From: support Date: Thu, 3 Nov 2022 16:38:44 +0000 (+0000) Subject: Built motion from commit 15712b09.|2.6.21 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;/%22avatar.png//%27?a=commitdiff_plain;h=a1b424b695b62c2112bb3eeb2dcd33f5ee8585bd;p=motion2.git Built motion from commit 15712b09.|2.6.21 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index d216b9d..1c7b53b 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-03T14:52:22.292Z", + "time": "2022-11-03T16:29:22.979Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 545087a..7676375 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-03T14:52:22.292Z", + "time": "2022-11-03T16:29:22.979Z", "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 6daa9e0..488121c 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 _0xe55d=['jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','getDataValue','action','STRING','contactManager','integration','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x541a87,_0x1fa04e){var _0x1db5b0=function(_0x9e58d3){while(--_0x9e58d3){_0x541a87['push'](_0x541a87['shift']());}};_0x1db5b0(++_0x1fa04e);}(_0xe55d,0x126));var _0xde55=function(_0xa31c12,_0x4881a4){_0xa31c12=_0xa31c12-0x0;var _0x646746=_0xe55d[_0xa31c12];return _0x646746;};'use strict';var Sequelize=require(_0xde55('0x0'));module[_0xde55('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2feb9d){return this[_0xde55('0x2')](_0xde55('0x3'));}},'action':{'type':Sequelize[_0xde55('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xde55('0x5'),_0xde55('0x6'),'motionbar',_0xde55('0x7'),_0xde55('0x8'),_0xde55('0x9'),'bot',_0xde55('0xa')]],'msg':_0xde55('0xb')}},'comment':_0xde55('0xb')},'data1':{'type':Sequelize[_0xde55('0x4')](0x1000),'comment':_0xde55('0xc')},'data2':{'type':Sequelize[_0xde55('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xde55('0x4')](0x1000),'comment':_0xde55('0xd')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xde55('0x4')](0x1000),'comments':_0xde55('0xe')},'data6':{'type':Sequelize['STRING'],'comments':_0xde55('0xf')},'data7':{'type':Sequelize[_0xde55('0x10')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xe6af=['script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','getDataValue','integration','motionbar','urlForward','browser','bot'];(function(_0x1cfe85,_0x7eb435){var _0x36cfd9=function(_0x466143){while(--_0x466143){_0x1cfe85['push'](_0x1cfe85['shift']());}};_0x36cfd9(++_0x7eb435);}(_0xe6af,0x106));var _0xfe6a=function(_0xb13baa,_0x2daca8){_0xb13baa=_0xb13baa-0x0;var _0x40be9c=_0xe6af[_0xb13baa];return _0x40be9c;};'use strict';var Sequelize=require('sequelize');module[_0xfe6a('0x0')]={'name':{'type':Sequelize[_0xfe6a('0x1')],'get':function(_0x43af40){return this[_0xfe6a('0x2')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xfe6a('0x3'),_0xfe6a('0x4'),'jscripty',_0xfe6a('0x5'),_0xfe6a('0x6'),_0xfe6a('0x7'),_0xfe6a('0x8')]],'msg':_0xfe6a('0x9')}},'comment':_0xfe6a('0x9')},'data1':{'type':Sequelize[_0xfe6a('0xa')](0x1000),'comment':_0xfe6a('0xb')},'data2':{'type':Sequelize[_0xfe6a('0xa')](0x1000),'comment':_0xfe6a('0xc')},'data3':{'type':Sequelize[_0xfe6a('0xa')](0x1000),'comment':_0xfe6a('0xd')},'data4':{'type':Sequelize[_0xfe6a('0xa')](0x1000),'comments':_0xfe6a('0xe')},'data5':{'type':Sequelize[_0xfe6a('0xa')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0xfe6a('0xf')},'data7':{'type':Sequelize[_0xfe6a('0x10')],'comments':_0xfe6a('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 3a311c5..1b2d6aa 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 _0x7501=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','stack','name','send','body','Action','find','params','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0xecf707,_0x2ff4b7){var _0x3e4060=function(_0x547c1f){while(--_0x547c1f){_0xecf707['push'](_0xecf707['shift']());}};_0x3e4060(++_0x2ff4b7);}(_0x7501,0x13c));var _0x1750=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x7501[_0xaa1b3e];return _0x454d7d;};'use strict';var emlformat=require(_0x1750('0x0'));var rimraf=require(_0x1750('0x1'));var zipdir=require(_0x1750('0x2'));var jsonpatch=require(_0x1750('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1750('0x4'));var Mustache=require(_0x1750('0x5'));var util=require(_0x1750('0x6'));var path=require(_0x1750('0x7'));var sox=require(_0x1750('0x8'));var csv=require(_0x1750('0x9'));var ejs=require(_0x1750('0xa'));var fs=require('fs');var fs_extra=require(_0x1750('0xb'));var _=require(_0x1750('0xc'));var squel=require(_0x1750('0xd'));var crypto=require(_0x1750('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1750('0x9'));var querystring=require('querystring');var Papa=require(_0x1750('0xf'));var Redis=require('ioredis');var authService=require(_0x1750('0x10'));var qs=require(_0x1750('0x11'));var as=require(_0x1750('0x12'));var hardwareService=require(_0x1750('0x13'));var logger=require('../../config/logger')(_0x1750('0x14'));var utils=require('../../config/utils');var config=require(_0x1750('0x15'));var licenseUtil=require(_0x1750('0x16'));var db=require(_0x1750('0x17'))['db'];function respondWithStatusCode(_0x34d95f,_0x2bb7df){_0x2bb7df=_0x2bb7df||0xcc;return function(_0x21ee54){if(_0x21ee54){return _0x34d95f['sendStatus'](_0x2bb7df);}return _0x34d95f[_0x1750('0x18')](_0x2bb7df)['end']();};}function respondWithResult(_0x3729b8,_0x5c6281){_0x5c6281=_0x5c6281||0xc8;return function(_0x4ec5f5){if(_0x4ec5f5){return _0x3729b8[_0x1750('0x18')](_0x5c6281)[_0x1750('0x19')](_0x4ec5f5);}};}function respondWithFilteredResult(_0x2acc14,_0x38ba66){return function(_0x4a7b8f){if(_0x4a7b8f){var _0xde35c2=typeof _0x38ba66[_0x1750('0x1a')]===_0x1750('0x1b')&&typeof _0x38ba66[_0x1750('0x1c')]===_0x1750('0x1b');var _0x36f800=_0x4a7b8f[_0x1750('0x1d')];var _0x354828=_0xde35c2?0x0:_0x38ba66[_0x1750('0x1a')];var _0x18cf50=_0xde35c2?_0x4a7b8f[_0x1750('0x1d')]:_0x38ba66['offset']+_0x38ba66[_0x1750('0x1c')];var _0xee6cfb;if(_0x18cf50>=_0x36f800){_0x18cf50=_0x36f800;_0xee6cfb=0xc8;}else{_0xee6cfb=0xce;}_0x2acc14[_0x1750('0x18')](_0xee6cfb);return _0x2acc14[_0x1750('0x1e')]('Content-Range',_0x354828+'-'+_0x18cf50+'/'+_0x36f800)[_0x1750('0x19')](_0x4a7b8f);}return null;};}function patchUpdates(_0x2f7335){return function(_0x489252){try{jsonpatch[_0x1750('0x1f')](_0x489252,_0x2f7335,!![]);}catch(_0x3b9f08){return BPromise[_0x1750('0x20')](_0x3b9f08);}return _0x489252[_0x1750('0x21')]();};}function saveUpdates(_0x5bee7a,_0x305894){return function(_0x4ac012){if(_0x4ac012){return _0x4ac012[_0x1750('0x22')](_0x5bee7a)['then'](function(_0x48ca6d){return _0x48ca6d;});}return null;};}function removeEntity(_0x4be0d5,_0xade833){return function(_0x2a3149){if(_0x2a3149){return _0x2a3149['destroy']()[_0x1750('0x23')](function(){_0x4be0d5[_0x1750('0x18')](0xcc)[_0x1750('0x24')]();});}};}function handleEntityNotFound(_0x3bfe7a,_0x530ff0){return function(_0x27fa6c){if(!_0x27fa6c){_0x3bfe7a['sendStatus'](0x194);}return _0x27fa6c;};}function handleError(_0x302833,_0x1b2f43){_0x1b2f43=_0x1b2f43||0x1f4;return function(_0x375f4e){logger['error'](_0x375f4e[_0x1750('0x25')]);if(_0x375f4e[_0x1750('0x26')]){delete _0x375f4e[_0x1750('0x26')];}_0x302833[_0x1750('0x18')](_0x1b2f43)[_0x1750('0x27')](_0x375f4e);};}exports[_0x1750('0x22')]=function(_0x25935b,_0xdfacd){if(_0x25935b[_0x1750('0x28')]['id']){delete _0x25935b[_0x1750('0x28')]['id'];}return db[_0x1750('0x29')][_0x1750('0x2a')]({'where':{'id':_0x25935b[_0x1750('0x2b')]['id']}})[_0x1750('0x23')](handleEntityNotFound(_0xdfacd,null))['then'](saveUpdates(_0x25935b[_0x1750('0x28')],null))[_0x1750('0x23')](respondWithResult(_0xdfacd,null))[_0x1750('0x2c')](handleError(_0xdfacd,null));};exports[_0x1750('0x2d')]=function(_0x56b3dd,_0x37235f){return db[_0x1750('0x29')]['find']({'where':{'id':_0x56b3dd['params']['id']}})[_0x1750('0x23')](handleEntityNotFound(_0x37235f,null))['then'](removeEntity(_0x37235f,null))[_0x1750('0x2c')](handleError(_0x37235f,null));}; \ No newline at end of file +var _0x5595=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','send','body','Action','find','params','catch','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x442fdf,_0x83c788){var _0x29432f=function(_0x30ff4a){while(--_0x30ff4a){_0x442fdf['push'](_0x442fdf['shift']());}};_0x29432f(++_0x83c788);}(_0x5595,0x19c));var _0x5559=function(_0x4414ed,_0x598f23){_0x4414ed=_0x4414ed-0x0;var _0x402ced=_0x5595[_0x4414ed];return _0x402ced;};'use strict';var emlformat=require(_0x5559('0x0'));var rimraf=require(_0x5559('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5559('0x2'));var moment=require(_0x5559('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5559('0x4'));var util=require('util');var path=require(_0x5559('0x5'));var sox=require(_0x5559('0x6'));var csv=require(_0x5559('0x7'));var ejs=require(_0x5559('0x8'));var fs=require('fs');var fs_extra=require(_0x5559('0x9'));var _=require(_0x5559('0xa'));var squel=require(_0x5559('0xb'));var crypto=require(_0x5559('0xc'));var jsforce=require(_0x5559('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5559('0x7'));var querystring=require(_0x5559('0xe'));var Papa=require(_0x5559('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5559('0x10'));var as=require(_0x5559('0x11'));var hardwareService=require(_0x5559('0x12'));var logger=require(_0x5559('0x13'))(_0x5559('0x14'));var utils=require(_0x5559('0x15'));var config=require(_0x5559('0x16'));var licenseUtil=require(_0x5559('0x17'));var db=require(_0x5559('0x18'))['db'];function respondWithStatusCode(_0x33e0f1,_0x4089d9){_0x4089d9=_0x4089d9||0xcc;return function(_0x258dcc){if(_0x258dcc){return _0x33e0f1[_0x5559('0x19')](_0x4089d9);}return _0x33e0f1[_0x5559('0x1a')](_0x4089d9)[_0x5559('0x1b')]();};}function respondWithResult(_0x29f537,_0x32b06e){_0x32b06e=_0x32b06e||0xc8;return function(_0xef928e){if(_0xef928e){return _0x29f537[_0x5559('0x1a')](_0x32b06e)[_0x5559('0x1c')](_0xef928e);}};}function respondWithFilteredResult(_0x362a53,_0xbd13c0){return function(_0x115479){if(_0x115479){var _0x263171=typeof _0xbd13c0[_0x5559('0x1d')]===_0x5559('0x1e')&&typeof _0xbd13c0[_0x5559('0x1f')]===_0x5559('0x1e');var _0x17ee55=_0x115479['count'];var _0x37ec41=_0x263171?0x0:_0xbd13c0[_0x5559('0x1d')];var _0x4be906=_0x263171?_0x115479[_0x5559('0x20')]:_0xbd13c0[_0x5559('0x1d')]+_0xbd13c0[_0x5559('0x1f')];var _0x27ba72;if(_0x4be906>=_0x17ee55){_0x4be906=_0x17ee55;_0x27ba72=0xc8;}else{_0x27ba72=0xce;}_0x362a53['status'](_0x27ba72);return _0x362a53[_0x5559('0x21')](_0x5559('0x22'),_0x37ec41+'-'+_0x4be906+'/'+_0x17ee55)[_0x5559('0x1c')](_0x115479);}return null;};}function patchUpdates(_0x193b52){return function(_0x14fc40){try{jsonpatch['apply'](_0x14fc40,_0x193b52,!![]);}catch(_0x4e1a08){return BPromise[_0x5559('0x23')](_0x4e1a08);}return _0x14fc40[_0x5559('0x24')]();};}function saveUpdates(_0x46e796,_0x352589){return function(_0x558436){if(_0x558436){return _0x558436[_0x5559('0x25')](_0x46e796)[_0x5559('0x26')](function(_0x43ba98){return _0x43ba98;});}return null;};}function removeEntity(_0x5aa3ab,_0xe4bc47){return function(_0x1f9f08){if(_0x1f9f08){return _0x1f9f08[_0x5559('0x27')]()['then'](function(){_0x5aa3ab[_0x5559('0x1a')](0xcc)[_0x5559('0x1b')]();});}};}function handleEntityNotFound(_0x33f290,_0x2a64d4){return function(_0x30e0bf){if(!_0x30e0bf){_0x33f290[_0x5559('0x19')](0x194);}return _0x30e0bf;};}function handleError(_0x38cf6a,_0x409897){_0x409897=_0x409897||0x1f4;return function(_0x370eec){logger[_0x5559('0x28')](_0x370eec[_0x5559('0x29')]);if(_0x370eec['name']){delete _0x370eec['name'];}_0x38cf6a[_0x5559('0x1a')](_0x409897)[_0x5559('0x2a')](_0x370eec);};}exports[_0x5559('0x25')]=function(_0x4ef1e3,_0x45e915){if(_0x4ef1e3[_0x5559('0x2b')]['id']){delete _0x4ef1e3[_0x5559('0x2b')]['id'];}return db[_0x5559('0x2c')][_0x5559('0x2d')]({'where':{'id':_0x4ef1e3[_0x5559('0x2e')]['id']}})['then'](handleEntityNotFound(_0x45e915,null))[_0x5559('0x26')](saveUpdates(_0x4ef1e3[_0x5559('0x2b')],null))[_0x5559('0x26')](respondWithResult(_0x45e915,null))[_0x5559('0x2f')](handleError(_0x45e915,null));};exports[_0x5559('0x27')]=function(_0x5be500,_0x95a263){return db[_0x5559('0x2c')][_0x5559('0x2d')]({'where':{'id':_0x5be500[_0x5559('0x2e')]['id']}})[_0x5559('0x26')](handleEntityNotFound(_0x95a263,null))[_0x5559('0x26')](removeEntity(_0x95a263,null))[_0x5559('0x2f')](handleError(_0x95a263,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index af7f006..603a34f 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 _0x4ac8=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./action.attributes','define','Action','tools_actions'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x4ac8,0x108));var _0x84ac=function(_0x5684bc,_0x2e91b7){_0x5684bc=_0x5684bc-0x0;var _0x2a5b02=_0x4ac8[_0x5684bc];return _0x2a5b02;};'use strict';var _=require(_0x84ac('0x0'));var util=require('util');var logger=require(_0x84ac('0x1'))(_0x84ac('0x2'));var moment=require(_0x84ac('0x3'));var BPromise=require(_0x84ac('0x4'));var rp=require(_0x84ac('0x5'));var fs=require('fs');var path=require(_0x84ac('0x6'));var rimraf=require('rimraf');var config=require(_0x84ac('0x7'));var attributes=require(_0x84ac('0x8'));module['exports']=function(_0x2f01dc,_0x2baee2){return _0x2f01dc[_0x84ac('0x9')](_0x84ac('0xa'),attributes,{'tableName':_0x84ac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7e8=['rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xa7e8,0x132));var _0x8a7e=function(_0x1a636e,_0x3d21d3){_0x1a636e=_0x1a636e-0x0;var _0x12f435=_0xa7e8[_0x1a636e];return _0x12f435;};'use strict';var _=require(_0x8a7e('0x0'));var util=require(_0x8a7e('0x1'));var logger=require(_0x8a7e('0x2'))('api');var moment=require(_0x8a7e('0x3'));var BPromise=require(_0x8a7e('0x4'));var rp=require(_0x8a7e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a7e('0x6'));var config=require(_0x8a7e('0x7'));var attributes=require(_0x8a7e('0x8'));module[_0x8a7e('0x9')]=function(_0x40cfc8,_0x3ee5f2){return _0x40cfc8[_0x8a7e('0xa')](_0x8a7e('0xb'),attributes,{'tableName':_0x8a7e('0xc'),'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 1c2145a..73888ad 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x7217,0x19e));var _0x7721=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x7217[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x47fc1a,_0x4bcf7f){var _0x1691ab=function(_0xdb9ce2){while(--_0xdb9ce2){_0x47fc1a['push'](_0x47fc1a['shift']());}};_0x1691ab(++_0x4bcf7f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var 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')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index d6f4b6d..c5f7b55 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 _0x397d=['path','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','update','delete','isAuthenticated','destroy','multer','util'];(function(_0x4d36a4,_0x303dd0){var _0x8d4548=function(_0x295887){while(--_0x295887){_0x4d36a4['push'](_0x4d36a4['shift']());}};_0x8d4548(++_0x303dd0);}(_0x397d,0x1c5));var _0xd397=function(_0xf38b7d,_0x519dd5){_0xf38b7d=_0xf38b7d-0x0;var _0x2f250d=_0x397d[_0xf38b7d];return _0x2f250d;};'use strict';var multer=require(_0xd397('0x0'));var util=require(_0xd397('0x1'));var path=require(_0xd397('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd397('0x3')]();var fs_extra=require(_0xd397('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd397('0x5'));var config=require(_0xd397('0x6'));var controller=require(_0xd397('0x7'));router[_0xd397('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd397('0x9')]);router[_0xd397('0xa')]('/:id',auth[_0xd397('0xb')](),controller[_0xd397('0xc')]);module['exports']=router; \ No newline at end of file +var _0x125f=['isAuthenticated','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','/:id'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x125f,0xe5));var _0xf125=function(_0x31850b,_0x4584c1){_0x31850b=_0x31850b-0x0;var _0x292dfc=_0x125f[_0x31850b];return _0x292dfc;};'use strict';var multer=require(_0xf125('0x0'));var util=require(_0xf125('0x1'));var path=require(_0xf125('0x2'));var timeout=require('connect-timeout');var express=require(_0xf125('0x3'));var router=express[_0xf125('0x4')]();var fs_extra=require(_0xf125('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf125('0x6'));var config=require(_0xf125('0x7'));var controller=require(_0xf125('0x8'));router[_0xf125('0x9')](_0xf125('0xa'),auth[_0xf125('0xb')](),controller[_0xf125('0xc')]);router[_0xf125('0xd')](_0xf125('0xa'),auth['isAuthenticated'](),controller[_0xf125('0xe')]);module[_0xf125('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index c8c62a7..e085c39 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 _0x5fab=['exports','STRING','TEXT','sequelize'];(function(_0x571f36,_0x58551e){var _0x12724f=function(_0x6e7d5f){while(--_0x6e7d5f){_0x571f36['push'](_0x571f36['shift']());}};_0x12724f(++_0x58551e);}(_0x5fab,0x177));var _0xb5fa=function(_0x2d9f26,_0x10e8dd){_0x2d9f26=_0x2d9f26-0x0;var _0x5c7562=_0x5fab[_0x2d9f26];return _0x5c7562;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb5fa('0x2')]},'parent':{'type':Sequelize[_0xb5fa('0x2')]},'table':{'type':Sequelize[_0xb5fa('0x2')]},'conditions':{'type':Sequelize[_0xb5fa('0x3')]},'joins':{'type':Sequelize[_0xb5fa('0x3')]}}; \ No newline at end of file +var _0x5075=['exports','STRING','TEXT','sequelize'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x5075,0x73));var _0x5507=function(_0x1d128e,_0x2c87de){_0x1d128e=_0x1d128e-0x0;var _0x3d5236=_0x5075[_0x1d128e];return _0x3d5236;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'name':{'type':Sequelize[_0x5507('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5507('0x2')]},'parent':{'type':Sequelize[_0x5507('0x2')]},'table':{'type':Sequelize[_0x5507('0x2')]},'conditions':{'type':Sequelize[_0x5507('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 deebfac..3e7c152 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 _0x2f65=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','rows','catch','show','params','AnalyticCustomReport','include','find','create','body','user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\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\x20NOT\x20EMPTY','rules','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','function','replace','format','groupBy','orderBy','field','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','MAX(%s)','operator','Sequelize','metric','DESC','output','web','fullPath','%s-%s.%s','randomstring','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','count','limit','set','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','stack','name','index','map','rawAttributes','fieldName','type'];(function(_0x20b621,_0x941a38){var _0xd7269e=function(_0x2544bf){while(--_0x2544bf){_0x20b621['push'](_0x20b621['shift']());}};_0xd7269e(++_0x941a38);}(_0x2f65,0x112));var _0x52f6=function(_0x2ee61a,_0x4141e3){_0x2ee61a=_0x2ee61a-0x0;var _0x5ad063=_0x2f65[_0x2ee61a];return _0x5ad063;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x52f6('0x0'));var zipdir=require(_0x52f6('0x1'));var jsonpatch=require(_0x52f6('0x2'));var rp=require(_0x52f6('0x3'));var moment=require(_0x52f6('0x4'));var BPromise=require(_0x52f6('0x5'));var Mustache=require(_0x52f6('0x6'));var util=require(_0x52f6('0x7'));var path=require(_0x52f6('0x8'));var sox=require(_0x52f6('0x9'));var csv=require(_0x52f6('0xa'));var ejs=require(_0x52f6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x52f6('0xc'));var crypto=require(_0x52f6('0xd'));var jsforce=require(_0x52f6('0xe'));var deskjs=require(_0x52f6('0xf'));var toCsv=require(_0x52f6('0xa'));var querystring=require(_0x52f6('0x10'));var Papa=require(_0x52f6('0x11'));var Redis=require(_0x52f6('0x12'));var authService=require(_0x52f6('0x13'));var qs=require(_0x52f6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x52f6('0x15'))(_0x52f6('0x16'));var utils=require(_0x52f6('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x52f6('0x18'))['db'];var dbH=require(_0x52f6('0x18'))['dbH'];function respondWithStatusCode(_0x3e15d5,_0x307c09){_0x307c09=_0x307c09||0xcc;return function(_0x4b092e){if(_0x4b092e){return _0x3e15d5[_0x52f6('0x19')](_0x307c09);}return _0x3e15d5['status'](_0x307c09)[_0x52f6('0x1a')]();};}function respondWithResult(_0x5bd7e6,_0x3dff0b){_0x3dff0b=_0x3dff0b||0xc8;return function(_0x8e6e89){if(_0x8e6e89){return _0x5bd7e6[_0x52f6('0x1b')](_0x3dff0b)[_0x52f6('0x1c')](_0x8e6e89);}};}function respondWithFilteredResult(_0x5825d6,_0x126c90){return function(_0x1321fb){if(_0x1321fb){var _0x31c95d=typeof _0x126c90[_0x52f6('0x1d')]==='undefined'&&typeof _0x126c90['limit']==='undefined';var _0x30ff49=_0x1321fb[_0x52f6('0x1e')];var _0x365396=_0x31c95d?0x0:_0x126c90[_0x52f6('0x1d')];var _0x48dae7=_0x31c95d?_0x1321fb['count']:_0x126c90['offset']+_0x126c90[_0x52f6('0x1f')];var _0x4f9ada;if(_0x48dae7>=_0x30ff49){_0x48dae7=_0x30ff49;_0x4f9ada=0xc8;}else{_0x4f9ada=0xce;}_0x5825d6[_0x52f6('0x1b')](_0x4f9ada);return _0x5825d6[_0x52f6('0x20')](_0x52f6('0x21'),_0x365396+'-'+_0x48dae7+'/'+_0x30ff49)['json'](_0x1321fb);}return null;};}function patchUpdates(_0x3ef1d9){return function(_0x2531ec){try{jsonpatch[_0x52f6('0x22')](_0x2531ec,_0x3ef1d9,!![]);}catch(_0x5e48c2){return BPromise[_0x52f6('0x23')](_0x5e48c2);}return _0x2531ec['save']();};}function saveUpdates(_0xc20de1,_0x424160){return function(_0x3c533f){if(_0x3c533f){return _0x3c533f[_0x52f6('0x24')](_0xc20de1)['then'](function(_0x10d879){return _0x10d879;});}return null;};}function removeEntity(_0x3af732,_0x2ffd2b){return function(_0x1e2535){if(_0x1e2535){return _0x1e2535['destroy']()[_0x52f6('0x25')](function(){var _0x17a150=_0x1e2535[_0x52f6('0x26')]({'plain':!![]});var _0xdbeab8='CustomReports';return db[_0x52f6('0x27')][_0x52f6('0x28')]({'where':{'type':_0xdbeab8,'resourceId':_0x17a150['id']}})[_0x52f6('0x25')](function(){return _0x1e2535;});})[_0x52f6('0x25')](function(){_0x3af732[_0x52f6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x517974,_0x469fb2){return function(_0x5546bd){if(!_0x5546bd){_0x517974['sendStatus'](0x194);}return _0x5546bd;};}function handleError(_0xf16ee2,_0x5eb381){_0x5eb381=_0x5eb381||0x1f4;return function(_0x3318e1){logger['error'](_0x3318e1[_0x52f6('0x29')]);if(_0x3318e1[_0x52f6('0x2a')]){delete _0x3318e1[_0x52f6('0x2a')];}_0xf16ee2[_0x52f6('0x1b')](_0x5eb381)['send'](_0x3318e1);};}exports[_0x52f6('0x2b')]=function(_0x42c867,_0x51de12){var _0xdce504={},_0x34d598={},_0x5a7d08={'count':0x0,'rows':[]};var _0x224984=_[_0x52f6('0x2c')](db['AnalyticCustomReport'][_0x52f6('0x2d')],function(_0x465136){return{'name':_0x465136[_0x52f6('0x2e')],'type':_0x465136[_0x52f6('0x2f')]['key']};});_0x34d598[_0x52f6('0x30')]=_[_0x52f6('0x2c')](_0x224984,_0x52f6('0x2a'));_0x34d598[_0x52f6('0x31')]=_[_0x52f6('0x32')](_0x42c867['query']);_0x34d598[_0x52f6('0x33')]=_[_0x52f6('0x34')](_0x34d598['model'],_0x34d598['query']);_0xdce504[_0x52f6('0x35')]=_[_0x52f6('0x34')](_0x34d598[_0x52f6('0x30')],qs[_0x52f6('0x36')](_0x42c867['query']['fields']));_0xdce504['attributes']=_0xdce504[_0x52f6('0x35')][_0x52f6('0x37')]?_0xdce504['attributes']:_0x34d598['model'];if(!_0x42c867[_0x52f6('0x31')][_0x52f6('0x38')]('nolimit')){_0xdce504[_0x52f6('0x1f')]=qs[_0x52f6('0x1f')](_0x42c867['query']['limit']);_0xdce504[_0x52f6('0x1d')]=qs[_0x52f6('0x1d')](_0x42c867[_0x52f6('0x31')][_0x52f6('0x1d')]);}_0xdce504[_0x52f6('0x39')]=qs[_0x52f6('0x3a')](_0x42c867[_0x52f6('0x31')][_0x52f6('0x3a')]);_0xdce504['where']=qs[_0x52f6('0x33')](_[_0x52f6('0x3b')](_0x42c867['query'],_0x34d598[_0x52f6('0x33')]),_0x224984);if(_0x42c867[_0x52f6('0x31')][_0x52f6('0x3c')]){_0xdce504[_0x52f6('0x3d')]=_[_0x52f6('0x3e')](_0xdce504[_0x52f6('0x3d')],{'$or':_[_0x52f6('0x2c')](_0x224984,function(_0x5695f7){if(_0x5695f7['type']!=='VIRTUAL'){var _0x369654={};_0x369654[_0x5695f7[_0x52f6('0x2a')]]={'$like':'%'+_0x42c867[_0x52f6('0x31')][_0x52f6('0x3c')]+'%'};return _0x369654;}})});}_0xdce504=_['merge']({},_0xdce504,_0x42c867[_0x52f6('0x3f')]);var _0x4ab03f={'where':_0xdce504[_0x52f6('0x3d')]};return db['AnalyticCustomReport'][_0x52f6('0x1e')](_0x4ab03f)[_0x52f6('0x25')](function(_0xdd4ca3){_0x5a7d08[_0x52f6('0x1e')]=_0xdd4ca3;if(_0x42c867['query'][_0x52f6('0x40')]){_0xdce504['include']=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0xdce504);})['then'](function(_0x489542){_0x5a7d08[_0x52f6('0x41')]=_0x489542;return _0x5a7d08;})[_0x52f6('0x25')](respondWithFilteredResult(_0x51de12,_0xdce504))[_0x52f6('0x42')](handleError(_0x51de12,null));};exports[_0x52f6('0x43')]=function(_0x380e57,_0x1ebbca){var _0x583ce1={'raw':![],'where':{'id':_0x380e57[_0x52f6('0x44')]['id']}},_0x57d480={};_0x57d480['model']=_['keys'](db[_0x52f6('0x45')]['rawAttributes']);_0x57d480[_0x52f6('0x31')]=_[_0x52f6('0x32')](_0x380e57[_0x52f6('0x31')]);_0x57d480['filters']=_[_0x52f6('0x34')](_0x57d480[_0x52f6('0x30')],_0x57d480[_0x52f6('0x31')]);_0x583ce1[_0x52f6('0x35')]=_[_0x52f6('0x34')](_0x57d480[_0x52f6('0x30')],qs[_0x52f6('0x36')](_0x380e57['query'][_0x52f6('0x36')]));_0x583ce1[_0x52f6('0x35')]=_0x583ce1[_0x52f6('0x35')]['length']?_0x583ce1[_0x52f6('0x35')]:_0x57d480['model'];if(_0x380e57[_0x52f6('0x31')][_0x52f6('0x40')]){_0x583ce1[_0x52f6('0x46')]=[{'all':!![]}];}_0x583ce1=_[_0x52f6('0x3e')]({},_0x583ce1,_0x380e57[_0x52f6('0x3f')]);return db[_0x52f6('0x45')][_0x52f6('0x47')](_0x583ce1)[_0x52f6('0x25')](handleEntityNotFound(_0x1ebbca,null))[_0x52f6('0x25')](respondWithResult(_0x1ebbca,null))[_0x52f6('0x42')](handleError(_0x1ebbca,null));};exports['create']=function(_0x16184e,_0x600aff){return db[_0x52f6('0x45')][_0x52f6('0x48')](_0x16184e[_0x52f6('0x49')],{})[_0x52f6('0x25')](function(_0x2b0621){var _0x16cb39=_0x16184e[_0x52f6('0x4a')][_0x52f6('0x26')]({'plain':!![]});if(!_0x16cb39)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16cb39[_0x52f6('0x4b')]===_0x52f6('0x4a')){var _0x267467=_0x2b0621[_0x52f6('0x26')]({'plain':!![]});var _0x289c8d=_0x52f6('0x4c');return db[_0x52f6('0x4d')][_0x52f6('0x47')]({'where':{'name':_0x289c8d,'userProfileId':_0x16cb39[_0x52f6('0x4e')]},'raw':!![]})[_0x52f6('0x25')](function(_0x389613){if(_0x389613&&_0x389613[_0x52f6('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x267467[_0x52f6('0x2a')],'resourceId':_0x267467['id'],'type':'CustomReports','sectionId':_0x389613['id']},{})[_0x52f6('0x25')](function(){return _0x2b0621;});}else{return _0x2b0621;}})[_0x52f6('0x42')](function(_0x431db4){logger['error'](_0x52f6('0x50'),_0x431db4);throw _0x431db4;});}return _0x2b0621;})[_0x52f6('0x25')](respondWithResult(_0x600aff,0xc9))[_0x52f6('0x42')](handleError(_0x600aff,null));};exports[_0x52f6('0x24')]=function(_0x75f331,_0xf481a1){if(_0x75f331[_0x52f6('0x49')]['id']){delete _0x75f331['body']['id'];}return db['AnalyticCustomReport'][_0x52f6('0x47')]({'where':{'id':_0x75f331[_0x52f6('0x44')]['id']}})[_0x52f6('0x25')](handleEntityNotFound(_0xf481a1,null))[_0x52f6('0x25')](saveUpdates(_0x75f331['body'],null))[_0x52f6('0x25')](respondWithResult(_0xf481a1,null))['catch'](handleError(_0xf481a1,null));};exports[_0x52f6('0x28')]=function(_0x2ce1b9,_0x1fd9ca){return db[_0x52f6('0x45')]['find']({'where':{'id':_0x2ce1b9['params']['id']}})[_0x52f6('0x25')](handleEntityNotFound(_0x1fd9ca,null))[_0x52f6('0x25')](removeEntity(_0x1fd9ca,null))[_0x52f6('0x42')](handleError(_0x1fd9ca,null));};exports[_0x52f6('0x51')]=function(_0x50261a,_0x5849bd){var _0x1ced39=0xa;var _0x3f4e15=[_0x52f6('0x52'),_0x52f6('0x53'),_0x52f6('0x54'),_0x52f6('0x55')];var _0x25cac2={'SUM':_0x52f6('0x56'),'COUNT':_0x52f6('0x57'),'COUNT DISTINCT':_0x52f6('0x58'),'MAX':'MAX(%s)','MIN':_0x52f6('0x59'),'AVG':_0x52f6('0x5a'),'GROUP_CONCAT':_0x52f6('0x5b'),'GROUP_CONCAT ASC':_0x52f6('0x5c'),'GROUP_CONCAT DESC':_0x52f6('0x5d')};var _0x2ea7e0={'SEC_TO_TIME':_0x52f6('0x5e'),'DATE':_0x52f6('0x5f'),'HOUR':_0x52f6('0x60'),'ROUND':_0x52f6('0x61'),'UNIX_TIMESTAMP':_0x52f6('0x62')};var _0x336a12=function(_0x5debcb){return!_[_0x52f6('0x63')]([_0x52f6('0x64'),_0x52f6('0x65'),'IS\x20EMPTY',_0x52f6('0x66')],_0x5debcb);};var _0x3d30cc=function(_0x571dd4){if(!_0x571dd4||!_0x571dd4[_0x52f6('0x67')]['length']){return'';}for(var _0x498ffa='(',_0x265fab=0x0;_0x265fab<_0x571dd4[_0x52f6('0x67')][_0x52f6('0x37')];_0x265fab+=0x1){_0x265fab>0x0&&(_0x498ffa+='\x20'+_0x571dd4['operator']+'\x20');_0x498ffa+=_0x571dd4[_0x52f6('0x67')][_0x265fab][_0x52f6('0x68')]?_0x3d30cc(_0x571dd4[_0x52f6('0x67')][_0x265fab][_0x52f6('0x68')]):_0x571dd4[_0x52f6('0x67')][_0x265fab]['field']+'\x20'+_0x571dd4['rules'][_0x265fab][_0x52f6('0x69')]+(_0x336a12(_0x571dd4['rules'][_0x265fab][_0x52f6('0x69')])?'\x20'+_0x571dd4[_0x52f6('0x67')][_0x265fab][_0x52f6('0x6a')]:'');}return _0x498ffa+')';};var _0xabe05b={'where':{'id':_0x50261a['params']['id']}},_0x28be83,_0x473cb0,_0xa2ba45,_0x11e4b7,_0x3d3c88;_0xabe05b=_[_0x52f6('0x3e')]({},_0xabe05b,_0x50261a[_0x52f6('0x3f')]);return db['AnalyticCustomReport'][_0x52f6('0x47')](_0xabe05b)['then'](function(_0x5c1916){if(_0x5c1916){_0x28be83=_0x5c1916;return _0x5c1916[_0x52f6('0x6b')]();}return null;})['then'](function(_0x21f6aa){if(_0x21f6aa){if(!_0x21f6aa[_0x52f6('0x37')]){throw new db['Sequelize'][(_0x52f6('0x6c'))](_0x52f6('0x6d'),0x193);}_0x473cb0=_0x21f6aa;return db[_0x52f6('0x6e')][_0x52f6('0x6f')]({'raw':!![]});}return null;})[_0x52f6('0x25')](function(_0x42c8f4){if(_0x42c8f4){_0xa2ba45=_[_0x52f6('0x70')](_0x42c8f4,'id');var _0x544779;var _0x48a65a=squel[_0x52f6('0x71')]();_0x48a65a[_0x52f6('0x72')](_0x28be83['table']);for(var _0x36c781=0x0;_0x36c781<_0x473cb0[_0x52f6('0x37')];_0x36c781+=0x1){_0x544779=_0x473cb0[_0x36c781][_0x52f6('0x73')]?_0xa2ba45[_0x473cb0[_0x36c781][_0x52f6('0x73')]]['metric']:_0x473cb0[_0x36c781]['field'];_0x544779=_0x473cb0[_0x36c781][_0x52f6('0x74')]?_[_0x52f6('0x75')](_0x25cac2[_0x473cb0[_0x36c781][_0x52f6('0x74')]],'%s',_0x544779):_0x544779;_0x544779=_0x473cb0[_0x36c781][_0x52f6('0x76')]?_[_0x52f6('0x75')](_0x2ea7e0[_0x473cb0[_0x36c781]['format']],'%s',_0x544779):_0x544779;if(_0x473cb0[_0x36c781][_0x52f6('0x77')]){_0x48a65a[_0x52f6('0x68')](_0x544779);}_0x473cb0[_0x36c781]['orderBy']&&_0x48a65a[_0x52f6('0x39')](_0x544779,_0x473cb0[_0x36c781][_0x52f6('0x78')]==='DESC'?![]:!![]);_0x48a65a[_0x52f6('0x79')](_0x544779,_0x473cb0[_0x36c781][_0x52f6('0x7a')]||_0x544779);}if(_0x28be83['joins']){_0x28be83['joins']=JSON['parse'](_0x28be83[_0x52f6('0x7b')]);for(var _0x3dd356=0x0;_0x3dd356<_0x28be83['joins'][_0x52f6('0x37')];_0x3dd356+=0x1){if(_0x28be83[_0x52f6('0x7b')][_0x3dd356][_0x52f6('0x2f')]&&_[_0x52f6('0x63')](_0x3f4e15,_0x28be83[_0x52f6('0x7b')][_0x3dd356][_0x52f6('0x2f')])&&_0x28be83[_0x52f6('0x7b')][_0x3dd356][_0x52f6('0x7c')]&&_0x28be83[_0x52f6('0x7b')][_0x3dd356][_0x52f6('0x7d')]&&_0x28be83['joins'][_0x3dd356][_0x52f6('0x7e')]){_0x48a65a[_0x28be83[_0x52f6('0x7b')][_0x3dd356]['type']](_0x28be83['joins'][_0x3dd356]['foreignTable'],null,util[_0x52f6('0x76')](_0x52f6('0x7f'),_0x28be83[_0x52f6('0x80')],_0x28be83[_0x52f6('0x7b')][_0x3dd356][_0x52f6('0x7c')],_0x28be83['joins'][_0x3dd356][_0x52f6('0x7d')],_0x28be83['joins'][_0x3dd356][_0x52f6('0x7e')]));}}}if(_0x28be83[_0x52f6('0x81')]){_0x28be83[_0x52f6('0x81')]=JSON[_0x52f6('0x82')](_0x28be83[_0x52f6('0x81')]);_0x48a65a[_0x52f6('0x3d')](_0x3d30cc(_0x28be83[_0x52f6('0x81')][_0x52f6('0x68')]));}_0x3d3c88=_0x48a65a[_0x52f6('0x83')]();_0x48a65a[_0x52f6('0x1f')](_0x1ced39);_0x48a65a[_0x52f6('0x1d')](0x0);logger[_0x52f6('0x84')]('Limited\x20Query:',_0x48a65a[_0x52f6('0x85')]());return dbH[_0x52f6('0x86')][_0x52f6('0x31')](_0x48a65a[_0x52f6('0x85')](),{'type':dbH[_0x52f6('0x86')][_0x52f6('0x87')][_0x52f6('0x88')]});}})[_0x52f6('0x25')](respondWithResult(_0x5849bd,null))[_0x52f6('0x42')](handleError(_0x5849bd,null));};function runReport(_0x1e2008,_0x114621,_0xfaf034){var _0x5094aa=_0x114621[_0x52f6('0x2a')];var _0x47a8c3=0xa;var _0x560e47=[_0x52f6('0x52'),_0x52f6('0x53'),_0x52f6('0x54'),_0x52f6('0x55')];var _0x30afe4={'SUM':_0x52f6('0x56'),'COUNT':_0x52f6('0x57'),'COUNT DISTINCT':_0x52f6('0x58'),'MAX':_0x52f6('0x89'),'MIN':_0x52f6('0x59'),'AVG':_0x52f6('0x5a'),'GROUP_CONCAT':_0x52f6('0x5b'),'GROUP_CONCAT ASC':_0x52f6('0x5c'),'GROUP_CONCAT DESC':_0x52f6('0x5d')};var _0x4d81e1={'SEC_TO_TIME':_0x52f6('0x5e'),'DATE':'DATE(%s)','HOUR':_0x52f6('0x60'),'ROUND':_0x52f6('0x61'),'UNIX_TIMESTAMP':_0x52f6('0x62')};var _0x428597=function(_0x25f313){return!_['includes']([_0x52f6('0x64'),_0x52f6('0x65'),'IS\x20EMPTY',_0x52f6('0x66')],_0x25f313);};var _0x4d012f=function(_0x555fec){if(!_0x555fec||!_0x555fec[_0x52f6('0x67')]['length']){return'';}for(var _0x256202='(',_0x3aee8c=0x0;_0x3aee8c<_0x555fec[_0x52f6('0x67')]['length'];_0x3aee8c+=0x1){_0x3aee8c>0x0&&(_0x256202+='\x20'+_0x555fec[_0x52f6('0x8a')]+'\x20');_0x256202+=_0x555fec[_0x52f6('0x67')][_0x3aee8c][_0x52f6('0x68')]?_0x4d012f(_0x555fec[_0x52f6('0x67')][_0x3aee8c][_0x52f6('0x68')]):_0x555fec[_0x52f6('0x67')][_0x3aee8c]['field']+'\x20'+_0x555fec[_0x52f6('0x67')][_0x3aee8c][_0x52f6('0x69')]+(_0x428597(_0x555fec['rules'][_0x3aee8c][_0x52f6('0x69')])?'\x20'+_0x555fec[_0x52f6('0x67')][_0x3aee8c]['value']:'');}return _0x256202+')';};var _0x13d2a5={'where':{'id':_0x1e2008['id']}},_0x2f6e45,_0x372b81,_0x3f0ff0,_0x193a05,_0x106a37;_0x13d2a5=_[_0x52f6('0x3e')]({},_0x13d2a5,_0xfaf034);return db[_0x52f6('0x45')][_0x52f6('0x47')](_0x13d2a5)[_0x52f6('0x25')](function(_0x7da1a2){if(_0x7da1a2){_0x2f6e45=_0x7da1a2;return _0x7da1a2[_0x52f6('0x6b')]();}return null;})[_0x52f6('0x25')](function(_0x1ca834){if(_0x1ca834){if(!_0x1ca834[_0x52f6('0x37')]){throw new db[(_0x52f6('0x8b'))]['ValidationErrorItem'](_0x52f6('0x6d'),0x193);}_0x372b81=_0x1ca834;return db[_0x52f6('0x6e')][_0x52f6('0x6f')]({'raw':!![]});}return null;})['then'](function(_0x365f2f){if(_0x365f2f){_0x3f0ff0=_[_0x52f6('0x70')](_0x365f2f,'id');var _0x11c72a;var _0x31cab4=squel['select']();_0x31cab4[_0x52f6('0x72')](_0x2f6e45['table']);for(var _0x5ef97c=0x0;_0x5ef97c<_0x372b81['length'];_0x5ef97c+=0x1){_0x11c72a=_0x372b81[_0x5ef97c][_0x52f6('0x73')]?_0x3f0ff0[_0x372b81[_0x5ef97c][_0x52f6('0x73')]][_0x52f6('0x8c')]:_0x372b81[_0x5ef97c][_0x52f6('0x79')];_0x11c72a=_0x372b81[_0x5ef97c][_0x52f6('0x74')]?_[_0x52f6('0x75')](_0x30afe4[_0x372b81[_0x5ef97c][_0x52f6('0x74')]],'%s',_0x11c72a):_0x11c72a;_0x11c72a=_0x372b81[_0x5ef97c][_0x52f6('0x76')]?_['replace'](_0x4d81e1[_0x372b81[_0x5ef97c][_0x52f6('0x76')]],'%s',_0x11c72a):_0x11c72a;if(_0x372b81[_0x5ef97c][_0x52f6('0x77')]){_0x31cab4['group'](_0x11c72a);}_0x372b81[_0x5ef97c][_0x52f6('0x78')]&&_0x31cab4[_0x52f6('0x39')](_0x11c72a,_0x372b81[_0x5ef97c]['orderBy']===_0x52f6('0x8d')?![]:!![]);_0x31cab4[_0x52f6('0x79')](_0x11c72a,_0x372b81[_0x5ef97c][_0x52f6('0x7a')]||_0x11c72a);}if(_0x2f6e45[_0x52f6('0x7b')]){_0x2f6e45['joins']=JSON[_0x52f6('0x82')](_0x2f6e45[_0x52f6('0x7b')]);for(var _0x1a45ac=0x0;_0x1a45ac<_0x2f6e45[_0x52f6('0x7b')]['length'];_0x1a45ac+=0x1){if(_0x2f6e45[_0x52f6('0x7b')][_0x1a45ac]['type']&&_[_0x52f6('0x63')](_0x560e47,_0x2f6e45[_0x52f6('0x7b')][_0x1a45ac][_0x52f6('0x2f')])&&_0x2f6e45[_0x52f6('0x7b')][_0x1a45ac][_0x52f6('0x7c')]&&_0x2f6e45[_0x52f6('0x7b')][_0x1a45ac][_0x52f6('0x7d')]&&_0x2f6e45[_0x52f6('0x7b')][_0x1a45ac]['foreignKey']){_0x31cab4[_0x2f6e45['joins'][_0x1a45ac][_0x52f6('0x2f')]](_0x2f6e45[_0x52f6('0x7b')][_0x1a45ac][_0x52f6('0x7d')],null,util[_0x52f6('0x76')](_0x52f6('0x7f'),_0x2f6e45[_0x52f6('0x80')],_0x2f6e45[_0x52f6('0x7b')][_0x1a45ac][_0x52f6('0x7c')],_0x2f6e45['joins'][_0x1a45ac][_0x52f6('0x7d')],_0x2f6e45[_0x52f6('0x7b')][_0x1a45ac][_0x52f6('0x7e')]));}}}if(_0x2f6e45[_0x52f6('0x81')]){_0x2f6e45['conditions']=JSON[_0x52f6('0x82')](_0x2f6e45[_0x52f6('0x81')]);_0x31cab4[_0x52f6('0x3d')](_0x4d012f(_0x2f6e45[_0x52f6('0x81')]['group']));}_0x106a37=_0x31cab4['clone']();_0x31cab4['limit'](_0x47a8c3);_0x31cab4[_0x52f6('0x1d')](0x0);return;}})['then'](function(){if(_0x114621[_0x52f6('0x8e')]===_0x52f6('0x8f')){return null;}var _0x1ced5b=_[_0x52f6('0x3e')](_0x114621,{'name':_0x114621[_0x52f6('0x90')]||_0x114621[_0x52f6('0x2a')]||_0x2f6e45[_0x52f6('0x2a')],'basename':_0x5094aa,'savename':util['format'](_0x52f6('0x91'),_0x114621['name']||_0x2f6e45['name'],require(_0x52f6('0x92'))['generate'](0x4),_0x114621['output']||_0x52f6('0x93')),'reportId':_0x2f6e45['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x52f6('0x48')](_0x1ced5b,{'raw':!![]});})[_0x52f6('0x25')](function(_0x1de668){if(_0x2f6e45[_0x52f6('0x80')]===_0x52f6('0x94')){_0x106a37[_0x52f6('0x3d')](_0x2f6e45['table']+_0x52f6('0x95'),_0x114621[_0x52f6('0x96')],_0x114621[_0x52f6('0x97')]);}else{_0x106a37['where'](_0x2f6e45[_0x52f6('0x80')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x114621[_0x52f6('0x96')],_0x114621[_0x52f6('0x97')]);}if(_0x1de668){logger[_0x52f6('0x98')](_0x52f6('0x99'),_0x106a37[_0x52f6('0x85')]());require('child_process')['fork'](path[_0x52f6('0x52')](__dirname,_0x52f6('0x9a'),_0x1de668['output']),[_0x1de668['id'],_0x106a37['toString'](),path[_0x52f6('0x52')](__dirname,_0x52f6('0x9b'),_0x1de668[_0x52f6('0x9c')]),_0x5094aa]);return _0x1de668;}else{var _0x485ee5=squel['select']();_0x485ee5[_0x52f6('0x72')]('('+_0x106a37[_0x52f6('0x85')]()+')','countTable');_0x485ee5['field'](_0x52f6('0x9d'),_0x52f6('0x1e'));_0x106a37[_0x52f6('0x1f')](_0x114621[_0x52f6('0x1f')]||_0x47a8c3);_0x106a37[_0x52f6('0x1d')](_0x114621[_0x52f6('0x1d')]||0x0);return dbH[_0x52f6('0x86')][_0x52f6('0x31')](_0x485ee5['toString'](),{'type':dbH[_0x52f6('0x86')][_0x52f6('0x87')]['SELECT']})[_0x52f6('0x25')](function(_0x3a433c){if(!_0x3a433c[_0x52f6('0x37')]){_0x193a05=0x0;}else{_0x193a05=_0x3a433c[0x0][_0x52f6('0x1e')]||0x0;}return dbH[_0x52f6('0x86')][_0x52f6('0x31')](_0x106a37[_0x52f6('0x85')](),{'type':dbH['sequelize'][_0x52f6('0x87')]['SELECT']});})[_0x52f6('0x25')](function(_0xa86969){return{'rows':_0xa86969||[],'count':_0x193a05};});}});}exports[_0x52f6('0x9e')]=function(_0x426d3a,_0x130be3){return runReport(_0x426d3a[_0x52f6('0x44')],_0x426d3a[_0x52f6('0x31')],_0x426d3a[_0x52f6('0x3f')])[_0x52f6('0x25')](respondWithResult(_0x130be3,null))[_0x52f6('0x42')](handleError(_0x130be3,null));};exports[_0x52f6('0x9f')]=runReport;exports['query']=function(_0xf44091,_0x59ca49){var _0x5c9b3c=0xa;var _0x3af69f=[_0x52f6('0x52'),'left_join',_0x52f6('0x54'),'cross_join'];var _0x4d76c8={'SUM':_0x52f6('0x56'),'COUNT':_0x52f6('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x52f6('0x89'),'MIN':_0x52f6('0x59'),'AVG':_0x52f6('0x5a'),'GROUP_CONCAT':_0x52f6('0x5b'),'GROUP_CONCAT ASC':_0x52f6('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5a4af3={'SEC_TO_TIME':_0x52f6('0x5e'),'DATE':_0x52f6('0x5f'),'HOUR':_0x52f6('0x60'),'ROUND':_0x52f6('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4940cd=function(_0x28e9c5){return!_['includes']([_0x52f6('0x64'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x52f6('0x66')],_0x28e9c5);};var _0x281839=function(_0x5e234f){if(!_0x5e234f||!_0x5e234f['rules'][_0x52f6('0x37')]){return'';}for(var _0x43f215='(',_0x44e111=0x0;_0x44e111<_0x5e234f[_0x52f6('0x67')][_0x52f6('0x37')];_0x44e111+=0x1){_0x44e111>0x0&&(_0x43f215+='\x20'+_0x5e234f[_0x52f6('0x8a')]+'\x20');_0x43f215+=_0x5e234f[_0x52f6('0x67')][_0x44e111]['group']?_0x281839(_0x5e234f[_0x52f6('0x67')][_0x44e111][_0x52f6('0x68')]):_0x5e234f[_0x52f6('0x67')][_0x44e111]['field']+'\x20'+_0x5e234f[_0x52f6('0x67')][_0x44e111][_0x52f6('0x69')]+(_0x4940cd(_0x5e234f[_0x52f6('0x67')][_0x44e111][_0x52f6('0x69')])?'\x20'+_0x5e234f['rules'][_0x44e111][_0x52f6('0x6a')]:'');}return _0x43f215+')';};var _0x45638e={'where':{'id':_0xf44091[_0x52f6('0x44')]['id']}},_0x295960,_0x4c8d49,_0x1b6e96,_0x4aeb1b,_0x4becf6;_0x45638e=_['merge']({},_0x45638e,_0xf44091[_0x52f6('0x3f')]);return db[_0x52f6('0x45')][_0x52f6('0x47')](_0x45638e)[_0x52f6('0x25')](function(_0x328f3c){if(_0x328f3c){_0x295960=_0x328f3c;return _0x328f3c['getFields']();}return null;})[_0x52f6('0x25')](function(_0x48f2c7){if(_0x48f2c7){if(!_0x48f2c7[_0x52f6('0x37')]){throw new db[(_0x52f6('0x8b'))]['ValidationErrorItem'](_0x52f6('0x6d'),0x193);}_0x4c8d49=_0x48f2c7;return db[_0x52f6('0x6e')][_0x52f6('0x6f')]({'raw':!![]});}return null;})[_0x52f6('0x25')](function(_0x43fc33){if(_0x43fc33){_0x1b6e96=_[_0x52f6('0x70')](_0x43fc33,'id');var _0x12b4e1;var _0xa06ea5=squel[_0x52f6('0x71')]();_0xa06ea5[_0x52f6('0x72')](_0x295960[_0x52f6('0x80')]);for(var _0x2f15fd=0x0;_0x2f15fd<_0x4c8d49[_0x52f6('0x37')];_0x2f15fd+=0x1){_0x12b4e1=_0x4c8d49[_0x2f15fd][_0x52f6('0x73')]?_0x1b6e96[_0x4c8d49[_0x2f15fd][_0x52f6('0x73')]][_0x52f6('0x8c')]:_0x4c8d49[_0x2f15fd]['field'];_0x12b4e1=_0x4c8d49[_0x2f15fd]['function']?_[_0x52f6('0x75')](_0x4d76c8[_0x4c8d49[_0x2f15fd][_0x52f6('0x74')]],'%s',_0x12b4e1):_0x12b4e1;_0x12b4e1=_0x4c8d49[_0x2f15fd][_0x52f6('0x76')]?_['replace'](_0x5a4af3[_0x4c8d49[_0x2f15fd][_0x52f6('0x76')]],'%s',_0x12b4e1):_0x12b4e1;if(_0x4c8d49[_0x2f15fd][_0x52f6('0x77')]){_0xa06ea5[_0x52f6('0x68')](_0x12b4e1);}_0x4c8d49[_0x2f15fd][_0x52f6('0x78')]&&_0xa06ea5[_0x52f6('0x39')](_0x12b4e1,_0x4c8d49[_0x2f15fd]['orderBy']===_0x52f6('0x8d')?![]:!![]);_0xa06ea5[_0x52f6('0x79')](_0x12b4e1,_0x4c8d49[_0x2f15fd][_0x52f6('0x7a')]||_0x12b4e1);}if(_0x295960[_0x52f6('0x7b')]){_0x295960['joins']=JSON[_0x52f6('0x82')](_0x295960[_0x52f6('0x7b')]);for(var _0x368dbf=0x0;_0x368dbf<_0x295960['joins'][_0x52f6('0x37')];_0x368dbf+=0x1){if(_0x295960[_0x52f6('0x7b')][_0x368dbf][_0x52f6('0x2f')]&&_[_0x52f6('0x63')](_0x3af69f,_0x295960['joins'][_0x368dbf][_0x52f6('0x2f')])&&_0x295960[_0x52f6('0x7b')][_0x368dbf][_0x52f6('0x7c')]&&_0x295960['joins'][_0x368dbf][_0x52f6('0x7d')]&&_0x295960[_0x52f6('0x7b')][_0x368dbf][_0x52f6('0x7e')]){_0xa06ea5[_0x295960[_0x52f6('0x7b')][_0x368dbf][_0x52f6('0x2f')]](_0x295960[_0x52f6('0x7b')][_0x368dbf][_0x52f6('0x7d')],null,util['format'](_0x52f6('0x7f'),_0x295960[_0x52f6('0x80')],_0x295960['joins'][_0x368dbf][_0x52f6('0x7c')],_0x295960[_0x52f6('0x7b')][_0x368dbf][_0x52f6('0x7d')],_0x295960['joins'][_0x368dbf][_0x52f6('0x7e')]));}}}if(_0x295960['conditions']){_0x295960['conditions']=JSON[_0x52f6('0x82')](_0x295960[_0x52f6('0x81')]);_0xa06ea5[_0x52f6('0x3d')](_0x281839(_0x295960[_0x52f6('0x81')]['group']));}_0x4becf6=_0xa06ea5[_0x52f6('0x83')]();_0xa06ea5[_0x52f6('0x1f')](_0x5c9b3c);_0xa06ea5[_0x52f6('0x1d')](0x0);logger[_0x52f6('0x84')](_0x52f6('0xa0'),_0xa06ea5[_0x52f6('0x85')]());return dbH[_0x52f6('0x86')]['query'](_0xa06ea5['toString'](),{'type':dbH[_0x52f6('0x86')][_0x52f6('0x87')][_0x52f6('0x88')]});}})[_0x52f6('0x25')](function(){return{'sql':_0x4becf6[_0x52f6('0x85')]()};})['then'](respondWithResult(_0x59ca49,null))['catch'](handleError(_0x59ca49,null));}; \ No newline at end of file +var _0xbbdd=['CustomReports','UserProfileResource','stack','name','AnalyticCustomReport','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','limit','debug','Limited\x20Query:','sequelize','toString','SELECT','join','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20NULL','getFields','select','clone','output','fullPath','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','QueryTypes','run','runReport','cross_join','SUM(%s)','AnalyticMetric','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','offset','count','set','reject','update','then','destroy','get'];(function(_0x1c6f2f,_0x5c556d){var _0x248ad4=function(_0x1affff){while(--_0x1affff){_0x1c6f2f['push'](_0x1c6f2f['shift']());}};_0x248ad4(++_0x5c556d);}(_0xbbdd,0x120));var _0xdbbd=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xbbdd[_0x45d55e];return _0x29812a;};'use strict';var emlformat=require(_0xdbbd('0x0'));var rimraf=require(_0xdbbd('0x1'));var zipdir=require(_0xdbbd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbbd('0x3'));var moment=require(_0xdbbd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdbbd('0x5'));var util=require(_0xdbbd('0x6'));var path=require(_0xdbbd('0x7'));var sox=require('sox');var csv=require(_0xdbbd('0x8'));var ejs=require(_0xdbbd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdbbd('0xa'));var squel=require(_0xdbbd('0xb'));var crypto=require(_0xdbbd('0xc'));var jsforce=require(_0xdbbd('0xd'));var deskjs=require(_0xdbbd('0xe'));var toCsv=require(_0xdbbd('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdbbd('0xf'));var authService=require(_0xdbbd('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbbd('0x11'));var logger=require(_0xdbbd('0x12'))(_0xdbbd('0x13'));var utils=require(_0xdbbd('0x14'));var config=require(_0xdbbd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xdbbd('0x16'))['db'];var dbH=require(_0xdbbd('0x16'))[_0xdbbd('0x17')];function respondWithStatusCode(_0x1d0452,_0x1aa01c){_0x1aa01c=_0x1aa01c||0xcc;return function(_0x11c5a1){if(_0x11c5a1){return _0x1d0452[_0xdbbd('0x18')](_0x1aa01c);}return _0x1d0452[_0xdbbd('0x19')](_0x1aa01c)[_0xdbbd('0x1a')]();};}function respondWithResult(_0x3e8a4d,_0x197368){_0x197368=_0x197368||0xc8;return function(_0x325615){if(_0x325615){return _0x3e8a4d['status'](_0x197368)[_0xdbbd('0x1b')](_0x325615);}};}function respondWithFilteredResult(_0x4b5e43,_0x1406a9){return function(_0x341657){if(_0x341657){var _0x1db149=typeof _0x1406a9[_0xdbbd('0x1c')]==='undefined'&&typeof _0x1406a9['limit']==='undefined';var _0x43cfa5=_0x341657[_0xdbbd('0x1d')];var _0x42b29d=_0x1db149?0x0:_0x1406a9[_0xdbbd('0x1c')];var _0x24ddab=_0x1db149?_0x341657[_0xdbbd('0x1d')]:_0x1406a9[_0xdbbd('0x1c')]+_0x1406a9['limit'];var _0x382fed;if(_0x24ddab>=_0x43cfa5){_0x24ddab=_0x43cfa5;_0x382fed=0xc8;}else{_0x382fed=0xce;}_0x4b5e43[_0xdbbd('0x19')](_0x382fed);return _0x4b5e43[_0xdbbd('0x1e')]('Content-Range',_0x42b29d+'-'+_0x24ddab+'/'+_0x43cfa5)[_0xdbbd('0x1b')](_0x341657);}return null;};}function patchUpdates(_0x2c4707){return function(_0x9d8a19){try{jsonpatch['apply'](_0x9d8a19,_0x2c4707,!![]);}catch(_0x5b3bee){return BPromise[_0xdbbd('0x1f')](_0x5b3bee);}return _0x9d8a19['save']();};}function saveUpdates(_0x5a9689,_0x206840){return function(_0x24d09f){if(_0x24d09f){return _0x24d09f[_0xdbbd('0x20')](_0x5a9689)[_0xdbbd('0x21')](function(_0x1580a6){return _0x1580a6;});}return null;};}function removeEntity(_0x37ef57,_0x4e2aff){return function(_0x518852){if(_0x518852){return _0x518852[_0xdbbd('0x22')]()[_0xdbbd('0x21')](function(){var _0x1333df=_0x518852[_0xdbbd('0x23')]({'plain':!![]});var _0x5b9c3f=_0xdbbd('0x24');return db[_0xdbbd('0x25')][_0xdbbd('0x22')]({'where':{'type':_0x5b9c3f,'resourceId':_0x1333df['id']}})['then'](function(){return _0x518852;});})[_0xdbbd('0x21')](function(){_0x37ef57['status'](0xcc)[_0xdbbd('0x1a')]();});}};}function handleEntityNotFound(_0x3e8cf1,_0x2e52ac){return function(_0x186096){if(!_0x186096){_0x3e8cf1[_0xdbbd('0x18')](0x194);}return _0x186096;};}function handleError(_0x2cc787,_0x26d68a){_0x26d68a=_0x26d68a||0x1f4;return function(_0xc62720){logger['error'](_0xc62720[_0xdbbd('0x26')]);if(_0xc62720[_0xdbbd('0x27')]){delete _0xc62720['name'];}_0x2cc787[_0xdbbd('0x19')](_0x26d68a)['send'](_0xc62720);};}exports['index']=function(_0x267dc3,_0x4b9194){var _0x59d4f8={},_0x3649f9={},_0x4a48db={'count':0x0,'rows':[]};var _0x5bddf1=_['map'](db[_0xdbbd('0x28')][_0xdbbd('0x29')],function(_0x5d8503){return{'name':_0x5d8503[_0xdbbd('0x2a')],'type':_0x5d8503['type'][_0xdbbd('0x2b')]};});_0x3649f9['model']=_[_0xdbbd('0x2c')](_0x5bddf1,_0xdbbd('0x27'));_0x3649f9['query']=_[_0xdbbd('0x2d')](_0x267dc3[_0xdbbd('0x2e')]);_0x3649f9[_0xdbbd('0x2f')]=_[_0xdbbd('0x30')](_0x3649f9[_0xdbbd('0x31')],_0x3649f9[_0xdbbd('0x2e')]);_0x59d4f8['attributes']=_['intersection'](_0x3649f9[_0xdbbd('0x31')],qs[_0xdbbd('0x32')](_0x267dc3[_0xdbbd('0x2e')][_0xdbbd('0x32')]));_0x59d4f8[_0xdbbd('0x33')]=_0x59d4f8['attributes'][_0xdbbd('0x34')]?_0x59d4f8[_0xdbbd('0x33')]:_0x3649f9[_0xdbbd('0x31')];if(!_0x267dc3[_0xdbbd('0x2e')][_0xdbbd('0x35')](_0xdbbd('0x36'))){_0x59d4f8['limit']=qs['limit'](_0x267dc3[_0xdbbd('0x2e')]['limit']);_0x59d4f8[_0xdbbd('0x1c')]=qs['offset'](_0x267dc3[_0xdbbd('0x2e')][_0xdbbd('0x1c')]);}_0x59d4f8[_0xdbbd('0x37')]=qs[_0xdbbd('0x38')](_0x267dc3[_0xdbbd('0x2e')][_0xdbbd('0x38')]);_0x59d4f8[_0xdbbd('0x39')]=qs[_0xdbbd('0x2f')](_[_0xdbbd('0x3a')](_0x267dc3['query'],_0x3649f9[_0xdbbd('0x2f')]),_0x5bddf1);if(_0x267dc3[_0xdbbd('0x2e')]['filter']){_0x59d4f8[_0xdbbd('0x39')]=_[_0xdbbd('0x3b')](_0x59d4f8[_0xdbbd('0x39')],{'$or':_[_0xdbbd('0x2c')](_0x5bddf1,function(_0x5ef1fc){if(_0x5ef1fc['type']!==_0xdbbd('0x3c')){var _0x4a09de={};_0x4a09de[_0x5ef1fc[_0xdbbd('0x27')]]={'$like':'%'+_0x267dc3[_0xdbbd('0x2e')]['filter']+'%'};return _0x4a09de;}})});}_0x59d4f8=_[_0xdbbd('0x3b')]({},_0x59d4f8,_0x267dc3[_0xdbbd('0x3d')]);var _0x4a32ff={'where':_0x59d4f8[_0xdbbd('0x39')]};return db[_0xdbbd('0x28')][_0xdbbd('0x1d')](_0x4a32ff)[_0xdbbd('0x21')](function(_0x16ae67){_0x4a48db[_0xdbbd('0x1d')]=_0x16ae67;if(_0x267dc3[_0xdbbd('0x2e')][_0xdbbd('0x3e')]){_0x59d4f8['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xdbbd('0x3f')](_0x59d4f8);})[_0xdbbd('0x21')](function(_0x5333a4){_0x4a48db['rows']=_0x5333a4;return _0x4a48db;})[_0xdbbd('0x21')](respondWithFilteredResult(_0x4b9194,_0x59d4f8))['catch'](handleError(_0x4b9194,null));};exports['show']=function(_0x4259ce,_0x5de53c){var _0x4ffa4f={'raw':![],'where':{'id':_0x4259ce[_0xdbbd('0x40')]['id']}},_0x27ce76={};_0x27ce76[_0xdbbd('0x31')]=_[_0xdbbd('0x2d')](db[_0xdbbd('0x28')]['rawAttributes']);_0x27ce76['query']=_[_0xdbbd('0x2d')](_0x4259ce[_0xdbbd('0x2e')]);_0x27ce76[_0xdbbd('0x2f')]=_[_0xdbbd('0x30')](_0x27ce76[_0xdbbd('0x31')],_0x27ce76['query']);_0x4ffa4f[_0xdbbd('0x33')]=_[_0xdbbd('0x30')](_0x27ce76['model'],qs['fields'](_0x4259ce[_0xdbbd('0x2e')][_0xdbbd('0x32')]));_0x4ffa4f[_0xdbbd('0x33')]=_0x4ffa4f[_0xdbbd('0x33')]['length']?_0x4ffa4f['attributes']:_0x27ce76[_0xdbbd('0x31')];if(_0x4259ce[_0xdbbd('0x2e')]['includeAll']){_0x4ffa4f[_0xdbbd('0x41')]=[{'all':!![]}];}_0x4ffa4f=_[_0xdbbd('0x3b')]({},_0x4ffa4f,_0x4259ce[_0xdbbd('0x3d')]);return db['AnalyticCustomReport'][_0xdbbd('0x42')](_0x4ffa4f)['then'](handleEntityNotFound(_0x5de53c,null))['then'](respondWithResult(_0x5de53c,null))[_0xdbbd('0x43')](handleError(_0x5de53c,null));};exports[_0xdbbd('0x44')]=function(_0x13a31b,_0x15df73){return db[_0xdbbd('0x28')][_0xdbbd('0x44')](_0x13a31b[_0xdbbd('0x45')],{})[_0xdbbd('0x21')](function(_0x2e685e){var _0x44b36f=_0x13a31b[_0xdbbd('0x46')]['get']({'plain':!![]});if(!_0x44b36f)throw new Error(_0xdbbd('0x47'));if(_0x44b36f[_0xdbbd('0x48')]===_0xdbbd('0x46')){var _0x364898=_0x2e685e[_0xdbbd('0x23')]({'plain':!![]});var _0x458a0f=_0xdbbd('0x49');return db[_0xdbbd('0x4a')][_0xdbbd('0x42')]({'where':{'name':_0x458a0f,'userProfileId':_0x44b36f['userProfileId']},'raw':!![]})['then'](function(_0x5b6990){if(_0x5b6990&&_0x5b6990['autoAssociation']===0x0){return db[_0xdbbd('0x25')]['create']({'name':_0x364898['name'],'resourceId':_0x364898['id'],'type':_0xdbbd('0x24'),'sectionId':_0x5b6990['id']},{})[_0xdbbd('0x21')](function(){return _0x2e685e;});}else{return _0x2e685e;}})['catch'](function(_0x40d91b){logger[_0xdbbd('0x4b')](_0xdbbd('0x4c'),_0x40d91b);throw _0x40d91b;});}return _0x2e685e;})[_0xdbbd('0x21')](respondWithResult(_0x15df73,0xc9))[_0xdbbd('0x43')](handleError(_0x15df73,null));};exports[_0xdbbd('0x20')]=function(_0x3fdd0f,_0x54b39b){if(_0x3fdd0f['body']['id']){delete _0x3fdd0f[_0xdbbd('0x45')]['id'];}return db[_0xdbbd('0x28')][_0xdbbd('0x42')]({'where':{'id':_0x3fdd0f[_0xdbbd('0x40')]['id']}})[_0xdbbd('0x21')](handleEntityNotFound(_0x54b39b,null))['then'](saveUpdates(_0x3fdd0f[_0xdbbd('0x45')],null))[_0xdbbd('0x21')](respondWithResult(_0x54b39b,null))[_0xdbbd('0x43')](handleError(_0x54b39b,null));};exports[_0xdbbd('0x22')]=function(_0x11796a,_0x36bc2a){return db[_0xdbbd('0x28')][_0xdbbd('0x42')]({'where':{'id':_0x11796a[_0xdbbd('0x40')]['id']}})[_0xdbbd('0x21')](handleEntityNotFound(_0x36bc2a,null))['then'](removeEntity(_0x36bc2a,null))[_0xdbbd('0x43')](handleError(_0x36bc2a,null));};exports[_0xdbbd('0x4d')]=function(_0x2e95d2,_0x28b531){var _0x5ac917=0xa;var _0x4f5551=['join',_0xdbbd('0x4e'),_0xdbbd('0x4f'),'cross_join'];var _0x88fbb={'SUM':'SUM(%s)','COUNT':_0xdbbd('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xdbbd('0x51'),'MIN':_0xdbbd('0x52'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xdbbd('0x53'),'GROUP_CONCAT ASC':_0xdbbd('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4be4db={'SEC_TO_TIME':_0xdbbd('0x55'),'DATE':'DATE(%s)','HOUR':_0xdbbd('0x56'),'ROUND':_0xdbbd('0x57'),'UNIX_TIMESTAMP':_0xdbbd('0x58')};var _0x2fea56=function(_0x8876f4){return!_[_0xdbbd('0x59')]([_0xdbbd('0x5a'),'IS\x20NOT\x20NULL',_0xdbbd('0x5b'),_0xdbbd('0x5c')],_0x8876f4);};var _0xbb5bc5=function(_0x2e4b8c){if(!_0x2e4b8c||!_0x2e4b8c[_0xdbbd('0x5d')]['length']){return'';}for(var _0x12a20d='(',_0x4ff189=0x0;_0x4ff189<_0x2e4b8c[_0xdbbd('0x5d')][_0xdbbd('0x34')];_0x4ff189+=0x1){_0x4ff189>0x0&&(_0x12a20d+='\x20'+_0x2e4b8c[_0xdbbd('0x5e')]+'\x20');_0x12a20d+=_0x2e4b8c['rules'][_0x4ff189]['group']?_0xbb5bc5(_0x2e4b8c[_0xdbbd('0x5d')][_0x4ff189][_0xdbbd('0x5f')]):_0x2e4b8c['rules'][_0x4ff189][_0xdbbd('0x60')]+'\x20'+_0x2e4b8c[_0xdbbd('0x5d')][_0x4ff189]['condition']+(_0x2fea56(_0x2e4b8c[_0xdbbd('0x5d')][_0x4ff189][_0xdbbd('0x61')])?'\x20'+_0x2e4b8c[_0xdbbd('0x5d')][_0x4ff189][_0xdbbd('0x62')]:'');}return _0x12a20d+')';};var _0x1c8879={'where':{'id':_0x2e95d2['params']['id']}},_0x182390,_0x8ecef3,_0x1e88bb,_0x245f41,_0x1354e3;_0x1c8879=_['merge']({},_0x1c8879,_0x2e95d2[_0xdbbd('0x3d')]);return db[_0xdbbd('0x28')][_0xdbbd('0x42')](_0x1c8879)[_0xdbbd('0x21')](function(_0x3d5da7){if(_0x3d5da7){_0x182390=_0x3d5da7;return _0x3d5da7['getFields']();}return null;})[_0xdbbd('0x21')](function(_0x439f41){if(_0x439f41){if(!_0x439f41['length']){throw new db[(_0xdbbd('0x63'))][(_0xdbbd('0x64'))](_0xdbbd('0x65'),0x193);}_0x8ecef3=_0x439f41;return db['AnalyticMetric'][_0xdbbd('0x3f')]({'raw':!![]});}return null;})[_0xdbbd('0x21')](function(_0x2bf902){if(_0x2bf902){_0x1e88bb=_[_0xdbbd('0x66')](_0x2bf902,'id');var _0x16bdad;var _0x50e81d=squel['select']();_0x50e81d[_0xdbbd('0x67')](_0x182390[_0xdbbd('0x68')]);for(var _0x1e5583=0x0;_0x1e5583<_0x8ecef3[_0xdbbd('0x34')];_0x1e5583+=0x1){_0x16bdad=_0x8ecef3[_0x1e5583][_0xdbbd('0x69')]?_0x1e88bb[_0x8ecef3[_0x1e5583][_0xdbbd('0x69')]][_0xdbbd('0x6a')]:_0x8ecef3[_0x1e5583]['field'];_0x16bdad=_0x8ecef3[_0x1e5583][_0xdbbd('0x6b')]?_[_0xdbbd('0x6c')](_0x88fbb[_0x8ecef3[_0x1e5583]['function']],'%s',_0x16bdad):_0x16bdad;_0x16bdad=_0x8ecef3[_0x1e5583][_0xdbbd('0x6d')]?_[_0xdbbd('0x6c')](_0x4be4db[_0x8ecef3[_0x1e5583]['format']],'%s',_0x16bdad):_0x16bdad;if(_0x8ecef3[_0x1e5583][_0xdbbd('0x6e')]){_0x50e81d[_0xdbbd('0x5f')](_0x16bdad);}_0x8ecef3[_0x1e5583]['orderBy']&&_0x50e81d[_0xdbbd('0x37')](_0x16bdad,_0x8ecef3[_0x1e5583][_0xdbbd('0x6f')]===_0xdbbd('0x70')?![]:!![]);_0x50e81d['field'](_0x16bdad,_0x8ecef3[_0x1e5583][_0xdbbd('0x71')]||_0x16bdad);}if(_0x182390[_0xdbbd('0x72')]){_0x182390[_0xdbbd('0x72')]=JSON[_0xdbbd('0x73')](_0x182390[_0xdbbd('0x72')]);for(var _0x5c15e1=0x0;_0x5c15e1<_0x182390[_0xdbbd('0x72')][_0xdbbd('0x34')];_0x5c15e1+=0x1){if(_0x182390[_0xdbbd('0x72')][_0x5c15e1][_0xdbbd('0x74')]&&_[_0xdbbd('0x59')](_0x4f5551,_0x182390['joins'][_0x5c15e1]['type'])&&_0x182390[_0xdbbd('0x72')][_0x5c15e1][_0xdbbd('0x75')]&&_0x182390[_0xdbbd('0x72')][_0x5c15e1][_0xdbbd('0x76')]&&_0x182390[_0xdbbd('0x72')][_0x5c15e1][_0xdbbd('0x77')]){_0x50e81d[_0x182390['joins'][_0x5c15e1][_0xdbbd('0x74')]](_0x182390['joins'][_0x5c15e1][_0xdbbd('0x76')],null,util['format'](_0xdbbd('0x78'),_0x182390[_0xdbbd('0x68')],_0x182390[_0xdbbd('0x72')][_0x5c15e1]['parentKey'],_0x182390[_0xdbbd('0x72')][_0x5c15e1][_0xdbbd('0x76')],_0x182390[_0xdbbd('0x72')][_0x5c15e1][_0xdbbd('0x77')]));}}}if(_0x182390[_0xdbbd('0x79')]){_0x182390[_0xdbbd('0x79')]=JSON[_0xdbbd('0x73')](_0x182390[_0xdbbd('0x79')]);_0x50e81d[_0xdbbd('0x39')](_0xbb5bc5(_0x182390[_0xdbbd('0x79')]['group']));}_0x1354e3=_0x50e81d['clone']();_0x50e81d[_0xdbbd('0x7a')](_0x5ac917);_0x50e81d[_0xdbbd('0x1c')](0x0);logger[_0xdbbd('0x7b')](_0xdbbd('0x7c'),_0x50e81d['toString']());return dbH[_0xdbbd('0x7d')]['query'](_0x50e81d[_0xdbbd('0x7e')](),{'type':dbH[_0xdbbd('0x7d')]['QueryTypes'][_0xdbbd('0x7f')]});}})[_0xdbbd('0x21')](respondWithResult(_0x28b531,null))[_0xdbbd('0x43')](handleError(_0x28b531,null));};function runReport(_0x390196,_0xe7280b,_0x10ffff){var _0x4b0aac=_0xe7280b[_0xdbbd('0x27')];var _0x3d5f46=0xa;var _0x354e99=[_0xdbbd('0x80'),_0xdbbd('0x4e'),_0xdbbd('0x4f'),'cross_join'];var _0x37a31f={'SUM':'SUM(%s)','COUNT':_0xdbbd('0x50'),'COUNT DISTINCT':_0xdbbd('0x81'),'MAX':_0xdbbd('0x51'),'MIN':_0xdbbd('0x52'),'AVG':_0xdbbd('0x82'),'GROUP_CONCAT':_0xdbbd('0x53'),'GROUP_CONCAT ASC':_0xdbbd('0x54'),'GROUP_CONCAT DESC':_0xdbbd('0x83')};var _0x29f466={'SEC_TO_TIME':_0xdbbd('0x55'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xdbbd('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x37fc55=function(_0x3011a8){return!_['includes']([_0xdbbd('0x5a'),_0xdbbd('0x84'),_0xdbbd('0x5b'),_0xdbbd('0x5c')],_0x3011a8);};var _0x33fe79=function(_0x15a2c){if(!_0x15a2c||!_0x15a2c[_0xdbbd('0x5d')][_0xdbbd('0x34')]){return'';}for(var _0x4393fa='(',_0x1b8083=0x0;_0x1b8083<_0x15a2c['rules'][_0xdbbd('0x34')];_0x1b8083+=0x1){_0x1b8083>0x0&&(_0x4393fa+='\x20'+_0x15a2c[_0xdbbd('0x5e')]+'\x20');_0x4393fa+=_0x15a2c['rules'][_0x1b8083][_0xdbbd('0x5f')]?_0x33fe79(_0x15a2c['rules'][_0x1b8083]['group']):_0x15a2c[_0xdbbd('0x5d')][_0x1b8083][_0xdbbd('0x60')]+'\x20'+_0x15a2c[_0xdbbd('0x5d')][_0x1b8083][_0xdbbd('0x61')]+(_0x37fc55(_0x15a2c['rules'][_0x1b8083]['condition'])?'\x20'+_0x15a2c[_0xdbbd('0x5d')][_0x1b8083]['value']:'');}return _0x4393fa+')';};var _0x569626={'where':{'id':_0x390196['id']}},_0x581f1c,_0x2425ec,_0x50ef54,_0x1ea149,_0x1235e9;_0x569626=_[_0xdbbd('0x3b')]({},_0x569626,_0x10ffff);return db['AnalyticCustomReport'][_0xdbbd('0x42')](_0x569626)[_0xdbbd('0x21')](function(_0x534b24){if(_0x534b24){_0x581f1c=_0x534b24;return _0x534b24[_0xdbbd('0x85')]();}return null;})[_0xdbbd('0x21')](function(_0x6eb57d){if(_0x6eb57d){if(!_0x6eb57d[_0xdbbd('0x34')]){throw new db[(_0xdbbd('0x63'))][(_0xdbbd('0x64'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2425ec=_0x6eb57d;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x3e7d81){if(_0x3e7d81){_0x50ef54=_[_0xdbbd('0x66')](_0x3e7d81,'id');var _0x21eb48;var _0x39789e=squel[_0xdbbd('0x86')]();_0x39789e['from'](_0x581f1c[_0xdbbd('0x68')]);for(var _0x311e51=0x0;_0x311e51<_0x2425ec[_0xdbbd('0x34')];_0x311e51+=0x1){_0x21eb48=_0x2425ec[_0x311e51][_0xdbbd('0x69')]?_0x50ef54[_0x2425ec[_0x311e51][_0xdbbd('0x69')]][_0xdbbd('0x6a')]:_0x2425ec[_0x311e51]['field'];_0x21eb48=_0x2425ec[_0x311e51]['function']?_[_0xdbbd('0x6c')](_0x37a31f[_0x2425ec[_0x311e51][_0xdbbd('0x6b')]],'%s',_0x21eb48):_0x21eb48;_0x21eb48=_0x2425ec[_0x311e51]['format']?_[_0xdbbd('0x6c')](_0x29f466[_0x2425ec[_0x311e51][_0xdbbd('0x6d')]],'%s',_0x21eb48):_0x21eb48;if(_0x2425ec[_0x311e51]['groupBy']){_0x39789e[_0xdbbd('0x5f')](_0x21eb48);}_0x2425ec[_0x311e51][_0xdbbd('0x6f')]&&_0x39789e[_0xdbbd('0x37')](_0x21eb48,_0x2425ec[_0x311e51][_0xdbbd('0x6f')]===_0xdbbd('0x70')?![]:!![]);_0x39789e[_0xdbbd('0x60')](_0x21eb48,_0x2425ec[_0x311e51][_0xdbbd('0x71')]||_0x21eb48);}if(_0x581f1c[_0xdbbd('0x72')]){_0x581f1c[_0xdbbd('0x72')]=JSON[_0xdbbd('0x73')](_0x581f1c[_0xdbbd('0x72')]);for(var _0x5863d2=0x0;_0x5863d2<_0x581f1c['joins'][_0xdbbd('0x34')];_0x5863d2+=0x1){if(_0x581f1c[_0xdbbd('0x72')][_0x5863d2][_0xdbbd('0x74')]&&_['includes'](_0x354e99,_0x581f1c[_0xdbbd('0x72')][_0x5863d2][_0xdbbd('0x74')])&&_0x581f1c['joins'][_0x5863d2][_0xdbbd('0x75')]&&_0x581f1c[_0xdbbd('0x72')][_0x5863d2][_0xdbbd('0x76')]&&_0x581f1c[_0xdbbd('0x72')][_0x5863d2]['foreignKey']){_0x39789e[_0x581f1c['joins'][_0x5863d2][_0xdbbd('0x74')]](_0x581f1c[_0xdbbd('0x72')][_0x5863d2]['foreignTable'],null,util[_0xdbbd('0x6d')](_0xdbbd('0x78'),_0x581f1c[_0xdbbd('0x68')],_0x581f1c[_0xdbbd('0x72')][_0x5863d2]['parentKey'],_0x581f1c[_0xdbbd('0x72')][_0x5863d2]['foreignTable'],_0x581f1c[_0xdbbd('0x72')][_0x5863d2]['foreignKey']));}}}if(_0x581f1c['conditions']){_0x581f1c['conditions']=JSON['parse'](_0x581f1c[_0xdbbd('0x79')]);_0x39789e['where'](_0x33fe79(_0x581f1c[_0xdbbd('0x79')][_0xdbbd('0x5f')]));}_0x1235e9=_0x39789e[_0xdbbd('0x87')]();_0x39789e[_0xdbbd('0x7a')](_0x3d5f46);_0x39789e[_0xdbbd('0x1c')](0x0);return;}})[_0xdbbd('0x21')](function(){if(_0xe7280b[_0xdbbd('0x88')]==='web'){return null;}var _0x5c180d=_[_0xdbbd('0x3b')](_0xe7280b,{'name':_0xe7280b[_0xdbbd('0x89')]||_0xe7280b[_0xdbbd('0x27')]||_0x581f1c[_0xdbbd('0x27')],'basename':_0x4b0aac,'savename':util[_0xdbbd('0x6d')](_0xdbbd('0x8a'),_0xe7280b[_0xdbbd('0x27')]||_0x581f1c[_0xdbbd('0x27')],require(_0xdbbd('0x8b'))[_0xdbbd('0x8c')](0x4),_0xe7280b['output']||'csv'),'reportId':_0x581f1c['id'],'reportType':_0xdbbd('0x8d')});return db[_0xdbbd('0x8e')]['create'](_0x5c180d,{'raw':!![]});})['then'](function(_0x3ad421){if(_0x581f1c[_0xdbbd('0x68')]===_0xdbbd('0x8f')){_0x1235e9[_0xdbbd('0x39')](_0x581f1c[_0xdbbd('0x68')]+_0xdbbd('0x90'),_0xe7280b[_0xdbbd('0x91')],_0xe7280b['endDate']);}else{_0x1235e9[_0xdbbd('0x39')](_0x581f1c[_0xdbbd('0x68')]+_0xdbbd('0x92'),_0xe7280b[_0xdbbd('0x91')],_0xe7280b[_0xdbbd('0x93')]);}if(_0x3ad421){logger[_0xdbbd('0x94')](_0xdbbd('0x95'),_0x1235e9['toString']());require(_0xdbbd('0x96'))[_0xdbbd('0x97')](path['join'](__dirname,_0xdbbd('0x98'),_0x3ad421[_0xdbbd('0x88')]),[_0x3ad421['id'],_0x1235e9[_0xdbbd('0x7e')](),path[_0xdbbd('0x80')](__dirname,_0xdbbd('0x99'),_0x3ad421[_0xdbbd('0x9a')]),_0x4b0aac]);return _0x3ad421;}else{var _0x4c6249=squel[_0xdbbd('0x86')]();_0x4c6249['from']('('+_0x1235e9[_0xdbbd('0x7e')]()+')','countTable');_0x4c6249[_0xdbbd('0x60')](_0xdbbd('0x9b'),_0xdbbd('0x1d'));_0x1235e9['limit'](_0xe7280b['limit']||_0x3d5f46);_0x1235e9[_0xdbbd('0x1c')](_0xe7280b[_0xdbbd('0x1c')]||0x0);return dbH[_0xdbbd('0x7d')][_0xdbbd('0x2e')](_0x4c6249[_0xdbbd('0x7e')](),{'type':dbH[_0xdbbd('0x7d')][_0xdbbd('0x9c')]['SELECT']})[_0xdbbd('0x21')](function(_0x352476){if(!_0x352476['length']){_0x1ea149=0x0;}else{_0x1ea149=_0x352476[0x0][_0xdbbd('0x1d')]||0x0;}return dbH['sequelize'][_0xdbbd('0x2e')](_0x1235e9[_0xdbbd('0x7e')](),{'type':dbH[_0xdbbd('0x7d')][_0xdbbd('0x9c')][_0xdbbd('0x7f')]});})['then'](function(_0xf671d){return{'rows':_0xf671d||[],'count':_0x1ea149};});}});}exports[_0xdbbd('0x9d')]=function(_0x24c663,_0xdf0046){return runReport(_0x24c663[_0xdbbd('0x40')],_0x24c663[_0xdbbd('0x2e')],_0x24c663['options'])[_0xdbbd('0x21')](respondWithResult(_0xdf0046,null))[_0xdbbd('0x43')](handleError(_0xdf0046,null));};exports[_0xdbbd('0x9e')]=runReport;exports[_0xdbbd('0x2e')]=function(_0x4e3c06,_0x4ab232){var _0x5ade61=0xa;var _0x10961d=[_0xdbbd('0x80'),_0xdbbd('0x4e'),_0xdbbd('0x4f'),_0xdbbd('0x9f')];var _0xf615d0={'SUM':_0xdbbd('0xa0'),'COUNT':_0xdbbd('0x50'),'COUNT DISTINCT':_0xdbbd('0x81'),'MAX':_0xdbbd('0x51'),'MIN':_0xdbbd('0x52'),'AVG':_0xdbbd('0x82'),'GROUP_CONCAT':_0xdbbd('0x53'),'GROUP_CONCAT ASC':_0xdbbd('0x54'),'GROUP_CONCAT DESC':_0xdbbd('0x83')};var _0x4ffe7c={'SEC_TO_TIME':_0xdbbd('0x55'),'DATE':'DATE(%s)','HOUR':_0xdbbd('0x56'),'ROUND':_0xdbbd('0x57'),'UNIX_TIMESTAMP':_0xdbbd('0x58')};var _0x68ad5a=function(_0x49f44a){return!_[_0xdbbd('0x59')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xdbbd('0x5b'),_0xdbbd('0x5c')],_0x49f44a);};var _0x3494c8=function(_0x3aac23){if(!_0x3aac23||!_0x3aac23[_0xdbbd('0x5d')][_0xdbbd('0x34')]){return'';}for(var _0x10021d='(',_0x3fb4c4=0x0;_0x3fb4c4<_0x3aac23['rules'][_0xdbbd('0x34')];_0x3fb4c4+=0x1){_0x3fb4c4>0x0&&(_0x10021d+='\x20'+_0x3aac23[_0xdbbd('0x5e')]+'\x20');_0x10021d+=_0x3aac23[_0xdbbd('0x5d')][_0x3fb4c4][_0xdbbd('0x5f')]?_0x3494c8(_0x3aac23[_0xdbbd('0x5d')][_0x3fb4c4][_0xdbbd('0x5f')]):_0x3aac23[_0xdbbd('0x5d')][_0x3fb4c4][_0xdbbd('0x60')]+'\x20'+_0x3aac23[_0xdbbd('0x5d')][_0x3fb4c4][_0xdbbd('0x61')]+(_0x68ad5a(_0x3aac23[_0xdbbd('0x5d')][_0x3fb4c4][_0xdbbd('0x61')])?'\x20'+_0x3aac23[_0xdbbd('0x5d')][_0x3fb4c4][_0xdbbd('0x62')]:'');}return _0x10021d+')';};var _0x33f04d={'where':{'id':_0x4e3c06[_0xdbbd('0x40')]['id']}},_0x1f06e7,_0x1f5e71,_0x148da5,_0x576f5a,_0x110e82;_0x33f04d=_['merge']({},_0x33f04d,_0x4e3c06[_0xdbbd('0x3d')]);return db[_0xdbbd('0x28')][_0xdbbd('0x42')](_0x33f04d)[_0xdbbd('0x21')](function(_0x1bcd8b){if(_0x1bcd8b){_0x1f06e7=_0x1bcd8b;return _0x1bcd8b[_0xdbbd('0x85')]();}return null;})[_0xdbbd('0x21')](function(_0x46fff9){if(_0x46fff9){if(!_0x46fff9[_0xdbbd('0x34')]){throw new db['Sequelize'][(_0xdbbd('0x64'))](_0xdbbd('0x65'),0x193);}_0x1f5e71=_0x46fff9;return db[_0xdbbd('0xa1')]['findAll']({'raw':!![]});}return null;})[_0xdbbd('0x21')](function(_0x3a15f5){if(_0x3a15f5){_0x148da5=_['keyBy'](_0x3a15f5,'id');var _0x2eb33b;var _0x245374=squel[_0xdbbd('0x86')]();_0x245374[_0xdbbd('0x67')](_0x1f06e7['table']);for(var _0x44213f=0x0;_0x44213f<_0x1f5e71[_0xdbbd('0x34')];_0x44213f+=0x1){_0x2eb33b=_0x1f5e71[_0x44213f][_0xdbbd('0x69')]?_0x148da5[_0x1f5e71[_0x44213f][_0xdbbd('0x69')]]['metric']:_0x1f5e71[_0x44213f][_0xdbbd('0x60')];_0x2eb33b=_0x1f5e71[_0x44213f][_0xdbbd('0x6b')]?_[_0xdbbd('0x6c')](_0xf615d0[_0x1f5e71[_0x44213f]['function']],'%s',_0x2eb33b):_0x2eb33b;_0x2eb33b=_0x1f5e71[_0x44213f][_0xdbbd('0x6d')]?_['replace'](_0x4ffe7c[_0x1f5e71[_0x44213f]['format']],'%s',_0x2eb33b):_0x2eb33b;if(_0x1f5e71[_0x44213f]['groupBy']){_0x245374[_0xdbbd('0x5f')](_0x2eb33b);}_0x1f5e71[_0x44213f][_0xdbbd('0x6f')]&&_0x245374['order'](_0x2eb33b,_0x1f5e71[_0x44213f]['orderBy']===_0xdbbd('0x70')?![]:!![]);_0x245374[_0xdbbd('0x60')](_0x2eb33b,_0x1f5e71[_0x44213f][_0xdbbd('0x71')]||_0x2eb33b);}if(_0x1f06e7[_0xdbbd('0x72')]){_0x1f06e7[_0xdbbd('0x72')]=JSON[_0xdbbd('0x73')](_0x1f06e7[_0xdbbd('0x72')]);for(var _0x5bfce4=0x0;_0x5bfce4<_0x1f06e7[_0xdbbd('0x72')][_0xdbbd('0x34')];_0x5bfce4+=0x1){if(_0x1f06e7[_0xdbbd('0x72')][_0x5bfce4][_0xdbbd('0x74')]&&_[_0xdbbd('0x59')](_0x10961d,_0x1f06e7['joins'][_0x5bfce4]['type'])&&_0x1f06e7[_0xdbbd('0x72')][_0x5bfce4]['parentKey']&&_0x1f06e7[_0xdbbd('0x72')][_0x5bfce4]['foreignTable']&&_0x1f06e7[_0xdbbd('0x72')][_0x5bfce4][_0xdbbd('0x77')]){_0x245374[_0x1f06e7[_0xdbbd('0x72')][_0x5bfce4]['type']](_0x1f06e7[_0xdbbd('0x72')][_0x5bfce4][_0xdbbd('0x76')],null,util['format'](_0xdbbd('0x78'),_0x1f06e7['table'],_0x1f06e7[_0xdbbd('0x72')][_0x5bfce4][_0xdbbd('0x75')],_0x1f06e7[_0xdbbd('0x72')][_0x5bfce4][_0xdbbd('0x76')],_0x1f06e7['joins'][_0x5bfce4][_0xdbbd('0x77')]));}}}if(_0x1f06e7[_0xdbbd('0x79')]){_0x1f06e7[_0xdbbd('0x79')]=JSON[_0xdbbd('0x73')](_0x1f06e7[_0xdbbd('0x79')]);_0x245374[_0xdbbd('0x39')](_0x3494c8(_0x1f06e7[_0xdbbd('0x79')][_0xdbbd('0x5f')]));}_0x110e82=_0x245374[_0xdbbd('0x87')]();_0x245374[_0xdbbd('0x7a')](_0x5ade61);_0x245374[_0xdbbd('0x1c')](0x0);logger[_0xdbbd('0x7b')]('Limited\x20Query:',_0x245374['toString']());return dbH[_0xdbbd('0x7d')][_0xdbbd('0x2e')](_0x245374['toString'](),{'type':dbH[_0xdbbd('0x7d')][_0xdbbd('0x9c')][_0xdbbd('0x7f')]});}})[_0xdbbd('0x21')](function(){return{'sql':_0x110e82[_0xdbbd('0x7e')]()};})[_0xdbbd('0x21')](respondWithResult(_0x4ab232,null))[_0xdbbd('0x43')](handleError(_0x4ab232,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 4ec47da..e558c9e 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 _0x07cc=['bluebird','request-promise','path','../../config/environment','exports','analytics_custom_reports','lodash','util','api','moment'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x07cc,0xce));var _0xc07c=function(_0x1c456a,_0x159391){_0x1c456a=_0x1c456a-0x0;var _0x42f967=_0x07cc[_0x1c456a];return _0x42f967;};'use strict';var _=require(_0xc07c('0x0'));var util=require(_0xc07c('0x1'));var logger=require('../../config/logger')(_0xc07c('0x2'));var moment=require(_0xc07c('0x3'));var BPromise=require(_0xc07c('0x4'));var rp=require(_0xc07c('0x5'));var fs=require('fs');var path=require(_0xc07c('0x6'));var rimraf=require('rimraf');var config=require(_0xc07c('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0xc07c('0x8')]=function(_0x39ba5b,_0xb7fa6a){return _0x39ba5b['define']('AnalyticCustomReport',attributes,{'tableName':_0xc07c('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e52=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x4c536d,_0xef4529){var _0x8b906b=function(_0x4b00eb){while(--_0x4b00eb){_0x4c536d['push'](_0x4c536d['shift']());}};_0x8b906b(++_0xef4529);}(_0x1e52,0x19e));var _0x21e5=function(_0x4f1b87,_0x260834){_0x4f1b87=_0x4f1b87-0x0;var _0x74718e=_0x1e52[_0x4f1b87];return _0x74718e;};'use strict';var _=require(_0x21e5('0x0'));var util=require(_0x21e5('0x1'));var logger=require(_0x21e5('0x2'))(_0x21e5('0x3'));var moment=require(_0x21e5('0x4'));var BPromise=require('bluebird');var rp=require(_0x21e5('0x5'));var fs=require('fs');var path=require(_0x21e5('0x6'));var rimraf=require(_0x21e5('0x7'));var config=require(_0x21e5('0x8'));var attributes=require(_0x21e5('0x9'));module[_0x21e5('0xa')]=function(_0x59ff46,_0x36a4cd){return _0x59ff46['define'](_0x21e5('0xb'),attributes,{'tableName':_0x21e5('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 baeabfe..3769f49 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 _0xeb6e=['request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client'];(function(_0x5d9bbe,_0x48dd91){var _0x39af0c=function(_0x34cf56){while(--_0x34cf56){_0x5d9bbe['push'](_0x5d9bbe['shift']());}};_0x39af0c(++_0x48dd91);}(_0xeb6e,0x1c6));var _0xeeb6=function(_0x2e2bfd,_0x1a546c){_0x2e2bfd=_0x2e2bfd-0x0;var _0x22641f=_0xeb6e[_0x2e2bfd];return _0x22641f;};'use strict';var _=require('lodash');var util=require(_0xeeb6('0x0'));var moment=require('moment');var BPromise=require(_0xeeb6('0x1'));var rs=require(_0xeeb6('0x2'));var fs=require('fs');var Redis=require(_0xeeb6('0x3'));var db=require(_0xeeb6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeeb6('0x5'));var config=require('../../config/environment');var jayson=require(_0xeeb6('0x6'));var client=jayson[_0xeeb6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16685e,_0x464cc9,_0x33cffe){return new BPromise(function(_0x47aab4,_0x227ff5){return client[_0xeeb6('0x8')](_0x16685e,_0x33cffe)[_0xeeb6('0x9')](function(_0x567cf6){logger[_0xeeb6('0xa')](_0xeeb6('0xb'),_0x464cc9,'request\x20sent');logger[_0xeeb6('0xc')](_0xeeb6('0xd'),_0x464cc9,_0xeeb6('0xe'),JSON[_0xeeb6('0xf')](_0x567cf6));if(_0x567cf6[_0xeeb6('0x10')]){if(_0x567cf6[_0xeeb6('0x10')][_0xeeb6('0x11')]===0x1f4){logger[_0xeeb6('0x10')](_0xeeb6('0xb'),_0x464cc9,_0x567cf6[_0xeeb6('0x10')][_0xeeb6('0x12')]);return _0x227ff5(_0x567cf6[_0xeeb6('0x10')]['message']);}logger[_0xeeb6('0x10')](_0xeeb6('0xb'),_0x464cc9,_0x567cf6['error']['message']);return _0x47aab4(_0x567cf6[_0xeeb6('0x10')][_0xeeb6('0x12')]);}else{logger[_0xeeb6('0xa')](_0xeeb6('0xb'),_0x464cc9,_0xeeb6('0xe'));_0x47aab4(_0x567cf6[_0xeeb6('0x13')][_0xeeb6('0x12')]);}})[_0xeeb6('0x14')](function(_0x4b433c){logger[_0xeeb6('0x10')](_0xeeb6('0xb'),_0x464cc9,_0x4b433c);_0x227ff5(_0x4b433c);});});} \ No newline at end of file +var _0xf998=['client','http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x2168c,_0xfc22ce){var _0x5eceb9=function(_0x3c5de9){while(--_0x3c5de9){_0x2168c['push'](_0x2168c['shift']());}};_0x5eceb9(++_0xfc22ce);}(_0xf998,0xae));var _0x8f99=function(_0x3e3f27,_0x2c2ecf){_0x3e3f27=_0x3e3f27-0x0;var _0x15c868=_0xf998[_0x3e3f27];return _0x15c868;};'use strict';var _=require(_0x8f99('0x0'));var util=require('util');var moment=require(_0x8f99('0x1'));var BPromise=require(_0x8f99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f99('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f99('0x4'))(_0x8f99('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8f99('0x6')][_0x8f99('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x48f3cd,_0x5c83d6,_0x391ade){return new BPromise(function(_0x5b23e3,_0x4f50e5){return client['request'](_0x48f3cd,_0x391ade)['then'](function(_0x25e933){logger[_0x8f99('0x8')](_0x8f99('0x9'),_0x5c83d6,_0x8f99('0xa'));logger[_0x8f99('0xb')](_0x8f99('0xc'),_0x5c83d6,'request\x20sent',JSON[_0x8f99('0xd')](_0x25e933));if(_0x25e933[_0x8f99('0xe')]){if(_0x25e933[_0x8f99('0xe')]['code']===0x1f4){logger['error'](_0x8f99('0x9'),_0x5c83d6,_0x25e933['error']['message']);return _0x4f50e5(_0x25e933[_0x8f99('0xe')][_0x8f99('0xf')]);}logger['error'](_0x8f99('0x9'),_0x5c83d6,_0x25e933[_0x8f99('0xe')][_0x8f99('0xf')]);return _0x5b23e3(_0x25e933[_0x8f99('0xe')][_0x8f99('0xf')]);}else{logger[_0x8f99('0x8')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5c83d6,_0x8f99('0xa'));_0x5b23e3(_0x25e933[_0x8f99('0x10')][_0x8f99('0xf')]);}})[_0x8f99('0x11')](function(_0x51065b){logger[_0x8f99('0xe')](_0x8f99('0x9'),_0x5c83d6,_0x51065b);_0x4f50e5(_0x51065b);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index ad387e1..f51dc3b 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 _0x27c5=['update','delete','destroy','exports','util','Router','fs-extra','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','query','post','create','put'];(function(_0x3d2ca7,_0x3effc2){var _0x51e785=function(_0x4e1859){while(--_0x4e1859){_0x3d2ca7['push'](_0x3d2ca7['shift']());}};_0x51e785(++_0x3effc2);}(_0x27c5,0x1a6));var _0x527c=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0x27c5[_0xfb0cfd];return _0x2fd8aa;};'use strict';var multer=require('multer');var util=require(_0x527c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x527c('0x1')]();var fs_extra=require(_0x527c('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x527c('0x3'));var config=require('../../config/environment');var controller=require(_0x527c('0x4'));router[_0x527c('0x5')]('/',auth[_0x527c('0x6')](),controller[_0x527c('0x7')]);router[_0x527c('0x5')](_0x527c('0x8'),auth[_0x527c('0x6')](),controller[_0x527c('0x9')]);router['get']('/:id/preview',auth[_0x527c('0x6')](),controller[_0x527c('0xa')]);router[_0x527c('0x5')](_0x527c('0xb'),auth[_0x527c('0x6')](),controller[_0x527c('0xc')]);router[_0x527c('0x5')](_0x527c('0xd'),auth['isAuthenticated'](),controller[_0x527c('0xe')]);router[_0x527c('0xf')]('/',auth[_0x527c('0x6')](),controller[_0x527c('0x10')]);router[_0x527c('0x11')]('/:id',auth[_0x527c('0x6')](),controller[_0x527c('0x12')]);router[_0x527c('0x13')](_0x527c('0x8'),auth[_0x527c('0x6')](),controller[_0x527c('0x14')]);module[_0x527c('0x15')]=router; \ No newline at end of file +var _0xfc3d=['../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x2df523,_0x11b09e){var _0x43f919=function(_0x53c3d6){while(--_0x53c3d6){_0x2df523['push'](_0x2df523['shift']());}};_0x43f919(++_0x11b09e);}(_0xfc3d,0x1a3));var _0xdfc3=function(_0xf6fe1b,_0x1a1644){_0xf6fe1b=_0xf6fe1b-0x0;var _0x2088b8=_0xfc3d[_0xf6fe1b];return _0x2088b8;};'use strict';var multer=require(_0xdfc3('0x0'));var util=require('util');var path=require(_0xdfc3('0x1'));var timeout=require(_0xdfc3('0x2'));var express=require(_0xdfc3('0x3'));var router=express[_0xdfc3('0x4')]();var fs_extra=require(_0xdfc3('0x5'));var auth=require(_0xdfc3('0x6'));var interaction=require(_0xdfc3('0x7'));var config=require('../../config/environment');var controller=require(_0xdfc3('0x8'));router[_0xdfc3('0x9')]('/',auth[_0xdfc3('0xa')](),controller[_0xdfc3('0xb')]);router[_0xdfc3('0x9')](_0xdfc3('0xc'),auth[_0xdfc3('0xa')](),controller[_0xdfc3('0xd')]);router[_0xdfc3('0x9')](_0xdfc3('0xe'),auth[_0xdfc3('0xa')](),controller[_0xdfc3('0xf')]);router[_0xdfc3('0x9')](_0xdfc3('0x10'),auth[_0xdfc3('0xa')](),controller[_0xdfc3('0x11')]);router[_0xdfc3('0x9')](_0xdfc3('0x12'),auth[_0xdfc3('0xa')](),controller[_0xdfc3('0x13')]);router[_0xdfc3('0x14')]('/',auth[_0xdfc3('0xa')](),controller[_0xdfc3('0x15')]);router[_0xdfc3('0x16')](_0xdfc3('0xc'),auth['isAuthenticated'](),controller[_0xdfc3('0x17')]);router['delete']('/:id',auth[_0xdfc3('0xa')](),controller[_0xdfc3('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 93e6bfd..8efe85c 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 _0xfdbd=['sequelize','exports','STRING','TEXT'];(function(_0x4907de,_0x5bbdc6){var _0x482054=function(_0x39ecf6){while(--_0x39ecf6){_0x4907de['push'](_0x4907de['shift']());}};_0x482054(++_0x5bbdc6);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0xfdbd[_0x11f249];return _0x5c3656;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'parent':{'type':Sequelize[_0xdfdb('0x2')]},'table':{'type':Sequelize[_0xdfdb('0x2')]},'conditions':{'type':Sequelize[_0xdfdb('0x3')]},'joins':{'type':Sequelize[_0xdfdb('0x3')]}}; \ No newline at end of file +var _0x8ef6=['STRING','TEXT','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x8a4773,_0x39e350){_0x8a4773=_0x8a4773-0x0;var _0x657a69=_0x8ef6[_0x8a4773];return _0x657a69;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'name':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x68ef('0x2')]},'parent':{'type':Sequelize[_0x68ef('0x2')]},'table':{'type':Sequelize[_0x68ef('0x2')]},'conditions':{'type':Sequelize[_0x68ef('0x3')]},'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 ad1a98c..537c946 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 _0xe2fe=['set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','groupBy','orderBy','alias','joins','parse','type','foreignTable','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20EMPTY','getFields','format','foreignKey','web','%s-%s.%s','randomstring','generate','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20EMPTY','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','dbH','status','json','offset','limit','undefined','count'];(function(_0xc8f1d4,_0x31dff6){var _0x2d3174=function(_0x442987){while(--_0x442987){_0xc8f1d4['push'](_0xc8f1d4['shift']());}};_0x2d3174(++_0x31dff6);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];var dbH=require(_0xee2f('0x10'))[_0xee2f('0x11')];function respondWithStatusCode(_0x100449,_0x131874){_0x131874=_0x131874||0xcc;return function(_0x3ab91f){if(_0x3ab91f){return _0x100449['sendStatus'](_0x131874);}return _0x100449[_0xee2f('0x12')](_0x131874)['end']();};}function respondWithResult(_0x36db10,_0x271c1d){_0x271c1d=_0x271c1d||0xc8;return function(_0x48b30c){if(_0x48b30c){return _0x36db10[_0xee2f('0x12')](_0x271c1d)[_0xee2f('0x13')](_0x48b30c);}};}function respondWithFilteredResult(_0x28b614,_0x1bbf7d){return function(_0x390c2c){if(_0x390c2c){var _0x58f42a=typeof _0x1bbf7d[_0xee2f('0x14')]==='undefined'&&typeof _0x1bbf7d[_0xee2f('0x15')]===_0xee2f('0x16');var _0x502eb6=_0x390c2c['count'];var _0x40b5bc=_0x58f42a?0x0:_0x1bbf7d['offset'];var _0x69db88=_0x58f42a?_0x390c2c[_0xee2f('0x17')]:_0x1bbf7d[_0xee2f('0x14')]+_0x1bbf7d['limit'];var _0x35e1a4;if(_0x69db88>=_0x502eb6){_0x69db88=_0x502eb6;_0x35e1a4=0xc8;}else{_0x35e1a4=0xce;}_0x28b614[_0xee2f('0x12')](_0x35e1a4);return _0x28b614[_0xee2f('0x18')](_0xee2f('0x19'),_0x40b5bc+'-'+_0x69db88+'/'+_0x502eb6)[_0xee2f('0x13')](_0x390c2c);}return null;};}function patchUpdates(_0x5d36d4){return function(_0x5e73ad){try{jsonpatch[_0xee2f('0x1a')](_0x5e73ad,_0x5d36d4,!![]);}catch(_0x3a1852){return BPromise[_0xee2f('0x1b')](_0x3a1852);}return _0x5e73ad[_0xee2f('0x1c')]();};}function saveUpdates(_0x472e3b,_0xf278cc){return function(_0x39a39c){if(_0x39a39c){return _0x39a39c['update'](_0x472e3b)[_0xee2f('0x1d')](function(_0x2c47c5){return _0x2c47c5;});}return null;};}function removeEntity(_0x15ceda,_0x70e308){return function(_0x820101){if(_0x820101){return _0x820101[_0xee2f('0x1e')]()[_0xee2f('0x1d')](function(){var _0x13013f=_0x820101[_0xee2f('0x1f')]({'plain':!![]});var _0x1e394f=_0xee2f('0x20');return db[_0xee2f('0x21')][_0xee2f('0x1e')]({'where':{'type':_0x1e394f,'resourceId':_0x13013f['id']}})[_0xee2f('0x1d')](function(){return _0x820101;});})['then'](function(){_0x15ceda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bdbb,_0x18ff19){return function(_0x2cb0cb){if(!_0x2cb0cb){_0x18bdbb[_0xee2f('0x22')](0x194);}return _0x2cb0cb;};}function handleError(_0x892a4e,_0x3737fd){_0x3737fd=_0x3737fd||0x1f4;return function(_0x4d8398){logger[_0xee2f('0x23')](_0x4d8398['stack']);if(_0x4d8398[_0xee2f('0x24')]){delete _0x4d8398[_0xee2f('0x24')];}_0x892a4e[_0xee2f('0x12')](_0x3737fd)[_0xee2f('0x25')](_0x4d8398);};}exports[_0xee2f('0x26')]=function(_0x47d5a6,_0x310c0b){var _0xd16e35={},_0x56706e={},_0x4ee0e1={'count':0x0,'rows':[]};var _0xd1aaac=_['map'](db[_0xee2f('0x27')][_0xee2f('0x28')],function(_0x53d9b7){return{'name':_0x53d9b7[_0xee2f('0x29')],'type':_0x53d9b7['type']['key']};});_0x56706e['model']=_[_0xee2f('0x2a')](_0xd1aaac,_0xee2f('0x24'));_0x56706e['query']=_[_0xee2f('0x2b')](_0x47d5a6[_0xee2f('0x2c')]);_0x56706e[_0xee2f('0x2d')]=_[_0xee2f('0x2e')](_0x56706e[_0xee2f('0x2f')],_0x56706e['query']);_0xd16e35[_0xee2f('0x30')]=_['intersection'](_0x56706e[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x47d5a6[_0xee2f('0x2c')]['fields']));_0xd16e35[_0xee2f('0x30')]=_0xd16e35['attributes'][_0xee2f('0x32')]?_0xd16e35['attributes']:_0x56706e[_0xee2f('0x2f')];if(!_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x33')](_0xee2f('0x34'))){_0xd16e35[_0xee2f('0x15')]=qs[_0xee2f('0x15')](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x15')]);_0xd16e35[_0xee2f('0x14')]=qs[_0xee2f('0x14')](_0x47d5a6[_0xee2f('0x2c')]['offset']);}_0xd16e35[_0xee2f('0x35')]=qs['sort'](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x36')]);_0xd16e35[_0xee2f('0x37')]=qs[_0xee2f('0x2d')](_[_0xee2f('0x38')](_0x47d5a6[_0xee2f('0x2c')],_0x56706e[_0xee2f('0x2d')]),_0xd1aaac);if(_0x47d5a6[_0xee2f('0x2c')]['filter']){_0xd16e35['where']=_['merge'](_0xd16e35[_0xee2f('0x37')],{'$or':_['map'](_0xd1aaac,function(_0x4501c4){if(_0x4501c4['type']!=='VIRTUAL'){var _0x5027a6={};_0x5027a6[_0x4501c4['name']]={'$like':'%'+_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x39')]+'%'};return _0x5027a6;}})});}_0xd16e35=_[_0xee2f('0x3a')]({},_0xd16e35,_0x47d5a6[_0xee2f('0x3b')]);var _0x4823a7={'where':_0xd16e35['where']};return db[_0xee2f('0x27')]['count'](_0x4823a7)['then'](function(_0x8204dc){_0x4ee0e1[_0xee2f('0x17')]=_0x8204dc;if(_0x47d5a6[_0xee2f('0x2c')]['includeAll']){_0xd16e35[_0xee2f('0x3c')]=[{'all':!![]}];}return db[_0xee2f('0x27')][_0xee2f('0x3d')](_0xd16e35);})['then'](function(_0x5896f6){_0x4ee0e1[_0xee2f('0x3e')]=_0x5896f6;return _0x4ee0e1;})[_0xee2f('0x1d')](respondWithFilteredResult(_0x310c0b,_0xd16e35))[_0xee2f('0x3f')](handleError(_0x310c0b,null));};exports[_0xee2f('0x40')]=function(_0x541fa0,_0x20697e){var _0x1df63d={'raw':!![],'where':{'id':_0x541fa0[_0xee2f('0x41')]['id']}},_0x242e91={};_0x242e91[_0xee2f('0x2f')]=_[_0xee2f('0x2b')](db[_0xee2f('0x27')][_0xee2f('0x28')]);_0x242e91[_0xee2f('0x2c')]=_[_0xee2f('0x2b')](_0x541fa0['query']);_0x242e91['filters']=_['intersection'](_0x242e91['model'],_0x242e91[_0xee2f('0x2c')]);_0x1df63d[_0xee2f('0x30')]=_[_0xee2f('0x2e')](_0x242e91[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x541fa0['query'][_0xee2f('0x31')]));_0x1df63d[_0xee2f('0x30')]=_0x1df63d[_0xee2f('0x30')][_0xee2f('0x32')]?_0x1df63d['attributes']:_0x242e91['model'];if(_0x541fa0['query'][_0xee2f('0x42')]){_0x1df63d['include']=[{'all':!![]}];}_0x1df63d=_['merge']({},_0x1df63d,_0x541fa0['options']);return db['AnalyticDefaultReport'][_0xee2f('0x43')](_0x1df63d)[_0xee2f('0x1d')](handleEntityNotFound(_0x20697e,null))[_0xee2f('0x1d')](respondWithResult(_0x20697e,null))['catch'](handleError(_0x20697e,null));};exports[_0xee2f('0x44')]=function(_0x57f65d,_0x3d95b8){return db[_0xee2f('0x27')][_0xee2f('0x44')](_0x57f65d[_0xee2f('0x45')],{})[_0xee2f('0x1d')](function(_0x4978eb){var _0x533ad0=_0x57f65d[_0xee2f('0x46')]['get']({'plain':!![]});if(!_0x533ad0)throw new Error(_0xee2f('0x47'));if(_0x533ad0[_0xee2f('0x48')]===_0xee2f('0x46')){var _0x88e683=_0x4978eb['get']({'plain':!![]});var _0x5df503=_0xee2f('0x49');return db[_0xee2f('0x4a')][_0xee2f('0x43')]({'where':{'name':_0x5df503,'userProfileId':_0x533ad0[_0xee2f('0x4b')]},'raw':!![]})[_0xee2f('0x1d')](function(_0x2a450f){if(_0x2a450f&&_0x2a450f[_0xee2f('0x4c')]===0x0){return db[_0xee2f('0x21')][_0xee2f('0x44')]({'name':_0x88e683[_0xee2f('0x24')],'resourceId':_0x88e683['id'],'type':_0xee2f('0x20'),'sectionId':_0x2a450f['id']},{})[_0xee2f('0x1d')](function(){return _0x4978eb;});}else{return _0x4978eb;}})['catch'](function(_0x34cb51){logger[_0xee2f('0x23')](_0xee2f('0x4d'),_0x34cb51);throw _0x34cb51;});}return _0x4978eb;})[_0xee2f('0x1d')](respondWithResult(_0x3d95b8,0xc9))['catch'](handleError(_0x3d95b8,null));};exports[_0xee2f('0x4e')]=function(_0xb3bf3f,_0x3a476f){if(_0xb3bf3f[_0xee2f('0x45')]['id']){delete _0xb3bf3f[_0xee2f('0x45')]['id'];}return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0xb3bf3f['params']['id']}})['then'](handleEntityNotFound(_0x3a476f,null))[_0xee2f('0x1d')](saveUpdates(_0xb3bf3f[_0xee2f('0x45')],null))[_0xee2f('0x1d')](respondWithResult(_0x3a476f,null))[_0xee2f('0x3f')](handleError(_0x3a476f,null));};exports[_0xee2f('0x1e')]=function(_0x101e09,_0x20aaca){return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0x101e09[_0xee2f('0x41')]['id']}})[_0xee2f('0x1d')](handleEntityNotFound(_0x20aaca,null))[_0xee2f('0x1d')](removeEntity(_0x20aaca,null))[_0xee2f('0x3f')](handleError(_0x20aaca,null));};exports[_0xee2f('0x4f')]=function(_0xcba6fc,_0x2b9636){var _0x1373a1=0xa;var _0x5d6c40=[_0xee2f('0x50'),'left_join',_0xee2f('0x51'),_0xee2f('0x52')];var _0x1dbbf2={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':_0xee2f('0x56'),'AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4fb159={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x1421da=function(_0xd967e9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),_0xee2f('0x5d'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xd967e9);};var _0x1708c5=function(_0x58e464){if(!_0x58e464||!_0x58e464[_0xee2f('0x5e')]['length']){return'';}for(var _0x7167f9='(',_0x59af84=0x0;_0x59af84<_0x58e464[_0xee2f('0x5e')][_0xee2f('0x32')];_0x59af84+=0x1){_0x59af84>0x0&&(_0x7167f9+='\x20'+_0x58e464[_0xee2f('0x5f')]+'\x20');_0x7167f9+=_0x58e464['rules'][_0x59af84][_0xee2f('0x60')]?_0x1708c5(_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x60')]):_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x61')]+'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x62')]+(_0x1421da(_0x58e464['rules'][_0x59af84][_0xee2f('0x62')])?'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x63')]:'');}return _0x7167f9+')';};var _0x353bd9={'where':{'id':_0xcba6fc[_0xee2f('0x41')]['id']}},_0x5280c7,_0x3c9d47,_0x8ccc9d,_0x15c7ff,_0x191af8;_0x353bd9=_[_0xee2f('0x3a')]({},_0x353bd9,_0xcba6fc['options']);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x353bd9)['then'](function(_0x9252e3){if(_0x9252e3){_0x5280c7=_0x9252e3;return _0x9252e3['getFields']();}return null;})[_0xee2f('0x1d')](function(_0x4ed7c9){if(_0x4ed7c9){if(!_0x4ed7c9['length']){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x3c9d47=_0x4ed7c9;return db[_0xee2f('0x67')][_0xee2f('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x238e7d){if(_0x238e7d){_0x8ccc9d=_[_0xee2f('0x68')](_0x238e7d,'id');var _0x42fae8;var _0x5d4fe8=squel[_0xee2f('0x69')]();_0x5d4fe8[_0xee2f('0x6a')](_0x5280c7['table']);for(var _0x1f1c55=0x0;_0x1f1c55<_0x3c9d47[_0xee2f('0x32')];_0x1f1c55+=0x1){_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]?_0x8ccc9d[_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x3c9d47[_0x1f1c55][_0xee2f('0x61')];_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x1dbbf2[_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]],'%s',_0x42fae8):_0x42fae8;_0x42fae8=_0x3c9d47[_0x1f1c55]['format']?_['replace'](_0x4fb159[_0x3c9d47[_0x1f1c55]['format']],'%s',_0x42fae8):_0x42fae8;if(_0x3c9d47[_0x1f1c55][_0xee2f('0x6f')]){_0x5d4fe8[_0xee2f('0x60')](_0x42fae8);}_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]&&_0x5d4fe8[_0xee2f('0x35')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x5d4fe8[_0xee2f('0x61')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x71')]||_0x42fae8);}if(_0x5280c7['joins']){_0x5280c7[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x72')]);for(var _0x5a7b6c=0x0;_0x5a7b6c<_0x5280c7[_0xee2f('0x72')]['length'];_0x5a7b6c+=0x1){if(_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]&&_['includes'](_0x5d6c40,_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')])&&_0x5280c7['joins'][_0x5a7b6c]['parentKey']&&_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')]&&_0x5280c7['joins'][_0x5a7b6c]['foreignKey']){_0x5d4fe8[_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]](_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')],null,util['format'](_0xee2f('0x76'),_0x5280c7[_0xee2f('0x77')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x78')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x75')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c]['foreignKey']));}}}if(_0x5280c7[_0xee2f('0x79')]){_0x5280c7[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x79')]);_0x5d4fe8[_0xee2f('0x37')](_0x1708c5(_0x5280c7['conditions'][_0xee2f('0x60')]));}_0x191af8=_0x5d4fe8[_0xee2f('0x7a')]();_0x5d4fe8[_0xee2f('0x15')](_0x1373a1);_0x5d4fe8[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x5d4fe8['toString']());return dbH['sequelize'][_0xee2f('0x2c')](_0x5d4fe8[_0xee2f('0x7d')](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](respondWithResult(_0x2b9636,null))[_0xee2f('0x3f')](handleError(_0x2b9636,null));};function runReport(_0x58c49e,_0x5b7b55,_0x2ad26d){var _0x27eabc=_0x5b7b55[_0xee2f('0x24')];var _0xc92046=0xa;var _0x38ee46=[_0xee2f('0x50'),_0xee2f('0x81'),_0xee2f('0x51'),_0xee2f('0x52')];var _0x21ac2d={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xee2f('0x56'),'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 _0x2ea31f={'SEC_TO_TIME':_0xee2f('0x82'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x18e191=function(_0x4fad8f){return!_['includes']([_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x84'),'IS\x20NOT\x20EMPTY'],_0x4fad8f);};var _0xd7c8f8=function(_0x4b0611){if(!_0x4b0611||!_0x4b0611[_0xee2f('0x5e')]['length']){return'';}for(var _0x378fc9='(',_0x25a3b9=0x0;_0x25a3b9<_0x4b0611[_0xee2f('0x5e')]['length'];_0x25a3b9+=0x1){_0x25a3b9>0x0&&(_0x378fc9+='\x20'+_0x4b0611['operator']+'\x20');_0x378fc9+=_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x60')]?_0xd7c8f8(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9]['group']):_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x61')]+'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')]+(_0x18e191(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')])?'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x63')]:'');}return _0x378fc9+')';};var _0x449656={'where':{'id':_0x58c49e['id']}},_0x1db0b5,_0x9f06f9,_0x659080,_0x28bde7,_0x214f94;_0x449656=_['merge']({},_0x449656,_0x2ad26d);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x449656)[_0xee2f('0x1d')](function(_0x2f5ed7){if(_0x2f5ed7){_0x1db0b5=_0x2f5ed7;return _0x2f5ed7[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x34cd09){if(_0x34cd09){if(!_0x34cd09[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x9f06f9=_0x34cd09;return db['AnalyticMetric'][_0xee2f('0x3d')]({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x1422e9){if(_0x1422e9){_0x659080=_[_0xee2f('0x68')](_0x1422e9,'id');var _0x53d769;var _0x15ca4e=squel[_0xee2f('0x69')]();_0x15ca4e[_0xee2f('0x6a')](_0x1db0b5['table']);for(var _0x4f02aa=0x0;_0x4f02aa<_0x9f06f9[_0xee2f('0x32')];_0x4f02aa+=0x1){_0x53d769=_0x9f06f9[_0x4f02aa]['MetricId']?_0x659080[_0x9f06f9[_0x4f02aa]['MetricId']]['metric']:_0x9f06f9[_0x4f02aa][_0xee2f('0x61')];_0x53d769=_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x21ac2d[_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]],'%s',_0x53d769):_0x53d769;_0x53d769=_0x9f06f9[_0x4f02aa]['format']?_[_0xee2f('0x6e')](_0x2ea31f[_0x9f06f9[_0x4f02aa][_0xee2f('0x86')]],'%s',_0x53d769):_0x53d769;if(_0x9f06f9[_0x4f02aa][_0xee2f('0x6f')]){_0x15ca4e['group'](_0x53d769);}_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]&&_0x15ca4e['order'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x15ca4e['field'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x71')]||_0x53d769);}if(_0x1db0b5['joins']){_0x1db0b5[_0xee2f('0x72')]=JSON['parse'](_0x1db0b5['joins']);for(var _0x149d7f=0x0;_0x149d7f<_0x1db0b5[_0xee2f('0x72')]['length'];_0x149d7f+=0x1){if(_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x74')]&&_['includes'](_0x38ee46,_0x1db0b5['joins'][_0x149d7f][_0xee2f('0x74')])&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['parentKey']&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')]&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]){_0x15ca4e[_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['type']](_0x1db0b5['joins'][_0x149d7f]['foreignTable'],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x1db0b5[_0xee2f('0x77')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x78')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]));}}}if(_0x1db0b5[_0xee2f('0x79')]){_0x1db0b5[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x1db0b5[_0xee2f('0x79')]);_0x15ca4e[_0xee2f('0x37')](_0xd7c8f8(_0x1db0b5[_0xee2f('0x79')][_0xee2f('0x60')]));}_0x214f94=_0x15ca4e['clone']();_0x15ca4e['limit'](_0xc92046);_0x15ca4e[_0xee2f('0x14')](0x0);return;}})[_0xee2f('0x1d')](function(){if(_0x5b7b55['output']===_0xee2f('0x88')){return null;}var _0x444c39=_[_0xee2f('0x3a')](_0x5b7b55,{'name':_0x5b7b55['fullPath']||_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],'basename':_0x27eabc,'savename':util[_0xee2f('0x86')](_0xee2f('0x89'),_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],require(_0xee2f('0x8a'))[_0xee2f('0x8b')](0x4),_0x5b7b55[_0xee2f('0x8c')]||'csv'),'reportId':_0x1db0b5['id'],'reportType':_0xee2f('0x8d')});return db[_0xee2f('0x8e')][_0xee2f('0x44')](_0x444c39,{'raw':!![]});})[_0xee2f('0x1d')](function(_0xe7e196){if(_0x1db0b5[_0xee2f('0x77')]===_0xee2f('0x8f')){_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+_0xee2f('0x90'),_0x5b7b55[_0xee2f('0x91')],_0x5b7b55['endDate']);}else{_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b7b55[_0xee2f('0x91')],_0x5b7b55[_0xee2f('0x92')]);}if(_0xe7e196){logger[_0xee2f('0x93')](_0xee2f('0x94'),_0x214f94[_0xee2f('0x7d')]());require(_0xee2f('0x95'))['fork'](path[_0xee2f('0x50')](__dirname,_0xee2f('0x96'),_0xe7e196['output']),[_0xe7e196['id'],_0x214f94[_0xee2f('0x7d')](),path[_0xee2f('0x50')](__dirname,'../../files/reports',_0xe7e196[_0xee2f('0x97')]),_0x27eabc]);return _0xe7e196;}else{var _0x26dd6c=squel[_0xee2f('0x69')]();_0x26dd6c[_0xee2f('0x6a')]('('+_0x214f94[_0xee2f('0x7d')]()+')',_0xee2f('0x98'));_0x26dd6c[_0xee2f('0x61')](_0xee2f('0x99'),_0xee2f('0x17'));_0x214f94[_0xee2f('0x15')](_0x5b7b55[_0xee2f('0x15')]||_0xc92046);_0x214f94[_0xee2f('0x14')](_0x5b7b55['offset']||0x0);return dbH[_0xee2f('0x7e')]['query'](_0x26dd6c['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')]['SELECT']})[_0xee2f('0x1d')](function(_0x472f83){if(!_0x472f83[_0xee2f('0x32')]){_0x28bde7=0x0;}else{_0x28bde7=_0x472f83[0x0]['count']||0x0;}return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x214f94['toString'](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});})[_0xee2f('0x1d')](function(_0x121a34){return{'rows':_0x121a34||[],'count':_0x28bde7};});}});}exports[_0xee2f('0x9a')]=function(_0x3d8c56,_0x5c8550){return runReport(_0x3d8c56[_0xee2f('0x41')],_0x3d8c56[_0xee2f('0x2c')],_0x3d8c56['options'])[_0xee2f('0x1d')](respondWithResult(_0x5c8550,null))[_0xee2f('0x3f')](handleError(_0x5c8550,null));};exports[_0xee2f('0x9b')]=runReport;exports['query']=function(_0x40fa57,_0x1fafcc){var _0x1163f1=0xa;var _0x162014=[_0xee2f('0x50'),_0xee2f('0x81'),'right_join',_0xee2f('0x52')];var _0xb93091={'SUM':_0xee2f('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':'MIN(%s)','AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xee2f('0x9c')};var _0x39922f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1c9f70=function(_0xa93dc9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),'IS\x20NOT\x20NULL',_0xee2f('0x84'),_0xee2f('0x9d')],_0xa93dc9);};var _0x44b06b=function(_0x541ac7){if(!_0x541ac7||!_0x541ac7[_0xee2f('0x5e')][_0xee2f('0x32')]){return'';}for(var _0xa89897='(',_0x2def5c=0x0;_0x2def5c<_0x541ac7['rules']['length'];_0x2def5c+=0x1){_0x2def5c>0x0&&(_0xa89897+='\x20'+_0x541ac7[_0xee2f('0x5f')]+'\x20');_0xa89897+=_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x60')]?_0x44b06b(_0x541ac7['rules'][_0x2def5c][_0xee2f('0x60')]):_0x541ac7[_0xee2f('0x5e')][_0x2def5c]['field']+'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')]+(_0x1c9f70(_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')])?'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x63')]:'');}return _0xa89897+')';};var _0x3f9188={'where':{'id':_0x40fa57['params']['id']}},_0x236b63,_0x4ad336,_0x3370de,_0x3c8c20,_0xc9228;_0x3f9188=_[_0xee2f('0x3a')]({},_0x3f9188,_0x40fa57[_0xee2f('0x3b')]);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x3f9188)[_0xee2f('0x1d')](function(_0xa0dfdd){if(_0xa0dfdd){_0x236b63=_0xa0dfdd;return _0xa0dfdd[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x298dfa){if(_0x298dfa){if(!_0x298dfa[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ad336=_0x298dfa;return db[_0xee2f('0x67')]['findAll']({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x35a1c9){if(_0x35a1c9){_0x3370de=_['keyBy'](_0x35a1c9,'id');var _0x464e9e;var _0x738f35=squel[_0xee2f('0x69')]();_0x738f35[_0xee2f('0x6a')](_0x236b63[_0xee2f('0x77')]);for(var _0xe24a8a=0x0;_0xe24a8a<_0x4ad336['length'];_0xe24a8a+=0x1){_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]?_0x3370de[_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x4ad336[_0xe24a8a][_0xee2f('0x61')];_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0xb93091[_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]],'%s',_0x464e9e):_0x464e9e;_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x86')]?_[_0xee2f('0x6e')](_0x39922f[_0x4ad336[_0xe24a8a][_0xee2f('0x86')]],'%s',_0x464e9e):_0x464e9e;if(_0x4ad336[_0xe24a8a]['groupBy']){_0x738f35[_0xee2f('0x60')](_0x464e9e);}_0x4ad336[_0xe24a8a][_0xee2f('0x70')]&&_0x738f35[_0xee2f('0x35')](_0x464e9e,_0x4ad336[_0xe24a8a]['orderBy']==='DESC'?![]:!![]);_0x738f35[_0xee2f('0x61')](_0x464e9e,_0x4ad336[_0xe24a8a][_0xee2f('0x71')]||_0x464e9e);}if(_0x236b63[_0xee2f('0x72')]){_0x236b63[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x236b63['joins']);for(var _0x1cee16=0x0;_0x1cee16<_0x236b63[_0xee2f('0x72')]['length'];_0x1cee16+=0x1){if(_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]&&_[_0xee2f('0x5b')](_0x162014,_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')])&&_0x236b63[_0xee2f('0x72')][_0x1cee16]['parentKey']&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')]&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]){_0x738f35[_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]](_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x236b63[_0xee2f('0x77')],_0x236b63['joins'][_0x1cee16][_0xee2f('0x78')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]));}}}if(_0x236b63[_0xee2f('0x79')]){_0x236b63['conditions']=JSON[_0xee2f('0x73')](_0x236b63[_0xee2f('0x79')]);_0x738f35[_0xee2f('0x37')](_0x44b06b(_0x236b63[_0xee2f('0x79')]['group']));}_0xc9228=_0x738f35[_0xee2f('0x7a')]();_0x738f35[_0xee2f('0x15')](_0x1163f1);_0x738f35[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x738f35[_0xee2f('0x7d')]());return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x738f35['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](function(){return{'sql':_0xc9228['toString']()};})[_0xee2f('0x1d')](respondWithResult(_0x1fafcc,null))['catch'](handleError(_0x1fafcc,null));}; \ No newline at end of file +var _0xdbf5=['includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','debug','Limited\x20Query:','toString','SELECT','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','IS\x20EMPTY','ValidationErrorItem','metric','DESC','clone','output','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','startDate','endDate','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','sequelize','QueryTypes','run','Sequelize','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','end','status','json','limit','undefined','count','set','Content-Range','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','catch','update','join','left_join','right_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x1e028d,_0x473948){_0x1e028d=_0x1e028d-0x0;var _0x535a54=_0xdbf5[_0x1e028d];return _0x535a54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5dbf('0x16'))[_0x5dbf('0x17')];function respondWithStatusCode(_0x1453a9,_0x7cb848){_0x7cb848=_0x7cb848||0xcc;return function(_0x14493a){if(_0x14493a){return _0x1453a9['sendStatus'](_0x7cb848);}return _0x1453a9['status'](_0x7cb848)[_0x5dbf('0x18')]();};}function respondWithResult(_0x3480c8,_0x48e7fd){_0x48e7fd=_0x48e7fd||0xc8;return function(_0x19624e){if(_0x19624e){return _0x3480c8[_0x5dbf('0x19')](_0x48e7fd)[_0x5dbf('0x1a')](_0x19624e);}};}function respondWithFilteredResult(_0x2dfa44,_0x181816){return function(_0x472eb9){if(_0x472eb9){var _0x2d32cc=typeof _0x181816['offset']==='undefined'&&typeof _0x181816[_0x5dbf('0x1b')]===_0x5dbf('0x1c');var _0x39c7aa=_0x472eb9[_0x5dbf('0x1d')];var _0x20c2b0=_0x2d32cc?0x0:_0x181816['offset'];var _0x11cd00=_0x2d32cc?_0x472eb9['count']:_0x181816['offset']+_0x181816['limit'];var _0x23d1e7;if(_0x11cd00>=_0x39c7aa){_0x11cd00=_0x39c7aa;_0x23d1e7=0xc8;}else{_0x23d1e7=0xce;}_0x2dfa44[_0x5dbf('0x19')](_0x23d1e7);return _0x2dfa44[_0x5dbf('0x1e')](_0x5dbf('0x1f'),_0x20c2b0+'-'+_0x11cd00+'/'+_0x39c7aa)[_0x5dbf('0x1a')](_0x472eb9);}return null;};}function patchUpdates(_0x5b2518){return function(_0x2764ea){try{jsonpatch['apply'](_0x2764ea,_0x5b2518,!![]);}catch(_0xb68f92){return BPromise[_0x5dbf('0x20')](_0xb68f92);}return _0x2764ea[_0x5dbf('0x21')]();};}function saveUpdates(_0x43a612,_0x3b763c){return function(_0x2f154e){if(_0x2f154e){return _0x2f154e['update'](_0x43a612)[_0x5dbf('0x22')](function(_0x3e3a2d){return _0x3e3a2d;});}return null;};}function removeEntity(_0x2d3e1b,_0x2079fc){return function(_0x2763ec){if(_0x2763ec){return _0x2763ec[_0x5dbf('0x23')]()[_0x5dbf('0x22')](function(){var _0x20ab1b=_0x2763ec[_0x5dbf('0x24')]({'plain':!![]});var _0x15a790=_0x5dbf('0x25');return db[_0x5dbf('0x26')][_0x5dbf('0x23')]({'where':{'type':_0x15a790,'resourceId':_0x20ab1b['id']}})[_0x5dbf('0x22')](function(){return _0x2763ec;});})[_0x5dbf('0x22')](function(){_0x2d3e1b[_0x5dbf('0x19')](0xcc)[_0x5dbf('0x18')]();});}};}function handleEntityNotFound(_0x3f8341,_0x159e61){return function(_0x22ec42){if(!_0x22ec42){_0x3f8341[_0x5dbf('0x27')](0x194);}return _0x22ec42;};}function handleError(_0x471027,_0x21cd00){_0x21cd00=_0x21cd00||0x1f4;return function(_0x5768b7){logger[_0x5dbf('0x28')](_0x5768b7[_0x5dbf('0x29')]);if(_0x5768b7[_0x5dbf('0x2a')]){delete _0x5768b7[_0x5dbf('0x2a')];}_0x471027[_0x5dbf('0x19')](_0x21cd00)[_0x5dbf('0x2b')](_0x5768b7);};}exports[_0x5dbf('0x2c')]=function(_0x31d57a,_0x406ce6){var _0x273b63={},_0x294dd7={},_0x50a307={'count':0x0,'rows':[]};var _0x4c1587=_[_0x5dbf('0x2d')](db[_0x5dbf('0x2e')][_0x5dbf('0x2f')],function(_0x3b73ad){return{'name':_0x3b73ad[_0x5dbf('0x30')],'type':_0x3b73ad['type']['key']};});_0x294dd7[_0x5dbf('0x31')]=_[_0x5dbf('0x2d')](_0x4c1587,'name');_0x294dd7[_0x5dbf('0x32')]=_[_0x5dbf('0x33')](_0x31d57a[_0x5dbf('0x32')]);_0x294dd7[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x294dd7['model'],_0x294dd7[_0x5dbf('0x32')]);_0x273b63[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x294dd7[_0x5dbf('0x31')],qs[_0x5dbf('0x37')](_0x31d57a['query'][_0x5dbf('0x37')]));_0x273b63[_0x5dbf('0x36')]=_0x273b63[_0x5dbf('0x36')][_0x5dbf('0x38')]?_0x273b63['attributes']:_0x294dd7[_0x5dbf('0x31')];if(!_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x39')](_0x5dbf('0x3a'))){_0x273b63[_0x5dbf('0x1b')]=qs[_0x5dbf('0x1b')](_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x1b')]);_0x273b63[_0x5dbf('0x3b')]=qs[_0x5dbf('0x3b')](_0x31d57a[_0x5dbf('0x32')]['offset']);}_0x273b63[_0x5dbf('0x3c')]=qs[_0x5dbf('0x3d')](_0x31d57a[_0x5dbf('0x32')]['sort']);_0x273b63[_0x5dbf('0x3e')]=qs[_0x5dbf('0x34')](_[_0x5dbf('0x3f')](_0x31d57a['query'],_0x294dd7[_0x5dbf('0x34')]),_0x4c1587);if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x40')]){_0x273b63['where']=_[_0x5dbf('0x41')](_0x273b63[_0x5dbf('0x3e')],{'$or':_[_0x5dbf('0x2d')](_0x4c1587,function(_0x260c9f){if(_0x260c9f[_0x5dbf('0x42')]!==_0x5dbf('0x43')){var _0x321ae3={};_0x321ae3[_0x260c9f[_0x5dbf('0x2a')]]={'$like':'%'+_0x31d57a['query']['filter']+'%'};return _0x321ae3;}})});}_0x273b63=_['merge']({},_0x273b63,_0x31d57a['options']);var _0x28b28f={'where':_0x273b63[_0x5dbf('0x3e')]};return db['AnalyticDefaultReport'][_0x5dbf('0x1d')](_0x28b28f)[_0x5dbf('0x22')](function(_0x5a60e8){_0x50a307[_0x5dbf('0x1d')]=_0x5a60e8;if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x44')]){_0x273b63[_0x5dbf('0x45')]=[{'all':!![]}];}return db[_0x5dbf('0x2e')][_0x5dbf('0x46')](_0x273b63);})[_0x5dbf('0x22')](function(_0x1c020a){_0x50a307[_0x5dbf('0x47')]=_0x1c020a;return _0x50a307;})[_0x5dbf('0x22')](respondWithFilteredResult(_0x406ce6,_0x273b63))['catch'](handleError(_0x406ce6,null));};exports[_0x5dbf('0x48')]=function(_0x22f958,_0xec1d28){var _0x50880d={'raw':!![],'where':{'id':_0x22f958[_0x5dbf('0x49')]['id']}},_0x16b0ff={};_0x16b0ff[_0x5dbf('0x31')]=_[_0x5dbf('0x33')](db['AnalyticDefaultReport'][_0x5dbf('0x2f')]);_0x16b0ff['query']=_[_0x5dbf('0x33')](_0x22f958[_0x5dbf('0x32')]);_0x16b0ff[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x16b0ff['model'],_0x16b0ff['query']);_0x50880d[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x16b0ff[_0x5dbf('0x31')],qs['fields'](_0x22f958[_0x5dbf('0x32')]['fields']));_0x50880d['attributes']=_0x50880d['attributes']['length']?_0x50880d[_0x5dbf('0x36')]:_0x16b0ff[_0x5dbf('0x31')];if(_0x22f958['query'][_0x5dbf('0x44')]){_0x50880d[_0x5dbf('0x45')]=[{'all':!![]}];}_0x50880d=_['merge']({},_0x50880d,_0x22f958[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')]['find'](_0x50880d)[_0x5dbf('0x22')](handleEntityNotFound(_0xec1d28,null))['then'](respondWithResult(_0xec1d28,null))['catch'](handleError(_0xec1d28,null));};exports[_0x5dbf('0x4b')]=function(_0x2a3d30,_0x17a1c0){return db['AnalyticDefaultReport']['create'](_0x2a3d30[_0x5dbf('0x4c')],{})[_0x5dbf('0x22')](function(_0x21f477){var _0x307a00=_0x2a3d30[_0x5dbf('0x4d')][_0x5dbf('0x24')]({'plain':!![]});if(!_0x307a00)throw new Error(_0x5dbf('0x4e'));if(_0x307a00[_0x5dbf('0x4f')]==='user'){var _0x3f38a0=_0x21f477[_0x5dbf('0x24')]({'plain':!![]});var _0x2927a3=_0x5dbf('0x50');return db[_0x5dbf('0x51')][_0x5dbf('0x52')]({'where':{'name':_0x2927a3,'userProfileId':_0x307a00[_0x5dbf('0x53')]},'raw':!![]})['then'](function(_0x1b0b13){if(_0x1b0b13&&_0x1b0b13['autoAssociation']===0x0){return db[_0x5dbf('0x26')][_0x5dbf('0x4b')]({'name':_0x3f38a0[_0x5dbf('0x2a')],'resourceId':_0x3f38a0['id'],'type':_0x5dbf('0x25'),'sectionId':_0x1b0b13['id']},{})[_0x5dbf('0x22')](function(){return _0x21f477;});}else{return _0x21f477;}})[_0x5dbf('0x54')](function(_0x353d0f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x353d0f);throw _0x353d0f;});}return _0x21f477;})['then'](respondWithResult(_0x17a1c0,0xc9))[_0x5dbf('0x54')](handleError(_0x17a1c0,null));};exports[_0x5dbf('0x55')]=function(_0x36a787,_0x56c8b2){if(_0x36a787['body']['id']){delete _0x36a787[_0x5dbf('0x4c')]['id'];}return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x36a787['params']['id']}})[_0x5dbf('0x22')](handleEntityNotFound(_0x56c8b2,null))['then'](saveUpdates(_0x36a787[_0x5dbf('0x4c')],null))[_0x5dbf('0x22')](respondWithResult(_0x56c8b2,null))[_0x5dbf('0x54')](handleError(_0x56c8b2,null));};exports['destroy']=function(_0x55fd51,_0x1b316d){return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x55fd51[_0x5dbf('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b316d,null))[_0x5dbf('0x22')](removeEntity(_0x1b316d,null))[_0x5dbf('0x54')](handleError(_0x1b316d,null));};exports['preview']=function(_0x5485f3,_0x19ec03){var _0x14bdb1=0xa;var _0x197e8c=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),'cross_join'];var _0x4107f1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5dbf('0x59'),'MIN':'MIN(%s)','AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x461ffb={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x3a84c2=function(_0x2ca889){return!_[_0x5dbf('0x63')]([_0x5dbf('0x64'),_0x5dbf('0x65'),'IS\x20EMPTY',_0x5dbf('0x66')],_0x2ca889);};var _0x553be4=function(_0xb0a9bf){if(!_0xb0a9bf||!_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x110224='(',_0x5a975a=0x0;_0x5a975a<_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')];_0x5a975a+=0x1){_0x5a975a>0x0&&(_0x110224+='\x20'+_0xb0a9bf[_0x5dbf('0x68')]+'\x20');_0x110224+=_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x69')]?_0x553be4(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a]['group']):_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6a')]+'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')]+(_0x3a84c2(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')])?'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6c')]:'');}return _0x110224+')';};var _0x12d69b={'where':{'id':_0x5485f3[_0x5dbf('0x49')]['id']}},_0x3b53da,_0x13c8ab,_0x2997a8,_0x5d7a37,_0x52109d;_0x12d69b=_[_0x5dbf('0x41')]({},_0x12d69b,_0x5485f3[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x12d69b)[_0x5dbf('0x22')](function(_0x1b42cf){if(_0x1b42cf){_0x3b53da=_0x1b42cf;return _0x1b42cf[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x57c568){if(_0x57c568){if(!_0x57c568['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x5dbf('0x6e'),0x193);}_0x13c8ab=_0x57c568;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x29c4d9){if(_0x29c4d9){_0x2997a8=_[_0x5dbf('0x70')](_0x29c4d9,'id');var _0x5331ff;var _0x5bb990=squel[_0x5dbf('0x71')]();_0x5bb990[_0x5dbf('0x72')](_0x3b53da['table']);for(var _0x1728b9=0x0;_0x1728b9<_0x13c8ab[_0x5dbf('0x38')];_0x1728b9+=0x1){_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]?_0x2997a8[_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]]['metric']:_0x13c8ab[_0x1728b9][_0x5dbf('0x6a')];_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4107f1[_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]],'%s',_0x5331ff):_0x5331ff;_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]?_['replace'](_0x461ffb[_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]],'%s',_0x5331ff):_0x5331ff;if(_0x13c8ab[_0x1728b9][_0x5dbf('0x77')]){_0x5bb990[_0x5dbf('0x69')](_0x5331ff);}_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]&&_0x5bb990['order'](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]==='DESC'?![]:!![]);_0x5bb990[_0x5dbf('0x6a')](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x79')]||_0x5331ff);}if(_0x3b53da[_0x5dbf('0x7a')]){_0x3b53da['joins']=JSON[_0x5dbf('0x7b')](_0x3b53da[_0x5dbf('0x7a')]);for(var _0x4166ce=0x0;_0x4166ce<_0x3b53da[_0x5dbf('0x7a')]['length'];_0x4166ce+=0x1){if(_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x197e8c,_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')])&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce]['parentKey']&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')]&&_0x3b53da['joins'][_0x4166ce][_0x5dbf('0x7d')]){_0x5bb990[_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]](_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')](_0x5dbf('0x7e'),_0x3b53da[_0x5dbf('0x7f')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x80')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7d')]));}}}if(_0x3b53da[_0x5dbf('0x81')]){_0x3b53da[_0x5dbf('0x81')]=JSON['parse'](_0x3b53da[_0x5dbf('0x81')]);_0x5bb990[_0x5dbf('0x3e')](_0x553be4(_0x3b53da[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x52109d=_0x5bb990['clone']();_0x5bb990[_0x5dbf('0x1b')](_0x14bdb1);_0x5bb990[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')](_0x5dbf('0x83'),_0x5bb990[_0x5dbf('0x84')]());return dbH['sequelize'][_0x5dbf('0x32')](_0x5bb990[_0x5dbf('0x84')](),{'type':dbH['sequelize']['QueryTypes'][_0x5dbf('0x85')]});}})[_0x5dbf('0x22')](respondWithResult(_0x19ec03,null))[_0x5dbf('0x54')](handleError(_0x19ec03,null));};function runReport(_0x8ca7de,_0x14b21b,_0x23ec75){var _0x22339b=_0x14b21b['name'];var _0x310078=0xa;var _0x3b01c0=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x4cceb1={'SUM':_0x5dbf('0x87'),'COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5924d2={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x4333db=function(_0x4cb92d){return!_['includes']([_0x5dbf('0x64'),'IS\x20NOT\x20NULL',_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x4cb92d);};var _0x541241=function(_0x3c7eaa){if(!_0x3c7eaa||!_0x3c7eaa['rules'][_0x5dbf('0x38')]){return'';}for(var _0x24d90a='(',_0xa3e94f=0x0;_0xa3e94f<_0x3c7eaa[_0x5dbf('0x67')][_0x5dbf('0x38')];_0xa3e94f+=0x1){_0xa3e94f>0x0&&(_0x24d90a+='\x20'+_0x3c7eaa['operator']+'\x20');_0x24d90a+=_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]?_0x541241(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]):_0x3c7eaa['rules'][_0xa3e94f][_0x5dbf('0x6a')]+'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')]+(_0x4333db(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')])?'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6c')]:'');}return _0x24d90a+')';};var _0x334f63={'where':{'id':_0x8ca7de['id']}},_0x5ac29f,_0x533fdd,_0x5bf068,_0x1bd06b,_0x274497;_0x334f63=_['merge']({},_0x334f63,_0x23ec75);return db['AnalyticDefaultReport']['find'](_0x334f63)[_0x5dbf('0x22')](function(_0x20bda9){if(_0x20bda9){_0x5ac29f=_0x20bda9;return _0x20bda9[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x12757d){if(_0x12757d){if(!_0x12757d[_0x5dbf('0x38')]){throw new db['Sequelize'][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x533fdd=_0x12757d;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x5722b3){if(_0x5722b3){_0x5bf068=_['keyBy'](_0x5722b3,'id');var _0x3a27c4;var _0x3620d2=squel[_0x5dbf('0x71')]();_0x3620d2['from'](_0x5ac29f[_0x5dbf('0x7f')]);for(var _0x447259=0x0;_0x447259<_0x533fdd['length'];_0x447259+=0x1){_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x73')]?_0x5bf068[_0x533fdd[_0x447259][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x533fdd[_0x447259][_0x5dbf('0x6a')];_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4cceb1[_0x533fdd[_0x447259][_0x5dbf('0x74')]],'%s',_0x3a27c4):_0x3a27c4;_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x76')]?_['replace'](_0x5924d2[_0x533fdd[_0x447259]['format']],'%s',_0x3a27c4):_0x3a27c4;if(_0x533fdd[_0x447259]['groupBy']){_0x3620d2[_0x5dbf('0x69')](_0x3a27c4);}_0x533fdd[_0x447259][_0x5dbf('0x78')]&&_0x3620d2[_0x5dbf('0x3c')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x78')]===_0x5dbf('0x8e')?![]:!![]);_0x3620d2[_0x5dbf('0x6a')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x79')]||_0x3a27c4);}if(_0x5ac29f[_0x5dbf('0x7a')]){_0x5ac29f[_0x5dbf('0x7a')]=JSON[_0x5dbf('0x7b')](_0x5ac29f['joins']);for(var _0x2ded2b=0x0;_0x2ded2b<_0x5ac29f[_0x5dbf('0x7a')][_0x5dbf('0x38')];_0x2ded2b+=0x1){if(_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x3b01c0,_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')])&&_0x5ac29f['joins'][_0x2ded2b]['parentKey']&&_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b]['foreignTable']&&_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7d')]){_0x3620d2[_0x5ac29f['joins'][_0x2ded2b]['type']](_0x5ac29f['joins'][_0x2ded2b]['foreignTable'],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x5ac29f[_0x5dbf('0x7f')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x80')],_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7c')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x7d')]));}}}if(_0x5ac29f['conditions']){_0x5ac29f[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x5ac29f[_0x5dbf('0x81')]);_0x3620d2['where'](_0x541241(_0x5ac29f[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x274497=_0x3620d2[_0x5dbf('0x8f')]();_0x3620d2['limit'](_0x310078);_0x3620d2[_0x5dbf('0x3b')](0x0);return;}})[_0x5dbf('0x22')](function(){if(_0x14b21b[_0x5dbf('0x90')]==='web'){return null;}var _0x48a8c5=_['merge'](_0x14b21b,{'name':_0x14b21b[_0x5dbf('0x91')]||_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f[_0x5dbf('0x2a')],'basename':_0x22339b,'savename':util[_0x5dbf('0x76')](_0x5dbf('0x92'),_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f['name'],require(_0x5dbf('0x93'))[_0x5dbf('0x94')](0x4),_0x14b21b[_0x5dbf('0x90')]||'csv'),'reportId':_0x5ac29f['id'],'reportType':_0x5dbf('0x95')});return db[_0x5dbf('0x96')][_0x5dbf('0x4b')](_0x48a8c5,{'raw':!![]});})[_0x5dbf('0x22')](function(_0x2afbd4){if(_0x5ac29f[_0x5dbf('0x7f')]===_0x5dbf('0x97')){_0x274497['where'](_0x5ac29f[_0x5dbf('0x7f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b[_0x5dbf('0x98')],_0x14b21b[_0x5dbf('0x99')]);}else{_0x274497[_0x5dbf('0x3e')](_0x5ac29f['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b['startDate'],_0x14b21b[_0x5dbf('0x99')]);}if(_0x2afbd4){logger[_0x5dbf('0x9a')]('Run\x20Query:',_0x274497[_0x5dbf('0x84')]());require('child_process')[_0x5dbf('0x9b')](path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9c'),_0x2afbd4['output']),[_0x2afbd4['id'],_0x274497[_0x5dbf('0x84')](),path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9d'),_0x2afbd4[_0x5dbf('0x9e')]),_0x22339b]);return _0x2afbd4;}else{var _0x4bc5af=squel[_0x5dbf('0x71')]();_0x4bc5af[_0x5dbf('0x72')]('('+_0x274497['toString']()+')',_0x5dbf('0x9f'));_0x4bc5af['field'](_0x5dbf('0xa0'),_0x5dbf('0x1d'));_0x274497[_0x5dbf('0x1b')](_0x14b21b['limit']||_0x310078);_0x274497[_0x5dbf('0x3b')](_0x14b21b[_0x5dbf('0x3b')]||0x0);return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x4bc5af[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')]['QueryTypes'][_0x5dbf('0x85')]})['then'](function(_0x6cfb82){if(!_0x6cfb82[_0x5dbf('0x38')]){_0x1bd06b=0x0;}else{_0x1bd06b=_0x6cfb82[0x0][_0x5dbf('0x1d')]||0x0;}return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x274497[_0x5dbf('0x84')](),{'type':dbH['sequelize'][_0x5dbf('0xa2')][_0x5dbf('0x85')]});})[_0x5dbf('0x22')](function(_0x4d68f6){return{'rows':_0x4d68f6||[],'count':_0x1bd06b};});}});}exports[_0x5dbf('0xa3')]=function(_0x47ac95,_0x51b241){return runReport(_0x47ac95[_0x5dbf('0x49')],_0x47ac95[_0x5dbf('0x32')],_0x47ac95[_0x5dbf('0x4a')])[_0x5dbf('0x22')](respondWithResult(_0x51b241,null))[_0x5dbf('0x54')](handleError(_0x51b241,null));};exports['runReport']=runReport;exports['query']=function(_0x4f38a0,_0x144300){var _0x1da1e3=0xa;var _0x25e681=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x236754={'SUM':'SUM(%s)','COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x191a16={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x51b0df=function(_0x48ea8a){return!_['includes']([_0x5dbf('0x64'),_0x5dbf('0x65'),_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x48ea8a);};var _0x3de263=function(_0x4f8dde){if(!_0x4f8dde||!_0x4f8dde[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x19effa='(',_0x29177e=0x0;_0x29177e<_0x4f8dde[_0x5dbf('0x67')]['length'];_0x29177e+=0x1){_0x29177e>0x0&&(_0x19effa+='\x20'+_0x4f8dde[_0x5dbf('0x68')]+'\x20');_0x19effa+=_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x69')]?_0x3de263(_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['group']):_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6a')]+'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')]+(_0x51b0df(_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')])?'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['value']:'');}return _0x19effa+')';};var _0x4899ac={'where':{'id':_0x4f38a0['params']['id']}},_0x51864c,_0x4562a4,_0x240304,_0x5df275,_0xc588a2;_0x4899ac=_[_0x5dbf('0x41')]({},_0x4899ac,_0x4f38a0['options']);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x4899ac)[_0x5dbf('0x22')](function(_0x2eafe0){if(_0x2eafe0){_0x51864c=_0x2eafe0;return _0x2eafe0[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x414859){if(_0x414859){if(!_0x414859['length']){throw new db[(_0x5dbf('0xa4'))][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x4562a4=_0x414859;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x153401){if(_0x153401){_0x240304=_[_0x5dbf('0x70')](_0x153401,'id');var _0xbe0ca0;var _0x521c72=squel[_0x5dbf('0x71')]();_0x521c72[_0x5dbf('0x72')](_0x51864c[_0x5dbf('0x7f')]);for(var _0x6b4262=0x0;_0x6b4262<_0x4562a4[_0x5dbf('0x38')];_0x6b4262+=0x1){_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x73')]?_0x240304[_0x4562a4[_0x6b4262][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x4562a4[_0x6b4262][_0x5dbf('0x6a')];_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x236754[_0x4562a4[_0x6b4262][_0x5dbf('0x74')]],'%s',_0xbe0ca0):_0xbe0ca0;_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x76')]?_[_0x5dbf('0x75')](_0x191a16[_0x4562a4[_0x6b4262][_0x5dbf('0x76')]],'%s',_0xbe0ca0):_0xbe0ca0;if(_0x4562a4[_0x6b4262][_0x5dbf('0x77')]){_0x521c72[_0x5dbf('0x69')](_0xbe0ca0);}_0x4562a4[_0x6b4262][_0x5dbf('0x78')]&&_0x521c72[_0x5dbf('0x3c')](_0xbe0ca0,_0x4562a4[_0x6b4262]['orderBy']===_0x5dbf('0x8e')?![]:!![]);_0x521c72['field'](_0xbe0ca0,_0x4562a4[_0x6b4262][_0x5dbf('0x79')]||_0xbe0ca0);}if(_0x51864c['joins']){_0x51864c[_0x5dbf('0x7a')]=JSON['parse'](_0x51864c[_0x5dbf('0x7a')]);for(var _0x417869=0x0;_0x417869<_0x51864c[_0x5dbf('0x7a')]['length'];_0x417869+=0x1){if(_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x25e681,_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')])&&_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x80')]&&_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')]&&_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignKey']){_0x521c72[_0x51864c[_0x5dbf('0x7a')][_0x417869]['type']](_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x51864c[_0x5dbf('0x7f')],_0x51864c['joins'][_0x417869]['parentKey'],_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignTable'],_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x7d')]));}}}if(_0x51864c[_0x5dbf('0x81')]){_0x51864c[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x51864c[_0x5dbf('0x81')]);_0x521c72[_0x5dbf('0x3e')](_0x3de263(_0x51864c[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0xc588a2=_0x521c72[_0x5dbf('0x8f')]();_0x521c72[_0x5dbf('0x1b')](_0x1da1e3);_0x521c72[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')]('Limited\x20Query:',_0x521c72[_0x5dbf('0x84')]());return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x521c72[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')][_0x5dbf('0xa2')]['SELECT']});}})[_0x5dbf('0x22')](function(){return{'sql':_0xc588a2[_0x5dbf('0x84')]()};})[_0x5dbf('0x22')](respondWithResult(_0x144300,null))[_0x5dbf('0x54')](handleError(_0x144300,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 049c4cc..9ec6421 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 _0x2f93=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','util'];(function(_0x14ed2f,_0x439945){var _0x5e29f9=function(_0xa75004){while(--_0xa75004){_0x14ed2f['push'](_0x14ed2f['shift']());}};_0x5e29f9(++_0x439945);}(_0x2f93,0x6b));var _0x32f9=function(_0x4750f4,_0x59ed63){_0x4750f4=_0x4750f4-0x0;var _0x2c4477=_0x2f93[_0x4750f4];return _0x2c4477;};'use strict';var _=require('lodash');var util=require(_0x32f9('0x0'));var logger=require(_0x32f9('0x1'))(_0x32f9('0x2'));var moment=require(_0x32f9('0x3'));var BPromise=require(_0x32f9('0x4'));var rp=require(_0x32f9('0x5'));var fs=require('fs');var path=require(_0x32f9('0x6'));var rimraf=require('rimraf');var config=require(_0x32f9('0x7'));var attributes=require(_0x32f9('0x8'));module[_0x32f9('0x9')]=function(_0x219793,_0x231065){return _0x219793[_0x32f9('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x32f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9649=['./analyticDefaultReport.attributes','exports','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20c2fa,_0x3050fc){var _0x4fdb7b=function(_0x460600){while(--_0x460600){_0x20c2fa['push'](_0x20c2fa['shift']());}};_0x4fdb7b(++_0x3050fc);}(_0x9649,0x9b));var _0x9964=function(_0x46edbb,_0x870d48){_0x46edbb=_0x46edbb-0x0;var _0x25d843=_0x9649[_0x46edbb];return _0x25d843;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9964('0x0'))(_0x9964('0x1'));var moment=require('moment');var BPromise=require(_0x9964('0x2'));var rp=require(_0x9964('0x3'));var fs=require('fs');var path=require(_0x9964('0x4'));var rimraf=require(_0x9964('0x5'));var config=require(_0x9964('0x6'));var attributes=require(_0x9964('0x7'));module[_0x9964('0x8')]=function(_0x56a58b,_0x3f4269){return _0x56a58b['define']('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 5a2feb4..54c1a68 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 _0x9ec1=['AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x283939,_0x208164){var _0x140754=function(_0x1eaaeb){while(--_0x1eaaeb){_0x283939['push'](_0x283939['shift']());}};_0x140754(++_0x208164);}(_0x9ec1,0x17e));var _0x19ec=function(_0x3c07eb,_0x519c10){_0x3c07eb=_0x3c07eb-0x0;var _0x559e48=_0x9ec1[_0x3c07eb];return _0x559e48;};'use strict';var _=require(_0x19ec('0x0'));var util=require(_0x19ec('0x1'));var moment=require(_0x19ec('0x2'));var BPromise=require(_0x19ec('0x3'));var rs=require(_0x19ec('0x4'));var fs=require('fs');var Redis=require(_0x19ec('0x5'));var db=require(_0x19ec('0x6'))['db'];var utils=require(_0x19ec('0x7'));var logger=require(_0x19ec('0x8'))(_0x19ec('0x9'));var config=require('../../config/environment');var jayson=require(_0x19ec('0xa'));var client=jayson[_0x19ec('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x546bfb,_0x4cd9b7,_0xf525b3){return new BPromise(function(_0x2faaa4,_0x5b6a5f){return client[_0x19ec('0xc')](_0x546bfb,_0xf525b3)[_0x19ec('0xd')](function(_0x1668f7){logger['info'](_0x19ec('0xe'),_0x4cd9b7,'request\x20sent');logger[_0x19ec('0xf')](_0x19ec('0x10'),_0x4cd9b7,'request\x20sent',JSON['stringify'](_0x1668f7));if(_0x1668f7['error']){if(_0x1668f7[_0x19ec('0x11')][_0x19ec('0x12')]===0x1f4){logger[_0x19ec('0x11')](_0x19ec('0xe'),_0x4cd9b7,_0x1668f7[_0x19ec('0x11')][_0x19ec('0x13')]);return _0x5b6a5f(_0x1668f7[_0x19ec('0x11')][_0x19ec('0x13')]);}logger[_0x19ec('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4cd9b7,_0x1668f7[_0x19ec('0x11')][_0x19ec('0x13')]);return _0x2faaa4(_0x1668f7[_0x19ec('0x11')][_0x19ec('0x13')]);}else{logger[_0x19ec('0x14')](_0x19ec('0xe'),_0x4cd9b7,'request\x20sent');_0x2faaa4(_0x1668f7[_0x19ec('0x15')][_0x19ec('0x13')]);}})['catch'](function(_0x40dec3){logger[_0x19ec('0x11')](_0x19ec('0xe'),_0x4cd9b7,_0x40dec3);_0x5b6a5f(_0x40dec3);});});} \ No newline at end of file +var _0xa7b5=['jayson/promise','client','request','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','code','error','AnalyticDefaultReport,\x20%s,\x20%s','message','info','result','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x49c307,_0x47117d){var _0x59055b=function(_0x4d7d97){while(--_0x4d7d97){_0x49c307['push'](_0x49c307['shift']());}};_0x59055b(++_0x47117d);}(_0xa7b5,0x1d5));var _0x5a7b=function(_0x502fe0,_0x38d6b0){_0x502fe0=_0x502fe0-0x0;var _0x564ab1=_0xa7b5[_0x502fe0];return _0x564ab1;};'use strict';var _=require('lodash');var util=require(_0x5a7b('0x0'));var moment=require(_0x5a7b('0x1'));var BPromise=require(_0x5a7b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a7b('0x3'))['db'];var utils=require(_0x5a7b('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5a7b('0x5'));var jayson=require(_0x5a7b('0x6'));var client=jayson[_0x5a7b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b6146,_0xd46db5,_0xf5fd53){return new BPromise(function(_0x3658fc,_0x248c6f){return client[_0x5a7b('0x8')](_0x4b6146,_0xf5fd53)['then'](function(_0x4eccb3){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0xd46db5,_0x5a7b('0x9'));logger[_0x5a7b('0xa')](_0x5a7b('0xb'),_0xd46db5,'request\x20sent',JSON[_0x5a7b('0xc')](_0x4eccb3));if(_0x4eccb3['error']){if(_0x4eccb3['error'][_0x5a7b('0xd')]===0x1f4){logger[_0x5a7b('0xe')](_0x5a7b('0xf'),_0xd46db5,_0x4eccb3[_0x5a7b('0xe')][_0x5a7b('0x10')]);return _0x248c6f(_0x4eccb3[_0x5a7b('0xe')][_0x5a7b('0x10')]);}logger[_0x5a7b('0xe')](_0x5a7b('0xf'),_0xd46db5,_0x4eccb3['error']['message']);return _0x3658fc(_0x4eccb3[_0x5a7b('0xe')]['message']);}else{logger[_0x5a7b('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xd46db5,_0x5a7b('0x9'));_0x3658fc(_0x4eccb3[_0x5a7b('0x12')][_0x5a7b('0x10')]);}})['catch'](function(_0x41661c){logger[_0x5a7b('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xd46db5,_0x41661c);_0x248c6f(_0x41661c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 5f93439..c248411 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 _0x788e=['/:id/run','query','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','index','isAuthenticated','show','get','preview'];(function(_0x32c6cd,_0x34031f){var _0x5304f1=function(_0x504c66){while(--_0x504c66){_0x32c6cd['push'](_0x32c6cd['shift']());}};_0x5304f1(++_0x34031f);}(_0x788e,0x12e));var _0xe788=function(_0x4163e2,_0x31d338){_0x4163e2=_0x4163e2-0x0;var _0x11d140=_0x788e[_0x4163e2];return _0x11d140;};'use strict';var multer=require('multer');var util=require(_0xe788('0x0'));var path=require(_0xe788('0x1'));var timeout=require(_0xe788('0x2'));var express=require(_0xe788('0x3'));var router=express[_0xe788('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe788('0x5'));var interaction=require(_0xe788('0x6'));var config=require('../../config/environment');var controller=require(_0xe788('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe788('0x8')]);router['get']('/:id',auth[_0xe788('0x9')](),controller[_0xe788('0xa')]);router[_0xe788('0xb')]('/:id/preview',auth['isAuthenticated'](),controller[_0xe788('0xc')]);router['get'](_0xe788('0xd'),auth[_0xe788('0x9')](),controller['run']);router[_0xe788('0xb')]('/:id/query',auth[_0xe788('0x9')](),controller[_0xe788('0xe')]);router['post']('/',auth[_0xe788('0x9')](),controller[_0xe788('0xf')]);router[_0xe788('0x10')](_0xe788('0x11'),auth[_0xe788('0x9')](),controller[_0xe788('0x12')]);router[_0xe788('0x13')](_0xe788('0x11'),auth[_0xe788('0x9')](),controller['destroy']);module[_0xe788('0x14')]=router; \ No newline at end of file +var _0x73f3=['put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','/:id','/:id/preview','preview','/:id/run','isAuthenticated','run','query','post'];(function(_0x30a879,_0x23e326){var _0x4d107e=function(_0x41eb9f){while(--_0x41eb9f){_0x30a879['push'](_0x30a879['shift']());}};_0x4d107e(++_0x23e326);}(_0x73f3,0xca));var _0x373f=function(_0x2e4620,_0x48b66a){_0x2e4620=_0x2e4620-0x0;var _0x45a5cf=_0x73f3[_0x2e4620];return _0x45a5cf;};'use strict';var multer=require(_0x373f('0x0'));var util=require(_0x373f('0x1'));var path=require('path');var timeout=require(_0x373f('0x2'));var express=require(_0x373f('0x3'));var router=express[_0x373f('0x4')]();var fs_extra=require(_0x373f('0x5'));var auth=require(_0x373f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x373f('0x7'));var controller=require(_0x373f('0x8'));router[_0x373f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x373f('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x373f('0x9')](_0x373f('0xb'),auth['isAuthenticated'](),controller[_0x373f('0xc')]);router[_0x373f('0x9')](_0x373f('0xd'),auth[_0x373f('0xe')](),controller[_0x373f('0xf')]);router['get']('/:id/query',auth[_0x373f('0xe')](),controller[_0x373f('0x10')]);router[_0x373f('0x11')]('/',auth[_0x373f('0xe')](),controller['create']);router[_0x373f('0x12')](_0x373f('0xa'),auth[_0x373f('0xe')](),controller[_0x373f('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x373f('0x14')]);module[_0x373f('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index e112550..e7d158b 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 _0x7de9=['moment','exports','ENUM','csv','pdf','xlsx','STRING','DATE','Loading','manual','scheduled','INTEGER'];(function(_0x538ab3,_0x462a78){var _0x1c0346=function(_0x87c14f){while(--_0x87c14f){_0x538ab3['push'](_0x538ab3['shift']());}};_0x1c0346(++_0x462a78);}(_0x7de9,0x1c8));var _0x97de=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x7de9[_0x11ce46];return _0x368a1e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x97de('0x0'));module[_0x97de('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x97de('0x2')](_0x97de('0x3'),_0x97de('0x4'),_0x97de('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x97de('0x6')],'allowNull':![]},'startDate':{'type':Sequelize[_0x97de('0x7')]},'endDate':{'type':Sequelize[_0x97de('0x7')]},'status':{'type':Sequelize[_0x97de('0x6')],'defaultValue':_0x97de('0x8')},'type':{'type':Sequelize[_0x97de('0x2')](_0x97de('0x9'),_0x97de('0xa')),'allowNull':![],'defaultValue':_0x97de('0x9')},'reportId':{'type':Sequelize[_0x97de('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x97de('0x6')]}}; \ No newline at end of file +var _0xdc85=['scheduled','UNSIGNED','moment','exports','STRING','ENUM','xlsx','csv','DATE','manual'];(function(_0x59916b,_0x406462){var _0x5a5123=function(_0xee12ff){while(--_0xee12ff){_0x59916b['push'](_0x59916b['shift']());}};_0x5a5123(++_0x406462);}(_0xdc85,0x1b0));var _0x5dc8=function(_0x377500,_0x40db90){_0x377500=_0x377500-0x0;var _0x44c84e=_0xdc85[_0x377500];return _0x44c84e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5dc8('0x0'));module[_0x5dc8('0x1')]={'name':{'type':Sequelize[_0x5dc8('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x5dc8('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x5dc8('0x3')]('csv','pdf',_0x5dc8('0x4')),'allowNull':![],'defaultValue':_0x5dc8('0x5')},'savename':{'type':Sequelize[_0x5dc8('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x5dc8('0x6')]},'endDate':{'type':Sequelize[_0x5dc8('0x6')]},'status':{'type':Sequelize[_0x5dc8('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x5dc8('0x3')](_0x5dc8('0x7'),_0x5dc8('0x8')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x5dc8('0x9')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 65a413b..a99b627 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 _0x7fce=['find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','download','basename','savename','output','root','server/files/reports','Sequelize','ValidationError','join','format','rimraf','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','end','json','undefined','count','offset','limit','set','apply','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','name','index','map','AnalyticExtractedReport','type','key','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes'];(function(_0x3d29aa,_0x2569d1){var _0x1e232b=function(_0x486ee4){while(--_0x486ee4){_0x3d29aa['push'](_0x3d29aa['shift']());}};_0x1e232b(++_0x2569d1);}(_0x7fce,0xb6));var _0xe7fc=function(_0x41bcac,_0x20863b){_0x41bcac=_0x41bcac-0x0;var _0x547d3a=_0x7fce[_0x41bcac];return _0x547d3a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe7fc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe7fc('0x1'));var Mustache=require(_0xe7fc('0x2'));var util=require(_0xe7fc('0x3'));var path=require('path');var sox=require(_0xe7fc('0x4'));var csv=require(_0xe7fc('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe7fc('0x6'));var _=require(_0xe7fc('0x7'));var squel=require(_0xe7fc('0x8'));var crypto=require(_0xe7fc('0x9'));var jsforce=require(_0xe7fc('0xa'));var deskjs=require(_0xe7fc('0xb'));var toCsv=require(_0xe7fc('0x5'));var querystring=require('querystring');var Papa=require(_0xe7fc('0xc'));var Redis=require(_0xe7fc('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe7fc('0xe'));var hardwareService=require(_0xe7fc('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xe7fc('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xe7fc('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1473b7,_0x56c99a){_0x56c99a=_0x56c99a||0xcc;return function(_0xdf7d1a){if(_0xdf7d1a){return _0x1473b7[_0xe7fc('0x12')](_0x56c99a);}return _0x1473b7['status'](_0x56c99a)[_0xe7fc('0x13')]();};}function respondWithResult(_0x3e3955,_0x319155){_0x319155=_0x319155||0xc8;return function(_0x464512){if(_0x464512){return _0x3e3955['status'](_0x319155)[_0xe7fc('0x14')](_0x464512);}};}function respondWithFilteredResult(_0xdb2eb,_0x5b9ae2){return function(_0x1349dc){if(_0x1349dc){var _0x2111b4=typeof _0x5b9ae2['offset']===_0xe7fc('0x15')&&typeof _0x5b9ae2['limit']===_0xe7fc('0x15');var _0x3f6bd1=_0x1349dc[_0xe7fc('0x16')];var _0x2e643a=_0x2111b4?0x0:_0x5b9ae2[_0xe7fc('0x17')];var _0x2f8f65=_0x2111b4?_0x1349dc['count']:_0x5b9ae2[_0xe7fc('0x17')]+_0x5b9ae2[_0xe7fc('0x18')];var _0x3ea343;if(_0x2f8f65>=_0x3f6bd1){_0x2f8f65=_0x3f6bd1;_0x3ea343=0xc8;}else{_0x3ea343=0xce;}_0xdb2eb['status'](_0x3ea343);return _0xdb2eb[_0xe7fc('0x19')]('Content-Range',_0x2e643a+'-'+_0x2f8f65+'/'+_0x3f6bd1)[_0xe7fc('0x14')](_0x1349dc);}return null;};}function patchUpdates(_0x219f23){return function(_0x45802a){try{jsonpatch[_0xe7fc('0x1a')](_0x45802a,_0x219f23,!![]);}catch(_0x1b6e95){return BPromise['reject'](_0x1b6e95);}return _0x45802a[_0xe7fc('0x1b')]();};}function saveUpdates(_0x5e186e,_0x117d74){return function(_0x997b1c){if(_0x997b1c){return _0x997b1c[_0xe7fc('0x1c')](_0x5e186e)[_0xe7fc('0x1d')](function(_0x2a12d1){return _0x2a12d1;});}return null;};}function removeEntity(_0x452951,_0x39c3db){return function(_0x3b0a2e){if(_0x3b0a2e){return _0x3b0a2e[_0xe7fc('0x1e')]()[_0xe7fc('0x1d')](function(){var _0xf43d96=_0x3b0a2e[_0xe7fc('0x1f')]({'plain':!![]});var _0x58356d=_0xe7fc('0x20');return db[_0xe7fc('0x21')][_0xe7fc('0x1e')]({'where':{'type':_0x58356d,'resourceId':_0xf43d96['id']}})[_0xe7fc('0x1d')](function(){return _0x3b0a2e;});})[_0xe7fc('0x1d')](function(){_0x452951['status'](0xcc)[_0xe7fc('0x13')]();});}};}function handleEntityNotFound(_0x3c0014,_0x5a226f){return function(_0x45117b){if(!_0x45117b){_0x3c0014[_0xe7fc('0x12')](0x194);}return _0x45117b;};}function handleError(_0x1b57ae,_0x4f296d){_0x4f296d=_0x4f296d||0x1f4;return function(_0x964b45){logger[_0xe7fc('0x22')](_0x964b45['stack']);if(_0x964b45[_0xe7fc('0x23')]){delete _0x964b45[_0xe7fc('0x23')];}_0x1b57ae['status'](_0x4f296d)['send'](_0x964b45);};}exports[_0xe7fc('0x24')]=function(_0x160709,_0x14569b){var _0x1b037c={},_0x4193b7={},_0x5c2512={'count':0x0,'rows':[]};var _0x46b891=_[_0xe7fc('0x25')](db[_0xe7fc('0x26')]['rawAttributes'],function(_0xe88100){return{'name':_0xe88100['fieldName'],'type':_0xe88100[_0xe7fc('0x27')][_0xe7fc('0x28')]};});_0x4193b7['model']=_[_0xe7fc('0x25')](_0x46b891,_0xe7fc('0x23'));_0x4193b7['query']=_['keys'](_0x160709['query']);_0x4193b7[_0xe7fc('0x29')]=_[_0xe7fc('0x2a')](_0x4193b7['model'],_0x4193b7[_0xe7fc('0x2b')]);_0x1b037c[_0xe7fc('0x2c')]=_[_0xe7fc('0x2a')](_0x4193b7[_0xe7fc('0x2d')],qs[_0xe7fc('0x2e')](_0x160709['query'][_0xe7fc('0x2e')]));_0x1b037c[_0xe7fc('0x2c')]=_0x1b037c['attributes'][_0xe7fc('0x2f')]?_0x1b037c[_0xe7fc('0x2c')]:_0x4193b7[_0xe7fc('0x2d')];if(!_0x160709[_0xe7fc('0x2b')][_0xe7fc('0x30')](_0xe7fc('0x31'))){_0x1b037c['limit']=qs[_0xe7fc('0x18')](_0x160709[_0xe7fc('0x2b')][_0xe7fc('0x18')]);_0x1b037c[_0xe7fc('0x17')]=qs[_0xe7fc('0x17')](_0x160709[_0xe7fc('0x2b')][_0xe7fc('0x17')]);}_0x1b037c['order']=qs[_0xe7fc('0x32')](_0x160709['query'][_0xe7fc('0x32')]);_0x1b037c[_0xe7fc('0x33')]=qs[_0xe7fc('0x29')](_[_0xe7fc('0x34')](_0x160709[_0xe7fc('0x2b')],_0x4193b7[_0xe7fc('0x29')]),_0x46b891);if(_0x160709[_0xe7fc('0x2b')][_0xe7fc('0x35')]){_0x1b037c['where']=_[_0xe7fc('0x36')](_0x1b037c['where'],{'$or':_['map'](_0x46b891,function(_0x1afc7d){if(_0x1afc7d[_0xe7fc('0x27')]!=='VIRTUAL'){var _0x44d3e1={};_0x44d3e1[_0x1afc7d[_0xe7fc('0x23')]]={'$like':'%'+_0x160709[_0xe7fc('0x2b')][_0xe7fc('0x35')]+'%'};return _0x44d3e1;}})});}_0x1b037c=_['merge']({},_0x1b037c,_0x160709['options']);var _0x4404ef={'where':_0x1b037c['where']};return db[_0xe7fc('0x26')][_0xe7fc('0x16')](_0x4404ef)['then'](function(_0x2c744c){_0x5c2512[_0xe7fc('0x16')]=_0x2c744c;if(_0x160709[_0xe7fc('0x2b')][_0xe7fc('0x37')]){_0x1b037c[_0xe7fc('0x38')]=[{'all':!![]}];}return db[_0xe7fc('0x26')][_0xe7fc('0x39')](_0x1b037c);})[_0xe7fc('0x1d')](function(_0x54b733){_0x5c2512[_0xe7fc('0x3a')]=_0x54b733;return _0x5c2512;})[_0xe7fc('0x1d')](respondWithFilteredResult(_0x14569b,_0x1b037c))[_0xe7fc('0x3b')](handleError(_0x14569b,null));};exports[_0xe7fc('0x3c')]=function(_0x583222,_0x266fa5){var _0x5015f6={'raw':!![],'where':{'id':_0x583222[_0xe7fc('0x3d')]['id']}},_0x287753={};_0x287753[_0xe7fc('0x2d')]=_[_0xe7fc('0x3e')](db['AnalyticExtractedReport'][_0xe7fc('0x3f')]);_0x287753['query']=_[_0xe7fc('0x3e')](_0x583222[_0xe7fc('0x2b')]);_0x287753['filters']=_[_0xe7fc('0x2a')](_0x287753[_0xe7fc('0x2d')],_0x287753['query']);_0x5015f6[_0xe7fc('0x2c')]=_[_0xe7fc('0x2a')](_0x287753['model'],qs[_0xe7fc('0x2e')](_0x583222[_0xe7fc('0x2b')]['fields']));_0x5015f6['attributes']=_0x5015f6['attributes']['length']?_0x5015f6['attributes']:_0x287753[_0xe7fc('0x2d')];if(_0x583222[_0xe7fc('0x2b')][_0xe7fc('0x37')]){_0x5015f6['include']=[{'all':!![]}];}_0x5015f6=_[_0xe7fc('0x36')]({},_0x5015f6,_0x583222['options']);return db[_0xe7fc('0x26')][_0xe7fc('0x40')](_0x5015f6)[_0xe7fc('0x1d')](handleEntityNotFound(_0x266fa5,null))[_0xe7fc('0x1d')](respondWithResult(_0x266fa5,null))['catch'](handleError(_0x266fa5,null));};exports[_0xe7fc('0x41')]=function(_0x1fb355,_0x2edf83){return db[_0xe7fc('0x26')][_0xe7fc('0x41')](_0x1fb355[_0xe7fc('0x42')],{})[_0xe7fc('0x1d')](function(_0x2d9833){var _0x28a2a1=_0x1fb355[_0xe7fc('0x43')][_0xe7fc('0x1f')]({'plain':!![]});if(!_0x28a2a1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28a2a1[_0xe7fc('0x44')]==='user'){var _0x1aa5bb=_0x2d9833[_0xe7fc('0x1f')]({'plain':!![]});var _0x5d97cf=_0xe7fc('0x20');return db[_0xe7fc('0x45')]['find']({'where':{'name':_0x5d97cf,'userProfileId':_0x28a2a1[_0xe7fc('0x46')]},'raw':!![]})['then'](function(_0x51a91c){if(_0x51a91c&&_0x51a91c[_0xe7fc('0x47')]===0x0){return db[_0xe7fc('0x21')][_0xe7fc('0x41')]({'name':_0x1aa5bb[_0xe7fc('0x23')],'resourceId':_0x1aa5bb['id'],'type':_0x51a91c[_0xe7fc('0x23')],'sectionId':_0x51a91c['id']},{})[_0xe7fc('0x1d')](function(){return _0x2d9833;});}else{return _0x2d9833;}})[_0xe7fc('0x3b')](function(_0xedc81){logger[_0xe7fc('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xedc81);throw _0xedc81;});}return _0x2d9833;})[_0xe7fc('0x1d')](respondWithResult(_0x2edf83,0xc9))[_0xe7fc('0x3b')](handleError(_0x2edf83,null));};exports[_0xe7fc('0x1c')]=function(_0x55da85,_0x466b6b){if(_0x55da85['body']['id']){delete _0x55da85[_0xe7fc('0x42')]['id'];}return db[_0xe7fc('0x26')][_0xe7fc('0x40')]({'where':{'id':_0x55da85['params']['id']}})[_0xe7fc('0x1d')](handleEntityNotFound(_0x466b6b,null))['then'](saveUpdates(_0x55da85['body'],null))['then'](respondWithResult(_0x466b6b,null))['catch'](handleError(_0x466b6b,null));};exports[_0xe7fc('0x1e')]=function(_0x3739fb,_0x2faeaa){return db[_0xe7fc('0x26')]['find']({'where':{'id':_0x3739fb[_0xe7fc('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2faeaa,null))[_0xe7fc('0x1d')](removeEntity(_0x2faeaa,null))[_0xe7fc('0x3b')](handleError(_0x2faeaa,null));};exports[_0xe7fc('0x48')]=function(_0x38b4d0,_0x5f4a6c,_0x150877){return db[_0xe7fc('0x26')][_0xe7fc('0x40')]({'where':{'id':_0x38b4d0['params']['id']},'attributes':['name',_0xe7fc('0x49'),_0xe7fc('0x4a'),_0xe7fc('0x4b')],'raw':!![]})[_0xe7fc('0x1d')](handleEntityNotFound(_0x5f4a6c,null))['then'](function(_0x180cf0){if(_0x180cf0){if(!fs['existsSync'](path['join'](config[_0xe7fc('0x4c')],_0xe7fc('0x4d'),_0x180cf0[_0xe7fc('0x4a')]))){throw new db[(_0xe7fc('0x4e'))][(_0xe7fc('0x4f'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x38b4d0['query']['exists']){return _0x5f4a6c[_0xe7fc('0x12')](0xc8);}return _0x5f4a6c[_0xe7fc('0x48')](path[_0xe7fc('0x50')](config[_0xe7fc('0x4c')],_0xe7fc('0x4d'),_0x180cf0[_0xe7fc('0x4a')]),util[_0xe7fc('0x51')]('%s.%s',_0x180cf0['basename']||_0x180cf0[_0xe7fc('0x23')],_0x180cf0['output']['toLowerCase']()));}})['catch'](handleError(_0x5f4a6c,null));}; \ No newline at end of file +var _0x8ca6=['includeAll','include','rows','catch','params','rawAttributes','options','find','create','body','user','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','join','root','server/files/reports','savename','Sequelize','ValidationError','exists','format','%s.%s','output','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','map','AnalyticExtractedReport','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x161118,_0x109f02){var _0x13cbae=function(_0x2e9c1e){while(--_0x2e9c1e){_0x161118['push'](_0x161118['shift']());}};_0x13cbae(++_0x109f02);}(_0x8ca6,0x1dd));var _0x68ca=function(_0x4a7c53,_0x49aeae){_0x4a7c53=_0x4a7c53-0x0;var _0x4a4ea5=_0x8ca6[_0x4a7c53];return _0x4a4ea5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x68ca('0x0'));var zipdir=require(_0x68ca('0x1'));var jsonpatch=require(_0x68ca('0x2'));var rp=require(_0x68ca('0x3'));var moment=require(_0x68ca('0x4'));var BPromise=require(_0x68ca('0x5'));var Mustache=require('mustache');var util=require(_0x68ca('0x6'));var path=require('path');var sox=require(_0x68ca('0x7'));var csv=require(_0x68ca('0x8'));var ejs=require(_0x68ca('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x68ca('0xa'));var jsforce=require(_0x68ca('0xb'));var deskjs=require(_0x68ca('0xc'));var toCsv=require(_0x68ca('0x8'));var querystring=require(_0x68ca('0xd'));var Papa=require(_0x68ca('0xe'));var Redis=require(_0x68ca('0xf'));var authService=require(_0x68ca('0x10'));var qs=require(_0x68ca('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68ca('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x68ca('0x13'));var config=require(_0x68ca('0x14'));var licenseUtil=require(_0x68ca('0x15'));var db=require(_0x68ca('0x16'))['db'];function respondWithStatusCode(_0x3a327a,_0x5d6aab){_0x5d6aab=_0x5d6aab||0xcc;return function(_0x606554){if(_0x606554){return _0x3a327a[_0x68ca('0x17')](_0x5d6aab);}return _0x3a327a[_0x68ca('0x18')](_0x5d6aab)['end']();};}function respondWithResult(_0x1803f2,_0x56fbc9){_0x56fbc9=_0x56fbc9||0xc8;return function(_0xc5892a){if(_0xc5892a){return _0x1803f2[_0x68ca('0x18')](_0x56fbc9)[_0x68ca('0x19')](_0xc5892a);}};}function respondWithFilteredResult(_0x4b19e7,_0x175403){return function(_0xeba741){if(_0xeba741){var _0x4b7eb8=typeof _0x175403['offset']===_0x68ca('0x1a')&&typeof _0x175403[_0x68ca('0x1b')]===_0x68ca('0x1a');var _0x391fba=_0xeba741[_0x68ca('0x1c')];var _0x4a511f=_0x4b7eb8?0x0:_0x175403[_0x68ca('0x1d')];var _0x5dfe4e=_0x4b7eb8?_0xeba741['count']:_0x175403['offset']+_0x175403[_0x68ca('0x1b')];var _0x190a27;if(_0x5dfe4e>=_0x391fba){_0x5dfe4e=_0x391fba;_0x190a27=0xc8;}else{_0x190a27=0xce;}_0x4b19e7['status'](_0x190a27);return _0x4b19e7[_0x68ca('0x1e')](_0x68ca('0x1f'),_0x4a511f+'-'+_0x5dfe4e+'/'+_0x391fba)['json'](_0xeba741);}return null;};}function patchUpdates(_0x5b3bd2){return function(_0x1cc00e){try{jsonpatch['apply'](_0x1cc00e,_0x5b3bd2,!![]);}catch(_0x23e613){return BPromise[_0x68ca('0x20')](_0x23e613);}return _0x1cc00e[_0x68ca('0x21')]();};}function saveUpdates(_0x527957,_0x49f207){return function(_0x43eaf8){if(_0x43eaf8){return _0x43eaf8[_0x68ca('0x22')](_0x527957)[_0x68ca('0x23')](function(_0x59ebf1){return _0x59ebf1;});}return null;};}function removeEntity(_0x1765e1,_0x1c66bb){return function(_0x5b6909){if(_0x5b6909){return _0x5b6909[_0x68ca('0x24')]()['then'](function(){var _0x24ede5=_0x5b6909[_0x68ca('0x25')]({'plain':!![]});var _0x54f709='ExtractedReports';return db[_0x68ca('0x26')][_0x68ca('0x24')]({'where':{'type':_0x54f709,'resourceId':_0x24ede5['id']}})[_0x68ca('0x23')](function(){return _0x5b6909;});})[_0x68ca('0x23')](function(){_0x1765e1[_0x68ca('0x18')](0xcc)[_0x68ca('0x27')]();});}};}function handleEntityNotFound(_0x23ec7a,_0x26b4ce){return function(_0x4be1d7){if(!_0x4be1d7){_0x23ec7a['sendStatus'](0x194);}return _0x4be1d7;};}function handleError(_0x5e0a9b,_0x95e2a4){_0x95e2a4=_0x95e2a4||0x1f4;return function(_0x3be314){logger[_0x68ca('0x28')](_0x3be314['stack']);if(_0x3be314[_0x68ca('0x29')]){delete _0x3be314[_0x68ca('0x29')];}_0x5e0a9b[_0x68ca('0x18')](_0x95e2a4)['send'](_0x3be314);};}exports['index']=function(_0x531305,_0x4c8bb1){var _0x26ceba={},_0x4841e7={},_0x3a5825={'count':0x0,'rows':[]};var _0x524e26=_[_0x68ca('0x2a')](db[_0x68ca('0x2b')]['rawAttributes'],function(_0x103baf){return{'name':_0x103baf[_0x68ca('0x2c')],'type':_0x103baf[_0x68ca('0x2d')][_0x68ca('0x2e')]};});_0x4841e7[_0x68ca('0x2f')]=_[_0x68ca('0x2a')](_0x524e26,'name');_0x4841e7['query']=_[_0x68ca('0x30')](_0x531305[_0x68ca('0x31')]);_0x4841e7[_0x68ca('0x32')]=_[_0x68ca('0x33')](_0x4841e7[_0x68ca('0x2f')],_0x4841e7[_0x68ca('0x31')]);_0x26ceba['attributes']=_[_0x68ca('0x33')](_0x4841e7[_0x68ca('0x2f')],qs['fields'](_0x531305[_0x68ca('0x31')][_0x68ca('0x34')]));_0x26ceba[_0x68ca('0x35')]=_0x26ceba[_0x68ca('0x35')][_0x68ca('0x36')]?_0x26ceba[_0x68ca('0x35')]:_0x4841e7['model'];if(!_0x531305[_0x68ca('0x31')][_0x68ca('0x37')](_0x68ca('0x38'))){_0x26ceba[_0x68ca('0x1b')]=qs['limit'](_0x531305['query'][_0x68ca('0x1b')]);_0x26ceba[_0x68ca('0x1d')]=qs[_0x68ca('0x1d')](_0x531305['query']['offset']);}_0x26ceba[_0x68ca('0x39')]=qs[_0x68ca('0x3a')](_0x531305[_0x68ca('0x31')][_0x68ca('0x3a')]);_0x26ceba[_0x68ca('0x3b')]=qs[_0x68ca('0x32')](_[_0x68ca('0x3c')](_0x531305['query'],_0x4841e7[_0x68ca('0x32')]),_0x524e26);if(_0x531305[_0x68ca('0x31')]['filter']){_0x26ceba[_0x68ca('0x3b')]=_[_0x68ca('0x3d')](_0x26ceba[_0x68ca('0x3b')],{'$or':_['map'](_0x524e26,function(_0x2fd47c){if(_0x2fd47c[_0x68ca('0x2d')]!==_0x68ca('0x3e')){var _0x376329={};_0x376329[_0x2fd47c[_0x68ca('0x29')]]={'$like':'%'+_0x531305[_0x68ca('0x31')]['filter']+'%'};return _0x376329;}})});}_0x26ceba=_[_0x68ca('0x3d')]({},_0x26ceba,_0x531305['options']);var _0x168b36={'where':_0x26ceba[_0x68ca('0x3b')]};return db[_0x68ca('0x2b')]['count'](_0x168b36)['then'](function(_0x5b7082){_0x3a5825['count']=_0x5b7082;if(_0x531305['query'][_0x68ca('0x3f')]){_0x26ceba[_0x68ca('0x40')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x26ceba);})[_0x68ca('0x23')](function(_0x26a036){_0x3a5825[_0x68ca('0x41')]=_0x26a036;return _0x3a5825;})[_0x68ca('0x23')](respondWithFilteredResult(_0x4c8bb1,_0x26ceba))[_0x68ca('0x42')](handleError(_0x4c8bb1,null));};exports['show']=function(_0x292f56,_0x464f5c){var _0x18f571={'raw':!![],'where':{'id':_0x292f56[_0x68ca('0x43')]['id']}},_0x2c9007={};_0x2c9007[_0x68ca('0x2f')]=_[_0x68ca('0x30')](db[_0x68ca('0x2b')][_0x68ca('0x44')]);_0x2c9007[_0x68ca('0x31')]=_[_0x68ca('0x30')](_0x292f56[_0x68ca('0x31')]);_0x2c9007[_0x68ca('0x32')]=_[_0x68ca('0x33')](_0x2c9007[_0x68ca('0x2f')],_0x2c9007[_0x68ca('0x31')]);_0x18f571['attributes']=_[_0x68ca('0x33')](_0x2c9007['model'],qs[_0x68ca('0x34')](_0x292f56[_0x68ca('0x31')][_0x68ca('0x34')]));_0x18f571[_0x68ca('0x35')]=_0x18f571[_0x68ca('0x35')][_0x68ca('0x36')]?_0x18f571[_0x68ca('0x35')]:_0x2c9007[_0x68ca('0x2f')];if(_0x292f56[_0x68ca('0x31')][_0x68ca('0x3f')]){_0x18f571[_0x68ca('0x40')]=[{'all':!![]}];}_0x18f571=_['merge']({},_0x18f571,_0x292f56[_0x68ca('0x45')]);return db[_0x68ca('0x2b')][_0x68ca('0x46')](_0x18f571)[_0x68ca('0x23')](handleEntityNotFound(_0x464f5c,null))[_0x68ca('0x23')](respondWithResult(_0x464f5c,null))[_0x68ca('0x42')](handleError(_0x464f5c,null));};exports[_0x68ca('0x47')]=function(_0x19fe48,_0x5691cf){return db[_0x68ca('0x2b')][_0x68ca('0x47')](_0x19fe48[_0x68ca('0x48')],{})['then'](function(_0x341778){var _0x60ddea=_0x19fe48[_0x68ca('0x49')][_0x68ca('0x25')]({'plain':!![]});if(!_0x60ddea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x60ddea['role']==='user'){var _0x51811a=_0x341778[_0x68ca('0x25')]({'plain':!![]});var _0xc07f8c=_0x68ca('0x4a');return db[_0x68ca('0x4b')][_0x68ca('0x46')]({'where':{'name':_0xc07f8c,'userProfileId':_0x60ddea[_0x68ca('0x4c')]},'raw':!![]})[_0x68ca('0x23')](function(_0xdfe60a){if(_0xdfe60a&&_0xdfe60a[_0x68ca('0x4d')]===0x0){return db[_0x68ca('0x26')][_0x68ca('0x47')]({'name':_0x51811a['name'],'resourceId':_0x51811a['id'],'type':_0xdfe60a[_0x68ca('0x29')],'sectionId':_0xdfe60a['id']},{})['then'](function(){return _0x341778;});}else{return _0x341778;}})[_0x68ca('0x42')](function(_0x449422){logger[_0x68ca('0x28')](_0x68ca('0x4e'),_0x449422);throw _0x449422;});}return _0x341778;})['then'](respondWithResult(_0x5691cf,0xc9))[_0x68ca('0x42')](handleError(_0x5691cf,null));};exports[_0x68ca('0x22')]=function(_0x61f0d2,_0x4f6efa){if(_0x61f0d2['body']['id']){delete _0x61f0d2[_0x68ca('0x48')]['id'];}return db[_0x68ca('0x2b')][_0x68ca('0x46')]({'where':{'id':_0x61f0d2[_0x68ca('0x43')]['id']}})[_0x68ca('0x23')](handleEntityNotFound(_0x4f6efa,null))[_0x68ca('0x23')](saveUpdates(_0x61f0d2[_0x68ca('0x48')],null))['then'](respondWithResult(_0x4f6efa,null))[_0x68ca('0x42')](handleError(_0x4f6efa,null));};exports[_0x68ca('0x24')]=function(_0x1baebc,_0xf1a725){return db[_0x68ca('0x2b')][_0x68ca('0x46')]({'where':{'id':_0x1baebc[_0x68ca('0x43')]['id']}})[_0x68ca('0x23')](handleEntityNotFound(_0xf1a725,null))[_0x68ca('0x23')](removeEntity(_0xf1a725,null))[_0x68ca('0x42')](handleError(_0xf1a725,null));};exports['download']=function(_0x2a5a12,_0x13f3db,_0x2abe6f){return db['AnalyticExtractedReport'][_0x68ca('0x46')]({'where':{'id':_0x2a5a12[_0x68ca('0x43')]['id']},'attributes':[_0x68ca('0x29'),_0x68ca('0x4f'),'savename','output'],'raw':!![]})[_0x68ca('0x23')](handleEntityNotFound(_0x13f3db,null))['then'](function(_0x1d9273){if(_0x1d9273){if(!fs['existsSync'](path[_0x68ca('0x50')](config[_0x68ca('0x51')],_0x68ca('0x52'),_0x1d9273[_0x68ca('0x53')]))){throw new db[(_0x68ca('0x54'))][(_0x68ca('0x55'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x2a5a12[_0x68ca('0x31')][_0x68ca('0x56')]){return _0x13f3db[_0x68ca('0x17')](0xc8);}return _0x13f3db['download'](path[_0x68ca('0x50')](config[_0x68ca('0x51')],'server/files/reports',_0x1d9273[_0x68ca('0x53')]),util[_0x68ca('0x57')](_0x68ca('0x58'),_0x1d9273[_0x68ca('0x4f')]||_0x1d9273[_0x68ca('0x29')],_0x1d9273[_0x68ca('0x59')]['toLowerCase']()));}})[_0x68ca('0x42')](handleError(_0x13f3db,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index b0797dd..9c396e3 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 _0x4f9a=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x4f9a,0x9f));var _0xa4f9=function(_0xe21d1,_0x44abc2){_0xe21d1=_0xe21d1-0x0;var _0x295ce2=_0x4f9a[_0xe21d1];return _0x295ce2;};'use strict';var _=require(_0xa4f9('0x0'));var util=require(_0xa4f9('0x1'));var logger=require(_0xa4f9('0x2'))(_0xa4f9('0x3'));var moment=require(_0xa4f9('0x4'));var BPromise=require('bluebird');var rp=require(_0xa4f9('0x5'));var fs=require('fs');var path=require(_0xa4f9('0x6'));var rimraf=require('rimraf');var config=require(_0xa4f9('0x7'));var attributes=require(_0xa4f9('0x8'));module[_0xa4f9('0x9')]=function(_0x230f9b,_0x32622f){return _0x230f9b[_0xa4f9('0xa')](_0xa4f9('0xb'),attributes,{'tableName':_0xa4f9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x260d=['../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x35bfa2,_0x1aeeab){var _0x3fcd0a=function(_0x5183e4){while(--_0x5183e4){_0x35bfa2['push'](_0x35bfa2['shift']());}};_0x3fcd0a(++_0x1aeeab);}(_0x260d,0xd8));var _0xd260=function(_0x4e1247,_0x2c1718){_0x4e1247=_0x4e1247-0x0;var _0x305b19=_0x260d[_0x4e1247];return _0x305b19;};'use strict';var _=require(_0xd260('0x0'));var util=require(_0xd260('0x1'));var logger=require(_0xd260('0x2'))(_0xd260('0x3'));var moment=require(_0xd260('0x4'));var BPromise=require(_0xd260('0x5'));var rp=require(_0xd260('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd260('0x7'));var config=require(_0xd260('0x8'));var attributes=require(_0xd260('0x9'));module[_0xd260('0xa')]=function(_0x2ce934,_0x47fa2b){return _0x2ce934[_0xd260('0xb')](_0xd260('0xc'),attributes,{'tableName':_0xd260('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 2b09638..c303dfe 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 _0xdc91=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x6805e5,_0x23fd57){var _0x1035a0=function(_0x18662d){while(--_0x18662d){_0x6805e5['push'](_0x6805e5['shift']());}};_0x1035a0(++_0x23fd57);}(_0xdc91,0x10c));var _0x1dc9=function(_0x246324,_0x32beb7){_0x246324=_0x246324-0x0;var _0x443d03=_0xdc91[_0x246324];return _0x443d03;};'use strict';var _=require(_0x1dc9('0x0'));var util=require(_0x1dc9('0x1'));var moment=require(_0x1dc9('0x2'));var BPromise=require(_0x1dc9('0x3'));var rs=require(_0x1dc9('0x4'));var fs=require('fs');var Redis=require(_0x1dc9('0x5'));var db=require(_0x1dc9('0x6'))['db'];var utils=require(_0x1dc9('0x7'));var logger=require(_0x1dc9('0x8'))(_0x1dc9('0x9'));var config=require(_0x1dc9('0xa'));var jayson=require(_0x1dc9('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x358946,_0x3323f,_0x598916){return new BPromise(function(_0x549f73,_0xf6e540){return client[_0x1dc9('0xc')](_0x358946,_0x598916)[_0x1dc9('0xd')](function(_0x3c074b){logger[_0x1dc9('0xe')](_0x1dc9('0xf'),_0x3323f,_0x1dc9('0x10'));logger[_0x1dc9('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x3323f,_0x1dc9('0x10'),JSON[_0x1dc9('0x12')](_0x3c074b));if(_0x3c074b[_0x1dc9('0x13')]){if(_0x3c074b['error'][_0x1dc9('0x14')]===0x1f4){logger[_0x1dc9('0x13')](_0x1dc9('0xf'),_0x3323f,_0x3c074b[_0x1dc9('0x13')][_0x1dc9('0x15')]);return _0xf6e540(_0x3c074b['error'][_0x1dc9('0x15')]);}logger[_0x1dc9('0x13')](_0x1dc9('0xf'),_0x3323f,_0x3c074b[_0x1dc9('0x13')]['message']);return _0x549f73(_0x3c074b['error'][_0x1dc9('0x15')]);}else{logger[_0x1dc9('0xe')](_0x1dc9('0xf'),_0x3323f,_0x1dc9('0x10'));_0x549f73(_0x3c074b[_0x1dc9('0x16')][_0x1dc9('0x15')]);}})[_0x1dc9('0x17')](function(_0x30f908){logger[_0x1dc9('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3323f,_0x30f908);_0xf6e540(_0x30f908);});});} \ No newline at end of file +var _0xf84a=['http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x49c37b,_0x23b0c5){var _0x3ba54b=function(_0x1439dd){while(--_0x1439dd){_0x49c37b['push'](_0x49c37b['shift']());}};_0x3ba54b(++_0x23b0c5);}(_0xf84a,0x97));var _0xaf84=function(_0xd76449,_0x3203f1){_0xd76449=_0xd76449-0x0;var _0x299467=_0xf84a[_0xd76449];return _0x299467;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaf84('0x0'));var BPromise=require(_0xaf84('0x1'));var rs=require(_0xaf84('0x2'));var fs=require('fs');var Redis=require(_0xaf84('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaf84('0x4'));var logger=require(_0xaf84('0x5'))('rpc');var config=require(_0xaf84('0x6'));var jayson=require(_0xaf84('0x7'));var client=jayson[_0xaf84('0x8')][_0xaf84('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x551f84,_0x93022b,_0x157f00){return new BPromise(function(_0x30e31c,_0x1b7235){return client['request'](_0x551f84,_0x157f00)[_0xaf84('0xa')](function(_0x1e894a){logger[_0xaf84('0xb')](_0xaf84('0xc'),_0x93022b,_0xaf84('0xd'));logger[_0xaf84('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x93022b,'request\x20sent',JSON['stringify'](_0x1e894a));if(_0x1e894a['error']){if(_0x1e894a[_0xaf84('0xf')][_0xaf84('0x10')]===0x1f4){logger[_0xaf84('0xf')](_0xaf84('0xc'),_0x93022b,_0x1e894a[_0xaf84('0xf')][_0xaf84('0x11')]);return _0x1b7235(_0x1e894a[_0xaf84('0xf')][_0xaf84('0x11')]);}logger['error'](_0xaf84('0xc'),_0x93022b,_0x1e894a[_0xaf84('0xf')]['message']);return _0x30e31c(_0x1e894a[_0xaf84('0xf')][_0xaf84('0x11')]);}else{logger['info'](_0xaf84('0xc'),_0x93022b,_0xaf84('0xd'));_0x30e31c(_0x1e894a[_0xaf84('0x12')][_0xaf84('0x11')]);}})[_0xaf84('0x13')](function(_0x13ab2b){logger[_0xaf84('0xf')](_0xaf84('0xc'),_0x93022b,_0x13ab2b);_0x1b7235(_0x13ab2b);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 7d3e12d..ad7a206 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 _0xe2f4=['delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','create','update'];(function(_0x19f6b7,_0x2ac2b0){var _0x364a30=function(_0x3e5c56){while(--_0x3e5c56){_0x19f6b7['push'](_0x19f6b7['shift']());}};_0x364a30(++_0x2ac2b0);}(_0xe2f4,0x17e));var _0x4e2f=function(_0x3178d3,_0x3c3e7d){_0x3178d3=_0x3178d3-0x0;var _0x4f3c8f=_0xe2f4[_0x3178d3];return _0x4f3c8f;};'use strict';var multer=require(_0x4e2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4e2f('0x1'));var express=require(_0x4e2f('0x2'));var router=express[_0x4e2f('0x3')]();var fs_extra=require(_0x4e2f('0x4'));var auth=require(_0x4e2f('0x5'));var interaction=require(_0x4e2f('0x6'));var config=require(_0x4e2f('0x7'));var controller=require(_0x4e2f('0x8'));router[_0x4e2f('0x9')]('/',auth[_0x4e2f('0xa')](),controller[_0x4e2f('0xb')]);router[_0x4e2f('0x9')](_0x4e2f('0xc'),auth['isAuthenticated'](),controller[_0x4e2f('0xd')]);router[_0x4e2f('0x9')](_0x4e2f('0xe'),auth[_0x4e2f('0xa')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x4e2f('0xf')]);router['put'](_0x4e2f('0xc'),auth[_0x4e2f('0xa')](),controller[_0x4e2f('0x10')]);router[_0x4e2f('0x11')]('/:id',auth[_0x4e2f('0xa')](),controller['destroy']);module[_0x4e2f('0x12')]=router; \ No newline at end of file +var _0x5257=['post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','/:id','show','/:id/download','isAuthenticated'];(function(_0xd050c6,_0x58ffb4){var _0x7278a=function(_0x16d03e){while(--_0x16d03e){_0xd050c6['push'](_0xd050c6['shift']());}};_0x7278a(++_0x58ffb4);}(_0x5257,0x1ba));var _0x7525=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x5257[_0x26f702];return _0x11417d;};'use strict';var multer=require(_0x7525('0x0'));var util=require(_0x7525('0x1'));var path=require('path');var timeout=require(_0x7525('0x2'));var express=require(_0x7525('0x3'));var router=express[_0x7525('0x4')]();var fs_extra=require(_0x7525('0x5'));var auth=require(_0x7525('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7525('0x7'));var controller=require(_0x7525('0x8'));router[_0x7525('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7525('0xa'),auth['isAuthenticated'](),controller[_0x7525('0xb')]);router[_0x7525('0x9')](_0x7525('0xc'),auth[_0x7525('0xd')](),controller['download']);router[_0x7525('0xe')]('/',auth['isAuthenticated'](),controller[_0x7525('0xf')]);router[_0x7525('0x10')](_0x7525('0xa'),auth[_0x7525('0xd')](),controller['update']);router['delete'](_0x7525('0xa'),auth[_0x7525('0xd')](),controller[_0x7525('0x11')]);module[_0x7525('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index ed9beb1..5a9b9ea 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 _0xad09=['sequelize','exports','STRING','BOOLEAN'];(function(_0x1aa9ce,_0x2e9b00){var _0x1b0e99=function(_0x210f73){while(--_0x210f73){_0x1aa9ce['push'](_0x1aa9ce['shift']());}};_0x1b0e99(++_0x2e9b00);}(_0xad09,0x11c));var _0x9ad0=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xad09[_0x4dcc2d];return _0x1bbd79;};'use strict';var Sequelize=require(_0x9ad0('0x0'));module[_0x9ad0('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x9ad0('0x2')]},'function':{'type':Sequelize[_0x9ad0('0x2')]},'format':{'type':Sequelize[_0x9ad0('0x2')]},'groupBy':{'type':Sequelize[_0x9ad0('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x9ad0('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1716=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x4e6afe,_0x34dc76){var _0x43cf2d=function(_0x1f585f){while(--_0x1f585f){_0x4e6afe['push'](_0x4e6afe['shift']());}};_0x43cf2d(++_0x34dc76);}(_0x1716,0x108));var _0x6171=function(_0x2f98a4,_0x1acd5a){_0x2f98a4=_0x2f98a4-0x0;var _0x1bb9bd=_0x1716[_0x2f98a4];return _0x1bb9bd;};'use strict';var Sequelize=require(_0x6171('0x0'));module['exports']={'field':{'type':Sequelize[_0x6171('0x1')]},'alias':{'type':Sequelize[_0x6171('0x2')]},'function':{'type':Sequelize[_0x6171('0x2')]},'format':{'type':Sequelize[_0x6171('0x2')]},'groupBy':{'type':Sequelize[_0x6171('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x6171('0x2')]},'custom':{'type':Sequelize[_0x6171('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 730c885..ba9b6af 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 _0xcd1e=['undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','params','merge','find','create','bulkCreate','body','bulkDestroy','ids','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json'];(function(_0x2960b9,_0x581eb4){var _0x2a1846=function(_0xc2e9be){while(--_0xc2e9be){_0x2960b9['push'](_0x2960b9['shift']());}};_0x2a1846(++_0x581eb4);}(_0xcd1e,0x114));var _0xecd1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xcd1e[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0xecd1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xecd1('0x1'));var rp=require('request-promise');var moment=require(_0xecd1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xecd1('0x3'));var util=require(_0xecd1('0x4'));var path=require(_0xecd1('0x5'));var sox=require('sox');var csv=require(_0xecd1('0x6'));var ejs=require(_0xecd1('0x7'));var fs=require('fs');var fs_extra=require(_0xecd1('0x8'));var _=require(_0xecd1('0x9'));var squel=require(_0xecd1('0xa'));var crypto=require(_0xecd1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xecd1('0xc'));var toCsv=require(_0xecd1('0x6'));var querystring=require(_0xecd1('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xecd1('0xe'));var qs=require(_0xecd1('0xf'));var as=require(_0xecd1('0x10'));var hardwareService=require(_0xecd1('0x11'));var logger=require(_0xecd1('0x12'))(_0xecd1('0x13'));var utils=require('../../config/utils');var config=require(_0xecd1('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xecd1('0x15'))['db'];function respondWithStatusCode(_0xb8bb3,_0x1ea8f1){_0x1ea8f1=_0x1ea8f1||0xcc;return function(_0x4e36c4){if(_0x4e36c4){return _0xb8bb3['sendStatus'](_0x1ea8f1);}return _0xb8bb3[_0xecd1('0x16')](_0x1ea8f1)['end']();};}function respondWithResult(_0x31de39,_0x4c66f3){_0x4c66f3=_0x4c66f3||0xc8;return function(_0x3e29e3){if(_0x3e29e3){return _0x31de39['status'](_0x4c66f3)[_0xecd1('0x17')](_0x3e29e3);}};}function respondWithFilteredResult(_0x35e3fd,_0x8fa433){return function(_0x590e19){if(_0x590e19){var _0x485b74=typeof _0x8fa433['offset']===_0xecd1('0x18')&&typeof _0x8fa433[_0xecd1('0x19')]==='undefined';var _0x3a8c17=_0x590e19[_0xecd1('0x1a')];var _0x514643=_0x485b74?0x0:_0x8fa433[_0xecd1('0x1b')];var _0x3c8a5b=_0x485b74?_0x590e19[_0xecd1('0x1a')]:_0x8fa433[_0xecd1('0x1b')]+_0x8fa433['limit'];var _0x510a25;if(_0x3c8a5b>=_0x3a8c17){_0x3c8a5b=_0x3a8c17;_0x510a25=0xc8;}else{_0x510a25=0xce;}_0x35e3fd[_0xecd1('0x16')](_0x510a25);return _0x35e3fd['set'](_0xecd1('0x1c'),_0x514643+'-'+_0x3c8a5b+'/'+_0x3a8c17)[_0xecd1('0x17')](_0x590e19);}return null;};}function patchUpdates(_0x77f59a){return function(_0x2102af){try{jsonpatch[_0xecd1('0x1d')](_0x2102af,_0x77f59a,!![]);}catch(_0x1dd841){return BPromise['reject'](_0x1dd841);}return _0x2102af[_0xecd1('0x1e')]();};}function saveUpdates(_0x6d4896,_0x4e537b){return function(_0x50506e){if(_0x50506e){return _0x50506e[_0xecd1('0x1f')](_0x6d4896)[_0xecd1('0x20')](function(_0x226c5c){return _0x226c5c;});}return null;};}function removeEntity(_0x2bf7b1,_0x871568){return function(_0x443af5){if(_0x443af5){return _0x443af5[_0xecd1('0x21')]()[_0xecd1('0x20')](function(){_0x2bf7b1[_0xecd1('0x16')](0xcc)[_0xecd1('0x22')]();});}};}function handleEntityNotFound(_0x24a98f,_0x987fc7){return function(_0xbb963b){if(!_0xbb963b){_0x24a98f['sendStatus'](0x194);}return _0xbb963b;};}function handleError(_0x305a9b,_0x41dd7e){_0x41dd7e=_0x41dd7e||0x1f4;return function(_0xe065d6){logger[_0xecd1('0x23')](_0xe065d6[_0xecd1('0x24')]);if(_0xe065d6[_0xecd1('0x25')]){delete _0xe065d6[_0xecd1('0x25')];}_0x305a9b[_0xecd1('0x16')](_0x41dd7e)[_0xecd1('0x26')](_0xe065d6);};}exports['index']=function(_0x4ec4da,_0x21002f){var _0x14b928={},_0x38d36b={},_0x41de54={'count':0x0,'rows':[]};var _0x41ebe9=_[_0xecd1('0x27')](db[_0xecd1('0x28')][_0xecd1('0x29')],function(_0xc2a6de){return{'name':_0xc2a6de[_0xecd1('0x2a')],'type':_0xc2a6de[_0xecd1('0x2b')]['key']};});_0x38d36b[_0xecd1('0x2c')]=_['map'](_0x41ebe9,_0xecd1('0x25'));_0x38d36b['query']=_[_0xecd1('0x2d')](_0x4ec4da[_0xecd1('0x2e')]);_0x38d36b[_0xecd1('0x2f')]=_['intersection'](_0x38d36b[_0xecd1('0x2c')],_0x38d36b[_0xecd1('0x2e')]);_0x14b928['attributes']=_[_0xecd1('0x30')](_0x38d36b[_0xecd1('0x2c')],qs[_0xecd1('0x31')](_0x4ec4da['query']['fields']));_0x14b928[_0xecd1('0x32')]=_0x14b928['attributes'][_0xecd1('0x33')]?_0x14b928[_0xecd1('0x32')]:_0x38d36b[_0xecd1('0x2c')];if(!_0x4ec4da[_0xecd1('0x2e')]['hasOwnProperty'](_0xecd1('0x34'))){_0x14b928[_0xecd1('0x19')]=qs[_0xecd1('0x19')](_0x4ec4da['query'][_0xecd1('0x19')]);_0x14b928[_0xecd1('0x1b')]=qs[_0xecd1('0x1b')](_0x4ec4da[_0xecd1('0x2e')][_0xecd1('0x1b')]);}_0x14b928['order']=qs[_0xecd1('0x35')](_0x4ec4da[_0xecd1('0x2e')]['sort']);_0x14b928[_0xecd1('0x36')]=qs[_0xecd1('0x2f')](_[_0xecd1('0x37')](_0x4ec4da[_0xecd1('0x2e')],_0x38d36b[_0xecd1('0x2f')]),_0x41ebe9);if(_0x4ec4da[_0xecd1('0x2e')][_0xecd1('0x38')]){_0x14b928[_0xecd1('0x36')]=_['merge'](_0x14b928[_0xecd1('0x36')],{'$or':_[_0xecd1('0x27')](_0x41ebe9,function(_0xce6a91){if(_0xce6a91[_0xecd1('0x2b')]!==_0xecd1('0x39')){var _0x188585={};_0x188585[_0xce6a91[_0xecd1('0x25')]]={'$like':'%'+_0x4ec4da[_0xecd1('0x2e')]['filter']+'%'};return _0x188585;}})});}_0x14b928=_['merge']({},_0x14b928,_0x4ec4da[_0xecd1('0x3a')]);var _0x33f6b1={'where':_0x14b928[_0xecd1('0x36')]};return db[_0xecd1('0x28')][_0xecd1('0x1a')](_0x33f6b1)[_0xecd1('0x20')](function(_0x5b2597){_0x41de54[_0xecd1('0x1a')]=_0x5b2597;if(_0x4ec4da[_0xecd1('0x2e')]['includeAll']){_0x14b928[_0xecd1('0x3b')]=[{'all':!![]}];}return db[_0xecd1('0x28')][_0xecd1('0x3c')](_0x14b928);})[_0xecd1('0x20')](function(_0x3b972e){_0x41de54[_0xecd1('0x3d')]=_0x3b972e;return _0x41de54;})['then'](respondWithFilteredResult(_0x21002f,_0x14b928))[_0xecd1('0x3e')](handleError(_0x21002f,null));};exports['show']=function(_0xf7a5be,_0x3a92a9){var _0x508eb2={'raw':![],'where':{'id':_0xf7a5be[_0xecd1('0x3f')]['id']}},_0x28705f={};_0x28705f[_0xecd1('0x2c')]=_[_0xecd1('0x2d')](db[_0xecd1('0x28')][_0xecd1('0x29')]);_0x28705f[_0xecd1('0x2e')]=_[_0xecd1('0x2d')](_0xf7a5be[_0xecd1('0x2e')]);_0x28705f['filters']=_[_0xecd1('0x30')](_0x28705f['model'],_0x28705f['query']);_0x508eb2[_0xecd1('0x32')]=_[_0xecd1('0x30')](_0x28705f['model'],qs[_0xecd1('0x31')](_0xf7a5be[_0xecd1('0x2e')][_0xecd1('0x31')]));_0x508eb2[_0xecd1('0x32')]=_0x508eb2[_0xecd1('0x32')][_0xecd1('0x33')]?_0x508eb2['attributes']:_0x28705f[_0xecd1('0x2c')];if(_0xf7a5be['query']['includeAll']){_0x508eb2[_0xecd1('0x3b')]=[{'all':!![]}];}_0x508eb2=_[_0xecd1('0x40')]({},_0x508eb2,_0xf7a5be[_0xecd1('0x3a')]);return db[_0xecd1('0x28')][_0xecd1('0x41')](_0x508eb2)['then'](handleEntityNotFound(_0x3a92a9,null))[_0xecd1('0x20')](respondWithResult(_0x3a92a9,null))['catch'](handleError(_0x3a92a9,null));};exports[_0xecd1('0x42')]=function(_0x39aa8f,_0x357e23){return db[_0xecd1('0x28')][_0xecd1('0x42')](_0x39aa8f['body'],{})[_0xecd1('0x20')](respondWithResult(_0x357e23,0xc9))[_0xecd1('0x3e')](handleError(_0x357e23,null));};exports[_0xecd1('0x43')]=function(_0x253b74,_0x1a8d02){return db[_0xecd1('0x28')]['bulkCreate'](_0x253b74[_0xecd1('0x44')],{'raw':![],'individualHooks':!![]})[_0xecd1('0x20')](respondWithResult(_0x1a8d02,0xc9))[_0xecd1('0x3e')](handleError(_0x1a8d02,null));};exports[_0xecd1('0x1f')]=function(_0xdb0b1e,_0xa98f1e){if(_0xdb0b1e[_0xecd1('0x44')]['id']){delete _0xdb0b1e[_0xecd1('0x44')]['id'];}return db[_0xecd1('0x28')]['find']({'where':{'id':_0xdb0b1e['params']['id']}})[_0xecd1('0x20')](handleEntityNotFound(_0xa98f1e,null))[_0xecd1('0x20')](saveUpdates(_0xdb0b1e['body'],null))['then'](respondWithResult(_0xa98f1e,null))['catch'](handleError(_0xa98f1e,null));};exports['destroy']=function(_0x42038c,_0x1c7720){return db[_0xecd1('0x28')][_0xecd1('0x41')]({'where':{'id':_0x42038c['params']['id']}})[_0xecd1('0x20')](handleEntityNotFound(_0x1c7720,null))['then'](removeEntity(_0x1c7720,null))[_0xecd1('0x3e')](handleError(_0x1c7720,null));};exports[_0xecd1('0x45')]=function(_0x41e96c,_0x131af2){return db[_0xecd1('0x28')][_0xecd1('0x21')]({'where':{'id':_0x41e96c['query'][_0xecd1('0x46')]||[]},'raw':![],'individualHooks':!![]})[_0xecd1('0x20')](respondWithResult(_0x131af2,0xcc))[_0xecd1('0x3e')](handleError(_0x131af2,null));};exports['addFields']=function(_0x2d92d6,_0x2a33fc,_0x533b28){return db[_0xecd1('0x47')][_0xecd1('0x48')]({'where':{'id':_0x2d92d6[_0xecd1('0x3f')]['id']}})[_0xecd1('0x20')](handleEntityNotFound(_0x2a33fc,null))[_0xecd1('0x20')](function(_0x5651bc){if(_0x5651bc){return db['sequelize'][_0xecd1('0x49')](function(_0x466643){return db[_0xecd1('0x28')][_0xecd1('0x21')]({'where':{'CustomReportId':_0x2d92d6[_0xecd1('0x3f')]['id']},'transaction':_0x466643})[_0xecd1('0x20')](function(_0x441274){var _0x5f120a=_['map'](_0x2d92d6[_0xecd1('0x44')],function(_0x3f9bec){delete _0x3f9bec['id'];_0x3f9bec[_0xecd1('0x4a')]=_0x2d92d6[_0xecd1('0x3f')]['id'];return _0x3f9bec;});return db['AnalyticFieldReport'][_0xecd1('0x43')](_0x5f120a,{'transaction':_0x466643});});})[_0xecd1('0x20')](function(){return db[_0xecd1('0x28')][_0xecd1('0x3c')]({'where':{'CustomReportId':_0x2d92d6[_0xecd1('0x3f')]['id']}});});}})[_0xecd1('0x20')](respondWithResult(_0x2a33fc,null))[_0xecd1('0x3e')](handleError(_0x2a33fc,null));}; \ No newline at end of file +var _0x2809=['rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','destroy','then','sendStatus','error','name','send','index','map','AnalyticFieldReport','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','options','find','create','body','bulkCreate','params','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format'];(function(_0x3ee8d1,_0x54afbd){var _0x5e6660=function(_0x3414a5){while(--_0x3414a5){_0x3ee8d1['push'](_0x3ee8d1['shift']());}};_0x5e6660(++_0x54afbd);}(_0x2809,0x1e5));var _0x9280=function(_0x2ff38f,_0xefceba){_0x2ff38f=_0x2ff38f-0x0;var _0x19a75f=_0x2809[_0x2ff38f];return _0x19a75f;};'use strict';var emlformat=require(_0x9280('0x0'));var rimraf=require(_0x9280('0x1'));var zipdir=require(_0x9280('0x2'));var jsonpatch=require(_0x9280('0x3'));var rp=require('request-promise');var moment=require(_0x9280('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9280('0x5'));var util=require(_0x9280('0x6'));var path=require(_0x9280('0x7'));var sox=require(_0x9280('0x8'));var csv=require(_0x9280('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9280('0xa'));var _=require(_0x9280('0xb'));var squel=require('squel');var crypto=require(_0x9280('0xc'));var jsforce=require(_0x9280('0xd'));var deskjs=require(_0x9280('0xe'));var toCsv=require(_0x9280('0x9'));var querystring=require('querystring');var Papa=require(_0x9280('0xf'));var Redis=require('ioredis');var authService=require(_0x9280('0x10'));var qs=require(_0x9280('0x11'));var as=require(_0x9280('0x12'));var hardwareService=require(_0x9280('0x13'));var logger=require('../../config/logger')(_0x9280('0x14'));var utils=require(_0x9280('0x15'));var config=require(_0x9280('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9280('0x17'))['db'];function respondWithStatusCode(_0xe2407b,_0x56a814){_0x56a814=_0x56a814||0xcc;return function(_0x5df9d0){if(_0x5df9d0){return _0xe2407b['sendStatus'](_0x56a814);}return _0xe2407b[_0x9280('0x18')](_0x56a814)[_0x9280('0x19')]();};}function respondWithResult(_0x30392a,_0x4786fd){_0x4786fd=_0x4786fd||0xc8;return function(_0x177c9a){if(_0x177c9a){return _0x30392a[_0x9280('0x18')](_0x4786fd)['json'](_0x177c9a);}};}function respondWithFilteredResult(_0x37cdd6,_0x22a1e7){return function(_0x1621d5){if(_0x1621d5){var _0x101280=typeof _0x22a1e7[_0x9280('0x1a')]===_0x9280('0x1b')&&typeof _0x22a1e7[_0x9280('0x1c')]==='undefined';var _0x4245d9=_0x1621d5['count'];var _0x45ad25=_0x101280?0x0:_0x22a1e7[_0x9280('0x1a')];var _0x1b767b=_0x101280?_0x1621d5[_0x9280('0x1d')]:_0x22a1e7[_0x9280('0x1a')]+_0x22a1e7[_0x9280('0x1c')];var _0x527f2b;if(_0x1b767b>=_0x4245d9){_0x1b767b=_0x4245d9;_0x527f2b=0xc8;}else{_0x527f2b=0xce;}_0x37cdd6['status'](_0x527f2b);return _0x37cdd6[_0x9280('0x1e')](_0x9280('0x1f'),_0x45ad25+'-'+_0x1b767b+'/'+_0x4245d9)[_0x9280('0x20')](_0x1621d5);}return null;};}function patchUpdates(_0x56099f){return function(_0x1fcf90){try{jsonpatch['apply'](_0x1fcf90,_0x56099f,!![]);}catch(_0x18e696){return BPromise['reject'](_0x18e696);}return _0x1fcf90[_0x9280('0x21')]();};}function saveUpdates(_0x33ecb2,_0x207af6){return function(_0x39c7f9){if(_0x39c7f9){return _0x39c7f9[_0x9280('0x22')](_0x33ecb2)['then'](function(_0x576399){return _0x576399;});}return null;};}function removeEntity(_0x5e8407,_0x265836){return function(_0x856071){if(_0x856071){return _0x856071[_0x9280('0x23')]()[_0x9280('0x24')](function(){_0x5e8407[_0x9280('0x18')](0xcc)[_0x9280('0x19')]();});}};}function handleEntityNotFound(_0x229db5,_0x4a5f06){return function(_0x45619d){if(!_0x45619d){_0x229db5[_0x9280('0x25')](0x194);}return _0x45619d;};}function handleError(_0x1569af,_0x425fcc){_0x425fcc=_0x425fcc||0x1f4;return function(_0x1a780f){logger[_0x9280('0x26')](_0x1a780f['stack']);if(_0x1a780f['name']){delete _0x1a780f[_0x9280('0x27')];}_0x1569af['status'](_0x425fcc)[_0x9280('0x28')](_0x1a780f);};}exports[_0x9280('0x29')]=function(_0x77c8f6,_0x52c1e6){var _0x213461={},_0x3f2d4e={},_0x2a3b4b={'count':0x0,'rows':[]};var _0x4dfa61=_[_0x9280('0x2a')](db[_0x9280('0x2b')]['rawAttributes'],function(_0x5ea5db){return{'name':_0x5ea5db[_0x9280('0x2c')],'type':_0x5ea5db['type'][_0x9280('0x2d')]};});_0x3f2d4e['model']=_['map'](_0x4dfa61,'name');_0x3f2d4e[_0x9280('0x2e')]=_[_0x9280('0x2f')](_0x77c8f6[_0x9280('0x2e')]);_0x3f2d4e[_0x9280('0x30')]=_[_0x9280('0x31')](_0x3f2d4e[_0x9280('0x32')],_0x3f2d4e[_0x9280('0x2e')]);_0x213461[_0x9280('0x33')]=_[_0x9280('0x31')](_0x3f2d4e[_0x9280('0x32')],qs[_0x9280('0x34')](_0x77c8f6['query'][_0x9280('0x34')]));_0x213461['attributes']=_0x213461[_0x9280('0x33')][_0x9280('0x35')]?_0x213461['attributes']:_0x3f2d4e[_0x9280('0x32')];if(!_0x77c8f6['query']['hasOwnProperty'](_0x9280('0x36'))){_0x213461[_0x9280('0x1c')]=qs[_0x9280('0x1c')](_0x77c8f6[_0x9280('0x2e')][_0x9280('0x1c')]);_0x213461['offset']=qs[_0x9280('0x1a')](_0x77c8f6[_0x9280('0x2e')]['offset']);}_0x213461[_0x9280('0x37')]=qs[_0x9280('0x38')](_0x77c8f6[_0x9280('0x2e')][_0x9280('0x38')]);_0x213461[_0x9280('0x39')]=qs[_0x9280('0x30')](_[_0x9280('0x3a')](_0x77c8f6['query'],_0x3f2d4e['filters']),_0x4dfa61);if(_0x77c8f6[_0x9280('0x2e')]['filter']){_0x213461[_0x9280('0x39')]=_[_0x9280('0x3b')](_0x213461[_0x9280('0x39')],{'$or':_[_0x9280('0x2a')](_0x4dfa61,function(_0x352e3a){if(_0x352e3a[_0x9280('0x3c')]!==_0x9280('0x3d')){var _0x11c24e={};_0x11c24e[_0x352e3a['name']]={'$like':'%'+_0x77c8f6[_0x9280('0x2e')][_0x9280('0x3e')]+'%'};return _0x11c24e;}})});}_0x213461=_['merge']({},_0x213461,_0x77c8f6['options']);var _0x317331={'where':_0x213461[_0x9280('0x39')]};return db['AnalyticFieldReport'][_0x9280('0x1d')](_0x317331)[_0x9280('0x24')](function(_0x4eb133){_0x2a3b4b[_0x9280('0x1d')]=_0x4eb133;if(_0x77c8f6[_0x9280('0x2e')][_0x9280('0x3f')]){_0x213461[_0x9280('0x40')]=[{'all':!![]}];}return db[_0x9280('0x2b')][_0x9280('0x41')](_0x213461);})[_0x9280('0x24')](function(_0x134fb0){_0x2a3b4b[_0x9280('0x42')]=_0x134fb0;return _0x2a3b4b;})[_0x9280('0x24')](respondWithFilteredResult(_0x52c1e6,_0x213461))[_0x9280('0x43')](handleError(_0x52c1e6,null));};exports['show']=function(_0x350a1c,_0x48994e){var _0x31915c={'raw':![],'where':{'id':_0x350a1c['params']['id']}},_0x4e81d4={};_0x4e81d4[_0x9280('0x32')]=_[_0x9280('0x2f')](db[_0x9280('0x2b')]['rawAttributes']);_0x4e81d4[_0x9280('0x2e')]=_[_0x9280('0x2f')](_0x350a1c[_0x9280('0x2e')]);_0x4e81d4[_0x9280('0x30')]=_['intersection'](_0x4e81d4['model'],_0x4e81d4['query']);_0x31915c[_0x9280('0x33')]=_[_0x9280('0x31')](_0x4e81d4[_0x9280('0x32')],qs[_0x9280('0x34')](_0x350a1c['query'][_0x9280('0x34')]));_0x31915c[_0x9280('0x33')]=_0x31915c['attributes'][_0x9280('0x35')]?_0x31915c[_0x9280('0x33')]:_0x4e81d4['model'];if(_0x350a1c[_0x9280('0x2e')]['includeAll']){_0x31915c[_0x9280('0x40')]=[{'all':!![]}];}_0x31915c=_[_0x9280('0x3b')]({},_0x31915c,_0x350a1c[_0x9280('0x44')]);return db[_0x9280('0x2b')][_0x9280('0x45')](_0x31915c)[_0x9280('0x24')](handleEntityNotFound(_0x48994e,null))[_0x9280('0x24')](respondWithResult(_0x48994e,null))[_0x9280('0x43')](handleError(_0x48994e,null));};exports[_0x9280('0x46')]=function(_0x50df55,_0xc8709d){return db[_0x9280('0x2b')][_0x9280('0x46')](_0x50df55[_0x9280('0x47')],{})[_0x9280('0x24')](respondWithResult(_0xc8709d,0xc9))[_0x9280('0x43')](handleError(_0xc8709d,null));};exports[_0x9280('0x48')]=function(_0x315144,_0x5ce638){return db[_0x9280('0x2b')]['bulkCreate'](_0x315144['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5ce638,0xc9))[_0x9280('0x43')](handleError(_0x5ce638,null));};exports[_0x9280('0x22')]=function(_0x306f09,_0x7ac59a){if(_0x306f09[_0x9280('0x47')]['id']){delete _0x306f09[_0x9280('0x47')]['id'];}return db[_0x9280('0x2b')][_0x9280('0x45')]({'where':{'id':_0x306f09[_0x9280('0x49')]['id']}})[_0x9280('0x24')](handleEntityNotFound(_0x7ac59a,null))[_0x9280('0x24')](saveUpdates(_0x306f09[_0x9280('0x47')],null))[_0x9280('0x24')](respondWithResult(_0x7ac59a,null))[_0x9280('0x43')](handleError(_0x7ac59a,null));};exports[_0x9280('0x23')]=function(_0x564688,_0x3d41b){return db['AnalyticFieldReport']['find']({'where':{'id':_0x564688[_0x9280('0x49')]['id']}})[_0x9280('0x24')](handleEntityNotFound(_0x3d41b,null))[_0x9280('0x24')](removeEntity(_0x3d41b,null))[_0x9280('0x43')](handleError(_0x3d41b,null));};exports[_0x9280('0x4a')]=function(_0x361904,_0x331fbf){return db['AnalyticFieldReport'][_0x9280('0x23')]({'where':{'id':_0x361904[_0x9280('0x2e')][_0x9280('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x9280('0x24')](respondWithResult(_0x331fbf,0xcc))[_0x9280('0x43')](handleError(_0x331fbf,null));};exports[_0x9280('0x4c')]=function(_0x31c204,_0x56ccb5,_0x26c6c3){return db[_0x9280('0x4d')]['findOne']({'where':{'id':_0x31c204[_0x9280('0x49')]['id']}})[_0x9280('0x24')](handleEntityNotFound(_0x56ccb5,null))[_0x9280('0x24')](function(_0xbdcfc){if(_0xbdcfc){return db[_0x9280('0x4e')][_0x9280('0x4f')](function(_0x5d3177){return db['AnalyticFieldReport'][_0x9280('0x23')]({'where':{'CustomReportId':_0x31c204[_0x9280('0x49')]['id']},'transaction':_0x5d3177})[_0x9280('0x24')](function(_0x2dd837){var _0x112120=_[_0x9280('0x2a')](_0x31c204[_0x9280('0x47')],function(_0x452e35){delete _0x452e35['id'];_0x452e35[_0x9280('0x50')]=_0x31c204['params']['id'];return _0x452e35;});return db['AnalyticFieldReport'][_0x9280('0x48')](_0x112120,{'transaction':_0x5d3177});});})[_0x9280('0x24')](function(){return db[_0x9280('0x2b')]['findAll']({'where':{'CustomReportId':_0x31c204['params']['id']}});});}})[_0x9280('0x24')](respondWithResult(_0x56ccb5,null))[_0x9280('0x43')](handleError(_0x56ccb5,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 807ec70..4c8089d 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 _0x363e=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x219a27,_0x208f9e){var _0x34c818=function(_0x402f76){while(--_0x402f76){_0x219a27['push'](_0x219a27['shift']());}};_0x34c818(++_0x208f9e);}(_0x363e,0x9b));var _0xe363=function(_0x3907f3,_0x5a665a){_0x3907f3=_0x3907f3-0x0;var _0x24722d=_0x363e[_0x3907f3];return _0x24722d;};'use strict';var _=require(_0xe363('0x0'));var util=require(_0xe363('0x1'));var logger=require(_0xe363('0x2'))('api');var moment=require(_0xe363('0x3'));var BPromise=require(_0xe363('0x4'));var rp=require(_0xe363('0x5'));var fs=require('fs');var path=require(_0xe363('0x6'));var rimraf=require(_0xe363('0x7'));var config=require(_0xe363('0x8'));var attributes=require(_0xe363('0x9'));module[_0xe363('0xa')]=function(_0x40bd5e,_0x54c817){return _0x40bd5e['define'](_0xe363('0xb'),attributes,{'tableName':_0xe363('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa82b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','define','analytics_report_fields','lodash','util','../../config/logger','api'];(function(_0x1b1e0a,_0x4b913e){var _0x1d98a0=function(_0x2e7f2b){while(--_0x2e7f2b){_0x1b1e0a['push'](_0x1b1e0a['shift']());}};_0x1d98a0(++_0x4b913e);}(_0xa82b,0x14e));var _0xba82=function(_0x91384,_0x545eef){_0x91384=_0x91384-0x0;var _0x44daa0=_0xa82b[_0x91384];return _0x44daa0;};'use strict';var _=require(_0xba82('0x0'));var util=require(_0xba82('0x1'));var logger=require(_0xba82('0x2'))(_0xba82('0x3'));var moment=require(_0xba82('0x4'));var BPromise=require(_0xba82('0x5'));var rp=require(_0xba82('0x6'));var fs=require('fs');var path=require(_0xba82('0x7'));var rimraf=require(_0xba82('0x8'));var config=require(_0xba82('0x9'));var attributes=require(_0xba82('0xa'));module['exports']=function(_0x15a45e,_0x130a68){return _0x15a45e[_0xba82('0xb')]('AnalyticFieldReport',attributes,{'tableName':_0xba82('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 9ac2e7e..67f580d 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 _0x0c76=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','catch'];(function(_0x3df38b,_0x46223e){var _0x5e5e22=function(_0xd0f2ea){while(--_0xd0f2ea){_0x3df38b['push'](_0x3df38b['shift']());}};_0x5e5e22(++_0x46223e);}(_0x0c76,0x8a));var _0x60c7=function(_0x22dc0b,_0x5d6c26){_0x22dc0b=_0x22dc0b-0x0;var _0x4443b3=_0x0c76[_0x22dc0b];return _0x4443b3;};'use strict';var _=require(_0x60c7('0x0'));var util=require(_0x60c7('0x1'));var moment=require('moment');var BPromise=require(_0x60c7('0x2'));var rs=require(_0x60c7('0x3'));var fs=require('fs');var Redis=require(_0x60c7('0x4'));var db=require(_0x60c7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x60c7('0x6'))(_0x60c7('0x7'));var config=require(_0x60c7('0x8'));var jayson=require(_0x60c7('0x9'));var client=jayson[_0x60c7('0xa')][_0x60c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10b50e,_0x219f64,_0x5ef53c){return new BPromise(function(_0xc804e4,_0xd5150d){return client[_0x60c7('0xc')](_0x10b50e,_0x5ef53c)[_0x60c7('0xd')](function(_0x9830f9){logger[_0x60c7('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x219f64,_0x60c7('0xf'));logger['debug'](_0x60c7('0x10'),_0x219f64,'request\x20sent',JSON[_0x60c7('0x11')](_0x9830f9));if(_0x9830f9[_0x60c7('0x12')]){if(_0x9830f9[_0x60c7('0x12')][_0x60c7('0x13')]===0x1f4){logger[_0x60c7('0x12')](_0x60c7('0x14'),_0x219f64,_0x9830f9[_0x60c7('0x12')][_0x60c7('0x15')]);return _0xd5150d(_0x9830f9[_0x60c7('0x12')][_0x60c7('0x15')]);}logger['error'](_0x60c7('0x14'),_0x219f64,_0x9830f9['error'][_0x60c7('0x15')]);return _0xc804e4(_0x9830f9[_0x60c7('0x12')][_0x60c7('0x15')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x219f64,_0x60c7('0xf'));_0xc804e4(_0x9830f9['result'][_0x60c7('0x15')]);}})[_0x60c7('0x16')](function(_0x1a6186){logger[_0x60c7('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x219f64,_0x1a6186);_0xd5150d(_0x1a6186);});});} \ No newline at end of file +var _0xcf2f=['stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0x1d2d2b,_0x5c46bb){var _0x27b0c7=function(_0x472390){while(--_0x472390){_0x1d2d2b['push'](_0x1d2d2b['shift']());}};_0x27b0c7(++_0x5c46bb);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x5ba253,_0x1a80b0){_0x5ba253=_0x5ba253-0x0;var _0x45783d=_0xcf2f[_0x5ba253];return _0x45783d;};'use strict';var _=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var moment=require(_0xfcf2('0x2'));var BPromise=require(_0xfcf2('0x3'));var rs=require(_0xfcf2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcf2('0x5'))['db'];var utils=require(_0xfcf2('0x6'));var logger=require(_0xfcf2('0x7'))(_0xfcf2('0x8'));var config=require(_0xfcf2('0x9'));var jayson=require(_0xfcf2('0xa'));var client=jayson[_0xfcf2('0xb')][_0xfcf2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41d4bd,_0x157f48,_0x16b6b2){return new BPromise(function(_0x34f444,_0xb4c510){return client[_0xfcf2('0xd')](_0x41d4bd,_0x16b6b2)['then'](function(_0x575f33){logger['info'](_0xfcf2('0xe'),_0x157f48,_0xfcf2('0xf'));logger['debug'](_0xfcf2('0x10'),_0x157f48,_0xfcf2('0xf'),JSON[_0xfcf2('0x11')](_0x575f33));if(_0x575f33[_0xfcf2('0x12')]){if(_0x575f33['error']['code']===0x1f4){logger[_0xfcf2('0x12')](_0xfcf2('0xe'),_0x157f48,_0x575f33[_0xfcf2('0x12')][_0xfcf2('0x13')]);return _0xb4c510(_0x575f33['error'][_0xfcf2('0x13')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x157f48,_0x575f33['error'][_0xfcf2('0x13')]);return _0x34f444(_0x575f33['error'][_0xfcf2('0x13')]);}else{logger[_0xfcf2('0x14')](_0xfcf2('0xe'),_0x157f48,_0xfcf2('0xf'));_0x34f444(_0x575f33[_0xfcf2('0x15')][_0xfcf2('0x13')]);}})[_0xfcf2('0x16')](function(_0x4d64ce){logger[_0xfcf2('0x12')](_0xfcf2('0xe'),_0x157f48,_0x4d64ce);_0xb4c510(_0x4d64ce);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 4aef918..04e9e8f 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(_0x1c2e36,_0x22dc66){var _0x36df5c=function(_0x55150a){while(--_0x55150a){_0x1c2e36['push'](_0x1c2e36['shift']());}};_0x36df5c(++_0x22dc66);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x2b3c79,_0x330855){var _0x165640=function(_0x56eeb2){while(--_0x56eeb2){_0x2b3c79['push'](_0x2b3c79['shift']());}};_0x165640(++_0x330855);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 6016bef..9fdd6c2 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 _0xab26=['STRING','TEXT','sequelize','exports'];(function(_0x470f24,_0x2436a9){var _0x2c6fc8=function(_0x3ef190){while(--_0x3ef190){_0x470f24['push'](_0x470f24['shift']());}};_0x2c6fc8(++_0x2436a9);}(_0xab26,0xd2));var _0x6ab2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xab26[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x6ab2('0x0'));module[_0x6ab2('0x1')]={'name':{'type':Sequelize[_0x6ab2('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x6ab2('0x2')]},'metric':{'type':Sequelize[_0x6ab2('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa71a=['TEXT','sequelize','exports','STRING','name'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa71a,0xf1));var _0xaa71=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa71a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xaa71('0x0'));module[_0xaa71('0x1')]={'name':{'type':Sequelize[_0xaa71('0x2')],'allowNull':![],'unique':_0xaa71('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xaa71('0x4')]},'description':{'type':Sequelize[_0xaa71('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 14a973b..a6539f0 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 _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x105ec7,_0x355e42){_0x105ec7=_0x105ec7-0x0;var _0x3d0930=_0x1cb9[_0x105ec7];return _0x3d0930;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file +var _0xabce=['includeAll','rows','show','params','intersection','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','filter','merge','VIRTUAL','options'];(function(_0x56fdb4,_0x26bc2e){var _0x239659=function(_0x44b5d5){while(--_0x44b5d5){_0x56fdb4['push'](_0x56fdb4['shift']());}};_0x239659(++_0x26bc2e);}(_0xabce,0x103));var _0xeabc=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xabce[_0x4bb66f];return _0xf2772f;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){var _0x480440=_0x319119[_0xeabc('0x26')]({'plain':!![]});var _0x4d4e29=_0xeabc('0x27');return db[_0xeabc('0x28')][_0xeabc('0x29')]({'where':{'type':_0x4d4e29,'resourceId':_0x480440['id']}})[_0xeabc('0x25')](function(){return _0x319119;});})[_0xeabc('0x25')](function(){_0x3854d2[_0xeabc('0x1a')](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4c2693,_0x5b2934){return function(_0x459c8a){if(!_0x459c8a){_0x4c2693['sendStatus'](0x194);}return _0x459c8a;};}function handleError(_0x3c1b5b,_0x2b342c){_0x2b342c=_0x2b342c||0x1f4;return function(_0x48fb52){logger[_0xeabc('0x2a')](_0x48fb52[_0xeabc('0x2b')]);if(_0x48fb52[_0xeabc('0x2c')]){delete _0x48fb52[_0xeabc('0x2c')];}_0x3c1b5b[_0xeabc('0x1a')](_0x2b342c)[_0xeabc('0x2d')](_0x48fb52);};}exports[_0xeabc('0x2e')]=function(_0x38dc0a,_0x2915c1){var _0x5ebb86={},_0x5b34dd={},_0x5bb1f1={'count':0x0,'rows':[]};var _0x2f03e8=_[_0xeabc('0x2f')](db[_0xeabc('0x30')][_0xeabc('0x31')],function(_0x73c8d4){return{'name':_0x73c8d4[_0xeabc('0x32')],'type':_0x73c8d4[_0xeabc('0x33')]['key']};});_0x5b34dd[_0xeabc('0x34')]=_[_0xeabc('0x2f')](_0x2f03e8,_0xeabc('0x2c'));_0x5b34dd['query']=_[_0xeabc('0x35')](_0x38dc0a[_0xeabc('0x36')]);_0x5b34dd[_0xeabc('0x37')]=_['intersection'](_0x5b34dd[_0xeabc('0x34')],_0x5b34dd[_0xeabc('0x36')]);_0x5ebb86[_0xeabc('0x38')]=_['intersection'](_0x5b34dd[_0xeabc('0x34')],qs[_0xeabc('0x39')](_0x38dc0a['query']['fields']));_0x5ebb86[_0xeabc('0x38')]=_0x5ebb86[_0xeabc('0x38')]['length']?_0x5ebb86[_0xeabc('0x38')]:_0x5b34dd[_0xeabc('0x34')];if(!_0x38dc0a[_0xeabc('0x36')][_0xeabc('0x3a')](_0xeabc('0x3b'))){_0x5ebb86['limit']=qs[_0xeabc('0x1d')](_0x38dc0a['query'][_0xeabc('0x1d')]);_0x5ebb86[_0xeabc('0x1f')]=qs[_0xeabc('0x1f')](_0x38dc0a['query']['offset']);}_0x5ebb86[_0xeabc('0x3c')]=qs['sort'](_0x38dc0a[_0xeabc('0x36')]['sort']);_0x5ebb86['where']=qs['filters'](_['pick'](_0x38dc0a[_0xeabc('0x36')],_0x5b34dd['filters']),_0x2f03e8);if(_0x38dc0a[_0xeabc('0x36')][_0xeabc('0x3d')]){_0x5ebb86['where']=_[_0xeabc('0x3e')](_0x5ebb86['where'],{'$or':_[_0xeabc('0x2f')](_0x2f03e8,function(_0x58aafe){if(_0x58aafe[_0xeabc('0x33')]!==_0xeabc('0x3f')){var _0xeeef02={};_0xeeef02[_0x58aafe['name']]={'$like':'%'+_0x38dc0a['query']['filter']+'%'};return _0xeeef02;}})});}_0x5ebb86=_[_0xeabc('0x3e')]({},_0x5ebb86,_0x38dc0a[_0xeabc('0x40')]);var _0xafa59b={'where':_0x5ebb86['where']};return db['AnalyticMetric'][_0xeabc('0x1e')](_0xafa59b)[_0xeabc('0x25')](function(_0x5e9cb3){_0x5bb1f1[_0xeabc('0x1e')]=_0x5e9cb3;if(_0x38dc0a['query'][_0xeabc('0x41')]){_0x5ebb86['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x5ebb86);})[_0xeabc('0x25')](function(_0x37c926){_0x5bb1f1[_0xeabc('0x42')]=_0x37c926;return _0x5bb1f1;})[_0xeabc('0x25')](respondWithFilteredResult(_0x2915c1,_0x5ebb86))['catch'](handleError(_0x2915c1,null));};exports[_0xeabc('0x43')]=function(_0x555d26,_0x7d5add){var _0x1a4bbe={'raw':!![],'where':{'id':_0x555d26[_0xeabc('0x44')]['id']}},_0x3a7807={};_0x3a7807[_0xeabc('0x34')]=_['keys'](db['AnalyticMetric'][_0xeabc('0x31')]);_0x3a7807['query']=_[_0xeabc('0x35')](_0x555d26[_0xeabc('0x36')]);_0x3a7807['filters']=_[_0xeabc('0x45')](_0x3a7807[_0xeabc('0x34')],_0x3a7807[_0xeabc('0x36')]);_0x1a4bbe[_0xeabc('0x38')]=_[_0xeabc('0x45')](_0x3a7807[_0xeabc('0x34')],qs[_0xeabc('0x39')](_0x555d26['query'][_0xeabc('0x39')]));_0x1a4bbe[_0xeabc('0x38')]=_0x1a4bbe[_0xeabc('0x38')][_0xeabc('0x46')]?_0x1a4bbe[_0xeabc('0x38')]:_0x3a7807[_0xeabc('0x34')];if(_0x555d26[_0xeabc('0x36')][_0xeabc('0x41')]){_0x1a4bbe[_0xeabc('0x47')]=[{'all':!![]}];}_0x1a4bbe=_[_0xeabc('0x3e')]({},_0x1a4bbe,_0x555d26['options']);return db[_0xeabc('0x30')][_0xeabc('0x48')](_0x1a4bbe)[_0xeabc('0x25')](handleEntityNotFound(_0x7d5add,null))[_0xeabc('0x25')](respondWithResult(_0x7d5add,null))[_0xeabc('0x49')](handleError(_0x7d5add,null));};exports[_0xeabc('0x4a')]=function(_0x268d95,_0x48df43){return db[_0xeabc('0x30')][_0xeabc('0x4a')](_0x268d95[_0xeabc('0x4b')],{})[_0xeabc('0x25')](function(_0x47440e){var _0x58e2c1=_0x268d95[_0xeabc('0x4c')][_0xeabc('0x26')]({'plain':!![]});if(!_0x58e2c1)throw new Error(_0xeabc('0x4d'));if(_0x58e2c1[_0xeabc('0x4e')]==='user'){var _0x400b82=_0x47440e[_0xeabc('0x26')]({'plain':!![]});var _0x568847=_0xeabc('0x27');return db['UserProfileSection'][_0xeabc('0x48')]({'where':{'name':_0x568847,'userProfileId':_0x58e2c1['userProfileId']},'raw':!![]})[_0xeabc('0x25')](function(_0x2ec94c){if(_0x2ec94c&&_0x2ec94c[_0xeabc('0x4f')]===0x0){return db[_0xeabc('0x28')][_0xeabc('0x4a')]({'name':_0x400b82[_0xeabc('0x2c')],'resourceId':_0x400b82['id'],'type':_0x2ec94c[_0xeabc('0x2c')],'sectionId':_0x2ec94c['id']},{})[_0xeabc('0x25')](function(){return _0x47440e;});}else{return _0x47440e;}})[_0xeabc('0x49')](function(_0x6423f3){logger['error'](_0xeabc('0x50'),_0x6423f3);throw _0x6423f3;});}return _0x47440e;})[_0xeabc('0x25')](respondWithResult(_0x48df43,0xc9))[_0xeabc('0x49')](handleError(_0x48df43,null));};exports[_0xeabc('0x24')]=function(_0x555d6b,_0x1cef45){if(_0x555d6b[_0xeabc('0x4b')]['id']){delete _0x555d6b[_0xeabc('0x4b')]['id'];}return db[_0xeabc('0x30')]['find']({'where':{'id':_0x555d6b[_0xeabc('0x44')]['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x1cef45,null))[_0xeabc('0x25')](saveUpdates(_0x555d6b[_0xeabc('0x4b')],null))[_0xeabc('0x25')](respondWithResult(_0x1cef45,null))[_0xeabc('0x49')](handleError(_0x1cef45,null));};exports[_0xeabc('0x29')]=function(_0x3ff38c,_0x17acf8){return db['AnalyticMetric'][_0xeabc('0x48')]({'where':{'id':_0x3ff38c['params']['id']}})['then'](handleEntityNotFound(_0x17acf8,null))['then'](removeEntity(_0x17acf8,null))[_0xeabc('0x49')](handleError(_0x17acf8,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 7bfbbe6..8e89f31 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 _0x00cd=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash','util'];(function(_0x34ccd2,_0x16fd49){var _0xb0d4b9=function(_0x5294aa){while(--_0x5294aa){_0x34ccd2['push'](_0x34ccd2['shift']());}};_0xb0d4b9(++_0x16fd49);}(_0x00cd,0xee));var _0xd00c=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0x00cd[_0x416cdc];return _0x1931ce;};'use strict';var _=require(_0xd00c('0x0'));var util=require(_0xd00c('0x1'));var logger=require(_0xd00c('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd00c('0x3'));var rp=require(_0xd00c('0x4'));var fs=require('fs');var path=require(_0xd00c('0x5'));var rimraf=require(_0xd00c('0x6'));var config=require(_0xd00c('0x7'));var attributes=require('./analyticMetric.attributes');module[_0xd00c('0x8')]=function(_0xbeac62,_0x2eb6ca){return _0xbeac62[_0xd00c('0x9')](_0xd00c('0xa'),attributes,{'tableName':_0xd00c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x539d=['../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x3c4cae,_0x4f2faf){var _0x2011e7=function(_0x40ffa8){while(--_0x40ffa8){_0x3c4cae['push'](_0x3c4cae['shift']());}};_0x2011e7(++_0x4f2faf);}(_0x539d,0x17b));var _0xd539=function(_0x53e29e,_0x17c540){_0x53e29e=_0x53e29e-0x0;var _0x54c118=_0x539d[_0x53e29e];return _0x54c118;};'use strict';var _=require(_0xd539('0x0'));var util=require('util');var logger=require(_0xd539('0x1'))(_0xd539('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd539('0x3'));var fs=require('fs');var path=require(_0xd539('0x4'));var rimraf=require(_0xd539('0x5'));var config=require(_0xd539('0x6'));var attributes=require(_0xd539('0x7'));module['exports']=function(_0x341dd4,_0x158719){return _0x341dd4[_0xd539('0x8')](_0xd539('0x9'),attributes,{'tableName':_0xd539('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 626c85f..85af4ee 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 _0x156c=['request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x220610,_0x3b80b4){var _0x42f444=function(_0x32aaa2){while(--_0x32aaa2){_0x220610['push'](_0x220610['shift']());}};_0x42f444(++_0x3b80b4);}(_0x156c,0x169));var _0xc156=function(_0x3b3f4f,_0x403216){_0x3b3f4f=_0x3b3f4f-0x0;var _0x174dbe=_0x156c[_0x3b3f4f];return _0x174dbe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc156('0x0'));var BPromise=require(_0xc156('0x1'));var rs=require(_0xc156('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc156('0x3'))['db'];var utils=require(_0xc156('0x4'));var logger=require(_0xc156('0x5'))(_0xc156('0x6'));var config=require(_0xc156('0x7'));var jayson=require(_0xc156('0x8'));var client=jayson[_0xc156('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49bcb8,_0x555998,_0x4cc907){return new BPromise(function(_0x32c0e7,_0x33e720){return client[_0xc156('0xa')](_0x49bcb8,_0x4cc907)['then'](function(_0x31ec5f){logger[_0xc156('0xb')](_0xc156('0xc'),_0x555998,_0xc156('0xd'));logger[_0xc156('0xe')](_0xc156('0xf'),_0x555998,_0xc156('0xd'),JSON[_0xc156('0x10')](_0x31ec5f));if(_0x31ec5f[_0xc156('0x11')]){if(_0x31ec5f[_0xc156('0x11')][_0xc156('0x12')]===0x1f4){logger[_0xc156('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x555998,_0x31ec5f['error']['message']);return _0x33e720(_0x31ec5f[_0xc156('0x11')][_0xc156('0x13')]);}logger['error'](_0xc156('0xc'),_0x555998,_0x31ec5f[_0xc156('0x11')][_0xc156('0x13')]);return _0x32c0e7(_0x31ec5f['error'][_0xc156('0x13')]);}else{logger[_0xc156('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x555998,_0xc156('0xd'));_0x32c0e7(_0x31ec5f[_0xc156('0x14')][_0xc156('0x13')]);}})[_0xc156('0x15')](function(_0x53e550){logger[_0xc156('0x11')](_0xc156('0xc'),_0x555998,_0x53e550);_0x33e720(_0x53e550);});});} \ No newline at end of file +var _0x728a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x1df0a6,_0x5c2cc2){var _0x5cbb65=function(_0x598e7a){while(--_0x598e7a){_0x1df0a6['push'](_0x1df0a6['shift']());}};_0x5cbb65(++_0x5c2cc2);}(_0x728a,0x19d));var _0xa728=function(_0x38250a,_0x137293){_0x38250a=_0x38250a-0x0;var _0x4e6031=_0x728a[_0x38250a];return _0x4e6031;};'use strict';var _=require(_0xa728('0x0'));var util=require(_0xa728('0x1'));var moment=require(_0xa728('0x2'));var BPromise=require(_0xa728('0x3'));var rs=require(_0xa728('0x4'));var fs=require('fs');var Redis=require(_0xa728('0x5'));var db=require(_0xa728('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa728('0x7'));var config=require('../../config/environment');var jayson=require(_0xa728('0x8'));var client=jayson[_0xa728('0x9')][_0xa728('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19bd5d,_0x159510,_0x1a2180){return new BPromise(function(_0x50a4a4,_0x4c3757){return client[_0xa728('0xb')](_0x19bd5d,_0x1a2180)[_0xa728('0xc')](function(_0xc5cd34){logger[_0xa728('0xd')](_0xa728('0xe'),_0x159510,_0xa728('0xf'));logger[_0xa728('0x10')](_0xa728('0x11'),_0x159510,'request\x20sent',JSON[_0xa728('0x12')](_0xc5cd34));if(_0xc5cd34['error']){if(_0xc5cd34[_0xa728('0x13')][_0xa728('0x14')]===0x1f4){logger[_0xa728('0x13')](_0xa728('0xe'),_0x159510,_0xc5cd34['error'][_0xa728('0x15')]);return _0x4c3757(_0xc5cd34['error']['message']);}logger[_0xa728('0x13')](_0xa728('0xe'),_0x159510,_0xc5cd34[_0xa728('0x13')][_0xa728('0x15')]);return _0x50a4a4(_0xc5cd34[_0xa728('0x13')][_0xa728('0x15')]);}else{logger[_0xa728('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x159510,'request\x20sent');_0x50a4a4(_0xc5cd34[_0xa728('0x16')][_0xa728('0x15')]);}})['catch'](function(_0x5d5e72){logger[_0xa728('0x13')](_0xa728('0xe'),_0x159510,_0x5d5e72);_0x4c3757(_0x5d5e72);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 3184036..081092b 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 _0xfdcd=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','util'];(function(_0x4cf8d4,_0x5aee73){var _0x2c1beb=function(_0x39b0a4){while(--_0x39b0a4){_0x4cf8d4['push'](_0x4cf8d4['shift']());}};_0x2c1beb(++_0x5aee73);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfdcd[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xdfdc('0x0'));var path=require(_0xdfdc('0x1'));var timeout=require(_0xdfdc('0x2'));var express=require('express');var router=express[_0xdfdc('0x3')]();var fs_extra=require(_0xdfdc('0x4'));var auth=require(_0xdfdc('0x5'));var interaction=require(_0xdfdc('0x6'));var config=require(_0xdfdc('0x7'));var controller=require(_0xdfdc('0x8'));router[_0xdfdc('0x9')]('/',auth[_0xdfdc('0xa')](),controller[_0xdfdc('0xb')]);router[_0xdfdc('0x9')](_0xdfdc('0xc'),auth[_0xdfdc('0xa')](),controller[_0xdfdc('0xd')]);router['post']('/',auth[_0xdfdc('0xa')](),controller[_0xdfdc('0xe')]);router['put'](_0xdfdc('0xc'),auth[_0xdfdc('0xa')](),controller[_0xdfdc('0xf')]);router[_0xdfdc('0x10')](_0xdfdc('0xc'),auth['isAuthenticated'](),controller[_0xdfdc('0x11')]);module['exports']=router; \ No newline at end of file +var _0xecb2=['show','post','put','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','/:id','isAuthenticated'];(function(_0x543939,_0x411b27){var _0x3b730c=function(_0x201b1a){while(--_0x201b1a){_0x543939['push'](_0x543939['shift']());}};_0x3b730c(++_0x411b27);}(_0xecb2,0xf6));var _0x2ecb=function(_0x3a7e23,_0x4525c7){_0x3a7e23=_0x3a7e23-0x0;var _0x1ef63e=_0xecb2[_0x3a7e23];return _0x1ef63e;};'use strict';var multer=require(_0x2ecb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2ecb('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2ecb('0x2'));var auth=require(_0x2ecb('0x3'));var interaction=require(_0x2ecb('0x4'));var config=require(_0x2ecb('0x5'));var controller=require(_0x2ecb('0x6'));router[_0x2ecb('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2ecb('0x8'),auth[_0x2ecb('0x9')](),controller[_0x2ecb('0xa')]);router[_0x2ecb('0xb')]('/',auth[_0x2ecb('0x9')](),controller['create']);router[_0x2ecb('0xc')](_0x2ecb('0x8'),auth[_0x2ecb('0x9')](),controller['update']);router[_0x2ecb('0xd')](_0x2ecb('0x8'),auth[_0x2ecb('0x9')](),controller[_0x2ecb('0xe')]);module[_0x2ecb('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index f7b1ca3..c563978 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 _0x4ad9=['exports','TEXT'];(function(_0x24807a,_0xd3e063){var _0x3e7b6e=function(_0x2dc99a){while(--_0x2dc99a){_0x24807a['push'](_0x24807a['shift']());}};_0x3e7b6e(++_0xd3e063);}(_0x4ad9,0xde));var _0x94ad=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4ad9[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0x94ad('0x0')]={'tree':{'type':Sequelize[_0x94ad('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5978=['exports','TEXT','sequelize'];(function(_0x252b32,_0x5dedbc){var _0x46269d=function(_0x270d20){while(--_0x270d20){_0x252b32['push'](_0x252b32['shift']());}};_0x46269d(++_0x5dedbc);}(_0x5978,0xdd));var _0x8597=function(_0x5d0ed1,_0x642529){_0x5d0ed1=_0x5d0ed1-0x0;var _0x403e6e=_0x5978[_0x5d0ed1];return _0x403e6e;};'use strict';var Sequelize=require(_0x8597('0x0'));module[_0x8597('0x1')]={'tree':{'type':Sequelize[_0x8597('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 304ab12..b55d370 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 _0x3258=['offset','undefined','limit','count','set','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x3258,0x1b0));var _0x8325=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3258[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8325('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8325('0x1'));var jsonpatch=require(_0x8325('0x2'));var rp=require('request-promise');var moment=require(_0x8325('0x3'));var BPromise=require(_0x8325('0x4'));var Mustache=require('mustache');var util=require(_0x8325('0x5'));var path=require(_0x8325('0x6'));var sox=require(_0x8325('0x7'));var csv=require('to-csv');var ejs=require(_0x8325('0x8'));var fs=require('fs');var fs_extra=require(_0x8325('0x9'));var _=require(_0x8325('0xa'));var squel=require(_0x8325('0xb'));var crypto=require(_0x8325('0xc'));var jsforce=require(_0x8325('0xd'));var deskjs=require(_0x8325('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8325('0xf'));var Papa=require('papaparse');var Redis=require(_0x8325('0x10'));var authService=require(_0x8325('0x11'));var qs=require(_0x8325('0x12'));var as=require(_0x8325('0x13'));var hardwareService=require(_0x8325('0x14'));var logger=require(_0x8325('0x15'))(_0x8325('0x16'));var utils=require(_0x8325('0x17'));var config=require(_0x8325('0x18'));var licenseUtil=require(_0x8325('0x19'));var db=require(_0x8325('0x1a'))['db'];function respondWithStatusCode(_0x45142c,_0x4fe45d){_0x4fe45d=_0x4fe45d||0xcc;return function(_0xf94623){if(_0xf94623){return _0x45142c['sendStatus'](_0x4fe45d);}return _0x45142c[_0x8325('0x1b')](_0x4fe45d)[_0x8325('0x1c')]();};}function respondWithResult(_0x37fcee,_0x45d663){_0x45d663=_0x45d663||0xc8;return function(_0x23b002){if(_0x23b002){return _0x37fcee[_0x8325('0x1b')](_0x45d663)[_0x8325('0x1d')](_0x23b002);}};}function respondWithFilteredResult(_0x3667a3,_0x5582e2){return function(_0x224ab7){if(_0x224ab7){var _0x89c6b3=typeof _0x5582e2[_0x8325('0x1e')]===_0x8325('0x1f')&&typeof _0x5582e2[_0x8325('0x20')]==='undefined';var _0x4d8e02=_0x224ab7[_0x8325('0x21')];var _0x57c4ef=_0x89c6b3?0x0:_0x5582e2['offset'];var _0x4075ce=_0x89c6b3?_0x224ab7['count']:_0x5582e2[_0x8325('0x1e')]+_0x5582e2[_0x8325('0x20')];var _0x3feeab;if(_0x4075ce>=_0x4d8e02){_0x4075ce=_0x4d8e02;_0x3feeab=0xc8;}else{_0x3feeab=0xce;}_0x3667a3['status'](_0x3feeab);return _0x3667a3[_0x8325('0x22')]('Content-Range',_0x57c4ef+'-'+_0x4075ce+'/'+_0x4d8e02)[_0x8325('0x1d')](_0x224ab7);}return null;};}function patchUpdates(_0x5013d5){return function(_0x516121){try{jsonpatch[_0x8325('0x23')](_0x516121,_0x5013d5,!![]);}catch(_0x28073e){return BPromise['reject'](_0x28073e);}return _0x516121[_0x8325('0x24')]();};}function saveUpdates(_0x222087,_0xce37e1){return function(_0x138053){if(_0x138053){return _0x138053['update'](_0x222087)[_0x8325('0x25')](function(_0x4a503e){return _0x4a503e;});}return null;};}function removeEntity(_0x23c87f,_0x267f83){return function(_0x3c720a){if(_0x3c720a){return _0x3c720a[_0x8325('0x26')]()[_0x8325('0x25')](function(){_0x23c87f[_0x8325('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x479ea9,_0x2e4adb){return function(_0x9d19b7){if(!_0x9d19b7){_0x479ea9[_0x8325('0x27')](0x194);}return _0x9d19b7;};}function handleError(_0x23f5f6,_0x3febb6){_0x3febb6=_0x3febb6||0x1f4;return function(_0x1cdb22){logger[_0x8325('0x28')](_0x1cdb22[_0x8325('0x29')]);if(_0x1cdb22['name']){delete _0x1cdb22[_0x8325('0x2a')];}_0x23f5f6[_0x8325('0x1b')](_0x3febb6)[_0x8325('0x2b')](_0x1cdb22);};}exports[_0x8325('0x2c')]=function(_0xf7de83,_0xfa6b16){var _0x2d6685={},_0x2bcebb={},_0x5bbfa8={'count':0x0,'rows':[]};var _0x136a00=_[_0x8325('0x2d')](db[_0x8325('0x2e')][_0x8325('0x2f')],function(_0x3b9306){return{'name':_0x3b9306[_0x8325('0x30')],'type':_0x3b9306[_0x8325('0x31')][_0x8325('0x32')]};});_0x2bcebb[_0x8325('0x33')]=_[_0x8325('0x2d')](_0x136a00,_0x8325('0x2a'));_0x2bcebb[_0x8325('0x34')]=_['keys'](_0xf7de83[_0x8325('0x34')]);_0x2bcebb[_0x8325('0x35')]=_['intersection'](_0x2bcebb['model'],_0x2bcebb[_0x8325('0x34')]);_0x2d6685[_0x8325('0x36')]=_[_0x8325('0x37')](_0x2bcebb['model'],qs[_0x8325('0x38')](_0xf7de83[_0x8325('0x34')][_0x8325('0x38')]));_0x2d6685[_0x8325('0x36')]=_0x2d6685['attributes'][_0x8325('0x39')]?_0x2d6685[_0x8325('0x36')]:_0x2bcebb['model'];if(!_0xf7de83[_0x8325('0x34')][_0x8325('0x3a')](_0x8325('0x3b'))){_0x2d6685[_0x8325('0x20')]=qs[_0x8325('0x20')](_0xf7de83[_0x8325('0x34')][_0x8325('0x20')]);_0x2d6685['offset']=qs[_0x8325('0x1e')](_0xf7de83[_0x8325('0x34')]['offset']);}_0x2d6685[_0x8325('0x3c')]=qs[_0x8325('0x3d')](_0xf7de83['query']['sort']);_0x2d6685[_0x8325('0x3e')]=qs['filters'](_['pick'](_0xf7de83[_0x8325('0x34')],_0x2bcebb[_0x8325('0x35')]),_0x136a00);if(_0xf7de83[_0x8325('0x34')][_0x8325('0x3f')]){_0x2d6685[_0x8325('0x3e')]=_[_0x8325('0x40')](_0x2d6685[_0x8325('0x3e')],{'$or':_[_0x8325('0x2d')](_0x136a00,function(_0x451442){if(_0x451442['type']!==_0x8325('0x41')){var _0x1106a7={};_0x1106a7[_0x451442[_0x8325('0x2a')]]={'$like':'%'+_0xf7de83['query'][_0x8325('0x3f')]+'%'};return _0x1106a7;}})});}_0x2d6685=_[_0x8325('0x40')]({},_0x2d6685,_0xf7de83['options']);var _0x35be97={'where':_0x2d6685[_0x8325('0x3e')]};return db[_0x8325('0x2e')][_0x8325('0x21')](_0x35be97)['then'](function(_0x26fecd){_0x5bbfa8['count']=_0x26fecd;if(_0xf7de83[_0x8325('0x34')]['includeAll']){_0x2d6685[_0x8325('0x42')]=[{'all':!![]}];}return db[_0x8325('0x2e')][_0x8325('0x43')](_0x2d6685);})[_0x8325('0x25')](function(_0x30794e){_0x5bbfa8[_0x8325('0x44')]=_0x30794e;return _0x5bbfa8;})[_0x8325('0x25')](respondWithFilteredResult(_0xfa6b16,_0x2d6685))[_0x8325('0x45')](handleError(_0xfa6b16,null));};exports[_0x8325('0x46')]=function(_0x5b4281,_0x58ac60){var _0x5ee328={'raw':!![],'where':{'id':_0x5b4281[_0x8325('0x47')]['id']}},_0x48f55c={};_0x48f55c[_0x8325('0x33')]=_[_0x8325('0x48')](db[_0x8325('0x2e')]['rawAttributes']);_0x48f55c[_0x8325('0x34')]=_[_0x8325('0x48')](_0x5b4281[_0x8325('0x34')]);_0x48f55c[_0x8325('0x35')]=_[_0x8325('0x37')](_0x48f55c[_0x8325('0x33')],_0x48f55c[_0x8325('0x34')]);_0x5ee328[_0x8325('0x36')]=_[_0x8325('0x37')](_0x48f55c[_0x8325('0x33')],qs[_0x8325('0x38')](_0x5b4281[_0x8325('0x34')][_0x8325('0x38')]));_0x5ee328[_0x8325('0x36')]=_0x5ee328['attributes'][_0x8325('0x39')]?_0x5ee328[_0x8325('0x36')]:_0x48f55c[_0x8325('0x33')];if(_0x5b4281[_0x8325('0x34')][_0x8325('0x49')]){_0x5ee328[_0x8325('0x42')]=[{'all':!![]}];}_0x5ee328=_[_0x8325('0x40')]({},_0x5ee328,_0x5b4281['options']);return db[_0x8325('0x2e')][_0x8325('0x4a')](_0x5ee328)[_0x8325('0x25')](handleEntityNotFound(_0x58ac60,null))[_0x8325('0x25')](respondWithResult(_0x58ac60,null))['catch'](handleError(_0x58ac60,null));};exports[_0x8325('0x4b')]=function(_0x10300b,_0x544d44){return db['AnalyticTreeReport']['create'](_0x10300b[_0x8325('0x4c')],{})[_0x8325('0x25')](respondWithResult(_0x544d44,0xc9))[_0x8325('0x45')](handleError(_0x544d44,null));};exports['update']=function(_0xf72b3e,_0x5f221a){if(_0xf72b3e[_0x8325('0x4c')]['id']){delete _0xf72b3e[_0x8325('0x4c')]['id'];}return db[_0x8325('0x2e')][_0x8325('0x4a')]({'where':{'id':_0xf72b3e[_0x8325('0x47')]['id']}})['then'](handleEntityNotFound(_0x5f221a,null))[_0x8325('0x25')](saveUpdates(_0xf72b3e[_0x8325('0x4c')],null))[_0x8325('0x25')](respondWithResult(_0x5f221a,null))[_0x8325('0x45')](handleError(_0x5f221a,null));};exports['destroy']=function(_0x29182d,_0x236efa){return db[_0x8325('0x2e')][_0x8325('0x4a')]({'where':{'id':_0x29182d[_0x8325('0x47')]['id']}})[_0x8325('0x25')](handleEntityNotFound(_0x236efa,null))['then'](removeEntity(_0x236efa,null))['catch'](handleError(_0x236efa,null));}; \ No newline at end of file +var _0x8885=['save','update','then','destroy','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','length','catch','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x28e7e1,_0x45f235){var _0x1d8a9e=function(_0x3e50cc){while(--_0x3e50cc){_0x28e7e1['push'](_0x28e7e1['shift']());}};_0x1d8a9e(++_0x45f235);}(_0x8885,0xcb));var _0x5888=function(_0x5bebcf,_0x1feaef){_0x5bebcf=_0x5bebcf-0x0;var _0x46249a=_0x8885[_0x5bebcf];return _0x46249a;};'use strict';var emlformat=require(_0x5888('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5888('0x1'));var jsonpatch=require(_0x5888('0x2'));var rp=require(_0x5888('0x3'));var moment=require(_0x5888('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5888('0x5'));var util=require(_0x5888('0x6'));var path=require(_0x5888('0x7'));var sox=require(_0x5888('0x8'));var csv=require(_0x5888('0x9'));var ejs=require(_0x5888('0xa'));var fs=require('fs');var fs_extra=require(_0x5888('0xb'));var _=require(_0x5888('0xc'));var squel=require(_0x5888('0xd'));var crypto=require(_0x5888('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5888('0xf'));var toCsv=require(_0x5888('0x9'));var querystring=require(_0x5888('0x10'));var Papa=require(_0x5888('0x11'));var Redis=require(_0x5888('0x12'));var authService=require(_0x5888('0x13'));var qs=require(_0x5888('0x14'));var as=require(_0x5888('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5888('0x16'))(_0x5888('0x17'));var utils=require(_0x5888('0x18'));var config=require(_0x5888('0x19'));var licenseUtil=require(_0x5888('0x1a'));var db=require(_0x5888('0x1b'))['db'];function respondWithStatusCode(_0x42fa86,_0x43e61f){_0x43e61f=_0x43e61f||0xcc;return function(_0x141938){if(_0x141938){return _0x42fa86[_0x5888('0x1c')](_0x43e61f);}return _0x42fa86[_0x5888('0x1d')](_0x43e61f)[_0x5888('0x1e')]();};}function respondWithResult(_0x1a49ca,_0x4a79b4){_0x4a79b4=_0x4a79b4||0xc8;return function(_0x3f985f){if(_0x3f985f){return _0x1a49ca[_0x5888('0x1d')](_0x4a79b4)[_0x5888('0x1f')](_0x3f985f);}};}function respondWithFilteredResult(_0x3ca556,_0x3e6d68){return function(_0x41d158){if(_0x41d158){var _0x2ae7f1=typeof _0x3e6d68[_0x5888('0x20')]===_0x5888('0x21')&&typeof _0x3e6d68[_0x5888('0x22')]==='undefined';var _0x108739=_0x41d158[_0x5888('0x23')];var _0x248a11=_0x2ae7f1?0x0:_0x3e6d68[_0x5888('0x20')];var _0x3fab03=_0x2ae7f1?_0x41d158[_0x5888('0x23')]:_0x3e6d68[_0x5888('0x20')]+_0x3e6d68[_0x5888('0x22')];var _0x2f76e7;if(_0x3fab03>=_0x108739){_0x3fab03=_0x108739;_0x2f76e7=0xc8;}else{_0x2f76e7=0xce;}_0x3ca556[_0x5888('0x1d')](_0x2f76e7);return _0x3ca556[_0x5888('0x24')](_0x5888('0x25'),_0x248a11+'-'+_0x3fab03+'/'+_0x108739)[_0x5888('0x1f')](_0x41d158);}return null;};}function patchUpdates(_0x3687a8){return function(_0x389996){try{jsonpatch[_0x5888('0x26')](_0x389996,_0x3687a8,!![]);}catch(_0x4c0305){return BPromise[_0x5888('0x27')](_0x4c0305);}return _0x389996[_0x5888('0x28')]();};}function saveUpdates(_0x2d0ebf,_0x492f08){return function(_0x2ea124){if(_0x2ea124){return _0x2ea124[_0x5888('0x29')](_0x2d0ebf)[_0x5888('0x2a')](function(_0x4fe3a2){return _0x4fe3a2;});}return null;};}function removeEntity(_0x8ad01,_0x11c3e0){return function(_0x304c0d){if(_0x304c0d){return _0x304c0d[_0x5888('0x2b')]()['then'](function(){_0x8ad01['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x420445,_0x2d6244){return function(_0x496b52){if(!_0x496b52){_0x420445[_0x5888('0x1c')](0x194);}return _0x496b52;};}function handleError(_0x40e5a6,_0xe4b8fe){_0xe4b8fe=_0xe4b8fe||0x1f4;return function(_0x32a119){logger[_0x5888('0x2c')](_0x32a119[_0x5888('0x2d')]);if(_0x32a119[_0x5888('0x2e')]){delete _0x32a119[_0x5888('0x2e')];}_0x40e5a6[_0x5888('0x1d')](_0xe4b8fe)['send'](_0x32a119);};}exports[_0x5888('0x2f')]=function(_0x23080c,_0x108b6e){var _0x27d2d6={},_0x5f3223={},_0x1b9378={'count':0x0,'rows':[]};var _0x495312=_[_0x5888('0x30')](db[_0x5888('0x31')][_0x5888('0x32')],function(_0x443569){return{'name':_0x443569[_0x5888('0x33')],'type':_0x443569['type'][_0x5888('0x34')]};});_0x5f3223[_0x5888('0x35')]=_[_0x5888('0x30')](_0x495312,_0x5888('0x2e'));_0x5f3223[_0x5888('0x36')]=_[_0x5888('0x37')](_0x23080c['query']);_0x5f3223[_0x5888('0x38')]=_[_0x5888('0x39')](_0x5f3223['model'],_0x5f3223[_0x5888('0x36')]);_0x27d2d6[_0x5888('0x3a')]=_[_0x5888('0x39')](_0x5f3223[_0x5888('0x35')],qs[_0x5888('0x3b')](_0x23080c['query']['fields']));_0x27d2d6[_0x5888('0x3a')]=_0x27d2d6[_0x5888('0x3a')]['length']?_0x27d2d6['attributes']:_0x5f3223[_0x5888('0x35')];if(!_0x23080c[_0x5888('0x36')][_0x5888('0x3c')](_0x5888('0x3d'))){_0x27d2d6['limit']=qs[_0x5888('0x22')](_0x23080c[_0x5888('0x36')][_0x5888('0x22')]);_0x27d2d6[_0x5888('0x20')]=qs[_0x5888('0x20')](_0x23080c[_0x5888('0x36')]['offset']);}_0x27d2d6[_0x5888('0x3e')]=qs[_0x5888('0x3f')](_0x23080c['query'][_0x5888('0x3f')]);_0x27d2d6[_0x5888('0x40')]=qs[_0x5888('0x38')](_['pick'](_0x23080c[_0x5888('0x36')],_0x5f3223['filters']),_0x495312);if(_0x23080c['query']['filter']){_0x27d2d6['where']=_['merge'](_0x27d2d6[_0x5888('0x40')],{'$or':_[_0x5888('0x30')](_0x495312,function(_0x48f58c){if(_0x48f58c[_0x5888('0x41')]!==_0x5888('0x42')){var _0x18673d={};_0x18673d[_0x48f58c[_0x5888('0x2e')]]={'$like':'%'+_0x23080c[_0x5888('0x36')][_0x5888('0x43')]+'%'};return _0x18673d;}})});}_0x27d2d6=_[_0x5888('0x44')]({},_0x27d2d6,_0x23080c[_0x5888('0x45')]);var _0x4e634f={'where':_0x27d2d6['where']};return db[_0x5888('0x31')][_0x5888('0x23')](_0x4e634f)[_0x5888('0x2a')](function(_0x39a23f){_0x1b9378[_0x5888('0x23')]=_0x39a23f;if(_0x23080c[_0x5888('0x36')][_0x5888('0x46')]){_0x27d2d6[_0x5888('0x47')]=[{'all':!![]}];}return db[_0x5888('0x31')][_0x5888('0x48')](_0x27d2d6);})[_0x5888('0x2a')](function(_0x2e4da0){_0x1b9378[_0x5888('0x49')]=_0x2e4da0;return _0x1b9378;})[_0x5888('0x2a')](respondWithFilteredResult(_0x108b6e,_0x27d2d6))['catch'](handleError(_0x108b6e,null));};exports[_0x5888('0x4a')]=function(_0x105192,_0x845f64){var _0x44de43={'raw':!![],'where':{'id':_0x105192[_0x5888('0x4b')]['id']}},_0x5f1307={};_0x5f1307[_0x5888('0x35')]=_['keys'](db[_0x5888('0x31')]['rawAttributes']);_0x5f1307['query']=_[_0x5888('0x37')](_0x105192[_0x5888('0x36')]);_0x5f1307['filters']=_[_0x5888('0x39')](_0x5f1307[_0x5888('0x35')],_0x5f1307['query']);_0x44de43['attributes']=_[_0x5888('0x39')](_0x5f1307[_0x5888('0x35')],qs['fields'](_0x105192[_0x5888('0x36')]['fields']));_0x44de43['attributes']=_0x44de43[_0x5888('0x3a')][_0x5888('0x4c')]?_0x44de43[_0x5888('0x3a')]:_0x5f1307[_0x5888('0x35')];if(_0x105192[_0x5888('0x36')][_0x5888('0x46')]){_0x44de43[_0x5888('0x47')]=[{'all':!![]}];}_0x44de43=_['merge']({},_0x44de43,_0x105192[_0x5888('0x45')]);return db['AnalyticTreeReport']['find'](_0x44de43)[_0x5888('0x2a')](handleEntityNotFound(_0x845f64,null))[_0x5888('0x2a')](respondWithResult(_0x845f64,null))[_0x5888('0x4d')](handleError(_0x845f64,null));};exports[_0x5888('0x4e')]=function(_0x1569c3,_0x446875){return db[_0x5888('0x31')][_0x5888('0x4e')](_0x1569c3[_0x5888('0x4f')],{})[_0x5888('0x2a')](respondWithResult(_0x446875,0xc9))[_0x5888('0x4d')](handleError(_0x446875,null));};exports[_0x5888('0x29')]=function(_0xd7d1b9,_0xc4cc8a){if(_0xd7d1b9[_0x5888('0x4f')]['id']){delete _0xd7d1b9['body']['id'];}return db[_0x5888('0x31')][_0x5888('0x50')]({'where':{'id':_0xd7d1b9[_0x5888('0x4b')]['id']}})[_0x5888('0x2a')](handleEntityNotFound(_0xc4cc8a,null))[_0x5888('0x2a')](saveUpdates(_0xd7d1b9[_0x5888('0x4f')],null))['then'](respondWithResult(_0xc4cc8a,null))[_0x5888('0x4d')](handleError(_0xc4cc8a,null));};exports[_0x5888('0x2b')]=function(_0x38ed2b,_0x2ba03b){return db[_0x5888('0x31')][_0x5888('0x50')]({'where':{'id':_0x38ed2b[_0x5888('0x4b')]['id']}})[_0x5888('0x2a')](handleEntityNotFound(_0x2ba03b,null))[_0x5888('0x2a')](removeEntity(_0x2ba03b,null))[_0x5888('0x4d')](handleError(_0x2ba03b,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 28ecb12..a2f4f81 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 _0x9e8c=['analytics_report_trees','util','../../config/logger','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x9e8c,0xf4));var _0xc9e8=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x9e8c[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require(_0xc9e8('0x0'));var logger=require(_0xc9e8('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc9e8('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc9e8('0x3'));var config=require(_0xc9e8('0x4'));var attributes=require(_0xc9e8('0x5'));module[_0xc9e8('0x6')]=function(_0x4b2a9b,_0x45bedb){return _0x4b2a9b['define'](_0xc9e8('0x7'),attributes,{'tableName':_0xc9e8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ae4=['exports','define','AnalyticTreeReport','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x6ae4,0xdb));var _0x46ae=function(_0x3ea42b,_0x1bf15e){_0x3ea42b=_0x3ea42b-0x0;var _0x3f3a89=_0x6ae4[_0x3ea42b];return _0x3f3a89;};'use strict';var _=require('lodash');var util=require(_0x46ae('0x0'));var logger=require(_0x46ae('0x1'))(_0x46ae('0x2'));var moment=require(_0x46ae('0x3'));var BPromise=require(_0x46ae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x46ae('0x5'));var rimraf=require(_0x46ae('0x6'));var config=require(_0x46ae('0x7'));var attributes=require(_0x46ae('0x8'));module[_0x46ae('0x9')]=function(_0x1ab258,_0x43e145){return _0x1ab258[_0x46ae('0xa')](_0x46ae('0xb'),attributes,{'tableName':'analytics_report_trees','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 348f233..169939a 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4ec90d,_0x5f80cb){var _0x371da6=function(_0x186a68){while(--_0x186a68){_0x4ec90d['push'](_0x4ec90d['shift']());}};_0x371da6(++_0x5f80cb);}(_0xadb5,0xad));var _0x5adb=function(_0x49f82c,_0x236730){_0x49f82c=_0x49f82c-0x0;var _0x4b6c4f=_0xadb5[_0x49f82c];return _0x4b6c4f;};'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']('AnalyticTreeReport,\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 _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(_0x11be6b,_0x5b88c6){var _0x59aebf=function(_0x9e98fe){while(--_0x9e98fe){_0x11be6b['push'](_0x11be6b['shift']());}};_0x59aebf(++_0x5b88c6);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc4aa[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 3b1d136..90ca248 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 _0xdaf3=['/:id','create','delete','destroy','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index'];(function(_0x320eba,_0xe8fa16){var _0x1e0b55=function(_0x22ef01){while(--_0x22ef01){_0x320eba['push'](_0x320eba['shift']());}};_0x1e0b55(++_0xe8fa16);}(_0xdaf3,0x10e));var _0x3daf=function(_0x48105b,_0x266487){_0x48105b=_0x48105b-0x0;var _0x1ca419=_0xdaf3[_0x48105b];return _0x1ca419;};'use strict';var multer=require(_0x3daf('0x0'));var util=require('util');var path=require(_0x3daf('0x1'));var timeout=require(_0x3daf('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3daf('0x3'));var interaction=require(_0x3daf('0x4'));var config=require(_0x3daf('0x5'));var controller=require(_0x3daf('0x6'));router[_0x3daf('0x7')]('/',auth[_0x3daf('0x8')](),controller[_0x3daf('0x9')]);router[_0x3daf('0x7')](_0x3daf('0xa'),auth[_0x3daf('0x8')](),controller['show']);router['post']('/',auth[_0x3daf('0x8')](),controller[_0x3daf('0xb')]);router['put'](_0x3daf('0xa'),auth[_0x3daf('0x8')](),controller['update']);router[_0x3daf('0xc')](_0x3daf('0xa'),auth['isAuthenticated'](),controller[_0x3daf('0xd')]);module['exports']=router; \ No newline at end of file +var _0x4342=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','show','post','create','update','delete','/:id','destroy','exports','multer','util'];(function(_0x36665f,_0x4f9488){var _0x481d25=function(_0x3779cc){while(--_0x3779cc){_0x36665f['push'](_0x36665f['shift']());}};_0x481d25(++_0x4f9488);}(_0x4342,0xee));var _0x2434=function(_0x1e1b5a,_0x13b534){_0x1e1b5a=_0x1e1b5a-0x0;var _0x3206db=_0x4342[_0x1e1b5a];return _0x3206db;};'use strict';var multer=require(_0x2434('0x0'));var util=require(_0x2434('0x1'));var path=require(_0x2434('0x2'));var timeout=require(_0x2434('0x3'));var express=require('express');var router=express[_0x2434('0x4')]();var fs_extra=require(_0x2434('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2434('0x6'));var config=require(_0x2434('0x7'));var controller=require(_0x2434('0x8'));router['get']('/',auth[_0x2434('0x9')](),controller[_0x2434('0xa')]);router[_0x2434('0xb')]('/:id',auth[_0x2434('0x9')](),controller[_0x2434('0xc')]);router[_0x2434('0xd')]('/',auth[_0x2434('0x9')](),controller[_0x2434('0xe')]);router['put']('/:id',auth[_0x2434('0x9')](),controller[_0x2434('0xf')]);router[_0x2434('0x10')](_0x2434('0x11'),auth['isAuthenticated'](),controller[_0x2434('0x12')]);module[_0x2434('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 2ff5e42..62d9118 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 _0x795a=['exports','STRING'];(function(_0x3b85c2,_0x50d623){var _0x48a40d=function(_0x7283d){while(--_0x7283d){_0x3b85c2['push'](_0x3b85c2['shift']());}};_0x48a40d(++_0x50d623);}(_0x795a,0xa2));var _0xa795=function(_0x3875b7,_0x12fba0){_0x3875b7=_0x3875b7-0x0;var _0xb82766=_0x795a[_0x3875b7];return _0xb82766;};'use strict';var Sequelize=require('sequelize');module[_0xa795('0x0')]={'name':{'type':Sequelize[_0xa795('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa795('0x1')]}}; \ No newline at end of file +var _0xb26e=['STRING','sequelize'];(function(_0x3d4ef1,_0x5a957c){var _0x409423=function(_0x1ab129){while(--_0x1ab129){_0x3d4ef1['push'](_0x3d4ef1['shift']());}};_0x409423(++_0x5a957c);}(_0xb26e,0x11d));var _0xeb26=function(_0x26a12e,_0x25d1b5){_0x26a12e=_0x26a12e-0x0;var _0x4a09d1=_0xb26e[_0x26a12e];return _0x4a09d1;};'use strict';var Sequelize=require(_0xeb26('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xeb26('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 3167dfd..cf6cf44 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 _0x1738=['omit','createdAt','body','updatedAt','create','params','originalname','basename','file','mimetype','download','findOne','ChatOfflineMessageId','join','root','offline-chat/','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','index','map','Attachment','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','show','rawAttributes','includeAll','find','clone','get'];(function(_0x570fba,_0x608b7a){var _0x493632=function(_0xd9ae50){while(--_0xd9ae50){_0x570fba['push'](_0x570fba['shift']());}};_0x493632(++_0x608b7a);}(_0x1738,0x1d2));var _0x8173=function(_0x11c3d7,_0x4d9e67){_0x11c3d7=_0x11c3d7-0x0;var _0x4d37b0=_0x1738[_0x11c3d7];return _0x4d37b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8173('0x0'));var zipdir=require(_0x8173('0x1'));var jsonpatch=require(_0x8173('0x2'));var rp=require(_0x8173('0x3'));var moment=require(_0x8173('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8173('0x5'));var util=require(_0x8173('0x6'));var path=require(_0x8173('0x7'));var sox=require('sox');var csv=require(_0x8173('0x8'));var ejs=require(_0x8173('0x9'));var fs=require('fs');var fs_extra=require(_0x8173('0xa'));var _=require(_0x8173('0xb'));var squel=require('squel');var crypto=require(_0x8173('0xc'));var jsforce=require(_0x8173('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8173('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8173('0xe'));var qs=require(_0x8173('0xf'));var as=require(_0x8173('0x10'));var hardwareService=require(_0x8173('0x11'));var logger=require('../../config/logger')(_0x8173('0x12'));var utils=require(_0x8173('0x13'));var config=require(_0x8173('0x14'));var licenseUtil=require(_0x8173('0x15'));var db=require(_0x8173('0x16'))['db'];function respondWithStatusCode(_0x2a62a3,_0x20bcae){_0x20bcae=_0x20bcae||0xcc;return function(_0x3b04ba){if(_0x3b04ba){return _0x2a62a3[_0x8173('0x17')](_0x20bcae);}return _0x2a62a3[_0x8173('0x18')](_0x20bcae)['end']();};}function respondWithResult(_0x11491d,_0x2d7476){_0x2d7476=_0x2d7476||0xc8;return function(_0x2b657e){if(_0x2b657e){return _0x11491d[_0x8173('0x18')](_0x2d7476)[_0x8173('0x19')](_0x2b657e);}};}function respondWithFilteredResult(_0x41b5ce,_0x405b5e){return function(_0x17f6f0){if(_0x17f6f0){var _0x1079de=typeof _0x405b5e[_0x8173('0x1a')]===_0x8173('0x1b')&&typeof _0x405b5e[_0x8173('0x1c')]===_0x8173('0x1b');var _0x4d555e=_0x17f6f0[_0x8173('0x1d')];var _0x162a53=_0x1079de?0x0:_0x405b5e[_0x8173('0x1a')];var _0x36a905=_0x1079de?_0x17f6f0[_0x8173('0x1d')]:_0x405b5e['offset']+_0x405b5e['limit'];var _0x50de76;if(_0x36a905>=_0x4d555e){_0x36a905=_0x4d555e;_0x50de76=0xc8;}else{_0x50de76=0xce;}_0x41b5ce[_0x8173('0x18')](_0x50de76);return _0x41b5ce[_0x8173('0x1e')](_0x8173('0x1f'),_0x162a53+'-'+_0x36a905+'/'+_0x4d555e)[_0x8173('0x19')](_0x17f6f0);}return null;};}function patchUpdates(_0x2a92f4){return function(_0x1f39d5){try{jsonpatch[_0x8173('0x20')](_0x1f39d5,_0x2a92f4,!![]);}catch(_0x480d2e){return BPromise[_0x8173('0x21')](_0x480d2e);}return _0x1f39d5['save']();};}function saveUpdates(_0x30bc7b,_0xc9088d){return function(_0x138939){if(_0x138939){return _0x138939[_0x8173('0x22')](_0x30bc7b)['then'](function(_0xb3594){return _0xb3594;});}return null;};}function removeEntity(_0xc371f2,_0x13d7b6){return function(_0x46c84b){if(_0x46c84b){return _0x46c84b[_0x8173('0x23')]()[_0x8173('0x24')](function(){_0xc371f2[_0x8173('0x18')](0xcc)[_0x8173('0x25')]();});}};}function handleEntityNotFound(_0x535b90,_0x4e1697){return function(_0x40806d){if(!_0x40806d){_0x535b90['sendStatus'](0x194);}return _0x40806d;};}function handleError(_0x4df437,_0x154241){_0x154241=_0x154241||0x1f4;return function(_0xb114f){logger[_0x8173('0x26')](_0xb114f[_0x8173('0x27')]);if(_0xb114f[_0x8173('0x28')]){delete _0xb114f[_0x8173('0x28')];}_0x4df437['status'](_0x154241)[_0x8173('0x29')](_0xb114f);};}exports[_0x8173('0x2a')]=function(_0x1c9af4,_0x7929c6){var _0x33e25f={},_0xf59f60={},_0x51ad6a={'count':0x0,'rows':[]};var _0x2d3a00=_[_0x8173('0x2b')](db[_0x8173('0x2c')]['rawAttributes'],function(_0x5aa431){return{'name':_0x5aa431[_0x8173('0x2d')],'type':_0x5aa431[_0x8173('0x2e')][_0x8173('0x2f')]};});_0xf59f60[_0x8173('0x30')]=_['map'](_0x2d3a00,_0x8173('0x28'));_0xf59f60[_0x8173('0x31')]=_[_0x8173('0x32')](_0x1c9af4['query']);_0xf59f60[_0x8173('0x33')]=_[_0x8173('0x34')](_0xf59f60[_0x8173('0x30')],_0xf59f60['query']);_0x33e25f[_0x8173('0x35')]=_[_0x8173('0x34')](_0xf59f60[_0x8173('0x30')],qs[_0x8173('0x36')](_0x1c9af4[_0x8173('0x31')][_0x8173('0x36')]));_0x33e25f[_0x8173('0x35')]=_0x33e25f[_0x8173('0x35')][_0x8173('0x37')]?_0x33e25f[_0x8173('0x35')]:_0xf59f60[_0x8173('0x30')];if(!_0x1c9af4[_0x8173('0x31')][_0x8173('0x38')](_0x8173('0x39'))){_0x33e25f[_0x8173('0x1c')]=qs[_0x8173('0x1c')](_0x1c9af4[_0x8173('0x31')]['limit']);_0x33e25f[_0x8173('0x1a')]=qs[_0x8173('0x1a')](_0x1c9af4[_0x8173('0x31')]['offset']);}_0x33e25f[_0x8173('0x3a')]=qs['sort'](_0x1c9af4['query'][_0x8173('0x3b')]);_0x33e25f[_0x8173('0x3c')]=qs[_0x8173('0x33')](_['pick'](_0x1c9af4['query'],_0xf59f60['filters']),_0x2d3a00);if(_0x1c9af4[_0x8173('0x31')][_0x8173('0x3d')]){_0x33e25f[_0x8173('0x3c')]=_[_0x8173('0x3e')](_0x33e25f[_0x8173('0x3c')],{'$or':_[_0x8173('0x2b')](_0x2d3a00,function(_0x4301f6){if(_0x4301f6['type']!==_0x8173('0x3f')){var _0x932d5d={};_0x932d5d[_0x4301f6['name']]={'$like':'%'+_0x1c9af4['query'][_0x8173('0x3d')]+'%'};return _0x932d5d;}})});}_0x33e25f=_[_0x8173('0x3e')]({},_0x33e25f,_0x1c9af4[_0x8173('0x40')]);var _0x2ab4c4={'where':_0x33e25f[_0x8173('0x3c')]};return db[_0x8173('0x2c')][_0x8173('0x1d')](_0x2ab4c4)[_0x8173('0x24')](function(_0x2dc707){_0x51ad6a[_0x8173('0x1d')]=_0x2dc707;if(_0x1c9af4[_0x8173('0x31')]['includeAll']){_0x33e25f[_0x8173('0x41')]=[{'all':!![]}];}return db[_0x8173('0x2c')]['findAll'](_0x33e25f);})[_0x8173('0x24')](function(_0x423999){_0x51ad6a[_0x8173('0x42')]=_0x423999;return _0x51ad6a;})[_0x8173('0x24')](respondWithFilteredResult(_0x7929c6,_0x33e25f))[_0x8173('0x43')](handleError(_0x7929c6,null));};exports[_0x8173('0x44')]=function(_0x16a15f,_0x448d34){var _0x4c3701={'raw':!![],'where':{'id':_0x16a15f['params']['id']}},_0x241113={};_0x241113[_0x8173('0x30')]=_[_0x8173('0x32')](db[_0x8173('0x2c')][_0x8173('0x45')]);_0x241113['query']=_[_0x8173('0x32')](_0x16a15f['query']);_0x241113['filters']=_['intersection'](_0x241113[_0x8173('0x30')],_0x241113['query']);_0x4c3701[_0x8173('0x35')]=_[_0x8173('0x34')](_0x241113[_0x8173('0x30')],qs[_0x8173('0x36')](_0x16a15f['query'][_0x8173('0x36')]));_0x4c3701[_0x8173('0x35')]=_0x4c3701[_0x8173('0x35')][_0x8173('0x37')]?_0x4c3701[_0x8173('0x35')]:_0x241113[_0x8173('0x30')];if(_0x16a15f[_0x8173('0x31')][_0x8173('0x46')]){_0x4c3701['include']=[{'all':!![]}];}_0x4c3701=_[_0x8173('0x3e')]({},_0x4c3701,_0x16a15f[_0x8173('0x40')]);return db[_0x8173('0x2c')][_0x8173('0x47')](_0x4c3701)[_0x8173('0x24')](handleEntityNotFound(_0x448d34,null))[_0x8173('0x24')](respondWithResult(_0x448d34,null))['catch'](handleError(_0x448d34,null));};exports[_0x8173('0x48')]=function(_0x2f295e,_0xaa3390){var _0x555390={'where':{'id':_0x2f295e['params']['id']}},_0x113cdb={};_0x113cdb[_0x8173('0x30')]=_[_0x8173('0x32')](db[_0x8173('0x2c')][_0x8173('0x45')]);_0x555390[_0x8173('0x35')]=_[_0x8173('0x34')](_0x113cdb[_0x8173('0x30')],qs[_0x8173('0x36')](_0x2f295e[_0x8173('0x31')][_0x8173('0x36')]));_0x555390[_0x8173('0x35')]=_0x555390[_0x8173('0x35')]['length']?_0x555390[_0x8173('0x35')]:_0x113cdb[_0x8173('0x30')];if(_0x2f295e['query'][_0x8173('0x46')]){_0x555390['include']=[{'all':!![]}];}_0x555390=_[_0x8173('0x3e')]({},_0x555390,_0x2f295e[_0x8173('0x40')]);return db[_0x8173('0x2c')]['find'](_0x555390)['then'](handleEntityNotFound(_0xaa3390,null))['then'](function(_0xccec0f){if(_0xccec0f){var _0x4255a7=_0xccec0f[_0x8173('0x49')]({'plain':!![]});_0x4255a7=qs[_0x8173('0x4a')](_0x4255a7,['id',_0x8173('0x4b'),'updatedAt']);_0x2f295e['body']=_['omit'](_0x2f295e[_0x8173('0x4c')],['id','createdAt',_0x8173('0x4d')]);return db['Attachment'][_0x8173('0x4e')](_[_0x8173('0x3e')](_0x4255a7,_0x2f295e[_0x8173('0x4c')]),{'include':_0x2f295e[_0x8173('0x31')][_0x8173('0x46')]?[{'all':!![]}]:undefined});}})[_0x8173('0x24')](respondWithResult(_0xaa3390,0xc9))[_0x8173('0x43')](handleError(_0xaa3390,null));};exports[_0x8173('0x22')]=function(_0x50dd8e,_0x2c6194){if(_0x50dd8e['body']['id']){delete _0x50dd8e[_0x8173('0x4c')]['id'];}return db[_0x8173('0x2c')][_0x8173('0x47')]({'where':{'id':_0x50dd8e[_0x8173('0x4f')]['id']}})[_0x8173('0x24')](handleEntityNotFound(_0x2c6194,null))[_0x8173('0x24')](saveUpdates(_0x50dd8e[_0x8173('0x4c')],null))[_0x8173('0x24')](respondWithResult(_0x2c6194,null))[_0x8173('0x43')](handleError(_0x2c6194,null));};exports[_0x8173('0x23')]=function(_0x53be08,_0x3c3358){return db[_0x8173('0x2c')][_0x8173('0x47')]({'where':{'id':_0x53be08[_0x8173('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3c3358,null))['then'](removeEntity(_0x3c3358,null))[_0x8173('0x43')](handleError(_0x3c3358,null));};exports[_0x8173('0x4e')]=function(_0x1ebea0,_0x7687d3,_0x2cab0c){_0x1ebea0[_0x8173('0x4c')]['name']=_0x1ebea0['file'][_0x8173('0x50')];_0x1ebea0['body'][_0x8173('0x51')]=_0x1ebea0[_0x8173('0x52')]['filename'];_0x1ebea0[_0x8173('0x4c')][_0x8173('0x2e')]=_0x1ebea0['file'][_0x8173('0x53')];return db['Attachment'][_0x8173('0x4e')](_0x1ebea0[_0x8173('0x4c')])['then'](respondWithResult(_0x7687d3,0xc9))[_0x8173('0x43')](handleError(_0x7687d3,null));};exports[_0x8173('0x54')]=function(_0x4212a0,_0x23faa9,_0x59f7b1){return db[_0x8173('0x2c')][_0x8173('0x55')]({'where':{'id':_0x4212a0['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x23faa9,null))['then'](function(_0x578212){if(_0x578212){var _0x4c527e=_0x578212[_0x8173('0x56')]!==null;var _0x100ca9=path[_0x8173('0x57')](config[_0x8173('0x58')],'server/files/attachments/');if(_0x4c527e){_0x100ca9=path['join'](_0x100ca9,_0x8173('0x59'));}var _0x527239=path['join'](_0x100ca9,_0x578212[_0x8173('0x51')]);return _0x23faa9[_0x8173('0x54')](_0x527239);}})[_0x8173('0x43')](handleError(_0x23faa9,null));}; \ No newline at end of file +var _0x5a57=['includeAll','find','clone','get','omit','createdAt','updatedAt','body','create','catch','file','filename','download','findOne','ChatOfflineMessageId','join','root','offline-chat/','basename','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','error','stack','name','index','Attachment','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params'];(function(_0x3a21c0,_0x348451){var _0x411e84=function(_0xdd7b02){while(--_0xdd7b02){_0x3a21c0['push'](_0x3a21c0['shift']());}};_0x411e84(++_0x348451);}(_0x5a57,0x10f));var _0x75a5=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x5a57[_0x1030ce];return _0x3367fd;};'use strict';var emlformat=require(_0x75a5('0x0'));var rimraf=require(_0x75a5('0x1'));var zipdir=require(_0x75a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75a5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x75a5('0x4'));var util=require(_0x75a5('0x5'));var path=require(_0x75a5('0x6'));var sox=require('sox');var csv=require(_0x75a5('0x7'));var ejs=require(_0x75a5('0x8'));var fs=require('fs');var fs_extra=require(_0x75a5('0x9'));var _=require('lodash');var squel=require(_0x75a5('0xa'));var crypto=require(_0x75a5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x75a5('0xc'));var toCsv=require(_0x75a5('0x7'));var querystring=require(_0x75a5('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x75a5('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x75a5('0xf'))(_0x75a5('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x75a5('0x11'));var db=require(_0x75a5('0x12'))['db'];function respondWithStatusCode(_0x3a1225,_0x5e43c9){_0x5e43c9=_0x5e43c9||0xcc;return function(_0x58ae54){if(_0x58ae54){return _0x3a1225[_0x75a5('0x13')](_0x5e43c9);}return _0x3a1225[_0x75a5('0x14')](_0x5e43c9)[_0x75a5('0x15')]();};}function respondWithResult(_0x3f2c2c,_0xf53909){_0xf53909=_0xf53909||0xc8;return function(_0x7c990e){if(_0x7c990e){return _0x3f2c2c[_0x75a5('0x14')](_0xf53909)['json'](_0x7c990e);}};}function respondWithFilteredResult(_0xd2f722,_0xde6046){return function(_0x359366){if(_0x359366){var _0x14741f=typeof _0xde6046[_0x75a5('0x16')]===_0x75a5('0x17')&&typeof _0xde6046[_0x75a5('0x18')]===_0x75a5('0x17');var _0x47b756=_0x359366[_0x75a5('0x19')];var _0x576892=_0x14741f?0x0:_0xde6046[_0x75a5('0x16')];var _0x1559fb=_0x14741f?_0x359366[_0x75a5('0x19')]:_0xde6046[_0x75a5('0x16')]+_0xde6046['limit'];var _0x8bc6c3;if(_0x1559fb>=_0x47b756){_0x1559fb=_0x47b756;_0x8bc6c3=0xc8;}else{_0x8bc6c3=0xce;}_0xd2f722[_0x75a5('0x14')](_0x8bc6c3);return _0xd2f722[_0x75a5('0x1a')](_0x75a5('0x1b'),_0x576892+'-'+_0x1559fb+'/'+_0x47b756)[_0x75a5('0x1c')](_0x359366);}return null;};}function patchUpdates(_0x4a4879){return function(_0xf1eb68){try{jsonpatch['apply'](_0xf1eb68,_0x4a4879,!![]);}catch(_0x47b9af){return BPromise[_0x75a5('0x1d')](_0x47b9af);}return _0xf1eb68[_0x75a5('0x1e')]();};}function saveUpdates(_0x224a3d,_0x176cf0){return function(_0x572853){if(_0x572853){return _0x572853['update'](_0x224a3d)[_0x75a5('0x1f')](function(_0x54191f){return _0x54191f;});}return null;};}function removeEntity(_0x1774c2,_0x152212){return function(_0x33a162){if(_0x33a162){return _0x33a162[_0x75a5('0x20')]()['then'](function(){_0x1774c2[_0x75a5('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x270ace,_0x32c2bf){return function(_0x5bc165){if(!_0x5bc165){_0x270ace[_0x75a5('0x13')](0x194);}return _0x5bc165;};}function handleError(_0x130af1,_0x518085){_0x518085=_0x518085||0x1f4;return function(_0x212f64){logger[_0x75a5('0x21')](_0x212f64[_0x75a5('0x22')]);if(_0x212f64[_0x75a5('0x23')]){delete _0x212f64[_0x75a5('0x23')];}_0x130af1[_0x75a5('0x14')](_0x518085)['send'](_0x212f64);};}exports[_0x75a5('0x24')]=function(_0x2602cf,_0x8e70fc){var _0x52f01e={},_0x273478={},_0x483c8b={'count':0x0,'rows':[]};var _0x205897=_['map'](db[_0x75a5('0x25')][_0x75a5('0x26')],function(_0x23a7c1){return{'name':_0x23a7c1[_0x75a5('0x27')],'type':_0x23a7c1[_0x75a5('0x28')][_0x75a5('0x29')]};});_0x273478[_0x75a5('0x2a')]=_[_0x75a5('0x2b')](_0x205897,_0x75a5('0x23'));_0x273478['query']=_[_0x75a5('0x2c')](_0x2602cf[_0x75a5('0x2d')]);_0x273478[_0x75a5('0x2e')]=_[_0x75a5('0x2f')](_0x273478[_0x75a5('0x2a')],_0x273478[_0x75a5('0x2d')]);_0x52f01e['attributes']=_[_0x75a5('0x2f')](_0x273478[_0x75a5('0x2a')],qs[_0x75a5('0x30')](_0x2602cf[_0x75a5('0x2d')][_0x75a5('0x30')]));_0x52f01e[_0x75a5('0x31')]=_0x52f01e[_0x75a5('0x31')][_0x75a5('0x32')]?_0x52f01e[_0x75a5('0x31')]:_0x273478[_0x75a5('0x2a')];if(!_0x2602cf[_0x75a5('0x2d')]['hasOwnProperty'](_0x75a5('0x33'))){_0x52f01e[_0x75a5('0x18')]=qs[_0x75a5('0x18')](_0x2602cf[_0x75a5('0x2d')][_0x75a5('0x18')]);_0x52f01e[_0x75a5('0x16')]=qs[_0x75a5('0x16')](_0x2602cf[_0x75a5('0x2d')][_0x75a5('0x16')]);}_0x52f01e[_0x75a5('0x34')]=qs[_0x75a5('0x35')](_0x2602cf[_0x75a5('0x2d')]['sort']);_0x52f01e[_0x75a5('0x36')]=qs['filters'](_[_0x75a5('0x37')](_0x2602cf[_0x75a5('0x2d')],_0x273478['filters']),_0x205897);if(_0x2602cf[_0x75a5('0x2d')][_0x75a5('0x38')]){_0x52f01e[_0x75a5('0x36')]=_[_0x75a5('0x39')](_0x52f01e[_0x75a5('0x36')],{'$or':_[_0x75a5('0x2b')](_0x205897,function(_0x54058a){if(_0x54058a[_0x75a5('0x28')]!==_0x75a5('0x3a')){var _0x154ff4={};_0x154ff4[_0x54058a[_0x75a5('0x23')]]={'$like':'%'+_0x2602cf[_0x75a5('0x2d')][_0x75a5('0x38')]+'%'};return _0x154ff4;}})});}_0x52f01e=_[_0x75a5('0x39')]({},_0x52f01e,_0x2602cf[_0x75a5('0x3b')]);var _0x1a9eda={'where':_0x52f01e[_0x75a5('0x36')]};return db[_0x75a5('0x25')][_0x75a5('0x19')](_0x1a9eda)[_0x75a5('0x1f')](function(_0x571701){_0x483c8b[_0x75a5('0x19')]=_0x571701;if(_0x2602cf[_0x75a5('0x2d')]['includeAll']){_0x52f01e[_0x75a5('0x3c')]=[{'all':!![]}];}return db[_0x75a5('0x25')][_0x75a5('0x3d')](_0x52f01e);})[_0x75a5('0x1f')](function(_0x552c26){_0x483c8b[_0x75a5('0x3e')]=_0x552c26;return _0x483c8b;})[_0x75a5('0x1f')](respondWithFilteredResult(_0x8e70fc,_0x52f01e))['catch'](handleError(_0x8e70fc,null));};exports[_0x75a5('0x3f')]=function(_0x57a2d6,_0x15ff80){var _0x5433c5={'raw':!![],'where':{'id':_0x57a2d6[_0x75a5('0x40')]['id']}},_0x433abf={};_0x433abf[_0x75a5('0x2a')]=_[_0x75a5('0x2c')](db[_0x75a5('0x25')]['rawAttributes']);_0x433abf['query']=_[_0x75a5('0x2c')](_0x57a2d6['query']);_0x433abf['filters']=_[_0x75a5('0x2f')](_0x433abf[_0x75a5('0x2a')],_0x433abf['query']);_0x5433c5[_0x75a5('0x31')]=_['intersection'](_0x433abf[_0x75a5('0x2a')],qs[_0x75a5('0x30')](_0x57a2d6[_0x75a5('0x2d')][_0x75a5('0x30')]));_0x5433c5['attributes']=_0x5433c5['attributes']['length']?_0x5433c5[_0x75a5('0x31')]:_0x433abf[_0x75a5('0x2a')];if(_0x57a2d6[_0x75a5('0x2d')][_0x75a5('0x41')]){_0x5433c5['include']=[{'all':!![]}];}_0x5433c5=_[_0x75a5('0x39')]({},_0x5433c5,_0x57a2d6[_0x75a5('0x3b')]);return db[_0x75a5('0x25')][_0x75a5('0x42')](_0x5433c5)[_0x75a5('0x1f')](handleEntityNotFound(_0x15ff80,null))[_0x75a5('0x1f')](respondWithResult(_0x15ff80,null))['catch'](handleError(_0x15ff80,null));};exports[_0x75a5('0x43')]=function(_0x2999e2,_0x2d64dd){var _0x3d6b40={'where':{'id':_0x2999e2[_0x75a5('0x40')]['id']}},_0x2ec048={};_0x2ec048[_0x75a5('0x2a')]=_[_0x75a5('0x2c')](db['Attachment'][_0x75a5('0x26')]);_0x3d6b40['attributes']=_[_0x75a5('0x2f')](_0x2ec048[_0x75a5('0x2a')],qs[_0x75a5('0x30')](_0x2999e2[_0x75a5('0x2d')]['fields']));_0x3d6b40[_0x75a5('0x31')]=_0x3d6b40[_0x75a5('0x31')][_0x75a5('0x32')]?_0x3d6b40[_0x75a5('0x31')]:_0x2ec048[_0x75a5('0x2a')];if(_0x2999e2[_0x75a5('0x2d')]['includeAll']){_0x3d6b40[_0x75a5('0x3c')]=[{'all':!![]}];}_0x3d6b40=_['merge']({},_0x3d6b40,_0x2999e2[_0x75a5('0x3b')]);return db[_0x75a5('0x25')][_0x75a5('0x42')](_0x3d6b40)[_0x75a5('0x1f')](handleEntityNotFound(_0x2d64dd,null))['then'](function(_0x217f1f){if(_0x217f1f){var _0x28e097=_0x217f1f[_0x75a5('0x44')]({'plain':!![]});_0x28e097=qs[_0x75a5('0x45')](_0x28e097,['id',_0x75a5('0x46'),_0x75a5('0x47')]);_0x2999e2[_0x75a5('0x48')]=_[_0x75a5('0x45')](_0x2999e2['body'],['id',_0x75a5('0x46'),'updatedAt']);return db['Attachment'][_0x75a5('0x49')](_[_0x75a5('0x39')](_0x28e097,_0x2999e2['body']),{'include':_0x2999e2['query'][_0x75a5('0x41')]?[{'all':!![]}]:undefined});}})[_0x75a5('0x1f')](respondWithResult(_0x2d64dd,0xc9))[_0x75a5('0x4a')](handleError(_0x2d64dd,null));};exports['update']=function(_0x2cb136,_0x22ab1b){if(_0x2cb136[_0x75a5('0x48')]['id']){delete _0x2cb136[_0x75a5('0x48')]['id'];}return db[_0x75a5('0x25')][_0x75a5('0x42')]({'where':{'id':_0x2cb136['params']['id']}})[_0x75a5('0x1f')](handleEntityNotFound(_0x22ab1b,null))[_0x75a5('0x1f')](saveUpdates(_0x2cb136[_0x75a5('0x48')],null))['then'](respondWithResult(_0x22ab1b,null))[_0x75a5('0x4a')](handleError(_0x22ab1b,null));};exports[_0x75a5('0x20')]=function(_0x45b94e,_0x3eabd2){return db[_0x75a5('0x25')]['find']({'where':{'id':_0x45b94e[_0x75a5('0x40')]['id']}})[_0x75a5('0x1f')](handleEntityNotFound(_0x3eabd2,null))[_0x75a5('0x1f')](removeEntity(_0x3eabd2,null))[_0x75a5('0x4a')](handleError(_0x3eabd2,null));};exports[_0x75a5('0x49')]=function(_0xdd8f3e,_0x135082,_0x21fd63){_0xdd8f3e[_0x75a5('0x48')][_0x75a5('0x23')]=_0xdd8f3e['file']['originalname'];_0xdd8f3e['body']['basename']=_0xdd8f3e[_0x75a5('0x4b')][_0x75a5('0x4c')];_0xdd8f3e[_0x75a5('0x48')][_0x75a5('0x28')]=_0xdd8f3e[_0x75a5('0x4b')]['mimetype'];return db['Attachment'][_0x75a5('0x49')](_0xdd8f3e[_0x75a5('0x48')])[_0x75a5('0x1f')](respondWithResult(_0x135082,0xc9))['catch'](handleError(_0x135082,null));};exports[_0x75a5('0x4d')]=function(_0x2187f4,_0x37c078,_0x3e81c6){return db[_0x75a5('0x25')][_0x75a5('0x4e')]({'where':{'id':_0x2187f4[_0x75a5('0x40')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x37c078,null))[_0x75a5('0x1f')](function(_0x27081c){if(_0x27081c){var _0x175afe=_0x27081c[_0x75a5('0x4f')]!==null;var _0x3f81d1=path[_0x75a5('0x50')](config[_0x75a5('0x51')],'server/files/attachments/');if(_0x175afe){_0x3f81d1=path[_0x75a5('0x50')](_0x3f81d1,_0x75a5('0x52'));}var _0x16e1a6=path['join'](_0x3f81d1,_0x27081c[_0x75a5('0x53')]);return _0x37c078[_0x75a5('0x4d')](_0x16e1a6);}})[_0x75a5('0x4a')](handleError(_0x37c078,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 3e333ee..b951c59 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 _0x5b7c=['request-promise','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4f6da7,_0x2412ce){var _0xefbe52=function(_0x5dec18){while(--_0x5dec18){_0x4f6da7['push'](_0x4f6da7['shift']());}};_0xefbe52(++_0x2412ce);}(_0x5b7c,0x1a8));var _0xc5b7=function(_0x253e05,_0x188da8){_0x253e05=_0x253e05-0x0;var _0x48a540=_0x5b7c[_0x253e05];return _0x48a540;};'use strict';var _=require(_0xc5b7('0x0'));var util=require('util');var logger=require(_0xc5b7('0x1'))(_0xc5b7('0x2'));var moment=require(_0xc5b7('0x3'));var BPromise=require(_0xc5b7('0x4'));var rp=require(_0xc5b7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc5b7('0x6'));var config=require(_0xc5b7('0x7'));var attributes=require(_0xc5b7('0x8'));module[_0xc5b7('0x9')]=function(_0x1ebd19,_0x237136){return _0x1ebd19[_0xc5b7('0xa')](_0xc5b7('0xb'),attributes,{'tableName':_0xc5b7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe25f=['moment','bluebird','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','Attachment','attachments','lodash'];(function(_0x490ca0,_0x2894f2){var _0x53845c=function(_0x3254d5){while(--_0x3254d5){_0x490ca0['push'](_0x490ca0['shift']());}};_0x53845c(++_0x2894f2);}(_0xe25f,0xdb));var _0xfe25=function(_0x462ec5,_0x505c77){_0x462ec5=_0x462ec5-0x0;var _0x5a593b=_0xe25f[_0x462ec5];return _0x5a593b;};'use strict';var _=require(_0xfe25('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfe25('0x1'));var BPromise=require(_0xfe25('0x2'));var rp=require(_0xfe25('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe25('0x4'));var config=require(_0xfe25('0x5'));var attributes=require(_0xfe25('0x6'));module[_0xfe25('0x7')]=function(_0x517cb4,_0x47b6ce){return _0x517cb4['define'](_0xfe25('0x8'),attributes,{'tableName':_0xfe25('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index ee50efd..dfdda55 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 _0xf109=['code','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','create','options','raw','stringify','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error'];(function(_0x4a331b,_0x565a6b){var _0x156945=function(_0x2fb80f){while(--_0x2fb80f){_0x4a331b['push'](_0x4a331b['shift']());}};_0x156945(++_0x565a6b);}(_0xf109,0xce));var _0x9f10=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf109[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var moment=require(_0x9f10('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f10('0x3'))['db'];var utils=require(_0x9f10('0x4'));var logger=require(_0x9f10('0x5'))(_0x9f10('0x6'));var config=require(_0x9f10('0x7'));var jayson=require(_0x9f10('0x8'));var client=jayson[_0x9f10('0x9')][_0x9f10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x227a29,_0x2a877e,_0x3fd82f){return new BPromise(function(_0x5c8719,_0x42a8cd){return client[_0x9f10('0xb')](_0x227a29,_0x3fd82f)[_0x9f10('0xc')](function(_0x1bde2e){logger[_0x9f10('0xd')]('Attachment,\x20%s,\x20%s',_0x2a877e,_0x9f10('0xe'));logger[_0x9f10('0xf')](_0x9f10('0x10'),_0x2a877e,'request\x20sent',JSON['stringify'](_0x1bde2e));if(_0x1bde2e[_0x9f10('0x11')]){if(_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x12')]===0x1f4){logger['error'](_0x9f10('0x13'),_0x2a877e,_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x14')]);return _0x42a8cd(_0x1bde2e['error'][_0x9f10('0x14')]);}logger[_0x9f10('0x11')]('Attachment,\x20%s,\x20%s',_0x2a877e,_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x14')]);return _0x5c8719(_0x1bde2e['error']['message']);}else{logger[_0x9f10('0xd')](_0x9f10('0x13'),_0x2a877e,'request\x20sent');_0x5c8719(_0x1bde2e[_0x9f10('0x15')]['message']);}})[_0x9f10('0x16')](function(_0x1f68d8){logger['error'](_0x9f10('0x13'),_0x2a877e,_0x1f68d8);_0x42a8cd(_0x1f68d8);});});}exports[_0x9f10('0x17')]=function(_0x509fba){var _0x150813=this;return new Promise(function(_0x53bfbd,_0xe221d0){return db['Attachment'][_0x9f10('0x18')](_0x509fba['body'],{'raw':_0x509fba['options']?_0x509fba[_0x9f10('0x19')][_0x9f10('0x1a')]===undefined?!![]:![]:!![]})[_0x9f10('0xc')](function(_0x3a78be){logger[_0x9f10('0xd')](_0x9f10('0x17'),_0x509fba);logger[_0x9f10('0xf')]('CreateAttachment',_0x509fba,JSON[_0x9f10('0x1b')](_0x3a78be));_0x53bfbd(_0x3a78be);})['catch'](function(_0x293990){logger[_0x9f10('0x11')](_0x9f10('0x17'),_0x293990['message'],_0x509fba);_0xe221d0(_0x150813[_0x9f10('0x11')](0x1f4,_0x293990[_0x9f10('0x14')]));});});}; \ No newline at end of file +var _0xb469=['options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','Attachment,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','CreateAttachment','create','body'];(function(_0x468147,_0x52533e){var _0x13de08=function(_0x429fbd){while(--_0x429fbd){_0x468147['push'](_0x468147['shift']());}};_0x13de08(++_0x52533e);}(_0xb469,0x13b));var _0x9b46=function(_0xfa290f,_0x15a4f6){_0xfa290f=_0xfa290f-0x0;var _0x237234=_0xb469[_0xfa290f];return _0x237234;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var moment=require(_0x9b46('0x2'));var BPromise=require(_0x9b46('0x3'));var rs=require(_0x9b46('0x4'));var fs=require('fs');var Redis=require(_0x9b46('0x5'));var db=require(_0x9b46('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b46('0x7'))(_0x9b46('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b46('0x9'));var client=jayson[_0x9b46('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b2dd3,_0x5bd834,_0x4c1ed9){return new BPromise(function(_0x34c0de,_0x545b6c){return client[_0x9b46('0xb')](_0x1b2dd3,_0x4c1ed9)[_0x9b46('0xc')](function(_0x43a112){logger['info'](_0x9b46('0xd'),_0x5bd834,'request\x20sent');logger[_0x9b46('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x5bd834,_0x9b46('0xf'),JSON['stringify'](_0x43a112));if(_0x43a112[_0x9b46('0x10')]){if(_0x43a112[_0x9b46('0x10')]['code']===0x1f4){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112['error'][_0x9b46('0x11')]);return _0x545b6c(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);return _0x34c0de(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}else{logger[_0x9b46('0x12')](_0x9b46('0xd'),_0x5bd834,_0x9b46('0xf'));_0x34c0de(_0x43a112[_0x9b46('0x13')]['message']);}})['catch'](function(_0x52c1b8){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x52c1b8);_0x545b6c(_0x52c1b8);});});}exports[_0x9b46('0x14')]=function(_0x5c5cc9){var _0x5dd7bd=this;return new Promise(function(_0x3d9efa,_0x4ccfd0){return db['Attachment'][_0x9b46('0x15')](_0x5c5cc9[_0x9b46('0x16')],{'raw':_0x5c5cc9['options']?_0x5c5cc9[_0x9b46('0x17')][_0x9b46('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x55aece){logger[_0x9b46('0x12')](_0x9b46('0x14'),_0x5c5cc9);logger[_0x9b46('0xe')]('CreateAttachment',_0x5c5cc9,JSON['stringify'](_0x55aece));_0x3d9efa(_0x55aece);})[_0x9b46('0x19')](function(_0x51d2ca){logger[_0x9b46('0x10')](_0x9b46('0x14'),_0x51d2ca['message'],_0x5c5cc9);_0x4ccfd0(_0x5dd7bd[_0x9b46('0x10')](0x1f4,_0x51d2ca['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index dee4b89..6540f7b 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(_0x539633,_0x2c1e83){var _0x186160=function(_0x3c1e41){while(--_0x3c1e41){_0x539633['push'](_0x539633['shift']());}};_0x186160(++_0x2c1e83);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d8812,_0x24b648){_0x3d8812=_0x3d8812-0x0;var _0x3aa4ee=_0xb10b[_0x3d8812];return _0x3aa4ee;};'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 _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0x0b0e[_0x29d2d2];return _0x3f6476;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index c1dea7c..c67cdef 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 _0x811f=['add','minutes','clearBlockUser','getLicense','status','send','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','use','User','passport-local','moment','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','baseDN','activedirectory','domain','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','role','blocked','blockedAt','online','user','then','disabled'];(function(_0x5e9cc6,_0x25d8d){var _0x1040f0=function(_0x10ebe1){while(--_0x10ebe1){_0x5e9cc6['push'](_0x5e9cc6['shift']());}};_0x1040f0(++_0x25d8d);}(_0x811f,0x15c));var _0xf811=function(_0x3815c2,_0x1f54e3){_0x3815c2=_0x3815c2-0x0;var _0x271f88=_0x811f[_0x3815c2];return _0x271f88;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xf811('0x0'))['Strategy'];var moment=require(_0xf811('0x1'));var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require('util');var db=require(_0xf811('0x2'))['db'];var authService=require(_0xf811('0x3'));var utils=require(_0xf811('0x4'));var config=require(_0xf811('0x5'));var logger=require(_0xf811('0x6'))(_0xf811('0x7'));function isActiveDirectoryConfigured(_0x304715){var _0x5c1783=![];if(typeof _0x304715['activedirectory']!=='undefined'){_0x5c1783=_0x304715['activedirectory'][_0xf811('0x8')]&&_0x304715[_0xf811('0x9')]['url']&&_0x304715[_0xf811('0x9')][_0xf811('0xa')];}return _0x5c1783;}function adAuthenticate(_0x4f6af8,_0x4032a8,_0x358067){return new BPromise(function(_0x25e9a8,_0x453b1c){try{var _0x3102a1=new ActiveDirectory(_0x4f6af8);_0x3102a1['authenticate'](_0x4032a8,_0x358067,function(_0x129ef7,_0x188f63){if(_0x129ef7){logger[_0xf811('0xb')]('Error\x20authenticate\x20%s:\x20%s',_0x4032a8,util['inspect'](_0x129ef7,{'showHidden':![],'depth':null}));_0x453b1c('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x188f63){logger[_0xf811('0xb')](_0xf811('0xc'),_0x4032a8);_0x453b1c(_0xf811('0xd'));}else{_0x25e9a8(_0x188f63);}});}catch(_0x46333c){_0x453b1c(_0x46333c);}});}function ActiveDirectoryAuthenticate(_0x346e1c,_0x164db0,_0x472a46,_0x6d4bfb){var _0x89f71d,_0x1267e7;if(!isActiveDirectoryConfigured(config)){logger[_0xf811('0xb')](_0xf811('0xe'),_0x164db0);return _0x6d4bfb(null,![],{'message':_0xf811('0xd')});}return db[_0xf811('0xf')]['findOne']({'where':{'id':0x1},'attributes':[_0xf811('0x10'),_0xf811('0x11')],'raw':!![]})['then'](function(_0x75d7d3){_0x89f71d=_0x75d7d3;if(!_0x89f71d[_0xf811('0x10')]){logger[_0xf811('0xb')](_0xf811('0x12'),_0x164db0);throw new Error(_0xf811('0xd'));}return _0x346e1c[_0xf811('0x13')]({'attributes':['id',_0xf811('0x14'),_0xf811('0x15'),_0xf811('0x16'),_0xf811('0x17'),'disabled',_0xf811('0x18'),_0xf811('0x19'),_0xf811('0x1a')],'where':{'name':_0x164db0,'role':{'$or':['admin',_0xf811('0x1b'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x278f62){if(!_0x278f62||_0x278f62&&_0x278f62[_0xf811('0x14')]!==_0x164db0){throw new Error(_0xf811('0xd'));}_0x1267e7=_0x278f62;var _0x5e4f95=_0x1267e7['name']+'@'+config[_0xf811('0x9')][_0xf811('0xa')];return adAuthenticate(config[_0xf811('0x9')],_0x5e4f95,_0x472a46);})[_0xf811('0x1c')](function(_0x6279de){if(_0x1267e7[_0xf811('0x1d')]){throw new Error(_0xf811('0xd'));}if(_0x89f71d['blockDuration']>0x0){if(_0x1267e7['blocked']){if(moment(_0x1267e7[_0xf811('0x19')])[_0xf811('0x1e')](_0x89f71d['blockDuration'],_0xf811('0x1f'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xf811('0x20')](_0x1267e7,0x0,![],null)[_0xf811('0x1c')](function(){return utils[_0xf811('0x21')](_0x1267e7);})[_0xf811('0x1c')](function(){return _0x6d4bfb(null,_0x1267e7);});}else{return utils['getLicense'](_0x1267e7)[_0xf811('0x1c')](function(){return _0x6d4bfb(null,_0x1267e7);});}}else{return utils['getLicense'](_0x1267e7)[_0xf811('0x1c')](function(){return _0x6d4bfb(null,_0x1267e7);});}})['catch'](function(_0x282529){return _0x6d4bfb(null,![],_0x282529);});}function handleError(_0x50ce49,_0x19f5e5,_0x3fc76d){return _0x50ce49[_0xf811('0x22')](_0x19f5e5||0x1f4)[_0xf811('0x23')]({'message':_0x3fc76d?_0x3fc76d['message']||_0x3fc76d:''});}exports['login']=function(_0x4c6a39,_0x46b2cf,_0x54527e){passport[_0xf811('0x24')](_0xf811('0x25'),function(_0x2cc1ec,_0x4c5cd9,_0x3126f4){var _0x379c2b=_0x2cc1ec||_0x3126f4;if(_0x379c2b){return handleError(_0x46b2cf,0x191,_0x379c2b);}if(!_0x4c5cd9){return handleError(_0x46b2cf,0x194,{'message':_0xf811('0x26')});}else{var _0x4a3edc={'payload':{'id':_0x4c5cd9['id'],'role':_0x4c5cd9[_0xf811('0x17')]},'options':{'expiresIn':0x15180}};return authService[_0xf811('0x27')](_0x4a3edc)[_0xf811('0x1c')](function(_0x4f68cb){_0x46b2cf['json']({'id':_0x4c5cd9['id'],'token':_0x4f68cb,'statusCall':'','isAlreadyLogged':_0x4c5cd9['online']});});}})(_0x4c6a39,_0x46b2cf,_0x54527e);};passport[_0xf811('0x28')](_0xf811('0x25'),new LocalStrategy({'usernameField':_0xf811('0x14'),'passwordField':'password'},function(_0x444d21,_0x3fd1e,_0x57bb97){return ActiveDirectoryAuthenticate(db[_0xf811('0x29')],_0x444d21,_0x3fd1e,_0x57bb97);})); \ No newline at end of file +var _0x41a1=['disabled','online','admin','agent','blocked','blockedAt','add','minutes','getLicense','catch','status','send','message','role','signToken','json','use','ad-login','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','baseDN','url','domain','authenticate','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','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'];(function(_0x1abe8d,_0x31e1f0){var _0x9f9ffe=function(_0x2056d1){while(--_0x2056d1){_0x1abe8d['push'](_0x1abe8d['shift']());}};_0x9f9ffe(++_0x31e1f0);}(_0x41a1,0x107));var _0x141a=function(_0x4bdd7e,_0x22950f){_0x4bdd7e=_0x4bdd7e-0x0;var _0x2c1a3d=_0x41a1[_0x4bdd7e];return _0x2c1a3d;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x141a('0x0'))[_0x141a('0x1')];var moment=require(_0x141a('0x2'));var ActiveDirectory=require(_0x141a('0x3'));var BPromise=require(_0x141a('0x4'));var util=require(_0x141a('0x5'));var db=require(_0x141a('0x6'))['db'];var authService=require(_0x141a('0x7'));var utils=require(_0x141a('0x8'));var config=require(_0x141a('0x9'));var logger=require('../../config/logger')(_0x141a('0xa'));function isActiveDirectoryConfigured(_0x581f90){var _0x277bbb=![];if(typeof _0x581f90[_0x141a('0xb')]!==_0x141a('0xc')){_0x277bbb=_0x581f90[_0x141a('0xb')][_0x141a('0xd')]&&_0x581f90[_0x141a('0xb')][_0x141a('0xe')]&&_0x581f90[_0x141a('0xb')][_0x141a('0xf')];}return _0x277bbb;}function adAuthenticate(_0x5e0be6,_0x526429,_0x111dae){return new BPromise(function(_0x1ce2ec,_0x575fe8){try{var _0x50388b=new ActiveDirectory(_0x5e0be6);_0x50388b[_0x141a('0x10')](_0x526429,_0x111dae,function(_0x57b480,_0x402bc9){if(_0x57b480){logger['error'](_0x141a('0x11'),_0x526429,util['inspect'](_0x57b480,{'showHidden':![],'depth':null}));_0x575fe8(_0x141a('0x12'));}else if(!_0x402bc9){logger[_0x141a('0x13')](_0x141a('0x14'),_0x526429);_0x575fe8(_0x141a('0x12'));}else{_0x1ce2ec(_0x402bc9);}});}catch(_0x262d73){_0x575fe8(_0x262d73);}});}function ActiveDirectoryAuthenticate(_0x485601,_0x83f75d,_0x50b9e6,_0x57bb47){var _0x35622f,_0x186cc7;if(!isActiveDirectoryConfigured(config)){logger[_0x141a('0x13')](_0x141a('0x15'),_0x83f75d);return _0x57bb47(null,![],{'message':_0x141a('0x12')});}return db[_0x141a('0x16')][_0x141a('0x17')]({'where':{'id':0x1},'attributes':[_0x141a('0x18'),_0x141a('0x19')],'raw':!![]})[_0x141a('0x1a')](function(_0x128434){_0x35622f=_0x128434;if(!_0x35622f[_0x141a('0x18')]){logger[_0x141a('0x13')](_0x141a('0x1b'),_0x83f75d);throw new Error(_0x141a('0x12'));}return _0x485601['findOne']({'attributes':['id',_0x141a('0x1c'),_0x141a('0x1d'),_0x141a('0x1e'),'role',_0x141a('0x1f'),'blocked','blockedAt',_0x141a('0x20')],'where':{'name':_0x83f75d,'role':{'$or':[_0x141a('0x21'),'user',_0x141a('0x22')]},'adSsoEnabled':!![]}});})['then'](function(_0x508d09){if(!_0x508d09||_0x508d09&&_0x508d09['name']!==_0x83f75d){throw new Error(_0x141a('0x12'));}_0x186cc7=_0x508d09;var _0x262d2f=_0x186cc7[_0x141a('0x1c')]+'@'+config[_0x141a('0xb')]['domain'];return adAuthenticate(config[_0x141a('0xb')],_0x262d2f,_0x50b9e6);})[_0x141a('0x1a')](function(_0x11225d){if(_0x186cc7[_0x141a('0x1f')]){throw new Error(_0x141a('0x12'));}if(_0x35622f['blockDuration']>0x0){if(_0x186cc7[_0x141a('0x23')]){if(moment(_0x186cc7[_0x141a('0x24')])[_0x141a('0x25')](_0x35622f[_0x141a('0x19')],_0x141a('0x26'))>moment()){throw new Error(_0x141a('0x12'));}return utils['clearBlockUser'](_0x186cc7,0x0,![],null)['then'](function(){return utils[_0x141a('0x27')](_0x186cc7);})[_0x141a('0x1a')](function(){return _0x57bb47(null,_0x186cc7);});}else{return utils[_0x141a('0x27')](_0x186cc7)[_0x141a('0x1a')](function(){return _0x57bb47(null,_0x186cc7);});}}else{return utils[_0x141a('0x27')](_0x186cc7)[_0x141a('0x1a')](function(){return _0x57bb47(null,_0x186cc7);});}})[_0x141a('0x28')](function(_0x5209c5){return _0x57bb47(null,![],_0x5209c5);});}function handleError(_0x482d15,_0x58bd30,_0x342a51){return _0x482d15[_0x141a('0x29')](_0x58bd30||0x1f4)[_0x141a('0x2a')]({'message':_0x342a51?_0x342a51[_0x141a('0x2b')]||_0x342a51:''});}exports['login']=function(_0x24c121,_0x731d24,_0xf87dcf){passport[_0x141a('0x10')]('ad-login',function(_0x1fbf14,_0x5634e5,_0x1a5c49){var _0x3143be=_0x1fbf14||_0x1a5c49;if(_0x3143be){return handleError(_0x731d24,0x191,_0x3143be);}if(!_0x5634e5){return handleError(_0x731d24,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2969e9={'payload':{'id':_0x5634e5['id'],'role':_0x5634e5[_0x141a('0x2c')]},'options':{'expiresIn':0x15180}};return authService[_0x141a('0x2d')](_0x2969e9)['then'](function(_0x259f9d){_0x731d24[_0x141a('0x2e')]({'id':_0x5634e5['id'],'token':_0x259f9d,'statusCall':'','isAlreadyLogged':_0x5634e5['online']});});}})(_0x24c121,_0x731d24,_0xf87dcf);};passport[_0x141a('0x2f')](_0x141a('0x30'),new LocalStrategy({'usernameField':'name','passwordField':_0x141a('0x1d')},function(_0x30ab26,_0x517b46,_0x145cb5){return ActiveDirectoryAuthenticate(db['User'],_0x30ab26,_0x517b46,_0x145cb5);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index e829dcf..1942a82 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 _0x0161=['express','login','exports'];(function(_0x496382,_0x15640a){var _0x51ad17=function(_0x12687b){while(--_0x12687b){_0x496382['push'](_0x496382['shift']());}};_0x51ad17(++_0x15640a);}(_0x0161,0xf6));var _0x1016=function(_0x1db9ff,_0xff3636){_0x1db9ff=_0x1db9ff-0x0;var _0x507cc1=_0x0161[_0x1db9ff];return _0x507cc1;};'use strict';var express=require(_0x1016('0x0'));var router=express['Router']();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0x1016('0x1')]);module[_0x1016('0x2')]=router; \ No newline at end of file +var _0xb37e=['login','./authActiveDirectory.controller'];(function(_0xbc8f8f,_0x515e26){var _0x4adb0d=function(_0x5e99a6){while(--_0x5e99a6){_0xbc8f8f['push'](_0xbc8f8f['shift']());}};_0x4adb0d(++_0x515e26);}(_0xb37e,0x177));var _0xeb37=function(_0x4a1044,_0x18b9ac){_0x4a1044=_0x4a1044-0x0;var _0x247f47=_0xb37e[_0x4a1044];return _0x247f47;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0xeb37('0x0'));router['post']('/',controller[_0xeb37('0x1')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index f4c53e9..40df24f 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x7a54,0x106));var _0x47a5=function(_0x236871,_0x5e2006){_0x236871=_0x236871-0x0;var _0x441126=_0x7a54[_0x236871];return _0x441126;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _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(_0x357df4,_0x36c762){var _0x27e369=function(_0x3bbf56){while(--_0x3bbf56){_0x357df4['push'](_0x357df4['shift']());}};_0x27e369(++_0x36c762);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 8cd39ef..9cce1a7 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 _0xa07e=['Router','./authGoogle.controller','../../components/auth/service','login','get','/callback','isMiddleware','setTokenCookie','exports','express','passport'];(function(_0x59de75,_0x2f7331){var _0x777df4=function(_0x2cbe46){while(--_0x2cbe46){_0x59de75['push'](_0x59de75['shift']());}};_0x777df4(++_0x2f7331);}(_0xa07e,0xda));var _0xea07=function(_0x19c6c3,_0x4bc398){_0x19c6c3=_0x19c6c3-0x0;var _0x4ce512=_0xa07e[_0x19c6c3];return _0x4ce512;};'use strict';var express=require(_0xea07('0x0'));var passport=require(_0xea07('0x1'));var router=express[_0xea07('0x2')]();var controller=require(_0xea07('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0xea07('0x4'));router['get']('/',controller[_0xea07('0x5')]);router[_0xea07('0x6')](_0xea07('0x7'),controller['callback'],authService[_0xea07('0x8')],userController[_0xea07('0x5')],authService[_0xea07('0x9')]);module[_0xea07('0xa')]=router; \ No newline at end of file +var _0xde6c=['setTokenCookie','express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','callback','login'];(function(_0x13d71a,_0x25ac53){var _0x48d55e=function(_0x524960){while(--_0x524960){_0x13d71a['push'](_0x13d71a['shift']());}};_0x48d55e(++_0x25ac53);}(_0xde6c,0x119));var _0xcde6=function(_0x1d4923,_0x4e222f){_0x1d4923=_0x1d4923-0x0;var _0x14ea9a=_0xde6c[_0x1d4923];return _0x14ea9a;};'use strict';var express=require(_0xcde6('0x0'));var passport=require(_0xcde6('0x1'));var router=express['Router']();var controller=require(_0xcde6('0x2'));var userController=require(_0xcde6('0x3'));var authService=require(_0xcde6('0x4'));router[_0xcde6('0x5')]('/',controller['login']);router[_0xcde6('0x5')](_0xcde6('0x6'),controller[_0xcde6('0x7')],authService['isMiddleware'],userController[_0xcde6('0x8')],authService[_0xcde6('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 460fe60..3a84827 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 _0x0c6a=['User','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','now','securePassword','passwordHistoryLimit','validatePasswordPattern','password','enforcePasswordHistory','previousPasswords','validatePasswordHistory','save','use','passport','Strategy','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','findOne','blockDuration','then','name','salt','disabled','blocked','loginAttempts','admin','agent','allowedLoginAttempts','blockedAt','add','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','minutes','getLicense','catch','MailAccount','find','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','\x22%s\x22\x20<%s>','user','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','online','forgot','email','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','Setting'];(function(_0x119d72,_0x21ac13){var _0x10242f=function(_0x52eb33){while(--_0x52eb33){_0x119d72['push'](_0x119d72['shift']());}};_0x10242f(++_0x21ac13);}(_0x0c6a,0x1eb));var _0xa0c6=function(_0x454017,_0x4c2948){_0x454017=_0x454017-0x0;var _0x22d946=_0x0c6a[_0x454017];return _0x22d946;};'use strict';var util=require('util');var passport=require(_0xa0c6('0x0'));var LocalStrategy=require('passport-local')[_0xa0c6('0x1')];var jayson=require('jayson/promise');var _=require(_0xa0c6('0x2'));var rs=require(_0xa0c6('0x3'));var moment=require('moment');var db=require(_0xa0c6('0x4'))['db'];var authService=require(_0xa0c6('0x5'));var utils=require(_0xa0c6('0x6'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x28fdd5,_0x4bc69a,_0x329dee,_0x1a3d77){var _0x496f2e,_0x329c0b;return db['Setting'][_0xa0c6('0x7')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xa0c6('0x8')],'raw':!![]})[_0xa0c6('0x9')](function(_0x2277ac){_0x496f2e=_0x2277ac;return _0x28fdd5[_0xa0c6('0x7')]({'attributes':['id',_0xa0c6('0xa'),'password',_0xa0c6('0xb'),'role',_0xa0c6('0xc'),_0xa0c6('0xd'),'blockedAt',_0xa0c6('0xe')],'where':{'name':_0x4bc69a,'role':{'$or':[_0xa0c6('0xf'),'user',_0xa0c6('0x10')]}}});})[_0xa0c6('0x9')](function(_0x5a3308){if(!_0x5a3308||_0x5a3308&&_0x5a3308[_0xa0c6('0xa')]!==_0x4bc69a){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x329c0b=_0x5a3308;return _0x329c0b;}})[_0xa0c6('0x9')](function(){_0x329c0b['authenticate'](_0x329dee,function(_0x244e0d,_0xfb84b3){var _0x5113e2=_0x329c0b[_0xa0c6('0xe')]+0x1;if(_0x244e0d){return _0x1a3d77(_0x244e0d);}else if(!_0xfb84b3){if(_0x329c0b[_0xa0c6('0xc')]){return _0x1a3d77(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x496f2e[_0xa0c6('0x11')]>0x0){if(_0x329c0b[_0xa0c6('0xd')]){if(_0x496f2e[_0xa0c6('0x8')]>0x0){if(moment(_0x329c0b[_0xa0c6('0x12')])[_0xa0c6('0x13')](_0x496f2e[_0xa0c6('0x8')],'minutes')>moment()){return _0x1a3d77(null,![],{'message':_0xa0c6('0x14')});}else{return utils[_0xa0c6('0x15')](_0x329c0b,_0x5113e2,![],null)[_0xa0c6('0x9')](function(){return _0x1a3d77(null,![],{'message':_0xa0c6('0x14')});});}}else{return _0x1a3d77(null,![],{'message':_0xa0c6('0x14')});}}else{if(_0x5113e2>=_0x496f2e['allowedLoginAttempts']){return utils[_0xa0c6('0x15')](_0x329c0b,0x0,!![],moment())[_0xa0c6('0x9')](function(){return _0x1a3d77(null,![],{'message':_0xa0c6('0x14')});});}else{return utils[_0xa0c6('0x15')](_0x329c0b,_0x5113e2,![],null)['then'](function(){return _0x1a3d77(null,![],{'message':_0xa0c6('0x14')});});}}}else{return _0x1a3d77(null,![],{'message':_0xa0c6('0x14')});}}else{if(_0x329c0b[_0xa0c6('0xc')]){return _0x1a3d77(null,![],{'message':_0xa0c6('0x14')});}else if(_0x496f2e[_0xa0c6('0x11')]>0x0){if(_0x329c0b[_0xa0c6('0xd')]){if(_0x496f2e[_0xa0c6('0x8')]>0x0){if(moment(_0x329c0b[_0xa0c6('0x12')])[_0xa0c6('0x13')](_0x496f2e[_0xa0c6('0x8')],_0xa0c6('0x16'))>moment()){return _0x1a3d77(null,![],{'message':_0xa0c6('0x14')});}else{return utils[_0xa0c6('0x15')](_0x329c0b,0x0,![],null)[_0xa0c6('0x9')](function(){return utils[_0xa0c6('0x17')](_0x329c0b);})[_0xa0c6('0x9')](function(){return _0x1a3d77(null,_0x329c0b);});}}else{return _0x1a3d77(null,![],{'message':_0xa0c6('0x14')});}}else{return utils[_0xa0c6('0x15')](_0x329c0b,0x0,![],null)[_0xa0c6('0x9')](function(){return utils[_0xa0c6('0x17')](_0x329c0b);})['then'](function(){return _0x1a3d77(null,_0x329c0b);})[_0xa0c6('0x18')](function(_0x2c21a7){return _0x1a3d77(null,![],_0x2c21a7);});}}else{if(_0x329c0b[_0xa0c6('0xd')]){return _0x1a3d77(null,![],{'message':_0xa0c6('0x14')});}else{return utils[_0xa0c6('0x17')](_0x329c0b)[_0xa0c6('0x9')](function(){return _0x1a3d77(null,_0x329c0b);});}}}});})[_0xa0c6('0x18')](function(_0x51e28a){return _0x1a3d77(null,![],_0x51e28a);});}function sendServiceMail(_0x107c72){return db[_0xa0c6('0x19')][_0xa0c6('0x1a')]({'where':{'service':!![]},'attributes':['id',_0xa0c6('0xa'),'email'],'include':[{'model':db['MailServerOut'],'as':_0xa0c6('0x1b'),'include':[{'model':db[_0xa0c6('0x1c')],'as':_0xa0c6('0x1c')}]}]})[_0xa0c6('0x9')](function(_0x5d577d){if(!_0x5d577d){throw new Error(_0xa0c6('0x1d'));}var _0x30918c=_0x5d577d[_0xa0c6('0x1e')]();var _0x522483={'account':_0x30918c,'message':_['merge']({'from':util['format'](_0xa0c6('0x1f'),_0x5d577d[_0xa0c6('0xa')],_0x5d577d['email']||_0x5d577d[_0xa0c6('0x1b')][_0xa0c6('0x20')])},_0x107c72)};return client['request'](_0xa0c6('0x21'),_0x522483);})[_0xa0c6('0x9')](function(_0x23b197){if(_0x23b197[_0xa0c6('0x22')]){throw new Error(util['format'](_0xa0c6('0x23'),_0x23b197['error'][_0xa0c6('0x24')]||JSON[_0xa0c6('0x25')](_0x23b197[_0xa0c6('0x22')])));}return!![];});}function handleError(_0x551ce7,_0x4e8597,_0x22baac){return _0x551ce7[_0xa0c6('0x26')](_0x4e8597||0x1f4)[_0xa0c6('0x27')]({'message':_0x22baac?_0x22baac['message']||_0x22baac:''});}exports[_0xa0c6('0x28')]=function(_0x2c98eb,_0x23f206,_0x2b91ac){passport[_0xa0c6('0x29')](_0xa0c6('0x2a'),function(_0x1fddfb,_0x37a6f5,_0x9928b9){var _0x5af67a=_0x1fddfb||_0x9928b9;if(_0x5af67a){return handleError(_0x23f206,0x191,_0x5af67a);}if(!_0x37a6f5){return handleError(_0x23f206,0x194,{'message':_0xa0c6('0x2b')});}else{var _0x14a813={'payload':{'id':_0x37a6f5['id'],'role':_0x37a6f5[_0xa0c6('0x2c')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x14a813)['then'](function(_0x12776f){_0x23f206[_0xa0c6('0x2d')]({'id':_0x37a6f5['id'],'token':_0x12776f,'statusCall':'','isAlreadyLogged':_0x37a6f5[_0xa0c6('0x2e')]});});}})(_0x2c98eb,_0x23f206,_0x2b91ac);};exports[_0xa0c6('0x2f')]=function(_0x5f570a,_0x108e89){if(!_0x5f570a['body'][_0xa0c6('0x30')]){return handleError(_0x108e89,0x1f4,{'message':_0xa0c6('0x31')});}var _0x1337cc=rs[_0xa0c6('0x32')]();_0x5f570a[_0xa0c6('0x33')][_0xa0c6('0x30')]=_0x5f570a['body'][_0xa0c6('0x30')][_0xa0c6('0x34')]()[_0xa0c6('0x35')]();var _0x7686b1;return db[_0xa0c6('0x36')][_0xa0c6('0x7')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xa0c6('0x8')],'raw':!![]})[_0xa0c6('0x9')](function(_0x1aa251){_0x7686b1=_0x1aa251;return db[_0xa0c6('0x37')][_0xa0c6('0x1a')]({'where':{'email':_0x5f570a[_0xa0c6('0x33')]['email']}});})[_0xa0c6('0x9')](function(_0x567942){if(!_0x567942){throw new Error(_0xa0c6('0x38'));}if(_0x567942[_0xa0c6('0xc')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x567942[_0xa0c6('0xd')]){if(moment(_0x567942[_0xa0c6('0x12')])['add'](_0x7686b1[_0xa0c6('0x8')],_0xa0c6('0x16'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x567942[_0xa0c6('0xd')]=![];_0x567942[_0xa0c6('0x12')]=null;}}_0x567942[_0xa0c6('0x39')]=_0x1337cc;_0x567942[_0xa0c6('0x3a')]=Date['now']()+0x36ee80;return _0x567942['save']();})[_0xa0c6('0x9')](function(){return sendServiceMail({'to':_0x5f570a[_0xa0c6('0x33')]['email'],'subject':_0xa0c6('0x3b'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xa0c6('0x3c')+_0xa0c6('0x3d')+_0x5f570a[_0xa0c6('0x3e')][_0xa0c6('0x3f')]+'/reset/'+_0x1337cc+'\x0a\x0a'+_0xa0c6('0x40')});})['then'](function(){_0x108e89[_0xa0c6('0x26')](0xc8)[_0xa0c6('0x27')]({'message':_0xa0c6('0x41')});})[_0xa0c6('0x18')](function(_0x20aab0){return handleError(_0x108e89,0x1f4,_0x20aab0);});};exports['reset']=function(_0x1f5b63,_0x1e3999){return db[_0xa0c6('0x37')]['find']({'where':{'resetPasswordToken':_0x1f5b63[_0xa0c6('0x42')][_0xa0c6('0x43')],'resetPasswordExpires':{'$gt':Date[_0xa0c6('0x44')]()}}})['then'](function(_0x14730a){if(!_0x14730a){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xa0c6('0x36')][_0xa0c6('0x7')]({'attributes':['id',_0xa0c6('0x45'),'enforcePasswordHistory',_0xa0c6('0x46')]})[_0xa0c6('0x9')](function(_0x5b50d3){if(_0x5b50d3[_0xa0c6('0x45')])authService[_0xa0c6('0x47')](_0x1f5b63[_0xa0c6('0x33')][_0xa0c6('0x48')]);if(!_0x5b50d3[_0xa0c6('0x49')]||!_0x14730a[_0xa0c6('0x4a')])return _0x14730a;authService[_0xa0c6('0x4b')](_0x1f5b63[_0xa0c6('0x33')][_0xa0c6('0x48')],_0x14730a[_0xa0c6('0x4a')],_0x5b50d3['passwordHistoryLimit']);return _0x14730a;})[_0xa0c6('0x9')](function(){_0x14730a[_0xa0c6('0x48')]=_0x1f5b63[_0xa0c6('0x33')][_0xa0c6('0x48')];_0x14730a[_0xa0c6('0x39')]=null;_0x14730a[_0xa0c6('0x3a')]=null;return _0x14730a[_0xa0c6('0x4c')]();});})[_0xa0c6('0x9')](function(){_0x1e3999[_0xa0c6('0x26')](0xc8)[_0xa0c6('0x27')]({'message':'Password\x20reset!'});})['catch'](function(_0x80b2c1){return handleError(_0x1e3999,0x1f4,_0x80b2c1);});};passport[_0xa0c6('0x4d')](_0xa0c6('0x2a'),new LocalStrategy({'usernameField':_0xa0c6('0xa'),'passwordField':'password'},function(_0x470682,_0x187773,_0x2c2dda){return localAuthenticate(db[_0xa0c6('0x37')],_0x470682,_0x187773,_0x2c2dda);})); \ No newline at end of file +var _0x594e=['User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','Password\x20reset!','use','local-login','passport-local','randomstring','moment','../../mysqldb','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','disabled','blocked','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','MailAccount','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','\x22%s\x22\x20<%s>','email','request','SendMail','error','format','message','stringify','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','Setting','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset'];(function(_0x651909,_0x15c6b4){var _0x572299=function(_0x5e8a48){while(--_0x5e8a48){_0x651909['push'](_0x651909['shift']());}};_0x572299(++_0x15c6b4);}(_0x594e,0xf6));var _0xe594=function(_0x59ef06,_0x5ec571){_0x59ef06=_0x59ef06-0x0;var _0x11c420=_0x594e[_0x59ef06];return _0x11c420;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0xe594('0x0'))['Strategy'];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0xe594('0x1'));var moment=require(_0xe594('0x2'));var db=require(_0xe594('0x3'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson[_0xe594('0x4')][_0xe594('0x5')]({'port':0x232b});function localAuthenticate(_0x3fcfc6,_0x499b14,_0x1715cf,_0x6e36e4){var _0x1eb125,_0x2e8b2f;return db['Setting'][_0xe594('0x6')]({'where':{'id':0x1},'attributes':[_0xe594('0x7'),_0xe594('0x8')],'raw':!![]})[_0xe594('0x9')](function(_0x2e0151){_0x1eb125=_0x2e0151;return _0x3fcfc6[_0xe594('0x6')]({'attributes':['id',_0xe594('0xa'),_0xe594('0xb'),'salt',_0xe594('0xc'),_0xe594('0xd'),_0xe594('0xe'),_0xe594('0xf'),_0xe594('0x10')],'where':{'name':_0x499b14,'role':{'$or':['admin',_0xe594('0x11'),_0xe594('0x12')]}}});})[_0xe594('0x9')](function(_0x41eb81){if(!_0x41eb81||_0x41eb81&&_0x41eb81['name']!==_0x499b14){throw new Error(_0xe594('0x13'));}else{_0x2e8b2f=_0x41eb81;return _0x2e8b2f;}})[_0xe594('0x9')](function(){_0x2e8b2f[_0xe594('0x14')](_0x1715cf,function(_0x3c0f9a,_0x4b87c8){var _0x3dde69=_0x2e8b2f[_0xe594('0x10')]+0x1;if(_0x3c0f9a){return _0x6e36e4(_0x3c0f9a);}else if(!_0x4b87c8){if(_0x2e8b2f[_0xe594('0xd')]){return _0x6e36e4(null,![],{'message':_0xe594('0x13')});}else if(_0x1eb125[_0xe594('0x7')]>0x0){if(_0x2e8b2f[_0xe594('0xe')]){if(_0x1eb125[_0xe594('0x8')]>0x0){if(moment(_0x2e8b2f[_0xe594('0xf')])[_0xe594('0x15')](_0x1eb125[_0xe594('0x8')],_0xe594('0x16'))>moment()){return _0x6e36e4(null,![],{'message':_0xe594('0x13')});}else{return utils[_0xe594('0x17')](_0x2e8b2f,_0x3dde69,![],null)[_0xe594('0x9')](function(){return _0x6e36e4(null,![],{'message':_0xe594('0x13')});});}}else{return _0x6e36e4(null,![],{'message':_0xe594('0x13')});}}else{if(_0x3dde69>=_0x1eb125[_0xe594('0x7')]){return utils['clearBlockUser'](_0x2e8b2f,0x0,!![],moment())[_0xe594('0x9')](function(){return _0x6e36e4(null,![],{'message':_0xe594('0x13')});});}else{return utils[_0xe594('0x17')](_0x2e8b2f,_0x3dde69,![],null)['then'](function(){return _0x6e36e4(null,![],{'message':_0xe594('0x13')});});}}}else{return _0x6e36e4(null,![],{'message':_0xe594('0x13')});}}else{if(_0x2e8b2f[_0xe594('0xd')]){return _0x6e36e4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x1eb125[_0xe594('0x7')]>0x0){if(_0x2e8b2f[_0xe594('0xe')]){if(_0x1eb125[_0xe594('0x8')]>0x0){if(moment(_0x2e8b2f[_0xe594('0xf')])[_0xe594('0x15')](_0x1eb125[_0xe594('0x8')],_0xe594('0x16'))>moment()){return _0x6e36e4(null,![],{'message':_0xe594('0x13')});}else{return utils[_0xe594('0x17')](_0x2e8b2f,0x0,![],null)[_0xe594('0x9')](function(){return utils[_0xe594('0x18')](_0x2e8b2f);})[_0xe594('0x9')](function(){return _0x6e36e4(null,_0x2e8b2f);});}}else{return _0x6e36e4(null,![],{'message':_0xe594('0x13')});}}else{return utils[_0xe594('0x17')](_0x2e8b2f,0x0,![],null)[_0xe594('0x9')](function(){return utils['getLicense'](_0x2e8b2f);})[_0xe594('0x9')](function(){return _0x6e36e4(null,_0x2e8b2f);})['catch'](function(_0x4c0ee5){return _0x6e36e4(null,![],_0x4c0ee5);});}}else{if(_0x2e8b2f[_0xe594('0xe')]){return _0x6e36e4(null,![],{'message':_0xe594('0x13')});}else{return utils[_0xe594('0x18')](_0x2e8b2f)[_0xe594('0x9')](function(){return _0x6e36e4(null,_0x2e8b2f);});}}}});})[_0xe594('0x19')](function(_0x171968){return _0x6e36e4(null,![],_0x171968);});}function sendServiceMail(_0x2e29c6){return db[_0xe594('0x1a')]['find']({'where':{'service':!![]},'attributes':['id',_0xe594('0xa'),'email'],'include':[{'model':db[_0xe594('0x1b')],'as':_0xe594('0x1c'),'include':[{'model':db[_0xe594('0x1d')],'as':_0xe594('0x1d')}]}]})['then'](function(_0x576152){if(!_0x576152){throw new Error(_0xe594('0x1e'));}var _0x3c5df4=_0x576152['getSmtpOptions']();var _0x176dae={'account':_0x3c5df4,'message':_[_0xe594('0x1f')]({'from':util['format'](_0xe594('0x20'),_0x576152[_0xe594('0xa')],_0x576152[_0xe594('0x21')]||_0x576152['Smtp'][_0xe594('0x11')])},_0x2e29c6)};return client[_0xe594('0x22')](_0xe594('0x23'),_0x176dae);})[_0xe594('0x9')](function(_0x17e491){if(_0x17e491[_0xe594('0x24')]){throw new Error(util[_0xe594('0x25')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x17e491[_0xe594('0x24')][_0xe594('0x26')]||JSON[_0xe594('0x27')](_0x17e491[_0xe594('0x24')])));}return!![];});}function handleError(_0x3992e1,_0x176424,_0x5224c3){return _0x3992e1['status'](_0x176424||0x1f4)[_0xe594('0x28')]({'message':_0x5224c3?_0x5224c3[_0xe594('0x26')]||_0x5224c3:''});}exports[_0xe594('0x29')]=function(_0x8f7698,_0xfdeb73,_0x47c361){passport[_0xe594('0x14')]('local-login',function(_0x539b4b,_0x31854b,_0x4e7a1a){var _0x4c3e12=_0x539b4b||_0x4e7a1a;if(_0x4c3e12){return handleError(_0xfdeb73,0x191,_0x4c3e12);}if(!_0x31854b){return handleError(_0xfdeb73,0x194,{'message':_0xe594('0x2a')});}else{var _0x1cb4d2={'payload':{'id':_0x31854b['id'],'role':_0x31854b['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1cb4d2)[_0xe594('0x9')](function(_0x7e47c7){_0xfdeb73['json']({'id':_0x31854b['id'],'token':_0x7e47c7,'statusCall':'','isAlreadyLogged':_0x31854b[_0xe594('0x2b')]});});}})(_0x8f7698,_0xfdeb73,_0x47c361);};exports[_0xe594('0x2c')]=function(_0x29692d,_0x70b483){if(!_0x29692d['body'][_0xe594('0x21')]){return handleError(_0x70b483,0x1f4,{'message':_0xe594('0x2d')});}var _0x1e0082=rs[_0xe594('0x2e')]();_0x29692d[_0xe594('0x2f')][_0xe594('0x21')]=_0x29692d[_0xe594('0x2f')]['email'][_0xe594('0x30')]()[_0xe594('0x31')]();var _0x3ad20a;return db[_0xe594('0x32')][_0xe594('0x6')]({'where':{'id':0x1},'attributes':[_0xe594('0x7'),_0xe594('0x8')],'raw':!![]})[_0xe594('0x9')](function(_0x312893){_0x3ad20a=_0x312893;return db['User'][_0xe594('0x33')]({'where':{'email':_0x29692d['body'][_0xe594('0x21')]}});})[_0xe594('0x9')](function(_0x51214c){if(!_0x51214c){throw new Error(_0xe594('0x34'));}if(_0x51214c['disabled']){throw new Error(_0xe594('0x35'));}if(_0x51214c['blocked']){if(moment(_0x51214c[_0xe594('0xf')])[_0xe594('0x15')](_0x3ad20a[_0xe594('0x8')],_0xe594('0x16'))>moment()){throw new Error(_0xe594('0x36'));}else{_0x51214c[_0xe594('0xe')]=![];_0x51214c[_0xe594('0xf')]=null;}}_0x51214c[_0xe594('0x37')]=_0x1e0082;_0x51214c['resetPasswordExpires']=Date[_0xe594('0x38')]()+0x36ee80;return _0x51214c[_0xe594('0x39')]();})['then'](function(){return sendServiceMail({'to':_0x29692d[_0xe594('0x2f')][_0xe594('0x21')],'subject':_0xe594('0x3a'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x29692d[_0xe594('0x3b')][_0xe594('0x3c')]+_0xe594('0x3d')+_0x1e0082+'\x0a\x0a'+_0xe594('0x3e')});})['then'](function(){_0x70b483[_0xe594('0x3f')](0xc8)[_0xe594('0x28')]({'message':_0xe594('0x40')});})[_0xe594('0x19')](function(_0x4f3a1b){return handleError(_0x70b483,0x1f4,_0x4f3a1b);});};exports[_0xe594('0x41')]=function(_0xba014c,_0x4849df){return db[_0xe594('0x42')][_0xe594('0x33')]({'where':{'resetPasswordToken':_0xba014c[_0xe594('0x43')][_0xe594('0x44')],'resetPasswordExpires':{'$gt':Date[_0xe594('0x38')]()}}})[_0xe594('0x9')](function(_0x4130e5){if(!_0x4130e5){throw new Error(_0xe594('0x45'));}return db[_0xe594('0x32')]['findOne']({'attributes':['id',_0xe594('0x46'),'enforcePasswordHistory',_0xe594('0x47')]})['then'](function(_0x598e91){if(_0x598e91[_0xe594('0x46')])authService[_0xe594('0x48')](_0xba014c['body'][_0xe594('0xb')]);if(!_0x598e91[_0xe594('0x49')]||!_0x4130e5[_0xe594('0x4a')])return _0x4130e5;authService['validatePasswordHistory'](_0xba014c[_0xe594('0x2f')]['password'],_0x4130e5[_0xe594('0x4a')],_0x598e91['passwordHistoryLimit']);return _0x4130e5;})[_0xe594('0x9')](function(){_0x4130e5[_0xe594('0xb')]=_0xba014c[_0xe594('0x2f')][_0xe594('0xb')];_0x4130e5[_0xe594('0x37')]=null;_0x4130e5['resetPasswordExpires']=null;return _0x4130e5[_0xe594('0x39')]();});})['then'](function(){_0x4849df[_0xe594('0x3f')](0xc8)['send']({'message':_0xe594('0x4b')});})[_0xe594('0x19')](function(_0x49c754){return handleError(_0x4849df,0x1f4,_0x49c754);});};passport[_0xe594('0x4c')](_0xe594('0x4d'),new LocalStrategy({'usernameField':_0xe594('0xa'),'passwordField':_0xe594('0xb')},function(_0x28e0fe,_0x2f797d,_0x4f4687){return localAuthenticate(db[_0xe594('0x42')],_0x28e0fe,_0x2f797d,_0x4f4687);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index f701f52..f45ce6e 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 _0x6afe=['reset','exports','express','Router','./authLocal.controller','login','post','forgot','/reset/:token'];(function(_0x533b5b,_0x33549a){var _0x4ff582=function(_0x1f21dc){while(--_0x1f21dc){_0x533b5b['push'](_0x533b5b['shift']());}};_0x4ff582(++_0x33549a);}(_0x6afe,0x80));var _0xe6af=function(_0x34412f,_0x116bea){_0x34412f=_0x34412f-0x0;var _0x4b4b5a=_0x6afe[_0x34412f];return _0x4b4b5a;};'use strict';var express=require(_0xe6af('0x0'));var router=express[_0xe6af('0x1')]();var controller=require(_0xe6af('0x2'));router['post']('/',controller[_0xe6af('0x3')]);router[_0xe6af('0x4')]('/forgot',controller[_0xe6af('0x5')]);router[_0xe6af('0x4')](_0xe6af('0x6'),controller[_0xe6af('0x7')]);module[_0xe6af('0x8')]=router; \ No newline at end of file +var _0xee62=['express','Router','./authLocal.controller','post','/forgot','forgot','reset'];(function(_0x1a8736,_0x5cb24d){var _0x2d14fe=function(_0xf46498){while(--_0xf46498){_0x1a8736['push'](_0x1a8736['shift']());}};_0x2d14fe(++_0x5cb24d);}(_0xee62,0xd9));var _0x2ee6=function(_0xc9a75f,_0x514e4e){_0xc9a75f=_0xc9a75f-0x0;var _0x180738=_0xee62[_0xc9a75f];return _0x180738;};'use strict';var express=require(_0x2ee6('0x0'));var router=express[_0x2ee6('0x1')]();var controller=require(_0x2ee6('0x2'));router[_0x2ee6('0x3')]('/',controller['login']);router[_0x2ee6('0x3')](_0x2ee6('0x4'),controller[_0x2ee6('0x5')]);router[_0x2ee6('0x3')]('/reset/:token',controller[_0x2ee6('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 200e8f8..2f03272 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 _0x5afa=['BOOLEAN','INTEGER','sequelize','STRING'];(function(_0x3938ab,_0x5ee681){var _0x2f7cfb=function(_0x151c03){while(--_0x151c03){_0x3938ab['push'](_0x3938ab['shift']());}};_0x2f7cfb(++_0x5ee681);}(_0x5afa,0xae));var _0xa5af=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5afa[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0xa5af('0x0'));module['exports']={'name':{'type':Sequelize[_0xa5af('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xa5af('0x1')]},'description':{'type':Sequelize[_0xa5af('0x1')]},'status':{'type':Sequelize[_0xa5af('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa5af('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x236f=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x31f889,_0x1d3179){var _0x2d2db9=function(_0x3a8a4d){while(--_0x3a8a4d){_0x31f889['push'](_0x31f889['shift']());}};_0x2d2db9(++_0x1d3179);}(_0x236f,0x1a1));var _0xf236=function(_0x34264b,_0x430d3b){_0x34264b=_0x34264b-0x0;var _0x3d811b=_0x236f[_0x34264b];return _0x3d811b;};'use strict';var Sequelize=require(_0xf236('0x0'));module[_0xf236('0x1')]={'name':{'type':Sequelize[_0xf236('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf236('0x2')]},'status':{'type':Sequelize[_0xf236('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xf236('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 470e745..97fe87c 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 _0x585b=['send','Automation','rawAttributes','fieldName','type','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','filter','merge','where','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','include','options','create','body','destroy','find','addConditions','Condition','ids','omit','getConditions','findOne','sort','pick','addActions','Action','order','getActions','rimraf','fast-json-patch','request-promise','moment','mustache','util','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','apply','reject','update','then','end','error','stack','name'];(function(_0x1ddb23,_0x3bb201){var _0x1e5bdf=function(_0x4708db){while(--_0x4708db){_0x1ddb23['push'](_0x1ddb23['shift']());}};_0x1e5bdf(++_0x3bb201);}(_0x585b,0x174));var _0xb585=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x585b[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb585('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb585('0x1'));var rp=require(_0xb585('0x2'));var moment=require(_0xb585('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb585('0x4'));var util=require(_0xb585('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(_0xb585('0x6'));var _=require('lodash');var squel=require(_0xb585('0x7'));var crypto=require(_0xb585('0x8'));var jsforce=require(_0xb585('0x9'));var deskjs=require(_0xb585('0xa'));var toCsv=require(_0xb585('0xb'));var querystring=require(_0xb585('0xc'));var Papa=require(_0xb585('0xd'));var Redis=require(_0xb585('0xe'));var authService=require(_0xb585('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb585('0x10'));var hardwareService=require(_0xb585('0x11'));var logger=require(_0xb585('0x12'))(_0xb585('0x13'));var utils=require('../../config/utils');var config=require(_0xb585('0x14'));var licenseUtil=require(_0xb585('0x15'));var db=require(_0xb585('0x16'))['db'];function respondWithStatusCode(_0x2dc214,_0x2e5ed6){_0x2e5ed6=_0x2e5ed6||0xcc;return function(_0x286e2e){if(_0x286e2e){return _0x2dc214[_0xb585('0x17')](_0x2e5ed6);}return _0x2dc214[_0xb585('0x18')](_0x2e5ed6)['end']();};}function respondWithResult(_0x3dacd4,_0x4b76ec){_0x4b76ec=_0x4b76ec||0xc8;return function(_0x221dc0){if(_0x221dc0){return _0x3dacd4[_0xb585('0x18')](_0x4b76ec)[_0xb585('0x19')](_0x221dc0);}};}function respondWithFilteredResult(_0x3c0ff6,_0x4bbcea){return function(_0x594a9b){if(_0x594a9b){var _0xa1cc61=typeof _0x4bbcea[_0xb585('0x1a')]===_0xb585('0x1b')&&typeof _0x4bbcea['limit']==='undefined';var _0x53ad10=_0x594a9b[_0xb585('0x1c')];var _0x27e37f=_0xa1cc61?0x0:_0x4bbcea[_0xb585('0x1a')];var _0x1a4e7b=_0xa1cc61?_0x594a9b[_0xb585('0x1c')]:_0x4bbcea[_0xb585('0x1a')]+_0x4bbcea[_0xb585('0x1d')];var _0x7901f9;if(_0x1a4e7b>=_0x53ad10){_0x1a4e7b=_0x53ad10;_0x7901f9=0xc8;}else{_0x7901f9=0xce;}_0x3c0ff6[_0xb585('0x18')](_0x7901f9);return _0x3c0ff6['set']('Content-Range',_0x27e37f+'-'+_0x1a4e7b+'/'+_0x53ad10)[_0xb585('0x19')](_0x594a9b);}return null;};}function patchUpdates(_0x3f5b9b){return function(_0x5c575b){try{jsonpatch[_0xb585('0x1e')](_0x5c575b,_0x3f5b9b,!![]);}catch(_0x55c1bc){return BPromise[_0xb585('0x1f')](_0x55c1bc);}return _0x5c575b['save']();};}function saveUpdates(_0x408194,_0x47525a){return function(_0x47ccdd){if(_0x47ccdd){return _0x47ccdd[_0xb585('0x20')](_0x408194)[_0xb585('0x21')](function(_0x9e1ff){return _0x9e1ff;});}return null;};}function removeEntity(_0x4edee1,_0x15e201){return function(_0x2c0f8f){if(_0x2c0f8f){return _0x2c0f8f['destroy']()[_0xb585('0x21')](function(){_0x4edee1[_0xb585('0x18')](0xcc)[_0xb585('0x22')]();});}};}function handleEntityNotFound(_0x3553c8,_0x5bcca4){return function(_0x2f5287){if(!_0x2f5287){_0x3553c8['sendStatus'](0x194);}return _0x2f5287;};}function handleError(_0x54922b,_0x5a0431){_0x5a0431=_0x5a0431||0x1f4;return function(_0x4cbbe2){logger[_0xb585('0x23')](_0x4cbbe2[_0xb585('0x24')]);if(_0x4cbbe2[_0xb585('0x25')]){delete _0x4cbbe2[_0xb585('0x25')];}_0x54922b[_0xb585('0x18')](_0x5a0431)[_0xb585('0x26')](_0x4cbbe2);};}exports['index']=function(_0x7f00fe,_0x55ecd4){var _0x2bddc1={},_0x3731b3={},_0x9bde2={'count':0x0,'rows':[]};var _0x1dc154=_['map'](db[_0xb585('0x27')][_0xb585('0x28')],function(_0x433ce2){return{'name':_0x433ce2[_0xb585('0x29')],'type':_0x433ce2[_0xb585('0x2a')]['key']};});_0x3731b3[_0xb585('0x2b')]=_[_0xb585('0x2c')](_0x1dc154,_0xb585('0x25'));_0x3731b3[_0xb585('0x2d')]=_['keys'](_0x7f00fe[_0xb585('0x2d')]);_0x3731b3[_0xb585('0x2e')]=_['intersection'](_0x3731b3['model'],_0x3731b3[_0xb585('0x2d')]);_0x2bddc1[_0xb585('0x2f')]=_[_0xb585('0x30')](_0x3731b3['model'],qs[_0xb585('0x31')](_0x7f00fe[_0xb585('0x2d')]['fields']));_0x2bddc1['attributes']=_0x2bddc1[_0xb585('0x2f')][_0xb585('0x32')]?_0x2bddc1['attributes']:_0x3731b3[_0xb585('0x2b')];if(!_0x7f00fe[_0xb585('0x2d')][_0xb585('0x33')](_0xb585('0x34'))){_0x2bddc1['limit']=qs[_0xb585('0x1d')](_0x7f00fe[_0xb585('0x2d')][_0xb585('0x1d')]);_0x2bddc1[_0xb585('0x1a')]=qs[_0xb585('0x1a')](_0x7f00fe[_0xb585('0x2d')][_0xb585('0x1a')]);}_0x2bddc1['order']=qs['sort'](_0x7f00fe['query']['sort']);_0x2bddc1['where']=qs[_0xb585('0x2e')](_['pick'](_0x7f00fe['query'],_0x3731b3[_0xb585('0x2e')]),_0x1dc154);if(_0x7f00fe[_0xb585('0x2d')][_0xb585('0x35')]){_0x2bddc1['where']=_[_0xb585('0x36')](_0x2bddc1[_0xb585('0x37')],{'$or':_['map'](_0x1dc154,function(_0x5a6e74){if(_0x5a6e74[_0xb585('0x2a')]!==_0xb585('0x38')){var _0xcc2631={};_0xcc2631[_0x5a6e74['name']]={'$like':'%'+_0x7f00fe[_0xb585('0x2d')][_0xb585('0x35')]+'%'};return _0xcc2631;}})});}_0x2bddc1=_[_0xb585('0x36')]({},_0x2bddc1,_0x7f00fe['options']);var _0x90f999={'where':_0x2bddc1['where']};return db[_0xb585('0x27')][_0xb585('0x1c')](_0x90f999)[_0xb585('0x21')](function(_0x3b0ac7){_0x9bde2[_0xb585('0x1c')]=_0x3b0ac7;if(_0x7f00fe[_0xb585('0x2d')][_0xb585('0x39')]){_0x2bddc1['include']=[{'all':!![]}];}return db[_0xb585('0x27')][_0xb585('0x3a')](_0x2bddc1);})['then'](function(_0x23acad){_0x9bde2[_0xb585('0x3b')]=_0x23acad;return _0x9bde2;})['then'](respondWithFilteredResult(_0x55ecd4,_0x2bddc1))[_0xb585('0x3c')](handleError(_0x55ecd4,null));};exports[_0xb585('0x3d')]=function(_0x82568a,_0x1d7a3b){var _0x7dee5c={'raw':![],'where':{'id':_0x82568a[_0xb585('0x3e')]['id']}},_0xaf5af2={};_0xaf5af2[_0xb585('0x2b')]=_[_0xb585('0x3f')](db['Automation'][_0xb585('0x28')]);_0xaf5af2['query']=_[_0xb585('0x3f')](_0x82568a['query']);_0xaf5af2['filters']=_[_0xb585('0x30')](_0xaf5af2[_0xb585('0x2b')],_0xaf5af2[_0xb585('0x2d')]);_0x7dee5c[_0xb585('0x2f')]=_[_0xb585('0x30')](_0xaf5af2[_0xb585('0x2b')],qs[_0xb585('0x31')](_0x82568a[_0xb585('0x2d')][_0xb585('0x31')]));_0x7dee5c[_0xb585('0x2f')]=_0x7dee5c[_0xb585('0x2f')][_0xb585('0x32')]?_0x7dee5c[_0xb585('0x2f')]:_0xaf5af2[_0xb585('0x2b')];if(_0x82568a[_0xb585('0x2d')][_0xb585('0x39')]){_0x7dee5c[_0xb585('0x40')]=[{'all':!![]}];}_0x7dee5c=_[_0xb585('0x36')]({},_0x7dee5c,_0x82568a[_0xb585('0x41')]);return db['Automation']['find'](_0x7dee5c)[_0xb585('0x21')](handleEntityNotFound(_0x1d7a3b,null))[_0xb585('0x21')](respondWithResult(_0x1d7a3b,null))[_0xb585('0x3c')](handleError(_0x1d7a3b,null));};exports[_0xb585('0x42')]=function(_0x53440d,_0x26e80c){return db[_0xb585('0x27')][_0xb585('0x42')](_0x53440d['body'],{})[_0xb585('0x21')](respondWithResult(_0x26e80c,0xc9))[_0xb585('0x3c')](handleError(_0x26e80c,null));};exports[_0xb585('0x20')]=function(_0x51ede9,_0x33cb81){if(_0x51ede9[_0xb585('0x43')]['id']){delete _0x51ede9['body']['id'];}return db[_0xb585('0x27')]['find']({'where':{'id':_0x51ede9[_0xb585('0x3e')]['id']}})[_0xb585('0x21')](handleEntityNotFound(_0x33cb81,null))[_0xb585('0x21')](saveUpdates(_0x51ede9['body'],null))[_0xb585('0x21')](respondWithResult(_0x33cb81,null))[_0xb585('0x3c')](handleError(_0x33cb81,null));};exports[_0xb585('0x44')]=function(_0x11d333,_0xef775f){return db[_0xb585('0x27')][_0xb585('0x45')]({'where':{'id':_0x11d333['params']['id']}})[_0xb585('0x21')](handleEntityNotFound(_0xef775f,null))[_0xb585('0x21')](removeEntity(_0xef775f,null))[_0xb585('0x3c')](handleError(_0xef775f,null));};exports[_0xb585('0x46')]=function(_0x383dad,_0x1701e0,_0x553ea0){return db[_0xb585('0x47')][_0xb585('0x45')]({'where':{'id':_0x383dad[_0xb585('0x3e')]['id']}})[_0xb585('0x21')](handleEntityNotFound(_0x1701e0,null))[_0xb585('0x21')](function(_0x29ff5c){if(_0x29ff5c){return _0x29ff5c[_0xb585('0x46')](_0x383dad['body'][_0xb585('0x48')],_[_0xb585('0x49')](_0x383dad[_0xb585('0x43')],['ids','id'])||{});}})[_0xb585('0x21')](respondWithResult(_0x1701e0,null))['catch'](handleError(_0x1701e0,null));};exports[_0xb585('0x4a')]=function(_0x42f65f,_0x74af79,_0x5b1839){var _0x5a5bc5={};var _0x301ed6={};var _0x182c8d;var _0x43fee4;return db['Automation'][_0xb585('0x4b')]({'where':{'id':_0x42f65f[_0xb585('0x3e')]['id']}})[_0xb585('0x21')](handleEntityNotFound(_0x74af79,null))[_0xb585('0x21')](function(_0x3e0d97){if(_0x3e0d97){_0x182c8d=_0x3e0d97;_0x301ed6[_0xb585('0x2b')]=_[_0xb585('0x3f')](db[_0xb585('0x47')]['rawAttributes']);_0x301ed6[_0xb585('0x2d')]=_[_0xb585('0x3f')](_0x42f65f[_0xb585('0x2d')]);_0x301ed6['filters']=_[_0xb585('0x30')](_0x301ed6[_0xb585('0x2b')],_0x301ed6[_0xb585('0x2d')]);_0x5a5bc5['attributes']=_['intersection'](_0x301ed6[_0xb585('0x2b')],qs[_0xb585('0x31')](_0x42f65f[_0xb585('0x2d')][_0xb585('0x31')]));_0x5a5bc5[_0xb585('0x2f')]=_0x5a5bc5[_0xb585('0x2f')][_0xb585('0x32')]?_0x5a5bc5[_0xb585('0x2f')]:_0x301ed6[_0xb585('0x2b')];_0x5a5bc5['order']=qs[_0xb585('0x4c')](_0x42f65f[_0xb585('0x2d')][_0xb585('0x4c')]);_0x5a5bc5[_0xb585('0x37')]=qs[_0xb585('0x2e')](_[_0xb585('0x4d')](_0x42f65f[_0xb585('0x2d')],_0x301ed6[_0xb585('0x2e')]));if(_0x42f65f[_0xb585('0x2d')]['filter']){_0x5a5bc5['where']=_[_0xb585('0x36')](_0x5a5bc5[_0xb585('0x37')],{'$or':_[_0xb585('0x2c')](_0x5a5bc5[_0xb585('0x2f')],function(_0x43fba7){var _0x57f3e7={};_0x57f3e7[_0x43fba7]={'$like':'%'+_0x42f65f['query'][_0xb585('0x35')]+'%'};return _0x57f3e7;})});}_0x5a5bc5=_['merge']({},_0x5a5bc5,_0x42f65f[_0xb585('0x41')]);return _0x182c8d[_0xb585('0x4a')](_0x5a5bc5);}})['then'](function(_0x296a87){if(_0x296a87){_0x43fee4=_0x296a87[_0xb585('0x32')];if(!_0x42f65f[_0xb585('0x2d')][_0xb585('0x33')](_0xb585('0x34'))){_0x5a5bc5[_0xb585('0x1d')]=qs[_0xb585('0x1d')](_0x42f65f['query']['limit']);_0x5a5bc5['offset']=qs[_0xb585('0x1a')](_0x42f65f['query'][_0xb585('0x1a')]);}return _0x182c8d[_0xb585('0x4a')](_0x5a5bc5);}})['then'](function(_0x29c57b){if(_0x29c57b){return _0x29c57b?{'count':_0x43fee4,'rows':_0x29c57b}:null;}})['then'](respondWithResult(_0x74af79,null))['catch'](handleError(_0x74af79,null));};exports[_0xb585('0x4e')]=function(_0x146d0e,_0x477a5c,_0x8c9985){return db[_0xb585('0x4f')][_0xb585('0x45')]({'where':{'id':_0x146d0e['params']['id']}})[_0xb585('0x21')](handleEntityNotFound(_0x477a5c,null))[_0xb585('0x21')](function(_0x405b41){if(_0x405b41){return _0x405b41[_0xb585('0x4e')](_0x146d0e['body'][_0xb585('0x48')],_[_0xb585('0x49')](_0x146d0e[_0xb585('0x43')],[_0xb585('0x48'),'id'])||{});}})[_0xb585('0x21')](respondWithResult(_0x477a5c,null))[_0xb585('0x3c')](handleError(_0x477a5c,null));};exports['getActions']=function(_0x7483e,_0xf4fbd1,_0x2be122){var _0x111302={};var _0x4d55fd={};var _0x4d4cbd;var _0x5bfa52;return db['Automation'][_0xb585('0x4b')]({'where':{'id':_0x7483e['params']['id']}})[_0xb585('0x21')](handleEntityNotFound(_0xf4fbd1,null))[_0xb585('0x21')](function(_0x3be972){if(_0x3be972){_0x4d4cbd=_0x3be972;_0x4d55fd['model']=_[_0xb585('0x3f')](db[_0xb585('0x4f')][_0xb585('0x28')]);_0x4d55fd['query']=_[_0xb585('0x3f')](_0x7483e['query']);_0x4d55fd[_0xb585('0x2e')]=_[_0xb585('0x30')](_0x4d55fd['model'],_0x4d55fd[_0xb585('0x2d')]);_0x111302[_0xb585('0x2f')]=_['intersection'](_0x4d55fd['model'],qs[_0xb585('0x31')](_0x7483e['query'][_0xb585('0x31')]));_0x111302['attributes']=_0x111302[_0xb585('0x2f')][_0xb585('0x32')]?_0x111302[_0xb585('0x2f')]:_0x4d55fd[_0xb585('0x2b')];_0x111302[_0xb585('0x50')]=qs[_0xb585('0x4c')](_0x7483e['query'][_0xb585('0x4c')]);_0x111302[_0xb585('0x37')]=qs['filters'](_[_0xb585('0x4d')](_0x7483e[_0xb585('0x2d')],_0x4d55fd[_0xb585('0x2e')]));if(_0x7483e[_0xb585('0x2d')][_0xb585('0x35')]){_0x111302[_0xb585('0x37')]=_[_0xb585('0x36')](_0x111302[_0xb585('0x37')],{'$or':_[_0xb585('0x2c')](_0x111302['attributes'],function(_0x3e7909){var _0x3d2b89={};_0x3d2b89[_0x3e7909]={'$like':'%'+_0x7483e[_0xb585('0x2d')][_0xb585('0x35')]+'%'};return _0x3d2b89;})});}_0x111302=_['merge']({},_0x111302,_0x7483e[_0xb585('0x41')]);return _0x4d4cbd['getActions'](_0x111302);}})['then'](function(_0x48ee34){if(_0x48ee34){_0x5bfa52=_0x48ee34[_0xb585('0x32')];if(!_0x7483e[_0xb585('0x2d')][_0xb585('0x33')](_0xb585('0x34'))){_0x111302[_0xb585('0x1d')]=qs[_0xb585('0x1d')](_0x7483e[_0xb585('0x2d')]['limit']);_0x111302['offset']=qs['offset'](_0x7483e[_0xb585('0x2d')]['offset']);}return _0x4d4cbd[_0xb585('0x51')](_0x111302);}})['then'](function(_0x55e734){if(_0x55e734){return _0x55e734?{'count':_0x5bfa52,'rows':_0x55e734}:null;}})[_0xb585('0x21')](respondWithResult(_0xf4fbd1,null))[_0xb585('0x3c')](handleError(_0xf4fbd1,null));}; \ No newline at end of file +var _0xa036=['hasOwnProperty','order','sort','where','pick','merge','includeAll','include','findAll','rows','catch','show','intersection','options','find','create','body','params','addConditions','ids','getConditions','Condition','filter','nolimit','addActions','Action','findOne','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0xa036,0x1ef));var _0x6a03=function(_0x5db664,_0x5e0f41){_0x5db664=_0x5db664-0x0;var _0xc962f7=_0xa036[_0x5db664];return _0xc962f7;};'use strict';var emlformat=require(_0x6a03('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a03('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6a03('0x2'));var BPromise=require(_0x6a03('0x3'));var Mustache=require(_0x6a03('0x4'));var util=require(_0x6a03('0x5'));var path=require(_0x6a03('0x6'));var sox=require('sox');var csv=require(_0x6a03('0x7'));var ejs=require(_0x6a03('0x8'));var fs=require('fs');var fs_extra=require(_0x6a03('0x9'));var _=require('lodash');var squel=require(_0x6a03('0xa'));var crypto=require('crypto');var jsforce=require(_0x6a03('0xb'));var deskjs=require(_0x6a03('0xc'));var toCsv=require(_0x6a03('0x7'));var querystring=require('querystring');var Papa=require(_0x6a03('0xd'));var Redis=require('ioredis');var authService=require(_0x6a03('0xe'));var qs=require(_0x6a03('0xf'));var as=require(_0x6a03('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a03('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6a03('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54b67f,_0x552445){_0x552445=_0x552445||0xcc;return function(_0x1f6cd9){if(_0x1f6cd9){return _0x54b67f[_0x6a03('0x13')](_0x552445);}return _0x54b67f[_0x6a03('0x14')](_0x552445)[_0x6a03('0x15')]();};}function respondWithResult(_0x6cfcea,_0x4db823){_0x4db823=_0x4db823||0xc8;return function(_0x5935d6){if(_0x5935d6){return _0x6cfcea[_0x6a03('0x14')](_0x4db823)[_0x6a03('0x16')](_0x5935d6);}};}function respondWithFilteredResult(_0x3e1411,_0x550e02){return function(_0x413759){if(_0x413759){var _0xcc638f=typeof _0x550e02[_0x6a03('0x17')]===_0x6a03('0x18')&&typeof _0x550e02[_0x6a03('0x19')]===_0x6a03('0x18');var _0xf3dfdf=_0x413759[_0x6a03('0x1a')];var _0x151da3=_0xcc638f?0x0:_0x550e02[_0x6a03('0x17')];var _0x7a8cfd=_0xcc638f?_0x413759[_0x6a03('0x1a')]:_0x550e02[_0x6a03('0x17')]+_0x550e02[_0x6a03('0x19')];var _0x5580de;if(_0x7a8cfd>=_0xf3dfdf){_0x7a8cfd=_0xf3dfdf;_0x5580de=0xc8;}else{_0x5580de=0xce;}_0x3e1411[_0x6a03('0x14')](_0x5580de);return _0x3e1411[_0x6a03('0x1b')](_0x6a03('0x1c'),_0x151da3+'-'+_0x7a8cfd+'/'+_0xf3dfdf)[_0x6a03('0x16')](_0x413759);}return null;};}function patchUpdates(_0x31c1cb){return function(_0x5f483b){try{jsonpatch[_0x6a03('0x1d')](_0x5f483b,_0x31c1cb,!![]);}catch(_0x47a04f){return BPromise[_0x6a03('0x1e')](_0x47a04f);}return _0x5f483b['save']();};}function saveUpdates(_0x3a8f3a,_0x39924f){return function(_0x13f49){if(_0x13f49){return _0x13f49[_0x6a03('0x1f')](_0x3a8f3a)[_0x6a03('0x20')](function(_0x501e1a){return _0x501e1a;});}return null;};}function removeEntity(_0xff4a3b,_0x3d99f0){return function(_0x3d1c4b){if(_0x3d1c4b){return _0x3d1c4b[_0x6a03('0x21')]()[_0x6a03('0x20')](function(){_0xff4a3b[_0x6a03('0x14')](0xcc)[_0x6a03('0x15')]();});}};}function handleEntityNotFound(_0x601ea6,_0x474530){return function(_0x309882){if(!_0x309882){_0x601ea6['sendStatus'](0x194);}return _0x309882;};}function handleError(_0x345ce5,_0x172d7d){_0x172d7d=_0x172d7d||0x1f4;return function(_0x4085a1){logger[_0x6a03('0x22')](_0x4085a1['stack']);if(_0x4085a1[_0x6a03('0x23')]){delete _0x4085a1[_0x6a03('0x23')];}_0x345ce5[_0x6a03('0x14')](_0x172d7d)[_0x6a03('0x24')](_0x4085a1);};}exports[_0x6a03('0x25')]=function(_0x3db4e1,_0x5633f){var _0x2caea3={},_0x31cde3={},_0x1a3773={'count':0x0,'rows':[]};var _0x5e57c6=_[_0x6a03('0x26')](db[_0x6a03('0x27')][_0x6a03('0x28')],function(_0xb3b471){return{'name':_0xb3b471[_0x6a03('0x29')],'type':_0xb3b471[_0x6a03('0x2a')][_0x6a03('0x2b')]};});_0x31cde3[_0x6a03('0x2c')]=_[_0x6a03('0x26')](_0x5e57c6,'name');_0x31cde3[_0x6a03('0x2d')]=_[_0x6a03('0x2e')](_0x3db4e1['query']);_0x31cde3[_0x6a03('0x2f')]=_['intersection'](_0x31cde3[_0x6a03('0x2c')],_0x31cde3[_0x6a03('0x2d')]);_0x2caea3['attributes']=_['intersection'](_0x31cde3[_0x6a03('0x2c')],qs[_0x6a03('0x30')](_0x3db4e1[_0x6a03('0x2d')]['fields']));_0x2caea3[_0x6a03('0x31')]=_0x2caea3[_0x6a03('0x31')][_0x6a03('0x32')]?_0x2caea3[_0x6a03('0x31')]:_0x31cde3['model'];if(!_0x3db4e1[_0x6a03('0x2d')][_0x6a03('0x33')]('nolimit')){_0x2caea3[_0x6a03('0x19')]=qs[_0x6a03('0x19')](_0x3db4e1[_0x6a03('0x2d')][_0x6a03('0x19')]);_0x2caea3['offset']=qs[_0x6a03('0x17')](_0x3db4e1[_0x6a03('0x2d')][_0x6a03('0x17')]);}_0x2caea3[_0x6a03('0x34')]=qs[_0x6a03('0x35')](_0x3db4e1[_0x6a03('0x2d')][_0x6a03('0x35')]);_0x2caea3[_0x6a03('0x36')]=qs['filters'](_[_0x6a03('0x37')](_0x3db4e1[_0x6a03('0x2d')],_0x31cde3['filters']),_0x5e57c6);if(_0x3db4e1[_0x6a03('0x2d')]['filter']){_0x2caea3[_0x6a03('0x36')]=_[_0x6a03('0x38')](_0x2caea3[_0x6a03('0x36')],{'$or':_[_0x6a03('0x26')](_0x5e57c6,function(_0x22ca05){if(_0x22ca05[_0x6a03('0x2a')]!=='VIRTUAL'){var _0x1b2f77={};_0x1b2f77[_0x22ca05[_0x6a03('0x23')]]={'$like':'%'+_0x3db4e1[_0x6a03('0x2d')]['filter']+'%'};return _0x1b2f77;}})});}_0x2caea3=_['merge']({},_0x2caea3,_0x3db4e1['options']);var _0x6f0072={'where':_0x2caea3[_0x6a03('0x36')]};return db['Automation']['count'](_0x6f0072)[_0x6a03('0x20')](function(_0x8540b6){_0x1a3773[_0x6a03('0x1a')]=_0x8540b6;if(_0x3db4e1[_0x6a03('0x2d')][_0x6a03('0x39')]){_0x2caea3[_0x6a03('0x3a')]=[{'all':!![]}];}return db['Automation'][_0x6a03('0x3b')](_0x2caea3);})[_0x6a03('0x20')](function(_0xecbe45){_0x1a3773[_0x6a03('0x3c')]=_0xecbe45;return _0x1a3773;})['then'](respondWithFilteredResult(_0x5633f,_0x2caea3))[_0x6a03('0x3d')](handleError(_0x5633f,null));};exports[_0x6a03('0x3e')]=function(_0x9cf7d1,_0x312ba9){var _0x1be907={'raw':![],'where':{'id':_0x9cf7d1['params']['id']}},_0x1fbdf7={};_0x1fbdf7[_0x6a03('0x2c')]=_[_0x6a03('0x2e')](db[_0x6a03('0x27')][_0x6a03('0x28')]);_0x1fbdf7[_0x6a03('0x2d')]=_[_0x6a03('0x2e')](_0x9cf7d1[_0x6a03('0x2d')]);_0x1fbdf7[_0x6a03('0x2f')]=_[_0x6a03('0x3f')](_0x1fbdf7[_0x6a03('0x2c')],_0x1fbdf7[_0x6a03('0x2d')]);_0x1be907[_0x6a03('0x31')]=_[_0x6a03('0x3f')](_0x1fbdf7[_0x6a03('0x2c')],qs[_0x6a03('0x30')](_0x9cf7d1['query'][_0x6a03('0x30')]));_0x1be907['attributes']=_0x1be907[_0x6a03('0x31')][_0x6a03('0x32')]?_0x1be907[_0x6a03('0x31')]:_0x1fbdf7['model'];if(_0x9cf7d1[_0x6a03('0x2d')][_0x6a03('0x39')]){_0x1be907['include']=[{'all':!![]}];}_0x1be907=_[_0x6a03('0x38')]({},_0x1be907,_0x9cf7d1[_0x6a03('0x40')]);return db[_0x6a03('0x27')][_0x6a03('0x41')](_0x1be907)['then'](handleEntityNotFound(_0x312ba9,null))[_0x6a03('0x20')](respondWithResult(_0x312ba9,null))[_0x6a03('0x3d')](handleError(_0x312ba9,null));};exports['create']=function(_0x5e3287,_0x35edd6){return db[_0x6a03('0x27')][_0x6a03('0x42')](_0x5e3287[_0x6a03('0x43')],{})[_0x6a03('0x20')](respondWithResult(_0x35edd6,0xc9))[_0x6a03('0x3d')](handleError(_0x35edd6,null));};exports[_0x6a03('0x1f')]=function(_0x5b05a3,_0x3b0397){if(_0x5b05a3[_0x6a03('0x43')]['id']){delete _0x5b05a3['body']['id'];}return db['Automation']['find']({'where':{'id':_0x5b05a3[_0x6a03('0x44')]['id']}})[_0x6a03('0x20')](handleEntityNotFound(_0x3b0397,null))[_0x6a03('0x20')](saveUpdates(_0x5b05a3[_0x6a03('0x43')],null))['then'](respondWithResult(_0x3b0397,null))[_0x6a03('0x3d')](handleError(_0x3b0397,null));};exports[_0x6a03('0x21')]=function(_0x1cd524,_0x52ac8b){return db[_0x6a03('0x27')]['find']({'where':{'id':_0x1cd524[_0x6a03('0x44')]['id']}})[_0x6a03('0x20')](handleEntityNotFound(_0x52ac8b,null))[_0x6a03('0x20')](removeEntity(_0x52ac8b,null))[_0x6a03('0x3d')](handleError(_0x52ac8b,null));};exports[_0x6a03('0x45')]=function(_0x5cf3f8,_0x579126,_0x284d87){return db['Condition'][_0x6a03('0x41')]({'where':{'id':_0x5cf3f8[_0x6a03('0x44')]['id']}})[_0x6a03('0x20')](handleEntityNotFound(_0x579126,null))['then'](function(_0x51b40e){if(_0x51b40e){return _0x51b40e['addConditions'](_0x5cf3f8['body'][_0x6a03('0x46')],_['omit'](_0x5cf3f8[_0x6a03('0x43')],[_0x6a03('0x46'),'id'])||{});}})[_0x6a03('0x20')](respondWithResult(_0x579126,null))['catch'](handleError(_0x579126,null));};exports[_0x6a03('0x47')]=function(_0x55e250,_0x11d764,_0x54f20b){var _0x37799f={};var _0x2ec5fe={};var _0x5d40ef;var _0x58149d;return db['Automation']['findOne']({'where':{'id':_0x55e250[_0x6a03('0x44')]['id']}})['then'](handleEntityNotFound(_0x11d764,null))['then'](function(_0x2a4131){if(_0x2a4131){_0x5d40ef=_0x2a4131;_0x2ec5fe['model']=_[_0x6a03('0x2e')](db[_0x6a03('0x48')][_0x6a03('0x28')]);_0x2ec5fe[_0x6a03('0x2d')]=_[_0x6a03('0x2e')](_0x55e250['query']);_0x2ec5fe[_0x6a03('0x2f')]=_[_0x6a03('0x3f')](_0x2ec5fe[_0x6a03('0x2c')],_0x2ec5fe['query']);_0x37799f['attributes']=_[_0x6a03('0x3f')](_0x2ec5fe['model'],qs[_0x6a03('0x30')](_0x55e250[_0x6a03('0x2d')][_0x6a03('0x30')]));_0x37799f[_0x6a03('0x31')]=_0x37799f[_0x6a03('0x31')][_0x6a03('0x32')]?_0x37799f[_0x6a03('0x31')]:_0x2ec5fe[_0x6a03('0x2c')];_0x37799f[_0x6a03('0x34')]=qs[_0x6a03('0x35')](_0x55e250[_0x6a03('0x2d')]['sort']);_0x37799f[_0x6a03('0x36')]=qs[_0x6a03('0x2f')](_['pick'](_0x55e250['query'],_0x2ec5fe[_0x6a03('0x2f')]));if(_0x55e250[_0x6a03('0x2d')]['filter']){_0x37799f['where']=_[_0x6a03('0x38')](_0x37799f['where'],{'$or':_[_0x6a03('0x26')](_0x37799f['attributes'],function(_0x3ebbac){var _0x32b2bb={};_0x32b2bb[_0x3ebbac]={'$like':'%'+_0x55e250[_0x6a03('0x2d')][_0x6a03('0x49')]+'%'};return _0x32b2bb;})});}_0x37799f=_['merge']({},_0x37799f,_0x55e250[_0x6a03('0x40')]);return _0x5d40ef[_0x6a03('0x47')](_0x37799f);}})[_0x6a03('0x20')](function(_0x4e63f9){if(_0x4e63f9){_0x58149d=_0x4e63f9[_0x6a03('0x32')];if(!_0x55e250['query'][_0x6a03('0x33')](_0x6a03('0x4a'))){_0x37799f[_0x6a03('0x19')]=qs['limit'](_0x55e250[_0x6a03('0x2d')][_0x6a03('0x19')]);_0x37799f[_0x6a03('0x17')]=qs['offset'](_0x55e250['query'][_0x6a03('0x17')]);}return _0x5d40ef[_0x6a03('0x47')](_0x37799f);}})[_0x6a03('0x20')](function(_0x53810e){if(_0x53810e){return _0x53810e?{'count':_0x58149d,'rows':_0x53810e}:null;}})[_0x6a03('0x20')](respondWithResult(_0x11d764,null))[_0x6a03('0x3d')](handleError(_0x11d764,null));};exports[_0x6a03('0x4b')]=function(_0x19a1d1,_0x3668e8,_0xe49833){return db[_0x6a03('0x4c')][_0x6a03('0x41')]({'where':{'id':_0x19a1d1[_0x6a03('0x44')]['id']}})[_0x6a03('0x20')](handleEntityNotFound(_0x3668e8,null))[_0x6a03('0x20')](function(_0xc62210){if(_0xc62210){return _0xc62210['addActions'](_0x19a1d1['body'][_0x6a03('0x46')],_['omit'](_0x19a1d1['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x3668e8,null))[_0x6a03('0x3d')](handleError(_0x3668e8,null));};exports['getActions']=function(_0x4bb197,_0x24ba06,_0x431101){var _0x4e303f={};var _0x5a1489={};var _0x14c624;var _0x57371f;return db[_0x6a03('0x27')][_0x6a03('0x4d')]({'where':{'id':_0x4bb197[_0x6a03('0x44')]['id']}})[_0x6a03('0x20')](handleEntityNotFound(_0x24ba06,null))['then'](function(_0x169945){if(_0x169945){_0x14c624=_0x169945;_0x5a1489[_0x6a03('0x2c')]=_[_0x6a03('0x2e')](db[_0x6a03('0x4c')][_0x6a03('0x28')]);_0x5a1489[_0x6a03('0x2d')]=_[_0x6a03('0x2e')](_0x4bb197[_0x6a03('0x2d')]);_0x5a1489[_0x6a03('0x2f')]=_['intersection'](_0x5a1489['model'],_0x5a1489[_0x6a03('0x2d')]);_0x4e303f['attributes']=_['intersection'](_0x5a1489[_0x6a03('0x2c')],qs[_0x6a03('0x30')](_0x4bb197[_0x6a03('0x2d')][_0x6a03('0x30')]));_0x4e303f[_0x6a03('0x31')]=_0x4e303f[_0x6a03('0x31')][_0x6a03('0x32')]?_0x4e303f[_0x6a03('0x31')]:_0x5a1489[_0x6a03('0x2c')];_0x4e303f[_0x6a03('0x34')]=qs[_0x6a03('0x35')](_0x4bb197[_0x6a03('0x2d')]['sort']);_0x4e303f['where']=qs['filters'](_[_0x6a03('0x37')](_0x4bb197[_0x6a03('0x2d')],_0x5a1489['filters']));if(_0x4bb197[_0x6a03('0x2d')]['filter']){_0x4e303f[_0x6a03('0x36')]=_[_0x6a03('0x38')](_0x4e303f[_0x6a03('0x36')],{'$or':_[_0x6a03('0x26')](_0x4e303f['attributes'],function(_0x1af1e0){var _0x18900a={};_0x18900a[_0x1af1e0]={'$like':'%'+_0x4bb197[_0x6a03('0x2d')]['filter']+'%'};return _0x18900a;})});}_0x4e303f=_[_0x6a03('0x38')]({},_0x4e303f,_0x4bb197[_0x6a03('0x40')]);return _0x14c624['getActions'](_0x4e303f);}})[_0x6a03('0x20')](function(_0x4b2624){if(_0x4b2624){_0x57371f=_0x4b2624['length'];if(!_0x4bb197[_0x6a03('0x2d')][_0x6a03('0x33')]('nolimit')){_0x4e303f[_0x6a03('0x19')]=qs['limit'](_0x4bb197['query'][_0x6a03('0x19')]);_0x4e303f[_0x6a03('0x17')]=qs[_0x6a03('0x17')](_0x4bb197[_0x6a03('0x2d')][_0x6a03('0x17')]);}return _0x14c624['getActions'](_0x4e303f);}})[_0x6a03('0x20')](function(_0x33b258){if(_0x33b258){return _0x33b258?{'count':_0x57371f,'rows':_0x33b258}:null;}})[_0x6a03('0x20')](respondWithResult(_0x24ba06,null))[_0x6a03('0x3d')](handleError(_0x24ba06,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index fff37e0..72afc84 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 _0x1263=['path','rimraf','../../config/environment','./automation.attributes','define','tools_automations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x25ff63,_0xf43f3){var _0x2009e7=function(_0x3c029a){while(--_0x3c029a){_0x25ff63['push'](_0x25ff63['shift']());}};_0x2009e7(++_0xf43f3);}(_0x1263,0xae));var _0x3126=function(_0x34f68,_0x2ea3d9){_0x34f68=_0x34f68-0x0;var _0x4f7101=_0x1263[_0x34f68];return _0x4f7101;};'use strict';var _=require('lodash');var util=require(_0x3126('0x0'));var logger=require(_0x3126('0x1'))(_0x3126('0x2'));var moment=require(_0x3126('0x3'));var BPromise=require(_0x3126('0x4'));var rp=require(_0x3126('0x5'));var fs=require('fs');var path=require(_0x3126('0x6'));var rimraf=require(_0x3126('0x7'));var config=require(_0x3126('0x8'));var attributes=require(_0x3126('0x9'));module['exports']=function(_0x488346,_0x56f599){return _0x488346[_0x3126('0xa')]('Automation',attributes,{'tableName':_0x3126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6932=['rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','../../config/logger','api','moment'];(function(_0x53efa4,_0x1e673b){var _0x276274=function(_0x5a0479){while(--_0x5a0479){_0x53efa4['push'](_0x53efa4['shift']());}};_0x276274(++_0x1e673b);}(_0x6932,0x6a));var _0x2693=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6932[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x2693('0x0'));var util=require('util');var logger=require(_0x2693('0x1'))(_0x2693('0x2'));var moment=require(_0x2693('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2693('0x4'));var config=require(_0x2693('0x5'));var attributes=require(_0x2693('0x6'));module[_0x2693('0x7')]=function(_0x59eb0b,_0x24663f){return _0x59eb0b[_0x2693('0x8')](_0x2693('0x9'),attributes,{'tableName':_0x2693('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 7f6c0e2..a5f164c 100644 --- a/server/api/automation/automation.rpc.js +++ b/server/api/automation/automation.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9123=['lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','message','Automation,\x20%s,\x20%s','result','catch'];(function(_0x34f5f1,_0xf82297){var _0x37a230=function(_0x90e002){while(--_0x90e002){_0x34f5f1['push'](_0x34f5f1['shift']());}};_0x37a230(++_0xf82297);}(_0x9123,0x140));var _0x3912=function(_0x6b2a45,_0xcd3208){_0x6b2a45=_0x6b2a45-0x0;var _0xa6db88=_0x9123[_0x6b2a45];return _0xa6db88;};'use strict';var _=require(_0x3912('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3912('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3912('0x2'))['db'];var utils=require(_0x3912('0x3'));var logger=require(_0x3912('0x4'))(_0x3912('0x5'));var config=require('../../config/environment');var jayson=require(_0x3912('0x6'));var client=jayson[_0x3912('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ea5cf,_0x2b3ac0,_0x2d75b6){return new BPromise(function(_0x2325d0,_0x51fb5b){return client[_0x3912('0x8')](_0x4ea5cf,_0x2d75b6)[_0x3912('0x9')](function(_0x2f5910){logger[_0x3912('0xa')]('Automation,\x20%s,\x20%s',_0x2b3ac0,_0x3912('0xb'));logger[_0x3912('0xc')]('Automation,\x20%s,\x20%s,\x20%s',_0x2b3ac0,_0x3912('0xb'),JSON[_0x3912('0xd')](_0x2f5910));if(_0x2f5910[_0x3912('0xe')]){if(_0x2f5910[_0x3912('0xe')][_0x3912('0xf')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x2b3ac0,_0x2f5910[_0x3912('0xe')][_0x3912('0x10')]);return _0x51fb5b(_0x2f5910[_0x3912('0xe')]['message']);}logger[_0x3912('0xe')](_0x3912('0x11'),_0x2b3ac0,_0x2f5910['error'][_0x3912('0x10')]);return _0x2325d0(_0x2f5910[_0x3912('0xe')][_0x3912('0x10')]);}else{logger[_0x3912('0xa')]('Automation,\x20%s,\x20%s',_0x2b3ac0,_0x3912('0xb'));_0x2325d0(_0x2f5910[_0x3912('0x12')][_0x3912('0x10')]);}})[_0x3912('0x13')](function(_0x4658b6){logger['error'](_0x3912('0x11'),_0x2b3ac0,_0x4658b6);_0x51fb5b(_0x4658b6);});});} \ No newline at end of file +var _0x1219=['http','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x339213,_0x4294a9){var _0x3ecb63=function(_0x1f6a55){while(--_0x1f6a55){_0x339213['push'](_0x339213['shift']());}};_0x3ecb63(++_0x4294a9);}(_0x1219,0x17c));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9121('0x0'));var util=require(_0x9121('0x1'));var moment=require(_0x9121('0x2'));var BPromise=require(_0x9121('0x3'));var rs=require(_0x9121('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9121('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9121('0x6'))(_0x9121('0x7'));var config=require(_0x9121('0x8'));var jayson=require(_0x9121('0x9'));var client=jayson[_0x9121('0xa')][_0x9121('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x437bac,_0x1387b7,_0x262520){return new BPromise(function(_0x409a74,_0x2c55eb){return client['request'](_0x437bac,_0x262520)[_0x9121('0xc')](function(_0x2bf1d6){logger[_0x9121('0xd')](_0x9121('0xe'),_0x1387b7,'request\x20sent');logger[_0x9121('0xf')](_0x9121('0x10'),_0x1387b7,_0x9121('0x11'),JSON[_0x9121('0x12')](_0x2bf1d6));if(_0x2bf1d6[_0x9121('0x13')]){if(_0x2bf1d6[_0x9121('0x13')][_0x9121('0x14')]===0x1f4){logger[_0x9121('0x13')](_0x9121('0xe'),_0x1387b7,_0x2bf1d6[_0x9121('0x13')][_0x9121('0x15')]);return _0x2c55eb(_0x2bf1d6[_0x9121('0x13')][_0x9121('0x15')]);}logger[_0x9121('0x13')](_0x9121('0xe'),_0x1387b7,_0x2bf1d6['error'][_0x9121('0x15')]);return _0x409a74(_0x2bf1d6[_0x9121('0x13')][_0x9121('0x15')]);}else{logger[_0x9121('0xd')](_0x9121('0xe'),_0x1387b7,_0x9121('0x11'));_0x409a74(_0x2bf1d6['result']['message']);}})[_0x9121('0x16')](function(_0x200a28){logger[_0x9121('0x13')](_0x9121('0xe'),_0x1387b7,_0x200a28);_0x2c55eb(_0x200a28);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index f695ba1..a3e6d1a 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 _0x607b=['getActions','create','addConditions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','get','/:id/conditions','getConditions','/:id/actions'];(function(_0x14254f,_0x58a984){var _0x4bc0a8=function(_0x527766){while(--_0x527766){_0x14254f['push'](_0x14254f['shift']());}};_0x4bc0a8(++_0x58a984);}(_0x607b,0x18f));var _0xb607=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x607b[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0xb607('0x0'));var util=require('util');var path=require(_0xb607('0x1'));var timeout=require(_0xb607('0x2'));var express=require(_0xb607('0x3'));var router=express[_0xb607('0x4')]();var fs_extra=require(_0xb607('0x5'));var auth=require(_0xb607('0x6'));var interaction=require(_0xb607('0x7'));var config=require(_0xb607('0x8'));var controller=require('./automation.controller');router['get']('/',auth[_0xb607('0x9')](),controller['index']);router['get'](_0xb607('0xa'),auth[_0xb607('0x9')](),controller['show']);router[_0xb607('0xb')](_0xb607('0xc'),auth[_0xb607('0x9')](),controller[_0xb607('0xd')]);router['get'](_0xb607('0xe'),auth[_0xb607('0x9')](),controller[_0xb607('0xf')]);router['post']('/',auth[_0xb607('0x9')](),controller[_0xb607('0x10')]);router['post'](_0xb607('0xc'),auth['isAuthenticated'](),controller[_0xb607('0x11')]);router['post'](_0xb607('0xe'),auth[_0xb607('0x9')](),controller['addActions']);router[_0xb607('0x12')](_0xb607('0xa'),auth[_0xb607('0x9')](),controller[_0xb607('0x13')]);router[_0xb607('0x14')](_0xb607('0xa'),auth[_0xb607('0x9')](),controller[_0xb607('0x15')]);module[_0xb607('0x16')]=router; \ No newline at end of file +var _0x8d37=['put','/:id','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','index','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions'];(function(_0x2dab94,_0x43fa57){var _0x3765d7=function(_0x337660){while(--_0x337660){_0x2dab94['push'](_0x2dab94['shift']());}};_0x3765d7(++_0x43fa57);}(_0x8d37,0xbc));var _0x78d3=function(_0x1376b6,_0x41e964){_0x1376b6=_0x1376b6-0x0;var _0x2cab78=_0x8d37[_0x1376b6];return _0x2cab78;};'use strict';var multer=require(_0x78d3('0x0'));var util=require('util');var path=require(_0x78d3('0x1'));var timeout=require(_0x78d3('0x2'));var express=require(_0x78d3('0x3'));var router=express[_0x78d3('0x4')]();var fs_extra=require(_0x78d3('0x5'));var auth=require(_0x78d3('0x6'));var interaction=require(_0x78d3('0x7'));var config=require('../../config/environment');var controller=require(_0x78d3('0x8'));router[_0x78d3('0x9')]('/',auth['isAuthenticated'](),controller[_0x78d3('0xa')]);router[_0x78d3('0x9')]('/:id',auth[_0x78d3('0xb')](),controller[_0x78d3('0xc')]);router[_0x78d3('0x9')](_0x78d3('0xd'),auth[_0x78d3('0xb')](),controller[_0x78d3('0xe')]);router['get'](_0x78d3('0xf'),auth[_0x78d3('0xb')](),controller[_0x78d3('0x10')]);router[_0x78d3('0x11')]('/',auth[_0x78d3('0xb')](),controller['create']);router[_0x78d3('0x11')](_0x78d3('0xd'),auth[_0x78d3('0xb')](),controller[_0x78d3('0x12')]);router[_0x78d3('0x11')](_0x78d3('0xf'),auth[_0x78d3('0xb')](),controller['addActions']);router[_0x78d3('0x13')](_0x78d3('0x14'),auth[_0x78d3('0xb')](),controller['update']);router[_0x78d3('0x15')]('/:id',auth[_0x78d3('0xb')](),controller['destroy']);module[_0x78d3('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 3694ac0..caf75e2 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 _0x62c0=['#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#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\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)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting'];(function(_0x5c7ded,_0x239513){var _0x367beb=function(_0x483e25){while(--_0x483e25){_0x5c7ded['push'](_0x5c7ded['shift']());}};_0x367beb(++_0x239513);}(_0x62c0,0xdb));var _0x062c=function(_0x4afac5,_0x1ab4ed){_0x4afac5=_0x4afac5-0x0;var _0x2404b3=_0x62c0[_0x4afac5];return _0x2404b3;};'use strict';var Sequelize=require(_0x062c('0x0'));module[_0x062c('0x1')]={'name':{'type':Sequelize[_0x062c('0x2')],'unique':_0x062c('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x062c('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x062c('0x4')},'limitCalls':{'type':Sequelize[_0x062c('0x5')](0x4)[_0x062c('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x062c('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x062c('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x062c('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x062c('0x5')](0x3)[_0x062c('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x062c('0x7')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x062c('0x5')](0x5)[_0x062c('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x062c('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0x062c('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x062c('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0x062c('0x5')](0x5)[_0x062c('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x062c('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x062c('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x062c('0x5')](0x5)[_0x062c('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x062c('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x062c('0xc')},'dialTimezone':{'type':Sequelize[_0x062c('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x062c('0x2')],'defaultValue':_0x062c('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0x062c('0xe')](_0x062c('0xf'),'never',_0x062c('0x10')),'defaultValue':_0x062c('0xf')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x062c('0x5')](0x9)[_0x062c('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x062c('0x11')},'dialAMDGreeting':{'type':Sequelize[_0x062c('0x5')](0x9)[_0x062c('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x062c('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x062c('0x5')](0x9)[_0x062c('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x062c('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x062c('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x062c('0x5')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x062c('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x062c('0x5')](0x9)[_0x062c('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x062c('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x062c('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x062c('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x062c('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x062c('0x5')](0x9)[_0x062c('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x062c('0xe')](_0x062c('0x17'),_0x062c('0x18')),'defaultValue':_0x062c('0x17')},'dialPrefix':{'type':Sequelize[_0x062c('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x062c('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x062c('0x19')},'dialCutDigit':{'type':Sequelize[_0x062c('0x5')](0x3)[_0x062c('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x062c('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x062c('0x5')](0x3)[_0x062c('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x062c('0x5')](0x5)[_0x062c('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x062c('0x1b')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x062c('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x062c('0x5')](0x5)[_0x062c('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x062c('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x062c('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x062c('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x062c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x062c('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0x062c('0x5')](0x3)[_0x062c('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x062c('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x062c('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x062c('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x062c('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x062c('0x5')](0x5)[_0x062c('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x062c('0x21')}}; \ No newline at end of file +var _0x241c=['BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr'];(function(_0x80a591,_0x5c79d0){var _0x2f9a7b=function(_0x39d57a){while(--_0x39d57a){_0x80a591['push'](_0x80a591['shift']());}};_0x2f9a7b(++_0x5c79d0);}(_0x241c,0xd8));var _0xc241=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x241c[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xc241('0x0'));module[_0xc241('0x1')]={'name':{'type':Sequelize[_0xc241('0x2')],'unique':_0xc241('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc241('0x4')]('ivr'),'allowNull':![],'defaultValue':_0xc241('0x5')},'description':{'type':Sequelize[_0xc241('0x2')]},'active':{'type':Sequelize[_0xc241('0x6')],'defaultValue':0x0,'comment':_0xc241('0x7')},'limitCalls':{'type':Sequelize[_0xc241('0x8')](0x4)[_0xc241('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc241('0xa')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xc241('0x8')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc241('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc241('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc241('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc241('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc241('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc241('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc241('0x8')](0x5)[_0xc241('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc241('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc241('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xc241('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc241('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc241('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc241('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc241('0x11')},'dialTimezone':{'type':Sequelize[_0xc241('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc241('0x2')],'defaultValue':_0xc241('0x12')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xc241('0x13'),'never',_0xc241('0x14')),'defaultValue':_0xc241('0x13')},'dialAMDActive':{'type':Sequelize[_0xc241('0x6')],'defaultValue':0x0,'comment':_0xc241('0x15')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc241('0x16')},'dialAMDGreeting':{'type':Sequelize[_0xc241('0x8')](0x9)[_0xc241('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc241('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc241('0x8')](0x9)[_0xc241('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc241('0x8')](0x9)[_0xc241('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xc241('0x8')](0x9)[_0xc241('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc241('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc241('0x8')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc241('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc241('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc241('0x8')](0x5)[_0xc241('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc241('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc241('0x8')](0x9)[_0xc241('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xc241('0x4')]('DESC',_0xc241('0x1b')),'defaultValue':_0xc241('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc241('0x8')](0x3)[_0xc241('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc241('0x1d')},'dialCutDigit':{'type':Sequelize[_0xc241('0x8')](0x3)[_0xc241('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc241('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc241('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc241('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xc241('0x8')](0x3)[_0xc241('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc241('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0xc241('0x8')](0x5)[_0xc241('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc241('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc241('0x8')](0x3)[_0xc241('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc241('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc241('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc241('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0xc241('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xc241('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc241('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc241('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 3dcaba4..56b800c 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 _0xfe9d=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','then','destroy','IvrCampaigns','end','error','name','send','index','Campaign','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','body','user','get','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','getHoppers','findOne','CmHopper','CampaignId','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x1d0271,_0x5f30c6){var _0x2cce38=function(_0x4c0568){while(--_0x4c0568){_0x1d0271['push'](_0x1d0271['shift']());}};_0x2cce38(++_0x5f30c6);}(_0xfe9d,0x10e));var _0xdfe9=function(_0x48a0ac,_0x557e09){_0x48a0ac=_0x48a0ac-0x0;var _0x56422c=_0xfe9d[_0x48a0ac];return _0x56422c;};'use strict';var emlformat=require(_0xdfe9('0x0'));var rimraf=require(_0xdfe9('0x1'));var zipdir=require(_0xdfe9('0x2'));var jsonpatch=require(_0xdfe9('0x3'));var rp=require(_0xdfe9('0x4'));var moment=require('moment');var BPromise=require(_0xdfe9('0x5'));var Mustache=require('mustache');var util=require(_0xdfe9('0x6'));var path=require(_0xdfe9('0x7'));var sox=require(_0xdfe9('0x8'));var csv=require(_0xdfe9('0x9'));var ejs=require(_0xdfe9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdfe9('0xb'));var crypto=require('crypto');var jsforce=require(_0xdfe9('0xc'));var deskjs=require(_0xdfe9('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfe9('0xe'));var Papa=require(_0xdfe9('0xf'));var Redis=require(_0xdfe9('0x10'));var authService=require(_0xdfe9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdfe9('0x12'));var hardwareService=require(_0xdfe9('0x13'));var logger=require(_0xdfe9('0x14'))(_0xdfe9('0x15'));var utils=require(_0xdfe9('0x16'));var config=require(_0xdfe9('0x17'));var licenseUtil=require(_0xdfe9('0x18'));var db=require(_0xdfe9('0x19'))['db'];function respondWithStatusCode(_0x379f5d,_0x351cc8){_0x351cc8=_0x351cc8||0xcc;return function(_0x5560ab){if(_0x5560ab){return _0x379f5d[_0xdfe9('0x1a')](_0x351cc8);}return _0x379f5d['status'](_0x351cc8)['end']();};}function respondWithResult(_0x202427,_0x4a1e01){_0x4a1e01=_0x4a1e01||0xc8;return function(_0x531409){if(_0x531409){return _0x202427[_0xdfe9('0x1b')](_0x4a1e01)[_0xdfe9('0x1c')](_0x531409);}};}function respondWithFilteredResult(_0x47dfaf,_0x313e61){return function(_0x5b849b){if(_0x5b849b){var _0x2d151b=typeof _0x313e61[_0xdfe9('0x1d')]===_0xdfe9('0x1e')&&typeof _0x313e61[_0xdfe9('0x1f')]===_0xdfe9('0x1e');var _0x479c63=_0x5b849b['count'];var _0x540fa3=_0x2d151b?0x0:_0x313e61[_0xdfe9('0x1d')];var _0x4fd892=_0x2d151b?_0x5b849b[_0xdfe9('0x20')]:_0x313e61[_0xdfe9('0x1d')]+_0x313e61[_0xdfe9('0x1f')];var _0x5dc44f;if(_0x4fd892>=_0x479c63){_0x4fd892=_0x479c63;_0x5dc44f=0xc8;}else{_0x5dc44f=0xce;}_0x47dfaf['status'](_0x5dc44f);return _0x47dfaf[_0xdfe9('0x21')]('Content-Range',_0x540fa3+'-'+_0x4fd892+'/'+_0x479c63)['json'](_0x5b849b);}return null;};}function patchUpdates(_0x34a55f){return function(_0x5691cc){try{jsonpatch[_0xdfe9('0x22')](_0x5691cc,_0x34a55f,!![]);}catch(_0x255df4){return BPromise['reject'](_0x255df4);}return _0x5691cc['save']();};}function saveUpdates(_0x412a25,_0x233e18){return function(_0x2fa679){if(_0x2fa679){return _0x2fa679[_0xdfe9('0x23')](_0x412a25)[_0xdfe9('0x24')](function(_0x8a9cb8){return _0x8a9cb8;});}return null;};}function removeEntity(_0x271b3e,_0x3a81eb){return function(_0x3a5a98){if(_0x3a5a98){return _0x3a5a98[_0xdfe9('0x25')]()[_0xdfe9('0x24')](function(){var _0x4ae939=_0x3a5a98['get']({'plain':!![]});var _0x2c1c83=_0xdfe9('0x26');return db['UserProfileResource'][_0xdfe9('0x25')]({'where':{'type':_0x2c1c83,'resourceId':_0x4ae939['id']}})['then'](function(){return _0x3a5a98;});})['then'](function(){_0x271b3e[_0xdfe9('0x1b')](0xcc)[_0xdfe9('0x27')]();});}};}function handleEntityNotFound(_0x11900e,_0x4188ea){return function(_0x521dd5){if(!_0x521dd5){_0x11900e['sendStatus'](0x194);}return _0x521dd5;};}function handleError(_0x4333c2,_0x11759c){_0x11759c=_0x11759c||0x1f4;return function(_0x344d93){logger[_0xdfe9('0x28')](_0x344d93['stack']);if(_0x344d93[_0xdfe9('0x29')]){delete _0x344d93[_0xdfe9('0x29')];}_0x4333c2['status'](_0x11759c)[_0xdfe9('0x2a')](_0x344d93);};}exports[_0xdfe9('0x2b')]=function(_0x204648,_0x497e72){var _0x45edc={},_0x24702d={},_0x1d4cfb={'count':0x0,'rows':[]};var _0x19f94d=_['map'](db[_0xdfe9('0x2c')][_0xdfe9('0x2d')],function(_0x29f707){return{'name':_0x29f707[_0xdfe9('0x2e')],'type':_0x29f707['type'][_0xdfe9('0x2f')]};});_0x24702d[_0xdfe9('0x30')]=_['map'](_0x19f94d,_0xdfe9('0x29'));_0x24702d[_0xdfe9('0x31')]=_[_0xdfe9('0x32')](_0x204648[_0xdfe9('0x31')]);_0x24702d[_0xdfe9('0x33')]=_[_0xdfe9('0x34')](_0x24702d[_0xdfe9('0x30')],_0x24702d[_0xdfe9('0x31')]);_0x45edc[_0xdfe9('0x35')]=_[_0xdfe9('0x34')](_0x24702d[_0xdfe9('0x30')],qs[_0xdfe9('0x36')](_0x204648['query']['fields']));_0x45edc[_0xdfe9('0x35')]=_0x45edc[_0xdfe9('0x35')][_0xdfe9('0x37')]?_0x45edc[_0xdfe9('0x35')]:_0x24702d[_0xdfe9('0x30')];if(!_0x204648[_0xdfe9('0x31')][_0xdfe9('0x38')](_0xdfe9('0x39'))){_0x45edc['limit']=qs[_0xdfe9('0x1f')](_0x204648[_0xdfe9('0x31')][_0xdfe9('0x1f')]);_0x45edc['offset']=qs['offset'](_0x204648[_0xdfe9('0x31')]['offset']);}_0x45edc[_0xdfe9('0x3a')]=qs[_0xdfe9('0x3b')](_0x204648['query'][_0xdfe9('0x3b')]);_0x45edc[_0xdfe9('0x3c')]=qs[_0xdfe9('0x33')](_[_0xdfe9('0x3d')](_0x204648[_0xdfe9('0x31')],_0x24702d[_0xdfe9('0x33')]),_0x19f94d);if(_0x204648['query'][_0xdfe9('0x3e')]){_0x45edc[_0xdfe9('0x3c')]=_['merge'](_0x45edc[_0xdfe9('0x3c')],{'$or':_[_0xdfe9('0x3f')](_0x19f94d,function(_0x13ddfc){if(_0x13ddfc[_0xdfe9('0x40')]!==_0xdfe9('0x41')){var _0x38ded7={};_0x38ded7[_0x13ddfc[_0xdfe9('0x29')]]={'$like':'%'+_0x204648[_0xdfe9('0x31')][_0xdfe9('0x3e')]+'%'};return _0x38ded7;}})});}_0x45edc=_[_0xdfe9('0x42')]({},_0x45edc,_0x204648[_0xdfe9('0x43')]);var _0x12ca7c={'where':_0x45edc[_0xdfe9('0x3c')]};return db[_0xdfe9('0x2c')][_0xdfe9('0x20')](_0x12ca7c)[_0xdfe9('0x24')](function(_0x4e0e88){_0x1d4cfb[_0xdfe9('0x20')]=_0x4e0e88;if(_0x204648[_0xdfe9('0x31')][_0xdfe9('0x44')]){_0x45edc[_0xdfe9('0x45')]=[{'all':!![]}];}return db[_0xdfe9('0x2c')]['findAll'](_0x45edc);})[_0xdfe9('0x24')](function(_0x499ab0){_0x1d4cfb[_0xdfe9('0x46')]=_0x499ab0;return _0x1d4cfb;})[_0xdfe9('0x24')](respondWithFilteredResult(_0x497e72,_0x45edc))[_0xdfe9('0x47')](handleError(_0x497e72,null));};exports['show']=function(_0x4b8dd8,_0x52161c){var _0x2de998={'raw':![],'where':{'id':_0x4b8dd8[_0xdfe9('0x48')]['id']}},_0x2034b2={};_0x2034b2[_0xdfe9('0x30')]=_['keys'](db[_0xdfe9('0x2c')][_0xdfe9('0x2d')]);_0x2034b2[_0xdfe9('0x31')]=_['keys'](_0x4b8dd8[_0xdfe9('0x31')]);_0x2034b2[_0xdfe9('0x33')]=_[_0xdfe9('0x34')](_0x2034b2[_0xdfe9('0x30')],_0x2034b2[_0xdfe9('0x31')]);_0x2de998[_0xdfe9('0x35')]=_[_0xdfe9('0x34')](_0x2034b2['model'],qs[_0xdfe9('0x36')](_0x4b8dd8[_0xdfe9('0x31')][_0xdfe9('0x36')]));_0x2de998[_0xdfe9('0x35')]=_0x2de998['attributes'][_0xdfe9('0x37')]?_0x2de998[_0xdfe9('0x35')]:_0x2034b2['model'];if(_0x4b8dd8[_0xdfe9('0x31')][_0xdfe9('0x44')]){_0x2de998['include']=[{'all':!![]}];}_0x2de998=_['merge']({},_0x2de998,_0x4b8dd8[_0xdfe9('0x43')]);return db[_0xdfe9('0x2c')][_0xdfe9('0x49')](_0x2de998)[_0xdfe9('0x24')](handleEntityNotFound(_0x52161c,null))[_0xdfe9('0x24')](respondWithResult(_0x52161c,null))[_0xdfe9('0x47')](handleError(_0x52161c,null));};exports['create']=function(_0x1f7cfc,_0x135c2e){return db[_0xdfe9('0x2c')]['create'](_0x1f7cfc[_0xdfe9('0x4a')],{})[_0xdfe9('0x24')](function(_0x294bfe){var _0x3480e1=_0x1f7cfc[_0xdfe9('0x4b')][_0xdfe9('0x4c')]({'plain':!![]});if(!_0x3480e1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3480e1['role']===_0xdfe9('0x4b')){var _0x3d3eb7=_0x294bfe[_0xdfe9('0x4c')]({'plain':!![]});var _0x23555f='IvrCampaigns';return db[_0xdfe9('0x4d')]['find']({'where':{'name':_0x23555f,'userProfileId':_0x3480e1['userProfileId']},'raw':!![]})[_0xdfe9('0x24')](function(_0x543ec7){if(_0x543ec7&&_0x543ec7['autoAssociation']===0x0){return db['UserProfileResource'][_0xdfe9('0x4e')]({'name':_0x3d3eb7[_0xdfe9('0x29')],'resourceId':_0x3d3eb7['id'],'type':_0x543ec7[_0xdfe9('0x29')],'sectionId':_0x543ec7['id']},{})['then'](function(){return _0x294bfe;});}else{return _0x294bfe;}})[_0xdfe9('0x47')](function(_0x48c049){logger[_0xdfe9('0x28')](_0xdfe9('0x4f'),_0x48c049);throw _0x48c049;});}return _0x294bfe;})['then'](respondWithResult(_0x135c2e,0xc9))[_0xdfe9('0x47')](handleError(_0x135c2e,null));};exports['clone']=function(_0xa3a429,_0x23f3c0){var _0x39fb11={'where':{'id':_0xa3a429[_0xdfe9('0x48')]['id']}},_0x4321e1={};_0x4321e1[_0xdfe9('0x30')]=_[_0xdfe9('0x32')](db[_0xdfe9('0x2c')][_0xdfe9('0x2d')]);_0x39fb11['attributes']=_[_0xdfe9('0x34')](_0x4321e1[_0xdfe9('0x30')],qs[_0xdfe9('0x36')](_0xa3a429[_0xdfe9('0x31')][_0xdfe9('0x36')]));_0x39fb11['attributes']=_0x39fb11['attributes'][_0xdfe9('0x37')]?_0x39fb11[_0xdfe9('0x35')]:_0x4321e1[_0xdfe9('0x30')];if(_0xa3a429[_0xdfe9('0x31')][_0xdfe9('0x44')]){_0x39fb11[_0xdfe9('0x45')]=[{'all':!![]}];}_0x39fb11=_['merge']({},_0x39fb11,_0xa3a429[_0xdfe9('0x43')]);return db[_0xdfe9('0x2c')][_0xdfe9('0x49')](_0x39fb11)['then'](handleEntityNotFound(_0x23f3c0,null))['then'](function(_0x14ece0){if(_0x14ece0){var _0x5cd5ad=_0x14ece0['get']({'plain':!![]});_0x5cd5ad=qs[_0xdfe9('0x50')](_0x5cd5ad,['id','createdAt',_0xdfe9('0x51')]);_0xa3a429[_0xdfe9('0x4a')]=_['omit'](_0xa3a429[_0xdfe9('0x4a')],['id',_0xdfe9('0x52'),_0xdfe9('0x51')]);return db[_0xdfe9('0x2c')][_0xdfe9('0x4e')](_['merge'](_0x5cd5ad,_0xa3a429[_0xdfe9('0x4a')]),{'include':_0xa3a429['query'][_0xdfe9('0x44')]?[{'all':!![]}]:undefined})[_0xdfe9('0x24')](function(_0x853aec){var _0x462488=_0xa3a429[_0xdfe9('0x4b')]['get']({'plain':!![]});if(!_0x462488)throw new Error(_0xdfe9('0x53'));if(_0x462488[_0xdfe9('0x54')]==='user'){var _0x14cf63=_0x853aec[_0xdfe9('0x4c')]({'plain':!![]});var _0x3b9d23=_0xdfe9('0x26');return db[_0xdfe9('0x4d')][_0xdfe9('0x49')]({'where':{'name':_0x3b9d23,'userProfileId':_0x462488[_0xdfe9('0x55')]},'raw':!![]})[_0xdfe9('0x24')](function(_0x257c55){if(_0x257c55&&_0x257c55[_0xdfe9('0x56')]===0x0){return db[_0xdfe9('0x57')][_0xdfe9('0x4e')]({'name':_0x14cf63[_0xdfe9('0x29')],'resourceId':_0x14cf63['id'],'type':_0x257c55['name'],'sectionId':_0x257c55['id']},{})[_0xdfe9('0x24')](function(){return _0x853aec;});}else{return _0x853aec;}})[_0xdfe9('0x47')](function(_0x248130){logger[_0xdfe9('0x28')](_0xdfe9('0x4f'),_0x248130);throw _0x248130;});}return _0x853aec;});}})[_0xdfe9('0x24')](respondWithResult(_0x23f3c0,0xc9))[_0xdfe9('0x47')](handleError(_0x23f3c0,null));};exports[_0xdfe9('0x23')]=function(_0x40398d,_0x516f5b){if(_0x40398d[_0xdfe9('0x4a')]['id']){delete _0x40398d[_0xdfe9('0x4a')]['id'];}return db[_0xdfe9('0x2c')][_0xdfe9('0x49')]({'where':{'id':_0x40398d[_0xdfe9('0x48')]['id']}})[_0xdfe9('0x24')](handleEntityNotFound(_0x516f5b,null))[_0xdfe9('0x24')](saveUpdates(_0x40398d['body'],null))['then'](respondWithResult(_0x516f5b,null))[_0xdfe9('0x47')](handleError(_0x516f5b,null));};exports[_0xdfe9('0x25')]=function(_0x1473fc,_0x297299){return db[_0xdfe9('0x2c')][_0xdfe9('0x49')]({'where':{'id':_0x1473fc[_0xdfe9('0x48')]['id']}})[_0xdfe9('0x24')](handleEntityNotFound(_0x297299,null))[_0xdfe9('0x24')](removeEntity(_0x297299,null))['catch'](handleError(_0x297299,null));};exports[_0xdfe9('0x58')]=function(_0x5b49d2,_0x286f9f,_0x52664d){var _0x244815={'raw':!![],'where':{}};var _0x151ec4={};var _0x5a81f9={'count':0x0,'rows':[]};return db[_0xdfe9('0x2c')][_0xdfe9('0x59')]({'where':{'id':_0x5b49d2[_0xdfe9('0x48')]['id']}})[_0xdfe9('0x24')](handleEntityNotFound(_0x286f9f,null))['then'](function(_0x3edffd){if(_0x3edffd){_0x151ec4['model']=_['keys'](db[_0xdfe9('0x5a')][_0xdfe9('0x2d')]);_0x151ec4[_0xdfe9('0x31')]=_[_0xdfe9('0x32')](_0x5b49d2[_0xdfe9('0x31')]);_0x151ec4['filters']=_['intersection'](_0x151ec4[_0xdfe9('0x30')],_0x151ec4['query']);_0x244815[_0xdfe9('0x35')]=_[_0xdfe9('0x34')](_0x151ec4[_0xdfe9('0x30')],qs[_0xdfe9('0x36')](_0x5b49d2[_0xdfe9('0x31')]['fields']));_0x244815['attributes']=_0x244815['attributes']['length']?_0x244815['attributes']:_0x151ec4[_0xdfe9('0x30')];if(!_0x5b49d2[_0xdfe9('0x31')][_0xdfe9('0x38')]('nolimit')){_0x244815['limit']=qs[_0xdfe9('0x1f')](_0x5b49d2[_0xdfe9('0x31')][_0xdfe9('0x1f')]);_0x244815['offset']=qs[_0xdfe9('0x1d')](_0x5b49d2[_0xdfe9('0x31')]['offset']);}_0x244815[_0xdfe9('0x3a')]=qs[_0xdfe9('0x3b')](_0x5b49d2[_0xdfe9('0x31')][_0xdfe9('0x3b')]);_0x244815[_0xdfe9('0x3c')]=qs[_0xdfe9('0x33')](_['pick'](_0x5b49d2[_0xdfe9('0x31')],_0x151ec4['filters']));_0x244815[_0xdfe9('0x3c')][_0xdfe9('0x5b')]=_0x3edffd['id'];if(_0x5b49d2[_0xdfe9('0x31')]['filter']){_0x244815[_0xdfe9('0x3c')]=_[_0xdfe9('0x42')](_0x244815['where'],{'$or':_['map'](_0x244815['attributes'],function(_0x3d047d){var _0xe00480={};_0xe00480[_0x3d047d]={'$like':'%'+_0x5b49d2[_0xdfe9('0x31')][_0xdfe9('0x3e')]+'%'};return _0xe00480;})});}_0x244815=_[_0xdfe9('0x42')]({},_0x244815,_0x5b49d2[_0xdfe9('0x43')]);return db['CmHopper'][_0xdfe9('0x20')]({'where':_0x244815[_0xdfe9('0x3c')]})[_0xdfe9('0x24')](function(_0x3b663d){_0x5a81f9[_0xdfe9('0x20')]=_0x3b663d;if(_0x5b49d2[_0xdfe9('0x31')][_0xdfe9('0x44')]){_0x244815[_0xdfe9('0x45')]=[{'all':!![]}];}return db[_0xdfe9('0x5a')][_0xdfe9('0x5c')](_0x244815);})[_0xdfe9('0x24')](function(_0x1fdd11){_0x5a81f9['rows']=_0x1fdd11;return _0x5a81f9;});}})[_0xdfe9('0x24')](respondWithFilteredResult(_0x286f9f,_0x244815))[_0xdfe9('0x47')](handleError(_0x286f9f,null));};exports[_0xdfe9('0x5d')]=function(_0x6867cc,_0x13f5d0,_0x4f3889){var _0x5daa67={'raw':!![],'where':{}};var _0x45c791={};var _0x11a3b3={'count':0x0,'rows':[]};return db[_0xdfe9('0x2c')][_0xdfe9('0x59')]({'where':{'id':_0x6867cc[_0xdfe9('0x48')]['id']}})[_0xdfe9('0x24')](handleEntityNotFound(_0x13f5d0,null))['then'](function(_0x47f492){if(_0x47f492){_0x45c791[_0xdfe9('0x30')]=_[_0xdfe9('0x32')](db[_0xdfe9('0x5e')][_0xdfe9('0x2d')]);_0x45c791['query']=_[_0xdfe9('0x32')](_0x6867cc['query']);_0x45c791['filters']=_[_0xdfe9('0x34')](_0x45c791['model'],_0x45c791['query']);_0x5daa67[_0xdfe9('0x35')]=_[_0xdfe9('0x34')](_0x45c791[_0xdfe9('0x30')],qs[_0xdfe9('0x36')](_0x6867cc[_0xdfe9('0x31')][_0xdfe9('0x36')]));_0x5daa67[_0xdfe9('0x35')]=_0x5daa67['attributes'][_0xdfe9('0x37')]?_0x5daa67['attributes']:_0x45c791[_0xdfe9('0x30')];if(!_0x6867cc[_0xdfe9('0x31')][_0xdfe9('0x38')](_0xdfe9('0x39'))){_0x5daa67[_0xdfe9('0x1f')]=qs[_0xdfe9('0x1f')](_0x6867cc['query'][_0xdfe9('0x1f')]);_0x5daa67[_0xdfe9('0x1d')]=qs[_0xdfe9('0x1d')](_0x6867cc['query'][_0xdfe9('0x1d')]);}_0x5daa67[_0xdfe9('0x3a')]=qs['sort'](_0x6867cc[_0xdfe9('0x31')][_0xdfe9('0x3b')]);_0x5daa67[_0xdfe9('0x3c')]=qs[_0xdfe9('0x33')](_[_0xdfe9('0x3d')](_0x6867cc[_0xdfe9('0x31')],_0x45c791[_0xdfe9('0x33')]));_0x5daa67[_0xdfe9('0x3c')]['CampaignId']=_0x47f492['id'];if(_0x6867cc[_0xdfe9('0x31')]['filter']){_0x5daa67[_0xdfe9('0x3c')]=_['merge'](_0x5daa67[_0xdfe9('0x3c')],{'$or':_['map'](_0x5daa67[_0xdfe9('0x35')],function(_0x5ac036){var _0x7bbe02={};_0x7bbe02[_0x5ac036]={'$like':'%'+_0x6867cc['query']['filter']+'%'};return _0x7bbe02;})});}_0x5daa67=_[_0xdfe9('0x42')]({},_0x5daa67,_0x6867cc[_0xdfe9('0x43')]);return db[_0xdfe9('0x5e')][_0xdfe9('0x20')]({'where':_0x5daa67['where']})['then'](function(_0x5b6612){_0x11a3b3[_0xdfe9('0x20')]=_0x5b6612;if(_0x6867cc['query']['includeAll']){_0x5daa67[_0xdfe9('0x45')]=[{'all':!![]}];}return db[_0xdfe9('0x5e')]['findAll'](_0x5daa67);})[_0xdfe9('0x24')](function(_0x29a26f){_0x11a3b3[_0xdfe9('0x46')]=_0x29a26f;return _0x11a3b3;});}})[_0xdfe9('0x24')](respondWithFilteredResult(_0x13f5d0,_0x5daa67))[_0xdfe9('0x47')](handleError(_0x13f5d0,null));};exports['getHopperFinals']=function(_0x3a5455,_0x333322,_0x10fbfa){var _0x6fb70={'raw':!![],'where':{}};var _0x1d8c3f={};var _0x3e74b9={'count':0x0,'rows':[]};return db['Campaign'][_0xdfe9('0x59')]({'where':{'id':_0x3a5455[_0xdfe9('0x48')]['id']}})[_0xdfe9('0x24')](handleEntityNotFound(_0x333322,null))[_0xdfe9('0x24')](function(_0x5d6315){if(_0x5d6315){_0x1d8c3f['model']=_[_0xdfe9('0x32')](db['CmHopperFinal'][_0xdfe9('0x2d')]);_0x1d8c3f['query']=_['keys'](_0x3a5455['query']);_0x1d8c3f['filters']=_[_0xdfe9('0x34')](_0x1d8c3f[_0xdfe9('0x30')],_0x1d8c3f[_0xdfe9('0x31')]);_0x6fb70[_0xdfe9('0x35')]=_[_0xdfe9('0x34')](_0x1d8c3f[_0xdfe9('0x30')],qs[_0xdfe9('0x36')](_0x3a5455[_0xdfe9('0x31')][_0xdfe9('0x36')]));_0x6fb70[_0xdfe9('0x35')]=_0x6fb70[_0xdfe9('0x35')][_0xdfe9('0x37')]?_0x6fb70[_0xdfe9('0x35')]:_0x1d8c3f['model'];if(!_0x3a5455[_0xdfe9('0x31')][_0xdfe9('0x38')](_0xdfe9('0x39'))){_0x6fb70[_0xdfe9('0x1f')]=qs['limit'](_0x3a5455[_0xdfe9('0x31')]['limit']);_0x6fb70[_0xdfe9('0x1d')]=qs['offset'](_0x3a5455['query']['offset']);}_0x6fb70['order']=qs[_0xdfe9('0x3b')](_0x3a5455[_0xdfe9('0x31')][_0xdfe9('0x3b')]);_0x6fb70[_0xdfe9('0x3c')]=qs[_0xdfe9('0x33')](_['pick'](_0x3a5455['query'],_0x1d8c3f[_0xdfe9('0x33')]));_0x6fb70[_0xdfe9('0x3c')][_0xdfe9('0x5b')]=_0x5d6315['id'];if(_0x3a5455['query']['filter']){_0x6fb70[_0xdfe9('0x3c')]=_[_0xdfe9('0x42')](_0x6fb70[_0xdfe9('0x3c')],{'$or':_[_0xdfe9('0x3f')](_0x6fb70[_0xdfe9('0x35')],function(_0x52369f){var _0x1227ca={};_0x1227ca[_0x52369f]={'$like':'%'+_0x3a5455[_0xdfe9('0x31')][_0xdfe9('0x3e')]+'%'};return _0x1227ca;})});}_0x6fb70=_[_0xdfe9('0x42')]({},_0x6fb70,_0x3a5455[_0xdfe9('0x43')]);return db['CmHopperFinal'][_0xdfe9('0x20')]({'where':_0x6fb70['where']})[_0xdfe9('0x24')](function(_0x23c7f6){_0x3e74b9[_0xdfe9('0x20')]=_0x23c7f6;if(_0x3a5455[_0xdfe9('0x31')][_0xdfe9('0x44')]){_0x6fb70[_0xdfe9('0x45')]=[{'all':!![]}];}return db[_0xdfe9('0x5f')][_0xdfe9('0x5c')](_0x6fb70);})[_0xdfe9('0x24')](function(_0x4f5b21){_0x3e74b9[_0xdfe9('0x46')]=_0x4f5b21;return _0x3e74b9;});}})[_0xdfe9('0x24')](respondWithFilteredResult(_0x333322,_0x6fb70))[_0xdfe9('0x47')](handleError(_0x333322,null));};exports[_0xdfe9('0x60')]=function(_0x2222a1,_0x47bd0a,_0x42afb4){var _0x70c14a={'raw':!![],'where':{}};var _0x2ee7f5={};var _0x644a9c={'count':0x0,'rows':[]};return db[_0xdfe9('0x2c')]['findOne']({'where':{'id':_0x2222a1[_0xdfe9('0x48')]['id']}})[_0xdfe9('0x24')](handleEntityNotFound(_0x47bd0a,null))[_0xdfe9('0x24')](function(_0x47445f){if(_0x47445f){_0x2ee7f5[_0xdfe9('0x30')]=_['keys'](db[_0xdfe9('0x61')]['rawAttributes']);_0x2ee7f5['query']=_['keys'](_0x2222a1['query']);_0x2ee7f5['filters']=_[_0xdfe9('0x34')](_0x2ee7f5[_0xdfe9('0x30')],_0x2ee7f5[_0xdfe9('0x31')]);_0x70c14a[_0xdfe9('0x35')]=_['intersection'](_0x2ee7f5[_0xdfe9('0x30')],qs[_0xdfe9('0x36')](_0x2222a1[_0xdfe9('0x31')]['fields']));_0x70c14a[_0xdfe9('0x35')]=_0x70c14a[_0xdfe9('0x35')][_0xdfe9('0x37')]?_0x70c14a[_0xdfe9('0x35')]:_0x2ee7f5[_0xdfe9('0x30')];if(!_0x2222a1[_0xdfe9('0x31')][_0xdfe9('0x38')](_0xdfe9('0x39'))){_0x70c14a[_0xdfe9('0x1f')]=qs[_0xdfe9('0x1f')](_0x2222a1[_0xdfe9('0x31')][_0xdfe9('0x1f')]);_0x70c14a[_0xdfe9('0x1d')]=qs[_0xdfe9('0x1d')](_0x2222a1['query'][_0xdfe9('0x1d')]);}_0x70c14a['order']=qs[_0xdfe9('0x3b')](_0x2222a1[_0xdfe9('0x31')][_0xdfe9('0x3b')]);_0x70c14a[_0xdfe9('0x3c')]=qs[_0xdfe9('0x33')](_[_0xdfe9('0x3d')](_0x2222a1[_0xdfe9('0x31')],_0x2ee7f5[_0xdfe9('0x33')]));_0x70c14a['where'][_0xdfe9('0x5b')]=_0x47445f['id'];if(_0x2222a1['query'][_0xdfe9('0x3e')]){_0x70c14a[_0xdfe9('0x3c')]=_[_0xdfe9('0x42')](_0x70c14a[_0xdfe9('0x3c')],{'$or':_[_0xdfe9('0x3f')](_0x70c14a[_0xdfe9('0x35')],function(_0x183778){var _0x383c0f={};_0x383c0f[_0x183778]={'$like':'%'+_0x2222a1[_0xdfe9('0x31')]['filter']+'%'};return _0x383c0f;})});}_0x70c14a=_[_0xdfe9('0x42')]({},_0x70c14a,_0x2222a1[_0xdfe9('0x43')]);return db[_0xdfe9('0x61')][_0xdfe9('0x20')]({'where':_0x70c14a[_0xdfe9('0x3c')]})[_0xdfe9('0x24')](function(_0x37d197){_0x644a9c['count']=_0x37d197;if(_0x2222a1[_0xdfe9('0x31')]['includeAll']){_0x70c14a[_0xdfe9('0x45')]=[{'all':!![]}];}return db[_0xdfe9('0x61')][_0xdfe9('0x5c')](_0x70c14a);})['then'](function(_0x4a5a6d){_0x644a9c[_0xdfe9('0x46')]=_0x4a5a6d;return _0x644a9c;});}})[_0xdfe9('0x24')](respondWithFilteredResult(_0x47bd0a,_0x70c14a))[_0xdfe9('0x47')](handleError(_0x47bd0a,null));};exports[_0xdfe9('0x62')]=function(_0x29d1ba,_0x1fbfa8,_0x34d1e0){var _0x20c20f={};var _0x43f699={};var _0xfe4776;var _0x12cacb;return db[_0xdfe9('0x2c')][_0xdfe9('0x59')]({'where':{'id':_0x29d1ba[_0xdfe9('0x48')]['id']}})[_0xdfe9('0x24')](handleEntityNotFound(_0x1fbfa8,null))[_0xdfe9('0x24')](function(_0x3497b2){if(_0x3497b2){_0xfe4776=_0x3497b2;_0x43f699[_0xdfe9('0x30')]=_[_0xdfe9('0x32')](db[_0xdfe9('0x63')][_0xdfe9('0x2d')]);_0x43f699[_0xdfe9('0x31')]=_['keys'](_0x29d1ba[_0xdfe9('0x31')]);_0x43f699[_0xdfe9('0x33')]=_[_0xdfe9('0x34')](_0x43f699[_0xdfe9('0x30')],_0x43f699[_0xdfe9('0x31')]);_0x20c20f['attributes']=_[_0xdfe9('0x34')](_0x43f699['model'],qs[_0xdfe9('0x36')](_0x29d1ba['query'][_0xdfe9('0x36')]));_0x20c20f['attributes']=_0x20c20f[_0xdfe9('0x35')][_0xdfe9('0x37')]?_0x20c20f['attributes']:_0x43f699[_0xdfe9('0x30')];_0x20c20f[_0xdfe9('0x3a')]=qs[_0xdfe9('0x3b')](_0x29d1ba[_0xdfe9('0x31')][_0xdfe9('0x3b')]);_0x20c20f[_0xdfe9('0x3c')]=qs[_0xdfe9('0x33')](_[_0xdfe9('0x3d')](_0x29d1ba[_0xdfe9('0x31')],_0x43f699['filters']));if(_0x29d1ba['query'][_0xdfe9('0x3e')]){_0x20c20f[_0xdfe9('0x3c')]=_[_0xdfe9('0x42')](_0x20c20f[_0xdfe9('0x3c')],{'$or':_[_0xdfe9('0x3f')](_0x20c20f[_0xdfe9('0x35')],function(_0x39bd29){var _0x5b2245={};_0x5b2245[_0x39bd29]={'$like':'%'+_0x29d1ba['query'][_0xdfe9('0x3e')]+'%'};return _0x5b2245;})});}_0x20c20f=_[_0xdfe9('0x42')]({},_0x20c20f,_0x29d1ba[_0xdfe9('0x43')]);return _0xfe4776['getLists'](_0x20c20f);}})[_0xdfe9('0x24')](function(_0x3659c3){if(_0x3659c3){_0x12cacb=_0x3659c3[_0xdfe9('0x37')];if(!_0x29d1ba[_0xdfe9('0x31')]['hasOwnProperty'](_0xdfe9('0x39'))){_0x20c20f[_0xdfe9('0x1f')]=qs[_0xdfe9('0x1f')](_0x29d1ba[_0xdfe9('0x31')][_0xdfe9('0x1f')]);_0x20c20f[_0xdfe9('0x1d')]=qs[_0xdfe9('0x1d')](_0x29d1ba[_0xdfe9('0x31')][_0xdfe9('0x1d')]);}return _0xfe4776['getLists'](_0x20c20f);}})[_0xdfe9('0x24')](function(_0x963b24){if(_0x963b24){return _0x963b24?{'count':_0x12cacb,'rows':_0x963b24}:null;}})[_0xdfe9('0x24')](respondWithResult(_0x1fbfa8,null))[_0xdfe9('0x47')](handleError(_0x1fbfa8,null));};exports[_0xdfe9('0x64')]=function(_0x5a88e0,_0x59e7c5,_0x516f58){var _0x1e966a,_0x4c0d52;var _0x3a17f9=[];var _0x2c4465=moment()[_0xdfe9('0x65')](_0xdfe9('0x66'));return db['Campaign'][_0xdfe9('0x49')]({'where':{'id':_0x5a88e0['params']['id']}})[_0xdfe9('0x24')](handleEntityNotFound(_0x59e7c5,null))[_0xdfe9('0x24')](function(_0x3cff83){if(_0x3cff83){_0x4c0d52=_0x3cff83;return _0x3cff83['addLists'](_0x5a88e0[_0xdfe9('0x4a')][_0xdfe9('0x67')],_['omit'](_0x5a88e0['body'],[_0xdfe9('0x67'),'id'])||{});}return null;})[_0xdfe9('0x68')](function(_0x309c5e){var _0x18a7aa;var _0x38e824;_0x1e966a=_0x309c5e||[];var _0x921f32=[];if(_0x309c5e){for(var _0x33b451=0x0;_0x33b451<_0x309c5e[_0xdfe9('0x37')];_0x33b451+=0x1){var _0x2b1658=_0x309c5e[_0x33b451][_0xdfe9('0x4c')]({'plain':!![]});_0x4c0d52[_0xdfe9('0x69')]=_0x5a88e0[_0xdfe9('0x4a')]['dialCheckDuplicateType']?_0x5a88e0[_0xdfe9('0x4a')][_0xdfe9('0x69')]:_0x4c0d52[_0xdfe9('0x69')];switch(_0x4c0d52[_0xdfe9('0x69')]){case _0xdfe9('0x6a'):_0x18a7aa=squel[_0xdfe9('0x6b')]()[_0xdfe9('0x6c')](_0xdfe9('0x6d'))[_0xdfe9('0x6e')]([_0xdfe9('0x6f'),_0xdfe9('0x70'),_0xdfe9('0x71'),_0xdfe9('0x72'),'CampaignId',_0xdfe9('0x52'),_0xdfe9('0x51')],squel[_0xdfe9('0x73')]()[_0xdfe9('0x74')]('phone',_0xdfe9('0x6f'))[_0xdfe9('0x74')](_0xdfe9('0x75'),_0xdfe9('0x70'))['field']('id',_0xdfe9('0x71'))[_0xdfe9('0x74')](_0x2b1658[_0xdfe9('0x76')]['toString'](),_0xdfe9('0x72'))[_0xdfe9('0x74')](_0x5a88e0[_0xdfe9('0x48')]['id']['toString'](),_0xdfe9('0x5b'))['field']('\x27'+_0x2c4465+'\x27','createdAt')[_0xdfe9('0x74')]('\x27'+_0x2c4465+'\x27',_0xdfe9('0x51'))[_0xdfe9('0x77')](_0xdfe9('0x78'))['where'](_0xdfe9('0x79'))[_0xdfe9('0x3c')](_0xdfe9('0x7a'),_0x2b1658[_0xdfe9('0x76')][_0xdfe9('0x7b')]())['where'](_0xdfe9('0x7c'))[_0xdfe9('0x3c')](_0xdfe9('0x7d'),squel[_0xdfe9('0x73')]()['field'](_0xdfe9('0x7e'))['from'](_0xdfe9('0x7f'))[_0xdfe9('0x3c')](_0xdfe9('0x80'),_0x5a88e0[_0xdfe9('0x48')]['id']['toString']()))[_0xdfe9('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xdfe9('0x73')]()['field'](_0xdfe9('0x81'))[_0xdfe9('0x77')]('cm_hopper')[_0xdfe9('0x3c')](_0xdfe9('0x80'),_0x5a88e0[_0xdfe9('0x48')]['id'][_0xdfe9('0x7b')]())))[_0xdfe9('0x7b')]();break;case _0xdfe9('0x82'):_0x18a7aa=squel['insert']()[_0xdfe9('0x6c')](_0xdfe9('0x6d'))['fromQuery']([_0xdfe9('0x6f'),_0xdfe9('0x70'),_0xdfe9('0x71'),_0xdfe9('0x72'),_0xdfe9('0x5b'),_0xdfe9('0x52'),_0xdfe9('0x51')],squel[_0xdfe9('0x73')]()[_0xdfe9('0x74')](_0xdfe9('0x6f'),_0xdfe9('0x6f'))[_0xdfe9('0x74')](_0xdfe9('0x75'),_0xdfe9('0x70'))['field']('id',_0xdfe9('0x71'))[_0xdfe9('0x74')](_0x2b1658[_0xdfe9('0x76')][_0xdfe9('0x7b')](),_0xdfe9('0x72'))[_0xdfe9('0x74')](_0x5a88e0[_0xdfe9('0x48')]['id'][_0xdfe9('0x7b')](),_0xdfe9('0x5b'))['field']('\x27'+_0x2c4465+'\x27',_0xdfe9('0x52'))['field']('\x27'+_0x2c4465+'\x27',_0xdfe9('0x51'))['from'](_0xdfe9('0x78'))[_0xdfe9('0x3c')](_0xdfe9('0x79'))[_0xdfe9('0x3c')]('ListId\x20=\x20?',_0x2b1658['CmListId']['toString']())[_0xdfe9('0x3c')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xdfe9('0x73')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0xdfe9('0x6d'))[_0xdfe9('0x3c')](_0xdfe9('0x80'),_0x5a88e0[_0xdfe9('0x48')]['id'][_0xdfe9('0x7b')]())))[_0xdfe9('0x7b')]();break;default:_0x18a7aa=squel[_0xdfe9('0x6b')]()[_0xdfe9('0x6c')]('cm_hopper')[_0xdfe9('0x6e')]([_0xdfe9('0x6f'),_0xdfe9('0x70'),_0xdfe9('0x71'),'ListId','CampaignId',_0xdfe9('0x52'),_0xdfe9('0x51')],squel[_0xdfe9('0x73')]()['field'](_0xdfe9('0x6f'),_0xdfe9('0x6f'))[_0xdfe9('0x74')](_0xdfe9('0x75'),_0xdfe9('0x70'))[_0xdfe9('0x74')]('id',_0xdfe9('0x71'))['field'](_0x2b1658[_0xdfe9('0x76')][_0xdfe9('0x7b')](),_0xdfe9('0x72'))['field'](_0x5a88e0[_0xdfe9('0x48')]['id'][_0xdfe9('0x7b')](),'CampaignId')['field']('\x27'+_0x2c4465+'\x27','createdAt')[_0xdfe9('0x74')]('\x27'+_0x2c4465+'\x27',_0xdfe9('0x51'))['from'](_0xdfe9('0x78'))[_0xdfe9('0x3c')](_0xdfe9('0x79'))[_0xdfe9('0x3c')](_0xdfe9('0x7a'),_0x2b1658['CmListId'][_0xdfe9('0x7b')]())[_0xdfe9('0x3c')](_0xdfe9('0x7c')))['toString']();}_0x38e824=squel[_0xdfe9('0x6b')]()['into'](_0xdfe9('0x83'))[_0xdfe9('0x6e')]([_0xdfe9('0x84'),_0xdfe9('0x70'),_0xdfe9('0x6f'),_0xdfe9('0x85'),'createdAt',_0xdfe9('0x51')],squel[_0xdfe9('0x73')]()[_0xdfe9('0x74')](_0xdfe9('0x86'),'id')[_0xdfe9('0x74')](_0xdfe9('0x75'),_0xdfe9('0x70'))[_0xdfe9('0x74')]('ci.item',_0xdfe9('0x6f'))[_0xdfe9('0x74')]('ci.OrderBY',_0xdfe9('0x85'))[_0xdfe9('0x74')]('\x27'+_0x2c4465+'\x27',_0xdfe9('0x52'))['field']('\x27'+_0x2c4465+'\x27',_0xdfe9('0x51'))[_0xdfe9('0x77')]('cm_contact_has_items','ci')[_0xdfe9('0x87')](_0xdfe9('0x6d'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0xdfe9('0x3c')](_0xdfe9('0x88'),_0x2b1658[_0xdfe9('0x76')][_0xdfe9('0x7b')]())[_0xdfe9('0x3c')](_0xdfe9('0x89'),_0x5a88e0[_0xdfe9('0x48')]['id']['toString']())['where'](_0xdfe9('0x8a'),_0x2c4465))[_0xdfe9('0x7b')]();_0x921f32[_0xdfe9('0x8b')](db['sequelize'][_0xdfe9('0x31')](_0x18a7aa));_0x3a17f9[_0xdfe9('0x8b')](db[_0xdfe9('0x8c')][_0xdfe9('0x31')](_0x38e824));}return BPromise[_0xdfe9('0x8d')](_0x921f32);}})[_0xdfe9('0x24')](function(){return BPromise[_0xdfe9('0x8d')](_0x3a17f9);})[_0xdfe9('0x24')](function(){return _0x1e966a;})[_0xdfe9('0x24')](respondWithResult(_0x59e7c5,null))[_0xdfe9('0x47')](handleError(_0x59e7c5,null));};exports['removeLists']=function(_0x215d4f,_0x38952f,_0x55b14b){return db[_0xdfe9('0x2c')][_0xdfe9('0x49')]({'where':{'id':_0x215d4f[_0xdfe9('0x48')]['id']}})['then'](handleEntityNotFound(_0x38952f,null))['then'](function(_0x26515a){if(_0x26515a){return _0x26515a[_0xdfe9('0x8e')](_0x215d4f[_0xdfe9('0x31')][_0xdfe9('0x67')]);}})[_0xdfe9('0x24')](function(_0x543f25){if(_0x543f25){return db[_0xdfe9('0x5a')]['destroy']({'where':{'ListId':_0x215d4f[_0xdfe9('0x31')][_0xdfe9('0x67')],'CampaignId':_0x215d4f['params']['id']}})[_0xdfe9('0x24')](function(){return _0x543f25;});}})[_0xdfe9('0x24')](respondWithStatusCode(_0x38952f,null))[_0xdfe9('0x47')](handleError(_0x38952f,null));};exports['getBlackLists']=function(_0x2f7e78,_0x28d82c,_0x5b281d){var _0x614696={};var _0x9ec0b5={};var _0x4fb996;var _0x2332c3;return db[_0xdfe9('0x2c')][_0xdfe9('0x59')]({'where':{'id':_0x2f7e78[_0xdfe9('0x48')]['id']}})[_0xdfe9('0x24')](handleEntityNotFound(_0x28d82c,null))[_0xdfe9('0x24')](function(_0x4e2be3){if(_0x4e2be3){_0x4fb996=_0x4e2be3;_0x9ec0b5[_0xdfe9('0x30')]=_['keys'](db[_0xdfe9('0x63')][_0xdfe9('0x2d')]);_0x9ec0b5['query']=_[_0xdfe9('0x32')](_0x2f7e78['query']);_0x9ec0b5['filters']=_['intersection'](_0x9ec0b5[_0xdfe9('0x30')],_0x9ec0b5[_0xdfe9('0x31')]);_0x614696[_0xdfe9('0x35')]=_[_0xdfe9('0x34')](_0x9ec0b5[_0xdfe9('0x30')],qs[_0xdfe9('0x36')](_0x2f7e78[_0xdfe9('0x31')][_0xdfe9('0x36')]));_0x614696[_0xdfe9('0x35')]=_0x614696['attributes']['length']?_0x614696[_0xdfe9('0x35')]:_0x9ec0b5[_0xdfe9('0x30')];_0x614696[_0xdfe9('0x3a')]=qs['sort'](_0x2f7e78[_0xdfe9('0x31')][_0xdfe9('0x3b')]);_0x614696[_0xdfe9('0x3c')]=qs[_0xdfe9('0x33')](_[_0xdfe9('0x3d')](_0x2f7e78['query'],_0x9ec0b5['filters']));if(_0x2f7e78['query'][_0xdfe9('0x3e')]){_0x614696[_0xdfe9('0x3c')]=_[_0xdfe9('0x42')](_0x614696[_0xdfe9('0x3c')],{'$or':_[_0xdfe9('0x3f')](_0x614696[_0xdfe9('0x35')],function(_0xa15c32){var _0x5916ff={};_0x5916ff[_0xa15c32]={'$like':'%'+_0x2f7e78[_0xdfe9('0x31')][_0xdfe9('0x3e')]+'%'};return _0x5916ff;})});}_0x614696=_[_0xdfe9('0x42')]({},_0x614696,_0x2f7e78[_0xdfe9('0x43')]);return _0x4fb996[_0xdfe9('0x8f')](_0x614696);}})[_0xdfe9('0x24')](function(_0xb76bc3){if(_0xb76bc3){_0x2332c3=_0xb76bc3[_0xdfe9('0x37')];if(!_0x2f7e78[_0xdfe9('0x31')][_0xdfe9('0x38')](_0xdfe9('0x39'))){_0x614696[_0xdfe9('0x1f')]=qs['limit'](_0x2f7e78[_0xdfe9('0x31')][_0xdfe9('0x1f')]);_0x614696[_0xdfe9('0x1d')]=qs[_0xdfe9('0x1d')](_0x2f7e78[_0xdfe9('0x31')][_0xdfe9('0x1d')]);}return _0x4fb996[_0xdfe9('0x8f')](_0x614696);}})['then'](function(_0x2b0b36){if(_0x2b0b36){return _0x2b0b36?{'count':_0x2332c3,'rows':_0x2b0b36}:null;}})['then'](respondWithResult(_0x28d82c,null))[_0xdfe9('0x47')](handleError(_0x28d82c,null));};exports[_0xdfe9('0x90')]=function(_0x303d8c,_0x590a4a,_0x339611){var _0x3f6634,_0x4367f4;var _0x1ecb7f=[];var _0x1c79cc=moment()['format'](_0xdfe9('0x66'));return db['Campaign']['find']({'where':{'id':_0x303d8c[_0xdfe9('0x48')]['id']}})['then'](handleEntityNotFound(_0x590a4a,null))[_0xdfe9('0x24')](function(_0x1eac90){if(_0x1eac90){_0x4367f4=_0x1eac90;return _0x1eac90['addBlackLists'](_0x303d8c['body']['ids'],_['omit'](_0x303d8c['body'],[_0xdfe9('0x67'),'id'])||{});}return null;})[_0xdfe9('0x68')](function(_0x56ccdb){var _0x45c1df;var _0x540805;_0x3f6634=_0x56ccdb||[];var _0x7d2342=[];if(_0x56ccdb){for(var _0x5b6545=0x0;_0x5b6545<_0x56ccdb[_0xdfe9('0x37')];_0x5b6545+=0x1){var _0x409576=_0x56ccdb[_0x5b6545]['get']({'plain':!![]});_0x45c1df=squel[_0xdfe9('0x6b')]()[_0xdfe9('0x6c')](_0xdfe9('0x91'))[_0xdfe9('0x6e')](['phone',_0xdfe9('0x71'),_0xdfe9('0x72'),_0xdfe9('0x5b'),'createdAt',_0xdfe9('0x51')],squel[_0xdfe9('0x73')]()[_0xdfe9('0x74')](_0xdfe9('0x6f'),_0xdfe9('0x6f'))[_0xdfe9('0x74')]('id',_0xdfe9('0x71'))['field'](_0x409576[_0xdfe9('0x76')]['toString'](),_0xdfe9('0x72'))[_0xdfe9('0x74')](_0x303d8c[_0xdfe9('0x48')]['id'][_0xdfe9('0x7b')](),_0xdfe9('0x5b'))[_0xdfe9('0x74')](_0xdfe9('0x75'),_0xdfe9('0x52'))[_0xdfe9('0x74')](_0xdfe9('0x75'),_0xdfe9('0x51'))[_0xdfe9('0x77')](_0xdfe9('0x78'))['where'](_0xdfe9('0x79'))[_0xdfe9('0x3c')](_0xdfe9('0x7a'),_0x409576[_0xdfe9('0x76')][_0xdfe9('0x7b')]())[_0xdfe9('0x3c')](_0xdfe9('0x7c')))[_0xdfe9('0x7b')]();_0x7d2342[_0xdfe9('0x8b')](db['sequelize']['query'](_0x45c1df));}return BPromise[_0xdfe9('0x8d')](_0x7d2342);}})[_0xdfe9('0x24')](function(){return _0x3f6634;})['then'](respondWithResult(_0x590a4a,null))[_0xdfe9('0x47')](handleError(_0x590a4a,null));};exports[_0xdfe9('0x92')]=function(_0xb88fd6,_0x38397b,_0x46e935){return db[_0xdfe9('0x2c')][_0xdfe9('0x49')]({'where':{'id':_0xb88fd6[_0xdfe9('0x48')]['id']}})[_0xdfe9('0x24')](handleEntityNotFound(_0x38397b,null))['then'](function(_0x4ce120){if(_0x4ce120){return _0x4ce120[_0xdfe9('0x92')](_0xb88fd6['query'][_0xdfe9('0x67')]);}})[_0xdfe9('0x24')](function(_0x81dc1e){if(_0x81dc1e){return db[_0xdfe9('0x61')][_0xdfe9('0x25')]({'where':{'ListId':_0xb88fd6[_0xdfe9('0x31')][_0xdfe9('0x67')],'CampaignId':_0xb88fd6['params']['id']}})[_0xdfe9('0x24')](function(){return _0x81dc1e;});}})[_0xdfe9('0x24')](respondWithStatusCode(_0x38397b,null))[_0xdfe9('0x47')](handleError(_0x38397b,null));}; \ No newline at end of file +var _0x2cbd=['../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','reject','save','update','then','destroy','get','IvrCampaigns','error','stack','name','send','index','map','Campaign','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','role','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','getHoppers','findOne','nolimit','order','filter','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CampaignId','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','field','NOW()','scheduledAt','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_contacts','COALESCE(phone,\x27\x27)','cmHopperId','OrderBy','h.id','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','sequelize','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','push','all','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2a3843,_0x53494e){var _0x1506ca=function(_0x1be6cc){while(--_0x1be6cc){_0x2a3843['push'](_0x2a3843['shift']());}};_0x1506ca(++_0x53494e);}(_0x2cbd,0x19e));var _0xd2cb=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x2cbd[_0x470bfb];return _0x2f5d97;};'use strict';var emlformat=require(_0xd2cb('0x0'));var rimraf=require(_0xd2cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd2cb('0x2'));var rp=require(_0xd2cb('0x3'));var moment=require(_0xd2cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd2cb('0x5'));var util=require(_0xd2cb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd2cb('0x7'));var ejs=require(_0xd2cb('0x8'));var fs=require('fs');var fs_extra=require(_0xd2cb('0x9'));var _=require(_0xd2cb('0xa'));var squel=require('squel');var crypto=require(_0xd2cb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd2cb('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd2cb('0xd'));var Papa=require(_0xd2cb('0xe'));var Redis=require('ioredis');var authService=require(_0xd2cb('0xf'));var qs=require(_0xd2cb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd2cb('0x11'));var logger=require(_0xd2cb('0x12'))(_0xd2cb('0x13'));var utils=require(_0xd2cb('0x14'));var config=require(_0xd2cb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd2cb('0x16'))['db'];function respondWithStatusCode(_0x3f6903,_0x62c951){_0x62c951=_0x62c951||0xcc;return function(_0x1ae36a){if(_0x1ae36a){return _0x3f6903[_0xd2cb('0x17')](_0x62c951);}return _0x3f6903['status'](_0x62c951)[_0xd2cb('0x18')]();};}function respondWithResult(_0xd25e16,_0x1e1ad5){_0x1e1ad5=_0x1e1ad5||0xc8;return function(_0x57e0c9){if(_0x57e0c9){return _0xd25e16[_0xd2cb('0x19')](_0x1e1ad5)[_0xd2cb('0x1a')](_0x57e0c9);}};}function respondWithFilteredResult(_0x501e19,_0x33538d){return function(_0x4ef741){if(_0x4ef741){var _0x4e02f7=typeof _0x33538d[_0xd2cb('0x1b')]===_0xd2cb('0x1c')&&typeof _0x33538d[_0xd2cb('0x1d')]===_0xd2cb('0x1c');var _0x498e27=_0x4ef741['count'];var _0x2f41d1=_0x4e02f7?0x0:_0x33538d[_0xd2cb('0x1b')];var _0x5871e5=_0x4e02f7?_0x4ef741[_0xd2cb('0x1e')]:_0x33538d[_0xd2cb('0x1b')]+_0x33538d[_0xd2cb('0x1d')];var _0x5d385a;if(_0x5871e5>=_0x498e27){_0x5871e5=_0x498e27;_0x5d385a=0xc8;}else{_0x5d385a=0xce;}_0x501e19[_0xd2cb('0x19')](_0x5d385a);return _0x501e19['set']('Content-Range',_0x2f41d1+'-'+_0x5871e5+'/'+_0x498e27)[_0xd2cb('0x1a')](_0x4ef741);}return null;};}function patchUpdates(_0x190cbb){return function(_0x4643a0){try{jsonpatch['apply'](_0x4643a0,_0x190cbb,!![]);}catch(_0x34c00a){return BPromise[_0xd2cb('0x1f')](_0x34c00a);}return _0x4643a0[_0xd2cb('0x20')]();};}function saveUpdates(_0x4618f1,_0x27badc){return function(_0x43154a){if(_0x43154a){return _0x43154a[_0xd2cb('0x21')](_0x4618f1)[_0xd2cb('0x22')](function(_0x5d1499){return _0x5d1499;});}return null;};}function removeEntity(_0x37333a,_0x29f8f0){return function(_0x5dfca2){if(_0x5dfca2){return _0x5dfca2[_0xd2cb('0x23')]()[_0xd2cb('0x22')](function(){var _0x138498=_0x5dfca2[_0xd2cb('0x24')]({'plain':!![]});var _0x46a378=_0xd2cb('0x25');return db['UserProfileResource'][_0xd2cb('0x23')]({'where':{'type':_0x46a378,'resourceId':_0x138498['id']}})['then'](function(){return _0x5dfca2;});})['then'](function(){_0x37333a['status'](0xcc)[_0xd2cb('0x18')]();});}};}function handleEntityNotFound(_0x37cb5e,_0x35ac19){return function(_0x9b502c){if(!_0x9b502c){_0x37cb5e['sendStatus'](0x194);}return _0x9b502c;};}function handleError(_0x30214e,_0x45f762){_0x45f762=_0x45f762||0x1f4;return function(_0xd28ae7){logger[_0xd2cb('0x26')](_0xd28ae7[_0xd2cb('0x27')]);if(_0xd28ae7[_0xd2cb('0x28')]){delete _0xd28ae7[_0xd2cb('0x28')];}_0x30214e[_0xd2cb('0x19')](_0x45f762)[_0xd2cb('0x29')](_0xd28ae7);};}exports[_0xd2cb('0x2a')]=function(_0x568340,_0x3b4b77){var _0x2b6b77={},_0x58e894={},_0x1c3486={'count':0x0,'rows':[]};var _0xfe4dc3=_[_0xd2cb('0x2b')](db[_0xd2cb('0x2c')]['rawAttributes'],function(_0x5af5c8){return{'name':_0x5af5c8[_0xd2cb('0x2d')],'type':_0x5af5c8[_0xd2cb('0x2e')][_0xd2cb('0x2f')]};});_0x58e894[_0xd2cb('0x30')]=_[_0xd2cb('0x2b')](_0xfe4dc3,'name');_0x58e894[_0xd2cb('0x31')]=_[_0xd2cb('0x32')](_0x568340[_0xd2cb('0x31')]);_0x58e894[_0xd2cb('0x33')]=_[_0xd2cb('0x34')](_0x58e894[_0xd2cb('0x30')],_0x58e894[_0xd2cb('0x31')]);_0x2b6b77[_0xd2cb('0x35')]=_['intersection'](_0x58e894[_0xd2cb('0x30')],qs['fields'](_0x568340[_0xd2cb('0x31')][_0xd2cb('0x36')]));_0x2b6b77[_0xd2cb('0x35')]=_0x2b6b77[_0xd2cb('0x35')][_0xd2cb('0x37')]?_0x2b6b77[_0xd2cb('0x35')]:_0x58e894[_0xd2cb('0x30')];if(!_0x568340['query'][_0xd2cb('0x38')]('nolimit')){_0x2b6b77['limit']=qs[_0xd2cb('0x1d')](_0x568340[_0xd2cb('0x31')][_0xd2cb('0x1d')]);_0x2b6b77['offset']=qs[_0xd2cb('0x1b')](_0x568340['query'][_0xd2cb('0x1b')]);}_0x2b6b77['order']=qs['sort'](_0x568340[_0xd2cb('0x31')][_0xd2cb('0x39')]);_0x2b6b77[_0xd2cb('0x3a')]=qs[_0xd2cb('0x33')](_[_0xd2cb('0x3b')](_0x568340[_0xd2cb('0x31')],_0x58e894[_0xd2cb('0x33')]),_0xfe4dc3);if(_0x568340['query']['filter']){_0x2b6b77[_0xd2cb('0x3a')]=_[_0xd2cb('0x3c')](_0x2b6b77[_0xd2cb('0x3a')],{'$or':_[_0xd2cb('0x2b')](_0xfe4dc3,function(_0x3d6077){if(_0x3d6077['type']!==_0xd2cb('0x3d')){var _0x58bdbb={};_0x58bdbb[_0x3d6077['name']]={'$like':'%'+_0x568340[_0xd2cb('0x31')]['filter']+'%'};return _0x58bdbb;}})});}_0x2b6b77=_[_0xd2cb('0x3c')]({},_0x2b6b77,_0x568340[_0xd2cb('0x3e')]);var _0x5647b8={'where':_0x2b6b77[_0xd2cb('0x3a')]};return db[_0xd2cb('0x2c')][_0xd2cb('0x1e')](_0x5647b8)[_0xd2cb('0x22')](function(_0x260450){_0x1c3486['count']=_0x260450;if(_0x568340[_0xd2cb('0x31')][_0xd2cb('0x3f')]){_0x2b6b77[_0xd2cb('0x40')]=[{'all':!![]}];}return db[_0xd2cb('0x2c')][_0xd2cb('0x41')](_0x2b6b77);})[_0xd2cb('0x22')](function(_0x26e204){_0x1c3486[_0xd2cb('0x42')]=_0x26e204;return _0x1c3486;})['then'](respondWithFilteredResult(_0x3b4b77,_0x2b6b77))[_0xd2cb('0x43')](handleError(_0x3b4b77,null));};exports[_0xd2cb('0x44')]=function(_0x1f5621,_0x38733c){var _0x6a3c8d={'raw':![],'where':{'id':_0x1f5621[_0xd2cb('0x45')]['id']}},_0x11ccc5={};_0x11ccc5[_0xd2cb('0x30')]=_[_0xd2cb('0x32')](db['Campaign'][_0xd2cb('0x46')]);_0x11ccc5[_0xd2cb('0x31')]=_[_0xd2cb('0x32')](_0x1f5621[_0xd2cb('0x31')]);_0x11ccc5[_0xd2cb('0x33')]=_['intersection'](_0x11ccc5[_0xd2cb('0x30')],_0x11ccc5[_0xd2cb('0x31')]);_0x6a3c8d[_0xd2cb('0x35')]=_[_0xd2cb('0x34')](_0x11ccc5['model'],qs[_0xd2cb('0x36')](_0x1f5621[_0xd2cb('0x31')][_0xd2cb('0x36')]));_0x6a3c8d['attributes']=_0x6a3c8d[_0xd2cb('0x35')][_0xd2cb('0x37')]?_0x6a3c8d[_0xd2cb('0x35')]:_0x11ccc5[_0xd2cb('0x30')];if(_0x1f5621[_0xd2cb('0x31')]['includeAll']){_0x6a3c8d[_0xd2cb('0x40')]=[{'all':!![]}];}_0x6a3c8d=_[_0xd2cb('0x3c')]({},_0x6a3c8d,_0x1f5621['options']);return db[_0xd2cb('0x2c')]['find'](_0x6a3c8d)[_0xd2cb('0x22')](handleEntityNotFound(_0x38733c,null))[_0xd2cb('0x22')](respondWithResult(_0x38733c,null))[_0xd2cb('0x43')](handleError(_0x38733c,null));};exports[_0xd2cb('0x47')]=function(_0x1e716b,_0x3d6d4d){return db[_0xd2cb('0x2c')]['create'](_0x1e716b['body'],{})['then'](function(_0x57bd98){var _0x1a57f0=_0x1e716b['user'][_0xd2cb('0x24')]({'plain':!![]});if(!_0x1a57f0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a57f0[_0xd2cb('0x48')]===_0xd2cb('0x49')){var _0x2eea67=_0x57bd98[_0xd2cb('0x24')]({'plain':!![]});var _0x4bc134='IvrCampaigns';return db[_0xd2cb('0x4a')][_0xd2cb('0x4b')]({'where':{'name':_0x4bc134,'userProfileId':_0x1a57f0['userProfileId']},'raw':!![]})['then'](function(_0x3ec8a7){if(_0x3ec8a7&&_0x3ec8a7['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2eea67[_0xd2cb('0x28')],'resourceId':_0x2eea67['id'],'type':_0x3ec8a7[_0xd2cb('0x28')],'sectionId':_0x3ec8a7['id']},{})[_0xd2cb('0x22')](function(){return _0x57bd98;});}else{return _0x57bd98;}})[_0xd2cb('0x43')](function(_0xee02d4){logger[_0xd2cb('0x26')](_0xd2cb('0x4c'),_0xee02d4);throw _0xee02d4;});}return _0x57bd98;})[_0xd2cb('0x22')](respondWithResult(_0x3d6d4d,0xc9))[_0xd2cb('0x43')](handleError(_0x3d6d4d,null));};exports[_0xd2cb('0x4d')]=function(_0x14dced,_0xd7af1f){var _0x540dd3={'where':{'id':_0x14dced[_0xd2cb('0x45')]['id']}},_0x100fc8={};_0x100fc8[_0xd2cb('0x30')]=_[_0xd2cb('0x32')](db[_0xd2cb('0x2c')][_0xd2cb('0x46')]);_0x540dd3[_0xd2cb('0x35')]=_['intersection'](_0x100fc8[_0xd2cb('0x30')],qs[_0xd2cb('0x36')](_0x14dced[_0xd2cb('0x31')]['fields']));_0x540dd3['attributes']=_0x540dd3[_0xd2cb('0x35')][_0xd2cb('0x37')]?_0x540dd3[_0xd2cb('0x35')]:_0x100fc8[_0xd2cb('0x30')];if(_0x14dced[_0xd2cb('0x31')][_0xd2cb('0x3f')]){_0x540dd3['include']=[{'all':!![]}];}_0x540dd3=_['merge']({},_0x540dd3,_0x14dced[_0xd2cb('0x3e')]);return db[_0xd2cb('0x2c')][_0xd2cb('0x4b')](_0x540dd3)[_0xd2cb('0x22')](handleEntityNotFound(_0xd7af1f,null))['then'](function(_0x55e8de){if(_0x55e8de){var _0x1cce90=_0x55e8de['get']({'plain':!![]});_0x1cce90=qs[_0xd2cb('0x4e')](_0x1cce90,['id','createdAt',_0xd2cb('0x4f')]);_0x14dced[_0xd2cb('0x50')]=_[_0xd2cb('0x4e')](_0x14dced[_0xd2cb('0x50')],['id',_0xd2cb('0x51'),_0xd2cb('0x4f')]);return db['Campaign'][_0xd2cb('0x47')](_[_0xd2cb('0x3c')](_0x1cce90,_0x14dced[_0xd2cb('0x50')]),{'include':_0x14dced[_0xd2cb('0x31')]['includeAll']?[{'all':!![]}]:undefined})[_0xd2cb('0x22')](function(_0xfe419e){var _0x4d893c=_0x14dced[_0xd2cb('0x49')][_0xd2cb('0x24')]({'plain':!![]});if(!_0x4d893c)throw new Error(_0xd2cb('0x52'));if(_0x4d893c[_0xd2cb('0x48')]===_0xd2cb('0x49')){var _0x311429=_0xfe419e[_0xd2cb('0x24')]({'plain':!![]});var _0x21f434='IvrCampaigns';return db[_0xd2cb('0x4a')][_0xd2cb('0x4b')]({'where':{'name':_0x21f434,'userProfileId':_0x4d893c['userProfileId']},'raw':!![]})[_0xd2cb('0x22')](function(_0x3f292f){if(_0x3f292f&&_0x3f292f[_0xd2cb('0x53')]===0x0){return db[_0xd2cb('0x54')][_0xd2cb('0x47')]({'name':_0x311429[_0xd2cb('0x28')],'resourceId':_0x311429['id'],'type':_0x3f292f[_0xd2cb('0x28')],'sectionId':_0x3f292f['id']},{})[_0xd2cb('0x22')](function(){return _0xfe419e;});}else{return _0xfe419e;}})[_0xd2cb('0x43')](function(_0x485de9){logger[_0xd2cb('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x485de9);throw _0x485de9;});}return _0xfe419e;});}})[_0xd2cb('0x22')](respondWithResult(_0xd7af1f,0xc9))['catch'](handleError(_0xd7af1f,null));};exports[_0xd2cb('0x21')]=function(_0x209dd5,_0x28779e){if(_0x209dd5[_0xd2cb('0x50')]['id']){delete _0x209dd5[_0xd2cb('0x50')]['id'];}return db[_0xd2cb('0x2c')]['find']({'where':{'id':_0x209dd5[_0xd2cb('0x45')]['id']}})['then'](handleEntityNotFound(_0x28779e,null))[_0xd2cb('0x22')](saveUpdates(_0x209dd5[_0xd2cb('0x50')],null))[_0xd2cb('0x22')](respondWithResult(_0x28779e,null))[_0xd2cb('0x43')](handleError(_0x28779e,null));};exports[_0xd2cb('0x23')]=function(_0x59a854,_0x24812c){return db[_0xd2cb('0x2c')][_0xd2cb('0x4b')]({'where':{'id':_0x59a854[_0xd2cb('0x45')]['id']}})[_0xd2cb('0x22')](handleEntityNotFound(_0x24812c,null))[_0xd2cb('0x22')](removeEntity(_0x24812c,null))[_0xd2cb('0x43')](handleError(_0x24812c,null));};exports[_0xd2cb('0x55')]=function(_0x61f407,_0x5d1f51,_0x341693){var _0x39d496={'raw':!![],'where':{}};var _0x1b782f={};var _0x52a546={'count':0x0,'rows':[]};return db['Campaign'][_0xd2cb('0x56')]({'where':{'id':_0x61f407['params']['id']}})['then'](handleEntityNotFound(_0x5d1f51,null))['then'](function(_0x559472){if(_0x559472){_0x1b782f[_0xd2cb('0x30')]=_[_0xd2cb('0x32')](db['CmHopper'][_0xd2cb('0x46')]);_0x1b782f[_0xd2cb('0x31')]=_['keys'](_0x61f407[_0xd2cb('0x31')]);_0x1b782f[_0xd2cb('0x33')]=_[_0xd2cb('0x34')](_0x1b782f['model'],_0x1b782f[_0xd2cb('0x31')]);_0x39d496['attributes']=_[_0xd2cb('0x34')](_0x1b782f[_0xd2cb('0x30')],qs[_0xd2cb('0x36')](_0x61f407['query'][_0xd2cb('0x36')]));_0x39d496[_0xd2cb('0x35')]=_0x39d496[_0xd2cb('0x35')]['length']?_0x39d496[_0xd2cb('0x35')]:_0x1b782f['model'];if(!_0x61f407[_0xd2cb('0x31')][_0xd2cb('0x38')](_0xd2cb('0x57'))){_0x39d496['limit']=qs[_0xd2cb('0x1d')](_0x61f407[_0xd2cb('0x31')][_0xd2cb('0x1d')]);_0x39d496['offset']=qs[_0xd2cb('0x1b')](_0x61f407[_0xd2cb('0x31')][_0xd2cb('0x1b')]);}_0x39d496[_0xd2cb('0x58')]=qs[_0xd2cb('0x39')](_0x61f407[_0xd2cb('0x31')][_0xd2cb('0x39')]);_0x39d496['where']=qs[_0xd2cb('0x33')](_[_0xd2cb('0x3b')](_0x61f407[_0xd2cb('0x31')],_0x1b782f[_0xd2cb('0x33')]));_0x39d496[_0xd2cb('0x3a')]['CampaignId']=_0x559472['id'];if(_0x61f407[_0xd2cb('0x31')][_0xd2cb('0x59')]){_0x39d496[_0xd2cb('0x3a')]=_[_0xd2cb('0x3c')](_0x39d496[_0xd2cb('0x3a')],{'$or':_[_0xd2cb('0x2b')](_0x39d496[_0xd2cb('0x35')],function(_0x44c274){var _0x1a04c0={};_0x1a04c0[_0x44c274]={'$like':'%'+_0x61f407[_0xd2cb('0x31')][_0xd2cb('0x59')]+'%'};return _0x1a04c0;})});}_0x39d496=_[_0xd2cb('0x3c')]({},_0x39d496,_0x61f407[_0xd2cb('0x3e')]);return db[_0xd2cb('0x5a')]['count']({'where':_0x39d496['where']})[_0xd2cb('0x22')](function(_0x574719){_0x52a546[_0xd2cb('0x1e')]=_0x574719;if(_0x61f407[_0xd2cb('0x31')]['includeAll']){_0x39d496[_0xd2cb('0x40')]=[{'all':!![]}];}return db[_0xd2cb('0x5a')][_0xd2cb('0x41')](_0x39d496);})[_0xd2cb('0x22')](function(_0x41669c){_0x52a546[_0xd2cb('0x42')]=_0x41669c;return _0x52a546;});}})[_0xd2cb('0x22')](respondWithFilteredResult(_0x5d1f51,_0x39d496))[_0xd2cb('0x43')](handleError(_0x5d1f51,null));};exports[_0xd2cb('0x5b')]=function(_0x26e91a,_0x36ab0b,_0x55a971){var _0x47ec1b={'raw':!![],'where':{}};var _0x4e7782={};var _0x57f94d={'count':0x0,'rows':[]};return db[_0xd2cb('0x2c')][_0xd2cb('0x56')]({'where':{'id':_0x26e91a['params']['id']}})['then'](handleEntityNotFound(_0x36ab0b,null))['then'](function(_0x1ede89){if(_0x1ede89){_0x4e7782[_0xd2cb('0x30')]=_[_0xd2cb('0x32')](db[_0xd2cb('0x5c')]['rawAttributes']);_0x4e7782[_0xd2cb('0x31')]=_[_0xd2cb('0x32')](_0x26e91a[_0xd2cb('0x31')]);_0x4e7782[_0xd2cb('0x33')]=_[_0xd2cb('0x34')](_0x4e7782[_0xd2cb('0x30')],_0x4e7782['query']);_0x47ec1b['attributes']=_[_0xd2cb('0x34')](_0x4e7782[_0xd2cb('0x30')],qs[_0xd2cb('0x36')](_0x26e91a[_0xd2cb('0x31')]['fields']));_0x47ec1b['attributes']=_0x47ec1b['attributes'][_0xd2cb('0x37')]?_0x47ec1b[_0xd2cb('0x35')]:_0x4e7782[_0xd2cb('0x30')];if(!_0x26e91a['query'][_0xd2cb('0x38')](_0xd2cb('0x57'))){_0x47ec1b['limit']=qs[_0xd2cb('0x1d')](_0x26e91a['query']['limit']);_0x47ec1b[_0xd2cb('0x1b')]=qs[_0xd2cb('0x1b')](_0x26e91a['query'][_0xd2cb('0x1b')]);}_0x47ec1b[_0xd2cb('0x58')]=qs['sort'](_0x26e91a[_0xd2cb('0x31')][_0xd2cb('0x39')]);_0x47ec1b[_0xd2cb('0x3a')]=qs[_0xd2cb('0x33')](_[_0xd2cb('0x3b')](_0x26e91a[_0xd2cb('0x31')],_0x4e7782['filters']));_0x47ec1b[_0xd2cb('0x3a')]['CampaignId']=_0x1ede89['id'];if(_0x26e91a[_0xd2cb('0x31')][_0xd2cb('0x59')]){_0x47ec1b['where']=_['merge'](_0x47ec1b[_0xd2cb('0x3a')],{'$or':_[_0xd2cb('0x2b')](_0x47ec1b['attributes'],function(_0x1e256e){var _0x58fa90={};_0x58fa90[_0x1e256e]={'$like':'%'+_0x26e91a['query']['filter']+'%'};return _0x58fa90;})});}_0x47ec1b=_['merge']({},_0x47ec1b,_0x26e91a[_0xd2cb('0x3e')]);return db[_0xd2cb('0x5c')][_0xd2cb('0x1e')]({'where':_0x47ec1b[_0xd2cb('0x3a')]})[_0xd2cb('0x22')](function(_0x830d13){_0x57f94d['count']=_0x830d13;if(_0x26e91a[_0xd2cb('0x31')][_0xd2cb('0x3f')]){_0x47ec1b[_0xd2cb('0x40')]=[{'all':!![]}];}return db[_0xd2cb('0x5c')]['findAll'](_0x47ec1b);})['then'](function(_0xf95d32){_0x57f94d['rows']=_0xf95d32;return _0x57f94d;});}})['then'](respondWithFilteredResult(_0x36ab0b,_0x47ec1b))[_0xd2cb('0x43')](handleError(_0x36ab0b,null));};exports[_0xd2cb('0x5d')]=function(_0x345d59,_0x2c98f5,_0x127166){var _0x3d30af={'raw':!![],'where':{}};var _0x146059={};var _0x1a6e56={'count':0x0,'rows':[]};return db[_0xd2cb('0x2c')][_0xd2cb('0x56')]({'where':{'id':_0x345d59[_0xd2cb('0x45')]['id']}})[_0xd2cb('0x22')](handleEntityNotFound(_0x2c98f5,null))[_0xd2cb('0x22')](function(_0x58ef9e){if(_0x58ef9e){_0x146059[_0xd2cb('0x30')]=_[_0xd2cb('0x32')](db[_0xd2cb('0x5e')]['rawAttributes']);_0x146059[_0xd2cb('0x31')]=_['keys'](_0x345d59['query']);_0x146059[_0xd2cb('0x33')]=_[_0xd2cb('0x34')](_0x146059[_0xd2cb('0x30')],_0x146059[_0xd2cb('0x31')]);_0x3d30af[_0xd2cb('0x35')]=_[_0xd2cb('0x34')](_0x146059['model'],qs[_0xd2cb('0x36')](_0x345d59['query'][_0xd2cb('0x36')]));_0x3d30af[_0xd2cb('0x35')]=_0x3d30af[_0xd2cb('0x35')][_0xd2cb('0x37')]?_0x3d30af[_0xd2cb('0x35')]:_0x146059[_0xd2cb('0x30')];if(!_0x345d59['query']['hasOwnProperty'](_0xd2cb('0x57'))){_0x3d30af[_0xd2cb('0x1d')]=qs[_0xd2cb('0x1d')](_0x345d59['query'][_0xd2cb('0x1d')]);_0x3d30af[_0xd2cb('0x1b')]=qs[_0xd2cb('0x1b')](_0x345d59['query'][_0xd2cb('0x1b')]);}_0x3d30af[_0xd2cb('0x58')]=qs[_0xd2cb('0x39')](_0x345d59[_0xd2cb('0x31')][_0xd2cb('0x39')]);_0x3d30af['where']=qs['filters'](_['pick'](_0x345d59[_0xd2cb('0x31')],_0x146059[_0xd2cb('0x33')]));_0x3d30af[_0xd2cb('0x3a')][_0xd2cb('0x5f')]=_0x58ef9e['id'];if(_0x345d59[_0xd2cb('0x31')][_0xd2cb('0x59')]){_0x3d30af['where']=_[_0xd2cb('0x3c')](_0x3d30af[_0xd2cb('0x3a')],{'$or':_[_0xd2cb('0x2b')](_0x3d30af[_0xd2cb('0x35')],function(_0x258c8b){var _0x2a62c1={};_0x2a62c1[_0x258c8b]={'$like':'%'+_0x345d59[_0xd2cb('0x31')]['filter']+'%'};return _0x2a62c1;})});}_0x3d30af=_[_0xd2cb('0x3c')]({},_0x3d30af,_0x345d59[_0xd2cb('0x3e')]);return db[_0xd2cb('0x5e')][_0xd2cb('0x1e')]({'where':_0x3d30af['where']})['then'](function(_0x5c8a36){_0x1a6e56['count']=_0x5c8a36;if(_0x345d59[_0xd2cb('0x31')][_0xd2cb('0x3f')]){_0x3d30af['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xd2cb('0x41')](_0x3d30af);})['then'](function(_0x348d4c){_0x1a6e56[_0xd2cb('0x42')]=_0x348d4c;return _0x1a6e56;});}})[_0xd2cb('0x22')](respondWithFilteredResult(_0x2c98f5,_0x3d30af))[_0xd2cb('0x43')](handleError(_0x2c98f5,null));};exports[_0xd2cb('0x60')]=function(_0x26d24f,_0x5e2a5f,_0x4e280e){var _0x350544={'raw':!![],'where':{}};var _0x55dcc4={};var _0x57c3af={'count':0x0,'rows':[]};return db[_0xd2cb('0x2c')][_0xd2cb('0x56')]({'where':{'id':_0x26d24f[_0xd2cb('0x45')]['id']}})[_0xd2cb('0x22')](handleEntityNotFound(_0x5e2a5f,null))[_0xd2cb('0x22')](function(_0x1b94d2){if(_0x1b94d2){_0x55dcc4[_0xd2cb('0x30')]=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x55dcc4[_0xd2cb('0x31')]=_[_0xd2cb('0x32')](_0x26d24f[_0xd2cb('0x31')]);_0x55dcc4['filters']=_['intersection'](_0x55dcc4[_0xd2cb('0x30')],_0x55dcc4[_0xd2cb('0x31')]);_0x350544[_0xd2cb('0x35')]=_[_0xd2cb('0x34')](_0x55dcc4['model'],qs[_0xd2cb('0x36')](_0x26d24f['query'][_0xd2cb('0x36')]));_0x350544[_0xd2cb('0x35')]=_0x350544[_0xd2cb('0x35')]['length']?_0x350544[_0xd2cb('0x35')]:_0x55dcc4[_0xd2cb('0x30')];if(!_0x26d24f['query'][_0xd2cb('0x38')]('nolimit')){_0x350544[_0xd2cb('0x1d')]=qs[_0xd2cb('0x1d')](_0x26d24f['query']['limit']);_0x350544[_0xd2cb('0x1b')]=qs[_0xd2cb('0x1b')](_0x26d24f[_0xd2cb('0x31')]['offset']);}_0x350544['order']=qs[_0xd2cb('0x39')](_0x26d24f[_0xd2cb('0x31')]['sort']);_0x350544[_0xd2cb('0x3a')]=qs[_0xd2cb('0x33')](_[_0xd2cb('0x3b')](_0x26d24f[_0xd2cb('0x31')],_0x55dcc4[_0xd2cb('0x33')]));_0x350544['where'][_0xd2cb('0x5f')]=_0x1b94d2['id'];if(_0x26d24f[_0xd2cb('0x31')][_0xd2cb('0x59')]){_0x350544['where']=_[_0xd2cb('0x3c')](_0x350544['where'],{'$or':_[_0xd2cb('0x2b')](_0x350544[_0xd2cb('0x35')],function(_0x47d08e){var _0x9cb35={};_0x9cb35[_0x47d08e]={'$like':'%'+_0x26d24f['query'][_0xd2cb('0x59')]+'%'};return _0x9cb35;})});}_0x350544=_[_0xd2cb('0x3c')]({},_0x350544,_0x26d24f[_0xd2cb('0x3e')]);return db[_0xd2cb('0x61')][_0xd2cb('0x1e')]({'where':_0x350544[_0xd2cb('0x3a')]})['then'](function(_0x4573cf){_0x57c3af[_0xd2cb('0x1e')]=_0x4573cf;if(_0x26d24f[_0xd2cb('0x31')][_0xd2cb('0x3f')]){_0x350544[_0xd2cb('0x40')]=[{'all':!![]}];}return db[_0xd2cb('0x61')]['findAll'](_0x350544);})[_0xd2cb('0x22')](function(_0x2700f4){_0x57c3af[_0xd2cb('0x42')]=_0x2700f4;return _0x57c3af;});}})[_0xd2cb('0x22')](respondWithFilteredResult(_0x5e2a5f,_0x350544))[_0xd2cb('0x43')](handleError(_0x5e2a5f,null));};exports[_0xd2cb('0x62')]=function(_0x393a7e,_0x42a4b0,_0x3ced0f){var _0x2330da={};var _0x1cf157={};var _0x239d76;var _0x599cb8;return db[_0xd2cb('0x2c')]['findOne']({'where':{'id':_0x393a7e[_0xd2cb('0x45')]['id']}})[_0xd2cb('0x22')](handleEntityNotFound(_0x42a4b0,null))[_0xd2cb('0x22')](function(_0x44e085){if(_0x44e085){_0x239d76=_0x44e085;_0x1cf157[_0xd2cb('0x30')]=_['keys'](db[_0xd2cb('0x63')]['rawAttributes']);_0x1cf157[_0xd2cb('0x31')]=_[_0xd2cb('0x32')](_0x393a7e[_0xd2cb('0x31')]);_0x1cf157[_0xd2cb('0x33')]=_[_0xd2cb('0x34')](_0x1cf157['model'],_0x1cf157['query']);_0x2330da[_0xd2cb('0x35')]=_[_0xd2cb('0x34')](_0x1cf157[_0xd2cb('0x30')],qs[_0xd2cb('0x36')](_0x393a7e[_0xd2cb('0x31')][_0xd2cb('0x36')]));_0x2330da[_0xd2cb('0x35')]=_0x2330da[_0xd2cb('0x35')][_0xd2cb('0x37')]?_0x2330da[_0xd2cb('0x35')]:_0x1cf157[_0xd2cb('0x30')];_0x2330da[_0xd2cb('0x58')]=qs[_0xd2cb('0x39')](_0x393a7e[_0xd2cb('0x31')][_0xd2cb('0x39')]);_0x2330da['where']=qs[_0xd2cb('0x33')](_[_0xd2cb('0x3b')](_0x393a7e[_0xd2cb('0x31')],_0x1cf157[_0xd2cb('0x33')]));if(_0x393a7e[_0xd2cb('0x31')][_0xd2cb('0x59')]){_0x2330da[_0xd2cb('0x3a')]=_[_0xd2cb('0x3c')](_0x2330da['where'],{'$or':_[_0xd2cb('0x2b')](_0x2330da[_0xd2cb('0x35')],function(_0x2f40b5){var _0x234cd3={};_0x234cd3[_0x2f40b5]={'$like':'%'+_0x393a7e[_0xd2cb('0x31')][_0xd2cb('0x59')]+'%'};return _0x234cd3;})});}_0x2330da=_['merge']({},_0x2330da,_0x393a7e[_0xd2cb('0x3e')]);return _0x239d76[_0xd2cb('0x62')](_0x2330da);}})[_0xd2cb('0x22')](function(_0x58b2d7){if(_0x58b2d7){_0x599cb8=_0x58b2d7['length'];if(!_0x393a7e['query'][_0xd2cb('0x38')]('nolimit')){_0x2330da[_0xd2cb('0x1d')]=qs[_0xd2cb('0x1d')](_0x393a7e['query']['limit']);_0x2330da[_0xd2cb('0x1b')]=qs[_0xd2cb('0x1b')](_0x393a7e[_0xd2cb('0x31')]['offset']);}return _0x239d76[_0xd2cb('0x62')](_0x2330da);}})[_0xd2cb('0x22')](function(_0x7247ad){if(_0x7247ad){return _0x7247ad?{'count':_0x599cb8,'rows':_0x7247ad}:null;}})[_0xd2cb('0x22')](respondWithResult(_0x42a4b0,null))[_0xd2cb('0x43')](handleError(_0x42a4b0,null));};exports[_0xd2cb('0x64')]=function(_0x25c847,_0x408527,_0x176337){var _0x556a02,_0x115cd0;var _0x2097d2=[];var _0x85e3a0=moment()[_0xd2cb('0x65')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xd2cb('0x2c')]['find']({'where':{'id':_0x25c847[_0xd2cb('0x45')]['id']}})['then'](handleEntityNotFound(_0x408527,null))[_0xd2cb('0x22')](function(_0x282454){if(_0x282454){_0x115cd0=_0x282454;return _0x282454['addLists'](_0x25c847[_0xd2cb('0x50')][_0xd2cb('0x66')],_['omit'](_0x25c847[_0xd2cb('0x50')],[_0xd2cb('0x66'),'id'])||{});}return null;})[_0xd2cb('0x67')](function(_0x551992){var _0x13f5fa;var _0x2914bd;_0x556a02=_0x551992||[];var _0x3b2c45=[];if(_0x551992){for(var _0x1914d2=0x0;_0x1914d2<_0x551992['length'];_0x1914d2+=0x1){var _0xf74678=_0x551992[_0x1914d2][_0xd2cb('0x24')]({'plain':!![]});_0x115cd0['dialCheckDuplicateType']=_0x25c847['body'][_0xd2cb('0x68')]?_0x25c847[_0xd2cb('0x50')][_0xd2cb('0x68')]:_0x115cd0[_0xd2cb('0x68')];switch(_0x115cd0['dialCheckDuplicateType']){case _0xd2cb('0x69'):_0x13f5fa=squel[_0xd2cb('0x6a')]()[_0xd2cb('0x6b')](_0xd2cb('0x6c'))[_0xd2cb('0x6d')]([_0xd2cb('0x6e'),'scheduledAt',_0xd2cb('0x6f'),_0xd2cb('0x70'),_0xd2cb('0x5f'),_0xd2cb('0x51'),_0xd2cb('0x4f')],squel['select']()['field'](_0xd2cb('0x6e'),_0xd2cb('0x6e'))[_0xd2cb('0x71')](_0xd2cb('0x72'),_0xd2cb('0x73'))['field']('id',_0xd2cb('0x6f'))[_0xd2cb('0x71')](_0xf74678['CmListId'][_0xd2cb('0x74')](),_0xd2cb('0x70'))[_0xd2cb('0x71')](_0x25c847[_0xd2cb('0x45')]['id']['toString'](),_0xd2cb('0x5f'))[_0xd2cb('0x71')]('\x27'+_0x85e3a0+'\x27',_0xd2cb('0x51'))[_0xd2cb('0x71')]('\x27'+_0x85e3a0+'\x27',_0xd2cb('0x4f'))[_0xd2cb('0x75')]('cm_contacts')[_0xd2cb('0x3a')](_0xd2cb('0x76'))[_0xd2cb('0x3a')](_0xd2cb('0x77'),_0xf74678[_0xd2cb('0x78')][_0xd2cb('0x74')]())[_0xd2cb('0x3a')](_0xd2cb('0x79'))[_0xd2cb('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd2cb('0x7a')]()[_0xd2cb('0x71')](_0xd2cb('0x7b'))[_0xd2cb('0x75')](_0xd2cb('0x7c'))[_0xd2cb('0x3a')](_0xd2cb('0x7d'),_0x25c847[_0xd2cb('0x45')]['id']['toString']()))[_0xd2cb('0x3a')](_0xd2cb('0x7e'),squel[_0xd2cb('0x7a')]()[_0xd2cb('0x71')]('COALESCE(phone,\x27\x27)')[_0xd2cb('0x75')](_0xd2cb('0x6c'))[_0xd2cb('0x3a')](_0xd2cb('0x7d'),_0x25c847[_0xd2cb('0x45')]['id'][_0xd2cb('0x74')]())))['toString']();break;case'onlyIfOpen':_0x13f5fa=squel[_0xd2cb('0x6a')]()[_0xd2cb('0x6b')](_0xd2cb('0x6c'))['fromQuery']([_0xd2cb('0x6e'),_0xd2cb('0x73'),_0xd2cb('0x6f'),_0xd2cb('0x70'),_0xd2cb('0x5f'),_0xd2cb('0x51'),_0xd2cb('0x4f')],squel[_0xd2cb('0x7a')]()[_0xd2cb('0x71')]('phone','phone')[_0xd2cb('0x71')]('NOW()',_0xd2cb('0x73'))[_0xd2cb('0x71')]('id','ContactId')[_0xd2cb('0x71')](_0xf74678[_0xd2cb('0x78')][_0xd2cb('0x74')](),'ListId')[_0xd2cb('0x71')](_0x25c847['params']['id'][_0xd2cb('0x74')](),_0xd2cb('0x5f'))['field']('\x27'+_0x85e3a0+'\x27',_0xd2cb('0x51'))[_0xd2cb('0x71')]('\x27'+_0x85e3a0+'\x27',_0xd2cb('0x4f'))['from'](_0xd2cb('0x7f'))[_0xd2cb('0x3a')](_0xd2cb('0x76'))[_0xd2cb('0x3a')]('ListId\x20=\x20?',_0xf74678[_0xd2cb('0x78')]['toString']())[_0xd2cb('0x3a')]('phone\x20IS\x20NOT\x20NULL')[_0xd2cb('0x3a')](_0xd2cb('0x7e'),squel[_0xd2cb('0x7a')]()[_0xd2cb('0x71')](_0xd2cb('0x80'))[_0xd2cb('0x75')](_0xd2cb('0x6c'))[_0xd2cb('0x3a')](_0xd2cb('0x7d'),_0x25c847['params']['id'][_0xd2cb('0x74')]())))[_0xd2cb('0x74')]();break;default:_0x13f5fa=squel[_0xd2cb('0x6a')]()[_0xd2cb('0x6b')]('cm_hopper')['fromQuery'](['phone',_0xd2cb('0x73'),_0xd2cb('0x6f'),_0xd2cb('0x70'),_0xd2cb('0x5f'),_0xd2cb('0x51'),_0xd2cb('0x4f')],squel[_0xd2cb('0x7a')]()[_0xd2cb('0x71')]('phone','phone')[_0xd2cb('0x71')](_0xd2cb('0x72'),_0xd2cb('0x73'))[_0xd2cb('0x71')]('id',_0xd2cb('0x6f'))[_0xd2cb('0x71')](_0xf74678[_0xd2cb('0x78')][_0xd2cb('0x74')](),'ListId')[_0xd2cb('0x71')](_0x25c847[_0xd2cb('0x45')]['id'][_0xd2cb('0x74')](),_0xd2cb('0x5f'))[_0xd2cb('0x71')]('\x27'+_0x85e3a0+'\x27',_0xd2cb('0x51'))['field']('\x27'+_0x85e3a0+'\x27','updatedAt')[_0xd2cb('0x75')](_0xd2cb('0x7f'))[_0xd2cb('0x3a')](_0xd2cb('0x76'))[_0xd2cb('0x3a')]('ListId\x20=\x20?',_0xf74678[_0xd2cb('0x78')]['toString']())[_0xd2cb('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0xd2cb('0x74')]();}_0x2914bd=squel['insert']()[_0xd2cb('0x6b')]('cm_hopper_additional_phones')[_0xd2cb('0x6d')]([_0xd2cb('0x81'),_0xd2cb('0x73'),_0xd2cb('0x6e'),_0xd2cb('0x82'),_0xd2cb('0x51'),_0xd2cb('0x4f')],squel[_0xd2cb('0x7a')]()[_0xd2cb('0x71')](_0xd2cb('0x83'),'id')[_0xd2cb('0x71')]('NOW()',_0xd2cb('0x73'))[_0xd2cb('0x71')]('ci.item',_0xd2cb('0x6e'))[_0xd2cb('0x71')](_0xd2cb('0x84'),_0xd2cb('0x82'))[_0xd2cb('0x71')]('\x27'+_0x85e3a0+'\x27',_0xd2cb('0x51'))[_0xd2cb('0x71')]('\x27'+_0x85e3a0+'\x27',_0xd2cb('0x4f'))['from'](_0xd2cb('0x85'),'ci')[_0xd2cb('0x86')](_0xd2cb('0x6c'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0xd2cb('0x3a')](_0xd2cb('0x87'),_0xf74678[_0xd2cb('0x78')][_0xd2cb('0x74')]())[_0xd2cb('0x3a')]('h.CampaignId=?',_0x25c847[_0xd2cb('0x45')]['id']['toString']())[_0xd2cb('0x3a')]('h.createdAt\x20=\x20?',_0x85e3a0))[_0xd2cb('0x74')]();_0x3b2c45['push'](db[_0xd2cb('0x88')][_0xd2cb('0x31')](_0x13f5fa));_0x2097d2['push'](db['sequelize'][_0xd2cb('0x31')](_0x2914bd));}return BPromise['all'](_0x3b2c45);}})['then'](function(){return BPromise['all'](_0x2097d2);})[_0xd2cb('0x22')](function(){return _0x556a02;})['then'](respondWithResult(_0x408527,null))['catch'](handleError(_0x408527,null));};exports[_0xd2cb('0x89')]=function(_0x139f8a,_0x1483c7,_0x287391){return db['Campaign'][_0xd2cb('0x4b')]({'where':{'id':_0x139f8a['params']['id']}})[_0xd2cb('0x22')](handleEntityNotFound(_0x1483c7,null))[_0xd2cb('0x22')](function(_0x150b04){if(_0x150b04){return _0x150b04['removeLists'](_0x139f8a['query'][_0xd2cb('0x66')]);}})[_0xd2cb('0x22')](function(_0x3007b1){if(_0x3007b1){return db['CmHopper'][_0xd2cb('0x23')]({'where':{'ListId':_0x139f8a[_0xd2cb('0x31')][_0xd2cb('0x66')],'CampaignId':_0x139f8a[_0xd2cb('0x45')]['id']}})[_0xd2cb('0x22')](function(){return _0x3007b1;});}})[_0xd2cb('0x22')](respondWithStatusCode(_0x1483c7,null))['catch'](handleError(_0x1483c7,null));};exports['getBlackLists']=function(_0x268c16,_0x1ff0d6,_0x71cbb4){var _0x295df6={};var _0x22c092={};var _0x59ffce;var _0xe81e84;return db[_0xd2cb('0x2c')][_0xd2cb('0x56')]({'where':{'id':_0x268c16['params']['id']}})[_0xd2cb('0x22')](handleEntityNotFound(_0x1ff0d6,null))[_0xd2cb('0x22')](function(_0x433e8d){if(_0x433e8d){_0x59ffce=_0x433e8d;_0x22c092[_0xd2cb('0x30')]=_[_0xd2cb('0x32')](db[_0xd2cb('0x63')][_0xd2cb('0x46')]);_0x22c092[_0xd2cb('0x31')]=_['keys'](_0x268c16['query']);_0x22c092[_0xd2cb('0x33')]=_['intersection'](_0x22c092[_0xd2cb('0x30')],_0x22c092[_0xd2cb('0x31')]);_0x295df6['attributes']=_[_0xd2cb('0x34')](_0x22c092['model'],qs[_0xd2cb('0x36')](_0x268c16['query']['fields']));_0x295df6[_0xd2cb('0x35')]=_0x295df6[_0xd2cb('0x35')][_0xd2cb('0x37')]?_0x295df6[_0xd2cb('0x35')]:_0x22c092['model'];_0x295df6['order']=qs[_0xd2cb('0x39')](_0x268c16[_0xd2cb('0x31')][_0xd2cb('0x39')]);_0x295df6[_0xd2cb('0x3a')]=qs[_0xd2cb('0x33')](_[_0xd2cb('0x3b')](_0x268c16[_0xd2cb('0x31')],_0x22c092['filters']));if(_0x268c16[_0xd2cb('0x31')]['filter']){_0x295df6[_0xd2cb('0x3a')]=_['merge'](_0x295df6['where'],{'$or':_[_0xd2cb('0x2b')](_0x295df6[_0xd2cb('0x35')],function(_0x4b2457){var _0x3791d5={};_0x3791d5[_0x4b2457]={'$like':'%'+_0x268c16[_0xd2cb('0x31')][_0xd2cb('0x59')]+'%'};return _0x3791d5;})});}_0x295df6=_[_0xd2cb('0x3c')]({},_0x295df6,_0x268c16[_0xd2cb('0x3e')]);return _0x59ffce['getBlackLists'](_0x295df6);}})[_0xd2cb('0x22')](function(_0x155845){if(_0x155845){_0xe81e84=_0x155845['length'];if(!_0x268c16[_0xd2cb('0x31')][_0xd2cb('0x38')](_0xd2cb('0x57'))){_0x295df6[_0xd2cb('0x1d')]=qs[_0xd2cb('0x1d')](_0x268c16['query']['limit']);_0x295df6[_0xd2cb('0x1b')]=qs[_0xd2cb('0x1b')](_0x268c16[_0xd2cb('0x31')]['offset']);}return _0x59ffce[_0xd2cb('0x8a')](_0x295df6);}})[_0xd2cb('0x22')](function(_0x4c7d8b){if(_0x4c7d8b){return _0x4c7d8b?{'count':_0xe81e84,'rows':_0x4c7d8b}:null;}})[_0xd2cb('0x22')](respondWithResult(_0x1ff0d6,null))[_0xd2cb('0x43')](handleError(_0x1ff0d6,null));};exports[_0xd2cb('0x8b')]=function(_0x328828,_0x4aadac,_0x89638f){var _0x305eb4,_0x1b9593;var _0x3481e0=[];var _0xe27d6b=moment()[_0xd2cb('0x65')](_0xd2cb('0x8c'));return db[_0xd2cb('0x2c')][_0xd2cb('0x4b')]({'where':{'id':_0x328828[_0xd2cb('0x45')]['id']}})[_0xd2cb('0x22')](handleEntityNotFound(_0x4aadac,null))[_0xd2cb('0x22')](function(_0x330238){if(_0x330238){_0x1b9593=_0x330238;return _0x330238[_0xd2cb('0x8b')](_0x328828[_0xd2cb('0x50')]['ids'],_[_0xd2cb('0x4e')](_0x328828[_0xd2cb('0x50')],['ids','id'])||{});}return null;})['spread'](function(_0xb4acce){var _0x3ecfd8;var _0xd24893;_0x305eb4=_0xb4acce||[];var _0x4974a7=[];if(_0xb4acce){for(var _0x37ea6f=0x0;_0x37ea6f<_0xb4acce[_0xd2cb('0x37')];_0x37ea6f+=0x1){var _0xf3a39a=_0xb4acce[_0x37ea6f][_0xd2cb('0x24')]({'plain':!![]});_0x3ecfd8=squel['insert']()[_0xd2cb('0x6b')](_0xd2cb('0x8d'))['fromQuery']([_0xd2cb('0x6e'),_0xd2cb('0x6f'),_0xd2cb('0x70'),_0xd2cb('0x5f'),_0xd2cb('0x51'),'updatedAt'],squel[_0xd2cb('0x7a')]()[_0xd2cb('0x71')](_0xd2cb('0x6e'),_0xd2cb('0x6e'))['field']('id',_0xd2cb('0x6f'))[_0xd2cb('0x71')](_0xf3a39a[_0xd2cb('0x78')][_0xd2cb('0x74')](),_0xd2cb('0x70'))[_0xd2cb('0x71')](_0x328828[_0xd2cb('0x45')]['id'][_0xd2cb('0x74')](),_0xd2cb('0x5f'))[_0xd2cb('0x71')](_0xd2cb('0x72'),'createdAt')[_0xd2cb('0x71')](_0xd2cb('0x72'),'updatedAt')[_0xd2cb('0x75')](_0xd2cb('0x7f'))[_0xd2cb('0x3a')](_0xd2cb('0x76'))['where'](_0xd2cb('0x77'),_0xf3a39a[_0xd2cb('0x78')][_0xd2cb('0x74')]())[_0xd2cb('0x3a')](_0xd2cb('0x79')))[_0xd2cb('0x74')]();_0x4974a7[_0xd2cb('0x8e')](db[_0xd2cb('0x88')]['query'](_0x3ecfd8));}return BPromise[_0xd2cb('0x8f')](_0x4974a7);}})[_0xd2cb('0x22')](function(){return _0x305eb4;})[_0xd2cb('0x22')](respondWithResult(_0x4aadac,null))[_0xd2cb('0x43')](handleError(_0x4aadac,null));};exports[_0xd2cb('0x90')]=function(_0x441070,_0xce8afb,_0x14e557){return db[_0xd2cb('0x2c')][_0xd2cb('0x4b')]({'where':{'id':_0x441070[_0xd2cb('0x45')]['id']}})['then'](handleEntityNotFound(_0xce8afb,null))[_0xd2cb('0x22')](function(_0x576500){if(_0x576500){return _0x576500[_0xd2cb('0x90')](_0x441070[_0xd2cb('0x31')]['ids']);}})[_0xd2cb('0x22')](function(_0x1746e9){if(_0x1746e9){return db[_0xd2cb('0x61')]['destroy']({'where':{'ListId':_0x441070[_0xd2cb('0x31')][_0xd2cb('0x66')],'CampaignId':_0x441070[_0xd2cb('0x45')]['id']}})[_0xd2cb('0x22')](function(){return _0x1746e9;});}})[_0xd2cb('0x22')](respondWithStatusCode(_0xce8afb,null))['catch'](handleError(_0xce8afb,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index f4a8e61..d613fbd 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(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x4684e9,_0x418964){var _0x118227=function(_0x34c9dd){while(--_0x34c9dd){_0x4684e9['push'](_0x4684e9['shift']());}};_0x118227(++_0x418964);}(_0x7a54,0x106));var _0x47a5=function(_0x38123a,_0x30efba){_0x38123a=_0x38123a-0x0;var _0x1c1dcd=_0x7a54[_0x38123a];return _0x1c1dcd;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index def9660..be78b62 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 _0x2830=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../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','raw','where','attributes','limit','include','model','map','lodash'];(function(_0x3de99a,_0x20140b){var _0x3d9667=function(_0x18284c){while(--_0x18284c){_0x3de99a['push'](_0x3de99a['shift']());}};_0x3d9667(++_0x20140b);}(_0x2830,0x117));var _0x0283=function(_0x10b582,_0x13fd8e){_0x10b582=_0x10b582-0x0;var _0x1d5883=_0x2830[_0x10b582];return _0x1d5883;};'use strict';var _=require(_0x0283('0x0'));var util=require(_0x0283('0x1'));var moment=require(_0x0283('0x2'));var BPromise=require(_0x0283('0x3'));var rs=require(_0x0283('0x4'));var fs=require('fs');var Redis=require(_0x0283('0x5'));var db=require(_0x0283('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0283('0x7'))('rpc');var config=require(_0x0283('0x8'));var jayson=require(_0x0283('0x9'));var client=jayson[_0x0283('0xa')][_0x0283('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14d6e5,_0x1149eb,_0x29e976){return new BPromise(function(_0x47ffae,_0x2ac9a5){return client[_0x0283('0xc')](_0x14d6e5,_0x29e976)[_0x0283('0xd')](function(_0x3a25f8){logger[_0x0283('0xe')](_0x0283('0xf'),_0x1149eb,_0x0283('0x10'));logger[_0x0283('0x11')]('Campaign,\x20%s,\x20%s,\x20%s',_0x1149eb,_0x0283('0x10'),JSON[_0x0283('0x12')](_0x3a25f8));if(_0x3a25f8[_0x0283('0x13')]){if(_0x3a25f8[_0x0283('0x13')][_0x0283('0x14')]===0x1f4){logger[_0x0283('0x13')](_0x0283('0xf'),_0x1149eb,_0x3a25f8['error'][_0x0283('0x15')]);return _0x2ac9a5(_0x3a25f8['error']['message']);}logger[_0x0283('0x13')](_0x0283('0xf'),_0x1149eb,_0x3a25f8[_0x0283('0x13')][_0x0283('0x15')]);return _0x47ffae(_0x3a25f8[_0x0283('0x13')]['message']);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x1149eb,_0x0283('0x10'));_0x47ffae(_0x3a25f8[_0x0283('0x16')][_0x0283('0x15')]);}})[_0x0283('0x17')](function(_0x2a801b){logger[_0x0283('0x13')](_0x0283('0xf'),_0x1149eb,_0x2a801b);_0x2ac9a5(_0x2a801b);});});}exports[_0x0283('0x18')]=function(_0x3ba73e){var _0x26f1c5=this;return new Promise(function(_0x138ad9,_0x518c85){return db[_0x0283('0x19')][_0x0283('0x1a')]({'raw':_0x3ba73e[_0x0283('0x1b')]?_0x3ba73e[_0x0283('0x1b')][_0x0283('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ba73e['options']?_0x3ba73e[_0x0283('0x1b')][_0x0283('0x1d')]||null:null,'attributes':_0x3ba73e[_0x0283('0x1b')]?_0x3ba73e[_0x0283('0x1b')][_0x0283('0x1e')]||null:null,'limit':_0x3ba73e[_0x0283('0x1b')]?_0x3ba73e[_0x0283('0x1b')][_0x0283('0x1f')]||null:null,'include':_0x3ba73e['options']?_0x3ba73e[_0x0283('0x1b')][_0x0283('0x20')]?_['map'](_0x3ba73e[_0x0283('0x1b')][_0x0283('0x20')],function(_0x269df8){return{'model':db[_0x269df8[_0x0283('0x21')]],'as':_0x269df8['as'],'attributes':_0x269df8[_0x0283('0x1e')],'include':_0x269df8['include']?_['map'](_0x269df8[_0x0283('0x20')],function(_0x458787){return{'model':db[_0x458787[_0x0283('0x21')]],'as':_0x458787['as'],'attributes':_0x458787[_0x0283('0x1e')],'include':_0x458787[_0x0283('0x20')]?_[_0x0283('0x22')](_0x458787['include'],function(_0xe56f4){return{'model':db[_0xe56f4[_0x0283('0x21')]],'as':_0xe56f4['as'],'attributes':_0xe56f4[_0x0283('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0283('0xd')](function(_0x5ce2da){logger[_0x0283('0xe')](_0x0283('0x18'),_0x3ba73e);logger[_0x0283('0x11')]('GetCampaign',_0x3ba73e,JSON[_0x0283('0x12')](_0x5ce2da));_0x138ad9(_0x5ce2da);})[_0x0283('0x17')](function(_0xb95f2){logger[_0x0283('0x13')]('GetCampaign',_0xb95f2['message'],_0x3ba73e);_0x518c85(_0x26f1c5[_0x0283('0x13')](0x1f4,_0xb95f2[_0x0283('0x15')]));});});}; \ No newline at end of file +var _0xe3ed=['code','message','info','catch','GetCampaign','options','raw','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0xe3ed,0x8d));var _0xde3e=function(_0x59955e,_0x1e8a91){_0x59955e=_0x59955e-0x0;var _0x9a75a1=_0xe3ed[_0x59955e];return _0x9a75a1;};'use strict';var _=require(_0xde3e('0x0'));var util=require(_0xde3e('0x1'));var moment=require(_0xde3e('0x2'));var BPromise=require(_0xde3e('0x3'));var rs=require(_0xde3e('0x4'));var fs=require('fs');var Redis=require(_0xde3e('0x5'));var db=require(_0xde3e('0x6'))['db'];var utils=require(_0xde3e('0x7'));var logger=require('../../config/logger')(_0xde3e('0x8'));var config=require(_0xde3e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xde3e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x184b02,_0x4c4ac6,_0x47e97f){return new BPromise(function(_0x3e0bb4,_0x3b1597){return client[_0xde3e('0xb')](_0x184b02,_0x47e97f)[_0xde3e('0xc')](function(_0x76daf5){logger['info'](_0xde3e('0xd'),_0x4c4ac6,_0xde3e('0xe'));logger[_0xde3e('0xf')](_0xde3e('0x10'),_0x4c4ac6,'request\x20sent',JSON[_0xde3e('0x11')](_0x76daf5));if(_0x76daf5[_0xde3e('0x12')]){if(_0x76daf5['error'][_0xde3e('0x13')]===0x1f4){logger[_0xde3e('0x12')]('Campaign,\x20%s,\x20%s',_0x4c4ac6,_0x76daf5[_0xde3e('0x12')]['message']);return _0x3b1597(_0x76daf5[_0xde3e('0x12')][_0xde3e('0x14')]);}logger[_0xde3e('0x12')]('Campaign,\x20%s,\x20%s',_0x4c4ac6,_0x76daf5[_0xde3e('0x12')][_0xde3e('0x14')]);return _0x3e0bb4(_0x76daf5['error']['message']);}else{logger[_0xde3e('0x15')](_0xde3e('0xd'),_0x4c4ac6,_0xde3e('0xe'));_0x3e0bb4(_0x76daf5['result']['message']);}})[_0xde3e('0x16')](function(_0x5e041a){logger['error'](_0xde3e('0xd'),_0x4c4ac6,_0x5e041a);_0x3b1597(_0x5e041a);});});}exports[_0xde3e('0x17')]=function(_0x4aa02c){var _0x460d69=this;return new Promise(function(_0x276e83,_0x264603){return db['Campaign']['findAll']({'raw':_0x4aa02c['options']?_0x4aa02c[_0xde3e('0x18')][_0xde3e('0x19')]===undefined?!![]:![]:!![],'where':_0x4aa02c[_0xde3e('0x18')]?_0x4aa02c['options'][_0xde3e('0x1a')]||null:null,'attributes':_0x4aa02c[_0xde3e('0x18')]?_0x4aa02c[_0xde3e('0x18')][_0xde3e('0x1b')]||null:null,'limit':_0x4aa02c[_0xde3e('0x18')]?_0x4aa02c[_0xde3e('0x18')][_0xde3e('0x1c')]||null:null,'include':_0x4aa02c[_0xde3e('0x18')]?_0x4aa02c[_0xde3e('0x18')]['include']?_[_0xde3e('0x1d')](_0x4aa02c[_0xde3e('0x18')][_0xde3e('0x1e')],function(_0x57df9e){return{'model':db[_0x57df9e[_0xde3e('0x1f')]],'as':_0x57df9e['as'],'attributes':_0x57df9e[_0xde3e('0x1b')],'include':_0x57df9e[_0xde3e('0x1e')]?_['map'](_0x57df9e[_0xde3e('0x1e')],function(_0x78647){return{'model':db[_0x78647[_0xde3e('0x1f')]],'as':_0x78647['as'],'attributes':_0x78647[_0xde3e('0x1b')],'include':_0x78647[_0xde3e('0x1e')]?_['map'](_0x78647['include'],function(_0x6c0db0){return{'model':db[_0x6c0db0[_0xde3e('0x1f')]],'as':_0x6c0db0['as'],'attributes':_0x6c0db0[_0xde3e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d1404){logger[_0xde3e('0x15')]('GetCampaign',_0x4aa02c);logger['debug'](_0xde3e('0x17'),_0x4aa02c,JSON[_0xde3e('0x11')](_0x3d1404));_0x276e83(_0x3d1404);})['catch'](function(_0x2e4c62){logger[_0xde3e('0x12')](_0xde3e('0x17'),_0x2e4c62['message'],_0x4aa02c);_0x264603(_0x460d69['error'](0x1f4,_0x2e4c62[_0xde3e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 1e4e22f..f70dd4f 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 _0x21a8=['addBlackLists','put','update','destroy','delete','removeLists','/:id/blacklists','removeBlackLists','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','index','/:id','isAuthenticated','show','getHoppers','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','/:id/clone','clone','addLists'];(function(_0x5d78f0,_0x3784f9){var _0x4d1012=function(_0x23d0ba){while(--_0x23d0ba){_0x5d78f0['push'](_0x5d78f0['shift']());}};_0x4d1012(++_0x3784f9);}(_0x21a8,0x1e5));var _0x821a=function(_0x59ff93,_0x4480c8){_0x59ff93=_0x59ff93-0x0;var _0x2d6f68=_0x21a8[_0x59ff93];return _0x2d6f68;};'use strict';var multer=require(_0x821a('0x0'));var util=require(_0x821a('0x1'));var path=require('path');var timeout=require(_0x821a('0x2'));var express=require('express');var router=express[_0x821a('0x3')]();var fs_extra=require(_0x821a('0x4'));var auth=require(_0x821a('0x5'));var interaction=require(_0x821a('0x6'));var config=require('../../config/environment');var controller=require(_0x821a('0x7'));router[_0x821a('0x8')]('/',auth['isAuthenticated'](),controller[_0x821a('0x9')]);router[_0x821a('0x8')](_0x821a('0xa'),auth[_0x821a('0xb')](),controller[_0x821a('0xc')]);router[_0x821a('0x8')]('/:id/hoppers',auth[_0x821a('0xb')](),controller[_0x821a('0xd')]);router[_0x821a('0x8')]('/:id/hopper_histories',auth['isAuthenticated'](),controller['getHopperHistories']);router['get'](_0x821a('0xe'),auth[_0x821a('0xb')](),controller[_0x821a('0xf')]);router[_0x821a('0x8')](_0x821a('0x10'),auth[_0x821a('0xb')](),controller[_0x821a('0x11')]);router[_0x821a('0x8')](_0x821a('0x12'),auth[_0x821a('0xb')](),controller[_0x821a('0x13')]);router['get']('/:id/blacklists',auth[_0x821a('0xb')](),controller[_0x821a('0x14')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x821a('0x15')](_0x821a('0x16'),auth[_0x821a('0xb')](),controller[_0x821a('0x17')]);router['post'](_0x821a('0x12'),auth[_0x821a('0xb')](),controller[_0x821a('0x18')]);router[_0x821a('0x15')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x821a('0x19')]);router[_0x821a('0x1a')](_0x821a('0xa'),auth[_0x821a('0xb')](),controller[_0x821a('0x1b')]);router['delete'](_0x821a('0xa'),auth['isAuthenticated'](),controller[_0x821a('0x1c')]);router[_0x821a('0x1d')](_0x821a('0x12'),auth[_0x821a('0xb')](),controller[_0x821a('0x1e')]);router[_0x821a('0x1d')](_0x821a('0x1f'),auth[_0x821a('0xb')](),controller[_0x821a('0x20')]);module[_0x821a('0x21')]=router; \ No newline at end of file +var _0x6315=['getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','/:id','update','destroy','/:id/lists','removeLists','removeBlackLists','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x6315,0xc7));var _0x5631=function(_0x5249dc,_0xeaa7a3){_0x5249dc=_0x5249dc-0x0;var _0x13eb2b=_0x6315[_0x5249dc];return _0x13eb2b;};'use strict';var multer=require(_0x5631('0x0'));var util=require('util');var path=require(_0x5631('0x1'));var timeout=require(_0x5631('0x2'));var express=require(_0x5631('0x3'));var router=express[_0x5631('0x4')]();var fs_extra=require(_0x5631('0x5'));var auth=require(_0x5631('0x6'));var interaction=require(_0x5631('0x7'));var config=require(_0x5631('0x8'));var controller=require(_0x5631('0x9'));router['get']('/',auth[_0x5631('0xa')](),controller[_0x5631('0xb')]);router[_0x5631('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x5631('0xd')]);router[_0x5631('0xc')](_0x5631('0xe'),auth[_0x5631('0xa')](),controller['getHoppers']);router[_0x5631('0xc')](_0x5631('0xf'),auth[_0x5631('0xa')](),controller[_0x5631('0x10')]);router[_0x5631('0xc')](_0x5631('0x11'),auth[_0x5631('0xa')](),controller[_0x5631('0x12')]);router[_0x5631('0xc')](_0x5631('0x13'),auth[_0x5631('0xa')](),controller[_0x5631('0x14')]);router[_0x5631('0xc')]('/:id/lists',auth['isAuthenticated'](),controller[_0x5631('0x15')]);router[_0x5631('0xc')](_0x5631('0x16'),auth[_0x5631('0xa')](),controller[_0x5631('0x17')]);router[_0x5631('0x18')]('/',auth['isAuthenticated'](),controller[_0x5631('0x19')]);router[_0x5631('0x18')](_0x5631('0x1a'),auth[_0x5631('0xa')](),controller[_0x5631('0x1b')]);router[_0x5631('0x18')]('/:id/lists',auth[_0x5631('0xa')](),controller[_0x5631('0x1c')]);router[_0x5631('0x18')](_0x5631('0x16'),auth['isAuthenticated'](),controller[_0x5631('0x1d')]);router[_0x5631('0x1e')](_0x5631('0x1f'),auth[_0x5631('0xa')](),controller[_0x5631('0x20')]);router['delete'](_0x5631('0x1f'),auth[_0x5631('0xa')](),controller[_0x5631('0x21')]);router['delete'](_0x5631('0x22'),auth[_0x5631('0xa')](),controller[_0x5631('0x23')]);router['delete'](_0x5631('0x16'),auth[_0x5631('0xa')](),controller[_0x5631('0x24')]);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 079472d..62d7fe4 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 _0x3364=['medium','getDataValue','key','sequelize','STRING','TEXT'];(function(_0x6e40fb,_0x17d469){var _0x1ff308=function(_0x576b18){while(--_0x576b18){_0x6e40fb['push'](_0x6e40fb['shift']());}};_0x1ff308(++_0x17d469);}(_0x3364,0x177));var _0x4336=function(_0x3abb8d,_0x1fc9cd){_0x3abb8d=_0x3abb8d-0x0;var _0x14dbf2=_0x3364[_0x3abb8d];return _0x14dbf2;};'use strict';var Sequelize=require(_0x4336('0x0'));module['exports']={'key':{'type':Sequelize[_0x4336('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x4336('0x2')],'length':_0x4336('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x4336('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4336('0x4')](_0x4336('0x5'));}}}; \ No newline at end of file +var _0xc5f7=['medium','STRING','VIRTUAL','getDataValue','key','TEXT'];(function(_0x302c27,_0x60bd8){var _0x3a8bbf=function(_0x5e2753){while(--_0x5e2753){_0x302c27['push'](_0x302c27['shift']());}};_0x3a8bbf(++_0x60bd8);}(_0xc5f7,0xad));var _0x7c5f=function(_0x4458dd,_0x58e790){_0x4458dd=_0x4458dd-0x0;var _0x170a48=_0xc5f7[_0x4458dd];return _0x170a48;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x7c5f('0x0')],'length':_0x7c5f('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x7c5f('0x2')]},'name':{'type':Sequelize[_0x7c5f('0x3')],'get':function(){return this[_0x7c5f('0x4')](_0x7c5f('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 5b8c74d..e1ed769 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 _0xe393=['to-csv','ejs','lodash','squel','crypto','jsforce','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','get','CannedAnswers','end','sendStatus','error','stack','name','send','index','map','CannedAnswer','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','show','params','rawAttributes','find','catch','update','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','mustache','path','sox'];(function(_0x3d5351,_0x27bc80){var _0x1db4db=function(_0x3f572b){while(--_0x3f572b){_0x3d5351['push'](_0x3d5351['shift']());}};_0x1db4db(++_0x27bc80);}(_0xe393,0x190));var _0x3e39=function(_0x42fe9c,_0x8ea8df){_0x42fe9c=_0x42fe9c-0x0;var _0xe8737f=_0xe393[_0x42fe9c];return _0xe8737f;};'use strict';var emlformat=require(_0x3e39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3e39('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3e39('0x2'));var util=require('util');var path=require(_0x3e39('0x3'));var sox=require(_0x3e39('0x4'));var csv=require(_0x3e39('0x5'));var ejs=require(_0x3e39('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e39('0x7'));var squel=require(_0x3e39('0x8'));var crypto=require(_0x3e39('0x9'));var jsforce=require(_0x3e39('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e39('0xb'));var logger=require(_0x3e39('0xc'))(_0x3e39('0xd'));var utils=require(_0x3e39('0xe'));var config=require('../../config/environment');var licenseUtil=require(_0x3e39('0xf'));var db=require(_0x3e39('0x10'))['db'];function respondWithStatusCode(_0x1773e7,_0x4d3228){_0x4d3228=_0x4d3228||0xcc;return function(_0x403bed){if(_0x403bed){return _0x1773e7['sendStatus'](_0x4d3228);}return _0x1773e7[_0x3e39('0x11')](_0x4d3228)['end']();};}function respondWithResult(_0x593957,_0x170c38){_0x170c38=_0x170c38||0xc8;return function(_0x5b2c6e){if(_0x5b2c6e){return _0x593957[_0x3e39('0x11')](_0x170c38)[_0x3e39('0x12')](_0x5b2c6e);}};}function respondWithFilteredResult(_0x59003b,_0x442e6d){return function(_0x4a0ea2){if(_0x4a0ea2){var _0x3facb3=typeof _0x442e6d[_0x3e39('0x13')]===_0x3e39('0x14')&&typeof _0x442e6d[_0x3e39('0x15')]==='undefined';var _0x4021f8=_0x4a0ea2[_0x3e39('0x16')];var _0x14e0e5=_0x3facb3?0x0:_0x442e6d[_0x3e39('0x13')];var _0x2d0f5b=_0x3facb3?_0x4a0ea2[_0x3e39('0x16')]:_0x442e6d['offset']+_0x442e6d[_0x3e39('0x15')];var _0x42e30e;if(_0x2d0f5b>=_0x4021f8){_0x2d0f5b=_0x4021f8;_0x42e30e=0xc8;}else{_0x42e30e=0xce;}_0x59003b[_0x3e39('0x11')](_0x42e30e);return _0x59003b[_0x3e39('0x17')]('Content-Range',_0x14e0e5+'-'+_0x2d0f5b+'/'+_0x4021f8)[_0x3e39('0x12')](_0x4a0ea2);}return null;};}function patchUpdates(_0x14779e){return function(_0x4567e9){try{jsonpatch[_0x3e39('0x18')](_0x4567e9,_0x14779e,!![]);}catch(_0x5570b2){return BPromise[_0x3e39('0x19')](_0x5570b2);}return _0x4567e9[_0x3e39('0x1a')]();};}function saveUpdates(_0x426f84,_0x1d64b9){return function(_0x248d91){if(_0x248d91){return _0x248d91['update'](_0x426f84)['then'](function(_0x15650b){return _0x15650b;});}return null;};}function removeEntity(_0x54b14e,_0x53ac35){return function(_0x310d57){if(_0x310d57){return _0x310d57[_0x3e39('0x1b')]()[_0x3e39('0x1c')](function(){var _0x65e981=_0x310d57[_0x3e39('0x1d')]({'plain':!![]});var _0xae702a=_0x3e39('0x1e');return db['UserProfileResource'][_0x3e39('0x1b')]({'where':{'type':_0xae702a,'resourceId':_0x65e981['id']}})['then'](function(){return _0x310d57;});})[_0x3e39('0x1c')](function(){_0x54b14e[_0x3e39('0x11')](0xcc)[_0x3e39('0x1f')]();});}};}function handleEntityNotFound(_0x1f7a45,_0x13126d){return function(_0x256b37){if(!_0x256b37){_0x1f7a45[_0x3e39('0x20')](0x194);}return _0x256b37;};}function handleError(_0x47b7d1,_0x51a436){_0x51a436=_0x51a436||0x1f4;return function(_0xa5a10c){logger[_0x3e39('0x21')](_0xa5a10c[_0x3e39('0x22')]);if(_0xa5a10c[_0x3e39('0x23')]){delete _0xa5a10c['name'];}_0x47b7d1['status'](_0x51a436)[_0x3e39('0x24')](_0xa5a10c);};}exports[_0x3e39('0x25')]=function(_0x46bd85,_0x27f000){var _0x22e391={},_0x373030={},_0x53fdeb={'count':0x0,'rows':[]};var _0x936222=_[_0x3e39('0x26')](db[_0x3e39('0x27')]['rawAttributes'],function(_0x47b6d7){return{'name':_0x47b6d7['fieldName'],'type':_0x47b6d7[_0x3e39('0x28')]['key']};});_0x373030['model']=_[_0x3e39('0x26')](_0x936222,_0x3e39('0x23'));_0x373030['query']=_[_0x3e39('0x29')](_0x46bd85[_0x3e39('0x2a')]);_0x373030[_0x3e39('0x2b')]=_[_0x3e39('0x2c')](_0x373030[_0x3e39('0x2d')],_0x373030['query']);_0x22e391[_0x3e39('0x2e')]=_['intersection'](_0x373030[_0x3e39('0x2d')],qs[_0x3e39('0x2f')](_0x46bd85['query'][_0x3e39('0x2f')]));_0x22e391[_0x3e39('0x2e')]=_0x22e391[_0x3e39('0x2e')][_0x3e39('0x30')]?_0x22e391[_0x3e39('0x2e')]:_0x373030[_0x3e39('0x2d')];if(!_0x46bd85[_0x3e39('0x2a')][_0x3e39('0x31')](_0x3e39('0x32'))){_0x22e391[_0x3e39('0x15')]=qs[_0x3e39('0x15')](_0x46bd85[_0x3e39('0x2a')]['limit']);_0x22e391[_0x3e39('0x13')]=qs[_0x3e39('0x13')](_0x46bd85[_0x3e39('0x2a')][_0x3e39('0x13')]);}_0x22e391[_0x3e39('0x33')]=qs['sort'](_0x46bd85[_0x3e39('0x2a')][_0x3e39('0x34')]);_0x22e391[_0x3e39('0x35')]=qs['filters'](_[_0x3e39('0x36')](_0x46bd85[_0x3e39('0x2a')],_0x373030['filters']),_0x936222);if(_0x46bd85[_0x3e39('0x2a')][_0x3e39('0x37')]){_0x22e391['where']=_[_0x3e39('0x38')](_0x22e391[_0x3e39('0x35')],{'$or':[{'key':{'$like':'%'+_0x46bd85[_0x3e39('0x2a')]['filter']+'%'}},{'value':{'$like':'%'+_0x46bd85[_0x3e39('0x2a')][_0x3e39('0x37')]+'%'}}]});}_0x22e391=_['merge']({},_0x22e391,_0x46bd85[_0x3e39('0x39')]);var _0x57c74b={'where':_0x22e391[_0x3e39('0x35')]};return db[_0x3e39('0x27')]['count'](_0x57c74b)[_0x3e39('0x1c')](function(_0x484750){_0x53fdeb[_0x3e39('0x16')]=_0x484750;if(_0x46bd85['query'][_0x3e39('0x3a')]){_0x22e391[_0x3e39('0x3b')]=[{'all':!![]}];}return db[_0x3e39('0x27')]['findAll'](_0x22e391);})[_0x3e39('0x1c')](function(_0x181ea2){_0x53fdeb['rows']=_0x181ea2;return _0x53fdeb;})['then'](respondWithFilteredResult(_0x27f000,_0x22e391))['catch'](handleError(_0x27f000,null));};exports[_0x3e39('0x3c')]=function(_0x2984de,_0x7ad944){var _0x27de05={'raw':!![],'where':{'id':_0x2984de[_0x3e39('0x3d')]['id']}},_0x40b3d5={};_0x40b3d5[_0x3e39('0x2d')]=_[_0x3e39('0x29')](db[_0x3e39('0x27')][_0x3e39('0x3e')]);_0x40b3d5['query']=_[_0x3e39('0x29')](_0x2984de[_0x3e39('0x2a')]);_0x40b3d5[_0x3e39('0x2b')]=_['intersection'](_0x40b3d5[_0x3e39('0x2d')],_0x40b3d5[_0x3e39('0x2a')]);_0x27de05[_0x3e39('0x2e')]=_[_0x3e39('0x2c')](_0x40b3d5['model'],qs['fields'](_0x2984de[_0x3e39('0x2a')][_0x3e39('0x2f')]));_0x27de05[_0x3e39('0x2e')]=_0x27de05[_0x3e39('0x2e')]['length']?_0x27de05[_0x3e39('0x2e')]:_0x40b3d5[_0x3e39('0x2d')];if(_0x2984de['query'][_0x3e39('0x3a')]){_0x27de05[_0x3e39('0x3b')]=[{'all':!![]}];}_0x27de05=_['merge']({},_0x27de05,_0x2984de['options']);return db[_0x3e39('0x27')][_0x3e39('0x3f')](_0x27de05)[_0x3e39('0x1c')](handleEntityNotFound(_0x7ad944,null))['then'](respondWithResult(_0x7ad944,null))[_0x3e39('0x40')](handleError(_0x7ad944,null));};exports[_0x3e39('0x41')]=function(_0x54f7e9,_0x5257d8){if(_0x54f7e9[_0x3e39('0x42')]['id']){delete _0x54f7e9[_0x3e39('0x42')]['id'];}return db[_0x3e39('0x27')][_0x3e39('0x3f')]({'where':{'id':_0x54f7e9[_0x3e39('0x3d')]['id']}})[_0x3e39('0x1c')](handleEntityNotFound(_0x5257d8,null))['then'](saveUpdates(_0x54f7e9[_0x3e39('0x42')],null))[_0x3e39('0x1c')](respondWithResult(_0x5257d8,null))[_0x3e39('0x40')](handleError(_0x5257d8,null));};exports[_0x3e39('0x1b')]=function(_0x1c9f46,_0x5d77ff){return db[_0x3e39('0x27')]['find']({'where':{'id':_0x1c9f46['params']['id']}})[_0x3e39('0x1c')](handleEntityNotFound(_0x5d77ff,null))[_0x3e39('0x1c')](removeEntity(_0x5d77ff,null))['catch'](handleError(_0x5d77ff,null));};exports['create']=function(_0x40a579,_0x106b28){var _0x18ee02={'key':_0x40a579[_0x3e39('0x42')]['key']};if(_0x40a579[_0x3e39('0x42')][_0x3e39('0x43')]){_0x18ee02[_0x3e39('0x43')]=_0x40a579[_0x3e39('0x42')][_0x3e39('0x43')];}else if(_0x40a579[_0x3e39('0x42')]['SmsAccountId']){_0x18ee02[_0x3e39('0x44')]=_0x40a579[_0x3e39('0x42')][_0x3e39('0x44')];}else if(_0x40a579['body'][_0x3e39('0x45')]){_0x18ee02[_0x3e39('0x45')]=_0x40a579[_0x3e39('0x42')]['OpenchannelAccountId'];}else if(_0x40a579[_0x3e39('0x42')]['ChatWebsiteId']){_0x18ee02['ChatWebsiteId']=_0x40a579[_0x3e39('0x42')]['ChatWebsiteId'];}return db[_0x3e39('0x27')][_0x3e39('0x3f')]({'where':_0x18ee02})[_0x3e39('0x1c')](function(_0x118a13){if(_0x118a13){throw new db['Sequelize'][(_0x3e39('0x46'))](_0x3e39('0x47'));}return db[_0x3e39('0x27')][_0x3e39('0x48')](_0x40a579[_0x3e39('0x42')]);})['then'](function(_0x2b3b49){var _0x59e39f=_0x40a579[_0x3e39('0x49')][_0x3e39('0x1d')]({'plain':!![]});if(!_0x59e39f)throw new Error(_0x3e39('0x4a'));if(_0x59e39f[_0x3e39('0x4b')]===_0x3e39('0x49')){var _0x4ec19d=_0x2b3b49[_0x3e39('0x1d')]({'plain':!![]});return db[_0x3e39('0x4c')][_0x3e39('0x3f')]({'where':{'name':_0x3e39('0x1e'),'userProfileId':_0x59e39f[_0x3e39('0x4d')]},'raw':!![]})[_0x3e39('0x1c')](function(_0x1d7ef5){if(_0x1d7ef5&&_0x1d7ef5[_0x3e39('0x4e')]===0x0){return db[_0x3e39('0x4f')][_0x3e39('0x48')]({'name':_0x4ec19d[_0x3e39('0x23')],'resourceId':_0x4ec19d['id'],'type':_0x1d7ef5[_0x3e39('0x23')],'sectionId':_0x1d7ef5['id']},{})[_0x3e39('0x1c')](function(){return _0x2b3b49;});}else{return _0x2b3b49;}})[_0x3e39('0x40')](function(_0x3e2dfe){logger['error'](_0x3e39('0x50'),_0x3e2dfe);throw _0x3e2dfe;});}return _0x2b3b49;})[_0x3e39('0x1c')](respondWithResult(_0x106b28,0xc9))[_0x3e39('0x40')](handleError(_0x106b28,null));}; \ No newline at end of file +var _0xc039=['key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','get','CannedAnswers','error','stack','name','CannedAnswer','rawAttributes','fieldName','model','map','query','intersection','fields','attributes','length','hasOwnProperty','order','filters','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','keys','find','body','create'];(function(_0x2b8a92,_0x192f64){var _0x31f0da=function(_0x208455){while(--_0x208455){_0x2b8a92['push'](_0x2b8a92['shift']());}};_0x31f0da(++_0x192f64);}(_0xc039,0x1ac));var _0x9c03=function(_0x3a95d8,_0x480b83){_0x3a95d8=_0x3a95d8-0x0;var _0x41e266=_0xc039[_0x3a95d8];return _0x41e266;};'use strict';var emlformat=require(_0x9c03('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c03('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c03('0x2'));var moment=require(_0x9c03('0x3'));var BPromise=require(_0x9c03('0x4'));var Mustache=require(_0x9c03('0x5'));var util=require(_0x9c03('0x6'));var path=require(_0x9c03('0x7'));var sox=require('sox');var csv=require(_0x9c03('0x8'));var ejs=require(_0x9c03('0x9'));var fs=require('fs');var fs_extra=require(_0x9c03('0xa'));var _=require(_0x9c03('0xb'));var squel=require(_0x9c03('0xc'));var crypto=require(_0x9c03('0xd'));var jsforce=require(_0x9c03('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9c03('0x8'));var querystring=require(_0x9c03('0xf'));var Papa=require(_0x9c03('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9c03('0x11'));var as=require(_0x9c03('0x12'));var hardwareService=require(_0x9c03('0x13'));var logger=require(_0x9c03('0x14'))('api');var utils=require(_0x9c03('0x15'));var config=require(_0x9c03('0x16'));var licenseUtil=require(_0x9c03('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x527e6f,_0x2e8386){_0x2e8386=_0x2e8386||0xcc;return function(_0x576c33){if(_0x576c33){return _0x527e6f[_0x9c03('0x18')](_0x2e8386);}return _0x527e6f[_0x9c03('0x19')](_0x2e8386)[_0x9c03('0x1a')]();};}function respondWithResult(_0x58e38d,_0x45e508){_0x45e508=_0x45e508||0xc8;return function(_0x1c94d0){if(_0x1c94d0){return _0x58e38d[_0x9c03('0x19')](_0x45e508)[_0x9c03('0x1b')](_0x1c94d0);}};}function respondWithFilteredResult(_0x15dc93,_0x461aa9){return function(_0xbf941f){if(_0xbf941f){var _0x3c00e9=typeof _0x461aa9[_0x9c03('0x1c')]==='undefined'&&typeof _0x461aa9[_0x9c03('0x1d')]==='undefined';var _0x491b76=_0xbf941f[_0x9c03('0x1e')];var _0x4843ca=_0x3c00e9?0x0:_0x461aa9['offset'];var _0x102350=_0x3c00e9?_0xbf941f['count']:_0x461aa9[_0x9c03('0x1c')]+_0x461aa9[_0x9c03('0x1d')];var _0x1639ef;if(_0x102350>=_0x491b76){_0x102350=_0x491b76;_0x1639ef=0xc8;}else{_0x1639ef=0xce;}_0x15dc93[_0x9c03('0x19')](_0x1639ef);return _0x15dc93[_0x9c03('0x1f')](_0x9c03('0x20'),_0x4843ca+'-'+_0x102350+'/'+_0x491b76)[_0x9c03('0x1b')](_0xbf941f);}return null;};}function patchUpdates(_0x50a190){return function(_0x2c1454){try{jsonpatch[_0x9c03('0x21')](_0x2c1454,_0x50a190,!![]);}catch(_0x23b25b){return BPromise['reject'](_0x23b25b);}return _0x2c1454[_0x9c03('0x22')]();};}function saveUpdates(_0x24727c,_0xa0a72){return function(_0x4d284c){if(_0x4d284c){return _0x4d284c[_0x9c03('0x23')](_0x24727c)[_0x9c03('0x24')](function(_0xcad1fd){return _0xcad1fd;});}return null;};}function removeEntity(_0x2cbec4,_0x5e568e){return function(_0x5d9dd5){if(_0x5d9dd5){return _0x5d9dd5[_0x9c03('0x25')]()[_0x9c03('0x24')](function(){var _0x14ee54=_0x5d9dd5[_0x9c03('0x26')]({'plain':!![]});var _0x317101=_0x9c03('0x27');return db['UserProfileResource'][_0x9c03('0x25')]({'where':{'type':_0x317101,'resourceId':_0x14ee54['id']}})[_0x9c03('0x24')](function(){return _0x5d9dd5;});})[_0x9c03('0x24')](function(){_0x2cbec4['status'](0xcc)[_0x9c03('0x1a')]();});}};}function handleEntityNotFound(_0x5d718e,_0x521354){return function(_0x241a2d){if(!_0x241a2d){_0x5d718e['sendStatus'](0x194);}return _0x241a2d;};}function handleError(_0x5ca6ed,_0x49fe9f){_0x49fe9f=_0x49fe9f||0x1f4;return function(_0x49f1f1){logger[_0x9c03('0x28')](_0x49f1f1[_0x9c03('0x29')]);if(_0x49f1f1[_0x9c03('0x2a')]){delete _0x49f1f1[_0x9c03('0x2a')];}_0x5ca6ed[_0x9c03('0x19')](_0x49fe9f)['send'](_0x49f1f1);};}exports['index']=function(_0x29aadb,_0x3fcb3d){var _0x286df1={},_0x501e79={},_0x1aa641={'count':0x0,'rows':[]};var _0x24d51e=_['map'](db[_0x9c03('0x2b')][_0x9c03('0x2c')],function(_0x447b00){return{'name':_0x447b00[_0x9c03('0x2d')],'type':_0x447b00['type']['key']};});_0x501e79[_0x9c03('0x2e')]=_[_0x9c03('0x2f')](_0x24d51e,'name');_0x501e79['query']=_['keys'](_0x29aadb[_0x9c03('0x30')]);_0x501e79['filters']=_[_0x9c03('0x31')](_0x501e79[_0x9c03('0x2e')],_0x501e79[_0x9c03('0x30')]);_0x286df1['attributes']=_[_0x9c03('0x31')](_0x501e79['model'],qs['fields'](_0x29aadb[_0x9c03('0x30')][_0x9c03('0x32')]));_0x286df1['attributes']=_0x286df1[_0x9c03('0x33')][_0x9c03('0x34')]?_0x286df1[_0x9c03('0x33')]:_0x501e79[_0x9c03('0x2e')];if(!_0x29aadb['query'][_0x9c03('0x35')]('nolimit')){_0x286df1['limit']=qs[_0x9c03('0x1d')](_0x29aadb['query'][_0x9c03('0x1d')]);_0x286df1[_0x9c03('0x1c')]=qs[_0x9c03('0x1c')](_0x29aadb[_0x9c03('0x30')][_0x9c03('0x1c')]);}_0x286df1[_0x9c03('0x36')]=qs['sort'](_0x29aadb[_0x9c03('0x30')]['sort']);_0x286df1['where']=qs[_0x9c03('0x37')](_['pick'](_0x29aadb['query'],_0x501e79['filters']),_0x24d51e);if(_0x29aadb[_0x9c03('0x30')][_0x9c03('0x38')]){_0x286df1['where']=_['merge'](_0x286df1[_0x9c03('0x39')],{'$or':[{'key':{'$like':'%'+_0x29aadb[_0x9c03('0x30')][_0x9c03('0x38')]+'%'}},{'value':{'$like':'%'+_0x29aadb[_0x9c03('0x30')][_0x9c03('0x38')]+'%'}}]});}_0x286df1=_[_0x9c03('0x3a')]({},_0x286df1,_0x29aadb['options']);var _0x17eba2={'where':_0x286df1[_0x9c03('0x39')]};return db[_0x9c03('0x2b')][_0x9c03('0x1e')](_0x17eba2)[_0x9c03('0x24')](function(_0x63301d){_0x1aa641[_0x9c03('0x1e')]=_0x63301d;if(_0x29aadb[_0x9c03('0x30')][_0x9c03('0x3b')]){_0x286df1[_0x9c03('0x3c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9c03('0x3d')](_0x286df1);})[_0x9c03('0x24')](function(_0x2c7016){_0x1aa641[_0x9c03('0x3e')]=_0x2c7016;return _0x1aa641;})[_0x9c03('0x24')](respondWithFilteredResult(_0x3fcb3d,_0x286df1))[_0x9c03('0x3f')](handleError(_0x3fcb3d,null));};exports[_0x9c03('0x40')]=function(_0x31fd3d,_0x22ede9){var _0x2ff7a6={'raw':!![],'where':{'id':_0x31fd3d[_0x9c03('0x41')]['id']}},_0x2d762f={};_0x2d762f['model']=_[_0x9c03('0x42')](db[_0x9c03('0x2b')]['rawAttributes']);_0x2d762f['query']=_[_0x9c03('0x42')](_0x31fd3d[_0x9c03('0x30')]);_0x2d762f['filters']=_[_0x9c03('0x31')](_0x2d762f[_0x9c03('0x2e')],_0x2d762f[_0x9c03('0x30')]);_0x2ff7a6[_0x9c03('0x33')]=_[_0x9c03('0x31')](_0x2d762f[_0x9c03('0x2e')],qs[_0x9c03('0x32')](_0x31fd3d['query'][_0x9c03('0x32')]));_0x2ff7a6[_0x9c03('0x33')]=_0x2ff7a6[_0x9c03('0x33')][_0x9c03('0x34')]?_0x2ff7a6['attributes']:_0x2d762f['model'];if(_0x31fd3d[_0x9c03('0x30')][_0x9c03('0x3b')]){_0x2ff7a6[_0x9c03('0x3c')]=[{'all':!![]}];}_0x2ff7a6=_['merge']({},_0x2ff7a6,_0x31fd3d['options']);return db['CannedAnswer'][_0x9c03('0x43')](_0x2ff7a6)[_0x9c03('0x24')](handleEntityNotFound(_0x22ede9,null))[_0x9c03('0x24')](respondWithResult(_0x22ede9,null))[_0x9c03('0x3f')](handleError(_0x22ede9,null));};exports[_0x9c03('0x23')]=function(_0x1deaf2,_0x1a7875){if(_0x1deaf2[_0x9c03('0x44')]['id']){delete _0x1deaf2['body']['id'];}return db[_0x9c03('0x2b')][_0x9c03('0x43')]({'where':{'id':_0x1deaf2[_0x9c03('0x41')]['id']}})[_0x9c03('0x24')](handleEntityNotFound(_0x1a7875,null))[_0x9c03('0x24')](saveUpdates(_0x1deaf2[_0x9c03('0x44')],null))[_0x9c03('0x24')](respondWithResult(_0x1a7875,null))['catch'](handleError(_0x1a7875,null));};exports[_0x9c03('0x25')]=function(_0x356084,_0x47b1b0){return db[_0x9c03('0x2b')][_0x9c03('0x43')]({'where':{'id':_0x356084[_0x9c03('0x41')]['id']}})[_0x9c03('0x24')](handleEntityNotFound(_0x47b1b0,null))['then'](removeEntity(_0x47b1b0,null))[_0x9c03('0x3f')](handleError(_0x47b1b0,null));};exports[_0x9c03('0x45')]=function(_0x69c3bf,_0xc508dc){var _0x44d18c={'key':_0x69c3bf[_0x9c03('0x44')][_0x9c03('0x46')]};if(_0x69c3bf['body'][_0x9c03('0x47')]){_0x44d18c['MailAccountId']=_0x69c3bf[_0x9c03('0x44')][_0x9c03('0x47')];}else if(_0x69c3bf[_0x9c03('0x44')][_0x9c03('0x48')]){_0x44d18c['SmsAccountId']=_0x69c3bf[_0x9c03('0x44')][_0x9c03('0x48')];}else if(_0x69c3bf[_0x9c03('0x44')][_0x9c03('0x49')]){_0x44d18c[_0x9c03('0x49')]=_0x69c3bf[_0x9c03('0x44')][_0x9c03('0x49')];}else if(_0x69c3bf['body']['ChatWebsiteId']){_0x44d18c[_0x9c03('0x4a')]=_0x69c3bf[_0x9c03('0x44')][_0x9c03('0x4a')];}return db[_0x9c03('0x2b')][_0x9c03('0x43')]({'where':_0x44d18c})[_0x9c03('0x24')](function(_0x52304c){if(_0x52304c){throw new db[(_0x9c03('0x4b'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x9c03('0x2b')][_0x9c03('0x45')](_0x69c3bf['body']);})[_0x9c03('0x24')](function(_0x31ee1b){var _0x354bdd=_0x69c3bf[_0x9c03('0x4c')][_0x9c03('0x26')]({'plain':!![]});if(!_0x354bdd)throw new Error(_0x9c03('0x4d'));if(_0x354bdd[_0x9c03('0x4e')]===_0x9c03('0x4c')){var _0x44c7b1=_0x31ee1b[_0x9c03('0x26')]({'plain':!![]});return db[_0x9c03('0x4f')][_0x9c03('0x43')]({'where':{'name':_0x9c03('0x27'),'userProfileId':_0x354bdd[_0x9c03('0x50')]},'raw':!![]})['then'](function(_0x56096c){if(_0x56096c&&_0x56096c[_0x9c03('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x44c7b1[_0x9c03('0x2a')],'resourceId':_0x44c7b1['id'],'type':_0x56096c[_0x9c03('0x2a')],'sectionId':_0x56096c['id']},{})['then'](function(){return _0x31ee1b;});}else{return _0x31ee1b;}})['catch'](function(_0x3f28da){logger[_0x9c03('0x28')](_0x9c03('0x52'),_0x3f28da);throw _0x3f28da;});}return _0x31ee1b;})['then'](respondWithResult(_0xc508dc,0xc9))['catch'](handleError(_0xc508dc,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index c492a48..6a8f9cc 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 _0xcecc=['define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x43983b,_0x438dc1){var _0x493729=function(_0x3f1f5c){while(--_0x3f1f5c){_0x43983b['push'](_0x43983b['shift']());}};_0x493729(++_0x438dc1);}(_0xcecc,0x115));var _0xccec=function(_0x434bb3,_0x1de996){_0x434bb3=_0x434bb3-0x0;var _0x23bffe=_0xcecc[_0x434bb3];return _0x23bffe;};'use strict';var _=require(_0xccec('0x0'));var util=require(_0xccec('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xccec('0x2'));var BPromise=require(_0xccec('0x3'));var rp=require(_0xccec('0x4'));var fs=require('fs');var path=require(_0xccec('0x5'));var rimraf=require('rimraf');var config=require(_0xccec('0x6'));var attributes=require(_0xccec('0x7'));module[_0xccec('0x8')]=function(_0x15b1f3,_0x25af93){return _0x15b1f3[_0xccec('0x9')](_0xccec('0xa'),attributes,{'tableName':_0xccec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xccec('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x39b8=['define','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./cannedAnswer.attributes'];(function(_0x52c9a9,_0x22bf6b){var _0x444f88=function(_0x40260c){while(--_0x40260c){_0x52c9a9['push'](_0x52c9a9['shift']());}};_0x444f88(++_0x22bf6b);}(_0x39b8,0x65));var _0x839b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x39b8[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x839b('0x0'));var util=require(_0x839b('0x1'));var logger=require(_0x839b('0x2'))(_0x839b('0x3'));var moment=require(_0x839b('0x4'));var BPromise=require(_0x839b('0x5'));var rp=require(_0x839b('0x6'));var fs=require('fs');var path=require(_0x839b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x839b('0x8'));module['exports']=function(_0x3d15d7,_0x57ffe9){return _0x3d15d7[_0x839b('0x9')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x839b('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 3fb93dd..e3b1d21 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(_0x1d346f,_0x2c831b){var _0x1c1881=function(_0x32273f){while(--_0x32273f){_0x1d346f['push'](_0x1d346f['shift']());}};_0x1c1881(++_0x2c831b);}(_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 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(_0x25f73f,_0x3e6c01){var _0x29b765=function(_0x50640a){while(--_0x50640a){_0x25f73f['push'](_0x25f73f['shift']());}};_0x29b765(++_0x3e6c01);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 dfab50e..19202c0 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 _0x3182=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','post','create','put'];(function(_0x3c9bb5,_0x49b022){var _0x5ec7c7=function(_0x4c1509){while(--_0x4c1509){_0x3c9bb5['push'](_0x3c9bb5['shift']());}};_0x5ec7c7(++_0x49b022);}(_0x3182,0xb8));var _0x2318=function(_0x5352cb,_0x3c9353){_0x5352cb=_0x5352cb-0x0;var _0x47b32b=_0x3182[_0x5352cb];return _0x47b32b;};'use strict';var multer=require('multer');var util=require(_0x2318('0x0'));var path=require(_0x2318('0x1'));var timeout=require(_0x2318('0x2'));var express=require(_0x2318('0x3'));var router=express[_0x2318('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2318('0x5'));var interaction=require(_0x2318('0x6'));var config=require(_0x2318('0x7'));var controller=require('./cannedAnswer.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2318('0x8'),auth[_0x2318('0x9')](),controller[_0x2318('0xa')]);router[_0x2318('0xb')]('/',auth['isAuthenticated'](),controller[_0x2318('0xc')]);router[_0x2318('0xd')](_0x2318('0x8'),auth[_0x2318('0x9')](),controller[_0x2318('0xe')]);router[_0x2318('0xf')](_0x2318('0x8'),auth[_0x2318('0x9')](),controller[_0x2318('0x10')]);module[_0x2318('0x11')]=router; \ No newline at end of file +var _0x8b11=['../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x29f54d,_0x4ef88a){var _0x229099=function(_0x14a741){while(--_0x14a741){_0x29f54d['push'](_0x29f54d['shift']());}};_0x229099(++_0x4ef88a);}(_0x8b11,0x145));var _0x18b1=function(_0x182094,_0x269200){_0x182094=_0x182094-0x0;var _0x2e74ff=_0x8b11[_0x182094];return _0x2e74ff;};'use strict';var multer=require(_0x18b1('0x0'));var util=require('util');var path=require(_0x18b1('0x1'));var timeout=require(_0x18b1('0x2'));var express=require(_0x18b1('0x3'));var router=express['Router']();var fs_extra=require(_0x18b1('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x18b1('0x5'));var controller=require('./cannedAnswer.controller');router[_0x18b1('0x6')]('/',auth[_0x18b1('0x7')](),controller[_0x18b1('0x8')]);router[_0x18b1('0x6')]('/:id',auth[_0x18b1('0x7')](),controller[_0x18b1('0x9')]);router[_0x18b1('0xa')]('/',auth[_0x18b1('0x7')](),controller[_0x18b1('0xb')]);router[_0x18b1('0xc')]('/:id',auth[_0x18b1('0x7')](),controller['update']);router['delete'](_0x18b1('0xd'),auth[_0x18b1('0x7')](),controller['destroy']);module[_0x18b1('0xe')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index a7d2920..e636a8f 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 _0x9000=['exports','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x1c523e,_0x308c68){var _0x43b130=function(_0x40693b){while(--_0x40693b){_0x1c523e['push'](_0x1c523e['shift']());}};_0x43b130(++_0x308c68);}(_0x9000,0x19e));var _0x0900=function(_0x4a7b64,_0x16733c){_0x4a7b64=_0x4a7b64-0x0;var _0x500da6=_0x9000[_0x4a7b64];return _0x500da6;};'use strict';var Sequelize=require(_0x0900('0x0'));module[_0x0900('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x0900('0x2')},'clid':{'type':Sequelize[_0x0900('0x3')]},'src':{'type':Sequelize[_0x0900('0x3')]},'dst':{'type':Sequelize[_0x0900('0x3')]},'dcontext':{'type':Sequelize[_0x0900('0x3')]},'channel':{'type':Sequelize[_0x0900('0x3')]},'dstchannel':{'type':Sequelize[_0x0900('0x3')]},'lastapp':{'type':Sequelize[_0x0900('0x3')]},'lastdata':{'type':Sequelize[_0x0900('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0900('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x0900('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x0900('0x3')]},'userfield':{'type':Sequelize[_0x0900('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x0900('0x3')]},'peeraccount':{'type':Sequelize[_0x0900('0x3')]},'type':{'type':Sequelize[_0x0900('0x3')]},'tag':{'type':Sequelize[_0x0900('0x3')]}}; \ No newline at end of file +var _0x422f=['STRING','INTEGER','sequelize','DATE','1970-01-01\x2000:00:01'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x422f,0xd9));var _0xf422=function(_0x82e4ae,_0x3ef9a1){_0x82e4ae=_0x82e4ae-0x0;var _0x49a2b3=_0x422f[_0x82e4ae];return _0x49a2b3;};'use strict';var Sequelize=require(_0xf422('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xf422('0x1')],'allowNull':![],'defaultValue':_0xf422('0x2')},'clid':{'type':Sequelize[_0xf422('0x3')]},'src':{'type':Sequelize[_0xf422('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xf422('0x3')]},'channel':{'type':Sequelize[_0xf422('0x3')]},'dstchannel':{'type':Sequelize[_0xf422('0x3')]},'lastapp':{'type':Sequelize[_0xf422('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xf422('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xf422('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf422('0x3')]},'amaflags':{'type':Sequelize[_0xf422('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xf422('0x3')]},'userfield':{'type':Sequelize[_0xf422('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xf422('0x3')]},'sequence':{'type':Sequelize[_0xf422('0x3')]},'peeraccount':{'type':Sequelize[_0xf422('0x3')]},'type':{'type':Sequelize[_0xf422('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index ebc47d2..898b221 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 _0xa751=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','status','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','Cdr','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','rows','catch','show','params','keys','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x3e079f,_0x189e15){var _0x296a34=function(_0xa31a0a){while(--_0xa31a0a){_0x3e079f['push'](_0x3e079f['shift']());}};_0x296a34(++_0x189e15);}(_0xa751,0x175));var _0x1a75=function(_0x1ab041,_0x3137d7){_0x1ab041=_0x1ab041-0x0;var _0x43b970=_0xa751[_0x1ab041];return _0x43b970;};'use strict';var emlformat=require(_0x1a75('0x0'));var rimraf=require(_0x1a75('0x1'));var zipdir=require(_0x1a75('0x2'));var jsonpatch=require(_0x1a75('0x3'));var rp=require('request-promise');var moment=require(_0x1a75('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1a75('0x5'));var util=require(_0x1a75('0x6'));var path=require(_0x1a75('0x7'));var sox=require('sox');var csv=require(_0x1a75('0x8'));var ejs=require(_0x1a75('0x9'));var fs=require('fs');var fs_extra=require(_0x1a75('0xa'));var _=require(_0x1a75('0xb'));var squel=require(_0x1a75('0xc'));var crypto=require(_0x1a75('0xd'));var jsforce=require(_0x1a75('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1a75('0xf'));var Redis=require(_0x1a75('0x10'));var authService=require(_0x1a75('0x11'));var qs=require(_0x1a75('0x12'));var as=require(_0x1a75('0x13'));var hardwareService=require(_0x1a75('0x14'));var logger=require(_0x1a75('0x15'))(_0x1a75('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a75('0x17'))['db'];function respondWithStatusCode(_0x24e8dc,_0xae1af0){_0xae1af0=_0xae1af0||0xcc;return function(_0x1220e4){if(_0x1220e4){return _0x24e8dc['sendStatus'](_0xae1af0);}return _0x24e8dc['status'](_0xae1af0)[_0x1a75('0x18')]();};}function respondWithResult(_0xf4a616,_0x48577b){_0x48577b=_0x48577b||0xc8;return function(_0x1c84d3){if(_0x1c84d3){return _0xf4a616[_0x1a75('0x19')](_0x48577b)['json'](_0x1c84d3);}};}function respondWithFilteredResult(_0x1f3c38,_0xb4a245){return function(_0x15a1ec){if(_0x15a1ec){var _0x5883df=typeof _0xb4a245['offset']==='undefined'&&typeof _0xb4a245[_0x1a75('0x1a')]===_0x1a75('0x1b');var _0x2b6f3d=_0x15a1ec[_0x1a75('0x1c')];var _0x1b1af2=_0x5883df?0x0:_0xb4a245[_0x1a75('0x1d')];var _0x47f384=_0x5883df?_0x15a1ec[_0x1a75('0x1c')]:_0xb4a245['offset']+_0xb4a245['limit'];var _0x42df2c;if(_0x47f384>=_0x2b6f3d){_0x47f384=_0x2b6f3d;_0x42df2c=0xc8;}else{_0x42df2c=0xce;}_0x1f3c38[_0x1a75('0x19')](_0x42df2c);return _0x1f3c38['set'](_0x1a75('0x1e'),_0x1b1af2+'-'+_0x47f384+'/'+_0x2b6f3d)['json'](_0x15a1ec);}return null;};}function patchUpdates(_0x4699c9){return function(_0x3e3549){try{jsonpatch[_0x1a75('0x1f')](_0x3e3549,_0x4699c9,!![]);}catch(_0x340750){return BPromise[_0x1a75('0x20')](_0x340750);}return _0x3e3549[_0x1a75('0x21')]();};}function saveUpdates(_0x5a0ad7,_0x3ed5e9){return function(_0x4dc595){if(_0x4dc595){return _0x4dc595[_0x1a75('0x22')](_0x5a0ad7)[_0x1a75('0x23')](function(_0x320413){return _0x320413;});}return null;};}function removeEntity(_0x59e3da,_0x443ff8){return function(_0x5e6617){if(_0x5e6617){return _0x5e6617[_0x1a75('0x24')]()[_0x1a75('0x23')](function(){_0x59e3da[_0x1a75('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9fe9fe,_0x126f40){return function(_0x4dec82){if(!_0x4dec82){_0x9fe9fe[_0x1a75('0x25')](0x194);}return _0x4dec82;};}function handleError(_0x399dae,_0x5a6acc){_0x5a6acc=_0x5a6acc||0x1f4;return function(_0x168e06){logger[_0x1a75('0x26')](_0x168e06[_0x1a75('0x27')]);if(_0x168e06[_0x1a75('0x28')]){delete _0x168e06['name'];}_0x399dae[_0x1a75('0x19')](_0x5a6acc)[_0x1a75('0x29')](_0x168e06);};}exports[_0x1a75('0x2a')]=function(_0x2f5ac9,_0xf33870){var _0x9e66b9={},_0x3b6e1d={},_0x38e885={'count':0x0,'rows':[]};var _0x5518ed=_['map'](db[_0x1a75('0x2b')][_0x1a75('0x2c')],function(_0x1a0359){return{'name':_0x1a0359[_0x1a75('0x2d')],'type':_0x1a0359[_0x1a75('0x2e')][_0x1a75('0x2f')]};});_0x3b6e1d[_0x1a75('0x30')]=_[_0x1a75('0x31')](_0x5518ed,'name');_0x3b6e1d['query']=_['keys'](_0x2f5ac9[_0x1a75('0x32')]);_0x3b6e1d[_0x1a75('0x33')]=_[_0x1a75('0x34')](_0x3b6e1d[_0x1a75('0x30')],_0x3b6e1d['query']);_0x9e66b9['attributes']=_['intersection'](_0x3b6e1d[_0x1a75('0x30')],qs[_0x1a75('0x35')](_0x2f5ac9['query']['fields']));_0x9e66b9[_0x1a75('0x36')]=_0x9e66b9['attributes'][_0x1a75('0x37')]?_0x9e66b9[_0x1a75('0x36')]:_0x3b6e1d[_0x1a75('0x30')];if(!_0x2f5ac9['query']['hasOwnProperty'](_0x1a75('0x38'))){_0x9e66b9[_0x1a75('0x1a')]=qs[_0x1a75('0x1a')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x1a')]);_0x9e66b9[_0x1a75('0x1d')]=qs[_0x1a75('0x1d')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x1d')]);}_0x9e66b9[_0x1a75('0x39')]=qs[_0x1a75('0x3a')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x3a')]);_0x9e66b9[_0x1a75('0x3b')]=qs[_0x1a75('0x33')](_[_0x1a75('0x3c')](_0x2f5ac9['query'],_0x3b6e1d[_0x1a75('0x33')]),_0x5518ed);if(_0x2f5ac9['query']['filter']){_0x9e66b9[_0x1a75('0x3b')]=_[_0x1a75('0x3d')](_0x9e66b9[_0x1a75('0x3b')],{'$or':_[_0x1a75('0x31')](_0x5518ed,function(_0x2842d4){if(_0x2842d4['type']!==_0x1a75('0x3e')){var _0xc88c40={};_0xc88c40[_0x2842d4[_0x1a75('0x28')]]={'$like':'%'+_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x3f')]+'%'};return _0xc88c40;}})});}_0x9e66b9=_['merge']({},_0x9e66b9,_0x2f5ac9[_0x1a75('0x40')]);var _0x481bfe={'where':_0x9e66b9[_0x1a75('0x3b')]};return db[_0x1a75('0x2b')][_0x1a75('0x1c')](_0x481bfe)[_0x1a75('0x23')](function(_0x269ed6){_0x38e885[_0x1a75('0x1c')]=_0x269ed6;if(_0x2f5ac9[_0x1a75('0x32')]['includeAll']){_0x9e66b9['include']=[{'all':!![]}];}return db[_0x1a75('0x2b')]['findAll'](_0x9e66b9);})[_0x1a75('0x23')](function(_0x14abcf){_0x38e885[_0x1a75('0x41')]=_0x14abcf;return _0x38e885;})['then'](respondWithFilteredResult(_0xf33870,_0x9e66b9))[_0x1a75('0x42')](handleError(_0xf33870,null));};exports[_0x1a75('0x43')]=function(_0x21bfae,_0x5a2c51){var _0x292cbc={'raw':!![],'where':{'id':_0x21bfae[_0x1a75('0x44')]['id']}},_0x15fe49={};_0x15fe49[_0x1a75('0x30')]=_[_0x1a75('0x45')](db[_0x1a75('0x2b')][_0x1a75('0x2c')]);_0x15fe49['query']=_[_0x1a75('0x45')](_0x21bfae[_0x1a75('0x32')]);_0x15fe49[_0x1a75('0x33')]=_[_0x1a75('0x34')](_0x15fe49[_0x1a75('0x30')],_0x15fe49['query']);_0x292cbc[_0x1a75('0x36')]=_[_0x1a75('0x34')](_0x15fe49['model'],qs[_0x1a75('0x35')](_0x21bfae['query'][_0x1a75('0x35')]));_0x292cbc['attributes']=_0x292cbc[_0x1a75('0x36')][_0x1a75('0x37')]?_0x292cbc[_0x1a75('0x36')]:_0x15fe49[_0x1a75('0x30')];if(_0x21bfae[_0x1a75('0x32')][_0x1a75('0x46')]){_0x292cbc[_0x1a75('0x47')]=[{'all':!![]}];}_0x292cbc=_['merge']({},_0x292cbc,_0x21bfae[_0x1a75('0x40')]);return db['Cdr'][_0x1a75('0x48')](_0x292cbc)[_0x1a75('0x23')](handleEntityNotFound(_0x5a2c51,null))[_0x1a75('0x23')](respondWithResult(_0x5a2c51,null))[_0x1a75('0x42')](handleError(_0x5a2c51,null));};exports[_0x1a75('0x49')]=function(_0x1bf8a0,_0x2cfacf){return db[_0x1a75('0x2b')]['create'](_0x1bf8a0[_0x1a75('0x4a')],{})[_0x1a75('0x23')](respondWithResult(_0x2cfacf,0xc9))[_0x1a75('0x42')](handleError(_0x2cfacf,null));};exports[_0x1a75('0x22')]=function(_0x385382,_0x1b76d){if(_0x385382[_0x1a75('0x4a')]['id']){delete _0x385382[_0x1a75('0x4a')]['id'];}return db[_0x1a75('0x2b')][_0x1a75('0x48')]({'where':{'id':_0x385382[_0x1a75('0x44')]['id']}})[_0x1a75('0x23')](handleEntityNotFound(_0x1b76d,null))[_0x1a75('0x23')](saveUpdates(_0x385382[_0x1a75('0x4a')],null))[_0x1a75('0x23')](respondWithResult(_0x1b76d,null))['catch'](handleError(_0x1b76d,null));};exports[_0x1a75('0x24')]=function(_0xa20c25,_0x1ae0cb){return db[_0x1a75('0x2b')][_0x1a75('0x48')]({'where':{'id':_0xa20c25[_0x1a75('0x44')]['id']}})[_0x1a75('0x23')](handleEntityNotFound(_0x1ae0cb,null))[_0x1a75('0x23')](removeEntity(_0x1ae0cb,null))['catch'](handleError(_0x1ae0cb,null));};exports[_0x1a75('0x4b')]=function(_0x5f44e3,_0x40e643){return db[_0x1a75('0x2b')][_0x1a75('0x4b')]()['then'](respondWithResult(_0x40e643,null))['catch'](handleError(_0x40e643,null));}; \ No newline at end of file +var _0x0fda=['limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','index','map','Cdr','fieldName','type','key','name','filters','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','keys','rawAttributes','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x1dd205,_0x4db82d){var _0x1f453a=function(_0x57d977){while(--_0x57d977){_0x1dd205['push'](_0x1dd205['shift']());}};_0x1f453a(++_0x4db82d);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x1054c7,_0x135ded){_0x1054c7=_0x1054c7-0x0;var _0x25f14a=_0x0fda[_0x1054c7];return _0x25f14a;};'use strict';var emlformat=require(_0xa0fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa0fd('0x1'));var jsonpatch=require(_0xa0fd('0x2'));var rp=require(_0xa0fd('0x3'));var moment=require(_0xa0fd('0x4'));var BPromise=require(_0xa0fd('0x5'));var Mustache=require(_0xa0fd('0x6'));var util=require(_0xa0fd('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa0fd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0fd('0x9'));var squel=require(_0xa0fd('0xa'));var crypto=require(_0xa0fd('0xb'));var jsforce=require(_0xa0fd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa0fd('0x8'));var querystring=require(_0xa0fd('0xd'));var Papa=require(_0xa0fd('0xe'));var Redis=require(_0xa0fd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa0fd('0x10'));var as=require(_0xa0fd('0x11'));var hardwareService=require(_0xa0fd('0x12'));var logger=require('../../config/logger')(_0xa0fd('0x13'));var utils=require(_0xa0fd('0x14'));var config=require(_0xa0fd('0x15'));var licenseUtil=require(_0xa0fd('0x16'));var db=require(_0xa0fd('0x17'))['db'];function respondWithStatusCode(_0x4d5c32,_0x490112){_0x490112=_0x490112||0xcc;return function(_0x32dcee){if(_0x32dcee){return _0x4d5c32[_0xa0fd('0x18')](_0x490112);}return _0x4d5c32['status'](_0x490112)[_0xa0fd('0x19')]();};}function respondWithResult(_0x8a67a5,_0x11e4eb){_0x11e4eb=_0x11e4eb||0xc8;return function(_0x1e4a48){if(_0x1e4a48){return _0x8a67a5[_0xa0fd('0x1a')](_0x11e4eb)[_0xa0fd('0x1b')](_0x1e4a48);}};}function respondWithFilteredResult(_0x2811c0,_0x4fe62c){return function(_0x1c6ffc){if(_0x1c6ffc){var _0x326ba8=typeof _0x4fe62c['offset']==='undefined'&&typeof _0x4fe62c[_0xa0fd('0x1c')]===_0xa0fd('0x1d');var _0x5d2d7b=_0x1c6ffc[_0xa0fd('0x1e')];var _0x22a876=_0x326ba8?0x0:_0x4fe62c[_0xa0fd('0x1f')];var _0x5073a8=_0x326ba8?_0x1c6ffc['count']:_0x4fe62c[_0xa0fd('0x1f')]+_0x4fe62c['limit'];var _0x40e288;if(_0x5073a8>=_0x5d2d7b){_0x5073a8=_0x5d2d7b;_0x40e288=0xc8;}else{_0x40e288=0xce;}_0x2811c0[_0xa0fd('0x1a')](_0x40e288);return _0x2811c0[_0xa0fd('0x20')](_0xa0fd('0x21'),_0x22a876+'-'+_0x5073a8+'/'+_0x5d2d7b)[_0xa0fd('0x1b')](_0x1c6ffc);}return null;};}function patchUpdates(_0x2273f4){return function(_0x113059){try{jsonpatch['apply'](_0x113059,_0x2273f4,!![]);}catch(_0x166934){return BPromise[_0xa0fd('0x22')](_0x166934);}return _0x113059[_0xa0fd('0x23')]();};}function saveUpdates(_0x18eaa8,_0x26e3a4){return function(_0x3af329){if(_0x3af329){return _0x3af329[_0xa0fd('0x24')](_0x18eaa8)[_0xa0fd('0x25')](function(_0xda6f53){return _0xda6f53;});}return null;};}function removeEntity(_0x13fc62,_0x28dbda){return function(_0x310279){if(_0x310279){return _0x310279[_0xa0fd('0x26')]()['then'](function(){_0x13fc62[_0xa0fd('0x1a')](0xcc)[_0xa0fd('0x19')]();});}};}function handleEntityNotFound(_0x541118,_0x197ae5){return function(_0x3cd5b0){if(!_0x3cd5b0){_0x541118['sendStatus'](0x194);}return _0x3cd5b0;};}function handleError(_0x5bb0ee,_0x2e9b0d){_0x2e9b0d=_0x2e9b0d||0x1f4;return function(_0x267899){logger['error'](_0x267899['stack']);if(_0x267899['name']){delete _0x267899['name'];}_0x5bb0ee[_0xa0fd('0x1a')](_0x2e9b0d)['send'](_0x267899);};}exports[_0xa0fd('0x27')]=function(_0x1db300,_0x2f5b0d){var _0x4a307b={},_0x36aaed={},_0x19c352={'count':0x0,'rows':[]};var _0x4feb93=_[_0xa0fd('0x28')](db[_0xa0fd('0x29')]['rawAttributes'],function(_0x366921){return{'name':_0x366921[_0xa0fd('0x2a')],'type':_0x366921[_0xa0fd('0x2b')][_0xa0fd('0x2c')]};});_0x36aaed['model']=_[_0xa0fd('0x28')](_0x4feb93,_0xa0fd('0x2d'));_0x36aaed['query']=_['keys'](_0x1db300['query']);_0x36aaed[_0xa0fd('0x2e')]=_['intersection'](_0x36aaed['model'],_0x36aaed[_0xa0fd('0x2f')]);_0x4a307b['attributes']=_[_0xa0fd('0x30')](_0x36aaed[_0xa0fd('0x31')],qs[_0xa0fd('0x32')](_0x1db300[_0xa0fd('0x2f')][_0xa0fd('0x32')]));_0x4a307b[_0xa0fd('0x33')]=_0x4a307b[_0xa0fd('0x33')][_0xa0fd('0x34')]?_0x4a307b['attributes']:_0x36aaed[_0xa0fd('0x31')];if(!_0x1db300['query'][_0xa0fd('0x35')]('nolimit')){_0x4a307b['limit']=qs[_0xa0fd('0x1c')](_0x1db300['query'][_0xa0fd('0x1c')]);_0x4a307b[_0xa0fd('0x1f')]=qs[_0xa0fd('0x1f')](_0x1db300[_0xa0fd('0x2f')]['offset']);}_0x4a307b[_0xa0fd('0x36')]=qs[_0xa0fd('0x37')](_0x1db300[_0xa0fd('0x2f')][_0xa0fd('0x37')]);_0x4a307b[_0xa0fd('0x38')]=qs[_0xa0fd('0x2e')](_[_0xa0fd('0x39')](_0x1db300['query'],_0x36aaed['filters']),_0x4feb93);if(_0x1db300[_0xa0fd('0x2f')][_0xa0fd('0x3a')]){_0x4a307b[_0xa0fd('0x38')]=_[_0xa0fd('0x3b')](_0x4a307b['where'],{'$or':_[_0xa0fd('0x28')](_0x4feb93,function(_0x3938da){if(_0x3938da[_0xa0fd('0x2b')]!==_0xa0fd('0x3c')){var _0x214094={};_0x214094[_0x3938da['name']]={'$like':'%'+_0x1db300[_0xa0fd('0x2f')][_0xa0fd('0x3a')]+'%'};return _0x214094;}})});}_0x4a307b=_['merge']({},_0x4a307b,_0x1db300['options']);var _0x27082a={'where':_0x4a307b[_0xa0fd('0x38')]};return db[_0xa0fd('0x29')][_0xa0fd('0x1e')](_0x27082a)[_0xa0fd('0x25')](function(_0xbeca16){_0x19c352[_0xa0fd('0x1e')]=_0xbeca16;if(_0x1db300[_0xa0fd('0x2f')][_0xa0fd('0x3d')]){_0x4a307b[_0xa0fd('0x3e')]=[{'all':!![]}];}return db[_0xa0fd('0x29')][_0xa0fd('0x3f')](_0x4a307b);})[_0xa0fd('0x25')](function(_0x466767){_0x19c352[_0xa0fd('0x40')]=_0x466767;return _0x19c352;})['then'](respondWithFilteredResult(_0x2f5b0d,_0x4a307b))['catch'](handleError(_0x2f5b0d,null));};exports['show']=function(_0x241e3e,_0x288a8a){var _0x399eb1={'raw':!![],'where':{'id':_0x241e3e[_0xa0fd('0x41')]['id']}},_0x54fb8c={};_0x54fb8c[_0xa0fd('0x31')]=_[_0xa0fd('0x42')](db['Cdr'][_0xa0fd('0x43')]);_0x54fb8c[_0xa0fd('0x2f')]=_[_0xa0fd('0x42')](_0x241e3e[_0xa0fd('0x2f')]);_0x54fb8c[_0xa0fd('0x2e')]=_[_0xa0fd('0x30')](_0x54fb8c['model'],_0x54fb8c[_0xa0fd('0x2f')]);_0x399eb1[_0xa0fd('0x33')]=_[_0xa0fd('0x30')](_0x54fb8c[_0xa0fd('0x31')],qs[_0xa0fd('0x32')](_0x241e3e[_0xa0fd('0x2f')]['fields']));_0x399eb1[_0xa0fd('0x33')]=_0x399eb1[_0xa0fd('0x33')][_0xa0fd('0x34')]?_0x399eb1[_0xa0fd('0x33')]:_0x54fb8c[_0xa0fd('0x31')];if(_0x241e3e['query']['includeAll']){_0x399eb1[_0xa0fd('0x3e')]=[{'all':!![]}];}_0x399eb1=_[_0xa0fd('0x3b')]({},_0x399eb1,_0x241e3e[_0xa0fd('0x44')]);return db[_0xa0fd('0x29')][_0xa0fd('0x45')](_0x399eb1)['then'](handleEntityNotFound(_0x288a8a,null))[_0xa0fd('0x25')](respondWithResult(_0x288a8a,null))[_0xa0fd('0x46')](handleError(_0x288a8a,null));};exports[_0xa0fd('0x47')]=function(_0x210a75,_0x93d528){return db[_0xa0fd('0x29')]['create'](_0x210a75['body'],{})['then'](respondWithResult(_0x93d528,0xc9))[_0xa0fd('0x46')](handleError(_0x93d528,null));};exports['update']=function(_0x4e4ce4,_0xcf725e){if(_0x4e4ce4['body']['id']){delete _0x4e4ce4[_0xa0fd('0x48')]['id'];}return db[_0xa0fd('0x29')]['find']({'where':{'id':_0x4e4ce4['params']['id']}})[_0xa0fd('0x25')](handleEntityNotFound(_0xcf725e,null))[_0xa0fd('0x25')](saveUpdates(_0x4e4ce4[_0xa0fd('0x48')],null))[_0xa0fd('0x25')](respondWithResult(_0xcf725e,null))[_0xa0fd('0x46')](handleError(_0xcf725e,null));};exports[_0xa0fd('0x26')]=function(_0x5268ba,_0x5712f2){return db['Cdr']['find']({'where':{'id':_0x5268ba[_0xa0fd('0x41')]['id']}})[_0xa0fd('0x25')](handleEntityNotFound(_0x5712f2,null))[_0xa0fd('0x25')](removeEntity(_0x5712f2,null))[_0xa0fd('0x46')](handleError(_0x5712f2,null));};exports[_0xa0fd('0x49')]=function(_0x53c1a2,_0x53f51c){return db['Cdr']['describe']()['then'](respondWithResult(_0x53f51c,null))[_0xa0fd('0x46')](handleError(_0x53f51c,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 507492a..9760f5b 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x12d001,_0x642c72){var _0x34fda9=function(_0x57e89d){while(--_0x57e89d){_0x12d001['push'](_0x12d001['shift']());}};_0x34fda9(++_0x642c72);}(_0x7a54,0x106));var _0x47a5=function(_0x3c396f,_0x193f1f){_0x3c396f=_0x3c396f-0x0;var _0x396546=_0x7a54[_0x3c396f];return _0x396546;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x519ec5,_0x5b7259){var _0x5a08bd=function(_0x178e25){while(--_0x178e25){_0x519ec5['push'](_0x519ec5['shift']());}};_0x5a08bd(++_0x5b7259);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 2df955b..f486d15 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 _0xb5c7=['../../config/logger','rpc','../../config/environment','client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5c2ee,_0x38274){var _0x18e7c4=function(_0x383911){while(--_0x383911){_0x5c2ee['push'](_0x5c2ee['shift']());}};_0x18e7c4(++_0x38274);}(_0xb5c7,0x1d8));var _0x7b5c=function(_0x38bcb6,_0x52d186){_0x38bcb6=_0x38bcb6-0x0;var _0x2e82be=_0xb5c7[_0x38bcb6];return _0x2e82be;};'use strict';var _=require(_0x7b5c('0x0'));var util=require(_0x7b5c('0x1'));var moment=require(_0x7b5c('0x2'));var BPromise=require(_0x7b5c('0x3'));var rs=require(_0x7b5c('0x4'));var fs=require('fs');var Redis=require(_0x7b5c('0x5'));var db=require(_0x7b5c('0x6'))['db'];var utils=require(_0x7b5c('0x7'));var logger=require(_0x7b5c('0x8'))(_0x7b5c('0x9'));var config=require(_0x7b5c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7b5c('0xb')][_0x7b5c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c1d5d,_0xb663c7,_0xf3d41f){return new BPromise(function(_0x35f25e,_0x5d1882){return client[_0x7b5c('0xd')](_0x3c1d5d,_0xf3d41f)['then'](function(_0x413050){logger[_0x7b5c('0xe')](_0x7b5c('0xf'),_0xb663c7,_0x7b5c('0x10'));logger[_0x7b5c('0x11')](_0x7b5c('0x12'),_0xb663c7,'request\x20sent',JSON[_0x7b5c('0x13')](_0x413050));if(_0x413050[_0x7b5c('0x14')]){if(_0x413050[_0x7b5c('0x14')][_0x7b5c('0x15')]===0x1f4){logger['error'](_0x7b5c('0xf'),_0xb663c7,_0x413050[_0x7b5c('0x14')]['message']);return _0x5d1882(_0x413050['error']['message']);}logger['error'](_0x7b5c('0xf'),_0xb663c7,_0x413050[_0x7b5c('0x14')]['message']);return _0x35f25e(_0x413050[_0x7b5c('0x14')][_0x7b5c('0x16')]);}else{logger['info'](_0x7b5c('0xf'),_0xb663c7,'request\x20sent');_0x35f25e(_0x413050[_0x7b5c('0x17')][_0x7b5c('0x16')]);}})['catch'](function(_0x2e89cd){logger[_0x7b5c('0x14')](_0x7b5c('0xf'),_0xb663c7,_0x2e89cd);_0x5d1882(_0x2e89cd);});});} \ No newline at end of file +var _0x05ec=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring'];(function(_0x1a20ec,_0x27626c){var _0x3a2ec1=function(_0xb45d54){while(--_0xb45d54){_0x1a20ec['push'](_0x1a20ec['shift']());}};_0x3a2ec1(++_0x27626c);}(_0x05ec,0x12c));var _0xc05e=function(_0x3513ed,_0x1a671e){_0x3513ed=_0x3513ed-0x0;var _0x4a70aa=_0x05ec[_0x3513ed];return _0x4a70aa;};'use strict';var _=require(_0xc05e('0x0'));var util=require('util');var moment=require(_0xc05e('0x1'));var BPromise=require(_0xc05e('0x2'));var rs=require(_0xc05e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc05e('0x4'))['db'];var utils=require(_0xc05e('0x5'));var logger=require(_0xc05e('0x6'))('rpc');var config=require(_0xc05e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc05e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x232190,_0x3bca88,_0x14be71){return new BPromise(function(_0x195d98,_0x55b5e5){return client['request'](_0x232190,_0x14be71)[_0xc05e('0x9')](function(_0x11a5fa){logger[_0xc05e('0xa')](_0xc05e('0xb'),_0x3bca88,_0xc05e('0xc'));logger[_0xc05e('0xd')](_0xc05e('0xe'),_0x3bca88,_0xc05e('0xc'),JSON[_0xc05e('0xf')](_0x11a5fa));if(_0x11a5fa[_0xc05e('0x10')]){if(_0x11a5fa[_0xc05e('0x10')]['code']===0x1f4){logger[_0xc05e('0x10')](_0xc05e('0xb'),_0x3bca88,_0x11a5fa[_0xc05e('0x10')][_0xc05e('0x11')]);return _0x55b5e5(_0x11a5fa[_0xc05e('0x10')]['message']);}logger[_0xc05e('0x10')](_0xc05e('0xb'),_0x3bca88,_0x11a5fa[_0xc05e('0x10')][_0xc05e('0x11')]);return _0x195d98(_0x11a5fa[_0xc05e('0x10')][_0xc05e('0x11')]);}else{logger['info'](_0xc05e('0xb'),_0x3bca88,_0xc05e('0xc'));_0x195d98(_0x11a5fa['result'][_0xc05e('0x11')]);}})[_0xc05e('0x12')](function(_0x55b6b3){logger['error'](_0xc05e('0xb'),_0x3bca88,_0x55b6b3);_0x55b5e5(_0x55b6b3);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 686377e..125691d 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(_0x54af0d,_0x3e5db0){var _0x57b08d=function(_0x35d93a){while(--_0x35d93a){_0x54af0d['push'](_0x54af0d['shift']());}};_0x57b08d(++_0x3e5db0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x27a93a,_0x6078bc){var _0x1f8620=function(_0x6c253b){while(--_0x6c253b){_0x27a93a['push'](_0x27a93a['shift']());}};_0x1f8620(++_0x6078bc);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d7fb5,_0x16eb5c){_0x3d7fb5=_0x3d7fb5-0x0;var _0x3a9642=_0xb10b[_0x3d7fb5];return _0x3a9642;};'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('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('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 dd5866d..5e9f471 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 _0xecdf=['*,*,*,*','INTEGER','STRING','noop'];(function(_0x361095,_0x490f4f){var _0x444810=function(_0x2a77af){while(--_0x2a77af){_0x361095['push'](_0x361095['shift']());}};_0x444810(++_0x490f4f);}(_0xecdf,0x195));var _0xfecd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xecdf[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xfecd('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xfecd('0x1')],'allowNull':![],'defaultValue':_0xfecd('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xfecd('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xfecd('0x3')}}; \ No newline at end of file +var _0x86eb=['exports','STRING','noop','TEXT','sequelize'];(function(_0x2c6c7f,_0x34bf43){var _0x437789=function(_0x27965a){while(--_0x27965a){_0x2c6c7f['push'](_0x2c6c7f['shift']());}};_0x437789(++_0x34bf43);}(_0x86eb,0x176));var _0xb86e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x86eb[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xb86e('0x0'));module[_0xb86e('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb86e('0x2')],'allowNull':![],'defaultValue':_0xb86e('0x3')},'appdata':{'type':Sequelize[_0xb86e('0x4')]()},'description':{'type':Sequelize[_0xb86e('0x2')]},'interval':{'type':Sequelize[_0xb86e('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index c245d67..55dafa2 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 _0x0d74=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','save','update','then','destroy','error','stack','name','show','params','model','ChatApplication','rawAttributes','query','keys','intersection','attributes','fields','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','squel','jsforce'];(function(_0x4d389d,_0xec145d){var _0x22bd25=function(_0x22cd63){while(--_0x22cd63){_0x4d389d['push'](_0x4d389d['shift']());}};_0x22bd25(++_0xec145d);}(_0x0d74,0x146));var _0x40d7=function(_0x4adf32,_0x82f9c8){_0x4adf32=_0x4adf32-0x0;var _0xc57d27=_0x0d74[_0x4adf32];return _0xc57d27;};'use strict';var emlformat=require(_0x40d7('0x0'));var rimraf=require(_0x40d7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x40d7('0x2'));var moment=require(_0x40d7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x40d7('0x4'));var path=require(_0x40d7('0x5'));var sox=require(_0x40d7('0x6'));var csv=require(_0x40d7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x40d7('0x8'));var crypto=require('crypto');var jsforce=require(_0x40d7('0x9'));var deskjs=require(_0x40d7('0xa'));var toCsv=require('to-csv');var querystring=require(_0x40d7('0xb'));var Papa=require(_0x40d7('0xc'));var Redis=require(_0x40d7('0xd'));var authService=require(_0x40d7('0xe'));var qs=require(_0x40d7('0xf'));var as=require(_0x40d7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x40d7('0x11'))(_0x40d7('0x12'));var utils=require(_0x40d7('0x13'));var config=require(_0x40d7('0x14'));var licenseUtil=require(_0x40d7('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43f1d8,_0xa08fd6){_0xa08fd6=_0xa08fd6||0xcc;return function(_0x3723a4){if(_0x3723a4){return _0x43f1d8[_0x40d7('0x16')](_0xa08fd6);}return _0x43f1d8['status'](_0xa08fd6)[_0x40d7('0x17')]();};}function respondWithResult(_0x4cb402,_0x14c12b){_0x14c12b=_0x14c12b||0xc8;return function(_0x2acc5b){if(_0x2acc5b){return _0x4cb402[_0x40d7('0x18')](_0x14c12b)[_0x40d7('0x19')](_0x2acc5b);}};}function respondWithFilteredResult(_0x1acc2f,_0x67d691){return function(_0x473fea){if(_0x473fea){var _0x55a7e0=typeof _0x67d691['offset']==='undefined'&&typeof _0x67d691[_0x40d7('0x1a')]===_0x40d7('0x1b');var _0x486d75=_0x473fea['count'];var _0x120964=_0x55a7e0?0x0:_0x67d691['offset'];var _0x4ed97e=_0x55a7e0?_0x473fea[_0x40d7('0x1c')]:_0x67d691[_0x40d7('0x1d')]+_0x67d691[_0x40d7('0x1a')];var _0x44fa91;if(_0x4ed97e>=_0x486d75){_0x4ed97e=_0x486d75;_0x44fa91=0xc8;}else{_0x44fa91=0xce;}_0x1acc2f[_0x40d7('0x18')](_0x44fa91);return _0x1acc2f[_0x40d7('0x1e')](_0x40d7('0x1f'),_0x120964+'-'+_0x4ed97e+'/'+_0x486d75)[_0x40d7('0x19')](_0x473fea);}return null;};}function patchUpdates(_0x5eb3c1){return function(_0x4c47cf){try{jsonpatch['apply'](_0x4c47cf,_0x5eb3c1,!![]);}catch(_0x34ea1d){return BPromise['reject'](_0x34ea1d);}return _0x4c47cf[_0x40d7('0x20')]();};}function saveUpdates(_0x145422,_0x985914){return function(_0x1a441a){if(_0x1a441a){return _0x1a441a[_0x40d7('0x21')](_0x145422)[_0x40d7('0x22')](function(_0xfec685){return _0xfec685;});}return null;};}function removeEntity(_0x3ccae9,_0x51180d){return function(_0x1cb3b2){if(_0x1cb3b2){return _0x1cb3b2[_0x40d7('0x23')]()['then'](function(){_0x3ccae9[_0x40d7('0x18')](0xcc)[_0x40d7('0x17')]();});}};}function handleEntityNotFound(_0x38276c,_0x29c62b){return function(_0x528ab5){if(!_0x528ab5){_0x38276c['sendStatus'](0x194);}return _0x528ab5;};}function handleError(_0x4889df,_0x4e7d84){_0x4e7d84=_0x4e7d84||0x1f4;return function(_0x539985){logger[_0x40d7('0x24')](_0x539985[_0x40d7('0x25')]);if(_0x539985[_0x40d7('0x26')]){delete _0x539985[_0x40d7('0x26')];}_0x4889df['status'](_0x4e7d84)['send'](_0x539985);};}exports[_0x40d7('0x27')]=function(_0x2b5f11,_0x4503cc){var _0x532ed5={'raw':!![],'where':{'id':_0x2b5f11[_0x40d7('0x28')]['id']}},_0x4fdf53={};_0x4fdf53[_0x40d7('0x29')]=_['keys'](db[_0x40d7('0x2a')][_0x40d7('0x2b')]);_0x4fdf53[_0x40d7('0x2c')]=_[_0x40d7('0x2d')](_0x2b5f11['query']);_0x4fdf53['filters']=_[_0x40d7('0x2e')](_0x4fdf53[_0x40d7('0x29')],_0x4fdf53[_0x40d7('0x2c')]);_0x532ed5[_0x40d7('0x2f')]=_[_0x40d7('0x2e')](_0x4fdf53[_0x40d7('0x29')],qs[_0x40d7('0x30')](_0x2b5f11['query'][_0x40d7('0x30')]));_0x532ed5[_0x40d7('0x2f')]=_0x532ed5[_0x40d7('0x2f')]['length']?_0x532ed5[_0x40d7('0x2f')]:_0x4fdf53[_0x40d7('0x29')];if(_0x2b5f11[_0x40d7('0x2c')][_0x40d7('0x31')]){_0x532ed5[_0x40d7('0x32')]=[{'all':!![]}];}_0x532ed5=_[_0x40d7('0x33')]({},_0x532ed5,_0x2b5f11[_0x40d7('0x34')]);return db['ChatApplication'][_0x40d7('0x35')](_0x532ed5)[_0x40d7('0x22')](handleEntityNotFound(_0x4503cc,null))[_0x40d7('0x22')](respondWithResult(_0x4503cc,null))[_0x40d7('0x36')](handleError(_0x4503cc,null));};exports[_0x40d7('0x21')]=function(_0x2d1ee6,_0x1e6f08){if(_0x2d1ee6[_0x40d7('0x37')]['id']){delete _0x2d1ee6['body']['id'];}return db['ChatApplication'][_0x40d7('0x35')]({'where':{'id':_0x2d1ee6[_0x40d7('0x28')]['id']}})['then'](handleEntityNotFound(_0x1e6f08,null))['then'](saveUpdates(_0x2d1ee6['body'],null))[_0x40d7('0x22')](respondWithResult(_0x1e6f08,null))['catch'](handleError(_0x1e6f08,null));};exports[_0x40d7('0x23')]=function(_0x56b17c,_0x798ba7){return db[_0x40d7('0x2a')][_0x40d7('0x35')]({'where':{'id':_0x56b17c[_0x40d7('0x28')]['id']}})[_0x40d7('0x22')](handleEntityNotFound(_0x798ba7,null))['then'](removeEntity(_0x798ba7,null))[_0x40d7('0x36')](handleError(_0x798ba7,null));}; \ No newline at end of file +var _0x0caf=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','filters','query','attributes','intersection','fields','length','include','merge','options','catch','body','destroy','find','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x33fc76,_0x4e17f4){var _0x1ba294=function(_0x11a7e6){while(--_0x11a7e6){_0x33fc76['push'](_0x33fc76['shift']());}};_0x1ba294(++_0x4e17f4);}(_0x0caf,0x9f));var _0xf0ca=function(_0x7f26c7,_0x50edd3){_0x7f26c7=_0x7f26c7-0x0;var _0x5741b4=_0x0caf[_0x7f26c7];return _0x5741b4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf0ca('0x0'));var rp=require(_0xf0ca('0x1'));var moment=require(_0xf0ca('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf0ca('0x3'));var path=require(_0xf0ca('0x4'));var sox=require('sox');var csv=require(_0xf0ca('0x5'));var ejs=require(_0xf0ca('0x6'));var fs=require('fs');var fs_extra=require(_0xf0ca('0x7'));var _=require('lodash');var squel=require(_0xf0ca('0x8'));var crypto=require(_0xf0ca('0x9'));var jsforce=require(_0xf0ca('0xa'));var deskjs=require(_0xf0ca('0xb'));var toCsv=require(_0xf0ca('0x5'));var querystring=require(_0xf0ca('0xc'));var Papa=require(_0xf0ca('0xd'));var Redis=require('ioredis');var authService=require(_0xf0ca('0xe'));var qs=require(_0xf0ca('0xf'));var as=require(_0xf0ca('0x10'));var hardwareService=require(_0xf0ca('0x11'));var logger=require(_0xf0ca('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf0ca('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xf0ca('0x14'))['db'];function respondWithStatusCode(_0x582e00,_0x3c1332){_0x3c1332=_0x3c1332||0xcc;return function(_0x38c595){if(_0x38c595){return _0x582e00[_0xf0ca('0x15')](_0x3c1332);}return _0x582e00[_0xf0ca('0x16')](_0x3c1332)[_0xf0ca('0x17')]();};}function respondWithResult(_0x3f6251,_0x5c5875){_0x5c5875=_0x5c5875||0xc8;return function(_0x6d9157){if(_0x6d9157){return _0x3f6251['status'](_0x5c5875)['json'](_0x6d9157);}};}function respondWithFilteredResult(_0x4545db,_0x34ea00){return function(_0x3b1daa){if(_0x3b1daa){var _0x2b074e=typeof _0x34ea00[_0xf0ca('0x18')]==='undefined'&&typeof _0x34ea00['limit']===_0xf0ca('0x19');var _0x4d08f2=_0x3b1daa['count'];var _0x3245b2=_0x2b074e?0x0:_0x34ea00[_0xf0ca('0x18')];var _0x2473f0=_0x2b074e?_0x3b1daa[_0xf0ca('0x1a')]:_0x34ea00[_0xf0ca('0x18')]+_0x34ea00[_0xf0ca('0x1b')];var _0x48b114;if(_0x2473f0>=_0x4d08f2){_0x2473f0=_0x4d08f2;_0x48b114=0xc8;}else{_0x48b114=0xce;}_0x4545db[_0xf0ca('0x16')](_0x48b114);return _0x4545db['set'](_0xf0ca('0x1c'),_0x3245b2+'-'+_0x2473f0+'/'+_0x4d08f2)[_0xf0ca('0x1d')](_0x3b1daa);}return null;};}function patchUpdates(_0x50f742){return function(_0x24303d){try{jsonpatch[_0xf0ca('0x1e')](_0x24303d,_0x50f742,!![]);}catch(_0x3512b3){return BPromise[_0xf0ca('0x1f')](_0x3512b3);}return _0x24303d[_0xf0ca('0x20')]();};}function saveUpdates(_0x2e54bf,_0x3414eb){return function(_0x520863){if(_0x520863){return _0x520863[_0xf0ca('0x21')](_0x2e54bf)[_0xf0ca('0x22')](function(_0x1ba29d){return _0x1ba29d;});}return null;};}function removeEntity(_0x3d6bad,_0x5f31c6){return function(_0xd8312a){if(_0xd8312a){return _0xd8312a['destroy']()['then'](function(){_0x3d6bad[_0xf0ca('0x16')](0xcc)[_0xf0ca('0x17')]();});}};}function handleEntityNotFound(_0x8dbaed,_0x11916a){return function(_0x106f8e){if(!_0x106f8e){_0x8dbaed[_0xf0ca('0x15')](0x194);}return _0x106f8e;};}function handleError(_0x20bfbc,_0x30b5a3){_0x30b5a3=_0x30b5a3||0x1f4;return function(_0x4c2365){logger['error'](_0x4c2365[_0xf0ca('0x23')]);if(_0x4c2365[_0xf0ca('0x24')]){delete _0x4c2365['name'];}_0x20bfbc[_0xf0ca('0x16')](_0x30b5a3)[_0xf0ca('0x25')](_0x4c2365);};}exports[_0xf0ca('0x26')]=function(_0x2aaae9,_0x48bbf8){var _0xb41d0a={'raw':!![],'where':{'id':_0x2aaae9[_0xf0ca('0x27')]['id']}},_0xbefb0e={};_0xbefb0e[_0xf0ca('0x28')]=_[_0xf0ca('0x29')](db[_0xf0ca('0x2a')][_0xf0ca('0x2b')]);_0xbefb0e['query']=_[_0xf0ca('0x29')](_0x2aaae9['query']);_0xbefb0e[_0xf0ca('0x2c')]=_['intersection'](_0xbefb0e[_0xf0ca('0x28')],_0xbefb0e[_0xf0ca('0x2d')]);_0xb41d0a[_0xf0ca('0x2e')]=_[_0xf0ca('0x2f')](_0xbefb0e[_0xf0ca('0x28')],qs[_0xf0ca('0x30')](_0x2aaae9[_0xf0ca('0x2d')][_0xf0ca('0x30')]));_0xb41d0a[_0xf0ca('0x2e')]=_0xb41d0a[_0xf0ca('0x2e')][_0xf0ca('0x31')]?_0xb41d0a[_0xf0ca('0x2e')]:_0xbefb0e[_0xf0ca('0x28')];if(_0x2aaae9[_0xf0ca('0x2d')]['includeAll']){_0xb41d0a[_0xf0ca('0x32')]=[{'all':!![]}];}_0xb41d0a=_[_0xf0ca('0x33')]({},_0xb41d0a,_0x2aaae9[_0xf0ca('0x34')]);return db[_0xf0ca('0x2a')]['find'](_0xb41d0a)[_0xf0ca('0x22')](handleEntityNotFound(_0x48bbf8,null))['then'](respondWithResult(_0x48bbf8,null))[_0xf0ca('0x35')](handleError(_0x48bbf8,null));};exports['update']=function(_0x617b26,_0x2c218b){if(_0x617b26['body']['id']){delete _0x617b26[_0xf0ca('0x36')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x617b26[_0xf0ca('0x27')]['id']}})[_0xf0ca('0x22')](handleEntityNotFound(_0x2c218b,null))[_0xf0ca('0x22')](saveUpdates(_0x617b26[_0xf0ca('0x36')],null))[_0xf0ca('0x22')](respondWithResult(_0x2c218b,null))['catch'](handleError(_0x2c218b,null));};exports[_0xf0ca('0x37')]=function(_0x448969,_0x436273){return db[_0xf0ca('0x2a')][_0xf0ca('0x38')]({'where':{'id':_0x448969[_0xf0ca('0x27')]['id']}})['then'](handleEntityNotFound(_0x436273,null))[_0xf0ca('0x22')](removeEntity(_0x436273,null))[_0xf0ca('0x35')](handleError(_0x436273,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 0adcf91..59c737f 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 _0x3caa=['../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird'];(function(_0x5139c3,_0x227ef7){var _0x264d9e=function(_0x352b9b){while(--_0x352b9b){_0x5139c3['push'](_0x5139c3['shift']());}};_0x264d9e(++_0x227ef7);}(_0x3caa,0xb0));var _0xa3ca=function(_0x2b992c,_0x56d7cb){_0x2b992c=_0x2b992c-0x0;var _0x5ed2bc=_0x3caa[_0x2b992c];return _0x5ed2bc;};'use strict';var _=require('lodash');var util=require(_0xa3ca('0x0'));var logger=require(_0xa3ca('0x1'))(_0xa3ca('0x2'));var moment=require('moment');var BPromise=require(_0xa3ca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa3ca('0x4'));var attributes=require(_0xa3ca('0x5'));module[_0xa3ca('0x6')]=function(_0x54b884,_0xfde181){return _0x54b884[_0xa3ca('0x7')](_0xa3ca('0x8'),attributes,{'tableName':_0xa3ca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa3ca('0xa'),'collate':_0xa3ca('0xb')});}; \ No newline at end of file +var _0xfabe=['utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','exports','chat_applications','utf8mb4'];(function(_0x5b5916,_0x161002){var _0x28beb3=function(_0x52184d){while(--_0x52184d){_0x5b5916['push'](_0x5b5916['shift']());}};_0x28beb3(++_0x161002);}(_0xfabe,0x9b));var _0xefab=function(_0x58c3b2,_0x231851){_0x58c3b2=_0x58c3b2-0x0;var _0x3ed760=_0xfabe[_0x58c3b2];return _0x3ed760;};'use strict';var _=require(_0xefab('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xefab('0x1'));var moment=require(_0xefab('0x2'));var BPromise=require(_0xefab('0x3'));var rp=require(_0xefab('0x4'));var fs=require('fs');var path=require(_0xefab('0x5'));var rimraf=require(_0xefab('0x6'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0xefab('0x7')]=function(_0x2cf433,_0x260585){return _0x2cf433['define']('ChatApplication',attributes,{'tableName':_0xefab('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xefab('0x9'),'collate':_0xefab('0xa')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 3c465e9..6c497e8 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 _0x5ec5=['http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x1e5764,_0x1604f7){var _0x4b2b39=function(_0x221348){while(--_0x221348){_0x1e5764['push'](_0x1e5764['shift']());}};_0x4b2b39(++_0x1604f7);}(_0x5ec5,0xe7));var _0x55ec=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5ec5[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x55ec('0x0'));var util=require(_0x55ec('0x1'));var moment=require(_0x55ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x55ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x55ec('0x5'))(_0x55ec('0x6'));var config=require('../../config/environment');var jayson=require(_0x55ec('0x7'));var client=jayson[_0x55ec('0x8')][_0x55ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f0fd2,_0xbb46c4,_0x8816a1){return new BPromise(function(_0xe286d6,_0xbcaad9){return client['request'](_0x5f0fd2,_0x8816a1)[_0x55ec('0xa')](function(_0x5a16a1){logger[_0x55ec('0xb')](_0x55ec('0xc'),_0xbb46c4,_0x55ec('0xd'));logger[_0x55ec('0xe')](_0x55ec('0xf'),_0xbb46c4,_0x55ec('0xd'),JSON[_0x55ec('0x10')](_0x5a16a1));if(_0x5a16a1[_0x55ec('0x11')]){if(_0x5a16a1[_0x55ec('0x11')]['code']===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0xbb46c4,_0x5a16a1['error'][_0x55ec('0x12')]);return _0xbcaad9(_0x5a16a1[_0x55ec('0x11')]['message']);}logger[_0x55ec('0x11')]('ChatApplication,\x20%s,\x20%s',_0xbb46c4,_0x5a16a1[_0x55ec('0x11')][_0x55ec('0x12')]);return _0xe286d6(_0x5a16a1[_0x55ec('0x11')][_0x55ec('0x12')]);}else{logger[_0x55ec('0xb')](_0x55ec('0xc'),_0xbb46c4,_0x55ec('0xd'));_0xe286d6(_0x5a16a1[_0x55ec('0x13')][_0x55ec('0x12')]);}})['catch'](function(_0x3a9813){logger[_0x55ec('0x11')]('ChatApplication,\x20%s,\x20%s',_0xbb46c4,_0x3a9813);_0xbcaad9(_0x3a9813);});});} \ No newline at end of file +var _0x3ffb=['info','ChatApplication,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x426223,_0x325880){var _0x4e0778=function(_0x1c3300){while(--_0x1c3300){_0x426223['push'](_0x426223['shift']());}};_0x4e0778(++_0x325880);}(_0x3ffb,0x195));var _0xb3ff=function(_0x3d740d,_0x373d2a){_0x3d740d=_0x3d740d-0x0;var _0x3e32be=_0x3ffb[_0x3d740d];return _0x3e32be;};'use strict';var _=require(_0xb3ff('0x0'));var util=require(_0xb3ff('0x1'));var moment=require('moment');var BPromise=require(_0xb3ff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb3ff('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb3ff('0x4'));var logger=require(_0xb3ff('0x5'))(_0xb3ff('0x6'));var config=require(_0xb3ff('0x7'));var jayson=require(_0xb3ff('0x8'));var client=jayson[_0xb3ff('0x9')][_0xb3ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49c5c3,_0x2751e3,_0x5b091e){return new BPromise(function(_0xe9806f,_0xb6ab1d){return client[_0xb3ff('0xb')](_0x49c5c3,_0x5b091e)[_0xb3ff('0xc')](function(_0x170dc9){logger[_0xb3ff('0xd')](_0xb3ff('0xe'),_0x2751e3,'request\x20sent');logger[_0xb3ff('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x2751e3,'request\x20sent',JSON[_0xb3ff('0x10')](_0x170dc9));if(_0x170dc9[_0xb3ff('0x11')]){if(_0x170dc9[_0xb3ff('0x11')][_0xb3ff('0x12')]===0x1f4){logger[_0xb3ff('0x11')](_0xb3ff('0xe'),_0x2751e3,_0x170dc9['error']['message']);return _0xb6ab1d(_0x170dc9[_0xb3ff('0x11')][_0xb3ff('0x13')]);}logger[_0xb3ff('0x11')]('ChatApplication,\x20%s,\x20%s',_0x2751e3,_0x170dc9['error'][_0xb3ff('0x13')]);return _0xe9806f(_0x170dc9['error'][_0xb3ff('0x13')]);}else{logger[_0xb3ff('0xd')](_0xb3ff('0xe'),_0x2751e3,'request\x20sent');_0xe9806f(_0x170dc9[_0xb3ff('0x14')][_0xb3ff('0x13')]);}})[_0xb3ff('0x15')](function(_0x4bceb9){logger[_0xb3ff('0x11')]('ChatApplication,\x20%s,\x20%s',_0x2751e3,_0x4bceb9);_0xb6ab1d(_0x4bceb9);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 1885002..f575f6d 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 _0x53f1=['get','/:id','show','delete','isAuthenticated','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller'];(function(_0x5a67c7,_0x2e28c6){var _0xc72328=function(_0x39d3bc){while(--_0x39d3bc){_0x5a67c7['push'](_0x5a67c7['shift']());}};_0xc72328(++_0x2e28c6);}(_0x53f1,0x18c));var _0x153f=function(_0x4a2e58,_0x53f399){_0x4a2e58=_0x4a2e58-0x0;var _0x7bc84e=_0x53f1[_0x4a2e58];return _0x7bc84e;};'use strict';var multer=require(_0x153f('0x0'));var util=require(_0x153f('0x1'));var path=require(_0x153f('0x2'));var timeout=require(_0x153f('0x3'));var express=require(_0x153f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x153f('0x5'));var interaction=require(_0x153f('0x6'));var config=require(_0x153f('0x7'));var controller=require(_0x153f('0x8'));router[_0x153f('0x9')](_0x153f('0xa'),auth['isAuthenticated'](),controller[_0x153f('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x153f('0xc')](_0x153f('0xa'),auth[_0x153f('0xd')](),controller['destroy']);module[_0x153f('0xe')]=router; \ No newline at end of file +var _0x6ef5=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id','update'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x6ef5,0x19b));var _0x56ef=function(_0x5bd0fa,_0x3905b7){_0x5bd0fa=_0x5bd0fa-0x0;var _0x39fcb4=_0x6ef5[_0x5bd0fa];return _0x39fcb4;};'use strict';var multer=require(_0x56ef('0x0'));var util=require(_0x56ef('0x1'));var path=require(_0x56ef('0x2'));var timeout=require(_0x56ef('0x3'));var express=require(_0x56ef('0x4'));var router=express['Router']();var fs_extra=require(_0x56ef('0x5'));var auth=require(_0x56ef('0x6'));var interaction=require(_0x56ef('0x7'));var config=require(_0x56ef('0x8'));var controller=require('./chatApplication.controller');router[_0x56ef('0x9')]('/:id',auth[_0x56ef('0xa')](),controller[_0x56ef('0xb')]);router['put'](_0x56ef('0xc'),auth[_0x56ef('0xa')](),controller[_0x56ef('0xd')]);router[_0x56ef('0xe')](_0x56ef('0xc'),auth[_0x56ef('0xa')](),controller[_0x56ef('0xf')]);module[_0x56ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 17b07c9..2f213fb 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 _0xe9ce=['STRING','BOOLEAN','sequelize','exports'];(function(_0x46fa21,_0x4dd7a8){var _0x519555=function(_0x38bd54){while(--_0x38bd54){_0x46fa21['push'](_0x46fa21['shift']());}};_0x519555(++_0x4dd7a8);}(_0xe9ce,0x1ae));var _0xee9c=function(_0x576485,_0x43d725){_0x576485=_0x576485-0x0;var _0x5b0140=_0xe9ce[_0x576485];return _0x5b0140;};'use strict';var Sequelize=require(_0xee9c('0x0'));module[_0xee9c('0x1')]={'name':{'type':Sequelize[_0xee9c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xee9c('0x2')]},'write':{'type':Sequelize[_0xee9c('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9f37=['exports','STRING','sequelize'];(function(_0x15d409,_0x16c2ee){var _0x379106=function(_0x3ab526){while(--_0x3ab526){_0x15d409['push'](_0x15d409['shift']());}};_0x379106(++_0x16c2ee);}(_0x9f37,0xd1));var _0x79f3=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x9f37[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0x79f3('0x0'));module[_0x79f3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x79f3('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 4230ce6..dfaf866 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 _0x4ad2=['attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ChatGroup','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','ChatInternalMessage','user','toInteger','ids','getMembers','findOne','keys','User','pick','removeMembers','addMessage','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','type','key','model','query','filters','intersection','fields'];(function(_0x1dfe19,_0x1e5f0e){var _0x1f44da=function(_0xd425dc){while(--_0xd425dc){_0x1dfe19['push'](_0x1dfe19['shift']());}};_0x1f44da(++_0x1e5f0e);}(_0x4ad2,0x84));var _0x24ad=function(_0x10ce8f,_0x3a39bf){_0x10ce8f=_0x10ce8f-0x0;var _0x45d0be=_0x4ad2[_0x10ce8f];return _0x45d0be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x24ad('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x24ad('0x1'));var rp=require(_0x24ad('0x2'));var moment=require(_0x24ad('0x3'));var BPromise=require(_0x24ad('0x4'));var Mustache=require(_0x24ad('0x5'));var util=require(_0x24ad('0x6'));var path=require(_0x24ad('0x7'));var sox=require(_0x24ad('0x8'));var csv=require(_0x24ad('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x24ad('0xa'));var _=require(_0x24ad('0xb'));var squel=require(_0x24ad('0xc'));var crypto=require(_0x24ad('0xd'));var jsforce=require(_0x24ad('0xe'));var deskjs=require(_0x24ad('0xf'));var toCsv=require(_0x24ad('0x9'));var querystring=require(_0x24ad('0x10'));var Papa=require('papaparse');var Redis=require(_0x24ad('0x11'));var authService=require(_0x24ad('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x24ad('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x24ad('0x14'))('api');var utils=require(_0x24ad('0x15'));var config=require(_0x24ad('0x16'));var licenseUtil=require(_0x24ad('0x17'));var db=require(_0x24ad('0x18'))['db'];config['redis']=_[_0x24ad('0x19')](config[_0x24ad('0x1a')],{'host':_0x24ad('0x1b'),'port':0x18eb});var socket=require(_0x24ad('0x1c'))(new Redis(config[_0x24ad('0x1a')]));require(_0x24ad('0x1d'))['register'](socket);function respondWithStatusCode(_0xd7a8db,_0x39e0bc){_0x39e0bc=_0x39e0bc||0xcc;return function(_0x506b4c){if(_0x506b4c){return _0xd7a8db[_0x24ad('0x1e')](_0x39e0bc);}return _0xd7a8db[_0x24ad('0x1f')](_0x39e0bc)[_0x24ad('0x20')]();};}function respondWithResult(_0x44a311,_0x3143e5){_0x3143e5=_0x3143e5||0xc8;return function(_0x173683){if(_0x173683){return _0x44a311[_0x24ad('0x1f')](_0x3143e5)[_0x24ad('0x21')](_0x173683);}};}function respondWithFilteredResult(_0x47fa8a,_0x1a4b4a){return function(_0xfcb6af){if(_0xfcb6af){var _0x502406=typeof _0x1a4b4a['offset']===_0x24ad('0x22')&&typeof _0x1a4b4a['limit']===_0x24ad('0x22');var _0x2d1020=_0xfcb6af[_0x24ad('0x23')];var _0x11a045=_0x502406?0x0:_0x1a4b4a['offset'];var _0x205dbe=_0x502406?_0xfcb6af[_0x24ad('0x23')]:_0x1a4b4a[_0x24ad('0x24')]+_0x1a4b4a[_0x24ad('0x25')];var _0x4126cb;if(_0x205dbe>=_0x2d1020){_0x205dbe=_0x2d1020;_0x4126cb=0xc8;}else{_0x4126cb=0xce;}_0x47fa8a[_0x24ad('0x1f')](_0x4126cb);return _0x47fa8a['set'](_0x24ad('0x26'),_0x11a045+'-'+_0x205dbe+'/'+_0x2d1020)[_0x24ad('0x21')](_0xfcb6af);}return null;};}function patchUpdates(_0x622cd5){return function(_0x485bf4){try{jsonpatch[_0x24ad('0x27')](_0x485bf4,_0x622cd5,!![]);}catch(_0x33c50a){return BPromise[_0x24ad('0x28')](_0x33c50a);}return _0x485bf4['save']();};}function saveUpdates(_0x2b3844,_0xd53163){return function(_0x1d85d5){if(_0x1d85d5){return _0x1d85d5[_0x24ad('0x29')](_0x2b3844)['then'](function(_0x530dd8){return _0x530dd8;});}return null;};}function removeEntity(_0x23b325,_0x48a199){return function(_0x34fca9){if(_0x34fca9){return _0x34fca9[_0x24ad('0x2a')]()[_0x24ad('0x2b')](function(){_0x23b325['status'](0xcc)[_0x24ad('0x20')]();});}};}function handleEntityNotFound(_0x33b9a6,_0x45ba18){return function(_0x38166b){if(!_0x38166b){_0x33b9a6[_0x24ad('0x1e')](0x194);}return _0x38166b;};}function handleError(_0x1bdcda,_0x19cce3){_0x19cce3=_0x19cce3||0x1f4;return function(_0x42d6a6){logger['error'](_0x42d6a6[_0x24ad('0x2c')]);if(_0x42d6a6[_0x24ad('0x2d')]){delete _0x42d6a6[_0x24ad('0x2d')];}_0x1bdcda[_0x24ad('0x1f')](_0x19cce3)[_0x24ad('0x2e')](_0x42d6a6);};}exports[_0x24ad('0x2f')]=function(_0x5a23ad,_0x1c9d42){var _0xab86b={},_0x2b86d9={},_0x3acbb7={'count':0x0,'rows':[]};var _0x7499ba=_[_0x24ad('0x30')](db['ChatGroup']['rawAttributes'],function(_0x4d7c91){return{'name':_0x4d7c91['fieldName'],'type':_0x4d7c91[_0x24ad('0x31')][_0x24ad('0x32')]};});_0x2b86d9[_0x24ad('0x33')]=_[_0x24ad('0x30')](_0x7499ba,_0x24ad('0x2d'));_0x2b86d9[_0x24ad('0x34')]=_['keys'](_0x5a23ad[_0x24ad('0x34')]);_0x2b86d9[_0x24ad('0x35')]=_[_0x24ad('0x36')](_0x2b86d9[_0x24ad('0x33')],_0x2b86d9[_0x24ad('0x34')]);_0xab86b['attributes']=_['intersection'](_0x2b86d9[_0x24ad('0x33')],qs['fields'](_0x5a23ad[_0x24ad('0x34')][_0x24ad('0x37')]));_0xab86b[_0x24ad('0x38')]=_0xab86b[_0x24ad('0x38')][_0x24ad('0x39')]?_0xab86b[_0x24ad('0x38')]:_0x2b86d9[_0x24ad('0x33')];if(!_0x5a23ad[_0x24ad('0x34')][_0x24ad('0x3a')](_0x24ad('0x3b'))){_0xab86b[_0x24ad('0x25')]=qs[_0x24ad('0x25')](_0x5a23ad['query'][_0x24ad('0x25')]);_0xab86b[_0x24ad('0x24')]=qs[_0x24ad('0x24')](_0x5a23ad[_0x24ad('0x34')][_0x24ad('0x24')]);}_0xab86b[_0x24ad('0x3c')]=qs[_0x24ad('0x3d')](_0x5a23ad[_0x24ad('0x34')][_0x24ad('0x3d')]);_0xab86b[_0x24ad('0x3e')]=qs['filters'](_['pick'](_0x5a23ad['query'],_0x2b86d9[_0x24ad('0x35')]),_0x7499ba);if(_0x5a23ad[_0x24ad('0x34')][_0x24ad('0x3f')]){_0xab86b[_0x24ad('0x3e')]=_[_0x24ad('0x40')](_0xab86b[_0x24ad('0x3e')],{'$or':_[_0x24ad('0x30')](_0x7499ba,function(_0x325ab3){if(_0x325ab3['type']!==_0x24ad('0x41')){var _0x46b227={};_0x46b227[_0x325ab3['name']]={'$like':'%'+_0x5a23ad[_0x24ad('0x34')][_0x24ad('0x3f')]+'%'};return _0x46b227;}})});}_0xab86b=_[_0x24ad('0x40')]({},_0xab86b,_0x5a23ad[_0x24ad('0x42')]);var _0x3adc75={'where':_0xab86b['where']};return db[_0x24ad('0x43')]['count'](_0x3adc75)['then'](function(_0xdc03cd){_0x3acbb7['count']=_0xdc03cd;if(_0x5a23ad[_0x24ad('0x34')][_0x24ad('0x44')]){_0xab86b[_0x24ad('0x45')]=[{'all':!![]}];}return db[_0x24ad('0x43')]['findAll'](_0xab86b);})['then'](function(_0x2e256e){_0x3acbb7[_0x24ad('0x46')]=_0x2e256e;return _0x3acbb7;})[_0x24ad('0x2b')](respondWithFilteredResult(_0x1c9d42,_0xab86b))[_0x24ad('0x47')](handleError(_0x1c9d42,null));};exports[_0x24ad('0x48')]=function(_0x3521db,_0x522d36){var _0x44ccd0={'raw':!![],'where':{'id':_0x3521db[_0x24ad('0x49')]['id']}},_0x549309={};_0x549309[_0x24ad('0x33')]=_['keys'](db[_0x24ad('0x43')][_0x24ad('0x4a')]);_0x549309['query']=_['keys'](_0x3521db[_0x24ad('0x34')]);_0x549309[_0x24ad('0x35')]=_[_0x24ad('0x36')](_0x549309[_0x24ad('0x33')],_0x549309[_0x24ad('0x34')]);_0x44ccd0[_0x24ad('0x38')]=_[_0x24ad('0x36')](_0x549309[_0x24ad('0x33')],qs['fields'](_0x3521db['query']['fields']));_0x44ccd0['attributes']=_0x44ccd0['attributes'][_0x24ad('0x39')]?_0x44ccd0[_0x24ad('0x38')]:_0x549309[_0x24ad('0x33')];if(_0x3521db['query'][_0x24ad('0x44')]){_0x44ccd0[_0x24ad('0x45')]=[{'all':!![]}];}_0x44ccd0=_[_0x24ad('0x40')]({},_0x44ccd0,_0x3521db[_0x24ad('0x42')]);return db[_0x24ad('0x43')][_0x24ad('0x4b')](_0x44ccd0)['then'](handleEntityNotFound(_0x522d36,null))[_0x24ad('0x2b')](respondWithResult(_0x522d36,null))[_0x24ad('0x47')](handleError(_0x522d36,null));};exports['create']=function(_0x3a7094,_0x45e197){return db[_0x24ad('0x43')][_0x24ad('0x4c')](_0x3a7094[_0x24ad('0x4d')],{})[_0x24ad('0x2b')](respondWithResult(_0x45e197,0xc9))[_0x24ad('0x47')](handleError(_0x45e197,null));};exports[_0x24ad('0x29')]=function(_0x4eac21,_0x51cddd){if(_0x4eac21[_0x24ad('0x4d')]['id']){delete _0x4eac21['body']['id'];}return db[_0x24ad('0x43')][_0x24ad('0x4b')]({'where':{'id':_0x4eac21[_0x24ad('0x49')]['id']}})[_0x24ad('0x2b')](handleEntityNotFound(_0x51cddd,null))[_0x24ad('0x2b')](saveUpdates(_0x4eac21['body'],null))[_0x24ad('0x2b')](respondWithResult(_0x51cddd,null))[_0x24ad('0x47')](handleError(_0x51cddd,null));};exports[_0x24ad('0x2a')]=function(_0x23472a,_0xb6cd34){return db[_0x24ad('0x43')][_0x24ad('0x4b')]({'where':{'id':_0x23472a[_0x24ad('0x49')]['id']}})[_0x24ad('0x2b')](handleEntityNotFound(_0xb6cd34,null))['then'](removeEntity(_0xb6cd34,null))[_0x24ad('0x47')](handleError(_0xb6cd34,null));};exports[_0x24ad('0x4e')]=function(_0x1b3207,_0xdc3142){return db[_0x24ad('0x43')][_0x24ad('0x4e')]()['then'](respondWithResult(_0xdc3142,null))[_0x24ad('0x47')](handleError(_0xdc3142,null));};exports['getUnread']=function(_0x40ab12,_0x593dff,_0x11f414){return db[_0x24ad('0x4f')][_0x24ad('0x23')]({'where':{'ChatGroupId':_0x40ab12[_0x24ad('0x49')]['id'],'ToId':_0x40ab12[_0x24ad('0x50')]['id'],'read':![]}})['then'](function(_0x467062){return{'id':_[_0x24ad('0x51')](_0x40ab12[_0x24ad('0x49')]['id']),'count':_0x467062};})[_0x24ad('0x2b')](respondWithResult(_0x593dff,null))[_0x24ad('0x47')](handleError(_0x593dff,null));};exports['addMembers']=function(_0x4746bc,_0x5dc5b5,_0x5adda7){return db[_0x24ad('0x43')][_0x24ad('0x4b')]({'where':{'id':_0x4746bc['params']['id']}})['then'](handleEntityNotFound(_0x5dc5b5,null))['then'](function(_0x5792cf){if(_0x5792cf){return _0x5792cf['addMembers'](_0x4746bc[_0x24ad('0x4d')][_0x24ad('0x52')],_['omit'](_0x4746bc[_0x24ad('0x4d')],[_0x24ad('0x52'),'id'])||{});}})[_0x24ad('0x2b')](respondWithResult(_0x5dc5b5,null))[_0x24ad('0x47')](handleError(_0x5dc5b5,null));};exports[_0x24ad('0x53')]=function(_0x1a9916,_0x27a02e,_0x11c51e){var _0x5d78da={};var _0x5b54e0={};var _0x13b392;var _0x1fe63b;return db['ChatGroup'][_0x24ad('0x54')]({'where':{'id':_0x1a9916[_0x24ad('0x49')]['id']}})[_0x24ad('0x2b')](handleEntityNotFound(_0x27a02e,null))['then'](function(_0x415d22){if(_0x415d22){_0x13b392=_0x415d22;_0x5b54e0[_0x24ad('0x33')]=_[_0x24ad('0x55')](db[_0x24ad('0x56')][_0x24ad('0x4a')]);_0x5b54e0[_0x24ad('0x34')]=_[_0x24ad('0x55')](_0x1a9916['query']);_0x5b54e0['filters']=_[_0x24ad('0x36')](_0x5b54e0['model'],_0x5b54e0['query']);_0x5d78da[_0x24ad('0x38')]=_[_0x24ad('0x36')](_0x5b54e0[_0x24ad('0x33')],qs['fields'](_0x1a9916[_0x24ad('0x34')][_0x24ad('0x37')]));_0x5d78da[_0x24ad('0x38')]=_0x5d78da[_0x24ad('0x38')]['length']?_0x5d78da[_0x24ad('0x38')]:_0x5b54e0[_0x24ad('0x33')];_0x5d78da['order']=qs['sort'](_0x1a9916[_0x24ad('0x34')][_0x24ad('0x3d')]);_0x5d78da[_0x24ad('0x3e')]=qs[_0x24ad('0x35')](_[_0x24ad('0x57')](_0x1a9916[_0x24ad('0x34')],_0x5b54e0['filters']));if(_0x1a9916[_0x24ad('0x34')][_0x24ad('0x3f')]){_0x5d78da['where']=_[_0x24ad('0x40')](_0x5d78da['where'],{'$or':_[_0x24ad('0x30')](_0x5d78da[_0x24ad('0x38')],function(_0x29e75b){var _0x2339f2={};_0x2339f2[_0x29e75b]={'$like':'%'+_0x1a9916[_0x24ad('0x34')][_0x24ad('0x3f')]+'%'};return _0x2339f2;})});}_0x5d78da=_['merge']({},_0x5d78da,_0x1a9916[_0x24ad('0x42')]);return _0x13b392[_0x24ad('0x53')](_0x5d78da);}})[_0x24ad('0x2b')](function(_0x1f6f04){if(_0x1f6f04){_0x1fe63b=_0x1f6f04[_0x24ad('0x39')];if(!_0x1a9916[_0x24ad('0x34')][_0x24ad('0x3a')](_0x24ad('0x3b'))){_0x5d78da['limit']=qs[_0x24ad('0x25')](_0x1a9916[_0x24ad('0x34')][_0x24ad('0x25')]);_0x5d78da[_0x24ad('0x24')]=qs[_0x24ad('0x24')](_0x1a9916[_0x24ad('0x34')][_0x24ad('0x24')]);}return _0x13b392[_0x24ad('0x53')](_0x5d78da);}})[_0x24ad('0x2b')](function(_0xe08203){if(_0xe08203){return _0xe08203?{'count':_0x1fe63b,'rows':_0xe08203}:null;}})[_0x24ad('0x2b')](respondWithResult(_0x27a02e,null))[_0x24ad('0x47')](handleError(_0x27a02e,null));};exports[_0x24ad('0x58')]=function(_0x34b3a6,_0x5abb87,_0x43f120){return db[_0x24ad('0x43')][_0x24ad('0x4b')]({'where':{'id':_0x34b3a6[_0x24ad('0x49')]['id']}})['then'](handleEntityNotFound(_0x5abb87,null))[_0x24ad('0x2b')](function(_0x11df0a){if(_0x11df0a){return _0x11df0a[_0x24ad('0x58')](_0x34b3a6[_0x24ad('0x34')]['ids']);}})[_0x24ad('0x2b')](respondWithStatusCode(_0x5abb87,null))[_0x24ad('0x47')](handleError(_0x5abb87,null));};exports[_0x24ad('0x59')]=function(_0x5a51c4,_0x1adc3e,_0xc73467){if(_0x5a51c4['body']['id']){delete _0x5a51c4[_0x24ad('0x4d')]['id'];}return db[_0x24ad('0x43')][_0x24ad('0x4b')]({'where':{'id':_0x5a51c4[_0x24ad('0x49')]['id']}})[_0x24ad('0x2b')](handleEntityNotFound(_0x1adc3e,null))[_0x24ad('0x2b')](function(_0x10b9b5){if(_0x10b9b5){_0x5a51c4[_0x24ad('0x4d')]['ChatGroupId']=_0x10b9b5['id'];return db[_0x24ad('0x4f')][_0x24ad('0x4c')](_0x5a51c4['body']);}})[_0x24ad('0x2b')](respondWithResult(_0x1adc3e,null))[_0x24ad('0x47')](handleError(_0x1adc3e,null));};exports[_0x24ad('0x5a')]=function(_0x273171,_0x2a80c0,_0x2219e2){var _0x54d59a={};var _0x4c38d9={};var _0x2a4b36;var _0x20c1cc;return db['ChatGroup']['findOne']({'where':{'id':_0x273171['params']['id']}})[_0x24ad('0x2b')](handleEntityNotFound(_0x2a80c0,null))['then'](function(_0x2008aa){if(_0x2008aa){_0x2a4b36=_0x2008aa;_0x4c38d9[_0x24ad('0x33')]=_[_0x24ad('0x55')](db['ChatInternalMessage'][_0x24ad('0x4a')]);_0x4c38d9[_0x24ad('0x34')]=_['keys'](_0x273171['query']);_0x4c38d9[_0x24ad('0x35')]=_[_0x24ad('0x36')](_0x4c38d9['model'],_0x4c38d9[_0x24ad('0x34')]);_0x54d59a['attributes']=_[_0x24ad('0x36')](_0x4c38d9[_0x24ad('0x33')],qs['fields'](_0x273171[_0x24ad('0x34')]['fields']));_0x54d59a['attributes']=_0x54d59a[_0x24ad('0x38')][_0x24ad('0x39')]?_0x54d59a[_0x24ad('0x38')]:_0x4c38d9[_0x24ad('0x33')];_0x54d59a[_0x24ad('0x3c')]=qs['sort'](_0x273171[_0x24ad('0x34')][_0x24ad('0x3d')]);_0x54d59a[_0x24ad('0x3e')]=qs['filters'](_[_0x24ad('0x57')](_0x273171[_0x24ad('0x34')],_0x4c38d9['filters']));if(_0x273171['query'][_0x24ad('0x3f')]){_0x54d59a[_0x24ad('0x3e')]=_['merge'](_0x54d59a[_0x24ad('0x3e')],{'$or':_[_0x24ad('0x30')](_0x54d59a[_0x24ad('0x38')],function(_0x17cec1){var _0x27a2c7={};_0x27a2c7[_0x17cec1]={'$like':'%'+_0x273171[_0x24ad('0x34')][_0x24ad('0x3f')]+'%'};return _0x27a2c7;})});}if(_0x273171[_0x24ad('0x34')][_0x24ad('0x5b')]){var _0x57ef1e=_0x273171['query'][_0x24ad('0x5b')]['split'](',');var _0xa56064={};_0xa56064[_0x57ef1e[0x0]]={'$gte':moment(_0x57ef1e[0x1])[_0x24ad('0x5c')](_0x24ad('0x5d'))};_0x54d59a[_0x24ad('0x3e')]=_['merge'](_0x54d59a[_0x24ad('0x3e')],_0xa56064);}_0x54d59a=_[_0x24ad('0x40')]({},_0x54d59a,_0x273171[_0x24ad('0x42')]);return _0x2a4b36['getMessages'](_0x54d59a);}})['then'](function(_0x40455f){if(_0x40455f){_0x20c1cc=_0x40455f['length'];if(!_0x273171[_0x24ad('0x34')][_0x24ad('0x3a')](_0x24ad('0x3b'))){_0x54d59a[_0x24ad('0x25')]=qs[_0x24ad('0x25')](_0x273171[_0x24ad('0x34')]['limit']);_0x54d59a['offset']=qs['offset'](_0x273171[_0x24ad('0x34')][_0x24ad('0x24')]);}return _0x2a4b36['getMessages'](_0x54d59a);}})[_0x24ad('0x2b')](function(_0x302437){if(_0x302437){return _0x302437?{'count':_0x20c1cc,'rows':_0x302437}:null;}})[_0x24ad('0x2b')](respondWithResult(_0x2a80c0,null))[_0x24ad('0x47')](handleError(_0x2a80c0,null));}; \ No newline at end of file +var _0xd225=['includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','findOne','User','getMembers','hasOwnProperty','removeMembers','addMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x1e0d60,_0x503460){var _0x5b9564=function(_0x331935){while(--_0x331935){_0x1e0d60['push'](_0x1e0d60['shift']());}};_0x5b9564(++_0x503460);}(_0xd225,0xed));var _0x5d22=function(_0x5d3380,_0x53d8bf){_0x5d3380=_0x5d3380-0x0;var _0x40baa6=_0xd225[_0x5d3380];return _0x40baa6;};'use strict';var emlformat=require(_0x5d22('0x0'));var rimraf=require(_0x5d22('0x1'));var zipdir=require(_0x5d22('0x2'));var jsonpatch=require(_0x5d22('0x3'));var rp=require(_0x5d22('0x4'));var moment=require(_0x5d22('0x5'));var BPromise=require(_0x5d22('0x6'));var Mustache=require(_0x5d22('0x7'));var util=require(_0x5d22('0x8'));var path=require(_0x5d22('0x9'));var sox=require(_0x5d22('0xa'));var csv=require(_0x5d22('0xb'));var ejs=require(_0x5d22('0xc'));var fs=require('fs');var fs_extra=require(_0x5d22('0xd'));var _=require(_0x5d22('0xe'));var squel=require(_0x5d22('0xf'));var crypto=require(_0x5d22('0x10'));var jsforce=require(_0x5d22('0x11'));var deskjs=require(_0x5d22('0x12'));var toCsv=require(_0x5d22('0xb'));var querystring=require('querystring');var Papa=require(_0x5d22('0x13'));var Redis=require(_0x5d22('0x14'));var authService=require(_0x5d22('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x5d22('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d22('0x17'))(_0x5d22('0x18'));var utils=require(_0x5d22('0x19'));var config=require(_0x5d22('0x1a'));var licenseUtil=require(_0x5d22('0x1b'));var db=require(_0x5d22('0x1c'))['db'];config[_0x5d22('0x1d')]=_[_0x5d22('0x1e')](config['redis'],{'host':_0x5d22('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5d22('0x20'))[_0x5d22('0x21')](socket);function respondWithStatusCode(_0x584506,_0x5ec77d){_0x5ec77d=_0x5ec77d||0xcc;return function(_0x1e3d61){if(_0x1e3d61){return _0x584506[_0x5d22('0x22')](_0x5ec77d);}return _0x584506[_0x5d22('0x23')](_0x5ec77d)['end']();};}function respondWithResult(_0x4f827f,_0x1315b7){_0x1315b7=_0x1315b7||0xc8;return function(_0x424dde){if(_0x424dde){return _0x4f827f[_0x5d22('0x23')](_0x1315b7)[_0x5d22('0x24')](_0x424dde);}};}function respondWithFilteredResult(_0x136960,_0x3a2ccc){return function(_0x44afe0){if(_0x44afe0){var _0x4ba8b7=typeof _0x3a2ccc['offset']===_0x5d22('0x25')&&typeof _0x3a2ccc[_0x5d22('0x26')]===_0x5d22('0x25');var _0x286ed0=_0x44afe0[_0x5d22('0x27')];var _0x5ecc01=_0x4ba8b7?0x0:_0x3a2ccc[_0x5d22('0x28')];var _0x2701e0=_0x4ba8b7?_0x44afe0[_0x5d22('0x27')]:_0x3a2ccc[_0x5d22('0x28')]+_0x3a2ccc[_0x5d22('0x26')];var _0x5d3ab1;if(_0x2701e0>=_0x286ed0){_0x2701e0=_0x286ed0;_0x5d3ab1=0xc8;}else{_0x5d3ab1=0xce;}_0x136960[_0x5d22('0x23')](_0x5d3ab1);return _0x136960[_0x5d22('0x29')](_0x5d22('0x2a'),_0x5ecc01+'-'+_0x2701e0+'/'+_0x286ed0)[_0x5d22('0x24')](_0x44afe0);}return null;};}function patchUpdates(_0x41fa57){return function(_0x265b6b){try{jsonpatch[_0x5d22('0x2b')](_0x265b6b,_0x41fa57,!![]);}catch(_0x22e72a){return BPromise[_0x5d22('0x2c')](_0x22e72a);}return _0x265b6b[_0x5d22('0x2d')]();};}function saveUpdates(_0x9db03f,_0x4be978){return function(_0x3bbb7b){if(_0x3bbb7b){return _0x3bbb7b[_0x5d22('0x2e')](_0x9db03f)[_0x5d22('0x2f')](function(_0x14ac30){return _0x14ac30;});}return null;};}function removeEntity(_0x39ff7c,_0x39e057){return function(_0xb90954){if(_0xb90954){return _0xb90954[_0x5d22('0x30')]()['then'](function(){_0x39ff7c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fcb92,_0x188d61){return function(_0x2ca993){if(!_0x2ca993){_0x1fcb92[_0x5d22('0x22')](0x194);}return _0x2ca993;};}function handleError(_0x444b85,_0xccbde0){_0xccbde0=_0xccbde0||0x1f4;return function(_0x1e2b87){logger[_0x5d22('0x31')](_0x1e2b87[_0x5d22('0x32')]);if(_0x1e2b87['name']){delete _0x1e2b87[_0x5d22('0x33')];}_0x444b85['status'](_0xccbde0)[_0x5d22('0x34')](_0x1e2b87);};}exports[_0x5d22('0x35')]=function(_0x2be662,_0x1e893f){var _0x3d44e5={},_0x36c256={},_0x49975c={'count':0x0,'rows':[]};var _0x208aba=_[_0x5d22('0x36')](db[_0x5d22('0x37')][_0x5d22('0x38')],function(_0x198662){return{'name':_0x198662['fieldName'],'type':_0x198662[_0x5d22('0x39')][_0x5d22('0x3a')]};});_0x36c256[_0x5d22('0x3b')]=_[_0x5d22('0x36')](_0x208aba,_0x5d22('0x33'));_0x36c256['query']=_['keys'](_0x2be662[_0x5d22('0x3c')]);_0x36c256[_0x5d22('0x3d')]=_[_0x5d22('0x3e')](_0x36c256[_0x5d22('0x3b')],_0x36c256[_0x5d22('0x3c')]);_0x3d44e5[_0x5d22('0x3f')]=_['intersection'](_0x36c256[_0x5d22('0x3b')],qs[_0x5d22('0x40')](_0x2be662['query']['fields']));_0x3d44e5[_0x5d22('0x3f')]=_0x3d44e5['attributes'][_0x5d22('0x41')]?_0x3d44e5[_0x5d22('0x3f')]:_0x36c256['model'];if(!_0x2be662[_0x5d22('0x3c')]['hasOwnProperty'](_0x5d22('0x42'))){_0x3d44e5[_0x5d22('0x26')]=qs[_0x5d22('0x26')](_0x2be662[_0x5d22('0x3c')][_0x5d22('0x26')]);_0x3d44e5[_0x5d22('0x28')]=qs[_0x5d22('0x28')](_0x2be662[_0x5d22('0x3c')][_0x5d22('0x28')]);}_0x3d44e5[_0x5d22('0x43')]=qs[_0x5d22('0x44')](_0x2be662[_0x5d22('0x3c')][_0x5d22('0x44')]);_0x3d44e5[_0x5d22('0x45')]=qs['filters'](_[_0x5d22('0x46')](_0x2be662[_0x5d22('0x3c')],_0x36c256[_0x5d22('0x3d')]),_0x208aba);if(_0x2be662[_0x5d22('0x3c')][_0x5d22('0x47')]){_0x3d44e5['where']=_['merge'](_0x3d44e5[_0x5d22('0x45')],{'$or':_[_0x5d22('0x36')](_0x208aba,function(_0x2488e6){if(_0x2488e6[_0x5d22('0x39')]!==_0x5d22('0x48')){var _0x50b849={};_0x50b849[_0x2488e6['name']]={'$like':'%'+_0x2be662[_0x5d22('0x3c')][_0x5d22('0x47')]+'%'};return _0x50b849;}})});}_0x3d44e5=_[_0x5d22('0x49')]({},_0x3d44e5,_0x2be662[_0x5d22('0x4a')]);var _0x4c814b={'where':_0x3d44e5['where']};return db[_0x5d22('0x37')][_0x5d22('0x27')](_0x4c814b)[_0x5d22('0x2f')](function(_0x9d3f4f){_0x49975c[_0x5d22('0x27')]=_0x9d3f4f;if(_0x2be662['query'][_0x5d22('0x4b')]){_0x3d44e5[_0x5d22('0x4c')]=[{'all':!![]}];}return db['ChatGroup'][_0x5d22('0x4d')](_0x3d44e5);})[_0x5d22('0x2f')](function(_0x33dff3){_0x49975c[_0x5d22('0x4e')]=_0x33dff3;return _0x49975c;})[_0x5d22('0x2f')](respondWithFilteredResult(_0x1e893f,_0x3d44e5))[_0x5d22('0x4f')](handleError(_0x1e893f,null));};exports[_0x5d22('0x50')]=function(_0x51873c,_0x4f55b3){var _0x1460a5={'raw':!![],'where':{'id':_0x51873c[_0x5d22('0x51')]['id']}},_0x4839fb={};_0x4839fb[_0x5d22('0x3b')]=_['keys'](db[_0x5d22('0x37')][_0x5d22('0x38')]);_0x4839fb[_0x5d22('0x3c')]=_[_0x5d22('0x52')](_0x51873c[_0x5d22('0x3c')]);_0x4839fb[_0x5d22('0x3d')]=_[_0x5d22('0x3e')](_0x4839fb['model'],_0x4839fb[_0x5d22('0x3c')]);_0x1460a5[_0x5d22('0x3f')]=_[_0x5d22('0x3e')](_0x4839fb[_0x5d22('0x3b')],qs[_0x5d22('0x40')](_0x51873c[_0x5d22('0x3c')]['fields']));_0x1460a5[_0x5d22('0x3f')]=_0x1460a5[_0x5d22('0x3f')][_0x5d22('0x41')]?_0x1460a5['attributes']:_0x4839fb['model'];if(_0x51873c[_0x5d22('0x3c')][_0x5d22('0x4b')]){_0x1460a5[_0x5d22('0x4c')]=[{'all':!![]}];}_0x1460a5=_['merge']({},_0x1460a5,_0x51873c['options']);return db['ChatGroup'][_0x5d22('0x53')](_0x1460a5)['then'](handleEntityNotFound(_0x4f55b3,null))[_0x5d22('0x2f')](respondWithResult(_0x4f55b3,null))[_0x5d22('0x4f')](handleError(_0x4f55b3,null));};exports[_0x5d22('0x54')]=function(_0x4fd67d,_0x5a8331){return db[_0x5d22('0x37')][_0x5d22('0x54')](_0x4fd67d[_0x5d22('0x55')],{})[_0x5d22('0x2f')](respondWithResult(_0x5a8331,0xc9))['catch'](handleError(_0x5a8331,null));};exports[_0x5d22('0x2e')]=function(_0x344c4b,_0x482e8e){if(_0x344c4b['body']['id']){delete _0x344c4b[_0x5d22('0x55')]['id'];}return db[_0x5d22('0x37')][_0x5d22('0x53')]({'where':{'id':_0x344c4b[_0x5d22('0x51')]['id']}})[_0x5d22('0x2f')](handleEntityNotFound(_0x482e8e,null))['then'](saveUpdates(_0x344c4b['body'],null))['then'](respondWithResult(_0x482e8e,null))[_0x5d22('0x4f')](handleError(_0x482e8e,null));};exports[_0x5d22('0x30')]=function(_0x45ac03,_0x30b4b7){return db['ChatGroup'][_0x5d22('0x53')]({'where':{'id':_0x45ac03[_0x5d22('0x51')]['id']}})[_0x5d22('0x2f')](handleEntityNotFound(_0x30b4b7,null))[_0x5d22('0x2f')](removeEntity(_0x30b4b7,null))[_0x5d22('0x4f')](handleError(_0x30b4b7,null));};exports[_0x5d22('0x56')]=function(_0x1f6ff5,_0x12c5e4){return db[_0x5d22('0x37')][_0x5d22('0x56')]()[_0x5d22('0x2f')](respondWithResult(_0x12c5e4,null))['catch'](handleError(_0x12c5e4,null));};exports['getUnread']=function(_0x58c43e,_0x2a5ac2,_0x34dd4c){return db[_0x5d22('0x57')][_0x5d22('0x27')]({'where':{'ChatGroupId':_0x58c43e[_0x5d22('0x51')]['id'],'ToId':_0x58c43e[_0x5d22('0x58')]['id'],'read':![]}})[_0x5d22('0x2f')](function(_0x494e3b){return{'id':_[_0x5d22('0x59')](_0x58c43e[_0x5d22('0x51')]['id']),'count':_0x494e3b};})[_0x5d22('0x2f')](respondWithResult(_0x2a5ac2,null))[_0x5d22('0x4f')](handleError(_0x2a5ac2,null));};exports[_0x5d22('0x5a')]=function(_0x506a3f,_0x52fb8b,_0x30088a){return db['ChatGroup'][_0x5d22('0x53')]({'where':{'id':_0x506a3f['params']['id']}})[_0x5d22('0x2f')](handleEntityNotFound(_0x52fb8b,null))[_0x5d22('0x2f')](function(_0x4848ae){if(_0x4848ae){return _0x4848ae[_0x5d22('0x5a')](_0x506a3f[_0x5d22('0x55')][_0x5d22('0x5b')],_[_0x5d22('0x5c')](_0x506a3f[_0x5d22('0x55')],[_0x5d22('0x5b'),'id'])||{});}})[_0x5d22('0x2f')](respondWithResult(_0x52fb8b,null))[_0x5d22('0x4f')](handleError(_0x52fb8b,null));};exports['getMembers']=function(_0x2a19c4,_0x5e8913,_0x4dd7ae){var _0x4242ff={};var _0xeaeeb9={};var _0x45e731;var _0x1f5981;return db[_0x5d22('0x37')][_0x5d22('0x5d')]({'where':{'id':_0x2a19c4[_0x5d22('0x51')]['id']}})[_0x5d22('0x2f')](handleEntityNotFound(_0x5e8913,null))[_0x5d22('0x2f')](function(_0x57b834){if(_0x57b834){_0x45e731=_0x57b834;_0xeaeeb9['model']=_[_0x5d22('0x52')](db[_0x5d22('0x5e')][_0x5d22('0x38')]);_0xeaeeb9['query']=_[_0x5d22('0x52')](_0x2a19c4[_0x5d22('0x3c')]);_0xeaeeb9['filters']=_[_0x5d22('0x3e')](_0xeaeeb9[_0x5d22('0x3b')],_0xeaeeb9['query']);_0x4242ff[_0x5d22('0x3f')]=_[_0x5d22('0x3e')](_0xeaeeb9[_0x5d22('0x3b')],qs[_0x5d22('0x40')](_0x2a19c4['query'][_0x5d22('0x40')]));_0x4242ff[_0x5d22('0x3f')]=_0x4242ff[_0x5d22('0x3f')][_0x5d22('0x41')]?_0x4242ff[_0x5d22('0x3f')]:_0xeaeeb9[_0x5d22('0x3b')];_0x4242ff['order']=qs['sort'](_0x2a19c4[_0x5d22('0x3c')][_0x5d22('0x44')]);_0x4242ff[_0x5d22('0x45')]=qs['filters'](_[_0x5d22('0x46')](_0x2a19c4[_0x5d22('0x3c')],_0xeaeeb9[_0x5d22('0x3d')]));if(_0x2a19c4[_0x5d22('0x3c')][_0x5d22('0x47')]){_0x4242ff[_0x5d22('0x45')]=_[_0x5d22('0x49')](_0x4242ff[_0x5d22('0x45')],{'$or':_[_0x5d22('0x36')](_0x4242ff['attributes'],function(_0x2775d5){var _0x498753={};_0x498753[_0x2775d5]={'$like':'%'+_0x2a19c4['query'][_0x5d22('0x47')]+'%'};return _0x498753;})});}_0x4242ff=_['merge']({},_0x4242ff,_0x2a19c4[_0x5d22('0x4a')]);return _0x45e731[_0x5d22('0x5f')](_0x4242ff);}})[_0x5d22('0x2f')](function(_0x27e440){if(_0x27e440){_0x1f5981=_0x27e440['length'];if(!_0x2a19c4['query'][_0x5d22('0x60')]('nolimit')){_0x4242ff[_0x5d22('0x26')]=qs[_0x5d22('0x26')](_0x2a19c4[_0x5d22('0x3c')][_0x5d22('0x26')]);_0x4242ff[_0x5d22('0x28')]=qs[_0x5d22('0x28')](_0x2a19c4[_0x5d22('0x3c')][_0x5d22('0x28')]);}return _0x45e731['getMembers'](_0x4242ff);}})['then'](function(_0x43d047){if(_0x43d047){return _0x43d047?{'count':_0x1f5981,'rows':_0x43d047}:null;}})[_0x5d22('0x2f')](respondWithResult(_0x5e8913,null))[_0x5d22('0x4f')](handleError(_0x5e8913,null));};exports[_0x5d22('0x61')]=function(_0x6d7cff,_0x5baa37,_0x224633){return db[_0x5d22('0x37')]['find']({'where':{'id':_0x6d7cff[_0x5d22('0x51')]['id']}})['then'](handleEntityNotFound(_0x5baa37,null))[_0x5d22('0x2f')](function(_0x5499e7){if(_0x5499e7){return _0x5499e7[_0x5d22('0x61')](_0x6d7cff['query'][_0x5d22('0x5b')]);}})[_0x5d22('0x2f')](respondWithStatusCode(_0x5baa37,null))['catch'](handleError(_0x5baa37,null));};exports[_0x5d22('0x62')]=function(_0x88756e,_0x16ca65,_0x54e4c3){if(_0x88756e[_0x5d22('0x55')]['id']){delete _0x88756e[_0x5d22('0x55')]['id'];}return db[_0x5d22('0x37')][_0x5d22('0x53')]({'where':{'id':_0x88756e[_0x5d22('0x51')]['id']}})[_0x5d22('0x2f')](handleEntityNotFound(_0x16ca65,null))['then'](function(_0x276955){if(_0x276955){_0x88756e['body']['ChatGroupId']=_0x276955['id'];return db[_0x5d22('0x57')][_0x5d22('0x54')](_0x88756e['body']);}})['then'](respondWithResult(_0x16ca65,null))['catch'](handleError(_0x16ca65,null));};exports[_0x5d22('0x63')]=function(_0xbd2b54,_0x2a133a,_0x2128ad){var _0x38f96f={};var _0x3ce17c={};var _0x152607;var _0x2135fe;return db[_0x5d22('0x37')][_0x5d22('0x5d')]({'where':{'id':_0xbd2b54[_0x5d22('0x51')]['id']}})[_0x5d22('0x2f')](handleEntityNotFound(_0x2a133a,null))[_0x5d22('0x2f')](function(_0x1734b1){if(_0x1734b1){_0x152607=_0x1734b1;_0x3ce17c[_0x5d22('0x3b')]=_['keys'](db[_0x5d22('0x57')]['rawAttributes']);_0x3ce17c['query']=_[_0x5d22('0x52')](_0xbd2b54[_0x5d22('0x3c')]);_0x3ce17c[_0x5d22('0x3d')]=_[_0x5d22('0x3e')](_0x3ce17c[_0x5d22('0x3b')],_0x3ce17c['query']);_0x38f96f[_0x5d22('0x3f')]=_[_0x5d22('0x3e')](_0x3ce17c[_0x5d22('0x3b')],qs[_0x5d22('0x40')](_0xbd2b54['query'][_0x5d22('0x40')]));_0x38f96f['attributes']=_0x38f96f[_0x5d22('0x3f')][_0x5d22('0x41')]?_0x38f96f[_0x5d22('0x3f')]:_0x3ce17c[_0x5d22('0x3b')];_0x38f96f[_0x5d22('0x43')]=qs[_0x5d22('0x44')](_0xbd2b54[_0x5d22('0x3c')]['sort']);_0x38f96f['where']=qs[_0x5d22('0x3d')](_['pick'](_0xbd2b54[_0x5d22('0x3c')],_0x3ce17c[_0x5d22('0x3d')]));if(_0xbd2b54[_0x5d22('0x3c')]['filter']){_0x38f96f[_0x5d22('0x45')]=_[_0x5d22('0x49')](_0x38f96f[_0x5d22('0x45')],{'$or':_[_0x5d22('0x36')](_0x38f96f[_0x5d22('0x3f')],function(_0x11a49d){var _0x5d58c8={};_0x5d58c8[_0x11a49d]={'$like':'%'+_0xbd2b54['query'][_0x5d22('0x47')]+'%'};return _0x5d58c8;})});}if(_0xbd2b54[_0x5d22('0x3c')][_0x5d22('0x64')]){var _0x5ba2f0=_0xbd2b54[_0x5d22('0x3c')][_0x5d22('0x64')][_0x5d22('0x65')](',');var _0x9a676b={};_0x9a676b[_0x5ba2f0[0x0]]={'$gte':moment(_0x5ba2f0[0x1])[_0x5d22('0x66')](_0x5d22('0x67'))};_0x38f96f[_0x5d22('0x45')]=_[_0x5d22('0x49')](_0x38f96f[_0x5d22('0x45')],_0x9a676b);}_0x38f96f=_[_0x5d22('0x49')]({},_0x38f96f,_0xbd2b54[_0x5d22('0x4a')]);return _0x152607['getMessages'](_0x38f96f);}})['then'](function(_0x2720e8){if(_0x2720e8){_0x2135fe=_0x2720e8[_0x5d22('0x41')];if(!_0xbd2b54[_0x5d22('0x3c')][_0x5d22('0x60')](_0x5d22('0x42'))){_0x38f96f[_0x5d22('0x26')]=qs[_0x5d22('0x26')](_0xbd2b54[_0x5d22('0x3c')]['limit']);_0x38f96f[_0x5d22('0x28')]=qs[_0x5d22('0x28')](_0xbd2b54[_0x5d22('0x3c')][_0x5d22('0x28')]);}return _0x152607[_0x5d22('0x63')](_0x38f96f);}})[_0x5d22('0x2f')](function(_0x2656cc){if(_0x2656cc){return _0x2656cc?{'count':_0x2135fe,'rows':_0x2656cc}:null;}})['then'](respondWithResult(_0x2a133a,null))[_0x5d22('0x4f')](handleError(_0x2a133a,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index fbde617..8592466 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 _0xfe91=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','update','remove'];(function(_0x497d8c,_0x2904c9){var _0xeafed7=function(_0x3b51e8){while(--_0x3b51e8){_0x497d8c['push'](_0x497d8c['shift']());}};_0xeafed7(++_0x2904c9);}(_0xfe91,0xd4));var _0x1fe9=function(_0x439d59,_0x11ccdf){_0x439d59=_0x439d59-0x0;var _0x3670c7=_0xfe91[_0x439d59];return _0x3670c7;};'use strict';var EventEmitter=require(_0x1fe9('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x1fe9('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1fe9('0x2'),'afterDestroy':_0x1fe9('0x3')};function emitEvent(_0x1b26ca){return function(_0xf47d94,_0x40c26c,_0x16259f){ChatGroupEvents[_0x1fe9('0x4')](_0x1b26ca+':'+_0xf47d94['id'],_0xf47d94);ChatGroupEvents['emit'](_0x1b26ca,_0xf47d94);_0x16259f(null);};}for(var e in events){if(events[_0x1fe9('0x5')](e)){var event=events[e];ChatGroup[_0x1fe9('0x6')](e,emitEvent(event));}}module[_0x1fe9('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0xa7b3=['setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb','ChatGroup'];(function(_0x4e3c5b,_0x2b5b9f){var _0x38e8f7=function(_0xe53153){while(--_0xe53153){_0x4e3c5b['push'](_0x4e3c5b['shift']());}};_0x38e8f7(++_0x2b5b9f);}(_0xa7b3,0x1ee));var _0x3a7b=function(_0x405733,_0x3d9f14){_0x405733=_0x405733-0x0;var _0x592395=_0xa7b3[_0x405733];return _0x592395;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x3a7b('0x0'))['db'][_0x3a7b('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x3a7b('0x2')](0x0);var events={'afterCreate':_0x3a7b('0x3'),'afterUpdate':_0x3a7b('0x4'),'afterDestroy':_0x3a7b('0x5')};function emitEvent(_0x2bd76a){return function(_0x48fa01,_0x29c779,_0xac38b6){ChatGroupEvents['emit'](_0x2bd76a+':'+_0x48fa01['id'],_0x48fa01);ChatGroupEvents[_0x3a7b('0x6')](_0x2bd76a,_0x48fa01);_0xac38b6(null);};}for(var e in events){if(events[_0x3a7b('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 76efe62..8f198b2 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 _0x0dfb=['ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','define'];(function(_0x1bb560,_0xeae53f){var _0x41416f=function(_0x4e3965){while(--_0x4e3965){_0x1bb560['push'](_0x1bb560['shift']());}};_0x41416f(++_0xeae53f);}(_0x0dfb,0x8e));var _0xb0df=function(_0x459564,_0x4305d6){_0x459564=_0x459564-0x0;var _0x3b12d0=_0x0dfb[_0x459564];return _0x3b12d0;};'use strict';var _=require(_0xb0df('0x0'));var util=require(_0xb0df('0x1'));var logger=require(_0xb0df('0x2'))(_0xb0df('0x3'));var moment=require(_0xb0df('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb0df('0x5'));var config=require(_0xb0df('0x6'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x1ec16f,_0x3d7464){return _0x1ec16f[_0xb0df('0x7')](_0xb0df('0x8'),attributes,{'tableName':_0xb0df('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4597=['ChatGroup','chat_groups','lodash','util','api','request-promise','path','../../config/environment','exports','define'];(function(_0x5a1734,_0x5b9ac3){var _0x351773=function(_0x5009de){while(--_0x5009de){_0x5a1734['push'](_0x5a1734['shift']());}};_0x351773(++_0x5b9ac3);}(_0x4597,0x1ba));var _0x7459=function(_0x1861c0,_0x1b2f40){_0x1861c0=_0x1861c0-0x0;var _0x431d51=_0x4597[_0x1861c0];return _0x431d51;};'use strict';var _=require(_0x7459('0x0'));var util=require(_0x7459('0x1'));var logger=require('../../config/logger')(_0x7459('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7459('0x3'));var fs=require('fs');var path=require(_0x7459('0x4'));var rimraf=require('rimraf');var config=require(_0x7459('0x5'));var attributes=require('./chatGroup.attributes');module[_0x7459('0x6')]=function(_0x5748c6,_0x387b31){return _0x5748c6[_0x7459('0x7')](_0x7459('0x8'),attributes,{'tableName':_0x7459('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index c6a0cec..307d04d 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 _0x9490=['info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x4b1efb,_0x1c34fd){var _0x1828c6=function(_0x1d11da){while(--_0x1d11da){_0x4b1efb['push'](_0x4b1efb['shift']());}};_0x1828c6(++_0x1c34fd);}(_0x9490,0x15c));var _0x0949=function(_0x322add,_0x48b075){_0x322add=_0x322add-0x0;var _0x2c6a89=_0x9490[_0x322add];return _0x2c6a89;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0949('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0949('0x1'));var db=require(_0x0949('0x2'))['db'];var utils=require(_0x0949('0x3'));var logger=require(_0x0949('0x4'))(_0x0949('0x5'));var config=require('../../config/environment');var jayson=require(_0x0949('0x6'));var client=jayson[_0x0949('0x7')][_0x0949('0x8')]({'port':0x232a});config[_0x0949('0x9')]=_[_0x0949('0xa')](config['redis'],{'host':_0x0949('0xb'),'port':0x18eb});var socket=require(_0x0949('0xc'))(new Redis(config[_0x0949('0x9')]));require('./chatGroup.socket')[_0x0949('0xd')](socket);function respondWithRpcPromise(_0x3c37f2,_0x43e197,_0x236682){return new BPromise(function(_0x5a198a,_0x296177){return client[_0x0949('0xe')](_0x3c37f2,_0x236682)[_0x0949('0xf')](function(_0x2e6175){logger[_0x0949('0x10')](_0x0949('0x11'),_0x43e197,_0x0949('0x12'));logger[_0x0949('0x13')](_0x0949('0x14'),_0x43e197,_0x0949('0x12'),JSON['stringify'](_0x2e6175));if(_0x2e6175['error']){if(_0x2e6175[_0x0949('0x15')][_0x0949('0x16')]===0x1f4){logger[_0x0949('0x15')](_0x0949('0x11'),_0x43e197,_0x2e6175['error'][_0x0949('0x17')]);return _0x296177(_0x2e6175['error'][_0x0949('0x17')]);}logger[_0x0949('0x15')](_0x0949('0x11'),_0x43e197,_0x2e6175[_0x0949('0x15')][_0x0949('0x17')]);return _0x5a198a(_0x2e6175[_0x0949('0x15')][_0x0949('0x17')]);}else{logger[_0x0949('0x10')](_0x0949('0x11'),_0x43e197,_0x0949('0x12'));_0x5a198a(_0x2e6175[_0x0949('0x18')][_0x0949('0x17')]);}})[_0x0949('0x19')](function(_0x5018ee){logger[_0x0949('0x15')](_0x0949('0x11'),_0x43e197,_0x5018ee);_0x296177(_0x5018ee);});});} \ No newline at end of file +var _0xd10b=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x143565,_0x54d887){var _0x4dc1d9=function(_0x5e8838){while(--_0x5e8838){_0x143565['push'](_0x143565['shift']());}};_0x4dc1d9(++_0x54d887);}(_0xd10b,0x189));var _0xbd10=function(_0x532fc8,_0x582fb0){_0x532fc8=_0x532fc8-0x0;var _0x186e8a=_0xd10b[_0x532fc8];return _0x186e8a;};'use strict';var _=require(_0xbd10('0x0'));var util=require(_0xbd10('0x1'));var moment=require(_0xbd10('0x2'));var BPromise=require(_0xbd10('0x3'));var rs=require(_0xbd10('0x4'));var fs=require('fs');var Redis=require(_0xbd10('0x5'));var db=require(_0xbd10('0x6'))['db'];var utils=require(_0xbd10('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xbd10('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbd10('0x9')]({'port':0x232a});config[_0xbd10('0xa')]=_[_0xbd10('0xb')](config[_0xbd10('0xa')],{'host':_0xbd10('0xc'),'port':0x18eb});var socket=require(_0xbd10('0xd'))(new Redis(config[_0xbd10('0xa')]));require(_0xbd10('0xe'))[_0xbd10('0xf')](socket);function respondWithRpcPromise(_0x45bbab,_0xd97ba4,_0x1c7332){return new BPromise(function(_0x488801,_0x409387){return client[_0xbd10('0x10')](_0x45bbab,_0x1c7332)[_0xbd10('0x11')](function(_0x888a80){logger[_0xbd10('0x12')](_0xbd10('0x13'),_0xd97ba4,_0xbd10('0x14'));logger['debug'](_0xbd10('0x15'),_0xd97ba4,'request\x20sent',JSON[_0xbd10('0x16')](_0x888a80));if(_0x888a80[_0xbd10('0x17')]){if(_0x888a80[_0xbd10('0x17')][_0xbd10('0x18')]===0x1f4){logger['error'](_0xbd10('0x13'),_0xd97ba4,_0x888a80['error']['message']);return _0x409387(_0x888a80[_0xbd10('0x17')][_0xbd10('0x19')]);}logger[_0xbd10('0x17')](_0xbd10('0x13'),_0xd97ba4,_0x888a80[_0xbd10('0x17')]['message']);return _0x488801(_0x888a80[_0xbd10('0x17')][_0xbd10('0x19')]);}else{logger[_0xbd10('0x12')](_0xbd10('0x13'),_0xd97ba4,_0xbd10('0x14'));_0x488801(_0x888a80[_0xbd10('0x1a')][_0xbd10('0x19')]);}})[_0xbd10('0x1b')](function(_0x25cf8e){logger[_0xbd10('0x17')](_0xbd10('0x13'),_0xd97ba4,_0x25cf8e);_0x409387(_0x25cf8e);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 35cce11..a04cff8 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 _0x27ce=['update','emit','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x273694,_0x4586c8){var _0x777503=function(_0x161e5b){while(--_0x161e5b){_0x273694['push'](_0x273694['shift']());}};_0x777503(++_0x4586c8);}(_0x27ce,0x1ad));var _0xe27c=function(_0x150cd5,_0x32feff){_0x150cd5=_0x150cd5-0x0;var _0x28f934=_0x27ce[_0x150cd5];return _0x28f934;};'use strict';var ChatGroupEvents=require(_0xe27c('0x0'));var events=[_0xe27c('0x1'),_0xe27c('0x2'),_0xe27c('0x3')];function createListener(_0x406f41,_0x14e3a5){return function(_0x2273f8){_0x14e3a5[_0xe27c('0x4')](_0x406f41,_0x2273f8);};}function removeListener(_0x47bca5,_0x370fc5){return function(){ChatGroupEvents[_0xe27c('0x5')](_0x47bca5,_0x370fc5);};}exports[_0xe27c('0x6')]=function(_0x1bfb3c){for(var _0x562780=0x0,_0x2b9a8b=events[_0xe27c('0x7')];_0x562780<_0x2b9a8b;_0x562780++){var _0x3d741f=events[_0x562780];var _0x2cacaa=createListener(_0xe27c('0x8')+_0x3d741f,_0x1bfb3c);ChatGroupEvents['on'](_0x3d741f,_0x2cacaa);}}; \ No newline at end of file +var _0x6fdf=['./chatGroup.events','emit','removeListener','register','length'];(function(_0x4f35eb,_0x511e11){var _0x483bf0=function(_0x534036){while(--_0x534036){_0x4f35eb['push'](_0x4f35eb['shift']());}};_0x483bf0(++_0x511e11);}(_0x6fdf,0x13b));var _0xf6fd=function(_0x59a466,_0x5e2be3){_0x59a466=_0x59a466-0x0;var _0x46a0af=_0x6fdf[_0x59a466];return _0x46a0af;};'use strict';var ChatGroupEvents=require(_0xf6fd('0x0'));var events=['save','remove','update'];function createListener(_0x3e1849,_0x64d39b){return function(_0x26cbf2){_0x64d39b[_0xf6fd('0x1')](_0x3e1849,_0x26cbf2);};}function removeListener(_0xaa665,_0x229140){return function(){ChatGroupEvents[_0xf6fd('0x2')](_0xaa665,_0x229140);};}exports[_0xf6fd('0x3')]=function(_0x33b508){for(var _0x1baf94=0x0,_0x58ebf6=events[_0xf6fd('0x4')];_0x1baf94<_0x58ebf6;_0x1baf94++){var _0x49dd29=events[_0x1baf94];var _0xbad1c0=createListener('chatGroup:'+_0x49dd29,_0x33b508);ChatGroupEvents['on'](_0x49dd29,_0xbad1c0);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 32cf171..ac0c775 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 _0xfc7e=['isAuthenticated','index','/describe','describe','show','/:id/unread','getUnread','/:id/members','post','create','addMembers','put','/:id','update','delete','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x14a028,_0x50fd59){var _0xf0a840=function(_0x4586b4){while(--_0x4586b4){_0x14a028['push'](_0x14a028['shift']());}};_0xf0a840(++_0x50fd59);}(_0xfc7e,0x9a));var _0xefc7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfc7e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xefc7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xefc7('0x1'));var router=express[_0xefc7('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xefc7('0x3'));var interaction=require(_0xefc7('0x4'));var config=require(_0xefc7('0x5'));var controller=require('./chatGroup.controller');router[_0xefc7('0x6')]('/',auth[_0xefc7('0x7')](),controller[_0xefc7('0x8')]);router['get'](_0xefc7('0x9'),auth[_0xefc7('0x7')](),controller[_0xefc7('0xa')]);router[_0xefc7('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xefc7('0xb')]);router[_0xefc7('0x6')](_0xefc7('0xc'),auth[_0xefc7('0x7')](),controller[_0xefc7('0xd')]);router['get'](_0xefc7('0xe'),auth[_0xefc7('0x7')](),controller['getMembers']);router[_0xefc7('0x6')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0xefc7('0xf')]('/',auth[_0xefc7('0x7')](),controller[_0xefc7('0x10')]);router[_0xefc7('0xf')](_0xefc7('0xe'),auth['isAuthenticated'](),controller[_0xefc7('0x11')]);router[_0xefc7('0xf')]('/:id/messages',auth[_0xefc7('0x7')](),controller['addMessage']);router[_0xefc7('0x12')](_0xefc7('0x13'),auth[_0xefc7('0x7')](),controller[_0xefc7('0x14')]);router[_0xefc7('0x15')](_0xefc7('0x13'),auth[_0xefc7('0x7')](),controller['destroy']);router[_0xefc7('0x15')](_0xefc7('0xe'),auth[_0xefc7('0x7')](),controller['removeMembers']);module[_0xefc7('0x16')]=router; \ No newline at end of file +var _0x5680=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','index','isAuthenticated','get','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','post','create','/:id/members','addMembers','addMessage','put','update','destroy','delete','removeMembers','exports'];(function(_0x38be4b,_0x4d134a){var _0x3d3a34=function(_0x244438){while(--_0x244438){_0x38be4b['push'](_0x38be4b['shift']());}};_0x3d3a34(++_0x4d134a);}(_0x5680,0xbd));var _0x0568=function(_0x542485,_0x45a70f){_0x542485=_0x542485-0x0;var _0x329073=_0x5680[_0x542485];return _0x329073;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0568('0x0'));var express=require(_0x0568('0x1'));var router=express[_0x0568('0x2')]();var fs_extra=require(_0x0568('0x3'));var auth=require(_0x0568('0x4'));var interaction=require(_0x0568('0x5'));var config=require('../../config/environment');var controller=require(_0x0568('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0568('0x7')]);router['get']('/describe',auth[_0x0568('0x8')](),controller['describe']);router[_0x0568('0x9')](_0x0568('0xa'),auth[_0x0568('0x8')](),controller[_0x0568('0xb')]);router[_0x0568('0x9')](_0x0568('0xc'),auth[_0x0568('0x8')](),controller[_0x0568('0xd')]);router['get']('/:id/members',auth[_0x0568('0x8')](),controller[_0x0568('0xe')]);router[_0x0568('0x9')](_0x0568('0xf'),auth[_0x0568('0x8')](),controller['getMessages']);router[_0x0568('0x10')]('/',auth[_0x0568('0x8')](),controller[_0x0568('0x11')]);router[_0x0568('0x10')](_0x0568('0x12'),auth['isAuthenticated'](),controller[_0x0568('0x13')]);router[_0x0568('0x10')]('/:id/messages',auth['isAuthenticated'](),controller[_0x0568('0x14')]);router[_0x0568('0x15')](_0x0568('0xa'),auth[_0x0568('0x8')](),controller[_0x0568('0x16')]);router['delete'](_0x0568('0xa'),auth['isAuthenticated'](),controller[_0x0568('0x17')]);router[_0x0568('0x18')](_0x0568('0x12'),auth[_0x0568('0x8')](),controller[_0x0568('0x19')]);module[_0x0568('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 38ca233..8b3014f 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 _0xde88=['star','TEXT','STRING','DATE','BOOLEAN','sequelize','exports','INTEGER','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde88,0x11c));var _0x8de8=function(_0x124f88,_0x3ad501){_0x124f88=_0x124f88-0x0;var _0xed0e3b=_0xde88[_0x124f88];return _0xed0e3b;};'use strict';var Sequelize=require(_0x8de8('0x0'));module[_0x8de8('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8de8('0x2')]},'ratingType':{'type':Sequelize[_0x8de8('0x3')](_0x8de8('0x4'),'thumb'),'defaultValue':_0x8de8('0x4')},'ratingMessage':{'type':Sequelize[_0x8de8('0x5')]},'pathTranscript':{'type':Sequelize[_0x8de8('0x5')]},'mailTranscript':{'type':Sequelize[_0x8de8('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x8de8('0x7')]},'disposition':{'type':Sequelize[_0x8de8('0x6')]},'secondDisposition':{'type':Sequelize[_0x8de8('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8de8('0x6')]},'browserName':{'type':Sequelize[_0x8de8('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x8de8('0x6')]},'osVersion':{'type':Sequelize[_0x8de8('0x6')]},'deviceModel':{'type':Sequelize[_0x8de8('0x6')]},'deviceVendor':{'type':Sequelize[_0x8de8('0x6')]},'deviceType':{'type':Sequelize[_0x8de8('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x8de8('0x6')]},'formData':{'type':Sequelize[_0x8de8('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x8de8('0x7')]},'lastMsgAt':{'type':Sequelize[_0x8de8('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x8de8('0x6')]},'customerPort':{'type':Sequelize[_0x8de8('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x8de8('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x8de8('0x8')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x301f=['sequelize','exports','INTEGER','star','thumb','TEXT','STRING','DATE','long','ENUM','out','BOOLEAN'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x301f,0x114));var _0xf301=function(_0xfe9588,_0x46d540){_0xfe9588=_0xfe9588-0x0;var _0x518942=_0x301f[_0xfe9588];return _0x518942;};'use strict';var Sequelize=require(_0xf301('0x0'));module[_0xf301('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xf301('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0xf301('0x3'),_0xf301('0x4')),'defaultValue':_0xf301('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xf301('0x5')]},'mailTranscript':{'type':Sequelize[_0xf301('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xf301('0x7')]},'disposition':{'type':Sequelize[_0xf301('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xf301('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xf301('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xf301('0x6')]},'osVersion':{'type':Sequelize[_0xf301('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xf301('0x6')]},'deviceType':{'type':Sequelize[_0xf301('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xf301('0x6')]},'formData':{'type':Sequelize[_0xf301('0x5')](_0xf301('0x8'))},'read1stAt':{'type':Sequelize[_0xf301('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf301('0x9')]('in',_0xf301('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf301('0x6')]},'customerPort':{'type':Sequelize[_0xf301('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xf301('0xb')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf301('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 1ccc2da..639d460 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 _0xb877=['zip-dir','moment','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','limit','count','set','Content-Range','json','update','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','index','rawAttributes','type','getOptions','findAll','chat','user','show','params','keys','ChatInteraction','query','filters','intersection','attributes','fields','length','model','includeAll','include','options','find','create','describe','findOne','ChatWebsiteId','vidaooApiKey','vidaooMetadata','vidaooEscalation','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','parse','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','originalname','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','basename','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsite','UserId','%s%d','agentAlias','System','customer','Visitor','ContactId','agentIdentifier','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','ChatInteractionId','includeAgent','push','rows','addTags','setTags','spread','Tag','emit','chatInteractionTags:save','removeTags','toString','server','files','tmp','attachments','transcript-%d-%s.zip','lastName','read','Account','Owner','Chat','N.A.','createdAt','browserName','referer','customerIp','customerPort','tail','existsSync','pipe','firstName','value','renderFile','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf'];(function(_0x1c446a,_0x3b3ad2){var _0x899e24=function(_0x579843){while(--_0x579843){_0x1c446a['push'](_0x1c446a['shift']());}};_0x899e24(++_0x3b3ad2);}(_0xb877,0xd0));var _0x7b87=function(_0x5c5c80,_0x2bdf94){_0x5c5c80=_0x5c5c80-0x0;var _0x510675=_0xb877[_0x5c5c80];return _0x510675;};'use strict';var rimraf=require(_0x7b87('0x0'));var zipdir=require(_0x7b87('0x1'));var rp=require('request-promise');var moment=require(_0x7b87('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7b87('0x3'));var util=require(_0x7b87('0x4'));var path=require(_0x7b87('0x5'));var ejs=require(_0x7b87('0x6'));var fs=require('fs');var _=require(_0x7b87('0x7'));var Redis=require(_0x7b87('0x8'));var interaction=require(_0x7b87('0x9'));var qs=require(_0x7b87('0xa'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x7b87('0xb'));var config=require(_0x7b87('0xc'));var db=require(_0x7b87('0xd'))['db'];config[_0x7b87('0xe')]=_[_0x7b87('0xf')](config[_0x7b87('0xe')],{'host':_0x7b87('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b87('0xe')]));require(_0x7b87('0x11'))[_0x7b87('0x12')](socket);var jayson=require(_0x7b87('0x13'));var client=jayson[_0x7b87('0x14')][_0x7b87('0x15')]({'port':0x232b});var client9004=jayson[_0x7b87('0x14')][_0x7b87('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x4387be,_0x253da3,_0x1411e6,_0x241fc9){return new BPromise(function(_0x5ec48a,_0x43db07){var _0x551f03=_0x241fc9||client;return _0x551f03[_0x7b87('0x16')](_0x4387be,_0x1411e6)[_0x7b87('0x17')](function(_0xe4cbc9){logger[_0x7b87('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x253da3,_0x7b87('0x19'));logger[_0x7b87('0x1a')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x253da3,_0x7b87('0x19'),JSON[_0x7b87('0x1b')](_0xe4cbc9));if(_0xe4cbc9[_0x7b87('0x1c')]){if(_0xe4cbc9[_0x7b87('0x1c')][_0x7b87('0x1d')]===0x1f4){logger[_0x7b87('0x1c')](_0x7b87('0x1e'),_0x253da3,_0xe4cbc9['error']['message']);return _0x43db07(_0xe4cbc9['error'][_0x7b87('0x1f')]);}logger[_0x7b87('0x1c')](_0x7b87('0x1e'),_0x253da3,_0xe4cbc9[_0x7b87('0x1c')][_0x7b87('0x1f')]);return _0x5ec48a(_0xe4cbc9[_0x7b87('0x1c')][_0x7b87('0x1f')]);}else{logger[_0x7b87('0x18')](_0x7b87('0x1e'),_0x253da3,_0x7b87('0x19'));_0x5ec48a(_0xe4cbc9['result']['message']);}})[_0x7b87('0x20')](function(_0xd22f4b){logger[_0x7b87('0x1c')](_0x7b87('0x1e'),_0x253da3,_0xd22f4b);_0x43db07(_0xd22f4b);});});}function respondWithStatusCode(_0x5cfdbc,_0x1ce1b5){_0x1ce1b5=_0x1ce1b5||0xcc;return function(_0x1d9eee){if(_0x1d9eee){return _0x5cfdbc[_0x7b87('0x21')](_0x1ce1b5);}return _0x5cfdbc[_0x7b87('0x22')](_0x1ce1b5)[_0x7b87('0x23')]();};}function respondWithResult(_0x534c9c,_0x10dabe){_0x10dabe=_0x10dabe||0xc8;return function(_0x3bcdad){if(_0x3bcdad){return _0x534c9c[_0x7b87('0x22')](_0x10dabe)['json'](_0x3bcdad);}};}function respondWithFilteredResult(_0x2b5a1c,_0x572d2f){return function(_0x46ecaa){if(_0x46ecaa){var _0x4bfbde=typeof _0x572d2f[_0x7b87('0x24')]==='undefined'&&typeof _0x572d2f[_0x7b87('0x25')]==='undefined';var _0x1accab=_0x46ecaa[_0x7b87('0x26')];var _0x3f3716=_0x4bfbde?0x0:_0x572d2f['offset'];var _0x676be2=_0x4bfbde?_0x46ecaa[_0x7b87('0x26')]:_0x572d2f[_0x7b87('0x24')]+_0x572d2f[_0x7b87('0x25')];var _0x4a9af3;if(_0x676be2>=_0x1accab){_0x676be2=_0x1accab;_0x4a9af3=0xc8;}else{_0x4a9af3=0xce;}_0x2b5a1c['status'](_0x4a9af3);return _0x2b5a1c[_0x7b87('0x27')](_0x7b87('0x28'),_0x3f3716+'-'+_0x676be2+'/'+_0x1accab)[_0x7b87('0x29')](_0x46ecaa);}return null;};}function saveUpdates(_0x209cda){return function(_0x311c2){if(_0x311c2){return _0x311c2[_0x7b87('0x2a')](_0x209cda)[_0x7b87('0x17')](function(_0x5e8592){return _0x5e8592;});}return null;};}function removeEntity(_0x383b21){return function(_0xd525e0){if(_0xd525e0){return _0xd525e0[_0x7b87('0x2b')]()[_0x7b87('0x17')](function(){_0x383b21['status'](0xcc)[_0x7b87('0x23')]();});}};}function handleEntityNotFound(_0x456dfb){return function(_0x36072c){if(!_0x36072c){_0x456dfb['sendStatus'](0x194);}return _0x36072c;};}function handleError(_0x5cd55a,_0x465ef4){_0x465ef4=_0x465ef4||0x1f4;return function(_0x69310e){logger[_0x7b87('0x1c')](_0x69310e[_0x7b87('0x2c')]);if(_0x69310e[_0x7b87('0x2d')]){delete _0x69310e[_0x7b87('0x2d')];}_0x5cd55a[_0x7b87('0x22')](_0x465ef4)[_0x7b87('0x2e')](_0x69310e);};}function getMustacheRender(_0x528f93,_0x1c777b){return Mustache[_0x7b87('0x2f')](_0x528f93,_[_0x7b87('0x30')](_0x1c777b[_0x7b87('0x31')],{'contact':_0x1c777b[_0x7b87('0x32')],'message':_0x1c777b[_0x7b87('0x1f')],'agent':_0x1c777b[_0x7b87('0x33')],'interaction':_0x1c777b[_0x7b87('0x34')],'account':_0x1c777b[_0x7b87('0x35')]}))||'';}exports[_0x7b87('0x36')]=function(_0x37ce05,_0x3d03fb){var _0x41cedb={};var _0x33861c=_['map'](db['ChatInteraction'][_0x7b87('0x37')],function(_0xd29bf6){return{'name':_0xd29bf6['fieldName'],'type':_0xd29bf6[_0x7b87('0x38')]['key']};});_0x41cedb=qs[_0x7b87('0x39')](_0x33861c,_0x37ce05);return interaction[_0x7b87('0x3a')](_0x7b87('0x3b'),_0x37ce05['query'],_0x37ce05[_0x7b87('0x3c')],_0x41cedb,_0x33861c)['then'](respondWithFilteredResult(_0x3d03fb,_0x41cedb))[_0x7b87('0x20')](handleError(_0x3d03fb,null));};exports[_0x7b87('0x3d')]=function(_0x4a9ca4,_0x14e7e9){var _0x48f463={'raw':![],'where':{'id':_0x4a9ca4[_0x7b87('0x3e')]['id']}},_0x382295={};_0x382295['model']=_[_0x7b87('0x3f')](db[_0x7b87('0x40')][_0x7b87('0x37')]);_0x382295[_0x7b87('0x41')]=_['keys'](_0x4a9ca4[_0x7b87('0x41')]);_0x382295[_0x7b87('0x42')]=_[_0x7b87('0x43')](_0x382295['model'],_0x382295[_0x7b87('0x41')]);_0x48f463[_0x7b87('0x44')]=_[_0x7b87('0x43')](_0x382295['model'],qs[_0x7b87('0x45')](_0x4a9ca4[_0x7b87('0x41')][_0x7b87('0x45')]));_0x48f463[_0x7b87('0x44')]=_0x48f463[_0x7b87('0x44')][_0x7b87('0x46')]?_0x48f463[_0x7b87('0x44')]:_0x382295[_0x7b87('0x47')];if(_0x4a9ca4[_0x7b87('0x41')][_0x7b87('0x48')]){_0x48f463[_0x7b87('0x49')]=[{'all':!![]}];}_0x48f463=_[_0x7b87('0x30')]({},_0x48f463,_0x4a9ca4[_0x7b87('0x4a')]);return db['ChatInteraction'][_0x7b87('0x4b')](_0x48f463)[_0x7b87('0x17')](handleEntityNotFound(_0x14e7e9,null))[_0x7b87('0x17')](respondWithResult(_0x14e7e9,null))['catch'](handleError(_0x14e7e9,null));};exports[_0x7b87('0x4c')]=function(_0x246275,_0x495e14){return db[_0x7b87('0x40')][_0x7b87('0x4c')](_0x246275[_0x7b87('0x31')],{})[_0x7b87('0x17')](respondWithResult(_0x495e14,0xc9))[_0x7b87('0x20')](handleError(_0x495e14,null));};exports['update']=function(_0x453de0,_0x2b5b88){if(_0x453de0[_0x7b87('0x31')]['id']){delete _0x453de0['body']['id'];}return db['ChatInteraction'][_0x7b87('0x4b')]({'where':{'id':_0x453de0[_0x7b87('0x3e')]['id']}})[_0x7b87('0x17')](handleEntityNotFound(_0x2b5b88,null))[_0x7b87('0x17')](saveUpdates(_0x453de0[_0x7b87('0x31')],null))[_0x7b87('0x17')](respondWithResult(_0x2b5b88,null))[_0x7b87('0x20')](handleError(_0x2b5b88,null));};exports[_0x7b87('0x2b')]=function(_0x128ada,_0x4d71ca){return db[_0x7b87('0x40')]['find']({'where':{'id':_0x128ada[_0x7b87('0x3e')]['id']}})[_0x7b87('0x17')](handleEntityNotFound(_0x4d71ca,null))['then'](removeEntity(_0x4d71ca,null))[_0x7b87('0x20')](handleError(_0x4d71ca,null));};exports[_0x7b87('0x4d')]=function(_0x3a86a6,_0x2d837b){return db[_0x7b87('0x40')][_0x7b87('0x4d')]()[_0x7b87('0x17')](respondWithResult(_0x2d837b,null))[_0x7b87('0x20')](handleError(_0x2d837b,null));};exports['createVidaooSession']=function(_0xfae69e,_0x11f602){var _0x33a3a7=_0xfae69e[_0x7b87('0x3e')]['id'];var _0x3811ae;var _0x2af130;var _0x1cfe99;return db[_0x7b87('0x40')][_0x7b87('0x4e')]({'where':{'id':_0x33a3a7}})['then'](function(_0x9e9007){_0x3811ae=_0x9e9007;return db['ChatWebsite'][_0x7b87('0x4e')]({'where':{'id':_0x9e9007[_0x7b87('0x4f')]},'attributes':['id',_0x7b87('0x50'),'vidaooEscalation','vidaooTopic','vidaooNote',_0x7b87('0x51')],'raw':!![]});})[_0x7b87('0x17')](function(_0x27a219){if(_0x27a219&&_0x27a219['vidaooApiKey']&&_0x27a219[_0x7b87('0x52')]){_0x2af130=_0x27a219;var _0x46be50={'interaction':{'id':_0x33a3a7},'agent':{'id':_0xfae69e[_0x7b87('0x3c')]['id'],'name':_0xfae69e[_0x7b87('0x3c')][_0x7b87('0x2d')],'fullname':_0xfae69e[_0x7b87('0x3c')][_0x7b87('0x53')],'email':_0xfae69e[_0x7b87('0x3c')][_0x7b87('0x54')]},'contact':_0xfae69e[_0x7b87('0x31')]['contact'],'account':_0xfae69e[_0x7b87('0x31')][_0x7b87('0x35')]};var _0x39469a={'rejectUnauthorized':![],'method':_0x7b87('0x55'),'url':_0x7b87('0x56'),'headers':{'X-APIKEY':_0x27a219[_0x7b87('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xfae69e[_0x7b87('0x3c')][_0x7b87('0x54')]],'buttons':null,'topic':_0x2af130['vidaooTopic'],'note':_[_0x7b87('0x57')](_0x2af130['vidaooNote'])?null:getMustacheRender(_0x2af130[_0x7b87('0x58')],_0x46be50),'metadata':null},'redirect':_0x7b87('0x59'),'json':!![]};try{if(!_[_0x7b87('0x57')](_0x2af130[_0x7b87('0x51')])){var _0x490219=getMustacheRender(_0x2af130['vidaooMetadata'],_0x46be50);var _0x21e353=JSON[_0x7b87('0x5a')](_0x490219);_0x39469a[_0x7b87('0x31')]['metadata']=_0x21e353;}}catch(_0x328291){throw new db[(_0x7b87('0x5b'))][(_0x7b87('0x5c'))](_0x7b87('0x5d'));}return rp(_0x39469a);}else{throw new db[(_0x7b87('0x5b'))]['ValidationError'](_0x7b87('0x5e'));}})[_0x7b87('0x17')](function(_0x33a9c0){_0x1cfe99=_0x33a9c0;if(_0x1cfe99['id']){var _0x35090d={'body':_0x1cfe99[_0x7b87('0x5f')],'ChatWebsiteId':_0x2af130['id'],'ChatInteractionId':_0x3811ae['id'],'direction':_0x7b87('0x60'),'UserId':_0xfae69e[_0x7b87('0x3c')]['id']};return db[_0x7b87('0x61')][_0x7b87('0x4c')](_0x35090d,{});}else{throw new db[(_0x7b87('0x5b'))][(_0x7b87('0x5c'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x3811ae[_0x7b87('0x62')]({'vidaooSessionId':_0x1cfe99['id']});})[_0x7b87('0x17')](respondWithResult(_0x11f602,null))['catch'](handleError(_0x11f602,null));};exports[_0x7b87('0x63')]=function(_0x4f9a1c,_0x1bb172){if(_0x4f9a1c[_0x7b87('0x31')]['id']){delete _0x4f9a1c[_0x7b87('0x31')]['id'];}return db[_0x7b87('0x40')][_0x7b87('0x4b')]({'where':{'id':_0x4f9a1c[_0x7b87('0x3e')]['id']},'include':[{'model':db[_0x7b87('0x64')],'as':_0x7b87('0x65')}]})['then'](handleEntityNotFound(_0x1bb172,null))['then'](saveUpdates(_0x4f9a1c[_0x7b87('0x31')],null))[_0x7b87('0x17')](respondWithResult(_0x1bb172,null))[_0x7b87('0x20')](handleError(_0x1bb172,null));};exports[_0x7b87('0x66')]=function(_0x1b434d,_0x187eff){if(_0x1b434d['body']['id']){delete _0x1b434d['body']['id'];}return db[_0x7b87('0x40')][_0x7b87('0x4b')]({'where':{'id':_0x1b434d['params']['id']}})['then'](function(_0x12b4cf){if(!_0x12b4cf){logger[_0x7b87('0x1c')](_0x7b87('0x67'),_0x7b87('0x66'),0x194,'entity\x20not\x20found');_0x187eff['sendStatus'](0x194);}else{if(_0x12b4cf['UserId']){throw new db[(_0x7b87('0x5b'))][(_0x7b87('0x5c'))](_0x7b87('0x68'));}}return _0x12b4cf;})[_0x7b87('0x17')](function(_0x79868c){if(_0x79868c){return _0x79868c[_0x7b87('0x2a')]({'closed':_0x1b434d[_0x7b87('0x31')][_0x7b87('0x69')],'disposition':_0x1b434d['body']['disposition']})[_0x7b87('0x17')](function(_0x22716d){return _0x22716d;});}})[_0x7b87('0x17')](function(){return respondWithRpcPromise(_0x7b87('0x6a'),_0x7b87('0x66'),_0x1b434d[_0x7b87('0x31')],client9004);})[_0x7b87('0x17')](respondWithResult(_0x187eff,null))[_0x7b87('0x20')](handleError(_0x187eff,null));};exports[_0x7b87('0x6b')]=function(_0x2bc5d1,_0xd61e8a){_0x2bc5d1['body'][_0x7b87('0x2d')]=_0x2bc5d1[_0x7b87('0x6c')][_0x7b87('0x6d')];_0x2bc5d1[_0x7b87('0x31')]['basename']=_0x2bc5d1[_0x7b87('0x6c')][_0x7b87('0x6e')];_0x2bc5d1[_0x7b87('0x31')][_0x7b87('0x38')]=_0x2bc5d1['file'][_0x7b87('0x6f')];return db[_0x7b87('0x70')][_0x7b87('0x4c')](_0x2bc5d1[_0x7b87('0x31')])[_0x7b87('0x17')](respondWithResult(_0xd61e8a,0xc9))[_0x7b87('0x20')](handleError(_0xd61e8a,null));};exports[_0x7b87('0x71')]=function(_0x1bdcfb,_0x5e9a84){return db[_0x7b87('0x40')][_0x7b87('0x4e')]({'where':{'id':_0x1bdcfb[_0x7b87('0x3e')]['id']},'raw':!![]})[_0x7b87('0x17')](handleEntityNotFound(_0x5e9a84,null))['then'](function(_0x586e11){if(_0x586e11){if(_0x586e11[_0x7b87('0x69')]){return _0x5e9a84[_0x7b87('0x22')](0x193)[_0x7b87('0x29')]({'status':0x193,'message':_0x7b87('0x72')});}return db[_0x7b87('0x70')][_0x7b87('0x4e')]({'where':{'id':_0x1bdcfb[_0x7b87('0x41')][_0x7b87('0x73')]},'raw':!![]})[_0x7b87('0x17')](handleEntityNotFound(_0x5e9a84,null));}})[_0x7b87('0x17')](function(_0x3a9d29){if(_0x3a9d29){var _0xea4e2c=_0x3a9d29[_0x7b87('0x74')]!==null;var _0x4ddcce=path[_0x7b87('0x75')](config[_0x7b87('0x76')],'server/files/attachments/');if(_0xea4e2c){_0x4ddcce=path[_0x7b87('0x75')](_0x4ddcce,'offline-chat/');}var _0x1c0329=path[_0x7b87('0x75')](_0x4ddcce,_0x3a9d29[_0x7b87('0x77')]);return _0x5e9a84[_0x7b87('0x78')](_0x1c0329);}})[_0x7b87('0x20')](handleError(_0x5e9a84,null));};exports[_0x7b87('0x79')]=function(_0x154298,_0x38b311){var _0x16e50c=null;var _0x424773=null;var _0x217631=null;if(_0x154298['body']['id']){delete _0x154298[_0x7b87('0x31')]['id'];}if(_0x154298['body'][_0x7b87('0x7a')]){_0x217631=path['join'](config[_0x7b87('0x76')],_0x7b87('0x7b'),util[_0x7b87('0x7c')](_0x7b87('0x7d'),Date[_0x7b87('0x7e')]()));_0x154298[_0x7b87('0x31')][_0x7b87('0x7f')]=_0x217631;}return db[_0x7b87('0x40')][_0x7b87('0x4b')]({'where':{'id':_0x154298[_0x7b87('0x3e')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x7b87('0x80'),'include':[{'model':db['User'],'as':_0x7b87('0x81')}]}]})[_0x7b87('0x17')](handleEntityNotFound(_0x38b311,null))['then'](saveUpdates(_0x154298[_0x7b87('0x31')],null))['then'](function(_0x2fcfca){if(_0x2fcfca){_0x16e50c=_0x2fcfca;return db[_0x7b87('0x82')][_0x7b87('0x4b')]({'where':{'id':_0x16e50c[_0x7b87('0x4f')]}});}})[_0x7b87('0x17')](function(_0x59060f){if(_0x59060f){_0x424773=_0x59060f;return db[_0x7b87('0x64')]['find']({'where':{'id':_0x16e50c['ContactId']}});}})[_0x7b87('0x17')](function(_0x19033a){if(_0x19033a){if(_0x217631){var _0x38d828=null;for(var _0x4cfe04=0x1;_0x4cfe04<_0x16e50c['Messages'][_0x7b87('0x46')];++_0x4cfe04){_0x38d828=_0x16e50c[_0x7b87('0x80')][_0x4cfe04];var _0x223ba6=_0x38d828[_0x7b87('0x83')]?util[_0x7b87('0x7c')](_0x7b87('0x84'),_0x424773[_0x7b87('0x85')],_0x38d828['UserId']):_0x7b87('0x86');var _0x5360de=_0x154298[_0x7b87('0x31')][_0x7b87('0x87')]||util['format'](_0x7b87('0x84'),_0x7b87('0x88'),_0x38d828[_0x7b87('0x89')]);switch(_0x424773[_0x7b87('0x8a')]){case _0x7b87('0x8b'):_0x223ba6=_0x38d828['UserId']?util[_0x7b87('0x7c')](_0x7b87('0x84'),_0x424773['agentAlias'],_0x38d828[_0x7b87('0x83')]):_0x7b87('0x86');break;case'agent_alias':_0x223ba6=_0x38d828[_0x7b87('0x83')]?_0x38d828[_0x7b87('0x81')][_0x7b87('0x8c')]||_0x38d828[_0x7b87('0x81')][_0x7b87('0x53')]:_0x7b87('0x86');break;case _0x7b87('0x8d'):_0x223ba6=_0x38d828[_0x7b87('0x83')]?_0x38d828['User']['fullname']:'System';break;default:_0x223ba6=_0x38d828[_0x7b87('0x83')]?util['format'](_0x7b87('0x84'),_0x424773[_0x7b87('0x85')],_0x38d828[_0x7b87('0x83')]):_0x7b87('0x86');}var _0x4fd334=util[_0x7b87('0x7c')](_0x7b87('0x8e'),moment(_0x38d828['createdAt'])[_0x7b87('0x7c')](_0x7b87('0x8f')),_0x38d828[_0x7b87('0x90')]==='in'?_0x5360de:_0x223ba6,_0x38d828[_0x7b87('0x31')]);if(!_0x38d828[_0x7b87('0x91')]){fs[_0x7b87('0x92')](_0x217631,_0x4fd334);}}return db[_0x7b87('0x93')][_0x7b87('0x4e')]({'where':{'service':!![]},'include':[{'model':db[_0x7b87('0x94')],'as':_0x7b87('0x95'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x7b87('0x96'),'raw':!![]}]}]});}}})['then'](function(_0x425c11){if(!_0x425c11||!_0x425c11['Smtp']||!_0x154298[_0x7b87('0x31')])return _0x16e50c;var _0x10e434=_0x425c11['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x7b87('0x97'),{'account':_0x10e434,'message':{'from':util[_0x7b87('0x7c')](_0x7b87('0x98'),_0x425c11[_0x7b87('0x2d')],_0x425c11[_0x7b87('0x54')]||_0x425c11['Smtp'][_0x7b87('0x3c')]),'to':_0x154298['body'][_0x7b87('0x7a')],'subject':_0x7b87('0x99'),'text':util[_0x7b87('0x7c')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x154298['body'][_0x7b87('0x7a')]),'attachments':[{'path':_0x217631}]}})['then'](function(){return _0x16e50c;})[_0x7b87('0x20')](function(_0x5415a6){logger[_0x7b87('0x1c')](_0x5415a6);});})['then'](respondWithStatusCode(_0x38b311,0xc8))[_0x7b87('0x20')](handleError(_0x38b311,null));};exports[_0x7b87('0x9a')]=function(_0x41a67b,_0x3af709){return db[_0x7b87('0x61')][_0x7b87('0x4b')]({'where':{'id':_0x41a67b[_0x7b87('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3af709,null))['then'](function(_0x549866){if(_0x549866){return _0x549866[_0x7b87('0x9a')](_0x41a67b[_0x7b87('0x31')][_0x7b87('0x9b')],_[_0x7b87('0x9c')](_0x41a67b['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x3af709,null))[_0x7b87('0x20')](handleError(_0x3af709,null));};exports[_0x7b87('0x9d')]=function(_0x2f499e,_0x5ef0bd){var _0x1324e2={'raw':![],'where':{}};var _0x12c69c={};var _0x14f7d7={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x7b87('0x4e')]({'where':{'id':_0x2f499e[_0x7b87('0x3e')]['id']}})[_0x7b87('0x17')](handleEntityNotFound(_0x5ef0bd,null))[_0x7b87('0x17')](function(_0x4850ae){if(_0x4850ae){_0x12c69c['model']=_['keys'](db[_0x7b87('0x61')][_0x7b87('0x37')]);_0x12c69c[_0x7b87('0x41')]=_['keys'](_0x2f499e['query']);_0x12c69c[_0x7b87('0x42')]=_[_0x7b87('0x43')](_0x12c69c[_0x7b87('0x47')],_0x12c69c[_0x7b87('0x41')]);_0x1324e2['attributes']=_[_0x7b87('0x43')](_0x12c69c['model'],qs[_0x7b87('0x45')](_0x2f499e[_0x7b87('0x41')][_0x7b87('0x45')]));_0x1324e2[_0x7b87('0x44')]=_0x1324e2[_0x7b87('0x44')][_0x7b87('0x46')]?_0x1324e2[_0x7b87('0x44')]:_0x12c69c[_0x7b87('0x47')];if(!_0x2f499e['query'][_0x7b87('0x9e')](_0x7b87('0x9f'))){_0x1324e2[_0x7b87('0x25')]=qs[_0x7b87('0x25')](_0x2f499e[_0x7b87('0x41')][_0x7b87('0x25')]);_0x1324e2['offset']=qs[_0x7b87('0x24')](_0x2f499e[_0x7b87('0x41')][_0x7b87('0x24')]);}_0x1324e2[_0x7b87('0xa0')]=qs['sort'](_0x2f499e['query'][_0x7b87('0xa1')]);_0x1324e2[_0x7b87('0xa2')]=qs[_0x7b87('0x42')](_[_0x7b87('0xa3')](_0x2f499e['query'],_0x12c69c[_0x7b87('0x42')]));_0x1324e2[_0x7b87('0xa2')]['ChatInteractionId']=_0x4850ae['id'];if(_0x2f499e[_0x7b87('0x41')][_0x7b87('0xa4')]){_0x1324e2[_0x7b87('0xa2')]=_[_0x7b87('0x30')](_0x1324e2[_0x7b87('0xa2')],{'$or':_[_0x7b87('0xa5')](_0x1324e2[_0x7b87('0x44')],function(_0x5f34bf){var _0x435ef5={};_0x435ef5[_0x5f34bf]={'$like':'%'+_0x2f499e[_0x7b87('0x41')][_0x7b87('0xa4')]+'%'};return _0x435ef5;})});}if(_0x2f499e[_0x7b87('0x41')][_0x7b87('0xa6')]){var _0xdd6378=_0x2f499e[_0x7b87('0x41')][_0x7b87('0xa6')][_0x7b87('0xa7')](',');var _0xbb503d={};_0xbb503d[_0xdd6378[0x0]]={'$gte':moment(_0xdd6378[0x1])[_0x7b87('0x7c')](_0x7b87('0xa8'))};_0x1324e2[_0x7b87('0xa2')]=_[_0x7b87('0x30')](_0x1324e2[_0x7b87('0xa2')],_0xbb503d);}_0x1324e2=_['merge']({},_0x1324e2,_0x2f499e['options']);return db[_0x7b87('0x61')][_0x7b87('0x26')]({'where':_0x1324e2[_0x7b87('0xa2')]})[_0x7b87('0x17')](function(_0x32bc80){_0x14f7d7[_0x7b87('0x26')]=_0x32bc80;if(_0x2f499e['query'][_0x7b87('0x48')]){_0x1324e2['include']=[{'all':!![]}];}return db[_0x7b87('0x61')][_0x7b87('0x3a')](_0x1324e2);})[_0x7b87('0x17')](function(_0x4f6256){_0x14f7d7['rows']=_0x4f6256;return _0x14f7d7;});}})[_0x7b87('0x17')](respondWithFilteredResult(_0x5ef0bd,_0x1324e2))[_0x7b87('0x20')](handleError(_0x5ef0bd,null));};exports[_0x7b87('0xa9')]=function(_0x528006,_0x5a5369){var _0x250451={'where':{}},_0x5b101b={},_0x5171d5={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x7b87('0x4e')]({'where':{'id':_0x528006[_0x7b87('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5a5369,null))[_0x7b87('0x17')](function(_0x416e0d){if(_0x416e0d){_0x5b101b[_0x7b87('0x47')]=_[_0x7b87('0x3f')](db[_0x7b87('0x61')][_0x7b87('0x37')]);_0x5b101b[_0x7b87('0x41')]=_['keys'](_0x528006[_0x7b87('0x41')]);_0x5b101b[_0x7b87('0x42')]=_[_0x7b87('0x43')](_0x5b101b['model'],_0x5b101b[_0x7b87('0x41')]);_0x250451[_0x7b87('0x44')]=_[_0x7b87('0x43')](_0x5b101b[_0x7b87('0x47')],qs[_0x7b87('0x45')](_0x528006['query'][_0x7b87('0x45')]));_0x250451['attributes']=_0x250451['attributes'][_0x7b87('0x46')]?_0x250451[_0x7b87('0x44')]:_0x5b101b[_0x7b87('0x47')];if(!_0x528006['query'][_0x7b87('0x9e')]('nolimit')){_0x250451[_0x7b87('0x25')]=qs[_0x7b87('0x25')](_0x528006[_0x7b87('0x41')]['limit']);_0x250451[_0x7b87('0x24')]=qs[_0x7b87('0x24')](_0x528006[_0x7b87('0x41')][_0x7b87('0x24')]);}_0x250451[_0x7b87('0xa0')]=qs['sort'](_0x528006['query'][_0x7b87('0xa1')]);_0x250451['where']=qs[_0x7b87('0x42')](_[_0x7b87('0xa3')](_0x528006[_0x7b87('0x41')],_0x5b101b[_0x7b87('0x42')]));_0x250451[_0x7b87('0xa2')][_0x7b87('0xaa')]=_0x416e0d['id'];if(_0x528006[_0x7b87('0x41')][_0x7b87('0xa4')]){_0x250451[_0x7b87('0xa2')]=_['merge'](_0x250451[_0x7b87('0xa2')],{'$or':_[_0x7b87('0xa5')](_0x250451['attributes'],function(_0x285b32){var _0xadb483={};_0xadb483[_0x285b32]={'$like':'%'+_0x528006[_0x7b87('0x41')][_0x7b87('0xa4')]+'%'};return _0xadb483;})});}_0x250451[_0x7b87('0xa2')][_0x7b87('0x91')]=![];if(_0x528006[_0x7b87('0x41')]['id']){_0x250451['where']['id']={'$gt':_0x528006['query']['id']};}_0x250451=_[_0x7b87('0x30')]({},_0x250451,_0x528006[_0x7b87('0x4a')]);return db['ChatMessage'][_0x7b87('0x26')]({'where':_0x250451[_0x7b87('0xa2')]})[_0x7b87('0x17')](function(_0x339075){_0x5171d5[_0x7b87('0x26')]=_0x339075;_0x250451[_0x7b87('0x49')]=[];if(_0x528006[_0x7b87('0x41')][_0x7b87('0xab')]){_0x250451[_0x7b87('0x49')][_0x7b87('0xac')]({'model':db[_0x7b87('0x81')],'as':'User','attributes':['id','fullname',_0x7b87('0x8c')]});}if(_0x528006[_0x7b87('0x41')][_0x7b87('0x48')]){_0x250451[_0x7b87('0x49')]=[{'all':!![]}];}return db[_0x7b87('0x61')][_0x7b87('0x3a')](_0x250451);})[_0x7b87('0x17')](function(_0x46aefb){_0x5171d5[_0x7b87('0xad')]=_0x46aefb;return _0x5171d5;});}})[_0x7b87('0x17')](respondWithFilteredResult(_0x5a5369,_0x250451))[_0x7b87('0x20')](handleError(_0x5a5369,null));};exports[_0x7b87('0xae')]=function(_0xfbca14,_0x3221c8){return db[_0x7b87('0x40')][_0x7b87('0x4b')]({'where':{'id':_0xfbca14[_0x7b87('0x3e')]['id']}})[_0x7b87('0x17')](handleEntityNotFound(_0x3221c8,null))['then'](function(_0x26c7b3){if(_0x26c7b3){return _0x26c7b3[_0x7b87('0xaf')](_0xfbca14[_0x7b87('0x31')]['ids'],_[_0x7b87('0x9c')](_0xfbca14[_0x7b87('0x31')],[_0x7b87('0x9b'),'id'])||{})[_0x7b87('0xb0')](function(){return db[_0x7b87('0xb1')][_0x7b87('0x3a')]({'attributes':['id',_0x7b87('0x2d'),'color'],'where':{'id':_0xfbca14[_0x7b87('0x31')][_0x7b87('0x9b')]}});})[_0x7b87('0x17')](function(_0x24283f){socket[_0x7b87('0xb2')](_0x7b87('0xb3'),{'id':Number(_0xfbca14[_0x7b87('0x3e')]['id']),'tags':_0x24283f||[]});return{'id':Number(_0xfbca14[_0x7b87('0x3e')]['id']),'tags':_0x24283f||[]};});}})[_0x7b87('0x17')](respondWithResult(_0x3221c8,null))[_0x7b87('0x20')](handleError(_0x3221c8,null));};exports[_0x7b87('0xb4')]=function(_0x5877ba,_0x50cfe3){return db[_0x7b87('0x40')][_0x7b87('0x4b')]({'where':{'id':_0x5877ba[_0x7b87('0x3e')]['id']}})[_0x7b87('0x17')](handleEntityNotFound(_0x50cfe3,null))[_0x7b87('0x17')](function(_0x239527){if(_0x239527){return _0x239527[_0x7b87('0xb4')](_0x5877ba[_0x7b87('0x41')]['ids']);}})[_0x7b87('0x17')](respondWithStatusCode(_0x50cfe3,null))[_0x7b87('0x20')](handleError(_0x50cfe3,null));};exports[_0x7b87('0x78')]=function(_0x2c1bc3,_0x51e4d1){var _0x5ec6be=moment()['unix']()[_0x7b87('0xb5')]();var _0x21887f=path[_0x7b87('0x75')](config[_0x7b87('0x76')],_0x7b87('0xb6'),_0x7b87('0xb7'),_0x7b87('0xb8'));var _0x3fefad=path[_0x7b87('0x75')](config['root'],'server',_0x7b87('0xb7'),_0x7b87('0xb9'));var _0x8ef9ed=path[_0x7b87('0x75')](_0x21887f,_0x5ec6be);var _0x2ba41c=util[_0x7b87('0x7c')](_0x7b87('0xba'),_0x2c1bc3[_0x7b87('0x3e')]['id'],_0x5ec6be);var _0x1c4457=path[_0x7b87('0x75')](_0x21887f,_0x2ba41c);var _0x32ef2e=[];_0x32ef2e['push']({'model':db[_0x7b87('0x81')],'as':_0x7b87('0x81'),'attributes':['id','fullname'],'raw':!![]});_0x32ef2e[_0x7b87('0xac')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0x7b87('0xbb')],'raw':!![]});if(_0x2c1bc3[_0x7b87('0x41')]['attachments']){_0x32ef2e[_0x7b87('0xac')]({'model':db[_0x7b87('0x70')],'as':'Attachment','raw':!![]});}var _0x2fa140=[{'model':db[_0x7b87('0x61')],'as':'Messages','attributes':['id',_0x7b87('0x31'),'createdAt',_0x7b87('0x90'),_0x7b87('0x91'),_0x7b87('0xbc')],'include':_0x32ef2e}];_0x2fa140[_0x7b87('0xac')]({'model':db['ChatWebsite'],'as':_0x7b87('0xbd'),'attributes':['id','name']});_0x2fa140[_0x7b87('0xac')]({'model':db[_0x7b87('0x81')],'as':_0x7b87('0xbe'),'attributes':['id',_0x7b87('0x53')]});return db[_0x7b87('0x40')][_0x7b87('0x4b')]({'where':{'id':_0x2c1bc3[_0x7b87('0x3e')]['id']},'include':_0x2fa140})[_0x7b87('0x17')](handleEntityNotFound(_0x51e4d1,null))['then'](function(_0x330bfd){if(_0x330bfd){var _0x57f9d2=_0x330bfd['get']({'plain':!![]});fs['mkdirSync'](_0x8ef9ed);var _0xc6ff09={'channel':_0x7b87('0xbf'),'account':_0x57f9d2[_0x7b87('0xbd')][_0x7b87('0x2d')],'agent':_0x57f9d2[_0x7b87('0xbe')]?_0x57f9d2['Owner']['fullname']:_0x7b87('0xc0'),'createdAt':moment(_0x57f9d2[_0x7b87('0xc1')])[_0x7b87('0x7c')](_0x7b87('0xa8'))[_0x7b87('0xb5')](),'closedAt':_0x57f9d2['closed']?moment(_0x57f9d2['closedAt'])[_0x7b87('0x7c')](_0x7b87('0xa8'))[_0x7b87('0xb5')]():'','disposition':_0x57f9d2['disposition'],'chatInfo':{'browser':_0x57f9d2[_0x7b87('0xc2')],'os':_0x57f9d2['osName'],'referer':_0x57f9d2[_0x7b87('0xc3')],'customerIp':_0x57f9d2[_0x7b87('0xc4')],'customerPort':_0x57f9d2[_0x7b87('0xc5')]?_0x57f9d2[_0x7b87('0xc5')]:_0x7b87('0xc0')},'messages':_(_0x57f9d2[_0x7b87('0x80')])[_0x7b87('0xc6')]()[_0x7b87('0xa4')]({'secret':![]})[_0x7b87('0xa5')](function(_0x5debfe){if(_0x5debfe[_0x7b87('0x70')]){var _0x19b982=path[_0x7b87('0x75')](_0x3fefad,_0x5debfe[_0x7b87('0x70')]['basename']);if(fs[_0x7b87('0xc7')](_0x19b982)){fs['createReadStream'](_0x19b982)[_0x7b87('0xc8')](fs['createWriteStream'](path[_0x7b87('0x75')](_0x8ef9ed,_0x5debfe[_0x7b87('0x70')][_0x7b87('0x77')])));}}return{'date':moment(_0x5debfe['createdAt'])[_0x7b87('0x7c')](_0x7b87('0xa8'))[_0x7b87('0xb5')](),'sender':_0x5debfe[_0x7b87('0x90')]===_0x7b87('0x60')?_0x5debfe[_0x7b87('0x81')]?_0x5debfe[_0x7b87('0x81')][_0x7b87('0x53')]:'System':_0x5debfe[_0x7b87('0x65')][_0x7b87('0xc9')]+(_0x5debfe[_0x7b87('0x65')][_0x7b87('0xbb')]?'\x20'+_0x5debfe[_0x7b87('0x65')]['lastName']:''),'body':_0x5debfe['Attachment']?_0x5debfe[_0x7b87('0x70')][_0x7b87('0x77')]:_0x5debfe[_0x7b87('0x31')],'direction':_0x5debfe[_0x7b87('0x90')]==='out'?'A':'C','secret':_0x5debfe[_0x7b87('0x91')],'read':_0x5debfe[_0x7b87('0xbc')],'attachment':_0x5debfe['Attachment']};})[_0x7b87('0xca')]()};return ejs[_0x7b87('0xcb')](path[_0x7b87('0x75')](config[_0x7b87('0x76')],_0x7b87('0xb6'),'views','downloadInteraction.ejs'),{'interaction':_0xc6ff09})[_0x7b87('0x17')](function(_0x5ab2e7){var _0x4a93d4=path[_0x7b87('0x75')](_0x8ef9ed,_0x7b87('0xcc')+_0x57f9d2['id']+'-'+_0x5ec6be+_0x7b87('0xcd'));var _0x4290a9={'path':_0x4a93d4,'channel':_0x7b87('0xbf'),'interactionId':_0x57f9d2['id']};return pdf[_0x7b87('0xce')](_0x5ab2e7,_0x4290a9);})[_0x7b87('0x17')](function(){return new Promise(function(_0x32c190,_0x256b09){zipdir(_0x8ef9ed,{'saveTo':_0x1c4457},function(_0x41eaf1,_0x184ec0){if(_0x41eaf1)return _0x256b09(_0x41eaf1);return _0x32c190(_0x184ec0);});})[_0x7b87('0x17')](function(){return new BPromise(function(_0x1749b0,_0x9949d3){rimraf(_0x8ef9ed,function(_0x46d0bc){if(_0x46d0bc)_0x9949d3(_0x46d0bc);return _0x1749b0();});});})[_0x7b87('0x17')](function(){return _0x51e4d1[_0x7b87('0x78')](_0x1c4457,_0x2ba41c,function(_0xb33c60){if(_0xb33c60){logger[_0x7b87('0x1c')](_0x7b87('0xcf'),_0xb33c60);}else{fs[_0x7b87('0xd0')](_0x1c4457);}});});});}else{return _0x51e4d1[_0x7b87('0x21')](0xc8);}})[_0x7b87('0x20')](handleError(_0x51e4d1,null));}; \ No newline at end of file +var _0x572f=['length','hasOwnProperty','nolimit','limit','order','sort','where','ChatInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','getMyMessages','pick','includeAgent','push','addTags','Tag','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','read','get','mkdirSync','Chat','Account','Owner','N.A.','toString','browserName','osName','referer','customerIp','tail','pipe','createWriteStream','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash','../../components/parsers/qs','api','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','undefined','count','offset','set','Content-Range','json','update','destroy','stack','name','send','merge','contact','agent','interaction','account','index','ChatInteraction','rawAttributes','type','key','getOptions','findAll','chat','show','params','keys','query','filters','intersection','model','attributes','fields','includeAll','include','create','body','describe','createVidaooSession','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','find','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','disposition','AbandonInteraction','attachmentUpload','basename','file','filename','mimetype','findOne','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','pathTranscript','Messages','User','ContactId','format','agentAlias','System','customer','%s%d','Visitor','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','mailTranscript','Mail\x20Transcript','addMessage','ids','omit'];(function(_0x51b57e,_0x2fcfd4){var _0x5b2c56=function(_0x5c724d){while(--_0x5c724d){_0x51b57e['push'](_0x51b57e['shift']());}};_0x5b2c56(++_0x2fcfd4);}(_0x572f,0x1d7));var _0xf572=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x572f[_0x42cae2];return _0x5f256f;};'use strict';var rimraf=require(_0xf572('0x0'));var zipdir=require(_0xf572('0x1'));var rp=require(_0xf572('0x2'));var moment=require(_0xf572('0x3'));var BPromise=require(_0xf572('0x4'));var Mustache=require('mustache');var util=require(_0xf572('0x5'));var path=require(_0xf572('0x6'));var ejs=require(_0xf572('0x7'));var fs=require('fs');var _=require(_0xf572('0x8'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xf572('0x9'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xf572('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf572('0xb')]=_[_0xf572('0xc')](config[_0xf572('0xb')],{'host':_0xf572('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf572('0xb')]));require(_0xf572('0xe'))[_0xf572('0xf')](socket);var jayson=require(_0xf572('0x10'));var client=jayson['client'][_0xf572('0x11')]({'port':0x232b});var client9004=jayson[_0xf572('0x12')][_0xf572('0x11')]({'port':0x232c});function respondWithRpcPromise(_0x36ff5f,_0x40c1d3,_0x2ca400,_0x4c96ef){return new BPromise(function(_0x5f3053,_0x5370bd){var _0x336cd1=_0x4c96ef||client;return _0x336cd1[_0xf572('0x13')](_0x36ff5f,_0x2ca400)[_0xf572('0x14')](function(_0x5e8e37){logger[_0xf572('0x15')](_0xf572('0x16'),_0x40c1d3,'request\x20sent');logger['debug'](_0xf572('0x17'),_0x40c1d3,_0xf572('0x18'),JSON[_0xf572('0x19')](_0x5e8e37));if(_0x5e8e37[_0xf572('0x1a')]){if(_0x5e8e37[_0xf572('0x1a')][_0xf572('0x1b')]===0x1f4){logger[_0xf572('0x1a')](_0xf572('0x16'),_0x40c1d3,_0x5e8e37[_0xf572('0x1a')][_0xf572('0x1c')]);return _0x5370bd(_0x5e8e37[_0xf572('0x1a')][_0xf572('0x1c')]);}logger[_0xf572('0x1a')](_0xf572('0x16'),_0x40c1d3,_0x5e8e37[_0xf572('0x1a')][_0xf572('0x1c')]);return _0x5f3053(_0x5e8e37[_0xf572('0x1a')][_0xf572('0x1c')]);}else{logger[_0xf572('0x15')](_0xf572('0x16'),_0x40c1d3,_0xf572('0x18'));_0x5f3053(_0x5e8e37[_0xf572('0x1d')][_0xf572('0x1c')]);}})[_0xf572('0x1e')](function(_0x3dd051){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x40c1d3,_0x3dd051);_0x5370bd(_0x3dd051);});});}function respondWithStatusCode(_0x2b69e2,_0x41ddd1){_0x41ddd1=_0x41ddd1||0xcc;return function(_0x4bd90c){if(_0x4bd90c){return _0x2b69e2[_0xf572('0x1f')](_0x41ddd1);}return _0x2b69e2[_0xf572('0x20')](_0x41ddd1)[_0xf572('0x21')]();};}function respondWithResult(_0x4e517d,_0x14a0aa){_0x14a0aa=_0x14a0aa||0xc8;return function(_0x34a8e3){if(_0x34a8e3){return _0x4e517d['status'](_0x14a0aa)['json'](_0x34a8e3);}};}function respondWithFilteredResult(_0xd8b4ac,_0x473e8b){return function(_0x57606e){if(_0x57606e){var _0x3ab9d6=typeof _0x473e8b['offset']===_0xf572('0x22')&&typeof _0x473e8b['limit']===_0xf572('0x22');var _0x3f3d03=_0x57606e[_0xf572('0x23')];var _0x9d302d=_0x3ab9d6?0x0:_0x473e8b[_0xf572('0x24')];var _0x46fb47=_0x3ab9d6?_0x57606e[_0xf572('0x23')]:_0x473e8b['offset']+_0x473e8b['limit'];var _0x217210;if(_0x46fb47>=_0x3f3d03){_0x46fb47=_0x3f3d03;_0x217210=0xc8;}else{_0x217210=0xce;}_0xd8b4ac[_0xf572('0x20')](_0x217210);return _0xd8b4ac[_0xf572('0x25')](_0xf572('0x26'),_0x9d302d+'-'+_0x46fb47+'/'+_0x3f3d03)[_0xf572('0x27')](_0x57606e);}return null;};}function saveUpdates(_0x18dfb2){return function(_0x82a06f){if(_0x82a06f){return _0x82a06f[_0xf572('0x28')](_0x18dfb2)[_0xf572('0x14')](function(_0xe337e0){return _0xe337e0;});}return null;};}function removeEntity(_0x22107e){return function(_0x1f938d){if(_0x1f938d){return _0x1f938d[_0xf572('0x29')]()['then'](function(){_0x22107e[_0xf572('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c2fef){return function(_0x329150){if(!_0x329150){_0x1c2fef[_0xf572('0x1f')](0x194);}return _0x329150;};}function handleError(_0x388bbc,_0x6b1ba1){_0x6b1ba1=_0x6b1ba1||0x1f4;return function(_0x51119d){logger['error'](_0x51119d[_0xf572('0x2a')]);if(_0x51119d[_0xf572('0x2b')]){delete _0x51119d[_0xf572('0x2b')];}_0x388bbc[_0xf572('0x20')](_0x6b1ba1)[_0xf572('0x2c')](_0x51119d);};}function getMustacheRender(_0x321469,_0x1c6fd1){return Mustache['render'](_0x321469,_[_0xf572('0x2d')](_0x1c6fd1['body'],{'contact':_0x1c6fd1[_0xf572('0x2e')],'message':_0x1c6fd1[_0xf572('0x1c')],'agent':_0x1c6fd1[_0xf572('0x2f')],'interaction':_0x1c6fd1[_0xf572('0x30')],'account':_0x1c6fd1[_0xf572('0x31')]}))||'';}exports[_0xf572('0x32')]=function(_0x1cfd8f,_0x1adb26){var _0x50bc4e={};var _0x36652a=_['map'](db[_0xf572('0x33')][_0xf572('0x34')],function(_0x47d8ec){return{'name':_0x47d8ec['fieldName'],'type':_0x47d8ec[_0xf572('0x35')][_0xf572('0x36')]};});_0x50bc4e=qs[_0xf572('0x37')](_0x36652a,_0x1cfd8f);return interaction[_0xf572('0x38')](_0xf572('0x39'),_0x1cfd8f['query'],_0x1cfd8f['user'],_0x50bc4e,_0x36652a)['then'](respondWithFilteredResult(_0x1adb26,_0x50bc4e))[_0xf572('0x1e')](handleError(_0x1adb26,null));};exports[_0xf572('0x3a')]=function(_0x38547c,_0x21a4b9){var _0x337252={'raw':![],'where':{'id':_0x38547c[_0xf572('0x3b')]['id']}},_0x3350c9={};_0x3350c9['model']=_[_0xf572('0x3c')](db[_0xf572('0x33')]['rawAttributes']);_0x3350c9[_0xf572('0x3d')]=_['keys'](_0x38547c[_0xf572('0x3d')]);_0x3350c9[_0xf572('0x3e')]=_[_0xf572('0x3f')](_0x3350c9[_0xf572('0x40')],_0x3350c9[_0xf572('0x3d')]);_0x337252[_0xf572('0x41')]=_['intersection'](_0x3350c9[_0xf572('0x40')],qs[_0xf572('0x42')](_0x38547c[_0xf572('0x3d')][_0xf572('0x42')]));_0x337252[_0xf572('0x41')]=_0x337252[_0xf572('0x41')]['length']?_0x337252[_0xf572('0x41')]:_0x3350c9['model'];if(_0x38547c[_0xf572('0x3d')][_0xf572('0x43')]){_0x337252[_0xf572('0x44')]=[{'all':!![]}];}_0x337252=_[_0xf572('0x2d')]({},_0x337252,_0x38547c['options']);return db[_0xf572('0x33')]['find'](_0x337252)[_0xf572('0x14')](handleEntityNotFound(_0x21a4b9,null))['then'](respondWithResult(_0x21a4b9,null))['catch'](handleError(_0x21a4b9,null));};exports['create']=function(_0x460355,_0x325f84){return db[_0xf572('0x33')][_0xf572('0x45')](_0x460355[_0xf572('0x46')],{})[_0xf572('0x14')](respondWithResult(_0x325f84,0xc9))['catch'](handleError(_0x325f84,null));};exports[_0xf572('0x28')]=function(_0x197d14,_0x3938a7){if(_0x197d14[_0xf572('0x46')]['id']){delete _0x197d14['body']['id'];}return db[_0xf572('0x33')]['find']({'where':{'id':_0x197d14['params']['id']}})[_0xf572('0x14')](handleEntityNotFound(_0x3938a7,null))[_0xf572('0x14')](saveUpdates(_0x197d14[_0xf572('0x46')],null))[_0xf572('0x14')](respondWithResult(_0x3938a7,null))[_0xf572('0x1e')](handleError(_0x3938a7,null));};exports[_0xf572('0x29')]=function(_0x477ac5,_0x14dc4c){return db[_0xf572('0x33')]['find']({'where':{'id':_0x477ac5[_0xf572('0x3b')]['id']}})[_0xf572('0x14')](handleEntityNotFound(_0x14dc4c,null))[_0xf572('0x14')](removeEntity(_0x14dc4c,null))[_0xf572('0x1e')](handleError(_0x14dc4c,null));};exports[_0xf572('0x47')]=function(_0x54299e,_0x53d476){return db[_0xf572('0x33')][_0xf572('0x47')]()[_0xf572('0x14')](respondWithResult(_0x53d476,null))[_0xf572('0x1e')](handleError(_0x53d476,null));};exports[_0xf572('0x48')]=function(_0x5578a2,_0x4583ed){var _0x25873b=_0x5578a2[_0xf572('0x3b')]['id'];var _0x150a65;var _0x4debf1;var _0x4e93da;return db[_0xf572('0x33')]['findOne']({'where':{'id':_0x25873b}})[_0xf572('0x14')](function(_0x1f122e){_0x150a65=_0x1f122e;return db[_0xf572('0x49')]['findOne']({'where':{'id':_0x1f122e[_0xf572('0x4a')]},'attributes':['id',_0xf572('0x4b'),_0xf572('0x4c'),_0xf572('0x4d'),_0xf572('0x4e'),_0xf572('0x4f')],'raw':!![]});})[_0xf572('0x14')](function(_0x51ad93){if(_0x51ad93&&_0x51ad93['vidaooApiKey']&&_0x51ad93[_0xf572('0x4c')]){_0x4debf1=_0x51ad93;var _0x2122f5={'interaction':{'id':_0x25873b},'agent':{'id':_0x5578a2[_0xf572('0x50')]['id'],'name':_0x5578a2['user'][_0xf572('0x2b')],'fullname':_0x5578a2['user'][_0xf572('0x51')],'email':_0x5578a2[_0xf572('0x50')][_0xf572('0x52')]},'contact':_0x5578a2['body'][_0xf572('0x2e')],'account':_0x5578a2[_0xf572('0x46')][_0xf572('0x31')]};var _0xdf7301={'rejectUnauthorized':![],'method':_0xf572('0x53'),'url':_0xf572('0x54'),'headers':{'X-APIKEY':_0x51ad93['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5578a2[_0xf572('0x50')][_0xf572('0x52')]],'buttons':null,'topic':_0x4debf1[_0xf572('0x4d')],'note':_[_0xf572('0x55')](_0x4debf1[_0xf572('0x4e')])?null:getMustacheRender(_0x4debf1[_0xf572('0x4e')],_0x2122f5),'metadata':null},'redirect':_0xf572('0x56'),'json':!![]};try{if(!_['isNull'](_0x4debf1[_0xf572('0x4f')])){var _0xddcea1=getMustacheRender(_0x4debf1[_0xf572('0x4f')],_0x2122f5);var _0x51b227=JSON[_0xf572('0x57')](_0xddcea1);_0xdf7301['body'][_0xf572('0x58')]=_0x51b227;}}catch(_0x52e82b){throw new db[(_0xf572('0x59'))][(_0xf572('0x5a'))](_0xf572('0x5b'));}return rp(_0xdf7301);}else{throw new db[(_0xf572('0x59'))][(_0xf572('0x5a'))](_0xf572('0x5c'));}})['then'](function(_0x306bf2){_0x4e93da=_0x306bf2;if(_0x4e93da['id']){var _0x52bcf9={'body':_0x4e93da[_0xf572('0x5d')],'ChatWebsiteId':_0x4debf1['id'],'ChatInteractionId':_0x150a65['id'],'direction':_0xf572('0x5e'),'UserId':_0x5578a2[_0xf572('0x50')]['id']};return db[_0xf572('0x5f')]['create'](_0x52bcf9,{});}else{throw new db[(_0xf572('0x59'))][(_0xf572('0x5a'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xf572('0x14')](function(){return _0x150a65['updateAttributes']({'vidaooSessionId':_0x4e93da['id']});})[_0xf572('0x14')](respondWithResult(_0x4583ed,null))['catch'](handleError(_0x4583ed,null));};exports['customUpdate']=function(_0x38e4ed,_0x5e3813){if(_0x38e4ed[_0xf572('0x46')]['id']){delete _0x38e4ed[_0xf572('0x46')]['id'];}return db[_0xf572('0x33')][_0xf572('0x60')]({'where':{'id':_0x38e4ed[_0xf572('0x3b')]['id']},'include':[{'model':db[_0xf572('0x61')],'as':_0xf572('0x62')}]})[_0xf572('0x14')](handleEntityNotFound(_0x5e3813,null))[_0xf572('0x14')](saveUpdates(_0x38e4ed[_0xf572('0x46')],null))['then'](respondWithResult(_0x5e3813,null))['catch'](handleError(_0x5e3813,null));};exports[_0xf572('0x63')]=function(_0x26ea9d,_0x434c84){if(_0x26ea9d[_0xf572('0x46')]['id']){delete _0x26ea9d[_0xf572('0x46')]['id'];}return db[_0xf572('0x33')][_0xf572('0x60')]({'where':{'id':_0x26ea9d[_0xf572('0x3b')]['id']}})[_0xf572('0x14')](function(_0x56dc4f){if(!_0x56dc4f){logger[_0xf572('0x1a')](_0xf572('0x64'),_0xf572('0x63'),0x194,_0xf572('0x65'));_0x434c84['sendStatus'](0x194);}else{if(_0x56dc4f[_0xf572('0x66')]){throw new db[(_0xf572('0x59'))][(_0xf572('0x5a'))]('Interaction\x20already\x20assigned');}}return _0x56dc4f;})[_0xf572('0x14')](function(_0x5af409){if(_0x5af409){return _0x5af409[_0xf572('0x28')]({'closed':_0x26ea9d[_0xf572('0x46')]['closed'],'disposition':_0x26ea9d[_0xf572('0x46')][_0xf572('0x67')]})[_0xf572('0x14')](function(_0x2882ca){return _0x2882ca;});}})[_0xf572('0x14')](function(){return respondWithRpcPromise(_0xf572('0x68'),_0xf572('0x63'),_0x26ea9d[_0xf572('0x46')],client9004);})[_0xf572('0x14')](respondWithResult(_0x434c84,null))[_0xf572('0x1e')](handleError(_0x434c84,null));};exports[_0xf572('0x69')]=function(_0x3fdf30,_0x16e2ef){_0x3fdf30[_0xf572('0x46')][_0xf572('0x2b')]=_0x3fdf30['file']['originalname'];_0x3fdf30['body'][_0xf572('0x6a')]=_0x3fdf30[_0xf572('0x6b')][_0xf572('0x6c')];_0x3fdf30[_0xf572('0x46')][_0xf572('0x35')]=_0x3fdf30[_0xf572('0x6b')][_0xf572('0x6d')];return db['Attachment']['create'](_0x3fdf30[_0xf572('0x46')])[_0xf572('0x14')](respondWithResult(_0x16e2ef,0xc9))['catch'](handleError(_0x16e2ef,null));};exports['attachmentDownload']=function(_0x4f5148,_0x19d0a2){return db[_0xf572('0x33')][_0xf572('0x6e')]({'where':{'id':_0x4f5148[_0xf572('0x3b')]['id']},'raw':!![]})[_0xf572('0x14')](handleEntityNotFound(_0x19d0a2,null))[_0xf572('0x14')](function(_0x35a671){if(_0x35a671){if(_0x35a671[_0xf572('0x6f')]){return _0x19d0a2['status'](0x193)[_0xf572('0x27')]({'status':0x193,'message':_0xf572('0x70')});}return db[_0xf572('0x71')][_0xf572('0x6e')]({'where':{'id':_0x4f5148['query'][_0xf572('0x72')]},'raw':!![]})['then'](handleEntityNotFound(_0x19d0a2,null));}})[_0xf572('0x14')](function(_0x169801){if(_0x169801){var _0x19f5da=_0x169801[_0xf572('0x73')]!==null;var _0x82eb20=path[_0xf572('0x74')](config[_0xf572('0x75')],_0xf572('0x76'));if(_0x19f5da){_0x82eb20=path[_0xf572('0x74')](_0x82eb20,_0xf572('0x77'));}var _0x3e8780=path[_0xf572('0x74')](_0x82eb20,_0x169801[_0xf572('0x6a')]);return _0x19d0a2[_0xf572('0x78')](_0x3e8780);}})[_0xf572('0x1e')](handleError(_0x19d0a2,null));};exports[_0xf572('0x79')]=function(_0x44d061,_0x5b1fd3){var _0x2a6e58=null;var _0x2c5a9c=null;var _0x4e409e=null;if(_0x44d061['body']['id']){delete _0x44d061[_0xf572('0x46')]['id'];}if(_0x44d061[_0xf572('0x46')]['mailTranscript']){_0x4e409e=path[_0xf572('0x74')](config[_0xf572('0x75')],'server/files/chat/upload/',util['format']('transcript-%s.txt',Date['now']()));_0x44d061[_0xf572('0x46')][_0xf572('0x7a')]=_0x4e409e;}return db['ChatInteraction'][_0xf572('0x60')]({'where':{'id':_0x44d061[_0xf572('0x3b')]['id']},'include':[{'model':db[_0xf572('0x5f')],'as':_0xf572('0x7b'),'include':[{'model':db[_0xf572('0x7c')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x5b1fd3,null))[_0xf572('0x14')](saveUpdates(_0x44d061[_0xf572('0x46')],null))[_0xf572('0x14')](function(_0x41b9ea){if(_0x41b9ea){_0x2a6e58=_0x41b9ea;return db[_0xf572('0x49')][_0xf572('0x60')]({'where':{'id':_0x2a6e58[_0xf572('0x4a')]}});}})[_0xf572('0x14')](function(_0xad08a4){if(_0xad08a4){_0x2c5a9c=_0xad08a4;return db[_0xf572('0x61')][_0xf572('0x60')]({'where':{'id':_0x2a6e58[_0xf572('0x7d')]}});}})['then'](function(_0x567a7b){if(_0x567a7b){if(_0x4e409e){var _0x279c16=null;for(var _0x34780f=0x1;_0x34780f<_0x2a6e58[_0xf572('0x7b')]['length'];++_0x34780f){_0x279c16=_0x2a6e58['Messages'][_0x34780f];var _0x5bad7f=_0x279c16[_0xf572('0x66')]?util[_0xf572('0x7e')]('%s%d',_0x2c5a9c[_0xf572('0x7f')],_0x279c16['UserId']):_0xf572('0x80');var _0x186624=_0x44d061[_0xf572('0x46')][_0xf572('0x81')]||util[_0xf572('0x7e')](_0xf572('0x82'),_0xf572('0x83'),_0x279c16[_0xf572('0x7d')]);switch(_0x2c5a9c['agentIdentifier']){case _0xf572('0x84'):_0x5bad7f=_0x279c16[_0xf572('0x66')]?util[_0xf572('0x7e')](_0xf572('0x82'),_0x2c5a9c[_0xf572('0x7f')],_0x279c16[_0xf572('0x66')]):_0xf572('0x80');break;case _0xf572('0x85'):_0x5bad7f=_0x279c16['UserId']?_0x279c16[_0xf572('0x7c')][_0xf572('0x86')]||_0x279c16[_0xf572('0x7c')][_0xf572('0x51')]:'System';break;case _0xf572('0x87'):_0x5bad7f=_0x279c16[_0xf572('0x66')]?_0x279c16['User'][_0xf572('0x51')]:_0xf572('0x80');break;default:_0x5bad7f=_0x279c16['UserId']?util[_0xf572('0x7e')](_0xf572('0x82'),_0x2c5a9c[_0xf572('0x7f')],_0x279c16[_0xf572('0x66')]):_0xf572('0x80');}var _0x2e23c8=util[_0xf572('0x7e')](_0xf572('0x88'),moment(_0x279c16[_0xf572('0x89')])[_0xf572('0x7e')](_0xf572('0x8a')),_0x279c16[_0xf572('0x8b')]==='in'?_0x186624:_0x5bad7f,_0x279c16['body']);if(!_0x279c16[_0xf572('0x8c')]){fs[_0xf572('0x8d')](_0x4e409e,_0x2e23c8);}}return db[_0xf572('0x8e')][_0xf572('0x6e')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf572('0x8f'),'raw':!![],'include':[{'model':db[_0xf572('0x90')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xf572('0x14')](function(_0x1e0706){if(!_0x1e0706||!_0x1e0706[_0xf572('0x8f')]||!_0x44d061[_0xf572('0x46')])return _0x2a6e58;var _0x14cf5a=_0x1e0706[_0xf572('0x91')]();return respondWithRpcPromise(_0xf572('0x92'),_0xf572('0x93'),{'account':_0x14cf5a,'message':{'from':util[_0xf572('0x7e')]('\x22%s\x22\x20<%s>',_0x1e0706[_0xf572('0x2b')],_0x1e0706[_0xf572('0x52')]||_0x1e0706['Smtp']['user']),'to':_0x44d061['body'][_0xf572('0x94')],'subject':_0xf572('0x95'),'text':util[_0xf572('0x7e')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x44d061[_0xf572('0x46')][_0xf572('0x94')]),'attachments':[{'path':_0x4e409e}]}})[_0xf572('0x14')](function(){return _0x2a6e58;})['catch'](function(_0x5780d2){logger[_0xf572('0x1a')](_0x5780d2);});})['then'](respondWithStatusCode(_0x5b1fd3,0xc8))[_0xf572('0x1e')](handleError(_0x5b1fd3,null));};exports[_0xf572('0x96')]=function(_0x58712c,_0x10b347){return db[_0xf572('0x5f')][_0xf572('0x60')]({'where':{'id':_0x58712c[_0xf572('0x3b')]['id']}})['then'](handleEntityNotFound(_0x10b347,null))[_0xf572('0x14')](function(_0x380302){if(_0x380302){return _0x380302[_0xf572('0x96')](_0x58712c[_0xf572('0x46')][_0xf572('0x97')],_[_0xf572('0x98')](_0x58712c[_0xf572('0x46')],['ids','id'])||{});}})[_0xf572('0x14')](respondWithResult(_0x10b347,null))['catch'](handleError(_0x10b347,null));};exports['getMessages']=function(_0x3d49b8,_0xbdfe9c){var _0x4c5fd3={'raw':![],'where':{}};var _0x1898d4={};var _0x9ec35f={'count':0x0,'rows':[]};return db[_0xf572('0x33')][_0xf572('0x6e')]({'where':{'id':_0x3d49b8[_0xf572('0x3b')]['id']}})[_0xf572('0x14')](handleEntityNotFound(_0xbdfe9c,null))[_0xf572('0x14')](function(_0x280477){if(_0x280477){_0x1898d4[_0xf572('0x40')]=_[_0xf572('0x3c')](db[_0xf572('0x5f')][_0xf572('0x34')]);_0x1898d4[_0xf572('0x3d')]=_['keys'](_0x3d49b8['query']);_0x1898d4['filters']=_['intersection'](_0x1898d4['model'],_0x1898d4['query']);_0x4c5fd3[_0xf572('0x41')]=_[_0xf572('0x3f')](_0x1898d4[_0xf572('0x40')],qs[_0xf572('0x42')](_0x3d49b8['query'][_0xf572('0x42')]));_0x4c5fd3[_0xf572('0x41')]=_0x4c5fd3[_0xf572('0x41')][_0xf572('0x99')]?_0x4c5fd3[_0xf572('0x41')]:_0x1898d4['model'];if(!_0x3d49b8[_0xf572('0x3d')][_0xf572('0x9a')](_0xf572('0x9b'))){_0x4c5fd3['limit']=qs[_0xf572('0x9c')](_0x3d49b8[_0xf572('0x3d')][_0xf572('0x9c')]);_0x4c5fd3[_0xf572('0x24')]=qs[_0xf572('0x24')](_0x3d49b8[_0xf572('0x3d')]['offset']);}_0x4c5fd3[_0xf572('0x9d')]=qs[_0xf572('0x9e')](_0x3d49b8[_0xf572('0x3d')][_0xf572('0x9e')]);_0x4c5fd3[_0xf572('0x9f')]=qs[_0xf572('0x3e')](_['pick'](_0x3d49b8[_0xf572('0x3d')],_0x1898d4[_0xf572('0x3e')]));_0x4c5fd3[_0xf572('0x9f')][_0xf572('0xa0')]=_0x280477['id'];if(_0x3d49b8[_0xf572('0x3d')][_0xf572('0xa1')]){_0x4c5fd3[_0xf572('0x9f')]=_[_0xf572('0x2d')](_0x4c5fd3[_0xf572('0x9f')],{'$or':_[_0xf572('0xa2')](_0x4c5fd3['attributes'],function(_0x58f11c){var _0xc4ba38={};_0xc4ba38[_0x58f11c]={'$like':'%'+_0x3d49b8[_0xf572('0x3d')]['filter']+'%'};return _0xc4ba38;})});}if(_0x3d49b8[_0xf572('0x3d')][_0xf572('0xa3')]){var _0x324e6f=_0x3d49b8[_0xf572('0x3d')][_0xf572('0xa3')][_0xf572('0xa4')](',');var _0x21cebe={};_0x21cebe[_0x324e6f[0x0]]={'$gte':moment(_0x324e6f[0x1])[_0xf572('0x7e')](_0xf572('0xa5'))};_0x4c5fd3[_0xf572('0x9f')]=_[_0xf572('0x2d')](_0x4c5fd3[_0xf572('0x9f')],_0x21cebe);}_0x4c5fd3=_[_0xf572('0x2d')]({},_0x4c5fd3,_0x3d49b8[_0xf572('0xa6')]);return db[_0xf572('0x5f')][_0xf572('0x23')]({'where':_0x4c5fd3['where']})['then'](function(_0x5dd0cb){_0x9ec35f['count']=_0x5dd0cb;if(_0x3d49b8[_0xf572('0x3d')][_0xf572('0x43')]){_0x4c5fd3[_0xf572('0x44')]=[{'all':!![]}];}return db[_0xf572('0x5f')]['findAll'](_0x4c5fd3);})[_0xf572('0x14')](function(_0x3c854a){_0x9ec35f[_0xf572('0xa7')]=_0x3c854a;return _0x9ec35f;});}})['then'](respondWithFilteredResult(_0xbdfe9c,_0x4c5fd3))['catch'](handleError(_0xbdfe9c,null));};exports[_0xf572('0xa8')]=function(_0xbda0ef,_0x28f961){var _0x3e8936={'where':{}},_0x501fbf={},_0x57d52b={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf572('0x6e')]({'where':{'id':_0xbda0ef[_0xf572('0x3b')]['id']}})['then'](handleEntityNotFound(_0x28f961,null))[_0xf572('0x14')](function(_0x323295){if(_0x323295){_0x501fbf['model']=_[_0xf572('0x3c')](db[_0xf572('0x5f')][_0xf572('0x34')]);_0x501fbf[_0xf572('0x3d')]=_[_0xf572('0x3c')](_0xbda0ef[_0xf572('0x3d')]);_0x501fbf[_0xf572('0x3e')]=_[_0xf572('0x3f')](_0x501fbf[_0xf572('0x40')],_0x501fbf[_0xf572('0x3d')]);_0x3e8936[_0xf572('0x41')]=_[_0xf572('0x3f')](_0x501fbf['model'],qs[_0xf572('0x42')](_0xbda0ef[_0xf572('0x3d')][_0xf572('0x42')]));_0x3e8936[_0xf572('0x41')]=_0x3e8936[_0xf572('0x41')][_0xf572('0x99')]?_0x3e8936[_0xf572('0x41')]:_0x501fbf[_0xf572('0x40')];if(!_0xbda0ef[_0xf572('0x3d')]['hasOwnProperty']('nolimit')){_0x3e8936[_0xf572('0x9c')]=qs[_0xf572('0x9c')](_0xbda0ef[_0xf572('0x3d')][_0xf572('0x9c')]);_0x3e8936['offset']=qs[_0xf572('0x24')](_0xbda0ef[_0xf572('0x3d')][_0xf572('0x24')]);}_0x3e8936['order']=qs['sort'](_0xbda0ef[_0xf572('0x3d')]['sort']);_0x3e8936[_0xf572('0x9f')]=qs[_0xf572('0x3e')](_[_0xf572('0xa9')](_0xbda0ef[_0xf572('0x3d')],_0x501fbf[_0xf572('0x3e')]));_0x3e8936['where']['ChatInteractionId']=_0x323295['id'];if(_0xbda0ef[_0xf572('0x3d')][_0xf572('0xa1')]){_0x3e8936['where']=_[_0xf572('0x2d')](_0x3e8936[_0xf572('0x9f')],{'$or':_['map'](_0x3e8936[_0xf572('0x41')],function(_0x126a61){var _0xf6496={};_0xf6496[_0x126a61]={'$like':'%'+_0xbda0ef[_0xf572('0x3d')][_0xf572('0xa1')]+'%'};return _0xf6496;})});}_0x3e8936[_0xf572('0x9f')][_0xf572('0x8c')]=![];if(_0xbda0ef[_0xf572('0x3d')]['id']){_0x3e8936[_0xf572('0x9f')]['id']={'$gt':_0xbda0ef[_0xf572('0x3d')]['id']};}_0x3e8936=_['merge']({},_0x3e8936,_0xbda0ef['options']);return db['ChatMessage'][_0xf572('0x23')]({'where':_0x3e8936[_0xf572('0x9f')]})[_0xf572('0x14')](function(_0x1be187){_0x57d52b['count']=_0x1be187;_0x3e8936[_0xf572('0x44')]=[];if(_0xbda0ef[_0xf572('0x3d')][_0xf572('0xaa')]){_0x3e8936[_0xf572('0x44')][_0xf572('0xab')]({'model':db['User'],'as':'User','attributes':['id',_0xf572('0x51'),_0xf572('0x86')]});}if(_0xbda0ef['query']['includeAll']){_0x3e8936[_0xf572('0x44')]=[{'all':!![]}];}return db[_0xf572('0x5f')][_0xf572('0x38')](_0x3e8936);})[_0xf572('0x14')](function(_0x5b5484){_0x57d52b[_0xf572('0xa7')]=_0x5b5484;return _0x57d52b;});}})[_0xf572('0x14')](respondWithFilteredResult(_0x28f961,_0x3e8936))['catch'](handleError(_0x28f961,null));};exports[_0xf572('0xac')]=function(_0x443fd3,_0x13dc07){return db['ChatInteraction'][_0xf572('0x60')]({'where':{'id':_0x443fd3[_0xf572('0x3b')]['id']}})[_0xf572('0x14')](handleEntityNotFound(_0x13dc07,null))[_0xf572('0x14')](function(_0x2df50d){if(_0x2df50d){return _0x2df50d['setTags'](_0x443fd3['body'][_0xf572('0x97')],_['omit'](_0x443fd3['body'],[_0xf572('0x97'),'id'])||{})['spread'](function(){return db[_0xf572('0xad')][_0xf572('0x38')]({'attributes':['id',_0xf572('0x2b'),_0xf572('0xae')],'where':{'id':_0x443fd3[_0xf572('0x46')][_0xf572('0x97')]}});})[_0xf572('0x14')](function(_0x3dc9ab){socket[_0xf572('0xaf')](_0xf572('0xb0'),{'id':Number(_0x443fd3[_0xf572('0x3b')]['id']),'tags':_0x3dc9ab||[]});return{'id':Number(_0x443fd3[_0xf572('0x3b')]['id']),'tags':_0x3dc9ab||[]};});}})[_0xf572('0x14')](respondWithResult(_0x13dc07,null))[_0xf572('0x1e')](handleError(_0x13dc07,null));};exports[_0xf572('0xb1')]=function(_0x4472a4,_0x462f5f){return db[_0xf572('0x33')][_0xf572('0x60')]({'where':{'id':_0x4472a4[_0xf572('0x3b')]['id']}})[_0xf572('0x14')](handleEntityNotFound(_0x462f5f,null))[_0xf572('0x14')](function(_0x5e1c2b){if(_0x5e1c2b){return _0x5e1c2b[_0xf572('0xb1')](_0x4472a4[_0xf572('0x3d')][_0xf572('0x97')]);}})[_0xf572('0x14')](respondWithStatusCode(_0x462f5f,null))[_0xf572('0x1e')](handleError(_0x462f5f,null));};exports['download']=function(_0x497d72,_0x1b330e){var _0x4bf1d9=moment()[_0xf572('0xb2')]()['toString']();var _0x566597=path['join'](config[_0xf572('0x75')],_0xf572('0xb3'),_0xf572('0xb4'),_0xf572('0xb5'));var _0x23ddb8=path[_0xf572('0x74')](config['root'],_0xf572('0xb3'),'files',_0xf572('0xb6'));var _0x143b5c=path[_0xf572('0x74')](_0x566597,_0x4bf1d9);var _0x1b693a=util['format'](_0xf572('0xb7'),_0x497d72[_0xf572('0x3b')]['id'],_0x4bf1d9);var _0x443f49=path[_0xf572('0x74')](_0x566597,_0x1b693a);var _0x374962=[];_0x374962[_0xf572('0xab')]({'model':db[_0xf572('0x7c')],'as':_0xf572('0x7c'),'attributes':['id',_0xf572('0x51')],'raw':!![]});_0x374962['push']({'model':db[_0xf572('0x61')],'as':'Contact','attributes':['id',_0xf572('0xb8'),'lastName'],'raw':!![]});if(_0x497d72[_0xf572('0x3d')]['attachments']){_0x374962[_0xf572('0xab')]({'model':db[_0xf572('0x71')],'as':'Attachment','raw':!![]});}var _0x9ab5fb=[{'model':db[_0xf572('0x5f')],'as':'Messages','attributes':['id','body',_0xf572('0x89'),_0xf572('0x8b'),_0xf572('0x8c'),_0xf572('0xb9')],'include':_0x374962}];_0x9ab5fb[_0xf572('0xab')]({'model':db[_0xf572('0x49')],'as':'Account','attributes':['id',_0xf572('0x2b')]});_0x9ab5fb[_0xf572('0xab')]({'model':db[_0xf572('0x7c')],'as':'Owner','attributes':['id','fullname']});return db[_0xf572('0x33')][_0xf572('0x60')]({'where':{'id':_0x497d72['params']['id']},'include':_0x9ab5fb})[_0xf572('0x14')](handleEntityNotFound(_0x1b330e,null))[_0xf572('0x14')](function(_0x1d577d){if(_0x1d577d){var _0x43f511=_0x1d577d[_0xf572('0xba')]({'plain':!![]});fs[_0xf572('0xbb')](_0x143b5c);var _0x16910a={'channel':_0xf572('0xbc'),'account':_0x43f511[_0xf572('0xbd')][_0xf572('0x2b')],'agent':_0x43f511[_0xf572('0xbe')]?_0x43f511['Owner'][_0xf572('0x51')]:_0xf572('0xbf'),'createdAt':moment(_0x43f511[_0xf572('0x89')])[_0xf572('0x7e')](_0xf572('0xa5'))[_0xf572('0xc0')](),'closedAt':_0x43f511['closed']?moment(_0x43f511['closedAt'])[_0xf572('0x7e')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf572('0xc0')]():'','disposition':_0x43f511[_0xf572('0x67')],'chatInfo':{'browser':_0x43f511[_0xf572('0xc1')],'os':_0x43f511[_0xf572('0xc2')],'referer':_0x43f511[_0xf572('0xc3')],'customerIp':_0x43f511[_0xf572('0xc4')],'customerPort':_0x43f511['customerPort']?_0x43f511['customerPort']:'N.A.'},'messages':_(_0x43f511['Messages'])[_0xf572('0xc5')]()['filter']({'secret':![]})[_0xf572('0xa2')](function(_0x146898){if(_0x146898['Attachment']){var _0x26bacd=path[_0xf572('0x74')](_0x23ddb8,_0x146898['Attachment'][_0xf572('0x6a')]);if(fs['existsSync'](_0x26bacd)){fs['createReadStream'](_0x26bacd)[_0xf572('0xc6')](fs[_0xf572('0xc7')](path[_0xf572('0x74')](_0x143b5c,_0x146898[_0xf572('0x71')][_0xf572('0x6a')])));}}return{'date':moment(_0x146898[_0xf572('0x89')])[_0xf572('0x7e')](_0xf572('0xa5'))[_0xf572('0xc0')](),'sender':_0x146898[_0xf572('0x8b')]===_0xf572('0x5e')?_0x146898[_0xf572('0x7c')]?_0x146898[_0xf572('0x7c')]['fullname']:_0xf572('0x80'):_0x146898[_0xf572('0x62')][_0xf572('0xb8')]+(_0x146898['Contact'][_0xf572('0xc8')]?'\x20'+_0x146898['Contact']['lastName']:''),'body':_0x146898[_0xf572('0x71')]?_0x146898[_0xf572('0x71')][_0xf572('0x6a')]:_0x146898[_0xf572('0x46')],'direction':_0x146898['direction']===_0xf572('0x5e')?'A':'C','secret':_0x146898[_0xf572('0x8c')],'read':_0x146898['read'],'attachment':_0x146898['Attachment']};})[_0xf572('0xc9')]()};return ejs[_0xf572('0xca')](path['join'](config[_0xf572('0x75')],_0xf572('0xb3'),_0xf572('0xcb'),_0xf572('0xcc')),{'interaction':_0x16910a})[_0xf572('0x14')](function(_0x527b2e){var _0xa766c3=path[_0xf572('0x74')](_0x143b5c,_0xf572('0xcd')+_0x43f511['id']+'-'+_0x4bf1d9+_0xf572('0xce'));var _0x35c11b={'path':_0xa766c3,'channel':_0xf572('0xbc'),'interactionId':_0x43f511['id']};return pdf['createPdfFromHTML'](_0x527b2e,_0x35c11b);})[_0xf572('0x14')](function(){return new Promise(function(_0x58e5de,_0x4e9687){zipdir(_0x143b5c,{'saveTo':_0x443f49},function(_0x34f96d,_0x47d541){if(_0x34f96d)return _0x4e9687(_0x34f96d);return _0x58e5de(_0x47d541);});})['then'](function(){return new BPromise(function(_0x4e4e7f,_0x3047d7){rimraf(_0x143b5c,function(_0x240fdf){if(_0x240fdf)_0x3047d7(_0x240fdf);return _0x4e4e7f();});});})[_0xf572('0x14')](function(){return _0x1b330e[_0xf572('0x78')](_0x443f49,_0x1b693a,function(_0x1d4870){if(_0x1d4870){logger[_0xf572('0x1a')](_0xf572('0xcf'),_0x1d4870);}else{fs['unlinkSync'](_0x443f49);}});});});}else{return _0x1b330e['sendStatus'](0xc8);}})[_0xf572('0x1e')](handleError(_0x1b330e,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index ee50bcb..3ebe9d1 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 _0x0fe9=['unreadMessages','length','emit','catch','hasOwnProperty','hook','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','remove','getUsers','then','Users','findAll','setDataValue'];(function(_0x1151fa,_0x2784a7){var _0x49da2b=function(_0x2d33ca){while(--_0x2d33ca){_0x1151fa['push'](_0x1151fa['shift']());}};_0x49da2b(++_0x2784a7);}(_0x0fe9,0x14a));var _0x90fe=function(_0x5a41e6,_0x3413d0){_0x5a41e6=_0x5a41e6-0x0;var _0x33a228=_0x0fe9[_0x5a41e6];return _0x33a228;};'use strict';var EventEmitter=require(_0x90fe('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x90fe('0x1')];var ChatMessage=require(_0x90fe('0x2'))['db'][_0x90fe('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x90fe('0x4')](0x0);var events={'afterCreate':_0x90fe('0x5'),'afterUpdate':'update','afterDestroy':_0x90fe('0x6')};function emitEvent(_0x5d9ccf){return function(_0x58b2ff,_0x4ba84d,_0x295a2a){_0x58b2ff[_0x90fe('0x7')]({'attributes':['id'],'raw':!![]})[_0x90fe('0x8')](function(_0x10127d){_0x58b2ff['setDataValue'](_0x90fe('0x9'),_0x10127d['map'](function(_0x2a178e){return{'id':_0x2a178e['id']};}));return ChatMessage[_0x90fe('0xa')]({'where':{'ChatInteractionId':_0x58b2ff['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x59b212){_0x58b2ff[_0x90fe('0xb')](_0x90fe('0xc'),_0x59b212[_0x90fe('0xd')]);ChatInteractionEvents['emit'](_0x5d9ccf+':'+_0x58b2ff['id'],_0x58b2ff);ChatInteractionEvents[_0x90fe('0xe')](_0x5d9ccf,_0x58b2ff);_0x295a2a(null);})[_0x90fe('0xf')](_0x295a2a(null));};}for(var e in events){if(events[_0x90fe('0x10')](e)){var event=events[e];ChatInteraction[_0x90fe('0x11')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x984e=['then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','update','getUsers'];(function(_0x577b65,_0x448665){var _0x564d82=function(_0x33de13){while(--_0x33de13){_0x577b65['push'](_0x577b65['shift']());}};_0x564d82(++_0x448665);}(_0x984e,0x192));var _0xe984=function(_0x5c2ab,_0x3d28e4){_0x5c2ab=_0x5c2ab-0x0;var _0x411c0a=_0x984e[_0x5c2ab];return _0x411c0a;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xe984('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0xe984('0x0'))['db'][_0xe984('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe984('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2a99c7){return function(_0x330379,_0x7ecaaf,_0x150616){_0x330379[_0xe984('0x3')]({'attributes':['id'],'raw':!![]})[_0xe984('0x4')](function(_0x1e787e){_0x330379[_0xe984('0x5')](_0xe984('0x6'),_0x1e787e[_0xe984('0x7')](function(_0x4f72){return{'id':_0x4f72['id']};}));return ChatMessage[_0xe984('0x8')]({'where':{'ChatInteractionId':_0x330379['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe984('0x4')](function(_0x1eeca5){_0x330379[_0xe984('0x5')](_0xe984('0x9'),_0x1eeca5['length']);ChatInteractionEvents['emit'](_0x2a99c7+':'+_0x330379['id'],_0x330379);ChatInteractionEvents[_0xe984('0xa')](_0x2a99c7,_0x330379);_0x150616(null);})['catch'](_0x150616(null));};}for(var e in events){if(events[_0xe984('0xb')](e)){var event=events[e];ChatInteraction[_0xe984('0xc')](e,emitEvent(event));}}module[_0xe984('0xd')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 0202470..f306461 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 _0x13c2=['utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','utf8mb4'];(function(_0x52d3c8,_0x16fb07){var _0x201eb2=function(_0x5377ba){while(--_0x5377ba){_0x52d3c8['push'](_0x52d3c8['shift']());}};_0x201eb2(++_0x16fb07);}(_0x13c2,0x196));var _0x213c=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x13c2[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x213c('0x0'));var util=require(_0x213c('0x1'));var logger=require('../../config/logger')(_0x213c('0x2'));var moment=require(_0x213c('0x3'));var BPromise=require('bluebird');var rp=require(_0x213c('0x4'));var fs=require('fs');var path=require(_0x213c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x213c('0x6'));module[_0x213c('0x7')]=function(_0x34f013,_0x4f9420){return _0x34f013[_0x213c('0x8')](_0x213c('0x9'),attributes,{'tableName':_0x213c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x156d3f,_0x29576a,_0x435ad2){if(_0x156d3f[_0x213c('0xb')](_0x213c('0xc'))){_0x156d3f['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x435ad2(null,_0x156d3f);}},'charset':_0x213c('0xd'),'collate':_0x213c('0xe')});}; \ No newline at end of file +var _0xde03=['define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','utf8mb4','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports'];(function(_0x13d40a,_0x4ee133){var _0x7dd51c=function(_0x3ac7d9){while(--_0x3ac7d9){_0x13d40a['push'](_0x13d40a['shift']());}};_0x7dd51c(++_0x4ee133);}(_0xde03,0x182));var _0x3de0=function(_0x316a87,_0x53c8ab){_0x316a87=_0x316a87-0x0;var _0xdd3282=_0xde03[_0x316a87];return _0xdd3282;};'use strict';var _=require(_0x3de0('0x0'));var util=require('util');var logger=require(_0x3de0('0x1'))(_0x3de0('0x2'));var moment=require(_0x3de0('0x3'));var BPromise=require('bluebird');var rp=require(_0x3de0('0x4'));var fs=require('fs');var path=require(_0x3de0('0x5'));var rimraf=require(_0x3de0('0x6'));var config=require(_0x3de0('0x7'));var attributes=require(_0x3de0('0x8'));module[_0x3de0('0x9')]=function(_0x504a81,_0x178718){return _0x504a81[_0x3de0('0xa')](_0x3de0('0xb'),attributes,{'tableName':_0x3de0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x186bfe,_0x1934e1,_0x14a4e7){if(_0x186bfe[_0x3de0('0xd')](_0x3de0('0xe'))){_0x186bfe[_0x3de0('0xf')]=moment()[_0x3de0('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x14a4e7(null,_0x186bfe);}},'charset':_0x3de0('0x11'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 6f5ccfd..029ec9b 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 _0x8904=['ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','attributes','limit','stringify','where','addTags','omit','ids','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8904,0x89));var _0x4890=function(_0x1a704d,_0xe0acd1){_0x1a704d=_0x1a704d-0x0;var _0xdef339=_0x8904[_0x1a704d];return _0xdef339;};'use strict';var _=require(_0x4890('0x0'));var util=require(_0x4890('0x1'));var moment=require(_0x4890('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4890('0x3'));var db=require(_0x4890('0x4'))['db'];var utils=require(_0x4890('0x5'));var logger=require(_0x4890('0x6'))('rpc');var config=require(_0x4890('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4890('0x8')][_0x4890('0x9')]({'port':0x232a});config[_0x4890('0xa')]=_[_0x4890('0xb')](config['redis'],{'host':_0x4890('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4890('0xa')]));require('./chatInteraction.socket')[_0x4890('0xd')](socket);function respondWithRpcPromise(_0x17a47e,_0x411b6b,_0x5851c2){return new BPromise(function(_0x248050,_0x1f05cf){return client[_0x4890('0xe')](_0x17a47e,_0x5851c2)[_0x4890('0xf')](function(_0xfdbe2f){logger[_0x4890('0x10')](_0x4890('0x11'),_0x411b6b,'request\x20sent');logger[_0x4890('0x12')](_0x4890('0x13'),_0x411b6b,_0x4890('0x14'),JSON['stringify'](_0xfdbe2f));if(_0xfdbe2f[_0x4890('0x15')]){if(_0xfdbe2f['error'][_0x4890('0x16')]===0x1f4){logger[_0x4890('0x15')](_0x4890('0x11'),_0x411b6b,_0xfdbe2f['error'][_0x4890('0x17')]);return _0x1f05cf(_0xfdbe2f[_0x4890('0x15')][_0x4890('0x17')]);}logger[_0x4890('0x15')](_0x4890('0x11'),_0x411b6b,_0xfdbe2f[_0x4890('0x15')][_0x4890('0x17')]);return _0x248050(_0xfdbe2f[_0x4890('0x15')][_0x4890('0x17')]);}else{logger[_0x4890('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x411b6b,_0x4890('0x14'));_0x248050(_0xfdbe2f['result'][_0x4890('0x17')]);}})[_0x4890('0x18')](function(_0x45de66){logger['error'](_0x4890('0x11'),_0x411b6b,_0x45de66);_0x1f05cf(_0x45de66);});});}exports[_0x4890('0x19')]=function(_0x4e9af3){var _0x29c5c6=this;return new Promise(function(_0x15ee7c,_0x5093d8){return db[_0x4890('0x1a')][_0x4890('0x1b')](_0x4e9af3[_0x4890('0x1c')],{'raw':_0x4e9af3[_0x4890('0x1d')]?_0x4e9af3[_0x4890('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e9af3[_0x4890('0x1d')]?_0x4e9af3[_0x4890('0x1d')]['where']||null:null,'attributes':_0x4e9af3['options']?_0x4e9af3[_0x4890('0x1d')][_0x4890('0x1e')]||null:null,'limit':_0x4e9af3['options']?_0x4e9af3[_0x4890('0x1d')][_0x4890('0x1f')]||null:null})[_0x4890('0xf')](function(_0x28d441){logger[_0x4890('0x10')](_0x4890('0x19'),_0x4e9af3);logger[_0x4890('0x12')](_0x4890('0x19'),_0x4e9af3,JSON[_0x4890('0x20')](_0x28d441));_0x15ee7c(_0x28d441);})[_0x4890('0x18')](function(_0x188e25){logger[_0x4890('0x15')](_0x4890('0x19'),_0x188e25['message'],_0x4e9af3);_0x5093d8(_0x29c5c6[_0x4890('0x15')](0x1f4,_0x188e25['message']));});});};exports['AddTagsToChatInteraction']=function(_0x845e18){return new Promise(function(_0x12bfa3,_0x41c7b5){return db['ChatInteraction']['find']({'where':_0x845e18[_0x4890('0x1d')]?_0x845e18[_0x4890('0x1d')][_0x4890('0x21')]||null:null})[_0x4890('0xf')](function(_0x437b83){if(_0x437b83){return _0x437b83[_0x4890('0x22')](_0x845e18['body']['ids'],_[_0x4890('0x23')](_0x845e18['body'],[_0x4890('0x24'),'id'])||{});}})[_0x4890('0x25')](function(_0x2d1424){logger[_0x4890('0x10')](_0x4890('0x26'),_0x845e18);logger[_0x4890('0x12')](_0x4890('0x26'),_0x845e18,JSON[_0x4890('0x20')](_0x2d1424));_0x12bfa3(_0x2d1424);})[_0x4890('0x18')](function(_0x1e73c7){logger['error'](_0x4890('0x26'),_0x1e73c7[_0x4890('0x17')],_0x845e18);_0x41c7b5(_this[_0x4890('0x15')](0x1f4,_0x1e73c7['message']));});});}; \ No newline at end of file +var _0x1fec=['./chatInteraction.socket','request','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','info','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','limit','AddTagsToChatInteraction','then','ids','omit','spread','debug','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x2843cc,_0x18af31){var _0x3d945b=function(_0x27b7c2){while(--_0x27b7c2){_0x2843cc['push'](_0x2843cc['shift']());}};_0x3d945b(++_0x18af31);}(_0x1fec,0x1ed));var _0xc1fe=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x1fec[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0xc1fe('0x0'));var util=require(_0xc1fe('0x1'));var moment=require(_0xc1fe('0x2'));var BPromise=require(_0xc1fe('0x3'));var rs=require(_0xc1fe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc1fe('0x5'))['db'];var utils=require(_0xc1fe('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc1fe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc1fe('0x8')][_0xc1fe('0x9')]({'port':0x232a});config[_0xc1fe('0xa')]=_[_0xc1fe('0xb')](config['redis'],{'host':_0xc1fe('0xc'),'port':0x18eb});var socket=require(_0xc1fe('0xd'))(new Redis(config[_0xc1fe('0xa')]));require(_0xc1fe('0xe'))['register'](socket);function respondWithRpcPromise(_0x320ec2,_0x3a04e1,_0x2e91c9){return new BPromise(function(_0x43d33e,_0x3aa257){return client[_0xc1fe('0xf')](_0x320ec2,_0x2e91c9)['then'](function(_0x2db38f){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x3a04e1,_0xc1fe('0x10'));logger['debug'](_0xc1fe('0x11'),_0x3a04e1,'request\x20sent',JSON[_0xc1fe('0x12')](_0x2db38f));if(_0x2db38f[_0xc1fe('0x13')]){if(_0x2db38f['error'][_0xc1fe('0x14')]===0x1f4){logger[_0xc1fe('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x3a04e1,_0x2db38f[_0xc1fe('0x13')][_0xc1fe('0x15')]);return _0x3aa257(_0x2db38f[_0xc1fe('0x13')][_0xc1fe('0x15')]);}logger[_0xc1fe('0x13')](_0xc1fe('0x16'),_0x3a04e1,_0x2db38f[_0xc1fe('0x13')][_0xc1fe('0x15')]);return _0x43d33e(_0x2db38f[_0xc1fe('0x13')][_0xc1fe('0x15')]);}else{logger[_0xc1fe('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x3a04e1,_0xc1fe('0x10'));_0x43d33e(_0x2db38f['result'][_0xc1fe('0x15')]);}})[_0xc1fe('0x18')](function(_0x10e58a){logger['error'](_0xc1fe('0x16'),_0x3a04e1,_0x10e58a);_0x3aa257(_0x10e58a);});});}exports[_0xc1fe('0x19')]=function(_0x2465bc){var _0x416310=this;return new Promise(function(_0x13ff65,_0x1c408c){return db[_0xc1fe('0x1a')]['update'](_0x2465bc[_0xc1fe('0x1b')],{'raw':_0x2465bc[_0xc1fe('0x1c')]?_0x2465bc[_0xc1fe('0x1c')][_0xc1fe('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2465bc['options']?_0x2465bc['options'][_0xc1fe('0x1e')]||null:null,'attributes':_0x2465bc[_0xc1fe('0x1c')]?_0x2465bc[_0xc1fe('0x1c')]['attributes']||null:null,'limit':_0x2465bc['options']?_0x2465bc[_0xc1fe('0x1c')][_0xc1fe('0x1f')]||null:null})['then'](function(_0x2221d5){logger['info']('UpdateChatInteraction',_0x2465bc);logger['debug']('UpdateChatInteraction',_0x2465bc,JSON['stringify'](_0x2221d5));_0x13ff65(_0x2221d5);})[_0xc1fe('0x18')](function(_0x503a0f){logger[_0xc1fe('0x13')]('UpdateChatInteraction',_0x503a0f['message'],_0x2465bc);_0x1c408c(_0x416310['error'](0x1f4,_0x503a0f[_0xc1fe('0x15')]));});});};exports[_0xc1fe('0x20')]=function(_0x2fb8d3){return new Promise(function(_0x451ace,_0xb47078){return db[_0xc1fe('0x1a')]['find']({'where':_0x2fb8d3[_0xc1fe('0x1c')]?_0x2fb8d3[_0xc1fe('0x1c')][_0xc1fe('0x1e')]||null:null})[_0xc1fe('0x21')](function(_0x23176e){if(_0x23176e){return _0x23176e['addTags'](_0x2fb8d3[_0xc1fe('0x1b')][_0xc1fe('0x22')],_[_0xc1fe('0x23')](_0x2fb8d3['body'],['ids','id'])||{});}})[_0xc1fe('0x24')](function(_0x42f05d){logger['info']('AddTags',_0x2fb8d3);logger[_0xc1fe('0x25')]('AddTags',_0x2fb8d3,JSON[_0xc1fe('0x12')](_0x42f05d));_0x451ace(_0x42f05d);})['catch'](function(_0x24205c){logger[_0xc1fe('0x13')](_0xc1fe('0x26'),_0x24205c[_0xc1fe('0x15')],_0x2fb8d3);_0xb47078(_this[_0xc1fe('0x13')](0x1f4,_0x24205c['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index aa301ce..205ba50 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 _0xb6f8=['register','./chatInteraction.events','save','update','emit','removeListener'];(function(_0x3152a2,_0x79816c){var _0x169e23=function(_0x42f916){while(--_0x42f916){_0x3152a2['push'](_0x3152a2['shift']());}};_0x169e23(++_0x79816c);}(_0xb6f8,0x199));var _0x8b6f=function(_0x2a5dc1,_0xc58ca4){_0x2a5dc1=_0x2a5dc1-0x0;var _0x244d63=_0xb6f8[_0x2a5dc1];return _0x244d63;};'use strict';var ChatInteractionEvents=require(_0x8b6f('0x0'));var events=[_0x8b6f('0x1'),'remove',_0x8b6f('0x2')];function createListener(_0x1f5212,_0x377809){return function(_0x3a9167){_0x377809[_0x8b6f('0x3')](_0x1f5212,_0x3a9167);};}function removeListener(_0x375bea,_0x357f83){return function(){ChatInteractionEvents[_0x8b6f('0x4')](_0x375bea,_0x357f83);};}exports[_0x8b6f('0x5')]=function(_0x5b11e9){for(var _0x2c7dd6=0x0,_0x1dd9b7=events['length'];_0x2c7dd6<_0x1dd9b7;_0x2c7dd6++){var _0x5e7009=events[_0x2c7dd6];var _0x528fe6=createListener('chatInteraction:'+_0x5e7009,_0x5b11e9);ChatInteractionEvents['on'](_0x5e7009,_0x528fe6);}}; \ No newline at end of file +var _0xbde8=['emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save','update'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xbde8,0x155));var _0x8bde=function(_0x13342f,_0x3d6303){_0x13342f=_0x13342f-0x0;var _0x2fc1fc=_0xbde8[_0x13342f];return _0x2fc1fc;};'use strict';var ChatInteractionEvents=require(_0x8bde('0x0'));var events=[_0x8bde('0x1'),'remove',_0x8bde('0x2')];function createListener(_0x298116,_0x1480d1){return function(_0x5de776){_0x1480d1[_0x8bde('0x3')](_0x298116,_0x5de776);};}function removeListener(_0x235330,_0x1e3137){return function(){ChatInteractionEvents[_0x8bde('0x4')](_0x235330,_0x1e3137);};}exports[_0x8bde('0x5')]=function(_0x26e75c){for(var _0x2a3965=0x0,_0x2fa161=events[_0x8bde('0x6')];_0x2a3965<_0x2fa161;_0x2a3965++){var _0x54050c=events[_0x2a3965];var _0x9812c9=createListener(_0x8bde('0x7')+_0x54050c,_0x26e75c);ChatInteractionEvents['on'](_0x54050c,_0x9812c9);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 1cc2e55..7a7afbd 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 _0x4dde=['/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','/:id/vidaoo','createVidaooSession','join','root','%s-%s','now','originalname','replace','post','/:id/attachment_upload','single','file','addMessage','/:id/tags','chat','addTags','tracked','chatinteraction:update','update','/:id/custom_update','put','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x49eb44,_0x724f7f){var _0x3ba34a=function(_0x1d15e4){while(--_0x1d15e4){_0x49eb44['push'](_0x49eb44['shift']());}};_0x3ba34a(++_0x724f7f);}(_0x4dde,0x172));var _0xe4dd=function(_0x488b36,_0x47a527){_0x488b36=_0x488b36-0x0;var _0x19b695=_0x4dde[_0x488b36];return _0x19b695;};'use strict';var multer=require(_0xe4dd('0x0'));var util=require(_0xe4dd('0x1'));var path=require(_0xe4dd('0x2'));var timeout=require('connect-timeout');var express=require(_0xe4dd('0x3'));var router=express[_0xe4dd('0x4')]();var fs_extra=require(_0xe4dd('0x5'));var auth=require(_0xe4dd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe4dd('0x7'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0xe4dd('0x8')](),controller[_0xe4dd('0x9')]);router[_0xe4dd('0xa')](_0xe4dd('0xb'),auth[_0xe4dd('0x8')](),controller[_0xe4dd('0xc')]);router[_0xe4dd('0xa')](_0xe4dd('0xd'),auth['isChatInteractionAuthorized'](),controller[_0xe4dd('0xe')]);router[_0xe4dd('0xa')](_0xe4dd('0xf'),auth[_0xe4dd('0x10')](),controller[_0xe4dd('0x11')]);router[_0xe4dd('0xa')](_0xe4dd('0x12'),auth['isAuthenticated'](),controller[_0xe4dd('0x13')]);router[_0xe4dd('0xa')](_0xe4dd('0x14'),auth['isChatInteractionAuthorized'](),controller[_0xe4dd('0x15')]);router[_0xe4dd('0xa')](_0xe4dd('0x16'),auth[_0xe4dd('0x8')](),controller[_0xe4dd('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe4dd('0x18')]);router['post'](_0xe4dd('0x19'),auth['isAuthenticated'](),controller[_0xe4dd('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3fb2d1,_0x4b25e5,_0x5e6f4d){_0x5e6f4d(null,path[_0xe4dd('0x1b')](config[_0xe4dd('0x1c')],'server/files/attachments/'));},'filename':function(_0x29e401,_0x3e247e,_0x21c67a){_0x21c67a(null,util['format'](_0xe4dd('0x1d'),Date[_0xe4dd('0x1e')](),_0x3e247e[_0xe4dd('0x1f')][_0xe4dd('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe4dd('0x21')](_0xe4dd('0x22'),upload[_0xe4dd('0x23')](_0xe4dd('0x24')),controller['attachmentUpload']);router[_0xe4dd('0x21')]('/:id/messages',auth[_0xe4dd('0x10')](),controller[_0xe4dd('0x25')]);router[_0xe4dd('0x21')](_0xe4dd('0x26'),auth[_0xe4dd('0x8')](),interaction['tracked'](_0xe4dd('0x27'),'chatinteraction:addtags'),controller[_0xe4dd('0x28')]);router['put'](_0xe4dd('0xd'),auth[_0xe4dd('0x8')](),interaction[_0xe4dd('0x29')]('chat',_0xe4dd('0x2a')),controller[_0xe4dd('0x2b')]);router['put'](_0xe4dd('0x2c'),controller['customUpdate']);router[_0xe4dd('0x2d')](_0xe4dd('0x2e'),auth[_0xe4dd('0x10')](),controller[_0xe4dd('0x2f')]);router[_0xe4dd('0x2d')](_0xe4dd('0x30'),controller[_0xe4dd('0x31')]);router[_0xe4dd('0x32')](_0xe4dd('0xd'),auth[_0xe4dd('0x8')](),interaction[_0xe4dd('0x29')](_0xe4dd('0x27'),_0xe4dd('0x33')),controller[_0xe4dd('0x34')]);router[_0xe4dd('0x32')]('/:id/tags',auth[_0xe4dd('0x8')](),controller[_0xe4dd('0x35')]);module[_0xe4dd('0x36')]=router; \ No newline at end of file +var _0xabcb=['getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','%s-%s','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','destroy','removeTags','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','getMessages','/:id/my_messages'];(function(_0x19b16e,_0x20c094){var _0xc9fa16=function(_0x110488){while(--_0x110488){_0x19b16e['push'](_0x19b16e['shift']());}};_0xc9fa16(++_0x20c094);}(_0xabcb,0x160));var _0xbabc=function(_0x4f4cf2,_0x118cc4){_0x4f4cf2=_0x4f4cf2-0x0;var _0x5ddc2d=_0xabcb[_0x4f4cf2];return _0x5ddc2d;};'use strict';var multer=require('multer');var util=require(_0xbabc('0x0'));var path=require(_0xbabc('0x1'));var timeout=require('connect-timeout');var express=require(_0xbabc('0x2'));var router=express[_0xbabc('0x3')]();var fs_extra=require(_0xbabc('0x4'));var auth=require(_0xbabc('0x5'));var interaction=require(_0xbabc('0x6'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router['get']('/',auth[_0xbabc('0x7')](),controller[_0xbabc('0x8')]);router[_0xbabc('0x9')](_0xbabc('0xa'),auth[_0xbabc('0x7')](),controller[_0xbabc('0xb')]);router[_0xbabc('0x9')](_0xbabc('0xc'),auth['isChatInteractionAuthorized'](),controller[_0xbabc('0xd')]);router[_0xbabc('0x9')](_0xbabc('0xe'),auth[_0xbabc('0xf')](),controller[_0xbabc('0x10')]);router[_0xbabc('0x9')]('/:id/messages',auth[_0xbabc('0x7')](),controller[_0xbabc('0x11')]);router[_0xbabc('0x9')](_0xbabc('0x12'),auth[_0xbabc('0xf')](),controller[_0xbabc('0x13')]);router[_0xbabc('0x9')](_0xbabc('0x14'),auth[_0xbabc('0x7')](),controller[_0xbabc('0x15')]);router[_0xbabc('0x16')]('/',auth[_0xbabc('0x7')](),controller[_0xbabc('0x17')]);router['post'](_0xbabc('0x18'),auth[_0xbabc('0x7')](),controller[_0xbabc('0x19')]);var upload=multer({'storage':multer[_0xbabc('0x1a')]({'destination':function(_0x1e1a09,_0x2afb78,_0x30c421){_0x30c421(null,path[_0xbabc('0x1b')](config['root'],_0xbabc('0x1c')));},'filename':function(_0x59cdd5,_0x5e48a1,_0xbb2424){_0xbb2424(null,util['format'](_0xbabc('0x1d'),Date['now'](),_0x5e48a1[_0xbabc('0x1e')][_0xbabc('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbabc('0x16')](_0xbabc('0x20'),upload[_0xbabc('0x21')](_0xbabc('0x22')),controller[_0xbabc('0x23')]);router[_0xbabc('0x16')]('/:id/messages',auth[_0xbabc('0xf')](),controller[_0xbabc('0x24')]);router[_0xbabc('0x16')](_0xbabc('0x25'),auth[_0xbabc('0x7')](),interaction[_0xbabc('0x26')](_0xbabc('0x27'),_0xbabc('0x28')),controller['addTags']);router[_0xbabc('0x29')](_0xbabc('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0xbabc('0x27'),_0xbabc('0x2a')),controller[_0xbabc('0x2b')]);router[_0xbabc('0x29')](_0xbabc('0x2c'),controller[_0xbabc('0x2d')]);router['put'](_0xbabc('0x2e'),auth[_0xbabc('0xf')](),controller[_0xbabc('0x2f')]);router[_0xbabc('0x29')](_0xbabc('0x30'),controller['close']);router[_0xbabc('0x31')](_0xbabc('0xc'),auth['isAuthenticated'](),interaction[_0xbabc('0x26')]('chat','chatinteraction:destroy'),controller[_0xbabc('0x32')]);router[_0xbabc('0x31')]('/:id/tags',auth[_0xbabc('0x7')](),controller[_0xbabc('0x33')]);module[_0xbabc('0x34')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 3e990de..4db2636 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 _0xd81d=['TEXT','BOOLEAN','INTEGER','exports'];(function(_0x567431,_0xeb8490){var _0x2e207d=function(_0x1ef6b6){while(--_0x1ef6b6){_0x567431['push'](_0x567431['shift']());}};_0x2e207d(++_0xeb8490);}(_0xd81d,0xf3));var _0xdd81=function(_0x1ece5e,_0x56d1bd){_0x1ece5e=_0x1ece5e-0x0;var _0x4de0eb=_0xd81d[_0x1ece5e];return _0x4de0eb;};'use strict';var Sequelize=require('sequelize');module[_0xdd81('0x0')]={'body':{'type':Sequelize[_0xdd81('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xdd81('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xdd81('0x3')]}}; \ No newline at end of file +var _0x4351=['sequelize','exports','BOOLEAN','INTEGER'];(function(_0x5640cb,_0xb87cca){var _0x17f6f8=function(_0x3383bf){while(--_0x3383bf){_0x5640cb['push'](_0x5640cb['shift']());}};_0x17f6f8(++_0xb87cca);}(_0x4351,0x1ec));var _0x1435=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x4351[_0x1caf6a];return _0x1bf493;};'use strict';var Sequelize=require(_0x1435('0x0'));module[_0x1435('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1435('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x1435('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index bab4558..16e0b06 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 _0x29ea=['reject','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','findAll','catch','params','keys','include','options','create','body','update','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','role','userpic','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','read','-createdAt','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x29ea,0x18f));var _0xa29e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x29ea[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa29e('0x0'));var jsonpatch=require(_0xa29e('0x1'));var rp=require(_0xa29e('0x2'));var moment=require('moment');var BPromise=require(_0xa29e('0x3'));var Mustache=require(_0xa29e('0x4'));var util=require(_0xa29e('0x5'));var path=require(_0xa29e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa29e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa29e('0x8'));var squel=require('squel');var crypto=require(_0xa29e('0x9'));var jsforce=require(_0xa29e('0xa'));var deskjs=require(_0xa29e('0xb'));var toCsv=require(_0xa29e('0xc'));var querystring=require('querystring');var Papa=require(_0xa29e('0xd'));var Redis=require(_0xa29e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa29e('0xf'));var as=require(_0xa29e('0x10'));var hardwareService=require(_0xa29e('0x11'));var logger=require(_0xa29e('0x12'))(_0xa29e('0x13'));var utils=require(_0xa29e('0x14'));var config=require(_0xa29e('0x15'));var licenseUtil=require(_0xa29e('0x16'));var db=require(_0xa29e('0x17'))['db'];config[_0xa29e('0x18')]=_[_0xa29e('0x19')](config[_0xa29e('0x18')],{'host':_0xa29e('0x1a'),'port':0x18eb});var socket=require(_0xa29e('0x1b'))(new Redis(config[_0xa29e('0x18')]));require(_0xa29e('0x1c'))[_0xa29e('0x1d')](socket);function respondWithStatusCode(_0x32f84b,_0x45ad07){_0x45ad07=_0x45ad07||0xcc;return function(_0x332b78){if(_0x332b78){return _0x32f84b[_0xa29e('0x1e')](_0x45ad07);}return _0x32f84b[_0xa29e('0x1f')](_0x45ad07)[_0xa29e('0x20')]();};}function respondWithResult(_0x165487,_0x583dc6){_0x583dc6=_0x583dc6||0xc8;return function(_0x551ceb){if(_0x551ceb){return _0x165487[_0xa29e('0x1f')](_0x583dc6)[_0xa29e('0x21')](_0x551ceb);}};}function respondWithFilteredResult(_0xb7d7b8,_0x537d51){return function(_0x1fd6e2){if(_0x1fd6e2){var _0x19bca2=typeof _0x537d51[_0xa29e('0x22')]===_0xa29e('0x23')&&typeof _0x537d51['limit']===_0xa29e('0x23');var _0x52904a=_0x1fd6e2[_0xa29e('0x24')];var _0x25d236=_0x19bca2?0x0:_0x537d51[_0xa29e('0x22')];var _0x2e9b30=_0x19bca2?_0x1fd6e2[_0xa29e('0x24')]:_0x537d51[_0xa29e('0x22')]+_0x537d51[_0xa29e('0x25')];var _0x2c56d9;if(_0x2e9b30>=_0x52904a){_0x2e9b30=_0x52904a;_0x2c56d9=0xc8;}else{_0x2c56d9=0xce;}_0xb7d7b8[_0xa29e('0x1f')](_0x2c56d9);return _0xb7d7b8[_0xa29e('0x26')](_0xa29e('0x27'),_0x25d236+'-'+_0x2e9b30+'/'+_0x52904a)[_0xa29e('0x21')](_0x1fd6e2);}return null;};}function patchUpdates(_0x217f08){return function(_0x3f0f69){try{jsonpatch[_0xa29e('0x28')](_0x3f0f69,_0x217f08,!![]);}catch(_0x25afa9){return BPromise[_0xa29e('0x29')](_0x25afa9);}return _0x3f0f69['save']();};}function saveUpdates(_0x48c4a8,_0x3d5e4a){return function(_0x5e763f){if(_0x5e763f){return _0x5e763f['update'](_0x48c4a8)[_0xa29e('0x2a')](function(_0x4b223b){return _0x4b223b;});}return null;};}function removeEntity(_0x2f80fe,_0x130cfa){return function(_0x16b7fe){if(_0x16b7fe){return _0x16b7fe[_0xa29e('0x2b')]()[_0xa29e('0x2a')](function(){_0x2f80fe['status'](0xcc)[_0xa29e('0x20')]();});}};}function handleEntityNotFound(_0x2096a1,_0x106752){return function(_0x1e8574){if(!_0x1e8574){_0x2096a1[_0xa29e('0x1e')](0x194);}return _0x1e8574;};}function handleError(_0x3a91ee,_0x2e5b7f){_0x2e5b7f=_0x2e5b7f||0x1f4;return function(_0x41a1b0){logger[_0xa29e('0x2c')](_0x41a1b0[_0xa29e('0x2d')]);if(_0x41a1b0[_0xa29e('0x2e')]){delete _0x41a1b0['name'];}_0x3a91ee[_0xa29e('0x1f')](_0x2e5b7f)[_0xa29e('0x2f')](_0x41a1b0);};}exports[_0xa29e('0x30')]=function(_0x29a42b,_0x7e3e16){var _0x36509c={},_0x27b24b={},_0x3de580={'count':0x0,'rows':[]};var _0x156509=_[_0xa29e('0x31')](db[_0xa29e('0x32')]['rawAttributes'],function(_0x37b343){return{'name':_0x37b343['fieldName'],'type':_0x37b343[_0xa29e('0x33')][_0xa29e('0x34')]};});_0x27b24b['model']=_[_0xa29e('0x31')](_0x156509,'name');_0x27b24b[_0xa29e('0x35')]=_['keys'](_0x29a42b[_0xa29e('0x35')]);_0x27b24b['filters']=_[_0xa29e('0x36')](_0x27b24b[_0xa29e('0x37')],_0x27b24b[_0xa29e('0x35')]);_0x36509c[_0xa29e('0x38')]=_[_0xa29e('0x36')](_0x27b24b[_0xa29e('0x37')],qs[_0xa29e('0x39')](_0x29a42b['query'][_0xa29e('0x39')]));_0x36509c[_0xa29e('0x38')]=_0x36509c[_0xa29e('0x38')][_0xa29e('0x3a')]?_0x36509c[_0xa29e('0x38')]:_0x27b24b['model'];if(!_0x29a42b[_0xa29e('0x35')][_0xa29e('0x3b')](_0xa29e('0x3c'))){_0x36509c[_0xa29e('0x25')]=qs[_0xa29e('0x25')](_0x29a42b[_0xa29e('0x35')][_0xa29e('0x25')]);_0x36509c[_0xa29e('0x22')]=qs[_0xa29e('0x22')](_0x29a42b[_0xa29e('0x35')][_0xa29e('0x22')]);}_0x36509c['order']=qs[_0xa29e('0x3d')](_0x29a42b[_0xa29e('0x35')][_0xa29e('0x3d')]);_0x36509c[_0xa29e('0x3e')]=qs['filters'](_[_0xa29e('0x3f')](_0x29a42b['query'],_0x27b24b[_0xa29e('0x40')]),_0x156509);if(_0x29a42b[_0xa29e('0x35')][_0xa29e('0x41')]){_0x36509c[_0xa29e('0x3e')]=_[_0xa29e('0x42')](_0x36509c['where'],{'$or':_[_0xa29e('0x31')](_0x156509,function(_0x5bc069){if(_0x5bc069[_0xa29e('0x33')]!==_0xa29e('0x43')){var _0x108ead={};_0x108ead[_0x5bc069[_0xa29e('0x2e')]]={'$like':'%'+_0x29a42b[_0xa29e('0x35')][_0xa29e('0x41')]+'%'};return _0x108ead;}})});}_0x36509c=_[_0xa29e('0x42')]({},_0x36509c,_0x29a42b['options']);var _0x4f2be7={'where':_0x36509c[_0xa29e('0x3e')]};return db[_0xa29e('0x32')][_0xa29e('0x24')](_0x4f2be7)[_0xa29e('0x2a')](function(_0x2ead53){_0x3de580['count']=_0x2ead53;if(_0x29a42b[_0xa29e('0x35')][_0xa29e('0x44')]){_0x36509c['include']=[{'all':!![]}];}return db['ChatInternalMessage'][_0xa29e('0x45')](_0x36509c);})[_0xa29e('0x2a')](function(_0xf17a94){_0x3de580['rows']=_0xf17a94;return _0x3de580;})[_0xa29e('0x2a')](respondWithFilteredResult(_0x7e3e16,_0x36509c))[_0xa29e('0x46')](handleError(_0x7e3e16,null));};exports['show']=function(_0x363574,_0x1aec7b){var _0x230b89={'raw':!![],'where':{'id':_0x363574[_0xa29e('0x47')]['id']}},_0x55a74e={};_0x55a74e[_0xa29e('0x37')]=_[_0xa29e('0x48')](db['ChatInternalMessage']['rawAttributes']);_0x55a74e[_0xa29e('0x35')]=_[_0xa29e('0x48')](_0x363574['query']);_0x55a74e[_0xa29e('0x40')]=_[_0xa29e('0x36')](_0x55a74e[_0xa29e('0x37')],_0x55a74e[_0xa29e('0x35')]);_0x230b89[_0xa29e('0x38')]=_[_0xa29e('0x36')](_0x55a74e[_0xa29e('0x37')],qs[_0xa29e('0x39')](_0x363574['query'][_0xa29e('0x39')]));_0x230b89[_0xa29e('0x38')]=_0x230b89[_0xa29e('0x38')][_0xa29e('0x3a')]?_0x230b89['attributes']:_0x55a74e[_0xa29e('0x37')];if(_0x363574['query'][_0xa29e('0x44')]){_0x230b89[_0xa29e('0x49')]=[{'all':!![]}];}_0x230b89=_[_0xa29e('0x42')]({},_0x230b89,_0x363574[_0xa29e('0x4a')]);return db[_0xa29e('0x32')]['find'](_0x230b89)[_0xa29e('0x2a')](handleEntityNotFound(_0x1aec7b,null))['then'](respondWithResult(_0x1aec7b,null))['catch'](handleError(_0x1aec7b,null));};exports[_0xa29e('0x4b')]=function(_0x26c9df,_0x141bb0){return db['ChatInternalMessage'][_0xa29e('0x4b')](_0x26c9df[_0xa29e('0x4c')],{})['then'](respondWithResult(_0x141bb0,0xc9))['catch'](handleError(_0x141bb0,null));};exports[_0xa29e('0x4d')]=function(_0x795b26,_0x4149b9){if(_0x795b26[_0xa29e('0x4c')]['id']){delete _0x795b26['body']['id'];}return db[_0xa29e('0x32')][_0xa29e('0x4e')]({'where':{'id':_0x795b26[_0xa29e('0x47')]['id']}})[_0xa29e('0x2a')](handleEntityNotFound(_0x4149b9,null))[_0xa29e('0x2a')](saveUpdates(_0x795b26[_0xa29e('0x4c')],null))[_0xa29e('0x2a')](respondWithResult(_0x4149b9,null))['catch'](handleError(_0x4149b9,null));};exports[_0xa29e('0x2b')]=function(_0x18963e,_0x103ca2){return db[_0xa29e('0x32')][_0xa29e('0x4e')]({'where':{'id':_0x18963e[_0xa29e('0x47')]['id']}})[_0xa29e('0x2a')](handleEntityNotFound(_0x103ca2,null))[_0xa29e('0x2a')](removeEntity(_0x103ca2,null))[_0xa29e('0x46')](handleError(_0x103ca2,null));};exports[_0xa29e('0x4f')]=function(_0xe87242,_0x71fa68){return db[_0xa29e('0x32')][_0xa29e('0x4f')]()[_0xa29e('0x2a')](respondWithResult(_0x71fa68,null))[_0xa29e('0x46')](handleError(_0x71fa68,null));};function wrapUser(_0x16cf44){return function(_0x14d69a){var _0x408567=_0x16cf44[_0xa29e('0x50')]({'plain':!![]});_0x408567[_0xa29e('0x51')]=[];if(_0x14d69a){_0x408567[_0xa29e('0x52')]=_0x14d69a[_0xa29e('0x53')];_0x408567[_0xa29e('0x54')]=_0x14d69a;}else{_0x408567['lastMessageAt']=moment(0x0)[_0xa29e('0x55')](_0xa29e('0x56'));_0x408567[_0xa29e('0x54')]={};}return _0x408567;};}exports[_0xa29e('0x57')]=function(_0x5d2a15,_0x2d52f4,_0x1f2219){var _0x130684=[];return db[_0xa29e('0x58')][_0xa29e('0x45')]({'where':{'role':[_0xa29e('0x59'),_0xa29e('0x5a'),_0xa29e('0x5b')]},'attributes':['id','fullname','name',_0xa29e('0x5c'),_0xa29e('0x5d'),'internal','online',_0xa29e('0x5e'),_0xa29e('0x5f'),_0xa29e('0x60')],'order':qs[_0xa29e('0x3d')](_0xa29e('0x61')),'include':[{'model':db[_0xa29e('0x62')],'as':_0xa29e('0x63'),'attributes':['id','name',_0xa29e('0x33')],'through':{'attributes':[]}}]})[_0xa29e('0x2a')](function(_0x18f498){if(_0x18f498){var _0x1936c6=_0x5d2a15[_0xa29e('0x5b')][_0xa29e('0x50')]({'plain':!![]});if(!_0x1936c6)throw new Error(_0xa29e('0x64'));if(_0x1936c6[_0xa29e('0x5c')]===_0xa29e('0x5b')){return db[_0xa29e('0x65')]['find']({'where':{'name':_0xa29e('0x66'),'userProfileId':_0x1936c6[_0xa29e('0x67')]},'raw':!![]})[_0xa29e('0x2a')](function(_0x10b7e3){if(_0x10b7e3){if(_0x10b7e3[_0xa29e('0x68')]===0x0){return db[_0xa29e('0x69')][_0xa29e('0x45')]({'where':{'sectionId':_0x10b7e3['id']},'raw':!![]})[_0xa29e('0x2a')](function(_0x26f2fe){var _0x1b3880=[];if(_['isEmpty'](_0x26f2fe)){_0x1b3880=_[_0xa29e('0x41')](_0x18f498,function(_0x55dd09){if(_0x55dd09[_0xa29e('0x5c')]!=='agent'){return _0x55dd09;}});return _0x1b3880;}else{for(var _0x4c15a9=0x0;_0x4c15a9<_0x18f498[_0xa29e('0x3a')];_0x4c15a9++){var _0x1b9bfd=_0x18f498[_0x4c15a9];if(_0x1b9bfd[_0xa29e('0x5c')]===_0xa29e('0x59')){var _0x54dc9f=_[_0xa29e('0x4e')](_0x26f2fe,function(_0x3bb0eb){return _0x3bb0eb[_0xa29e('0x6a')]===_0x1b9bfd['id'];});if(_0x54dc9f)_0x1b3880[_0xa29e('0x6b')](_0x1b9bfd);}else{_0x1b3880['push'](_0x1b9bfd);}}return _0x1b3880;}});}else{return _0x18f498;}}else{var _0x58a14f=_['filter'](_0x18f498,function(_0x48f871){if(_0x48f871[_0xa29e('0x5c')]!==_0xa29e('0x59')){return _0x48f871;}});return _0x58a14f;}});}else{return _0x18f498;}}})['then'](function(_0x288959){var _0x9cb85e=[];if(_0x288959){_0x130684=_0x288959;for(var _0x40140c=0x0;_0x40140c<_0x288959['length'];_0x40140c+=0x1){_0x130684[_0x40140c][_0xa29e('0x51')]=[];_0x9cb85e[_0xa29e('0x6b')](db[_0xa29e('0x32')]['find']({'where':{'FromId':[_0x5d2a15[_0xa29e('0x5b')]['id'],_0x288959[_0x40140c]['id']],'ToId':[_0x5d2a15[_0xa29e('0x5b')]['id'],_0x288959[_0x40140c]['id']],'ChatGroupId':null},'attributes':['id',_0xa29e('0x53'),'FromId','ToId',_0xa29e('0x6c'),'body'],'order':qs['sort'](_0xa29e('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa29e('0x2a')](wrapUser(_0x288959[_0x40140c])));}return BPromise['all'](_0x9cb85e);}return[];})['then'](function(_0x5a6bbf){return{'rows':_0x5a6bbf,'count':_0x5a6bbf['length']};})[_0xa29e('0x2a')](respondWithResult(_0x2d52f4,null))[_0xa29e('0x46')](handleError(_0x2d52f4,null));}; \ No newline at end of file +var _0x68a2=['catch','show','params','keys','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','User','agent','admin','user','role','internal','lastLoginAt','-online','VoiceQueues','type','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','ChatInternalMessage','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll','include','findAll'];(function(_0x2d8b2f,_0x1be1c7){var _0x4fb232=function(_0x23cfa3){while(--_0x23cfa3){_0x2d8b2f['push'](_0x2d8b2f['shift']());}};_0x4fb232(++_0x1be1c7);}(_0x68a2,0x1b6));var _0x268a=function(_0x270173,_0x2c245e){_0x270173=_0x270173-0x0;var _0x7892f1=_0x68a2[_0x270173];return _0x7892f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x268a('0x0'));var zipdir=require(_0x268a('0x1'));var jsonpatch=require(_0x268a('0x2'));var rp=require('request-promise');var moment=require(_0x268a('0x3'));var BPromise=require(_0x268a('0x4'));var Mustache=require(_0x268a('0x5'));var util=require(_0x268a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x268a('0x7'));var ejs=require(_0x268a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x268a('0x9'));var squel=require(_0x268a('0xa'));var crypto=require(_0x268a('0xb'));var jsforce=require(_0x268a('0xc'));var deskjs=require(_0x268a('0xd'));var toCsv=require(_0x268a('0x7'));var querystring=require(_0x268a('0xe'));var Papa=require(_0x268a('0xf'));var Redis=require(_0x268a('0x10'));var authService=require(_0x268a('0x11'));var qs=require(_0x268a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x268a('0x13'))('api');var utils=require(_0x268a('0x14'));var config=require(_0x268a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x268a('0x16'))['db'];config['redis']=_['defaults'](config[_0x268a('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x268a('0x18'))(new Redis(config['redis']));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x45e933,_0x48d4e3){_0x48d4e3=_0x48d4e3||0xcc;return function(_0x334a7d){if(_0x334a7d){return _0x45e933[_0x268a('0x19')](_0x48d4e3);}return _0x45e933[_0x268a('0x1a')](_0x48d4e3)[_0x268a('0x1b')]();};}function respondWithResult(_0x362d48,_0x36eb3e){_0x36eb3e=_0x36eb3e||0xc8;return function(_0x5ef9a3){if(_0x5ef9a3){return _0x362d48[_0x268a('0x1a')](_0x36eb3e)[_0x268a('0x1c')](_0x5ef9a3);}};}function respondWithFilteredResult(_0x3496f7,_0x5b63c8){return function(_0x23b220){if(_0x23b220){var _0x45235d=typeof _0x5b63c8[_0x268a('0x1d')]===_0x268a('0x1e')&&typeof _0x5b63c8[_0x268a('0x1f')]===_0x268a('0x1e');var _0x117bd4=_0x23b220['count'];var _0x2fee5a=_0x45235d?0x0:_0x5b63c8[_0x268a('0x1d')];var _0x57aca4=_0x45235d?_0x23b220[_0x268a('0x20')]:_0x5b63c8[_0x268a('0x1d')]+_0x5b63c8[_0x268a('0x1f')];var _0x12b161;if(_0x57aca4>=_0x117bd4){_0x57aca4=_0x117bd4;_0x12b161=0xc8;}else{_0x12b161=0xce;}_0x3496f7[_0x268a('0x1a')](_0x12b161);return _0x3496f7['set'](_0x268a('0x21'),_0x2fee5a+'-'+_0x57aca4+'/'+_0x117bd4)[_0x268a('0x1c')](_0x23b220);}return null;};}function patchUpdates(_0x25c897){return function(_0x2ff448){try{jsonpatch[_0x268a('0x22')](_0x2ff448,_0x25c897,!![]);}catch(_0x23b301){return BPromise[_0x268a('0x23')](_0x23b301);}return _0x2ff448[_0x268a('0x24')]();};}function saveUpdates(_0x49c922,_0x464375){return function(_0xaab6d0){if(_0xaab6d0){return _0xaab6d0[_0x268a('0x25')](_0x49c922)[_0x268a('0x26')](function(_0x372c10){return _0x372c10;});}return null;};}function removeEntity(_0x5d0b13,_0x677c8a){return function(_0x584c43){if(_0x584c43){return _0x584c43[_0x268a('0x27')]()[_0x268a('0x26')](function(){_0x5d0b13['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6f6c7b,_0x10f487){return function(_0x330a73){if(!_0x330a73){_0x6f6c7b['sendStatus'](0x194);}return _0x330a73;};}function handleError(_0x2dab9a,_0x8fefff){_0x8fefff=_0x8fefff||0x1f4;return function(_0x1096e0){logger[_0x268a('0x28')](_0x1096e0[_0x268a('0x29')]);if(_0x1096e0['name']){delete _0x1096e0['name'];}_0x2dab9a[_0x268a('0x1a')](_0x8fefff)[_0x268a('0x2a')](_0x1096e0);};}exports['index']=function(_0x2c7160,_0x3d542b){var _0x402765={},_0x460a92={},_0x1e0756={'count':0x0,'rows':[]};var _0xa5fd45=_[_0x268a('0x2b')](db[_0x268a('0x2c')][_0x268a('0x2d')],function(_0x4eb495){return{'name':_0x4eb495[_0x268a('0x2e')],'type':_0x4eb495['type'][_0x268a('0x2f')]};});_0x460a92[_0x268a('0x30')]=_[_0x268a('0x2b')](_0xa5fd45,'name');_0x460a92[_0x268a('0x31')]=_['keys'](_0x2c7160[_0x268a('0x31')]);_0x460a92[_0x268a('0x32')]=_[_0x268a('0x33')](_0x460a92['model'],_0x460a92[_0x268a('0x31')]);_0x402765[_0x268a('0x34')]=_[_0x268a('0x33')](_0x460a92['model'],qs[_0x268a('0x35')](_0x2c7160[_0x268a('0x31')][_0x268a('0x35')]));_0x402765['attributes']=_0x402765[_0x268a('0x34')][_0x268a('0x36')]?_0x402765[_0x268a('0x34')]:_0x460a92[_0x268a('0x30')];if(!_0x2c7160[_0x268a('0x31')]['hasOwnProperty'](_0x268a('0x37'))){_0x402765[_0x268a('0x1f')]=qs[_0x268a('0x1f')](_0x2c7160[_0x268a('0x31')][_0x268a('0x1f')]);_0x402765[_0x268a('0x1d')]=qs[_0x268a('0x1d')](_0x2c7160[_0x268a('0x31')][_0x268a('0x1d')]);}_0x402765[_0x268a('0x38')]=qs['sort'](_0x2c7160[_0x268a('0x31')][_0x268a('0x39')]);_0x402765[_0x268a('0x3a')]=qs[_0x268a('0x32')](_['pick'](_0x2c7160[_0x268a('0x31')],_0x460a92[_0x268a('0x32')]),_0xa5fd45);if(_0x2c7160[_0x268a('0x31')][_0x268a('0x3b')]){_0x402765[_0x268a('0x3a')]=_[_0x268a('0x3c')](_0x402765[_0x268a('0x3a')],{'$or':_[_0x268a('0x2b')](_0xa5fd45,function(_0x5948bb){if(_0x5948bb['type']!==_0x268a('0x3d')){var _0x1682e0={};_0x1682e0[_0x5948bb[_0x268a('0x3e')]]={'$like':'%'+_0x2c7160[_0x268a('0x31')][_0x268a('0x3b')]+'%'};return _0x1682e0;}})});}_0x402765=_[_0x268a('0x3c')]({},_0x402765,_0x2c7160[_0x268a('0x3f')]);var _0x22abf0={'where':_0x402765[_0x268a('0x3a')]};return db['ChatInternalMessage'][_0x268a('0x20')](_0x22abf0)[_0x268a('0x26')](function(_0x4e4973){_0x1e0756[_0x268a('0x20')]=_0x4e4973;if(_0x2c7160[_0x268a('0x31')][_0x268a('0x40')]){_0x402765[_0x268a('0x41')]=[{'all':!![]}];}return db[_0x268a('0x2c')][_0x268a('0x42')](_0x402765);})[_0x268a('0x26')](function(_0x2888b6){_0x1e0756['rows']=_0x2888b6;return _0x1e0756;})[_0x268a('0x26')](respondWithFilteredResult(_0x3d542b,_0x402765))[_0x268a('0x43')](handleError(_0x3d542b,null));};exports[_0x268a('0x44')]=function(_0x2e9ff8,_0x43b963){var _0x3e9460={'raw':!![],'where':{'id':_0x2e9ff8[_0x268a('0x45')]['id']}},_0x98b4c={};_0x98b4c['model']=_[_0x268a('0x46')](db[_0x268a('0x2c')]['rawAttributes']);_0x98b4c['query']=_[_0x268a('0x46')](_0x2e9ff8[_0x268a('0x31')]);_0x98b4c[_0x268a('0x32')]=_[_0x268a('0x33')](_0x98b4c[_0x268a('0x30')],_0x98b4c['query']);_0x3e9460['attributes']=_[_0x268a('0x33')](_0x98b4c[_0x268a('0x30')],qs[_0x268a('0x35')](_0x2e9ff8[_0x268a('0x31')][_0x268a('0x35')]));_0x3e9460[_0x268a('0x34')]=_0x3e9460['attributes']['length']?_0x3e9460[_0x268a('0x34')]:_0x98b4c[_0x268a('0x30')];if(_0x2e9ff8[_0x268a('0x31')][_0x268a('0x40')]){_0x3e9460[_0x268a('0x41')]=[{'all':!![]}];}_0x3e9460=_['merge']({},_0x3e9460,_0x2e9ff8[_0x268a('0x3f')]);return db[_0x268a('0x2c')][_0x268a('0x47')](_0x3e9460)[_0x268a('0x26')](handleEntityNotFound(_0x43b963,null))[_0x268a('0x26')](respondWithResult(_0x43b963,null))['catch'](handleError(_0x43b963,null));};exports['create']=function(_0x414138,_0x2c2b00){return db[_0x268a('0x2c')][_0x268a('0x48')](_0x414138[_0x268a('0x49')],{})[_0x268a('0x26')](respondWithResult(_0x2c2b00,0xc9))[_0x268a('0x43')](handleError(_0x2c2b00,null));};exports[_0x268a('0x25')]=function(_0x9bef16,_0x5655b4){if(_0x9bef16['body']['id']){delete _0x9bef16['body']['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x9bef16[_0x268a('0x45')]['id']}})['then'](handleEntityNotFound(_0x5655b4,null))[_0x268a('0x26')](saveUpdates(_0x9bef16[_0x268a('0x49')],null))[_0x268a('0x26')](respondWithResult(_0x5655b4,null))[_0x268a('0x43')](handleError(_0x5655b4,null));};exports[_0x268a('0x27')]=function(_0xa3cf8e,_0x254828){return db[_0x268a('0x2c')][_0x268a('0x47')]({'where':{'id':_0xa3cf8e[_0x268a('0x45')]['id']}})['then'](handleEntityNotFound(_0x254828,null))[_0x268a('0x26')](removeEntity(_0x254828,null))['catch'](handleError(_0x254828,null));};exports['describe']=function(_0x23964b,_0xc65a55){return db[_0x268a('0x2c')][_0x268a('0x4a')]()[_0x268a('0x26')](respondWithResult(_0xc65a55,null))[_0x268a('0x43')](handleError(_0xc65a55,null));};function wrapUser(_0x12237c){return function(_0x275cf7){var _0x590217=_0x12237c[_0x268a('0x4b')]({'plain':!![]});_0x590217[_0x268a('0x4c')]=[];if(_0x275cf7){_0x590217[_0x268a('0x4d')]=_0x275cf7[_0x268a('0x4e')];_0x590217[_0x268a('0x4f')]=_0x275cf7;}else{_0x590217[_0x268a('0x4d')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x590217[_0x268a('0x4f')]={};}return _0x590217;};}exports['getUsers']=function(_0x1b0dc5,_0x2edae5,_0x2f4c1d){var _0xfb2495=[];return db[_0x268a('0x50')]['findAll']({'where':{'role':[_0x268a('0x51'),_0x268a('0x52'),_0x268a('0x53')]},'attributes':['id','fullname',_0x268a('0x3e'),_0x268a('0x54'),'userpic',_0x268a('0x55'),'online',_0x268a('0x56'),'allowmessenger','showWebBar'],'order':qs[_0x268a('0x39')](_0x268a('0x57')),'include':[{'model':db['VoiceQueue'],'as':_0x268a('0x58'),'attributes':['id','name',_0x268a('0x59')],'through':{'attributes':[]}}]})[_0x268a('0x26')](function(_0x374c95){if(_0x374c95){var _0x2bc547=_0x1b0dc5[_0x268a('0x53')][_0x268a('0x4b')]({'plain':!![]});if(!_0x2bc547)throw new Error(_0x268a('0x5a'));if(_0x2bc547[_0x268a('0x54')]==='user'){return db[_0x268a('0x5b')]['find']({'where':{'name':'Agents','userProfileId':_0x2bc547['userProfileId']},'raw':!![]})[_0x268a('0x26')](function(_0x46509c){if(_0x46509c){if(_0x46509c[_0x268a('0x5c')]===0x0){return db['UserProfileResource'][_0x268a('0x42')]({'where':{'sectionId':_0x46509c['id']},'raw':!![]})[_0x268a('0x26')](function(_0x1126e6){var _0x331b7f=[];if(_[_0x268a('0x5d')](_0x1126e6)){_0x331b7f=_[_0x268a('0x3b')](_0x374c95,function(_0x321b06){if(_0x321b06['role']!=='agent'){return _0x321b06;}});return _0x331b7f;}else{for(var _0x257b7f=0x0;_0x257b7f<_0x374c95[_0x268a('0x36')];_0x257b7f++){var _0x173489=_0x374c95[_0x257b7f];if(_0x173489['role']===_0x268a('0x51')){var _0x1deb68=_[_0x268a('0x47')](_0x1126e6,function(_0x520009){return _0x520009[_0x268a('0x5e')]===_0x173489['id'];});if(_0x1deb68)_0x331b7f['push'](_0x173489);}else{_0x331b7f[_0x268a('0x5f')](_0x173489);}}return _0x331b7f;}});}else{return _0x374c95;}}else{var _0x57ca43=_['filter'](_0x374c95,function(_0x44f164){if(_0x44f164[_0x268a('0x54')]!=='agent'){return _0x44f164;}});return _0x57ca43;}});}else{return _0x374c95;}}})[_0x268a('0x26')](function(_0x40d196){var _0xc5fbe5=[];if(_0x40d196){_0xfb2495=_0x40d196;for(var _0x241d5f=0x0;_0x241d5f<_0x40d196[_0x268a('0x36')];_0x241d5f+=0x1){_0xfb2495[_0x241d5f]['messages']=[];_0xc5fbe5[_0x268a('0x5f')](db[_0x268a('0x2c')][_0x268a('0x47')]({'where':{'FromId':[_0x1b0dc5[_0x268a('0x53')]['id'],_0x40d196[_0x241d5f]['id']],'ToId':[_0x1b0dc5['user']['id'],_0x40d196[_0x241d5f]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x268a('0x60'),_0x268a('0x61'),_0x268a('0x62'),_0x268a('0x49')],'order':qs[_0x268a('0x39')](_0x268a('0x63')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x40d196[_0x241d5f])));}return BPromise[_0x268a('0x64')](_0xc5fbe5);}return[];})[_0x268a('0x26')](function(_0x4a6df5){return{'rows':_0x4a6df5,'count':_0x4a6df5['length']};})[_0x268a('0x26')](respondWithResult(_0x2edae5,null))[_0x268a('0x43')](handleError(_0x2edae5,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 5668a51..25aed61 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 _0xf7d9=['remove','emit','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x53b2cd,_0x18747e){var _0x100d52=function(_0x4ffedc){while(--_0x4ffedc){_0x53b2cd['push'](_0x53b2cd['shift']());}};_0x100d52(++_0x18747e);}(_0xf7d9,0x122));var _0x9f7d=function(_0x4f5320,_0x2832ad){_0x4f5320=_0x4f5320-0x0;var _0xc6f45b=_0xf7d9[_0x4f5320];return _0xc6f45b;};'use strict';var EventEmitter=require(_0x9f7d('0x0'));var ChatInternalMessage=require(_0x9f7d('0x1'))['db'][_0x9f7d('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x9f7d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9f7d('0x4')};function emitEvent(_0x55c91a){return function(_0xd94b54,_0x1cc9d9,_0x20851d){ChatInternalMessageEvents[_0x9f7d('0x5')](_0x55c91a+':'+_0xd94b54['id'],_0xd94b54);ChatInternalMessageEvents[_0x9f7d('0x5')](_0x55c91a,_0xd94b54);_0x20851d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x9f7d('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xa35f=['setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x48a583,_0x229f86){var _0x50fefe=function(_0x4b1f5e){while(--_0x4b1f5e){_0x48a583['push'](_0x48a583['shift']());}};_0x50fefe(++_0x229f86);}(_0xa35f,0x141));var _0xfa35=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0xa35f[_0x52684f];return _0x4a55f0;};'use strict';var EventEmitter=require(_0xfa35('0x0'));var ChatInternalMessage=require(_0xfa35('0x1'))['db'][_0xfa35('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xfa35('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfa35('0x4'),'afterDestroy':_0xfa35('0x5')};function emitEvent(_0x3ef5b7){return function(_0x134f75,_0x2f25bb,_0xb52934){ChatInternalMessageEvents['emit'](_0x3ef5b7+':'+_0x134f75['id'],_0x134f75);ChatInternalMessageEvents[_0xfa35('0x6')](_0x3ef5b7,_0x134f75);_0xb52934(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xfa35('0x7')](e,emitEvent(event));}}module[_0xfa35('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 57a9c64..98401c6 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 _0x008b=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','utf8mb4'];(function(_0x22418a,_0xf9f963){var _0x4f86d5=function(_0x18b11c){while(--_0x18b11c){_0x22418a['push'](_0x22418a['shift']());}};_0x4f86d5(++_0xf9f963);}(_0x008b,0x15d));var _0xb008=function(_0x376ae7,_0x5dcca1){_0x376ae7=_0x376ae7-0x0;var _0x88b0e8=_0x008b[_0x376ae7];return _0x88b0e8;};'use strict';var _=require(_0xb008('0x0'));var util=require(_0xb008('0x1'));var logger=require('../../config/logger')(_0xb008('0x2'));var moment=require(_0xb008('0x3'));var BPromise=require(_0xb008('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb008('0x5'));var rimraf=require(_0xb008('0x6'));var config=require(_0xb008('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0xb008('0x8')]=function(_0x27e2f9,_0x4c03f1){return _0x27e2f9[_0xb008('0x9')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb008('0xa'),'collate':_0xb008('0xb')});}; \ No newline at end of file +var _0xe332=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x5d69e7,_0x5da0ad){var _0x47d9e5=function(_0x411682){while(--_0x411682){_0x5d69e7['push'](_0x5d69e7['shift']());}};_0x47d9e5(++_0x5da0ad);}(_0xe332,0x13c));var _0x2e33=function(_0x18d7de,_0x3d3c49){_0x18d7de=_0x18d7de-0x0;var _0x3c55f2=_0xe332[_0x18d7de];return _0x3c55f2;};'use strict';var _=require(_0x2e33('0x0'));var util=require(_0x2e33('0x1'));var logger=require(_0x2e33('0x2'))(_0x2e33('0x3'));var moment=require(_0x2e33('0x4'));var BPromise=require(_0x2e33('0x5'));var rp=require(_0x2e33('0x6'));var fs=require('fs');var path=require(_0x2e33('0x7'));var rimraf=require(_0x2e33('0x8'));var config=require(_0x2e33('0x9'));var attributes=require(_0x2e33('0xa'));module[_0x2e33('0xb')]=function(_0x271856,_0x27bba0){return _0x271856[_0x2e33('0xc')](_0x2e33('0xd'),attributes,{'tableName':_0x2e33('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2e33('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index b05734d..fb0ecae 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 _0xf986=['../../mysqldb','client','http','defaults','redis','localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x3a4c07,_0x18440c){var _0x5a4943=function(_0x4afb24){while(--_0x4afb24){_0x3a4c07['push'](_0x3a4c07['shift']());}};_0x5a4943(++_0x18440c);}(_0xf986,0x163));var _0x6f98=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf986[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x6f98('0x0'));var util=require(_0x6f98('0x1'));var moment=require(_0x6f98('0x2'));var BPromise=require('bluebird');var rs=require(_0x6f98('0x3'));var fs=require('fs');var Redis=require(_0x6f98('0x4'));var db=require(_0x6f98('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6f98('0x6')][_0x6f98('0x7')]({'port':0x232a});config['redis']=_[_0x6f98('0x8')](config[_0x6f98('0x9')],{'host':_0x6f98('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f98('0x9')]));require(_0x6f98('0xb'))[_0x6f98('0xc')](socket);function respondWithRpcPromise(_0xd358bc,_0x257d98,_0x322ce7){return new BPromise(function(_0x4b84a2,_0x10e14a){return client[_0x6f98('0xd')](_0xd358bc,_0x322ce7)[_0x6f98('0xe')](function(_0xadf22a){logger[_0x6f98('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x257d98,'request\x20sent');logger['debug'](_0x6f98('0x10'),_0x257d98,_0x6f98('0x11'),JSON['stringify'](_0xadf22a));if(_0xadf22a[_0x6f98('0x12')]){if(_0xadf22a[_0x6f98('0x12')][_0x6f98('0x13')]===0x1f4){logger[_0x6f98('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x257d98,_0xadf22a[_0x6f98('0x12')][_0x6f98('0x14')]);return _0x10e14a(_0xadf22a[_0x6f98('0x12')]['message']);}logger[_0x6f98('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x257d98,_0xadf22a[_0x6f98('0x12')]['message']);return _0x4b84a2(_0xadf22a[_0x6f98('0x12')][_0x6f98('0x14')]);}else{logger[_0x6f98('0xf')](_0x6f98('0x15'),_0x257d98,_0x6f98('0x11'));_0x4b84a2(_0xadf22a[_0x6f98('0x16')][_0x6f98('0x14')]);}})[_0x6f98('0x17')](function(_0x5d23f8){logger[_0x6f98('0x12')](_0x6f98('0x15'),_0x257d98,_0x5d23f8);_0x10e14a(_0x5d23f8);});});} \ No newline at end of file +var _0x225c=['socket.io-emitter','./chatInternalMessage.socket','request','then','info','request\x20sent','debug','stringify','error','message','ChatInternalMessage,\x20%s,\x20%s','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x451f13,_0x5e3850){var _0x408e3c=function(_0x18dbe5){while(--_0x18dbe5){_0x451f13['push'](_0x451f13['shift']());}};_0x408e3c(++_0x5e3850);}(_0x225c,0x106));var _0xc225=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x225c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc225('0x0'));var util=require(_0xc225('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc225('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc225('0x3'))['db'];var utils=require(_0xc225('0x4'));var logger=require(_0xc225('0x5'))(_0xc225('0x6'));var config=require(_0xc225('0x7'));var jayson=require(_0xc225('0x8'));var client=jayson[_0xc225('0x9')]['http']({'port':0x232a});config[_0xc225('0xa')]=_[_0xc225('0xb')](config[_0xc225('0xa')],{'host':_0xc225('0xc'),'port':0x18eb});var socket=require(_0xc225('0xd'))(new Redis(config['redis']));require(_0xc225('0xe'))['register'](socket);function respondWithRpcPromise(_0x42dcd0,_0x10f26b,_0x238dbf){return new BPromise(function(_0x52727e,_0x1c2115){return client[_0xc225('0xf')](_0x42dcd0,_0x238dbf)[_0xc225('0x10')](function(_0x331018){logger[_0xc225('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x10f26b,_0xc225('0x12'));logger[_0xc225('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x10f26b,'request\x20sent',JSON[_0xc225('0x14')](_0x331018));if(_0x331018[_0xc225('0x15')]){if(_0x331018[_0xc225('0x15')]['code']===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x10f26b,_0x331018['error']['message']);return _0x1c2115(_0x331018[_0xc225('0x15')][_0xc225('0x16')]);}logger[_0xc225('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x10f26b,_0x331018[_0xc225('0x15')]['message']);return _0x52727e(_0x331018['error'][_0xc225('0x16')]);}else{logger['info'](_0xc225('0x17'),_0x10f26b,_0xc225('0x12'));_0x52727e(_0x331018['result'][_0xc225('0x16')]);}})[_0xc225('0x18')](function(_0x3a92b){logger[_0xc225('0x15')](_0xc225('0x17'),_0x10f26b,_0x3a92b);_0x1c2115(_0x3a92b);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 4e4bb40..3e5bde9 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 _0xcb6f=['register','length','chatInternalMessage:','./chatInternalMessage.events','remove','update','emit'];(function(_0x1bde08,_0xb146a6){var _0x303726=function(_0x1a53a1){while(--_0x1a53a1){_0x1bde08['push'](_0x1bde08['shift']());}};_0x303726(++_0xb146a6);}(_0xcb6f,0x1ae));var _0xfcb6=function(_0x1e7ceb,_0x16a2bd){_0x1e7ceb=_0x1e7ceb-0x0;var _0x22b22f=_0xcb6f[_0x1e7ceb];return _0x22b22f;};'use strict';var ChatInternalMessageEvents=require(_0xfcb6('0x0'));var events=['save',_0xfcb6('0x1'),_0xfcb6('0x2')];function createListener(_0x1e2252,_0x4793c0){return function(_0x1686de){_0x4793c0[_0xfcb6('0x3')](_0x1e2252,_0x1686de);};}function removeListener(_0x433fcd,_0x426b67){return function(){ChatInternalMessageEvents['removeListener'](_0x433fcd,_0x426b67);};}exports[_0xfcb6('0x4')]=function(_0x564a7e){for(var _0x5a6309=0x0,_0x29b17f=events[_0xfcb6('0x5')];_0x5a6309<_0x29b17f;_0x5a6309++){var _0x144004=events[_0x5a6309];var _0xbe5295=createListener(_0xfcb6('0x6')+_0x144004,_0x564a7e);ChatInternalMessageEvents['on'](_0x144004,_0xbe5295);}}; \ No newline at end of file +var _0xaa5c=['length','./chatInternalMessage.events','save','emit','removeListener'];(function(_0x3c9741,_0x557e3d){var _0x72aa01=function(_0x2fb44d){while(--_0x2fb44d){_0x3c9741['push'](_0x3c9741['shift']());}};_0x72aa01(++_0x557e3d);}(_0xaa5c,0xd8));var _0xcaa5=function(_0x1c938e,_0xaf1c4a){_0x1c938e=_0x1c938e-0x0;var _0x4c5103=_0xaa5c[_0x1c938e];return _0x4c5103;};'use strict';var ChatInternalMessageEvents=require(_0xcaa5('0x0'));var events=[_0xcaa5('0x1'),'remove','update'];function createListener(_0x1a3678,_0x264b4d){return function(_0xc3b6){_0x264b4d[_0xcaa5('0x2')](_0x1a3678,_0xc3b6);};}function removeListener(_0x2a0b71,_0x1b9d97){return function(){ChatInternalMessageEvents[_0xcaa5('0x3')](_0x2a0b71,_0x1b9d97);};}exports['register']=function(_0x1d1b97){for(var _0xdba82c=0x0,_0x5f2376=events[_0xcaa5('0x4')];_0xdba82c<_0x5f2376;_0xdba82c++){var _0x3c33ad=events[_0xdba82c];var _0x3a4c21=createListener('chatInternalMessage:'+_0x3c33ad,_0x1d1b97);ChatInternalMessageEvents['on'](_0x3c33ad,_0x3a4c21);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 1f64c4e..c572a84 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 _0x9f8c=['get','isAuthenticated','index','/describe','describe','/users','/:id','post','put','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller'];(function(_0x36f14c,_0x12fb9c){var _0x1ca6bf=function(_0x372f3b){while(--_0x372f3b){_0x36f14c['push'](_0x36f14c['shift']());}};_0x1ca6bf(++_0x12fb9c);}(_0x9f8c,0x14c));var _0xc9f8=function(_0x3028ac,_0x358fcb){_0x3028ac=_0x3028ac-0x0;var _0x43ae08=_0x9f8c[_0x3028ac];return _0x43ae08;};'use strict';var multer=require(_0xc9f8('0x0'));var util=require('util');var path=require(_0xc9f8('0x1'));var timeout=require('connect-timeout');var express=require(_0xc9f8('0x2'));var router=express[_0xc9f8('0x3')]();var fs_extra=require(_0xc9f8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc9f8('0x5'));var config=require(_0xc9f8('0x6'));var controller=require(_0xc9f8('0x7'));router[_0xc9f8('0x8')]('/',auth[_0xc9f8('0x9')](),controller[_0xc9f8('0xa')]);router[_0xc9f8('0x8')](_0xc9f8('0xb'),auth[_0xc9f8('0x9')](),controller[_0xc9f8('0xc')]);router['get'](_0xc9f8('0xd'),auth['isAuthenticated'](),controller['getUsers']);router[_0xc9f8('0x8')](_0xc9f8('0xe'),auth[_0xc9f8('0x9')](),controller['show']);router[_0xc9f8('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc9f8('0x10')](_0xc9f8('0xe'),controller['update']);router[_0xc9f8('0x11')](_0xc9f8('0xe'),auth[_0xc9f8('0x9')](),controller[_0xc9f8('0x12')]);module[_0xc9f8('0x13')]=router; \ No newline at end of file +var _0xc002=['isAuthenticated','index','get','/describe','describe','/users','getUsers','/:id','show','post','create','put','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller'];(function(_0x2681c9,_0x55559f){var _0x2ea1ac=function(_0x27eb14){while(--_0x27eb14){_0x2681c9['push'](_0x2681c9['shift']());}};_0x2ea1ac(++_0x55559f);}(_0xc002,0x1db));var _0x2c00=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xc002[_0x4fbfd9];return _0x31dc94;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2c00('0x0'));var timeout=require(_0x2c00('0x1'));var express=require(_0x2c00('0x2'));var router=express[_0x2c00('0x3')]();var fs_extra=require(_0x2c00('0x4'));var auth=require(_0x2c00('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2c00('0x6'));var controller=require(_0x2c00('0x7'));router['get']('/',auth[_0x2c00('0x8')](),controller[_0x2c00('0x9')]);router[_0x2c00('0xa')](_0x2c00('0xb'),auth[_0x2c00('0x8')](),controller[_0x2c00('0xc')]);router[_0x2c00('0xa')](_0x2c00('0xd'),auth[_0x2c00('0x8')](),controller[_0x2c00('0xe')]);router['get'](_0x2c00('0xf'),auth[_0x2c00('0x8')](),controller[_0x2c00('0x10')]);router[_0x2c00('0x11')]('/',auth['isAuthenticated'](),controller[_0x2c00('0x12')]);router[_0x2c00('0x13')](_0x2c00('0xf'),controller['update']);router[_0x2c00('0x14')](_0x2c00('0xf'),auth['isAuthenticated'](),controller[_0x2c00('0x15')]);module[_0x2c00('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 86a7da2..b2b423d 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 _0x5a13=['TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x4a5c11,_0x204ec0){var _0x230f14=function(_0x49840b){while(--_0x49840b){_0x4a5c11['push'](_0x4a5c11['shift']());}};_0x230f14(++_0x204ec0);}(_0x5a13,0x145));var _0x35a1=function(_0x280cb8,_0x5177d2){_0x280cb8=_0x280cb8-0x0;var _0x2acd92=_0x5a13[_0x280cb8];return _0x2acd92;};'use strict';var Sequelize=require(_0x35a1('0x0'));module[_0x35a1('0x1')]={'body':{'type':Sequelize['TEXT'](_0x35a1('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x35a1('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x35a1('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x35a1('0x4')]('in',_0x35a1('0x5')),'defaultValue':_0x35a1('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x35a1('0x6')]},'providerName':{'type':Sequelize[_0x35a1('0x7')]},'providerResponse':{'type':Sequelize[_0x35a1('0x8')]}}; \ No newline at end of file +var _0xb9e7=['ENUM','out','DATE','exports','TEXT','medium','BOOLEAN'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0xb9e7[_0x53b53e];return _0xbb6179;};'use strict';var Sequelize=require('sequelize');module[_0x7b9e('0x0')]={'body':{'type':Sequelize[_0x7b9e('0x1')](_0x7b9e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7b9e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7b9e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7b9e('0x4')]('in','out'),'defaultValue':_0x7b9e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7b9e('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7b9e('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index c13bdab..684f2bf 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 _0x5fce=['count','limit','set','Content-Range','json','save','update','end','stack','name','send','index','ChatMessage','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','destroy','describe','../../config/logger','chat-interactions','chat','read','readAt','format','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','ContactId','sequelize','User','internal','event','reject','rejectmessage','parse','eml-format','zip-dir','fast-json-patch','request-promise','moment','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/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatMessage.socket','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','offset','undefined'];(function(_0x2b4360,_0x1498bd){var _0x583307=function(_0x49a542){while(--_0x49a542){_0x2b4360['push'](_0x2b4360['shift']());}};_0x583307(++_0x1498bd);}(_0x5fce,0xdc));var _0xe5fc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5fce[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xe5fc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe5fc('0x1'));var jsonpatch=require(_0xe5fc('0x2'));var rp=require(_0xe5fc('0x3'));var moment=require(_0xe5fc('0x4'));var BPromise=require(_0xe5fc('0x5'));var Mustache=require(_0xe5fc('0x6'));var util=require(_0xe5fc('0x7'));var path=require(_0xe5fc('0x8'));var sox=require(_0xe5fc('0x9'));var csv=require(_0xe5fc('0xa'));var ejs=require(_0xe5fc('0xb'));var fs=require('fs');var fs_extra=require(_0xe5fc('0xc'));var _=require(_0xe5fc('0xd'));var squel=require(_0xe5fc('0xe'));var crypto=require(_0xe5fc('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe5fc('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe5fc('0x11'));var Redis=require(_0xe5fc('0x12'));var authService=require(_0xe5fc('0x13'));var qs=require(_0xe5fc('0x14'));var as=require(_0xe5fc('0x15'));var hardwareService=require(_0xe5fc('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xe5fc('0x17'));var config=require(_0xe5fc('0x18'));var licenseUtil=require(_0xe5fc('0x19'));var db=require(_0xe5fc('0x1a'))['db'];config[_0xe5fc('0x1b')]=_['defaults'](config['redis'],{'host':_0xe5fc('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe5fc('0x1b')]));require(_0xe5fc('0x1d'))['register'](socket);var jayson=require(_0xe5fc('0x1e'));var client=jayson[_0xe5fc('0x1f')][_0xe5fc('0x20')]({'port':0x232c});var client9002=jayson[_0xe5fc('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c5480,_0x32d86c,_0x40ddb6,_0x2c6c70){return new BPromise(function(_0x158adb,_0x38b5f0){var _0x242d57=_0x2c6c70||client;return _0x242d57['request'](_0x3c5480,_0x40ddb6)[_0xe5fc('0x21')](function(_0x552747){logger[_0xe5fc('0x22')](_0xe5fc('0x23'),_0x32d86c,_0xe5fc('0x24'));logger[_0xe5fc('0x25')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x32d86c,_0xe5fc('0x24'),JSON[_0xe5fc('0x26')](_0x552747));if(_0x552747[_0xe5fc('0x27')]){if(_0x552747[_0xe5fc('0x27')]['code']===0x1f4){logger[_0xe5fc('0x27')](_0xe5fc('0x23'),_0x32d86c,_0x552747[_0xe5fc('0x27')][_0xe5fc('0x28')]);return _0x38b5f0(_0x552747['error']['message']);}logger[_0xe5fc('0x27')](_0xe5fc('0x23'),_0x32d86c,_0x552747['error']['message']);return _0x158adb(_0x552747[_0xe5fc('0x27')][_0xe5fc('0x28')]);}else{logger[_0xe5fc('0x22')](_0xe5fc('0x23'),_0x32d86c,_0xe5fc('0x24'));_0x158adb(_0x552747['result'][_0xe5fc('0x28')]);}})[_0xe5fc('0x29')](function(_0xb4317a){logger[_0xe5fc('0x27')](_0xe5fc('0x23'),_0x32d86c,_0xb4317a);_0x38b5f0(_0xb4317a);});});}function respondWithStatusCode(_0x9d7b01,_0x17ab23){_0x17ab23=_0x17ab23||0xcc;return function(_0x4e0a8e){if(_0x4e0a8e){return _0x9d7b01[_0xe5fc('0x2a')](_0x17ab23);}return _0x9d7b01[_0xe5fc('0x2b')](_0x17ab23)['end']();};}function respondWithResult(_0x1f2c6e,_0x498c64){_0x498c64=_0x498c64||0xc8;return function(_0x334342){if(_0x334342){return _0x1f2c6e[_0xe5fc('0x2b')](_0x498c64)['json'](_0x334342);}};}function respondWithFilteredResult(_0x505516,_0x1e5cd2){return function(_0x28f22c){if(_0x28f22c){var _0x508abe=typeof _0x1e5cd2[_0xe5fc('0x2c')]===_0xe5fc('0x2d')&&typeof _0x1e5cd2['limit']==='undefined';var _0x423ec6=_0x28f22c[_0xe5fc('0x2e')];var _0x54f885=_0x508abe?0x0:_0x1e5cd2[_0xe5fc('0x2c')];var _0x6549d8=_0x508abe?_0x28f22c[_0xe5fc('0x2e')]:_0x1e5cd2[_0xe5fc('0x2c')]+_0x1e5cd2[_0xe5fc('0x2f')];var _0x130c86;if(_0x6549d8>=_0x423ec6){_0x6549d8=_0x423ec6;_0x130c86=0xc8;}else{_0x130c86=0xce;}_0x505516[_0xe5fc('0x2b')](_0x130c86);return _0x505516[_0xe5fc('0x30')](_0xe5fc('0x31'),_0x54f885+'-'+_0x6549d8+'/'+_0x423ec6)[_0xe5fc('0x32')](_0x28f22c);}return null;};}function patchUpdates(_0x1a84f0){return function(_0x1f797a){try{jsonpatch['apply'](_0x1f797a,_0x1a84f0,!![]);}catch(_0x1f02c1){return BPromise['reject'](_0x1f02c1);}return _0x1f797a[_0xe5fc('0x33')]();};}function saveUpdates(_0x54b54d,_0x17b849){return function(_0x256612){if(_0x256612){return _0x256612[_0xe5fc('0x34')](_0x54b54d)['then'](function(_0x283192){return _0x283192;});}return null;};}function removeEntity(_0x1a8f71,_0x2440a7){return function(_0x803642){if(_0x803642){return _0x803642['destroy']()[_0xe5fc('0x21')](function(){_0x1a8f71[_0xe5fc('0x2b')](0xcc)[_0xe5fc('0x35')]();});}};}function handleEntityNotFound(_0x347ca2,_0x946690){return function(_0x38b065){if(!_0x38b065){_0x347ca2[_0xe5fc('0x2a')](0x194);}return _0x38b065;};}function handleError(_0x22286d,_0x507e74){_0x507e74=_0x507e74||0x1f4;return function(_0x2d4f61){logger[_0xe5fc('0x27')](_0x2d4f61[_0xe5fc('0x36')]);if(_0x2d4f61[_0xe5fc('0x37')]){delete _0x2d4f61[_0xe5fc('0x37')];}_0x22286d[_0xe5fc('0x2b')](_0x507e74)[_0xe5fc('0x38')](_0x2d4f61);};}exports[_0xe5fc('0x39')]=function(_0x1398cb,_0x21e6d5){var _0xe80aaf={},_0x349afe={},_0x45f6fa={'count':0x0,'rows':[]};var _0x57f52c=_['map'](db[_0xe5fc('0x3a')][_0xe5fc('0x3b')],function(_0x33ebea){return{'name':_0x33ebea[_0xe5fc('0x3c')],'type':_0x33ebea[_0xe5fc('0x3d')]['key']};});_0x349afe['model']=_['map'](_0x57f52c,'name');_0x349afe[_0xe5fc('0x3e')]=_['keys'](_0x1398cb[_0xe5fc('0x3e')]);_0x349afe[_0xe5fc('0x3f')]=_[_0xe5fc('0x40')](_0x349afe[_0xe5fc('0x41')],_0x349afe[_0xe5fc('0x3e')]);_0xe80aaf[_0xe5fc('0x42')]=_['intersection'](_0x349afe[_0xe5fc('0x41')],qs[_0xe5fc('0x43')](_0x1398cb[_0xe5fc('0x3e')][_0xe5fc('0x43')]));_0xe80aaf[_0xe5fc('0x42')]=_0xe80aaf[_0xe5fc('0x42')][_0xe5fc('0x44')]?_0xe80aaf[_0xe5fc('0x42')]:_0x349afe[_0xe5fc('0x41')];if(!_0x1398cb[_0xe5fc('0x3e')][_0xe5fc('0x45')]('nolimit')){_0xe80aaf[_0xe5fc('0x2f')]=qs[_0xe5fc('0x2f')](_0x1398cb[_0xe5fc('0x3e')]['limit']);_0xe80aaf[_0xe5fc('0x2c')]=qs[_0xe5fc('0x2c')](_0x1398cb['query'][_0xe5fc('0x2c')]);}_0xe80aaf[_0xe5fc('0x46')]=qs[_0xe5fc('0x47')](_0x1398cb[_0xe5fc('0x3e')][_0xe5fc('0x47')]);_0xe80aaf[_0xe5fc('0x48')]=qs[_0xe5fc('0x3f')](_[_0xe5fc('0x49')](_0x1398cb[_0xe5fc('0x3e')],_0x349afe[_0xe5fc('0x3f')]),_0x57f52c);if(_0x1398cb[_0xe5fc('0x3e')]['filter']){_0xe80aaf['where']=_[_0xe5fc('0x4a')](_0xe80aaf['where'],{'$or':_['map'](_0x57f52c,function(_0x53026a){if(_0x53026a[_0xe5fc('0x3d')]!==_0xe5fc('0x4b')){var _0x3d92f8={};_0x3d92f8[_0x53026a[_0xe5fc('0x37')]]={'$like':'%'+_0x1398cb[_0xe5fc('0x3e')]['filter']+'%'};return _0x3d92f8;}})});}_0xe80aaf=_['merge']({},_0xe80aaf,_0x1398cb[_0xe5fc('0x4c')]);var _0x53883a={'where':_0xe80aaf[_0xe5fc('0x48')]};return db['ChatMessage'][_0xe5fc('0x2e')](_0x53883a)[_0xe5fc('0x21')](function(_0x505d23){_0x45f6fa[_0xe5fc('0x2e')]=_0x505d23;if(_0x1398cb[_0xe5fc('0x3e')][_0xe5fc('0x4d')]){_0xe80aaf['include']=[{'all':!![]}];}return db['ChatMessage'][_0xe5fc('0x4e')](_0xe80aaf);})[_0xe5fc('0x21')](function(_0x112678){_0x45f6fa[_0xe5fc('0x4f')]=_0x112678;return _0x45f6fa;})[_0xe5fc('0x21')](respondWithFilteredResult(_0x21e6d5,_0xe80aaf))['catch'](handleError(_0x21e6d5,null));};exports[_0xe5fc('0x50')]=function(_0x2832f4,_0x2a2d07){var _0x406c45={'raw':!![],'where':{'id':_0x2832f4[_0xe5fc('0x51')]['id']}},_0x49c488={};_0x49c488[_0xe5fc('0x41')]=_[_0xe5fc('0x52')](db['ChatMessage'][_0xe5fc('0x3b')]);_0x49c488[_0xe5fc('0x3e')]=_['keys'](_0x2832f4[_0xe5fc('0x3e')]);_0x49c488[_0xe5fc('0x3f')]=_[_0xe5fc('0x40')](_0x49c488[_0xe5fc('0x41')],_0x49c488[_0xe5fc('0x3e')]);_0x406c45['attributes']=_[_0xe5fc('0x40')](_0x49c488[_0xe5fc('0x41')],qs[_0xe5fc('0x43')](_0x2832f4[_0xe5fc('0x3e')][_0xe5fc('0x43')]));_0x406c45[_0xe5fc('0x42')]=_0x406c45[_0xe5fc('0x42')]['length']?_0x406c45['attributes']:_0x49c488[_0xe5fc('0x41')];if(_0x2832f4[_0xe5fc('0x3e')][_0xe5fc('0x4d')]){_0x406c45[_0xe5fc('0x53')]=[{'all':!![]}];}_0x406c45=_[_0xe5fc('0x4a')]({},_0x406c45,_0x2832f4['options']);return db['ChatMessage'][_0xe5fc('0x54')](_0x406c45)[_0xe5fc('0x21')](handleEntityNotFound(_0x2a2d07,null))[_0xe5fc('0x21')](respondWithResult(_0x2a2d07,null))[_0xe5fc('0x29')](handleError(_0x2a2d07,null));};exports[_0xe5fc('0x55')]=function(_0x1cd84b,_0x50342c){return db[_0xe5fc('0x3a')][_0xe5fc('0x55')](_0x1cd84b[_0xe5fc('0x56')],{})[_0xe5fc('0x21')](respondWithResult(_0x50342c,0xc9))[_0xe5fc('0x29')](handleError(_0x50342c,null));};exports[_0xe5fc('0x34')]=function(_0x24f7d3,_0x2aa1ed){if(_0x24f7d3[_0xe5fc('0x56')]['id']){delete _0x24f7d3[_0xe5fc('0x56')]['id'];}return db[_0xe5fc('0x3a')][_0xe5fc('0x54')]({'where':{'id':_0x24f7d3[_0xe5fc('0x51')]['id']}})[_0xe5fc('0x21')](handleEntityNotFound(_0x2aa1ed,null))[_0xe5fc('0x21')](saveUpdates(_0x24f7d3[_0xe5fc('0x56')],null))[_0xe5fc('0x21')](respondWithResult(_0x2aa1ed,null))[_0xe5fc('0x29')](handleError(_0x2aa1ed,null));};exports[_0xe5fc('0x57')]=function(_0x1836f2,_0x197649){return db[_0xe5fc('0x3a')][_0xe5fc('0x54')]({'where':{'id':_0x1836f2[_0xe5fc('0x51')]['id']}})[_0xe5fc('0x21')](handleEntityNotFound(_0x197649,null))['then'](removeEntity(_0x197649,null))[_0xe5fc('0x29')](handleError(_0x197649,null));};exports[_0xe5fc('0x58')]=function(_0x422ece,_0x24ed53){return db[_0xe5fc('0x3a')][_0xe5fc('0x58')]()[_0xe5fc('0x21')](respondWithResult(_0x24ed53,null))[_0xe5fc('0x29')](handleError(_0x24ed53,null));};var interaction_log=require(_0xe5fc('0x59'))(_0xe5fc('0x5a'));exports['accept']=function(_0x5b3eb4,_0x5c70c,_0xd40a58){var _0x20a321={'agent':{},'channel':_0xe5fc('0x5b')};if(_0x5b3eb4[_0xe5fc('0x56')]['id']){delete _0x5b3eb4['body']['id'];}_0x5b3eb4[_0xe5fc('0x56')][_0xe5fc('0x5c')]=!![];_0x5b3eb4[_0xe5fc('0x56')][_0xe5fc('0x5d')]=moment()[_0xe5fc('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x5b3eb4[_0xe5fc('0x56')][_0xe5fc('0x5f')]=_0x5b3eb4[_0xe5fc('0x56')][_0xe5fc('0x5f')]||_0x5b3eb4[_0xe5fc('0x60')]['id'];_0x20a321[_0xe5fc('0x61')]['id']=_0x5b3eb4[_0xe5fc('0x56')][_0xe5fc('0x5f')];return db['ChatMessage'][_0xe5fc('0x54')]({'where':{'id':_0x5b3eb4[_0xe5fc('0x51')]['id'],'UserId':null}})[_0xe5fc('0x21')](handleEntityNotFound(_0x5c70c,null))[_0xe5fc('0x21')](saveUpdates(_0x5b3eb4[_0xe5fc('0x56')],null))['then'](function(_0x375f61){if(_0x375f61){_0x20a321[_0xe5fc('0x28')]=_0x375f61[_0xe5fc('0x62')]({'plain':!![]});return db[_0xe5fc('0x63')][_0xe5fc('0x54')]({'where':{'id':_0x375f61[_0xe5fc('0x64')]}});}return null;})[_0xe5fc('0x21')](handleEntityNotFound(_0x5c70c,null))[_0xe5fc('0x21')](function(_0x5f01a4){if(_0x5f01a4){return _0x5f01a4[_0xe5fc('0x34')]({'UserId':_0x5b3eb4[_0xe5fc('0x56')]['UserId'],'read1stAt':_[_0xe5fc('0x65')](_0x5f01a4['read1stAt'])?moment()[_0xe5fc('0x5e')](_0xe5fc('0x66')):undefined});}return null;})[_0xe5fc('0x21')](function(_0x5a6a75){if(_0x5a6a75){_0x20a321[_0xe5fc('0x67')]=_0x5a6a75[_0xe5fc('0x62')]({'plain':!![]});interaction_log[_0xe5fc('0x22')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5b3eb4[_0xe5fc('0x60')]['id'],_0x5b3eb4[_0xe5fc('0x60')][_0xe5fc('0x37')],_0x5b3eb4[_0xe5fc('0x60')][_0xe5fc('0x68')],_0x20a321['interaction']['id'],_0x5b3eb4[_0xe5fc('0x56')]?JSON[_0xe5fc('0x26')](_0x5b3eb4['body']):'null');return respondWithRpcPromise(_0xe5fc('0x69'),'acceptMessage',_0x20a321);}return null;})[_0xe5fc('0x21')](function(_0xc412c4){var _0x4b1da8=_0xe5fc('0x6a')+_0xc412c4[_0xe5fc('0x28')]['ContactId'];return db['sequelize'][_0xe5fc('0x3e')](_0x4b1da8,{'type':db[_0xe5fc('0x6b')][_0xe5fc('0x6c')][_0xe5fc('0x6d')],'raw':!![]})[_0xe5fc('0x21')](function(_0x243112){return _0x243112;});})[_0xe5fc('0x21')](function(_0x2b7b15){if(_0x2b7b15){_0x20a321[_0xe5fc('0x28')][_0xe5fc('0x6e')]=_0x2b7b15[0x0];if(!_0x5b3eb4[_0xe5fc('0x56')][_0xe5fc('0x5f')])return;return db['User'][_0xe5fc('0x54')]({'where':{'id':_0x5b3eb4[_0xe5fc('0x56')][_0xe5fc('0x5f')],'role':_0xe5fc('0x61')},'attributes':['id',_0xe5fc('0x37'),_0xe5fc('0x6f'),_0xe5fc('0x70'),'internal'],'raw':!![]});}return null;})['then'](function(_0xc6f588){if(!_0xc6f588)return null;_0x20a321[_0xe5fc('0x28')][_0xe5fc('0x61')]=_0xc6f588;return _0x20a321;})[_0xe5fc('0x21')](function(_0x142f5d){if(_0x142f5d){if(_0x5b3eb4[_0xe5fc('0x56')][_0xe5fc('0x71')]){_0x20a321[_0xe5fc('0x28')][_0xe5fc('0x72')]=util[_0xe5fc('0x5e')](_0xe5fc('0x73'),_0x5b3eb4[_0xe5fc('0x60')][_0xe5fc('0x37')]);_0x20a321[_0xe5fc('0x28')]['channel']=_0x20a321[_0xe5fc('0x74')];_0x20a321[_0xe5fc('0x28')][_0xe5fc('0x75')]=_0x20a321[_0xe5fc('0x74')];_0x20a321[_0xe5fc('0x28')]['event']=_0xe5fc('0x76');return respondWithRpcPromise(_0xe5fc('0x77'),_0xe5fc('0x77'),{'event':_0xe5fc('0x78'),'message':_[_0xe5fc('0x4a')](_0x20a321[_0xe5fc('0x28')],JSON['parse'](_0x20a321['interaction'][_0xe5fc('0x79')]))},client9002)['then'](function(){return _0x20a321;});}return _0x20a321;}return null;})[_0xe5fc('0x21')](respondWithResult(_0x5c70c,null))[_0xe5fc('0x29')](handleError(_0x5c70c,null));};var interaction_log=require('../../config/logger')(_0xe5fc('0x5a'));exports['reject']=function(_0x7996c0,_0x13ebb6,_0x1d4080){var _0x1daf92={'agent':{},'channel':_0xe5fc('0x5b')};if(_0x7996c0[_0xe5fc('0x56')]['id']){delete _0x7996c0[_0xe5fc('0x56')]['id'];}_0x7996c0[_0xe5fc('0x56')][_0xe5fc('0x5f')]=_0x7996c0[_0xe5fc('0x56')][_0xe5fc('0x5f')]||_0x7996c0[_0xe5fc('0x60')]['id'];_0x1daf92[_0xe5fc('0x61')]['id']=_0x7996c0['body']['UserId'];return db['ChatMessage']['find']({'where':{'id':_0x7996c0[_0xe5fc('0x51')]['id'],'UserId':null}})[_0xe5fc('0x21')](handleEntityNotFound(_0x13ebb6,null))['then'](function(_0x5b8519){if(_0x5b8519){_0x1daf92[_0xe5fc('0x28')]=_0x5b8519[_0xe5fc('0x62')]({'plain':!![]});return db['ChatInteraction'][_0xe5fc('0x54')]({'where':{'id':_0x5b8519['ChatInteractionId']}});}return null;})[_0xe5fc('0x21')](handleEntityNotFound(_0x13ebb6,null))[_0xe5fc('0x21')](function(_0x31929d){if(_0x31929d){_0x1daf92[_0xe5fc('0x67')]=_0x31929d[_0xe5fc('0x62')]({'plain':!![]});interaction_log[_0xe5fc('0x22')](_0xe5fc('0x7a'),_0x7996c0[_0xe5fc('0x60')]['id'],_0x7996c0[_0xe5fc('0x60')]['name'],_0x7996c0[_0xe5fc('0x60')][_0xe5fc('0x68')],_0x1daf92[_0xe5fc('0x67')]['id'],_0x7996c0[_0xe5fc('0x56')]?JSON[_0xe5fc('0x26')](_0x7996c0[_0xe5fc('0x56')]):_0xe5fc('0x7b'));return respondWithRpcPromise(_0xe5fc('0x7c'),'rejectMessage',_0x1daf92);}return null;})[_0xe5fc('0x21')](function(_0x9cbb9c){var _0x721421=_0xe5fc('0x6a')+_0x9cbb9c[_0xe5fc('0x28')][_0xe5fc('0x7d')];return db[_0xe5fc('0x7e')]['query'](_0x721421,{'type':db[_0xe5fc('0x6b')][_0xe5fc('0x6c')][_0xe5fc('0x6d')],'raw':!![]})['then'](function(_0x2f8d7b){return _0x2f8d7b;});})[_0xe5fc('0x21')](function(_0x50ee88){if(_0x50ee88){_0x1daf92[_0xe5fc('0x28')]['contact']=_0x50ee88[0x0];if(!_0x7996c0['body'][_0xe5fc('0x5f')])return;return db[_0xe5fc('0x7f')]['find']({'where':{'id':_0x7996c0[_0xe5fc('0x56')][_0xe5fc('0x5f')],'role':_0xe5fc('0x61')},'attributes':['id',_0xe5fc('0x37'),_0xe5fc('0x6f'),'email',_0xe5fc('0x80')],'raw':!![]});}return null;})['then'](function(_0x304527){if(!_0x304527)return null;_0x1daf92['message'][_0xe5fc('0x61')]=_0x304527;return _0x1daf92;})[_0xe5fc('0x21')](function(_0x30c1a8){if(_0x30c1a8){_0x30c1a8[_0xe5fc('0x28')][_0xe5fc('0x72')]=util['format'](_0xe5fc('0x73'),_0x7996c0[_0xe5fc('0x60')]['name']);_0x30c1a8['message'][_0xe5fc('0x74')]=_0x1daf92[_0xe5fc('0x74')];_0x30c1a8[_0xe5fc('0x28')]['motionChannel']=_0x1daf92['channel'];_0x30c1a8[_0xe5fc('0x28')][_0xe5fc('0x81')]=_0xe5fc('0x82');respondWithRpcPromise(_0xe5fc('0x77'),_0xe5fc('0x77'),{'event':_0xe5fc('0x83'),'message':_[_0xe5fc('0x4a')](_0x1daf92[_0xe5fc('0x28')],JSON[_0xe5fc('0x84')](_0x1daf92['interaction'][_0xe5fc('0x79')]))},client9002);return _0x1daf92;}return null;})[_0xe5fc('0x21')](respondWithResult(_0x13ebb6,null))['catch'](handleError(_0x13ebb6,null));}; \ No newline at end of file +var _0x6978=['debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','includeAll','include','rows','params','merge','options','create','body','find','describe','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','formData','chat-interactions','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','internal','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','client','http','then','info','ChatMessage,\x20%s,\x20%s'];(function(_0x4610b7,_0x823778){var _0x4e21cd=function(_0x479a7d){while(--_0x479a7d){_0x4610b7['push'](_0x4610b7['shift']());}};_0x4e21cd(++_0x823778);}(_0x6978,0x16f));var _0x8697=function(_0x333767,_0x3e6f9c){_0x333767=_0x333767-0x0;var _0x51661b=_0x6978[_0x333767];return _0x51661b;};'use strict';var emlformat=require(_0x8697('0x0'));var rimraf=require(_0x8697('0x1'));var zipdir=require(_0x8697('0x2'));var jsonpatch=require(_0x8697('0x3'));var rp=require(_0x8697('0x4'));var moment=require(_0x8697('0x5'));var BPromise=require(_0x8697('0x6'));var Mustache=require(_0x8697('0x7'));var util=require(_0x8697('0x8'));var path=require(_0x8697('0x9'));var sox=require(_0x8697('0xa'));var csv=require('to-csv');var ejs=require(_0x8697('0xb'));var fs=require('fs');var fs_extra=require(_0x8697('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8697('0xd'));var jsforce=require(_0x8697('0xe'));var deskjs=require(_0x8697('0xf'));var toCsv=require(_0x8697('0x10'));var querystring=require(_0x8697('0x11'));var Papa=require(_0x8697('0x12'));var Redis=require(_0x8697('0x13'));var authService=require(_0x8697('0x14'));var qs=require(_0x8697('0x15'));var as=require(_0x8697('0x16'));var hardwareService=require(_0x8697('0x17'));var logger=require(_0x8697('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x8697('0x19'));var licenseUtil=require(_0x8697('0x1a'));var db=require(_0x8697('0x1b'))['db'];config[_0x8697('0x1c')]=_[_0x8697('0x1d')](config[_0x8697('0x1c')],{'host':_0x8697('0x1e'),'port':0x18eb});var socket=require(_0x8697('0x1f'))(new Redis(config['redis']));require(_0x8697('0x20'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x8697('0x21')][_0x8697('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x4f1eb4,_0x1be0c2,_0x4fea72,_0x4d045c){return new BPromise(function(_0x1d995c,_0x4942be){var _0xdc6dd1=_0x4d045c||client;return _0xdc6dd1['request'](_0x4f1eb4,_0x4fea72)[_0x8697('0x23')](function(_0x4650a6){logger[_0x8697('0x24')](_0x8697('0x25'),_0x1be0c2,'request\x20sent');logger[_0x8697('0x26')](_0x8697('0x27'),_0x1be0c2,_0x8697('0x28'),JSON[_0x8697('0x29')](_0x4650a6));if(_0x4650a6[_0x8697('0x2a')]){if(_0x4650a6[_0x8697('0x2a')][_0x8697('0x2b')]===0x1f4){logger[_0x8697('0x2a')](_0x8697('0x25'),_0x1be0c2,_0x4650a6[_0x8697('0x2a')]['message']);return _0x4942be(_0x4650a6[_0x8697('0x2a')]['message']);}logger[_0x8697('0x2a')](_0x8697('0x25'),_0x1be0c2,_0x4650a6[_0x8697('0x2a')][_0x8697('0x2c')]);return _0x1d995c(_0x4650a6['error']['message']);}else{logger[_0x8697('0x24')]('ChatMessage,\x20%s,\x20%s',_0x1be0c2,'request\x20sent');_0x1d995c(_0x4650a6[_0x8697('0x2d')][_0x8697('0x2c')]);}})[_0x8697('0x2e')](function(_0x3f5ded){logger['error'](_0x8697('0x25'),_0x1be0c2,_0x3f5ded);_0x4942be(_0x3f5ded);});});}function respondWithStatusCode(_0x12ec19,_0x42e4e6){_0x42e4e6=_0x42e4e6||0xcc;return function(_0x483c87){if(_0x483c87){return _0x12ec19[_0x8697('0x2f')](_0x42e4e6);}return _0x12ec19[_0x8697('0x30')](_0x42e4e6)[_0x8697('0x31')]();};}function respondWithResult(_0x3ad99d,_0x4ef8d3){_0x4ef8d3=_0x4ef8d3||0xc8;return function(_0x539a85){if(_0x539a85){return _0x3ad99d[_0x8697('0x30')](_0x4ef8d3)[_0x8697('0x32')](_0x539a85);}};}function respondWithFilteredResult(_0x1528ca,_0x25e584){return function(_0x5aae23){if(_0x5aae23){var _0x3ab461=typeof _0x25e584[_0x8697('0x33')]===_0x8697('0x34')&&typeof _0x25e584[_0x8697('0x35')]==='undefined';var _0x31a6bd=_0x5aae23[_0x8697('0x36')];var _0x2f89fd=_0x3ab461?0x0:_0x25e584['offset'];var _0x5d870b=_0x3ab461?_0x5aae23['count']:_0x25e584['offset']+_0x25e584['limit'];var _0x14e98d;if(_0x5d870b>=_0x31a6bd){_0x5d870b=_0x31a6bd;_0x14e98d=0xc8;}else{_0x14e98d=0xce;}_0x1528ca[_0x8697('0x30')](_0x14e98d);return _0x1528ca[_0x8697('0x37')](_0x8697('0x38'),_0x2f89fd+'-'+_0x5d870b+'/'+_0x31a6bd)[_0x8697('0x32')](_0x5aae23);}return null;};}function patchUpdates(_0x3fddd1){return function(_0x17effc){try{jsonpatch[_0x8697('0x39')](_0x17effc,_0x3fddd1,!![]);}catch(_0xd5aafe){return BPromise[_0x8697('0x3a')](_0xd5aafe);}return _0x17effc[_0x8697('0x3b')]();};}function saveUpdates(_0x4ad75b,_0x44f4ee){return function(_0x3faa83){if(_0x3faa83){return _0x3faa83[_0x8697('0x3c')](_0x4ad75b)[_0x8697('0x23')](function(_0x47388e){return _0x47388e;});}return null;};}function removeEntity(_0x15ddf3,_0xa6bd7f){return function(_0xae3af7){if(_0xae3af7){return _0xae3af7[_0x8697('0x3d')]()[_0x8697('0x23')](function(){_0x15ddf3[_0x8697('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48f03c,_0x1837ff){return function(_0x3d5d18){if(!_0x3d5d18){_0x48f03c[_0x8697('0x2f')](0x194);}return _0x3d5d18;};}function handleError(_0x44d27f,_0x394a7f){_0x394a7f=_0x394a7f||0x1f4;return function(_0x359d90){logger['error'](_0x359d90[_0x8697('0x3e')]);if(_0x359d90['name']){delete _0x359d90[_0x8697('0x3f')];}_0x44d27f[_0x8697('0x30')](_0x394a7f)[_0x8697('0x40')](_0x359d90);};}exports[_0x8697('0x41')]=function(_0x2dd7f4,_0x30e519){var _0x3b687c={},_0x3ba5ca={},_0x204ffc={'count':0x0,'rows':[]};var _0x12b468=_[_0x8697('0x42')](db[_0x8697('0x43')][_0x8697('0x44')],function(_0x385e70){return{'name':_0x385e70['fieldName'],'type':_0x385e70[_0x8697('0x45')][_0x8697('0x46')]};});_0x3ba5ca['model']=_[_0x8697('0x42')](_0x12b468,'name');_0x3ba5ca[_0x8697('0x47')]=_[_0x8697('0x48')](_0x2dd7f4[_0x8697('0x47')]);_0x3ba5ca['filters']=_[_0x8697('0x49')](_0x3ba5ca[_0x8697('0x4a')],_0x3ba5ca[_0x8697('0x47')]);_0x3b687c['attributes']=_['intersection'](_0x3ba5ca[_0x8697('0x4a')],qs[_0x8697('0x4b')](_0x2dd7f4[_0x8697('0x47')][_0x8697('0x4b')]));_0x3b687c[_0x8697('0x4c')]=_0x3b687c[_0x8697('0x4c')]['length']?_0x3b687c[_0x8697('0x4c')]:_0x3ba5ca[_0x8697('0x4a')];if(!_0x2dd7f4[_0x8697('0x47')][_0x8697('0x4d')](_0x8697('0x4e'))){_0x3b687c[_0x8697('0x35')]=qs['limit'](_0x2dd7f4['query'][_0x8697('0x35')]);_0x3b687c['offset']=qs[_0x8697('0x33')](_0x2dd7f4[_0x8697('0x47')][_0x8697('0x33')]);}_0x3b687c['order']=qs[_0x8697('0x4f')](_0x2dd7f4[_0x8697('0x47')]['sort']);_0x3b687c[_0x8697('0x50')]=qs[_0x8697('0x51')](_[_0x8697('0x52')](_0x2dd7f4[_0x8697('0x47')],_0x3ba5ca['filters']),_0x12b468);if(_0x2dd7f4[_0x8697('0x47')][_0x8697('0x53')]){_0x3b687c[_0x8697('0x50')]=_['merge'](_0x3b687c['where'],{'$or':_[_0x8697('0x42')](_0x12b468,function(_0xcac32e){if(_0xcac32e['type']!=='VIRTUAL'){var _0x30fcbc={};_0x30fcbc[_0xcac32e[_0x8697('0x3f')]]={'$like':'%'+_0x2dd7f4[_0x8697('0x47')][_0x8697('0x53')]+'%'};return _0x30fcbc;}})});}_0x3b687c=_['merge']({},_0x3b687c,_0x2dd7f4['options']);var _0x2089f7={'where':_0x3b687c[_0x8697('0x50')]};return db['ChatMessage'][_0x8697('0x36')](_0x2089f7)[_0x8697('0x23')](function(_0x391ed3){_0x204ffc[_0x8697('0x36')]=_0x391ed3;if(_0x2dd7f4[_0x8697('0x47')][_0x8697('0x54')]){_0x3b687c[_0x8697('0x55')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x3b687c);})[_0x8697('0x23')](function(_0x1313b7){_0x204ffc[_0x8697('0x56')]=_0x1313b7;return _0x204ffc;})[_0x8697('0x23')](respondWithFilteredResult(_0x30e519,_0x3b687c))['catch'](handleError(_0x30e519,null));};exports['show']=function(_0x3bb647,_0x776021){var _0xc94ba2={'raw':!![],'where':{'id':_0x3bb647[_0x8697('0x57')]['id']}},_0xfbed2f={};_0xfbed2f[_0x8697('0x4a')]=_[_0x8697('0x48')](db[_0x8697('0x43')][_0x8697('0x44')]);_0xfbed2f[_0x8697('0x47')]=_[_0x8697('0x48')](_0x3bb647[_0x8697('0x47')]);_0xfbed2f[_0x8697('0x51')]=_['intersection'](_0xfbed2f[_0x8697('0x4a')],_0xfbed2f[_0x8697('0x47')]);_0xc94ba2[_0x8697('0x4c')]=_[_0x8697('0x49')](_0xfbed2f[_0x8697('0x4a')],qs[_0x8697('0x4b')](_0x3bb647[_0x8697('0x47')]['fields']));_0xc94ba2[_0x8697('0x4c')]=_0xc94ba2[_0x8697('0x4c')]['length']?_0xc94ba2[_0x8697('0x4c')]:_0xfbed2f[_0x8697('0x4a')];if(_0x3bb647['query'][_0x8697('0x54')]){_0xc94ba2[_0x8697('0x55')]=[{'all':!![]}];}_0xc94ba2=_[_0x8697('0x58')]({},_0xc94ba2,_0x3bb647[_0x8697('0x59')]);return db[_0x8697('0x43')]['find'](_0xc94ba2)[_0x8697('0x23')](handleEntityNotFound(_0x776021,null))[_0x8697('0x23')](respondWithResult(_0x776021,null))[_0x8697('0x2e')](handleError(_0x776021,null));};exports[_0x8697('0x5a')]=function(_0x336f80,_0x54212f){return db[_0x8697('0x43')][_0x8697('0x5a')](_0x336f80[_0x8697('0x5b')],{})[_0x8697('0x23')](respondWithResult(_0x54212f,0xc9))[_0x8697('0x2e')](handleError(_0x54212f,null));};exports[_0x8697('0x3c')]=function(_0x15b06f,_0x2da733){if(_0x15b06f['body']['id']){delete _0x15b06f[_0x8697('0x5b')]['id'];}return db['ChatMessage'][_0x8697('0x5c')]({'where':{'id':_0x15b06f[_0x8697('0x57')]['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x2da733,null))[_0x8697('0x23')](saveUpdates(_0x15b06f['body'],null))[_0x8697('0x23')](respondWithResult(_0x2da733,null))[_0x8697('0x2e')](handleError(_0x2da733,null));};exports[_0x8697('0x3d')]=function(_0x4c77bd,_0x1c6b54){return db[_0x8697('0x43')][_0x8697('0x5c')]({'where':{'id':_0x4c77bd['params']['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x1c6b54,null))[_0x8697('0x23')](removeEntity(_0x1c6b54,null))[_0x8697('0x2e')](handleError(_0x1c6b54,null));};exports[_0x8697('0x5d')]=function(_0x1bf191,_0x1a9a9e){return db[_0x8697('0x43')][_0x8697('0x5d')]()['then'](respondWithResult(_0x1a9a9e,null))[_0x8697('0x2e')](handleError(_0x1a9a9e,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x8697('0x5e')]=function(_0x4db806,_0x4aad73,_0x1d734f){var _0x44d102={'agent':{},'channel':_0x8697('0x5f')};if(_0x4db806[_0x8697('0x5b')]['id']){delete _0x4db806[_0x8697('0x5b')]['id'];}_0x4db806['body']['read']=!![];_0x4db806[_0x8697('0x5b')][_0x8697('0x60')]=moment()[_0x8697('0x61')](_0x8697('0x62'));_0x4db806['body'][_0x8697('0x63')]=_0x4db806[_0x8697('0x5b')][_0x8697('0x63')]||_0x4db806[_0x8697('0x64')]['id'];_0x44d102['agent']['id']=_0x4db806['body'][_0x8697('0x63')];return db[_0x8697('0x43')]['find']({'where':{'id':_0x4db806[_0x8697('0x57')]['id'],'UserId':null}})[_0x8697('0x23')](handleEntityNotFound(_0x4aad73,null))[_0x8697('0x23')](saveUpdates(_0x4db806[_0x8697('0x5b')],null))['then'](function(_0x375c4d){if(_0x375c4d){_0x44d102[_0x8697('0x2c')]=_0x375c4d[_0x8697('0x65')]({'plain':!![]});return db['ChatInteraction'][_0x8697('0x5c')]({'where':{'id':_0x375c4d[_0x8697('0x66')]}});}return null;})[_0x8697('0x23')](handleEntityNotFound(_0x4aad73,null))['then'](function(_0x53cc93){if(_0x53cc93){return _0x53cc93[_0x8697('0x3c')]({'UserId':_0x4db806['body'][_0x8697('0x63')],'read1stAt':_[_0x8697('0x67')](_0x53cc93[_0x8697('0x68')])?moment()[_0x8697('0x61')](_0x8697('0x62')):undefined});}return null;})[_0x8697('0x23')](function(_0x235c96){if(_0x235c96){_0x44d102[_0x8697('0x69')]=_0x235c96[_0x8697('0x65')]({'plain':!![]});interaction_log[_0x8697('0x24')](_0x8697('0x6a'),_0x4db806[_0x8697('0x64')]['id'],_0x4db806[_0x8697('0x64')]['name'],_0x4db806[_0x8697('0x64')][_0x8697('0x6b')],_0x44d102[_0x8697('0x69')]['id'],_0x4db806[_0x8697('0x5b')]?JSON[_0x8697('0x29')](_0x4db806[_0x8697('0x5b')]):_0x8697('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x8697('0x6d'),_0x44d102);}return null;})['then'](function(_0x605044){var _0x3c2ca7=_0x8697('0x6e')+_0x605044[_0x8697('0x2c')][_0x8697('0x6f')];return db['sequelize'][_0x8697('0x47')](_0x3c2ca7,{'type':db[_0x8697('0x70')][_0x8697('0x71')][_0x8697('0x72')],'raw':!![]})[_0x8697('0x23')](function(_0x49c831){return _0x49c831;});})[_0x8697('0x23')](function(_0x383049){if(_0x383049){_0x44d102[_0x8697('0x2c')]['contact']=_0x383049[0x0];if(!_0x4db806['body'][_0x8697('0x63')])return;return db[_0x8697('0x73')][_0x8697('0x5c')]({'where':{'id':_0x4db806[_0x8697('0x5b')][_0x8697('0x63')],'role':_0x8697('0x74')},'attributes':['id',_0x8697('0x3f'),_0x8697('0x75'),_0x8697('0x76'),'internal'],'raw':!![]});}return null;})['then'](function(_0x2604fc){if(!_0x2604fc)return null;_0x44d102[_0x8697('0x2c')][_0x8697('0x74')]=_0x2604fc;return _0x44d102;})[_0x8697('0x23')](function(_0x1c18ef){if(_0x1c18ef){if(_0x4db806[_0x8697('0x5b')]['manual']){_0x44d102[_0x8697('0x2c')][_0x8697('0x77')]=util[_0x8697('0x61')](_0x8697('0x78'),_0x4db806[_0x8697('0x64')][_0x8697('0x3f')]);_0x44d102[_0x8697('0x2c')][_0x8697('0x79')]=_0x44d102[_0x8697('0x79')];_0x44d102[_0x8697('0x2c')][_0x8697('0x7a')]=_0x44d102[_0x8697('0x79')];_0x44d102[_0x8697('0x2c')]['event']='accept';return respondWithRpcPromise(_0x8697('0x7b'),_0x8697('0x7b'),{'event':_0x8697('0x7c'),'message':_['merge'](_0x44d102[_0x8697('0x2c')],JSON[_0x8697('0x7d')](_0x44d102[_0x8697('0x69')][_0x8697('0x7e')]))},client9002)['then'](function(){return _0x44d102;});}return _0x44d102;}return null;})[_0x8697('0x23')](respondWithResult(_0x4aad73,null))[_0x8697('0x2e')](handleError(_0x4aad73,null));};var interaction_log=require(_0x8697('0x18'))(_0x8697('0x7f'));exports[_0x8697('0x3a')]=function(_0x50416d,_0x2b1ba4,_0x2544a1){var _0x17dff3={'agent':{},'channel':_0x8697('0x5f')};if(_0x50416d[_0x8697('0x5b')]['id']){delete _0x50416d[_0x8697('0x5b')]['id'];}_0x50416d[_0x8697('0x5b')][_0x8697('0x63')]=_0x50416d[_0x8697('0x5b')][_0x8697('0x63')]||_0x50416d[_0x8697('0x64')]['id'];_0x17dff3[_0x8697('0x74')]['id']=_0x50416d[_0x8697('0x5b')][_0x8697('0x63')];return db[_0x8697('0x43')]['find']({'where':{'id':_0x50416d[_0x8697('0x57')]['id'],'UserId':null}})[_0x8697('0x23')](handleEntityNotFound(_0x2b1ba4,null))['then'](function(_0x343457){if(_0x343457){_0x17dff3['message']=_0x343457['get']({'plain':!![]});return db[_0x8697('0x80')][_0x8697('0x5c')]({'where':{'id':_0x343457[_0x8697('0x66')]}});}return null;})[_0x8697('0x23')](handleEntityNotFound(_0x2b1ba4,null))[_0x8697('0x23')](function(_0x1d483f){if(_0x1d483f){_0x17dff3[_0x8697('0x69')]=_0x1d483f[_0x8697('0x65')]({'plain':!![]});interaction_log[_0x8697('0x24')](_0x8697('0x81'),_0x50416d['user']['id'],_0x50416d[_0x8697('0x64')][_0x8697('0x3f')],_0x50416d[_0x8697('0x64')][_0x8697('0x6b')],_0x17dff3['interaction']['id'],_0x50416d[_0x8697('0x5b')]?JSON[_0x8697('0x29')](_0x50416d['body']):_0x8697('0x6c'));return respondWithRpcPromise('RejectMessage',_0x8697('0x82'),_0x17dff3);}return null;})['then'](function(_0x147841){var _0x5bb4dd=_0x8697('0x6e')+_0x147841[_0x8697('0x2c')][_0x8697('0x6f')];return db[_0x8697('0x83')][_0x8697('0x47')](_0x5bb4dd,{'type':db[_0x8697('0x70')][_0x8697('0x71')][_0x8697('0x72')],'raw':!![]})['then'](function(_0xf2e5d8){return _0xf2e5d8;});})[_0x8697('0x23')](function(_0x29fb90){if(_0x29fb90){_0x17dff3[_0x8697('0x2c')]['contact']=_0x29fb90[0x0];if(!_0x50416d[_0x8697('0x5b')][_0x8697('0x63')])return;return db['User'][_0x8697('0x5c')]({'where':{'id':_0x50416d['body'][_0x8697('0x63')],'role':'agent'},'attributes':['id','name',_0x8697('0x75'),_0x8697('0x76'),_0x8697('0x84')],'raw':!![]});}return null;})[_0x8697('0x23')](function(_0x24f250){if(!_0x24f250)return null;_0x17dff3['message'][_0x8697('0x74')]=_0x24f250;return _0x17dff3;})[_0x8697('0x23')](function(_0x443443){if(_0x443443){_0x443443[_0x8697('0x2c')][_0x8697('0x77')]=util['format'](_0x8697('0x78'),_0x50416d[_0x8697('0x64')]['name']);_0x443443['message']['channel']=_0x17dff3[_0x8697('0x79')];_0x443443[_0x8697('0x2c')][_0x8697('0x7a')]=_0x17dff3[_0x8697('0x79')];_0x443443['message'][_0x8697('0x85')]=_0x8697('0x3a');respondWithRpcPromise('EventManager','EventManager',{'event':_0x8697('0x86'),'message':_['merge'](_0x17dff3[_0x8697('0x2c')],JSON[_0x8697('0x7d')](_0x17dff3[_0x8697('0x69')][_0x8697('0x7e')]))},client9002);return _0x17dff3;}return null;})[_0x8697('0x23')](respondWithResult(_0x2b1ba4,null))[_0x8697('0x2e')](handleError(_0x2b1ba4,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index da944a3..fe471ec 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 _0x6a3b=['setMaxListeners','save','remove','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage'];(function(_0x466889,_0x3c822e){var _0x1428b0=function(_0x5ae2dc){while(--_0x5ae2dc){_0x466889['push'](_0x466889['shift']());}};_0x1428b0(++_0x3c822e);}(_0x6a3b,0x1de));var _0xb6a3=function(_0x51d631,_0x5de154){_0x51d631=_0x51d631-0x0;var _0x1d5a28=_0x6a3b[_0x51d631];return _0x1d5a28;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xb6a3('0x0'))['db'][_0xb6a3('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb6a3('0x2')](0x0);var events={'afterCreate':_0xb6a3('0x3'),'afterUpdate':'update','afterDestroy':_0xb6a3('0x4')};function emitEvent(_0x1e32c0){return function(_0x5e9956,_0x33b32a,_0x4c199a){ChatMessageEvents['emit'](_0x1e32c0+':'+_0x5e9956['id'],_0x5e9956);ChatMessageEvents['emit'](_0x1e32c0,_0x5e9956);_0x4c199a(null);};}for(var e in events){if(events[_0xb6a3('0x5')](e)){var event=events[e];ChatMessage[_0xb6a3('0x6')](e,emitEvent(event));}}module[_0xb6a3('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x57fa=['exports','events','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x57fa,0x135));var _0xa57f=function(_0x11cb1c,_0x2c0036){_0x11cb1c=_0x11cb1c-0x0;var _0x5359fc=_0x57fa[_0x11cb1c];return _0x5359fc;};'use strict';var EventEmitter=require(_0xa57f('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa57f('0x1')](0x0);var events={'afterCreate':_0xa57f('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x411b15){return function(_0x37802c,_0x34b12d,_0x253b51){ChatMessageEvents[_0xa57f('0x3')](_0x411b15+':'+_0x37802c['id'],_0x37802c);ChatMessageEvents[_0xa57f('0x3')](_0x411b15,_0x37802c);_0x253b51(null);};}for(var e in events){if(events[_0xa57f('0x4')](e)){var event=events[e];ChatMessage[_0xa57f('0x5')](e,emitEvent(event));}}module[_0xa57f('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 9c14e27..4272b39 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 _0x55bf=['models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','then','createdAt','catch','error','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x55bf,0x107));var _0xf55b=function(_0x5c6160,_0x112b30){_0x5c6160=_0x5c6160-0x0;var _0x1f2d2d=_0x55bf[_0x5c6160];return _0x1f2d2d;};'use strict';var _=require('lodash');var util=require(_0xf55b('0x0'));var logger=require(_0xf55b('0x1'))(_0xf55b('0x2'));var moment=require(_0xf55b('0x3'));var BPromise=require(_0xf55b('0x4'));var rp=require(_0xf55b('0x5'));var fs=require('fs');var path=require(_0xf55b('0x6'));var rimraf=require(_0xf55b('0x7'));var config=require(_0xf55b('0x8'));var attributes=require(_0xf55b('0x9'));module[_0xf55b('0xa')]=function(_0x240fc2,_0x30303f){return _0x240fc2[_0xf55b('0xb')]('ChatMessage',attributes,{'tableName':_0xf55b('0xc'),'paranoid':![],'indexes':[{'name':_0xf55b('0xd'),'fields':[_0xf55b('0xe')],'type':_0xf55b('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e087e,_0x233dcb,_0x45e9bc){var _0x3cf900=_0x240fc2[_0xf55b('0x10')];var _0x4dae26=_0x5e087e[_0xf55b('0x11')]({'plain':!![]});if(_0x4dae26[_0xf55b('0x12')][_0xf55b('0x13')]()==='in'||_0x4dae26['direction'][_0xf55b('0x13')]()===_0xf55b('0x14')&&!_0x4dae26[_0xf55b('0x15')]&&!_[_0xf55b('0x16')](_0x4dae26[_0xf55b('0x17')])){_0x3cf900[_0xf55b('0x18')][_0xf55b('0x19')]({'where':{'id':_0x4dae26['ChatInteractionId']}})[_0xf55b('0x1a')](function(_0x1e3764){if(_0x1e3764){_0x1e3764['update']({'lastMsgAt':_0x4dae26[_0xf55b('0x1b')],'lastMsgDirection':_0x4dae26['direction'][_0xf55b('0x13')]()});}})[_0xf55b('0x1c')](function(_0x5c79b3){console[_0xf55b('0x1d')](_0x5c79b3);});}_0x45e9bc();}},'charset':_0xf55b('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xffaa=['secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','FULLTEXT','models','direction','toLowerCase','out'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0xffaa,0x129));var _0xaffa=function(_0x49fc48,_0x53d9e6){_0x49fc48=_0x49fc48-0x0;var _0x365b52=_0xffaa[_0x49fc48];return _0x365b52;};'use strict';var _=require('lodash');var util=require(_0xaffa('0x0'));var logger=require('../../config/logger')(_0xaffa('0x1'));var moment=require('moment');var BPromise=require(_0xaffa('0x2'));var rp=require(_0xaffa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaffa('0x4'));var config=require(_0xaffa('0x5'));var attributes=require(_0xaffa('0x6'));module['exports']=function(_0x43c026,_0x1ee484){return _0x43c026[_0xaffa('0x7')](_0xaffa('0x8'),attributes,{'tableName':_0xaffa('0x9'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0xaffa('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x14522b,_0x21accb,_0x325e0e){var _0x45d48c=_0x43c026[_0xaffa('0xb')];var _0x9e7da7=_0x14522b['get']({'plain':!![]});if(_0x9e7da7[_0xaffa('0xc')][_0xaffa('0xd')]()==='in'||_0x9e7da7['direction'][_0xaffa('0xd')]()===_0xaffa('0xe')&&!_0x9e7da7[_0xaffa('0xf')]&&!_[_0xaffa('0x10')](_0x9e7da7['UserId'])){_0x45d48c[_0xaffa('0x11')][_0xaffa('0x12')]({'where':{'id':_0x9e7da7[_0xaffa('0x13')]}})[_0xaffa('0x14')](function(_0x5050ea){if(_0x5050ea){_0x5050ea[_0xaffa('0x15')]({'lastMsgAt':_0x9e7da7['createdAt'],'lastMsgDirection':_0x9e7da7['direction'][_0xaffa('0xd')]()});}})[_0xaffa('0x16')](function(_0x1ad80e){console[_0xaffa('0x17')](_0x1ad80e);});}_0x325e0e();}},'charset':_0xaffa('0x18'),'collate':_0xaffa('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index ac7a5be..696d87f 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 _0x483f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','register','request','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateChatMessage','ChatMessage','body','options','then','debug','stringify','lodash','util','moment','bluebird'];(function(_0x276fcc,_0x52efb7){var _0x395db8=function(_0x74be4e){while(--_0x74be4e){_0x276fcc['push'](_0x276fcc['shift']());}};_0x395db8(++_0x52efb7);}(_0x483f,0x11c));var _0xf483=function(_0x364ed6,_0x14c306){_0x364ed6=_0x364ed6-0x0;var _0x501248=_0x483f[_0x364ed6];return _0x501248;};'use strict';var _=require(_0xf483('0x0'));var util=require(_0xf483('0x1'));var moment=require(_0xf483('0x2'));var BPromise=require(_0xf483('0x3'));var rs=require(_0xf483('0x4'));var fs=require('fs');var Redis=require(_0xf483('0x5'));var db=require(_0xf483('0x6'))['db'];var utils=require(_0xf483('0x7'));var logger=require(_0xf483('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf483('0x9')][_0xf483('0xa')]({'port':0x232a});config[_0xf483('0xb')]=_[_0xf483('0xc')](config[_0xf483('0xb')],{'host':_0xf483('0xd'),'port':0x18eb});var socket=require(_0xf483('0xe'))(new Redis(config[_0xf483('0xb')]));require('./chatMessage.socket')[_0xf483('0xf')](socket);function respondWithRpcPromise(_0x4a2a8d,_0x521477,_0x220c7a){return new BPromise(function(_0x16c2b6,_0x1d735d){return client[_0xf483('0x10')](_0x4a2a8d,_0x220c7a)['then'](function(_0x3978eb){logger['info'](_0xf483('0x11'),_0x521477,_0xf483('0x12'));logger['debug'](_0xf483('0x13'),_0x521477,_0xf483('0x12'),JSON['stringify'](_0x3978eb));if(_0x3978eb['error']){if(_0x3978eb[_0xf483('0x14')][_0xf483('0x15')]===0x1f4){logger[_0xf483('0x14')](_0xf483('0x11'),_0x521477,_0x3978eb[_0xf483('0x14')]['message']);return _0x1d735d(_0x3978eb[_0xf483('0x14')][_0xf483('0x16')]);}logger['error'](_0xf483('0x11'),_0x521477,_0x3978eb[_0xf483('0x14')][_0xf483('0x16')]);return _0x16c2b6(_0x3978eb[_0xf483('0x14')][_0xf483('0x16')]);}else{logger[_0xf483('0x17')](_0xf483('0x11'),_0x521477,_0xf483('0x12'));_0x16c2b6(_0x3978eb['result'][_0xf483('0x16')]);}})[_0xf483('0x18')](function(_0x378f80){logger['error']('ChatMessage,\x20%s,\x20%s',_0x521477,_0x378f80);_0x1d735d(_0x378f80);});});}exports[_0xf483('0x19')]=function(_0x2f2070){var _0x2a6f64=this;return new Promise(function(_0x4a1f72,_0x390fbd){return db[_0xf483('0x1a')]['create'](_0x2f2070[_0xf483('0x1b')],{'raw':_0x2f2070['options']?_0x2f2070[_0xf483('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xf483('0x1d')](function(_0x4a4489){logger[_0xf483('0x17')](_0xf483('0x19'),_0x2f2070);logger[_0xf483('0x1e')](_0xf483('0x19'),_0x2f2070,JSON[_0xf483('0x1f')](_0x4a4489));_0x4a1f72(_0x4a4489);})[_0xf483('0x18')](function(_0x398599){logger['error'](_0xf483('0x19'),_0x398599[_0xf483('0x16')],_0x2f2070);_0x390fbd(_0x2a6f64[_0xf483('0x14')](0x1f4,_0x398599[_0xf483('0x16')]));});});}; \ No newline at end of file +var _0xed49=['./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateChatMessage','options','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xed49,0x128));var _0x9ed4=function(_0xe8f877,_0x12582b){_0xe8f877=_0xe8f877-0x0;var _0x3c3283=_0xed49[_0xe8f877];return _0x3c3283;};'use strict';var _=require(_0x9ed4('0x0'));var util=require(_0x9ed4('0x1'));var moment=require('moment');var BPromise=require(_0x9ed4('0x2'));var rs=require(_0x9ed4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ed4('0x4'))['db'];var utils=require(_0x9ed4('0x5'));var logger=require(_0x9ed4('0x6'))(_0x9ed4('0x7'));var config=require('../../config/environment');var jayson=require(_0x9ed4('0x8'));var client=jayson[_0x9ed4('0x9')][_0x9ed4('0xa')]({'port':0x232a});config[_0x9ed4('0xb')]=_['defaults'](config[_0x9ed4('0xb')],{'host':_0x9ed4('0xc'),'port':0x18eb});var socket=require(_0x9ed4('0xd'))(new Redis(config[_0x9ed4('0xb')]));require(_0x9ed4('0xe'))[_0x9ed4('0xf')](socket);function respondWithRpcPromise(_0x1eadb5,_0x1dac74,_0xb9e6f3){return new BPromise(function(_0x7dab87,_0x3eef26){return client[_0x9ed4('0x10')](_0x1eadb5,_0xb9e6f3)[_0x9ed4('0x11')](function(_0x408770){logger[_0x9ed4('0x12')](_0x9ed4('0x13'),_0x1dac74,_0x9ed4('0x14'));logger[_0x9ed4('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1dac74,'request\x20sent',JSON[_0x9ed4('0x16')](_0x408770));if(_0x408770[_0x9ed4('0x17')]){if(_0x408770[_0x9ed4('0x17')][_0x9ed4('0x18')]===0x1f4){logger[_0x9ed4('0x17')](_0x9ed4('0x13'),_0x1dac74,_0x408770[_0x9ed4('0x17')]['message']);return _0x3eef26(_0x408770[_0x9ed4('0x17')]['message']);}logger[_0x9ed4('0x17')](_0x9ed4('0x13'),_0x1dac74,_0x408770['error']['message']);return _0x7dab87(_0x408770['error'][_0x9ed4('0x19')]);}else{logger[_0x9ed4('0x12')](_0x9ed4('0x13'),_0x1dac74,_0x9ed4('0x14'));_0x7dab87(_0x408770[_0x9ed4('0x1a')][_0x9ed4('0x19')]);}})[_0x9ed4('0x1b')](function(_0x2886f9){logger[_0x9ed4('0x17')](_0x9ed4('0x13'),_0x1dac74,_0x2886f9);_0x3eef26(_0x2886f9);});});}exports[_0x9ed4('0x1c')]=function(_0x45b0d2){var _0x2a5caa=this;return new Promise(function(_0x478494,_0x203781){return db['ChatMessage']['create'](_0x45b0d2['body'],{'raw':_0x45b0d2[_0x9ed4('0x1d')]?_0x45b0d2[_0x9ed4('0x1d')][_0x9ed4('0x1e')]===undefined?!![]:![]:!![]})[_0x9ed4('0x11')](function(_0x318673){logger[_0x9ed4('0x12')]('CreateChatMessage',_0x45b0d2);logger['debug']('CreateChatMessage',_0x45b0d2,JSON[_0x9ed4('0x16')](_0x318673));_0x478494(_0x318673);})[_0x9ed4('0x1b')](function(_0x42fc0d){logger['error'](_0x9ed4('0x1c'),_0x42fc0d[_0x9ed4('0x19')],_0x45b0d2);_0x203781(_0x2a5caa[_0x9ed4('0x17')](0x1f4,_0x42fc0d[_0x9ed4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 65600e8..e602c76 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 _0x45d1=['removeListener','register','length','./chatMessage.events','save','update'];(function(_0x243073,_0x33b885){var _0x569624=function(_0x2e1af3){while(--_0x2e1af3){_0x243073['push'](_0x243073['shift']());}};_0x569624(++_0x33b885);}(_0x45d1,0x1cb));var _0x145d=function(_0x301c34,_0x15701e){_0x301c34=_0x301c34-0x0;var _0x1a8c5a=_0x45d1[_0x301c34];return _0x1a8c5a;};'use strict';var ChatMessageEvents=require(_0x145d('0x0'));var events=[_0x145d('0x1'),'remove',_0x145d('0x2')];function createListener(_0x1d1ab1,_0x4f5dd4){return function(_0x22f728){_0x4f5dd4['emit'](_0x1d1ab1,_0x22f728);};}function removeListener(_0x3076c2,_0x327cd3){return function(){ChatMessageEvents[_0x145d('0x3')](_0x3076c2,_0x327cd3);};}exports[_0x145d('0x4')]=function(_0x14ddd8){for(var _0x2896c3=0x0,_0xbc4161=events[_0x145d('0x5')];_0x2896c3<_0xbc4161;_0x2896c3++){var _0x46a729=events[_0x2896c3];var _0x47eadc=createListener('chatMessage:'+_0x46a729,_0x14ddd8);ChatMessageEvents['on'](_0x46a729,_0x47eadc);}}; \ No newline at end of file +var _0x0bde=['save','update','emit','removeListener','register','length','chatMessage:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bde,0xe7));var _0xe0bd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0bde[_0x2641f9];return _0x585741;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xe0bd('0x0'),'remove',_0xe0bd('0x1')];function createListener(_0x3dc984,_0x1d8922){return function(_0x1e198a){_0x1d8922[_0xe0bd('0x2')](_0x3dc984,_0x1e198a);};}function removeListener(_0x5541b9,_0x34df88){return function(){ChatMessageEvents[_0xe0bd('0x3')](_0x5541b9,_0x34df88);};}exports[_0xe0bd('0x4')]=function(_0x3b712a){for(var _0x22bfd1=0x0,_0x26393f=events[_0xe0bd('0x5')];_0x22bfd1<_0x26393f;_0x22bfd1++){var _0x491dc7=events[_0x22bfd1];var _0x40b36a=createListener(_0xe0bd('0x6')+_0x491dc7,_0x3b712a);ChatMessageEvents['on'](_0x491dc7,_0x40b36a);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 7454060..da86fda 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 _0xfd57=['reject','destroy','exports','multer','util','path','Router','../../components/auth/service','./chatMessage.controller','get','/describe','describe','isAuthenticated','show','post','tracked','chat','chatmessage:create','put','/:id','update','/:id/accept','accept','/:id/reject'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xfd57,0x183));var _0x7fd5=function(_0xe83f06,_0x5cad4a){_0xe83f06=_0xe83f06-0x0;var _0x4b6ccd=_0xfd57[_0xe83f06];return _0x4b6ccd;};'use strict';var multer=require(_0x7fd5('0x0'));var util=require(_0x7fd5('0x1'));var path=require(_0x7fd5('0x2'));var timeout=require('connect-timeout');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('../../config/environment');var controller=require(_0x7fd5('0x5'));router[_0x7fd5('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7fd5('0x6')](_0x7fd5('0x7'),auth['isAuthenticated'](),controller[_0x7fd5('0x8')]);router[_0x7fd5('0x6')]('/:id',auth[_0x7fd5('0x9')](),controller[_0x7fd5('0xa')]);router[_0x7fd5('0xb')]('/',auth['isAuthenticated'](),interaction[_0x7fd5('0xc')](_0x7fd5('0xd'),_0x7fd5('0xe')),controller['create']);router[_0x7fd5('0xf')](_0x7fd5('0x10'),controller[_0x7fd5('0x11')]);router['put'](_0x7fd5('0x12'),auth[_0x7fd5('0x9')](),controller[_0x7fd5('0x13')]);router[_0x7fd5('0xf')](_0x7fd5('0x14'),auth['isAuthenticated'](),controller[_0x7fd5('0x15')]);router['delete'](_0x7fd5('0x10'),auth[_0x7fd5('0x9')](),controller[_0x7fd5('0x16')]);module[_0x7fd5('0x17')]=router; \ No newline at end of file +var _0x4729=['multer','path','express','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','post','chat','chatmessage:create','create','put','/:id/accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x1cdbaf,_0x5e8a50){var _0x3b060c=function(_0x5680c0){while(--_0x5680c0){_0x1cdbaf['push'](_0x1cdbaf['shift']());}};_0x3b060c(++_0x5e8a50);}(_0x4729,0x14a));var _0x9472=function(_0x587b55,_0x58cce0){_0x587b55=_0x587b55-0x0;var _0x51f07f=_0x4729[_0x587b55];return _0x51f07f;};'use strict';var multer=require(_0x9472('0x0'));var util=require('util');var path=require(_0x9472('0x1'));var timeout=require('connect-timeout');var express=require(_0x9472('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9472('0x3'));var controller=require(_0x9472('0x4'));router['get']('/',auth[_0x9472('0x5')](),controller[_0x9472('0x6')]);router[_0x9472('0x7')](_0x9472('0x8'),auth[_0x9472('0x5')](),controller[_0x9472('0x9')]);router[_0x9472('0x7')](_0x9472('0xa'),auth[_0x9472('0x5')](),controller['show']);router[_0x9472('0xb')]('/',auth[_0x9472('0x5')](),interaction['tracked'](_0x9472('0xc'),_0x9472('0xd')),controller[_0x9472('0xe')]);router[_0x9472('0xf')](_0x9472('0xa'),controller['update']);router['put'](_0x9472('0x10'),auth['isAuthenticated'](),controller['accept']);router[_0x9472('0xf')](_0x9472('0x11'),auth[_0x9472('0x5')](),controller[_0x9472('0x12')]);router[_0x9472('0x13')](_0x9472('0xa'),auth['isAuthenticated'](),controller[_0x9472('0x14')]);module[_0x9472('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 539c679..fad03d9 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 _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x3ca301,_0x5ee8a2){var _0x1cccc3=function(_0x4778d8){while(--_0x4778d8){_0x3ca301['push'](_0x3ca301['shift']());}};_0x1cccc3(++_0x5ee8a2);}(_0xdb28,0x106));var _0x8db2=function(_0x555d43,_0x521cc7){_0x555d43=_0x555d43-0x0;var _0x205038=_0xdb28[_0x555d43];return _0x205038;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['medium','TEXT','exports'];(function(_0x14fdce,_0xd5f695){var _0x1ebdb9=function(_0x5ea7f7){while(--_0x5ea7f7){_0x14fdce['push'](_0x14fdce['shift']());}};_0x1ebdb9(++_0xd5f695);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 5ae3752..f799aa6 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(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x7a54,0x106));var _0x47a5=function(_0x5c65bf,_0x522020){_0x5c65bf=_0x5c65bf-0x0;var _0xa950ee=_0x7a54[_0x5c65bf];return _0xa950ee;};'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(_0x12ddd2,_0xbd105d){var _0x25a558=function(_0xed2e03){while(--_0xed2e03){_0x12ddd2['push'](_0x12ddd2['shift']());}};_0x25a558(++_0xbd105d);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 83c9abc..1d27ecf 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 _0x5554=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x3e5f22,_0x42c42c){var _0x1d0e1a=function(_0x99d5d4){while(--_0x99d5d4){_0x3e5f22['push'](_0x3e5f22['shift']());}};_0x1d0e1a(++_0x42c42c);}(_0x5554,0xfc));var _0x4555=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5554[_0x580576];return _0x3f55a0;};'use strict';var EventEmitter=require(_0x4555('0x0'));var ChatOfflineMessage=require(_0x4555('0x1'))['db'][_0x4555('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x4555('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x406d92){return function(_0x5e4875,_0x5cbed8,_0x34643a){ChatOfflineMessageEvents[_0x4555('0x4')](_0x406d92+':'+_0x5e4875['id'],_0x5e4875);ChatOfflineMessageEvents[_0x4555('0x4')](_0x406d92,_0x5e4875);_0x34643a(null);};}for(var e in events){if(events[_0x4555('0x5')](e)){var event=events[e];ChatOfflineMessage[_0x4555('0x6')](e,emitEvent(event));}}module[_0x4555('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xed1f=['events','../../mysqldb','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed1f,0x170));var _0xfed1=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xed1f[_0x5ddaac];return _0x2a9c58;};'use strict';var EventEmitter=require(_0xfed1('0x0'));var ChatOfflineMessage=require(_0xfed1('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfed1('0x2'),'afterUpdate':'update','afterDestroy':_0xfed1('0x3')};function emitEvent(_0x501da6){return function(_0x444ba8,_0x423af3,_0x198341){ChatOfflineMessageEvents[_0xfed1('0x4')](_0x501da6+':'+_0x444ba8['id'],_0x444ba8);ChatOfflineMessageEvents[_0xfed1('0x4')](_0x501da6,_0x444ba8);_0x198341(null);};}for(var e in events){if(events[_0xfed1('0x5')](e)){var event=events[e];ChatOfflineMessage[_0xfed1('0x6')](e,emitEvent(event));}}module[_0xfed1('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 2c06471..f5f9369 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 _0xe8e2=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes'];(function(_0x5bd0c0,_0x4c7afe){var _0x4007a3=function(_0x1c9a5c){while(--_0x1c9a5c){_0x5bd0c0['push'](_0x5bd0c0['shift']());}};_0x4007a3(++_0x4c7afe);}(_0xe8e2,0x131));var _0x2e8e=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xe8e2[_0x36ed48];return _0x51c63a;};'use strict';var attributes=require(_0x2e8e('0x0'));module[_0x2e8e('0x1')]=function(_0x51e710){return _0x51e710[_0x2e8e('0x2')](_0x2e8e('0x3'),attributes,{'tableName':_0x2e8e('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2e8e('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x98e9=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x98e9,0x102));var _0x998e=function(_0x5db53b,_0x247450){_0x5db53b=_0x5db53b-0x0;var _0x1009be=_0x98e9[_0x5db53b];return _0x1009be;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x998e('0x0')]=function(_0x4d3a6c){return _0x4d3a6c[_0x998e('0x1')](_0x998e('0x2'),attributes,{'tableName':_0x998e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x998e('0x4'),'collate':_0x998e('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 13012c1..e8137bb 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 _0x2c79=['../../config/utils','rpc','../../config/environment','client','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0x2c79,0x164));var _0x92c7=function(_0x28f01e,_0xfb427f){_0x28f01e=_0x28f01e-0x0;var _0x16e587=_0x2c79[_0x28f01e];return _0x16e587;};'use strict';var _=require(_0x92c7('0x0'));var util=require('util');var moment=require(_0x92c7('0x1'));var BPromise=require(_0x92c7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92c7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x92c7('0x4'));var logger=require('../../config/logger')(_0x92c7('0x5'));var config=require(_0x92c7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x92c7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ca9ab,_0x135b32,_0x49f481){return new BPromise(function(_0x5a11eb,_0x2db2b4){return client['request'](_0x1ca9ab,_0x49f481)[_0x92c7('0x8')](function(_0x5ed009){logger['info'](_0x92c7('0x9'),_0x135b32,_0x92c7('0xa'));logger[_0x92c7('0xb')](_0x92c7('0xc'),_0x135b32,'request\x20sent',JSON[_0x92c7('0xd')](_0x5ed009));if(_0x5ed009[_0x92c7('0xe')]){if(_0x5ed009[_0x92c7('0xe')][_0x92c7('0xf')]===0x1f4){logger[_0x92c7('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x135b32,_0x5ed009[_0x92c7('0xe')][_0x92c7('0x10')]);return _0x2db2b4(_0x5ed009[_0x92c7('0xe')][_0x92c7('0x10')]);}logger[_0x92c7('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x135b32,_0x5ed009[_0x92c7('0xe')][_0x92c7('0x10')]);return _0x5a11eb(_0x5ed009['error'][_0x92c7('0x10')]);}else{logger[_0x92c7('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x135b32,_0x92c7('0xa'));_0x5a11eb(_0x5ed009[_0x92c7('0x12')][_0x92c7('0x10')]);}})[_0x92c7('0x13')](function(_0x1048c6){logger[_0x92c7('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x135b32,_0x1048c6);_0x2db2b4(_0x1048c6);});});} \ No newline at end of file +var _0x854a=['request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../config/environment','jayson/promise','client','http','then','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s'];(function(_0x3bd1f8,_0x4ef80d){var _0x3b4bf2=function(_0x36591e){while(--_0x36591e){_0x3bd1f8['push'](_0x3bd1f8['shift']());}};_0x3b4bf2(++_0x4ef80d);}(_0x854a,0x1e8));var _0xa854=function(_0x492054,_0x35f669){_0x492054=_0x492054-0x0;var _0x26baf0=_0x854a[_0x492054];return _0x26baf0;};'use strict';var _=require(_0xa854('0x0'));var util=require(_0xa854('0x1'));var moment=require('moment');var BPromise=require(_0xa854('0x2'));var rs=require(_0xa854('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa854('0x4'));var jayson=require(_0xa854('0x5'));var client=jayson[_0xa854('0x6')][_0xa854('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3e26f6,_0x511fd3,_0x55a0cb){return new BPromise(function(_0x5150fc,_0x4110ed){return client['request'](_0x3e26f6,_0x55a0cb)[_0xa854('0x8')](function(_0x52b63d){logger['info'](_0xa854('0x9'),_0x511fd3,'request\x20sent');logger[_0xa854('0xa')](_0xa854('0xb'),_0x511fd3,_0xa854('0xc'),JSON[_0xa854('0xd')](_0x52b63d));if(_0x52b63d[_0xa854('0xe')]){if(_0x52b63d['error'][_0xa854('0xf')]===0x1f4){logger[_0xa854('0xe')](_0xa854('0x9'),_0x511fd3,_0x52b63d[_0xa854('0xe')][_0xa854('0x10')]);return _0x4110ed(_0x52b63d['error'][_0xa854('0x10')]);}logger[_0xa854('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x511fd3,_0x52b63d[_0xa854('0xe')]['message']);return _0x5150fc(_0x52b63d[_0xa854('0xe')]['message']);}else{logger[_0xa854('0x11')](_0xa854('0x9'),_0x511fd3,'request\x20sent');_0x5150fc(_0x52b63d[_0xa854('0x12')][_0xa854('0x10')]);}})[_0xa854('0x13')](function(_0xaefa67){logger[_0xa854('0xe')](_0xa854('0x9'),_0x511fd3,_0xaefa67);_0x4110ed(_0xaefa67);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 5899716..a91d84e 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 _0x1d47=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','show','post','create','put','update','/:id','destroy','exports','path','Router','fs-extra'];(function(_0x5927af,_0x2194cd){var _0x4ac8ee=function(_0x4f53bd){while(--_0x4f53bd){_0x5927af['push'](_0x5927af['shift']());}};_0x4ac8ee(++_0x2194cd);}(_0x1d47,0x177));var _0x71d4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1d47[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x71d4('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x71d4('0x1')]();var fs_extra=require(_0x71d4('0x2'));var auth=require(_0x71d4('0x3'));var interaction=require(_0x71d4('0x4'));var config=require(_0x71d4('0x5'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x71d4('0x6')]);router[_0x71d4('0x7')](_0x71d4('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x71d4('0x7')]('/:id',auth[_0x71d4('0x9')](),controller[_0x71d4('0xa')]);router[_0x71d4('0xb')]('/',auth[_0x71d4('0x9')](),controller[_0x71d4('0xc')]);router[_0x71d4('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x71d4('0xe')]);router['delete'](_0x71d4('0xf'),auth[_0x71d4('0x9')](),controller[_0x71d4('0x10')]);module[_0x71d4('0x11')]=router; \ No newline at end of file +var _0x14f7=['destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x14f7,0xf1));var _0x714f=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x14f7[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x714f('0x0'));var util=require('util');var path=require(_0x714f('0x1'));var timeout=require(_0x714f('0x2'));var express=require(_0x714f('0x3'));var router=express[_0x714f('0x4')]();var fs_extra=require(_0x714f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x714f('0x6'));var config=require(_0x714f('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0x714f('0x8')]('/',auth[_0x714f('0x9')](),controller[_0x714f('0xa')]);router[_0x714f('0x8')](_0x714f('0xb'),auth[_0x714f('0x9')](),controller[_0x714f('0xc')]);router[_0x714f('0x8')](_0x714f('0xd'),auth[_0x714f('0x9')](),controller[_0x714f('0xe')]);router[_0x714f('0xf')]('/',auth[_0x714f('0x9')](),controller[_0x714f('0x10')]);router[_0x714f('0x11')](_0x714f('0xd'),auth[_0x714f('0x9')](),controller[_0x714f('0x12')]);router['delete'](_0x714f('0xd'),auth[_0x714f('0x9')](),controller[_0x714f('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 9735710..23a56c4 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 _0xe354=['sequelize','exports','STRING','ENUM','mouseOver','INTEGER'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xe354,0xfc));var _0x4e35=function(_0x1350a9,_0xf00430){_0x1350a9=_0x1350a9-0x0;var _0x47b55c=_0xe354[_0x1350a9];return _0x47b55c;};'use strict';var Sequelize=require(_0x4e35('0x0'));module[_0x4e35('0x1')]={'name':{'type':Sequelize[_0x4e35('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4e35('0x3')](_0x4e35('0x4'),'timeout'),'defaultValue':_0x4e35('0x4')},'selector':{'type':Sequelize[_0x4e35('0x2')]},'timeout':{'type':Sequelize[_0x4e35('0x5')]}}; \ No newline at end of file +var _0xbbbd=['ENUM','mouseOver','timeout','INTEGER','sequelize','exports','STRING'];(function(_0x52f159,_0x419d8a){var _0x156799=function(_0xf168e8){while(--_0xf168e8){_0x52f159['push'](_0x52f159['shift']());}};_0x156799(++_0x419d8a);}(_0xbbbd,0x1a1));var _0xdbbb=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xbbbd[_0x19b3f9];return _0x18c3f6;};'use strict';var Sequelize=require(_0xdbbb('0x0'));module[_0xdbbb('0x1')]={'name':{'type':Sequelize[_0xdbbb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdbbb('0x3')](_0xdbbb('0x4'),_0xdbbb('0x5')),'defaultValue':_0xdbbb('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xdbbb('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 2adceb6..c3d7078 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 _0xf360=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','error','name','send','params','model','keys','rawAttributes','query','filters','attributes','intersection','fields','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x508128,_0x58f39f){var _0x1c82e7=function(_0x5aa225){while(--_0x5aa225){_0x508128['push'](_0x508128['shift']());}};_0x1c82e7(++_0x58f39f);}(_0xf360,0x9e));var _0x0f36=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf360[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x0f36('0x0'));var rimraf=require(_0x0f36('0x1'));var zipdir=require(_0x0f36('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f36('0x3'));var moment=require('moment');var BPromise=require(_0x0f36('0x4'));var Mustache=require(_0x0f36('0x5'));var util=require(_0x0f36('0x6'));var path=require('path');var sox=require(_0x0f36('0x7'));var csv=require(_0x0f36('0x8'));var ejs=require(_0x0f36('0x9'));var fs=require('fs');var fs_extra=require(_0x0f36('0xa'));var _=require(_0x0f36('0xb'));var squel=require(_0x0f36('0xc'));var crypto=require(_0x0f36('0xd'));var jsforce=require(_0x0f36('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0f36('0x8'));var querystring=require(_0x0f36('0xf'));var Papa=require(_0x0f36('0x10'));var Redis=require(_0x0f36('0x11'));var authService=require(_0x0f36('0x12'));var qs=require(_0x0f36('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f36('0x14'));var logger=require(_0x0f36('0x15'))(_0x0f36('0x16'));var utils=require('../../config/utils');var config=require(_0x0f36('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x478313,_0xea1040){_0xea1040=_0xea1040||0xcc;return function(_0x4e30cc){if(_0x4e30cc){return _0x478313[_0x0f36('0x18')](_0xea1040);}return _0x478313[_0x0f36('0x19')](_0xea1040)[_0x0f36('0x1a')]();};}function respondWithResult(_0xb021c,_0x5dee19){_0x5dee19=_0x5dee19||0xc8;return function(_0x1a06cc){if(_0x1a06cc){return _0xb021c['status'](_0x5dee19)[_0x0f36('0x1b')](_0x1a06cc);}};}function respondWithFilteredResult(_0x19afe8,_0x420baf){return function(_0x38e64a){if(_0x38e64a){var _0x167825=typeof _0x420baf[_0x0f36('0x1c')]===_0x0f36('0x1d')&&typeof _0x420baf['limit']==='undefined';var _0x2f26d2=_0x38e64a[_0x0f36('0x1e')];var _0x4b48eb=_0x167825?0x0:_0x420baf['offset'];var _0x121ff3=_0x167825?_0x38e64a[_0x0f36('0x1e')]:_0x420baf['offset']+_0x420baf[_0x0f36('0x1f')];var _0x28eaf2;if(_0x121ff3>=_0x2f26d2){_0x121ff3=_0x2f26d2;_0x28eaf2=0xc8;}else{_0x28eaf2=0xce;}_0x19afe8['status'](_0x28eaf2);return _0x19afe8[_0x0f36('0x20')]('Content-Range',_0x4b48eb+'-'+_0x121ff3+'/'+_0x2f26d2)['json'](_0x38e64a);}return null;};}function patchUpdates(_0x2f7972){return function(_0x1b365a){try{jsonpatch['apply'](_0x1b365a,_0x2f7972,!![]);}catch(_0x5888c5){return BPromise[_0x0f36('0x21')](_0x5888c5);}return _0x1b365a[_0x0f36('0x22')]();};}function saveUpdates(_0x5c15d9,_0x249b7a){return function(_0x567814){if(_0x567814){return _0x567814[_0x0f36('0x23')](_0x5c15d9)['then'](function(_0x2eb5be){return _0x2eb5be;});}return null;};}function removeEntity(_0x21837e,_0x15722f){return function(_0x552d90){if(_0x552d90){return _0x552d90[_0x0f36('0x24')]()[_0x0f36('0x25')](function(){_0x21837e[_0x0f36('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e7ee5,_0x23050c){return function(_0x264639){if(!_0x264639){_0x2e7ee5[_0x0f36('0x18')](0x194);}return _0x264639;};}function handleError(_0x55b849,_0x20c2e7){_0x20c2e7=_0x20c2e7||0x1f4;return function(_0x5aaa73){logger[_0x0f36('0x26')](_0x5aaa73['stack']);if(_0x5aaa73[_0x0f36('0x27')]){delete _0x5aaa73[_0x0f36('0x27')];}_0x55b849[_0x0f36('0x19')](_0x20c2e7)[_0x0f36('0x28')](_0x5aaa73);};}exports['show']=function(_0x398dcd,_0x597c6c){var _0x1eacbb={'raw':!![],'where':{'id':_0x398dcd[_0x0f36('0x29')]['id']}},_0x438e29={};_0x438e29[_0x0f36('0x2a')]=_[_0x0f36('0x2b')](db['ChatProactiveAction'][_0x0f36('0x2c')]);_0x438e29[_0x0f36('0x2d')]=_[_0x0f36('0x2b')](_0x398dcd[_0x0f36('0x2d')]);_0x438e29[_0x0f36('0x2e')]=_['intersection'](_0x438e29['model'],_0x438e29[_0x0f36('0x2d')]);_0x1eacbb[_0x0f36('0x2f')]=_[_0x0f36('0x30')](_0x438e29[_0x0f36('0x2a')],qs[_0x0f36('0x31')](_0x398dcd['query'][_0x0f36('0x31')]));_0x1eacbb['attributes']=_0x1eacbb[_0x0f36('0x2f')]['length']?_0x1eacbb[_0x0f36('0x2f')]:_0x438e29['model'];if(_0x398dcd[_0x0f36('0x2d')][_0x0f36('0x32')]){_0x1eacbb[_0x0f36('0x33')]=[{'all':!![]}];}_0x1eacbb=_[_0x0f36('0x34')]({},_0x1eacbb,_0x398dcd[_0x0f36('0x35')]);return db[_0x0f36('0x36')][_0x0f36('0x37')](_0x1eacbb)[_0x0f36('0x25')](handleEntityNotFound(_0x597c6c,null))[_0x0f36('0x25')](respondWithResult(_0x597c6c,null))[_0x0f36('0x38')](handleError(_0x597c6c,null));};exports[_0x0f36('0x39')]=function(_0x44c878,_0x2993b1){return db[_0x0f36('0x36')][_0x0f36('0x39')](_0x44c878[_0x0f36('0x3a')],{})['then'](respondWithResult(_0x2993b1,0xc9))[_0x0f36('0x38')](handleError(_0x2993b1,null));};exports['update']=function(_0x335bb2,_0x395bf5){if(_0x335bb2['body']['id']){delete _0x335bb2[_0x0f36('0x3a')]['id'];}return db[_0x0f36('0x36')]['find']({'where':{'id':_0x335bb2[_0x0f36('0x29')]['id']}})[_0x0f36('0x25')](handleEntityNotFound(_0x395bf5,null))[_0x0f36('0x25')](saveUpdates(_0x335bb2['body'],null))['then'](respondWithResult(_0x395bf5,null))[_0x0f36('0x38')](handleError(_0x395bf5,null));};exports[_0x0f36('0x24')]=function(_0x24fbfa,_0xf0bc4e){return db[_0x0f36('0x36')]['find']({'where':{'id':_0x24fbfa[_0x0f36('0x29')]['id']}})['then'](handleEntityNotFound(_0xf0bc4e,null))['then'](removeEntity(_0xf0bc4e,null))[_0x0f36('0x38')](handleError(_0xf0bc4e,null));}; \ No newline at end of file +var _0x0dba=['intersection','attributes','fields','length','includeAll','merge','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters'];(function(_0x4f2ce6,_0x2a0163){var _0x3dbb40=function(_0x1469a6){while(--_0x1469a6){_0x4f2ce6['push'](_0x4f2ce6['shift']());}};_0x3dbb40(++_0x2a0163);}(_0x0dba,0x136));var _0xa0db=function(_0x47758b,_0x4bdd91){_0x47758b=_0x47758b-0x0;var _0x2feebe=_0x0dba[_0x47758b];return _0x2feebe;};'use strict';var emlformat=require(_0xa0db('0x0'));var rimraf=require(_0xa0db('0x1'));var zipdir=require(_0xa0db('0x2'));var jsonpatch=require(_0xa0db('0x3'));var rp=require(_0xa0db('0x4'));var moment=require(_0xa0db('0x5'));var BPromise=require(_0xa0db('0x6'));var Mustache=require(_0xa0db('0x7'));var util=require(_0xa0db('0x8'));var path=require(_0xa0db('0x9'));var sox=require(_0xa0db('0xa'));var csv=require(_0xa0db('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa0db('0xc'));var crypto=require(_0xa0db('0xd'));var jsforce=require(_0xa0db('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa0db('0xb'));var querystring=require(_0xa0db('0xf'));var Papa=require(_0xa0db('0x10'));var Redis=require(_0xa0db('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa0db('0x12'));var as=require(_0xa0db('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa0db('0x14'));var utils=require(_0xa0db('0x15'));var config=require(_0xa0db('0x16'));var licenseUtil=require(_0xa0db('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15ef0d,_0x19145b){_0x19145b=_0x19145b||0xcc;return function(_0xb161b6){if(_0xb161b6){return _0x15ef0d[_0xa0db('0x18')](_0x19145b);}return _0x15ef0d[_0xa0db('0x19')](_0x19145b)[_0xa0db('0x1a')]();};}function respondWithResult(_0x14d525,_0x3ea19f){_0x3ea19f=_0x3ea19f||0xc8;return function(_0x3eb470){if(_0x3eb470){return _0x14d525['status'](_0x3ea19f)[_0xa0db('0x1b')](_0x3eb470);}};}function respondWithFilteredResult(_0x1048bf,_0x24efb1){return function(_0x1bb2a0){if(_0x1bb2a0){var _0x2d8396=typeof _0x24efb1[_0xa0db('0x1c')]===_0xa0db('0x1d')&&typeof _0x24efb1[_0xa0db('0x1e')]===_0xa0db('0x1d');var _0x590f63=_0x1bb2a0[_0xa0db('0x1f')];var _0x215658=_0x2d8396?0x0:_0x24efb1['offset'];var _0x12766f=_0x2d8396?_0x1bb2a0[_0xa0db('0x1f')]:_0x24efb1[_0xa0db('0x1c')]+_0x24efb1[_0xa0db('0x1e')];var _0x4536fc;if(_0x12766f>=_0x590f63){_0x12766f=_0x590f63;_0x4536fc=0xc8;}else{_0x4536fc=0xce;}_0x1048bf[_0xa0db('0x19')](_0x4536fc);return _0x1048bf[_0xa0db('0x20')]('Content-Range',_0x215658+'-'+_0x12766f+'/'+_0x590f63)['json'](_0x1bb2a0);}return null;};}function patchUpdates(_0x479198){return function(_0x53c0d7){try{jsonpatch[_0xa0db('0x21')](_0x53c0d7,_0x479198,!![]);}catch(_0x3c7939){return BPromise[_0xa0db('0x22')](_0x3c7939);}return _0x53c0d7['save']();};}function saveUpdates(_0x4e9fb8,_0x24c25c){return function(_0x4c3070){if(_0x4c3070){return _0x4c3070[_0xa0db('0x23')](_0x4e9fb8)[_0xa0db('0x24')](function(_0x103160){return _0x103160;});}return null;};}function removeEntity(_0xc5ace,_0x4e9a22){return function(_0x2f3a45){if(_0x2f3a45){return _0x2f3a45[_0xa0db('0x25')]()[_0xa0db('0x24')](function(){_0xc5ace[_0xa0db('0x19')](0xcc)[_0xa0db('0x1a')]();});}};}function handleEntityNotFound(_0x362c30,_0x186d17){return function(_0x2a3742){if(!_0x2a3742){_0x362c30[_0xa0db('0x18')](0x194);}return _0x2a3742;};}function handleError(_0x2e858e,_0x5b0772){_0x5b0772=_0x5b0772||0x1f4;return function(_0x3652a1){logger[_0xa0db('0x26')](_0x3652a1[_0xa0db('0x27')]);if(_0x3652a1[_0xa0db('0x28')]){delete _0x3652a1[_0xa0db('0x28')];}_0x2e858e[_0xa0db('0x19')](_0x5b0772)[_0xa0db('0x29')](_0x3652a1);};}exports[_0xa0db('0x2a')]=function(_0x20a1bc,_0x28cb71){var _0xaa9854={'raw':!![],'where':{'id':_0x20a1bc[_0xa0db('0x2b')]['id']}},_0x3a3dba={};_0x3a3dba[_0xa0db('0x2c')]=_[_0xa0db('0x2d')](db[_0xa0db('0x2e')][_0xa0db('0x2f')]);_0x3a3dba['query']=_['keys'](_0x20a1bc[_0xa0db('0x30')]);_0x3a3dba[_0xa0db('0x31')]=_[_0xa0db('0x32')](_0x3a3dba[_0xa0db('0x2c')],_0x3a3dba[_0xa0db('0x30')]);_0xaa9854[_0xa0db('0x33')]=_[_0xa0db('0x32')](_0x3a3dba['model'],qs[_0xa0db('0x34')](_0x20a1bc[_0xa0db('0x30')]['fields']));_0xaa9854['attributes']=_0xaa9854['attributes'][_0xa0db('0x35')]?_0xaa9854[_0xa0db('0x33')]:_0x3a3dba['model'];if(_0x20a1bc[_0xa0db('0x30')][_0xa0db('0x36')]){_0xaa9854['include']=[{'all':!![]}];}_0xaa9854=_[_0xa0db('0x37')]({},_0xaa9854,_0x20a1bc['options']);return db['ChatProactiveAction'][_0xa0db('0x38')](_0xaa9854)[_0xa0db('0x24')](handleEntityNotFound(_0x28cb71,null))[_0xa0db('0x24')](respondWithResult(_0x28cb71,null))[_0xa0db('0x39')](handleError(_0x28cb71,null));};exports[_0xa0db('0x3a')]=function(_0x3c314f,_0xad2f44){return db[_0xa0db('0x2e')]['create'](_0x3c314f['body'],{})['then'](respondWithResult(_0xad2f44,0xc9))['catch'](handleError(_0xad2f44,null));};exports['update']=function(_0x562cd7,_0x34afd7){if(_0x562cd7[_0xa0db('0x3b')]['id']){delete _0x562cd7[_0xa0db('0x3b')]['id'];}return db[_0xa0db('0x2e')][_0xa0db('0x38')]({'where':{'id':_0x562cd7[_0xa0db('0x2b')]['id']}})[_0xa0db('0x24')](handleEntityNotFound(_0x34afd7,null))[_0xa0db('0x24')](saveUpdates(_0x562cd7[_0xa0db('0x3b')],null))[_0xa0db('0x24')](respondWithResult(_0x34afd7,null))[_0xa0db('0x39')](handleError(_0x34afd7,null));};exports[_0xa0db('0x25')]=function(_0xe92bbe,_0xc6c6af){return db[_0xa0db('0x2e')][_0xa0db('0x38')]({'where':{'id':_0xe92bbe[_0xa0db('0x2b')]['id']}})[_0xa0db('0x24')](handleEntityNotFound(_0xc6c6af,null))[_0xa0db('0x24')](removeEntity(_0xc6c6af,null))[_0xa0db('0x39')](handleError(_0xc6c6af,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index c744ed4..52bc46a 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 _0x5ecb=['chat_proactive_actions','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x5ecb,0x160));var _0xb5ec=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x5ecb[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0xb5ec('0x0'));var util=require(_0xb5ec('0x1'));var logger=require('../../config/logger')(_0xb5ec('0x2'));var moment=require(_0xb5ec('0x3'));var BPromise=require(_0xb5ec('0x4'));var rp=require(_0xb5ec('0x5'));var fs=require('fs');var path=require(_0xb5ec('0x6'));var rimraf=require(_0xb5ec('0x7'));var config=require(_0xb5ec('0x8'));var attributes=require(_0xb5ec('0x9'));module[_0xb5ec('0xa')]=function(_0x10b680,_0x3a47e7){return _0x10b680['define'](_0xb5ec('0xb'),attributes,{'tableName':_0xb5ec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdc1=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','ChatProactiveAction','chat_proactive_actions'];(function(_0x5693fa,_0x2d4a4a){var _0x1b6152=function(_0x14468d){while(--_0x14468d){_0x5693fa['push'](_0x5693fa['shift']());}};_0x1b6152(++_0x2d4a4a);}(_0xfdc1,0x18c));var _0x1fdc=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xfdc1[_0x166d93];return _0xba708;};'use strict';var _=require(_0x1fdc('0x0'));var util=require('util');var logger=require(_0x1fdc('0x1'))(_0x1fdc('0x2'));var moment=require(_0x1fdc('0x3'));var BPromise=require(_0x1fdc('0x4'));var rp=require(_0x1fdc('0x5'));var fs=require('fs');var path=require(_0x1fdc('0x6'));var rimraf=require(_0x1fdc('0x7'));var config=require(_0x1fdc('0x8'));var attributes=require(_0x1fdc('0x9'));module['exports']=function(_0x37e0e2,_0x418859){return _0x37e0e2['define'](_0x1fdc('0xa'),attributes,{'tableName':_0x1fdc('0xb'),'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 a3aeea9..169c9e0 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 _0xfe28=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x3c5c1f,_0x2f90fe){var _0x45ff5a=function(_0x5c26b1){while(--_0x5c26b1){_0x3c5c1f['push'](_0x3c5c1f['shift']());}};_0x45ff5a(++_0x2f90fe);}(_0xfe28,0x1e4));var _0x8fe2=function(_0x3fa4f3,_0x5cdc5b){_0x3fa4f3=_0x3fa4f3-0x0;var _0x461aac=_0xfe28[_0x3fa4f3];return _0x461aac;};'use strict';var _=require(_0x8fe2('0x0'));var util=require('util');var moment=require(_0x8fe2('0x1'));var BPromise=require(_0x8fe2('0x2'));var rs=require(_0x8fe2('0x3'));var fs=require('fs');var Redis=require(_0x8fe2('0x4'));var db=require(_0x8fe2('0x5'))['db'];var utils=require(_0x8fe2('0x6'));var logger=require(_0x8fe2('0x7'))(_0x8fe2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8fe2('0x9'));var client=jayson[_0x8fe2('0xa')][_0x8fe2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x122ff2,_0x192a6a,_0x404cd1){return new BPromise(function(_0x18053d,_0x1608f3){return client[_0x8fe2('0xc')](_0x122ff2,_0x404cd1)['then'](function(_0x34d05d){logger[_0x8fe2('0xd')](_0x8fe2('0xe'),_0x192a6a,'request\x20sent');logger['debug'](_0x8fe2('0xf'),_0x192a6a,_0x8fe2('0x10'),JSON[_0x8fe2('0x11')](_0x34d05d));if(_0x34d05d[_0x8fe2('0x12')]){if(_0x34d05d[_0x8fe2('0x12')][_0x8fe2('0x13')]===0x1f4){logger[_0x8fe2('0x12')](_0x8fe2('0xe'),_0x192a6a,_0x34d05d[_0x8fe2('0x12')][_0x8fe2('0x14')]);return _0x1608f3(_0x34d05d[_0x8fe2('0x12')][_0x8fe2('0x14')]);}logger[_0x8fe2('0x12')](_0x8fe2('0xe'),_0x192a6a,_0x34d05d['error']['message']);return _0x18053d(_0x34d05d[_0x8fe2('0x12')][_0x8fe2('0x14')]);}else{logger['info'](_0x8fe2('0xe'),_0x192a6a,_0x8fe2('0x10'));_0x18053d(_0x34d05d[_0x8fe2('0x15')][_0x8fe2('0x14')]);}})[_0x8fe2('0x16')](function(_0x11d90b){logger[_0x8fe2('0x12')](_0x8fe2('0xe'),_0x192a6a,_0x11d90b);_0x1608f3(_0x11d90b);});});} \ No newline at end of file +var _0xb465=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring'];(function(_0x4b6002,_0xd252af){var _0x347fe9=function(_0x2f7d82){while(--_0x2f7d82){_0x4b6002['push'](_0x4b6002['shift']());}};_0x347fe9(++_0xd252af);}(_0xb465,0x96));var _0x5b46=function(_0x1a380c,_0x3bc0da){_0x1a380c=_0x1a380c-0x0;var _0x3a2ad8=_0xb465[_0x1a380c];return _0x3a2ad8;};'use strict';var _=require('lodash');var util=require(_0x5b46('0x0'));var moment=require(_0x5b46('0x1'));var BPromise=require(_0x5b46('0x2'));var rs=require(_0x5b46('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b46('0x4'))['db'];var utils=require(_0x5b46('0x5'));var logger=require(_0x5b46('0x6'))(_0x5b46('0x7'));var config=require(_0x5b46('0x8'));var jayson=require(_0x5b46('0x9'));var client=jayson[_0x5b46('0xa')][_0x5b46('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x367294,_0x14a1bc,_0x58d86c){return new BPromise(function(_0x4246bb,_0x16b8da){return client['request'](_0x367294,_0x58d86c)[_0x5b46('0xc')](function(_0x4c8e74){logger[_0x5b46('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x14a1bc,_0x5b46('0xe'));logger['debug'](_0x5b46('0xf'),_0x14a1bc,_0x5b46('0xe'),JSON[_0x5b46('0x10')](_0x4c8e74));if(_0x4c8e74[_0x5b46('0x11')]){if(_0x4c8e74[_0x5b46('0x11')][_0x5b46('0x12')]===0x1f4){logger[_0x5b46('0x11')](_0x5b46('0x13'),_0x14a1bc,_0x4c8e74[_0x5b46('0x11')][_0x5b46('0x14')]);return _0x16b8da(_0x4c8e74[_0x5b46('0x11')][_0x5b46('0x14')]);}logger[_0x5b46('0x11')](_0x5b46('0x13'),_0x14a1bc,_0x4c8e74[_0x5b46('0x11')]['message']);return _0x4246bb(_0x4c8e74[_0x5b46('0x11')][_0x5b46('0x14')]);}else{logger[_0x5b46('0xd')](_0x5b46('0x13'),_0x14a1bc,_0x5b46('0xe'));_0x4246bb(_0x4c8e74[_0x5b46('0x15')]['message']);}})['catch'](function(_0x3db2c1){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x14a1bc,_0x3db2c1);_0x16b8da(_0x3db2c1);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index ba898c4..127a13c 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 _0x46ed=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0x46ed,0x168));var _0xd46e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x46ed[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd46e('0x5'));var interaction=require(_0xd46e('0x6'));var config=require('../../config/environment');var controller=require(_0xd46e('0x7'));router[_0xd46e('0x8')](_0xd46e('0x9'),auth[_0xd46e('0xa')](),controller[_0xd46e('0xb')]);router[_0xd46e('0xc')]('/',auth[_0xd46e('0xa')](),controller[_0xd46e('0xd')]);router[_0xd46e('0xe')](_0xd46e('0x9'),auth[_0xd46e('0xa')](),controller['update']);router[_0xd46e('0xf')](_0xd46e('0x9'),auth['isAuthenticated'](),controller[_0xd46e('0x10')]);module[_0xd46e('0x11')]=router; \ No newline at end of file +var _0x71ab=['get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x71ab,0x64));var _0xb71a=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x71ab[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var fs_extra=require(_0xb71a('0x3'));var auth=require(_0xb71a('0x4'));var interaction=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var controller=require(_0xb71a('0x7'));router[_0xb71a('0x8')](_0xb71a('0x9'),auth[_0xb71a('0xa')](),controller[_0xb71a('0xb')]);router[_0xb71a('0xc')]('/',auth[_0xb71a('0xa')](),controller[_0xb71a('0xd')]);router[_0xb71a('0xe')](_0xb71a('0x9'),auth[_0xb71a('0xa')](),controller[_0xb71a('0xf')]);router[_0xb71a('0x10')]('/:id',auth[_0xb71a('0xa')](),controller['destroy']);module[_0xb71a('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 8149ab6..9f521bd 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 _0x2355=['ENUM','roundrobin','exports','STRING','name'];(function(_0x40b06b,_0x347b33){var _0x11e446=function(_0x3566eb){while(--_0x3566eb){_0x40b06b['push'](_0x40b06b['shift']());}};_0x11e446(++_0x347b33);}(_0x2355,0x6b));var _0x5235=function(_0x142ff8,_0x49ad75){_0x142ff8=_0x142ff8-0x0;var _0x4cd7f1=_0x2355[_0x142ff8];return _0x4cd7f1;};'use strict';var Sequelize=require('sequelize');module[_0x5235('0x0')]={'name':{'type':Sequelize[_0x5235('0x1')],'unique':_0x5235('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5235('0x3')]('rrmemory','beepall',_0x5235('0x4'))}}; \ No newline at end of file +var _0x1500=['INTEGER','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x375325,_0x57a850){var _0x228f57=function(_0x2ad744){while(--_0x2ad744){_0x375325['push'](_0x375325['shift']());}};_0x228f57(++_0x57a850);}(_0x1500,0x1bf));var _0x0150=function(_0x5b309a,_0x445cf9){_0x5b309a=_0x5b309a-0x0;var _0x59c82d=_0x1500[_0x5b309a];return _0x59c82d;};'use strict';var Sequelize=require(_0x0150('0x0'));module[_0x0150('0x1')]={'name':{'type':Sequelize[_0x0150('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0150('0x2')]},'timeout':{'type':Sequelize[_0x0150('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0150('0x4'),_0x0150('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 3804786..5593c4a 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 _0xd33c=['send','index','map','ChatQueue','fieldName','type','getOptions','where','include','query','findAll','rows','catch','show','keys','rawAttributes','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','params','describe','findOne','UserChatQueue','order','sort','ChatQueueId','filter','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','getTeams','pick','hasOwnProperty','nolimit','addTeams','ids','Team','User','Agents','online','flatMap','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','userChatQueue:remove','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','update','then','destroy','get','ChatQueues','UserProfileResource','error','name'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xd33c,0xd2));var _0xcd33=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xd33c[_0xa1e3e3];return _0xc980e9;};'use strict';var BPromise=require(_0xcd33('0x0'));var util=require('util');var _=require(_0xcd33('0x1'));var squel=require('squel');var Redis=require(_0xcd33('0x2'));var qs=require(_0xcd33('0x3'));var logger=require(_0xcd33('0x4'))('api');var config=require(_0xcd33('0x5'));var db=require(_0xcd33('0x6'))['db'];config[_0xcd33('0x7')]=_['defaults'](config[_0xcd33('0x7')],{'host':_0xcd33('0x8'),'port':0x18eb});var socket=require(_0xcd33('0x9'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xcd33('0xa')](socket);function respondWithStatusCode(_0x25622e,_0x4943df){_0x4943df=_0x4943df||0xcc;return function(_0xbec258){if(_0xbec258){return _0x25622e[_0xcd33('0xb')](_0x4943df);}return _0x25622e[_0xcd33('0xc')](_0x4943df)[_0xcd33('0xd')]();};}function respondWithResult(_0x2001b5,_0x348059){_0x348059=_0x348059||0xc8;return function(_0x3191a6){if(_0x3191a6){return _0x2001b5[_0xcd33('0xc')](_0x348059)[_0xcd33('0xe')](_0x3191a6);}};}function respondWithFilteredResult(_0x55299a,_0x5d8270){return function(_0x22cac9){if(_0x22cac9){var _0x42e23b=typeof _0x5d8270['offset']===_0xcd33('0xf')&&typeof _0x5d8270[_0xcd33('0x10')]===_0xcd33('0xf');var _0x30d66e=_0x22cac9[_0xcd33('0x11')];var _0xdca684=_0x42e23b?0x0:_0x5d8270[_0xcd33('0x12')];var _0xe486c5=_0x42e23b?_0x22cac9[_0xcd33('0x11')]:_0x5d8270['offset']+_0x5d8270[_0xcd33('0x10')];var _0x51b7fb;if(_0xe486c5>=_0x30d66e){_0xe486c5=_0x30d66e;_0x51b7fb=0xc8;}else{_0x51b7fb=0xce;}_0x55299a[_0xcd33('0xc')](_0x51b7fb);return _0x55299a[_0xcd33('0x13')]('Content-Range',_0xdca684+'-'+_0xe486c5+'/'+_0x30d66e)[_0xcd33('0xe')](_0x22cac9);}return null;};}function saveUpdates(_0x2f103e){return function(_0x2355d8){if(_0x2355d8){return _0x2355d8[_0xcd33('0x14')](_0x2f103e)[_0xcd33('0x15')](function(_0x2c7bec){return _0x2c7bec;});}return null;};}function removeEntity(_0x272be0){return function(_0x16d27d){if(_0x16d27d){return _0x16d27d[_0xcd33('0x16')]()['then'](function(){var _0xf70817=_0x16d27d[_0xcd33('0x17')]({'plain':!![]});var _0x192321=_0xcd33('0x18');return db[_0xcd33('0x19')][_0xcd33('0x16')]({'where':{'type':_0x192321,'resourceId':_0xf70817['id']}})[_0xcd33('0x15')](function(){return _0x16d27d;});})[_0xcd33('0x15')](function(){_0x272be0[_0xcd33('0xc')](0xcc)[_0xcd33('0xd')]();});}};}function handleEntityNotFound(_0x3a6523){return function(_0x26ec50){if(!_0x26ec50){_0x3a6523[_0xcd33('0xb')](0x194);}return _0x26ec50;};}function handleError(_0x4ea5a7,_0x2ec60c){_0x2ec60c=_0x2ec60c||0x1f4;return function(_0x4f07d3){logger[_0xcd33('0x1a')](_0x4f07d3['stack']);if(_0x4f07d3[_0xcd33('0x1b')]){delete _0x4f07d3[_0xcd33('0x1b')];}_0x4ea5a7[_0xcd33('0xc')](_0x2ec60c)[_0xcd33('0x1c')](_0x4f07d3);};}exports[_0xcd33('0x1d')]=function(_0x13ace0,_0x4bd137){var _0xbfa076={};var _0x5c6f34={'count':0x0,'rows':[]};var _0x3ac42c=_[_0xcd33('0x1e')](db[_0xcd33('0x1f')]['rawAttributes'],function(_0x28edc4){return{'name':_0x28edc4[_0xcd33('0x20')],'type':_0x28edc4[_0xcd33('0x21')]['key']};});_0xbfa076=qs[_0xcd33('0x22')](_0x3ac42c,_0x13ace0);var _0xb6388c={'where':_0xbfa076[_0xcd33('0x23')]};return db[_0xcd33('0x1f')][_0xcd33('0x11')](_0xb6388c)[_0xcd33('0x15')](function(_0x4bb1b7){_0x5c6f34[_0xcd33('0x11')]=_0x4bb1b7;_0xbfa076[_0xcd33('0x24')]=qs['include'](_0x13ace0[_0xcd33('0x25')]);return db[_0xcd33('0x1f')][_0xcd33('0x26')](_0xbfa076);})[_0xcd33('0x15')](function(_0x3ad4a1){_0x5c6f34[_0xcd33('0x27')]=_0x3ad4a1;return _0x5c6f34;})[_0xcd33('0x15')](respondWithFilteredResult(_0x4bd137,_0xbfa076))[_0xcd33('0x28')](handleError(_0x4bd137,null));};exports[_0xcd33('0x29')]=function(_0x34659e,_0xac2055){var _0x46a3a9={'raw':!![],'where':{'id':_0x34659e['params']['id']}},_0x29621f={};_0x29621f['model']=_[_0xcd33('0x2a')](db[_0xcd33('0x1f')][_0xcd33('0x2b')]);_0x29621f[_0xcd33('0x25')]=_[_0xcd33('0x2a')](_0x34659e[_0xcd33('0x25')]);_0x29621f[_0xcd33('0x2c')]=_[_0xcd33('0x2d')](_0x29621f[_0xcd33('0x2e')],_0x29621f[_0xcd33('0x25')]);_0x46a3a9[_0xcd33('0x2f')]=_[_0xcd33('0x2d')](_0x29621f['model'],qs[_0xcd33('0x30')](_0x34659e[_0xcd33('0x25')][_0xcd33('0x30')]));_0x46a3a9[_0xcd33('0x2f')]=_0x46a3a9[_0xcd33('0x2f')][_0xcd33('0x31')]?_0x46a3a9[_0xcd33('0x2f')]:_0x29621f[_0xcd33('0x2e')];if(_0x34659e[_0xcd33('0x25')][_0xcd33('0x32')]){_0x46a3a9[_0xcd33('0x24')]=[{'all':!![]}];}_0x46a3a9=_[_0xcd33('0x33')]({},_0x46a3a9,_0x34659e[_0xcd33('0x34')]);return db[_0xcd33('0x1f')][_0xcd33('0x35')](_0x46a3a9)[_0xcd33('0x15')](handleEntityNotFound(_0xac2055,null))[_0xcd33('0x15')](respondWithResult(_0xac2055,null))[_0xcd33('0x28')](handleError(_0xac2055,null));};exports[_0xcd33('0x36')]=function(_0x3d7608,_0x2cbff2){return db['ChatQueue']['create'](_0x3d7608[_0xcd33('0x37')],{})['then'](function(_0x2fc3aa){var _0x537230=_0x3d7608['user'][_0xcd33('0x17')]({'plain':!![]});if(!_0x537230)throw new Error(_0xcd33('0x38'));if(_0x537230[_0xcd33('0x39')]===_0xcd33('0x3a')){var _0x798a21=_0x2fc3aa[_0xcd33('0x17')]({'plain':!![]});var _0x2d04f6=_0xcd33('0x18');return db['UserProfileSection'][_0xcd33('0x35')]({'where':{'name':_0x2d04f6,'userProfileId':_0x537230[_0xcd33('0x3b')]},'raw':!![]})['then'](function(_0x3a071a){if(_0x3a071a&&_0x3a071a[_0xcd33('0x3c')]===0x0){return db[_0xcd33('0x19')]['create']({'name':_0x798a21[_0xcd33('0x1b')],'resourceId':_0x798a21['id'],'type':_0x3a071a['name'],'sectionId':_0x3a071a['id']},{})[_0xcd33('0x15')](function(){return _0x2fc3aa;});}else{return _0x2fc3aa;}})[_0xcd33('0x28')](function(_0x2a7467){logger[_0xcd33('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a7467);throw _0x2a7467;});}return _0x2fc3aa;})['then'](respondWithResult(_0x2cbff2,0xc9))[_0xcd33('0x28')](handleError(_0x2cbff2,null));};exports[_0xcd33('0x14')]=function(_0x5a733e,_0x59b22a){if(_0x5a733e[_0xcd33('0x37')]['id']){delete _0x5a733e[_0xcd33('0x37')]['id'];}return db[_0xcd33('0x1f')]['find']({'where':{'id':_0x5a733e[_0xcd33('0x3d')]['id']}})[_0xcd33('0x15')](handleEntityNotFound(_0x59b22a,null))['then'](saveUpdates(_0x5a733e[_0xcd33('0x37')],null))[_0xcd33('0x15')](respondWithResult(_0x59b22a,null))[_0xcd33('0x28')](handleError(_0x59b22a,null));};exports['destroy']=function(_0x20b4b6,_0x497c46){return db[_0xcd33('0x1f')][_0xcd33('0x35')]({'where':{'id':_0x20b4b6[_0xcd33('0x3d')]['id']}})['then'](handleEntityNotFound(_0x497c46,null))[_0xcd33('0x15')](removeEntity(_0x497c46,null))['catch'](handleError(_0x497c46,null));};exports['describe']=function(_0x10bdd7,_0x291dff){return db[_0xcd33('0x1f')][_0xcd33('0x3e')]()[_0xcd33('0x15')](respondWithResult(_0x291dff,null))[_0xcd33('0x28')](handleError(_0x291dff,null));};exports['getMembers']=function(_0x1e3550,_0x58516e){var _0x497e75={'raw':!![],'where':{}},_0x2b1ac7={},_0x1bef1a;return db['ChatQueue'][_0xcd33('0x3f')]({'where':{'id':_0x1e3550[_0xcd33('0x3d')]['id']}})[_0xcd33('0x15')](handleEntityNotFound(_0x58516e,null))['then'](function(_0x4cc000){if(_0x4cc000){_0x1bef1a=_0x4cc000[_0xcd33('0x17')]({'plain':!![]});_0x2b1ac7[_0xcd33('0x2e')]=_[_0xcd33('0x2a')](db[_0xcd33('0x40')]['rawAttributes']);_0x2b1ac7[_0xcd33('0x25')]=_[_0xcd33('0x2a')](_0x1e3550[_0xcd33('0x25')]);_0x2b1ac7['filters']=_[_0xcd33('0x2d')](_0x2b1ac7[_0xcd33('0x2e')],_0x2b1ac7[_0xcd33('0x25')]);_0x497e75[_0xcd33('0x2f')]=_[_0xcd33('0x2d')](_0x2b1ac7[_0xcd33('0x2e')],qs[_0xcd33('0x30')](_0x1e3550[_0xcd33('0x25')][_0xcd33('0x30')]));_0x497e75[_0xcd33('0x2f')]=_0x497e75[_0xcd33('0x2f')]['length']?_0x497e75[_0xcd33('0x2f')]:_0x2b1ac7[_0xcd33('0x2e')];if(!_0x1e3550['query']['hasOwnProperty']('nolimit')){_0x497e75['limit']=qs[_0xcd33('0x10')](_0x1e3550['query'][_0xcd33('0x10')]);_0x497e75[_0xcd33('0x12')]=qs[_0xcd33('0x12')](_0x1e3550[_0xcd33('0x25')][_0xcd33('0x12')]);}_0x497e75[_0xcd33('0x41')]=qs[_0xcd33('0x42')](_0x1e3550[_0xcd33('0x25')]['sort']);_0x497e75[_0xcd33('0x23')]=qs['filters'](_['pick'](_0x1e3550['query'],_0x2b1ac7[_0xcd33('0x2c')]));_0x497e75[_0xcd33('0x23')][_0xcd33('0x43')]=_0x4cc000['id'];if(_0x1e3550[_0xcd33('0x25')][_0xcd33('0x44')]){_0x497e75[_0xcd33('0x23')]=_['merge'](_0x497e75[_0xcd33('0x23')],{'$or':_[_0xcd33('0x1e')](_0x497e75[_0xcd33('0x2f')],function(_0x3275b0){var _0x4c676d={};_0x4c676d[_0x3275b0]={'$like':'%'+_0x1e3550[_0xcd33('0x25')]['filter']+'%'};return _0x4c676d;})});}_0x497e75=_[_0xcd33('0x33')]({},_0x497e75,_0x1e3550[_0xcd33('0x34')]);return db[_0xcd33('0x40')]['findAll'](_0x497e75);}})[_0xcd33('0x15')](function(_0x5957d4){if(_0x5957d4){return db['User'][_0xcd33('0x45')]({'where':{'id':_['map'](_0x5957d4,_0xcd33('0x46')),'role':'agent'},'attributes':['id',_0xcd33('0x1b'),'chatPause',_0xcd33('0x47'),_0xcd33('0x48')]});}})[_0xcd33('0x15')](function(_0x5d87b6){if(_0x5d87b6){return{'count':_0x5d87b6[_0xcd33('0x11')],'rows':_[_0xcd33('0x1e')](_0x5d87b6[_0xcd33('0x27')],function(_0xa045ee){return{'membername':_0xa045ee[_0xcd33('0x1b')],'UserId':_0xa045ee['id'],'queue_name':_0x1bef1a[_0xcd33('0x1b')],'ChatQueueId':_0x1bef1a['id'],'interface':util[_0xcd33('0x49')](_0xcd33('0x4a'),'SIP',_0xa045ee[_0xcd33('0x1b')]),'penalty':0x0,'paused':_0xa045ee['chatPause'],'createdAt':_0xa045ee[_0xcd33('0x48')],'updatedAt':_0xa045ee[_0xcd33('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcd33('0x15')](respondWithFilteredResult(_0x58516e,_0x497e75))['catch'](handleError(_0x58516e,null));};exports[_0xcd33('0x4b')]=function(_0x3a441c,_0x30f201){var _0x3a2be5={};var _0x5df00f={};var _0x1f5e4d;var _0xdd14dd;return db[_0xcd33('0x1f')][_0xcd33('0x3f')]({'where':{'id':_0x3a441c[_0xcd33('0x3d')]['id']}})[_0xcd33('0x15')](handleEntityNotFound(_0x30f201,null))['then'](function(_0x404c78){if(_0x404c78){_0x1f5e4d=_0x404c78;_0x5df00f['model']=_[_0xcd33('0x2a')](db['Team'][_0xcd33('0x2b')]);_0x5df00f[_0xcd33('0x25')]=_[_0xcd33('0x2a')](_0x3a441c['query']);_0x5df00f[_0xcd33('0x2c')]=_[_0xcd33('0x2d')](_0x5df00f[_0xcd33('0x2e')],_0x5df00f[_0xcd33('0x25')]);_0x3a2be5[_0xcd33('0x2f')]=_[_0xcd33('0x2d')](_0x5df00f[_0xcd33('0x2e')],qs[_0xcd33('0x30')](_0x3a441c['query']['fields']));_0x3a2be5['attributes']=_0x3a2be5['attributes']['length']?_0x3a2be5['attributes']:_0x5df00f[_0xcd33('0x2e')];_0x3a2be5['order']=qs[_0xcd33('0x42')](_0x3a441c[_0xcd33('0x25')][_0xcd33('0x42')]);_0x3a2be5[_0xcd33('0x23')]=qs['filters'](_[_0xcd33('0x4c')](_0x3a441c['query'],_0x5df00f[_0xcd33('0x2c')]));if(_0x3a441c[_0xcd33('0x25')]['filter']){_0x3a2be5['where']=_[_0xcd33('0x33')](_0x3a2be5[_0xcd33('0x23')],{'$or':_[_0xcd33('0x1e')](_0x3a2be5[_0xcd33('0x2f')],function(_0xb13439){var _0x2cd173={};_0x2cd173[_0xb13439]={'$like':'%'+_0x3a441c[_0xcd33('0x25')][_0xcd33('0x44')]+'%'};return _0x2cd173;})});}_0x3a2be5=_['merge']({},_0x3a2be5,_0x3a441c[_0xcd33('0x34')]);return _0x1f5e4d[_0xcd33('0x4b')](_0x3a2be5);}})[_0xcd33('0x15')](function(_0x405812){if(_0x405812){_0xdd14dd=_0x405812[_0xcd33('0x31')];if(!_0x3a441c[_0xcd33('0x25')][_0xcd33('0x4d')](_0xcd33('0x4e'))){_0x3a2be5[_0xcd33('0x10')]=qs[_0xcd33('0x10')](_0x3a441c[_0xcd33('0x25')][_0xcd33('0x10')]);_0x3a2be5[_0xcd33('0x12')]=qs[_0xcd33('0x12')](_0x3a441c['query']['offset']);}return _0x1f5e4d['getTeams'](_0x3a2be5);}})[_0xcd33('0x15')](function(_0x241da5){if(_0x241da5){return _0x241da5?{'count':_0xdd14dd,'rows':_0x241da5}:null;}})['then'](respondWithResult(_0x30f201,null))[_0xcd33('0x28')](handleError(_0x30f201,null));};exports[_0xcd33('0x4f')]=function(_0x48eb86,_0x330993){var _0x121b33=_0x48eb86[_0xcd33('0x37')][_0xcd33('0x50')];return db[_0xcd33('0x51')][_0xcd33('0x26')]({'where':{'id':_0x121b33},'attributes':['id'],'include':[{'model':db[_0xcd33('0x52')],'as':_0xcd33('0x53'),'attributes':['id',_0xcd33('0x1b'),_0xcd33('0x54'),'voicePause','interface'],'raw':!![]}]})[_0xcd33('0x15')](function(_0x32df6f){if(_0x32df6f){var _0x46c017=_[_0xcd33('0x55')](_0x32df6f,function(_0x6c2dbd){var _0x31a48c=_0x6c2dbd['get']({'plain':!![]});return _0x31a48c[_0xcd33('0x53')];});return db[_0xcd33('0x1f')][_0xcd33('0x35')]({'where':{'id':_0x48eb86[_0xcd33('0x3d')]['id']}})[_0xcd33('0x15')](function(_0x5a479c){return db['sequelize'][_0xcd33('0x56')](function(_0x162113){return _0x5a479c[_0xcd33('0x4f')](_0x121b33,{'transaction':_0x162113})[_0xcd33('0x15')](function(){return BPromise[_0xcd33('0x57')](_0x46c017,function(_0x4af482){return db[_0xcd33('0x40')][_0xcd33('0x58')]({'where':{'UserId':_0x4af482['id'],'ChatQueueId':_0x48eb86[_0xcd33('0x3d')]['id']},'transaction':_0x162113});});})[_0xcd33('0x15')](function(){_0x46c017[_0xcd33('0x59')](function(_0x17dc9d){socket[_0xcd33('0x5a')]('userChatQueue:save',{'UserId':_0x17dc9d['id'],'ChatQueueId':_0x5a479c['id']});});});});});}})[_0xcd33('0x15')](respondWithStatusCode(_0x330993,null))[_0xcd33('0x28')](handleError(_0x330993,null));};exports[_0xcd33('0x5b')]=function(_0xab4ae6,_0x123f50){return db[_0xcd33('0x51')]['findAll']({'where':{'id':_0xab4ae6[_0xcd33('0x25')][_0xcd33('0x50')]},'attributes':['id'],'include':[{'model':db[_0xcd33('0x52')],'as':_0xcd33('0x53'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x123f50,null))[_0xcd33('0x15')](function(_0x4c4f43){var _0x59d226=_[_0xcd33('0x1e')](_0x4c4f43,'id');var _0x3f35a8=[];var _0x191c80=[];var _0x1dd191=squel[_0xcd33('0x5c')]();_0x1dd191[_0xcd33('0x5d')]('tq.TeamId')['from']('team_has_chat_queues','tq')[_0xcd33('0x5e')](_0xcd33('0x5f'),'ut',_0xcd33('0x60'))[_0xcd33('0x23')](_0xcd33('0x61'),_0xab4ae6[_0xcd33('0x3d')]['id']);for(var _0x356a98=0x0;_0x356a98<_0x4c4f43['length'];_0x356a98+=0x1){let _0x4ba0e1=_0x4c4f43[_0x356a98];for(var _0x245fd9=0x0;_0x245fd9<_0x4ba0e1[_0xcd33('0x53')][_0xcd33('0x31')];_0x245fd9+=0x1){let _0x1ef4ae=_0x4ba0e1['Agents'][_0x245fd9];var _0x48a01b=_0x1dd191[_0xcd33('0x62')]();_0x48a01b[_0xcd33('0x23')](_0xcd33('0x63'),_0x1ef4ae['id']);_0x191c80[_0xcd33('0x64')](db[_0xcd33('0x65')][_0xcd33('0x25')](_0x48a01b[_0xcd33('0x66')](),{'type':db['sequelize'][_0xcd33('0x67')][_0xcd33('0x68')]})[_0xcd33('0x15')](function(_0x541eda){if(_0x541eda[_0xcd33('0x31')]===0x1){return _0x1ef4ae['id'];}else{var _0x59b429=_[_0xcd33('0x69')](_[_0xcd33('0x1e')](_0x541eda,_0xcd33('0x6a')),function(_0x389746){return _[_0xcd33('0x6b')](_0x59d226,_0x389746);});if(_0x59b429){return _0x1ef4ae['id'];}}}));}}return BPromise[_0xcd33('0x6c')](_0x191c80)[_0xcd33('0x15')](function(_0x868e39){_0x3f35a8=_(_0x3f35a8)[_0xcd33('0x6d')](_0x868e39)[_0xcd33('0x6e')]()[_0xcd33('0x6f')]();return db['ChatQueue'][_0xcd33('0x35')]({'where':{'id':_0xab4ae6['params']['id']}})[_0xcd33('0x15')](function(_0x840491){return db[_0xcd33('0x65')][_0xcd33('0x56')](function(_0x26ab20){return _0x840491['removeTeams'](_0xab4ae6[_0xcd33('0x25')][_0xcd33('0x50')],{'transaction':_0x26ab20})[_0xcd33('0x15')](function(){if(!_[_0xcd33('0x70')](_0x3f35a8)){return _0x840491[_0xcd33('0x71')](_0x3f35a8,{'transaction':_0x26ab20});}})[_0xcd33('0x15')](function(){_0x3f35a8[_0xcd33('0x59')](function(_0x19f634){socket[_0xcd33('0x5a')]('userChatQueue:remove',{'UserId':_0x19f634,'ChatQueueId':_0x840491['id']});});});});});});})['then'](respondWithStatusCode(_0x123f50,null))[_0xcd33('0x28')](handleError(_0x123f50,null));};exports[_0xcd33('0x72')]=function(_0x974b00,_0x43671c){return db[_0xcd33('0x1f')]['find']({'where':{'id':_0x974b00[_0xcd33('0x3d')]['id']}})['then'](handleEntityNotFound(_0x43671c,null))['then'](function(_0x19ea85){if(_0x19ea85){return _0x19ea85[_0xcd33('0x72')](_0x974b00[_0xcd33('0x37')][_0xcd33('0x50')],_[_0xcd33('0x73')](_0x974b00[_0xcd33('0x37')],[_0xcd33('0x50'),'id'])||{})[_0xcd33('0x74')](function(_0x3c2fb5){for(var _0x416af3=0x0;_0x416af3<_0x974b00['body'][_0xcd33('0x50')][_0xcd33('0x31')];_0x416af3+=0x1){socket[_0xcd33('0x5a')]('userChatQueue:save',{'UserId':Number(_0x974b00[_0xcd33('0x37')][_0xcd33('0x50')][_0x416af3]),'ChatQueueId':Number(_0x974b00[_0xcd33('0x3d')]['id'])});}return _0x3c2fb5;});}})[_0xcd33('0x15')](respondWithResult(_0x43671c,null))[_0xcd33('0x28')](handleError(_0x43671c,null));};exports[_0xcd33('0x71')]=function(_0x4b20fb,_0x45be2d){return db[_0xcd33('0x1f')][_0xcd33('0x35')]({'where':{'id':_0x4b20fb[_0xcd33('0x3d')]['id']}})[_0xcd33('0x15')](handleEntityNotFound(_0x45be2d,null))[_0xcd33('0x15')](function(_0x521c5d){if(_0x521c5d){return _0x521c5d[_0xcd33('0x71')](_0x4b20fb[_0xcd33('0x25')]['ids'])[_0xcd33('0x15')](function(){if(_['isArray'](_0x4b20fb[_0xcd33('0x25')][_0xcd33('0x50')])){for(var _0xfce377=0x0;_0xfce377<_0x4b20fb[_0xcd33('0x25')][_0xcd33('0x50')][_0xcd33('0x31')];_0xfce377+=0x1){socket['emit'](_0xcd33('0x75'),{'UserId':Number(_0x4b20fb['query'][_0xcd33('0x50')][_0xfce377]),'ChatQueueId':Number(_0x4b20fb[_0xcd33('0x3d')]['id'])});}}else{socket[_0xcd33('0x5a')]('userChatQueue:remove',{'UserId':Number(_0x4b20fb['query'][_0xcd33('0x50')]),'ChatQueueId':Number(_0x4b20fb[_0xcd33('0x3d')]['id'])});}});}})['then'](respondWithStatusCode(_0x45be2d,null))[_0xcd33('0x28')](handleError(_0x45be2d,null));};exports[_0xcd33('0x76')]=function(_0x789d9c,_0x2fe7af){var _0x389c20={};var _0x342618={};var _0x5bee9f;var _0x38772d;return db[_0xcd33('0x1f')][_0xcd33('0x3f')]({'where':{'id':_0x789d9c['params']['id']}})[_0xcd33('0x15')](handleEntityNotFound(_0x2fe7af,null))[_0xcd33('0x15')](function(_0x2a463f){if(_0x2a463f){_0x5bee9f=_0x2a463f;_0x342618[_0xcd33('0x2e')]=_[_0xcd33('0x2a')](db[_0xcd33('0x52')]['rawAttributes']);_0x342618['query']=_[_0xcd33('0x2a')](_0x789d9c[_0xcd33('0x25')]);_0x342618['filters']=_[_0xcd33('0x2d')](_0x342618[_0xcd33('0x2e')],_0x342618['query']);_0x389c20['attributes']=_[_0xcd33('0x2d')](_0x342618['model'],qs[_0xcd33('0x30')](_0x789d9c[_0xcd33('0x25')][_0xcd33('0x30')]));_0x389c20[_0xcd33('0x2f')]=_0x389c20[_0xcd33('0x2f')][_0xcd33('0x31')]?_0x389c20['attributes']:_0x342618[_0xcd33('0x2e')];_0x389c20[_0xcd33('0x41')]=qs[_0xcd33('0x42')](_0x789d9c[_0xcd33('0x25')][_0xcd33('0x42')]);_0x389c20[_0xcd33('0x23')]=qs[_0xcd33('0x2c')](_[_0xcd33('0x4c')](_0x789d9c[_0xcd33('0x25')],_0x342618['filters']));if(_0x789d9c[_0xcd33('0x25')][_0xcd33('0x44')]){_0x389c20['where']=_[_0xcd33('0x33')](_0x389c20[_0xcd33('0x23')],{'$or':_[_0xcd33('0x1e')](_0x389c20[_0xcd33('0x2f')],function(_0x1676bf){var _0xca5130={};_0xca5130[_0x1676bf]={'$like':'%'+_0x789d9c[_0xcd33('0x25')]['filter']+'%'};return _0xca5130;})});}_0x389c20=_[_0xcd33('0x33')]({},_0x389c20,_0x789d9c[_0xcd33('0x34')]);return _0x5bee9f['getAgents'](_0x389c20);}})['then'](function(_0xf92e82){if(_0xf92e82){_0x38772d=_0xf92e82['length'];if(!_0x789d9c[_0xcd33('0x25')][_0xcd33('0x4d')]('nolimit')){_0x389c20['limit']=qs[_0xcd33('0x10')](_0x789d9c['query'][_0xcd33('0x10')]);_0x389c20[_0xcd33('0x12')]=qs[_0xcd33('0x12')](_0x789d9c[_0xcd33('0x25')][_0xcd33('0x12')]);}return _0x5bee9f[_0xcd33('0x76')](_0x389c20);}})['then'](function(_0x208ca6){if(_0x208ca6){return _0x208ca6?{'count':_0x38772d,'rows':_0x208ca6}:null;}})[_0xcd33('0x15')](respondWithResult(_0x2fe7af,null))['catch'](handleError(_0x2fe7af,null));}; \ No newline at end of file +var _0x279e=['createdAt','format','%s/%s','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','interface','flatMap','transaction','findOrCreate','forEach','emit','removeTeams','User','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','includes','all','union','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','sendStatus','status','json','offset','undefined','count','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','error','name','index','map','ChatQueue','fieldName','type','key','where','include','query','findAll','catch','show','params','model','keys','rawAttributes','intersection','attributes','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','filters','fields','nolimit','limit','order','sort','pick','ChatQueueId','filter','findAndCountAll','UserId','agent','chatPause','updatedAt'];(function(_0x7179ba,_0x37504f){var _0x4ad820=function(_0x131107){while(--_0x131107){_0x7179ba['push'](_0x7179ba['shift']());}};_0x4ad820(++_0x37504f);}(_0x279e,0x11f));var _0xe279=function(_0x557fb5,_0x2b00d4){_0x557fb5=_0x557fb5-0x0;var _0x5de04f=_0x279e[_0x557fb5];return _0x5de04f;};'use strict';var BPromise=require(_0xe279('0x0'));var util=require(_0xe279('0x1'));var _=require(_0xe279('0x2'));var squel=require(_0xe279('0x3'));var Redis=require(_0xe279('0x4'));var qs=require(_0xe279('0x5'));var logger=require(_0xe279('0x6'))(_0xe279('0x7'));var config=require(_0xe279('0x8'));var db=require(_0xe279('0x9'))['db'];config[_0xe279('0xa')]=_[_0xe279('0xb')](config[_0xe279('0xa')],{'host':_0xe279('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe279('0xa')]));require(_0xe279('0xd'))[_0xe279('0xe')](socket);function respondWithStatusCode(_0x40f35d,_0x1dff6f){_0x1dff6f=_0x1dff6f||0xcc;return function(_0x224003){if(_0x224003){return _0x40f35d[_0xe279('0xf')](_0x1dff6f);}return _0x40f35d[_0xe279('0x10')](_0x1dff6f)['end']();};}function respondWithResult(_0x552a27,_0x23b863){_0x23b863=_0x23b863||0xc8;return function(_0xcfd693){if(_0xcfd693){return _0x552a27['status'](_0x23b863)[_0xe279('0x11')](_0xcfd693);}};}function respondWithFilteredResult(_0x5762aa,_0x61c18){return function(_0x7c1726){if(_0x7c1726){var _0x2f7e34=typeof _0x61c18[_0xe279('0x12')]===_0xe279('0x13')&&typeof _0x61c18['limit']===_0xe279('0x13');var _0xf08668=_0x7c1726['count'];var _0x12e7f1=_0x2f7e34?0x0:_0x61c18[_0xe279('0x12')];var _0x469245=_0x2f7e34?_0x7c1726[_0xe279('0x14')]:_0x61c18[_0xe279('0x12')]+_0x61c18['limit'];var _0x4391d0;if(_0x469245>=_0xf08668){_0x469245=_0xf08668;_0x4391d0=0xc8;}else{_0x4391d0=0xce;}_0x5762aa['status'](_0x4391d0);return _0x5762aa['set'](_0xe279('0x15'),_0x12e7f1+'-'+_0x469245+'/'+_0xf08668)[_0xe279('0x11')](_0x7c1726);}return null;};}function saveUpdates(_0x4145db){return function(_0x234675){if(_0x234675){return _0x234675[_0xe279('0x16')](_0x4145db)[_0xe279('0x17')](function(_0x109f70){return _0x109f70;});}return null;};}function removeEntity(_0x46c156){return function(_0x115111){if(_0x115111){return _0x115111[_0xe279('0x18')]()[_0xe279('0x17')](function(){var _0x133e28=_0x115111[_0xe279('0x19')]({'plain':!![]});var _0x7f384=_0xe279('0x1a');return db[_0xe279('0x1b')][_0xe279('0x18')]({'where':{'type':_0x7f384,'resourceId':_0x133e28['id']}})[_0xe279('0x17')](function(){return _0x115111;});})[_0xe279('0x17')](function(){_0x46c156[_0xe279('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x92d1f8){return function(_0x225f53){if(!_0x225f53){_0x92d1f8[_0xe279('0xf')](0x194);}return _0x225f53;};}function handleError(_0x5dbf71,_0x1eccd0){_0x1eccd0=_0x1eccd0||0x1f4;return function(_0x1851db){logger[_0xe279('0x1c')](_0x1851db['stack']);if(_0x1851db[_0xe279('0x1d')]){delete _0x1851db[_0xe279('0x1d')];}_0x5dbf71[_0xe279('0x10')](_0x1eccd0)['send'](_0x1851db);};}exports[_0xe279('0x1e')]=function(_0x2aa184,_0x44851d){var _0x48436f={};var _0x429375={'count':0x0,'rows':[]};var _0x51c7fe=_[_0xe279('0x1f')](db[_0xe279('0x20')]['rawAttributes'],function(_0x494dcd){return{'name':_0x494dcd[_0xe279('0x21')],'type':_0x494dcd[_0xe279('0x22')][_0xe279('0x23')]};});_0x48436f=qs['getOptions'](_0x51c7fe,_0x2aa184);var _0xfda5da={'where':_0x48436f[_0xe279('0x24')]};return db[_0xe279('0x20')][_0xe279('0x14')](_0xfda5da)[_0xe279('0x17')](function(_0x3088b4){_0x429375[_0xe279('0x14')]=_0x3088b4;_0x48436f[_0xe279('0x25')]=qs[_0xe279('0x25')](_0x2aa184[_0xe279('0x26')]);return db[_0xe279('0x20')][_0xe279('0x27')](_0x48436f);})[_0xe279('0x17')](function(_0xdfcceb){_0x429375['rows']=_0xdfcceb;return _0x429375;})[_0xe279('0x17')](respondWithFilteredResult(_0x44851d,_0x48436f))[_0xe279('0x28')](handleError(_0x44851d,null));};exports[_0xe279('0x29')]=function(_0x146c4d,_0x17e292){var _0x2c7551={'raw':!![],'where':{'id':_0x146c4d[_0xe279('0x2a')]['id']}},_0x199d32={};_0x199d32[_0xe279('0x2b')]=_[_0xe279('0x2c')](db[_0xe279('0x20')][_0xe279('0x2d')]);_0x199d32[_0xe279('0x26')]=_[_0xe279('0x2c')](_0x146c4d['query']);_0x199d32['filters']=_[_0xe279('0x2e')](_0x199d32[_0xe279('0x2b')],_0x199d32['query']);_0x2c7551[_0xe279('0x2f')]=_[_0xe279('0x2e')](_0x199d32[_0xe279('0x2b')],qs['fields'](_0x146c4d[_0xe279('0x26')]['fields']));_0x2c7551['attributes']=_0x2c7551[_0xe279('0x2f')][_0xe279('0x30')]?_0x2c7551['attributes']:_0x199d32[_0xe279('0x2b')];if(_0x146c4d[_0xe279('0x26')][_0xe279('0x31')]){_0x2c7551[_0xe279('0x25')]=[{'all':!![]}];}_0x2c7551=_[_0xe279('0x32')]({},_0x2c7551,_0x146c4d[_0xe279('0x33')]);return db[_0xe279('0x20')][_0xe279('0x34')](_0x2c7551)[_0xe279('0x17')](handleEntityNotFound(_0x17e292,null))[_0xe279('0x17')](respondWithResult(_0x17e292,null))[_0xe279('0x28')](handleError(_0x17e292,null));};exports[_0xe279('0x35')]=function(_0x7b68e,_0x423f16){return db[_0xe279('0x20')][_0xe279('0x35')](_0x7b68e[_0xe279('0x36')],{})['then'](function(_0x4358){var _0x27614d=_0x7b68e[_0xe279('0x37')][_0xe279('0x19')]({'plain':!![]});if(!_0x27614d)throw new Error(_0xe279('0x38'));if(_0x27614d[_0xe279('0x39')]===_0xe279('0x37')){var _0x5e9292=_0x4358[_0xe279('0x19')]({'plain':!![]});var _0x51f42f=_0xe279('0x1a');return db[_0xe279('0x3a')]['find']({'where':{'name':_0x51f42f,'userProfileId':_0x27614d[_0xe279('0x3b')]},'raw':!![]})[_0xe279('0x17')](function(_0x25939d){if(_0x25939d&&_0x25939d[_0xe279('0x3c')]===0x0){return db[_0xe279('0x1b')][_0xe279('0x35')]({'name':_0x5e9292[_0xe279('0x1d')],'resourceId':_0x5e9292['id'],'type':_0x25939d[_0xe279('0x1d')],'sectionId':_0x25939d['id']},{})['then'](function(){return _0x4358;});}else{return _0x4358;}})['catch'](function(_0x526f35){logger[_0xe279('0x1c')](_0xe279('0x3d'),_0x526f35);throw _0x526f35;});}return _0x4358;})[_0xe279('0x17')](respondWithResult(_0x423f16,0xc9))[_0xe279('0x28')](handleError(_0x423f16,null));};exports[_0xe279('0x16')]=function(_0x31fdbb,_0x2781d6){if(_0x31fdbb[_0xe279('0x36')]['id']){delete _0x31fdbb[_0xe279('0x36')]['id'];}return db[_0xe279('0x20')][_0xe279('0x34')]({'where':{'id':_0x31fdbb[_0xe279('0x2a')]['id']}})[_0xe279('0x17')](handleEntityNotFound(_0x2781d6,null))[_0xe279('0x17')](saveUpdates(_0x31fdbb[_0xe279('0x36')],null))['then'](respondWithResult(_0x2781d6,null))[_0xe279('0x28')](handleError(_0x2781d6,null));};exports[_0xe279('0x18')]=function(_0x2371bb,_0x4801a0){return db[_0xe279('0x20')]['find']({'where':{'id':_0x2371bb[_0xe279('0x2a')]['id']}})[_0xe279('0x17')](handleEntityNotFound(_0x4801a0,null))[_0xe279('0x17')](removeEntity(_0x4801a0,null))[_0xe279('0x28')](handleError(_0x4801a0,null));};exports['describe']=function(_0x597be9,_0x182fac){return db[_0xe279('0x20')][_0xe279('0x3e')]()[_0xe279('0x17')](respondWithResult(_0x182fac,null))[_0xe279('0x28')](handleError(_0x182fac,null));};exports['getMembers']=function(_0x477a74,_0x5c1e90){var _0xdb33f={'raw':!![],'where':{}},_0xe6bda3={},_0x39f04e;return db[_0xe279('0x20')][_0xe279('0x3f')]({'where':{'id':_0x477a74[_0xe279('0x2a')]['id']}})[_0xe279('0x17')](handleEntityNotFound(_0x5c1e90,null))[_0xe279('0x17')](function(_0x327489){if(_0x327489){_0x39f04e=_0x327489[_0xe279('0x19')]({'plain':!![]});_0xe6bda3[_0xe279('0x2b')]=_['keys'](db[_0xe279('0x40')][_0xe279('0x2d')]);_0xe6bda3['query']=_[_0xe279('0x2c')](_0x477a74['query']);_0xe6bda3[_0xe279('0x41')]=_[_0xe279('0x2e')](_0xe6bda3[_0xe279('0x2b')],_0xe6bda3[_0xe279('0x26')]);_0xdb33f['attributes']=_['intersection'](_0xe6bda3['model'],qs['fields'](_0x477a74[_0xe279('0x26')][_0xe279('0x42')]));_0xdb33f[_0xe279('0x2f')]=_0xdb33f[_0xe279('0x2f')][_0xe279('0x30')]?_0xdb33f['attributes']:_0xe6bda3[_0xe279('0x2b')];if(!_0x477a74[_0xe279('0x26')]['hasOwnProperty'](_0xe279('0x43'))){_0xdb33f['limit']=qs[_0xe279('0x44')](_0x477a74[_0xe279('0x26')][_0xe279('0x44')]);_0xdb33f[_0xe279('0x12')]=qs[_0xe279('0x12')](_0x477a74[_0xe279('0x26')]['offset']);}_0xdb33f[_0xe279('0x45')]=qs[_0xe279('0x46')](_0x477a74['query'][_0xe279('0x46')]);_0xdb33f[_0xe279('0x24')]=qs['filters'](_[_0xe279('0x47')](_0x477a74['query'],_0xe6bda3[_0xe279('0x41')]));_0xdb33f[_0xe279('0x24')][_0xe279('0x48')]=_0x327489['id'];if(_0x477a74[_0xe279('0x26')]['filter']){_0xdb33f[_0xe279('0x24')]=_['merge'](_0xdb33f[_0xe279('0x24')],{'$or':_['map'](_0xdb33f[_0xe279('0x2f')],function(_0x234f08){var _0x403544={};_0x403544[_0x234f08]={'$like':'%'+_0x477a74[_0xe279('0x26')][_0xe279('0x49')]+'%'};return _0x403544;})});}_0xdb33f=_[_0xe279('0x32')]({},_0xdb33f,_0x477a74[_0xe279('0x33')]);return db[_0xe279('0x40')][_0xe279('0x27')](_0xdb33f);}})[_0xe279('0x17')](function(_0x3f3fdd){if(_0x3f3fdd){return db['User'][_0xe279('0x4a')]({'where':{'id':_[_0xe279('0x1f')](_0x3f3fdd,_0xe279('0x4b')),'role':_0xe279('0x4c')},'attributes':['id','name',_0xe279('0x4d'),_0xe279('0x4e'),_0xe279('0x4f')]});}})[_0xe279('0x17')](function(_0x32c820){if(_0x32c820){return{'count':_0x32c820[_0xe279('0x14')],'rows':_[_0xe279('0x1f')](_0x32c820['rows'],function(_0x10115b){return{'membername':_0x10115b['name'],'UserId':_0x10115b['id'],'queue_name':_0x39f04e[_0xe279('0x1d')],'ChatQueueId':_0x39f04e['id'],'interface':util[_0xe279('0x50')](_0xe279('0x51'),'SIP',_0x10115b[_0xe279('0x1d')]),'penalty':0x0,'paused':_0x10115b[_0xe279('0x4d')],'createdAt':_0x10115b['createdAt'],'updatedAt':_0x10115b[_0xe279('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe279('0x17')](respondWithFilteredResult(_0x5c1e90,_0xdb33f))['catch'](handleError(_0x5c1e90,null));};exports[_0xe279('0x52')]=function(_0x1d9e78,_0x3f8dd6){var _0x1c16b3={};var _0x499e79={};var _0x4adf13;var _0x4df47e;return db[_0xe279('0x20')][_0xe279('0x3f')]({'where':{'id':_0x1d9e78[_0xe279('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3f8dd6,null))[_0xe279('0x17')](function(_0x37e3f2){if(_0x37e3f2){_0x4adf13=_0x37e3f2;_0x499e79[_0xe279('0x2b')]=_['keys'](db[_0xe279('0x53')][_0xe279('0x2d')]);_0x499e79[_0xe279('0x26')]=_[_0xe279('0x2c')](_0x1d9e78[_0xe279('0x26')]);_0x499e79[_0xe279('0x41')]=_[_0xe279('0x2e')](_0x499e79[_0xe279('0x2b')],_0x499e79[_0xe279('0x26')]);_0x1c16b3[_0xe279('0x2f')]=_[_0xe279('0x2e')](_0x499e79['model'],qs[_0xe279('0x42')](_0x1d9e78[_0xe279('0x26')][_0xe279('0x42')]));_0x1c16b3['attributes']=_0x1c16b3['attributes'][_0xe279('0x30')]?_0x1c16b3[_0xe279('0x2f')]:_0x499e79[_0xe279('0x2b')];_0x1c16b3['order']=qs['sort'](_0x1d9e78['query'][_0xe279('0x46')]);_0x1c16b3[_0xe279('0x24')]=qs['filters'](_[_0xe279('0x47')](_0x1d9e78[_0xe279('0x26')],_0x499e79['filters']));if(_0x1d9e78[_0xe279('0x26')][_0xe279('0x49')]){_0x1c16b3['where']=_[_0xe279('0x32')](_0x1c16b3[_0xe279('0x24')],{'$or':_[_0xe279('0x1f')](_0x1c16b3[_0xe279('0x2f')],function(_0x16ff32){var _0x5179b4={};_0x5179b4[_0x16ff32]={'$like':'%'+_0x1d9e78['query']['filter']+'%'};return _0x5179b4;})});}_0x1c16b3=_[_0xe279('0x32')]({},_0x1c16b3,_0x1d9e78[_0xe279('0x33')]);return _0x4adf13[_0xe279('0x52')](_0x1c16b3);}})['then'](function(_0x13c4db){if(_0x13c4db){_0x4df47e=_0x13c4db[_0xe279('0x30')];if(!_0x1d9e78[_0xe279('0x26')][_0xe279('0x54')](_0xe279('0x43'))){_0x1c16b3[_0xe279('0x44')]=qs[_0xe279('0x44')](_0x1d9e78['query'][_0xe279('0x44')]);_0x1c16b3[_0xe279('0x12')]=qs[_0xe279('0x12')](_0x1d9e78['query']['offset']);}return _0x4adf13[_0xe279('0x52')](_0x1c16b3);}})[_0xe279('0x17')](function(_0xaa4eba){if(_0xaa4eba){return _0xaa4eba?{'count':_0x4df47e,'rows':_0xaa4eba}:null;}})[_0xe279('0x17')](respondWithResult(_0x3f8dd6,null))['catch'](handleError(_0x3f8dd6,null));};exports[_0xe279('0x55')]=function(_0x2ed3e9,_0x1c7d57){var _0x298c82=_0x2ed3e9[_0xe279('0x36')][_0xe279('0x56')];return db[_0xe279('0x53')][_0xe279('0x27')]({'where':{'id':_0x298c82},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe279('0x57'),'attributes':['id',_0xe279('0x1d'),_0xe279('0x58'),'voicePause',_0xe279('0x59')],'raw':!![]}]})[_0xe279('0x17')](function(_0x205561){if(_0x205561){var _0x208370=_[_0xe279('0x5a')](_0x205561,function(_0x209ae1){var _0x2c5907=_0x209ae1[_0xe279('0x19')]({'plain':!![]});return _0x2c5907['Agents'];});return db[_0xe279('0x20')][_0xe279('0x34')]({'where':{'id':_0x2ed3e9[_0xe279('0x2a')]['id']}})[_0xe279('0x17')](function(_0x89de92){return db['sequelize'][_0xe279('0x5b')](function(_0x382eec){return _0x89de92[_0xe279('0x55')](_0x298c82,{'transaction':_0x382eec})[_0xe279('0x17')](function(){return BPromise['each'](_0x208370,function(_0x56bfa5){return db[_0xe279('0x40')][_0xe279('0x5c')]({'where':{'UserId':_0x56bfa5['id'],'ChatQueueId':_0x2ed3e9[_0xe279('0x2a')]['id']},'transaction':_0x382eec});});})[_0xe279('0x17')](function(){_0x208370[_0xe279('0x5d')](function(_0x3b12cc){socket[_0xe279('0x5e')]('userChatQueue:save',{'UserId':_0x3b12cc['id'],'ChatQueueId':_0x89de92['id']});});});});});}})[_0xe279('0x17')](respondWithStatusCode(_0x1c7d57,null))[_0xe279('0x28')](handleError(_0x1c7d57,null));};exports[_0xe279('0x5f')]=function(_0x55feac,_0x5b38f7){return db[_0xe279('0x53')]['findAll']({'where':{'id':_0x55feac['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xe279('0x60')],'as':_0xe279('0x57'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5b38f7,null))[_0xe279('0x17')](function(_0x201a16){var _0xc9fc36=_[_0xe279('0x1f')](_0x201a16,'id');var _0x680e41=[];var _0x148517=[];var _0x5d06f9=squel[_0xe279('0x61')]();_0x5d06f9[_0xe279('0x62')](_0xe279('0x63'))[_0xe279('0x64')](_0xe279('0x65'),'tq')[_0xe279('0x66')](_0xe279('0x67'),'ut',_0xe279('0x68'))['where'](_0xe279('0x69'),_0x55feac['params']['id']);for(var _0x493b12=0x0;_0x493b12<_0x201a16['length'];_0x493b12+=0x1){let _0x44cd1a=_0x201a16[_0x493b12];for(var _0x527e0a=0x0;_0x527e0a<_0x44cd1a[_0xe279('0x57')]['length'];_0x527e0a+=0x1){let _0x58230a=_0x44cd1a[_0xe279('0x57')][_0x527e0a];var _0x2aecc8=_0x5d06f9['clone']();_0x2aecc8[_0xe279('0x24')](_0xe279('0x6a'),_0x58230a['id']);_0x148517[_0xe279('0x6b')](db['sequelize'][_0xe279('0x26')](_0x2aecc8[_0xe279('0x6c')](),{'type':db[_0xe279('0x6d')][_0xe279('0x6e')]['SELECT']})['then'](function(_0x45ac2c){if(_0x45ac2c[_0xe279('0x30')]===0x1){return _0x58230a['id'];}else{var _0x2cc2ff=_['every'](_[_0xe279('0x1f')](_0x45ac2c,'TeamId'),function(_0x9037e4){return _[_0xe279('0x6f')](_0xc9fc36,_0x9037e4);});if(_0x2cc2ff){return _0x58230a['id'];}}}));}}return BPromise[_0xe279('0x70')](_0x148517)['then'](function(_0x2653b0){_0x680e41=_(_0x680e41)[_0xe279('0x71')](_0x2653b0)['compact']()[_0xe279('0x72')]();return db['ChatQueue'][_0xe279('0x34')]({'where':{'id':_0x55feac[_0xe279('0x2a')]['id']}})[_0xe279('0x17')](function(_0x7b480b){return db['sequelize']['transaction'](function(_0x541404){return _0x7b480b[_0xe279('0x5f')](_0x55feac[_0xe279('0x26')][_0xe279('0x56')],{'transaction':_0x541404})[_0xe279('0x17')](function(){if(!_[_0xe279('0x73')](_0x680e41)){return _0x7b480b[_0xe279('0x74')](_0x680e41,{'transaction':_0x541404});}})[_0xe279('0x17')](function(){_0x680e41['forEach'](function(_0x164a33){socket[_0xe279('0x5e')](_0xe279('0x75'),{'UserId':_0x164a33,'ChatQueueId':_0x7b480b['id']});});});});});});})[_0xe279('0x17')](respondWithStatusCode(_0x5b38f7,null))[_0xe279('0x28')](handleError(_0x5b38f7,null));};exports[_0xe279('0x76')]=function(_0x36b1c1,_0x7727ff){return db[_0xe279('0x20')]['find']({'where':{'id':_0x36b1c1[_0xe279('0x2a')]['id']}})['then'](handleEntityNotFound(_0x7727ff,null))[_0xe279('0x17')](function(_0x1572a4){if(_0x1572a4){return _0x1572a4['addAgents'](_0x36b1c1[_0xe279('0x36')][_0xe279('0x56')],_[_0xe279('0x77')](_0x36b1c1[_0xe279('0x36')],['ids','id'])||{})[_0xe279('0x78')](function(_0x18ce17){for(var _0x298d1a=0x0;_0x298d1a<_0x36b1c1['body'][_0xe279('0x56')][_0xe279('0x30')];_0x298d1a+=0x1){socket[_0xe279('0x5e')]('userChatQueue:save',{'UserId':Number(_0x36b1c1[_0xe279('0x36')][_0xe279('0x56')][_0x298d1a]),'ChatQueueId':Number(_0x36b1c1[_0xe279('0x2a')]['id'])});}return _0x18ce17;});}})['then'](respondWithResult(_0x7727ff,null))[_0xe279('0x28')](handleError(_0x7727ff,null));};exports['removeAgents']=function(_0x5f3d94,_0x1c320a){return db[_0xe279('0x20')]['find']({'where':{'id':_0x5f3d94['params']['id']}})[_0xe279('0x17')](handleEntityNotFound(_0x1c320a,null))[_0xe279('0x17')](function(_0x5bea45){if(_0x5bea45){return _0x5bea45[_0xe279('0x74')](_0x5f3d94['query'][_0xe279('0x56')])[_0xe279('0x17')](function(){if(_['isArray'](_0x5f3d94['query']['ids'])){for(var _0xe7a007=0x0;_0xe7a007<_0x5f3d94[_0xe279('0x26')][_0xe279('0x56')][_0xe279('0x30')];_0xe7a007+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x5f3d94['query'][_0xe279('0x56')][_0xe7a007]),'ChatQueueId':Number(_0x5f3d94[_0xe279('0x2a')]['id'])});}}else{socket['emit'](_0xe279('0x75'),{'UserId':Number(_0x5f3d94[_0xe279('0x26')][_0xe279('0x56')]),'ChatQueueId':Number(_0x5f3d94[_0xe279('0x2a')]['id'])});}});}})[_0xe279('0x17')](respondWithStatusCode(_0x1c320a,null))[_0xe279('0x28')](handleError(_0x1c320a,null));};exports[_0xe279('0x79')]=function(_0x360662,_0x2fa3e9){var _0x1529bd={};var _0x42ec05={};var _0x45718e;var _0xc9cada;return db[_0xe279('0x20')][_0xe279('0x3f')]({'where':{'id':_0x360662['params']['id']}})[_0xe279('0x17')](handleEntityNotFound(_0x2fa3e9,null))['then'](function(_0x152065){if(_0x152065){_0x45718e=_0x152065;_0x42ec05[_0xe279('0x2b')]=_[_0xe279('0x2c')](db[_0xe279('0x60')]['rawAttributes']);_0x42ec05[_0xe279('0x26')]=_[_0xe279('0x2c')](_0x360662['query']);_0x42ec05[_0xe279('0x41')]=_[_0xe279('0x2e')](_0x42ec05[_0xe279('0x2b')],_0x42ec05['query']);_0x1529bd[_0xe279('0x2f')]=_['intersection'](_0x42ec05['model'],qs[_0xe279('0x42')](_0x360662[_0xe279('0x26')]['fields']));_0x1529bd[_0xe279('0x2f')]=_0x1529bd[_0xe279('0x2f')]['length']?_0x1529bd[_0xe279('0x2f')]:_0x42ec05['model'];_0x1529bd['order']=qs['sort'](_0x360662[_0xe279('0x26')]['sort']);_0x1529bd[_0xe279('0x24')]=qs[_0xe279('0x41')](_['pick'](_0x360662['query'],_0x42ec05['filters']));if(_0x360662[_0xe279('0x26')]['filter']){_0x1529bd[_0xe279('0x24')]=_['merge'](_0x1529bd[_0xe279('0x24')],{'$or':_[_0xe279('0x1f')](_0x1529bd[_0xe279('0x2f')],function(_0x4d2961){var _0x2ba14a={};_0x2ba14a[_0x4d2961]={'$like':'%'+_0x360662[_0xe279('0x26')][_0xe279('0x49')]+'%'};return _0x2ba14a;})});}_0x1529bd=_[_0xe279('0x32')]({},_0x1529bd,_0x360662[_0xe279('0x33')]);return _0x45718e[_0xe279('0x79')](_0x1529bd);}})[_0xe279('0x17')](function(_0x1ee803){if(_0x1ee803){_0xc9cada=_0x1ee803[_0xe279('0x30')];if(!_0x360662[_0xe279('0x26')][_0xe279('0x54')](_0xe279('0x43'))){_0x1529bd['limit']=qs[_0xe279('0x44')](_0x360662[_0xe279('0x26')][_0xe279('0x44')]);_0x1529bd['offset']=qs[_0xe279('0x12')](_0x360662[_0xe279('0x26')][_0xe279('0x12')]);}return _0x45718e['getAgents'](_0x1529bd);}})[_0xe279('0x17')](function(_0x49aa9a){if(_0x49aa9a){return _0x49aa9a?{'count':_0xc9cada,'rows':_0x49aa9a}:null;}})[_0xe279('0x17')](respondWithResult(_0x2fa3e9,null))[_0xe279('0x28')](handleError(_0x2fa3e9,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index dd7dc1b..a94ccc1 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 _0xc02b=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x49f5df,_0x27919c){var _0x4f040f=function(_0x4c9f3e){while(--_0x4c9f3e){_0x49f5df['push'](_0x49f5df['shift']());}};_0x4f040f(++_0x27919c);}(_0xc02b,0x169));var _0xbc02=function(_0x4c6c46,_0x4d5b50){_0x4c6c46=_0x4c6c46-0x0;var _0x4eca5e=_0xc02b[_0x4c6c46];return _0x4eca5e;};'use strict';var EventEmitter=require(_0xbc02('0x0'));var ChatQueue=require(_0xbc02('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbc02('0x2'),'afterUpdate':_0xbc02('0x3'),'afterDestroy':_0xbc02('0x4')};function emitEvent(_0x10626a){return function(_0x4c1075,_0x3586aa,_0x23bb82){ChatQueueEvents[_0xbc02('0x5')](_0x10626a+':'+_0x4c1075['id'],_0x4c1075);ChatQueueEvents[_0xbc02('0x5')](_0x10626a,_0x4c1075);_0x23bb82(null);};}for(var e in events){if(events[_0xbc02('0x6')](e)){var event=events[e];ChatQueue[_0xbc02('0x7')](e,emitEvent(event));}}module[_0xbc02('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xf0cd=['events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x3c1ea9,_0x436f52){var _0x54312e=function(_0x70728e){while(--_0x70728e){_0x3c1ea9['push'](_0x3c1ea9['shift']());}};_0x54312e(++_0x436f52);}(_0xf0cd,0x154));var _0xdf0c=function(_0x598a93,_0x1e2be1){_0x598a93=_0x598a93-0x0;var _0x9dd13a=_0xf0cd[_0x598a93];return _0x9dd13a;};'use strict';var EventEmitter=require(_0xdf0c('0x0'));var ChatQueue=require(_0xdf0c('0x1'))['db'][_0xdf0c('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xdf0c('0x3')](0x0);var events={'afterCreate':_0xdf0c('0x4'),'afterUpdate':_0xdf0c('0x5'),'afterDestroy':_0xdf0c('0x6')};function emitEvent(_0x12098f){return function(_0x3fde9a,_0x39710d,_0x3cd3f7){ChatQueueEvents['emit'](_0x12098f+':'+_0x3fde9a['id'],_0x3fde9a);ChatQueueEvents['emit'](_0x12098f,_0x3fde9a);_0x3cd3f7(null);};}for(var e in events){if(events[_0xdf0c('0x7')](e)){var event=events[e];ChatQueue[_0xdf0c('0x8')](e,emitEvent(event));}}module[_0xdf0c('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 4f91ede..2c525a7 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 _0x3acb=['../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3acb,0x68));var _0xb3ac=function(_0x47ff64,_0x5cc9ef){_0x47ff64=_0x47ff64-0x0;var _0x240bc9=_0x3acb[_0x47ff64];return _0x240bc9;};'use strict';var _=require(_0xb3ac('0x0'));var util=require(_0xb3ac('0x1'));var logger=require(_0xb3ac('0x2'))('api');var moment=require(_0xb3ac('0x3'));var BPromise=require(_0xb3ac('0x4'));var rp=require(_0xb3ac('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3ac('0x6'));var attributes=require(_0xb3ac('0x7'));module[_0xb3ac('0x8')]=function(_0xb07cfe,_0x15ce51){return _0xb07cfe[_0xb3ac('0x9')](_0xb3ac('0xa'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x257e=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash'];(function(_0x1d4b14,_0x2619a8){var _0x2e477b=function(_0x4ba152){while(--_0x4ba152){_0x1d4b14['push'](_0x1d4b14['shift']());}};_0x2e477b(++_0x2619a8);}(_0x257e,0x103));var _0xe257=function(_0x3c4062,_0x3767fc){_0x3c4062=_0x3c4062-0x0;var _0x3f5bf3=_0x257e[_0x3c4062];return _0x3f5bf3;};'use strict';var _=require(_0xe257('0x0'));var util=require(_0xe257('0x1'));var logger=require(_0xe257('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe257('0x3'));var rp=require(_0xe257('0x4'));var fs=require('fs');var path=require(_0xe257('0x5'));var rimraf=require(_0xe257('0x6'));var config=require(_0xe257('0x7'));var attributes=require(_0xe257('0x8'));module[_0xe257('0x9')]=function(_0x3fc5ce,_0x144130){return _0x3fc5ce[_0xe257('0xa')](_0xe257('0xb'),attributes,{'tableName':_0xe257('0xc'),'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 4324336..8677699 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 _0x117c=['map','model','GetChatQueue','ShowChatQueue','raw','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./chatQueue.socket','register','then','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ChatQueue','findAll','options','where','attributes','limit','include'];(function(_0x339948,_0x1e07fe){var _0x3fe9cc=function(_0x5bfc39){while(--_0x5bfc39){_0x339948['push'](_0x339948['shift']());}};_0x3fe9cc(++_0x1e07fe);}(_0x117c,0x71));var _0xc117=function(_0x4b3358,_0x5cda77){_0x4b3358=_0x4b3358-0x0;var _0x1ea011=_0x117c[_0x4b3358];return _0x1ea011;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc117('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc117('0x1'))['db'];var utils=require(_0xc117('0x2'));var logger=require(_0xc117('0x3'))(_0xc117('0x4'));var config=require(_0xc117('0x5'));var jayson=require(_0xc117('0x6'));var client=jayson['client'][_0xc117('0x7')]({'port':0x232a});config[_0xc117('0x8')]=_['defaults'](config[_0xc117('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xc117('0x9'))(new Redis(config[_0xc117('0x8')]));require(_0xc117('0xa'))[_0xc117('0xb')](socket);function respondWithRpcPromise(_0x1a52a5,_0x4a1e04,_0x36f8e6){return new BPromise(function(_0x574c99,_0x44d812){return client['request'](_0x1a52a5,_0x36f8e6)[_0xc117('0xc')](function(_0x25d4ff){logger['info'](_0xc117('0xd'),_0x4a1e04,'request\x20sent');logger[_0xc117('0xe')](_0xc117('0xf'),_0x4a1e04,_0xc117('0x10'),JSON[_0xc117('0x11')](_0x25d4ff));if(_0x25d4ff['error']){if(_0x25d4ff[_0xc117('0x12')][_0xc117('0x13')]===0x1f4){logger[_0xc117('0x12')](_0xc117('0xd'),_0x4a1e04,_0x25d4ff[_0xc117('0x12')][_0xc117('0x14')]);return _0x44d812(_0x25d4ff[_0xc117('0x12')][_0xc117('0x14')]);}logger[_0xc117('0x12')]('ChatQueue,\x20%s,\x20%s',_0x4a1e04,_0x25d4ff['error'][_0xc117('0x14')]);return _0x574c99(_0x25d4ff[_0xc117('0x12')][_0xc117('0x14')]);}else{logger[_0xc117('0x15')](_0xc117('0xd'),_0x4a1e04,_0xc117('0x10'));_0x574c99(_0x25d4ff[_0xc117('0x16')][_0xc117('0x14')]);}})[_0xc117('0x17')](function(_0x1eb419){logger[_0xc117('0x12')](_0xc117('0xd'),_0x4a1e04,_0x1eb419);_0x44d812(_0x1eb419);});});}exports['GetChatQueue']=function(_0x1b9095){var _0x4717ec=this;return new Promise(function(_0xf5307f,_0x1a5ba0){return db[_0xc117('0x18')][_0xc117('0x19')]({'raw':_0x1b9095[_0xc117('0x1a')]?_0x1b9095['options']['raw']===undefined?!![]:![]:!![],'where':_0x1b9095[_0xc117('0x1a')]?_0x1b9095[_0xc117('0x1a')][_0xc117('0x1b')]||null:null,'attributes':_0x1b9095[_0xc117('0x1a')]?_0x1b9095[_0xc117('0x1a')][_0xc117('0x1c')]||null:null,'limit':_0x1b9095['options']?_0x1b9095['options'][_0xc117('0x1d')]||null:null,'include':_0x1b9095['options']?_0x1b9095[_0xc117('0x1a')][_0xc117('0x1e')]?_[_0xc117('0x1f')](_0x1b9095['options'][_0xc117('0x1e')],function(_0xfefce5){return{'model':db[_0xfefce5[_0xc117('0x20')]],'as':_0xfefce5['as'],'attributes':_0xfefce5[_0xc117('0x1c')],'include':_0xfefce5[_0xc117('0x1e')]?_[_0xc117('0x1f')](_0xfefce5['include'],function(_0x334041){return{'model':db[_0x334041['model']],'as':_0x334041['as'],'attributes':_0x334041['attributes'],'include':_0x334041[_0xc117('0x1e')]?_[_0xc117('0x1f')](_0x334041[_0xc117('0x1e')],function(_0x52c152){return{'model':db[_0x52c152[_0xc117('0x20')]],'as':_0x52c152['as'],'attributes':_0x52c152[_0xc117('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x459b8a){logger[_0xc117('0x15')](_0xc117('0x21'),_0x1b9095);logger['debug'](_0xc117('0x21'),_0x1b9095,JSON['stringify'](_0x459b8a));_0xf5307f(_0x459b8a);})[_0xc117('0x17')](function(_0x168a76){logger[_0xc117('0x12')](_0xc117('0x21'),_0x168a76['message'],_0x1b9095);_0x1a5ba0(_0x4717ec[_0xc117('0x12')](0x1f4,_0x168a76[_0xc117('0x14')]));});});};exports[_0xc117('0x22')]=function(_0x3d4887){var _0x59e817=this;return new Promise(function(_0x2cb54a,_0x5a675a){return db[_0xc117('0x18')]['find']({'raw':_0x3d4887[_0xc117('0x1a')]?_0x3d4887['options'][_0xc117('0x23')]===undefined?!![]:![]:!![],'where':_0x3d4887['options']?_0x3d4887[_0xc117('0x1a')][_0xc117('0x1b')]||null:null,'attributes':_0x3d4887[_0xc117('0x1a')]?_0x3d4887['options'][_0xc117('0x1c')]||null:null,'include':_0x3d4887[_0xc117('0x1a')]?_0x3d4887[_0xc117('0x1a')][_0xc117('0x1e')]?_[_0xc117('0x1f')](_0x3d4887[_0xc117('0x1a')][_0xc117('0x1e')],function(_0x3302b9){return{'model':db[_0x3302b9['model']],'as':_0x3302b9['as'],'attributes':_0x3302b9[_0xc117('0x1c')],'include':_0x3302b9[_0xc117('0x1e')]?_[_0xc117('0x1f')](_0x3302b9['include'],function(_0x2a5efb){return{'model':db[_0x2a5efb[_0xc117('0x20')]],'as':_0x2a5efb['as'],'attributes':_0x2a5efb[_0xc117('0x1c')],'include':_0x2a5efb[_0xc117('0x1e')]?_[_0xc117('0x1f')](_0x2a5efb[_0xc117('0x1e')],function(_0x580637){return{'model':db[_0x580637['model']],'as':_0x580637['as'],'attributes':_0x580637[_0xc117('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc117('0xc')](function(_0x5db7a2){logger[_0xc117('0x15')](_0xc117('0x22'),_0x3d4887);logger[_0xc117('0xe')]('ShowChatQueue',_0x3d4887,JSON['stringify'](_0x5db7a2));_0x2cb54a(_0x5db7a2);})['catch'](function(_0x124aee){logger['error'](_0xc117('0x22'),_0x124aee[_0xc117('0x14')],_0x3d4887);_0x5a675a(_0x59e817[_0xc117('0x12')](0x1f4,_0x124aee[_0xc117('0x14')]));});});}; \ No newline at end of file +var _0xa3c3=['info','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','include','model','map','ShowChatQueue','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x598957,_0x2f1879){var _0x42b4c4=function(_0x78a66a){while(--_0x78a66a){_0x598957['push'](_0x598957['shift']());}};_0x42b4c4(++_0x2f1879);}(_0xa3c3,0xcc));var _0x3a3c=function(_0x70668c,_0x4fb1dd){_0x70668c=_0x70668c-0x0;var _0x30e9a5=_0xa3c3[_0x70668c];return _0x30e9a5;};'use strict';var _=require(_0x3a3c('0x0'));var util=require('util');var moment=require(_0x3a3c('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a3c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a3c('0x3'))['db'];var utils=require(_0x3a3c('0x4'));var logger=require('../../config/logger')(_0x3a3c('0x5'));var config=require(_0x3a3c('0x6'));var jayson=require(_0x3a3c('0x7'));var client=jayson[_0x3a3c('0x8')]['http']({'port':0x232a});config['redis']=_[_0x3a3c('0x9')](config[_0x3a3c('0xa')],{'host':_0x3a3c('0xb'),'port':0x18eb});var socket=require(_0x3a3c('0xc'))(new Redis(config[_0x3a3c('0xa')]));require('./chatQueue.socket')[_0x3a3c('0xd')](socket);function respondWithRpcPromise(_0x1e26f9,_0x367223,_0x2e29d2){return new BPromise(function(_0x544fc3,_0x2eed5b){return client[_0x3a3c('0xe')](_0x1e26f9,_0x2e29d2)[_0x3a3c('0xf')](function(_0x2e2232){logger['info'](_0x3a3c('0x10'),_0x367223,_0x3a3c('0x11'));logger[_0x3a3c('0x12')](_0x3a3c('0x13'),_0x367223,_0x3a3c('0x11'),JSON[_0x3a3c('0x14')](_0x2e2232));if(_0x2e2232[_0x3a3c('0x15')]){if(_0x2e2232[_0x3a3c('0x15')][_0x3a3c('0x16')]===0x1f4){logger[_0x3a3c('0x15')]('ChatQueue,\x20%s,\x20%s',_0x367223,_0x2e2232[_0x3a3c('0x15')][_0x3a3c('0x17')]);return _0x2eed5b(_0x2e2232['error'][_0x3a3c('0x17')]);}logger[_0x3a3c('0x15')](_0x3a3c('0x10'),_0x367223,_0x2e2232[_0x3a3c('0x15')][_0x3a3c('0x17')]);return _0x544fc3(_0x2e2232[_0x3a3c('0x15')][_0x3a3c('0x17')]);}else{logger[_0x3a3c('0x18')](_0x3a3c('0x10'),_0x367223,_0x3a3c('0x11'));_0x544fc3(_0x2e2232[_0x3a3c('0x19')][_0x3a3c('0x17')]);}})[_0x3a3c('0x1a')](function(_0x15c68b){logger['error'](_0x3a3c('0x10'),_0x367223,_0x15c68b);_0x2eed5b(_0x15c68b);});});}exports[_0x3a3c('0x1b')]=function(_0x379652){var _0x29df40=this;return new Promise(function(_0x369047,_0x56079e){return db[_0x3a3c('0x1c')][_0x3a3c('0x1d')]({'raw':_0x379652[_0x3a3c('0x1e')]?_0x379652[_0x3a3c('0x1e')][_0x3a3c('0x1f')]===undefined?!![]:![]:!![],'where':_0x379652[_0x3a3c('0x1e')]?_0x379652[_0x3a3c('0x1e')][_0x3a3c('0x20')]||null:null,'attributes':_0x379652[_0x3a3c('0x1e')]?_0x379652[_0x3a3c('0x1e')][_0x3a3c('0x21')]||null:null,'limit':_0x379652[_0x3a3c('0x1e')]?_0x379652[_0x3a3c('0x1e')]['limit']||null:null,'include':_0x379652[_0x3a3c('0x1e')]?_0x379652[_0x3a3c('0x1e')]['include']?_['map'](_0x379652[_0x3a3c('0x1e')][_0x3a3c('0x22')],function(_0x55e925){return{'model':db[_0x55e925[_0x3a3c('0x23')]],'as':_0x55e925['as'],'attributes':_0x55e925[_0x3a3c('0x21')],'include':_0x55e925['include']?_[_0x3a3c('0x24')](_0x55e925[_0x3a3c('0x22')],function(_0x42ffb8){return{'model':db[_0x42ffb8['model']],'as':_0x42ffb8['as'],'attributes':_0x42ffb8[_0x3a3c('0x21')],'include':_0x42ffb8[_0x3a3c('0x22')]?_[_0x3a3c('0x24')](_0x42ffb8[_0x3a3c('0x22')],function(_0x28a0c7){return{'model':db[_0x28a0c7[_0x3a3c('0x23')]],'as':_0x28a0c7['as'],'attributes':_0x28a0c7[_0x3a3c('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x169bac){logger[_0x3a3c('0x18')](_0x3a3c('0x1b'),_0x379652);logger[_0x3a3c('0x12')](_0x3a3c('0x1b'),_0x379652,JSON[_0x3a3c('0x14')](_0x169bac));_0x369047(_0x169bac);})[_0x3a3c('0x1a')](function(_0x553072){logger[_0x3a3c('0x15')](_0x3a3c('0x1b'),_0x553072['message'],_0x379652);_0x56079e(_0x29df40[_0x3a3c('0x15')](0x1f4,_0x553072[_0x3a3c('0x17')]));});});};exports[_0x3a3c('0x25')]=function(_0x48bf45){var _0x4e0636=this;return new Promise(function(_0xa0bfc5,_0x5e2451){return db[_0x3a3c('0x1c')]['find']({'raw':_0x48bf45[_0x3a3c('0x1e')]?_0x48bf45['options'][_0x3a3c('0x1f')]===undefined?!![]:![]:!![],'where':_0x48bf45[_0x3a3c('0x1e')]?_0x48bf45[_0x3a3c('0x1e')][_0x3a3c('0x20')]||null:null,'attributes':_0x48bf45['options']?_0x48bf45[_0x3a3c('0x1e')]['attributes']||null:null,'include':_0x48bf45['options']?_0x48bf45['options'][_0x3a3c('0x22')]?_[_0x3a3c('0x24')](_0x48bf45[_0x3a3c('0x1e')][_0x3a3c('0x22')],function(_0x5aa41e){return{'model':db[_0x5aa41e['model']],'as':_0x5aa41e['as'],'attributes':_0x5aa41e[_0x3a3c('0x21')],'include':_0x5aa41e[_0x3a3c('0x22')]?_[_0x3a3c('0x24')](_0x5aa41e[_0x3a3c('0x22')],function(_0x31e5f9){return{'model':db[_0x31e5f9[_0x3a3c('0x23')]],'as':_0x31e5f9['as'],'attributes':_0x31e5f9['attributes'],'include':_0x31e5f9[_0x3a3c('0x22')]?_[_0x3a3c('0x24')](_0x31e5f9['include'],function(_0x1d6bcc){return{'model':db[_0x1d6bcc['model']],'as':_0x1d6bcc['as'],'attributes':_0x1d6bcc[_0x3a3c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3a3c('0xf')](function(_0x4fb094){logger[_0x3a3c('0x18')](_0x3a3c('0x25'),_0x48bf45);logger['debug']('ShowChatQueue',_0x48bf45,JSON[_0x3a3c('0x14')](_0x4fb094));_0xa0bfc5(_0x4fb094);})['catch'](function(_0x2f3278){logger[_0x3a3c('0x15')](_0x3a3c('0x25'),_0x2f3278[_0x3a3c('0x17')],_0x48bf45);_0x5e2451(_0x4e0636[_0x3a3c('0x15')](0x1f4,_0x2f3278[_0x3a3c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 0d71c6d..a66fb0d 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 _0xb43b=['./chatQueue.events','save','update','emit','removeListener','length','chatQueue:'];(function(_0x433e29,_0x14b418){var _0x84abd4=function(_0x232635){while(--_0x232635){_0x433e29['push'](_0x433e29['shift']());}};_0x84abd4(++_0x14b418);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1ae8b9,_0x564fe4){_0x1ae8b9=_0x1ae8b9-0x0;var _0x50e83a=_0xb43b[_0x1ae8b9];return _0x50e83a;};'use strict';var ChatQueueEvents=require(_0xbb43('0x0'));var events=[_0xbb43('0x1'),'remove',_0xbb43('0x2')];function createListener(_0x1995f8,_0x22bc86){return function(_0x4cf605){_0x22bc86[_0xbb43('0x3')](_0x1995f8,_0x4cf605);};}function removeListener(_0x41aff6,_0x351254){return function(){ChatQueueEvents[_0xbb43('0x4')](_0x41aff6,_0x351254);};}exports['register']=function(_0x491fb9){for(var _0x378df5=0x0,_0x553520=events[_0xbb43('0x5')];_0x378df5<_0x553520;_0x378df5++){var _0x1ccd49=events[_0x378df5];var _0x2a2f11=createListener(_0xbb43('0x6')+_0x1ccd49,_0x491fb9);ChatQueueEvents['on'](_0x1ccd49,_0x2a2f11);}}; \ No newline at end of file +var _0x68fc=['emit','removeListener','register','chatQueue:','./chatQueue.events','save','remove'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0x68fc,0xa5));var _0xc68f=function(_0x5eb345,_0x1bd6c0){_0x5eb345=_0x5eb345-0x0;var _0x5b7e0d=_0x68fc[_0x5eb345];return _0x5b7e0d;};'use strict';var ChatQueueEvents=require(_0xc68f('0x0'));var events=[_0xc68f('0x1'),_0xc68f('0x2'),'update'];function createListener(_0x49aa95,_0x26513f){return function(_0x506fb5){_0x26513f[_0xc68f('0x3')](_0x49aa95,_0x506fb5);};}function removeListener(_0x593648,_0x5899ea){return function(){ChatQueueEvents[_0xc68f('0x4')](_0x593648,_0x5899ea);};}exports[_0xc68f('0x5')]=function(_0x1c6df9){for(var _0x363cdf=0x0,_0x4fcce4=events['length'];_0x363cdf<_0x4fcce4;_0x363cdf++){var _0x9f2705=events[_0x363cdf];var _0x2bf3fd=createListener(_0xc68f('0x6')+_0x9f2705,_0x1c6df9);ChatQueueEvents['on'](_0x9f2705,_0x2bf3fd);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 67b8308..18eba32 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3e74,0x175));var _0x43e7=function(_0x540e9b,_0x3125c9){_0x540e9b=_0x540e9b-0x0;var _0x2dd5bc=_0x3e74[_0x540e9b];return _0x2dd5bc;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x336ef6,_0x28335f){var _0x37575c=function(_0x39c1fe){while(--_0x39c1fe){_0x336ef6['push'](_0x336ef6['shift']());}};_0x37575c(++_0x28335f);}(_0xe14b,0x93));var _0xbe14=function(_0x11cf8e,_0x54e763){_0x11cf8e=_0x11cf8e-0x0;var _0x5664a1=_0xe14b[_0x11cf8e];return _0x5664a1;};'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 9587945..7340eee 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 _0xd06e=['exports','STRING','DATE'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd06e,0x16b));var _0xed06=function(_0x14796e,_0x2f5bd8){_0x14796e=_0x14796e-0x0;var _0xbbb626=_0xd06e[_0x14796e];return _0xbbb626;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xed06('0x0')]={'uniqueid':{'type':Sequelize[_0xed06('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xed06('0x2')]},'acceptAt':{'type':Sequelize[_0xed06('0x2')]},'exitAt':{'type':Sequelize[_0xed06('0x2')]},'reason':{'type':Sequelize[_0xed06('0x1')]}}; \ No newline at end of file +var _0x1ac8=['STRING','DATE','moment','sequelize','exports'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x1ac8,0xed));var _0x81ac=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1ac8[_0x122ef9];return _0x42fba0;};'use strict';var moment=require(_0x81ac('0x0'));var Sequelize=require(_0x81ac('0x1'));module[_0x81ac('0x2')]={'uniqueid':{'type':Sequelize[_0x81ac('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x81ac('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x81ac('0x4')]},'acceptAt':{'type':Sequelize[_0x81ac('0x4')]},'exitAt':{'type':Sequelize[_0x81ac('0x4')]},'reason':{'type':Sequelize[_0x81ac('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 8bc64ec..f216c3f 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 _0xad68=['attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','rawAttributes','filters','length','includeAll','find','create','body','params','describe','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','ChatQueueReport','fieldName','type','model','keys','query','intersection'];(function(_0x13a312,_0x1bbaad){var _0x305ca3=function(_0x58e13a){while(--_0x58e13a){_0x13a312['push'](_0x13a312['shift']());}};_0x305ca3(++_0x1bbaad);}(_0xad68,0x100));var _0x8ad6=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0xad68[_0x3e0b8f];return _0x22f742;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8ad6('0x0'));var jsonpatch=require(_0x8ad6('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8ad6('0x2'));var Mustache=require(_0x8ad6('0x3'));var util=require(_0x8ad6('0x4'));var path=require(_0x8ad6('0x5'));var sox=require(_0x8ad6('0x6'));var csv=require(_0x8ad6('0x7'));var ejs=require(_0x8ad6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ad6('0x9'));var squel=require(_0x8ad6('0xa'));var crypto=require(_0x8ad6('0xb'));var jsforce=require(_0x8ad6('0xc'));var deskjs=require(_0x8ad6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ad6('0xe'));var Redis=require(_0x8ad6('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8ad6('0x10'));var hardwareService=require(_0x8ad6('0x11'));var logger=require(_0x8ad6('0x12'))(_0x8ad6('0x13'));var utils=require(_0x8ad6('0x14'));var config=require(_0x8ad6('0x15'));var licenseUtil=require(_0x8ad6('0x16'));var db=require(_0x8ad6('0x17'))['db'];function respondWithStatusCode(_0x5ea9e2,_0x3d0252){_0x3d0252=_0x3d0252||0xcc;return function(_0x4b8041){if(_0x4b8041){return _0x5ea9e2['sendStatus'](_0x3d0252);}return _0x5ea9e2[_0x8ad6('0x18')](_0x3d0252)['end']();};}function respondWithResult(_0x329fca,_0x50179e){_0x50179e=_0x50179e||0xc8;return function(_0x307afc){if(_0x307afc){return _0x329fca[_0x8ad6('0x18')](_0x50179e)[_0x8ad6('0x19')](_0x307afc);}};}function respondWithFilteredResult(_0x5bbfb6,_0x45e709){return function(_0x1fed01){if(_0x1fed01){var _0x37a7f0=typeof _0x45e709[_0x8ad6('0x1a')]===_0x8ad6('0x1b')&&typeof _0x45e709[_0x8ad6('0x1c')]===_0x8ad6('0x1b');var _0x2e9a2e=_0x1fed01['count'];var _0x8ca3e3=_0x37a7f0?0x0:_0x45e709[_0x8ad6('0x1a')];var _0x29e6a6=_0x37a7f0?_0x1fed01[_0x8ad6('0x1d')]:_0x45e709[_0x8ad6('0x1a')]+_0x45e709[_0x8ad6('0x1c')];var _0x144b50;if(_0x29e6a6>=_0x2e9a2e){_0x29e6a6=_0x2e9a2e;_0x144b50=0xc8;}else{_0x144b50=0xce;}_0x5bbfb6['status'](_0x144b50);return _0x5bbfb6[_0x8ad6('0x1e')](_0x8ad6('0x1f'),_0x8ca3e3+'-'+_0x29e6a6+'/'+_0x2e9a2e)[_0x8ad6('0x19')](_0x1fed01);}return null;};}function patchUpdates(_0x52f4ab){return function(_0x47086a){try{jsonpatch[_0x8ad6('0x20')](_0x47086a,_0x52f4ab,!![]);}catch(_0x3074e7){return BPromise[_0x8ad6('0x21')](_0x3074e7);}return _0x47086a[_0x8ad6('0x22')]();};}function saveUpdates(_0x46f5bf,_0x42f18b){return function(_0x5edc1){if(_0x5edc1){return _0x5edc1[_0x8ad6('0x23')](_0x46f5bf)['then'](function(_0x47af23){return _0x47af23;});}return null;};}function removeEntity(_0x2762e7,_0x351267){return function(_0x558430){if(_0x558430){return _0x558430[_0x8ad6('0x24')]()[_0x8ad6('0x25')](function(){_0x2762e7[_0x8ad6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54adf7,_0x4795d8){return function(_0x850dc6){if(!_0x850dc6){_0x54adf7[_0x8ad6('0x26')](0x194);}return _0x850dc6;};}function handleError(_0xf0a55f,_0x2e4cf7){_0x2e4cf7=_0x2e4cf7||0x1f4;return function(_0x1c79c9){logger[_0x8ad6('0x27')](_0x1c79c9[_0x8ad6('0x28')]);if(_0x1c79c9[_0x8ad6('0x29')]){delete _0x1c79c9[_0x8ad6('0x29')];}_0xf0a55f[_0x8ad6('0x18')](_0x2e4cf7)[_0x8ad6('0x2a')](_0x1c79c9);};}exports[_0x8ad6('0x2b')]=function(_0x303f6a,_0x371f2b){var _0x34f567={},_0x24a2fa={},_0xaabe95={'count':0x0,'rows':[]};var _0x3c2092=_[_0x8ad6('0x2c')](db[_0x8ad6('0x2d')]['rawAttributes'],function(_0x3dfedd){return{'name':_0x3dfedd[_0x8ad6('0x2e')],'type':_0x3dfedd[_0x8ad6('0x2f')]['key']};});_0x24a2fa[_0x8ad6('0x30')]=_['map'](_0x3c2092,'name');_0x24a2fa['query']=_[_0x8ad6('0x31')](_0x303f6a[_0x8ad6('0x32')]);_0x24a2fa['filters']=_[_0x8ad6('0x33')](_0x24a2fa[_0x8ad6('0x30')],_0x24a2fa[_0x8ad6('0x32')]);_0x34f567[_0x8ad6('0x34')]=_[_0x8ad6('0x33')](_0x24a2fa['model'],qs[_0x8ad6('0x35')](_0x303f6a[_0x8ad6('0x32')]['fields']));_0x34f567[_0x8ad6('0x34')]=_0x34f567['attributes']['length']?_0x34f567[_0x8ad6('0x34')]:_0x24a2fa[_0x8ad6('0x30')];if(!_0x303f6a['query'][_0x8ad6('0x36')](_0x8ad6('0x37'))){_0x34f567[_0x8ad6('0x1c')]=qs[_0x8ad6('0x1c')](_0x303f6a['query'][_0x8ad6('0x1c')]);_0x34f567[_0x8ad6('0x1a')]=qs[_0x8ad6('0x1a')](_0x303f6a[_0x8ad6('0x32')]['offset']);}_0x34f567['order']=qs[_0x8ad6('0x38')](_0x303f6a[_0x8ad6('0x32')][_0x8ad6('0x38')]);_0x34f567['where']=qs['filters'](_[_0x8ad6('0x39')](_0x303f6a[_0x8ad6('0x32')],_0x24a2fa['filters']),_0x3c2092);if(_0x303f6a[_0x8ad6('0x32')][_0x8ad6('0x3a')]){_0x34f567['where']=_[_0x8ad6('0x3b')](_0x34f567['where'],{'$or':_[_0x8ad6('0x2c')](_0x3c2092,function(_0x552754){if(_0x552754[_0x8ad6('0x2f')]!==_0x8ad6('0x3c')){var _0x4dd3ec={};_0x4dd3ec[_0x552754[_0x8ad6('0x29')]]={'$like':'%'+_0x303f6a['query']['filter']+'%'};return _0x4dd3ec;}})});}_0x34f567=_[_0x8ad6('0x3b')]({},_0x34f567,_0x303f6a[_0x8ad6('0x3d')]);var _0x17da1c={'where':_0x34f567[_0x8ad6('0x3e')]};return db[_0x8ad6('0x2d')][_0x8ad6('0x1d')](_0x17da1c)[_0x8ad6('0x25')](function(_0x341c76){_0xaabe95['count']=_0x341c76;if(_0x303f6a[_0x8ad6('0x32')]['includeAll']){_0x34f567[_0x8ad6('0x3f')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x8ad6('0x40')](_0x34f567);})[_0x8ad6('0x25')](function(_0x27fea){_0xaabe95[_0x8ad6('0x41')]=_0x27fea;return _0xaabe95;})['then'](respondWithFilteredResult(_0x371f2b,_0x34f567))[_0x8ad6('0x42')](handleError(_0x371f2b,null));};exports[_0x8ad6('0x43')]=function(_0x2eb7be,_0x233cac){var _0x2ccbed={'raw':!![],'where':{'id':_0x2eb7be['params']['id']}},_0x5deb79={};_0x5deb79[_0x8ad6('0x30')]=_[_0x8ad6('0x31')](db[_0x8ad6('0x2d')][_0x8ad6('0x44')]);_0x5deb79[_0x8ad6('0x32')]=_[_0x8ad6('0x31')](_0x2eb7be[_0x8ad6('0x32')]);_0x5deb79[_0x8ad6('0x45')]=_[_0x8ad6('0x33')](_0x5deb79[_0x8ad6('0x30')],_0x5deb79['query']);_0x2ccbed[_0x8ad6('0x34')]=_[_0x8ad6('0x33')](_0x5deb79[_0x8ad6('0x30')],qs[_0x8ad6('0x35')](_0x2eb7be[_0x8ad6('0x32')][_0x8ad6('0x35')]));_0x2ccbed[_0x8ad6('0x34')]=_0x2ccbed[_0x8ad6('0x34')][_0x8ad6('0x46')]?_0x2ccbed['attributes']:_0x5deb79[_0x8ad6('0x30')];if(_0x2eb7be[_0x8ad6('0x32')][_0x8ad6('0x47')]){_0x2ccbed['include']=[{'all':!![]}];}_0x2ccbed=_['merge']({},_0x2ccbed,_0x2eb7be[_0x8ad6('0x3d')]);return db[_0x8ad6('0x2d')][_0x8ad6('0x48')](_0x2ccbed)[_0x8ad6('0x25')](handleEntityNotFound(_0x233cac,null))[_0x8ad6('0x25')](respondWithResult(_0x233cac,null))[_0x8ad6('0x42')](handleError(_0x233cac,null));};exports[_0x8ad6('0x49')]=function(_0x50e7bc,_0x5ce092){return db[_0x8ad6('0x2d')][_0x8ad6('0x49')](_0x50e7bc[_0x8ad6('0x4a')],{})[_0x8ad6('0x25')](respondWithResult(_0x5ce092,0xc9))[_0x8ad6('0x42')](handleError(_0x5ce092,null));};exports[_0x8ad6('0x23')]=function(_0x438612,_0x52c1ca){if(_0x438612['body']['id']){delete _0x438612[_0x8ad6('0x4a')]['id'];}return db[_0x8ad6('0x2d')][_0x8ad6('0x48')]({'where':{'id':_0x438612['params']['id']}})['then'](handleEntityNotFound(_0x52c1ca,null))['then'](saveUpdates(_0x438612['body'],null))[_0x8ad6('0x25')](respondWithResult(_0x52c1ca,null))['catch'](handleError(_0x52c1ca,null));};exports[_0x8ad6('0x24')]=function(_0x72ce3b,_0x4acba7){return db[_0x8ad6('0x2d')][_0x8ad6('0x48')]({'where':{'id':_0x72ce3b[_0x8ad6('0x4b')]['id']}})[_0x8ad6('0x25')](handleEntityNotFound(_0x4acba7,null))['then'](removeEntity(_0x4acba7,null))[_0x8ad6('0x42')](handleError(_0x4acba7,null));};exports['describe']=function(_0xc8a5b,_0x114f5b){return db[_0x8ad6('0x2d')][_0x8ad6('0x4c')]()[_0x8ad6('0x25')](respondWithResult(_0x114f5b,null))[_0x8ad6('0x42')](handleError(_0x114f5b,null));}; \ No newline at end of file +var _0x2675=['limit','count','Content-Range','json','apply','reject','destroy','then','error','name','send','index','map','ChatQueueReport','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','rawAttributes','length','options','find','create','body','update','params','describe','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x3ee070,_0x3c962b){var _0x31501c=function(_0x1233dc){while(--_0x1233dc){_0x3ee070['push'](_0x3ee070['shift']());}};_0x31501c(++_0x3c962b);}(_0x2675,0x75));var _0x5267=function(_0x5a1f87,_0x132b85){_0x5a1f87=_0x5a1f87-0x0;var _0x25ba1f=_0x2675[_0x5a1f87];return _0x25ba1f;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];function respondWithStatusCode(_0x1f9be3,_0x1d7090){_0x1d7090=_0x1d7090||0xcc;return function(_0x1171b9){if(_0x1171b9){return _0x1f9be3[_0x5267('0x16')](_0x1d7090);}return _0x1f9be3[_0x5267('0x17')](_0x1d7090)[_0x5267('0x18')]();};}function respondWithResult(_0x1e2d3b,_0x16e5a7){_0x16e5a7=_0x16e5a7||0xc8;return function(_0x29349a){if(_0x29349a){return _0x1e2d3b[_0x5267('0x17')](_0x16e5a7)['json'](_0x29349a);}};}function respondWithFilteredResult(_0x52e24e,_0xa593fb){return function(_0x40d897){if(_0x40d897){var _0x38a147=typeof _0xa593fb[_0x5267('0x19')]===_0x5267('0x1a')&&typeof _0xa593fb[_0x5267('0x1b')]===_0x5267('0x1a');var _0x6831e0=_0x40d897[_0x5267('0x1c')];var _0xb1c97a=_0x38a147?0x0:_0xa593fb[_0x5267('0x19')];var _0x1ab03=_0x38a147?_0x40d897['count']:_0xa593fb[_0x5267('0x19')]+_0xa593fb[_0x5267('0x1b')];var _0x5069e8;if(_0x1ab03>=_0x6831e0){_0x1ab03=_0x6831e0;_0x5069e8=0xc8;}else{_0x5069e8=0xce;}_0x52e24e[_0x5267('0x17')](_0x5069e8);return _0x52e24e['set'](_0x5267('0x1d'),_0xb1c97a+'-'+_0x1ab03+'/'+_0x6831e0)[_0x5267('0x1e')](_0x40d897);}return null;};}function patchUpdates(_0x39c0c3){return function(_0x2a9f99){try{jsonpatch[_0x5267('0x1f')](_0x2a9f99,_0x39c0c3,!![]);}catch(_0x4dd637){return BPromise[_0x5267('0x20')](_0x4dd637);}return _0x2a9f99['save']();};}function saveUpdates(_0xa32663,_0x420fb8){return function(_0x3b53ac){if(_0x3b53ac){return _0x3b53ac['update'](_0xa32663)['then'](function(_0x5546e2){return _0x5546e2;});}return null;};}function removeEntity(_0x4a17c7,_0x5ea6a6){return function(_0x26c7f8){if(_0x26c7f8){return _0x26c7f8[_0x5267('0x21')]()[_0x5267('0x22')](function(){_0x4a17c7[_0x5267('0x17')](0xcc)[_0x5267('0x18')]();});}};}function handleEntityNotFound(_0x40d1be,_0x126a97){return function(_0x220e03){if(!_0x220e03){_0x40d1be[_0x5267('0x16')](0x194);}return _0x220e03;};}function handleError(_0x59f112,_0x5cb64f){_0x5cb64f=_0x5cb64f||0x1f4;return function(_0x354111){logger[_0x5267('0x23')](_0x354111['stack']);if(_0x354111[_0x5267('0x24')]){delete _0x354111['name'];}_0x59f112['status'](_0x5cb64f)[_0x5267('0x25')](_0x354111);};}exports[_0x5267('0x26')]=function(_0x1f33b7,_0x2d2ace){var _0x33c431={},_0x4f3d4d={},_0x5e87eb={'count':0x0,'rows':[]};var _0x18020c=_[_0x5267('0x27')](db[_0x5267('0x28')]['rawAttributes'],function(_0x58d685){return{'name':_0x58d685[_0x5267('0x29')],'type':_0x58d685[_0x5267('0x2a')][_0x5267('0x2b')]};});_0x4f3d4d['model']=_['map'](_0x18020c,_0x5267('0x24'));_0x4f3d4d[_0x5267('0x2c')]=_[_0x5267('0x2d')](_0x1f33b7[_0x5267('0x2c')]);_0x4f3d4d['filters']=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],_0x4f3d4d[_0x5267('0x2c')]);_0x33c431[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],qs[_0x5267('0x31')](_0x1f33b7[_0x5267('0x2c')]['fields']));_0x33c431['attributes']=_0x33c431[_0x5267('0x30')]['length']?_0x33c431[_0x5267('0x30')]:_0x4f3d4d[_0x5267('0x2f')];if(!_0x1f33b7[_0x5267('0x2c')][_0x5267('0x32')]('nolimit')){_0x33c431[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x1b')]);_0x33c431[_0x5267('0x19')]=qs[_0x5267('0x19')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x19')]);}_0x33c431['order']=qs[_0x5267('0x33')](_0x1f33b7['query'][_0x5267('0x33')]);_0x33c431[_0x5267('0x34')]=qs[_0x5267('0x35')](_[_0x5267('0x36')](_0x1f33b7[_0x5267('0x2c')],_0x4f3d4d[_0x5267('0x35')]),_0x18020c);if(_0x1f33b7[_0x5267('0x2c')]['filter']){_0x33c431[_0x5267('0x34')]=_[_0x5267('0x37')](_0x33c431[_0x5267('0x34')],{'$or':_[_0x5267('0x27')](_0x18020c,function(_0x82cea7){if(_0x82cea7[_0x5267('0x2a')]!==_0x5267('0x38')){var _0x487dfc={};_0x487dfc[_0x82cea7[_0x5267('0x24')]]={'$like':'%'+_0x1f33b7['query'][_0x5267('0x39')]+'%'};return _0x487dfc;}})});}_0x33c431=_['merge']({},_0x33c431,_0x1f33b7['options']);var _0x51bddd={'where':_0x33c431[_0x5267('0x34')]};return db['ChatQueueReport'][_0x5267('0x1c')](_0x51bddd)[_0x5267('0x22')](function(_0x3d4b19){_0x5e87eb[_0x5267('0x1c')]=_0x3d4b19;if(_0x1f33b7['query'][_0x5267('0x3a')]){_0x33c431[_0x5267('0x3b')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x33c431);})[_0x5267('0x22')](function(_0x560cdf){_0x5e87eb[_0x5267('0x3c')]=_0x560cdf;return _0x5e87eb;})[_0x5267('0x22')](respondWithFilteredResult(_0x2d2ace,_0x33c431))[_0x5267('0x3d')](handleError(_0x2d2ace,null));};exports[_0x5267('0x3e')]=function(_0x36d0f1,_0x3012cb){var _0x27add5={'raw':!![],'where':{'id':_0x36d0f1['params']['id']}},_0x5697b3={};_0x5697b3[_0x5267('0x2f')]=_['keys'](db[_0x5267('0x28')][_0x5267('0x3f')]);_0x5697b3['query']=_[_0x5267('0x2d')](_0x36d0f1[_0x5267('0x2c')]);_0x5697b3[_0x5267('0x35')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],_0x5697b3[_0x5267('0x2c')]);_0x27add5[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],qs['fields'](_0x36d0f1[_0x5267('0x2c')][_0x5267('0x31')]));_0x27add5[_0x5267('0x30')]=_0x27add5[_0x5267('0x30')][_0x5267('0x40')]?_0x27add5['attributes']:_0x5697b3[_0x5267('0x2f')];if(_0x36d0f1['query'][_0x5267('0x3a')]){_0x27add5['include']=[{'all':!![]}];}_0x27add5=_['merge']({},_0x27add5,_0x36d0f1[_0x5267('0x41')]);return db['ChatQueueReport'][_0x5267('0x42')](_0x27add5)[_0x5267('0x22')](handleEntityNotFound(_0x3012cb,null))[_0x5267('0x22')](respondWithResult(_0x3012cb,null))[_0x5267('0x3d')](handleError(_0x3012cb,null));};exports['create']=function(_0x12d6a8,_0x4ee826){return db['ChatQueueReport'][_0x5267('0x43')](_0x12d6a8[_0x5267('0x44')],{})['then'](respondWithResult(_0x4ee826,0xc9))['catch'](handleError(_0x4ee826,null));};exports[_0x5267('0x45')]=function(_0xe0439e,_0x3d2436){if(_0xe0439e[_0x5267('0x44')]['id']){delete _0xe0439e[_0x5267('0x44')]['id'];}return db[_0x5267('0x28')][_0x5267('0x42')]({'where':{'id':_0xe0439e[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x3d2436,null))[_0x5267('0x22')](saveUpdates(_0xe0439e[_0x5267('0x44')],null))[_0x5267('0x22')](respondWithResult(_0x3d2436,null))[_0x5267('0x3d')](handleError(_0x3d2436,null));};exports[_0x5267('0x21')]=function(_0x4f7f75,_0x8636d0){return db[_0x5267('0x28')][_0x5267('0x42')]({'where':{'id':_0x4f7f75['params']['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x8636d0,null))[_0x5267('0x22')](removeEntity(_0x8636d0,null))[_0x5267('0x3d')](handleError(_0x8636d0,null));};exports[_0x5267('0x47')]=function(_0x119546,_0x1457cf){return db['ChatQueueReport'][_0x5267('0x47')]()['then'](respondWithResult(_0x1457cf,null))[_0x5267('0x3d')](handleError(_0x1457cf,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 5738b54..2a39776 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x44caf4,_0x238750){var _0x117cad=function(_0x3e64c8){while(--_0x3e64c8){_0x44caf4['push'](_0x44caf4['shift']());}};_0x117cad(++_0x238750);}(_0xe706,0xa3));var _0x6e70=function(_0x26d678,_0x273258){_0x26d678=_0x26d678-0x0;var _0x4ad538=_0xe706[_0x26d678];return _0x4ad538;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x141f90,_0x1d15ac){var _0x12699f=function(_0x39255e){while(--_0x39255e){_0x141f90['push'](_0x141f90['shift']());}};_0x12699f(++_0x1d15ac);}(_0x757a,0xde));var _0xa757=function(_0xdf47c1,_0xeeec17){_0xdf47c1=_0xdf47c1-0x0;var _0x163912=_0x757a[_0xdf47c1];return _0x163912;};'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 a9201cf..4216c30 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 _0xee12=['request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','options','update','body','raw','where','attributes','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0xee12,0xc5));var _0x2ee1=function(_0x2205a2,_0x28f139){_0x2205a2=_0x2205a2-0x0;var _0x50008e=_0xee12[_0x2205a2];return _0x50008e;};'use strict';var _=require(_0x2ee1('0x0'));var util=require(_0x2ee1('0x1'));var moment=require(_0x2ee1('0x2'));var BPromise=require(_0x2ee1('0x3'));var rs=require(_0x2ee1('0x4'));var fs=require('fs');var Redis=require(_0x2ee1('0x5'));var db=require(_0x2ee1('0x6'))['db'];var utils=require(_0x2ee1('0x7'));var logger=require(_0x2ee1('0x8'))(_0x2ee1('0x9'));var config=require(_0x2ee1('0xa'));var jayson=require(_0x2ee1('0xb'));var client=jayson['client'][_0x2ee1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x28fd33,_0x1a14f4,_0x4ec243){return new BPromise(function(_0x32afaf,_0x790956){return client[_0x2ee1('0xd')](_0x28fd33,_0x4ec243)[_0x2ee1('0xe')](function(_0x31280d){logger[_0x2ee1('0xf')](_0x2ee1('0x10'),_0x1a14f4,_0x2ee1('0x11'));logger[_0x2ee1('0x12')](_0x2ee1('0x13'),_0x1a14f4,'request\x20sent',JSON[_0x2ee1('0x14')](_0x31280d));if(_0x31280d[_0x2ee1('0x15')]){if(_0x31280d['error']['code']===0x1f4){logger[_0x2ee1('0x15')]('ChatQueueReport,\x20%s,\x20%s',_0x1a14f4,_0x31280d[_0x2ee1('0x15')][_0x2ee1('0x16')]);return _0x790956(_0x31280d[_0x2ee1('0x15')][_0x2ee1('0x16')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x1a14f4,_0x31280d[_0x2ee1('0x15')][_0x2ee1('0x16')]);return _0x32afaf(_0x31280d[_0x2ee1('0x15')][_0x2ee1('0x16')]);}else{logger[_0x2ee1('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x1a14f4,_0x2ee1('0x11'));_0x32afaf(_0x31280d[_0x2ee1('0x17')][_0x2ee1('0x16')]);}})[_0x2ee1('0x18')](function(_0x9f4f8e){logger['error'](_0x2ee1('0x10'),_0x1a14f4,_0x9f4f8e);_0x790956(_0x9f4f8e);});});}exports[_0x2ee1('0x19')]=function(_0x4eedcd){var _0x2901ce=this;return new Promise(function(_0x46669a,_0x1c0d39){return db[_0x2ee1('0x1a')]['create'](_0x4eedcd['body'],{'raw':_0x4eedcd[_0x2ee1('0x1b')]?_0x4eedcd[_0x2ee1('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x2ee1('0xe')](function(_0x1c2be0){logger['info'](_0x2ee1('0x19'),_0x4eedcd);logger[_0x2ee1('0x12')](_0x2ee1('0x19'),_0x4eedcd,JSON['stringify'](_0x1c2be0));_0x46669a(_0x1c2be0);})['catch'](function(_0x46585f){logger[_0x2ee1('0x15')](_0x2ee1('0x19'),_0x46585f[_0x2ee1('0x16')],_0x4eedcd);_0x1c0d39(_0x2901ce[_0x2ee1('0x15')](0x1f4,_0x46585f['message']));});});};exports['UpdateChatQueueReport']=function(_0x4759a6){var _0x31644f=this;return new Promise(function(_0x2d07a1,_0x531ba3){return db[_0x2ee1('0x1a')][_0x2ee1('0x1c')](_0x4759a6[_0x2ee1('0x1d')],{'raw':_0x4759a6[_0x2ee1('0x1b')]?_0x4759a6[_0x2ee1('0x1b')][_0x2ee1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4759a6[_0x2ee1('0x1b')]?_0x4759a6['options'][_0x2ee1('0x1f')]||null:null,'attributes':_0x4759a6['options']?_0x4759a6['options'][_0x2ee1('0x20')]||null:null,'limit':_0x4759a6[_0x2ee1('0x1b')]?_0x4759a6['options'][_0x2ee1('0x21')]||null:null})['then'](function(_0x246fb7){logger[_0x2ee1('0xf')](_0x2ee1('0x22'),_0x4759a6);logger['debug'](_0x2ee1('0x22'),_0x4759a6,JSON[_0x2ee1('0x14')](_0x246fb7));_0x2d07a1(_0x246fb7);})[_0x2ee1('0x18')](function(_0x373fa5){logger[_0x2ee1('0x15')](_0x2ee1('0x22'),_0x373fa5['message'],_0x4759a6);_0x531ba3(_0x31644f['error'](0x1f4,_0x373fa5[_0x2ee1('0x16')]));});});}; \ No newline at end of file +var _0x4c55=['../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','UpdateChatQueueReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x4c55,0x107));var _0x54c5=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4c55[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x54c5('0x0'));var util=require(_0x54c5('0x1'));var moment=require('moment');var BPromise=require(_0x54c5('0x2'));var rs=require(_0x54c5('0x3'));var fs=require('fs');var Redis=require(_0x54c5('0x4'));var db=require(_0x54c5('0x5'))['db'];var utils=require(_0x54c5('0x6'));var logger=require(_0x54c5('0x7'))(_0x54c5('0x8'));var config=require(_0x54c5('0x9'));var jayson=require(_0x54c5('0xa'));var client=jayson[_0x54c5('0xb')][_0x54c5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xea8837,_0x2ef8a1,_0x418c80){return new BPromise(function(_0x593fa4,_0x17c13d){return client[_0x54c5('0xd')](_0xea8837,_0x418c80)[_0x54c5('0xe')](function(_0x1bbf5f){logger[_0x54c5('0xf')](_0x54c5('0x10'),_0x2ef8a1,'request\x20sent');logger[_0x54c5('0x11')](_0x54c5('0x12'),_0x2ef8a1,_0x54c5('0x13'),JSON[_0x54c5('0x14')](_0x1bbf5f));if(_0x1bbf5f[_0x54c5('0x15')]){if(_0x1bbf5f[_0x54c5('0x15')][_0x54c5('0x16')]===0x1f4){logger['error'](_0x54c5('0x10'),_0x2ef8a1,_0x1bbf5f[_0x54c5('0x15')]['message']);return _0x17c13d(_0x1bbf5f['error'][_0x54c5('0x17')]);}logger[_0x54c5('0x15')](_0x54c5('0x10'),_0x2ef8a1,_0x1bbf5f[_0x54c5('0x15')][_0x54c5('0x17')]);return _0x593fa4(_0x1bbf5f[_0x54c5('0x15')][_0x54c5('0x17')]);}else{logger[_0x54c5('0xf')](_0x54c5('0x10'),_0x2ef8a1,_0x54c5('0x13'));_0x593fa4(_0x1bbf5f['result'][_0x54c5('0x17')]);}})[_0x54c5('0x18')](function(_0x26072e){logger[_0x54c5('0x15')]('ChatQueueReport,\x20%s,\x20%s',_0x2ef8a1,_0x26072e);_0x17c13d(_0x26072e);});});}exports[_0x54c5('0x19')]=function(_0x4debc8){var _0x1875f8=this;return new Promise(function(_0x3a2242,_0x61771d){return db[_0x54c5('0x1a')][_0x54c5('0x1b')](_0x4debc8['body'],{'raw':_0x4debc8[_0x54c5('0x1c')]?_0x4debc8[_0x54c5('0x1c')][_0x54c5('0x1d')]===undefined?!![]:![]:!![]})[_0x54c5('0xe')](function(_0x5901e7){logger[_0x54c5('0xf')](_0x54c5('0x19'),_0x4debc8);logger[_0x54c5('0x11')](_0x54c5('0x19'),_0x4debc8,JSON[_0x54c5('0x14')](_0x5901e7));_0x3a2242(_0x5901e7);})[_0x54c5('0x18')](function(_0x4b85c8){logger[_0x54c5('0x15')]('CreateChatQueueReport',_0x4b85c8[_0x54c5('0x17')],_0x4debc8);_0x61771d(_0x1875f8[_0x54c5('0x15')](0x1f4,_0x4b85c8[_0x54c5('0x17')]));});});};exports[_0x54c5('0x1e')]=function(_0x125da9){var _0x23c011=this;return new Promise(function(_0x188891,_0x20b7ee){return db[_0x54c5('0x1a')][_0x54c5('0x1f')](_0x125da9['body'],{'raw':_0x125da9[_0x54c5('0x1c')]?_0x125da9['options'][_0x54c5('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x125da9[_0x54c5('0x1c')]?_0x125da9[_0x54c5('0x1c')]['where']||null:null,'attributes':_0x125da9['options']?_0x125da9['options'][_0x54c5('0x20')]||null:null,'limit':_0x125da9[_0x54c5('0x1c')]?_0x125da9[_0x54c5('0x1c')][_0x54c5('0x21')]||null:null})[_0x54c5('0xe')](function(_0x531662){logger[_0x54c5('0xf')]('UpdateChatQueueReport',_0x125da9);logger[_0x54c5('0x11')](_0x54c5('0x1e'),_0x125da9,JSON[_0x54c5('0x14')](_0x531662));_0x188891(_0x531662);})['catch'](function(_0x4ee236){logger[_0x54c5('0x15')](_0x54c5('0x1e'),_0x4ee236[_0x54c5('0x17')],_0x125da9);_0x20b7ee(_0x23c011[_0x54c5('0x15')](0x1f4,_0x4ee236[_0x54c5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index fa3b4b7..b6d1b98 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 _0x5b60=['/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','post','create','put'];(function(_0x22c44,_0x466cac){var _0xd02537=function(_0x196ab7){while(--_0x196ab7){_0x22c44['push'](_0x22c44['shift']());}};_0xd02537(++_0x466cac);}(_0x5b60,0x1eb));var _0x05b6=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x5b60[_0x2cf2e9];return _0xd3670d;};'use strict';var multer=require(_0x05b6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x05b6('0x1'));var express=require(_0x05b6('0x2'));var router=express[_0x05b6('0x3')]();var fs_extra=require(_0x05b6('0x4'));var auth=require(_0x05b6('0x5'));var interaction=require(_0x05b6('0x6'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x05b6('0x7')]('/',auth[_0x05b6('0x8')](),controller['index']);router['get'](_0x05b6('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x05b6('0x7')]('/:id',auth[_0x05b6('0x8')](),controller['show']);router[_0x05b6('0xa')]('/',auth[_0x05b6('0x8')](),controller[_0x05b6('0xb')]);router[_0x05b6('0xc')](_0x05b6('0xd'),auth[_0x05b6('0x8')](),controller[_0x05b6('0xe')]);router[_0x05b6('0xf')](_0x05b6('0xd'),auth['isAuthenticated'](),controller[_0x05b6('0x10')]);module[_0x05b6('0x11')]=router; \ No newline at end of file +var _0xa6ea=['get','isAuthenticated','index','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller'];(function(_0x401ad6,_0x392d17){var _0x159ef3=function(_0x33151c){while(--_0x33151c){_0x401ad6['push'](_0x401ad6['shift']());}};_0x159ef3(++_0x392d17);}(_0xa6ea,0x137));var _0xaa6e=function(_0x1e4b07,_0x44cbb5){_0x1e4b07=_0x1e4b07-0x0;var _0x292a27=_0xa6ea[_0x1e4b07];return _0x292a27;};'use strict';var multer=require(_0xaa6e('0x0'));var util=require(_0xaa6e('0x1'));var path=require(_0xaa6e('0x2'));var timeout=require(_0xaa6e('0x3'));var express=require('express');var router=express[_0xaa6e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaa6e('0x5'));var interaction=require(_0xaa6e('0x6'));var config=require(_0xaa6e('0x7'));var controller=require(_0xaa6e('0x8'));router[_0xaa6e('0x9')]('/',auth[_0xaa6e('0xa')](),controller[_0xaa6e('0xb')]);router[_0xaa6e('0x9')]('/describe',auth[_0xaa6e('0xa')](),controller[_0xaa6e('0xc')]);router[_0xaa6e('0x9')](_0xaa6e('0xd'),auth['isAuthenticated'](),controller[_0xaa6e('0xe')]);router[_0xaa6e('0xf')]('/',auth[_0xaa6e('0xa')](),controller['create']);router[_0xaa6e('0x10')]('/:id',auth[_0xaa6e('0xa')](),controller['update']);router[_0xaa6e('0x11')](_0xaa6e('0xd'),auth[_0xaa6e('0xa')](),controller[_0xaa6e('0x12')]);module[_0xaa6e('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 08da4ba..0f0fa79 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xf378e9,_0x13a065){var _0x8f5c42=function(_0x54a660){while(--_0x54a660){_0xf378e9['push'](_0xf378e9['shift']());}};_0x8f5c42(++_0x13a065);}(_0x70e0,0x17b));var _0x070e=function(_0x58ef8c,_0x3921af){_0x58ef8c=_0x58ef8c-0x0;var _0x5cc496=_0x70e0[_0x58ef8c];return _0x5cc496;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x2c9e08,_0x30077a){var _0x2f6a0b=function(_0x1b1f14){while(--_0x1b1f14){_0x2c9e08['push'](_0x2c9e08['shift']());}};_0x2f6a0b(++_0x30077a);}(_0xedd9,0xfc));var _0x9edd=function(_0xf386c8,_0x3108c5){_0xf386c8=_0xf386c8-0x0;var _0x27dccf=_0xedd9[_0xf386c8];return _0x27dccf;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 9d142a8..380d578 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 _0x31b9=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','end','stack','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x31b9,0xb4));var _0x931b=function(_0x1041db,_0x36cc68){_0x1041db=_0x1041db-0x0;var _0x1c82ad=_0x31b9[_0x1041db];return _0x1c82ad;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x931b('0x0'));var jsonpatch=require(_0x931b('0x1'));var rp=require(_0x931b('0x2'));var moment=require(_0x931b('0x3'));var BPromise=require(_0x931b('0x4'));var Mustache=require(_0x931b('0x5'));var util=require('util');var path=require(_0x931b('0x6'));var sox=require(_0x931b('0x7'));var csv=require('to-csv');var ejs=require(_0x931b('0x8'));var fs=require('fs');var fs_extra=require(_0x931b('0x9'));var _=require(_0x931b('0xa'));var squel=require(_0x931b('0xb'));var crypto=require(_0x931b('0xc'));var jsforce=require(_0x931b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x931b('0xe'));var querystring=require(_0x931b('0xf'));var Papa=require(_0x931b('0x10'));var Redis=require('ioredis');var authService=require(_0x931b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x931b('0x12'));var hardwareService=require(_0x931b('0x13'));var logger=require(_0x931b('0x14'))(_0x931b('0x15'));var utils=require(_0x931b('0x16'));var config=require(_0x931b('0x17'));var licenseUtil=require(_0x931b('0x18'));var db=require(_0x931b('0x19'))['db'];function respondWithStatusCode(_0x3dab4a,_0x38482f){_0x38482f=_0x38482f||0xcc;return function(_0x125dd2){if(_0x125dd2){return _0x3dab4a[_0x931b('0x1a')](_0x38482f);}return _0x3dab4a[_0x931b('0x1b')](_0x38482f)['end']();};}function respondWithResult(_0x519904,_0x5005f7){_0x5005f7=_0x5005f7||0xc8;return function(_0x225f82){if(_0x225f82){return _0x519904['status'](_0x5005f7)[_0x931b('0x1c')](_0x225f82);}};}function respondWithFilteredResult(_0x45b0c7,_0x4816f4){return function(_0x11ece7){if(_0x11ece7){var _0x362157=typeof _0x4816f4[_0x931b('0x1d')]===_0x931b('0x1e')&&typeof _0x4816f4[_0x931b('0x1f')]===_0x931b('0x1e');var _0x51dc1e=_0x11ece7[_0x931b('0x20')];var _0x5d5de5=_0x362157?0x0:_0x4816f4['offset'];var _0x3bd846=_0x362157?_0x11ece7['count']:_0x4816f4[_0x931b('0x1d')]+_0x4816f4[_0x931b('0x1f')];var _0x13ee7a;if(_0x3bd846>=_0x51dc1e){_0x3bd846=_0x51dc1e;_0x13ee7a=0xc8;}else{_0x13ee7a=0xce;}_0x45b0c7[_0x931b('0x1b')](_0x13ee7a);return _0x45b0c7[_0x931b('0x21')]('Content-Range',_0x5d5de5+'-'+_0x3bd846+'/'+_0x51dc1e)[_0x931b('0x1c')](_0x11ece7);}return null;};}function patchUpdates(_0x58e33d){return function(_0x2eef49){try{jsonpatch['apply'](_0x2eef49,_0x58e33d,!![]);}catch(_0x480a67){return BPromise[_0x931b('0x22')](_0x480a67);}return _0x2eef49[_0x931b('0x23')]();};}function saveUpdates(_0x22b39a,_0x1d8627){return function(_0x404f70){if(_0x404f70){return _0x404f70[_0x931b('0x24')](_0x22b39a)['then'](function(_0x499c62){return _0x499c62;});}return null;};}function removeEntity(_0x49c456,_0x5d6e88){return function(_0x3ce80a){if(_0x3ce80a){return _0x3ce80a[_0x931b('0x25')]()[_0x931b('0x26')](function(){_0x49c456[_0x931b('0x1b')](0xcc)[_0x931b('0x27')]();});}};}function handleEntityNotFound(_0x1ad0e4,_0x36dc59){return function(_0x1621be){if(!_0x1621be){_0x1ad0e4[_0x931b('0x1a')](0x194);}return _0x1621be;};}function handleError(_0x3b6e22,_0xb16da6){_0xb16da6=_0xb16da6||0x1f4;return function(_0x4e2be2){logger['error'](_0x4e2be2[_0x931b('0x28')]);if(_0x4e2be2['name']){delete _0x4e2be2[_0x931b('0x29')];}_0x3b6e22[_0x931b('0x1b')](_0xb16da6)[_0x931b('0x2a')](_0x4e2be2);};}exports[_0x931b('0x2b')]=function(_0x1b2fdf,_0x5f44df){var _0x1e3b17={},_0x43ef1f={},_0x42bbab={'count':0x0,'rows':[]};var _0x4f102b=_['map'](db[_0x931b('0x2c')][_0x931b('0x2d')],function(_0x590046){return{'name':_0x590046[_0x931b('0x2e')],'type':_0x590046[_0x931b('0x2f')][_0x931b('0x30')]};});_0x43ef1f[_0x931b('0x31')]=_[_0x931b('0x32')](_0x4f102b,_0x931b('0x29'));_0x43ef1f['query']=_[_0x931b('0x33')](_0x1b2fdf[_0x931b('0x34')]);_0x43ef1f[_0x931b('0x35')]=_[_0x931b('0x36')](_0x43ef1f[_0x931b('0x31')],_0x43ef1f[_0x931b('0x34')]);_0x1e3b17[_0x931b('0x37')]=_[_0x931b('0x36')](_0x43ef1f['model'],qs[_0x931b('0x38')](_0x1b2fdf['query'][_0x931b('0x38')]));_0x1e3b17[_0x931b('0x37')]=_0x1e3b17[_0x931b('0x37')][_0x931b('0x39')]?_0x1e3b17[_0x931b('0x37')]:_0x43ef1f[_0x931b('0x31')];if(!_0x1b2fdf[_0x931b('0x34')][_0x931b('0x3a')](_0x931b('0x3b'))){_0x1e3b17[_0x931b('0x1f')]=qs[_0x931b('0x1f')](_0x1b2fdf['query'][_0x931b('0x1f')]);_0x1e3b17[_0x931b('0x1d')]=qs[_0x931b('0x1d')](_0x1b2fdf[_0x931b('0x34')]['offset']);}_0x1e3b17[_0x931b('0x3c')]=qs[_0x931b('0x3d')](_0x1b2fdf[_0x931b('0x34')][_0x931b('0x3d')]);_0x1e3b17[_0x931b('0x3e')]=qs[_0x931b('0x35')](_[_0x931b('0x3f')](_0x1b2fdf[_0x931b('0x34')],_0x43ef1f['filters']),_0x4f102b);if(_0x1b2fdf['query'][_0x931b('0x40')]){_0x1e3b17['where']=_[_0x931b('0x41')](_0x1e3b17['where'],{'$or':_[_0x931b('0x32')](_0x4f102b,function(_0x52bfbc){if(_0x52bfbc[_0x931b('0x2f')]!==_0x931b('0x42')){var _0x29dbd5={};_0x29dbd5[_0x52bfbc[_0x931b('0x29')]]={'$like':'%'+_0x1b2fdf[_0x931b('0x34')]['filter']+'%'};return _0x29dbd5;}})});}_0x1e3b17=_[_0x931b('0x41')]({},_0x1e3b17,_0x1b2fdf['options']);var _0x2a82b2={'where':_0x1e3b17[_0x931b('0x3e')]};return db[_0x931b('0x2c')][_0x931b('0x20')](_0x2a82b2)['then'](function(_0x2f8398){_0x42bbab['count']=_0x2f8398;if(_0x1b2fdf[_0x931b('0x34')][_0x931b('0x43')]){_0x1e3b17[_0x931b('0x44')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x931b('0x45')](_0x1e3b17);})[_0x931b('0x26')](function(_0x261391){_0x42bbab[_0x931b('0x46')]=_0x261391;return _0x42bbab;})['then'](respondWithFilteredResult(_0x5f44df,_0x1e3b17))[_0x931b('0x47')](handleError(_0x5f44df,null));};exports[_0x931b('0x48')]=function(_0x5494f9,_0x2288d1){var _0x33be6c={'raw':!![],'where':{'id':_0x5494f9[_0x931b('0x49')]['id']}},_0x1a26db={};_0x1a26db[_0x931b('0x31')]=_[_0x931b('0x33')](db[_0x931b('0x2c')][_0x931b('0x2d')]);_0x1a26db[_0x931b('0x34')]=_[_0x931b('0x33')](_0x5494f9['query']);_0x1a26db['filters']=_['intersection'](_0x1a26db[_0x931b('0x31')],_0x1a26db[_0x931b('0x34')]);_0x33be6c[_0x931b('0x37')]=_[_0x931b('0x36')](_0x1a26db[_0x931b('0x31')],qs[_0x931b('0x38')](_0x5494f9[_0x931b('0x34')][_0x931b('0x38')]));_0x33be6c['attributes']=_0x33be6c['attributes'][_0x931b('0x39')]?_0x33be6c['attributes']:_0x1a26db['model'];if(_0x5494f9['query'][_0x931b('0x43')]){_0x33be6c[_0x931b('0x44')]=[{'all':!![]}];}_0x33be6c=_[_0x931b('0x41')]({},_0x33be6c,_0x5494f9[_0x931b('0x4a')]);return db[_0x931b('0x2c')]['find'](_0x33be6c)[_0x931b('0x26')](handleEntityNotFound(_0x2288d1,null))[_0x931b('0x26')](respondWithResult(_0x2288d1,null))[_0x931b('0x47')](handleError(_0x2288d1,null));};exports[_0x931b('0x4b')]=function(_0x279819,_0x376f8b){return db[_0x931b('0x2c')][_0x931b('0x4b')](_0x279819[_0x931b('0x4c')],{})[_0x931b('0x26')](respondWithResult(_0x376f8b,0xc9))[_0x931b('0x47')](handleError(_0x376f8b,null));};exports['update']=function(_0x202f8a,_0xe2d5d7){if(_0x202f8a['body']['id']){delete _0x202f8a[_0x931b('0x4c')]['id'];}return db['ChatTransferReport'][_0x931b('0x4d')]({'where':{'id':_0x202f8a[_0x931b('0x49')]['id']}})[_0x931b('0x26')](handleEntityNotFound(_0xe2d5d7,null))[_0x931b('0x26')](saveUpdates(_0x202f8a[_0x931b('0x4c')],null))[_0x931b('0x26')](respondWithResult(_0xe2d5d7,null))['catch'](handleError(_0xe2d5d7,null));};exports[_0x931b('0x25')]=function(_0x3da14b,_0x1fb5ea){return db[_0x931b('0x2c')][_0x931b('0x4d')]({'where':{'id':_0x3da14b[_0x931b('0x49')]['id']}})[_0x931b('0x26')](handleEntityNotFound(_0x1fb5ea,null))['then'](removeEntity(_0x1fb5ea,null))[_0x931b('0x47')](handleError(_0x1fb5ea,null));};exports['describe']=function(_0x3e12b5,_0x45128c){return db['ChatTransferReport'][_0x931b('0x4e')]()[_0x931b('0x26')](respondWithResult(_0x45128c,null))[_0x931b('0x47')](handleError(_0x45128c,null));}; \ No newline at end of file +var _0x40da=['catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','ChatTransferReport','includeAll','findAll','show','params','include','find'];(function(_0x267d05,_0x41d22e){var _0xefea0a=function(_0x6be634){while(--_0x6be634){_0x267d05['push'](_0x267d05['shift']());}};_0xefea0a(++_0x41d22e);}(_0x40da,0x1cc));var _0xa40d=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x40da[_0x342baa];return _0x1208f3;};'use strict';var emlformat=require(_0xa40d('0x0'));var rimraf=require(_0xa40d('0x1'));var zipdir=require(_0xa40d('0x2'));var jsonpatch=require(_0xa40d('0x3'));var rp=require(_0xa40d('0x4'));var moment=require(_0xa40d('0x5'));var BPromise=require(_0xa40d('0x6'));var Mustache=require(_0xa40d('0x7'));var util=require('util');var path=require(_0xa40d('0x8'));var sox=require(_0xa40d('0x9'));var csv=require(_0xa40d('0xa'));var ejs=require(_0xa40d('0xb'));var fs=require('fs');var fs_extra=require(_0xa40d('0xc'));var _=require('lodash');var squel=require(_0xa40d('0xd'));var crypto=require('crypto');var jsforce=require(_0xa40d('0xe'));var deskjs=require(_0xa40d('0xf'));var toCsv=require(_0xa40d('0xa'));var querystring=require(_0xa40d('0x10'));var Papa=require(_0xa40d('0x11'));var Redis=require(_0xa40d('0x12'));var authService=require(_0xa40d('0x13'));var qs=require(_0xa40d('0x14'));var as=require(_0xa40d('0x15'));var hardwareService=require(_0xa40d('0x16'));var logger=require(_0xa40d('0x17'))(_0xa40d('0x18'));var utils=require(_0xa40d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xa40d('0x1a'));var db=require(_0xa40d('0x1b'))['db'];function respondWithStatusCode(_0x3ef99d,_0x2d047a){_0x2d047a=_0x2d047a||0xcc;return function(_0xca3850){if(_0xca3850){return _0x3ef99d[_0xa40d('0x1c')](_0x2d047a);}return _0x3ef99d[_0xa40d('0x1d')](_0x2d047a)[_0xa40d('0x1e')]();};}function respondWithResult(_0x4a31db,_0xd5ecf2){_0xd5ecf2=_0xd5ecf2||0xc8;return function(_0x43e74d){if(_0x43e74d){return _0x4a31db[_0xa40d('0x1d')](_0xd5ecf2)[_0xa40d('0x1f')](_0x43e74d);}};}function respondWithFilteredResult(_0x364c33,_0x1d12ba){return function(_0x3c5e2){if(_0x3c5e2){var _0x195ee4=typeof _0x1d12ba[_0xa40d('0x20')]===_0xa40d('0x21')&&typeof _0x1d12ba[_0xa40d('0x22')]===_0xa40d('0x21');var _0x5806fd=_0x3c5e2[_0xa40d('0x23')];var _0xa3a10a=_0x195ee4?0x0:_0x1d12ba[_0xa40d('0x20')];var _0x389420=_0x195ee4?_0x3c5e2['count']:_0x1d12ba['offset']+_0x1d12ba[_0xa40d('0x22')];var _0x19c2a6;if(_0x389420>=_0x5806fd){_0x389420=_0x5806fd;_0x19c2a6=0xc8;}else{_0x19c2a6=0xce;}_0x364c33[_0xa40d('0x1d')](_0x19c2a6);return _0x364c33[_0xa40d('0x24')]('Content-Range',_0xa3a10a+'-'+_0x389420+'/'+_0x5806fd)[_0xa40d('0x1f')](_0x3c5e2);}return null;};}function patchUpdates(_0x458234){return function(_0x4ed15d){try{jsonpatch[_0xa40d('0x25')](_0x4ed15d,_0x458234,!![]);}catch(_0x4d2e6f){return BPromise[_0xa40d('0x26')](_0x4d2e6f);}return _0x4ed15d['save']();};}function saveUpdates(_0x388be8,_0x3d00e3){return function(_0x29d31d){if(_0x29d31d){return _0x29d31d[_0xa40d('0x27')](_0x388be8)[_0xa40d('0x28')](function(_0x5a2a27){return _0x5a2a27;});}return null;};}function removeEntity(_0x323eee,_0x36046a){return function(_0x365d29){if(_0x365d29){return _0x365d29['destroy']()[_0xa40d('0x28')](function(){_0x323eee[_0xa40d('0x1d')](0xcc)[_0xa40d('0x1e')]();});}};}function handleEntityNotFound(_0x5a9f34,_0x1c5e00){return function(_0x235ea6){if(!_0x235ea6){_0x5a9f34[_0xa40d('0x1c')](0x194);}return _0x235ea6;};}function handleError(_0x55daf1,_0x2c7216){_0x2c7216=_0x2c7216||0x1f4;return function(_0x5b3b8b){logger[_0xa40d('0x29')](_0x5b3b8b[_0xa40d('0x2a')]);if(_0x5b3b8b[_0xa40d('0x2b')]){delete _0x5b3b8b[_0xa40d('0x2b')];}_0x55daf1[_0xa40d('0x1d')](_0x2c7216)['send'](_0x5b3b8b);};}exports[_0xa40d('0x2c')]=function(_0x188211,_0x5ab846){var _0x2a8f40={},_0x11102d={},_0x13afc7={'count':0x0,'rows':[]};var _0x1152ac=_[_0xa40d('0x2d')](db['ChatTransferReport'][_0xa40d('0x2e')],function(_0xd264bf){return{'name':_0xd264bf[_0xa40d('0x2f')],'type':_0xd264bf[_0xa40d('0x30')]['key']};});_0x11102d[_0xa40d('0x31')]=_['map'](_0x1152ac,_0xa40d('0x2b'));_0x11102d[_0xa40d('0x32')]=_['keys'](_0x188211[_0xa40d('0x32')]);_0x11102d['filters']=_[_0xa40d('0x33')](_0x11102d[_0xa40d('0x31')],_0x11102d[_0xa40d('0x32')]);_0x2a8f40[_0xa40d('0x34')]=_[_0xa40d('0x33')](_0x11102d[_0xa40d('0x31')],qs['fields'](_0x188211[_0xa40d('0x32')][_0xa40d('0x35')]));_0x2a8f40[_0xa40d('0x34')]=_0x2a8f40[_0xa40d('0x34')][_0xa40d('0x36')]?_0x2a8f40[_0xa40d('0x34')]:_0x11102d[_0xa40d('0x31')];if(!_0x188211[_0xa40d('0x32')][_0xa40d('0x37')](_0xa40d('0x38'))){_0x2a8f40[_0xa40d('0x22')]=qs[_0xa40d('0x22')](_0x188211['query'][_0xa40d('0x22')]);_0x2a8f40[_0xa40d('0x20')]=qs['offset'](_0x188211[_0xa40d('0x32')]['offset']);}_0x2a8f40[_0xa40d('0x39')]=qs[_0xa40d('0x3a')](_0x188211[_0xa40d('0x32')][_0xa40d('0x3a')]);_0x2a8f40[_0xa40d('0x3b')]=qs[_0xa40d('0x3c')](_[_0xa40d('0x3d')](_0x188211[_0xa40d('0x32')],_0x11102d[_0xa40d('0x3c')]),_0x1152ac);if(_0x188211[_0xa40d('0x32')][_0xa40d('0x3e')]){_0x2a8f40[_0xa40d('0x3b')]=_['merge'](_0x2a8f40[_0xa40d('0x3b')],{'$or':_[_0xa40d('0x2d')](_0x1152ac,function(_0x1c4c65){if(_0x1c4c65[_0xa40d('0x30')]!=='VIRTUAL'){var _0x33a9e9={};_0x33a9e9[_0x1c4c65[_0xa40d('0x2b')]]={'$like':'%'+_0x188211['query']['filter']+'%'};return _0x33a9e9;}})});}_0x2a8f40=_[_0xa40d('0x3f')]({},_0x2a8f40,_0x188211[_0xa40d('0x40')]);var _0x18af58={'where':_0x2a8f40[_0xa40d('0x3b')]};return db[_0xa40d('0x41')][_0xa40d('0x23')](_0x18af58)['then'](function(_0x3aa395){_0x13afc7[_0xa40d('0x23')]=_0x3aa395;if(_0x188211['query'][_0xa40d('0x42')]){_0x2a8f40['include']=[{'all':!![]}];}return db[_0xa40d('0x41')][_0xa40d('0x43')](_0x2a8f40);})[_0xa40d('0x28')](function(_0x42d6de){_0x13afc7['rows']=_0x42d6de;return _0x13afc7;})[_0xa40d('0x28')](respondWithFilteredResult(_0x5ab846,_0x2a8f40))['catch'](handleError(_0x5ab846,null));};exports[_0xa40d('0x44')]=function(_0x1767eb,_0x3e4ac0){var _0x1a9b15={'raw':!![],'where':{'id':_0x1767eb[_0xa40d('0x45')]['id']}},_0x583398={};_0x583398['model']=_['keys'](db[_0xa40d('0x41')][_0xa40d('0x2e')]);_0x583398[_0xa40d('0x32')]=_['keys'](_0x1767eb[_0xa40d('0x32')]);_0x583398['filters']=_[_0xa40d('0x33')](_0x583398[_0xa40d('0x31')],_0x583398[_0xa40d('0x32')]);_0x1a9b15['attributes']=_[_0xa40d('0x33')](_0x583398[_0xa40d('0x31')],qs[_0xa40d('0x35')](_0x1767eb[_0xa40d('0x32')]['fields']));_0x1a9b15[_0xa40d('0x34')]=_0x1a9b15['attributes'][_0xa40d('0x36')]?_0x1a9b15['attributes']:_0x583398[_0xa40d('0x31')];if(_0x1767eb[_0xa40d('0x32')][_0xa40d('0x42')]){_0x1a9b15[_0xa40d('0x46')]=[{'all':!![]}];}_0x1a9b15=_['merge']({},_0x1a9b15,_0x1767eb['options']);return db[_0xa40d('0x41')][_0xa40d('0x47')](_0x1a9b15)['then'](handleEntityNotFound(_0x3e4ac0,null))[_0xa40d('0x28')](respondWithResult(_0x3e4ac0,null))[_0xa40d('0x48')](handleError(_0x3e4ac0,null));};exports[_0xa40d('0x49')]=function(_0x287315,_0x1dd6f2){return db[_0xa40d('0x41')][_0xa40d('0x49')](_0x287315['body'],{})[_0xa40d('0x28')](respondWithResult(_0x1dd6f2,0xc9))[_0xa40d('0x48')](handleError(_0x1dd6f2,null));};exports[_0xa40d('0x27')]=function(_0x5761cb,_0x21df2a){if(_0x5761cb[_0xa40d('0x4a')]['id']){delete _0x5761cb[_0xa40d('0x4a')]['id'];}return db[_0xa40d('0x41')][_0xa40d('0x47')]({'where':{'id':_0x5761cb[_0xa40d('0x45')]['id']}})[_0xa40d('0x28')](handleEntityNotFound(_0x21df2a,null))[_0xa40d('0x28')](saveUpdates(_0x5761cb[_0xa40d('0x4a')],null))[_0xa40d('0x28')](respondWithResult(_0x21df2a,null))['catch'](handleError(_0x21df2a,null));};exports['destroy']=function(_0xe57c,_0x169d95){return db[_0xa40d('0x41')][_0xa40d('0x47')]({'where':{'id':_0xe57c[_0xa40d('0x45')]['id']}})[_0xa40d('0x28')](handleEntityNotFound(_0x169d95,null))[_0xa40d('0x28')](removeEntity(_0x169d95,null))[_0xa40d('0x48')](handleError(_0x169d95,null));};exports[_0xa40d('0x4b')]=function(_0x152a61,_0x22466d){return db[_0xa40d('0x41')][_0xa40d('0x4b')]()[_0xa40d('0x28')](respondWithResult(_0x22466d,null))[_0xa40d('0x48')](handleError(_0x22466d,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 8efea23..0604832 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 _0xe655=['../../config/environment','exports','define','ChatTransferReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2ca3d8,_0xf83cb8){var _0x2639d9=function(_0x5ee2bc){while(--_0x5ee2bc){_0x2ca3d8['push'](_0x2ca3d8['shift']());}};_0x2639d9(++_0xf83cb8);}(_0xe655,0xe2));var _0x5e65=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe655[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5e65('0x0'));var util=require(_0x5e65('0x1'));var logger=require('../../config/logger')(_0x5e65('0x2'));var moment=require(_0x5e65('0x3'));var BPromise=require(_0x5e65('0x4'));var rp=require(_0x5e65('0x5'));var fs=require('fs');var path=require(_0x5e65('0x6'));var rimraf=require(_0x5e65('0x7'));var config=require(_0x5e65('0x8'));var attributes=require('./chatTransferReport.attributes');module[_0x5e65('0x9')]=function(_0x49eb8f,_0x25d439){return _0x49eb8f[_0x5e65('0xa')](_0x5e65('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x5e65('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb100=['report_chat_transfer','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb100,0x76));var _0x0b10=function(_0x3a121b,_0x16de2b){_0x3a121b=_0x3a121b-0x0;var _0x16958e=_0xb100[_0x3a121b];return _0x16958e;};'use strict';var _=require(_0x0b10('0x0'));var util=require(_0x0b10('0x1'));var logger=require(_0x0b10('0x2'))(_0x0b10('0x3'));var moment=require(_0x0b10('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b10('0x5'));var rimraf=require(_0x0b10('0x6'));var config=require(_0x0b10('0x7'));var attributes=require(_0x0b10('0x8'));module[_0x0b10('0x9')]=function(_0xcf9d41,_0xbda4f3){return _0xcf9d41[_0x0b10('0xa')](_0x0b10('0xb'),attributes,{'tableName':_0x0b10('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','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 2b93b97..b1c7f7b 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 _0xbae9=['../../config/environment','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5610c6,_0x1af83c){var _0x1b5ccb=function(_0x28ec20){while(--_0x28ec20){_0x5610c6['push'](_0x5610c6['shift']());}};_0x1b5ccb(++_0x1af83c);}(_0xbae9,0x101));var _0x9bae=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xbae9[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x9bae('0x0'));var util=require(_0x9bae('0x1'));var moment=require('moment');var BPromise=require(_0x9bae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bae('0x3'))['db'];var utils=require(_0x9bae('0x4'));var logger=require(_0x9bae('0x5'))(_0x9bae('0x6'));var config=require(_0x9bae('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9bae('0x8')][_0x9bae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x379d7b,_0x34b5f5,_0x324983){return new BPromise(function(_0x2f87dd,_0x1f4dc0){return client[_0x9bae('0xa')](_0x379d7b,_0x324983)[_0x9bae('0xb')](function(_0x5a0f00){logger[_0x9bae('0xc')](_0x9bae('0xd'),_0x34b5f5,'request\x20sent');logger[_0x9bae('0xe')](_0x9bae('0xf'),_0x34b5f5,_0x9bae('0x10'),JSON['stringify'](_0x5a0f00));if(_0x5a0f00[_0x9bae('0x11')]){if(_0x5a0f00[_0x9bae('0x11')][_0x9bae('0x12')]===0x1f4){logger[_0x9bae('0x11')](_0x9bae('0xd'),_0x34b5f5,_0x5a0f00[_0x9bae('0x11')][_0x9bae('0x13')]);return _0x1f4dc0(_0x5a0f00[_0x9bae('0x11')]['message']);}logger[_0x9bae('0x11')](_0x9bae('0xd'),_0x34b5f5,_0x5a0f00[_0x9bae('0x11')][_0x9bae('0x13')]);return _0x2f87dd(_0x5a0f00[_0x9bae('0x11')][_0x9bae('0x13')]);}else{logger[_0x9bae('0xc')](_0x9bae('0xd'),_0x34b5f5,_0x9bae('0x10'));_0x2f87dd(_0x5a0f00[_0x9bae('0x14')][_0x9bae('0x13')]);}})[_0x9bae('0x15')](function(_0x4241ac){logger['error'](_0x9bae('0xd'),_0x34b5f5,_0x4241ac);_0x1f4dc0(_0x4241ac);});});} \ No newline at end of file +var _0xef0f=['then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xef0f,0x7f));var _0xfef0=function(_0x13df9f,_0x2713e0){_0x13df9f=_0x13df9f-0x0;var _0x170f3d=_0xef0f[_0x13df9f];return _0x170f3d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfef0('0x0'));var BPromise=require(_0xfef0('0x1'));var rs=require(_0xfef0('0x2'));var fs=require('fs');var Redis=require(_0xfef0('0x3'));var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfef0('0x8')][_0xfef0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x506c9d,_0x282706,_0x3a258b){return new BPromise(function(_0x3bbd64,_0x4d4e4d){return client[_0xfef0('0xa')](_0x506c9d,_0x3a258b)[_0xfef0('0xb')](function(_0x10c47f){logger[_0xfef0('0xc')](_0xfef0('0xd'),_0x282706,'request\x20sent');logger[_0xfef0('0xe')](_0xfef0('0xf'),_0x282706,_0xfef0('0x10'),JSON[_0xfef0('0x11')](_0x10c47f));if(_0x10c47f[_0xfef0('0x12')]){if(_0x10c47f[_0xfef0('0x12')][_0xfef0('0x13')]===0x1f4){logger[_0xfef0('0x12')](_0xfef0('0xd'),_0x282706,_0x10c47f[_0xfef0('0x12')][_0xfef0('0x14')]);return _0x4d4e4d(_0x10c47f[_0xfef0('0x12')][_0xfef0('0x14')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x282706,_0x10c47f[_0xfef0('0x12')]['message']);return _0x3bbd64(_0x10c47f[_0xfef0('0x12')]['message']);}else{logger[_0xfef0('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x282706,_0xfef0('0x10'));_0x3bbd64(_0x10c47f[_0xfef0('0x15')]['message']);}})[_0xfef0('0x16')](function(_0x5b56de){logger['error'](_0xfef0('0xd'),_0x282706,_0x5b56de);_0x4d4e4d(_0x5b56de);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index c09ee74..362cf8a 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 _0x8f5f=['put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x8f5f,0x155));var _0xf8f5=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0x8f5f[_0x498334];return _0x13bb70;};'use strict';var multer=require('multer');var util=require(_0xf8f5('0x0'));var path=require(_0xf8f5('0x1'));var timeout=require(_0xf8f5('0x2'));var express=require(_0xf8f5('0x3'));var router=express['Router']();var fs_extra=require(_0xf8f5('0x4'));var auth=require(_0xf8f5('0x5'));var interaction=require(_0xf8f5('0x6'));var config=require(_0xf8f5('0x7'));var controller=require('./chatTransferReport.controller');router[_0xf8f5('0x8')]('/',auth[_0xf8f5('0x9')](),controller['index']);router['get'](_0xf8f5('0xa'),auth[_0xf8f5('0x9')](),controller[_0xf8f5('0xb')]);router[_0xf8f5('0x8')](_0xf8f5('0xc'),auth[_0xf8f5('0x9')](),controller[_0xf8f5('0xd')]);router[_0xf8f5('0xe')]('/',auth['isAuthenticated'](),controller[_0xf8f5('0xf')]);router[_0xf8f5('0x10')](_0xf8f5('0xc'),auth[_0xf8f5('0x9')](),controller[_0xf8f5('0x11')]);router[_0xf8f5('0x12')](_0xf8f5('0xc'),auth[_0xf8f5('0x9')](),controller[_0xf8f5('0x13')]);module[_0xf8f5('0x14')]=router; \ No newline at end of file +var _0xe96a=['./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x57674a,_0x173eaf){var _0x51cdb5=function(_0x39f779){while(--_0x39f779){_0x57674a['push'](_0x57674a['shift']());}};_0x51cdb5(++_0x173eaf);}(_0xe96a,0x199));var _0xae96=function(_0x3d1ce2,_0x2a9d26){_0x3d1ce2=_0x3d1ce2-0x0;var _0x43c682=_0xe96a[_0x3d1ce2];return _0x43c682;};'use strict';var multer=require(_0xae96('0x0'));var util=require(_0xae96('0x1'));var path=require(_0xae96('0x2'));var timeout=require(_0xae96('0x3'));var express=require(_0xae96('0x4'));var router=express[_0xae96('0x5')]();var fs_extra=require(_0xae96('0x6'));var auth=require(_0xae96('0x7'));var interaction=require(_0xae96('0x8'));var config=require('../../config/environment');var controller=require(_0xae96('0x9'));router[_0xae96('0xa')]('/',auth[_0xae96('0xb')](),controller[_0xae96('0xc')]);router['get'](_0xae96('0xd'),auth[_0xae96('0xb')](),controller[_0xae96('0xe')]);router[_0xae96('0xa')](_0xae96('0xf'),auth[_0xae96('0xb')](),controller['show']);router[_0xae96('0x10')]('/',auth['isAuthenticated'](),controller[_0xae96('0x11')]);router[_0xae96('0x12')](_0xae96('0xf'),auth[_0xae96('0xb')](),controller[_0xae96('0x13')]);router['delete'](_0xae96('0xf'),auth['isAuthenticated'](),controller[_0xae96('0x14')]);module[_0xae96('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 11573a9..afd4e8c 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 _0xa661=['exports','STRING','email','Agent','#011F6A','#ffffff','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','BOOLEAN','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','thumb','star','stringify','input','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring'];(function(_0x435044,_0x36ab8e){var _0x33d4c6=function(_0x15efa0){while(--_0x15efa0){_0x435044['push'](_0x435044['shift']());}};_0x33d4c6(++_0x36ab8e);}(_0xa661,0xd2));var _0x1a66=function(_0x5aabcb,_0x219fbd){_0x5aabcb=_0x5aabcb-0x0;var _0x4b6e71=_0xa661[_0x5aabcb];return _0x4b6e71;};'use strict';var Sequelize=require(_0x1a66('0x0'));var rs=require(_0x1a66('0x1'));module[_0x1a66('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x1a66('0x3')]},'mapKey':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0x4')},'mapKeyOffline':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x1a66('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x1a66('0x3')],'allowNull':![],'defaultValue':_0x1a66('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1a66('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1a66('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x1a66('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x1a66('0x8')](_0x1a66('0x9'),_0x1a66('0xa')),'defaultValue':_0x1a66('0x9')},'header_online':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0xb')},'start_chat_button':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0xd')},'download_transcript':{'type':Sequelize[_0x1a66('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x1a66('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x1a66('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x1a66('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x1a66('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0x13')},'noteTitle':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0x14')},'closingMessage':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0x15')},'closingMessageButton':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0x16')},'skipMessageButton':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0x17')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x1a66('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x1a66('0xe')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x1a66('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0x18')},'ratingType':{'type':Sequelize['ENUM']('star',_0x1a66('0x19')),'defaultValue':_0x1a66('0x1a')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1a66('0x1b')]({'items':[{'type':_0x1a66('0x1c'),'variable':null,'config':{'placeholder':'name','type':_0x1a66('0x1d'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x1a66('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x1a66('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x1a66('0x1e')](_0x1a66('0x1f'))?JSON[_0x1a66('0x20')](this['getDataValue']('onlineForm')):{};},'set':function(_0x1dfb04){return this[_0x1a66('0x21')](_0x1a66('0x1f'),JSON[_0x1a66('0x1b')](_0x1dfb04));}},'offlineForm':{'type':Sequelize[_0x1a66('0x11')],'defaultValue':function(){return JSON[_0x1a66('0x1b')]({'items':[{'type':_0x1a66('0x1c'),'props':{'title':_0x1a66('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x1a66('0x4')},'variable':null},{'type':_0x1a66('0x22'),'config':{'placeholder':_0x1a66('0x23')},'props':{'title':'Comments','helpText':_0x1a66('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x1a66('0x1e')](_0x1a66('0x25'))?JSON['parse'](this['getDataValue'](_0x1a66('0x25'))):{};},'set':function(_0x4ffb60){return this[_0x1a66('0x21')](_0x1a66('0x25'),JSON['stringify'](_0x4ffb60));}},'token':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x1a66('0xe')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x1a66('0xe')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x1a66('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x1a66('0x3')]},'waitingTitle':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0x26')},'waitingMessage':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0x28')},'offlineMessageBody':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x1a66('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x1a66('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0x17')},'sendUnmanaged':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x1a66('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x1a66('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x1a66('0x3')]},'notificationTemplate':{'type':Sequelize[_0x1a66('0x11')],'defaultValue':function(){return _0x1a66('0x2b');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1a66('0xe')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x1a66('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0x2c')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x1a66('0x2d')},'messagesAlignment':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0x2e')},'defaultTitle':{'type':Sequelize[_0x1a66('0x3')]},'customerAvatar':{'type':Sequelize[_0x1a66('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x1a66('0xe')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x1a66('0x3')],'allowNull':![],'defaultValue':_0x1a66('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x1a66('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1a66('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1a66('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':_0x1a66('0x30')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1a66('0xf')],'comment':_0x1a66('0x31')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1a66('0x32'),'set':function(_0x409e31){if(!_0x409e31)this['setDataValue'](_0x1a66('0x33'),null);this[_0x1a66('0x21')]('mandatoryDisposition',_0x409e31);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1a66('0x34')},'vidaooNote':{'type':Sequelize[_0x1a66('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x1a66('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5e16=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','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:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','System'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5e16,0x180));var _0x65e1=function(_0x5c6022,_0x5cd10b){_0x5c6022=_0x5c6022-0x0;var _0x4ab5af=_0x5e16[_0x5c6022];return _0x4ab5af;};'use strict';var Sequelize=require(_0x65e1('0x0'));var rs=require(_0x65e1('0x1'));module[_0x65e1('0x2')]={'name':{'type':Sequelize[_0x65e1('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x65e1('0x4')},'description':{'type':Sequelize[_0x65e1('0x3')]},'mapKey':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':_0x65e1('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x65e1('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':_0x65e1('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x65e1('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x65e1('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x65e1('0x3')],'allowNull':![],'defaultValue':_0x65e1('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x65e1('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x65e1('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x65e1('0x3')]},'animation':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x65e1('0xb')]('rounded','squared'),'defaultValue':_0x65e1('0xc')},'header_online':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':_0x65e1('0xd')},'start_chat_button':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':_0x65e1('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x65e1('0xf')},'header_offline':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':_0x65e1('0x10')},'download_transcript':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x65e1('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x65e1('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x65e1('0x12')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':_0x65e1('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x65e1('0x14')},'placeholderMessage':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':_0x65e1('0x15')},'closingMessage':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':_0x65e1('0xf')},'skipMessageButton':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':_0x65e1('0x16')},'conditionAgreement':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x65e1('0x17')},'ratingType':{'type':Sequelize[_0x65e1('0xb')](_0x65e1('0x18'),_0x65e1('0x19')),'defaultValue':_0x65e1('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x65e1('0x12')],'defaultValue':function(){return JSON[_0x65e1('0x1a')]({'items':[{'type':_0x65e1('0x1b'),'variable':null,'config':{'placeholder':_0x65e1('0x1c'),'type':_0x65e1('0x1d'),'required':!![]},'props':{'title':_0x65e1('0x1c'),'helpText':''}},{'type':_0x65e1('0x1b'),'props':{'title':_0x65e1('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x65e1('0x5'),'type':_0x65e1('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x65e1('0x1e')](_0x65e1('0x1f'))?JSON[_0x65e1('0x20')](this[_0x65e1('0x1e')](_0x65e1('0x1f'))):{};},'set':function(_0x22c24a){return this['setDataValue']('onlineForm',JSON[_0x65e1('0x1a')](_0x22c24a));}},'offlineForm':{'type':Sequelize[_0x65e1('0x12')],'defaultValue':function(){return JSON[_0x65e1('0x1a')]({'items':[{'type':'input','props':{'title':_0x65e1('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x65e1('0x5'),'type':_0x65e1('0x5')},'variable':null},{'type':_0x65e1('0x21'),'config':{'placeholder':_0x65e1('0x22')},'props':{'title':_0x65e1('0x22'),'helpText':_0x65e1('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x65e1('0x1e')]('offlineForm')?JSON[_0x65e1('0x20')](this[_0x65e1('0x1e')](_0x65e1('0x24'))):{};},'set':function(_0x3c3790){return this[_0x65e1('0x25')]('offlineForm',JSON[_0x65e1('0x1a')](_0x3c3790));}},'token':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':function(){return rs[_0x65e1('0x26')]();}},'autoclose':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x65e1('0x3')]},'forwardOffline':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x65e1('0x3')]},'waitingTitle':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':_0x65e1('0x27')},'waitingMessage':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':_0x65e1('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':_0x65e1('0x29')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x65e1('0x16')},'sendUnmanaged':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':_0x65e1('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x65e1('0x12')]},'showAgentAvatar':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x65e1('0x12')],'defaultValue':function(){return _0x65e1('0x2a');}},'notificationSound':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':_0x65e1('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x65e1('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':_0x65e1('0x2c')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':_0x65e1('0x2d')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x65e1('0x2e')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x65e1('0x12')]},'showCustomerAvatar':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x65e1('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x65e1('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x65e1('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':_0x65e1('0x2f')},'systemAvatar':{'type':Sequelize[_0x65e1('0x12')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x65e1('0x9')],'comment':_0x65e1('0x30')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x65e1('0x31'),'set':function(_0x45a055){if(!_0x45a055)this[_0x65e1('0x25')](_0x65e1('0x32'),null);this[_0x65e1('0x25')](_0x65e1('0x33'),_0x45a055);}},'vidaooEscalation':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x65e1('0x3')],'allowNull':![],'defaultValue':_0x65e1('0x34')},'vidaooNote':{'type':Sequelize[_0x65e1('0x3')],'defaultValue':function(){return _0x65e1('0x35');}},'vidaooMetadata':{'type':Sequelize[_0x65e1('0x12')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x65e1('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x65e1('0x12')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index f68fa42..16b4a16 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 _0x21e2=['ChatApplication','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','list','applications','orderBy','priority','asc','account','threadId','externalUrl','ChatInteraction','ContactId','interaction','contact','lastName','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','user','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','Contact','User','fullname','internal','Tag','Tags','color','tag','getProactiveActions','getLicense','virtual','License','increment','chatLicenseExceeded','readFileSync','server/files/chat/iframe.ejs','origin','3.5.0','remote','headers','x-forwarded-for','x-real-ip','remoteAddress','referer','replace','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','util','lodash','querystring','html-to-text','jayson/promise','../../components/parsers/qs','../../config/logger','api','APIOutOfIntervalError','../../errors/api','handleError','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','update','get','ChatWebsites','UserProfileResource','destroy','stack','name','send','getSnippet','format','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','all','some','user-agent-parser','setUA','getResult','customerIp','cf-connecting-ip','first','split','firstName','x-real-port','browser','version','%s\x20%s','unknown','vendor','%s\x20%s\x20%s','device','model','type','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','map','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','show','params','includeAll','options','find','create','body','UserProfileSection','userProfileId','autoAssociation','describe','Disposition','getDispositions','hasOwnProperty','nolimit','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','findOne','ChatWebsiteId','removeAnswers','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts','DESC'];(function(_0x27dde9,_0xa95823){var _0x293f40=function(_0x1027dd){while(--_0x1027dd){_0x27dde9['push'](_0x27dde9['shift']());}};_0x293f40(++_0xa95823);}(_0x21e2,0x1bb));var _0x221e=function(_0x5354bd,_0x3b11dd){_0x5354bd=_0x5354bd-0x0;var _0x3fcc7b=_0x21e2[_0x5354bd];return _0x3fcc7b;};'use strict';var Mustache=require('mustache');var util=require(_0x221e('0x0'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x221e('0x1'));var querystring=require(_0x221e('0x2'));var htmlToText=require(_0x221e('0x3'));var Redis=require('ioredis');var jayson=require(_0x221e('0x4'));var url=require('url');var qs=require(_0x221e('0x5'));var logger=require(_0x221e('0x6'))(_0x221e('0x7'));var config=require('../../config/environment');var APIOutOfIntervalError=require('../../errors/api')[_0x221e('0x8')];var APINotFoundError=require(_0x221e('0x9'))['APINotFoundError'];var APIHandleError=require(_0x221e('0x9'))[_0x221e('0xa')];var db=require(_0x221e('0xb'))['db'];config[_0x221e('0xc')]=_[_0x221e('0xd')](config[_0x221e('0xc')],{'host':_0x221e('0xe'),'port':0x18eb});var socket=require(_0x221e('0xf'))(new Redis(config[_0x221e('0xc')]));require(_0x221e('0x10'))['register'](socket);var client=jayson[_0x221e('0x11')][_0x221e('0x12')]({'port':0x232c});var client9002=jayson['client'][_0x221e('0x12')]({'port':0x232a});var client9003=jayson[_0x221e('0x11')]['http']({'port':0x232b});var client9001=jayson[_0x221e('0x11')]['http']({'port':0x2329});function respondWithRpcPromise(_0x118079,_0x3fcb74,_0x410a11,_0x317e03){return new Promise(function(_0x9a61e7,_0x126b57){var _0x3309a8=_0x317e03||client;return _0x3309a8[_0x221e('0x13')](_0x118079,_0x410a11)[_0x221e('0x14')](function(_0x18637c){logger[_0x221e('0x15')](_0x221e('0x16'),_0x3fcb74,_0x221e('0x17'));logger[_0x221e('0x18')](_0x221e('0x19'),_0x3fcb74,_0x221e('0x17'),JSON[_0x221e('0x1a')](_0x18637c));if(_0x18637c[_0x221e('0x1b')]){if(_0x18637c[_0x221e('0x1b')][_0x221e('0x1c')]===0x1f4){logger['error'](_0x221e('0x16'),_0x3fcb74,_0x18637c[_0x221e('0x1b')][_0x221e('0x1d')]);return _0x126b57(_0x18637c['error']['message']);}logger['error'](_0x221e('0x16'),_0x3fcb74,_0x18637c['error'][_0x221e('0x1d')]);return _0x9a61e7(_0x18637c[_0x221e('0x1b')][_0x221e('0x1d')]);}else{logger['info'](_0x221e('0x16'),_0x3fcb74,_0x221e('0x17'));_0x9a61e7(_0x18637c['result'][_0x221e('0x1d')]);}})[_0x221e('0x1e')](function(_0x22dd6b){logger['error'](_0x221e('0x16'),_0x3fcb74,_0x22dd6b);_0x126b57(_0x22dd6b);});});}function respondWithStatusCode(_0x331946,_0x499067){_0x499067=_0x499067||0xcc;return function(_0x28cd47){if(_0x28cd47){return _0x331946[_0x221e('0x1f')](_0x499067);}return _0x331946[_0x221e('0x20')](_0x499067)[_0x221e('0x21')]();};}function respondWithResult(_0x5bb75b,_0x5731be){_0x5731be=_0x5731be||0xc8;return function(_0x583fc6){if(_0x583fc6){return _0x5bb75b[_0x221e('0x20')](_0x5731be)[_0x221e('0x22')](_0x583fc6);}};}function respondWithFilteredResult(_0x364e72,_0x5137c3){return function(_0x35a938){if(_0x35a938){var _0x11e2ea=typeof _0x5137c3['offset']==='undefined'&&typeof _0x5137c3[_0x221e('0x23')]===_0x221e('0x24');var _0xa70219=_0x35a938[_0x221e('0x25')];var _0xba12cd=_0x11e2ea?0x0:_0x5137c3[_0x221e('0x26')];var _0x1cbf07=_0x11e2ea?_0x35a938['count']:_0x5137c3[_0x221e('0x26')]+_0x5137c3[_0x221e('0x23')];var _0x213fff;if(_0x1cbf07>=_0xa70219){_0x1cbf07=_0xa70219;_0x213fff=0xc8;}else{_0x213fff=0xce;}_0x364e72[_0x221e('0x20')](_0x213fff);return _0x364e72[_0x221e('0x27')]('Content-Range',_0xba12cd+'-'+_0x1cbf07+'/'+_0xa70219)[_0x221e('0x22')](_0x35a938);}return null;};}function saveUpdates(_0x51da9b){return function(_0x39fa28){if(_0x39fa28){return _0x39fa28[_0x221e('0x28')](_0x51da9b)[_0x221e('0x14')](function(_0x5e6477){return _0x5e6477;});}return null;};}function removeEntity(_0x5596a8){return function(_0x306505){if(_0x306505){return _0x306505['destroy']()['then'](function(){var _0x4c6366=_0x306505[_0x221e('0x29')]({'plain':!![]});var _0x194cf3=_0x221e('0x2a');return db[_0x221e('0x2b')][_0x221e('0x2c')]({'where':{'type':_0x194cf3,'resourceId':_0x4c6366['id']}})[_0x221e('0x14')](function(){return _0x306505;});})['then'](function(){_0x5596a8[_0x221e('0x20')](0xcc)[_0x221e('0x21')]();});}};}function handleEntityNotFound(_0x436e4d){return function(_0x406673){if(!_0x406673){_0x436e4d[_0x221e('0x1f')](0x194);}return _0x406673;};}function handleError(_0x3c7008,_0x3ca84e){_0x3ca84e=_0x3ca84e||0x1f4;return function(_0x133f78){logger['error'](_0x133f78[_0x221e('0x2d')]);if(_0x133f78[_0x221e('0x2e')]){delete _0x133f78['name'];}_0x3c7008[_0x221e('0x20')](_0x3ca84e)[_0x221e('0x2f')](_0x133f78);};}function iftimePromise(_0x4ce910,_0x215abc){return respondWithRpcPromise('Command',_0x221e('0x30'),{'command':_0x215abc['timezone']?util[_0x221e('0x31')](_0x221e('0x32'),_0x4ce910[_0x221e('0x33')],_0x215abc[_0x221e('0x34')]):util[_0x221e('0x31')](_0x221e('0x35'),_0x4ce910[_0x221e('0x33')])},client9002)['then'](function(_0x78fe29){var _0x5cfb48=_0x78fe29&&_0x78fe29[_0x221e('0x36')]('true')>=0x0?!![]:![];logger[_0x221e('0x15')](_0x221e('0x37'),_0x215abc['id'],_0x4ce910['id'],_0x4ce910['interval'],_0x5cfb48?_0x221e('0x38'):_0x221e('0x39'),_0x215abc['timezone']?_0x215abc[_0x221e('0x34')]:_0x221e('0x3a'));return _0x5cfb48;})[_0x221e('0x1e')](function(_0x1f1c75){logger[_0x221e('0x1b')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x215abc['id'],_0x4ce910['id'],_0x4ce910[_0x221e('0x33')],util[_0x221e('0x3b')](_0x1f1c75,{'showHidden':![],'depth':null}),_0x215abc[_0x221e('0x34')]?_0x215abc[_0x221e('0x34')]:_0x221e('0x3a'));return![];});}function checkWebsiteIntervals(_0x1d3d70){var _0xdfe744=_['map'](_0x1d3d70[_0x221e('0x3c')][_0x221e('0x3d')],function(_0xd47e00){var _0x5f0085=_0xd47e00[_0x221e('0x29')]({'plain':!![]});return iftimePromise(_0x5f0085,_0x1d3d70);});return Promise[_0x221e('0x3e')](_0xdfe744)['then'](function(_0x544c85){return _[_0x221e('0x3f')](_0x544c85);});}function createInteractionObject(_0x3b5cfd,_0x19691e,_0x4ddf1a,_0x2613ee){var _0x1ec19a=require(_0x221e('0x40'));var _0x37ee23=new _0x1ec19a();var _0x1255f9=_0x37ee23[_0x221e('0x41')](_0x4ddf1a['user-agent'])[_0x221e('0x42')]();var _0x541eee=_0x19691e[_0x221e('0x43')];if(_0x4ddf1a[_0x221e('0x44')]){_0x541eee=_0x4ddf1a['cf-connecting-ip'];}else if(_0x4ddf1a['x-forwarded-for']){_0x541eee=_[_0x221e('0x45')](_0x4ddf1a['x-forwarded-for'][_0x221e('0x46')](','));}return{'ContactId':_0x2613ee['id'],'ChatWebsiteId':_0x3b5cfd,'from':(_0x2613ee[_0x221e('0x47')]||'')+'\x20'+(_0x2613ee['lastName']||''),'customerIp':_0x541eee,'customerPort':_0x4ddf1a[_0x221e('0x48')]?_0x4ddf1a[_0x221e('0x48')]:null,'referer':_0x19691e['referer'],'browserName':_0x1255f9[_0x221e('0x49')][_0x221e('0x2e')]&&_0x1255f9['browser'][_0x221e('0x4a')]?util[_0x221e('0x31')](_0x221e('0x4b'),_0x1255f9['browser'][_0x221e('0x2e')],_0x1255f9[_0x221e('0x49')][_0x221e('0x4a')]):'unknown','browserVersion':_0x1255f9[_0x221e('0x49')]['version']||_0x221e('0x4c'),'osName':util['format']('%s\x20%s',_0x1255f9['os'][_0x221e('0x2e')],_0x1255f9['os'][_0x221e('0x4a')]),'osVersion':_0x1255f9['os'][_0x221e('0x4a')],'deviceModel':_0x1255f9['device']['model']&&_0x1255f9['device'][_0x221e('0x4d')]?util[_0x221e('0x31')](_0x221e('0x4e'),_0x1255f9[_0x221e('0x4f')][_0x221e('0x50')],_0x1255f9['device'][_0x221e('0x4d')],_0x1255f9[_0x221e('0x4f')][_0x221e('0x51')]):null,'deviceVendor':_0x1255f9[_0x221e('0x4f')]['vendor'],'deviceType':_0x1255f9[_0x221e('0x4f')][_0x221e('0x51')],'formData':JSON[_0x221e('0x1a')](_0x19691e)};}exports['index']=function(_0xe9a9fb,_0x19ddd7){var _0x179599={'include':[{'model':db[_0x221e('0x52')],'as':_0x221e('0x53')}]},_0x1b0d5d={},_0x7f7d58={'count':0x0,'rows':[]};var _0x3dadfe=_['map'](db[_0x221e('0x54')][_0x221e('0x55')],function(_0x2a9725){return{'name':_0x2a9725[_0x221e('0x56')],'type':_0x2a9725[_0x221e('0x51')][_0x221e('0x57')]};});_0x1b0d5d[_0x221e('0x50')]=_[_0x221e('0x58')](_0x3dadfe,_0x221e('0x2e'));_0x1b0d5d[_0x221e('0x59')]=_[_0x221e('0x5a')](_0xe9a9fb['query']);_0x1b0d5d[_0x221e('0x5b')]=_['intersection'](_0x1b0d5d['model'],_0x1b0d5d['query']);_0x179599[_0x221e('0x5c')]=_[_0x221e('0x5d')](_0x1b0d5d['model'],qs[_0x221e('0x5e')](_0xe9a9fb[_0x221e('0x59')][_0x221e('0x5e')]));_0x179599['attributes']=_0x179599[_0x221e('0x5c')][_0x221e('0x5f')]?_0x179599[_0x221e('0x5c')]:_0x1b0d5d[_0x221e('0x50')];if(!_0xe9a9fb[_0x221e('0x59')]['hasOwnProperty']('nolimit')){_0x179599['limit']=qs[_0x221e('0x23')](_0xe9a9fb[_0x221e('0x59')]['limit']);_0x179599[_0x221e('0x26')]=qs[_0x221e('0x26')](_0xe9a9fb['query']['offset']);}_0x179599[_0x221e('0x60')]=qs['sort'](_0xe9a9fb['query'][_0x221e('0x61')]);_0x179599[_0x221e('0x62')]=qs[_0x221e('0x5b')](_[_0x221e('0x63')](_0xe9a9fb[_0x221e('0x59')],_0x1b0d5d[_0x221e('0x5b')]),_0x3dadfe);if(_0xe9a9fb['query'][_0x221e('0x64')]){_0x179599['where']=_[_0x221e('0x65')](_0x179599[_0x221e('0x62')],{'$or':_[_0x221e('0x58')](_0x3dadfe,function(_0x51d5b8){if(_0x51d5b8[_0x221e('0x51')]!==_0x221e('0x66')){var _0x30ed3e={};_0x30ed3e[_0x51d5b8[_0x221e('0x2e')]]={'$like':'%'+_0xe9a9fb[_0x221e('0x59')][_0x221e('0x64')]+'%'};return _0x30ed3e;}})});}_0x179599=_[_0x221e('0x65')]({},_0x179599,_0xe9a9fb['options']);var _0x5dbfe={'where':_0x179599['where']};return db[_0x221e('0x54')][_0x221e('0x25')](_0x5dbfe)[_0x221e('0x14')](function(_0x30a222){_0x7f7d58[_0x221e('0x25')]=_0x30a222;if(_0xe9a9fb[_0x221e('0x59')]['includeAll']){_0x179599[_0x221e('0x67')]=[{'all':!![]}];}return db[_0x221e('0x54')]['findAll'](_0x179599);})[_0x221e('0x14')](function(_0x19359e){_0x7f7d58['rows']=_0x19359e;return _0x7f7d58;})[_0x221e('0x14')](respondWithFilteredResult(_0x19ddd7,_0x179599))[_0x221e('0x1e')](handleError(_0x19ddd7,null));};exports[_0x221e('0x68')]=function(_0x43ddc8,_0x4e6ff7){var _0x59de10={'raw':![],'where':{'id':_0x43ddc8[_0x221e('0x69')]['id']},'include':[{'model':db[_0x221e('0x52')],'as':_0x221e('0x53')}]},_0x2705c9={};_0x2705c9[_0x221e('0x50')]=_['keys'](db[_0x221e('0x54')][_0x221e('0x55')]);_0x2705c9['query']=_[_0x221e('0x5a')](_0x43ddc8[_0x221e('0x59')]);_0x2705c9[_0x221e('0x5b')]=_['intersection'](_0x2705c9[_0x221e('0x50')],_0x2705c9[_0x221e('0x59')]);_0x59de10[_0x221e('0x5c')]=_[_0x221e('0x5d')](_0x2705c9['model'],qs[_0x221e('0x5e')](_0x43ddc8['query']['fields']));_0x59de10['attributes']=_0x59de10[_0x221e('0x5c')]['length']?_0x59de10['attributes']:_0x2705c9[_0x221e('0x50')];if(_0x43ddc8[_0x221e('0x59')][_0x221e('0x6a')]){_0x59de10[_0x221e('0x67')]=[{'all':!![]}];}_0x59de10=_[_0x221e('0x65')]({},_0x59de10,_0x43ddc8[_0x221e('0x6b')]);return db['ChatWebsite'][_0x221e('0x6c')](_0x59de10)[_0x221e('0x14')](handleEntityNotFound(_0x4e6ff7,null))[_0x221e('0x14')](respondWithResult(_0x4e6ff7,null))['catch'](handleError(_0x4e6ff7,null));};exports[_0x221e('0x6d')]=function(_0x2b305d,_0x260326){return db['ChatWebsite'][_0x221e('0x6d')](_0x2b305d[_0x221e('0x6e')],{})[_0x221e('0x14')](function(_0xb9576c){var _0x2740fb=_0x2b305d['user'][_0x221e('0x29')]({'plain':!![]});if(!_0x2740fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2740fb['role']==='user'){var _0x5a44c6=_0xb9576c[_0x221e('0x29')]({'plain':!![]});var _0x88555c=_0x221e('0x2a');return db[_0x221e('0x6f')][_0x221e('0x6c')]({'where':{'name':_0x88555c,'userProfileId':_0x2740fb[_0x221e('0x70')]},'raw':!![]})['then'](function(_0x349d9f){if(_0x349d9f&&_0x349d9f[_0x221e('0x71')]===0x0){return db['UserProfileResource'][_0x221e('0x6d')]({'name':_0x5a44c6[_0x221e('0x2e')],'resourceId':_0x5a44c6['id'],'type':_0x349d9f[_0x221e('0x2e')],'sectionId':_0x349d9f['id']},{})[_0x221e('0x14')](function(){return _0xb9576c;});}else{return _0xb9576c;}})[_0x221e('0x1e')](function(_0x62b8e9){logger[_0x221e('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x62b8e9);throw _0x62b8e9;});}return _0xb9576c;})[_0x221e('0x14')](respondWithResult(_0x260326,0xc9))[_0x221e('0x1e')](handleError(_0x260326,null));};exports[_0x221e('0x28')]=function(_0x4d155a,_0x245ca6){if(_0x4d155a[_0x221e('0x6e')]['id']){delete _0x4d155a[_0x221e('0x6e')]['id'];}return db['ChatWebsite'][_0x221e('0x6c')]({'where':{'id':_0x4d155a['params']['id']},'include':[{'model':db['Pause'],'as':_0x221e('0x53')}]})['then'](handleEntityNotFound(_0x245ca6,null))[_0x221e('0x14')](saveUpdates(_0x4d155a[_0x221e('0x6e')],null))['then'](respondWithResult(_0x245ca6,null))[_0x221e('0x1e')](handleError(_0x245ca6,null));};exports[_0x221e('0x2c')]=function(_0x1453ce,_0x3e07ce){return db['ChatWebsite'][_0x221e('0x6c')]({'where':{'id':_0x1453ce[_0x221e('0x69')]['id']}})[_0x221e('0x14')](handleEntityNotFound(_0x3e07ce,null))[_0x221e('0x14')](removeEntity(_0x3e07ce,null))[_0x221e('0x1e')](handleError(_0x3e07ce,null));};exports[_0x221e('0x72')]=function(_0x45570c,_0x415391){return db[_0x221e('0x54')][_0x221e('0x72')]()[_0x221e('0x14')](respondWithResult(_0x415391,null))[_0x221e('0x1e')](handleError(_0x415391,null));};exports['addDisposition']=function(_0x576b66,_0x214e29){if(_0x576b66[_0x221e('0x6e')]['id']){delete _0x576b66[_0x221e('0x6e')]['id'];}return db[_0x221e('0x54')]['find']({'where':{'id':_0x576b66[_0x221e('0x69')]['id']}})['then'](handleEntityNotFound(_0x214e29,null))[_0x221e('0x14')](function(_0x839a07){if(_0x839a07){_0x576b66[_0x221e('0x6e')]['ChatWebsiteId']=_0x839a07['id'];return db[_0x221e('0x73')]['create'](_0x576b66[_0x221e('0x6e')]);}})['then'](respondWithResult(_0x214e29,null))[_0x221e('0x1e')](handleError(_0x214e29,null));};exports[_0x221e('0x74')]=function(_0x15153f,_0x3ba9b5){var _0x111fb4={'raw':![],'where':{}};var _0x46d33d={};var _0x5e4aef={'count':0x0,'rows':[]};return db[_0x221e('0x54')]['findOne']({'where':{'id':_0x15153f[_0x221e('0x69')]['id']}})[_0x221e('0x14')](handleEntityNotFound(_0x3ba9b5,null))['then'](function(_0x4d039a){if(_0x4d039a){_0x46d33d[_0x221e('0x50')]=_[_0x221e('0x5a')](db[_0x221e('0x73')][_0x221e('0x55')]);_0x46d33d[_0x221e('0x59')]=_['keys'](_0x15153f[_0x221e('0x59')]);_0x46d33d[_0x221e('0x5b')]=_['intersection'](_0x46d33d[_0x221e('0x50')],_0x46d33d[_0x221e('0x59')]);_0x111fb4['attributes']=_[_0x221e('0x5d')](_0x46d33d['model'],qs[_0x221e('0x5e')](_0x15153f[_0x221e('0x59')][_0x221e('0x5e')]));_0x111fb4['attributes']=_0x111fb4['attributes'][_0x221e('0x5f')]?_0x111fb4['attributes']:_0x46d33d['model'];if(!_0x15153f['query'][_0x221e('0x75')](_0x221e('0x76'))){_0x111fb4[_0x221e('0x23')]=qs[_0x221e('0x23')](_0x15153f['query']['limit']);_0x111fb4[_0x221e('0x26')]=qs[_0x221e('0x26')](_0x15153f['query'][_0x221e('0x26')]);}_0x111fb4[_0x221e('0x60')]=qs[_0x221e('0x61')](_0x15153f[_0x221e('0x59')][_0x221e('0x61')]);_0x111fb4[_0x221e('0x62')]=qs[_0x221e('0x5b')](_['pick'](_0x15153f[_0x221e('0x59')],_0x46d33d[_0x221e('0x5b')]));_0x111fb4['where']['ChatWebsiteId']=_0x4d039a['id'];if(_0x15153f[_0x221e('0x59')][_0x221e('0x64')]){_0x111fb4[_0x221e('0x62')]=_[_0x221e('0x65')](_0x111fb4['where'],{'$or':_[_0x221e('0x58')](_0x111fb4['attributes'],function(_0x19fac4){var _0x176561={};_0x176561[_0x19fac4]={'$like':'%'+_0x15153f[_0x221e('0x59')][_0x221e('0x64')]+'%'};return _0x176561;})});}_0x111fb4=_[_0x221e('0x65')]({},_0x111fb4,_0x15153f[_0x221e('0x6b')]);return db[_0x221e('0x73')][_0x221e('0x25')]({'where':_0x111fb4[_0x221e('0x62')]})[_0x221e('0x14')](function(_0x59b95f){_0x5e4aef[_0x221e('0x25')]=_0x59b95f;if(_0x15153f[_0x221e('0x59')][_0x221e('0x6a')]){_0x111fb4[_0x221e('0x67')]=[{'all':!![]}];}return db[_0x221e('0x73')][_0x221e('0x77')](_0x111fb4);})[_0x221e('0x14')](function(_0x353a3d){_0x5e4aef[_0x221e('0x78')]=_0x353a3d;return _0x5e4aef;});}})['then'](respondWithFilteredResult(_0x3ba9b5,_0x111fb4))[_0x221e('0x1e')](handleError(_0x3ba9b5,null));};exports[_0x221e('0x79')]=function(_0x49b467,_0x889308){return db[_0x221e('0x54')][_0x221e('0x6c')]({'where':{'id':_0x49b467[_0x221e('0x69')]['id']}})[_0x221e('0x14')](handleEntityNotFound(_0x889308,null))[_0x221e('0x14')](function(_0x1b6cce){if(_0x1b6cce){return _0x1b6cce[_0x221e('0x79')](_0x49b467['query'][_0x221e('0x7a')]);}})['then'](respondWithStatusCode(_0x889308,null))[_0x221e('0x1e')](handleError(_0x889308,null));};exports[_0x221e('0x7b')]=function(_0x549da9,_0x5c9909){if(_0x549da9[_0x221e('0x6e')]['id']){delete _0x549da9[_0x221e('0x6e')]['id'];}return db[_0x221e('0x54')][_0x221e('0x6c')]({'where':{'id':_0x549da9[_0x221e('0x69')]['id']}})[_0x221e('0x14')](handleEntityNotFound(_0x5c9909,null))[_0x221e('0x14')](function(_0x431c6a){if(_0x431c6a){_0x549da9[_0x221e('0x6e')]['ChatWebsiteId']=_0x431c6a['id'];return db[_0x221e('0x7c')][_0x221e('0x6d')](_0x549da9[_0x221e('0x6e')]);}})[_0x221e('0x14')](respondWithResult(_0x5c9909,null))[_0x221e('0x1e')](handleError(_0x5c9909,null));};exports['getAnswers']=function(_0x2e0734,_0x34892d){var _0x21beb8={'raw':![],'where':{}};var _0x11197a={};var _0x1087fb={'count':0x0,'rows':[]};return db[_0x221e('0x54')][_0x221e('0x7d')]({'where':{'id':_0x2e0734[_0x221e('0x69')]['id']}})[_0x221e('0x14')](handleEntityNotFound(_0x34892d,null))[_0x221e('0x14')](function(_0x5c559d){if(_0x5c559d){_0x11197a[_0x221e('0x50')]=_[_0x221e('0x5a')](db[_0x221e('0x7c')][_0x221e('0x55')]);_0x11197a[_0x221e('0x59')]=_[_0x221e('0x5a')](_0x2e0734[_0x221e('0x59')]);_0x11197a[_0x221e('0x5b')]=_[_0x221e('0x5d')](_0x11197a[_0x221e('0x50')],_0x11197a[_0x221e('0x59')]);_0x21beb8[_0x221e('0x5c')]=_['intersection'](_0x11197a[_0x221e('0x50')],qs['fields'](_0x2e0734['query']['fields']));_0x21beb8[_0x221e('0x5c')]=_0x21beb8['attributes']['length']?_0x21beb8[_0x221e('0x5c')]:_0x11197a['model'];if(!_0x2e0734[_0x221e('0x59')][_0x221e('0x75')](_0x221e('0x76'))){_0x21beb8['limit']=qs[_0x221e('0x23')](_0x2e0734[_0x221e('0x59')][_0x221e('0x23')]);_0x21beb8[_0x221e('0x26')]=qs[_0x221e('0x26')](_0x2e0734[_0x221e('0x59')][_0x221e('0x26')]);}_0x21beb8[_0x221e('0x60')]=qs['sort'](_0x2e0734[_0x221e('0x59')][_0x221e('0x61')]);_0x21beb8[_0x221e('0x62')]=qs[_0x221e('0x5b')](_[_0x221e('0x63')](_0x2e0734[_0x221e('0x59')],_0x11197a[_0x221e('0x5b')]));_0x21beb8[_0x221e('0x62')][_0x221e('0x7e')]=_0x5c559d['id'];if(_0x2e0734[_0x221e('0x59')][_0x221e('0x64')]){_0x21beb8[_0x221e('0x62')]=_['merge'](_0x21beb8['where'],{'$or':_[_0x221e('0x58')](_0x21beb8['attributes'],function(_0x2d3229){var _0x1e6e55={};_0x1e6e55[_0x2d3229]={'$like':'%'+_0x2e0734[_0x221e('0x59')][_0x221e('0x64')]+'%'};return _0x1e6e55;})});}_0x21beb8=_[_0x221e('0x65')]({},_0x21beb8,_0x2e0734['options']);return db[_0x221e('0x7c')][_0x221e('0x25')]({'where':_0x21beb8[_0x221e('0x62')]})[_0x221e('0x14')](function(_0x309a3b){_0x1087fb[_0x221e('0x25')]=_0x309a3b;if(_0x2e0734[_0x221e('0x59')][_0x221e('0x6a')]){_0x21beb8[_0x221e('0x67')]=[{'all':!![]}];}return db[_0x221e('0x7c')]['findAll'](_0x21beb8);})[_0x221e('0x14')](function(_0x4a1ac5){_0x1087fb[_0x221e('0x78')]=_0x4a1ac5;return _0x1087fb;});}})['then'](respondWithFilteredResult(_0x34892d,_0x21beb8))[_0x221e('0x1e')](handleError(_0x34892d,null));};exports['removeAnswers']=function(_0x18d463,_0x1ae87f){return db[_0x221e('0x54')]['find']({'where':{'id':_0x18d463['params']['id']}})[_0x221e('0x14')](handleEntityNotFound(_0x1ae87f,null))[_0x221e('0x14')](function(_0xb5d8b8){if(_0xb5d8b8){return _0xb5d8b8[_0x221e('0x7f')](_0x18d463[_0x221e('0x59')][_0x221e('0x7a')]);}})[_0x221e('0x14')](respondWithStatusCode(_0x1ae87f,null))[_0x221e('0x1e')](handleError(_0x1ae87f,null));};exports['addLogo']=function(_0x3aca6c,_0x95829){_0x3aca6c[_0x221e('0x6e')][_0x221e('0x80')]=_0x3aca6c[_0x221e('0x81')]['filename'];return db[_0x221e('0x54')]['find']({'where':{'id':_0x3aca6c['params']['id']}})[_0x221e('0x14')](handleEntityNotFound(_0x95829,null))[_0x221e('0x14')](saveUpdates(_0x3aca6c['body'],null))[_0x221e('0x14')](respondWithResult(_0x95829,null))[_0x221e('0x1e')](handleError(_0x95829,null));};exports[_0x221e('0x82')]=function(_0x29c970,_0x356cf2){_0x29c970[_0x221e('0x6e')][_0x221e('0x83')]=_0x29c970[_0x221e('0x81')][_0x221e('0x84')];return db[_0x221e('0x54')][_0x221e('0x6c')]({'where':{'id':_0x29c970['params']['id']}})['then'](handleEntityNotFound(_0x356cf2,null))[_0x221e('0x14')](saveUpdates(_0x29c970[_0x221e('0x6e')],null))[_0x221e('0x14')](respondWithResult(_0x356cf2,null))[_0x221e('0x1e')](handleError(_0x356cf2,null));};exports[_0x221e('0x85')]=function(_0x469c9b,_0x917291){_0x469c9b[_0x221e('0x6e')][_0x221e('0x86')]=_0x469c9b[_0x221e('0x81')]['filename'];return db[_0x221e('0x54')][_0x221e('0x6c')]({'where':{'id':_0x469c9b[_0x221e('0x69')]['id']}})[_0x221e('0x14')](handleEntityNotFound(_0x917291,null))[_0x221e('0x14')](saveUpdates(_0x469c9b[_0x221e('0x6e')],null))['then'](respondWithResult(_0x917291,null))['catch'](handleError(_0x917291,null));};exports[_0x221e('0x87')]=function(_0x2c0fbf,_0x45b151){_0x2c0fbf[_0x221e('0x6e')][_0x221e('0x88')]=_0x2c0fbf[_0x221e('0x81')][_0x221e('0x84')];return db[_0x221e('0x54')][_0x221e('0x6c')]({'where':{'id':_0x2c0fbf[_0x221e('0x69')]['id']}})['then'](handleEntityNotFound(_0x45b151,null))[_0x221e('0x14')](saveUpdates(_0x2c0fbf['body'],null))[_0x221e('0x14')](respondWithResult(_0x45b151,null))['catch'](handleError(_0x45b151,null));};exports[_0x221e('0x89')]=function(_0x2aa816,_0x3b99d5){var _0x530d61=path[_0x221e('0x8a')](config['root'],_0x221e('0x8b'));var _0x5ca14a={'where':{'id':_0x2aa816['params']['id']},'attributes':['id',_0x221e('0x80')],'raw':!![]};var _0x101002=![];return require(_0x221e('0x8c'))['getLicense']()[_0x221e('0x14')](function(_0x1dbfde){if(_0x1dbfde){_0x101002=_0x1dbfde[_0x221e('0x8d')];}})[_0x221e('0x14')](function(){return db[_0x221e('0x54')]['find'](_0x5ca14a);})[_0x221e('0x14')](handleEntityNotFound(_0x3b99d5,null))[_0x221e('0x14')](function(_0x45eecc){if(_0x45eecc){if(!_[_0x221e('0x8e')](_0x45eecc['sitepic'])){if(fs['existsSync'](path[_0x221e('0x8a')](config[_0x221e('0x8f')],'server/files/images/logos/',_0x45eecc[_0x221e('0x80')]))&&_0x101002){_0x530d61=path[_0x221e('0x8a')](config[_0x221e('0x8f')],_0x221e('0x90'),_0x45eecc[_0x221e('0x80')]);}}return _0x3b99d5[_0x221e('0x91')](_0x530d61);}})['catch'](handleError(_0x3b99d5,null));};exports[_0x221e('0x92')]=function(_0x5b7eb2,_0x4154ee){var _0x4d67db=path[_0x221e('0x8a')](config[_0x221e('0x8f')],_0x221e('0x93'));var _0x1c7f27={'where':{'id':_0x5b7eb2[_0x221e('0x69')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x221e('0x54')]['find'](_0x1c7f27)[_0x221e('0x14')](handleEntityNotFound(_0x4154ee,null))['then'](function(_0x3e39a5){if(_0x3e39a5){if(!_['isNil'](_0x3e39a5[_0x221e('0x83')])){if(fs[_0x221e('0x94')](path[_0x221e('0x8a')](config[_0x221e('0x8f')],'server/files/images/avatars/',_0x3e39a5['agentAvatar']))){_0x4d67db=path['join'](config[_0x221e('0x8f')],_0x221e('0x95'),_0x3e39a5[_0x221e('0x83')]);}}return _0x4154ee[_0x221e('0x91')](_0x4d67db);}})[_0x221e('0x1e')](handleError(_0x4154ee,null));};exports[_0x221e('0x96')]=function(_0x254447,_0x448096){var _0x2dae79=path[_0x221e('0x8a')](config[_0x221e('0x8f')],_0x221e('0x97'));var _0x1e0a88={'where':{'id':_0x254447['params']['id']},'attributes':['id',_0x221e('0x86'),_0x221e('0x98')],'raw':!![]};return db[_0x221e('0x54')]['find'](_0x1e0a88)['then'](handleEntityNotFound(_0x448096,null))[_0x221e('0x14')](function(_0x45c05d){if(_0x45c05d){if(!_[_0x221e('0x8e')](_0x45c05d[_0x221e('0x86')])){if(fs[_0x221e('0x94')](path[_0x221e('0x8a')](config[_0x221e('0x8f')],_0x221e('0x95'),_0x45c05d[_0x221e('0x86')]))&&_0x45c05d[_0x221e('0x98')]){_0x2dae79=path[_0x221e('0x8a')](config[_0x221e('0x8f')],_0x221e('0x95'),_0x45c05d[_0x221e('0x86')]);}}return _0x448096[_0x221e('0x91')](_0x2dae79);}})[_0x221e('0x1e')](handleError(_0x448096,null));};exports[_0x221e('0x99')]=function(_0x18f3b8,_0x296e8a){var _0xad5ed9=path[_0x221e('0x8a')](config[_0x221e('0x8f')],_0x221e('0x9a'));var _0x343ae4={'where':{'id':_0x18f3b8[_0x221e('0x69')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0x221e('0x6c')](_0x343ae4)['then'](handleEntityNotFound(_0x296e8a,null))[_0x221e('0x14')](function(_0x250b27){if(_0x250b27){if(!_[_0x221e('0x8e')](_0x250b27[_0x221e('0x88')])){if(fs[_0x221e('0x94')](path[_0x221e('0x8a')](config[_0x221e('0x8f')],_0x221e('0x95'),_0x250b27['systemAvatar']))){_0xad5ed9=path['join'](config[_0x221e('0x8f')],_0x221e('0x95'),_0x250b27['systemAvatar']);}}return _0x296e8a[_0x221e('0x91')](_0xad5ed9);}})[_0x221e('0x1e')](handleError(_0x296e8a,null));};exports[_0x221e('0x9b')]=function(_0x49833f,_0x35ed75){var _0x54238c={'body':_0x49833f[_0x221e('0x6e')],'channel':'chat'};var _0x451ce6=[];var _0x5e44ba=[];var _0x16b22a={};var _0x2a2fbb=![];return db[_0x221e('0x9c')]['describe']()[_0x221e('0x14')](function(_0x56bb4e){if(!_0x56bb4e){throw new db['Sequelize'][(_0x221e('0x9d'))](_0x221e('0x9e'));}_0x451ce6=_[_0x221e('0x9f')](_[_0x221e('0x5a')](_0x56bb4e),[_0x221e('0xa0'),_0x221e('0xa1')]);_0x5e44ba=_['difference'](_[_0x221e('0x5a')](_0x56bb4e),[_0x221e('0xa0'),_0x221e('0xa1'),_0x221e('0xa2'),_0x221e('0xa3')]);if(_0x49833f[_0x221e('0x6e')]['id']){delete _0x49833f[_0x221e('0x6e')]['id'];}if(_[_0x221e('0x8e')](_0x49833f[_0x221e('0x6e')]['from'])){throw new db[(_0x221e('0xa4'))][(_0x221e('0x9d'))](_0x221e('0xa5'));}if(_[_0x221e('0x8e')](_0x49833f[_0x221e('0x6e')][_0x221e('0x6e')])||_0x49833f[_0x221e('0x6e')][_0x221e('0x6e')]===''){throw new db[(_0x221e('0xa4'))][(_0x221e('0x9d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x221e('0x8e')](_0x49833f['body'][_0x221e('0xa6')])){throw new db[(_0x221e('0xa4'))][(_0x221e('0x9d'))](_0x221e('0xa7')+_0x5e44ba);}if(!_['includes'](_0x5e44ba,_0x49833f[_0x221e('0x6e')]['mapKey'])){throw new db[(_0x221e('0xa4'))][(_0x221e('0x9d'))](_0x221e('0xa8')+_0x5e44ba);}_0x16b22a[_0x49833f['body'][_0x221e('0xa6')]]=_0x49833f[_0x221e('0x6e')][_0x221e('0xa9')];})[_0x221e('0x14')](function(){return db[_0x221e('0x54')]['find']({'where':{'id':_0x49833f[_0x221e('0x69')]['id']},'include':[{'model':db['CmList'],'as':_0x221e('0xaa'),'include':[{'model':db[_0x221e('0x9c')],'as':_0x221e('0xab'),'where':_0x16b22a,'limit':0x1,'order':[[_0x221e('0xa1'),_0x221e('0xac')]]}]},{'model':db[_0x221e('0xad')],'as':_0x221e('0xae')},{'model':db[_0x221e('0x3c')],'as':_0x221e('0x3c'),'include':[{'model':db[_0x221e('0x3c')],'as':_0x221e('0x3d'),'attributes':['id',_0x221e('0x33')],'raw':!![]}]}]});})[_0x221e('0x14')](function(_0x4cfe7a){if(!_0x4cfe7a)throw new APINotFoundError(util[_0x221e('0x31')](_0x221e('0xaf'),_0x49833f[_0x221e('0x69')]['id']));if(!_0x4cfe7a[_0x221e('0x3c')]||!_0x4cfe7a[_0x221e('0x3c')][_0x221e('0x3d')])return[_0x4cfe7a,!![]];return[_0x4cfe7a,checkWebsiteIntervals(_0x4cfe7a)];})[_0x221e('0xb0')](function(_0x22ebe9,_0x4a07cc){if(!_0x4a07cc)throw new APIOutOfIntervalError();if(!_0x22ebe9['List'])return;_0x54238c['account']=_0x22ebe9;_0x54238c[_0x221e('0xb1')]=_0x22ebe9[_0x221e('0xaa')];_0x54238c[_0x221e('0xb2')]=_[_0x221e('0xb3')](_0x22ebe9[_0x221e('0xae')],[_0x221e('0xb4')],[_0x221e('0xb5')]);if(_0x54238c[_0x221e('0xb6')][_0x221e('0xae')]){delete _0x54238c[_0x221e('0xb6')][_0x221e('0xae')];}if(_0x54238c['account'][_0x221e('0xaa')]&&_0x54238c[_0x221e('0xb6')][_0x221e('0xaa')][_0x221e('0xab')][_0x221e('0x5f')]){return _0x54238c[_0x221e('0xb6')][_0x221e('0xaa')][_0x221e('0xab')][0x0];}var _0x92de3f=_[_0x221e('0xd')](_0x49833f[_0x221e('0x6e')],{'firstName':_0x49833f[_0x221e('0x6e')][_0x221e('0xa9')],'ListId':_0x22ebe9[_0x221e('0xa3')]});_0x92de3f[_0x49833f[_0x221e('0x6e')][_0x221e('0xa6')]]=_0x49833f[_0x221e('0x6e')]['from'];return db[_0x221e('0x9c')][_0x221e('0x6d')](_0x92de3f,{'fields':_0x451ce6,'raw':!![]});})[_0x221e('0x14')](function(_0x5a1984){_0x54238c['contact']=_0x5a1984;var _0x5ee3e0=createInteractionObject(_0x49833f['params']['id'],_0x49833f['body'],_0x49833f['headers'],_0x5a1984);var _0x5f53a8={'ChatWebsiteId':_0x49833f[_0x221e('0x69')]['id'],'closed':![]};if(_0x49833f[_0x221e('0x6e')]['threadId']){_0x5f53a8[_0x221e('0xb7')]=_0x49833f[_0x221e('0x6e')][_0x221e('0xb7')];return db['ChatInteraction']['find']({'where':_0x5f53a8})[_0x221e('0x14')](function(_0x4aad49){if(_0x4aad49){_0x2a2fbb=!![];return _0x4aad49;}_0x5ee3e0[_0x221e('0xb7')]=_0x49833f[_0x221e('0x6e')][_0x221e('0xb7')];_0x5ee3e0[_0x221e('0xb8')]=_0x49833f['body'][_0x221e('0xb8')];return db[_0x221e('0xb9')]['create'](_0x5ee3e0);});}_0x5f53a8[_0x221e('0xba')]=_0x5a1984['id'];if(_0x49833f['body'][_0x221e('0xbb')]&&_0x49833f[_0x221e('0x6e')][_0x221e('0xbb')]['id']){_0x5f53a8['id']=_0x49833f[_0x221e('0x6e')][_0x221e('0xbb')]['id'];return db['ChatInteraction'][_0x221e('0x6c')]({'where':_0x5f53a8})[_0x221e('0x14')](function(_0x3a2e9d){if(_0x3a2e9d){_0x2a2fbb=!![];return _0x3a2e9d;}return db[_0x221e('0xb9')]['create'](_0x5ee3e0);});}return db[_0x221e('0xb9')]['create'](_0x5ee3e0);})[_0x221e('0x14')](function(_0x33a124){if(!_0x2a2fbb)return _0x33a124;var _0x11fc7e={'from':(_0x54238c[_0x221e('0xbc')][_0x221e('0x47')]||'')+'\x20'+(_0x54238c[_0x221e('0xbc')][_0x221e('0xbd')]||'')};if(_0x49833f['body'][_0x221e('0xb7')]&&_0x49833f[_0x221e('0x6e')][_0x221e('0xbe')]&&_0x49833f['body']['threadId']!=_0x49833f['body'][_0x221e('0xbe')]){_0x11fc7e[_0x221e('0xb7')]=_0x49833f[_0x221e('0x6e')][_0x221e('0xbe')];}return _0x33a124[_0x221e('0x28')](_0x11fc7e);})[_0x221e('0x14')](function(_0x2c913e){_0x54238c[_0x221e('0xbb')]=_0x2c913e['get']({'plain':!![]});_0x54238c[_0x221e('0xbb')][_0x221e('0xbf')]=!_0x2a2fbb;if(_0x54238c[_0x221e('0xbb')]['created']){if(_0x54238c['account']['autoclose']){_0x54238c[_0x221e('0xb2')][_0x221e('0xc0')]({'id':0x0,'priority':_0x54238c[_0x221e('0xb2')]['length']+0x1,'app':_0x221e('0xc1'),'appdata':_0x221e('0xc2'),'interval':_0x221e('0xc3')});}}return db[_0x221e('0xc4')][_0x221e('0x6d')]({'body':_0x49833f[_0x221e('0x6e')][_0x221e('0x6e')],'ChatWebsiteId':_0x49833f['params']['id'],'ChatInteractionId':_0x2c913e['id'],'direction':'in','ContactId':_0x54238c[_0x221e('0xbc')]['id'],'AttachmentId':_0x49833f['body'][_0x221e('0xc5')]});})[_0x221e('0x14')](function(_0x7c5a95){_0x54238c[_0x221e('0x1d')]=_0x7c5a95;if(!_0x54238c['interaction'][_0x221e('0xc6')]){return;}return db['User'][_0x221e('0x6c')]({'attributes':['id',_0x221e('0x2e')],'where':{'id':_0x54238c[_0x221e('0xbb')][_0x221e('0xc6')]}});})[_0x221e('0x14')](function(_0x513548){if(_0x513548){_0x54238c['applications'][_0x221e('0xc7')]({'id':0x0,'priority':0x0,'app':_0x221e('0xc8'),'appdata':_0x513548[_0x221e('0x2e')]+','+(_0x54238c[_0x221e('0xb6')][_0x221e('0xc9')]||0xa),'interval':_0x221e('0xc3')});_0x54238c[_0x221e('0xca')]=!![];}if(!_0x54238c[_0x221e('0xbb')][_0x221e('0xcb')]){return;}return db[_0x221e('0xcc')][_0x221e('0x6c')]({'attributes':['id','name'],'where':{'id':_0x54238c[_0x221e('0xbb')][_0x221e('0xcb')]}});})['then'](function(_0x42e7d3){if(_0x42e7d3){_0x54238c[_0x221e('0xb2')][_0x221e('0xc7')]({'id':0x0,'priority':0x1,'app':_0x221e('0xcd'),'appdata':_0x42e7d3[_0x221e('0x2e')]+','+(_0x54238c[_0x221e('0xb6')][_0x221e('0xce')]||0x12c),'interval':_0x221e('0xc3')});}return respondWithRpcPromise(_0x221e('0xcf'),_0x221e('0xd0'),_0x54238c);})['then'](function(_0x312251){respondWithRpcPromise('EventManager','EventManager',{'event':_0x221e('0x9b'),'message':_0x312251},client9002);return _0x312251;})[_0x221e('0x14')](respondWithResult(_0x35ed75,null))[_0x221e('0x1e')](APIHandleError(_0x35ed75));};exports[_0x221e('0xd1')]=function(_0x4c4e00,_0xb07241){var _0x51ac19,_0x564bc9,_0x355aa2;var _0x362a1b=[];var _0x13d06={};var _0x5a4dd9=_0x4c4e00[_0x221e('0xd2')]||[];var _0x1fba15=[];var _0x42a2e4;return db[_0x221e('0x9c')][_0x221e('0x72')]()[_0x221e('0x14')](function(_0x1da919){if(!_0x1da919){throw new db[(_0x221e('0xa4'))][(_0x221e('0x9d'))](_0x221e('0x9e'));}_0x362a1b=_[_0x221e('0x9f')](_[_0x221e('0x5a')](_0x1da919),[_0x221e('0xa0'),_0x221e('0xa1'),_0x221e('0xa2'),_0x221e('0xa3')]);if(_0x4c4e00[_0x221e('0x6e')]['id']){delete _0x4c4e00[_0x221e('0x6e')]['id'];}if(_[_0x221e('0x8e')](_0x4c4e00[_0x221e('0x6e')]['from'])){throw _0xb07241[_0x221e('0x20')](0x1f4)[_0x221e('0x2f')](new db[(_0x221e('0xa4'))][(_0x221e('0x9d'))](_0x221e('0xa5')));}if(_['isNil'](_0x4c4e00[_0x221e('0x6e')][_0x221e('0x6e')])||_0x4c4e00[_0x221e('0x6e')][_0x221e('0x6e')]===''){throw _0xb07241[_0x221e('0x20')](0x1f4)[_0x221e('0x2f')](new db[(_0x221e('0xa4'))][(_0x221e('0x9d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x221e('0x8e')](_0x4c4e00[_0x221e('0x6e')][_0x221e('0xd3')])){throw _0xb07241[_0x221e('0x20')](0x1f4)['send'](new db[(_0x221e('0xa4'))]['ValidationError'](_0x221e('0xd4')+_0x362a1b));}if(!_[_0x221e('0xd5')](_0x362a1b,_0x4c4e00[_0x221e('0x6e')][_0x221e('0xd3')])){throw _0xb07241[_0x221e('0x20')](0x1f4)['send'](new db[(_0x221e('0xa4'))][(_0x221e('0x9d'))](_0x221e('0xd6')+_0x362a1b));}_0x13d06[_0x4c4e00[_0x221e('0x6e')][_0x221e('0xd3')]]=_0x4c4e00[_0x221e('0x6e')][_0x221e('0xa9')];})[_0x221e('0x14')](function(){return db[_0x221e('0x54')][_0x221e('0x6c')]({'where':{'id':_0x4c4e00[_0x221e('0x69')]['id']},'include':[{'model':db[_0x221e('0xd7')],'as':'List'},{'model':db[_0x221e('0xd8')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0xb07241,null))[_0x221e('0x14')](function(_0x2a55b2){if(_0x2a55b2&&_0x2a55b2[_0x221e('0xaa')]){_0x564bc9=_0x2a55b2;var _0x28ef87=_[_0x221e('0xd')](_0x4c4e00[_0x221e('0x6e')],{'firstName':_0x4c4e00[_0x221e('0x6e')][_0x221e('0xa9')],'phone':_0x4c4e00[_0x221e('0x6e')]['from'],'ListId':_0x2a55b2['ListId']});_0x28ef87[_0x4c4e00[_0x221e('0x6e')][_0x221e('0xd3')]]=_0x4c4e00[_0x221e('0x6e')][_0x221e('0xa9')];return db[_0x221e('0x9c')][_0x221e('0xd9')]({'where':_0x13d06,'defaults':_0x28ef87});}})[_0x221e('0xb0')](function(_0x1dc3d7){if(_0x1dc3d7){_0x355aa2=_0x1dc3d7;var _0x1c6460=fs['readFileSync'](path[_0x221e('0x8a')](config[_0x221e('0x8f')],_0x221e('0xda')),_0x221e('0xdb'));var _0x15573b=ejs[_0x221e('0xdc')](_0x1c6460,{'body':_[_0x221e('0xdd')](_0x4c4e00[_0x221e('0x6e')]['body']),'bodyTitle':_0x564bc9[_0x221e('0xde')]});return db[_0x221e('0xdf')][_0x221e('0x6d')]({'body':_0x15573b,'plainBody':htmlToText['fromString'](_0x15573b),'ContactId':_0x1dc3d7['id'],'ChatWebsiteId':_0x564bc9['id']});}})[_0x221e('0x14')](function(_0xb2ef93){_0x42a2e4=_0xb2ef93;if(_0x5a4dd9[_0x221e('0x5f')]){var _0xfe9f1=_0x5a4dd9['map'](function(_0x451271){return{'name':_0x451271[_0x221e('0xe0')],'basename':_0x451271['filename'],'type':_0x451271[_0x221e('0xe1')],'ChatOfflineMessageId':_0xb2ef93['id']};});_0x1fba15=_0xfe9f1['map'](_0x299688=>{var _0x43f957={'filename':_0x299688['name'],'path':path[_0x221e('0x8a')](config['root'],_0x221e('0xe2'),_0x221e('0xd2'),_0x221e('0xe3'),'offline-chat',_0x299688['basename'])};return _0x43f957;});if(!_0x564bc9[_0x221e('0xe4')]){return db[_0x221e('0xe5')]['transaction'](function(_0x3126aa){return db[_0x221e('0xe6')][_0x221e('0xe7')](_0xfe9f1,{'transaction':_0x3126aa});});}}})[_0x221e('0x14')](function(){if(_0x42a2e4){_0x51ac19=_0x42a2e4;return db[_0x221e('0xd8')][_0x221e('0x7d')]({'where':{'service':!![]},'include':[{'model':db[_0x221e('0xe8')],'as':_0x221e('0xe9'),'raw':!![],'include':[{'model':db[_0x221e('0xea')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x221e('0x14')](function(_0x41896d){if(_0x41896d&&_0x41896d[_0x221e('0xe9')]&&_0x564bc9['forwardOffline']&&_0x564bc9[_0x221e('0xeb')]){var _0x57eda6=_0x41896d[_0x221e('0xec')]();return respondWithRpcPromise(_0x221e('0xed'),'sendMail',{'account':_0x57eda6,'message':{'from':util[_0x221e('0x31')](_0x221e('0xee'),_0x41896d[_0x221e('0x2e')],_0x41896d[_0x221e('0xef')]||_0x41896d[_0x221e('0xe9')][_0x221e('0xf0')]),'to':_0x564bc9[_0x221e('0xeb')],'subject':_0x564bc9[_0x221e('0xf1')],'html':_0x51ac19[_0x221e('0x6e')],'attachments':_0x1fba15}},client9003)[_0x221e('0x14')](function(){return _0x51ac19;})[_0x221e('0x1e')](function(_0x3c8249){logger[_0x221e('0x1b')](_0x3c8249);});}})[_0x221e('0x14')](function(){if(_0x564bc9&&_0x564bc9[_0x221e('0xe4')]&&_0x564bc9[_0x221e('0xf2')]){var _0x57c6dc=[];if(_0x5a4dd9[_0x221e('0x5f')]){_0x57c6dc=_0x5a4dd9[_0x221e('0x58')](function(_0x172457){return{'name':_0x172457[_0x221e('0xe0')],'basename':_0x172457['filename'],'type':_0x172457[_0x221e('0xe1')],'ChatOfflineMessageId':_0x42a2e4['id']};});}var _0x24d4f4;if(!_[_0x221e('0x8e')](_0x564bc9[_0x221e('0xf3')])){var _0xb717c4=_[_0x221e('0x58')](_0x4c4e00[_0x221e('0x6e')],function(_0x5b5c45){return _0x5b5c45;});var _0x2b6655=_['toPairsIn'](_0xb717c4)[0x0];var _0x104108=_[_0x221e('0xf4')](_0x2b6655,function(_0x2ca1d7){return _0x2ca1d7;});_0x24d4f4=_0x104108[0x1][_0x564bc9['subjectOffline']];}var _0x596e71={'from':_0x355aa2['email'],'firstName':_0x355aa2[_0x221e('0x47')],'lastName':_0x355aa2[_0x221e('0xbd')],'mapKey':_0x221e('0xef'),'message':{'from':_0x355aa2['email'],'to':_0x564bc9[_0x221e('0xd8')][_0x221e('0xef')],'cc':'','subject':_['isNil'](_0x24d4f4)?_0x564bc9[_0x221e('0xf1')]:_0x24d4f4,'messageId':'','sentAt':new Date(),'attach':_0x57c6dc[_0x221e('0x5f')],'attachments':_0x57c6dc,'originChannel':_0x221e('0xf5'),'ChatWebsiteId':_0x564bc9['id'],'ChatOfflineMessageId':_0x51ac19['id'],'originTo':_0x564bc9[_0x221e('0xd8')]['email']},'body':_0x51ac19[_0x221e('0x6e')]};var _0x4df2dd={'account':{'id':_0x564bc9[_0x221e('0xf2')]},'body':_0x596e71,'log':_0x221e('0xf6')};return respondWithRpcPromise('NotifyMailAccount',_0x221e('0xf7'),_0x4df2dd,client9001)['then'](function(){return _0x51ac19;})['catch'](function(_0xf6c130){logger[_0x221e('0x1b')](_0xf6c130);});}return;})[_0x221e('0x14')](function(){if(_0x51ac19){return _0x51ac19;}})[_0x221e('0x14')](respondWithResult(_0xb07241,null))[_0x221e('0x1e')](function(){for(var _0x4473eb of _0x5a4dd9){var _0x43a729=path[_0x221e('0x8a')](config[_0x221e('0x8f')],_0x221e('0xe2'),'files',_0x221e('0xe3'),'offline-chat',_0x4473eb[_0x221e('0x84')]);fs_extra[_0x221e('0xf8')](_0x43a729)[_0x221e('0x1e')](function(_0x2ca14b){logger[_0x221e('0x1b')]('Could\x20not\x20remove\x20attachment\x20file',_0x43a729,_0x2ca14b);});}});};exports['addInteraction']=function(_0x39dfd4,_0x3e6810){return db[_0x221e('0xb9')]['find']({'where':{'id':_0x39dfd4[_0x221e('0x69')]['id']}})[_0x221e('0x14')](handleEntityNotFound(_0x3e6810,null))[_0x221e('0x14')](function(_0x175ff4){if(_0x175ff4){return _0x175ff4[_0x221e('0xf9')](_0x39dfd4[_0x221e('0x6e')][_0x221e('0x7a')],_[_0x221e('0xfa')](_0x39dfd4['body'],[_0x221e('0x7a'),'id'])||{});}})['then'](respondWithResult(_0x3e6810,null))[_0x221e('0x1e')](handleError(_0x3e6810,null));};exports[_0x221e('0xfb')]=function(_0x53b796,_0x5f2db1){var _0x182064={'raw':![],'where':{}};var _0x24f988={};var _0x21504b={'count':0x0,'rows':[]};return db[_0x221e('0x54')][_0x221e('0x7d')]({'where':{'id':_0x53b796[_0x221e('0x69')]['id']}})[_0x221e('0x14')](handleEntityNotFound(_0x5f2db1,null))[_0x221e('0x14')](function(_0x51b695){if(_0x51b695){_0x24f988[_0x221e('0x50')]=_[_0x221e('0x5a')](db[_0x221e('0xb9')][_0x221e('0x55')]);_0x24f988[_0x221e('0x59')]=_['keys'](_0x53b796[_0x221e('0x59')]);_0x24f988[_0x221e('0x5b')]=_[_0x221e('0x5d')](_0x24f988[_0x221e('0x50')],_0x24f988[_0x221e('0x59')]);_0x182064[_0x221e('0x5c')]=_['intersection'](_0x24f988[_0x221e('0x50')],qs[_0x221e('0x5e')](_0x53b796['query'][_0x221e('0x5e')]));_0x182064[_0x221e('0x5c')]=_0x182064[_0x221e('0x5c')][_0x221e('0x5f')]?_0x182064[_0x221e('0x5c')]:_0x24f988[_0x221e('0x50')];if(!_0x53b796['query'][_0x221e('0x75')](_0x221e('0x76'))){_0x182064[_0x221e('0x23')]=qs[_0x221e('0x23')](_0x53b796[_0x221e('0x59')][_0x221e('0x23')]);_0x182064[_0x221e('0x26')]=qs[_0x221e('0x26')](_0x53b796[_0x221e('0x59')][_0x221e('0x26')]);}_0x182064[_0x221e('0x60')]=qs[_0x221e('0x61')](_0x53b796[_0x221e('0x59')][_0x221e('0x61')]);_0x182064['where']=qs[_0x221e('0x5b')](_['pick'](_0x53b796[_0x221e('0x59')],_0x24f988[_0x221e('0x5b')]));_0x182064[_0x221e('0x62')][_0x221e('0x7e')]=_0x51b695['id'];if(_0x53b796[_0x221e('0x59')][_0x221e('0x64')]){_0x182064[_0x221e('0x62')]=_[_0x221e('0x65')](_0x182064[_0x221e('0x62')],{'$or':_[_0x221e('0x58')](_0x182064[_0x221e('0x5c')],function(_0x3a3b88){var _0x71db9f={};_0x71db9f[_0x3a3b88]={'$like':'%'+_0x53b796[_0x221e('0x59')][_0x221e('0x64')]+'%'};return _0x71db9f;})});}_0x182064=_[_0x221e('0x65')]({},_0x182064,_0x53b796[_0x221e('0x6b')]);return db['ChatInteraction'][_0x221e('0x25')]({'where':_0x182064[_0x221e('0x62')]})[_0x221e('0x14')](function(_0x501be5){_0x21504b[_0x221e('0x25')]=_0x501be5;if(_0x53b796[_0x221e('0x59')][_0x221e('0x6a')]){_0x182064[_0x221e('0x67')]=[{'model':db[_0x221e('0x9c')],'as':_0x221e('0xfc'),'required':![]},{'model':db[_0x221e('0xfd')],'as':'Owner','attributes':[_0x221e('0x2e'),_0x221e('0xfe'),_0x221e('0xff')],'required':![]},{'model':db[_0x221e('0x100')],'as':_0x221e('0x101'),'attributes':['id',_0x221e('0x2e'),_0x221e('0x102')],'where':_0x53b796[_0x221e('0x59')][_0x221e('0x103')]?{'id':_0x53b796[_0x221e('0x59')][_0x221e('0x103')]}:undefined,'required':_0x53b796[_0x221e('0x59')][_0x221e('0x103')]?!![]:![]}];}return db[_0x221e('0xb9')][_0x221e('0x77')](_0x182064);})[_0x221e('0x14')](function(_0x5986e2){_0x21504b[_0x221e('0x78')]=_0x5986e2;return _0x21504b;});}})['then'](respondWithFilteredResult(_0x5f2db1,_0x182064))[_0x221e('0x1e')](handleError(_0x5f2db1,null));};exports[_0x221e('0x30')]=function(_0x43ad16,_0x556a46){var _0x535b7d=0x0;var _0x1de4b1=0x0;var _0x57e3c8=![];var _0x305d13;var _0x3e08a7;return db[_0x221e('0x54')][_0x221e('0x6c')]({'where':{'id':_0x43ad16[_0x221e('0x69')]['id']},'include':[{'model':db[_0x221e('0x3c')],'as':_0x221e('0x3c'),'include':[{'model':db[_0x221e('0x3c')],'as':_0x221e('0x3d'),'attributes':['id',_0x221e('0x33')]}]}]})[_0x221e('0x14')](handleEntityNotFound(_0x556a46,null))['then'](function(_0x269db9){if(_0x269db9){_0x305d13=_0x269db9;return _0x269db9[_0x221e('0x104')]({'raw':!![]});}})[_0x221e('0x14')](function(_0x65f67d){if(_0x305d13){if(_0x65f67d){_0x3e08a7=_0x65f67d;}}return require(_0x221e('0x8c'))[_0x221e('0x105')]();})[_0x221e('0x14')](function(_0x17031e){if(_0x17031e){_0x1de4b1=_0x17031e[_0x221e('0x106')];_0x57e3c8=_0x17031e['custom'];}})[_0x221e('0x14')](function(){return db[_0x221e('0xb9')][_0x221e('0x25')]({'where':{'closed':![]}});})[_0x221e('0x14')](function(_0x4051af){_0x535b7d=_0x4051af;if(_0x1de4b1&&_0x4051af>_0x1de4b1){return db[_0x221e('0x107')][_0x221e('0x7d')]({'where':{'id':0x1}})[_0x221e('0x14')](function(_0x28452e){if(_0x28452e){_0x28452e[_0x221e('0x108')](_0x221e('0x109'));}});}})[_0x221e('0x14')](function(){if(!_0x305d13[_0x221e('0x3c')]||!_0x305d13[_0x221e('0x3c')][_0x221e('0x3d')])return!![];return checkWebsiteIntervals(_0x305d13);})['then'](function(_0x4c9061){var _0x47abb6=fs[_0x221e('0x10a')](path['join'](config['root'],_0x221e('0x10b')),'utf8');var _0x3ea16d=new url['URL'](_0x305d13['address'])[_0x221e('0x10c')];var _0x5f5159=_0x221e('0x10d');var _0x5df5f0=![];var _0x3c37a0={'chatVersion':_0x5f5159,'chatWebsiteAddressOrigin':_0x3ea16d,'remote':_0x305d13[_0x221e('0x10e')],'query':querystring['stringify'](_[_0x221e('0x65')](_0x305d13['get']({'plain':!![]}),{'customerIp':_0x43ad16[_0x221e('0x10f')][_0x221e('0x110')]||_0x43ad16[_0x221e('0x10f')][_0x221e('0x111')]||_0x43ad16['connection'][_0x221e('0x112')]||_0x43ad16['ip'],'referer':_0x43ad16[_0x221e('0x10f')][_0x221e('0x113')],'openedInteractions':_0x535b7d,'maxInteractions':_0x1de4b1,'virtual':_0x57e3c8['virtual'],'online':_0x4c9061,'custom':_0x57e3c8}))[_0x221e('0x114')](/'/g,'\x5c\x27')};_0x556a46['send'](ejs[_0x221e('0xdc')](Mustache[_0x221e('0xdc')](_0x47abb6,_0x3c37a0),{'proactiveActions':_0x3e08a7,'alignment':_0x305d13['alignment'],'verticalAlignment':_0x305d13['verticalAlignment'],'div_color':_0x305d13[_0x221e('0x102')],'labelText':_0x305d13[_0x221e('0x115')],'text_color':_0x305d13[_0x221e('0x116')],'text_button_color':_0x305d13[_0x221e('0x117')],'button_color':_0x305d13[_0x221e('0x118')],'background_color':_0x305d13[_0x221e('0x119')],'hideWhenOffline':_0x305d13[_0x221e('0x11a')],'intervalId':_0x305d13['IntervalId'],'isDevelopment':_0x5df5f0,'chatVersion':_0x5f5159}));})['catch'](handleError(_0x556a46,null));};exports[_0x221e('0x11b')]=function(_0x21392f,_0x2603d7){var _0x10c1d3=_0x21392f['params']['id'];var _0x3df9e0=_0x21392f[_0x221e('0x6e')];var _0x39b92f=0xc8;var _0x2ea262=null;return db[_0x221e('0xe5')][_0x221e('0x11c')]({'isolationLevel':db[_0x221e('0xe5')][_0x221e('0x11d')][_0x221e('0x11e')][_0x221e('0x11f')]},function(_0x124fa2){return db[_0x221e('0x54')][_0x221e('0x7d')]({'where':{'id':_0x10c1d3},'transaction':_0x124fa2})[_0x221e('0x14')](function(_0x543eb5){if(_0x543eb5){return db[_0x221e('0xad')][_0x221e('0x2c')]({'where':{'ChatWebsiteId':_0x10c1d3},'transaction':_0x124fa2})[_0x221e('0x14')](function(){var _0x1d4c45=_[_0x221e('0x58')](_0x3df9e0,function(_0x2e76db){_0x2e76db[_0x221e('0x7e')]=_0x10c1d3;return _0x2e76db;});return db[_0x221e('0xad')]['bulkCreate'](_0x1d4c45,{'transaction':_0x124fa2});});}else{_0x39b92f=0x194;_0x2ea262=[];}});})['then'](function(){if(_0x39b92f!==0x194){return db['ChatApplication'][_0x221e('0x120')]({'where':{'ChatWebsiteId':_0x10c1d3},'order':_0x221e('0xb4')})['then'](function(_0x412a1b){_0x2ea262=_0x412a1b;});}})[_0x221e('0x1e')](function(_0x34117d){_0x39b92f=0x1f4;logger['error'](_0x34117d[_0x221e('0x2d')]);if(_0x34117d[_0x221e('0x2e')]){delete _0x34117d['name'];}_0x2ea262=_0x34117d;})['finally'](function(){if(_0x2ea262===null){_0x2603d7[_0x221e('0x1f')](_0x39b92f);}else{if(_0x39b92f===0x1f4){_0x2603d7[_0x221e('0x20')](_0x39b92f)[_0x221e('0x2f')](_0x2ea262);}else{_0x2603d7[_0x221e('0x20')](_0x39b92f)['json'](_0x2ea262);}}});};exports[_0x221e('0x121')]=function(_0x340e41,_0x1ee0b5){var _0x559369={};var _0x25a0d6={};var _0x3ec381;var _0x5e7ebe;return db['ChatWebsite'][_0x221e('0x7d')]({'where':{'id':_0x340e41[_0x221e('0x69')]['id']}})['then'](handleEntityNotFound(_0x1ee0b5,null))[_0x221e('0x14')](function(_0x52ad03){if(_0x52ad03){_0x3ec381=_0x52ad03;_0x25a0d6[_0x221e('0x50')]=_[_0x221e('0x5a')](db[_0x221e('0xad')][_0x221e('0x55')]);_0x25a0d6[_0x221e('0x59')]=_['keys'](_0x340e41[_0x221e('0x59')]);_0x25a0d6['filters']=_[_0x221e('0x5d')](_0x25a0d6[_0x221e('0x50')],_0x25a0d6[_0x221e('0x59')]);_0x559369[_0x221e('0x5c')]=_[_0x221e('0x5d')](_0x25a0d6[_0x221e('0x50')],qs['fields'](_0x340e41[_0x221e('0x59')][_0x221e('0x5e')]));_0x559369[_0x221e('0x5c')]=_0x559369[_0x221e('0x5c')][_0x221e('0x5f')]?_0x559369[_0x221e('0x5c')]:_0x25a0d6[_0x221e('0x50')];_0x559369['order']=qs[_0x221e('0x61')](_0x340e41[_0x221e('0x59')][_0x221e('0x61')]);_0x559369['where']=qs[_0x221e('0x5b')](_[_0x221e('0x63')](_0x340e41[_0x221e('0x59')],_0x25a0d6[_0x221e('0x5b')]));if(_0x340e41['query'][_0x221e('0x64')]){_0x559369[_0x221e('0x62')]=_[_0x221e('0x65')](_0x559369[_0x221e('0x62')],{'$or':_[_0x221e('0x58')](_0x559369['attributes'],function(_0x29a0c5){var _0x518097={};_0x518097[_0x29a0c5]={'$like':'%'+_0x340e41[_0x221e('0x59')][_0x221e('0x64')]+'%'};return _0x518097;})});}_0x559369=_['merge']({},_0x559369,_0x340e41[_0x221e('0x6b')]);return _0x3ec381[_0x221e('0x121')](_0x559369);}})[_0x221e('0x14')](function(_0x1f5c35){if(_0x1f5c35){_0x5e7ebe=_0x1f5c35['length'];if(!_0x340e41[_0x221e('0x59')][_0x221e('0x75')]('nolimit')){_0x559369[_0x221e('0x23')]=qs['limit'](_0x340e41['query'][_0x221e('0x23')]);_0x559369[_0x221e('0x26')]=qs[_0x221e('0x26')](_0x340e41[_0x221e('0x59')][_0x221e('0x26')]);}return _0x3ec381['getApplications'](_0x559369);}})['then'](function(_0x2717cc){if(_0x2717cc){return _0x2717cc?{'count':_0x5e7ebe,'rows':_0x2717cc}:null;}})[_0x221e('0x14')](respondWithResult(_0x1ee0b5,null))[_0x221e('0x1e')](handleError(_0x1ee0b5,null));};exports[_0x221e('0x122')]=function(_0x547907,_0x338d42){return db[_0x221e('0x123')][_0x221e('0x6c')]({'where':{'id':_0x547907[_0x221e('0x69')]['id']}})[_0x221e('0x14')](handleEntityNotFound(_0x338d42,null))[_0x221e('0x14')](function(_0x1db472){if(_0x1db472){return _0x1db472[_0x221e('0x122')](_0x547907[_0x221e('0x6e')][_0x221e('0x7a')],_[_0x221e('0xfa')](_0x547907[_0x221e('0x6e')],[_0x221e('0x7a'),'id'])||{});}})[_0x221e('0x14')](respondWithResult(_0x338d42,null))['catch'](handleError(_0x338d42,null));};exports[_0x221e('0x104')]=function(_0x2a36ef,_0x2dc49b){var _0x2d1397={};var _0x541472={};var _0x3dd3e6;var _0x9aa592;return db['ChatWebsite'][_0x221e('0x7d')]({'where':{'id':_0x2a36ef[_0x221e('0x69')]['id']}})[_0x221e('0x14')](handleEntityNotFound(_0x2dc49b,null))[_0x221e('0x14')](function(_0xa11b69){if(_0xa11b69){_0x3dd3e6=_0xa11b69;_0x541472[_0x221e('0x50')]=_[_0x221e('0x5a')](db[_0x221e('0x124')][_0x221e('0x55')]);_0x541472[_0x221e('0x59')]=_[_0x221e('0x5a')](_0x2a36ef[_0x221e('0x59')]);_0x541472['filters']=_[_0x221e('0x5d')](_0x541472[_0x221e('0x50')],_0x541472[_0x221e('0x59')]);_0x2d1397['attributes']=_[_0x221e('0x5d')](_0x541472[_0x221e('0x50')],qs[_0x221e('0x5e')](_0x2a36ef['query'][_0x221e('0x5e')]));_0x2d1397['attributes']=_0x2d1397['attributes'][_0x221e('0x5f')]?_0x2d1397[_0x221e('0x5c')]:_0x541472['model'];_0x2d1397[_0x221e('0x60')]=qs[_0x221e('0x61')](_0x2a36ef['query'][_0x221e('0x61')]);_0x2d1397[_0x221e('0x62')]=qs[_0x221e('0x5b')](_[_0x221e('0x63')](_0x2a36ef[_0x221e('0x59')],_0x541472[_0x221e('0x5b')]));if(_0x2a36ef[_0x221e('0x59')]['filter']){_0x2d1397['where']=_['merge'](_0x2d1397['where'],{'$or':_[_0x221e('0x58')](_0x2d1397[_0x221e('0x5c')],function(_0x10f757){var _0x486c29={};_0x486c29[_0x10f757]={'$like':'%'+_0x2a36ef[_0x221e('0x59')]['filter']+'%'};return _0x486c29;})});}_0x2d1397=_[_0x221e('0x65')]({},_0x2d1397,_0x2a36ef[_0x221e('0x6b')]);return _0x3dd3e6[_0x221e('0x104')](_0x2d1397);}})[_0x221e('0x14')](function(_0x4cb77a){if(_0x4cb77a){_0x9aa592=_0x4cb77a[_0x221e('0x5f')];if(!_0x2a36ef['query'][_0x221e('0x75')]('nolimit')){_0x2d1397[_0x221e('0x23')]=qs[_0x221e('0x23')](_0x2a36ef[_0x221e('0x59')][_0x221e('0x23')]);_0x2d1397['offset']=qs[_0x221e('0x26')](_0x2a36ef[_0x221e('0x59')]['offset']);}return _0x3dd3e6['getProactiveActions'](_0x2d1397);}})[_0x221e('0x14')](function(_0x531c69){if(_0x531c69){return _0x531c69?{'count':_0x9aa592,'rows':_0x531c69}:null;}})['then'](respondWithResult(_0x2dc49b,null))['catch'](handleError(_0x2dc49b,null));};exports[_0x221e('0x125')]=function(_0x235367,_0x4ba720){var _0x47f2ab=_0x235367[_0x221e('0x59')][_0x221e('0x126')]==='false'?_0x221e('0x127'):_0x221e('0x128');return db[_0x221e('0x54')][_0x221e('0x6c')]({'attributes':['id',_0x47f2ab],'where':{'id':_0x235367[_0x221e('0x69')]['id']}})[_0x221e('0x14')](handleEntityNotFound(_0x4ba720,null))[_0x221e('0x14')](function(_0x232edd){if(_0x232edd){var _0x1768cc=_0x232edd[_0x47f2ab];var _0x10d853=_0x1768cc&&_0x1768cc[_0x221e('0x129')]?_0x1768cc[_0x221e('0x129')]:[];_0x4ba720[_0x221e('0x2f')]({'fromKey':_['isNil'](_0x1768cc[_0x221e('0x12a')])?undefined:_0x1768cc['fromKey'],'count':_0x10d853[_0x221e('0x5f')],'rows':_0x10d853});}})[_0x221e('0x1e')](handleError(_0x4ba720,null));};exports[_0x221e('0x12b')]=function(_0x2d4548,_0x4551c1){var _0x5c48c8={'raw':![],'where':{}};var _0x4a1869={};var _0x27df01={'count':0x0,'rows':[]};return db[_0x221e('0x54')]['findOne']({'where':{'id':_0x2d4548[_0x221e('0x69')]['id']}})[_0x221e('0x14')](handleEntityNotFound(_0x4551c1,null))[_0x221e('0x14')](function(_0x16b57c){if(_0x16b57c){_0x4a1869[_0x221e('0x50')]=_[_0x221e('0x5a')](db[_0x221e('0xdf')][_0x221e('0x55')]);_0x4a1869[_0x221e('0x59')]=_[_0x221e('0x5a')](_0x2d4548[_0x221e('0x59')]);_0x4a1869['filters']=_[_0x221e('0x5d')](_0x4a1869[_0x221e('0x50')],_0x4a1869[_0x221e('0x59')]);_0x5c48c8[_0x221e('0x5c')]=_[_0x221e('0x5d')](_0x4a1869[_0x221e('0x50')],qs['fields'](_0x2d4548[_0x221e('0x59')][_0x221e('0x5e')]));_0x5c48c8[_0x221e('0x5c')]=_0x5c48c8[_0x221e('0x5c')][_0x221e('0x5f')]?_0x5c48c8[_0x221e('0x5c')]:_0x4a1869[_0x221e('0x50')];if(!_0x2d4548[_0x221e('0x59')][_0x221e('0x75')](_0x221e('0x76'))){_0x5c48c8[_0x221e('0x23')]=qs[_0x221e('0x23')](_0x2d4548[_0x221e('0x59')][_0x221e('0x23')]);_0x5c48c8[_0x221e('0x26')]=qs[_0x221e('0x26')](_0x2d4548[_0x221e('0x59')][_0x221e('0x26')]);}_0x5c48c8['order']=qs['sort'](_0x2d4548[_0x221e('0x59')][_0x221e('0x61')]);_0x5c48c8[_0x221e('0x62')]=qs[_0x221e('0x5b')](_[_0x221e('0x63')](_0x2d4548[_0x221e('0x59')],_0x4a1869['filters']));_0x5c48c8[_0x221e('0x62')][_0x221e('0x7e')]=_0x16b57c['id'];if(_0x2d4548[_0x221e('0x59')]['filter']){_0x5c48c8[_0x221e('0x62')]=_[_0x221e('0x65')](_0x5c48c8[_0x221e('0x62')],{'$or':_['map'](_0x5c48c8['attributes'],function(_0x2e0ecc){var _0x12c30b={};_0x12c30b[_0x2e0ecc]={'$like':'%'+_0x2d4548[_0x221e('0x59')][_0x221e('0x64')]+'%'};return _0x12c30b;})});}_0x5c48c8=_[_0x221e('0x65')]({},_0x5c48c8,_0x2d4548['options']);return db[_0x221e('0xdf')]['count']({'where':_0x5c48c8[_0x221e('0x62')]})[_0x221e('0x14')](function(_0x2c31b6){_0x27df01[_0x221e('0x25')]=_0x2c31b6;if(_0x2d4548[_0x221e('0x59')][_0x221e('0x6a')]){_0x5c48c8[_0x221e('0x67')]=[{'all':!![]}];}else{_0x5c48c8['include']=[{'model':db[_0x221e('0x9c')],'as':'Contact','required':![]},{'model':db[_0x221e('0xe6')],'as':_0x221e('0x12c'),'required':![]}];}return db[_0x221e('0xdf')]['findAll'](_0x5c48c8);})[_0x221e('0x14')](function(_0x18be8c){_0x27df01[_0x221e('0x78')]=_0x18be8c;return _0x27df01;});}})[_0x221e('0x14')](respondWithFilteredResult(_0x4551c1,_0x5c48c8))[_0x221e('0x1e')](handleError(_0x4551c1,null));};exports['addAgents']=function(_0x3df119,_0x454c6d){return db[_0x221e('0x54')][_0x221e('0x6c')]({'where':{'id':_0x3df119[_0x221e('0x69')]['id']}})[_0x221e('0x14')](handleEntityNotFound(_0x454c6d,null))[_0x221e('0x14')](function(_0x2fdbb8){if(_0x2fdbb8){return _0x2fdbb8[_0x221e('0x12d')](_0x3df119[_0x221e('0x6e')][_0x221e('0x7a')],_[_0x221e('0xfa')](_0x3df119[_0x221e('0x6e')],[_0x221e('0x7a'),'id'])||{})[_0x221e('0xb0')](function(_0x9843b){for(var _0x42e829=0x0;_0x42e829<_0x3df119[_0x221e('0x6e')][_0x221e('0x7a')][_0x221e('0x5f')];_0x42e829+=0x1){socket[_0x221e('0x12e')](_0x221e('0x12f'),{'UserId':Number(_0x3df119['body'][_0x221e('0x7a')][_0x42e829]),'ChatWebsiteId':Number(_0x3df119[_0x221e('0x69')]['id'])});}return _0x9843b;});}})[_0x221e('0x14')](respondWithResult(_0x454c6d,null))[_0x221e('0x1e')](handleError(_0x454c6d,null));};exports[_0x221e('0x130')]=function(_0x3e5795,_0x20959c){return db[_0x221e('0x54')][_0x221e('0x6c')]({'where':{'id':_0x3e5795[_0x221e('0x69')]['id']}})[_0x221e('0x14')](handleEntityNotFound(_0x20959c,null))['then'](function(_0x4980f8){if(_0x4980f8){return _0x4980f8[_0x221e('0x130')](_0x3e5795[_0x221e('0x59')]['ids'])[_0x221e('0x14')](function(){if(_[_0x221e('0x131')](_0x3e5795[_0x221e('0x59')][_0x221e('0x7a')])){for(var _0x218925=0x0;_0x218925<_0x3e5795[_0x221e('0x59')]['ids'][_0x221e('0x5f')];_0x218925+=0x1){socket[_0x221e('0x12e')]('userChatWebsite:remove',{'UserId':Number(_0x3e5795[_0x221e('0x59')][_0x221e('0x7a')][_0x218925]),'ChatWebsiteId':Number(_0x3e5795[_0x221e('0x69')]['id'])});}}else{socket[_0x221e('0x12e')](_0x221e('0x132'),{'UserId':Number(_0x3e5795[_0x221e('0x59')][_0x221e('0x7a')]),'ChatWebsiteId':Number(_0x3e5795[_0x221e('0x69')]['id'])});}});}})[_0x221e('0x14')](respondWithStatusCode(_0x20959c,null))[_0x221e('0x1e')](handleError(_0x20959c,null));};exports['getAgents']=function(_0x5a6fa8,_0x39b240){var _0x23f0a5={};var _0x366db5={};var _0x2af01b;var _0x1bcda6;return db[_0x221e('0x54')][_0x221e('0x7d')]({'where':{'id':_0x5a6fa8[_0x221e('0x69')]['id']}})[_0x221e('0x14')](handleEntityNotFound(_0x39b240,null))['then'](function(_0x44e9c3){if(_0x44e9c3){_0x2af01b=_0x44e9c3;_0x366db5[_0x221e('0x50')]=_['keys'](db[_0x221e('0xfd')][_0x221e('0x55')]);_0x366db5[_0x221e('0x59')]=_[_0x221e('0x5a')](_0x5a6fa8[_0x221e('0x59')]);_0x366db5['filters']=_[_0x221e('0x5d')](_0x366db5['model'],_0x366db5[_0x221e('0x59')]);_0x23f0a5['attributes']=_['intersection'](_0x366db5[_0x221e('0x50')],qs[_0x221e('0x5e')](_0x5a6fa8[_0x221e('0x59')][_0x221e('0x5e')]));_0x23f0a5[_0x221e('0x5c')]=_0x23f0a5[_0x221e('0x5c')][_0x221e('0x5f')]?_0x23f0a5[_0x221e('0x5c')]:_0x366db5[_0x221e('0x50')];_0x23f0a5['order']=qs[_0x221e('0x61')](_0x5a6fa8[_0x221e('0x59')][_0x221e('0x61')]);_0x23f0a5['where']=qs[_0x221e('0x5b')](_[_0x221e('0x63')](_0x5a6fa8[_0x221e('0x59')],_0x366db5[_0x221e('0x5b')]));if(_0x5a6fa8[_0x221e('0x59')][_0x221e('0x64')]){_0x23f0a5['where']=_[_0x221e('0x65')](_0x23f0a5[_0x221e('0x62')],{'$or':_[_0x221e('0x58')](_0x23f0a5[_0x221e('0x5c')],function(_0x56f35a){var _0x2fca67={};_0x2fca67[_0x56f35a]={'$like':'%'+_0x5a6fa8[_0x221e('0x59')][_0x221e('0x64')]+'%'};return _0x2fca67;})});}_0x23f0a5=_[_0x221e('0x65')]({},_0x23f0a5,_0x5a6fa8[_0x221e('0x6b')]);return _0x2af01b[_0x221e('0x133')](_0x23f0a5);}})[_0x221e('0x14')](function(_0x3a2e48){if(_0x3a2e48){_0x1bcda6=_0x3a2e48[_0x221e('0x5f')];if(!_0x5a6fa8[_0x221e('0x59')][_0x221e('0x75')]('nolimit')){_0x23f0a5['limit']=qs[_0x221e('0x23')](_0x5a6fa8[_0x221e('0x59')][_0x221e('0x23')]);_0x23f0a5[_0x221e('0x26')]=qs['offset'](_0x5a6fa8['query'][_0x221e('0x26')]);}return _0x2af01b[_0x221e('0x133')](_0x23f0a5);}})[_0x221e('0x14')](function(_0x361af6){if(_0x361af6){return _0x361af6?{'count':_0x1bcda6,'rows':_0x361af6}:null;}})[_0x221e('0x14')](respondWithResult(_0x39b240,null))[_0x221e('0x1e')](handleError(_0x39b240,null));}; \ No newline at end of file +var _0xd81e=['register','http','client','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','offset','undefined','count','limit','update','then','destroy','get','UserProfileResource','stack','name','Command','getSnippet','timezone','format','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','map','Intervals','all','some','user-agent-parser','setUA','user-agent','getResult','x-forwarded-for','split','firstName','x-real-port','referer','browser','%s\x20%s','version','unknown','device','model','vendor','%s\x20%s\x20%s','type','stringify','mandatoryDispositionPause','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatWebsite','includeAll','include','rows','show','params','Pause','find','create','body','user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','getDispositions','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/','download','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','Interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','account','list','applications','orderBy','priority','defaults','contact','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','lastName','messageId','created','autoclose','push','close','unmanaged','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','EventManager','notify','offline','files','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','attachments','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','nolimit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getProactiveActions','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','URL','origin','3.5.0','x-real-ip','connection','alignment','labelText','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','lodash','querystring','html-to-text','ioredis','jayson/promise','url','../../config/logger','../../errors/api','APIOutOfIntervalError','APINotFoundError','handleError','redis','localhost','./chatWebsite.socket'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0xd81e,0x123));var _0xed81=function(_0x49ffde,_0x3c9f87){_0x49ffde=_0x49ffde-0x0;var _0x21cc8a=_0xd81e[_0x49ffde];return _0x21cc8a;};'use strict';var Mustache=require(_0xed81('0x0'));var util=require(_0xed81('0x1'));var path=require(_0xed81('0x2'));var ejs=require(_0xed81('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed81('0x4'));var querystring=require(_0xed81('0x5'));var htmlToText=require(_0xed81('0x6'));var Redis=require(_0xed81('0x7'));var jayson=require(_0xed81('0x8'));var url=require(_0xed81('0x9'));var qs=require('../../components/parsers/qs');var logger=require(_0xed81('0xa'))('api');var config=require('../../config/environment');var APIOutOfIntervalError=require(_0xed81('0xb'))[_0xed81('0xc')];var APINotFoundError=require(_0xed81('0xb'))[_0xed81('0xd')];var APIHandleError=require('../../errors/api')[_0xed81('0xe')];var db=require('../../mysqldb')['db'];config[_0xed81('0xf')]=_['defaults'](config['redis'],{'host':_0xed81('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xed81('0xf')]));require(_0xed81('0x11'))[_0xed81('0x12')](socket);var client=jayson['client'][_0xed81('0x13')]({'port':0x232c});var client9002=jayson[_0xed81('0x14')][_0xed81('0x13')]({'port':0x232a});var client9003=jayson[_0xed81('0x14')][_0xed81('0x13')]({'port':0x232b});var client9001=jayson[_0xed81('0x14')][_0xed81('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x213ced,_0x2dd198,_0x21cf80,_0x39dfda){return new Promise(function(_0x505a1f,_0x513a24){var _0x355c69=_0x39dfda||client;return _0x355c69['request'](_0x213ced,_0x21cf80)['then'](function(_0x29fb24){logger[_0xed81('0x15')](_0xed81('0x16'),_0x2dd198,'request\x20sent');logger[_0xed81('0x17')](_0xed81('0x18'),_0x2dd198,_0xed81('0x19'),JSON['stringify'](_0x29fb24));if(_0x29fb24[_0xed81('0x1a')]){if(_0x29fb24[_0xed81('0x1a')][_0xed81('0x1b')]===0x1f4){logger['error'](_0xed81('0x16'),_0x2dd198,_0x29fb24[_0xed81('0x1a')][_0xed81('0x1c')]);return _0x513a24(_0x29fb24[_0xed81('0x1a')][_0xed81('0x1c')]);}logger['error'](_0xed81('0x16'),_0x2dd198,_0x29fb24['error'][_0xed81('0x1c')]);return _0x505a1f(_0x29fb24[_0xed81('0x1a')][_0xed81('0x1c')]);}else{logger[_0xed81('0x15')](_0xed81('0x16'),_0x2dd198,_0xed81('0x19'));_0x505a1f(_0x29fb24['result']['message']);}})['catch'](function(_0x546fe8){logger[_0xed81('0x1a')](_0xed81('0x16'),_0x2dd198,_0x546fe8);_0x513a24(_0x546fe8);});});}function respondWithStatusCode(_0x586408,_0x447640){_0x447640=_0x447640||0xcc;return function(_0x3e966c){if(_0x3e966c){return _0x586408[_0xed81('0x1d')](_0x447640);}return _0x586408[_0xed81('0x1e')](_0x447640)['end']();};}function respondWithResult(_0x4aeddc,_0x1e86f3){_0x1e86f3=_0x1e86f3||0xc8;return function(_0x391bc3){if(_0x391bc3){return _0x4aeddc['status'](_0x1e86f3)['json'](_0x391bc3);}};}function respondWithFilteredResult(_0x569454,_0x4f1f24){return function(_0x49dec6){if(_0x49dec6){var _0x1e0044=typeof _0x4f1f24[_0xed81('0x1f')]===_0xed81('0x20')&&typeof _0x4f1f24['limit']===_0xed81('0x20');var _0x2bd424=_0x49dec6[_0xed81('0x21')];var _0x3df166=_0x1e0044?0x0:_0x4f1f24[_0xed81('0x1f')];var _0x4d1725=_0x1e0044?_0x49dec6['count']:_0x4f1f24[_0xed81('0x1f')]+_0x4f1f24[_0xed81('0x22')];var _0x280b2e;if(_0x4d1725>=_0x2bd424){_0x4d1725=_0x2bd424;_0x280b2e=0xc8;}else{_0x280b2e=0xce;}_0x569454[_0xed81('0x1e')](_0x280b2e);return _0x569454['set']('Content-Range',_0x3df166+'-'+_0x4d1725+'/'+_0x2bd424)['json'](_0x49dec6);}return null;};}function saveUpdates(_0x1311d6){return function(_0x5b2116){if(_0x5b2116){return _0x5b2116[_0xed81('0x23')](_0x1311d6)[_0xed81('0x24')](function(_0x500dfa){return _0x500dfa;});}return null;};}function removeEntity(_0x448533){return function(_0x17ed54){if(_0x17ed54){return _0x17ed54[_0xed81('0x25')]()[_0xed81('0x24')](function(){var _0x554269=_0x17ed54[_0xed81('0x26')]({'plain':!![]});var _0x144209='ChatWebsites';return db[_0xed81('0x27')][_0xed81('0x25')]({'where':{'type':_0x144209,'resourceId':_0x554269['id']}})['then'](function(){return _0x17ed54;});})['then'](function(){_0x448533['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23953f){return function(_0x413dbc){if(!_0x413dbc){_0x23953f[_0xed81('0x1d')](0x194);}return _0x413dbc;};}function handleError(_0x5a7033,_0x30ef92){_0x30ef92=_0x30ef92||0x1f4;return function(_0x20dfe5){logger[_0xed81('0x1a')](_0x20dfe5[_0xed81('0x28')]);if(_0x20dfe5[_0xed81('0x29')]){delete _0x20dfe5[_0xed81('0x29')];}_0x5a7033[_0xed81('0x1e')](_0x30ef92)['send'](_0x20dfe5);};}function iftimePromise(_0x4b67a2,_0x66822d){return respondWithRpcPromise(_0xed81('0x2a'),_0xed81('0x2b'),{'command':_0x66822d[_0xed81('0x2c')]?util[_0xed81('0x2d')](_0xed81('0x2e'),_0x4b67a2[_0xed81('0x2f')],_0x66822d[_0xed81('0x2c')]):util[_0xed81('0x2d')](_0xed81('0x30'),_0x4b67a2[_0xed81('0x2f')])},client9002)['then'](function(_0x6e5fbd){var _0xdc4466=_0x6e5fbd&&_0x6e5fbd[_0xed81('0x31')](_0xed81('0x32'))>=0x0?!![]:![];logger[_0xed81('0x15')](_0xed81('0x33'),_0x66822d['id'],_0x4b67a2['id'],_0x4b67a2[_0xed81('0x2f')],_0xdc4466?_0xed81('0x34'):_0xed81('0x35'),_0x66822d[_0xed81('0x2c')]?_0x66822d[_0xed81('0x2c')]:_0xed81('0x36'));return _0xdc4466;})['catch'](function(_0x3bb9c5){logger[_0xed81('0x1a')](_0xed81('0x33'),_0x66822d['id'],_0x4b67a2['id'],_0x4b67a2[_0xed81('0x2f')],util[_0xed81('0x37')](_0x3bb9c5,{'showHidden':![],'depth':null}),_0x66822d['timezone']?_0x66822d['timezone']:'No\x20timezone');return![];});}function checkWebsiteIntervals(_0x18f5f7){var _0x48386b=_[_0xed81('0x38')](_0x18f5f7['Interval'][_0xed81('0x39')],function(_0x417ea1){var _0x4b301c=_0x417ea1['get']({'plain':!![]});return iftimePromise(_0x4b301c,_0x18f5f7);});return Promise[_0xed81('0x3a')](_0x48386b)[_0xed81('0x24')](function(_0x9a2d69){return _[_0xed81('0x3b')](_0x9a2d69);});}function createInteractionObject(_0xb98cc4,_0x776b09,_0x526a22,_0x328312){var _0x3fd248=require(_0xed81('0x3c'));var _0x5e996f=new _0x3fd248();var _0x362ff3=_0x5e996f[_0xed81('0x3d')](_0x526a22[_0xed81('0x3e')])[_0xed81('0x3f')]();var _0x14ca0f=_0x776b09['customerIp'];if(_0x526a22['cf-connecting-ip']){_0x14ca0f=_0x526a22['cf-connecting-ip'];}else if(_0x526a22[_0xed81('0x40')]){_0x14ca0f=_['first'](_0x526a22[_0xed81('0x40')][_0xed81('0x41')](','));}return{'ContactId':_0x328312['id'],'ChatWebsiteId':_0xb98cc4,'from':(_0x328312[_0xed81('0x42')]||'')+'\x20'+(_0x328312['lastName']||''),'customerIp':_0x14ca0f,'customerPort':_0x526a22[_0xed81('0x43')]?_0x526a22[_0xed81('0x43')]:null,'referer':_0x776b09[_0xed81('0x44')],'browserName':_0x362ff3[_0xed81('0x45')][_0xed81('0x29')]&&_0x362ff3['browser']['version']?util[_0xed81('0x2d')](_0xed81('0x46'),_0x362ff3[_0xed81('0x45')]['name'],_0x362ff3[_0xed81('0x45')][_0xed81('0x47')]):_0xed81('0x48'),'browserVersion':_0x362ff3['browser']['version']||'unknown','osName':util['format']('%s\x20%s',_0x362ff3['os'][_0xed81('0x29')],_0x362ff3['os'][_0xed81('0x47')]),'osVersion':_0x362ff3['os'][_0xed81('0x47')],'deviceModel':_0x362ff3[_0xed81('0x49')][_0xed81('0x4a')]&&_0x362ff3['device'][_0xed81('0x4b')]?util['format'](_0xed81('0x4c'),_0x362ff3[_0xed81('0x49')][_0xed81('0x4a')],_0x362ff3[_0xed81('0x49')][_0xed81('0x4b')],_0x362ff3['device']['type']):null,'deviceVendor':_0x362ff3[_0xed81('0x49')][_0xed81('0x4b')],'deviceType':_0x362ff3[_0xed81('0x49')][_0xed81('0x4d')],'formData':JSON[_0xed81('0x4e')](_0x776b09)};}exports['index']=function(_0x245332,_0xd881aa){var _0x58ba2f={'include':[{'model':db['Pause'],'as':_0xed81('0x4f')}]},_0x3809da={},_0x5a616f={'count':0x0,'rows':[]};var _0x5619c1=_['map'](db['ChatWebsite'][_0xed81('0x50')],function(_0xf90d01){return{'name':_0xf90d01[_0xed81('0x51')],'type':_0xf90d01[_0xed81('0x4d')][_0xed81('0x52')]};});_0x3809da[_0xed81('0x4a')]=_['map'](_0x5619c1,_0xed81('0x29'));_0x3809da['query']=_[_0xed81('0x53')](_0x245332[_0xed81('0x54')]);_0x3809da[_0xed81('0x55')]=_[_0xed81('0x56')](_0x3809da[_0xed81('0x4a')],_0x3809da['query']);_0x58ba2f[_0xed81('0x57')]=_['intersection'](_0x3809da['model'],qs[_0xed81('0x58')](_0x245332[_0xed81('0x54')][_0xed81('0x58')]));_0x58ba2f['attributes']=_0x58ba2f['attributes'][_0xed81('0x59')]?_0x58ba2f['attributes']:_0x3809da[_0xed81('0x4a')];if(!_0x245332[_0xed81('0x54')][_0xed81('0x5a')]('nolimit')){_0x58ba2f[_0xed81('0x22')]=qs['limit'](_0x245332[_0xed81('0x54')][_0xed81('0x22')]);_0x58ba2f['offset']=qs[_0xed81('0x1f')](_0x245332[_0xed81('0x54')]['offset']);}_0x58ba2f[_0xed81('0x5b')]=qs['sort'](_0x245332['query'][_0xed81('0x5c')]);_0x58ba2f[_0xed81('0x5d')]=qs[_0xed81('0x55')](_[_0xed81('0x5e')](_0x245332['query'],_0x3809da[_0xed81('0x55')]),_0x5619c1);if(_0x245332[_0xed81('0x54')][_0xed81('0x5f')]){_0x58ba2f[_0xed81('0x5d')]=_[_0xed81('0x60')](_0x58ba2f['where'],{'$or':_[_0xed81('0x38')](_0x5619c1,function(_0xcdaac6){if(_0xcdaac6[_0xed81('0x4d')]!==_0xed81('0x61')){var _0x20bdf3={};_0x20bdf3[_0xcdaac6['name']]={'$like':'%'+_0x245332[_0xed81('0x54')][_0xed81('0x5f')]+'%'};return _0x20bdf3;}})});}_0x58ba2f=_[_0xed81('0x60')]({},_0x58ba2f,_0x245332[_0xed81('0x62')]);var _0x1b7099={'where':_0x58ba2f[_0xed81('0x5d')]};return db[_0xed81('0x63')][_0xed81('0x21')](_0x1b7099)[_0xed81('0x24')](function(_0x32a0fa){_0x5a616f[_0xed81('0x21')]=_0x32a0fa;if(_0x245332[_0xed81('0x54')][_0xed81('0x64')]){_0x58ba2f[_0xed81('0x65')]=[{'all':!![]}];}return db[_0xed81('0x63')]['findAll'](_0x58ba2f);})['then'](function(_0x3e684e){_0x5a616f[_0xed81('0x66')]=_0x3e684e;return _0x5a616f;})['then'](respondWithFilteredResult(_0xd881aa,_0x58ba2f))['catch'](handleError(_0xd881aa,null));};exports[_0xed81('0x67')]=function(_0x94ccc,_0x2accd1){var _0x3d4118={'raw':![],'where':{'id':_0x94ccc[_0xed81('0x68')]['id']},'include':[{'model':db[_0xed81('0x69')],'as':_0xed81('0x4f')}]},_0x2d2e2b={};_0x2d2e2b[_0xed81('0x4a')]=_[_0xed81('0x53')](db[_0xed81('0x63')]['rawAttributes']);_0x2d2e2b['query']=_[_0xed81('0x53')](_0x94ccc['query']);_0x2d2e2b[_0xed81('0x55')]=_[_0xed81('0x56')](_0x2d2e2b[_0xed81('0x4a')],_0x2d2e2b[_0xed81('0x54')]);_0x3d4118[_0xed81('0x57')]=_[_0xed81('0x56')](_0x2d2e2b[_0xed81('0x4a')],qs[_0xed81('0x58')](_0x94ccc[_0xed81('0x54')][_0xed81('0x58')]));_0x3d4118[_0xed81('0x57')]=_0x3d4118['attributes'][_0xed81('0x59')]?_0x3d4118[_0xed81('0x57')]:_0x2d2e2b[_0xed81('0x4a')];if(_0x94ccc['query']['includeAll']){_0x3d4118[_0xed81('0x65')]=[{'all':!![]}];}_0x3d4118=_[_0xed81('0x60')]({},_0x3d4118,_0x94ccc[_0xed81('0x62')]);return db[_0xed81('0x63')][_0xed81('0x6a')](_0x3d4118)[_0xed81('0x24')](handleEntityNotFound(_0x2accd1,null))[_0xed81('0x24')](respondWithResult(_0x2accd1,null))['catch'](handleError(_0x2accd1,null));};exports[_0xed81('0x6b')]=function(_0x5a037e,_0x264f04){return db['ChatWebsite']['create'](_0x5a037e[_0xed81('0x6c')],{})[_0xed81('0x24')](function(_0x2202de){var _0x3cc53e=_0x5a037e[_0xed81('0x6d')][_0xed81('0x26')]({'plain':!![]});if(!_0x3cc53e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cc53e[_0xed81('0x6e')]===_0xed81('0x6d')){var _0x24a908=_0x2202de[_0xed81('0x26')]({'plain':!![]});var _0x4bb909=_0xed81('0x6f');return db[_0xed81('0x70')]['find']({'where':{'name':_0x4bb909,'userProfileId':_0x3cc53e[_0xed81('0x71')]},'raw':!![]})['then'](function(_0x32e335){if(_0x32e335&&_0x32e335[_0xed81('0x72')]===0x0){return db['UserProfileResource']['create']({'name':_0x24a908[_0xed81('0x29')],'resourceId':_0x24a908['id'],'type':_0x32e335[_0xed81('0x29')],'sectionId':_0x32e335['id']},{})[_0xed81('0x24')](function(){return _0x2202de;});}else{return _0x2202de;}})[_0xed81('0x73')](function(_0x193a14){logger[_0xed81('0x1a')](_0xed81('0x74'),_0x193a14);throw _0x193a14;});}return _0x2202de;})['then'](respondWithResult(_0x264f04,0xc9))[_0xed81('0x73')](handleError(_0x264f04,null));};exports['update']=function(_0x5f5494,_0x4c7c64){if(_0x5f5494['body']['id']){delete _0x5f5494[_0xed81('0x6c')]['id'];}return db[_0xed81('0x63')]['find']({'where':{'id':_0x5f5494[_0xed81('0x68')]['id']},'include':[{'model':db[_0xed81('0x69')],'as':_0xed81('0x4f')}]})[_0xed81('0x24')](handleEntityNotFound(_0x4c7c64,null))[_0xed81('0x24')](saveUpdates(_0x5f5494['body'],null))[_0xed81('0x24')](respondWithResult(_0x4c7c64,null))[_0xed81('0x73')](handleError(_0x4c7c64,null));};exports[_0xed81('0x25')]=function(_0x41fb2e,_0x41f50a){return db['ChatWebsite'][_0xed81('0x6a')]({'where':{'id':_0x41fb2e['params']['id']}})[_0xed81('0x24')](handleEntityNotFound(_0x41f50a,null))[_0xed81('0x24')](removeEntity(_0x41f50a,null))[_0xed81('0x73')](handleError(_0x41f50a,null));};exports[_0xed81('0x75')]=function(_0x48f316,_0x11389a){return db[_0xed81('0x63')][_0xed81('0x75')]()[_0xed81('0x24')](respondWithResult(_0x11389a,null))[_0xed81('0x73')](handleError(_0x11389a,null));};exports['addDisposition']=function(_0x307451,_0x3964e7){if(_0x307451[_0xed81('0x6c')]['id']){delete _0x307451['body']['id'];}return db[_0xed81('0x63')][_0xed81('0x6a')]({'where':{'id':_0x307451[_0xed81('0x68')]['id']}})[_0xed81('0x24')](handleEntityNotFound(_0x3964e7,null))[_0xed81('0x24')](function(_0x3375cf){if(_0x3375cf){_0x307451[_0xed81('0x6c')][_0xed81('0x76')]=_0x3375cf['id'];return db['Disposition'][_0xed81('0x6b')](_0x307451['body']);}})[_0xed81('0x24')](respondWithResult(_0x3964e7,null))[_0xed81('0x73')](handleError(_0x3964e7,null));};exports[_0xed81('0x77')]=function(_0xf12833,_0x461ed2){var _0x36e2a7={'raw':![],'where':{}};var _0x517689={};var _0x59f4af={'count':0x0,'rows':[]};return db[_0xed81('0x63')]['findOne']({'where':{'id':_0xf12833[_0xed81('0x68')]['id']}})[_0xed81('0x24')](handleEntityNotFound(_0x461ed2,null))[_0xed81('0x24')](function(_0x5aed95){if(_0x5aed95){_0x517689[_0xed81('0x4a')]=_[_0xed81('0x53')](db['Disposition'][_0xed81('0x50')]);_0x517689['query']=_['keys'](_0xf12833[_0xed81('0x54')]);_0x517689[_0xed81('0x55')]=_[_0xed81('0x56')](_0x517689[_0xed81('0x4a')],_0x517689[_0xed81('0x54')]);_0x36e2a7['attributes']=_['intersection'](_0x517689[_0xed81('0x4a')],qs['fields'](_0xf12833[_0xed81('0x54')][_0xed81('0x58')]));_0x36e2a7[_0xed81('0x57')]=_0x36e2a7[_0xed81('0x57')]['length']?_0x36e2a7[_0xed81('0x57')]:_0x517689[_0xed81('0x4a')];if(!_0xf12833[_0xed81('0x54')]['hasOwnProperty']('nolimit')){_0x36e2a7[_0xed81('0x22')]=qs[_0xed81('0x22')](_0xf12833[_0xed81('0x54')][_0xed81('0x22')]);_0x36e2a7[_0xed81('0x1f')]=qs['offset'](_0xf12833[_0xed81('0x54')][_0xed81('0x1f')]);}_0x36e2a7[_0xed81('0x5b')]=qs['sort'](_0xf12833[_0xed81('0x54')][_0xed81('0x5c')]);_0x36e2a7[_0xed81('0x5d')]=qs[_0xed81('0x55')](_[_0xed81('0x5e')](_0xf12833[_0xed81('0x54')],_0x517689['filters']));_0x36e2a7['where'][_0xed81('0x76')]=_0x5aed95['id'];if(_0xf12833[_0xed81('0x54')][_0xed81('0x5f')]){_0x36e2a7['where']=_['merge'](_0x36e2a7[_0xed81('0x5d')],{'$or':_['map'](_0x36e2a7[_0xed81('0x57')],function(_0x1f5a9a){var _0xe51142={};_0xe51142[_0x1f5a9a]={'$like':'%'+_0xf12833['query'][_0xed81('0x5f')]+'%'};return _0xe51142;})});}_0x36e2a7=_[_0xed81('0x60')]({},_0x36e2a7,_0xf12833[_0xed81('0x62')]);return db[_0xed81('0x78')]['count']({'where':_0x36e2a7[_0xed81('0x5d')]})[_0xed81('0x24')](function(_0x5583f9){_0x59f4af[_0xed81('0x21')]=_0x5583f9;if(_0xf12833[_0xed81('0x54')]['includeAll']){_0x36e2a7['include']=[{'all':!![]}];}return db[_0xed81('0x78')][_0xed81('0x79')](_0x36e2a7);})[_0xed81('0x24')](function(_0x9b8e2){_0x59f4af['rows']=_0x9b8e2;return _0x59f4af;});}})['then'](respondWithFilteredResult(_0x461ed2,_0x36e2a7))[_0xed81('0x73')](handleError(_0x461ed2,null));};exports[_0xed81('0x7a')]=function(_0x2f50da,_0x1b9318){return db[_0xed81('0x63')]['find']({'where':{'id':_0x2f50da[_0xed81('0x68')]['id']}})[_0xed81('0x24')](handleEntityNotFound(_0x1b9318,null))[_0xed81('0x24')](function(_0x187821){if(_0x187821){return _0x187821[_0xed81('0x7a')](_0x2f50da[_0xed81('0x54')][_0xed81('0x7b')]);}})[_0xed81('0x24')](respondWithStatusCode(_0x1b9318,null))['catch'](handleError(_0x1b9318,null));};exports[_0xed81('0x7c')]=function(_0x3017c9,_0x30fc7b){if(_0x3017c9[_0xed81('0x6c')]['id']){delete _0x3017c9['body']['id'];}return db[_0xed81('0x63')]['find']({'where':{'id':_0x3017c9[_0xed81('0x68')]['id']}})[_0xed81('0x24')](handleEntityNotFound(_0x30fc7b,null))[_0xed81('0x24')](function(_0x13fcf0){if(_0x13fcf0){_0x3017c9[_0xed81('0x6c')][_0xed81('0x76')]=_0x13fcf0['id'];return db[_0xed81('0x7d')][_0xed81('0x6b')](_0x3017c9['body']);}})['then'](respondWithResult(_0x30fc7b,null))[_0xed81('0x73')](handleError(_0x30fc7b,null));};exports[_0xed81('0x7e')]=function(_0x274804,_0x3648f7){var _0x2f90ab={'raw':![],'where':{}};var _0x2165e5={};var _0x172b03={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xed81('0x7f')]({'where':{'id':_0x274804[_0xed81('0x68')]['id']}})[_0xed81('0x24')](handleEntityNotFound(_0x3648f7,null))['then'](function(_0x490ada){if(_0x490ada){_0x2165e5[_0xed81('0x4a')]=_[_0xed81('0x53')](db[_0xed81('0x7d')][_0xed81('0x50')]);_0x2165e5['query']=_['keys'](_0x274804[_0xed81('0x54')]);_0x2165e5[_0xed81('0x55')]=_['intersection'](_0x2165e5[_0xed81('0x4a')],_0x2165e5[_0xed81('0x54')]);_0x2f90ab[_0xed81('0x57')]=_[_0xed81('0x56')](_0x2165e5[_0xed81('0x4a')],qs[_0xed81('0x58')](_0x274804['query'][_0xed81('0x58')]));_0x2f90ab[_0xed81('0x57')]=_0x2f90ab[_0xed81('0x57')][_0xed81('0x59')]?_0x2f90ab[_0xed81('0x57')]:_0x2165e5[_0xed81('0x4a')];if(!_0x274804[_0xed81('0x54')]['hasOwnProperty']('nolimit')){_0x2f90ab[_0xed81('0x22')]=qs[_0xed81('0x22')](_0x274804[_0xed81('0x54')][_0xed81('0x22')]);_0x2f90ab['offset']=qs[_0xed81('0x1f')](_0x274804['query'][_0xed81('0x1f')]);}_0x2f90ab[_0xed81('0x5b')]=qs[_0xed81('0x5c')](_0x274804[_0xed81('0x54')]['sort']);_0x2f90ab[_0xed81('0x5d')]=qs[_0xed81('0x55')](_[_0xed81('0x5e')](_0x274804[_0xed81('0x54')],_0x2165e5['filters']));_0x2f90ab[_0xed81('0x5d')][_0xed81('0x76')]=_0x490ada['id'];if(_0x274804[_0xed81('0x54')][_0xed81('0x5f')]){_0x2f90ab[_0xed81('0x5d')]=_[_0xed81('0x60')](_0x2f90ab[_0xed81('0x5d')],{'$or':_[_0xed81('0x38')](_0x2f90ab[_0xed81('0x57')],function(_0x3c8b9e){var _0x2ee314={};_0x2ee314[_0x3c8b9e]={'$like':'%'+_0x274804['query'][_0xed81('0x5f')]+'%'};return _0x2ee314;})});}_0x2f90ab=_['merge']({},_0x2f90ab,_0x274804['options']);return db['CannedAnswer'][_0xed81('0x21')]({'where':_0x2f90ab[_0xed81('0x5d')]})[_0xed81('0x24')](function(_0x4b7ba3){_0x172b03['count']=_0x4b7ba3;if(_0x274804[_0xed81('0x54')][_0xed81('0x64')]){_0x2f90ab[_0xed81('0x65')]=[{'all':!![]}];}return db[_0xed81('0x7d')][_0xed81('0x79')](_0x2f90ab);})[_0xed81('0x24')](function(_0x75e82d){_0x172b03[_0xed81('0x66')]=_0x75e82d;return _0x172b03;});}})[_0xed81('0x24')](respondWithFilteredResult(_0x3648f7,_0x2f90ab))[_0xed81('0x73')](handleError(_0x3648f7,null));};exports[_0xed81('0x80')]=function(_0x31d63e,_0x4b2d46){return db[_0xed81('0x63')][_0xed81('0x6a')]({'where':{'id':_0x31d63e[_0xed81('0x68')]['id']}})[_0xed81('0x24')](handleEntityNotFound(_0x4b2d46,null))['then'](function(_0x2141e8){if(_0x2141e8){return _0x2141e8[_0xed81('0x80')](_0x31d63e['query'][_0xed81('0x7b')]);}})[_0xed81('0x24')](respondWithStatusCode(_0x4b2d46,null))['catch'](handleError(_0x4b2d46,null));};exports[_0xed81('0x81')]=function(_0x3b61fc,_0x54d56b){_0x3b61fc[_0xed81('0x6c')][_0xed81('0x82')]=_0x3b61fc[_0xed81('0x83')]['filename'];return db['ChatWebsite'][_0xed81('0x6a')]({'where':{'id':_0x3b61fc[_0xed81('0x68')]['id']}})['then'](handleEntityNotFound(_0x54d56b,null))['then'](saveUpdates(_0x3b61fc[_0xed81('0x6c')],null))[_0xed81('0x24')](respondWithResult(_0x54d56b,null))[_0xed81('0x73')](handleError(_0x54d56b,null));};exports[_0xed81('0x84')]=function(_0x38e487,_0x5a42f1){_0x38e487[_0xed81('0x6c')][_0xed81('0x85')]=_0x38e487[_0xed81('0x83')][_0xed81('0x86')];return db[_0xed81('0x63')][_0xed81('0x6a')]({'where':{'id':_0x38e487[_0xed81('0x68')]['id']}})['then'](handleEntityNotFound(_0x5a42f1,null))['then'](saveUpdates(_0x38e487['body'],null))[_0xed81('0x24')](respondWithResult(_0x5a42f1,null))[_0xed81('0x73')](handleError(_0x5a42f1,null));};exports[_0xed81('0x87')]=function(_0x4940de,_0x3280e2){_0x4940de[_0xed81('0x6c')][_0xed81('0x88')]=_0x4940de[_0xed81('0x83')]['filename'];return db[_0xed81('0x63')][_0xed81('0x6a')]({'where':{'id':_0x4940de[_0xed81('0x68')]['id']}})[_0xed81('0x24')](handleEntityNotFound(_0x3280e2,null))[_0xed81('0x24')](saveUpdates(_0x4940de['body'],null))[_0xed81('0x24')](respondWithResult(_0x3280e2,null))['catch'](handleError(_0x3280e2,null));};exports[_0xed81('0x89')]=function(_0x51083b,_0x18035f){_0x51083b[_0xed81('0x6c')][_0xed81('0x8a')]=_0x51083b[_0xed81('0x83')][_0xed81('0x86')];return db[_0xed81('0x63')][_0xed81('0x6a')]({'where':{'id':_0x51083b[_0xed81('0x68')]['id']}})[_0xed81('0x24')](handleEntityNotFound(_0x18035f,null))[_0xed81('0x24')](saveUpdates(_0x51083b[_0xed81('0x6c')],null))['then'](respondWithResult(_0x18035f,null))[_0xed81('0x73')](handleError(_0x18035f,null));};exports[_0xed81('0x8b')]=function(_0x3d7dd6,_0xbf1068){var _0x5c77c6=path[_0xed81('0x8c')](config[_0xed81('0x8d')],_0xed81('0x8e'));var _0x310323={'where':{'id':_0x3d7dd6[_0xed81('0x68')]['id']},'attributes':['id',_0xed81('0x82')],'raw':!![]};var _0x55a94b=![];return require(_0xed81('0x8f'))[_0xed81('0x90')]()['then'](function(_0x16b0c7){if(_0x16b0c7){_0x55a94b=_0x16b0c7[_0xed81('0x91')];}})['then'](function(){return db[_0xed81('0x63')][_0xed81('0x6a')](_0x310323);})['then'](handleEntityNotFound(_0xbf1068,null))[_0xed81('0x24')](function(_0x1f3f93){if(_0x1f3f93){if(!_[_0xed81('0x92')](_0x1f3f93[_0xed81('0x82')])){if(fs[_0xed81('0x93')](path[_0xed81('0x8c')](config['root'],_0xed81('0x94'),_0x1f3f93[_0xed81('0x82')]))&&_0x55a94b){_0x5c77c6=path['join'](config[_0xed81('0x8d')],_0xed81('0x94'),_0x1f3f93['sitepic']);}}return _0xbf1068['download'](_0x5c77c6);}})[_0xed81('0x73')](handleError(_0xbf1068,null));};exports[_0xed81('0x95')]=function(_0x50cb70,_0x911103){var _0x315377=path[_0xed81('0x8c')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x16bde6={'where':{'id':_0x50cb70['params']['id']},'attributes':['id',_0xed81('0x85')],'raw':!![]};return db[_0xed81('0x63')][_0xed81('0x6a')](_0x16bde6)[_0xed81('0x24')](handleEntityNotFound(_0x911103,null))[_0xed81('0x24')](function(_0x4016f6){if(_0x4016f6){if(!_[_0xed81('0x92')](_0x4016f6[_0xed81('0x85')])){if(fs[_0xed81('0x93')](path[_0xed81('0x8c')](config[_0xed81('0x8d')],'server/files/images/avatars/',_0x4016f6[_0xed81('0x85')]))){_0x315377=path[_0xed81('0x8c')](config[_0xed81('0x8d')],_0xed81('0x96'),_0x4016f6[_0xed81('0x85')]);}}return _0x911103[_0xed81('0x97')](_0x315377);}})[_0xed81('0x73')](handleError(_0x911103,null));};exports[_0xed81('0x98')]=function(_0x26bef0,_0x52df39){var _0x3c5398=path[_0xed81('0x8c')](config[_0xed81('0x8d')],'server/files/images/avatars/customer_avatar.png');var _0x377e8d={'where':{'id':_0x26bef0['params']['id']},'attributes':['id',_0xed81('0x88'),_0xed81('0x99')],'raw':!![]};return db[_0xed81('0x63')]['find'](_0x377e8d)[_0xed81('0x24')](handleEntityNotFound(_0x52df39,null))['then'](function(_0xb1367c){if(_0xb1367c){if(!_[_0xed81('0x92')](_0xb1367c[_0xed81('0x88')])){if(fs[_0xed81('0x93')](path[_0xed81('0x8c')](config['root'],_0xed81('0x96'),_0xb1367c[_0xed81('0x88')]))&&_0xb1367c['showCustomerAvatar']){_0x3c5398=path[_0xed81('0x8c')](config[_0xed81('0x8d')],_0xed81('0x96'),_0xb1367c['customerAvatar']);}}return _0x52df39[_0xed81('0x97')](_0x3c5398);}})[_0xed81('0x73')](handleError(_0x52df39,null));};exports['getSystemAvatar']=function(_0xe983b4,_0x20f905){var _0x49a8af=path[_0xed81('0x8c')](config[_0xed81('0x8d')],_0xed81('0x9a'));var _0x496a01={'where':{'id':_0xe983b4[_0xed81('0x68')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xed81('0x63')][_0xed81('0x6a')](_0x496a01)[_0xed81('0x24')](handleEntityNotFound(_0x20f905,null))[_0xed81('0x24')](function(_0xf018f){if(_0xf018f){if(!_[_0xed81('0x92')](_0xf018f[_0xed81('0x8a')])){if(fs[_0xed81('0x93')](path[_0xed81('0x8c')](config[_0xed81('0x8d')],_0xed81('0x96'),_0xf018f[_0xed81('0x8a')]))){_0x49a8af=path[_0xed81('0x8c')](config[_0xed81('0x8d')],_0xed81('0x96'),_0xf018f[_0xed81('0x8a')]);}}return _0x20f905[_0xed81('0x97')](_0x49a8af);}})[_0xed81('0x73')](handleError(_0x20f905,null));};exports['notify']=function(_0x4044f4,_0x6775e9){var _0x55b4e9={'body':_0x4044f4[_0xed81('0x6c')],'channel':_0xed81('0x9b')};var _0x4b6e74=[];var _0x49ff24=[];var _0x48079f={};var _0x23df02=![];return db['CmContact'][_0xed81('0x75')]()[_0xed81('0x24')](function(_0x1491f5){if(!_0x1491f5){throw new db[(_0xed81('0x9c'))][(_0xed81('0x9d'))](_0xed81('0x9e'));}_0x4b6e74=_[_0xed81('0x9f')](_[_0xed81('0x53')](_0x1491f5),[_0xed81('0xa0'),_0xed81('0xa1')]);_0x49ff24=_[_0xed81('0x9f')](_['keys'](_0x1491f5),[_0xed81('0xa0'),_0xed81('0xa1'),_0xed81('0xa2'),_0xed81('0xa3')]);if(_0x4044f4[_0xed81('0x6c')]['id']){delete _0x4044f4[_0xed81('0x6c')]['id'];}if(_['isNil'](_0x4044f4[_0xed81('0x6c')]['from'])){throw new db['Sequelize'][(_0xed81('0x9d'))](_0xed81('0xa4'));}if(_[_0xed81('0x92')](_0x4044f4[_0xed81('0x6c')]['body'])||_0x4044f4['body'][_0xed81('0x6c')]===''){throw new db[(_0xed81('0x9c'))][(_0xed81('0x9d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xed81('0x92')](_0x4044f4['body']['mapKey'])){throw new db[(_0xed81('0x9c'))][(_0xed81('0x9d'))](_0xed81('0xa5')+_0x49ff24);}if(!_['includes'](_0x49ff24,_0x4044f4['body'][_0xed81('0xa6')])){throw new db[(_0xed81('0x9c'))]['ValidationError'](_0xed81('0xa7')+_0x49ff24);}_0x48079f[_0x4044f4[_0xed81('0x6c')][_0xed81('0xa6')]]=_0x4044f4[_0xed81('0x6c')][_0xed81('0xa8')];})[_0xed81('0x24')](function(){return db[_0xed81('0x63')]['find']({'where':{'id':_0x4044f4[_0xed81('0x68')]['id']},'include':[{'model':db[_0xed81('0xa9')],'as':_0xed81('0xaa'),'include':[{'model':db[_0xed81('0xab')],'as':_0xed81('0xac'),'where':_0x48079f,'limit':0x1,'order':[['updatedAt',_0xed81('0xad')]]}]},{'model':db[_0xed81('0xae')],'as':_0xed81('0xaf')},{'model':db['Interval'],'as':_0xed81('0xb0'),'include':[{'model':db['Interval'],'as':_0xed81('0x39'),'attributes':['id',_0xed81('0x2f')],'raw':!![]}]}]});})[_0xed81('0x24')](function(_0x46b0d0){if(!_0x46b0d0)throw new APINotFoundError(util[_0xed81('0x2d')](_0xed81('0xb1'),_0x4044f4[_0xed81('0x68')]['id']));if(!_0x46b0d0[_0xed81('0xb0')]||!_0x46b0d0['Interval'][_0xed81('0x39')])return[_0x46b0d0,!![]];return[_0x46b0d0,checkWebsiteIntervals(_0x46b0d0)];})[_0xed81('0xb2')](function(_0x5184c9,_0x4b7182){if(!_0x4b7182)throw new APIOutOfIntervalError();if(!_0x5184c9[_0xed81('0xaa')])return;_0x55b4e9[_0xed81('0xb3')]=_0x5184c9;_0x55b4e9[_0xed81('0xb4')]=_0x5184c9[_0xed81('0xaa')];_0x55b4e9[_0xed81('0xb5')]=_[_0xed81('0xb6')](_0x5184c9[_0xed81('0xaf')],[_0xed81('0xb7')],['asc']);if(_0x55b4e9['account'][_0xed81('0xaf')]){delete _0x55b4e9['account'][_0xed81('0xaf')];}if(_0x55b4e9[_0xed81('0xb3')][_0xed81('0xaa')]&&_0x55b4e9[_0xed81('0xb3')][_0xed81('0xaa')][_0xed81('0xac')][_0xed81('0x59')]){return _0x55b4e9[_0xed81('0xb3')][_0xed81('0xaa')][_0xed81('0xac')][0x0];}var _0x405c81=_[_0xed81('0xb8')](_0x4044f4['body'],{'firstName':_0x4044f4[_0xed81('0x6c')][_0xed81('0xa8')],'ListId':_0x5184c9[_0xed81('0xa3')]});_0x405c81[_0x4044f4[_0xed81('0x6c')]['mapKey']]=_0x4044f4[_0xed81('0x6c')][_0xed81('0xa8')];return db['CmContact'][_0xed81('0x6b')](_0x405c81,{'fields':_0x4b6e74,'raw':!![]});})[_0xed81('0x24')](function(_0x3770a5){_0x55b4e9[_0xed81('0xb9')]=_0x3770a5;var _0xbfb92=createInteractionObject(_0x4044f4[_0xed81('0x68')]['id'],_0x4044f4[_0xed81('0x6c')],_0x4044f4[_0xed81('0xba')],_0x3770a5);var _0x10cd7f={'ChatWebsiteId':_0x4044f4[_0xed81('0x68')]['id'],'closed':![]};if(_0x4044f4[_0xed81('0x6c')]['threadId']){_0x10cd7f['threadId']=_0x4044f4['body'][_0xed81('0xbb')];return db[_0xed81('0xbc')]['find']({'where':_0x10cd7f})[_0xed81('0x24')](function(_0x59ecdd){if(_0x59ecdd){_0x23df02=!![];return _0x59ecdd;}_0xbfb92['threadId']=_0x4044f4[_0xed81('0x6c')][_0xed81('0xbb')];_0xbfb92[_0xed81('0xbd')]=_0x4044f4['body']['externalUrl'];return db[_0xed81('0xbc')][_0xed81('0x6b')](_0xbfb92);});}_0x10cd7f[_0xed81('0xbe')]=_0x3770a5['id'];if(_0x4044f4['body']['interaction']&&_0x4044f4[_0xed81('0x6c')]['interaction']['id']){_0x10cd7f['id']=_0x4044f4['body'][_0xed81('0xbf')]['id'];return db[_0xed81('0xbc')][_0xed81('0x6a')]({'where':_0x10cd7f})['then'](function(_0x5d3d2e){if(_0x5d3d2e){_0x23df02=!![];return _0x5d3d2e;}return db[_0xed81('0xbc')][_0xed81('0x6b')](_0xbfb92);});}return db[_0xed81('0xbc')][_0xed81('0x6b')](_0xbfb92);})[_0xed81('0x24')](function(_0x231855){if(!_0x23df02)return _0x231855;var _0x627c27={'from':(_0x55b4e9[_0xed81('0xb9')][_0xed81('0x42')]||'')+'\x20'+(_0x55b4e9[_0xed81('0xb9')][_0xed81('0xc0')]||'')};if(_0x4044f4['body']['threadId']&&_0x4044f4[_0xed81('0x6c')]['messageId']&&_0x4044f4[_0xed81('0x6c')][_0xed81('0xbb')]!=_0x4044f4[_0xed81('0x6c')][_0xed81('0xc1')]){_0x627c27[_0xed81('0xbb')]=_0x4044f4[_0xed81('0x6c')][_0xed81('0xc1')];}return _0x231855['update'](_0x627c27);})['then'](function(_0x249eb3){_0x55b4e9[_0xed81('0xbf')]=_0x249eb3[_0xed81('0x26')]({'plain':!![]});_0x55b4e9[_0xed81('0xbf')][_0xed81('0xc2')]=!_0x23df02;if(_0x55b4e9[_0xed81('0xbf')]['created']){if(_0x55b4e9[_0xed81('0xb3')][_0xed81('0xc3')]){_0x55b4e9[_0xed81('0xb5')][_0xed81('0xc4')]({'id':0x0,'priority':_0x55b4e9['applications'][_0xed81('0x59')]+0x1,'app':_0xed81('0xc5'),'appdata':_0xed81('0xc6'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0xed81('0x6b')]({'body':_0x4044f4[_0xed81('0x6c')][_0xed81('0x6c')],'ChatWebsiteId':_0x4044f4[_0xed81('0x68')]['id'],'ChatInteractionId':_0x249eb3['id'],'direction':'in','ContactId':_0x55b4e9['contact']['id'],'AttachmentId':_0x4044f4[_0xed81('0x6c')][_0xed81('0xc7')]});})[_0xed81('0x24')](function(_0x312089){_0x55b4e9[_0xed81('0x1c')]=_0x312089;if(!_0x55b4e9[_0xed81('0xbf')]['UserId']){return;}return db[_0xed81('0xc8')][_0xed81('0x6a')]({'attributes':['id',_0xed81('0x29')],'where':{'id':_0x55b4e9[_0xed81('0xbf')][_0xed81('0xc9')]}});})[_0xed81('0x24')](function(_0x16a59b){if(_0x16a59b){_0x55b4e9[_0xed81('0xb5')][_0xed81('0xca')]({'id':0x0,'priority':0x0,'app':_0xed81('0xcb'),'appdata':_0x16a59b[_0xed81('0x29')]+','+(_0x55b4e9[_0xed81('0xb3')][_0xed81('0xcc')]||0xa),'interval':'*,*,*,*'});_0x55b4e9[_0xed81('0xcd')]=!![];}if(!_0x55b4e9[_0xed81('0xbf')][_0xed81('0xce')]){return;}return db[_0xed81('0xcf')][_0xed81('0x6a')]({'attributes':['id',_0xed81('0x29')],'where':{'id':_0x55b4e9[_0xed81('0xbf')]['queueId']}});})[_0xed81('0x24')](function(_0x25e496){if(_0x25e496){_0x55b4e9['applications'][_0xed81('0xca')]({'id':0x0,'priority':0x1,'app':_0xed81('0xd0'),'appdata':_0x25e496['name']+','+(_0x55b4e9[_0xed81('0xb3')][_0xed81('0xd1')]||0x12c),'interval':_0xed81('0xd2')});}return respondWithRpcPromise(_0xed81('0xd3'),_0xed81('0xd4'),_0x55b4e9);})['then'](function(_0x6b0d2c){respondWithRpcPromise(_0xed81('0xd5'),_0xed81('0xd5'),{'event':_0xed81('0xd6'),'message':_0x6b0d2c},client9002);return _0x6b0d2c;})[_0xed81('0x24')](respondWithResult(_0x6775e9,null))['catch'](APIHandleError(_0x6775e9));};exports[_0xed81('0xd7')]=function(_0x31af7f,_0x1a8aff){var _0x9e7182,_0x2606e0,_0x1dd450;var _0xe0a23a=[];var _0x1edaf7={};var _0x3fe693=_0x31af7f[_0xed81('0xd8')]||[];var _0x430cd1=[];var _0x315e17;return db[_0xed81('0xab')]['describe']()[_0xed81('0x24')](function(_0x1ceade){if(!_0x1ceade){throw new db[(_0xed81('0x9c'))][(_0xed81('0x9d'))](_0xed81('0x9e'));}_0xe0a23a=_[_0xed81('0x9f')](_[_0xed81('0x53')](_0x1ceade),[_0xed81('0xa0'),_0xed81('0xa1'),_0xed81('0xa2'),_0xed81('0xa3')]);if(_0x31af7f[_0xed81('0x6c')]['id']){delete _0x31af7f['body']['id'];}if(_[_0xed81('0x92')](_0x31af7f[_0xed81('0x6c')][_0xed81('0xa8')])){throw _0x1a8aff['status'](0x1f4)[_0xed81('0xd9')](new db[(_0xed81('0x9c'))][(_0xed81('0x9d'))](_0xed81('0xa4')));}if(_['isNil'](_0x31af7f[_0xed81('0x6c')][_0xed81('0x6c')])||_0x31af7f[_0xed81('0x6c')][_0xed81('0x6c')]===''){throw _0x1a8aff['status'](0x1f4)['send'](new db[(_0xed81('0x9c'))]['ValidationError'](_0xed81('0xda')));}if(_['isNil'](_0x31af7f[_0xed81('0x6c')][_0xed81('0xdb')])){throw _0x1a8aff[_0xed81('0x1e')](0x1f4)[_0xed81('0xd9')](new db[(_0xed81('0x9c'))][(_0xed81('0x9d'))](_0xed81('0xdc')+_0xe0a23a));}if(!_['includes'](_0xe0a23a,_0x31af7f['body'][_0xed81('0xdb')])){throw _0x1a8aff['status'](0x1f4)[_0xed81('0xd9')](new db['Sequelize']['ValidationError'](_0xed81('0xdd')+_0xe0a23a));}_0x1edaf7[_0x31af7f['body'][_0xed81('0xdb')]]=_0x31af7f[_0xed81('0x6c')][_0xed81('0xa8')];})[_0xed81('0x24')](function(){return db[_0xed81('0x63')][_0xed81('0x6a')]({'where':{'id':_0x31af7f['params']['id']},'include':[{'model':db[_0xed81('0xa9')],'as':_0xed81('0xaa')},{'model':db[_0xed81('0xde')],'as':_0xed81('0xde')}]});})[_0xed81('0x24')](handleEntityNotFound(_0x1a8aff,null))[_0xed81('0x24')](function(_0x39184a){if(_0x39184a&&_0x39184a[_0xed81('0xaa')]){_0x2606e0=_0x39184a;var _0x2b2b57=_[_0xed81('0xb8')](_0x31af7f[_0xed81('0x6c')],{'firstName':_0x31af7f[_0xed81('0x6c')]['from'],'phone':_0x31af7f[_0xed81('0x6c')][_0xed81('0xa8')],'ListId':_0x39184a[_0xed81('0xa3')]});_0x2b2b57[_0x31af7f[_0xed81('0x6c')][_0xed81('0xdb')]]=_0x31af7f[_0xed81('0x6c')][_0xed81('0xa8')];return db[_0xed81('0xab')][_0xed81('0xdf')]({'where':_0x1edaf7,'defaults':_0x2b2b57});}})[_0xed81('0xb2')](function(_0x333805){if(_0x333805){_0x1dd450=_0x333805;var _0x37677e=fs[_0xed81('0xe0')](path['join'](config[_0xed81('0x8d')],_0xed81('0xe1')),_0xed81('0xe2'));var _0x7bfcc9=ejs[_0xed81('0xe3')](_0x37677e,{'body':_['toPairs'](_0x31af7f[_0xed81('0x6c')][_0xed81('0x6c')]),'bodyTitle':_0x2606e0[_0xed81('0xe4')]});return db[_0xed81('0xe5')][_0xed81('0x6b')]({'body':_0x7bfcc9,'plainBody':htmlToText['fromString'](_0x7bfcc9),'ContactId':_0x333805['id'],'ChatWebsiteId':_0x2606e0['id']});}})[_0xed81('0x24')](function(_0x423ac2){_0x315e17=_0x423ac2;if(_0x3fe693[_0xed81('0x59')]){var _0x20e404=_0x3fe693['map'](function(_0x12c677){return{'name':_0x12c677[_0xed81('0xe6')],'basename':_0x12c677['filename'],'type':_0x12c677[_0xed81('0xe7')],'ChatOfflineMessageId':_0x423ac2['id']};});_0x430cd1=_0x20e404[_0xed81('0x38')](_0x2799c8=>{var _0x31a24a={'filename':_0x2799c8[_0xed81('0x29')],'path':path[_0xed81('0x8c')](config[_0xed81('0x8d')],_0xed81('0xe8'),'files','attachments','offline-chat',_0x2799c8[_0xed81('0xe9')])};return _0x31a24a;});if(!_0x2606e0[_0xed81('0xea')]){return db[_0xed81('0xeb')][_0xed81('0xec')](function(_0xf5fbf6){return db[_0xed81('0xed')][_0xed81('0xee')](_0x20e404,{'transaction':_0xf5fbf6});});}}})['then'](function(){if(_0x315e17){_0x9e7182=_0x315e17;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xed81('0xef')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xed81('0xf0')],'as':_0xed81('0xf0'),'raw':!![]}]}]});}})[_0xed81('0x24')](function(_0x17f2b6){if(_0x17f2b6&&_0x17f2b6[_0xed81('0xf1')]&&_0x2606e0['forwardOffline']&&_0x2606e0['forwardOfflineAddress']){var _0x2ef6ab=_0x17f2b6[_0xed81('0xf2')]();return respondWithRpcPromise(_0xed81('0xf3'),_0xed81('0xf4'),{'account':_0x2ef6ab,'message':{'from':util[_0xed81('0x2d')](_0xed81('0xf5'),_0x17f2b6[_0xed81('0x29')],_0x17f2b6[_0xed81('0xf6')]||_0x17f2b6['Smtp'][_0xed81('0x6d')]),'to':_0x2606e0[_0xed81('0xf7')],'subject':_0x2606e0[_0xed81('0xf8')],'html':_0x9e7182['body'],'attachments':_0x430cd1}},client9003)['then'](function(){return _0x9e7182;})['catch'](function(_0x47e096){logger['error'](_0x47e096);});}})['then'](function(){if(_0x2606e0&&_0x2606e0[_0xed81('0xea')]&&_0x2606e0[_0xed81('0xf9')]){var _0x1defa3=[];if(_0x3fe693['length']){_0x1defa3=_0x3fe693[_0xed81('0x38')](function(_0x5323ca){return{'name':_0x5323ca['originalname'],'basename':_0x5323ca['filename'],'type':_0x5323ca[_0xed81('0xe7')],'ChatOfflineMessageId':_0x315e17['id']};});}var _0x17594d;if(!_[_0xed81('0x92')](_0x2606e0[_0xed81('0xfa')])){var _0x1204a2=_[_0xed81('0x38')](_0x31af7f['body'],function(_0x127678){return _0x127678;});var _0x3b61fe=_[_0xed81('0xfb')](_0x1204a2)[0x0];var _0x4d4baa=_[_0xed81('0xfc')](_0x3b61fe,function(_0x85b1c2){return _0x85b1c2;});_0x17594d=_0x4d4baa[0x1][_0x2606e0[_0xed81('0xfa')]];}var _0x28b064={'from':_0x1dd450[_0xed81('0xf6')],'firstName':_0x1dd450['firstName'],'lastName':_0x1dd450['lastName'],'mapKey':_0xed81('0xf6'),'message':{'from':_0x1dd450[_0xed81('0xf6')],'to':_0x2606e0[_0xed81('0xde')][_0xed81('0xf6')],'cc':'','subject':_[_0xed81('0x92')](_0x17594d)?_0x2606e0[_0xed81('0xf8')]:_0x17594d,'messageId':'','sentAt':new Date(),'attach':_0x1defa3['length'],'attachments':_0x1defa3,'originChannel':_0xed81('0xfd'),'ChatWebsiteId':_0x2606e0['id'],'ChatOfflineMessageId':_0x9e7182['id'],'originTo':_0x2606e0[_0xed81('0xde')][_0xed81('0xf6')]},'body':_0x9e7182[_0xed81('0x6c')]};var _0x342e79={'account':{'id':_0x2606e0[_0xed81('0xf9')]},'body':_0x28b064,'log':_0xed81('0xfe')};return respondWithRpcPromise(_0xed81('0xfe'),_0xed81('0xff'),_0x342e79,client9001)[_0xed81('0x24')](function(){return _0x9e7182;})[_0xed81('0x73')](function(_0x5a3e25){logger['error'](_0x5a3e25);});}return;})[_0xed81('0x24')](function(){if(_0x9e7182){return _0x9e7182;}})['then'](respondWithResult(_0x1a8aff,null))[_0xed81('0x73')](function(){for(var _0x3d0a23 of _0x3fe693){var _0x173611=path['join'](config[_0xed81('0x8d')],_0xed81('0xe8'),_0xed81('0xd8'),_0xed81('0x100'),'offline-chat',_0x3d0a23[_0xed81('0x86')]);fs_extra['remove'](_0x173611)[_0xed81('0x73')](function(_0x454b02){logger['error'](_0xed81('0x101'),_0x173611,_0x454b02);});}});};exports['addInteraction']=function(_0x21a0e1,_0x3bcc37){return db[_0xed81('0xbc')][_0xed81('0x6a')]({'where':{'id':_0x21a0e1[_0xed81('0x68')]['id']}})[_0xed81('0x24')](handleEntityNotFound(_0x3bcc37,null))[_0xed81('0x24')](function(_0x5af041){if(_0x5af041){return _0x5af041[_0xed81('0x102')](_0x21a0e1[_0xed81('0x6c')][_0xed81('0x7b')],_[_0xed81('0x103')](_0x21a0e1[_0xed81('0x6c')],[_0xed81('0x7b'),'id'])||{});}})[_0xed81('0x24')](respondWithResult(_0x3bcc37,null))['catch'](handleError(_0x3bcc37,null));};exports['getInteractions']=function(_0xb392a7,_0x3d1b67){var _0x108c2e={'raw':![],'where':{}};var _0x36b031={};var _0x596047={'count':0x0,'rows':[]};return db[_0xed81('0x63')][_0xed81('0x7f')]({'where':{'id':_0xb392a7[_0xed81('0x68')]['id']}})[_0xed81('0x24')](handleEntityNotFound(_0x3d1b67,null))[_0xed81('0x24')](function(_0xb03d73){if(_0xb03d73){_0x36b031['model']=_['keys'](db[_0xed81('0xbc')]['rawAttributes']);_0x36b031[_0xed81('0x54')]=_['keys'](_0xb392a7['query']);_0x36b031[_0xed81('0x55')]=_[_0xed81('0x56')](_0x36b031[_0xed81('0x4a')],_0x36b031['query']);_0x108c2e[_0xed81('0x57')]=_['intersection'](_0x36b031[_0xed81('0x4a')],qs[_0xed81('0x58')](_0xb392a7[_0xed81('0x54')][_0xed81('0x58')]));_0x108c2e[_0xed81('0x57')]=_0x108c2e[_0xed81('0x57')][_0xed81('0x59')]?_0x108c2e[_0xed81('0x57')]:_0x36b031[_0xed81('0x4a')];if(!_0xb392a7[_0xed81('0x54')]['hasOwnProperty'](_0xed81('0x104'))){_0x108c2e['limit']=qs[_0xed81('0x22')](_0xb392a7['query'][_0xed81('0x22')]);_0x108c2e['offset']=qs[_0xed81('0x1f')](_0xb392a7[_0xed81('0x54')]['offset']);}_0x108c2e[_0xed81('0x5b')]=qs[_0xed81('0x5c')](_0xb392a7[_0xed81('0x54')][_0xed81('0x5c')]);_0x108c2e[_0xed81('0x5d')]=qs[_0xed81('0x55')](_[_0xed81('0x5e')](_0xb392a7['query'],_0x36b031[_0xed81('0x55')]));_0x108c2e[_0xed81('0x5d')][_0xed81('0x76')]=_0xb03d73['id'];if(_0xb392a7[_0xed81('0x54')][_0xed81('0x5f')]){_0x108c2e[_0xed81('0x5d')]=_[_0xed81('0x60')](_0x108c2e[_0xed81('0x5d')],{'$or':_[_0xed81('0x38')](_0x108c2e[_0xed81('0x57')],function(_0x356f9b){var _0x5c4395={};_0x5c4395[_0x356f9b]={'$like':'%'+_0xb392a7[_0xed81('0x54')][_0xed81('0x5f')]+'%'};return _0x5c4395;})});}_0x108c2e=_[_0xed81('0x60')]({},_0x108c2e,_0xb392a7[_0xed81('0x62')]);return db[_0xed81('0xbc')][_0xed81('0x21')]({'where':_0x108c2e[_0xed81('0x5d')]})[_0xed81('0x24')](function(_0xe71c96){_0x596047[_0xed81('0x21')]=_0xe71c96;if(_0xb392a7['query'][_0xed81('0x64')]){_0x108c2e[_0xed81('0x65')]=[{'model':db[_0xed81('0xab')],'as':_0xed81('0x105'),'required':![]},{'model':db[_0xed81('0xc8')],'as':_0xed81('0x106'),'attributes':[_0xed81('0x29'),_0xed81('0x107'),_0xed81('0x108')],'required':![]},{'model':db[_0xed81('0x109')],'as':_0xed81('0x10a'),'attributes':['id',_0xed81('0x29'),_0xed81('0x10b')],'where':_0xb392a7[_0xed81('0x54')][_0xed81('0x10c')]?{'id':_0xb392a7[_0xed81('0x54')][_0xed81('0x10c')]}:undefined,'required':_0xb392a7[_0xed81('0x54')][_0xed81('0x10c')]?!![]:![]}];}return db[_0xed81('0xbc')][_0xed81('0x79')](_0x108c2e);})[_0xed81('0x24')](function(_0x50b156){_0x596047[_0xed81('0x66')]=_0x50b156;return _0x596047;});}})[_0xed81('0x24')](respondWithFilteredResult(_0x3d1b67,_0x108c2e))['catch'](handleError(_0x3d1b67,null));};exports[_0xed81('0x2b')]=function(_0x25bf60,_0x1c8d8a){var _0x1f360e=0x0;var _0x2d194d=0x0;var _0x350d8b=![];var _0x17c2bf;var _0x88d917;return db[_0xed81('0x63')][_0xed81('0x6a')]({'where':{'id':_0x25bf60[_0xed81('0x68')]['id']},'include':[{'model':db['Interval'],'as':_0xed81('0xb0'),'include':[{'model':db[_0xed81('0xb0')],'as':_0xed81('0x39'),'attributes':['id','interval']}]}]})[_0xed81('0x24')](handleEntityNotFound(_0x1c8d8a,null))['then'](function(_0x1feb63){if(_0x1feb63){_0x17c2bf=_0x1feb63;return _0x1feb63[_0xed81('0x10d')]({'raw':!![]});}})[_0xed81('0x24')](function(_0x503aa6){if(_0x17c2bf){if(_0x503aa6){_0x88d917=_0x503aa6;}}return require(_0xed81('0x8f'))[_0xed81('0x90')]();})[_0xed81('0x24')](function(_0x1c0ba5){if(_0x1c0ba5){_0x2d194d=_0x1c0ba5[_0xed81('0x10e')];_0x350d8b=_0x1c0ba5[_0xed81('0x91')];}})['then'](function(){return db[_0xed81('0xbc')][_0xed81('0x21')]({'where':{'closed':![]}});})[_0xed81('0x24')](function(_0x461f25){_0x1f360e=_0x461f25;if(_0x2d194d&&_0x461f25>_0x2d194d){return db[_0xed81('0x10f')][_0xed81('0x7f')]({'where':{'id':0x1}})[_0xed81('0x24')](function(_0xe1a5d6){if(_0xe1a5d6){_0xe1a5d6[_0xed81('0x110')](_0xed81('0x111'));}});}})[_0xed81('0x24')](function(){if(!_0x17c2bf[_0xed81('0xb0')]||!_0x17c2bf[_0xed81('0xb0')][_0xed81('0x39')])return!![];return checkWebsiteIntervals(_0x17c2bf);})[_0xed81('0x24')](function(_0x6946ef){var _0x12ac4f=fs[_0xed81('0xe0')](path[_0xed81('0x8c')](config[_0xed81('0x8d')],_0xed81('0x112')),'utf8');var _0x229377=new url[(_0xed81('0x113'))](_0x17c2bf['address'])[_0xed81('0x114')];var _0x5886dc=_0xed81('0x115');var _0x523318=![];var _0x49baae={'chatVersion':_0x5886dc,'chatWebsiteAddressOrigin':_0x229377,'remote':_0x17c2bf['remote'],'query':querystring[_0xed81('0x4e')](_[_0xed81('0x60')](_0x17c2bf[_0xed81('0x26')]({'plain':!![]}),{'customerIp':_0x25bf60[_0xed81('0xba')][_0xed81('0x40')]||_0x25bf60['headers'][_0xed81('0x116')]||_0x25bf60[_0xed81('0x117')]['remoteAddress']||_0x25bf60['ip'],'referer':_0x25bf60[_0xed81('0xba')][_0xed81('0x44')],'openedInteractions':_0x1f360e,'maxInteractions':_0x2d194d,'virtual':_0x350d8b[_0xed81('0x10e')],'online':_0x6946ef,'custom':_0x350d8b}))['replace'](/'/g,'\x5c\x27')};_0x1c8d8a[_0xed81('0xd9')](ejs['render'](Mustache[_0xed81('0xe3')](_0x12ac4f,_0x49baae),{'proactiveActions':_0x88d917,'alignment':_0x17c2bf[_0xed81('0x118')],'verticalAlignment':_0x17c2bf['verticalAlignment'],'div_color':_0x17c2bf[_0xed81('0x10b')],'labelText':_0x17c2bf[_0xed81('0x119')],'text_color':_0x17c2bf['textColor'],'text_button_color':_0x17c2bf[_0xed81('0x11a')],'button_color':_0x17c2bf[_0xed81('0x11b')],'background_color':_0x17c2bf['backgroundColor'],'hideWhenOffline':_0x17c2bf[_0xed81('0x11c')],'intervalId':_0x17c2bf[_0xed81('0x11d')],'isDevelopment':_0x523318,'chatVersion':_0x5886dc}));})[_0xed81('0x73')](handleError(_0x1c8d8a,null));};exports[_0xed81('0x11e')]=function(_0x1b40df,_0x3d5565){var _0x5922f1=_0x1b40df[_0xed81('0x68')]['id'];var _0xeb84de=_0x1b40df[_0xed81('0x6c')];var _0x3e6d17=0xc8;var _0x299bd5=null;return db[_0xed81('0xeb')][_0xed81('0xec')]({'isolationLevel':db[_0xed81('0xeb')][_0xed81('0x11f')][_0xed81('0x120')][_0xed81('0x121')]},function(_0x10e0c3){return db[_0xed81('0x63')][_0xed81('0x7f')]({'where':{'id':_0x5922f1},'transaction':_0x10e0c3})[_0xed81('0x24')](function(_0x17c2b1){if(_0x17c2b1){return db[_0xed81('0xae')][_0xed81('0x25')]({'where':{'ChatWebsiteId':_0x5922f1},'transaction':_0x10e0c3})['then'](function(){var _0x2b7880=_['map'](_0xeb84de,function(_0x3ef19e){_0x3ef19e[_0xed81('0x76')]=_0x5922f1;return _0x3ef19e;});return db[_0xed81('0xae')]['bulkCreate'](_0x2b7880,{'transaction':_0x10e0c3});});}else{_0x3e6d17=0x194;_0x299bd5=[];}});})[_0xed81('0x24')](function(){if(_0x3e6d17!==0x194){return db['ChatApplication'][_0xed81('0x122')]({'where':{'ChatWebsiteId':_0x5922f1},'order':'priority'})[_0xed81('0x24')](function(_0x550003){_0x299bd5=_0x550003;});}})[_0xed81('0x73')](function(_0x607200){_0x3e6d17=0x1f4;logger[_0xed81('0x1a')](_0x607200[_0xed81('0x28')]);if(_0x607200[_0xed81('0x29')]){delete _0x607200[_0xed81('0x29')];}_0x299bd5=_0x607200;})[_0xed81('0x123')](function(){if(_0x299bd5===null){_0x3d5565[_0xed81('0x1d')](_0x3e6d17);}else{if(_0x3e6d17===0x1f4){_0x3d5565['status'](_0x3e6d17)['send'](_0x299bd5);}else{_0x3d5565[_0xed81('0x1e')](_0x3e6d17)['json'](_0x299bd5);}}});};exports[_0xed81('0x124')]=function(_0x33e285,_0x365104){var _0x17294f={};var _0x1f2398={};var _0x4df90b;var _0x24b41f;return db['ChatWebsite'][_0xed81('0x7f')]({'where':{'id':_0x33e285['params']['id']}})[_0xed81('0x24')](handleEntityNotFound(_0x365104,null))['then'](function(_0x283829){if(_0x283829){_0x4df90b=_0x283829;_0x1f2398[_0xed81('0x4a')]=_['keys'](db[_0xed81('0xae')][_0xed81('0x50')]);_0x1f2398[_0xed81('0x54')]=_[_0xed81('0x53')](_0x33e285[_0xed81('0x54')]);_0x1f2398[_0xed81('0x55')]=_[_0xed81('0x56')](_0x1f2398[_0xed81('0x4a')],_0x1f2398['query']);_0x17294f['attributes']=_[_0xed81('0x56')](_0x1f2398[_0xed81('0x4a')],qs['fields'](_0x33e285[_0xed81('0x54')]['fields']));_0x17294f[_0xed81('0x57')]=_0x17294f['attributes'][_0xed81('0x59')]?_0x17294f[_0xed81('0x57')]:_0x1f2398[_0xed81('0x4a')];_0x17294f['order']=qs[_0xed81('0x5c')](_0x33e285[_0xed81('0x54')][_0xed81('0x5c')]);_0x17294f['where']=qs[_0xed81('0x55')](_[_0xed81('0x5e')](_0x33e285[_0xed81('0x54')],_0x1f2398['filters']));if(_0x33e285[_0xed81('0x54')][_0xed81('0x5f')]){_0x17294f[_0xed81('0x5d')]=_[_0xed81('0x60')](_0x17294f[_0xed81('0x5d')],{'$or':_[_0xed81('0x38')](_0x17294f[_0xed81('0x57')],function(_0x300da5){var _0x42ad86={};_0x42ad86[_0x300da5]={'$like':'%'+_0x33e285[_0xed81('0x54')][_0xed81('0x5f')]+'%'};return _0x42ad86;})});}_0x17294f=_[_0xed81('0x60')]({},_0x17294f,_0x33e285[_0xed81('0x62')]);return _0x4df90b['getApplications'](_0x17294f);}})[_0xed81('0x24')](function(_0x5b8413){if(_0x5b8413){_0x24b41f=_0x5b8413[_0xed81('0x59')];if(!_0x33e285[_0xed81('0x54')][_0xed81('0x5a')](_0xed81('0x104'))){_0x17294f[_0xed81('0x22')]=qs['limit'](_0x33e285[_0xed81('0x54')][_0xed81('0x22')]);_0x17294f[_0xed81('0x1f')]=qs[_0xed81('0x1f')](_0x33e285['query'][_0xed81('0x1f')]);}return _0x4df90b[_0xed81('0x124')](_0x17294f);}})[_0xed81('0x24')](function(_0x313f08){if(_0x313f08){return _0x313f08?{'count':_0x24b41f,'rows':_0x313f08}:null;}})[_0xed81('0x24')](respondWithResult(_0x365104,null))[_0xed81('0x73')](handleError(_0x365104,null));};exports[_0xed81('0x125')]=function(_0xd6c612,_0x1a388d){return db[_0xed81('0x126')][_0xed81('0x6a')]({'where':{'id':_0xd6c612['params']['id']}})['then'](handleEntityNotFound(_0x1a388d,null))[_0xed81('0x24')](function(_0x1fb3d2){if(_0x1fb3d2){return _0x1fb3d2[_0xed81('0x125')](_0xd6c612[_0xed81('0x6c')][_0xed81('0x7b')],_[_0xed81('0x103')](_0xd6c612[_0xed81('0x6c')],[_0xed81('0x7b'),'id'])||{});}})[_0xed81('0x24')](respondWithResult(_0x1a388d,null))[_0xed81('0x73')](handleError(_0x1a388d,null));};exports['getProactiveActions']=function(_0x40fb73,_0x5ca1e8){var _0x24822f={};var _0x1cbdf2={};var _0x5dbcc0;var _0x391c01;return db[_0xed81('0x63')][_0xed81('0x7f')]({'where':{'id':_0x40fb73[_0xed81('0x68')]['id']}})['then'](handleEntityNotFound(_0x5ca1e8,null))[_0xed81('0x24')](function(_0x1b7bf7){if(_0x1b7bf7){_0x5dbcc0=_0x1b7bf7;_0x1cbdf2[_0xed81('0x4a')]=_[_0xed81('0x53')](db[_0xed81('0x127')][_0xed81('0x50')]);_0x1cbdf2[_0xed81('0x54')]=_[_0xed81('0x53')](_0x40fb73['query']);_0x1cbdf2[_0xed81('0x55')]=_[_0xed81('0x56')](_0x1cbdf2['model'],_0x1cbdf2[_0xed81('0x54')]);_0x24822f[_0xed81('0x57')]=_[_0xed81('0x56')](_0x1cbdf2['model'],qs['fields'](_0x40fb73[_0xed81('0x54')][_0xed81('0x58')]));_0x24822f[_0xed81('0x57')]=_0x24822f[_0xed81('0x57')][_0xed81('0x59')]?_0x24822f[_0xed81('0x57')]:_0x1cbdf2[_0xed81('0x4a')];_0x24822f['order']=qs[_0xed81('0x5c')](_0x40fb73[_0xed81('0x54')][_0xed81('0x5c')]);_0x24822f['where']=qs[_0xed81('0x55')](_[_0xed81('0x5e')](_0x40fb73[_0xed81('0x54')],_0x1cbdf2[_0xed81('0x55')]));if(_0x40fb73[_0xed81('0x54')][_0xed81('0x5f')]){_0x24822f[_0xed81('0x5d')]=_[_0xed81('0x60')](_0x24822f[_0xed81('0x5d')],{'$or':_[_0xed81('0x38')](_0x24822f['attributes'],function(_0x322c27){var _0x2b9ce3={};_0x2b9ce3[_0x322c27]={'$like':'%'+_0x40fb73[_0xed81('0x54')]['filter']+'%'};return _0x2b9ce3;})});}_0x24822f=_['merge']({},_0x24822f,_0x40fb73[_0xed81('0x62')]);return _0x5dbcc0['getProactiveActions'](_0x24822f);}})['then'](function(_0x10e151){if(_0x10e151){_0x391c01=_0x10e151[_0xed81('0x59')];if(!_0x40fb73[_0xed81('0x54')][_0xed81('0x5a')](_0xed81('0x104'))){_0x24822f[_0xed81('0x22')]=qs[_0xed81('0x22')](_0x40fb73[_0xed81('0x54')][_0xed81('0x22')]);_0x24822f[_0xed81('0x1f')]=qs[_0xed81('0x1f')](_0x40fb73[_0xed81('0x54')][_0xed81('0x1f')]);}return _0x5dbcc0[_0xed81('0x10d')](_0x24822f);}})['then'](function(_0x136a81){if(_0x136a81){return _0x136a81?{'count':_0x391c01,'rows':_0x136a81}:null;}})[_0xed81('0x24')](respondWithResult(_0x5ca1e8,null))[_0xed81('0x73')](handleError(_0x5ca1e8,null));};exports[_0xed81('0x128')]=function(_0x4e4b59,_0x5b8492){var _0xaf538f=_0x4e4b59[_0xed81('0x54')]['online']===_0xed81('0x129')?_0xed81('0x12a'):'onlineForm';return db[_0xed81('0x63')]['find']({'attributes':['id',_0xaf538f],'where':{'id':_0x4e4b59[_0xed81('0x68')]['id']}})[_0xed81('0x24')](handleEntityNotFound(_0x5b8492,null))['then'](function(_0x4bc9a2){if(_0x4bc9a2){var _0x4d9459=_0x4bc9a2[_0xaf538f];var _0xbd6b04=_0x4d9459&&_0x4d9459[_0xed81('0x12b')]?_0x4d9459[_0xed81('0x12b')]:[];_0x5b8492['send']({'fromKey':_['isNil'](_0x4d9459['fromKey'])?undefined:_0x4d9459[_0xed81('0x12c')],'count':_0xbd6b04['length'],'rows':_0xbd6b04});}})['catch'](handleError(_0x5b8492,null));};exports[_0xed81('0x12d')]=function(_0x3dd57e,_0x21572c){var _0x47e068={'raw':![],'where':{}};var _0x32c670={};var _0x5c7002={'count':0x0,'rows':[]};return db[_0xed81('0x63')][_0xed81('0x7f')]({'where':{'id':_0x3dd57e[_0xed81('0x68')]['id']}})[_0xed81('0x24')](handleEntityNotFound(_0x21572c,null))[_0xed81('0x24')](function(_0x441432){if(_0x441432){_0x32c670[_0xed81('0x4a')]=_[_0xed81('0x53')](db[_0xed81('0xe5')]['rawAttributes']);_0x32c670[_0xed81('0x54')]=_[_0xed81('0x53')](_0x3dd57e[_0xed81('0x54')]);_0x32c670['filters']=_['intersection'](_0x32c670[_0xed81('0x4a')],_0x32c670[_0xed81('0x54')]);_0x47e068[_0xed81('0x57')]=_[_0xed81('0x56')](_0x32c670['model'],qs[_0xed81('0x58')](_0x3dd57e[_0xed81('0x54')][_0xed81('0x58')]));_0x47e068[_0xed81('0x57')]=_0x47e068[_0xed81('0x57')][_0xed81('0x59')]?_0x47e068[_0xed81('0x57')]:_0x32c670[_0xed81('0x4a')];if(!_0x3dd57e['query'][_0xed81('0x5a')](_0xed81('0x104'))){_0x47e068[_0xed81('0x22')]=qs['limit'](_0x3dd57e['query'][_0xed81('0x22')]);_0x47e068[_0xed81('0x1f')]=qs[_0xed81('0x1f')](_0x3dd57e[_0xed81('0x54')][_0xed81('0x1f')]);}_0x47e068[_0xed81('0x5b')]=qs[_0xed81('0x5c')](_0x3dd57e[_0xed81('0x54')]['sort']);_0x47e068[_0xed81('0x5d')]=qs[_0xed81('0x55')](_[_0xed81('0x5e')](_0x3dd57e[_0xed81('0x54')],_0x32c670['filters']));_0x47e068[_0xed81('0x5d')]['ChatWebsiteId']=_0x441432['id'];if(_0x3dd57e[_0xed81('0x54')]['filter']){_0x47e068[_0xed81('0x5d')]=_[_0xed81('0x60')](_0x47e068['where'],{'$or':_[_0xed81('0x38')](_0x47e068[_0xed81('0x57')],function(_0x110c38){var _0x5b576d={};_0x5b576d[_0x110c38]={'$like':'%'+_0x3dd57e['query']['filter']+'%'};return _0x5b576d;})});}_0x47e068=_[_0xed81('0x60')]({},_0x47e068,_0x3dd57e[_0xed81('0x62')]);return db[_0xed81('0xe5')]['count']({'where':_0x47e068[_0xed81('0x5d')]})['then'](function(_0x14aaa1){_0x5c7002['count']=_0x14aaa1;if(_0x3dd57e['query'][_0xed81('0x64')]){_0x47e068[_0xed81('0x65')]=[{'all':!![]}];}else{_0x47e068['include']=[{'model':db[_0xed81('0xab')],'as':_0xed81('0x105'),'required':![]},{'model':db['Attachment'],'as':_0xed81('0x12e'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x47e068);})[_0xed81('0x24')](function(_0x1c333c){_0x5c7002[_0xed81('0x66')]=_0x1c333c;return _0x5c7002;});}})['then'](respondWithFilteredResult(_0x21572c,_0x47e068))[_0xed81('0x73')](handleError(_0x21572c,null));};exports['addAgents']=function(_0xa83e25,_0x31ef32){return db[_0xed81('0x63')]['find']({'where':{'id':_0xa83e25[_0xed81('0x68')]['id']}})['then'](handleEntityNotFound(_0x31ef32,null))[_0xed81('0x24')](function(_0x585c72){if(_0x585c72){return _0x585c72[_0xed81('0x12f')](_0xa83e25['body'][_0xed81('0x7b')],_['omit'](_0xa83e25[_0xed81('0x6c')],[_0xed81('0x7b'),'id'])||{})[_0xed81('0xb2')](function(_0xbc1487){for(var _0xc6976b=0x0;_0xc6976b<_0xa83e25['body'][_0xed81('0x7b')][_0xed81('0x59')];_0xc6976b+=0x1){socket['emit'](_0xed81('0x130'),{'UserId':Number(_0xa83e25[_0xed81('0x6c')]['ids'][_0xc6976b]),'ChatWebsiteId':Number(_0xa83e25[_0xed81('0x68')]['id'])});}return _0xbc1487;});}})[_0xed81('0x24')](respondWithResult(_0x31ef32,null))['catch'](handleError(_0x31ef32,null));};exports[_0xed81('0x131')]=function(_0x1ab622,_0x32faad){return db[_0xed81('0x63')][_0xed81('0x6a')]({'where':{'id':_0x1ab622[_0xed81('0x68')]['id']}})[_0xed81('0x24')](handleEntityNotFound(_0x32faad,null))[_0xed81('0x24')](function(_0x3ec984){if(_0x3ec984){return _0x3ec984['removeAgents'](_0x1ab622[_0xed81('0x54')][_0xed81('0x7b')])[_0xed81('0x24')](function(){if(_[_0xed81('0x132')](_0x1ab622[_0xed81('0x54')]['ids'])){for(var _0x483c0e=0x0;_0x483c0e<_0x1ab622[_0xed81('0x54')][_0xed81('0x7b')][_0xed81('0x59')];_0x483c0e+=0x1){socket['emit'](_0xed81('0x133'),{'UserId':Number(_0x1ab622[_0xed81('0x54')]['ids'][_0x483c0e]),'ChatWebsiteId':Number(_0x1ab622['params']['id'])});}}else{socket['emit'](_0xed81('0x133'),{'UserId':Number(_0x1ab622['query']['ids']),'ChatWebsiteId':Number(_0x1ab622[_0xed81('0x68')]['id'])});}});}})['then'](respondWithStatusCode(_0x32faad,null))['catch'](handleError(_0x32faad,null));};exports[_0xed81('0x134')]=function(_0x3cf5b3,_0x2dc262){var _0xf6271e={};var _0x3ad037={};var _0x4b1ba8;var _0xb3316d;return db[_0xed81('0x63')][_0xed81('0x7f')]({'where':{'id':_0x3cf5b3[_0xed81('0x68')]['id']}})[_0xed81('0x24')](handleEntityNotFound(_0x2dc262,null))['then'](function(_0x51f238){if(_0x51f238){_0x4b1ba8=_0x51f238;_0x3ad037[_0xed81('0x4a')]=_[_0xed81('0x53')](db[_0xed81('0xc8')][_0xed81('0x50')]);_0x3ad037[_0xed81('0x54')]=_[_0xed81('0x53')](_0x3cf5b3[_0xed81('0x54')]);_0x3ad037[_0xed81('0x55')]=_[_0xed81('0x56')](_0x3ad037[_0xed81('0x4a')],_0x3ad037['query']);_0xf6271e[_0xed81('0x57')]=_[_0xed81('0x56')](_0x3ad037['model'],qs[_0xed81('0x58')](_0x3cf5b3[_0xed81('0x54')][_0xed81('0x58')]));_0xf6271e[_0xed81('0x57')]=_0xf6271e[_0xed81('0x57')][_0xed81('0x59')]?_0xf6271e[_0xed81('0x57')]:_0x3ad037['model'];_0xf6271e[_0xed81('0x5b')]=qs['sort'](_0x3cf5b3[_0xed81('0x54')]['sort']);_0xf6271e['where']=qs[_0xed81('0x55')](_[_0xed81('0x5e')](_0x3cf5b3[_0xed81('0x54')],_0x3ad037['filters']));if(_0x3cf5b3[_0xed81('0x54')][_0xed81('0x5f')]){_0xf6271e[_0xed81('0x5d')]=_['merge'](_0xf6271e[_0xed81('0x5d')],{'$or':_[_0xed81('0x38')](_0xf6271e[_0xed81('0x57')],function(_0x1befb5){var _0x56a80c={};_0x56a80c[_0x1befb5]={'$like':'%'+_0x3cf5b3['query'][_0xed81('0x5f')]+'%'};return _0x56a80c;})});}_0xf6271e=_[_0xed81('0x60')]({},_0xf6271e,_0x3cf5b3[_0xed81('0x62')]);return _0x4b1ba8[_0xed81('0x134')](_0xf6271e);}})[_0xed81('0x24')](function(_0x2a892f){if(_0x2a892f){_0xb3316d=_0x2a892f[_0xed81('0x59')];if(!_0x3cf5b3['query'][_0xed81('0x5a')](_0xed81('0x104'))){_0xf6271e[_0xed81('0x22')]=qs[_0xed81('0x22')](_0x3cf5b3['query'][_0xed81('0x22')]);_0xf6271e[_0xed81('0x1f')]=qs[_0xed81('0x1f')](_0x3cf5b3[_0xed81('0x54')][_0xed81('0x1f')]);}return _0x4b1ba8[_0xed81('0x134')](_0xf6271e);}})[_0xed81('0x24')](function(_0x2953f3){if(_0x2953f3){return _0x2953f3?{'count':_0xb3316d,'rows':_0x2953f3}:null;}})[_0xed81('0x24')](respondWithResult(_0x2dc262,null))[_0xed81('0x73')](handleError(_0x2dc262,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index c71c331..ca933e3 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 _0xb2b5=['emit','hasOwnProperty','hook','save','update'];(function(_0x55e09d,_0x1f1f19){var _0x1a8715=function(_0x537ec0){while(--_0x537ec0){_0x55e09d['push'](_0x55e09d['shift']());}};_0x1a8715(++_0x1f1f19);}(_0xb2b5,0xa3));var _0x5b2b=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xb2b5[_0x88cd7b];return _0x56fcc8;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5b2b('0x0'),'afterUpdate':_0x5b2b('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4eee87){return function(_0x31784d,_0x11fae1,_0x51e747){ChatWebsiteEvents[_0x5b2b('0x2')](_0x4eee87+':'+_0x31784d['id'],_0x31784d);ChatWebsiteEvents['emit'](_0x4eee87,_0x31784d);_0x51e747(null);};}for(var e in events){if(events[_0x5b2b('0x3')](e)){var event=events[e];ChatWebsite[_0x5b2b('0x4')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x0851=['ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x35df55,_0x87d578){var _0x341d2f=function(_0x3c5806){while(--_0x3c5806){_0x35df55['push'](_0x35df55['shift']());}};_0x341d2f(++_0x87d578);}(_0x0851,0x8a));var _0x1085=function(_0x19d58c,_0x4b8060){_0x19d58c=_0x19d58c-0x0;var _0x1aed3e=_0x0851[_0x19d58c];return _0x1aed3e;};'use strict';var EventEmitter=require(_0x1085('0x0'));var ChatWebsite=require(_0x1085('0x1'))['db'][_0x1085('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1085('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1085('0x4'),'afterDestroy':_0x1085('0x5')};function emitEvent(_0x2de96f){return function(_0x3cbd88,_0x3b40fb,_0x3a528e){ChatWebsiteEvents[_0x1085('0x6')](_0x2de96f+':'+_0x3cbd88['id'],_0x3cbd88);ChatWebsiteEvents[_0x1085('0x6')](_0x2de96f,_0x3cbd88);_0x3a528e(null);};}for(var e in events){if(events[_0x1085('0x7')](e)){var event=events[e];ChatWebsite[_0x1085('0x8')](e,emitEvent(event));}}module[_0x1085('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 385eac9..ce82edf 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 _0xcd5d=['lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xcd5d,0xe7));var _0xdcd5=function(_0x4d06fb,_0x354453){_0x4d06fb=_0x4d06fb-0x0;var _0x586e1e=_0xcd5d[_0x4d06fb];return _0x586e1e;};'use strict';var _=require(_0xdcd5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdcd5('0x1'));var BPromise=require(_0xdcd5('0x2'));var rp=require(_0xdcd5('0x3'));var fs=require('fs');var path=require(_0xdcd5('0x4'));var rimraf=require(_0xdcd5('0x5'));var config=require(_0xdcd5('0x6'));var attributes=require(_0xdcd5('0x7'));module['exports']=function(_0x2eccf5,_0x2b8ee9){return _0x2eccf5[_0xdcd5('0x8')](_0xdcd5('0x9'),attributes,{'tableName':_0xdcd5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd95d=['ChatWebsite','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','define'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xd95d,0x1b9));var _0xdd95=function(_0x8203c3,_0x349fa7){_0x8203c3=_0x8203c3-0x0;var _0x10a9d8=_0xd95d[_0x8203c3];return _0x10a9d8;};'use strict';var _=require(_0xdd95('0x0'));var util=require('util');var logger=require(_0xdd95('0x1'))(_0xdd95('0x2'));var moment=require(_0xdd95('0x3'));var BPromise=require(_0xdd95('0x4'));var rp=require(_0xdd95('0x5'));var fs=require('fs');var path=require(_0xdd95('0x6'));var rimraf=require('rimraf');var config=require(_0xdd95('0x7'));var attributes=require(_0xdd95('0x8'));module['exports']=function(_0x1b138d,_0x11c31b){return _0x1b138d[_0xdd95('0x9')](_0xdd95('0xa'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index cde085e..fb4ed74 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 _0x8f43=['stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./chatWebsite.socket','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x45ba17,_0x5e14e4){var _0x3f3626=function(_0x5d90c2){while(--_0x5d90c2){_0x45ba17['push'](_0x45ba17['shift']());}};_0x3f3626(++_0x5e14e4);}(_0x8f43,0x12f));var _0x38f4=function(_0x3e920d,_0x1762d8){_0x3e920d=_0x3e920d-0x0;var _0x4fcdc6=_0x8f43[_0x3e920d];return _0x4fcdc6;};'use strict';var _=require(_0x38f4('0x0'));var util=require(_0x38f4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x38f4('0x2'));var fs=require('fs');var Redis=require(_0x38f4('0x3'));var db=require(_0x38f4('0x4'))['db'];var utils=require(_0x38f4('0x5'));var logger=require(_0x38f4('0x6'))(_0x38f4('0x7'));var config=require(_0x38f4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x38f4('0x9')][_0x38f4('0xa')]({'port':0x232a});config[_0x38f4('0xb')]=_[_0x38f4('0xc')](config[_0x38f4('0xb')],{'host':_0x38f4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38f4('0xb')]));require(_0x38f4('0xe'))['register'](socket);function respondWithRpcPromise(_0xfff9a3,_0x5be3c4,_0x3ee97){return new BPromise(function(_0x42bd98,_0x62438c){return client['request'](_0xfff9a3,_0x3ee97)[_0x38f4('0xf')](function(_0x36e096){logger[_0x38f4('0x10')](_0x38f4('0x11'),_0x5be3c4,_0x38f4('0x12'));logger[_0x38f4('0x13')](_0x38f4('0x14'),_0x5be3c4,_0x38f4('0x12'),JSON[_0x38f4('0x15')](_0x36e096));if(_0x36e096[_0x38f4('0x16')]){if(_0x36e096[_0x38f4('0x16')][_0x38f4('0x17')]===0x1f4){logger[_0x38f4('0x16')](_0x38f4('0x11'),_0x5be3c4,_0x36e096[_0x38f4('0x16')][_0x38f4('0x18')]);return _0x62438c(_0x36e096['error'][_0x38f4('0x18')]);}logger[_0x38f4('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x5be3c4,_0x36e096['error'][_0x38f4('0x18')]);return _0x42bd98(_0x36e096[_0x38f4('0x16')][_0x38f4('0x18')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5be3c4,_0x38f4('0x12'));_0x42bd98(_0x36e096[_0x38f4('0x19')]['message']);}})[_0x38f4('0x1a')](function(_0x3bbbeb){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x5be3c4,_0x3bbbeb);_0x62438c(_0x3bbbeb);});});} \ No newline at end of file +var _0x6510=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','ChatWebsite,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2a1771,_0x587575){var _0x37f314=function(_0x5735e2){while(--_0x5735e2){_0x2a1771['push'](_0x2a1771['shift']());}};_0x37f314(++_0x587575);}(_0x6510,0x1b5));var _0x0651=function(_0x46519d,_0xbf0495){_0x46519d=_0x46519d-0x0;var _0x2ea21e=_0x6510[_0x46519d];return _0x2ea21e;};'use strict';var _=require(_0x0651('0x0'));var util=require('util');var moment=require(_0x0651('0x1'));var BPromise=require(_0x0651('0x2'));var rs=require(_0x0651('0x3'));var fs=require('fs');var Redis=require(_0x0651('0x4'));var db=require(_0x0651('0x5'))['db'];var utils=require(_0x0651('0x6'));var logger=require(_0x0651('0x7'))(_0x0651('0x8'));var config=require(_0x0651('0x9'));var jayson=require(_0x0651('0xa'));var client=jayson[_0x0651('0xb')][_0x0651('0xc')]({'port':0x232a});config[_0x0651('0xd')]=_[_0x0651('0xe')](config[_0x0651('0xd')],{'host':_0x0651('0xf'),'port':0x18eb});var socket=require(_0x0651('0x10'))(new Redis(config[_0x0651('0xd')]));require('./chatWebsite.socket')[_0x0651('0x11')](socket);function respondWithRpcPromise(_0x25a1d4,_0x317da4,_0xeea9b4){return new BPromise(function(_0x1d2a1e,_0x2b46c8){return client[_0x0651('0x12')](_0x25a1d4,_0xeea9b4)['then'](function(_0x124cb0){logger[_0x0651('0x13')](_0x0651('0x14'),_0x317da4,'request\x20sent');logger[_0x0651('0x15')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x317da4,'request\x20sent',JSON[_0x0651('0x16')](_0x124cb0));if(_0x124cb0[_0x0651('0x17')]){if(_0x124cb0[_0x0651('0x17')][_0x0651('0x18')]===0x1f4){logger['error'](_0x0651('0x14'),_0x317da4,_0x124cb0['error'][_0x0651('0x19')]);return _0x2b46c8(_0x124cb0[_0x0651('0x17')][_0x0651('0x19')]);}logger[_0x0651('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x317da4,_0x124cb0[_0x0651('0x17')][_0x0651('0x19')]);return _0x1d2a1e(_0x124cb0[_0x0651('0x17')][_0x0651('0x19')]);}else{logger[_0x0651('0x13')](_0x0651('0x14'),_0x317da4,'request\x20sent');_0x1d2a1e(_0x124cb0[_0x0651('0x1a')][_0x0651('0x19')]);}})[_0x0651('0x1b')](function(_0x5a10dd){logger[_0x0651('0x17')](_0x0651('0x14'),_0x317da4,_0x5a10dd);_0x2b46c8(_0x5a10dd);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 8ac851c..542f911 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 _0x01cf=['save','update','emit','removeListener','register','length','./chatWebsite.events'];(function(_0x27ceab,_0x3e259b){var _0x12ee34=function(_0x321366){while(--_0x321366){_0x27ceab['push'](_0x27ceab['shift']());}};_0x12ee34(++_0x3e259b);}(_0x01cf,0x1e2));var _0xf01c=function(_0x3e09e1,_0x1dbd0f){_0x3e09e1=_0x3e09e1-0x0;var _0x306074=_0x01cf[_0x3e09e1];return _0x306074;};'use strict';var ChatWebsiteEvents=require(_0xf01c('0x0'));var events=[_0xf01c('0x1'),'remove',_0xf01c('0x2')];function createListener(_0x23306a,_0x49eb29){return function(_0x44cc45){_0x49eb29[_0xf01c('0x3')](_0x23306a,_0x44cc45);};}function removeListener(_0x5d7133,_0x165eca){return function(){ChatWebsiteEvents[_0xf01c('0x4')](_0x5d7133,_0x165eca);};}exports[_0xf01c('0x5')]=function(_0x363bd5){for(var _0x5a9d3d=0x0,_0x476646=events[_0xf01c('0x6')];_0x5a9d3d<_0x476646;_0x5a9d3d++){var _0x249610=events[_0x5a9d3d];var _0x8149e8=createListener('chatWebsite:'+_0x249610,_0x363bd5);ChatWebsiteEvents['on'](_0x249610,_0x8149e8);}}; \ No newline at end of file +var _0x55ca=['register','length','./chatWebsite.events','save'];(function(_0x36ed80,_0x102296){var _0x418c68=function(_0x2a91fc){while(--_0x2a91fc){_0x36ed80['push'](_0x36ed80['shift']());}};_0x418c68(++_0x102296);}(_0x55ca,0x18e));var _0xa55c=function(_0xbdf03f,_0x595215){_0xbdf03f=_0xbdf03f-0x0;var _0x2bbe9e=_0x55ca[_0xbdf03f];return _0x2bbe9e;};'use strict';var ChatWebsiteEvents=require(_0xa55c('0x0'));var events=[_0xa55c('0x1'),'remove','update'];function createListener(_0x25ebdb,_0x1c57d6){return function(_0x16e350){_0x1c57d6['emit'](_0x25ebdb,_0x16e350);};}function removeListener(_0x3e2d2d,_0x39f91f){return function(){ChatWebsiteEvents['removeListener'](_0x3e2d2d,_0x39f91f);};}exports[_0xa55c('0x2')]=function(_0x159b0b){for(var _0x846e22=0x0,_0x1d1605=events[_0xa55c('0x3')];_0x846e22<_0x1d1605;_0x846e22++){var _0x21c96a=events[_0x846e22];var _0x49d5c6=createListener('chatWebsite:'+_0x21c96a,_0x159b0b);ChatWebsiteEvents['on'](_0x21c96a,_0x49d5c6);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index af0fb31..08d3e5f 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 _0xaecb=['delete','removeAnswers','removeAgents','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers','root','server/files/images/logos/','format','%s-%s','now','originalname','single','addLogo','diskStorage','join','server/files/images/avatars/','file','addCustomerAvatar','addSystemAvatar','server/files','attachments','offline-chat','replace','/:id/offline','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','update','destroy'];(function(_0x2e3524,_0x4e90a1){var _0x32d498=function(_0x2c14ec){while(--_0x2c14ec){_0x2e3524['push'](_0x2e3524['shift']());}};_0x32d498(++_0x4e90a1);}(_0xaecb,0x93));var _0xbaec=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaecb[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xbaec('0x0'));var util=require(_0xbaec('0x1'));var path=require(_0xbaec('0x2'));var timeout=require(_0xbaec('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbaec('0x4'));var auth=require(_0xbaec('0x5'));var interaction=require(_0xbaec('0x6'));var config=require(_0xbaec('0x7'));var controller=require('./chatWebsite.controller');router[_0xbaec('0x8')]('/',auth[_0xbaec('0x9')](),controller[_0xbaec('0xa')]);router['get'](_0xbaec('0xb'),auth[_0xbaec('0x9')](),controller[_0xbaec('0xc')]);router[_0xbaec('0x8')](_0xbaec('0xd'),auth[_0xbaec('0x9')](),controller[_0xbaec('0xe')]);router[_0xbaec('0x8')](_0xbaec('0xf'),auth['isAuthenticated'](),controller[_0xbaec('0x10')]);router['get']('/:id/canned_answers',auth[_0xbaec('0x9')](),controller[_0xbaec('0x11')]);router[_0xbaec('0x8')](_0xbaec('0x12'),controller[_0xbaec('0x13')]);router[_0xbaec('0x8')](_0xbaec('0x14'),controller[_0xbaec('0x15')]);router[_0xbaec('0x8')](_0xbaec('0x16'),controller[_0xbaec('0x17')]);router[_0xbaec('0x8')](_0xbaec('0x18'),controller[_0xbaec('0x19')]);router[_0xbaec('0x8')](_0xbaec('0x1a'),auth[_0xbaec('0x9')](),controller[_0xbaec('0x1b')]);router[_0xbaec('0x8')](_0xbaec('0x1c'),controller['getSnippet']);router[_0xbaec('0x8')](_0xbaec('0x1d'),auth[_0xbaec('0x9')](),controller[_0xbaec('0x1e')]);router['get']('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xbaec('0x1f')]);router[_0xbaec('0x8')](_0xbaec('0x20'),controller[_0xbaec('0x21')]);router[_0xbaec('0x8')](_0xbaec('0x22'),auth[_0xbaec('0x9')](),controller[_0xbaec('0x23')]);router['get'](_0xbaec('0x24'),auth['isAuthenticated'](),controller[_0xbaec('0x25')]);router['post']('/',auth[_0xbaec('0x9')](),controller[_0xbaec('0x26')]);router[_0xbaec('0x27')](_0xbaec('0xf'),auth[_0xbaec('0x9')](),controller[_0xbaec('0x28')]);router['post'](_0xbaec('0x29'),auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2dbf5a,_0x212afe,_0x472576){_0x472576(null,path['join'](config[_0xbaec('0x2a')],_0xbaec('0x2b')));},'filename':function(_0x162b66,_0x21149a,_0x2aed1e){_0x2aed1e(null,util[_0xbaec('0x2c')](_0xbaec('0x2d'),Date[_0xbaec('0x2e')](),_0x21149a[_0xbaec('0x2f')]));}})});router[_0xbaec('0x27')](_0xbaec('0x12'),upload[_0xbaec('0x30')]('file'),controller[_0xbaec('0x31')]);var upload=multer({'storage':multer[_0xbaec('0x32')]({'destination':function(_0x1fc206,_0x3f021c,_0x4d5d9e){_0x4d5d9e(null,path[_0xbaec('0x33')](config['root'],_0xbaec('0x34')));},'filename':function(_0x50d3b0,_0x5d733c,_0x33f197){_0x33f197(null,util[_0xbaec('0x2c')](_0xbaec('0x2d'),Date[_0xbaec('0x2e')](),_0x5d733c[_0xbaec('0x2f')]));}})});router[_0xbaec('0x27')](_0xbaec('0x14'),upload['single'](_0xbaec('0x35')),controller['addAvatar']);var upload=multer({'storage':multer[_0xbaec('0x32')]({'destination':function(_0x3e0760,_0x2b214a,_0x4fbd4b){_0x4fbd4b(null,path[_0xbaec('0x33')](config[_0xbaec('0x2a')],_0xbaec('0x34')));},'filename':function(_0x52920f,_0x4713fd,_0x249308){_0x249308(null,util['format'](_0xbaec('0x2d'),Date[_0xbaec('0x2e')](),_0x4713fd[_0xbaec('0x2f')]));}})});router['post'](_0xbaec('0x16'),upload[_0xbaec('0x30')](_0xbaec('0x35')),controller[_0xbaec('0x36')]);var upload=multer({'storage':multer[_0xbaec('0x32')]({'destination':function(_0x534374,_0x415c1c,_0x1f0651){_0x1f0651(null,path['join'](config['root'],_0xbaec('0x34')));},'filename':function(_0x3a1f55,_0x3b9d67,_0x5a7d8f){_0x5a7d8f(null,util[_0xbaec('0x2c')]('%s-%s',Date[_0xbaec('0x2e')](),_0x3b9d67['originalname']));}})});router[_0xbaec('0x27')](_0xbaec('0x18'),upload[_0xbaec('0x30')](_0xbaec('0x35')),controller[_0xbaec('0x37')]);router['post']('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xbaec('0x32')]({'destination':function(_0x472d8d,_0x23fe11,_0x53811a){const _0xe14960=path[_0xbaec('0x33')](config[_0xbaec('0x2a')],_0xbaec('0x38'),_0xbaec('0x39'),_0xbaec('0x3a'));fs_extra['ensureDir'](_0xe14960,function(){_0x53811a(null,_0xe14960);});},'filename':function(_0x55642a,_0x55073e,_0x44a80b){const _0x4f3c12=_0x55073e[_0xbaec('0x2f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4dd7f3=path['extname'](_0x4f3c12);const _0x14ec39=Date['now']()+'-'+_0x4f3c12[_0xbaec('0x3b')](_0x4dd7f3,'')+_0x4dd7f3;_0x44a80b(null,_0x14ec39);}})});router[_0xbaec('0x27')](_0xbaec('0x3c'),offlineUploadMulter['any'](),controller['offline']);router['post']('/:id/interactions',auth[_0xbaec('0x9')](),controller[_0xbaec('0x3d')]);router['post'](_0xbaec('0x1d'),auth['isAuthenticated'](),controller[_0xbaec('0x3e')]);router[_0xbaec('0x27')](_0xbaec('0x3f'),auth[_0xbaec('0x9')](),controller[_0xbaec('0x40')]);router[_0xbaec('0x27')](_0xbaec('0x24'),auth[_0xbaec('0x9')](),controller[_0xbaec('0x41')]);router[_0xbaec('0x42')]('/:id',auth[_0xbaec('0x9')](),controller[_0xbaec('0x43')]);router['delete'](_0xbaec('0xd'),auth[_0xbaec('0x9')](),controller[_0xbaec('0x44')]);router[_0xbaec('0x45')]('/:id/dispositions',auth[_0xbaec('0x9')](),controller['removeDispositions']);router[_0xbaec('0x45')](_0xbaec('0x29'),auth[_0xbaec('0x9')](),controller[_0xbaec('0x46')]);router['delete'](_0xbaec('0x24'),auth[_0xbaec('0x9')](),controller[_0xbaec('0x47')]);module['exports']=router; \ No newline at end of file +var _0x6cb7=['/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition','diskStorage','root','server/files/images/logos/','%s-%s','originalname','single','addLogo','join','server/files/images/avatars/','now','format','file','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addApplications','addAgents','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar'];(function(_0x19d48d,_0x546c3b){var _0x363d52=function(_0x2004c1){while(--_0x2004c1){_0x19d48d['push'](_0x19d48d['shift']());}};_0x363d52(++_0x546c3b);}(_0x6cb7,0x16a));var _0x76cb=function(_0x26595c,_0x177716){_0x26595c=_0x26595c-0x0;var _0x5178b9=_0x6cb7[_0x26595c];return _0x5178b9;};'use strict';var multer=require(_0x76cb('0x0'));var util=require(_0x76cb('0x1'));var path=require(_0x76cb('0x2'));var timeout=require(_0x76cb('0x3'));var express=require(_0x76cb('0x4'));var router=express[_0x76cb('0x5')]();var fs_extra=require(_0x76cb('0x6'));var auth=require(_0x76cb('0x7'));var interaction=require(_0x76cb('0x8'));var config=require(_0x76cb('0x9'));var controller=require('./chatWebsite.controller');router['get']('/',auth[_0x76cb('0xa')](),controller[_0x76cb('0xb')]);router['get'](_0x76cb('0xc'),auth[_0x76cb('0xa')](),controller[_0x76cb('0xd')]);router[_0x76cb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x76cb('0xf')]);router[_0x76cb('0xe')](_0x76cb('0x10'),auth[_0x76cb('0xa')](),controller[_0x76cb('0x11')]);router[_0x76cb('0xe')](_0x76cb('0x12'),auth[_0x76cb('0xa')](),controller[_0x76cb('0x13')]);router[_0x76cb('0xe')](_0x76cb('0x14'),controller[_0x76cb('0x15')]);router[_0x76cb('0xe')](_0x76cb('0x16'),controller['getAvatar']);router[_0x76cb('0xe')](_0x76cb('0x17'),controller[_0x76cb('0x18')]);router[_0x76cb('0xe')](_0x76cb('0x19'),controller['getSystemAvatar']);router[_0x76cb('0xe')](_0x76cb('0x1a'),auth[_0x76cb('0xa')](),controller[_0x76cb('0x1b')]);router[_0x76cb('0xe')](_0x76cb('0x1c'),controller[_0x76cb('0x1d')]);router[_0x76cb('0xe')](_0x76cb('0x1e'),auth['isAuthenticated'](),controller[_0x76cb('0x1f')]);router['get'](_0x76cb('0x20'),auth[_0x76cb('0xa')](),controller[_0x76cb('0x21')]);router[_0x76cb('0xe')](_0x76cb('0x22'),controller[_0x76cb('0x23')]);router[_0x76cb('0xe')](_0x76cb('0x24'),auth[_0x76cb('0xa')](),controller[_0x76cb('0x25')]);router['get'](_0x76cb('0x26'),auth['isAuthenticated'](),controller['getAgents']);router[_0x76cb('0x27')]('/',auth['isAuthenticated'](),controller[_0x76cb('0x28')]);router['post'](_0x76cb('0x10'),auth[_0x76cb('0xa')](),controller[_0x76cb('0x29')]);router['post']('/:id/canned_answers',auth[_0x76cb('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x76cb('0x2a')]({'destination':function(_0x3e1b88,_0x5d9daf,_0xb47629){_0xb47629(null,path['join'](config[_0x76cb('0x2b')],_0x76cb('0x2c')));},'filename':function(_0x29b2e6,_0x5b151a,_0x537e90){_0x537e90(null,util['format'](_0x76cb('0x2d'),Date['now'](),_0x5b151a[_0x76cb('0x2e')]));}})});router[_0x76cb('0x27')](_0x76cb('0x14'),upload[_0x76cb('0x2f')]('file'),controller[_0x76cb('0x30')]);var upload=multer({'storage':multer[_0x76cb('0x2a')]({'destination':function(_0x1a443d,_0x3cbd2e,_0x1df775){_0x1df775(null,path[_0x76cb('0x31')](config[_0x76cb('0x2b')],_0x76cb('0x32')));},'filename':function(_0x534c40,_0xf29cf,_0x4150d5){_0x4150d5(null,util['format'](_0x76cb('0x2d'),Date[_0x76cb('0x33')](),_0xf29cf[_0x76cb('0x2e')]));}})});router[_0x76cb('0x27')](_0x76cb('0x16'),upload[_0x76cb('0x2f')]('file'),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x534f02,_0x40087c,_0x424dec){_0x424dec(null,path[_0x76cb('0x31')](config[_0x76cb('0x2b')],_0x76cb('0x32')));},'filename':function(_0x1be3b2,_0x1dcee6,_0x206f60){_0x206f60(null,util[_0x76cb('0x34')](_0x76cb('0x2d'),Date[_0x76cb('0x33')](),_0x1dcee6[_0x76cb('0x2e')]));}})});router[_0x76cb('0x27')](_0x76cb('0x17'),upload[_0x76cb('0x2f')](_0x76cb('0x35')),controller[_0x76cb('0x36')]);var upload=multer({'storage':multer[_0x76cb('0x2a')]({'destination':function(_0x47ee2a,_0x431420,_0x367a70){_0x367a70(null,path[_0x76cb('0x31')](config[_0x76cb('0x2b')],'server/files/images/avatars/'));},'filename':function(_0x374909,_0x360da7,_0x42f65c){_0x42f65c(null,util[_0x76cb('0x34')]('%s-%s',Date[_0x76cb('0x33')](),_0x360da7['originalname']));}})});router[_0x76cb('0x27')](_0x76cb('0x19'),upload[_0x76cb('0x2f')]('file'),controller[_0x76cb('0x37')]);router[_0x76cb('0x27')](_0x76cb('0x38'),controller[_0x76cb('0x39')]);const offlineUploadMulter=multer({'storage':multer[_0x76cb('0x2a')]({'destination':function(_0x1a043e,_0x104760,_0x141638){const _0x21ed91=path[_0x76cb('0x31')](config['root'],_0x76cb('0x3a'),_0x76cb('0x3b'),_0x76cb('0x3c'));fs_extra[_0x76cb('0x3d')](_0x21ed91,function(){_0x141638(null,_0x21ed91);});},'filename':function(_0x223996,_0x108f98,_0x4dd84e){const _0x3bd08c=_0x108f98[_0x76cb('0x2e')][_0x76cb('0x3e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5132d8=path[_0x76cb('0x3f')](_0x3bd08c);const _0x586772=Date[_0x76cb('0x33')]()+'-'+_0x3bd08c[_0x76cb('0x3e')](_0x5132d8,'')+_0x5132d8;_0x4dd84e(null,_0x586772);}})});router[_0x76cb('0x27')](_0x76cb('0x40'),offlineUploadMulter[_0x76cb('0x41')](),controller[_0x76cb('0x42')]);router[_0x76cb('0x27')](_0x76cb('0x1a'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x76cb('0x27')](_0x76cb('0x1e'),auth[_0x76cb('0xa')](),controller[_0x76cb('0x43')]);router['post'](_0x76cb('0x20'),auth[_0x76cb('0xa')](),controller['addProactiveActions']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x76cb('0x44')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x76cb('0x45')]);router[_0x76cb('0x46')](_0x76cb('0x47'),auth[_0x76cb('0xa')](),controller[_0x76cb('0x48')]);router[_0x76cb('0x46')]('/:id/dispositions',auth[_0x76cb('0xa')](),controller[_0x76cb('0x49')]);router[_0x76cb('0x46')](_0x76cb('0x12'),auth[_0x76cb('0xa')](),controller[_0x76cb('0x4a')]);router[_0x76cb('0x46')](_0x76cb('0x26'),auth[_0x76cb('0xa')](),controller[_0x76cb('0x4b')]);module[_0x76cb('0x4c')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 65b1037..2da6e0a 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 _0x5b40=['beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','exports'];(function(_0x3696e1,_0xe6f8da){var _0x5d794f=function(_0x46a369){while(--_0x46a369){_0x3696e1['push'](_0x3696e1['shift']());}};_0x5d794f(++_0xe6f8da);}(_0x5b40,0x188));var _0x05b4=function(_0x4288f6,_0x3552ec){_0x4288f6=_0x4288f6-0x0;var _0x366e96=_0x5b40[_0x4288f6];return _0x366e96;};var beaverLogger=require(_0x05b4('0x0'));var express=require(_0x05b4('0x1'));var auth=require(_0x05b4('0x2'));var config=require(_0x05b4('0x3'));var router=express[_0x05b4('0x4')]();var isProduction=config[_0x05b4('0x5')]===_0x05b4('0x6')||![];function clientSideLogs(_0x52ec99,_0x1b9039,_0x54b07b){var _0x710631=_0x52ec99[_0x05b4('0x7')][_0x05b4('0x8')](_0x05b4('0x9'));if(!_0x710631){throw new Error(_0x05b4('0xa'));}return beaverLogger[_0x05b4('0xb')]({'uri':'/client-logs','logger':_0x710631,'enableCors':!isProduction})(_0x52ec99,_0x1b9039,_0x54b07b);}router[_0x05b4('0xc')](auth['isAuthenticated'](),clientSideLogs);module[_0x05b4('0xd')]=router; \ No newline at end of file +var _0x0488=['../config/environment','Router','env','production','get','client-side-logger','expressEndpoint','/client-logs','isAuthenticated','beaver-logger/server','express','../components/auth/service'];(function(_0x1922e4,_0x148b75){var _0x132ad8=function(_0x73f0bd){while(--_0x73f0bd){_0x1922e4['push'](_0x1922e4['shift']());}};_0x132ad8(++_0x148b75);}(_0x0488,0x17d));var _0x8048=function(_0x5c26f3,_0x6fa62c){_0x5c26f3=_0x5c26f3-0x0;var _0x1b02eb=_0x0488[_0x5c26f3];return _0x1b02eb;};var beaverLogger=require(_0x8048('0x0'));var express=require(_0x8048('0x1'));var auth=require(_0x8048('0x2'));var config=require(_0x8048('0x3'));var router=express[_0x8048('0x4')]();var isProduction=config[_0x8048('0x5')]===_0x8048('0x6')||![];function clientSideLogs(_0x2edbd2,_0xe1c552,_0x13c717){var _0x2ec25c=_0x2edbd2['app'][_0x8048('0x7')](_0x8048('0x8'));if(!_0x2ec25c){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x8048('0x9')]({'uri':_0x8048('0xa'),'logger':_0x2ec25c,'enableCors':!isProduction})(_0x2edbd2,_0xe1c552,_0x13c717);}router['use'](auth[_0x8048('0xb')](),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 db5a72b..293fce3 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 _0x4d48=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365'];(function(_0x50989f,_0xd3cb7b){var _0x4bf81e=function(_0x1bf68e){while(--_0x1bf68e){_0x50989f['push'](_0x50989f['shift']());}};_0x4bf81e(++_0xd3cb7b);}(_0x4d48,0x141));var _0x84d4=function(_0x385380,_0x1a8069){_0x385380=_0x385380-0x0;var _0x1cfcd3=_0x4d48[_0x385380];return _0x1cfcd3;};'use strict';var Sequelize=require(_0x84d4('0x0'));module[_0x84d4('0x1')]={'name':{'type':Sequelize[_0x84d4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x84d4('0x3')](_0x84d4('0x4'),_0x84d4('0x5'),_0x84d4('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x84d4('0x3')](_0x84d4('0x7'),_0x84d4('0x8'))},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x84d4('0x2')],'comment':_0x84d4('0x9')},'data3':{'type':Sequelize[_0x84d4('0x2')],'comment':_0x84d4('0xa')},'data4':{'type':Sequelize[_0x84d4('0x2')],'comment':_0x84d4('0xb')},'data5':{'type':Sequelize[_0x84d4('0xc')],'comment':_0x84d4('0xd')},'data6':{'type':Sequelize[_0x84d4('0xc')],'comment':_0x84d4('0xe')},'data7':{'type':Sequelize[_0x84d4('0xc')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0xb277=['AmazonAWS','Google','MicrosoftAzure','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','STRING','ENUM'];(function(_0x23a608,_0x35d4f0){var _0x89c004=function(_0x2d2049){while(--_0x2d2049){_0x23a608['push'](_0x23a608['shift']());}};_0x89c004(++_0x35d4f0);}(_0xb277,0xa7));var _0x7b27=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xb277[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7b27('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x7b27('0x1')](_0x7b27('0x2'),_0x7b27('0x3'),_0x7b27('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('Outlook365','Dynamics365')},'data1':{'type':Sequelize['STRING'],'comment':_0x7b27('0x5')},'data2':{'type':Sequelize[_0x7b27('0x0')],'comment':_0x7b27('0x6')},'data3':{'type':Sequelize[_0x7b27('0x0')],'comment':_0x7b27('0x7')},'data4':{'type':Sequelize[_0x7b27('0x0')],'comment':_0x7b27('0x8')},'data5':{'type':Sequelize[_0x7b27('0x9')],'comment':_0x7b27('0xa')},'data6':{'type':Sequelize[_0x7b27('0x9')],'comment':_0x7b27('0xb')},'data7':{'type':Sequelize[_0x7b27('0x9')],'comment':_0x7b27('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index fbbf5ff..3ad1c22 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 _0xa51e=['emit','microsoftAuthorization:error','message','stringify','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','status','limit','undefined','count','offset','set','Content-Range','json','update','then','destroy','end','sendStatus','error','name','padEnd','index','CloudProvider','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','includeAll','findAll','rows','MicrosoftAzure','decryptString','data3','show','include','service','catch','body','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','find','params','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval'];(function(_0x1c633b,_0xfb7ad0){var _0x4b8802=function(_0x2e69a1){while(--_0x2e69a1){_0x1c633b['push'](_0x1c633b['shift']());}};_0x4b8802(++_0xfb7ad0);}(_0xa51e,0x1c1));var _0xea51=function(_0x1fd8b3,_0x3bd29a){_0x1fd8b3=_0x1fd8b3-0x0;var _0x1f461f=_0xa51e[_0x1fd8b3];return _0x1f461f;};'use strict';var _=require('lodash');var Redis=require(_0xea51('0x0'));var qs=require(_0xea51('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0xea51('0x2'));var logger=require(_0xea51('0x3'))(_0xea51('0x4'));var db=require(_0xea51('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0xea51('0x6')]=_['defaults'](config[_0xea51('0x6')],{'host':_0xea51('0x7'),'port':0x18eb});var socket=require(_0xea51('0x8'))(new Redis(config[_0xea51('0x6')]));var redis=new Redis(config[_0xea51('0x6')]);function respondWithStatusCode(_0x5290ef,_0x5dcaed){_0x5dcaed=_0x5dcaed||0xcc;return function(_0xbdfcd3){if(_0xbdfcd3){return _0x5290ef['sendStatus'](_0x5dcaed);}return _0x5290ef[_0xea51('0x9')](_0x5dcaed)['end']();};}function respondWithResult(_0x12c4ab,_0x2ecab7){_0x2ecab7=_0x2ecab7||0xc8;return function(_0x4ffa14){if(_0x4ffa14){return _0x12c4ab[_0xea51('0x9')](_0x2ecab7)['json'](_0x4ffa14);}};}function respondWithFilteredResult(_0x5f428c,_0x5df92c){return function(_0x8b31c8){if(_0x8b31c8){var _0x1acaa6=typeof _0x5df92c['offset']==='undefined'&&typeof _0x5df92c[_0xea51('0xa')]===_0xea51('0xb');var _0x53b4d3=_0x8b31c8[_0xea51('0xc')];var _0x1cfe7a=_0x1acaa6?0x0:_0x5df92c[_0xea51('0xd')];var _0x5ed4d5=_0x1acaa6?_0x8b31c8['count']:_0x5df92c['offset']+_0x5df92c['limit'];var _0x369792;if(_0x5ed4d5>=_0x53b4d3){_0x5ed4d5=_0x53b4d3;_0x369792=0xc8;}else{_0x369792=0xce;}_0x5f428c['status'](_0x369792);return _0x5f428c[_0xea51('0xe')](_0xea51('0xf'),_0x1cfe7a+'-'+_0x5ed4d5+'/'+_0x53b4d3)[_0xea51('0x10')](_0x8b31c8);}return null;};}function saveUpdates(_0x4b29e4){return function(_0x5ef55a){if(_0x5ef55a){return _0x5ef55a[_0xea51('0x11')](_0x4b29e4)[_0xea51('0x12')](function(_0x12a0b8){return _0x12a0b8;});}return null;};}function removeEntity(_0x23cdc3){return function(_0x227c3a){if(_0x227c3a){return _0x227c3a[_0xea51('0x13')]()[_0xea51('0x12')](function(){_0x23cdc3[_0xea51('0x9')](0xcc)[_0xea51('0x14')]();});}};}function handleEntityNotFound(_0x11c976){return function(_0x3791b3){if(!_0x3791b3){_0x11c976[_0xea51('0x15')](0x194);}return _0x3791b3;};}function handleError(_0x302baf,_0x6ded84){_0x6ded84=_0x6ded84||0x1f4;return function(_0x5daaeb){logger[_0xea51('0x16')](_0x5daaeb['stack']);if(_0x5daaeb[_0xea51('0x17')]){delete _0x5daaeb[_0xea51('0x17')];}_0x302baf['status'](_0x6ded84)['send'](_0x5daaeb);};}function maskClientSecret(_0x2b2194){return _[_0xea51('0x18')](_0x2b2194['slice'](0x0,0x3),0x14,'*');}exports[_0xea51('0x19')]=function(_0x243a0a,_0x51bd08){var _0x5cf939={},_0x1458b9={},_0xac4c02={'count':0x0,'rows':[]};var _0x5b5d0a=_['map'](db[_0xea51('0x1a')][_0xea51('0x1b')],function(_0x203e71){return{'name':_0x203e71[_0xea51('0x1c')],'type':_0x203e71[_0xea51('0x1d')][_0xea51('0x1e')]};});_0x1458b9[_0xea51('0x1f')]=_[_0xea51('0x20')](_0x5b5d0a,_0xea51('0x17'));_0x1458b9[_0xea51('0x21')]=_[_0xea51('0x22')](_0x243a0a[_0xea51('0x21')]);_0x1458b9[_0xea51('0x23')]=_[_0xea51('0x24')](_0x1458b9[_0xea51('0x1f')],_0x1458b9[_0xea51('0x21')]);_0x5cf939[_0xea51('0x25')]=_[_0xea51('0x24')](_0x1458b9[_0xea51('0x1f')],qs[_0xea51('0x26')](_0x243a0a[_0xea51('0x21')][_0xea51('0x26')]));_0x5cf939[_0xea51('0x25')]=_0x5cf939[_0xea51('0x25')][_0xea51('0x27')]?_0x5cf939[_0xea51('0x25')]:_0x1458b9['model'];if(!_0x243a0a[_0xea51('0x21')]['hasOwnProperty']('nolimit')){_0x5cf939[_0xea51('0xa')]=qs[_0xea51('0xa')](_0x243a0a['query'][_0xea51('0xa')]);_0x5cf939[_0xea51('0xd')]=qs[_0xea51('0xd')](_0x243a0a[_0xea51('0x21')]['offset']);}_0x5cf939[_0xea51('0x28')]=qs[_0xea51('0x29')](_0x243a0a[_0xea51('0x21')]['sort']);_0x5cf939[_0xea51('0x2a')]=qs['filters'](_['pick'](_0x243a0a[_0xea51('0x21')],_0x1458b9['filters']),_0x5b5d0a);if(_0x243a0a[_0xea51('0x21')][_0xea51('0x2b')]){_0x5cf939[_0xea51('0x2a')]=_[_0xea51('0x2c')](_0x5cf939[_0xea51('0x2a')],{'$or':_[_0xea51('0x20')](_0x5b5d0a,function(_0x4acb74){if(_0x4acb74[_0xea51('0x1d')]!=='VIRTUAL'){var _0x5617a4={};_0x5617a4[_0x4acb74[_0xea51('0x17')]]={'$like':'%'+_0x243a0a['query'][_0xea51('0x2b')]+'%'};return _0x5617a4;}})});}_0x5cf939=_[_0xea51('0x2c')]({},_0x5cf939,_0x243a0a['options']);var _0x2add4d={'where':_0x5cf939[_0xea51('0x2a')]};return db[_0xea51('0x1a')][_0xea51('0xc')](_0x2add4d)[_0xea51('0x12')](function(_0x11def8){_0xac4c02[_0xea51('0xc')]=_0x11def8;if(_0x243a0a[_0xea51('0x21')][_0xea51('0x2d')]){_0x5cf939['include']=[{'all':!![]}];}return db['CloudProvider'][_0xea51('0x2e')](_0x5cf939);})['then'](function(_0xdc5197){_0xac4c02[_0xea51('0x2f')]=_[_0xea51('0x20')](_0xdc5197,function(_0xc4b1e7){if(_0xc4b1e7['service']===_0xea51('0x30')){var _0x5ce1d5=encryptor[_0xea51('0x31')](_0xc4b1e7[_0xea51('0x32')]);_0xc4b1e7[_0xea51('0x32')]=maskClientSecret(_0x5ce1d5);}return _0xc4b1e7;});return _0xac4c02;})[_0xea51('0x12')](respondWithFilteredResult(_0x51bd08,_0x5cf939))['catch'](handleError(_0x51bd08,null));};exports[_0xea51('0x33')]=function(_0x3e2cf5,_0x22849f){var _0x136639={'raw':!![],'where':{'id':_0x3e2cf5['params']['id']}},_0x451637={};_0x451637['model']=_[_0xea51('0x22')](db[_0xea51('0x1a')][_0xea51('0x1b')]);_0x451637[_0xea51('0x21')]=_[_0xea51('0x22')](_0x3e2cf5[_0xea51('0x21')]);_0x451637[_0xea51('0x23')]=_[_0xea51('0x24')](_0x451637[_0xea51('0x1f')],_0x451637[_0xea51('0x21')]);_0x136639[_0xea51('0x25')]=_[_0xea51('0x24')](_0x451637[_0xea51('0x1f')],qs['fields'](_0x3e2cf5[_0xea51('0x21')][_0xea51('0x26')]));_0x136639[_0xea51('0x25')]=_0x136639[_0xea51('0x25')][_0xea51('0x27')]?_0x136639['attributes']:_0x451637[_0xea51('0x1f')];if(_0x3e2cf5['query'][_0xea51('0x2d')]){_0x136639[_0xea51('0x34')]=[{'all':!![]}];}_0x136639=_['merge']({},_0x136639,_0x3e2cf5['options']);return db[_0xea51('0x1a')]['find'](_0x136639)[_0xea51('0x12')](handleEntityNotFound(_0x22849f,null))[_0xea51('0x12')](function(_0x336f8c){if(_0x336f8c[_0xea51('0x35')]==='MicrosoftAzure'){var _0x35de9e=encryptor[_0xea51('0x31')](_0x336f8c[_0xea51('0x32')]);_0x336f8c[_0xea51('0x32')]=maskClientSecret(_0x35de9e);}return _0x336f8c;})[_0xea51('0x12')](respondWithResult(_0x22849f,null))[_0xea51('0x36')](handleError(_0x22849f,null));};exports['create']=function(_0x101a05,_0x1aa2e7){if(!_0x101a05[_0xea51('0x37')][_0xea51('0x17')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x101a05[_0xea51('0x37')]['service'])throw new Error('Service\x20parameter\x20not\x20specified');var _0x22fbf2=db[_0xea51('0x1a')][_0xea51('0x1b')][_0xea51('0x35')][_0xea51('0x38')];if(!_0x22fbf2[_0xea51('0x39')](_0x101a05[_0xea51('0x37')][_0xea51('0x35')]))throw new Error(_0xea51('0x3a')+_0x22fbf2[_0xea51('0x3b')](',\x20'));if(_0x101a05['body'][_0xea51('0x35')]===_0xea51('0x30')&&_0x101a05['body'][_0xea51('0x32')]){_0x101a05[_0xea51('0x37')][_0xea51('0x32')]=encryptor[_0xea51('0x3c')](_0x101a05[_0xea51('0x37')][_0xea51('0x32')]);}return db[_0xea51('0x1a')][_0xea51('0x3d')](_0x101a05[_0xea51('0x37')],{})[_0xea51('0x12')](respondWithResult(_0x1aa2e7,0xc9))[_0xea51('0x36')](handleError(_0x1aa2e7,null));};exports[_0xea51('0x11')]=function(_0x21a1b4,_0x11180a){if(_0x21a1b4[_0xea51('0x37')]['id']){delete _0x21a1b4['body']['id'];}return db[_0xea51('0x1a')][_0xea51('0x3e')]({'where':{'id':_0x21a1b4[_0xea51('0x3f')]['id']}})[_0xea51('0x12')](handleEntityNotFound(_0x11180a,null))[_0xea51('0x12')](function(_0x4b7cf8){if(_0x4b7cf8[_0xea51('0x35')]==='MicrosoftAzure'&&_0x21a1b4[_0xea51('0x37')][_0xea51('0x32')]){_0x21a1b4[_0xea51('0x37')]['data3']=encryptor['encryptString'](_0x21a1b4[_0xea51('0x37')]['data3']);}return _0x4b7cf8;})[_0xea51('0x12')](saveUpdates(_0x21a1b4['body'],null))[_0xea51('0x12')](respondWithResult(_0x11180a,null))['catch'](handleError(_0x11180a,null));};exports[_0xea51('0x13')]=function(_0x35e98e,_0x3eaf51){return db[_0xea51('0x1a')][_0xea51('0x3e')]({'where':{'id':_0x35e98e[_0xea51('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3eaf51,null))[_0xea51('0x12')](removeEntity(_0x3eaf51,null))[_0xea51('0x36')](handleError(_0x3eaf51,null));};exports[_0xea51('0x40')]=function(_0x199e34,_0x3cb92b){return db[_0xea51('0x1a')][_0xea51('0x41')]({'where':{'id':_0x199e34['params']['id']},'raw':!![]})[_0xea51('0x12')](function(_0x21f8eb){if(!_0x21f8eb)return _0x3cb92b[_0xea51('0x15')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x21f8eb,_0x199e34[_0xea51('0x42')]['id'])};})[_0xea51('0x12')](respondWithResult(_0x3cb92b,null))['catch'](handleError(_0x3cb92b,null));};exports[_0xea51('0x43')]=function(_0x2b0872,_0x38a071){var _0x2d81bd=_0x2b0872['body'];var _0x29e838;var _0x1a02ef;if(_0x2d81bd[_0xea51('0x16')])throw _0x2d81bd;redis[_0xea51('0x44')](_0x2d81bd[_0xea51('0x45')])['then'](function(_0x823194){if(!_0x823194)throw new Error(_0xea51('0x46'));_0x29e838=JSON[_0xea51('0x47')](_0x823194);var _0x4b1db1=Buffer[_0xea51('0x48')](_0x2d81bd['state'],'base64')[_0xea51('0x49')](_0xea51('0x4a'));_0x1a02ef=JSON[_0xea51('0x47')](_0x4b1db1);if(!oauth[_0xea51('0x4b')](_0x2d81bd[_0xea51('0x4c')],_0x29e838[_0xea51('0x4d')]))throw new Error(_0xea51('0x4e'));redis['del'](_0x2d81bd[_0xea51('0x45')]);return oauth[_0xea51('0x4f')](_0x2d81bd[_0xea51('0x50')],_0x29e838);})[_0xea51('0x12')](function(_0x5edfa7){_0x29e838[_0xea51('0x51')]=_0x5edfa7['access_token'];_0x29e838[_0xea51('0x52')]=_0x5edfa7[_0xea51('0x53')];return db[_0xea51('0x1a')]['update']({'data5':_0x29e838[_0xea51('0x51')],'data6':_0x29e838['data6']},{'where':{'id':_0x29e838['id']}});})[_0xea51('0x12')](function(){oauth[_0xea51('0x54')](_0x29e838);socket[_0xea51('0x55')]('microsoftAuthorization:success',{'id':_0x1a02ef['id']});return;})[_0xea51('0x12')](respondWithStatusCode(_0x38a071,null))[_0xea51('0x36')](function(_0x4c6e2d){if(_0x1a02ef){socket[_0xea51('0x55')](_0xea51('0x56'),{'id':_0x1a02ef['id']});}if(!_0x29e838){logger[_0xea51('0x16')]('Invalid\x20authentication\x20state\x20parameter',_0x4c6e2d);return _0x38a071[_0xea51('0x9')](0x1f4)['send'](_0x4c6e2d[_0xea51('0x57')]);}logger[_0xea51('0x16')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x29e838['id'],JSON[_0xea51('0x58')](_0x4c6e2d));});}; \ No newline at end of file +var _0x9977=['type','VIRTUAL','filter','options','CloudProvider','includeAll','include','findAll','rows','service','decryptString','data3','catch','params','find','MicrosoftAzure','create','Name\x20parameter\x20not\x20specified','body','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','get','state','from','base64','toString','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','startRefreshInterval','microsoftAuthorization:success','emit','Invalid\x20authentication\x20state\x20parameter','message','stringify','lodash','../../components/parsers/qs','../../components/encryptor','../../config/logger','redis','socket.io-emitter','sendStatus','status','json','offset','limit','count','set','Content-Range','update','then','end','stack','name','send','padEnd','slice','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge'];(function(_0x74e038,_0x207b89){var _0x4f666d=function(_0x3c8b10){while(--_0x3c8b10){_0x74e038['push'](_0x74e038['shift']());}};_0x4f666d(++_0x207b89);}(_0x9977,0x1ae));var _0x7997=function(_0x4a7193,_0x556c6a){_0x4a7193=_0x4a7193-0x0;var _0xc33d94=_0x9977[_0x4a7193];return _0xc33d94;};'use strict';var _=require(_0x7997('0x0'));var Redis=require('ioredis');var qs=require(_0x7997('0x1'));var encryptor=require(_0x7997('0x2'));var config=require('../../config/environment');var logger=require(_0x7997('0x3'))('api');var db=require('../../mysqldb')['db'];var oauth=require('./cloudProvider.oauth');config[_0x7997('0x4')]=_['defaults'](config[_0x7997('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x7997('0x5'))(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x2ca025,_0xd179f7){_0xd179f7=_0xd179f7||0xcc;return function(_0x54b4b8){if(_0x54b4b8){return _0x2ca025[_0x7997('0x6')](_0xd179f7);}return _0x2ca025[_0x7997('0x7')](_0xd179f7)['end']();};}function respondWithResult(_0x33f5d7,_0x16f567){_0x16f567=_0x16f567||0xc8;return function(_0x420c57){if(_0x420c57){return _0x33f5d7[_0x7997('0x7')](_0x16f567)[_0x7997('0x8')](_0x420c57);}};}function respondWithFilteredResult(_0x4556ab,_0x12ac8d){return function(_0x2b286c){if(_0x2b286c){var _0x754c7d=typeof _0x12ac8d[_0x7997('0x9')]==='undefined'&&typeof _0x12ac8d[_0x7997('0xa')]==='undefined';var _0x3f7699=_0x2b286c[_0x7997('0xb')];var _0x5570c3=_0x754c7d?0x0:_0x12ac8d[_0x7997('0x9')];var _0x24dde8=_0x754c7d?_0x2b286c[_0x7997('0xb')]:_0x12ac8d[_0x7997('0x9')]+_0x12ac8d[_0x7997('0xa')];var _0x30db94;if(_0x24dde8>=_0x3f7699){_0x24dde8=_0x3f7699;_0x30db94=0xc8;}else{_0x30db94=0xce;}_0x4556ab['status'](_0x30db94);return _0x4556ab[_0x7997('0xc')](_0x7997('0xd'),_0x5570c3+'-'+_0x24dde8+'/'+_0x3f7699)[_0x7997('0x8')](_0x2b286c);}return null;};}function saveUpdates(_0x5d4547){return function(_0x5b7a13){if(_0x5b7a13){return _0x5b7a13[_0x7997('0xe')](_0x5d4547)[_0x7997('0xf')](function(_0x52cb6c){return _0x52cb6c;});}return null;};}function removeEntity(_0x15c451){return function(_0x3c01d5){if(_0x3c01d5){return _0x3c01d5['destroy']()[_0x7997('0xf')](function(){_0x15c451[_0x7997('0x7')](0xcc)[_0x7997('0x10')]();});}};}function handleEntityNotFound(_0x2e914e){return function(_0x1e352d){if(!_0x1e352d){_0x2e914e[_0x7997('0x6')](0x194);}return _0x1e352d;};}function handleError(_0x4ef8f9,_0x2515f1){_0x2515f1=_0x2515f1||0x1f4;return function(_0x176301){logger['error'](_0x176301[_0x7997('0x11')]);if(_0x176301[_0x7997('0x12')]){delete _0x176301[_0x7997('0x12')];}_0x4ef8f9[_0x7997('0x7')](_0x2515f1)[_0x7997('0x13')](_0x176301);};}function maskClientSecret(_0x4515c7){return _[_0x7997('0x14')](_0x4515c7[_0x7997('0x15')](0x0,0x3),0x14,'*');}exports['index']=function(_0x5a9bc0,_0x5397a4){var _0x273041={},_0x3e6084={},_0x38cc3e={'count':0x0,'rows':[]};var _0x4abeba=_[_0x7997('0x16')](db['CloudProvider'][_0x7997('0x17')],function(_0xa06c82){return{'name':_0xa06c82[_0x7997('0x18')],'type':_0xa06c82['type'][_0x7997('0x19')]};});_0x3e6084[_0x7997('0x1a')]=_[_0x7997('0x16')](_0x4abeba,_0x7997('0x12'));_0x3e6084[_0x7997('0x1b')]=_[_0x7997('0x1c')](_0x5a9bc0[_0x7997('0x1b')]);_0x3e6084[_0x7997('0x1d')]=_[_0x7997('0x1e')](_0x3e6084[_0x7997('0x1a')],_0x3e6084[_0x7997('0x1b')]);_0x273041[_0x7997('0x1f')]=_['intersection'](_0x3e6084[_0x7997('0x1a')],qs[_0x7997('0x20')](_0x5a9bc0[_0x7997('0x1b')][_0x7997('0x20')]));_0x273041[_0x7997('0x1f')]=_0x273041['attributes'][_0x7997('0x21')]?_0x273041[_0x7997('0x1f')]:_0x3e6084[_0x7997('0x1a')];if(!_0x5a9bc0[_0x7997('0x1b')][_0x7997('0x22')](_0x7997('0x23'))){_0x273041['limit']=qs[_0x7997('0xa')](_0x5a9bc0[_0x7997('0x1b')][_0x7997('0xa')]);_0x273041[_0x7997('0x9')]=qs['offset'](_0x5a9bc0[_0x7997('0x1b')][_0x7997('0x9')]);}_0x273041[_0x7997('0x24')]=qs[_0x7997('0x25')](_0x5a9bc0['query'][_0x7997('0x25')]);_0x273041[_0x7997('0x26')]=qs[_0x7997('0x1d')](_['pick'](_0x5a9bc0[_0x7997('0x1b')],_0x3e6084[_0x7997('0x1d')]),_0x4abeba);if(_0x5a9bc0[_0x7997('0x1b')]['filter']){_0x273041[_0x7997('0x26')]=_[_0x7997('0x27')](_0x273041[_0x7997('0x26')],{'$or':_[_0x7997('0x16')](_0x4abeba,function(_0x487874){if(_0x487874[_0x7997('0x28')]!==_0x7997('0x29')){var _0xcef210={};_0xcef210[_0x487874['name']]={'$like':'%'+_0x5a9bc0[_0x7997('0x1b')][_0x7997('0x2a')]+'%'};return _0xcef210;}})});}_0x273041=_['merge']({},_0x273041,_0x5a9bc0[_0x7997('0x2b')]);var _0x2c534f={'where':_0x273041['where']};return db[_0x7997('0x2c')][_0x7997('0xb')](_0x2c534f)[_0x7997('0xf')](function(_0x52094d){_0x38cc3e['count']=_0x52094d;if(_0x5a9bc0[_0x7997('0x1b')][_0x7997('0x2d')]){_0x273041[_0x7997('0x2e')]=[{'all':!![]}];}return db[_0x7997('0x2c')][_0x7997('0x2f')](_0x273041);})[_0x7997('0xf')](function(_0x24c660){_0x38cc3e[_0x7997('0x30')]=_[_0x7997('0x16')](_0x24c660,function(_0x1003f2){if(_0x1003f2[_0x7997('0x31')]==='MicrosoftAzure'){var _0x30293b=encryptor[_0x7997('0x32')](_0x1003f2[_0x7997('0x33')]);_0x1003f2['data3']=maskClientSecret(_0x30293b);}return _0x1003f2;});return _0x38cc3e;})[_0x7997('0xf')](respondWithFilteredResult(_0x5397a4,_0x273041))[_0x7997('0x34')](handleError(_0x5397a4,null));};exports['show']=function(_0x503b0a,_0x25ed8e){var _0x51dd7d={'raw':!![],'where':{'id':_0x503b0a[_0x7997('0x35')]['id']}},_0x45fe22={};_0x45fe22[_0x7997('0x1a')]=_['keys'](db[_0x7997('0x2c')][_0x7997('0x17')]);_0x45fe22['query']=_[_0x7997('0x1c')](_0x503b0a[_0x7997('0x1b')]);_0x45fe22[_0x7997('0x1d')]=_[_0x7997('0x1e')](_0x45fe22['model'],_0x45fe22[_0x7997('0x1b')]);_0x51dd7d[_0x7997('0x1f')]=_[_0x7997('0x1e')](_0x45fe22[_0x7997('0x1a')],qs[_0x7997('0x20')](_0x503b0a[_0x7997('0x1b')][_0x7997('0x20')]));_0x51dd7d[_0x7997('0x1f')]=_0x51dd7d[_0x7997('0x1f')][_0x7997('0x21')]?_0x51dd7d[_0x7997('0x1f')]:_0x45fe22[_0x7997('0x1a')];if(_0x503b0a[_0x7997('0x1b')][_0x7997('0x2d')]){_0x51dd7d['include']=[{'all':!![]}];}_0x51dd7d=_[_0x7997('0x27')]({},_0x51dd7d,_0x503b0a[_0x7997('0x2b')]);return db[_0x7997('0x2c')][_0x7997('0x36')](_0x51dd7d)[_0x7997('0xf')](handleEntityNotFound(_0x25ed8e,null))[_0x7997('0xf')](function(_0x1ebdeb){if(_0x1ebdeb['service']===_0x7997('0x37')){var _0x4a49a5=encryptor['decryptString'](_0x1ebdeb[_0x7997('0x33')]);_0x1ebdeb[_0x7997('0x33')]=maskClientSecret(_0x4a49a5);}return _0x1ebdeb;})[_0x7997('0xf')](respondWithResult(_0x25ed8e,null))[_0x7997('0x34')](handleError(_0x25ed8e,null));};exports[_0x7997('0x38')]=function(_0x5f21ff,_0x3e5dd9){if(!_0x5f21ff['body'][_0x7997('0x12')])throw new Error(_0x7997('0x39'));if(!_0x5f21ff[_0x7997('0x3a')][_0x7997('0x31')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x293add=db[_0x7997('0x2c')]['rawAttributes']['service'][_0x7997('0x3b')];if(!_0x293add[_0x7997('0x3c')](_0x5f21ff[_0x7997('0x3a')]['service']))throw new Error(_0x7997('0x3d')+_0x293add[_0x7997('0x3e')](',\x20'));if(_0x5f21ff[_0x7997('0x3a')][_0x7997('0x31')]==='MicrosoftAzure'&&_0x5f21ff[_0x7997('0x3a')][_0x7997('0x33')]){_0x5f21ff['body'][_0x7997('0x33')]=encryptor[_0x7997('0x3f')](_0x5f21ff[_0x7997('0x3a')]['data3']);}return db[_0x7997('0x2c')][_0x7997('0x38')](_0x5f21ff[_0x7997('0x3a')],{})['then'](respondWithResult(_0x3e5dd9,0xc9))['catch'](handleError(_0x3e5dd9,null));};exports[_0x7997('0xe')]=function(_0x5a3f16,_0x3e5d5b){if(_0x5a3f16['body']['id']){delete _0x5a3f16[_0x7997('0x3a')]['id'];}return db[_0x7997('0x2c')][_0x7997('0x36')]({'where':{'id':_0x5a3f16[_0x7997('0x35')]['id']}})[_0x7997('0xf')](handleEntityNotFound(_0x3e5d5b,null))['then'](function(_0xb25517){if(_0xb25517[_0x7997('0x31')]===_0x7997('0x37')&&_0x5a3f16['body'][_0x7997('0x33')]){_0x5a3f16[_0x7997('0x3a')][_0x7997('0x33')]=encryptor[_0x7997('0x3f')](_0x5a3f16[_0x7997('0x3a')]['data3']);}return _0xb25517;})[_0x7997('0xf')](saveUpdates(_0x5a3f16[_0x7997('0x3a')],null))[_0x7997('0xf')](respondWithResult(_0x3e5d5b,null))[_0x7997('0x34')](handleError(_0x3e5d5b,null));};exports[_0x7997('0x40')]=function(_0x323d46,_0x8b8f63){return db[_0x7997('0x2c')][_0x7997('0x36')]({'where':{'id':_0x323d46['params']['id']}})[_0x7997('0xf')](handleEntityNotFound(_0x8b8f63,null))[_0x7997('0xf')](removeEntity(_0x8b8f63,null))[_0x7997('0x34')](handleError(_0x8b8f63,null));};exports[_0x7997('0x41')]=function(_0x23363e,_0x3367bc){return db['CloudProvider'][_0x7997('0x42')]({'where':{'id':_0x23363e[_0x7997('0x35')]['id']},'raw':!![]})[_0x7997('0xf')](function(_0x4655f6){if(!_0x4655f6)return _0x3367bc[_0x7997('0x6')](0x194);return{'url':oauth[_0x7997('0x43')](_0x4655f6,_0x23363e[_0x7997('0x44')]['id'])};})['then'](respondWithResult(_0x3367bc,null))[_0x7997('0x34')](handleError(_0x3367bc,null));};exports[_0x7997('0x45')]=function(_0x11e979,_0x2677ef){var _0x206032=_0x11e979[_0x7997('0x3a')];var _0x1af59f;var _0x41c712;if(_0x206032[_0x7997('0x46')])throw _0x206032;redis[_0x7997('0x47')](_0x206032[_0x7997('0x48')])[_0x7997('0xf')](function(_0x11ef27){if(!_0x11ef27)throw new Error('Invalid\x20state\x20parameter');_0x1af59f=JSON['parse'](_0x11ef27);var _0x29d8de=Buffer[_0x7997('0x49')](_0x206032['state'],_0x7997('0x4a'))[_0x7997('0x4b')](_0x7997('0x4c'));_0x41c712=JSON[_0x7997('0x4d')](_0x29d8de);if(!oauth[_0x7997('0x4e')](_0x206032[_0x7997('0x4f')],_0x1af59f[_0x7997('0x50')]))throw new Error(_0x7997('0x51'));redis[_0x7997('0x52')](_0x206032[_0x7997('0x48')]);return oauth[_0x7997('0x53')](_0x206032[_0x7997('0x54')],_0x1af59f);})[_0x7997('0xf')](function(_0x110412){_0x1af59f[_0x7997('0x55')]=_0x110412[_0x7997('0x56')];_0x1af59f[_0x7997('0x57')]=_0x110412['refresh_token'];return db[_0x7997('0x2c')][_0x7997('0xe')]({'data5':_0x1af59f[_0x7997('0x55')],'data6':_0x1af59f[_0x7997('0x57')]},{'where':{'id':_0x1af59f['id']}});})['then'](function(){oauth[_0x7997('0x58')](_0x1af59f);socket['emit'](_0x7997('0x59'),{'id':_0x41c712['id']});return;})[_0x7997('0xf')](respondWithStatusCode(_0x2677ef,null))[_0x7997('0x34')](function(_0x59b8b0){if(_0x41c712){socket[_0x7997('0x5a')]('microsoftAuthorization:error',{'id':_0x41c712['id']});}if(!_0x1af59f){logger['error'](_0x7997('0x5b'),_0x59b8b0);return _0x2677ef[_0x7997('0x7')](0x1f4)['send'](_0x59b8b0[_0x7997('0x5c')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x1af59f['id'],JSON[_0x7997('0x5d')](_0x59b8b0));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 7476ba7..709ac79 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 _0xc0f0=['define','CloudProvider','util','api','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes'];(function(_0x5e10fa,_0x53eff8){var _0x1c09f4=function(_0x25eaf0){while(--_0x25eaf0){_0x5e10fa['push'](_0x5e10fa['shift']());}};_0x1c09f4(++_0x53eff8);}(_0xc0f0,0x12b));var _0x0c0f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc0f0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0c0f('0x0'));var logger=require('../../config/logger')(_0x0c0f('0x1'));var moment=require('moment');var BPromise=require(_0x0c0f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c0f('0x3'));var rimraf=require(_0x0c0f('0x4'));var config=require(_0x0c0f('0x5'));var attributes=require(_0x0c0f('0x6'));module['exports']=function(_0x35efa4,_0x44a9bf){return _0x35efa4[_0x0c0f('0x7')](_0x0c0f('0x8'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9562=['moment','bluebird','request-promise','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','util','api'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0x9562,0xc4));var _0x2956=function(_0x37d421,_0x4fbd25){_0x37d421=_0x37d421-0x0;var _0x22ee81=_0x9562[_0x37d421];return _0x22ee81;};'use strict';var _=require('lodash');var util=require(_0x2956('0x0'));var logger=require('../../config/logger')(_0x2956('0x1'));var moment=require(_0x2956('0x2'));var BPromise=require(_0x2956('0x3'));var rp=require(_0x2956('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2956('0x5'));var config=require(_0x2956('0x6'));var attributes=require(_0x2956('0x7'));module[_0x2956('0x8')]=function(_0x1aaba7,_0x4d21e3){return _0x1aaba7[_0x2956('0x9')](_0x2956('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 1fb9a3d..5bd791e 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 _0x35df=['redirect_uri','data4','response_mode','form_post','prompt','login','map','value','oauth2Claims','replace','oauth2/','data1','set','decode','payload','iss','issuer','aud','audience','nonce','isAfter','unix','exp','resolve','CloudProvider','then','refresh_token','decryptString','POST','access_token','data6','update','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data3','bind','intervals','findAll','all','exports','lodash','crypto','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','push','data7','/.default','join','Dynamics365','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','response_type'];(function(_0x34ed44,_0x908217){var _0x474bdc=function(_0x5b1f62){while(--_0x5b1f62){_0x34ed44['push'](_0x34ed44['shift']());}};_0x474bdc(++_0x908217);}(_0x35df,0x17f));var _0xf35d=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x35df[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0xf35d('0x0'));var crypto=require(_0xf35d('0x1'));var jwt=require(_0xf35d('0x2'));var moment=require('moment');var Redis=require(_0xf35d('0x3'));var rp=require(_0xf35d('0x4'));var util=require(_0xf35d('0x5'));var encryptor=require(_0xf35d('0x6'));var config=require(_0xf35d('0x7'));var logger=require(_0xf35d('0x8'))(_0xf35d('0x9'));var schedule=require(_0xf35d('0xa'));var db=require(_0xf35d('0xb'))['db'];config[_0xf35d('0xc')]=_[_0xf35d('0xd')](config[_0xf35d('0xc')],{'host':_0xf35d('0xe'),'port':0x18eb});var redis=new Redis(config[_0xf35d('0xc')]);var MICROSOFT_AUTH_URL=_0xf35d('0xf');var AZURE_AUTH_SCOPES={'Outlook365':[_0xf35d('0x10'),_0xf35d('0x11'),_0xf35d('0x12'),_0xf35d('0x13'),_0xf35d('0x14'),'https://outlook.office.com/POP.AccessAsUser.All',_0xf35d('0x15')],'Dynamics365':[_0xf35d('0x10'),_0xf35d('0x13')]};var MICROSOFT_AUTH_ENDPOINT=_0xf35d('0x16');var MICROSOFT_TOKEN_ENDPOINT=_0xf35d('0x17');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x6ccdbe){var _0xd14205=_['map'](AZURE_AUTH_SCOPES[_0x6ccdbe[_0xf35d('0x18')]]);if(_0x6ccdbe[_0xf35d('0x18')]==='Dynamics365')_0xd14205[_0xf35d('0x19')](_0x6ccdbe[_0xf35d('0x1a')]+_0xf35d('0x1b'));return _0xd14205[_0xf35d('0x1c')]('\x20');}function getAccessTokenScope(_0x26e727){if(_0x26e727['type']==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x26e727[_0xf35d('0x18')]===_0xf35d('0x1d'))return _0x26e727[_0xf35d('0x1a')]+_0xf35d('0x1b');}function generateMicrosoftAuthorizationUrl(_0x2d6175,_0x56c7c6){var _0x436a47=MICROSOFT_AUTH_URL['replace'](_0xf35d('0x1e'),_0x2d6175[_0xf35d('0x1f')]);var _0x1b2076=[_0xf35d('0x20'),_0xf35d('0x21')];var _0x415028=Buffer[_0xf35d('0x22')](JSON[_0xf35d('0x23')]({'id':_0x56c7c6}))[_0xf35d('0x24')](_0xf35d('0x25'));var _0x5d9370=crypto[_0xf35d('0x26')](0x10)[_0xf35d('0x24')](_0xf35d('0x27'));var _0x254fa9=getAuthorizationScopes(_0x2d6175);var _0x53fb57=[{'key':_0xf35d('0x28'),'value':_0x2d6175['data1']},{'key':_0xf35d('0x29'),'value':encodeURIComponent(_0x1b2076[_0xf35d('0x1c')]('\x20'))},{'key':_0xf35d('0x2a'),'value':_0x2d6175[_0xf35d('0x2b')]},{'key':_0xf35d('0x2c'),'value':_0xf35d('0x2d')},{'key':'scope','value':encodeURIComponent(_0x254fa9)},{'key':'state','value':_0x415028},{'key':'nonce','value':_0x5d9370},{'key':_0xf35d('0x2e'),'value':_0xf35d('0x2f')}];var _0x1b7945=_0x436a47+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xf35d('0x30')](_0x53fb57,function(_0x3e3676){return _0x3e3676['key']+'='+_0x3e3676[_0xf35d('0x31')];})[_0xf35d('0x1c')]('&');_0x2d6175[_0xf35d('0x32')]={'issuer':_0x436a47[_0xf35d('0x33')](_0xf35d('0x34'),''),'audience':_0x2d6175[_0xf35d('0x35')],'state':_0x415028,'nonce':_0x5d9370};redis[_0xf35d('0x36')](_0x415028,JSON[_0xf35d('0x23')](_0x2d6175));return _0x1b7945;}function isValidIdToken(_0x285c25,_0x374433){try{var _0x2311f5=jwt[_0xf35d('0x37')](_0x285c25,{'complete':!![]});var _0x1cefe0=_0x2311f5[_0xf35d('0x38')];if(_0x1cefe0[_0xf35d('0x39')]!==_0x374433[_0xf35d('0x3a')])return![];if(_0x1cefe0[_0xf35d('0x3b')]!==_0x374433[_0xf35d('0x3c')])return![];if(_0x1cefe0[_0xf35d('0x3d')]!==_0x374433[_0xf35d('0x3d')])return![];if(moment()[_0xf35d('0x3e')](moment[_0xf35d('0x3f')](_0x1cefe0[_0xf35d('0x40')])))return![];return!![];}catch(_0x1206fa){throw _0x1206fa;}}function refreshOauth2MicrosoftAccessToken(_0x4248a3){return Promise[_0xf35d('0x41')]()['then'](function(){if(_0x4248a3['data3'])return _0x4248a3;return db[_0xf35d('0x42')]['findOne']({'where':{'id':_0x4248a3['id']},'raw':!![]});})[_0xf35d('0x43')](function(_0x126f10){var _0x65263a={'grant_type':_0xf35d('0x44'),'refresh_token':_0x126f10['data6'],'scope':getAccessTokenScope(_0x126f10),'redirect_uri':_0x126f10['data4'],'client_id':_0x126f10[_0xf35d('0x35')],'client_secret':encryptor[_0xf35d('0x45')](_0x126f10['data3'])};var _0x22f749={'method':_0xf35d('0x46'),'uri':MICROSOFT_AUTH_URL[_0xf35d('0x33')](_0xf35d('0x1e'),_0x126f10['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x65263a,'json':!![]};return rp(_0x22f749);})[_0xf35d('0x43')](function(_0x17db26){_0x4248a3['data5']=_0x17db26[_0xf35d('0x47')];_0x4248a3[_0xf35d('0x48')]=_0x17db26[_0xf35d('0x44')];return db[_0xf35d('0x42')][_0xf35d('0x49')]({'data5':_0x4248a3[_0xf35d('0x4a')],'data6':_0x4248a3['data6']},{'where':{'id':_0x4248a3['id']}});})[_0xf35d('0x43')](function(){return _0x4248a3;})[_0xf35d('0x4b')](function(_0x3c4792){logger[_0xf35d('0x4c')](_0xf35d('0x4d'),_0x4248a3['id'],_0x3c4792);});}function getOauth2MicrosoftAccessToken(_0x37d571,_0x4bc0ca){var _0x1d08bc={'grant_type':_0xf35d('0x4e'),'code':_0x37d571,'scope':getAccessTokenScope(_0x4bc0ca),'redirect_uri':_0x4bc0ca['data4'],'client_id':_0x4bc0ca[_0xf35d('0x35')],'client_secret':encryptor[_0xf35d('0x45')](_0x4bc0ca[_0xf35d('0x4f')])};var _0x3fc412={'method':_0xf35d('0x46'),'uri':MICROSOFT_AUTH_URL[_0xf35d('0x33')]('{TENANT_ID}',_0x4bc0ca[_0xf35d('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1d08bc,'json':!![]};return rp(_0x3fc412);}function startRefreshInterval(_0x43aad5){var _0x25e0ce=schedule['intervals'];if(_0x25e0ce[_0x43aad5['id']])clearInterval(_0x25e0ce[_0x43aad5['id']]);_0x25e0ce[_0x43aad5['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xf35d('0x50')](this,{'id':_0x43aad5['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xf35d('0x51')]=_0x25e0ce;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xf35d('0x52')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xf35d('0x43')](function(_0xe900e8){var _0x151118=_0xe900e8[_0xf35d('0x30')](function(_0x195849){return refreshOauth2MicrosoftAccessToken(_0x195849)['then'](function(_0x169c67){startRefreshInterval(_0x169c67);});});return Promise[_0xf35d('0x53')](_0x151118);})[_0xf35d('0x4b')](function(_0x2ca9db){var _0x250170=_0x2ca9db?util['inspect'](_0x2ca9db,{'showHidden':![],'depth':null}):'';logger[_0xf35d('0x4c')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x250170);});}module[_0xf35d('0x54')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xaf70=['data2','data5','access_token','refresh_token','CloudProvider','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','bind','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','/.default','join','https://outlook.office365.com/IMAP.AccessAsUser.All','data7','replace','{TENANT_ID}','code','id_token','from','toString','base64','randomBytes','hex','client_id','response_type','redirect_uri','data4','scope','state','nonce','prompt','login','key','oauth2Claims','oauth2/','data1','set','decode','iss','issuer','aud','audience','isAfter','unix','exp','data3','findOne','then','data6','decryptString','POST'];(function(_0x2929a1,_0x2e5656){var _0x102c4a=function(_0x4ca160){while(--_0x4ca160){_0x2929a1['push'](_0x2929a1['shift']());}};_0x102c4a(++_0x2e5656);}(_0xaf70,0x103));var _0x0af7=function(_0x35ddbc,_0x7d10b7){_0x35ddbc=_0x35ddbc-0x0;var _0x438347=_0xaf70[_0x35ddbc];return _0x438347;};'use strict';var _=require(_0x0af7('0x0'));var crypto=require('crypto');var jwt=require(_0x0af7('0x1'));var moment=require(_0x0af7('0x2'));var Redis=require(_0x0af7('0x3'));var rp=require(_0x0af7('0x4'));var util=require(_0x0af7('0x5'));var encryptor=require(_0x0af7('0x6'));var config=require(_0x0af7('0x7'));var logger=require(_0x0af7('0x8'))('api');var schedule=require(_0x0af7('0x9'));var db=require(_0x0af7('0xa'))['db'];config[_0x0af7('0xb')]=_['defaults'](config[_0x0af7('0xb')],{'host':_0x0af7('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x0af7('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x0af7('0xe'),'profile',_0x0af7('0xf'),_0x0af7('0x10'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x0af7('0x11'),_0x0af7('0x12')],'Dynamics365':[_0x0af7('0xe'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x0af7('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x0af7('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x19cdc6){var _0x26c2ca=_[_0x0af7('0x15')](AZURE_AUTH_SCOPES[_0x19cdc6[_0x0af7('0x16')]]);if(_0x19cdc6['type']===_0x0af7('0x17'))_0x26c2ca['push'](_0x19cdc6['data7']+_0x0af7('0x18'));return _0x26c2ca[_0x0af7('0x19')]('\x20');}function getAccessTokenScope(_0x2f3251){if(_0x2f3251[_0x0af7('0x16')]==='Outlook365')return _0x0af7('0x1a');if(_0x2f3251[_0x0af7('0x16')]==='Dynamics365')return _0x2f3251[_0x0af7('0x1b')]+_0x0af7('0x18');}function generateMicrosoftAuthorizationUrl(_0x11e635,_0x514e7c){var _0x451142=MICROSOFT_AUTH_URL[_0x0af7('0x1c')](_0x0af7('0x1d'),_0x11e635['data2']);var _0x29ee44=[_0x0af7('0x1e'),_0x0af7('0x1f')];var _0x1e3aa6=Buffer[_0x0af7('0x20')](JSON['stringify']({'id':_0x514e7c}))[_0x0af7('0x21')](_0x0af7('0x22'));var _0x7c09a4=crypto[_0x0af7('0x23')](0x10)[_0x0af7('0x21')](_0x0af7('0x24'));var _0x7516d2=getAuthorizationScopes(_0x11e635);var _0x414041=[{'key':_0x0af7('0x25'),'value':_0x11e635['data1']},{'key':_0x0af7('0x26'),'value':encodeURIComponent(_0x29ee44[_0x0af7('0x19')]('\x20'))},{'key':_0x0af7('0x27'),'value':_0x11e635[_0x0af7('0x28')]},{'key':'response_mode','value':'form_post'},{'key':_0x0af7('0x29'),'value':encodeURIComponent(_0x7516d2)},{'key':_0x0af7('0x2a'),'value':_0x1e3aa6},{'key':_0x0af7('0x2b'),'value':_0x7c09a4},{'key':_0x0af7('0x2c'),'value':_0x0af7('0x2d')}];var _0x4e526f=_0x451142+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x0af7('0x15')](_0x414041,function(_0x3933ba){return _0x3933ba[_0x0af7('0x2e')]+'='+_0x3933ba['value'];})[_0x0af7('0x19')]('&');_0x11e635[_0x0af7('0x2f')]={'issuer':_0x451142[_0x0af7('0x1c')](_0x0af7('0x30'),''),'audience':_0x11e635[_0x0af7('0x31')],'state':_0x1e3aa6,'nonce':_0x7c09a4};redis[_0x0af7('0x32')](_0x1e3aa6,JSON['stringify'](_0x11e635));return _0x4e526f;}function isValidIdToken(_0x6f17e2,_0x5bc57d){try{var _0x3e4784=jwt[_0x0af7('0x33')](_0x6f17e2,{'complete':!![]});var _0x472282=_0x3e4784['payload'];if(_0x472282[_0x0af7('0x34')]!==_0x5bc57d[_0x0af7('0x35')])return![];if(_0x472282[_0x0af7('0x36')]!==_0x5bc57d[_0x0af7('0x37')])return![];if(_0x472282[_0x0af7('0x2b')]!==_0x5bc57d[_0x0af7('0x2b')])return![];if(moment()[_0x0af7('0x38')](moment[_0x0af7('0x39')](_0x472282[_0x0af7('0x3a')])))return![];return!![];}catch(_0x4485fa){throw _0x4485fa;}}function refreshOauth2MicrosoftAccessToken(_0x3969bb){return Promise['resolve']()['then'](function(){if(_0x3969bb[_0x0af7('0x3b')])return _0x3969bb;return db['CloudProvider'][_0x0af7('0x3c')]({'where':{'id':_0x3969bb['id']},'raw':!![]});})[_0x0af7('0x3d')](function(_0x5bfe50){var _0x3e9efb={'grant_type':'refresh_token','refresh_token':_0x5bfe50[_0x0af7('0x3e')],'scope':getAccessTokenScope(_0x5bfe50),'redirect_uri':_0x5bfe50[_0x0af7('0x28')],'client_id':_0x5bfe50['data1'],'client_secret':encryptor[_0x0af7('0x3f')](_0x5bfe50[_0x0af7('0x3b')])};var _0x476d85={'method':_0x0af7('0x40'),'uri':MICROSOFT_AUTH_URL[_0x0af7('0x1c')](_0x0af7('0x1d'),_0x5bfe50[_0x0af7('0x41')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3e9efb,'json':!![]};return rp(_0x476d85);})[_0x0af7('0x3d')](function(_0x21fdfe){_0x3969bb[_0x0af7('0x42')]=_0x21fdfe[_0x0af7('0x43')];_0x3969bb[_0x0af7('0x3e')]=_0x21fdfe[_0x0af7('0x44')];return db[_0x0af7('0x45')][_0x0af7('0x46')]({'data5':_0x3969bb[_0x0af7('0x42')],'data6':_0x3969bb[_0x0af7('0x3e')]},{'where':{'id':_0x3969bb['id']}});})[_0x0af7('0x3d')](function(){return _0x3969bb;})[_0x0af7('0x47')](function(_0x13599d){logger[_0x0af7('0x48')](_0x0af7('0x49'),_0x3969bb['id'],_0x13599d);});}function getOauth2MicrosoftAccessToken(_0x5ae288,_0x8b24da){var _0x33fced={'grant_type':'authorization_code','code':_0x5ae288,'scope':getAccessTokenScope(_0x8b24da),'redirect_uri':_0x8b24da['data4'],'client_id':_0x8b24da[_0x0af7('0x31')],'client_secret':encryptor[_0x0af7('0x3f')](_0x8b24da[_0x0af7('0x3b')])};var _0x24d6f8={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x0af7('0x1c')](_0x0af7('0x1d'),_0x8b24da['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x33fced,'json':!![]};return rp(_0x24d6f8);}function startRefreshInterval(_0x877e32){var _0x3a6d5e=schedule['intervals'];if(_0x3a6d5e[_0x877e32['id']])clearInterval(_0x3a6d5e[_0x877e32['id']]);_0x3a6d5e[_0x877e32['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x0af7('0x4a')](this,{'id':_0x877e32['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x0af7('0x4b')]=_0x3a6d5e;}function startAllRefreshIntervals(){return db[_0x0af7('0x45')][_0x0af7('0x4c')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x0af7('0x3d')](function(_0x1a7988){var _0x54b8b9=_0x1a7988[_0x0af7('0x15')](function(_0x22971e){return refreshOauth2MicrosoftAccessToken(_0x22971e)['then'](function(_0x39a59a){startRefreshInterval(_0x39a59a);});});return Promise[_0x0af7('0x4d')](_0x54b8b9);})[_0x0af7('0x47')](function(_0x1ba83e){var _0x2ee2ff=_0x1ba83e?util[_0x0af7('0x4e')](_0x1ba83e,{'showHidden':![],'depth':null}):'';logger['error'](_0x0af7('0x4f'),_0x2ee2ff);});}module[_0x0af7('0x50')]={'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 d757574..e8cc9da 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 _0x91b6=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x284db2,_0x2872da){var _0x4bdab1=function(_0xfc11ae){while(--_0xfc11ae){_0x284db2['push'](_0x284db2['shift']());}};_0x4bdab1(++_0x2872da);}(_0x91b6,0x18b));var _0x691b=function(_0x53fda3,_0x5cc847){_0x53fda3=_0x53fda3-0x0;var _0x3c0742=_0x91b6[_0x53fda3];return _0x3c0742;};'use strict';var _=require(_0x691b('0x0'));var util=require(_0x691b('0x1'));var moment=require('moment');var BPromise=require(_0x691b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x691b('0x3'))['db'];var utils=require(_0x691b('0x4'));var logger=require(_0x691b('0x5'))(_0x691b('0x6'));var config=require(_0x691b('0x7'));var jayson=require(_0x691b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x448027,_0x1ebd9c,_0x4ff18c){return new BPromise(function(_0x223632,_0xceca6a){return client[_0x691b('0x9')](_0x448027,_0x4ff18c)[_0x691b('0xa')](function(_0xbd8767){logger[_0x691b('0xb')](_0x691b('0xc'),_0x1ebd9c,_0x691b('0xd'));logger['debug'](_0x691b('0xe'),_0x1ebd9c,_0x691b('0xd'),JSON[_0x691b('0xf')](_0xbd8767));if(_0xbd8767[_0x691b('0x10')]){if(_0xbd8767[_0x691b('0x10')][_0x691b('0x11')]===0x1f4){logger['error'](_0x691b('0xc'),_0x1ebd9c,_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);return _0xceca6a(_0xbd8767[_0x691b('0x10')]['message']);}logger[_0x691b('0x10')](_0x691b('0xc'),_0x1ebd9c,_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);return _0x223632(_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);}else{logger[_0x691b('0xb')]('CloudProvider,\x20%s,\x20%s',_0x1ebd9c,_0x691b('0xd'));_0x223632(_0xbd8767['result'][_0x691b('0x12')]);}})[_0x691b('0x13')](function(_0x2e4f84){logger[_0x691b('0x10')](_0x691b('0xc'),_0x1ebd9c,_0x2e4f84);_0xceca6a(_0x2e4f84);});});} \ No newline at end of file +var _0x585e=['then','info','request\x20sent','debug','error','code','message','CloudProvider,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x32db7f,_0x4b1a1d){var _0x3b59d8=function(_0x2c4e54){while(--_0x2c4e54){_0x32db7f['push'](_0x32db7f['shift']());}};_0x3b59d8(++_0x4b1a1d);}(_0x585e,0x1c2));var _0xe585=function(_0x16f2ea,_0x566625){_0x16f2ea=_0x16f2ea-0x0;var _0xe4e684=_0x585e[_0x16f2ea];return _0xe4e684;};'use strict';var _=require(_0xe585('0x0'));var util=require(_0xe585('0x1'));var moment=require(_0xe585('0x2'));var BPromise=require(_0xe585('0x3'));var rs=require(_0xe585('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe585('0x5'));var logger=require(_0xe585('0x6'))('rpc');var config=require(_0xe585('0x7'));var jayson=require(_0xe585('0x8'));var client=jayson[_0xe585('0x9')][_0xe585('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13a862,_0x50a2b2,_0x46642c){return new BPromise(function(_0x19d1ec,_0x204326){return client[_0xe585('0xb')](_0x13a862,_0x46642c)[_0xe585('0xc')](function(_0x20b3b9){logger[_0xe585('0xd')]('CloudProvider,\x20%s,\x20%s',_0x50a2b2,_0xe585('0xe'));logger[_0xe585('0xf')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x50a2b2,_0xe585('0xe'),JSON['stringify'](_0x20b3b9));if(_0x20b3b9[_0xe585('0x10')]){if(_0x20b3b9[_0xe585('0x10')][_0xe585('0x11')]===0x1f4){logger[_0xe585('0x10')]('CloudProvider,\x20%s,\x20%s',_0x50a2b2,_0x20b3b9[_0xe585('0x10')][_0xe585('0x12')]);return _0x204326(_0x20b3b9[_0xe585('0x10')]['message']);}logger[_0xe585('0x10')](_0xe585('0x13'),_0x50a2b2,_0x20b3b9[_0xe585('0x10')][_0xe585('0x12')]);return _0x19d1ec(_0x20b3b9[_0xe585('0x10')]['message']);}else{logger[_0xe585('0xd')]('CloudProvider,\x20%s,\x20%s',_0x50a2b2,'request\x20sent');_0x19d1ec(_0x20b3b9[_0xe585('0x14')][_0xe585('0x12')]);}})['catch'](function(_0x1ced58){logger[_0xe585('0x10')]('CloudProvider,\x20%s,\x20%s',_0x50a2b2,_0x1ced58);_0x204326(_0x1ced58);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index d32995a..51723bd 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 _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0x5f2f,0x73));var _0xf5f2=function(_0x9538b8,_0x5a4c23){_0x9538b8=_0x9538b8-0x0;var _0x294aa5=_0x5f2f[_0x9538b8];return _0x294aa5;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file +var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x3434fb,_0x34d665){var _0x27e59e=function(_0x45bd80){while(--_0x45bd80){_0x3434fb['push'](_0x3434fb['shift']());}};_0x27e59e(++_0x34d665);}(_0xdb28,0x106));var _0x8db2=function(_0x308821,_0x51f9b9){_0x308821=_0x308821-0x0;var _0xf3d8d3=_0xdb28[_0x308821];return _0xf3d8d3;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index b652d8d..a9ab0b1 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 _0x661a=['name','sequelize','STRING'];(function(_0x413727,_0x17adb1){var _0x5f46d7=function(_0xbb668e){while(--_0xbb668e){_0x413727['push'](_0x413727['shift']());}};_0x5f46d7(++_0x17adb1);}(_0x661a,0x1c9));var _0xa661=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0x661a[_0x3ef2d5];return _0x2fefb2;};'use strict';var Sequelize=require(_0xa661('0x0'));module['exports']={'name':{'type':Sequelize[_0xa661('0x1')],'unique':_0xa661('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xa661('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xa661('0x1')]},'phone':{'type':Sequelize[_0xa661('0x1')]},'fax':{'type':Sequelize[_0xa661('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xa661('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xa661('0x1')]},'country':{'type':Sequelize[_0xa661('0x1')]},'email':{'type':Sequelize[_0xa661('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xa661('0x1')]},'sStreet':{'type':Sequelize[_0xa661('0x1')]},'sPostalCode':{'type':Sequelize[_0xa661('0x1')]},'sCity':{'type':Sequelize[_0xa661('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa661('0x1')]}}; \ No newline at end of file +var _0x4c9e=['name','exports','STRING'];(function(_0x4dfd70,_0x35e8d2){var _0x48d818=function(_0x4e9e22){while(--_0x4e9e22){_0x4dfd70['push'](_0x4dfd70['shift']());}};_0x48d818(++_0x35e8d2);}(_0x4c9e,0x145));var _0xe4c9=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x4c9e[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require('sequelize');module[_0xe4c9('0x0')]={'name':{'type':Sequelize[_0xe4c9('0x1')],'unique':_0xe4c9('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xe4c9('0x1')]},'companyId':{'type':Sequelize[_0xe4c9('0x1')]},'website':{'type':Sequelize[_0xe4c9('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xe4c9('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xe4c9('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xe4c9('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xe4c9('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xe4c9('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xe4c9('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xe4c9('0x1')]},'description':{'type':Sequelize[_0xe4c9('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 0b026cd..12d4c3f 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 _0x7350=['merge','options','include','findAll','rows','catch','keys','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','update','params','addContacts','CmContact','omit','ids','getContacts','findOne','nolimit','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','map'];(function(_0x44a3b0,_0x352810){var _0x39e6f6=function(_0x248002){while(--_0x248002){_0x44a3b0['push'](_0x44a3b0['shift']());}};_0x39e6f6(++_0x352810);}(_0x7350,0x176));var _0x0735=function(_0x2430f6,_0x128e37){_0x2430f6=_0x2430f6-0x0;var _0x3c43dd=_0x7350[_0x2430f6];return _0x3c43dd;};'use strict';var emlformat=require(_0x0735('0x0'));var rimraf=require(_0x0735('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0735('0x2'));var BPromise=require(_0x0735('0x3'));var Mustache=require(_0x0735('0x4'));var util=require(_0x0735('0x5'));var path=require('path');var sox=require(_0x0735('0x6'));var csv=require(_0x0735('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0735('0x8'));var _=require(_0x0735('0x9'));var squel=require(_0x0735('0xa'));var crypto=require(_0x0735('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0735('0xc'));var toCsv=require(_0x0735('0x7'));var querystring=require(_0x0735('0xd'));var Papa=require(_0x0735('0xe'));var Redis=require(_0x0735('0xf'));var authService=require(_0x0735('0x10'));var qs=require(_0x0735('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0735('0x12'));var logger=require('../../config/logger')(_0x0735('0x13'));var utils=require(_0x0735('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0735('0x15'));var db=require(_0x0735('0x16'))['db'];function respondWithStatusCode(_0x14d65d,_0xb9a1ad){_0xb9a1ad=_0xb9a1ad||0xcc;return function(_0x119de2){if(_0x119de2){return _0x14d65d[_0x0735('0x17')](_0xb9a1ad);}return _0x14d65d['status'](_0xb9a1ad)[_0x0735('0x18')]();};}function respondWithResult(_0xd04be3,_0x362e8c){_0x362e8c=_0x362e8c||0xc8;return function(_0x1d1463){if(_0x1d1463){return _0xd04be3[_0x0735('0x19')](_0x362e8c)[_0x0735('0x1a')](_0x1d1463);}};}function respondWithFilteredResult(_0x406a61,_0x28aeee){return function(_0x172c19){if(_0x172c19){var _0x5dfcc7=typeof _0x28aeee[_0x0735('0x1b')]===_0x0735('0x1c')&&typeof _0x28aeee[_0x0735('0x1d')]===_0x0735('0x1c');var _0x3dbec1=_0x172c19[_0x0735('0x1e')];var _0x482070=_0x5dfcc7?0x0:_0x28aeee[_0x0735('0x1b')];var _0x19dc07=_0x5dfcc7?_0x172c19[_0x0735('0x1e')]:_0x28aeee[_0x0735('0x1b')]+_0x28aeee[_0x0735('0x1d')];var _0x5937dd;if(_0x19dc07>=_0x3dbec1){_0x19dc07=_0x3dbec1;_0x5937dd=0xc8;}else{_0x5937dd=0xce;}_0x406a61[_0x0735('0x19')](_0x5937dd);return _0x406a61[_0x0735('0x1f')](_0x0735('0x20'),_0x482070+'-'+_0x19dc07+'/'+_0x3dbec1)[_0x0735('0x1a')](_0x172c19);}return null;};}function patchUpdates(_0x4328b0){return function(_0x2373ec){try{jsonpatch[_0x0735('0x21')](_0x2373ec,_0x4328b0,!![]);}catch(_0x4633b1){return BPromise[_0x0735('0x22')](_0x4633b1);}return _0x2373ec[_0x0735('0x23')]();};}function saveUpdates(_0x170ef4,_0x4ded92){return function(_0x1cdc3c){if(_0x1cdc3c){return _0x1cdc3c['update'](_0x170ef4)[_0x0735('0x24')](function(_0xe20ddd){return _0xe20ddd;});}return null;};}function removeEntity(_0x3ed588,_0x153eb8){return function(_0x1c7c65){if(_0x1c7c65){return _0x1c7c65[_0x0735('0x25')]()[_0x0735('0x24')](function(){var _0x523f97=_0x1c7c65[_0x0735('0x26')]({'plain':!![]});var _0x3e0cf5=_0x0735('0x27');return db[_0x0735('0x28')][_0x0735('0x25')]({'where':{'type':_0x3e0cf5,'resourceId':_0x523f97['id']}})[_0x0735('0x24')](function(){return _0x1c7c65;});})[_0x0735('0x24')](function(){_0x3ed588[_0x0735('0x19')](0xcc)[_0x0735('0x18')]();});}};}function handleEntityNotFound(_0x25a7d8,_0x3eb4cd){return function(_0x159496){if(!_0x159496){_0x25a7d8[_0x0735('0x17')](0x194);}return _0x159496;};}function handleError(_0x3429ce,_0x1594da){_0x1594da=_0x1594da||0x1f4;return function(_0x539213){logger[_0x0735('0x29')](_0x539213[_0x0735('0x2a')]);if(_0x539213[_0x0735('0x2b')]){delete _0x539213['name'];}_0x3429ce[_0x0735('0x19')](_0x1594da)[_0x0735('0x2c')](_0x539213);};}exports[_0x0735('0x2d')]=function(_0x108a82,_0x519359){var _0x272487={},_0x58f6a9={},_0x3dad8e={'count':0x0,'rows':[]};return db[_0x0735('0x2e')][_0x0735('0x2f')]()[_0x0735('0x24')](function(_0x28ecd7){_0x58f6a9[_0x0735('0x30')]=_['keys'](_0x28ecd7);_0x58f6a9['query']=_['keys'](_0x108a82[_0x0735('0x31')]);_0x58f6a9[_0x0735('0x32')]=_[_0x0735('0x33')](_0x58f6a9['model'],_0x58f6a9['query']);_0x272487[_0x0735('0x34')]=_[_0x0735('0x33')](_0x58f6a9[_0x0735('0x30')],qs[_0x0735('0x35')](_0x108a82[_0x0735('0x31')][_0x0735('0x35')]));_0x272487['attributes']=_0x272487[_0x0735('0x34')]['length']?_0x272487['attributes']:_0x58f6a9[_0x0735('0x30')];if(!_0x108a82[_0x0735('0x31')][_0x0735('0x36')]('nolimit')){_0x272487[_0x0735('0x1d')]=qs[_0x0735('0x1d')](_0x108a82[_0x0735('0x31')][_0x0735('0x1d')]);_0x272487['offset']=qs[_0x0735('0x1b')](_0x108a82[_0x0735('0x31')][_0x0735('0x1b')]);}_0x272487[_0x0735('0x37')]=qs[_0x0735('0x38')](_0x108a82[_0x0735('0x31')][_0x0735('0x38')]);_0x272487['where']=qs[_0x0735('0x32')](_[_0x0735('0x39')](_0x108a82[_0x0735('0x31')],_0x58f6a9[_0x0735('0x32')]),_0x28ecd7);if(_0x108a82[_0x0735('0x31')][_0x0735('0x3a')]){_0x272487[_0x0735('0x3b')]=_['merge'](_0x272487[_0x0735('0x3b')],{'$or':_[_0x0735('0x3c')](_0x272487[_0x0735('0x34')],function(_0x2d4501){var _0x50bed0={};_0x50bed0[_0x2d4501]={'$like':'%'+_0x108a82[_0x0735('0x31')][_0x0735('0x3a')]+'%'};return _0x50bed0;})});}_0x272487=_[_0x0735('0x3d')]({},_0x272487,_0x108a82[_0x0735('0x3e')]);var _0x17b721={'where':_0x272487['where']};return db['CmCompany'][_0x0735('0x1e')](_0x17b721)['then'](function(_0x78afa1){_0x3dad8e['count']=_0x78afa1;if(_0x108a82['query']['includeAll']){_0x272487[_0x0735('0x3f')]=[{'all':!![]}];}return db[_0x0735('0x2e')][_0x0735('0x40')](_0x272487);})[_0x0735('0x24')](function(_0x56a47a){_0x3dad8e[_0x0735('0x41')]=_0x56a47a;return _0x3dad8e;})[_0x0735('0x24')](respondWithFilteredResult(_0x519359,_0x272487))[_0x0735('0x42')](handleError(_0x519359,null));})[_0x0735('0x42')](handleError(_0x519359,null));};exports['show']=function(_0x442037,_0x2cbca5){var _0x594b2d={'raw':![],'where':{'id':_0x442037['params']['id']}},_0x35d610={};_0x35d610['model']=_['keys'](db['CmCompany']['rawAttributes']);_0x35d610[_0x0735('0x31')]=_[_0x0735('0x43')](_0x442037[_0x0735('0x31')]);_0x35d610[_0x0735('0x32')]=_[_0x0735('0x33')](_0x35d610['model'],_0x35d610[_0x0735('0x31')]);_0x594b2d['attributes']=_[_0x0735('0x33')](_0x35d610[_0x0735('0x30')],qs[_0x0735('0x35')](_0x442037[_0x0735('0x31')]['fields']));_0x594b2d[_0x0735('0x34')]=_0x594b2d[_0x0735('0x34')][_0x0735('0x44')]?_0x594b2d[_0x0735('0x34')]:_0x35d610[_0x0735('0x30')];if(_0x442037[_0x0735('0x31')][_0x0735('0x45')]){_0x594b2d[_0x0735('0x3f')]=[{'all':!![]}];}_0x594b2d=_[_0x0735('0x3d')]({},_0x594b2d,_0x442037[_0x0735('0x3e')]);return db['CmCompany'][_0x0735('0x46')](_0x594b2d)['then'](handleEntityNotFound(_0x2cbca5,null))[_0x0735('0x24')](respondWithResult(_0x2cbca5,null))[_0x0735('0x42')](handleError(_0x2cbca5,null));};exports[_0x0735('0x47')]=function(_0x1c6f17,_0xa52bf8){return db['CmCompany']['create'](_0x1c6f17[_0x0735('0x48')],{})[_0x0735('0x24')](function(_0x55afe6){var _0x2a7d2a=_0x1c6f17[_0x0735('0x49')][_0x0735('0x26')]({'plain':!![]});if(!_0x2a7d2a)throw new Error(_0x0735('0x4a'));if(_0x2a7d2a[_0x0735('0x4b')]===_0x0735('0x49')){var _0x1fdc07=_0x55afe6[_0x0735('0x26')]({'plain':!![]});var _0x310eea=_0x0735('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x310eea,'userProfileId':_0x2a7d2a[_0x0735('0x4c')]},'raw':!![]})[_0x0735('0x24')](function(_0x5de213){if(_0x5de213&&_0x5de213[_0x0735('0x4d')]===0x0){return db[_0x0735('0x28')][_0x0735('0x47')]({'name':_0x1fdc07['name'],'resourceId':_0x1fdc07['id'],'type':_0x5de213[_0x0735('0x2b')],'sectionId':_0x5de213['id']},{})[_0x0735('0x24')](function(){return _0x55afe6;});}else{return _0x55afe6;}})[_0x0735('0x42')](function(_0x125027){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x125027);throw _0x125027;});}return _0x55afe6;})['then'](respondWithResult(_0xa52bf8,0xc9))[_0x0735('0x42')](handleError(_0xa52bf8,null));};exports[_0x0735('0x4e')]=function(_0x101f49,_0x1dae49){if(_0x101f49['body']['id']){delete _0x101f49[_0x0735('0x48')]['id'];}return db[_0x0735('0x2e')][_0x0735('0x46')]({'where':{'id':_0x101f49[_0x0735('0x4f')]['id']}})[_0x0735('0x24')](handleEntityNotFound(_0x1dae49,null))[_0x0735('0x24')](saveUpdates(_0x101f49[_0x0735('0x48')],null))[_0x0735('0x24')](respondWithResult(_0x1dae49,null))[_0x0735('0x42')](handleError(_0x1dae49,null));};exports['destroy']=function(_0x44d7c8,_0x178ded){return db['CmCompany'][_0x0735('0x46')]({'where':{'id':_0x44d7c8['params']['id']}})[_0x0735('0x24')](handleEntityNotFound(_0x178ded,null))['then'](removeEntity(_0x178ded,null))['catch'](handleError(_0x178ded,null));};exports['describe']=function(_0xd4af33,_0x10929b){return db[_0x0735('0x2e')][_0x0735('0x2f')]()[_0x0735('0x24')](respondWithResult(_0x10929b,null))['catch'](handleError(_0x10929b,null));};exports[_0x0735('0x50')]=function(_0x446403,_0x2fce47,_0x16418a){return db[_0x0735('0x51')][_0x0735('0x46')]({'where':{'id':_0x446403[_0x0735('0x4f')]['id']}})[_0x0735('0x24')](handleEntityNotFound(_0x2fce47,null))[_0x0735('0x24')](function(_0x497183){if(_0x497183){return _0x497183[_0x0735('0x50')](_0x446403[_0x0735('0x48')]['ids'],_[_0x0735('0x52')](_0x446403[_0x0735('0x48')],[_0x0735('0x53'),'id'])||{});}})[_0x0735('0x24')](respondWithResult(_0x2fce47,null))['catch'](handleError(_0x2fce47,null));};exports[_0x0735('0x54')]=function(_0x7f8acb,_0x164034,_0x43240e){var _0xc7898c={};var _0x261bec={};var _0x332010;var _0x31e385;return db[_0x0735('0x2e')][_0x0735('0x55')]({'where':{'id':_0x7f8acb[_0x0735('0x4f')]['id']}})[_0x0735('0x24')](handleEntityNotFound(_0x164034,null))['then'](function(_0x38b6bd){if(_0x38b6bd){_0x332010=_0x38b6bd;_0x261bec[_0x0735('0x30')]=_[_0x0735('0x43')](db[_0x0735('0x51')]['rawAttributes']);_0x261bec['query']=_[_0x0735('0x43')](_0x7f8acb[_0x0735('0x31')]);_0x261bec[_0x0735('0x32')]=_[_0x0735('0x33')](_0x261bec['model'],_0x261bec[_0x0735('0x31')]);_0xc7898c[_0x0735('0x34')]=_[_0x0735('0x33')](_0x261bec[_0x0735('0x30')],qs['fields'](_0x7f8acb[_0x0735('0x31')][_0x0735('0x35')]));_0xc7898c[_0x0735('0x34')]=_0xc7898c['attributes']['length']?_0xc7898c[_0x0735('0x34')]:_0x261bec[_0x0735('0x30')];_0xc7898c[_0x0735('0x37')]=qs[_0x0735('0x38')](_0x7f8acb[_0x0735('0x31')][_0x0735('0x38')]);_0xc7898c[_0x0735('0x3b')]=qs[_0x0735('0x32')](_[_0x0735('0x39')](_0x7f8acb[_0x0735('0x31')],_0x261bec[_0x0735('0x32')]));if(_0x7f8acb['query'][_0x0735('0x3a')]){_0xc7898c[_0x0735('0x3b')]=_[_0x0735('0x3d')](_0xc7898c[_0x0735('0x3b')],{'$or':_[_0x0735('0x3c')](_0xc7898c['attributes'],function(_0x7a7841){var _0x384b53={};_0x384b53[_0x7a7841]={'$like':'%'+_0x7f8acb[_0x0735('0x31')]['filter']+'%'};return _0x384b53;})});}_0xc7898c=_[_0x0735('0x3d')]({},_0xc7898c,_0x7f8acb['options']);return _0x332010[_0x0735('0x54')](_0xc7898c);}})[_0x0735('0x24')](function(_0x341ec2){if(_0x341ec2){_0x31e385=_0x341ec2['length'];if(!_0x7f8acb['query'][_0x0735('0x36')](_0x0735('0x56'))){_0xc7898c[_0x0735('0x1d')]=qs[_0x0735('0x1d')](_0x7f8acb['query'][_0x0735('0x1d')]);_0xc7898c[_0x0735('0x1b')]=qs[_0x0735('0x1b')](_0x7f8acb[_0x0735('0x31')][_0x0735('0x1b')]);}return _0x332010['getContacts'](_0xc7898c);}})['then'](function(_0x148595){if(_0x148595){return _0x148595?{'count':_0x31e385,'rows':_0x148595}:null;}})[_0x0735('0x24')](respondWithResult(_0x164034,null))[_0x0735('0x42')](handleError(_0x164034,null));}; \ No newline at end of file +var _0x252c=['util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','get','Companies','UserProfileResource','destroy','error','stack','name','send','CmCompany','model','intersection','query','attributes','fields','nolimit','order','where','filters','pick','merge','filter','options','includeAll','rows','catch','params','rawAttributes','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','CmContact','addContacts','ids','findOne','sort','map','getContacts','length','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x15b8f4,_0x1f4494){var _0x251fc8=function(_0x37c020){while(--_0x37c020){_0x15b8f4['push'](_0x15b8f4['shift']());}};_0x251fc8(++_0x1f4494);}(_0x252c,0x152));var _0xc252=function(_0x2de186,_0x46aaaa){_0x2de186=_0x2de186-0x0;var _0x4f16f8=_0x252c[_0x2de186];return _0x4f16f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc252('0x0'));var zipdir=require(_0xc252('0x1'));var jsonpatch=require(_0xc252('0x2'));var rp=require(_0xc252('0x3'));var moment=require('moment');var BPromise=require(_0xc252('0x4'));var Mustache=require(_0xc252('0x5'));var util=require(_0xc252('0x6'));var path=require(_0xc252('0x7'));var sox=require('sox');var csv=require(_0xc252('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc252('0x9'));var squel=require(_0xc252('0xa'));var crypto=require(_0xc252('0xb'));var jsforce=require(_0xc252('0xc'));var deskjs=require(_0xc252('0xd'));var toCsv=require(_0xc252('0x8'));var querystring=require(_0xc252('0xe'));var Papa=require(_0xc252('0xf'));var Redis=require(_0xc252('0x10'));var authService=require(_0xc252('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc252('0x12'));var hardwareService=require(_0xc252('0x13'));var logger=require(_0xc252('0x14'))(_0xc252('0x15'));var utils=require(_0xc252('0x16'));var config=require(_0xc252('0x17'));var licenseUtil=require(_0xc252('0x18'));var db=require(_0xc252('0x19'))['db'];function respondWithStatusCode(_0x351d3d,_0x4c2dcb){_0x4c2dcb=_0x4c2dcb||0xcc;return function(_0x2cd5e1){if(_0x2cd5e1){return _0x351d3d[_0xc252('0x1a')](_0x4c2dcb);}return _0x351d3d[_0xc252('0x1b')](_0x4c2dcb)[_0xc252('0x1c')]();};}function respondWithResult(_0x2b7be5,_0x2548e0){_0x2548e0=_0x2548e0||0xc8;return function(_0x163286){if(_0x163286){return _0x2b7be5[_0xc252('0x1b')](_0x2548e0)[_0xc252('0x1d')](_0x163286);}};}function respondWithFilteredResult(_0x39c088,_0x763612){return function(_0x1a8ce8){if(_0x1a8ce8){var _0x3b7190=typeof _0x763612[_0xc252('0x1e')]===_0xc252('0x1f')&&typeof _0x763612[_0xc252('0x20')]==='undefined';var _0x4a6d24=_0x1a8ce8[_0xc252('0x21')];var _0x4b006c=_0x3b7190?0x0:_0x763612['offset'];var _0x13e9ca=_0x3b7190?_0x1a8ce8[_0xc252('0x21')]:_0x763612['offset']+_0x763612['limit'];var _0x2f680d;if(_0x13e9ca>=_0x4a6d24){_0x13e9ca=_0x4a6d24;_0x2f680d=0xc8;}else{_0x2f680d=0xce;}_0x39c088['status'](_0x2f680d);return _0x39c088[_0xc252('0x22')](_0xc252('0x23'),_0x4b006c+'-'+_0x13e9ca+'/'+_0x4a6d24)[_0xc252('0x1d')](_0x1a8ce8);}return null;};}function patchUpdates(_0x2556c5){return function(_0x4f21f4){try{jsonpatch['apply'](_0x4f21f4,_0x2556c5,!![]);}catch(_0x509a7b){return BPromise[_0xc252('0x24')](_0x509a7b);}return _0x4f21f4['save']();};}function saveUpdates(_0x1f8049,_0x1c0f87){return function(_0xc03a3a){if(_0xc03a3a){return _0xc03a3a['update'](_0x1f8049)[_0xc252('0x25')](function(_0xf400c0){return _0xf400c0;});}return null;};}function removeEntity(_0x4f6678,_0x92efa0){return function(_0x53f165){if(_0x53f165){return _0x53f165['destroy']()['then'](function(){var _0x122647=_0x53f165[_0xc252('0x26')]({'plain':!![]});var _0x2844ee=_0xc252('0x27');return db[_0xc252('0x28')][_0xc252('0x29')]({'where':{'type':_0x2844ee,'resourceId':_0x122647['id']}})[_0xc252('0x25')](function(){return _0x53f165;});})[_0xc252('0x25')](function(){_0x4f6678[_0xc252('0x1b')](0xcc)[_0xc252('0x1c')]();});}};}function handleEntityNotFound(_0x441619,_0x34634c){return function(_0x39b4af){if(!_0x39b4af){_0x441619[_0xc252('0x1a')](0x194);}return _0x39b4af;};}function handleError(_0xe8f290,_0x4d36aa){_0x4d36aa=_0x4d36aa||0x1f4;return function(_0x2e26fe){logger[_0xc252('0x2a')](_0x2e26fe[_0xc252('0x2b')]);if(_0x2e26fe[_0xc252('0x2c')]){delete _0x2e26fe[_0xc252('0x2c')];}_0xe8f290[_0xc252('0x1b')](_0x4d36aa)[_0xc252('0x2d')](_0x2e26fe);};}exports['index']=function(_0x20dfad,_0x2161b2){var _0x4e0696={},_0x3bbbef={},_0x4a89f5={'count':0x0,'rows':[]};return db[_0xc252('0x2e')]['describe']()[_0xc252('0x25')](function(_0x395c54){_0x3bbbef[_0xc252('0x2f')]=_['keys'](_0x395c54);_0x3bbbef['query']=_['keys'](_0x20dfad['query']);_0x3bbbef['filters']=_[_0xc252('0x30')](_0x3bbbef[_0xc252('0x2f')],_0x3bbbef[_0xc252('0x31')]);_0x4e0696[_0xc252('0x32')]=_[_0xc252('0x30')](_0x3bbbef['model'],qs[_0xc252('0x33')](_0x20dfad[_0xc252('0x31')][_0xc252('0x33')]));_0x4e0696[_0xc252('0x32')]=_0x4e0696[_0xc252('0x32')]['length']?_0x4e0696[_0xc252('0x32')]:_0x3bbbef['model'];if(!_0x20dfad[_0xc252('0x31')]['hasOwnProperty'](_0xc252('0x34'))){_0x4e0696['limit']=qs[_0xc252('0x20')](_0x20dfad[_0xc252('0x31')][_0xc252('0x20')]);_0x4e0696[_0xc252('0x1e')]=qs[_0xc252('0x1e')](_0x20dfad['query'][_0xc252('0x1e')]);}_0x4e0696[_0xc252('0x35')]=qs['sort'](_0x20dfad['query']['sort']);_0x4e0696[_0xc252('0x36')]=qs[_0xc252('0x37')](_[_0xc252('0x38')](_0x20dfad['query'],_0x3bbbef['filters']),_0x395c54);if(_0x20dfad[_0xc252('0x31')]['filter']){_0x4e0696[_0xc252('0x36')]=_[_0xc252('0x39')](_0x4e0696[_0xc252('0x36')],{'$or':_['map'](_0x4e0696[_0xc252('0x32')],function(_0x2011b6){var _0x548baf={};_0x548baf[_0x2011b6]={'$like':'%'+_0x20dfad['query'][_0xc252('0x3a')]+'%'};return _0x548baf;})});}_0x4e0696=_['merge']({},_0x4e0696,_0x20dfad[_0xc252('0x3b')]);var _0x2aec3a={'where':_0x4e0696[_0xc252('0x36')]};return db['CmCompany'][_0xc252('0x21')](_0x2aec3a)[_0xc252('0x25')](function(_0x497497){_0x4a89f5[_0xc252('0x21')]=_0x497497;if(_0x20dfad[_0xc252('0x31')][_0xc252('0x3c')]){_0x4e0696['include']=[{'all':!![]}];}return db[_0xc252('0x2e')]['findAll'](_0x4e0696);})['then'](function(_0x1eb9f9){_0x4a89f5[_0xc252('0x3d')]=_0x1eb9f9;return _0x4a89f5;})[_0xc252('0x25')](respondWithFilteredResult(_0x2161b2,_0x4e0696))[_0xc252('0x3e')](handleError(_0x2161b2,null));})[_0xc252('0x3e')](handleError(_0x2161b2,null));};exports['show']=function(_0x36c42c,_0x14a4f0){var _0x4e4738={'raw':![],'where':{'id':_0x36c42c[_0xc252('0x3f')]['id']}},_0x416a48={};_0x416a48['model']=_['keys'](db[_0xc252('0x2e')][_0xc252('0x40')]);_0x416a48[_0xc252('0x31')]=_[_0xc252('0x41')](_0x36c42c['query']);_0x416a48[_0xc252('0x37')]=_[_0xc252('0x30')](_0x416a48[_0xc252('0x2f')],_0x416a48['query']);_0x4e4738[_0xc252('0x32')]=_[_0xc252('0x30')](_0x416a48[_0xc252('0x2f')],qs['fields'](_0x36c42c[_0xc252('0x31')][_0xc252('0x33')]));_0x4e4738[_0xc252('0x32')]=_0x4e4738[_0xc252('0x32')]['length']?_0x4e4738[_0xc252('0x32')]:_0x416a48['model'];if(_0x36c42c[_0xc252('0x31')][_0xc252('0x3c')]){_0x4e4738[_0xc252('0x42')]=[{'all':!![]}];}_0x4e4738=_[_0xc252('0x39')]({},_0x4e4738,_0x36c42c['options']);return db[_0xc252('0x2e')]['find'](_0x4e4738)[_0xc252('0x25')](handleEntityNotFound(_0x14a4f0,null))[_0xc252('0x25')](respondWithResult(_0x14a4f0,null))[_0xc252('0x3e')](handleError(_0x14a4f0,null));};exports['create']=function(_0x4fac7f,_0x1f30d0){return db[_0xc252('0x2e')][_0xc252('0x43')](_0x4fac7f[_0xc252('0x44')],{})[_0xc252('0x25')](function(_0x35eae9){var _0x10c998=_0x4fac7f[_0xc252('0x45')][_0xc252('0x26')]({'plain':!![]});if(!_0x10c998)throw new Error(_0xc252('0x46'));if(_0x10c998[_0xc252('0x47')]==='user'){var _0x3302e6=_0x35eae9[_0xc252('0x26')]({'plain':!![]});var _0x15681a=_0xc252('0x27');return db[_0xc252('0x48')][_0xc252('0x49')]({'where':{'name':_0x15681a,'userProfileId':_0x10c998[_0xc252('0x4a')]},'raw':!![]})[_0xc252('0x25')](function(_0x23b214){if(_0x23b214&&_0x23b214['autoAssociation']===0x0){return db[_0xc252('0x28')][_0xc252('0x43')]({'name':_0x3302e6[_0xc252('0x2c')],'resourceId':_0x3302e6['id'],'type':_0x23b214[_0xc252('0x2c')],'sectionId':_0x23b214['id']},{})['then'](function(){return _0x35eae9;});}else{return _0x35eae9;}})[_0xc252('0x3e')](function(_0x30ab83){logger[_0xc252('0x2a')](_0xc252('0x4b'),_0x30ab83);throw _0x30ab83;});}return _0x35eae9;})['then'](respondWithResult(_0x1f30d0,0xc9))[_0xc252('0x3e')](handleError(_0x1f30d0,null));};exports[_0xc252('0x4c')]=function(_0x462711,_0x1a5339){if(_0x462711[_0xc252('0x44')]['id']){delete _0x462711[_0xc252('0x44')]['id'];}return db[_0xc252('0x2e')][_0xc252('0x49')]({'where':{'id':_0x462711[_0xc252('0x3f')]['id']}})[_0xc252('0x25')](handleEntityNotFound(_0x1a5339,null))[_0xc252('0x25')](saveUpdates(_0x462711[_0xc252('0x44')],null))[_0xc252('0x25')](respondWithResult(_0x1a5339,null))['catch'](handleError(_0x1a5339,null));};exports[_0xc252('0x29')]=function(_0x207f00,_0x1e74bd){return db[_0xc252('0x2e')][_0xc252('0x49')]({'where':{'id':_0x207f00[_0xc252('0x3f')]['id']}})[_0xc252('0x25')](handleEntityNotFound(_0x1e74bd,null))[_0xc252('0x25')](removeEntity(_0x1e74bd,null))[_0xc252('0x3e')](handleError(_0x1e74bd,null));};exports[_0xc252('0x4d')]=function(_0x3fa175,_0xbdf478){return db[_0xc252('0x2e')][_0xc252('0x4d')]()[_0xc252('0x25')](respondWithResult(_0xbdf478,null))[_0xc252('0x3e')](handleError(_0xbdf478,null));};exports['addContacts']=function(_0x409c60,_0x2fc7b3,_0x346c26){return db[_0xc252('0x4e')]['find']({'where':{'id':_0x409c60[_0xc252('0x3f')]['id']}})[_0xc252('0x25')](handleEntityNotFound(_0x2fc7b3,null))[_0xc252('0x25')](function(_0x453fec){if(_0x453fec){return _0x453fec[_0xc252('0x4f')](_0x409c60[_0xc252('0x44')]['ids'],_['omit'](_0x409c60[_0xc252('0x44')],[_0xc252('0x50'),'id'])||{});}})['then'](respondWithResult(_0x2fc7b3,null))[_0xc252('0x3e')](handleError(_0x2fc7b3,null));};exports['getContacts']=function(_0x69bc87,_0x475a63,_0x22a98d){var _0x4beca6={};var _0x5efa2c={};var _0x3632db;var _0x457e32;return db['CmCompany'][_0xc252('0x51')]({'where':{'id':_0x69bc87['params']['id']}})[_0xc252('0x25')](handleEntityNotFound(_0x475a63,null))[_0xc252('0x25')](function(_0x5955a1){if(_0x5955a1){_0x3632db=_0x5955a1;_0x5efa2c[_0xc252('0x2f')]=_[_0xc252('0x41')](db[_0xc252('0x4e')][_0xc252('0x40')]);_0x5efa2c[_0xc252('0x31')]=_[_0xc252('0x41')](_0x69bc87[_0xc252('0x31')]);_0x5efa2c[_0xc252('0x37')]=_[_0xc252('0x30')](_0x5efa2c[_0xc252('0x2f')],_0x5efa2c[_0xc252('0x31')]);_0x4beca6[_0xc252('0x32')]=_[_0xc252('0x30')](_0x5efa2c['model'],qs['fields'](_0x69bc87['query'][_0xc252('0x33')]));_0x4beca6['attributes']=_0x4beca6['attributes']['length']?_0x4beca6['attributes']:_0x5efa2c[_0xc252('0x2f')];_0x4beca6[_0xc252('0x35')]=qs[_0xc252('0x52')](_0x69bc87[_0xc252('0x31')][_0xc252('0x52')]);_0x4beca6[_0xc252('0x36')]=qs[_0xc252('0x37')](_[_0xc252('0x38')](_0x69bc87[_0xc252('0x31')],_0x5efa2c[_0xc252('0x37')]));if(_0x69bc87[_0xc252('0x31')][_0xc252('0x3a')]){_0x4beca6[_0xc252('0x36')]=_[_0xc252('0x39')](_0x4beca6[_0xc252('0x36')],{'$or':_[_0xc252('0x53')](_0x4beca6['attributes'],function(_0x3bb638){var _0x236478={};_0x236478[_0x3bb638]={'$like':'%'+_0x69bc87['query'][_0xc252('0x3a')]+'%'};return _0x236478;})});}_0x4beca6=_[_0xc252('0x39')]({},_0x4beca6,_0x69bc87[_0xc252('0x3b')]);return _0x3632db[_0xc252('0x54')](_0x4beca6);}})[_0xc252('0x25')](function(_0x1dbb6c){if(_0x1dbb6c){_0x457e32=_0x1dbb6c[_0xc252('0x55')];if(!_0x69bc87['query']['hasOwnProperty']('nolimit')){_0x4beca6[_0xc252('0x20')]=qs[_0xc252('0x20')](_0x69bc87[_0xc252('0x31')][_0xc252('0x20')]);_0x4beca6[_0xc252('0x1e')]=qs[_0xc252('0x1e')](_0x69bc87['query']['offset']);}return _0x3632db[_0xc252('0x54')](_0x4beca6);}})['then'](function(_0x4d114e){if(_0x4d114e){return _0x4d114e?{'count':_0x457e32,'rows':_0x4d114e}:null;}})[_0xc252('0x25')](respondWithResult(_0x475a63,null))['catch'](handleError(_0x475a63,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index ca5d55c..92304de 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 _0x767c=['path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','lodash','util','moment','bluebird','request-promise'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x767c,0x145));var _0xc767=function(_0x33d28c,_0x29e4b7){_0x33d28c=_0x33d28c-0x0;var _0x1c38e5=_0x767c[_0x33d28c];return _0x1c38e5;};'use strict';var _=require(_0xc767('0x0'));var util=require(_0xc767('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc767('0x2'));var BPromise=require(_0xc767('0x3'));var rp=require(_0xc767('0x4'));var fs=require('fs');var path=require(_0xc767('0x5'));var rimraf=require(_0xc767('0x6'));var config=require(_0xc767('0x7'));var attributes=require(_0xc767('0x8'));module[_0xc767('0x9')]=function(_0x1f71c4,_0x13bccc){return _0x1f71c4[_0xc767('0xa')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb85e=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports','CmCompany'];(function(_0x4ffa03,_0x363a82){var _0x30d661=function(_0x36ba86){while(--_0x36ba86){_0x4ffa03['push'](_0x4ffa03['shift']());}};_0x30d661(++_0x363a82);}(_0xb85e,0x13f));var _0xeb85=function(_0x3c4919,_0x3c3201){_0x3c4919=_0x3c4919-0x0;var _0x29b5f6=_0xb85e[_0x3c4919];return _0x29b5f6;};'use strict';var _=require(_0xeb85('0x0'));var util=require(_0xeb85('0x1'));var logger=require(_0xeb85('0x2'))(_0xeb85('0x3'));var moment=require(_0xeb85('0x4'));var BPromise=require('bluebird');var rp=require(_0xeb85('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb85('0x6'));var config=require(_0xeb85('0x7'));var attributes=require(_0xeb85('0x8'));module[_0xeb85('0x9')]=function(_0x27aeb2,_0x59a474){return _0x27aeb2['define'](_0xeb85('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index a39fc9d..e528807 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 _0x2030=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','CmCompany,\x20%s,\x20%s'];(function(_0x1663a5,_0x1038d9){var _0x1a4ff2=function(_0x56d366){while(--_0x56d366){_0x1663a5['push'](_0x1663a5['shift']());}};_0x1a4ff2(++_0x1038d9);}(_0x2030,0x113));var _0x0203=function(_0x459820,_0x50202a){_0x459820=_0x459820-0x0;var _0x1d0c05=_0x2030[_0x459820];return _0x1d0c05;};'use strict';var _=require(_0x0203('0x0'));var util=require(_0x0203('0x1'));var moment=require(_0x0203('0x2'));var BPromise=require(_0x0203('0x3'));var rs=require(_0x0203('0x4'));var fs=require('fs');var Redis=require(_0x0203('0x5'));var db=require(_0x0203('0x6'))['db'];var utils=require(_0x0203('0x7'));var logger=require('../../config/logger')(_0x0203('0x8'));var config=require('../../config/environment');var jayson=require(_0x0203('0x9'));var client=jayson['client'][_0x0203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dcada,_0x51fca2,_0x2375d4){return new BPromise(function(_0x2e509d,_0x3fc3ff){return client[_0x0203('0xb')](_0x3dcada,_0x2375d4)[_0x0203('0xc')](function(_0x272d6f){logger['info']('CmCompany,\x20%s,\x20%s',_0x51fca2,_0x0203('0xd'));logger[_0x0203('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x51fca2,_0x0203('0xd'),JSON[_0x0203('0xf')](_0x272d6f));if(_0x272d6f[_0x0203('0x10')]){if(_0x272d6f[_0x0203('0x10')][_0x0203('0x11')]===0x1f4){logger[_0x0203('0x10')](_0x0203('0x12'),_0x51fca2,_0x272d6f['error'][_0x0203('0x13')]);return _0x3fc3ff(_0x272d6f[_0x0203('0x10')][_0x0203('0x13')]);}logger[_0x0203('0x10')](_0x0203('0x12'),_0x51fca2,_0x272d6f[_0x0203('0x10')]['message']);return _0x2e509d(_0x272d6f['error']['message']);}else{logger['info'](_0x0203('0x12'),_0x51fca2,_0x0203('0xd'));_0x2e509d(_0x272d6f['result'][_0x0203('0x13')]);}})[_0x0203('0x14')](function(_0x5834d0){logger[_0x0203('0x10')](_0x0203('0x12'),_0x51fca2,_0x5834d0);_0x3fc3ff(_0x5834d0);});});} \ No newline at end of file +var _0xff4a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x37320d,_0x11212c){var _0x57f2bf=function(_0x2bd366){while(--_0x2bd366){_0x37320d['push'](_0x37320d['shift']());}};_0x57f2bf(++_0x11212c);}(_0xff4a,0x15d));var _0xaff4=function(_0x5dfbcc,_0x71fbd1){_0x5dfbcc=_0x5dfbcc-0x0;var _0x5d9a91=_0xff4a[_0x5dfbcc];return _0x5d9a91;};'use strict';var _=require(_0xaff4('0x0'));var util=require(_0xaff4('0x1'));var moment=require(_0xaff4('0x2'));var BPromise=require(_0xaff4('0x3'));var rs=require(_0xaff4('0x4'));var fs=require('fs');var Redis=require(_0xaff4('0x5'));var db=require(_0xaff4('0x6'))['db'];var utils=require(_0xaff4('0x7'));var logger=require(_0xaff4('0x8'))(_0xaff4('0x9'));var config=require(_0xaff4('0xa'));var jayson=require(_0xaff4('0xb'));var client=jayson[_0xaff4('0xc')][_0xaff4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x438cc4,_0x856f5a,_0x2dbfbe){return new BPromise(function(_0x3ec3f5,_0x47becc){return client[_0xaff4('0xe')](_0x438cc4,_0x2dbfbe)['then'](function(_0x4a00f6){logger[_0xaff4('0xf')](_0xaff4('0x10'),_0x856f5a,_0xaff4('0x11'));logger[_0xaff4('0x12')](_0xaff4('0x13'),_0x856f5a,'request\x20sent',JSON[_0xaff4('0x14')](_0x4a00f6));if(_0x4a00f6[_0xaff4('0x15')]){if(_0x4a00f6[_0xaff4('0x15')][_0xaff4('0x16')]===0x1f4){logger[_0xaff4('0x15')]('CmCompany,\x20%s,\x20%s',_0x856f5a,_0x4a00f6[_0xaff4('0x15')][_0xaff4('0x17')]);return _0x47becc(_0x4a00f6[_0xaff4('0x15')]['message']);}logger[_0xaff4('0x15')](_0xaff4('0x10'),_0x856f5a,_0x4a00f6['error']['message']);return _0x3ec3f5(_0x4a00f6['error'][_0xaff4('0x17')]);}else{logger['info'](_0xaff4('0x10'),_0x856f5a,_0xaff4('0x11'));_0x3ec3f5(_0x4a00f6['result'][_0xaff4('0x17')]);}})[_0xaff4('0x18')](function(_0x4c54cb){logger[_0xaff4('0x15')](_0xaff4('0x10'),_0x856f5a,_0x4c54cb);_0x47becc(_0x4c54cb);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index d8b35f7..cae3aa0 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 _0x4f83=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','create','post','/:id/contacts','put','/:id','update','exports','multer','path','express'];(function(_0x40410a,_0x45b741){var _0x38a126=function(_0x46661d){while(--_0x46661d){_0x40410a['push'](_0x40410a['shift']());}};_0x38a126(++_0x45b741);}(_0x4f83,0x1c5));var _0x34f8=function(_0x43014e,_0x24cf89){_0x43014e=_0x43014e-0x0;var _0x221b93=_0x4f83[_0x43014e];return _0x221b93;};'use strict';var multer=require(_0x34f8('0x0'));var util=require('util');var path=require(_0x34f8('0x1'));var timeout=require('connect-timeout');var express=require(_0x34f8('0x2'));var router=express[_0x34f8('0x3')]();var fs_extra=require(_0x34f8('0x4'));var auth=require(_0x34f8('0x5'));var interaction=require(_0x34f8('0x6'));var config=require('../../config/environment');var controller=require(_0x34f8('0x7'));router[_0x34f8('0x8')]('/',auth[_0x34f8('0x9')](),controller[_0x34f8('0xa')]);router['get'](_0x34f8('0xb'),auth[_0x34f8('0x9')](),controller['describe']);router['get']('/:id',auth[_0x34f8('0x9')](),controller['show']);router[_0x34f8('0x8')]('/:id/contacts',auth[_0x34f8('0x9')](),controller['getContacts']);router['post']('/',auth[_0x34f8('0x9')](),controller[_0x34f8('0xc')]);router[_0x34f8('0xd')](_0x34f8('0xe'),auth[_0x34f8('0x9')](),controller['addContacts']);router[_0x34f8('0xf')](_0x34f8('0x10'),auth[_0x34f8('0x9')](),controller[_0x34f8('0x11')]);router['delete']('/:id',auth[_0x34f8('0x9')](),controller['destroy']);module[_0x34f8('0x12')]=router; \ No newline at end of file +var _0x4be6=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/describe','/:id','show','getContacts','post','create','/:id/contacts','addContacts','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x427b66,_0x3c1600){var _0x36ce48=function(_0x4ce2b2){while(--_0x4ce2b2){_0x427b66['push'](_0x427b66['shift']());}};_0x36ce48(++_0x3c1600);}(_0x4be6,0x74));var _0x64be=function(_0x4c4ca2,_0x30d812){_0x4c4ca2=_0x4c4ca2-0x0;var _0x17dac3=_0x4be6[_0x4c4ca2];return _0x17dac3;};'use strict';var multer=require(_0x64be('0x0'));var util=require(_0x64be('0x1'));var path=require(_0x64be('0x2'));var timeout=require(_0x64be('0x3'));var express=require(_0x64be('0x4'));var router=express[_0x64be('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x64be('0x6'));var interaction=require(_0x64be('0x7'));var config=require(_0x64be('0x8'));var controller=require(_0x64be('0x9'));router[_0x64be('0xa')]('/',auth[_0x64be('0xb')](),controller['index']);router['get'](_0x64be('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x64be('0xa')](_0x64be('0xd'),auth[_0x64be('0xb')](),controller[_0x64be('0xe')]);router[_0x64be('0xa')]('/:id/contacts',auth[_0x64be('0xb')](),controller[_0x64be('0xf')]);router[_0x64be('0x10')]('/',auth[_0x64be('0xb')](),controller[_0x64be('0x11')]);router[_0x64be('0x10')](_0x64be('0x12'),auth['isAuthenticated'](),controller[_0x64be('0x13')]);router[_0x64be('0x14')](_0x64be('0xd'),auth[_0x64be('0xb')](),controller[_0x64be('0x15')]);router['delete']('/:id',auth[_0x64be('0xb')](),controller[_0x64be('0x16')]);module[_0x64be('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 ccf504d..f899f17 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 _0x9b78=['lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x43ead7,_0x484a83){var _0xfe6a20=function(_0x39b783){while(--_0x39b783){_0x43ead7['push'](_0x43ead7['shift']());}};_0xfe6a20(++_0x484a83);}(_0x9b78,0x195));var _0x89b7=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0x9b78[_0x54b062];return _0x255e41;};'use strict';var _=require(_0x89b7('0x0'));var Sequelize=require(_0x89b7('0x1'));module[_0x89b7('0x2')]={'firstName':{'type':Sequelize[_0x89b7('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x89b7('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x89b7('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x89b7('0x3')]},'description':{'type':Sequelize[_0x89b7('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x89b7('0x3')]},'fax':{'type':Sequelize[_0x89b7('0x3')]},'email':{'type':Sequelize[_0x89b7('0x3')]},'url':{'type':Sequelize[_0x89b7('0x3')]},'facebook':{'type':Sequelize[_0x89b7('0x3')]},'fb_data':{'type':Sequelize[_0x89b7('0x3')]},'twitter':{'type':Sequelize[_0x89b7('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x89b7('0x3')]},'viber':{'type':Sequelize[_0x89b7('0x3')]},'line':{'type':Sequelize[_0x89b7('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x89b7('0x3')]},'UserId':{'type':Sequelize[_0x89b7('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x89b7('0x3')]},'priority':{'type':Sequelize[_0x89b7('0x5')](0x2)[_0x89b7('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x89b7('0x7')],'defaultValue':Sequelize[_0x89b7('0x8')]},'dialTimezone':{'type':Sequelize[_0x89b7('0x3')]},'utcOffset':{'type':Sequelize[_0x89b7('0x5')]}}; \ No newline at end of file +var _0x7ae1=['INTEGER','lodash','sequelize','exports','STRING','TEXT','NOW'];(function(_0x4fa925,_0x24c92d){var _0x46f66c=function(_0x2c4ea4){while(--_0x2c4ea4){_0x4fa925['push'](_0x4fa925['shift']());}};_0x46f66c(++_0x24c92d);}(_0x7ae1,0xf6));var _0x17ae=function(_0x2f2520,_0x1fd270){_0x2f2520=_0x2f2520-0x0;var _0x30607b=_0x7ae1[_0x2f2520];return _0x30607b;};'use strict';var _=require(_0x17ae('0x0'));var Sequelize=require(_0x17ae('0x1'));module[_0x17ae('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x17ae('0x3')]},'street':{'type':Sequelize[_0x17ae('0x3')]},'postalCode':{'type':Sequelize[_0x17ae('0x3')]},'city':{'type':Sequelize[_0x17ae('0x3')]},'country':{'type':Sequelize[_0x17ae('0x3')]},'dateOfBirth':{'type':Sequelize[_0x17ae('0x3')]},'description':{'type':Sequelize[_0x17ae('0x4')]},'phone':{'type':Sequelize[_0x17ae('0x3')]},'mobile':{'type':Sequelize[_0x17ae('0x3')]},'fax':{'type':Sequelize[_0x17ae('0x3')]},'email':{'type':Sequelize[_0x17ae('0x3')]},'url':{'type':Sequelize[_0x17ae('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x17ae('0x3')]},'twitter':{'type':Sequelize[_0x17ae('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x17ae('0x3')]},'viber':{'type':Sequelize[_0x17ae('0x3')]},'line':{'type':Sequelize[_0x17ae('0x3')]},'wechat':{'type':Sequelize[_0x17ae('0x3')]},'telegram':{'type':Sequelize[_0x17ae('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x17ae('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x17ae('0x5')]},'dialTimezone':{'type':Sequelize[_0x17ae('0x3')]},'utcOffset':{'type':Sequelize[_0x17ae('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 5026bb8..3c39d8f 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 _0xf293=['VoiceCallReport','startCase','closed','closedAt','disposition','secondDisposition','UserId','Account','key','browserName','customerIp','customerPort','deviceModel','osName','ratingValue','referer','subject','substatus','externalUrl','Interaction','Owner','flatten','sortBy','value','moment','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','undefined','offset','count','limit','set','Content-Range','update','destroy','then','end','sendStatus','error','stack','name','index','describe','findAll','user','catch','CmContact','params','tags','length','keys','startsWith','cf_','query','CmCustomField','columnName','displayName','alias','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','get','isArray','join','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','from','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','isNil','utcOffset','timezones','additionalPhones','each','duplicates','$or','push','where','findOrCreate','spread','show','find','Tag','Tags','tag','Phones','ContactItemType','sequelize','Phones.OrderBy','ListId','omit','format','dialTimezone','$and','pickBy','cf_%d','table','cm_contacts','setFields','id\x20=\x20?','text','phone','findOne','rawAttributes','filters','intersection','model','fields','attributes','order','sort','pick','filter','map','options','getTags','setTags','all','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','literal','`ItemType`.OrderBy','ItemType.OrderBy','bulkCreate','ItemType','duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','getHoppers','nolimit','ContactId','include','getHopperHistories','includeAll','rows','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','file','filename','chmodSync','0777','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','meta','import','User','binding','stringify','message','error\x20child\x20process','importUpdates','No\x20firstName\x20column\x20specified','../../components/import/cm/csvUpdates','exit','mail','chat','sms','voice','resolve','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','type','source','callerid','starttime','endtime','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','fullname','DESC'];(function(_0x12254f,_0x100cfe){var _0x3a4fa2=function(_0x1ce891){while(--_0x1ce891){_0x12254f['push'](_0x12254f['shift']());}};_0x3a4fa2(++_0x100cfe);}(_0xf293,0x10c));var _0x3f29=function(_0x112ad6,_0x1a1ab9){_0x112ad6=_0x112ad6-0x0;var _0x5373f6=_0xf293[_0x112ad6];return _0x5373f6;};'use strict';var moment=require(_0x3f29('0x0'));var BPromise=require(_0x3f29('0x1'));var util=require(_0x3f29('0x2'));var path=require(_0x3f29('0x3'));var fs=require('fs');var _=require(_0x3f29('0x4'));var squel=require(_0x3f29('0x5'));var Papa=require(_0x3f29('0x6'));var Redis=require(_0x3f29('0x7'));var contacts=require('../../components/contacts');var qs=require(_0x3f29('0x8'));var logger=require(_0x3f29('0x9'))(_0x3f29('0xa'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var db=require(_0x3f29('0xb'))['db'];config[_0x3f29('0xc')]=_[_0x3f29('0xd')](config['redis'],{'host':_0x3f29('0xe'),'port':0x18eb});var socket=require(_0x3f29('0xf'))(new Redis(config[_0x3f29('0xc')]));require(_0x3f29('0x10'))[_0x3f29('0x11')](socket);function respondWithResult(_0x459d1f,_0x139225){_0x139225=_0x139225||0xc8;return function(_0x12fbe5){if(_0x12fbe5){return _0x459d1f[_0x3f29('0x12')](_0x139225)[_0x3f29('0x13')](_0x12fbe5);}};}function respondWithFilteredResult(_0x232756,_0x48507c){return function(_0x23cd9e){if(_0x23cd9e){var _0x95977e=typeof _0x48507c['offset']===_0x3f29('0x14')&&typeof _0x48507c['limit']===_0x3f29('0x14');var _0xd0b146=_0x23cd9e['count'];var _0x5ba3be=_0x95977e?0x0:_0x48507c[_0x3f29('0x15')];var _0x4d4417=_0x95977e?_0x23cd9e[_0x3f29('0x16')]:_0x48507c[_0x3f29('0x15')]+_0x48507c[_0x3f29('0x17')];var _0x5720a9;if(_0x4d4417>=_0xd0b146){_0x4d4417=_0xd0b146;_0x5720a9=0xc8;}else{_0x5720a9=0xce;}_0x232756[_0x3f29('0x12')](_0x5720a9);return _0x232756[_0x3f29('0x18')](_0x3f29('0x19'),_0x5ba3be+'-'+_0x4d4417+'/'+_0xd0b146)[_0x3f29('0x13')](_0x23cd9e);}return null;};}function saveUpdates(_0x19aafd){return function(_0xdca6e9){if(_0xdca6e9){return _0xdca6e9[_0x3f29('0x1a')](_0x19aafd)['then'](function(_0x3ae665){return _0x3ae665;});}return null;};}function removeEntity(_0x4f3152){return function(_0xad38d3){if(_0xad38d3){return _0xad38d3[_0x3f29('0x1b')]()[_0x3f29('0x1c')](function(){_0x4f3152['status'](0xcc)[_0x3f29('0x1d')]();});}};}function handleEntityNotFound(_0x403f4b){return function(_0x5cb3f8){if(!_0x5cb3f8){_0x403f4b[_0x3f29('0x1e')](0x194);}return _0x5cb3f8;};}function handleError(_0x4a38be,_0x2629af){_0x2629af=_0x2629af||0x1f4;return function(_0x1895bb){logger[_0x3f29('0x1f')](_0x1895bb[_0x3f29('0x20')]);if(_0x1895bb[_0x3f29('0x21')]){delete _0x1895bb[_0x3f29('0x21')];}_0x4a38be[_0x3f29('0x12')](_0x2629af)['send'](_0x1895bb);};}exports[_0x3f29('0x22')]=function(_0x13555b,_0x5a3ffa){var _0x1672e8={};return contacts[_0x3f29('0x23')]()[_0x3f29('0x1c')](function(_0x4f1697){_0x1672e8=qs['getOptions'](_0x4f1697,_0x13555b);return contacts[_0x3f29('0x24')](_0x13555b['query'],_0x13555b[_0x3f29('0x25')],_0x1672e8,_0x4f1697);})['then'](respondWithFilteredResult(_0x5a3ffa,_0x1672e8))[_0x3f29('0x26')](handleError(_0x5a3ffa,null));};exports[_0x3f29('0x1b')]=function(_0x1966c5,_0x289c32){return db[_0x3f29('0x27')]['find']({'where':{'id':_0x1966c5[_0x3f29('0x28')]['id']}})[_0x3f29('0x1c')](handleEntityNotFound(_0x289c32,null))[_0x3f29('0x1c')](removeEntity(_0x289c32,null))[_0x3f29('0x26')](handleError(_0x289c32,null));};exports[_0x3f29('0x23')]=function(_0x4f83c9,_0x772169){return db['CmContact']['describe']()['then'](function(_0x46c4ee){delete _0x46c4ee[_0x3f29('0x29')];for(var _0x1d0783=0x0;_0x1d07830x0){return new Promise(function(_0x37605e){var _0x30d881=[];for(var _0x3ead38=0x0;_0x3ead38<_0x56ba83[_0x3f29('0x2a')];_0x3ead38++){_0x30d881[_0x3f29('0x5c')](insertAdditionalPhones(_0x56ba83[_0x3ead38]['contact'],_0x56ba83[_0x3ead38][_0x3f29('0x58')]));}Promise['all'](_0x30d881)[_0x3f29('0x1c')](function(){_0x37605e(0x1);});})[_0x3f29('0x1c')](function(){return{'success':_0x29159b,'failure':_0x5497dd,'duplicates':_0x41a714};});}else{return{'success':_0x29159b,'failure':_0x5497dd,'duplicates':_0x41a714};}}})[_0x3f29('0x1c')](respondWithResult(_0x1423d9,0xc9))[_0x3f29('0x26')](handleError(_0x1423d9,null));};exports[_0x3f29('0x60')]=function(_0x286a3f,_0x53ec11){var _0x32da1a;return db[_0x3f29('0x27')][_0x3f29('0x23')]()[_0x3f29('0x1c')](function(_0xf2d7a4){return db[_0x3f29('0x27')][_0x3f29('0x61')]({'where':{'id':_0x286a3f[_0x3f29('0x28')]['id']},'include':[{'model':db[_0x3f29('0x62')],'as':_0x3f29('0x63'),'attributes':['id',_0x3f29('0x21'),'color'],'required':_0x286a3f['query'][_0x3f29('0x64')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x3f29('0x65'),'where':{'CmContactId':_0x286a3f['params']['id']},'required':![],'include':[{'model':db[_0x3f29('0x66')],'as':'ItemType'}]}],'order':[db[_0x3f29('0x67')]['literal'](_0x3f29('0x68'))],'attributes':_[_0x3f29('0x2b')](_0xf2d7a4)});})['then'](function(_0x41d345){if(!_[_0x3f29('0x55')](_0x41d345)){_0x32da1a=_0x41d345[_0x3f29('0x39')]({'plain':!![]});var _0x177e20={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x41d345&&_0x41d345['ListId']){if(_0x41d345[_0x3f29('0x69')]){_0x177e20[_0x3f29('0x5d')]['$and'][_0x3f29('0x5c')]({'ListId':{'$ne':_0x41d345['ListId']}});}}return db[_0x3f29('0x2f')][_0x3f29('0x24')](_0x177e20);}})[_0x3f29('0x1c')](function(_0x4c018a){if(!_['isNil'](_0x4c018a)){return _[_0x3f29('0x6a')](_0x32da1a,_['map'](_0x4c018a,function(_0x2329bb){return util[_0x3f29('0x6b')]('cf_%d',_0x2329bb['id']);}));}})[_0x3f29('0x1c')](handleEntityNotFound(_0x53ec11,null))[_0x3f29('0x1c')](respondWithResult(_0x53ec11,null))[_0x3f29('0x26')](handleError(_0x53ec11,null));};exports['update']=function(_0x3ee59a,_0x414ecb){var _0x105fe2;if(_0x3ee59a[_0x3f29('0x38')]['id']){delete _0x3ee59a[_0x3f29('0x38')]['id'];}if(!_[_0x3f29('0x55')](_0x3ee59a[_0x3f29('0x38')][_0x3f29('0x6c')])){var _0x3df880=_0x3ee59a['body'][_0x3f29('0x6c')];if(!_['isNil'](shared[_0x3f29('0x57')][_0x3df880]))_0x3ee59a['body'][_0x3f29('0x56')]=shared[_0x3f29('0x57')][_0x3df880][_0x3f29('0x56')];}return db['CmContact'][_0x3f29('0x61')]({'where':{'id':_0x3ee59a[_0x3f29('0x28')]['id']}})[_0x3f29('0x1c')](handleEntityNotFound(_0x414ecb,null))[_0x3f29('0x1c')](saveUpdates(_0x3ee59a['body'],null))[_0x3f29('0x1c')](function(_0x4489ab){_0x105fe2=_0x4489ab;var _0x227820={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4489ab&&_0x4489ab[_0x3f29('0x69')]){if(_0x4489ab[_0x3f29('0x69')]){_0x227820[_0x3f29('0x5d')][_0x3f29('0x6d')][_0x3f29('0x5c')]({'ListId':{'$ne':_0x4489ab[_0x3f29('0x69')]}});}}return db[_0x3f29('0x2f')][_0x3f29('0x24')](_0x227820);})[_0x3f29('0x1c')](function(_0xdfe9b3){if(_0xdfe9b3){return _['omit'](_[_0x3f29('0x6e')](_0x3ee59a[_0x3f29('0x38')],function(_0x5e2182,_0x56d916){return _[_0x3f29('0x2c')](_0x56d916,_0x3f29('0x2d'));}),_['map'](_0xdfe9b3,function(_0x14d64b){return util['format'](_0x3f29('0x6f'),_0x14d64b['id']);}));}})[_0x3f29('0x1c')](function(_0x5d4eae){if(_0x5d4eae&&!_['isEmpty'](_0x5d4eae)){var _0x360dd3=squel[_0x3f29('0x1a')]()[_0x3f29('0x70')](_0x3f29('0x71'))[_0x3f29('0x72')](_0x5d4eae)[_0x3f29('0x5d')](_0x3f29('0x73'),_0x3ee59a[_0x3f29('0x28')]['id'])['toParam']();return db['sequelize'][_0x3f29('0x2e')](_0x360dd3[_0x3f29('0x74')],{'replacements':_0x360dd3[_0x3f29('0x33')]});}})[_0x3f29('0x1c')](function(){if(_0x3ee59a[_0x3f29('0x38')][_0x3f29('0x75')]&&_0x105fe2){return db[_0x3f29('0x3d')][_0x3f29('0x1a')]({'phone':_0x3ee59a[_0x3f29('0x38')][_0x3f29('0x75')],'OrderBy':0x0},{'where':{'ContactId':_0x105fe2['id']}});}})[_0x3f29('0x1c')](function(){return _0x105fe2;})[_0x3f29('0x1c')](respondWithResult(_0x414ecb,null))[_0x3f29('0x26')](handleError(_0x414ecb,null));};exports['getTags']=function(_0x50cc2b,_0x54bd39){var _0x41f57f={};var _0x195683={};var _0x3797f6;var _0x2bc896;return db[_0x3f29('0x27')][_0x3f29('0x76')]({'where':{'id':_0x50cc2b[_0x3f29('0x28')]['id']}})[_0x3f29('0x1c')](handleEntityNotFound(_0x54bd39,null))['then'](function(_0x1a036f){if(_0x1a036f){_0x3797f6=_0x1a036f;_0x195683['model']=_[_0x3f29('0x2b')](db[_0x3f29('0x62')][_0x3f29('0x77')]);_0x195683[_0x3f29('0x2e')]=_[_0x3f29('0x2b')](_0x50cc2b[_0x3f29('0x2e')]);_0x195683[_0x3f29('0x78')]=_[_0x3f29('0x79')](_0x195683[_0x3f29('0x7a')],_0x195683[_0x3f29('0x2e')]);_0x41f57f['attributes']=_[_0x3f29('0x79')](_0x195683[_0x3f29('0x7a')],qs[_0x3f29('0x7b')](_0x50cc2b[_0x3f29('0x2e')]['fields']));_0x41f57f[_0x3f29('0x7c')]=_0x41f57f[_0x3f29('0x7c')]['length']?_0x41f57f[_0x3f29('0x7c')]:_0x195683[_0x3f29('0x7a')];_0x41f57f[_0x3f29('0x7d')]=qs[_0x3f29('0x7e')](_0x50cc2b['query'][_0x3f29('0x7e')]);_0x41f57f[_0x3f29('0x5d')]=qs['filters'](_[_0x3f29('0x7f')](_0x50cc2b['query'],_0x195683[_0x3f29('0x78')]));if(_0x50cc2b['query'][_0x3f29('0x80')]){_0x41f57f[_0x3f29('0x5d')]=_[_0x3f29('0x37')](_0x41f57f['where'],{'$or':_[_0x3f29('0x81')](_0x41f57f[_0x3f29('0x7c')],function(_0x1a9187){var _0x4d8122={};_0x4d8122[_0x1a9187]={'$like':'%'+_0x50cc2b[_0x3f29('0x2e')][_0x3f29('0x80')]+'%'};return _0x4d8122;})});}_0x41f57f=_[_0x3f29('0x37')]({},_0x41f57f,_0x50cc2b[_0x3f29('0x82')]);return _0x3797f6[_0x3f29('0x83')](_0x41f57f);}})[_0x3f29('0x1c')](function(_0x53272c){if(_0x53272c){_0x2bc896=_0x53272c['length'];if(!_0x50cc2b[_0x3f29('0x2e')]['hasOwnProperty']('nolimit')){_0x41f57f['limit']=qs[_0x3f29('0x17')](_0x50cc2b[_0x3f29('0x2e')][_0x3f29('0x17')]);_0x41f57f[_0x3f29('0x15')]=qs['offset'](_0x50cc2b[_0x3f29('0x2e')]['offset']);}return _0x3797f6[_0x3f29('0x83')](_0x41f57f);}})['then'](function(_0x5ec596){if(_0x5ec596){return _0x5ec596?{'count':_0x2bc896,'rows':_0x5ec596}:null;}})[_0x3f29('0x1c')](respondWithResult(_0x54bd39,null))[_0x3f29('0x26')](handleError(_0x54bd39,null));};exports[_0x3f29('0x84')]=function(_0x242228,_0x24566f){if(_0x242228['body']['id']){delete _0x242228['body']['id'];}return db[_0x3f29('0x27')][_0x3f29('0x76')]({'where':{'id':_0x242228['params']['id']}})[_0x3f29('0x1c')](handleEntityNotFound(_0x24566f,null))[_0x3f29('0x1c')](function(_0x18739b){if(_0x18739b){return _0x18739b[_0x3f29('0x84')](_0x242228[_0x3f29('0x38')]['ids']||[]);}return null;})[_0x3f29('0x1c')](respondWithResult(_0x24566f,null))[_0x3f29('0x26')](handleError(_0x24566f,null));};exports['setAdditionalPhones']=function(_0x57d269,_0x3fd1d1){var _0x244fb9=[];_0x244fb9[_0x3f29('0x5c')](addAdditionalPhones(_0x57d269[_0x3f29('0x38')]));Promise[_0x3f29('0x85')](_0x244fb9)[_0x3f29('0x1c')](function(){_0x244fb9=[];_0x244fb9[_0x3f29('0x5c')](deleteCmHopperPhones(_0x57d269['body']['id']));_0x244fb9[_0x3f29('0x5c')](addCmHopperPhones(_0x57d269[_0x3f29('0x38')]['id']));Promise[_0x3f29('0x85')](_0x244fb9)[_0x3f29('0x1c')](function(){return[0x1];})['then'](respondWithResult(_0x3fd1d1,null));});};function addAdditionalPhones(_0x3046ed){var _0x3f5f0a;return new Promise(function(_0x6bcf67){return db[_0x3f29('0x49')][_0x3f29('0x1b')]({'where':{'CmContactId':_0x3046ed['id']}})['then'](function(){db[_0x3f29('0x66')][_0x3f29('0x24')]({'raw':!![],'attributes':['id',_0x3f29('0x86')]})[_0x3f29('0x1c')](function(_0x4cb394){var _0x374e3f=[];for(var _0x25e98d=0x0;_0x25e98d<_0x3046ed[_0x3f29('0x87')][_0x3f29('0x2a')];_0x25e98d++){var _0x3fc783=_0x3046ed[_0x3f29('0x88')]?_[_0x3f29('0x55')](_0x3046ed[_0x3f29('0x88')][_0x25e98d])?'':_0x3046ed[_0x3f29('0x88')][_0x25e98d]:_0x3046ed['items'][_0x25e98d][_0x3f29('0x89')]?_0x3046ed[_0x3f29('0x87')][_0x25e98d][_0x3f29('0x89')]:'';var _0x534668=_[_0x3f29('0x55')](_0x3046ed[_0x3f29('0x87')][_0x25e98d]['description'])?'':_0x3046ed['items'][_0x25e98d][_0x3f29('0x8a')];var _0x494d2d=_0x3fc783+':'+_0x3046ed[_0x3f29('0x87')][_0x25e98d]['phone']+'§'+_0x534668;if(_[_0x3f29('0x55')](_0x3f5f0a))_0x3f5f0a=_0x494d2d;else _0x3f5f0a+=';'+_0x494d2d;var _0x58fcef=null;var _0x3a769e=null;if(_0x3046ed['item_types']){if(!_[_0x3f29('0x55')](_0x3046ed['item_types'][_0x25e98d])){_0x3a769e=_[_0x3f29('0x61')](_0x4cb394,function(_0x5b0730){return _0x5b0730['id']===_0x3046ed['item_types'][_0x25e98d];});if(!_[_0x3f29('0x55')](_0x3a769e)){_0x58fcef=_0x3a769e[_0x3f29('0x86')];}}}else{if(!_[_0x3f29('0x55')](_0x3046ed[_0x3f29('0x87')][_0x25e98d])){_0x3a769e=_[_0x3f29('0x61')](_0x4cb394,function(_0x2feac2){return _0x2feac2['id']===_0x3046ed[_0x3f29('0x87')][_0x25e98d][_0x3f29('0x89')];});if(!_[_0x3f29('0x55')](_0x3a769e)){_0x58fcef=_0x25e98d;}}}if(_[_0x3f29('0x55')](_0x58fcef)){_0x58fcef=0x64;}_0x374e3f[_0x3f29('0x5c')](addAdditionalPhone(_0x3046ed['id'],_0x3046ed[_0x3f29('0x87')][_0x25e98d]['phone'],_0x3046ed[_0x3f29('0x88')]?_['isNil'](_0x3046ed['item_types'][_0x25e98d])?null:_0x3046ed[_0x3f29('0x88')][_0x25e98d]:_0x3046ed[_0x3f29('0x87')][_0x25e98d][_0x3f29('0x89')]?_0x3046ed[_0x3f29('0x87')][_0x25e98d][_0x3f29('0x89')]:null,_0x58fcef,_0x534668));}Promise[_0x3f29('0x85')](_0x374e3f)[_0x3f29('0x1c')](function(){db[_0x3f29('0x27')][_0x3f29('0x1a')]({'AdditionalPhones':_0x3f5f0a},{'where':{'id':_0x3046ed['id']}})['then'](function(){_0x6bcf67(0x1);});});});});});}function addAdditionalPhone(_0x18a51a,_0x5db1d5,_0x1d7ef3,_0x3a3a75,_0x3658b8){return db[_0x3f29('0x49')]['find']({'where':{'CmContactId':_0x18a51a,'item':_0x5db1d5}})['then'](function(_0xf5d65d){if(_0xf5d65d)logger[_0x3f29('0x3c')](_0x3f29('0x8b'),_0xf5d65d);else{db['CmContactHasItem'][_0x3f29('0x54')]({'CmContactId':_0x18a51a,'item':_0x5db1d5,'ItemTypeId':_0x1d7ef3,'OrderBy':_0x3a3a75,'ItemClass':_0x3f29('0x8c'),'description':_0x3658b8});}});}function deleteCmHopperPhones(_0x3e7954){return new Promise(function(_0x37217a){return db[_0x3f29('0x3d')][_0x3f29('0x24')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3e7954}})[_0x3f29('0x1c')](function(_0x3249f1){db[_0x3f29('0x8d')][_0x3f29('0x1b')]({'where':{'CmHopperId':{'$in':_[_0x3f29('0x81')](_0x3249f1,'id')}}});})['then'](function(){_0x37217a(0x1);});});}function addCmHopperPhones(_0x1ff7b0){return new Promise(function(_0x12939e){return db['CmHopper'][_0x3f29('0x24')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1ff7b0}})[_0x3f29('0x1c')](function(_0x3fe1be){var _0x1a8168=[];_[_0x3f29('0x81')](_0x3fe1be,function(_0x3033a3){_0x1a8168[_0x3f29('0x5c')](createCmHopperPhone(_0x1ff7b0,_0x3033a3['id']));});Promise[_0x3f29('0x85')](_0x1a8168)[_0x3f29('0x1c')](function(){_0x12939e(0x1);});});});}function createCmHopperPhone(_0x1853fa,_0x23e7a7){return new Promise(function(_0x39b977){db[_0x3f29('0x49')][_0x3f29('0x24')]({'raw':!![],'attributes':[_0x3f29('0x8e'),_0x3f29('0x86')],'where':{'CmContactId':_0x1853fa,'ItemClass':_0x3f29('0x8c')},'include':[{'model':db[_0x3f29('0x66')],'attributes':[_0x3f29('0x86')],'as':'ItemType'}],'order':[_0x3f29('0x86'),db[_0x3f29('0x67')][_0x3f29('0x8f')](_0x3f29('0x90'))]})[_0x3f29('0x1c')](function(_0x5efcf3){var _0x20ce77=0x1;var _0x3cdc47=_[_0x3f29('0x81')](_0x5efcf3,function(_0x4a0da0){_0x4a0da0['CmHopperId']=_0x23e7a7;_0x4a0da0[_0x3f29('0x75')]=_0x4a0da0[_0x3f29('0x8e')];_0x4a0da0[_0x3f29('0x86')]=_0x20ce77;delete _0x4a0da0[_0x3f29('0x91')];_0x20ce77=_0x20ce77+0x1;return _0x4a0da0;});return db[_0x3f29('0x8d')][_0x3f29('0x92')](_0x3cdc47,{});})[_0x3f29('0x1c')](function(){_0x39b977(0x1);});});}function insertAdditionalPhones(_0x2dbda9,_0x13b7f1){return new Promise(function(_0xb16d67){var _0x4e8523=[];for(var _0x3f10e5=0x0;_0x3f10e5<_0x13b7f1[_0x3f29('0x2a')];_0x3f10e5++){var _0x39db19=_0x13b7f1[_0x3f10e5];_0x4e8523[_0x3f29('0x5c')](parseContactItemType(_0x39db19));}Promise[_0x3f29('0x85')](_0x4e8523)[_0x3f29('0x1c')](function(){var _0xd54eda={'id':_0x2dbda9['id'],'items':_0x13b7f1};return addAdditionalPhones(_0xd54eda)[_0x3f29('0x1c')](function(){return addCmHopperPhones(_0x2dbda9['id']);});})[_0x3f29('0x1c')](function(){_0xb16d67(_0x2dbda9);});});}function parseContactItemType(_0x2702fd){return new Promise(function(_0x37a8d8){if(_0x2702fd[_0x3f29('0x36')](_0x3f29('0x89'))){_0x37a8d8(_0x2702fd);}else{return db['ContactItemType'][_0x3f29('0x61')]({'where':{'name':_0x2702fd[_0x3f29('0x93')]}})[_0x3f29('0x1c')](function(_0xaf9e46){if(_[_0x3f29('0x55')](_0xaf9e46))_0x2702fd['ItemTypeId']=null;else _0x2702fd['ItemTypeId']=_0xaf9e46['id'];_0x37a8d8(_0x2702fd);});}});}exports['getAdditionalPhones']=function(_0x18a20a,_0x3dedc9){return db['CmContactHasItem'][_0x3f29('0x24')]({'raw':!![],'where':{'CmContactId':_0x18a20a[_0x3f29('0x28')]['id'],'ItemClass':_0x3f29('0x8c')},'include':[{'model':db['ContactItemType'],'as':_0x3f29('0x93')}],'order':[[_0x3f29('0x86')],[db['sequelize'][_0x3f29('0x8f')]('`ItemType`.OrderBy')]]})['then'](function(_0x24046f){return _0x24046f;})[_0x3f29('0x1c')](respondWithResult(_0x3dedc9,null))[_0x3f29('0x26')](handleError(_0x3dedc9,null));};exports[_0x3f29('0x94')]=function(_0x4614cc,_0x3b5056){return db[_0x3f29('0x49')][_0x3f29('0x24')]({'raw':!![],'where':{'CmContactId':_0x4614cc[_0x3f29('0x38')][_0x3f29('0x95')]}})['then'](function(_0x4e71d4){var _0x477276=_[_0x3f29('0x81')](_0x4e71d4,function(_0x5bb958){_0x5bb958['CmContactId']=_0x4614cc['body'][_0x3f29('0x96')];return _0x5bb958;});return db[_0x3f29('0x49')][_0x3f29('0x92')](_0x477276,{});})[_0x3f29('0x1c')](function(){return addCmHopperPhones(_0x4614cc[_0x3f29('0x38')][_0x3f29('0x96')]);})[_0x3f29('0x1c')](function(){return['ok'];})['then'](respondWithResult(_0x3b5056,null))['catch'](handleError(_0x3b5056,null));};exports[_0x3f29('0x97')]=function(_0x270a83,_0x5efb65){var _0x5eebff=[];_0x5eebff[_0x3f29('0x5c')](createCmHopperPhone(_0x270a83[_0x3f29('0x38')]['id'],_0x270a83[_0x3f29('0x38')]['hopperId']));Promise['all'](_0x5eebff)[_0x3f29('0x1c')](function(){return[0x1];})[_0x3f29('0x1c')](respondWithResult(_0x5efb65,null));};exports[_0x3f29('0x98')]=function(_0x5eddfa,_0x5eac38){var _0xe5c63={'raw':![],'where':{}};var _0x5dd82d={};var _0xa74e4c={'count':0x0,'rows':[]};return db[_0x3f29('0x27')]['findOne']({'where':{'id':_0x5eddfa[_0x3f29('0x28')]['id']}})[_0x3f29('0x1c')](handleEntityNotFound(_0x5eac38,null))[_0x3f29('0x1c')](function(_0xaf72b0){if(_0xaf72b0){_0x5dd82d[_0x3f29('0x7a')]=_[_0x3f29('0x2b')](db[_0x3f29('0x3d')][_0x3f29('0x77')]);_0x5dd82d['query']=_[_0x3f29('0x2b')](_0x5eddfa['query']);_0x5dd82d[_0x3f29('0x78')]=_['intersection'](_0x5dd82d['model'],_0x5dd82d[_0x3f29('0x2e')]);_0xe5c63[_0x3f29('0x7c')]=_['intersection'](_0x5dd82d[_0x3f29('0x7a')],qs[_0x3f29('0x7b')](_0x5eddfa['query']['fields']));_0xe5c63[_0x3f29('0x7c')]=_0xe5c63['attributes'][_0x3f29('0x2a')]?_0xe5c63[_0x3f29('0x7c')]:_0x5dd82d[_0x3f29('0x7a')];if(!_0x5eddfa[_0x3f29('0x2e')][_0x3f29('0x36')](_0x3f29('0x99'))){_0xe5c63['limit']=qs[_0x3f29('0x17')](_0x5eddfa[_0x3f29('0x2e')][_0x3f29('0x17')]);_0xe5c63[_0x3f29('0x15')]=qs['offset'](_0x5eddfa['query'][_0x3f29('0x15')]);}_0xe5c63[_0x3f29('0x7d')]=qs[_0x3f29('0x7e')](_0x5eddfa[_0x3f29('0x2e')]['sort']);_0xe5c63[_0x3f29('0x5d')]=qs[_0x3f29('0x78')](_[_0x3f29('0x7f')](_0x5eddfa[_0x3f29('0x2e')],_0x5dd82d[_0x3f29('0x78')]));_0xe5c63[_0x3f29('0x5d')][_0x3f29('0x9a')]=_0xaf72b0['id'];if(_0x5eddfa[_0x3f29('0x2e')][_0x3f29('0x80')]){_0xe5c63[_0x3f29('0x5d')]=_[_0x3f29('0x37')](_0xe5c63[_0x3f29('0x5d')],{'$or':_[_0x3f29('0x81')](_0xe5c63['attributes'],function(_0x318426){var _0x3ae78b={};_0x3ae78b[_0x318426]={'$like':'%'+_0x5eddfa[_0x3f29('0x2e')]['filter']+'%'};return _0x3ae78b;})});}_0xe5c63=_[_0x3f29('0x37')]({},_0xe5c63,_0x5eddfa[_0x3f29('0x82')]);return db['CmHopper'][_0x3f29('0x16')]({'where':_0xe5c63[_0x3f29('0x5d')]})[_0x3f29('0x1c')](function(_0x513fa8){_0xa74e4c[_0x3f29('0x16')]=_0x513fa8;if(_0x5eddfa['query']['includeAll']){_0xe5c63[_0x3f29('0x9b')]=[{'all':!![]}];}return db[_0x3f29('0x3d')][_0x3f29('0x24')](_0xe5c63);})[_0x3f29('0x1c')](function(_0x2104fa){_0xa74e4c['rows']=_0x2104fa;return _0xa74e4c;});}})['then'](respondWithFilteredResult(_0x5eac38,_0xe5c63))[_0x3f29('0x26')](handleError(_0x5eac38,null));};exports[_0x3f29('0x9c')]=function(_0x47ccfc,_0x4cff85){var _0x1ce17e={'raw':!![],'where':{}};var _0x5c0c40={};var _0x5ea721={'count':0x0,'rows':[]};return db[_0x3f29('0x27')][_0x3f29('0x76')]({'where':{'id':_0x47ccfc[_0x3f29('0x28')]['id']}})[_0x3f29('0x1c')](handleEntityNotFound(_0x4cff85,null))[_0x3f29('0x1c')](function(_0x5a1acf){if(_0x5a1acf){_0x5c0c40[_0x3f29('0x7a')]=_[_0x3f29('0x2b')](db[_0x3f29('0x4b')][_0x3f29('0x77')]);_0x5c0c40[_0x3f29('0x2e')]=_['keys'](_0x47ccfc['query']);_0x5c0c40[_0x3f29('0x78')]=_[_0x3f29('0x79')](_0x5c0c40[_0x3f29('0x7a')],_0x5c0c40[_0x3f29('0x2e')]);_0x1ce17e[_0x3f29('0x7c')]=_[_0x3f29('0x79')](_0x5c0c40['model'],qs['fields'](_0x47ccfc[_0x3f29('0x2e')][_0x3f29('0x7b')]));_0x1ce17e[_0x3f29('0x7c')]=_0x1ce17e[_0x3f29('0x7c')]['length']?_0x1ce17e[_0x3f29('0x7c')]:_0x5c0c40[_0x3f29('0x7a')];if(!_0x47ccfc['query'][_0x3f29('0x36')]('nolimit')){_0x1ce17e[_0x3f29('0x17')]=qs[_0x3f29('0x17')](_0x47ccfc[_0x3f29('0x2e')][_0x3f29('0x17')]);_0x1ce17e['offset']=qs['offset'](_0x47ccfc[_0x3f29('0x2e')][_0x3f29('0x15')]);}_0x1ce17e[_0x3f29('0x7d')]=qs[_0x3f29('0x7e')](_0x47ccfc[_0x3f29('0x2e')][_0x3f29('0x7e')]);_0x1ce17e[_0x3f29('0x5d')]=qs[_0x3f29('0x78')](_[_0x3f29('0x7f')](_0x47ccfc['query'],_0x5c0c40[_0x3f29('0x78')]));_0x1ce17e[_0x3f29('0x5d')][_0x3f29('0x9a')]=_0x5a1acf['id'];if(_0x47ccfc['query'][_0x3f29('0x80')]){_0x1ce17e[_0x3f29('0x5d')]=_['merge'](_0x1ce17e[_0x3f29('0x5d')],{'$or':_['map'](_0x1ce17e[_0x3f29('0x7c')],function(_0x57c095){var _0x416629={};_0x416629[_0x57c095]={'$like':'%'+_0x47ccfc[_0x3f29('0x2e')]['filter']+'%'};return _0x416629;})});}_0x1ce17e=_[_0x3f29('0x37')]({},_0x1ce17e,_0x47ccfc['options']);return db[_0x3f29('0x4b')][_0x3f29('0x16')]({'where':_0x1ce17e[_0x3f29('0x5d')]})['then'](function(_0x572eb7){_0x5ea721['count']=_0x572eb7;if(_0x47ccfc[_0x3f29('0x2e')][_0x3f29('0x9d')]){_0x1ce17e[_0x3f29('0x9b')]=[{'all':!![]}];}return db[_0x3f29('0x4b')]['findAll'](_0x1ce17e);})[_0x3f29('0x1c')](function(_0x36cd6f){_0x5ea721[_0x3f29('0x9e')]=_0x36cd6f;return _0x5ea721;});}})[_0x3f29('0x1c')](respondWithFilteredResult(_0x4cff85,_0x1ce17e))[_0x3f29('0x26')](handleError(_0x4cff85,null));};exports[_0x3f29('0x9f')]=function(_0x34b062,_0x562117){var _0x591c6a={'raw':!![],'where':{}};var _0x52b581={};var _0x4fd270={'count':0x0,'rows':[]};return db['CmContact'][_0x3f29('0x76')]({'where':{'id':_0x34b062[_0x3f29('0x28')]['id']}})['then'](handleEntityNotFound(_0x562117,null))['then'](function(_0x102199){if(_0x102199){_0x52b581[_0x3f29('0x7a')]=_[_0x3f29('0x2b')](db[_0x3f29('0x4a')]['rawAttributes']);_0x52b581['query']=_[_0x3f29('0x2b')](_0x34b062[_0x3f29('0x2e')]);_0x52b581['filters']=_[_0x3f29('0x79')](_0x52b581[_0x3f29('0x7a')],_0x52b581[_0x3f29('0x2e')]);_0x591c6a[_0x3f29('0x7c')]=_[_0x3f29('0x79')](_0x52b581[_0x3f29('0x7a')],qs[_0x3f29('0x7b')](_0x34b062[_0x3f29('0x2e')][_0x3f29('0x7b')]));_0x591c6a[_0x3f29('0x7c')]=_0x591c6a['attributes'][_0x3f29('0x2a')]?_0x591c6a[_0x3f29('0x7c')]:_0x52b581[_0x3f29('0x7a')];if(!_0x34b062[_0x3f29('0x2e')][_0x3f29('0x36')](_0x3f29('0x99'))){_0x591c6a[_0x3f29('0x17')]=qs[_0x3f29('0x17')](_0x34b062['query'][_0x3f29('0x17')]);_0x591c6a[_0x3f29('0x15')]=qs[_0x3f29('0x15')](_0x34b062['query'][_0x3f29('0x15')]);}_0x591c6a[_0x3f29('0x7d')]=qs[_0x3f29('0x7e')](_0x34b062[_0x3f29('0x2e')][_0x3f29('0x7e')]);_0x591c6a['where']=qs[_0x3f29('0x78')](_['pick'](_0x34b062['query'],_0x52b581[_0x3f29('0x78')]));_0x591c6a[_0x3f29('0x5d')][_0x3f29('0x9a')]=_0x102199['id'];if(_0x34b062[_0x3f29('0x2e')][_0x3f29('0x80')]){_0x591c6a['where']=_[_0x3f29('0x37')](_0x591c6a['where'],{'$or':_[_0x3f29('0x81')](_0x591c6a[_0x3f29('0x7c')],function(_0x323418){var _0x1f9d8c={};_0x1f9d8c[_0x323418]={'$like':'%'+_0x34b062['query'][_0x3f29('0x80')]+'%'};return _0x1f9d8c;})});}_0x591c6a=_[_0x3f29('0x37')]({},_0x591c6a,_0x34b062[_0x3f29('0x82')]);return db[_0x3f29('0x4a')][_0x3f29('0x16')]({'where':_0x591c6a[_0x3f29('0x5d')]})[_0x3f29('0x1c')](function(_0xacefcc){_0x4fd270[_0x3f29('0x16')]=_0xacefcc;if(_0x34b062['query']['includeAll']){_0x591c6a[_0x3f29('0x9b')]=[{'all':!![]}];}return db[_0x3f29('0x4a')][_0x3f29('0x24')](_0x591c6a);})[_0x3f29('0x1c')](function(_0x382274){_0x4fd270[_0x3f29('0x9e')]=_0x382274;return _0x4fd270;});}})[_0x3f29('0x1c')](respondWithFilteredResult(_0x562117,_0x591c6a))['catch'](handleError(_0x562117,null));};exports[_0x3f29('0xa0')]=function(_0x314ed1,_0xe19bb){var _0x5c8723={'raw':!![],'where':{}};var _0x5e8931={};var _0x3a756f={'count':0x0,'rows':[]};return db[_0x3f29('0x27')][_0x3f29('0x76')]({'where':{'id':_0x314ed1[_0x3f29('0x28')]['id']}})[_0x3f29('0x1c')](handleEntityNotFound(_0xe19bb,null))[_0x3f29('0x1c')](function(_0x4eac92){if(_0x4eac92){_0x5e8931[_0x3f29('0x7a')]=_[_0x3f29('0x2b')](db['JscriptySessionReport']['rawAttributes']);_0x5e8931[_0x3f29('0x2e')]=_['keys'](_0x314ed1[_0x3f29('0x2e')]);_0x5e8931[_0x3f29('0x78')]=_[_0x3f29('0x79')](_0x5e8931[_0x3f29('0x7a')],_0x5e8931[_0x3f29('0x2e')]);_0x5c8723[_0x3f29('0x7c')]=_[_0x3f29('0x79')](_0x5e8931[_0x3f29('0x7a')],qs[_0x3f29('0x7b')](_0x314ed1['query'][_0x3f29('0x7b')]));_0x5c8723[_0x3f29('0x7c')]=_0x5c8723[_0x3f29('0x7c')]['length']?_0x5c8723[_0x3f29('0x7c')]:_0x5e8931[_0x3f29('0x7a')];if(!_0x314ed1['query']['hasOwnProperty'](_0x3f29('0x99'))){_0x5c8723['limit']=qs[_0x3f29('0x17')](_0x314ed1[_0x3f29('0x2e')]['limit']);_0x5c8723[_0x3f29('0x15')]=qs[_0x3f29('0x15')](_0x314ed1[_0x3f29('0x2e')][_0x3f29('0x15')]);}_0x5c8723[_0x3f29('0x7d')]=qs[_0x3f29('0x7e')](_0x314ed1[_0x3f29('0x2e')][_0x3f29('0x7e')]);_0x5c8723['where']=qs['filters'](_[_0x3f29('0x7f')](_0x314ed1[_0x3f29('0x2e')],_0x5e8931[_0x3f29('0x78')]));_0x5c8723[_0x3f29('0x5d')][_0x3f29('0x9a')]=_0x4eac92['id'];if(_0x314ed1[_0x3f29('0x2e')][_0x3f29('0x80')]){_0x5c8723['where']=_[_0x3f29('0x37')](_0x5c8723[_0x3f29('0x5d')],{'$or':_[_0x3f29('0x81')](_0x5c8723[_0x3f29('0x7c')],function(_0x4dea83){var _0x350055={};_0x350055[_0x4dea83]={'$like':'%'+_0x314ed1[_0x3f29('0x2e')][_0x3f29('0x80')]+'%'};return _0x350055;})});}_0x5c8723=_[_0x3f29('0x37')]({},_0x5c8723,_0x314ed1[_0x3f29('0x82')]);return db[_0x3f29('0x50')][_0x3f29('0x16')]({'where':_0x5c8723[_0x3f29('0x5d')]})[_0x3f29('0x1c')](function(_0x56d3c1){_0x3a756f[_0x3f29('0x16')]=_0x56d3c1;if(_0x314ed1[_0x3f29('0x2e')][_0x3f29('0x9d')]){_0x5c8723['include']=[{'all':!![]}];}return db[_0x3f29('0x50')]['findAll'](_0x5c8723);})[_0x3f29('0x1c')](function(_0x2a12fe){_0x3a756f['rows']=_0x2a12fe;return _0x3a756f;});}})[_0x3f29('0x1c')](respondWithFilteredResult(_0xe19bb,_0x5c8723))[_0x3f29('0x26')](handleError(_0xe19bb,null));};exports[_0x3f29('0xa1')]=function(_0x5364d9,_0x2cc199){try{if(!_0x5364d9[_0x3f29('0x38')][_0x3f29('0x69')]){throw new Error(_0x3f29('0xa2'));}if(!_0x5364d9[_0x3f29('0x38')][_0x3f29('0xa3')]){throw new Error(_0x3f29('0xa4'));}if(!_0x5364d9['body'][_0x3f29('0xa5')]){throw new Error(_0x3f29('0xa6'));}if(!_0x5364d9[_0x3f29('0x38')][_0x3f29('0xa7')]){throw new Error(_0x3f29('0xa8'));}var _0xa3b489=_0x5364d9[_0x3f29('0x38')][_0x3f29('0xa3')][_0x3f29('0xa9')](',');var _0x328814=_0x5364d9[_0x3f29('0x38')][_0x3f29('0xa5')]['split'](',');if(!_0xa3b489[_0x3f29('0x2a')]||!_0x328814[_0x3f29('0x2a')]||_0xa3b489[_0x3f29('0x2a')]!==_0x328814['length']){throw new Error(_0x3f29('0xaa'));}_0x5364d9[_0x3f29('0x38')][_0x3f29('0x7b')]=_[_0x3f29('0xab')](_0xa3b489,_0x328814);if(!_0x5364d9[_0x3f29('0x38')][_0x3f29('0x7b')][_0x3f29('0x75')]){throw new Error(_0x3f29('0xac'));}if(!_0x5364d9[_0x3f29('0x38')]['fields'][_0x3f29('0xad')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x3d6e24=path[_0x3f29('0x3b')](config[_0x3f29('0xae')],'server/files/tmp',_0x5364d9[_0x3f29('0xaf')][_0x3f29('0xb0')]);fs[_0x3f29('0xb1')](_0x3d6e24,parseInt(_0x3f29('0xb2'),0x8));var _0x1c247b=require('child_process')[_0x3f29('0xb3')](path['join'](__dirname,_0x3f29('0xb4')),[_0x3d6e24,_0x5364d9['body']['binding_keys'],_0x5364d9[_0x3f29('0x38')][_0x3f29('0xa5')],_0x5364d9[_0x3f29('0x38')]['ListId'],_0x5364d9['body'][_0x3f29('0xb5')],_0x5364d9[_0x3f29('0x38')]['duplicates'],_0x5364d9['body'][_0x3f29('0xa7')]]);return _0x2cc199[_0x3f29('0x12')](0xc8)['json']({'message':_0x3f29('0xb6'),'pid':_0x1c247b[_0x3f29('0xb7')]});}catch(_0x2f41db){return _0x2cc199[_0x3f29('0x12')](0x1f4)[_0x3f29('0xb8')](_0x2f41db);}};exports[_0x3f29('0xb9')]=function(_0x2e81cf,_0x4b3959){var _0x128032=fs['createReadStream'](_0x2e81cf['file'][_0x3f29('0x3')]);Papa['parse'](_0x128032,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x560724){return _0x4b3959['status'](0xc8)[_0x3f29('0x13')]({'file':_0x2e81cf[_0x3f29('0xaf')],'fields':_0x560724[_0x3f29('0xba')][_0x3f29('0x7b')]});}});};exports[_0x3f29('0xbb')]=function(_0x3ccb93,_0x3dbb58){return db[_0x3f29('0xbc')][_0x3f29('0x24')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x3f29('0x1c')](function(_0x40c903){var _0x41750d=![];if(!_0x3ccb93['body']['ListId']){throw new Error(_0x3f29('0xa2'));}if(!_0x3ccb93['body'][_0x3f29('0xbd')][_0x3f29('0x75')]){throw new Error(_0x3f29('0xac'));}if(!_0x3ccb93[_0x3f29('0x38')][_0x3f29('0xbd')][_0x3f29('0xad')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x3ccb93[_0x3f29('0x38')][_0x3f29('0xa7')]){throw new Error(_0x3f29('0xa8'));}var _0x3cdfde=require('child_process')[_0x3f29('0xb3')](path[_0x3f29('0x3b')](__dirname,'../../components/import/cm/csv2'),[_0x3ccb93[_0x3f29('0x28')]['id'],JSON[_0x3f29('0xbe')](_0x3ccb93[_0x3f29('0x38')]),JSON[_0x3f29('0xbe')](_0x40c903)]);_0x3cdfde['on'](_0x3f29('0xbf'),function(){_0x41750d=!![];return _0x3dbb58[_0x3f29('0x12')](0xc8)[_0x3f29('0x13')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x3cdfde['pid']});});_0x3cdfde['on']('exit',function(_0x41966a){if(_0x41966a&&!_0x41750d){return _0x3dbb58['status'](0x1f4)[_0x3f29('0x13')]({'message':_0x3f29('0xc0'),'pid':_0x3cdfde[_0x3f29('0xb7')]});}});})[_0x3f29('0x26')](handleError(_0x3dbb58,null));};exports[_0x3f29('0xc1')]=function(_0x5daa67,_0x457180){return db[_0x3f29('0xbc')][_0x3f29('0x24')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x3f29('0x1c')](function(_0x1b2769){var _0x2d3257=![];if(!_0x5daa67[_0x3f29('0x38')][_0x3f29('0x69')]){throw new Error(_0x3f29('0xa2'));}if(!_0x5daa67[_0x3f29('0x38')][_0x3f29('0xbd')][_0x3f29('0x75')]){throw new Error(_0x3f29('0xac'));}if(!_0x5daa67['body'][_0x3f29('0xbd')]['firstName']){throw new Error(_0x3f29('0xc2'));}if(!_0x5daa67[_0x3f29('0x38')][_0x3f29('0xa7')]){throw new Error(_0x3f29('0xa8'));}var _0xb1f833=require('child_process')[_0x3f29('0xb3')](path[_0x3f29('0x3b')](__dirname,_0x3f29('0xc3')),[_0x5daa67[_0x3f29('0x28')]['id'],JSON[_0x3f29('0xbe')](_0x5daa67[_0x3f29('0x38')]),JSON[_0x3f29('0xbe')](_0x1b2769)]);_0xb1f833['on'](_0x3f29('0xbf'),function(){_0x2d3257=!![];return _0x457180['status'](0xc8)[_0x3f29('0x13')]({'message':'start\x20child\x20process\x20correctly!','pid':_0xb1f833[_0x3f29('0xb7')]});});_0xb1f833['on'](_0x3f29('0xc4'),function(_0x480feb){if(_0x480feb&&!_0x2d3257){return _0x457180[_0x3f29('0x12')](0x1f4)[_0x3f29('0x13')]({'message':'error\x20child\x20process','pid':_0xb1f833['pid']});}});})['catch'](handleError(_0x457180,null));};exports['getJourney']=function(_0x1a99aa,_0x12aec3){var _0x532e5a=[_0x3f29('0xc5'),_0x3f29('0xc6'),_0x3f29('0xc7'),'openchannel','fax','whatsapp',_0x3f29('0xc8')];var _0xbaa187={'offset':0x0,'order':qs['sort']('-createdAt')},_0x26ea56={'count':0x0,'rows':[]};Promise[_0x3f29('0xc9')]()[_0x3f29('0x1c')](function(){if(_0x1a99aa[_0x3f29('0x2e')][_0x3f29('0xca')]){if(!_[_0x3f29('0xcb')](_0x532e5a,_0x1a99aa[_0x3f29('0x2e')]['channel']['toLowerCase']())){throw new Error(_0x3f29('0xcc'));}_0x532e5a=[_0x1a99aa[_0x3f29('0x2e')][_0x3f29('0xca')][_0x3f29('0xcd')]()];}if(_0x1a99aa['query'][_0x3f29('0xce')]){try{var _0x395989=JSON['parse'](_0x1a99aa[_0x3f29('0x2e')]['range']);if(!moment(_0x395989[_0x3f29('0x40')])[_0x3f29('0xcf')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x395989['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x18378d){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x1a99aa[_0x3f29('0x2e')]['hasOwnProperty'](_0x3f29('0x99'))){_0xbaa187[_0x3f29('0x17')]=qs['limit'](_0x1a99aa[_0x3f29('0x2e')][_0x3f29('0x17')]||0xa);_0xbaa187[_0x3f29('0x15')]=qs[_0x3f29('0x15')](_0x1a99aa[_0x3f29('0x2e')]['offset']);}var _0x55adde=_0x532e5a[_0x3f29('0x81')](function(_0x46648a){if(_0x46648a===_0x3f29('0xc8')){var _0xf6011={'attributes':['id','uniqueid',_0x3f29('0xd0'),_0x3f29('0xd1'),'destination',_0x3f29('0xd2'),_0x3f29('0xd3'),_0x3f29('0xd4'),'duration',_0x3f29('0xd5'),_0x3f29('0xd6'),_0x3f29('0xd7'),_0x3f29('0xd8'),_0x3f29('0xd9'),'UserId'],'where':{'ContactId':_0x1a99aa['params']['id']},'include':[{'model':db['User'],'as':_0x3f29('0xbc'),'attributes':['id',_0x3f29('0x21'),_0x3f29('0xda'),_0x3f29('0x32')]}],'order':[[_0x3f29('0xd6'),_0x3f29('0xdb')]]};if(_0x1a99aa[_0x3f29('0x2e')]['range']){_0xf6011[_0x3f29('0x5d')][_0x3f29('0xd6')]={'$gte':_0x395989[_0x3f29('0x40')],'$lte':_0x395989['to']};}return db[_0x3f29('0xdc')]['findAndCountAll'](_0xf6011)[_0x3f29('0x1c')](function(_0x3e9fa1){_0x26ea56[_0x3f29('0x16')]+=_0x3e9fa1[_0x3f29('0x16')];return _['map'](_0x3e9fa1['rows'],function(_0x3fff73){var _0x381c72=_0x3fff73[_0x3f29('0x39')]({'plain':!![]});_0x381c72[_0x3f29('0xca')]=_0x46648a;if(_0x381c72[_0x3f29('0xbc')]){_0x381c72[_0x3f29('0xbc')]={'id':_0x381c72[_0x3f29('0xbc')]['id'],'name':_0x381c72[_0x3f29('0xbc')]['name'],'fullname':_0x381c72['User']['fullname'],'alias':_0x381c72[_0x3f29('0xbc')][_0x3f29('0x32')]};}return _0x381c72;});});}else{var _0x3b2816=_[_0x3f29('0xdd')](_0x46648a)+(_0x46648a===_0x3f29('0xc6')?'Website':'Account');var _0x162e2c={'attributes':['id',_0x3f29('0xde'),_0x3f29('0xdf'),_0x3f29('0xd6'),_0x3f29('0xd5'),_0x3f29('0xe0'),_0x3f29('0xe1'),'thirdDisposition',_0x3f29('0xe2'),_0x3b2816+'Id'],'where':{'ContactId':_0x1a99aa['params']['id']},'include':[{'model':db[_0x3b2816],'as':_0x3f29('0xe3'),'attributes':['id','name',_0x3f29('0xe4')]},{'model':db[_0x3f29('0xbc')],'as':'Owner','attributes':['id',_0x3f29('0x21'),_0x3f29('0xda')]},{'model':db[_0x3f29('0x62')],'as':_0x3f29('0x63'),'attributes':['id',_0x3f29('0x21'),'color'],'through':{'attributes':[]}}],'order':[[_0x3f29('0xd6'),_0x3f29('0xdb')]]};if(_0x1a99aa[_0x3f29('0x2e')][_0x3f29('0xce')]){_0x162e2c[_0x3f29('0x5d')][_0x3f29('0xd6')]={'$gte':_0x395989[_0x3f29('0x40')],'$lte':_0x395989['to']};}switch(_0x46648a){case _0x3f29('0xc6'):_0x162e2c[_0x3f29('0x7c')][_0x3f29('0x5c')](_0x3f29('0xe5'),_0x3f29('0xe6'),_0x3f29('0xe7'),_0x3f29('0xe8'),_0x3f29('0xe9'),'ratingMessage','ratingType',_0x3f29('0xea'),_0x3f29('0xeb'));break;case _0x3f29('0xc5'):_0x162e2c[_0x3f29('0x7c')][_0x3f29('0x5c')](_0x3f29('0xec'),_0x3f29('0xed'));break;case'openchannel':_0x162e2c[_0x3f29('0x7c')][_0x3f29('0x5c')](_0x3f29('0xee'),'threadId');break;}return db[_['startCase'](_0x46648a)+_0x3f29('0xef')]['findAndCountAll'](_0x162e2c)[_0x3f29('0x1c')](function(_0x4e370a){_0x26ea56['count']+=_0x4e370a[_0x3f29('0x16')];return _['map'](_0x4e370a[_0x3f29('0x9e')],function(_0x26380b){var _0x1ccec4=_0x26380b[_0x3f29('0x39')]({'plain':!![]});_0x1ccec4['channel']=_0x46648a;if(_0x1ccec4[_0x3f29('0xf0')]){_0x1ccec4[_0x3f29('0xf0')]={'id':_0x1ccec4[_0x3f29('0xf0')]['id'],'name':_0x1ccec4[_0x3f29('0xf0')]['name'],'fullname':_0x1ccec4['Owner'][_0x3f29('0xda')]};}return _0x1ccec4;});});}});return Promise[_0x3f29('0x85')](_0x55adde);})[_0x3f29('0x1c')](function(_0x298e94){return _(_0x298e94)[_0x3f29('0xf1')]()[_0x3f29('0xf2')](_0x3f29('0xd6'))['reverse']()[_0x3f29('0xf3')]();})[_0x3f29('0x1c')](function(_0x52e226){_0x26ea56[_0x3f29('0x9e')]=_0xbaa187[_0x3f29('0x17')]?_0x52e226['slice'](_0xbaa187[_0x3f29('0x15')],_0xbaa187['offset']+_0xbaa187['limit']):_0x52e226;return _0x26ea56;})[_0x3f29('0x1c')](respondWithFilteredResult(_0x12aec3,_0xbaa187))[_0x3f29('0x26')](handleError(_0x12aec3,null));}; \ No newline at end of file +var _0x4c4b=['from','get','isArray','CmHopper','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','duplicates','where','$or','ListId','findOrCreate','hasOwnProperty','push','contact','all','show','params','Tag','Tags','tag','Phones','ContactItemType','ItemType','Phones.OrderBy','omit','map','format','cf_%d','$and','pickBy','startsWith','table','id\x20=\x20?','toParam','sequelize','text','phone','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','getTags','offset','setTags','setAdditionalPhones','OrderBy','item_types','items','ItemTypeId','description','contact\x20phone\x20exists','PHONE','item','literal','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','bulkCreate','`ItemType`.OrderBy','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','nolimit','ContactId','options','includeAll','include','rows','JscriptySessionReport','binding_keys','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','upload','createReadStream','parse','import','User','agent','No\x20ListId\x20specified','binding','firstName','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','error\x20child\x20process','importUpdates','No\x20firstName\x20column\x20specified','fork','../../components/import/cm/csvUpdates','exit','getJourney','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userThirdDisposition','UserId','alias','findAndCountAll','fullname','startCase','Website','Account','closed','closedAt','secondDisposition','thirdDisposition','color','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','referer','mail','subject','externalUrl','threadId','Interaction','Owner','flatten','sortBy','moment','bluebird','path','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','localhost','socket.io-emitter','register','status','json','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','error','name','send','index','describe','getOptions','user','CmContact','find','catch','tags','keys','length','cf_','columnName','displayName','query','analytics','CmCustomField','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','merge','body','findAll'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0x4c4b,0xc7));var _0xb4c4=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4c4b[_0x2b4411];return _0x8e41ef;};'use strict';var moment=require(_0xb4c4('0x0'));var BPromise=require(_0xb4c4('0x1'));var util=require('util');var path=require(_0xb4c4('0x2'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Papa=require(_0xb4c4('0x3'));var Redis=require(_0xb4c4('0x4'));var contacts=require(_0xb4c4('0x5'));var qs=require(_0xb4c4('0x6'));var logger=require(_0xb4c4('0x7'))('api');var config=require(_0xb4c4('0x8'));var shared=require(_0xb4c4('0x9'));var db=require(_0xb4c4('0xa'))['db'];config[_0xb4c4('0xb')]=_['defaults'](config['redis'],{'host':_0xb4c4('0xc'),'port':0x18eb});var socket=require(_0xb4c4('0xd'))(new Redis(config[_0xb4c4('0xb')]));require('./cmContact.socket')[_0xb4c4('0xe')](socket);function respondWithResult(_0x2f1770,_0x2d9eda){_0x2d9eda=_0x2d9eda||0xc8;return function(_0x297417){if(_0x297417){return _0x2f1770[_0xb4c4('0xf')](_0x2d9eda)[_0xb4c4('0x10')](_0x297417);}};}function respondWithFilteredResult(_0x4b75e0,_0x1ec7de){return function(_0x2c4f2a){if(_0x2c4f2a){var _0x1f4f92=typeof _0x1ec7de['offset']===_0xb4c4('0x11')&&typeof _0x1ec7de[_0xb4c4('0x12')]==='undefined';var _0x42b2d1=_0x2c4f2a[_0xb4c4('0x13')];var _0x2196f5=_0x1f4f92?0x0:_0x1ec7de['offset'];var _0x4c54bd=_0x1f4f92?_0x2c4f2a[_0xb4c4('0x13')]:_0x1ec7de['offset']+_0x1ec7de[_0xb4c4('0x12')];var _0x7618e1;if(_0x4c54bd>=_0x42b2d1){_0x4c54bd=_0x42b2d1;_0x7618e1=0xc8;}else{_0x7618e1=0xce;}_0x4b75e0[_0xb4c4('0xf')](_0x7618e1);return _0x4b75e0['set'](_0xb4c4('0x14'),_0x2196f5+'-'+_0x4c54bd+'/'+_0x42b2d1)[_0xb4c4('0x10')](_0x2c4f2a);}return null;};}function saveUpdates(_0x2369e2){return function(_0x11c875){if(_0x11c875){return _0x11c875['update'](_0x2369e2)[_0xb4c4('0x15')](function(_0x3eb1b8){return _0x3eb1b8;});}return null;};}function removeEntity(_0x23e910){return function(_0xc283c2){if(_0xc283c2){return _0xc283c2[_0xb4c4('0x16')]()[_0xb4c4('0x15')](function(){_0x23e910[_0xb4c4('0xf')](0xcc)[_0xb4c4('0x17')]();});}};}function handleEntityNotFound(_0x22641c){return function(_0x537396){if(!_0x537396){_0x22641c[_0xb4c4('0x18')](0x194);}return _0x537396;};}function handleError(_0x2c6ee3,_0x2f2474){_0x2f2474=_0x2f2474||0x1f4;return function(_0x5ec111){logger[_0xb4c4('0x19')](_0x5ec111['stack']);if(_0x5ec111['name']){delete _0x5ec111[_0xb4c4('0x1a')];}_0x2c6ee3[_0xb4c4('0xf')](_0x2f2474)[_0xb4c4('0x1b')](_0x5ec111);};}exports[_0xb4c4('0x1c')]=function(_0x4df444,_0xaba9ae){var _0x3f06d7={};return contacts[_0xb4c4('0x1d')]()[_0xb4c4('0x15')](function(_0xd5fbe2){_0x3f06d7=qs[_0xb4c4('0x1e')](_0xd5fbe2,_0x4df444);return contacts['findAll'](_0x4df444['query'],_0x4df444[_0xb4c4('0x1f')],_0x3f06d7,_0xd5fbe2);})[_0xb4c4('0x15')](respondWithFilteredResult(_0xaba9ae,_0x3f06d7))['catch'](handleError(_0xaba9ae,null));};exports[_0xb4c4('0x16')]=function(_0x1ce1fe,_0x42016e){return db[_0xb4c4('0x20')][_0xb4c4('0x21')]({'where':{'id':_0x1ce1fe['params']['id']}})[_0xb4c4('0x15')](handleEntityNotFound(_0x42016e,null))[_0xb4c4('0x15')](removeEntity(_0x42016e,null))[_0xb4c4('0x22')](handleError(_0x42016e,null));};exports[_0xb4c4('0x1d')]=function(_0x22e810,_0x2835f8){return db[_0xb4c4('0x20')]['describe']()['then'](function(_0xf65af){delete _0xf65af[_0xb4c4('0x23')];for(var _0x518dd7=0x0;_0x518dd70x0){return new Promise(function(_0x42b415){var _0x474024=[];for(var _0x139c69=0x0;_0x139c69<_0x4d2912['length'];_0x139c69++){_0x474024[_0xb4c4('0x5e')](insertAdditionalPhones(_0x4d2912[_0x139c69][_0xb4c4('0x5f')],_0x4d2912[_0x139c69][_0xb4c4('0x57')]));}Promise[_0xb4c4('0x60')](_0x474024)['then'](function(){_0x42b415(0x1);});})[_0xb4c4('0x15')](function(){return{'success':_0x2b73a4,'failure':_0x5cbc9b,'duplicates':_0x1e9512};});}else{return{'success':_0x2b73a4,'failure':_0x5cbc9b,'duplicates':_0x1e9512};}}})[_0xb4c4('0x15')](respondWithResult(_0x46c20a,0xc9))[_0xb4c4('0x22')](handleError(_0x46c20a,null));};exports[_0xb4c4('0x61')]=function(_0x52f4d5,_0x4f892a){var _0xea198f;return db[_0xb4c4('0x20')][_0xb4c4('0x1d')]()['then'](function(_0x131951){return db[_0xb4c4('0x20')][_0xb4c4('0x21')]({'where':{'id':_0x52f4d5[_0xb4c4('0x62')]['id']},'include':[{'model':db[_0xb4c4('0x63')],'as':_0xb4c4('0x64'),'attributes':['id','name','color'],'required':_0x52f4d5[_0xb4c4('0x29')][_0xb4c4('0x65')]?!![]:![]},{'model':db[_0xb4c4('0x46')],'as':_0xb4c4('0x66'),'where':{'CmContactId':_0x52f4d5['params']['id']},'required':![],'include':[{'model':db[_0xb4c4('0x67')],'as':_0xb4c4('0x68')}]}],'order':[db['sequelize']['literal'](_0xb4c4('0x69'))],'attributes':_[_0xb4c4('0x24')](_0x131951)});})[_0xb4c4('0x15')](function(_0x5b579e){if(!_[_0xb4c4('0x53')](_0x5b579e)){_0xea198f=_0x5b579e[_0xb4c4('0x36')]({'plain':!![]});var _0x7e196f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5b579e&&_0x5b579e[_0xb4c4('0x5b')]){if(_0x5b579e[_0xb4c4('0x5b')]){_0x7e196f[_0xb4c4('0x59')]['$and']['push']({'ListId':{'$ne':_0x5b579e['ListId']}});}}return db['CmCustomField'][_0xb4c4('0x34')](_0x7e196f);}})['then'](function(_0x28af21){if(!_[_0xb4c4('0x53')](_0x28af21)){return _[_0xb4c4('0x6a')](_0xea198f,_[_0xb4c4('0x6b')](_0x28af21,function(_0x584ad3){return util[_0xb4c4('0x6c')](_0xb4c4('0x6d'),_0x584ad3['id']);}));}})[_0xb4c4('0x15')](handleEntityNotFound(_0x4f892a,null))[_0xb4c4('0x15')](respondWithResult(_0x4f892a,null))['catch'](handleError(_0x4f892a,null));};exports[_0xb4c4('0x3b')]=function(_0x3590f9,_0x284352){var _0x378d39;if(_0x3590f9[_0xb4c4('0x33')]['id']){delete _0x3590f9[_0xb4c4('0x33')]['id'];}if(!_['isNil'](_0x3590f9[_0xb4c4('0x33')]['dialTimezone'])){var _0x5b33e8=_0x3590f9[_0xb4c4('0x33')][_0xb4c4('0x54')];if(!_['isNil'](shared[_0xb4c4('0x55')][_0x5b33e8]))_0x3590f9[_0xb4c4('0x33')][_0xb4c4('0x56')]=shared['timezones'][_0x5b33e8][_0xb4c4('0x56')];}return db['CmContact'][_0xb4c4('0x21')]({'where':{'id':_0x3590f9[_0xb4c4('0x62')]['id']}})['then'](handleEntityNotFound(_0x284352,null))[_0xb4c4('0x15')](saveUpdates(_0x3590f9[_0xb4c4('0x33')],null))[_0xb4c4('0x15')](function(_0x2b8d42){_0x378d39=_0x2b8d42;var _0x29bf1e={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2b8d42&&_0x2b8d42[_0xb4c4('0x5b')]){if(_0x2b8d42[_0xb4c4('0x5b')]){_0x29bf1e['where'][_0xb4c4('0x6e')][_0xb4c4('0x5e')]({'ListId':{'$ne':_0x2b8d42[_0xb4c4('0x5b')]}});}}return db[_0xb4c4('0x2b')][_0xb4c4('0x34')](_0x29bf1e);})[_0xb4c4('0x15')](function(_0x364834){if(_0x364834){return _['omit'](_[_0xb4c4('0x6f')](_0x3590f9['body'],function(_0x573f41,_0x3d0a0c){return _[_0xb4c4('0x70')](_0x3d0a0c,_0xb4c4('0x26'));}),_[_0xb4c4('0x6b')](_0x364834,function(_0x219c02){return util['format']('cf_%d',_0x219c02['id']);}));}})[_0xb4c4('0x15')](function(_0x5f25c1){if(_0x5f25c1&&!_['isEmpty'](_0x5f25c1)){var _0x289977=squel[_0xb4c4('0x3b')]()[_0xb4c4('0x71')]('cm_contacts')['setFields'](_0x5f25c1)['where'](_0xb4c4('0x72'),_0x3590f9[_0xb4c4('0x62')]['id'])[_0xb4c4('0x73')]();return db[_0xb4c4('0x74')][_0xb4c4('0x29')](_0x289977[_0xb4c4('0x75')],{'replacements':_0x289977[_0xb4c4('0x2e')]});}})[_0xb4c4('0x15')](function(){if(_0x3590f9[_0xb4c4('0x33')][_0xb4c4('0x76')]&&_0x378d39){return db[_0xb4c4('0x38')][_0xb4c4('0x3b')]({'phone':_0x3590f9[_0xb4c4('0x33')][_0xb4c4('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x378d39['id']}});}})[_0xb4c4('0x15')](function(){return _0x378d39;})[_0xb4c4('0x15')](respondWithResult(_0x284352,null))['catch'](handleError(_0x284352,null));};exports['getTags']=function(_0x2d2a75,_0x79dff8){var _0x590c35={};var _0x4186b1={};var _0xc1b5ca;var _0x3016f3;return db[_0xb4c4('0x20')][_0xb4c4('0x77')]({'where':{'id':_0x2d2a75['params']['id']}})[_0xb4c4('0x15')](handleEntityNotFound(_0x79dff8,null))['then'](function(_0x3cd9b0){if(_0x3cd9b0){_0xc1b5ca=_0x3cd9b0;_0x4186b1[_0xb4c4('0x78')]=_[_0xb4c4('0x24')](db['Tag'][_0xb4c4('0x79')]);_0x4186b1[_0xb4c4('0x29')]=_['keys'](_0x2d2a75['query']);_0x4186b1[_0xb4c4('0x7a')]=_[_0xb4c4('0x7b')](_0x4186b1[_0xb4c4('0x78')],_0x4186b1[_0xb4c4('0x29')]);_0x590c35[_0xb4c4('0x7c')]=_[_0xb4c4('0x7b')](_0x4186b1['model'],qs[_0xb4c4('0x7d')](_0x2d2a75[_0xb4c4('0x29')][_0xb4c4('0x7d')]));_0x590c35['attributes']=_0x590c35[_0xb4c4('0x7c')][_0xb4c4('0x25')]?_0x590c35['attributes']:_0x4186b1[_0xb4c4('0x78')];_0x590c35[_0xb4c4('0x7e')]=qs[_0xb4c4('0x7f')](_0x2d2a75[_0xb4c4('0x29')][_0xb4c4('0x7f')]);_0x590c35[_0xb4c4('0x59')]=qs[_0xb4c4('0x7a')](_[_0xb4c4('0x80')](_0x2d2a75[_0xb4c4('0x29')],_0x4186b1[_0xb4c4('0x7a')]));if(_0x2d2a75['query'][_0xb4c4('0x81')]){_0x590c35[_0xb4c4('0x59')]=_['merge'](_0x590c35['where'],{'$or':_[_0xb4c4('0x6b')](_0x590c35[_0xb4c4('0x7c')],function(_0x490de2){var _0x1b239f={};_0x1b239f[_0x490de2]={'$like':'%'+_0x2d2a75[_0xb4c4('0x29')][_0xb4c4('0x81')]+'%'};return _0x1b239f;})});}_0x590c35=_['merge']({},_0x590c35,_0x2d2a75['options']);return _0xc1b5ca[_0xb4c4('0x82')](_0x590c35);}})[_0xb4c4('0x15')](function(_0x1af825){if(_0x1af825){_0x3016f3=_0x1af825['length'];if(!_0x2d2a75[_0xb4c4('0x29')][_0xb4c4('0x5d')]('nolimit')){_0x590c35[_0xb4c4('0x12')]=qs[_0xb4c4('0x12')](_0x2d2a75['query'][_0xb4c4('0x12')]);_0x590c35[_0xb4c4('0x83')]=qs[_0xb4c4('0x83')](_0x2d2a75['query'][_0xb4c4('0x83')]);}return _0xc1b5ca[_0xb4c4('0x82')](_0x590c35);}})[_0xb4c4('0x15')](function(_0x20bb8f){if(_0x20bb8f){return _0x20bb8f?{'count':_0x3016f3,'rows':_0x20bb8f}:null;}})[_0xb4c4('0x15')](respondWithResult(_0x79dff8,null))[_0xb4c4('0x22')](handleError(_0x79dff8,null));};exports[_0xb4c4('0x84')]=function(_0x5a53d5,_0x189a2f){if(_0x5a53d5[_0xb4c4('0x33')]['id']){delete _0x5a53d5['body']['id'];}return db[_0xb4c4('0x20')][_0xb4c4('0x77')]({'where':{'id':_0x5a53d5[_0xb4c4('0x62')]['id']}})[_0xb4c4('0x15')](handleEntityNotFound(_0x189a2f,null))[_0xb4c4('0x15')](function(_0x248cee){if(_0x248cee){return _0x248cee['setTags'](_0x5a53d5[_0xb4c4('0x33')]['ids']||[]);}return null;})[_0xb4c4('0x15')](respondWithResult(_0x189a2f,null))['catch'](handleError(_0x189a2f,null));};exports[_0xb4c4('0x85')]=function(_0x275816,_0x2af580){var _0x400896=[];_0x400896[_0xb4c4('0x5e')](addAdditionalPhones(_0x275816['body']));Promise[_0xb4c4('0x60')](_0x400896)['then'](function(){_0x400896=[];_0x400896[_0xb4c4('0x5e')](deleteCmHopperPhones(_0x275816['body']['id']));_0x400896['push'](addCmHopperPhones(_0x275816[_0xb4c4('0x33')]['id']));Promise[_0xb4c4('0x60')](_0x400896)[_0xb4c4('0x15')](function(){return[0x1];})[_0xb4c4('0x15')](respondWithResult(_0x2af580,null));});};function addAdditionalPhones(_0x1a6830){var _0x14eda2;return new Promise(function(_0x13402a){return db[_0xb4c4('0x46')]['destroy']({'where':{'CmContactId':_0x1a6830['id']}})[_0xb4c4('0x15')](function(){db['ContactItemType'][_0xb4c4('0x34')]({'raw':!![],'attributes':['id',_0xb4c4('0x86')]})[_0xb4c4('0x15')](function(_0x1528ee){var _0x52be3c=[];for(var _0x57e684=0x0;_0x57e684<_0x1a6830['items'][_0xb4c4('0x25')];_0x57e684++){var _0x34acdf=_0x1a6830[_0xb4c4('0x87')]?_[_0xb4c4('0x53')](_0x1a6830[_0xb4c4('0x87')][_0x57e684])?'':_0x1a6830['item_types'][_0x57e684]:_0x1a6830[_0xb4c4('0x88')][_0x57e684][_0xb4c4('0x89')]?_0x1a6830[_0xb4c4('0x88')][_0x57e684][_0xb4c4('0x89')]:'';var _0x1404ae=_[_0xb4c4('0x53')](_0x1a6830['items'][_0x57e684]['description'])?'':_0x1a6830[_0xb4c4('0x88')][_0x57e684][_0xb4c4('0x8a')];var _0x59cae0=_0x34acdf+':'+_0x1a6830['items'][_0x57e684][_0xb4c4('0x76')]+'§'+_0x1404ae;if(_[_0xb4c4('0x53')](_0x14eda2))_0x14eda2=_0x59cae0;else _0x14eda2+=';'+_0x59cae0;var _0x540f66=null;var _0x20cbf5=null;if(_0x1a6830['item_types']){if(!_[_0xb4c4('0x53')](_0x1a6830[_0xb4c4('0x87')][_0x57e684])){_0x20cbf5=_[_0xb4c4('0x21')](_0x1528ee,function(_0x1b43d5){return _0x1b43d5['id']===_0x1a6830[_0xb4c4('0x87')][_0x57e684];});if(!_[_0xb4c4('0x53')](_0x20cbf5)){_0x540f66=_0x20cbf5[_0xb4c4('0x86')];}}}else{if(!_[_0xb4c4('0x53')](_0x1a6830[_0xb4c4('0x88')][_0x57e684])){_0x20cbf5=_['find'](_0x1528ee,function(_0x32304e){return _0x32304e['id']===_0x1a6830[_0xb4c4('0x88')][_0x57e684][_0xb4c4('0x89')];});if(!_[_0xb4c4('0x53')](_0x20cbf5)){_0x540f66=_0x57e684;}}}if(_[_0xb4c4('0x53')](_0x540f66)){_0x540f66=0x64;}_0x52be3c[_0xb4c4('0x5e')](addAdditionalPhone(_0x1a6830['id'],_0x1a6830[_0xb4c4('0x88')][_0x57e684][_0xb4c4('0x76')],_0x1a6830[_0xb4c4('0x87')]?_[_0xb4c4('0x53')](_0x1a6830[_0xb4c4('0x87')][_0x57e684])?null:_0x1a6830[_0xb4c4('0x87')][_0x57e684]:_0x1a6830[_0xb4c4('0x88')][_0x57e684][_0xb4c4('0x89')]?_0x1a6830[_0xb4c4('0x88')][_0x57e684]['ItemTypeId']:null,_0x540f66,_0x1404ae));}Promise[_0xb4c4('0x60')](_0x52be3c)['then'](function(){db['CmContact'][_0xb4c4('0x3b')]({'AdditionalPhones':_0x14eda2},{'where':{'id':_0x1a6830['id']}})[_0xb4c4('0x15')](function(){_0x13402a(0x1);});});});});});}function addAdditionalPhone(_0x2c73eb,_0x3ea9ae,_0x275f7d,_0x165dcd,_0x2d6c32){return db[_0xb4c4('0x46')]['find']({'where':{'CmContactId':_0x2c73eb,'item':_0x3ea9ae}})[_0xb4c4('0x15')](function(_0xb5733a){if(_0xb5733a)logger['info'](_0xb4c4('0x8b'),_0xb5733a);else{db['CmContactHasItem'][_0xb4c4('0x51')]({'CmContactId':_0x2c73eb,'item':_0x3ea9ae,'ItemTypeId':_0x275f7d,'OrderBy':_0x165dcd,'ItemClass':_0xb4c4('0x8c'),'description':_0x2d6c32});}});}function deleteCmHopperPhones(_0x49c8e3){return new Promise(function(_0x5be561){return db[_0xb4c4('0x38')][_0xb4c4('0x34')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x49c8e3}})[_0xb4c4('0x15')](function(_0x48c797){db['CmHopperAdditionalPhone'][_0xb4c4('0x16')]({'where':{'CmHopperId':{'$in':_[_0xb4c4('0x6b')](_0x48c797,'id')}}});})['then'](function(){_0x5be561(0x1);});});}function addCmHopperPhones(_0x2ce8a3){return new Promise(function(_0x252c12){return db['CmHopper'][_0xb4c4('0x34')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2ce8a3}})['then'](function(_0x545da3){var _0x4060da=[];_['map'](_0x545da3,function(_0x115a16){_0x4060da['push'](createCmHopperPhone(_0x2ce8a3,_0x115a16['id']));});Promise[_0xb4c4('0x60')](_0x4060da)[_0xb4c4('0x15')](function(){_0x252c12(0x1);});});});}function createCmHopperPhone(_0x348d7e,_0x123813){return new Promise(function(_0x57085b){db[_0xb4c4('0x46')][_0xb4c4('0x34')]({'raw':!![],'attributes':[_0xb4c4('0x8d'),_0xb4c4('0x86')],'where':{'CmContactId':_0x348d7e,'ItemClass':_0xb4c4('0x8c')},'include':[{'model':db[_0xb4c4('0x67')],'attributes':[_0xb4c4('0x86')],'as':_0xb4c4('0x68')}],'order':[_0xb4c4('0x86'),db[_0xb4c4('0x74')][_0xb4c4('0x8e')]('`ItemType`.OrderBy')]})[_0xb4c4('0x15')](function(_0x28219f){var _0x26467b=0x1;var _0x184b42=_['map'](_0x28219f,function(_0x50ca49){_0x50ca49[_0xb4c4('0x8f')]=_0x123813;_0x50ca49[_0xb4c4('0x76')]=_0x50ca49[_0xb4c4('0x8d')];_0x50ca49['OrderBy']=_0x26467b;delete _0x50ca49[_0xb4c4('0x90')];_0x26467b=_0x26467b+0x1;return _0x50ca49;});return db[_0xb4c4('0x91')][_0xb4c4('0x92')](_0x184b42,{});})[_0xb4c4('0x15')](function(){_0x57085b(0x1);});});}function insertAdditionalPhones(_0x7d907d,_0x44b091){return new Promise(function(_0x328737){var _0x12f8db=[];for(var _0x5d7a10=0x0;_0x5d7a10<_0x44b091['length'];_0x5d7a10++){var _0x46b3f1=_0x44b091[_0x5d7a10];_0x12f8db[_0xb4c4('0x5e')](parseContactItemType(_0x46b3f1));}Promise['all'](_0x12f8db)[_0xb4c4('0x15')](function(){var _0x2027a2={'id':_0x7d907d['id'],'items':_0x44b091};return addAdditionalPhones(_0x2027a2)['then'](function(){return addCmHopperPhones(_0x7d907d['id']);});})[_0xb4c4('0x15')](function(){_0x328737(_0x7d907d);});});}function parseContactItemType(_0x228576){return new Promise(function(_0xe3c0bf){if(_0x228576['hasOwnProperty'](_0xb4c4('0x89'))){_0xe3c0bf(_0x228576);}else{return db[_0xb4c4('0x67')]['find']({'where':{'name':_0x228576[_0xb4c4('0x68')]}})['then'](function(_0x2fc63c){if(_[_0xb4c4('0x53')](_0x2fc63c))_0x228576[_0xb4c4('0x89')]=null;else _0x228576['ItemTypeId']=_0x2fc63c['id'];_0xe3c0bf(_0x228576);});}});}exports['getAdditionalPhones']=function(_0x3e74e7,_0x18f316){return db[_0xb4c4('0x46')][_0xb4c4('0x34')]({'raw':!![],'where':{'CmContactId':_0x3e74e7[_0xb4c4('0x62')]['id'],'ItemClass':_0xb4c4('0x8c')},'include':[{'model':db[_0xb4c4('0x67')],'as':'ItemType'}],'order':[[_0xb4c4('0x86')],[db[_0xb4c4('0x74')][_0xb4c4('0x8e')](_0xb4c4('0x93'))]]})[_0xb4c4('0x15')](function(_0x5b0352){return _0x5b0352;})['then'](respondWithResult(_0x18f316,null))[_0xb4c4('0x22')](handleError(_0x18f316,null));};exports['duplicateAdditionalPhones']=function(_0x14eb25,_0x547715){return db[_0xb4c4('0x46')][_0xb4c4('0x34')]({'raw':!![],'where':{'CmContactId':_0x14eb25[_0xb4c4('0x33')]['fromContactId']}})[_0xb4c4('0x15')](function(_0xb2369c){var _0xfccc70=_[_0xb4c4('0x6b')](_0xb2369c,function(_0x3ce307){_0x3ce307[_0xb4c4('0x94')]=_0x14eb25['body'][_0xb4c4('0x95')];return _0x3ce307;});return db[_0xb4c4('0x46')][_0xb4c4('0x92')](_0xfccc70,{});})[_0xb4c4('0x15')](function(){return addCmHopperPhones(_0x14eb25[_0xb4c4('0x33')][_0xb4c4('0x95')]);})[_0xb4c4('0x15')](function(){return['ok'];})['then'](respondWithResult(_0x547715,null))['catch'](handleError(_0x547715,null));};exports[_0xb4c4('0x96')]=function(_0x43dc83,_0x5d1cb3){var _0x2d0b7c=[];_0x2d0b7c[_0xb4c4('0x5e')](createCmHopperPhone(_0x43dc83[_0xb4c4('0x33')]['id'],_0x43dc83[_0xb4c4('0x33')][_0xb4c4('0x97')]));Promise[_0xb4c4('0x60')](_0x2d0b7c)[_0xb4c4('0x15')](function(){return[0x1];})[_0xb4c4('0x15')](respondWithResult(_0x5d1cb3,null));};exports[_0xb4c4('0x98')]=function(_0x3a9230,_0x58bfae){var _0x21f32a={'raw':![],'where':{}};var _0x524487={};var _0x2aeb8e={'count':0x0,'rows':[]};return db[_0xb4c4('0x20')][_0xb4c4('0x77')]({'where':{'id':_0x3a9230[_0xb4c4('0x62')]['id']}})[_0xb4c4('0x15')](handleEntityNotFound(_0x58bfae,null))['then'](function(_0x10a54d){if(_0x10a54d){_0x524487['model']=_['keys'](db['CmHopper'][_0xb4c4('0x79')]);_0x524487[_0xb4c4('0x29')]=_[_0xb4c4('0x24')](_0x3a9230[_0xb4c4('0x29')]);_0x524487[_0xb4c4('0x7a')]=_[_0xb4c4('0x7b')](_0x524487[_0xb4c4('0x78')],_0x524487['query']);_0x21f32a[_0xb4c4('0x7c')]=_[_0xb4c4('0x7b')](_0x524487[_0xb4c4('0x78')],qs[_0xb4c4('0x7d')](_0x3a9230['query']['fields']));_0x21f32a[_0xb4c4('0x7c')]=_0x21f32a['attributes'][_0xb4c4('0x25')]?_0x21f32a[_0xb4c4('0x7c')]:_0x524487[_0xb4c4('0x78')];if(!_0x3a9230[_0xb4c4('0x29')][_0xb4c4('0x5d')](_0xb4c4('0x99'))){_0x21f32a[_0xb4c4('0x12')]=qs['limit'](_0x3a9230['query']['limit']);_0x21f32a[_0xb4c4('0x83')]=qs[_0xb4c4('0x83')](_0x3a9230[_0xb4c4('0x29')]['offset']);}_0x21f32a[_0xb4c4('0x7e')]=qs['sort'](_0x3a9230[_0xb4c4('0x29')][_0xb4c4('0x7f')]);_0x21f32a[_0xb4c4('0x59')]=qs['filters'](_[_0xb4c4('0x80')](_0x3a9230[_0xb4c4('0x29')],_0x524487[_0xb4c4('0x7a')]));_0x21f32a[_0xb4c4('0x59')][_0xb4c4('0x9a')]=_0x10a54d['id'];if(_0x3a9230[_0xb4c4('0x29')][_0xb4c4('0x81')]){_0x21f32a[_0xb4c4('0x59')]=_['merge'](_0x21f32a[_0xb4c4('0x59')],{'$or':_[_0xb4c4('0x6b')](_0x21f32a[_0xb4c4('0x7c')],function(_0x3bc31a){var _0xecb30e={};_0xecb30e[_0x3bc31a]={'$like':'%'+_0x3a9230[_0xb4c4('0x29')][_0xb4c4('0x81')]+'%'};return _0xecb30e;})});}_0x21f32a=_[_0xb4c4('0x32')]({},_0x21f32a,_0x3a9230[_0xb4c4('0x9b')]);return db[_0xb4c4('0x38')][_0xb4c4('0x13')]({'where':_0x21f32a[_0xb4c4('0x59')]})[_0xb4c4('0x15')](function(_0x2e1e6e){_0x2aeb8e[_0xb4c4('0x13')]=_0x2e1e6e;if(_0x3a9230[_0xb4c4('0x29')][_0xb4c4('0x9c')]){_0x21f32a[_0xb4c4('0x9d')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x21f32a);})[_0xb4c4('0x15')](function(_0x39ccf7){_0x2aeb8e[_0xb4c4('0x9e')]=_0x39ccf7;return _0x2aeb8e;});}})['then'](respondWithFilteredResult(_0x58bfae,_0x21f32a))[_0xb4c4('0x22')](handleError(_0x58bfae,null));};exports['getHopperHistories']=function(_0x34c906,_0x35225b){var _0x50f9de={'raw':!![],'where':{}};var _0x5ecdca={};var _0x333203={'count':0x0,'rows':[]};return db[_0xb4c4('0x20')]['findOne']({'where':{'id':_0x34c906['params']['id']}})[_0xb4c4('0x15')](handleEntityNotFound(_0x35225b,null))[_0xb4c4('0x15')](function(_0xd0fdf2){if(_0xd0fdf2){_0x5ecdca['model']=_[_0xb4c4('0x24')](db[_0xb4c4('0x48')][_0xb4c4('0x79')]);_0x5ecdca[_0xb4c4('0x29')]=_[_0xb4c4('0x24')](_0x34c906['query']);_0x5ecdca[_0xb4c4('0x7a')]=_[_0xb4c4('0x7b')](_0x5ecdca['model'],_0x5ecdca[_0xb4c4('0x29')]);_0x50f9de[_0xb4c4('0x7c')]=_['intersection'](_0x5ecdca[_0xb4c4('0x78')],qs[_0xb4c4('0x7d')](_0x34c906[_0xb4c4('0x29')][_0xb4c4('0x7d')]));_0x50f9de['attributes']=_0x50f9de['attributes'][_0xb4c4('0x25')]?_0x50f9de[_0xb4c4('0x7c')]:_0x5ecdca['model'];if(!_0x34c906[_0xb4c4('0x29')][_0xb4c4('0x5d')](_0xb4c4('0x99'))){_0x50f9de[_0xb4c4('0x12')]=qs[_0xb4c4('0x12')](_0x34c906[_0xb4c4('0x29')][_0xb4c4('0x12')]);_0x50f9de['offset']=qs[_0xb4c4('0x83')](_0x34c906[_0xb4c4('0x29')][_0xb4c4('0x83')]);}_0x50f9de[_0xb4c4('0x7e')]=qs[_0xb4c4('0x7f')](_0x34c906[_0xb4c4('0x29')][_0xb4c4('0x7f')]);_0x50f9de[_0xb4c4('0x59')]=qs[_0xb4c4('0x7a')](_['pick'](_0x34c906[_0xb4c4('0x29')],_0x5ecdca[_0xb4c4('0x7a')]));_0x50f9de[_0xb4c4('0x59')][_0xb4c4('0x9a')]=_0xd0fdf2['id'];if(_0x34c906[_0xb4c4('0x29')][_0xb4c4('0x81')]){_0x50f9de[_0xb4c4('0x59')]=_[_0xb4c4('0x32')](_0x50f9de[_0xb4c4('0x59')],{'$or':_[_0xb4c4('0x6b')](_0x50f9de[_0xb4c4('0x7c')],function(_0x272d54){var _0x5f134c={};_0x5f134c[_0x272d54]={'$like':'%'+_0x34c906[_0xb4c4('0x29')][_0xb4c4('0x81')]+'%'};return _0x5f134c;})});}_0x50f9de=_[_0xb4c4('0x32')]({},_0x50f9de,_0x34c906[_0xb4c4('0x9b')]);return db[_0xb4c4('0x48')][_0xb4c4('0x13')]({'where':_0x50f9de[_0xb4c4('0x59')]})['then'](function(_0x155a78){_0x333203[_0xb4c4('0x13')]=_0x155a78;if(_0x34c906[_0xb4c4('0x29')][_0xb4c4('0x9c')]){_0x50f9de[_0xb4c4('0x9d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xb4c4('0x34')](_0x50f9de);})[_0xb4c4('0x15')](function(_0x21457c){_0x333203['rows']=_0x21457c;return _0x333203;});}})[_0xb4c4('0x15')](respondWithFilteredResult(_0x35225b,_0x50f9de))[_0xb4c4('0x22')](handleError(_0x35225b,null));};exports['getHopperFinals']=function(_0x39a7c0,_0x54b548){var _0xaead2a={'raw':!![],'where':{}};var _0x14e821={};var _0x39e550={'count':0x0,'rows':[]};return db[_0xb4c4('0x20')]['findOne']({'where':{'id':_0x39a7c0[_0xb4c4('0x62')]['id']}})['then'](handleEntityNotFound(_0x54b548,null))['then'](function(_0x40d5a8){if(_0x40d5a8){_0x14e821[_0xb4c4('0x78')]=_[_0xb4c4('0x24')](db[_0xb4c4('0x47')][_0xb4c4('0x79')]);_0x14e821['query']=_['keys'](_0x39a7c0['query']);_0x14e821['filters']=_['intersection'](_0x14e821[_0xb4c4('0x78')],_0x14e821[_0xb4c4('0x29')]);_0xaead2a[_0xb4c4('0x7c')]=_[_0xb4c4('0x7b')](_0x14e821[_0xb4c4('0x78')],qs[_0xb4c4('0x7d')](_0x39a7c0[_0xb4c4('0x29')][_0xb4c4('0x7d')]));_0xaead2a[_0xb4c4('0x7c')]=_0xaead2a[_0xb4c4('0x7c')][_0xb4c4('0x25')]?_0xaead2a[_0xb4c4('0x7c')]:_0x14e821[_0xb4c4('0x78')];if(!_0x39a7c0[_0xb4c4('0x29')][_0xb4c4('0x5d')](_0xb4c4('0x99'))){_0xaead2a['limit']=qs[_0xb4c4('0x12')](_0x39a7c0[_0xb4c4('0x29')][_0xb4c4('0x12')]);_0xaead2a[_0xb4c4('0x83')]=qs['offset'](_0x39a7c0[_0xb4c4('0x29')][_0xb4c4('0x83')]);}_0xaead2a[_0xb4c4('0x7e')]=qs['sort'](_0x39a7c0[_0xb4c4('0x29')][_0xb4c4('0x7f')]);_0xaead2a[_0xb4c4('0x59')]=qs[_0xb4c4('0x7a')](_['pick'](_0x39a7c0[_0xb4c4('0x29')],_0x14e821[_0xb4c4('0x7a')]));_0xaead2a[_0xb4c4('0x59')][_0xb4c4('0x9a')]=_0x40d5a8['id'];if(_0x39a7c0['query'][_0xb4c4('0x81')]){_0xaead2a[_0xb4c4('0x59')]=_[_0xb4c4('0x32')](_0xaead2a[_0xb4c4('0x59')],{'$or':_[_0xb4c4('0x6b')](_0xaead2a[_0xb4c4('0x7c')],function(_0x1b5a76){var _0x39d074={};_0x39d074[_0x1b5a76]={'$like':'%'+_0x39a7c0[_0xb4c4('0x29')][_0xb4c4('0x81')]+'%'};return _0x39d074;})});}_0xaead2a=_[_0xb4c4('0x32')]({},_0xaead2a,_0x39a7c0[_0xb4c4('0x9b')]);return db[_0xb4c4('0x47')][_0xb4c4('0x13')]({'where':_0xaead2a['where']})[_0xb4c4('0x15')](function(_0x5aafa8){_0x39e550[_0xb4c4('0x13')]=_0x5aafa8;if(_0x39a7c0[_0xb4c4('0x29')]['includeAll']){_0xaead2a['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0xaead2a);})[_0xb4c4('0x15')](function(_0xd75b75){_0x39e550['rows']=_0xd75b75;return _0x39e550;});}})['then'](respondWithFilteredResult(_0x54b548,_0xaead2a))[_0xb4c4('0x22')](handleError(_0x54b548,null));};exports['getJscriptySessions']=function(_0x4fd2cb,_0x386919){var _0x4b230f={'raw':!![],'where':{}};var _0x376cce={};var _0x5c1451={'count':0x0,'rows':[]};return db[_0xb4c4('0x20')]['findOne']({'where':{'id':_0x4fd2cb[_0xb4c4('0x62')]['id']}})['then'](handleEntityNotFound(_0x386919,null))[_0xb4c4('0x15')](function(_0x5055ee){if(_0x5055ee){_0x376cce[_0xb4c4('0x78')]=_['keys'](db['JscriptySessionReport'][_0xb4c4('0x79')]);_0x376cce[_0xb4c4('0x29')]=_['keys'](_0x4fd2cb[_0xb4c4('0x29')]);_0x376cce['filters']=_[_0xb4c4('0x7b')](_0x376cce[_0xb4c4('0x78')],_0x376cce[_0xb4c4('0x29')]);_0x4b230f[_0xb4c4('0x7c')]=_['intersection'](_0x376cce[_0xb4c4('0x78')],qs[_0xb4c4('0x7d')](_0x4fd2cb[_0xb4c4('0x29')]['fields']));_0x4b230f[_0xb4c4('0x7c')]=_0x4b230f[_0xb4c4('0x7c')][_0xb4c4('0x25')]?_0x4b230f['attributes']:_0x376cce[_0xb4c4('0x78')];if(!_0x4fd2cb['query'][_0xb4c4('0x5d')](_0xb4c4('0x99'))){_0x4b230f[_0xb4c4('0x12')]=qs[_0xb4c4('0x12')](_0x4fd2cb['query'][_0xb4c4('0x12')]);_0x4b230f[_0xb4c4('0x83')]=qs[_0xb4c4('0x83')](_0x4fd2cb[_0xb4c4('0x29')]['offset']);}_0x4b230f['order']=qs['sort'](_0x4fd2cb[_0xb4c4('0x29')][_0xb4c4('0x7f')]);_0x4b230f['where']=qs[_0xb4c4('0x7a')](_[_0xb4c4('0x80')](_0x4fd2cb[_0xb4c4('0x29')],_0x376cce[_0xb4c4('0x7a')]));_0x4b230f[_0xb4c4('0x59')][_0xb4c4('0x9a')]=_0x5055ee['id'];if(_0x4fd2cb[_0xb4c4('0x29')][_0xb4c4('0x81')]){_0x4b230f[_0xb4c4('0x59')]=_['merge'](_0x4b230f[_0xb4c4('0x59')],{'$or':_[_0xb4c4('0x6b')](_0x4b230f[_0xb4c4('0x7c')],function(_0xc1dbf9){var _0x25d17c={};_0x25d17c[_0xc1dbf9]={'$like':'%'+_0x4fd2cb[_0xb4c4('0x29')][_0xb4c4('0x81')]+'%'};return _0x25d17c;})});}_0x4b230f=_[_0xb4c4('0x32')]({},_0x4b230f,_0x4fd2cb[_0xb4c4('0x9b')]);return db[_0xb4c4('0x9f')][_0xb4c4('0x13')]({'where':_0x4b230f['where']})['then'](function(_0x42a76c){_0x5c1451[_0xb4c4('0x13')]=_0x42a76c;if(_0x4fd2cb[_0xb4c4('0x29')]['includeAll']){_0x4b230f[_0xb4c4('0x9d')]=[{'all':!![]}];}return db[_0xb4c4('0x9f')][_0xb4c4('0x34')](_0x4b230f);})[_0xb4c4('0x15')](function(_0x307ab5){_0x5c1451[_0xb4c4('0x9e')]=_0x307ab5;return _0x5c1451;});}})[_0xb4c4('0x15')](respondWithFilteredResult(_0x386919,_0x4b230f))[_0xb4c4('0x22')](handleError(_0x386919,null));};exports['uploadCsv']=function(_0x1b754c,_0x15008b){try{if(!_0x1b754c[_0xb4c4('0x33')][_0xb4c4('0x5b')]){throw new Error('No\x20ListId\x20specified');}if(!_0x1b754c[_0xb4c4('0x33')][_0xb4c4('0xa0')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x1b754c[_0xb4c4('0x33')][_0xb4c4('0xa1')]){throw new Error(_0xb4c4('0xa2'));}if(!_0x1b754c[_0xb4c4('0x33')]['socket_timestamp']){throw new Error(_0xb4c4('0xa3'));}var _0x34509d=_0x1b754c[_0xb4c4('0x33')]['binding_keys'][_0xb4c4('0xa4')](',');var _0x371347=_0x1b754c[_0xb4c4('0x33')][_0xb4c4('0xa1')][_0xb4c4('0xa4')](',');if(!_0x34509d[_0xb4c4('0x25')]||!_0x371347[_0xb4c4('0x25')]||_0x34509d['length']!==_0x371347[_0xb4c4('0x25')]){throw new Error(_0xb4c4('0xa5'));}_0x1b754c[_0xb4c4('0x33')][_0xb4c4('0x7d')]=_[_0xb4c4('0xa6')](_0x34509d,_0x371347);if(!_0x1b754c[_0xb4c4('0x33')][_0xb4c4('0x7d')][_0xb4c4('0x76')]){throw new Error(_0xb4c4('0xa7'));}if(!_0x1b754c['body'][_0xb4c4('0x7d')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x2af7e3=path[_0xb4c4('0x52')](config[_0xb4c4('0xa8')],_0xb4c4('0xa9'),_0x1b754c[_0xb4c4('0xaa')][_0xb4c4('0xab')]);fs[_0xb4c4('0xac')](_0x2af7e3,parseInt('0777',0x8));var _0x1dfc99=require('child_process')['fork'](path['join'](__dirname,_0xb4c4('0xad')),[_0x2af7e3,_0x1b754c[_0xb4c4('0x33')][_0xb4c4('0xa0')],_0x1b754c[_0xb4c4('0x33')][_0xb4c4('0xa1')],_0x1b754c[_0xb4c4('0x33')][_0xb4c4('0x5b')],_0x1b754c[_0xb4c4('0x33')][_0xb4c4('0xae')],_0x1b754c['body'][_0xb4c4('0x58')],_0x1b754c[_0xb4c4('0x33')][_0xb4c4('0xaf')]]);return _0x15008b[_0xb4c4('0xf')](0xc8)[_0xb4c4('0x10')]({'message':_0xb4c4('0xb0'),'pid':_0x1dfc99['pid']});}catch(_0x124e30){return _0x15008b[_0xb4c4('0xf')](0x1f4)[_0xb4c4('0x1b')](_0x124e30);}};exports[_0xb4c4('0xb1')]=function(_0x521edb,_0x55f52a){var _0x5c1f57=fs[_0xb4c4('0xb2')](_0x521edb[_0xb4c4('0xaa')]['path']);Papa[_0xb4c4('0xb3')](_0x5c1f57,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x70f0e1){return _0x55f52a[_0xb4c4('0xf')](0xc8)[_0xb4c4('0x10')]({'file':_0x521edb[_0xb4c4('0xaa')],'fields':_0x70f0e1['meta']['fields']});}});};exports[_0xb4c4('0xb4')]=function(_0x39b019,_0x466322){return db[_0xb4c4('0xb5')][_0xb4c4('0x34')]({'raw':!![],'attributes':['id'],'where':{'role':_0xb4c4('0xb6')}})[_0xb4c4('0x15')](function(_0x439764){var _0x13d7b5=![];if(!_0x39b019[_0xb4c4('0x33')][_0xb4c4('0x5b')]){throw new Error(_0xb4c4('0xb7'));}if(!_0x39b019[_0xb4c4('0x33')][_0xb4c4('0xb8')][_0xb4c4('0x76')]){throw new Error(_0xb4c4('0xa7'));}if(!_0x39b019[_0xb4c4('0x33')][_0xb4c4('0xb8')][_0xb4c4('0xb9')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x39b019['body'][_0xb4c4('0xaf')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x40ddbe=require(_0xb4c4('0xba'))['fork'](path['join'](__dirname,_0xb4c4('0xbb')),[_0x39b019[_0xb4c4('0x62')]['id'],JSON[_0xb4c4('0xbc')](_0x39b019['body']),JSON[_0xb4c4('0xbc')](_0x439764)]);_0x40ddbe['on'](_0xb4c4('0xbd'),function(){_0x13d7b5=!![];return _0x466322[_0xb4c4('0xf')](0xc8)[_0xb4c4('0x10')]({'message':_0xb4c4('0xbe'),'pid':_0x40ddbe[_0xb4c4('0xbf')]});});_0x40ddbe['on']('exit',function(_0x165673){if(_0x165673&&!_0x13d7b5){return _0x466322[_0xb4c4('0xf')](0x1f4)[_0xb4c4('0x10')]({'message':_0xb4c4('0xc0'),'pid':_0x40ddbe[_0xb4c4('0xbf')]});}});})['catch'](handleError(_0x466322,null));};exports[_0xb4c4('0xc1')]=function(_0x4479c6,_0x567dba){return db[_0xb4c4('0xb5')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0xb4c4('0x15')](function(_0x39689f){var _0x4d2b6d=![];if(!_0x4479c6['body']['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x4479c6[_0xb4c4('0x33')]['binding'][_0xb4c4('0x76')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x4479c6[_0xb4c4('0x33')][_0xb4c4('0xb8')][_0xb4c4('0xb9')]){throw new Error(_0xb4c4('0xc2'));}if(!_0x4479c6[_0xb4c4('0x33')][_0xb4c4('0xaf')]){throw new Error(_0xb4c4('0xa3'));}var _0x62ac9=require(_0xb4c4('0xba'))[_0xb4c4('0xc3')](path[_0xb4c4('0x52')](__dirname,_0xb4c4('0xc4')),[_0x4479c6[_0xb4c4('0x62')]['id'],JSON[_0xb4c4('0xbc')](_0x4479c6['body']),JSON[_0xb4c4('0xbc')](_0x39689f)]);_0x62ac9['on']('message',function(){_0x4d2b6d=!![];return _0x567dba[_0xb4c4('0xf')](0xc8)[_0xb4c4('0x10')]({'message':_0xb4c4('0xbe'),'pid':_0x62ac9[_0xb4c4('0xbf')]});});_0x62ac9['on'](_0xb4c4('0xc5'),function(_0x761089){if(_0x761089&&!_0x4d2b6d){return _0x567dba[_0xb4c4('0xf')](0x1f4)[_0xb4c4('0x10')]({'message':_0xb4c4('0xc0'),'pid':_0x62ac9['pid']});}});})[_0xb4c4('0x22')](handleError(_0x567dba,null));};exports[_0xb4c4('0xc6')]=function(_0x269133,_0x1b5ab5){var _0x4f99a9=['mail',_0xb4c4('0xc7'),_0xb4c4('0xc8'),_0xb4c4('0xc9'),_0xb4c4('0xca'),_0xb4c4('0xcb'),_0xb4c4('0xcc')];var _0xb7eb93={'offset':0x0,'order':qs[_0xb4c4('0x7f')](_0xb4c4('0xcd'))},_0x564554={'count':0x0,'rows':[]};Promise[_0xb4c4('0xce')]()['then'](function(){if(_0x269133[_0xb4c4('0x29')][_0xb4c4('0xcf')]){if(!_['includes'](_0x4f99a9,_0x269133[_0xb4c4('0x29')][_0xb4c4('0xcf')][_0xb4c4('0xd0')]())){throw new Error('Invalid\x20channel');}_0x4f99a9=[_0x269133[_0xb4c4('0x29')][_0xb4c4('0xcf')][_0xb4c4('0xd0')]()];}if(_0x269133['query'][_0xb4c4('0xd1')]){try{var _0x2cf337=JSON[_0xb4c4('0xb3')](_0x269133['query'][_0xb4c4('0xd1')]);if(!moment(_0x2cf337[_0xb4c4('0x35')])['isValid']()){throw new Error(_0xb4c4('0xd2'));}if(!moment(_0x2cf337['to'])[_0xb4c4('0xd3')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x21d046){throw new Error(_0xb4c4('0xd4'));}}if(!_0x269133[_0xb4c4('0x29')][_0xb4c4('0x5d')]('nolimit')){_0xb7eb93[_0xb4c4('0x12')]=qs[_0xb4c4('0x12')](_0x269133['query'][_0xb4c4('0x12')]||0xa);_0xb7eb93[_0xb4c4('0x83')]=qs[_0xb4c4('0x83')](_0x269133[_0xb4c4('0x29')][_0xb4c4('0x83')]);}var _0x186e14=_0x4f99a9[_0xb4c4('0x6b')](function(_0x4a293c){if(_0x4a293c==='voice'){var _0x41ef8d={'attributes':['id',_0xb4c4('0xd5'),_0xb4c4('0x2d'),_0xb4c4('0xd6'),_0xb4c4('0xd7'),_0xb4c4('0xd8'),_0xb4c4('0xd9'),_0xb4c4('0xda'),_0xb4c4('0xdb'),_0xb4c4('0xdc'),_0xb4c4('0xdd'),_0xb4c4('0xde'),'userSecondDisposition',_0xb4c4('0xdf'),_0xb4c4('0xe0')],'where':{'ContactId':_0x269133[_0xb4c4('0x62')]['id']},'include':[{'model':db[_0xb4c4('0xb5')],'as':_0xb4c4('0xb5'),'attributes':['id',_0xb4c4('0x1a'),'fullname',_0xb4c4('0xe1')]}],'order':[[_0xb4c4('0xdd'),'DESC']]};if(_0x269133[_0xb4c4('0x29')][_0xb4c4('0xd1')]){_0x41ef8d[_0xb4c4('0x59')][_0xb4c4('0xdd')]={'$gte':_0x2cf337['from'],'$lte':_0x2cf337['to']};}return db['VoiceCallReport'][_0xb4c4('0xe2')](_0x41ef8d)[_0xb4c4('0x15')](function(_0x459ec9){_0x564554[_0xb4c4('0x13')]+=_0x459ec9['count'];return _[_0xb4c4('0x6b')](_0x459ec9['rows'],function(_0x26249a){var _0x26a782=_0x26249a['get']({'plain':!![]});_0x26a782[_0xb4c4('0xcf')]=_0x4a293c;if(_0x26a782['User']){_0x26a782[_0xb4c4('0xb5')]={'id':_0x26a782[_0xb4c4('0xb5')]['id'],'name':_0x26a782[_0xb4c4('0xb5')][_0xb4c4('0x1a')],'fullname':_0x26a782['User'][_0xb4c4('0xe3')],'alias':_0x26a782[_0xb4c4('0xb5')][_0xb4c4('0xe1')]};}return _0x26a782;});});}else{var _0x541d91=_[_0xb4c4('0xe4')](_0x4a293c)+(_0x4a293c===_0xb4c4('0xc7')?_0xb4c4('0xe5'):_0xb4c4('0xe6'));var _0xcc9b96={'attributes':['id',_0xb4c4('0xe7'),_0xb4c4('0xe8'),_0xb4c4('0xdd'),'note','disposition',_0xb4c4('0xe9'),_0xb4c4('0xea'),_0xb4c4('0xe0'),_0x541d91+'Id'],'where':{'ContactId':_0x269133[_0xb4c4('0x62')]['id']},'include':[{'model':db[_0x541d91],'as':'Account','attributes':['id',_0xb4c4('0x1a'),'key']},{'model':db[_0xb4c4('0xb5')],'as':'Owner','attributes':['id','name',_0xb4c4('0xe3')]},{'model':db[_0xb4c4('0x63')],'as':_0xb4c4('0x64'),'attributes':['id','name',_0xb4c4('0xeb')],'through':{'attributes':[]}}],'order':[[_0xb4c4('0xdd'),'DESC']]};if(_0x269133[_0xb4c4('0x29')][_0xb4c4('0xd1')]){_0xcc9b96['where'][_0xb4c4('0xdd')]={'$gte':_0x2cf337[_0xb4c4('0x35')],'$lte':_0x2cf337['to']};}switch(_0x4a293c){case _0xb4c4('0xc7'):_0xcc9b96[_0xb4c4('0x7c')]['push'](_0xb4c4('0xec'),_0xb4c4('0xed'),_0xb4c4('0xee'),_0xb4c4('0xef'),_0xb4c4('0xf0'),_0xb4c4('0xf1'),_0xb4c4('0xf2'),'ratingValue',_0xb4c4('0xf3'));break;case _0xb4c4('0xf4'):_0xcc9b96['attributes'][_0xb4c4('0x5e')](_0xb4c4('0xf5'),'substatus');break;case _0xb4c4('0xc9'):_0xcc9b96[_0xb4c4('0x7c')]['push'](_0xb4c4('0xf6'),_0xb4c4('0xf7'));break;}return db[_[_0xb4c4('0xe4')](_0x4a293c)+_0xb4c4('0xf8')]['findAndCountAll'](_0xcc9b96)[_0xb4c4('0x15')](function(_0x147205){_0x564554[_0xb4c4('0x13')]+=_0x147205['count'];return _['map'](_0x147205['rows'],function(_0x38f93e){var _0xc15825=_0x38f93e[_0xb4c4('0x36')]({'plain':!![]});_0xc15825[_0xb4c4('0xcf')]=_0x4a293c;if(_0xc15825[_0xb4c4('0xf9')]){_0xc15825[_0xb4c4('0xf9')]={'id':_0xc15825[_0xb4c4('0xf9')]['id'],'name':_0xc15825[_0xb4c4('0xf9')][_0xb4c4('0x1a')],'fullname':_0xc15825[_0xb4c4('0xf9')]['fullname']};}return _0xc15825;});});}});return Promise['all'](_0x186e14);})[_0xb4c4('0x15')](function(_0x3c37c7){return _(_0x3c37c7)[_0xb4c4('0xfa')]()[_0xb4c4('0xfb')]('createdAt')['reverse']()['value']();})[_0xb4c4('0x15')](function(_0x4dd401){_0x564554[_0xb4c4('0x9e')]=_0xb7eb93[_0xb4c4('0x12')]?_0x4dd401['slice'](_0xb7eb93[_0xb4c4('0x83')],_0xb7eb93[_0xb4c4('0x83')]+_0xb7eb93[_0xb4c4('0x12')]):_0x4dd401;return _0x564554;})[_0xb4c4('0x15')](respondWithFilteredResult(_0x1b5ab5,_0xb7eb93))[_0xb4c4('0x22')](handleError(_0x1b5ab5,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 3c235c4..c2fad2e 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 _0xd6fb=['../../mysqldb','CmContact','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x4f6faf,_0x148286){var _0xb9736b=function(_0x3b09d8){while(--_0x3b09d8){_0x4f6faf['push'](_0x4f6faf['shift']());}};_0xb9736b(++_0x148286);}(_0xd6fb,0x13b));var _0xbd6f=function(_0x333113,_0x5bdd54){_0x333113=_0x333113-0x0;var _0x958af4=_0xd6fb[_0x333113];return _0x958af4;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xbd6f('0x0'))['db'][_0xbd6f('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xbd6f('0x2')](0x0);var events={'afterCreate':_0xbd6f('0x3'),'afterUpdate':_0xbd6f('0x4'),'afterDestroy':_0xbd6f('0x5')};function emitEvent(_0x1a52d6){return function(_0x4a1571,_0x2a2db1,_0x1151f5){CmContactEvents['emit'](_0x1a52d6+':'+_0x4a1571['id'],_0x4a1571);CmContactEvents['emit'](_0x1a52d6,_0x4a1571);_0x1151f5(null);};}for(var e in events){if(events[_0xbd6f('0x6')](e)){var event=events[e];CmContact[_0xbd6f('0x7')](e,emitEvent(event));}}module[_0xbd6f('0x8')]=CmContactEvents; \ No newline at end of file +var _0x3374=['save','emit','hasOwnProperty','hook','exports','events','CmContact','setMaxListeners'];(function(_0x30924c,_0x4a536a){var _0xac7c21=function(_0x523d5e){while(--_0x523d5e){_0x30924c['push'](_0x30924c['shift']());}};_0xac7c21(++_0x4a536a);}(_0x3374,0x13d));var _0x4337=function(_0x13df9a,_0x2ec2f8){_0x13df9a=_0x13df9a-0x0;var _0x1133c3=_0x3374[_0x13df9a];return _0x1133c3;};'use strict';var EventEmitter=require(_0x4337('0x0'));var CmContact=require('../../mysqldb')['db'][_0x4337('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x4337('0x2')](0x0);var events={'afterCreate':_0x4337('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xd0c13f){return function(_0x59207e,_0x1198ba,_0x58fb6a){CmContactEvents[_0x4337('0x4')](_0xd0c13f+':'+_0x59207e['id'],_0x59207e);CmContactEvents['emit'](_0xd0c13f,_0x59207e);_0x58fb6a(null);};}for(var e in events){if(events[_0x4337('0x5')](e)){var event=events[e];CmContact[_0x4337('0x6')](e,emitEvent(event));}}module[_0x4337('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 70bb509..4c0765c 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 _0xa885=['../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','lastName','mobile','fax','FULLTEXT','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','findOne','timezones','utcOffset','add','minutes','ret','CmHopper','then','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','findAll','outbound','Lists','length','dialCheckDuplicateType','always','onlyIfOpen','BlackLists','CmHopperBlack','message','CmList','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x15b3ed,_0x528368){var _0x3ea287=function(_0x484008){while(--_0x484008){_0x15b3ed['push'](_0x15b3ed['shift']());}};_0x3ea287(++_0x528368);}(_0xa885,0x172));var _0x5a88=function(_0x509ba3,_0x220cbe){_0x509ba3=_0x509ba3-0x0;var _0x1b59d2=_0xa885[_0x509ba3];return _0x1b59d2;};'use strict';var _=require(_0x5a88('0x0'));var util=require(_0x5a88('0x1'));var logger=require(_0x5a88('0x2'))(_0x5a88('0x3'));var moment=require(_0x5a88('0x4'));var BPromise=require(_0x5a88('0x5'));var rp=require(_0x5a88('0x6'));var fs=require('fs');var path=require(_0x5a88('0x7'));var rimraf=require(_0x5a88('0x8'));var config=require(_0x5a88('0x9'));var shared=require(_0x5a88('0xa'));var attributes=require(_0x5a88('0xb'));module[_0x5a88('0xc')]=function(_0x59757f,_0x3c8189){return _0x59757f[_0x5a88('0xd')](_0x5a88('0xe'),attributes,{'tableName':_0x5a88('0xf'),'paranoid':!![],'indexes':[{'name':_0x5a88('0x10'),'fields':[_0x5a88('0x10')]},{'name':_0x5a88('0x11'),'fields':['firstName',_0x5a88('0x12'),_0x5a88('0x10'),_0x5a88('0x13'),_0x5a88('0x14'),'email'],'type':_0x5a88('0x15')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x5a88('0x16'),'hooks':{'afterCreate':function(_0x5b79cb,_0x22a57b,_0x2a600e){var _0x3dcd6d=_0x59757f[_0x5a88('0x17')];var _0x485e02=_0x5b79cb[_0x5a88('0x18')]({'plain':!![]});function _0x17b78e(){return function(_0x5d92fc){logger[_0x5a88('0x19')](_0x5a88('0x1a'),_0x5a88('0x1b'),util[_0x5a88('0x1c')](_0x5d92fc,{'showHidden':![],'depth':null}));};}function _0x3b7c8f(_0x6977b4,_0x939dbb){var _0x6c51e4=_0x939dbb[_0x5a88('0x1d')]?_0x939dbb[_0x5a88('0x1d')]:moment()[_0x5a88('0x1e')](_0x5a88('0x1f'));return new BPromise(function(_0x1cdb54,_0x36978c){if(_[_0x5a88('0x20')](_0x939dbb[_0x5a88('0x21')])){_0x1cdb54({'ret':_0x6c51e4});}else{_0x3dcd6d['VoiceQueue'][_0x5a88('0x22')]({'where':{'id':_0x6977b4['id']}})['then'](function(_0x148269){if(!_[_0x5a88('0x20')](_0x148269)){var _0x5d9e9b=_0x148269['dialTimezone'];if(!_[_0x5a88('0x20')](_0x5d9e9b)){var _0x462b18=shared[_0x5a88('0x23')];var _0x5aee93=_0x462b18[_0x5d9e9b];var _0x124a91=_0x462b18[_0x939dbb[_0x5a88('0x21')]];if(!_['isNil'](_0x5aee93)&&!_['isNil'](_0x124a91)){var _0x44ef7d=_0x5aee93[_0x5a88('0x24')]-_0x124a91[_0x5a88('0x24')];_0x6c51e4=_0x939dbb[_0x5a88('0x1d')]?_0x939dbb[_0x5a88('0x1d')]:moment();var _0x2305eb=moment(_0x6c51e4)[_0x5a88('0x25')](_0x44ef7d,_0x5a88('0x26'));_0x1cdb54({'ret':_0x2305eb[_0x5a88('0x1e')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x1cdb54({'ret':_0x6c51e4});}else _0x1cdb54({'ret':_0x6c51e4});}else{_0x1cdb54({'ret':_0x6c51e4});}});}});return 0xa;}var _0xcc171a=function(_0x220905){return new BPromise(function(_0x19d366,_0x3f82a4){_0x3b7c8f(_0x220905,_0x485e02)['then'](function(_0xb522d2){_0x485e02[_0x5a88('0x1d')]=_0xb522d2[_0x5a88('0x27')];_0x3dcd6d[_0x5a88('0x28')][_0x5a88('0x22')]({'where':{'phone':_0x485e02[_0x5a88('0x10')],'VoiceQueueId':_0x220905['id']}})[_0x5a88('0x29')](function(_0x21ca8f){if(!_[_0x5a88('0x20')](_0x21ca8f)){throw new Error(_0x5a88('0x2a')+_0x485e02[_0x5a88('0x10')]+_0x5a88('0x2b')+_0x220905['id']);}return _0x3dcd6d[_0x5a88('0x28')][_0x5a88('0x2c')]({'phone':_0x485e02['phone'],'ContactId':_0x485e02['id'],'ListId':_0x485e02[_0x5a88('0x2d')],'priority':_0x485e02[_0x5a88('0x2e')]?_0x485e02['priority']:0x2,'scheduledat':_0x485e02[_0x5a88('0x1d')]?_0x485e02[_0x5a88('0x1d')]:moment()[_0x5a88('0x1e')](_0x5a88('0x1f')),'callback':_0x485e02['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x485e02[_0x5a88('0x2f')]?_0x485e02[_0x5a88('0x2f')]:undefined,'callbackat':_0x485e02['callbackUniqueid']?moment()[_0x5a88('0x1e')](_0x5a88('0x1f')):undefined,'VoiceQueueId':_0x220905['id']});})[_0x5a88('0x30')](function(_0x4fb9d2){_0x3f82a4(_0x4fb9d2);});});});};var _0x4b2a71=function(_0x46abb8){return new BPromise(function(_0x308314,_0x49e1e5){_0x3b7c8f(_0x46abb8,_0x485e02)[_0x5a88('0x29')](function(_0x317694){_0x485e02[_0x5a88('0x1d')]=_0x317694[_0x5a88('0x27')];_0x3dcd6d[_0x5a88('0x28')][_0x5a88('0x22')]({'where':{'phone':_0x485e02[_0x5a88('0x10')],'VoiceQueueId':_0x46abb8['id']}})[_0x5a88('0x29')](function(_0x3455a9){if(!_['isNil'](_0x3455a9)){throw new Error(_0x5a88('0x2a')+_0x485e02[_0x5a88('0x10')]+_0x5a88('0x31')+_0x46abb8['id']);}return _0x3dcd6d[_0x5a88('0x32')][_0x5a88('0x22')]({'where':{'calleridnum':_0x485e02[_0x5a88('0x10')],'VoiceQueueId':_0x46abb8['id']}});})['then'](function(_0x195e0c){if(!_['isNil'](_0x195e0c)){throw new Error(_0x5a88('0x33')+_0x485e02['phone']+_0x5a88('0x34')+_0x46abb8['id']);}return _0x3dcd6d[_0x5a88('0x28')][_0x5a88('0x2c')]({'phone':_0x485e02['phone'],'ContactId':_0x485e02['id'],'ListId':_0x485e02[_0x5a88('0x2d')],'priority':_0x485e02[_0x5a88('0x2e')]?_0x485e02[_0x5a88('0x2e')]:0x2,'scheduledat':_0x485e02[_0x5a88('0x1d')]?_0x485e02[_0x5a88('0x1d')]:moment()['format'](_0x5a88('0x1f')),'callback':_0x485e02[_0x5a88('0x2f')]?!![]:![],'callbackuniqueid':_0x485e02[_0x5a88('0x2f')]?_0x485e02['callbackUniqueid']:undefined,'callbackat':_0x485e02[_0x5a88('0x2f')]?moment()[_0x5a88('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x46abb8['id']});})['catch'](function(_0x5ddc6e){_0x49e1e5(_0x5ddc6e);});});});};function _0x23b6b6(){return function(_0x4e0537){logger[_0x5a88('0x19')](_0x5a88('0x1a'),'afterCreate',util[_0x5a88('0x1c')](_0x4e0537,{'showHidden':![],'depth':null}));};}function _0x5783da(_0x138408,_0x2a76e9){var _0x2ff930=_0x2a76e9['scheduledat']?_0x2a76e9[_0x5a88('0x1d')]:moment()['format'](_0x5a88('0x1f'));return new BPromise(function(_0x2b21c4,_0xeb7dac){if(_[_0x5a88('0x20')](_0x2a76e9['dialTimezone'])){_0x2b21c4({'ret':_0x2ff930});}else{_0x3dcd6d[_0x5a88('0x35')][_0x5a88('0x22')]({'where':{'id':_0x138408['id']}})[_0x5a88('0x29')](function(_0x23b035){if(!_[_0x5a88('0x20')](_0x23b035)){var _0x3c8997=_0x23b035[_0x5a88('0x21')];if(!_[_0x5a88('0x20')](_0x3c8997)){var _0x365dd2=shared[_0x5a88('0x23')];var _0x4fcec5=_0x365dd2[_0x3c8997];var _0x400ef6=_0x365dd2[_0x2a76e9[_0x5a88('0x21')]];if(!_[_0x5a88('0x20')](_0x4fcec5)&&!_[_0x5a88('0x20')](_0x400ef6)){var _0x33aeec=_0x4fcec5[_0x5a88('0x24')]-_0x400ef6[_0x5a88('0x24')];_0x2ff930=_0x2a76e9[_0x5a88('0x1d')]?_0x2a76e9[_0x5a88('0x1d')]:moment();var _0x4d3fbe=moment(_0x2ff930)[_0x5a88('0x25')](_0x33aeec,_0x5a88('0x26'));_0x2b21c4({'ret':_0x4d3fbe[_0x5a88('0x1e')](_0x5a88('0x1f'))});}else _0x2b21c4({'ret':_0x2ff930});}else _0x2b21c4({'ret':_0x2ff930});}else{_0x2b21c4({'ret':_0x2ff930});}});}});return 0xa;}var _0x351125=function(_0x103f49){return new BPromise(function(_0x214312,_0xfe89b4){_0x5783da(_0x103f49,_0x485e02)[_0x5a88('0x29')](function(_0x222e5e){_0x485e02[_0x5a88('0x1d')]=_0x222e5e[_0x5a88('0x27')];_0x3dcd6d[_0x5a88('0x28')]['findOne']({'where':{'phone':_0x485e02['phone'],'CampaignId':_0x103f49['id']}})['then'](function(_0x5d5a62){if(!_[_0x5a88('0x20')](_0x5d5a62)){throw new Error(_0x5a88('0x2a')+_0x485e02[_0x5a88('0x10')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x103f49['id']);}return _0x3dcd6d[_0x5a88('0x28')][_0x5a88('0x2c')]({'phone':_0x485e02[_0x5a88('0x10')],'ContactId':_0x485e02['id'],'ListId':_0x485e02[_0x5a88('0x2d')],'priority':_0x485e02[_0x5a88('0x2e')]?_0x485e02[_0x5a88('0x2e')]:0x2,'scheduledat':_0x485e02[_0x5a88('0x1d')]?_0x485e02[_0x5a88('0x1d')]:moment()[_0x5a88('0x1e')](_0x5a88('0x1f')),'callback':_0x485e02[_0x5a88('0x2f')]?!![]:![],'callbackuniqueid':_0x485e02[_0x5a88('0x2f')]?_0x485e02[_0x5a88('0x2f')]:undefined,'callbackat':_0x485e02[_0x5a88('0x2f')]?moment()[_0x5a88('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x103f49['id']});})['catch'](function(_0x234d0e){_0xfe89b4(_0x234d0e);});});});};var _0x3dee78=function(_0x32b794){return new BPromise(function(_0x4cfe15,_0x49a428){_0x5783da(_0x32b794,_0x485e02)[_0x5a88('0x29')](function(_0x4e3359){_0x485e02['scheduledat']=_0x4e3359[_0x5a88('0x27')];_0x3dcd6d[_0x5a88('0x28')]['findOne']({'where':{'phone':_0x485e02[_0x5a88('0x10')],'CampaignId':_0x32b794['id']}})[_0x5a88('0x29')](function(_0x2de154){if(!_['isNil'](_0x2de154)){throw new Error(_0x5a88('0x2a')+_0x485e02[_0x5a88('0x10')]+_0x5a88('0x36')+_0x32b794['id']);}return _0x3dcd6d[_0x5a88('0x32')][_0x5a88('0x22')]({'where':{'calleridnum':_0x485e02['phone'],'CampaignId':_0x32b794['id']}});})[_0x5a88('0x29')](function(_0x5283bc){if(!_['isNil'](_0x5283bc)){throw new Error(_0x5a88('0x33')+_0x485e02[_0x5a88('0x10')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x32b794['id']);}return _0x3dcd6d['CmHopper']['create']({'phone':_0x485e02[_0x5a88('0x10')],'ContactId':_0x485e02['id'],'ListId':_0x485e02['ListId'],'priority':_0x485e02[_0x5a88('0x2e')]?_0x485e02['priority']:0x2,'scheduledat':_0x485e02['scheduledat']?_0x485e02[_0x5a88('0x1d')]:moment()[_0x5a88('0x1e')](_0x5a88('0x1f')),'callback':_0x485e02[_0x5a88('0x2f')]?!![]:![],'callbackuniqueid':_0x485e02[_0x5a88('0x2f')]?_0x485e02[_0x5a88('0x2f')]:undefined,'callbackat':_0x485e02['callbackUniqueid']?moment()[_0x5a88('0x1e')](_0x5a88('0x1f')):undefined,'CampaignId':_0x32b794['id']});})[_0x5a88('0x30')](function(_0x5d926c){_0x49a428(_0x5d926c);});});});};if(_0x485e02[_0x5a88('0x2d')]){_0x3dcd6d['VoiceQueue'][_0x5a88('0x37')]({'where':{'type':_0x5a88('0x38')},'attributes':['id','dialCheckDuplicateType',_0x5a88('0x21')],'include':[{'model':_0x3dcd6d['CmList'],'as':_0x5a88('0x39'),'where':{'id':_0x485e02[_0x5a88('0x2d')]}}]})[_0x5a88('0x29')](function(_0xf82063){if(_0xf82063){var _0x47895b=[];for(var _0x29d251=0x0,_0x40b91e;_0x29d251<_0xf82063[_0x5a88('0x3a')];_0x29d251+=0x1){_0x40b91e=_0xf82063[_0x29d251]['get']({'plain':!![]});switch(_0x40b91e[_0x5a88('0x3b')]){case _0x5a88('0x3c'):_0x4b2a71(_0x40b91e)['catch'](_0x17b78e());break;case _0x5a88('0x3d'):_0xcc171a(_0x40b91e)[_0x5a88('0x30')](_0x17b78e());break;default:_0x5783da(_0x40b91e,_0x485e02)[_0x5a88('0x29')](function(_0x2a926d){_0x485e02['scheduledat']=_0x2a926d[_0x5a88('0x27')];_0x3dcd6d[_0x5a88('0x28')]['create']({'phone':_0x485e02[_0x5a88('0x10')],'ContactId':_0x485e02['id'],'ListId':_0x485e02['ListId'],'scheduledat':_0x485e02[_0x5a88('0x1d')]?_0x485e02['scheduledat']:moment()[_0x5a88('0x1e')](_0x5a88('0x1f')),'priority':_0x485e02['priority']?_0x485e02[_0x5a88('0x2e')]:0x2,'callback':_0x485e02[_0x5a88('0x2f')]?!![]:![],'callbackuniqueid':_0x485e02[_0x5a88('0x2f')]?_0x485e02['callbackUniqueid']:undefined,'callbackat':_0x485e02['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x40b91e['id']})['catch'](_0x17b78e());});}}}})['then'](function(){return _0x3dcd6d['VoiceQueue'][_0x5a88('0x37')]({'where':{'type':_0x5a88('0x38')},'attributes':['id'],'include':[{'model':_0x3dcd6d['CmList'],'as':_0x5a88('0x3e'),'where':{'id':_0x485e02['ListId']}}]})[_0x5a88('0x29')](function(_0xfe1873){if(_0xfe1873){var _0x3c8cc3=[];for(var _0x3266a0=0x0,_0x19e676;_0x3266a0<_0xfe1873[_0x5a88('0x3a')];_0x3266a0+=0x1){_0x19e676=_0xfe1873[_0x3266a0][_0x5a88('0x18')]({'plain':!![]});_0x3dcd6d[_0x5a88('0x3f')]['create']({'phone':_0x485e02[_0x5a88('0x10')],'ContactId':_0x485e02['id'],'ListId':_0x485e02[_0x5a88('0x2d')],'VoiceQueueId':_0x19e676['id']})[_0x5a88('0x30')](function(_0x550f34){logger['error']('cmContact,\x20%s,\x20%s','afterCreate',_0x550f34[_0x5a88('0x40')]);});}}});})[_0x5a88('0x29')](function(){return _0x3dcd6d[_0x5a88('0x35')][_0x5a88('0x37')]({'attributes':['id',_0x5a88('0x3b'),'dialTimezone'],'include':[{'model':_0x3dcd6d[_0x5a88('0x41')],'as':'Lists','where':{'id':_0x485e02[_0x5a88('0x2d')]}}]})[_0x5a88('0x29')](function(_0x29e3cd){if(_0x29e3cd){var _0x39f86b=[];for(var _0x31f579=0x0,_0x5a9b1d;_0x31f579<_0x29e3cd['length'];_0x31f579+=0x1){_0x5a9b1d=_0x29e3cd[_0x31f579]['get']({'plain':!![]});switch(_0x5a9b1d[_0x5a88('0x3b')]){case _0x5a88('0x3c'):_0x3dee78(_0x5a9b1d)[_0x5a88('0x30')](_0x23b6b6());break;case'onlyIfOpen':_0x351125(_0x5a9b1d)[_0x5a88('0x30')](_0x23b6b6());break;default:_0x3dcd6d['CmHopper'][_0x5a88('0x2c')]({'phone':_0x485e02[_0x5a88('0x10')],'ContactId':_0x485e02['id'],'ListId':_0x485e02['ListId'],'scheduledat':_0x485e02[_0x5a88('0x1d')]?_0x485e02[_0x5a88('0x1d')]:moment()['format'](_0x5a88('0x1f')),'priority':_0x485e02[_0x5a88('0x2e')]?_0x485e02['priority']:0x2,'callback':_0x485e02[_0x5a88('0x2f')]?!![]:![],'callbackuniqueid':_0x485e02['callbackUniqueid']?_0x485e02[_0x5a88('0x2f')]:undefined,'callbackat':_0x485e02['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x5a9b1d['id']})['catch'](_0x23b6b6());}}}});})['then'](function(){return _0x3dcd6d[_0x5a88('0x35')]['findAll']({'attributes':['id'],'include':[{'model':_0x3dcd6d[_0x5a88('0x41')],'as':_0x5a88('0x3e'),'where':{'id':_0x485e02[_0x5a88('0x2d')]}}]})[_0x5a88('0x29')](function(_0x4bbf51){if(_0x4bbf51){var _0x552e32=[];for(var _0x4496f4=0x0,_0x105aa7;_0x4496f4<_0x4bbf51['length'];_0x4496f4+=0x1){_0x105aa7=_0x4bbf51[_0x4496f4]['get']({'plain':!![]});_0x3dcd6d[_0x5a88('0x3f')][_0x5a88('0x2c')]({'phone':_0x485e02['phone'],'ContactId':_0x485e02['id'],'ListId':_0x485e02[_0x5a88('0x2d')],'CampaignId':_0x105aa7['id']})[_0x5a88('0x30')](function(_0x339ae1){logger[_0x5a88('0x19')](_0x5a88('0x42'),'afterCreate',_0x339ae1[_0x5a88('0x40')]);});}}});})[_0x5a88('0x29')](function(){_0x2a600e();})[_0x5a88('0x30')](function(_0x5531d4){logger[_0x5a88('0x19')](_0x5a88('0x42'),_0x5a88('0x1b'),_0x5531d4[_0x5a88('0x40')]);_0x2a600e(_0x5531d4);});}else{_0x2a600e(new Error(_0x5a88('0x43')));}},'afterDestroy':function(_0x57fa2f,_0x31d3fc,_0x13560){var _0x743f9c=_0x59757f['models'];var _0x1eb815=_0x57fa2f[_0x5a88('0x18')]({'plain':!![]});return _0x743f9c[_0x5a88('0x28')]['findAll']({'raw':!![],'where':{'ListId':_0x1eb815[_0x5a88('0x2d')],'ContactId':_0x1eb815['id']}})[_0x5a88('0x29')](function(_0x10c7dc){if(!_[_0x5a88('0x44')](_0x10c7dc)){var _0x5aa521=[];for(var _0x9e0bb6=0x0;_0x9e0bb6<_0x10c7dc[_0x5a88('0x3a')];_0x9e0bb6+=0x1){var _0x5151f0=_0x743f9c['CmHopper'][_0x5a88('0x45')]({'where':{'ListId':_0x10c7dc[_0x9e0bb6]['ListId'],'ContactId':_0x10c7dc[_0x9e0bb6][_0x5a88('0x46')],'VoiceQueueId':_0x10c7dc[_0x9e0bb6][_0x5a88('0x47')],'CampaignId':_0x10c7dc[_0x9e0bb6]['CampaignId']}});_0x5aa521[_0x5a88('0x48')](_0x5151f0);}return BPromise[_0x5a88('0x49')](_0x5aa521);}})[_0x5a88('0x29')](function(_0x452cd7){logger[_0x5a88('0x4a')](_0x5a88('0x4b'),util[_0x5a88('0x1c')](_0x452cd7,{'showHidden':![],'depth':null}));_0x13560();})[_0x5a88('0x30')](function(_0xa61e0a){logger[_0x5a88('0x19')]('[CmContact][afterDestroy][Error]',util[_0x5a88('0x1c')](_0xa61e0a,{'showHidden':![],'depth':null}));_0x13560(_0xa61e0a);});}}});}; \ No newline at end of file +var _0xc993=['inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','VoiceQueue','then','isNil','timezones','utcOffset','add','minutes','format','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','findOne','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','afterCreate','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','length','always','BlackLists','CmHopperBlack','message','Lists','onlyIfOpen','cmContact,\x20%s,\x20%s','destroy','ContactId','VoiceQueueId','CampaignId','push','all','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','api','moment','bluebird','request-promise','path','exports','define','CmContact','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','utf8mb4_unicode_ci','models','get','error','cmContact'];(function(_0x136a0d,_0x476fe2){var _0x212ea5=function(_0xa288e){while(--_0xa288e){_0x136a0d['push'](_0x136a0d['shift']());}};_0x212ea5(++_0x476fe2);}(_0xc993,0x77));var _0x3c99=function(_0x13c6e0,_0x404982){_0x13c6e0=_0x13c6e0-0x0;var _0x58ab38=_0xc993[_0x13c6e0];return _0x58ab38;};'use strict';var _=require(_0x3c99('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3c99('0x1'));var moment=require(_0x3c99('0x2'));var BPromise=require(_0x3c99('0x3'));var rp=require(_0x3c99('0x4'));var fs=require('fs');var path=require(_0x3c99('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var shared=require('../../config/environment/shared');var attributes=require('./cmContact.attributes');module[_0x3c99('0x6')]=function(_0x15443b,_0x51cfb5){return _0x15443b[_0x3c99('0x7')](_0x3c99('0x8'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x3c99('0x9'),'fields':[_0x3c99('0x9')]},{'name':_0x3c99('0xa'),'fields':[_0x3c99('0xb'),_0x3c99('0xc'),'phone',_0x3c99('0xd'),_0x3c99('0xe'),_0x3c99('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'charset':'utf8mb4','collate':_0x3c99('0x10'),'hooks':{'afterCreate':function(_0x359985,_0x1a6152,_0x400427){var _0x58b171=_0x15443b[_0x3c99('0x11')];var _0x2c08e3=_0x359985[_0x3c99('0x12')]({'plain':!![]});function _0x22c8a2(){return function(_0xee9214){logger[_0x3c99('0x13')](_0x3c99('0x14'),'afterCreate',util[_0x3c99('0x15')](_0xee9214,{'showHidden':![],'depth':null}));};}function _0x41de35(_0x29c383,_0x2db31e){var _0x5ded87=_0x2db31e[_0x3c99('0x16')]?_0x2db31e[_0x3c99('0x16')]:moment()['format'](_0x3c99('0x17'));return new BPromise(function(_0x48d156,_0xdcb6c7){if(_['isNil'](_0x2db31e[_0x3c99('0x18')])){_0x48d156({'ret':_0x5ded87});}else{_0x58b171[_0x3c99('0x19')]['findOne']({'where':{'id':_0x29c383['id']}})[_0x3c99('0x1a')](function(_0x3b73db){if(!_[_0x3c99('0x1b')](_0x3b73db)){var _0x5bb60d=_0x3b73db[_0x3c99('0x18')];if(!_[_0x3c99('0x1b')](_0x5bb60d)){var _0x50fe34=shared[_0x3c99('0x1c')];var _0x4010d1=_0x50fe34[_0x5bb60d];var _0x2e89a6=_0x50fe34[_0x2db31e['dialTimezone']];if(!_['isNil'](_0x4010d1)&&!_[_0x3c99('0x1b')](_0x2e89a6)){var _0x5e7666=_0x4010d1[_0x3c99('0x1d')]-_0x2e89a6['utcOffset'];_0x5ded87=_0x2db31e[_0x3c99('0x16')]?_0x2db31e[_0x3c99('0x16')]:moment();var _0x512785=moment(_0x5ded87)[_0x3c99('0x1e')](_0x5e7666,_0x3c99('0x1f'));_0x48d156({'ret':_0x512785[_0x3c99('0x20')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x48d156({'ret':_0x5ded87});}else _0x48d156({'ret':_0x5ded87});}else{_0x48d156({'ret':_0x5ded87});}});}});return 0xa;}var _0x44b698=function(_0x4e095e){return new BPromise(function(_0x1515ed,_0x2971ff){_0x41de35(_0x4e095e,_0x2c08e3)[_0x3c99('0x1a')](function(_0x419311){_0x2c08e3[_0x3c99('0x16')]=_0x419311[_0x3c99('0x21')];_0x58b171['CmHopper']['findOne']({'where':{'phone':_0x2c08e3[_0x3c99('0x9')],'VoiceQueueId':_0x4e095e['id']}})[_0x3c99('0x1a')](function(_0x1148eb){if(!_[_0x3c99('0x1b')](_0x1148eb)){throw new Error(_0x3c99('0x22')+_0x2c08e3[_0x3c99('0x9')]+_0x3c99('0x23')+_0x4e095e['id']);}return _0x58b171[_0x3c99('0x24')][_0x3c99('0x25')]({'phone':_0x2c08e3[_0x3c99('0x9')],'ContactId':_0x2c08e3['id'],'ListId':_0x2c08e3[_0x3c99('0x26')],'priority':_0x2c08e3[_0x3c99('0x27')]?_0x2c08e3[_0x3c99('0x27')]:0x2,'scheduledat':_0x2c08e3[_0x3c99('0x16')]?_0x2c08e3[_0x3c99('0x16')]:moment()[_0x3c99('0x20')](_0x3c99('0x17')),'callback':_0x2c08e3['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2c08e3[_0x3c99('0x28')]?_0x2c08e3[_0x3c99('0x28')]:undefined,'callbackat':_0x2c08e3['callbackUniqueid']?moment()[_0x3c99('0x20')](_0x3c99('0x17')):undefined,'VoiceQueueId':_0x4e095e['id']});})[_0x3c99('0x29')](function(_0x43cf1a){_0x2971ff(_0x43cf1a);});});});};var _0x43c152=function(_0x150d24){return new BPromise(function(_0xbb4a99,_0x1100de){_0x41de35(_0x150d24,_0x2c08e3)['then'](function(_0x56182d){_0x2c08e3[_0x3c99('0x16')]=_0x56182d['ret'];_0x58b171['CmHopper']['findOne']({'where':{'phone':_0x2c08e3[_0x3c99('0x9')],'VoiceQueueId':_0x150d24['id']}})[_0x3c99('0x1a')](function(_0x1501fe){if(!_[_0x3c99('0x1b')](_0x1501fe)){throw new Error(_0x3c99('0x22')+_0x2c08e3[_0x3c99('0x9')]+_0x3c99('0x2a')+_0x150d24['id']);}return _0x58b171[_0x3c99('0x2b')][_0x3c99('0x2c')]({'where':{'calleridnum':_0x2c08e3[_0x3c99('0x9')],'VoiceQueueId':_0x150d24['id']}});})['then'](function(_0x3e50f0){if(!_[_0x3c99('0x1b')](_0x3e50f0)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x2c08e3[_0x3c99('0x9')]+_0x3c99('0x2d')+_0x150d24['id']);}return _0x58b171[_0x3c99('0x24')]['create']({'phone':_0x2c08e3[_0x3c99('0x9')],'ContactId':_0x2c08e3['id'],'ListId':_0x2c08e3[_0x3c99('0x26')],'priority':_0x2c08e3[_0x3c99('0x27')]?_0x2c08e3[_0x3c99('0x27')]:0x2,'scheduledat':_0x2c08e3[_0x3c99('0x16')]?_0x2c08e3['scheduledat']:moment()[_0x3c99('0x20')](_0x3c99('0x17')),'callback':_0x2c08e3[_0x3c99('0x28')]?!![]:![],'callbackuniqueid':_0x2c08e3[_0x3c99('0x28')]?_0x2c08e3[_0x3c99('0x28')]:undefined,'callbackat':_0x2c08e3[_0x3c99('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x150d24['id']});})['catch'](function(_0x270091){_0x1100de(_0x270091);});});});};function _0x1c160f(){return function(_0xa20e7a){logger[_0x3c99('0x13')](_0x3c99('0x14'),_0x3c99('0x2e'),util[_0x3c99('0x15')](_0xa20e7a,{'showHidden':![],'depth':null}));};}function _0x9c5cb9(_0x5078d2,_0x3ca6f9){var _0x538cf9=_0x3ca6f9[_0x3c99('0x16')]?_0x3ca6f9[_0x3c99('0x16')]:moment()[_0x3c99('0x20')](_0x3c99('0x17'));return new BPromise(function(_0x7e1e26,_0x41ffaf){if(_[_0x3c99('0x1b')](_0x3ca6f9['dialTimezone'])){_0x7e1e26({'ret':_0x538cf9});}else{_0x58b171[_0x3c99('0x2f')]['findOne']({'where':{'id':_0x5078d2['id']}})['then'](function(_0x28b22e){if(!_[_0x3c99('0x1b')](_0x28b22e)){var _0x8de37a=_0x28b22e[_0x3c99('0x18')];if(!_[_0x3c99('0x1b')](_0x8de37a)){var _0x22f2a3=shared[_0x3c99('0x1c')];var _0x563500=_0x22f2a3[_0x8de37a];var _0x132f51=_0x22f2a3[_0x3ca6f9[_0x3c99('0x18')]];if(!_[_0x3c99('0x1b')](_0x563500)&&!_[_0x3c99('0x1b')](_0x132f51)){var _0x32fd27=_0x563500[_0x3c99('0x1d')]-_0x132f51['utcOffset'];_0x538cf9=_0x3ca6f9['scheduledat']?_0x3ca6f9[_0x3c99('0x16')]:moment();var _0x45492a=moment(_0x538cf9)[_0x3c99('0x1e')](_0x32fd27,_0x3c99('0x1f'));_0x7e1e26({'ret':_0x45492a[_0x3c99('0x20')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x7e1e26({'ret':_0x538cf9});}else _0x7e1e26({'ret':_0x538cf9});}else{_0x7e1e26({'ret':_0x538cf9});}});}});return 0xa;}var _0x1d384f=function(_0x5f5ba8){return new BPromise(function(_0x4f1248,_0x85a122){_0x9c5cb9(_0x5f5ba8,_0x2c08e3)['then'](function(_0x197515){_0x2c08e3[_0x3c99('0x16')]=_0x197515['ret'];_0x58b171[_0x3c99('0x24')][_0x3c99('0x2c')]({'where':{'phone':_0x2c08e3['phone'],'CampaignId':_0x5f5ba8['id']}})[_0x3c99('0x1a')](function(_0x3e0268){if(!_[_0x3c99('0x1b')](_0x3e0268)){throw new Error('cmContact,\x20afterCreate\x20'+_0x2c08e3['phone']+_0x3c99('0x30')+_0x5f5ba8['id']);}return _0x58b171[_0x3c99('0x24')]['create']({'phone':_0x2c08e3['phone'],'ContactId':_0x2c08e3['id'],'ListId':_0x2c08e3['ListId'],'priority':_0x2c08e3[_0x3c99('0x27')]?_0x2c08e3[_0x3c99('0x27')]:0x2,'scheduledat':_0x2c08e3[_0x3c99('0x16')]?_0x2c08e3[_0x3c99('0x16')]:moment()[_0x3c99('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2c08e3[_0x3c99('0x28')]?!![]:![],'callbackuniqueid':_0x2c08e3[_0x3c99('0x28')]?_0x2c08e3[_0x3c99('0x28')]:undefined,'callbackat':_0x2c08e3[_0x3c99('0x28')]?moment()[_0x3c99('0x20')](_0x3c99('0x17')):undefined,'CampaignId':_0x5f5ba8['id']});})[_0x3c99('0x29')](function(_0x229c47){_0x85a122(_0x229c47);});});});};var _0x486614=function(_0x20cf90){return new BPromise(function(_0x192f64,_0x22ac7c){_0x9c5cb9(_0x20cf90,_0x2c08e3)[_0x3c99('0x1a')](function(_0x4da236){_0x2c08e3[_0x3c99('0x16')]=_0x4da236[_0x3c99('0x21')];_0x58b171[_0x3c99('0x24')][_0x3c99('0x2c')]({'where':{'phone':_0x2c08e3[_0x3c99('0x9')],'CampaignId':_0x20cf90['id']}})['then'](function(_0x4d9da9){if(!_[_0x3c99('0x1b')](_0x4d9da9)){throw new Error(_0x3c99('0x22')+_0x2c08e3[_0x3c99('0x9')]+_0x3c99('0x31')+_0x20cf90['id']);}return _0x58b171['CmHopperFinal'][_0x3c99('0x2c')]({'where':{'calleridnum':_0x2c08e3[_0x3c99('0x9')],'CampaignId':_0x20cf90['id']}});})[_0x3c99('0x1a')](function(_0x531313){if(!_['isNil'](_0x531313)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x2c08e3[_0x3c99('0x9')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x20cf90['id']);}return _0x58b171[_0x3c99('0x24')][_0x3c99('0x25')]({'phone':_0x2c08e3[_0x3c99('0x9')],'ContactId':_0x2c08e3['id'],'ListId':_0x2c08e3[_0x3c99('0x26')],'priority':_0x2c08e3[_0x3c99('0x27')]?_0x2c08e3[_0x3c99('0x27')]:0x2,'scheduledat':_0x2c08e3['scheduledat']?_0x2c08e3[_0x3c99('0x16')]:moment()['format'](_0x3c99('0x17')),'callback':_0x2c08e3['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2c08e3[_0x3c99('0x28')]?_0x2c08e3['callbackUniqueid']:undefined,'callbackat':_0x2c08e3[_0x3c99('0x28')]?moment()[_0x3c99('0x20')](_0x3c99('0x17')):undefined,'CampaignId':_0x20cf90['id']});})[_0x3c99('0x29')](function(_0x2a1c7e){_0x22ac7c(_0x2a1c7e);});});});};if(_0x2c08e3[_0x3c99('0x26')]){_0x58b171[_0x3c99('0x19')][_0x3c99('0x32')]({'where':{'type':_0x3c99('0x33')},'attributes':['id',_0x3c99('0x34'),_0x3c99('0x18')],'include':[{'model':_0x58b171[_0x3c99('0x35')],'as':'Lists','where':{'id':_0x2c08e3[_0x3c99('0x26')]}}]})[_0x3c99('0x1a')](function(_0x51a35b){if(_0x51a35b){var _0x44e041=[];for(var _0x1d02a0=0x0,_0x684dc4;_0x1d02a0<_0x51a35b[_0x3c99('0x36')];_0x1d02a0+=0x1){_0x684dc4=_0x51a35b[_0x1d02a0][_0x3c99('0x12')]({'plain':!![]});switch(_0x684dc4[_0x3c99('0x34')]){case _0x3c99('0x37'):_0x43c152(_0x684dc4)[_0x3c99('0x29')](_0x22c8a2());break;case'onlyIfOpen':_0x44b698(_0x684dc4)[_0x3c99('0x29')](_0x22c8a2());break;default:_0x9c5cb9(_0x684dc4,_0x2c08e3)[_0x3c99('0x1a')](function(_0x4d1e06){_0x2c08e3[_0x3c99('0x16')]=_0x4d1e06[_0x3c99('0x21')];_0x58b171[_0x3c99('0x24')]['create']({'phone':_0x2c08e3[_0x3c99('0x9')],'ContactId':_0x2c08e3['id'],'ListId':_0x2c08e3['ListId'],'scheduledat':_0x2c08e3[_0x3c99('0x16')]?_0x2c08e3[_0x3c99('0x16')]:moment()[_0x3c99('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x2c08e3[_0x3c99('0x27')]?_0x2c08e3[_0x3c99('0x27')]:0x2,'callback':_0x2c08e3['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2c08e3[_0x3c99('0x28')]?_0x2c08e3[_0x3c99('0x28')]:undefined,'callbackat':_0x2c08e3['callbackUniqueid']?moment()[_0x3c99('0x20')](_0x3c99('0x17')):undefined,'VoiceQueueId':_0x684dc4['id']})['catch'](_0x22c8a2());});}}}})[_0x3c99('0x1a')](function(){return _0x58b171[_0x3c99('0x19')][_0x3c99('0x32')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x58b171[_0x3c99('0x35')],'as':_0x3c99('0x38'),'where':{'id':_0x2c08e3['ListId']}}]})[_0x3c99('0x1a')](function(_0x533f7b){if(_0x533f7b){var _0x2ebace=[];for(var _0x4cc863=0x0,_0x36827b;_0x4cc863<_0x533f7b['length'];_0x4cc863+=0x1){_0x36827b=_0x533f7b[_0x4cc863][_0x3c99('0x12')]({'plain':!![]});_0x58b171[_0x3c99('0x39')][_0x3c99('0x25')]({'phone':_0x2c08e3['phone'],'ContactId':_0x2c08e3['id'],'ListId':_0x2c08e3['ListId'],'VoiceQueueId':_0x36827b['id']})[_0x3c99('0x29')](function(_0x2f95c8){logger[_0x3c99('0x13')]('cmContact,\x20%s,\x20%s',_0x3c99('0x2e'),_0x2f95c8[_0x3c99('0x3a')]);});}}});})[_0x3c99('0x1a')](function(){return _0x58b171['Campaign'][_0x3c99('0x32')]({'attributes':['id',_0x3c99('0x34'),'dialTimezone'],'include':[{'model':_0x58b171[_0x3c99('0x35')],'as':_0x3c99('0x3b'),'where':{'id':_0x2c08e3[_0x3c99('0x26')]}}]})['then'](function(_0x1952fd){if(_0x1952fd){var _0xa9b1=[];for(var _0x3eb500=0x0,_0x546156;_0x3eb500<_0x1952fd['length'];_0x3eb500+=0x1){_0x546156=_0x1952fd[_0x3eb500][_0x3c99('0x12')]({'plain':!![]});switch(_0x546156[_0x3c99('0x34')]){case _0x3c99('0x37'):_0x486614(_0x546156)[_0x3c99('0x29')](_0x1c160f());break;case _0x3c99('0x3c'):_0x1d384f(_0x546156)[_0x3c99('0x29')](_0x1c160f());break;default:_0x58b171['CmHopper'][_0x3c99('0x25')]({'phone':_0x2c08e3[_0x3c99('0x9')],'ContactId':_0x2c08e3['id'],'ListId':_0x2c08e3[_0x3c99('0x26')],'scheduledat':_0x2c08e3[_0x3c99('0x16')]?_0x2c08e3['scheduledat']:moment()[_0x3c99('0x20')](_0x3c99('0x17')),'priority':_0x2c08e3[_0x3c99('0x27')]?_0x2c08e3[_0x3c99('0x27')]:0x2,'callback':_0x2c08e3['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2c08e3['callbackUniqueid']?_0x2c08e3[_0x3c99('0x28')]:undefined,'callbackat':_0x2c08e3[_0x3c99('0x28')]?moment()['format'](_0x3c99('0x17')):undefined,'CampaignId':_0x546156['id']})[_0x3c99('0x29')](_0x1c160f());}}}});})[_0x3c99('0x1a')](function(){return _0x58b171['Campaign'][_0x3c99('0x32')]({'attributes':['id'],'include':[{'model':_0x58b171['CmList'],'as':_0x3c99('0x38'),'where':{'id':_0x2c08e3[_0x3c99('0x26')]}}]})['then'](function(_0x444355){if(_0x444355){var _0x3f4901=[];for(var _0x1c3c2d=0x0,_0x158cf5;_0x1c3c2d<_0x444355[_0x3c99('0x36')];_0x1c3c2d+=0x1){_0x158cf5=_0x444355[_0x1c3c2d][_0x3c99('0x12')]({'plain':!![]});_0x58b171[_0x3c99('0x39')][_0x3c99('0x25')]({'phone':_0x2c08e3[_0x3c99('0x9')],'ContactId':_0x2c08e3['id'],'ListId':_0x2c08e3[_0x3c99('0x26')],'CampaignId':_0x158cf5['id']})[_0x3c99('0x29')](function(_0x225757){logger[_0x3c99('0x13')](_0x3c99('0x3d'),_0x3c99('0x2e'),_0x225757[_0x3c99('0x3a')]);});}}});})[_0x3c99('0x1a')](function(){_0x400427();})[_0x3c99('0x29')](function(_0x3f3d65){logger[_0x3c99('0x13')](_0x3c99('0x3d'),_0x3c99('0x2e'),_0x3f3d65[_0x3c99('0x3a')]);_0x400427(_0x3f3d65);});}else{_0x400427(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x28be9e,_0x574d3f,_0x744b87){var _0x5a785f=_0x15443b['models'];var _0x129a05=_0x28be9e[_0x3c99('0x12')]({'plain':!![]});return _0x5a785f[_0x3c99('0x24')][_0x3c99('0x32')]({'raw':!![],'where':{'ListId':_0x129a05[_0x3c99('0x26')],'ContactId':_0x129a05['id']}})['then'](function(_0x6e4483){if(!_['isEmpty'](_0x6e4483)){var _0x3593b7=[];for(var _0x3f7c7f=0x0;_0x3f7c7f<_0x6e4483[_0x3c99('0x36')];_0x3f7c7f+=0x1){var _0x4bb56f=_0x5a785f[_0x3c99('0x24')][_0x3c99('0x3e')]({'where':{'ListId':_0x6e4483[_0x3f7c7f]['ListId'],'ContactId':_0x6e4483[_0x3f7c7f][_0x3c99('0x3f')],'VoiceQueueId':_0x6e4483[_0x3f7c7f][_0x3c99('0x40')],'CampaignId':_0x6e4483[_0x3f7c7f][_0x3c99('0x41')]}});_0x3593b7[_0x3c99('0x42')](_0x4bb56f);}return BPromise[_0x3c99('0x43')](_0x3593b7);}})['then'](function(_0x48d333){logger['info'](_0x3c99('0x44'),util[_0x3c99('0x15')](_0x48d333,{'showHidden':![],'depth':null}));_0x744b87();})[_0x3c99('0x29')](function(_0xeadb7){logger['error'](_0x3c99('0x45'),util[_0x3c99('0x15')](_0xeadb7,{'showHidden':![],'depth':null}));_0x744b87(_0xeadb7);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index b6acade..1d63a29 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(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0x39739d,_0x7b1c13){var _0x26a6fb=function(_0x2ec7d9){while(--_0x2ec7d9){_0x39739d['push'](_0x39739d['shift']());}};_0x26a6fb(++_0x7b1c13);}(_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['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 3524630..e766f12 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 _0x3685=['sequelize','INTEGER','STRING','PHONE'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x5368('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x5368('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x5368('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x5368('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x5368('0x2')],'defaultValue':_0x5368('0x3')},'OrderBy':{'type':Sequelize[_0x5368('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x5368('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x167e=['INTEGER','STRING','PHONE','sequelize','exports'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x167e,0xa3));var _0xe167=function(_0x19d873,_0x37bfc8){_0x19d873=_0x19d873-0x0;var _0x245678=_0x167e[_0x19d873];return _0x245678;};'use strict';var Sequelize=require(_0xe167('0x0'));module[_0xe167('0x1')]={'CmContactId':{'type':Sequelize[_0xe167('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xe167('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xe167('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xe167('0x3')],'defaultValue':_0xe167('0x4')},'OrderBy':{'type':Sequelize[_0xe167('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 5731e3b..fee9d8c 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 _0x83a6=['CmContactHasItems','error','stack','name','index','map','CmContactHasItem','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','order','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','catch','params','includeAll','find','body','user','get','UserProfileSection','userProfileId','UserProfileResource','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','destroy','then'];(function(_0x30b8e7,_0x525367){var _0x223b35=function(_0x522727){while(--_0x522727){_0x30b8e7['push'](_0x30b8e7['shift']());}};_0x223b35(++_0x525367);}(_0x83a6,0x109));var _0x683a=function(_0x1f4acf,_0x4ea06c){_0x1f4acf=_0x1f4acf-0x0;var _0x25ea54=_0x83a6[_0x1f4acf];return _0x25ea54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x683a('0x0'));var zipdir=require(_0x683a('0x1'));var jsonpatch=require(_0x683a('0x2'));var rp=require(_0x683a('0x3'));var moment=require(_0x683a('0x4'));var BPromise=require(_0x683a('0x5'));var Mustache=require(_0x683a('0x6'));var util=require(_0x683a('0x7'));var path=require(_0x683a('0x8'));var sox=require('sox');var csv=require(_0x683a('0x9'));var ejs=require(_0x683a('0xa'));var fs=require('fs');var fs_extra=require(_0x683a('0xb'));var _=require('lodash');var squel=require(_0x683a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x683a('0xd'));var toCsv=require(_0x683a('0x9'));var querystring=require(_0x683a('0xe'));var Papa=require(_0x683a('0xf'));var Redis=require('ioredis');var authService=require(_0x683a('0x10'));var qs=require(_0x683a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x683a('0x12'));var logger=require(_0x683a('0x13'))(_0x683a('0x14'));var utils=require(_0x683a('0x15'));var config=require(_0x683a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x683a('0x17'))['db'];function respondWithStatusCode(_0xab49a1,_0x348f2d){_0x348f2d=_0x348f2d||0xcc;return function(_0x1241df){if(_0x1241df){return _0xab49a1[_0x683a('0x18')](_0x348f2d);}return _0xab49a1[_0x683a('0x19')](_0x348f2d)[_0x683a('0x1a')]();};}function respondWithResult(_0x14b73c,_0x1d6131){_0x1d6131=_0x1d6131||0xc8;return function(_0x4b2a59){if(_0x4b2a59){return _0x14b73c['status'](_0x1d6131)[_0x683a('0x1b')](_0x4b2a59);}};}function respondWithFilteredResult(_0x5ee3b8,_0x1e8a76){return function(_0x79d6b6){if(_0x79d6b6){var _0x3d1196=typeof _0x1e8a76['offset']===_0x683a('0x1c')&&typeof _0x1e8a76[_0x683a('0x1d')]===_0x683a('0x1c');var _0x2bf1f6=_0x79d6b6['count'];var _0xc6b65c=_0x3d1196?0x0:_0x1e8a76[_0x683a('0x1e')];var _0x1cba70=_0x3d1196?_0x79d6b6[_0x683a('0x1f')]:_0x1e8a76[_0x683a('0x1e')]+_0x1e8a76[_0x683a('0x1d')];var _0x3dd809;if(_0x1cba70>=_0x2bf1f6){_0x1cba70=_0x2bf1f6;_0x3dd809=0xc8;}else{_0x3dd809=0xce;}_0x5ee3b8[_0x683a('0x19')](_0x3dd809);return _0x5ee3b8[_0x683a('0x20')](_0x683a('0x21'),_0xc6b65c+'-'+_0x1cba70+'/'+_0x2bf1f6)[_0x683a('0x1b')](_0x79d6b6);}return null;};}function patchUpdates(_0x10bd8c){return function(_0xb64ec8){try{jsonpatch[_0x683a('0x22')](_0xb64ec8,_0x10bd8c,!![]);}catch(_0x341f6e){return BPromise[_0x683a('0x23')](_0x341f6e);}return _0xb64ec8[_0x683a('0x24')]();};}function saveUpdates(_0xb2491b,_0x7dce81){return function(_0x502b51){if(_0x502b51){return _0x502b51['update'](_0xb2491b)['then'](function(_0x2aa1c9){return _0x2aa1c9;});}return null;};}function removeEntity(_0x48cb80,_0x196b59){return function(_0x6e6202){if(_0x6e6202){return _0x6e6202[_0x683a('0x25')]()[_0x683a('0x26')](function(){var _0x3b7f6c=_0x6e6202['get']({'plain':!![]});var _0x3414a1=_0x683a('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x3414a1,'resourceId':_0x3b7f6c['id']}})['then'](function(){return _0x6e6202;});})[_0x683a('0x26')](function(){_0x48cb80[_0x683a('0x19')](0xcc)[_0x683a('0x1a')]();});}};}function handleEntityNotFound(_0x4724d8,_0x1d48a0){return function(_0x490aaf){if(!_0x490aaf){_0x4724d8[_0x683a('0x18')](0x194);}return _0x490aaf;};}function handleError(_0x352b33,_0x5e7355){_0x5e7355=_0x5e7355||0x1f4;return function(_0x5aef3e){logger[_0x683a('0x28')](_0x5aef3e[_0x683a('0x29')]);if(_0x5aef3e[_0x683a('0x2a')]){delete _0x5aef3e['name'];}_0x352b33[_0x683a('0x19')](_0x5e7355)['send'](_0x5aef3e);};}exports[_0x683a('0x2b')]=function(_0x4a519f,_0x2167e7){var _0x30c1e2={},_0x101677={},_0x625ed9={'count':0x0,'rows':[]};var _0x46ac5d=_[_0x683a('0x2c')](db[_0x683a('0x2d')][_0x683a('0x2e')],function(_0x27733c){return{'name':_0x27733c['fieldName'],'type':_0x27733c[_0x683a('0x2f')][_0x683a('0x30')]};});_0x101677[_0x683a('0x31')]=_['map'](_0x46ac5d,_0x683a('0x2a'));_0x101677['query']=_[_0x683a('0x32')](_0x4a519f[_0x683a('0x33')]);_0x101677['filters']=_[_0x683a('0x34')](_0x101677['model'],_0x101677['query']);_0x30c1e2[_0x683a('0x35')]=_['intersection'](_0x101677[_0x683a('0x31')],qs[_0x683a('0x36')](_0x4a519f[_0x683a('0x33')][_0x683a('0x36')]));_0x30c1e2[_0x683a('0x35')]=_0x30c1e2[_0x683a('0x35')][_0x683a('0x37')]?_0x30c1e2[_0x683a('0x35')]:_0x101677[_0x683a('0x31')];if(!_0x4a519f['query']['hasOwnProperty']('nolimit')){_0x30c1e2[_0x683a('0x1d')]=qs['limit'](_0x4a519f[_0x683a('0x33')][_0x683a('0x1d')]);_0x30c1e2['offset']=qs[_0x683a('0x1e')](_0x4a519f[_0x683a('0x33')]['offset']);}_0x30c1e2[_0x683a('0x38')]=qs[_0x683a('0x39')](_0x4a519f['query'][_0x683a('0x39')]);_0x30c1e2[_0x683a('0x3a')]=qs[_0x683a('0x3b')](_['pick'](_0x4a519f[_0x683a('0x33')],_0x101677[_0x683a('0x3b')]),_0x46ac5d);if(_0x4a519f[_0x683a('0x33')][_0x683a('0x3c')]){_0x30c1e2[_0x683a('0x3a')]=_[_0x683a('0x3d')](_0x30c1e2[_0x683a('0x3a')],{'$or':_['map'](_0x46ac5d,function(_0x331814){if(_0x331814['type']!==_0x683a('0x3e')){var _0x4780c3={};_0x4780c3[_0x331814[_0x683a('0x2a')]]={'$like':'%'+_0x4a519f[_0x683a('0x33')][_0x683a('0x3c')]+'%'};return _0x4780c3;}})});}_0x30c1e2=_[_0x683a('0x3d')]({},_0x30c1e2,_0x4a519f[_0x683a('0x3f')]);var _0xca1bcc={'where':_0x30c1e2['where']};return db[_0x683a('0x2d')][_0x683a('0x1f')](_0xca1bcc)[_0x683a('0x26')](function(_0x272640){_0x625ed9[_0x683a('0x1f')]=_0x272640;if(_0x4a519f[_0x683a('0x33')]['includeAll']){_0x30c1e2[_0x683a('0x40')]=[{'all':!![]}];}return db[_0x683a('0x2d')]['findAll'](_0x30c1e2);})['then'](function(_0x4af1c8){_0x625ed9[_0x683a('0x41')]=_0x4af1c8;return _0x625ed9;})['then'](respondWithFilteredResult(_0x2167e7,_0x30c1e2))[_0x683a('0x42')](handleError(_0x2167e7,null));};exports['show']=function(_0xd08ac1,_0x99955f){var _0x1ed97b={'raw':!![],'where':{'id':_0xd08ac1[_0x683a('0x43')]['id']}},_0x3fc19e={};_0x3fc19e[_0x683a('0x31')]=_[_0x683a('0x32')](db[_0x683a('0x2d')][_0x683a('0x2e')]);_0x3fc19e['query']=_[_0x683a('0x32')](_0xd08ac1[_0x683a('0x33')]);_0x3fc19e[_0x683a('0x3b')]=_['intersection'](_0x3fc19e[_0x683a('0x31')],_0x3fc19e[_0x683a('0x33')]);_0x1ed97b[_0x683a('0x35')]=_['intersection'](_0x3fc19e[_0x683a('0x31')],qs[_0x683a('0x36')](_0xd08ac1['query'][_0x683a('0x36')]));_0x1ed97b[_0x683a('0x35')]=_0x1ed97b[_0x683a('0x35')]['length']?_0x1ed97b['attributes']:_0x3fc19e[_0x683a('0x31')];if(_0xd08ac1[_0x683a('0x33')][_0x683a('0x44')]){_0x1ed97b[_0x683a('0x40')]=[{'all':!![]}];}_0x1ed97b=_[_0x683a('0x3d')]({},_0x1ed97b,_0xd08ac1[_0x683a('0x3f')]);return db[_0x683a('0x2d')][_0x683a('0x45')](_0x1ed97b)[_0x683a('0x26')](handleEntityNotFound(_0x99955f,null))[_0x683a('0x26')](respondWithResult(_0x99955f,null))[_0x683a('0x42')](handleError(_0x99955f,null));};exports['create']=function(_0x1da13a,_0x1b3470){return db[_0x683a('0x2d')]['create'](_0x1da13a[_0x683a('0x46')],{})[_0x683a('0x26')](function(_0x10d02f){var _0x10b542=_0x1da13a[_0x683a('0x47')][_0x683a('0x48')]({'plain':!![]});if(!_0x10b542)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10b542['role']===_0x683a('0x47')){var _0x452b5d=_0x10d02f['get']({'plain':!![]});var _0xb52049=_0x683a('0x27');return db[_0x683a('0x49')][_0x683a('0x45')]({'where':{'name':_0xb52049,'userProfileId':_0x10b542[_0x683a('0x4a')]},'raw':!![]})['then'](function(_0x5d7876){if(_0x5d7876&&_0x5d7876['autoAssociation']===0x0){return db[_0x683a('0x4b')]['create']({'name':_0x452b5d[_0x683a('0x2a')],'resourceId':_0x452b5d['id'],'type':_0x5d7876[_0x683a('0x2a')],'sectionId':_0x5d7876['id']},{})[_0x683a('0x26')](function(){return _0x10d02f;});}else{return _0x10d02f;}})[_0x683a('0x42')](function(_0x325718){logger[_0x683a('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x325718);throw _0x325718;});}return _0x10d02f;})[_0x683a('0x26')](respondWithResult(_0x1b3470,0xc9))[_0x683a('0x42')](handleError(_0x1b3470,null));};exports['update']=function(_0x453b8b,_0x45b4c5){if(_0x453b8b[_0x683a('0x46')]['id']){delete _0x453b8b[_0x683a('0x46')]['id'];}return db[_0x683a('0x2d')][_0x683a('0x45')]({'where':{'id':_0x453b8b['params']['id']}})[_0x683a('0x26')](handleEntityNotFound(_0x45b4c5,null))[_0x683a('0x26')](saveUpdates(_0x453b8b[_0x683a('0x46')],null))['then'](respondWithResult(_0x45b4c5,null))['catch'](handleError(_0x45b4c5,null));};exports[_0x683a('0x25')]=function(_0x21011b,_0x164cea){return db[_0x683a('0x2d')][_0x683a('0x45')]({'where':{'id':_0x21011b[_0x683a('0x43')]['id']}})['then'](handleEntityNotFound(_0x164cea,null))[_0x683a('0x26')](removeEntity(_0x164cea,null))['catch'](handleError(_0x164cea,null));}; \ No newline at end of file +var _0xc6c3=['find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','save','update','then','destroy','get','CmContactHasItems','end','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','length','options'];(function(_0x38f737,_0x54f685){var _0x7afda3=function(_0x1ac1d7){while(--_0x1ac1d7){_0x38f737['push'](_0x38f737['shift']());}};_0x7afda3(++_0x54f685);}(_0xc6c3,0xab));var _0x3c6c=function(_0x380afd,_0x24dbc8){_0x380afd=_0x380afd-0x0;var _0x4cda3d=_0xc6c3[_0x380afd];return _0x4cda3d;};'use strict';var emlformat=require(_0x3c6c('0x0'));var rimraf=require(_0x3c6c('0x1'));var zipdir=require(_0x3c6c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3c6c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3c6c('0x4'));var util=require(_0x3c6c('0x5'));var path=require(_0x3c6c('0x6'));var sox=require(_0x3c6c('0x7'));var csv=require(_0x3c6c('0x8'));var ejs=require(_0x3c6c('0x9'));var fs=require('fs');var fs_extra=require(_0x3c6c('0xa'));var _=require('lodash');var squel=require(_0x3c6c('0xb'));var crypto=require(_0x3c6c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3c6c('0x8'));var querystring=require(_0x3c6c('0xd'));var Papa=require(_0x3c6c('0xe'));var Redis=require(_0x3c6c('0xf'));var authService=require(_0x3c6c('0x10'));var qs=require(_0x3c6c('0x11'));var as=require(_0x3c6c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c6c('0x13'))('api');var utils=require(_0x3c6c('0x14'));var config=require(_0x3c6c('0x15'));var licenseUtil=require(_0x3c6c('0x16'));var db=require(_0x3c6c('0x17'))['db'];function respondWithStatusCode(_0x2839b0,_0x57ede5){_0x57ede5=_0x57ede5||0xcc;return function(_0x1f862a){if(_0x1f862a){return _0x2839b0[_0x3c6c('0x18')](_0x57ede5);}return _0x2839b0[_0x3c6c('0x19')](_0x57ede5)['end']();};}function respondWithResult(_0x1f5aaf,_0x2c664f){_0x2c664f=_0x2c664f||0xc8;return function(_0x46574a){if(_0x46574a){return _0x1f5aaf['status'](_0x2c664f)['json'](_0x46574a);}};}function respondWithFilteredResult(_0x54948f,_0x3b610c){return function(_0x17121e){if(_0x17121e){var _0x4fcc12=typeof _0x3b610c[_0x3c6c('0x1a')]===_0x3c6c('0x1b')&&typeof _0x3b610c[_0x3c6c('0x1c')]===_0x3c6c('0x1b');var _0x5a7ec7=_0x17121e['count'];var _0x4f63d3=_0x4fcc12?0x0:_0x3b610c['offset'];var _0x139158=_0x4fcc12?_0x17121e['count']:_0x3b610c[_0x3c6c('0x1a')]+_0x3b610c[_0x3c6c('0x1c')];var _0x418679;if(_0x139158>=_0x5a7ec7){_0x139158=_0x5a7ec7;_0x418679=0xc8;}else{_0x418679=0xce;}_0x54948f[_0x3c6c('0x19')](_0x418679);return _0x54948f['set']('Content-Range',_0x4f63d3+'-'+_0x139158+'/'+_0x5a7ec7)['json'](_0x17121e);}return null;};}function patchUpdates(_0x18fa53){return function(_0x48348f){try{jsonpatch['apply'](_0x48348f,_0x18fa53,!![]);}catch(_0x56a004){return BPromise['reject'](_0x56a004);}return _0x48348f[_0x3c6c('0x1d')]();};}function saveUpdates(_0x17f9a5,_0x4cb665){return function(_0x23054c){if(_0x23054c){return _0x23054c[_0x3c6c('0x1e')](_0x17f9a5)[_0x3c6c('0x1f')](function(_0x449d1f){return _0x449d1f;});}return null;};}function removeEntity(_0x323dac,_0x2992b4){return function(_0x4ec945){if(_0x4ec945){return _0x4ec945[_0x3c6c('0x20')]()['then'](function(){var _0x8740a7=_0x4ec945[_0x3c6c('0x21')]({'plain':!![]});var _0x3df318=_0x3c6c('0x22');return db['UserProfileResource'][_0x3c6c('0x20')]({'where':{'type':_0x3df318,'resourceId':_0x8740a7['id']}})[_0x3c6c('0x1f')](function(){return _0x4ec945;});})[_0x3c6c('0x1f')](function(){_0x323dac[_0x3c6c('0x19')](0xcc)[_0x3c6c('0x23')]();});}};}function handleEntityNotFound(_0x5bc9ca,_0x4172d0){return function(_0x513e4b){if(!_0x513e4b){_0x5bc9ca[_0x3c6c('0x18')](0x194);}return _0x513e4b;};}function handleError(_0x5d6126,_0x2ab739){_0x2ab739=_0x2ab739||0x1f4;return function(_0x1656ea){logger['error'](_0x1656ea[_0x3c6c('0x24')]);if(_0x1656ea[_0x3c6c('0x25')]){delete _0x1656ea['name'];}_0x5d6126['status'](_0x2ab739)[_0x3c6c('0x26')](_0x1656ea);};}exports[_0x3c6c('0x27')]=function(_0x304031,_0x1989ff){var _0x4ed747={},_0x23d0b4={},_0x2e672a={'count':0x0,'rows':[]};var _0x14af4f=_[_0x3c6c('0x28')](db[_0x3c6c('0x29')][_0x3c6c('0x2a')],function(_0x44d500){return{'name':_0x44d500[_0x3c6c('0x2b')],'type':_0x44d500[_0x3c6c('0x2c')][_0x3c6c('0x2d')]};});_0x23d0b4[_0x3c6c('0x2e')]=_[_0x3c6c('0x28')](_0x14af4f,_0x3c6c('0x25'));_0x23d0b4[_0x3c6c('0x2f')]=_[_0x3c6c('0x30')](_0x304031[_0x3c6c('0x2f')]);_0x23d0b4[_0x3c6c('0x31')]=_[_0x3c6c('0x32')](_0x23d0b4['model'],_0x23d0b4['query']);_0x4ed747['attributes']=_[_0x3c6c('0x32')](_0x23d0b4[_0x3c6c('0x2e')],qs[_0x3c6c('0x33')](_0x304031['query'][_0x3c6c('0x33')]));_0x4ed747[_0x3c6c('0x34')]=_0x4ed747[_0x3c6c('0x34')]['length']?_0x4ed747[_0x3c6c('0x34')]:_0x23d0b4[_0x3c6c('0x2e')];if(!_0x304031[_0x3c6c('0x2f')][_0x3c6c('0x35')](_0x3c6c('0x36'))){_0x4ed747['limit']=qs[_0x3c6c('0x1c')](_0x304031[_0x3c6c('0x2f')][_0x3c6c('0x1c')]);_0x4ed747['offset']=qs[_0x3c6c('0x1a')](_0x304031['query'][_0x3c6c('0x1a')]);}_0x4ed747[_0x3c6c('0x37')]=qs[_0x3c6c('0x38')](_0x304031['query'][_0x3c6c('0x38')]);_0x4ed747[_0x3c6c('0x39')]=qs[_0x3c6c('0x31')](_['pick'](_0x304031[_0x3c6c('0x2f')],_0x23d0b4[_0x3c6c('0x31')]),_0x14af4f);if(_0x304031['query'][_0x3c6c('0x3a')]){_0x4ed747[_0x3c6c('0x39')]=_['merge'](_0x4ed747[_0x3c6c('0x39')],{'$or':_['map'](_0x14af4f,function(_0x17e758){if(_0x17e758[_0x3c6c('0x2c')]!==_0x3c6c('0x3b')){var _0x1ce93a={};_0x1ce93a[_0x17e758[_0x3c6c('0x25')]]={'$like':'%'+_0x304031['query']['filter']+'%'};return _0x1ce93a;}})});}_0x4ed747=_[_0x3c6c('0x3c')]({},_0x4ed747,_0x304031['options']);var _0x5b9c12={'where':_0x4ed747[_0x3c6c('0x39')]};return db[_0x3c6c('0x29')][_0x3c6c('0x3d')](_0x5b9c12)[_0x3c6c('0x1f')](function(_0x3379db){_0x2e672a[_0x3c6c('0x3d')]=_0x3379db;if(_0x304031[_0x3c6c('0x2f')][_0x3c6c('0x3e')]){_0x4ed747[_0x3c6c('0x3f')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x3c6c('0x40')](_0x4ed747);})[_0x3c6c('0x1f')](function(_0x363916){_0x2e672a[_0x3c6c('0x41')]=_0x363916;return _0x2e672a;})[_0x3c6c('0x1f')](respondWithFilteredResult(_0x1989ff,_0x4ed747))[_0x3c6c('0x42')](handleError(_0x1989ff,null));};exports['show']=function(_0x3a1626,_0x3da9eb){var _0x457d5f={'raw':!![],'where':{'id':_0x3a1626['params']['id']}},_0x1bbdfe={};_0x1bbdfe['model']=_[_0x3c6c('0x30')](db['CmContactHasItem'][_0x3c6c('0x2a')]);_0x1bbdfe[_0x3c6c('0x2f')]=_[_0x3c6c('0x30')](_0x3a1626[_0x3c6c('0x2f')]);_0x1bbdfe[_0x3c6c('0x31')]=_[_0x3c6c('0x32')](_0x1bbdfe['model'],_0x1bbdfe[_0x3c6c('0x2f')]);_0x457d5f[_0x3c6c('0x34')]=_['intersection'](_0x1bbdfe[_0x3c6c('0x2e')],qs[_0x3c6c('0x33')](_0x3a1626['query']['fields']));_0x457d5f[_0x3c6c('0x34')]=_0x457d5f[_0x3c6c('0x34')][_0x3c6c('0x43')]?_0x457d5f[_0x3c6c('0x34')]:_0x1bbdfe['model'];if(_0x3a1626[_0x3c6c('0x2f')][_0x3c6c('0x3e')]){_0x457d5f[_0x3c6c('0x3f')]=[{'all':!![]}];}_0x457d5f=_['merge']({},_0x457d5f,_0x3a1626[_0x3c6c('0x44')]);return db['CmContactHasItem'][_0x3c6c('0x45')](_0x457d5f)[_0x3c6c('0x1f')](handleEntityNotFound(_0x3da9eb,null))['then'](respondWithResult(_0x3da9eb,null))[_0x3c6c('0x42')](handleError(_0x3da9eb,null));};exports[_0x3c6c('0x46')]=function(_0xc02cab,_0xeaceee){return db['CmContactHasItem']['create'](_0xc02cab[_0x3c6c('0x47')],{})[_0x3c6c('0x1f')](function(_0xad85d3){var _0x2dcc86=_0xc02cab['user'][_0x3c6c('0x21')]({'plain':!![]});if(!_0x2dcc86)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2dcc86[_0x3c6c('0x48')]===_0x3c6c('0x49')){var _0x1aa05b=_0xad85d3[_0x3c6c('0x21')]({'plain':!![]});var _0x54be2c=_0x3c6c('0x22');return db[_0x3c6c('0x4a')][_0x3c6c('0x45')]({'where':{'name':_0x54be2c,'userProfileId':_0x2dcc86[_0x3c6c('0x4b')]},'raw':!![]})[_0x3c6c('0x1f')](function(_0x40e638){if(_0x40e638&&_0x40e638[_0x3c6c('0x4c')]===0x0){return db['UserProfileResource'][_0x3c6c('0x46')]({'name':_0x1aa05b[_0x3c6c('0x25')],'resourceId':_0x1aa05b['id'],'type':_0x40e638[_0x3c6c('0x25')],'sectionId':_0x40e638['id']},{})[_0x3c6c('0x1f')](function(){return _0xad85d3;});}else{return _0xad85d3;}})[_0x3c6c('0x42')](function(_0x3a3e0a){logger[_0x3c6c('0x4d')](_0x3c6c('0x4e'),_0x3a3e0a);throw _0x3a3e0a;});}return _0xad85d3;})[_0x3c6c('0x1f')](respondWithResult(_0xeaceee,0xc9))[_0x3c6c('0x42')](handleError(_0xeaceee,null));};exports[_0x3c6c('0x1e')]=function(_0xadd4a1,_0x84ac6c){if(_0xadd4a1['body']['id']){delete _0xadd4a1[_0x3c6c('0x47')]['id'];}return db[_0x3c6c('0x29')][_0x3c6c('0x45')]({'where':{'id':_0xadd4a1[_0x3c6c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x84ac6c,null))[_0x3c6c('0x1f')](saveUpdates(_0xadd4a1[_0x3c6c('0x47')],null))['then'](respondWithResult(_0x84ac6c,null))[_0x3c6c('0x42')](handleError(_0x84ac6c,null));};exports[_0x3c6c('0x20')]=function(_0x32a48c,_0x5de0f7){return db[_0x3c6c('0x29')][_0x3c6c('0x45')]({'where':{'id':_0x32a48c[_0x3c6c('0x4f')]['id']}})[_0x3c6c('0x1f')](handleEntityNotFound(_0x5de0f7,null))[_0x3c6c('0x1f')](removeEntity(_0x5de0f7,null))[_0x3c6c('0x42')](handleError(_0x5de0f7,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 5a21c32..b1231f9 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 _0x7085=['./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0xef8959,_0x56dc08){var _0x1ab0c5=function(_0x5323c5){while(--_0x5323c5){_0xef8959['push'](_0xef8959['shift']());}};_0x1ab0c5(++_0x56dc08);}(_0x7085,0x125));var _0x5708=function(_0x4d32e9,_0x390d44){_0x4d32e9=_0x4d32e9-0x0;var _0x2d9ece=_0x7085[_0x4d32e9];return _0x2d9ece;};'use strict';var _=require(_0x5708('0x0'));var util=require(_0x5708('0x1'));var logger=require(_0x5708('0x2'))(_0x5708('0x3'));var moment=require('moment');var BPromise=require(_0x5708('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5708('0x5'));var rimraf=require('rimraf');var config=require(_0x5708('0x6'));var attributes=require(_0x5708('0x7'));module[_0x5708('0x8')]=function(_0x5c5c6b,_0x16c771){return _0x5c5c6b[_0x5708('0x9')](_0x5708('0xa'),attributes,{'tableName':_0x5708('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66ab=['request-promise','path','rimraf','./cmContactHasItem.attributes','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x66ab,0x187));var _0xb66a=function(_0x2f75d1,_0x38f249){_0x2f75d1=_0x2f75d1-0x0;var _0x4eefbf=_0x66ab[_0x2f75d1];return _0x4eefbf;};'use strict';var _=require(_0xb66a('0x0'));var util=require(_0xb66a('0x1'));var logger=require(_0xb66a('0x2'))(_0xb66a('0x3'));var moment=require('moment');var BPromise=require(_0xb66a('0x4'));var rp=require(_0xb66a('0x5'));var fs=require('fs');var path=require(_0xb66a('0x6'));var rimraf=require(_0xb66a('0x7'));var config=require('../../config/environment');var attributes=require(_0xb66a('0x8'));module['exports']=function(_0x4fa411,_0x2156ed){return _0x4fa411[_0xb66a('0x9')](_0xb66a('0xa'),attributes,{'tableName':_0xb66a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 0b93807..1c1f6f1 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 _0xcbbd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xcbbd,0xae));var _0xdcbb=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xcbbd[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0xdcbb('0x0'));var util=require(_0xdcbb('0x1'));var moment=require(_0xdcbb('0x2'));var BPromise=require(_0xdcbb('0x3'));var rs=require(_0xdcbb('0x4'));var fs=require('fs');var Redis=require(_0xdcbb('0x5'));var db=require(_0xdcbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcbb('0x7'))(_0xdcbb('0x8'));var config=require(_0xdcbb('0x9'));var jayson=require(_0xdcbb('0xa'));var client=jayson[_0xdcbb('0xb')][_0xdcbb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5232ac,_0x339b5f,_0x556249){return new BPromise(function(_0x1a3d64,_0x2dcccd){return client[_0xdcbb('0xd')](_0x5232ac,_0x556249)[_0xdcbb('0xe')](function(_0x2b8cec){logger[_0xdcbb('0xf')](_0xdcbb('0x10'),_0x339b5f,_0xdcbb('0x11'));logger[_0xdcbb('0x12')](_0xdcbb('0x13'),_0x339b5f,_0xdcbb('0x11'),JSON[_0xdcbb('0x14')](_0x2b8cec));if(_0x2b8cec[_0xdcbb('0x15')]){if(_0x2b8cec['error']['code']===0x1f4){logger[_0xdcbb('0x15')]('CmContactHasItem,\x20%s,\x20%s',_0x339b5f,_0x2b8cec[_0xdcbb('0x15')][_0xdcbb('0x16')]);return _0x2dcccd(_0x2b8cec[_0xdcbb('0x15')][_0xdcbb('0x16')]);}logger[_0xdcbb('0x15')](_0xdcbb('0x10'),_0x339b5f,_0x2b8cec['error']['message']);return _0x1a3d64(_0x2b8cec[_0xdcbb('0x15')][_0xdcbb('0x16')]);}else{logger[_0xdcbb('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x339b5f,_0xdcbb('0x11'));_0x1a3d64(_0x2b8cec[_0xdcbb('0x17')]['message']);}})[_0xdcbb('0x18')](function(_0xc3fc33){logger[_0xdcbb('0x15')](_0xdcbb('0x10'),_0x339b5f,_0xc3fc33);_0x2dcccd(_0xc3fc33);});});} \ No newline at end of file +var _0x60a5=['result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','info'];(function(_0x10413d,_0x39ceb2){var _0x26c937=function(_0x3fb540){while(--_0x3fb540){_0x10413d['push'](_0x10413d['shift']());}};_0x26c937(++_0x39ceb2);}(_0x60a5,0xe7));var _0x560a=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x60a5[_0x55f8b4];return _0x2475f9;};'use strict';var _=require('lodash');var util=require(_0x560a('0x0'));var moment=require(_0x560a('0x1'));var BPromise=require(_0x560a('0x2'));var rs=require(_0x560a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x560a('0x4'))['db'];var utils=require(_0x560a('0x5'));var logger=require(_0x560a('0x6'))(_0x560a('0x7'));var config=require(_0x560a('0x8'));var jayson=require(_0x560a('0x9'));var client=jayson['client'][_0x560a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa286a6,_0x17fcb8,_0x30c67f){return new BPromise(function(_0x40f3d4,_0xf8d8ea){return client[_0x560a('0xb')](_0xa286a6,_0x30c67f)[_0x560a('0xc')](function(_0xa93a81){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x17fcb8,_0x560a('0xd'));logger[_0x560a('0xe')](_0x560a('0xf'),_0x17fcb8,_0x560a('0xd'),JSON[_0x560a('0x10')](_0xa93a81));if(_0xa93a81[_0x560a('0x11')]){if(_0xa93a81[_0x560a('0x11')][_0x560a('0x12')]===0x1f4){logger[_0x560a('0x11')](_0x560a('0x13'),_0x17fcb8,_0xa93a81[_0x560a('0x11')][_0x560a('0x14')]);return _0xf8d8ea(_0xa93a81[_0x560a('0x11')][_0x560a('0x14')]);}logger[_0x560a('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x17fcb8,_0xa93a81['error']['message']);return _0x40f3d4(_0xa93a81['error'][_0x560a('0x14')]);}else{logger[_0x560a('0x15')]('CmContactHasItem,\x20%s,\x20%s',_0x17fcb8,_0x560a('0xd'));_0x40f3d4(_0xa93a81[_0x560a('0x16')][_0x560a('0x14')]);}})['catch'](function(_0x201711){logger[_0x560a('0x11')](_0x560a('0x13'),_0x17fcb8,_0x201711);_0xf8d8ea(_0x201711);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 3e278fe..7a5115b 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 _0xe900=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','/:id','show','create','put','delete','destroy','multer','util'];(function(_0x4df85c,_0x248dfb){var _0x4e2a61=function(_0x4e2c8e){while(--_0x4e2c8e){_0x4df85c['push'](_0x4df85c['shift']());}};_0x4e2a61(++_0x248dfb);}(_0xe900,0xfd));var _0x0e90=function(_0x93d04d,_0x4bb350){_0x93d04d=_0x93d04d-0x0;var _0x5e9ab4=_0xe900[_0x93d04d];return _0x5e9ab4;};'use strict';var multer=require(_0x0e90('0x0'));var util=require(_0x0e90('0x1'));var path=require('path');var timeout=require(_0x0e90('0x2'));var express=require(_0x0e90('0x3'));var router=express[_0x0e90('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0e90('0x5'));var interaction=require(_0x0e90('0x6'));var config=require(_0x0e90('0x7'));var controller=require(_0x0e90('0x8'));router[_0x0e90('0x9')]('/',auth[_0x0e90('0xa')](),controller['index']);router[_0x0e90('0x9')](_0x0e90('0xb'),auth['isAuthenticated'](),controller[_0x0e90('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0e90('0xd')]);router[_0x0e90('0xe')](_0x0e90('0xb'),auth[_0x0e90('0xa')](),controller['update']);router[_0x0e90('0xf')](_0x0e90('0xb'),auth['isAuthenticated'](),controller[_0x0e90('0x10')]);module['exports']=router; \ No newline at end of file +var _0x06a0=['put','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x2ac32b,_0x134b81){var _0x298c2e=function(_0x40703a){while(--_0x40703a){_0x2ac32b['push'](_0x2ac32b['shift']());}};_0x298c2e(++_0x134b81);}(_0x06a0,0x1e1));var _0x006a=function(_0x13a6d8,_0x6189c){_0x13a6d8=_0x13a6d8-0x0;var _0x176743=_0x06a0[_0x13a6d8];return _0x176743;};'use strict';var multer=require(_0x006a('0x0'));var util=require('util');var path=require(_0x006a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x006a('0x2')]();var fs_extra=require(_0x006a('0x3'));var auth=require(_0x006a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x006a('0x5'));router[_0x006a('0x6')]('/',auth[_0x006a('0x7')](),controller[_0x006a('0x8')]);router[_0x006a('0x6')](_0x006a('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x006a('0xa')]('/',auth[_0x006a('0x7')](),controller[_0x006a('0xb')]);router[_0x006a('0xc')](_0x006a('0x9'),auth[_0x006a('0x7')](),controller[_0x006a('0xd')]);router[_0x006a('0xe')](_0x006a('0x9'),auth[_0x006a('0x7')](),controller[_0x006a('0xf')]);module[_0x006a('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 8831c36..f6a8891 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 _0xfc6a=['setDataValue','getDataValue','long','select','parse','values','isArray','stringify','BOOLEAN','voice','exports','VIRTUAL','alias','STRING'];(function(_0x4f5dc2,_0x1bb444){var _0x4897d8=function(_0x318f5d){while(--_0x318f5d){_0x4f5dc2['push'](_0x4f5dc2['shift']());}};_0x4897d8(++_0x1bb444);}(_0xfc6a,0x6c));var _0xafc6=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xfc6a[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xafc6('0x0')]={'name':{'type':Sequelize[_0xafc6('0x1')],'get':function(_0x19acd4){return this['getDataValue'](_0xafc6('0x2'));}},'alias':{'type':Sequelize[_0xafc6('0x3')],'allowNull':![],'set':function(_0xcfd882){this[_0xafc6('0x4')]('alias',_0xcfd882?_0xcfd882:this[_0xafc6('0x5')]('name'));}},'type':{'type':Sequelize[_0xafc6('0x3')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xafc6('0x6')),'get':function(){if(this[_0xafc6('0x5')]('type')===_0xafc6('0x7')){return JSON[_0xafc6('0x8')](this[_0xafc6('0x5')](_0xafc6('0x9')));}else{return this[_0xafc6('0x5')]('values');}},'set':function(_0xe2e953){if(Array[_0xafc6('0xa')](_0xe2e953)){this[_0xafc6('0x4')]('values',JSON[_0xafc6('0xb')](_0xe2e953));}else{this[_0xafc6('0x4')](_0xafc6('0x9'),_0xe2e953);}}},'required':{'type':Sequelize[_0xafc6('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xafc6('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xafc6('0xd'))}}; \ No newline at end of file +var _0xb905=['alias','STRING','setDataValue','name','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue'];(function(_0x3669a0,_0xf29656){var _0x5adce0=function(_0x395c26){while(--_0x395c26){_0x3669a0['push'](_0x3669a0['shift']());}};_0x5adce0(++_0xf29656);}(_0xb905,0x14f));var _0x5b90=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb905[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0x5b90('0x0'));var _=require(_0x5b90('0x1'));module[_0x5b90('0x2')]={'name':{'type':Sequelize[_0x5b90('0x3')],'get':function(_0x22071a){return this[_0x5b90('0x4')](_0x5b90('0x5'));}},'alias':{'type':Sequelize[_0x5b90('0x6')],'allowNull':![],'set':function(_0x2ebe11){this[_0x5b90('0x7')]('alias',_0x2ebe11?_0x2ebe11:this[_0x5b90('0x4')](_0x5b90('0x8')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x5b90('0x9')](_0x5b90('0xa')),'get':function(){if(this[_0x5b90('0x4')](_0x5b90('0xb'))===_0x5b90('0xc')){return JSON[_0x5b90('0xd')](this[_0x5b90('0x4')](_0x5b90('0xe')));}else{return this['getDataValue']('values');}},'set':function(_0x3e1e10){if(Array[_0x5b90('0xf')](_0x3e1e10)){this[_0x5b90('0x7')](_0x5b90('0xe'),JSON[_0x5b90('0x10')](_0x3e1e10));}else{this[_0x5b90('0x7')](_0x5b90('0xe'),_0x3e1e10);}}},'required':{'type':Sequelize[_0x5b90('0x11')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x5b90('0x12')](_0x5b90('0x13'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 13086e5..9b27e70 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 _0x0674=['filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','CmCustomField','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0x0674,0x11a));var _0x4067=function(_0x4911c8,_0x5f4f83){_0x4911c8=_0x4911c8-0x0;var _0x3e685d=_0x0674[_0x4911c8];return _0x3e685d;};'use strict';var emlformat=require(_0x4067('0x0'));var rimraf=require(_0x4067('0x1'));var zipdir=require(_0x4067('0x2'));var jsonpatch=require(_0x4067('0x3'));var rp=require(_0x4067('0x4'));var moment=require(_0x4067('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4067('0x6'));var util=require(_0x4067('0x7'));var path=require(_0x4067('0x8'));var sox=require(_0x4067('0x9'));var csv=require(_0x4067('0xa'));var ejs=require(_0x4067('0xb'));var fs=require('fs');var fs_extra=require(_0x4067('0xc'));var _=require(_0x4067('0xd'));var squel=require(_0x4067('0xe'));var crypto=require(_0x4067('0xf'));var jsforce=require(_0x4067('0x10'));var deskjs=require(_0x4067('0x11'));var toCsv=require(_0x4067('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4067('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4067('0x13'));var as=require(_0x4067('0x14'));var hardwareService=require(_0x4067('0x15'));var logger=require('../../config/logger')(_0x4067('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4067('0x17'));var db=require(_0x4067('0x18'))['db'];function respondWithStatusCode(_0x71d702,_0x161001){_0x161001=_0x161001||0xcc;return function(_0x50090c){if(_0x50090c){return _0x71d702[_0x4067('0x19')](_0x161001);}return _0x71d702['status'](_0x161001)[_0x4067('0x1a')]();};}function respondWithResult(_0x452a9a,_0x543333){_0x543333=_0x543333||0xc8;return function(_0x3445f2){if(_0x3445f2){return _0x452a9a['status'](_0x543333)[_0x4067('0x1b')](_0x3445f2);}};}function respondWithFilteredResult(_0x30c8b6,_0x38f339){return function(_0x11f34){if(_0x11f34){var _0x454ec3=typeof _0x38f339[_0x4067('0x1c')]===_0x4067('0x1d')&&typeof _0x38f339[_0x4067('0x1e')]===_0x4067('0x1d');var _0x56c9d5=_0x11f34[_0x4067('0x1f')];var _0x307a80=_0x454ec3?0x0:_0x38f339[_0x4067('0x1c')];var _0x131d38=_0x454ec3?_0x11f34['count']:_0x38f339[_0x4067('0x1c')]+_0x38f339['limit'];var _0x54221f;if(_0x131d38>=_0x56c9d5){_0x131d38=_0x56c9d5;_0x54221f=0xc8;}else{_0x54221f=0xce;}_0x30c8b6[_0x4067('0x20')](_0x54221f);return _0x30c8b6['set'](_0x4067('0x21'),_0x307a80+'-'+_0x131d38+'/'+_0x56c9d5)[_0x4067('0x1b')](_0x11f34);}return null;};}function patchUpdates(_0x5d3975){return function(_0x217d22){try{jsonpatch[_0x4067('0x22')](_0x217d22,_0x5d3975,!![]);}catch(_0x4bc973){return BPromise[_0x4067('0x23')](_0x4bc973);}return _0x217d22[_0x4067('0x24')]();};}function saveUpdates(_0x27e001,_0x510c5f){return function(_0x49d69d){if(_0x49d69d){return _0x49d69d['update'](_0x27e001)['then'](function(_0x46463e){return _0x46463e;});}return null;};}function removeEntity(_0x1b5560,_0x55f4ff){return function(_0x589f2e){if(_0x589f2e){return _0x589f2e[_0x4067('0x25')]()[_0x4067('0x26')](function(){_0x1b5560[_0x4067('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x499d90,_0x4d2de5){return function(_0x14ef9a){if(!_0x14ef9a){_0x499d90[_0x4067('0x19')](0x194);}return _0x14ef9a;};}function handleError(_0x4ad17a,_0x50a9e){_0x50a9e=_0x50a9e||0x1f4;return function(_0x5168c5){logger[_0x4067('0x27')](_0x5168c5[_0x4067('0x28')]);if(_0x5168c5[_0x4067('0x29')]){delete _0x5168c5[_0x4067('0x29')];}_0x4ad17a[_0x4067('0x20')](_0x50a9e)[_0x4067('0x2a')](_0x5168c5);};}exports['index']=function(_0x4fa0ae,_0x2e5d95){var _0x489c8c={},_0x564080={},_0x33cfba={'count':0x0,'rows':[]};var _0x51a28c=_[_0x4067('0x2b')](db[_0x4067('0x2c')][_0x4067('0x2d')],function(_0x37c9c4){return{'name':_0x37c9c4['fieldName'],'type':_0x37c9c4[_0x4067('0x2e')][_0x4067('0x2f')]};});_0x564080[_0x4067('0x30')]=_['differenceBy'](_[_0x4067('0x2b')](_0x51a28c,'name'),[_0x4067('0x29')]);_0x564080[_0x4067('0x31')]=_[_0x4067('0x32')](_0x4fa0ae[_0x4067('0x31')]);_0x564080[_0x4067('0x33')]=_['intersection'](_0x564080[_0x4067('0x30')],_0x564080[_0x4067('0x31')]);_0x489c8c[_0x4067('0x34')]=_[_0x4067('0x35')](_0x564080['model'],qs[_0x4067('0x36')](_0x4fa0ae[_0x4067('0x31')]['fields']));_0x489c8c['attributes']=_0x489c8c[_0x4067('0x34')][_0x4067('0x37')]?_0x489c8c[_0x4067('0x34')]:_0x564080['model'];if(!_0x4fa0ae['query'][_0x4067('0x38')]('nolimit')){_0x489c8c[_0x4067('0x1e')]=qs[_0x4067('0x1e')](_0x4fa0ae['query']['limit']);_0x489c8c[_0x4067('0x1c')]=qs[_0x4067('0x1c')](_0x4fa0ae[_0x4067('0x31')][_0x4067('0x1c')]);}_0x489c8c[_0x4067('0x39')]=qs[_0x4067('0x3a')](_0x4fa0ae[_0x4067('0x31')]['sort']);_0x489c8c[_0x4067('0x3b')]=qs[_0x4067('0x33')](_[_0x4067('0x3c')](_0x4fa0ae[_0x4067('0x31')],_0x564080[_0x4067('0x33')]),_0x51a28c);if(_0x4fa0ae[_0x4067('0x31')]['filter']){_0x489c8c[_0x4067('0x3b')]=_[_0x4067('0x3d')](_0x489c8c[_0x4067('0x3b')],{'$or':_['map'](_0x51a28c,function(_0xbf5a3a){if(_0xbf5a3a[_0x4067('0x2e')]!=='VIRTUAL'){var _0x4bba3a={};_0x4bba3a[_0xbf5a3a['name']]={'$like':'%'+_0x4fa0ae[_0x4067('0x31')][_0x4067('0x3e')]+'%'};return _0x4bba3a;}})});}_0x489c8c=_[_0x4067('0x3d')]({},_0x489c8c,_0x4fa0ae[_0x4067('0x3f')]);var _0x1116f4={'where':_0x489c8c[_0x4067('0x3b')]};return db[_0x4067('0x2c')][_0x4067('0x1f')](_0x1116f4)['then'](function(_0x1e46cd){_0x33cfba[_0x4067('0x1f')]=_0x1e46cd;if(_0x4fa0ae[_0x4067('0x31')][_0x4067('0x40')]){_0x489c8c[_0x4067('0x41')]=[{'all':!![]}];}return db[_0x4067('0x2c')][_0x4067('0x42')](_0x489c8c);})[_0x4067('0x26')](function(_0x1de913){_0x33cfba[_0x4067('0x43')]=_0x1de913;return _0x33cfba;})[_0x4067('0x26')](respondWithFilteredResult(_0x2e5d95,_0x489c8c))[_0x4067('0x44')](handleError(_0x2e5d95,null));};exports[_0x4067('0x45')]=function(_0x1d1d00,_0xd39e6c){var _0x3596f5={'raw':!![],'where':{'id':_0x1d1d00[_0x4067('0x46')]['id']}},_0x4ce7c6={};_0x4ce7c6['model']=_[_0x4067('0x32')](db[_0x4067('0x2c')][_0x4067('0x2d')]);_0x4ce7c6[_0x4067('0x31')]=_[_0x4067('0x32')](_0x1d1d00[_0x4067('0x31')]);_0x4ce7c6[_0x4067('0x33')]=_['intersection'](_0x4ce7c6[_0x4067('0x30')],_0x4ce7c6['query']);_0x3596f5['attributes']=_[_0x4067('0x35')](_0x4ce7c6[_0x4067('0x30')],qs[_0x4067('0x36')](_0x1d1d00[_0x4067('0x31')][_0x4067('0x36')]));_0x3596f5[_0x4067('0x34')]=_0x3596f5['attributes'][_0x4067('0x37')]?_0x3596f5[_0x4067('0x34')]:_0x4ce7c6[_0x4067('0x30')];if(_0x1d1d00['query'][_0x4067('0x40')]){_0x3596f5[_0x4067('0x41')]=[{'all':!![]}];}_0x3596f5=_['merge']({},_0x3596f5,_0x1d1d00[_0x4067('0x3f')]);return db['CmCustomField'][_0x4067('0x47')](_0x3596f5)[_0x4067('0x26')](handleEntityNotFound(_0xd39e6c,null))['then'](respondWithResult(_0xd39e6c,null))['catch'](handleError(_0xd39e6c,null));};exports[_0x4067('0x48')]=function(_0x464f88,_0x2d1385){if(_0x464f88[_0x4067('0x49')]['id']){delete _0x464f88[_0x4067('0x49')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x464f88[_0x4067('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d1385,null))[_0x4067('0x26')](saveUpdates(_0x464f88[_0x4067('0x49')],null))[_0x4067('0x26')](respondWithResult(_0x2d1385,null))[_0x4067('0x44')](handleError(_0x2d1385,null));};exports[_0x4067('0x25')]=function(_0x25a6b8,_0x35d96b){return db[_0x4067('0x2c')][_0x4067('0x47')]({'where':{'id':_0x25a6b8[_0x4067('0x46')]['id']}})['then'](handleEntityNotFound(_0x35d96b,null))[_0x4067('0x26')](removeEntity(_0x35d96b,null))[_0x4067('0x44')](handleError(_0x35d96b,null));};exports[_0x4067('0x4a')]=function(_0x20d788,_0x5dbbbd){var _0x2298ff;return db[_0x4067('0x4b')][_0x4067('0x4c')](function(_0x348d2d){return db['CmCustomField']['create'](_0x20d788['body'],{'transaction':_0x348d2d})['then'](function(_0x328bff){_0x2298ff=_0x328bff;var _0x50c07f={'type':db[_0x4067('0x4d')][_0x4067('0x4e')],'transaction':_0x348d2d};switch(_0x20d788['body'][_0x4067('0x2e')]){case'text':_0x50c07f[_0x4067('0x2e')]=db['Sequelize'][_0x4067('0x4e')];break;case _0x4067('0x4f'):_0x50c07f[_0x4067('0x2e')]=db['Sequelize'][_0x4067('0x50')];break;case _0x4067('0x51'):_0x50c07f[_0x4067('0x2e')]=db[_0x4067('0x4d')][_0x4067('0x52')];_0x50c07f['defaultValue']=![];break;default:}return db['sequelize']['queryInterface']['addColumn'](_0x4067('0x53'),util[_0x4067('0x54')](_0x4067('0x55'),_0x2298ff['id']),_0x50c07f);})['then'](function(){return _0x2298ff;});})['then'](respondWithResult(_0x5dbbbd,0xc9))[_0x4067('0x44')](handleError(_0x5dbbbd,null));}; \ No newline at end of file +var _0x6df1=['options','include','findAll','rows','catch','show','params','includeAll','find','body','create','transaction','Sequelize','text','TEXT','number','INTEGER','switch','sequelize','addColumn','cm_contacts','format','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x10ced8,_0x3e72d7){var _0x2cb1fb=function(_0x4b3182){while(--_0x4b3182){_0x10ced8['push'](_0x10ced8['shift']());}};_0x2cb1fb(++_0x3e72d7);}(_0x6df1,0x1e8));var _0x16df=function(_0x1bd224,_0x4ff3cd){_0x1bd224=_0x1bd224-0x0;var _0x12f4e6=_0x6df1[_0x1bd224];return _0x12f4e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x16df('0x0'));var zipdir=require(_0x16df('0x1'));var jsonpatch=require(_0x16df('0x2'));var rp=require(_0x16df('0x3'));var moment=require(_0x16df('0x4'));var BPromise=require(_0x16df('0x5'));var Mustache=require(_0x16df('0x6'));var util=require('util');var path=require('path');var sox=require(_0x16df('0x7'));var csv=require(_0x16df('0x8'));var ejs=require(_0x16df('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x16df('0xa'));var squel=require(_0x16df('0xb'));var crypto=require(_0x16df('0xc'));var jsforce=require(_0x16df('0xd'));var deskjs=require(_0x16df('0xe'));var toCsv=require('to-csv');var querystring=require(_0x16df('0xf'));var Papa=require(_0x16df('0x10'));var Redis=require(_0x16df('0x11'));var authService=require(_0x16df('0x12'));var qs=require(_0x16df('0x13'));var as=require(_0x16df('0x14'));var hardwareService=require(_0x16df('0x15'));var logger=require(_0x16df('0x16'))(_0x16df('0x17'));var utils=require('../../config/utils');var config=require(_0x16df('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x16df('0x19'))['db'];function respondWithStatusCode(_0x96d9f7,_0x641d20){_0x641d20=_0x641d20||0xcc;return function(_0x219b16){if(_0x219b16){return _0x96d9f7['sendStatus'](_0x641d20);}return _0x96d9f7[_0x16df('0x1a')](_0x641d20)['end']();};}function respondWithResult(_0x34bb36,_0x4b06c9){_0x4b06c9=_0x4b06c9||0xc8;return function(_0x411cc7){if(_0x411cc7){return _0x34bb36[_0x16df('0x1a')](_0x4b06c9)[_0x16df('0x1b')](_0x411cc7);}};}function respondWithFilteredResult(_0x1017cd,_0x3a11dd){return function(_0x580bfc){if(_0x580bfc){var _0x3b136f=typeof _0x3a11dd[_0x16df('0x1c')]===_0x16df('0x1d')&&typeof _0x3a11dd[_0x16df('0x1e')]===_0x16df('0x1d');var _0x4d7d62=_0x580bfc[_0x16df('0x1f')];var _0x516fe5=_0x3b136f?0x0:_0x3a11dd[_0x16df('0x1c')];var _0xcbc42d=_0x3b136f?_0x580bfc['count']:_0x3a11dd['offset']+_0x3a11dd['limit'];var _0xdac9ab;if(_0xcbc42d>=_0x4d7d62){_0xcbc42d=_0x4d7d62;_0xdac9ab=0xc8;}else{_0xdac9ab=0xce;}_0x1017cd[_0x16df('0x1a')](_0xdac9ab);return _0x1017cd[_0x16df('0x20')](_0x16df('0x21'),_0x516fe5+'-'+_0xcbc42d+'/'+_0x4d7d62)[_0x16df('0x1b')](_0x580bfc);}return null;};}function patchUpdates(_0x5d0910){return function(_0x4622e7){try{jsonpatch[_0x16df('0x22')](_0x4622e7,_0x5d0910,!![]);}catch(_0x1b4c41){return BPromise[_0x16df('0x23')](_0x1b4c41);}return _0x4622e7[_0x16df('0x24')]();};}function saveUpdates(_0x2954d8,_0x115250){return function(_0x4e3ee4){if(_0x4e3ee4){return _0x4e3ee4[_0x16df('0x25')](_0x2954d8)[_0x16df('0x26')](function(_0x274ea8){return _0x274ea8;});}return null;};}function removeEntity(_0x1d5d9c,_0x447cdd){return function(_0x3a5eaa){if(_0x3a5eaa){return _0x3a5eaa[_0x16df('0x27')]()['then'](function(){_0x1d5d9c[_0x16df('0x1a')](0xcc)[_0x16df('0x28')]();});}};}function handleEntityNotFound(_0xb24c04,_0x661a60){return function(_0x17cdda){if(!_0x17cdda){_0xb24c04[_0x16df('0x29')](0x194);}return _0x17cdda;};}function handleError(_0x47b976,_0x381a13){_0x381a13=_0x381a13||0x1f4;return function(_0x5a3ee4){logger[_0x16df('0x2a')](_0x5a3ee4[_0x16df('0x2b')]);if(_0x5a3ee4[_0x16df('0x2c')]){delete _0x5a3ee4[_0x16df('0x2c')];}_0x47b976[_0x16df('0x1a')](_0x381a13)[_0x16df('0x2d')](_0x5a3ee4);};}exports[_0x16df('0x2e')]=function(_0x46d608,_0x2b5544){var _0x4e6f68={},_0x47e778={},_0x3c9824={'count':0x0,'rows':[]};var _0x6b351c=_[_0x16df('0x2f')](db[_0x16df('0x30')][_0x16df('0x31')],function(_0xa59eaf){return{'name':_0xa59eaf[_0x16df('0x32')],'type':_0xa59eaf[_0x16df('0x33')][_0x16df('0x34')]};});_0x47e778[_0x16df('0x35')]=_[_0x16df('0x36')](_['map'](_0x6b351c,'name'),['name']);_0x47e778[_0x16df('0x37')]=_[_0x16df('0x38')](_0x46d608['query']);_0x47e778[_0x16df('0x39')]=_[_0x16df('0x3a')](_0x47e778[_0x16df('0x35')],_0x47e778[_0x16df('0x37')]);_0x4e6f68[_0x16df('0x3b')]=_[_0x16df('0x3a')](_0x47e778[_0x16df('0x35')],qs['fields'](_0x46d608['query'][_0x16df('0x3c')]));_0x4e6f68[_0x16df('0x3b')]=_0x4e6f68[_0x16df('0x3b')][_0x16df('0x3d')]?_0x4e6f68[_0x16df('0x3b')]:_0x47e778['model'];if(!_0x46d608[_0x16df('0x37')][_0x16df('0x3e')](_0x16df('0x3f'))){_0x4e6f68[_0x16df('0x1e')]=qs[_0x16df('0x1e')](_0x46d608[_0x16df('0x37')][_0x16df('0x1e')]);_0x4e6f68[_0x16df('0x1c')]=qs[_0x16df('0x1c')](_0x46d608[_0x16df('0x37')]['offset']);}_0x4e6f68[_0x16df('0x40')]=qs['sort'](_0x46d608[_0x16df('0x37')]['sort']);_0x4e6f68[_0x16df('0x41')]=qs['filters'](_[_0x16df('0x42')](_0x46d608[_0x16df('0x37')],_0x47e778[_0x16df('0x39')]),_0x6b351c);if(_0x46d608['query'][_0x16df('0x43')]){_0x4e6f68['where']=_[_0x16df('0x44')](_0x4e6f68['where'],{'$or':_[_0x16df('0x2f')](_0x6b351c,function(_0x273658){if(_0x273658[_0x16df('0x33')]!==_0x16df('0x45')){var _0x345b21={};_0x345b21[_0x273658['name']]={'$like':'%'+_0x46d608[_0x16df('0x37')][_0x16df('0x43')]+'%'};return _0x345b21;}})});}_0x4e6f68=_[_0x16df('0x44')]({},_0x4e6f68,_0x46d608[_0x16df('0x46')]);var _0x1101aa={'where':_0x4e6f68[_0x16df('0x41')]};return db[_0x16df('0x30')][_0x16df('0x1f')](_0x1101aa)[_0x16df('0x26')](function(_0x4075f5){_0x3c9824[_0x16df('0x1f')]=_0x4075f5;if(_0x46d608[_0x16df('0x37')]['includeAll']){_0x4e6f68[_0x16df('0x47')]=[{'all':!![]}];}return db['CmCustomField'][_0x16df('0x48')](_0x4e6f68);})['then'](function(_0x5843f5){_0x3c9824[_0x16df('0x49')]=_0x5843f5;return _0x3c9824;})['then'](respondWithFilteredResult(_0x2b5544,_0x4e6f68))[_0x16df('0x4a')](handleError(_0x2b5544,null));};exports[_0x16df('0x4b')]=function(_0x3d440b,_0x238474){var _0x3c207f={'raw':!![],'where':{'id':_0x3d440b[_0x16df('0x4c')]['id']}},_0x50310c={};_0x50310c[_0x16df('0x35')]=_['keys'](db[_0x16df('0x30')][_0x16df('0x31')]);_0x50310c[_0x16df('0x37')]=_['keys'](_0x3d440b['query']);_0x50310c[_0x16df('0x39')]=_[_0x16df('0x3a')](_0x50310c[_0x16df('0x35')],_0x50310c['query']);_0x3c207f[_0x16df('0x3b')]=_[_0x16df('0x3a')](_0x50310c[_0x16df('0x35')],qs[_0x16df('0x3c')](_0x3d440b[_0x16df('0x37')]['fields']));_0x3c207f[_0x16df('0x3b')]=_0x3c207f[_0x16df('0x3b')]['length']?_0x3c207f[_0x16df('0x3b')]:_0x50310c[_0x16df('0x35')];if(_0x3d440b[_0x16df('0x37')][_0x16df('0x4d')]){_0x3c207f[_0x16df('0x47')]=[{'all':!![]}];}_0x3c207f=_[_0x16df('0x44')]({},_0x3c207f,_0x3d440b['options']);return db[_0x16df('0x30')][_0x16df('0x4e')](_0x3c207f)['then'](handleEntityNotFound(_0x238474,null))['then'](respondWithResult(_0x238474,null))[_0x16df('0x4a')](handleError(_0x238474,null));};exports[_0x16df('0x25')]=function(_0x656ac0,_0xc8f3c4){if(_0x656ac0[_0x16df('0x4f')]['id']){delete _0x656ac0[_0x16df('0x4f')]['id'];}return db[_0x16df('0x30')][_0x16df('0x4e')]({'where':{'id':_0x656ac0[_0x16df('0x4c')]['id']}})[_0x16df('0x26')](handleEntityNotFound(_0xc8f3c4,null))[_0x16df('0x26')](saveUpdates(_0x656ac0[_0x16df('0x4f')],null))['then'](respondWithResult(_0xc8f3c4,null))[_0x16df('0x4a')](handleError(_0xc8f3c4,null));};exports['destroy']=function(_0x55995a,_0x59b5aa){return db['CmCustomField'][_0x16df('0x4e')]({'where':{'id':_0x55995a[_0x16df('0x4c')]['id']}})['then'](handleEntityNotFound(_0x59b5aa,null))['then'](removeEntity(_0x59b5aa,null))['catch'](handleError(_0x59b5aa,null));};exports[_0x16df('0x50')]=function(_0x4fd1b7,_0x1a9440){var _0xc88a63;return db['sequelize'][_0x16df('0x51')](function(_0x350d9){return db[_0x16df('0x30')][_0x16df('0x50')](_0x4fd1b7[_0x16df('0x4f')],{'transaction':_0x350d9})[_0x16df('0x26')](function(_0x2ef6fd){_0xc88a63=_0x2ef6fd;var _0x22baa0={'type':db[_0x16df('0x52')]['TEXT'],'transaction':_0x350d9};switch(_0x4fd1b7[_0x16df('0x4f')][_0x16df('0x33')]){case _0x16df('0x53'):_0x22baa0[_0x16df('0x33')]=db['Sequelize'][_0x16df('0x54')];break;case _0x16df('0x55'):_0x22baa0[_0x16df('0x33')]=db[_0x16df('0x52')][_0x16df('0x56')];break;case _0x16df('0x57'):_0x22baa0['type']=db[_0x16df('0x52')]['BOOLEAN'];_0x22baa0['defaultValue']=![];break;default:}return db[_0x16df('0x58')]['queryInterface'][_0x16df('0x59')](_0x16df('0x5a'),util[_0x16df('0x5b')](_0x16df('0x5c'),_0xc88a63['id']),_0x22baa0);})[_0x16df('0x26')](function(){return _0xc88a63;});})['then'](respondWithResult(_0x1a9440,0xc9))[_0x16df('0x4a')](handleError(_0x1a9440,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 18d8553..c58adcf 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 _0xf045=['cm_custom_fields','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','CmCustomField'];(function(_0x336037,_0xb9b8a9){var _0x4f1a72=function(_0x4c4230){while(--_0x4c4230){_0x336037['push'](_0x336037['shift']());}};_0x4f1a72(++_0xb9b8a9);}(_0xf045,0xd9));var _0x5f04=function(_0x3c2527,_0x119897){_0x3c2527=_0x3c2527-0x0;var _0x52babb=_0xf045[_0x3c2527];return _0x52babb;};'use strict';var _=require(_0x5f04('0x0'));var util=require(_0x5f04('0x1'));var logger=require('../../config/logger')(_0x5f04('0x2'));var moment=require(_0x5f04('0x3'));var BPromise=require(_0x5f04('0x4'));var rp=require(_0x5f04('0x5'));var fs=require('fs');var path=require(_0x5f04('0x6'));var rimraf=require('rimraf');var config=require(_0x5f04('0x7'));var attributes=require('./cmCustomField.attributes');module[_0x5f04('0x8')]=function(_0x533118,_0x2deb0d){return _0x533118[_0x5f04('0x9')](_0x5f04('0xa'),attributes,{'tableName':_0x5f04('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a6b=['cm_custom_fields','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define'];(function(_0x4bab7c,_0x4dddf5){var _0xe8e5f3=function(_0x2cb48e){while(--_0x2cb48e){_0x4bab7c['push'](_0x4bab7c['shift']());}};_0xe8e5f3(++_0x4dddf5);}(_0x4a6b,0x194));var _0xb4a6=function(_0x64c934,_0x43436b){_0x64c934=_0x64c934-0x0;var _0x470d6b=_0x4a6b[_0x64c934];return _0x470d6b;};'use strict';var _=require(_0xb4a6('0x0'));var util=require(_0xb4a6('0x1'));var logger=require('../../config/logger')(_0xb4a6('0x2'));var moment=require(_0xb4a6('0x3'));var BPromise=require(_0xb4a6('0x4'));var rp=require(_0xb4a6('0x5'));var fs=require('fs');var path=require(_0xb4a6('0x6'));var rimraf=require(_0xb4a6('0x7'));var config=require(_0xb4a6('0x8'));var attributes=require(_0xb4a6('0x9'));module[_0xb4a6('0xa')]=function(_0x489599,_0x2d386b){return _0x489599[_0xb4a6('0xb')]('CmCustomField',attributes,{'tableName':_0xb4a6('0xc'),'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 9f31ab2..4b1f747 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 _0x85ff=['../../config/environment','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x85ff,0x163));var _0xf85f=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x85ff[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf85f('0x0'));var fs=require('fs');var Redis=require(_0xf85f('0x1'));var db=require(_0xf85f('0x2'))['db'];var utils=require(_0xf85f('0x3'));var logger=require(_0xf85f('0x4'))('rpc');var config=require(_0xf85f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf85f('0x6')][_0xf85f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4df1c3,_0xb9bac,_0x1a1b07){return new BPromise(function(_0x26ee0f,_0x198384){return client[_0xf85f('0x8')](_0x4df1c3,_0x1a1b07)[_0xf85f('0x9')](function(_0x4e8090){logger['info'](_0xf85f('0xa'),_0xb9bac,_0xf85f('0xb'));logger[_0xf85f('0xc')](_0xf85f('0xd'),_0xb9bac,_0xf85f('0xb'),JSON[_0xf85f('0xe')](_0x4e8090));if(_0x4e8090[_0xf85f('0xf')]){if(_0x4e8090[_0xf85f('0xf')][_0xf85f('0x10')]===0x1f4){logger['error'](_0xf85f('0xa'),_0xb9bac,_0x4e8090[_0xf85f('0xf')][_0xf85f('0x11')]);return _0x198384(_0x4e8090[_0xf85f('0xf')]['message']);}logger[_0xf85f('0xf')](_0xf85f('0xa'),_0xb9bac,_0x4e8090[_0xf85f('0xf')][_0xf85f('0x11')]);return _0x26ee0f(_0x4e8090[_0xf85f('0xf')][_0xf85f('0x11')]);}else{logger[_0xf85f('0x12')]('CmCustomField,\x20%s,\x20%s',_0xb9bac,'request\x20sent');_0x26ee0f(_0x4e8090[_0xf85f('0x13')][_0xf85f('0x11')]);}})['catch'](function(_0x4946d3){logger[_0xf85f('0xf')](_0xf85f('0xa'),_0xb9bac,_0x4946d3);_0x198384(_0x4946d3);});});} \ No newline at end of file +var _0xd7a3=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','debug','request\x20sent','error','code','CmCustomField,\x20%s,\x20%s'];(function(_0x2bc3ca,_0x5759e6){var _0x19ce1b=function(_0x6bd2d1){while(--_0x6bd2d1){_0x2bc3ca['push'](_0x2bc3ca['shift']());}};_0x19ce1b(++_0x5759e6);}(_0xd7a3,0x1a5));var _0x3d7a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xd7a3[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x3d7a('0x0'));var util=require(_0x3d7a('0x1'));var moment=require(_0x3d7a('0x2'));var BPromise=require(_0x3d7a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d7a('0x4'));var db=require(_0x3d7a('0x5'))['db'];var utils=require(_0x3d7a('0x6'));var logger=require(_0x3d7a('0x7'))(_0x3d7a('0x8'));var config=require(_0x3d7a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3d7a('0xa')][_0x3d7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x324b7a,_0x2cebaf,_0x3334cb){return new BPromise(function(_0x2607a8,_0x4f1199){return client[_0x3d7a('0xc')](_0x324b7a,_0x3334cb)['then'](function(_0x333c3c){logger[_0x3d7a('0xd')]('CmCustomField,\x20%s,\x20%s',_0x2cebaf,'request\x20sent');logger[_0x3d7a('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x2cebaf,_0x3d7a('0xf'),JSON['stringify'](_0x333c3c));if(_0x333c3c[_0x3d7a('0x10')]){if(_0x333c3c['error'][_0x3d7a('0x11')]===0x1f4){logger[_0x3d7a('0x10')](_0x3d7a('0x12'),_0x2cebaf,_0x333c3c[_0x3d7a('0x10')][_0x3d7a('0x13')]);return _0x4f1199(_0x333c3c[_0x3d7a('0x10')][_0x3d7a('0x13')]);}logger['error'](_0x3d7a('0x12'),_0x2cebaf,_0x333c3c['error']['message']);return _0x2607a8(_0x333c3c[_0x3d7a('0x10')][_0x3d7a('0x13')]);}else{logger[_0x3d7a('0xd')](_0x3d7a('0x12'),_0x2cebaf,_0x3d7a('0xf'));_0x2607a8(_0x333c3c[_0x3d7a('0x14')][_0x3d7a('0x13')]);}})[_0x3d7a('0x15')](function(_0x355320){logger[_0x3d7a('0x10')](_0x3d7a('0x12'),_0x2cebaf,_0x355320);_0x4f1199(_0x355320);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index cbe1848..f338546 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 _0xe2af=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','/:id','show','post','isAuthenticated','put','update','destroy','exports','util','path'];(function(_0x54edb9,_0x4ca3c5){var _0x35c9f6=function(_0x2b0d55){while(--_0x2b0d55){_0x54edb9['push'](_0x54edb9['shift']());}};_0x35c9f6(++_0x4ca3c5);}(_0xe2af,0x6a));var _0xfe2a=function(_0x6b8fa5,_0x4120ce){_0x6b8fa5=_0x6b8fa5-0x0;var _0x404621=_0xe2af[_0x6b8fa5];return _0x404621;};'use strict';var multer=require('multer');var util=require(_0xfe2a('0x0'));var path=require(_0xfe2a('0x1'));var timeout=require(_0xfe2a('0x2'));var express=require(_0xfe2a('0x3'));var router=express[_0xfe2a('0x4')]();var fs_extra=require(_0xfe2a('0x5'));var auth=require(_0xfe2a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfe2a('0x7'));var controller=require(_0xfe2a('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfe2a('0x9')](_0xfe2a('0xa'),auth['isAuthenticated'](),controller[_0xfe2a('0xb')]);router[_0xfe2a('0xc')]('/',auth[_0xfe2a('0xd')](),controller['create']);router[_0xfe2a('0xe')](_0xfe2a('0xa'),auth['isAuthenticated'](),controller[_0xfe2a('0xf')]);router['delete'](_0xfe2a('0xa'),auth[_0xfe2a('0xd')](),controller[_0xfe2a('0x10')]);module[_0xfe2a('0x11')]=router; \ No newline at end of file +var _0x6dec=['put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x2e0257,_0x2cbd14){var _0x3d49b4=function(_0x4067b0){while(--_0x4067b0){_0x2e0257['push'](_0x2e0257['shift']());}};_0x3d49b4(++_0x2cbd14);}(_0x6dec,0x10e));var _0xc6de=function(_0x127862,_0xb5cb16){_0x127862=_0x127862-0x0;var _0xd0531d=_0x6dec[_0x127862];return _0xd0531d;};'use strict';var multer=require(_0xc6de('0x0'));var util=require('util');var path=require(_0xc6de('0x1'));var timeout=require(_0xc6de('0x2'));var express=require(_0xc6de('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6de('0x4'));var interaction=require(_0xc6de('0x5'));var config=require(_0xc6de('0x6'));var controller=require(_0xc6de('0x7'));router[_0xc6de('0x8')]('/',auth[_0xc6de('0x9')](),controller[_0xc6de('0xa')]);router[_0xc6de('0x8')](_0xc6de('0xb'),auth[_0xc6de('0x9')](),controller[_0xc6de('0xc')]);router[_0xc6de('0xd')]('/',auth[_0xc6de('0x9')](),controller[_0xc6de('0xe')]);router[_0xc6de('0xf')](_0xc6de('0xb'),auth[_0xc6de('0x9')](),controller['update']);router[_0xc6de('0x10')](_0xc6de('0xb'),auth[_0xc6de('0x9')](),controller[_0xc6de('0x11')]);module[_0xc6de('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 6112bb4..eca0a16 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 _0x6e92=['STRING','UNSIGNED','contactListQueue','sequelize','DATE','INTEGER','BOOLEAN'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x6e92,0x7a));var _0x26e9=function(_0x41216a,_0x53e83d){_0x41216a=_0x41216a-0x0;var _0x122cf1=_0x6e92[_0x41216a];return _0x122cf1;};'use strict';var moment=require('moment');var Sequelize=require(_0x26e9('0x0'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x26e9('0x1')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x26e9('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x26e9('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x26e9('0x2')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x26e9('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x26e9('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x26e9('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x26e9('0x2')],'unique':_0x26e9('0x6')},'ListId':{'type':Sequelize[_0x26e9('0x2')],'unique':_0x26e9('0x6')},'UserId':{'type':Sequelize[_0x26e9('0x2')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x26e9('0x6')},'CampaignId':{'type':Sequelize[_0x26e9('0x2')]},'countnosuchnumberretry':{'type':Sequelize[_0x26e9('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x26e9('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x26e9('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x26e9('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x26e9('0x2')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x26e9('0x2')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x26e9('0x4')]},'recallmeNotifiedDate':{'type':Sequelize[_0x26e9('0x1')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x27e7=['STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x27e7,0x15d));var _0x727e=function(_0x46d7e1,_0x2fa6e8){_0x46d7e1=_0x46d7e1-0x0;var _0x1270d1=_0x27e7[_0x46d7e1];return _0x1270d1;};'use strict';var moment=require(_0x727e('0x0'));var Sequelize=require(_0x727e('0x1'));module[_0x727e('0x2')]={'phone':{'type':Sequelize[_0x727e('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x727e('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x727e('0x5')],'defaultValue':moment()[_0x727e('0x6')](_0x727e('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x727e('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x727e('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x727e('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x727e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x727e('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x727e('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x727e('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x727e('0x8')],'unique':_0x727e('0xa')},'ListId':{'type':Sequelize[_0x727e('0x8')],'unique':_0x727e('0xa')},'UserId':{'type':Sequelize[_0x727e('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x727e('0x8')],'unique':_0x727e('0xa')},'CampaignId':{'type':Sequelize[_0x727e('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0x727e('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x727e('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x727e('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x727e('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x727e('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x727e('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index ea787fe..67e1e4e 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 _0xa3e6=['ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','create','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','findOne','scheduledat','phone','recallme','UPDATE','Contact','CmCompany','Company','VoiceQueue','Queue','dialActive','getPreviewRecall','LOCK','CmList','List','error','getOpenContacts','entity\x20not\x20found','push','utcOffset','timezones','moment','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','update','then','sendStatus','stack','name','map','CmHopper','rawAttributes','fieldName','key','query','keys','intersection','model','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','params','fields','find','catch','body','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','deleted','campaign','membername','user','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype'];(function(_0x3b1b5b,_0x27cfed){var _0x48bf1b=function(_0x1791b2){while(--_0x1791b2){_0x3b1b5b['push'](_0x3b1b5b['shift']());}};_0x48bf1b(++_0x27cfed);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x2cc058,_0x38d356){_0x2cc058=_0x2cc058-0x0;var _0x39af13=_0xa3e6[_0x2cc058];return _0x39af13;};'use strict';var moment=require(_0x6a3e('0x0'));var _=require('lodash');var qs=require(_0x6a3e('0x1'));var logger=require('../../config/logger')(_0x6a3e('0x2'));var shared=require(_0x6a3e('0x3'));var db=require(_0x6a3e('0x4'))['db'];function respondWithResult(_0x56e3f4,_0xe03261){_0xe03261=_0xe03261||0xc8;return function(_0x5e9a85){if(_0x5e9a85){return _0x56e3f4[_0x6a3e('0x5')](_0xe03261)[_0x6a3e('0x6')](_0x5e9a85);}};}function respondWithFilteredResult(_0x1c7709,_0x315ed8){return function(_0x19dd88){if(_0x19dd88){var _0x52a2f8=typeof _0x315ed8[_0x6a3e('0x7')]===_0x6a3e('0x8')&&typeof _0x315ed8['limit']==='undefined';var _0x2d2477=_0x19dd88['count'];var _0x54a40c=_0x52a2f8?0x0:_0x315ed8[_0x6a3e('0x7')];var _0x4f5a4a=_0x52a2f8?_0x19dd88[_0x6a3e('0x9')]:_0x315ed8['offset']+_0x315ed8[_0x6a3e('0xa')];var _0x3159db;if(_0x4f5a4a>=_0x2d2477){_0x4f5a4a=_0x2d2477;_0x3159db=0xc8;}else{_0x3159db=0xce;}_0x1c7709[_0x6a3e('0x5')](_0x3159db);return _0x1c7709[_0x6a3e('0xb')](_0x6a3e('0xc'),_0x54a40c+'-'+_0x4f5a4a+'/'+_0x2d2477)[_0x6a3e('0x6')](_0x19dd88);}return null;};}function saveUpdates(_0x4a3a97,_0x27e169){return function(_0x385c29){if(_0x385c29){return _0x385c29[_0x6a3e('0xd')](_0x4a3a97)[_0x6a3e('0xe')](function(_0x1364be){return _0x1364be;});}return null;};}function handleEntityNotFound(_0x31aefa,_0x222f7c){return function(_0x4bd05f){if(!_0x4bd05f){_0x31aefa[_0x6a3e('0xf')](0x194);}return _0x4bd05f;};}function handleError(_0x13b172,_0x8ed74b){_0x8ed74b=_0x8ed74b||0x1f4;return function(_0x2a62a8){logger['error'](_0x2a62a8[_0x6a3e('0x10')]);if(_0x2a62a8[_0x6a3e('0x11')]){delete _0x2a62a8['name'];}_0x13b172['status'](_0x8ed74b)['send'](_0x2a62a8);};}exports['index']=function(_0x48adf6,_0x3693a2){var _0x467e2c={},_0x31a190={},_0x701d04={'count':0x0,'rows':[]};var _0x17fde0=_[_0x6a3e('0x12')](db[_0x6a3e('0x13')][_0x6a3e('0x14')],function(_0x493454){return{'name':_0x493454[_0x6a3e('0x15')],'type':_0x493454['type'][_0x6a3e('0x16')]};});_0x31a190['model']=_[_0x6a3e('0x12')](_0x17fde0,_0x6a3e('0x11'));_0x31a190[_0x6a3e('0x17')]=_[_0x6a3e('0x18')](_0x48adf6['query']);_0x31a190['filters']=_[_0x6a3e('0x19')](_0x31a190[_0x6a3e('0x1a')],_0x31a190[_0x6a3e('0x17')]);_0x31a190[_0x6a3e('0x1b')]=_[_0x6a3e('0x1c')](_0x31a190[_0x6a3e('0x1b')],[_0x6a3e('0x1d'),_0x6a3e('0x1e'),_0x6a3e('0x1f'),_0x6a3e('0x20'),_0x6a3e('0x21'),_0x6a3e('0x22'),_0x6a3e('0x23'),_0x6a3e('0x24'),_0x6a3e('0x25'),'$between','$notBetween',_0x6a3e('0x26'),_0x6a3e('0x27'),_0x6a3e('0x28'),_0x6a3e('0x29'),_0x6a3e('0x2a'),_0x6a3e('0x2b'),_0x6a3e('0x28'),_0x6a3e('0x2c'),_0x6a3e('0x2d'),_0x6a3e('0x2e'),_0x6a3e('0x2f')]);_0x467e2c['attributes']=_['intersection'](_0x31a190[_0x6a3e('0x1a')],qs['fields'](_0x48adf6[_0x6a3e('0x17')]['fields']));_0x467e2c['attributes']=_0x467e2c[_0x6a3e('0x30')][_0x6a3e('0x31')]?_0x467e2c['attributes']:_0x31a190['model'];if(!_0x48adf6[_0x6a3e('0x17')][_0x6a3e('0x32')](_0x6a3e('0x33'))){_0x467e2c[_0x6a3e('0xa')]=qs['limit'](_0x48adf6['query'][_0x6a3e('0xa')]);_0x467e2c[_0x6a3e('0x7')]=qs[_0x6a3e('0x7')](_0x48adf6[_0x6a3e('0x17')]['offset']);}_0x467e2c[_0x6a3e('0x34')]=qs[_0x6a3e('0x35')](_0x48adf6['query']['sort']);_0x467e2c['where']=qs[_0x6a3e('0x1b')](_[_0x6a3e('0x36')](_0x48adf6[_0x6a3e('0x17')],_0x31a190[_0x6a3e('0x1b')]),_0x17fde0);if(_0x48adf6[_0x6a3e('0x17')][_0x6a3e('0x37')]){_0x467e2c[_0x6a3e('0x38')]=_[_0x6a3e('0x39')](_0x467e2c[_0x6a3e('0x38')],{'$or':_[_0x6a3e('0x12')](_0x17fde0,function(_0xe442a9){if(_0xe442a9[_0x6a3e('0x3a')]!==_0x6a3e('0x3b')){var _0x12469a={};_0x12469a[_0xe442a9[_0x6a3e('0x11')]]={'$like':'%'+_0x48adf6['query'][_0x6a3e('0x37')]+'%'};return _0x12469a;}})});}_0x467e2c=_[_0x6a3e('0x39')]({},_0x467e2c,_0x48adf6[_0x6a3e('0x3c')]);var _0x5cf995={'where':_0x467e2c[_0x6a3e('0x38')]};return db[_0x6a3e('0x13')]['count'](_0x5cf995)[_0x6a3e('0xe')](function(_0x3f7e1){_0x701d04[_0x6a3e('0x9')]=_0x3f7e1;if(_0x48adf6['query'][_0x6a3e('0x3d')]){_0x467e2c[_0x6a3e('0x3e')]=[{'all':!![]}];}return db[_0x6a3e('0x13')][_0x6a3e('0x3f')](_0x467e2c);})[_0x6a3e('0xe')](function(_0x1f7d13){_0x701d04['rows']=_0x1f7d13;return _0x701d04;})[_0x6a3e('0xe')](respondWithFilteredResult(_0x3693a2,_0x467e2c))['catch'](handleError(_0x3693a2,null));};exports['show']=function(_0x4bc630,_0xfbbb78){var _0x4bb1ba={'raw':!![],'where':{'id':_0x4bc630[_0x6a3e('0x40')]['id']}},_0x1a6b68={};_0x1a6b68[_0x6a3e('0x1a')]=_[_0x6a3e('0x18')](db[_0x6a3e('0x13')][_0x6a3e('0x14')]);_0x1a6b68['query']=_['keys'](_0x4bc630[_0x6a3e('0x17')]);_0x1a6b68[_0x6a3e('0x1b')]=_[_0x6a3e('0x19')](_0x1a6b68[_0x6a3e('0x1a')],_0x1a6b68[_0x6a3e('0x17')]);_0x4bb1ba['attributes']=_[_0x6a3e('0x19')](_0x1a6b68[_0x6a3e('0x1a')],qs['fields'](_0x4bc630[_0x6a3e('0x17')][_0x6a3e('0x41')]));_0x4bb1ba[_0x6a3e('0x30')]=_0x4bb1ba['attributes'][_0x6a3e('0x31')]?_0x4bb1ba[_0x6a3e('0x30')]:_0x1a6b68[_0x6a3e('0x1a')];if(_0x4bc630[_0x6a3e('0x17')][_0x6a3e('0x3d')]){_0x4bb1ba[_0x6a3e('0x3e')]=[{'all':!![]}];}_0x4bb1ba=_['merge']({},_0x4bb1ba,_0x4bc630[_0x6a3e('0x3c')]);return db[_0x6a3e('0x13')][_0x6a3e('0x42')](_0x4bb1ba)['then'](handleEntityNotFound(_0xfbbb78,null))[_0x6a3e('0xe')](respondWithResult(_0xfbbb78,null))['catch'](handleError(_0xfbbb78,null));};exports['create']=function(_0x1b801e,_0x2788a8){return db[_0x6a3e('0x13')]['create'](_0x1b801e['body'],{})[_0x6a3e('0xe')](respondWithResult(_0x2788a8,0xc9))[_0x6a3e('0x43')](handleError(_0x2788a8,null));};exports[_0x6a3e('0xd')]=function(_0x320530,_0x1c9f75){if(_0x320530[_0x6a3e('0x44')]['id']){delete _0x320530['body']['id'];}return db[_0x6a3e('0x13')][_0x6a3e('0x42')]({'where':{'id':_0x320530[_0x6a3e('0x40')]['id']}})[_0x6a3e('0xe')](handleEntityNotFound(_0x1c9f75,null))[_0x6a3e('0xe')](saveUpdates(_0x320530[_0x6a3e('0x44')],null))[_0x6a3e('0xe')](respondWithResult(_0x1c9f75,null))[_0x6a3e('0x43')](handleError(_0x1c9f75,null));};exports[_0x6a3e('0x45')]=function(_0x4d36e2,_0x40a09d){return db[_0x6a3e('0x13')]['describe']()[_0x6a3e('0xe')](respondWithResult(_0x40a09d,null))['catch'](handleError(_0x40a09d,null));};exports[_0x6a3e('0x46')]=function(_0x10cd8e,_0x28a3e9){var _0x4f288d;var _0x25fa0c=_0x10cd8e[_0x6a3e('0x40')]['id'];return db['CmHopper']['find']({'where':{'id':_0x10cd8e['params']['id']}})[_0x6a3e('0xe')](handleEntityNotFound(_0x28a3e9,null))[_0x6a3e('0xe')](function(_0x32fb36){if(_0x32fb36){return _0x32fb36[_0x6a3e('0x46')]()[_0x6a3e('0xe')](function(_0x448e46){return _0x448e46;});}})[_0x6a3e('0xe')](function(_0x1ce964){_0x4f288d=_0x1ce964;if(_0x1ce964){if(_0x1ce964[_0x6a3e('0x47')]||_0x1ce964[_0x6a3e('0x48')]){return db[_0x1ce964[_0x6a3e('0x47')]?'VoiceQueue':_0x6a3e('0x49')][_0x6a3e('0x42')]({'where':{'id':_0x1ce964[_0x6a3e('0x47')]?_0x1ce964[_0x6a3e('0x47')]:_0x1ce964[_0x6a3e('0x48')]},'attributes':['id','name'],'raw':!![]});}}})[_0x6a3e('0xe')](function(_0x4d1882){var _0x1afa0a={};if(_0x4d1882){_[_0x6a3e('0x39')](_0x1afa0a,_[_0x6a3e('0x4a')](_0x4f288d[_0x6a3e('0x4b')],[_0x6a3e('0x4c'),'updatedAt','id']));_0x1afa0a['state']=0x15;_0x1afa0a['statedesc']=_0x6a3e('0x4d');_0x1afa0a[_0x6a3e('0x4e')]=_0x4d1882[_0x6a3e('0x11')];_0x1afa0a[_0x6a3e('0x4f')]=_0x10cd8e[_0x6a3e('0x50')][_0x6a3e('0x11')];_0x1afa0a['UserId']=_0x10cd8e[_0x6a3e('0x50')]['id'];_0x1afa0a['deleted']=!![];_0x1afa0a['deletedat']=moment()['format'](_0x6a3e('0x51'));_0x1afa0a[_0x6a3e('0x52')]=_0x4f288d['phone'];_0x1afa0a[_0x6a3e('0x53')]=_0x4f288d[_0x6a3e('0x47')]?'queue':_0x6a3e('0x54');return db[_0x6a3e('0x55')][_0x6a3e('0x42')]({'where':{'id':_0x1afa0a[_0x6a3e('0x56')]},'attributes':[_0x6a3e('0x57'),'lastName']})[_0x6a3e('0xe')](function(_0x9128f8){if(!_['isNil'](_0x28a3e9)&&!_[_0x6a3e('0x58')](_0x9128f8[_0x6a3e('0x57')])){_0x1afa0a[_0x6a3e('0x59')]=_0x9128f8[_0x6a3e('0x57')];if(!_[_0x6a3e('0x58')](_0x9128f8[_0x6a3e('0x5a')])){_0x1afa0a[_0x6a3e('0x59')]+='\x20'+_0x9128f8[_0x6a3e('0x5a')];}}})[_0x6a3e('0x5b')](function(){return db[_0x6a3e('0x5c')][_0x6a3e('0x5d')](_0x1afa0a);});}})['then'](function(_0x2870be){return db[_0x6a3e('0x5e')][_0x6a3e('0x46')]({'where':{'CmHopperId':_0x25fa0c}});})['then'](function(){return _0x28a3e9[_0x6a3e('0x5')](0xcc)[_0x6a3e('0x5f')]();})[_0x6a3e('0x43')](handleError(_0x28a3e9,null));};exports[_0x6a3e('0x60')]=function(_0x582ad9,_0x3e29a8){var _0x5ed33d=[];return db[_0x6a3e('0x55')]['describe']()[_0x6a3e('0xe')](function(_0x486d4a){_0x5ed33d=_[_0x6a3e('0x18')](_0x486d4a);return _0x582ad9[_0x6a3e('0x50')][_0x6a3e('0x61')]({'where':{'type':_0x6a3e('0x62'),'dialActive':!![],'dialMethod':_0x6a3e('0x63')},'attributes':['id',_0x6a3e('0x64'),_0x6a3e('0x65')],'raw':!![]});})['then'](function(_0x3a5f9d){if(_0x3a5f9d&&_0x3a5f9d[_0x6a3e('0x31')]){return db[_0x6a3e('0x66')][_0x6a3e('0x67')](function(_0x145655){var _0x3a4a29={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6a3e('0x68')](_0x6a3e('0x51'))},'VoiceQueueId':{'$in':_[_0x6a3e('0x12')](_0x3a5f9d,'id')},'$or':[{'UserId':null},{'UserId':_0x582ad9[_0x6a3e('0x50')]['id']}]};var _0x3c7bd0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3a5f9d)[_0x6a3e('0x37')](['dialPreviewAutoRecallMe',0x0])[_0x6a3e('0x12')]('id')[_0x6a3e('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x582ad9[_0x6a3e('0x50')]['id']}]};var _0x5d11f9={'$or':[_0x3a4a29,_0x3c7bd0]};var _0x4420b9=[];if(_0x582ad9['body'][_0x6a3e('0x6a')]&&_0x582ad9[_0x6a3e('0x44')]['direction']===_0x6a3e('0x6b')){if(!_[_0x6a3e('0x6c')](_0x582ad9['body'][_0x6a3e('0x6d')])){_0x5d11f9['id']={'$in':_0x582ad9[_0x6a3e('0x44')][_0x6a3e('0x6d')]};}_0x4420b9=[[_0x6a3e('0x6e'),_0x6a3e('0x6f')],['scheduledAt',_0x3a5f9d[0x0][_0x6a3e('0x64')]==='ASC'?_0x6a3e('0x70'):'ASC'],db[_0x6a3e('0x66')][_0x6a3e('0x71')](_0x6a3e('0x72')),['id',_0x6a3e('0x70')]];}else{if(!_['isEmpty'](_0x582ad9['body'][_0x6a3e('0x6d')])){_0x5d11f9['id']={'$notIn':_0x582ad9[_0x6a3e('0x44')]['hopperIds']};}_0x4420b9=[[_0x6a3e('0x6e'),_0x6a3e('0x70')],[_0x6a3e('0x73'),_0x3a5f9d[0x0][_0x6a3e('0x64')]],db[_0x6a3e('0x66')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x6a3e('0x6f')]];}return db[_0x6a3e('0x13')][_0x6a3e('0x74')]({'attributes':['id',_0x6a3e('0x75'),_0x6a3e('0x76'),_0x6a3e('0x77')],'where':_0x5d11f9,'order':_0x4420b9,'transaction':_0x145655,'lock':_0x145655['LOCK'][_0x6a3e('0x78')],'include':[{'model':db[_0x6a3e('0x55')],'as':_0x6a3e('0x79'),'attributes':_0x5ed33d,'include':[{'model':db[_0x6a3e('0x7a')],'as':_0x6a3e('0x7b'),'attributes':['id',_0x6a3e('0x11')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x6a3e('0x11')]},{'model':db[_0x6a3e('0x7c')],'as':_0x6a3e('0x7d'),'attributes':['id',_0x6a3e('0x11'),_0x6a3e('0x7e')]}]})[_0x6a3e('0xe')](function(_0x2208e9){if(_0x2208e9){return _0x2208e9[_0x6a3e('0xd')]({'UserId':_0x582ad9[_0x6a3e('0x50')]['id']},{'transaction':_0x145655});}});});}})['then'](handleEntityNotFound(_0x3e29a8,null))[_0x6a3e('0xe')](respondWithResult(_0x3e29a8,null))[_0x6a3e('0x43')](handleError(_0x3e29a8,null));};exports[_0x6a3e('0x7f')]=function(_0x2e8af7,_0x35bbfe,_0x281fba){var _0x7e983a=[];var _0x687f86=_0x2e8af7['params']['id'];var _0x477bfb=_0x2e8af7['user']['id'];return db['CmContact'][_0x6a3e('0x45')]()[_0x6a3e('0xe')](function(_0x3f68c6){_0x7e983a=_['keys'](_0x3f68c6);return db[_0x6a3e('0x66')][_0x6a3e('0x67')](function(_0x20fdf4){const _0x672d9d={'id':_0x687f86};return db[_0x6a3e('0x13')][_0x6a3e('0x74')]({'attributes':['id',_0x6a3e('0x75'),_0x6a3e('0x77')],'where':_0x672d9d,'transaction':_0x20fdf4,'lock':_0x20fdf4[_0x6a3e('0x80')]['UPDATE'],'include':[{'model':db[_0x6a3e('0x55')],'as':_0x6a3e('0x79'),'attributes':_0x7e983a,'include':[{'model':db[_0x6a3e('0x7a')],'as':_0x6a3e('0x7b'),'attributes':['id',_0x6a3e('0x11')]}]},{'model':db[_0x6a3e('0x81')],'as':_0x6a3e('0x82'),'attributes':['id',_0x6a3e('0x11')]},{'model':db[_0x6a3e('0x7c')],'as':_0x6a3e('0x7d'),'attributes':['id',_0x6a3e('0x11'),'dialActive']}]})['then'](function(_0x5148de){if(_0x5148de){return _0x5148de[_0x6a3e('0xd')]({'UserId':_0x477bfb},{'transaction':_0x20fdf4});}});});})['then'](handleEntityNotFound(_0x35bbfe,null))['then'](respondWithResult(_0x35bbfe,null))[_0x6a3e('0x43')](handleError(_0x35bbfe,null));};exports['getOpenContacts']=function(_0x1029f9,_0x7bf1b2){return _0x1029f9[_0x6a3e('0x50')][_0x6a3e('0x61')]({'where':{'type':_0x6a3e('0x62'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x6a3e('0xe')](function(_0x5bb624){if(_0x5bb624&&_0x5bb624[_0x6a3e('0x31')]){return db[_0x6a3e('0x13')][_0x6a3e('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6a3e('0x68')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x5bb624,'id')},'$or':[{'UserId':null},{'UserId':_0x1029f9[_0x6a3e('0x50')]['id']}]}});}return 0x0;})[_0x6a3e('0xe')](function(_0x242f2e){if(!_[_0x6a3e('0x58')](_0x242f2e)&&_['isNumber'](_0x242f2e)){return _0x7bf1b2[_0x6a3e('0x5')](0xc8)[_0x6a3e('0x6')]({'contacts':_0x242f2e});}else{logger[_0x6a3e('0x83')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x6a3e('0x84'),0x194,_0x6a3e('0x85'));_0x7bf1b2[_0x6a3e('0xf')](0x194);}})['catch'](handleError(_0x7bf1b2,null));};exports['getTimezones']=function(_0x242c45,_0xe89e40){var _0x35cefc=shared['timezones'];var _0xb9d497=[];_[_0x6a3e('0x12')](_0x35cefc,function(_0x5bf103){_0xb9d497[_0x6a3e('0x86')]({'id':_0x5bf103[_0x6a3e('0x11')],'name':_0x5bf103[_0x6a3e('0x11')],'utcOffset':_0x5bf103[_0x6a3e('0x87')]});});return _0xe89e40['status'](0xc8)['json']({'tz':_0xb9d497});};exports['getTimezone']=function(_0x4b71f4,_0x515764){var _0x32aefd=shared[_0x6a3e('0x88')];var _0x442eca={};if(!_[_0x6a3e('0x58')](_0x32aefd[_0x4b71f4[_0x6a3e('0x44')]['id']]))_0x442eca=_0x32aefd[_0x4b71f4['body']['id']];return _0x515764[_0x6a3e('0x5')](0xc8)[_0x6a3e('0x6')](_0x442eca);}; \ No newline at end of file +var _0x00bb=['find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','deleted','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','preview','dialPreviewAutoRecallMe','format','value','direction','prev','isEmpty','ASC','dialOrderByScheduledAt','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','hopperIds','priority','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','Queue','dialActive','getPreviewRecall','transaction','recallme','getOpenContacts','outbound','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','api','../../mysqldb','status','offset','undefined','limit','count','json','update','then','sendStatus','error','name','send','index','CmHopper','rawAttributes','type','model','map','query','intersection','filters','concat','$and','$or','$gte','$lt','$lte','$ne','$between','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys'];(function(_0xcbc7d0,_0x4ad63c){var _0x37b8c6=function(_0x153fee){while(--_0x153fee){_0xcbc7d0['push'](_0xcbc7d0['shift']());}};_0x37b8c6(++_0x4ad63c);}(_0x00bb,0x1d8));var _0xb00b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x00bb[_0x397e5f];return _0x5302b8;};'use strict';var moment=require(_0xb00b('0x0'));var _=require(_0xb00b('0x1'));var qs=require(_0xb00b('0x2'));var logger=require('../../config/logger')(_0xb00b('0x3'));var shared=require('../../config/environment');var db=require(_0xb00b('0x4'))['db'];function respondWithResult(_0x464fe7,_0x582ef9){_0x582ef9=_0x582ef9||0xc8;return function(_0x14b5d0){if(_0x14b5d0){return _0x464fe7[_0xb00b('0x5')](_0x582ef9)['json'](_0x14b5d0);}};}function respondWithFilteredResult(_0x574cf8,_0x532ffb){return function(_0x36e363){if(_0x36e363){var _0xf737d0=typeof _0x532ffb[_0xb00b('0x6')]===_0xb00b('0x7')&&typeof _0x532ffb[_0xb00b('0x8')]===_0xb00b('0x7');var _0x5b0c03=_0x36e363['count'];var _0x5154d9=_0xf737d0?0x0:_0x532ffb[_0xb00b('0x6')];var _0x5851d4=_0xf737d0?_0x36e363[_0xb00b('0x9')]:_0x532ffb[_0xb00b('0x6')]+_0x532ffb['limit'];var _0x3182db;if(_0x5851d4>=_0x5b0c03){_0x5851d4=_0x5b0c03;_0x3182db=0xc8;}else{_0x3182db=0xce;}_0x574cf8['status'](_0x3182db);return _0x574cf8['set']('Content-Range',_0x5154d9+'-'+_0x5851d4+'/'+_0x5b0c03)[_0xb00b('0xa')](_0x36e363);}return null;};}function saveUpdates(_0x2d8ddf,_0x1be8aa){return function(_0x466b9b){if(_0x466b9b){return _0x466b9b[_0xb00b('0xb')](_0x2d8ddf)[_0xb00b('0xc')](function(_0x4ada81){return _0x4ada81;});}return null;};}function handleEntityNotFound(_0x218de2,_0xb0d42e){return function(_0x482fe6){if(!_0x482fe6){_0x218de2[_0xb00b('0xd')](0x194);}return _0x482fe6;};}function handleError(_0x1084a6,_0x540b79){_0x540b79=_0x540b79||0x1f4;return function(_0x5da36b){logger[_0xb00b('0xe')](_0x5da36b['stack']);if(_0x5da36b['name']){delete _0x5da36b[_0xb00b('0xf')];}_0x1084a6[_0xb00b('0x5')](_0x540b79)[_0xb00b('0x10')](_0x5da36b);};}exports[_0xb00b('0x11')]=function(_0x58d65f,_0x2a7231){var _0x599347={},_0x415f91={},_0x5aa9a0={'count':0x0,'rows':[]};var _0x25d7a0=_['map'](db[_0xb00b('0x12')][_0xb00b('0x13')],function(_0x53ee68){return{'name':_0x53ee68['fieldName'],'type':_0x53ee68[_0xb00b('0x14')]['key']};});_0x415f91[_0xb00b('0x15')]=_[_0xb00b('0x16')](_0x25d7a0,_0xb00b('0xf'));_0x415f91[_0xb00b('0x17')]=_['keys'](_0x58d65f[_0xb00b('0x17')]);_0x415f91['filters']=_[_0xb00b('0x18')](_0x415f91[_0xb00b('0x15')],_0x415f91['query']);_0x415f91[_0xb00b('0x19')]=_[_0xb00b('0x1a')](_0x415f91['filters'],[_0xb00b('0x1b'),_0xb00b('0x1c'),'$gt',_0xb00b('0x1d'),_0xb00b('0x1e'),_0xb00b('0x1f'),_0xb00b('0x20'),'$eq','$not',_0xb00b('0x21'),'$notBetween','$in','$notIn',_0xb00b('0x22'),_0xb00b('0x23'),_0xb00b('0x24'),_0xb00b('0x25'),_0xb00b('0x22'),_0xb00b('0x26'),_0xb00b('0x27'),'$contained',_0xb00b('0x28')]);_0x599347['attributes']=_[_0xb00b('0x18')](_0x415f91[_0xb00b('0x15')],qs[_0xb00b('0x29')](_0x58d65f['query'][_0xb00b('0x29')]));_0x599347[_0xb00b('0x2a')]=_0x599347[_0xb00b('0x2a')][_0xb00b('0x2b')]?_0x599347[_0xb00b('0x2a')]:_0x415f91[_0xb00b('0x15')];if(!_0x58d65f[_0xb00b('0x17')][_0xb00b('0x2c')](_0xb00b('0x2d'))){_0x599347['limit']=qs[_0xb00b('0x8')](_0x58d65f[_0xb00b('0x17')]['limit']);_0x599347[_0xb00b('0x6')]=qs[_0xb00b('0x6')](_0x58d65f['query'][_0xb00b('0x6')]);}_0x599347['order']=qs[_0xb00b('0x2e')](_0x58d65f[_0xb00b('0x17')][_0xb00b('0x2e')]);_0x599347[_0xb00b('0x2f')]=qs[_0xb00b('0x19')](_[_0xb00b('0x30')](_0x58d65f[_0xb00b('0x17')],_0x415f91['filters']),_0x25d7a0);if(_0x58d65f['query']['filter']){_0x599347[_0xb00b('0x2f')]=_[_0xb00b('0x31')](_0x599347[_0xb00b('0x2f')],{'$or':_[_0xb00b('0x16')](_0x25d7a0,function(_0x5cfa60){if(_0x5cfa60[_0xb00b('0x14')]!==_0xb00b('0x32')){var _0x341f46={};_0x341f46[_0x5cfa60[_0xb00b('0xf')]]={'$like':'%'+_0x58d65f[_0xb00b('0x17')][_0xb00b('0x33')]+'%'};return _0x341f46;}})});}_0x599347=_[_0xb00b('0x31')]({},_0x599347,_0x58d65f[_0xb00b('0x34')]);var _0x5efc18={'where':_0x599347['where']};return db[_0xb00b('0x12')]['count'](_0x5efc18)[_0xb00b('0xc')](function(_0x1c5400){_0x5aa9a0[_0xb00b('0x9')]=_0x1c5400;if(_0x58d65f[_0xb00b('0x17')][_0xb00b('0x35')]){_0x599347[_0xb00b('0x36')]=[{'all':!![]}];}return db[_0xb00b('0x12')]['findAll'](_0x599347);})[_0xb00b('0xc')](function(_0x25578e){_0x5aa9a0[_0xb00b('0x37')]=_0x25578e;return _0x5aa9a0;})[_0xb00b('0xc')](respondWithFilteredResult(_0x2a7231,_0x599347))[_0xb00b('0x38')](handleError(_0x2a7231,null));};exports[_0xb00b('0x39')]=function(_0x59fb00,_0x36980a){var _0x3beb8f={'raw':!![],'where':{'id':_0x59fb00[_0xb00b('0x3a')]['id']}},_0x4801e7={};_0x4801e7[_0xb00b('0x15')]=_[_0xb00b('0x3b')](db[_0xb00b('0x12')][_0xb00b('0x13')]);_0x4801e7['query']=_[_0xb00b('0x3b')](_0x59fb00[_0xb00b('0x17')]);_0x4801e7[_0xb00b('0x19')]=_[_0xb00b('0x18')](_0x4801e7['model'],_0x4801e7['query']);_0x3beb8f[_0xb00b('0x2a')]=_[_0xb00b('0x18')](_0x4801e7[_0xb00b('0x15')],qs[_0xb00b('0x29')](_0x59fb00[_0xb00b('0x17')][_0xb00b('0x29')]));_0x3beb8f[_0xb00b('0x2a')]=_0x3beb8f['attributes'][_0xb00b('0x2b')]?_0x3beb8f[_0xb00b('0x2a')]:_0x4801e7[_0xb00b('0x15')];if(_0x59fb00[_0xb00b('0x17')][_0xb00b('0x35')]){_0x3beb8f[_0xb00b('0x36')]=[{'all':!![]}];}_0x3beb8f=_[_0xb00b('0x31')]({},_0x3beb8f,_0x59fb00[_0xb00b('0x34')]);return db[_0xb00b('0x12')][_0xb00b('0x3c')](_0x3beb8f)[_0xb00b('0xc')](handleEntityNotFound(_0x36980a,null))[_0xb00b('0xc')](respondWithResult(_0x36980a,null))['catch'](handleError(_0x36980a,null));};exports[_0xb00b('0x3d')]=function(_0x35a0ba,_0xd07fb8){return db[_0xb00b('0x12')][_0xb00b('0x3d')](_0x35a0ba[_0xb00b('0x3e')],{})[_0xb00b('0xc')](respondWithResult(_0xd07fb8,0xc9))[_0xb00b('0x38')](handleError(_0xd07fb8,null));};exports[_0xb00b('0xb')]=function(_0x103320,_0x1eec12){if(_0x103320[_0xb00b('0x3e')]['id']){delete _0x103320['body']['id'];}return db['CmHopper']['find']({'where':{'id':_0x103320[_0xb00b('0x3a')]['id']}})[_0xb00b('0xc')](handleEntityNotFound(_0x1eec12,null))['then'](saveUpdates(_0x103320[_0xb00b('0x3e')],null))[_0xb00b('0xc')](respondWithResult(_0x1eec12,null))[_0xb00b('0x38')](handleError(_0x1eec12,null));};exports[_0xb00b('0x3f')]=function(_0x4b62b3,_0x58e9cb){return db[_0xb00b('0x12')][_0xb00b('0x3f')]()['then'](respondWithResult(_0x58e9cb,null))['catch'](handleError(_0x58e9cb,null));};exports[_0xb00b('0x40')]=function(_0x3a205d,_0x4e0be4){var _0x2228e9;var _0x47a814=_0x3a205d['params']['id'];return db['CmHopper'][_0xb00b('0x3c')]({'where':{'id':_0x3a205d['params']['id']}})[_0xb00b('0xc')](handleEntityNotFound(_0x4e0be4,null))[_0xb00b('0xc')](function(_0x4b6482){if(_0x4b6482){return _0x4b6482[_0xb00b('0x40')]()[_0xb00b('0xc')](function(_0xda60ca){return _0xda60ca;});}})['then'](function(_0x5bd40c){_0x2228e9=_0x5bd40c;if(_0x5bd40c){if(_0x5bd40c[_0xb00b('0x41')]||_0x5bd40c[_0xb00b('0x42')]){return db[_0x5bd40c['VoiceQueueId']?_0xb00b('0x43'):_0xb00b('0x44')]['find']({'where':{'id':_0x5bd40c[_0xb00b('0x41')]?_0x5bd40c[_0xb00b('0x41')]:_0x5bd40c[_0xb00b('0x42')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x19f907){var _0x398deb={};if(_0x19f907){_[_0xb00b('0x31')](_0x398deb,_[_0xb00b('0x45')](_0x2228e9['dataValues'],[_0xb00b('0x46'),_0xb00b('0x47'),'id']));_0x398deb['state']=0x15;_0x398deb['statedesc']=_0xb00b('0x48');_0x398deb['campaign']=_0x19f907[_0xb00b('0xf')];_0x398deb[_0xb00b('0x49')]=_0x3a205d[_0xb00b('0x4a')][_0xb00b('0xf')];_0x398deb[_0xb00b('0x4b')]=_0x3a205d[_0xb00b('0x4a')]['id'];_0x398deb['deleted']=!![];_0x398deb[_0xb00b('0x4c')]=moment()['format'](_0xb00b('0x4d'));_0x398deb[_0xb00b('0x4e')]=_0x2228e9[_0xb00b('0x4f')];_0x398deb['campaigntype']=_0x2228e9[_0xb00b('0x41')]?_0xb00b('0x50'):_0xb00b('0x51');return db['CmContact'][_0xb00b('0x3c')]({'where':{'id':_0x398deb[_0xb00b('0x52')]},'attributes':[_0xb00b('0x53'),_0xb00b('0x54')]})[_0xb00b('0xc')](function(_0x279467){if(!_[_0xb00b('0x55')](_0x4e0be4)&&!_[_0xb00b('0x55')](_0x279467['firstName'])){_0x398deb[_0xb00b('0x56')]=_0x279467[_0xb00b('0x53')];if(!_[_0xb00b('0x55')](_0x279467['lastName'])){_0x398deb[_0xb00b('0x56')]+='\x20'+_0x279467[_0xb00b('0x54')];}}})[_0xb00b('0x57')](function(){return db[_0xb00b('0x58')][_0xb00b('0x3d')](_0x398deb);});}})['then'](function(_0xfd4ecc){return db[_0xb00b('0x59')][_0xb00b('0x40')]({'where':{'CmHopperId':_0x47a814}});})[_0xb00b('0xc')](function(){return _0x4e0be4['status'](0xcc)[_0xb00b('0x5a')]();})[_0xb00b('0x38')](handleError(_0x4e0be4,null));};exports[_0xb00b('0x5b')]=function(_0x2d73bb,_0x161216){var _0x1e5ed8=[];return db[_0xb00b('0x5c')]['describe']()[_0xb00b('0xc')](function(_0x502822){_0x1e5ed8=_[_0xb00b('0x3b')](_0x502822);return _0x2d73bb['user'][_0xb00b('0x5d')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xb00b('0x5e')},'attributes':['id','dialOrderByScheduledAt',_0xb00b('0x5f')],'raw':!![]});})[_0xb00b('0xc')](function(_0x3bae02){if(_0x3bae02&&_0x3bae02['length']){return db['sequelize']['transaction'](function(_0x21a53d){var _0x3126be={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xb00b('0x60')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xb00b('0x16')](_0x3bae02,'id')},'$or':[{'UserId':null},{'UserId':_0x2d73bb[_0xb00b('0x4a')]['id']}]};var _0xca87d4={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3bae02)[_0xb00b('0x33')]([_0xb00b('0x5f'),0x0])['map']('id')[_0xb00b('0x61')]()},'$or':[{'UserId':null},{'UserId':_0x2d73bb[_0xb00b('0x4a')]['id']}]};var _0x5622a4={'$or':[_0x3126be,_0xca87d4]};var _0xe1316d=[];if(_0x2d73bb[_0xb00b('0x3e')][_0xb00b('0x62')]&&_0x2d73bb['body']['direction']===_0xb00b('0x63')){if(!_[_0xb00b('0x64')](_0x2d73bb[_0xb00b('0x3e')]['hopperIds'])){_0x5622a4['id']={'$in':_0x2d73bb['body']['hopperIds']};}_0xe1316d=[['priority',_0xb00b('0x65')],['scheduledAt',_0x3bae02[0x0][_0xb00b('0x66')]===_0xb00b('0x65')?'DESC':_0xb00b('0x65')],db[_0xb00b('0x67')][_0xb00b('0x68')](_0xb00b('0x69')),['id',_0xb00b('0x6a')]];}else{if(!_['isEmpty'](_0x2d73bb[_0xb00b('0x3e')][_0xb00b('0x6b')])){_0x5622a4['id']={'$notIn':_0x2d73bb[_0xb00b('0x3e')][_0xb00b('0x6b')]};}_0xe1316d=[[_0xb00b('0x6c'),_0xb00b('0x6a')],[_0xb00b('0x6d'),_0x3bae02[0x0]['dialOrderByScheduledAt']],db[_0xb00b('0x67')][_0xb00b('0x68')](_0xb00b('0x6e')),['id',_0xb00b('0x65')]];}return db[_0xb00b('0x12')][_0xb00b('0x6f')]({'attributes':['id',_0xb00b('0x70'),_0xb00b('0x4f'),'recallme'],'where':_0x5622a4,'order':_0xe1316d,'transaction':_0x21a53d,'lock':_0x21a53d[_0xb00b('0x71')][_0xb00b('0x72')],'include':[{'model':db[_0xb00b('0x5c')],'as':_0xb00b('0x73'),'attributes':_0x1e5ed8,'include':[{'model':db[_0xb00b('0x74')],'as':_0xb00b('0x75'),'attributes':['id',_0xb00b('0xf')]}]},{'model':db[_0xb00b('0x76')],'as':'List','attributes':['id',_0xb00b('0xf')]},{'model':db[_0xb00b('0x43')],'as':_0xb00b('0x77'),'attributes':['id',_0xb00b('0xf'),_0xb00b('0x78')]}]})[_0xb00b('0xc')](function(_0x26461a){if(_0x26461a){return _0x26461a['update']({'UserId':_0x2d73bb[_0xb00b('0x4a')]['id']},{'transaction':_0x21a53d});}});});}})[_0xb00b('0xc')](handleEntityNotFound(_0x161216,null))[_0xb00b('0xc')](respondWithResult(_0x161216,null))[_0xb00b('0x38')](handleError(_0x161216,null));};exports[_0xb00b('0x79')]=function(_0x14ccaf,_0x4930f3,_0x39bb6c){var _0x4e95c7=[];var _0x135cbf=_0x14ccaf['params']['id'];var _0x1b255d=_0x14ccaf[_0xb00b('0x4a')]['id'];return db[_0xb00b('0x5c')]['describe']()['then'](function(_0x9ad1c6){_0x4e95c7=_[_0xb00b('0x3b')](_0x9ad1c6);return db[_0xb00b('0x67')][_0xb00b('0x7a')](function(_0x36b3a2){const _0x13e875={'id':_0x135cbf};return db[_0xb00b('0x12')][_0xb00b('0x6f')]({'attributes':['id',_0xb00b('0x70'),_0xb00b('0x7b')],'where':_0x13e875,'transaction':_0x36b3a2,'lock':_0x36b3a2[_0xb00b('0x71')][_0xb00b('0x72')],'include':[{'model':db[_0xb00b('0x5c')],'as':_0xb00b('0x73'),'attributes':_0x4e95c7,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0xb00b('0xf')]}]},{'model':db[_0xb00b('0x76')],'as':'List','attributes':['id','name']},{'model':db[_0xb00b('0x43')],'as':_0xb00b('0x77'),'attributes':['id',_0xb00b('0xf'),'dialActive']}]})[_0xb00b('0xc')](function(_0x3f415a){if(_0x3f415a){return _0x3f415a[_0xb00b('0xb')]({'UserId':_0x1b255d},{'transaction':_0x36b3a2});}});});})[_0xb00b('0xc')](handleEntityNotFound(_0x4930f3,null))[_0xb00b('0xc')](respondWithResult(_0x4930f3,null))[_0xb00b('0x38')](handleError(_0x4930f3,null));};exports[_0xb00b('0x7c')]=function(_0x4a9125,_0x4168cf){return _0x4a9125['user'][_0xb00b('0x5d')]({'where':{'type':_0xb00b('0x7d'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xb00b('0xc')](function(_0x1099cb){if(_0x1099cb&&_0x1099cb[_0xb00b('0x2b')]){return db[_0xb00b('0x12')][_0xb00b('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xb00b('0x60')](_0xb00b('0x4d'))},'VoiceQueueId':{'$in':_[_0xb00b('0x16')](_0x1099cb,'id')},'$or':[{'UserId':null},{'UserId':_0x4a9125[_0xb00b('0x4a')]['id']}]}});}return 0x0;})[_0xb00b('0xc')](function(_0x2ec3f2){if(!_[_0xb00b('0x55')](_0x2ec3f2)&&_['isNumber'](_0x2ec3f2)){return _0x4168cf[_0xb00b('0x5')](0xc8)[_0xb00b('0xa')]({'contacts':_0x2ec3f2});}else{logger[_0xb00b('0xe')](_0xb00b('0x7e'),'getOpenContacts',0x194,_0xb00b('0x7f'));_0x4168cf[_0xb00b('0xd')](0x194);}})[_0xb00b('0x38')](handleError(_0x4168cf,null));};exports[_0xb00b('0x80')]=function(_0x21471a,_0x5b4d38){var _0x2f1096=shared[_0xb00b('0x81')];var _0xa4fe1e=[];_[_0xb00b('0x16')](_0x2f1096,function(_0x4fb982){_0xa4fe1e[_0xb00b('0x82')]({'id':_0x4fb982['name'],'name':_0x4fb982[_0xb00b('0xf')],'utcOffset':_0x4fb982[_0xb00b('0x83')]});});return _0x5b4d38[_0xb00b('0x5')](0xc8)[_0xb00b('0xa')]({'tz':_0xa4fe1e});};exports[_0xb00b('0x84')]=function(_0x27e051,_0x430e8a){var _0x319977=shared[_0xb00b('0x81')];var _0x1cd071={};if(!_[_0xb00b('0x55')](_0x319977[_0x27e051['body']['id']]))_0x1cd071=_0x319977[_0x27e051[_0xb00b('0x3e')]['id']];return _0x430e8a[_0xb00b('0x5')](0xc8)[_0xb00b('0xa')](_0x1cd071);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 5eb0f72..7a520c4 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 _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x2a7654,_0x40f552){var _0x2c87a6=function(_0xea98f7){while(--_0xea98f7){_0x2a7654['push'](_0x2a7654['shift']());}};_0x2c87a6(++_0x40f552);}(_0x46ed,0x168));var _0xd46e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x46ed[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[{'name':_0xd46e('0xc'),'fields':[_0xd46e('0xc')]},{'name':_0xd46e('0xd'),'fields':[_0xd46e('0xd')]},{'name':'priority','fields':[_0xd46e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','priority','lodash'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x326f,0xd1));var _0xf326=function(_0x375630,_0x4cc34f){_0x375630=_0x375630-0x0;var _0x448a16=_0x326f[_0x375630];return _0x448a16;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['scheduledat']},{'name':'phone','fields':['phone']},{'name':_0xf326('0xe'),'fields':[_0xf326('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index f96000c..299e409 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 _0x578c=['active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','keys','User','Agent','name','length','update','includes','push','all','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','findAll','COUNT','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','Contact','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','literal','voicePause','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','options','raw','where','attributes','limit','include','model','map','debug','stringify','catch','error','message','ShowCmHopper','find','info','CreateCmHopper','create','body','then','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]'];(function(_0x3b19ea,_0x518b6b){var _0x40ece9=function(_0x3a3386){while(--_0x3a3386){_0x3b19ea['push'](_0x3b19ea['shift']());}};_0x40ece9(++_0x518b6b);}(_0x578c,0x1e8));var _0xc578=function(_0x229a59,_0x31220a){_0x229a59=_0x229a59-0x0;var _0x437f56=_0x578c[_0x229a59];return _0x437f56;};'use strict';var _=require(_0xc578('0x0'));var util=require(_0xc578('0x1'));var moment=require(_0xc578('0x2'));var BPromise=require(_0xc578('0x3'));var db=require(_0xc578('0x4'))['db'];var logger=require(_0xc578('0x5'))('rpc');exports[_0xc578('0x6')]=function(_0x27dd6e){var _0xc31428=this;return new Promise(function(_0x1d7b09,_0x22f522){return db[_0xc578('0x7')]['findAll']({'raw':_0x27dd6e[_0xc578('0x8')]?_0x27dd6e[_0xc578('0x8')][_0xc578('0x9')]===undefined?!![]:![]:!![],'where':_0x27dd6e[_0xc578('0x8')]?_0x27dd6e['options'][_0xc578('0xa')]||null:null,'attributes':_0x27dd6e[_0xc578('0x8')]?_0x27dd6e[_0xc578('0x8')][_0xc578('0xb')]||null:null,'limit':_0x27dd6e[_0xc578('0x8')]?_0x27dd6e[_0xc578('0x8')][_0xc578('0xc')]||null:null,'include':_0x27dd6e['options']?_0x27dd6e[_0xc578('0x8')][_0xc578('0xd')]?_['map'](_0x27dd6e['options'][_0xc578('0xd')],function(_0x5b23c9){return{'model':db[_0x5b23c9[_0xc578('0xe')]],'as':_0x5b23c9['as'],'attributes':_0x5b23c9['attributes'],'include':_0x5b23c9['include']?_[_0xc578('0xf')](_0x5b23c9[_0xc578('0xd')],function(_0x3dd0c6){return{'model':db[_0x3dd0c6[_0xc578('0xe')]],'as':_0x3dd0c6['as'],'attributes':_0x3dd0c6[_0xc578('0xb')],'include':_0x3dd0c6[_0xc578('0xd')]?_['map'](_0x3dd0c6[_0xc578('0xd')],function(_0x1c4eb4){return{'model':db[_0x1c4eb4[_0xc578('0xe')]],'as':_0x1c4eb4['as'],'attributes':_0x1c4eb4[_0xc578('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55d58d){logger['info'](_0xc578('0x6'),_0x27dd6e);logger[_0xc578('0x10')](_0xc578('0x6'),_0x27dd6e,JSON[_0xc578('0x11')](_0x55d58d));_0x1d7b09(_0x55d58d);})[_0xc578('0x12')](function(_0x16a83c){logger[_0xc578('0x13')]('GetCmHopper',_0x16a83c[_0xc578('0x14')],_0x27dd6e);_0x22f522(_0xc31428[_0xc578('0x13')](0x1f4,_0x16a83c[_0xc578('0x14')]));});});};exports[_0xc578('0x15')]=function(_0x53f5b8){var _0x212bc6=this;return new Promise(function(_0x55fe05,_0x29b68b){return db['CmHopper'][_0xc578('0x16')]({'raw':_0x53f5b8[_0xc578('0x8')]?_0x53f5b8[_0xc578('0x8')][_0xc578('0x9')]===undefined?!![]:![]:!![],'where':_0x53f5b8['options']?_0x53f5b8[_0xc578('0x8')][_0xc578('0xa')]||null:null,'attributes':_0x53f5b8[_0xc578('0x8')]?_0x53f5b8['options'][_0xc578('0xb')]||null:null,'include':_0x53f5b8[_0xc578('0x8')]?_0x53f5b8['options'][_0xc578('0xd')]?_[_0xc578('0xf')](_0x53f5b8[_0xc578('0x8')][_0xc578('0xd')],function(_0x4cba94){return{'model':db[_0x4cba94[_0xc578('0xe')]],'as':_0x4cba94['as'],'attributes':_0x4cba94[_0xc578('0xb')],'include':_0x4cba94[_0xc578('0xd')]?_[_0xc578('0xf')](_0x4cba94[_0xc578('0xd')],function(_0xc9dcf9){return{'model':db[_0xc9dcf9[_0xc578('0xe')]],'as':_0xc9dcf9['as'],'attributes':_0xc9dcf9[_0xc578('0xb')],'include':_0xc9dcf9['include']?_[_0xc578('0xf')](_0xc9dcf9[_0xc578('0xd')],function(_0x249572){return{'model':db[_0x249572[_0xc578('0xe')]],'as':_0x249572['as'],'attributes':_0x249572[_0xc578('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1316d2){logger[_0xc578('0x17')]('ShowCmHopper',_0x53f5b8);logger[_0xc578('0x10')](_0xc578('0x15'),_0x53f5b8,JSON['stringify'](_0x1316d2));_0x55fe05(_0x1316d2);})[_0xc578('0x12')](function(_0x3a916e){logger[_0xc578('0x13')](_0xc578('0x15'),_0x3a916e[_0xc578('0x14')],_0x53f5b8);_0x29b68b(_0x212bc6[_0xc578('0x13')](0x1f4,_0x3a916e['message']));});});};exports[_0xc578('0x18')]=function(_0x47adb3){var _0x598f13=this;return new Promise(function(_0x9be07f,_0x24cb2c){return db['CmHopper'][_0xc578('0x19')](_0x47adb3[_0xc578('0x1a')],{'raw':_0x47adb3[_0xc578('0x8')]?_0x47adb3[_0xc578('0x8')]['raw']===undefined?!![]:![]:!![]})[_0xc578('0x1b')](function(_0x5922d0){logger['info'](_0xc578('0x18'),_0x47adb3);logger[_0xc578('0x10')]('CreateCmHopper',_0x47adb3,JSON[_0xc578('0x11')](_0x5922d0));_0x9be07f(_0x5922d0);})[_0xc578('0x12')](function(_0x5407d2){logger[_0xc578('0x13')](_0xc578('0x18'),_0x5407d2[_0xc578('0x14')],_0x47adb3);_0x24cb2c(_0x598f13['error'](0x1f4,_0x5407d2[_0xc578('0x14')]));});});};exports['UpdateCmHopper']=function(_0x1a697c){var _0x471bf3=this;return new Promise(function(_0x2bdb6c,_0x193f0a){return db[_0xc578('0x7')]['update'](_0x1a697c[_0xc578('0x1a')],{'raw':_0x1a697c['options']?_0x1a697c[_0xc578('0x8')][_0xc578('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a697c[_0xc578('0x8')]?_0x1a697c[_0xc578('0x8')]['where']||null:null,'attributes':_0x1a697c[_0xc578('0x8')]?_0x1a697c['options']['attributes']||null:null,'limit':_0x1a697c[_0xc578('0x8')]?_0x1a697c[_0xc578('0x8')]['limit']||null:null})['then'](function(_0x257203){logger[_0xc578('0x17')](_0xc578('0x1c'),_0x1a697c);logger['info'](_0xc578('0x1d'),JSON[_0xc578('0x11')](_0x1a697c[_0xc578('0x8')]['where']),_0x1a697c[_0xc578('0x1a')][_0xc578('0x1e')]);logger['debug']('UpdateCmHopper',_0x1a697c,JSON[_0xc578('0x11')](_0x257203));_0x2bdb6c(_0x257203);})[_0xc578('0x12')](function(_0x3aee02){logger[_0xc578('0x13')](_0xc578('0x1c'),_0x3aee02[_0xc578('0x14')],_0x1a697c);_0x193f0a(_0x471bf3['error'](0x1f4,_0x3aee02[_0xc578('0x14')]));});});};exports[_0xc578('0x1f')]=function(_0x17a642){var _0x5482e0=this;return new Promise(function(_0x4e5494,_0x23a439){return db['CmHopper'][_0xc578('0x20')]({'where':_0x17a642['options']?_0x17a642[_0xc578('0x8')]['where']||null:null})[_0xc578('0x1b')](function(_0x156e9c){logger[_0xc578('0x17')]('DestroyCmHopper',_0x17a642);logger[_0xc578('0x10')](_0xc578('0x1f'),_0x17a642,JSON[_0xc578('0x11')](_0x156e9c));_0x4e5494(_0x156e9c);})[_0xc578('0x12')](function(_0x5506b0){logger['error'](_0xc578('0x1f'),_0x5506b0[_0xc578('0x14')],_0x17a642);_0x23a439(_0x5482e0[_0xc578('0x13')](0x1f4,_0x5506b0['message']));});});};exports[_0xc578('0x21')]=function(_0x2c081c){var _0x17f48d=this;return new Promise(function(_0xbe6f94,_0x1782b7){return db[_0xc578('0x22')][_0xc578('0x23')]()['then'](function(_0x1fae9b){return db[_0xc578('0x24')][_0xc578('0x25')](function(_0x3dadac){return db['CmHopper']['findAll']({'where':_0x2c081c[_0xc578('0x8')]?_0x2c081c[_0xc578('0x8')][_0xc578('0xa')]||null:null,'attributes':_0x2c081c[_0xc578('0x8')]?_0x2c081c[_0xc578('0x8')][_0xc578('0xb')]||null:null,'limit':_0x2c081c[_0xc578('0x8')]?_0x2c081c['options']['limit']||null:null,'order':_0x2c081c['options']?_0x2c081c[_0xc578('0x8')][_0xc578('0x26')]||null:null,'transaction':_0x3dadac,'lock':_0x3dadac[_0xc578('0x27')]['UPDATE'],'include':[{'model':db[_0xc578('0x22')],'as':'Contact','attributes':_[_0xc578('0x28')](_0x1fae9b)},{'model':db[_0xc578('0x29')],'as':_0xc578('0x2a'),'attributes':['id',_0xc578('0x2b'),'voicePause']}]})['then'](function(_0x2caf5a){var _0x1e1ce9=[];var _0x2f233a=[];for(var _0x295f74=0x0;_0x295f74<_0x2caf5a[_0xc578('0x2c')];_0x295f74+=0x1){var _0x11837b=_0x2caf5a[_0x295f74]['UserId'];if(_0x11837b===null){_0x1e1ce9['push'](_0x2caf5a[_0x295f74][_0xc578('0x2d')](_0x2c081c['body'],{'transaction':_0x3dadac}));}else if(!_0x2f233a[_0xc578('0x2e')](_0x11837b)){_0x2f233a[_0xc578('0x2f')](_0x11837b);_0x1e1ce9['push'](_0x2caf5a[_0x295f74][_0xc578('0x2d')](_0x2c081c[_0xc578('0x1a')],{'transaction':_0x3dadac}));}}return BPromise[_0xc578('0x30')](_0x1e1ce9);});})['then'](function(_0x4a9e0b){logger[_0xc578('0x17')](_0xc578('0x21'),_0x2c081c);if(_0x4a9e0b['length']>0x0){logger[_0xc578('0x17')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x4a9e0b[0x0][_0xc578('0x31')]['id'],_0x4a9e0b[0x0][_0xc578('0x31')][_0xc578('0x32')],_0x4a9e0b[0x0][_0xc578('0x31')][_0xc578('0x1e')]);}logger[_0xc578('0x10')](_0xc578('0x21'),_0x2c081c,JSON[_0xc578('0x11')](_0x4a9e0b));_0xbe6f94(_0x4a9e0b);})[_0xc578('0x12')](function(_0x234d83){logger[_0xc578('0x13')](_0xc578('0x21'),_0x234d83[_0xc578('0x14')],_0x2c081c);_0x1782b7(_0x17f48d[_0xc578('0x13')](0x1f4,_0x234d83[_0xc578('0x14')]));});});});};exports[_0xc578('0x33')]=function(_0x10f7d6){var _0x3c31eb=this;return new Promise(function(_0x599f83,_0x149cb5){return db[_0xc578('0x24')][_0xc578('0x25')](function(_0x17a05b){return db[_0xc578('0x34')][_0xc578('0x19')](_0x10f7d6['body'],{'raw':_0x10f7d6[_0xc578('0x8')]?_0x10f7d6[_0xc578('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x17a05b})[_0xc578('0x1b')](function(){logger[_0xc578('0x17')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x10f7d6[_0xc578('0x8')][_0xc578('0xa')]),_0x10f7d6[_0xc578('0x8')][_0xc578('0xa')][_0xc578('0x1e')]);return db['CmHopper'][_0xc578('0x20')]({'where':_0x10f7d6['options']?_0x10f7d6[_0xc578('0x8')][_0xc578('0xa')]||null:null,'transaction':_0x17a05b});});})[_0xc578('0x1b')](function(_0xe994e0){logger['info'](_0xc578('0x33'),_0x10f7d6);logger['debug'](_0xc578('0x33'),_0x10f7d6,JSON['stringify'](_0xe994e0));_0x599f83(_0xe994e0);})[_0xc578('0x12')](function(_0x4296fd){logger[_0xc578('0x13')](_0xc578('0x33'),_0x4296fd[_0xc578('0x14')],_0x10f7d6);_0x149cb5(_0x3c31eb[_0xc578('0x13')](0x1f4,_0x4296fd[_0xc578('0x14')]));});});};exports[_0xc578('0x35')]=function(_0xe50baf){var _0x3d3a6a=this;return new Promise(function(_0x45cdf7,_0x109f99){return db[_0xc578('0x7')][_0xc578('0x36')]({'raw':_0xe50baf[_0xc578('0x8')]?_0xe50baf[_0xc578('0x8')][_0xc578('0x9')]===undefined?!![]:![]:!![],'where':_0xe50baf[_0xc578('0x8')]?_0xe50baf[_0xc578('0x8')][_0xc578('0xa')]||null:null,'attributes':[[db['sequelize']['fn'](_0xc578('0x37'),db['sequelize']['fn']('IF',db[_0xc578('0x24')]['literal']('`scheduledat`\x20>=\x20'+util[_0xc578('0x38')]('\x22%s\x22',moment()[_0xc578('0x38')](_0xc578('0x39')))+_0xc578('0x3a')))),_0xc578('0x3b')]]})[_0xc578('0x1b')](function(_0x12e7ad){logger[_0xc578('0x17')](_0xc578('0x35'),_0xe50baf);logger['debug'](_0xc578('0x35'),_0xe50baf,JSON[_0xc578('0x11')](_0x12e7ad));_0x45cdf7(_0x12e7ad);})['catch'](function(_0x597df7){logger['error'](_0xc578('0x35'),_0x597df7[_0xc578('0x14')],_0xe50baf);_0x109f99(_0x3d3a6a[_0xc578('0x13')](0x1f4,_0x597df7[_0xc578('0x14')]));});});};exports['GetContactRecallMe']=function(_0x25984e){var _0x376069=this;return new Promise(function(_0x536ac9,_0x37887f){return db[_0xc578('0x22')][_0xc578('0x23')]()[_0xc578('0x1b')](function(){return db[_0xc578('0x24')][_0xc578('0x25')](function(_0x2dc82a){return db['CmHopper']['findAll']({'where':_0x25984e[_0xc578('0x8')]?_0x25984e['options'][_0xc578('0xa')]||null:null,'attributes':_0x25984e[_0xc578('0x8')]?_0x25984e['options'][_0xc578('0xb')]||null:null,'limit':0x1,'order':_0x25984e[_0xc578('0x8')]?_0x25984e[_0xc578('0x8')][_0xc578('0x26')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x2dc82a,'lock':_0x2dc82a[_0xc578('0x27')]['UPDATE'],'include':_0x25984e[_0xc578('0x8')]?_0x25984e[_0xc578('0x8')][_0xc578('0xd')]?_[_0xc578('0xf')](_0x25984e[_0xc578('0x8')][_0xc578('0xd')],function(_0x5d8489){return{'model':db[_0x5d8489[_0xc578('0xe')]],'as':_0x5d8489['as'],'attributes':_0x5d8489['attributes'],'include':_0x5d8489[_0xc578('0xd')]?_[_0xc578('0xf')](_0x5d8489[_0xc578('0xd')],function(_0x491229){return{'model':db[_0x491229[_0xc578('0xe')]],'as':_0x491229['as'],'attributes':_0x491229['attributes'],'include':_0x491229[_0xc578('0xd')]?_[_0xc578('0xf')](_0x491229[_0xc578('0xd')],function(_0xb0c8ea){return{'model':db[_0xb0c8ea['model']],'as':_0xb0c8ea['as'],'attributes':_0xb0c8ea[_0xc578('0xb')]};}):[]};}):[]};}):[]:[]})[_0xc578('0x1b')](function(_0x311e6e){var _0x5eeb7b=[];for(var _0x4a87c4=0x0;_0x4a87c4<_0x311e6e[_0xc578('0x2c')];_0x4a87c4+=0x1){_0x5eeb7b[_0xc578('0x2f')](_0x311e6e[_0x4a87c4][_0xc578('0x2d')](_0x25984e[_0xc578('0x1a')],{'transaction':_0x2dc82a}));}return BPromise[_0xc578('0x30')](_0x5eeb7b);});})[_0xc578('0x1b')](function(_0x484dd0){logger['info'](_0xc578('0x3c'),_0x25984e);logger[_0xc578('0x10')](_0xc578('0x3c'),_0x25984e,JSON['stringify'](_0x484dd0));_0x536ac9(_0x484dd0);})[_0xc578('0x12')](function(_0x57d7d4){logger[_0xc578('0x13')](_0xc578('0x3c'),_0x57d7d4[_0xc578('0x14')],_0x25984e);_0x37887f(_0x376069[_0xc578('0x13')](0x1f4,_0x57d7d4[_0xc578('0x14')]));});});});};exports[_0xc578('0x3d')]=function(_0x402f4b){var _0x37995d=this;return new Promise(function(_0x1503d3,_0x47acc2){db[_0xc578('0x22')][_0xc578('0x23')]()['then'](function(_0x4c7504){return db[_0xc578('0x7')][_0xc578('0x36')]({'raw':_0x402f4b['options']?_0x402f4b['options'][_0xc578('0x9')]===undefined?!![]:![]:!![],'where':_0x402f4b['options']?_0x402f4b['options'][_0xc578('0xa')]||null:null,'attributes':_0x402f4b[_0xc578('0x8')]?_0x402f4b[_0xc578('0x8')][_0xc578('0xb')]||null:null,'limit':_0x402f4b['options']?_0x402f4b[_0xc578('0x8')]['limit']||null:null,'include':_0x402f4b[_0xc578('0x8')]?_0x402f4b['options']['include']?_[_0xc578('0xf')](_0x402f4b[_0xc578('0x8')]['include'],function(_0x4408ac){return{'model':db[_0x4408ac[_0xc578('0xe')]],'as':_0x4408ac['as'],'attributes':_0x4408ac['as']===_0xc578('0x3e')?_[_0xc578('0x28')](_0x4c7504):_0x4408ac[_0xc578('0xb')],'include':_0x4408ac['include']?_[_0xc578('0xf')](_0x4408ac['include'],function(_0x4075ad){return{'model':db[_0x4075ad[_0xc578('0xe')]],'as':_0x4075ad['as'],'attributes':_0x4075ad[_0xc578('0xb')],'include':_0x4075ad[_0xc578('0xd')]?_[_0xc578('0xf')](_0x4075ad[_0xc578('0xd')],function(_0x54e700){return{'model':db[_0x54e700[_0xc578('0xe')]],'as':_0x54e700['as'],'attributes':_0x54e700[_0xc578('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x97d9a6){logger[_0xc578('0x17')](_0xc578('0x6'),_0x402f4b);logger['debug'](_0xc578('0x6'),_0x402f4b,JSON[_0xc578('0x11')](_0x97d9a6));_0x1503d3(_0x97d9a6);})[_0xc578('0x12')](function(_0x29127e){logger[_0xc578('0x13')]('GetCmHopper',_0x29127e['message'],_0x402f4b);_0x47acc2(_0x37995d[_0xc578('0x13')](0x1f4,_0x29127e['message']));});});});};exports[_0xc578('0x3f')]=function(_0x2839ff){var _0xf9dbc7=this;return new Promise(function(_0x172ae7,_0x48ce36){return db[_0xc578('0x22')]['findOne']({'raw':!![],'where':{'phone':_0x2839ff[_0xc578('0x8')][_0xc578('0xa')][_0xc578('0x40')]},'attributes':['id',_0xc578('0x41')],'order':[['id',_0xc578('0x42')]]})['then'](function(_0x3eaaaa){logger[_0xc578('0x17')](_0xc578('0x43'),_0x2839ff);logger[_0xc578('0x10')](_0xc578('0x43'),_0x2839ff,JSON['stringify'](_0x3eaaaa));_0x172ae7(_0x3eaaaa);})['catch'](function(_0x119329){logger[_0xc578('0x13')](_0xc578('0x43'),_0x119329[_0xc578('0x14')],_0x2839ff);_0x48ce36(_0xf9dbc7[_0xc578('0x13')](0x1f4,_0x119329[_0xc578('0x14')]));});});};exports[_0xc578('0x44')]=function(_0x4e8d24){var _0x4c8bc1=this;return new Promise(function(_0x3365fb,_0x169a0f){return db[_0xc578('0x24')][_0xc578('0x25')](function(_0x407bd7){var _0x4b98aa=_0x4e8d24['options']&&_0x4e8d24[_0xc578('0x8')][_0xc578('0xa')]?_0x4e8d24[_0xc578('0x8')]['where']:{};return db[_0xc578('0x7')][_0xc578('0x2d')](_0x4e8d24[_0xc578('0x1a')],{'where':_0x4b98aa,'transaction':_0x407bd7})['then'](function(_0x24e259){logger[_0xc578('0x17')](_0xc578('0x44'),_0x4e8d24);logger[_0xc578('0x10')](_0xc578('0x44'),_0x4e8d24,JSON[_0xc578('0x11')](_0x24e259));_0x3365fb(_0x24e259);})[_0xc578('0x12')](function(_0x5475f0){logger[_0xc578('0x13')](_0xc578('0x44'),_0x5475f0[_0xc578('0x14')],_0x4e8d24);_0x169a0f(_0x4c8bc1[_0xc578('0x13')](0x1f4,_0x5475f0[_0xc578('0x14')]));});});});};exports[_0xc578('0x45')]=function(_0x30e365){var _0x577724=this;var _0xc466a1=_0x30e365[_0xc578('0x1a')][_0xc578('0xa')]['voiceQueueIds'];var _0x2509b2=_0x30e365[_0xc578('0x1a')][_0xc578('0xa')][_0xc578('0x46')];var _0x112fb6=_0x30e365['body'][_0xc578('0xa')]['availableAgentsIds'];return new Promise(function(_0x12883d,_0x1cc054){return db[_0xc578('0x7')][_0xc578('0x36')]({'where':{'voiceQueueId':{'$in':_0xc466a1},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xc578('0x47')]('NOW()\x20+\x20INTERVAL\x20'+_0x2509b2+'\x20MINUTE'),'$gt':db['sequelize'][_0xc578('0x47')]('NOW()')}},'UserId':{'$in':_0x112fb6}},'include':[{'model':db[_0xc578('0x22')],'as':_0xc578('0x3e')},{'model':db['User'],'as':_0xc578('0x2a'),'attributes':['id',_0xc578('0x2b'),_0xc578('0x48')]},{'model':db['CmList'],'as':_0xc578('0x49')}]})[_0xc578('0x1b')](function(_0x479fd4){if(_0x479fd4[_0xc578('0x2c')]>0x0){return db[_0xc578('0x24')][_0xc578('0x25')](function(_0x545189){return db[_0xc578('0x7')][_0xc578('0x2d')]({'recallmeNotifiedDate':db[_0xc578('0x24')][_0xc578('0x47')]('NOW()')},{'where':{'id':{'$in':_[_0xc578('0xf')](_0x479fd4,'id')}},'transaction':_0x545189})['then'](function(){_0x12883d(_0x479fd4);})[_0xc578('0x12')](function(_0x2d634d){logger[_0xc578('0x13')](_0xc578('0x45'),_0x2d634d[_0xc578('0x14')],_0x30e365);_0x1cc054(_0x577724[_0xc578('0x13')](0x1f4,_0x2d634d['message']));});})[_0xc578('0x12')](function(_0x5321ec){logger[_0xc578('0x13')](_0xc578('0x45'),_0x5321ec[_0xc578('0x14')],_0x30e365);_0x1cc054(_0x577724[_0xc578('0x13')](0x1f4,_0x5321ec[_0xc578('0x14')]));});}else{_0x12883d(_0x479fd4);}});});}; \ No newline at end of file +var _0xaaee=['voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','moment','bluebird','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','map','model','then','info','debug','message','find','raw','ShowCmHopper','stringify','catch','error','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','body','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','order','UserId','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xaaee,0xa9));var _0xeaae=function(_0x75e4fd,_0x38203e){_0x75e4fd=_0x75e4fd-0x0;var _0x12c960=_0xaaee[_0x75e4fd];return _0x12c960;};'use strict';var _=require(_0xeaae('0x0'));var util=require('util');var moment=require(_0xeaae('0x1'));var BPromise=require(_0xeaae('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xeaae('0x3'))(_0xeaae('0x4'));exports[_0xeaae('0x5')]=function(_0x380932){var _0x48d60a=this;return new Promise(function(_0xf79ad0,_0xee1d1f){return db[_0xeaae('0x6')][_0xeaae('0x7')]({'raw':_0x380932[_0xeaae('0x8')]?_0x380932[_0xeaae('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x380932[_0xeaae('0x8')]?_0x380932[_0xeaae('0x8')][_0xeaae('0x9')]||null:null,'attributes':_0x380932[_0xeaae('0x8')]?_0x380932[_0xeaae('0x8')][_0xeaae('0xa')]||null:null,'limit':_0x380932[_0xeaae('0x8')]?_0x380932[_0xeaae('0x8')][_0xeaae('0xb')]||null:null,'include':_0x380932['options']?_0x380932[_0xeaae('0x8')][_0xeaae('0xc')]?_[_0xeaae('0xd')](_0x380932['options']['include'],function(_0x24ae51){return{'model':db[_0x24ae51[_0xeaae('0xe')]],'as':_0x24ae51['as'],'attributes':_0x24ae51[_0xeaae('0xa')],'include':_0x24ae51['include']?_[_0xeaae('0xd')](_0x24ae51[_0xeaae('0xc')],function(_0x3b1578){return{'model':db[_0x3b1578[_0xeaae('0xe')]],'as':_0x3b1578['as'],'attributes':_0x3b1578['attributes'],'include':_0x3b1578['include']?_[_0xeaae('0xd')](_0x3b1578[_0xeaae('0xc')],function(_0x8dc1ac){return{'model':db[_0x8dc1ac[_0xeaae('0xe')]],'as':_0x8dc1ac['as'],'attributes':_0x8dc1ac['attributes']};}):[]};}):[]};}):[]:[]})[_0xeaae('0xf')](function(_0x5be794){logger[_0xeaae('0x10')](_0xeaae('0x5'),_0x380932);logger[_0xeaae('0x11')](_0xeaae('0x5'),_0x380932,JSON['stringify'](_0x5be794));_0xf79ad0(_0x5be794);})['catch'](function(_0x5d5aa1){logger['error'](_0xeaae('0x5'),_0x5d5aa1[_0xeaae('0x12')],_0x380932);_0xee1d1f(_0x48d60a['error'](0x1f4,_0x5d5aa1[_0xeaae('0x12')]));});});};exports['ShowCmHopper']=function(_0x1ac7a2){var _0x2ddb28=this;return new Promise(function(_0x3491a6,_0x52de90){return db[_0xeaae('0x6')][_0xeaae('0x13')]({'raw':_0x1ac7a2['options']?_0x1ac7a2['options'][_0xeaae('0x14')]===undefined?!![]:![]:!![],'where':_0x1ac7a2['options']?_0x1ac7a2['options'][_0xeaae('0x9')]||null:null,'attributes':_0x1ac7a2[_0xeaae('0x8')]?_0x1ac7a2[_0xeaae('0x8')][_0xeaae('0xa')]||null:null,'include':_0x1ac7a2[_0xeaae('0x8')]?_0x1ac7a2[_0xeaae('0x8')][_0xeaae('0xc')]?_[_0xeaae('0xd')](_0x1ac7a2[_0xeaae('0x8')][_0xeaae('0xc')],function(_0x56eae0){return{'model':db[_0x56eae0[_0xeaae('0xe')]],'as':_0x56eae0['as'],'attributes':_0x56eae0[_0xeaae('0xa')],'include':_0x56eae0[_0xeaae('0xc')]?_[_0xeaae('0xd')](_0x56eae0[_0xeaae('0xc')],function(_0x45a6df){return{'model':db[_0x45a6df[_0xeaae('0xe')]],'as':_0x45a6df['as'],'attributes':_0x45a6df[_0xeaae('0xa')],'include':_0x45a6df['include']?_['map'](_0x45a6df[_0xeaae('0xc')],function(_0x668fd2){return{'model':db[_0x668fd2[_0xeaae('0xe')]],'as':_0x668fd2['as'],'attributes':_0x668fd2['attributes']};}):[]};}):[]};}):[]:[]})[_0xeaae('0xf')](function(_0x30e777){logger[_0xeaae('0x10')](_0xeaae('0x15'),_0x1ac7a2);logger[_0xeaae('0x11')](_0xeaae('0x15'),_0x1ac7a2,JSON[_0xeaae('0x16')](_0x30e777));_0x3491a6(_0x30e777);})[_0xeaae('0x17')](function(_0x38c80c){logger[_0xeaae('0x18')]('ShowCmHopper',_0x38c80c[_0xeaae('0x12')],_0x1ac7a2);_0x52de90(_0x2ddb28[_0xeaae('0x18')](0x1f4,_0x38c80c['message']));});});};exports['CreateCmHopper']=function(_0x387f8e){var _0x4f01d0=this;return new Promise(function(_0x1dfe6b,_0x1827b9){return db[_0xeaae('0x6')]['create'](_0x387f8e['body'],{'raw':_0x387f8e['options']?_0x387f8e[_0xeaae('0x8')]['raw']===undefined?!![]:![]:!![]})[_0xeaae('0xf')](function(_0x34d825){logger[_0xeaae('0x10')]('CreateCmHopper',_0x387f8e);logger[_0xeaae('0x11')](_0xeaae('0x19'),_0x387f8e,JSON[_0xeaae('0x16')](_0x34d825));_0x1dfe6b(_0x34d825);})[_0xeaae('0x17')](function(_0x3d1251){logger['error'](_0xeaae('0x19'),_0x3d1251[_0xeaae('0x12')],_0x387f8e);_0x1827b9(_0x4f01d0[_0xeaae('0x18')](0x1f4,_0x3d1251[_0xeaae('0x12')]));});});};exports[_0xeaae('0x1a')]=function(_0x259139){var _0x1bb73f=this;return new Promise(function(_0x90ad27,_0x183b99){return db[_0xeaae('0x6')][_0xeaae('0x1b')](_0x259139['body'],{'raw':_0x259139['options']?_0x259139['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x259139['options']?_0x259139[_0xeaae('0x8')]['where']||null:null,'attributes':_0x259139[_0xeaae('0x8')]?_0x259139['options'][_0xeaae('0xa')]||null:null,'limit':_0x259139['options']?_0x259139['options'][_0xeaae('0xb')]||null:null})[_0xeaae('0xf')](function(_0x58089f){logger[_0xeaae('0x10')](_0xeaae('0x1a'),_0x259139);logger['info'](_0xeaae('0x1c'),JSON[_0xeaae('0x16')](_0x259139[_0xeaae('0x8')][_0xeaae('0x9')]),_0x259139[_0xeaae('0x1d')]['active']);logger[_0xeaae('0x11')]('UpdateCmHopper',_0x259139,JSON[_0xeaae('0x16')](_0x58089f));_0x90ad27(_0x58089f);})[_0xeaae('0x17')](function(_0x4b47db){logger[_0xeaae('0x18')](_0xeaae('0x1a'),_0x4b47db[_0xeaae('0x12')],_0x259139);_0x183b99(_0x1bb73f['error'](0x1f4,_0x4b47db[_0xeaae('0x12')]));});});};exports[_0xeaae('0x1e')]=function(_0x3cabe6){var _0x40d844=this;return new Promise(function(_0x1386ca,_0x4fc077){return db['CmHopper'][_0xeaae('0x1f')]({'where':_0x3cabe6[_0xeaae('0x8')]?_0x3cabe6[_0xeaae('0x8')]['where']||null:null})[_0xeaae('0xf')](function(_0x51f2a8){logger[_0xeaae('0x10')]('DestroyCmHopper',_0x3cabe6);logger[_0xeaae('0x11')](_0xeaae('0x1e'),_0x3cabe6,JSON[_0xeaae('0x16')](_0x51f2a8));_0x1386ca(_0x51f2a8);})['catch'](function(_0x19dce2){logger['error'](_0xeaae('0x1e'),_0x19dce2['message'],_0x3cabe6);_0x4fc077(_0x40d844['error'](0x1f4,_0x19dce2[_0xeaae('0x12')]));});});};exports[_0xeaae('0x20')]=function(_0x5d3dd7){var _0x1e7a34=this;return new Promise(function(_0x2cf84c,_0x171f77){return db[_0xeaae('0x21')][_0xeaae('0x22')]()[_0xeaae('0xf')](function(_0x5236b6){return db[_0xeaae('0x23')][_0xeaae('0x24')](function(_0x3e2689){return db['CmHopper']['findAll']({'where':_0x5d3dd7[_0xeaae('0x8')]?_0x5d3dd7[_0xeaae('0x8')]['where']||null:null,'attributes':_0x5d3dd7[_0xeaae('0x8')]?_0x5d3dd7[_0xeaae('0x8')][_0xeaae('0xa')]||null:null,'limit':_0x5d3dd7[_0xeaae('0x8')]?_0x5d3dd7[_0xeaae('0x8')]['limit']||null:null,'order':_0x5d3dd7[_0xeaae('0x8')]?_0x5d3dd7['options']['order']||null:null,'transaction':_0x3e2689,'lock':_0x3e2689[_0xeaae('0x25')][_0xeaae('0x26')],'include':[{'model':db[_0xeaae('0x21')],'as':_0xeaae('0x27'),'attributes':_[_0xeaae('0x28')](_0x5236b6)},{'model':db[_0xeaae('0x29')],'as':_0xeaae('0x2a'),'attributes':['id',_0xeaae('0x2b'),_0xeaae('0x2c')]}]})[_0xeaae('0xf')](function(_0x407a09){var _0x1312bb=[];var _0xa77659=[];for(var _0x451553=0x0;_0x451553<_0x407a09['length'];_0x451553+=0x1){var _0x19c654=_0x407a09[_0x451553]['UserId'];if(_0x19c654===null){_0x1312bb[_0xeaae('0x2d')](_0x407a09[_0x451553][_0xeaae('0x1b')](_0x5d3dd7[_0xeaae('0x1d')],{'transaction':_0x3e2689}));}else if(!_0xa77659[_0xeaae('0x2e')](_0x19c654)){_0xa77659['push'](_0x19c654);_0x1312bb[_0xeaae('0x2d')](_0x407a09[_0x451553]['update'](_0x5d3dd7[_0xeaae('0x1d')],{'transaction':_0x3e2689}));}}return BPromise[_0xeaae('0x2f')](_0x1312bb);});})[_0xeaae('0xf')](function(_0x34bf1c){logger['info'](_0xeaae('0x20'),_0x5d3dd7);if(_0x34bf1c[_0xeaae('0x30')]>0x0){logger[_0xeaae('0x10')](_0xeaae('0x31'),_0x34bf1c[0x0]['dataValues']['id'],_0x34bf1c[0x0][_0xeaae('0x32')][_0xeaae('0x33')],_0x34bf1c[0x0]['dataValues'][_0xeaae('0x34')]);}logger[_0xeaae('0x11')](_0xeaae('0x20'),_0x5d3dd7,JSON[_0xeaae('0x16')](_0x34bf1c));_0x2cf84c(_0x34bf1c);})[_0xeaae('0x17')](function(_0x3e7e90){logger[_0xeaae('0x18')](_0xeaae('0x20'),_0x3e7e90['message'],_0x5d3dd7);_0x171f77(_0x1e7a34[_0xeaae('0x18')](0x1f4,_0x3e7e90[_0xeaae('0x12')]));});});});};exports[_0xeaae('0x35')]=function(_0x408ebe){var _0x1b4e07=this;return new Promise(function(_0x28ff30,_0x5aaecc){return db[_0xeaae('0x23')]['transaction'](function(_0x34c701){return db['CmHopperFinal'][_0xeaae('0x36')](_0x408ebe[_0xeaae('0x1d')],{'raw':_0x408ebe['options']?_0x408ebe['options'][_0xeaae('0x14')]===undefined?!![]:![]:!![],'transaction':_0x34c701})[_0xeaae('0xf')](function(){logger[_0xeaae('0x10')](_0xeaae('0x37'),JSON['stringify'](_0x408ebe['options'][_0xeaae('0x9')]),_0x408ebe[_0xeaae('0x8')][_0xeaae('0x9')][_0xeaae('0x34')]);return db[_0xeaae('0x6')][_0xeaae('0x1f')]({'where':_0x408ebe[_0xeaae('0x8')]?_0x408ebe[_0xeaae('0x8')]['where']||null:null,'transaction':_0x34c701});});})[_0xeaae('0xf')](function(_0x2d9105){logger[_0xeaae('0x10')]('MoveContactManagedDialer',_0x408ebe);logger[_0xeaae('0x11')](_0xeaae('0x35'),_0x408ebe,JSON['stringify'](_0x2d9105));_0x28ff30(_0x2d9105);})[_0xeaae('0x17')](function(_0x2fdaf9){logger[_0xeaae('0x18')](_0xeaae('0x35'),_0x2fdaf9[_0xeaae('0x12')],_0x408ebe);_0x5aaecc(_0x1b4e07[_0xeaae('0x18')](0x1f4,_0x2fdaf9[_0xeaae('0x12')]));});});};exports[_0xeaae('0x38')]=function(_0x2975c8){var _0x345e70=this;return new Promise(function(_0x22f347,_0x2d6417){return db[_0xeaae('0x6')][_0xeaae('0x7')]({'raw':_0x2975c8[_0xeaae('0x8')]?_0x2975c8['options']['raw']===undefined?!![]:![]:!![],'where':_0x2975c8[_0xeaae('0x8')]?_0x2975c8[_0xeaae('0x8')][_0xeaae('0x9')]||null:null,'attributes':[[db[_0xeaae('0x23')]['fn'](_0xeaae('0x39'),db[_0xeaae('0x23')]['fn']('IF',db[_0xeaae('0x23')]['literal'](_0xeaae('0x3a')+util[_0xeaae('0x3b')](_0xeaae('0x3c'),moment()[_0xeaae('0x3b')](_0xeaae('0x3d')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0xeaae('0xf')](function(_0x3357e6){logger[_0xeaae('0x10')](_0xeaae('0x38'),_0x2975c8);logger[_0xeaae('0x11')]('CountReScheduled',_0x2975c8,JSON[_0xeaae('0x16')](_0x3357e6));_0x22f347(_0x3357e6);})['catch'](function(_0x3a6230){logger[_0xeaae('0x18')](_0xeaae('0x38'),_0x3a6230[_0xeaae('0x12')],_0x2975c8);_0x2d6417(_0x345e70['error'](0x1f4,_0x3a6230[_0xeaae('0x12')]));});});};exports[_0xeaae('0x3e')]=function(_0x462ad5){var _0x38b80e=this;return new Promise(function(_0x2e9f85,_0x462330){return db[_0xeaae('0x21')][_0xeaae('0x22')]()[_0xeaae('0xf')](function(){return db[_0xeaae('0x23')]['transaction'](function(_0x85cbf2){return db[_0xeaae('0x6')]['findAll']({'where':_0x462ad5[_0xeaae('0x8')]?_0x462ad5['options'][_0xeaae('0x9')]||null:null,'attributes':_0x462ad5[_0xeaae('0x8')]?_0x462ad5['options']['attributes']||null:null,'limit':0x1,'order':_0x462ad5[_0xeaae('0x8')]?_0x462ad5[_0xeaae('0x8')][_0xeaae('0x3f')]||null:null,'group':db[_0xeaae('0x6')][_0xeaae('0x40')],'transaction':_0x85cbf2,'lock':_0x85cbf2['LOCK'][_0xeaae('0x26')],'include':_0x462ad5[_0xeaae('0x8')]?_0x462ad5[_0xeaae('0x8')][_0xeaae('0xc')]?_[_0xeaae('0xd')](_0x462ad5[_0xeaae('0x8')][_0xeaae('0xc')],function(_0x1d42a9){return{'model':db[_0x1d42a9['model']],'as':_0x1d42a9['as'],'attributes':_0x1d42a9[_0xeaae('0xa')],'include':_0x1d42a9[_0xeaae('0xc')]?_[_0xeaae('0xd')](_0x1d42a9[_0xeaae('0xc')],function(_0x47b04a){return{'model':db[_0x47b04a['model']],'as':_0x47b04a['as'],'attributes':_0x47b04a['attributes'],'include':_0x47b04a[_0xeaae('0xc')]?_[_0xeaae('0xd')](_0x47b04a[_0xeaae('0xc')],function(_0x2d0e7b){return{'model':db[_0x2d0e7b['model']],'as':_0x2d0e7b['as'],'attributes':_0x2d0e7b[_0xeaae('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13546d){var _0x4b3f81=[];for(var _0x1c529d=0x0;_0x1c529d<_0x13546d['length'];_0x1c529d+=0x1){_0x4b3f81[_0xeaae('0x2d')](_0x13546d[_0x1c529d][_0xeaae('0x1b')](_0x462ad5[_0xeaae('0x1d')],{'transaction':_0x85cbf2}));}return BPromise[_0xeaae('0x2f')](_0x4b3f81);});})[_0xeaae('0xf')](function(_0x53278d){logger[_0xeaae('0x10')]('GetContactRecallMe',_0x462ad5);logger[_0xeaae('0x11')](_0xeaae('0x3e'),_0x462ad5,JSON[_0xeaae('0x16')](_0x53278d));_0x2e9f85(_0x53278d);})[_0xeaae('0x17')](function(_0x49afc1){logger['error'](_0xeaae('0x3e'),_0x49afc1['message'],_0x462ad5);_0x462330(_0x38b80e[_0xeaae('0x18')](0x1f4,_0x49afc1[_0xeaae('0x12')]));});});});};exports['GetCmHopperPreview']=function(_0x42b694){var _0x5e1efb=this;return new Promise(function(_0x24b12d,_0x5ec067){db['CmContact'][_0xeaae('0x22')]()[_0xeaae('0xf')](function(_0x42d002){return db['CmHopper'][_0xeaae('0x7')]({'raw':_0x42b694[_0xeaae('0x8')]?_0x42b694[_0xeaae('0x8')][_0xeaae('0x14')]===undefined?!![]:![]:!![],'where':_0x42b694[_0xeaae('0x8')]?_0x42b694[_0xeaae('0x8')][_0xeaae('0x9')]||null:null,'attributes':_0x42b694['options']?_0x42b694['options'][_0xeaae('0xa')]||null:null,'limit':_0x42b694['options']?_0x42b694['options'][_0xeaae('0xb')]||null:null,'include':_0x42b694[_0xeaae('0x8')]?_0x42b694[_0xeaae('0x8')][_0xeaae('0xc')]?_[_0xeaae('0xd')](_0x42b694[_0xeaae('0x8')][_0xeaae('0xc')],function(_0x4dcb7d){return{'model':db[_0x4dcb7d['model']],'as':_0x4dcb7d['as'],'attributes':_0x4dcb7d['as']===_0xeaae('0x27')?_['keys'](_0x42d002):_0x4dcb7d['attributes'],'include':_0x4dcb7d[_0xeaae('0xc')]?_[_0xeaae('0xd')](_0x4dcb7d['include'],function(_0x378177){return{'model':db[_0x378177[_0xeaae('0xe')]],'as':_0x378177['as'],'attributes':_0x378177[_0xeaae('0xa')],'include':_0x378177[_0xeaae('0xc')]?_[_0xeaae('0xd')](_0x378177[_0xeaae('0xc')],function(_0x3ffa5d){return{'model':db[_0x3ffa5d[_0xeaae('0xe')]],'as':_0x3ffa5d['as'],'attributes':_0x3ffa5d[_0xeaae('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14bd5f){logger['info'](_0xeaae('0x5'),_0x42b694);logger['debug'](_0xeaae('0x5'),_0x42b694,JSON['stringify'](_0x14bd5f));_0x24b12d(_0x14bd5f);})[_0xeaae('0x17')](function(_0x4b35f2){logger[_0xeaae('0x18')](_0xeaae('0x5'),_0x4b35f2[_0xeaae('0x12')],_0x42b694);_0x5ec067(_0x5e1efb[_0xeaae('0x18')](0x1f4,_0x4b35f2['message']));});});});};exports[_0xeaae('0x41')]=function(_0x4aca1e){var _0x37075d=this;return new Promise(function(_0x4098f6,_0x1c1ceb){return db[_0xeaae('0x21')]['findOne']({'raw':!![],'where':{'phone':_0x4aca1e[_0xeaae('0x8')][_0xeaae('0x9')][_0xeaae('0x42')]},'attributes':['id',_0xeaae('0x43')],'order':[['id',_0xeaae('0x44')]]})[_0xeaae('0xf')](function(_0x47cc16){logger[_0xeaae('0x10')](_0xeaae('0x45'),_0x4aca1e);logger[_0xeaae('0x11')](_0xeaae('0x45'),_0x4aca1e,JSON['stringify'](_0x47cc16));_0x4098f6(_0x47cc16);})[_0xeaae('0x17')](function(_0x27a8ce){logger[_0xeaae('0x18')](_0xeaae('0x45'),_0x27a8ce[_0xeaae('0x12')],_0x4aca1e);_0x1c1ceb(_0x37075d[_0xeaae('0x18')](0x1f4,_0x27a8ce[_0xeaae('0x12')]));});});};exports[_0xeaae('0x46')]=function(_0x1e9213){var _0x18fabf=this;return new Promise(function(_0x3f53f0,_0x4272d8){return db[_0xeaae('0x23')][_0xeaae('0x24')](function(_0x398612){var _0x1b3c11=_0x1e9213[_0xeaae('0x8')]&&_0x1e9213[_0xeaae('0x8')][_0xeaae('0x9')]?_0x1e9213[_0xeaae('0x8')][_0xeaae('0x9')]:{};return db['CmHopper'][_0xeaae('0x1b')](_0x1e9213[_0xeaae('0x1d')],{'where':_0x1b3c11,'transaction':_0x398612})[_0xeaae('0xf')](function(_0x30afdb){logger[_0xeaae('0x10')](_0xeaae('0x46'),_0x1e9213);logger[_0xeaae('0x11')](_0xeaae('0x46'),_0x1e9213,JSON['stringify'](_0x30afdb));_0x3f53f0(_0x30afdb);})['catch'](function(_0x3a0b84){logger[_0xeaae('0x18')](_0xeaae('0x46'),_0x3a0b84[_0xeaae('0x12')],_0x1e9213);_0x4272d8(_0x18fabf[_0xeaae('0x18')](0x1f4,_0x3a0b84[_0xeaae('0x12')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x4ffa03){var _0x541015=this;var _0x5d27ed=_0x4ffa03[_0xeaae('0x1d')][_0xeaae('0x9')][_0xeaae('0x47')];var _0x1cd9b6=_0x4ffa03['body']['where'][_0xeaae('0x48')];var _0x55c52b=_0x4ffa03[_0xeaae('0x1d')][_0xeaae('0x9')][_0xeaae('0x49')];return new Promise(function(_0x19e6b0,_0x23d728){return db[_0xeaae('0x6')]['findAll']({'where':{'voiceQueueId':{'$in':_0x5d27ed},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xeaae('0x23')]['literal'](_0xeaae('0x4a')+_0x1cd9b6+_0xeaae('0x4b')),'$gt':db['sequelize']['literal'](_0xeaae('0x4c'))}},'UserId':{'$in':_0x55c52b}},'include':[{'model':db['CmContact'],'as':_0xeaae('0x27')},{'model':db[_0xeaae('0x29')],'as':_0xeaae('0x2a'),'attributes':['id',_0xeaae('0x2b'),_0xeaae('0x2c')]},{'model':db[_0xeaae('0x4d')],'as':_0xeaae('0x4e')}]})['then'](function(_0x115e09){if(_0x115e09['length']>0x0){return db[_0xeaae('0x23')][_0xeaae('0x24')](function(_0x438ee2){return db[_0xeaae('0x6')][_0xeaae('0x1b')]({'recallmeNotifiedDate':db['sequelize']['literal'](_0xeaae('0x4c'))},{'where':{'id':{'$in':_[_0xeaae('0xd')](_0x115e09,'id')}},'transaction':_0x438ee2})[_0xeaae('0xf')](function(){_0x19e6b0(_0x115e09);})[_0xeaae('0x17')](function(_0x5b6096){logger['error'](_0xeaae('0x4f'),_0x5b6096[_0xeaae('0x12')],_0x4ffa03);_0x23d728(_0x541015['error'](0x1f4,_0x5b6096[_0xeaae('0x12')]));});})[_0xeaae('0x17')](function(_0x5323bf){logger['error'](_0xeaae('0x4f'),_0x5323bf[_0xeaae('0x12')],_0x4ffa03);_0x23d728(_0x541015[_0xeaae('0x18')](0x1f4,_0x5323bf[_0xeaae('0x12')]));});}else{_0x19e6b0(_0x115e09);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 5fccf2f..365b532 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 _0xebea=['update','destroy','exports','express','Router','./cmHopper.controller','get','index','isAuthenticated','describe','getOpenContacts','/timezones','getTimezones','/:id','show','getPreviewRecall','post','create','getPreview','/timezone','getTimezone','put'];(function(_0x25685f,_0x28cc3e){var _0x474a41=function(_0x3aa1da){while(--_0x3aa1da){_0x25685f['push'](_0x25685f['shift']());}};_0x474a41(++_0x28cc3e);}(_0xebea,0x1d1));var _0xaebe=function(_0x5f0f33,_0x419a1e){_0x5f0f33=_0x5f0f33-0x0;var _0x3e6c81=_0xebea[_0x5f0f33];return _0x3e6c81;};'use strict';var express=require(_0xaebe('0x0'));var router=express[_0xaebe('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xaebe('0x2'));router[_0xaebe('0x3')]('/',auth['isAuthenticated'](),controller[_0xaebe('0x4')]);router[_0xaebe('0x3')]('/describe',auth[_0xaebe('0x5')](),controller[_0xaebe('0x6')]);router[_0xaebe('0x3')]('/opencontacts',auth[_0xaebe('0x5')](),controller[_0xaebe('0x7')]);router[_0xaebe('0x3')](_0xaebe('0x8'),auth['isAuthenticated'](),controller[_0xaebe('0x9')]);router[_0xaebe('0x3')](_0xaebe('0xa'),auth[_0xaebe('0x5')](),controller[_0xaebe('0xb')]);router[_0xaebe('0x3')]('/:id/previewrecall',auth['isAuthenticated'](),controller[_0xaebe('0xc')]);router[_0xaebe('0xd')]('/',auth['isAuthenticated'](),controller[_0xaebe('0xe')]);router['post']('/preview',auth['isAuthenticated'](),controller[_0xaebe('0xf')]);router[_0xaebe('0xd')](_0xaebe('0x10'),auth[_0xaebe('0x5')](),controller[_0xaebe('0x11')]);router[_0xaebe('0x12')](_0xaebe('0xa'),auth[_0xaebe('0x5')](),controller[_0xaebe('0x13')]);router['delete'](_0xaebe('0xa'),auth['isAuthenticated'](),controller[_0xaebe('0x14')]);module[_0xaebe('0x15')]=router; \ No newline at end of file +var _0x2a4c=['./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','create','/preview','getPreview','/timezone','getTimezone','update','destroy','express','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a4c,0x81));var _0xc2a4=function(_0x535b46,_0xe83884){_0x535b46=_0x535b46-0x0;var _0x120c48=_0x2a4c[_0x535b46];return _0x120c48;};'use strict';var express=require(_0xc2a4('0x0'));var router=express[_0xc2a4('0x1')]();var auth=require(_0xc2a4('0x2'));var controller=require(_0xc2a4('0x3'));router[_0xc2a4('0x4')]('/',auth[_0xc2a4('0x5')](),controller[_0xc2a4('0x6')]);router[_0xc2a4('0x4')](_0xc2a4('0x7'),auth[_0xc2a4('0x5')](),controller['describe']);router['get'](_0xc2a4('0x8'),auth['isAuthenticated'](),controller[_0xc2a4('0x9')]);router[_0xc2a4('0x4')](_0xc2a4('0xa'),auth[_0xc2a4('0x5')](),controller[_0xc2a4('0xb')]);router[_0xc2a4('0x4')](_0xc2a4('0xc'),auth[_0xc2a4('0x5')](),controller['show']);router['get'](_0xc2a4('0xd'),auth[_0xc2a4('0x5')](),controller[_0xc2a4('0xe')]);router['post']('/',auth[_0xc2a4('0x5')](),controller[_0xc2a4('0xf')]);router['post'](_0xc2a4('0x10'),auth['isAuthenticated'](),controller[_0xc2a4('0x11')]);router['post'](_0xc2a4('0x12'),auth[_0xc2a4('0x5')](),controller[_0xc2a4('0x13')]);router['put']('/:id',auth[_0xc2a4('0x5')](),controller[_0xc2a4('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc2a4('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index be0daf7..b294dd0 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 _0x560a=['format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','INTEGER','STRING','DATE'];(function(_0x538b31,_0x80e294){var _0x4348f0=function(_0x428ae3){while(--_0x428ae3){_0x538b31['push'](_0x538b31['shift']());}};_0x4348f0(++_0x80e294);}(_0x560a,0x136));var _0xa560=function(_0x549d2b,_0x2acfaa){_0x549d2b=_0x549d2b-0x0;var _0x2f7f64=_0x560a[_0x549d2b];return _0x2f7f64;};'use strict';var moment=require(_0xa560('0x0'));var Sequelize=require('sequelize');module[_0xa560('0x1')]={'CmHopperId':{'type':Sequelize[_0xa560('0x2')]},'phone':{'type':Sequelize[_0xa560('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xa560('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xa560('0x4')],'defaultValue':moment()[_0xa560('0x5')](_0xa560('0x6'))},'countbusyretry':{'type':Sequelize[_0xa560('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xa560('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa560('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa560('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa560('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa560('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x36c0=['YYYY-MM-DD\x20HH:mm:ss','moment','INTEGER','STRING','format'];(function(_0x107f72,_0x4f449a){var _0x412031=function(_0x562001){while(--_0x562001){_0x107f72['push'](_0x107f72['shift']());}};_0x412031(++_0x4f449a);}(_0x36c0,0x65));var _0x036c=function(_0x101b65,_0x2a18a1){_0x101b65=_0x101b65-0x0;var _0x3820ee=_0x36c0[_0x101b65];return _0x3820ee;};'use strict';var moment=require(_0x036c('0x0'));var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0x036c('0x1')]},'phone':{'type':Sequelize[_0x036c('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x036c('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x036c('0x3')](_0x036c('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x036c('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x036c('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x036c('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x036c('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x036c('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x036c('0x1')],'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 ff120a4..17cc634 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 _0x9921=['ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','sendStatus','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','count','includeAll','include','findAll','rows','catch','show','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','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','path','sox','to-csv'];(function(_0x379a1e,_0x46a119){var _0x5776e0=function(_0x996fe6){while(--_0x996fe6){_0x379a1e['push'](_0x379a1e['shift']());}};_0x5776e0(++_0x46a119);}(_0x9921,0x9e));var _0x1992=function(_0x49d5ad,_0x4d2c9d){_0x49d5ad=_0x49d5ad-0x0;var _0x57b756=_0x9921[_0x49d5ad];return _0x57b756;};'use strict';var emlformat=require(_0x1992('0x0'));var rimraf=require(_0x1992('0x1'));var zipdir=require(_0x1992('0x2'));var jsonpatch=require(_0x1992('0x3'));var rp=require(_0x1992('0x4'));var moment=require(_0x1992('0x5'));var BPromise=require(_0x1992('0x6'));var Mustache=require(_0x1992('0x7'));var util=require(_0x1992('0x8'));var path=require(_0x1992('0x9'));var sox=require(_0x1992('0xa'));var csv=require(_0x1992('0xb'));var ejs=require(_0x1992('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1992('0xd'));var squel=require(_0x1992('0xe'));var crypto=require(_0x1992('0xf'));var jsforce=require(_0x1992('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x1992('0xb'));var querystring=require(_0x1992('0x11'));var Papa=require(_0x1992('0x12'));var Redis=require(_0x1992('0x13'));var authService=require(_0x1992('0x14'));var qs=require(_0x1992('0x15'));var as=require(_0x1992('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1992('0x17'))(_0x1992('0x18'));var utils=require(_0x1992('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d8a8c,_0x4cb664){_0x4cb664=_0x4cb664||0xcc;return function(_0x258420){if(_0x258420){return _0x1d8a8c['sendStatus'](_0x4cb664);}return _0x1d8a8c['status'](_0x4cb664)[_0x1992('0x1a')]();};}function respondWithResult(_0x7105c0,_0x36542e){_0x36542e=_0x36542e||0xc8;return function(_0x44cc2e){if(_0x44cc2e){return _0x7105c0[_0x1992('0x1b')](_0x36542e)[_0x1992('0x1c')](_0x44cc2e);}};}function respondWithFilteredResult(_0x4d4821,_0x330508){return function(_0x2ac913){if(_0x2ac913){var _0x531e33=typeof _0x330508[_0x1992('0x1d')]===_0x1992('0x1e')&&typeof _0x330508[_0x1992('0x1f')]===_0x1992('0x1e');var _0x4fbbfb=_0x2ac913['count'];var _0x36ddac=_0x531e33?0x0:_0x330508[_0x1992('0x1d')];var _0x192e4a=_0x531e33?_0x2ac913['count']:_0x330508[_0x1992('0x1d')]+_0x330508[_0x1992('0x1f')];var _0x35b7d7;if(_0x192e4a>=_0x4fbbfb){_0x192e4a=_0x4fbbfb;_0x35b7d7=0xc8;}else{_0x35b7d7=0xce;}_0x4d4821[_0x1992('0x1b')](_0x35b7d7);return _0x4d4821['set'](_0x1992('0x20'),_0x36ddac+'-'+_0x192e4a+'/'+_0x4fbbfb)[_0x1992('0x1c')](_0x2ac913);}return null;};}function patchUpdates(_0x10344d){return function(_0x255a2e){try{jsonpatch[_0x1992('0x21')](_0x255a2e,_0x10344d,!![]);}catch(_0x218e1e){return BPromise[_0x1992('0x22')](_0x218e1e);}return _0x255a2e[_0x1992('0x23')]();};}function saveUpdates(_0x53775d,_0x401fe8){return function(_0x5e6ad0){if(_0x5e6ad0){return _0x5e6ad0[_0x1992('0x24')](_0x53775d)[_0x1992('0x25')](function(_0x3f4454){return _0x3f4454;});}return null;};}function removeEntity(_0x560c0a,_0xb573e3){return function(_0x355354){if(_0x355354){return _0x355354[_0x1992('0x26')]()[_0x1992('0x25')](function(){var _0x55d465=_0x355354['get']({'plain':!![]});var _0x55f2ac=_0x1992('0x27');return db[_0x1992('0x28')][_0x1992('0x26')]({'where':{'type':_0x55f2ac,'resourceId':_0x55d465['id']}})[_0x1992('0x25')](function(){return _0x355354;});})[_0x1992('0x25')](function(){_0x560c0a[_0x1992('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cbe26,_0x514246){return function(_0x4bbe43){if(!_0x4bbe43){_0x1cbe26[_0x1992('0x29')](0x194);}return _0x4bbe43;};}function handleError(_0x41be65,_0x10137c){_0x10137c=_0x10137c||0x1f4;return function(_0x12f8b9){logger[_0x1992('0x2a')](_0x12f8b9[_0x1992('0x2b')]);if(_0x12f8b9['name']){delete _0x12f8b9[_0x1992('0x2c')];}_0x41be65[_0x1992('0x1b')](_0x10137c)[_0x1992('0x2d')](_0x12f8b9);};}exports['index']=function(_0x4dd92d,_0x294ad2){var _0x4d9df6={},_0x20d746={},_0x5b8774={'count':0x0,'rows':[]};var _0x277c8a=_[_0x1992('0x2e')](db[_0x1992('0x2f')][_0x1992('0x30')],function(_0x47b078){return{'name':_0x47b078[_0x1992('0x31')],'type':_0x47b078['type']['key']};});_0x20d746[_0x1992('0x32')]=_['map'](_0x277c8a,_0x1992('0x2c'));_0x20d746[_0x1992('0x33')]=_[_0x1992('0x34')](_0x4dd92d[_0x1992('0x33')]);_0x20d746['filters']=_['intersection'](_0x20d746[_0x1992('0x32')],_0x20d746[_0x1992('0x33')]);_0x4d9df6['attributes']=_[_0x1992('0x35')](_0x20d746[_0x1992('0x32')],qs['fields'](_0x4dd92d[_0x1992('0x33')][_0x1992('0x36')]));_0x4d9df6[_0x1992('0x37')]=_0x4d9df6[_0x1992('0x37')]['length']?_0x4d9df6[_0x1992('0x37')]:_0x20d746['model'];if(!_0x4dd92d[_0x1992('0x33')][_0x1992('0x38')](_0x1992('0x39'))){_0x4d9df6[_0x1992('0x1f')]=qs[_0x1992('0x1f')](_0x4dd92d[_0x1992('0x33')]['limit']);_0x4d9df6[_0x1992('0x1d')]=qs['offset'](_0x4dd92d[_0x1992('0x33')]['offset']);}_0x4d9df6[_0x1992('0x3a')]=qs[_0x1992('0x3b')](_0x4dd92d['query']['sort']);_0x4d9df6[_0x1992('0x3c')]=qs[_0x1992('0x3d')](_[_0x1992('0x3e')](_0x4dd92d['query'],_0x20d746[_0x1992('0x3d')]),_0x277c8a);if(_0x4dd92d['query']['filter']){_0x4d9df6[_0x1992('0x3c')]=_[_0x1992('0x3f')](_0x4d9df6[_0x1992('0x3c')],{'$or':_[_0x1992('0x2e')](_0x277c8a,function(_0x19161e){if(_0x19161e['type']!=='VIRTUAL'){var _0x35d327={};_0x35d327[_0x19161e[_0x1992('0x2c')]]={'$like':'%'+_0x4dd92d[_0x1992('0x33')]['filter']+'%'};return _0x35d327;}})});}_0x4d9df6=_[_0x1992('0x3f')]({},_0x4d9df6,_0x4dd92d[_0x1992('0x40')]);var _0xf6601={'where':_0x4d9df6['where']};return db[_0x1992('0x2f')][_0x1992('0x41')](_0xf6601)[_0x1992('0x25')](function(_0x2476b0){_0x5b8774[_0x1992('0x41')]=_0x2476b0;if(_0x4dd92d[_0x1992('0x33')][_0x1992('0x42')]){_0x4d9df6[_0x1992('0x43')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x1992('0x44')](_0x4d9df6);})[_0x1992('0x25')](function(_0x4f196e){_0x5b8774[_0x1992('0x45')]=_0x4f196e;return _0x5b8774;})['then'](respondWithFilteredResult(_0x294ad2,_0x4d9df6))[_0x1992('0x46')](handleError(_0x294ad2,null));};exports[_0x1992('0x47')]=function(_0x2a4a56,_0x4fa32e){var _0x574af2={'raw':!![],'where':{'id':_0x2a4a56['params']['id']}},_0x57f3a7={};_0x57f3a7[_0x1992('0x32')]=_[_0x1992('0x34')](db[_0x1992('0x2f')][_0x1992('0x30')]);_0x57f3a7[_0x1992('0x33')]=_[_0x1992('0x34')](_0x2a4a56[_0x1992('0x33')]);_0x57f3a7[_0x1992('0x3d')]=_[_0x1992('0x35')](_0x57f3a7[_0x1992('0x32')],_0x57f3a7[_0x1992('0x33')]);_0x574af2[_0x1992('0x37')]=_['intersection'](_0x57f3a7['model'],qs[_0x1992('0x36')](_0x2a4a56['query']['fields']));_0x574af2[_0x1992('0x37')]=_0x574af2[_0x1992('0x37')][_0x1992('0x48')]?_0x574af2[_0x1992('0x37')]:_0x57f3a7[_0x1992('0x32')];if(_0x2a4a56[_0x1992('0x33')]['includeAll']){_0x574af2['include']=[{'all':!![]}];}_0x574af2=_['merge']({},_0x574af2,_0x2a4a56[_0x1992('0x40')]);return db[_0x1992('0x2f')][_0x1992('0x49')](_0x574af2)[_0x1992('0x25')](handleEntityNotFound(_0x4fa32e,null))[_0x1992('0x25')](respondWithResult(_0x4fa32e,null))[_0x1992('0x46')](handleError(_0x4fa32e,null));};exports[_0x1992('0x4a')]=function(_0x26f61f,_0x35ddc8){return db['CmHopperAdditionalPhone'][_0x1992('0x4a')](_0x26f61f[_0x1992('0x4b')],{})[_0x1992('0x25')](function(_0x2669d5){var _0x3efe85=_0x26f61f['user'][_0x1992('0x4c')]({'plain':!![]});if(!_0x3efe85)throw new Error(_0x1992('0x4d'));if(_0x3efe85[_0x1992('0x4e')]===_0x1992('0x4f')){var _0x549b3a=_0x2669d5[_0x1992('0x4c')]({'plain':!![]});var _0x140336=_0x1992('0x27');return db[_0x1992('0x50')]['find']({'where':{'name':_0x140336,'userProfileId':_0x3efe85[_0x1992('0x51')]},'raw':!![]})[_0x1992('0x25')](function(_0x3b15f3){if(_0x3b15f3&&_0x3b15f3[_0x1992('0x52')]===0x0){return db[_0x1992('0x28')][_0x1992('0x4a')]({'name':_0x549b3a[_0x1992('0x2c')],'resourceId':_0x549b3a['id'],'type':_0x3b15f3[_0x1992('0x2c')],'sectionId':_0x3b15f3['id']},{})[_0x1992('0x25')](function(){return _0x2669d5;});}else{return _0x2669d5;}})['catch'](function(_0x481e8e){logger['error'](_0x1992('0x53'),_0x481e8e);throw _0x481e8e;});}return _0x2669d5;})['then'](respondWithResult(_0x35ddc8,0xc9))[_0x1992('0x46')](handleError(_0x35ddc8,null));};exports[_0x1992('0x24')]=function(_0x500f4b,_0x4da86a){if(_0x500f4b[_0x1992('0x4b')]['id']){delete _0x500f4b[_0x1992('0x4b')]['id'];}return db[_0x1992('0x2f')][_0x1992('0x49')]({'where':{'id':_0x500f4b[_0x1992('0x54')]['id']}})[_0x1992('0x25')](handleEntityNotFound(_0x4da86a,null))[_0x1992('0x25')](saveUpdates(_0x500f4b[_0x1992('0x4b')],null))[_0x1992('0x25')](respondWithResult(_0x4da86a,null))[_0x1992('0x46')](handleError(_0x4da86a,null));};exports[_0x1992('0x26')]=function(_0x3260d7,_0x504ab8){return db['CmHopperAdditionalPhone'][_0x1992('0x49')]({'where':{'id':_0x3260d7[_0x1992('0x54')]['id']}})[_0x1992('0x25')](handleEntityNotFound(_0x504ab8,null))[_0x1992('0x25')](removeEntity(_0x504ab8,null))['catch'](handleError(_0x504ab8,null));}; \ No newline at end of file +var _0x6981=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','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','end','status','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','get','CmHopperAdditionalPhones','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','role','UserProfileSection','userProfileId'];(function(_0x5ecc5d,_0x38d142){var _0x5b98a3=function(_0x469ad1){while(--_0x469ad1){_0x5ecc5d['push'](_0x5ecc5d['shift']());}};_0x5b98a3(++_0x38d142);}(_0x6981,0x146));var _0x1698=function(_0x437c5d,_0x418ff6){_0x437c5d=_0x437c5d-0x0;var _0x566c72=_0x6981[_0x437c5d];return _0x566c72;};'use strict';var emlformat=require(_0x1698('0x0'));var rimraf=require(_0x1698('0x1'));var zipdir=require(_0x1698('0x2'));var jsonpatch=require(_0x1698('0x3'));var rp=require(_0x1698('0x4'));var moment=require('moment');var BPromise=require(_0x1698('0x5'));var Mustache=require('mustache');var util=require(_0x1698('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1698('0x7'));var ejs=require(_0x1698('0x8'));var fs=require('fs');var fs_extra=require(_0x1698('0x9'));var _=require(_0x1698('0xa'));var squel=require(_0x1698('0xb'));var crypto=require(_0x1698('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1698('0xd'));var toCsv=require(_0x1698('0x7'));var querystring=require('querystring');var Papa=require(_0x1698('0xe'));var Redis=require(_0x1698('0xf'));var authService=require(_0x1698('0x10'));var qs=require(_0x1698('0x11'));var as=require(_0x1698('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1698('0x13'))(_0x1698('0x14'));var utils=require(_0x1698('0x15'));var config=require(_0x1698('0x16'));var licenseUtil=require(_0x1698('0x17'));var db=require(_0x1698('0x18'))['db'];function respondWithStatusCode(_0x4d63f3,_0x5363f1){_0x5363f1=_0x5363f1||0xcc;return function(_0x29b20e){if(_0x29b20e){return _0x4d63f3[_0x1698('0x19')](_0x5363f1);}return _0x4d63f3['status'](_0x5363f1)[_0x1698('0x1a')]();};}function respondWithResult(_0x2e1037,_0x4a1a7c){_0x4a1a7c=_0x4a1a7c||0xc8;return function(_0x3a46fa){if(_0x3a46fa){return _0x2e1037[_0x1698('0x1b')](_0x4a1a7c)['json'](_0x3a46fa);}};}function respondWithFilteredResult(_0x462d52,_0x37b44e){return function(_0x3207db){if(_0x3207db){var _0x1689c7=typeof _0x37b44e[_0x1698('0x1c')]==='undefined'&&typeof _0x37b44e[_0x1698('0x1d')]===_0x1698('0x1e');var _0x38a9f8=_0x3207db[_0x1698('0x1f')];var _0x2bcb2e=_0x1689c7?0x0:_0x37b44e[_0x1698('0x1c')];var _0x40f7f0=_0x1689c7?_0x3207db[_0x1698('0x1f')]:_0x37b44e['offset']+_0x37b44e[_0x1698('0x1d')];var _0x7658c6;if(_0x40f7f0>=_0x38a9f8){_0x40f7f0=_0x38a9f8;_0x7658c6=0xc8;}else{_0x7658c6=0xce;}_0x462d52[_0x1698('0x1b')](_0x7658c6);return _0x462d52['set'](_0x1698('0x20'),_0x2bcb2e+'-'+_0x40f7f0+'/'+_0x38a9f8)['json'](_0x3207db);}return null;};}function patchUpdates(_0x35b683){return function(_0xfbb218){try{jsonpatch[_0x1698('0x21')](_0xfbb218,_0x35b683,!![]);}catch(_0x4f4021){return BPromise[_0x1698('0x22')](_0x4f4021);}return _0xfbb218[_0x1698('0x23')]();};}function saveUpdates(_0x2b381b,_0x231679){return function(_0x10c6ca){if(_0x10c6ca){return _0x10c6ca[_0x1698('0x24')](_0x2b381b)['then'](function(_0xaf86c0){return _0xaf86c0;});}return null;};}function removeEntity(_0x2d33e4,_0x80ed34){return function(_0x26193b){if(_0x26193b){return _0x26193b['destroy']()[_0x1698('0x25')](function(){var _0x5c2f46=_0x26193b[_0x1698('0x26')]({'plain':!![]});var _0x5e0ab9=_0x1698('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x5e0ab9,'resourceId':_0x5c2f46['id']}})[_0x1698('0x25')](function(){return _0x26193b;});})[_0x1698('0x25')](function(){_0x2d33e4[_0x1698('0x1b')](0xcc)[_0x1698('0x1a')]();});}};}function handleEntityNotFound(_0x309797,_0x495c4a){return function(_0x584b57){if(!_0x584b57){_0x309797['sendStatus'](0x194);}return _0x584b57;};}function handleError(_0x55fcfc,_0xbe337a){_0xbe337a=_0xbe337a||0x1f4;return function(_0x4c8d90){logger[_0x1698('0x28')](_0x4c8d90[_0x1698('0x29')]);if(_0x4c8d90[_0x1698('0x2a')]){delete _0x4c8d90[_0x1698('0x2a')];}_0x55fcfc[_0x1698('0x1b')](_0xbe337a)[_0x1698('0x2b')](_0x4c8d90);};}exports[_0x1698('0x2c')]=function(_0x3ba39c,_0x4a31b5){var _0x23f293={},_0x2ae2a9={},_0x2b0bfd={'count':0x0,'rows':[]};var _0xea661e=_[_0x1698('0x2d')](db[_0x1698('0x2e')][_0x1698('0x2f')],function(_0x462822){return{'name':_0x462822[_0x1698('0x30')],'type':_0x462822[_0x1698('0x31')]['key']};});_0x2ae2a9['model']=_['map'](_0xea661e,_0x1698('0x2a'));_0x2ae2a9[_0x1698('0x32')]=_['keys'](_0x3ba39c[_0x1698('0x32')]);_0x2ae2a9[_0x1698('0x33')]=_['intersection'](_0x2ae2a9[_0x1698('0x34')],_0x2ae2a9[_0x1698('0x32')]);_0x23f293[_0x1698('0x35')]=_[_0x1698('0x36')](_0x2ae2a9[_0x1698('0x34')],qs[_0x1698('0x37')](_0x3ba39c[_0x1698('0x32')][_0x1698('0x37')]));_0x23f293[_0x1698('0x35')]=_0x23f293[_0x1698('0x35')]['length']?_0x23f293['attributes']:_0x2ae2a9['model'];if(!_0x3ba39c[_0x1698('0x32')][_0x1698('0x38')](_0x1698('0x39'))){_0x23f293[_0x1698('0x1d')]=qs['limit'](_0x3ba39c['query'][_0x1698('0x1d')]);_0x23f293[_0x1698('0x1c')]=qs[_0x1698('0x1c')](_0x3ba39c[_0x1698('0x32')][_0x1698('0x1c')]);}_0x23f293[_0x1698('0x3a')]=qs[_0x1698('0x3b')](_0x3ba39c[_0x1698('0x32')][_0x1698('0x3b')]);_0x23f293[_0x1698('0x3c')]=qs[_0x1698('0x33')](_[_0x1698('0x3d')](_0x3ba39c[_0x1698('0x32')],_0x2ae2a9['filters']),_0xea661e);if(_0x3ba39c['query'][_0x1698('0x3e')]){_0x23f293[_0x1698('0x3c')]=_[_0x1698('0x3f')](_0x23f293[_0x1698('0x3c')],{'$or':_['map'](_0xea661e,function(_0x192a8d){if(_0x192a8d[_0x1698('0x31')]!==_0x1698('0x40')){var _0x5291e8={};_0x5291e8[_0x192a8d[_0x1698('0x2a')]]={'$like':'%'+_0x3ba39c['query'][_0x1698('0x3e')]+'%'};return _0x5291e8;}})});}_0x23f293=_[_0x1698('0x3f')]({},_0x23f293,_0x3ba39c['options']);var _0x5966d5={'where':_0x23f293[_0x1698('0x3c')]};return db['CmHopperAdditionalPhone'][_0x1698('0x1f')](_0x5966d5)[_0x1698('0x25')](function(_0x1ecf6c){_0x2b0bfd[_0x1698('0x1f')]=_0x1ecf6c;if(_0x3ba39c['query'][_0x1698('0x41')]){_0x23f293[_0x1698('0x42')]=[{'all':!![]}];}return db[_0x1698('0x2e')][_0x1698('0x43')](_0x23f293);})[_0x1698('0x25')](function(_0x3a84b2){_0x2b0bfd[_0x1698('0x44')]=_0x3a84b2;return _0x2b0bfd;})[_0x1698('0x25')](respondWithFilteredResult(_0x4a31b5,_0x23f293))[_0x1698('0x45')](handleError(_0x4a31b5,null));};exports['show']=function(_0x4a35d4,_0x3c42bd){var _0xd8b18={'raw':!![],'where':{'id':_0x4a35d4[_0x1698('0x46')]['id']}},_0x3c69a8={};_0x3c69a8[_0x1698('0x34')]=_[_0x1698('0x47')](db[_0x1698('0x2e')][_0x1698('0x2f')]);_0x3c69a8[_0x1698('0x32')]=_['keys'](_0x4a35d4[_0x1698('0x32')]);_0x3c69a8[_0x1698('0x33')]=_[_0x1698('0x36')](_0x3c69a8[_0x1698('0x34')],_0x3c69a8[_0x1698('0x32')]);_0xd8b18['attributes']=_[_0x1698('0x36')](_0x3c69a8[_0x1698('0x34')],qs[_0x1698('0x37')](_0x4a35d4[_0x1698('0x32')][_0x1698('0x37')]));_0xd8b18[_0x1698('0x35')]=_0xd8b18[_0x1698('0x35')]['length']?_0xd8b18[_0x1698('0x35')]:_0x3c69a8[_0x1698('0x34')];if(_0x4a35d4[_0x1698('0x32')][_0x1698('0x41')]){_0xd8b18[_0x1698('0x42')]=[{'all':!![]}];}_0xd8b18=_[_0x1698('0x3f')]({},_0xd8b18,_0x4a35d4['options']);return db[_0x1698('0x2e')][_0x1698('0x48')](_0xd8b18)[_0x1698('0x25')](handleEntityNotFound(_0x3c42bd,null))['then'](respondWithResult(_0x3c42bd,null))[_0x1698('0x45')](handleError(_0x3c42bd,null));};exports[_0x1698('0x49')]=function(_0x2eb0fb,_0x7d63a3){return db[_0x1698('0x2e')][_0x1698('0x49')](_0x2eb0fb[_0x1698('0x4a')],{})['then'](function(_0x1bd71f){var _0x1b8b34=_0x2eb0fb[_0x1698('0x4b')][_0x1698('0x26')]({'plain':!![]});if(!_0x1b8b34)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b8b34[_0x1698('0x4c')]===_0x1698('0x4b')){var _0x38827c=_0x1bd71f[_0x1698('0x26')]({'plain':!![]});var _0x2fead6=_0x1698('0x27');return db[_0x1698('0x4d')][_0x1698('0x48')]({'where':{'name':_0x2fead6,'userProfileId':_0x1b8b34[_0x1698('0x4e')]},'raw':!![]})[_0x1698('0x25')](function(_0x2b3342){if(_0x2b3342&&_0x2b3342[_0x1698('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x38827c[_0x1698('0x2a')],'resourceId':_0x38827c['id'],'type':_0x2b3342[_0x1698('0x2a')],'sectionId':_0x2b3342['id']},{})[_0x1698('0x25')](function(){return _0x1bd71f;});}else{return _0x1bd71f;}})[_0x1698('0x45')](function(_0x5bb938){logger[_0x1698('0x28')](_0x1698('0x50'),_0x5bb938);throw _0x5bb938;});}return _0x1bd71f;})[_0x1698('0x25')](respondWithResult(_0x7d63a3,0xc9))[_0x1698('0x45')](handleError(_0x7d63a3,null));};exports[_0x1698('0x24')]=function(_0xc0dacc,_0x4ace68){if(_0xc0dacc[_0x1698('0x4a')]['id']){delete _0xc0dacc[_0x1698('0x4a')]['id'];}return db[_0x1698('0x2e')][_0x1698('0x48')]({'where':{'id':_0xc0dacc[_0x1698('0x46')]['id']}})[_0x1698('0x25')](handleEntityNotFound(_0x4ace68,null))['then'](saveUpdates(_0xc0dacc[_0x1698('0x4a')],null))[_0x1698('0x25')](respondWithResult(_0x4ace68,null))[_0x1698('0x45')](handleError(_0x4ace68,null));};exports['destroy']=function(_0x51929e,_0x70a684){return db[_0x1698('0x2e')][_0x1698('0x48')]({'where':{'id':_0x51929e[_0x1698('0x46')]['id']}})[_0x1698('0x25')](handleEntityNotFound(_0x70a684,null))[_0x1698('0x25')](removeEntity(_0x70a684,null))['catch'](handleError(_0x70a684,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 30fff87..b00a650 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 _0x66c7=['rimraf','../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2797c6,_0x37421b){var _0x54809f=function(_0x2d100c){while(--_0x2d100c){_0x2797c6['push'](_0x2797c6['shift']());}};_0x54809f(++_0x37421b);}(_0x66c7,0x19d));var _0x766c=function(_0x12dd56,_0x883203){_0x12dd56=_0x12dd56-0x0;var _0x8725b9=_0x66c7[_0x12dd56];return _0x8725b9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x766c('0x0'))(_0x766c('0x1'));var moment=require('moment');var BPromise=require(_0x766c('0x2'));var rp=require(_0x766c('0x3'));var fs=require('fs');var path=require(_0x766c('0x4'));var rimraf=require(_0x766c('0x5'));var config=require(_0x766c('0x6'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x766c('0x7')]=function(_0x586ca6,_0x1ddbd9){return _0x586ca6[_0x766c('0x8')](_0x766c('0x9'),attributes,{'tableName':_0x766c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5da1=['CmHopperAdditionalPhone','cm_hopper_additional_phones','api','moment','bluebird','path','../../config/environment','./cmHopperAdditionalPhone.attributes','define'];(function(_0x5cfe83,_0x4b0a71){var _0x15153c=function(_0x27942a){while(--_0x27942a){_0x5cfe83['push'](_0x5cfe83['shift']());}};_0x15153c(++_0x4b0a71);}(_0x5da1,0xbf));var _0x15da=function(_0x320170,_0x3a5d85){_0x320170=_0x320170-0x0;var _0x4ec7fd=_0x5da1[_0x320170];return _0x4ec7fd;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x15da('0x0'));var moment=require(_0x15da('0x1'));var BPromise=require(_0x15da('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x15da('0x3'));var rimraf=require('rimraf');var config=require(_0x15da('0x4'));var attributes=require(_0x15da('0x5'));module['exports']=function(_0x261900,_0x4054bd){return _0x261900[_0x15da('0x6')](_0x15da('0x7'),attributes,{'tableName':_0x15da('0x8'),'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 84a3752..846d755 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 _0x5ef8=['duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','countbusyretry','countcongestionretry','countmachineretry','catch','VerifyAdditionalPhones','SwapAdditionalPhones'];(function(_0x2146d3,_0x22f2fc){var _0x10d24a=function(_0x17ec9d){while(--_0x17ec9d){_0x2146d3['push'](_0x2146d3['shift']());}};_0x10d24a(++_0x22f2fc);}(_0x5ef8,0x7f));var _0x85ef=function(_0x5271ec,_0x295a44){_0x5271ec=_0x5271ec-0x0;var _0x257e8e=_0x5ef8[_0x5271ec];return _0x257e8e;};'use strict';var _=require(_0x85ef('0x0'));var util=require(_0x85ef('0x1'));var moment=require(_0x85ef('0x2'));var BPromise=require(_0x85ef('0x3'));var rs=require(_0x85ef('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x85ef('0x5'));var config=require(_0x85ef('0x6'));var jayson=require(_0x85ef('0x7'));var client=jayson[_0x85ef('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e1cf8,_0x4c44f6,_0x43e96d){return new BPromise(function(_0xfa9518,_0xbbe5b2){return client[_0x85ef('0x9')](_0x2e1cf8,_0x43e96d)[_0x85ef('0xa')](function(_0x4e3964){logger[_0x85ef('0xb')](_0x85ef('0xc'),_0x4c44f6,'request\x20sent');logger[_0x85ef('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x4c44f6,_0x85ef('0xe'),JSON[_0x85ef('0xf')](_0x4e3964));if(_0x4e3964[_0x85ef('0x10')]){if(_0x4e3964[_0x85ef('0x10')]['code']===0x1f4){logger[_0x85ef('0x10')](_0x85ef('0xc'),_0x4c44f6,_0x4e3964[_0x85ef('0x10')][_0x85ef('0x11')]);return _0xbbe5b2(_0x4e3964[_0x85ef('0x10')][_0x85ef('0x11')]);}logger[_0x85ef('0x10')](_0x85ef('0xc'),_0x4c44f6,_0x4e3964[_0x85ef('0x10')]['message']);return _0xfa9518(_0x4e3964[_0x85ef('0x10')]['message']);}else{logger[_0x85ef('0xb')](_0x85ef('0xc'),_0x4c44f6,_0x85ef('0xe'));_0xfa9518(_0x4e3964[_0x85ef('0x12')]['message']);}})['catch'](function(_0x28ab1c){logger[_0x85ef('0x10')](_0x85ef('0xc'),_0x4c44f6,_0x28ab1c);_0xbbe5b2(_0x28ab1c);});});}exports['VerifyAdditionalPhones']=function(_0xc1e223){var _0x538098=this;return new Promise(function(_0x2099a1,_0x1893f4){return db[_0x85ef('0x13')][_0x85ef('0x14')]({'raw':!![],'where':{'ContactId':_0xc1e223[_0x85ef('0x15')][_0x85ef('0x16')],'ListId':_0xc1e223[_0x85ef('0x15')][_0x85ef('0x17')],'VoiceQueueId':_0xc1e223[_0x85ef('0x15')][_0x85ef('0x18')]===undefined?null:_0xc1e223['body'][_0x85ef('0x18')],'CampaignId':_0xc1e223['body'][_0x85ef('0x19')]===undefined?null:_0xc1e223[_0x85ef('0x15')][_0x85ef('0x19')]}})[_0x85ef('0xa')](function(_0x4e7534){if(_0x4e7534!=null){return db[_0x85ef('0x1a')][_0x85ef('0x14')]({'raw':!![],'where':{'CmHopperId':_0x4e7534['id'],'OrderBy':{'$gt':_0x4e7534[_0x85ef('0x1b')]}},'order':[[_0x85ef('0x1b'),_0x85ef('0x1c')]]})[_0x85ef('0xa')](function(_0x4c3786){var _0x4ef91b=0x0;if(_0x4c3786){if(_0x4c3786['countbusyretry']+_0x4c3786['countcongestionretry']+_0x4c3786[_0x85ef('0x1d')]+_0x4c3786[_0x85ef('0x1e')]+_0x4c3786[_0x85ef('0x1f')]+_0x4c3786[_0x85ef('0x20')]+_0x4c3786['countmachineretry']+_0x4c3786[_0x85ef('0x21')]<_0xc1e223['entity'][_0x85ef('0x22')])_0x4ef91b=0x1;_0x2099a1({'additional':_0x4ef91b});}else{return db[_0x85ef('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4e7534['id']},'order':[['OrderBy',_0x85ef('0x1c')]]})[_0x85ef('0xa')](function(_0x592171){var _0x2e3c27=0x0;if(_0x592171){if(_0x592171[_0x85ef('0x23')]+_0x592171[_0x85ef('0x24')]+_0x592171[_0x85ef('0x1d')]+_0x592171[_0x85ef('0x1e')]+_0x592171[_0x85ef('0x1f')]+_0x592171[_0x85ef('0x20')]+_0x592171[_0x85ef('0x25')]+_0x592171[_0x85ef('0x21')]<_0xc1e223['entity']['dialGlobalMaxRetry'])_0x2e3c27=0x1;_0x2099a1({'additional':_0x2e3c27});}else{_0x2099a1({'additional':0x0});}})[_0x85ef('0x26')](function(_0x4c2519){logger[_0x85ef('0x10')](_0x85ef('0x27'),_0x4c2519[_0x85ef('0x11')]);_0x1893f4(_0x538098[_0x85ef('0x10')](0x1f4,_0x4c2519['message']));});}})[_0x85ef('0x26')](function(_0x244b96){logger[_0x85ef('0x10')](_0x85ef('0x27'),_0x244b96[_0x85ef('0x11')]);_0x1893f4(_0x538098[_0x85ef('0x10')](0x1f4,_0x244b96[_0x85ef('0x11')]));});}else _0x2099a1({'additional':0x0});});});};exports[_0x85ef('0x28')]=function(_0x2c356f){var _0x2a2fe7=this;return new Promise(function(_0x43d72d,_0x385fe1){return db[_0x85ef('0x13')][_0x85ef('0x14')]({'raw':!![],'where':{'ContactId':_0x2c356f[_0x85ef('0x15')][_0x85ef('0x16')],'ListId':_0x2c356f[_0x85ef('0x15')]['ListId'],'VoiceQueueId':_0x2c356f[_0x85ef('0x15')]['VoiceQueueId']===undefined?null:_0x2c356f[_0x85ef('0x15')][_0x85ef('0x18')],'CampaignId':_0x2c356f[_0x85ef('0x15')][_0x85ef('0x19')]===undefined?null:_0x2c356f[_0x85ef('0x15')]['CampaignId']}})[_0x85ef('0xa')](function(_0x5a1384){if(_0x5a1384!=null){return db[_0x85ef('0x1a')][_0x85ef('0x14')]({'raw':!![],'where':{'CmHopperId':_0x5a1384['id'],'OrderBy':{'$gte':_0x5a1384['OrderBy']}},'order':[[_0x85ef('0x1b'),'ASC']]})[_0x85ef('0xa')](function(_0x5ce1e1){if(_0x5ce1e1)return activateAdditionalPhone(_0x5a1384,_0x2c356f[_0x85ef('0x15')],_0x5ce1e1,_0x2c356f[_0x85ef('0x29')],_0x2c356f[_0x85ef('0x2a')])[_0x85ef('0xa')](function(_0x3598aa){_0x43d72d(_0x3598aa);});else{return db[_0x85ef('0x1a')][_0x85ef('0x14')]({'raw':!![],'where':{'CmHopperId':_0x5a1384['id']},'order':[[_0x85ef('0x1b'),_0x85ef('0x1c')]]})[_0x85ef('0xa')](function(_0x54f190){if(_0x54f190)return activateAdditionalPhone(_0x5a1384,_0x2c356f[_0x85ef('0x15')],_0x54f190,_0x2c356f[_0x85ef('0x29')],_0x2c356f[_0x85ef('0x2a')])['then'](function(_0x16901c){_0x43d72d(_0x16901c);});else{_0x43d72d({'id':_0x5a1384['id'],'phone':''});}})[_0x85ef('0x26')](function(_0x31f942){logger[_0x85ef('0x10')](_0x85ef('0x27'),_0x31f942[_0x85ef('0x11')]);_0x385fe1(_0x2a2fe7[_0x85ef('0x10')](0x1f4,_0x31f942[_0x85ef('0x11')]));});}})[_0x85ef('0x26')](function(_0x46cd44){logger[_0x85ef('0x10')](_0x85ef('0x27'),_0x46cd44[_0x85ef('0x11')]);_0x385fe1(_0x2a2fe7[_0x85ef('0x10')](0x1f4,_0x46cd44[_0x85ef('0x11')]));});}else _0x43d72d(0x1);});});};function activateAdditionalPhone(_0x257ad2,_0x1ab795,_0xb3b6f6,_0x1f7e22,_0xc97b5b){return new Promise(function(_0x558018,_0x2256ff){var _0x28cafc;if(_[_0x85ef('0x2b')](_0xb3b6f6[_0x85ef('0x2c')])){_0xb3b6f6[_0x85ef('0x2c')]=moment();}if(moment()>moment(_0xb3b6f6[_0x85ef('0x2c')])){_0x28cafc=moment()[_0x85ef('0x2d')](_0xc97b5b||0x3,_0x85ef('0x2e'));}else{if(_0xb3b6f6[_0x85ef('0x1b')]==0x0){_0x28cafc=moment(_0xb3b6f6[_0x85ef('0x2c')]);}else{_0x28cafc=moment()['add'](_0xc97b5b||0x3,_0x85ef('0x2e'));}}if(_[_0x85ef('0x2b')](_0x28cafc)){_0x28cafc=moment()[_0x85ef('0x2d')](_0xc97b5b||0x3,_0x85ef('0x2e'));}var _0x11a835={'phone':_0x257ad2[_0x85ef('0x2f')],'active':0x0,'OrderBy':_[_0x85ef('0x2b')](_0x257ad2['OrderBy'])?0x0:_0x257ad2[_0x85ef('0x1b')],'scheduledat':moment()['add'](_0x1f7e22||0x1,_0x85ef('0x2e')),'countbusyretry':_0x1ab795[_0x85ef('0x23')],'countcongestionretry':_0x1ab795[_0x85ef('0x24')],'countnoanswerretry':_0x1ab795[_0x85ef('0x1d')],'countnosuchnumberretry':_0x1ab795[_0x85ef('0x1e')],'countdropretry':_0x1ab795[_0x85ef('0x1f')],'countabandonedretry':_0x1ab795[_0x85ef('0x20')],'countmachineretry':_0x1ab795['countmachineretry'],'countagentrejectretry':_0x1ab795[_0x85ef('0x21')],'createdAt':_0x1ab795[_0x85ef('0x30')],'updatedAt':_0x1ab795[_0x85ef('0x31')]};var _0x189b17={'CmHopperId':_0x257ad2['id'],'phone':_0xb3b6f6[_0x85ef('0x2f')],'active':0x0,'OrderBy':_[_0x85ef('0x2b')](_0xb3b6f6['OrderBy'])?0x0:_0xb3b6f6['OrderBy'],'scheduledat':_0x28cafc,'countbusyretry':_0xb3b6f6[_0x85ef('0x23')],'countcongestionretry':_0xb3b6f6[_0x85ef('0x24')],'countnoanswerretry':_0xb3b6f6[_0x85ef('0x1d')],'countnosuchnumberretry':_0xb3b6f6[_0x85ef('0x1e')],'countdropretry':_0xb3b6f6[_0x85ef('0x1f')],'countabandonedretry':_0xb3b6f6[_0x85ef('0x20')],'countmachineretry':_0xb3b6f6[_0x85ef('0x25')],'countagentrejectretry':_0xb3b6f6[_0x85ef('0x21')],'createdAt':_0xb3b6f6[_0x85ef('0x30')],'updatedAt':_0xb3b6f6[_0x85ef('0x31')]};return db[_0x85ef('0x32')][_0x85ef('0x33')](function(_0x527f0f){return db[_0x85ef('0x1a')][_0x85ef('0x34')](_0x11a835,{'where':{'id':_0xb3b6f6['id']}},{'transaction':_0x527f0f})[_0x85ef('0xa')](function(){return db['CmHopper'][_0x85ef('0x34')](_0x189b17,{'where':{'id':_0x257ad2['id']}},{'transaction':_0x527f0f});});})['then'](function(_0x551063){_0x558018({'id':_0x257ad2['id'],'phone':_0xb3b6f6['phone']});})[_0x85ef('0x26')](function(_0x2fd056){logger[_0x85ef('0x10')](_0x85ef('0x35'),_0x2fd056[_0x85ef('0x11')]);_0x2256ff({'error':_0x2fd056['message']});});});}exports['IncrementPreviewCounters']=function(_0x43cb03){var _0x494900=this;return new Promise(function(_0x5efb82,_0x589dd7){return db['CmHopper'][_0x85ef('0x34')](_0x43cb03[_0x85ef('0x15')][_0x85ef('0x36')],{'where':{'id':_0x43cb03[_0x85ef('0x15')]['id']}})['then'](function(_0x232fd7){_0x5efb82(_0x232fd7);})[_0x85ef('0x26')](function(_0x1b4192){logger[_0x85ef('0x10')](_0x85ef('0x37'),_0x1b4192[_0x85ef('0x11')]);_0x589dd7(_0x494900[_0x85ef('0x10')](0x1f4,_0x1b4192[_0x85ef('0x11')]));});});}; \ No newline at end of file +var _0x6cc0=['SwapAdditionalPhones','ListId','VoiceQueueId','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','countcongestionretry','countdropretry'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0x6cc0,0x1b5));var _0x06cc=function(_0x2877e6,_0x501acf){_0x2877e6=_0x2877e6-0x0;var _0x59b78b=_0x6cc0[_0x2877e6];return _0x59b78b;};'use strict';var _=require(_0x06cc('0x0'));var util=require(_0x06cc('0x1'));var moment=require(_0x06cc('0x2'));var BPromise=require(_0x06cc('0x3'));var rs=require(_0x06cc('0x4'));var fs=require('fs');var Redis=require(_0x06cc('0x5'));var db=require(_0x06cc('0x6'))['db'];var utils=require(_0x06cc('0x7'));var logger=require('../../config/logger')(_0x06cc('0x8'));var config=require(_0x06cc('0x9'));var jayson=require(_0x06cc('0xa'));var client=jayson[_0x06cc('0xb')][_0x06cc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x323396,_0x215658,_0x32ea15){return new BPromise(function(_0x14a1e6,_0x2d591d){return client['request'](_0x323396,_0x32ea15)[_0x06cc('0xd')](function(_0x554e4f){logger[_0x06cc('0xe')](_0x06cc('0xf'),_0x215658,'request\x20sent');logger[_0x06cc('0x10')](_0x06cc('0x11'),_0x215658,_0x06cc('0x12'),JSON[_0x06cc('0x13')](_0x554e4f));if(_0x554e4f['error']){if(_0x554e4f[_0x06cc('0x14')][_0x06cc('0x15')]===0x1f4){logger[_0x06cc('0x14')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x215658,_0x554e4f['error'][_0x06cc('0x16')]);return _0x2d591d(_0x554e4f[_0x06cc('0x14')][_0x06cc('0x16')]);}logger[_0x06cc('0x14')](_0x06cc('0xf'),_0x215658,_0x554e4f['error'][_0x06cc('0x16')]);return _0x14a1e6(_0x554e4f[_0x06cc('0x14')][_0x06cc('0x16')]);}else{logger['info'](_0x06cc('0xf'),_0x215658,_0x06cc('0x12'));_0x14a1e6(_0x554e4f['result']['message']);}})[_0x06cc('0x17')](function(_0x51658d){logger['error'](_0x06cc('0xf'),_0x215658,_0x51658d);_0x2d591d(_0x51658d);});});}exports[_0x06cc('0x18')]=function(_0x3696cb){var _0x1e8218=this;return new Promise(function(_0xd70ed1,_0x2c0f90){return db[_0x06cc('0x19')][_0x06cc('0x1a')]({'raw':!![],'where':{'ContactId':_0x3696cb['body'][_0x06cc('0x1b')],'ListId':_0x3696cb[_0x06cc('0x1c')]['ListId'],'VoiceQueueId':_0x3696cb[_0x06cc('0x1c')]['VoiceQueueId']===undefined?null:_0x3696cb['body']['VoiceQueueId'],'CampaignId':_0x3696cb['body'][_0x06cc('0x1d')]===undefined?null:_0x3696cb[_0x06cc('0x1c')][_0x06cc('0x1d')]}})[_0x06cc('0xd')](function(_0x4574f3){if(_0x4574f3!=null){return db[_0x06cc('0x1e')][_0x06cc('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x4574f3['id'],'OrderBy':{'$gt':_0x4574f3['OrderBy']}},'order':[[_0x06cc('0x1f'),'ASC']]})[_0x06cc('0xd')](function(_0x5d6fef){var _0x538a84=0x0;if(_0x5d6fef){if(_0x5d6fef[_0x06cc('0x20')]+_0x5d6fef['countcongestionretry']+_0x5d6fef[_0x06cc('0x21')]+_0x5d6fef[_0x06cc('0x22')]+_0x5d6fef['countdropretry']+_0x5d6fef[_0x06cc('0x23')]+_0x5d6fef[_0x06cc('0x24')]+_0x5d6fef[_0x06cc('0x25')]<_0x3696cb[_0x06cc('0x26')][_0x06cc('0x27')])_0x538a84=0x1;_0xd70ed1({'additional':_0x538a84});}else{return db['CmHopperAdditionalPhone'][_0x06cc('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x4574f3['id']},'order':[[_0x06cc('0x1f'),_0x06cc('0x28')]]})[_0x06cc('0xd')](function(_0x421704){var _0x58848f=0x0;if(_0x421704){if(_0x421704[_0x06cc('0x20')]+_0x421704[_0x06cc('0x29')]+_0x421704[_0x06cc('0x21')]+_0x421704[_0x06cc('0x22')]+_0x421704[_0x06cc('0x2a')]+_0x421704[_0x06cc('0x23')]+_0x421704[_0x06cc('0x24')]+_0x421704[_0x06cc('0x25')]<_0x3696cb[_0x06cc('0x26')][_0x06cc('0x27')])_0x58848f=0x1;_0xd70ed1({'additional':_0x58848f});}else{_0xd70ed1({'additional':0x0});}})['catch'](function(_0x687226){logger[_0x06cc('0x14')](_0x06cc('0x18'),_0x687226[_0x06cc('0x16')]);_0x2c0f90(_0x1e8218[_0x06cc('0x14')](0x1f4,_0x687226[_0x06cc('0x16')]));});}})[_0x06cc('0x17')](function(_0x524e2f){logger[_0x06cc('0x14')]('VerifyAdditionalPhones',_0x524e2f[_0x06cc('0x16')]);_0x2c0f90(_0x1e8218[_0x06cc('0x14')](0x1f4,_0x524e2f[_0x06cc('0x16')]));});}else _0xd70ed1({'additional':0x0});});});};exports[_0x06cc('0x2b')]=function(_0x2f1176){var _0x11f8be=this;return new Promise(function(_0x2b549a,_0x10187a){return db[_0x06cc('0x19')][_0x06cc('0x1a')]({'raw':!![],'where':{'ContactId':_0x2f1176['body'][_0x06cc('0x1b')],'ListId':_0x2f1176[_0x06cc('0x1c')][_0x06cc('0x2c')],'VoiceQueueId':_0x2f1176['body'][_0x06cc('0x2d')]===undefined?null:_0x2f1176[_0x06cc('0x1c')][_0x06cc('0x2d')],'CampaignId':_0x2f1176[_0x06cc('0x1c')][_0x06cc('0x1d')]===undefined?null:_0x2f1176['body'][_0x06cc('0x1d')]}})[_0x06cc('0xd')](function(_0x420904){if(_0x420904!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x420904['id'],'OrderBy':{'$gte':_0x420904[_0x06cc('0x1f')]}},'order':[[_0x06cc('0x1f'),_0x06cc('0x28')]]})[_0x06cc('0xd')](function(_0x111310){if(_0x111310)return activateAdditionalPhone(_0x420904,_0x2f1176['body'],_0x111310,_0x2f1176[_0x06cc('0x2e')],_0x2f1176[_0x06cc('0x2f')])[_0x06cc('0xd')](function(_0xdb7688){_0x2b549a(_0xdb7688);});else{return db[_0x06cc('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x420904['id']},'order':[[_0x06cc('0x1f'),_0x06cc('0x28')]]})['then'](function(_0x5b1ca2){if(_0x5b1ca2)return activateAdditionalPhone(_0x420904,_0x2f1176[_0x06cc('0x1c')],_0x5b1ca2,_0x2f1176[_0x06cc('0x2e')],_0x2f1176[_0x06cc('0x2f')])[_0x06cc('0xd')](function(_0x4418da){_0x2b549a(_0x4418da);});else{_0x2b549a({'id':_0x420904['id'],'phone':''});}})[_0x06cc('0x17')](function(_0x2b7092){logger[_0x06cc('0x14')](_0x06cc('0x18'),_0x2b7092[_0x06cc('0x16')]);_0x10187a(_0x11f8be[_0x06cc('0x14')](0x1f4,_0x2b7092['message']));});}})[_0x06cc('0x17')](function(_0x5d3058){logger[_0x06cc('0x14')](_0x06cc('0x18'),_0x5d3058['message']);_0x10187a(_0x11f8be[_0x06cc('0x14')](0x1f4,_0x5d3058[_0x06cc('0x16')]));});}else _0x2b549a(0x1);});});};function activateAdditionalPhone(_0x4a582c,_0x7b5154,_0x23969c,_0x30bcbb,_0x1bb1d5){return new Promise(function(_0x4452e0,_0x40e4f6){var _0x3b6bd6;if(_[_0x06cc('0x30')](_0x23969c[_0x06cc('0x31')])){_0x23969c[_0x06cc('0x31')]=moment();}if(moment()>moment(_0x23969c[_0x06cc('0x31')])){_0x3b6bd6=moment()[_0x06cc('0x32')](_0x1bb1d5||0x3,_0x06cc('0x33'));}else{if(_0x23969c['OrderBy']==0x0){_0x3b6bd6=moment(_0x23969c[_0x06cc('0x31')]);}else{_0x3b6bd6=moment()[_0x06cc('0x32')](_0x1bb1d5||0x3,_0x06cc('0x33'));}}if(_[_0x06cc('0x30')](_0x3b6bd6)){_0x3b6bd6=moment()[_0x06cc('0x32')](_0x1bb1d5||0x3,_0x06cc('0x33'));}var _0x290935={'phone':_0x4a582c[_0x06cc('0x34')],'active':0x0,'OrderBy':_[_0x06cc('0x30')](_0x4a582c[_0x06cc('0x1f')])?0x0:_0x4a582c[_0x06cc('0x1f')],'scheduledat':moment()[_0x06cc('0x32')](_0x30bcbb||0x1,'minutes'),'countbusyretry':_0x7b5154[_0x06cc('0x20')],'countcongestionretry':_0x7b5154[_0x06cc('0x29')],'countnoanswerretry':_0x7b5154[_0x06cc('0x21')],'countnosuchnumberretry':_0x7b5154[_0x06cc('0x22')],'countdropretry':_0x7b5154[_0x06cc('0x2a')],'countabandonedretry':_0x7b5154['countabandonedretry'],'countmachineretry':_0x7b5154[_0x06cc('0x24')],'countagentrejectretry':_0x7b5154[_0x06cc('0x25')],'createdAt':_0x7b5154[_0x06cc('0x35')],'updatedAt':_0x7b5154[_0x06cc('0x36')]};var _0x2868c1={'CmHopperId':_0x4a582c['id'],'phone':_0x23969c[_0x06cc('0x34')],'active':0x0,'OrderBy':_['isNil'](_0x23969c[_0x06cc('0x1f')])?0x0:_0x23969c[_0x06cc('0x1f')],'scheduledat':_0x3b6bd6,'countbusyretry':_0x23969c[_0x06cc('0x20')],'countcongestionretry':_0x23969c[_0x06cc('0x29')],'countnoanswerretry':_0x23969c[_0x06cc('0x21')],'countnosuchnumberretry':_0x23969c[_0x06cc('0x22')],'countdropretry':_0x23969c['countdropretry'],'countabandonedretry':_0x23969c[_0x06cc('0x23')],'countmachineretry':_0x23969c['countmachineretry'],'countagentrejectretry':_0x23969c[_0x06cc('0x25')],'createdAt':_0x23969c[_0x06cc('0x35')],'updatedAt':_0x23969c[_0x06cc('0x36')]};return db[_0x06cc('0x37')][_0x06cc('0x38')](function(_0x2ead9f){return db[_0x06cc('0x1e')]['update'](_0x290935,{'where':{'id':_0x23969c['id']}},{'transaction':_0x2ead9f})['then'](function(){return db[_0x06cc('0x19')][_0x06cc('0x39')](_0x2868c1,{'where':{'id':_0x4a582c['id']}},{'transaction':_0x2ead9f});});})[_0x06cc('0xd')](function(_0x59df60){_0x4452e0({'id':_0x4a582c['id'],'phone':_0x23969c[_0x06cc('0x34')]});})[_0x06cc('0x17')](function(_0x61a825){logger[_0x06cc('0x14')](_0x06cc('0x3a'),_0x61a825['message']);_0x40e4f6({'error':_0x61a825[_0x06cc('0x16')]});});});}exports[_0x06cc('0x3b')]=function(_0x35b20f){var _0x45a9df=this;return new Promise(function(_0x2cca98,_0x10046c){return db['CmHopper'][_0x06cc('0x39')](_0x35b20f[_0x06cc('0x1c')]['field'],{'where':{'id':_0x35b20f[_0x06cc('0x1c')]['id']}})[_0x06cc('0xd')](function(_0x13fbe1){_0x2cca98(_0x13fbe1);})[_0x06cc('0x17')](function(_0x3b667d){logger['error']('IncrementPreviewCounters',_0x3b667d[_0x06cc('0x16')]);_0x10046c(_0x45a9df[_0x06cc('0x14')](0x1f4,_0x3b667d[_0x06cc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 1ed3f6d..991ab08 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 _0xf1c4=['delete','destroy','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','/:id','isAuthenticated','create','put','update'];(function(_0x16dbcd,_0x274516){var _0x34706e=function(_0x43433d){while(--_0x43433d){_0x16dbcd['push'](_0x16dbcd['shift']());}};_0x34706e(++_0x274516);}(_0xf1c4,0x15b));var _0x4f1c=function(_0x2d32b8,_0x3ca6ea){_0x2d32b8=_0x2d32b8-0x0;var _0xc72e3d=_0xf1c4[_0x2d32b8];return _0xc72e3d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4f1c('0x0'));var timeout=require(_0x4f1c('0x1'));var express=require(_0x4f1c('0x2'));var router=express['Router']();var fs_extra=require(_0x4f1c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4f1c('0x4'));var config=require(_0x4f1c('0x5'));var controller=require(_0x4f1c('0x6'));router[_0x4f1c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4f1c('0x7')](_0x4f1c('0x8'),auth[_0x4f1c('0x9')](),controller['show']);router['post']('/',auth[_0x4f1c('0x9')](),controller[_0x4f1c('0xa')]);router[_0x4f1c('0xb')](_0x4f1c('0x8'),auth[_0x4f1c('0x9')](),controller[_0x4f1c('0xc')]);router[_0x4f1c('0xd')](_0x4f1c('0x8'),auth[_0x4f1c('0x9')](),controller[_0x4f1c('0xe')]);module['exports']=router; \ No newline at end of file +var _0x0c53=['isAuthenticated','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id','show'];(function(_0x2645ab,_0x3ad9ee){var _0xe94f48=function(_0x5cffed){while(--_0x5cffed){_0x2645ab['push'](_0x2645ab['shift']());}};_0xe94f48(++_0x3ad9ee);}(_0x0c53,0x1e1));var _0x30c5=function(_0x5aa847,_0x44dfa9){_0x5aa847=_0x5aa847-0x0;var _0x2fd701=_0x0c53[_0x5aa847];return _0x2fd701;};'use strict';var multer=require(_0x30c5('0x0'));var util=require(_0x30c5('0x1'));var path=require('path');var timeout=require(_0x30c5('0x2'));var express=require(_0x30c5('0x3'));var router=express[_0x30c5('0x4')]();var fs_extra=require(_0x30c5('0x5'));var auth=require(_0x30c5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x30c5('0x7'));var controller=require(_0x30c5('0x8'));router[_0x30c5('0x9')]('/',auth['isAuthenticated'](),controller[_0x30c5('0xa')]);router[_0x30c5('0x9')](_0x30c5('0xb'),auth['isAuthenticated'](),controller[_0x30c5('0xc')]);router['post']('/',auth[_0x30c5('0xd')](),controller[_0x30c5('0xe')]);router['put']('/:id',auth[_0x30c5('0xd')](),controller[_0x30c5('0xf')]);router[_0x30c5('0x10')]('/:id',auth[_0x30c5('0xd')](),controller[_0x30c5('0x11')]);module[_0x30c5('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 1333a22..fc926c0 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 _0x29e8=['contactListQueue','INTEGER','moment','sequelize','exports','STRING'];(function(_0x14242b,_0x52f4b4){var _0x2d57c9=function(_0x5e7ed5){while(--_0x5e7ed5){_0x14242b['push'](_0x14242b['shift']());}};_0x2d57c9(++_0x52f4b4);}(_0x29e8,0x116));var _0x829e=function(_0x247ce4,_0x52bb04){_0x247ce4=_0x247ce4-0x0;var _0x2d41d7=_0x29e8[_0x247ce4];return _0x2d41d7;};'use strict';var moment=require(_0x829e('0x0'));var Sequelize=require(_0x829e('0x1'));module[_0x829e('0x2')]={'phone':{'type':Sequelize[_0x829e('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x829e('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x829e('0x4')},'VoiceQueueId':{'type':Sequelize[_0x829e('0x5')],'unique':_0x829e('0x4')}}; \ No newline at end of file +var _0xcca7=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x29b886,_0x3ec7c2){var _0x263ef9=function(_0xf28d06){while(--_0xf28d06){_0x29b886['push'](_0x29b886['shift']());}};_0x263ef9(++_0x3ec7c2);}(_0xcca7,0x1aa));var _0x7cca=function(_0x3d44e1,_0x36db1f){_0x3d44e1=_0x3d44e1-0x0;var _0x521e4c=_0xcca7[_0x3d44e1];return _0x521e4c;};'use strict';var moment=require(_0x7cca('0x0'));var Sequelize=require(_0x7cca('0x1'));module[_0x7cca('0x2')]={'phone':{'type':Sequelize[_0x7cca('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x7cca('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x7cca('0x4')],'unique':_0x7cca('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 9a0071d..1568ba0 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 _0xf9a8=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','destroy','describe','eml-format','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter'];(function(_0x5a0f53,_0x3cf8a4){var _0x262793=function(_0x7d6caa){while(--_0x7d6caa){_0x5a0f53['push'](_0x5a0f53['shift']());}};_0x262793(++_0x3cf8a4);}(_0xf9a8,0x1bd));var _0x8f9a=function(_0x304ed0,_0x2d95a8){_0x304ed0=_0x304ed0-0x0;var _0x40c322=_0xf9a8[_0x304ed0];return _0x40c322;};'use strict';var emlformat=require(_0x8f9a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8f9a('0x1'));var rp=require('request-promise');var moment=require(_0x8f9a('0x2'));var BPromise=require(_0x8f9a('0x3'));var Mustache=require('mustache');var util=require(_0x8f9a('0x4'));var path=require(_0x8f9a('0x5'));var sox=require(_0x8f9a('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f9a('0x7'));var _=require(_0x8f9a('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8f9a('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x8f9a('0xa'));var querystring=require(_0x8f9a('0xb'));var Papa=require(_0x8f9a('0xc'));var Redis=require(_0x8f9a('0xd'));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(_0x8f9a('0xe'))(_0x8f9a('0xf'));var utils=require(_0x8f9a('0x10'));var config=require(_0x8f9a('0x11'));var licenseUtil=require(_0x8f9a('0x12'));var db=require(_0x8f9a('0x13'))['db'];function respondWithStatusCode(_0xa4cd4e,_0x597187){_0x597187=_0x597187||0xcc;return function(_0x901fe8){if(_0x901fe8){return _0xa4cd4e[_0x8f9a('0x14')](_0x597187);}return _0xa4cd4e[_0x8f9a('0x15')](_0x597187)[_0x8f9a('0x16')]();};}function respondWithResult(_0x5adcb8,_0x2fd2a7){_0x2fd2a7=_0x2fd2a7||0xc8;return function(_0x4f4f21){if(_0x4f4f21){return _0x5adcb8[_0x8f9a('0x15')](_0x2fd2a7)[_0x8f9a('0x17')](_0x4f4f21);}};}function respondWithFilteredResult(_0x113591,_0x46e83f){return function(_0x21f037){if(_0x21f037){var _0x1b3fa9=typeof _0x46e83f['offset']===_0x8f9a('0x18')&&typeof _0x46e83f[_0x8f9a('0x19')]===_0x8f9a('0x18');var _0x54f26d=_0x21f037[_0x8f9a('0x1a')];var _0x8ea5f=_0x1b3fa9?0x0:_0x46e83f[_0x8f9a('0x1b')];var _0x29cdcd=_0x1b3fa9?_0x21f037['count']:_0x46e83f[_0x8f9a('0x1b')]+_0x46e83f[_0x8f9a('0x19')];var _0x573a5;if(_0x29cdcd>=_0x54f26d){_0x29cdcd=_0x54f26d;_0x573a5=0xc8;}else{_0x573a5=0xce;}_0x113591[_0x8f9a('0x15')](_0x573a5);return _0x113591[_0x8f9a('0x1c')](_0x8f9a('0x1d'),_0x8ea5f+'-'+_0x29cdcd+'/'+_0x54f26d)[_0x8f9a('0x17')](_0x21f037);}return null;};}function patchUpdates(_0x2cf0ec){return function(_0x14d18a){try{jsonpatch['apply'](_0x14d18a,_0x2cf0ec,!![]);}catch(_0xfee355){return BPromise[_0x8f9a('0x1e')](_0xfee355);}return _0x14d18a[_0x8f9a('0x1f')]();};}function saveUpdates(_0x37b31b,_0x43342e){return function(_0x2c2f12){if(_0x2c2f12){return _0x2c2f12[_0x8f9a('0x20')](_0x37b31b)[_0x8f9a('0x21')](function(_0x56fded){return _0x56fded;});}return null;};}function removeEntity(_0x595cb1,_0x4b05cd){return function(_0x14cad7){if(_0x14cad7){return _0x14cad7['destroy']()['then'](function(){_0x595cb1[_0x8f9a('0x15')](0xcc)[_0x8f9a('0x16')]();});}};}function handleEntityNotFound(_0x22ff94,_0xdfaf4b){return function(_0x323e94){if(!_0x323e94){_0x22ff94['sendStatus'](0x194);}return _0x323e94;};}function handleError(_0x1f5d45,_0x46bfb7){_0x46bfb7=_0x46bfb7||0x1f4;return function(_0x3132f3){logger[_0x8f9a('0x22')](_0x3132f3[_0x8f9a('0x23')]);if(_0x3132f3[_0x8f9a('0x24')]){delete _0x3132f3[_0x8f9a('0x24')];}_0x1f5d45['status'](_0x46bfb7)[_0x8f9a('0x25')](_0x3132f3);};}exports[_0x8f9a('0x26')]=function(_0x2693a7,_0x1c92c3){var _0x5ce2d2={},_0xde3f91={},_0x3879ca={'count':0x0,'rows':[]};var _0x13a877=_[_0x8f9a('0x27')](db[_0x8f9a('0x28')][_0x8f9a('0x29')],function(_0x4c9d04){return{'name':_0x4c9d04[_0x8f9a('0x2a')],'type':_0x4c9d04[_0x8f9a('0x2b')][_0x8f9a('0x2c')]};});_0xde3f91[_0x8f9a('0x2d')]=_[_0x8f9a('0x27')](_0x13a877,_0x8f9a('0x24'));_0xde3f91[_0x8f9a('0x2e')]=_[_0x8f9a('0x2f')](_0x2693a7[_0x8f9a('0x2e')]);_0xde3f91[_0x8f9a('0x30')]=_['intersection'](_0xde3f91[_0x8f9a('0x2d')],_0xde3f91[_0x8f9a('0x2e')]);_0x5ce2d2[_0x8f9a('0x31')]=_[_0x8f9a('0x32')](_0xde3f91['model'],qs[_0x8f9a('0x33')](_0x2693a7[_0x8f9a('0x2e')][_0x8f9a('0x33')]));_0x5ce2d2[_0x8f9a('0x31')]=_0x5ce2d2[_0x8f9a('0x31')][_0x8f9a('0x34')]?_0x5ce2d2[_0x8f9a('0x31')]:_0xde3f91[_0x8f9a('0x2d')];if(!_0x2693a7['query']['hasOwnProperty'](_0x8f9a('0x35'))){_0x5ce2d2[_0x8f9a('0x19')]=qs['limit'](_0x2693a7[_0x8f9a('0x2e')][_0x8f9a('0x19')]);_0x5ce2d2[_0x8f9a('0x1b')]=qs[_0x8f9a('0x1b')](_0x2693a7[_0x8f9a('0x2e')][_0x8f9a('0x1b')]);}_0x5ce2d2[_0x8f9a('0x36')]=qs[_0x8f9a('0x37')](_0x2693a7[_0x8f9a('0x2e')][_0x8f9a('0x37')]);_0x5ce2d2[_0x8f9a('0x38')]=qs[_0x8f9a('0x30')](_[_0x8f9a('0x39')](_0x2693a7['query'],_0xde3f91[_0x8f9a('0x30')]),_0x13a877);if(_0x2693a7[_0x8f9a('0x2e')][_0x8f9a('0x3a')]){_0x5ce2d2[_0x8f9a('0x38')]=_[_0x8f9a('0x3b')](_0x5ce2d2[_0x8f9a('0x38')],{'$or':_[_0x8f9a('0x27')](_0x13a877,function(_0x789bc3){if(_0x789bc3[_0x8f9a('0x2b')]!==_0x8f9a('0x3c')){var _0x355e23={};_0x355e23[_0x789bc3[_0x8f9a('0x24')]]={'$like':'%'+_0x2693a7['query'][_0x8f9a('0x3a')]+'%'};return _0x355e23;}})});}_0x5ce2d2=_[_0x8f9a('0x3b')]({},_0x5ce2d2,_0x2693a7[_0x8f9a('0x3d')]);var _0x3841d2={'where':_0x5ce2d2[_0x8f9a('0x38')]};return db[_0x8f9a('0x28')][_0x8f9a('0x1a')](_0x3841d2)[_0x8f9a('0x21')](function(_0x8c3855){_0x3879ca[_0x8f9a('0x1a')]=_0x8c3855;if(_0x2693a7[_0x8f9a('0x2e')][_0x8f9a('0x3e')]){_0x5ce2d2[_0x8f9a('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x8f9a('0x40')](_0x5ce2d2);})[_0x8f9a('0x21')](function(_0x30ade3){_0x3879ca[_0x8f9a('0x41')]=_0x30ade3;return _0x3879ca;})[_0x8f9a('0x21')](respondWithFilteredResult(_0x1c92c3,_0x5ce2d2))[_0x8f9a('0x42')](handleError(_0x1c92c3,null));};exports['show']=function(_0x535984,_0x55add7){var _0x8449d={'raw':!![],'where':{'id':_0x535984[_0x8f9a('0x43')]['id']}},_0xeb465c={};_0xeb465c[_0x8f9a('0x2d')]=_[_0x8f9a('0x2f')](db[_0x8f9a('0x28')][_0x8f9a('0x29')]);_0xeb465c[_0x8f9a('0x2e')]=_[_0x8f9a('0x2f')](_0x535984[_0x8f9a('0x2e')]);_0xeb465c[_0x8f9a('0x30')]=_[_0x8f9a('0x32')](_0xeb465c[_0x8f9a('0x2d')],_0xeb465c[_0x8f9a('0x2e')]);_0x8449d[_0x8f9a('0x31')]=_[_0x8f9a('0x32')](_0xeb465c['model'],qs[_0x8f9a('0x33')](_0x535984[_0x8f9a('0x2e')][_0x8f9a('0x33')]));_0x8449d[_0x8f9a('0x31')]=_0x8449d[_0x8f9a('0x31')][_0x8f9a('0x34')]?_0x8449d[_0x8f9a('0x31')]:_0xeb465c[_0x8f9a('0x2d')];if(_0x535984[_0x8f9a('0x2e')][_0x8f9a('0x3e')]){_0x8449d[_0x8f9a('0x3f')]=[{'all':!![]}];}_0x8449d=_['merge']({},_0x8449d,_0x535984['options']);return db[_0x8f9a('0x28')][_0x8f9a('0x44')](_0x8449d)[_0x8f9a('0x21')](handleEntityNotFound(_0x55add7,null))[_0x8f9a('0x21')](respondWithResult(_0x55add7,null))[_0x8f9a('0x42')](handleError(_0x55add7,null));};exports['update']=function(_0x2d86cc,_0x62f121){if(_0x2d86cc['body']['id']){delete _0x2d86cc['body']['id'];}return db[_0x8f9a('0x28')][_0x8f9a('0x44')]({'where':{'id':_0x2d86cc[_0x8f9a('0x43')]['id']}})['then'](handleEntityNotFound(_0x62f121,null))['then'](saveUpdates(_0x2d86cc[_0x8f9a('0x45')],null))[_0x8f9a('0x21')](respondWithResult(_0x62f121,null))[_0x8f9a('0x42')](handleError(_0x62f121,null));};exports[_0x8f9a('0x46')]=function(_0x17d83f,_0x2ac5cd){return db[_0x8f9a('0x28')]['find']({'where':{'id':_0x17d83f[_0x8f9a('0x43')]['id']}})[_0x8f9a('0x21')](handleEntityNotFound(_0x2ac5cd,null))[_0x8f9a('0x21')](removeEntity(_0x2ac5cd,null))[_0x8f9a('0x42')](handleError(_0x2ac5cd,null));};exports[_0x8f9a('0x47')]=function(_0x11603d,_0xe0fe5f){return db[_0x8f9a('0x28')]['describe']()[_0x8f9a('0x21')](respondWithResult(_0xe0fe5f,null))[_0x8f9a('0x42')](handleError(_0xe0fe5f,null));}; \ No newline at end of file +var _0x2a64=['update','then','end','error','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','findAll','rows','show','params','includeAll','include','options','catch','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save'];(function(_0x151ad4,_0x2b9dc7){var _0x3ec519=function(_0x18d491){while(--_0x18d491){_0x151ad4['push'](_0x151ad4['shift']());}};_0x3ec519(++_0x2b9dc7);}(_0x2a64,0xc1));var _0x42a6=function(_0x267fd5,_0x122151){_0x267fd5=_0x267fd5-0x0;var _0x183285=_0x2a64[_0x267fd5];return _0x183285;};'use strict';var emlformat=require(_0x42a6('0x0'));var rimraf=require(_0x42a6('0x1'));var zipdir=require(_0x42a6('0x2'));var jsonpatch=require(_0x42a6('0x3'));var rp=require('request-promise');var moment=require(_0x42a6('0x4'));var BPromise=require(_0x42a6('0x5'));var Mustache=require('mustache');var util=require(_0x42a6('0x6'));var path=require(_0x42a6('0x7'));var sox=require(_0x42a6('0x8'));var csv=require(_0x42a6('0x9'));var ejs=require(_0x42a6('0xa'));var fs=require('fs');var fs_extra=require(_0x42a6('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x42a6('0xc'));var jsforce=require(_0x42a6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x42a6('0x9'));var querystring=require(_0x42a6('0xe'));var Papa=require(_0x42a6('0xf'));var Redis=require(_0x42a6('0x10'));var authService=require(_0x42a6('0x11'));var qs=require(_0x42a6('0x12'));var as=require(_0x42a6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x42a6('0x14'));var config=require(_0x42a6('0x15'));var licenseUtil=require(_0x42a6('0x16'));var db=require(_0x42a6('0x17'))['db'];function respondWithStatusCode(_0x1146fc,_0x1dfb14){_0x1dfb14=_0x1dfb14||0xcc;return function(_0x41857b){if(_0x41857b){return _0x1146fc[_0x42a6('0x18')](_0x1dfb14);}return _0x1146fc['status'](_0x1dfb14)['end']();};}function respondWithResult(_0x214e83,_0x5e2bb7){_0x5e2bb7=_0x5e2bb7||0xc8;return function(_0x1605b7){if(_0x1605b7){return _0x214e83[_0x42a6('0x19')](_0x5e2bb7)[_0x42a6('0x1a')](_0x1605b7);}};}function respondWithFilteredResult(_0x137f4a,_0x3efe9c){return function(_0x5cd920){if(_0x5cd920){var _0x2779ff=typeof _0x3efe9c['offset']===_0x42a6('0x1b')&&typeof _0x3efe9c['limit']===_0x42a6('0x1b');var _0x1fcf55=_0x5cd920[_0x42a6('0x1c')];var _0x36c880=_0x2779ff?0x0:_0x3efe9c['offset'];var _0x16228c=_0x2779ff?_0x5cd920[_0x42a6('0x1c')]:_0x3efe9c[_0x42a6('0x1d')]+_0x3efe9c[_0x42a6('0x1e')];var _0x10e4a5;if(_0x16228c>=_0x1fcf55){_0x16228c=_0x1fcf55;_0x10e4a5=0xc8;}else{_0x10e4a5=0xce;}_0x137f4a[_0x42a6('0x19')](_0x10e4a5);return _0x137f4a['set'](_0x42a6('0x1f'),_0x36c880+'-'+_0x16228c+'/'+_0x1fcf55)[_0x42a6('0x1a')](_0x5cd920);}return null;};}function patchUpdates(_0x37db20){return function(_0x45e574){try{jsonpatch[_0x42a6('0x20')](_0x45e574,_0x37db20,!![]);}catch(_0x284762){return BPromise[_0x42a6('0x21')](_0x284762);}return _0x45e574[_0x42a6('0x22')]();};}function saveUpdates(_0x478063,_0x34fc4e){return function(_0x53f022){if(_0x53f022){return _0x53f022[_0x42a6('0x23')](_0x478063)[_0x42a6('0x24')](function(_0x517974){return _0x517974;});}return null;};}function removeEntity(_0x4ccc67,_0x265737){return function(_0x1bc590){if(_0x1bc590){return _0x1bc590['destroy']()[_0x42a6('0x24')](function(){_0x4ccc67[_0x42a6('0x19')](0xcc)[_0x42a6('0x25')]();});}};}function handleEntityNotFound(_0x327338,_0x184bcd){return function(_0x18d020){if(!_0x18d020){_0x327338[_0x42a6('0x18')](0x194);}return _0x18d020;};}function handleError(_0x209661,_0x216832){_0x216832=_0x216832||0x1f4;return function(_0x45e0ac){logger[_0x42a6('0x26')](_0x45e0ac[_0x42a6('0x27')]);if(_0x45e0ac['name']){delete _0x45e0ac[_0x42a6('0x28')];}_0x209661[_0x42a6('0x19')](_0x216832)['send'](_0x45e0ac);};}exports[_0x42a6('0x29')]=function(_0x5d0d2e,_0x40f8ff){var _0x387671={},_0x4c1459={},_0x984a0c={'count':0x0,'rows':[]};var _0x24f8e5=_[_0x42a6('0x2a')](db[_0x42a6('0x2b')][_0x42a6('0x2c')],function(_0xcbefc3){return{'name':_0xcbefc3[_0x42a6('0x2d')],'type':_0xcbefc3[_0x42a6('0x2e')][_0x42a6('0x2f')]};});_0x4c1459[_0x42a6('0x30')]=_['map'](_0x24f8e5,_0x42a6('0x28'));_0x4c1459['query']=_[_0x42a6('0x31')](_0x5d0d2e[_0x42a6('0x32')]);_0x4c1459[_0x42a6('0x33')]=_[_0x42a6('0x34')](_0x4c1459[_0x42a6('0x30')],_0x4c1459['query']);_0x387671[_0x42a6('0x35')]=_[_0x42a6('0x34')](_0x4c1459[_0x42a6('0x30')],qs[_0x42a6('0x36')](_0x5d0d2e[_0x42a6('0x32')][_0x42a6('0x36')]));_0x387671['attributes']=_0x387671[_0x42a6('0x35')][_0x42a6('0x37')]?_0x387671[_0x42a6('0x35')]:_0x4c1459[_0x42a6('0x30')];if(!_0x5d0d2e[_0x42a6('0x32')]['hasOwnProperty'](_0x42a6('0x38'))){_0x387671[_0x42a6('0x1e')]=qs[_0x42a6('0x1e')](_0x5d0d2e['query'][_0x42a6('0x1e')]);_0x387671['offset']=qs[_0x42a6('0x1d')](_0x5d0d2e[_0x42a6('0x32')][_0x42a6('0x1d')]);}_0x387671[_0x42a6('0x39')]=qs['sort'](_0x5d0d2e['query'][_0x42a6('0x3a')]);_0x387671[_0x42a6('0x3b')]=qs[_0x42a6('0x33')](_[_0x42a6('0x3c')](_0x5d0d2e[_0x42a6('0x32')],_0x4c1459[_0x42a6('0x33')]),_0x24f8e5);if(_0x5d0d2e['query'][_0x42a6('0x3d')]){_0x387671['where']=_['merge'](_0x387671[_0x42a6('0x3b')],{'$or':_[_0x42a6('0x2a')](_0x24f8e5,function(_0xd27216){if(_0xd27216[_0x42a6('0x2e')]!==_0x42a6('0x3e')){var _0x230af3={};_0x230af3[_0xd27216[_0x42a6('0x28')]]={'$like':'%'+_0x5d0d2e['query'][_0x42a6('0x3d')]+'%'};return _0x230af3;}})});}_0x387671=_[_0x42a6('0x3f')]({},_0x387671,_0x5d0d2e['options']);var _0x586371={'where':_0x387671[_0x42a6('0x3b')]};return db[_0x42a6('0x2b')][_0x42a6('0x1c')](_0x586371)[_0x42a6('0x24')](function(_0x52a3bd){_0x984a0c[_0x42a6('0x1c')]=_0x52a3bd;if(_0x5d0d2e[_0x42a6('0x32')]['includeAll']){_0x387671['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x42a6('0x40')](_0x387671);})[_0x42a6('0x24')](function(_0x621202){_0x984a0c[_0x42a6('0x41')]=_0x621202;return _0x984a0c;})['then'](respondWithFilteredResult(_0x40f8ff,_0x387671))['catch'](handleError(_0x40f8ff,null));};exports[_0x42a6('0x42')]=function(_0x5d2411,_0x2e4939){var _0x3cb622={'raw':!![],'where':{'id':_0x5d2411[_0x42a6('0x43')]['id']}},_0x3e7665={};_0x3e7665['model']=_[_0x42a6('0x31')](db[_0x42a6('0x2b')][_0x42a6('0x2c')]);_0x3e7665['query']=_[_0x42a6('0x31')](_0x5d2411[_0x42a6('0x32')]);_0x3e7665['filters']=_[_0x42a6('0x34')](_0x3e7665[_0x42a6('0x30')],_0x3e7665[_0x42a6('0x32')]);_0x3cb622['attributes']=_[_0x42a6('0x34')](_0x3e7665[_0x42a6('0x30')],qs['fields'](_0x5d2411['query']['fields']));_0x3cb622[_0x42a6('0x35')]=_0x3cb622[_0x42a6('0x35')][_0x42a6('0x37')]?_0x3cb622['attributes']:_0x3e7665[_0x42a6('0x30')];if(_0x5d2411[_0x42a6('0x32')][_0x42a6('0x44')]){_0x3cb622[_0x42a6('0x45')]=[{'all':!![]}];}_0x3cb622=_['merge']({},_0x3cb622,_0x5d2411[_0x42a6('0x46')]);return db[_0x42a6('0x2b')]['find'](_0x3cb622)[_0x42a6('0x24')](handleEntityNotFound(_0x2e4939,null))[_0x42a6('0x24')](respondWithResult(_0x2e4939,null))[_0x42a6('0x47')](handleError(_0x2e4939,null));};exports[_0x42a6('0x23')]=function(_0xaad286,_0x41bfa5){if(_0xaad286[_0x42a6('0x48')]['id']){delete _0xaad286[_0x42a6('0x48')]['id'];}return db[_0x42a6('0x2b')][_0x42a6('0x49')]({'where':{'id':_0xaad286['params']['id']}})[_0x42a6('0x24')](handleEntityNotFound(_0x41bfa5,null))['then'](saveUpdates(_0xaad286[_0x42a6('0x48')],null))[_0x42a6('0x24')](respondWithResult(_0x41bfa5,null))[_0x42a6('0x47')](handleError(_0x41bfa5,null));};exports[_0x42a6('0x4a')]=function(_0x9f36b,_0x591d65){return db[_0x42a6('0x2b')][_0x42a6('0x49')]({'where':{'id':_0x9f36b[_0x42a6('0x43')]['id']}})[_0x42a6('0x24')](handleEntityNotFound(_0x591d65,null))[_0x42a6('0x24')](removeEntity(_0x591d65,null))['catch'](handleError(_0x591d65,null));};exports[_0x42a6('0x4b')]=function(_0x7aae8f,_0x415fb0){return db[_0x42a6('0x2b')][_0x42a6('0x4b')]()[_0x42a6('0x24')](respondWithResult(_0x415fb0,null))[_0x42a6('0x47')](handleError(_0x415fb0,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 139a9b8..e6b5c08 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 _0x669b=['CmHopperBlack','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define'];(function(_0x1a89ae,_0x34ec9e){var _0x266c02=function(_0x6d8605){while(--_0x6d8605){_0x1a89ae['push'](_0x1a89ae['shift']());}};_0x266c02(++_0x34ec9e);}(_0x669b,0x121));var _0xb669=function(_0x348b47,_0xe62003){_0x348b47=_0x348b47-0x0;var _0x4acb0a=_0x669b[_0x348b47];return _0x4acb0a;};'use strict';var _=require('lodash');var util=require(_0xb669('0x0'));var logger=require(_0xb669('0x1'))(_0xb669('0x2'));var moment=require(_0xb669('0x3'));var BPromise=require(_0xb669('0x4'));var rp=require(_0xb669('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb669('0x6'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0xca43a,_0x4cf964){return _0xca43a[_0xb669('0x7')](_0xb669('0x8'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf67c=['api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','../../config/logger'];(function(_0x1294af,_0x3fa78a){var _0xd2ca86=function(_0x3d6b8e){while(--_0x3d6b8e){_0x1294af['push'](_0x1294af['shift']());}};_0xd2ca86(++_0x3fa78a);}(_0xf67c,0x9a));var _0xcf67=function(_0x1bd381,_0x13ec9f){_0x1bd381=_0x1bd381-0x0;var _0x354c22=_0xf67c[_0x1bd381];return _0x354c22;};'use strict';var _=require(_0xcf67('0x0'));var util=require('util');var logger=require(_0xcf67('0x1'))(_0xcf67('0x2'));var moment=require(_0xcf67('0x3'));var BPromise=require('bluebird');var rp=require(_0xcf67('0x4'));var fs=require('fs');var path=require(_0xcf67('0x5'));var rimraf=require(_0xcf67('0x6'));var config=require(_0xcf67('0x7'));var attributes=require(_0xcf67('0x8'));module[_0xcf67('0x9')]=function(_0x5da897,_0x1c2fed){return _0x5da897[_0xcf67('0xa')](_0xcf67('0xb'),attributes,{'tableName':_0xcf67('0xc'),'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 34919ca..afc3c8b 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 _0xc88d=['DestroyCmHopperBlack','destroy','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','request\x20sent','catch','CmHopperBlack','findAll','options','raw','attributes','limit','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','update','body','where'];(function(_0x5c2ba0,_0x196e25){var _0x1723eb=function(_0x6eed50){while(--_0x6eed50){_0x5c2ba0['push'](_0x5c2ba0['shift']());}};_0x1723eb(++_0x196e25);}(_0xc88d,0x13a));var _0xdc88=function(_0x4087e9,_0x55f4c1){_0x4087e9=_0x4087e9-0x0;var _0x4041d2=_0xc88d[_0x4087e9];return _0x4041d2;};'use strict';var _=require(_0xdc88('0x0'));var util=require('util');var moment=require(_0xdc88('0x1'));var BPromise=require('bluebird');var rs=require(_0xdc88('0x2'));var fs=require('fs');var Redis=require(_0xdc88('0x3'));var db=require(_0xdc88('0x4'))['db'];var utils=require(_0xdc88('0x5'));var logger=require(_0xdc88('0x6'))(_0xdc88('0x7'));var config=require(_0xdc88('0x8'));var jayson=require(_0xdc88('0x9'));var client=jayson['client'][_0xdc88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x226e50,_0x2535b7,_0x2874c8){return new BPromise(function(_0x4c2bb2,_0x5f01ac){return client[_0xdc88('0xb')](_0x226e50,_0x2874c8)[_0xdc88('0xc')](function(_0x58a5df){logger[_0xdc88('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x2535b7,'request\x20sent');logger[_0xdc88('0xe')](_0xdc88('0xf'),_0x2535b7,'request\x20sent',JSON[_0xdc88('0x10')](_0x58a5df));if(_0x58a5df[_0xdc88('0x11')]){if(_0x58a5df[_0xdc88('0x11')][_0xdc88('0x12')]===0x1f4){logger[_0xdc88('0x11')](_0xdc88('0x13'),_0x2535b7,_0x58a5df[_0xdc88('0x11')][_0xdc88('0x14')]);return _0x5f01ac(_0x58a5df[_0xdc88('0x11')][_0xdc88('0x14')]);}logger[_0xdc88('0x11')](_0xdc88('0x13'),_0x2535b7,_0x58a5df['error']['message']);return _0x4c2bb2(_0x58a5df[_0xdc88('0x11')][_0xdc88('0x14')]);}else{logger['info'](_0xdc88('0x13'),_0x2535b7,_0xdc88('0x15'));_0x4c2bb2(_0x58a5df['result'][_0xdc88('0x14')]);}})[_0xdc88('0x16')](function(_0x8b4577){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x2535b7,_0x8b4577);_0x5f01ac(_0x8b4577);});});}exports['GetCmHopperBlack']=function(_0x24901e){var _0x457a13=this;return new Promise(function(_0x30fed7,_0x14b7fe){return db[_0xdc88('0x17')][_0xdc88('0x18')]({'raw':_0x24901e['options']?_0x24901e[_0xdc88('0x19')][_0xdc88('0x1a')]===undefined?!![]:![]:!![],'where':_0x24901e[_0xdc88('0x19')]?_0x24901e[_0xdc88('0x19')]['where']||null:null,'attributes':_0x24901e[_0xdc88('0x19')]?_0x24901e[_0xdc88('0x19')][_0xdc88('0x1b')]||null:null,'limit':_0x24901e['options']?_0x24901e[_0xdc88('0x19')][_0xdc88('0x1c')]||null:null,'include':_0x24901e['options']?_0x24901e[_0xdc88('0x19')][_0xdc88('0x1d')]?_[_0xdc88('0x1e')](_0x24901e[_0xdc88('0x19')][_0xdc88('0x1d')],function(_0x3e25be){return{'model':db[_0x3e25be[_0xdc88('0x1f')]],'as':_0x3e25be['as'],'attributes':_0x3e25be[_0xdc88('0x1b')],'include':_0x3e25be[_0xdc88('0x1d')]?_[_0xdc88('0x1e')](_0x3e25be[_0xdc88('0x1d')],function(_0x5f18d8){return{'model':db[_0x5f18d8['model']],'as':_0x5f18d8['as'],'attributes':_0x5f18d8[_0xdc88('0x1b')],'include':_0x5f18d8[_0xdc88('0x1d')]?_[_0xdc88('0x1e')](_0x5f18d8['include'],function(_0x40e794){return{'model':db[_0x40e794[_0xdc88('0x1f')]],'as':_0x40e794['as'],'attributes':_0x40e794[_0xdc88('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdc88('0xc')](function(_0x4b3030){logger[_0xdc88('0xd')]('GetCmHopperBlack',_0x24901e);logger[_0xdc88('0xe')](_0xdc88('0x20'),_0x24901e,JSON[_0xdc88('0x10')](_0x4b3030));_0x30fed7(_0x4b3030);})[_0xdc88('0x16')](function(_0x260296){logger[_0xdc88('0x11')]('GetCmHopperBlack',_0x260296[_0xdc88('0x14')],_0x24901e);_0x14b7fe(_0x457a13[_0xdc88('0x11')](0x1f4,_0x260296['message']));});});};exports[_0xdc88('0x21')]=function(_0x2753ba){var _0xf36cb5=this;return new Promise(function(_0x58fb7a,_0x3d9806){return db['CmHopperBlack'][_0xdc88('0x22')](_0x2753ba[_0xdc88('0x23')],{'raw':_0x2753ba[_0xdc88('0x19')]?_0x2753ba[_0xdc88('0x19')][_0xdc88('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2753ba[_0xdc88('0x19')]?_0x2753ba[_0xdc88('0x19')][_0xdc88('0x24')]||null:null,'attributes':_0x2753ba['options']?_0x2753ba[_0xdc88('0x19')][_0xdc88('0x1b')]||null:null,'limit':_0x2753ba[_0xdc88('0x19')]?_0x2753ba[_0xdc88('0x19')][_0xdc88('0x1c')]||null:null})['then'](function(_0xb2411c){logger['info'](_0xdc88('0x21'),_0x2753ba);logger[_0xdc88('0xe')](_0xdc88('0x21'),_0x2753ba,JSON[_0xdc88('0x10')](_0xb2411c));_0x58fb7a(_0xb2411c);})[_0xdc88('0x16')](function(_0x10ae17){logger['error'](_0xdc88('0x21'),_0x10ae17[_0xdc88('0x14')],_0x2753ba);_0x3d9806(_0xf36cb5[_0xdc88('0x11')](0x1f4,_0x10ae17[_0xdc88('0x14')]));});});};exports[_0xdc88('0x25')]=function(_0x4a2bb0){var _0x1fdc49=this;return new Promise(function(_0x22faa0,_0x9bc76){return db[_0xdc88('0x17')][_0xdc88('0x26')]({'where':_0x4a2bb0['options']?_0x4a2bb0[_0xdc88('0x19')][_0xdc88('0x24')]||null:null})[_0xdc88('0xc')](function(_0x5ea047){logger[_0xdc88('0xd')](_0xdc88('0x25'),_0x4a2bb0);logger[_0xdc88('0xe')](_0xdc88('0x25'),_0x4a2bb0,JSON[_0xdc88('0x10')](_0x5ea047));_0x22faa0(_0x5ea047);})[_0xdc88('0x16')](function(_0x34e553){logger['error'](_0xdc88('0x25'),_0x34e553[_0xdc88('0x14')],_0x4a2bb0);_0x9bc76(_0x1fdc49[_0xdc88('0x11')](0x1f4,_0x34e553['message']));});});}; \ No newline at end of file +var _0x695a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','attributes','include','map','model','update','body','limit','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','where','lodash','util'];(function(_0x17caca,_0x2bc731){var _0x1d9b18=function(_0x1c7190){while(--_0x1c7190){_0x17caca['push'](_0x17caca['shift']());}};_0x1d9b18(++_0x2bc731);}(_0x695a,0x116));var _0xa695=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x695a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa695('0x0'));var util=require(_0xa695('0x1'));var moment=require(_0xa695('0x2'));var BPromise=require(_0xa695('0x3'));var rs=require(_0xa695('0x4'));var fs=require('fs');var Redis=require(_0xa695('0x5'));var db=require(_0xa695('0x6'))['db'];var utils=require(_0xa695('0x7'));var logger=require(_0xa695('0x8'))(_0xa695('0x9'));var config=require(_0xa695('0xa'));var jayson=require(_0xa695('0xb'));var client=jayson[_0xa695('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20f291,_0x391bd4,_0x1e789c){return new BPromise(function(_0x5ecf59,_0x2a61f1){return client['request'](_0x20f291,_0x1e789c)[_0xa695('0xd')](function(_0x3a56cf){logger[_0xa695('0xe')](_0xa695('0xf'),_0x391bd4,_0xa695('0x10'));logger[_0xa695('0x11')](_0xa695('0x12'),_0x391bd4,_0xa695('0x10'),JSON[_0xa695('0x13')](_0x3a56cf));if(_0x3a56cf[_0xa695('0x14')]){if(_0x3a56cf[_0xa695('0x14')]['code']===0x1f4){logger[_0xa695('0x14')](_0xa695('0xf'),_0x391bd4,_0x3a56cf[_0xa695('0x14')][_0xa695('0x15')]);return _0x2a61f1(_0x3a56cf[_0xa695('0x14')]['message']);}logger['error'](_0xa695('0xf'),_0x391bd4,_0x3a56cf[_0xa695('0x14')]['message']);return _0x5ecf59(_0x3a56cf[_0xa695('0x14')]['message']);}else{logger[_0xa695('0xe')](_0xa695('0xf'),_0x391bd4,_0xa695('0x10'));_0x5ecf59(_0x3a56cf[_0xa695('0x16')][_0xa695('0x15')]);}})[_0xa695('0x17')](function(_0x10b1fc){logger[_0xa695('0x14')](_0xa695('0xf'),_0x391bd4,_0x10b1fc);_0x2a61f1(_0x10b1fc);});});}exports[_0xa695('0x18')]=function(_0x581694){var _0x1d3e38=this;return new Promise(function(_0x4bba6c,_0x22bfde){return db[_0xa695('0x19')][_0xa695('0x1a')]({'raw':_0x581694['options']?_0x581694[_0xa695('0x1b')][_0xa695('0x1c')]===undefined?!![]:![]:!![],'where':_0x581694['options']?_0x581694[_0xa695('0x1b')]['where']||null:null,'attributes':_0x581694[_0xa695('0x1b')]?_0x581694[_0xa695('0x1b')][_0xa695('0x1d')]||null:null,'limit':_0x581694[_0xa695('0x1b')]?_0x581694[_0xa695('0x1b')]['limit']||null:null,'include':_0x581694[_0xa695('0x1b')]?_0x581694[_0xa695('0x1b')][_0xa695('0x1e')]?_[_0xa695('0x1f')](_0x581694['options']['include'],function(_0x28de17){return{'model':db[_0x28de17[_0xa695('0x20')]],'as':_0x28de17['as'],'attributes':_0x28de17[_0xa695('0x1d')],'include':_0x28de17[_0xa695('0x1e')]?_[_0xa695('0x1f')](_0x28de17[_0xa695('0x1e')],function(_0x56610e){return{'model':db[_0x56610e['model']],'as':_0x56610e['as'],'attributes':_0x56610e[_0xa695('0x1d')],'include':_0x56610e['include']?_['map'](_0x56610e[_0xa695('0x1e')],function(_0x12443a){return{'model':db[_0x12443a[_0xa695('0x20')]],'as':_0x12443a['as'],'attributes':_0x12443a[_0xa695('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa695('0xd')](function(_0x86ad2e){logger[_0xa695('0xe')](_0xa695('0x18'),_0x581694);logger[_0xa695('0x11')]('GetCmHopperBlack',_0x581694,JSON[_0xa695('0x13')](_0x86ad2e));_0x4bba6c(_0x86ad2e);})[_0xa695('0x17')](function(_0x540f35){logger[_0xa695('0x14')](_0xa695('0x18'),_0x540f35[_0xa695('0x15')],_0x581694);_0x22bfde(_0x1d3e38['error'](0x1f4,_0x540f35[_0xa695('0x15')]));});});};exports['UpdateCmHopperBlack']=function(_0x4cfa7c){var _0x4a624b=this;return new Promise(function(_0x33eb2a,_0x272f5a){return db[_0xa695('0x19')][_0xa695('0x21')](_0x4cfa7c[_0xa695('0x22')],{'raw':_0x4cfa7c['options']?_0x4cfa7c[_0xa695('0x1b')][_0xa695('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cfa7c['options']?_0x4cfa7c[_0xa695('0x1b')]['where']||null:null,'attributes':_0x4cfa7c[_0xa695('0x1b')]?_0x4cfa7c[_0xa695('0x1b')][_0xa695('0x1d')]||null:null,'limit':_0x4cfa7c[_0xa695('0x1b')]?_0x4cfa7c[_0xa695('0x1b')][_0xa695('0x23')]||null:null})[_0xa695('0xd')](function(_0xd1f1bf){logger[_0xa695('0xe')]('UpdateCmHopperBlack',_0x4cfa7c);logger['debug'](_0xa695('0x24'),_0x4cfa7c,JSON[_0xa695('0x13')](_0xd1f1bf));_0x33eb2a(_0xd1f1bf);})[_0xa695('0x17')](function(_0x5d2480){logger[_0xa695('0x14')](_0xa695('0x24'),_0x5d2480[_0xa695('0x15')],_0x4cfa7c);_0x272f5a(_0x4a624b[_0xa695('0x14')](0x1f4,_0x5d2480[_0xa695('0x15')]));});});};exports[_0xa695('0x25')]=function(_0x3fd02a){var _0x2a9ac8=this;return new Promise(function(_0x34a866,_0x2a018d){return db[_0xa695('0x19')][_0xa695('0x26')]({'where':_0x3fd02a[_0xa695('0x1b')]?_0x3fd02a['options'][_0xa695('0x27')]||null:null})[_0xa695('0xd')](function(_0x541a9b){logger['info'](_0xa695('0x25'),_0x3fd02a);logger[_0xa695('0x11')](_0xa695('0x25'),_0x3fd02a,JSON[_0xa695('0x13')](_0x541a9b));_0x34a866(_0x541a9b);})[_0xa695('0x17')](function(_0x460398){logger['error']('DestroyCmHopperBlack',_0x460398[_0xa695('0x15')],_0x3fd02a);_0x2a018d(_0x2a9ac8[_0xa695('0x14')](0x1f4,_0x460398[_0xa695('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 7a335ac..63ab5f4 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 _0x2d72=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','/:id','show','update','delete','multer','util','path'];(function(_0x422059,_0x55d477){var _0x3669d9=function(_0x1d1a61){while(--_0x1d1a61){_0x422059['push'](_0x422059['shift']());}};_0x3669d9(++_0x55d477);}(_0x2d72,0xa8));var _0x22d7=function(_0x5a40fa,_0x566bbe){_0x5a40fa=_0x5a40fa-0x0;var _0x27b611=_0x2d72[_0x5a40fa];return _0x27b611;};'use strict';var multer=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var path=require(_0x22d7('0x2'));var timeout=require(_0x22d7('0x3'));var express=require(_0x22d7('0x4'));var router=express[_0x22d7('0x5')]();var fs_extra=require(_0x22d7('0x6'));var auth=require(_0x22d7('0x7'));var interaction=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var controller=require(_0x22d7('0xa'));router[_0x22d7('0xb')]('/',auth[_0x22d7('0xc')](),controller[_0x22d7('0xd')]);router['get'](_0x22d7('0xe'),auth[_0x22d7('0xc')](),controller['describe']);router[_0x22d7('0xb')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x10')]);router['put']('/:id',auth[_0x22d7('0xc')](),controller[_0x22d7('0x11')]);router[_0x22d7('0x12')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5d17=['index','/describe','isAuthenticated','describe','/:id','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x38622b,_0x3cfdf7){var _0x2c1a7a=function(_0x5de9cc){while(--_0x5de9cc){_0x38622b['push'](_0x38622b['shift']());}};_0x2c1a7a(++_0x3cfdf7);}(_0x5d17,0x114));var _0x75d1=function(_0x457d51,_0x259c93){_0x457d51=_0x457d51-0x0;var _0x266b92=_0x5d17[_0x457d51];return _0x266b92;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var fs_extra=require(_0x75d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var controller=require(_0x75d1('0x7'));router[_0x75d1('0x8')]('/',auth['isAuthenticated'](),controller[_0x75d1('0x9')]);router[_0x75d1('0x8')](_0x75d1('0xa'),auth[_0x75d1('0xb')](),controller[_0x75d1('0xc')]);router[_0x75d1('0x8')](_0x75d1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x75d1('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x75d1('0xf')]);router[_0x75d1('0x10')]('/:id',auth[_0x75d1('0xb')](),controller[_0x75d1('0x11')]);module[_0x75d1('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index f1755ad..794f467 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 _0x975e=['endtime','setDataValue','followuptime','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue'];(function(_0x5012e0,_0x47a186){var _0x72706d=function(_0x13d02e){while(--_0x13d02e){_0x5012e0['push'](_0x5012e0['shift']());}};_0x72706d(++_0x47a186);}(_0x975e,0x7d));var _0xe975=function(_0x1f625b,_0x276b0e){_0x1f625b=_0x1f625b-0x0;var _0x748222=_0x975e[_0x1f625b];return _0x748222;};'use strict';var Sequelize=require(_0xe975('0x0'));var moment=require(_0xe975('0x1'));module[_0xe975('0x2')]={'state':{'type':Sequelize[_0xe975('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xe975('0x4')]},'scheduledat':{'type':Sequelize[_0xe975('0x5')]},'countbusyretry':{'type':Sequelize[_0xe975('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe975('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe975('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe975('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xe975('0x4')]},'originatecalleridname':{'type':Sequelize[_0xe975('0x4')]},'calleridnum':{'type':Sequelize[_0xe975('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe975('0x5')]},'responsetime':{'type':Sequelize[_0xe975('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xe975('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe975('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe975('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe975('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe975('0x4')]},'campaign':{'type':Sequelize[_0xe975('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xe975('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x2b8c71){var _0x26a5de=this[_0xe975('0x6')](_0xe975('0x7'));if(_0x26a5de&&_0x2b8c71){this[_0xe975('0x8')](_0xe975('0x9'),moment(_0x2b8c71)['diff'](moment(_0x26a5de),'seconds'));}}},'amd':{'type':Sequelize[_0xe975('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe975('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe975('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe975('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xe975('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe975('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe975('0x5')]},'deleted':{'type':Sequelize[_0xe975('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xe975('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe975('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xe975('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe975('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe975('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe975('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x31b4=['setDataValue','followuptime','seconds','BOOLEAN','sequelize','moment','STRING','INTEGER','DATE','getDataValue','endtime'];(function(_0x5ab48d,_0x5c539a){var _0x12a0ea=function(_0x3df378){while(--_0x3df378){_0x5ab48d['push'](_0x5ab48d['shift']());}};_0x12a0ea(++_0x5c539a);}(_0x31b4,0x10c));var _0x431b=function(_0x27ae24,_0x59ca59){_0x27ae24=_0x27ae24-0x0;var _0x5e86ce=_0x31b4[_0x27ae24];return _0x5e86ce;};'use strict';var Sequelize=require(_0x431b('0x0'));var moment=require(_0x431b('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x431b('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x431b('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x431b('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x431b('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x431b('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x431b('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x431b('0x2')]},'originatecalleridname':{'type':Sequelize[_0x431b('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x431b('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x431b('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x431b('0x4')]},'endtime':{'type':Sequelize[_0x431b('0x4')]},'ringtime':{'type':Sequelize[_0x431b('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x431b('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x431b('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x431b('0x2')]},'campaign':{'type':Sequelize[_0x431b('0x2')]},'campaigntype':{'type':Sequelize[_0x431b('0x2')]},'membername':{'type':Sequelize[_0x431b('0x2')]},'reason':{'type':Sequelize[_0x431b('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x431b('0x2')]},'thirdDisposition':{'type':Sequelize[_0x431b('0x2')]},'dispositionat':{'type':Sequelize[_0x431b('0x4')],'set':function(_0x35871){var _0x5dd7a6=this[_0x431b('0x5')](_0x431b('0x6'));if(_0x5dd7a6&&_0x35871){this[_0x431b('0x7')](_0x431b('0x8'),moment(_0x35871)['diff'](moment(_0x5dd7a6),_0x431b('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x431b('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x431b('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x431b('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x431b('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x431b('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x431b('0x4')]},'deleted':{'type':Sequelize[_0x431b('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x431b('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x431b('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x431b('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x431b('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x431b('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x431b('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 878b3bd..f9e0c73 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 _0x4819=['send','map','CmHopperFinal','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','catch','show','keys','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name'];(function(_0x2aaf68,_0x522680){var _0x479818=function(_0x4378bd){while(--_0x4378bd){_0x2aaf68['push'](_0x2aaf68['shift']());}};_0x479818(++_0x522680);}(_0x4819,0xcd));var _0x9481=function(_0x530151,_0x27ab6d){_0x530151=_0x530151-0x0;var _0x129774=_0x4819[_0x530151];return _0x129774;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];function respondWithStatusCode(_0xed8e9,_0x499b87){_0x499b87=_0x499b87||0xcc;return function(_0x5aac02){if(_0x5aac02){return _0xed8e9[_0x9481('0x1a')](_0x499b87);}return _0xed8e9[_0x9481('0x1b')](_0x499b87)[_0x9481('0x1c')]();};}function respondWithResult(_0x28fcb6,_0x3d23c2){_0x3d23c2=_0x3d23c2||0xc8;return function(_0xc7a0b5){if(_0xc7a0b5){return _0x28fcb6[_0x9481('0x1b')](_0x3d23c2)['json'](_0xc7a0b5);}};}function respondWithFilteredResult(_0x4220f1,_0x7a7ee){return function(_0x5b1fe6){if(_0x5b1fe6){var _0x2266d5=typeof _0x7a7ee['offset']===_0x9481('0x1d')&&typeof _0x7a7ee[_0x9481('0x1e')]===_0x9481('0x1d');var _0x2bb2a4=_0x5b1fe6['count'];var _0x5eda66=_0x2266d5?0x0:_0x7a7ee[_0x9481('0x1f')];var _0x50a559=_0x2266d5?_0x5b1fe6['count']:_0x7a7ee[_0x9481('0x1f')]+_0x7a7ee[_0x9481('0x1e')];var _0x18c6f5;if(_0x50a559>=_0x2bb2a4){_0x50a559=_0x2bb2a4;_0x18c6f5=0xc8;}else{_0x18c6f5=0xce;}_0x4220f1[_0x9481('0x1b')](_0x18c6f5);return _0x4220f1[_0x9481('0x20')](_0x9481('0x21'),_0x5eda66+'-'+_0x50a559+'/'+_0x2bb2a4)['json'](_0x5b1fe6);}return null;};}function patchUpdates(_0x2cf1aa){return function(_0x272a84){try{jsonpatch[_0x9481('0x22')](_0x272a84,_0x2cf1aa,!![]);}catch(_0x615e02){return BPromise[_0x9481('0x23')](_0x615e02);}return _0x272a84['save']();};}function saveUpdates(_0x215dd7,_0x294908){return function(_0x572599){if(_0x572599){return _0x572599[_0x9481('0x24')](_0x215dd7)[_0x9481('0x25')](function(_0x352b3a){return _0x352b3a;});}return null;};}function removeEntity(_0x1809d2,_0x2dc02e){return function(_0x49ecfa){if(_0x49ecfa){return _0x49ecfa[_0x9481('0x26')]()[_0x9481('0x25')](function(){_0x1809d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b0c3,_0x299e28){return function(_0x550fce){if(!_0x550fce){_0x12b0c3[_0x9481('0x1a')](0x194);}return _0x550fce;};}function handleError(_0x20ff9a,_0xeff0a5){_0xeff0a5=_0xeff0a5||0x1f4;return function(_0x28ae1b){logger['error'](_0x28ae1b[_0x9481('0x27')]);if(_0x28ae1b[_0x9481('0x28')]){delete _0x28ae1b[_0x9481('0x28')];}_0x20ff9a['status'](_0xeff0a5)[_0x9481('0x29')](_0x28ae1b);};}exports['index']=function(_0x2e1eff,_0xe153ab){var _0x22ab26={},_0x13ef93={},_0x2e5e63={'count':0x0,'rows':[]};var _0x53560d=_[_0x9481('0x2a')](db[_0x9481('0x2b')][_0x9481('0x2c')],function(_0x4895a0){return{'name':_0x4895a0['fieldName'],'type':_0x4895a0[_0x9481('0x2d')][_0x9481('0x2e')]};});_0x13ef93[_0x9481('0x2f')]=_[_0x9481('0x2a')](_0x53560d,'name');_0x13ef93['query']=_['keys'](_0x2e1eff[_0x9481('0x30')]);_0x13ef93['filters']=_[_0x9481('0x31')](_0x13ef93['model'],_0x13ef93[_0x9481('0x30')]);_0x22ab26[_0x9481('0x32')]=_[_0x9481('0x31')](_0x13ef93[_0x9481('0x2f')],qs[_0x9481('0x33')](_0x2e1eff['query'][_0x9481('0x33')]));_0x22ab26[_0x9481('0x32')]=_0x22ab26[_0x9481('0x32')]['length']?_0x22ab26[_0x9481('0x32')]:_0x13ef93[_0x9481('0x2f')];if(!_0x2e1eff[_0x9481('0x30')][_0x9481('0x34')](_0x9481('0x35'))){_0x22ab26[_0x9481('0x1e')]=qs['limit'](_0x2e1eff[_0x9481('0x30')]['limit']);_0x22ab26[_0x9481('0x1f')]=qs[_0x9481('0x1f')](_0x2e1eff[_0x9481('0x30')][_0x9481('0x1f')]);}_0x22ab26[_0x9481('0x36')]=qs[_0x9481('0x37')](_0x2e1eff['query'][_0x9481('0x37')]);_0x22ab26[_0x9481('0x38')]=qs['filters'](_['pick'](_0x2e1eff[_0x9481('0x30')],_0x13ef93['filters']),_0x53560d);if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]){_0x22ab26[_0x9481('0x38')]=_[_0x9481('0x3a')](_0x22ab26['where'],{'$or':_[_0x9481('0x2a')](_0x53560d,function(_0x590d50){if(_0x590d50[_0x9481('0x2d')]!=='VIRTUAL'){var _0x2ce972={};_0x2ce972[_0x590d50['name']]={'$like':'%'+_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]+'%'};return _0x2ce972;}})});}_0x22ab26=_[_0x9481('0x3a')]({},_0x22ab26,_0x2e1eff[_0x9481('0x3b')]);var _0x97dc3e={'where':_0x22ab26[_0x9481('0x38')]};return db[_0x9481('0x2b')]['count'](_0x97dc3e)[_0x9481('0x25')](function(_0x3857e8){_0x2e5e63[_0x9481('0x3c')]=_0x3857e8;if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x3d')]){_0x22ab26[_0x9481('0x3e')]=[{'all':!![]}];}return db[_0x9481('0x2b')]['findAll'](_0x22ab26);})[_0x9481('0x25')](function(_0x1872ff){_0x2e5e63['rows']=_0x1872ff;return _0x2e5e63;})[_0x9481('0x25')](respondWithFilteredResult(_0xe153ab,_0x22ab26))[_0x9481('0x3f')](handleError(_0xe153ab,null));};exports[_0x9481('0x40')]=function(_0x3eb9ee,_0x29a8e9){var _0x5a8ffd={'raw':!![],'where':{'id':_0x3eb9ee['params']['id']}},_0x304791={};_0x304791[_0x9481('0x2f')]=_[_0x9481('0x41')](db['CmHopperFinal']['rawAttributes']);_0x304791[_0x9481('0x30')]=_[_0x9481('0x41')](_0x3eb9ee[_0x9481('0x30')]);_0x304791['filters']=_[_0x9481('0x31')](_0x304791[_0x9481('0x2f')],_0x304791['query']);_0x5a8ffd['attributes']=_[_0x9481('0x31')](_0x304791['model'],qs[_0x9481('0x33')](_0x3eb9ee[_0x9481('0x30')][_0x9481('0x33')]));_0x5a8ffd[_0x9481('0x32')]=_0x5a8ffd[_0x9481('0x32')]['length']?_0x5a8ffd[_0x9481('0x32')]:_0x304791[_0x9481('0x2f')];if(_0x3eb9ee['query'][_0x9481('0x3d')]){_0x5a8ffd[_0x9481('0x3e')]=[{'all':!![]}];}_0x5a8ffd=_[_0x9481('0x3a')]({},_0x5a8ffd,_0x3eb9ee[_0x9481('0x3b')]);return db[_0x9481('0x2b')][_0x9481('0x42')](_0x5a8ffd)[_0x9481('0x25')](handleEntityNotFound(_0x29a8e9,null))[_0x9481('0x25')](respondWithResult(_0x29a8e9,null))[_0x9481('0x3f')](handleError(_0x29a8e9,null));};exports['describe']=function(_0xd36133,_0x5d3a06){return db['CmHopperFinal'][_0x9481('0x43')]()['then'](respondWithResult(_0x5d3a06,null))[_0x9481('0x3f')](handleError(_0x5d3a06,null));};exports[_0x9481('0x24')]=function(_0x47f8b2,_0x277e2a){if(_0x47f8b2[_0x9481('0x44')][_0x9481('0x45')]){delete _0x47f8b2[_0x9481('0x44')][_0x9481('0x45')];}return db[_0x9481('0x2b')]['find']({'where':{'uniqueid':_0x47f8b2['params']['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x277e2a,null))[_0x9481('0x25')](saveUpdates(_0x47f8b2[_0x9481('0x44')],null))[_0x9481('0x25')](respondWithResult(_0x277e2a,null))[_0x9481('0x3f')](handleError(_0x277e2a,null));};exports[_0x9481('0x46')]=function(_0x1c070c,_0x3d2250,_0x580273){return db[_0x9481('0x2b')][_0x9481('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x1c070c[_0x9481('0x48')]['id']},'attributes':[[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x9481('0x4b')](_0x9481('0x4c')))),_0x9481('0x4d')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')]['literal'](_0x9481('0x4e')))),_0x9481('0x4f')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x9481('0x50')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x51')))),_0x9481('0x52')],[db['sequelize']['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x53')))),_0x9481('0x54')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x9481('0x55')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x56')))),_0x9481('0x57')]]})[_0x9481('0x25')](handleEntityNotFound(_0x3d2250,null))['then'](respondWithResult(_0x3d2250,null))['catch'](handleError(_0x3d2250,null));};exports[_0x9481('0x58')]=function(_0x3cbab5,_0xb58b67,_0xe008db){return db[_0x9481('0x2b')][_0x9481('0x47')]({'raw':![],'where':{'CampaignId':_0x3cbab5['params']['id']},'attributes':[[db['sequelize']['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')]['literal'](_0x9481('0x4c')))),_0x9481('0x4d')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db['sequelize']['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x4e')))),'busyContacts'],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x9481('0x50')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x51')))),_0x9481('0x52')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x53')))),_0x9481('0x54')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x9481('0x55')],[db['sequelize']['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x9481('0x57')]]})[_0x9481('0x25')](handleEntityNotFound(_0xb58b67,null))[_0x9481('0x25')](respondWithResult(_0xb58b67,null))[_0x9481('0x3f')](handleError(_0xb58b67,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0xa83176,_0x265f1c,_0x2a053a){return db[_0x9481('0x59')]['find']({'where':{'id':_0xa83176['params']['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x265f1c,null))[_0x9481('0x25')](function(_0x193992){var _0x380f2a;if(_0x193992){_0x380f2a=squel[_0x9481('0x5a')]()['into'](_0x9481('0x5b'))[_0x9481('0x5c')]([_0x9481('0x5d'),_0x9481('0x5e'),_0x9481('0x5f'),_0x9481('0x60'),_0x9481('0x61'),_0x9481('0x62'),_0x9481('0x63')],squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x66'),_0x9481('0x5d'))[_0x9481('0x65')](_0x9481('0x67'),'scheduledAt')[_0x9481('0x65')](_0x9481('0x68'),_0x9481('0x5f'))[_0x9481('0x65')](_0x9481('0x69'),_0x9481('0x60'))[_0x9481('0x65')]('ANY_VALUE(VoiceQueueId)',_0x9481('0x61'))[_0x9481('0x65')]('NOW()','createdAt')[_0x9481('0x65')]('NOW()','updatedAt')[_0x9481('0x6a')]('cm_hopper_final')[_0x9481('0x38')](_0x9481('0x6b'),_0xa83176[_0x9481('0x48')]['id'][_0x9481('0x6c')]())['where'](_0x9481('0x6d'),_0xa83176['body'][_0x9481('0x6e')][_0x9481('0x6c')]())[_0x9481('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9481('0x64')]()['field']('phone')[_0x9481('0x6a')](_0x9481('0x5b'))[_0x9481('0x38')]('VoiceQueueId\x20=\x20?',_0xa83176[_0x9481('0x48')]['id'][_0x9481('0x6c')]()))['where'](_0x9481('0x6f'),squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x70'))['from'](_0x9481('0x71'))['where'](_0x9481('0x6b'),_0xa83176[_0x9481('0x48')]['id']['toString']())[_0x9481('0x38')](_0x9481('0x72')))[_0x9481('0x73')]('ContactId'))['toString']();return db[_0x9481('0x49')]['query'](_0x380f2a);}return[];})[_0x9481('0x25')](respondWithResult(_0x265f1c,null))[_0x9481('0x3f')](handleError(_0x265f1c,null));};exports[_0x9481('0x74')]=function(_0x55b428,_0x3f74f1,_0x287d06){return db[_0x9481('0x75')]['find']({'where':{'id':_0x55b428[_0x9481('0x48')]['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x3f74f1,null))[_0x9481('0x25')](function(_0x32b30f){var _0x347da1;if(_0x32b30f){_0x347da1=squel[_0x9481('0x5a')]()[_0x9481('0x76')](_0x9481('0x5b'))[_0x9481('0x5c')]([_0x9481('0x5d'),'scheduledAt',_0x9481('0x5f'),'ListId','CampaignId','createdAt',_0x9481('0x63')],squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x66'),_0x9481('0x5d'))['field'](_0x9481('0x67'),_0x9481('0x5e'))[_0x9481('0x65')](_0x9481('0x68'),_0x9481('0x5f'))[_0x9481('0x65')](_0x9481('0x69'),_0x9481('0x60'))[_0x9481('0x65')](_0x9481('0x77'),'CampaignId')[_0x9481('0x65')](_0x9481('0x67'),_0x9481('0x62'))[_0x9481('0x65')](_0x9481('0x67'),_0x9481('0x63'))[_0x9481('0x6a')](_0x9481('0x71'))[_0x9481('0x38')](_0x9481('0x78'),_0x55b428['params']['id'][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x6d'),_0x55b428[_0x9481('0x44')][_0x9481('0x6e')][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x79'))[_0x9481('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9481('0x64')]()['field']('phone')[_0x9481('0x6a')](_0x9481('0x5b'))[_0x9481('0x38')](_0x9481('0x78'),_0x55b428[_0x9481('0x48')]['id'][_0x9481('0x6c')]()))['where'](_0x9481('0x6f'),squel['select']()[_0x9481('0x65')](_0x9481('0x70'))[_0x9481('0x6a')]('cm_hopper_final')['where'](_0x9481('0x78'),_0x55b428[_0x9481('0x48')]['id'][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x72')))[_0x9481('0x73')](_0x9481('0x5f')))[_0x9481('0x6c')]();return db[_0x9481('0x49')]['query'](_0x347da1);}return[];})[_0x9481('0x25')](respondWithResult(_0x3f74f1,null))[_0x9481('0x3f')](handleError(_0x3f74f1,null));};exports['checkContactHopper']=function(_0x2c53df,_0x534979,_0x616b77){return db[_0x9481('0x7a')]['findOne']({'where':{'VoiceQueueId':_0x2c53df[_0x9481('0x44')][_0x9481('0x61')],'CampaignId':_0x2c53df[_0x9481('0x44')]['CampaignId'],'ContactId':_0x2c53df[_0x9481('0x44')][_0x9481('0x5f')]}})['then'](handleEntityNotFound(_0x534979,null))[_0x9481('0x25')](function(_0x5c7602){if(_0x5c7602){return _0x5c7602;}return null;})[_0x9481('0x25')](respondWithResult(_0x534979,null))[_0x9481('0x3f')](handleError(_0x534979,null));}; \ No newline at end of file +var _0xe2fe=['calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','select','calleridnum','state\x20=\x204','group','scheduledAt','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','CmHopperFinal','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','find','body','uniqueid','params','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','ContactId','ListId','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state'];(function(_0x201cf1,_0x89cd67){var _0x53ebb5=function(_0x5ddc56){while(--_0x5ddc56){_0x201cf1['push'](_0x201cf1['shift']());}};_0x53ebb5(++_0x89cd67);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['CmHopperFinal']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':!![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['describe']=function(_0x1609f0,_0x54cc44){return db['CmHopperFinal']['describe']()['then'](respondWithResult(_0x54cc44,null))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x32da72,_0x584383){if(_0x32da72[_0xee2f('0x3e')]['uniqueid']){delete _0x32da72[_0xee2f('0x3e')][_0xee2f('0x3f')];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'uniqueid':_0x32da72[_0xee2f('0x40')]['id']}})['then'](handleEntityNotFound(_0x584383,null))['then'](saveUpdates(_0x32da72[_0xee2f('0x3e')],null))['then'](respondWithResult(_0x584383,null))[_0xee2f('0x3b')](handleError(_0x584383,null));};exports[_0xee2f('0x41')]=function(_0x1928f8,_0x88e683,_0x4fb3a0){return db['CmHopperFinal'][_0xee2f('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x1928f8[_0xee2f('0x40')]['id']},'attributes':[[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x46')))),_0xee2f('0x47')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db['sequelize'][_0xee2f('0x45')](_0xee2f('0x48')))),_0xee2f('0x49')],[db[_0xee2f('0x43')]['fn']('COUNT',db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x4a')))),_0xee2f('0x4b')],[db['sequelize']['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db['sequelize'][_0xee2f('0x45')](_0xee2f('0x4c')))),_0xee2f('0x4d')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')]['literal'](_0xee2f('0x4e')))),_0xee2f('0x4f')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x50')))),_0xee2f('0x51')],[db['sequelize']['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x52')))),_0xee2f('0x53')],[db[_0xee2f('0x43')]['fn']('COUNT',db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x54')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x88e683,null))['then'](respondWithResult(_0x88e683,null))['catch'](handleError(_0x88e683,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x8f90e6,_0x511e54,_0x2891ed){return db[_0xee2f('0x23')][_0xee2f('0x42')]({'raw':![],'where':{'CampaignId':_0x8f90e6[_0xee2f('0x40')]['id']},'attributes':[[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db['sequelize'][_0xee2f('0x45')]('`state`\x20=\x200,\x201,\x20null'))),_0xee2f('0x47')],[db['sequelize']['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x48')))),'noAnswerContacts'],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x4a')))),_0xee2f('0x4b')],[db['sequelize']['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x4c')))),_0xee2f('0x4d')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xee2f('0x4f')],[db[_0xee2f('0x43')]['fn']('COUNT',db[_0xee2f('0x43')]['fn']('IF',db['sequelize'][_0xee2f('0x45')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')]('`state`\x20=\x2022,\x201,\x20null'))),_0xee2f('0x53')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')]('`state`\x20=\x2019,\x201,\x20null'))),_0xee2f('0x55')]]})[_0xee2f('0x1c')](handleEntityNotFound(_0x511e54,null))[_0xee2f('0x1c')](respondWithResult(_0x511e54,null))[_0xee2f('0x3b')](handleError(_0x511e54,null));};exports[_0xee2f('0x56')]=function(_0x2adcc6,_0x43b883,_0x97edb2){return db[_0xee2f('0x57')]['find']({'where':{'id':_0x2adcc6['params']['id']}})['then'](handleEntityNotFound(_0x43b883,null))[_0xee2f('0x1c')](function(_0x19ce25){var _0x4288eb;if(_0x19ce25){_0x4288eb=squel[_0xee2f('0x58')]()[_0xee2f('0x59')]('cm_hopper')[_0xee2f('0x5a')]([_0xee2f('0x5b'),'scheduledAt',_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x5e'),'createdAt',_0xee2f('0x5f')],squel['select']()[_0xee2f('0x60')](_0xee2f('0x61'),'phone')[_0xee2f('0x60')](_0xee2f('0x62'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0xee2f('0x5c'))['field']('ANY_VALUE(ListId)',_0xee2f('0x5d'))[_0xee2f('0x60')]('ANY_VALUE(VoiceQueueId)',_0xee2f('0x5e'))['field'](_0xee2f('0x62'),_0xee2f('0x63'))[_0xee2f('0x60')](_0xee2f('0x62'),_0xee2f('0x5f'))[_0xee2f('0x64')](_0xee2f('0x65'))['where'](_0xee2f('0x66'),_0x2adcc6[_0xee2f('0x40')]['id'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x68'),_0x2adcc6['body'][_0xee2f('0x69')][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x6a'))[_0xee2f('0x32')](_0xee2f('0x6b'),squel['select']()['field'](_0xee2f('0x5b'))[_0xee2f('0x64')](_0xee2f('0x6c'))[_0xee2f('0x32')](_0xee2f('0x66'),_0x2adcc6[_0xee2f('0x40')]['id'][_0xee2f('0x67')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xee2f('0x6d')]()[_0xee2f('0x60')](_0xee2f('0x6e'))[_0xee2f('0x64')](_0xee2f('0x65'))[_0xee2f('0x32')](_0xee2f('0x66'),_0x2adcc6[_0xee2f('0x40')]['id'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x6f')))[_0xee2f('0x70')]('ContactId'))['toString']();return db[_0xee2f('0x43')]['query'](_0x4288eb);}return[];})['then'](respondWithResult(_0x43b883,null))['catch'](handleError(_0x43b883,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x2ea31f,_0x277507,_0x500459){return db['Campaign'][_0xee2f('0x3d')]({'where':{'id':_0x2ea31f[_0xee2f('0x40')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x277507,null))['then'](function(_0x4aeae5){var _0x2b6f0f;if(_0x4aeae5){_0x2b6f0f=squel[_0xee2f('0x58')]()[_0xee2f('0x59')]('cm_hopper')[_0xee2f('0x5a')](['phone',_0xee2f('0x71'),'ContactId',_0xee2f('0x5d'),_0xee2f('0x72'),_0xee2f('0x63'),'updatedAt'],squel['select']()[_0xee2f('0x60')](_0xee2f('0x61'),_0xee2f('0x5b'))['field'](_0xee2f('0x62'),_0xee2f('0x71'))[_0xee2f('0x60')](_0xee2f('0x73'),_0xee2f('0x5c'))[_0xee2f('0x60')](_0xee2f('0x74'),_0xee2f('0x5d'))[_0xee2f('0x60')](_0xee2f('0x75'),_0xee2f('0x72'))[_0xee2f('0x60')](_0xee2f('0x62'),_0xee2f('0x63'))['field'](_0xee2f('0x62'),_0xee2f('0x5f'))[_0xee2f('0x64')](_0xee2f('0x65'))[_0xee2f('0x32')](_0xee2f('0x76'),_0x2ea31f[_0xee2f('0x40')]['id'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x68'),_0x2ea31f[_0xee2f('0x3e')]['state'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x6a'))[_0xee2f('0x32')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xee2f('0x6d')]()[_0xee2f('0x60')](_0xee2f('0x5b'))['from']('cm_hopper')[_0xee2f('0x32')]('CampaignId\x20=\x20?',_0x2ea31f['params']['id']['toString']()))[_0xee2f('0x32')](_0xee2f('0x6b'),squel[_0xee2f('0x6d')]()[_0xee2f('0x60')]('calleridnum')[_0xee2f('0x64')](_0xee2f('0x65'))[_0xee2f('0x32')]('CampaignId\x20=\x20?',_0x2ea31f[_0xee2f('0x40')]['id']['toString']())[_0xee2f('0x32')]('state\x20=\x204'))['group'](_0xee2f('0x5c')))['toString']();return db[_0xee2f('0x43')]['query'](_0x2b6f0f);}return[];})['then'](respondWithResult(_0x277507,null))[_0xee2f('0x3b')](handleError(_0x277507,null));};exports[_0xee2f('0x77')]=function(_0x4fed80,_0x2685ed,_0x34f882){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x4fed80[_0xee2f('0x3e')][_0xee2f('0x5e')],'CampaignId':_0x4fed80['body'][_0xee2f('0x72')],'ContactId':_0x4fed80[_0xee2f('0x3e')][_0xee2f('0x5c')]}})[_0xee2f('0x1c')](handleEntityNotFound(_0x2685ed,null))[_0xee2f('0x1c')](function(_0x4f20e9){if(_0x4f20e9){return _0x4f20e9;}return null;})['then'](respondWithResult(_0x2685ed,null))['catch'](handleError(_0x2685ed,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index bf66e26..868d1d8 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 _0x15a9=['moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x15a9,0x1ec));var _0x915a=function(_0x40fbe5,_0x4fd4ed){_0x40fbe5=_0x40fbe5-0x0;var _0x306e43=_0x15a9[_0x40fbe5];return _0x306e43;};'use strict';var _=require('lodash');var util=require(_0x915a('0x0'));var logger=require(_0x915a('0x1'))('api');var moment=require(_0x915a('0x2'));var BPromise=require('bluebird');var rp=require(_0x915a('0x3'));var fs=require('fs');var path=require(_0x915a('0x4'));var rimraf=require(_0x915a('0x5'));var config=require(_0x915a('0x6'));var attributes=require(_0x915a('0x7'));module[_0x915a('0x8')]=function(_0x5e970f,_0x4410f6){return _0x5e970f['define'](_0x915a('0x9'),attributes,{'tableName':_0x915a('0xa'),'paranoid':![],'indexes':[{'name':_0x915a('0xb'),'fields':[_0x915a('0xb')]},{'name':_0x915a('0xc'),'fields':[_0x915a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f35=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','CmHopperFinal','calleridnum'];(function(_0x2dd2ae,_0x152ff8){var _0xa0f3b3=function(_0x5c8ab7){while(--_0x5c8ab7){_0x2dd2ae['push'](_0x2dd2ae['shift']());}};_0xa0f3b3(++_0x152ff8);}(_0x9f35,0x151));var _0x59f3=function(_0x310d95,_0x43eb60){_0x310d95=_0x310d95-0x0;var _0x5bccd4=_0x9f35[_0x310d95];return _0x5bccd4;};'use strict';var _=require(_0x59f3('0x0'));var util=require(_0x59f3('0x1'));var logger=require(_0x59f3('0x2'))(_0x59f3('0x3'));var moment=require(_0x59f3('0x4'));var BPromise=require('bluebird');var rp=require(_0x59f3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x59f3('0x6'));var config=require(_0x59f3('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0x59f3('0x8')]=function(_0xecd536,_0xb79632){return _0xecd536['define'](_0x59f3('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x59f3('0xa'),'fields':[_0x59f3('0xa')]},{'name':_0x59f3('0xb'),'fields':[_0x59f3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 87f43bb..8b89f03 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x3cea3d,_0x4a8c60){var _0x19d044=function(_0x45ada4){while(--_0x45ada4){_0x3cea3d['push'](_0x3cea3d['shift']());}};_0x19d044(++_0x4a8c60);}(_0xb10b,0x12a));var _0xbb10=function(_0xff3357,_0x3b4152){_0xff3357=_0xff3357-0x0;var _0x16d529=_0xb10b[_0xff3357];return _0x16d529;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5d0428,_0x33ab8c){var _0x5522ec=function(_0x4b3cc9){while(--_0x4b3cc9){_0x5d0428['push'](_0x5d0428['shift']());}};_0x5522ec(++_0x33ab8c);}(_0x7a54,0x106));var _0x47a5=function(_0xdcce3e,_0x3ae4a2){_0xdcce3e=_0xdcce3e-0x0;var _0x55deb8=_0x7a54[_0xdcce3e];return _0x55deb8;};'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 73c9e64..2e659d4 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 _0x0f8f=['/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','get','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id'];(function(_0x28ae95,_0x6d6d3d){var _0x1969d2=function(_0x275178){while(--_0x275178){_0x28ae95['push'](_0x28ae95['shift']());}};_0x1969d2(++_0x6d6d3d);}(_0x0f8f,0x1cc));var _0xf0f8=function(_0x39fd11,_0x5d7883){_0x39fd11=_0x39fd11-0x0;var _0x302799=_0x0f8f[_0x39fd11];return _0x302799;};'use strict';var multer=require('multer');var util=require(_0xf0f8('0x0'));var path=require(_0xf0f8('0x1'));var timeout=require('connect-timeout');var express=require(_0xf0f8('0x2'));var router=express[_0xf0f8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf0f8('0x4'));var interaction=require(_0xf0f8('0x5'));var config=require(_0xf0f8('0x6'));var controller=require(_0xf0f8('0x7'));router['get']('/',auth[_0xf0f8('0x8')](),controller['index']);router[_0xf0f8('0x9')](_0xf0f8('0xa'),auth['isAuthenticated'](),controller[_0xf0f8('0xb')]);router[_0xf0f8('0x9')](_0xf0f8('0xc'),auth['isAuthenticated'](),controller[_0xf0f8('0xd')]);router[_0xf0f8('0x9')](_0xf0f8('0xe'),auth[_0xf0f8('0x8')](),controller[_0xf0f8('0xf')]);router[_0xf0f8('0x9')](_0xf0f8('0x10'),auth[_0xf0f8('0x8')](),controller[_0xf0f8('0x11')]);router[_0xf0f8('0x12')](_0xf0f8('0x13'),auth[_0xf0f8('0x8')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xf0f8('0x12')](_0xf0f8('0x14'),auth[_0xf0f8('0x8')](),controller[_0xf0f8('0x15')]);router[_0xf0f8('0x12')](_0xf0f8('0x16'),auth[_0xf0f8('0x8')](),controller[_0xf0f8('0x17')]);router['put']('/:id',auth[_0xf0f8('0x8')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x15ad=['/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1a8dfc,_0x2ae370){var _0x5390e4=function(_0x142a89){while(--_0x142a89){_0x1a8dfc['push'](_0x1a8dfc['shift']());}};_0x5390e4(++_0x2ae370);}(_0x15ad,0x6e));var _0xd15a=function(_0x173b39,_0x4326b6){_0x173b39=_0x173b39-0x0;var _0x1da735=_0x15ad[_0x173b39];return _0x1da735;};'use strict';var multer=require(_0xd15a('0x0'));var util=require(_0xd15a('0x1'));var path=require('path');var timeout=require(_0xd15a('0x2'));var express=require(_0xd15a('0x3'));var router=express[_0xd15a('0x4')]();var fs_extra=require(_0xd15a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd15a('0x6'));var config=require(_0xd15a('0x7'));var controller=require('./cmHopperFinal.controller');router[_0xd15a('0x8')]('/',auth[_0xd15a('0x9')](),controller['index']);router['get'](_0xd15a('0xa'),auth[_0xd15a('0x9')](),controller['describe']);router[_0xd15a('0x8')](_0xd15a('0xb'),auth[_0xd15a('0x9')](),controller[_0xd15a('0xc')]);router['get'](_0xd15a('0xd'),auth['isAuthenticated'](),controller[_0xd15a('0xe')]);router[_0xd15a('0x8')](_0xd15a('0xf'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0xd15a('0x10')](_0xd15a('0x11'),auth[_0xd15a('0x9')](),controller[_0xd15a('0x12')]);router[_0xd15a('0x10')](_0xd15a('0x13'),auth[_0xd15a('0x9')](),controller[_0xd15a('0x14')]);router[_0xd15a('0x10')](_0xd15a('0x15'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0xd15a('0x16')](_0xd15a('0xb'),auth['isAuthenticated'](),controller[_0xd15a('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 38bdf9d..91453af 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 _0xe1c0=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x2c27e4,_0x5653ba){var _0x4c83dd=function(_0x44730){while(--_0x44730){_0x2c27e4['push'](_0x2c27e4['shift']());}};_0x4c83dd(++_0x5653ba);}(_0xe1c0,0x120));var _0x0e1c=function(_0x2e14a9,_0x34a30f){_0x2e14a9=_0x2e14a9-0x0;var _0x18e859=_0xe1c0[_0x2e14a9];return _0x18e859;};'use strict';var Sequelize=require(_0x0e1c('0x0'));module[_0x0e1c('0x1')]={'state':{'type':Sequelize[_0x0e1c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0e1c('0x3')]},'scheduledat':{'type':Sequelize[_0x0e1c('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0e1c('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0e1c('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x0e1c('0x3')]},'originatecalleridname':{'type':Sequelize[_0x0e1c('0x3')]},'calleridnum':{'type':Sequelize[_0x0e1c('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0e1c('0x4')]},'answertime':{'type':Sequelize[_0x0e1c('0x4')]},'droptime':{'type':Sequelize[_0x0e1c('0x4')]},'endtime':{'type':Sequelize[_0x0e1c('0x4')]},'ringtime':{'type':Sequelize[_0x0e1c('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0e1c('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0e1c('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0e1c('0x3')]},'campaign':{'type':Sequelize[_0x0e1c('0x3')]},'campaigntype':{'type':Sequelize[_0x0e1c('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x0e1c('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0e1c('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x0e1c('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0e1c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0e1c('0x4')]},'recallme':{'type':Sequelize[_0x0e1c('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0e1c('0x4')]},'edited':{'type':Sequelize[_0x0e1c('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0e1c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0e1c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0e1c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0e1c('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xee9c=['BOOLEAN','exports','INTEGER','STRING','DATE'];(function(_0x12e822,_0x249647){var _0x25cdee=function(_0x2db122){while(--_0x2db122){_0x12e822['push'](_0x12e822['shift']());}};_0x25cdee(++_0x249647);}(_0xee9c,0x1e6));var _0xcee9=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0xee9c[_0x40df5f];return _0x1573f1;};'use strict';var Sequelize=require('sequelize');module[_0xcee9('0x0')]={'state':{'type':Sequelize[_0xcee9('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xcee9('0x2')]},'scheduledat':{'type':Sequelize[_0xcee9('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcee9('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcee9('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xcee9('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xcee9('0x2')]},'starttime':{'type':Sequelize[_0xcee9('0x3')]},'responsetime':{'type':Sequelize[_0xcee9('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xcee9('0x3')]},'ringtime':{'type':Sequelize[_0xcee9('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xcee9('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcee9('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcee9('0x2')]},'campaign':{'type':Sequelize[_0xcee9('0x2')]},'campaigntype':{'type':Sequelize[_0xcee9('0x2')]},'membername':{'type':Sequelize[_0xcee9('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xcee9('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xcee9('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcee9('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcee9('0x3')]},'recallme':{'type':Sequelize[_0xcee9('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xcee9('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xcee9('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcee9('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcee9('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcee9('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 9004b8d..b08765c 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 _0x9e6e=['request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','stack','name','map','rawAttributes','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','filter','options','CmHopperHistory','include','rows','show','params','includeAll','find','catch','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x8a130e,_0x2dfa89){var _0x239757=function(_0x3d5e78){while(--_0x3d5e78){_0x8a130e['push'](_0x8a130e['shift']());}};_0x239757(++_0x2dfa89);}(_0x9e6e,0x16e));var _0xe9e6=function(_0x580730,_0x423233){_0x580730=_0x580730-0x0;var _0xf5629a=_0x9e6e[_0x580730];return _0xf5629a;};'use strict';var emlformat=require(_0xe9e6('0x0'));var rimraf=require(_0xe9e6('0x1'));var zipdir=require(_0xe9e6('0x2'));var jsonpatch=require(_0xe9e6('0x3'));var rp=require(_0xe9e6('0x4'));var moment=require(_0xe9e6('0x5'));var BPromise=require(_0xe9e6('0x6'));var Mustache=require(_0xe9e6('0x7'));var util=require(_0xe9e6('0x8'));var path=require(_0xe9e6('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe9e6('0xa'));var fs=require('fs');var fs_extra=require(_0xe9e6('0xb'));var _=require(_0xe9e6('0xc'));var squel=require(_0xe9e6('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe9e6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe9e6('0xf'));var Papa=require(_0xe9e6('0x10'));var Redis=require(_0xe9e6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe9e6('0x12'));var as=require(_0xe9e6('0x13'));var hardwareService=require(_0xe9e6('0x14'));var logger=require(_0xe9e6('0x15'))(_0xe9e6('0x16'));var utils=require('../../config/utils');var config=require(_0xe9e6('0x17'));var licenseUtil=require(_0xe9e6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5282cd,_0x117b4f){_0x117b4f=_0x117b4f||0xcc;return function(_0x2d7ec3){if(_0x2d7ec3){return _0x5282cd[_0xe9e6('0x19')](_0x117b4f);}return _0x5282cd[_0xe9e6('0x1a')](_0x117b4f)[_0xe9e6('0x1b')]();};}function respondWithResult(_0x3c7d4a,_0x1c7d22){_0x1c7d22=_0x1c7d22||0xc8;return function(_0x340fdb){if(_0x340fdb){return _0x3c7d4a['status'](_0x1c7d22)['json'](_0x340fdb);}};}function respondWithFilteredResult(_0x55b26b,_0x47bfd3){return function(_0x3c733c){if(_0x3c733c){var _0x322207=typeof _0x47bfd3[_0xe9e6('0x1c')]===_0xe9e6('0x1d')&&typeof _0x47bfd3[_0xe9e6('0x1e')]==='undefined';var _0x55012f=_0x3c733c[_0xe9e6('0x1f')];var _0x35c1e3=_0x322207?0x0:_0x47bfd3['offset'];var _0x40f831=_0x322207?_0x3c733c['count']:_0x47bfd3[_0xe9e6('0x1c')]+_0x47bfd3[_0xe9e6('0x1e')];var _0x876e35;if(_0x40f831>=_0x55012f){_0x40f831=_0x55012f;_0x876e35=0xc8;}else{_0x876e35=0xce;}_0x55b26b['status'](_0x876e35);return _0x55b26b['set'](_0xe9e6('0x20'),_0x35c1e3+'-'+_0x40f831+'/'+_0x55012f)[_0xe9e6('0x21')](_0x3c733c);}return null;};}function patchUpdates(_0xc0663a){return function(_0x4edb82){try{jsonpatch[_0xe9e6('0x22')](_0x4edb82,_0xc0663a,!![]);}catch(_0x3b2d1f){return BPromise[_0xe9e6('0x23')](_0x3b2d1f);}return _0x4edb82[_0xe9e6('0x24')]();};}function saveUpdates(_0x49210b,_0x14064c){return function(_0x9d25d5){if(_0x9d25d5){return _0x9d25d5[_0xe9e6('0x25')](_0x49210b)[_0xe9e6('0x26')](function(_0xa0b619){return _0xa0b619;});}return null;};}function removeEntity(_0x35beb4,_0x18528a){return function(_0x5ee5f2){if(_0x5ee5f2){return _0x5ee5f2['destroy']()[_0xe9e6('0x26')](function(){_0x35beb4['status'](0xcc)[_0xe9e6('0x1b')]();});}};}function handleEntityNotFound(_0x3ee796,_0x24d49b){return function(_0x237a67){if(!_0x237a67){_0x3ee796[_0xe9e6('0x19')](0x194);}return _0x237a67;};}function handleError(_0x3b905f,_0x405748){_0x405748=_0x405748||0x1f4;return function(_0xdc82a2){logger['error'](_0xdc82a2[_0xe9e6('0x27')]);if(_0xdc82a2[_0xe9e6('0x28')]){delete _0xdc82a2['name'];}_0x3b905f[_0xe9e6('0x1a')](_0x405748)['send'](_0xdc82a2);};}exports['index']=function(_0x306316,_0x4f826d){var _0x5494cf={},_0x22493d={},_0x959a75={'count':0x0,'rows':[]};var _0x59bf53=_[_0xe9e6('0x29')](db['CmHopperHistory'][_0xe9e6('0x2a')],function(_0x37c07d){return{'name':_0x37c07d[_0xe9e6('0x2b')],'type':_0x37c07d[_0xe9e6('0x2c')][_0xe9e6('0x2d')]};});_0x22493d['model']=_[_0xe9e6('0x29')](_0x59bf53,_0xe9e6('0x28'));_0x22493d[_0xe9e6('0x2e')]=_[_0xe9e6('0x2f')](_0x306316[_0xe9e6('0x2e')]);_0x22493d['filters']=_['intersection'](_0x22493d[_0xe9e6('0x30')],_0x22493d[_0xe9e6('0x2e')]);_0x5494cf['attributes']=_[_0xe9e6('0x31')](_0x22493d[_0xe9e6('0x30')],qs[_0xe9e6('0x32')](_0x306316[_0xe9e6('0x2e')][_0xe9e6('0x32')]));_0x5494cf[_0xe9e6('0x33')]=_0x5494cf[_0xe9e6('0x33')][_0xe9e6('0x34')]?_0x5494cf['attributes']:_0x22493d['model'];if(!_0x306316[_0xe9e6('0x2e')][_0xe9e6('0x35')](_0xe9e6('0x36'))){_0x5494cf[_0xe9e6('0x1e')]=qs['limit'](_0x306316['query'][_0xe9e6('0x1e')]);_0x5494cf[_0xe9e6('0x1c')]=qs[_0xe9e6('0x1c')](_0x306316['query'][_0xe9e6('0x1c')]);}_0x5494cf['order']=qs['sort'](_0x306316['query'][_0xe9e6('0x37')]);_0x5494cf['where']=qs[_0xe9e6('0x38')](_[_0xe9e6('0x39')](_0x306316[_0xe9e6('0x2e')],_0x22493d['filters']),_0x59bf53);if(_0x306316['query']['filter']){_0x5494cf[_0xe9e6('0x3a')]=_[_0xe9e6('0x3b')](_0x5494cf[_0xe9e6('0x3a')],{'$or':_[_0xe9e6('0x29')](_0x59bf53,function(_0x48913e){if(_0x48913e[_0xe9e6('0x2c')]!=='VIRTUAL'){var _0xe4cede={};_0xe4cede[_0x48913e[_0xe9e6('0x28')]]={'$like':'%'+_0x306316['query'][_0xe9e6('0x3c')]+'%'};return _0xe4cede;}})});}_0x5494cf=_['merge']({},_0x5494cf,_0x306316[_0xe9e6('0x3d')]);var _0x4386be={'where':_0x5494cf[_0xe9e6('0x3a')]};return db[_0xe9e6('0x3e')]['count'](_0x4386be)['then'](function(_0x406f67){_0x959a75[_0xe9e6('0x1f')]=_0x406f67;if(_0x306316['query']['includeAll']){_0x5494cf[_0xe9e6('0x3f')]=[{'all':!![]}];}return db[_0xe9e6('0x3e')]['findAll'](_0x5494cf);})[_0xe9e6('0x26')](function(_0x2f33b2){_0x959a75[_0xe9e6('0x40')]=_0x2f33b2;return _0x959a75;})['then'](respondWithFilteredResult(_0x4f826d,_0x5494cf))['catch'](handleError(_0x4f826d,null));};exports[_0xe9e6('0x41')]=function(_0x454291,_0x23dd6d){var _0x232f23={'raw':!![],'where':{'id':_0x454291[_0xe9e6('0x42')]['id']}},_0x415588={};_0x415588[_0xe9e6('0x30')]=_[_0xe9e6('0x2f')](db[_0xe9e6('0x3e')][_0xe9e6('0x2a')]);_0x415588['query']=_[_0xe9e6('0x2f')](_0x454291['query']);_0x415588[_0xe9e6('0x38')]=_['intersection'](_0x415588[_0xe9e6('0x30')],_0x415588['query']);_0x232f23[_0xe9e6('0x33')]=_[_0xe9e6('0x31')](_0x415588[_0xe9e6('0x30')],qs['fields'](_0x454291[_0xe9e6('0x2e')][_0xe9e6('0x32')]));_0x232f23['attributes']=_0x232f23[_0xe9e6('0x33')][_0xe9e6('0x34')]?_0x232f23['attributes']:_0x415588[_0xe9e6('0x30')];if(_0x454291[_0xe9e6('0x2e')][_0xe9e6('0x43')]){_0x232f23['include']=[{'all':!![]}];}_0x232f23=_['merge']({},_0x232f23,_0x454291[_0xe9e6('0x3d')]);return db['CmHopperHistory'][_0xe9e6('0x44')](_0x232f23)[_0xe9e6('0x26')](handleEntityNotFound(_0x23dd6d,null))[_0xe9e6('0x26')](respondWithResult(_0x23dd6d,null))[_0xe9e6('0x45')](handleError(_0x23dd6d,null));};exports[_0xe9e6('0x46')]=function(_0xa63283,_0x1e10b7){return db[_0xe9e6('0x3e')][_0xe9e6('0x46')](_0xa63283[_0xe9e6('0x47')],{})[_0xe9e6('0x26')](respondWithResult(_0x1e10b7,0xc9))['catch'](handleError(_0x1e10b7,null));};exports[_0xe9e6('0x48')]=function(_0x3fa751,_0x33d013){return db['CmHopperHistory']['describe']()['then'](respondWithResult(_0x33d013,null))['catch'](handleError(_0x33d013,null));};exports['update']=function(_0x52a4a5,_0x12327f){if(_0x52a4a5['body'][_0xe9e6('0x49')]){delete _0x52a4a5[_0xe9e6('0x47')][_0xe9e6('0x49')];}return db[_0xe9e6('0x3e')][_0xe9e6('0x44')]({'where':{'uniqueid':_0x52a4a5['params']['id']}})[_0xe9e6('0x26')](handleEntityNotFound(_0x12327f,null))[_0xe9e6('0x26')](saveUpdates(_0x52a4a5['body'],null))[_0xe9e6('0x26')](respondWithResult(_0x12327f,null))[_0xe9e6('0x45')](handleError(_0x12327f,null));}; \ No newline at end of file +var _0xef19=['ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','destroy','then','stack','name','send','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','options','CmHopperHistory','includeAll','include','findAll','rows','catch','show','params','keys','length','find','body','describe','update','uniqueid','eml-format','moment','mustache','util','path','sox'];(function(_0x1905cc,_0x99e86f){var _0x15f952=function(_0x4471c0){while(--_0x4471c0){_0x1905cc['push'](_0x1905cc['shift']());}};_0x15f952(++_0x99e86f);}(_0xef19,0xcf));var _0x9ef1=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0xef19[_0x1e6b59];return _0x40d7c5;};'use strict';var emlformat=require(_0x9ef1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9ef1('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x9ef1('0x2'));var util=require(_0x9ef1('0x3'));var path=require(_0x9ef1('0x4'));var sox=require(_0x9ef1('0x5'));var csv=require('to-csv');var ejs=require(_0x9ef1('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ef1('0x7'));var squel=require(_0x9ef1('0x8'));var crypto=require(_0x9ef1('0x9'));var jsforce=require(_0x9ef1('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x9ef1('0xb'));var querystring=require(_0x9ef1('0xc'));var Papa=require('papaparse');var Redis=require(_0x9ef1('0xd'));var authService=require(_0x9ef1('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ef1('0xf'));var logger=require(_0x9ef1('0x10'))(_0x9ef1('0x11'));var utils=require('../../config/utils');var config=require(_0x9ef1('0x12'));var licenseUtil=require(_0x9ef1('0x13'));var db=require(_0x9ef1('0x14'))['db'];function respondWithStatusCode(_0x4527b1,_0x43fd2f){_0x43fd2f=_0x43fd2f||0xcc;return function(_0x388a82){if(_0x388a82){return _0x4527b1[_0x9ef1('0x15')](_0x43fd2f);}return _0x4527b1['status'](_0x43fd2f)[_0x9ef1('0x16')]();};}function respondWithResult(_0x4fdf45,_0x3f9600){_0x3f9600=_0x3f9600||0xc8;return function(_0x13f56b){if(_0x13f56b){return _0x4fdf45[_0x9ef1('0x17')](_0x3f9600)[_0x9ef1('0x18')](_0x13f56b);}};}function respondWithFilteredResult(_0x5e615c,_0x116252){return function(_0x46c56d){if(_0x46c56d){var _0x15a8d6=typeof _0x116252['offset']===_0x9ef1('0x19')&&typeof _0x116252[_0x9ef1('0x1a')]===_0x9ef1('0x19');var _0x48a3b1=_0x46c56d['count'];var _0x59ac3d=_0x15a8d6?0x0:_0x116252[_0x9ef1('0x1b')];var _0x36eb34=_0x15a8d6?_0x46c56d[_0x9ef1('0x1c')]:_0x116252[_0x9ef1('0x1b')]+_0x116252[_0x9ef1('0x1a')];var _0x2d9db4;if(_0x36eb34>=_0x48a3b1){_0x36eb34=_0x48a3b1;_0x2d9db4=0xc8;}else{_0x2d9db4=0xce;}_0x5e615c[_0x9ef1('0x17')](_0x2d9db4);return _0x5e615c[_0x9ef1('0x1d')](_0x9ef1('0x1e'),_0x59ac3d+'-'+_0x36eb34+'/'+_0x48a3b1)['json'](_0x46c56d);}return null;};}function patchUpdates(_0x192d62){return function(_0x21f803){try{jsonpatch[_0x9ef1('0x1f')](_0x21f803,_0x192d62,!![]);}catch(_0x14ea7b){return BPromise[_0x9ef1('0x20')](_0x14ea7b);}return _0x21f803['save']();};}function saveUpdates(_0x47426c,_0x314416){return function(_0x180174){if(_0x180174){return _0x180174['update'](_0x47426c)['then'](function(_0x4891a0){return _0x4891a0;});}return null;};}function removeEntity(_0x47fbf1,_0x8e79b7){return function(_0x16c764){if(_0x16c764){return _0x16c764[_0x9ef1('0x21')]()[_0x9ef1('0x22')](function(){_0x47fbf1[_0x9ef1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x438ca4,_0x1e1751){return function(_0x269c9a){if(!_0x269c9a){_0x438ca4[_0x9ef1('0x15')](0x194);}return _0x269c9a;};}function handleError(_0x9faf04,_0x5f2dde){_0x5f2dde=_0x5f2dde||0x1f4;return function(_0x3e31a2){logger['error'](_0x3e31a2[_0x9ef1('0x23')]);if(_0x3e31a2['name']){delete _0x3e31a2[_0x9ef1('0x24')];}_0x9faf04[_0x9ef1('0x17')](_0x5f2dde)[_0x9ef1('0x25')](_0x3e31a2);};}exports['index']=function(_0x2192ce,_0x458198){var _0x548271={},_0x3a0234={},_0x4f8a18={'count':0x0,'rows':[]};var _0x3d7d4d=_[_0x9ef1('0x26')](db['CmHopperHistory'][_0x9ef1('0x27')],function(_0x4f11a0){return{'name':_0x4f11a0[_0x9ef1('0x28')],'type':_0x4f11a0[_0x9ef1('0x29')]['key']};});_0x3a0234[_0x9ef1('0x2a')]=_[_0x9ef1('0x26')](_0x3d7d4d,'name');_0x3a0234[_0x9ef1('0x2b')]=_['keys'](_0x2192ce[_0x9ef1('0x2b')]);_0x3a0234['filters']=_[_0x9ef1('0x2c')](_0x3a0234[_0x9ef1('0x2a')],_0x3a0234[_0x9ef1('0x2b')]);_0x548271[_0x9ef1('0x2d')]=_[_0x9ef1('0x2c')](_0x3a0234['model'],qs[_0x9ef1('0x2e')](_0x2192ce['query']['fields']));_0x548271[_0x9ef1('0x2d')]=_0x548271[_0x9ef1('0x2d')]['length']?_0x548271[_0x9ef1('0x2d')]:_0x3a0234[_0x9ef1('0x2a')];if(!_0x2192ce['query']['hasOwnProperty'](_0x9ef1('0x2f'))){_0x548271[_0x9ef1('0x1a')]=qs[_0x9ef1('0x1a')](_0x2192ce[_0x9ef1('0x2b')][_0x9ef1('0x1a')]);_0x548271[_0x9ef1('0x1b')]=qs['offset'](_0x2192ce[_0x9ef1('0x2b')][_0x9ef1('0x1b')]);}_0x548271[_0x9ef1('0x30')]=qs[_0x9ef1('0x31')](_0x2192ce[_0x9ef1('0x2b')][_0x9ef1('0x31')]);_0x548271['where']=qs['filters'](_[_0x9ef1('0x32')](_0x2192ce['query'],_0x3a0234[_0x9ef1('0x33')]),_0x3d7d4d);if(_0x2192ce[_0x9ef1('0x2b')]['filter']){_0x548271[_0x9ef1('0x34')]=_[_0x9ef1('0x35')](_0x548271[_0x9ef1('0x34')],{'$or':_['map'](_0x3d7d4d,function(_0x274467){if(_0x274467[_0x9ef1('0x29')]!==_0x9ef1('0x36')){var _0x5bd764={};_0x5bd764[_0x274467[_0x9ef1('0x24')]]={'$like':'%'+_0x2192ce['query']['filter']+'%'};return _0x5bd764;}})});}_0x548271=_[_0x9ef1('0x35')]({},_0x548271,_0x2192ce[_0x9ef1('0x37')]);var _0x131382={'where':_0x548271['where']};return db[_0x9ef1('0x38')][_0x9ef1('0x1c')](_0x131382)[_0x9ef1('0x22')](function(_0xa8e24c){_0x4f8a18[_0x9ef1('0x1c')]=_0xa8e24c;if(_0x2192ce[_0x9ef1('0x2b')][_0x9ef1('0x39')]){_0x548271[_0x9ef1('0x3a')]=[{'all':!![]}];}return db[_0x9ef1('0x38')][_0x9ef1('0x3b')](_0x548271);})[_0x9ef1('0x22')](function(_0x55c06d){_0x4f8a18[_0x9ef1('0x3c')]=_0x55c06d;return _0x4f8a18;})['then'](respondWithFilteredResult(_0x458198,_0x548271))[_0x9ef1('0x3d')](handleError(_0x458198,null));};exports[_0x9ef1('0x3e')]=function(_0x1f9627,_0x3ee730){var _0x48ccd9={'raw':!![],'where':{'id':_0x1f9627[_0x9ef1('0x3f')]['id']}},_0x380500={};_0x380500[_0x9ef1('0x2a')]=_[_0x9ef1('0x40')](db[_0x9ef1('0x38')][_0x9ef1('0x27')]);_0x380500[_0x9ef1('0x2b')]=_[_0x9ef1('0x40')](_0x1f9627['query']);_0x380500['filters']=_[_0x9ef1('0x2c')](_0x380500['model'],_0x380500['query']);_0x48ccd9['attributes']=_[_0x9ef1('0x2c')](_0x380500[_0x9ef1('0x2a')],qs[_0x9ef1('0x2e')](_0x1f9627[_0x9ef1('0x2b')][_0x9ef1('0x2e')]));_0x48ccd9['attributes']=_0x48ccd9['attributes'][_0x9ef1('0x41')]?_0x48ccd9[_0x9ef1('0x2d')]:_0x380500[_0x9ef1('0x2a')];if(_0x1f9627[_0x9ef1('0x2b')][_0x9ef1('0x39')]){_0x48ccd9[_0x9ef1('0x3a')]=[{'all':!![]}];}_0x48ccd9=_['merge']({},_0x48ccd9,_0x1f9627[_0x9ef1('0x37')]);return db[_0x9ef1('0x38')][_0x9ef1('0x42')](_0x48ccd9)['then'](handleEntityNotFound(_0x3ee730,null))[_0x9ef1('0x22')](respondWithResult(_0x3ee730,null))[_0x9ef1('0x3d')](handleError(_0x3ee730,null));};exports['create']=function(_0x1db844,_0x40036a){return db[_0x9ef1('0x38')]['create'](_0x1db844[_0x9ef1('0x43')],{})[_0x9ef1('0x22')](respondWithResult(_0x40036a,0xc9))[_0x9ef1('0x3d')](handleError(_0x40036a,null));};exports[_0x9ef1('0x44')]=function(_0x22e18d,_0x41d687){return db[_0x9ef1('0x38')][_0x9ef1('0x44')]()['then'](respondWithResult(_0x41d687,null))[_0x9ef1('0x3d')](handleError(_0x41d687,null));};exports[_0x9ef1('0x45')]=function(_0x5ad579,_0xd81e6b){if(_0x5ad579['body'][_0x9ef1('0x46')]){delete _0x5ad579['body'][_0x9ef1('0x46')];}return db[_0x9ef1('0x38')][_0x9ef1('0x42')]({'where':{'uniqueid':_0x5ad579[_0x9ef1('0x3f')]['id']}})[_0x9ef1('0x22')](handleEntityNotFound(_0xd81e6b,null))[_0x9ef1('0x22')](saveUpdates(_0x5ad579[_0x9ef1('0x43')],null))[_0x9ef1('0x22')](respondWithResult(_0xd81e6b,null))['catch'](handleError(_0xd81e6b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 8ebef9e..230b173 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 _0x7f59=['path','rimraf','../../config/environment','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x7f59,0x12e));var _0x97f5=function(_0xedc626,_0x24afc3){_0xedc626=_0xedc626-0x0;var _0x573455=_0x7f59[_0xedc626];return _0x573455;};'use strict';var _=require(_0x97f5('0x0'));var util=require(_0x97f5('0x1'));var logger=require('../../config/logger')(_0x97f5('0x2'));var moment=require(_0x97f5('0x3'));var BPromise=require(_0x97f5('0x4'));var rp=require(_0x97f5('0x5'));var fs=require('fs');var path=require(_0x97f5('0x6'));var rimraf=require(_0x97f5('0x7'));var config=require(_0x97f5('0x8'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x498110,_0x5d7027){return _0x498110[_0x97f5('0x9')](_0x97f5('0xa'),attributes,{'tableName':_0x97f5('0xb'),'paranoid':![],'indexes':[{'name':_0x97f5('0xc'),'fields':[_0x97f5('0xc')]},{'name':_0x97f5('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d14=['./cmHopperHistory.attributes','exports','cm_hopper_history','endtime','uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1a7535,_0x152458){var _0x328c13=function(_0x5b5cfa){while(--_0x5b5cfa){_0x1a7535['push'](_0x1a7535['shift']());}};_0x328c13(++_0x152458);}(_0x7d14,0x6d));var _0x47d1=function(_0x16dc7a,_0x37d015){_0x16dc7a=_0x16dc7a-0x0;var _0x4e61b0=_0x7d14[_0x16dc7a];return _0x4e61b0;};'use strict';var _=require(_0x47d1('0x0'));var util=require(_0x47d1('0x1'));var logger=require('../../config/logger')(_0x47d1('0x2'));var moment=require(_0x47d1('0x3'));var BPromise=require(_0x47d1('0x4'));var rp=require(_0x47d1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x47d1('0x6'));var config=require(_0x47d1('0x7'));var attributes=require(_0x47d1('0x8'));module[_0x47d1('0x9')]=function(_0x1b2f47,_0x550ee2){return _0x1b2f47['define']('CmHopperHistory',attributes,{'tableName':_0x47d1('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x47d1('0xb')]},{'name':_0x47d1('0xc'),'fields':[_0x47d1('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 ea323b4..5fe7e06 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 _0x7b37=['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','where','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateCmHopperHistory','CmHopperHistory','options','raw','catch','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','then','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null'];(function(_0x117e07,_0xbc8c5d){var _0x1e1ea3=function(_0x3f5a1e){while(--_0x3f5a1e){_0x117e07['push'](_0x117e07['shift']());}};_0x1e1ea3(++_0xbc8c5d);}(_0x7b37,0xd9));var _0x77b3=function(_0x40a107,_0x5acc82){_0x40a107=_0x40a107-0x0;var _0x4beb59=_0x7b37[_0x40a107];return _0x4beb59;};'use strict';var _=require(_0x77b3('0x0'));var util=require(_0x77b3('0x1'));var moment=require('moment');var BPromise=require(_0x77b3('0x2'));var rs=require(_0x77b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77b3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77b3('0x5'))(_0x77b3('0x6'));var config=require(_0x77b3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x77b3('0x8')][_0x77b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x515f06,_0x49aded,_0x2f896b){return new BPromise(function(_0x5b3fb4,_0x35becb){return client[_0x77b3('0xa')](_0x515f06,_0x2f896b)['then'](function(_0x46dc45){logger[_0x77b3('0xb')](_0x77b3('0xc'),_0x49aded,_0x77b3('0xd'));logger[_0x77b3('0xe')](_0x77b3('0xf'),_0x49aded,_0x77b3('0xd'),JSON[_0x77b3('0x10')](_0x46dc45));if(_0x46dc45[_0x77b3('0x11')]){if(_0x46dc45[_0x77b3('0x11')]['code']===0x1f4){logger[_0x77b3('0x11')](_0x77b3('0xc'),_0x49aded,_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);return _0x35becb(_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);}logger[_0x77b3('0x11')](_0x77b3('0xc'),_0x49aded,_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);return _0x5b3fb4(_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);}else{logger['info'](_0x77b3('0xc'),_0x49aded,_0x77b3('0xd'));_0x5b3fb4(_0x46dc45[_0x77b3('0x13')][_0x77b3('0x12')]);}})['catch'](function(_0x224303){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x49aded,_0x224303);_0x35becb(_0x224303);});});}exports[_0x77b3('0x14')]=function(_0x32bf27){var _0x16e1fd=this;return new Promise(function(_0x4499e8,_0x52d3ea){return db[_0x77b3('0x15')]['create'](_0x32bf27['body'],{'raw':_0x32bf27[_0x77b3('0x16')]?_0x32bf27[_0x77b3('0x16')][_0x77b3('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x95b5fc){logger[_0x77b3('0xb')](_0x77b3('0x14'),_0x32bf27);logger[_0x77b3('0xe')](_0x77b3('0x14'),_0x32bf27,JSON[_0x77b3('0x10')](_0x95b5fc));_0x4499e8(_0x95b5fc);})[_0x77b3('0x18')](function(_0x17d739){logger[_0x77b3('0x11')](_0x77b3('0x14'),_0x17d739['message'],_0x32bf27);_0x52d3ea(_0x16e1fd[_0x77b3('0x11')](0x1f4,_0x17d739['message']));});});};exports[_0x77b3('0x19')]=function(_0x54dcd7){var _0x297e68=this;return new Promise(function(_0x21d3df,_0x37de70){return db[_0x77b3('0x15')][_0x77b3('0x1a')]({'raw':_0x54dcd7['options']?_0x54dcd7['options'][_0x77b3('0x17')]===undefined?!![]:![]:!![],'where':_0x54dcd7[_0x77b3('0x16')]?_0x54dcd7[_0x77b3('0x16')]['where']||null:null,'attributes':[[db[_0x77b3('0x1b')]['fn'](_0x77b3('0x1c'),db[_0x77b3('0x1b')][_0x77b3('0x1d')]('id')),_0x77b3('0x1e')],[db[_0x77b3('0x1b')]['fn']('COUNT',db[_0x77b3('0x1b')]['fn']('IF',db[_0x77b3('0x1b')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x77b3('0x1f')],[db[_0x77b3('0x1b')]['fn'](_0x77b3('0x1c'),db[_0x77b3('0x1b')]['fn']('IF',db[_0x77b3('0x1b')][_0x77b3('0x20')](_0x77b3('0x21')))),_0x77b3('0x22')],[db[_0x77b3('0x1b')]['fn'](_0x77b3('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0x77b3('0x20')](_0x77b3('0x23')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x77b3('0x1b')]['fn'](_0x77b3('0x24'),db[_0x77b3('0x1b')]['fn']('IF',db[_0x77b3('0x1b')]['literal'](_0x77b3('0x25')))),_0x77b3('0x26')],[db[_0x77b3('0x1b')]['fn'](_0x77b3('0x24'),db[_0x77b3('0x1b')]['fn']('IF',db[_0x77b3('0x1b')][_0x77b3('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0x77b3('0x27')](function(_0x5ed77f){logger['info']('AvgHandleTime',_0x54dcd7);logger[_0x77b3('0xe')](_0x77b3('0x19'),_0x54dcd7,JSON[_0x77b3('0x10')](_0x5ed77f));_0x21d3df(_0x5ed77f);})[_0x77b3('0x18')](function(_0x598077){logger[_0x77b3('0x11')](_0x77b3('0x19'),_0x598077[_0x77b3('0x12')],_0x54dcd7);_0x37de70(_0x297e68[_0x77b3('0x11')](0x1f4,_0x598077['message']));});});};exports[_0x77b3('0x28')]=function(_0x22b6bf){var _0x5ad785=this;return new Promise(function(_0x50ec81,_0x3ba5c6){return db[_0x77b3('0x15')]['findAll']({'raw':_0x22b6bf[_0x77b3('0x16')]?_0x22b6bf['options'][_0x77b3('0x17')]===undefined?!![]:![]:!![],'where':_0x22b6bf[_0x77b3('0x16')]?_0x22b6bf[_0x77b3('0x16')]['where']||null:null,'attributes':[[_0x77b3('0x29'),_0x77b3('0x2a')],[db[_0x77b3('0x1b')]['fn'](_0x77b3('0x1c'),db['sequelize']['fn']('IF',db[_0x77b3('0x1b')][_0x77b3('0x20')]('`state`\x20=\x200,\x201,\x20null'))),_0x77b3('0x2b')],[db['sequelize']['fn'](_0x77b3('0x1c'),db[_0x77b3('0x1b')]['fn']('IF',db[_0x77b3('0x1b')][_0x77b3('0x20')](_0x77b3('0x2c')))),_0x77b3('0x2d')],[db['sequelize']['fn'](_0x77b3('0x1c'),db[_0x77b3('0x1b')]['fn']('IF',db[_0x77b3('0x1b')][_0x77b3('0x20')](_0x77b3('0x2e')))),_0x77b3('0x2f')],[db['sequelize']['fn'](_0x77b3('0x1c'),db[_0x77b3('0x1b')]['fn']('IF',db[_0x77b3('0x1b')]['literal'](_0x77b3('0x30')))),'outboundBusyCallsDay'],[db[_0x77b3('0x1b')]['fn']('COUNT',db[_0x77b3('0x1b')]['fn']('IF',db[_0x77b3('0x1b')][_0x77b3('0x20')](_0x77b3('0x31')))),'outboundCongestionCallsDay'],[db[_0x77b3('0x1b')]['fn'](_0x77b3('0x1c'),db[_0x77b3('0x1b')]['fn']('IF',db[_0x77b3('0x1b')]['literal'](_0x77b3('0x32')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0x77b3('0x1c'),db[_0x77b3('0x1b')]['fn']('IF',db[_0x77b3('0x1b')][_0x77b3('0x20')](_0x77b3('0x33')))),_0x77b3('0x34')],[db[_0x77b3('0x1b')]['fn'](_0x77b3('0x1c'),db['sequelize']['fn']('IF',db[_0x77b3('0x1b')][_0x77b3('0x20')](_0x77b3('0x35')))),'outboundUnknownCallsDay'],[db[_0x77b3('0x1b')]['fn'](_0x77b3('0x1c'),db[_0x77b3('0x1b')]['fn']('IF',db[_0x77b3('0x1b')][_0x77b3('0x20')](_0x77b3('0x36')))),_0x77b3('0x37')],[db[_0x77b3('0x1b')]['fn'](_0x77b3('0x1c'),db[_0x77b3('0x1b')]['fn']('IF',db[_0x77b3('0x1b')][_0x77b3('0x20')](_0x77b3('0x38')))),_0x77b3('0x39')],[db[_0x77b3('0x1b')]['fn'](_0x77b3('0x1c'),db['sequelize']['fn']('IF',db[_0x77b3('0x1b')][_0x77b3('0x20')](_0x77b3('0x3a')))),_0x77b3('0x3b')],[db[_0x77b3('0x1b')]['fn'](_0x77b3('0x1c'),db[_0x77b3('0x1b')]['fn']('IF',db[_0x77b3('0x1b')]['literal'](_0x77b3('0x3c')))),_0x77b3('0x3d')],[db[_0x77b3('0x1b')]['fn'](_0x77b3('0x1c'),db[_0x77b3('0x1b')]['fn']('IF',db[_0x77b3('0x1b')][_0x77b3('0x20')](_0x77b3('0x3e')))),_0x77b3('0x3b')],[db[_0x77b3('0x1b')]['fn'](_0x77b3('0x1c'),db[_0x77b3('0x1b')]['fn']('IF',db[_0x77b3('0x1b')][_0x77b3('0x20')](_0x77b3('0x3f')))),_0x77b3('0x40')]],'group':['campaign']})['then'](function(_0x142aff){logger[_0x77b3('0xb')](_0x77b3('0x28'),_0x22b6bf);logger[_0x77b3('0xe')](_0x77b3('0x28'),_0x22b6bf,JSON[_0x77b3('0x10')](_0x142aff));_0x50ec81(_0x142aff);})['catch'](function(_0x11ec26){logger[_0x77b3('0x11')](_0x77b3('0x28'),_0x11ec26['message'],_0x22b6bf);_0x3ba5c6(_0x5ad785[_0x77b3('0x11')](0x1f4,_0x11ec26[_0x77b3('0x12')]));});});};exports[_0x77b3('0x41')]=function(_0x1310fc){var _0x3dd7b9=this;return new Promise(function(_0x51ad97,_0x1750c3){return db[_0x77b3('0x15')][_0x77b3('0x1a')]({'raw':_0x1310fc[_0x77b3('0x16')]?_0x1310fc[_0x77b3('0x16')][_0x77b3('0x17')]===undefined?!![]:![]:!![],'where':_0x1310fc[_0x77b3('0x16')]?_0x1310fc[_0x77b3('0x16')][_0x77b3('0x42')]||null:null,'attributes':[[_0x77b3('0x29'),_0x77b3('0x2a')],[db[_0x77b3('0x1b')]['fn'](_0x77b3('0x1c'),db[_0x77b3('0x1b')]['col']('id')),'ivrTotalCallsDays'],[db[_0x77b3('0x1b')]['fn'](_0x77b3('0x1c'),db[_0x77b3('0x1b')]['fn']('IF',db[_0x77b3('0x1b')][_0x77b3('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x77b3('0x43')]],'group':['campaign']})[_0x77b3('0x27')](function(_0x56fdd7){logger[_0x77b3('0xb')](_0x77b3('0x41'),_0x1310fc);logger[_0x77b3('0xe')](_0x77b3('0x41'),_0x1310fc,JSON[_0x77b3('0x10')](_0x56fdd7));_0x51ad97(_0x56fdd7);})[_0x77b3('0x18')](function(_0x1a3fc0){logger[_0x77b3('0x11')](_0x77b3('0x41'),_0x1a3fc0['message'],_0x1310fc);_0x1750c3(_0x3dd7b9['error'](0x1f4,_0x1a3fc0[_0x77b3('0x12')]));});});}; \ No newline at end of file +var _0x750a=['CmHopperHistory','findAll','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','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','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','catch','body','options','then','AvgHandleTime'];(function(_0x24e3e1,_0xe4e770){var _0x380e65=function(_0x4ab081){while(--_0x4ab081){_0x24e3e1['push'](_0x24e3e1['shift']());}};_0x380e65(++_0xe4e770);}(_0x750a,0x140));var _0xa750=function(_0x4d7f97,_0x46a6b6){_0x4d7f97=_0x4d7f97-0x0;var _0x3baeab=_0x750a[_0x4d7f97];return _0x3baeab;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});}exports['CreateCmHopperHistory']=function(_0x433dbd){var _0x1bde87=this;return new Promise(function(_0x4f1faa,_0x36dcca){return db['CmHopperHistory']['create'](_0x433dbd[_0xa750('0x15')],{'raw':_0x433dbd['options']?_0x433dbd[_0xa750('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xa750('0x17')](function(_0x4a007d){logger[_0xa750('0xc')]('CreateCmHopperHistory',_0x433dbd);logger[_0xa750('0xe')]('CreateCmHopperHistory',_0x433dbd,JSON['stringify'](_0x4a007d));_0x4f1faa(_0x4a007d);})[_0xa750('0x14')](function(_0x52da84){logger[_0xa750('0x10')]('CreateCmHopperHistory',_0x52da84['message'],_0x433dbd);_0x36dcca(_0x1bde87['error'](0x1f4,_0x52da84['message']));});});};exports[_0xa750('0x18')]=function(_0x2ec6c4){var _0x2c43ef=this;return new Promise(function(_0x384d48,_0x1b80a5){return db[_0xa750('0x19')][_0xa750('0x1a')]({'raw':_0x2ec6c4[_0xa750('0x16')]?_0x2ec6c4[_0xa750('0x16')][_0xa750('0x1b')]===undefined?!![]:![]:!![],'where':_0x2ec6c4[_0xa750('0x16')]?_0x2ec6c4[_0xa750('0x16')][_0xa750('0x1c')]||null:null,'attributes':[[db[_0xa750('0x1d')]['fn'](_0xa750('0x1e'),db['sequelize'][_0xa750('0x1f')]('id')),_0xa750('0x20')],[db[_0xa750('0x1d')]['fn']('COUNT',db[_0xa750('0x1d')]['fn']('IF',db[_0xa750('0x1d')][_0xa750('0x21')](_0xa750('0x22')))),'predictiveIntervalAnsweredCalls'],[db[_0xa750('0x1d')]['fn'](_0xa750('0x1e'),db[_0xa750('0x1d')]['fn']('IF',db[_0xa750('0x1d')][_0xa750('0x21')]('`state`\x20=\x2010,\x201,\x20null'))),_0xa750('0x23')],[db['sequelize']['fn'](_0xa750('0x1e'),db[_0xa750('0x1d')]['fn']('IF',db['sequelize'][_0xa750('0x21')](_0xa750('0x24')))),_0xa750('0x25')],[db[_0xa750('0x1d')]['fn'](_0xa750('0x26'),db[_0xa750('0x1d')]['fn']('IF',db[_0xa750('0x1d')][_0xa750('0x21')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xa750('0x27')],[db['sequelize']['fn'](_0xa750('0x26'),db[_0xa750('0x1d')]['fn']('IF',db[_0xa750('0x1d')][_0xa750('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xa750('0x28')]]})[_0xa750('0x17')](function(_0x5c2e02){logger[_0xa750('0xc')](_0xa750('0x18'),_0x2ec6c4);logger[_0xa750('0xe')](_0xa750('0x18'),_0x2ec6c4,JSON['stringify'](_0x5c2e02));_0x384d48(_0x5c2e02);})[_0xa750('0x14')](function(_0x5a0bbd){logger['error'](_0xa750('0x18'),_0x5a0bbd[_0xa750('0x13')],_0x2ec6c4);_0x1b80a5(_0x2c43ef[_0xa750('0x10')](0x1f4,_0x5a0bbd['message']));});});};exports[_0xa750('0x29')]=function(_0x28603e){var _0x181d77=this;return new Promise(function(_0x53ad23,_0x37abd2){return db[_0xa750('0x19')][_0xa750('0x1a')]({'raw':_0x28603e['options']?_0x28603e[_0xa750('0x16')][_0xa750('0x1b')]===undefined?!![]:![]:!![],'where':_0x28603e[_0xa750('0x16')]?_0x28603e['options'][_0xa750('0x1c')]||null:null,'attributes':[[_0xa750('0x2a'),_0xa750('0x2b')],[db[_0xa750('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa750('0x1d')][_0xa750('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0xa750('0x2c')],[db[_0xa750('0x1d')]['fn'](_0xa750('0x1e'),db[_0xa750('0x1d')]['fn']('IF',db[_0xa750('0x1d')]['literal'](_0xa750('0x2d')))),_0xa750('0x2e')],[db[_0xa750('0x1d')]['fn'](_0xa750('0x1e'),db[_0xa750('0x1d')]['fn']('IF',db[_0xa750('0x1d')][_0xa750('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0xa750('0x2f')],[db['sequelize']['fn'](_0xa750('0x1e'),db['sequelize']['fn']('IF',db[_0xa750('0x1d')][_0xa750('0x21')](_0xa750('0x30')))),_0xa750('0x31')],[db[_0xa750('0x1d')]['fn'](_0xa750('0x1e'),db[_0xa750('0x1d')]['fn']('IF',db[_0xa750('0x1d')][_0xa750('0x21')](_0xa750('0x32')))),_0xa750('0x33')],[db[_0xa750('0x1d')]['fn'](_0xa750('0x1e'),db[_0xa750('0x1d')]['fn']('IF',db[_0xa750('0x1d')][_0xa750('0x21')](_0xa750('0x34')))),_0xa750('0x35')],[db[_0xa750('0x1d')]['fn'](_0xa750('0x1e'),db['sequelize']['fn']('IF',db[_0xa750('0x1d')][_0xa750('0x21')](_0xa750('0x36')))),_0xa750('0x37')],[db[_0xa750('0x1d')]['fn'](_0xa750('0x1e'),db[_0xa750('0x1d')]['fn']('IF',db[_0xa750('0x1d')][_0xa750('0x21')]('`state`\x20=\x2012,\x201,\x20null'))),_0xa750('0x38')],[db[_0xa750('0x1d')]['fn']('COUNT',db[_0xa750('0x1d')]['fn']('IF',db[_0xa750('0x1d')][_0xa750('0x21')](_0xa750('0x39')))),_0xa750('0x3a')],[db[_0xa750('0x1d')]['fn'](_0xa750('0x1e'),db[_0xa750('0x1d')]['fn']('IF',db[_0xa750('0x1d')][_0xa750('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),_0xa750('0x3b')],[db[_0xa750('0x1d')]['fn']('COUNT',db[_0xa750('0x1d')]['fn']('IF',db[_0xa750('0x1d')][_0xa750('0x21')]('`state`\x20=\x2018,\x201,\x20null'))),_0xa750('0x3c')],[db[_0xa750('0x1d')]['fn'](_0xa750('0x1e'),db[_0xa750('0x1d')]['fn']('IF',db['sequelize'][_0xa750('0x21')](_0xa750('0x3d')))),_0xa750('0x3e')],[db[_0xa750('0x1d')]['fn']('COUNT',db[_0xa750('0x1d')]['fn']('IF',db[_0xa750('0x1d')]['literal'](_0xa750('0x3f')))),'outboundRejectCallsDay'],[db[_0xa750('0x1d')]['fn'](_0xa750('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xa750('0x40')))),_0xa750('0x41')]],'group':['campaign']})[_0xa750('0x17')](function(_0x1a79a9){logger[_0xa750('0xc')]('GetVoiceQueueHopperHistory',_0x28603e);logger['debug']('GetVoiceQueueHopperHistory',_0x28603e,JSON['stringify'](_0x1a79a9));_0x53ad23(_0x1a79a9);})[_0xa750('0x14')](function(_0x4a1b5d){logger[_0xa750('0x10')](_0xa750('0x29'),_0x4a1b5d['message'],_0x28603e);_0x37abd2(_0x181d77[_0xa750('0x10')](0x1f4,_0x4a1b5d['message']));});});};exports[_0xa750('0x42')]=function(_0x53c0a9){var _0x54788d=this;return new Promise(function(_0x5940be,_0x495457){return db[_0xa750('0x19')][_0xa750('0x1a')]({'raw':_0x53c0a9['options']?_0x53c0a9['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c0a9[_0xa750('0x16')]?_0x53c0a9[_0xa750('0x16')][_0xa750('0x1c')]||null:null,'attributes':[[_0xa750('0x2a'),_0xa750('0x2b')],[db[_0xa750('0x1d')]['fn']('COUNT',db['sequelize'][_0xa750('0x1f')]('id')),_0xa750('0x43')],[db[_0xa750('0x1d')]['fn'](_0xa750('0x1e'),db[_0xa750('0x1d')]['fn']('IF',db['sequelize'][_0xa750('0x21')](_0xa750('0x22')))),_0xa750('0x44')]],'group':[_0xa750('0x2a')]})[_0xa750('0x17')](function(_0x2ec84f){logger[_0xa750('0xc')](_0xa750('0x42'),_0x53c0a9);logger['debug'](_0xa750('0x42'),_0x53c0a9,JSON[_0xa750('0xf')](_0x2ec84f));_0x5940be(_0x2ec84f);})[_0xa750('0x14')](function(_0x1f03e2){logger[_0xa750('0x10')]('GetCampaignHopperHistory',_0x1f03e2[_0xa750('0x13')],_0x53c0a9);_0x495457(_0x54788d[_0xa750('0x10')](0x1f4,_0x1f03e2[_0xa750('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 4ff021a..1195479 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 _0x0cdc=['express','Router','fs-extra','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','exports','util','path','connect-timeout'];(function(_0x367de9,_0x4bd325){var _0x2ceb12=function(_0x2f38a3){while(--_0x2f38a3){_0x367de9['push'](_0x367de9['shift']());}};_0x2ceb12(++_0x4bd325);}(_0x0cdc,0x1b2));var _0xc0cd=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x0cdc[_0xd09668];return _0x68726;};'use strict';var multer=require('multer');var util=require(_0xc0cd('0x0'));var path=require(_0xc0cd('0x1'));var timeout=require(_0xc0cd('0x2'));var express=require(_0xc0cd('0x3'));var router=express[_0xc0cd('0x4')]();var fs_extra=require(_0xc0cd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc0cd('0x6'));var config=require('../../config/environment');var controller=require(_0xc0cd('0x7'));router[_0xc0cd('0x8')]('/',auth[_0xc0cd('0x9')](),controller['index']);router[_0xc0cd('0x8')](_0xc0cd('0xa'),auth[_0xc0cd('0x9')](),controller[_0xc0cd('0xb')]);router['get'](_0xc0cd('0xc'),auth[_0xc0cd('0x9')](),controller[_0xc0cd('0xd')]);router[_0xc0cd('0xe')]('/',auth[_0xc0cd('0x9')](),controller[_0xc0cd('0xf')]);router[_0xc0cd('0x10')]('/:id',auth[_0xc0cd('0x9')](),controller[_0xc0cd('0x11')]);module[_0xc0cd('0x12')]=router; \ No newline at end of file +var _0x31f4=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0x31f4,0x1bb));var _0x431f=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0x31f4[_0x41c381];return _0x427981;};'use strict';var multer=require(_0x431f('0x0'));var util=require(_0x431f('0x1'));var path=require(_0x431f('0x2'));var timeout=require('connect-timeout');var express=require(_0x431f('0x3'));var router=express[_0x431f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x431f('0x5'));var interaction=require(_0x431f('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0x431f('0x7')]('/',auth[_0x431f('0x8')](),controller['index']);router['get']('/describe',auth[_0x431f('0x8')](),controller[_0x431f('0x9')]);router[_0x431f('0x7')](_0x431f('0xa'),auth[_0x431f('0x8')](),controller[_0x431f('0xb')]);router[_0x431f('0xc')]('/',auth['isAuthenticated'](),controller[_0x431f('0xd')]);router[_0x431f('0xe')](_0x431f('0xa'),auth[_0x431f('0x8')](),controller[_0x431f('0xf')]);module[_0x431f('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 02d3048..1b5e70b 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 _0xbeea=['sequelize','STRING','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbeea,0xb1));var _0xabee=function(_0x4f9ef1,_0x3cead7){_0x4f9ef1=_0x4f9ef1-0x0;var _0x3d3573=_0xbeea[_0x4f9ef1];return _0x3d3573;};'use strict';var Sequelize=require(_0xabee('0x0'));module['exports']={'name':{'type':Sequelize[_0xabee('0x1')],'unique':_0xabee('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xabee('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeb0d=['sequelize','STRING'];(function(_0xddcb3c,_0x188628){var _0xf39702=function(_0x4a6f61){while(--_0x4a6f61){_0xddcb3c['push'](_0xddcb3c['shift']());}};_0xf39702(++_0x188628);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x2d8bec,_0x25b304){_0x2d8bec=_0x2d8bec-0x0;var _0x3cc608=_0xeb0d[_0x2d8bec];return _0x3cc608;};'use strict';var Sequelize=require(_0xdeb0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdeb0('0x1')]},'dialPrefix':{'type':Sequelize[_0xdeb0('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 6ac3ef7..7227bf9 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 _0xa6fa=['defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','get','Lists','UserProfileResource','name','index','map','CmList','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','length','includeAll','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','addDisposition','ListId','Disposition','nolimit','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','each','omit','success','push','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','customField_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis'];(function(_0x55cf89,_0x23be1e){var _0x37bb01=function(_0x29e66f){while(--_0x29e66f){_0x55cf89['push'](_0x55cf89['shift']());}};_0x37bb01(++_0x23be1e);}(_0xa6fa,0x8d));var _0xaa6f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa6fa[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xaa6f('0x0'));var rimraf=require(_0xaa6f('0x1'));var zipdir=require(_0xaa6f('0x2'));var jsonpatch=require(_0xaa6f('0x3'));var rp=require('request-promise');var moment=require(_0xaa6f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaa6f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xaa6f('0x6'));var ejs=require(_0xaa6f('0x7'));var fs=require('fs');var fs_extra=require(_0xaa6f('0x8'));var _=require('lodash');var squel=require(_0xaa6f('0x9'));var crypto=require(_0xaa6f('0xa'));var jsforce=require(_0xaa6f('0xb'));var deskjs=require(_0xaa6f('0xc'));var toCsv=require(_0xaa6f('0x6'));var querystring=require('querystring');var Papa=require(_0xaa6f('0xd'));var Redis=require(_0xaa6f('0xe'));var authService=require(_0xaa6f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xaa6f('0x10'));var hardwareService=require(_0xaa6f('0x11'));var logger=require('../../config/logger')(_0xaa6f('0x12'));var utils=require('../../config/utils');var config=require(_0xaa6f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa6f('0x14'))['db'];var csv_results;config[_0xaa6f('0x15')]=_[_0xaa6f('0x16')](config[_0xaa6f('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa6f('0x17'))(new Redis(config['redis']));require(_0xaa6f('0x18'))[_0xaa6f('0x19')](socket);function respondWithStatusCode(_0x22074a,_0x2f2ac0){_0x2f2ac0=_0x2f2ac0||0xcc;return function(_0x5a0f67){if(_0x5a0f67){return _0x22074a[_0xaa6f('0x1a')](_0x2f2ac0);}return _0x22074a[_0xaa6f('0x1b')](_0x2f2ac0)[_0xaa6f('0x1c')]();};}function respondWithResult(_0x25824f,_0x9b033c){_0x9b033c=_0x9b033c||0xc8;return function(_0x77c1b9){if(_0x77c1b9){return _0x25824f[_0xaa6f('0x1b')](_0x9b033c)[_0xaa6f('0x1d')](_0x77c1b9);}};}function respondWithFilteredResult(_0x20e5d1,_0x28efbf){return function(_0x1cca70){if(_0x1cca70){var _0x1a1320=typeof _0x28efbf[_0xaa6f('0x1e')]===_0xaa6f('0x1f')&&typeof _0x28efbf[_0xaa6f('0x20')]===_0xaa6f('0x1f');var _0x5352e3=_0x1cca70['count'];var _0x5c6eae=_0x1a1320?0x0:_0x28efbf[_0xaa6f('0x1e')];var _0xafd087=_0x1a1320?_0x1cca70[_0xaa6f('0x21')]:_0x28efbf[_0xaa6f('0x1e')]+_0x28efbf[_0xaa6f('0x20')];var _0x51bbcb;if(_0xafd087>=_0x5352e3){_0xafd087=_0x5352e3;_0x51bbcb=0xc8;}else{_0x51bbcb=0xce;}_0x20e5d1[_0xaa6f('0x1b')](_0x51bbcb);return _0x20e5d1['set'](_0xaa6f('0x22'),_0x5c6eae+'-'+_0xafd087+'/'+_0x5352e3)[_0xaa6f('0x1d')](_0x1cca70);}return null;};}function patchUpdates(_0x3a73bc){return function(_0x5cbfe2){try{jsonpatch['apply'](_0x5cbfe2,_0x3a73bc,!![]);}catch(_0x520435){return BPromise[_0xaa6f('0x23')](_0x520435);}return _0x5cbfe2[_0xaa6f('0x24')]();};}function saveUpdates(_0x2367cf,_0x502a0d){return function(_0x40f6a4){if(_0x40f6a4){return _0x40f6a4[_0xaa6f('0x25')](_0x2367cf)[_0xaa6f('0x26')](function(_0x3b02ad){return _0x3b02ad;});}return null;};}function removeEntity(_0x5ccaa2,_0x49f5eb){return function(_0x555aa7){if(_0x555aa7){return _0x555aa7['destroy']()['then'](function(){var _0x49f6a7=_0x555aa7[_0xaa6f('0x27')]({'plain':!![]});var _0x1e1834=_0xaa6f('0x28');return db[_0xaa6f('0x29')]['destroy']({'where':{'type':_0x1e1834,'resourceId':_0x49f6a7['id']}})[_0xaa6f('0x26')](function(){return _0x555aa7;});})['then'](function(){_0x5ccaa2[_0xaa6f('0x1b')](0xcc)[_0xaa6f('0x1c')]();});}};}function handleEntityNotFound(_0x215d0f,_0xae7914){return function(_0x30374e){if(!_0x30374e){_0x215d0f[_0xaa6f('0x1a')](0x194);}return _0x30374e;};}function handleError(_0x5222fb,_0x3e54a5){_0x3e54a5=_0x3e54a5||0x1f4;return function(_0x45a85f){logger['error'](_0x45a85f['stack']);if(_0x45a85f[_0xaa6f('0x2a')]){delete _0x45a85f['name'];}_0x5222fb['status'](_0x3e54a5)['send'](_0x45a85f);};}exports[_0xaa6f('0x2b')]=function(_0x80e031,_0xeae5f8){var _0x5a4a60={},_0x13d789={},_0x1ebaaa={'count':0x0,'rows':[]};var _0x4f2a8d=_[_0xaa6f('0x2c')](db[_0xaa6f('0x2d')][_0xaa6f('0x2e')],function(_0x22a63b){return{'name':_0x22a63b[_0xaa6f('0x2f')],'type':_0x22a63b[_0xaa6f('0x30')][_0xaa6f('0x31')]};});_0x13d789['model']=_[_0xaa6f('0x2c')](_0x4f2a8d,_0xaa6f('0x2a'));_0x13d789[_0xaa6f('0x32')]=_[_0xaa6f('0x33')](_0x80e031[_0xaa6f('0x32')]);_0x13d789[_0xaa6f('0x34')]=_[_0xaa6f('0x35')](_0x13d789[_0xaa6f('0x36')],_0x13d789[_0xaa6f('0x32')]);_0x5a4a60[_0xaa6f('0x37')]=_[_0xaa6f('0x35')](_0x13d789[_0xaa6f('0x36')],qs[_0xaa6f('0x38')](_0x80e031['query']['fields']));_0x5a4a60[_0xaa6f('0x37')]=_0x5a4a60[_0xaa6f('0x37')]['length']?_0x5a4a60[_0xaa6f('0x37')]:_0x13d789[_0xaa6f('0x36')];if(!_0x80e031[_0xaa6f('0x32')][_0xaa6f('0x39')]('nolimit')){_0x5a4a60[_0xaa6f('0x20')]=qs[_0xaa6f('0x20')](_0x80e031[_0xaa6f('0x32')][_0xaa6f('0x20')]);_0x5a4a60['offset']=qs[_0xaa6f('0x1e')](_0x80e031[_0xaa6f('0x32')][_0xaa6f('0x1e')]);}_0x5a4a60[_0xaa6f('0x3a')]=qs[_0xaa6f('0x3b')](_0x80e031[_0xaa6f('0x32')][_0xaa6f('0x3b')]);_0x5a4a60[_0xaa6f('0x3c')]=qs['filters'](_[_0xaa6f('0x3d')](_0x80e031[_0xaa6f('0x32')],_0x13d789[_0xaa6f('0x34')]),_0x4f2a8d);if(_0x80e031[_0xaa6f('0x32')]['filter']){_0x5a4a60[_0xaa6f('0x3c')]=_[_0xaa6f('0x3e')](_0x5a4a60[_0xaa6f('0x3c')],{'$or':_[_0xaa6f('0x2c')](_0x4f2a8d,function(_0xa252e2){if(_0xa252e2['type']!==_0xaa6f('0x3f')){var _0x51fbdb={};_0x51fbdb[_0xa252e2[_0xaa6f('0x2a')]]={'$like':'%'+_0x80e031[_0xaa6f('0x32')][_0xaa6f('0x40')]+'%'};return _0x51fbdb;}})});}_0x5a4a60=_[_0xaa6f('0x3e')]({},_0x5a4a60,_0x80e031['options']);var _0x5426a3={'where':_0x5a4a60[_0xaa6f('0x3c')]};return db[_0xaa6f('0x2d')][_0xaa6f('0x21')](_0x5426a3)[_0xaa6f('0x26')](function(_0x189d85){_0x1ebaaa[_0xaa6f('0x21')]=_0x189d85;if(_0x80e031[_0xaa6f('0x32')]['includeAll']){_0x5a4a60[_0xaa6f('0x41')]=[{'all':!![]}];}return db[_0xaa6f('0x2d')][_0xaa6f('0x42')](_0x5a4a60);})[_0xaa6f('0x26')](function(_0x236462){_0x1ebaaa[_0xaa6f('0x43')]=_0x236462;return _0x1ebaaa;})[_0xaa6f('0x26')](respondWithFilteredResult(_0xeae5f8,_0x5a4a60))[_0xaa6f('0x44')](handleError(_0xeae5f8,null));};exports[_0xaa6f('0x45')]=function(_0x5942e8,_0x4cc000){var _0x4942d3={'raw':![],'where':{'id':_0x5942e8[_0xaa6f('0x46')]['id']}},_0x933d6d={};_0x933d6d['model']=_[_0xaa6f('0x33')](db[_0xaa6f('0x2d')][_0xaa6f('0x2e')]);_0x933d6d[_0xaa6f('0x32')]=_[_0xaa6f('0x33')](_0x5942e8[_0xaa6f('0x32')]);_0x933d6d[_0xaa6f('0x34')]=_[_0xaa6f('0x35')](_0x933d6d[_0xaa6f('0x36')],_0x933d6d['query']);_0x4942d3[_0xaa6f('0x37')]=_[_0xaa6f('0x35')](_0x933d6d['model'],qs[_0xaa6f('0x38')](_0x5942e8['query'][_0xaa6f('0x38')]));_0x4942d3[_0xaa6f('0x37')]=_0x4942d3['attributes'][_0xaa6f('0x47')]?_0x4942d3[_0xaa6f('0x37')]:_0x933d6d['model'];if(_0x5942e8[_0xaa6f('0x32')][_0xaa6f('0x48')]){_0x4942d3[_0xaa6f('0x41')]=[{'all':!![]}];}_0x4942d3=_['merge']({},_0x4942d3,_0x5942e8[_0xaa6f('0x49')]);return db[_0xaa6f('0x2d')][_0xaa6f('0x4a')](_0x4942d3)[_0xaa6f('0x26')](handleEntityNotFound(_0x4cc000,null))[_0xaa6f('0x26')](respondWithResult(_0x4cc000,null))[_0xaa6f('0x44')](handleError(_0x4cc000,null));};exports[_0xaa6f('0x4b')]=function(_0x181fbe,_0x98aec0){return db[_0xaa6f('0x2d')][_0xaa6f('0x4b')](_0x181fbe['body'],{})[_0xaa6f('0x26')](function(_0x566f73){var _0x2b62f5=_0x181fbe[_0xaa6f('0x4c')][_0xaa6f('0x27')]({'plain':!![]});if(!_0x2b62f5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b62f5[_0xaa6f('0x4d')]===_0xaa6f('0x4c')){var _0x294f95=_0x566f73[_0xaa6f('0x27')]({'plain':!![]});var _0x4650bb=_0xaa6f('0x28');return db[_0xaa6f('0x4e')][_0xaa6f('0x4a')]({'where':{'name':_0x4650bb,'userProfileId':_0x2b62f5[_0xaa6f('0x4f')]},'raw':!![]})[_0xaa6f('0x26')](function(_0x22f001){if(_0x22f001&&_0x22f001[_0xaa6f('0x50')]===0x0){return db[_0xaa6f('0x29')]['create']({'name':_0x294f95['name'],'resourceId':_0x294f95['id'],'type':_0x22f001[_0xaa6f('0x2a')],'sectionId':_0x22f001['id']},{})[_0xaa6f('0x26')](function(){return _0x566f73;});}else{return _0x566f73;}})[_0xaa6f('0x44')](function(_0x45aa5e){logger[_0xaa6f('0x51')](_0xaa6f('0x52'),_0x45aa5e);throw _0x45aa5e;});}return _0x566f73;})[_0xaa6f('0x26')](respondWithResult(_0x98aec0,0xc9))[_0xaa6f('0x44')](handleError(_0x98aec0,null));};exports[_0xaa6f('0x25')]=function(_0x5e384b,_0x20547e){if(_0x5e384b[_0xaa6f('0x53')]['id']){delete _0x5e384b[_0xaa6f('0x53')]['id'];}return db[_0xaa6f('0x2d')][_0xaa6f('0x4a')]({'where':{'id':_0x5e384b[_0xaa6f('0x46')]['id']}})[_0xaa6f('0x26')](handleEntityNotFound(_0x20547e,null))['then'](saveUpdates(_0x5e384b[_0xaa6f('0x53')],null))['then'](respondWithResult(_0x20547e,null))[_0xaa6f('0x44')](handleError(_0x20547e,null));};exports[_0xaa6f('0x54')]=function(_0x5e24d5,_0x2551c6){return db['CmList']['find']({'where':{'id':_0x5e24d5[_0xaa6f('0x46')]['id']}})[_0xaa6f('0x26')](handleEntityNotFound(_0x2551c6,null))[_0xaa6f('0x26')](removeEntity(_0x2551c6,null))[_0xaa6f('0x44')](handleError(_0x2551c6,null));};exports[_0xaa6f('0x55')]=function(_0x16f555,_0x2869e9){return db[_0xaa6f('0x2d')][_0xaa6f('0x55')]()[_0xaa6f('0x26')](respondWithResult(_0x2869e9,null))['catch'](handleError(_0x2869e9,null));};exports[_0xaa6f('0x56')]=function(_0x28cae8,_0x3144b4,_0x341251){if(_0x28cae8[_0xaa6f('0x53')]['id']){delete _0x28cae8[_0xaa6f('0x53')]['id'];}return db[_0xaa6f('0x2d')]['find']({'where':{'id':_0x28cae8[_0xaa6f('0x46')]['id']}})['then'](handleEntityNotFound(_0x3144b4,null))[_0xaa6f('0x26')](function(_0x29eab9){if(_0x29eab9){_0x28cae8[_0xaa6f('0x53')][_0xaa6f('0x57')]=_0x29eab9['id'];return db['Disposition'][_0xaa6f('0x4b')](_0x28cae8['body']);}})[_0xaa6f('0x26')](respondWithResult(_0x3144b4,null))['catch'](handleError(_0x3144b4,null));};exports['getDispositions']=function(_0x2a4494,_0x1d03db,_0x2bd750){var _0x488115={'raw':![],'where':{}};var _0xaff916={};var _0x1563d0={'count':0x0,'rows':[]};return db[_0xaa6f('0x2d')]['findOne']({'where':{'id':_0x2a4494[_0xaa6f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d03db,null))['then'](function(_0x3c9302){if(_0x3c9302){_0xaff916[_0xaa6f('0x36')]=_[_0xaa6f('0x33')](db[_0xaa6f('0x58')][_0xaa6f('0x2e')]);_0xaff916[_0xaa6f('0x32')]=_[_0xaa6f('0x33')](_0x2a4494[_0xaa6f('0x32')]);_0xaff916[_0xaa6f('0x34')]=_[_0xaa6f('0x35')](_0xaff916[_0xaa6f('0x36')],_0xaff916[_0xaa6f('0x32')]);_0x488115[_0xaa6f('0x37')]=_['intersection'](_0xaff916[_0xaa6f('0x36')],qs[_0xaa6f('0x38')](_0x2a4494['query'][_0xaa6f('0x38')]));_0x488115['attributes']=_0x488115[_0xaa6f('0x37')]['length']?_0x488115['attributes']:_0xaff916['model'];if(!_0x2a4494[_0xaa6f('0x32')][_0xaa6f('0x39')](_0xaa6f('0x59'))){_0x488115[_0xaa6f('0x20')]=qs['limit'](_0x2a4494[_0xaa6f('0x32')][_0xaa6f('0x20')]);_0x488115[_0xaa6f('0x1e')]=qs[_0xaa6f('0x1e')](_0x2a4494[_0xaa6f('0x32')][_0xaa6f('0x1e')]);}_0x488115[_0xaa6f('0x3a')]=qs[_0xaa6f('0x3b')](_0x2a4494[_0xaa6f('0x32')][_0xaa6f('0x3b')]);_0x488115[_0xaa6f('0x3c')]=qs[_0xaa6f('0x34')](_['pick'](_0x2a4494[_0xaa6f('0x32')],_0xaff916['filters']));_0x488115[_0xaa6f('0x3c')][_0xaa6f('0x57')]=_0x3c9302['id'];if(_0x2a4494['query']['filter']){_0x488115['where']=_[_0xaa6f('0x3e')](_0x488115[_0xaa6f('0x3c')],{'$or':_[_0xaa6f('0x2c')](_0x488115[_0xaa6f('0x37')],function(_0x4a6ae2){var _0x284c9b={};_0x284c9b[_0x4a6ae2]={'$like':'%'+_0x2a4494[_0xaa6f('0x32')][_0xaa6f('0x40')]+'%'};return _0x284c9b;})});}_0x488115=_[_0xaa6f('0x3e')]({},_0x488115,_0x2a4494[_0xaa6f('0x49')]);return db[_0xaa6f('0x58')][_0xaa6f('0x21')]({'where':_0x488115[_0xaa6f('0x3c')]})[_0xaa6f('0x26')](function(_0x440c4e){_0x1563d0[_0xaa6f('0x21')]=_0x440c4e;if(_0x2a4494['query'][_0xaa6f('0x48')]){_0x488115['include']=[{'all':!![]}];}return db[_0xaa6f('0x58')][_0xaa6f('0x42')](_0x488115);})[_0xaa6f('0x26')](function(_0x3a8430){_0x1563d0[_0xaa6f('0x43')]=_0x3a8430;return _0x1563d0;});}})[_0xaa6f('0x26')](respondWithFilteredResult(_0x1d03db,_0x488115))['catch'](handleError(_0x1d03db,null));};exports[_0xaa6f('0x5a')]=function(_0x4e3447,_0x1215a7,_0x7d6550){return db[_0xaa6f('0x2d')][_0xaa6f('0x4a')]({'where':{'id':_0x4e3447['params']['id']}})[_0xaa6f('0x26')](handleEntityNotFound(_0x1215a7,null))['then'](function(_0x143022){if(_0x143022){return _0x143022['removeDispositions'](_0x4e3447[_0xaa6f('0x32')][_0xaa6f('0x5b')]);}})['then'](respondWithStatusCode(_0x1215a7,null))[_0xaa6f('0x44')](handleError(_0x1215a7,null));};exports[_0xaa6f('0x5c')]=function(_0x4602f9,_0x143cad,_0x3085f6){return db['CmList'][_0xaa6f('0x4a')]({'where':{'id':_0x4602f9[_0xaa6f('0x46')]['id']}})[_0xaa6f('0x26')](handleEntityNotFound(_0x143cad,null))[_0xaa6f('0x26')](function(_0x1f731b){if(_0x1f731b){var _0x517775=[];var _0x21ed24={'success':[],'errors':[]};return db[_0xaa6f('0x5d')][_0xaa6f('0x55')]()['then'](function(_0xc71239){if(_0x4602f9[_0xaa6f('0x53')]['tags']&&_[_0xaa6f('0x5e')](_0x4602f9[_0xaa6f('0x53')][_0xaa6f('0x5f')])){if(_0x4602f9[_0xaa6f('0x53')]['tags'][_0xaa6f('0x47')]){_0x4602f9[_0xaa6f('0x53')][_0xaa6f('0x5f')]=_0x4602f9['body']['tags'][_0xaa6f('0x60')](';')+';';}else{_0x4602f9[_0xaa6f('0x53')]['tags']=null;}}else{_0x4602f9['body'][_0xaa6f('0x5f')]=null;}if(_0x4602f9[_0xaa6f('0x53')]&&_['isArray'](_0x4602f9[_0xaa6f('0x53')])){for(var _0x5769b2=0x0;_0x5769b2<_0x4602f9[_0xaa6f('0x53')][_0xaa6f('0x47')];_0x5769b2+=0x1){_0x4602f9[_0xaa6f('0x53')][_0x5769b2][_0xaa6f('0x57')]=_0x4602f9[_0xaa6f('0x46')]['id'];_0x517775['push'](_0x4602f9[_0xaa6f('0x53')][_0x5769b2]);}return BPromise[_0xaa6f('0x61')](_0x517775,function(_0x537bf2){return db[_0xaa6f('0x5d')]['create'](_[_0xaa6f('0x62')](_0x537bf2,['ids','id'])||{},{'fields':_[_0xaa6f('0x33')](_0xc71239),'raw':!![]})['then'](function(_0x4ddd76){_0x21ed24[_0xaa6f('0x63')][_0xaa6f('0x64')](_0x4ddd76[_0xaa6f('0x65')]);})[_0xaa6f('0x44')](function(_0x20436e){_0x21ed24[_0xaa6f('0x66')][_0xaa6f('0x64')]({'data':_0x537bf2,'error':_0x20436e[_0xaa6f('0x67')]});});})['then'](function(_0x4e3706){return _0x21ed24;})['catch'](function(_0x276dca){return _0x276dca;});}else{_0x143cad[_0xaa6f('0x1b')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x143cad,null))['catch'](handleError(_0x143cad,null));};exports[_0xaa6f('0x68')]=function(_0x14e4b7,_0x472a93,_0x412b8f){var _0x5baa1a;return db['CmList'][_0xaa6f('0x4a')]({'where':{'id':_0x14e4b7[_0xaa6f('0x46')]['id']},'include':[{'model':db[_0xaa6f('0x69')],'as':_0xaa6f('0x6a')}]})[_0xaa6f('0x26')](handleEntityNotFound(_0x472a93,null))[_0xaa6f('0x26')](function(_0x6642e0){if(_0x6642e0){_0x5baa1a=_0x6642e0;return db[_0xaa6f('0x5d')][_0xaa6f('0x2e')];}})[_0xaa6f('0x26')](function(_0x5a4cf2){if(_0x5a4cf2){var _0x55a427={};var _0x44ed72={};_0x44ed72['model']=_[_0xaa6f('0x6b')](_['keys'](_0x5a4cf2),_[_0xaa6f('0x2c')](_0x5baa1a[_0xaa6f('0x6a')],function(_0x2e5488){return util[_0xaa6f('0x6c')](_0xaa6f('0x6d'),_0x2e5488['id']);}));_0x44ed72[_0xaa6f('0x32')]=_[_0xaa6f('0x33')](_0x14e4b7[_0xaa6f('0x32')]);_0x44ed72['filters']=_[_0xaa6f('0x35')](_0x44ed72[_0xaa6f('0x36')],_0x44ed72[_0xaa6f('0x32')]);_0x55a427[_0xaa6f('0x37')]=_[_0xaa6f('0x35')](_0x44ed72['model'],qs[_0xaa6f('0x38')](_0x14e4b7[_0xaa6f('0x32')][_0xaa6f('0x38')]));_0x55a427[_0xaa6f('0x37')]=_0x55a427[_0xaa6f('0x37')][_0xaa6f('0x47')]?_0x55a427[_0xaa6f('0x37')]:_0x44ed72[_0xaa6f('0x36')];if(!_0x14e4b7[_0xaa6f('0x32')][_0xaa6f('0x39')]('nolimit')){_0x55a427[_0xaa6f('0x20')]=qs[_0xaa6f('0x20')](_0x14e4b7[_0xaa6f('0x32')][_0xaa6f('0x20')]);_0x55a427[_0xaa6f('0x1e')]=qs[_0xaa6f('0x1e')](_0x14e4b7[_0xaa6f('0x32')][_0xaa6f('0x1e')]);}_0x55a427[_0xaa6f('0x3a')]=qs[_0xaa6f('0x3b')](_0x14e4b7[_0xaa6f('0x32')][_0xaa6f('0x3b')]);_0x55a427[_0xaa6f('0x3c')]=qs[_0xaa6f('0x34')](_['pick'](_0x14e4b7['query'],_0x44ed72['filters']));_0x55a427[_0xaa6f('0x6e')]=!![];if(_0x14e4b7['query']['filter']){_0x55a427['where']=_['merge'](_0x55a427[_0xaa6f('0x3c')],{'$or':_[_0xaa6f('0x2c')](_0x55a427['attributes'],function(_0x2e2c04){var _0x2dbeb9={};_0x2dbeb9[_0x2e2c04]={'$like':'%'+_0x14e4b7['query'][_0xaa6f('0x40')]+'%'};return _0x2dbeb9;})});}_0x55a427=_['merge']({},_0x55a427,_0x14e4b7[_0xaa6f('0x49')]);return _0x5baa1a[_0xaa6f('0x68')](_0x55a427);}})[_0xaa6f('0x26')](respondWithResult(_0x472a93,null))[_0xaa6f('0x44')](handleError(_0x472a93,null));};exports[_0xaa6f('0x6f')]=function(_0x418d10,_0x4b1fac,_0x407a68){var _0x50579e;var _0x1dc52f;var _0x35f1c1;var _0x507688=_0x418d10['params']['id'];csv_results=[];return db['ContactItemType'][_0xaa6f('0x42')]({'attributes':['id',_0xaa6f('0x2a')],'raw':!![],'order':[_0xaa6f('0x70')]})[_0xaa6f('0x26')](function(_0x1082d2){_0x50579e=_0x1082d2;var _0xf5db17=_[_0xaa6f('0x33')](db['CmContact'][_0xaa6f('0x2e')]);return db[_0xaa6f('0x69')][_0xaa6f('0x42')]({'raw':!![],'attributes':['id',_0xaa6f('0x71')]})[_0xaa6f('0x26')](function(_0x956b19){_0x1dc52f=_0x956b19;var _0x3af8d9=squel[_0xaa6f('0x72')]()[_0xaa6f('0x38')](_0xf5db17)[_0xaa6f('0x73')](_0xaa6f('0x74'),'c')[_0xaa6f('0x3c')](_0xaa6f('0x75'),_0x507688)['where']('c.deletedAt\x20is\x20null')[_0xaa6f('0x76')]();for(var _0x4001eb=0x0;_0x4001eb<_0x1dc52f['length'];_0x4001eb++){_0x3af8d9[_0xaa6f('0x77')](_0xaa6f('0x78')+_0x1dc52f[_0x4001eb]['id'],_0xaa6f('0x79')+_0x1dc52f[_0x4001eb]['alias']);}for(var _0x4001eb=0x0;_0x4001eb<_0x50579e['length'];_0x4001eb++){_0x3af8d9[_0xaa6f('0x77')](squel[_0xaa6f('0x72')]()[_0xaa6f('0x77')]('item')['from'](_0xaa6f('0x7a'))['where'](_0xaa6f('0x7b'),_0x50579e[_0x4001eb]['id'])['where'](_0xaa6f('0x7c')),_0xaa6f('0x7d')+_0x50579e[_0x4001eb][_0xaa6f('0x2a')]);_0x3af8d9[_0xaa6f('0x77')](squel[_0xaa6f('0x72')]()[_0xaa6f('0x77')](_0xaa6f('0x7e'))[_0xaa6f('0x73')](_0xaa6f('0x7a'))['where'](_0xaa6f('0x7b'),_0x50579e[_0x4001eb]['id'])[_0xaa6f('0x3c')]('CmContactId\x20=\x20c.id'),_0xaa6f('0x7f')+_0x50579e[_0x4001eb][_0xaa6f('0x2a')]);}var _0x216fe8=[];_0x216fe8['push'](_0x3af8d9['toString']());BPromise[_0xaa6f('0x61')](_0x216fe8,handleQuery)[_0xaa6f('0x26')](function(_0x33b5f9){handleQuery(_0x3af8d9[_0xaa6f('0x80')]());var _0x3ece2f=csv_results[0x0];if(!_[_0xaa6f('0x81')](_0x3ece2f)){var _0x15fbd1=toCsv(_0x3ece2f);var _0x2fb6f3=Date[_0xaa6f('0x82')]();fs[_0xaa6f('0x83')](util[_0xaa6f('0x6c')](_0xaa6f('0x84'),_0x507688,_0x2fb6f3),_0x15fbd1);_0x4b1fac[_0xaa6f('0x85')](_0xaa6f('0x86'),_0xaa6f('0x87')+util[_0xaa6f('0x6c')](_0xaa6f('0x88'),_0x507688,_0x2fb6f3));_0x4b1fac[_0xaa6f('0x85')](_0xaa6f('0x89'),'text/csv');return _0x4b1fac['download'](util['format'](_0xaa6f('0x84'),_0x507688,_0x2fb6f3));}else{return _0x4b1fac[_0xaa6f('0x1a')](0xcc);}});});});};exports[_0xaa6f('0x8a')]=function(_0xe7991,_0x5dcf33,_0x306c5b){var _0x17a4e7;delete _0xe7991[_0xaa6f('0x53')]['id'];return db[_0xaa6f('0x2d')][_0xaa6f('0x8b')]({'where':{'id':_0xe7991[_0xaa6f('0x46')]['id']}})[_0xaa6f('0x26')](handleEntityNotFound(_0x5dcf33,null))['then'](function(_0x732cf){if(_0x732cf){return db[_0xaa6f('0x8c')][_0xaa6f('0x8d')](function(_0x106b0b){return db[_0xaa6f('0x69')][_0xaa6f('0x4b')](_0xe7991[_0xaa6f('0x53')],{'transaction':_0x106b0b})[_0xaa6f('0x26')](function(_0x1070c6){_0x17a4e7=_0x1070c6;return _0x732cf[_0xaa6f('0x8e')](_0x1070c6,{'transaction':_0x106b0b});})['then'](function(){var _0x41a9f2={'type':db[_0xaa6f('0x8f')][_0xaa6f('0x90')],'transaction':_0x106b0b};switch(_0xe7991[_0xaa6f('0x53')][_0xaa6f('0x30')]){case _0xaa6f('0x91'):_0x41a9f2[_0xaa6f('0x30')]=db['Sequelize']['TEXT'];break;case _0xaa6f('0x92'):_0x41a9f2[_0xaa6f('0x30')]=db[_0xaa6f('0x8f')][_0xaa6f('0x93')];break;case _0xaa6f('0x94'):_0x41a9f2['type']=db[_0xaa6f('0x8f')]['BOOLEAN'];_0x41a9f2[_0xaa6f('0x95')]=![];break;default:}return db['sequelize'][_0xaa6f('0x96')][_0xaa6f('0x97')](_0xaa6f('0x74'),util[_0xaa6f('0x6c')](_0xaa6f('0x98'),_0x17a4e7['id']),_0x41a9f2);})[_0xaa6f('0x26')](function(){return _0x17a4e7;});});}})['then'](respondWithResult(_0x5dcf33,null))[_0xaa6f('0x44')](handleError(_0x5dcf33,null));};exports[_0xaa6f('0x99')]=function(_0x1870bd,_0x1553ec,_0x1523f9){var _0x19abfe={};var _0xb7ccd8={};var _0x322e12;var _0x403943;return db['CmList'][_0xaa6f('0x8b')]({'where':{'id':_0x1870bd[_0xaa6f('0x46')]['id']}})[_0xaa6f('0x26')](handleEntityNotFound(_0x1553ec,null))['then'](function(_0x146a17){if(_0x146a17){_0x322e12=_0x146a17;_0xb7ccd8[_0xaa6f('0x36')]=_[_0xaa6f('0x33')](db[_0xaa6f('0x69')]['rawAttributes']);_0xb7ccd8[_0xaa6f('0x32')]=_[_0xaa6f('0x33')](_0x1870bd[_0xaa6f('0x32')]);_0xb7ccd8[_0xaa6f('0x34')]=_[_0xaa6f('0x35')](_0xb7ccd8[_0xaa6f('0x36')],_0xb7ccd8['query']);_0x19abfe[_0xaa6f('0x37')]=_[_0xaa6f('0x35')](_0xb7ccd8[_0xaa6f('0x36')],qs[_0xaa6f('0x38')](_0x1870bd['query'][_0xaa6f('0x38')]));_0x19abfe[_0xaa6f('0x37')]=_0x19abfe['attributes'][_0xaa6f('0x47')]?_0x19abfe[_0xaa6f('0x37')]:_0xb7ccd8['model'];_0x19abfe[_0xaa6f('0x3a')]=qs[_0xaa6f('0x3b')](_0x1870bd[_0xaa6f('0x32')][_0xaa6f('0x3b')]);_0x19abfe[_0xaa6f('0x3c')]=qs['filters'](_['pick'](_0x1870bd[_0xaa6f('0x32')],_0xb7ccd8[_0xaa6f('0x34')]));_0x19abfe[_0xaa6f('0x3c')]=_[_0xaa6f('0x3e')](_0x19abfe[_0xaa6f('0x3c')],{'$or':[{'ListId':_0x146a17['id']},{'ListId':null}]});if(_0x1870bd['query'][_0xaa6f('0x40')]){_0x19abfe[_0xaa6f('0x3c')]=_[_0xaa6f('0x3e')](_0x19abfe[_0xaa6f('0x3c')],{'$or':_[_0xaa6f('0x2c')](_0x19abfe[_0xaa6f('0x37')],function(_0x3b568e){var _0x4bb123={};_0x4bb123[_0x3b568e]={'$like':'%'+_0x1870bd['query'][_0xaa6f('0x40')]+'%'};return _0x4bb123;})});}_0x19abfe=_[_0xaa6f('0x3e')]({},_0x19abfe,_0x1870bd[_0xaa6f('0x49')]);return db['CmCustomField'][_0xaa6f('0x9a')](_0x19abfe);}})['then'](respondWithResult(_0x1553ec,null))[_0xaa6f('0x44')](handleError(_0x1553ec,null));};exports[_0xaa6f('0x9b')]=function(_0x1dcb6f,_0x51a550){return db['CmCustomField'][_0xaa6f('0x9a')]({'where':{'ListId':null}})[_0xaa6f('0x26')](handleEntityNotFound(_0x51a550,null))['then'](function(_0x5e30e4){return _0x5e30e4;})[_0xaa6f('0x26')](respondWithResult(_0x51a550,null))[_0xaa6f('0x44')](handleError(_0x51a550,null));};exports[_0xaa6f('0x9c')]=function(_0x503336,_0x1c3237,_0x564274){return db[_0xaa6f('0x2d')][_0xaa6f('0x4a')]({'where':{'id':_0x503336[_0xaa6f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1c3237,null))[_0xaa6f('0x26')](function(_0x4802a7){if(_0x4802a7){return _0x4802a7[_0xaa6f('0x9c')](_0x503336[_0xaa6f('0x53')][_0xaa6f('0x5b')],_[_0xaa6f('0x62')](_0x503336[_0xaa6f('0x53')],[_0xaa6f('0x5b'),'id'])||{})[_0xaa6f('0x9d')](function(_0x5f0764){for(var _0x1a388c=0x0;_0x1a388c<_0x503336[_0xaa6f('0x53')][_0xaa6f('0x5b')][_0xaa6f('0x47')];_0x1a388c+=0x1){socket[_0xaa6f('0x9e')]('userCmList:save',{'UserId':Number(_0x503336[_0xaa6f('0x53')][_0xaa6f('0x5b')][_0x1a388c]),'CmListId':Number(_0x503336[_0xaa6f('0x46')]['id'])});}return _0x5f0764;});}})[_0xaa6f('0x26')](respondWithResult(_0x1c3237,null))['catch'](handleError(_0x1c3237,null));};exports[_0xaa6f('0x9f')]=function(_0x55e153,_0x2114b1,_0x5db569){return db['CmList'][_0xaa6f('0x4a')]({'where':{'id':_0x55e153[_0xaa6f('0x46')]['id']}})[_0xaa6f('0x26')](handleEntityNotFound(_0x2114b1,null))[_0xaa6f('0x26')](function(_0x2b3d00){if(_0x2b3d00){return _0x2b3d00[_0xaa6f('0x9f')](_0x55e153[_0xaa6f('0x32')][_0xaa6f('0x5b')])['then'](function(){if(_['isArray'](_0x55e153[_0xaa6f('0x32')][_0xaa6f('0x5b')])){for(var _0x490ba7=0x0;_0x490ba7<_0x55e153['query'][_0xaa6f('0x5b')][_0xaa6f('0x47')];_0x490ba7+=0x1){socket['emit'](_0xaa6f('0xa0'),{'UserId':Number(_0x55e153['query'][_0xaa6f('0x5b')][_0x490ba7]),'CmListId':Number(_0x55e153[_0xaa6f('0x46')]['id'])});}}else{socket[_0xaa6f('0x9e')](_0xaa6f('0xa0'),{'UserId':Number(_0x55e153[_0xaa6f('0x32')][_0xaa6f('0x5b')]),'CmListId':Number(_0x55e153['params']['id'])});}});}})[_0xaa6f('0x26')](respondWithStatusCode(_0x2114b1,null))['catch'](handleError(_0x2114b1,null));};exports[_0xaa6f('0xa1')]=function(_0x253e96,_0x4a0916,_0x290c2a){var _0x48105f={};var _0x259cc5={};var _0xcaee5d;var _0x27904f;return db['CmList'][_0xaa6f('0x8b')]({'where':{'id':_0x253e96['params']['id']}})['then'](handleEntityNotFound(_0x4a0916,null))[_0xaa6f('0x26')](function(_0x425419){if(_0x425419){_0xcaee5d=_0x425419;_0x259cc5[_0xaa6f('0x36')]=_[_0xaa6f('0x33')](db['User'][_0xaa6f('0x2e')]);_0x259cc5['query']=_[_0xaa6f('0x33')](_0x253e96['query']);_0x259cc5[_0xaa6f('0x34')]=_[_0xaa6f('0x35')](_0x259cc5[_0xaa6f('0x36')],_0x259cc5[_0xaa6f('0x32')]);_0x48105f[_0xaa6f('0x37')]=_[_0xaa6f('0x35')](_0x259cc5[_0xaa6f('0x36')],qs[_0xaa6f('0x38')](_0x253e96[_0xaa6f('0x32')][_0xaa6f('0x38')]));_0x48105f[_0xaa6f('0x37')]=_0x48105f[_0xaa6f('0x37')][_0xaa6f('0x47')]?_0x48105f['attributes']:_0x259cc5[_0xaa6f('0x36')];_0x48105f[_0xaa6f('0x3a')]=qs[_0xaa6f('0x3b')](_0x253e96[_0xaa6f('0x32')][_0xaa6f('0x3b')]);_0x48105f[_0xaa6f('0x3c')]=qs[_0xaa6f('0x34')](_[_0xaa6f('0x3d')](_0x253e96[_0xaa6f('0x32')],_0x259cc5[_0xaa6f('0x34')]));if(_0x253e96[_0xaa6f('0x32')][_0xaa6f('0x40')]){_0x48105f[_0xaa6f('0x3c')]=_[_0xaa6f('0x3e')](_0x48105f['where'],{'$or':_[_0xaa6f('0x2c')](_0x48105f['attributes'],function(_0x2e2f58){var _0x30fe92={};_0x30fe92[_0x2e2f58]={'$like':'%'+_0x253e96[_0xaa6f('0x32')]['filter']+'%'};return _0x30fe92;})});}_0x48105f=_[_0xaa6f('0x3e')]({},_0x48105f,_0x253e96['options']);return _0xcaee5d[_0xaa6f('0xa1')](_0x48105f);}})[_0xaa6f('0x26')](function(_0x2c32bd){if(_0x2c32bd){_0x27904f=_0x2c32bd[_0xaa6f('0x47')];if(!_0x253e96[_0xaa6f('0x32')][_0xaa6f('0x39')](_0xaa6f('0x59'))){_0x48105f[_0xaa6f('0x20')]=qs[_0xaa6f('0x20')](_0x253e96[_0xaa6f('0x32')][_0xaa6f('0x20')]);_0x48105f[_0xaa6f('0x1e')]=qs['offset'](_0x253e96[_0xaa6f('0x32')]['offset']);}return _0xcaee5d['getAgents'](_0x48105f);}})['then'](function(_0x582a41){if(_0x582a41){return _0x582a41?{'count':_0x27904f,'rows':_0x582a41}:null;}})['then'](respondWithResult(_0x4a0916,null))['catch'](handleError(_0x4a0916,null));};function handleQuery(_0x314a01){logger[_0xaa6f('0xa2')](_0x314a01);return db[_0xaa6f('0x8c')][_0xaa6f('0x32')](_0x314a01)[_0xaa6f('0x9d')](function(_0x162bdc){csv_results[_0xaa6f('0x64')](_0x162bdc);})[_0xaa6f('0x44')](function(_0x4a3ecf){logger[_0xaa6f('0x51')](_0x4a3ecf[_0xaa6f('0x67')]);});} \ No newline at end of file +var _0x6d38=['cf_%s','getCustomFields','getGlobalCustomFields','addAgents','omit','spread','removeAgents','emit','userCmList:remove','getAgents','User','info','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','UserProfileResource','destroy','error','name','send','index','map','CmList','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','rawAttributes','intersection','options','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','ListId','Disposition','findOne','filter','removeDispositions','addContacts','isArray','tags','join','CmContact','ids','success','push','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','raw','ContactItemType','OrderBy','CmCustomField','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','customField_','select','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','Content-disposition','attachment;\x20filename=','setHeader','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','TEXT','text','number','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn'];(function(_0x327b3e,_0x1ed5dd){var _0x574989=function(_0x370454){while(--_0x370454){_0x327b3e['push'](_0x327b3e['shift']());}};_0x574989(++_0x1ed5dd);}(_0x6d38,0x1ef));var _0x86d3=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x6d38[_0x580576];return _0x3f55a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];var csv_results;config[_0x86d3('0x14')]=_[_0x86d3('0x15')](config[_0x86d3('0x14')],{'host':_0x86d3('0x16'),'port':0x18eb});var socket=require(_0x86d3('0x17'))(new Redis(config[_0x86d3('0x14')]));require(_0x86d3('0x18'))['register'](socket);function respondWithStatusCode(_0x1c1ba8,_0x1f35cf){_0x1f35cf=_0x1f35cf||0xcc;return function(_0x356e7d){if(_0x356e7d){return _0x1c1ba8[_0x86d3('0x19')](_0x1f35cf);}return _0x1c1ba8[_0x86d3('0x1a')](_0x1f35cf)[_0x86d3('0x1b')]();};}function respondWithResult(_0x1ff008,_0x44436d){_0x44436d=_0x44436d||0xc8;return function(_0x53b437){if(_0x53b437){return _0x1ff008[_0x86d3('0x1a')](_0x44436d)[_0x86d3('0x1c')](_0x53b437);}};}function respondWithFilteredResult(_0x431b3f,_0xa26ea2){return function(_0x46feec){if(_0x46feec){var _0x120ef3=typeof _0xa26ea2[_0x86d3('0x1d')]===_0x86d3('0x1e')&&typeof _0xa26ea2[_0x86d3('0x1f')]==='undefined';var _0x191ba5=_0x46feec['count'];var _0x6ced9e=_0x120ef3?0x0:_0xa26ea2['offset'];var _0x52293e=_0x120ef3?_0x46feec[_0x86d3('0x20')]:_0xa26ea2[_0x86d3('0x1d')]+_0xa26ea2[_0x86d3('0x1f')];var _0x1720ae;if(_0x52293e>=_0x191ba5){_0x52293e=_0x191ba5;_0x1720ae=0xc8;}else{_0x1720ae=0xce;}_0x431b3f['status'](_0x1720ae);return _0x431b3f[_0x86d3('0x21')]('Content-Range',_0x6ced9e+'-'+_0x52293e+'/'+_0x191ba5)[_0x86d3('0x1c')](_0x46feec);}return null;};}function patchUpdates(_0x3fdf67){return function(_0x1ce849){try{jsonpatch['apply'](_0x1ce849,_0x3fdf67,!![]);}catch(_0x39d819){return BPromise[_0x86d3('0x22')](_0x39d819);}return _0x1ce849[_0x86d3('0x23')]();};}function saveUpdates(_0x4bf5b8,_0x58ba51){return function(_0x26262a){if(_0x26262a){return _0x26262a['update'](_0x4bf5b8)[_0x86d3('0x24')](function(_0x1bea5e){return _0x1bea5e;});}return null;};}function removeEntity(_0x3dfecd,_0x3c5fe4){return function(_0x48b3ff){if(_0x48b3ff){return _0x48b3ff['destroy']()[_0x86d3('0x24')](function(){var _0x611764=_0x48b3ff['get']({'plain':!![]});var _0x14e325='Lists';return db[_0x86d3('0x25')][_0x86d3('0x26')]({'where':{'type':_0x14e325,'resourceId':_0x611764['id']}})[_0x86d3('0x24')](function(){return _0x48b3ff;});})[_0x86d3('0x24')](function(){_0x3dfecd[_0x86d3('0x1a')](0xcc)[_0x86d3('0x1b')]();});}};}function handleEntityNotFound(_0x1f203e,_0x35d708){return function(_0x303f13){if(!_0x303f13){_0x1f203e[_0x86d3('0x19')](0x194);}return _0x303f13;};}function handleError(_0x206996,_0x1666af){_0x1666af=_0x1666af||0x1f4;return function(_0x36dfa6){logger[_0x86d3('0x27')](_0x36dfa6['stack']);if(_0x36dfa6[_0x86d3('0x28')]){delete _0x36dfa6[_0x86d3('0x28')];}_0x206996[_0x86d3('0x1a')](_0x1666af)[_0x86d3('0x29')](_0x36dfa6);};}exports[_0x86d3('0x2a')]=function(_0x245e39,_0x4a5ff0){var _0xba2f49={},_0x5c71df={},_0x5b61b2={'count':0x0,'rows':[]};var _0x20fa21=_[_0x86d3('0x2b')](db[_0x86d3('0x2c')]['rawAttributes'],function(_0x3866b8){return{'name':_0x3866b8[_0x86d3('0x2d')],'type':_0x3866b8['type'][_0x86d3('0x2e')]};});_0x5c71df[_0x86d3('0x2f')]=_[_0x86d3('0x2b')](_0x20fa21,_0x86d3('0x28'));_0x5c71df[_0x86d3('0x30')]=_[_0x86d3('0x31')](_0x245e39[_0x86d3('0x30')]);_0x5c71df[_0x86d3('0x32')]=_['intersection'](_0x5c71df['model'],_0x5c71df['query']);_0xba2f49[_0x86d3('0x33')]=_['intersection'](_0x5c71df[_0x86d3('0x2f')],qs['fields'](_0x245e39[_0x86d3('0x30')][_0x86d3('0x34')]));_0xba2f49[_0x86d3('0x33')]=_0xba2f49[_0x86d3('0x33')][_0x86d3('0x35')]?_0xba2f49[_0x86d3('0x33')]:_0x5c71df[_0x86d3('0x2f')];if(!_0x245e39['query'][_0x86d3('0x36')](_0x86d3('0x37'))){_0xba2f49['limit']=qs[_0x86d3('0x1f')](_0x245e39[_0x86d3('0x30')][_0x86d3('0x1f')]);_0xba2f49[_0x86d3('0x1d')]=qs['offset'](_0x245e39[_0x86d3('0x30')][_0x86d3('0x1d')]);}_0xba2f49[_0x86d3('0x38')]=qs['sort'](_0x245e39[_0x86d3('0x30')][_0x86d3('0x39')]);_0xba2f49[_0x86d3('0x3a')]=qs[_0x86d3('0x32')](_[_0x86d3('0x3b')](_0x245e39[_0x86d3('0x30')],_0x5c71df[_0x86d3('0x32')]),_0x20fa21);if(_0x245e39[_0x86d3('0x30')]['filter']){_0xba2f49[_0x86d3('0x3a')]=_[_0x86d3('0x3c')](_0xba2f49[_0x86d3('0x3a')],{'$or':_[_0x86d3('0x2b')](_0x20fa21,function(_0x5ebb4d){if(_0x5ebb4d[_0x86d3('0x3d')]!==_0x86d3('0x3e')){var _0x6f72be={};_0x6f72be[_0x5ebb4d[_0x86d3('0x28')]]={'$like':'%'+_0x245e39['query']['filter']+'%'};return _0x6f72be;}})});}_0xba2f49=_[_0x86d3('0x3c')]({},_0xba2f49,_0x245e39['options']);var _0x53545a={'where':_0xba2f49[_0x86d3('0x3a')]};return db[_0x86d3('0x2c')][_0x86d3('0x20')](_0x53545a)[_0x86d3('0x24')](function(_0x23ef72){_0x5b61b2['count']=_0x23ef72;if(_0x245e39[_0x86d3('0x30')][_0x86d3('0x3f')]){_0xba2f49[_0x86d3('0x40')]=[{'all':!![]}];}return db['CmList'][_0x86d3('0x41')](_0xba2f49);})[_0x86d3('0x24')](function(_0x5dfae8){_0x5b61b2[_0x86d3('0x42')]=_0x5dfae8;return _0x5b61b2;})[_0x86d3('0x24')](respondWithFilteredResult(_0x4a5ff0,_0xba2f49))['catch'](handleError(_0x4a5ff0,null));};exports['show']=function(_0x5b3772,_0x26bc3b){var _0x396641={'raw':![],'where':{'id':_0x5b3772[_0x86d3('0x43')]['id']}},_0x82bbcd={};_0x82bbcd[_0x86d3('0x2f')]=_[_0x86d3('0x31')](db['CmList'][_0x86d3('0x44')]);_0x82bbcd[_0x86d3('0x30')]=_['keys'](_0x5b3772[_0x86d3('0x30')]);_0x82bbcd[_0x86d3('0x32')]=_[_0x86d3('0x45')](_0x82bbcd[_0x86d3('0x2f')],_0x82bbcd[_0x86d3('0x30')]);_0x396641[_0x86d3('0x33')]=_['intersection'](_0x82bbcd[_0x86d3('0x2f')],qs[_0x86d3('0x34')](_0x5b3772['query'][_0x86d3('0x34')]));_0x396641[_0x86d3('0x33')]=_0x396641[_0x86d3('0x33')][_0x86d3('0x35')]?_0x396641[_0x86d3('0x33')]:_0x82bbcd['model'];if(_0x5b3772[_0x86d3('0x30')][_0x86d3('0x3f')]){_0x396641[_0x86d3('0x40')]=[{'all':!![]}];}_0x396641=_[_0x86d3('0x3c')]({},_0x396641,_0x5b3772[_0x86d3('0x46')]);return db[_0x86d3('0x2c')][_0x86d3('0x47')](_0x396641)[_0x86d3('0x24')](handleEntityNotFound(_0x26bc3b,null))[_0x86d3('0x24')](respondWithResult(_0x26bc3b,null))[_0x86d3('0x48')](handleError(_0x26bc3b,null));};exports[_0x86d3('0x49')]=function(_0x1236ea,_0x4ea940){return db[_0x86d3('0x2c')][_0x86d3('0x49')](_0x1236ea['body'],{})[_0x86d3('0x24')](function(_0x23a6ee){var _0x197047=_0x1236ea[_0x86d3('0x4a')][_0x86d3('0x4b')]({'plain':!![]});if(!_0x197047)throw new Error(_0x86d3('0x4c'));if(_0x197047['role']==='user'){var _0x5b872f=_0x23a6ee['get']({'plain':!![]});var _0x159253=_0x86d3('0x4d');return db[_0x86d3('0x4e')][_0x86d3('0x47')]({'where':{'name':_0x159253,'userProfileId':_0x197047[_0x86d3('0x4f')]},'raw':!![]})[_0x86d3('0x24')](function(_0x24d59e){if(_0x24d59e&&_0x24d59e['autoAssociation']===0x0){return db[_0x86d3('0x25')][_0x86d3('0x49')]({'name':_0x5b872f[_0x86d3('0x28')],'resourceId':_0x5b872f['id'],'type':_0x24d59e[_0x86d3('0x28')],'sectionId':_0x24d59e['id']},{})[_0x86d3('0x24')](function(){return _0x23a6ee;});}else{return _0x23a6ee;}})[_0x86d3('0x48')](function(_0x34935f){logger['error'](_0x86d3('0x50'),_0x34935f);throw _0x34935f;});}return _0x23a6ee;})['then'](respondWithResult(_0x4ea940,0xc9))[_0x86d3('0x48')](handleError(_0x4ea940,null));};exports[_0x86d3('0x51')]=function(_0xd072f2,_0x3ffd22){if(_0xd072f2[_0x86d3('0x52')]['id']){delete _0xd072f2['body']['id'];}return db[_0x86d3('0x2c')][_0x86d3('0x47')]({'where':{'id':_0xd072f2[_0x86d3('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ffd22,null))['then'](saveUpdates(_0xd072f2['body'],null))[_0x86d3('0x24')](respondWithResult(_0x3ffd22,null))['catch'](handleError(_0x3ffd22,null));};exports[_0x86d3('0x26')]=function(_0x2c5ebf,_0x1fbd25){return db[_0x86d3('0x2c')]['find']({'where':{'id':_0x2c5ebf['params']['id']}})['then'](handleEntityNotFound(_0x1fbd25,null))[_0x86d3('0x24')](removeEntity(_0x1fbd25,null))[_0x86d3('0x48')](handleError(_0x1fbd25,null));};exports['describe']=function(_0x3561c5,_0x37fe22){return db[_0x86d3('0x2c')][_0x86d3('0x53')]()[_0x86d3('0x24')](respondWithResult(_0x37fe22,null))['catch'](handleError(_0x37fe22,null));};exports[_0x86d3('0x54')]=function(_0x1c134b,_0x462e96,_0x3c038b){if(_0x1c134b['body']['id']){delete _0x1c134b[_0x86d3('0x52')]['id'];}return db[_0x86d3('0x2c')]['find']({'where':{'id':_0x1c134b[_0x86d3('0x43')]['id']}})[_0x86d3('0x24')](handleEntityNotFound(_0x462e96,null))[_0x86d3('0x24')](function(_0x29bdee){if(_0x29bdee){_0x1c134b[_0x86d3('0x52')][_0x86d3('0x55')]=_0x29bdee['id'];return db[_0x86d3('0x56')]['create'](_0x1c134b['body']);}})[_0x86d3('0x24')](respondWithResult(_0x462e96,null))['catch'](handleError(_0x462e96,null));};exports['getDispositions']=function(_0x58e4b6,_0x156960,_0x53ad5b){var _0x254ac3={'raw':![],'where':{}};var _0x5f2ed6={};var _0x1d8010={'count':0x0,'rows':[]};return db[_0x86d3('0x2c')][_0x86d3('0x57')]({'where':{'id':_0x58e4b6['params']['id']}})['then'](handleEntityNotFound(_0x156960,null))[_0x86d3('0x24')](function(_0xf2c179){if(_0xf2c179){_0x5f2ed6[_0x86d3('0x2f')]=_[_0x86d3('0x31')](db[_0x86d3('0x56')][_0x86d3('0x44')]);_0x5f2ed6[_0x86d3('0x30')]=_[_0x86d3('0x31')](_0x58e4b6[_0x86d3('0x30')]);_0x5f2ed6[_0x86d3('0x32')]=_[_0x86d3('0x45')](_0x5f2ed6[_0x86d3('0x2f')],_0x5f2ed6[_0x86d3('0x30')]);_0x254ac3[_0x86d3('0x33')]=_[_0x86d3('0x45')](_0x5f2ed6[_0x86d3('0x2f')],qs[_0x86d3('0x34')](_0x58e4b6[_0x86d3('0x30')]['fields']));_0x254ac3[_0x86d3('0x33')]=_0x254ac3[_0x86d3('0x33')][_0x86d3('0x35')]?_0x254ac3['attributes']:_0x5f2ed6[_0x86d3('0x2f')];if(!_0x58e4b6[_0x86d3('0x30')][_0x86d3('0x36')](_0x86d3('0x37'))){_0x254ac3['limit']=qs[_0x86d3('0x1f')](_0x58e4b6['query'][_0x86d3('0x1f')]);_0x254ac3[_0x86d3('0x1d')]=qs[_0x86d3('0x1d')](_0x58e4b6[_0x86d3('0x30')][_0x86d3('0x1d')]);}_0x254ac3['order']=qs[_0x86d3('0x39')](_0x58e4b6['query'][_0x86d3('0x39')]);_0x254ac3[_0x86d3('0x3a')]=qs['filters'](_[_0x86d3('0x3b')](_0x58e4b6[_0x86d3('0x30')],_0x5f2ed6[_0x86d3('0x32')]));_0x254ac3[_0x86d3('0x3a')][_0x86d3('0x55')]=_0xf2c179['id'];if(_0x58e4b6[_0x86d3('0x30')][_0x86d3('0x58')]){_0x254ac3['where']=_[_0x86d3('0x3c')](_0x254ac3[_0x86d3('0x3a')],{'$or':_[_0x86d3('0x2b')](_0x254ac3[_0x86d3('0x33')],function(_0x46e356){var _0x47f72e={};_0x47f72e[_0x46e356]={'$like':'%'+_0x58e4b6[_0x86d3('0x30')][_0x86d3('0x58')]+'%'};return _0x47f72e;})});}_0x254ac3=_['merge']({},_0x254ac3,_0x58e4b6[_0x86d3('0x46')]);return db[_0x86d3('0x56')][_0x86d3('0x20')]({'where':_0x254ac3[_0x86d3('0x3a')]})[_0x86d3('0x24')](function(_0x351d73){_0x1d8010[_0x86d3('0x20')]=_0x351d73;if(_0x58e4b6[_0x86d3('0x30')][_0x86d3('0x3f')]){_0x254ac3[_0x86d3('0x40')]=[{'all':!![]}];}return db[_0x86d3('0x56')][_0x86d3('0x41')](_0x254ac3);})[_0x86d3('0x24')](function(_0xab8a80){_0x1d8010['rows']=_0xab8a80;return _0x1d8010;});}})[_0x86d3('0x24')](respondWithFilteredResult(_0x156960,_0x254ac3))[_0x86d3('0x48')](handleError(_0x156960,null));};exports[_0x86d3('0x59')]=function(_0x31d64a,_0x5645cc,_0x37828b){return db[_0x86d3('0x2c')][_0x86d3('0x47')]({'where':{'id':_0x31d64a[_0x86d3('0x43')]['id']}})['then'](handleEntityNotFound(_0x5645cc,null))['then'](function(_0x234497){if(_0x234497){return _0x234497['removeDispositions'](_0x31d64a[_0x86d3('0x30')]['ids']);}})['then'](respondWithStatusCode(_0x5645cc,null))[_0x86d3('0x48')](handleError(_0x5645cc,null));};exports[_0x86d3('0x5a')]=function(_0x3cb04d,_0x357398,_0x121dca){return db['CmList'][_0x86d3('0x47')]({'where':{'id':_0x3cb04d[_0x86d3('0x43')]['id']}})['then'](handleEntityNotFound(_0x357398,null))[_0x86d3('0x24')](function(_0x33872f){if(_0x33872f){var _0x585ce3=[];var _0x21ea5a={'success':[],'errors':[]};return db['CmContact'][_0x86d3('0x53')]()['then'](function(_0x5bb2e5){if(_0x3cb04d[_0x86d3('0x52')]['tags']&&_[_0x86d3('0x5b')](_0x3cb04d[_0x86d3('0x52')][_0x86d3('0x5c')])){if(_0x3cb04d[_0x86d3('0x52')][_0x86d3('0x5c')][_0x86d3('0x35')]){_0x3cb04d[_0x86d3('0x52')][_0x86d3('0x5c')]=_0x3cb04d['body'][_0x86d3('0x5c')][_0x86d3('0x5d')](';')+';';}else{_0x3cb04d[_0x86d3('0x52')][_0x86d3('0x5c')]=null;}}else{_0x3cb04d[_0x86d3('0x52')]['tags']=null;}if(_0x3cb04d[_0x86d3('0x52')]&&_[_0x86d3('0x5b')](_0x3cb04d[_0x86d3('0x52')])){for(var _0x302240=0x0;_0x302240<_0x3cb04d[_0x86d3('0x52')][_0x86d3('0x35')];_0x302240+=0x1){_0x3cb04d[_0x86d3('0x52')][_0x302240]['ListId']=_0x3cb04d[_0x86d3('0x43')]['id'];_0x585ce3['push'](_0x3cb04d[_0x86d3('0x52')][_0x302240]);}return BPromise['each'](_0x585ce3,function(_0x5a22ca){return db[_0x86d3('0x5e')][_0x86d3('0x49')](_['omit'](_0x5a22ca,[_0x86d3('0x5f'),'id'])||{},{'fields':_[_0x86d3('0x31')](_0x5bb2e5),'raw':!![]})[_0x86d3('0x24')](function(_0x1c1384){_0x21ea5a[_0x86d3('0x60')][_0x86d3('0x61')](_0x1c1384[_0x86d3('0x62')]);})['catch'](function(_0x593b85){_0x21ea5a[_0x86d3('0x63')][_0x86d3('0x61')]({'data':_0x5a22ca,'error':_0x593b85[_0x86d3('0x64')]});});})[_0x86d3('0x24')](function(_0xbbdd46){return _0x21ea5a;})[_0x86d3('0x48')](function(_0x592068){return _0x592068;});}else{_0x357398[_0x86d3('0x1a')](0x190)[_0x86d3('0x1c')]({'message':_0x86d3('0x65')});}});}})[_0x86d3('0x24')](respondWithResult(_0x357398,null))[_0x86d3('0x48')](handleError(_0x357398,null));};exports[_0x86d3('0x66')]=function(_0x3cbab3,_0x2a9b06,_0x15dfa1){var _0x5948e1;return db[_0x86d3('0x2c')][_0x86d3('0x47')]({'where':{'id':_0x3cbab3['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x86d3('0x67')}]})[_0x86d3('0x24')](handleEntityNotFound(_0x2a9b06,null))[_0x86d3('0x24')](function(_0x5004cd){if(_0x5004cd){_0x5948e1=_0x5004cd;return db[_0x86d3('0x5e')][_0x86d3('0x44')];}})[_0x86d3('0x24')](function(_0x422509){if(_0x422509){var _0x3d3e7f={};var _0x49d0c9={};_0x49d0c9[_0x86d3('0x2f')]=_[_0x86d3('0x68')](_['keys'](_0x422509),_[_0x86d3('0x2b')](_0x5948e1[_0x86d3('0x67')],function(_0x1ddd75){return util[_0x86d3('0x69')]('cf_%d',_0x1ddd75['id']);}));_0x49d0c9[_0x86d3('0x30')]=_[_0x86d3('0x31')](_0x3cbab3[_0x86d3('0x30')]);_0x49d0c9[_0x86d3('0x32')]=_[_0x86d3('0x45')](_0x49d0c9['model'],_0x49d0c9[_0x86d3('0x30')]);_0x3d3e7f[_0x86d3('0x33')]=_[_0x86d3('0x45')](_0x49d0c9[_0x86d3('0x2f')],qs[_0x86d3('0x34')](_0x3cbab3[_0x86d3('0x30')][_0x86d3('0x34')]));_0x3d3e7f[_0x86d3('0x33')]=_0x3d3e7f[_0x86d3('0x33')][_0x86d3('0x35')]?_0x3d3e7f['attributes']:_0x49d0c9['model'];if(!_0x3cbab3[_0x86d3('0x30')][_0x86d3('0x36')]('nolimit')){_0x3d3e7f[_0x86d3('0x1f')]=qs[_0x86d3('0x1f')](_0x3cbab3[_0x86d3('0x30')][_0x86d3('0x1f')]);_0x3d3e7f[_0x86d3('0x1d')]=qs[_0x86d3('0x1d')](_0x3cbab3[_0x86d3('0x30')][_0x86d3('0x1d')]);}_0x3d3e7f[_0x86d3('0x38')]=qs['sort'](_0x3cbab3['query']['sort']);_0x3d3e7f['where']=qs[_0x86d3('0x32')](_[_0x86d3('0x3b')](_0x3cbab3[_0x86d3('0x30')],_0x49d0c9[_0x86d3('0x32')]));_0x3d3e7f[_0x86d3('0x6a')]=!![];if(_0x3cbab3[_0x86d3('0x30')][_0x86d3('0x58')]){_0x3d3e7f['where']=_[_0x86d3('0x3c')](_0x3d3e7f[_0x86d3('0x3a')],{'$or':_[_0x86d3('0x2b')](_0x3d3e7f[_0x86d3('0x33')],function(_0x557034){var _0xe239b5={};_0xe239b5[_0x557034]={'$like':'%'+_0x3cbab3['query'][_0x86d3('0x58')]+'%'};return _0xe239b5;})});}_0x3d3e7f=_[_0x86d3('0x3c')]({},_0x3d3e7f,_0x3cbab3[_0x86d3('0x46')]);return _0x5948e1[_0x86d3('0x66')](_0x3d3e7f);}})[_0x86d3('0x24')](respondWithResult(_0x2a9b06,null))['catch'](handleError(_0x2a9b06,null));};exports['getContactsCsv']=function(_0x31d740,_0x5c73b4,_0x3cadd9){var _0x53514d;var _0x17278a;var _0x4b20c0;var _0x4c9067=_0x31d740[_0x86d3('0x43')]['id'];csv_results=[];return db[_0x86d3('0x6b')][_0x86d3('0x41')]({'attributes':['id',_0x86d3('0x28')],'raw':!![],'order':[_0x86d3('0x6c')]})[_0x86d3('0x24')](function(_0x14ebae){_0x53514d=_0x14ebae;var _0x31b338=_[_0x86d3('0x31')](db[_0x86d3('0x5e')][_0x86d3('0x44')]);return db[_0x86d3('0x6d')][_0x86d3('0x41')]({'raw':!![],'attributes':['id',_0x86d3('0x6e')]})[_0x86d3('0x24')](function(_0x4abc61){_0x17278a=_0x4abc61;var _0x5361d9=squel['select']()[_0x86d3('0x34')](_0x31b338)[_0x86d3('0x6f')](_0x86d3('0x70'),'c')[_0x86d3('0x3a')](_0x86d3('0x71'),_0x4c9067)[_0x86d3('0x3a')](_0x86d3('0x72'))[_0x86d3('0x73')]();for(var _0x1c8673=0x0;_0x1c8673<_0x17278a[_0x86d3('0x35')];_0x1c8673++){_0x5361d9[_0x86d3('0x74')]('c.cf_'+_0x17278a[_0x1c8673]['id'],_0x86d3('0x75')+_0x17278a[_0x1c8673]['alias']);}for(var _0x1c8673=0x0;_0x1c8673<_0x53514d[_0x86d3('0x35')];_0x1c8673++){_0x5361d9[_0x86d3('0x74')](squel[_0x86d3('0x76')]()['field'](_0x86d3('0x77'))[_0x86d3('0x6f')](_0x86d3('0x78'))[_0x86d3('0x3a')](_0x86d3('0x79'),_0x53514d[_0x1c8673]['id'])[_0x86d3('0x3a')](_0x86d3('0x7a')),_0x86d3('0x7b')+_0x53514d[_0x1c8673][_0x86d3('0x28')]);_0x5361d9[_0x86d3('0x74')](squel[_0x86d3('0x76')]()[_0x86d3('0x74')](_0x86d3('0x7c'))[_0x86d3('0x6f')](_0x86d3('0x78'))[_0x86d3('0x3a')](_0x86d3('0x79'),_0x53514d[_0x1c8673]['id'])['where'](_0x86d3('0x7a')),_0x86d3('0x7d')+_0x53514d[_0x1c8673][_0x86d3('0x28')]);}var _0x35d595=[];_0x35d595['push'](_0x5361d9[_0x86d3('0x7e')]());BPromise['each'](_0x35d595,handleQuery)['then'](function(_0xd0d0a1){handleQuery(_0x5361d9[_0x86d3('0x7e')]());var _0x44ae59=csv_results[0x0];if(!_[_0x86d3('0x7f')](_0x44ae59)){var _0x337401=toCsv(_0x44ae59);var _0x348c8b=Date[_0x86d3('0x80')]();fs[_0x86d3('0x81')](util['format']('/tmp/list_%d_%s.csv',_0x4c9067,_0x348c8b),_0x337401);_0x5c73b4['setHeader'](_0x86d3('0x82'),_0x86d3('0x83')+util[_0x86d3('0x69')]('list_%d_%s.csv',_0x4c9067,_0x348c8b));_0x5c73b4[_0x86d3('0x84')]('Content-type',_0x86d3('0x85'));return _0x5c73b4[_0x86d3('0x86')](util[_0x86d3('0x69')](_0x86d3('0x87'),_0x4c9067,_0x348c8b));}else{return _0x5c73b4['sendStatus'](0xcc);}});});});};exports[_0x86d3('0x88')]=function(_0x3a48a3,_0x2ca7c0,_0x5f0c68){var _0x50564d;delete _0x3a48a3['body']['id'];return db[_0x86d3('0x2c')][_0x86d3('0x57')]({'where':{'id':_0x3a48a3['params']['id']}})[_0x86d3('0x24')](handleEntityNotFound(_0x2ca7c0,null))['then'](function(_0x3a2ec6){if(_0x3a2ec6){return db[_0x86d3('0x89')][_0x86d3('0x8a')](function(_0x56ff91){return db[_0x86d3('0x6d')][_0x86d3('0x49')](_0x3a48a3[_0x86d3('0x52')],{'transaction':_0x56ff91})[_0x86d3('0x24')](function(_0x412404){_0x50564d=_0x412404;return _0x3a2ec6['addCustomFields'](_0x412404,{'transaction':_0x56ff91});})[_0x86d3('0x24')](function(){var _0x3db2cc={'type':db['Sequelize'][_0x86d3('0x8b')],'transaction':_0x56ff91};switch(_0x3a48a3[_0x86d3('0x52')]['type']){case _0x86d3('0x8c'):_0x3db2cc['type']=db['Sequelize'][_0x86d3('0x8b')];break;case _0x86d3('0x8d'):_0x3db2cc[_0x86d3('0x3d')]=db[_0x86d3('0x8e')][_0x86d3('0x8f')];break;case _0x86d3('0x90'):_0x3db2cc[_0x86d3('0x3d')]=db[_0x86d3('0x8e')][_0x86d3('0x91')];_0x3db2cc[_0x86d3('0x92')]=![];break;default:}return db[_0x86d3('0x89')][_0x86d3('0x93')][_0x86d3('0x94')]('cm_contacts',util[_0x86d3('0x69')](_0x86d3('0x95'),_0x50564d['id']),_0x3db2cc);})[_0x86d3('0x24')](function(){return _0x50564d;});});}})[_0x86d3('0x24')](respondWithResult(_0x2ca7c0,null))[_0x86d3('0x48')](handleError(_0x2ca7c0,null));};exports[_0x86d3('0x96')]=function(_0x5dfc29,_0x21fc0f,_0x4f2359){var _0x129b00={};var _0x388036={};var _0x51400c;var _0x49f00f;return db[_0x86d3('0x2c')][_0x86d3('0x57')]({'where':{'id':_0x5dfc29[_0x86d3('0x43')]['id']}})['then'](handleEntityNotFound(_0x21fc0f,null))['then'](function(_0x3b9e1e){if(_0x3b9e1e){_0x51400c=_0x3b9e1e;_0x388036[_0x86d3('0x2f')]=_[_0x86d3('0x31')](db['CmCustomField'][_0x86d3('0x44')]);_0x388036[_0x86d3('0x30')]=_[_0x86d3('0x31')](_0x5dfc29[_0x86d3('0x30')]);_0x388036[_0x86d3('0x32')]=_[_0x86d3('0x45')](_0x388036[_0x86d3('0x2f')],_0x388036[_0x86d3('0x30')]);_0x129b00[_0x86d3('0x33')]=_[_0x86d3('0x45')](_0x388036[_0x86d3('0x2f')],qs['fields'](_0x5dfc29[_0x86d3('0x30')]['fields']));_0x129b00['attributes']=_0x129b00[_0x86d3('0x33')][_0x86d3('0x35')]?_0x129b00['attributes']:_0x388036['model'];_0x129b00[_0x86d3('0x38')]=qs[_0x86d3('0x39')](_0x5dfc29[_0x86d3('0x30')][_0x86d3('0x39')]);_0x129b00['where']=qs[_0x86d3('0x32')](_[_0x86d3('0x3b')](_0x5dfc29[_0x86d3('0x30')],_0x388036[_0x86d3('0x32')]));_0x129b00[_0x86d3('0x3a')]=_['merge'](_0x129b00[_0x86d3('0x3a')],{'$or':[{'ListId':_0x3b9e1e['id']},{'ListId':null}]});if(_0x5dfc29[_0x86d3('0x30')][_0x86d3('0x58')]){_0x129b00['where']=_[_0x86d3('0x3c')](_0x129b00['where'],{'$or':_[_0x86d3('0x2b')](_0x129b00[_0x86d3('0x33')],function(_0x5a467d){var _0x346309={};_0x346309[_0x5a467d]={'$like':'%'+_0x5dfc29[_0x86d3('0x30')][_0x86d3('0x58')]+'%'};return _0x346309;})});}_0x129b00=_[_0x86d3('0x3c')]({},_0x129b00,_0x5dfc29[_0x86d3('0x46')]);return db[_0x86d3('0x6d')]['findAndCountAll'](_0x129b00);}})[_0x86d3('0x24')](respondWithResult(_0x21fc0f,null))['catch'](handleError(_0x21fc0f,null));};exports[_0x86d3('0x97')]=function(_0x23149a,_0x2f3fde){return db[_0x86d3('0x6d')]['findAndCountAll']({'where':{'ListId':null}})[_0x86d3('0x24')](handleEntityNotFound(_0x2f3fde,null))[_0x86d3('0x24')](function(_0x4d755a){return _0x4d755a;})[_0x86d3('0x24')](respondWithResult(_0x2f3fde,null))[_0x86d3('0x48')](handleError(_0x2f3fde,null));};exports[_0x86d3('0x98')]=function(_0x538dfb,_0x73c64,_0xb0d0a5){return db['CmList']['find']({'where':{'id':_0x538dfb[_0x86d3('0x43')]['id']}})['then'](handleEntityNotFound(_0x73c64,null))['then'](function(_0xeb0ac9){if(_0xeb0ac9){return _0xeb0ac9[_0x86d3('0x98')](_0x538dfb[_0x86d3('0x52')]['ids'],_[_0x86d3('0x99')](_0x538dfb[_0x86d3('0x52')],[_0x86d3('0x5f'),'id'])||{})[_0x86d3('0x9a')](function(_0x15473){for(var _0x56d68e=0x0;_0x56d68e<_0x538dfb[_0x86d3('0x52')][_0x86d3('0x5f')]['length'];_0x56d68e+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x538dfb[_0x86d3('0x52')]['ids'][_0x56d68e]),'CmListId':Number(_0x538dfb['params']['id'])});}return _0x15473;});}})[_0x86d3('0x24')](respondWithResult(_0x73c64,null))[_0x86d3('0x48')](handleError(_0x73c64,null));};exports['removeAgents']=function(_0x593b34,_0x32c63a,_0x191a08){return db[_0x86d3('0x2c')]['find']({'where':{'id':_0x593b34[_0x86d3('0x43')]['id']}})[_0x86d3('0x24')](handleEntityNotFound(_0x32c63a,null))[_0x86d3('0x24')](function(_0x2308c1){if(_0x2308c1){return _0x2308c1[_0x86d3('0x9b')](_0x593b34[_0x86d3('0x30')]['ids'])[_0x86d3('0x24')](function(){if(_[_0x86d3('0x5b')](_0x593b34[_0x86d3('0x30')]['ids'])){for(var _0x6bc1bd=0x0;_0x6bc1bd<_0x593b34['query'][_0x86d3('0x5f')][_0x86d3('0x35')];_0x6bc1bd+=0x1){socket[_0x86d3('0x9c')](_0x86d3('0x9d'),{'UserId':Number(_0x593b34['query']['ids'][_0x6bc1bd]),'CmListId':Number(_0x593b34[_0x86d3('0x43')]['id'])});}}else{socket[_0x86d3('0x9c')](_0x86d3('0x9d'),{'UserId':Number(_0x593b34[_0x86d3('0x30')][_0x86d3('0x5f')]),'CmListId':Number(_0x593b34[_0x86d3('0x43')]['id'])});}});}})[_0x86d3('0x24')](respondWithStatusCode(_0x32c63a,null))['catch'](handleError(_0x32c63a,null));};exports[_0x86d3('0x9e')]=function(_0x5df4bc,_0x303176,_0x16df83){var _0x4b884e={};var _0x418bc4={};var _0x5eae11;var _0x1aa647;return db[_0x86d3('0x2c')][_0x86d3('0x57')]({'where':{'id':_0x5df4bc['params']['id']}})[_0x86d3('0x24')](handleEntityNotFound(_0x303176,null))[_0x86d3('0x24')](function(_0x58738c){if(_0x58738c){_0x5eae11=_0x58738c;_0x418bc4['model']=_['keys'](db[_0x86d3('0x9f')]['rawAttributes']);_0x418bc4[_0x86d3('0x30')]=_[_0x86d3('0x31')](_0x5df4bc['query']);_0x418bc4[_0x86d3('0x32')]=_[_0x86d3('0x45')](_0x418bc4[_0x86d3('0x2f')],_0x418bc4['query']);_0x4b884e[_0x86d3('0x33')]=_[_0x86d3('0x45')](_0x418bc4[_0x86d3('0x2f')],qs[_0x86d3('0x34')](_0x5df4bc['query'][_0x86d3('0x34')]));_0x4b884e[_0x86d3('0x33')]=_0x4b884e['attributes'][_0x86d3('0x35')]?_0x4b884e[_0x86d3('0x33')]:_0x418bc4[_0x86d3('0x2f')];_0x4b884e[_0x86d3('0x38')]=qs[_0x86d3('0x39')](_0x5df4bc[_0x86d3('0x30')][_0x86d3('0x39')]);_0x4b884e[_0x86d3('0x3a')]=qs['filters'](_[_0x86d3('0x3b')](_0x5df4bc[_0x86d3('0x30')],_0x418bc4[_0x86d3('0x32')]));if(_0x5df4bc['query'][_0x86d3('0x58')]){_0x4b884e[_0x86d3('0x3a')]=_['merge'](_0x4b884e[_0x86d3('0x3a')],{'$or':_[_0x86d3('0x2b')](_0x4b884e[_0x86d3('0x33')],function(_0x45d883){var _0x186d3d={};_0x186d3d[_0x45d883]={'$like':'%'+_0x5df4bc['query']['filter']+'%'};return _0x186d3d;})});}_0x4b884e=_['merge']({},_0x4b884e,_0x5df4bc['options']);return _0x5eae11['getAgents'](_0x4b884e);}})[_0x86d3('0x24')](function(_0x3bc53c){if(_0x3bc53c){_0x1aa647=_0x3bc53c[_0x86d3('0x35')];if(!_0x5df4bc['query'][_0x86d3('0x36')](_0x86d3('0x37'))){_0x4b884e[_0x86d3('0x1f')]=qs[_0x86d3('0x1f')](_0x5df4bc['query'][_0x86d3('0x1f')]);_0x4b884e['offset']=qs[_0x86d3('0x1d')](_0x5df4bc[_0x86d3('0x30')][_0x86d3('0x1d')]);}return _0x5eae11['getAgents'](_0x4b884e);}})['then'](function(_0x32f058){if(_0x32f058){return _0x32f058?{'count':_0x1aa647,'rows':_0x32f058}:null;}})['then'](respondWithResult(_0x303176,null))[_0x86d3('0x48')](handleError(_0x303176,null));};function handleQuery(_0x3845cc){logger[_0x86d3('0xa0')](_0x3845cc);return db['sequelize'][_0x86d3('0x30')](_0x3845cc)['spread'](function(_0x1aedcc){csv_results[_0x86d3('0x61')](_0x1aedcc);})[_0x86d3('0x48')](function(_0x1548a4){logger['error'](_0x1548a4['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 5a14ec2..0e26ec9 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(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe14b,0x93));var _0xbe14=function(_0x319402,_0x2216a8){_0x319402=_0x319402-0x0;var _0x5bfdc6=_0xe14b[_0x319402];return _0x5bfdc6;};'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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3e74,0x175));var _0x43e7=function(_0x1994b9,_0x5df8a8){_0x1994b9=_0x1994b9-0x0;var _0x532f25=_0x3e74[_0x1994b9];return _0x532f25;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index fdba662..f2be4a2 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 _0x750a=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','moment','bluebird','request-promise'];(function(_0x1968a2,_0x2963f2){var _0x565681=function(_0x1ba43a){while(--_0x1ba43a){_0x1968a2['push'](_0x1968a2['shift']());}};_0x565681(++_0x2963f2);}(_0x750a,0x140));var _0xa750=function(_0x2861c8,_0x226fea){_0x2861c8=_0x2861c8-0x0;var _0x491800=_0x750a[_0x2861c8];return _0x491800;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa750('0x1'));var BPromise=require(_0xa750('0x2'));var rp=require(_0xa750('0x3'));var fs=require('fs');var path=require(_0xa750('0x4'));var rimraf=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var attributes=require(_0xa750('0x7'));module[_0xa750('0x8')]=function(_0x10b4d9,_0x2497df){return _0x10b4d9[_0xa750('0x9')](_0xa750('0xa'),attributes,{'tableName':_0xa750('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ea=['cm_lists','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList'];(function(_0x24f5b1,_0x350007){var _0x451a13=function(_0x30d668){while(--_0x30d668){_0x24f5b1['push'](_0x24f5b1['shift']());}};_0x451a13(++_0x350007);}(_0xd2ea,0x15f));var _0xad2e=function(_0x4e7d4a,_0x35cdc8){_0x4e7d4a=_0x4e7d4a-0x0;var _0x235800=_0xd2ea[_0x4e7d4a];return _0x235800;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var moment=require(_0xad2e('0x4'));var BPromise=require('bluebird');var rp=require(_0xad2e('0x5'));var fs=require('fs');var path=require(_0xad2e('0x6'));var rimraf=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var attributes=require(_0xad2e('0x9'));module[_0xad2e('0xa')]=function(_0x29e97f,_0x592e8b){return _0x29e97f[_0xad2e('0xb')](_0xad2e('0xc'),attributes,{'tableName':_0xad2e('0xd'),'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 eea41af..83b13da 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 _0xb668=['localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults'];(function(_0x1aef65,_0x521e60){var _0x4a4594=function(_0x120020){while(--_0x120020){_0x1aef65['push'](_0x1aef65['shift']());}};_0x4a4594(++_0x521e60);}(_0xb668,0x77));var _0x8b66=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb668[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x8b66('0x0'));var util=require('util');var moment=require(_0x8b66('0x1'));var BPromise=require(_0x8b66('0x2'));var rs=require(_0x8b66('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b66('0x4'))['db'];var utils=require(_0x8b66('0x5'));var logger=require(_0x8b66('0x6'))('rpc');var config=require(_0x8b66('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8b66('0x8')]['http']({'port':0x232a});config[_0x8b66('0x9')]=_[_0x8b66('0xa')](config['redis'],{'host':_0x8b66('0xb'),'port':0x18eb});var socket=require(_0x8b66('0xc'))(new Redis(config['redis']));require('./cmList.socket')[_0x8b66('0xd')](socket);function respondWithRpcPromise(_0x4f9bf7,_0x430b8b,_0x49648c){return new BPromise(function(_0x56f9d1,_0x40faf0){return client[_0x8b66('0xe')](_0x4f9bf7,_0x49648c)[_0x8b66('0xf')](function(_0x2e85f1){logger[_0x8b66('0x10')](_0x8b66('0x11'),_0x430b8b,_0x8b66('0x12'));logger[_0x8b66('0x13')](_0x8b66('0x14'),_0x430b8b,_0x8b66('0x12'),JSON['stringify'](_0x2e85f1));if(_0x2e85f1[_0x8b66('0x15')]){if(_0x2e85f1[_0x8b66('0x15')][_0x8b66('0x16')]===0x1f4){logger['error'](_0x8b66('0x11'),_0x430b8b,_0x2e85f1[_0x8b66('0x15')][_0x8b66('0x17')]);return _0x40faf0(_0x2e85f1[_0x8b66('0x15')][_0x8b66('0x17')]);}logger[_0x8b66('0x15')]('CmList,\x20%s,\x20%s',_0x430b8b,_0x2e85f1['error']['message']);return _0x56f9d1(_0x2e85f1[_0x8b66('0x15')][_0x8b66('0x17')]);}else{logger[_0x8b66('0x10')](_0x8b66('0x11'),_0x430b8b,_0x8b66('0x12'));_0x56f9d1(_0x2e85f1[_0x8b66('0x18')]['message']);}})[_0x8b66('0x19')](function(_0x3dede4){logger['error']('CmList,\x20%s,\x20%s',_0x430b8b,_0x3dede4);_0x40faf0(_0x3dede4);});});} \ No newline at end of file +var _0x5132=['request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket'];(function(_0x5391b1,_0x3771ee){var _0x564ce3=function(_0x125994){while(--_0x125994){_0x5391b1['push'](_0x5391b1['shift']());}};_0x564ce3(++_0x3771ee);}(_0x5132,0x15c));var _0x2513=function(_0x31c068,_0x47c598){_0x31c068=_0x31c068-0x0;var _0x1369c1=_0x5132[_0x31c068];return _0x1369c1;};'use strict';var _=require(_0x2513('0x0'));var util=require(_0x2513('0x1'));var moment=require(_0x2513('0x2'));var BPromise=require(_0x2513('0x3'));var rs=require(_0x2513('0x4'));var fs=require('fs');var Redis=require(_0x2513('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2513('0x6'));var logger=require(_0x2513('0x7'))(_0x2513('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2513('0x9')][_0x2513('0xa')]({'port':0x232a});config[_0x2513('0xb')]=_[_0x2513('0xc')](config['redis'],{'host':_0x2513('0xd'),'port':0x18eb});var socket=require(_0x2513('0xe'))(new Redis(config['redis']));require(_0x2513('0xf'))['register'](socket);function respondWithRpcPromise(_0x41abd0,_0x5871f8,_0x1d3d52){return new BPromise(function(_0x4cbe59,_0x97950b){return client[_0x2513('0x10')](_0x41abd0,_0x1d3d52)[_0x2513('0x11')](function(_0x5a5a50){logger[_0x2513('0x12')]('CmList,\x20%s,\x20%s',_0x5871f8,_0x2513('0x13'));logger[_0x2513('0x14')](_0x2513('0x15'),_0x5871f8,'request\x20sent',JSON[_0x2513('0x16')](_0x5a5a50));if(_0x5a5a50['error']){if(_0x5a5a50[_0x2513('0x17')][_0x2513('0x18')]===0x1f4){logger[_0x2513('0x17')](_0x2513('0x19'),_0x5871f8,_0x5a5a50[_0x2513('0x17')][_0x2513('0x1a')]);return _0x97950b(_0x5a5a50[_0x2513('0x17')][_0x2513('0x1a')]);}logger['error']('CmList,\x20%s,\x20%s',_0x5871f8,_0x5a5a50['error'][_0x2513('0x1a')]);return _0x4cbe59(_0x5a5a50[_0x2513('0x17')][_0x2513('0x1a')]);}else{logger['info'](_0x2513('0x19'),_0x5871f8,_0x2513('0x13'));_0x4cbe59(_0x5a5a50['result']['message']);}})[_0x2513('0x1b')](function(_0x24b67a){logger[_0x2513('0x17')]('CmList,\x20%s,\x20%s',_0x5871f8,_0x24b67a);_0x97950b(_0x24b67a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 5ce0066..24d66ea 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 _0xd115=['./cmList.events','remove','emit','register','length','cmList:'];(function(_0xcd9a1b,_0x3e35f8){var _0x389619=function(_0x536a82){while(--_0x536a82){_0xcd9a1b['push'](_0xcd9a1b['shift']());}};_0x389619(++_0x3e35f8);}(_0xd115,0x10e));var _0x5d11=function(_0x4c585c,_0x7b0f4c){_0x4c585c=_0x4c585c-0x0;var _0x238a38=_0xd115[_0x4c585c];return _0x238a38;};'use strict';var CmListEvents=require(_0x5d11('0x0'));var events=['save',_0x5d11('0x1'),'update'];function createListener(_0x1222ab,_0x1f4806){return function(_0x516e68){_0x1f4806[_0x5d11('0x2')](_0x1222ab,_0x516e68);};}function removeListener(_0x174b84,_0x545d59){return function(){CmListEvents['removeListener'](_0x174b84,_0x545d59);};}exports[_0x5d11('0x3')]=function(_0x4b612f){for(var _0x1c9167=0x0,_0x39e8d5=events[_0x5d11('0x4')];_0x1c9167<_0x39e8d5;_0x1c9167++){var _0x340668=events[_0x1c9167];var _0x3e7526=createListener(_0x5d11('0x5')+_0x340668,_0x4b612f);CmListEvents['on'](_0x340668,_0x3e7526);}}; \ No newline at end of file +var _0xd082=['length','./cmList.events','save','remove','update','removeListener','register'];(function(_0xee9aba,_0x3630d5){var _0x558030=function(_0x415928){while(--_0x415928){_0xee9aba['push'](_0xee9aba['shift']());}};_0x558030(++_0x3630d5);}(_0xd082,0x197));var _0x2d08=function(_0x3ffb5f,_0x32c5f8){_0x3ffb5f=_0x3ffb5f-0x0;var _0x20ea71=_0xd082[_0x3ffb5f];return _0x20ea71;};'use strict';var CmListEvents=require(_0x2d08('0x0'));var events=[_0x2d08('0x1'),_0x2d08('0x2'),_0x2d08('0x3')];function createListener(_0x1133c7,_0x3013a0){return function(_0x20b2cb){_0x3013a0['emit'](_0x1133c7,_0x20b2cb);};}function removeListener(_0x52a68e,_0x3b647f){return function(){CmListEvents[_0x2d08('0x4')](_0x52a68e,_0x3b647f);};}exports[_0x2d08('0x5')]=function(_0x5a6f75){for(var _0x558380=0x0,_0x2fd456=events[_0x2d08('0x6')];_0x558380<_0x2fd456;_0x558380++){var _0x4ecb08=events[_0x558380];var _0x2b907d=createListener('cmList:'+_0x4ecb08,_0x5a6f75);CmListEvents['on'](_0x4ecb08,_0x2b907d);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9ca74fd..7f07c6f 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 _0x2392=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addCustomField','addAgents','/:id','update','delete','removeDispositions','removeAgents','exports','multer','util'];(function(_0x33aa9d,_0x340550){var _0x43679e=function(_0x5cddd9){while(--_0x5cddd9){_0x33aa9d['push'](_0x33aa9d['shift']());}};_0x43679e(++_0x340550);}(_0x2392,0xd0));var _0x2239=function(_0x40f8d2,_0x51e9e0){_0x40f8d2=_0x40f8d2-0x0;var _0x258bdb=_0x2392[_0x40f8d2];return _0x258bdb;};'use strict';var multer=require(_0x2239('0x0'));var util=require(_0x2239('0x1'));var path=require('path');var timeout=require(_0x2239('0x2'));var express=require(_0x2239('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2239('0x4'));var interaction=require(_0x2239('0x5'));var config=require(_0x2239('0x6'));var controller=require(_0x2239('0x7'));router[_0x2239('0x8')]('/',auth[_0x2239('0x9')](),controller[_0x2239('0xa')]);router[_0x2239('0x8')](_0x2239('0xb'),auth[_0x2239('0x9')](),controller[_0x2239('0xc')]);router[_0x2239('0x8')](_0x2239('0xd'),auth['isAuthenticated'](),controller[_0x2239('0xe')]);router[_0x2239('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2239('0xf')]);router[_0x2239('0x8')](_0x2239('0x10'),auth[_0x2239('0x9')](),controller[_0x2239('0x11')]);router[_0x2239('0x8')](_0x2239('0x12'),auth['isAuthenticated'](),controller[_0x2239('0x13')]);router[_0x2239('0x8')]('/:id/contacts/csv',auth[_0x2239('0x9')](),controller[_0x2239('0x14')]);router[_0x2239('0x8')](_0x2239('0x15'),auth['isAuthenticated'](),controller[_0x2239('0x16')]);router['get'](_0x2239('0x17'),auth[_0x2239('0x9')](),controller[_0x2239('0x18')]);router[_0x2239('0x19')]('/',auth['isAuthenticated'](),controller[_0x2239('0x1a')]);router[_0x2239('0x19')]('/:id/dispositions',auth[_0x2239('0x9')](),controller['addDisposition']);router[_0x2239('0x19')]('/:id/contacts',auth[_0x2239('0x9')](),controller['addContacts']);router[_0x2239('0x19')](_0x2239('0x15'),auth[_0x2239('0x9')](),controller[_0x2239('0x1b')]);router['post'](_0x2239('0x17'),auth['isAuthenticated'](),controller[_0x2239('0x1c')]);router['put'](_0x2239('0x1d'),auth[_0x2239('0x9')](),controller[_0x2239('0x1e')]);router['delete']('/:id',auth[_0x2239('0x9')](),controller['destroy']);router[_0x2239('0x1f')](_0x2239('0x10'),auth[_0x2239('0x9')](),controller[_0x2239('0x20')]);router['delete'](_0x2239('0x17'),auth[_0x2239('0x9')](),controller[_0x2239('0x21')]);module[_0x2239('0x22')]=router; \ No newline at end of file +var _0xb81d=['/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','/:id/contacts','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0xb81d,0xb4));var _0xdb81=function(_0x520ea7,_0x1cbddc){_0x520ea7=_0x520ea7-0x0;var _0x47a57c=_0xb81d[_0x520ea7];return _0x47a57c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdb81('0x0'));var timeout=require(_0xdb81('0x1'));var express=require(_0xdb81('0x2'));var router=express['Router']();var fs_extra=require(_0xdb81('0x3'));var auth=require(_0xdb81('0x4'));var interaction=require(_0xdb81('0x5'));var config=require(_0xdb81('0x6'));var controller=require(_0xdb81('0x7'));router[_0xdb81('0x8')]('/',auth[_0xdb81('0x9')](),controller['index']);router[_0xdb81('0x8')](_0xdb81('0xa'),auth[_0xdb81('0x9')](),controller[_0xdb81('0xb')]);router[_0xdb81('0x8')](_0xdb81('0xc'),auth[_0xdb81('0x9')](),controller[_0xdb81('0xd')]);router['get'](_0xdb81('0xe'),auth[_0xdb81('0x9')](),controller[_0xdb81('0xf')]);router[_0xdb81('0x8')]('/:id/dispositions',auth[_0xdb81('0x9')](),controller[_0xdb81('0x10')]);router['get']('/:id/contacts',auth[_0xdb81('0x9')](),controller[_0xdb81('0x11')]);router['get'](_0xdb81('0x12'),auth[_0xdb81('0x9')](),controller[_0xdb81('0x13')]);router[_0xdb81('0x8')](_0xdb81('0x14'),auth[_0xdb81('0x9')](),controller[_0xdb81('0x15')]);router[_0xdb81('0x8')](_0xdb81('0x16'),auth[_0xdb81('0x9')](),controller[_0xdb81('0x17')]);router[_0xdb81('0x18')]('/',auth[_0xdb81('0x9')](),controller[_0xdb81('0x19')]);router[_0xdb81('0x18')](_0xdb81('0x1a'),auth[_0xdb81('0x9')](),controller['addDisposition']);router['post'](_0xdb81('0x1b'),auth[_0xdb81('0x9')](),controller[_0xdb81('0x1c')]);router['post']('/:id/fields',auth[_0xdb81('0x9')](),controller[_0xdb81('0x1d')]);router[_0xdb81('0x18')]('/:id/users',auth[_0xdb81('0x9')](),controller[_0xdb81('0x1e')]);router[_0xdb81('0x1f')](_0xdb81('0xe'),auth[_0xdb81('0x9')](),controller[_0xdb81('0x20')]);router[_0xdb81('0x21')]('/:id',auth['isAuthenticated'](),controller[_0xdb81('0x22')]);router[_0xdb81('0x21')](_0xdb81('0x1a'),auth[_0xdb81('0x9')](),controller[_0xdb81('0x23')]);router[_0xdb81('0x21')]('/:id/users',auth[_0xdb81('0x9')](),controller[_0xdb81('0x24')]);module[_0xdb81('0x25')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 4e2d981..9e05ea6 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 _0xc63f=['sequelize','VIRTUAL','field','STRING'];(function(_0x33e317,_0xb080fe){var _0x5d17b6=function(_0x5d8572){while(--_0x5d8572){_0x33e317['push'](_0x33e317['shift']());}};_0x5d17b6(++_0xb080fe);}(_0xc63f,0xb0));var _0xfc63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc63f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfc63('0x0'));module['exports']={'name':{'type':Sequelize[_0xfc63('0x1')],'get':function(_0x4f48b0){return this['getDataValue'](_0xfc63('0x2'));}},'field':{'type':Sequelize[_0xfc63('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xfc63('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x1033=['field','STRING','exports','VIRTUAL','getDataValue'];(function(_0x1998f7,_0x2e5740){var _0x595adb=function(_0x58a54e){while(--_0x58a54e){_0x1998f7['push'](_0x1998f7['shift']());}};_0x595adb(++_0x2e5740);}(_0x1033,0x1b0));var _0x3103=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x1033[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require('sequelize');module[_0x3103('0x0')]={'name':{'type':Sequelize[_0x3103('0x1')],'get':function(_0x557b2f){return this[_0x3103('0x2')](_0x3103('0x3'));}},'field':{'type':Sequelize[_0x3103('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x3103('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x3103('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index a714e6d..0ae15cd 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x56f914,_0x5bda3b){var _0x218ec8=function(_0x1bae77){while(--_0x1bae77){_0x56f914['push'](_0x56f914['shift']());}};_0x218ec8(++_0x5bda3b);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +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(_0x5624f3,_0x14c782){var _0x136d30=function(_0x4cafff){while(--_0x4cafff){_0x5624f3['push'](_0x5624f3['shift']());}};_0x136d30(++_0x14c782);}(_0x7a54,0x106));var _0x47a5=function(_0x3ffdb3,_0x47d908){_0x3ffdb3=_0x3ffdb3-0x0;var _0x435822=_0x7a54[_0x3ffdb3];return _0x435822;};'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 1f24144..a65fb6a 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 _0x5887=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','Condition','tools_conditions','lodash'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5887,0xd7));var _0x7588=function(_0x4f7e37,_0x291c9f){_0x4f7e37=_0x4f7e37-0x0;var _0x442ea8=_0x5887[_0x4f7e37];return _0x442ea8;};'use strict';var _=require(_0x7588('0x0'));var util=require(_0x7588('0x1'));var logger=require(_0x7588('0x2'))('api');var moment=require(_0x7588('0x3'));var BPromise=require('bluebird');var rp=require(_0x7588('0x4'));var fs=require('fs');var path=require(_0x7588('0x5'));var rimraf=require(_0x7588('0x6'));var config=require(_0x7588('0x7'));var attributes=require(_0x7588('0x8'));module[_0x7588('0x9')]=function(_0x463422,_0x1a24c1){return _0x463422['define'](_0x7588('0xa'),attributes,{'tableName':_0x7588('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26db=['./condition.attributes','exports','define','Condition','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x415260,_0x135fcb){var _0x490f21=function(_0x28d91c){while(--_0x28d91c){_0x415260['push'](_0x415260['shift']());}};_0x490f21(++_0x135fcb);}(_0x26db,0x170));var _0xb26d=function(_0x13259e,_0x2b427d){_0x13259e=_0x13259e-0x0;var _0xc38144=_0x26db[_0x13259e];return _0xc38144;};'use strict';var _=require('lodash');var util=require(_0xb26d('0x0'));var logger=require(_0xb26d('0x1'))(_0xb26d('0x2'));var moment=require(_0xb26d('0x3'));var BPromise=require(_0xb26d('0x4'));var rp=require(_0xb26d('0x5'));var fs=require('fs');var path=require(_0xb26d('0x6'));var rimraf=require(_0xb26d('0x7'));var config=require(_0xb26d('0x8'));var attributes=require(_0xb26d('0x9'));module[_0xb26d('0xa')]=function(_0x29abda,_0x3ec981){return _0x29abda[_0xb26d('0xb')](_0xb26d('0xc'),attributes,{'tableName':'tools_conditions','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 f058366..7d2796b 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 _0x00a7=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x132043,_0x29f20a){var _0x718d13=function(_0x2f9071){while(--_0x2f9071){_0x132043['push'](_0x132043['shift']());}};_0x718d13(++_0x29f20a);}(_0x00a7,0x131));var _0x700a=function(_0x3b18e7,_0x251137){_0x3b18e7=_0x3b18e7-0x0;var _0x35eb49=_0x00a7[_0x3b18e7];return _0x35eb49;};'use strict';var _=require(_0x700a('0x0'));var util=require(_0x700a('0x1'));var moment=require(_0x700a('0x2'));var BPromise=require(_0x700a('0x3'));var rs=require(_0x700a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x700a('0x5'))['db'];var utils=require(_0x700a('0x6'));var logger=require(_0x700a('0x7'))(_0x700a('0x8'));var config=require(_0x700a('0x9'));var jayson=require(_0x700a('0xa'));var client=jayson['client'][_0x700a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42c2fa,_0x1a0cae,_0x30d211){return new BPromise(function(_0x15ac9c,_0x4943ba){return client['request'](_0x42c2fa,_0x30d211)[_0x700a('0xc')](function(_0x2eaf4d){logger[_0x700a('0xd')](_0x700a('0xe'),_0x1a0cae,_0x700a('0xf'));logger[_0x700a('0x10')](_0x700a('0x11'),_0x1a0cae,_0x700a('0xf'),JSON[_0x700a('0x12')](_0x2eaf4d));if(_0x2eaf4d[_0x700a('0x13')]){if(_0x2eaf4d[_0x700a('0x13')]['code']===0x1f4){logger[_0x700a('0x13')](_0x700a('0xe'),_0x1a0cae,_0x2eaf4d[_0x700a('0x13')][_0x700a('0x14')]);return _0x4943ba(_0x2eaf4d[_0x700a('0x13')][_0x700a('0x14')]);}logger[_0x700a('0x13')](_0x700a('0xe'),_0x1a0cae,_0x2eaf4d[_0x700a('0x13')]['message']);return _0x15ac9c(_0x2eaf4d[_0x700a('0x13')][_0x700a('0x14')]);}else{logger['info'](_0x700a('0xe'),_0x1a0cae,_0x700a('0xf'));_0x15ac9c(_0x2eaf4d[_0x700a('0x15')][_0x700a('0x14')]);}})[_0x700a('0x16')](function(_0x4d29a4){logger['error'](_0x700a('0xe'),_0x1a0cae,_0x4d29a4);_0x4943ba(_0x4d29a4);});});} \ No newline at end of file +var _0xf706=['request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','Condition,\x20%s,\x20%s','debug','stringify','error','message','info'];(function(_0x5c6fab,_0x37fafa){var _0x3207eb=function(_0x34f697){while(--_0x34f697){_0x5c6fab['push'](_0x5c6fab['shift']());}};_0x3207eb(++_0x37fafa);}(_0xf706,0x1a7));var _0x6f70=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xf706[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x6f70('0x0'));var util=require(_0x6f70('0x1'));var moment=require(_0x6f70('0x2'));var BPromise=require(_0x6f70('0x3'));var rs=require(_0x6f70('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f70('0x5'))['db'];var utils=require(_0x6f70('0x6'));var logger=require(_0x6f70('0x7'))('rpc');var config=require(_0x6f70('0x8'));var jayson=require(_0x6f70('0x9'));var client=jayson['client'][_0x6f70('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x199d77,_0x269616,_0x58ba1d){return new BPromise(function(_0x4cb6d0,_0x530810){return client[_0x6f70('0xb')](_0x199d77,_0x58ba1d)['then'](function(_0x44b274){logger['info'](_0x6f70('0xc'),_0x269616,'request\x20sent');logger[_0x6f70('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x269616,'request\x20sent',JSON[_0x6f70('0xe')](_0x44b274));if(_0x44b274[_0x6f70('0xf')]){if(_0x44b274[_0x6f70('0xf')]['code']===0x1f4){logger[_0x6f70('0xf')]('Condition,\x20%s,\x20%s',_0x269616,_0x44b274[_0x6f70('0xf')]['message']);return _0x530810(_0x44b274[_0x6f70('0xf')][_0x6f70('0x10')]);}logger['error'](_0x6f70('0xc'),_0x269616,_0x44b274[_0x6f70('0xf')][_0x6f70('0x10')]);return _0x4cb6d0(_0x44b274[_0x6f70('0xf')][_0x6f70('0x10')]);}else{logger[_0x6f70('0x11')](_0x6f70('0xc'),_0x269616,_0x6f70('0x12'));_0x4cb6d0(_0x44b274[_0x6f70('0x13')][_0x6f70('0x10')]);}})[_0x6f70('0x14')](function(_0xccbdea){logger[_0x6f70('0xf')](_0x6f70('0xc'),_0x269616,_0xccbdea);_0x530810(_0xccbdea);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 862d791..31dcfab 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 _0x2e30=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','/:id','destroy','exports','multer','util'];(function(_0x3ce6d2,_0x90364d){var _0x4c1dd4=function(_0x3b2e50){while(--_0x3b2e50){_0x3ce6d2['push'](_0x3ce6d2['shift']());}};_0x4c1dd4(++_0x90364d);}(_0x2e30,0x6e));var _0x02e3=function(_0xf2fc8e,_0xf574d7){_0xf2fc8e=_0xf2fc8e-0x0;var _0xf793fb=_0x2e30[_0xf2fc8e];return _0xf793fb;};'use strict';var multer=require(_0x02e3('0x0'));var util=require(_0x02e3('0x1'));var path=require(_0x02e3('0x2'));var timeout=require(_0x02e3('0x3'));var express=require(_0x02e3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x02e3('0x5'));var interaction=require(_0x02e3('0x6'));var config=require(_0x02e3('0x7'));var controller=require(_0x02e3('0x8'));router[_0x02e3('0x9')]('/:id',auth[_0x02e3('0xa')](),controller['update']);router['delete'](_0x02e3('0xb'),auth[_0x02e3('0xa')](),controller[_0x02e3('0xc')]);module[_0x02e3('0xd')]=router; \ No newline at end of file +var _0xc26e=['exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','update','isAuthenticated'];(function(_0x4cd21c,_0x35fa45){var _0x5d8e5e=function(_0x3af223){while(--_0x3af223){_0x4cd21c['push'](_0x4cd21c['shift']());}};_0x5d8e5e(++_0x35fa45);}(_0xc26e,0x109));var _0xec26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc26e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xec26('0x0'));var path=require(_0xec26('0x1'));var timeout=require('connect-timeout');var express=require(_0xec26('0x2'));var router=express['Router']();var fs_extra=require(_0xec26('0x3'));var auth=require(_0xec26('0x4'));var interaction=require(_0xec26('0x5'));var config=require(_0xec26('0x6'));var controller=require('./condition.controller');router[_0xec26('0x7')](_0xec26('0x8'),auth['isAuthenticated'](),controller[_0xec26('0x9')]);router['delete']('/:id',auth[_0xec26('0xa')](),controller['destroy']);module[_0xec26('0xb')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 7832a8c..4647fd4 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 _0xc20c=['name','INTEGER','sequelize','STRING'];(function(_0x38ec14,_0xb7db5a){var _0x4c70b1=function(_0x49d2c5){while(--_0x49d2c5){_0x38ec14['push'](_0x38ec14['shift']());}};_0x4c70b1(++_0xb7db5a);}(_0xc20c,0x182));var _0xcc20=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xc20c[_0x368fb9];return _0x4892fb;};'use strict';var Sequelize=require(_0xcc20('0x0'));module['exports']={'name':{'type':Sequelize[_0xcc20('0x1')],'allowNull':![],'unique':_0xcc20('0x2')},'OrderBy':{'type':Sequelize[_0xcc20('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x48eb=['INTEGER','STRING','exports','name'];(function(_0xab5a87,_0x438bd3){var _0x284c2a=function(_0x233c86){while(--_0x233c86){_0xab5a87['push'](_0xab5a87['shift']());}};_0x284c2a(++_0x438bd3);}(_0x48eb,0xce));var _0xb48e=function(_0x4a8b0b,_0x361344){_0x4a8b0b=_0x4a8b0b-0x0;var _0x5322e7=_0x48eb[_0x4a8b0b];return _0x5322e7;};'use strict';var Sequelize=require('sequelize');module[_0xb48e('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb48e('0x1')},'OrderBy':{'type':Sequelize[_0xb48e('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xb48e('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 9f2db9a..95071a9 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 _0xb78e=['find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','CmContactHasItem','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','json','apply','reject','save','destroy','ContactItemTypes','UserProfileResource','then','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show'];(function(_0x102090,_0x236c7a){var _0xf5777f=function(_0x3872cf){while(--_0x3872cf){_0x102090['push'](_0x102090['shift']());}};_0xf5777f(++_0x236c7a);}(_0xb78e,0x1c9));var _0xeb78=function(_0xc889b4,_0x2b0c26){_0xc889b4=_0xc889b4-0x0;var _0xb7a71c=_0xb78e[_0xc889b4];return _0xb7a71c;};'use strict';var emlformat=require(_0xeb78('0x0'));var rimraf=require(_0xeb78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb78('0x2'));var rp=require(_0xeb78('0x3'));var moment=require(_0xeb78('0x4'));var BPromise=require(_0xeb78('0x5'));var Mustache=require(_0xeb78('0x6'));var util=require(_0xeb78('0x7'));var path=require(_0xeb78('0x8'));var sox=require(_0xeb78('0x9'));var csv=require('to-csv');var ejs=require(_0xeb78('0xa'));var fs=require('fs');var fs_extra=require(_0xeb78('0xb'));var _=require(_0xeb78('0xc'));var squel=require(_0xeb78('0xd'));var crypto=require(_0xeb78('0xe'));var jsforce=require(_0xeb78('0xf'));var deskjs=require(_0xeb78('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeb78('0x11'));var Papa=require(_0xeb78('0x12'));var Redis=require(_0xeb78('0x13'));var authService=require(_0xeb78('0x14'));var qs=require(_0xeb78('0x15'));var as=require(_0xeb78('0x16'));var hardwareService=require(_0xeb78('0x17'));var logger=require(_0xeb78('0x18'))(_0xeb78('0x19'));var utils=require('../../config/utils');var config=require(_0xeb78('0x1a'));var licenseUtil=require(_0xeb78('0x1b'));var db=require(_0xeb78('0x1c'))['db'];function respondWithStatusCode(_0x259df2,_0x9dbe51){_0x9dbe51=_0x9dbe51||0xcc;return function(_0x28c58c){if(_0x28c58c){return _0x259df2[_0xeb78('0x1d')](_0x9dbe51);}return _0x259df2[_0xeb78('0x1e')](_0x9dbe51)[_0xeb78('0x1f')]();};}function respondWithResult(_0x9bcc79,_0x5d50cf){_0x5d50cf=_0x5d50cf||0xc8;return function(_0x315914){if(_0x315914){return _0x9bcc79[_0xeb78('0x1e')](_0x5d50cf)['json'](_0x315914);}};}function respondWithFilteredResult(_0x538485,_0x53be89){return function(_0x23a0d0){if(_0x23a0d0){var _0x50ebae=typeof _0x53be89[_0xeb78('0x20')]===_0xeb78('0x21')&&typeof _0x53be89['limit']===_0xeb78('0x21');var _0x53c811=_0x23a0d0[_0xeb78('0x22')];var _0x92e410=_0x50ebae?0x0:_0x53be89['offset'];var _0x45176e=_0x50ebae?_0x23a0d0[_0xeb78('0x22')]:_0x53be89[_0xeb78('0x20')]+_0x53be89['limit'];var _0x24d845;if(_0x45176e>=_0x53c811){_0x45176e=_0x53c811;_0x24d845=0xc8;}else{_0x24d845=0xce;}_0x538485[_0xeb78('0x1e')](_0x24d845);return _0x538485['set']('Content-Range',_0x92e410+'-'+_0x45176e+'/'+_0x53c811)[_0xeb78('0x23')](_0x23a0d0);}return null;};}function patchUpdates(_0x106c5d){return function(_0x42eacb){try{jsonpatch[_0xeb78('0x24')](_0x42eacb,_0x106c5d,!![]);}catch(_0x432b18){return BPromise[_0xeb78('0x25')](_0x432b18);}return _0x42eacb[_0xeb78('0x26')]();};}function saveUpdates(_0x3ea071,_0x18f08d){return function(_0x52b8c1){if(_0x52b8c1){return _0x52b8c1['update'](_0x3ea071)['then'](function(_0x5c9e0d){return _0x5c9e0d;});}return null;};}function removeEntity(_0x3c8e66,_0x5b15d8){return function(_0x2159c1){if(_0x2159c1){return _0x2159c1[_0xeb78('0x27')]()['then'](function(){var _0x777ca3=_0x2159c1['get']({'plain':!![]});var _0x9a00b=_0xeb78('0x28');return db[_0xeb78('0x29')][_0xeb78('0x27')]({'where':{'type':_0x9a00b,'resourceId':_0x777ca3['id']}})['then'](function(){return _0x2159c1;});})[_0xeb78('0x2a')](function(){_0x3c8e66['status'](0xcc)[_0xeb78('0x1f')]();});}};}function handleEntityNotFound(_0x23295a,_0x4493bb){return function(_0x5263fc){if(!_0x5263fc){_0x23295a[_0xeb78('0x1d')](0x194);}return _0x5263fc;};}function handleError(_0x1e7d56,_0x1c04dd){_0x1c04dd=_0x1c04dd||0x1f4;return function(_0x381b2f){logger[_0xeb78('0x2b')](_0x381b2f[_0xeb78('0x2c')]);if(_0x381b2f[_0xeb78('0x2d')]){delete _0x381b2f[_0xeb78('0x2d')];}_0x1e7d56[_0xeb78('0x1e')](_0x1c04dd)[_0xeb78('0x2e')](_0x381b2f);};}exports[_0xeb78('0x2f')]=function(_0x505468,_0x555d89){var _0x4d12a3={},_0xb3a935={},_0x4253ea={'count':0x0,'rows':[]};var _0x15327f=_['map'](db[_0xeb78('0x30')][_0xeb78('0x31')],function(_0x3de59f){return{'name':_0x3de59f[_0xeb78('0x32')],'type':_0x3de59f[_0xeb78('0x33')][_0xeb78('0x34')]};});_0xb3a935[_0xeb78('0x35')]=_[_0xeb78('0x36')](_0x15327f,_0xeb78('0x2d'));_0xb3a935['query']=_[_0xeb78('0x37')](_0x505468['query']);_0xb3a935[_0xeb78('0x38')]=_[_0xeb78('0x39')](_0xb3a935[_0xeb78('0x35')],_0xb3a935[_0xeb78('0x3a')]);_0x4d12a3[_0xeb78('0x3b')]=_[_0xeb78('0x39')](_0xb3a935['model'],qs['fields'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x3c')]));_0x4d12a3[_0xeb78('0x3b')]=_0x4d12a3[_0xeb78('0x3b')][_0xeb78('0x3d')]?_0x4d12a3['attributes']:_0xb3a935[_0xeb78('0x35')];if(!_0x505468[_0xeb78('0x3a')][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x4d12a3[_0xeb78('0x40')]=qs[_0xeb78('0x40')](_0x505468['query']['limit']);_0x4d12a3['offset']=qs['offset'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x20')]);}_0x4d12a3[_0xeb78('0x41')]=qs['sort'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x42')]);_0x4d12a3['where']=qs['filters'](_['pick'](_0x505468[_0xeb78('0x3a')],_0xb3a935[_0xeb78('0x38')]),_0x15327f);if(_0x505468[_0xeb78('0x3a')]['filter']){_0x4d12a3[_0xeb78('0x43')]=_[_0xeb78('0x44')](_0x4d12a3[_0xeb78('0x43')],{'$or':_['map'](_0x15327f,function(_0xf0f13c){if(_0xf0f13c[_0xeb78('0x33')]!==_0xeb78('0x45')){var _0x437590={};_0x437590[_0xf0f13c['name']]={'$like':'%'+_0x505468['query'][_0xeb78('0x46')]+'%'};return _0x437590;}})});}_0x4d12a3=_[_0xeb78('0x44')]({},_0x4d12a3,_0x505468[_0xeb78('0x47')]);var _0x183095={'where':_0x4d12a3[_0xeb78('0x43')]};return db[_0xeb78('0x30')][_0xeb78('0x22')](_0x183095)[_0xeb78('0x2a')](function(_0x47567d){_0x4253ea['count']=_0x47567d;if(_0x505468[_0xeb78('0x3a')][_0xeb78('0x48')]){_0x4d12a3[_0xeb78('0x49')]=[{'all':!![]}];}return db['ContactItemType'][_0xeb78('0x4a')](_0x4d12a3);})['then'](function(_0x21f81b){_0x4253ea[_0xeb78('0x4b')]=_0x21f81b;return _0x4253ea;})[_0xeb78('0x2a')](respondWithFilteredResult(_0x555d89,_0x4d12a3))['catch'](handleError(_0x555d89,null));};exports[_0xeb78('0x4c')]=function(_0x3ab487,_0x390051){var _0x2944d8={'raw':!![],'where':{'id':_0x3ab487['params']['id']}},_0x2dc9f7={};_0x2dc9f7[_0xeb78('0x35')]=_[_0xeb78('0x37')](db['ContactItemType'][_0xeb78('0x31')]);_0x2dc9f7[_0xeb78('0x3a')]=_[_0xeb78('0x37')](_0x3ab487['query']);_0x2dc9f7[_0xeb78('0x38')]=_[_0xeb78('0x39')](_0x2dc9f7[_0xeb78('0x35')],_0x2dc9f7[_0xeb78('0x3a')]);_0x2944d8[_0xeb78('0x3b')]=_[_0xeb78('0x39')](_0x2dc9f7['model'],qs['fields'](_0x3ab487[_0xeb78('0x3a')][_0xeb78('0x3c')]));_0x2944d8['attributes']=_0x2944d8[_0xeb78('0x3b')][_0xeb78('0x3d')]?_0x2944d8[_0xeb78('0x3b')]:_0x2dc9f7[_0xeb78('0x35')];if(_0x3ab487[_0xeb78('0x3a')][_0xeb78('0x48')]){_0x2944d8[_0xeb78('0x49')]=[{'all':!![]}];}_0x2944d8=_[_0xeb78('0x44')]({},_0x2944d8,_0x3ab487[_0xeb78('0x47')]);return db[_0xeb78('0x30')][_0xeb78('0x4d')](_0x2944d8)[_0xeb78('0x2a')](handleEntityNotFound(_0x390051,null))[_0xeb78('0x2a')](respondWithResult(_0x390051,null))[_0xeb78('0x4e')](handleError(_0x390051,null));};exports[_0xeb78('0x4f')]=function(_0x58e361,_0x2c4616){return db[_0xeb78('0x30')][_0xeb78('0x4f')](_0x58e361[_0xeb78('0x50')],{})['then'](function(_0x35cedb){var _0x135106=_0x58e361[_0xeb78('0x51')][_0xeb78('0x52')]({'plain':!![]});if(!_0x135106)throw new Error(_0xeb78('0x53'));if(_0x135106['role']==='user'){var _0x553f6d=_0x35cedb[_0xeb78('0x52')]({'plain':!![]});var _0x21ee21='ContactItemTypes';return db[_0xeb78('0x54')][_0xeb78('0x4d')]({'where':{'name':_0x21ee21,'userProfileId':_0x135106[_0xeb78('0x55')]},'raw':!![]})['then'](function(_0x4d6a21){if(_0x4d6a21&&_0x4d6a21[_0xeb78('0x56')]===0x0){return db[_0xeb78('0x29')][_0xeb78('0x4f')]({'name':_0x553f6d['name'],'resourceId':_0x553f6d['id'],'type':_0x4d6a21[_0xeb78('0x2d')],'sectionId':_0x4d6a21['id']},{})[_0xeb78('0x2a')](function(){return _0x35cedb;});}else{return _0x35cedb;}})[_0xeb78('0x4e')](function(_0x4a3c91){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a3c91);throw _0x4a3c91;});}return _0x35cedb;})[_0xeb78('0x2a')](respondWithResult(_0x2c4616,0xc9))[_0xeb78('0x4e')](handleError(_0x2c4616,null));};exports['update']=function(_0x2b42f6,_0x31eb10){if(_0x2b42f6[_0xeb78('0x50')]['id']){delete _0x2b42f6['body']['id'];}return db[_0xeb78('0x30')]['find']({'where':{'id':_0x2b42f6[_0xeb78('0x57')]['id']}})[_0xeb78('0x2a')](handleEntityNotFound(_0x31eb10,null))[_0xeb78('0x2a')](saveUpdates(_0x2b42f6['body'],null))['then'](respondWithResult(_0x31eb10,null))['catch'](handleError(_0x31eb10,null));};exports['destroy']=function(_0x3238e9,_0x51f51f){return db[_0xeb78('0x30')][_0xeb78('0x4d')]({'where':{'id':_0x3238e9[_0xeb78('0x57')]['id']}})[_0xeb78('0x2a')](handleEntityNotFound(_0x51f51f,null))[_0xeb78('0x2a')](db[_0xeb78('0x58')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3238e9['params']['id']}}))[_0xeb78('0x2a')](removeEntity(_0x51f51f,null))[_0xeb78('0x4e')](handleError(_0x51f51f,null));}; \ No newline at end of file +var _0xdb28=['params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','get','ContactItemTypes','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','options','ContactItemType','includeAll','include','findAll','rows','catch','show'];(function(_0x28e044,_0x3bc7b2){var _0x83a367=function(_0x5918e6){while(--_0x5918e6){_0x28e044['push'](_0x28e044['shift']());}};_0x83a367(++_0x3bc7b2);}(_0xdb28,0x106));var _0x8db2=function(_0x144c3d,_0x43b0d8){_0x144c3d=_0x144c3d-0x0;var _0x23b717=_0xdb28[_0x144c3d];return _0x23b717;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){var _0x4d923c=_0x4f6516[_0x8db2('0x25')]({'plain':!![]});var _0x29b5cd=_0x8db2('0x26');return db[_0x8db2('0x27')][_0x8db2('0x28')]({'where':{'type':_0x29b5cd,'resourceId':_0x4d923c['id']}})[_0x8db2('0x24')](function(){return _0x4f6516;});})['then'](function(){_0x5c6614[_0x8db2('0x19')](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x430dd5,_0x8b7cec){return function(_0x483aee){if(!_0x483aee){_0x430dd5[_0x8db2('0x29')](0x194);}return _0x483aee;};}function handleError(_0x11f398,_0x241baf){_0x241baf=_0x241baf||0x1f4;return function(_0x1687ed){logger[_0x8db2('0x2a')](_0x1687ed[_0x8db2('0x2b')]);if(_0x1687ed[_0x8db2('0x2c')]){delete _0x1687ed[_0x8db2('0x2c')];}_0x11f398[_0x8db2('0x19')](_0x241baf)['send'](_0x1687ed);};}exports[_0x8db2('0x2d')]=function(_0x50b28d,_0x59cb77){var _0x302188={},_0x25ed2c={},_0xcc8a66={'count':0x0,'rows':[]};var _0x49b2b3=_[_0x8db2('0x2e')](db['ContactItemType'][_0x8db2('0x2f')],function(_0x2b653b){return{'name':_0x2b653b[_0x8db2('0x30')],'type':_0x2b653b['type']['key']};});_0x25ed2c[_0x8db2('0x31')]=_[_0x8db2('0x2e')](_0x49b2b3,'name');_0x25ed2c['query']=_[_0x8db2('0x32')](_0x50b28d[_0x8db2('0x33')]);_0x25ed2c[_0x8db2('0x34')]=_[_0x8db2('0x35')](_0x25ed2c[_0x8db2('0x31')],_0x25ed2c[_0x8db2('0x33')]);_0x302188[_0x8db2('0x36')]=_[_0x8db2('0x35')](_0x25ed2c[_0x8db2('0x31')],qs[_0x8db2('0x37')](_0x50b28d['query'][_0x8db2('0x37')]));_0x302188[_0x8db2('0x36')]=_0x302188['attributes'][_0x8db2('0x38')]?_0x302188[_0x8db2('0x36')]:_0x25ed2c['model'];if(!_0x50b28d['query'][_0x8db2('0x39')]('nolimit')){_0x302188[_0x8db2('0x1f')]=qs[_0x8db2('0x1f')](_0x50b28d[_0x8db2('0x33')][_0x8db2('0x1f')]);_0x302188['offset']=qs[_0x8db2('0x1c')](_0x50b28d['query'][_0x8db2('0x1c')]);}_0x302188[_0x8db2('0x3a')]=qs[_0x8db2('0x3b')](_0x50b28d[_0x8db2('0x33')]['sort']);_0x302188['where']=qs[_0x8db2('0x34')](_[_0x8db2('0x3c')](_0x50b28d['query'],_0x25ed2c[_0x8db2('0x34')]),_0x49b2b3);if(_0x50b28d[_0x8db2('0x33')][_0x8db2('0x3d')]){_0x302188['where']=_[_0x8db2('0x3e')](_0x302188[_0x8db2('0x3f')],{'$or':_[_0x8db2('0x2e')](_0x49b2b3,function(_0x279e74){if(_0x279e74[_0x8db2('0x40')]!==_0x8db2('0x41')){var _0x380046={};_0x380046[_0x279e74[_0x8db2('0x2c')]]={'$like':'%'+_0x50b28d[_0x8db2('0x33')][_0x8db2('0x3d')]+'%'};return _0x380046;}})});}_0x302188=_[_0x8db2('0x3e')]({},_0x302188,_0x50b28d[_0x8db2('0x42')]);var _0x1d9025={'where':_0x302188['where']};return db[_0x8db2('0x43')][_0x8db2('0x1e')](_0x1d9025)['then'](function(_0x49a7ae){_0xcc8a66[_0x8db2('0x1e')]=_0x49a7ae;if(_0x50b28d['query'][_0x8db2('0x44')]){_0x302188[_0x8db2('0x45')]=[{'all':!![]}];}return db[_0x8db2('0x43')][_0x8db2('0x46')](_0x302188);})[_0x8db2('0x24')](function(_0x30d606){_0xcc8a66[_0x8db2('0x47')]=_0x30d606;return _0xcc8a66;})['then'](respondWithFilteredResult(_0x59cb77,_0x302188))[_0x8db2('0x48')](handleError(_0x59cb77,null));};exports[_0x8db2('0x49')]=function(_0x40c69e,_0x4a0b56){var _0x482b26={'raw':!![],'where':{'id':_0x40c69e[_0x8db2('0x4a')]['id']}},_0x424c27={};_0x424c27[_0x8db2('0x31')]=_[_0x8db2('0x32')](db['ContactItemType'][_0x8db2('0x2f')]);_0x424c27['query']=_[_0x8db2('0x32')](_0x40c69e[_0x8db2('0x33')]);_0x424c27[_0x8db2('0x34')]=_['intersection'](_0x424c27['model'],_0x424c27[_0x8db2('0x33')]);_0x482b26['attributes']=_[_0x8db2('0x35')](_0x424c27[_0x8db2('0x31')],qs[_0x8db2('0x37')](_0x40c69e[_0x8db2('0x33')][_0x8db2('0x37')]));_0x482b26[_0x8db2('0x36')]=_0x482b26[_0x8db2('0x36')][_0x8db2('0x38')]?_0x482b26[_0x8db2('0x36')]:_0x424c27[_0x8db2('0x31')];if(_0x40c69e[_0x8db2('0x33')][_0x8db2('0x44')]){_0x482b26['include']=[{'all':!![]}];}_0x482b26=_[_0x8db2('0x3e')]({},_0x482b26,_0x40c69e[_0x8db2('0x42')]);return db[_0x8db2('0x43')][_0x8db2('0x4b')](_0x482b26)['then'](handleEntityNotFound(_0x4a0b56,null))['then'](respondWithResult(_0x4a0b56,null))[_0x8db2('0x48')](handleError(_0x4a0b56,null));};exports[_0x8db2('0x4c')]=function(_0x164020,_0x4c66e5){return db['ContactItemType']['create'](_0x164020[_0x8db2('0x4d')],{})[_0x8db2('0x24')](function(_0x55c7dd){var _0x383fa1=_0x164020[_0x8db2('0x4e')][_0x8db2('0x25')]({'plain':!![]});if(!_0x383fa1)throw new Error(_0x8db2('0x4f'));if(_0x383fa1['role']==='user'){var _0x3d29bc=_0x55c7dd[_0x8db2('0x25')]({'plain':!![]});var _0x2908e4=_0x8db2('0x26');return db[_0x8db2('0x50')][_0x8db2('0x4b')]({'where':{'name':_0x2908e4,'userProfileId':_0x383fa1[_0x8db2('0x51')]},'raw':!![]})[_0x8db2('0x24')](function(_0x4187d6){if(_0x4187d6&&_0x4187d6[_0x8db2('0x52')]===0x0){return db[_0x8db2('0x27')][_0x8db2('0x4c')]({'name':_0x3d29bc[_0x8db2('0x2c')],'resourceId':_0x3d29bc['id'],'type':_0x4187d6[_0x8db2('0x2c')],'sectionId':_0x4187d6['id']},{})[_0x8db2('0x24')](function(){return _0x55c7dd;});}else{return _0x55c7dd;}})['catch'](function(_0x2ded23){logger[_0x8db2('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ded23);throw _0x2ded23;});}return _0x55c7dd;})[_0x8db2('0x24')](respondWithResult(_0x4c66e5,0xc9))[_0x8db2('0x48')](handleError(_0x4c66e5,null));};exports[_0x8db2('0x23')]=function(_0x547215,_0x3498dc){if(_0x547215[_0x8db2('0x4d')]['id']){delete _0x547215[_0x8db2('0x4d')]['id'];}return db[_0x8db2('0x43')][_0x8db2('0x4b')]({'where':{'id':_0x547215['params']['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x3498dc,null))[_0x8db2('0x24')](saveUpdates(_0x547215[_0x8db2('0x4d')],null))['then'](respondWithResult(_0x3498dc,null))[_0x8db2('0x48')](handleError(_0x3498dc,null));};exports[_0x8db2('0x28')]=function(_0x33dddd,_0x7b0de8){return db[_0x8db2('0x43')][_0x8db2('0x4b')]({'where':{'id':_0x33dddd[_0x8db2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x7b0de8,null))[_0x8db2('0x24')](db[_0x8db2('0x53')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x33dddd[_0x8db2('0x4a')]['id']}}))[_0x8db2('0x24')](removeEntity(_0x7b0de8,null))['catch'](handleError(_0x7b0de8,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 403f38e..048def2 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 _0x11b4=['bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','tools_contact_item_types','util','../../config/logger'];(function(_0x18eb0b,_0x11077e){var _0x1ddc58=function(_0x42dffa){while(--_0x42dffa){_0x18eb0b['push'](_0x18eb0b['shift']());}};_0x1ddc58(++_0x11077e);}(_0x11b4,0xda));var _0x411b=function(_0x1963ce,_0x382a04){_0x1963ce=_0x1963ce-0x0;var _0x1c5921=_0x11b4[_0x1963ce];return _0x1c5921;};'use strict';var _=require('lodash');var util=require(_0x411b('0x0'));var logger=require(_0x411b('0x1'))('api');var moment=require('moment');var BPromise=require(_0x411b('0x2'));var rp=require(_0x411b('0x3'));var fs=require('fs');var path=require(_0x411b('0x4'));var rimraf=require(_0x411b('0x5'));var config=require(_0x411b('0x6'));var attributes=require(_0x411b('0x7'));module[_0x411b('0x8')]=function(_0x544761,_0x14d7cd){return _0x544761[_0x411b('0x9')]('ContactItemType',attributes,{'tableName':_0x411b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9135=['api','moment','rimraf','./contactItemType.attributes','exports','define','tools_contact_item_types','lodash','../../config/logger'];(function(_0x2c3a8f,_0x374e56){var _0x189412=function(_0x560055){while(--_0x560055){_0x2c3a8f['push'](_0x2c3a8f['shift']());}};_0x189412(++_0x374e56);}(_0x9135,0xdf));var _0x5913=function(_0x442257,_0xf1ca8d){_0x442257=_0x442257-0x0;var _0x1f8f37=_0x9135[_0x442257];return _0x1f8f37;};'use strict';var _=require(_0x5913('0x0'));var util=require('util');var logger=require(_0x5913('0x1'))(_0x5913('0x2'));var moment=require(_0x5913('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5913('0x4'));var config=require('../../config/environment');var attributes=require(_0x5913('0x5'));module[_0x5913('0x6')]=function(_0x144976,_0x1280fe){return _0x144976[_0x5913('0x7')]('ContactItemType',attributes,{'tableName':_0x5913('0x8'),'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 58a577b..f96ea0f 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 _0x17ec=['client','http','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0x17ec,0x185));var _0xc17e=function(_0x3dfb10,_0x4f0c0d){_0x3dfb10=_0x3dfb10-0x0;var _0x2ff9d2=_0x17ec[_0x3dfb10];return _0x2ff9d2;};'use strict';var _=require(_0xc17e('0x0'));var util=require(_0xc17e('0x1'));var moment=require(_0xc17e('0x2'));var BPromise=require(_0xc17e('0x3'));var rs=require(_0xc17e('0x4'));var fs=require('fs');var Redis=require(_0xc17e('0x5'));var db=require(_0xc17e('0x6'))['db'];var utils=require(_0xc17e('0x7'));var logger=require(_0xc17e('0x8'))('rpc');var config=require(_0xc17e('0x9'));var jayson=require(_0xc17e('0xa'));var client=jayson[_0xc17e('0xb')][_0xc17e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20dac1,_0x55c330,_0xa40cf6){return new BPromise(function(_0xbb585,_0xcd1a8b){return client['request'](_0x20dac1,_0xa40cf6)[_0xc17e('0xd')](function(_0x1358f3){logger[_0xc17e('0xe')](_0xc17e('0xf'),_0x55c330,_0xc17e('0x10'));logger[_0xc17e('0x11')](_0xc17e('0x12'),_0x55c330,_0xc17e('0x10'),JSON[_0xc17e('0x13')](_0x1358f3));if(_0x1358f3[_0xc17e('0x14')]){if(_0x1358f3['error'][_0xc17e('0x15')]===0x1f4){logger[_0xc17e('0x14')](_0xc17e('0xf'),_0x55c330,_0x1358f3[_0xc17e('0x14')][_0xc17e('0x16')]);return _0xcd1a8b(_0x1358f3[_0xc17e('0x14')]['message']);}logger[_0xc17e('0x14')](_0xc17e('0xf'),_0x55c330,_0x1358f3[_0xc17e('0x14')][_0xc17e('0x16')]);return _0xbb585(_0x1358f3[_0xc17e('0x14')][_0xc17e('0x16')]);}else{logger[_0xc17e('0xe')]('ContactItemType,\x20%s,\x20%s',_0x55c330,'request\x20sent');_0xbb585(_0x1358f3[_0xc17e('0x17')][_0xc17e('0x16')]);}})[_0xc17e('0x18')](function(_0x4c8482){logger[_0xc17e('0x14')](_0xc17e('0xf'),_0x55c330,_0x4c8482);_0xcd1a8b(_0x4c8482);});});} \ No newline at end of file +var _0xe033=['info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xe033,0xc0));var _0x3e03=function(_0x3c14d8,_0xad30f1){_0x3c14d8=_0x3c14d8-0x0;var _0x492480=_0xe033[_0x3c14d8];return _0x492480;};'use strict';var _=require(_0x3e03('0x0'));var util=require(_0x3e03('0x1'));var moment=require(_0x3e03('0x2'));var BPromise=require(_0x3e03('0x3'));var rs=require(_0x3e03('0x4'));var fs=require('fs');var Redis=require(_0x3e03('0x5'));var db=require(_0x3e03('0x6'))['db'];var utils=require(_0x3e03('0x7'));var logger=require(_0x3e03('0x8'))(_0x3e03('0x9'));var config=require(_0x3e03('0xa'));var jayson=require(_0x3e03('0xb'));var client=jayson[_0x3e03('0xc')][_0x3e03('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xdccb5b,_0x42f778,_0xd8ee5d){return new BPromise(function(_0x3c5bcf,_0x506c59){return client[_0x3e03('0xe')](_0xdccb5b,_0xd8ee5d)[_0x3e03('0xf')](function(_0x345812){logger[_0x3e03('0x10')](_0x3e03('0x11'),_0x42f778,_0x3e03('0x12'));logger[_0x3e03('0x13')](_0x3e03('0x14'),_0x42f778,_0x3e03('0x12'),JSON[_0x3e03('0x15')](_0x345812));if(_0x345812[_0x3e03('0x16')]){if(_0x345812[_0x3e03('0x16')][_0x3e03('0x17')]===0x1f4){logger[_0x3e03('0x16')]('ContactItemType,\x20%s,\x20%s',_0x42f778,_0x345812[_0x3e03('0x16')][_0x3e03('0x18')]);return _0x506c59(_0x345812[_0x3e03('0x16')][_0x3e03('0x18')]);}logger[_0x3e03('0x16')](_0x3e03('0x11'),_0x42f778,_0x345812[_0x3e03('0x16')]['message']);return _0x3c5bcf(_0x345812[_0x3e03('0x16')][_0x3e03('0x18')]);}else{logger[_0x3e03('0x10')](_0x3e03('0x11'),_0x42f778,_0x3e03('0x12'));_0x3c5bcf(_0x345812[_0x3e03('0x19')][_0x3e03('0x18')]);}})['catch'](function(_0x3fcf89){logger[_0x3e03('0x16')]('ContactItemType,\x20%s,\x20%s',_0x42f778,_0x3fcf89);_0x506c59(_0x3fcf89);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 0ec34aa..4d47834 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 _0x4441=['../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5572ef,_0x4940a3){var _0x1268df=function(_0x346979){while(--_0x346979){_0x5572ef['push'](_0x5572ef['shift']());}};_0x1268df(++_0x4940a3);}(_0x4441,0x18f));var _0x1444=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4441[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x1444('0x0'));var path=require(_0x1444('0x1'));var timeout=require(_0x1444('0x2'));var express=require(_0x1444('0x3'));var router=express[_0x1444('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1444('0x5'));var interaction=require(_0x1444('0x6'));var config=require(_0x1444('0x7'));var controller=require(_0x1444('0x8'));router[_0x1444('0x9')]('/',auth[_0x1444('0xa')](),controller['index']);router[_0x1444('0x9')](_0x1444('0xb'),auth['isAuthenticated'](),controller[_0x1444('0xc')]);router[_0x1444('0xd')]('/',auth[_0x1444('0xa')](),controller[_0x1444('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9b27=['Router','fs-extra','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','put','destroy','exports','multer','connect-timeout','express'];(function(_0x54e157,_0x112e57){var _0x1c0b2e=function(_0x38be48){while(--_0x38be48){_0x54e157['push'](_0x54e157['shift']());}};_0x1c0b2e(++_0x112e57);}(_0x9b27,0x10d));var _0x79b2=function(_0x1dc8ce,_0x46f0a2){_0x1dc8ce=_0x1dc8ce-0x0;var _0xc1fadd=_0x9b27[_0x1dc8ce];return _0xc1fadd;};'use strict';var multer=require(_0x79b2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x79b2('0x1'));var express=require(_0x79b2('0x2'));var router=express[_0x79b2('0x3')]();var fs_extra=require(_0x79b2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x79b2('0x5'));var config=require(_0x79b2('0x6'));var controller=require(_0x79b2('0x7'));router[_0x79b2('0x8')]('/',auth[_0x79b2('0x9')](),controller['index']);router['get'](_0x79b2('0xa'),auth[_0x79b2('0x9')](),controller[_0x79b2('0xb')]);router[_0x79b2('0xc')]('/',auth[_0x79b2('0x9')](),controller[_0x79b2('0xd')]);router[_0x79b2('0xe')](_0x79b2('0xa'),auth[_0x79b2('0x9')](),controller['update']);router['delete'](_0x79b2('0xa'),auth[_0x79b2('0x9')](),controller[_0x79b2('0xf')]);module[_0x79b2('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 464c7a1..87f16cd 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(_0x51c52b,_0x147712){var _0x581ce3=function(_0x2e61a0){while(--_0x2e61a0){_0x51c52b['push'](_0x51c52b['shift']());}};_0x581ce3(++_0x147712);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x54be38,_0x561f9c){var _0x504034=function(_0x2288d4){while(--_0x2288d4){_0x54be38['push'](_0x54be38['shift']());}};_0x504034(++_0x561f9c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b9fe018..3eaceee 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 _0xfa98=['util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','stack','name','index','map','rawAttributes','model','keys','query','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','include','Dashboard','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','autoAssociation','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','voice','attrFaxAccounts','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','order','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x448f50,_0x5587ba){var _0x2af4c3=function(_0x5f2616){while(--_0x5f2616){_0x448f50['push'](_0x448f50['shift']());}};_0x2af4c3(++_0x5587ba);}(_0xfa98,0x105));var _0x8fa9=function(_0x50b5e4,_0x1be8aa){_0x50b5e4=_0x50b5e4-0x0;var _0x3262b2=_0xfa98[_0x50b5e4];return _0x3262b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8fa9('0x0'));var zipdir=require(_0x8fa9('0x1'));var jsonpatch=require(_0x8fa9('0x2'));var rp=require(_0x8fa9('0x3'));var moment=require(_0x8fa9('0x4'));var BPromise=require(_0x8fa9('0x5'));var Mustache=require(_0x8fa9('0x6'));var util=require(_0x8fa9('0x7'));var path=require(_0x8fa9('0x8'));var sox=require(_0x8fa9('0x9'));var csv=require('to-csv');var ejs=require(_0x8fa9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8fa9('0xb'));var squel=require(_0x8fa9('0xc'));var crypto=require(_0x8fa9('0xd'));var jsforce=require(_0x8fa9('0xe'));var deskjs=require(_0x8fa9('0xf'));var toCsv=require(_0x8fa9('0x10'));var querystring=require(_0x8fa9('0x11'));var Papa=require(_0x8fa9('0x12'));var Redis=require('ioredis');var authService=require(_0x8fa9('0x13'));var qs=require(_0x8fa9('0x14'));var as=require(_0x8fa9('0x15'));var hardwareService=require(_0x8fa9('0x16'));var logger=require(_0x8fa9('0x17'))(_0x8fa9('0x18'));var utils=require(_0x8fa9('0x19'));var config=require(_0x8fa9('0x1a'));var licenseUtil=require(_0x8fa9('0x1b'));var db=require('../../mysqldb')['db'];config[_0x8fa9('0x1c')]=_[_0x8fa9('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8fa9('0x1e'))(new Redis(config[_0x8fa9('0x1c')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x5c7a62,_0x323ab2){_0x323ab2=_0x323ab2||0xcc;return function(_0x70e42){if(_0x70e42){return _0x5c7a62[_0x8fa9('0x1f')](_0x323ab2);}return _0x5c7a62[_0x8fa9('0x20')](_0x323ab2)[_0x8fa9('0x21')]();};}function respondWithResult(_0x112dd9,_0x12d59a){_0x12d59a=_0x12d59a||0xc8;return function(_0x11d0bc){if(_0x11d0bc){return _0x112dd9[_0x8fa9('0x20')](_0x12d59a)[_0x8fa9('0x22')](_0x11d0bc);}};}function respondWithFilteredResult(_0x562bd3,_0x2fd6f3){return function(_0x550cdb){if(_0x550cdb){var _0x1c377f=typeof _0x2fd6f3[_0x8fa9('0x23')]==='undefined'&&typeof _0x2fd6f3[_0x8fa9('0x24')]===_0x8fa9('0x25');var _0x45b101=_0x550cdb['count'];var _0x507a72=_0x1c377f?0x0:_0x2fd6f3['offset'];var _0xb8b1e2=_0x1c377f?_0x550cdb[_0x8fa9('0x26')]:_0x2fd6f3[_0x8fa9('0x23')]+_0x2fd6f3[_0x8fa9('0x24')];var _0x69e756;if(_0xb8b1e2>=_0x45b101){_0xb8b1e2=_0x45b101;_0x69e756=0xc8;}else{_0x69e756=0xce;}_0x562bd3[_0x8fa9('0x20')](_0x69e756);return _0x562bd3[_0x8fa9('0x27')](_0x8fa9('0x28'),_0x507a72+'-'+_0xb8b1e2+'/'+_0x45b101)[_0x8fa9('0x22')](_0x550cdb);}return null;};}function patchUpdates(_0x5acf30){return function(_0x357a9c){try{jsonpatch[_0x8fa9('0x29')](_0x357a9c,_0x5acf30,!![]);}catch(_0x3af5a0){return BPromise[_0x8fa9('0x2a')](_0x3af5a0);}return _0x357a9c[_0x8fa9('0x2b')]();};}function saveUpdates(_0x339682,_0x5107b0){return function(_0x38cc62){if(_0x38cc62){return _0x38cc62[_0x8fa9('0x2c')](_0x339682)[_0x8fa9('0x2d')](function(_0x42c290){return _0x42c290;});}return null;};}function removeEntity(_0x33c9be,_0x5a094c){return function(_0xf1b0a8){if(_0xf1b0a8){return _0xf1b0a8['destroy']()[_0x8fa9('0x2d')](function(){var _0x406678=_0xf1b0a8[_0x8fa9('0x2e')]({'plain':!![]});var _0x36f9c0=_0x8fa9('0x2f');return db[_0x8fa9('0x30')][_0x8fa9('0x31')]({'where':{'type':_0x36f9c0,'resourceId':_0x406678['id']}})[_0x8fa9('0x2d')](function(){return _0xf1b0a8;});})[_0x8fa9('0x2d')](function(){_0x33c9be[_0x8fa9('0x20')](0xcc)[_0x8fa9('0x21')]();});}};}function handleEntityNotFound(_0x269141,_0x211b29){return function(_0x4f2f40){if(!_0x4f2f40){_0x269141[_0x8fa9('0x1f')](0x194);}return _0x4f2f40;};}function handleError(_0xe871d8,_0x31f47a){_0x31f47a=_0x31f47a||0x1f4;return function(_0x617476){logger['error'](_0x617476[_0x8fa9('0x32')]);if(_0x617476[_0x8fa9('0x33')]){delete _0x617476['name'];}_0xe871d8[_0x8fa9('0x20')](_0x31f47a)['send'](_0x617476);};}exports[_0x8fa9('0x34')]=function(_0x536af1,_0x3dcd26){var _0x288fe3={},_0x16b42c={},_0x347b88={'count':0x0,'rows':[]};var _0x6d5c66=_[_0x8fa9('0x35')](db['Dashboard'][_0x8fa9('0x36')],function(_0x26763a){return{'name':_0x26763a['fieldName'],'type':_0x26763a['type']['key']};});_0x16b42c[_0x8fa9('0x37')]=_[_0x8fa9('0x35')](_0x6d5c66,_0x8fa9('0x33'));_0x16b42c['query']=_[_0x8fa9('0x38')](_0x536af1[_0x8fa9('0x39')]);_0x16b42c['filters']=_[_0x8fa9('0x3a')](_0x16b42c['model'],_0x16b42c[_0x8fa9('0x39')]);_0x288fe3[_0x8fa9('0x3b')]=_[_0x8fa9('0x3a')](_0x16b42c[_0x8fa9('0x37')],qs[_0x8fa9('0x3c')](_0x536af1[_0x8fa9('0x39')][_0x8fa9('0x3c')]));_0x288fe3[_0x8fa9('0x3b')]=_0x288fe3[_0x8fa9('0x3b')][_0x8fa9('0x3d')]?_0x288fe3[_0x8fa9('0x3b')]:_0x16b42c[_0x8fa9('0x37')];if(!_0x536af1[_0x8fa9('0x39')]['hasOwnProperty'](_0x8fa9('0x3e'))){_0x288fe3[_0x8fa9('0x24')]=qs['limit'](_0x536af1[_0x8fa9('0x39')][_0x8fa9('0x24')]);_0x288fe3[_0x8fa9('0x23')]=qs['offset'](_0x536af1[_0x8fa9('0x39')][_0x8fa9('0x23')]);}_0x288fe3['order']=qs['sort'](_0x536af1[_0x8fa9('0x39')][_0x8fa9('0x3f')]);_0x288fe3['where']=qs[_0x8fa9('0x40')](_[_0x8fa9('0x41')](_0x536af1[_0x8fa9('0x39')],_0x16b42c[_0x8fa9('0x40')]),_0x6d5c66);if(_0x536af1['query'][_0x8fa9('0x42')]){_0x288fe3[_0x8fa9('0x43')]=_[_0x8fa9('0x44')](_0x288fe3['where'],{'$or':_[_0x8fa9('0x35')](_0x6d5c66,function(_0x583925){if(_0x583925[_0x8fa9('0x45')]!==_0x8fa9('0x46')){var _0x204119={};_0x204119[_0x583925[_0x8fa9('0x33')]]={'$like':'%'+_0x536af1[_0x8fa9('0x39')][_0x8fa9('0x42')]+'%'};return _0x204119;}})});}_0x288fe3=_[_0x8fa9('0x44')]({},_0x288fe3,_0x536af1['options']);var _0x81551f={'where':_0x288fe3['where']};return db['Dashboard'][_0x8fa9('0x26')](_0x81551f)[_0x8fa9('0x2d')](function(_0xd7514c){_0x347b88[_0x8fa9('0x26')]=_0xd7514c;if(_0x536af1[_0x8fa9('0x39')][_0x8fa9('0x47')]){_0x288fe3[_0x8fa9('0x48')]=[{'all':!![]}];}return db[_0x8fa9('0x49')][_0x8fa9('0x4a')](_0x288fe3);})[_0x8fa9('0x2d')](function(_0x291003){_0x347b88[_0x8fa9('0x4b')]=_0x291003;return _0x347b88;})['then'](respondWithFilteredResult(_0x3dcd26,_0x288fe3))[_0x8fa9('0x4c')](handleError(_0x3dcd26,null));};exports[_0x8fa9('0x4d')]=function(_0x3f5a23,_0x33534e){var _0x149bc0={'raw':![],'where':{'id':_0x3f5a23[_0x8fa9('0x4e')]['id']}},_0x741fda={};_0x741fda[_0x8fa9('0x37')]=_[_0x8fa9('0x38')](db[_0x8fa9('0x49')][_0x8fa9('0x36')]);_0x741fda[_0x8fa9('0x39')]=_[_0x8fa9('0x38')](_0x3f5a23[_0x8fa9('0x39')]);_0x741fda[_0x8fa9('0x40')]=_[_0x8fa9('0x3a')](_0x741fda[_0x8fa9('0x37')],_0x741fda[_0x8fa9('0x39')]);_0x149bc0[_0x8fa9('0x3b')]=_[_0x8fa9('0x3a')](_0x741fda[_0x8fa9('0x37')],qs[_0x8fa9('0x3c')](_0x3f5a23[_0x8fa9('0x39')][_0x8fa9('0x3c')]));_0x149bc0[_0x8fa9('0x3b')]=_0x149bc0['attributes']['length']?_0x149bc0[_0x8fa9('0x3b')]:_0x741fda[_0x8fa9('0x37')];if(_0x3f5a23['query']['includeAll']){_0x149bc0[_0x8fa9('0x48')]=[{'all':!![]}];}_0x149bc0=_[_0x8fa9('0x44')]({},_0x149bc0,_0x3f5a23[_0x8fa9('0x4f')]);return db[_0x8fa9('0x49')][_0x8fa9('0x50')](_0x149bc0)[_0x8fa9('0x2d')](handleEntityNotFound(_0x33534e,null))[_0x8fa9('0x2d')](respondWithResult(_0x33534e,null))[_0x8fa9('0x4c')](handleError(_0x33534e,null));};exports['create']=function(_0x538c20,_0x3f54a2){return db[_0x8fa9('0x49')][_0x8fa9('0x51')](_0x538c20[_0x8fa9('0x52')],{})[_0x8fa9('0x2d')](function(_0x3f1a3f){var _0x3b9d9c=_0x538c20[_0x8fa9('0x53')][_0x8fa9('0x2e')]({'plain':!![]});if(!_0x3b9d9c)throw new Error(_0x8fa9('0x54'));if(_0x3b9d9c[_0x8fa9('0x55')]===_0x8fa9('0x53')){var _0x14ddb9=_0x3f1a3f[_0x8fa9('0x2e')]({'plain':!![]});var _0x121e16=_0x8fa9('0x2f');return db[_0x8fa9('0x56')][_0x8fa9('0x50')]({'where':{'name':_0x121e16,'userProfileId':_0x3b9d9c[_0x8fa9('0x57')]},'raw':!![]})[_0x8fa9('0x2d')](function(_0x3289a8){if(_0x3289a8&&_0x3289a8['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x14ddb9[_0x8fa9('0x33')],'resourceId':_0x14ddb9['id'],'type':_0x3289a8[_0x8fa9('0x33')],'sectionId':_0x3289a8['id']},{})[_0x8fa9('0x2d')](function(){return _0x3f1a3f;});}else{return _0x3f1a3f;}})['catch'](function(_0x10b1ba){logger[_0x8fa9('0x58')](_0x8fa9('0x59'),_0x10b1ba);throw _0x10b1ba;});}return _0x3f1a3f;})[_0x8fa9('0x2d')](respondWithResult(_0x3f54a2,0xc9))[_0x8fa9('0x4c')](handleError(_0x3f54a2,null));};exports[_0x8fa9('0x5a')]=function(_0x26602b,_0x42db77){var _0x422b5a={'where':{'id':_0x26602b[_0x8fa9('0x4e')]['id']}},_0x322438={};_0x322438[_0x8fa9('0x37')]=_['keys'](db['Dashboard'][_0x8fa9('0x36')]);_0x422b5a[_0x8fa9('0x3b')]=_['intersection'](_0x322438['model'],qs['fields'](_0x26602b[_0x8fa9('0x39')][_0x8fa9('0x3c')]));_0x422b5a['attributes']=_0x422b5a[_0x8fa9('0x3b')][_0x8fa9('0x3d')]?_0x422b5a[_0x8fa9('0x3b')]:_0x322438[_0x8fa9('0x37')];if(_0x26602b['query'][_0x8fa9('0x47')]){_0x422b5a[_0x8fa9('0x48')]=[{'all':!![]}];}_0x422b5a=_[_0x8fa9('0x44')]({},_0x422b5a,_0x26602b[_0x8fa9('0x4f')]);return db[_0x8fa9('0x49')]['find'](_0x422b5a)['then'](handleEntityNotFound(_0x42db77,null))[_0x8fa9('0x2d')](function(_0x574967){if(_0x574967){var _0x324be5=_0x574967['get']({'plain':!![]});_0x324be5=qs[_0x8fa9('0x5b')](_0x324be5,['id',_0x8fa9('0x5c'),_0x8fa9('0x5d')]);_0x26602b[_0x8fa9('0x52')]=_['omit'](_0x26602b['body'],['id','createdAt',_0x8fa9('0x5d')]);return db[_0x8fa9('0x49')]['create'](_[_0x8fa9('0x44')](_0x324be5,_0x26602b[_0x8fa9('0x52')]),{'include':_0x26602b['query']['includeAll']?[{'all':!![]}]:undefined})[_0x8fa9('0x2d')](function(_0x2629d9){var _0x9a10c1=_0x26602b[_0x8fa9('0x53')][_0x8fa9('0x2e')]({'plain':!![]});if(!_0x9a10c1)throw new Error(_0x8fa9('0x54'));if(_0x9a10c1['role']===_0x8fa9('0x53')){var _0x136443=_0x2629d9['get']({'plain':!![]});var _0x573248=_0x8fa9('0x2f');return db[_0x8fa9('0x56')]['find']({'where':{'name':_0x573248,'userProfileId':_0x9a10c1[_0x8fa9('0x57')]},'raw':!![]})[_0x8fa9('0x2d')](function(_0x5c2209){if(_0x5c2209&&_0x5c2209[_0x8fa9('0x5e')]===0x0){return db[_0x8fa9('0x30')][_0x8fa9('0x51')]({'name':_0x136443[_0x8fa9('0x33')],'resourceId':_0x136443['id'],'type':_0x5c2209[_0x8fa9('0x33')],'sectionId':_0x5c2209['id']},{})[_0x8fa9('0x2d')](function(){return _0x2629d9;});}else{return _0x2629d9;}})['catch'](function(_0x24174c){logger[_0x8fa9('0x58')](_0x8fa9('0x59'),_0x24174c);throw _0x24174c;});}return _0x2629d9;});}})[_0x8fa9('0x2d')](respondWithResult(_0x42db77,0xc9))[_0x8fa9('0x4c')](handleError(_0x42db77,null));};exports[_0x8fa9('0x2c')]=function(_0x3723d0,_0x550360){if(_0x3723d0[_0x8fa9('0x52')]['id']){delete _0x3723d0[_0x8fa9('0x52')]['id'];}return db[_0x8fa9('0x49')][_0x8fa9('0x50')]({'where':{'id':_0x3723d0[_0x8fa9('0x4e')]['id']}})[_0x8fa9('0x2d')](handleEntityNotFound(_0x550360,null))['then'](saveUpdates(_0x3723d0[_0x8fa9('0x52')],null))[_0x8fa9('0x2d')](respondWithResult(_0x550360,null))[_0x8fa9('0x4c')](handleError(_0x550360,null));};exports[_0x8fa9('0x31')]=function(_0x2ac832,_0x3b269e){return db[_0x8fa9('0x49')]['find']({'where':{'id':_0x2ac832[_0x8fa9('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3b269e,null))[_0x8fa9('0x2d')](removeEntity(_0x3b269e,null))[_0x8fa9('0x4c')](handleError(_0x3b269e,null));};function widgetAttributes(_0x3f76f3){try{switch(_0x3f76f3['type']){case _0x8fa9('0x5f'):return[{'name':_0x8fa9('0x60'),'value':_0x3f76f3[_0x8fa9('0x60')]||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3[_0x8fa9('0x61')][0x0]?_0x3f76f3['attrs'][0x0][_0x8fa9('0x62')]:undefined)||'https://'}];case'custom':return[{'name':_0x8fa9('0x63'),'value':_0x3f76f3['attrPath']||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3[_0x8fa9('0x61')][0x0]?_0x3f76f3['attrs'][0x0][_0x8fa9('0x62')]:undefined)||''}];case _0x8fa9('0x64'):return[{'name':_0x8fa9('0x65'),'value':_0x3f76f3[_0x8fa9('0x65')]||(_0x3f76f3['attrs']&&_0x3f76f3[_0x8fa9('0x61')][0x0]?_0x3f76f3[_0x8fa9('0x61')][0x0][_0x8fa9('0x62')]:undefined)||_0x8fa9('0x66')},{'name':_0x8fa9('0x67'),'value':_0x3f76f3[_0x8fa9('0x67')]||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3['attrs'][0x1]?_0x3f76f3[_0x8fa9('0x61')][0x1][_0x8fa9('0x62')]:undefined)||_0x8fa9('0x68')},{'name':_0x8fa9('0x69'),'value':_0x3f76f3[_0x8fa9('0x69')]||(_0x3f76f3['attrs']&&_0x3f76f3[_0x8fa9('0x61')][0x2]?_0x3f76f3[_0x8fa9('0x61')][0x2][_0x8fa9('0x62')]:undefined)||0xc}];case _0x8fa9('0x6a'):return[{'name':_0x8fa9('0x6b'),'value':_0x3f76f3['attrMetric']||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3['attrs'][0x0]?_0x3f76f3['attrs'][0x0][_0x8fa9('0x62')]:undefined)||'total'},{'name':_0x8fa9('0x6c'),'value':_0x3f76f3[_0x8fa9('0x6c')]||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3[_0x8fa9('0x61')][0x1]?_0x3f76f3[_0x8fa9('0x61')][0x1]['value']:undefined)||[]},{'name':_0x8fa9('0x69'),'value':_0x3f76f3[_0x8fa9('0x69')]||(_0x3f76f3['attrs']&&_0x3f76f3['attrs'][0x2]?_0x3f76f3[_0x8fa9('0x61')][0x2]['value']:undefined)||0x14},{'name':_0x8fa9('0x6d'),'value':_0x3f76f3[_0x8fa9('0x6d')]||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3[_0x8fa9('0x61')][0x3]?_0x3f76f3[_0x8fa9('0x61')][0x3]['value']:undefined)||'voice'},{'name':_0x8fa9('0x6e'),'value':_0x3f76f3[_0x8fa9('0x6e')]||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3['attrs'][0x4]?_0x3f76f3[_0x8fa9('0x61')][0x4][_0x8fa9('0x62')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x3f76f3['attrFaxAccounts']||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3[_0x8fa9('0x61')][0x5]?_0x3f76f3[_0x8fa9('0x61')][0x5][_0x8fa9('0x62')]:undefined)||''},{'name':_0x8fa9('0x6f'),'value':_0x3f76f3[_0x8fa9('0x6f')]||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3['attrs'][0x6]?_0x3f76f3[_0x8fa9('0x61')][0x6]['value']:undefined)||''},{'name':_0x8fa9('0x70'),'value':_0x3f76f3[_0x8fa9('0x70')]||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3[_0x8fa9('0x61')][0x7]?_0x3f76f3[_0x8fa9('0x61')][0x7][_0x8fa9('0x62')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3f76f3['attrWhatsappAccounts']||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3[_0x8fa9('0x61')][0x8]?_0x3f76f3[_0x8fa9('0x61')][0x8][_0x8fa9('0x62')]:undefined)||''},{'name':_0x8fa9('0x71'),'value':_0x3f76f3['attrChatWebsites']||(_0x3f76f3['attrs']&&_0x3f76f3['attrs'][0x9]?_0x3f76f3['attrs'][0x9][_0x8fa9('0x62')]:undefined)||''}];case _0x8fa9('0x72'):case _0x8fa9('0x73'):return[{'name':_0x8fa9('0x74'),'value':_0x3f76f3['attrSerie1']||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3[_0x8fa9('0x61')][0x0]?_0x3f76f3[_0x8fa9('0x61')][0x0][_0x8fa9('0x62')]:undefined)||_0x8fa9('0x75')},{'name':_0x8fa9('0x76'),'value':_0x3f76f3[_0x8fa9('0x76')]||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3[_0x8fa9('0x61')][0x1]?_0x3f76f3[_0x8fa9('0x61')][0x1][_0x8fa9('0x62')]:undefined)||null},{'name':_0x8fa9('0x77'),'value':_0x3f76f3[_0x8fa9('0x77')]||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3[_0x8fa9('0x61')][0x2]?_0x3f76f3[_0x8fa9('0x61')][0x2][_0x8fa9('0x62')]:undefined)||null},{'name':_0x8fa9('0x6c'),'value':_0x3f76f3[_0x8fa9('0x6c')]||(_0x3f76f3['attrs']&&_0x3f76f3['attrs'][0x3]?_0x3f76f3[_0x8fa9('0x61')][0x3]['value']:undefined)||[]},{'name':_0x8fa9('0x6d'),'value':_0x3f76f3['attrChannel']||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3['attrs'][0x4]?_0x3f76f3[_0x8fa9('0x61')][0x4][_0x8fa9('0x62')]:undefined)||_0x8fa9('0x78')},{'name':_0x8fa9('0x6e'),'value':_0x3f76f3['attrEmailAccounts']||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3['attrs'][0x5]?_0x3f76f3[_0x8fa9('0x61')][0x5][_0x8fa9('0x62')]:undefined)||''},{'name':_0x8fa9('0x79'),'value':_0x3f76f3[_0x8fa9('0x79')]||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3[_0x8fa9('0x61')][0x6]?_0x3f76f3[_0x8fa9('0x61')][0x6][_0x8fa9('0x62')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3f76f3[_0x8fa9('0x6f')]||(_0x3f76f3['attrs']&&_0x3f76f3[_0x8fa9('0x61')][0x7]?_0x3f76f3['attrs'][0x7][_0x8fa9('0x62')]:undefined)||''},{'name':_0x8fa9('0x70'),'value':_0x3f76f3[_0x8fa9('0x70')]||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3[_0x8fa9('0x61')][0x8]?_0x3f76f3['attrs'][0x8]['value']:undefined)||''},{'name':_0x8fa9('0x7a'),'value':_0x3f76f3[_0x8fa9('0x7a')]||(_0x3f76f3['attrs']&&_0x3f76f3['attrs'][0x9]?_0x3f76f3[_0x8fa9('0x61')][0x9][_0x8fa9('0x62')]:undefined)||''},{'name':_0x8fa9('0x71'),'value':_0x3f76f3[_0x8fa9('0x71')]||(_0x3f76f3['attrs']&&_0x3f76f3['attrs'][0xa]?_0x3f76f3[_0x8fa9('0x61')][0xa]['value']:undefined)||''}];case _0x8fa9('0x7b'):return[{'name':_0x8fa9('0x7c'),'type':_0x3f76f3[_0x8fa9('0x7d')]||(_0x3f76f3['attrs']&&_0x3f76f3[_0x8fa9('0x61')][0x0]?_0x3f76f3[_0x8fa9('0x61')][0x0]['type']:undefined)||null,'value':_0x3f76f3[_0x8fa9('0x7c')]||(_0x3f76f3[_0x8fa9('0x61')]&&_0x3f76f3[_0x8fa9('0x61')][0x0]?_0x3f76f3[_0x8fa9('0x61')][0x0]['value']:undefined)||null},{'name':_0x8fa9('0x7e'),'value':_0x3f76f3['attrRefresh']||(_0x3f76f3['attrs']&&_0x3f76f3[_0x8fa9('0x61')][0x1]?_0x3f76f3['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5d3ffe){logger[_0x8fa9('0x58')](_0x8fa9('0x7f'),JSON[_0x8fa9('0x80')](_0x5d3ffe));return[];}}exports['addItem']=function(_0x1c4038,_0x2906f9,_0x527b77){if(_0x1c4038[_0x8fa9('0x52')]['id']){delete _0x1c4038['body']['id'];}return db[_0x8fa9('0x49')]['find']({'where':{'id':_0x1c4038[_0x8fa9('0x4e')]['id']}})[_0x8fa9('0x2d')](handleEntityNotFound(_0x2906f9,null))['then'](function(_0x58d9ef){if(_0x58d9ef){_0x1c4038[_0x8fa9('0x52')][_0x8fa9('0x81')]=_0x58d9ef['id'];_0x1c4038[_0x8fa9('0x52')][_0x8fa9('0x61')]=widgetAttributes(_0x1c4038['body']);return db[_0x8fa9('0x82')][_0x8fa9('0x51')](_0x1c4038['body']);}})[_0x8fa9('0x2d')](respondWithResult(_0x2906f9,null))[_0x8fa9('0x4c')](handleError(_0x2906f9,null));};exports[_0x8fa9('0x83')]=function(_0x4cd184,_0x847885,_0x527e5f){var _0x12914d={};var _0x278b75={};var _0x20e2c0;var _0x419178;return db[_0x8fa9('0x49')]['findOne']({'where':{'id':_0x4cd184[_0x8fa9('0x4e')]['id']}})[_0x8fa9('0x2d')](handleEntityNotFound(_0x847885,null))[_0x8fa9('0x2d')](function(_0x499f6b){if(_0x499f6b){_0x20e2c0=_0x499f6b;_0x278b75['model']=_['keys'](db[_0x8fa9('0x82')]['rawAttributes']);_0x278b75[_0x8fa9('0x39')]=_[_0x8fa9('0x38')](_0x4cd184['query']);_0x278b75[_0x8fa9('0x40')]=_[_0x8fa9('0x3a')](_0x278b75[_0x8fa9('0x37')],_0x278b75['query']);_0x12914d[_0x8fa9('0x3b')]=_[_0x8fa9('0x3a')](_0x278b75['model'],qs['fields'](_0x4cd184[_0x8fa9('0x39')][_0x8fa9('0x3c')]));_0x12914d[_0x8fa9('0x3b')]=_0x12914d[_0x8fa9('0x3b')][_0x8fa9('0x3d')]?_0x12914d[_0x8fa9('0x3b')]:_0x278b75[_0x8fa9('0x37')];_0x12914d[_0x8fa9('0x84')]=qs['sort'](_0x4cd184['query'][_0x8fa9('0x3f')]);_0x12914d[_0x8fa9('0x43')]=qs[_0x8fa9('0x40')](_[_0x8fa9('0x41')](_0x4cd184[_0x8fa9('0x39')],_0x278b75[_0x8fa9('0x40')]));if(_0x4cd184['query'][_0x8fa9('0x42')]){_0x12914d[_0x8fa9('0x43')]=_[_0x8fa9('0x44')](_0x12914d[_0x8fa9('0x43')],{'$or':_['map'](_0x12914d[_0x8fa9('0x3b')],function(_0x4bd3da){var _0x1eb5ee={};_0x1eb5ee[_0x4bd3da]={'$like':'%'+_0x4cd184['query'][_0x8fa9('0x42')]+'%'};return _0x1eb5ee;})});}_0x12914d=_['merge']({},_0x12914d,_0x4cd184[_0x8fa9('0x4f')]);return _0x20e2c0[_0x8fa9('0x83')](_0x12914d);}})['then'](function(_0x58c75b){if(_0x58c75b){_0x419178=_0x58c75b[_0x8fa9('0x3d')];if(!_0x4cd184[_0x8fa9('0x39')][_0x8fa9('0x85')]('nolimit')){_0x12914d[_0x8fa9('0x24')]=qs['limit'](_0x4cd184[_0x8fa9('0x39')][_0x8fa9('0x24')]);_0x12914d['offset']=qs[_0x8fa9('0x23')](_0x4cd184['query'][_0x8fa9('0x23')]);}return _0x20e2c0[_0x8fa9('0x83')](_0x12914d);}})['then'](function(_0x423bf5){if(_0x423bf5){return _0x423bf5?{'count':_0x419178,'rows':_0x423bf5}:null;}})[_0x8fa9('0x2d')](respondWithResult(_0x847885,null))['catch'](handleError(_0x847885,null));}; \ No newline at end of file +var _0xc24d=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','role','catch','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','pick','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./dashboard.socket','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','map','Dashboard','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','options','include','findAll','rows','keys','length','includeAll','find','create'];(function(_0x4a50ef,_0x1731bf){var _0x17ab1b=function(_0x3a5e57){while(--_0x3a5e57){_0x4a50ef['push'](_0x4a50ef['shift']());}};_0x17ab1b(++_0x1731bf);}(_0xc24d,0x1bf));var _0xdc24=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0xc24d[_0x102b0c];return _0x9b15ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc24('0x0'));var zipdir=require(_0xdc24('0x1'));var jsonpatch=require(_0xdc24('0x2'));var rp=require('request-promise');var moment=require(_0xdc24('0x3'));var BPromise=require(_0xdc24('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdc24('0x5'));var sox=require(_0xdc24('0x6'));var csv=require(_0xdc24('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdc24('0x8'));var _=require(_0xdc24('0x9'));var squel=require(_0xdc24('0xa'));var crypto=require(_0xdc24('0xb'));var jsforce=require(_0xdc24('0xc'));var deskjs=require(_0xdc24('0xd'));var toCsv=require(_0xdc24('0x7'));var querystring=require(_0xdc24('0xe'));var Papa=require(_0xdc24('0xf'));var Redis=require('ioredis');var authService=require(_0xdc24('0x10'));var qs=require(_0xdc24('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdc24('0x12'));var logger=require('../../config/logger')(_0xdc24('0x13'));var utils=require('../../config/utils');var config=require(_0xdc24('0x14'));var licenseUtil=require(_0xdc24('0x15'));var db=require(_0xdc24('0x16'))['db'];config['redis']=_[_0xdc24('0x17')](config['redis'],{'host':_0xdc24('0x18'),'port':0x18eb});var socket=require(_0xdc24('0x19'))(new Redis(config[_0xdc24('0x1a')]));require(_0xdc24('0x1b'))['register'](socket);function respondWithStatusCode(_0xc95853,_0x147bd2){_0x147bd2=_0x147bd2||0xcc;return function(_0x4233c0){if(_0x4233c0){return _0xc95853[_0xdc24('0x1c')](_0x147bd2);}return _0xc95853[_0xdc24('0x1d')](_0x147bd2)[_0xdc24('0x1e')]();};}function respondWithResult(_0x213397,_0x492e7e){_0x492e7e=_0x492e7e||0xc8;return function(_0x13c642){if(_0x13c642){return _0x213397[_0xdc24('0x1d')](_0x492e7e)[_0xdc24('0x1f')](_0x13c642);}};}function respondWithFilteredResult(_0x3b9e90,_0x434b0d){return function(_0x176cd3){if(_0x176cd3){var _0x32714c=typeof _0x434b0d['offset']==='undefined'&&typeof _0x434b0d['limit']==='undefined';var _0x456565=_0x176cd3[_0xdc24('0x20')];var _0x429471=_0x32714c?0x0:_0x434b0d[_0xdc24('0x21')];var _0x46455e=_0x32714c?_0x176cd3[_0xdc24('0x20')]:_0x434b0d['offset']+_0x434b0d[_0xdc24('0x22')];var _0x3dadfd;if(_0x46455e>=_0x456565){_0x46455e=_0x456565;_0x3dadfd=0xc8;}else{_0x3dadfd=0xce;}_0x3b9e90[_0xdc24('0x1d')](_0x3dadfd);return _0x3b9e90['set'](_0xdc24('0x23'),_0x429471+'-'+_0x46455e+'/'+_0x456565)['json'](_0x176cd3);}return null;};}function patchUpdates(_0x320dd3){return function(_0x33124f){try{jsonpatch[_0xdc24('0x24')](_0x33124f,_0x320dd3,!![]);}catch(_0x5abee3){return BPromise[_0xdc24('0x25')](_0x5abee3);}return _0x33124f[_0xdc24('0x26')]();};}function saveUpdates(_0x513f70,_0x23d89b){return function(_0x5b968c){if(_0x5b968c){return _0x5b968c[_0xdc24('0x27')](_0x513f70)[_0xdc24('0x28')](function(_0x176cc9){return _0x176cc9;});}return null;};}function removeEntity(_0x5ac0a1,_0x390744){return function(_0x2f3634){if(_0x2f3634){return _0x2f3634[_0xdc24('0x29')]()[_0xdc24('0x28')](function(){var _0x3e9879=_0x2f3634[_0xdc24('0x2a')]({'plain':!![]});var _0x570702=_0xdc24('0x2b');return db[_0xdc24('0x2c')][_0xdc24('0x29')]({'where':{'type':_0x570702,'resourceId':_0x3e9879['id']}})[_0xdc24('0x28')](function(){return _0x2f3634;});})[_0xdc24('0x28')](function(){_0x5ac0a1[_0xdc24('0x1d')](0xcc)[_0xdc24('0x1e')]();});}};}function handleEntityNotFound(_0x1d1fb6,_0x31e2e7){return function(_0x384c84){if(!_0x384c84){_0x1d1fb6[_0xdc24('0x1c')](0x194);}return _0x384c84;};}function handleError(_0x4d0176,_0x2b2c9a){_0x2b2c9a=_0x2b2c9a||0x1f4;return function(_0x336fd5){logger[_0xdc24('0x2d')](_0x336fd5[_0xdc24('0x2e')]);if(_0x336fd5['name']){delete _0x336fd5[_0xdc24('0x2f')];}_0x4d0176[_0xdc24('0x1d')](_0x2b2c9a)[_0xdc24('0x30')](_0x336fd5);};}exports['index']=function(_0x3238a9,_0xa0d2a6){var _0x22f9ab={},_0x10ee9a={},_0x5cff42={'count':0x0,'rows':[]};var _0x52dd5e=_[_0xdc24('0x31')](db[_0xdc24('0x32')][_0xdc24('0x33')],function(_0x17e79f){return{'name':_0x17e79f[_0xdc24('0x34')],'type':_0x17e79f['type'][_0xdc24('0x35')]};});_0x10ee9a['model']=_['map'](_0x52dd5e,_0xdc24('0x2f'));_0x10ee9a[_0xdc24('0x36')]=_['keys'](_0x3238a9['query']);_0x10ee9a[_0xdc24('0x37')]=_[_0xdc24('0x38')](_0x10ee9a[_0xdc24('0x39')],_0x10ee9a[_0xdc24('0x36')]);_0x22f9ab[_0xdc24('0x3a')]=_[_0xdc24('0x38')](_0x10ee9a[_0xdc24('0x39')],qs[_0xdc24('0x3b')](_0x3238a9[_0xdc24('0x36')][_0xdc24('0x3b')]));_0x22f9ab[_0xdc24('0x3a')]=_0x22f9ab[_0xdc24('0x3a')]['length']?_0x22f9ab[_0xdc24('0x3a')]:_0x10ee9a[_0xdc24('0x39')];if(!_0x3238a9['query'][_0xdc24('0x3c')](_0xdc24('0x3d'))){_0x22f9ab[_0xdc24('0x22')]=qs['limit'](_0x3238a9['query']['limit']);_0x22f9ab[_0xdc24('0x21')]=qs[_0xdc24('0x21')](_0x3238a9[_0xdc24('0x36')][_0xdc24('0x21')]);}_0x22f9ab[_0xdc24('0x3e')]=qs[_0xdc24('0x3f')](_0x3238a9[_0xdc24('0x36')][_0xdc24('0x3f')]);_0x22f9ab['where']=qs[_0xdc24('0x37')](_['pick'](_0x3238a9[_0xdc24('0x36')],_0x10ee9a[_0xdc24('0x37')]),_0x52dd5e);if(_0x3238a9[_0xdc24('0x36')][_0xdc24('0x40')]){_0x22f9ab[_0xdc24('0x41')]=_[_0xdc24('0x42')](_0x22f9ab[_0xdc24('0x41')],{'$or':_[_0xdc24('0x31')](_0x52dd5e,function(_0x45b599){if(_0x45b599[_0xdc24('0x43')]!=='VIRTUAL'){var _0x129bad={};_0x129bad[_0x45b599[_0xdc24('0x2f')]]={'$like':'%'+_0x3238a9['query']['filter']+'%'};return _0x129bad;}})});}_0x22f9ab=_[_0xdc24('0x42')]({},_0x22f9ab,_0x3238a9[_0xdc24('0x44')]);var _0x59eb7a={'where':_0x22f9ab['where']};return db[_0xdc24('0x32')]['count'](_0x59eb7a)[_0xdc24('0x28')](function(_0x578324){_0x5cff42[_0xdc24('0x20')]=_0x578324;if(_0x3238a9[_0xdc24('0x36')]['includeAll']){_0x22f9ab[_0xdc24('0x45')]=[{'all':!![]}];}return db['Dashboard'][_0xdc24('0x46')](_0x22f9ab);})[_0xdc24('0x28')](function(_0x197332){_0x5cff42[_0xdc24('0x47')]=_0x197332;return _0x5cff42;})[_0xdc24('0x28')](respondWithFilteredResult(_0xa0d2a6,_0x22f9ab))['catch'](handleError(_0xa0d2a6,null));};exports['show']=function(_0x343a45,_0x2fa8e2){var _0x227df6={'raw':![],'where':{'id':_0x343a45['params']['id']}},_0xca53={};_0xca53[_0xdc24('0x39')]=_[_0xdc24('0x48')](db[_0xdc24('0x32')][_0xdc24('0x33')]);_0xca53['query']=_[_0xdc24('0x48')](_0x343a45['query']);_0xca53[_0xdc24('0x37')]=_['intersection'](_0xca53[_0xdc24('0x39')],_0xca53[_0xdc24('0x36')]);_0x227df6[_0xdc24('0x3a')]=_[_0xdc24('0x38')](_0xca53[_0xdc24('0x39')],qs[_0xdc24('0x3b')](_0x343a45[_0xdc24('0x36')]['fields']));_0x227df6[_0xdc24('0x3a')]=_0x227df6[_0xdc24('0x3a')][_0xdc24('0x49')]?_0x227df6[_0xdc24('0x3a')]:_0xca53[_0xdc24('0x39')];if(_0x343a45[_0xdc24('0x36')][_0xdc24('0x4a')]){_0x227df6['include']=[{'all':!![]}];}_0x227df6=_[_0xdc24('0x42')]({},_0x227df6,_0x343a45[_0xdc24('0x44')]);return db[_0xdc24('0x32')][_0xdc24('0x4b')](_0x227df6)[_0xdc24('0x28')](handleEntityNotFound(_0x2fa8e2,null))[_0xdc24('0x28')](respondWithResult(_0x2fa8e2,null))['catch'](handleError(_0x2fa8e2,null));};exports[_0xdc24('0x4c')]=function(_0x49c4d2,_0x1ecaa0){return db[_0xdc24('0x32')][_0xdc24('0x4c')](_0x49c4d2[_0xdc24('0x4d')],{})[_0xdc24('0x28')](function(_0x49eb9a){var _0x15a1e4=_0x49c4d2[_0xdc24('0x4e')][_0xdc24('0x2a')]({'plain':!![]});if(!_0x15a1e4)throw new Error(_0xdc24('0x4f'));if(_0x15a1e4['role']===_0xdc24('0x4e')){var _0x8fb2f2=_0x49eb9a[_0xdc24('0x2a')]({'plain':!![]});var _0x14d361=_0xdc24('0x2b');return db[_0xdc24('0x50')][_0xdc24('0x4b')]({'where':{'name':_0x14d361,'userProfileId':_0x15a1e4[_0xdc24('0x51')]},'raw':!![]})[_0xdc24('0x28')](function(_0x3ef8d8){if(_0x3ef8d8&&_0x3ef8d8[_0xdc24('0x52')]===0x0){return db[_0xdc24('0x2c')][_0xdc24('0x4c')]({'name':_0x8fb2f2['name'],'resourceId':_0x8fb2f2['id'],'type':_0x3ef8d8[_0xdc24('0x2f')],'sectionId':_0x3ef8d8['id']},{})[_0xdc24('0x28')](function(){return _0x49eb9a;});}else{return _0x49eb9a;}})['catch'](function(_0x40e959){logger['error'](_0xdc24('0x53'),_0x40e959);throw _0x40e959;});}return _0x49eb9a;})[_0xdc24('0x28')](respondWithResult(_0x1ecaa0,0xc9))['catch'](handleError(_0x1ecaa0,null));};exports[_0xdc24('0x54')]=function(_0x4fec04,_0x11a97e){var _0x707964={'where':{'id':_0x4fec04[_0xdc24('0x55')]['id']}},_0x2f22b0={};_0x2f22b0[_0xdc24('0x39')]=_[_0xdc24('0x48')](db[_0xdc24('0x32')]['rawAttributes']);_0x707964[_0xdc24('0x3a')]=_['intersection'](_0x2f22b0[_0xdc24('0x39')],qs[_0xdc24('0x3b')](_0x4fec04['query'][_0xdc24('0x3b')]));_0x707964[_0xdc24('0x3a')]=_0x707964['attributes'][_0xdc24('0x49')]?_0x707964[_0xdc24('0x3a')]:_0x2f22b0[_0xdc24('0x39')];if(_0x4fec04['query'][_0xdc24('0x4a')]){_0x707964[_0xdc24('0x45')]=[{'all':!![]}];}_0x707964=_[_0xdc24('0x42')]({},_0x707964,_0x4fec04['options']);return db[_0xdc24('0x32')][_0xdc24('0x4b')](_0x707964)['then'](handleEntityNotFound(_0x11a97e,null))[_0xdc24('0x28')](function(_0x4afb53){if(_0x4afb53){var _0x124e2f=_0x4afb53['get']({'plain':!![]});_0x124e2f=qs[_0xdc24('0x56')](_0x124e2f,['id',_0xdc24('0x57'),_0xdc24('0x58')]);_0x4fec04['body']=_[_0xdc24('0x56')](_0x4fec04['body'],['id',_0xdc24('0x57'),_0xdc24('0x58')]);return db[_0xdc24('0x32')][_0xdc24('0x4c')](_[_0xdc24('0x42')](_0x124e2f,_0x4fec04[_0xdc24('0x4d')]),{'include':_0x4fec04[_0xdc24('0x36')]['includeAll']?[{'all':!![]}]:undefined})[_0xdc24('0x28')](function(_0x21e060){var _0x154450=_0x4fec04[_0xdc24('0x4e')][_0xdc24('0x2a')]({'plain':!![]});if(!_0x154450)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x154450[_0xdc24('0x59')]===_0xdc24('0x4e')){var _0x566152=_0x21e060[_0xdc24('0x2a')]({'plain':!![]});var _0x363f56=_0xdc24('0x2b');return db[_0xdc24('0x50')]['find']({'where':{'name':_0x363f56,'userProfileId':_0x154450[_0xdc24('0x51')]},'raw':!![]})[_0xdc24('0x28')](function(_0x52468a){if(_0x52468a&&_0x52468a['autoAssociation']===0x0){return db['UserProfileResource'][_0xdc24('0x4c')]({'name':_0x566152[_0xdc24('0x2f')],'resourceId':_0x566152['id'],'type':_0x52468a['name'],'sectionId':_0x52468a['id']},{})[_0xdc24('0x28')](function(){return _0x21e060;});}else{return _0x21e060;}})[_0xdc24('0x5a')](function(_0x345a61){logger[_0xdc24('0x2d')](_0xdc24('0x53'),_0x345a61);throw _0x345a61;});}return _0x21e060;});}})[_0xdc24('0x28')](respondWithResult(_0x11a97e,0xc9))[_0xdc24('0x5a')](handleError(_0x11a97e,null));};exports[_0xdc24('0x27')]=function(_0x3f0d42,_0x8830d1){if(_0x3f0d42[_0xdc24('0x4d')]['id']){delete _0x3f0d42[_0xdc24('0x4d')]['id'];}return db[_0xdc24('0x32')][_0xdc24('0x4b')]({'where':{'id':_0x3f0d42[_0xdc24('0x55')]['id']}})['then'](handleEntityNotFound(_0x8830d1,null))[_0xdc24('0x28')](saveUpdates(_0x3f0d42['body'],null))[_0xdc24('0x28')](respondWithResult(_0x8830d1,null))['catch'](handleError(_0x8830d1,null));};exports['destroy']=function(_0x40f07e,_0x57a57e){return db[_0xdc24('0x32')][_0xdc24('0x4b')]({'where':{'id':_0x40f07e[_0xdc24('0x55')]['id']}})[_0xdc24('0x28')](handleEntityNotFound(_0x57a57e,null))[_0xdc24('0x28')](removeEntity(_0x57a57e,null))[_0xdc24('0x5a')](handleError(_0x57a57e,null));};function widgetAttributes(_0x56b116){try{switch(_0x56b116[_0xdc24('0x43')]){case _0xdc24('0x5b'):return[{'name':_0xdc24('0x5c'),'value':_0x56b116[_0xdc24('0x5c')]||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116['attrs'][0x0]?_0x56b116['attrs'][0x0][_0xdc24('0x5e')]:undefined)||_0xdc24('0x5f')}];case _0xdc24('0x60'):return[{'name':_0xdc24('0x61'),'value':_0x56b116[_0xdc24('0x61')]||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116['attrs'][0x0]?_0x56b116[_0xdc24('0x5d')][0x0][_0xdc24('0x5e')]:undefined)||''}];case _0xdc24('0x62'):return[{'name':_0xdc24('0x63'),'value':_0x56b116[_0xdc24('0x63')]||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116['attrs'][0x0]?_0x56b116[_0xdc24('0x5d')][0x0][_0xdc24('0x5e')]:undefined)||_0xdc24('0x64')},{'name':_0xdc24('0x65'),'value':_0x56b116[_0xdc24('0x65')]||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x1]?_0x56b116[_0xdc24('0x5d')][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x56b116[_0xdc24('0x66')]||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x2]?_0x56b116[_0xdc24('0x5d')][0x2][_0xdc24('0x5e')]:undefined)||0xc}];case _0xdc24('0x67'):return[{'name':_0xdc24('0x68'),'value':_0x56b116['attrMetric']||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x0]?_0x56b116['attrs'][0x0]['value']:undefined)||_0xdc24('0x69')},{'name':'attrVoiceQueues','value':_0x56b116[_0xdc24('0x6a')]||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x1]?_0x56b116[_0xdc24('0x5d')][0x1][_0xdc24('0x5e')]:undefined)||[]},{'name':'attrFontSize','value':_0x56b116[_0xdc24('0x66')]||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x2]?_0x56b116[_0xdc24('0x5d')][0x2][_0xdc24('0x5e')]:undefined)||0x14},{'name':_0xdc24('0x6b'),'value':_0x56b116['attrChannel']||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x3]?_0x56b116[_0xdc24('0x5d')][0x3][_0xdc24('0x5e')]:undefined)||_0xdc24('0x6c')},{'name':'attrEmailAccounts','value':_0x56b116['attrEmailAccounts']||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x4]?_0x56b116[_0xdc24('0x5d')][0x4][_0xdc24('0x5e')]:undefined)||''},{'name':_0xdc24('0x6d'),'value':_0x56b116[_0xdc24('0x6d')]||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x5]?_0x56b116[_0xdc24('0x5d')][0x5][_0xdc24('0x5e')]:undefined)||''},{'name':_0xdc24('0x6e'),'value':_0x56b116[_0xdc24('0x6e')]||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x6]?_0x56b116[_0xdc24('0x5d')][0x6]['value']:undefined)||''},{'name':_0xdc24('0x6f'),'value':_0x56b116[_0xdc24('0x6f')]||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x7]?_0x56b116[_0xdc24('0x5d')][0x7]['value']:undefined)||''},{'name':_0xdc24('0x70'),'value':_0x56b116[_0xdc24('0x70')]||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x8]?_0x56b116['attrs'][0x8][_0xdc24('0x5e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x56b116[_0xdc24('0x71')]||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x9]?_0x56b116[_0xdc24('0x5d')][0x9][_0xdc24('0x5e')]:undefined)||''}];case _0xdc24('0x72'):case _0xdc24('0x73'):return[{'name':_0xdc24('0x74'),'value':_0x56b116[_0xdc24('0x74')]||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x0]?_0x56b116['attrs'][0x0]['value']:undefined)||_0xdc24('0x69')},{'name':_0xdc24('0x75'),'value':_0x56b116[_0xdc24('0x75')]||(_0x56b116['attrs']&&_0x56b116[_0xdc24('0x5d')][0x1]?_0x56b116[_0xdc24('0x5d')][0x1][_0xdc24('0x5e')]:undefined)||null},{'name':_0xdc24('0x76'),'value':_0x56b116[_0xdc24('0x76')]||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x2]?_0x56b116[_0xdc24('0x5d')][0x2][_0xdc24('0x5e')]:undefined)||null},{'name':_0xdc24('0x6a'),'value':_0x56b116['attrVoiceQueues']||(_0x56b116['attrs']&&_0x56b116[_0xdc24('0x5d')][0x3]?_0x56b116['attrs'][0x3][_0xdc24('0x5e')]:undefined)||[]},{'name':_0xdc24('0x6b'),'value':_0x56b116['attrChannel']||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x4]?_0x56b116['attrs'][0x4][_0xdc24('0x5e')]:undefined)||_0xdc24('0x6c')},{'name':_0xdc24('0x77'),'value':_0x56b116['attrEmailAccounts']||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x5]?_0x56b116[_0xdc24('0x5d')][0x5][_0xdc24('0x5e')]:undefined)||''},{'name':_0xdc24('0x6d'),'value':_0x56b116['attrFaxAccounts']||(_0x56b116['attrs']&&_0x56b116[_0xdc24('0x5d')][0x6]?_0x56b116[_0xdc24('0x5d')][0x6][_0xdc24('0x5e')]:undefined)||''},{'name':_0xdc24('0x6e'),'value':_0x56b116[_0xdc24('0x6e')]||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x7]?_0x56b116[_0xdc24('0x5d')][0x7][_0xdc24('0x5e')]:undefined)||''},{'name':_0xdc24('0x6f'),'value':_0x56b116['attrOpenchannelAccounts']||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116['attrs'][0x8]?_0x56b116[_0xdc24('0x5d')][0x8]['value']:undefined)||''},{'name':_0xdc24('0x70'),'value':_0x56b116['attrWhatsappAccounts']||(_0x56b116['attrs']&&_0x56b116[_0xdc24('0x5d')][0x9]?_0x56b116['attrs'][0x9][_0xdc24('0x5e')]:undefined)||''},{'name':_0xdc24('0x71'),'value':_0x56b116['attrChatWebsites']||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116['attrs'][0xa]?_0x56b116[_0xdc24('0x5d')][0xa][_0xdc24('0x5e')]:undefined)||''}];case _0xdc24('0x78'):return[{'name':_0xdc24('0x79'),'type':_0x56b116['reportType']||(_0x56b116['attrs']&&_0x56b116['attrs'][0x0]?_0x56b116[_0xdc24('0x5d')][0x0][_0xdc24('0x43')]:undefined)||null,'value':_0x56b116[_0xdc24('0x79')]||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116[_0xdc24('0x5d')][0x0]?_0x56b116['attrs'][0x0]['value']:undefined)||null},{'name':_0xdc24('0x7a'),'value':_0x56b116[_0xdc24('0x7a')]||(_0x56b116[_0xdc24('0x5d')]&&_0x56b116['attrs'][0x1]?_0x56b116[_0xdc24('0x5d')][0x1][_0xdc24('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x2b115b){logger[_0xdc24('0x2d')](_0xdc24('0x7b'),JSON[_0xdc24('0x7c')](_0x2b115b));return[];}}exports[_0xdc24('0x7d')]=function(_0x59e5c5,_0x4be33d,_0xb1acf4){if(_0x59e5c5[_0xdc24('0x4d')]['id']){delete _0x59e5c5[_0xdc24('0x4d')]['id'];}return db[_0xdc24('0x32')]['find']({'where':{'id':_0x59e5c5[_0xdc24('0x55')]['id']}})[_0xdc24('0x28')](handleEntityNotFound(_0x4be33d,null))[_0xdc24('0x28')](function(_0x23181f){if(_0x23181f){_0x59e5c5[_0xdc24('0x4d')][_0xdc24('0x7e')]=_0x23181f['id'];_0x59e5c5['body'][_0xdc24('0x5d')]=widgetAttributes(_0x59e5c5['body']);return db[_0xdc24('0x7f')][_0xdc24('0x4c')](_0x59e5c5[_0xdc24('0x4d')]);}})['then'](respondWithResult(_0x4be33d,null))['catch'](handleError(_0x4be33d,null));};exports[_0xdc24('0x80')]=function(_0x38cc7a,_0x159a35,_0x1b079e){var _0x1b8647={};var _0x3c2682={};var _0xc8adeb;var _0x52bbd7;return db[_0xdc24('0x32')][_0xdc24('0x81')]({'where':{'id':_0x38cc7a[_0xdc24('0x55')]['id']}})['then'](handleEntityNotFound(_0x159a35,null))[_0xdc24('0x28')](function(_0x1b9d2f){if(_0x1b9d2f){_0xc8adeb=_0x1b9d2f;_0x3c2682[_0xdc24('0x39')]=_['keys'](db[_0xdc24('0x7f')][_0xdc24('0x33')]);_0x3c2682[_0xdc24('0x36')]=_[_0xdc24('0x48')](_0x38cc7a[_0xdc24('0x36')]);_0x3c2682[_0xdc24('0x37')]=_[_0xdc24('0x38')](_0x3c2682[_0xdc24('0x39')],_0x3c2682[_0xdc24('0x36')]);_0x1b8647[_0xdc24('0x3a')]=_[_0xdc24('0x38')](_0x3c2682['model'],qs[_0xdc24('0x3b')](_0x38cc7a[_0xdc24('0x36')][_0xdc24('0x3b')]));_0x1b8647[_0xdc24('0x3a')]=_0x1b8647[_0xdc24('0x3a')]['length']?_0x1b8647['attributes']:_0x3c2682[_0xdc24('0x39')];_0x1b8647[_0xdc24('0x3e')]=qs[_0xdc24('0x3f')](_0x38cc7a[_0xdc24('0x36')]['sort']);_0x1b8647[_0xdc24('0x41')]=qs[_0xdc24('0x37')](_[_0xdc24('0x82')](_0x38cc7a[_0xdc24('0x36')],_0x3c2682['filters']));if(_0x38cc7a[_0xdc24('0x36')][_0xdc24('0x40')]){_0x1b8647[_0xdc24('0x41')]=_[_0xdc24('0x42')](_0x1b8647['where'],{'$or':_[_0xdc24('0x31')](_0x1b8647[_0xdc24('0x3a')],function(_0x1c0f18){var _0x51e3d6={};_0x51e3d6[_0x1c0f18]={'$like':'%'+_0x38cc7a[_0xdc24('0x36')]['filter']+'%'};return _0x51e3d6;})});}_0x1b8647=_['merge']({},_0x1b8647,_0x38cc7a[_0xdc24('0x44')]);return _0xc8adeb[_0xdc24('0x80')](_0x1b8647);}})['then'](function(_0x12f92c){if(_0x12f92c){_0x52bbd7=_0x12f92c[_0xdc24('0x49')];if(!_0x38cc7a[_0xdc24('0x36')]['hasOwnProperty']('nolimit')){_0x1b8647['limit']=qs[_0xdc24('0x22')](_0x38cc7a[_0xdc24('0x36')][_0xdc24('0x22')]);_0x1b8647[_0xdc24('0x21')]=qs[_0xdc24('0x21')](_0x38cc7a['query'][_0xdc24('0x21')]);}return _0xc8adeb[_0xdc24('0x80')](_0x1b8647);}})['then'](function(_0x504a8d){if(_0x504a8d){return _0x504a8d?{'count':_0x52bbd7,'rows':_0x504a8d}:null;}})[_0xdc24('0x28')](respondWithResult(_0x159a35,null))[_0xdc24('0x5a')](handleError(_0x159a35,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 89409e3..06d3fee 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 _0x618a=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard'];(function(_0x1fd201,_0x4ace6b){var _0x260194=function(_0x325af7){while(--_0x325af7){_0x1fd201['push'](_0x1fd201['shift']());}};_0x260194(++_0x4ace6b);}(_0x618a,0xe3));var _0xa618=function(_0x4ec69a,_0x2826de){_0x4ec69a=_0x4ec69a-0x0;var _0x280921=_0x618a[_0x4ec69a];return _0x280921;};'use strict';var EventEmitter=require(_0xa618('0x0'));var Dashboard=require(_0xa618('0x1'))['db'][_0xa618('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa618('0x3')](0x0);var events={'afterCreate':_0xa618('0x4'),'afterUpdate':'update','afterDestroy':_0xa618('0x5')};function emitEvent(_0x651ae2){return function(_0x39df27,_0x4f8af6,_0x3d33e9){DashboardEvents[_0xa618('0x6')](_0x651ae2+':'+_0x39df27['id'],_0x39df27);DashboardEvents[_0xa618('0x6')](_0x651ae2,_0x39df27);_0x3d33e9(null);};}for(var e in events){if(events[_0xa618('0x7')](e)){var event=events[e];Dashboard[_0xa618('0x8')](e,emitEvent(event));}}module[_0xa618('0x9')]=DashboardEvents; \ No newline at end of file +var _0x5396=['events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3ff330,_0x18f005){var _0x18e14e=function(_0x1f4941){while(--_0x1f4941){_0x3ff330['push'](_0x3ff330['shift']());}};_0x18e14e(++_0x18f005);}(_0x5396,0x134));var _0x6539=function(_0x4bedbe,_0x2743f2){_0x4bedbe=_0x4bedbe-0x0;var _0x48bf61=_0x5396[_0x4bedbe];return _0x48bf61;};'use strict';var EventEmitter=require(_0x6539('0x0'));var Dashboard=require(_0x6539('0x1'))['db'][_0x6539('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x6539('0x3')](0x0);var events={'afterCreate':_0x6539('0x4'),'afterUpdate':_0x6539('0x5'),'afterDestroy':_0x6539('0x6')};function emitEvent(_0x58a35f){return function(_0x5bea39,_0x574389,_0x27972e){DashboardEvents[_0x6539('0x7')](_0x58a35f+':'+_0x5bea39['id'],_0x5bea39);DashboardEvents[_0x6539('0x7')](_0x58a35f,_0x5bea39);_0x27972e(null);};}for(var e in events){if(events[_0x6539('0x8')](e)){var event=events[e];Dashboard[_0x6539('0x9')](e,emitEvent(event));}}module[_0x6539('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index adc7fd2..e59c12d 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 _0x4655=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard'];(function(_0x5742b8,_0x244cae){var _0x232029=function(_0x4aef8a){while(--_0x4aef8a){_0x5742b8['push'](_0x5742b8['shift']());}};_0x232029(++_0x244cae);}(_0x4655,0x11e));var _0x5465=function(_0x24c37c,_0x251858){_0x24c37c=_0x24c37c-0x0;var _0x1d97bb=_0x4655[_0x24c37c];return _0x1d97bb;};'use strict';var _=require('lodash');var util=require(_0x5465('0x0'));var logger=require(_0x5465('0x1'))(_0x5465('0x2'));var moment=require(_0x5465('0x3'));var BPromise=require(_0x5465('0x4'));var rp=require(_0x5465('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5465('0x6'));var config=require(_0x5465('0x7'));var attributes=require(_0x5465('0x8'));module['exports']=function(_0x23687e,_0x11d95f){return _0x23687e[_0x5465('0x9')](_0x5465('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa19=['rimraf','../../config/environment','define','Dashboard','dashboards','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4bbf52,_0x3bca03){var _0x545de0=function(_0x9ec4ec){while(--_0x9ec4ec){_0x4bbf52['push'](_0x4bbf52['shift']());}};_0x545de0(++_0x3bca03);}(_0xaa19,0x139));var _0x9aa1=function(_0x573831,_0x2623e2){_0x573831=_0x573831-0x0;var _0x4a3912=_0xaa19[_0x573831];return _0x4a3912;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9aa1('0x0'))(_0x9aa1('0x1'));var moment=require(_0x9aa1('0x2'));var BPromise=require(_0x9aa1('0x3'));var rp=require(_0x9aa1('0x4'));var fs=require('fs');var path=require(_0x9aa1('0x5'));var rimraf=require(_0x9aa1('0x6'));var config=require(_0x9aa1('0x7'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x340e5e,_0x22eb17){return _0x340e5e[_0x9aa1('0x8')](_0x9aa1('0x9'),attributes,{'tableName':_0x9aa1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 0524a9c..7c6f9fa 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 _0xdd2c=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','catch'];(function(_0x4e3436,_0x218fcd){var _0x43899d=function(_0x1d7d74){while(--_0x1d7d74){_0x4e3436['push'](_0x4e3436['shift']());}};_0x43899d(++_0x218fcd);}(_0xdd2c,0x16c));var _0xcdd2=function(_0x235797,_0x34f2dc){_0x235797=_0x235797-0x0;var _0x25000d=_0xdd2c[_0x235797];return _0x25000d;};'use strict';var _=require(_0xcdd2('0x0'));var util=require(_0xcdd2('0x1'));var moment=require(_0xcdd2('0x2'));var BPromise=require(_0xcdd2('0x3'));var rs=require(_0xcdd2('0x4'));var fs=require('fs');var Redis=require(_0xcdd2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdd2('0x6'));var logger=require(_0xcdd2('0x7'))(_0xcdd2('0x8'));var config=require(_0xcdd2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcdd2('0xa')][_0xcdd2('0xb')]({'port':0x232a});config[_0xcdd2('0xc')]=_[_0xcdd2('0xd')](config[_0xcdd2('0xc')],{'host':_0xcdd2('0xe'),'port':0x18eb});var socket=require(_0xcdd2('0xf'))(new Redis(config[_0xcdd2('0xc')]));require('./dashboard.socket')[_0xcdd2('0x10')](socket);function respondWithRpcPromise(_0x26723d,_0x28ad39,_0x1d713a){return new BPromise(function(_0x2aa96a,_0x3fcf27){return client['request'](_0x26723d,_0x1d713a)[_0xcdd2('0x11')](function(_0x2da78e){logger[_0xcdd2('0x12')]('Dashboard,\x20%s,\x20%s',_0x28ad39,_0xcdd2('0x13'));logger[_0xcdd2('0x14')](_0xcdd2('0x15'),_0x28ad39,_0xcdd2('0x13'),JSON[_0xcdd2('0x16')](_0x2da78e));if(_0x2da78e[_0xcdd2('0x17')]){if(_0x2da78e[_0xcdd2('0x17')][_0xcdd2('0x18')]===0x1f4){logger[_0xcdd2('0x17')](_0xcdd2('0x19'),_0x28ad39,_0x2da78e[_0xcdd2('0x17')]['message']);return _0x3fcf27(_0x2da78e[_0xcdd2('0x17')][_0xcdd2('0x1a')]);}logger[_0xcdd2('0x17')](_0xcdd2('0x19'),_0x28ad39,_0x2da78e['error'][_0xcdd2('0x1a')]);return _0x2aa96a(_0x2da78e[_0xcdd2('0x17')][_0xcdd2('0x1a')]);}else{logger[_0xcdd2('0x12')](_0xcdd2('0x19'),_0x28ad39,_0xcdd2('0x13'));_0x2aa96a(_0x2da78e['result']['message']);}})[_0xcdd2('0x1b')](function(_0xe3f9){logger['error']('Dashboard,\x20%s,\x20%s',_0x28ad39,_0xe3f9);_0x3fcf27(_0xe3f9);});});} \ No newline at end of file +var _0x1233=['request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./dashboard.socket','request','info','Dashboard,\x20%s,\x20%s'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0x1233,0x1ca));var _0x3123=function(_0x3c858f,_0x235201){_0x3c858f=_0x3c858f-0x0;var _0x198090=_0x1233[_0x3c858f];return _0x198090;};'use strict';var _=require('lodash');var util=require(_0x3123('0x0'));var moment=require(_0x3123('0x1'));var BPromise=require('bluebird');var rs=require(_0x3123('0x2'));var fs=require('fs');var Redis=require(_0x3123('0x3'));var db=require(_0x3123('0x4'))['db'];var utils=require(_0x3123('0x5'));var logger=require(_0x3123('0x6'))(_0x3123('0x7'));var config=require(_0x3123('0x8'));var jayson=require(_0x3123('0x9'));var client=jayson[_0x3123('0xa')][_0x3123('0xb')]({'port':0x232a});config[_0x3123('0xc')]=_['defaults'](config[_0x3123('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3123('0xc')]));require(_0x3123('0xd'))['register'](socket);function respondWithRpcPromise(_0x1dd10c,_0x10a97e,_0x2c701f){return new BPromise(function(_0x9b08a9,_0x7ddacb){return client[_0x3123('0xe')](_0x1dd10c,_0x2c701f)['then'](function(_0x5bfdc8){logger[_0x3123('0xf')](_0x3123('0x10'),_0x10a97e,_0x3123('0x11'));logger['debug'](_0x3123('0x12'),_0x10a97e,_0x3123('0x11'),JSON[_0x3123('0x13')](_0x5bfdc8));if(_0x5bfdc8[_0x3123('0x14')]){if(_0x5bfdc8['error'][_0x3123('0x15')]===0x1f4){logger['error'](_0x3123('0x10'),_0x10a97e,_0x5bfdc8[_0x3123('0x14')][_0x3123('0x16')]);return _0x7ddacb(_0x5bfdc8['error'][_0x3123('0x16')]);}logger[_0x3123('0x14')](_0x3123('0x10'),_0x10a97e,_0x5bfdc8['error'][_0x3123('0x16')]);return _0x9b08a9(_0x5bfdc8[_0x3123('0x14')]['message']);}else{logger[_0x3123('0xf')]('Dashboard,\x20%s,\x20%s',_0x10a97e,_0x3123('0x11'));_0x9b08a9(_0x5bfdc8[_0x3123('0x17')][_0x3123('0x16')]);}})[_0x3123('0x18')](function(_0x3a06d5){logger['error']('Dashboard,\x20%s,\x20%s',_0x10a97e,_0x3a06d5);_0x7ddacb(_0x3a06d5);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index db9ac09..005767b 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 _0x42d2=['update','emit','removeListener','register','dashboard:','./dashboard.events','save'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x42d2,0xc9));var _0x242d=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x42d2[_0x278e3c];return _0x3e2d9b;};'use strict';var DashboardEvents=require(_0x242d('0x0'));var events=[_0x242d('0x1'),'remove',_0x242d('0x2')];function createListener(_0x181309,_0x3c1109){return function(_0x6cd84f){_0x3c1109[_0x242d('0x3')](_0x181309,_0x6cd84f);};}function removeListener(_0xb62687,_0x122886){return function(){DashboardEvents[_0x242d('0x4')](_0xb62687,_0x122886);};}exports[_0x242d('0x5')]=function(_0x57eb6e){for(var _0xadeb56=0x0,_0x31e0a7=events['length'];_0xadeb56<_0x31e0a7;_0xadeb56++){var _0x445709=events[_0xadeb56];var _0x48acc5=createListener(_0x242d('0x6')+_0x445709,_0x57eb6e);DashboardEvents['on'](_0x445709,_0x48acc5);}}; \ No newline at end of file +var _0xa315=['dashboard:','save','remove','update','emit','removeListener','length'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xa315,0x19e));var _0x5a31=function(_0x4a45b4,_0x59804f){_0x4a45b4=_0x4a45b4-0x0;var _0x1a99c9=_0xa315[_0x4a45b4];return _0x1a99c9;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x5a31('0x0'),_0x5a31('0x1'),_0x5a31('0x2')];function createListener(_0x44271d,_0x3668e8){return function(_0x3928f8){_0x3668e8[_0x5a31('0x3')](_0x44271d,_0x3928f8);};}function removeListener(_0x58ff4c,_0x589f55){return function(){DashboardEvents[_0x5a31('0x4')](_0x58ff4c,_0x589f55);};}exports['register']=function(_0x1b6f0c){for(var _0x581bc3=0x0,_0x213732=events[_0x5a31('0x5')];_0x581bc3<_0x213732;_0x581bc3++){var _0x5222da=events[_0x581bc3];var _0x11f4cb=createListener(_0x5a31('0x6')+_0x5222da,_0x1b6f0c);DashboardEvents['on'](_0x5222da,_0x11f4cb);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index d09e581..cb9c01e 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 _0x4e78=['delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','getItems','post','/:id/clone','clone','/:id/items','addItem'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x4e78,0xaa));var _0x84e7=function(_0x304b67,_0x31cb39){_0x304b67=_0x304b67-0x0;var _0x493afb=_0x4e78[_0x304b67];return _0x493afb;};'use strict';var multer=require(_0x84e7('0x0'));var util=require(_0x84e7('0x1'));var path=require(_0x84e7('0x2'));var timeout=require(_0x84e7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x84e7('0x4'));var interaction=require(_0x84e7('0x5'));var config=require(_0x84e7('0x6'));var controller=require(_0x84e7('0x7'));router[_0x84e7('0x8')]('/',auth[_0x84e7('0x9')](),controller[_0x84e7('0xa')]);router[_0x84e7('0x8')](_0x84e7('0xb'),auth[_0x84e7('0x9')](),controller[_0x84e7('0xc')]);router['get']('/:id/items',auth['isAuthenticated'](),controller[_0x84e7('0xd')]);router['post']('/',auth[_0x84e7('0x9')](),controller['create']);router[_0x84e7('0xe')](_0x84e7('0xf'),auth[_0x84e7('0x9')](),controller[_0x84e7('0x10')]);router[_0x84e7('0xe')](_0x84e7('0x11'),auth[_0x84e7('0x9')](),controller[_0x84e7('0x12')]);router['put']('/:id',auth[_0x84e7('0x9')](),controller['update']);router[_0x84e7('0x13')](_0x84e7('0xb'),auth[_0x84e7('0x9')](),controller['destroy']);module[_0x84e7('0x14')]=router; \ No newline at end of file +var _0x5ee4=['../../components/auth/service','../../components/interaction/service','./dashboard.controller','isAuthenticated','index','get','show','/:id/items','post','create','/:id/clone','clone','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x55e734,_0x4d6bd4){var _0x12cda9=function(_0x1ac7ff){while(--_0x1ac7ff){_0x55e734['push'](_0x55e734['shift']());}};_0x12cda9(++_0x4d6bd4);}(_0x5ee4,0xf7));var _0x45ee=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x5ee4[_0x4e676e];return _0x336a3c;};'use strict';var multer=require('multer');var util=require(_0x45ee('0x0'));var path=require(_0x45ee('0x1'));var timeout=require(_0x45ee('0x2'));var express=require(_0x45ee('0x3'));var router=express[_0x45ee('0x4')]();var fs_extra=require(_0x45ee('0x5'));var auth=require(_0x45ee('0x6'));var interaction=require(_0x45ee('0x7'));var config=require('../../config/environment');var controller=require(_0x45ee('0x8'));router['get']('/',auth[_0x45ee('0x9')](),controller[_0x45ee('0xa')]);router[_0x45ee('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x45ee('0xc')]);router[_0x45ee('0xb')](_0x45ee('0xd'),auth['isAuthenticated'](),controller['getItems']);router[_0x45ee('0xe')]('/',auth[_0x45ee('0x9')](),controller[_0x45ee('0xf')]);router[_0x45ee('0xe')](_0x45ee('0x10'),auth[_0x45ee('0x9')](),controller[_0x45ee('0x11')]);router[_0x45ee('0xe')]('/:id/items',auth[_0x45ee('0x9')](),controller['addItem']);router[_0x45ee('0x12')](_0x45ee('0x13'),auth['isAuthenticated'](),controller[_0x45ee('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x45ee('0x15')]);module[_0x45ee('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 143101d..820bbab 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 _0x7096=['setDataValue','stringify','INTEGER','#ffffff','squel','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7096,0x10c));var _0x6709=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x7096[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x6709('0x0'));var _=require('lodash');module[_0x6709('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6709('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6709('0x3')](_0x6709('0x4')),'get':function(){try{return JSON[_0x6709('0x5')](this[_0x6709('0x6')](_0x6709('0x7')));}catch(_0xb8fe6d){return[];}},'set':function(_0x9d630f){try{this[_0x6709('0x8')](_0x6709('0x7'),JSON[_0x6709('0x9')](_0x9d630f));}catch(_0x985814){this[_0x6709('0x8')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6709('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6709('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x6709('0xa')]},'col':{'type':Sequelize[_0x6709('0xa')]},'background':{'type':Sequelize[_0x6709('0x2')],'allowNull':![],'defaultValue':_0x6709('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6709('0x2')]},'titleFontSize':{'type':Sequelize[_0x6709('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x1261=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0x1261,0x144));var _0x1126=function(_0xf35bc1,_0x510803){_0xf35bc1=_0xf35bc1-0x0;var _0xa6b162=_0x1261[_0xf35bc1];return _0xa6b162;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x1126('0x0'));var _=require(_0x1126('0x1'));module[_0x1126('0x2')]={'title':{'type':Sequelize[_0x1126('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1126('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x1126('0x4')](_0x1126('0x5')),'get':function(){try{return JSON[_0x1126('0x6')](this[_0x1126('0x7')](_0x1126('0x8')));}catch(_0x5a2189){return[];}},'set':function(_0x5c68c8){try{this[_0x1126('0x9')](_0x1126('0x8'),JSON['stringify'](_0x5c68c8));}catch(_0x17e5f0){this[_0x1126('0x9')](_0x1126('0x8'),JSON[_0x1126('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x1126('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1126('0xb')]},'col':{'type':Sequelize[_0x1126('0xb')]},'background':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1126('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 d234d58..5357948 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 _0xdcfa=['end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','sendStatus','error','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','attributes','intersection','fields','length','include','merge','options','catch','destroy','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','status'];(function(_0x4b3d13,_0x1993d5){var _0xf64dd8=function(_0x2304ed){while(--_0x2304ed){_0x4b3d13['push'](_0x4b3d13['shift']());}};_0xf64dd8(++_0x1993d5);}(_0xdcfa,0xad));var _0xadcf=function(_0x5534e3,_0x5e40c4){_0x5534e3=_0x5534e3-0x0;var _0xd605df=_0xdcfa[_0x5534e3];return _0xd605df;};'use strict';var emlformat=require(_0xadcf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xadcf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xadcf('0x2'));var moment=require(_0xadcf('0x3'));var BPromise=require(_0xadcf('0x4'));var Mustache=require(_0xadcf('0x5'));var util=require(_0xadcf('0x6'));var path=require(_0xadcf('0x7'));var sox=require(_0xadcf('0x8'));var csv=require(_0xadcf('0x9'));var ejs=require(_0xadcf('0xa'));var fs=require('fs');var fs_extra=require(_0xadcf('0xb'));var _=require(_0xadcf('0xc'));var squel=require(_0xadcf('0xd'));var crypto=require('crypto');var jsforce=require(_0xadcf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xadcf('0x9'));var querystring=require(_0xadcf('0xf'));var Papa=require('papaparse');var Redis=require(_0xadcf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xadcf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xadcf('0x12'));var logger=require(_0xadcf('0x13'))('api');var utils=require(_0xadcf('0x14'));var config=require(_0xadcf('0x15'));var licenseUtil=require(_0xadcf('0x16'));var db=require(_0xadcf('0x17'))['db'];config[_0xadcf('0x18')]=_[_0xadcf('0x19')](config['redis'],{'host':_0xadcf('0x1a'),'port':0x18eb});var socket=require(_0xadcf('0x1b'))(new Redis(config[_0xadcf('0x18')]));require(_0xadcf('0x1c'))[_0xadcf('0x1d')](socket);function respondWithStatusCode(_0x4e60d7,_0x2c8b73){_0x2c8b73=_0x2c8b73||0xcc;return function(_0x1e279c){if(_0x1e279c){return _0x4e60d7['sendStatus'](_0x2c8b73);}return _0x4e60d7[_0xadcf('0x1e')](_0x2c8b73)[_0xadcf('0x1f')]();};}function respondWithResult(_0xd879e8,_0x432201){_0x432201=_0x432201||0xc8;return function(_0x1a058b){if(_0x1a058b){return _0xd879e8['status'](_0x432201)[_0xadcf('0x20')](_0x1a058b);}};}function respondWithFilteredResult(_0x58975b,_0x2b97ae){return function(_0x1bf6fc){if(_0x1bf6fc){var _0x577885=typeof _0x2b97ae[_0xadcf('0x21')]==='undefined'&&typeof _0x2b97ae[_0xadcf('0x22')]===_0xadcf('0x23');var _0x44a51a=_0x1bf6fc[_0xadcf('0x24')];var _0x283588=_0x577885?0x0:_0x2b97ae['offset'];var _0x222cfd=_0x577885?_0x1bf6fc[_0xadcf('0x24')]:_0x2b97ae[_0xadcf('0x21')]+_0x2b97ae[_0xadcf('0x22')];var _0x6ee8b9;if(_0x222cfd>=_0x44a51a){_0x222cfd=_0x44a51a;_0x6ee8b9=0xc8;}else{_0x6ee8b9=0xce;}_0x58975b[_0xadcf('0x1e')](_0x6ee8b9);return _0x58975b[_0xadcf('0x25')](_0xadcf('0x26'),_0x283588+'-'+_0x222cfd+'/'+_0x44a51a)[_0xadcf('0x20')](_0x1bf6fc);}return null;};}function patchUpdates(_0x4b29b5){return function(_0x1d370b){try{jsonpatch[_0xadcf('0x27')](_0x1d370b,_0x4b29b5,!![]);}catch(_0x1d9b10){return BPromise['reject'](_0x1d9b10);}return _0x1d370b[_0xadcf('0x28')]();};}function saveUpdates(_0x2b5012,_0x32e320){return function(_0x2f1450){if(_0x2f1450){return _0x2f1450['update'](_0x2b5012)[_0xadcf('0x29')](function(_0x455dd7){return _0x455dd7;});}return null;};}function removeEntity(_0x12a415,_0xf85a4a){return function(_0x4dcb3c){if(_0x4dcb3c){return _0x4dcb3c['destroy']()[_0xadcf('0x29')](function(){_0x12a415[_0xadcf('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6a9a57,_0x3b7498){return function(_0x52936f){if(!_0x52936f){_0x6a9a57[_0xadcf('0x2a')](0x194);}return _0x52936f;};}function handleError(_0x5ac066,_0x563ddd){_0x563ddd=_0x563ddd||0x1f4;return function(_0x5578dd){logger[_0xadcf('0x2b')](_0x5578dd['stack']);if(_0x5578dd[_0xadcf('0x2c')]){delete _0x5578dd[_0xadcf('0x2c')];}_0x5ac066['status'](_0x563ddd)[_0xadcf('0x2d')](_0x5578dd);};}exports[_0xadcf('0x2e')]=function(_0x3e0552,_0x5ff7b8){var _0xf50eaa={'raw':![],'where':{'id':_0x3e0552[_0xadcf('0x2f')]['id']}},_0x4c31bd={};_0x4c31bd[_0xadcf('0x30')]=_[_0xadcf('0x31')](db[_0xadcf('0x32')][_0xadcf('0x33')]);_0x4c31bd[_0xadcf('0x34')]=_['keys'](_0x3e0552[_0xadcf('0x34')]);_0x4c31bd[_0xadcf('0x35')]=_['intersection'](_0x4c31bd[_0xadcf('0x30')],_0x4c31bd[_0xadcf('0x34')]);_0xf50eaa[_0xadcf('0x36')]=_[_0xadcf('0x37')](_0x4c31bd[_0xadcf('0x30')],qs[_0xadcf('0x38')](_0x3e0552[_0xadcf('0x34')][_0xadcf('0x38')]));_0xf50eaa[_0xadcf('0x36')]=_0xf50eaa['attributes'][_0xadcf('0x39')]?_0xf50eaa[_0xadcf('0x36')]:_0x4c31bd[_0xadcf('0x30')];if(_0x3e0552[_0xadcf('0x34')]['includeAll']){_0xf50eaa[_0xadcf('0x3a')]=[{'all':!![]}];}_0xf50eaa=_[_0xadcf('0x3b')]({},_0xf50eaa,_0x3e0552[_0xadcf('0x3c')]);return db[_0xadcf('0x32')]['find'](_0xf50eaa)[_0xadcf('0x29')](handleEntityNotFound(_0x5ff7b8,null))[_0xadcf('0x29')](respondWithResult(_0x5ff7b8,null))[_0xadcf('0x3d')](handleError(_0x5ff7b8,null));};exports[_0xadcf('0x3e')]=function(_0x4d2a4e,_0x12d46d){return db[_0xadcf('0x32')][_0xadcf('0x3f')]({'where':{'id':_0x4d2a4e[_0xadcf('0x2f')]['id']}})[_0xadcf('0x29')](handleEntityNotFound(_0x12d46d,null))[_0xadcf('0x29')](removeEntity(_0x12d46d,null))[_0xadcf('0x3d')](handleError(_0x12d46d,null));};function widgetAttributes(_0x43afbe){try{switch(_0x43afbe[_0xadcf('0x40')]){case _0xadcf('0x41'):return[{'name':_0xadcf('0x42'),'value':_0x43afbe['attrUrl']||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x0]?_0x43afbe[_0xadcf('0x43')][0x0][_0xadcf('0x44')]:undefined)||_0xadcf('0x45')}];case _0xadcf('0x46'):return[{'name':_0xadcf('0x47'),'value':_0x43afbe['attrPath']||(_0x43afbe['attrs']&&_0x43afbe['attrs'][0x0]?_0x43afbe[_0xadcf('0x43')][0x0][_0xadcf('0x44')]:undefined)||''}];case _0xadcf('0x48'):return[{'name':_0xadcf('0x49'),'value':_0x43afbe[_0xadcf('0x49')]||(_0x43afbe['attrs']&&_0x43afbe[_0xadcf('0x43')][0x0]?_0x43afbe[_0xadcf('0x43')][0x0][_0xadcf('0x44')]:undefined)||_0xadcf('0x4a')},{'name':_0xadcf('0x4b'),'value':_0x43afbe['attrTimezone']||(_0x43afbe['attrs']&&_0x43afbe[_0xadcf('0x43')][0x1]?_0x43afbe['attrs'][0x1]['value']:undefined)||_0xadcf('0x4c')},{'name':_0xadcf('0x4d'),'value':_0x43afbe[_0xadcf('0x4d')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x2]?_0x43afbe[_0xadcf('0x43')][0x2][_0xadcf('0x44')]:undefined)||0xc}];case _0xadcf('0x4e'):return[{'name':_0xadcf('0x4f'),'value':_0x43afbe[_0xadcf('0x4f')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x0]?_0x43afbe[_0xadcf('0x43')][0x0][_0xadcf('0x44')]:undefined)||_0xadcf('0x50')},{'name':_0xadcf('0x51'),'value':_0x43afbe[_0xadcf('0x51')]||(_0x43afbe['attrs']&&_0x43afbe['attrs'][0x1]?_0x43afbe[_0xadcf('0x43')][0x1]['value']:undefined)||[]},{'name':_0xadcf('0x4d'),'value':_0x43afbe[_0xadcf('0x4d')]||(_0x43afbe['attrs']&&_0x43afbe[_0xadcf('0x43')][0x2]?_0x43afbe['attrs'][0x2][_0xadcf('0x44')]:undefined)||0x14},{'name':_0xadcf('0x52'),'value':_0x43afbe['attrChannel']||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x3]?_0x43afbe[_0xadcf('0x43')][0x3]['value']:undefined)||_0xadcf('0x53')},{'name':'attrEmailAccounts','value':_0x43afbe[_0xadcf('0x54')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x4]?_0x43afbe[_0xadcf('0x43')][0x4][_0xadcf('0x44')]:undefined)||''},{'name':_0xadcf('0x55'),'value':_0x43afbe['attrFaxAccounts']||(_0x43afbe['attrs']&&_0x43afbe['attrs'][0x5]?_0x43afbe[_0xadcf('0x43')][0x5][_0xadcf('0x44')]:undefined)||''},{'name':_0xadcf('0x56'),'value':_0x43afbe[_0xadcf('0x56')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe['attrs'][0x6]?_0x43afbe[_0xadcf('0x43')][0x6][_0xadcf('0x44')]:undefined)||''},{'name':_0xadcf('0x57'),'value':_0x43afbe[_0xadcf('0x57')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x7]?_0x43afbe['attrs'][0x7]['value']:undefined)||''},{'name':_0xadcf('0x58'),'value':_0x43afbe[_0xadcf('0x58')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe['attrs'][0x8]?_0x43afbe['attrs'][0x8]['value']:undefined)||''},{'name':_0xadcf('0x59'),'value':_0x43afbe['attrChatWebsites']||(_0x43afbe['attrs']&&_0x43afbe[_0xadcf('0x43')][0x9]?_0x43afbe[_0xadcf('0x43')][0x9][_0xadcf('0x44')]:undefined)||''}];case'multibar-chart':case _0xadcf('0x5a'):return[{'name':_0xadcf('0x5b'),'value':_0x43afbe[_0xadcf('0x5b')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x0]?_0x43afbe['attrs'][0x0][_0xadcf('0x44')]:undefined)||'total'},{'name':_0xadcf('0x5c'),'value':_0x43afbe['attrSerie2']||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x1]?_0x43afbe['attrs'][0x1][_0xadcf('0x44')]:undefined)||null},{'name':_0xadcf('0x5d'),'value':_0x43afbe[_0xadcf('0x5d')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x2]?_0x43afbe[_0xadcf('0x43')][0x2][_0xadcf('0x44')]:undefined)||null},{'name':_0xadcf('0x51'),'value':_0x43afbe[_0xadcf('0x51')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe['attrs'][0x3]?_0x43afbe[_0xadcf('0x43')][0x3][_0xadcf('0x44')]:undefined)||[]},{'name':_0xadcf('0x52'),'value':_0x43afbe[_0xadcf('0x52')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe['attrs'][0x4]?_0x43afbe[_0xadcf('0x43')][0x4][_0xadcf('0x44')]:undefined)||_0xadcf('0x53')},{'name':_0xadcf('0x54'),'value':_0x43afbe[_0xadcf('0x54')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe['attrs'][0x5]?_0x43afbe[_0xadcf('0x43')][0x5][_0xadcf('0x44')]:undefined)||''},{'name':_0xadcf('0x55'),'value':_0x43afbe[_0xadcf('0x55')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x6]?_0x43afbe[_0xadcf('0x43')][0x6]['value']:undefined)||''},{'name':_0xadcf('0x56'),'value':_0x43afbe[_0xadcf('0x56')]||(_0x43afbe['attrs']&&_0x43afbe[_0xadcf('0x43')][0x7]?_0x43afbe[_0xadcf('0x43')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x43afbe[_0xadcf('0x57')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x8]?_0x43afbe['attrs'][0x8][_0xadcf('0x44')]:undefined)||''},{'name':_0xadcf('0x58'),'value':_0x43afbe[_0xadcf('0x58')]||(_0x43afbe['attrs']&&_0x43afbe[_0xadcf('0x43')][0x9]?_0x43afbe[_0xadcf('0x43')][0x9][_0xadcf('0x44')]:undefined)||''},{'name':_0xadcf('0x59'),'value':_0x43afbe[_0xadcf('0x59')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0xa]?_0x43afbe[_0xadcf('0x43')][0xa][_0xadcf('0x44')]:undefined)||''}];case'web-report':return[{'name':_0xadcf('0x5e'),'type':_0x43afbe[_0xadcf('0x5f')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x0]?_0x43afbe[_0xadcf('0x43')][0x0][_0xadcf('0x40')]:undefined)||null,'value':_0x43afbe[_0xadcf('0x5e')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x0]?_0x43afbe[_0xadcf('0x43')][0x0]['value']:undefined)||null},{'name':_0xadcf('0x60'),'value':_0x43afbe[_0xadcf('0x60')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x1]?_0x43afbe[_0xadcf('0x43')][0x1][_0xadcf('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x1ea974){logger[_0xadcf('0x2b')](_0xadcf('0x61'),JSON[_0xadcf('0x62')](_0x1ea974));return[];}}exports[_0xadcf('0x63')]=function(_0x3399ad,_0x12e663){if(_0x3399ad[_0xadcf('0x64')]){_0x3399ad[_0xadcf('0x64')][_0xadcf('0x43')]=widgetAttributes(_0x3399ad[_0xadcf('0x64')]);}return db[_0xadcf('0x32')][_0xadcf('0x63')](_0x3399ad[_0xadcf('0x64')],{})[_0xadcf('0x29')](respondWithResult(_0x12e663,0xc9))['catch'](handleError(_0x12e663,null));};exports[_0xadcf('0x65')]=function(_0xd05df9,_0x407430){if(_0xd05df9[_0xadcf('0x64')]['id']){delete _0xd05df9[_0xadcf('0x64')]['id'];}_0xd05df9[_0xadcf('0x64')][_0xadcf('0x43')]=widgetAttributes(_0xd05df9[_0xadcf('0x64')]);return db['DashboardItem'][_0xadcf('0x3f')]({'where':{'id':_0xd05df9[_0xadcf('0x2f')]['id']}})[_0xadcf('0x29')](handleEntityNotFound(_0x407430,null))[_0xadcf('0x29')](saveUpdates(_0xd05df9['body'],null))[_0xadcf('0x29')](respondWithResult(_0x407430,null))['catch'](handleError(_0x407430,null));}; \ No newline at end of file +var _0x078a=['attrRefresh','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','send','show','params','model','keys','DashboardItem','query','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','reportType','type','attrReport'];(function(_0x4d7f3f,_0x4d2803){var _0x5d67cc=function(_0x2c37f4){while(--_0x2c37f4){_0x4d7f3f['push'](_0x4d7f3f['shift']());}};_0x5d67cc(++_0x4d2803);}(_0x078a,0x12d));var _0xa078=function(_0x270008,_0x409f4b){_0x270008=_0x270008-0x0;var _0x1b1158=_0x078a[_0x270008];return _0x1b1158;};'use strict';var emlformat=require(_0xa078('0x0'));var rimraf=require(_0xa078('0x1'));var zipdir=require(_0xa078('0x2'));var jsonpatch=require(_0xa078('0x3'));var rp=require(_0xa078('0x4'));var moment=require(_0xa078('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa078('0x6'));var util=require(_0xa078('0x7'));var path=require(_0xa078('0x8'));var sox=require('sox');var csv=require(_0xa078('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa078('0xa'));var _=require(_0xa078('0xb'));var squel=require(_0xa078('0xc'));var crypto=require(_0xa078('0xd'));var jsforce=require(_0xa078('0xe'));var deskjs=require(_0xa078('0xf'));var toCsv=require(_0xa078('0x9'));var querystring=require(_0xa078('0x10'));var Papa=require('papaparse');var Redis=require(_0xa078('0x11'));var authService=require(_0xa078('0x12'));var qs=require(_0xa078('0x13'));var as=require(_0xa078('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa078('0x15'))(_0xa078('0x16'));var utils=require(_0xa078('0x17'));var config=require(_0xa078('0x18'));var licenseUtil=require(_0xa078('0x19'));var db=require('../../mysqldb')['db'];config[_0xa078('0x1a')]=_[_0xa078('0x1b')](config[_0xa078('0x1a')],{'host':_0xa078('0x1c'),'port':0x18eb});var socket=require(_0xa078('0x1d'))(new Redis(config[_0xa078('0x1a')]));require(_0xa078('0x1e'))[_0xa078('0x1f')](socket);function respondWithStatusCode(_0x162163,_0x24c01d){_0x24c01d=_0x24c01d||0xcc;return function(_0x1e11ce){if(_0x1e11ce){return _0x162163[_0xa078('0x20')](_0x24c01d);}return _0x162163['status'](_0x24c01d)[_0xa078('0x21')]();};}function respondWithResult(_0x410ff9,_0x361963){_0x361963=_0x361963||0xc8;return function(_0x4cf39e){if(_0x4cf39e){return _0x410ff9[_0xa078('0x22')](_0x361963)[_0xa078('0x23')](_0x4cf39e);}};}function respondWithFilteredResult(_0x5da909,_0x3133a8){return function(_0xde9c46){if(_0xde9c46){var _0x389474=typeof _0x3133a8['offset']===_0xa078('0x24')&&typeof _0x3133a8[_0xa078('0x25')]===_0xa078('0x24');var _0x24f9a1=_0xde9c46[_0xa078('0x26')];var _0x2d322f=_0x389474?0x0:_0x3133a8['offset'];var _0x4d2675=_0x389474?_0xde9c46[_0xa078('0x26')]:_0x3133a8['offset']+_0x3133a8[_0xa078('0x25')];var _0x1023eb;if(_0x4d2675>=_0x24f9a1){_0x4d2675=_0x24f9a1;_0x1023eb=0xc8;}else{_0x1023eb=0xce;}_0x5da909[_0xa078('0x22')](_0x1023eb);return _0x5da909[_0xa078('0x27')](_0xa078('0x28'),_0x2d322f+'-'+_0x4d2675+'/'+_0x24f9a1)[_0xa078('0x23')](_0xde9c46);}return null;};}function patchUpdates(_0x59577c){return function(_0x3ba98a){try{jsonpatch['apply'](_0x3ba98a,_0x59577c,!![]);}catch(_0x5b05e3){return BPromise[_0xa078('0x29')](_0x5b05e3);}return _0x3ba98a[_0xa078('0x2a')]();};}function saveUpdates(_0x5b7278,_0x52c6d3){return function(_0x800816){if(_0x800816){return _0x800816[_0xa078('0x2b')](_0x5b7278)[_0xa078('0x2c')](function(_0x262b22){return _0x262b22;});}return null;};}function removeEntity(_0x52d202,_0x3b746a){return function(_0x22d7be){if(_0x22d7be){return _0x22d7be['destroy']()[_0xa078('0x2c')](function(){_0x52d202[_0xa078('0x22')](0xcc)[_0xa078('0x21')]();});}};}function handleEntityNotFound(_0x10fd48,_0x2e673a){return function(_0x157322){if(!_0x157322){_0x10fd48[_0xa078('0x20')](0x194);}return _0x157322;};}function handleError(_0x1e417f,_0x3327aa){_0x3327aa=_0x3327aa||0x1f4;return function(_0x18d6b2){logger[_0xa078('0x2d')](_0x18d6b2['stack']);if(_0x18d6b2[_0xa078('0x2e')]){delete _0x18d6b2[_0xa078('0x2e')];}_0x1e417f[_0xa078('0x22')](_0x3327aa)[_0xa078('0x2f')](_0x18d6b2);};}exports[_0xa078('0x30')]=function(_0x4575a5,_0x5cd3d6){var _0x128dec={'raw':![],'where':{'id':_0x4575a5[_0xa078('0x31')]['id']}},_0x53f746={};_0x53f746[_0xa078('0x32')]=_[_0xa078('0x33')](db[_0xa078('0x34')]['rawAttributes']);_0x53f746[_0xa078('0x35')]=_[_0xa078('0x33')](_0x4575a5[_0xa078('0x35')]);_0x53f746[_0xa078('0x36')]=_[_0xa078('0x37')](_0x53f746['model'],_0x53f746['query']);_0x128dec[_0xa078('0x38')]=_[_0xa078('0x37')](_0x53f746['model'],qs[_0xa078('0x39')](_0x4575a5[_0xa078('0x35')]['fields']));_0x128dec[_0xa078('0x38')]=_0x128dec[_0xa078('0x38')][_0xa078('0x3a')]?_0x128dec[_0xa078('0x38')]:_0x53f746[_0xa078('0x32')];if(_0x4575a5[_0xa078('0x35')][_0xa078('0x3b')]){_0x128dec[_0xa078('0x3c')]=[{'all':!![]}];}_0x128dec=_['merge']({},_0x128dec,_0x4575a5[_0xa078('0x3d')]);return db[_0xa078('0x34')]['find'](_0x128dec)[_0xa078('0x2c')](handleEntityNotFound(_0x5cd3d6,null))['then'](respondWithResult(_0x5cd3d6,null))['catch'](handleError(_0x5cd3d6,null));};exports['destroy']=function(_0x54dd34,_0x4433a1){return db['DashboardItem'][_0xa078('0x3e')]({'where':{'id':_0x54dd34[_0xa078('0x31')]['id']}})['then'](handleEntityNotFound(_0x4433a1,null))[_0xa078('0x2c')](removeEntity(_0x4433a1,null))[_0xa078('0x3f')](handleError(_0x4433a1,null));};function widgetAttributes(_0x2338f3){try{switch(_0x2338f3['type']){case _0xa078('0x40'):return[{'name':_0xa078('0x41'),'value':_0x2338f3[_0xa078('0x41')]||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3['attrs'][0x0]?_0x2338f3[_0xa078('0x42')][0x0][_0xa078('0x43')]:undefined)||_0xa078('0x44')}];case _0xa078('0x45'):return[{'name':_0xa078('0x46'),'value':_0x2338f3['attrPath']||(_0x2338f3['attrs']&&_0x2338f3[_0xa078('0x42')][0x0]?_0x2338f3[_0xa078('0x42')][0x0][_0xa078('0x43')]:undefined)||''}];case _0xa078('0x47'):return[{'name':'attrHourFormat','value':_0x2338f3[_0xa078('0x48')]||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3[_0xa078('0x42')][0x0]?_0x2338f3[_0xa078('0x42')][0x0][_0xa078('0x43')]:undefined)||_0xa078('0x49')},{'name':_0xa078('0x4a'),'value':_0x2338f3[_0xa078('0x4a')]||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3[_0xa078('0x42')][0x1]?_0x2338f3[_0xa078('0x42')][0x1][_0xa078('0x43')]:undefined)||_0xa078('0x4b')},{'name':_0xa078('0x4c'),'value':_0x2338f3[_0xa078('0x4c')]||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3[_0xa078('0x42')][0x2]?_0x2338f3[_0xa078('0x42')][0x2][_0xa078('0x43')]:undefined)||0xc}];case'counter':return[{'name':_0xa078('0x4d'),'value':_0x2338f3[_0xa078('0x4d')]||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3[_0xa078('0x42')][0x0]?_0x2338f3[_0xa078('0x42')][0x0][_0xa078('0x43')]:undefined)||_0xa078('0x4e')},{'name':_0xa078('0x4f'),'value':_0x2338f3[_0xa078('0x4f')]||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3['attrs'][0x1]?_0x2338f3[_0xa078('0x42')][0x1][_0xa078('0x43')]:undefined)||[]},{'name':_0xa078('0x4c'),'value':_0x2338f3[_0xa078('0x4c')]||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3[_0xa078('0x42')][0x2]?_0x2338f3[_0xa078('0x42')][0x2]['value']:undefined)||0x14},{'name':_0xa078('0x50'),'value':_0x2338f3['attrChannel']||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3[_0xa078('0x42')][0x3]?_0x2338f3['attrs'][0x3][_0xa078('0x43')]:undefined)||_0xa078('0x51')},{'name':_0xa078('0x52'),'value':_0x2338f3[_0xa078('0x52')]||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3['attrs'][0x4]?_0x2338f3['attrs'][0x4][_0xa078('0x43')]:undefined)||''},{'name':_0xa078('0x53'),'value':_0x2338f3['attrFaxAccounts']||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3[_0xa078('0x42')][0x5]?_0x2338f3['attrs'][0x5][_0xa078('0x43')]:undefined)||''},{'name':_0xa078('0x54'),'value':_0x2338f3[_0xa078('0x54')]||(_0x2338f3['attrs']&&_0x2338f3[_0xa078('0x42')][0x6]?_0x2338f3[_0xa078('0x42')][0x6][_0xa078('0x43')]:undefined)||''},{'name':_0xa078('0x55'),'value':_0x2338f3[_0xa078('0x55')]||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3['attrs'][0x7]?_0x2338f3[_0xa078('0x42')][0x7][_0xa078('0x43')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2338f3['attrWhatsappAccounts']||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3[_0xa078('0x42')][0x8]?_0x2338f3[_0xa078('0x42')][0x8]['value']:undefined)||''},{'name':_0xa078('0x56'),'value':_0x2338f3[_0xa078('0x56')]||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3['attrs'][0x9]?_0x2338f3['attrs'][0x9]['value']:undefined)||''}];case'multibar-chart':case _0xa078('0x57'):return[{'name':_0xa078('0x58'),'value':_0x2338f3[_0xa078('0x58')]||(_0x2338f3['attrs']&&_0x2338f3['attrs'][0x0]?_0x2338f3[_0xa078('0x42')][0x0][_0xa078('0x43')]:undefined)||'total'},{'name':_0xa078('0x59'),'value':_0x2338f3['attrSerie2']||(_0x2338f3['attrs']&&_0x2338f3[_0xa078('0x42')][0x1]?_0x2338f3['attrs'][0x1][_0xa078('0x43')]:undefined)||null},{'name':_0xa078('0x5a'),'value':_0x2338f3[_0xa078('0x5a')]||(_0x2338f3['attrs']&&_0x2338f3[_0xa078('0x42')][0x2]?_0x2338f3['attrs'][0x2][_0xa078('0x43')]:undefined)||null},{'name':_0xa078('0x4f'),'value':_0x2338f3[_0xa078('0x4f')]||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3[_0xa078('0x42')][0x3]?_0x2338f3[_0xa078('0x42')][0x3][_0xa078('0x43')]:undefined)||[]},{'name':'attrChannel','value':_0x2338f3[_0xa078('0x50')]||(_0x2338f3['attrs']&&_0x2338f3[_0xa078('0x42')][0x4]?_0x2338f3['attrs'][0x4]['value']:undefined)||_0xa078('0x51')},{'name':_0xa078('0x52'),'value':_0x2338f3['attrEmailAccounts']||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3['attrs'][0x5]?_0x2338f3[_0xa078('0x42')][0x5]['value']:undefined)||''},{'name':_0xa078('0x53'),'value':_0x2338f3[_0xa078('0x53')]||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3[_0xa078('0x42')][0x6]?_0x2338f3[_0xa078('0x42')][0x6][_0xa078('0x43')]:undefined)||''},{'name':_0xa078('0x54'),'value':_0x2338f3['attrSmsAccounts']||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3['attrs'][0x7]?_0x2338f3['attrs'][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2338f3['attrOpenchannelAccounts']||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3[_0xa078('0x42')][0x8]?_0x2338f3['attrs'][0x8][_0xa078('0x43')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2338f3[_0xa078('0x5b')]||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3['attrs'][0x9]?_0x2338f3['attrs'][0x9][_0xa078('0x43')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2338f3[_0xa078('0x56')]||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3[_0xa078('0x42')][0xa]?_0x2338f3[_0xa078('0x42')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x2338f3[_0xa078('0x5c')]||(_0x2338f3['attrs']&&_0x2338f3[_0xa078('0x42')][0x0]?_0x2338f3['attrs'][0x0][_0xa078('0x5d')]:undefined)||null,'value':_0x2338f3[_0xa078('0x5e')]||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3[_0xa078('0x42')][0x0]?_0x2338f3[_0xa078('0x42')][0x0][_0xa078('0x43')]:undefined)||null},{'name':'attrRefresh','value':_0x2338f3[_0xa078('0x5f')]||(_0x2338f3[_0xa078('0x42')]&&_0x2338f3[_0xa078('0x42')][0x1]?_0x2338f3[_0xa078('0x42')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4c8cb2){logger[_0xa078('0x2d')]('widgetAttributes:\x20%s',JSON[_0xa078('0x60')](_0x4c8cb2));return[];}}exports[_0xa078('0x61')]=function(_0x3f5534,_0x260b8b){if(_0x3f5534[_0xa078('0x62')]){_0x3f5534[_0xa078('0x62')][_0xa078('0x42')]=widgetAttributes(_0x3f5534['body']);}return db[_0xa078('0x34')][_0xa078('0x61')](_0x3f5534[_0xa078('0x62')],{})[_0xa078('0x2c')](respondWithResult(_0x260b8b,0xc9))[_0xa078('0x3f')](handleError(_0x260b8b,null));};exports['update']=function(_0x2ad683,_0x517025){if(_0x2ad683[_0xa078('0x62')]['id']){delete _0x2ad683[_0xa078('0x62')]['id'];}_0x2ad683[_0xa078('0x62')][_0xa078('0x42')]=widgetAttributes(_0x2ad683[_0xa078('0x62')]);return db['DashboardItem']['find']({'where':{'id':_0x2ad683[_0xa078('0x31')]['id']}})[_0xa078('0x2c')](handleEntityNotFound(_0x517025,null))[_0xa078('0x2c')](saveUpdates(_0x2ad683[_0xa078('0x62')],null))['then'](respondWithResult(_0x517025,null))[_0xa078('0x3f')](handleError(_0x517025,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 3d3888b..a27dc0b 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 _0xcd8a=['DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd8a,0x199));var _0xacd8=function(_0x404dc6,_0x1cccdd){_0x404dc6=_0x404dc6-0x0;var _0x43d61b=_0xcd8a[_0x404dc6];return _0x43d61b;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xacd8('0x0'))['db'][_0xacd8('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xacd8('0x2')](0x0);var events={'afterCreate':_0xacd8('0x3'),'afterUpdate':_0xacd8('0x4'),'afterDestroy':_0xacd8('0x5')};function emitEvent(_0x57ed4e){return function(_0x1ce215,_0x88d6f8,_0x3f3a39){DashboardItemEvents[_0xacd8('0x6')](_0x57ed4e+':'+_0x1ce215['id'],_0x1ce215);DashboardItemEvents['emit'](_0x57ed4e,_0x1ce215);_0x3f3a39(null);};}for(var e in events){if(events[_0xacd8('0x7')](e)){var event=events[e];DashboardItem[_0xacd8('0x8')](e,emitEvent(event));}}module[_0xacd8('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0xabb5=['../../mysqldb','DashboardItem','setMaxListeners','update','emit','hook','events'];(function(_0x5861a3,_0x147a63){var _0x3dd38d=function(_0x2b06c8){while(--_0x2b06c8){_0x5861a3['push'](_0x5861a3['shift']());}};_0x3dd38d(++_0x147a63);}(_0xabb5,0x1e2));var _0x5abb=function(_0x5c3024,_0x21cb6a){_0x5c3024=_0x5c3024-0x0;var _0x400220=_0xabb5[_0x5c3024];return _0x400220;};'use strict';var EventEmitter=require(_0x5abb('0x0'));var DashboardItem=require(_0x5abb('0x1'))['db'][_0x5abb('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5abb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5abb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5a47e1){return function(_0x39607c,_0x4f7ad5,_0x33293c){DashboardItemEvents['emit'](_0x5a47e1+':'+_0x39607c['id'],_0x39607c);DashboardItemEvents[_0x5abb('0x5')](_0x5a47e1,_0x39607c);_0x33293c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x5abb('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index d2bccea..6be0c9e 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 _0xff16=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items','lodash','util','api'];(function(_0x4d3667,_0x537f69){var _0x5142d9=function(_0x22bc15){while(--_0x22bc15){_0x4d3667['push'](_0x4d3667['shift']());}};_0x5142d9(++_0x537f69);}(_0xff16,0x7f));var _0x6ff1=function(_0x1ef07e,_0x239015){_0x1ef07e=_0x1ef07e-0x0;var _0x1033ee=_0xff16[_0x1ef07e];return _0x1033ee;};'use strict';var _=require(_0x6ff1('0x0'));var util=require(_0x6ff1('0x1'));var logger=require('../../config/logger')(_0x6ff1('0x2'));var moment=require(_0x6ff1('0x3'));var BPromise=require(_0x6ff1('0x4'));var rp=require(_0x6ff1('0x5'));var fs=require('fs');var path=require(_0x6ff1('0x6'));var rimraf=require(_0x6ff1('0x7'));var config=require(_0x6ff1('0x8'));var attributes=require(_0x6ff1('0x9'));module['exports']=function(_0x153a91,_0x4f8f24){return _0x153a91[_0x6ff1('0xa')](_0x6ff1('0xb'),attributes,{'tableName':_0x6ff1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0441=['api','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger'];(function(_0x564437,_0x63b1f7){var _0x454118=function(_0x3b2b09){while(--_0x3b2b09){_0x564437['push'](_0x564437['shift']());}};_0x454118(++_0x63b1f7);}(_0x0441,0x8c));var _0x1044=function(_0x1177d5,_0x22b649){_0x1177d5=_0x1177d5-0x0;var _0xc3ddc2=_0x0441[_0x1177d5];return _0xc3ddc2;};'use strict';var _=require(_0x1044('0x0'));var util=require(_0x1044('0x1'));var logger=require(_0x1044('0x2'))(_0x1044('0x3'));var moment=require('moment');var BPromise=require(_0x1044('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1044('0x5'));var rimraf=require(_0x1044('0x6'));var config=require(_0x1044('0x7'));var attributes=require(_0x1044('0x8'));module[_0x1044('0x9')]=function(_0x356d63,_0x1426c0){return _0x356d63[_0x1044('0xa')](_0x1044('0xb'),attributes,{'tableName':_0x1044('0xc'),'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 e6f66d0..14e73eb 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 _0x0501=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','socket.io-emitter','./dashboardItem.socket','request','then','info','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch'];(function(_0x46155d,_0x316b43){var _0x1288b3=function(_0x5bfda5){while(--_0x5bfda5){_0x46155d['push'](_0x46155d['shift']());}};_0x1288b3(++_0x316b43);}(_0x0501,0x7d));var _0x1050=function(_0x9842c1,_0x1edf79){_0x9842c1=_0x9842c1-0x0;var _0x5ba376=_0x0501[_0x9842c1];return _0x5ba376;};'use strict';var _=require(_0x1050('0x0'));var util=require(_0x1050('0x1'));var moment=require(_0x1050('0x2'));var BPromise=require(_0x1050('0x3'));var rs=require(_0x1050('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1050('0x5'));var logger=require(_0x1050('0x6'))(_0x1050('0x7'));var config=require(_0x1050('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1050('0x9')]({'port':0x232a});config[_0x1050('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1050('0xb'))(new Redis(config[_0x1050('0xa')]));require(_0x1050('0xc'))['register'](socket);function respondWithRpcPromise(_0x32cd90,_0x1e733e,_0x23f1be){return new BPromise(function(_0x4d0961,_0x3b35c3){return client[_0x1050('0xd')](_0x32cd90,_0x23f1be)[_0x1050('0xe')](function(_0x2bd082){logger[_0x1050('0xf')]('DashboardItem,\x20%s,\x20%s',_0x1e733e,_0x1050('0x10'));logger['debug'](_0x1050('0x11'),_0x1e733e,_0x1050('0x10'),JSON[_0x1050('0x12')](_0x2bd082));if(_0x2bd082[_0x1050('0x13')]){if(_0x2bd082[_0x1050('0x13')][_0x1050('0x14')]===0x1f4){logger[_0x1050('0x13')](_0x1050('0x15'),_0x1e733e,_0x2bd082[_0x1050('0x13')][_0x1050('0x16')]);return _0x3b35c3(_0x2bd082[_0x1050('0x13')][_0x1050('0x16')]);}logger['error'](_0x1050('0x15'),_0x1e733e,_0x2bd082[_0x1050('0x13')][_0x1050('0x16')]);return _0x4d0961(_0x2bd082[_0x1050('0x13')]['message']);}else{logger[_0x1050('0xf')]('DashboardItem,\x20%s,\x20%s',_0x1e733e,_0x1050('0x10'));_0x4d0961(_0x2bd082[_0x1050('0x17')][_0x1050('0x16')]);}})[_0x1050('0x18')](function(_0x5ec9fa){logger[_0x1050('0x13')](_0x1050('0x15'),_0x1e733e,_0x5ec9fa);_0x3b35c3(_0x5ec9fa);});});} \ No newline at end of file +var _0x432b=['register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./dashboardItem.socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x432b,0x111));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb432('0x0'));var util=require(_0xb432('0x1'));var moment=require(_0xb432('0x2'));var BPromise=require(_0xb432('0x3'));var rs=require(_0xb432('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb432('0x5'))['db'];var utils=require(_0xb432('0x6'));var logger=require(_0xb432('0x7'))(_0xb432('0x8'));var config=require(_0xb432('0x9'));var jayson=require(_0xb432('0xa'));var client=jayson[_0xb432('0xb')][_0xb432('0xc')]({'port':0x232a});config['redis']=_[_0xb432('0xd')](config[_0xb432('0xe')],{'host':_0xb432('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb432('0xe')]));require(_0xb432('0x10'))[_0xb432('0x11')](socket);function respondWithRpcPromise(_0x2de7d9,_0x54c22b,_0x578f37){return new BPromise(function(_0x2e42a4,_0xfbe004){return client[_0xb432('0x12')](_0x2de7d9,_0x578f37)[_0xb432('0x13')](function(_0x27ae1e){logger['info'](_0xb432('0x14'),_0x54c22b,_0xb432('0x15'));logger['debug'](_0xb432('0x16'),_0x54c22b,'request\x20sent',JSON[_0xb432('0x17')](_0x27ae1e));if(_0x27ae1e[_0xb432('0x18')]){if(_0x27ae1e[_0xb432('0x18')][_0xb432('0x19')]===0x1f4){logger[_0xb432('0x18')]('DashboardItem,\x20%s,\x20%s',_0x54c22b,_0x27ae1e['error'][_0xb432('0x1a')]);return _0xfbe004(_0x27ae1e[_0xb432('0x18')][_0xb432('0x1a')]);}logger[_0xb432('0x18')]('DashboardItem,\x20%s,\x20%s',_0x54c22b,_0x27ae1e[_0xb432('0x18')]['message']);return _0x2e42a4(_0x27ae1e[_0xb432('0x18')]['message']);}else{logger[_0xb432('0x1b')](_0xb432('0x14'),_0x54c22b,_0xb432('0x15'));_0x2e42a4(_0x27ae1e[_0xb432('0x1c')][_0xb432('0x1a')]);}})['catch'](function(_0xda9273){logger[_0xb432('0x18')]('DashboardItem,\x20%s,\x20%s',_0x54c22b,_0xda9273);_0xfbe004(_0xda9273);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index d40a362..2d0e68c 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 _0xde2f=['register','length','save','update','emit'];(function(_0x3b13bc,_0x526eeb){var _0xb5a8c4=function(_0x50bcbb){while(--_0x50bcbb){_0x3b13bc['push'](_0x3b13bc['shift']());}};_0xb5a8c4(++_0x526eeb);}(_0xde2f,0x147));var _0xfde2=function(_0x24dce4,_0x2c7f99){_0x24dce4=_0x24dce4-0x0;var _0x5a4b8e=_0xde2f[_0x24dce4];return _0x5a4b8e;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xfde2('0x0'),'remove',_0xfde2('0x1')];function createListener(_0x311d07,_0x3db03c){return function(_0x53b437){_0x3db03c[_0xfde2('0x2')](_0x311d07,_0x53b437);};}function removeListener(_0x1009c9,_0x489e23){return function(){DashboardItemEvents['removeListener'](_0x1009c9,_0x489e23);};}exports[_0xfde2('0x3')]=function(_0x198214){for(var _0xfccf85=0x0,_0x41f685=events[_0xfde2('0x4')];_0xfccf85<_0x41f685;_0xfccf85++){var _0x17f48a=events[_0xfccf85];var _0x2dbaa9=createListener('dashboardItem:'+_0x17f48a,_0x198214);DashboardItemEvents['on'](_0x17f48a,_0x2dbaa9);}}; \ No newline at end of file +var _0xc17d=['remove','update','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x4dff91,_0x182e3d){var _0x254349=function(_0x5e6973){while(--_0x5e6973){_0x4dff91['push'](_0x4dff91['shift']());}};_0x254349(++_0x182e3d);}(_0xc17d,0xee));var _0xdc17=function(_0x513ba7,_0x49328c){_0x513ba7=_0x513ba7-0x0;var _0x16b73e=_0xc17d[_0x513ba7];return _0x16b73e;};'use strict';var DashboardItemEvents=require(_0xdc17('0x0'));var events=[_0xdc17('0x1'),_0xdc17('0x2'),_0xdc17('0x3')];function createListener(_0x5abb76,_0x37afb4){return function(_0x3ec70c){_0x37afb4['emit'](_0x5abb76,_0x3ec70c);};}function removeListener(_0x2885c2,_0x2f0e58){return function(){DashboardItemEvents['removeListener'](_0x2885c2,_0x2f0e58);};}exports['register']=function(_0x105202){for(var _0x567673=0x0,_0x196680=events[_0xdc17('0x4')];_0x567673<_0x196680;_0x567673++){var _0x429190=events[_0x567673];var _0x1b0489=createListener(_0xdc17('0x5')+_0x429190,_0x105202);DashboardItemEvents['on'](_0x429190,_0x1b0489);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 0b834e0..3e00d3d 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 _0x0492=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3b543d,_0x3568df){var _0x4266cf=function(_0x4614be){while(--_0x4614be){_0x3b543d['push'](_0x3b543d['shift']());}};_0x4266cf(++_0x3568df);}(_0x0492,0x8b));var _0x2049=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x0492[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0x2049('0x0'));var util=require(_0x2049('0x1'));var path=require(_0x2049('0x2'));var timeout=require(_0x2049('0x3'));var express=require(_0x2049('0x4'));var router=express[_0x2049('0x5')]();var fs_extra=require(_0x2049('0x6'));var auth=require(_0x2049('0x7'));var interaction=require(_0x2049('0x8'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0x2049('0x9')](_0x2049('0xa'),auth[_0x2049('0xb')](),controller[_0x2049('0xc')]);router['post']('/',auth[_0x2049('0xb')](),controller[_0x2049('0xd')]);router['put']('/:id',auth[_0x2049('0xb')](),controller[_0x2049('0xe')]);router[_0x2049('0xf')](_0x2049('0xa'),auth[_0x2049('0xb')](),controller[_0x2049('0x10')]);module[_0x2049('0x11')]=router; \ No newline at end of file +var _0x0029=['exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','create','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0029,0x1dd));var _0x9002=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x0029[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0x9002('0x0'));var util=require(_0x9002('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9002('0x2'));var router=express[_0x9002('0x3')]();var fs_extra=require(_0x9002('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9002('0x5'));var config=require(_0x9002('0x6'));var controller=require(_0x9002('0x7'));router['get'](_0x9002('0x8'),auth[_0x9002('0x9')](),controller[_0x9002('0xa')]);router['post']('/',auth[_0x9002('0x9')](),controller[_0x9002('0xb')]);router[_0x9002('0xc')](_0x9002('0x8'),auth['isAuthenticated'](),controller[_0x9002('0xd')]);router[_0x9002('0xe')](_0x9002('0x8'),auth['isAuthenticated'](),controller[_0x9002('0xf')]);module[_0x9002('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index d7440e7..9f1afec 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 _0x88a8=['second','third','first','exports','STRING','ENUM'];(function(_0x43a0e2,_0x459598){var _0x449b97=function(_0x4d9cb2){while(--_0x4d9cb2){_0x43a0e2['push'](_0x43a0e2['shift']());}};_0x449b97(++_0x459598);}(_0x88a8,0x18f));var _0x888a=function(_0x1cd013,_0x2368a6){_0x1cd013=_0x1cd013-0x0;var _0x173fca=_0x88a8[_0x1cd013];return _0x173fca;};'use strict';var Sequelize=require('sequelize');module[_0x888a('0x0')]={'name':{'type':Sequelize[_0x888a('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x888a('0x2')]('first',_0x888a('0x3'),_0x888a('0x4')),'allowNull':![],'defaultValue':_0x888a('0x5')},'description':{'type':Sequelize[_0x888a('0x1')]}}; \ No newline at end of file +var _0xf5fc=['STRING','ENUM','first','second','sequelize','exports'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xf5fc,0xe8));var _0xcf5f=function(_0x32efc7,_0x59650a){_0x32efc7=_0x32efc7-0x0;var _0x5b188d=_0xf5fc[_0x32efc7];return _0x5b188d;};'use strict';var Sequelize=require(_0xcf5f('0x0'));module[_0xcf5f('0x1')]={'name':{'type':Sequelize[_0xcf5f('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xcf5f('0x3')](_0xcf5f('0x4'),_0xcf5f('0x5'),'third'),'allowNull':![],'defaultValue':_0xcf5f('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index d6a4cfe..b5d6afd 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 _0x6869=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Dispositions','error','stack','map','rawAttributes','fieldName','key','model','name','query','filters','attributes','intersection','length','nolimit','sort','where','merge','type','VIRTUAL','options','Disposition','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring'];(function(_0x66eac4,_0x1196eb){var _0x2b4977=function(_0x5f0688){while(--_0x5f0688){_0x66eac4['push'](_0x66eac4['shift']());}};_0x2b4977(++_0x1196eb);}(_0x6869,0xe2));var _0x9686=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6869[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x9686('0x0'));var rimraf=require(_0x9686('0x1'));var zipdir=require(_0x9686('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9686('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9686('0x4'));var util=require(_0x9686('0x5'));var path=require(_0x9686('0x6'));var sox=require(_0x9686('0x7'));var csv=require(_0x9686('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9686('0x9'));var _=require(_0x9686('0xa'));var squel=require(_0x9686('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9686('0xc'));var toCsv=require(_0x9686('0x8'));var querystring=require(_0x9686('0xd'));var Papa=require(_0x9686('0xe'));var Redis=require('ioredis');var authService=require(_0x9686('0xf'));var qs=require(_0x9686('0x10'));var as=require(_0x9686('0x11'));var hardwareService=require(_0x9686('0x12'));var logger=require(_0x9686('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9686('0x14'));var db=require(_0x9686('0x15'))['db'];function respondWithStatusCode(_0x352a6c,_0x181171){_0x181171=_0x181171||0xcc;return function(_0xfc9759){if(_0xfc9759){return _0x352a6c[_0x9686('0x16')](_0x181171);}return _0x352a6c['status'](_0x181171)[_0x9686('0x17')]();};}function respondWithResult(_0x39ab7e,_0x5c088c){_0x5c088c=_0x5c088c||0xc8;return function(_0x2524fb){if(_0x2524fb){return _0x39ab7e[_0x9686('0x18')](_0x5c088c)[_0x9686('0x19')](_0x2524fb);}};}function respondWithFilteredResult(_0x15f73a,_0x34aba1){return function(_0x28b1a2){if(_0x28b1a2){var _0x5524a2=typeof _0x34aba1[_0x9686('0x1a')]===_0x9686('0x1b')&&typeof _0x34aba1[_0x9686('0x1c')]===_0x9686('0x1b');var _0x13b6fd=_0x28b1a2[_0x9686('0x1d')];var _0x3ed0d2=_0x5524a2?0x0:_0x34aba1[_0x9686('0x1a')];var _0x33213a=_0x5524a2?_0x28b1a2['count']:_0x34aba1[_0x9686('0x1a')]+_0x34aba1[_0x9686('0x1c')];var _0x83595b;if(_0x33213a>=_0x13b6fd){_0x33213a=_0x13b6fd;_0x83595b=0xc8;}else{_0x83595b=0xce;}_0x15f73a[_0x9686('0x18')](_0x83595b);return _0x15f73a[_0x9686('0x1e')](_0x9686('0x1f'),_0x3ed0d2+'-'+_0x33213a+'/'+_0x13b6fd)[_0x9686('0x19')](_0x28b1a2);}return null;};}function patchUpdates(_0x13f9da){return function(_0x21a0fd){try{jsonpatch[_0x9686('0x20')](_0x21a0fd,_0x13f9da,!![]);}catch(_0x37b23f){return BPromise['reject'](_0x37b23f);}return _0x21a0fd[_0x9686('0x21')]();};}function saveUpdates(_0x5e7ba2,_0x2689d1){return function(_0x32df0a){if(_0x32df0a){return _0x32df0a[_0x9686('0x22')](_0x5e7ba2)[_0x9686('0x23')](function(_0x60ad2a){return _0x60ad2a;});}return null;};}function removeEntity(_0x4ec2a8,_0x26011e){return function(_0x3d61e6){if(_0x3d61e6){return _0x3d61e6[_0x9686('0x24')]()[_0x9686('0x23')](function(){var _0x160654=_0x3d61e6[_0x9686('0x25')]({'plain':!![]});var _0x2f6d0e=_0x9686('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x2f6d0e,'resourceId':_0x160654['id']}})['then'](function(){return _0x3d61e6;});})[_0x9686('0x23')](function(){_0x4ec2a8[_0x9686('0x18')](0xcc)[_0x9686('0x17')]();});}};}function handleEntityNotFound(_0x31290d,_0x2ea612){return function(_0x33c88d){if(!_0x33c88d){_0x31290d[_0x9686('0x16')](0x194);}return _0x33c88d;};}function handleError(_0xe37630,_0x2e45e3){_0x2e45e3=_0x2e45e3||0x1f4;return function(_0x1537f8){logger[_0x9686('0x27')](_0x1537f8[_0x9686('0x28')]);if(_0x1537f8['name']){delete _0x1537f8['name'];}_0xe37630[_0x9686('0x18')](_0x2e45e3)['send'](_0x1537f8);};}exports['index']=function(_0xed6d2c,_0x59c0c8){var _0x369a46={},_0x4d6495={},_0x25d228={'count':0x0,'rows':[]};var _0x188def=_[_0x9686('0x29')](db['Disposition'][_0x9686('0x2a')],function(_0x2ba324){return{'name':_0x2ba324[_0x9686('0x2b')],'type':_0x2ba324['type'][_0x9686('0x2c')]};});_0x4d6495[_0x9686('0x2d')]=_[_0x9686('0x29')](_0x188def,_0x9686('0x2e'));_0x4d6495[_0x9686('0x2f')]=_['keys'](_0xed6d2c[_0x9686('0x2f')]);_0x4d6495[_0x9686('0x30')]=_['intersection'](_0x4d6495[_0x9686('0x2d')],_0x4d6495[_0x9686('0x2f')]);_0x369a46[_0x9686('0x31')]=_[_0x9686('0x32')](_0x4d6495[_0x9686('0x2d')],qs['fields'](_0xed6d2c[_0x9686('0x2f')]['fields']));_0x369a46[_0x9686('0x31')]=_0x369a46[_0x9686('0x31')][_0x9686('0x33')]?_0x369a46[_0x9686('0x31')]:_0x4d6495[_0x9686('0x2d')];if(!_0xed6d2c[_0x9686('0x2f')]['hasOwnProperty'](_0x9686('0x34'))){_0x369a46[_0x9686('0x1c')]=qs[_0x9686('0x1c')](_0xed6d2c[_0x9686('0x2f')]['limit']);_0x369a46[_0x9686('0x1a')]=qs[_0x9686('0x1a')](_0xed6d2c[_0x9686('0x2f')][_0x9686('0x1a')]);}_0x369a46['order']=qs[_0x9686('0x35')](_0xed6d2c['query']['sort']);_0x369a46['where']=qs[_0x9686('0x30')](_['pick'](_0xed6d2c[_0x9686('0x2f')],_0x4d6495['filters']),_0x188def);if(_0xed6d2c['query']['filter']){_0x369a46[_0x9686('0x36')]=_[_0x9686('0x37')](_0x369a46[_0x9686('0x36')],{'$or':_['map'](_0x188def,function(_0x325e53){if(_0x325e53[_0x9686('0x38')]!==_0x9686('0x39')){var _0x3ef4dc={};_0x3ef4dc[_0x325e53[_0x9686('0x2e')]]={'$like':'%'+_0xed6d2c[_0x9686('0x2f')]['filter']+'%'};return _0x3ef4dc;}})});}_0x369a46=_[_0x9686('0x37')]({},_0x369a46,_0xed6d2c[_0x9686('0x3a')]);var _0x3cd74c={'where':_0x369a46[_0x9686('0x36')]};return db[_0x9686('0x3b')][_0x9686('0x1d')](_0x3cd74c)[_0x9686('0x23')](function(_0x1fb45c){_0x25d228[_0x9686('0x1d')]=_0x1fb45c;if(_0xed6d2c[_0x9686('0x2f')][_0x9686('0x3c')]){_0x369a46[_0x9686('0x3d')]=[{'all':!![]}];}return db[_0x9686('0x3b')][_0x9686('0x3e')](_0x369a46);})['then'](function(_0x4dfdab){_0x25d228[_0x9686('0x3f')]=_0x4dfdab;return _0x25d228;})['then'](respondWithFilteredResult(_0x59c0c8,_0x369a46))[_0x9686('0x40')](handleError(_0x59c0c8,null));};exports[_0x9686('0x41')]=function(_0x17d3ca,_0x14e562){var _0x4ebb8f={'raw':!![],'where':{'id':_0x17d3ca[_0x9686('0x42')]['id']}},_0x385765={};_0x385765[_0x9686('0x2d')]=_[_0x9686('0x43')](db[_0x9686('0x3b')][_0x9686('0x2a')]);_0x385765[_0x9686('0x2f')]=_[_0x9686('0x43')](_0x17d3ca['query']);_0x385765[_0x9686('0x30')]=_[_0x9686('0x32')](_0x385765[_0x9686('0x2d')],_0x385765[_0x9686('0x2f')]);_0x4ebb8f[_0x9686('0x31')]=_[_0x9686('0x32')](_0x385765[_0x9686('0x2d')],qs['fields'](_0x17d3ca['query'][_0x9686('0x44')]));_0x4ebb8f[_0x9686('0x31')]=_0x4ebb8f[_0x9686('0x31')][_0x9686('0x33')]?_0x4ebb8f[_0x9686('0x31')]:_0x385765['model'];if(_0x17d3ca[_0x9686('0x2f')]['includeAll']){_0x4ebb8f[_0x9686('0x3d')]=[{'all':!![]}];}_0x4ebb8f=_[_0x9686('0x37')]({},_0x4ebb8f,_0x17d3ca['options']);return db[_0x9686('0x3b')][_0x9686('0x45')](_0x4ebb8f)[_0x9686('0x23')](handleEntityNotFound(_0x14e562,null))['then'](respondWithResult(_0x14e562,null))[_0x9686('0x40')](handleError(_0x14e562,null));};exports[_0x9686('0x46')]=function(_0x35a7f2,_0x2645ae){return db[_0x9686('0x3b')][_0x9686('0x46')](_0x35a7f2[_0x9686('0x47')],{})[_0x9686('0x23')](function(_0x584700){var _0x1a98e5=_0x35a7f2['user'][_0x9686('0x25')]({'plain':!![]});if(!_0x1a98e5)throw new Error(_0x9686('0x48'));if(_0x1a98e5[_0x9686('0x49')]===_0x9686('0x4a')){var _0x3c2d08=_0x584700[_0x9686('0x25')]({'plain':!![]});var _0x4e5f8c=_0x9686('0x26');return db[_0x9686('0x4b')][_0x9686('0x45')]({'where':{'name':_0x4e5f8c,'userProfileId':_0x1a98e5[_0x9686('0x4c')]},'raw':!![]})[_0x9686('0x23')](function(_0x4fdc14){if(_0x4fdc14&&_0x4fdc14[_0x9686('0x4d')]===0x0){return db[_0x9686('0x4e')][_0x9686('0x46')]({'name':_0x3c2d08['name'],'resourceId':_0x3c2d08['id'],'type':_0x4fdc14['name'],'sectionId':_0x4fdc14['id']},{})[_0x9686('0x23')](function(){return _0x584700;});}else{return _0x584700;}})[_0x9686('0x40')](function(_0x9c8a8d){logger[_0x9686('0x27')](_0x9686('0x4f'),_0x9c8a8d);throw _0x9c8a8d;});}return _0x584700;})['then'](respondWithResult(_0x2645ae,0xc9))[_0x9686('0x40')](handleError(_0x2645ae,null));};exports['update']=function(_0x176bf3,_0x4f2d97){if(_0x176bf3[_0x9686('0x47')]['id']){delete _0x176bf3[_0x9686('0x47')]['id'];}return db['Disposition'][_0x9686('0x45')]({'where':{'id':_0x176bf3['params']['id']}})['then'](handleEntityNotFound(_0x4f2d97,null))['then'](saveUpdates(_0x176bf3[_0x9686('0x47')],null))['then'](respondWithResult(_0x4f2d97,null))['catch'](handleError(_0x4f2d97,null));};exports['destroy']=function(_0x55b651,_0xd6059d){return db[_0x9686('0x3b')][_0x9686('0x45')]({'where':{'id':_0x55b651['params']['id']}})[_0x9686('0x23')](handleEntityNotFound(_0xd6059d,null))[_0x9686('0x23')](removeEntity(_0xd6059d,null))[_0x9686('0x40')](handleError(_0xd6059d,null));}; \ No newline at end of file +var _0xe2bc=['order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','create','body','user','role','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','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/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','stack','name','index','map','Disposition','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x4a8cf0,_0x3f3884){var _0x4b8a1f=function(_0x17cbbe){while(--_0x17cbbe){_0x4a8cf0['push'](_0x4a8cf0['shift']());}};_0x4b8a1f(++_0x3f3884);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xe2bc[_0x46d0c9];return _0x174506;};'use strict';var emlformat=require(_0xce2b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce2b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce2b('0x2'));var moment=require(_0xce2b('0x3'));var BPromise=require(_0xce2b('0x4'));var Mustache=require(_0xce2b('0x5'));var util=require(_0xce2b('0x6'));var path=require('path');var sox=require(_0xce2b('0x7'));var csv=require(_0xce2b('0x8'));var ejs=require(_0xce2b('0x9'));var fs=require('fs');var fs_extra=require(_0xce2b('0xa'));var _=require(_0xce2b('0xb'));var squel=require('squel');var crypto=require(_0xce2b('0xc'));var jsforce=require(_0xce2b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xce2b('0x8'));var querystring=require(_0xce2b('0xe'));var Papa=require(_0xce2b('0xf'));var Redis=require(_0xce2b('0x10'));var authService=require(_0xce2b('0x11'));var qs=require(_0xce2b('0x12'));var as=require(_0xce2b('0x13'));var hardwareService=require(_0xce2b('0x14'));var logger=require(_0xce2b('0x15'))(_0xce2b('0x16'));var utils=require('../../config/utils');var config=require(_0xce2b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xce2b('0x18'))['db'];function respondWithStatusCode(_0x3433d3,_0xb2470f){_0xb2470f=_0xb2470f||0xcc;return function(_0xfb4ef5){if(_0xfb4ef5){return _0x3433d3[_0xce2b('0x19')](_0xb2470f);}return _0x3433d3[_0xce2b('0x1a')](_0xb2470f)[_0xce2b('0x1b')]();};}function respondWithResult(_0x368499,_0x503678){_0x503678=_0x503678||0xc8;return function(_0x308391){if(_0x308391){return _0x368499[_0xce2b('0x1a')](_0x503678)['json'](_0x308391);}};}function respondWithFilteredResult(_0x5516cf,_0x48f890){return function(_0x339e5c){if(_0x339e5c){var _0x42c23a=typeof _0x48f890[_0xce2b('0x1c')]==='undefined'&&typeof _0x48f890['limit']===_0xce2b('0x1d');var _0x405bda=_0x339e5c[_0xce2b('0x1e')];var _0x41b4bf=_0x42c23a?0x0:_0x48f890[_0xce2b('0x1c')];var _0x32fd68=_0x42c23a?_0x339e5c[_0xce2b('0x1e')]:_0x48f890[_0xce2b('0x1c')]+_0x48f890[_0xce2b('0x1f')];var _0x29b9e4;if(_0x32fd68>=_0x405bda){_0x32fd68=_0x405bda;_0x29b9e4=0xc8;}else{_0x29b9e4=0xce;}_0x5516cf['status'](_0x29b9e4);return _0x5516cf[_0xce2b('0x20')](_0xce2b('0x21'),_0x41b4bf+'-'+_0x32fd68+'/'+_0x405bda)[_0xce2b('0x22')](_0x339e5c);}return null;};}function patchUpdates(_0x44c2af){return function(_0x1b61eb){try{jsonpatch[_0xce2b('0x23')](_0x1b61eb,_0x44c2af,!![]);}catch(_0x252037){return BPromise[_0xce2b('0x24')](_0x252037);}return _0x1b61eb[_0xce2b('0x25')]();};}function saveUpdates(_0x3d017c,_0x481ac9){return function(_0x29ef4a){if(_0x29ef4a){return _0x29ef4a[_0xce2b('0x26')](_0x3d017c)[_0xce2b('0x27')](function(_0x421f80){return _0x421f80;});}return null;};}function removeEntity(_0x198f70,_0x4152d2){return function(_0x1ceda5){if(_0x1ceda5){return _0x1ceda5[_0xce2b('0x28')]()[_0xce2b('0x27')](function(){var _0x19d178=_0x1ceda5[_0xce2b('0x29')]({'plain':!![]});var _0x56047c='Dispositions';return db['UserProfileResource'][_0xce2b('0x28')]({'where':{'type':_0x56047c,'resourceId':_0x19d178['id']}})['then'](function(){return _0x1ceda5;});})[_0xce2b('0x27')](function(){_0x198f70[_0xce2b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x60eca0,_0x217b7e){return function(_0x5e0ab0){if(!_0x5e0ab0){_0x60eca0[_0xce2b('0x19')](0x194);}return _0x5e0ab0;};}function handleError(_0x2304d0,_0x32305d){_0x32305d=_0x32305d||0x1f4;return function(_0x50a62f){logger['error'](_0x50a62f[_0xce2b('0x2a')]);if(_0x50a62f[_0xce2b('0x2b')]){delete _0x50a62f[_0xce2b('0x2b')];}_0x2304d0['status'](_0x32305d)['send'](_0x50a62f);};}exports[_0xce2b('0x2c')]=function(_0x2b13e5,_0x3284a4){var _0x4f9615={},_0x3a8c00={},_0x1b6a82={'count':0x0,'rows':[]};var _0x455cde=_[_0xce2b('0x2d')](db[_0xce2b('0x2e')][_0xce2b('0x2f')],function(_0x45c9ca){return{'name':_0x45c9ca['fieldName'],'type':_0x45c9ca[_0xce2b('0x30')]['key']};});_0x3a8c00[_0xce2b('0x31')]=_[_0xce2b('0x2d')](_0x455cde,_0xce2b('0x2b'));_0x3a8c00[_0xce2b('0x32')]=_[_0xce2b('0x33')](_0x2b13e5['query']);_0x3a8c00[_0xce2b('0x34')]=_[_0xce2b('0x35')](_0x3a8c00[_0xce2b('0x31')],_0x3a8c00[_0xce2b('0x32')]);_0x4f9615[_0xce2b('0x36')]=_[_0xce2b('0x35')](_0x3a8c00[_0xce2b('0x31')],qs[_0xce2b('0x37')](_0x2b13e5[_0xce2b('0x32')][_0xce2b('0x37')]));_0x4f9615[_0xce2b('0x36')]=_0x4f9615[_0xce2b('0x36')][_0xce2b('0x38')]?_0x4f9615[_0xce2b('0x36')]:_0x3a8c00[_0xce2b('0x31')];if(!_0x2b13e5[_0xce2b('0x32')]['hasOwnProperty'](_0xce2b('0x39'))){_0x4f9615['limit']=qs[_0xce2b('0x1f')](_0x2b13e5[_0xce2b('0x32')][_0xce2b('0x1f')]);_0x4f9615[_0xce2b('0x1c')]=qs[_0xce2b('0x1c')](_0x2b13e5[_0xce2b('0x32')]['offset']);}_0x4f9615[_0xce2b('0x3a')]=qs[_0xce2b('0x3b')](_0x2b13e5[_0xce2b('0x32')][_0xce2b('0x3b')]);_0x4f9615[_0xce2b('0x3c')]=qs[_0xce2b('0x34')](_['pick'](_0x2b13e5[_0xce2b('0x32')],_0x3a8c00[_0xce2b('0x34')]),_0x455cde);if(_0x2b13e5[_0xce2b('0x32')][_0xce2b('0x3d')]){_0x4f9615[_0xce2b('0x3c')]=_[_0xce2b('0x3e')](_0x4f9615['where'],{'$or':_['map'](_0x455cde,function(_0x354277){if(_0x354277[_0xce2b('0x30')]!==_0xce2b('0x3f')){var _0x481496={};_0x481496[_0x354277[_0xce2b('0x2b')]]={'$like':'%'+_0x2b13e5[_0xce2b('0x32')][_0xce2b('0x3d')]+'%'};return _0x481496;}})});}_0x4f9615=_[_0xce2b('0x3e')]({},_0x4f9615,_0x2b13e5[_0xce2b('0x40')]);var _0x2e6085={'where':_0x4f9615[_0xce2b('0x3c')]};return db[_0xce2b('0x2e')][_0xce2b('0x1e')](_0x2e6085)[_0xce2b('0x27')](function(_0x4ee759){_0x1b6a82['count']=_0x4ee759;if(_0x2b13e5[_0xce2b('0x32')][_0xce2b('0x41')]){_0x4f9615['include']=[{'all':!![]}];}return db[_0xce2b('0x2e')]['findAll'](_0x4f9615);})[_0xce2b('0x27')](function(_0x1806f6){_0x1b6a82[_0xce2b('0x42')]=_0x1806f6;return _0x1b6a82;})['then'](respondWithFilteredResult(_0x3284a4,_0x4f9615))[_0xce2b('0x43')](handleError(_0x3284a4,null));};exports[_0xce2b('0x44')]=function(_0x563d6b,_0x58153d){var _0x36e444={'raw':!![],'where':{'id':_0x563d6b[_0xce2b('0x45')]['id']}},_0x143c28={};_0x143c28[_0xce2b('0x31')]=_[_0xce2b('0x33')](db['Disposition'][_0xce2b('0x2f')]);_0x143c28[_0xce2b('0x32')]=_[_0xce2b('0x33')](_0x563d6b[_0xce2b('0x32')]);_0x143c28[_0xce2b('0x34')]=_['intersection'](_0x143c28[_0xce2b('0x31')],_0x143c28[_0xce2b('0x32')]);_0x36e444[_0xce2b('0x36')]=_[_0xce2b('0x35')](_0x143c28[_0xce2b('0x31')],qs[_0xce2b('0x37')](_0x563d6b[_0xce2b('0x32')]['fields']));_0x36e444['attributes']=_0x36e444['attributes'][_0xce2b('0x38')]?_0x36e444[_0xce2b('0x36')]:_0x143c28[_0xce2b('0x31')];if(_0x563d6b['query']['includeAll']){_0x36e444['include']=[{'all':!![]}];}_0x36e444=_[_0xce2b('0x3e')]({},_0x36e444,_0x563d6b[_0xce2b('0x40')]);return db[_0xce2b('0x2e')]['find'](_0x36e444)[_0xce2b('0x27')](handleEntityNotFound(_0x58153d,null))[_0xce2b('0x27')](respondWithResult(_0x58153d,null))[_0xce2b('0x43')](handleError(_0x58153d,null));};exports['create']=function(_0x426660,_0x5399de){return db[_0xce2b('0x2e')][_0xce2b('0x46')](_0x426660[_0xce2b('0x47')],{})['then'](function(_0x439ddb){var _0x34213c=_0x426660[_0xce2b('0x48')][_0xce2b('0x29')]({'plain':!![]});if(!_0x34213c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34213c[_0xce2b('0x49')]===_0xce2b('0x48')){var _0x39a75e=_0x439ddb[_0xce2b('0x29')]({'plain':!![]});var _0x14ecae='Dispositions';return db[_0xce2b('0x4a')][_0xce2b('0x4b')]({'where':{'name':_0x14ecae,'userProfileId':_0x34213c[_0xce2b('0x4c')]},'raw':!![]})[_0xce2b('0x27')](function(_0x82feda){if(_0x82feda&&_0x82feda['autoAssociation']===0x0){return db[_0xce2b('0x4d')]['create']({'name':_0x39a75e[_0xce2b('0x2b')],'resourceId':_0x39a75e['id'],'type':_0x82feda[_0xce2b('0x2b')],'sectionId':_0x82feda['id']},{})['then'](function(){return _0x439ddb;});}else{return _0x439ddb;}})['catch'](function(_0x230169){logger[_0xce2b('0x4e')](_0xce2b('0x4f'),_0x230169);throw _0x230169;});}return _0x439ddb;})['then'](respondWithResult(_0x5399de,0xc9))[_0xce2b('0x43')](handleError(_0x5399de,null));};exports[_0xce2b('0x26')]=function(_0x4af369,_0x474e42){if(_0x4af369[_0xce2b('0x47')]['id']){delete _0x4af369[_0xce2b('0x47')]['id'];}return db[_0xce2b('0x2e')][_0xce2b('0x4b')]({'where':{'id':_0x4af369[_0xce2b('0x45')]['id']}})['then'](handleEntityNotFound(_0x474e42,null))[_0xce2b('0x27')](saveUpdates(_0x4af369['body'],null))[_0xce2b('0x27')](respondWithResult(_0x474e42,null))[_0xce2b('0x43')](handleError(_0x474e42,null));};exports[_0xce2b('0x28')]=function(_0x105d3f,_0x4e91c3){return db[_0xce2b('0x2e')][_0xce2b('0x4b')]({'where':{'id':_0x105d3f[_0xce2b('0x45')]['id']}})[_0xce2b('0x27')](handleEntityNotFound(_0x4e91c3,null))['then'](removeEntity(_0x4e91c3,null))[_0xce2b('0x43')](handleError(_0x4e91c3,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 85fdd8e..e850b7e 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 _0xd1d0=['exports','Disposition','name_voice','ListId','name_chat','name','MailAccountId','SmsAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5ae445,_0xc1ab27){var _0x402852=function(_0x15f9c9){while(--_0x15f9c9){_0x5ae445['push'](_0x5ae445['shift']());}};_0x402852(++_0xc1ab27);}(_0xd1d0,0xf4));var _0x0d1d=function(_0x4285a1,_0x40ddee){_0x4285a1=_0x4285a1-0x0;var _0x135a77=_0xd1d0[_0x4285a1];return _0x135a77;};'use strict';var _=require(_0x0d1d('0x0'));var util=require(_0x0d1d('0x1'));var logger=require(_0x0d1d('0x2'))('api');var moment=require(_0x0d1d('0x3'));var BPromise=require(_0x0d1d('0x4'));var rp=require(_0x0d1d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0d1d('0x6'));var config=require(_0x0d1d('0x7'));var attributes=require('./disposition.attributes');module[_0x0d1d('0x8')]=function(_0x4c1a0e,_0x4f2578){return _0x4c1a0e['define'](_0x0d1d('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x0d1d('0xa'),'fields':['name',_0x0d1d('0xb')]},{'unique':!![],'name':_0x0d1d('0xc'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x0d1d('0xd'),_0x0d1d('0xe')]},{'unique':!![],'name':'name_sms','fields':[_0x0d1d('0xd'),_0x0d1d('0xf')]},{'unique':!![],'name':'name_fax','fields':[_0x0d1d('0xd'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0x0d1d('0xd'),'OpenchannelAccountId']},{'unique':!![],'name':_0x0d1d('0x10'),'fields':[_0x0d1d('0xd'),_0x0d1d('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd16=['request-promise','path','../../config/environment','exports','define','tools_dispositions','name_voice','name','name_chat','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','api','moment','bluebird'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0xcd16,0x7f));var _0x6cd1=function(_0x1b468a,_0x22212a){_0x1b468a=_0x1b468a-0x0;var _0x178561=_0xcd16[_0x1b468a];return _0x178561;};'use strict';var _=require(_0x6cd1('0x0'));var util=require(_0x6cd1('0x1'));var logger=require('../../config/logger')(_0x6cd1('0x2'));var moment=require(_0x6cd1('0x3'));var BPromise=require(_0x6cd1('0x4'));var rp=require(_0x6cd1('0x5'));var fs=require('fs');var path=require(_0x6cd1('0x6'));var rimraf=require('rimraf');var config=require(_0x6cd1('0x7'));var attributes=require('./disposition.attributes');module[_0x6cd1('0x8')]=function(_0x15880d,_0x33a1dc){return _0x15880d[_0x6cd1('0x9')]('Disposition',attributes,{'tableName':_0x6cd1('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x6cd1('0xb'),'fields':[_0x6cd1('0xc'),'ListId']},{'unique':!![],'name':_0x6cd1('0xd'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0x6cd1('0xe'),'fields':['name',_0x6cd1('0xf')]},{'unique':!![],'name':'name_sms','fields':[_0x6cd1('0xc'),_0x6cd1('0x10')]},{'unique':!![],'name':_0x6cd1('0x11'),'fields':[_0x6cd1('0xc'),_0x6cd1('0x12')]},{'unique':!![],'name':_0x6cd1('0x13'),'fields':[_0x6cd1('0xc'),_0x6cd1('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x6cd1('0xc'),_0x6cd1('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 8705995..0be2fdc 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(_0x316f46,_0x4df2b9){var _0x3ddccf=function(_0x5115b6){while(--_0x5115b6){_0x316f46['push'](_0x316f46['shift']());}};_0x3ddccf(++_0x4df2b9);}(_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 +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(_0x1a48ee,_0xe0a0d6){var _0x26bda3=function(_0x5e30ca){while(--_0x5e30ca){_0x1a48ee['push'](_0x1a48ee['shift']());}};_0x26bda3(++_0xe0a0d6);}(_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 diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index fac8643..a6efd39 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 _0x27f3=['isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x142aa1,_0x1377b7){var _0x463ecb=function(_0x318433){while(--_0x318433){_0x142aa1['push'](_0x142aa1['shift']());}};_0x463ecb(++_0x1377b7);}(_0x27f3,0xd2));var _0x327f=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x27f3[_0x462999];return _0x4b1366;};'use strict';var multer=require(_0x327f('0x0'));var util=require(_0x327f('0x1'));var path=require(_0x327f('0x2'));var timeout=require(_0x327f('0x3'));var express=require(_0x327f('0x4'));var router=express[_0x327f('0x5')]();var fs_extra=require(_0x327f('0x6'));var auth=require(_0x327f('0x7'));var interaction=require(_0x327f('0x8'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x327f('0x9')]('/',auth[_0x327f('0xa')](),controller[_0x327f('0xb')]);router[_0x327f('0x9')](_0x327f('0xc'),auth['isAuthenticated'](),controller[_0x327f('0xd')]);router[_0x327f('0xe')]('/',auth[_0x327f('0xa')](),controller[_0x327f('0xf')]);router[_0x327f('0x10')](_0x327f('0xc'),auth[_0x327f('0xa')](),controller[_0x327f('0x11')]);router['delete'](_0x327f('0xc'),auth[_0x327f('0xa')](),controller[_0x327f('0x12')]);module[_0x327f('0x13')]=router; \ No newline at end of file +var _0x9d52=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer'];(function(_0x569a0e,_0x4440f1){var _0x139c48=function(_0xfc721a){while(--_0xfc721a){_0x569a0e['push'](_0x569a0e['shift']());}};_0x139c48(++_0x4440f1);}(_0x9d52,0x18e));var _0x29d5=function(_0x56500a,_0x5953c7){_0x56500a=_0x56500a-0x0;var _0x333977=_0x9d52[_0x56500a];return _0x333977;};'use strict';var multer=require(_0x29d5('0x0'));var util=require(_0x29d5('0x1'));var path=require(_0x29d5('0x2'));var timeout=require(_0x29d5('0x3'));var express=require(_0x29d5('0x4'));var router=express[_0x29d5('0x5')]();var fs_extra=require(_0x29d5('0x6'));var auth=require(_0x29d5('0x7'));var interaction=require(_0x29d5('0x8'));var config=require(_0x29d5('0x9'));var controller=require(_0x29d5('0xa'));router[_0x29d5('0xb')]('/',auth[_0x29d5('0xc')](),controller[_0x29d5('0xd')]);router[_0x29d5('0xb')](_0x29d5('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x29d5('0xf')]('/',auth[_0x29d5('0xc')](),controller['create']);router[_0x29d5('0x10')]('/:id',auth[_0x29d5('0xc')](),controller[_0x29d5('0x11')]);router[_0x29d5('0x12')](_0x29d5('0xe'),auth[_0x29d5('0xc')](),controller[_0x29d5('0x13')]);module[_0x29d5('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index afac060..92bf796 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 _0xbd51=['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','mandatoryDisposition','sequelize','STRING','ENUM','yes','localstationid','2400','7200','9600','12000','14400','4800','INTEGER','SIP','IAX','DADHI','KHOMP'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x12e975,_0x8808c1){_0x12e975=_0x12e975-0x0;var _0x538022=_0xbd51[_0x12e975];return _0x538022;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bd5('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1bd5('0x1')]},'ecm':{'type':Sequelize[_0x1bd5('0x2')](_0x1bd5('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0x1bd5('0x4')},'minrate':{'type':Sequelize[_0x1bd5('0x2')](_0x1bd5('0x5'),'4800',_0x1bd5('0x6'),_0x1bd5('0x7'),_0x1bd5('0x8'),_0x1bd5('0x9')),'defaultValue':_0x1bd5('0xa')},'maxrate':{'type':Sequelize['ENUM'](_0x1bd5('0x5'),'4800',_0x1bd5('0x6'),_0x1bd5('0x7'),_0x1bd5('0x8'),_0x1bd5('0x9')),'defaultValue':_0x1bd5('0x9')},'modem':{'type':Sequelize[_0x1bd5('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x1bd5('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1bd5('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1bd5('0x2')](_0x1bd5('0xc'),_0x1bd5('0xd'),_0x1bd5('0xe'),_0x1bd5('0xf')),'defaultValue':_0x1bd5('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1bd5('0x10');}},'notificationSound':{'type':Sequelize[_0x1bd5('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1bd5('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1bd5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1bd5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1bd5('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1bd5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1bd5('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x1bd5('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x1bd5('0x11')],'defaultValue':![],'comment':_0x1bd5('0x13'),'set':function(_0x3afc4a){if(!_0x3afc4a)this[_0x1bd5('0x14')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x1bd5('0x15'),_0x3afc4a);}}}; \ No newline at end of file +var _0x6f44=['KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x6f44,0x1ea));var _0x46f4=function(_0x331df1,_0x194203){_0x331df1=_0x331df1-0x0;var _0x1d57b1=_0x6f44[_0x331df1];return _0x1d57b1;};'use strict';var Sequelize=require(_0x46f4('0x0'));module[_0x46f4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x46f4('0x2')]},'ecm':{'type':Sequelize[_0x46f4('0x3')](_0x46f4('0x4'),'no'),'defaultValue':_0x46f4('0x4')},'headerinfo':{'type':Sequelize[_0x46f4('0x2')],'defaultValue':_0x46f4('0x5')},'localstationid':{'type':Sequelize[_0x46f4('0x2')],'unique':_0x46f4('0x6')},'minrate':{'type':Sequelize[_0x46f4('0x3')]('2400',_0x46f4('0x7'),_0x46f4('0x8'),_0x46f4('0x9'),'12000','14400'),'defaultValue':_0x46f4('0x7')},'maxrate':{'type':Sequelize[_0x46f4('0x3')]('2400',_0x46f4('0x7'),'7200',_0x46f4('0x9'),'12000',_0x46f4('0xa')),'defaultValue':_0x46f4('0xa')},'modem':{'type':Sequelize[_0x46f4('0x2')],'defaultValue':_0x46f4('0xb')},'gateway':{'type':Sequelize[_0x46f4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x46f4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x46f4('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x46f4('0x3')](_0x46f4('0xd'),_0x46f4('0xe'),_0x46f4('0xf'),_0x46f4('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x46f4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x46f4('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x46f4('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x46f4('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x46f4('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x46f4('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x46f4('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x46f4('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x46f4('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5e237d){if(!_0x5e237d)this['setDataValue'](_0x46f4('0x14'),null);this[_0x46f4('0x15')]('mandatoryDisposition',_0x5e237d);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 4129771..1e5d8bd 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 _0xe891=['out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','path','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./faxAccount.socket','register','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','end','status','offset','limit','undefined','count','set','json','apply','reject','save','destroy','get','UserProfileResource','stack','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','FaxInteraction','addInteraction','getInteractions','CmContact','Contact','fullname','internal','Tag','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','context','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','modem','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','VoiceExtension','updateAccountApplications','transaction','omit','tech','createdAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','defaults','List\x20not\x20found'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe891,0xda));var _0x1e89=function(_0x54b695,_0x1c99d5){_0x54b695=_0x54b695-0x0;var _0x24418d=_0xe891[_0x54b695];return _0x24418d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e89('0x0'));var zipdir=require(_0x1e89('0x1'));var jsonpatch=require(_0x1e89('0x2'));var rp=require('request-promise');var moment=require(_0x1e89('0x3'));var BPromise=require(_0x1e89('0x4'));var Mustache=require(_0x1e89('0x5'));var util=require(_0x1e89('0x6'));var path=require('path');var sox=require(_0x1e89('0x7'));var csv=require(_0x1e89('0x8'));var ejs=require(_0x1e89('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1e89('0xa'));var crypto=require(_0x1e89('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1e89('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1e89('0xd'));var Papa=require(_0x1e89('0xe'));var Redis=require(_0x1e89('0xf'));var authService=require(_0x1e89('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1e89('0x11'));var hardwareService=require(_0x1e89('0x12'));var logger=require(_0x1e89('0x13'))(_0x1e89('0x14'));var utils=require(_0x1e89('0x15'));var config=require(_0x1e89('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e89('0x17'))['db'];config[_0x1e89('0x18')]=_['defaults'](config['redis'],{'host':_0x1e89('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e89('0x18')]));require(_0x1e89('0x1a'))[_0x1e89('0x1b')](socket);var jayson=require(_0x1e89('0x1c'));var client=jayson[_0x1e89('0x1d')][_0x1e89('0x1e')]({'port':0x232c});var client9002=jayson[_0x1e89('0x1d')][_0x1e89('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x21f224,_0x155785,_0x42a74f,_0x4f9318){return new BPromise(function(_0x32248a,_0x463291){var _0x41f9a1=_0x4f9318||client;return _0x41f9a1[_0x1e89('0x1f')](_0x21f224,_0x42a74f)[_0x1e89('0x20')](function(_0x25f3ee){logger['info'](_0x1e89('0x21'),_0x155785,_0x1e89('0x22'));logger[_0x1e89('0x23')](_0x1e89('0x24'),_0x155785,_0x1e89('0x22'),JSON[_0x1e89('0x25')](_0x25f3ee));if(_0x25f3ee[_0x1e89('0x26')]){if(_0x25f3ee[_0x1e89('0x26')][_0x1e89('0x27')]===0x1f4){logger[_0x1e89('0x26')](_0x1e89('0x21'),_0x155785,_0x25f3ee[_0x1e89('0x26')][_0x1e89('0x28')]);return _0x463291(_0x25f3ee[_0x1e89('0x26')][_0x1e89('0x28')]);}logger[_0x1e89('0x26')]('FaxAccount,\x20%s,\x20%s',_0x155785,_0x25f3ee[_0x1e89('0x26')][_0x1e89('0x28')]);return _0x32248a(_0x25f3ee['error'][_0x1e89('0x28')]);}else{logger[_0x1e89('0x29')](_0x1e89('0x21'),_0x155785,'request\x20sent');_0x32248a(_0x25f3ee[_0x1e89('0x2a')]['message']);}})['catch'](function(_0x5e1b2b){logger[_0x1e89('0x26')](_0x1e89('0x21'),_0x155785,_0x5e1b2b);_0x463291(_0x5e1b2b);});});}function respondWithStatusCode(_0x3c4902,_0x31ae5d){_0x31ae5d=_0x31ae5d||0xcc;return function(_0x2c860b){if(_0x2c860b){return _0x3c4902[_0x1e89('0x2b')](_0x31ae5d);}return _0x3c4902['status'](_0x31ae5d)[_0x1e89('0x2c')]();};}function respondWithResult(_0x4c8a97,_0x425d4d){_0x425d4d=_0x425d4d||0xc8;return function(_0x3908ec){if(_0x3908ec){return _0x4c8a97[_0x1e89('0x2d')](_0x425d4d)['json'](_0x3908ec);}};}function respondWithFilteredResult(_0x2d2fd5,_0x595894){return function(_0x1173d1){if(_0x1173d1){var _0x4ade05=typeof _0x595894[_0x1e89('0x2e')]==='undefined'&&typeof _0x595894[_0x1e89('0x2f')]===_0x1e89('0x30');var _0x270357=_0x1173d1[_0x1e89('0x31')];var _0x25af98=_0x4ade05?0x0:_0x595894[_0x1e89('0x2e')];var _0x58c802=_0x4ade05?_0x1173d1[_0x1e89('0x31')]:_0x595894['offset']+_0x595894[_0x1e89('0x2f')];var _0x47daf0;if(_0x58c802>=_0x270357){_0x58c802=_0x270357;_0x47daf0=0xc8;}else{_0x47daf0=0xce;}_0x2d2fd5[_0x1e89('0x2d')](_0x47daf0);return _0x2d2fd5[_0x1e89('0x32')]('Content-Range',_0x25af98+'-'+_0x58c802+'/'+_0x270357)[_0x1e89('0x33')](_0x1173d1);}return null;};}function patchUpdates(_0x1faa03){return function(_0x414461){try{jsonpatch[_0x1e89('0x34')](_0x414461,_0x1faa03,!![]);}catch(_0x338d12){return BPromise[_0x1e89('0x35')](_0x338d12);}return _0x414461[_0x1e89('0x36')]();};}function saveUpdates(_0x12492e,_0x4747d6){return function(_0x2be078){if(_0x2be078){return _0x2be078['update'](_0x12492e)[_0x1e89('0x20')](function(_0x44a965){return _0x44a965;});}return null;};}function removeEntity(_0x22ec11,_0x42998d){return function(_0xbc5062){if(_0xbc5062){return _0xbc5062[_0x1e89('0x37')]()[_0x1e89('0x20')](function(){var _0x2ba57f=_0xbc5062[_0x1e89('0x38')]({'plain':!![]});var _0x12af4e='FaxAccounts';return db[_0x1e89('0x39')][_0x1e89('0x37')]({'where':{'type':_0x12af4e,'resourceId':_0x2ba57f['id']}})[_0x1e89('0x20')](function(){return _0xbc5062;});})[_0x1e89('0x20')](function(){_0x22ec11['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb14c83,_0x2edbf3){return function(_0x2174ba){if(!_0x2174ba){_0xb14c83[_0x1e89('0x2b')](0x194);}return _0x2174ba;};}function handleError(_0x909436,_0x3b16f3){_0x3b16f3=_0x3b16f3||0x1f4;return function(_0x26a90f){logger['error'](_0x26a90f[_0x1e89('0x3a')]);if(_0x26a90f['name']){delete _0x26a90f['name'];}_0x909436['status'](_0x3b16f3)['send'](_0x26a90f);};}exports[_0x1e89('0x3b')]=function(_0x31e17e,_0x4c100f){var _0x111ab4={'include':[{'model':db[_0x1e89('0x3c')],'as':_0x1e89('0x3d')}]},_0x516389={},_0x109d84={'count':0x0,'rows':[]};var _0x22e406=_[_0x1e89('0x3e')](db[_0x1e89('0x3f')][_0x1e89('0x40')],function(_0x23cfa2){return{'name':_0x23cfa2[_0x1e89('0x41')],'type':_0x23cfa2[_0x1e89('0x42')][_0x1e89('0x43')]};});_0x516389[_0x1e89('0x44')]=_[_0x1e89('0x3e')](_0x22e406,_0x1e89('0x45'));_0x516389[_0x1e89('0x46')]=_[_0x1e89('0x47')](_0x31e17e[_0x1e89('0x46')]);_0x516389[_0x1e89('0x48')]=_[_0x1e89('0x49')](_0x516389[_0x1e89('0x44')],_0x516389[_0x1e89('0x46')]);_0x111ab4['attributes']=_[_0x1e89('0x49')](_0x516389['model'],qs[_0x1e89('0x4a')](_0x31e17e['query'][_0x1e89('0x4a')]));_0x111ab4['attributes']=_0x111ab4['attributes'][_0x1e89('0x4b')]?_0x111ab4[_0x1e89('0x4c')]:_0x516389['model'];if(!_0x31e17e[_0x1e89('0x46')][_0x1e89('0x4d')](_0x1e89('0x4e'))){_0x111ab4['limit']=qs[_0x1e89('0x2f')](_0x31e17e[_0x1e89('0x46')]['limit']);_0x111ab4['offset']=qs['offset'](_0x31e17e[_0x1e89('0x46')][_0x1e89('0x2e')]);}_0x111ab4[_0x1e89('0x4f')]=qs['sort'](_0x31e17e['query'][_0x1e89('0x50')]);_0x111ab4[_0x1e89('0x51')]=qs[_0x1e89('0x48')](_[_0x1e89('0x52')](_0x31e17e[_0x1e89('0x46')],_0x516389[_0x1e89('0x48')]),_0x22e406);if(_0x31e17e[_0x1e89('0x46')][_0x1e89('0x53')]){_0x111ab4[_0x1e89('0x51')]=_['merge'](_0x111ab4[_0x1e89('0x51')],{'$or':_[_0x1e89('0x3e')](_0x22e406,function(_0x1e5b6e){if(_0x1e5b6e[_0x1e89('0x42')]!==_0x1e89('0x54')){var _0x5aa962={};_0x5aa962[_0x1e5b6e[_0x1e89('0x45')]]={'$like':'%'+_0x31e17e['query'][_0x1e89('0x53')]+'%'};return _0x5aa962;}})});}_0x111ab4=_[_0x1e89('0x55')]({},_0x111ab4,_0x31e17e[_0x1e89('0x56')]);var _0x4416a8={'where':_0x111ab4[_0x1e89('0x51')]};return db[_0x1e89('0x3f')][_0x1e89('0x31')](_0x4416a8)[_0x1e89('0x20')](function(_0x1959e9){_0x109d84[_0x1e89('0x31')]=_0x1959e9;if(_0x31e17e[_0x1e89('0x46')][_0x1e89('0x57')]){_0x111ab4[_0x1e89('0x58')]=[{'all':!![]}];}return db['FaxAccount'][_0x1e89('0x59')](_0x111ab4);})[_0x1e89('0x20')](function(_0x287cd6){_0x109d84[_0x1e89('0x5a')]=_0x287cd6;return _0x109d84;})[_0x1e89('0x20')](respondWithFilteredResult(_0x4c100f,_0x111ab4))[_0x1e89('0x5b')](handleError(_0x4c100f,null));};exports['show']=function(_0x3186a3,_0x33de16){var _0x5de8d4={'raw':![],'where':{'id':_0x3186a3[_0x1e89('0x5c')]['id']},'include':[{'model':db[_0x1e89('0x3c')],'as':_0x1e89('0x3d')}]},_0x339bf5={};_0x339bf5['model']=_[_0x1e89('0x47')](db[_0x1e89('0x3f')][_0x1e89('0x40')]);_0x339bf5[_0x1e89('0x46')]=_['keys'](_0x3186a3[_0x1e89('0x46')]);_0x339bf5['filters']=_[_0x1e89('0x49')](_0x339bf5[_0x1e89('0x44')],_0x339bf5[_0x1e89('0x46')]);_0x5de8d4[_0x1e89('0x4c')]=_[_0x1e89('0x49')](_0x339bf5[_0x1e89('0x44')],qs[_0x1e89('0x4a')](_0x3186a3[_0x1e89('0x46')][_0x1e89('0x4a')]));_0x5de8d4[_0x1e89('0x4c')]=_0x5de8d4['attributes'][_0x1e89('0x4b')]?_0x5de8d4[_0x1e89('0x4c')]:_0x339bf5[_0x1e89('0x44')];if(_0x3186a3[_0x1e89('0x46')]['includeAll']){_0x5de8d4[_0x1e89('0x58')]=[{'all':!![]}];}_0x5de8d4=_[_0x1e89('0x55')]({},_0x5de8d4,_0x3186a3[_0x1e89('0x56')]);return db[_0x1e89('0x3f')][_0x1e89('0x5d')](_0x5de8d4)[_0x1e89('0x20')](handleEntityNotFound(_0x33de16,null))[_0x1e89('0x20')](respondWithResult(_0x33de16,null))[_0x1e89('0x5b')](handleError(_0x33de16,null));};exports[_0x1e89('0x5e')]=function(_0xfe7bd,_0xdee22e){return db[_0x1e89('0x3f')][_0x1e89('0x5e')](_0xfe7bd[_0x1e89('0x5f')],{})[_0x1e89('0x20')](function(_0x49cfbf){var _0x70504e=_0xfe7bd[_0x1e89('0x60')][_0x1e89('0x38')]({'plain':!![]});if(!_0x70504e)throw new Error(_0x1e89('0x61'));if(_0x70504e[_0x1e89('0x62')]==='user'){var _0x522540=_0x49cfbf[_0x1e89('0x38')]({'plain':!![]});var _0x4ad8f9=_0x1e89('0x63');return db[_0x1e89('0x64')]['find']({'where':{'name':_0x4ad8f9,'userProfileId':_0x70504e['userProfileId']},'raw':!![]})[_0x1e89('0x20')](function(_0x150f9a){if(_0x150f9a&&_0x150f9a[_0x1e89('0x65')]===0x0){return db['UserProfileResource'][_0x1e89('0x5e')]({'name':_0x522540[_0x1e89('0x45')],'resourceId':_0x522540['id'],'type':_0x150f9a[_0x1e89('0x45')],'sectionId':_0x150f9a['id']},{})[_0x1e89('0x20')](function(){return _0x49cfbf;});}else{return _0x49cfbf;}})[_0x1e89('0x5b')](function(_0x42e557){logger[_0x1e89('0x26')](_0x1e89('0x66'),_0x42e557);throw _0x42e557;});}return _0x49cfbf;})[_0x1e89('0x20')](respondWithResult(_0xdee22e,0xc9))[_0x1e89('0x5b')](handleError(_0xdee22e,null));};exports[_0x1e89('0x67')]=function(_0x73684c,_0x4f1bd5){if(_0x73684c['body']['id']){delete _0x73684c[_0x1e89('0x5f')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x73684c['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x1e89('0x20')](handleEntityNotFound(_0x4f1bd5,null))['then'](saveUpdates(_0x73684c[_0x1e89('0x5f')],null))['then'](respondWithResult(_0x4f1bd5,null))[_0x1e89('0x5b')](handleError(_0x4f1bd5,null));};exports[_0x1e89('0x37')]=function(_0x49988e,_0x5ecc37){return db[_0x1e89('0x3f')][_0x1e89('0x5d')]({'where':{'id':_0x49988e[_0x1e89('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5ecc37,null))[_0x1e89('0x20')](removeEntity(_0x5ecc37,null))[_0x1e89('0x5b')](handleError(_0x5ecc37,null));};exports[_0x1e89('0x68')]=function(_0x441413,_0x4048f6){return db[_0x1e89('0x3f')][_0x1e89('0x68')]()[_0x1e89('0x20')](respondWithResult(_0x4048f6,null))[_0x1e89('0x5b')](handleError(_0x4048f6,null));};exports[_0x1e89('0x69')]=function(_0x48d4bb,_0xfd5c90,_0x55f6c9){if(_0x48d4bb[_0x1e89('0x5f')]['id']){delete _0x48d4bb[_0x1e89('0x5f')]['id'];}return db[_0x1e89('0x3f')][_0x1e89('0x5d')]({'where':{'id':_0x48d4bb[_0x1e89('0x5c')]['id']}})[_0x1e89('0x20')](handleEntityNotFound(_0xfd5c90,null))['then'](function(_0x289867){if(_0x289867){_0x48d4bb[_0x1e89('0x5f')][_0x1e89('0x6a')]=_0x289867['id'];return db[_0x1e89('0x6b')][_0x1e89('0x5e')](_0x48d4bb['body']);}})['then'](respondWithResult(_0xfd5c90,null))[_0x1e89('0x5b')](handleError(_0xfd5c90,null));};exports[_0x1e89('0x6c')]=function(_0x368f3d,_0x3015d3,_0x8b45d9){var _0x185def={'raw':![],'where':{}};var _0x2c76e8={};var _0x52925d={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1e89('0x6d')]({'where':{'id':_0x368f3d['params']['id']}})[_0x1e89('0x20')](handleEntityNotFound(_0x3015d3,null))[_0x1e89('0x20')](function(_0x2d1e78){if(_0x2d1e78){_0x2c76e8[_0x1e89('0x44')]=_[_0x1e89('0x47')](db['Disposition'][_0x1e89('0x40')]);_0x2c76e8[_0x1e89('0x46')]=_['keys'](_0x368f3d['query']);_0x2c76e8[_0x1e89('0x48')]=_[_0x1e89('0x49')](_0x2c76e8[_0x1e89('0x44')],_0x2c76e8['query']);_0x185def[_0x1e89('0x4c')]=_['intersection'](_0x2c76e8[_0x1e89('0x44')],qs[_0x1e89('0x4a')](_0x368f3d[_0x1e89('0x46')]['fields']));_0x185def[_0x1e89('0x4c')]=_0x185def[_0x1e89('0x4c')][_0x1e89('0x4b')]?_0x185def[_0x1e89('0x4c')]:_0x2c76e8[_0x1e89('0x44')];if(!_0x368f3d[_0x1e89('0x46')][_0x1e89('0x4d')](_0x1e89('0x4e'))){_0x185def[_0x1e89('0x2f')]=qs[_0x1e89('0x2f')](_0x368f3d[_0x1e89('0x46')]['limit']);_0x185def[_0x1e89('0x2e')]=qs['offset'](_0x368f3d[_0x1e89('0x46')][_0x1e89('0x2e')]);}_0x185def[_0x1e89('0x4f')]=qs[_0x1e89('0x50')](_0x368f3d[_0x1e89('0x46')][_0x1e89('0x50')]);_0x185def[_0x1e89('0x51')]=qs[_0x1e89('0x48')](_[_0x1e89('0x52')](_0x368f3d[_0x1e89('0x46')],_0x2c76e8['filters']));_0x185def[_0x1e89('0x51')][_0x1e89('0x6a')]=_0x2d1e78['id'];if(_0x368f3d[_0x1e89('0x46')][_0x1e89('0x53')]){_0x185def['where']=_['merge'](_0x185def['where'],{'$or':_['map'](_0x185def['attributes'],function(_0x22b947){var _0x17be29={};_0x17be29[_0x22b947]={'$like':'%'+_0x368f3d[_0x1e89('0x46')][_0x1e89('0x53')]+'%'};return _0x17be29;})});}_0x185def=_[_0x1e89('0x55')]({},_0x185def,_0x368f3d[_0x1e89('0x56')]);return db['Disposition'][_0x1e89('0x31')]({'where':_0x185def[_0x1e89('0x51')]})[_0x1e89('0x20')](function(_0x5606f7){_0x52925d[_0x1e89('0x31')]=_0x5606f7;if(_0x368f3d['query'][_0x1e89('0x57')]){_0x185def[_0x1e89('0x58')]=[{'all':!![]}];}return db[_0x1e89('0x6b')]['findAll'](_0x185def);})[_0x1e89('0x20')](function(_0x306ad5){_0x52925d[_0x1e89('0x5a')]=_0x306ad5;return _0x52925d;});}})[_0x1e89('0x20')](respondWithFilteredResult(_0x3015d3,_0x185def))[_0x1e89('0x5b')](handleError(_0x3015d3,null));};exports[_0x1e89('0x6e')]=function(_0x3b2699,_0x120a6d,_0x264ebd){return db[_0x1e89('0x3f')][_0x1e89('0x5d')]({'where':{'id':_0x3b2699[_0x1e89('0x5c')]['id']}})[_0x1e89('0x20')](handleEntityNotFound(_0x120a6d,null))['then'](function(_0x358a17){if(_0x358a17){return _0x358a17[_0x1e89('0x6e')](_0x3b2699[_0x1e89('0x46')][_0x1e89('0x6f')]);}})[_0x1e89('0x20')](respondWithStatusCode(_0x120a6d,null))[_0x1e89('0x5b')](handleError(_0x120a6d,null));};exports[_0x1e89('0x70')]=function(_0x59bf0d,_0x245dfc,_0x433813){if(_0x59bf0d[_0x1e89('0x5f')]['id']){delete _0x59bf0d[_0x1e89('0x5f')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x59bf0d['params']['id']}})[_0x1e89('0x20')](handleEntityNotFound(_0x245dfc,null))[_0x1e89('0x20')](function(_0x92ff5a){if(_0x92ff5a){_0x59bf0d['body'][_0x1e89('0x6a')]=_0x92ff5a['id'];return db[_0x1e89('0x71')][_0x1e89('0x5e')](_0x59bf0d[_0x1e89('0x5f')]);}})[_0x1e89('0x20')](respondWithResult(_0x245dfc,null))[_0x1e89('0x5b')](handleError(_0x245dfc,null));};exports['getAnswers']=function(_0x482c7a,_0x14881a,_0x5773ac){var _0x2cd1be={'raw':![],'where':{}};var _0x156f03={};var _0x472921={'count':0x0,'rows':[]};return db[_0x1e89('0x3f')]['findOne']({'where':{'id':_0x482c7a[_0x1e89('0x5c')]['id']}})[_0x1e89('0x20')](handleEntityNotFound(_0x14881a,null))[_0x1e89('0x20')](function(_0x8b2870){if(_0x8b2870){_0x156f03[_0x1e89('0x44')]=_[_0x1e89('0x47')](db[_0x1e89('0x71')]['rawAttributes']);_0x156f03[_0x1e89('0x46')]=_[_0x1e89('0x47')](_0x482c7a[_0x1e89('0x46')]);_0x156f03[_0x1e89('0x48')]=_[_0x1e89('0x49')](_0x156f03[_0x1e89('0x44')],_0x156f03[_0x1e89('0x46')]);_0x2cd1be[_0x1e89('0x4c')]=_[_0x1e89('0x49')](_0x156f03['model'],qs['fields'](_0x482c7a['query'][_0x1e89('0x4a')]));_0x2cd1be['attributes']=_0x2cd1be['attributes']['length']?_0x2cd1be[_0x1e89('0x4c')]:_0x156f03[_0x1e89('0x44')];if(!_0x482c7a['query'][_0x1e89('0x4d')]('nolimit')){_0x2cd1be[_0x1e89('0x2f')]=qs[_0x1e89('0x2f')](_0x482c7a['query'][_0x1e89('0x2f')]);_0x2cd1be['offset']=qs[_0x1e89('0x2e')](_0x482c7a[_0x1e89('0x46')][_0x1e89('0x2e')]);}_0x2cd1be[_0x1e89('0x4f')]=qs[_0x1e89('0x50')](_0x482c7a[_0x1e89('0x46')][_0x1e89('0x50')]);_0x2cd1be[_0x1e89('0x51')]=qs[_0x1e89('0x48')](_[_0x1e89('0x52')](_0x482c7a[_0x1e89('0x46')],_0x156f03[_0x1e89('0x48')]));_0x2cd1be['where'][_0x1e89('0x6a')]=_0x8b2870['id'];if(_0x482c7a[_0x1e89('0x46')][_0x1e89('0x53')]){_0x2cd1be[_0x1e89('0x51')]=_[_0x1e89('0x55')](_0x2cd1be[_0x1e89('0x51')],{'$or':_[_0x1e89('0x3e')](_0x2cd1be[_0x1e89('0x4c')],function(_0x17b06d){var _0x450a51={};_0x450a51[_0x17b06d]={'$like':'%'+_0x482c7a[_0x1e89('0x46')][_0x1e89('0x53')]+'%'};return _0x450a51;})});}_0x2cd1be=_[_0x1e89('0x55')]({},_0x2cd1be,_0x482c7a[_0x1e89('0x56')]);return db[_0x1e89('0x71')][_0x1e89('0x31')]({'where':_0x2cd1be[_0x1e89('0x51')]})[_0x1e89('0x20')](function(_0x345e9f){_0x472921[_0x1e89('0x31')]=_0x345e9f;if(_0x482c7a[_0x1e89('0x46')]['includeAll']){_0x2cd1be[_0x1e89('0x58')]=[{'all':!![]}];}return db[_0x1e89('0x71')][_0x1e89('0x59')](_0x2cd1be);})[_0x1e89('0x20')](function(_0x8cc08d){_0x472921['rows']=_0x8cc08d;return _0x472921;});}})[_0x1e89('0x20')](respondWithFilteredResult(_0x14881a,_0x2cd1be))[_0x1e89('0x5b')](handleError(_0x14881a,null));};exports[_0x1e89('0x72')]=function(_0x31c0f6,_0x5c172f,_0x1c0f3a){return db[_0x1e89('0x3f')][_0x1e89('0x5d')]({'where':{'id':_0x31c0f6[_0x1e89('0x5c')]['id']}})[_0x1e89('0x20')](handleEntityNotFound(_0x5c172f,null))[_0x1e89('0x20')](function(_0x26628e){if(_0x26628e){return _0x26628e[_0x1e89('0x72')](_0x31c0f6[_0x1e89('0x46')][_0x1e89('0x6f')]);}})[_0x1e89('0x20')](respondWithStatusCode(_0x5c172f,null))[_0x1e89('0x5b')](handleError(_0x5c172f,null));};exports['addInteraction']=function(_0x5b5108,_0x297482,_0x4bdea8){return db[_0x1e89('0x73')]['find']({'where':{'id':_0x5b5108[_0x1e89('0x5c')]['id']}})[_0x1e89('0x20')](handleEntityNotFound(_0x297482,null))['then'](function(_0x18f7b2){if(_0x18f7b2){return _0x18f7b2[_0x1e89('0x74')](_0x5b5108[_0x1e89('0x5f')]['ids'],_['omit'](_0x5b5108['body'],[_0x1e89('0x6f'),'id'])||{});}})[_0x1e89('0x20')](respondWithResult(_0x297482,null))[_0x1e89('0x5b')](handleError(_0x297482,null));};exports[_0x1e89('0x75')]=function(_0x508b91,_0x513cdd,_0xb300b2){var _0x597c95={'raw':![],'where':{}};var _0x5b6716={};var _0x218992={'count':0x0,'rows':[]};return db[_0x1e89('0x3f')][_0x1e89('0x6d')]({'where':{'id':_0x508b91[_0x1e89('0x5c')]['id']}})[_0x1e89('0x20')](handleEntityNotFound(_0x513cdd,null))[_0x1e89('0x20')](function(_0x3ffb69){if(_0x3ffb69){_0x5b6716[_0x1e89('0x44')]=_[_0x1e89('0x47')](db[_0x1e89('0x73')][_0x1e89('0x40')]);_0x5b6716[_0x1e89('0x46')]=_[_0x1e89('0x47')](_0x508b91[_0x1e89('0x46')]);_0x5b6716['filters']=_[_0x1e89('0x49')](_0x5b6716[_0x1e89('0x44')],_0x5b6716[_0x1e89('0x46')]);_0x597c95[_0x1e89('0x4c')]=_[_0x1e89('0x49')](_0x5b6716[_0x1e89('0x44')],qs[_0x1e89('0x4a')](_0x508b91[_0x1e89('0x46')][_0x1e89('0x4a')]));_0x597c95[_0x1e89('0x4c')]=_0x597c95['attributes'][_0x1e89('0x4b')]?_0x597c95['attributes']:_0x5b6716[_0x1e89('0x44')];if(!_0x508b91[_0x1e89('0x46')]['hasOwnProperty'](_0x1e89('0x4e'))){_0x597c95[_0x1e89('0x2f')]=qs['limit'](_0x508b91['query'][_0x1e89('0x2f')]);_0x597c95[_0x1e89('0x2e')]=qs[_0x1e89('0x2e')](_0x508b91[_0x1e89('0x46')][_0x1e89('0x2e')]);}_0x597c95[_0x1e89('0x4f')]=qs[_0x1e89('0x50')](_0x508b91['query'][_0x1e89('0x50')]);_0x597c95[_0x1e89('0x51')]=qs[_0x1e89('0x48')](_['pick'](_0x508b91[_0x1e89('0x46')],_0x5b6716[_0x1e89('0x48')]));_0x597c95[_0x1e89('0x51')][_0x1e89('0x6a')]=_0x3ffb69['id'];if(_0x508b91[_0x1e89('0x46')][_0x1e89('0x53')]){_0x597c95[_0x1e89('0x51')]=_[_0x1e89('0x55')](_0x597c95[_0x1e89('0x51')],{'$or':_[_0x1e89('0x3e')](_0x597c95[_0x1e89('0x4c')],function(_0x1c1a5b){var _0x145650={};_0x145650[_0x1c1a5b]={'$like':'%'+_0x508b91['query'][_0x1e89('0x53')]+'%'};return _0x145650;})});}_0x597c95=_[_0x1e89('0x55')]({},_0x597c95,_0x508b91['options']);return db[_0x1e89('0x73')][_0x1e89('0x31')]({'where':_0x597c95[_0x1e89('0x51')]})[_0x1e89('0x20')](function(_0x337c0c){_0x218992['count']=_0x337c0c;if(_0x508b91['query'][_0x1e89('0x57')]){_0x597c95[_0x1e89('0x58')]=[{'model':db[_0x1e89('0x76')],'as':_0x1e89('0x77'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x1e89('0x45'),_0x1e89('0x78'),_0x1e89('0x79')],'required':![]},{'model':db[_0x1e89('0x7a')],'as':'Tags','attributes':['id',_0x1e89('0x45'),_0x1e89('0x7b')],'where':_0x508b91[_0x1e89('0x46')][_0x1e89('0x7c')]?{'id':_0x508b91[_0x1e89('0x46')]['tag']}:undefined,'required':_0x508b91['query'][_0x1e89('0x7c')]?!![]:![]}];}return db[_0x1e89('0x73')][_0x1e89('0x59')](_0x597c95);})[_0x1e89('0x20')](function(_0x4c4f04){_0x218992[_0x1e89('0x5a')]=_0x4c4f04;return _0x218992;});}})[_0x1e89('0x20')](respondWithFilteredResult(_0x513cdd,_0x597c95))[_0x1e89('0x5b')](handleError(_0x513cdd,null));};exports[_0x1e89('0x7d')]=function(_0x3db752,_0x4e248e){var _0x3c2527=_0x3db752[_0x1e89('0x5c')]['id'];var _0x288360=_0x3db752[_0x1e89('0x5f')];var _0x4eb285=0xc8;var _0x3c1b29=null;return db[_0x1e89('0x7e')]['transaction']({'isolationLevel':db['sequelize'][_0x1e89('0x7f')][_0x1e89('0x80')][_0x1e89('0x81')]},function(_0x3fdc4e){return db['FaxAccount'][_0x1e89('0x6d')]({'where':{'id':_0x3c2527},'transaction':_0x3fdc4e})['then'](function(_0x178f48){if(_0x178f48){return db[_0x1e89('0x82')][_0x1e89('0x37')]({'where':{'FaxAccountId':_0x3c2527},'transaction':_0x3fdc4e})['then'](function(){var _0x248daf=_[_0x1e89('0x3e')](_0x288360,function(_0x3caa4e){_0x3caa4e['FaxAccountId']=_0x3c2527;return _0x3caa4e;});return db['FaxApplication'][_0x1e89('0x83')](_0x248daf,{'transaction':_0x3fdc4e});});}else{_0x4eb285=0x194;_0x3c1b29=[];}});})[_0x1e89('0x20')](function(){if(_0x4eb285!==0x194){return db[_0x1e89('0x82')][_0x1e89('0x84')]({'where':{'FaxAccountId':_0x3c2527},'order':_0x1e89('0x85')})[_0x1e89('0x20')](function(_0x1b134c){_0x3c1b29=_0x1b134c;});}})[_0x1e89('0x5b')](function(_0x290401){_0x4eb285=0x1f4;logger[_0x1e89('0x26')](_0x290401[_0x1e89('0x3a')]);if(_0x290401[_0x1e89('0x45')]){delete _0x290401[_0x1e89('0x45')];}_0x3c1b29=_0x290401;})[_0x1e89('0x86')](function(){if(_0x3c1b29===null){_0x4e248e[_0x1e89('0x2b')](_0x4eb285);}else{if(_0x4eb285===0x1f4){_0x4e248e['status'](_0x4eb285)[_0x1e89('0x87')](_0x3c1b29);}else{_0x4e248e['status'](_0x4eb285)['json'](_0x3c1b29);}}});};exports['getApplications']=function(_0xd4b38e,_0x134979,_0x3eb4b3){var _0x2f5310={};var _0x13c3b4={};var _0xd9489d;var _0x16751b;return db[_0x1e89('0x3f')][_0x1e89('0x6d')]({'where':{'id':_0xd4b38e[_0x1e89('0x5c')]['id']}})[_0x1e89('0x20')](handleEntityNotFound(_0x134979,null))[_0x1e89('0x20')](function(_0x15318e){if(_0x15318e){_0xd9489d=_0x15318e;_0x13c3b4[_0x1e89('0x44')]=_['keys'](db[_0x1e89('0x82')]['rawAttributes']);_0x13c3b4['query']=_['keys'](_0xd4b38e[_0x1e89('0x46')]);_0x13c3b4[_0x1e89('0x48')]=_[_0x1e89('0x49')](_0x13c3b4[_0x1e89('0x44')],_0x13c3b4[_0x1e89('0x46')]);_0x2f5310[_0x1e89('0x4c')]=_['intersection'](_0x13c3b4[_0x1e89('0x44')],qs[_0x1e89('0x4a')](_0xd4b38e['query'][_0x1e89('0x4a')]));_0x2f5310[_0x1e89('0x4c')]=_0x2f5310['attributes']['length']?_0x2f5310[_0x1e89('0x4c')]:_0x13c3b4[_0x1e89('0x44')];_0x2f5310['order']=qs['sort'](_0xd4b38e[_0x1e89('0x46')]['sort']);_0x2f5310[_0x1e89('0x51')]=qs['filters'](_[_0x1e89('0x52')](_0xd4b38e[_0x1e89('0x46')],_0x13c3b4[_0x1e89('0x48')]));if(_0xd4b38e[_0x1e89('0x46')][_0x1e89('0x53')]){_0x2f5310[_0x1e89('0x51')]=_[_0x1e89('0x55')](_0x2f5310[_0x1e89('0x51')],{'$or':_[_0x1e89('0x3e')](_0x2f5310[_0x1e89('0x4c')],function(_0x59ab10){var _0x22dabc={};_0x22dabc[_0x59ab10]={'$like':'%'+_0xd4b38e['query'][_0x1e89('0x53')]+'%'};return _0x22dabc;})});}_0x2f5310=_[_0x1e89('0x55')]({},_0x2f5310,_0xd4b38e['options']);return _0xd9489d[_0x1e89('0x88')](_0x2f5310);}})['then'](function(_0x32c239){if(_0x32c239){_0x16751b=_0x32c239[_0x1e89('0x4b')];if(!_0xd4b38e['query'][_0x1e89('0x4d')](_0x1e89('0x4e'))){_0x2f5310['limit']=qs[_0x1e89('0x2f')](_0xd4b38e[_0x1e89('0x46')][_0x1e89('0x2f')]);_0x2f5310[_0x1e89('0x2e')]=qs[_0x1e89('0x2e')](_0xd4b38e[_0x1e89('0x46')][_0x1e89('0x2e')]);}return _0xd9489d[_0x1e89('0x88')](_0x2f5310);}})['then'](function(_0x31b56e){if(_0x31b56e){return _0x31b56e?{'count':_0x16751b,'rows':_0x31b56e}:null;}})['then'](respondWithResult(_0x134979,null))[_0x1e89('0x5b')](handleError(_0x134979,null));};function Extension(_0x159788,_0x180d1c,_0x38f3e1,_0x2f0273){this[_0x1e89('0x89')]='from-voip-provider';this[_0x1e89('0x8a')]=_0x159788['localstationid'];this[_0x1e89('0x8b')]=_0x2f0273;this[_0x1e89('0x42')]=_0x1e89('0x8c');this[_0x1e89('0x8d')]=_0x1e89('0x8e');this[_0x1e89('0x6a')]=_0x159788['id'];this[_0x1e89('0x85')]=_0x180d1c;this[_0x1e89('0x8f')]=_0x38f3e1;}function createExtensionsReciveFax(_0x185eef){var _0x2c4b37=0x1;var _0x3dd22b=[];_0x3dd22b[_0x1e89('0x90')](new Extension(_0x185eef,_0x2c4b37,'',_0x1e89('0x91')));_0x2c4b37+=0x1;_0x3dd22b[_0x1e89('0x90')](new Extension(_0x185eef,_0x2c4b37,_0x1e89('0x92'),_0x1e89('0x93')));_0x2c4b37+=0x1;for(var _0x24ac07 in _0x185eef){if(_0x185eef[_0x1e89('0x4d')](_0x24ac07)&&(_0x24ac07===_0x1e89('0x94')||_0x24ac07===_0x1e89('0x95')||_0x24ac07===_0x1e89('0x96')||_0x24ac07===_0x1e89('0x97')||_0x24ac07===_0x1e89('0x98')||_0x24ac07===_0x1e89('0x99')||_0x24ac07==='minrate'||_0x24ac07===_0x1e89('0x9a')||_0x24ac07==='t38timeout')){_0x3dd22b['push'](new Extension(_0x185eef,_0x2c4b37,_0x1e89('0x9b')+_0x24ac07+')='+_0x185eef[_0x24ac07],'Set'));_0x2c4b37+=0x1;}}_0x3dd22b[_0x1e89('0x90')](new Extension(_0x185eef,_0x2c4b37,'6','Wait'));_0x2c4b37+=0x1;_0x3dd22b[_0x1e89('0x90')](new Extension(_0x185eef,_0x2c4b37,_0x1e89('0x9c'),_0x1e89('0x9d')));_0x2c4b37=0x0;return _0x3dd22b;}exports['addAccountApplications']=function(_0x5e214c,_0x419bdf,_0x1ab179){var _0x678f6e;return db[_0x1e89('0x7e')]['transaction'](function(_0x4a8457){return db[_0x1e89('0x3f')][_0x1e89('0x5e')](_0x5e214c[_0x1e89('0x5f')],{'transaction':_0x4a8457})[_0x1e89('0x20')](function(_0x44b5e0){_0x678f6e=_0x44b5e0[_0x1e89('0x38')]({'plain':!![]});return db[_0x1e89('0x9e')]['bulkCreate'](createExtensionsReciveFax(_0x678f6e),{'transaction':_0x4a8457});});})[_0x1e89('0x20')](function(){return _0x678f6e;})[_0x1e89('0x20')](respondWithResult(_0x419bdf,null))['catch'](handleError(_0x419bdf,null));};exports[_0x1e89('0x9f')]=function(_0x1771e6,_0x28f98b,_0x265e62){var _0x42f34c;return db['sequelize'][_0x1e89('0xa0')](function(_0x1fdb53){return db[_0x1e89('0x3f')]['update'](_0x1771e6[_0x1e89('0x5f')],{'where':{'id':_0x1771e6[_0x1e89('0x5f')]['id']},'transaction':_0x1fdb53})[_0x1e89('0x20')](function(_0x5e944b){return db['VoiceExtension'][_0x1e89('0x37')]({'where':{'FaxAccountId':_0x1771e6[_0x1e89('0x5f')]['id']},'transaction':_0x1fdb53})[_0x1e89('0x20')](function(_0x2924b1){return db[_0x1e89('0x9e')][_0x1e89('0x83')](createExtensionsReciveFax(_[_0x1e89('0xa1')](_0x1771e6[_0x1e89('0x5f')],[_0x1e89('0xa2'),_0x1e89('0x43'),_0x1e89('0xa3'),'updatedAt','TrunkId',_0x1e89('0xa4')])),{'transaction':_0x1fdb53});});});})[_0x1e89('0x20')](function(){return db[_0x1e89('0x3f')][_0x1e89('0xa5')](_0x1771e6[_0x1e89('0x5f')]['id']);})[_0x1e89('0x20')](respondWithResult(_0x28f98b,null))[_0x1e89('0x5b')](handleError(_0x28f98b,null));};exports[_0x1e89('0xa6')]=function(_0x1b14b3,_0x373bce,_0x670a77){var _0x31fb62={'raw':!![],'where':{}};var _0x196bd9={};var _0x1d53c6={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1e89('0x6d')]({'where':{'id':_0x1b14b3[_0x1e89('0x5c')]['id']}})[_0x1e89('0x20')](handleEntityNotFound(_0x373bce,null))['then'](function(_0x599862){if(_0x599862){_0x196bd9[_0x1e89('0x44')]=_[_0x1e89('0x47')](db[_0x1e89('0xa7')][_0x1e89('0x40')]);_0x196bd9['query']=_[_0x1e89('0x47')](_0x1b14b3[_0x1e89('0x46')]);_0x196bd9['filters']=_['intersection'](_0x196bd9[_0x1e89('0x44')],_0x196bd9['query']);_0x31fb62['attributes']=_['intersection'](_0x196bd9[_0x1e89('0x44')],qs[_0x1e89('0x4a')](_0x1b14b3['query'][_0x1e89('0x4a')]));_0x31fb62[_0x1e89('0x4c')]=_0x31fb62[_0x1e89('0x4c')][_0x1e89('0x4b')]?_0x31fb62[_0x1e89('0x4c')]:_0x196bd9[_0x1e89('0x44')];if(!_0x1b14b3[_0x1e89('0x46')]['hasOwnProperty'](_0x1e89('0x4e'))){_0x31fb62['limit']=qs['limit'](_0x1b14b3[_0x1e89('0x46')][_0x1e89('0x2f')]);_0x31fb62[_0x1e89('0x2e')]=qs[_0x1e89('0x2e')](_0x1b14b3[_0x1e89('0x46')][_0x1e89('0x2e')]);}_0x31fb62[_0x1e89('0x4f')]=qs[_0x1e89('0x50')](_0x1b14b3[_0x1e89('0x46')][_0x1e89('0x50')]);_0x31fb62['where']=qs[_0x1e89('0x48')](_[_0x1e89('0x52')](_0x1b14b3[_0x1e89('0x46')],_0x196bd9[_0x1e89('0x48')]));_0x31fb62['where'][_0x1e89('0x6a')]=_0x599862['id'];if(_0x1b14b3['query'][_0x1e89('0x53')]){_0x31fb62[_0x1e89('0x51')]=_[_0x1e89('0x55')](_0x31fb62[_0x1e89('0x51')],{'$or':_[_0x1e89('0x3e')](_0x31fb62[_0x1e89('0x4c')],function(_0x46a65d){var _0x730fb8={};_0x730fb8[_0x46a65d]={'$like':'%'+_0x1b14b3[_0x1e89('0x46')][_0x1e89('0x53')]+'%'};return _0x730fb8;})});}if(_0x1b14b3['query']['$gte']){var _0x5502c8=_0x1b14b3[_0x1e89('0x46')][_0x1e89('0xa8')][_0x1e89('0xa9')](',');var _0x1a461b={};_0x1a461b[_0x5502c8[0x0]]={'$gte':moment(_0x5502c8[0x1])[_0x1e89('0xaa')](_0x1e89('0xab'))};_0x31fb62['where']=_[_0x1e89('0x55')](_0x31fb62['where'],_0x1a461b);}_0x31fb62=_['merge']({},_0x31fb62,_0x1b14b3['options']);return db[_0x1e89('0xa7')]['count']({'where':_0x31fb62[_0x1e89('0x51')]})[_0x1e89('0x20')](function(_0x4f7063){_0x1d53c6[_0x1e89('0x31')]=_0x4f7063;if(_0x1b14b3[_0x1e89('0x46')][_0x1e89('0x57')]){_0x31fb62[_0x1e89('0x58')]=[{'all':!![]}];}return db[_0x1e89('0xa7')]['findAll'](_0x31fb62);})[_0x1e89('0x20')](function(_0x5887b8){_0x1d53c6[_0x1e89('0x5a')]=_0x5887b8;return _0x1d53c6;});}})[_0x1e89('0x20')](respondWithFilteredResult(_0x373bce,_0x31fb62))[_0x1e89('0x5b')](handleError(_0x373bce,null));};exports[_0x1e89('0x87')]=function(_0xa4369f,_0x29fc3b,_0x46ef68){var _0x5a3387,_0x385c55={},_0x4fd9bf;if(_0xa4369f[_0x1e89('0x5f')]['to']){_0x4fd9bf=_0xa4369f['body']['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0xa4369f['params']['id']},'include':[{'model':db[_0x1e89('0xac')],'as':_0x1e89('0xad'),'include':[{'model':db[_0x1e89('0x76')],'as':_0x1e89('0xae'),'where':{'fax':_0x4fd9bf},'limit':0x1,'order':[['updatedAt',_0x1e89('0xaf')]]}]}]})[_0x1e89('0x20')](handleEntityNotFound(_0x29fc3b,null))[_0x1e89('0x20')](function(_0x4791ab){_0x5a3387=_0x4791ab;if(_0xa4369f[_0x1e89('0x5f')][_0x1e89('0xb0')]&&_0xa4369f['body'][_0x1e89('0xb0')][_0x1e89('0x4b')]){for(var _0x4ba5b3=0x0;_0x4ba5b3<_0xa4369f[_0x1e89('0x5f')][_0x1e89('0xb0')][_0x1e89('0x4b')];_0x4ba5b3+=0x1){_0xa4369f[_0x1e89('0x5f')][_0x1e89('0xb0')][_0x4ba5b3]={'filename':_0xa4369f['body'][_0x1e89('0xb0')][_0x4ba5b3][_0x1e89('0x45')],'id':_0xa4369f[_0x1e89('0x5f')][_0x1e89('0xb0')][_0x4ba5b3]['id'],'path':path[_0x1e89('0xb1')](config[_0x1e89('0xb2')],_0x1e89('0xb3'),_0xa4369f['body'][_0x1e89('0xb0')][_0x4ba5b3]['basename'])};}}return respondWithRpcPromise(_0x1e89('0xb4'),_0x1e89('0xb4'),{'FaxAccountId':_[_0x1e89('0xb5')](_0xa4369f[_0x1e89('0x5c')]['id'])?undefined:_0xa4369f[_0x1e89('0x5c')]['id'],'path':_[_0x1e89('0xb5')](_0xa4369f[_0x1e89('0x5f')][_0x1e89('0xb0')][0x0]['path'])?undefined:_0xa4369f['body'][_0x1e89('0xb0')][0x0]['path'],'fax':_[_0x1e89('0xb5')](_0xa4369f[_0x1e89('0x5f')]['to'][0x0])?undefined:_0xa4369f[_0x1e89('0x5f')]['to'][0x0]},client9002);})[_0x1e89('0x20')](function(){if(_0x5a3387){if(_[_0x1e89('0xb5')](_0xa4369f['body'][_0x1e89('0xb6')])){_0xa4369f[_0x1e89('0x5f')]['from']=util[_0x1e89('0xaa')](_0x1e89('0xb7'),_0x5a3387[_0x1e89('0x45')],_0x5a3387['fax']);}if(_0x5a3387[_0x1e89('0xad')]){if(_0x5a3387[_0x1e89('0xad')][_0x1e89('0xae')]['length']){return _0x5a3387[_0x1e89('0xad')][_0x1e89('0xae')][0x0];}else{return db[_0x1e89('0x76')][_0x1e89('0x5e')](_[_0x1e89('0xb8')](_0xa4369f[_0x1e89('0x5f')],{'firstName':_0xa4369f[_0x1e89('0x5f')]['to'][0x0],'phone':_0xa4369f[_0x1e89('0x5f')]['to'][0x0],'fax':_0xa4369f[_0x1e89('0x5f')]['to'][0x0],'ListId':_0x5a3387[_0x1e89('0xa4')]}));}}else{throw new Error(_0x1e89('0xb9'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x1e89('0x20')](function(_0x266870){if(_0x266870){return db[_0x1e89('0x73')][_0x1e89('0x5d')]({'where':{'ContactId':_0x266870['id'],'closed':![],'FaxAccountId':_0x5a3387['id']}})[_0x1e89('0x20')](function(_0x48967a){if(_0x48967a){return[_0x48967a,![]];}return db[_0x1e89('0x73')]['create']({'UserId':_0xa4369f[_0x1e89('0x60')]['id'],'ContactId':_0x266870['id'],'FaxAccountId':_0x5a3387['id'],'fax':_0xa4369f[_0x1e89('0x5f')]['to'][0x0],'firstMsgDirection':_0x1e89('0xba'),'Messages':[_['merge'](_0xa4369f['body'],{'read':![],'body':_0xa4369f['body'][_0x1e89('0xb0')][0x0][_0x1e89('0xbb')],'FaxAccountId':_0x5a3387['id'],'UserId':_0xa4369f[_0x1e89('0x60')]['id'],'ContactId':_0x266870['id'],'AttachmentId':_0xa4369f[_0x1e89('0x5f')][_0x1e89('0xb0')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x1e89('0xbc')}]})[_0x1e89('0x20')](function(_0x24bf28){return[_0x24bf28,!![]];});});}else{throw new Error(_0x1e89('0xbd'));}})[_0x1e89('0xbe')](function(_0x395e40,_0x528c2c){if(_0x528c2c){return _0x395e40;}return db[_0x1e89('0xa7')][_0x1e89('0x5e')]({'direction':_0x1e89('0xba'),'read':![],'body':_0xa4369f['body'][_0x1e89('0xb0')][0x0][_0x1e89('0xbb')],'FaxAccountId':_0x5a3387['id'],'FaxInteractionId':_0x395e40['id'],'UserId':_0xa4369f[_0x1e89('0x60')]['id'],'ContactId':_0x395e40[_0x1e89('0xbf')],'AttachmentId':_0xa4369f[_0x1e89('0x5f')][_0x1e89('0xb0')][0x0]['id']})['then'](function(_0x241f48){_0x395e40[_0x1e89('0xc0')]['Messages']=[];_0x395e40[_0x1e89('0xc0')][_0x1e89('0xbc')][_0x1e89('0x90')](_0x241f48[_0x1e89('0xc0')]);return _0x395e40;});})['then'](function(_0x2efef7){respondWithRpcPromise(_0x1e89('0xc1'),'SendFax',{'FaxAccountId':_[_0x1e89('0xb5')](_0xa4369f[_0x1e89('0x5c')]['id'])?undefined:_0xa4369f[_0x1e89('0x5c')]['id'],'path':_[_0x1e89('0xb5')](_0xa4369f[_0x1e89('0x5f')][_0x1e89('0xb0')][0x0][_0x1e89('0xc2')])?undefined:_0xa4369f[_0x1e89('0x5f')][_0x1e89('0xb0')][0x0][_0x1e89('0xc2')],'fax':_[_0x1e89('0xb5')](_0xa4369f[_0x1e89('0x5f')]['to'][0x0])?undefined:_0xa4369f[_0x1e89('0x5f')]['to'][0x0],'AttachmentId':_0xa4369f['body'][_0x1e89('0xb0')][0x0]['id']},client9002)[_0x1e89('0x20')](function(_0xb017c1){logger[_0x1e89('0x29')](_0x1e89('0xc3'),_0xb017c1);})[_0x1e89('0x5b')](function(_0x4c3bab){logger['info'](_0x1e89('0xc3'),_0x4c3bab);});return _0x2efef7;})[_0x1e89('0x20')](respondWithResult(_0x29fc3b,null))[_0x1e89('0x5b')](handleError(_0x29fc3b,null));};exports[_0x1e89('0xc4')]=function(_0x3e8ee9,_0x331b13,_0x540d60){return db[_0x1e89('0x3f')][_0x1e89('0x5d')]({'where':{'id':_0x3e8ee9[_0x1e89('0x5c')]['id']}})['then'](handleEntityNotFound(_0x331b13,null))['then'](function(_0x183961){if(_0x183961){return _0x183961['addAgents'](_0x3e8ee9[_0x1e89('0x5f')][_0x1e89('0x6f')],_[_0x1e89('0xa1')](_0x3e8ee9[_0x1e89('0x5f')],[_0x1e89('0x6f'),'id'])||{})[_0x1e89('0xbe')](function(_0x4b6467){for(var _0x12e797=0x0;_0x12e797<_0x3e8ee9[_0x1e89('0x5f')][_0x1e89('0x6f')][_0x1e89('0x4b')];_0x12e797+=0x1){socket[_0x1e89('0xc5')](_0x1e89('0xc6'),{'UserId':Number(_0x3e8ee9['body'][_0x1e89('0x6f')][_0x12e797]),'FaxAccountId':Number(_0x3e8ee9['params']['id'])});}return _0x4b6467;});}})[_0x1e89('0x20')](respondWithResult(_0x331b13,null))[_0x1e89('0x5b')](handleError(_0x331b13,null));};exports[_0x1e89('0xc7')]=function(_0x3ba758,_0x279ed5,_0x59366c){return db[_0x1e89('0x3f')]['find']({'where':{'id':_0x3ba758[_0x1e89('0x5c')]['id']}})['then'](handleEntityNotFound(_0x279ed5,null))[_0x1e89('0x20')](function(_0x1f0097){if(_0x1f0097){return _0x1f0097['removeAgents'](_0x3ba758[_0x1e89('0x46')][_0x1e89('0x6f')])['then'](function(){if(_['isArray'](_0x3ba758[_0x1e89('0x46')][_0x1e89('0x6f')])){for(var _0x3d5222=0x0;_0x3d5222<_0x3ba758['query'][_0x1e89('0x6f')][_0x1e89('0x4b')];_0x3d5222+=0x1){socket[_0x1e89('0xc5')](_0x1e89('0xc8'),{'UserId':Number(_0x3ba758[_0x1e89('0x46')]['ids'][_0x3d5222]),'FaxAccountId':Number(_0x3ba758[_0x1e89('0x5c')]['id'])});}}else{socket[_0x1e89('0xc5')](_0x1e89('0xc8'),{'UserId':Number(_0x3ba758[_0x1e89('0x46')][_0x1e89('0x6f')]),'FaxAccountId':Number(_0x3ba758[_0x1e89('0x5c')]['id'])});}});}})[_0x1e89('0x20')](respondWithStatusCode(_0x279ed5,null))[_0x1e89('0x5b')](handleError(_0x279ed5,null));};exports[_0x1e89('0xc9')]=function(_0x459240,_0x3876e0,_0x278237){var _0x319c21={};var _0x4fb169={};var _0x17fddd;var _0xb2c409;return db[_0x1e89('0x3f')][_0x1e89('0x6d')]({'where':{'id':_0x459240[_0x1e89('0x5c')]['id']}})[_0x1e89('0x20')](handleEntityNotFound(_0x3876e0,null))[_0x1e89('0x20')](function(_0x41f110){if(_0x41f110){_0x17fddd=_0x41f110;_0x4fb169['model']=_[_0x1e89('0x47')](db['User']['rawAttributes']);_0x4fb169['query']=_[_0x1e89('0x47')](_0x459240[_0x1e89('0x46')]);_0x4fb169[_0x1e89('0x48')]=_['intersection'](_0x4fb169[_0x1e89('0x44')],_0x4fb169[_0x1e89('0x46')]);_0x319c21['attributes']=_[_0x1e89('0x49')](_0x4fb169[_0x1e89('0x44')],qs[_0x1e89('0x4a')](_0x459240[_0x1e89('0x46')][_0x1e89('0x4a')]));_0x319c21[_0x1e89('0x4c')]=_0x319c21[_0x1e89('0x4c')][_0x1e89('0x4b')]?_0x319c21[_0x1e89('0x4c')]:_0x4fb169[_0x1e89('0x44')];_0x319c21[_0x1e89('0x4f')]=qs[_0x1e89('0x50')](_0x459240[_0x1e89('0x46')]['sort']);_0x319c21[_0x1e89('0x51')]=qs[_0x1e89('0x48')](_[_0x1e89('0x52')](_0x459240[_0x1e89('0x46')],_0x4fb169[_0x1e89('0x48')]));if(_0x459240[_0x1e89('0x46')][_0x1e89('0x53')]){_0x319c21[_0x1e89('0x51')]=_[_0x1e89('0x55')](_0x319c21[_0x1e89('0x51')],{'$or':_[_0x1e89('0x3e')](_0x319c21[_0x1e89('0x4c')],function(_0x41054c){var _0x113e05={};_0x113e05[_0x41054c]={'$like':'%'+_0x459240[_0x1e89('0x46')][_0x1e89('0x53')]+'%'};return _0x113e05;})});}_0x319c21=_[_0x1e89('0x55')]({},_0x319c21,_0x459240[_0x1e89('0x56')]);return _0x17fddd[_0x1e89('0xc9')](_0x319c21);}})[_0x1e89('0x20')](function(_0x8d8c4a){if(_0x8d8c4a){_0xb2c409=_0x8d8c4a[_0x1e89('0x4b')];if(!_0x459240[_0x1e89('0x46')][_0x1e89('0x4d')](_0x1e89('0x4e'))){_0x319c21['limit']=qs['limit'](_0x459240[_0x1e89('0x46')][_0x1e89('0x2f')]);_0x319c21['offset']=qs['offset'](_0x459240[_0x1e89('0x46')]['offset']);}return _0x17fddd[_0x1e89('0xc9')](_0x319c21);}})[_0x1e89('0x20')](function(_0x540b7b){if(_0x540b7b){return _0x540b7b?{'count':_0xb2c409,'rows':_0x540b7b}:null;}})[_0x1e89('0x20')](respondWithResult(_0x3876e0,null))[_0x1e89('0x5b')](handleError(_0x3876e0,null));}; \ No newline at end of file +var _0xdf45=['info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','count','limit','set','Content-Range','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','map','FaxAccount','rawAttributes','fieldName','type','model','keys','query','fields','attributes','length','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','findAll','rows','show','Pause','intersection','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','mandatoryDispositionPause','describe','FaxAccountId','Disposition','getDispositions','findOne','nolimit','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','gateway','modem','t38timeout','FAXOPT(','Set','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','key','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','CmList','List','CmContact','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','ContactId','Messages','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then'];(function(_0x17dd0d,_0x377249){var _0x56a7c2=function(_0x464255){while(--_0x464255){_0x17dd0d['push'](_0x17dd0d['shift']());}};_0x56a7c2(++_0x377249);}(_0xdf45,0x16d));var _0x5df4=function(_0x197767,_0x400276){_0x197767=_0x197767-0x0;var _0x5422c6=_0xdf45[_0x197767];return _0x5422c6;};'use strict';var emlformat=require(_0x5df4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5df4('0x1'));var jsonpatch=require(_0x5df4('0x2'));var rp=require(_0x5df4('0x3'));var moment=require(_0x5df4('0x4'));var BPromise=require(_0x5df4('0x5'));var Mustache=require(_0x5df4('0x6'));var util=require(_0x5df4('0x7'));var path=require(_0x5df4('0x8'));var sox=require(_0x5df4('0x9'));var csv=require(_0x5df4('0xa'));var ejs=require(_0x5df4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5df4('0xc'));var deskjs=require(_0x5df4('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5df4('0xe'));var Redis=require('ioredis');var authService=require(_0x5df4('0xf'));var qs=require(_0x5df4('0x10'));var as=require(_0x5df4('0x11'));var hardwareService=require(_0x5df4('0x12'));var logger=require(_0x5df4('0x13'))(_0x5df4('0x14'));var utils=require('../../config/utils');var config=require(_0x5df4('0x15'));var licenseUtil=require(_0x5df4('0x16'));var db=require(_0x5df4('0x17'))['db'];config[_0x5df4('0x18')]=_[_0x5df4('0x19')](config[_0x5df4('0x18')],{'host':_0x5df4('0x1a'),'port':0x18eb});var socket=require(_0x5df4('0x1b'))(new Redis(config[_0x5df4('0x18')]));require(_0x5df4('0x1c'))[_0x5df4('0x1d')](socket);var jayson=require(_0x5df4('0x1e'));var client=jayson[_0x5df4('0x1f')][_0x5df4('0x20')]({'port':0x232c});var client9002=jayson[_0x5df4('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2790e0,_0xc60eaa,_0x279919,_0x365619){return new BPromise(function(_0x2927c7,_0x288c25){var _0x2bb170=_0x365619||client;return _0x2bb170[_0x5df4('0x21')](_0x2790e0,_0x279919)[_0x5df4('0x22')](function(_0x48b56d){logger[_0x5df4('0x23')](_0x5df4('0x24'),_0xc60eaa,_0x5df4('0x25'));logger[_0x5df4('0x26')](_0x5df4('0x27'),_0xc60eaa,'request\x20sent',JSON[_0x5df4('0x28')](_0x48b56d));if(_0x48b56d[_0x5df4('0x29')]){if(_0x48b56d[_0x5df4('0x29')][_0x5df4('0x2a')]===0x1f4){logger['error'](_0x5df4('0x24'),_0xc60eaa,_0x48b56d[_0x5df4('0x29')][_0x5df4('0x2b')]);return _0x288c25(_0x48b56d[_0x5df4('0x29')]['message']);}logger['error'](_0x5df4('0x24'),_0xc60eaa,_0x48b56d[_0x5df4('0x29')][_0x5df4('0x2b')]);return _0x2927c7(_0x48b56d[_0x5df4('0x29')][_0x5df4('0x2b')]);}else{logger[_0x5df4('0x23')](_0x5df4('0x24'),_0xc60eaa,'request\x20sent');_0x2927c7(_0x48b56d['result']['message']);}})[_0x5df4('0x2c')](function(_0x39ca4c){logger[_0x5df4('0x29')]('FaxAccount,\x20%s,\x20%s',_0xc60eaa,_0x39ca4c);_0x288c25(_0x39ca4c);});});}function respondWithStatusCode(_0x45d9dc,_0x528d75){_0x528d75=_0x528d75||0xcc;return function(_0x2ed344){if(_0x2ed344){return _0x45d9dc[_0x5df4('0x2d')](_0x528d75);}return _0x45d9dc[_0x5df4('0x2e')](_0x528d75)[_0x5df4('0x2f')]();};}function respondWithResult(_0x206b88,_0xa3a3cc){_0xa3a3cc=_0xa3a3cc||0xc8;return function(_0x1db033){if(_0x1db033){return _0x206b88['status'](_0xa3a3cc)[_0x5df4('0x30')](_0x1db033);}};}function respondWithFilteredResult(_0x48cca7,_0x49b715){return function(_0x4b59ce){if(_0x4b59ce){var _0x5828df=typeof _0x49b715[_0x5df4('0x31')]==='undefined'&&typeof _0x49b715['limit']==='undefined';var _0x184170=_0x4b59ce['count'];var _0x27566e=_0x5828df?0x0:_0x49b715[_0x5df4('0x31')];var _0x46c357=_0x5828df?_0x4b59ce[_0x5df4('0x32')]:_0x49b715[_0x5df4('0x31')]+_0x49b715[_0x5df4('0x33')];var _0x157a3d;if(_0x46c357>=_0x184170){_0x46c357=_0x184170;_0x157a3d=0xc8;}else{_0x157a3d=0xce;}_0x48cca7[_0x5df4('0x2e')](_0x157a3d);return _0x48cca7[_0x5df4('0x34')](_0x5df4('0x35'),_0x27566e+'-'+_0x46c357+'/'+_0x184170)[_0x5df4('0x30')](_0x4b59ce);}return null;};}function patchUpdates(_0x5c33e7){return function(_0x19c24d){try{jsonpatch['apply'](_0x19c24d,_0x5c33e7,!![]);}catch(_0x53cff0){return BPromise[_0x5df4('0x36')](_0x53cff0);}return _0x19c24d[_0x5df4('0x37')]();};}function saveUpdates(_0x41bebc,_0x3d23e4){return function(_0x28f51e){if(_0x28f51e){return _0x28f51e[_0x5df4('0x38')](_0x41bebc)[_0x5df4('0x22')](function(_0x28b6e1){return _0x28b6e1;});}return null;};}function removeEntity(_0x1fa6d8,_0x16334c){return function(_0x46701e){if(_0x46701e){return _0x46701e[_0x5df4('0x39')]()[_0x5df4('0x22')](function(){var _0x5598de=_0x46701e[_0x5df4('0x3a')]({'plain':!![]});var _0x5776b6=_0x5df4('0x3b');return db[_0x5df4('0x3c')]['destroy']({'where':{'type':_0x5776b6,'resourceId':_0x5598de['id']}})['then'](function(){return _0x46701e;});})['then'](function(){_0x1fa6d8['status'](0xcc)[_0x5df4('0x2f')]();});}};}function handleEntityNotFound(_0x230057,_0x2f75c7){return function(_0xc434cd){if(!_0xc434cd){_0x230057[_0x5df4('0x2d')](0x194);}return _0xc434cd;};}function handleError(_0x30f304,_0x166b81){_0x166b81=_0x166b81||0x1f4;return function(_0x48dd37){logger[_0x5df4('0x29')](_0x48dd37[_0x5df4('0x3d')]);if(_0x48dd37[_0x5df4('0x3e')]){delete _0x48dd37[_0x5df4('0x3e')];}_0x30f304[_0x5df4('0x2e')](_0x166b81)[_0x5df4('0x3f')](_0x48dd37);};}exports[_0x5df4('0x40')]=function(_0x434f05,_0x14b7cb){var _0xa461b6={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2ccb76={},_0x1737a7={'count':0x0,'rows':[]};var _0x58ba5f=_[_0x5df4('0x41')](db[_0x5df4('0x42')][_0x5df4('0x43')],function(_0x1079d5){return{'name':_0x1079d5[_0x5df4('0x44')],'type':_0x1079d5[_0x5df4('0x45')]['key']};});_0x2ccb76[_0x5df4('0x46')]=_['map'](_0x58ba5f,_0x5df4('0x3e'));_0x2ccb76['query']=_[_0x5df4('0x47')](_0x434f05[_0x5df4('0x48')]);_0x2ccb76['filters']=_['intersection'](_0x2ccb76[_0x5df4('0x46')],_0x2ccb76['query']);_0xa461b6['attributes']=_['intersection'](_0x2ccb76[_0x5df4('0x46')],qs[_0x5df4('0x49')](_0x434f05['query'][_0x5df4('0x49')]));_0xa461b6[_0x5df4('0x4a')]=_0xa461b6[_0x5df4('0x4a')][_0x5df4('0x4b')]?_0xa461b6[_0x5df4('0x4a')]:_0x2ccb76[_0x5df4('0x46')];if(!_0x434f05[_0x5df4('0x48')]['hasOwnProperty']('nolimit')){_0xa461b6[_0x5df4('0x33')]=qs['limit'](_0x434f05[_0x5df4('0x48')][_0x5df4('0x33')]);_0xa461b6[_0x5df4('0x31')]=qs[_0x5df4('0x31')](_0x434f05[_0x5df4('0x48')][_0x5df4('0x31')]);}_0xa461b6[_0x5df4('0x4c')]=qs[_0x5df4('0x4d')](_0x434f05[_0x5df4('0x48')]['sort']);_0xa461b6[_0x5df4('0x4e')]=qs[_0x5df4('0x4f')](_[_0x5df4('0x50')](_0x434f05[_0x5df4('0x48')],_0x2ccb76[_0x5df4('0x4f')]),_0x58ba5f);if(_0x434f05[_0x5df4('0x48')]['filter']){_0xa461b6[_0x5df4('0x4e')]=_[_0x5df4('0x51')](_0xa461b6[_0x5df4('0x4e')],{'$or':_[_0x5df4('0x41')](_0x58ba5f,function(_0x42f8c0){if(_0x42f8c0['type']!==_0x5df4('0x52')){var _0x3cdad9={};_0x3cdad9[_0x42f8c0[_0x5df4('0x3e')]]={'$like':'%'+_0x434f05[_0x5df4('0x48')]['filter']+'%'};return _0x3cdad9;}})});}_0xa461b6=_['merge']({},_0xa461b6,_0x434f05[_0x5df4('0x53')]);var _0x5c518b={'where':_0xa461b6['where']};return db['FaxAccount'][_0x5df4('0x32')](_0x5c518b)[_0x5df4('0x22')](function(_0x44e46a){_0x1737a7['count']=_0x44e46a;if(_0x434f05[_0x5df4('0x48')][_0x5df4('0x54')]){_0xa461b6['include']=[{'all':!![]}];}return db[_0x5df4('0x42')][_0x5df4('0x55')](_0xa461b6);})[_0x5df4('0x22')](function(_0x830bc1){_0x1737a7[_0x5df4('0x56')]=_0x830bc1;return _0x1737a7;})[_0x5df4('0x22')](respondWithFilteredResult(_0x14b7cb,_0xa461b6))[_0x5df4('0x2c')](handleError(_0x14b7cb,null));};exports[_0x5df4('0x57')]=function(_0x4e592d,_0x275dab){var _0x5bee06={'raw':![],'where':{'id':_0x4e592d['params']['id']},'include':[{'model':db[_0x5df4('0x58')],'as':'mandatoryDispositionPause'}]},_0x504d3e={};_0x504d3e['model']=_['keys'](db[_0x5df4('0x42')][_0x5df4('0x43')]);_0x504d3e[_0x5df4('0x48')]=_[_0x5df4('0x47')](_0x4e592d[_0x5df4('0x48')]);_0x504d3e[_0x5df4('0x4f')]=_[_0x5df4('0x59')](_0x504d3e[_0x5df4('0x46')],_0x504d3e[_0x5df4('0x48')]);_0x5bee06[_0x5df4('0x4a')]=_[_0x5df4('0x59')](_0x504d3e[_0x5df4('0x46')],qs[_0x5df4('0x49')](_0x4e592d['query']['fields']));_0x5bee06[_0x5df4('0x4a')]=_0x5bee06[_0x5df4('0x4a')][_0x5df4('0x4b')]?_0x5bee06['attributes']:_0x504d3e['model'];if(_0x4e592d['query']['includeAll']){_0x5bee06[_0x5df4('0x5a')]=[{'all':!![]}];}_0x5bee06=_[_0x5df4('0x51')]({},_0x5bee06,_0x4e592d[_0x5df4('0x53')]);return db[_0x5df4('0x42')]['find'](_0x5bee06)[_0x5df4('0x22')](handleEntityNotFound(_0x275dab,null))[_0x5df4('0x22')](respondWithResult(_0x275dab,null))[_0x5df4('0x2c')](handleError(_0x275dab,null));};exports['create']=function(_0x58bae9,_0x312e1a){return db[_0x5df4('0x42')][_0x5df4('0x5b')](_0x58bae9[_0x5df4('0x5c')],{})[_0x5df4('0x22')](function(_0x2c5b3b){var _0x3049f5=_0x58bae9[_0x5df4('0x5d')][_0x5df4('0x3a')]({'plain':!![]});if(!_0x3049f5)throw new Error(_0x5df4('0x5e'));if(_0x3049f5[_0x5df4('0x5f')]===_0x5df4('0x5d')){var _0x58fdf8=_0x2c5b3b[_0x5df4('0x3a')]({'plain':!![]});var _0x20465c=_0x5df4('0x3b');return db[_0x5df4('0x60')][_0x5df4('0x61')]({'where':{'name':_0x20465c,'userProfileId':_0x3049f5[_0x5df4('0x62')]},'raw':!![]})[_0x5df4('0x22')](function(_0x1c45c6){if(_0x1c45c6&&_0x1c45c6[_0x5df4('0x63')]===0x0){return db[_0x5df4('0x3c')]['create']({'name':_0x58fdf8[_0x5df4('0x3e')],'resourceId':_0x58fdf8['id'],'type':_0x1c45c6[_0x5df4('0x3e')],'sectionId':_0x1c45c6['id']},{})[_0x5df4('0x22')](function(){return _0x2c5b3b;});}else{return _0x2c5b3b;}})[_0x5df4('0x2c')](function(_0x392e0b){logger[_0x5df4('0x29')](_0x5df4('0x64'),_0x392e0b);throw _0x392e0b;});}return _0x2c5b3b;})[_0x5df4('0x22')](respondWithResult(_0x312e1a,0xc9))[_0x5df4('0x2c')](handleError(_0x312e1a,null));};exports[_0x5df4('0x38')]=function(_0x349717,_0xfa65a3){if(_0x349717[_0x5df4('0x5c')]['id']){delete _0x349717[_0x5df4('0x5c')]['id'];}return db[_0x5df4('0x42')][_0x5df4('0x61')]({'where':{'id':_0x349717[_0x5df4('0x65')]['id']},'include':[{'model':db[_0x5df4('0x58')],'as':_0x5df4('0x66')}]})[_0x5df4('0x22')](handleEntityNotFound(_0xfa65a3,null))[_0x5df4('0x22')](saveUpdates(_0x349717[_0x5df4('0x5c')],null))[_0x5df4('0x22')](respondWithResult(_0xfa65a3,null))[_0x5df4('0x2c')](handleError(_0xfa65a3,null));};exports[_0x5df4('0x39')]=function(_0x35ea33,_0x584e7d){return db['FaxAccount'][_0x5df4('0x61')]({'where':{'id':_0x35ea33[_0x5df4('0x65')]['id']}})[_0x5df4('0x22')](handleEntityNotFound(_0x584e7d,null))[_0x5df4('0x22')](removeEntity(_0x584e7d,null))[_0x5df4('0x2c')](handleError(_0x584e7d,null));};exports[_0x5df4('0x67')]=function(_0x5199be,_0x14bcfe){return db[_0x5df4('0x42')][_0x5df4('0x67')]()[_0x5df4('0x22')](respondWithResult(_0x14bcfe,null))[_0x5df4('0x2c')](handleError(_0x14bcfe,null));};exports['addDisposition']=function(_0x328ce6,_0x1dda1,_0x4aee4b){if(_0x328ce6[_0x5df4('0x5c')]['id']){delete _0x328ce6[_0x5df4('0x5c')]['id'];}return db['FaxAccount'][_0x5df4('0x61')]({'where':{'id':_0x328ce6[_0x5df4('0x65')]['id']}})['then'](handleEntityNotFound(_0x1dda1,null))[_0x5df4('0x22')](function(_0x5191cf){if(_0x5191cf){_0x328ce6[_0x5df4('0x5c')][_0x5df4('0x68')]=_0x5191cf['id'];return db[_0x5df4('0x69')][_0x5df4('0x5b')](_0x328ce6[_0x5df4('0x5c')]);}})['then'](respondWithResult(_0x1dda1,null))[_0x5df4('0x2c')](handleError(_0x1dda1,null));};exports[_0x5df4('0x6a')]=function(_0x4f99c8,_0x141d1b,_0x4372a6){var _0x4cd9f2={'raw':![],'where':{}};var _0x4a4a33={};var _0x3cc113={'count':0x0,'rows':[]};return db[_0x5df4('0x42')][_0x5df4('0x6b')]({'where':{'id':_0x4f99c8[_0x5df4('0x65')]['id']}})[_0x5df4('0x22')](handleEntityNotFound(_0x141d1b,null))[_0x5df4('0x22')](function(_0x34f36b){if(_0x34f36b){_0x4a4a33[_0x5df4('0x46')]=_['keys'](db[_0x5df4('0x69')]['rawAttributes']);_0x4a4a33[_0x5df4('0x48')]=_[_0x5df4('0x47')](_0x4f99c8['query']);_0x4a4a33[_0x5df4('0x4f')]=_['intersection'](_0x4a4a33[_0x5df4('0x46')],_0x4a4a33[_0x5df4('0x48')]);_0x4cd9f2[_0x5df4('0x4a')]=_[_0x5df4('0x59')](_0x4a4a33[_0x5df4('0x46')],qs['fields'](_0x4f99c8[_0x5df4('0x48')][_0x5df4('0x49')]));_0x4cd9f2['attributes']=_0x4cd9f2[_0x5df4('0x4a')][_0x5df4('0x4b')]?_0x4cd9f2[_0x5df4('0x4a')]:_0x4a4a33[_0x5df4('0x46')];if(!_0x4f99c8[_0x5df4('0x48')]['hasOwnProperty'](_0x5df4('0x6c'))){_0x4cd9f2[_0x5df4('0x33')]=qs[_0x5df4('0x33')](_0x4f99c8['query']['limit']);_0x4cd9f2[_0x5df4('0x31')]=qs[_0x5df4('0x31')](_0x4f99c8['query']['offset']);}_0x4cd9f2[_0x5df4('0x4c')]=qs['sort'](_0x4f99c8['query']['sort']);_0x4cd9f2[_0x5df4('0x4e')]=qs[_0x5df4('0x4f')](_['pick'](_0x4f99c8[_0x5df4('0x48')],_0x4a4a33[_0x5df4('0x4f')]));_0x4cd9f2[_0x5df4('0x4e')][_0x5df4('0x68')]=_0x34f36b['id'];if(_0x4f99c8[_0x5df4('0x48')][_0x5df4('0x6d')]){_0x4cd9f2[_0x5df4('0x4e')]=_[_0x5df4('0x51')](_0x4cd9f2[_0x5df4('0x4e')],{'$or':_[_0x5df4('0x41')](_0x4cd9f2['attributes'],function(_0x12143e){var _0x1718a2={};_0x1718a2[_0x12143e]={'$like':'%'+_0x4f99c8[_0x5df4('0x48')][_0x5df4('0x6d')]+'%'};return _0x1718a2;})});}_0x4cd9f2=_[_0x5df4('0x51')]({},_0x4cd9f2,_0x4f99c8[_0x5df4('0x53')]);return db[_0x5df4('0x69')][_0x5df4('0x32')]({'where':_0x4cd9f2[_0x5df4('0x4e')]})[_0x5df4('0x22')](function(_0x3e29af){_0x3cc113[_0x5df4('0x32')]=_0x3e29af;if(_0x4f99c8['query'][_0x5df4('0x54')]){_0x4cd9f2[_0x5df4('0x5a')]=[{'all':!![]}];}return db[_0x5df4('0x69')][_0x5df4('0x55')](_0x4cd9f2);})[_0x5df4('0x22')](function(_0x4ba3ee){_0x3cc113[_0x5df4('0x56')]=_0x4ba3ee;return _0x3cc113;});}})['then'](respondWithFilteredResult(_0x141d1b,_0x4cd9f2))[_0x5df4('0x2c')](handleError(_0x141d1b,null));};exports[_0x5df4('0x6e')]=function(_0x100470,_0x550d21,_0x104c56){return db[_0x5df4('0x42')][_0x5df4('0x61')]({'where':{'id':_0x100470[_0x5df4('0x65')]['id']}})['then'](handleEntityNotFound(_0x550d21,null))[_0x5df4('0x22')](function(_0x427bdb){if(_0x427bdb){return _0x427bdb[_0x5df4('0x6e')](_0x100470['query'][_0x5df4('0x6f')]);}})['then'](respondWithStatusCode(_0x550d21,null))[_0x5df4('0x2c')](handleError(_0x550d21,null));};exports[_0x5df4('0x70')]=function(_0x35863d,_0x374a4c,_0x36e67c){if(_0x35863d['body']['id']){delete _0x35863d[_0x5df4('0x5c')]['id'];}return db[_0x5df4('0x42')][_0x5df4('0x61')]({'where':{'id':_0x35863d[_0x5df4('0x65')]['id']}})[_0x5df4('0x22')](handleEntityNotFound(_0x374a4c,null))[_0x5df4('0x22')](function(_0x42268d){if(_0x42268d){_0x35863d[_0x5df4('0x5c')][_0x5df4('0x68')]=_0x42268d['id'];return db[_0x5df4('0x71')][_0x5df4('0x5b')](_0x35863d['body']);}})[_0x5df4('0x22')](respondWithResult(_0x374a4c,null))[_0x5df4('0x2c')](handleError(_0x374a4c,null));};exports[_0x5df4('0x72')]=function(_0x25876b,_0x473c21,_0x276579){var _0x34e8a7={'raw':![],'where':{}};var _0x4eda6f={};var _0x4dec59={'count':0x0,'rows':[]};return db[_0x5df4('0x42')][_0x5df4('0x6b')]({'where':{'id':_0x25876b[_0x5df4('0x65')]['id']}})[_0x5df4('0x22')](handleEntityNotFound(_0x473c21,null))[_0x5df4('0x22')](function(_0x5bbe04){if(_0x5bbe04){_0x4eda6f['model']=_['keys'](db[_0x5df4('0x71')][_0x5df4('0x43')]);_0x4eda6f[_0x5df4('0x48')]=_[_0x5df4('0x47')](_0x25876b['query']);_0x4eda6f[_0x5df4('0x4f')]=_[_0x5df4('0x59')](_0x4eda6f[_0x5df4('0x46')],_0x4eda6f[_0x5df4('0x48')]);_0x34e8a7['attributes']=_[_0x5df4('0x59')](_0x4eda6f[_0x5df4('0x46')],qs['fields'](_0x25876b[_0x5df4('0x48')][_0x5df4('0x49')]));_0x34e8a7[_0x5df4('0x4a')]=_0x34e8a7[_0x5df4('0x4a')][_0x5df4('0x4b')]?_0x34e8a7[_0x5df4('0x4a')]:_0x4eda6f[_0x5df4('0x46')];if(!_0x25876b[_0x5df4('0x48')][_0x5df4('0x73')]('nolimit')){_0x34e8a7[_0x5df4('0x33')]=qs['limit'](_0x25876b[_0x5df4('0x48')][_0x5df4('0x33')]);_0x34e8a7[_0x5df4('0x31')]=qs['offset'](_0x25876b[_0x5df4('0x48')]['offset']);}_0x34e8a7[_0x5df4('0x4c')]=qs[_0x5df4('0x4d')](_0x25876b[_0x5df4('0x48')][_0x5df4('0x4d')]);_0x34e8a7[_0x5df4('0x4e')]=qs['filters'](_[_0x5df4('0x50')](_0x25876b[_0x5df4('0x48')],_0x4eda6f[_0x5df4('0x4f')]));_0x34e8a7[_0x5df4('0x4e')][_0x5df4('0x68')]=_0x5bbe04['id'];if(_0x25876b[_0x5df4('0x48')]['filter']){_0x34e8a7[_0x5df4('0x4e')]=_[_0x5df4('0x51')](_0x34e8a7[_0x5df4('0x4e')],{'$or':_[_0x5df4('0x41')](_0x34e8a7[_0x5df4('0x4a')],function(_0x4e6a1e){var _0x2bbe40={};_0x2bbe40[_0x4e6a1e]={'$like':'%'+_0x25876b[_0x5df4('0x48')][_0x5df4('0x6d')]+'%'};return _0x2bbe40;})});}_0x34e8a7=_['merge']({},_0x34e8a7,_0x25876b[_0x5df4('0x53')]);return db['CannedAnswer'][_0x5df4('0x32')]({'where':_0x34e8a7['where']})[_0x5df4('0x22')](function(_0x5e7b98){_0x4dec59[_0x5df4('0x32')]=_0x5e7b98;if(_0x25876b['query']['includeAll']){_0x34e8a7[_0x5df4('0x5a')]=[{'all':!![]}];}return db[_0x5df4('0x71')]['findAll'](_0x34e8a7);})[_0x5df4('0x22')](function(_0x42984e){_0x4dec59[_0x5df4('0x56')]=_0x42984e;return _0x4dec59;});}})[_0x5df4('0x22')](respondWithFilteredResult(_0x473c21,_0x34e8a7))[_0x5df4('0x2c')](handleError(_0x473c21,null));};exports['removeAnswers']=function(_0x185b6e,_0x45a4f9,_0x481465){return db[_0x5df4('0x42')][_0x5df4('0x61')]({'where':{'id':_0x185b6e[_0x5df4('0x65')]['id']}})['then'](handleEntityNotFound(_0x45a4f9,null))['then'](function(_0x145f0f){if(_0x145f0f){return _0x145f0f[_0x5df4('0x74')](_0x185b6e[_0x5df4('0x48')][_0x5df4('0x6f')]);}})[_0x5df4('0x22')](respondWithStatusCode(_0x45a4f9,null))[_0x5df4('0x2c')](handleError(_0x45a4f9,null));};exports['addInteraction']=function(_0x33bfd1,_0x407601,_0x4c412b){return db[_0x5df4('0x75')]['find']({'where':{'id':_0x33bfd1[_0x5df4('0x65')]['id']}})[_0x5df4('0x22')](handleEntityNotFound(_0x407601,null))[_0x5df4('0x22')](function(_0x37764d){if(_0x37764d){return _0x37764d[_0x5df4('0x76')](_0x33bfd1[_0x5df4('0x5c')][_0x5df4('0x6f')],_[_0x5df4('0x77')](_0x33bfd1[_0x5df4('0x5c')],[_0x5df4('0x6f'),'id'])||{});}})[_0x5df4('0x22')](respondWithResult(_0x407601,null))['catch'](handleError(_0x407601,null));};exports[_0x5df4('0x78')]=function(_0x1226e1,_0x35686b,_0x58965d){var _0x231654={'raw':![],'where':{}};var _0xf4303d={};var _0x445ab0={'count':0x0,'rows':[]};return db[_0x5df4('0x42')][_0x5df4('0x6b')]({'where':{'id':_0x1226e1['params']['id']}})['then'](handleEntityNotFound(_0x35686b,null))[_0x5df4('0x22')](function(_0xd677f2){if(_0xd677f2){_0xf4303d[_0x5df4('0x46')]=_[_0x5df4('0x47')](db['FaxInteraction']['rawAttributes']);_0xf4303d[_0x5df4('0x48')]=_[_0x5df4('0x47')](_0x1226e1[_0x5df4('0x48')]);_0xf4303d[_0x5df4('0x4f')]=_[_0x5df4('0x59')](_0xf4303d[_0x5df4('0x46')],_0xf4303d[_0x5df4('0x48')]);_0x231654[_0x5df4('0x4a')]=_[_0x5df4('0x59')](_0xf4303d[_0x5df4('0x46')],qs[_0x5df4('0x49')](_0x1226e1[_0x5df4('0x48')][_0x5df4('0x49')]));_0x231654[_0x5df4('0x4a')]=_0x231654[_0x5df4('0x4a')]['length']?_0x231654[_0x5df4('0x4a')]:_0xf4303d[_0x5df4('0x46')];if(!_0x1226e1[_0x5df4('0x48')]['hasOwnProperty'](_0x5df4('0x6c'))){_0x231654['limit']=qs['limit'](_0x1226e1[_0x5df4('0x48')][_0x5df4('0x33')]);_0x231654['offset']=qs[_0x5df4('0x31')](_0x1226e1['query'][_0x5df4('0x31')]);}_0x231654[_0x5df4('0x4c')]=qs['sort'](_0x1226e1['query'][_0x5df4('0x4d')]);_0x231654[_0x5df4('0x4e')]=qs['filters'](_['pick'](_0x1226e1[_0x5df4('0x48')],_0xf4303d[_0x5df4('0x4f')]));_0x231654['where'][_0x5df4('0x68')]=_0xd677f2['id'];if(_0x1226e1['query'][_0x5df4('0x6d')]){_0x231654[_0x5df4('0x4e')]=_['merge'](_0x231654[_0x5df4('0x4e')],{'$or':_['map'](_0x231654[_0x5df4('0x4a')],function(_0xa14f9d){var _0x51fffb={};_0x51fffb[_0xa14f9d]={'$like':'%'+_0x1226e1[_0x5df4('0x48')][_0x5df4('0x6d')]+'%'};return _0x51fffb;})});}_0x231654=_['merge']({},_0x231654,_0x1226e1['options']);return db[_0x5df4('0x75')]['count']({'where':_0x231654[_0x5df4('0x4e')]})[_0x5df4('0x22')](function(_0x3bc89a){_0x445ab0['count']=_0x3bc89a;if(_0x1226e1[_0x5df4('0x48')]['includeAll']){_0x231654[_0x5df4('0x5a')]=[{'model':db['CmContact'],'as':_0x5df4('0x79'),'required':![]},{'model':db[_0x5df4('0x7a')],'as':_0x5df4('0x7b'),'attributes':['name',_0x5df4('0x7c'),_0x5df4('0x7d')],'required':![]},{'model':db[_0x5df4('0x7e')],'as':_0x5df4('0x7f'),'attributes':['id','name','color'],'where':_0x1226e1[_0x5df4('0x48')]['tag']?{'id':_0x1226e1[_0x5df4('0x48')][_0x5df4('0x80')]}:undefined,'required':_0x1226e1[_0x5df4('0x48')]['tag']?!![]:![]}];}return db[_0x5df4('0x75')][_0x5df4('0x55')](_0x231654);})[_0x5df4('0x22')](function(_0x133c45){_0x445ab0[_0x5df4('0x56')]=_0x133c45;return _0x445ab0;});}})[_0x5df4('0x22')](respondWithFilteredResult(_0x35686b,_0x231654))[_0x5df4('0x2c')](handleError(_0x35686b,null));};exports[_0x5df4('0x81')]=function(_0x4ec292,_0x38d272){var _0x42ec17=_0x4ec292['params']['id'];var _0x21b381=_0x4ec292[_0x5df4('0x5c')];var _0x4d8a62=0xc8;var _0x5c2bac=null;return db[_0x5df4('0x82')][_0x5df4('0x83')]({'isolationLevel':db[_0x5df4('0x82')][_0x5df4('0x84')]['ISOLATION_LEVELS'][_0x5df4('0x85')]},function(_0x31f3a7){return db[_0x5df4('0x42')][_0x5df4('0x6b')]({'where':{'id':_0x42ec17},'transaction':_0x31f3a7})[_0x5df4('0x22')](function(_0xccfa9){if(_0xccfa9){return db[_0x5df4('0x86')][_0x5df4('0x39')]({'where':{'FaxAccountId':_0x42ec17},'transaction':_0x31f3a7})[_0x5df4('0x22')](function(){var _0x2873f9=_[_0x5df4('0x41')](_0x21b381,function(_0x3c1209){_0x3c1209['FaxAccountId']=_0x42ec17;return _0x3c1209;});return db[_0x5df4('0x86')][_0x5df4('0x87')](_0x2873f9,{'transaction':_0x31f3a7});});}else{_0x4d8a62=0x194;_0x5c2bac=[];}});})[_0x5df4('0x22')](function(){if(_0x4d8a62!==0x194){return db[_0x5df4('0x86')][_0x5df4('0x88')]({'where':{'FaxAccountId':_0x42ec17},'order':_0x5df4('0x89')})[_0x5df4('0x22')](function(_0x207741){_0x5c2bac=_0x207741;});}})[_0x5df4('0x2c')](function(_0x5f44dd){_0x4d8a62=0x1f4;logger[_0x5df4('0x29')](_0x5f44dd[_0x5df4('0x3d')]);if(_0x5f44dd[_0x5df4('0x3e')]){delete _0x5f44dd[_0x5df4('0x3e')];}_0x5c2bac=_0x5f44dd;})[_0x5df4('0x8a')](function(){if(_0x5c2bac===null){_0x38d272[_0x5df4('0x2d')](_0x4d8a62);}else{if(_0x4d8a62===0x1f4){_0x38d272['status'](_0x4d8a62)[_0x5df4('0x3f')](_0x5c2bac);}else{_0x38d272[_0x5df4('0x2e')](_0x4d8a62)[_0x5df4('0x30')](_0x5c2bac);}}});};exports[_0x5df4('0x8b')]=function(_0x222f17,_0x343001,_0x2dd2d0){var _0x5d8e6a={};var _0x4fff19={};var _0x3c3dff;var _0x490440;return db[_0x5df4('0x42')][_0x5df4('0x6b')]({'where':{'id':_0x222f17[_0x5df4('0x65')]['id']}})[_0x5df4('0x22')](handleEntityNotFound(_0x343001,null))[_0x5df4('0x22')](function(_0x1d075d){if(_0x1d075d){_0x3c3dff=_0x1d075d;_0x4fff19[_0x5df4('0x46')]=_[_0x5df4('0x47')](db['FaxApplication'][_0x5df4('0x43')]);_0x4fff19['query']=_[_0x5df4('0x47')](_0x222f17[_0x5df4('0x48')]);_0x4fff19['filters']=_[_0x5df4('0x59')](_0x4fff19[_0x5df4('0x46')],_0x4fff19[_0x5df4('0x48')]);_0x5d8e6a[_0x5df4('0x4a')]=_['intersection'](_0x4fff19['model'],qs[_0x5df4('0x49')](_0x222f17['query'][_0x5df4('0x49')]));_0x5d8e6a['attributes']=_0x5d8e6a[_0x5df4('0x4a')]['length']?_0x5d8e6a[_0x5df4('0x4a')]:_0x4fff19[_0x5df4('0x46')];_0x5d8e6a['order']=qs[_0x5df4('0x4d')](_0x222f17[_0x5df4('0x48')][_0x5df4('0x4d')]);_0x5d8e6a[_0x5df4('0x4e')]=qs[_0x5df4('0x4f')](_[_0x5df4('0x50')](_0x222f17[_0x5df4('0x48')],_0x4fff19[_0x5df4('0x4f')]));if(_0x222f17[_0x5df4('0x48')][_0x5df4('0x6d')]){_0x5d8e6a['where']=_['merge'](_0x5d8e6a[_0x5df4('0x4e')],{'$or':_[_0x5df4('0x41')](_0x5d8e6a[_0x5df4('0x4a')],function(_0x1754e2){var _0x5fc1fc={};_0x5fc1fc[_0x1754e2]={'$like':'%'+_0x222f17[_0x5df4('0x48')][_0x5df4('0x6d')]+'%'};return _0x5fc1fc;})});}_0x5d8e6a=_[_0x5df4('0x51')]({},_0x5d8e6a,_0x222f17[_0x5df4('0x53')]);return _0x3c3dff[_0x5df4('0x8b')](_0x5d8e6a);}})[_0x5df4('0x22')](function(_0x9f15){if(_0x9f15){_0x490440=_0x9f15['length'];if(!_0x222f17[_0x5df4('0x48')][_0x5df4('0x73')](_0x5df4('0x6c'))){_0x5d8e6a[_0x5df4('0x33')]=qs[_0x5df4('0x33')](_0x222f17[_0x5df4('0x48')]['limit']);_0x5d8e6a[_0x5df4('0x31')]=qs[_0x5df4('0x31')](_0x222f17[_0x5df4('0x48')]['offset']);}return _0x3c3dff[_0x5df4('0x8b')](_0x5d8e6a);}})[_0x5df4('0x22')](function(_0x30fd10){if(_0x30fd10){return _0x30fd10?{'count':_0x490440,'rows':_0x30fd10}:null;}})[_0x5df4('0x22')](respondWithResult(_0x343001,null))[_0x5df4('0x2c')](handleError(_0x343001,null));};function Extension(_0xdabc3c,_0x7c4821,_0xc58aeb,_0x59353f){this[_0x5df4('0x8c')]=_0x5df4('0x8d');this[_0x5df4('0x8e')]=_0xdabc3c[_0x5df4('0x8f')];this['app']=_0x59353f;this['type']='system';this[_0x5df4('0x90')]=_0x5df4('0x91');this[_0x5df4('0x68')]=_0xdabc3c['id'];this[_0x5df4('0x89')]=_0x7c4821;this[_0x5df4('0x92')]=_0xc58aeb;}function createExtensionsReciveFax(_0x27bf16){var _0x5c2824=0x1;var _0x23c0f4=[];_0x23c0f4[_0x5df4('0x93')](new Extension(_0x27bf16,_0x5c2824,'',_0x5df4('0x94')));_0x5c2824+=0x1;_0x23c0f4[_0x5df4('0x93')](new Extension(_0x27bf16,_0x5c2824,_0x5df4('0x95'),'Set'));_0x5c2824+=0x1;for(var _0xdf6569 in _0x27bf16){if(_0x27bf16[_0x5df4('0x73')](_0xdf6569)&&(_0xdf6569==='ecm'||_0xdf6569===_0x5df4('0x8f')||_0xdf6569===_0x5df4('0x96')||_0xdf6569==='faxdetect'||_0xdf6569==='headerinfo'||_0xdf6569==='maxrate'||_0xdf6569==='minrate'||_0xdf6569===_0x5df4('0x97')||_0xdf6569===_0x5df4('0x98'))){_0x23c0f4[_0x5df4('0x93')](new Extension(_0x27bf16,_0x5c2824,_0x5df4('0x99')+_0xdf6569+')='+_0x27bf16[_0xdf6569],_0x5df4('0x9a')));_0x5c2824+=0x1;}}_0x23c0f4[_0x5df4('0x93')](new Extension(_0x27bf16,_0x5c2824,'6',_0x5df4('0x9b')));_0x5c2824+=0x1;_0x23c0f4[_0x5df4('0x93')](new Extension(_0x27bf16,_0x5c2824,'/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',_0x5df4('0x9c')));_0x5c2824=0x0;return _0x23c0f4;}exports[_0x5df4('0x9d')]=function(_0x4fea8d,_0x24fe82,_0x196e1b){var _0x433e04;return db[_0x5df4('0x82')][_0x5df4('0x83')](function(_0x5eea07){return db['FaxAccount']['create'](_0x4fea8d[_0x5df4('0x5c')],{'transaction':_0x5eea07})[_0x5df4('0x22')](function(_0x50e176){_0x433e04=_0x50e176['get']({'plain':!![]});return db[_0x5df4('0x9e')][_0x5df4('0x87')](createExtensionsReciveFax(_0x433e04),{'transaction':_0x5eea07});});})[_0x5df4('0x22')](function(){return _0x433e04;})[_0x5df4('0x22')](respondWithResult(_0x24fe82,null))[_0x5df4('0x2c')](handleError(_0x24fe82,null));};exports[_0x5df4('0x9f')]=function(_0x5c2d6a,_0x569b2c,_0x43f0c0){var _0x4ce23a;return db[_0x5df4('0x82')]['transaction'](function(_0xc13fae){return db[_0x5df4('0x42')][_0x5df4('0x38')](_0x5c2d6a['body'],{'where':{'id':_0x5c2d6a[_0x5df4('0x5c')]['id']},'transaction':_0xc13fae})[_0x5df4('0x22')](function(_0x4a3a65){return db[_0x5df4('0x9e')][_0x5df4('0x39')]({'where':{'FaxAccountId':_0x5c2d6a[_0x5df4('0x5c')]['id']},'transaction':_0xc13fae})[_0x5df4('0x22')](function(_0x259d9a){return db[_0x5df4('0x9e')][_0x5df4('0x87')](createExtensionsReciveFax(_['omit'](_0x5c2d6a['body'],[_0x5df4('0xa0'),_0x5df4('0xa1'),'createdAt','updatedAt',_0x5df4('0xa2'),'ListId'])),{'transaction':_0xc13fae});});});})['then'](function(){return db[_0x5df4('0x42')][_0x5df4('0xa3')](_0x5c2d6a[_0x5df4('0x5c')]['id']);})['then'](respondWithResult(_0x569b2c,null))['catch'](handleError(_0x569b2c,null));};exports[_0x5df4('0xa4')]=function(_0x4637fc,_0x56f287,_0x5775af){var _0x395634={'raw':!![],'where':{}};var _0x9f0959={};var _0xbbb33a={'count':0x0,'rows':[]};return db[_0x5df4('0x42')][_0x5df4('0x6b')]({'where':{'id':_0x4637fc['params']['id']}})[_0x5df4('0x22')](handleEntityNotFound(_0x56f287,null))[_0x5df4('0x22')](function(_0x48de54){if(_0x48de54){_0x9f0959[_0x5df4('0x46')]=_['keys'](db[_0x5df4('0xa5')][_0x5df4('0x43')]);_0x9f0959['query']=_[_0x5df4('0x47')](_0x4637fc[_0x5df4('0x48')]);_0x9f0959[_0x5df4('0x4f')]=_[_0x5df4('0x59')](_0x9f0959[_0x5df4('0x46')],_0x9f0959[_0x5df4('0x48')]);_0x395634['attributes']=_[_0x5df4('0x59')](_0x9f0959[_0x5df4('0x46')],qs[_0x5df4('0x49')](_0x4637fc[_0x5df4('0x48')][_0x5df4('0x49')]));_0x395634['attributes']=_0x395634[_0x5df4('0x4a')]['length']?_0x395634['attributes']:_0x9f0959['model'];if(!_0x4637fc[_0x5df4('0x48')]['hasOwnProperty'](_0x5df4('0x6c'))){_0x395634[_0x5df4('0x33')]=qs[_0x5df4('0x33')](_0x4637fc[_0x5df4('0x48')][_0x5df4('0x33')]);_0x395634[_0x5df4('0x31')]=qs[_0x5df4('0x31')](_0x4637fc[_0x5df4('0x48')][_0x5df4('0x31')]);}_0x395634[_0x5df4('0x4c')]=qs[_0x5df4('0x4d')](_0x4637fc[_0x5df4('0x48')]['sort']);_0x395634[_0x5df4('0x4e')]=qs[_0x5df4('0x4f')](_[_0x5df4('0x50')](_0x4637fc[_0x5df4('0x48')],_0x9f0959['filters']));_0x395634[_0x5df4('0x4e')][_0x5df4('0x68')]=_0x48de54['id'];if(_0x4637fc[_0x5df4('0x48')]['filter']){_0x395634[_0x5df4('0x4e')]=_[_0x5df4('0x51')](_0x395634[_0x5df4('0x4e')],{'$or':_[_0x5df4('0x41')](_0x395634[_0x5df4('0x4a')],function(_0x3ecc35){var _0x2a5407={};_0x2a5407[_0x3ecc35]={'$like':'%'+_0x4637fc[_0x5df4('0x48')][_0x5df4('0x6d')]+'%'};return _0x2a5407;})});}if(_0x4637fc[_0x5df4('0x48')]['$gte']){var _0x38b6e7=_0x4637fc[_0x5df4('0x48')][_0x5df4('0xa6')][_0x5df4('0xa7')](',');var _0x2cfd27={};_0x2cfd27[_0x38b6e7[0x0]]={'$gte':moment(_0x38b6e7[0x1])[_0x5df4('0xa8')]('YYYY-MM-DD\x20HH:mm:ss')};_0x395634[_0x5df4('0x4e')]=_[_0x5df4('0x51')](_0x395634[_0x5df4('0x4e')],_0x2cfd27);}_0x395634=_[_0x5df4('0x51')]({},_0x395634,_0x4637fc['options']);return db[_0x5df4('0xa5')][_0x5df4('0x32')]({'where':_0x395634[_0x5df4('0x4e')]})[_0x5df4('0x22')](function(_0x168014){_0xbbb33a['count']=_0x168014;if(_0x4637fc[_0x5df4('0x48')][_0x5df4('0x54')]){_0x395634['include']=[{'all':!![]}];}return db[_0x5df4('0xa5')][_0x5df4('0x55')](_0x395634);})[_0x5df4('0x22')](function(_0x2d8fae){_0xbbb33a[_0x5df4('0x56')]=_0x2d8fae;return _0xbbb33a;});}})[_0x5df4('0x22')](respondWithFilteredResult(_0x56f287,_0x395634))[_0x5df4('0x2c')](handleError(_0x56f287,null));};exports[_0x5df4('0x3f')]=function(_0x1111af,_0x3a8c30,_0x490764){var _0x49448c,_0x3d8787={},_0x32f948;if(_0x1111af[_0x5df4('0x5c')]['to']){_0x32f948=_0x1111af['body']['to'][0x0];}return db[_0x5df4('0x42')][_0x5df4('0x61')]({'where':{'id':_0x1111af[_0x5df4('0x65')]['id']},'include':[{'model':db[_0x5df4('0xa9')],'as':_0x5df4('0xaa'),'include':[{'model':db[_0x5df4('0xab')],'as':_0x5df4('0xac'),'where':{'fax':_0x32f948},'limit':0x1,'order':[['updatedAt',_0x5df4('0xad')]]}]}]})[_0x5df4('0x22')](handleEntityNotFound(_0x3a8c30,null))['then'](function(_0xedcef8){_0x49448c=_0xedcef8;if(_0x1111af['body'][_0x5df4('0xae')]&&_0x1111af[_0x5df4('0x5c')][_0x5df4('0xae')][_0x5df4('0x4b')]){for(var _0x50db16=0x0;_0x50db16<_0x1111af[_0x5df4('0x5c')][_0x5df4('0xae')][_0x5df4('0x4b')];_0x50db16+=0x1){_0x1111af[_0x5df4('0x5c')]['attachments'][_0x50db16]={'filename':_0x1111af['body'][_0x5df4('0xae')][_0x50db16][_0x5df4('0x3e')],'id':_0x1111af['body'][_0x5df4('0xae')][_0x50db16]['id'],'path':path['join'](config[_0x5df4('0xaf')],_0x5df4('0xb0'),_0x1111af['body'][_0x5df4('0xae')][_0x50db16][_0x5df4('0xb1')])};}}return respondWithRpcPromise(_0x5df4('0xb2'),_0x5df4('0xb2'),{'FaxAccountId':_['isNil'](_0x1111af['params']['id'])?undefined:_0x1111af[_0x5df4('0x65')]['id'],'path':_[_0x5df4('0xb3')](_0x1111af[_0x5df4('0x5c')][_0x5df4('0xae')][0x0][_0x5df4('0x8')])?undefined:_0x1111af['body'][_0x5df4('0xae')][0x0][_0x5df4('0x8')],'fax':_[_0x5df4('0xb3')](_0x1111af[_0x5df4('0x5c')]['to'][0x0])?undefined:_0x1111af['body']['to'][0x0]},client9002);})['then'](function(){if(_0x49448c){if(_[_0x5df4('0xb3')](_0x1111af[_0x5df4('0x5c')]['from'])){_0x1111af['body']['from']=util[_0x5df4('0xa8')](_0x5df4('0xb4'),_0x49448c['name'],_0x49448c[_0x5df4('0xb5')]);}if(_0x49448c[_0x5df4('0xaa')]){if(_0x49448c['List'][_0x5df4('0xac')][_0x5df4('0x4b')]){return _0x49448c[_0x5df4('0xaa')][_0x5df4('0xac')][0x0];}else{return db[_0x5df4('0xab')][_0x5df4('0x5b')](_[_0x5df4('0x19')](_0x1111af['body'],{'firstName':_0x1111af[_0x5df4('0x5c')]['to'][0x0],'phone':_0x1111af[_0x5df4('0x5c')]['to'][0x0],'fax':_0x1111af[_0x5df4('0x5c')]['to'][0x0],'ListId':_0x49448c[_0x5df4('0xb6')]}));}}else{throw new Error(_0x5df4('0xb7'));}}else{throw new Error(_0x5df4('0xb8'));}})['then'](function(_0x2b4e26){if(_0x2b4e26){return db['FaxInteraction'][_0x5df4('0x61')]({'where':{'ContactId':_0x2b4e26['id'],'closed':![],'FaxAccountId':_0x49448c['id']}})[_0x5df4('0x22')](function(_0x2b581d){if(_0x2b581d){return[_0x2b581d,![]];}return db[_0x5df4('0x75')][_0x5df4('0x5b')]({'UserId':_0x1111af[_0x5df4('0x5d')]['id'],'ContactId':_0x2b4e26['id'],'FaxAccountId':_0x49448c['id'],'fax':_0x1111af[_0x5df4('0x5c')]['to'][0x0],'firstMsgDirection':_0x5df4('0xb9'),'Messages':[_[_0x5df4('0x51')](_0x1111af[_0x5df4('0x5c')],{'read':![],'body':_0x1111af[_0x5df4('0x5c')][_0x5df4('0xae')][0x0][_0x5df4('0xba')],'FaxAccountId':_0x49448c['id'],'UserId':_0x1111af[_0x5df4('0x5d')]['id'],'ContactId':_0x2b4e26['id'],'AttachmentId':_0x1111af['body'][_0x5df4('0xae')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0x5df4('0x22')](function(_0x5889aa){return[_0x5889aa,!![]];});});}else{throw new Error(_0x5df4('0xbb'));}})['spread'](function(_0x3a6471,_0x5692e4){if(_0x5692e4){return _0x3a6471;}return db[_0x5df4('0xa5')][_0x5df4('0x5b')]({'direction':_0x5df4('0xb9'),'read':![],'body':_0x1111af[_0x5df4('0x5c')][_0x5df4('0xae')][0x0][_0x5df4('0xba')],'FaxAccountId':_0x49448c['id'],'FaxInteractionId':_0x3a6471['id'],'UserId':_0x1111af['user']['id'],'ContactId':_0x3a6471[_0x5df4('0xbc')],'AttachmentId':_0x1111af[_0x5df4('0x5c')]['attachments'][0x0]['id']})['then'](function(_0x29dff8){_0x3a6471['dataValues'][_0x5df4('0xbd')]=[];_0x3a6471[_0x5df4('0xbe')]['Messages'][_0x5df4('0x93')](_0x29dff8[_0x5df4('0xbe')]);return _0x3a6471;});})[_0x5df4('0x22')](function(_0x2ab5c5){respondWithRpcPromise('SendFax',_0x5df4('0xbf'),{'FaxAccountId':_[_0x5df4('0xb3')](_0x1111af['params']['id'])?undefined:_0x1111af[_0x5df4('0x65')]['id'],'path':_[_0x5df4('0xb3')](_0x1111af['body'][_0x5df4('0xae')][0x0][_0x5df4('0x8')])?undefined:_0x1111af[_0x5df4('0x5c')][_0x5df4('0xae')][0x0]['path'],'fax':_[_0x5df4('0xb3')](_0x1111af[_0x5df4('0x5c')]['to'][0x0])?undefined:_0x1111af[_0x5df4('0x5c')]['to'][0x0],'AttachmentId':_0x1111af[_0x5df4('0x5c')][_0x5df4('0xae')][0x0]['id']},client9002)['then'](function(_0x145d16){logger['info']('SendFaxRpc,\x20%s',_0x145d16);})['catch'](function(_0x38ac6a){logger[_0x5df4('0x23')](_0x5df4('0xc0'),_0x38ac6a);});return _0x2ab5c5;})[_0x5df4('0x22')](respondWithResult(_0x3a8c30,null))[_0x5df4('0x2c')](handleError(_0x3a8c30,null));};exports['addAgents']=function(_0x2a0c18,_0x4d4148,_0x3574be){return db[_0x5df4('0x42')][_0x5df4('0x61')]({'where':{'id':_0x2a0c18[_0x5df4('0x65')]['id']}})[_0x5df4('0x22')](handleEntityNotFound(_0x4d4148,null))[_0x5df4('0x22')](function(_0x3429cf){if(_0x3429cf){return _0x3429cf[_0x5df4('0xc1')](_0x2a0c18[_0x5df4('0x5c')][_0x5df4('0x6f')],_[_0x5df4('0x77')](_0x2a0c18[_0x5df4('0x5c')],[_0x5df4('0x6f'),'id'])||{})['spread'](function(_0xf819c3){for(var _0x2a0975=0x0;_0x2a0975<_0x2a0c18[_0x5df4('0x5c')][_0x5df4('0x6f')][_0x5df4('0x4b')];_0x2a0975+=0x1){socket[_0x5df4('0xc2')](_0x5df4('0xc3'),{'UserId':Number(_0x2a0c18['body'][_0x5df4('0x6f')][_0x2a0975]),'FaxAccountId':Number(_0x2a0c18[_0x5df4('0x65')]['id'])});}return _0xf819c3;});}})[_0x5df4('0x22')](respondWithResult(_0x4d4148,null))[_0x5df4('0x2c')](handleError(_0x4d4148,null));};exports[_0x5df4('0xc4')]=function(_0xac8b8,_0x52c0cc,_0x2b8b80){return db[_0x5df4('0x42')][_0x5df4('0x61')]({'where':{'id':_0xac8b8[_0x5df4('0x65')]['id']}})['then'](handleEntityNotFound(_0x52c0cc,null))['then'](function(_0x3a6183){if(_0x3a6183){return _0x3a6183[_0x5df4('0xc4')](_0xac8b8[_0x5df4('0x48')][_0x5df4('0x6f')])[_0x5df4('0x22')](function(){if(_[_0x5df4('0xc5')](_0xac8b8['query']['ids'])){for(var _0x50ceda=0x0;_0x50ceda<_0xac8b8[_0x5df4('0x48')][_0x5df4('0x6f')][_0x5df4('0x4b')];_0x50ceda+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0xac8b8[_0x5df4('0x48')][_0x5df4('0x6f')][_0x50ceda]),'FaxAccountId':Number(_0xac8b8[_0x5df4('0x65')]['id'])});}}else{socket[_0x5df4('0xc2')](_0x5df4('0xc6'),{'UserId':Number(_0xac8b8[_0x5df4('0x48')][_0x5df4('0x6f')]),'FaxAccountId':Number(_0xac8b8[_0x5df4('0x65')]['id'])});}});}})[_0x5df4('0x22')](respondWithStatusCode(_0x52c0cc,null))[_0x5df4('0x2c')](handleError(_0x52c0cc,null));};exports[_0x5df4('0xc7')]=function(_0x359f54,_0x4b4626,_0xaa50ca){var _0x4e9582={};var _0x3143c7={};var _0x141615;var _0x475399;return db[_0x5df4('0x42')][_0x5df4('0x6b')]({'where':{'id':_0x359f54[_0x5df4('0x65')]['id']}})['then'](handleEntityNotFound(_0x4b4626,null))['then'](function(_0x2090af){if(_0x2090af){_0x141615=_0x2090af;_0x3143c7[_0x5df4('0x46')]=_[_0x5df4('0x47')](db['User'][_0x5df4('0x43')]);_0x3143c7['query']=_['keys'](_0x359f54[_0x5df4('0x48')]);_0x3143c7['filters']=_[_0x5df4('0x59')](_0x3143c7[_0x5df4('0x46')],_0x3143c7[_0x5df4('0x48')]);_0x4e9582['attributes']=_['intersection'](_0x3143c7[_0x5df4('0x46')],qs[_0x5df4('0x49')](_0x359f54[_0x5df4('0x48')][_0x5df4('0x49')]));_0x4e9582[_0x5df4('0x4a')]=_0x4e9582[_0x5df4('0x4a')][_0x5df4('0x4b')]?_0x4e9582[_0x5df4('0x4a')]:_0x3143c7[_0x5df4('0x46')];_0x4e9582[_0x5df4('0x4c')]=qs['sort'](_0x359f54[_0x5df4('0x48')]['sort']);_0x4e9582[_0x5df4('0x4e')]=qs[_0x5df4('0x4f')](_[_0x5df4('0x50')](_0x359f54[_0x5df4('0x48')],_0x3143c7[_0x5df4('0x4f')]));if(_0x359f54['query'][_0x5df4('0x6d')]){_0x4e9582[_0x5df4('0x4e')]=_[_0x5df4('0x51')](_0x4e9582[_0x5df4('0x4e')],{'$or':_['map'](_0x4e9582[_0x5df4('0x4a')],function(_0x55dcba){var _0x59427d={};_0x59427d[_0x55dcba]={'$like':'%'+_0x359f54[_0x5df4('0x48')][_0x5df4('0x6d')]+'%'};return _0x59427d;})});}_0x4e9582=_['merge']({},_0x4e9582,_0x359f54[_0x5df4('0x53')]);return _0x141615['getAgents'](_0x4e9582);}})['then'](function(_0x415cf0){if(_0x415cf0){_0x475399=_0x415cf0[_0x5df4('0x4b')];if(!_0x359f54[_0x5df4('0x48')]['hasOwnProperty'](_0x5df4('0x6c'))){_0x4e9582[_0x5df4('0x33')]=qs[_0x5df4('0x33')](_0x359f54['query'][_0x5df4('0x33')]);_0x4e9582[_0x5df4('0x31')]=qs[_0x5df4('0x31')](_0x359f54[_0x5df4('0x48')][_0x5df4('0x31')]);}return _0x141615['getAgents'](_0x4e9582);}})[_0x5df4('0x22')](function(_0x977cc6){if(_0x977cc6){return _0x977cc6?{'count':_0x475399,'rows':_0x977cc6}:null;}})[_0x5df4('0x22')](respondWithResult(_0x4b4626,null))[_0x5df4('0x2c')](handleError(_0x4b4626,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 5f431ac..7605982 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 _0xca7e=['events','FaxAccount','save','emit','hasOwnProperty','exports'];(function(_0x339c23,_0x541ff6){var _0x5bf134=function(_0x46c91d){while(--_0x46c91d){_0x339c23['push'](_0x339c23['shift']());}};_0x5bf134(++_0x541ff6);}(_0xca7e,0xde));var _0xeca7=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xca7e[_0x40220a];return _0x3903cc;};'use strict';var EventEmitter=require(_0xeca7('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xeca7('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeca7('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1146cc){return function(_0x447867,_0x141844,_0x270d52){FaxAccountEvents[_0xeca7('0x3')](_0x1146cc+':'+_0x447867['id'],_0x447867);FaxAccountEvents[_0xeca7('0x3')](_0x1146cc,_0x447867);_0x270d52(null);};}for(var e in events){if(events[_0xeca7('0x4')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xeca7('0x5')]=FaxAccountEvents; \ No newline at end of file +var _0x2295=['events','../../mysqldb','save','remove','hasOwnProperty'];(function(_0x466bc5,_0x3a0f2a){var _0x138952=function(_0x392fa2){while(--_0x392fa2){_0x466bc5['push'](_0x466bc5['shift']());}};_0x138952(++_0x3a0f2a);}(_0x2295,0x113));var _0x5229=function(_0x536a58,_0x215d01){_0x536a58=_0x536a58-0x0;var _0x1635e8=_0x2295[_0x536a58];return _0x1635e8;};'use strict';var EventEmitter=require(_0x5229('0x0'));var FaxAccount=require(_0x5229('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5229('0x2'),'afterUpdate':'update','afterDestroy':_0x5229('0x3')};function emitEvent(_0x376765){return function(_0x113fd2,_0x1792f3,_0x5aa878){FaxAccountEvents['emit'](_0x376765+':'+_0x113fd2['id'],_0x113fd2);FaxAccountEvents['emit'](_0x376765,_0x113fd2);_0x5aa878(null);};}for(var e in events){if(events[_0x5229('0x4')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 31d7761..c70646a 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 _0xbe6f=['path','rimraf','../../config/environment','define','fax_accounts','lodash','../../config/logger','api','request-promise'];(function(_0x31c0e3,_0x3c5cd6){var _0xf34e31=function(_0x312d15){while(--_0x312d15){_0x31c0e3['push'](_0x31c0e3['shift']());}};_0xf34e31(++_0x3c5cd6);}(_0xbe6f,0x9e));var _0xfbe6=function(_0x5edeff,_0x4507b6){_0x5edeff=_0x5edeff-0x0;var _0x589fd7=_0xbe6f[_0x5edeff];return _0x589fd7;};'use strict';var _=require(_0xfbe6('0x0'));var util=require('util');var logger=require(_0xfbe6('0x1'))(_0xfbe6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfbe6('0x3'));var fs=require('fs');var path=require(_0xfbe6('0x4'));var rimraf=require(_0xfbe6('0x5'));var config=require(_0xfbe6('0x6'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x5068ac,_0x3fd15f){return _0x5068ac[_0xfbe6('0x7')]('FaxAccount',attributes,{'tableName':_0xfbe6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc85=['FaxAccount','fax_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x219e1a,_0x4b2e95){var _0x3e1110=function(_0x179022){while(--_0x179022){_0x219e1a['push'](_0x219e1a['shift']());}};_0x3e1110(++_0x4b2e95);}(_0xcc85,0x1af));var _0x5cc8=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0xcc85[_0x5a636f];return _0x6a8cfb;};'use strict';var _=require(_0x5cc8('0x0'));var util=require(_0x5cc8('0x1'));var logger=require('../../config/logger')(_0x5cc8('0x2'));var moment=require(_0x5cc8('0x3'));var BPromise=require(_0x5cc8('0x4'));var rp=require(_0x5cc8('0x5'));var fs=require('fs');var path=require(_0x5cc8('0x6'));var rimraf=require(_0x5cc8('0x7'));var config=require(_0x5cc8('0x8'));var attributes=require('./faxAccount.attributes');module[_0x5cc8('0x9')]=function(_0x5019ba,_0x1fe4f8){return _0x5019ba[_0x5cc8('0xa')](_0x5cc8('0xb'),attributes,{'tableName':_0x5cc8('0xc'),'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 b3abba5..12f5f73 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 _0xdccd=['contact','fax','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','close','unmanaged','created','interaction','FaxMessage','AttachmentId','name','agent','FaxQueue','queueId','unshift','queue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxAccount','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','body','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','createdAt','keys','ListId','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','CmList','List','Contacts','updatedAt','DESC','FaxApplication','account','applications','Applications','list','orderBy','asc','length','create'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xdccd,0x183));var _0xddcc=function(_0x46d068,_0x5112e2){_0x46d068=_0x46d068-0x0;var _0x2d53c9=_0xdccd[_0x46d068];return _0x2d53c9;};'use strict';var _=require('lodash');var util=require(_0xddcc('0x0'));var moment=require(_0xddcc('0x1'));var BPromise=require(_0xddcc('0x2'));var rs=require(_0xddcc('0x3'));var fs=require('fs');var Redis=require(_0xddcc('0x4'));var db=require(_0xddcc('0x5'))['db'];var utils=require(_0xddcc('0x6'));var logger=require(_0xddcc('0x7'))(_0xddcc('0x8'));var config=require('../../config/environment');var jayson=require(_0xddcc('0x9'));var client=jayson['client'][_0xddcc('0xa')]({'port':0x232c});config[_0xddcc('0xb')]=_[_0xddcc('0xc')](config[_0xddcc('0xb')],{'host':_0xddcc('0xd'),'port':0x18eb});var socket=require(_0xddcc('0xe'))(new Redis(config['redis']));require(_0xddcc('0xf'))[_0xddcc('0x10')](socket);function respondWithRpcPromise(_0x3d8e31,_0x3675bc,_0x4f0d94){return new BPromise(function(_0x451ccb,_0x14dc1b){return client[_0xddcc('0x11')](_0x3d8e31,_0x4f0d94)[_0xddcc('0x12')](function(_0x185228){logger[_0xddcc('0x13')](_0xddcc('0x14'),_0x3675bc,'request\x20sent');logger[_0xddcc('0x15')](_0xddcc('0x16'),_0x3675bc,_0xddcc('0x17'),JSON['stringify'](_0x185228));if(_0x185228[_0xddcc('0x18')]){if(_0x185228[_0xddcc('0x18')][_0xddcc('0x19')]===0x1f4){logger[_0xddcc('0x18')](_0xddcc('0x14'),_0x3675bc,_0x185228[_0xddcc('0x18')][_0xddcc('0x1a')]);return _0x14dc1b(_0x185228[_0xddcc('0x18')][_0xddcc('0x1a')]);}logger[_0xddcc('0x18')](_0xddcc('0x14'),_0x3675bc,_0x185228[_0xddcc('0x18')]['message']);return _0x451ccb(_0x185228['error']['message']);}else{logger[_0xddcc('0x13')](_0xddcc('0x14'),_0x3675bc,'request\x20sent');_0x451ccb(_0x185228[_0xddcc('0x1b')]['message']);}})[_0xddcc('0x1c')](function(_0x392e54){logger['error'](_0xddcc('0x14'),_0x3675bc,_0x392e54);_0x14dc1b(_0x392e54);});});}exports['GetFaxAccount']=function(_0x216c9c){var _0x5e6eb4=this;return new Promise(function(_0x590bd3,_0x272768){return db[_0xddcc('0x1d')]['findAll']({'raw':_0x216c9c[_0xddcc('0x1e')]?_0x216c9c['options'][_0xddcc('0x1f')]===undefined?!![]:![]:!![],'where':_0x216c9c['options']?_0x216c9c[_0xddcc('0x1e')][_0xddcc('0x20')]||null:null,'attributes':_0x216c9c[_0xddcc('0x1e')]?_0x216c9c['options'][_0xddcc('0x21')]||null:null,'limit':_0x216c9c['options']?_0x216c9c[_0xddcc('0x1e')][_0xddcc('0x22')]||null:null,'include':_0x216c9c[_0xddcc('0x1e')]?_0x216c9c[_0xddcc('0x1e')][_0xddcc('0x23')]?_[_0xddcc('0x24')](_0x216c9c[_0xddcc('0x1e')][_0xddcc('0x23')],function(_0x45e4b8){return{'model':db[_0x45e4b8[_0xddcc('0x25')]],'as':_0x45e4b8['as'],'attributes':_0x45e4b8[_0xddcc('0x21')],'include':_0x45e4b8[_0xddcc('0x23')]?_[_0xddcc('0x24')](_0x45e4b8[_0xddcc('0x23')],function(_0x2e1d32){return{'model':db[_0x2e1d32[_0xddcc('0x25')]],'as':_0x2e1d32['as'],'attributes':_0x2e1d32[_0xddcc('0x21')],'include':_0x2e1d32[_0xddcc('0x23')]?_[_0xddcc('0x24')](_0x2e1d32[_0xddcc('0x23')],function(_0x42355a){return{'model':db[_0x42355a[_0xddcc('0x25')]],'as':_0x42355a['as'],'attributes':_0x42355a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1cd179){logger[_0xddcc('0x13')](_0xddcc('0x26'),_0x216c9c);logger[_0xddcc('0x15')]('GetFaxAccount',_0x216c9c,JSON['stringify'](_0x1cd179));_0x590bd3(_0x1cd179);})[_0xddcc('0x1c')](function(_0x212941){logger['error'](_0xddcc('0x26'),_0x212941['message'],_0x216c9c);_0x272768(_0x5e6eb4[_0xddcc('0x18')](0x1f4,_0x212941[_0xddcc('0x1a')]));});});};exports['NotifyFaxAccount']=function(_0x42be7f,_0x54e3c7,_0x3b7414){var _0x20e802=this;return new Promise(function(_0x48f595,_0x3fb1a2){var _0x48b247={'body':_0x42be7f[_0xddcc('0x27')],'channel':'fax'};var _0x548ece=[];var _0x459a1c=[];var _0x54769e={};return db[_0xddcc('0x28')][_0xddcc('0x29')]()[_0xddcc('0x12')](function(_0xe5ff1a){if(!_0xe5ff1a){throw new db[(_0xddcc('0x2a'))]['ValidationError'](_0xddcc('0x2b'));}_0x548ece=_[_0xddcc('0x2c')](_['keys'](_0xe5ff1a),[_0xddcc('0x2d'),'updatedAt']);_0x459a1c=_['difference'](_[_0xddcc('0x2e')](_0xe5ff1a),['createdAt','updatedAt','CompanyId',_0xddcc('0x2f')]);if(_0x42be7f['body']['id']){delete _0x42be7f[_0xddcc('0x27')]['id'];}if(_['isNil'](_0x42be7f[_0xddcc('0x27')]['from'])){throw new db['Sequelize'][(_0xddcc('0x30'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x42be7f[_0xddcc('0x27')][_0xddcc('0x27')])||_0x42be7f[_0xddcc('0x27')][_0xddcc('0x27')]===''){throw new db[(_0xddcc('0x2a'))][(_0xddcc('0x30'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x42be7f[_0xddcc('0x27')][_0xddcc('0x31')])){throw new db[(_0xddcc('0x2a'))][(_0xddcc('0x30'))](_0xddcc('0x32')+_0x459a1c);}if(!_['includes'](_0x459a1c,_0x42be7f[_0xddcc('0x27')][_0xddcc('0x31')])){throw new db['Sequelize'][(_0xddcc('0x30'))](_0xddcc('0x33')+_0x459a1c);}_0x54769e[_0x42be7f[_0xddcc('0x27')]['mapKey']]=_0x42be7f[_0xddcc('0x27')][_0xddcc('0x34')];})[_0xddcc('0x12')](function(){return db['FaxAccount'][_0xddcc('0x35')]({'where':{'id':_0x42be7f['account']['id']},'include':[{'model':db[_0xddcc('0x36')],'as':_0xddcc('0x37'),'include':[{'model':db[_0xddcc('0x28')],'as':_0xddcc('0x38'),'where':_0x54769e,'limit':0x1,'order':[[_0xddcc('0x39'),_0xddcc('0x3a')]]}]},{'model':db[_0xddcc('0x3b')],'as':'Applications'}]});})['then'](function(_0x3ad236){if(_0x3ad236&&_0x3ad236['List']){var _0x1a94e6=_0x3ad236['get']({'plain':!![]});_0x48b247[_0xddcc('0x3c')]=_0x1a94e6;_0x48b247[_0xddcc('0x3d')]=_0x1a94e6[_0xddcc('0x3e')];_0x48b247[_0xddcc('0x3f')]=_0x1a94e6[_0xddcc('0x37')];_0x48b247[_0xddcc('0x3d')]=_[_0xddcc('0x40')](_0x48b247[_0xddcc('0x3d')],['priority'],[_0xddcc('0x41')]);if(_0x48b247['account']['Applications']){delete _0x48b247[_0xddcc('0x3c')]['Applications'];}if(_0x48b247['account']['List']&&_0x48b247[_0xddcc('0x3c')][_0xddcc('0x37')][_0xddcc('0x38')][_0xddcc('0x42')]){return _0x48b247[_0xddcc('0x3c')]['List'][_0xddcc('0x38')][0x0];}var _0x56ac28=_[_0xddcc('0xc')](_0x42be7f[_0xddcc('0x27')],{'firstName':_0x42be7f[_0xddcc('0x27')][_0xddcc('0x34')],'ListId':_0x1a94e6[_0xddcc('0x2f')]});_0x56ac28[_0x42be7f[_0xddcc('0x27')]['mapKey']]=_0x42be7f['body'][_0xddcc('0x34')];return db[_0xddcc('0x28')][_0xddcc('0x43')](_0x56ac28,{'fields':_0x548ece,'raw':!![]});}})[_0xddcc('0x12')](function(_0x20b414){_0x48b247[_0xddcc('0x44')]=_0x20b414;if(_0x20b414){var _0x114aa1={'ContactId':_0x20b414['id'],'FaxAccountId':_0x42be7f[_0xddcc('0x3c')]['id'],'fax':_0x20b414[_0xddcc('0x45')]};return db[_0xddcc('0x46')]['find']({'where':{'ContactId':_0x20b414['id'],'closed':![],'FaxAccountId':_0x42be7f[_0xddcc('0x3c')]['id']}})[_0xddcc('0x12')](function(_0x4f833c){if(_0x4f833c){return[_0x4f833c,![]];}return db[_0xddcc('0x46')][_0xddcc('0x43')](_0x114aa1)[_0xddcc('0x12')](function(_0xf0ae2d){return[_0xf0ae2d,!![]];});});}else{throw new Error(_0xddcc('0x47'));}})[_0xddcc('0x48')](function(_0x269daa,_0x18b9f3){var _0x1b0a32=_0x269daa[_0xddcc('0x49')]({'plain':!![]});if(_0x18b9f3){if(_0x48b247[_0xddcc('0x3c')][_0xddcc('0x4a')]){_0x48b247[_0xddcc('0x3d')]['push']({'id':0x0,'priority':_0x48b247['applications']['length']+0x1,'app':_0xddcc('0x4b'),'appdata':_0xddcc('0x4c'),'interval':'*,*,*,*'});}_0x1b0a32[_0xddcc('0x4d')]=!![];}else{_0x1b0a32['created']=![];}_0x48b247[_0xddcc('0x4e')]=_0x1b0a32;return db[_0xddcc('0x4f')]['create']({'body':_0x42be7f['body'][_0xddcc('0x27')],'FaxAccountId':_0x42be7f[_0xddcc('0x3c')]['id'],'FaxInteractionId':_0x269daa['id'],'direction':'in','ContactId':_0x269daa['ContactId'],'AttachmentId':_0x42be7f[_0xddcc('0x27')][_0xddcc('0x50')]});})[_0xddcc('0x12')](function(_0x50c62a){_0x48b247[_0xddcc('0x1a')]=_0x50c62a;if(!_0x48b247[_0xddcc('0x4e')]['UserId'])return;return db['User']['find']({'attributes':['id',_0xddcc('0x51')],'where':{'id':_0x48b247['interaction']['UserId']}});})[_0xddcc('0x12')](function(_0x19aa67){if(_0x19aa67){_0x48b247['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xddcc('0x52'),'appdata':_0x19aa67['name']+','+(_0x48b247['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x48b247[_0xddcc('0x4e')]['queueId'])return;return db[_0xddcc('0x53')][_0xddcc('0x35')]({'attributes':['id',_0xddcc('0x51')],'where':{'id':_0x48b247[_0xddcc('0x4e')][_0xddcc('0x54')]}});})['then'](function(_0x2df914){if(_0x2df914){_0x48b247['applications'][_0xddcc('0x55')]({'id':0x0,'priority':0x1,'app':_0xddcc('0x56'),'appdata':_0x2df914[_0xddcc('0x51')]+','+(_0x48b247[_0xddcc('0x3c')][_0xddcc('0x57')]||0x12c),'interval':_0xddcc('0x58')});}return respondWithRpcPromise(_0xddcc('0x59'),_0xddcc('0x5a'),_0x48b247);})[_0xddcc('0x12')](function(_0x1ca96c){_0x48f595(_0x1ca96c);})[_0xddcc('0x1c')](function(_0x27053b){_0x3fb1a2(_0x20e802[_0xddcc('0x18')](0x1f4,_0x27053b[_0xddcc('0x1a')]));});});}; \ No newline at end of file +var _0x6545=['unmanaged','*,*,*,*','created','FaxMessage','AttachmentId','interaction','UserId','User','name','unshift','agent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','model','debug','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','List','Contacts','DESC','FaxApplication','Applications','applications','list','orderBy','priority','asc','length','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','get','autoclose','close'];(function(_0x239904,_0x4b11e2){var _0x259609=function(_0x41d52a){while(--_0x41d52a){_0x239904['push'](_0x239904['shift']());}};_0x259609(++_0x4b11e2);}(_0x6545,0x137));var _0x5654=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6545[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5654('0x0'));var util=require(_0x5654('0x1'));var moment=require(_0x5654('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5654('0x3'))['db'];var utils=require(_0x5654('0x4'));var logger=require(_0x5654('0x5'))(_0x5654('0x6'));var config=require('../../config/environment');var jayson=require(_0x5654('0x7'));var client=jayson[_0x5654('0x8')][_0x5654('0x9')]({'port':0x232c});config[_0x5654('0xa')]=_[_0x5654('0xb')](config[_0x5654('0xa')],{'host':_0x5654('0xc'),'port':0x18eb});var socket=require(_0x5654('0xd'))(new Redis(config[_0x5654('0xa')]));require(_0x5654('0xe'))[_0x5654('0xf')](socket);function respondWithRpcPromise(_0x55c986,_0x199232,_0x427ff0){return new BPromise(function(_0x2d5a83,_0x5a1caa){return client[_0x5654('0x10')](_0x55c986,_0x427ff0)[_0x5654('0x11')](function(_0x1b98bc){logger[_0x5654('0x12')](_0x5654('0x13'),_0x199232,_0x5654('0x14'));logger['debug'](_0x5654('0x15'),_0x199232,_0x5654('0x14'),JSON[_0x5654('0x16')](_0x1b98bc));if(_0x1b98bc[_0x5654('0x17')]){if(_0x1b98bc[_0x5654('0x17')][_0x5654('0x18')]===0x1f4){logger[_0x5654('0x17')](_0x5654('0x13'),_0x199232,_0x1b98bc[_0x5654('0x17')][_0x5654('0x19')]);return _0x5a1caa(_0x1b98bc[_0x5654('0x17')][_0x5654('0x19')]);}logger[_0x5654('0x17')](_0x5654('0x13'),_0x199232,_0x1b98bc['error'][_0x5654('0x19')]);return _0x2d5a83(_0x1b98bc[_0x5654('0x17')][_0x5654('0x19')]);}else{logger[_0x5654('0x12')](_0x5654('0x13'),_0x199232,_0x5654('0x14'));_0x2d5a83(_0x1b98bc[_0x5654('0x1a')]['message']);}})[_0x5654('0x1b')](function(_0x3dee58){logger[_0x5654('0x17')](_0x5654('0x13'),_0x199232,_0x3dee58);_0x5a1caa(_0x3dee58);});});}exports[_0x5654('0x1c')]=function(_0x40236e){var _0x33309=this;return new Promise(function(_0x292ca0,_0x36bf5e){return db[_0x5654('0x1d')][_0x5654('0x1e')]({'raw':_0x40236e[_0x5654('0x1f')]?_0x40236e[_0x5654('0x1f')][_0x5654('0x20')]===undefined?!![]:![]:!![],'where':_0x40236e[_0x5654('0x1f')]?_0x40236e[_0x5654('0x1f')][_0x5654('0x21')]||null:null,'attributes':_0x40236e[_0x5654('0x1f')]?_0x40236e[_0x5654('0x1f')][_0x5654('0x22')]||null:null,'limit':_0x40236e[_0x5654('0x1f')]?_0x40236e[_0x5654('0x1f')][_0x5654('0x23')]||null:null,'include':_0x40236e[_0x5654('0x1f')]?_0x40236e[_0x5654('0x1f')][_0x5654('0x24')]?_['map'](_0x40236e[_0x5654('0x1f')][_0x5654('0x24')],function(_0x59e9a9){return{'model':db[_0x59e9a9[_0x5654('0x25')]],'as':_0x59e9a9['as'],'attributes':_0x59e9a9[_0x5654('0x22')],'include':_0x59e9a9['include']?_['map'](_0x59e9a9[_0x5654('0x24')],function(_0x53b30c){return{'model':db[_0x53b30c[_0x5654('0x25')]],'as':_0x53b30c['as'],'attributes':_0x53b30c[_0x5654('0x22')],'include':_0x53b30c[_0x5654('0x24')]?_['map'](_0x53b30c[_0x5654('0x24')],function(_0x29593b){return{'model':db[_0x29593b[_0x5654('0x25')]],'as':_0x29593b['as'],'attributes':_0x29593b[_0x5654('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5654('0x11')](function(_0x2fab79){logger[_0x5654('0x12')](_0x5654('0x1c'),_0x40236e);logger[_0x5654('0x26')](_0x5654('0x1c'),_0x40236e,JSON[_0x5654('0x16')](_0x2fab79));_0x292ca0(_0x2fab79);})[_0x5654('0x1b')](function(_0x2bdac5){logger['error'](_0x5654('0x1c'),_0x2bdac5['message'],_0x40236e);_0x36bf5e(_0x33309[_0x5654('0x17')](0x1f4,_0x2bdac5[_0x5654('0x19')]));});});};exports[_0x5654('0x27')]=function(_0x540fff,_0x5ee3cb,_0x24f355){var _0x473af7=this;return new Promise(function(_0x23f3f4,_0x22da7a){var _0x4971a5={'body':_0x540fff[_0x5654('0x28')],'channel':_0x5654('0x29')};var _0x4088d8=[];var _0x3b0536=[];var _0x4fd360={};return db['CmContact'][_0x5654('0x2a')]()[_0x5654('0x11')](function(_0x12f847){if(!_0x12f847){throw new db[(_0x5654('0x2b'))][(_0x5654('0x2c'))]('no\x20available\x20attributes');}_0x4088d8=_[_0x5654('0x2d')](_[_0x5654('0x2e')](_0x12f847),[_0x5654('0x2f'),_0x5654('0x30')]);_0x3b0536=_[_0x5654('0x2d')](_['keys'](_0x12f847),[_0x5654('0x2f'),_0x5654('0x30'),_0x5654('0x31'),_0x5654('0x32')]);if(_0x540fff[_0x5654('0x28')]['id']){delete _0x540fff[_0x5654('0x28')]['id'];}if(_['isNil'](_0x540fff['body']['from'])){throw new db[(_0x5654('0x2b'))][(_0x5654('0x2c'))](_0x5654('0x33'));}if(_[_0x5654('0x34')](_0x540fff[_0x5654('0x28')][_0x5654('0x28')])||_0x540fff[_0x5654('0x28')][_0x5654('0x28')]===''){throw new db[(_0x5654('0x2b'))][(_0x5654('0x2c'))](_0x5654('0x35'));}if(_[_0x5654('0x34')](_0x540fff['body'][_0x5654('0x36')])){throw new db[(_0x5654('0x2b'))][(_0x5654('0x2c'))](_0x5654('0x37')+_0x3b0536);}if(!_[_0x5654('0x38')](_0x3b0536,_0x540fff[_0x5654('0x28')][_0x5654('0x36')])){throw new db[(_0x5654('0x2b'))]['ValidationError'](_0x5654('0x39')+_0x3b0536);}_0x4fd360[_0x540fff[_0x5654('0x28')]['mapKey']]=_0x540fff[_0x5654('0x28')][_0x5654('0x3a')];})[_0x5654('0x11')](function(){return db[_0x5654('0x1d')]['find']({'where':{'id':_0x540fff[_0x5654('0x3b')]['id']},'include':[{'model':db[_0x5654('0x3c')],'as':_0x5654('0x3d'),'include':[{'model':db['CmContact'],'as':_0x5654('0x3e'),'where':_0x4fd360,'limit':0x1,'order':[[_0x5654('0x30'),_0x5654('0x3f')]]}]},{'model':db[_0x5654('0x40')],'as':_0x5654('0x41')}]});})[_0x5654('0x11')](function(_0x12d5cb){if(_0x12d5cb&&_0x12d5cb[_0x5654('0x3d')]){var _0x1a39e0=_0x12d5cb['get']({'plain':!![]});_0x4971a5[_0x5654('0x3b')]=_0x1a39e0;_0x4971a5[_0x5654('0x42')]=_0x1a39e0[_0x5654('0x41')];_0x4971a5[_0x5654('0x43')]=_0x1a39e0[_0x5654('0x3d')];_0x4971a5[_0x5654('0x42')]=_[_0x5654('0x44')](_0x4971a5[_0x5654('0x42')],[_0x5654('0x45')],[_0x5654('0x46')]);if(_0x4971a5[_0x5654('0x3b')]['Applications']){delete _0x4971a5[_0x5654('0x3b')]['Applications'];}if(_0x4971a5[_0x5654('0x3b')]['List']&&_0x4971a5['account'][_0x5654('0x3d')]['Contacts'][_0x5654('0x47')]){return _0x4971a5[_0x5654('0x3b')][_0x5654('0x3d')][_0x5654('0x3e')][0x0];}var _0x2a9348=_[_0x5654('0xb')](_0x540fff[_0x5654('0x28')],{'firstName':_0x540fff['body']['from'],'ListId':_0x1a39e0[_0x5654('0x32')]});_0x2a9348[_0x540fff[_0x5654('0x28')][_0x5654('0x36')]]=_0x540fff[_0x5654('0x28')][_0x5654('0x3a')];return db['CmContact'][_0x5654('0x48')](_0x2a9348,{'fields':_0x4088d8,'raw':!![]});}})[_0x5654('0x11')](function(_0x2ecfda){_0x4971a5[_0x5654('0x49')]=_0x2ecfda;if(_0x2ecfda){var _0x21f135={'ContactId':_0x2ecfda['id'],'FaxAccountId':_0x540fff[_0x5654('0x3b')]['id'],'fax':_0x2ecfda[_0x5654('0x29')]};return db[_0x5654('0x4a')][_0x5654('0x4b')]({'where':{'ContactId':_0x2ecfda['id'],'closed':![],'FaxAccountId':_0x540fff[_0x5654('0x3b')]['id']}})[_0x5654('0x11')](function(_0x478db0){if(_0x478db0){return[_0x478db0,![]];}return db['FaxInteraction']['create'](_0x21f135)['then'](function(_0x5f2bb5){return[_0x5f2bb5,!![]];});});}else{throw new Error(_0x5654('0x4c'));}})[_0x5654('0x4d')](function(_0x439629,_0x2dbe61){var _0x24ab2a=_0x439629[_0x5654('0x4e')]({'plain':!![]});if(_0x2dbe61){if(_0x4971a5['account'][_0x5654('0x4f')]){_0x4971a5['applications']['push']({'id':0x0,'priority':_0x4971a5[_0x5654('0x42')][_0x5654('0x47')]+0x1,'app':_0x5654('0x50'),'appdata':_0x5654('0x51'),'interval':_0x5654('0x52')});}_0x24ab2a[_0x5654('0x53')]=!![];}else{_0x24ab2a[_0x5654('0x53')]=![];}_0x4971a5['interaction']=_0x24ab2a;return db[_0x5654('0x54')][_0x5654('0x48')]({'body':_0x540fff[_0x5654('0x28')]['body'],'FaxAccountId':_0x540fff[_0x5654('0x3b')]['id'],'FaxInteractionId':_0x439629['id'],'direction':'in','ContactId':_0x439629['ContactId'],'AttachmentId':_0x540fff[_0x5654('0x28')][_0x5654('0x55')]});})['then'](function(_0x44ca04){_0x4971a5['message']=_0x44ca04;if(!_0x4971a5[_0x5654('0x56')][_0x5654('0x57')])return;return db[_0x5654('0x58')][_0x5654('0x4b')]({'attributes':['id',_0x5654('0x59')],'where':{'id':_0x4971a5[_0x5654('0x56')][_0x5654('0x57')]}});})[_0x5654('0x11')](function(_0x21b96f){if(_0x21b96f){_0x4971a5[_0x5654('0x42')][_0x5654('0x5a')]({'id':0x0,'priority':0x0,'app':_0x5654('0x5b'),'appdata':_0x21b96f[_0x5654('0x59')]+','+(_0x4971a5[_0x5654('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':_0x5654('0x52')});}if(!_0x4971a5[_0x5654('0x56')][_0x5654('0x5c')])return;return db[_0x5654('0x5d')][_0x5654('0x4b')]({'attributes':['id',_0x5654('0x59')],'where':{'id':_0x4971a5['interaction'][_0x5654('0x5c')]}});})[_0x5654('0x11')](function(_0x2d18a4){if(_0x2d18a4){_0x4971a5[_0x5654('0x42')]['unshift']({'id':0x0,'priority':0x1,'app':_0x5654('0x5e'),'appdata':_0x2d18a4['name']+','+(_0x4971a5['account'][_0x5654('0x5f')]||0x12c),'interval':_0x5654('0x52')});}return respondWithRpcPromise(_0x5654('0x60'),_0x5654('0x61'),_0x4971a5);})[_0x5654('0x11')](function(_0x24445f){_0x23f3f4(_0x24445f);})[_0x5654('0x1b')](function(_0x4c8ce7){_0x22da7a(_0x473af7[_0x5654('0x17')](0x1f4,_0x4c8ce7[_0x5654('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index e58383a..bfcef0b 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 _0xbd2a=['length','faxAccount:','save','remove','update','removeListener','register'];(function(_0x36bff5,_0x3156cb){var _0x80ade5=function(_0x5eee65){while(--_0x5eee65){_0x36bff5['push'](_0x36bff5['shift']());}};_0x80ade5(++_0x3156cb);}(_0xbd2a,0x95));var _0xabd2=function(_0xc324fd,_0x2d097a){_0xc324fd=_0xc324fd-0x0;var _0x2a5a95=_0xbd2a[_0xc324fd];return _0x2a5a95;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xabd2('0x0'),_0xabd2('0x1'),_0xabd2('0x2')];function createListener(_0x88d98c,_0x555d07){return function(_0x8f6bd3){_0x555d07['emit'](_0x88d98c,_0x8f6bd3);};}function removeListener(_0x429dcf,_0x35c313){return function(){FaxAccountEvents[_0xabd2('0x3')](_0x429dcf,_0x35c313);};}exports[_0xabd2('0x4')]=function(_0x2a6514){for(var _0x346beb=0x0,_0x5ec657=events[_0xabd2('0x5')];_0x346beb<_0x5ec657;_0x346beb++){var _0x1cf9a9=events[_0x346beb];var _0x35b1a9=createListener(_0xabd2('0x6')+_0x1cf9a9,_0x2a6514);FaxAccountEvents['on'](_0x1cf9a9,_0x35b1a9);}}; \ No newline at end of file +var _0x5623=['emit','removeListener','length','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0x351795,_0x3936b1){var _0x2cbe0f=function(_0x54059b){while(--_0x54059b){_0x351795['push'](_0x351795['shift']());}};_0x2cbe0f(++_0x3936b1);}(_0x5623,0x1ac));var _0x3562=function(_0x351800,_0x35bdbf){_0x351800=_0x351800-0x0;var _0x5ef09a=_0x5623[_0x351800];return _0x5ef09a;};'use strict';var FaxAccountEvents=require(_0x3562('0x0'));var events=[_0x3562('0x1'),_0x3562('0x2'),_0x3562('0x3')];function createListener(_0x18cf26,_0x28a109){return function(_0x415467){_0x28a109[_0x3562('0x4')](_0x18cf26,_0x415467);};}function removeListener(_0xe086b7,_0x156467){return function(){FaxAccountEvents[_0x3562('0x5')](_0xe086b7,_0x156467);};}exports['register']=function(_0x2ce63d){for(var _0x301b49=0x0,_0x2e6229=events[_0x3562('0x6')];_0x301b49<_0x2e6229;_0x301b49++){var _0x58072f=events[_0x301b49];var _0x3f88ab=createListener(_0x3562('0x7')+_0x58072f,_0x2ce63d);FaxAccountEvents['on'](_0x58072f,_0x3f88ab);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 6966dd5..18cb124 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 _0xefb7=['/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./faxAccount.controller','isAuthenticated','describe','show','get','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','put'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xefb7,0x85));var _0x7efb=function(_0x5ae8f7,_0x330d91){_0x5ae8f7=_0x5ae8f7-0x0;var _0x54c636=_0xefb7[_0x5ae8f7];return _0x54c636;};'use strict';var multer=require(_0x7efb('0x0'));var util=require('util');var path=require(_0x7efb('0x1'));var timeout=require('connect-timeout');var express=require(_0x7efb('0x2'));var router=express[_0x7efb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7efb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7efb('0x5'));var controller=require(_0x7efb('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x7efb('0x7')](),controller[_0x7efb('0x8')]);router['get']('/:id',auth[_0x7efb('0x7')](),controller[_0x7efb('0x9')]);router[_0x7efb('0xa')](_0x7efb('0xb'),auth[_0x7efb('0x7')](),controller[_0x7efb('0xc')]);router[_0x7efb('0xa')](_0x7efb('0xd'),auth[_0x7efb('0x7')](),controller[_0x7efb('0xe')]);router[_0x7efb('0xa')](_0x7efb('0xf'),auth[_0x7efb('0x7')](),controller[_0x7efb('0x10')]);router['get'](_0x7efb('0x11'),auth[_0x7efb('0x7')](),controller[_0x7efb('0x12')]);router[_0x7efb('0xa')](_0x7efb('0x13'),auth[_0x7efb('0x7')](),controller[_0x7efb('0x14')]);router[_0x7efb('0xa')](_0x7efb('0x15'),auth[_0x7efb('0x7')](),controller[_0x7efb('0x16')]);router[_0x7efb('0x17')]('/',auth[_0x7efb('0x7')](),controller[_0x7efb('0x18')]);router[_0x7efb('0x17')](_0x7efb('0xb'),auth[_0x7efb('0x7')](),controller[_0x7efb('0x19')]);router['post'](_0x7efb('0xd'),auth[_0x7efb('0x7')](),controller[_0x7efb('0x1a')]);router[_0x7efb('0x17')](_0x7efb('0xf'),auth[_0x7efb('0x7')](),controller[_0x7efb('0x1b')]);router['post'](_0x7efb('0x11'),auth[_0x7efb('0x7')](),controller['addApplications']);router['post'](_0x7efb('0x1c'),auth[_0x7efb('0x7')](),controller[_0x7efb('0x1d')]);router[_0x7efb('0x17')](_0x7efb('0x1e'),auth['isAuthenticated'](),controller[_0x7efb('0x1f')]);router['post'](_0x7efb('0x20'),auth[_0x7efb('0x7')](),controller['send']);router[_0x7efb('0x17')](_0x7efb('0x15'),auth[_0x7efb('0x7')](),controller[_0x7efb('0x21')]);router[_0x7efb('0x22')](_0x7efb('0x23'),auth[_0x7efb('0x7')](),controller['update']);router[_0x7efb('0x24')](_0x7efb('0x23'),auth[_0x7efb('0x7')](),controller[_0x7efb('0x25')]);router[_0x7efb('0x24')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x7efb('0x26')]);router[_0x7efb('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x7efb('0x27')]);router[_0x7efb('0x24')](_0x7efb('0x15'),auth[_0x7efb('0x7')](),controller[_0x7efb('0x28')]);module[_0x7efb('0x29')]=router; \ No newline at end of file +var _0x3f6b=['addApplications','addAccountApplications','/updateaccountapplications','/:id/send','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','post','create','addDisposition','addAnswer'];(function(_0x4e7390,_0x38ab2d){var _0x51640e=function(_0x1ce918){while(--_0x1ce918){_0x4e7390['push'](_0x4e7390['shift']());}};_0x51640e(++_0x38ab2d);}(_0x3f6b,0x126));var _0xb3f6=function(_0x5e77c3,_0x4289c2){_0x5e77c3=_0x5e77c3-0x0;var _0x431a21=_0x3f6b[_0x5e77c3];return _0x431a21;};'use strict';var multer=require(_0xb3f6('0x0'));var util=require('util');var path=require(_0xb3f6('0x1'));var timeout=require('connect-timeout');var express=require(_0xb3f6('0x2'));var router=express[_0xb3f6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb3f6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb3f6('0x5'));var controller=require(_0xb3f6('0x6'));router[_0xb3f6('0x7')]('/',auth[_0xb3f6('0x8')](),controller[_0xb3f6('0x9')]);router[_0xb3f6('0x7')](_0xb3f6('0xa'),auth[_0xb3f6('0x8')](),controller[_0xb3f6('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb3f6('0xc')]);router[_0xb3f6('0x7')](_0xb3f6('0xd'),auth['isAuthenticated'](),controller[_0xb3f6('0xe')]);router[_0xb3f6('0x7')](_0xb3f6('0xf'),auth[_0xb3f6('0x8')](),controller['getAnswers']);router['get'](_0xb3f6('0x10'),auth[_0xb3f6('0x8')](),controller[_0xb3f6('0x11')]);router['get'](_0xb3f6('0x12'),auth[_0xb3f6('0x8')](),controller[_0xb3f6('0x13')]);router['get'](_0xb3f6('0x14'),auth[_0xb3f6('0x8')](),controller['getMessages']);router[_0xb3f6('0x7')](_0xb3f6('0x15'),auth['isAuthenticated'](),controller['getAgents']);router[_0xb3f6('0x16')]('/',auth[_0xb3f6('0x8')](),controller[_0xb3f6('0x17')]);router[_0xb3f6('0x16')](_0xb3f6('0xd'),auth['isAuthenticated'](),controller[_0xb3f6('0x18')]);router[_0xb3f6('0x16')](_0xb3f6('0xf'),auth[_0xb3f6('0x8')](),controller[_0xb3f6('0x19')]);router[_0xb3f6('0x16')](_0xb3f6('0x10'),auth[_0xb3f6('0x8')](),controller['addInteraction']);router[_0xb3f6('0x16')](_0xb3f6('0x12'),auth[_0xb3f6('0x8')](),controller[_0xb3f6('0x1a')]);router[_0xb3f6('0x16')]('/addaccountapplications',auth[_0xb3f6('0x8')](),controller[_0xb3f6('0x1b')]);router[_0xb3f6('0x16')](_0xb3f6('0x1c'),auth[_0xb3f6('0x8')](),controller['updateAccountApplications']);router['post'](_0xb3f6('0x1d'),auth[_0xb3f6('0x8')](),controller['send']);router[_0xb3f6('0x16')](_0xb3f6('0x15'),auth[_0xb3f6('0x8')](),controller[_0xb3f6('0x1e')]);router[_0xb3f6('0x1f')](_0xb3f6('0x20'),auth[_0xb3f6('0x8')](),controller[_0xb3f6('0x21')]);router[_0xb3f6('0x22')](_0xb3f6('0x20'),auth[_0xb3f6('0x8')](),controller[_0xb3f6('0x23')]);router[_0xb3f6('0x22')]('/:id/dispositions',auth[_0xb3f6('0x8')](),controller[_0xb3f6('0x24')]);router[_0xb3f6('0x22')](_0xb3f6('0xf'),auth[_0xb3f6('0x8')](),controller[_0xb3f6('0x25')]);router[_0xb3f6('0x22')]('/:id/users',auth['isAuthenticated'](),controller[_0xb3f6('0x26')]);module[_0xb3f6('0x27')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 43c1462..c41c396 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 _0x6aa4=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x307f71,_0x50db95){var _0x26628f=function(_0x3125c7){while(--_0x3125c7){_0x307f71['push'](_0x307f71['shift']());}};_0x26628f(++_0x50db95);}(_0x6aa4,0xc1));var _0x46aa=function(_0x3b142b,_0x40c699){_0x3b142b=_0x3b142b-0x0;var _0x3e09e7=_0x6aa4[_0x3b142b];return _0x3e09e7;};'use strict';var Sequelize=require(_0x46aa('0x0'));module[_0x46aa('0x1')]={'priority':{'type':Sequelize[_0x46aa('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x46aa('0x3')],'allowNull':![],'defaultValue':_0x46aa('0x4')},'appdata':{'type':Sequelize[_0x46aa('0x5')]()},'description':{'type':Sequelize[_0x46aa('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x5817=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x9b3d89,_0x17672f){var _0x24159=function(_0x29b018){while(--_0x29b018){_0x9b3d89['push'](_0x9b3d89['shift']());}};_0x24159(++_0x17672f);}(_0x5817,0x13c));var _0x7581=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x5817[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require('sequelize');module[_0x7581('0x0')]={'priority':{'type':Sequelize[_0x7581('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7581('0x2')],'allowNull':![],'defaultValue':_0x7581('0x3')},'appdata':{'type':Sequelize[_0x7581('0x4')]()},'description':{'type':Sequelize[_0x7581('0x2')]},'interval':{'type':Sequelize[_0x7581('0x2')],'defaultValue':_0x7581('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 094050c..3d6c726 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 _0x87c2=['status','end','offset','undefined','limit','count','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','filter','includeAll','include','findAll','rows','show','params','merge','options','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5e0da7,_0x3cff94){var _0xba99e6=function(_0x45269d){while(--_0x45269d){_0x5e0da7['push'](_0x5e0da7['shift']());}};_0xba99e6(++_0x3cff94);}(_0x87c2,0x18c));var _0x287c=function(_0x4ed6e2,_0x4c4666){_0x4ed6e2=_0x4ed6e2-0x0;var _0x48558a=_0x87c2[_0x4ed6e2];return _0x48558a;};'use strict';var emlformat=require(_0x287c('0x0'));var rimraf=require(_0x287c('0x1'));var zipdir=require(_0x287c('0x2'));var jsonpatch=require(_0x287c('0x3'));var rp=require(_0x287c('0x4'));var moment=require(_0x287c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x287c('0x6'));var util=require(_0x287c('0x7'));var path=require(_0x287c('0x8'));var sox=require(_0x287c('0x9'));var csv=require('to-csv');var ejs=require(_0x287c('0xa'));var fs=require('fs');var fs_extra=require(_0x287c('0xb'));var _=require(_0x287c('0xc'));var squel=require(_0x287c('0xd'));var crypto=require('crypto');var jsforce=require(_0x287c('0xe'));var deskjs=require(_0x287c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x287c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x287c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x287c('0x12'));var hardwareService=require(_0x287c('0x13'));var logger=require(_0x287c('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x287c('0x15'));var licenseUtil=require(_0x287c('0x16'));var db=require(_0x287c('0x17'))['db'];function respondWithStatusCode(_0xa698e4,_0x497309){_0x497309=_0x497309||0xcc;return function(_0x506829){if(_0x506829){return _0xa698e4['sendStatus'](_0x497309);}return _0xa698e4[_0x287c('0x18')](_0x497309)[_0x287c('0x19')]();};}function respondWithResult(_0x52deb2,_0x7fd8f2){_0x7fd8f2=_0x7fd8f2||0xc8;return function(_0x4f537d){if(_0x4f537d){return _0x52deb2[_0x287c('0x18')](_0x7fd8f2)['json'](_0x4f537d);}};}function respondWithFilteredResult(_0x2cddfe,_0x5d0604){return function(_0x22d3f4){if(_0x22d3f4){var _0x42e999=typeof _0x5d0604[_0x287c('0x1a')]===_0x287c('0x1b')&&typeof _0x5d0604[_0x287c('0x1c')]==='undefined';var _0xb5f388=_0x22d3f4[_0x287c('0x1d')];var _0x1e6b31=_0x42e999?0x0:_0x5d0604[_0x287c('0x1a')];var _0x5161c1=_0x42e999?_0x22d3f4[_0x287c('0x1d')]:_0x5d0604[_0x287c('0x1a')]+_0x5d0604[_0x287c('0x1c')];var _0x1cba2c;if(_0x5161c1>=_0xb5f388){_0x5161c1=_0xb5f388;_0x1cba2c=0xc8;}else{_0x1cba2c=0xce;}_0x2cddfe[_0x287c('0x18')](_0x1cba2c);return _0x2cddfe['set']('Content-Range',_0x1e6b31+'-'+_0x5161c1+'/'+_0xb5f388)[_0x287c('0x1e')](_0x22d3f4);}return null;};}function patchUpdates(_0x4de5ed){return function(_0x3a0d86){try{jsonpatch[_0x287c('0x1f')](_0x3a0d86,_0x4de5ed,!![]);}catch(_0x69a620){return BPromise['reject'](_0x69a620);}return _0x3a0d86[_0x287c('0x20')]();};}function saveUpdates(_0x259e66,_0x14103d){return function(_0x3c4cc7){if(_0x3c4cc7){return _0x3c4cc7[_0x287c('0x21')](_0x259e66)[_0x287c('0x22')](function(_0x52db48){return _0x52db48;});}return null;};}function removeEntity(_0x3baa74,_0x2e38f9){return function(_0x435d95){if(_0x435d95){return _0x435d95[_0x287c('0x23')]()[_0x287c('0x22')](function(){_0x3baa74[_0x287c('0x18')](0xcc)[_0x287c('0x19')]();});}};}function handleEntityNotFound(_0x1dfa19,_0x25220e){return function(_0x4c54a3){if(!_0x4c54a3){_0x1dfa19[_0x287c('0x24')](0x194);}return _0x4c54a3;};}function handleError(_0x3b5c0a,_0x56edd6){_0x56edd6=_0x56edd6||0x1f4;return function(_0x25b298){logger[_0x287c('0x25')](_0x25b298[_0x287c('0x26')]);if(_0x25b298['name']){delete _0x25b298[_0x287c('0x27')];}_0x3b5c0a[_0x287c('0x18')](_0x56edd6)[_0x287c('0x28')](_0x25b298);};}exports[_0x287c('0x29')]=function(_0x2541b0,_0x242ffe){var _0x29c96a={},_0x558411={},_0x3f5c03={'count':0x0,'rows':[]};var _0x2a9155=_[_0x287c('0x2a')](db[_0x287c('0x2b')][_0x287c('0x2c')],function(_0xff6746){return{'name':_0xff6746[_0x287c('0x2d')],'type':_0xff6746[_0x287c('0x2e')][_0x287c('0x2f')]};});_0x558411[_0x287c('0x30')]=_['map'](_0x2a9155,_0x287c('0x27'));_0x558411[_0x287c('0x31')]=_['keys'](_0x2541b0[_0x287c('0x31')]);_0x558411['filters']=_[_0x287c('0x32')](_0x558411[_0x287c('0x30')],_0x558411['query']);_0x29c96a['attributes']=_[_0x287c('0x32')](_0x558411[_0x287c('0x30')],qs[_0x287c('0x33')](_0x2541b0[_0x287c('0x31')][_0x287c('0x33')]));_0x29c96a[_0x287c('0x34')]=_0x29c96a[_0x287c('0x34')][_0x287c('0x35')]?_0x29c96a[_0x287c('0x34')]:_0x558411[_0x287c('0x30')];if(!_0x2541b0[_0x287c('0x31')][_0x287c('0x36')]('nolimit')){_0x29c96a[_0x287c('0x1c')]=qs[_0x287c('0x1c')](_0x2541b0['query'][_0x287c('0x1c')]);_0x29c96a[_0x287c('0x1a')]=qs[_0x287c('0x1a')](_0x2541b0[_0x287c('0x31')][_0x287c('0x1a')]);}_0x29c96a['order']=qs['sort'](_0x2541b0[_0x287c('0x31')][_0x287c('0x37')]);_0x29c96a[_0x287c('0x38')]=qs[_0x287c('0x39')](_['pick'](_0x2541b0[_0x287c('0x31')],_0x558411[_0x287c('0x39')]),_0x2a9155);if(_0x2541b0['query'][_0x287c('0x3a')]){_0x29c96a['where']=_['merge'](_0x29c96a[_0x287c('0x38')],{'$or':_['map'](_0x2a9155,function(_0x4609ee){if(_0x4609ee[_0x287c('0x2e')]!=='VIRTUAL'){var _0x368f0c={};_0x368f0c[_0x4609ee[_0x287c('0x27')]]={'$like':'%'+_0x2541b0[_0x287c('0x31')][_0x287c('0x3a')]+'%'};return _0x368f0c;}})});}_0x29c96a=_['merge']({},_0x29c96a,_0x2541b0['options']);var _0x38b2df={'where':_0x29c96a['where']};return db['FaxApplication'][_0x287c('0x1d')](_0x38b2df)[_0x287c('0x22')](function(_0x24f375){_0x3f5c03[_0x287c('0x1d')]=_0x24f375;if(_0x2541b0[_0x287c('0x31')][_0x287c('0x3b')]){_0x29c96a[_0x287c('0x3c')]=[{'all':!![]}];}return db[_0x287c('0x2b')][_0x287c('0x3d')](_0x29c96a);})[_0x287c('0x22')](function(_0x5d4ff6){_0x3f5c03[_0x287c('0x3e')]=_0x5d4ff6;return _0x3f5c03;})[_0x287c('0x22')](respondWithFilteredResult(_0x242ffe,_0x29c96a))['catch'](handleError(_0x242ffe,null));};exports[_0x287c('0x3f')]=function(_0x321648,_0x198807){var _0x11e986={'raw':!![],'where':{'id':_0x321648[_0x287c('0x40')]['id']}},_0x5bfe9c={};_0x5bfe9c[_0x287c('0x30')]=_['keys'](db['FaxApplication']['rawAttributes']);_0x5bfe9c[_0x287c('0x31')]=_['keys'](_0x321648[_0x287c('0x31')]);_0x5bfe9c[_0x287c('0x39')]=_[_0x287c('0x32')](_0x5bfe9c[_0x287c('0x30')],_0x5bfe9c['query']);_0x11e986[_0x287c('0x34')]=_[_0x287c('0x32')](_0x5bfe9c[_0x287c('0x30')],qs[_0x287c('0x33')](_0x321648[_0x287c('0x31')][_0x287c('0x33')]));_0x11e986[_0x287c('0x34')]=_0x11e986[_0x287c('0x34')]['length']?_0x11e986[_0x287c('0x34')]:_0x5bfe9c[_0x287c('0x30')];if(_0x321648['query'][_0x287c('0x3b')]){_0x11e986[_0x287c('0x3c')]=[{'all':!![]}];}_0x11e986=_[_0x287c('0x41')]({},_0x11e986,_0x321648[_0x287c('0x42')]);return db['FaxApplication']['find'](_0x11e986)[_0x287c('0x22')](handleEntityNotFound(_0x198807,null))[_0x287c('0x22')](respondWithResult(_0x198807,null))[_0x287c('0x43')](handleError(_0x198807,null));};exports['create']=function(_0x245dac,_0x57c3da){return db[_0x287c('0x2b')][_0x287c('0x44')](_0x245dac[_0x287c('0x45')],{})[_0x287c('0x22')](respondWithResult(_0x57c3da,0xc9))['catch'](handleError(_0x57c3da,null));};exports[_0x287c('0x21')]=function(_0x33f98f,_0x2e7a99){if(_0x33f98f[_0x287c('0x45')]['id']){delete _0x33f98f[_0x287c('0x45')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x33f98f[_0x287c('0x40')]['id']}})['then'](handleEntityNotFound(_0x2e7a99,null))[_0x287c('0x22')](saveUpdates(_0x33f98f[_0x287c('0x45')],null))[_0x287c('0x22')](respondWithResult(_0x2e7a99,null))['catch'](handleError(_0x2e7a99,null));};exports[_0x287c('0x23')]=function(_0x21b11a,_0x4d42d5){return db['FaxApplication']['find']({'where':{'id':_0x21b11a['params']['id']}})[_0x287c('0x22')](handleEntityNotFound(_0x4d42d5,null))[_0x287c('0x22')](removeEntity(_0x4d42d5,null))[_0x287c('0x43')](handleError(_0x4d42d5,null));}; \ No newline at end of file +var _0x1d6e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','FaxApplication','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x127b7b,_0x3bd98d){var _0x1cafa8=function(_0x2c787d){while(--_0x2c787d){_0x127b7b['push'](_0x127b7b['shift']());}};_0x1cafa8(++_0x3bd98d);}(_0x1d6e,0xdc));var _0xe1d6=function(_0x5c8827,_0x5bc5d7){_0x5c8827=_0x5c8827-0x0;var _0x50ffd5=_0x1d6e[_0x5c8827];return _0x50ffd5;};'use strict';var emlformat=require(_0xe1d6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe1d6('0x1'));var jsonpatch=require(_0xe1d6('0x2'));var rp=require(_0xe1d6('0x3'));var moment=require(_0xe1d6('0x4'));var BPromise=require(_0xe1d6('0x5'));var Mustache=require(_0xe1d6('0x6'));var util=require(_0xe1d6('0x7'));var path=require(_0xe1d6('0x8'));var sox=require(_0xe1d6('0x9'));var csv=require(_0xe1d6('0xa'));var ejs=require(_0xe1d6('0xb'));var fs=require('fs');var fs_extra=require(_0xe1d6('0xc'));var _=require(_0xe1d6('0xd'));var squel=require(_0xe1d6('0xe'));var crypto=require(_0xe1d6('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe1d6('0x10'));var toCsv=require(_0xe1d6('0xa'));var querystring=require(_0xe1d6('0x11'));var Papa=require(_0xe1d6('0x12'));var Redis=require(_0xe1d6('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe1d6('0x14'));var as=require(_0xe1d6('0x15'));var hardwareService=require(_0xe1d6('0x16'));var logger=require(_0xe1d6('0x17'))(_0xe1d6('0x18'));var utils=require(_0xe1d6('0x19'));var config=require(_0xe1d6('0x1a'));var licenseUtil=require(_0xe1d6('0x1b'));var db=require(_0xe1d6('0x1c'))['db'];function respondWithStatusCode(_0x3def10,_0x2a705b){_0x2a705b=_0x2a705b||0xcc;return function(_0x39fd6c){if(_0x39fd6c){return _0x3def10['sendStatus'](_0x2a705b);}return _0x3def10['status'](_0x2a705b)[_0xe1d6('0x1d')]();};}function respondWithResult(_0x256120,_0x7fcbba){_0x7fcbba=_0x7fcbba||0xc8;return function(_0x46319f){if(_0x46319f){return _0x256120[_0xe1d6('0x1e')](_0x7fcbba)[_0xe1d6('0x1f')](_0x46319f);}};}function respondWithFilteredResult(_0x5030e0,_0x401ca3){return function(_0x226d5){if(_0x226d5){var _0x29e9ff=typeof _0x401ca3[_0xe1d6('0x20')]===_0xe1d6('0x21')&&typeof _0x401ca3['limit']===_0xe1d6('0x21');var _0x3dfbd6=_0x226d5['count'];var _0x1d3fbb=_0x29e9ff?0x0:_0x401ca3['offset'];var _0x3e4239=_0x29e9ff?_0x226d5[_0xe1d6('0x22')]:_0x401ca3['offset']+_0x401ca3[_0xe1d6('0x23')];var _0x1331c6;if(_0x3e4239>=_0x3dfbd6){_0x3e4239=_0x3dfbd6;_0x1331c6=0xc8;}else{_0x1331c6=0xce;}_0x5030e0[_0xe1d6('0x1e')](_0x1331c6);return _0x5030e0[_0xe1d6('0x24')](_0xe1d6('0x25'),_0x1d3fbb+'-'+_0x3e4239+'/'+_0x3dfbd6)[_0xe1d6('0x1f')](_0x226d5);}return null;};}function patchUpdates(_0x15bef7){return function(_0x66e68a){try{jsonpatch[_0xe1d6('0x26')](_0x66e68a,_0x15bef7,!![]);}catch(_0x2ffe19){return BPromise['reject'](_0x2ffe19);}return _0x66e68a[_0xe1d6('0x27')]();};}function saveUpdates(_0x95c2c7,_0x17578c){return function(_0x39a920){if(_0x39a920){return _0x39a920[_0xe1d6('0x28')](_0x95c2c7)[_0xe1d6('0x29')](function(_0x2c9277){return _0x2c9277;});}return null;};}function removeEntity(_0x3526a3,_0x196bd9){return function(_0x2004eb){if(_0x2004eb){return _0x2004eb[_0xe1d6('0x2a')]()['then'](function(){_0x3526a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15c534,_0x3c4bf2){return function(_0x1f1165){if(!_0x1f1165){_0x15c534[_0xe1d6('0x2b')](0x194);}return _0x1f1165;};}function handleError(_0x403b7b,_0x157477){_0x157477=_0x157477||0x1f4;return function(_0x8b9558){logger[_0xe1d6('0x2c')](_0x8b9558['stack']);if(_0x8b9558['name']){delete _0x8b9558[_0xe1d6('0x2d')];}_0x403b7b[_0xe1d6('0x1e')](_0x157477)[_0xe1d6('0x2e')](_0x8b9558);};}exports[_0xe1d6('0x2f')]=function(_0x377f19,_0x50d26a){var _0x5c52dd={},_0x58b6c0={},_0x29cf1e={'count':0x0,'rows':[]};var _0x324d22=_[_0xe1d6('0x30')](db[_0xe1d6('0x31')][_0xe1d6('0x32')],function(_0x263b0e){return{'name':_0x263b0e[_0xe1d6('0x33')],'type':_0x263b0e['type'][_0xe1d6('0x34')]};});_0x58b6c0[_0xe1d6('0x35')]=_[_0xe1d6('0x30')](_0x324d22,_0xe1d6('0x2d'));_0x58b6c0[_0xe1d6('0x36')]=_['keys'](_0x377f19[_0xe1d6('0x36')]);_0x58b6c0[_0xe1d6('0x37')]=_[_0xe1d6('0x38')](_0x58b6c0[_0xe1d6('0x35')],_0x58b6c0[_0xe1d6('0x36')]);_0x5c52dd[_0xe1d6('0x39')]=_['intersection'](_0x58b6c0[_0xe1d6('0x35')],qs[_0xe1d6('0x3a')](_0x377f19['query'][_0xe1d6('0x3a')]));_0x5c52dd['attributes']=_0x5c52dd['attributes'][_0xe1d6('0x3b')]?_0x5c52dd['attributes']:_0x58b6c0[_0xe1d6('0x35')];if(!_0x377f19['query'][_0xe1d6('0x3c')](_0xe1d6('0x3d'))){_0x5c52dd[_0xe1d6('0x23')]=qs[_0xe1d6('0x23')](_0x377f19[_0xe1d6('0x36')]['limit']);_0x5c52dd['offset']=qs[_0xe1d6('0x20')](_0x377f19[_0xe1d6('0x36')]['offset']);}_0x5c52dd['order']=qs[_0xe1d6('0x3e')](_0x377f19[_0xe1d6('0x36')][_0xe1d6('0x3e')]);_0x5c52dd[_0xe1d6('0x3f')]=qs[_0xe1d6('0x37')](_['pick'](_0x377f19[_0xe1d6('0x36')],_0x58b6c0[_0xe1d6('0x37')]),_0x324d22);if(_0x377f19[_0xe1d6('0x36')][_0xe1d6('0x40')]){_0x5c52dd[_0xe1d6('0x3f')]=_[_0xe1d6('0x41')](_0x5c52dd[_0xe1d6('0x3f')],{'$or':_[_0xe1d6('0x30')](_0x324d22,function(_0x59e73b){if(_0x59e73b[_0xe1d6('0x42')]!==_0xe1d6('0x43')){var _0x9a8fd5={};_0x9a8fd5[_0x59e73b[_0xe1d6('0x2d')]]={'$like':'%'+_0x377f19['query'][_0xe1d6('0x40')]+'%'};return _0x9a8fd5;}})});}_0x5c52dd=_[_0xe1d6('0x41')]({},_0x5c52dd,_0x377f19[_0xe1d6('0x44')]);var _0x1c703b={'where':_0x5c52dd[_0xe1d6('0x3f')]};return db[_0xe1d6('0x31')][_0xe1d6('0x22')](_0x1c703b)['then'](function(_0x11a504){_0x29cf1e[_0xe1d6('0x22')]=_0x11a504;if(_0x377f19['query'][_0xe1d6('0x45')]){_0x5c52dd[_0xe1d6('0x46')]=[{'all':!![]}];}return db[_0xe1d6('0x31')][_0xe1d6('0x47')](_0x5c52dd);})[_0xe1d6('0x29')](function(_0xb21608){_0x29cf1e[_0xe1d6('0x48')]=_0xb21608;return _0x29cf1e;})[_0xe1d6('0x29')](respondWithFilteredResult(_0x50d26a,_0x5c52dd))[_0xe1d6('0x49')](handleError(_0x50d26a,null));};exports[_0xe1d6('0x4a')]=function(_0x3157c6,_0x2cd7df){var _0x2a3ce2={'raw':!![],'where':{'id':_0x3157c6[_0xe1d6('0x4b')]['id']}},_0x3b90a0={};_0x3b90a0[_0xe1d6('0x35')]=_[_0xe1d6('0x4c')](db['FaxApplication'][_0xe1d6('0x32')]);_0x3b90a0[_0xe1d6('0x36')]=_[_0xe1d6('0x4c')](_0x3157c6[_0xe1d6('0x36')]);_0x3b90a0['filters']=_[_0xe1d6('0x38')](_0x3b90a0[_0xe1d6('0x35')],_0x3b90a0[_0xe1d6('0x36')]);_0x2a3ce2[_0xe1d6('0x39')]=_[_0xe1d6('0x38')](_0x3b90a0[_0xe1d6('0x35')],qs['fields'](_0x3157c6[_0xe1d6('0x36')][_0xe1d6('0x3a')]));_0x2a3ce2[_0xe1d6('0x39')]=_0x2a3ce2[_0xe1d6('0x39')][_0xe1d6('0x3b')]?_0x2a3ce2['attributes']:_0x3b90a0[_0xe1d6('0x35')];if(_0x3157c6[_0xe1d6('0x36')][_0xe1d6('0x45')]){_0x2a3ce2[_0xe1d6('0x46')]=[{'all':!![]}];}_0x2a3ce2=_[_0xe1d6('0x41')]({},_0x2a3ce2,_0x3157c6[_0xe1d6('0x44')]);return db[_0xe1d6('0x31')][_0xe1d6('0x4d')](_0x2a3ce2)[_0xe1d6('0x29')](handleEntityNotFound(_0x2cd7df,null))[_0xe1d6('0x29')](respondWithResult(_0x2cd7df,null))['catch'](handleError(_0x2cd7df,null));};exports[_0xe1d6('0x4e')]=function(_0x497050,_0x46cfad){return db[_0xe1d6('0x31')][_0xe1d6('0x4e')](_0x497050['body'],{})[_0xe1d6('0x29')](respondWithResult(_0x46cfad,0xc9))[_0xe1d6('0x49')](handleError(_0x46cfad,null));};exports[_0xe1d6('0x28')]=function(_0x472fe3,_0x229794){if(_0x472fe3[_0xe1d6('0x4f')]['id']){delete _0x472fe3[_0xe1d6('0x4f')]['id'];}return db[_0xe1d6('0x31')][_0xe1d6('0x4d')]({'where':{'id':_0x472fe3[_0xe1d6('0x4b')]['id']}})[_0xe1d6('0x29')](handleEntityNotFound(_0x229794,null))[_0xe1d6('0x29')](saveUpdates(_0x472fe3[_0xe1d6('0x4f')],null))[_0xe1d6('0x29')](respondWithResult(_0x229794,null))[_0xe1d6('0x49')](handleError(_0x229794,null));};exports[_0xe1d6('0x2a')]=function(_0x280a22,_0x26dd9d){return db[_0xe1d6('0x31')]['find']({'where':{'id':_0x280a22['params']['id']}})[_0xe1d6('0x29')](handleEntityNotFound(_0x26dd9d,null))[_0xe1d6('0x29')](removeEntity(_0x26dd9d,null))[_0xe1d6('0x49')](handleError(_0x26dd9d,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index b18df28..eaef862 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 _0xdd5a=['utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','FaxApplication'];(function(_0x5c7ff5,_0x50506a){var _0x29824c=function(_0x28e05a){while(--_0x28e05a){_0x5c7ff5['push'](_0x5c7ff5['shift']());}};_0x29824c(++_0x50506a);}(_0xdd5a,0x10a));var _0xadd5=function(_0x15765b,_0x17f135){_0x15765b=_0x15765b-0x0;var _0x33914d=_0xdd5a[_0x15765b];return _0x33914d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xadd5('0x0'))(_0xadd5('0x1'));var moment=require(_0xadd5('0x2'));var BPromise=require(_0xadd5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xadd5('0x4'));var rimraf=require(_0xadd5('0x5'));var config=require(_0xadd5('0x6'));var attributes=require('./faxApplication.attributes');module[_0xadd5('0x7')]=function(_0xa681a5,_0x2eaf4b){return _0xa681a5['define'](_0xadd5('0x8'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xadd5('0x9'),'collate':_0xadd5('0xa')});}; \ No newline at end of file +var _0xd32b=['rimraf','./faxApplication.attributes','exports','define','fax_applications','api','moment','bluebird','path'];(function(_0x5a43b8,_0x2e0eb2){var _0x26eeef=function(_0x4b1451){while(--_0x4b1451){_0x5a43b8['push'](_0x5a43b8['shift']());}};_0x26eeef(++_0x2e0eb2);}(_0xd32b,0xd4));var _0xbd32=function(_0x53e6b1,_0x944690){_0x53e6b1=_0x53e6b1-0x0;var _0x13e2a0=_0xd32b[_0x53e6b1];return _0x13e2a0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbd32('0x0'));var moment=require(_0xbd32('0x1'));var BPromise=require(_0xbd32('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd32('0x3'));var rimraf=require(_0xbd32('0x4'));var config=require('../../config/environment');var attributes=require(_0xbd32('0x5'));module[_0xbd32('0x6')]=function(_0x4bb223,_0xfcb797){return _0x4bb223[_0xbd32('0x7')]('FaxApplication',attributes,{'tableName':_0xbd32('0x8'),'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 db13c7d..a05d20f 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 _0x4244=['client','request','then','info','request\x20sent','debug','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','limit','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5a0424,_0x4be292){var _0x2e5692=function(_0x25411e){while(--_0x25411e){_0x5a0424['push'](_0x5a0424['shift']());}};_0x2e5692(++_0x4be292);}(_0x4244,0x68));var _0x4424=function(_0x258ad0,_0xc15ade){_0x258ad0=_0x258ad0-0x0;var _0x14ad52=_0x4244[_0x258ad0];return _0x14ad52;};'use strict';var _=require('lodash');var util=require(_0x4424('0x0'));var moment=require(_0x4424('0x1'));var BPromise=require('bluebird');var rs=require(_0x4424('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4424('0x3'))['db'];var utils=require(_0x4424('0x4'));var logger=require(_0x4424('0x5'))(_0x4424('0x6'));var config=require('../../config/environment');var jayson=require(_0x4424('0x7'));var client=jayson[_0x4424('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28e41f,_0x44a92f,_0x192e35){return new BPromise(function(_0x42f3b0,_0x132fb3){return client[_0x4424('0x9')](_0x28e41f,_0x192e35)[_0x4424('0xa')](function(_0x4e3043){logger[_0x4424('0xb')]('FaxApplication,\x20%s,\x20%s',_0x44a92f,_0x4424('0xc'));logger[_0x4424('0xd')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x44a92f,_0x4424('0xc'),JSON[_0x4424('0xe')](_0x4e3043));if(_0x4e3043['error']){if(_0x4e3043[_0x4424('0xf')][_0x4424('0x10')]===0x1f4){logger[_0x4424('0xf')](_0x4424('0x11'),_0x44a92f,_0x4e3043['error'][_0x4424('0x12')]);return _0x132fb3(_0x4e3043[_0x4424('0xf')][_0x4424('0x12')]);}logger[_0x4424('0xf')](_0x4424('0x11'),_0x44a92f,_0x4e3043['error']['message']);return _0x42f3b0(_0x4e3043[_0x4424('0xf')][_0x4424('0x12')]);}else{logger['info'](_0x4424('0x11'),_0x44a92f,_0x4424('0xc'));_0x42f3b0(_0x4e3043[_0x4424('0x13')]['message']);}})[_0x4424('0x14')](function(_0x350cbc){logger[_0x4424('0xf')]('FaxApplication,\x20%s,\x20%s',_0x44a92f,_0x350cbc);_0x132fb3(_0x350cbc);});});}exports[_0x4424('0x15')]=function(_0xe112b0){var _0x48bf3d=this;return new Promise(function(_0x26ac51,_0xae57d5){return db[_0x4424('0x16')][_0x4424('0x17')](_0xe112b0[_0x4424('0x18')],{'raw':_0xe112b0[_0x4424('0x19')]?_0xe112b0[_0x4424('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe112b0[_0x4424('0x19')]?_0xe112b0[_0x4424('0x19')][_0x4424('0x1a')]||null:null,'attributes':_0xe112b0[_0x4424('0x19')]?_0xe112b0[_0x4424('0x19')]['attributes']||null:null,'limit':_0xe112b0[_0x4424('0x19')]?_0xe112b0[_0x4424('0x19')][_0x4424('0x1b')]||null:null})[_0x4424('0xa')](function(_0x62f63b){logger[_0x4424('0xb')](_0x4424('0x15'),_0xe112b0);logger[_0x4424('0xd')](_0x4424('0x15'),_0xe112b0,JSON[_0x4424('0xe')](_0x62f63b));_0x26ac51(_0x62f63b);})[_0x4424('0x14')](function(_0x36cb97){logger[_0x4424('0xf')](_0x4424('0x15'),_0x36cb97[_0x4424('0x12')],_0xe112b0);_0xae57d5(_0x48bf3d[_0x4424('0xf')](0x1f4,_0x36cb97[_0x4424('0x12')]));});});}; \ No newline at end of file +var _0x019f=['error','message','UpdateFaxApplication','update','body','options','where','attributes','limit','then','stringify','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x19347b,_0x476e16){var _0x5be34b=function(_0x10736a){while(--_0x10736a){_0x19347b['push'](_0x19347b['shift']());}};_0x5be34b(++_0x476e16);}(_0x019f,0xfc));var _0xf019=function(_0x42764d,_0x332a27){_0x42764d=_0x42764d-0x0;var _0x2a643c=_0x019f[_0x42764d];return _0x2a643c;};'use strict';var _=require('lodash');var util=require(_0xf019('0x0'));var moment=require('moment');var BPromise=require(_0xf019('0x1'));var rs=require(_0xf019('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf019('0x3'));var logger=require(_0xf019('0x4'))(_0xf019('0x5'));var config=require('../../config/environment');var jayson=require(_0xf019('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xdaeeb4,_0xafdd66,_0x14b502){return new BPromise(function(_0x5a360d,_0x1ac0bb){return client[_0xf019('0x7')](_0xdaeeb4,_0x14b502)['then'](function(_0x3514ba){logger[_0xf019('0x8')](_0xf019('0x9'),_0xafdd66,_0xf019('0xa'));logger[_0xf019('0xb')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0xafdd66,_0xf019('0xa'),JSON['stringify'](_0x3514ba));if(_0x3514ba[_0xf019('0xc')]){if(_0x3514ba[_0xf019('0xc')]['code']===0x1f4){logger[_0xf019('0xc')](_0xf019('0x9'),_0xafdd66,_0x3514ba[_0xf019('0xc')][_0xf019('0xd')]);return _0x1ac0bb(_0x3514ba[_0xf019('0xc')][_0xf019('0xd')]);}logger[_0xf019('0xc')](_0xf019('0x9'),_0xafdd66,_0x3514ba['error'][_0xf019('0xd')]);return _0x5a360d(_0x3514ba[_0xf019('0xc')][_0xf019('0xd')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0xafdd66,_0xf019('0xa'));_0x5a360d(_0x3514ba['result'][_0xf019('0xd')]);}})['catch'](function(_0x2aacc9){logger['error']('FaxApplication,\x20%s,\x20%s',_0xafdd66,_0x2aacc9);_0x1ac0bb(_0x2aacc9);});});}exports[_0xf019('0xe')]=function(_0x4c549d){var _0x9cd397=this;return new Promise(function(_0x27bf8c,_0xa8d5ea){return db['FaxApplication'][_0xf019('0xf')](_0x4c549d[_0xf019('0x10')],{'raw':_0x4c549d['options']?_0x4c549d[_0xf019('0x11')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c549d['options']?_0x4c549d[_0xf019('0x11')][_0xf019('0x12')]||null:null,'attributes':_0x4c549d[_0xf019('0x11')]?_0x4c549d[_0xf019('0x11')][_0xf019('0x13')]||null:null,'limit':_0x4c549d[_0xf019('0x11')]?_0x4c549d[_0xf019('0x11')][_0xf019('0x14')]||null:null})[_0xf019('0x15')](function(_0x283947){logger[_0xf019('0x8')](_0xf019('0xe'),_0x4c549d);logger['debug']('UpdateFaxApplication',_0x4c549d,JSON[_0xf019('0x16')](_0x283947));_0x27bf8c(_0x283947);})[_0xf019('0x17')](function(_0x113d61){logger[_0xf019('0xc')](_0xf019('0xe'),_0x113d61[_0xf019('0xd')],_0x4c549d);_0xa8d5ea(_0x9cd397[_0xf019('0xc')](0x1f4,_0x113d61['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 6a35815..2daa721 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 _0xdd4f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','express'];(function(_0xe7044c,_0x485cb8){var _0x4a74b5=function(_0x4db4cf){while(--_0x4db4cf){_0xe7044c['push'](_0xe7044c['shift']());}};_0x4a74b5(++_0x485cb8);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x293614,_0x2fa0cc){_0x293614=_0x293614-0x0;var _0x583a11=_0xdd4f[_0x293614];return _0x583a11;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfdd4('0x3'));var interaction=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var controller=require('./faxApplication.controller');router[_0xfdd4('0x6')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x8')]);router[_0xfdd4('0x6')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xa')]);router['post']('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xb')]);router[_0xfdd4('0xc')]('/:id',auth[_0xfdd4('0x7')](),controller['update']);router[_0xfdd4('0xd')](_0xfdd4('0x9'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xe')]);module[_0xfdd4('0xf')]=router; \ No newline at end of file +var _0xe511=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','show','post','put'];(function(_0x349e38,_0x49c65a){var _0x1e79f5=function(_0xd451fa){while(--_0xd451fa){_0x349e38['push'](_0x349e38['shift']());}};_0x1e79f5(++_0x49c65a);}(_0xe511,0x16f));var _0x1e51=function(_0x45d1fa,_0x2ff76f){_0x45d1fa=_0x45d1fa-0x0;var _0x380621=_0xe511[_0x45d1fa];return _0x380621;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1e51('0xc')](_0x1e51('0xd'),auth[_0x1e51('0xe')](),controller[_0x1e51('0xf')]);router[_0x1e51('0x10')](_0x1e51('0xd'),auth['isAuthenticated'](),controller[_0x1e51('0x11')]);module[_0x1e51('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index c524011..9c41218 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 _0xe2fe=['DATE','STRING','out','INTEGER','sequelize'];(function(_0x5c54c3,_0x38bc22){var _0x1b6a56=function(_0x19414){while(--_0x19414){_0x5c54c3['push'](_0x5c54c3['shift']());}};_0x1b6a56(++_0x38bc22);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xee2f('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xee2f('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xee2f('0x2')]},'thirdDisposition':{'type':Sequelize[_0xee2f('0x2')]},'note':{'type':Sequelize[_0xee2f('0x2')]},'read1stAt':{'type':Sequelize[_0xee2f('0x1')]},'fax':{'type':Sequelize[_0xee2f('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xee2f('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xee2f('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xee2f('0x3')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xee2f('0x4')]}}; \ No newline at end of file +var _0x0295=['out','sequelize','DATE','STRING','ENUM'];(function(_0x5aec27,_0x4a50fa){var _0x42bd67=function(_0x5ee8fb){while(--_0x5ee8fb){_0x5aec27['push'](_0x5aec27['shift']());}};_0x42bd67(++_0x4a50fa);}(_0x0295,0x1f0));var _0x5029=function(_0x79ef34,_0x42d1a1){_0x79ef34=_0x79ef34-0x0;var _0x43d708=_0x0295[_0x79ef34];return _0x43d708;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5029('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5029('0x2')]},'note':{'type':Sequelize[_0x5029('0x2')]},'read1stAt':{'type':Sequelize[_0x5029('0x1')]},'fax':{'type':Sequelize[_0x5029('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x5029('0x3')]('in',_0x5029('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5029('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x5029('0x3')]('in',_0x5029('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 41880e9..2afe9e0 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 _0x9b92=['keys','filters','intersection','attributes','fields','length','query','includeAll','merge','find','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','map','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','resolve','download','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','error','stack','name','send','index','key','getOptions','findAll','user','catch','show','params','model','FaxInteraction','rawAttributes'];(function(_0x4ed007,_0x2b0a98){var _0xb46b9d=function(_0x1f7d0f){while(--_0x1f7d0f){_0x4ed007['push'](_0x4ed007['shift']());}};_0xb46b9d(++_0x2b0a98);}(_0x9b92,0xaf));var _0x29b9=function(_0x448747,_0x52303a){_0x448747=_0x448747-0x0;var _0x34b9f4=_0x9b92[_0x448747];return _0x34b9f4;};'use strict';var rimraf=require(_0x29b9('0x0'));var zipdir=require(_0x29b9('0x1'));var moment=require(_0x29b9('0x2'));var BPromise=require(_0x29b9('0x3'));var util=require('util');var path=require(_0x29b9('0x4'));var fs=require('fs');var _=require(_0x29b9('0x5'));var Redis=require(_0x29b9('0x6'));var interaction=require(_0x29b9('0x7'));var qs=require(_0x29b9('0x8'));var logger=require('../../config/logger')(_0x29b9('0x9'));var config=require(_0x29b9('0xa'));var db=require(_0x29b9('0xb'))['db'];config['redis']=_[_0x29b9('0xc')](config[_0x29b9('0xd')],{'host':_0x29b9('0xe'),'port':0x18eb});var socket=require(_0x29b9('0xf'))(new Redis(config[_0x29b9('0xd')]));require(_0x29b9('0x10'))[_0x29b9('0x11')](socket);function respondWithStatusCode(_0x20b3d3,_0x517b75){_0x517b75=_0x517b75||0xcc;return function(_0x587a1d){if(_0x587a1d){return _0x20b3d3[_0x29b9('0x12')](_0x517b75);}return _0x20b3d3[_0x29b9('0x13')](_0x517b75)['end']();};}function respondWithResult(_0x1d0409,_0x2e4496){_0x2e4496=_0x2e4496||0xc8;return function(_0x1013f3){if(_0x1013f3){return _0x1d0409[_0x29b9('0x13')](_0x2e4496)[_0x29b9('0x14')](_0x1013f3);}};}function respondWithFilteredResult(_0x3f498e,_0x25f5d5){return function(_0x4e1002){if(_0x4e1002){var _0x3cf2fd=typeof _0x25f5d5[_0x29b9('0x15')]===_0x29b9('0x16')&&typeof _0x25f5d5[_0x29b9('0x17')]===_0x29b9('0x16');var _0x24b339=_0x4e1002['count'];var _0x474a18=_0x3cf2fd?0x0:_0x25f5d5[_0x29b9('0x15')];var _0x50fa92=_0x3cf2fd?_0x4e1002[_0x29b9('0x18')]:_0x25f5d5['offset']+_0x25f5d5['limit'];var _0x16c73e;if(_0x50fa92>=_0x24b339){_0x50fa92=_0x24b339;_0x16c73e=0xc8;}else{_0x16c73e=0xce;}_0x3f498e[_0x29b9('0x13')](_0x16c73e);return _0x3f498e[_0x29b9('0x19')](_0x29b9('0x1a'),_0x474a18+'-'+_0x50fa92+'/'+_0x24b339)[_0x29b9('0x14')](_0x4e1002);}return null;};}function saveUpdates(_0x5e5704){return function(_0x520cda){if(_0x520cda){return _0x520cda['update'](_0x5e5704)[_0x29b9('0x1b')](function(_0x5e036b){return _0x5e036b;});}return null;};}function removeEntity(_0x32af5c){return function(_0x2f91e7){if(_0x2f91e7){return _0x2f91e7[_0x29b9('0x1c')]()['then'](function(){_0x32af5c[_0x29b9('0x13')](0xcc)[_0x29b9('0x1d')]();});}};}function handleEntityNotFound(_0x52d762){return function(_0x56ed6c){if(!_0x56ed6c){_0x52d762[_0x29b9('0x12')](0x194);}return _0x56ed6c;};}function handleError(_0x531b3,_0x8491dd){_0x8491dd=_0x8491dd||0x1f4;return function(_0xc8cd44){logger[_0x29b9('0x1e')](_0xc8cd44[_0x29b9('0x1f')]);if(_0xc8cd44[_0x29b9('0x20')]){delete _0xc8cd44[_0x29b9('0x20')];}_0x531b3[_0x29b9('0x13')](_0x8491dd)[_0x29b9('0x21')](_0xc8cd44);};}exports[_0x29b9('0x22')]=function(_0x479319,_0x3f19bb){var _0x1efa80={};var _0x5a43eb=_['map'](db['FaxInteraction']['rawAttributes'],function(_0x5c9e9e){return{'name':_0x5c9e9e['fieldName'],'type':_0x5c9e9e['type'][_0x29b9('0x23')]};});_0x1efa80=qs[_0x29b9('0x24')](_0x5a43eb,_0x479319);return interaction[_0x29b9('0x25')]('fax',_0x479319['query'],_0x479319[_0x29b9('0x26')],_0x1efa80,_0x5a43eb)[_0x29b9('0x1b')](respondWithFilteredResult(_0x3f19bb,_0x1efa80))[_0x29b9('0x27')](handleError(_0x3f19bb,null));};exports[_0x29b9('0x28')]=function(_0x50e5a1,_0x5e1020){var _0x52bac7={'raw':![],'where':{'id':_0x50e5a1[_0x29b9('0x29')]['id']}},_0x5891f5={};_0x5891f5[_0x29b9('0x2a')]=_['keys'](db[_0x29b9('0x2b')][_0x29b9('0x2c')]);_0x5891f5['query']=_[_0x29b9('0x2d')](_0x50e5a1['query']);_0x5891f5[_0x29b9('0x2e')]=_[_0x29b9('0x2f')](_0x5891f5[_0x29b9('0x2a')],_0x5891f5['query']);_0x52bac7[_0x29b9('0x30')]=_['intersection'](_0x5891f5[_0x29b9('0x2a')],qs[_0x29b9('0x31')](_0x50e5a1['query'][_0x29b9('0x31')]));_0x52bac7[_0x29b9('0x30')]=_0x52bac7[_0x29b9('0x30')][_0x29b9('0x32')]?_0x52bac7[_0x29b9('0x30')]:_0x5891f5[_0x29b9('0x2a')];if(_0x50e5a1[_0x29b9('0x33')][_0x29b9('0x34')]){_0x52bac7['include']=[{'all':!![]}];}_0x52bac7=_[_0x29b9('0x35')]({},_0x52bac7,_0x50e5a1['options']);return db[_0x29b9('0x2b')][_0x29b9('0x36')](_0x52bac7)['then'](handleEntityNotFound(_0x5e1020,null))['then'](respondWithResult(_0x5e1020,null))[_0x29b9('0x27')](handleError(_0x5e1020,null));};exports[_0x29b9('0x37')]=function(_0x2080f0,_0x289c3a){return db[_0x29b9('0x2b')][_0x29b9('0x37')](_0x2080f0[_0x29b9('0x38')],{})['then'](respondWithResult(_0x289c3a,0xc9))[_0x29b9('0x27')](handleError(_0x289c3a,null));};exports['update']=function(_0x27cfd5,_0x1e8369){if(_0x27cfd5['body']['id']){delete _0x27cfd5[_0x29b9('0x38')]['id'];}return db[_0x29b9('0x2b')]['find']({'where':{'id':_0x27cfd5['params']['id']}})[_0x29b9('0x1b')](handleEntityNotFound(_0x1e8369,null))[_0x29b9('0x1b')](saveUpdates(_0x27cfd5[_0x29b9('0x38')],null))[_0x29b9('0x1b')](respondWithResult(_0x1e8369,null))[_0x29b9('0x27')](handleError(_0x1e8369,null));};exports[_0x29b9('0x1c')]=function(_0x981bb1,_0x46547d){return db[_0x29b9('0x2b')][_0x29b9('0x36')]({'where':{'id':_0x981bb1[_0x29b9('0x29')]['id']}})['then'](handleEntityNotFound(_0x46547d,null))[_0x29b9('0x1b')](removeEntity(_0x46547d,null))[_0x29b9('0x27')](handleError(_0x46547d,null));};exports[_0x29b9('0x39')]=function(_0x245469,_0x26698d){return db[_0x29b9('0x2b')][_0x29b9('0x39')]()['then'](respondWithResult(_0x26698d,null))[_0x29b9('0x27')](handleError(_0x26698d,null));};exports[_0x29b9('0x3a')]=function(_0x48a1cf,_0x1945a5){return db[_0x29b9('0x3b')][_0x29b9('0x36')]({'where':{'id':_0x48a1cf['params']['id']}})[_0x29b9('0x1b')](handleEntityNotFound(_0x1945a5,null))[_0x29b9('0x1b')](function(_0x1d1138){if(_0x1d1138){return _0x1d1138[_0x29b9('0x3a')](_0x48a1cf['body'][_0x29b9('0x3c')],_[_0x29b9('0x3d')](_0x48a1cf[_0x29b9('0x38')],[_0x29b9('0x3c'),'id'])||{});}})[_0x29b9('0x1b')](respondWithResult(_0x1945a5,null))[_0x29b9('0x27')](handleError(_0x1945a5,null));};exports[_0x29b9('0x3e')]=function(_0x4a968d,_0x4c4f98){var _0x1da90a={'raw':![],'where':{}};var _0x51b3d3={};var _0x15c161={'count':0x0,'rows':[]};return db[_0x29b9('0x2b')][_0x29b9('0x3f')]({'where':{'id':_0x4a968d[_0x29b9('0x29')]['id']}})['then'](handleEntityNotFound(_0x4c4f98,null))[_0x29b9('0x1b')](function(_0x53c851){if(_0x53c851){_0x51b3d3['model']=_[_0x29b9('0x2d')](db[_0x29b9('0x3b')]['rawAttributes']);_0x51b3d3[_0x29b9('0x33')]=_['keys'](_0x4a968d['query']);_0x51b3d3[_0x29b9('0x2e')]=_[_0x29b9('0x2f')](_0x51b3d3[_0x29b9('0x2a')],_0x51b3d3[_0x29b9('0x33')]);_0x1da90a[_0x29b9('0x30')]=_[_0x29b9('0x2f')](_0x51b3d3[_0x29b9('0x2a')],qs[_0x29b9('0x31')](_0x4a968d[_0x29b9('0x33')][_0x29b9('0x31')]));_0x1da90a[_0x29b9('0x30')]=_0x1da90a[_0x29b9('0x30')]['length']?_0x1da90a[_0x29b9('0x30')]:_0x51b3d3[_0x29b9('0x2a')];if(!_0x4a968d['query'][_0x29b9('0x40')](_0x29b9('0x41'))){_0x1da90a[_0x29b9('0x17')]=qs['limit'](_0x4a968d[_0x29b9('0x33')][_0x29b9('0x17')]);_0x1da90a[_0x29b9('0x15')]=qs[_0x29b9('0x15')](_0x4a968d[_0x29b9('0x33')][_0x29b9('0x15')]);}_0x1da90a[_0x29b9('0x42')]=qs[_0x29b9('0x43')](_0x4a968d['query'][_0x29b9('0x43')]);_0x1da90a[_0x29b9('0x44')]=qs[_0x29b9('0x2e')](_[_0x29b9('0x45')](_0x4a968d[_0x29b9('0x33')],_0x51b3d3[_0x29b9('0x2e')]));_0x1da90a['where'][_0x29b9('0x46')]=_0x53c851['id'];if(_0x4a968d[_0x29b9('0x33')]['filter']){_0x1da90a[_0x29b9('0x44')]=_[_0x29b9('0x35')](_0x1da90a[_0x29b9('0x44')],{'$or':_[_0x29b9('0x47')](_0x1da90a[_0x29b9('0x30')],function(_0x1934f3){var _0x2102d4={};_0x2102d4[_0x1934f3]={'$like':'%'+_0x4a968d['query'][_0x29b9('0x48')]+'%'};return _0x2102d4;})});}if(_0x4a968d[_0x29b9('0x33')][_0x29b9('0x49')]){var _0x5b5ee4=_0x4a968d[_0x29b9('0x33')][_0x29b9('0x49')][_0x29b9('0x4a')](',');var _0x218184={};_0x218184[_0x5b5ee4[0x0]]={'$gte':moment(_0x5b5ee4[0x1])[_0x29b9('0x4b')](_0x29b9('0x4c'))};_0x1da90a[_0x29b9('0x44')]=_[_0x29b9('0x35')](_0x1da90a[_0x29b9('0x44')],_0x218184);}_0x1da90a=_[_0x29b9('0x35')]({},_0x1da90a,_0x4a968d[_0x29b9('0x4d')]);return db['FaxMessage'][_0x29b9('0x18')]({'where':_0x1da90a[_0x29b9('0x44')]})[_0x29b9('0x1b')](function(_0x3c1ec5){_0x15c161['count']=_0x3c1ec5;if(_0x4a968d[_0x29b9('0x33')]['includeAll']){_0x1da90a['include']=[{'all':!![]}];}return db[_0x29b9('0x3b')][_0x29b9('0x25')](_0x1da90a);})['then'](function(_0x2f18ef){_0x15c161[_0x29b9('0x4e')]=_0x2f18ef;return _0x15c161;});}})[_0x29b9('0x1b')](respondWithFilteredResult(_0x4c4f98,_0x1da90a))[_0x29b9('0x27')](handleError(_0x4c4f98,null));};exports[_0x29b9('0x4f')]=function(_0x540854,_0x48e1f4){return db[_0x29b9('0x2b')][_0x29b9('0x36')]({'where':{'id':_0x540854[_0x29b9('0x29')]['id']}})[_0x29b9('0x1b')](handleEntityNotFound(_0x48e1f4,null))[_0x29b9('0x1b')](function(_0x3a1030){if(_0x3a1030){return _0x3a1030[_0x29b9('0x50')](_0x540854['body'][_0x29b9('0x3c')],_['omit'](_0x540854[_0x29b9('0x38')],['ids','id'])||{})[_0x29b9('0x51')](function(){return db[_0x29b9('0x52')][_0x29b9('0x25')]({'attributes':['id',_0x29b9('0x20'),_0x29b9('0x53')],'where':{'id':_0x540854[_0x29b9('0x38')][_0x29b9('0x3c')]}});})[_0x29b9('0x1b')](function(_0x22acfe){socket[_0x29b9('0x54')](_0x29b9('0x55'),{'id':Number(_0x540854[_0x29b9('0x29')]['id']),'tags':_0x22acfe||[]});return{'id':Number(_0x540854['params']['id']),'tags':_0x22acfe||[]};});}})[_0x29b9('0x1b')](respondWithResult(_0x48e1f4,null))[_0x29b9('0x27')](handleError(_0x48e1f4,null));};exports['removeTags']=function(_0x4706f3,_0x5f46cc){return db[_0x29b9('0x2b')][_0x29b9('0x36')]({'where':{'id':_0x4706f3[_0x29b9('0x29')]['id']}})[_0x29b9('0x1b')](handleEntityNotFound(_0x5f46cc,null))[_0x29b9('0x1b')](function(_0x2eba28){if(_0x2eba28){return _0x2eba28[_0x29b9('0x56')](_0x4706f3[_0x29b9('0x33')][_0x29b9('0x3c')]);}})[_0x29b9('0x1b')](respondWithStatusCode(_0x5f46cc,null))[_0x29b9('0x27')](handleError(_0x5f46cc,null));};exports['download']=function(_0x4b8f35,_0x34b155){var _0x2367e8=moment()[_0x29b9('0x57')]()['toString']();var _0x3fe2c8=path[_0x29b9('0x58')](config[_0x29b9('0x59')],'server',_0x29b9('0x5a'),_0x29b9('0x5b'));var _0x2d7fd9=path[_0x29b9('0x58')](config[_0x29b9('0x59')],_0x29b9('0x5c'),_0x29b9('0x5a'),_0x29b9('0x5d'));var _0x26f3a1=path[_0x29b9('0x58')](_0x3fe2c8,_0x2367e8);var _0x382e86=util[_0x29b9('0x4b')](_0x29b9('0x5e'),_0x4b8f35[_0x29b9('0x29')]['id'],_0x2367e8);var _0x49ab84=path[_0x29b9('0x58')](_0x3fe2c8,_0x382e86);var _0x365764=[];_0x365764[_0x29b9('0x5f')]({'model':db[_0x29b9('0x60')],'as':_0x29b9('0x60'),'raw':!![]});var _0x10c9e1=[{'model':db[_0x29b9('0x3b')],'as':_0x29b9('0x61'),'attributes':['id',_0x29b9('0x38'),_0x29b9('0x62')],'include':_0x365764}];return db[_0x29b9('0x2b')]['find']({'where':{'id':_0x4b8f35[_0x29b9('0x29')]['id']},'include':_0x10c9e1})[_0x29b9('0x1b')](handleEntityNotFound(_0x34b155,null))[_0x29b9('0x1b')](function(_0x166d2a){if(_0x166d2a&&_0x166d2a[_0x29b9('0x61')]){var _0x171ce4=_0x166d2a[_0x29b9('0x63')]({'plain':!![]});fs[_0x29b9('0x64')](_0x26f3a1);for(var _0x2733dc=0x0;_0x2733dc<_0x171ce4['Messages'][_0x29b9('0x32')];_0x2733dc++){var _0x278478=_0x171ce4[_0x29b9('0x61')][_0x2733dc][_0x29b9('0x60')];if(_0x278478){var _0x412392=path[_0x29b9('0x58')](_0x2d7fd9,_0x278478[_0x29b9('0x65')]);if(fs['existsSync'](_0x412392)){fs[_0x29b9('0x66')](_0x412392)[_0x29b9('0x67')](fs[_0x29b9('0x68')](path[_0x29b9('0x58')](_0x26f3a1,_0x278478['basename'])));}}}return BPromise[_0x29b9('0x69')]()[_0x29b9('0x1b')](function(){return new BPromise(function(_0x3a1d6e,_0x25ac75){zipdir(_0x26f3a1,{'saveTo':_0x49ab84},function(_0xdce4d8,_0x2053f6){if(_0xdce4d8)return _0x25ac75(_0xdce4d8);return _0x3a1d6e(_0x2053f6);});})[_0x29b9('0x1b')](function(){return new BPromise(function(_0x768a8d,_0x2bd3e1){rimraf(_0x26f3a1,function(_0x1d6d1f){if(_0x1d6d1f)_0x2bd3e1(_0x1d6d1f);return _0x768a8d();});});})[_0x29b9('0x1b')](function(){return _0x34b155[_0x29b9('0x6a')](_0x49ab84,_0x382e86,function(_0x4f5a02){if(_0x4f5a02){console[_0x29b9('0x6b')](_0x29b9('0x6c'),_0x4f5a02);}else{fs[_0x29b9('0x6d')](_0x49ab84);}});});});}else{return _0x34b155[_0x29b9('0x12')](0xc8);}})[_0x29b9('0x27')](handleError(_0x34b155,null));}; \ No newline at end of file +var _0xdc31=['attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','pipe','createWriteStream','download','rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','offset','undefined','limit','count','json','update','then','stack','name','send','index','FaxInteraction','rawAttributes','fieldName','type','getOptions','findAll','fax','user','catch','params','model','keys','query','filters','intersection','fields','attributes','length','includeAll','include','options','create','body','find','destroy','describe','addMessage','FaxMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','setTags','omit','spread','Tag','color','faxInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp'];(function(_0x43bdde,_0xb6a969){var _0x1d2844=function(_0x5979fe){while(--_0x5979fe){_0x43bdde['push'](_0x43bdde['shift']());}};_0x1d2844(++_0xb6a969);}(_0xdc31,0x72));var _0x1dc3=function(_0x499fe9,_0x5007b3){_0x499fe9=_0x499fe9-0x0;var _0xf278fd=_0xdc31[_0x499fe9];return _0xf278fd;};'use strict';var rimraf=require(_0x1dc3('0x0'));var zipdir=require(_0x1dc3('0x1'));var moment=require(_0x1dc3('0x2'));var BPromise=require('bluebird');var util=require(_0x1dc3('0x3'));var path=require(_0x1dc3('0x4'));var fs=require('fs');var _=require(_0x1dc3('0x5'));var Redis=require(_0x1dc3('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x1dc3('0x7'));var logger=require(_0x1dc3('0x8'))(_0x1dc3('0x9'));var config=require(_0x1dc3('0xa'));var db=require(_0x1dc3('0xb'))['db'];config[_0x1dc3('0xc')]=_[_0x1dc3('0xd')](config[_0x1dc3('0xc')],{'host':_0x1dc3('0xe'),'port':0x18eb});var socket=require(_0x1dc3('0xf'))(new Redis(config['redis']));require(_0x1dc3('0x10'))[_0x1dc3('0x11')](socket);function respondWithStatusCode(_0x4125fb,_0x573c55){_0x573c55=_0x573c55||0xcc;return function(_0x51a102){if(_0x51a102){return _0x4125fb[_0x1dc3('0x12')](_0x573c55);}return _0x4125fb['status'](_0x573c55)[_0x1dc3('0x13')]();};}function respondWithResult(_0xa2ade2,_0xb91c07){_0xb91c07=_0xb91c07||0xc8;return function(_0x5101bc){if(_0x5101bc){return _0xa2ade2[_0x1dc3('0x14')](_0xb91c07)['json'](_0x5101bc);}};}function respondWithFilteredResult(_0x188283,_0x5ea749){return function(_0x5bc008){if(_0x5bc008){var _0x389f63=typeof _0x5ea749[_0x1dc3('0x15')]===_0x1dc3('0x16')&&typeof _0x5ea749[_0x1dc3('0x17')]==='undefined';var _0x2561f5=_0x5bc008['count'];var _0x48b53d=_0x389f63?0x0:_0x5ea749[_0x1dc3('0x15')];var _0x3c274f=_0x389f63?_0x5bc008[_0x1dc3('0x18')]:_0x5ea749[_0x1dc3('0x15')]+_0x5ea749['limit'];var _0x10136c;if(_0x3c274f>=_0x2561f5){_0x3c274f=_0x2561f5;_0x10136c=0xc8;}else{_0x10136c=0xce;}_0x188283['status'](_0x10136c);return _0x188283['set']('Content-Range',_0x48b53d+'-'+_0x3c274f+'/'+_0x2561f5)[_0x1dc3('0x19')](_0x5bc008);}return null;};}function saveUpdates(_0x59e5a4){return function(_0x4d1a1e){if(_0x4d1a1e){return _0x4d1a1e[_0x1dc3('0x1a')](_0x59e5a4)[_0x1dc3('0x1b')](function(_0x410bc1){return _0x410bc1;});}return null;};}function removeEntity(_0x14776c){return function(_0x1bbdbc){if(_0x1bbdbc){return _0x1bbdbc['destroy']()['then'](function(){_0x14776c[_0x1dc3('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21f811){return function(_0xd1d019){if(!_0xd1d019){_0x21f811['sendStatus'](0x194);}return _0xd1d019;};}function handleError(_0x454fe3,_0x343ff6){_0x343ff6=_0x343ff6||0x1f4;return function(_0x4531ed){logger['error'](_0x4531ed[_0x1dc3('0x1c')]);if(_0x4531ed['name']){delete _0x4531ed[_0x1dc3('0x1d')];}_0x454fe3[_0x1dc3('0x14')](_0x343ff6)[_0x1dc3('0x1e')](_0x4531ed);};}exports[_0x1dc3('0x1f')]=function(_0x449fb7,_0x43dc78){var _0x382e2d={};var _0x443085=_['map'](db[_0x1dc3('0x20')][_0x1dc3('0x21')],function(_0x28151b){return{'name':_0x28151b[_0x1dc3('0x22')],'type':_0x28151b[_0x1dc3('0x23')]['key']};});_0x382e2d=qs[_0x1dc3('0x24')](_0x443085,_0x449fb7);return interaction[_0x1dc3('0x25')](_0x1dc3('0x26'),_0x449fb7['query'],_0x449fb7[_0x1dc3('0x27')],_0x382e2d,_0x443085)[_0x1dc3('0x1b')](respondWithFilteredResult(_0x43dc78,_0x382e2d))[_0x1dc3('0x28')](handleError(_0x43dc78,null));};exports['show']=function(_0x542a15,_0x30094d){var _0x5293f0={'raw':![],'where':{'id':_0x542a15[_0x1dc3('0x29')]['id']}},_0x571beb={};_0x571beb[_0x1dc3('0x2a')]=_[_0x1dc3('0x2b')](db['FaxInteraction']['rawAttributes']);_0x571beb['query']=_[_0x1dc3('0x2b')](_0x542a15[_0x1dc3('0x2c')]);_0x571beb[_0x1dc3('0x2d')]=_[_0x1dc3('0x2e')](_0x571beb[_0x1dc3('0x2a')],_0x571beb[_0x1dc3('0x2c')]);_0x5293f0['attributes']=_[_0x1dc3('0x2e')](_0x571beb[_0x1dc3('0x2a')],qs[_0x1dc3('0x2f')](_0x542a15['query'][_0x1dc3('0x2f')]));_0x5293f0[_0x1dc3('0x30')]=_0x5293f0['attributes'][_0x1dc3('0x31')]?_0x5293f0[_0x1dc3('0x30')]:_0x571beb[_0x1dc3('0x2a')];if(_0x542a15[_0x1dc3('0x2c')][_0x1dc3('0x32')]){_0x5293f0[_0x1dc3('0x33')]=[{'all':!![]}];}_0x5293f0=_['merge']({},_0x5293f0,_0x542a15[_0x1dc3('0x34')]);return db[_0x1dc3('0x20')]['find'](_0x5293f0)['then'](handleEntityNotFound(_0x30094d,null))['then'](respondWithResult(_0x30094d,null))['catch'](handleError(_0x30094d,null));};exports[_0x1dc3('0x35')]=function(_0x525d1a,_0x560d7c){return db[_0x1dc3('0x20')][_0x1dc3('0x35')](_0x525d1a[_0x1dc3('0x36')],{})[_0x1dc3('0x1b')](respondWithResult(_0x560d7c,0xc9))[_0x1dc3('0x28')](handleError(_0x560d7c,null));};exports[_0x1dc3('0x1a')]=function(_0xe4f096,_0x1624a8){if(_0xe4f096['body']['id']){delete _0xe4f096[_0x1dc3('0x36')]['id'];}return db[_0x1dc3('0x20')][_0x1dc3('0x37')]({'where':{'id':_0xe4f096[_0x1dc3('0x29')]['id']}})['then'](handleEntityNotFound(_0x1624a8,null))[_0x1dc3('0x1b')](saveUpdates(_0xe4f096[_0x1dc3('0x36')],null))['then'](respondWithResult(_0x1624a8,null))[_0x1dc3('0x28')](handleError(_0x1624a8,null));};exports[_0x1dc3('0x38')]=function(_0x34eb66,_0x35204e){return db['FaxInteraction']['find']({'where':{'id':_0x34eb66[_0x1dc3('0x29')]['id']}})[_0x1dc3('0x1b')](handleEntityNotFound(_0x35204e,null))[_0x1dc3('0x1b')](removeEntity(_0x35204e,null))['catch'](handleError(_0x35204e,null));};exports[_0x1dc3('0x39')]=function(_0x42673e,_0x1374dd){return db['FaxInteraction'][_0x1dc3('0x39')]()[_0x1dc3('0x1b')](respondWithResult(_0x1374dd,null))['catch'](handleError(_0x1374dd,null));};exports[_0x1dc3('0x3a')]=function(_0x15a978,_0x3321ae){return db[_0x1dc3('0x3b')]['find']({'where':{'id':_0x15a978[_0x1dc3('0x29')]['id']}})[_0x1dc3('0x1b')](handleEntityNotFound(_0x3321ae,null))[_0x1dc3('0x1b')](function(_0x38479d){if(_0x38479d){return _0x38479d[_0x1dc3('0x3a')](_0x15a978[_0x1dc3('0x36')][_0x1dc3('0x3c')],_['omit'](_0x15a978[_0x1dc3('0x36')],[_0x1dc3('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x3321ae,null))[_0x1dc3('0x28')](handleError(_0x3321ae,null));};exports[_0x1dc3('0x3d')]=function(_0x18264b,_0xc21e8e){var _0x4bb780={'raw':![],'where':{}};var _0x32c79f={};var _0x343557={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x1dc3('0x3e')]({'where':{'id':_0x18264b[_0x1dc3('0x29')]['id']}})[_0x1dc3('0x1b')](handleEntityNotFound(_0xc21e8e,null))['then'](function(_0x2ede9d){if(_0x2ede9d){_0x32c79f[_0x1dc3('0x2a')]=_[_0x1dc3('0x2b')](db[_0x1dc3('0x3b')][_0x1dc3('0x21')]);_0x32c79f['query']=_[_0x1dc3('0x2b')](_0x18264b['query']);_0x32c79f['filters']=_[_0x1dc3('0x2e')](_0x32c79f['model'],_0x32c79f[_0x1dc3('0x2c')]);_0x4bb780['attributes']=_[_0x1dc3('0x2e')](_0x32c79f[_0x1dc3('0x2a')],qs[_0x1dc3('0x2f')](_0x18264b['query'][_0x1dc3('0x2f')]));_0x4bb780[_0x1dc3('0x30')]=_0x4bb780[_0x1dc3('0x30')][_0x1dc3('0x31')]?_0x4bb780[_0x1dc3('0x30')]:_0x32c79f[_0x1dc3('0x2a')];if(!_0x18264b[_0x1dc3('0x2c')][_0x1dc3('0x3f')](_0x1dc3('0x40'))){_0x4bb780[_0x1dc3('0x17')]=qs[_0x1dc3('0x17')](_0x18264b[_0x1dc3('0x2c')]['limit']);_0x4bb780['offset']=qs[_0x1dc3('0x15')](_0x18264b[_0x1dc3('0x2c')][_0x1dc3('0x15')]);}_0x4bb780[_0x1dc3('0x41')]=qs[_0x1dc3('0x42')](_0x18264b['query'][_0x1dc3('0x42')]);_0x4bb780[_0x1dc3('0x43')]=qs['filters'](_[_0x1dc3('0x44')](_0x18264b[_0x1dc3('0x2c')],_0x32c79f[_0x1dc3('0x2d')]));_0x4bb780['where'][_0x1dc3('0x45')]=_0x2ede9d['id'];if(_0x18264b[_0x1dc3('0x2c')][_0x1dc3('0x46')]){_0x4bb780[_0x1dc3('0x43')]=_[_0x1dc3('0x47')](_0x4bb780[_0x1dc3('0x43')],{'$or':_['map'](_0x4bb780[_0x1dc3('0x30')],function(_0xed5ca4){var _0x4adec4={};_0x4adec4[_0xed5ca4]={'$like':'%'+_0x18264b[_0x1dc3('0x2c')][_0x1dc3('0x46')]+'%'};return _0x4adec4;})});}if(_0x18264b['query'][_0x1dc3('0x48')]){var _0x36d957=_0x18264b[_0x1dc3('0x2c')][_0x1dc3('0x48')][_0x1dc3('0x49')](',');var _0x1b3ad7={};_0x1b3ad7[_0x36d957[0x0]]={'$gte':moment(_0x36d957[0x1])[_0x1dc3('0x4a')](_0x1dc3('0x4b'))};_0x4bb780['where']=_[_0x1dc3('0x47')](_0x4bb780[_0x1dc3('0x43')],_0x1b3ad7);}_0x4bb780=_[_0x1dc3('0x47')]({},_0x4bb780,_0x18264b[_0x1dc3('0x34')]);return db[_0x1dc3('0x3b')]['count']({'where':_0x4bb780[_0x1dc3('0x43')]})['then'](function(_0x33d66f){_0x343557[_0x1dc3('0x18')]=_0x33d66f;if(_0x18264b['query'][_0x1dc3('0x32')]){_0x4bb780[_0x1dc3('0x33')]=[{'all':!![]}];}return db[_0x1dc3('0x3b')][_0x1dc3('0x25')](_0x4bb780);})['then'](function(_0x2b84fc){_0x343557['rows']=_0x2b84fc;return _0x343557;});}})[_0x1dc3('0x1b')](respondWithFilteredResult(_0xc21e8e,_0x4bb780))['catch'](handleError(_0xc21e8e,null));};exports['addTags']=function(_0xf10b1f,_0x51ee64){return db['FaxInteraction'][_0x1dc3('0x37')]({'where':{'id':_0xf10b1f['params']['id']}})[_0x1dc3('0x1b')](handleEntityNotFound(_0x51ee64,null))[_0x1dc3('0x1b')](function(_0x592d09){if(_0x592d09){return _0x592d09[_0x1dc3('0x4c')](_0xf10b1f['body']['ids'],_[_0x1dc3('0x4d')](_0xf10b1f['body'],['ids','id'])||{})[_0x1dc3('0x4e')](function(){return db[_0x1dc3('0x4f')][_0x1dc3('0x25')]({'attributes':['id',_0x1dc3('0x1d'),_0x1dc3('0x50')],'where':{'id':_0xf10b1f[_0x1dc3('0x36')][_0x1dc3('0x3c')]}});})[_0x1dc3('0x1b')](function(_0x377579){socket['emit'](_0x1dc3('0x51'),{'id':Number(_0xf10b1f[_0x1dc3('0x29')]['id']),'tags':_0x377579||[]});return{'id':Number(_0xf10b1f[_0x1dc3('0x29')]['id']),'tags':_0x377579||[]};});}})[_0x1dc3('0x1b')](respondWithResult(_0x51ee64,null))[_0x1dc3('0x28')](handleError(_0x51ee64,null));};exports[_0x1dc3('0x52')]=function(_0x1d2d42,_0x47c97d){return db[_0x1dc3('0x20')]['find']({'where':{'id':_0x1d2d42[_0x1dc3('0x29')]['id']}})[_0x1dc3('0x1b')](handleEntityNotFound(_0x47c97d,null))[_0x1dc3('0x1b')](function(_0x281f83){if(_0x281f83){return _0x281f83[_0x1dc3('0x52')](_0x1d2d42['query'][_0x1dc3('0x3c')]);}})[_0x1dc3('0x1b')](respondWithStatusCode(_0x47c97d,null))[_0x1dc3('0x28')](handleError(_0x47c97d,null));};exports['download']=function(_0x5c8d06,_0x16a5e8){var _0x5d5c7b=moment()[_0x1dc3('0x53')]()[_0x1dc3('0x54')]();var _0xcc4587=path[_0x1dc3('0x55')](config[_0x1dc3('0x56')],_0x1dc3('0x57'),_0x1dc3('0x58'),_0x1dc3('0x59'));var _0x354ac5=path[_0x1dc3('0x55')](config['root'],'server',_0x1dc3('0x58'),_0x1dc3('0x5a'));var _0x3beb11=path[_0x1dc3('0x55')](_0xcc4587,_0x5d5c7b);var _0x2e35e0=util[_0x1dc3('0x4a')](_0x1dc3('0x5b'),_0x5c8d06[_0x1dc3('0x29')]['id'],_0x5d5c7b);var _0x8ddd9e=path['join'](_0xcc4587,_0x2e35e0);var _0x4601ff=[];_0x4601ff['push']({'model':db[_0x1dc3('0x5c')],'as':_0x1dc3('0x5c'),'raw':!![]});var _0x5e0aba=[{'model':db['FaxMessage'],'as':_0x1dc3('0x5d'),'attributes':['id',_0x1dc3('0x36'),_0x1dc3('0x5e')],'include':_0x4601ff}];return db[_0x1dc3('0x20')][_0x1dc3('0x37')]({'where':{'id':_0x5c8d06[_0x1dc3('0x29')]['id']},'include':_0x5e0aba})[_0x1dc3('0x1b')](handleEntityNotFound(_0x16a5e8,null))[_0x1dc3('0x1b')](function(_0x5941af){if(_0x5941af&&_0x5941af[_0x1dc3('0x5d')]){var _0x3ba363=_0x5941af[_0x1dc3('0x5f')]({'plain':!![]});fs[_0x1dc3('0x60')](_0x3beb11);for(var _0x149d2d=0x0;_0x149d2d<_0x3ba363[_0x1dc3('0x5d')]['length'];_0x149d2d++){var _0xea2988=_0x3ba363[_0x1dc3('0x5d')][_0x149d2d][_0x1dc3('0x5c')];if(_0xea2988){var _0x5c5aac=path['join'](_0x354ac5,_0xea2988[_0x1dc3('0x61')]);if(fs[_0x1dc3('0x62')](_0x5c5aac)){fs['createReadStream'](_0x5c5aac)[_0x1dc3('0x63')](fs[_0x1dc3('0x64')](path[_0x1dc3('0x55')](_0x3beb11,_0xea2988[_0x1dc3('0x61')])));}}}return BPromise['resolve']()[_0x1dc3('0x1b')](function(){return new BPromise(function(_0x128a6c,_0x4aa20b){zipdir(_0x3beb11,{'saveTo':_0x8ddd9e},function(_0x4ab982,_0x14db48){if(_0x4ab982)return _0x4aa20b(_0x4ab982);return _0x128a6c(_0x14db48);});})[_0x1dc3('0x1b')](function(){return new BPromise(function(_0x49931b,_0x1139f5){rimraf(_0x3beb11,function(_0x299f8c){if(_0x299f8c)_0x1139f5(_0x299f8c);return _0x49931b();});});})['then'](function(){return _0x16a5e8[_0x1dc3('0x65')](_0x8ddd9e,_0x2e35e0,function(_0x10b01b){if(_0x10b01b){console['log']('err',_0x10b01b);}else{fs['unlinkSync'](_0x8ddd9e);}});});});}else{return _0x16a5e8[_0x1dc3('0x12')](0xc8);}})[_0x1dc3('0x28')](handleError(_0x16a5e8,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 1eba839..8c5edbb 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 _0x4c5e=['hook','exports','events','FaxInteraction','FaxMessage','setMaxListeners','save','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x4c5e,0x134));var _0xe4c5=function(_0x2c0ecf,_0x19d61b){_0x2c0ecf=_0x2c0ecf-0x0;var _0xb734ff=_0x4c5e[_0x2c0ecf];return _0xb734ff;};'use strict';var EventEmitter=require(_0xe4c5('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xe4c5('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0xe4c5('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xe4c5('0x3')](0x0);var events={'afterCreate':_0xe4c5('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3bcc3e){return function(_0x6efc9c,_0x3adc1d,_0x5ea488){_0x6efc9c[_0xe4c5('0x5')]({'attributes':['id'],'raw':!![]})[_0xe4c5('0x6')](function(_0x1c9caf){_0x6efc9c[_0xe4c5('0x7')](_0xe4c5('0x8'),_0x1c9caf[_0xe4c5('0x9')](function(_0x2aaea1){return{'id':_0x2aaea1['id']};}));return FaxMessage[_0xe4c5('0xa')]({'where':{'FaxInteractionId':_0x6efc9c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5c941a){_0x6efc9c['setDataValue'](_0xe4c5('0xb'),_0x5c941a[_0xe4c5('0xc')]);FaxInteractionEvents['emit'](_0x3bcc3e+':'+_0x6efc9c['id'],_0x6efc9c);FaxInteractionEvents[_0xe4c5('0xd')](_0x3bcc3e,_0x6efc9c);_0x5ea488(null);})[_0xe4c5('0xe')](_0x5ea488(null));};}for(var e in events){if(events[_0xe4c5('0xf')](e)){var event=events[e];FaxInteraction[_0xe4c5('0x10')](e,emitEvent(event));}}module[_0xe4c5('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0xcac2=['update','remove','getUsers','then','Users','map','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcac2,0x13f));var _0x2cac=function(_0x17f992,_0x24df9d){_0x17f992=_0x17f992-0x0;var _0x4f3779=_0xcac2[_0x17f992];return _0x4f3779;};'use strict';var EventEmitter=require(_0x2cac('0x0'));var FaxInteraction=require(_0x2cac('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x2cac('0x1'))['db'][_0x2cac('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2cac('0x3')](0x0);var events={'afterCreate':_0x2cac('0x4'),'afterUpdate':_0x2cac('0x5'),'afterDestroy':_0x2cac('0x6')};function emitEvent(_0x8b0f2c){return function(_0x1f6c5e,_0x5a1037,_0x2153c2){_0x1f6c5e[_0x2cac('0x7')]({'attributes':['id'],'raw':!![]})[_0x2cac('0x8')](function(_0x2fdfd2){_0x1f6c5e['setDataValue'](_0x2cac('0x9'),_0x2fdfd2[_0x2cac('0xa')](function(_0x28e6e0){return{'id':_0x28e6e0['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x1f6c5e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2cac('0x8')](function(_0x3e24df){_0x1f6c5e[_0x2cac('0xb')](_0x2cac('0xc'),_0x3e24df[_0x2cac('0xd')]);FaxInteractionEvents['emit'](_0x8b0f2c+':'+_0x1f6c5e['id'],_0x1f6c5e);FaxInteractionEvents[_0x2cac('0xe')](_0x8b0f2c,_0x1f6c5e);_0x2153c2(null);})['catch'](_0x2153c2(null));};}for(var e in events){if(events[_0x2cac('0xf')](e)){var event=events[e];FaxInteraction[_0x2cac('0x10')](e,emitEvent(event));}}module[_0x2cac('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 324c2bb..7e0b329 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 _0x0189=['exports','define','FaxInteraction','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','path','rimraf','./faxInteraction.attributes'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0189,0x178));var _0x9018=function(_0x4e3f21,_0x4660a2){_0x4e3f21=_0x4e3f21-0x0;var _0x5a5d1a=_0x0189[_0x4e3f21];return _0x5a5d1a;};'use strict';var _=require(_0x9018('0x0'));var util=require(_0x9018('0x1'));var logger=require(_0x9018('0x2'))(_0x9018('0x3'));var moment=require(_0x9018('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9018('0x5'));var rimraf=require(_0x9018('0x6'));var config=require('../../config/environment');var attributes=require(_0x9018('0x7'));module[_0x9018('0x8')]=function(_0x4b83fb,_0x2592f4){return _0x4b83fb[_0x9018('0x9')](_0x9018('0xa'),attributes,{'tableName':_0x9018('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x436d0e,_0x38102b,_0x319a0f){if(_0x436d0e[_0x9018('0xc')](_0x9018('0xd'))){_0x436d0e['closedAt']=moment()[_0x9018('0xe')](_0x9018('0xf'));}_0x319a0f(null,_0x436d0e);}}});}; \ No newline at end of file +var _0x55d6=['changed','closed','closedAt','format','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','FaxInteraction','fax_interactions'];(function(_0x6c8609,_0x5bf137){var _0x520004=function(_0x2ad797){while(--_0x2ad797){_0x6c8609['push'](_0x6c8609['shift']());}};_0x520004(++_0x5bf137);}(_0x55d6,0x112));var _0x655d=function(_0x1d56cb,_0x4a072b){_0x1d56cb=_0x1d56cb-0x0;var _0x26e89a=_0x55d6[_0x1d56cb];return _0x26e89a;};'use strict';var _=require(_0x655d('0x0'));var util=require(_0x655d('0x1'));var logger=require('../../config/logger')(_0x655d('0x2'));var moment=require(_0x655d('0x3'));var BPromise=require(_0x655d('0x4'));var rp=require(_0x655d('0x5'));var fs=require('fs');var path=require(_0x655d('0x6'));var rimraf=require('rimraf');var config=require(_0x655d('0x7'));var attributes=require(_0x655d('0x8'));module['exports']=function(_0x4f30a4,_0x23b634){return _0x4f30a4['define'](_0x655d('0x9'),attributes,{'tableName':_0x655d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x52dbcc,_0x707022,_0x57eab1){if(_0x52dbcc[_0x655d('0xb')](_0x655d('0xc'))){_0x52dbcc[_0x655d('0xd')]=moment()[_0x655d('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x57eab1(null,_0x52dbcc);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 57d15a3..62459d4 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 _0x07f6=['stringify','error','code','message','result','catch','UpdateFaxInteraction','update','options','raw','where','attributes','FaxInteraction','body','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x07f6,0x89));var _0x607f=function(_0xf2662b,_0x4d8f41){_0xf2662b=_0xf2662b-0x0;var _0x257dc7=_0x07f6[_0xf2662b];return _0x257dc7;};'use strict';var _=require(_0x607f('0x0'));var util=require(_0x607f('0x1'));var moment=require('moment');var BPromise=require(_0x607f('0x2'));var rs=require(_0x607f('0x3'));var fs=require('fs');var Redis=require(_0x607f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x607f('0x5'));var logger=require(_0x607f('0x6'))(_0x607f('0x7'));var config=require('../../config/environment');var jayson=require(_0x607f('0x8'));var client=jayson[_0x607f('0x9')][_0x607f('0xa')]({'port':0x232a});config[_0x607f('0xb')]=_[_0x607f('0xc')](config[_0x607f('0xb')],{'host':_0x607f('0xd'),'port':0x18eb});var socket=require(_0x607f('0xe'))(new Redis(config[_0x607f('0xb')]));require(_0x607f('0xf'))[_0x607f('0x10')](socket);function respondWithRpcPromise(_0x4c3b84,_0x2dbc4e,_0x4f87ac){return new BPromise(function(_0x9926c8,_0x5bc375){return client['request'](_0x4c3b84,_0x4f87ac)[_0x607f('0x11')](function(_0x379efc){logger[_0x607f('0x12')](_0x607f('0x13'),_0x2dbc4e,_0x607f('0x14'));logger[_0x607f('0x15')](_0x607f('0x16'),_0x2dbc4e,_0x607f('0x14'),JSON[_0x607f('0x17')](_0x379efc));if(_0x379efc['error']){if(_0x379efc[_0x607f('0x18')][_0x607f('0x19')]===0x1f4){logger['error'](_0x607f('0x13'),_0x2dbc4e,_0x379efc['error']['message']);return _0x5bc375(_0x379efc[_0x607f('0x18')][_0x607f('0x1a')]);}logger[_0x607f('0x18')](_0x607f('0x13'),_0x2dbc4e,_0x379efc[_0x607f('0x18')][_0x607f('0x1a')]);return _0x9926c8(_0x379efc['error'][_0x607f('0x1a')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x2dbc4e,'request\x20sent');_0x9926c8(_0x379efc[_0x607f('0x1b')][_0x607f('0x1a')]);}})[_0x607f('0x1c')](function(_0x17a5fa){logger[_0x607f('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x2dbc4e,_0x17a5fa);_0x5bc375(_0x17a5fa);});});}exports[_0x607f('0x1d')]=function(_0x58f77d){var _0x44554d=this;return new Promise(function(_0xc29956,_0x50bdf6){return db['FaxInteraction'][_0x607f('0x1e')](_0x58f77d['body'],{'raw':_0x58f77d[_0x607f('0x1f')]?_0x58f77d[_0x607f('0x1f')][_0x607f('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58f77d[_0x607f('0x1f')]?_0x58f77d[_0x607f('0x1f')][_0x607f('0x21')]||null:null,'attributes':_0x58f77d[_0x607f('0x1f')]?_0x58f77d['options'][_0x607f('0x22')]||null:null,'limit':_0x58f77d[_0x607f('0x1f')]?_0x58f77d['options']['limit']||null:null})['then'](function(_0x5ec83d){logger[_0x607f('0x12')](_0x607f('0x1d'),_0x58f77d);logger['debug']('UpdateFaxInteraction',_0x58f77d,JSON[_0x607f('0x17')](_0x5ec83d));_0xc29956(_0x5ec83d);})['catch'](function(_0x4eee91){logger[_0x607f('0x18')](_0x607f('0x1d'),_0x4eee91[_0x607f('0x1a')],_0x58f77d);_0x50bdf6(_0x44554d[_0x607f('0x18')](0x1f4,_0x4eee91['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x104944){return new Promise(function(_0x29c944,_0x3dfc40){return db[_0x607f('0x23')]['find']({'where':_0x104944['options']?_0x104944[_0x607f('0x1f')][_0x607f('0x21')]||null:null})[_0x607f('0x11')](function(_0x14d8c6){if(_0x14d8c6){return _0x14d8c6['addTags'](_0x104944[_0x607f('0x24')][_0x607f('0x25')],_['omit'](_0x104944[_0x607f('0x24')],[_0x607f('0x25'),'id'])||{});}})[_0x607f('0x26')](function(_0x498468){logger[_0x607f('0x12')](_0x607f('0x27'),_0x104944);logger[_0x607f('0x15')](_0x607f('0x27'),_0x104944,JSON[_0x607f('0x17')](_0x498468));_0x29c944(_0x498468);})[_0x607f('0x1c')](function(_0x19f989){logger['error'](_0x607f('0x27'),_0x19f989[_0x607f('0x1a')],_0x104944);_0x3dfc40(_this[_0x607f('0x18')](0x1f4,_0x19f989[_0x607f('0x1a')]));});});}; \ No newline at end of file +var _0xab77=['update','body','options','attributes','limit','then','AddTagsToFaxInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction'];(function(_0x2e9a63,_0xcb23f1){var _0x130ea5=function(_0x586a5c){while(--_0x586a5c){_0x2e9a63['push'](_0x2e9a63['shift']());}};_0x130ea5(++_0xcb23f1);}(_0xab77,0x8f));var _0x7ab7=function(_0x1db863,_0x8f181d){_0x1db863=_0x1db863-0x0;var _0x18b578=_0xab77[_0x1db863];return _0x18b578;};'use strict';var _=require(_0x7ab7('0x0'));var util=require(_0x7ab7('0x1'));var moment=require(_0x7ab7('0x2'));var BPromise=require(_0x7ab7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ab7('0x4'));var db=require(_0x7ab7('0x5'))['db'];var utils=require(_0x7ab7('0x6'));var logger=require('../../config/logger')(_0x7ab7('0x7'));var config=require(_0x7ab7('0x8'));var jayson=require(_0x7ab7('0x9'));var client=jayson['client'][_0x7ab7('0xa')]({'port':0x232a});config[_0x7ab7('0xb')]=_['defaults'](config['redis'],{'host':_0x7ab7('0xc'),'port':0x18eb});var socket=require(_0x7ab7('0xd'))(new Redis(config['redis']));require(_0x7ab7('0xe'))[_0x7ab7('0xf')](socket);function respondWithRpcPromise(_0x2b645b,_0x4b5e17,_0x4c0409){return new BPromise(function(_0x31435f,_0x108c37){return client['request'](_0x2b645b,_0x4c0409)['then'](function(_0x26f887){logger[_0x7ab7('0x10')](_0x7ab7('0x11'),_0x4b5e17,_0x7ab7('0x12'));logger[_0x7ab7('0x13')](_0x7ab7('0x14'),_0x4b5e17,_0x7ab7('0x12'),JSON[_0x7ab7('0x15')](_0x26f887));if(_0x26f887['error']){if(_0x26f887[_0x7ab7('0x16')][_0x7ab7('0x17')]===0x1f4){logger[_0x7ab7('0x16')](_0x7ab7('0x11'),_0x4b5e17,_0x26f887[_0x7ab7('0x16')][_0x7ab7('0x18')]);return _0x108c37(_0x26f887[_0x7ab7('0x16')][_0x7ab7('0x18')]);}logger[_0x7ab7('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x4b5e17,_0x26f887[_0x7ab7('0x16')][_0x7ab7('0x18')]);return _0x31435f(_0x26f887[_0x7ab7('0x16')][_0x7ab7('0x18')]);}else{logger['info'](_0x7ab7('0x11'),_0x4b5e17,_0x7ab7('0x12'));_0x31435f(_0x26f887[_0x7ab7('0x19')]['message']);}})[_0x7ab7('0x1a')](function(_0x2ccdbf){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x4b5e17,_0x2ccdbf);_0x108c37(_0x2ccdbf);});});}exports[_0x7ab7('0x1b')]=function(_0x566cf3){var _0x5485fb=this;return new Promise(function(_0x5745d2,_0x4533ad){return db[_0x7ab7('0x1c')][_0x7ab7('0x1d')](_0x566cf3[_0x7ab7('0x1e')],{'raw':_0x566cf3[_0x7ab7('0x1f')]?_0x566cf3[_0x7ab7('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x566cf3[_0x7ab7('0x1f')]?_0x566cf3['options']['where']||null:null,'attributes':_0x566cf3[_0x7ab7('0x1f')]?_0x566cf3[_0x7ab7('0x1f')][_0x7ab7('0x20')]||null:null,'limit':_0x566cf3[_0x7ab7('0x1f')]?_0x566cf3[_0x7ab7('0x1f')][_0x7ab7('0x21')]||null:null})[_0x7ab7('0x22')](function(_0x3f412a){logger[_0x7ab7('0x10')](_0x7ab7('0x1b'),_0x566cf3);logger[_0x7ab7('0x13')](_0x7ab7('0x1b'),_0x566cf3,JSON[_0x7ab7('0x15')](_0x3f412a));_0x5745d2(_0x3f412a);})['catch'](function(_0x940e05){logger['error'](_0x7ab7('0x1b'),_0x940e05[_0x7ab7('0x18')],_0x566cf3);_0x4533ad(_0x5485fb['error'](0x1f4,_0x940e05['message']));});});};exports[_0x7ab7('0x23')]=function(_0x25e9d5){return new Promise(function(_0x31f9f2,_0x404442){return db['FaxInteraction'][_0x7ab7('0x24')]({'where':_0x25e9d5[_0x7ab7('0x1f')]?_0x25e9d5[_0x7ab7('0x1f')][_0x7ab7('0x25')]||null:null})['then'](function(_0x3d7774){if(_0x3d7774){return _0x3d7774[_0x7ab7('0x26')](_0x25e9d5[_0x7ab7('0x1e')][_0x7ab7('0x27')],_[_0x7ab7('0x28')](_0x25e9d5[_0x7ab7('0x1e')],[_0x7ab7('0x27'),'id'])||{});}})[_0x7ab7('0x29')](function(_0x4fe448){logger[_0x7ab7('0x10')](_0x7ab7('0x2a'),_0x25e9d5);logger[_0x7ab7('0x13')](_0x7ab7('0x2a'),_0x25e9d5,JSON[_0x7ab7('0x15')](_0x4fe448));_0x31f9f2(_0x4fe448);})['catch'](function(_0x28ff58){logger[_0x7ab7('0x16')](_0x7ab7('0x2a'),_0x28ff58['message'],_0x25e9d5);_0x404442(_this['error'](0x1f4,_0x28ff58[_0x7ab7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 149c0c1..640b46f 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 _0x9c99=['faxInteraction:','./faxInteraction.events','save','remove','emit','removeListener','register'];(function(_0x170c55,_0x336a26){var _0x371d4b=function(_0x5dd848){while(--_0x5dd848){_0x170c55['push'](_0x170c55['shift']());}};_0x371d4b(++_0x336a26);}(_0x9c99,0x151));var _0x99c9=function(_0x39d518,_0x32b600){_0x39d518=_0x39d518-0x0;var _0x2feade=_0x9c99[_0x39d518];return _0x2feade;};'use strict';var FaxInteractionEvents=require(_0x99c9('0x0'));var events=[_0x99c9('0x1'),_0x99c9('0x2'),'update'];function createListener(_0x242de3,_0x32550e){return function(_0x4b2cc4){_0x32550e[_0x99c9('0x3')](_0x242de3,_0x4b2cc4);};}function removeListener(_0x304a86,_0x233bcf){return function(){FaxInteractionEvents[_0x99c9('0x4')](_0x304a86,_0x233bcf);};}exports[_0x99c9('0x5')]=function(_0x445a71){for(var _0x1ed585=0x0,_0x163f38=events['length'];_0x1ed585<_0x163f38;_0x1ed585++){var _0x320d13=events[_0x1ed585];var _0x2aa867=createListener(_0x99c9('0x6')+_0x320d13,_0x445a71);FaxInteractionEvents['on'](_0x320d13,_0x2aa867);}}; \ No newline at end of file +var _0xc6d1=['save','remove','update','emit','register','length','faxInteraction:','./faxInteraction.events'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xc6d1,0x77));var _0x1c6d=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xc6d1[_0xd1d19a];return _0x52a79d;};'use strict';var FaxInteractionEvents=require(_0x1c6d('0x0'));var events=[_0x1c6d('0x1'),_0x1c6d('0x2'),_0x1c6d('0x3')];function createListener(_0x5ca08e,_0x5ea3b3){return function(_0x6d930a){_0x5ea3b3[_0x1c6d('0x4')](_0x5ca08e,_0x6d930a);};}function removeListener(_0x14b476,_0x385fe7){return function(){FaxInteractionEvents['removeListener'](_0x14b476,_0x385fe7);};}exports[_0x1c6d('0x5')]=function(_0x26eab4){for(var _0x2c0477=0x0,_0x47270a=events[_0x1c6d('0x6')];_0x2c0477<_0x47270a;_0x2c0477++){var _0x365ab3=events[_0x2c0477];var _0xd0803d=createListener(_0x1c6d('0x7')+_0x365ab3,_0x26eab4);FaxInteractionEvents['on'](_0x365ab3,_0xd0803d);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 7265b09..842ebdf 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 _0xa1ad=['faxinteraction:destroy','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','addTags','put','faxinteraction:update','delete'];(function(_0x407efe,_0x2fbb65){var _0x10cc54=function(_0x4f750e){while(--_0x4f750e){_0x407efe['push'](_0x407efe['shift']());}};_0x10cc54(++_0x2fbb65);}(_0xa1ad,0x15e));var _0xda1a=function(_0x25bca6,_0xe415ea){_0x25bca6=_0x25bca6-0x0;var _0x3f8d02=_0xa1ad[_0x25bca6];return _0x3f8d02;};'use strict';var multer=require('multer');var util=require(_0xda1a('0x0'));var path=require(_0xda1a('0x1'));var timeout=require('connect-timeout');var express=require(_0xda1a('0x2'));var router=express[_0xda1a('0x3')]();var fs_extra=require(_0xda1a('0x4'));var auth=require(_0xda1a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xda1a('0x6'));var controller=require('./faxInteraction.controller');router[_0xda1a('0x7')]('/',auth[_0xda1a('0x8')](),controller[_0xda1a('0x9')]);router['get'](_0xda1a('0xa'),auth[_0xda1a('0x8')](),controller[_0xda1a('0xb')]);router[_0xda1a('0x7')](_0xda1a('0xc'),auth['isAuthenticated'](),controller[_0xda1a('0xd')]);router['get']('/:id/messages',auth[_0xda1a('0x8')](),controller[_0xda1a('0xe')]);router[_0xda1a('0x7')](_0xda1a('0xf'),auth[_0xda1a('0x8')](),controller[_0xda1a('0x10')]);router[_0xda1a('0x11')]('/',auth[_0xda1a('0x8')](),controller[_0xda1a('0x12')]);router['post']('/:id/messages',auth[_0xda1a('0x8')](),controller[_0xda1a('0x13')]);router[_0xda1a('0x11')](_0xda1a('0x14'),auth['isAuthenticated'](),interaction[_0xda1a('0x15')](_0xda1a('0x16'),'faxinteraction:addtags'),controller[_0xda1a('0x17')]);router[_0xda1a('0x18')](_0xda1a('0xc'),auth[_0xda1a('0x8')](),interaction[_0xda1a('0x15')](_0xda1a('0x16'),_0xda1a('0x19')),controller['update']);router[_0xda1a('0x1a')](_0xda1a('0xc'),auth[_0xda1a('0x8')](),interaction[_0xda1a('0x15')](_0xda1a('0x16'),_0xda1a('0x1b')),controller[_0xda1a('0x1c')]);router[_0xda1a('0x1a')](_0xda1a('0x14'),auth[_0xda1a('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xa8bd=['/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','isAuthenticated','get','/describe','describe'];(function(_0x27591c,_0x2e5ec0){var _0x14179d=function(_0x87bcf){while(--_0x87bcf){_0x27591c['push'](_0x27591c['shift']());}};_0x14179d(++_0x2e5ec0);}(_0xa8bd,0x115));var _0xda8b=function(_0x4edfab,_0x351f99){_0x4edfab=_0x4edfab-0x0;var _0x1749b9=_0xa8bd[_0x4edfab];return _0x1749b9;};'use strict';var multer=require(_0xda8b('0x0'));var util=require(_0xda8b('0x1'));var path=require(_0xda8b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xda8b('0x3'));var auth=require(_0xda8b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xda8b('0x5'));var controller=require(_0xda8b('0x6'));router['get']('/',auth[_0xda8b('0x7')](),controller['index']);router[_0xda8b('0x8')](_0xda8b('0x9'),auth[_0xda8b('0x7')](),controller[_0xda8b('0xa')]);router[_0xda8b('0x8')](_0xda8b('0xb'),auth[_0xda8b('0x7')](),controller[_0xda8b('0xc')]);router[_0xda8b('0x8')](_0xda8b('0xd'),auth[_0xda8b('0x7')](),controller[_0xda8b('0xe')]);router[_0xda8b('0x8')](_0xda8b('0xf'),auth['isAuthenticated'](),controller[_0xda8b('0x10')]);router[_0xda8b('0x11')]('/',auth[_0xda8b('0x7')](),controller[_0xda8b('0x12')]);router[_0xda8b('0x11')]('/:id/messages',auth[_0xda8b('0x7')](),controller[_0xda8b('0x13')]);router[_0xda8b('0x11')](_0xda8b('0x14'),auth['isAuthenticated'](),interaction[_0xda8b('0x15')](_0xda8b('0x16'),'faxinteraction:addtags'),controller[_0xda8b('0x17')]);router[_0xda8b('0x18')](_0xda8b('0xb'),auth['isAuthenticated'](),interaction[_0xda8b('0x15')](_0xda8b('0x16'),_0xda8b('0x19')),controller[_0xda8b('0x1a')]);router[_0xda8b('0x1b')](_0xda8b('0xb'),auth[_0xda8b('0x7')](),interaction[_0xda8b('0x15')](_0xda8b('0x16'),_0xda8b('0x1c')),controller[_0xda8b('0x1d')]);router[_0xda8b('0x1b')](_0xda8b('0x14'),auth['isAuthenticated'](),controller[_0xda8b('0x1e')]);module[_0xda8b('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 24e702d..3032c55 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 _0x8c25=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x1c1d04,_0x1cc372){var _0x2b22e6=function(_0x178cf1){while(--_0x178cf1){_0x1c1d04['push'](_0x1c1d04['shift']());}};_0x2b22e6(++_0x1cc372);}(_0x8c25,0x15e));var _0x58c2=function(_0x351254,_0x36e73a){_0x351254=_0x351254-0x0;var _0xc4d674=_0x8c25[_0x351254];return _0xc4d674;};'use strict';var Sequelize=require(_0x58c2('0x0'));module[_0x58c2('0x1')]={'body':{'type':Sequelize[_0x58c2('0x2')](_0x58c2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x58c2('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x58c2('0x5')]('in','out'),'defaultValue':_0x58c2('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x50a6=['exports','BOOLEAN','out','TEXT','sequelize'];(function(_0x546ec1,_0x203781){var _0x224e56=function(_0x114edf){while(--_0x114edf){_0x546ec1['push'](_0x546ec1['shift']());}};_0x224e56(++_0x203781);}(_0x50a6,0xa4));var _0x650a=function(_0x5d7b48,_0x1c8eaa){_0x5d7b48=_0x5d7b48-0x0;var _0x31bd82=_0x50a6[_0x5d7b48];return _0x31bd82;};'use strict';var Sequelize=require(_0x650a('0x0'));module[_0x650a('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x650a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x650a('0x3')),'defaultValue':_0x650a('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x650a('0x4')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 5551750..f0b429c 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 _0xc5af=['SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','attachments','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','json','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','rows','options','find','body','params','destroy','describe','fax-interactions','accept','fax','read','readAt','format','UserId','get','FaxInteraction','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','RejectMessage','QueryTypes','event','create','CmContact','findOne','Attachment','AttachmentId'];(function(_0x49efa2,_0xfecbbc){var _0x1642f3=function(_0x4e9f99){while(--_0x4e9f99){_0x49efa2['push'](_0x49efa2['shift']());}};_0x1642f3(++_0xfecbbc);}(_0xc5af,0x97));var _0xfc5a=function(_0x337992,_0x2a5a3d){_0x337992=_0x337992-0x0;var _0x524e91=_0xc5af[_0x337992];return _0x524e91;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfc5a('0x0'));var jsonpatch=require(_0xfc5a('0x1'));var rp=require('request-promise');var moment=require(_0xfc5a('0x2'));var BPromise=require(_0xfc5a('0x3'));var Mustache=require(_0xfc5a('0x4'));var util=require(_0xfc5a('0x5'));var path=require(_0xfc5a('0x6'));var sox=require(_0xfc5a('0x7'));var csv=require('to-csv');var ejs=require(_0xfc5a('0x8'));var fs=require('fs');var fs_extra=require(_0xfc5a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfc5a('0xa'));var deskjs=require(_0xfc5a('0xb'));var toCsv=require(_0xfc5a('0xc'));var querystring=require(_0xfc5a('0xd'));var Papa=require('papaparse');var Redis=require(_0xfc5a('0xe'));var authService=require(_0xfc5a('0xf'));var qs=require(_0xfc5a('0x10'));var as=require(_0xfc5a('0x11'));var hardwareService=require(_0xfc5a('0x12'));var logger=require(_0xfc5a('0x13'))(_0xfc5a('0x14'));var utils=require('../../config/utils');var config=require(_0xfc5a('0x15'));var licenseUtil=require(_0xfc5a('0x16'));var db=require(_0xfc5a('0x17'))['db'];config['redis']=_['defaults'](config[_0xfc5a('0x18')],{'host':_0xfc5a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc5a('0x18')]));require(_0xfc5a('0x1a'))[_0xfc5a('0x1b')](socket);var jayson=require(_0xfc5a('0x1c'));var client=jayson[_0xfc5a('0x1d')][_0xfc5a('0x1e')]({'port':0x232c});var client9002=jayson[_0xfc5a('0x1d')][_0xfc5a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3b17c2,_0x492e44,_0x23c80a,_0x522d8e){return new BPromise(function(_0x564d0f,_0x77d189){var _0x5952fb=_0x522d8e||client;return _0x5952fb['request'](_0x3b17c2,_0x23c80a)[_0xfc5a('0x1f')](function(_0x18d83d){logger[_0xfc5a('0x20')](_0xfc5a('0x21'),_0x492e44,_0xfc5a('0x22'));logger[_0xfc5a('0x23')](_0xfc5a('0x24'),_0x492e44,_0xfc5a('0x22'),JSON['stringify'](_0x18d83d));if(_0x18d83d[_0xfc5a('0x25')]){if(_0x18d83d['error'][_0xfc5a('0x26')]===0x1f4){logger[_0xfc5a('0x25')](_0xfc5a('0x21'),_0x492e44,_0x18d83d['error'][_0xfc5a('0x27')]);return _0x77d189(_0x18d83d[_0xfc5a('0x25')][_0xfc5a('0x27')]);}logger['error'](_0xfc5a('0x21'),_0x492e44,_0x18d83d[_0xfc5a('0x25')][_0xfc5a('0x27')]);return _0x564d0f(_0x18d83d['error'][_0xfc5a('0x27')]);}else{logger[_0xfc5a('0x20')]('FaxMessage,\x20%s,\x20%s',_0x492e44,_0xfc5a('0x22'));_0x564d0f(_0x18d83d[_0xfc5a('0x28')][_0xfc5a('0x27')]);}})[_0xfc5a('0x29')](function(_0x59c436){logger[_0xfc5a('0x25')](_0xfc5a('0x21'),_0x492e44,_0x59c436);_0x77d189(_0x59c436);});});}function respondWithStatusCode(_0x380e64,_0x46008b){_0x46008b=_0x46008b||0xcc;return function(_0x33d9c9){if(_0x33d9c9){return _0x380e64[_0xfc5a('0x2a')](_0x46008b);}return _0x380e64['status'](_0x46008b)[_0xfc5a('0x2b')]();};}function respondWithResult(_0x6bd16b,_0x49b677){_0x49b677=_0x49b677||0xc8;return function(_0x38ace3){if(_0x38ace3){return _0x6bd16b['status'](_0x49b677)[_0xfc5a('0x2c')](_0x38ace3);}};}function respondWithFilteredResult(_0x4fb858,_0x1ca6c3){return function(_0x4f0837){if(_0x4f0837){var _0x4d9596=typeof _0x1ca6c3['offset']===_0xfc5a('0x2d')&&typeof _0x1ca6c3['limit']===_0xfc5a('0x2d');var _0x29747f=_0x4f0837[_0xfc5a('0x2e')];var _0xf840fd=_0x4d9596?0x0:_0x1ca6c3['offset'];var _0xb0a193=_0x4d9596?_0x4f0837[_0xfc5a('0x2e')]:_0x1ca6c3['offset']+_0x1ca6c3[_0xfc5a('0x2f')];var _0x1ff6f3;if(_0xb0a193>=_0x29747f){_0xb0a193=_0x29747f;_0x1ff6f3=0xc8;}else{_0x1ff6f3=0xce;}_0x4fb858[_0xfc5a('0x30')](_0x1ff6f3);return _0x4fb858[_0xfc5a('0x31')](_0xfc5a('0x32'),_0xf840fd+'-'+_0xb0a193+'/'+_0x29747f)[_0xfc5a('0x2c')](_0x4f0837);}return null;};}function patchUpdates(_0x342cc4){return function(_0x47fa66){try{jsonpatch[_0xfc5a('0x33')](_0x47fa66,_0x342cc4,!![]);}catch(_0x147a2b){return BPromise[_0xfc5a('0x34')](_0x147a2b);}return _0x47fa66[_0xfc5a('0x35')]();};}function saveUpdates(_0x37ad44,_0x4076e4){return function(_0x4817bd){if(_0x4817bd){return _0x4817bd[_0xfc5a('0x36')](_0x37ad44)[_0xfc5a('0x1f')](function(_0x11b708){return _0x11b708;});}return null;};}function removeEntity(_0x340249,_0x15816f){return function(_0xb55542){if(_0xb55542){return _0xb55542['destroy']()['then'](function(){_0x340249[_0xfc5a('0x30')](0xcc)[_0xfc5a('0x2b')]();});}};}function handleEntityNotFound(_0x3085ee,_0x17aa37){return function(_0x41a3b){if(!_0x41a3b){_0x3085ee[_0xfc5a('0x2a')](0x194);}return _0x41a3b;};}function handleError(_0xb40af7,_0x23efaa){_0x23efaa=_0x23efaa||0x1f4;return function(_0x164565){logger[_0xfc5a('0x25')](_0x164565[_0xfc5a('0x37')]);if(_0x164565[_0xfc5a('0x38')]){delete _0x164565[_0xfc5a('0x38')];}_0xb40af7[_0xfc5a('0x30')](_0x23efaa)['send'](_0x164565);};}exports[_0xfc5a('0x39')]=function(_0x2208b6,_0x201f6b){var _0x5bb32b={},_0x22fe49={},_0x4ff4af={'count':0x0,'rows':[]};var _0x3c1e2c=_[_0xfc5a('0x3a')](db[_0xfc5a('0x3b')][_0xfc5a('0x3c')],function(_0x33eaff){return{'name':_0x33eaff[_0xfc5a('0x3d')],'type':_0x33eaff[_0xfc5a('0x3e')][_0xfc5a('0x3f')]};});_0x22fe49[_0xfc5a('0x40')]=_[_0xfc5a('0x3a')](_0x3c1e2c,'name');_0x22fe49['query']=_[_0xfc5a('0x41')](_0x2208b6[_0xfc5a('0x42')]);_0x22fe49['filters']=_['intersection'](_0x22fe49[_0xfc5a('0x40')],_0x22fe49[_0xfc5a('0x42')]);_0x5bb32b[_0xfc5a('0x43')]=_[_0xfc5a('0x44')](_0x22fe49[_0xfc5a('0x40')],qs[_0xfc5a('0x45')](_0x2208b6[_0xfc5a('0x42')][_0xfc5a('0x45')]));_0x5bb32b[_0xfc5a('0x43')]=_0x5bb32b[_0xfc5a('0x43')][_0xfc5a('0x46')]?_0x5bb32b[_0xfc5a('0x43')]:_0x22fe49[_0xfc5a('0x40')];if(!_0x2208b6[_0xfc5a('0x42')][_0xfc5a('0x47')]('nolimit')){_0x5bb32b[_0xfc5a('0x2f')]=qs[_0xfc5a('0x2f')](_0x2208b6[_0xfc5a('0x42')][_0xfc5a('0x2f')]);_0x5bb32b[_0xfc5a('0x48')]=qs[_0xfc5a('0x48')](_0x2208b6[_0xfc5a('0x42')][_0xfc5a('0x48')]);}_0x5bb32b[_0xfc5a('0x49')]=qs['sort'](_0x2208b6['query'][_0xfc5a('0x4a')]);_0x5bb32b[_0xfc5a('0x4b')]=qs['filters'](_[_0xfc5a('0x4c')](_0x2208b6['query'],_0x22fe49[_0xfc5a('0x4d')]),_0x3c1e2c);if(_0x2208b6[_0xfc5a('0x42')]['filter']){_0x5bb32b[_0xfc5a('0x4b')]=_[_0xfc5a('0x4e')](_0x5bb32b[_0xfc5a('0x4b')],{'$or':_[_0xfc5a('0x3a')](_0x3c1e2c,function(_0x83237d){if(_0x83237d[_0xfc5a('0x3e')]!==_0xfc5a('0x4f')){var _0x13242a={};_0x13242a[_0x83237d['name']]={'$like':'%'+_0x2208b6[_0xfc5a('0x42')][_0xfc5a('0x50')]+'%'};return _0x13242a;}})});}_0x5bb32b=_[_0xfc5a('0x4e')]({},_0x5bb32b,_0x2208b6['options']);var _0x39fdc6={'where':_0x5bb32b[_0xfc5a('0x4b')]};return db[_0xfc5a('0x3b')][_0xfc5a('0x2e')](_0x39fdc6)[_0xfc5a('0x1f')](function(_0x428ecb){_0x4ff4af['count']=_0x428ecb;if(_0x2208b6[_0xfc5a('0x42')][_0xfc5a('0x51')]){_0x5bb32b[_0xfc5a('0x52')]=[{'all':!![]}];}return db[_0xfc5a('0x3b')]['findAll'](_0x5bb32b);})['then'](function(_0x13d1c6){_0x4ff4af[_0xfc5a('0x53')]=_0x13d1c6;return _0x4ff4af;})[_0xfc5a('0x1f')](respondWithFilteredResult(_0x201f6b,_0x5bb32b))['catch'](handleError(_0x201f6b,null));};exports['show']=function(_0x54a028,_0xf75acb){var _0x3cdbd8={'raw':!![],'where':{'id':_0x54a028['params']['id']}},_0x519f33={};_0x519f33[_0xfc5a('0x40')]=_['keys'](db[_0xfc5a('0x3b')][_0xfc5a('0x3c')]);_0x519f33[_0xfc5a('0x42')]=_[_0xfc5a('0x41')](_0x54a028[_0xfc5a('0x42')]);_0x519f33[_0xfc5a('0x4d')]=_[_0xfc5a('0x44')](_0x519f33[_0xfc5a('0x40')],_0x519f33[_0xfc5a('0x42')]);_0x3cdbd8[_0xfc5a('0x43')]=_[_0xfc5a('0x44')](_0x519f33[_0xfc5a('0x40')],qs['fields'](_0x54a028[_0xfc5a('0x42')][_0xfc5a('0x45')]));_0x3cdbd8[_0xfc5a('0x43')]=_0x3cdbd8[_0xfc5a('0x43')][_0xfc5a('0x46')]?_0x3cdbd8[_0xfc5a('0x43')]:_0x519f33['model'];if(_0x54a028['query'][_0xfc5a('0x51')]){_0x3cdbd8[_0xfc5a('0x52')]=[{'all':!![]}];}_0x3cdbd8=_['merge']({},_0x3cdbd8,_0x54a028[_0xfc5a('0x54')]);return db[_0xfc5a('0x3b')][_0xfc5a('0x55')](_0x3cdbd8)[_0xfc5a('0x1f')](handleEntityNotFound(_0xf75acb,null))[_0xfc5a('0x1f')](respondWithResult(_0xf75acb,null))[_0xfc5a('0x29')](handleError(_0xf75acb,null));};exports[_0xfc5a('0x36')]=function(_0x425ce2,_0x4e8e8c){if(_0x425ce2[_0xfc5a('0x56')]['id']){delete _0x425ce2[_0xfc5a('0x56')]['id'];}return db[_0xfc5a('0x3b')][_0xfc5a('0x55')]({'where':{'id':_0x425ce2[_0xfc5a('0x57')]['id']}})['then'](handleEntityNotFound(_0x4e8e8c,null))[_0xfc5a('0x1f')](saveUpdates(_0x425ce2[_0xfc5a('0x56')],null))[_0xfc5a('0x1f')](respondWithResult(_0x4e8e8c,null))[_0xfc5a('0x29')](handleError(_0x4e8e8c,null));};exports[_0xfc5a('0x58')]=function(_0x327860,_0x2e8bd2){return db['FaxMessage']['find']({'where':{'id':_0x327860['params']['id']}})[_0xfc5a('0x1f')](handleEntityNotFound(_0x2e8bd2,null))[_0xfc5a('0x1f')](removeEntity(_0x2e8bd2,null))[_0xfc5a('0x29')](handleError(_0x2e8bd2,null));};exports[_0xfc5a('0x59')]=function(_0x3f6a82,_0x38cee4){return db[_0xfc5a('0x3b')][_0xfc5a('0x59')]()[_0xfc5a('0x1f')](respondWithResult(_0x38cee4,null))[_0xfc5a('0x29')](handleError(_0x38cee4,null));};var interaction_log=require(_0xfc5a('0x13'))(_0xfc5a('0x5a'));exports[_0xfc5a('0x5b')]=function(_0x25b47a,_0xd86c21,_0x33f270){var _0x1c040={'agent':{},'channel':_0xfc5a('0x5c')};if(_0x25b47a[_0xfc5a('0x56')]['id']){delete _0x25b47a['body']['id'];}_0x25b47a[_0xfc5a('0x56')][_0xfc5a('0x5d')]=!![];_0x25b47a['body'][_0xfc5a('0x5e')]=moment()[_0xfc5a('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x25b47a['body'][_0xfc5a('0x60')]=_0x25b47a[_0xfc5a('0x56')][_0xfc5a('0x60')]||_0x25b47a['user']['id'];_0x1c040['agent']['id']=_0x25b47a[_0xfc5a('0x56')]['UserId'];return db['FaxMessage'][_0xfc5a('0x55')]({'where':{'id':_0x25b47a[_0xfc5a('0x57')]['id'],'UserId':null}})[_0xfc5a('0x1f')](handleEntityNotFound(_0xd86c21,null))[_0xfc5a('0x1f')](saveUpdates(_0x25b47a[_0xfc5a('0x56')],null))['then'](function(_0x142a49){if(_0x142a49){_0x1c040['message']=_0x142a49[_0xfc5a('0x61')]({'plain':!![]});return db[_0xfc5a('0x62')][_0xfc5a('0x55')]({'where':{'id':_0x142a49[_0xfc5a('0x63')]}});}return null;})[_0xfc5a('0x1f')](handleEntityNotFound(_0xd86c21,null))[_0xfc5a('0x1f')](function(_0x162290){if(_0x162290){return _0x162290[_0xfc5a('0x36')]({'UserId':_0x25b47a[_0xfc5a('0x56')][_0xfc5a('0x60')],'read1stAt':_[_0xfc5a('0x64')](_0x162290['read1stAt'])?moment()[_0xfc5a('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xfc5a('0x1f')](function(_0xfc2c30){if(_0xfc2c30){_0x1c040[_0xfc5a('0x65')]=_0xfc2c30[_0xfc5a('0x61')]({'plain':!![]});interaction_log[_0xfc5a('0x20')](_0xfc5a('0x66'),_0x25b47a[_0xfc5a('0x67')]['id'],_0x25b47a[_0xfc5a('0x67')][_0xfc5a('0x38')],_0x25b47a[_0xfc5a('0x67')]['role'],_0x1c040['interaction']['id'],_0x25b47a[_0xfc5a('0x56')]?JSON[_0xfc5a('0x68')](_0x25b47a[_0xfc5a('0x56')]):_0xfc5a('0x69'));return respondWithRpcPromise(_0xfc5a('0x6a'),_0xfc5a('0x6b'),_0x1c040);}return null;})[_0xfc5a('0x1f')](function(_0x4c8815){var _0x45ff0e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4c8815[_0xfc5a('0x27')][_0xfc5a('0x6c')];return db[_0xfc5a('0x6d')]['query'](_0x45ff0e,{'type':db[_0xfc5a('0x6e')]['QueryTypes'][_0xfc5a('0x6f')],'raw':!![]})[_0xfc5a('0x1f')](function(_0x1f6298){return _0x1f6298;});})[_0xfc5a('0x1f')](function(_0x3bd611){if(_0x3bd611){_0x1c040[_0xfc5a('0x27')][_0xfc5a('0x70')]=_0x3bd611[0x0];if(!_0x25b47a[_0xfc5a('0x56')][_0xfc5a('0x60')])return;return db[_0xfc5a('0x71')][_0xfc5a('0x55')]({'where':{'id':_0x25b47a[_0xfc5a('0x56')][_0xfc5a('0x60')],'role':_0xfc5a('0x72')},'attributes':['id',_0xfc5a('0x38'),_0xfc5a('0x73'),_0xfc5a('0x74'),_0xfc5a('0x75')],'raw':!![]});}return null;})[_0xfc5a('0x1f')](function(_0x1de93b){if(!_0x1de93b)return null;_0x1c040[_0xfc5a('0x27')][_0xfc5a('0x72')]=_0x1de93b;return _0x1c040;})[_0xfc5a('0x1f')](function(_0x3a18b6){if(_0x3a18b6){if(_0x25b47a[_0xfc5a('0x56')][_0xfc5a('0x76')]){_0x1c040[_0xfc5a('0x27')][_0xfc5a('0x77')]=util[_0xfc5a('0x5f')](_0xfc5a('0x78'),_0x25b47a[_0xfc5a('0x67')][_0xfc5a('0x38')]);_0x1c040[_0xfc5a('0x27')]['channel']=_0x1c040[_0xfc5a('0x79')];_0x1c040[_0xfc5a('0x27')][_0xfc5a('0x7a')]=_0x1c040[_0xfc5a('0x79')];_0x1c040['message']['event']=_0xfc5a('0x5b');return respondWithRpcPromise(_0xfc5a('0x7b'),_0xfc5a('0x7b'),{'event':_0xfc5a('0x7c'),'message':_0x1c040['message']},client9002)[_0xfc5a('0x1f')](function(){return _0x1c040;});}return _0x1c040;}return null;})[_0xfc5a('0x1f')](respondWithResult(_0xd86c21,null))['catch'](handleError(_0xd86c21,null));};var interaction_log=require(_0xfc5a('0x13'))('fax-interactions');exports[_0xfc5a('0x34')]=function(_0x5f4dd0,_0x5c5f54,_0x401738){var _0x490a31={'agent':{},'channel':_0xfc5a('0x5c')};if(_0x5f4dd0[_0xfc5a('0x56')]['id']){delete _0x5f4dd0[_0xfc5a('0x56')]['id'];}_0x5f4dd0[_0xfc5a('0x56')][_0xfc5a('0x60')]=_0x5f4dd0[_0xfc5a('0x56')]['UserId']||_0x5f4dd0[_0xfc5a('0x67')]['id'];_0x490a31['agent']['id']=_0x5f4dd0[_0xfc5a('0x56')]['UserId'];return db[_0xfc5a('0x3b')][_0xfc5a('0x55')]({'where':{'id':_0x5f4dd0['params']['id'],'UserId':null}})[_0xfc5a('0x1f')](handleEntityNotFound(_0x5c5f54,null))[_0xfc5a('0x1f')](function(_0x1582eb){if(_0x1582eb){_0x490a31['message']=_0x1582eb[_0xfc5a('0x61')]({'plain':!![]});return db[_0xfc5a('0x62')][_0xfc5a('0x55')]({'where':{'id':_0x1582eb['FaxInteractionId']}});}return null;})[_0xfc5a('0x1f')](handleEntityNotFound(_0x5c5f54,null))['then'](function(_0x5bab05){if(_0x5bab05){_0x490a31[_0xfc5a('0x65')]=_0x5bab05[_0xfc5a('0x61')]({'plain':!![]});interaction_log[_0xfc5a('0x20')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5f4dd0[_0xfc5a('0x67')]['id'],_0x5f4dd0[_0xfc5a('0x67')]['name'],_0x5f4dd0[_0xfc5a('0x67')]['role'],_0x490a31[_0xfc5a('0x65')]['id'],_0x5f4dd0[_0xfc5a('0x56')]?JSON['stringify'](_0x5f4dd0[_0xfc5a('0x56')]):_0xfc5a('0x69'));return respondWithRpcPromise(_0xfc5a('0x7d'),'rejectMessage',_0x490a31);}return null;})[_0xfc5a('0x1f')](function(_0x85fef7){var _0x479b9f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x85fef7[_0xfc5a('0x27')][_0xfc5a('0x6c')];return db[_0xfc5a('0x6d')]['query'](_0x479b9f,{'type':db[_0xfc5a('0x6e')][_0xfc5a('0x7e')][_0xfc5a('0x6f')],'raw':!![]})[_0xfc5a('0x1f')](function(_0x36a2bf){return _0x36a2bf;});})[_0xfc5a('0x1f')](function(_0x566a77){if(_0x566a77){_0x490a31[_0xfc5a('0x27')][_0xfc5a('0x70')]=_0x566a77[0x0];if(!_0x5f4dd0['body'][_0xfc5a('0x60')])return;return db['User'][_0xfc5a('0x55')]({'where':{'id':_0x5f4dd0[_0xfc5a('0x56')][_0xfc5a('0x60')],'role':_0xfc5a('0x72')},'attributes':['id',_0xfc5a('0x38'),'fullname',_0xfc5a('0x74'),_0xfc5a('0x75')],'raw':!![]});}return null;})[_0xfc5a('0x1f')](function(_0x343d7e){if(!_0x343d7e)return null;_0x490a31[_0xfc5a('0x27')][_0xfc5a('0x72')]=_0x343d7e;return _0x490a31;})['then'](function(_0x5397c4){if(_0x5397c4){_0x5397c4[_0xfc5a('0x27')][_0xfc5a('0x77')]=util[_0xfc5a('0x5f')](_0xfc5a('0x78'),_0x5f4dd0[_0xfc5a('0x67')][_0xfc5a('0x38')]);_0x5397c4[_0xfc5a('0x27')][_0xfc5a('0x79')]=_0x490a31[_0xfc5a('0x79')];_0x5397c4['message'][_0xfc5a('0x7a')]=_0x490a31[_0xfc5a('0x79')];_0x5397c4['message'][_0xfc5a('0x7f')]='reject';respondWithRpcPromise(_0xfc5a('0x7b'),_0xfc5a('0x7b'),{'event':'rejectmessage','message':_0x5397c4[_0xfc5a('0x27')]},client9002);return _0x490a31;}return null;})['then'](respondWithResult(_0x5c5f54,null))['catch'](handleError(_0x5c5f54,null));};exports['create']=function(_0x416cde,_0x1c81d6){var _0x5af820;return db['FaxMessage'][_0xfc5a('0x80')](_0x416cde['body'],{})[_0xfc5a('0x1f')](function(_0x4565cb){_0x5af820=_0x4565cb;return db[_0xfc5a('0x81')][_0xfc5a('0x82')]({'where':{'id':_0x5af820[_0xfc5a('0x6c')]}});})[_0xfc5a('0x1f')](function(_0x5c6660){if(_[_0xfc5a('0x64')](_0x5c6660)){return;}else{_0x5af820[_0xfc5a('0x5c')]=_0x5c6660[_0xfc5a('0x5c')];return db[_0xfc5a('0x83')][_0xfc5a('0x82')]({'where':{'id':_0x5af820[_0xfc5a('0x84')]}});}})['then'](function(_0x3be139){return respondWithRpcPromise(_0xfc5a('0x85'),_0xfc5a('0x85'),{'FaxAccountId':_['isNil'](_0x416cde[_0xfc5a('0x56')])?undefined:_0x416cde[_0xfc5a('0x56')][_0xfc5a('0x86')],'path':_['isNil'](_0x3be139)?undefined:util['format'](_0xfc5a('0x87'),_0x3be139[_0xfc5a('0x88')]),'fax':_['isNil'](_0x5af820[_0xfc5a('0x5c')])?undefined:_0x5af820[_0xfc5a('0x5c')],'AttachmentId':_0x5af820[_0xfc5a('0x84')]},client9002);})[_0xfc5a('0x1f')](respondWithResult(_0x1c81d6,0xc9))[_0xfc5a('0x29')](handleError(_0x1c81d6,null));};exports[_0xfc5a('0x89')]=function(_0x21846d,_0x16d121){var _0x1661ee=path[_0xfc5a('0x8a')](config[_0xfc5a('0x8b')],_0xfc5a('0x8c'),'files',_0xfc5a('0x8d'));return db[_0xfc5a('0x3b')]['find']({'where':{'id':_0x21846d[_0xfc5a('0x57')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0xfc5a('0x1f')](handleEntityNotFound(_0x16d121,null))[_0xfc5a('0x1f')](function(_0x10401e){if(_0x10401e){return _0x16d121[_0xfc5a('0x89')](path['join'](_0x1661ee,_0x10401e['Attachment'][_0xfc5a('0x88')]));}})[_0xfc5a('0x29')](handleError(_0x16d121,null));}; \ No newline at end of file +var _0xe715=['interaction','null','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','FaxInteraction','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','event','rejectmessage','create','CmContact','findOne','Attachment','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','files','attachments','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','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','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','http','client','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','FaxMessage','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','rows','show','params','rawAttributes','includeAll','include','body','find','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role'];(function(_0x521f7a,_0x1159be){var _0x34a290=function(_0x3978ae){while(--_0x3978ae){_0x521f7a['push'](_0x521f7a['shift']());}};_0x34a290(++_0x1159be);}(_0xe715,0xb2));var _0x5e71=function(_0x2d85cc,_0x57505d){_0x2d85cc=_0x2d85cc-0x0;var _0x4e8cf9=_0xe715[_0x2d85cc];return _0x4e8cf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e71('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e71('0x1'));var rp=require(_0x5e71('0x2'));var moment=require(_0x5e71('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5e71('0x4'));var path=require(_0x5e71('0x5'));var sox=require(_0x5e71('0x6'));var csv=require(_0x5e71('0x7'));var ejs=require(_0x5e71('0x8'));var fs=require('fs');var fs_extra=require(_0x5e71('0x9'));var _=require('lodash');var squel=require(_0x5e71('0xa'));var crypto=require(_0x5e71('0xb'));var jsforce=require(_0x5e71('0xc'));var deskjs=require(_0x5e71('0xd'));var toCsv=require(_0x5e71('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5e71('0xe'));var qs=require(_0x5e71('0xf'));var as=require(_0x5e71('0x10'));var hardwareService=require(_0x5e71('0x11'));var logger=require(_0x5e71('0x12'))(_0x5e71('0x13'));var utils=require(_0x5e71('0x14'));var config=require(_0x5e71('0x15'));var licenseUtil=require(_0x5e71('0x16'));var db=require('../../mysqldb')['db'];config[_0x5e71('0x17')]=_[_0x5e71('0x18')](config[_0x5e71('0x17')],{'host':_0x5e71('0x19'),'port':0x18eb});var socket=require(_0x5e71('0x1a'))(new Redis(config[_0x5e71('0x17')]));require(_0x5e71('0x1b'))[_0x5e71('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5e71('0x1d')]({'port':0x232c});var client9002=jayson[_0x5e71('0x1e')][_0x5e71('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x47e9e9,_0x4ce530,_0xa00a3,_0x2231f0){return new BPromise(function(_0x242844,_0x432add){var _0x152714=_0x2231f0||client;return _0x152714[_0x5e71('0x1f')](_0x47e9e9,_0xa00a3)['then'](function(_0x296574){logger[_0x5e71('0x20')](_0x5e71('0x21'),_0x4ce530,_0x5e71('0x22'));logger[_0x5e71('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x4ce530,'request\x20sent',JSON[_0x5e71('0x24')](_0x296574));if(_0x296574[_0x5e71('0x25')]){if(_0x296574[_0x5e71('0x25')][_0x5e71('0x26')]===0x1f4){logger[_0x5e71('0x25')]('FaxMessage,\x20%s,\x20%s',_0x4ce530,_0x296574[_0x5e71('0x25')][_0x5e71('0x27')]);return _0x432add(_0x296574[_0x5e71('0x25')][_0x5e71('0x27')]);}logger[_0x5e71('0x25')](_0x5e71('0x21'),_0x4ce530,_0x296574['error'][_0x5e71('0x27')]);return _0x242844(_0x296574['error'][_0x5e71('0x27')]);}else{logger[_0x5e71('0x20')](_0x5e71('0x21'),_0x4ce530,'request\x20sent');_0x242844(_0x296574['result']['message']);}})[_0x5e71('0x28')](function(_0x58745e){logger[_0x5e71('0x25')](_0x5e71('0x21'),_0x4ce530,_0x58745e);_0x432add(_0x58745e);});});}function respondWithStatusCode(_0x402fd9,_0x1e434d){_0x1e434d=_0x1e434d||0xcc;return function(_0x98e928){if(_0x98e928){return _0x402fd9['sendStatus'](_0x1e434d);}return _0x402fd9[_0x5e71('0x29')](_0x1e434d)['end']();};}function respondWithResult(_0x2ae883,_0x50fea2){_0x50fea2=_0x50fea2||0xc8;return function(_0x1a954f){if(_0x1a954f){return _0x2ae883[_0x5e71('0x29')](_0x50fea2)[_0x5e71('0x2a')](_0x1a954f);}};}function respondWithFilteredResult(_0x106cb0,_0x233cc4){return function(_0x28f6d){if(_0x28f6d){var _0x141ce0=typeof _0x233cc4['offset']===_0x5e71('0x2b')&&typeof _0x233cc4[_0x5e71('0x2c')]===_0x5e71('0x2b');var _0x1a0af8=_0x28f6d[_0x5e71('0x2d')];var _0xc68986=_0x141ce0?0x0:_0x233cc4['offset'];var _0x372412=_0x141ce0?_0x28f6d[_0x5e71('0x2d')]:_0x233cc4['offset']+_0x233cc4[_0x5e71('0x2c')];var _0x3a0ee4;if(_0x372412>=_0x1a0af8){_0x372412=_0x1a0af8;_0x3a0ee4=0xc8;}else{_0x3a0ee4=0xce;}_0x106cb0[_0x5e71('0x29')](_0x3a0ee4);return _0x106cb0[_0x5e71('0x2e')](_0x5e71('0x2f'),_0xc68986+'-'+_0x372412+'/'+_0x1a0af8)[_0x5e71('0x2a')](_0x28f6d);}return null;};}function patchUpdates(_0x5ec87a){return function(_0x3b4a79){try{jsonpatch[_0x5e71('0x30')](_0x3b4a79,_0x5ec87a,!![]);}catch(_0x389f1b){return BPromise[_0x5e71('0x31')](_0x389f1b);}return _0x3b4a79[_0x5e71('0x32')]();};}function saveUpdates(_0x1ae565,_0x5c1d47){return function(_0x575f72){if(_0x575f72){return _0x575f72[_0x5e71('0x33')](_0x1ae565)['then'](function(_0x4bf14b){return _0x4bf14b;});}return null;};}function removeEntity(_0x45b6cf,_0x5c39b9){return function(_0x18236c){if(_0x18236c){return _0x18236c[_0x5e71('0x34')]()[_0x5e71('0x35')](function(){_0x45b6cf[_0x5e71('0x29')](0xcc)[_0x5e71('0x36')]();});}};}function handleEntityNotFound(_0x8ef3e2,_0xcfeb51){return function(_0x2a4b8e){if(!_0x2a4b8e){_0x8ef3e2['sendStatus'](0x194);}return _0x2a4b8e;};}function handleError(_0x350330,_0x1f5390){_0x1f5390=_0x1f5390||0x1f4;return function(_0x579035){logger[_0x5e71('0x25')](_0x579035[_0x5e71('0x37')]);if(_0x579035[_0x5e71('0x38')]){delete _0x579035[_0x5e71('0x38')];}_0x350330['status'](_0x1f5390)[_0x5e71('0x39')](_0x579035);};}exports[_0x5e71('0x3a')]=function(_0x5bc023,_0x39317e){var _0x3a3773={},_0x31d5f8={},_0x268b1d={'count':0x0,'rows':[]};var _0x2d493d=_[_0x5e71('0x3b')](db[_0x5e71('0x3c')]['rawAttributes'],function(_0x3afe62){return{'name':_0x3afe62['fieldName'],'type':_0x3afe62[_0x5e71('0x3d')][_0x5e71('0x3e')]};});_0x31d5f8['model']=_[_0x5e71('0x3b')](_0x2d493d,_0x5e71('0x38'));_0x31d5f8[_0x5e71('0x3f')]=_[_0x5e71('0x40')](_0x5bc023[_0x5e71('0x3f')]);_0x31d5f8[_0x5e71('0x41')]=_['intersection'](_0x31d5f8[_0x5e71('0x42')],_0x31d5f8[_0x5e71('0x3f')]);_0x3a3773[_0x5e71('0x43')]=_[_0x5e71('0x44')](_0x31d5f8['model'],qs[_0x5e71('0x45')](_0x5bc023[_0x5e71('0x3f')][_0x5e71('0x45')]));_0x3a3773[_0x5e71('0x43')]=_0x3a3773[_0x5e71('0x43')][_0x5e71('0x46')]?_0x3a3773[_0x5e71('0x43')]:_0x31d5f8['model'];if(!_0x5bc023['query'][_0x5e71('0x47')](_0x5e71('0x48'))){_0x3a3773[_0x5e71('0x2c')]=qs[_0x5e71('0x2c')](_0x5bc023[_0x5e71('0x3f')]['limit']);_0x3a3773[_0x5e71('0x49')]=qs[_0x5e71('0x49')](_0x5bc023[_0x5e71('0x3f')]['offset']);}_0x3a3773[_0x5e71('0x4a')]=qs[_0x5e71('0x4b')](_0x5bc023[_0x5e71('0x3f')][_0x5e71('0x4b')]);_0x3a3773[_0x5e71('0x4c')]=qs['filters'](_[_0x5e71('0x4d')](_0x5bc023['query'],_0x31d5f8[_0x5e71('0x41')]),_0x2d493d);if(_0x5bc023[_0x5e71('0x3f')][_0x5e71('0x4e')]){_0x3a3773[_0x5e71('0x4c')]=_[_0x5e71('0x4f')](_0x3a3773['where'],{'$or':_[_0x5e71('0x3b')](_0x2d493d,function(_0x5ab014){if(_0x5ab014[_0x5e71('0x3d')]!=='VIRTUAL'){var _0x525f0b={};_0x525f0b[_0x5ab014[_0x5e71('0x38')]]={'$like':'%'+_0x5bc023[_0x5e71('0x3f')][_0x5e71('0x4e')]+'%'};return _0x525f0b;}})});}_0x3a3773=_[_0x5e71('0x4f')]({},_0x3a3773,_0x5bc023[_0x5e71('0x50')]);var _0x818ba2={'where':_0x3a3773['where']};return db[_0x5e71('0x3c')][_0x5e71('0x2d')](_0x818ba2)[_0x5e71('0x35')](function(_0xef2ffa){_0x268b1d[_0x5e71('0x2d')]=_0xef2ffa;if(_0x5bc023['query']['includeAll']){_0x3a3773['include']=[{'all':!![]}];}return db[_0x5e71('0x3c')]['findAll'](_0x3a3773);})[_0x5e71('0x35')](function(_0x12a010){_0x268b1d[_0x5e71('0x51')]=_0x12a010;return _0x268b1d;})['then'](respondWithFilteredResult(_0x39317e,_0x3a3773))[_0x5e71('0x28')](handleError(_0x39317e,null));};exports[_0x5e71('0x52')]=function(_0x33669d,_0x443ab2){var _0x1e12cd={'raw':!![],'where':{'id':_0x33669d[_0x5e71('0x53')]['id']}},_0x52577b={};_0x52577b['model']=_[_0x5e71('0x40')](db[_0x5e71('0x3c')][_0x5e71('0x54')]);_0x52577b[_0x5e71('0x3f')]=_['keys'](_0x33669d[_0x5e71('0x3f')]);_0x52577b[_0x5e71('0x41')]=_['intersection'](_0x52577b[_0x5e71('0x42')],_0x52577b[_0x5e71('0x3f')]);_0x1e12cd['attributes']=_[_0x5e71('0x44')](_0x52577b['model'],qs[_0x5e71('0x45')](_0x33669d[_0x5e71('0x3f')][_0x5e71('0x45')]));_0x1e12cd['attributes']=_0x1e12cd[_0x5e71('0x43')][_0x5e71('0x46')]?_0x1e12cd['attributes']:_0x52577b[_0x5e71('0x42')];if(_0x33669d[_0x5e71('0x3f')][_0x5e71('0x55')]){_0x1e12cd[_0x5e71('0x56')]=[{'all':!![]}];}_0x1e12cd=_['merge']({},_0x1e12cd,_0x33669d[_0x5e71('0x50')]);return db[_0x5e71('0x3c')]['find'](_0x1e12cd)[_0x5e71('0x35')](handleEntityNotFound(_0x443ab2,null))['then'](respondWithResult(_0x443ab2,null))[_0x5e71('0x28')](handleError(_0x443ab2,null));};exports[_0x5e71('0x33')]=function(_0x5993fa,_0x5728dc){if(_0x5993fa[_0x5e71('0x57')]['id']){delete _0x5993fa[_0x5e71('0x57')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x5993fa['params']['id']}})[_0x5e71('0x35')](handleEntityNotFound(_0x5728dc,null))[_0x5e71('0x35')](saveUpdates(_0x5993fa[_0x5e71('0x57')],null))[_0x5e71('0x35')](respondWithResult(_0x5728dc,null))[_0x5e71('0x28')](handleError(_0x5728dc,null));};exports['destroy']=function(_0x4b1eb5,_0x7bfc4f){return db[_0x5e71('0x3c')][_0x5e71('0x58')]({'where':{'id':_0x4b1eb5[_0x5e71('0x53')]['id']}})[_0x5e71('0x35')](handleEntityNotFound(_0x7bfc4f,null))[_0x5e71('0x35')](removeEntity(_0x7bfc4f,null))[_0x5e71('0x28')](handleError(_0x7bfc4f,null));};exports[_0x5e71('0x59')]=function(_0x3ddc50,_0x5a9dab){return db[_0x5e71('0x3c')][_0x5e71('0x59')]()[_0x5e71('0x35')](respondWithResult(_0x5a9dab,null))[_0x5e71('0x28')](handleError(_0x5a9dab,null));};var interaction_log=require(_0x5e71('0x12'))(_0x5e71('0x5a'));exports[_0x5e71('0x5b')]=function(_0x331bfd,_0x4c0351,_0x1793a8){var _0xd82220={'agent':{},'channel':_0x5e71('0x5c')};if(_0x331bfd[_0x5e71('0x57')]['id']){delete _0x331bfd[_0x5e71('0x57')]['id'];}_0x331bfd[_0x5e71('0x57')][_0x5e71('0x5d')]=!![];_0x331bfd[_0x5e71('0x57')]['readAt']=moment()[_0x5e71('0x5e')](_0x5e71('0x5f'));_0x331bfd[_0x5e71('0x57')][_0x5e71('0x60')]=_0x331bfd[_0x5e71('0x57')][_0x5e71('0x60')]||_0x331bfd[_0x5e71('0x61')]['id'];_0xd82220[_0x5e71('0x62')]['id']=_0x331bfd[_0x5e71('0x57')][_0x5e71('0x60')];return db['FaxMessage'][_0x5e71('0x58')]({'where':{'id':_0x331bfd[_0x5e71('0x53')]['id'],'UserId':null}})[_0x5e71('0x35')](handleEntityNotFound(_0x4c0351,null))['then'](saveUpdates(_0x331bfd[_0x5e71('0x57')],null))[_0x5e71('0x35')](function(_0x264e61){if(_0x264e61){_0xd82220[_0x5e71('0x27')]=_0x264e61['get']({'plain':!![]});return db['FaxInteraction'][_0x5e71('0x58')]({'where':{'id':_0x264e61[_0x5e71('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x4c0351,null))[_0x5e71('0x35')](function(_0x47cf24){if(_0x47cf24){return _0x47cf24['update']({'UserId':_0x331bfd[_0x5e71('0x57')]['UserId'],'read1stAt':_[_0x5e71('0x64')](_0x47cf24[_0x5e71('0x65')])?moment()[_0x5e71('0x5e')](_0x5e71('0x5f')):undefined});}return null;})[_0x5e71('0x35')](function(_0x113681){if(_0x113681){_0xd82220['interaction']=_0x113681['get']({'plain':!![]});interaction_log[_0x5e71('0x20')](_0x5e71('0x66'),_0x331bfd[_0x5e71('0x61')]['id'],_0x331bfd['user'][_0x5e71('0x38')],_0x331bfd[_0x5e71('0x61')][_0x5e71('0x67')],_0xd82220[_0x5e71('0x68')]['id'],_0x331bfd[_0x5e71('0x57')]?JSON[_0x5e71('0x24')](_0x331bfd['body']):_0x5e71('0x69'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0xd82220);}return null;})['then'](function(_0x2b124f){var _0x5ceeaa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2b124f[_0x5e71('0x27')][_0x5e71('0x6a')];return db['sequelize'][_0x5e71('0x3f')](_0x5ceeaa,{'type':db[_0x5e71('0x6b')][_0x5e71('0x6c')]['SELECT'],'raw':!![]})[_0x5e71('0x35')](function(_0x4aa7e3){return _0x4aa7e3;});})[_0x5e71('0x35')](function(_0xa52a44){if(_0xa52a44){_0xd82220[_0x5e71('0x27')][_0x5e71('0x6d')]=_0xa52a44[0x0];if(!_0x331bfd[_0x5e71('0x57')][_0x5e71('0x60')])return;return db[_0x5e71('0x6e')]['find']({'where':{'id':_0x331bfd[_0x5e71('0x57')][_0x5e71('0x60')],'role':_0x5e71('0x62')},'attributes':['id','name',_0x5e71('0x6f'),_0x5e71('0x70'),_0x5e71('0x71')],'raw':!![]});}return null;})[_0x5e71('0x35')](function(_0x2b0a06){if(!_0x2b0a06)return null;_0xd82220[_0x5e71('0x27')][_0x5e71('0x62')]=_0x2b0a06;return _0xd82220;})[_0x5e71('0x35')](function(_0x45c6ef){if(_0x45c6ef){if(_0x331bfd[_0x5e71('0x57')][_0x5e71('0x72')]){_0xd82220[_0x5e71('0x27')][_0x5e71('0x73')]=util['format'](_0x5e71('0x74'),_0x331bfd[_0x5e71('0x61')][_0x5e71('0x38')]);_0xd82220[_0x5e71('0x27')][_0x5e71('0x75')]=_0xd82220[_0x5e71('0x75')];_0xd82220[_0x5e71('0x27')][_0x5e71('0x76')]=_0xd82220['channel'];_0xd82220[_0x5e71('0x27')]['event']=_0x5e71('0x5b');return respondWithRpcPromise(_0x5e71('0x77'),_0x5e71('0x77'),{'event':_0x5e71('0x78'),'message':_0xd82220[_0x5e71('0x27')]},client9002)[_0x5e71('0x35')](function(){return _0xd82220;});}return _0xd82220;}return null;})['then'](respondWithResult(_0x4c0351,null))[_0x5e71('0x28')](handleError(_0x4c0351,null));};var interaction_log=require(_0x5e71('0x12'))(_0x5e71('0x5a'));exports[_0x5e71('0x31')]=function(_0x1da894,_0x11f3a2,_0x4afb4e){var _0x591139={'agent':{},'channel':_0x5e71('0x5c')};if(_0x1da894[_0x5e71('0x57')]['id']){delete _0x1da894[_0x5e71('0x57')]['id'];}_0x1da894[_0x5e71('0x57')][_0x5e71('0x60')]=_0x1da894[_0x5e71('0x57')][_0x5e71('0x60')]||_0x1da894['user']['id'];_0x591139[_0x5e71('0x62')]['id']=_0x1da894[_0x5e71('0x57')][_0x5e71('0x60')];return db[_0x5e71('0x3c')][_0x5e71('0x58')]({'where':{'id':_0x1da894[_0x5e71('0x53')]['id'],'UserId':null}})[_0x5e71('0x35')](handleEntityNotFound(_0x11f3a2,null))[_0x5e71('0x35')](function(_0x1a46aa){if(_0x1a46aa){_0x591139[_0x5e71('0x27')]=_0x1a46aa['get']({'plain':!![]});return db[_0x5e71('0x79')][_0x5e71('0x58')]({'where':{'id':_0x1a46aa[_0x5e71('0x63')]}});}return null;})[_0x5e71('0x35')](handleEntityNotFound(_0x11f3a2,null))[_0x5e71('0x35')](function(_0x2e218b){if(_0x2e218b){_0x591139[_0x5e71('0x68')]=_0x2e218b['get']({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1da894[_0x5e71('0x61')]['id'],_0x1da894[_0x5e71('0x61')][_0x5e71('0x38')],_0x1da894['user'][_0x5e71('0x67')],_0x591139[_0x5e71('0x68')]['id'],_0x1da894[_0x5e71('0x57')]?JSON[_0x5e71('0x24')](_0x1da894['body']):_0x5e71('0x69'));return respondWithRpcPromise(_0x5e71('0x7a'),_0x5e71('0x7b'),_0x591139);}return null;})[_0x5e71('0x35')](function(_0x500983){var _0x25892f=_0x5e71('0x7c')+_0x500983[_0x5e71('0x27')][_0x5e71('0x6a')];return db['sequelize'][_0x5e71('0x3f')](_0x25892f,{'type':db[_0x5e71('0x6b')][_0x5e71('0x6c')][_0x5e71('0x7d')],'raw':!![]})['then'](function(_0x399a8a){return _0x399a8a;});})[_0x5e71('0x35')](function(_0x4b4587){if(_0x4b4587){_0x591139[_0x5e71('0x27')][_0x5e71('0x6d')]=_0x4b4587[0x0];if(!_0x1da894[_0x5e71('0x57')][_0x5e71('0x60')])return;return db[_0x5e71('0x6e')]['find']({'where':{'id':_0x1da894['body'][_0x5e71('0x60')],'role':_0x5e71('0x62')},'attributes':['id',_0x5e71('0x38'),_0x5e71('0x6f'),_0x5e71('0x70'),'internal'],'raw':!![]});}return null;})[_0x5e71('0x35')](function(_0x448a55){if(!_0x448a55)return null;_0x591139[_0x5e71('0x27')]['agent']=_0x448a55;return _0x591139;})[_0x5e71('0x35')](function(_0x21166a){if(_0x21166a){_0x21166a[_0x5e71('0x27')][_0x5e71('0x73')]=util['format'](_0x5e71('0x74'),_0x1da894[_0x5e71('0x61')][_0x5e71('0x38')]);_0x21166a['message']['channel']=_0x591139[_0x5e71('0x75')];_0x21166a[_0x5e71('0x27')]['motionChannel']=_0x591139[_0x5e71('0x75')];_0x21166a[_0x5e71('0x27')][_0x5e71('0x7e')]=_0x5e71('0x31');respondWithRpcPromise(_0x5e71('0x77'),_0x5e71('0x77'),{'event':_0x5e71('0x7f'),'message':_0x21166a['message']},client9002);return _0x591139;}return null;})['then'](respondWithResult(_0x11f3a2,null))['catch'](handleError(_0x11f3a2,null));};exports[_0x5e71('0x80')]=function(_0x473259,_0x2cf9ff){var _0x1b3d66;return db[_0x5e71('0x3c')]['create'](_0x473259['body'],{})[_0x5e71('0x35')](function(_0x390678){_0x1b3d66=_0x390678;return db[_0x5e71('0x81')][_0x5e71('0x82')]({'where':{'id':_0x1b3d66['ContactId']}});})['then'](function(_0x41e528){if(_[_0x5e71('0x64')](_0x41e528)){return;}else{_0x1b3d66[_0x5e71('0x5c')]=_0x41e528['fax'];return db[_0x5e71('0x83')]['findOne']({'where':{'id':_0x1b3d66['AttachmentId']}});}})[_0x5e71('0x35')](function(_0x3f5fcb){return respondWithRpcPromise(_0x5e71('0x84'),_0x5e71('0x84'),{'FaxAccountId':_['isNil'](_0x473259[_0x5e71('0x57')])?undefined:_0x473259[_0x5e71('0x57')]['FaxAccountId'],'path':_[_0x5e71('0x64')](_0x3f5fcb)?undefined:util[_0x5e71('0x5e')](_0x5e71('0x85'),_0x3f5fcb[_0x5e71('0x86')]),'fax':_[_0x5e71('0x64')](_0x1b3d66[_0x5e71('0x5c')])?undefined:_0x1b3d66['fax'],'AttachmentId':_0x1b3d66[_0x5e71('0x87')]},client9002);})[_0x5e71('0x35')](respondWithResult(_0x2cf9ff,0xc9))[_0x5e71('0x28')](handleError(_0x2cf9ff,null));};exports[_0x5e71('0x88')]=function(_0x2e9ebb,_0x223ae0){var _0xfceeae=path[_0x5e71('0x89')](config[_0x5e71('0x8a')],'server',_0x5e71('0x8b'),_0x5e71('0x8c'));return db[_0x5e71('0x3c')]['find']({'where':{'id':_0x2e9ebb[_0x5e71('0x53')]['id']},'include':[{'model':db['Attachment'],'as':_0x5e71('0x83')}]})[_0x5e71('0x35')](handleEntityNotFound(_0x223ae0,null))[_0x5e71('0x35')](function(_0x226483){if(_0x226483){return _0x223ae0[_0x5e71('0x88')](path['join'](_0xfceeae,_0x226483[_0x5e71('0x83')]['basename']));}})[_0x5e71('0x28')](handleError(_0x223ae0,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 24dab4f..e433910 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 _0x933c=['../../mysqldb','FaxMessage','setMaxListeners','save','emit','hook','events'];(function(_0x438003,_0x5057b5){var _0x49a251=function(_0xf3faf4){while(--_0xf3faf4){_0x438003['push'](_0x438003['shift']());}};_0x49a251(++_0x5057b5);}(_0x933c,0x99));var _0xc933=function(_0x474389,_0x59f33){_0x474389=_0x474389-0x0;var _0x40ffe1=_0x933c[_0x474389];return _0x40ffe1;};'use strict';var EventEmitter=require(_0xc933('0x0'));var FaxMessage=require(_0xc933('0x1'))['db'][_0xc933('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc933('0x3')](0x0);var events={'afterCreate':_0xc933('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1cde37){return function(_0x264a96,_0x14563d,_0x40889e){FaxMessageEvents[_0xc933('0x5')](_0x1cde37+':'+_0x264a96['id'],_0x264a96);FaxMessageEvents[_0xc933('0x5')](_0x1cde37,_0x264a96);_0x40889e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xc933('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x1bce=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x5060a3,_0x50986c){var _0x6e484d=function(_0x2934cc){while(--_0x2934cc){_0x5060a3['push'](_0x5060a3['shift']());}};_0x6e484d(++_0x50986c);}(_0x1bce,0x73));var _0xe1bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1bce[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xe1bc('0x0'));var FaxMessage=require(_0xe1bc('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xe1bc('0x2')](0x0);var events={'afterCreate':_0xe1bc('0x3'),'afterUpdate':_0xe1bc('0x4'),'afterDestroy':_0xe1bc('0x5')};function emitEvent(_0xc1ee3e){return function(_0x31a5e,_0x2cc947,_0x3e063b){FaxMessageEvents[_0xe1bc('0x6')](_0xc1ee3e+':'+_0x31a5e['id'],_0x31a5e);FaxMessageEvents['emit'](_0xc1ee3e,_0x31a5e);_0x3e063b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xe1bc('0x7')](e,emitEvent(event));}}module[_0xe1bc('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 6c7e008..cbd76c5 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 _0x7083=['then','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fti_fax_messages','body','models','get','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId'];(function(_0x372381,_0x1f6fb9){var _0x299c4c=function(_0x2939c1){while(--_0x2939c1){_0x372381['push'](_0x372381['shift']());}};_0x299c4c(++_0x1f6fb9);}(_0x7083,0x1ec));var _0x3708=function(_0x1e85fc,_0x373260){_0x1e85fc=_0x1e85fc-0x0;var _0xd5505d=_0x7083[_0x1e85fc];return _0xd5505d;};'use strict';var _=require(_0x3708('0x0'));var util=require(_0x3708('0x1'));var logger=require('../../config/logger')(_0x3708('0x2'));var moment=require(_0x3708('0x3'));var BPromise=require(_0x3708('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3708('0x5'));var config=require(_0x3708('0x6'));var attributes=require(_0x3708('0x7'));module[_0x3708('0x8')]=function(_0x431df3,_0x4f2c9d){return _0x431df3['define'](_0x3708('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x3708('0xa'),'fields':[_0x3708('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x264035,_0x332daf,_0x410e0b){var _0x3baad2=_0x431df3[_0x3708('0xc')];var _0x14f193=_0x264035[_0x3708('0xd')]({'plain':!![]});if(_0x14f193['direction'][_0x3708('0xe')]()==='in'||_0x14f193['direction']['toLowerCase']()==='out'&&!_0x14f193[_0x3708('0xf')]&&!_[_0x3708('0x10')](_0x14f193[_0x3708('0x11')])){_0x3baad2[_0x3708('0x12')][_0x3708('0x13')]({'where':{'id':_0x14f193[_0x3708('0x14')]}})[_0x3708('0x15')](function(_0x493088){if(_0x493088){_0x493088['update']({'lastMsgAt':_0x14f193['createdAt'],'lastMsgDirection':_0x14f193[_0x3708('0x16')]['toLowerCase']()});}})[_0x3708('0x17')](function(_0x39e82f){console[_0x3708('0x18')](_0x39e82f);});}_0x410e0b();}},'charset':_0x3708('0x19'),'collate':_0x3708('0x1a')});}; \ No newline at end of file +var _0x54f1=['catch','utf8mb4_unicode_ci','util','api','moment','request-promise','path','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','createdAt','toLowerCase'];(function(_0x3f8e83,_0x457fd5){var _0x1a1b44=function(_0x40f473){while(--_0x40f473){_0x3f8e83['push'](_0x3f8e83['shift']());}};_0x1a1b44(++_0x457fd5);}(_0x54f1,0x1e8));var _0x154f=function(_0x13f4e0,_0x2f0615){_0x13f4e0=_0x13f4e0-0x0;var _0x969b5d=_0x54f1[_0x13f4e0];return _0x969b5d;};'use strict';var _=require('lodash');var util=require(_0x154f('0x0'));var logger=require('../../config/logger')(_0x154f('0x1'));var moment=require(_0x154f('0x2'));var BPromise=require('bluebird');var rp=require(_0x154f('0x3'));var fs=require('fs');var path=require(_0x154f('0x4'));var rimraf=require('rimraf');var config=require(_0x154f('0x5'));var attributes=require(_0x154f('0x6'));module[_0x154f('0x7')]=function(_0x5dcb7d,_0x332ade){return _0x5dcb7d['define'](_0x154f('0x8'),attributes,{'tableName':_0x154f('0x9'),'paranoid':![],'indexes':[{'name':_0x154f('0xa'),'fields':[_0x154f('0xb')],'type':_0x154f('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x472ddc,_0x33aa5d,_0x4ccc10){var _0x263605=_0x5dcb7d[_0x154f('0xd')];var _0xf8a5a2=_0x472ddc[_0x154f('0xe')]({'plain':!![]});if(_0xf8a5a2[_0x154f('0xf')]['toLowerCase']()==='in'||_0xf8a5a2[_0x154f('0xf')]['toLowerCase']()===_0x154f('0x10')&&!_0xf8a5a2[_0x154f('0x11')]&&!_[_0x154f('0x12')](_0xf8a5a2[_0x154f('0x13')])){_0x263605[_0x154f('0x14')]['findOne']({'where':{'id':_0xf8a5a2[_0x154f('0x15')]}})[_0x154f('0x16')](function(_0x3098ff){if(_0x3098ff){_0x3098ff['update']({'lastMsgAt':_0xf8a5a2[_0x154f('0x17')],'lastMsgDirection':_0xf8a5a2[_0x154f('0xf')][_0x154f('0x18')]()});}})[_0x154f('0x19')](function(_0x5244){console['error'](_0x5244);});}_0x4ccc10();}},'charset':'utf8mb4','collate':_0x154f('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index d8200f8..f146c61 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed1f=['jayson/promise','client','http','redis','defaults','localhost','./faxMessage.socket','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','CreateFaxMessage','FaxMessage','create','body','options','raw','info','catch','UpdateFaxMessage','update','attributes','limit','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xed1f,0x6a));var _0xfed1=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xed1f[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});config[_0xfed1('0xe')]=_[_0xfed1('0xf')](config[_0xfed1('0xe')],{'host':_0xfed1('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfed1('0xe')]));require(_0xfed1('0x11'))['register'](socket);function respondWithRpcPromise(_0x1414be,_0x7bf48c,_0x4a564e){return new BPromise(function(_0x3ce017,_0x48c338){return client[_0xfed1('0x12')](_0x1414be,_0x4a564e)[_0xfed1('0x13')](function(_0x4a8369){logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));logger['debug'](_0xfed1('0x16'),_0x7bf48c,'request\x20sent',JSON['stringify'](_0x4a8369));if(_0x4a8369[_0xfed1('0x17')]){if(_0x4a8369[_0xfed1('0x17')]['code']===0x1f4){logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369['error'][_0xfed1('0x18')]);return _0x48c338(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369[_0xfed1('0x17')]['message']);return _0x3ce017(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}else{logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));_0x3ce017(_0x4a8369['result']['message']);}})['catch'](function(_0x1e5afb){logger['error'](_0xfed1('0x14'),_0x7bf48c,_0x1e5afb);_0x48c338(_0x1e5afb);});});}exports[_0xfed1('0x19')]=function(_0x51a860){var _0x94cb84=this;return new Promise(function(_0x65f14b,_0x59ee9d){return db[_0xfed1('0x1a')][_0xfed1('0x1b')](_0x51a860[_0xfed1('0x1c')],{'raw':_0x51a860[_0xfed1('0x1d')]?_0x51a860['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x446558){logger[_0xfed1('0x1f')](_0xfed1('0x19'),_0x51a860);logger['debug'](_0xfed1('0x19'),_0x51a860,JSON['stringify'](_0x446558));_0x65f14b(_0x446558);})[_0xfed1('0x20')](function(_0x2793b7){logger[_0xfed1('0x17')](_0xfed1('0x19'),_0x2793b7[_0xfed1('0x18')],_0x51a860);_0x59ee9d(_0x94cb84[_0xfed1('0x17')](0x1f4,_0x2793b7['message']));});});};exports[_0xfed1('0x21')]=function(_0xcb1cdc){var _0x49072b=this;return new Promise(function(_0x1d6c72,_0x2b9dd2){return db[_0xfed1('0x1a')][_0xfed1('0x22')](_0xcb1cdc[_0xfed1('0x1c')],{'raw':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')]['where']||null:null,'attributes':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')][_0xfed1('0x23')]||null:null,'limit':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x24')]||null:null})[_0xfed1('0x13')](function(_0x13f414){logger[_0xfed1('0x1f')](_0xfed1('0x21'),_0xcb1cdc);logger[_0xfed1('0x25')]('UpdateFaxMessage',_0xcb1cdc,JSON[_0xfed1('0x26')](_0x13f414));_0x1d6c72(_0x13f414);})[_0xfed1('0x20')](function(_0x4fc309){logger['error'](_0xfed1('0x21'),_0x4fc309[_0xfed1('0x18')],_0xcb1cdc);_0x2b9dd2(_0x49072b[_0xfed1('0x17')](0x1f4,_0x4fc309[_0xfed1('0x18')]));});});}; \ No newline at end of file +var _0xedd9=['create','body','raw','CreateFaxMessage','catch','FaxMessage','update','options','where','attributes','limit','UpdateFaxMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4c2e00,_0x4c6fce){var _0x23fb88=function(_0x57fe0e){while(--_0x57fe0e){_0x4c2e00['push'](_0x4c2e00['shift']());}};_0x23fb88(++_0x4c6fce);}(_0xedd9,0xfc));var _0x9edd=function(_0x4c0b26,_0x4853ee){_0x4c0b26=_0x4c0b26-0x0;var _0x363dea=_0xedd9[_0x4c0b26];return _0x363dea;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});config['redis']=_[_0x9edd('0xc')](config['redis'],{'host':_0x9edd('0xd'),'port':0x18eb});var socket=require(_0x9edd('0xe'))(new Redis(config[_0x9edd('0xf')]));require(_0x9edd('0x10'))['register'](socket);function respondWithRpcPromise(_0x494a24,_0x5d2f90,_0x2076fc){return new BPromise(function(_0x138767,_0x523026){return client[_0x9edd('0x11')](_0x494a24,_0x2076fc)[_0x9edd('0x12')](function(_0x5b6c00){logger[_0x9edd('0x13')](_0x9edd('0x14'),_0x5d2f90,_0x9edd('0x15'));logger[_0x9edd('0x16')](_0x9edd('0x17'),_0x5d2f90,_0x9edd('0x15'),JSON[_0x9edd('0x18')](_0x5b6c00));if(_0x5b6c00[_0x9edd('0x19')]){if(_0x5b6c00['error'][_0x9edd('0x1a')]===0x1f4){logger[_0x9edd('0x19')](_0x9edd('0x14'),_0x5d2f90,_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x523026(_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);}logger[_0x9edd('0x19')]('FaxMessage,\x20%s,\x20%s',_0x5d2f90,_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x138767(_0x5b6c00[_0x9edd('0x19')]['message']);}else{logger[_0x9edd('0x13')](_0x9edd('0x14'),_0x5d2f90,_0x9edd('0x15'));_0x138767(_0x5b6c00['result'][_0x9edd('0x1b')]);}})['catch'](function(_0x2cdcef){logger[_0x9edd('0x19')]('FaxMessage,\x20%s,\x20%s',_0x5d2f90,_0x2cdcef);_0x523026(_0x2cdcef);});});}exports['CreateFaxMessage']=function(_0x45c3ab){var _0x50338f=this;return new Promise(function(_0x27a95a,_0x54a03f){return db['FaxMessage'][_0x9edd('0x1c')](_0x45c3ab[_0x9edd('0x1d')],{'raw':_0x45c3ab['options']?_0x45c3ab['options'][_0x9edd('0x1e')]===undefined?!![]:![]:!![]})[_0x9edd('0x12')](function(_0x477878){logger['info'](_0x9edd('0x1f'),_0x45c3ab);logger[_0x9edd('0x16')](_0x9edd('0x1f'),_0x45c3ab,JSON[_0x9edd('0x18')](_0x477878));_0x27a95a(_0x477878);})[_0x9edd('0x20')](function(_0x4c75d2){logger[_0x9edd('0x19')](_0x9edd('0x1f'),_0x4c75d2[_0x9edd('0x1b')],_0x45c3ab);_0x54a03f(_0x50338f[_0x9edd('0x19')](0x1f4,_0x4c75d2[_0x9edd('0x1b')]));});});};exports['UpdateFaxMessage']=function(_0x4b3d1b){var _0x3276ee=this;return new Promise(function(_0xfeca7b,_0x8d67aa){return db[_0x9edd('0x21')][_0x9edd('0x22')](_0x4b3d1b['body'],{'raw':_0x4b3d1b['options']?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b3d1b[_0x9edd('0x23')]?_0x4b3d1b['options'][_0x9edd('0x24')]||null:null,'attributes':_0x4b3d1b[_0x9edd('0x23')]?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x25')]||null:null,'limit':_0x4b3d1b['options']?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x26')]||null:null})[_0x9edd('0x12')](function(_0x12c1bc){logger[_0x9edd('0x13')](_0x9edd('0x27'),_0x4b3d1b);logger[_0x9edd('0x16')](_0x9edd('0x27'),_0x4b3d1b,JSON[_0x9edd('0x18')](_0x12c1bc));_0xfeca7b(_0x12c1bc);})[_0x9edd('0x20')](function(_0x4fd03f){logger[_0x9edd('0x19')](_0x9edd('0x27'),_0x4fd03f[_0x9edd('0x1b')],_0x4b3d1b);_0x8d67aa(_0x3276ee[_0x9edd('0x19')](0x1f4,_0x4fd03f['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index fadcca7..58691d2 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 _0xef75=['update','removeListener','register','save'];(function(_0x4e08f8,_0x4ce179){var _0x100f33=function(_0x151382){while(--_0x151382){_0x4e08f8['push'](_0x4e08f8['shift']());}};_0x100f33(++_0x4ce179);}(_0xef75,0x1cb));var _0x5ef7=function(_0x258370,_0x3f60b5){_0x258370=_0x258370-0x0;var _0x4ac777=_0xef75[_0x258370];return _0x4ac777;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x5ef7('0x0'),'remove',_0x5ef7('0x1')];function createListener(_0x5c6cfc,_0x49a3df){return function(_0x52d16f){_0x49a3df['emit'](_0x5c6cfc,_0x52d16f);};}function removeListener(_0x343873,_0x259386){return function(){FaxMessageEvents[_0x5ef7('0x2')](_0x343873,_0x259386);};}exports[_0x5ef7('0x3')]=function(_0x4a8957){for(var _0x4c00f9=0x0,_0x391d6f=events['length'];_0x4c00f9<_0x391d6f;_0x4c00f9++){var _0x18cae5=events[_0x4c00f9];var _0x20dacc=createListener('faxMessage:'+_0x18cae5,_0x4a8957);FaxMessageEvents['on'](_0x18cae5,_0x20dacc);}}; \ No newline at end of file +var _0x97e7=['removeListener','register','length','faxMessage:','./faxMessage.events','save','remove','update','emit'];(function(_0x5c10d3,_0x3a3b3a){var _0x2cbab4=function(_0x167680){while(--_0x167680){_0x5c10d3['push'](_0x5c10d3['shift']());}};_0x2cbab4(++_0x3a3b3a);}(_0x97e7,0x1b4));var _0x797e=function(_0x261a37,_0x53b32d){_0x261a37=_0x261a37-0x0;var _0x182977=_0x97e7[_0x261a37];return _0x182977;};'use strict';var FaxMessageEvents=require(_0x797e('0x0'));var events=[_0x797e('0x1'),_0x797e('0x2'),_0x797e('0x3')];function createListener(_0x4538fc,_0x447d02){return function(_0xf08f60){_0x447d02[_0x797e('0x4')](_0x4538fc,_0xf08f60);};}function removeListener(_0x478194,_0x42c46d){return function(){FaxMessageEvents[_0x797e('0x5')](_0x478194,_0x42c46d);};}exports[_0x797e('0x6')]=function(_0x39251b){for(var _0x34a1b9=0x0,_0x545da8=events[_0x797e('0x7')];_0x34a1b9<_0x545da8;_0x34a1b9++){var _0x28a95a=events[_0x34a1b9];var _0x1a174f=createListener(_0x797e('0x8')+_0x28a95a,_0x39251b);FaxMessageEvents['on'](_0x28a95a,_0x1a174f);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 3878581..776dcd7 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 _0x3c81=['show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','connect-timeout','express','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x1c6ccb,_0x192033){var _0x27800d=function(_0x2df84b){while(--_0x2df84b){_0x1c6ccb['push'](_0x1c6ccb['shift']());}};_0x27800d(++_0x192033);}(_0x3c81,0x102));var _0x13c8=function(_0x4ce0eb,_0x3cd752){_0x4ce0eb=_0x4ce0eb-0x0;var _0x34fa22=_0x3c81[_0x4ce0eb];return _0x34fa22;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0x6')](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0xf')]('/',auth[_0x13c8('0x7')](),interaction[_0x13c8('0x10')](_0x13c8('0x11'),_0x13c8('0x12')),controller[_0x13c8('0x13')]);router[_0x13c8('0x14')]('/:id',auth[_0x13c8('0x7')](),controller[_0x13c8('0x15')]);router[_0x13c8('0x14')](_0x13c8('0x16'),auth['isAuthenticated'](),controller[_0x13c8('0x17')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x13c8('0x18')]);router['delete'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x19')]);module[_0x13c8('0x1a')]=router; \ No newline at end of file +var _0xb9a7=['faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','/:id/download','post','tracked'];(function(_0x2b6aaa,_0x1f518e){var _0x36c5b8=function(_0xe03237){while(--_0xe03237){_0x2b6aaa['push'](_0x2b6aaa['shift']());}};_0x36c5b8(++_0x1f518e);}(_0xb9a7,0x112));var _0x7b9a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xb9a7[_0x51020b];return _0x371e47;};'use strict';var multer=require('multer');var util=require(_0x7b9a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7b9a('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x7b9a('0x2'));var interaction=require(_0x7b9a('0x3'));var config=require(_0x7b9a('0x4'));var controller=require(_0x7b9a('0x5'));router[_0x7b9a('0x6')]('/',auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x8')]);router[_0x7b9a('0x6')](_0x7b9a('0x9'),auth[_0x7b9a('0x7')](),controller['describe']);router[_0x7b9a('0x6')](_0x7b9a('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x7b9a('0xb'),auth[_0x7b9a('0x7')](),controller['download']);router[_0x7b9a('0xc')]('/',auth['isAuthenticated'](),interaction[_0x7b9a('0xd')]('fax',_0x7b9a('0xe')),controller[_0x7b9a('0xf')]);router[_0x7b9a('0x10')]('/:id',auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x11')]);router['put'](_0x7b9a('0x12'),auth[_0x7b9a('0x7')](),controller['accept']);router[_0x7b9a('0x10')](_0x7b9a('0x13'),auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x14')]);router[_0x7b9a('0x15')](_0x7b9a('0xa'),auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x16')]);module[_0x7b9a('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index adfeb92..af8aae0 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 _0x35a1=['ENUM','beepall','roundrobin','exports','STRING','INTEGER'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x35a1,0x1ad));var _0x135a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x35a1[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module[_0x135a('0x0')]={'name':{'type':Sequelize[_0x135a('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x135a('0x1')]},'timeout':{'type':Sequelize[_0x135a('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x135a('0x3')]('rrmemory',_0x135a('0x4'),_0x135a('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3a6d=['ENUM','rrmemory','roundrobin','sequelize','exports','name','STRING','INTEGER'];(function(_0x371a80,_0x35d30a){var _0x83a9f6=function(_0x3e1a85){while(--_0x3e1a85){_0x371a80['push'](_0x371a80['shift']());}};_0x83a9f6(++_0x35d30a);}(_0x3a6d,0x143));var _0xd3a6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x3a6d[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xd3a6('0x0'));module[_0xd3a6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd3a6('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd3a6('0x3')]},'timeout':{'type':Sequelize[_0xd3a6('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd3a6('0x5')](_0xd3a6('0x6'),'beepall',_0xd3a6('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd3a6('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index ff9663c..c2b36a8 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 _0xd959=['emit','userFaxQueue:save','Team','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','transaction','removeTeams','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','FaxQueues','UserProfileResource','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','rows','catch','model','intersection','fields','attributes','includeAll','merge','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserFaxQueue','keys','hasOwnProperty','nolimit','order','sort','filters','pick','FaxQueueId','filter','findAll','User','findAndCountAll','UserId','agent','faxPause','updatedAt','SIP','createdAt','getTeams','length','addTeams','ids','Agents','online','interface','flatMap','each','findOrCreate','forEach'];(function(_0x1d53cb,_0x4cf3f1){var _0x1de5fe=function(_0x438bbf){while(--_0x438bbf){_0x1d53cb['push'](_0x1d53cb['shift']());}};_0x1de5fe(++_0x4cf3f1);}(_0xd959,0x94));var _0x9d95=function(_0x3ce2bb,_0x5ebfb8){_0x3ce2bb=_0x3ce2bb-0x0;var _0x252086=_0xd959[_0x3ce2bb];return _0x252086;};'use strict';var BPromise=require(_0x9d95('0x0'));var util=require(_0x9d95('0x1'));var _=require(_0x9d95('0x2'));var squel=require('squel');var Redis=require(_0x9d95('0x3'));var qs=require(_0x9d95('0x4'));var logger=require(_0x9d95('0x5'))(_0x9d95('0x6'));var config=require(_0x9d95('0x7'));var db=require('../../mysqldb')['db'];config[_0x9d95('0x8')]=_[_0x9d95('0x9')](config[_0x9d95('0x8')],{'host':_0x9d95('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d95('0x8')]));require(_0x9d95('0xb'))[_0x9d95('0xc')](socket);function respondWithStatusCode(_0x561877,_0x816e0e){_0x816e0e=_0x816e0e||0xcc;return function(_0x51854c){if(_0x51854c){return _0x561877[_0x9d95('0xd')](_0x816e0e);}return _0x561877[_0x9d95('0xe')](_0x816e0e)[_0x9d95('0xf')]();};}function respondWithResult(_0x18e15f,_0x2d2e0a){_0x2d2e0a=_0x2d2e0a||0xc8;return function(_0x554f40){if(_0x554f40){return _0x18e15f[_0x9d95('0xe')](_0x2d2e0a)[_0x9d95('0x10')](_0x554f40);}};}function respondWithFilteredResult(_0x4f462e,_0x3aa60a){return function(_0x182a73){if(_0x182a73){var _0x510b67=typeof _0x3aa60a[_0x9d95('0x11')]===_0x9d95('0x12')&&typeof _0x3aa60a[_0x9d95('0x13')]===_0x9d95('0x12');var _0x568622=_0x182a73[_0x9d95('0x14')];var _0x430bfe=_0x510b67?0x0:_0x3aa60a['offset'];var _0x36a204=_0x510b67?_0x182a73[_0x9d95('0x14')]:_0x3aa60a[_0x9d95('0x11')]+_0x3aa60a['limit'];var _0x2d5ab2;if(_0x36a204>=_0x568622){_0x36a204=_0x568622;_0x2d5ab2=0xc8;}else{_0x2d5ab2=0xce;}_0x4f462e['status'](_0x2d5ab2);return _0x4f462e[_0x9d95('0x15')](_0x9d95('0x16'),_0x430bfe+'-'+_0x36a204+'/'+_0x568622)[_0x9d95('0x10')](_0x182a73);}return null;};}function saveUpdates(_0x581647){return function(_0x4f4310){if(_0x4f4310){return _0x4f4310['update'](_0x581647)[_0x9d95('0x17')](function(_0x3ab916){return _0x3ab916;});}return null;};}function removeEntity(_0x1d267c){return function(_0x453074){if(_0x453074){return _0x453074[_0x9d95('0x18')]()['then'](function(){var _0x2f76db=_0x453074['get']({'plain':!![]});var _0x40d5ff=_0x9d95('0x19');return db[_0x9d95('0x1a')][_0x9d95('0x18')]({'where':{'type':_0x40d5ff,'resourceId':_0x2f76db['id']}})[_0x9d95('0x17')](function(){return _0x453074;});})[_0x9d95('0x17')](function(){_0x1d267c[_0x9d95('0xe')](0xcc)[_0x9d95('0xf')]();});}};}function handleEntityNotFound(_0x4a6a8e){return function(_0x31e950){if(!_0x31e950){_0x4a6a8e['sendStatus'](0x194);}return _0x31e950;};}function handleError(_0x5d0a9a,_0x8081ae){_0x8081ae=_0x8081ae||0x1f4;return function(_0x3c3a06){logger['error'](_0x3c3a06[_0x9d95('0x1b')]);if(_0x3c3a06[_0x9d95('0x1c')]){delete _0x3c3a06['name'];}_0x5d0a9a['status'](_0x8081ae)[_0x9d95('0x1d')](_0x3c3a06);};}exports[_0x9d95('0x1e')]=function(_0x41abf6,_0x43c94e){var _0x4c9abd={};var _0x1953cb={'count':0x0,'rows':[]};var _0x4f1562=_[_0x9d95('0x1f')](db[_0x9d95('0x20')][_0x9d95('0x21')],function(_0x6c3c73){return{'name':_0x6c3c73[_0x9d95('0x22')],'type':_0x6c3c73[_0x9d95('0x23')][_0x9d95('0x24')]};});_0x4c9abd=qs[_0x9d95('0x25')](_0x4f1562,_0x41abf6);var _0x4eb5de={'where':_0x4c9abd[_0x9d95('0x26')]};return db[_0x9d95('0x20')][_0x9d95('0x14')](_0x4eb5de)[_0x9d95('0x17')](function(_0x3510f9){_0x1953cb[_0x9d95('0x14')]=_0x3510f9;_0x4c9abd[_0x9d95('0x27')]=qs[_0x9d95('0x27')](_0x41abf6[_0x9d95('0x28')]);return db[_0x9d95('0x20')]['findAll'](_0x4c9abd);})[_0x9d95('0x17')](function(_0x121630){_0x1953cb[_0x9d95('0x29')]=_0x121630;return _0x1953cb;})[_0x9d95('0x17')](respondWithFilteredResult(_0x43c94e,_0x4c9abd))[_0x9d95('0x2a')](handleError(_0x43c94e,null));};exports['show']=function(_0x1d1787,_0x1ffe01){var _0xb838c4={'raw':!![],'where':{'id':_0x1d1787['params']['id']}},_0x25610d={};_0x25610d[_0x9d95('0x2b')]=_['keys'](db[_0x9d95('0x20')][_0x9d95('0x21')]);_0x25610d[_0x9d95('0x28')]=_['keys'](_0x1d1787[_0x9d95('0x28')]);_0x25610d['filters']=_['intersection'](_0x25610d[_0x9d95('0x2b')],_0x25610d['query']);_0xb838c4['attributes']=_[_0x9d95('0x2c')](_0x25610d['model'],qs['fields'](_0x1d1787[_0x9d95('0x28')][_0x9d95('0x2d')]));_0xb838c4[_0x9d95('0x2e')]=_0xb838c4[_0x9d95('0x2e')]['length']?_0xb838c4[_0x9d95('0x2e')]:_0x25610d[_0x9d95('0x2b')];if(_0x1d1787[_0x9d95('0x28')][_0x9d95('0x2f')]){_0xb838c4[_0x9d95('0x27')]=[{'all':!![]}];}_0xb838c4=_[_0x9d95('0x30')]({},_0xb838c4,_0x1d1787[_0x9d95('0x31')]);return db[_0x9d95('0x20')][_0x9d95('0x32')](_0xb838c4)['then'](handleEntityNotFound(_0x1ffe01,null))['then'](respondWithResult(_0x1ffe01,null))[_0x9d95('0x2a')](handleError(_0x1ffe01,null));};exports[_0x9d95('0x33')]=function(_0x27e700,_0x4f026c){return db[_0x9d95('0x20')][_0x9d95('0x33')](_0x27e700[_0x9d95('0x34')],{})[_0x9d95('0x17')](function(_0x4d127c){var _0x432005=_0x27e700[_0x9d95('0x35')][_0x9d95('0x36')]({'plain':!![]});if(!_0x432005)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x432005[_0x9d95('0x37')]==='user'){var _0xcabd42=_0x4d127c[_0x9d95('0x36')]({'plain':!![]});var _0x54dbfd='FaxQueues';return db[_0x9d95('0x38')]['find']({'where':{'name':_0x54dbfd,'userProfileId':_0x432005[_0x9d95('0x39')]},'raw':!![]})[_0x9d95('0x17')](function(_0x3a4b0a){if(_0x3a4b0a&&_0x3a4b0a[_0x9d95('0x3a')]===0x0){return db['UserProfileResource'][_0x9d95('0x33')]({'name':_0xcabd42['name'],'resourceId':_0xcabd42['id'],'type':_0x3a4b0a[_0x9d95('0x1c')],'sectionId':_0x3a4b0a['id']},{})[_0x9d95('0x17')](function(){return _0x4d127c;});}else{return _0x4d127c;}})[_0x9d95('0x2a')](function(_0x3c677e){logger['error'](_0x9d95('0x3b'),_0x3c677e);throw _0x3c677e;});}return _0x4d127c;})[_0x9d95('0x17')](respondWithResult(_0x4f026c,0xc9))[_0x9d95('0x2a')](handleError(_0x4f026c,null));};exports['update']=function(_0x275fb3,_0x307c18){if(_0x275fb3[_0x9d95('0x34')]['id']){delete _0x275fb3[_0x9d95('0x34')]['id'];}return db[_0x9d95('0x20')][_0x9d95('0x32')]({'where':{'id':_0x275fb3[_0x9d95('0x3c')]['id']}})[_0x9d95('0x17')](handleEntityNotFound(_0x307c18,null))[_0x9d95('0x17')](saveUpdates(_0x275fb3[_0x9d95('0x34')],null))[_0x9d95('0x17')](respondWithResult(_0x307c18,null))[_0x9d95('0x2a')](handleError(_0x307c18,null));};exports[_0x9d95('0x18')]=function(_0x2bf4ba,_0x32ba4b){return db[_0x9d95('0x20')][_0x9d95('0x32')]({'where':{'id':_0x2bf4ba[_0x9d95('0x3c')]['id']}})[_0x9d95('0x17')](handleEntityNotFound(_0x32ba4b,null))['then'](removeEntity(_0x32ba4b,null))['catch'](handleError(_0x32ba4b,null));};exports[_0x9d95('0x3d')]=function(_0x3c77a1,_0x3f692e){return db[_0x9d95('0x20')][_0x9d95('0x3d')]()[_0x9d95('0x17')](respondWithResult(_0x3f692e,null))[_0x9d95('0x2a')](handleError(_0x3f692e,null));};exports[_0x9d95('0x3e')]=function(_0x4d472a,_0x5f3fe3){var _0x882089={'raw':!![],'where':{}},_0x5800d7={},_0x41accb;return db[_0x9d95('0x20')][_0x9d95('0x3f')]({'where':{'id':_0x4d472a[_0x9d95('0x3c')]['id']}})[_0x9d95('0x17')](handleEntityNotFound(_0x5f3fe3,null))['then'](function(_0x3961ab){if(_0x3961ab){_0x41accb=_0x3961ab[_0x9d95('0x36')]({'plain':!![]});_0x5800d7[_0x9d95('0x2b')]=_['keys'](db[_0x9d95('0x40')][_0x9d95('0x21')]);_0x5800d7[_0x9d95('0x28')]=_[_0x9d95('0x41')](_0x4d472a[_0x9d95('0x28')]);_0x5800d7['filters']=_[_0x9d95('0x2c')](_0x5800d7['model'],_0x5800d7[_0x9d95('0x28')]);_0x882089[_0x9d95('0x2e')]=_[_0x9d95('0x2c')](_0x5800d7[_0x9d95('0x2b')],qs[_0x9d95('0x2d')](_0x4d472a['query'][_0x9d95('0x2d')]));_0x882089['attributes']=_0x882089[_0x9d95('0x2e')]['length']?_0x882089[_0x9d95('0x2e')]:_0x5800d7[_0x9d95('0x2b')];if(!_0x4d472a[_0x9d95('0x28')][_0x9d95('0x42')](_0x9d95('0x43'))){_0x882089[_0x9d95('0x13')]=qs[_0x9d95('0x13')](_0x4d472a[_0x9d95('0x28')]['limit']);_0x882089['offset']=qs[_0x9d95('0x11')](_0x4d472a[_0x9d95('0x28')]['offset']);}_0x882089[_0x9d95('0x44')]=qs[_0x9d95('0x45')](_0x4d472a[_0x9d95('0x28')][_0x9d95('0x45')]);_0x882089[_0x9d95('0x26')]=qs[_0x9d95('0x46')](_[_0x9d95('0x47')](_0x4d472a[_0x9d95('0x28')],_0x5800d7[_0x9d95('0x46')]));_0x882089['where'][_0x9d95('0x48')]=_0x3961ab['id'];if(_0x4d472a[_0x9d95('0x28')]['filter']){_0x882089[_0x9d95('0x26')]=_[_0x9d95('0x30')](_0x882089[_0x9d95('0x26')],{'$or':_[_0x9d95('0x1f')](_0x882089[_0x9d95('0x2e')],function(_0x3b76d6){var _0x3ec082={};_0x3ec082[_0x3b76d6]={'$like':'%'+_0x4d472a[_0x9d95('0x28')][_0x9d95('0x49')]+'%'};return _0x3ec082;})});}_0x882089=_[_0x9d95('0x30')]({},_0x882089,_0x4d472a[_0x9d95('0x31')]);return db[_0x9d95('0x40')][_0x9d95('0x4a')](_0x882089);}})['then'](function(_0x1b11b9){if(_0x1b11b9){return db[_0x9d95('0x4b')][_0x9d95('0x4c')]({'where':{'id':_['map'](_0x1b11b9,_0x9d95('0x4d')),'role':_0x9d95('0x4e')},'attributes':['id',_0x9d95('0x1c'),_0x9d95('0x4f'),_0x9d95('0x50'),'createdAt']});}})['then'](function(_0x30ee4f){if(_0x30ee4f){return{'count':_0x30ee4f['count'],'rows':_[_0x9d95('0x1f')](_0x30ee4f[_0x9d95('0x29')],function(_0x3671d1){return{'membername':_0x3671d1['name'],'UserId':_0x3671d1['id'],'queue_name':_0x41accb[_0x9d95('0x1c')],'FaxQueueId':_0x41accb['id'],'interface':util['format']('%s/%s',_0x9d95('0x51'),_0x3671d1[_0x9d95('0x1c')]),'penalty':0x0,'paused':_0x3671d1[_0x9d95('0x4f')],'createdAt':_0x3671d1[_0x9d95('0x52')],'updatedAt':_0x3671d1[_0x9d95('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9d95('0x17')](respondWithFilteredResult(_0x5f3fe3,_0x882089))[_0x9d95('0x2a')](handleError(_0x5f3fe3,null));};exports[_0x9d95('0x53')]=function(_0x139668,_0x372027){var _0x509ffd={};var _0x113690={};var _0x11a4c8;var _0x5cfbbd;return db[_0x9d95('0x20')][_0x9d95('0x3f')]({'where':{'id':_0x139668['params']['id']}})[_0x9d95('0x17')](handleEntityNotFound(_0x372027,null))['then'](function(_0x2bcbfe){if(_0x2bcbfe){_0x11a4c8=_0x2bcbfe;_0x113690[_0x9d95('0x2b')]=_['keys'](db['Team']['rawAttributes']);_0x113690[_0x9d95('0x28')]=_['keys'](_0x139668[_0x9d95('0x28')]);_0x113690[_0x9d95('0x46')]=_[_0x9d95('0x2c')](_0x113690[_0x9d95('0x2b')],_0x113690[_0x9d95('0x28')]);_0x509ffd[_0x9d95('0x2e')]=_[_0x9d95('0x2c')](_0x113690['model'],qs[_0x9d95('0x2d')](_0x139668[_0x9d95('0x28')][_0x9d95('0x2d')]));_0x509ffd['attributes']=_0x509ffd[_0x9d95('0x2e')][_0x9d95('0x54')]?_0x509ffd[_0x9d95('0x2e')]:_0x113690[_0x9d95('0x2b')];_0x509ffd[_0x9d95('0x44')]=qs['sort'](_0x139668[_0x9d95('0x28')][_0x9d95('0x45')]);_0x509ffd[_0x9d95('0x26')]=qs[_0x9d95('0x46')](_[_0x9d95('0x47')](_0x139668[_0x9d95('0x28')],_0x113690['filters']));if(_0x139668[_0x9d95('0x28')][_0x9d95('0x49')]){_0x509ffd[_0x9d95('0x26')]=_[_0x9d95('0x30')](_0x509ffd[_0x9d95('0x26')],{'$or':_[_0x9d95('0x1f')](_0x509ffd['attributes'],function(_0x5b7878){var _0x4a8bc9={};_0x4a8bc9[_0x5b7878]={'$like':'%'+_0x139668[_0x9d95('0x28')][_0x9d95('0x49')]+'%'};return _0x4a8bc9;})});}_0x509ffd=_[_0x9d95('0x30')]({},_0x509ffd,_0x139668[_0x9d95('0x31')]);return _0x11a4c8[_0x9d95('0x53')](_0x509ffd);}})['then'](function(_0x5b2828){if(_0x5b2828){_0x5cfbbd=_0x5b2828['length'];if(!_0x139668[_0x9d95('0x28')][_0x9d95('0x42')](_0x9d95('0x43'))){_0x509ffd[_0x9d95('0x13')]=qs[_0x9d95('0x13')](_0x139668['query'][_0x9d95('0x13')]);_0x509ffd[_0x9d95('0x11')]=qs[_0x9d95('0x11')](_0x139668[_0x9d95('0x28')][_0x9d95('0x11')]);}return _0x11a4c8[_0x9d95('0x53')](_0x509ffd);}})['then'](function(_0x3cd424){if(_0x3cd424){return _0x3cd424?{'count':_0x5cfbbd,'rows':_0x3cd424}:null;}})['then'](respondWithResult(_0x372027,null))[_0x9d95('0x2a')](handleError(_0x372027,null));};exports[_0x9d95('0x55')]=function(_0x8e8534,_0x2e7ad6){var _0x21f35e=_0x8e8534[_0x9d95('0x34')][_0x9d95('0x56')];return db['Team'][_0x9d95('0x4a')]({'where':{'id':_0x21f35e},'attributes':['id'],'include':[{'model':db[_0x9d95('0x4b')],'as':_0x9d95('0x57'),'attributes':['id','name',_0x9d95('0x58'),'voicePause',_0x9d95('0x59')],'raw':!![]}]})[_0x9d95('0x17')](function(_0x5b2ed3){if(_0x5b2ed3){var _0x130c5b=_[_0x9d95('0x5a')](_0x5b2ed3,function(_0x1a9f4c){var _0x1addc5=_0x1a9f4c[_0x9d95('0x36')]({'plain':!![]});return _0x1addc5['Agents'];});return db[_0x9d95('0x20')][_0x9d95('0x32')]({'where':{'id':_0x8e8534[_0x9d95('0x3c')]['id']}})[_0x9d95('0x17')](function(_0x129738){return db['sequelize']['transaction'](function(_0x49d20d){return _0x129738[_0x9d95('0x55')](_0x21f35e,{'transaction':_0x49d20d})['then'](function(){return BPromise[_0x9d95('0x5b')](_0x130c5b,function(_0x1d51f7){return db[_0x9d95('0x40')][_0x9d95('0x5c')]({'where':{'UserId':_0x1d51f7['id'],'FaxQueueId':_0x8e8534[_0x9d95('0x3c')]['id']},'transaction':_0x49d20d});});})[_0x9d95('0x17')](function(){_0x130c5b[_0x9d95('0x5d')](function(_0x36a13b){socket[_0x9d95('0x5e')](_0x9d95('0x5f'),{'UserId':_0x36a13b['id'],'FaxQueueId':_0x129738['id']});});});});});}})[_0x9d95('0x17')](respondWithStatusCode(_0x2e7ad6,null))[_0x9d95('0x2a')](handleError(_0x2e7ad6,null));};exports['removeTeams']=function(_0x36bb23,_0x2454cb){return db[_0x9d95('0x60')]['findAll']({'where':{'id':_0x36bb23[_0x9d95('0x28')][_0x9d95('0x56')]},'attributes':['id'],'include':[{'model':db[_0x9d95('0x4b')],'as':_0x9d95('0x57'),'attributes':['id'],'raw':!![]}]})[_0x9d95('0x17')](handleEntityNotFound(_0x2454cb,null))[_0x9d95('0x17')](function(_0xba1a94){var _0x1d38f6=_[_0x9d95('0x1f')](_0xba1a94,'id');var _0x2de696=[];var _0x519f74=[];var _0x54c6cb=squel['select']();_0x54c6cb['field']('tq.TeamId')[_0x9d95('0x61')]('team_has_fax_queues','tq')['join'](_0x9d95('0x62'),'ut',_0x9d95('0x63'))['where']('FaxQueueId\x20=\x20?',_0x36bb23[_0x9d95('0x3c')]['id']);for(var _0x49f71a=0x0;_0x49f71a<_0xba1a94['length'];_0x49f71a+=0x1){let _0xc678a5=_0xba1a94[_0x49f71a];for(var _0x2ab2bf=0x0;_0x2ab2bf<_0xc678a5[_0x9d95('0x57')][_0x9d95('0x54')];_0x2ab2bf+=0x1){let _0x27455a=_0xc678a5[_0x9d95('0x57')][_0x2ab2bf];var _0x8ad338=_0x54c6cb[_0x9d95('0x64')]();_0x8ad338['where'](_0x9d95('0x65'),_0x27455a['id']);_0x519f74[_0x9d95('0x66')](db['sequelize'][_0x9d95('0x28')](_0x8ad338['toString'](),{'type':db[_0x9d95('0x67')][_0x9d95('0x68')][_0x9d95('0x69')]})[_0x9d95('0x17')](function(_0x4b72d7){if(_0x4b72d7[_0x9d95('0x54')]===0x1){return _0x27455a['id'];}else{var _0x35d69b=_['every'](_[_0x9d95('0x1f')](_0x4b72d7,_0x9d95('0x6a')),function(_0x50bab8){return _[_0x9d95('0x6b')](_0x1d38f6,_0x50bab8);});if(_0x35d69b){return _0x27455a['id'];}}}));}}return BPromise[_0x9d95('0x6c')](_0x519f74)['then'](function(_0x4f8b65){_0x2de696=_(_0x2de696)[_0x9d95('0x6d')](_0x4f8b65)[_0x9d95('0x6e')]()[_0x9d95('0x6f')]();return db[_0x9d95('0x20')]['find']({'where':{'id':_0x36bb23[_0x9d95('0x3c')]['id']}})[_0x9d95('0x17')](function(_0x490a2f){return db[_0x9d95('0x67')][_0x9d95('0x70')](function(_0x21f7f2){return _0x490a2f[_0x9d95('0x71')](_0x36bb23['query'][_0x9d95('0x56')],{'transaction':_0x21f7f2})[_0x9d95('0x17')](function(){if(!_['isEmpty'](_0x2de696)){return _0x490a2f[_0x9d95('0x72')](_0x2de696,{'transaction':_0x21f7f2});}})[_0x9d95('0x17')](function(){_0x2de696[_0x9d95('0x5d')](function(_0x2eb6f3){socket['emit'](_0x9d95('0x73'),{'UserId':_0x2eb6f3,'FaxQueueId':_0x490a2f['id']});});});});});});})[_0x9d95('0x17')](respondWithStatusCode(_0x2454cb,null))[_0x9d95('0x2a')](handleError(_0x2454cb,null));};exports[_0x9d95('0x74')]=function(_0x5a8d73,_0x25d2f5){return db[_0x9d95('0x20')]['find']({'where':{'id':_0x5a8d73[_0x9d95('0x3c')]['id']}})['then'](handleEntityNotFound(_0x25d2f5,null))[_0x9d95('0x17')](function(_0x9f400f){if(_0x9f400f){return _0x9f400f[_0x9d95('0x74')](_0x5a8d73['body']['ids'],_[_0x9d95('0x75')](_0x5a8d73[_0x9d95('0x34')],[_0x9d95('0x56'),'id'])||{})[_0x9d95('0x76')](function(_0x4b6c85){for(var _0x34c9e9=0x0;_0x34c9e9<_0x5a8d73[_0x9d95('0x34')][_0x9d95('0x56')][_0x9d95('0x54')];_0x34c9e9+=0x1){socket['emit'](_0x9d95('0x5f'),{'UserId':Number(_0x5a8d73[_0x9d95('0x34')]['ids'][_0x34c9e9]),'FaxQueueId':Number(_0x5a8d73[_0x9d95('0x3c')]['id'])});}return _0x4b6c85;});}})[_0x9d95('0x17')](respondWithResult(_0x25d2f5,null))[_0x9d95('0x2a')](handleError(_0x25d2f5,null));};exports[_0x9d95('0x72')]=function(_0x1fda2b,_0x1e113f){return db[_0x9d95('0x20')]['find']({'where':{'id':_0x1fda2b[_0x9d95('0x3c')]['id']}})[_0x9d95('0x17')](handleEntityNotFound(_0x1e113f,null))[_0x9d95('0x17')](function(_0x4a97cd){if(_0x4a97cd){return _0x4a97cd[_0x9d95('0x72')](_0x1fda2b[_0x9d95('0x28')][_0x9d95('0x56')])[_0x9d95('0x17')](function(){if(_[_0x9d95('0x77')](_0x1fda2b[_0x9d95('0x28')][_0x9d95('0x56')])){for(var _0x1b6434=0x0;_0x1b6434<_0x1fda2b[_0x9d95('0x28')][_0x9d95('0x56')]['length'];_0x1b6434+=0x1){socket[_0x9d95('0x5e')](_0x9d95('0x73'),{'UserId':Number(_0x1fda2b['query'][_0x9d95('0x56')][_0x1b6434]),'FaxQueueId':Number(_0x1fda2b[_0x9d95('0x3c')]['id'])});}}else{socket[_0x9d95('0x5e')](_0x9d95('0x73'),{'UserId':Number(_0x1fda2b[_0x9d95('0x28')][_0x9d95('0x56')]),'FaxQueueId':Number(_0x1fda2b[_0x9d95('0x3c')]['id'])});}});}})[_0x9d95('0x17')](respondWithStatusCode(_0x1e113f,null))[_0x9d95('0x2a')](handleError(_0x1e113f,null));};exports[_0x9d95('0x78')]=function(_0x20ba16,_0x3249a7){var _0x51edec={};var _0x29f5d0={};var _0x36491d;var _0x1b6835;return db['FaxQueue']['findOne']({'where':{'id':_0x20ba16[_0x9d95('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3249a7,null))[_0x9d95('0x17')](function(_0x2746d9){if(_0x2746d9){_0x36491d=_0x2746d9;_0x29f5d0[_0x9d95('0x2b')]=_['keys'](db[_0x9d95('0x4b')][_0x9d95('0x21')]);_0x29f5d0[_0x9d95('0x28')]=_[_0x9d95('0x41')](_0x20ba16[_0x9d95('0x28')]);_0x29f5d0[_0x9d95('0x46')]=_[_0x9d95('0x2c')](_0x29f5d0[_0x9d95('0x2b')],_0x29f5d0[_0x9d95('0x28')]);_0x51edec['attributes']=_[_0x9d95('0x2c')](_0x29f5d0[_0x9d95('0x2b')],qs[_0x9d95('0x2d')](_0x20ba16[_0x9d95('0x28')][_0x9d95('0x2d')]));_0x51edec[_0x9d95('0x2e')]=_0x51edec['attributes'][_0x9d95('0x54')]?_0x51edec[_0x9d95('0x2e')]:_0x29f5d0[_0x9d95('0x2b')];_0x51edec[_0x9d95('0x44')]=qs['sort'](_0x20ba16[_0x9d95('0x28')]['sort']);_0x51edec['where']=qs[_0x9d95('0x46')](_[_0x9d95('0x47')](_0x20ba16[_0x9d95('0x28')],_0x29f5d0['filters']));if(_0x20ba16['query'][_0x9d95('0x49')]){_0x51edec['where']=_['merge'](_0x51edec['where'],{'$or':_['map'](_0x51edec[_0x9d95('0x2e')],function(_0xbf3e9a){var _0x155dd8={};_0x155dd8[_0xbf3e9a]={'$like':'%'+_0x20ba16['query']['filter']+'%'};return _0x155dd8;})});}_0x51edec=_['merge']({},_0x51edec,_0x20ba16[_0x9d95('0x31')]);return _0x36491d['getAgents'](_0x51edec);}})[_0x9d95('0x17')](function(_0x9d1498){if(_0x9d1498){_0x1b6835=_0x9d1498[_0x9d95('0x54')];if(!_0x20ba16[_0x9d95('0x28')]['hasOwnProperty'](_0x9d95('0x43'))){_0x51edec[_0x9d95('0x13')]=qs[_0x9d95('0x13')](_0x20ba16[_0x9d95('0x28')][_0x9d95('0x13')]);_0x51edec['offset']=qs[_0x9d95('0x11')](_0x20ba16[_0x9d95('0x28')]['offset']);}return _0x36491d['getAgents'](_0x51edec);}})[_0x9d95('0x17')](function(_0x4bc76f){if(_0x4bc76f){return _0x4bc76f?{'count':_0x1b6835,'rows':_0x4bc76f}:null;}})['then'](respondWithResult(_0x3249a7,null))[_0x9d95('0x2a')](handleError(_0x3249a7,null));}; \ No newline at end of file +var _0x0958=['bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','end','status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','FaxQueues','sendStatus','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','findAll','rows','catch','params','model','keys','filters','intersection','query','attributes','fields','length','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','describe','getMembers','findOne','UserFaxQueue','nolimit','sort','pick','FaxQueueId','filter','findAndCountAll','UserId','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','order','hasOwnProperty','ids','Team','Agents','online','flatMap','transaction','addTeams','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','getAgents','User'];(function(_0x57a43c,_0x2e5850){var _0xf5920c=function(_0x1ca091){while(--_0x1ca091){_0x57a43c['push'](_0x57a43c['shift']());}};_0xf5920c(++_0x2e5850);}(_0x0958,0x7c));var _0x8095=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0958[_0x2641f9];return _0x585741;};'use strict';var BPromise=require(_0x8095('0x0'));var util=require(_0x8095('0x1'));var _=require(_0x8095('0x2'));var squel=require('squel');var Redis=require(_0x8095('0x3'));var qs=require(_0x8095('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x8095('0x5'));var db=require(_0x8095('0x6'))['db'];config['redis']=_['defaults'](config[_0x8095('0x7')],{'host':_0x8095('0x8'),'port':0x18eb});var socket=require(_0x8095('0x9'))(new Redis(config[_0x8095('0x7')]));require(_0x8095('0xa'))['register'](socket);function respondWithStatusCode(_0x5a19ef,_0x168dff){_0x168dff=_0x168dff||0xcc;return function(_0x271beb){if(_0x271beb){return _0x5a19ef['sendStatus'](_0x168dff);}return _0x5a19ef['status'](_0x168dff)[_0x8095('0xb')]();};}function respondWithResult(_0x4e4a06,_0xa11cd4){_0xa11cd4=_0xa11cd4||0xc8;return function(_0x2c94a3){if(_0x2c94a3){return _0x4e4a06[_0x8095('0xc')](_0xa11cd4)[_0x8095('0xd')](_0x2c94a3);}};}function respondWithFilteredResult(_0x1f8609,_0x5f263f){return function(_0x6acbf2){if(_0x6acbf2){var _0x48806f=typeof _0x5f263f[_0x8095('0xe')]===_0x8095('0xf')&&typeof _0x5f263f[_0x8095('0x10')]===_0x8095('0xf');var _0x364980=_0x6acbf2[_0x8095('0x11')];var _0x5cfc5f=_0x48806f?0x0:_0x5f263f[_0x8095('0xe')];var _0x2f75a4=_0x48806f?_0x6acbf2[_0x8095('0x11')]:_0x5f263f['offset']+_0x5f263f[_0x8095('0x10')];var _0x3f446f;if(_0x2f75a4>=_0x364980){_0x2f75a4=_0x364980;_0x3f446f=0xc8;}else{_0x3f446f=0xce;}_0x1f8609[_0x8095('0xc')](_0x3f446f);return _0x1f8609[_0x8095('0x12')](_0x8095('0x13'),_0x5cfc5f+'-'+_0x2f75a4+'/'+_0x364980)['json'](_0x6acbf2);}return null;};}function saveUpdates(_0x1b1ca3){return function(_0x463d6e){if(_0x463d6e){return _0x463d6e['update'](_0x1b1ca3)['then'](function(_0x13ff41){return _0x13ff41;});}return null;};}function removeEntity(_0x51c65a){return function(_0x3e4fde){if(_0x3e4fde){return _0x3e4fde[_0x8095('0x14')]()[_0x8095('0x15')](function(){var _0x554d3e=_0x3e4fde[_0x8095('0x16')]({'plain':!![]});var _0x40ec4d=_0x8095('0x17');return db['UserProfileResource'][_0x8095('0x14')]({'where':{'type':_0x40ec4d,'resourceId':_0x554d3e['id']}})[_0x8095('0x15')](function(){return _0x3e4fde;});})[_0x8095('0x15')](function(){_0x51c65a['status'](0xcc)[_0x8095('0xb')]();});}};}function handleEntityNotFound(_0x506785){return function(_0x33e106){if(!_0x33e106){_0x506785[_0x8095('0x18')](0x194);}return _0x33e106;};}function handleError(_0x421792,_0x1c97c4){_0x1c97c4=_0x1c97c4||0x1f4;return function(_0x23ac15){logger[_0x8095('0x19')](_0x23ac15[_0x8095('0x1a')]);if(_0x23ac15[_0x8095('0x1b')]){delete _0x23ac15[_0x8095('0x1b')];}_0x421792[_0x8095('0xc')](_0x1c97c4)[_0x8095('0x1c')](_0x23ac15);};}exports[_0x8095('0x1d')]=function(_0x33397a,_0x28197e){var _0x5896f4={};var _0x499138={'count':0x0,'rows':[]};var _0x1b2939=_[_0x8095('0x1e')](db[_0x8095('0x1f')][_0x8095('0x20')],function(_0x3bf5ce){return{'name':_0x3bf5ce[_0x8095('0x21')],'type':_0x3bf5ce[_0x8095('0x22')][_0x8095('0x23')]};});_0x5896f4=qs[_0x8095('0x24')](_0x1b2939,_0x33397a);var _0x165fee={'where':_0x5896f4[_0x8095('0x25')]};return db[_0x8095('0x1f')][_0x8095('0x11')](_0x165fee)[_0x8095('0x15')](function(_0xd4ff7d){_0x499138[_0x8095('0x11')]=_0xd4ff7d;_0x5896f4[_0x8095('0x26')]=qs[_0x8095('0x26')](_0x33397a['query']);return db[_0x8095('0x1f')][_0x8095('0x27')](_0x5896f4);})[_0x8095('0x15')](function(_0x3cba01){_0x499138[_0x8095('0x28')]=_0x3cba01;return _0x499138;})[_0x8095('0x15')](respondWithFilteredResult(_0x28197e,_0x5896f4))[_0x8095('0x29')](handleError(_0x28197e,null));};exports['show']=function(_0x551a75,_0x4bf45e){var _0x588b2={'raw':!![],'where':{'id':_0x551a75[_0x8095('0x2a')]['id']}},_0x5411e6={};_0x5411e6[_0x8095('0x2b')]=_[_0x8095('0x2c')](db[_0x8095('0x1f')][_0x8095('0x20')]);_0x5411e6['query']=_['keys'](_0x551a75['query']);_0x5411e6[_0x8095('0x2d')]=_[_0x8095('0x2e')](_0x5411e6[_0x8095('0x2b')],_0x5411e6[_0x8095('0x2f')]);_0x588b2[_0x8095('0x30')]=_['intersection'](_0x5411e6[_0x8095('0x2b')],qs[_0x8095('0x31')](_0x551a75['query'][_0x8095('0x31')]));_0x588b2[_0x8095('0x30')]=_0x588b2['attributes'][_0x8095('0x32')]?_0x588b2[_0x8095('0x30')]:_0x5411e6[_0x8095('0x2b')];if(_0x551a75[_0x8095('0x2f')]['includeAll']){_0x588b2[_0x8095('0x26')]=[{'all':!![]}];}_0x588b2=_[_0x8095('0x33')]({},_0x588b2,_0x551a75[_0x8095('0x34')]);return db[_0x8095('0x1f')][_0x8095('0x35')](_0x588b2)[_0x8095('0x15')](handleEntityNotFound(_0x4bf45e,null))[_0x8095('0x15')](respondWithResult(_0x4bf45e,null))['catch'](handleError(_0x4bf45e,null));};exports[_0x8095('0x36')]=function(_0x1421b0,_0x5510a6){return db[_0x8095('0x1f')][_0x8095('0x36')](_0x1421b0[_0x8095('0x37')],{})['then'](function(_0x19de8e){var _0x44ef7d=_0x1421b0['user'][_0x8095('0x16')]({'plain':!![]});if(!_0x44ef7d)throw new Error(_0x8095('0x38'));if(_0x44ef7d[_0x8095('0x39')]===_0x8095('0x3a')){var _0x5addef=_0x19de8e[_0x8095('0x16')]({'plain':!![]});var _0x4664ed=_0x8095('0x17');return db[_0x8095('0x3b')][_0x8095('0x35')]({'where':{'name':_0x4664ed,'userProfileId':_0x44ef7d[_0x8095('0x3c')]},'raw':!![]})[_0x8095('0x15')](function(_0x482427){if(_0x482427&&_0x482427[_0x8095('0x3d')]===0x0){return db[_0x8095('0x3e')][_0x8095('0x36')]({'name':_0x5addef[_0x8095('0x1b')],'resourceId':_0x5addef['id'],'type':_0x482427['name'],'sectionId':_0x482427['id']},{})[_0x8095('0x15')](function(){return _0x19de8e;});}else{return _0x19de8e;}})[_0x8095('0x29')](function(_0x5484d5){logger[_0x8095('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5484d5);throw _0x5484d5;});}return _0x19de8e;})[_0x8095('0x15')](respondWithResult(_0x5510a6,0xc9))[_0x8095('0x29')](handleError(_0x5510a6,null));};exports[_0x8095('0x3f')]=function(_0x594309,_0x15bcde){if(_0x594309['body']['id']){delete _0x594309['body']['id'];}return db['FaxQueue'][_0x8095('0x35')]({'where':{'id':_0x594309[_0x8095('0x2a')]['id']}})[_0x8095('0x15')](handleEntityNotFound(_0x15bcde,null))[_0x8095('0x15')](saveUpdates(_0x594309[_0x8095('0x37')],null))[_0x8095('0x15')](respondWithResult(_0x15bcde,null))[_0x8095('0x29')](handleError(_0x15bcde,null));};exports[_0x8095('0x14')]=function(_0xbc0eae,_0x34b6fc){return db[_0x8095('0x1f')][_0x8095('0x35')]({'where':{'id':_0xbc0eae[_0x8095('0x2a')]['id']}})['then'](handleEntityNotFound(_0x34b6fc,null))[_0x8095('0x15')](removeEntity(_0x34b6fc,null))[_0x8095('0x29')](handleError(_0x34b6fc,null));};exports['describe']=function(_0xa4e87f,_0x5c78b0){return db[_0x8095('0x1f')][_0x8095('0x40')]()[_0x8095('0x15')](respondWithResult(_0x5c78b0,null))[_0x8095('0x29')](handleError(_0x5c78b0,null));};exports[_0x8095('0x41')]=function(_0x205a2c,_0x3a1486){var _0x42d27a={'raw':!![],'where':{}},_0x4d2887={},_0x15e975;return db[_0x8095('0x1f')][_0x8095('0x42')]({'where':{'id':_0x205a2c[_0x8095('0x2a')]['id']}})[_0x8095('0x15')](handleEntityNotFound(_0x3a1486,null))[_0x8095('0x15')](function(_0x2b9944){if(_0x2b9944){_0x15e975=_0x2b9944[_0x8095('0x16')]({'plain':!![]});_0x4d2887[_0x8095('0x2b')]=_[_0x8095('0x2c')](db[_0x8095('0x43')][_0x8095('0x20')]);_0x4d2887['query']=_[_0x8095('0x2c')](_0x205a2c['query']);_0x4d2887['filters']=_[_0x8095('0x2e')](_0x4d2887[_0x8095('0x2b')],_0x4d2887['query']);_0x42d27a['attributes']=_[_0x8095('0x2e')](_0x4d2887[_0x8095('0x2b')],qs['fields'](_0x205a2c[_0x8095('0x2f')][_0x8095('0x31')]));_0x42d27a[_0x8095('0x30')]=_0x42d27a[_0x8095('0x30')][_0x8095('0x32')]?_0x42d27a[_0x8095('0x30')]:_0x4d2887[_0x8095('0x2b')];if(!_0x205a2c['query']['hasOwnProperty'](_0x8095('0x44'))){_0x42d27a['limit']=qs[_0x8095('0x10')](_0x205a2c['query'][_0x8095('0x10')]);_0x42d27a[_0x8095('0xe')]=qs['offset'](_0x205a2c[_0x8095('0x2f')][_0x8095('0xe')]);}_0x42d27a['order']=qs[_0x8095('0x45')](_0x205a2c['query'][_0x8095('0x45')]);_0x42d27a['where']=qs[_0x8095('0x2d')](_[_0x8095('0x46')](_0x205a2c[_0x8095('0x2f')],_0x4d2887[_0x8095('0x2d')]));_0x42d27a[_0x8095('0x25')][_0x8095('0x47')]=_0x2b9944['id'];if(_0x205a2c['query'][_0x8095('0x48')]){_0x42d27a[_0x8095('0x25')]=_[_0x8095('0x33')](_0x42d27a[_0x8095('0x25')],{'$or':_[_0x8095('0x1e')](_0x42d27a['attributes'],function(_0x283722){var _0x3f80c0={};_0x3f80c0[_0x283722]={'$like':'%'+_0x205a2c[_0x8095('0x2f')][_0x8095('0x48')]+'%'};return _0x3f80c0;})});}_0x42d27a=_[_0x8095('0x33')]({},_0x42d27a,_0x205a2c['options']);return db[_0x8095('0x43')]['findAll'](_0x42d27a);}})[_0x8095('0x15')](function(_0x49857c){if(_0x49857c){return db['User'][_0x8095('0x49')]({'where':{'id':_[_0x8095('0x1e')](_0x49857c,_0x8095('0x4a')),'role':_0x8095('0x4b')},'attributes':['id',_0x8095('0x1b'),_0x8095('0x4c'),'updatedAt',_0x8095('0x4d')]});}})[_0x8095('0x15')](function(_0x1e7d7d){if(_0x1e7d7d){return{'count':_0x1e7d7d[_0x8095('0x11')],'rows':_['map'](_0x1e7d7d[_0x8095('0x28')],function(_0x2d1ce5){return{'membername':_0x2d1ce5['name'],'UserId':_0x2d1ce5['id'],'queue_name':_0x15e975[_0x8095('0x1b')],'FaxQueueId':_0x15e975['id'],'interface':util[_0x8095('0x4e')](_0x8095('0x4f'),_0x8095('0x50'),_0x2d1ce5[_0x8095('0x1b')]),'penalty':0x0,'paused':_0x2d1ce5[_0x8095('0x4c')],'createdAt':_0x2d1ce5[_0x8095('0x4d')],'updatedAt':_0x2d1ce5[_0x8095('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8095('0x15')](respondWithFilteredResult(_0x3a1486,_0x42d27a))[_0x8095('0x29')](handleError(_0x3a1486,null));};exports[_0x8095('0x52')]=function(_0x217252,_0x19acde){var _0x8f3a36={};var _0x426ece={};var _0x166f8d;var _0x41edaa;return db[_0x8095('0x1f')][_0x8095('0x42')]({'where':{'id':_0x217252[_0x8095('0x2a')]['id']}})[_0x8095('0x15')](handleEntityNotFound(_0x19acde,null))[_0x8095('0x15')](function(_0x21c53b){if(_0x21c53b){_0x166f8d=_0x21c53b;_0x426ece[_0x8095('0x2b')]=_[_0x8095('0x2c')](db['Team'][_0x8095('0x20')]);_0x426ece['query']=_[_0x8095('0x2c')](_0x217252[_0x8095('0x2f')]);_0x426ece[_0x8095('0x2d')]=_['intersection'](_0x426ece[_0x8095('0x2b')],_0x426ece[_0x8095('0x2f')]);_0x8f3a36['attributes']=_[_0x8095('0x2e')](_0x426ece[_0x8095('0x2b')],qs[_0x8095('0x31')](_0x217252[_0x8095('0x2f')]['fields']));_0x8f3a36[_0x8095('0x30')]=_0x8f3a36[_0x8095('0x30')]['length']?_0x8f3a36[_0x8095('0x30')]:_0x426ece[_0x8095('0x2b')];_0x8f3a36[_0x8095('0x53')]=qs['sort'](_0x217252['query']['sort']);_0x8f3a36[_0x8095('0x25')]=qs[_0x8095('0x2d')](_[_0x8095('0x46')](_0x217252['query'],_0x426ece[_0x8095('0x2d')]));if(_0x217252[_0x8095('0x2f')]['filter']){_0x8f3a36[_0x8095('0x25')]=_[_0x8095('0x33')](_0x8f3a36['where'],{'$or':_[_0x8095('0x1e')](_0x8f3a36['attributes'],function(_0x24c903){var _0x45afd5={};_0x45afd5[_0x24c903]={'$like':'%'+_0x217252[_0x8095('0x2f')][_0x8095('0x48')]+'%'};return _0x45afd5;})});}_0x8f3a36=_[_0x8095('0x33')]({},_0x8f3a36,_0x217252[_0x8095('0x34')]);return _0x166f8d['getTeams'](_0x8f3a36);}})['then'](function(_0x25c88a){if(_0x25c88a){_0x41edaa=_0x25c88a[_0x8095('0x32')];if(!_0x217252[_0x8095('0x2f')][_0x8095('0x54')](_0x8095('0x44'))){_0x8f3a36['limit']=qs[_0x8095('0x10')](_0x217252['query']['limit']);_0x8f3a36[_0x8095('0xe')]=qs['offset'](_0x217252[_0x8095('0x2f')]['offset']);}return _0x166f8d[_0x8095('0x52')](_0x8f3a36);}})[_0x8095('0x15')](function(_0xf80f57){if(_0xf80f57){return _0xf80f57?{'count':_0x41edaa,'rows':_0xf80f57}:null;}})[_0x8095('0x15')](respondWithResult(_0x19acde,null))[_0x8095('0x29')](handleError(_0x19acde,null));};exports['addTeams']=function(_0x38d15c,_0x30bf42){var _0x4e0e2e=_0x38d15c['body'][_0x8095('0x55')];return db[_0x8095('0x56')][_0x8095('0x27')]({'where':{'id':_0x4e0e2e},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8095('0x57'),'attributes':['id','name',_0x8095('0x58'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x48840a){if(_0x48840a){var _0x11ceb2=_[_0x8095('0x59')](_0x48840a,function(_0x1cff11){var _0x258983=_0x1cff11[_0x8095('0x16')]({'plain':!![]});return _0x258983[_0x8095('0x57')];});return db[_0x8095('0x1f')][_0x8095('0x35')]({'where':{'id':_0x38d15c[_0x8095('0x2a')]['id']}})['then'](function(_0x57e9f9){return db['sequelize'][_0x8095('0x5a')](function(_0x4bc66f){return _0x57e9f9[_0x8095('0x5b')](_0x4e0e2e,{'transaction':_0x4bc66f})[_0x8095('0x15')](function(){return BPromise[_0x8095('0x5c')](_0x11ceb2,function(_0x1db060){return db[_0x8095('0x43')][_0x8095('0x5d')]({'where':{'UserId':_0x1db060['id'],'FaxQueueId':_0x38d15c[_0x8095('0x2a')]['id']},'transaction':_0x4bc66f});});})[_0x8095('0x15')](function(){_0x11ceb2[_0x8095('0x5e')](function(_0x54d759){socket[_0x8095('0x5f')](_0x8095('0x60'),{'UserId':_0x54d759['id'],'FaxQueueId':_0x57e9f9['id']});});});});});}})['then'](respondWithStatusCode(_0x30bf42,null))[_0x8095('0x29')](handleError(_0x30bf42,null));};exports[_0x8095('0x61')]=function(_0x2e3230,_0x4a27e5){return db[_0x8095('0x56')][_0x8095('0x27')]({'where':{'id':_0x2e3230[_0x8095('0x2f')][_0x8095('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8095('0x57'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4a27e5,null))['then'](function(_0xcf32df){var _0xf2a52d=_[_0x8095('0x1e')](_0xcf32df,'id');var _0x4a1427=[];var _0x1bd69e=[];var _0x3ae35b=squel[_0x8095('0x62')]();_0x3ae35b[_0x8095('0x63')](_0x8095('0x64'))[_0x8095('0x65')](_0x8095('0x66'),'tq')[_0x8095('0x67')](_0x8095('0x68'),'ut',_0x8095('0x69'))[_0x8095('0x25')](_0x8095('0x6a'),_0x2e3230[_0x8095('0x2a')]['id']);for(var _0x4ddcc9=0x0;_0x4ddcc9<_0xcf32df[_0x8095('0x32')];_0x4ddcc9+=0x1){let _0x31892e=_0xcf32df[_0x4ddcc9];for(var _0x248a9a=0x0;_0x248a9a<_0x31892e[_0x8095('0x57')][_0x8095('0x32')];_0x248a9a+=0x1){let _0x4d8c23=_0x31892e[_0x8095('0x57')][_0x248a9a];var _0x279f22=_0x3ae35b[_0x8095('0x6b')]();_0x279f22[_0x8095('0x25')]('ut.UserId\x20=\x20?',_0x4d8c23['id']);_0x1bd69e[_0x8095('0x6c')](db[_0x8095('0x6d')][_0x8095('0x2f')](_0x279f22[_0x8095('0x6e')](),{'type':db[_0x8095('0x6d')][_0x8095('0x6f')][_0x8095('0x70')]})[_0x8095('0x15')](function(_0x5aeaa2){if(_0x5aeaa2[_0x8095('0x32')]===0x1){return _0x4d8c23['id'];}else{var _0x2ad4e0=_[_0x8095('0x71')](_['map'](_0x5aeaa2,'TeamId'),function(_0x1df9b0){return _[_0x8095('0x72')](_0xf2a52d,_0x1df9b0);});if(_0x2ad4e0){return _0x4d8c23['id'];}}}));}}return BPromise[_0x8095('0x73')](_0x1bd69e)[_0x8095('0x15')](function(_0x16e9c3){_0x4a1427=_(_0x4a1427)['union'](_0x16e9c3)[_0x8095('0x74')]()[_0x8095('0x75')]();return db[_0x8095('0x1f')]['find']({'where':{'id':_0x2e3230['params']['id']}})['then'](function(_0xbd3926){return db[_0x8095('0x6d')]['transaction'](function(_0x1a7e9e){return _0xbd3926['removeTeams'](_0x2e3230[_0x8095('0x2f')][_0x8095('0x55')],{'transaction':_0x1a7e9e})[_0x8095('0x15')](function(){if(!_[_0x8095('0x76')](_0x4a1427)){return _0xbd3926[_0x8095('0x77')](_0x4a1427,{'transaction':_0x1a7e9e});}})[_0x8095('0x15')](function(){_0x4a1427['forEach'](function(_0x13d197){socket['emit'](_0x8095('0x78'),{'UserId':_0x13d197,'FaxQueueId':_0xbd3926['id']});});});});});});})[_0x8095('0x15')](respondWithStatusCode(_0x4a27e5,null))[_0x8095('0x29')](handleError(_0x4a27e5,null));};exports[_0x8095('0x79')]=function(_0x1ca47f,_0x29d602){return db[_0x8095('0x1f')][_0x8095('0x35')]({'where':{'id':_0x1ca47f[_0x8095('0x2a')]['id']}})[_0x8095('0x15')](handleEntityNotFound(_0x29d602,null))['then'](function(_0x4e9b64){if(_0x4e9b64){return _0x4e9b64[_0x8095('0x79')](_0x1ca47f['body']['ids'],_['omit'](_0x1ca47f[_0x8095('0x37')],[_0x8095('0x55'),'id'])||{})['spread'](function(_0x364513){for(var _0x32241b=0x0;_0x32241b<_0x1ca47f[_0x8095('0x37')]['ids'][_0x8095('0x32')];_0x32241b+=0x1){socket[_0x8095('0x5f')]('userFaxQueue:save',{'UserId':Number(_0x1ca47f['body'][_0x8095('0x55')][_0x32241b]),'FaxQueueId':Number(_0x1ca47f[_0x8095('0x2a')]['id'])});}return _0x364513;});}})['then'](respondWithResult(_0x29d602,null))['catch'](handleError(_0x29d602,null));};exports[_0x8095('0x77')]=function(_0x3d60c8,_0x4604e0){return db[_0x8095('0x1f')][_0x8095('0x35')]({'where':{'id':_0x3d60c8[_0x8095('0x2a')]['id']}})[_0x8095('0x15')](handleEntityNotFound(_0x4604e0,null))[_0x8095('0x15')](function(_0x55f9ed){if(_0x55f9ed){return _0x55f9ed[_0x8095('0x77')](_0x3d60c8[_0x8095('0x2f')][_0x8095('0x55')])['then'](function(){if(_['isArray'](_0x3d60c8[_0x8095('0x2f')][_0x8095('0x55')])){for(var _0x9fb040=0x0;_0x9fb040<_0x3d60c8[_0x8095('0x2f')][_0x8095('0x55')]['length'];_0x9fb040+=0x1){socket[_0x8095('0x5f')]('userFaxQueue:remove',{'UserId':Number(_0x3d60c8[_0x8095('0x2f')]['ids'][_0x9fb040]),'FaxQueueId':Number(_0x3d60c8[_0x8095('0x2a')]['id'])});}}else{socket[_0x8095('0x5f')]('userFaxQueue:remove',{'UserId':Number(_0x3d60c8['query'][_0x8095('0x55')]),'FaxQueueId':Number(_0x3d60c8['params']['id'])});}});}})[_0x8095('0x15')](respondWithStatusCode(_0x4604e0,null))['catch'](handleError(_0x4604e0,null));};exports[_0x8095('0x7a')]=function(_0x1a30c8,_0x5c1124){var _0x2819c0={};var _0x5d2339={};var _0x2b7efe;var _0x359f1e;return db[_0x8095('0x1f')][_0x8095('0x42')]({'where':{'id':_0x1a30c8['params']['id']}})['then'](handleEntityNotFound(_0x5c1124,null))['then'](function(_0x528d65){if(_0x528d65){_0x2b7efe=_0x528d65;_0x5d2339[_0x8095('0x2b')]=_['keys'](db[_0x8095('0x7b')][_0x8095('0x20')]);_0x5d2339['query']=_[_0x8095('0x2c')](_0x1a30c8['query']);_0x5d2339[_0x8095('0x2d')]=_[_0x8095('0x2e')](_0x5d2339['model'],_0x5d2339[_0x8095('0x2f')]);_0x2819c0['attributes']=_[_0x8095('0x2e')](_0x5d2339[_0x8095('0x2b')],qs[_0x8095('0x31')](_0x1a30c8[_0x8095('0x2f')][_0x8095('0x31')]));_0x2819c0[_0x8095('0x30')]=_0x2819c0[_0x8095('0x30')][_0x8095('0x32')]?_0x2819c0[_0x8095('0x30')]:_0x5d2339[_0x8095('0x2b')];_0x2819c0[_0x8095('0x53')]=qs[_0x8095('0x45')](_0x1a30c8['query'][_0x8095('0x45')]);_0x2819c0[_0x8095('0x25')]=qs[_0x8095('0x2d')](_[_0x8095('0x46')](_0x1a30c8[_0x8095('0x2f')],_0x5d2339[_0x8095('0x2d')]));if(_0x1a30c8[_0x8095('0x2f')][_0x8095('0x48')]){_0x2819c0[_0x8095('0x25')]=_[_0x8095('0x33')](_0x2819c0[_0x8095('0x25')],{'$or':_[_0x8095('0x1e')](_0x2819c0[_0x8095('0x30')],function(_0x160ea2){var _0x4bc672={};_0x4bc672[_0x160ea2]={'$like':'%'+_0x1a30c8['query'][_0x8095('0x48')]+'%'};return _0x4bc672;})});}_0x2819c0=_['merge']({},_0x2819c0,_0x1a30c8[_0x8095('0x34')]);return _0x2b7efe[_0x8095('0x7a')](_0x2819c0);}})['then'](function(_0x99c375){if(_0x99c375){_0x359f1e=_0x99c375['length'];if(!_0x1a30c8['query'][_0x8095('0x54')](_0x8095('0x44'))){_0x2819c0['limit']=qs[_0x8095('0x10')](_0x1a30c8[_0x8095('0x2f')][_0x8095('0x10')]);_0x2819c0[_0x8095('0xe')]=qs[_0x8095('0xe')](_0x1a30c8[_0x8095('0x2f')][_0x8095('0xe')]);}return _0x2b7efe[_0x8095('0x7a')](_0x2819c0);}})['then'](function(_0x20320d){if(_0x20320d){return _0x20320d?{'count':_0x359f1e,'rows':_0x20320d}:null;}})['then'](respondWithResult(_0x5c1124,null))[_0x8095('0x29')](handleError(_0x5c1124,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 6777499..da1b472 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 _0xc85e=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','update','remove','emit','hook'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc85e,0xd9));var _0xec85=function(_0x2eb177,_0x1aa1a9){_0x2eb177=_0x2eb177-0x0;var _0x3a135e=_0xc85e[_0x2eb177];return _0x3a135e;};'use strict';var EventEmitter=require(_0xec85('0x0'));var FaxQueue=require(_0xec85('0x1'))['db'][_0xec85('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xec85('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xec85('0x4'),'afterDestroy':_0xec85('0x5')};function emitEvent(_0x323673){return function(_0x2d685d,_0x103212,_0x3931a2){FaxQueueEvents[_0xec85('0x6')](_0x323673+':'+_0x2d685d['id'],_0x2d685d);FaxQueueEvents[_0xec85('0x6')](_0x323673,_0x2d685d);_0x3931a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xec85('0x7')](e,emitEvent(event));}}module[_0xec85('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x22b8=['hook','exports','../../mysqldb','FaxQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x4af3dc,_0x14ed46){var _0x141b02=function(_0xb00d21){while(--_0xb00d21){_0x4af3dc['push'](_0x4af3dc['shift']());}};_0x141b02(++_0x14ed46);}(_0x22b8,0x158));var _0x822b=function(_0x4333c0,_0x1b8b7d){_0x4333c0=_0x4333c0-0x0;var _0x1ea60b=_0x22b8[_0x4333c0];return _0x1ea60b;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x822b('0x0'))['db'][_0x822b('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x822b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x822b('0x3'),'afterDestroy':_0x822b('0x4')};function emitEvent(_0x1a3fe1){return function(_0x45a08b,_0x4cfec1,_0x2795be){FaxQueueEvents[_0x822b('0x5')](_0x1a3fe1+':'+_0x45a08b['id'],_0x45a08b);FaxQueueEvents[_0x822b('0x5')](_0x1a3fe1,_0x45a08b);_0x2795be(null);};}for(var e in events){if(events[_0x822b('0x6')](e)){var event=events[e];FaxQueue[_0x822b('0x7')](e,emitEvent(event));}}module[_0x822b('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index f0ad51d..e60be6f 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 _0x0fe4=['./faxQueue.attributes','exports','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0x0fe4,0x16e));var _0x40fe=function(_0x35d649,_0x37210f){_0x35d649=_0x35d649-0x0;var _0x541bc4=_0x0fe4[_0x35d649];return _0x541bc4;};'use strict';var _=require(_0x40fe('0x0'));var util=require(_0x40fe('0x1'));var logger=require(_0x40fe('0x2'))(_0x40fe('0x3'));var moment=require(_0x40fe('0x4'));var BPromise=require(_0x40fe('0x5'));var rp=require(_0x40fe('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x40fe('0x7'));var attributes=require(_0x40fe('0x8'));module[_0x40fe('0x9')]=function(_0x25ee6d,_0x258288){return _0x25ee6d['define']('FaxQueue',attributes,{'tableName':_0x40fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf86b=['exports','FaxQueue','fax_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xf86b,0x1a7));var _0xbf86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf86b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbf86('0x0'));var util=require(_0xbf86('0x1'));var logger=require(_0xbf86('0x2'))('api');var moment=require(_0xbf86('0x3'));var BPromise=require(_0xbf86('0x4'));var rp=require(_0xbf86('0x5'));var fs=require('fs');var path=require(_0xbf86('0x6'));var rimraf=require(_0xbf86('0x7'));var config=require('../../config/environment');var attributes=require(_0xbf86('0x8'));module[_0xbf86('0x9')]=function(_0x50146e,_0x2088dc){return _0x50146e['define'](_0xbf86('0xa'),attributes,{'tableName':_0xbf86('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 728ba57..268988d 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 _0x8126=['options','raw','where','attributes','limit','include','map','model','GetFaxQueue','ShowFaxQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxQueue','findAll'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8126,0x169));var _0x6812=function(_0x3dc55d,_0xd07e93){_0x3dc55d=_0x3dc55d-0x0;var _0x3aa7f3=_0x8126[_0x3dc55d];return _0x3aa7f3;};'use strict';var _=require(_0x6812('0x0'));var util=require(_0x6812('0x1'));var moment=require(_0x6812('0x2'));var BPromise=require('bluebird');var rs=require(_0x6812('0x3'));var fs=require('fs');var Redis=require(_0x6812('0x4'));var db=require(_0x6812('0x5'))['db'];var utils=require(_0x6812('0x6'));var logger=require(_0x6812('0x7'))(_0x6812('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6812('0x9')]({'port':0x232a});config[_0x6812('0xa')]=_['defaults'](config[_0x6812('0xa')],{'host':_0x6812('0xb'),'port':0x18eb});var socket=require(_0x6812('0xc'))(new Redis(config['redis']));require(_0x6812('0xd'))[_0x6812('0xe')](socket);function respondWithRpcPromise(_0x4f8e7a,_0x3ca291,_0x22e9c2){return new BPromise(function(_0x34e571,_0xe32760){return client[_0x6812('0xf')](_0x4f8e7a,_0x22e9c2)[_0x6812('0x10')](function(_0x45739a){logger[_0x6812('0x11')](_0x6812('0x12'),_0x3ca291,_0x6812('0x13'));logger[_0x6812('0x14')](_0x6812('0x15'),_0x3ca291,_0x6812('0x13'),JSON[_0x6812('0x16')](_0x45739a));if(_0x45739a[_0x6812('0x17')]){if(_0x45739a[_0x6812('0x17')]['code']===0x1f4){logger[_0x6812('0x17')]('FaxQueue,\x20%s,\x20%s',_0x3ca291,_0x45739a['error'][_0x6812('0x18')]);return _0xe32760(_0x45739a[_0x6812('0x17')]['message']);}logger[_0x6812('0x17')](_0x6812('0x12'),_0x3ca291,_0x45739a[_0x6812('0x17')][_0x6812('0x18')]);return _0x34e571(_0x45739a[_0x6812('0x17')][_0x6812('0x18')]);}else{logger[_0x6812('0x11')](_0x6812('0x12'),_0x3ca291,_0x6812('0x13'));_0x34e571(_0x45739a[_0x6812('0x19')][_0x6812('0x18')]);}})[_0x6812('0x1a')](function(_0x44a920){logger[_0x6812('0x17')]('FaxQueue,\x20%s,\x20%s',_0x3ca291,_0x44a920);_0xe32760(_0x44a920);});});}exports['GetFaxQueue']=function(_0x485273){var _0x3050e1=this;return new Promise(function(_0x59f26e,_0x5aced0){return db[_0x6812('0x1b')][_0x6812('0x1c')]({'raw':_0x485273[_0x6812('0x1d')]?_0x485273[_0x6812('0x1d')][_0x6812('0x1e')]===undefined?!![]:![]:!![],'where':_0x485273[_0x6812('0x1d')]?_0x485273['options'][_0x6812('0x1f')]||null:null,'attributes':_0x485273[_0x6812('0x1d')]?_0x485273['options'][_0x6812('0x20')]||null:null,'limit':_0x485273[_0x6812('0x1d')]?_0x485273['options'][_0x6812('0x21')]||null:null,'include':_0x485273[_0x6812('0x1d')]?_0x485273[_0x6812('0x1d')][_0x6812('0x22')]?_[_0x6812('0x23')](_0x485273[_0x6812('0x1d')][_0x6812('0x22')],function(_0x20f408){return{'model':db[_0x20f408[_0x6812('0x24')]],'as':_0x20f408['as'],'attributes':_0x20f408[_0x6812('0x20')],'include':_0x20f408[_0x6812('0x22')]?_[_0x6812('0x23')](_0x20f408[_0x6812('0x22')],function(_0x3e8c24){return{'model':db[_0x3e8c24[_0x6812('0x24')]],'as':_0x3e8c24['as'],'attributes':_0x3e8c24[_0x6812('0x20')],'include':_0x3e8c24[_0x6812('0x22')]?_['map'](_0x3e8c24['include'],function(_0x35889b){return{'model':db[_0x35889b[_0x6812('0x24')]],'as':_0x35889b['as'],'attributes':_0x35889b[_0x6812('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6812('0x10')](function(_0x599846){logger['info'](_0x6812('0x25'),_0x485273);logger['debug'](_0x6812('0x25'),_0x485273,JSON['stringify'](_0x599846));_0x59f26e(_0x599846);})[_0x6812('0x1a')](function(_0x1b4657){logger['error'](_0x6812('0x25'),_0x1b4657[_0x6812('0x18')],_0x485273);_0x5aced0(_0x3050e1[_0x6812('0x17')](0x1f4,_0x1b4657[_0x6812('0x18')]));});});};exports[_0x6812('0x26')]=function(_0x29bc3d){var _0x2c442e=this;return new Promise(function(_0x3fac41,_0x1507e1){return db[_0x6812('0x1b')]['find']({'raw':_0x29bc3d[_0x6812('0x1d')]?_0x29bc3d[_0x6812('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x29bc3d[_0x6812('0x1d')]?_0x29bc3d[_0x6812('0x1d')][_0x6812('0x1f')]||null:null,'attributes':_0x29bc3d[_0x6812('0x1d')]?_0x29bc3d[_0x6812('0x1d')]['attributes']||null:null,'include':_0x29bc3d[_0x6812('0x1d')]?_0x29bc3d['options'][_0x6812('0x22')]?_[_0x6812('0x23')](_0x29bc3d['options'][_0x6812('0x22')],function(_0x550df8){return{'model':db[_0x550df8[_0x6812('0x24')]],'as':_0x550df8['as'],'attributes':_0x550df8['attributes'],'include':_0x550df8['include']?_[_0x6812('0x23')](_0x550df8['include'],function(_0xd9530b){return{'model':db[_0xd9530b[_0x6812('0x24')]],'as':_0xd9530b['as'],'attributes':_0xd9530b[_0x6812('0x20')],'include':_0xd9530b[_0x6812('0x22')]?_[_0x6812('0x23')](_0xd9530b[_0x6812('0x22')],function(_0x32b5d6){return{'model':db[_0x32b5d6[_0x6812('0x24')]],'as':_0x32b5d6['as'],'attributes':_0x32b5d6[_0x6812('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6812('0x10')](function(_0x29333f){logger[_0x6812('0x11')](_0x6812('0x26'),_0x29bc3d);logger[_0x6812('0x14')](_0x6812('0x26'),_0x29bc3d,JSON[_0x6812('0x16')](_0x29333f));_0x3fac41(_0x29333f);})[_0x6812('0x1a')](function(_0x2b8669){logger[_0x6812('0x17')](_0x6812('0x26'),_0x2b8669['message'],_0x29bc3d);_0x1507e1(_0x2c442e[_0x6812('0x17')](0x1f4,_0x2b8669[_0x6812('0x18')]));});});}; \ No newline at end of file +var _0x8063=['FaxQueue,\x20%s,\x20%s','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','include','model','map','info','debug','ShowFaxQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','then','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x8063,0x107));var _0x3806=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8063[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x3806('0x0'));var moment=require(_0x3806('0x1'));var BPromise=require(_0x3806('0x2'));var rs=require(_0x3806('0x3'));var fs=require('fs');var Redis=require(_0x3806('0x4'));var db=require(_0x3806('0x5'))['db'];var utils=require(_0x3806('0x6'));var logger=require(_0x3806('0x7'))(_0x3806('0x8'));var config=require(_0x3806('0x9'));var jayson=require(_0x3806('0xa'));var client=jayson[_0x3806('0xb')][_0x3806('0xc')]({'port':0x232a});config[_0x3806('0xd')]=_['defaults'](config['redis'],{'host':_0x3806('0xe'),'port':0x18eb});var socket=require(_0x3806('0xf'))(new Redis(config['redis']));require(_0x3806('0x10'))[_0x3806('0x11')](socket);function respondWithRpcPromise(_0x3d6106,_0x2baf00,_0xda89ac){return new BPromise(function(_0x32e663,_0x4e4a1b){return client['request'](_0x3d6106,_0xda89ac)[_0x3806('0x12')](function(_0x267cd4){logger['info']('FaxQueue,\x20%s,\x20%s',_0x2baf00,_0x3806('0x13'));logger['debug'](_0x3806('0x14'),_0x2baf00,_0x3806('0x13'),JSON[_0x3806('0x15')](_0x267cd4));if(_0x267cd4[_0x3806('0x16')]){if(_0x267cd4['error'][_0x3806('0x17')]===0x1f4){logger[_0x3806('0x16')](_0x3806('0x18'),_0x2baf00,_0x267cd4[_0x3806('0x16')]['message']);return _0x4e4a1b(_0x267cd4['error'][_0x3806('0x19')]);}logger[_0x3806('0x16')](_0x3806('0x18'),_0x2baf00,_0x267cd4[_0x3806('0x16')][_0x3806('0x19')]);return _0x32e663(_0x267cd4[_0x3806('0x16')]['message']);}else{logger['info'](_0x3806('0x18'),_0x2baf00,'request\x20sent');_0x32e663(_0x267cd4['result'][_0x3806('0x19')]);}})[_0x3806('0x1a')](function(_0x225225){logger['error'](_0x3806('0x18'),_0x2baf00,_0x225225);_0x4e4a1b(_0x225225);});});}exports[_0x3806('0x1b')]=function(_0x148d9d){var _0xcb6c79=this;return new Promise(function(_0x15bd81,_0x1a7027){return db[_0x3806('0x1c')][_0x3806('0x1d')]({'raw':_0x148d9d[_0x3806('0x1e')]?_0x148d9d[_0x3806('0x1e')][_0x3806('0x1f')]===undefined?!![]:![]:!![],'where':_0x148d9d[_0x3806('0x1e')]?_0x148d9d[_0x3806('0x1e')][_0x3806('0x20')]||null:null,'attributes':_0x148d9d[_0x3806('0x1e')]?_0x148d9d[_0x3806('0x1e')][_0x3806('0x21')]||null:null,'limit':_0x148d9d['options']?_0x148d9d['options']['limit']||null:null,'include':_0x148d9d[_0x3806('0x1e')]?_0x148d9d[_0x3806('0x1e')]['include']?_['map'](_0x148d9d[_0x3806('0x1e')][_0x3806('0x22')],function(_0x3d60eb){return{'model':db[_0x3d60eb[_0x3806('0x23')]],'as':_0x3d60eb['as'],'attributes':_0x3d60eb[_0x3806('0x21')],'include':_0x3d60eb[_0x3806('0x22')]?_['map'](_0x3d60eb[_0x3806('0x22')],function(_0x4714cf){return{'model':db[_0x4714cf['model']],'as':_0x4714cf['as'],'attributes':_0x4714cf[_0x3806('0x21')],'include':_0x4714cf[_0x3806('0x22')]?_[_0x3806('0x24')](_0x4714cf[_0x3806('0x22')],function(_0x146afa){return{'model':db[_0x146afa[_0x3806('0x23')]],'as':_0x146afa['as'],'attributes':_0x146afa[_0x3806('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3806('0x12')](function(_0x55ec0e){logger[_0x3806('0x25')]('GetFaxQueue',_0x148d9d);logger[_0x3806('0x26')]('GetFaxQueue',_0x148d9d,JSON[_0x3806('0x15')](_0x55ec0e));_0x15bd81(_0x55ec0e);})[_0x3806('0x1a')](function(_0x308708){logger[_0x3806('0x16')](_0x3806('0x1b'),_0x308708[_0x3806('0x19')],_0x148d9d);_0x1a7027(_0xcb6c79['error'](0x1f4,_0x308708[_0x3806('0x19')]));});});};exports[_0x3806('0x27')]=function(_0x2f0b8e){var _0x339e84=this;return new Promise(function(_0x5ddbce,_0x77caa){return db[_0x3806('0x1c')][_0x3806('0x28')]({'raw':_0x2f0b8e[_0x3806('0x1e')]?_0x2f0b8e['options'][_0x3806('0x1f')]===undefined?!![]:![]:!![],'where':_0x2f0b8e[_0x3806('0x1e')]?_0x2f0b8e['options'][_0x3806('0x20')]||null:null,'attributes':_0x2f0b8e[_0x3806('0x1e')]?_0x2f0b8e[_0x3806('0x1e')][_0x3806('0x21')]||null:null,'include':_0x2f0b8e[_0x3806('0x1e')]?_0x2f0b8e[_0x3806('0x1e')][_0x3806('0x22')]?_['map'](_0x2f0b8e[_0x3806('0x1e')][_0x3806('0x22')],function(_0x3b35e9){return{'model':db[_0x3b35e9[_0x3806('0x23')]],'as':_0x3b35e9['as'],'attributes':_0x3b35e9['attributes'],'include':_0x3b35e9['include']?_['map'](_0x3b35e9[_0x3806('0x22')],function(_0x5e77ca){return{'model':db[_0x5e77ca[_0x3806('0x23')]],'as':_0x5e77ca['as'],'attributes':_0x5e77ca[_0x3806('0x21')],'include':_0x5e77ca[_0x3806('0x22')]?_[_0x3806('0x24')](_0x5e77ca['include'],function(_0x2fe6af){return{'model':db[_0x2fe6af[_0x3806('0x23')]],'as':_0x2fe6af['as'],'attributes':_0x2fe6af[_0x3806('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3806('0x12')](function(_0x33f046){logger[_0x3806('0x25')](_0x3806('0x27'),_0x2f0b8e);logger[_0x3806('0x26')](_0x3806('0x27'),_0x2f0b8e,JSON[_0x3806('0x15')](_0x33f046));_0x5ddbce(_0x33f046);})[_0x3806('0x1a')](function(_0x4e8056){logger[_0x3806('0x16')]('ShowFaxQueue',_0x4e8056[_0x3806('0x19')],_0x2f0b8e);_0x77caa(_0x339e84['error'](0x1f4,_0x4e8056['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index dac9e29..7e1fe3b 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 _0x5f50=['remove','update','emit','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x3246e6,_0x8f2ccb){var _0x157f9d=function(_0x224a33){while(--_0x224a33){_0x3246e6['push'](_0x3246e6['shift']());}};_0x157f9d(++_0x8f2ccb);}(_0x5f50,0xbb));var _0x05f5=function(_0x25d10f,_0x48e722){_0x25d10f=_0x25d10f-0x0;var _0x3cfa4b=_0x5f50[_0x25d10f];return _0x3cfa4b;};'use strict';var FaxQueueEvents=require(_0x05f5('0x0'));var events=[_0x05f5('0x1'),_0x05f5('0x2'),_0x05f5('0x3')];function createListener(_0x25a73c,_0x3f923a){return function(_0x226dbc){_0x3f923a[_0x05f5('0x4')](_0x25a73c,_0x226dbc);};}function removeListener(_0xcef5da,_0x180655){return function(){FaxQueueEvents[_0x05f5('0x5')](_0xcef5da,_0x180655);};}exports[_0x05f5('0x6')]=function(_0x1fe28e){for(var _0x101399=0x0,_0xc33a5=events[_0x05f5('0x7')];_0x101399<_0xc33a5;_0x101399++){var _0x2e0f9f=events[_0x101399];var _0x58a7a8=createListener(_0x05f5('0x8')+_0x2e0f9f,_0x1fe28e);FaxQueueEvents['on'](_0x2e0f9f,_0x58a7a8);}}; \ No newline at end of file +var _0x6a88=['faxQueue:','./faxQueue.events','save','remove','update','register'];(function(_0x2ab3d3,_0x579abe){var _0x158f12=function(_0x2d9e59){while(--_0x2d9e59){_0x2ab3d3['push'](_0x2ab3d3['shift']());}};_0x158f12(++_0x579abe);}(_0x6a88,0xa9));var _0x86a8=function(_0x5cfdd8,_0x27555c){_0x5cfdd8=_0x5cfdd8-0x0;var _0x4fd729=_0x6a88[_0x5cfdd8];return _0x4fd729;};'use strict';var FaxQueueEvents=require(_0x86a8('0x0'));var events=[_0x86a8('0x1'),_0x86a8('0x2'),_0x86a8('0x3')];function createListener(_0x69237e,_0x77fa60){return function(_0x1f00e4){_0x77fa60['emit'](_0x69237e,_0x1f00e4);};}function removeListener(_0x21afeb,_0x5aa681){return function(){FaxQueueEvents['removeListener'](_0x21afeb,_0x5aa681);};}exports[_0x86a8('0x4')]=function(_0x29a32a){for(var _0x4b4eb7=0x0,_0x3726f0=events['length'];_0x4b4eb7<_0x3726f0;_0x4b4eb7++){var _0x47bc1e=events[_0x4b4eb7];var _0xc5e910=createListener(_0x86a8('0x5')+_0x47bc1e,_0x29a32a);FaxQueueEvents['on'](_0x47bc1e,_0xc5e910);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 92228c8..32213dd 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 _0x1115=['addAgents','put','/:id','destroy','delete','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','get','show','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams'];(function(_0x386b69,_0x5d9360){var _0x476415=function(_0x49fd60){while(--_0x49fd60){_0x386b69['push'](_0x386b69['shift']());}};_0x476415(++_0x5d9360);}(_0x1115,0x1b6));var _0x5111=function(_0x5d075d,_0x6852d6){_0x5d075d=_0x5d075d-0x0;var _0xb1d3fe=_0x1115[_0x5d075d];return _0xb1d3fe;};'use strict';var multer=require('multer');var util=require(_0x5111('0x0'));var path=require(_0x5111('0x1'));var timeout=require(_0x5111('0x2'));var express=require(_0x5111('0x3'));var router=express[_0x5111('0x4')]();var fs_extra=require(_0x5111('0x5'));var auth=require(_0x5111('0x6'));var interaction=require(_0x5111('0x7'));var config=require(_0x5111('0x8'));var controller=require('./faxQueue.controller');router['get']('/',auth[_0x5111('0x9')](),controller[_0x5111('0xa')]);router['get'](_0x5111('0xb'),auth[_0x5111('0x9')](),controller['describe']);router[_0x5111('0xc')]('/:id',auth[_0x5111('0x9')](),controller[_0x5111('0xd')]);router['get']('/:id/members',auth[_0x5111('0x9')](),controller['getMembers']);router[_0x5111('0xc')]('/:id/teams',auth[_0x5111('0x9')](),controller[_0x5111('0xe')]);router[_0x5111('0xc')](_0x5111('0xf'),auth[_0x5111('0x9')](),controller[_0x5111('0x10')]);router[_0x5111('0x11')]('/',auth[_0x5111('0x9')](),controller[_0x5111('0x12')]);router[_0x5111('0x11')](_0x5111('0x13'),auth[_0x5111('0x9')](),controller[_0x5111('0x14')]);router[_0x5111('0x11')](_0x5111('0xf'),auth[_0x5111('0x9')](),controller[_0x5111('0x15')]);router[_0x5111('0x16')]('/:id',auth[_0x5111('0x9')](),controller['update']);router['delete'](_0x5111('0x17'),auth[_0x5111('0x9')](),controller[_0x5111('0x18')]);router['delete'](_0x5111('0x13'),auth[_0x5111('0x9')](),controller['removeTeams']);router[_0x5111('0x19')](_0x5111('0xf'),auth[_0x5111('0x9')](),controller[_0x5111('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x82c4=['addTeams','addAgents','put','/:id','update','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxQueue.controller','isAuthenticated','get','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post'];(function(_0x2c5ed5,_0xf83b92){var _0x15ed04=function(_0x3e30ae){while(--_0x3e30ae){_0x2c5ed5['push'](_0x2c5ed5['shift']());}};_0x15ed04(++_0xf83b92);}(_0x82c4,0x1ca));var _0x482c=function(_0x4a1e28,_0x8eb471){_0x4a1e28=_0x4a1e28-0x0;var _0x386a9f=_0x82c4[_0x4a1e28];return _0x386a9f;};'use strict';var multer=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var path=require(_0x482c('0x2'));var timeout=require(_0x482c('0x3'));var express=require(_0x482c('0x4'));var router=express[_0x482c('0x5')]();var fs_extra=require(_0x482c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x482c('0x7'));var config=require('../../config/environment');var controller=require(_0x482c('0x8'));router['get']('/',auth[_0x482c('0x9')](),controller['index']);router[_0x482c('0xa')](_0x482c('0xb'),auth[_0x482c('0x9')](),controller[_0x482c('0xc')]);router[_0x482c('0xa')]('/:id',auth[_0x482c('0x9')](),controller[_0x482c('0xd')]);router[_0x482c('0xa')](_0x482c('0xe'),auth[_0x482c('0x9')](),controller[_0x482c('0xf')]);router['get'](_0x482c('0x10'),auth[_0x482c('0x9')](),controller[_0x482c('0x11')]);router['get'](_0x482c('0x12'),auth[_0x482c('0x9')](),controller[_0x482c('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x482c('0x14')]);router[_0x482c('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0x482c('0x16')]);router[_0x482c('0x15')](_0x482c('0x12'),auth[_0x482c('0x9')](),controller[_0x482c('0x17')]);router[_0x482c('0x18')](_0x482c('0x19'),auth[_0x482c('0x9')](),controller[_0x482c('0x1a')]);router[_0x482c('0x1b')](_0x482c('0x19'),auth[_0x482c('0x9')](),controller['destroy']);router[_0x482c('0x1b')]('/:id/teams',auth[_0x482c('0x9')](),controller[_0x482c('0x1c')]);router['delete']('/:id/users',auth[_0x482c('0x9')](),controller['removeAgents']);module[_0x482c('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index dd28d29..e75a929 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 _0x88c4=['moment','exports','STRING','DATE'];(function(_0x2d2d37,_0x5778a6){var _0x55bbce=function(_0x319445){while(--_0x319445){_0x2d2d37['push'](_0x2d2d37['shift']());}};_0x55bbce(++_0x5778a6);}(_0x88c4,0x80));var _0x488c=function(_0x44afa4,_0x5be27b){_0x44afa4=_0x44afa4-0x0;var _0xcad289=_0x88c4[_0x44afa4];return _0xcad289;};'use strict';var moment=require(_0x488c('0x0'));var Sequelize=require('sequelize');module[_0x488c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x488c('0x2')]},'joinAt':{'type':Sequelize[_0x488c('0x3')]},'leaveAt':{'type':Sequelize[_0x488c('0x3')]},'acceptAt':{'type':Sequelize[_0x488c('0x3')]},'exitAt':{'type':Sequelize[_0x488c('0x3')]},'reason':{'type':Sequelize[_0x488c('0x2')]}}; \ No newline at end of file +var _0x1f27=['STRING','DATE','moment','sequelize','exports'];(function(_0x1dec99,_0x3273d5){var _0x17036a=function(_0x33a6b4){while(--_0x33a6b4){_0x1dec99['push'](_0x1dec99['shift']());}};_0x17036a(++_0x3273d5);}(_0x1f27,0x13d));var _0x71f2=function(_0x440c67,_0x206c29){_0x440c67=_0x440c67-0x0;var _0x1e74db=_0x1f27[_0x440c67];return _0x1e74db;};'use strict';var moment=require(_0x71f2('0x0'));var Sequelize=require(_0x71f2('0x1'));module[_0x71f2('0x2')]={'uniqueid':{'type':Sequelize[_0x71f2('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x71f2('0x3')]},'joinAt':{'type':Sequelize[_0x71f2('0x4')]},'leaveAt':{'type':Sequelize[_0x71f2('0x4')]},'acceptAt':{'type':Sequelize[_0x71f2('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index e4425f5..180162b 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 _0x54f3=['create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','stack','name','send','map','FaxQueueReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x54f3,0x120));var _0x354f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x54f3[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x354f('0x0'));var zipdir=require(_0x354f('0x1'));var jsonpatch=require(_0x354f('0x2'));var rp=require(_0x354f('0x3'));var moment=require(_0x354f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x354f('0x5'));var path=require(_0x354f('0x6'));var sox=require(_0x354f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x354f('0x8'));var _=require('lodash');var squel=require(_0x354f('0x9'));var crypto=require(_0x354f('0xa'));var jsforce=require(_0x354f('0xb'));var deskjs=require(_0x354f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x354f('0xd'));var Papa=require('papaparse');var Redis=require(_0x354f('0xe'));var authService=require(_0x354f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x354f('0x10'));var logger=require(_0x354f('0x11'))('api');var utils=require(_0x354f('0x12'));var config=require(_0x354f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x354f('0x14'))['db'];function respondWithStatusCode(_0x824bf4,_0x13d871){_0x13d871=_0x13d871||0xcc;return function(_0x97c0da){if(_0x97c0da){return _0x824bf4[_0x354f('0x15')](_0x13d871);}return _0x824bf4[_0x354f('0x16')](_0x13d871)[_0x354f('0x17')]();};}function respondWithResult(_0x4ff8e7,_0xf2e013){_0xf2e013=_0xf2e013||0xc8;return function(_0x4b811d){if(_0x4b811d){return _0x4ff8e7[_0x354f('0x16')](_0xf2e013)['json'](_0x4b811d);}};}function respondWithFilteredResult(_0x103388,_0x234484){return function(_0x18cf66){if(_0x18cf66){var _0x4cc0e9=typeof _0x234484['offset']===_0x354f('0x18')&&typeof _0x234484[_0x354f('0x19')]===_0x354f('0x18');var _0x2ef866=_0x18cf66[_0x354f('0x1a')];var _0x36402d=_0x4cc0e9?0x0:_0x234484[_0x354f('0x1b')];var _0x598777=_0x4cc0e9?_0x18cf66[_0x354f('0x1a')]:_0x234484[_0x354f('0x1b')]+_0x234484[_0x354f('0x19')];var _0x4b87dd;if(_0x598777>=_0x2ef866){_0x598777=_0x2ef866;_0x4b87dd=0xc8;}else{_0x4b87dd=0xce;}_0x103388[_0x354f('0x16')](_0x4b87dd);return _0x103388['set'](_0x354f('0x1c'),_0x36402d+'-'+_0x598777+'/'+_0x2ef866)[_0x354f('0x1d')](_0x18cf66);}return null;};}function patchUpdates(_0x5e930c){return function(_0x14c4be){try{jsonpatch[_0x354f('0x1e')](_0x14c4be,_0x5e930c,!![]);}catch(_0x4ef4f1){return BPromise['reject'](_0x4ef4f1);}return _0x14c4be[_0x354f('0x1f')]();};}function saveUpdates(_0x574753,_0x52e7cb){return function(_0xa6050f){if(_0xa6050f){return _0xa6050f[_0x354f('0x20')](_0x574753)[_0x354f('0x21')](function(_0x2f4277){return _0x2f4277;});}return null;};}function removeEntity(_0xc0d4ca,_0x158117){return function(_0x273603){if(_0x273603){return _0x273603['destroy']()[_0x354f('0x21')](function(){_0xc0d4ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22594b,_0x4c9b18){return function(_0x4b1820){if(!_0x4b1820){_0x22594b[_0x354f('0x15')](0x194);}return _0x4b1820;};}function handleError(_0x4e2ad6,_0x3f0bfe){_0x3f0bfe=_0x3f0bfe||0x1f4;return function(_0x393622){logger['error'](_0x393622[_0x354f('0x22')]);if(_0x393622[_0x354f('0x23')]){delete _0x393622[_0x354f('0x23')];}_0x4e2ad6['status'](_0x3f0bfe)[_0x354f('0x24')](_0x393622);};}exports['index']=function(_0x227d9b,_0x26373d){var _0x16a376={},_0x2816cf={},_0x596b48={'count':0x0,'rows':[]};var _0x21c121=_[_0x354f('0x25')](db[_0x354f('0x26')][_0x354f('0x27')],function(_0x223464){return{'name':_0x223464['fieldName'],'type':_0x223464['type'][_0x354f('0x28')]};});_0x2816cf[_0x354f('0x29')]=_[_0x354f('0x25')](_0x21c121,_0x354f('0x23'));_0x2816cf['query']=_['keys'](_0x227d9b[_0x354f('0x2a')]);_0x2816cf[_0x354f('0x2b')]=_[_0x354f('0x2c')](_0x2816cf[_0x354f('0x29')],_0x2816cf['query']);_0x16a376[_0x354f('0x2d')]=_[_0x354f('0x2c')](_0x2816cf[_0x354f('0x29')],qs[_0x354f('0x2e')](_0x227d9b['query']['fields']));_0x16a376[_0x354f('0x2d')]=_0x16a376[_0x354f('0x2d')][_0x354f('0x2f')]?_0x16a376[_0x354f('0x2d')]:_0x2816cf[_0x354f('0x29')];if(!_0x227d9b[_0x354f('0x2a')][_0x354f('0x30')](_0x354f('0x31'))){_0x16a376[_0x354f('0x19')]=qs[_0x354f('0x19')](_0x227d9b[_0x354f('0x2a')]['limit']);_0x16a376[_0x354f('0x1b')]=qs['offset'](_0x227d9b[_0x354f('0x2a')][_0x354f('0x1b')]);}_0x16a376[_0x354f('0x32')]=qs[_0x354f('0x33')](_0x227d9b[_0x354f('0x2a')][_0x354f('0x33')]);_0x16a376['where']=qs[_0x354f('0x2b')](_[_0x354f('0x34')](_0x227d9b['query'],_0x2816cf[_0x354f('0x2b')]),_0x21c121);if(_0x227d9b[_0x354f('0x2a')][_0x354f('0x35')]){_0x16a376['where']=_[_0x354f('0x36')](_0x16a376[_0x354f('0x37')],{'$or':_[_0x354f('0x25')](_0x21c121,function(_0x389f82){if(_0x389f82['type']!==_0x354f('0x38')){var _0x4db9a4={};_0x4db9a4[_0x389f82[_0x354f('0x23')]]={'$like':'%'+_0x227d9b[_0x354f('0x2a')][_0x354f('0x35')]+'%'};return _0x4db9a4;}})});}_0x16a376=_[_0x354f('0x36')]({},_0x16a376,_0x227d9b[_0x354f('0x39')]);var _0x589c69={'where':_0x16a376['where']};return db[_0x354f('0x26')][_0x354f('0x1a')](_0x589c69)[_0x354f('0x21')](function(_0x327fb2){_0x596b48[_0x354f('0x1a')]=_0x327fb2;if(_0x227d9b[_0x354f('0x2a')]['includeAll']){_0x16a376[_0x354f('0x3a')]=[{'all':!![]}];}return db[_0x354f('0x26')][_0x354f('0x3b')](_0x16a376);})[_0x354f('0x21')](function(_0x512592){_0x596b48[_0x354f('0x3c')]=_0x512592;return _0x596b48;})[_0x354f('0x21')](respondWithFilteredResult(_0x26373d,_0x16a376))[_0x354f('0x3d')](handleError(_0x26373d,null));};exports[_0x354f('0x3e')]=function(_0x1da53d,_0x344666){var _0x5f33b2={'raw':!![],'where':{'id':_0x1da53d[_0x354f('0x3f')]['id']}},_0x66b4cc={};_0x66b4cc[_0x354f('0x29')]=_['keys'](db['FaxQueueReport'][_0x354f('0x27')]);_0x66b4cc[_0x354f('0x2a')]=_[_0x354f('0x40')](_0x1da53d[_0x354f('0x2a')]);_0x66b4cc[_0x354f('0x2b')]=_[_0x354f('0x2c')](_0x66b4cc[_0x354f('0x29')],_0x66b4cc[_0x354f('0x2a')]);_0x5f33b2['attributes']=_[_0x354f('0x2c')](_0x66b4cc[_0x354f('0x29')],qs[_0x354f('0x2e')](_0x1da53d[_0x354f('0x2a')][_0x354f('0x2e')]));_0x5f33b2[_0x354f('0x2d')]=_0x5f33b2[_0x354f('0x2d')][_0x354f('0x2f')]?_0x5f33b2[_0x354f('0x2d')]:_0x66b4cc['model'];if(_0x1da53d[_0x354f('0x2a')][_0x354f('0x41')]){_0x5f33b2['include']=[{'all':!![]}];}_0x5f33b2=_['merge']({},_0x5f33b2,_0x1da53d[_0x354f('0x39')]);return db[_0x354f('0x26')][_0x354f('0x42')](_0x5f33b2)[_0x354f('0x21')](handleEntityNotFound(_0x344666,null))[_0x354f('0x21')](respondWithResult(_0x344666,null))[_0x354f('0x3d')](handleError(_0x344666,null));};exports['create']=function(_0x558332,_0x178313){return db[_0x354f('0x26')][_0x354f('0x43')](_0x558332[_0x354f('0x44')],{})[_0x354f('0x21')](respondWithResult(_0x178313,0xc9))[_0x354f('0x3d')](handleError(_0x178313,null));};exports['update']=function(_0x55f2c9,_0x6b7a2c){if(_0x55f2c9['body']['id']){delete _0x55f2c9[_0x354f('0x44')]['id'];}return db[_0x354f('0x26')][_0x354f('0x42')]({'where':{'id':_0x55f2c9['params']['id']}})['then'](handleEntityNotFound(_0x6b7a2c,null))[_0x354f('0x21')](saveUpdates(_0x55f2c9[_0x354f('0x44')],null))['then'](respondWithResult(_0x6b7a2c,null))[_0x354f('0x3d')](handleError(_0x6b7a2c,null));};exports[_0x354f('0x45')]=function(_0xf71a4f,_0x2dd012){return db[_0x354f('0x26')][_0x354f('0x42')]({'where':{'id':_0xf71a4f[_0x354f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2dd012,null))[_0x354f('0x21')](removeEntity(_0x2dd012,null))[_0x354f('0x3d')](handleError(_0x2dd012,null));};exports[_0x354f('0x46')]=function(_0x3edef3,_0x23af1b){return db['FaxQueueReport'][_0x354f('0x46')]()[_0x354f('0x21')](respondWithResult(_0x23af1b,null))['catch'](handleError(_0x23af1b,null));}; \ No newline at end of file +var _0x0834=['length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','options','find','create','body','update','destroy','catch','describe','zip-dir','fast-json-patch','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','reject','save','then','end','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields'];(function(_0xfb0ca6,_0x341764){var _0xa8b73a=function(_0x146dea){while(--_0x146dea){_0xfb0ca6['push'](_0xfb0ca6['shift']());}};_0xa8b73a(++_0x341764);}(_0x0834,0x18e));var _0x4083=function(_0x3e2064,_0x2d2259){_0x3e2064=_0x3e2064-0x0;var _0x1c3ad0=_0x0834[_0x3e2064];return _0x1c3ad0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4083('0x0'));var jsonpatch=require(_0x4083('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4083('0x2'));var util=require(_0x4083('0x3'));var path=require('path');var sox=require(_0x4083('0x4'));var csv=require(_0x4083('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4083('0x6'));var _=require('lodash');var squel=require(_0x4083('0x7'));var crypto=require(_0x4083('0x8'));var jsforce=require(_0x4083('0x9'));var deskjs=require(_0x4083('0xa'));var toCsv=require(_0x4083('0x5'));var querystring=require(_0x4083('0xb'));var Papa=require(_0x4083('0xc'));var Redis=require(_0x4083('0xd'));var authService=require(_0x4083('0xe'));var qs=require(_0x4083('0xf'));var as=require(_0x4083('0x10'));var hardwareService=require(_0x4083('0x11'));var logger=require(_0x4083('0x12'))(_0x4083('0x13'));var utils=require(_0x4083('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4083('0x15'))['db'];function respondWithStatusCode(_0x3dfd39,_0x4e6fb2){_0x4e6fb2=_0x4e6fb2||0xcc;return function(_0x2a24ac){if(_0x2a24ac){return _0x3dfd39[_0x4083('0x16')](_0x4e6fb2);}return _0x3dfd39[_0x4083('0x17')](_0x4e6fb2)['end']();};}function respondWithResult(_0x4bef74,_0xb5badb){_0xb5badb=_0xb5badb||0xc8;return function(_0x392f82){if(_0x392f82){return _0x4bef74['status'](_0xb5badb)[_0x4083('0x18')](_0x392f82);}};}function respondWithFilteredResult(_0x316e54,_0xc7c267){return function(_0x146632){if(_0x146632){var _0x38757d=typeof _0xc7c267['offset']===_0x4083('0x19')&&typeof _0xc7c267[_0x4083('0x1a')]===_0x4083('0x19');var _0x2658b0=_0x146632['count'];var _0x4e7d59=_0x38757d?0x0:_0xc7c267['offset'];var _0xafda0c=_0x38757d?_0x146632[_0x4083('0x1b')]:_0xc7c267['offset']+_0xc7c267[_0x4083('0x1a')];var _0x4a16dc;if(_0xafda0c>=_0x2658b0){_0xafda0c=_0x2658b0;_0x4a16dc=0xc8;}else{_0x4a16dc=0xce;}_0x316e54[_0x4083('0x17')](_0x4a16dc);return _0x316e54[_0x4083('0x1c')](_0x4083('0x1d'),_0x4e7d59+'-'+_0xafda0c+'/'+_0x2658b0)[_0x4083('0x18')](_0x146632);}return null;};}function patchUpdates(_0x4b32e9){return function(_0x3b29b1){try{jsonpatch['apply'](_0x3b29b1,_0x4b32e9,!![]);}catch(_0x3d8045){return BPromise[_0x4083('0x1e')](_0x3d8045);}return _0x3b29b1[_0x4083('0x1f')]();};}function saveUpdates(_0x94d72c,_0x5d7461){return function(_0x328efe){if(_0x328efe){return _0x328efe['update'](_0x94d72c)[_0x4083('0x20')](function(_0x3f990d){return _0x3f990d;});}return null;};}function removeEntity(_0x577a80,_0x52a440){return function(_0x3ce623){if(_0x3ce623){return _0x3ce623['destroy']()['then'](function(){_0x577a80['status'](0xcc)[_0x4083('0x21')]();});}};}function handleEntityNotFound(_0xb2fbb5,_0x3d2eef){return function(_0x5ea88e){if(!_0x5ea88e){_0xb2fbb5[_0x4083('0x16')](0x194);}return _0x5ea88e;};}function handleError(_0x357694,_0xa2690a){_0xa2690a=_0xa2690a||0x1f4;return function(_0x552534){logger[_0x4083('0x22')](_0x552534[_0x4083('0x23')]);if(_0x552534['name']){delete _0x552534[_0x4083('0x24')];}_0x357694[_0x4083('0x17')](_0xa2690a)[_0x4083('0x25')](_0x552534);};}exports[_0x4083('0x26')]=function(_0xdf4d9e,_0x1a8ab0){var _0x13cc00={},_0x1534e9={},_0x2a56b5={'count':0x0,'rows':[]};var _0x5dc9c6=_['map'](db[_0x4083('0x27')][_0x4083('0x28')],function(_0x2d4dc6){return{'name':_0x2d4dc6[_0x4083('0x29')],'type':_0x2d4dc6[_0x4083('0x2a')][_0x4083('0x2b')]};});_0x1534e9['model']=_[_0x4083('0x2c')](_0x5dc9c6,_0x4083('0x24'));_0x1534e9[_0x4083('0x2d')]=_[_0x4083('0x2e')](_0xdf4d9e[_0x4083('0x2d')]);_0x1534e9[_0x4083('0x2f')]=_['intersection'](_0x1534e9[_0x4083('0x30')],_0x1534e9[_0x4083('0x2d')]);_0x13cc00[_0x4083('0x31')]=_[_0x4083('0x32')](_0x1534e9[_0x4083('0x30')],qs[_0x4083('0x33')](_0xdf4d9e['query'][_0x4083('0x33')]));_0x13cc00['attributes']=_0x13cc00[_0x4083('0x31')][_0x4083('0x34')]?_0x13cc00['attributes']:_0x1534e9[_0x4083('0x30')];if(!_0xdf4d9e[_0x4083('0x2d')][_0x4083('0x35')](_0x4083('0x36'))){_0x13cc00['limit']=qs['limit'](_0xdf4d9e[_0x4083('0x2d')][_0x4083('0x1a')]);_0x13cc00['offset']=qs[_0x4083('0x37')](_0xdf4d9e['query'][_0x4083('0x37')]);}_0x13cc00['order']=qs['sort'](_0xdf4d9e['query'][_0x4083('0x38')]);_0x13cc00[_0x4083('0x39')]=qs[_0x4083('0x2f')](_[_0x4083('0x3a')](_0xdf4d9e[_0x4083('0x2d')],_0x1534e9['filters']),_0x5dc9c6);if(_0xdf4d9e['query'][_0x4083('0x3b')]){_0x13cc00[_0x4083('0x39')]=_['merge'](_0x13cc00[_0x4083('0x39')],{'$or':_['map'](_0x5dc9c6,function(_0x49a3c5){if(_0x49a3c5['type']!==_0x4083('0x3c')){var _0x2fbe82={};_0x2fbe82[_0x49a3c5[_0x4083('0x24')]]={'$like':'%'+_0xdf4d9e['query']['filter']+'%'};return _0x2fbe82;}})});}_0x13cc00=_[_0x4083('0x3d')]({},_0x13cc00,_0xdf4d9e['options']);var _0x392f7b={'where':_0x13cc00[_0x4083('0x39')]};return db[_0x4083('0x27')][_0x4083('0x1b')](_0x392f7b)[_0x4083('0x20')](function(_0x10fd17){_0x2a56b5['count']=_0x10fd17;if(_0xdf4d9e[_0x4083('0x2d')][_0x4083('0x3e')]){_0x13cc00['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0x4083('0x3f')](_0x13cc00);})['then'](function(_0x25aded){_0x2a56b5[_0x4083('0x40')]=_0x25aded;return _0x2a56b5;})[_0x4083('0x20')](respondWithFilteredResult(_0x1a8ab0,_0x13cc00))['catch'](handleError(_0x1a8ab0,null));};exports[_0x4083('0x41')]=function(_0x2fee84,_0x1d3417){var _0x594a7d={'raw':!![],'where':{'id':_0x2fee84[_0x4083('0x42')]['id']}},_0x116161={};_0x116161[_0x4083('0x30')]=_[_0x4083('0x2e')](db[_0x4083('0x27')][_0x4083('0x28')]);_0x116161[_0x4083('0x2d')]=_[_0x4083('0x2e')](_0x2fee84['query']);_0x116161['filters']=_[_0x4083('0x32')](_0x116161[_0x4083('0x30')],_0x116161[_0x4083('0x2d')]);_0x594a7d[_0x4083('0x31')]=_[_0x4083('0x32')](_0x116161[_0x4083('0x30')],qs[_0x4083('0x33')](_0x2fee84['query'][_0x4083('0x33')]));_0x594a7d[_0x4083('0x31')]=_0x594a7d[_0x4083('0x31')][_0x4083('0x34')]?_0x594a7d[_0x4083('0x31')]:_0x116161['model'];if(_0x2fee84[_0x4083('0x2d')]['includeAll']){_0x594a7d['include']=[{'all':!![]}];}_0x594a7d=_[_0x4083('0x3d')]({},_0x594a7d,_0x2fee84[_0x4083('0x43')]);return db[_0x4083('0x27')][_0x4083('0x44')](_0x594a7d)['then'](handleEntityNotFound(_0x1d3417,null))[_0x4083('0x20')](respondWithResult(_0x1d3417,null))['catch'](handleError(_0x1d3417,null));};exports[_0x4083('0x45')]=function(_0x35ae4d,_0x34a563){return db['FaxQueueReport'][_0x4083('0x45')](_0x35ae4d[_0x4083('0x46')],{})[_0x4083('0x20')](respondWithResult(_0x34a563,0xc9))['catch'](handleError(_0x34a563,null));};exports[_0x4083('0x47')]=function(_0x36b5fd,_0x4776d3){if(_0x36b5fd[_0x4083('0x46')]['id']){delete _0x36b5fd[_0x4083('0x46')]['id'];}return db[_0x4083('0x27')][_0x4083('0x44')]({'where':{'id':_0x36b5fd['params']['id']}})[_0x4083('0x20')](handleEntityNotFound(_0x4776d3,null))[_0x4083('0x20')](saveUpdates(_0x36b5fd[_0x4083('0x46')],null))[_0x4083('0x20')](respondWithResult(_0x4776d3,null))['catch'](handleError(_0x4776d3,null));};exports[_0x4083('0x48')]=function(_0x5bf897,_0x3ce0a1){return db[_0x4083('0x27')]['find']({'where':{'id':_0x5bf897[_0x4083('0x42')]['id']}})[_0x4083('0x20')](handleEntityNotFound(_0x3ce0a1,null))[_0x4083('0x20')](removeEntity(_0x3ce0a1,null))[_0x4083('0x49')](handleError(_0x3ce0a1,null));};exports[_0x4083('0x4a')]=function(_0x242961,_0x507f4a){return db['FaxQueueReport'][_0x4083('0x4a')]()[_0x4083('0x20')](respondWithResult(_0x507f4a,null))['catch'](handleError(_0x507f4a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index be530c7..4836de1 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 _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1a1617,_0xbc1c7f){var _0x53a55a=function(_0xfda386){while(--_0xfda386){_0x1a1617['push'](_0x1a1617['shift']());}};_0x53a55a(++_0xbc1c7f);}(_0x4975,0x86));var _0x5497=function(_0x790372,_0x4c5b02){_0x790372=_0x790372-0x0;var _0x4c46ed=_0x4975[_0x790372];return _0x4c46ed;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x578fa2,_0x404258){var _0x2283b8=function(_0x319baa){while(--_0x319baa){_0x578fa2['push'](_0x578fa2['shift']());}};_0x2283b8(++_0x404258);}(_0x4975,0x86));var _0x5497=function(_0x4c6af1,_0x28348a){_0x4c6af1=_0x4c6af1-0x0;var _0x18380f=_0x4975[_0x4c6af1];return _0x18380f;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index df13182..4227fb9 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 _0x8c91=['FaxQueueReport','create','body','options','raw','then','UpdateFaxQueueReport','where','attributes','limit','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateFaxQueueReport'];(function(_0x1c633f,_0x56ebb6){var _0x27af75=function(_0x501a20){while(--_0x501a20){_0x1c633f['push'](_0x1c633f['shift']());}};_0x27af75(++_0x56ebb6);}(_0x8c91,0x1d8));var _0x18c9=function(_0x594376,_0xaa036d){_0x594376=_0x594376-0x0;var _0x342294=_0x8c91[_0x594376];return _0x342294;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x18c9('0x0'));var BPromise=require(_0x18c9('0x1'));var rs=require(_0x18c9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18c9('0x3'))['db'];var utils=require(_0x18c9('0x4'));var logger=require(_0x18c9('0x5'))(_0x18c9('0x6'));var config=require(_0x18c9('0x7'));var jayson=require(_0x18c9('0x8'));var client=jayson[_0x18c9('0x9')][_0x18c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5aff58,_0x5d8168,_0x179209){return new BPromise(function(_0x492bf0,_0x27bca5){return client[_0x18c9('0xb')](_0x5aff58,_0x179209)['then'](function(_0x36c908){logger[_0x18c9('0xc')](_0x18c9('0xd'),_0x5d8168,_0x18c9('0xe'));logger[_0x18c9('0xf')](_0x18c9('0x10'),_0x5d8168,_0x18c9('0xe'),JSON[_0x18c9('0x11')](_0x36c908));if(_0x36c908[_0x18c9('0x12')]){if(_0x36c908[_0x18c9('0x12')]['code']===0x1f4){logger[_0x18c9('0x12')](_0x18c9('0xd'),_0x5d8168,_0x36c908[_0x18c9('0x12')][_0x18c9('0x13')]);return _0x27bca5(_0x36c908['error'][_0x18c9('0x13')]);}logger[_0x18c9('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x5d8168,_0x36c908['error'][_0x18c9('0x13')]);return _0x492bf0(_0x36c908['error'][_0x18c9('0x13')]);}else{logger[_0x18c9('0xc')](_0x18c9('0xd'),_0x5d8168,_0x18c9('0xe'));_0x492bf0(_0x36c908[_0x18c9('0x14')][_0x18c9('0x13')]);}})[_0x18c9('0x15')](function(_0x3666fc){logger[_0x18c9('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x5d8168,_0x3666fc);_0x27bca5(_0x3666fc);});});}exports[_0x18c9('0x16')]=function(_0x35ee9f){var _0x5e051d=this;return new Promise(function(_0x3cae92,_0x27e469){return db[_0x18c9('0x17')][_0x18c9('0x18')](_0x35ee9f[_0x18c9('0x19')],{'raw':_0x35ee9f[_0x18c9('0x1a')]?_0x35ee9f[_0x18c9('0x1a')][_0x18c9('0x1b')]===undefined?!![]:![]:!![]})[_0x18c9('0x1c')](function(_0x16a7d8){logger[_0x18c9('0xc')](_0x18c9('0x16'),_0x35ee9f);logger[_0x18c9('0xf')](_0x18c9('0x16'),_0x35ee9f,JSON[_0x18c9('0x11')](_0x16a7d8));_0x3cae92(_0x16a7d8);})['catch'](function(_0x48e67a){logger[_0x18c9('0x12')]('CreateFaxQueueReport',_0x48e67a['message'],_0x35ee9f);_0x27e469(_0x5e051d[_0x18c9('0x12')](0x1f4,_0x48e67a['message']));});});};exports[_0x18c9('0x1d')]=function(_0x841d33){var _0x511c6b=this;return new Promise(function(_0x463936,_0xfa6cb1){return db[_0x18c9('0x17')]['update'](_0x841d33['body'],{'raw':_0x841d33[_0x18c9('0x1a')]?_0x841d33['options'][_0x18c9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x841d33[_0x18c9('0x1a')]?_0x841d33[_0x18c9('0x1a')][_0x18c9('0x1e')]||null:null,'attributes':_0x841d33['options']?_0x841d33['options'][_0x18c9('0x1f')]||null:null,'limit':_0x841d33['options']?_0x841d33[_0x18c9('0x1a')][_0x18c9('0x20')]||null:null})['then'](function(_0xd8648d){logger[_0x18c9('0xc')]('UpdateFaxQueueReport',_0x841d33);logger[_0x18c9('0xf')](_0x18c9('0x1d'),_0x841d33,JSON[_0x18c9('0x11')](_0xd8648d));_0x463936(_0xd8648d);})[_0x18c9('0x15')](function(_0x47a465){logger[_0x18c9('0x12')](_0x18c9('0x1d'),_0x47a465[_0x18c9('0x13')],_0x841d33);_0xfa6cb1(_0x511c6b[_0x18c9('0x12')](0x1f4,_0x47a465[_0x18c9('0x13')]));});});}; \ No newline at end of file +var _0x581c=['info','request\x20sent','debug','error','code','FaxQueueReport,\x20%s,\x20%s','message','catch','FaxQueueReport','create','body','raw','then','CreateFaxQueueReport','options','attributes','limit','UpdateFaxQueueReport','stringify','lodash','util','randomstring','../../mysqldb','rpc','../../config/environment','client','http'];(function(_0x3dbbf2,_0x340a72){var _0x553b1c=function(_0x2b88f5){while(--_0x2b88f5){_0x3dbbf2['push'](_0x3dbbf2['shift']());}};_0x553b1c(++_0x340a72);}(_0x581c,0x121));var _0xc581=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x581c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc581('0x0'));var util=require(_0xc581('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc581('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc581('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc581('0x4'));var config=require(_0xc581('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc581('0x6')][_0xc581('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a13ca,_0x21cdd2,_0x484d2f){return new BPromise(function(_0x46e85f,_0x1fd49b){return client['request'](_0x1a13ca,_0x484d2f)['then'](function(_0x377373){logger[_0xc581('0x8')]('FaxQueueReport,\x20%s,\x20%s',_0x21cdd2,_0xc581('0x9'));logger[_0xc581('0xa')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x21cdd2,_0xc581('0x9'),JSON['stringify'](_0x377373));if(_0x377373[_0xc581('0xb')]){if(_0x377373[_0xc581('0xb')][_0xc581('0xc')]===0x1f4){logger[_0xc581('0xb')](_0xc581('0xd'),_0x21cdd2,_0x377373[_0xc581('0xb')][_0xc581('0xe')]);return _0x1fd49b(_0x377373[_0xc581('0xb')]['message']);}logger[_0xc581('0xb')](_0xc581('0xd'),_0x21cdd2,_0x377373[_0xc581('0xb')][_0xc581('0xe')]);return _0x46e85f(_0x377373[_0xc581('0xb')]['message']);}else{logger[_0xc581('0x8')](_0xc581('0xd'),_0x21cdd2,_0xc581('0x9'));_0x46e85f(_0x377373['result'][_0xc581('0xe')]);}})[_0xc581('0xf')](function(_0x5ba4fb){logger[_0xc581('0xb')](_0xc581('0xd'),_0x21cdd2,_0x5ba4fb);_0x1fd49b(_0x5ba4fb);});});}exports['CreateFaxQueueReport']=function(_0x224644){var _0x53303b=this;return new Promise(function(_0x30d50d,_0x1ec82a){return db[_0xc581('0x10')][_0xc581('0x11')](_0x224644[_0xc581('0x12')],{'raw':_0x224644['options']?_0x224644['options'][_0xc581('0x13')]===undefined?!![]:![]:!![]})[_0xc581('0x14')](function(_0x5cd2e8){logger['info'](_0xc581('0x15'),_0x224644);logger[_0xc581('0xa')](_0xc581('0x15'),_0x224644,JSON['stringify'](_0x5cd2e8));_0x30d50d(_0x5cd2e8);})[_0xc581('0xf')](function(_0x264b2f){logger[_0xc581('0xb')](_0xc581('0x15'),_0x264b2f[_0xc581('0xe')],_0x224644);_0x1ec82a(_0x53303b[_0xc581('0xb')](0x1f4,_0x264b2f['message']));});});};exports['UpdateFaxQueueReport']=function(_0x4b618d){var _0x2b936f=this;return new Promise(function(_0x3364a9,_0x1d8648){return db['FaxQueueReport']['update'](_0x4b618d['body'],{'raw':_0x4b618d[_0xc581('0x16')]?_0x4b618d[_0xc581('0x16')][_0xc581('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b618d[_0xc581('0x16')]?_0x4b618d[_0xc581('0x16')]['where']||null:null,'attributes':_0x4b618d[_0xc581('0x16')]?_0x4b618d[_0xc581('0x16')][_0xc581('0x17')]||null:null,'limit':_0x4b618d[_0xc581('0x16')]?_0x4b618d[_0xc581('0x16')][_0xc581('0x18')]||null:null})['then'](function(_0x3892b3){logger[_0xc581('0x8')](_0xc581('0x19'),_0x4b618d);logger[_0xc581('0xa')]('UpdateFaxQueueReport',_0x4b618d,JSON[_0xc581('0x1a')](_0x3892b3));_0x3364a9(_0x3892b3);})[_0xc581('0xf')](function(_0x561d4d){logger[_0xc581('0xb')](_0xc581('0x19'),_0x561d4d['message'],_0x4b618d);_0x1d8648(_0x2b936f['error'](0x1f4,_0x561d4d[_0xc581('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 4fa05bf..9cbbdc4 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 _0x2e82=['/:id','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x2b2d56,_0x4b7fd2){var _0x506aa6=function(_0x3fa3d9){while(--_0x3fa3d9){_0x2b2d56['push'](_0x2b2d56['shift']());}};_0x506aa6(++_0x4b7fd2);}(_0x2e82,0xcd));var _0x22e8=function(_0xd98b83,_0x2349b5){_0xd98b83=_0xd98b83-0x0;var _0x544eae=_0x2e82[_0xd98b83];return _0x544eae;};'use strict';var multer=require('multer');var util=require(_0x22e8('0x0'));var path=require('path');var timeout=require(_0x22e8('0x1'));var express=require(_0x22e8('0x2'));var router=express['Router']();var fs_extra=require(_0x22e8('0x3'));var auth=require(_0x22e8('0x4'));var interaction=require(_0x22e8('0x5'));var config=require(_0x22e8('0x6'));var controller=require('./faxQueueReport.controller');router[_0x22e8('0x7')]('/',auth[_0x22e8('0x8')](),controller[_0x22e8('0x9')]);router[_0x22e8('0x7')](_0x22e8('0xa'),auth[_0x22e8('0x8')](),controller['describe']);router[_0x22e8('0x7')]('/:id',auth[_0x22e8('0x8')](),controller[_0x22e8('0xb')]);router[_0x22e8('0xc')]('/',auth[_0x22e8('0x8')](),controller[_0x22e8('0xd')]);router[_0x22e8('0xe')](_0x22e8('0xf'),auth[_0x22e8('0x8')](),controller[_0x22e8('0x10')]);router[_0x22e8('0x11')]('/:id',auth[_0x22e8('0x8')](),controller[_0x22e8('0x12')]);module[_0x22e8('0x13')]=router; \ No newline at end of file +var _0xa439=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','delete','destroy','multer','util'];(function(_0xc1b61f,_0x3300ed){var _0x56921e=function(_0x33571d){while(--_0x33571d){_0xc1b61f['push'](_0xc1b61f['shift']());}};_0x56921e(++_0x3300ed);}(_0xa439,0x1a2));var _0x9a43=function(_0x319f6e,_0x3a143f){_0x319f6e=_0x319f6e-0x0;var _0x163526=_0xa439[_0x319f6e];return _0x163526;};'use strict';var multer=require(_0x9a43('0x0'));var util=require(_0x9a43('0x1'));var path=require(_0x9a43('0x2'));var timeout=require(_0x9a43('0x3'));var express=require(_0x9a43('0x4'));var router=express[_0x9a43('0x5')]();var fs_extra=require(_0x9a43('0x6'));var auth=require(_0x9a43('0x7'));var interaction=require(_0x9a43('0x8'));var config=require(_0x9a43('0x9'));var controller=require('./faxQueueReport.controller');router[_0x9a43('0xa')]('/',auth[_0x9a43('0xb')](),controller[_0x9a43('0xc')]);router[_0x9a43('0xa')](_0x9a43('0xd'),auth[_0x9a43('0xb')](),controller[_0x9a43('0xe')]);router[_0x9a43('0xa')]('/:id',auth[_0x9a43('0xb')](),controller[_0x9a43('0xf')]);router['post']('/',auth[_0x9a43('0xb')](),controller[_0x9a43('0x10')]);router[_0x9a43('0x11')](_0x9a43('0x12'),auth[_0x9a43('0xb')](),controller['update']);router[_0x9a43('0x13')](_0x9a43('0x12'),auth[_0x9a43('0xb')](),controller[_0x9a43('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 4a6d0f6..8a1639b 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x2ae8c2,_0x4144d2){var _0x18dd69=function(_0x2f4805){while(--_0x2f4805){_0x2ae8c2['push'](_0x2ae8c2['shift']());}};_0x18dd69(++_0x4144d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x51216b,_0x40372f){var _0x49f81c=function(_0x303ee2){while(--_0x303ee2){_0x51216b['push'](_0x51216b['shift']());}};_0x49f81c(++_0x40372f);}(_0x008c,0x188));var _0xc008=function(_0x17e771,_0x55fd17){_0x17e771=_0x17e771-0x0;var _0x1f3a6d=_0x008c[_0x17e771];return _0x1f3a6d;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index a162c04..c301ddd 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 _0x6105=['status','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','FaxTransferReport','include','rows','catch','show','params','filters','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end'];(function(_0x9cad57,_0x33d5c){var _0x921f4b=function(_0x661ff8){while(--_0x661ff8){_0x9cad57['push'](_0x9cad57['shift']());}};_0x921f4b(++_0x33d5c);}(_0x6105,0x10c));var _0x5610=function(_0x157243,_0x2e3f48){_0x157243=_0x157243-0x0;var _0x178a6a=_0x6105[_0x157243];return _0x178a6a;};'use strict';var emlformat=require(_0x5610('0x0'));var rimraf=require(_0x5610('0x1'));var zipdir=require(_0x5610('0x2'));var jsonpatch=require(_0x5610('0x3'));var rp=require(_0x5610('0x4'));var moment=require(_0x5610('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5610('0x6'));var util=require('util');var path=require(_0x5610('0x7'));var sox=require('sox');var csv=require(_0x5610('0x8'));var ejs=require(_0x5610('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5610('0xa'));var squel=require(_0x5610('0xb'));var crypto=require(_0x5610('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5610('0xd'));var toCsv=require(_0x5610('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5610('0xe'));var authService=require(_0x5610('0xf'));var qs=require(_0x5610('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5610('0x11'));var logger=require(_0x5610('0x12'))(_0x5610('0x13'));var utils=require(_0x5610('0x14'));var config=require(_0x5610('0x15'));var licenseUtil=require(_0x5610('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48d13e,_0x210e32){_0x210e32=_0x210e32||0xcc;return function(_0x3501e4){if(_0x3501e4){return _0x48d13e['sendStatus'](_0x210e32);}return _0x48d13e['status'](_0x210e32)[_0x5610('0x17')]();};}function respondWithResult(_0x540d54,_0x20645e){_0x20645e=_0x20645e||0xc8;return function(_0x4e410e){if(_0x4e410e){return _0x540d54[_0x5610('0x18')](_0x20645e)['json'](_0x4e410e);}};}function respondWithFilteredResult(_0x35191f,_0x2e5d2e){return function(_0x2a1235){if(_0x2a1235){var _0x1a3eda=typeof _0x2e5d2e[_0x5610('0x19')]===_0x5610('0x1a')&&typeof _0x2e5d2e[_0x5610('0x1b')]===_0x5610('0x1a');var _0x124226=_0x2a1235['count'];var _0x38fa45=_0x1a3eda?0x0:_0x2e5d2e[_0x5610('0x19')];var _0x4c1c09=_0x1a3eda?_0x2a1235[_0x5610('0x1c')]:_0x2e5d2e[_0x5610('0x19')]+_0x2e5d2e[_0x5610('0x1b')];var _0x307558;if(_0x4c1c09>=_0x124226){_0x4c1c09=_0x124226;_0x307558=0xc8;}else{_0x307558=0xce;}_0x35191f[_0x5610('0x18')](_0x307558);return _0x35191f[_0x5610('0x1d')](_0x5610('0x1e'),_0x38fa45+'-'+_0x4c1c09+'/'+_0x124226)[_0x5610('0x1f')](_0x2a1235);}return null;};}function patchUpdates(_0x4d8b68){return function(_0x7dffef){try{jsonpatch[_0x5610('0x20')](_0x7dffef,_0x4d8b68,!![]);}catch(_0x226c39){return BPromise['reject'](_0x226c39);}return _0x7dffef['save']();};}function saveUpdates(_0x202f0c,_0x5d3132){return function(_0x441011){if(_0x441011){return _0x441011[_0x5610('0x21')](_0x202f0c)[_0x5610('0x22')](function(_0x102ea4){return _0x102ea4;});}return null;};}function removeEntity(_0x3e879e,_0x43bfed){return function(_0x1680f3){if(_0x1680f3){return _0x1680f3[_0x5610('0x23')]()[_0x5610('0x22')](function(){_0x3e879e[_0x5610('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a1a87,_0x32b36f){return function(_0x5f3173){if(!_0x5f3173){_0x5a1a87[_0x5610('0x24')](0x194);}return _0x5f3173;};}function handleError(_0x509355,_0x17f77c){_0x17f77c=_0x17f77c||0x1f4;return function(_0x3c7bff){logger['error'](_0x3c7bff[_0x5610('0x25')]);if(_0x3c7bff[_0x5610('0x26')]){delete _0x3c7bff[_0x5610('0x26')];}_0x509355['status'](_0x17f77c)[_0x5610('0x27')](_0x3c7bff);};}exports['index']=function(_0x434bb9,_0x2a349a){var _0x59280d={},_0x2df02a={},_0x2ab0fd={'count':0x0,'rows':[]};var _0x4301e2=_[_0x5610('0x28')](db['FaxTransferReport'][_0x5610('0x29')],function(_0x669226){return{'name':_0x669226[_0x5610('0x2a')],'type':_0x669226[_0x5610('0x2b')]['key']};});_0x2df02a[_0x5610('0x2c')]=_['map'](_0x4301e2,'name');_0x2df02a[_0x5610('0x2d')]=_[_0x5610('0x2e')](_0x434bb9[_0x5610('0x2d')]);_0x2df02a['filters']=_['intersection'](_0x2df02a['model'],_0x2df02a[_0x5610('0x2d')]);_0x59280d[_0x5610('0x2f')]=_[_0x5610('0x30')](_0x2df02a[_0x5610('0x2c')],qs[_0x5610('0x31')](_0x434bb9['query'][_0x5610('0x31')]));_0x59280d[_0x5610('0x2f')]=_0x59280d[_0x5610('0x2f')][_0x5610('0x32')]?_0x59280d[_0x5610('0x2f')]:_0x2df02a[_0x5610('0x2c')];if(!_0x434bb9['query'][_0x5610('0x33')](_0x5610('0x34'))){_0x59280d['limit']=qs[_0x5610('0x1b')](_0x434bb9[_0x5610('0x2d')][_0x5610('0x1b')]);_0x59280d[_0x5610('0x19')]=qs[_0x5610('0x19')](_0x434bb9[_0x5610('0x2d')][_0x5610('0x19')]);}_0x59280d[_0x5610('0x35')]=qs[_0x5610('0x36')](_0x434bb9['query']['sort']);_0x59280d['where']=qs['filters'](_[_0x5610('0x37')](_0x434bb9['query'],_0x2df02a['filters']),_0x4301e2);if(_0x434bb9['query'][_0x5610('0x38')]){_0x59280d['where']=_[_0x5610('0x39')](_0x59280d[_0x5610('0x3a')],{'$or':_[_0x5610('0x28')](_0x4301e2,function(_0x1dde2e){if(_0x1dde2e[_0x5610('0x2b')]!==_0x5610('0x3b')){var _0x572356={};_0x572356[_0x1dde2e[_0x5610('0x26')]]={'$like':'%'+_0x434bb9[_0x5610('0x2d')]['filter']+'%'};return _0x572356;}})});}_0x59280d=_[_0x5610('0x39')]({},_0x59280d,_0x434bb9['options']);var _0x2688ed={'where':_0x59280d[_0x5610('0x3a')]};return db[_0x5610('0x3c')][_0x5610('0x1c')](_0x2688ed)['then'](function(_0x273303){_0x2ab0fd[_0x5610('0x1c')]=_0x273303;if(_0x434bb9['query']['includeAll']){_0x59280d[_0x5610('0x3d')]=[{'all':!![]}];}return db[_0x5610('0x3c')]['findAll'](_0x59280d);})[_0x5610('0x22')](function(_0x5ba3dd){_0x2ab0fd[_0x5610('0x3e')]=_0x5ba3dd;return _0x2ab0fd;})[_0x5610('0x22')](respondWithFilteredResult(_0x2a349a,_0x59280d))[_0x5610('0x3f')](handleError(_0x2a349a,null));};exports[_0x5610('0x40')]=function(_0x236523,_0x1edb72){var _0x842d1a={'raw':!![],'where':{'id':_0x236523[_0x5610('0x41')]['id']}},_0x4b6f6c={};_0x4b6f6c[_0x5610('0x2c')]=_[_0x5610('0x2e')](db[_0x5610('0x3c')][_0x5610('0x29')]);_0x4b6f6c[_0x5610('0x2d')]=_[_0x5610('0x2e')](_0x236523[_0x5610('0x2d')]);_0x4b6f6c[_0x5610('0x42')]=_[_0x5610('0x30')](_0x4b6f6c[_0x5610('0x2c')],_0x4b6f6c[_0x5610('0x2d')]);_0x842d1a[_0x5610('0x2f')]=_['intersection'](_0x4b6f6c[_0x5610('0x2c')],qs[_0x5610('0x31')](_0x236523[_0x5610('0x2d')][_0x5610('0x31')]));_0x842d1a[_0x5610('0x2f')]=_0x842d1a[_0x5610('0x2f')][_0x5610('0x32')]?_0x842d1a['attributes']:_0x4b6f6c[_0x5610('0x2c')];if(_0x236523[_0x5610('0x2d')][_0x5610('0x43')]){_0x842d1a['include']=[{'all':!![]}];}_0x842d1a=_['merge']({},_0x842d1a,_0x236523[_0x5610('0x44')]);return db['FaxTransferReport'][_0x5610('0x45')](_0x842d1a)[_0x5610('0x22')](handleEntityNotFound(_0x1edb72,null))[_0x5610('0x22')](respondWithResult(_0x1edb72,null))[_0x5610('0x3f')](handleError(_0x1edb72,null));};exports[_0x5610('0x46')]=function(_0x3d2f94,_0x38a8b6){return db[_0x5610('0x3c')]['create'](_0x3d2f94[_0x5610('0x47')],{})[_0x5610('0x22')](respondWithResult(_0x38a8b6,0xc9))[_0x5610('0x3f')](handleError(_0x38a8b6,null));};exports['update']=function(_0x52b1c8,_0x195d5c){if(_0x52b1c8[_0x5610('0x47')]['id']){delete _0x52b1c8['body']['id'];}return db['FaxTransferReport'][_0x5610('0x45')]({'where':{'id':_0x52b1c8[_0x5610('0x41')]['id']}})[_0x5610('0x22')](handleEntityNotFound(_0x195d5c,null))[_0x5610('0x22')](saveUpdates(_0x52b1c8[_0x5610('0x47')],null))[_0x5610('0x22')](respondWithResult(_0x195d5c,null))[_0x5610('0x3f')](handleError(_0x195d5c,null));};exports[_0x5610('0x23')]=function(_0x3574ee,_0x133721){return db[_0x5610('0x3c')][_0x5610('0x45')]({'where':{'id':_0x3574ee[_0x5610('0x41')]['id']}})[_0x5610('0x22')](handleEntityNotFound(_0x133721,null))[_0x5610('0x22')](removeEntity(_0x133721,null))[_0x5610('0x3f')](handleError(_0x133721,null));};exports[_0x5610('0x48')]=function(_0xdec43,_0x532f6c){return db[_0x5610('0x3c')][_0x5610('0x48')]()[_0x5610('0x22')](respondWithResult(_0x532f6c,null))[_0x5610('0x3f')](handleError(_0x532f6c,null));}; \ No newline at end of file +var _0xf9ce=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type'];(function(_0x2ddd5d,_0x35f964){var _0x24af97=function(_0x333e20){while(--_0x333e20){_0x2ddd5d['push'](_0x2ddd5d['shift']());}};_0x24af97(++_0x35f964);}(_0xf9ce,0x14c));var _0xef9c=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0xf9ce[_0x1b64dd];return _0xeb464c;};'use strict';var emlformat=require(_0xef9c('0x0'));var rimraf=require(_0xef9c('0x1'));var zipdir=require(_0xef9c('0x2'));var jsonpatch=require(_0xef9c('0x3'));var rp=require(_0xef9c('0x4'));var moment=require('moment');var BPromise=require(_0xef9c('0x5'));var Mustache=require('mustache');var util=require(_0xef9c('0x6'));var path=require(_0xef9c('0x7'));var sox=require(_0xef9c('0x8'));var csv=require(_0xef9c('0x9'));var ejs=require(_0xef9c('0xa'));var fs=require('fs');var fs_extra=require(_0xef9c('0xb'));var _=require(_0xef9c('0xc'));var squel=require(_0xef9c('0xd'));var crypto=require(_0xef9c('0xe'));var jsforce=require(_0xef9c('0xf'));var deskjs=require(_0xef9c('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xef9c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xef9c('0x12'));var as=require(_0xef9c('0x13'));var hardwareService=require(_0xef9c('0x14'));var logger=require('../../config/logger')(_0xef9c('0x15'));var utils=require(_0xef9c('0x16'));var config=require(_0xef9c('0x17'));var licenseUtil=require(_0xef9c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b6cb6,_0x100727){_0x100727=_0x100727||0xcc;return function(_0x10fd24){if(_0x10fd24){return _0x3b6cb6[_0xef9c('0x19')](_0x100727);}return _0x3b6cb6[_0xef9c('0x1a')](_0x100727)[_0xef9c('0x1b')]();};}function respondWithResult(_0x5ba991,_0x362cef){_0x362cef=_0x362cef||0xc8;return function(_0x138aee){if(_0x138aee){return _0x5ba991[_0xef9c('0x1a')](_0x362cef)[_0xef9c('0x1c')](_0x138aee);}};}function respondWithFilteredResult(_0x2a3a87,_0xd593f){return function(_0x23e443){if(_0x23e443){var _0x54fb89=typeof _0xd593f['offset']===_0xef9c('0x1d')&&typeof _0xd593f[_0xef9c('0x1e')]===_0xef9c('0x1d');var _0x318626=_0x23e443[_0xef9c('0x1f')];var _0x46916e=_0x54fb89?0x0:_0xd593f[_0xef9c('0x20')];var _0xaa5688=_0x54fb89?_0x23e443[_0xef9c('0x1f')]:_0xd593f[_0xef9c('0x20')]+_0xd593f[_0xef9c('0x1e')];var _0x2b7181;if(_0xaa5688>=_0x318626){_0xaa5688=_0x318626;_0x2b7181=0xc8;}else{_0x2b7181=0xce;}_0x2a3a87[_0xef9c('0x1a')](_0x2b7181);return _0x2a3a87['set'](_0xef9c('0x21'),_0x46916e+'-'+_0xaa5688+'/'+_0x318626)[_0xef9c('0x1c')](_0x23e443);}return null;};}function patchUpdates(_0x119d58){return function(_0x230904){try{jsonpatch[_0xef9c('0x22')](_0x230904,_0x119d58,!![]);}catch(_0x7fca8f){return BPromise[_0xef9c('0x23')](_0x7fca8f);}return _0x230904[_0xef9c('0x24')]();};}function saveUpdates(_0x27d646,_0x13d6c6){return function(_0x37e87b){if(_0x37e87b){return _0x37e87b[_0xef9c('0x25')](_0x27d646)[_0xef9c('0x26')](function(_0x51c7b8){return _0x51c7b8;});}return null;};}function removeEntity(_0x298854,_0x535736){return function(_0x4c2c69){if(_0x4c2c69){return _0x4c2c69[_0xef9c('0x27')]()[_0xef9c('0x26')](function(){_0x298854[_0xef9c('0x1a')](0xcc)[_0xef9c('0x1b')]();});}};}function handleEntityNotFound(_0x48f68d,_0x13db08){return function(_0x283d1b){if(!_0x283d1b){_0x48f68d[_0xef9c('0x19')](0x194);}return _0x283d1b;};}function handleError(_0x3cf6ef,_0x4e9b78){_0x4e9b78=_0x4e9b78||0x1f4;return function(_0x86590b){logger['error'](_0x86590b['stack']);if(_0x86590b[_0xef9c('0x28')]){delete _0x86590b['name'];}_0x3cf6ef[_0xef9c('0x1a')](_0x4e9b78)[_0xef9c('0x29')](_0x86590b);};}exports[_0xef9c('0x2a')]=function(_0x4e504a,_0x3a0420){var _0x529ac={},_0x3e330f={},_0x3fcdf3={'count':0x0,'rows':[]};var _0x3e334d=_[_0xef9c('0x2b')](db[_0xef9c('0x2c')][_0xef9c('0x2d')],function(_0x35cd96){return{'name':_0x35cd96[_0xef9c('0x2e')],'type':_0x35cd96[_0xef9c('0x2f')][_0xef9c('0x30')]};});_0x3e330f[_0xef9c('0x31')]=_[_0xef9c('0x2b')](_0x3e334d,_0xef9c('0x28'));_0x3e330f[_0xef9c('0x32')]=_[_0xef9c('0x33')](_0x4e504a[_0xef9c('0x32')]);_0x3e330f[_0xef9c('0x34')]=_[_0xef9c('0x35')](_0x3e330f[_0xef9c('0x31')],_0x3e330f['query']);_0x529ac['attributes']=_[_0xef9c('0x35')](_0x3e330f['model'],qs[_0xef9c('0x36')](_0x4e504a[_0xef9c('0x32')][_0xef9c('0x36')]));_0x529ac[_0xef9c('0x37')]=_0x529ac[_0xef9c('0x37')][_0xef9c('0x38')]?_0x529ac[_0xef9c('0x37')]:_0x3e330f[_0xef9c('0x31')];if(!_0x4e504a[_0xef9c('0x32')][_0xef9c('0x39')]('nolimit')){_0x529ac[_0xef9c('0x1e')]=qs[_0xef9c('0x1e')](_0x4e504a[_0xef9c('0x32')][_0xef9c('0x1e')]);_0x529ac[_0xef9c('0x20')]=qs[_0xef9c('0x20')](_0x4e504a[_0xef9c('0x32')][_0xef9c('0x20')]);}_0x529ac[_0xef9c('0x3a')]=qs[_0xef9c('0x3b')](_0x4e504a[_0xef9c('0x32')][_0xef9c('0x3b')]);_0x529ac[_0xef9c('0x3c')]=qs[_0xef9c('0x34')](_['pick'](_0x4e504a[_0xef9c('0x32')],_0x3e330f[_0xef9c('0x34')]),_0x3e334d);if(_0x4e504a[_0xef9c('0x32')][_0xef9c('0x3d')]){_0x529ac['where']=_[_0xef9c('0x3e')](_0x529ac[_0xef9c('0x3c')],{'$or':_[_0xef9c('0x2b')](_0x3e334d,function(_0x4d4b95){if(_0x4d4b95['type']!==_0xef9c('0x3f')){var _0x4cc5ac={};_0x4cc5ac[_0x4d4b95['name']]={'$like':'%'+_0x4e504a[_0xef9c('0x32')][_0xef9c('0x3d')]+'%'};return _0x4cc5ac;}})});}_0x529ac=_[_0xef9c('0x3e')]({},_0x529ac,_0x4e504a['options']);var _0x5e0265={'where':_0x529ac[_0xef9c('0x3c')]};return db[_0xef9c('0x2c')]['count'](_0x5e0265)[_0xef9c('0x26')](function(_0x32c4e6){_0x3fcdf3[_0xef9c('0x1f')]=_0x32c4e6;if(_0x4e504a[_0xef9c('0x32')][_0xef9c('0x40')]){_0x529ac[_0xef9c('0x41')]=[{'all':!![]}];}return db[_0xef9c('0x2c')][_0xef9c('0x42')](_0x529ac);})[_0xef9c('0x26')](function(_0x47f848){_0x3fcdf3[_0xef9c('0x43')]=_0x47f848;return _0x3fcdf3;})['then'](respondWithFilteredResult(_0x3a0420,_0x529ac))[_0xef9c('0x44')](handleError(_0x3a0420,null));};exports[_0xef9c('0x45')]=function(_0x1b68dd,_0x3e7737){var _0x20d3e9={'raw':!![],'where':{'id':_0x1b68dd[_0xef9c('0x46')]['id']}},_0x1969e4={};_0x1969e4[_0xef9c('0x31')]=_[_0xef9c('0x33')](db[_0xef9c('0x2c')][_0xef9c('0x2d')]);_0x1969e4[_0xef9c('0x32')]=_[_0xef9c('0x33')](_0x1b68dd['query']);_0x1969e4[_0xef9c('0x34')]=_['intersection'](_0x1969e4[_0xef9c('0x31')],_0x1969e4[_0xef9c('0x32')]);_0x20d3e9['attributes']=_[_0xef9c('0x35')](_0x1969e4[_0xef9c('0x31')],qs[_0xef9c('0x36')](_0x1b68dd[_0xef9c('0x32')][_0xef9c('0x36')]));_0x20d3e9[_0xef9c('0x37')]=_0x20d3e9[_0xef9c('0x37')][_0xef9c('0x38')]?_0x20d3e9[_0xef9c('0x37')]:_0x1969e4[_0xef9c('0x31')];if(_0x1b68dd['query'][_0xef9c('0x40')]){_0x20d3e9[_0xef9c('0x41')]=[{'all':!![]}];}_0x20d3e9=_[_0xef9c('0x3e')]({},_0x20d3e9,_0x1b68dd[_0xef9c('0x47')]);return db[_0xef9c('0x2c')][_0xef9c('0x48')](_0x20d3e9)[_0xef9c('0x26')](handleEntityNotFound(_0x3e7737,null))[_0xef9c('0x26')](respondWithResult(_0x3e7737,null))[_0xef9c('0x44')](handleError(_0x3e7737,null));};exports[_0xef9c('0x49')]=function(_0x1a051c,_0x2f77a7){return db[_0xef9c('0x2c')]['create'](_0x1a051c[_0xef9c('0x4a')],{})[_0xef9c('0x26')](respondWithResult(_0x2f77a7,0xc9))[_0xef9c('0x44')](handleError(_0x2f77a7,null));};exports[_0xef9c('0x25')]=function(_0x3dc28c,_0x22f5f5){if(_0x3dc28c['body']['id']){delete _0x3dc28c['body']['id'];}return db[_0xef9c('0x2c')][_0xef9c('0x48')]({'where':{'id':_0x3dc28c[_0xef9c('0x46')]['id']}})['then'](handleEntityNotFound(_0x22f5f5,null))[_0xef9c('0x26')](saveUpdates(_0x3dc28c[_0xef9c('0x4a')],null))['then'](respondWithResult(_0x22f5f5,null))['catch'](handleError(_0x22f5f5,null));};exports[_0xef9c('0x27')]=function(_0xe24e18,_0x301667){return db[_0xef9c('0x2c')][_0xef9c('0x48')]({'where':{'id':_0xe24e18['params']['id']}})['then'](handleEntityNotFound(_0x301667,null))[_0xef9c('0x26')](removeEntity(_0x301667,null))[_0xef9c('0x44')](handleError(_0x301667,null));};exports[_0xef9c('0x4b')]=function(_0x501821,_0xd5f3bd){return db[_0xef9c('0x2c')][_0xef9c('0x4b')]()['then'](respondWithResult(_0xd5f3bd,null))[_0xef9c('0x44')](handleError(_0xd5f3bd,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 9bde498..c1d621f 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 _0xcca2=['./faxTransferReport.attributes','define','report_fax_transfer','uniqueid','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x475674,_0x21125f){var _0x46b19b=function(_0x46674c){while(--_0x46674c){_0x475674['push'](_0x475674['shift']());}};_0x46b19b(++_0x21125f);}(_0xcca2,0x1bc));var _0x2cca=function(_0x354587,_0x1e2d76){_0x354587=_0x354587-0x0;var _0x127c1f=_0xcca2[_0x354587];return _0x127c1f;};'use strict';var _=require(_0x2cca('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2cca('0x1'));var BPromise=require(_0x2cca('0x2'));var rp=require(_0x2cca('0x3'));var fs=require('fs');var path=require(_0x2cca('0x4'));var rimraf=require(_0x2cca('0x5'));var config=require('../../config/environment');var attributes=require(_0x2cca('0x6'));module['exports']=function(_0x235c3a,_0x459a16){return _0x235c3a[_0x2cca('0x7')]('FaxTransferReport',attributes,{'tableName':_0x2cca('0x8'),'paranoid':![],'indexes':[{'name':_0x2cca('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdd73=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','uniqueid'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xdd73,0x156));var _0x3dd7=function(_0x160d97,_0x5379be){_0x160d97=_0x160d97-0x0;var _0x3a3e8e=_0xdd73[_0x160d97];return _0x3a3e8e;};'use strict';var _=require(_0x3dd7('0x0'));var util=require(_0x3dd7('0x1'));var logger=require(_0x3dd7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3dd7('0x3'));var rp=require(_0x3dd7('0x4'));var fs=require('fs');var path=require(_0x3dd7('0x5'));var rimraf=require(_0x3dd7('0x6'));var config=require(_0x3dd7('0x7'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x4657cf,_0xf6457d){return _0x4657cf['define']('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x3dd7('0x8'),'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 60f5ac5..799616b 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 _0x0b23=['debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0xb8adba,_0x43ed86){var _0x1b65ba=function(_0xd21d04){while(--_0xd21d04){_0xb8adba['push'](_0xb8adba['shift']());}};_0x1b65ba(++_0x43ed86);}(_0x0b23,0x129));var _0x30b2=function(_0x681bea,_0x15dd28){_0x681bea=_0x681bea-0x0;var _0x3904a5=_0x0b23[_0x681bea];return _0x3904a5;};'use strict';var _=require(_0x30b2('0x0'));var util=require(_0x30b2('0x1'));var moment=require(_0x30b2('0x2'));var BPromise=require('bluebird');var rs=require(_0x30b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x30b2('0x4'))['db'];var utils=require(_0x30b2('0x5'));var logger=require(_0x30b2('0x6'))(_0x30b2('0x7'));var config=require('../../config/environment');var jayson=require(_0x30b2('0x8'));var client=jayson[_0x30b2('0x9')][_0x30b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d28ce,_0x96fd96,_0x23ddd2){return new BPromise(function(_0x26f4ad,_0x3e0489){return client[_0x30b2('0xb')](_0x1d28ce,_0x23ddd2)[_0x30b2('0xc')](function(_0x631b85){logger['info'](_0x30b2('0xd'),_0x96fd96,_0x30b2('0xe'));logger[_0x30b2('0xf')](_0x30b2('0x10'),_0x96fd96,'request\x20sent',JSON[_0x30b2('0x11')](_0x631b85));if(_0x631b85['error']){if(_0x631b85[_0x30b2('0x12')][_0x30b2('0x13')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x96fd96,_0x631b85[_0x30b2('0x12')][_0x30b2('0x14')]);return _0x3e0489(_0x631b85[_0x30b2('0x12')][_0x30b2('0x14')]);}logger['error'](_0x30b2('0xd'),_0x96fd96,_0x631b85[_0x30b2('0x12')][_0x30b2('0x14')]);return _0x26f4ad(_0x631b85['error'][_0x30b2('0x14')]);}else{logger[_0x30b2('0x15')](_0x30b2('0xd'),_0x96fd96,_0x30b2('0xe'));_0x26f4ad(_0x631b85[_0x30b2('0x16')][_0x30b2('0x14')]);}})[_0x30b2('0x17')](function(_0x1d66d2){logger['error'](_0x30b2('0xd'),_0x96fd96,_0x1d66d2);_0x3e0489(_0x1d66d2);});});} \ No newline at end of file +var _0x7f1b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x12a1da,_0x2203d6){var _0x891aaf=function(_0x40d188){while(--_0x40d188){_0x12a1da['push'](_0x12a1da['shift']());}};_0x891aaf(++_0x2203d6);}(_0x7f1b,0xec));var _0xb7f1=function(_0x2e0586,_0x4f0005){_0x2e0586=_0x2e0586-0x0;var _0x44323a=_0x7f1b[_0x2e0586];return _0x44323a;};'use strict';var _=require('lodash');var util=require(_0xb7f1('0x0'));var moment=require(_0xb7f1('0x1'));var BPromise=require(_0xb7f1('0x2'));var rs=require(_0xb7f1('0x3'));var fs=require('fs');var Redis=require(_0xb7f1('0x4'));var db=require(_0xb7f1('0x5'))['db'];var utils=require(_0xb7f1('0x6'));var logger=require(_0xb7f1('0x7'))(_0xb7f1('0x8'));var config=require(_0xb7f1('0x9'));var jayson=require(_0xb7f1('0xa'));var client=jayson[_0xb7f1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a54d4,_0x1760c4,_0x20ecae){return new BPromise(function(_0x77a6f8,_0x536da9){return client[_0xb7f1('0xc')](_0x3a54d4,_0x20ecae)[_0xb7f1('0xd')](function(_0x36ce9d){logger[_0xb7f1('0xe')](_0xb7f1('0xf'),_0x1760c4,_0xb7f1('0x10'));logger[_0xb7f1('0x11')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x1760c4,_0xb7f1('0x10'),JSON['stringify'](_0x36ce9d));if(_0x36ce9d['error']){if(_0x36ce9d['error']['code']===0x1f4){logger[_0xb7f1('0x12')](_0xb7f1('0xf'),_0x1760c4,_0x36ce9d[_0xb7f1('0x12')][_0xb7f1('0x13')]);return _0x536da9(_0x36ce9d[_0xb7f1('0x12')][_0xb7f1('0x13')]);}logger[_0xb7f1('0x12')](_0xb7f1('0xf'),_0x1760c4,_0x36ce9d[_0xb7f1('0x12')]['message']);return _0x77a6f8(_0x36ce9d['error'][_0xb7f1('0x13')]);}else{logger[_0xb7f1('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x1760c4,_0xb7f1('0x10'));_0x77a6f8(_0x36ce9d[_0xb7f1('0x14')][_0xb7f1('0x13')]);}})[_0xb7f1('0x15')](function(_0x319117){logger[_0xb7f1('0x12')](_0xb7f1('0xf'),_0x1760c4,_0x319117);_0x536da9(_0x319117);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index f65e48e..918719f 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 _0xd90e=['create','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x3b8328,_0x1a0adc){var _0x28ef1a=function(_0x40b2fa){while(--_0x40b2fa){_0x3b8328['push'](_0x3b8328['shift']());}};_0x28ef1a(++_0x1a0adc);}(_0xd90e,0xe0));var _0xed90=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd90e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xed90('0x0'));var util=require(_0xed90('0x1'));var path=require(_0xed90('0x2'));var timeout=require(_0xed90('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xed90('0x4'));var auth=require(_0xed90('0x5'));var interaction=require(_0xed90('0x6'));var config=require(_0xed90('0x7'));var controller=require(_0xed90('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xed90('0x9')]);router[_0xed90('0xa')](_0xed90('0xb'),auth[_0xed90('0xc')](),controller[_0xed90('0xd')]);router[_0xed90('0xa')](_0xed90('0xe'),auth[_0xed90('0xc')](),controller[_0xed90('0xf')]);router['post']('/',auth[_0xed90('0xc')](),controller[_0xed90('0x10')]);router['put']('/:id',auth[_0xed90('0xc')](),controller[_0xed90('0x11')]);router[_0xed90('0x12')](_0xed90('0xe'),auth[_0xed90('0xc')](),controller[_0xed90('0x13')]);module['exports']=router; \ No newline at end of file +var _0xb653=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','index','isAuthenticated','describe','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x2ccb91,_0xa2c1b4){var _0x4136ca=function(_0x4326f0){while(--_0x4326f0){_0x2ccb91['push'](_0x2ccb91['shift']());}};_0x4136ca(++_0xa2c1b4);}(_0xb653,0x1b3));var _0x3b65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb653[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3b65('0x0'));var util=require(_0x3b65('0x1'));var path=require(_0x3b65('0x2'));var timeout=require(_0x3b65('0x3'));var express=require(_0x3b65('0x4'));var router=express[_0x3b65('0x5')]();var fs_extra=require(_0x3b65('0x6'));var auth=require(_0x3b65('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3b65('0x8'));var controller=require(_0x3b65('0x9'));router[_0x3b65('0xa')]('/',auth['isAuthenticated'](),controller[_0x3b65('0xb')]);router['get']('/describe',auth[_0x3b65('0xc')](),controller[_0x3b65('0xd')]);router[_0x3b65('0xa')](_0x3b65('0xe'),auth[_0x3b65('0xc')](),controller[_0x3b65('0xf')]);router[_0x3b65('0x10')]('/',auth[_0x3b65('0xc')](),controller['create']);router[_0x3b65('0x11')](_0x3b65('0xe'),auth['isAuthenticated'](),controller[_0x3b65('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3b65('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 22b06be..d3265df 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 _0xcd86=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./intDeskAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xcd86,0x145));var _0x6cd8=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xcd86[_0x45d3f0];return _0x314b79;};'use strict';var multer=require(_0x6cd8('0x0'));var util=require(_0x6cd8('0x1'));var path=require(_0x6cd8('0x2'));var timeout=require(_0x6cd8('0x3'));var express=require(_0x6cd8('0x4'));var router=express[_0x6cd8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6cd8('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6cd8('0x7'));router['get']('/',auth[_0x6cd8('0x8')](),controller[_0x6cd8('0x9')]);router[_0x6cd8('0xa')](_0x6cd8('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x6cd8('0xa')](_0x6cd8('0xc'),auth[_0x6cd8('0x8')](),controller[_0x6cd8('0xd')]);router['get'](_0x6cd8('0xe'),auth[_0x6cd8('0x8')](),controller[_0x6cd8('0xf')]);router[_0x6cd8('0x10')]('/',auth[_0x6cd8('0x8')](),controller[_0x6cd8('0x11')]);router[_0x6cd8('0x10')](_0x6cd8('0xc'),auth[_0x6cd8('0x8')](),controller[_0x6cd8('0x12')]);router['put']('/:id',auth[_0x6cd8('0x8')](),controller[_0x6cd8('0x13')]);router[_0x6cd8('0x14')](_0x6cd8('0xb'),auth[_0x6cd8('0x8')](),controller[_0x6cd8('0x15')]);module[_0x6cd8('0x16')]=router; \ No newline at end of file +var _0x0752=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','show','get','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','destroy','exports'];(function(_0x103fc5,_0x391e01){var _0x3f510e=function(_0x4fb1cc){while(--_0x4fb1cc){_0x103fc5['push'](_0x103fc5['shift']());}};_0x3f510e(++_0x391e01);}(_0x0752,0xc0));var _0x2075=function(_0xbbdac4,_0x1680af){_0xbbdac4=_0xbbdac4-0x0;var _0x29a431=_0x0752[_0xbbdac4];return _0x29a431;};'use strict';var multer=require(_0x2075('0x0'));var util=require('util');var path=require(_0x2075('0x1'));var timeout=require(_0x2075('0x2'));var express=require(_0x2075('0x3'));var router=express[_0x2075('0x4')]();var fs_extra=require(_0x2075('0x5'));var auth=require(_0x2075('0x6'));var interaction=require(_0x2075('0x7'));var config=require(_0x2075('0x8'));var controller=require('./intDeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2075('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2075('0xa')]);router[_0x2075('0xb')](_0x2075('0xc'),auth[_0x2075('0xd')](),controller[_0x2075('0xe')]);router[_0x2075('0xb')](_0x2075('0xf'),auth[_0x2075('0xd')](),controller[_0x2075('0x10')]);router[_0x2075('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2075('0x11')](_0x2075('0xc'),auth[_0x2075('0xd')](),controller[_0x2075('0x12')]);router[_0x2075('0x13')](_0x2075('0x14'),auth['isAuthenticated'](),controller[_0x2075('0x15')]);router['delete'](_0x2075('0x14'),auth[_0x2075('0xd')](),controller[_0x2075('0x16')]);module[_0x2075('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 79ce749..3cfed55 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 _0x330d=['basic','integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0xd4ee1a,_0xeb5d6){var _0x5f565e=function(_0x195c3e){while(--_0x195c3e){_0xd4ee1a['push'](_0xd4ee1a['shift']());}};_0x5f565e(++_0xeb5d6);}(_0x330d,0x1ca));var _0xd330=function(_0x1d80be,_0x3a60ff){_0x1d80be=_0x1d80be-0x0;var _0xf9a4f3=_0x330d[_0x1d80be];return _0xf9a4f3;};'use strict';var Sequelize=require(_0xd330('0x0'));module[_0xd330('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd330('0x2')]},'remoteUri':{'type':Sequelize[_0xd330('0x2')]},'authType':{'type':Sequelize[_0xd330('0x3')](_0xd330('0x4')),'defaultValue':_0xd330('0x4')},'password':{'type':Sequelize[_0xd330('0x2')]},'consumerKey':{'type':Sequelize[_0xd330('0x2')]},'consumerSecret':{'type':Sequelize[_0xd330('0x2')]},'token':{'type':Sequelize[_0xd330('0x2')]},'tokenSecret':{'type':Sequelize[_0xd330('0x2')]},'serverUrl':{'type':Sequelize[_0xd330('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd330('0x5'),_0xd330('0x6')),'defaultValue':_0xd330('0x5')}}; \ No newline at end of file +var _0x8c64=['integrationTab','newTab','sequelize','exports','STRING','basic'];(function(_0x464264,_0x1a5c22){var _0x37df34=function(_0x1017e3){while(--_0x1017e3){_0x464264['push'](_0x464264['shift']());}};_0x37df34(++_0x1a5c22);}(_0x8c64,0x19a));var _0x48c6=function(_0x17ef11,_0x41e000){_0x17ef11=_0x17ef11-0x0;var _0x2e5fee=_0x8c64[_0x17ef11];return _0x2e5fee;};'use strict';var Sequelize=require(_0x48c6('0x0'));module[_0x48c6('0x1')]={'name':{'type':Sequelize[_0x48c6('0x2')]},'description':{'type':Sequelize[_0x48c6('0x2')]},'username':{'type':Sequelize[_0x48c6('0x2')]},'remoteUri':{'type':Sequelize[_0x48c6('0x2')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0x48c6('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x48c6('0x2')]},'consumerSecret':{'type':Sequelize[_0x48c6('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x48c6('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x48c6('0x4'),_0x48c6('0x5')),'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 16d1e1e..8482c1f 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 _0x5fa1=['entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','DeskAccount','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','type','getDescriptions','channel','DeskConfiguration','DeskField','getFields','priority','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','authType','basic','headers','Authorization','format','Basic\x20%s','username','toString','base64','_embedded'];(function(_0x481af3,_0x483fac){var _0x3354ea=function(_0x2e3de5){while(--_0x2e3de5){_0x481af3['push'](_0x481af3['shift']());}};_0x3354ea(++_0x483fac);}(_0x5fa1,0xe2));var _0x15fa=function(_0x22aa91,_0x42829c){_0x22aa91=_0x22aa91-0x0;var _0x58887d=_0x5fa1[_0x22aa91];return _0x58887d;};'use strict';var emlformat=require(_0x15fa('0x0'));var rimraf=require(_0x15fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x15fa('0x2'));var moment=require(_0x15fa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x15fa('0x4'));var util=require(_0x15fa('0x5'));var path=require(_0x15fa('0x6'));var sox=require(_0x15fa('0x7'));var csv=require(_0x15fa('0x8'));var ejs=require(_0x15fa('0x9'));var fs=require('fs');var fs_extra=require(_0x15fa('0xa'));var _=require(_0x15fa('0xb'));var squel=require(_0x15fa('0xc'));var crypto=require(_0x15fa('0xd'));var jsforce=require(_0x15fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x15fa('0x8'));var querystring=require(_0x15fa('0xf'));var Papa=require(_0x15fa('0x10'));var Redis=require(_0x15fa('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x15fa('0x12'));var as=require(_0x15fa('0x13'));var hardwareService=require(_0x15fa('0x14'));var logger=require('../../config/logger')(_0x15fa('0x15'));var utils=require(_0x15fa('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x15fa('0x17'))['db'];var integrations=require(_0x15fa('0x18'));function respondWithStatusCode(_0x25d24a,_0xc1ca9d){_0xc1ca9d=_0xc1ca9d||0xcc;return function(_0x1c2984){if(_0x1c2984){return _0x25d24a['sendStatus'](_0xc1ca9d);}return _0x25d24a[_0x15fa('0x19')](_0xc1ca9d)[_0x15fa('0x1a')]();};}function respondWithResult(_0x1ad3f8,_0x52579d){_0x52579d=_0x52579d||0xc8;return function(_0x1ab0f9){if(_0x1ab0f9){return _0x1ad3f8[_0x15fa('0x19')](_0x52579d)[_0x15fa('0x1b')](_0x1ab0f9);}};}function respondWithFilteredResult(_0x1f1feb,_0x5a1cc3){return function(_0x368756){if(_0x368756){var _0x41e174=typeof _0x5a1cc3[_0x15fa('0x1c')]===_0x15fa('0x1d')&&typeof _0x5a1cc3[_0x15fa('0x1e')]===_0x15fa('0x1d');var _0x5c550e=_0x368756[_0x15fa('0x1f')];var _0x337136=_0x41e174?0x0:_0x5a1cc3['offset'];var _0x54540a=_0x41e174?_0x368756[_0x15fa('0x1f')]:_0x5a1cc3['offset']+_0x5a1cc3[_0x15fa('0x1e')];var _0x38a6f8;if(_0x54540a>=_0x5c550e){_0x54540a=_0x5c550e;_0x38a6f8=0xc8;}else{_0x38a6f8=0xce;}_0x1f1feb[_0x15fa('0x19')](_0x38a6f8);return _0x1f1feb[_0x15fa('0x20')]('Content-Range',_0x337136+'-'+_0x54540a+'/'+_0x5c550e)[_0x15fa('0x1b')](_0x368756);}return null;};}function patchUpdates(_0x5d638e){return function(_0x3fcc60){try{jsonpatch['apply'](_0x3fcc60,_0x5d638e,!![]);}catch(_0x5341aa){return BPromise['reject'](_0x5341aa);}return _0x3fcc60['save']();};}function saveUpdates(_0x258484,_0x203542){return function(_0x1737dd){if(_0x1737dd){return _0x1737dd[_0x15fa('0x21')](_0x258484)['then'](function(_0x48cab5){return _0x48cab5;});}return null;};}function removeEntity(_0x57c4fe,_0x1150cb){return function(_0x415fff){if(_0x415fff){return _0x415fff['destroy']()[_0x15fa('0x22')](function(){_0x57c4fe[_0x15fa('0x19')](0xcc)[_0x15fa('0x1a')]();});}};}function handleEntityNotFound(_0x49f1c3,_0xd148f0){return function(_0x147cae){if(!_0x147cae){_0x49f1c3['sendStatus'](0x194);}return _0x147cae;};}function handleError(_0x388d9c,_0x565310){_0x565310=_0x565310||0x1f4;return function(_0x4b5d75){logger[_0x15fa('0x23')](_0x4b5d75[_0x15fa('0x24')]);if(_0x4b5d75[_0x15fa('0x25')]){delete _0x4b5d75[_0x15fa('0x25')];}_0x388d9c[_0x15fa('0x19')](_0x565310)[_0x15fa('0x26')](_0x4b5d75);};}exports[_0x15fa('0x27')]=function(_0x3adb9f,_0x8ab03){var _0x375787={},_0x5f85db={},_0x5b51e7={'count':0x0,'rows':[]};var _0x59fe8b=_[_0x15fa('0x28')](db['DeskAccount'][_0x15fa('0x29')],function(_0x47f72a){return{'name':_0x47f72a[_0x15fa('0x2a')],'type':_0x47f72a['type'][_0x15fa('0x2b')]};});_0x5f85db[_0x15fa('0x2c')]=_['map'](_0x59fe8b,_0x15fa('0x25'));_0x5f85db[_0x15fa('0x2d')]=_['keys'](_0x3adb9f[_0x15fa('0x2d')]);_0x5f85db[_0x15fa('0x2e')]=_[_0x15fa('0x2f')](_0x5f85db['model'],_0x5f85db[_0x15fa('0x2d')]);_0x375787[_0x15fa('0x30')]=_[_0x15fa('0x2f')](_0x5f85db[_0x15fa('0x2c')],qs[_0x15fa('0x31')](_0x3adb9f['query'][_0x15fa('0x31')]));_0x375787[_0x15fa('0x30')]=_0x375787[_0x15fa('0x30')][_0x15fa('0x32')]?_0x375787[_0x15fa('0x30')]:_0x5f85db[_0x15fa('0x2c')];if(!_0x3adb9f['query'][_0x15fa('0x33')]('nolimit')){_0x375787[_0x15fa('0x1e')]=qs['limit'](_0x3adb9f['query']['limit']);_0x375787[_0x15fa('0x1c')]=qs[_0x15fa('0x1c')](_0x3adb9f['query']['offset']);}_0x375787[_0x15fa('0x34')]=qs[_0x15fa('0x35')](_0x3adb9f[_0x15fa('0x2d')][_0x15fa('0x35')]);_0x375787[_0x15fa('0x36')]=qs[_0x15fa('0x2e')](_['pick'](_0x3adb9f[_0x15fa('0x2d')],_0x5f85db[_0x15fa('0x2e')]),_0x59fe8b);if(_0x3adb9f[_0x15fa('0x2d')][_0x15fa('0x37')]){_0x375787[_0x15fa('0x36')]=_[_0x15fa('0x38')](_0x375787[_0x15fa('0x36')],{'$or':_[_0x15fa('0x28')](_0x59fe8b,function(_0x30519e){if(_0x30519e['type']!==_0x15fa('0x39')){var _0x13eda2={};_0x13eda2[_0x30519e['name']]={'$like':'%'+_0x3adb9f['query']['filter']+'%'};return _0x13eda2;}})});}_0x375787=_[_0x15fa('0x38')]({},_0x375787,_0x3adb9f[_0x15fa('0x3a')]);var _0x2301eb={'where':_0x375787[_0x15fa('0x36')]};return db[_0x15fa('0x3b')][_0x15fa('0x1f')](_0x2301eb)[_0x15fa('0x22')](function(_0x21629c){_0x5b51e7[_0x15fa('0x1f')]=_0x21629c;if(_0x3adb9f[_0x15fa('0x2d')][_0x15fa('0x3c')]){_0x375787['include']=[{'all':!![]}];}return db['DeskAccount'][_0x15fa('0x3d')](_0x375787);})[_0x15fa('0x22')](function(_0x62671a){_0x5b51e7[_0x15fa('0x3e')]=_0x62671a;return _0x5b51e7;})['then'](respondWithFilteredResult(_0x8ab03,_0x375787))[_0x15fa('0x3f')](handleError(_0x8ab03,null));};exports[_0x15fa('0x40')]=function(_0x2956f5,_0x333f54){var _0x410618={'raw':![],'where':{'id':_0x2956f5[_0x15fa('0x41')]['id']}},_0x536120={};_0x536120[_0x15fa('0x2c')]=_[_0x15fa('0x42')](db[_0x15fa('0x3b')]['rawAttributes']);_0x536120[_0x15fa('0x2d')]=_[_0x15fa('0x42')](_0x2956f5['query']);_0x536120[_0x15fa('0x2e')]=_[_0x15fa('0x2f')](_0x536120[_0x15fa('0x2c')],_0x536120[_0x15fa('0x2d')]);_0x410618[_0x15fa('0x30')]=_[_0x15fa('0x2f')](_0x536120[_0x15fa('0x2c')],qs[_0x15fa('0x31')](_0x2956f5['query'][_0x15fa('0x31')]));_0x410618['attributes']=_0x410618[_0x15fa('0x30')][_0x15fa('0x32')]?_0x410618[_0x15fa('0x30')]:_0x536120[_0x15fa('0x2c')];if(_0x2956f5[_0x15fa('0x2d')][_0x15fa('0x3c')]){_0x410618[_0x15fa('0x43')]=[{'all':!![]}];}_0x410618=_['merge']({},_0x410618,_0x2956f5[_0x15fa('0x3a')]);return db['DeskAccount'][_0x15fa('0x44')](_0x410618)[_0x15fa('0x22')](handleEntityNotFound(_0x333f54,null))['then'](respondWithResult(_0x333f54,null))[_0x15fa('0x3f')](handleError(_0x333f54,null));};exports['create']=function(_0x425577,_0x31c46a){return db[_0x15fa('0x3b')][_0x15fa('0x45')](_0x425577[_0x15fa('0x46')],{})[_0x15fa('0x22')](respondWithResult(_0x31c46a,0xc9))['catch'](handleError(_0x31c46a,null));};exports['update']=function(_0x3da8b1,_0x3ef4e6){if(_0x3da8b1[_0x15fa('0x46')]['id']){delete _0x3da8b1['body']['id'];}return db[_0x15fa('0x3b')]['find']({'where':{'id':_0x3da8b1[_0x15fa('0x41')]['id']}})[_0x15fa('0x22')](handleEntityNotFound(_0x3ef4e6,null))['then'](saveUpdates(_0x3da8b1['body'],null))[_0x15fa('0x22')](respondWithResult(_0x3ef4e6,null))['catch'](handleError(_0x3ef4e6,null));};exports['destroy']=function(_0xb66dfb,_0x44d3e4){return db[_0x15fa('0x3b')][_0x15fa('0x44')]({'where':{'id':_0xb66dfb[_0x15fa('0x41')]['id']}})[_0x15fa('0x22')](handleEntityNotFound(_0x44d3e4,null))[_0x15fa('0x22')](removeEntity(_0x44d3e4,null))[_0x15fa('0x3f')](handleError(_0x44d3e4,null));};exports[_0x15fa('0x47')]=function(_0x502491,_0x853c98,_0x37477c){var _0x520e4a={};var _0x59fc64={};var _0x3f7ab9;var _0x19f6bd;return db['DeskAccount'][_0x15fa('0x48')]({'where':{'id':_0x502491[_0x15fa('0x41')]['id']}})['then'](handleEntityNotFound(_0x853c98,null))[_0x15fa('0x22')](function(_0x4cfc3e){if(_0x4cfc3e){_0x3f7ab9=_0x4cfc3e;_0x59fc64[_0x15fa('0x2c')]=_[_0x15fa('0x42')](db['DeskConfiguration'][_0x15fa('0x29')]);_0x59fc64['query']=_[_0x15fa('0x42')](_0x502491[_0x15fa('0x2d')]);_0x59fc64['filters']=_[_0x15fa('0x2f')](_0x59fc64[_0x15fa('0x2c')],_0x59fc64[_0x15fa('0x2d')]);_0x520e4a[_0x15fa('0x30')]=_['intersection'](_0x59fc64['model'],qs[_0x15fa('0x31')](_0x502491[_0x15fa('0x2d')][_0x15fa('0x31')]));_0x520e4a[_0x15fa('0x30')]=_0x520e4a['attributes'][_0x15fa('0x32')]?_0x520e4a[_0x15fa('0x30')]:_0x59fc64[_0x15fa('0x2c')];_0x520e4a[_0x15fa('0x34')]=qs[_0x15fa('0x35')](_0x502491[_0x15fa('0x2d')]['sort']);_0x520e4a[_0x15fa('0x36')]=qs[_0x15fa('0x2e')](_['pick'](_0x502491[_0x15fa('0x2d')],_0x59fc64[_0x15fa('0x2e')]));if(_0x502491['query'][_0x15fa('0x37')]){_0x520e4a[_0x15fa('0x36')]=_[_0x15fa('0x38')](_0x520e4a[_0x15fa('0x36')],{'$or':_['map'](_0x520e4a[_0x15fa('0x30')],function(_0x3b5fde){var _0x2c76a2={};_0x2c76a2[_0x3b5fde]={'$like':'%'+_0x502491[_0x15fa('0x2d')][_0x15fa('0x37')]+'%'};return _0x2c76a2;})});}_0x520e4a=_['merge']({},_0x520e4a,_0x502491[_0x15fa('0x3a')]);return _0x3f7ab9['getConfigurations'](_0x520e4a);}})[_0x15fa('0x22')](function(_0x132a03){if(_0x132a03){_0x19f6bd=_0x132a03[_0x15fa('0x32')];if(!_0x502491[_0x15fa('0x2d')][_0x15fa('0x33')](_0x15fa('0x49'))){_0x520e4a[_0x15fa('0x1e')]=qs[_0x15fa('0x1e')](_0x502491['query'][_0x15fa('0x1e')]);_0x520e4a[_0x15fa('0x1c')]=qs[_0x15fa('0x1c')](_0x502491[_0x15fa('0x2d')][_0x15fa('0x1c')]);}return _0x3f7ab9[_0x15fa('0x47')](_0x520e4a);}})[_0x15fa('0x22')](function(_0x61a8ec){if(_0x61a8ec){return _0x61a8ec?{'count':_0x19f6bd,'rows':_0x61a8ec}:null;}})[_0x15fa('0x22')](respondWithResult(_0x853c98,null))[_0x15fa('0x3f')](handleError(_0x853c98,null));};exports[_0x15fa('0x4a')]=function(_0x1118c7,_0x79154d,_0x2d515c){if(_0x1118c7[_0x15fa('0x46')]['id']){delete _0x1118c7[_0x15fa('0x46')]['id'];}return db[_0x15fa('0x3b')]['findOne']({'where':{'id':_0x1118c7[_0x15fa('0x41')]['id']}})[_0x15fa('0x22')](handleEntityNotFound(_0x79154d,null))[_0x15fa('0x22')](function(_0x319123){if(_0x319123){_0x1118c7[_0x15fa('0x46')][_0x15fa('0x4b')]=_0x319123['id'];_0x1118c7[_0x15fa('0x46')][_0x15fa('0x4c')]=integrations[_0x15fa('0x4d')](_0x1118c7['body']['channel'],_0x1118c7['body'][_0x15fa('0x4e')]);_0x1118c7[_0x15fa('0x46')]['Descriptions']=integrations[_0x15fa('0x4f')](_0x1118c7[_0x15fa('0x46')][_0x15fa('0x50')],_0x1118c7[_0x15fa('0x46')][_0x15fa('0x4e')]);return db[_0x15fa('0x51')][_0x15fa('0x45')](_0x1118c7['body'],{'include':[{'model':db['DeskField'],'as':_0x15fa('0x4c')},{'model':db[_0x15fa('0x52')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x79154d,null))['catch'](handleError(_0x79154d,null));};exports[_0x15fa('0x53')]=function(_0x4888ca,_0x2a8ef9,_0x39c41a){var _0x30b5eb=[{'name':_0x15fa('0x54'),'label':_0x15fa('0x54'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x8d70e8='';return db[_0x15fa('0x3b')][_0x15fa('0x48')]({'where':{'id':_0x4888ca['params']['id']},'attributes':['id','remoteUri','authType','username','password',_0x15fa('0x55'),'consumerSecret',_0x15fa('0x56'),_0x15fa('0x57')]})['then'](handleEntityNotFound(_0x2a8ef9,null))[_0x15fa('0x22')](function(_0x1e25f4){if(_0x1e25f4){_0x8d70e8=_0x1e25f4['remoteUri'];var _0x3a439d=_0x8d70e8[_0x15fa('0x58')](-0x1);if(_0x3a439d==='/'){_0x8d70e8=_0x8d70e8[_0x15fa('0x59')](0x0,_0x8d70e8[_0x15fa('0x5a')](_0x3a439d));}var _0x1dae74={'method':_0x15fa('0x5b'),'uri':util['format'](_0x15fa('0x5c'),_0x8d70e8),'headers':{'Content-Type':_0x15fa('0x5d'),'Accept':_0x15fa('0x5d')},'json':!![]};if(_0x1e25f4[_0x15fa('0x5e')]===_0x15fa('0x5f')){_0x1dae74[_0x15fa('0x60')][_0x15fa('0x61')]=util[_0x15fa('0x62')](_0x15fa('0x63'),new Buffer(util[_0x15fa('0x62')]('%s:%s',_0x1e25f4[_0x15fa('0x64')],_0x1e25f4['password']))[_0x15fa('0x65')](_0x15fa('0x66')));}return rp(_0x1dae74)[_0x15fa('0x22')](function(_0x53dc9b){return _0x30b5eb['concat'](_[_0x15fa('0x28')](_0x53dc9b[_0x15fa('0x67')][_0x15fa('0x68')],function(_0xd778b){return{'id':_0xd778b[_0x15fa('0x25')],'name':_0xd778b['name'],'type':_0xd778b[_0x15fa('0x4e')],'active':_0xd778b['active'],'label':_0xd778b[_0x15fa('0x69')],'custom':!![]};}));});}})[_0x15fa('0x22')](function(_0x7d065c){return{'count':_0x7d065c[_0x15fa('0x32')],'rows':_0x7d065c};})['then'](respondWithResult(_0x2a8ef9,null))[_0x15fa('0x3f')](function(_0x34fe9a){var _0x2f5d00=_0x4888ca[_0x15fa('0x2d')][_0x15fa('0x6a')]?0x1f4:_0x34fe9a[_0x15fa('0x6b')]||0x1f4;logger[_0x15fa('0x23')](_0x15fa('0x6c'),_0x15fa('0x53'),_0x2f5d00,JSON['stringify'](_0x34fe9a));delete _0x34fe9a[_0x15fa('0x25')];if(_0x2f5d00===0x191){_0x2f5d00=0x190;}_0x2a8ef9[_0x15fa('0x19')](_0x2f5d00)[_0x15fa('0x26')](_0x4888ca[_0x15fa('0x2d')][_0x15fa('0x6a')]?{'message':_0x15fa('0x6d'),'statusCode':_0x34fe9a[_0x15fa('0x6b')]}:_0x34fe9a);});}; \ No newline at end of file +var _0x57cc=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','save','update','then','end','error','stack','name','send','index','DeskAccount','rawAttributes','fieldName','key','map','query','keys','filters','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','intersection','find','create','body','params','getConfigurations','findOne','length','hasOwnProperty','AccountId','getSubjects','channel','type','Descriptions','getDescriptions','DeskConfiguration','DeskField','Subjects','getFields','priority','remoteUri','authType','password','consumerSecret','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','username','toString','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x57cc,0xda));var _0xc57c=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0x57cc[_0x9729d7];return _0x3c4ac6;};'use strict';var emlformat=require(_0xc57c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc57c('0x1'));var jsonpatch=require(_0xc57c('0x2'));var rp=require(_0xc57c('0x3'));var moment=require(_0xc57c('0x4'));var BPromise=require(_0xc57c('0x5'));var Mustache=require('mustache');var util=require(_0xc57c('0x6'));var path=require(_0xc57c('0x7'));var sox=require(_0xc57c('0x8'));var csv=require(_0xc57c('0x9'));var ejs=require(_0xc57c('0xa'));var fs=require('fs');var fs_extra=require(_0xc57c('0xb'));var _=require(_0xc57c('0xc'));var squel=require('squel');var crypto=require(_0xc57c('0xd'));var jsforce=require(_0xc57c('0xe'));var deskjs=require(_0xc57c('0xf'));var toCsv=require(_0xc57c('0x9'));var querystring=require(_0xc57c('0x10'));var Papa=require(_0xc57c('0x11'));var Redis=require(_0xc57c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc57c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc57c('0x14'));var logger=require(_0xc57c('0x15'))(_0xc57c('0x16'));var utils=require(_0xc57c('0x17'));var config=require(_0xc57c('0x18'));var licenseUtil=require(_0xc57c('0x19'));var db=require(_0xc57c('0x1a'))['db'];var integrations=require(_0xc57c('0x1b'));function respondWithStatusCode(_0x166510,_0x15b1cf){_0x15b1cf=_0x15b1cf||0xcc;return function(_0x2ccfc9){if(_0x2ccfc9){return _0x166510[_0xc57c('0x1c')](_0x15b1cf);}return _0x166510[_0xc57c('0x1d')](_0x15b1cf)['end']();};}function respondWithResult(_0x25e5aa,_0x1181c5){_0x1181c5=_0x1181c5||0xc8;return function(_0x4aac48){if(_0x4aac48){return _0x25e5aa[_0xc57c('0x1d')](_0x1181c5)['json'](_0x4aac48);}};}function respondWithFilteredResult(_0x3e1987,_0x17d801){return function(_0x71ef2c){if(_0x71ef2c){var _0x73754a=typeof _0x17d801[_0xc57c('0x1e')]===_0xc57c('0x1f')&&typeof _0x17d801['limit']===_0xc57c('0x1f');var _0x209955=_0x71ef2c[_0xc57c('0x20')];var _0x301294=_0x73754a?0x0:_0x17d801[_0xc57c('0x1e')];var _0x1b7a33=_0x73754a?_0x71ef2c[_0xc57c('0x20')]:_0x17d801['offset']+_0x17d801[_0xc57c('0x21')];var _0x4d0fcf;if(_0x1b7a33>=_0x209955){_0x1b7a33=_0x209955;_0x4d0fcf=0xc8;}else{_0x4d0fcf=0xce;}_0x3e1987[_0xc57c('0x1d')](_0x4d0fcf);return _0x3e1987[_0xc57c('0x22')]('Content-Range',_0x301294+'-'+_0x1b7a33+'/'+_0x209955)[_0xc57c('0x23')](_0x71ef2c);}return null;};}function patchUpdates(_0x5b80c1){return function(_0xd0cf85){try{jsonpatch[_0xc57c('0x24')](_0xd0cf85,_0x5b80c1,!![]);}catch(_0x2207a6){return BPromise[_0xc57c('0x25')](_0x2207a6);}return _0xd0cf85[_0xc57c('0x26')]();};}function saveUpdates(_0x5d9403,_0x44d6c4){return function(_0x15e304){if(_0x15e304){return _0x15e304[_0xc57c('0x27')](_0x5d9403)['then'](function(_0x322660){return _0x322660;});}return null;};}function removeEntity(_0x57233d,_0xaec8db){return function(_0x2a4bf9){if(_0x2a4bf9){return _0x2a4bf9['destroy']()[_0xc57c('0x28')](function(){_0x57233d[_0xc57c('0x1d')](0xcc)[_0xc57c('0x29')]();});}};}function handleEntityNotFound(_0x45f871,_0x3916f2){return function(_0x5edefe){if(!_0x5edefe){_0x45f871[_0xc57c('0x1c')](0x194);}return _0x5edefe;};}function handleError(_0x4b48ef,_0x4b16a8){_0x4b16a8=_0x4b16a8||0x1f4;return function(_0x1d30ca){logger[_0xc57c('0x2a')](_0x1d30ca[_0xc57c('0x2b')]);if(_0x1d30ca['name']){delete _0x1d30ca[_0xc57c('0x2c')];}_0x4b48ef[_0xc57c('0x1d')](_0x4b16a8)[_0xc57c('0x2d')](_0x1d30ca);};}exports[_0xc57c('0x2e')]=function(_0x41c5a9,_0x56c94e){var _0x3db83e={},_0x789204={},_0x21b78a={'count':0x0,'rows':[]};var _0x5303e3=_['map'](db[_0xc57c('0x2f')][_0xc57c('0x30')],function(_0x66a434){return{'name':_0x66a434[_0xc57c('0x31')],'type':_0x66a434['type'][_0xc57c('0x32')]};});_0x789204['model']=_[_0xc57c('0x33')](_0x5303e3,_0xc57c('0x2c'));_0x789204[_0xc57c('0x34')]=_[_0xc57c('0x35')](_0x41c5a9['query']);_0x789204[_0xc57c('0x36')]=_['intersection'](_0x789204[_0xc57c('0x37')],_0x789204[_0xc57c('0x34')]);_0x3db83e[_0xc57c('0x38')]=_['intersection'](_0x789204[_0xc57c('0x37')],qs[_0xc57c('0x39')](_0x41c5a9[_0xc57c('0x34')][_0xc57c('0x39')]));_0x3db83e['attributes']=_0x3db83e[_0xc57c('0x38')]['length']?_0x3db83e[_0xc57c('0x38')]:_0x789204[_0xc57c('0x37')];if(!_0x41c5a9[_0xc57c('0x34')]['hasOwnProperty'](_0xc57c('0x3a'))){_0x3db83e[_0xc57c('0x21')]=qs[_0xc57c('0x21')](_0x41c5a9[_0xc57c('0x34')]['limit']);_0x3db83e['offset']=qs['offset'](_0x41c5a9[_0xc57c('0x34')]['offset']);}_0x3db83e[_0xc57c('0x3b')]=qs['sort'](_0x41c5a9[_0xc57c('0x34')][_0xc57c('0x3c')]);_0x3db83e[_0xc57c('0x3d')]=qs[_0xc57c('0x36')](_[_0xc57c('0x3e')](_0x41c5a9[_0xc57c('0x34')],_0x789204['filters']),_0x5303e3);if(_0x41c5a9[_0xc57c('0x34')][_0xc57c('0x3f')]){_0x3db83e['where']=_[_0xc57c('0x40')](_0x3db83e[_0xc57c('0x3d')],{'$or':_['map'](_0x5303e3,function(_0x14d30a){if(_0x14d30a['type']!==_0xc57c('0x41')){var _0x25c493={};_0x25c493[_0x14d30a['name']]={'$like':'%'+_0x41c5a9[_0xc57c('0x34')][_0xc57c('0x3f')]+'%'};return _0x25c493;}})});}_0x3db83e=_[_0xc57c('0x40')]({},_0x3db83e,_0x41c5a9[_0xc57c('0x42')]);var _0x26bbd8={'where':_0x3db83e['where']};return db[_0xc57c('0x2f')]['count'](_0x26bbd8)['then'](function(_0x1963a2){_0x21b78a['count']=_0x1963a2;if(_0x41c5a9[_0xc57c('0x34')][_0xc57c('0x43')]){_0x3db83e[_0xc57c('0x44')]=[{'all':!![]}];}return db[_0xc57c('0x2f')][_0xc57c('0x45')](_0x3db83e);})[_0xc57c('0x28')](function(_0x25a0ad){_0x21b78a[_0xc57c('0x46')]=_0x25a0ad;return _0x21b78a;})[_0xc57c('0x28')](respondWithFilteredResult(_0x56c94e,_0x3db83e))[_0xc57c('0x47')](handleError(_0x56c94e,null));};exports['show']=function(_0x449474,_0x5aab4d){var _0x83e262={'raw':![],'where':{'id':_0x449474['params']['id']}},_0x2a8d99={};_0x2a8d99[_0xc57c('0x37')]=_[_0xc57c('0x35')](db[_0xc57c('0x2f')][_0xc57c('0x30')]);_0x2a8d99[_0xc57c('0x34')]=_[_0xc57c('0x35')](_0x449474['query']);_0x2a8d99[_0xc57c('0x36')]=_[_0xc57c('0x48')](_0x2a8d99[_0xc57c('0x37')],_0x2a8d99[_0xc57c('0x34')]);_0x83e262['attributes']=_[_0xc57c('0x48')](_0x2a8d99[_0xc57c('0x37')],qs['fields'](_0x449474['query'][_0xc57c('0x39')]));_0x83e262[_0xc57c('0x38')]=_0x83e262[_0xc57c('0x38')]['length']?_0x83e262['attributes']:_0x2a8d99[_0xc57c('0x37')];if(_0x449474[_0xc57c('0x34')][_0xc57c('0x43')]){_0x83e262['include']=[{'all':!![]}];}_0x83e262=_[_0xc57c('0x40')]({},_0x83e262,_0x449474[_0xc57c('0x42')]);return db[_0xc57c('0x2f')][_0xc57c('0x49')](_0x83e262)[_0xc57c('0x28')](handleEntityNotFound(_0x5aab4d,null))[_0xc57c('0x28')](respondWithResult(_0x5aab4d,null))[_0xc57c('0x47')](handleError(_0x5aab4d,null));};exports[_0xc57c('0x4a')]=function(_0x4134,_0x4f2e3b){return db[_0xc57c('0x2f')][_0xc57c('0x4a')](_0x4134['body'],{})[_0xc57c('0x28')](respondWithResult(_0x4f2e3b,0xc9))[_0xc57c('0x47')](handleError(_0x4f2e3b,null));};exports[_0xc57c('0x27')]=function(_0x591a1b,_0x189b26){if(_0x591a1b[_0xc57c('0x4b')]['id']){delete _0x591a1b[_0xc57c('0x4b')]['id'];}return db[_0xc57c('0x2f')][_0xc57c('0x49')]({'where':{'id':_0x591a1b['params']['id']}})[_0xc57c('0x28')](handleEntityNotFound(_0x189b26,null))[_0xc57c('0x28')](saveUpdates(_0x591a1b[_0xc57c('0x4b')],null))[_0xc57c('0x28')](respondWithResult(_0x189b26,null))[_0xc57c('0x47')](handleError(_0x189b26,null));};exports['destroy']=function(_0x1f91e0,_0x10c191){return db[_0xc57c('0x2f')]['find']({'where':{'id':_0x1f91e0[_0xc57c('0x4c')]['id']}})[_0xc57c('0x28')](handleEntityNotFound(_0x10c191,null))['then'](removeEntity(_0x10c191,null))[_0xc57c('0x47')](handleError(_0x10c191,null));};exports[_0xc57c('0x4d')]=function(_0x1a5d2d,_0x36c9c9,_0x4f950b){var _0x47dbcb={};var _0x5c4b3d={};var _0x353336;var _0x1dd70f;return db['DeskAccount'][_0xc57c('0x4e')]({'where':{'id':_0x1a5d2d[_0xc57c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x36c9c9,null))[_0xc57c('0x28')](function(_0x1ca49b){if(_0x1ca49b){_0x353336=_0x1ca49b;_0x5c4b3d[_0xc57c('0x37')]=_['keys'](db['DeskConfiguration'][_0xc57c('0x30')]);_0x5c4b3d[_0xc57c('0x34')]=_['keys'](_0x1a5d2d[_0xc57c('0x34')]);_0x5c4b3d[_0xc57c('0x36')]=_[_0xc57c('0x48')](_0x5c4b3d[_0xc57c('0x37')],_0x5c4b3d[_0xc57c('0x34')]);_0x47dbcb[_0xc57c('0x38')]=_['intersection'](_0x5c4b3d[_0xc57c('0x37')],qs[_0xc57c('0x39')](_0x1a5d2d[_0xc57c('0x34')][_0xc57c('0x39')]));_0x47dbcb[_0xc57c('0x38')]=_0x47dbcb['attributes'][_0xc57c('0x4f')]?_0x47dbcb[_0xc57c('0x38')]:_0x5c4b3d[_0xc57c('0x37')];_0x47dbcb[_0xc57c('0x3b')]=qs['sort'](_0x1a5d2d[_0xc57c('0x34')][_0xc57c('0x3c')]);_0x47dbcb[_0xc57c('0x3d')]=qs['filters'](_[_0xc57c('0x3e')](_0x1a5d2d[_0xc57c('0x34')],_0x5c4b3d[_0xc57c('0x36')]));if(_0x1a5d2d[_0xc57c('0x34')][_0xc57c('0x3f')]){_0x47dbcb[_0xc57c('0x3d')]=_['merge'](_0x47dbcb[_0xc57c('0x3d')],{'$or':_[_0xc57c('0x33')](_0x47dbcb[_0xc57c('0x38')],function(_0x16c15e){var _0x28e267={};_0x28e267[_0x16c15e]={'$like':'%'+_0x1a5d2d['query']['filter']+'%'};return _0x28e267;})});}_0x47dbcb=_[_0xc57c('0x40')]({},_0x47dbcb,_0x1a5d2d['options']);return _0x353336['getConfigurations'](_0x47dbcb);}})[_0xc57c('0x28')](function(_0x490f12){if(_0x490f12){_0x1dd70f=_0x490f12[_0xc57c('0x4f')];if(!_0x1a5d2d['query'][_0xc57c('0x50')](_0xc57c('0x3a'))){_0x47dbcb[_0xc57c('0x21')]=qs[_0xc57c('0x21')](_0x1a5d2d['query'][_0xc57c('0x21')]);_0x47dbcb[_0xc57c('0x1e')]=qs['offset'](_0x1a5d2d['query'][_0xc57c('0x1e')]);}return _0x353336[_0xc57c('0x4d')](_0x47dbcb);}})['then'](function(_0x3d921b){if(_0x3d921b){return _0x3d921b?{'count':_0x1dd70f,'rows':_0x3d921b}:null;}})['then'](respondWithResult(_0x36c9c9,null))[_0xc57c('0x47')](handleError(_0x36c9c9,null));};exports['addConfiguration']=function(_0x5bb9e2,_0x155c22,_0x4e2e20){if(_0x5bb9e2[_0xc57c('0x4b')]['id']){delete _0x5bb9e2[_0xc57c('0x4b')]['id'];}return db[_0xc57c('0x2f')][_0xc57c('0x4e')]({'where':{'id':_0x5bb9e2['params']['id']}})[_0xc57c('0x28')](handleEntityNotFound(_0x155c22,null))[_0xc57c('0x28')](function(_0x48a497){if(_0x48a497){_0x5bb9e2[_0xc57c('0x4b')][_0xc57c('0x51')]=_0x48a497['id'];_0x5bb9e2[_0xc57c('0x4b')]['Subjects']=integrations[_0xc57c('0x52')](_0x5bb9e2['body'][_0xc57c('0x53')],_0x5bb9e2[_0xc57c('0x4b')][_0xc57c('0x54')]);_0x5bb9e2[_0xc57c('0x4b')][_0xc57c('0x55')]=integrations[_0xc57c('0x56')](_0x5bb9e2[_0xc57c('0x4b')]['channel'],_0x5bb9e2['body'][_0xc57c('0x54')]);return db[_0xc57c('0x57')]['create'](_0x5bb9e2[_0xc57c('0x4b')],{'include':[{'model':db[_0xc57c('0x58')],'as':_0xc57c('0x59')},{'model':db[_0xc57c('0x58')],'as':_0xc57c('0x55')}]});}return null;})[_0xc57c('0x28')](respondWithResult(_0x155c22,null))[_0xc57c('0x47')](handleError(_0x155c22,null));};exports[_0xc57c('0x5a')]=function(_0x228b5b,_0x323a3b,_0x4e6046){var _0x19eacd=[{'name':_0xc57c('0x5b'),'label':_0xc57c('0x5b'),'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 _0x29f6f7='';return db[_0xc57c('0x2f')][_0xc57c('0x4e')]({'where':{'id':_0x228b5b['params']['id']},'attributes':['id',_0xc57c('0x5c'),_0xc57c('0x5d'),'username',_0xc57c('0x5e'),'consumerKey',_0xc57c('0x5f'),'token','tokenSecret']})[_0xc57c('0x28')](handleEntityNotFound(_0x323a3b,null))['then'](function(_0x54c93a){if(_0x54c93a){_0x29f6f7=_0x54c93a[_0xc57c('0x5c')];var _0x205587=_0x29f6f7[_0xc57c('0x60')](-0x1);if(_0x205587==='/'){_0x29f6f7=_0x29f6f7['substring'](0x0,_0x29f6f7[_0xc57c('0x61')](_0x205587));}var _0x4a8987={'method':_0xc57c('0x62'),'uri':util[_0xc57c('0x63')](_0xc57c('0x64'),_0x29f6f7),'headers':{'Content-Type':_0xc57c('0x65'),'Accept':_0xc57c('0x65')},'json':!![]};if(_0x54c93a[_0xc57c('0x5d')]===_0xc57c('0x66')){_0x4a8987[_0xc57c('0x67')][_0xc57c('0x68')]=util[_0xc57c('0x63')](_0xc57c('0x69'),new Buffer(util[_0xc57c('0x63')]('%s:%s',_0x54c93a[_0xc57c('0x6a')],_0x54c93a['password']))[_0xc57c('0x6b')]('base64'));}return rp(_0x4a8987)[_0xc57c('0x28')](function(_0x3a9159){return _0x19eacd[_0xc57c('0x6c')](_[_0xc57c('0x33')](_0x3a9159[_0xc57c('0x6d')][_0xc57c('0x6e')],function(_0x24e944){return{'id':_0x24e944[_0xc57c('0x2c')],'name':_0x24e944[_0xc57c('0x2c')],'type':_0x24e944[_0xc57c('0x54')],'active':_0x24e944['active'],'label':_0x24e944[_0xc57c('0x6f')],'custom':!![]};}));});}})['then'](function(_0x5dabe1){return{'count':_0x5dabe1[_0xc57c('0x4f')],'rows':_0x5dabe1};})[_0xc57c('0x28')](respondWithResult(_0x323a3b,null))[_0xc57c('0x47')](function(_0x3dda2a){var _0x4ae846=_0x228b5b[_0xc57c('0x34')][_0xc57c('0x70')]?0x1f4:_0x3dda2a[_0xc57c('0x71')]||0x1f4;logger[_0xc57c('0x2a')](_0xc57c('0x72'),_0xc57c('0x5a'),_0x4ae846,JSON[_0xc57c('0x73')](_0x3dda2a));delete _0x3dda2a[_0xc57c('0x2c')];if(_0x4ae846===0x191){_0x4ae846=0x190;}_0x323a3b[_0xc57c('0x1d')](_0x4ae846)[_0xc57c('0x2d')](_0x228b5b[_0xc57c('0x34')][_0xc57c('0x70')]?{'message':_0xc57c('0x74'),'statusCode':_0x3dda2a[_0xc57c('0x71')]}:_0x3dda2a);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 6eedc46..8319ea8 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 _0x5402=['util','bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash'];(function(_0x5e3fdd,_0x4b07fa){var _0x514f25=function(_0xc5eb54){while(--_0xc5eb54){_0x5e3fdd['push'](_0x5e3fdd['shift']());}};_0x514f25(++_0x4b07fa);}(_0x5402,0x197));var _0x2540=function(_0x26c992,_0x47f906){_0x26c992=_0x26c992-0x0;var _0x41d3a2=_0x5402[_0x26c992];return _0x41d3a2;};'use strict';var _=require(_0x2540('0x0'));var util=require(_0x2540('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2540('0x2'));var rp=require(_0x2540('0x3'));var fs=require('fs');var path=require(_0x2540('0x4'));var rimraf=require('rimraf');var config=require(_0x2540('0x5'));var attributes=require(_0x2540('0x6'));var integrations=require(_0x2540('0x7'));module[_0x2540('0x8')]=function(_0x5591e2,_0x2d6fd3){return _0x5591e2[_0x2540('0x9')](_0x2540('0xa'),attributes,{'tableName':_0x2540('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebc6=['path','../../config/environment','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts','util','api','bluebird'];(function(_0x28c1c0,_0x2398aa){var _0x2ff1e3=function(_0x23dfb3){while(--_0x23dfb3){_0x28c1c0['push'](_0x28c1c0['shift']());}};_0x2ff1e3(++_0x2398aa);}(_0xebc6,0xe3));var _0x6ebc=function(_0xc98354,_0x3bf67b){_0xc98354=_0xc98354-0x0;var _0x424479=_0xebc6[_0xc98354];return _0x424479;};'use strict';var _=require('lodash');var util=require(_0x6ebc('0x0'));var logger=require('../../config/logger')(_0x6ebc('0x1'));var moment=require('moment');var BPromise=require(_0x6ebc('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ebc('0x3'));var rimraf=require('rimraf');var config=require(_0x6ebc('0x4'));var attributes=require(_0x6ebc('0x5'));var integrations=require('../../components/integrations/configuration');module[_0x6ebc('0x6')]=function(_0x2de576,_0x7e08a6){return _0x2de576[_0x6ebc('0x7')](_0x6ebc('0x8'),attributes,{'tableName':_0x6ebc('0x9'),'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 e187aa1..b5bb35b 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 _0xdd66=['DeskAccount','options','raw','where','attributes','limit','include','map','model','stringify','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetDeskAccount'];(function(_0xf6268a,_0x4d2a75){var _0x479dbd=function(_0x2a2b92){while(--_0x2a2b92){_0xf6268a['push'](_0xf6268a['shift']());}};_0x479dbd(++_0x4d2a75);}(_0xdd66,0x1da));var _0x6dd6=function(_0x18e376,_0x1a5079){_0x18e376=_0x18e376-0x0;var _0x151824=_0xdd66[_0x18e376];return _0x151824;};'use strict';var _=require(_0x6dd6('0x0'));var util=require(_0x6dd6('0x1'));var moment=require(_0x6dd6('0x2'));var BPromise=require(_0x6dd6('0x3'));var rs=require(_0x6dd6('0x4'));var fs=require('fs');var Redis=require(_0x6dd6('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6dd6('0x6'));var client=jayson[_0x6dd6('0x7')][_0x6dd6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30c22b,_0x1eb05c,_0x323223){return new BPromise(function(_0x28303e,_0x157780){return client['request'](_0x30c22b,_0x323223)[_0x6dd6('0x9')](function(_0x164a61){logger['info'](_0x6dd6('0xa'),_0x1eb05c,_0x6dd6('0xb'));logger[_0x6dd6('0xc')](_0x6dd6('0xd'),_0x1eb05c,_0x6dd6('0xb'),JSON['stringify'](_0x164a61));if(_0x164a61[_0x6dd6('0xe')]){if(_0x164a61[_0x6dd6('0xe')][_0x6dd6('0xf')]===0x1f4){logger[_0x6dd6('0xe')](_0x6dd6('0xa'),_0x1eb05c,_0x164a61['error'][_0x6dd6('0x10')]);return _0x157780(_0x164a61[_0x6dd6('0xe')][_0x6dd6('0x10')]);}logger[_0x6dd6('0xe')]('DeskAccount,\x20%s,\x20%s',_0x1eb05c,_0x164a61['error']['message']);return _0x28303e(_0x164a61[_0x6dd6('0xe')]['message']);}else{logger[_0x6dd6('0x11')](_0x6dd6('0xa'),_0x1eb05c,'request\x20sent');_0x28303e(_0x164a61[_0x6dd6('0x12')][_0x6dd6('0x10')]);}})[_0x6dd6('0x13')](function(_0x2960d8){logger['error'](_0x6dd6('0xa'),_0x1eb05c,_0x2960d8);_0x157780(_0x2960d8);});});}exports[_0x6dd6('0x14')]=function(_0x317b19){var _0x2ff4d4=this;return new Promise(function(_0x534060,_0x5520b6){return db[_0x6dd6('0x15')]['findAll']({'raw':_0x317b19[_0x6dd6('0x16')]?_0x317b19['options'][_0x6dd6('0x17')]===undefined?!![]:![]:!![],'where':_0x317b19[_0x6dd6('0x16')]?_0x317b19[_0x6dd6('0x16')][_0x6dd6('0x18')]||null:null,'attributes':_0x317b19[_0x6dd6('0x16')]?_0x317b19['options'][_0x6dd6('0x19')]||null:null,'limit':_0x317b19['options']?_0x317b19['options'][_0x6dd6('0x1a')]||null:null,'include':_0x317b19[_0x6dd6('0x16')]?_0x317b19[_0x6dd6('0x16')][_0x6dd6('0x1b')]?_[_0x6dd6('0x1c')](_0x317b19['options'][_0x6dd6('0x1b')],function(_0x8ea201){return{'model':db[_0x8ea201[_0x6dd6('0x1d')]],'as':_0x8ea201['as'],'attributes':_0x8ea201[_0x6dd6('0x19')],'include':_0x8ea201[_0x6dd6('0x1b')]?_['map'](_0x8ea201['include'],function(_0x27fe89){return{'model':db[_0x27fe89[_0x6dd6('0x1d')]],'as':_0x27fe89['as'],'attributes':_0x27fe89['attributes'],'include':_0x27fe89[_0x6dd6('0x1b')]?_['map'](_0x27fe89[_0x6dd6('0x1b')],function(_0x59b1cd){return{'model':db[_0x59b1cd[_0x6dd6('0x1d')]],'as':_0x59b1cd['as'],'attributes':_0x59b1cd[_0x6dd6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6dd6('0x9')](function(_0xcebbdf){logger[_0x6dd6('0x11')]('GetDeskAccount',_0x317b19);logger[_0x6dd6('0xc')](_0x6dd6('0x14'),_0x317b19,JSON[_0x6dd6('0x1e')](_0xcebbdf));_0x534060(_0xcebbdf);})[_0x6dd6('0x13')](function(_0x949e7a){logger['error'](_0x6dd6('0x14'),_0x949e7a['message'],_0x317b19);_0x5520b6(_0x2ff4d4[_0x6dd6('0xe')](0x1f4,_0x949e7a[_0x6dd6('0x10')]));});});};exports[_0x6dd6('0x1f')]=function(_0x39335c){var _0x1d1483=this;return new Promise(function(_0x30d5df,_0x467546){return db[_0x6dd6('0x15')][_0x6dd6('0x20')]({'raw':_0x39335c[_0x6dd6('0x16')]?_0x39335c['options'][_0x6dd6('0x17')]===undefined?!![]:![]:!![],'where':_0x39335c['options']?_0x39335c[_0x6dd6('0x16')][_0x6dd6('0x18')]||null:null,'attributes':_0x39335c[_0x6dd6('0x16')]?_0x39335c[_0x6dd6('0x16')][_0x6dd6('0x19')]||null:null,'include':_0x39335c[_0x6dd6('0x16')]?_0x39335c['options']['include']?_[_0x6dd6('0x1c')](_0x39335c[_0x6dd6('0x16')][_0x6dd6('0x1b')],function(_0x2e250a){return{'model':db[_0x2e250a[_0x6dd6('0x1d')]],'as':_0x2e250a['as'],'attributes':_0x2e250a['attributes'],'include':_0x2e250a[_0x6dd6('0x1b')]?_[_0x6dd6('0x1c')](_0x2e250a[_0x6dd6('0x1b')],function(_0x51901b){return{'model':db[_0x51901b['model']],'as':_0x51901b['as'],'attributes':_0x51901b[_0x6dd6('0x19')],'include':_0x51901b[_0x6dd6('0x1b')]?_[_0x6dd6('0x1c')](_0x51901b['include'],function(_0x261cc4){return{'model':db[_0x261cc4['model']],'as':_0x261cc4['as'],'attributes':_0x261cc4[_0x6dd6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6dd6('0x9')](function(_0xc10751){logger['info']('ShowDeskAccount',_0x39335c);logger[_0x6dd6('0xc')](_0x6dd6('0x1f'),_0x39335c,JSON[_0x6dd6('0x1e')](_0xc10751));_0x30d5df(_0xc10751);})[_0x6dd6('0x13')](function(_0x32266b){logger[_0x6dd6('0xe')](_0x6dd6('0x1f'),_0x32266b['message'],_0x39335c);_0x467546(_0x1d1483[_0x6dd6('0xe')](0x1f4,_0x32266b[_0x6dd6('0x10')]));});});}; \ No newline at end of file +var _0x8893=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','DeskAccount','options','raw','where','limit','include','attributes','map','model','GetDeskAccount','ShowDeskAccount','find','util','moment'];(function(_0x253c82,_0x37df37){var _0x3efa41=function(_0x1de993){while(--_0x1de993){_0x253c82['push'](_0x253c82['shift']());}};_0x3efa41(++_0x37df37);}(_0x8893,0x139));var _0x3889=function(_0x317f3c,_0x1e01ff){_0x317f3c=_0x317f3c-0x0;var _0x14b379=_0x8893[_0x317f3c];return _0x14b379;};'use strict';var _=require('lodash');var util=require(_0x3889('0x0'));var moment=require(_0x3889('0x1'));var BPromise=require('bluebird');var rs=require(_0x3889('0x2'));var fs=require('fs');var Redis=require(_0x3889('0x3'));var db=require(_0x3889('0x4'))['db'];var utils=require(_0x3889('0x5'));var logger=require(_0x3889('0x6'))(_0x3889('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3889('0x8')][_0x3889('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a59e6,_0x14a463,_0x305690){return new BPromise(function(_0xc67dda,_0x44f520){return client[_0x3889('0xa')](_0x4a59e6,_0x305690)[_0x3889('0xb')](function(_0x310102){logger[_0x3889('0xc')](_0x3889('0xd'),_0x14a463,_0x3889('0xe'));logger[_0x3889('0xf')](_0x3889('0x10'),_0x14a463,_0x3889('0xe'),JSON[_0x3889('0x11')](_0x310102));if(_0x310102['error']){if(_0x310102[_0x3889('0x12')][_0x3889('0x13')]===0x1f4){logger[_0x3889('0x12')](_0x3889('0xd'),_0x14a463,_0x310102[_0x3889('0x12')][_0x3889('0x14')]);return _0x44f520(_0x310102[_0x3889('0x12')][_0x3889('0x14')]);}logger[_0x3889('0x12')](_0x3889('0xd'),_0x14a463,_0x310102['error']['message']);return _0xc67dda(_0x310102[_0x3889('0x12')][_0x3889('0x14')]);}else{logger[_0x3889('0xc')](_0x3889('0xd'),_0x14a463,_0x3889('0xe'));_0xc67dda(_0x310102[_0x3889('0x15')][_0x3889('0x14')]);}})[_0x3889('0x16')](function(_0x5fbf2){logger['error'](_0x3889('0xd'),_0x14a463,_0x5fbf2);_0x44f520(_0x5fbf2);});});}exports['GetDeskAccount']=function(_0x1dd717){var _0x2ab0b0=this;return new Promise(function(_0x2446d1,_0x3cd81b){return db[_0x3889('0x17')]['findAll']({'raw':_0x1dd717[_0x3889('0x18')]?_0x1dd717['options'][_0x3889('0x19')]===undefined?!![]:![]:!![],'where':_0x1dd717['options']?_0x1dd717[_0x3889('0x18')][_0x3889('0x1a')]||null:null,'attributes':_0x1dd717[_0x3889('0x18')]?_0x1dd717[_0x3889('0x18')]['attributes']||null:null,'limit':_0x1dd717['options']?_0x1dd717[_0x3889('0x18')][_0x3889('0x1b')]||null:null,'include':_0x1dd717[_0x3889('0x18')]?_0x1dd717[_0x3889('0x18')][_0x3889('0x1c')]?_['map'](_0x1dd717['options'][_0x3889('0x1c')],function(_0x4eee39){return{'model':db[_0x4eee39['model']],'as':_0x4eee39['as'],'attributes':_0x4eee39[_0x3889('0x1d')],'include':_0x4eee39[_0x3889('0x1c')]?_['map'](_0x4eee39[_0x3889('0x1c')],function(_0x2cdfcf){return{'model':db[_0x2cdfcf['model']],'as':_0x2cdfcf['as'],'attributes':_0x2cdfcf[_0x3889('0x1d')],'include':_0x2cdfcf['include']?_[_0x3889('0x1e')](_0x2cdfcf[_0x3889('0x1c')],function(_0x117271){return{'model':db[_0x117271[_0x3889('0x1f')]],'as':_0x117271['as'],'attributes':_0x117271[_0x3889('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3889('0xb')](function(_0x57ee37){logger[_0x3889('0xc')](_0x3889('0x20'),_0x1dd717);logger[_0x3889('0xf')](_0x3889('0x20'),_0x1dd717,JSON[_0x3889('0x11')](_0x57ee37));_0x2446d1(_0x57ee37);})[_0x3889('0x16')](function(_0x573e88){logger['error'](_0x3889('0x20'),_0x573e88[_0x3889('0x14')],_0x1dd717);_0x3cd81b(_0x2ab0b0[_0x3889('0x12')](0x1f4,_0x573e88['message']));});});};exports[_0x3889('0x21')]=function(_0x4d1224){var _0x1611e4=this;return new Promise(function(_0x1b8055,_0x2946d3){return db[_0x3889('0x17')][_0x3889('0x22')]({'raw':_0x4d1224[_0x3889('0x18')]?_0x4d1224[_0x3889('0x18')][_0x3889('0x19')]===undefined?!![]:![]:!![],'where':_0x4d1224['options']?_0x4d1224[_0x3889('0x18')]['where']||null:null,'attributes':_0x4d1224[_0x3889('0x18')]?_0x4d1224[_0x3889('0x18')][_0x3889('0x1d')]||null:null,'include':_0x4d1224[_0x3889('0x18')]?_0x4d1224[_0x3889('0x18')][_0x3889('0x1c')]?_[_0x3889('0x1e')](_0x4d1224[_0x3889('0x18')][_0x3889('0x1c')],function(_0x1a5680){return{'model':db[_0x1a5680[_0x3889('0x1f')]],'as':_0x1a5680['as'],'attributes':_0x1a5680['attributes'],'include':_0x1a5680[_0x3889('0x1c')]?_[_0x3889('0x1e')](_0x1a5680[_0x3889('0x1c')],function(_0x328fda){return{'model':db[_0x328fda['model']],'as':_0x328fda['as'],'attributes':_0x328fda[_0x3889('0x1d')],'include':_0x328fda['include']?_[_0x3889('0x1e')](_0x328fda[_0x3889('0x1c')],function(_0x56c46c){return{'model':db[_0x56c46c[_0x3889('0x1f')]],'as':_0x56c46c['as'],'attributes':_0x56c46c[_0x3889('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5398b1){logger['info']('ShowDeskAccount',_0x4d1224);logger['debug']('ShowDeskAccount',_0x4d1224,JSON[_0x3889('0x11')](_0x5398b1));_0x1b8055(_0x5398b1);})['catch'](function(_0x186826){logger[_0x3889('0x12')](_0x3889('0x21'),_0x186826[_0x3889('0x14')],_0x4d1224);_0x2946d3(_0x1611e4[_0x3889('0x12')](0x1f4,_0x186826[_0x3889('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 5f0ecf9..f54dda5 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x439edc,_0x253f4e){var _0x3dfc42=function(_0xfff2c8){while(--_0xfff2c8){_0x439edc['push'](_0x439edc['shift']());}};_0x3dfc42(++_0x253f4e);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x38ff2b,_0x3a0316){var _0x341f5e=function(_0x346368){while(--_0x346368){_0x38ff2b['push'](_0x38ff2b['shift']());}};_0x341f5e(++_0x3a0316);}(_0x55ca,0x126));var _0xa55c=function(_0x3cc81e,_0x435f44){_0x3cc81e=_0x3cc81e-0x0;var _0x5b15e3=_0x55ca[_0x3cc81e];return _0x5b15e3;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 2befa4d..ff60a4b 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 _0x539d=['exports','STRING','sequelize'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x539d,0x8c));var _0xd539=function(_0x31abee,_0x11ff0c){_0x31abee=_0x31abee-0x0;var _0x3c1761=_0x539d[_0x31abee];return _0x3c1761;};'use strict';var Sequelize=require(_0xd539('0x0'));module[_0xd539('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd539('0x2')]}}; \ No newline at end of file +var _0x2f62=['STRING','sequelize','exports'];(function(_0xcb7b4e,_0x5ce687){var _0x3f40ea=function(_0x1146b6){while(--_0x1146b6){_0xcb7b4e['push'](_0xcb7b4e['shift']());}};_0x3f40ea(++_0x5ce687);}(_0x2f62,0x124));var _0x22f6=function(_0x12413c,_0x1f5b08){_0x12413c=_0x12413c-0x0;var _0x4c84db=_0x2f62[_0x12413c];return _0x4c84db;};'use strict';var Sequelize=require(_0x22f6('0x0'));module[_0x22f6('0x1')]={'name':{'type':Sequelize[_0x22f6('0x2')]},'description':{'type':Sequelize[_0x22f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 356bed2..6ae05d8 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 _0x52d7=['sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','length','find','body','catch','update','getFields','findOne','DeskField','pick','hasOwnProperty','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','request-promise','moment','util','path'];(function(_0x26fbfd,_0x47f2c1){var _0x508968=function(_0x44f9dd){while(--_0x44f9dd){_0x26fbfd['push'](_0x26fbfd['shift']());}};_0x508968(++_0x47f2c1);}(_0x52d7,0x1da));var _0x752d=function(_0x57eb2d,_0x5e4918){_0x57eb2d=_0x57eb2d-0x0;var _0xd8e18=_0x52d7[_0x57eb2d];return _0xd8e18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x752d('0x0'));var zipdir=require(_0x752d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x752d('0x2'));var moment=require(_0x752d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x752d('0x4'));var path=require(_0x752d('0x5'));var sox=require(_0x752d('0x6'));var csv=require('to-csv');var ejs=require(_0x752d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x752d('0x8'));var squel=require('squel');var crypto=require(_0x752d('0x9'));var jsforce=require(_0x752d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x752d('0xb'));var querystring=require(_0x752d('0xc'));var Papa=require(_0x752d('0xd'));var Redis=require(_0x752d('0xe'));var authService=require(_0x752d('0xf'));var qs=require(_0x752d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x752d('0x11'))('api');var utils=require(_0x752d('0x12'));var config=require(_0x752d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x752d('0x14'))['db'];function respondWithStatusCode(_0x3bd4dc,_0x31fe9a){_0x31fe9a=_0x31fe9a||0xcc;return function(_0x42dd1){if(_0x42dd1){return _0x3bd4dc[_0x752d('0x15')](_0x31fe9a);}return _0x3bd4dc[_0x752d('0x16')](_0x31fe9a)[_0x752d('0x17')]();};}function respondWithResult(_0x28821c,_0x44a67c){_0x44a67c=_0x44a67c||0xc8;return function(_0x41c15b){if(_0x41c15b){return _0x28821c['status'](_0x44a67c)[_0x752d('0x18')](_0x41c15b);}};}function respondWithFilteredResult(_0x5a610a,_0x33ef7a){return function(_0x450eef){if(_0x450eef){var _0x7bb2e2=typeof _0x33ef7a[_0x752d('0x19')]===_0x752d('0x1a')&&typeof _0x33ef7a['limit']==='undefined';var _0x4b2abd=_0x450eef[_0x752d('0x1b')];var _0x521f75=_0x7bb2e2?0x0:_0x33ef7a[_0x752d('0x19')];var _0x2da9dc=_0x7bb2e2?_0x450eef[_0x752d('0x1b')]:_0x33ef7a[_0x752d('0x19')]+_0x33ef7a[_0x752d('0x1c')];var _0x5d2d6c;if(_0x2da9dc>=_0x4b2abd){_0x2da9dc=_0x4b2abd;_0x5d2d6c=0xc8;}else{_0x5d2d6c=0xce;}_0x5a610a[_0x752d('0x16')](_0x5d2d6c);return _0x5a610a[_0x752d('0x1d')](_0x752d('0x1e'),_0x521f75+'-'+_0x2da9dc+'/'+_0x4b2abd)['json'](_0x450eef);}return null;};}function patchUpdates(_0x4fcfb5){return function(_0x13dc44){try{jsonpatch[_0x752d('0x1f')](_0x13dc44,_0x4fcfb5,!![]);}catch(_0x4a0b48){return BPromise[_0x752d('0x20')](_0x4a0b48);}return _0x13dc44[_0x752d('0x21')]();};}function saveUpdates(_0x8183e4,_0x171ae6){return function(_0x5c0a68){if(_0x5c0a68){return _0x5c0a68['update'](_0x8183e4)[_0x752d('0x22')](function(_0x379f33){return _0x379f33;});}return null;};}function removeEntity(_0x191d26,_0x124392){return function(_0x286883){if(_0x286883){return _0x286883['destroy']()['then'](function(){_0x191d26['status'](0xcc)[_0x752d('0x17')]();});}};}function handleEntityNotFound(_0x5c79b8,_0x7dadd2){return function(_0x12190d){if(!_0x12190d){_0x5c79b8['sendStatus'](0x194);}return _0x12190d;};}function handleError(_0x425bb3,_0x7b8f47){_0x7b8f47=_0x7b8f47||0x1f4;return function(_0x325c6d){logger[_0x752d('0x23')](_0x325c6d['stack']);if(_0x325c6d[_0x752d('0x24')]){delete _0x325c6d['name'];}_0x425bb3['status'](_0x7b8f47)['send'](_0x325c6d);};}exports[_0x752d('0x25')]=function(_0x5664e7,_0x3e58bc){var _0x21b7d9={},_0x5dcef3={},_0x43bae7={'count':0x0,'rows':[]};var _0x29e0d0=_[_0x752d('0x26')](db[_0x752d('0x27')][_0x752d('0x28')],function(_0x8e2498){return{'name':_0x8e2498[_0x752d('0x29')],'type':_0x8e2498[_0x752d('0x2a')][_0x752d('0x2b')]};});_0x5dcef3['model']=_['map'](_0x29e0d0,'name');_0x5dcef3[_0x752d('0x2c')]=_[_0x752d('0x2d')](_0x5664e7[_0x752d('0x2c')]);_0x5dcef3[_0x752d('0x2e')]=_[_0x752d('0x2f')](_0x5dcef3[_0x752d('0x30')],_0x5dcef3['query']);_0x21b7d9['attributes']=_[_0x752d('0x2f')](_0x5dcef3[_0x752d('0x30')],qs[_0x752d('0x31')](_0x5664e7[_0x752d('0x2c')][_0x752d('0x31')]));_0x21b7d9['attributes']=_0x21b7d9[_0x752d('0x32')]['length']?_0x21b7d9[_0x752d('0x32')]:_0x5dcef3[_0x752d('0x30')];if(!_0x5664e7['query']['hasOwnProperty']('nolimit')){_0x21b7d9[_0x752d('0x1c')]=qs['limit'](_0x5664e7[_0x752d('0x2c')]['limit']);_0x21b7d9[_0x752d('0x19')]=qs[_0x752d('0x19')](_0x5664e7[_0x752d('0x2c')][_0x752d('0x19')]);}_0x21b7d9[_0x752d('0x33')]=qs[_0x752d('0x34')](_0x5664e7[_0x752d('0x2c')]['sort']);_0x21b7d9[_0x752d('0x35')]=qs['filters'](_['pick'](_0x5664e7['query'],_0x5dcef3[_0x752d('0x2e')]),_0x29e0d0);if(_0x5664e7[_0x752d('0x2c')]['filter']){_0x21b7d9['where']=_[_0x752d('0x36')](_0x21b7d9[_0x752d('0x35')],{'$or':_['map'](_0x29e0d0,function(_0x30d50e){if(_0x30d50e[_0x752d('0x2a')]!==_0x752d('0x37')){var _0x2dab82={};_0x2dab82[_0x30d50e[_0x752d('0x24')]]={'$like':'%'+_0x5664e7[_0x752d('0x2c')][_0x752d('0x38')]+'%'};return _0x2dab82;}})});}_0x21b7d9=_[_0x752d('0x36')]({},_0x21b7d9,_0x5664e7[_0x752d('0x39')]);var _0x232121={'where':_0x21b7d9[_0x752d('0x35')]};return db['DeskConfiguration']['count'](_0x232121)[_0x752d('0x22')](function(_0x440727){_0x43bae7[_0x752d('0x1b')]=_0x440727;if(_0x5664e7[_0x752d('0x2c')][_0x752d('0x3a')]){_0x21b7d9[_0x752d('0x3b')]=[{'all':!![]}];}return db[_0x752d('0x27')][_0x752d('0x3c')](_0x21b7d9);})[_0x752d('0x22')](function(_0x2d8276){_0x43bae7[_0x752d('0x3d')]=_0x2d8276;return _0x43bae7;})[_0x752d('0x22')](respondWithFilteredResult(_0x3e58bc,_0x21b7d9))['catch'](handleError(_0x3e58bc,null));};exports['show']=function(_0x7a2b47,_0x32c07b){var _0x38fb20={'raw':![],'where':{'id':_0x7a2b47[_0x752d('0x3e')]['id']}},_0x1843cc={};_0x1843cc[_0x752d('0x30')]=_[_0x752d('0x2d')](db[_0x752d('0x27')][_0x752d('0x28')]);_0x1843cc[_0x752d('0x2c')]=_[_0x752d('0x2d')](_0x7a2b47[_0x752d('0x2c')]);_0x1843cc[_0x752d('0x2e')]=_[_0x752d('0x2f')](_0x1843cc['model'],_0x1843cc[_0x752d('0x2c')]);_0x38fb20[_0x752d('0x32')]=_[_0x752d('0x2f')](_0x1843cc[_0x752d('0x30')],qs['fields'](_0x7a2b47[_0x752d('0x2c')][_0x752d('0x31')]));_0x38fb20[_0x752d('0x32')]=_0x38fb20[_0x752d('0x32')][_0x752d('0x3f')]?_0x38fb20['attributes']:_0x1843cc[_0x752d('0x30')];if(_0x7a2b47[_0x752d('0x2c')][_0x752d('0x3a')]){_0x38fb20[_0x752d('0x3b')]=[{'all':!![]}];}_0x38fb20=_['merge']({},_0x38fb20,_0x7a2b47[_0x752d('0x39')]);return db['DeskConfiguration'][_0x752d('0x40')](_0x38fb20)[_0x752d('0x22')](handleEntityNotFound(_0x32c07b,null))[_0x752d('0x22')](respondWithResult(_0x32c07b,null))['catch'](handleError(_0x32c07b,null));};exports['create']=function(_0x1746ef,_0x400d09){return db[_0x752d('0x27')]['create'](_0x1746ef[_0x752d('0x41')],{})[_0x752d('0x22')](respondWithResult(_0x400d09,0xc9))[_0x752d('0x42')](handleError(_0x400d09,null));};exports[_0x752d('0x43')]=function(_0x4e3865,_0x15198a){if(_0x4e3865[_0x752d('0x41')]['id']){delete _0x4e3865['body']['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x4e3865[_0x752d('0x3e')]['id']}})[_0x752d('0x22')](handleEntityNotFound(_0x15198a,null))[_0x752d('0x22')](saveUpdates(_0x4e3865[_0x752d('0x41')],null))[_0x752d('0x22')](respondWithResult(_0x15198a,null))[_0x752d('0x42')](handleError(_0x15198a,null));};exports['destroy']=function(_0x2a93ac,_0x1a08a2){return db['DeskConfiguration'][_0x752d('0x40')]({'where':{'id':_0x2a93ac[_0x752d('0x3e')]['id']}})[_0x752d('0x22')](handleEntityNotFound(_0x1a08a2,null))['then'](removeEntity(_0x1a08a2,null))['catch'](handleError(_0x1a08a2,null));};exports[_0x752d('0x44')]=function(_0x578234,_0x383a9f,_0x11faf0){var _0x4b5da5={};var _0x46ebf7={};var _0x4762d9;var _0x3b80fa;return db[_0x752d('0x27')][_0x752d('0x45')]({'where':{'id':_0x578234[_0x752d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x383a9f,null))[_0x752d('0x22')](function(_0x4bc2c1){if(_0x4bc2c1){_0x4762d9=_0x4bc2c1;_0x46ebf7[_0x752d('0x30')]=_['keys'](db[_0x752d('0x46')][_0x752d('0x28')]);_0x46ebf7['query']=_[_0x752d('0x2d')](_0x578234[_0x752d('0x2c')]);_0x46ebf7[_0x752d('0x2e')]=_[_0x752d('0x2f')](_0x46ebf7[_0x752d('0x30')],_0x46ebf7[_0x752d('0x2c')]);_0x4b5da5[_0x752d('0x32')]=_[_0x752d('0x2f')](_0x46ebf7[_0x752d('0x30')],qs[_0x752d('0x31')](_0x578234[_0x752d('0x2c')]['fields']));_0x4b5da5[_0x752d('0x32')]=_0x4b5da5[_0x752d('0x32')]['length']?_0x4b5da5[_0x752d('0x32')]:_0x46ebf7['model'];_0x4b5da5[_0x752d('0x33')]=qs[_0x752d('0x34')](_0x578234[_0x752d('0x2c')][_0x752d('0x34')]);_0x4b5da5['where']=qs[_0x752d('0x2e')](_[_0x752d('0x47')](_0x578234[_0x752d('0x2c')],_0x46ebf7[_0x752d('0x2e')]));if(_0x578234[_0x752d('0x2c')]['filter']){_0x4b5da5[_0x752d('0x35')]=_[_0x752d('0x36')](_0x4b5da5[_0x752d('0x35')],{'$or':_[_0x752d('0x26')](_0x4b5da5[_0x752d('0x32')],function(_0x6c6f51){var _0x4dd129={};_0x4dd129[_0x6c6f51]={'$like':'%'+_0x578234['query']['filter']+'%'};return _0x4dd129;})});}_0x4b5da5=_['merge']({},_0x4b5da5,_0x578234['options']);return _0x4762d9[_0x752d('0x44')](_0x4b5da5);}})['then'](function(_0x512bf7){if(_0x512bf7){_0x3b80fa=_0x512bf7['length'];if(!_0x578234['query'][_0x752d('0x48')](_0x752d('0x49'))){_0x4b5da5[_0x752d('0x1c')]=qs[_0x752d('0x1c')](_0x578234[_0x752d('0x2c')][_0x752d('0x1c')]);_0x4b5da5[_0x752d('0x19')]=qs[_0x752d('0x19')](_0x578234['query'][_0x752d('0x19')]);}return _0x4762d9[_0x752d('0x44')](_0x4b5da5);}})[_0x752d('0x22')](function(_0x25fd34){if(_0x25fd34){return _0x25fd34?{'count':_0x3b80fa,'rows':_0x25fd34}:null;}})[_0x752d('0x22')](respondWithResult(_0x383a9f,null))[_0x752d('0x42')](handleError(_0x383a9f,null));};exports[_0x752d('0x4a')]=function(_0x80fcec,_0x24e1b5,_0x4c0a85){var _0x7d5061={};var _0x4aaf90={};var _0x58c5cc;var _0x3bd94f;return db[_0x752d('0x27')][_0x752d('0x45')]({'where':{'id':_0x80fcec['params']['id']}})[_0x752d('0x22')](handleEntityNotFound(_0x24e1b5,null))[_0x752d('0x22')](function(_0x4b73a5){if(_0x4b73a5){_0x58c5cc=_0x4b73a5;_0x4aaf90['model']=_['keys'](db[_0x752d('0x46')][_0x752d('0x28')]);_0x4aaf90[_0x752d('0x2c')]=_[_0x752d('0x2d')](_0x80fcec[_0x752d('0x2c')]);_0x4aaf90['filters']=_[_0x752d('0x2f')](_0x4aaf90[_0x752d('0x30')],_0x4aaf90['query']);_0x7d5061[_0x752d('0x32')]=_[_0x752d('0x2f')](_0x4aaf90[_0x752d('0x30')],qs[_0x752d('0x31')](_0x80fcec['query'][_0x752d('0x31')]));_0x7d5061[_0x752d('0x32')]=_0x7d5061[_0x752d('0x32')][_0x752d('0x3f')]?_0x7d5061[_0x752d('0x32')]:_0x4aaf90[_0x752d('0x30')];_0x7d5061[_0x752d('0x33')]=qs[_0x752d('0x34')](_0x80fcec[_0x752d('0x2c')][_0x752d('0x34')]);_0x7d5061[_0x752d('0x35')]=qs[_0x752d('0x2e')](_[_0x752d('0x47')](_0x80fcec[_0x752d('0x2c')],_0x4aaf90[_0x752d('0x2e')]));if(_0x80fcec['query'][_0x752d('0x38')]){_0x7d5061[_0x752d('0x35')]=_[_0x752d('0x36')](_0x7d5061[_0x752d('0x35')],{'$or':_['map'](_0x7d5061[_0x752d('0x32')],function(_0x28e7ea){var _0xd06b87={};_0xd06b87[_0x28e7ea]={'$like':'%'+_0x80fcec[_0x752d('0x2c')][_0x752d('0x38')]+'%'};return _0xd06b87;})});}_0x7d5061=_['merge']({},_0x7d5061,_0x80fcec[_0x752d('0x39')]);return _0x58c5cc['getSubjects'](_0x7d5061);}})[_0x752d('0x22')](function(_0x54909f){if(_0x54909f){_0x3bd94f=_0x54909f[_0x752d('0x3f')];if(!_0x80fcec[_0x752d('0x2c')][_0x752d('0x48')]('nolimit')){_0x7d5061[_0x752d('0x1c')]=qs['limit'](_0x80fcec[_0x752d('0x2c')][_0x752d('0x1c')]);_0x7d5061[_0x752d('0x19')]=qs[_0x752d('0x19')](_0x80fcec['query'][_0x752d('0x19')]);}return _0x58c5cc[_0x752d('0x4a')](_0x7d5061);}})[_0x752d('0x22')](function(_0xdb7203){if(_0xdb7203){return _0xdb7203?{'count':_0x3bd94f,'rows':_0xdb7203}:null;}})[_0x752d('0x22')](respondWithResult(_0x24e1b5,null))[_0x752d('0x42')](handleError(_0x24e1b5,null));};exports[_0x752d('0x4b')]=function(_0x4a8e7e,_0x3664e4,_0x2d47d9){var _0x1677b6={};var _0x2f5f9c={};var _0x333ff9;var _0x175125;return db[_0x752d('0x27')][_0x752d('0x45')]({'where':{'id':_0x4a8e7e[_0x752d('0x3e')]['id']}})[_0x752d('0x22')](handleEntityNotFound(_0x3664e4,null))[_0x752d('0x22')](function(_0x363070){if(_0x363070){_0x333ff9=_0x363070;_0x2f5f9c[_0x752d('0x30')]=_['keys'](db['DeskField'][_0x752d('0x28')]);_0x2f5f9c['query']=_['keys'](_0x4a8e7e['query']);_0x2f5f9c[_0x752d('0x2e')]=_[_0x752d('0x2f')](_0x2f5f9c[_0x752d('0x30')],_0x2f5f9c['query']);_0x1677b6[_0x752d('0x32')]=_[_0x752d('0x2f')](_0x2f5f9c[_0x752d('0x30')],qs[_0x752d('0x31')](_0x4a8e7e[_0x752d('0x2c')][_0x752d('0x31')]));_0x1677b6['attributes']=_0x1677b6[_0x752d('0x32')][_0x752d('0x3f')]?_0x1677b6[_0x752d('0x32')]:_0x2f5f9c[_0x752d('0x30')];_0x1677b6[_0x752d('0x33')]=qs[_0x752d('0x34')](_0x4a8e7e[_0x752d('0x2c')][_0x752d('0x34')]);_0x1677b6[_0x752d('0x35')]=qs[_0x752d('0x2e')](_[_0x752d('0x47')](_0x4a8e7e['query'],_0x2f5f9c[_0x752d('0x2e')]));if(_0x4a8e7e[_0x752d('0x2c')][_0x752d('0x38')]){_0x1677b6[_0x752d('0x35')]=_[_0x752d('0x36')](_0x1677b6[_0x752d('0x35')],{'$or':_['map'](_0x1677b6[_0x752d('0x32')],function(_0x45cecb){var _0x3cf380={};_0x3cf380[_0x45cecb]={'$like':'%'+_0x4a8e7e[_0x752d('0x2c')][_0x752d('0x38')]+'%'};return _0x3cf380;})});}_0x1677b6=_['merge']({},_0x1677b6,_0x4a8e7e[_0x752d('0x39')]);return _0x333ff9['getDescriptions'](_0x1677b6);}})[_0x752d('0x22')](function(_0x534713){if(_0x534713){_0x175125=_0x534713['length'];if(!_0x4a8e7e[_0x752d('0x2c')][_0x752d('0x48')](_0x752d('0x49'))){_0x1677b6[_0x752d('0x1c')]=qs[_0x752d('0x1c')](_0x4a8e7e[_0x752d('0x2c')][_0x752d('0x1c')]);_0x1677b6[_0x752d('0x19')]=qs['offset'](_0x4a8e7e[_0x752d('0x2c')]['offset']);}return _0x333ff9['getDescriptions'](_0x1677b6);}})['then'](function(_0x11858d){if(_0x11858d){return _0x11858d?{'count':_0x175125,'rows':_0x11858d}:null;}})[_0x752d('0x22')](respondWithResult(_0x3664e4,null))[_0x752d('0x42')](handleError(_0x3664e4,null));};exports[_0x752d('0x4c')]=function(_0x467780,_0x31bf1f,_0x33d91b){var _0x32802c={};var _0x29fb67={};var _0xa6ba70;var _0x44901c;return db[_0x752d('0x27')]['findOne']({'where':{'id':_0x467780[_0x752d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x31bf1f,null))[_0x752d('0x22')](function(_0xdf4cf0){if(_0xdf4cf0){_0xa6ba70=_0xdf4cf0;_0x29fb67[_0x752d('0x30')]=_[_0x752d('0x2d')](db[_0x752d('0x4d')]['rawAttributes']);_0x29fb67[_0x752d('0x2c')]=_[_0x752d('0x2d')](_0x467780[_0x752d('0x2c')]);_0x29fb67[_0x752d('0x2e')]=_[_0x752d('0x2f')](_0x29fb67['model'],_0x29fb67['query']);_0x32802c[_0x752d('0x32')]=_[_0x752d('0x2f')](_0x29fb67[_0x752d('0x30')],qs[_0x752d('0x31')](_0x467780[_0x752d('0x2c')][_0x752d('0x31')]));_0x32802c[_0x752d('0x32')]=_0x32802c[_0x752d('0x32')][_0x752d('0x3f')]?_0x32802c['attributes']:_0x29fb67[_0x752d('0x30')];_0x32802c[_0x752d('0x33')]=qs['sort'](_0x467780[_0x752d('0x2c')][_0x752d('0x34')]);_0x32802c['where']=qs['filters'](_['pick'](_0x467780['query'],_0x29fb67['filters']));if(_0x467780['query'][_0x752d('0x38')]){_0x32802c[_0x752d('0x35')]=_[_0x752d('0x36')](_0x32802c[_0x752d('0x35')],{'$or':_[_0x752d('0x26')](_0x32802c[_0x752d('0x32')],function(_0x432d57){var _0xbfa426={};_0xbfa426[_0x432d57]={'$like':'%'+_0x467780['query'][_0x752d('0x38')]+'%'};return _0xbfa426;})});}_0x32802c=_[_0x752d('0x36')]({},_0x32802c,_0x467780[_0x752d('0x39')]);return _0xa6ba70[_0x752d('0x4c')](_0x32802c);}})[_0x752d('0x22')](function(_0x753c0){if(_0x753c0){_0x44901c=_0x753c0[_0x752d('0x3f')];if(!_0x467780['query']['hasOwnProperty']('nolimit')){_0x32802c[_0x752d('0x1c')]=qs[_0x752d('0x1c')](_0x467780[_0x752d('0x2c')][_0x752d('0x1c')]);_0x32802c[_0x752d('0x19')]=qs['offset'](_0x467780[_0x752d('0x2c')][_0x752d('0x19')]);}return _0xa6ba70[_0x752d('0x4c')](_0x32802c);}})[_0x752d('0x22')](function(_0x2adf07){if(_0x2adf07){return _0x2adf07?{'count':_0x44901c,'rows':_0x2adf07}:null;}})[_0x752d('0x22')](respondWithResult(_0x31bf1f,null))[_0x752d('0x42')](handleError(_0x31bf1f,null));};exports[_0x752d('0x4e')]=function(_0x55d5f0,_0x195de0,_0x3fdad0){if(_0x55d5f0[_0x752d('0x41')]['id']){delete _0x55d5f0[_0x752d('0x41')]['id'];}return db[_0x752d('0x27')][_0x752d('0x45')]({'where':{'id':_0x55d5f0[_0x752d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x195de0,null))[_0x752d('0x22')](function(_0x3fc2bb){if(_0x3fc2bb){return _0x3fc2bb['setTags'](_0x55d5f0[_0x752d('0x41')][_0x752d('0x4f')]||[]);}return null;})[_0x752d('0x22')](respondWithResult(_0x195de0,null))[_0x752d('0x42')](handleError(_0x195de0,null));}; \ No newline at end of file +var _0x85ca=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','then','include','rows','catch','show','params','find','create','body','getFields','findOne','DeskField','filter','getSubjects','getDescriptions','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra'];(function(_0x300519,_0x2bc37a){var _0xb389a3=function(_0x517c43){while(--_0x517c43){_0x300519['push'](_0x300519['shift']());}};_0xb389a3(++_0x2bc37a);}(_0x85ca,0xa0));var _0xa85c=function(_0x4f50cf,_0x287534){_0x4f50cf=_0x4f50cf-0x0;var _0x5b238c=_0x85ca[_0x4f50cf];return _0x5b238c;};'use strict';var emlformat=require(_0xa85c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa85c('0x1'));var jsonpatch=require(_0xa85c('0x2'));var rp=require(_0xa85c('0x3'));var moment=require(_0xa85c('0x4'));var BPromise=require(_0xa85c('0x5'));var Mustache=require(_0xa85c('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa85c('0x7'));var ejs=require(_0xa85c('0x8'));var fs=require('fs');var fs_extra=require(_0xa85c('0x9'));var _=require(_0xa85c('0xa'));var squel=require(_0xa85c('0xb'));var crypto=require(_0xa85c('0xc'));var jsforce=require(_0xa85c('0xd'));var deskjs=require(_0xa85c('0xe'));var toCsv=require(_0xa85c('0x7'));var querystring=require(_0xa85c('0xf'));var Papa=require(_0xa85c('0x10'));var Redis=require(_0xa85c('0x11'));var authService=require(_0xa85c('0x12'));var qs=require(_0xa85c('0x13'));var as=require(_0xa85c('0x14'));var hardwareService=require(_0xa85c('0x15'));var logger=require(_0xa85c('0x16'))(_0xa85c('0x17'));var utils=require(_0xa85c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa85c('0x19'));var db=require(_0xa85c('0x1a'))['db'];function respondWithStatusCode(_0x45cc12,_0x4e5e0d){_0x4e5e0d=_0x4e5e0d||0xcc;return function(_0x3df5e5){if(_0x3df5e5){return _0x45cc12[_0xa85c('0x1b')](_0x4e5e0d);}return _0x45cc12[_0xa85c('0x1c')](_0x4e5e0d)[_0xa85c('0x1d')]();};}function respondWithResult(_0x3aa20e,_0xffc568){_0xffc568=_0xffc568||0xc8;return function(_0x96f8cd){if(_0x96f8cd){return _0x3aa20e[_0xa85c('0x1c')](_0xffc568)['json'](_0x96f8cd);}};}function respondWithFilteredResult(_0xbaa7e4,_0xec6ae3){return function(_0x571c51){if(_0x571c51){var _0x3fdba0=typeof _0xec6ae3[_0xa85c('0x1e')]==='undefined'&&typeof _0xec6ae3['limit']==='undefined';var _0xb9f82b=_0x571c51[_0xa85c('0x1f')];var _0x507142=_0x3fdba0?0x0:_0xec6ae3[_0xa85c('0x1e')];var _0x4e6619=_0x3fdba0?_0x571c51[_0xa85c('0x1f')]:_0xec6ae3[_0xa85c('0x1e')]+_0xec6ae3[_0xa85c('0x20')];var _0x2765e7;if(_0x4e6619>=_0xb9f82b){_0x4e6619=_0xb9f82b;_0x2765e7=0xc8;}else{_0x2765e7=0xce;}_0xbaa7e4[_0xa85c('0x1c')](_0x2765e7);return _0xbaa7e4[_0xa85c('0x21')](_0xa85c('0x22'),_0x507142+'-'+_0x4e6619+'/'+_0xb9f82b)['json'](_0x571c51);}return null;};}function patchUpdates(_0x3c92e7){return function(_0x48e6d5){try{jsonpatch[_0xa85c('0x23')](_0x48e6d5,_0x3c92e7,!![]);}catch(_0x229614){return BPromise[_0xa85c('0x24')](_0x229614);}return _0x48e6d5[_0xa85c('0x25')]();};}function saveUpdates(_0x208bc8,_0x320d83){return function(_0x647747){if(_0x647747){return _0x647747[_0xa85c('0x26')](_0x208bc8)['then'](function(_0x26c1c5){return _0x26c1c5;});}return null;};}function removeEntity(_0x5db5cd,_0x5b8dd5){return function(_0x576c14){if(_0x576c14){return _0x576c14[_0xa85c('0x27')]()['then'](function(){_0x5db5cd[_0xa85c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d2306,_0x234962){return function(_0x5abe4c){if(!_0x5abe4c){_0x4d2306['sendStatus'](0x194);}return _0x5abe4c;};}function handleError(_0xc938a2,_0x568a34){_0x568a34=_0x568a34||0x1f4;return function(_0x4164a6){logger[_0xa85c('0x28')](_0x4164a6[_0xa85c('0x29')]);if(_0x4164a6['name']){delete _0x4164a6[_0xa85c('0x2a')];}_0xc938a2[_0xa85c('0x1c')](_0x568a34)[_0xa85c('0x2b')](_0x4164a6);};}exports[_0xa85c('0x2c')]=function(_0x31fbc5,_0x48fa28){var _0x39de93={},_0x11cb78={},_0x1e8048={'count':0x0,'rows':[]};var _0x375ef9=_['map'](db[_0xa85c('0x2d')][_0xa85c('0x2e')],function(_0x124511){return{'name':_0x124511[_0xa85c('0x2f')],'type':_0x124511[_0xa85c('0x30')][_0xa85c('0x31')]};});_0x11cb78[_0xa85c('0x32')]=_[_0xa85c('0x33')](_0x375ef9,_0xa85c('0x2a'));_0x11cb78[_0xa85c('0x34')]=_[_0xa85c('0x35')](_0x31fbc5[_0xa85c('0x34')]);_0x11cb78[_0xa85c('0x36')]=_[_0xa85c('0x37')](_0x11cb78[_0xa85c('0x32')],_0x11cb78[_0xa85c('0x34')]);_0x39de93['attributes']=_['intersection'](_0x11cb78[_0xa85c('0x32')],qs['fields'](_0x31fbc5[_0xa85c('0x34')][_0xa85c('0x38')]));_0x39de93[_0xa85c('0x39')]=_0x39de93[_0xa85c('0x39')][_0xa85c('0x3a')]?_0x39de93['attributes']:_0x11cb78['model'];if(!_0x31fbc5[_0xa85c('0x34')][_0xa85c('0x3b')](_0xa85c('0x3c'))){_0x39de93['limit']=qs[_0xa85c('0x20')](_0x31fbc5[_0xa85c('0x34')]['limit']);_0x39de93[_0xa85c('0x1e')]=qs[_0xa85c('0x1e')](_0x31fbc5[_0xa85c('0x34')]['offset']);}_0x39de93[_0xa85c('0x3d')]=qs[_0xa85c('0x3e')](_0x31fbc5[_0xa85c('0x34')]['sort']);_0x39de93[_0xa85c('0x3f')]=qs['filters'](_[_0xa85c('0x40')](_0x31fbc5[_0xa85c('0x34')],_0x11cb78[_0xa85c('0x36')]),_0x375ef9);if(_0x31fbc5['query']['filter']){_0x39de93[_0xa85c('0x3f')]=_[_0xa85c('0x41')](_0x39de93[_0xa85c('0x3f')],{'$or':_[_0xa85c('0x33')](_0x375ef9,function(_0x308ecb){if(_0x308ecb[_0xa85c('0x30')]!==_0xa85c('0x42')){var _0x586190={};_0x586190[_0x308ecb[_0xa85c('0x2a')]]={'$like':'%'+_0x31fbc5[_0xa85c('0x34')]['filter']+'%'};return _0x586190;}})});}_0x39de93=_[_0xa85c('0x41')]({},_0x39de93,_0x31fbc5[_0xa85c('0x43')]);var _0x2a9d0c={'where':_0x39de93[_0xa85c('0x3f')]};return db[_0xa85c('0x2d')][_0xa85c('0x1f')](_0x2a9d0c)[_0xa85c('0x44')](function(_0x99574c){_0x1e8048[_0xa85c('0x1f')]=_0x99574c;if(_0x31fbc5['query']['includeAll']){_0x39de93[_0xa85c('0x45')]=[{'all':!![]}];}return db[_0xa85c('0x2d')]['findAll'](_0x39de93);})[_0xa85c('0x44')](function(_0x4a2ae8){_0x1e8048[_0xa85c('0x46')]=_0x4a2ae8;return _0x1e8048;})[_0xa85c('0x44')](respondWithFilteredResult(_0x48fa28,_0x39de93))[_0xa85c('0x47')](handleError(_0x48fa28,null));};exports[_0xa85c('0x48')]=function(_0x1dded3,_0x35c32f){var _0xe89517={'raw':![],'where':{'id':_0x1dded3[_0xa85c('0x49')]['id']}},_0x44812c={};_0x44812c[_0xa85c('0x32')]=_['keys'](db['DeskConfiguration'][_0xa85c('0x2e')]);_0x44812c[_0xa85c('0x34')]=_['keys'](_0x1dded3['query']);_0x44812c[_0xa85c('0x36')]=_['intersection'](_0x44812c['model'],_0x44812c[_0xa85c('0x34')]);_0xe89517['attributes']=_['intersection'](_0x44812c[_0xa85c('0x32')],qs[_0xa85c('0x38')](_0x1dded3[_0xa85c('0x34')][_0xa85c('0x38')]));_0xe89517[_0xa85c('0x39')]=_0xe89517[_0xa85c('0x39')]['length']?_0xe89517[_0xa85c('0x39')]:_0x44812c['model'];if(_0x1dded3[_0xa85c('0x34')]['includeAll']){_0xe89517[_0xa85c('0x45')]=[{'all':!![]}];}_0xe89517=_['merge']({},_0xe89517,_0x1dded3['options']);return db[_0xa85c('0x2d')][_0xa85c('0x4a')](_0xe89517)[_0xa85c('0x44')](handleEntityNotFound(_0x35c32f,null))[_0xa85c('0x44')](respondWithResult(_0x35c32f,null))[_0xa85c('0x47')](handleError(_0x35c32f,null));};exports[_0xa85c('0x4b')]=function(_0x44d516,_0x31f56a){return db[_0xa85c('0x2d')]['create'](_0x44d516[_0xa85c('0x4c')],{})[_0xa85c('0x44')](respondWithResult(_0x31f56a,0xc9))[_0xa85c('0x47')](handleError(_0x31f56a,null));};exports[_0xa85c('0x26')]=function(_0x1cc9d0,_0x32a81e){if(_0x1cc9d0['body']['id']){delete _0x1cc9d0[_0xa85c('0x4c')]['id'];}return db[_0xa85c('0x2d')][_0xa85c('0x4a')]({'where':{'id':_0x1cc9d0[_0xa85c('0x49')]['id']}})['then'](handleEntityNotFound(_0x32a81e,null))[_0xa85c('0x44')](saveUpdates(_0x1cc9d0[_0xa85c('0x4c')],null))[_0xa85c('0x44')](respondWithResult(_0x32a81e,null))[_0xa85c('0x47')](handleError(_0x32a81e,null));};exports[_0xa85c('0x27')]=function(_0x1e29c6,_0x54f1b2){return db[_0xa85c('0x2d')][_0xa85c('0x4a')]({'where':{'id':_0x1e29c6['params']['id']}})[_0xa85c('0x44')](handleEntityNotFound(_0x54f1b2,null))['then'](removeEntity(_0x54f1b2,null))['catch'](handleError(_0x54f1b2,null));};exports[_0xa85c('0x4d')]=function(_0x58f8c6,_0x1bec5e,_0x37324c){var _0x29b68c={};var _0x222925={};var _0xefa420;var _0x2a630f;return db[_0xa85c('0x2d')][_0xa85c('0x4e')]({'where':{'id':_0x58f8c6[_0xa85c('0x49')]['id']}})[_0xa85c('0x44')](handleEntityNotFound(_0x1bec5e,null))[_0xa85c('0x44')](function(_0xcbfb06){if(_0xcbfb06){_0xefa420=_0xcbfb06;_0x222925[_0xa85c('0x32')]=_[_0xa85c('0x35')](db[_0xa85c('0x4f')][_0xa85c('0x2e')]);_0x222925['query']=_[_0xa85c('0x35')](_0x58f8c6[_0xa85c('0x34')]);_0x222925[_0xa85c('0x36')]=_['intersection'](_0x222925['model'],_0x222925[_0xa85c('0x34')]);_0x29b68c[_0xa85c('0x39')]=_[_0xa85c('0x37')](_0x222925['model'],qs['fields'](_0x58f8c6[_0xa85c('0x34')]['fields']));_0x29b68c[_0xa85c('0x39')]=_0x29b68c[_0xa85c('0x39')][_0xa85c('0x3a')]?_0x29b68c[_0xa85c('0x39')]:_0x222925[_0xa85c('0x32')];_0x29b68c[_0xa85c('0x3d')]=qs['sort'](_0x58f8c6[_0xa85c('0x34')]['sort']);_0x29b68c[_0xa85c('0x3f')]=qs[_0xa85c('0x36')](_[_0xa85c('0x40')](_0x58f8c6[_0xa85c('0x34')],_0x222925[_0xa85c('0x36')]));if(_0x58f8c6[_0xa85c('0x34')][_0xa85c('0x50')]){_0x29b68c[_0xa85c('0x3f')]=_[_0xa85c('0x41')](_0x29b68c['where'],{'$or':_[_0xa85c('0x33')](_0x29b68c[_0xa85c('0x39')],function(_0x466027){var _0x3adda8={};_0x3adda8[_0x466027]={'$like':'%'+_0x58f8c6[_0xa85c('0x34')]['filter']+'%'};return _0x3adda8;})});}_0x29b68c=_['merge']({},_0x29b68c,_0x58f8c6[_0xa85c('0x43')]);return _0xefa420['getFields'](_0x29b68c);}})[_0xa85c('0x44')](function(_0x345bdc){if(_0x345bdc){_0x2a630f=_0x345bdc[_0xa85c('0x3a')];if(!_0x58f8c6[_0xa85c('0x34')][_0xa85c('0x3b')]('nolimit')){_0x29b68c[_0xa85c('0x20')]=qs[_0xa85c('0x20')](_0x58f8c6['query'][_0xa85c('0x20')]);_0x29b68c[_0xa85c('0x1e')]=qs[_0xa85c('0x1e')](_0x58f8c6[_0xa85c('0x34')][_0xa85c('0x1e')]);}return _0xefa420[_0xa85c('0x4d')](_0x29b68c);}})[_0xa85c('0x44')](function(_0x1f021f){if(_0x1f021f){return _0x1f021f?{'count':_0x2a630f,'rows':_0x1f021f}:null;}})[_0xa85c('0x44')](respondWithResult(_0x1bec5e,null))[_0xa85c('0x47')](handleError(_0x1bec5e,null));};exports[_0xa85c('0x51')]=function(_0x5830b5,_0x4970dc,_0x3682e6){var _0x51faba={};var _0x4b504f={};var _0x390075;var _0x5883fb;return db[_0xa85c('0x2d')][_0xa85c('0x4e')]({'where':{'id':_0x5830b5['params']['id']}})[_0xa85c('0x44')](handleEntityNotFound(_0x4970dc,null))['then'](function(_0x35f496){if(_0x35f496){_0x390075=_0x35f496;_0x4b504f[_0xa85c('0x32')]=_[_0xa85c('0x35')](db[_0xa85c('0x4f')][_0xa85c('0x2e')]);_0x4b504f['query']=_[_0xa85c('0x35')](_0x5830b5['query']);_0x4b504f[_0xa85c('0x36')]=_[_0xa85c('0x37')](_0x4b504f[_0xa85c('0x32')],_0x4b504f['query']);_0x51faba[_0xa85c('0x39')]=_['intersection'](_0x4b504f['model'],qs[_0xa85c('0x38')](_0x5830b5[_0xa85c('0x34')][_0xa85c('0x38')]));_0x51faba[_0xa85c('0x39')]=_0x51faba[_0xa85c('0x39')][_0xa85c('0x3a')]?_0x51faba[_0xa85c('0x39')]:_0x4b504f[_0xa85c('0x32')];_0x51faba[_0xa85c('0x3d')]=qs[_0xa85c('0x3e')](_0x5830b5[_0xa85c('0x34')][_0xa85c('0x3e')]);_0x51faba[_0xa85c('0x3f')]=qs[_0xa85c('0x36')](_[_0xa85c('0x40')](_0x5830b5[_0xa85c('0x34')],_0x4b504f['filters']));if(_0x5830b5[_0xa85c('0x34')]['filter']){_0x51faba[_0xa85c('0x3f')]=_[_0xa85c('0x41')](_0x51faba[_0xa85c('0x3f')],{'$or':_[_0xa85c('0x33')](_0x51faba[_0xa85c('0x39')],function(_0x479967){var _0x251ed0={};_0x251ed0[_0x479967]={'$like':'%'+_0x5830b5[_0xa85c('0x34')][_0xa85c('0x50')]+'%'};return _0x251ed0;})});}_0x51faba=_[_0xa85c('0x41')]({},_0x51faba,_0x5830b5['options']);return _0x390075['getSubjects'](_0x51faba);}})[_0xa85c('0x44')](function(_0x51aa43){if(_0x51aa43){_0x5883fb=_0x51aa43[_0xa85c('0x3a')];if(!_0x5830b5[_0xa85c('0x34')]['hasOwnProperty']('nolimit')){_0x51faba['limit']=qs[_0xa85c('0x20')](_0x5830b5['query'][_0xa85c('0x20')]);_0x51faba[_0xa85c('0x1e')]=qs[_0xa85c('0x1e')](_0x5830b5[_0xa85c('0x34')]['offset']);}return _0x390075['getSubjects'](_0x51faba);}})[_0xa85c('0x44')](function(_0x54547f){if(_0x54547f){return _0x54547f?{'count':_0x5883fb,'rows':_0x54547f}:null;}})[_0xa85c('0x44')](respondWithResult(_0x4970dc,null))[_0xa85c('0x47')](handleError(_0x4970dc,null));};exports[_0xa85c('0x52')]=function(_0xd352a0,_0x7a9644,_0x3e1b68){var _0x94ce53={};var _0x30a9e2={};var _0x124169;var _0xf6d203;return db[_0xa85c('0x2d')]['findOne']({'where':{'id':_0xd352a0[_0xa85c('0x49')]['id']}})[_0xa85c('0x44')](handleEntityNotFound(_0x7a9644,null))[_0xa85c('0x44')](function(_0x3704ba){if(_0x3704ba){_0x124169=_0x3704ba;_0x30a9e2[_0xa85c('0x32')]=_['keys'](db[_0xa85c('0x4f')][_0xa85c('0x2e')]);_0x30a9e2['query']=_[_0xa85c('0x35')](_0xd352a0[_0xa85c('0x34')]);_0x30a9e2[_0xa85c('0x36')]=_['intersection'](_0x30a9e2[_0xa85c('0x32')],_0x30a9e2[_0xa85c('0x34')]);_0x94ce53[_0xa85c('0x39')]=_[_0xa85c('0x37')](_0x30a9e2[_0xa85c('0x32')],qs['fields'](_0xd352a0[_0xa85c('0x34')][_0xa85c('0x38')]));_0x94ce53[_0xa85c('0x39')]=_0x94ce53[_0xa85c('0x39')]['length']?_0x94ce53[_0xa85c('0x39')]:_0x30a9e2[_0xa85c('0x32')];_0x94ce53[_0xa85c('0x3d')]=qs['sort'](_0xd352a0[_0xa85c('0x34')][_0xa85c('0x3e')]);_0x94ce53[_0xa85c('0x3f')]=qs[_0xa85c('0x36')](_[_0xa85c('0x40')](_0xd352a0['query'],_0x30a9e2[_0xa85c('0x36')]));if(_0xd352a0[_0xa85c('0x34')][_0xa85c('0x50')]){_0x94ce53[_0xa85c('0x3f')]=_[_0xa85c('0x41')](_0x94ce53[_0xa85c('0x3f')],{'$or':_[_0xa85c('0x33')](_0x94ce53['attributes'],function(_0x25cb3a){var _0x3e6177={};_0x3e6177[_0x25cb3a]={'$like':'%'+_0xd352a0[_0xa85c('0x34')][_0xa85c('0x50')]+'%'};return _0x3e6177;})});}_0x94ce53=_[_0xa85c('0x41')]({},_0x94ce53,_0xd352a0[_0xa85c('0x43')]);return _0x124169[_0xa85c('0x52')](_0x94ce53);}})[_0xa85c('0x44')](function(_0x119829){if(_0x119829){_0xf6d203=_0x119829[_0xa85c('0x3a')];if(!_0xd352a0[_0xa85c('0x34')][_0xa85c('0x3b')](_0xa85c('0x3c'))){_0x94ce53[_0xa85c('0x20')]=qs['limit'](_0xd352a0['query'][_0xa85c('0x20')]);_0x94ce53[_0xa85c('0x1e')]=qs[_0xa85c('0x1e')](_0xd352a0[_0xa85c('0x34')]['offset']);}return _0x124169[_0xa85c('0x52')](_0x94ce53);}})[_0xa85c('0x44')](function(_0x4d3693){if(_0x4d3693){return _0x4d3693?{'count':_0xf6d203,'rows':_0x4d3693}:null;}})['then'](respondWithResult(_0x7a9644,null))[_0xa85c('0x47')](handleError(_0x7a9644,null));};exports['getTags']=function(_0x552ce9,_0x470204,_0x3cdcd9){var _0x353d8a={};var _0x68295c={};var _0x4c39b4;var _0xa08629;return db['DeskConfiguration']['findOne']({'where':{'id':_0x552ce9[_0xa85c('0x49')]['id']}})[_0xa85c('0x44')](handleEntityNotFound(_0x470204,null))['then'](function(_0x1fa4a5){if(_0x1fa4a5){_0x4c39b4=_0x1fa4a5;_0x68295c[_0xa85c('0x32')]=_[_0xa85c('0x35')](db['Tag'][_0xa85c('0x2e')]);_0x68295c[_0xa85c('0x34')]=_[_0xa85c('0x35')](_0x552ce9['query']);_0x68295c[_0xa85c('0x36')]=_[_0xa85c('0x37')](_0x68295c[_0xa85c('0x32')],_0x68295c[_0xa85c('0x34')]);_0x353d8a[_0xa85c('0x39')]=_['intersection'](_0x68295c[_0xa85c('0x32')],qs['fields'](_0x552ce9[_0xa85c('0x34')][_0xa85c('0x38')]));_0x353d8a[_0xa85c('0x39')]=_0x353d8a['attributes'][_0xa85c('0x3a')]?_0x353d8a[_0xa85c('0x39')]:_0x68295c[_0xa85c('0x32')];_0x353d8a[_0xa85c('0x3d')]=qs['sort'](_0x552ce9[_0xa85c('0x34')][_0xa85c('0x3e')]);_0x353d8a[_0xa85c('0x3f')]=qs[_0xa85c('0x36')](_['pick'](_0x552ce9[_0xa85c('0x34')],_0x68295c[_0xa85c('0x36')]));if(_0x552ce9[_0xa85c('0x34')][_0xa85c('0x50')]){_0x353d8a[_0xa85c('0x3f')]=_[_0xa85c('0x41')](_0x353d8a['where'],{'$or':_[_0xa85c('0x33')](_0x353d8a[_0xa85c('0x39')],function(_0xa6c5e3){var _0xe337ad={};_0xe337ad[_0xa6c5e3]={'$like':'%'+_0x552ce9[_0xa85c('0x34')][_0xa85c('0x50')]+'%'};return _0xe337ad;})});}_0x353d8a=_['merge']({},_0x353d8a,_0x552ce9[_0xa85c('0x43')]);return _0x4c39b4['getTags'](_0x353d8a);}})[_0xa85c('0x44')](function(_0x25b339){if(_0x25b339){_0xa08629=_0x25b339[_0xa85c('0x3a')];if(!_0x552ce9[_0xa85c('0x34')][_0xa85c('0x3b')](_0xa85c('0x3c'))){_0x353d8a[_0xa85c('0x20')]=qs['limit'](_0x552ce9[_0xa85c('0x34')][_0xa85c('0x20')]);_0x353d8a[_0xa85c('0x1e')]=qs['offset'](_0x552ce9[_0xa85c('0x34')][_0xa85c('0x1e')]);}return _0x4c39b4['getTags'](_0x353d8a);}})[_0xa85c('0x44')](function(_0x2e105d){if(_0x2e105d){return _0x2e105d?{'count':_0xa08629,'rows':_0x2e105d}:null;}})['then'](respondWithResult(_0x470204,null))['catch'](handleError(_0x470204,null));};exports[_0xa85c('0x53')]=function(_0x200581,_0x1b888c,_0x36ceb1){if(_0x200581[_0xa85c('0x4c')]['id']){delete _0x200581[_0xa85c('0x4c')]['id'];}return db[_0xa85c('0x2d')][_0xa85c('0x4e')]({'where':{'id':_0x200581[_0xa85c('0x49')]['id']}})[_0xa85c('0x44')](handleEntityNotFound(_0x1b888c,null))[_0xa85c('0x44')](function(_0x3470df){if(_0x3470df){return _0x3470df[_0xa85c('0x53')](_0x200581[_0xa85c('0x4c')][_0xa85c('0x54')]||[]);}return null;})[_0xa85c('0x44')](respondWithResult(_0x1b888c,null))[_0xa85c('0x47')](handleError(_0x1b888c,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 216bc4d..ec255f1 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 _0xf1a7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','util'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0xf1a7,0x8f));var _0x7f1a=function(_0x1c8863,_0x561650){_0x1c8863=_0x1c8863-0x0;var _0x119a0b=_0xf1a7[_0x1c8863];return _0x119a0b;};'use strict';var _=require('lodash');var util=require(_0x7f1a('0x0'));var logger=require('../../config/logger')(_0x7f1a('0x1'));var moment=require(_0x7f1a('0x2'));var BPromise=require(_0x7f1a('0x3'));var rp=require(_0x7f1a('0x4'));var fs=require('fs');var path=require(_0x7f1a('0x5'));var rimraf=require(_0x7f1a('0x6'));var config=require(_0x7f1a('0x7'));var attributes=require(_0x7f1a('0x8'));module[_0x7f1a('0x9')]=function(_0x41446f,_0x1c3c87){return _0x41446f['define'](_0x7f1a('0xa'),attributes,{'tableName':_0x7f1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf8d=['moment','bluebird','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xcf8d,0x1a0));var _0xdcf8=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0xcf8d[_0x591cfd];return _0x4d0100;};'use strict';var _=require(_0xdcf8('0x0'));var util=require(_0xdcf8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdcf8('0x2'));var BPromise=require(_0xdcf8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdcf8('0x4'));var config=require(_0xdcf8('0x5'));var attributes=require(_0xdcf8('0x6'));module[_0xdcf8('0x7')]=function(_0x42256f,_0xc1405f){return _0x42256f[_0xdcf8('0x8')](_0xdcf8('0x9'),attributes,{'tableName':_0xdcf8('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 aaa89a7..8e12d47 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x4920e9,_0x276a15){var _0x3d9f5b=function(_0x32bde9){while(--_0x32bde9){_0x4920e9['push'](_0x4920e9['shift']());}};_0x3d9f5b(++_0x276a15);}(_0x1a85,0x178));var _0x51a8=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0x1a85[_0x7791d5];return _0x5ce288;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0xb3f9=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb3f9,0x122));var _0x9b3f=function(_0x5b6332,_0x33a772){_0x5b6332=_0x5b6332-0x0;var _0x399561=_0xb3f9[_0x5b6332];return _0x399561;};'use strict';var _=require(_0x9b3f('0x0'));var util=require(_0x9b3f('0x1'));var moment=require(_0x9b3f('0x2'));var BPromise=require(_0x9b3f('0x3'));var rs=require(_0x9b3f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b3f('0x5'))['db'];var utils=require(_0x9b3f('0x6'));var logger=require(_0x9b3f('0x7'))(_0x9b3f('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b3f('0x9'));var client=jayson['client'][_0x9b3f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1906f6,_0x1a29f1,_0x384694){return new BPromise(function(_0x52a320,_0x580b87){return client[_0x9b3f('0xb')](_0x1906f6,_0x384694)[_0x9b3f('0xc')](function(_0x41a78c){logger[_0x9b3f('0xd')](_0x9b3f('0xe'),_0x1a29f1,_0x9b3f('0xf'));logger[_0x9b3f('0x10')](_0x9b3f('0x11'),_0x1a29f1,_0x9b3f('0xf'),JSON[_0x9b3f('0x12')](_0x41a78c));if(_0x41a78c[_0x9b3f('0x13')]){if(_0x41a78c[_0x9b3f('0x13')][_0x9b3f('0x14')]===0x1f4){logger['error'](_0x9b3f('0xe'),_0x1a29f1,_0x41a78c[_0x9b3f('0x13')][_0x9b3f('0x15')]);return _0x580b87(_0x41a78c[_0x9b3f('0x13')][_0x9b3f('0x15')]);}logger[_0x9b3f('0x13')](_0x9b3f('0xe'),_0x1a29f1,_0x41a78c[_0x9b3f('0x13')][_0x9b3f('0x15')]);return _0x52a320(_0x41a78c[_0x9b3f('0x13')][_0x9b3f('0x15')]);}else{logger[_0x9b3f('0xd')](_0x9b3f('0xe'),_0x1a29f1,'request\x20sent');_0x52a320(_0x41a78c[_0x9b3f('0x16')][_0x9b3f('0x15')]);}})[_0x9b3f('0x17')](function(_0x23c726){logger['error'](_0x9b3f('0xe'),_0x1a29f1,_0x23c726);_0x580b87(_0x23c726);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index f47ff75..f795a0a 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 _0x3719=['put','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0xd58a4a,_0x3abb1e){var _0x2922fa=function(_0x5a4a1c){while(--_0x5a4a1c){_0xd58a4a['push'](_0xd58a4a['shift']());}};_0x2922fa(++_0x3abb1e);}(_0x3719,0x123));var _0x9371=function(_0x155035,_0x4e0121){_0x155035=_0x155035-0x0;var _0x185328=_0x3719[_0x155035];return _0x185328;};'use strict';var multer=require(_0x9371('0x0'));var util=require('util');var path=require(_0x9371('0x1'));var timeout=require(_0x9371('0x2'));var express=require(_0x9371('0x3'));var router=express[_0x9371('0x4')]();var fs_extra=require(_0x9371('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9371('0x6'));var config=require(_0x9371('0x7'));var controller=require(_0x9371('0x8'));router[_0x9371('0x9')]('/',auth[_0x9371('0xa')](),controller[_0x9371('0xb')]);router[_0x9371('0x9')](_0x9371('0xc'),auth['isAuthenticated'](),controller[_0x9371('0xd')]);router[_0x9371('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9371('0xf')](_0x9371('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9371('0xc'),auth[_0x9371('0xa')](),controller[_0x9371('0x10')]);module[_0x9371('0x11')]=router; \ No newline at end of file +var _0x1e5a=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','isAuthenticated','index','get','/:id','show','create','update','delete'];(function(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0x1e5a,0xb5));var _0xa1e5=function(_0x46b1c9,_0x169f87){_0x46b1c9=_0x46b1c9-0x0;var _0x17569c=_0x1e5a[_0x46b1c9];return _0x17569c;};'use strict';var multer=require(_0xa1e5('0x0'));var util=require(_0xa1e5('0x1'));var path=require(_0xa1e5('0x2'));var timeout=require(_0xa1e5('0x3'));var express=require(_0xa1e5('0x4'));var router=express['Router']();var fs_extra=require(_0xa1e5('0x5'));var auth=require(_0xa1e5('0x6'));var interaction=require(_0xa1e5('0x7'));var config=require('../../config/environment');var controller=require(_0xa1e5('0x8'));router['get']('/',auth[_0xa1e5('0x9')](),controller[_0xa1e5('0xa')]);router[_0xa1e5('0xb')](_0xa1e5('0xc'),auth[_0xa1e5('0x9')](),controller[_0xa1e5('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa1e5('0xe')]);router['put'](_0xa1e5('0xc'),auth[_0xa1e5('0x9')](),controller[_0xa1e5('0xf')]);router[_0xa1e5('0x10')](_0xa1e5('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xa1e5('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 be4eb78..9e661b7 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 _0xed9c=['BOOLEAN','exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable'];(function(_0x28038b,_0x2f3c5f){var _0x3b3faf=function(_0x2252f7){while(--_0x2252f7){_0x28038b['push'](_0x28038b['shift']());}};_0x3b3faf(++_0x2f3c5f);}(_0xed9c,0x7f));var _0xced9=function(_0x2753d5,_0x46affe){_0x2753d5=_0x2753d5-0x0;var _0x4cd609=_0xed9c[_0x2753d5];return _0x4cd609;};'use strict';var Sequelize=require('sequelize');module[_0xced9('0x0')]={'type':{'type':Sequelize['ENUM'](_0xced9('0x1'),'variable',_0xced9('0x2'),_0xced9('0x3'),_0xced9('0x4')),'defaultValue':_0xced9('0x1')},'content':{'type':Sequelize[_0xced9('0x5')]},'key':{'type':Sequelize[_0xced9('0x5')]},'keyType':{'type':Sequelize[_0xced9('0x6')](_0xced9('0x1'),_0xced9('0x7'),_0xced9('0x2'))},'keyContent':{'type':Sequelize[_0xced9('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xced9('0x5')]},'customField':{'type':Sequelize[_0xced9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe655=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x3d23fb,_0x32ce0a){var _0x240a07=function(_0x58d5e7){while(--_0x58d5e7){_0x3d23fb['push'](_0x3d23fb['shift']());}};_0x240a07(++_0x32ce0a);}(_0xe655,0x1d3));var _0x5e65=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe655[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x5e65('0x0'));module[_0x5e65('0x1')]={'type':{'type':Sequelize[_0x5e65('0x2')](_0x5e65('0x3'),_0x5e65('0x4'),_0x5e65('0x5'),_0x5e65('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x5e65('0x7')]},'key':{'type':Sequelize[_0x5e65('0x7')]},'keyType':{'type':Sequelize[_0x5e65('0x2')](_0x5e65('0x3'),_0x5e65('0x4'),_0x5e65('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5e65('0x7')]},'nameField':{'type':Sequelize[_0x5e65('0x7')]},'customField':{'type':Sequelize[_0x5e65('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 726f533..96e1fc3 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 _0x09b1=['sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','show','length','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order'];(function(_0xddd82e,_0xd79a77){var _0x468240=function(_0x22092e){while(--_0x22092e){_0xddd82e['push'](_0xddd82e['shift']());}};_0x468240(++_0xd79a77);}(_0x09b1,0xa7));var _0x109b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x09b1[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x109b('0x0'));var rimraf=require(_0x109b('0x1'));var zipdir=require(_0x109b('0x2'));var jsonpatch=require(_0x109b('0x3'));var rp=require(_0x109b('0x4'));var moment=require('moment');var BPromise=require(_0x109b('0x5'));var Mustache=require(_0x109b('0x6'));var util=require(_0x109b('0x7'));var path=require(_0x109b('0x8'));var sox=require(_0x109b('0x9'));var csv=require(_0x109b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x109b('0xb'));var _=require(_0x109b('0xc'));var squel=require(_0x109b('0xd'));var crypto=require(_0x109b('0xe'));var jsforce=require(_0x109b('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x109b('0x10'));var Papa=require(_0x109b('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x109b('0x12'));var hardwareService=require(_0x109b('0x13'));var logger=require('../../config/logger')(_0x109b('0x14'));var utils=require(_0x109b('0x15'));var config=require(_0x109b('0x16'));var licenseUtil=require(_0x109b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31cade,_0x34ed0){_0x34ed0=_0x34ed0||0xcc;return function(_0x259c85){if(_0x259c85){return _0x31cade[_0x109b('0x18')](_0x34ed0);}return _0x31cade[_0x109b('0x19')](_0x34ed0)[_0x109b('0x1a')]();};}function respondWithResult(_0x487920,_0x5ef8aa){_0x5ef8aa=_0x5ef8aa||0xc8;return function(_0x25b1e6){if(_0x25b1e6){return _0x487920[_0x109b('0x19')](_0x5ef8aa)[_0x109b('0x1b')](_0x25b1e6);}};}function respondWithFilteredResult(_0x40eb0e,_0x16c926){return function(_0x5bccd2){if(_0x5bccd2){var _0x52f17b=typeof _0x16c926[_0x109b('0x1c')]===_0x109b('0x1d')&&typeof _0x16c926['limit']===_0x109b('0x1d');var _0x3c494a=_0x5bccd2['count'];var _0x27a3f7=_0x52f17b?0x0:_0x16c926[_0x109b('0x1c')];var _0x2dddcb=_0x52f17b?_0x5bccd2['count']:_0x16c926['offset']+_0x16c926[_0x109b('0x1e')];var _0x52fe86;if(_0x2dddcb>=_0x3c494a){_0x2dddcb=_0x3c494a;_0x52fe86=0xc8;}else{_0x52fe86=0xce;}_0x40eb0e['status'](_0x52fe86);return _0x40eb0e[_0x109b('0x1f')](_0x109b('0x20'),_0x27a3f7+'-'+_0x2dddcb+'/'+_0x3c494a)[_0x109b('0x1b')](_0x5bccd2);}return null;};}function patchUpdates(_0x251f97){return function(_0xce1f){try{jsonpatch[_0x109b('0x21')](_0xce1f,_0x251f97,!![]);}catch(_0x3d8ffa){return BPromise[_0x109b('0x22')](_0x3d8ffa);}return _0xce1f[_0x109b('0x23')]();};}function saveUpdates(_0x228b1b,_0x3e8150){return function(_0x54e3e3){if(_0x54e3e3){return _0x54e3e3[_0x109b('0x24')](_0x228b1b)[_0x109b('0x25')](function(_0x36a161){return _0x36a161;});}return null;};}function removeEntity(_0x56f077,_0x3c1f4c){return function(_0x42a6a4){if(_0x42a6a4){return _0x42a6a4[_0x109b('0x26')]()[_0x109b('0x25')](function(){_0x56f077[_0x109b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d86bc,_0x11223a){return function(_0x25d04f){if(!_0x25d04f){_0x1d86bc[_0x109b('0x18')](0x194);}return _0x25d04f;};}function handleError(_0x68eb2e,_0x5b368b){_0x5b368b=_0x5b368b||0x1f4;return function(_0x385a2d){logger[_0x109b('0x27')](_0x385a2d[_0x109b('0x28')]);if(_0x385a2d[_0x109b('0x29')]){delete _0x385a2d[_0x109b('0x29')];}_0x68eb2e[_0x109b('0x19')](_0x5b368b)[_0x109b('0x2a')](_0x385a2d);};}exports[_0x109b('0x2b')]=function(_0x2e8839,_0x267387){var _0xa8bc18={},_0x45358f={},_0x4ef7c4={'count':0x0,'rows':[]};var _0x23f399=_[_0x109b('0x2c')](db[_0x109b('0x2d')][_0x109b('0x2e')],function(_0xeb8aea){return{'name':_0xeb8aea['fieldName'],'type':_0xeb8aea[_0x109b('0x2f')][_0x109b('0x30')]};});_0x45358f[_0x109b('0x31')]=_[_0x109b('0x2c')](_0x23f399,_0x109b('0x29'));_0x45358f[_0x109b('0x32')]=_[_0x109b('0x33')](_0x2e8839[_0x109b('0x32')]);_0x45358f[_0x109b('0x34')]=_[_0x109b('0x35')](_0x45358f['model'],_0x45358f['query']);_0xa8bc18[_0x109b('0x36')]=_[_0x109b('0x35')](_0x45358f[_0x109b('0x31')],qs['fields'](_0x2e8839['query']['fields']));_0xa8bc18[_0x109b('0x36')]=_0xa8bc18[_0x109b('0x36')]['length']?_0xa8bc18['attributes']:_0x45358f['model'];if(!_0x2e8839[_0x109b('0x32')][_0x109b('0x37')](_0x109b('0x38'))){_0xa8bc18[_0x109b('0x1e')]=qs[_0x109b('0x1e')](_0x2e8839['query'][_0x109b('0x1e')]);_0xa8bc18[_0x109b('0x1c')]=qs[_0x109b('0x1c')](_0x2e8839[_0x109b('0x32')][_0x109b('0x1c')]);}_0xa8bc18[_0x109b('0x39')]=qs['sort'](_0x2e8839[_0x109b('0x32')][_0x109b('0x3a')]);_0xa8bc18[_0x109b('0x3b')]=qs[_0x109b('0x34')](_[_0x109b('0x3c')](_0x2e8839[_0x109b('0x32')],_0x45358f[_0x109b('0x34')]),_0x23f399);if(_0x2e8839[_0x109b('0x32')][_0x109b('0x3d')]){_0xa8bc18[_0x109b('0x3b')]=_[_0x109b('0x3e')](_0xa8bc18[_0x109b('0x3b')],{'$or':_[_0x109b('0x2c')](_0x23f399,function(_0x1ffe26){if(_0x1ffe26[_0x109b('0x2f')]!=='VIRTUAL'){var _0x30fb8d={};_0x30fb8d[_0x1ffe26['name']]={'$like':'%'+_0x2e8839[_0x109b('0x32')][_0x109b('0x3d')]+'%'};return _0x30fb8d;}})});}_0xa8bc18=_[_0x109b('0x3e')]({},_0xa8bc18,_0x2e8839['options']);var _0x4d72d3={'where':_0xa8bc18[_0x109b('0x3b')]};return db[_0x109b('0x2d')]['count'](_0x4d72d3)[_0x109b('0x25')](function(_0x47eeca){_0x4ef7c4[_0x109b('0x3f')]=_0x47eeca;if(_0x2e8839[_0x109b('0x32')][_0x109b('0x40')]){_0xa8bc18[_0x109b('0x41')]=[{'all':!![]}];}return db[_0x109b('0x2d')][_0x109b('0x42')](_0xa8bc18);})[_0x109b('0x25')](function(_0x434db8){_0x4ef7c4[_0x109b('0x43')]=_0x434db8;return _0x4ef7c4;})['then'](respondWithFilteredResult(_0x267387,_0xa8bc18))['catch'](handleError(_0x267387,null));};exports[_0x109b('0x44')]=function(_0xeb35a0,_0x164af8){var _0x482548={'raw':!![],'where':{'id':_0xeb35a0['params']['id']}},_0x3a137d={};_0x3a137d[_0x109b('0x31')]=_[_0x109b('0x33')](db[_0x109b('0x2d')][_0x109b('0x2e')]);_0x3a137d[_0x109b('0x32')]=_[_0x109b('0x33')](_0xeb35a0['query']);_0x3a137d['filters']=_[_0x109b('0x35')](_0x3a137d[_0x109b('0x31')],_0x3a137d[_0x109b('0x32')]);_0x482548[_0x109b('0x36')]=_[_0x109b('0x35')](_0x3a137d[_0x109b('0x31')],qs['fields'](_0xeb35a0[_0x109b('0x32')]['fields']));_0x482548[_0x109b('0x36')]=_0x482548[_0x109b('0x36')][_0x109b('0x45')]?_0x482548[_0x109b('0x36')]:_0x3a137d['model'];if(_0xeb35a0[_0x109b('0x32')]['includeAll']){_0x482548['include']=[{'all':!![]}];}_0x482548=_[_0x109b('0x3e')]({},_0x482548,_0xeb35a0['options']);return db[_0x109b('0x2d')][_0x109b('0x46')](_0x482548)['then'](handleEntityNotFound(_0x164af8,null))[_0x109b('0x25')](respondWithResult(_0x164af8,null))[_0x109b('0x47')](handleError(_0x164af8,null));};exports[_0x109b('0x48')]=function(_0x41d351,_0x392c24){return db[_0x109b('0x2d')][_0x109b('0x48')](_0x41d351[_0x109b('0x49')],{})[_0x109b('0x25')](respondWithResult(_0x392c24,0xc9))[_0x109b('0x47')](handleError(_0x392c24,null));};exports[_0x109b('0x24')]=function(_0xf031cd,_0x957a6f){if(_0xf031cd['body']['id']){delete _0xf031cd[_0x109b('0x49')]['id'];}return db[_0x109b('0x2d')][_0x109b('0x46')]({'where':{'id':_0xf031cd[_0x109b('0x4a')]['id']}})[_0x109b('0x25')](handleEntityNotFound(_0x957a6f,null))['then'](saveUpdates(_0xf031cd[_0x109b('0x49')],null))['then'](respondWithResult(_0x957a6f,null))[_0x109b('0x47')](handleError(_0x957a6f,null));};exports[_0x109b('0x26')]=function(_0x1bfdc9,_0x16b167){return db[_0x109b('0x2d')][_0x109b('0x46')]({'where':{'id':_0x1bfdc9[_0x109b('0x4a')]['id']}})[_0x109b('0x25')](handleEntityNotFound(_0x16b167,null))[_0x109b('0x25')](removeEntity(_0x16b167,null))[_0x109b('0x47')](handleError(_0x16b167,null));}; \ No newline at end of file +var _0xfd87=['crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','DeskField','rawAttributes','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','filter','merge','where','options','includeAll','include','findAll','rows','catch','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel'];(function(_0x2c6af3,_0x3ce442){var _0x4895bf=function(_0x5566cf){while(--_0x5566cf){_0x2c6af3['push'](_0x2c6af3['shift']());}};_0x4895bf(++_0x3ce442);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7fd8('0x0'));var rimraf=require(_0x7fd8('0x1'));var zipdir=require(_0x7fd8('0x2'));var jsonpatch=require(_0x7fd8('0x3'));var rp=require(_0x7fd8('0x4'));var moment=require(_0x7fd8('0x5'));var BPromise=require(_0x7fd8('0x6'));var Mustache=require(_0x7fd8('0x7'));var util=require(_0x7fd8('0x8'));var path=require(_0x7fd8('0x9'));var sox=require(_0x7fd8('0xa'));var csv=require('to-csv');var ejs=require(_0x7fd8('0xb'));var fs=require('fs');var fs_extra=require(_0x7fd8('0xc'));var _=require('lodash');var squel=require(_0x7fd8('0xd'));var crypto=require(_0x7fd8('0xe'));var jsforce=require(_0x7fd8('0xf'));var deskjs=require(_0x7fd8('0x10'));var toCsv=require(_0x7fd8('0x11'));var querystring=require('querystring');var Papa=require(_0x7fd8('0x12'));var Redis=require(_0x7fd8('0x13'));var authService=require(_0x7fd8('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fd8('0x15'))('api');var utils=require(_0x7fd8('0x16'));var config=require(_0x7fd8('0x17'));var licenseUtil=require(_0x7fd8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x136770,_0x2cccdb){_0x2cccdb=_0x2cccdb||0xcc;return function(_0xe84aa7){if(_0xe84aa7){return _0x136770[_0x7fd8('0x19')](_0x2cccdb);}return _0x136770[_0x7fd8('0x1a')](_0x2cccdb)['end']();};}function respondWithResult(_0x1af365,_0x17a3a1){_0x17a3a1=_0x17a3a1||0xc8;return function(_0x1d481a){if(_0x1d481a){return _0x1af365[_0x7fd8('0x1a')](_0x17a3a1)[_0x7fd8('0x1b')](_0x1d481a);}};}function respondWithFilteredResult(_0x38d45a,_0x1a4a52){return function(_0x33c8f9){if(_0x33c8f9){var _0x2a8818=typeof _0x1a4a52[_0x7fd8('0x1c')]===_0x7fd8('0x1d')&&typeof _0x1a4a52['limit']==='undefined';var _0x5ca7f6=_0x33c8f9[_0x7fd8('0x1e')];var _0xce23dc=_0x2a8818?0x0:_0x1a4a52['offset'];var _0x39e301=_0x2a8818?_0x33c8f9[_0x7fd8('0x1e')]:_0x1a4a52[_0x7fd8('0x1c')]+_0x1a4a52[_0x7fd8('0x1f')];var _0x3ab724;if(_0x39e301>=_0x5ca7f6){_0x39e301=_0x5ca7f6;_0x3ab724=0xc8;}else{_0x3ab724=0xce;}_0x38d45a[_0x7fd8('0x1a')](_0x3ab724);return _0x38d45a[_0x7fd8('0x20')](_0x7fd8('0x21'),_0xce23dc+'-'+_0x39e301+'/'+_0x5ca7f6)['json'](_0x33c8f9);}return null;};}function patchUpdates(_0x34bc09){return function(_0x3b7b49){try{jsonpatch[_0x7fd8('0x22')](_0x3b7b49,_0x34bc09,!![]);}catch(_0x13417d){return BPromise[_0x7fd8('0x23')](_0x13417d);}return _0x3b7b49[_0x7fd8('0x24')]();};}function saveUpdates(_0x4f8563,_0xecd3f3){return function(_0x1d26d4){if(_0x1d26d4){return _0x1d26d4[_0x7fd8('0x25')](_0x4f8563)[_0x7fd8('0x26')](function(_0x52b71a){return _0x52b71a;});}return null;};}function removeEntity(_0x3f71a4,_0x402fa1){return function(_0x2e7520){if(_0x2e7520){return _0x2e7520[_0x7fd8('0x27')]()[_0x7fd8('0x26')](function(){_0x3f71a4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3650cb,_0x6cccad){return function(_0xa273a7){if(!_0xa273a7){_0x3650cb[_0x7fd8('0x19')](0x194);}return _0xa273a7;};}function handleError(_0x17b86a,_0x50f34f){_0x50f34f=_0x50f34f||0x1f4;return function(_0x12bc21){logger[_0x7fd8('0x28')](_0x12bc21[_0x7fd8('0x29')]);if(_0x12bc21[_0x7fd8('0x2a')]){delete _0x12bc21[_0x7fd8('0x2a')];}_0x17b86a['status'](_0x50f34f)['send'](_0x12bc21);};}exports[_0x7fd8('0x2b')]=function(_0x2bd721,_0x3919b1){var _0x4319b8={},_0x573ed0={},_0x4fc63a={'count':0x0,'rows':[]};var _0x8f9a8e=_['map'](db[_0x7fd8('0x2c')][_0x7fd8('0x2d')],function(_0x3df0a2){return{'name':_0x3df0a2['fieldName'],'type':_0x3df0a2[_0x7fd8('0x2e')]['key']};});_0x573ed0[_0x7fd8('0x2f')]=_[_0x7fd8('0x30')](_0x8f9a8e,_0x7fd8('0x2a'));_0x573ed0[_0x7fd8('0x31')]=_[_0x7fd8('0x32')](_0x2bd721[_0x7fd8('0x31')]);_0x573ed0[_0x7fd8('0x33')]=_['intersection'](_0x573ed0[_0x7fd8('0x2f')],_0x573ed0[_0x7fd8('0x31')]);_0x4319b8[_0x7fd8('0x34')]=_[_0x7fd8('0x35')](_0x573ed0[_0x7fd8('0x2f')],qs[_0x7fd8('0x36')](_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x36')]));_0x4319b8['attributes']=_0x4319b8['attributes'][_0x7fd8('0x37')]?_0x4319b8[_0x7fd8('0x34')]:_0x573ed0[_0x7fd8('0x2f')];if(!_0x2bd721['query'][_0x7fd8('0x38')]('nolimit')){_0x4319b8['limit']=qs[_0x7fd8('0x1f')](_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x1f')]);_0x4319b8[_0x7fd8('0x1c')]=qs[_0x7fd8('0x1c')](_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x1c')]);}_0x4319b8[_0x7fd8('0x39')]=qs['sort'](_0x2bd721[_0x7fd8('0x31')]['sort']);_0x4319b8['where']=qs[_0x7fd8('0x33')](_['pick'](_0x2bd721['query'],_0x573ed0['filters']),_0x8f9a8e);if(_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x3a')]){_0x4319b8['where']=_[_0x7fd8('0x3b')](_0x4319b8[_0x7fd8('0x3c')],{'$or':_[_0x7fd8('0x30')](_0x8f9a8e,function(_0x5d8d3d){if(_0x5d8d3d['type']!=='VIRTUAL'){var _0x1cc1d5={};_0x1cc1d5[_0x5d8d3d[_0x7fd8('0x2a')]]={'$like':'%'+_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x3a')]+'%'};return _0x1cc1d5;}})});}_0x4319b8=_[_0x7fd8('0x3b')]({},_0x4319b8,_0x2bd721[_0x7fd8('0x3d')]);var _0x2b5abb={'where':_0x4319b8['where']};return db['DeskField']['count'](_0x2b5abb)[_0x7fd8('0x26')](function(_0x24a0f8){_0x4fc63a[_0x7fd8('0x1e')]=_0x24a0f8;if(_0x2bd721['query'][_0x7fd8('0x3e')]){_0x4319b8[_0x7fd8('0x3f')]=[{'all':!![]}];}return db[_0x7fd8('0x2c')][_0x7fd8('0x40')](_0x4319b8);})['then'](function(_0x2f480c){_0x4fc63a[_0x7fd8('0x41')]=_0x2f480c;return _0x4fc63a;})['then'](respondWithFilteredResult(_0x3919b1,_0x4319b8))[_0x7fd8('0x42')](handleError(_0x3919b1,null));};exports['show']=function(_0x92b45f,_0x2026aa){var _0x393174={'raw':!![],'where':{'id':_0x92b45f['params']['id']}},_0xffd29a={};_0xffd29a[_0x7fd8('0x2f')]=_[_0x7fd8('0x32')](db[_0x7fd8('0x2c')][_0x7fd8('0x2d')]);_0xffd29a[_0x7fd8('0x31')]=_[_0x7fd8('0x32')](_0x92b45f['query']);_0xffd29a['filters']=_['intersection'](_0xffd29a[_0x7fd8('0x2f')],_0xffd29a[_0x7fd8('0x31')]);_0x393174['attributes']=_['intersection'](_0xffd29a[_0x7fd8('0x2f')],qs[_0x7fd8('0x36')](_0x92b45f['query'][_0x7fd8('0x36')]));_0x393174[_0x7fd8('0x34')]=_0x393174[_0x7fd8('0x34')]['length']?_0x393174[_0x7fd8('0x34')]:_0xffd29a[_0x7fd8('0x2f')];if(_0x92b45f['query'][_0x7fd8('0x3e')]){_0x393174['include']=[{'all':!![]}];}_0x393174=_[_0x7fd8('0x3b')]({},_0x393174,_0x92b45f[_0x7fd8('0x3d')]);return db[_0x7fd8('0x2c')][_0x7fd8('0x43')](_0x393174)[_0x7fd8('0x26')](handleEntityNotFound(_0x2026aa,null))[_0x7fd8('0x26')](respondWithResult(_0x2026aa,null))[_0x7fd8('0x42')](handleError(_0x2026aa,null));};exports[_0x7fd8('0x44')]=function(_0x4c2784,_0x1666e7){return db['DeskField'][_0x7fd8('0x44')](_0x4c2784[_0x7fd8('0x45')],{})['then'](respondWithResult(_0x1666e7,0xc9))[_0x7fd8('0x42')](handleError(_0x1666e7,null));};exports[_0x7fd8('0x25')]=function(_0x5cbc91,_0x5e3a45){if(_0x5cbc91['body']['id']){delete _0x5cbc91[_0x7fd8('0x45')]['id'];}return db['DeskField'][_0x7fd8('0x43')]({'where':{'id':_0x5cbc91[_0x7fd8('0x46')]['id']}})[_0x7fd8('0x26')](handleEntityNotFound(_0x5e3a45,null))[_0x7fd8('0x26')](saveUpdates(_0x5cbc91[_0x7fd8('0x45')],null))['then'](respondWithResult(_0x5e3a45,null))['catch'](handleError(_0x5e3a45,null));};exports[_0x7fd8('0x27')]=function(_0x46c230,_0x6924a2){return db[_0x7fd8('0x2c')]['find']({'where':{'id':_0x46c230[_0x7fd8('0x46')]['id']}})['then'](handleEntityNotFound(_0x6924a2,null))[_0x7fd8('0x26')](removeEntity(_0x6924a2,null))[_0x7fd8('0x42')](handleError(_0x6924a2,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 4ab2bbd..39734cb 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 _0x2d2d=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','idField','FieldId','lodash'];(function(_0x308a9a,_0xd452bb){var _0xf317d1=function(_0x2df45c){while(--_0x2df45c){_0x308a9a['push'](_0x308a9a['shift']());}};_0xf317d1(++_0xd452bb);}(_0x2d2d,0x195));var _0xd2d2=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x2d2d[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0xd2d2('0x0'));var util=require(_0xd2d2('0x1'));var logger=require(_0xd2d2('0x2'))('api');var moment=require(_0xd2d2('0x3'));var BPromise=require('bluebird');var rp=require(_0xd2d2('0x4'));var fs=require('fs');var path=require(_0xd2d2('0x5'));var rimraf=require(_0xd2d2('0x6'));var config=require(_0xd2d2('0x7'));var attributes=require(_0xd2d2('0x8'));module[_0xd2d2('0x9')]=function(_0x32de05,_0x5332a2){return _0x32de05[_0xd2d2('0xa')]('DeskField',attributes,{'tableName':_0xd2d2('0xb'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xd2d2('0xc'),_0xd2d2('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x809d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x809d,0x12b));var _0xd809=function(_0x18c7a2,_0x3f9c8c){_0x18c7a2=_0x18c7a2-0x0;var _0xb6ddcb=_0x809d[_0x18c7a2];return _0xb6ddcb;};'use strict';var _=require('lodash');var util=require(_0xd809('0x0'));var logger=require(_0xd809('0x1'))(_0xd809('0x2'));var moment=require(_0xd809('0x3'));var BPromise=require(_0xd809('0x4'));var rp=require(_0xd809('0x5'));var fs=require('fs');var path=require(_0xd809('0x6'));var rimraf=require(_0xd809('0x7'));var config=require('../../config/environment');var attributes=require(_0xd809('0x8'));module['exports']=function(_0x2af1d8,_0x4b45ea){return _0x2af1d8[_0xd809('0x9')](_0xd809('0xa'),attributes,{'tableName':_0xd809('0xb'),'paranoid':![],'indexes':[{'name':_0xd809('0xc'),'fields':[_0xd809('0xd'),_0xd809('0xe')],'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 90b7f36..0914f96 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 _0x417b=['http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x504187,_0x407042){var _0x84c53d=function(_0x41ab4c){while(--_0x41ab4c){_0x504187['push'](_0x504187['shift']());}};_0x84c53d(++_0x407042);}(_0x417b,0xee));var _0xb417=function(_0x5d3bd1,_0x2591ee){_0x5d3bd1=_0x5d3bd1-0x0;var _0xc5b91=_0x417b[_0x5d3bd1];return _0xc5b91;};'use strict';var _=require(_0xb417('0x0'));var util=require(_0xb417('0x1'));var moment=require(_0xb417('0x2'));var BPromise=require(_0xb417('0x3'));var rs=require(_0xb417('0x4'));var fs=require('fs');var Redis=require(_0xb417('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb417('0x6'));var logger=require(_0xb417('0x7'))(_0xb417('0x8'));var config=require(_0xb417('0x9'));var jayson=require(_0xb417('0xa'));var client=jayson[_0xb417('0xb')][_0xb417('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x30b02d,_0xc58823,_0x3c6a06){return new BPromise(function(_0x1f5254,_0xd3ea47){return client[_0xb417('0xd')](_0x30b02d,_0x3c6a06)[_0xb417('0xe')](function(_0x40b56a){logger['info'](_0xb417('0xf'),_0xc58823,_0xb417('0x10'));logger[_0xb417('0x11')](_0xb417('0x12'),_0xc58823,_0xb417('0x10'),JSON[_0xb417('0x13')](_0x40b56a));if(_0x40b56a[_0xb417('0x14')]){if(_0x40b56a[_0xb417('0x14')]['code']===0x1f4){logger[_0xb417('0x14')](_0xb417('0xf'),_0xc58823,_0x40b56a[_0xb417('0x14')][_0xb417('0x15')]);return _0xd3ea47(_0x40b56a[_0xb417('0x14')][_0xb417('0x15')]);}logger['error'](_0xb417('0xf'),_0xc58823,_0x40b56a[_0xb417('0x14')]['message']);return _0x1f5254(_0x40b56a[_0xb417('0x14')][_0xb417('0x15')]);}else{logger[_0xb417('0x16')](_0xb417('0xf'),_0xc58823,'request\x20sent');_0x1f5254(_0x40b56a[_0xb417('0x17')]['message']);}})[_0xb417('0x18')](function(_0x5325bb){logger[_0xb417('0x14')](_0xb417('0xf'),_0xc58823,_0x5325bb);_0xd3ea47(_0x5325bb);});});} \ No newline at end of file +var _0x8d0d=['error','code','message','catch','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x438fa5,_0x446fc2){var _0x338600=function(_0xe82354){while(--_0xe82354){_0x438fa5['push'](_0x438fa5['shift']());}};_0x338600(++_0x446fc2);}(_0x8d0d,0x10e));var _0xd8d0=function(_0x53a420,_0x2fac98){_0x53a420=_0x53a420-0x0;var _0x13333b=_0x8d0d[_0x53a420];return _0x13333b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd8d0('0x0'));var BPromise=require(_0xd8d0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8d0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8d0('0x3'));var logger=require('../../config/logger')(_0xd8d0('0x4'));var config=require(_0xd8d0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd8d0('0x6')][_0xd8d0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x598d4e,_0x23ef87,_0x422eea){return new BPromise(function(_0x249c61,_0x364510){return client[_0xd8d0('0x8')](_0x598d4e,_0x422eea)[_0xd8d0('0x9')](function(_0x3e9c26){logger[_0xd8d0('0xa')](_0xd8d0('0xb'),_0x23ef87,'request\x20sent');logger[_0xd8d0('0xc')](_0xd8d0('0xd'),_0x23ef87,_0xd8d0('0xe'),JSON['stringify'](_0x3e9c26));if(_0x3e9c26[_0xd8d0('0xf')]){if(_0x3e9c26['error'][_0xd8d0('0x10')]===0x1f4){logger['error'](_0xd8d0('0xb'),_0x23ef87,_0x3e9c26['error'][_0xd8d0('0x11')]);return _0x364510(_0x3e9c26[_0xd8d0('0xf')][_0xd8d0('0x11')]);}logger['error'](_0xd8d0('0xb'),_0x23ef87,_0x3e9c26[_0xd8d0('0xf')][_0xd8d0('0x11')]);return _0x249c61(_0x3e9c26['error'][_0xd8d0('0x11')]);}else{logger[_0xd8d0('0xa')]('DeskField,\x20%s,\x20%s',_0x23ef87,'request\x20sent');_0x249c61(_0x3e9c26['result']['message']);}})[_0xd8d0('0x12')](function(_0x240bf4){logger[_0xd8d0('0xf')](_0xd8d0('0xb'),_0x23ef87,_0x240bf4);_0x364510(_0x240bf4);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 757a055..66a0e1e 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 _0x0033=['../../config/environment','./intDynamics365Account.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0x0033,0x1b2));var _0x3003=function(_0x3fc287,_0x5c3f36){_0x3fc287=_0x3fc287-0x0;var _0x33af9f=_0x0033[_0x3fc287];return _0x33af9f;};'use strict';var multer=require('multer');var util=require(_0x3003('0x0'));var path=require(_0x3003('0x1'));var timeout=require(_0x3003('0x2'));var express=require(_0x3003('0x3'));var router=express[_0x3003('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3003('0x5'));var interaction=require(_0x3003('0x6'));var config=require(_0x3003('0x7'));var controller=require(_0x3003('0x8'));router['get']('/',auth[_0x3003('0x9')](),controller['index']);router[_0x3003('0xa')](_0x3003('0xb'),auth['isAuthenticated'](),controller[_0x3003('0xc')]);router[_0x3003('0xa')](_0x3003('0xd'),auth['isAuthenticated'](),controller[_0x3003('0xe')]);router[_0x3003('0xa')](_0x3003('0xf'),auth[_0x3003('0x9')](),controller['getFields']);router[_0x3003('0x10')]('/',auth[_0x3003('0x9')](),controller[_0x3003('0x11')]);router[_0x3003('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x3003('0x12')]);router['put'](_0x3003('0xb'),auth[_0x3003('0x9')](),controller[_0x3003('0x13')]);router[_0x3003('0x14')](_0x3003('0xb'),auth[_0x3003('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf208=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','/:id','update','destroy','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf208,0x1c8));var _0x8f20=function(_0x3f0e5e,_0x10b9b7){_0x3f0e5e=_0x3f0e5e-0x0;var _0x36ca13=_0xf208[_0x3f0e5e];return _0x36ca13;};'use strict';var multer=require(_0x8f20('0x0'));var util=require(_0x8f20('0x1'));var path=require(_0x8f20('0x2'));var timeout=require(_0x8f20('0x3'));var express=require('express');var router=express[_0x8f20('0x4')]();var fs_extra=require(_0x8f20('0x5'));var auth=require(_0x8f20('0x6'));var interaction=require(_0x8f20('0x7'));var config=require(_0x8f20('0x8'));var controller=require(_0x8f20('0x9'));router[_0x8f20('0xa')]('/',auth[_0x8f20('0xb')](),controller['index']);router[_0x8f20('0xa')]('/:id',auth[_0x8f20('0xb')](),controller[_0x8f20('0xc')]);router[_0x8f20('0xa')]('/:id/configurations',auth[_0x8f20('0xb')](),controller[_0x8f20('0xd')]);router[_0x8f20('0xa')](_0x8f20('0xe'),auth[_0x8f20('0xb')](),controller['getFields']);router[_0x8f20('0xf')]('/',auth[_0x8f20('0xb')](),controller[_0x8f20('0x10')]);router[_0x8f20('0xf')](_0x8f20('0x11'),auth[_0x8f20('0xb')](),controller[_0x8f20('0x12')]);router['put'](_0x8f20('0x13'),auth[_0x8f20('0xb')](),controller[_0x8f20('0x14')]);router['delete']('/:id',auth[_0x8f20('0xb')](),controller[_0x8f20('0x15')]);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 deee0ec..7f7fbe5 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 _0x3cd8=['sequelize','exports','STRING','BOOLEAN'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x3cd8,0x150));var _0x83cd=function(_0x91ed5c,_0xdb6b34){_0x91ed5c=_0x91ed5c-0x0;var _0x2387d8=_0x3cd8[_0x91ed5c];return _0x2387d8;};'use strict';var Sequelize=require(_0x83cd('0x0'));module[_0x83cd('0x1')]={'name':{'type':Sequelize[_0x83cd('0x2')]},'username':{'type':Sequelize[_0x83cd('0x2')]},'password':{'type':Sequelize[_0x83cd('0x2')]},'remoteUri':{'type':Sequelize[_0x83cd('0x2')]},'tenantId':{'type':Sequelize[_0x83cd('0x2')]},'clientId':{'type':Sequelize[_0x83cd('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x83cd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x83cd('0x2')]},'modernAuthentication':{'type':Sequelize[_0x83cd('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe4b8=['BOOLEAN','sequelize','exports','STRING'];(function(_0x576462,_0x3a3ea9){var _0x97a241=function(_0x350c37){while(--_0x350c37){_0x576462['push'](_0x576462['shift']());}};_0x97a241(++_0x3a3ea9);}(_0xe4b8,0x179));var _0x8e4b=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xe4b8[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require(_0x8e4b('0x0'));module[_0x8e4b('0x1')]={'name':{'type':Sequelize[_0x8e4b('0x2')]},'username':{'type':Sequelize[_0x8e4b('0x2')]},'password':{'type':Sequelize[_0x8e4b('0x2')]},'remoteUri':{'type':Sequelize[_0x8e4b('0x2')]},'tenantId':{'type':Sequelize[_0x8e4b('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x8e4b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8e4b('0x2')]},'modernAuthentication':{'type':Sequelize[_0x8e4b('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 4085fe6..8461bb4 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 _0xd582=['responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','remoteUri','tenantId','clientId','modernAuthentication','data5','data7','access_token','CloudProvider','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','isNil','push','StringAttributeMetadata','DoubleAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','send',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','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','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','then','destroy','end','sendStatus','error','stack','name','map','Dynamics365Account','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','filters','length','options','find','body','update','getConfigurations','findOne','Dynamics365Configuration','pick','hasOwnProperty','addConfiguration','getSubjects','channel','getDescriptions','create','Dynamics365Field','Subjects','Descriptions','substring','lastIndexOf','format','%s/api/data/v9.0/','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xd582,0xff));var _0x2d58=function(_0x1be97a,_0x112d6d){_0x1be97a=_0x1be97a-0x0;var _0x489159=_0xd582[_0x1be97a];return _0x489159;};'use strict';var rp=require(_0x2d58('0x0'));var util=require(_0x2d58('0x1'));var _=require(_0x2d58('0x2'));var qs=require(_0x2d58('0x3'));var logger=require(_0x2d58('0x4'))(_0x2d58('0x5'));var db=require(_0x2d58('0x6'))['db'];var integrations=require(_0x2d58('0x7'));function respondWithResult(_0x45d81c,_0xdd572c){_0xdd572c=_0xdd572c||0xc8;return function(_0x2d47ea){if(_0x2d47ea){return _0x45d81c[_0x2d58('0x8')](_0xdd572c)[_0x2d58('0x9')](_0x2d47ea);}};}function respondWithFilteredResult(_0x363915,_0x45e5fd){return function(_0x16a5a1){if(_0x16a5a1){var _0x308218=typeof _0x45e5fd[_0x2d58('0xa')]==='undefined'&&typeof _0x45e5fd[_0x2d58('0xb')]===_0x2d58('0xc');var _0x4e0884=_0x16a5a1[_0x2d58('0xd')];var _0x29393a=_0x308218?0x0:_0x45e5fd[_0x2d58('0xa')];var _0x4cd55a=_0x308218?_0x16a5a1[_0x2d58('0xd')]:_0x45e5fd[_0x2d58('0xa')]+_0x45e5fd[_0x2d58('0xb')];var _0x32a76a;if(_0x4cd55a>=_0x4e0884){_0x4cd55a=_0x4e0884;_0x32a76a=0xc8;}else{_0x32a76a=0xce;}_0x363915[_0x2d58('0x8')](_0x32a76a);return _0x363915[_0x2d58('0xe')]('Content-Range',_0x29393a+'-'+_0x4cd55a+'/'+_0x4e0884)[_0x2d58('0x9')](_0x16a5a1);}return null;};}function saveUpdates(_0x35402d){return function(_0x8cbe17){if(_0x8cbe17){return _0x8cbe17['update'](_0x35402d)[_0x2d58('0xf')](function(_0x505518){return _0x505518;});}return null;};}function removeEntity(_0x55402d){return function(_0x69ad6c){if(_0x69ad6c){return _0x69ad6c[_0x2d58('0x10')]()[_0x2d58('0xf')](function(){_0x55402d['status'](0xcc)[_0x2d58('0x11')]();});}};}function handleEntityNotFound(_0x267712){return function(_0x7d3804){if(!_0x7d3804){_0x267712[_0x2d58('0x12')](0x194);}return _0x7d3804;};}function handleError(_0x35cc0e,_0x493998){_0x493998=_0x493998||0x1f4;return function(_0x3bd68c){logger[_0x2d58('0x13')](_0x3bd68c[_0x2d58('0x14')]);if(_0x3bd68c[_0x2d58('0x15')]){delete _0x3bd68c[_0x2d58('0x15')];}_0x35cc0e[_0x2d58('0x8')](_0x493998)['send'](_0x3bd68c);};}exports['index']=function(_0x2350b7,_0x455528){var _0x41719d={},_0x4e2d57={},_0x320921={'count':0x0,'rows':[]};var _0x3e8012=_[_0x2d58('0x16')](db[_0x2d58('0x17')]['rawAttributes'],function(_0x396c37){return{'name':_0x396c37['fieldName'],'type':_0x396c37[_0x2d58('0x18')][_0x2d58('0x19')]};});_0x4e2d57[_0x2d58('0x1a')]=_[_0x2d58('0x16')](_0x3e8012,_0x2d58('0x15'));_0x4e2d57[_0x2d58('0x1b')]=_[_0x2d58('0x1c')](_0x2350b7[_0x2d58('0x1b')]);_0x4e2d57['filters']=_['intersection'](_0x4e2d57['model'],_0x4e2d57['query']);_0x41719d['attributes']=_[_0x2d58('0x1d')](_0x4e2d57[_0x2d58('0x1a')],qs[_0x2d58('0x1e')](_0x2350b7[_0x2d58('0x1b')]['fields']));_0x41719d[_0x2d58('0x1f')]=_0x41719d['attributes']['length']?_0x41719d['attributes']:_0x4e2d57[_0x2d58('0x1a')];if(!_0x2350b7['query']['hasOwnProperty'](_0x2d58('0x20'))){_0x41719d[_0x2d58('0xb')]=qs[_0x2d58('0xb')](_0x2350b7[_0x2d58('0x1b')][_0x2d58('0xb')]);_0x41719d['offset']=qs[_0x2d58('0xa')](_0x2350b7[_0x2d58('0x1b')][_0x2d58('0xa')]);}_0x41719d[_0x2d58('0x21')]=qs[_0x2d58('0x22')](_0x2350b7[_0x2d58('0x1b')]['sort']);_0x41719d['where']=qs['filters'](_['pick'](_0x2350b7[_0x2d58('0x1b')],_0x4e2d57['filters']),_0x3e8012);if(_0x2350b7[_0x2d58('0x1b')]['filter']){_0x41719d[_0x2d58('0x23')]=_[_0x2d58('0x24')](_0x41719d[_0x2d58('0x23')],{'$or':_['map'](_0x3e8012,function(_0x19be1e){if(_0x19be1e['type']!=='VIRTUAL'){var _0x40b222={};_0x40b222[_0x19be1e['name']]={'$like':'%'+_0x2350b7['query'][_0x2d58('0x25')]+'%'};return _0x40b222;}})});}_0x41719d=_['merge']({},_0x41719d,_0x2350b7['options']);var _0x5d7b04={'where':_0x41719d[_0x2d58('0x23')]};return db['Dynamics365Account'][_0x2d58('0xd')](_0x5d7b04)['then'](function(_0x18881f){_0x320921[_0x2d58('0xd')]=_0x18881f;if(_0x2350b7[_0x2d58('0x1b')][_0x2d58('0x26')]){_0x41719d[_0x2d58('0x27')]=[{'all':!![]}];}return db[_0x2d58('0x17')]['findAll'](_0x41719d);})[_0x2d58('0xf')](function(_0x17fc7b){_0x320921[_0x2d58('0x28')]=_0x17fc7b;return _0x320921;})['then'](respondWithFilteredResult(_0x455528,_0x41719d))[_0x2d58('0x29')](handleError(_0x455528,null));};exports[_0x2d58('0x2a')]=function(_0x51a135,_0x10b67d){var _0x3b79c2={'raw':![],'where':{'id':_0x51a135[_0x2d58('0x2b')]['id']}},_0x3714dc={};_0x3714dc['model']=_[_0x2d58('0x1c')](db[_0x2d58('0x17')][_0x2d58('0x2c')]);_0x3714dc['query']=_[_0x2d58('0x1c')](_0x51a135[_0x2d58('0x1b')]);_0x3714dc[_0x2d58('0x2d')]=_[_0x2d58('0x1d')](_0x3714dc['model'],_0x3714dc[_0x2d58('0x1b')]);_0x3b79c2[_0x2d58('0x1f')]=_['intersection'](_0x3714dc[_0x2d58('0x1a')],qs[_0x2d58('0x1e')](_0x51a135[_0x2d58('0x1b')][_0x2d58('0x1e')]));_0x3b79c2[_0x2d58('0x1f')]=_0x3b79c2[_0x2d58('0x1f')][_0x2d58('0x2e')]?_0x3b79c2[_0x2d58('0x1f')]:_0x3714dc[_0x2d58('0x1a')];if(_0x51a135['query'][_0x2d58('0x26')]){_0x3b79c2[_0x2d58('0x27')]=[{'all':!![]}];}_0x3b79c2=_[_0x2d58('0x24')]({},_0x3b79c2,_0x51a135[_0x2d58('0x2f')]);return db['Dynamics365Account'][_0x2d58('0x30')](_0x3b79c2)[_0x2d58('0xf')](handleEntityNotFound(_0x10b67d,null))[_0x2d58('0xf')](respondWithResult(_0x10b67d,null))[_0x2d58('0x29')](handleError(_0x10b67d,null));};exports['create']=function(_0x3ce518,_0x4a3c2a){return db[_0x2d58('0x17')]['create'](_0x3ce518[_0x2d58('0x31')],{})[_0x2d58('0xf')](respondWithResult(_0x4a3c2a,0xc9))[_0x2d58('0x29')](handleError(_0x4a3c2a,null));};exports[_0x2d58('0x32')]=function(_0x17bcae,_0x18a88b){if(_0x17bcae[_0x2d58('0x31')]['id']){delete _0x17bcae[_0x2d58('0x31')]['id'];}return db['Dynamics365Account'][_0x2d58('0x30')]({'where':{'id':_0x17bcae[_0x2d58('0x2b')]['id']}})[_0x2d58('0xf')](handleEntityNotFound(_0x18a88b,null))[_0x2d58('0xf')](saveUpdates(_0x17bcae[_0x2d58('0x31')],null))[_0x2d58('0xf')](respondWithResult(_0x18a88b,null))['catch'](handleError(_0x18a88b,null));};exports[_0x2d58('0x10')]=function(_0x4b5a0c,_0x5822d1){return db[_0x2d58('0x17')][_0x2d58('0x30')]({'where':{'id':_0x4b5a0c[_0x2d58('0x2b')]['id']}})[_0x2d58('0xf')](handleEntityNotFound(_0x5822d1,null))['then'](removeEntity(_0x5822d1,null))[_0x2d58('0x29')](handleError(_0x5822d1,null));};exports[_0x2d58('0x33')]=function(_0x4647ef,_0x596040){var _0x4ac101={};var _0x3e421b={};var _0x13d9be;var _0x3d678a;return db[_0x2d58('0x17')][_0x2d58('0x34')]({'where':{'id':_0x4647ef[_0x2d58('0x2b')]['id']}})[_0x2d58('0xf')](handleEntityNotFound(_0x596040,null))[_0x2d58('0xf')](function(_0x3bd6cc){if(_0x3bd6cc){_0x13d9be=_0x3bd6cc;_0x3e421b['model']=_[_0x2d58('0x1c')](db[_0x2d58('0x35')][_0x2d58('0x2c')]);_0x3e421b[_0x2d58('0x1b')]=_[_0x2d58('0x1c')](_0x4647ef[_0x2d58('0x1b')]);_0x3e421b[_0x2d58('0x2d')]=_[_0x2d58('0x1d')](_0x3e421b[_0x2d58('0x1a')],_0x3e421b[_0x2d58('0x1b')]);_0x4ac101[_0x2d58('0x1f')]=_[_0x2d58('0x1d')](_0x3e421b[_0x2d58('0x1a')],qs[_0x2d58('0x1e')](_0x4647ef[_0x2d58('0x1b')]['fields']));_0x4ac101[_0x2d58('0x1f')]=_0x4ac101[_0x2d58('0x1f')][_0x2d58('0x2e')]?_0x4ac101[_0x2d58('0x1f')]:_0x3e421b[_0x2d58('0x1a')];_0x4ac101[_0x2d58('0x21')]=qs[_0x2d58('0x22')](_0x4647ef[_0x2d58('0x1b')][_0x2d58('0x22')]);_0x4ac101[_0x2d58('0x23')]=qs['filters'](_[_0x2d58('0x36')](_0x4647ef[_0x2d58('0x1b')],_0x3e421b[_0x2d58('0x2d')]));if(_0x4647ef[_0x2d58('0x1b')]['filter']){_0x4ac101[_0x2d58('0x23')]=_[_0x2d58('0x24')](_0x4ac101['where'],{'$or':_[_0x2d58('0x16')](_0x4ac101['attributes'],function(_0x2cdc5f){var _0x5e6ab2={};_0x5e6ab2[_0x2cdc5f]={'$like':'%'+_0x4647ef[_0x2d58('0x1b')][_0x2d58('0x25')]+'%'};return _0x5e6ab2;})});}_0x4ac101=_[_0x2d58('0x24')]({},_0x4ac101,_0x4647ef['options']);return _0x13d9be['getConfigurations'](_0x4ac101);}})['then'](function(_0xa6810b){if(_0xa6810b){_0x3d678a=_0xa6810b[_0x2d58('0x2e')];if(!_0x4647ef[_0x2d58('0x1b')][_0x2d58('0x37')](_0x2d58('0x20'))){_0x4ac101[_0x2d58('0xb')]=qs['limit'](_0x4647ef[_0x2d58('0x1b')][_0x2d58('0xb')]);_0x4ac101[_0x2d58('0xa')]=qs['offset'](_0x4647ef['query']['offset']);}return _0x13d9be[_0x2d58('0x33')](_0x4ac101);}})[_0x2d58('0xf')](function(_0xc32c48){if(_0xc32c48){return _0xc32c48?{'count':_0x3d678a,'rows':_0xc32c48}:null;}})[_0x2d58('0xf')](respondWithResult(_0x596040,null))[_0x2d58('0x29')](handleError(_0x596040,null));};exports[_0x2d58('0x38')]=function(_0x27c7a0,_0x5b32b5){if(_0x27c7a0['body']['id']){delete _0x27c7a0[_0x2d58('0x31')]['id'];}return db[_0x2d58('0x17')][_0x2d58('0x34')]({'where':{'id':_0x27c7a0[_0x2d58('0x2b')]['id']}})[_0x2d58('0xf')](handleEntityNotFound(_0x5b32b5,null))[_0x2d58('0xf')](function(_0x1c4f57){if(_0x1c4f57){_0x27c7a0[_0x2d58('0x31')]['AccountId']=_0x1c4f57['id'];_0x27c7a0['body']['Subjects']=integrations[_0x2d58('0x39')](_0x27c7a0['body'][_0x2d58('0x3a')],_0x27c7a0[_0x2d58('0x31')]['type']);_0x27c7a0[_0x2d58('0x31')]['Descriptions']=integrations[_0x2d58('0x3b')](_0x27c7a0[_0x2d58('0x31')]['channel'],_0x27c7a0[_0x2d58('0x31')][_0x2d58('0x18')]);return db['Dynamics365Configuration'][_0x2d58('0x3c')](_0x27c7a0['body'],{'include':[{'model':db[_0x2d58('0x3d')],'as':_0x2d58('0x3e')},{'model':db[_0x2d58('0x3d')],'as':_0x2d58('0x3f')}]});}return null;})[_0x2d58('0xf')](respondWithResult(_0x5b32b5,null))[_0x2d58('0x29')](handleError(_0x5b32b5,null));};function sanitizeRemoteUri(_0x4693ba){var _0x24cbdc=_0x4693ba['slice'](-0x1);if(_0x24cbdc==='/')return _0x4693ba[_0x2d58('0x40')](0x0,_0x4693ba[_0x2d58('0x41')](_0x24cbdc));return _0x4693ba;}function getWebApiUrl(_0x4df8a5){return util[_0x2d58('0x42')](_0x2d58('0x43'),_0x4df8a5);}exports['getFields']=function(_0x110628,_0x686d30){var _0x182424=_0x110628[_0x2d58('0x1b')][_0x2d58('0x44')];var _0x28660a=_0x182424===_0x2d58('0x45')?_0x2d58('0x46'):_0x2d58('0x47');var _0x13776f='';var _0x144769='';var _0x1f674b='';var _0x16fb1b='';var _0x1e8064='';var _0x114fcc='';var _0x16c27f='';var _0x5e8b31='';var _0x2ac55d=[_0x2d58('0x48'),_0x2d58('0x49'),_0x2d58('0x4a'),_0x2d58('0x4b'),_0x2d58('0x4c'),_0x2d58('0x4d'),_0x2d58('0x4e'),_0x2d58('0x4f'),'directioncode',_0x2d58('0x50')];var _0x3e0552=['accountidname',_0x2d58('0x51'),_0x2d58('0x52'),_0x2d58('0x53'),_0x2d58('0x54'),_0x2d58('0x55'),_0x2d58('0x56'),_0x2d58('0x57'),_0x2d58('0x58'),_0x2d58('0x59'),_0x2d58('0x5a'),_0x2d58('0x5b'),_0x2d58('0x5c'),_0x2d58('0x5d'),'createdonbehalfbyyominame',_0x2d58('0x5e'),_0x2d58('0x5f'),'customeridyominame',_0x2d58('0x60'),_0x2d58('0x61'),_0x2d58('0x62'),_0x2d58('0x63'),'escalatedon','exchangerate',_0x2d58('0x64'),_0x2d58('0x65'),_0x2d58('0x66'),_0x2d58('0x67'),_0x2d58('0x68'),_0x2d58('0x69'),_0x2d58('0x6a'),_0x2d58('0x6b'),'modifiedbyexternalpartyyominame',_0x2d58('0x6c'),_0x2d58('0x6d'),_0x2d58('0x6e'),_0x2d58('0x6f'),_0x2d58('0x70'),_0x2d58('0x71'),'msdyn_iotalertname','numberofchildincidents','onholdtime',_0x2d58('0x72'),_0x2d58('0x73'),_0x2d58('0x74'),'owneridyominame',_0x2d58('0x75'),_0x2d58('0x76'),_0x2d58('0x77'),_0x2d58('0x78'),_0x2d58('0x79'),_0x2d58('0x7a'),_0x2d58('0x7b'),_0x2d58('0x7c'),_0x2d58('0x7d'),_0x2d58('0x7e'),_0x2d58('0x7f'),_0x2d58('0x80'),_0x2d58('0x81'),'slaname','socialprofileidname',_0x2d58('0x82'),_0x2d58('0x83'),_0x2d58('0x84'),_0x2d58('0x85'),'timezoneruleversionnumber',_0x2d58('0x86'),_0x2d58('0x87'),'utcconversiontimezonecode',_0x2d58('0x88')];var _0x2e2010=_0x2ac55d[_0x2d58('0x89')](_0x3e0552);return db[_0x2d58('0x17')][_0x2d58('0x34')]({'where':{'id':_0x110628[_0x2d58('0x2b')]['id']},'attributes':['id',_0x2d58('0x8a'),'password',_0x2d58('0x8b'),_0x2d58('0x8c'),_0x2d58('0x8d'),'clientSecret',_0x2d58('0x8e')],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id',_0x2d58('0x8f'),_0x2d58('0x90')]}]})[_0x2d58('0xf')](handleEntityNotFound(_0x686d30,null))['then'](function(_0x5063d4){if(_0x5063d4){if(_0x5063d4[_0x2d58('0x8e')]){_0x5063d4[_0x2d58('0x91')]=_0x5063d4['CloudProvider'][_0x2d58('0x8f')];_0x5e8b31=sanitizeRemoteUri(_0x5063d4[_0x2d58('0x92')][_0x2d58('0x90')]);_0x16c27f=getWebApiUrl(_0x5e8b31);return _0x5063d4;}_0x5e8b31=sanitizeRemoteUri(_0x5063d4[_0x2d58('0x8b')]);_0x16c27f=getWebApiUrl(_0x5e8b31);var _0x240ecd={'method':_0x2d58('0x93'),'uri':_0x2d58('0x94')+_0x5063d4['tenantId']+_0x2d58('0x95'),'form':{'client_id':_0x5063d4[_0x2d58('0x8d')],'resource':_0x5e8b31,'username':_0x5063d4[_0x2d58('0x8a')],'password':_0x5063d4['password'],'grant_type':'password','client_secret':_0x5063d4[_0x2d58('0x96')]},'json':!![]};return rp(_0x240ecd);}})[_0x2d58('0xf')](function(_0x556b48){_0x114fcc=_0x556b48[_0x2d58('0x91')];var _0x33edaa={'method':_0x2d58('0x97'),'uri':encodeURI(_0x16c27f+_0x2d58('0x98')+_0x28660a+'\x27'),'headers':{'Authorization':_0x2d58('0x99')+_0x114fcc,'If-None-Match':null,'OData-Version':_0x2d58('0x9a')},'json':!![]};return rp(_0x33edaa);})[_0x2d58('0xf')](function(_0x48ff6e){var _0x312154=_0x48ff6e[_0x2d58('0x9b')][0x0];var _0x6860a8=_0x312154[_0x2d58('0x9c')];var _0x2e1c8d={'method':_0x2d58('0x97'),'uri':_0x16c27f+_0x2d58('0x9d')+_0x6860a8+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x2d58('0x99')+_0x114fcc,'If-None-Match':null,'OData-Version':_0x2d58('0x9a')},'json':!![]};return rp(_0x2e1c8d);})['then'](function(_0x27286c){_0x13776f=_0x27286c;_0x144769=_0x13776f[_0x2d58('0x9e')];_0x144769=_['remove'](_0x144769,function(_0x2c696a){return!_0x2e2010['includes'](_0x2c696a[_0x2d58('0x9f')]);});var _0x2aeb12=[];var _0x413ec9=[];_0x144769[_0x2d58('0xa0')](function(_0x158f65){if(_0x158f65['@odata.type']){var _0x33bf44=_0x158f65[_0x2d58('0xa1')]['substring'](_0x158f65[_0x2d58('0xa1')][_0x2d58('0x41')]('.')+0x1);if(_0x33bf44===_0x2d58('0xa2')){_0x2aeb12['push'](getSelectList(_0x16c27f,_0x182424,_0x413ec9,_0x13776f['MetadataId'],_0x158f65[_0x2d58('0x9c')],_0x114fcc));}}});return Promise['all'](_0x2aeb12);})[_0x2d58('0xf')](function(_0x33eee1){_0x1f674b=_0x33eee1[0x0];var _0x320cbf=[];var _0x12e151=[];_0x144769['forEach'](function(_0x39f829){if(!_[_0x2d58('0xa3')](_0x39f829[_0x2d58('0xa1')])){var _0x5462a7=_0x39f829['@odata.type']['substring'](_0x39f829[_0x2d58('0xa1')][_0x2d58('0x41')]('.')+0x1);if(_0x5462a7==='BooleanAttributeMetadata'){_0x320cbf[_0x2d58('0xa4')](getBooleanList(_0x16c27f,_0x182424,_0x12e151,_0x13776f['MetadataId'],_0x39f829[_0x2d58('0x9c')],_0x114fcc));}}});return Promise['all'](_0x320cbf);})['then'](function(_0x4df2de){_0x16fb1b=_0x4df2de[0x0];var _0x18667a=[];var _0x90bc0b=[];_0x144769[_0x2d58('0xa0')](function(_0x4170b4){if(_0x4170b4[_0x2d58('0xa1')]){var _0x357661=_0x4170b4[_0x2d58('0xa1')][_0x2d58('0x40')](_0x4170b4[_0x2d58('0xa1')][_0x2d58('0x41')]('.')+0x1);if(_0x357661===_0x2d58('0xa5')||_0x357661===_0x2d58('0xa6')||_0x357661==='BigIntAttributeMetadata'||_0x357661==='IntegerAttributeMetadata'||_0x357661===_0x2d58('0xa7')||_0x357661===_0x2d58('0xa8')||_0x357661===_0x2d58('0xa9')||_0x357661===_0x2d58('0xaa')||_0x357661===_0x2d58('0xab')||_0x357661==='DecimalAttributeMetadata'){_0x18667a[_0x2d58('0xa4')](getInputList(_0x16c27f,_0x182424,_0x357661,_0x90bc0b,_0x13776f[_0x2d58('0x9c')],_0x4170b4[_0x2d58('0x9c')],_0x114fcc));}}});return Promise['all'](_0x18667a);})[_0x2d58('0xf')](function(_0x5c7314){_0x1e8064=_0x5c7314[0x0];var _0x54aaca=_0x1f674b[_0x2d58('0x89')](_0x16fb1b)['concat'](_0x1e8064);var _0x163ca1={'count':_0x54aaca['length'],'rows':_0x54aaca};return _0x163ca1;})[_0x2d58('0xf')](respondWithResult(_0x686d30,null))[_0x2d58('0x29')](function(_0x33b72a){var _0x32df64=_0x110628[_0x2d58('0x1b')][_0x2d58('0xac')]?0x1f4:_0x33b72a[_0x2d58('0xad')]||0x1f4;logger[_0x2d58('0x13')](_0x33b72a[_0x2d58('0x14')]);delete _0x33b72a[_0x2d58('0x15')];if(_0x32df64===0x191){_0x32df64=0x190;}_0x686d30[_0x2d58('0x8')](_0x32df64)[_0x2d58('0xae')](_0x110628['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x33b72a[_0x2d58('0xad')]}:_0x33b72a);});};function getSelectList(_0x12dfb0,_0x16323d,_0x38ec7c,_0x884e66,_0x43cb0e,_0x1834cd){var _0x3e0da0={'method':_0x2d58('0x97'),'uri':_0x12dfb0+_0x2d58('0x9d')+_0x884e66+_0x2d58('0xaf')+_0x43cb0e+_0x2d58('0xb0')+_0x2d58('0xb1'),'headers':{'Authorization':_0x2d58('0x99')+_0x1834cd,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3e0da0)[_0x2d58('0xf')](function(_0x224515){var _0x5483f0=[];var _0x5bd260=_0x224515[_0x2d58('0xb2')][_0x2d58('0xb3')];_0x5bd260[_0x2d58('0xa0')](function(_0x388fac){_0x5483f0['push']({'name':_0x388fac[_0x2d58('0xb4')][_0x2d58('0xb5')][_0x2d58('0xb4')],'value':String(_0x388fac['Value'])});});var _0xf2de3f={'id':_0x16323d+'_'+_0x224515['LogicalName'],'name':_0x224515[_0x2d58('0xb6')][_0x2d58('0xb5')][_0x2d58('0xb4')],'custom':![],'options':_0x5483f0};_0x38ec7c[_0x2d58('0xa4')](_0xf2de3f);return _0x38ec7c;});}function getBooleanList(_0x2e85e8,_0x3392a8,_0x4f3d34,_0x2c5fa0,_0x1ffa1f,_0x333a83){var _0x4a1f5a={'method':_0x2d58('0x97'),'uri':_0x2e85e8+_0x2d58('0x9d')+_0x2c5fa0+_0x2d58('0xaf')+_0x1ffa1f+_0x2d58('0xb7'),'headers':{'Authorization':_0x2d58('0x99')+_0x333a83,'If-None-Match':null,'OData-Version':_0x2d58('0x9a')},'json':!![]};return rp(_0x4a1f5a)['then'](function(_0x29864b){var _0x40f247=[];_0x40f247[_0x2d58('0xa4')]({'name':_0x29864b['OptionSet'][_0x2d58('0xb8')][_0x2d58('0xb4')]['UserLocalizedLabel'][_0x2d58('0xb4')],'value':_0x2d58('0xb9')},{'name':_0x29864b[_0x2d58('0xb2')][_0x2d58('0xba')][_0x2d58('0xb4')]['UserLocalizedLabel'][_0x2d58('0xb4')],'value':_0x2d58('0xbb')});var _0x35cfa5={'id':_0x3392a8+'_'+_0x29864b[_0x2d58('0x9f')],'name':_0x29864b['DisplayName'][_0x2d58('0xb5')][_0x2d58('0xb4')],'custom':![],'options':_0x40f247};_0x4f3d34[_0x2d58('0xa4')](_0x35cfa5);return _0x4f3d34;});}function getInputList(_0x5a6b03,_0x6f0601,_0x56a3ac,_0x18363d,_0x4a2f90,_0x391b45,_0x463e3c){var _0x3ac241={'method':'GET','uri':_0x5a6b03+_0x2d58('0x9d')+_0x4a2f90+')/Attributes('+_0x391b45+_0x2d58('0xbc')+_0x56a3ac+_0x2d58('0xbd'),'headers':{'Authorization':_0x2d58('0x99')+_0x463e3c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3ac241)[_0x2d58('0xf')](function(_0x555e86){var _0x31046e={'id':_0x6f0601+'_'+_0x555e86[_0x2d58('0x9f')],'name':_0x555e86[_0x2d58('0xb6')][_0x2d58('0xb5')]?_0x555e86[_0x2d58('0xb6')]['UserLocalizedLabel'][_0x2d58('0xb4')]:_0x555e86[_0x2d58('0x9f')],'custom':![],'options':[]};_0x18363d[_0x2d58('0xa4')](_0x31046e);return _0x18363d;});} \ No newline at end of file +var _0x34fd=['entityimage_timestamp','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data7','data5','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','access_token','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','substring','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','EntityDefinitions(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Label','UserLocalizedLabel','LogicalName','DisplayName','GET',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','api','status','json','limit','count','offset','set','Content-Range','update','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','rows','catch','show','params','find','create','body','findOne','Dynamics365Configuration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','getDescriptions','Dynamics365Field','Subjects','Descriptions','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname'];(function(_0x1ba11b,_0x55368d){var _0x3aa543=function(_0x2ae700){while(--_0x2ae700){_0x1ba11b['push'](_0x1ba11b['shift']());}};_0x3aa543(++_0x55368d);}(_0x34fd,0x1d8));var _0xd34f=function(_0xbcb29f,_0x5f8ffe){_0xbcb29f=_0xbcb29f-0x0;var _0x5bbf7e=_0x34fd[_0xbcb29f];return _0x5bbf7e;};'use strict';var rp=require(_0xd34f('0x0'));var util=require(_0xd34f('0x1'));var _=require(_0xd34f('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xd34f('0x3'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x356d72,_0x4c635e){_0x4c635e=_0x4c635e||0xc8;return function(_0x2b4638){if(_0x2b4638){return _0x356d72[_0xd34f('0x4')](_0x4c635e)[_0xd34f('0x5')](_0x2b4638);}};}function respondWithFilteredResult(_0x1223dd,_0x119db6){return function(_0x2a42b7){if(_0x2a42b7){var _0x32eeb1=typeof _0x119db6['offset']==='undefined'&&typeof _0x119db6[_0xd34f('0x6')]==='undefined';var _0x51d603=_0x2a42b7[_0xd34f('0x7')];var _0x172ca1=_0x32eeb1?0x0:_0x119db6['offset'];var _0x271d9c=_0x32eeb1?_0x2a42b7['count']:_0x119db6[_0xd34f('0x8')]+_0x119db6[_0xd34f('0x6')];var _0x32970b;if(_0x271d9c>=_0x51d603){_0x271d9c=_0x51d603;_0x32970b=0xc8;}else{_0x32970b=0xce;}_0x1223dd['status'](_0x32970b);return _0x1223dd[_0xd34f('0x9')](_0xd34f('0xa'),_0x172ca1+'-'+_0x271d9c+'/'+_0x51d603)[_0xd34f('0x5')](_0x2a42b7);}return null;};}function saveUpdates(_0x3e0b17){return function(_0x3c6cec){if(_0x3c6cec){return _0x3c6cec[_0xd34f('0xb')](_0x3e0b17)['then'](function(_0x23497f){return _0x23497f;});}return null;};}function removeEntity(_0x32654f){return function(_0x130aaf){if(_0x130aaf){return _0x130aaf[_0xd34f('0xc')]()['then'](function(){_0x32654f['status'](0xcc)[_0xd34f('0xd')]();});}};}function handleEntityNotFound(_0x1e68fc){return function(_0x5bf20c){if(!_0x5bf20c){_0x1e68fc[_0xd34f('0xe')](0x194);}return _0x5bf20c;};}function handleError(_0x24124b,_0x5224a1){_0x5224a1=_0x5224a1||0x1f4;return function(_0x461c31){logger[_0xd34f('0xf')](_0x461c31[_0xd34f('0x10')]);if(_0x461c31['name']){delete _0x461c31[_0xd34f('0x11')];}_0x24124b['status'](_0x5224a1)[_0xd34f('0x12')](_0x461c31);};}exports[_0xd34f('0x13')]=function(_0x5b542d,_0x7b9c65){var _0x5a8466={},_0x2040d5={},_0x3fa6f6={'count':0x0,'rows':[]};var _0x5b4e4f=_[_0xd34f('0x14')](db[_0xd34f('0x15')][_0xd34f('0x16')],function(_0x554434){return{'name':_0x554434[_0xd34f('0x17')],'type':_0x554434[_0xd34f('0x18')][_0xd34f('0x19')]};});_0x2040d5['model']=_[_0xd34f('0x14')](_0x5b4e4f,_0xd34f('0x11'));_0x2040d5[_0xd34f('0x1a')]=_[_0xd34f('0x1b')](_0x5b542d[_0xd34f('0x1a')]);_0x2040d5[_0xd34f('0x1c')]=_['intersection'](_0x2040d5[_0xd34f('0x1d')],_0x2040d5[_0xd34f('0x1a')]);_0x5a8466[_0xd34f('0x1e')]=_[_0xd34f('0x1f')](_0x2040d5['model'],qs['fields'](_0x5b542d['query'][_0xd34f('0x20')]));_0x5a8466['attributes']=_0x5a8466[_0xd34f('0x1e')][_0xd34f('0x21')]?_0x5a8466[_0xd34f('0x1e')]:_0x2040d5[_0xd34f('0x1d')];if(!_0x5b542d[_0xd34f('0x1a')]['hasOwnProperty'](_0xd34f('0x22'))){_0x5a8466[_0xd34f('0x6')]=qs[_0xd34f('0x6')](_0x5b542d[_0xd34f('0x1a')]['limit']);_0x5a8466[_0xd34f('0x8')]=qs[_0xd34f('0x8')](_0x5b542d[_0xd34f('0x1a')][_0xd34f('0x8')]);}_0x5a8466[_0xd34f('0x23')]=qs[_0xd34f('0x24')](_0x5b542d['query'][_0xd34f('0x24')]);_0x5a8466[_0xd34f('0x25')]=qs[_0xd34f('0x1c')](_[_0xd34f('0x26')](_0x5b542d['query'],_0x2040d5[_0xd34f('0x1c')]),_0x5b4e4f);if(_0x5b542d['query'][_0xd34f('0x27')]){_0x5a8466['where']=_[_0xd34f('0x28')](_0x5a8466[_0xd34f('0x25')],{'$or':_[_0xd34f('0x14')](_0x5b4e4f,function(_0x2c96f8){if(_0x2c96f8[_0xd34f('0x18')]!==_0xd34f('0x29')){var _0x58c29f={};_0x58c29f[_0x2c96f8['name']]={'$like':'%'+_0x5b542d[_0xd34f('0x1a')][_0xd34f('0x27')]+'%'};return _0x58c29f;}})});}_0x5a8466=_[_0xd34f('0x28')]({},_0x5a8466,_0x5b542d[_0xd34f('0x2a')]);var _0xfcf82f={'where':_0x5a8466[_0xd34f('0x25')]};return db[_0xd34f('0x15')][_0xd34f('0x7')](_0xfcf82f)[_0xd34f('0x2b')](function(_0x55db19){_0x3fa6f6[_0xd34f('0x7')]=_0x55db19;if(_0x5b542d[_0xd34f('0x1a')][_0xd34f('0x2c')]){_0x5a8466[_0xd34f('0x2d')]=[{'all':!![]}];}return db[_0xd34f('0x15')]['findAll'](_0x5a8466);})[_0xd34f('0x2b')](function(_0x1180a9){_0x3fa6f6[_0xd34f('0x2e')]=_0x1180a9;return _0x3fa6f6;})[_0xd34f('0x2b')](respondWithFilteredResult(_0x7b9c65,_0x5a8466))[_0xd34f('0x2f')](handleError(_0x7b9c65,null));};exports[_0xd34f('0x30')]=function(_0x54c037,_0x47147c){var _0x5dc0fb={'raw':![],'where':{'id':_0x54c037[_0xd34f('0x31')]['id']}},_0x3ceb94={};_0x3ceb94[_0xd34f('0x1d')]=_[_0xd34f('0x1b')](db[_0xd34f('0x15')][_0xd34f('0x16')]);_0x3ceb94['query']=_[_0xd34f('0x1b')](_0x54c037[_0xd34f('0x1a')]);_0x3ceb94[_0xd34f('0x1c')]=_[_0xd34f('0x1f')](_0x3ceb94[_0xd34f('0x1d')],_0x3ceb94['query']);_0x5dc0fb[_0xd34f('0x1e')]=_['intersection'](_0x3ceb94[_0xd34f('0x1d')],qs[_0xd34f('0x20')](_0x54c037[_0xd34f('0x1a')]['fields']));_0x5dc0fb[_0xd34f('0x1e')]=_0x5dc0fb[_0xd34f('0x1e')][_0xd34f('0x21')]?_0x5dc0fb['attributes']:_0x3ceb94[_0xd34f('0x1d')];if(_0x54c037[_0xd34f('0x1a')]['includeAll']){_0x5dc0fb[_0xd34f('0x2d')]=[{'all':!![]}];}_0x5dc0fb=_[_0xd34f('0x28')]({},_0x5dc0fb,_0x54c037[_0xd34f('0x2a')]);return db[_0xd34f('0x15')][_0xd34f('0x32')](_0x5dc0fb)[_0xd34f('0x2b')](handleEntityNotFound(_0x47147c,null))[_0xd34f('0x2b')](respondWithResult(_0x47147c,null))[_0xd34f('0x2f')](handleError(_0x47147c,null));};exports[_0xd34f('0x33')]=function(_0x12fdd3,_0x454f8f){return db[_0xd34f('0x15')][_0xd34f('0x33')](_0x12fdd3[_0xd34f('0x34')],{})[_0xd34f('0x2b')](respondWithResult(_0x454f8f,0xc9))[_0xd34f('0x2f')](handleError(_0x454f8f,null));};exports[_0xd34f('0xb')]=function(_0x5db4cc,_0x4b6b81){if(_0x5db4cc[_0xd34f('0x34')]['id']){delete _0x5db4cc[_0xd34f('0x34')]['id'];}return db['Dynamics365Account'][_0xd34f('0x32')]({'where':{'id':_0x5db4cc['params']['id']}})[_0xd34f('0x2b')](handleEntityNotFound(_0x4b6b81,null))[_0xd34f('0x2b')](saveUpdates(_0x5db4cc['body'],null))['then'](respondWithResult(_0x4b6b81,null))['catch'](handleError(_0x4b6b81,null));};exports[_0xd34f('0xc')]=function(_0x5b6ddf,_0x29c688){return db[_0xd34f('0x15')]['find']({'where':{'id':_0x5b6ddf[_0xd34f('0x31')]['id']}})[_0xd34f('0x2b')](handleEntityNotFound(_0x29c688,null))['then'](removeEntity(_0x29c688,null))[_0xd34f('0x2f')](handleError(_0x29c688,null));};exports['getConfigurations']=function(_0x4df170,_0x52cddf){var _0x81212e={};var _0x2e617a={};var _0xe1ea47;var _0x122fd0;return db['Dynamics365Account'][_0xd34f('0x35')]({'where':{'id':_0x4df170[_0xd34f('0x31')]['id']}})[_0xd34f('0x2b')](handleEntityNotFound(_0x52cddf,null))[_0xd34f('0x2b')](function(_0x278218){if(_0x278218){_0xe1ea47=_0x278218;_0x2e617a[_0xd34f('0x1d')]=_[_0xd34f('0x1b')](db[_0xd34f('0x36')][_0xd34f('0x16')]);_0x2e617a[_0xd34f('0x1a')]=_[_0xd34f('0x1b')](_0x4df170[_0xd34f('0x1a')]);_0x2e617a[_0xd34f('0x1c')]=_['intersection'](_0x2e617a[_0xd34f('0x1d')],_0x2e617a[_0xd34f('0x1a')]);_0x81212e[_0xd34f('0x1e')]=_[_0xd34f('0x1f')](_0x2e617a['model'],qs[_0xd34f('0x20')](_0x4df170[_0xd34f('0x1a')][_0xd34f('0x20')]));_0x81212e[_0xd34f('0x1e')]=_0x81212e[_0xd34f('0x1e')]['length']?_0x81212e['attributes']:_0x2e617a[_0xd34f('0x1d')];_0x81212e[_0xd34f('0x23')]=qs[_0xd34f('0x24')](_0x4df170['query']['sort']);_0x81212e[_0xd34f('0x25')]=qs[_0xd34f('0x1c')](_[_0xd34f('0x26')](_0x4df170[_0xd34f('0x1a')],_0x2e617a[_0xd34f('0x1c')]));if(_0x4df170['query'][_0xd34f('0x27')]){_0x81212e[_0xd34f('0x25')]=_[_0xd34f('0x28')](_0x81212e['where'],{'$or':_[_0xd34f('0x14')](_0x81212e[_0xd34f('0x1e')],function(_0x50f639){var _0x304569={};_0x304569[_0x50f639]={'$like':'%'+_0x4df170[_0xd34f('0x1a')][_0xd34f('0x27')]+'%'};return _0x304569;})});}_0x81212e=_[_0xd34f('0x28')]({},_0x81212e,_0x4df170[_0xd34f('0x2a')]);return _0xe1ea47[_0xd34f('0x37')](_0x81212e);}})[_0xd34f('0x2b')](function(_0xb870c7){if(_0xb870c7){_0x122fd0=_0xb870c7[_0xd34f('0x21')];if(!_0x4df170[_0xd34f('0x1a')][_0xd34f('0x38')](_0xd34f('0x22'))){_0x81212e['limit']=qs[_0xd34f('0x6')](_0x4df170['query']['limit']);_0x81212e[_0xd34f('0x8')]=qs[_0xd34f('0x8')](_0x4df170[_0xd34f('0x1a')][_0xd34f('0x8')]);}return _0xe1ea47[_0xd34f('0x37')](_0x81212e);}})[_0xd34f('0x2b')](function(_0x5dad63){if(_0x5dad63){return _0x5dad63?{'count':_0x122fd0,'rows':_0x5dad63}:null;}})[_0xd34f('0x2b')](respondWithResult(_0x52cddf,null))['catch'](handleError(_0x52cddf,null));};exports[_0xd34f('0x39')]=function(_0x2d8fc4,_0x25a8d9){if(_0x2d8fc4[_0xd34f('0x34')]['id']){delete _0x2d8fc4['body']['id'];}return db[_0xd34f('0x15')][_0xd34f('0x35')]({'where':{'id':_0x2d8fc4['params']['id']}})[_0xd34f('0x2b')](handleEntityNotFound(_0x25a8d9,null))[_0xd34f('0x2b')](function(_0x299f0b){if(_0x299f0b){_0x2d8fc4[_0xd34f('0x34')][_0xd34f('0x3a')]=_0x299f0b['id'];_0x2d8fc4['body']['Subjects']=integrations[_0xd34f('0x3b')](_0x2d8fc4[_0xd34f('0x34')][_0xd34f('0x3c')],_0x2d8fc4['body'][_0xd34f('0x18')]);_0x2d8fc4['body']['Descriptions']=integrations[_0xd34f('0x3d')](_0x2d8fc4[_0xd34f('0x34')][_0xd34f('0x3c')],_0x2d8fc4[_0xd34f('0x34')]['type']);return db['Dynamics365Configuration'][_0xd34f('0x33')](_0x2d8fc4['body'],{'include':[{'model':db[_0xd34f('0x3e')],'as':_0xd34f('0x3f')},{'model':db[_0xd34f('0x3e')],'as':_0xd34f('0x40')}]});}return null;})[_0xd34f('0x2b')](respondWithResult(_0x25a8d9,null))[_0xd34f('0x2f')](handleError(_0x25a8d9,null));};function sanitizeRemoteUri(_0x17e9bf){var _0x40289c=_0x17e9bf[_0xd34f('0x41')](-0x1);if(_0x40289c==='/')return _0x17e9bf['substring'](0x0,_0x17e9bf[_0xd34f('0x42')](_0x40289c));return _0x17e9bf;}function getWebApiUrl(_0x5a6e2a){return util[_0xd34f('0x43')](_0xd34f('0x44'),_0x5a6e2a);}exports[_0xd34f('0x45')]=function(_0x2a57d5,_0x527064){var _0x22e83e=_0x2a57d5[_0xd34f('0x1a')][_0xd34f('0x46')];var _0x1413fa=_0x22e83e===_0xd34f('0x47')?_0xd34f('0x48'):_0xd34f('0x49');var _0x38b805='';var _0x242092='';var _0x4e4b44='';var _0x49948='';var _0x45b470='';var _0x495ea8='';var _0x136ed9='';var _0x2fc54c='';var _0x23652a=[_0xd34f('0x4a'),_0xd34f('0x4b'),_0xd34f('0x4c'),_0xd34f('0x4d'),_0xd34f('0x4e'),_0xd34f('0x4f'),_0xd34f('0x50'),_0xd34f('0x51'),'directioncode',_0xd34f('0x52')];var _0x24bb26=[_0xd34f('0x53'),'accountidyominame','actualserviceunits',_0xd34f('0x54'),'contactidname',_0xd34f('0x55'),_0xd34f('0x56'),_0xd34f('0x57'),_0xd34f('0x58'),'createdbyexternalpartyyominame',_0xd34f('0x59'),_0xd34f('0x5a'),_0xd34f('0x5b'),_0xd34f('0x5c'),_0xd34f('0x5d'),'customeridname',_0xd34f('0x5e'),_0xd34f('0x5f'),_0xd34f('0x60'),_0xd34f('0x61'),_0xd34f('0x62'),'entityimage_url','escalatedon',_0xd34f('0x63'),_0xd34f('0x64'),_0xd34f('0x65'),_0xd34f('0x66'),_0xd34f('0x67'),_0xd34f('0x68'),_0xd34f('0x69'),_0xd34f('0x6a'),_0xd34f('0x6b'),'modifiedbyexternalpartyyominame',_0xd34f('0x6c'),_0xd34f('0x6d'),_0xd34f('0x6e'),_0xd34f('0x6f'),_0xd34f('0x70'),_0xd34f('0x71'),'msdyn_iotalertname',_0xd34f('0x72'),_0xd34f('0x73'),'overriddencreatedon',_0xd34f('0x74'),_0xd34f('0x75'),_0xd34f('0x76'),_0xd34f('0x77'),_0xd34f('0x78'),'primarycontactidyominame','prioritycodename','productidname','productserialnumber',_0xd34f('0x79'),_0xd34f('0x7a'),_0xd34f('0x7b'),_0xd34f('0x7c'),_0xd34f('0x7d'),_0xd34f('0x7e'),_0xd34f('0x7f'),'slaname',_0xd34f('0x80'),_0xd34f('0x81'),_0xd34f('0x82'),_0xd34f('0x83'),'ticketnumber','timezoneruleversionnumber',_0xd34f('0x84'),_0xd34f('0x85'),_0xd34f('0x86'),_0xd34f('0x87')];var _0x32de65=_0x23652a[_0xd34f('0x88')](_0x24bb26);return db['Dynamics365Account'][_0xd34f('0x35')]({'where':{'id':_0x2a57d5[_0xd34f('0x31')]['id']},'attributes':['id','username',_0xd34f('0x89'),_0xd34f('0x8a'),'tenantId',_0xd34f('0x8b'),_0xd34f('0x8c'),_0xd34f('0x8d')],'include':[{'model':db[_0xd34f('0x8e')],'as':_0xd34f('0x8e'),'attributes':['id','data5',_0xd34f('0x8f')]}]})['then'](handleEntityNotFound(_0x527064,null))[_0xd34f('0x2b')](function(_0x22d4ab){if(_0x22d4ab){if(_0x22d4ab[_0xd34f('0x8d')]){_0x22d4ab['access_token']=_0x22d4ab['CloudProvider'][_0xd34f('0x90')];_0x2fc54c=sanitizeRemoteUri(_0x22d4ab[_0xd34f('0x8e')]['data7']);_0x136ed9=getWebApiUrl(_0x2fc54c);return _0x22d4ab;}_0x2fc54c=sanitizeRemoteUri(_0x22d4ab['remoteUri']);_0x136ed9=getWebApiUrl(_0x2fc54c);var _0x3024d5={'method':_0xd34f('0x91'),'uri':_0xd34f('0x92')+_0x22d4ab[_0xd34f('0x93')]+_0xd34f('0x94'),'form':{'client_id':_0x22d4ab['clientId'],'resource':_0x2fc54c,'username':_0x22d4ab['username'],'password':_0x22d4ab[_0xd34f('0x89')],'grant_type':_0xd34f('0x89'),'client_secret':_0x22d4ab[_0xd34f('0x8c')]},'json':!![]};return rp(_0x3024d5);}})['then'](function(_0x426362){_0x495ea8=_0x426362[_0xd34f('0x95')];var _0x4f0f9e={'method':'GET','uri':encodeURI(_0x136ed9+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x1413fa+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x495ea8,'If-None-Match':null,'OData-Version':_0xd34f('0x96')},'json':!![]};return rp(_0x4f0f9e);})[_0xd34f('0x2b')](function(_0x56e206){var _0x4ec641=_0x56e206[_0xd34f('0x97')][0x0];var _0x4b43e2=_0x4ec641[_0xd34f('0x98')];var _0x29072f={'method':'GET','uri':_0x136ed9+'EntityDefinitions('+_0x4b43e2+_0xd34f('0x99'),'headers':{'Authorization':'Bearer\x20'+_0x495ea8,'If-None-Match':null,'OData-Version':_0xd34f('0x96')},'json':!![]};return rp(_0x29072f);})['then'](function(_0x5e9784){_0x38b805=_0x5e9784;_0x242092=_0x38b805[_0xd34f('0x9a')];_0x242092=_[_0xd34f('0x9b')](_0x242092,function(_0x2bc128){return!_0x32de65[_0xd34f('0x9c')](_0x2bc128['LogicalName']);});var _0x54e48d=[];var _0x2e5737=[];_0x242092[_0xd34f('0x9d')](function(_0x209ff2){if(_0x209ff2[_0xd34f('0x9e')]){var _0x3f29ef=_0x209ff2[_0xd34f('0x9e')]['substring'](_0x209ff2[_0xd34f('0x9e')]['lastIndexOf']('.')+0x1);if(_0x3f29ef===_0xd34f('0x9f')){_0x54e48d[_0xd34f('0xa0')](getSelectList(_0x136ed9,_0x22e83e,_0x2e5737,_0x38b805[_0xd34f('0x98')],_0x209ff2[_0xd34f('0x98')],_0x495ea8));}}});return Promise[_0xd34f('0xa1')](_0x54e48d);})['then'](function(_0x315fb0){_0x4e4b44=_0x315fb0[0x0];var _0x549fb2=[];var _0x360719=[];_0x242092[_0xd34f('0x9d')](function(_0x195a89){if(!_[_0xd34f('0xa2')](_0x195a89[_0xd34f('0x9e')])){var _0x4d4a73=_0x195a89[_0xd34f('0x9e')][_0xd34f('0xa3')](_0x195a89['@odata.type']['lastIndexOf']('.')+0x1);if(_0x4d4a73===_0xd34f('0xa4')){_0x549fb2[_0xd34f('0xa0')](getBooleanList(_0x136ed9,_0x22e83e,_0x360719,_0x38b805[_0xd34f('0x98')],_0x195a89[_0xd34f('0x98')],_0x495ea8));}}});return Promise[_0xd34f('0xa1')](_0x549fb2);})[_0xd34f('0x2b')](function(_0x24a61a){_0x49948=_0x24a61a[0x0];var _0x1a2492=[];var _0x25ac05=[];_0x242092['forEach'](function(_0x372f35){if(_0x372f35['@odata.type']){var _0x1befd8=_0x372f35[_0xd34f('0x9e')][_0xd34f('0xa3')](_0x372f35[_0xd34f('0x9e')][_0xd34f('0x42')]('.')+0x1);if(_0x1befd8===_0xd34f('0xa5')||_0x1befd8===_0xd34f('0xa6')||_0x1befd8==='BigIntAttributeMetadata'||_0x1befd8===_0xd34f('0xa7')||_0x1befd8===_0xd34f('0xa8')||_0x1befd8===_0xd34f('0xa9')||_0x1befd8===_0xd34f('0xaa')||_0x1befd8===_0xd34f('0xab')||_0x1befd8==='StateAttributeMetadata'||_0x1befd8===_0xd34f('0xac')){_0x1a2492['push'](getInputList(_0x136ed9,_0x22e83e,_0x1befd8,_0x25ac05,_0x38b805[_0xd34f('0x98')],_0x372f35[_0xd34f('0x98')],_0x495ea8));}}});return Promise['all'](_0x1a2492);})[_0xd34f('0x2b')](function(_0x2582f1){_0x45b470=_0x2582f1[0x0];var _0x6def38=_0x4e4b44['concat'](_0x49948)[_0xd34f('0x88')](_0x45b470);var _0x385deb={'count':_0x6def38['length'],'rows':_0x6def38};return _0x385deb;})[_0xd34f('0x2b')](respondWithResult(_0x527064,null))['catch'](function(_0x38bdde){var _0x3f447a=_0x2a57d5['query'][_0xd34f('0xad')]?0x1f4:_0x38bdde['statusCode']||0x1f4;logger['error'](_0x38bdde[_0xd34f('0x10')]);delete _0x38bdde[_0xd34f('0x11')];if(_0x3f447a===0x191){_0x3f447a=0x190;}_0x527064[_0xd34f('0x4')](_0x3f447a)[_0xd34f('0x12')](_0x2a57d5['query'][_0xd34f('0xad')]?{'message':'Wrong\x20credentials','statusCode':_0x38bdde[_0xd34f('0xae')]}:_0x38bdde);});};function getSelectList(_0xaa2374,_0x37d208,_0x32a5b6,_0x2be55e,_0x2ebd26,_0x557b7c){var _0x3a6b9f={'method':'GET','uri':_0xaa2374+_0xd34f('0xaf')+_0x2be55e+')/Attributes('+_0x2ebd26+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xd34f('0xb0'),'headers':{'Authorization':_0xd34f('0xb1')+_0x557b7c,'If-None-Match':null,'OData-Version':_0xd34f('0x96')},'json':!![]};return rp(_0x3a6b9f)['then'](function(_0x57207b){var _0x3f56d5=[];var _0x4d5411=_0x57207b[_0xd34f('0xb2')]['Options'];_0x4d5411['forEach'](function(_0x1177e2){_0x3f56d5['push']({'name':_0x1177e2[_0xd34f('0xb3')][_0xd34f('0xb4')][_0xd34f('0xb3')],'value':String(_0x1177e2['Value'])});});var _0x2b1f90={'id':_0x37d208+'_'+_0x57207b[_0xd34f('0xb5')],'name':_0x57207b[_0xd34f('0xb6')][_0xd34f('0xb4')]['Label'],'custom':![],'options':_0x3f56d5};_0x32a5b6['push'](_0x2b1f90);return _0x32a5b6;});}function getBooleanList(_0x49f998,_0x2bc268,_0x1737b0,_0x2ba192,_0x11a7a7,_0x553b38){var _0x668001={'method':_0xd34f('0xb7'),'uri':_0x49f998+'EntityDefinitions('+_0x2ba192+_0xd34f('0xb8')+_0x11a7a7+_0xd34f('0xb9'),'headers':{'Authorization':_0xd34f('0xb1')+_0x553b38,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x668001)[_0xd34f('0x2b')](function(_0x4321cb){var _0xcb4984=[];_0xcb4984[_0xd34f('0xa0')]({'name':_0x4321cb[_0xd34f('0xb2')][_0xd34f('0xba')]['Label'][_0xd34f('0xb4')][_0xd34f('0xb3')],'value':'true'},{'name':_0x4321cb['OptionSet']['FalseOption'][_0xd34f('0xb3')][_0xd34f('0xb4')][_0xd34f('0xb3')],'value':_0xd34f('0xbb')});var _0x372e56={'id':_0x2bc268+'_'+_0x4321cb[_0xd34f('0xb5')],'name':_0x4321cb['DisplayName'][_0xd34f('0xb4')]['Label'],'custom':![],'options':_0xcb4984};_0x1737b0[_0xd34f('0xa0')](_0x372e56);return _0x1737b0;});}function getInputList(_0x57c560,_0x9b2a9b,_0x2ee986,_0x467389,_0x483e03,_0x3aae9e,_0x160540){var _0x12fe51={'method':_0xd34f('0xb7'),'uri':_0x57c560+_0xd34f('0xaf')+_0x483e03+_0xd34f('0xb8')+_0x3aae9e+_0xd34f('0xbc')+_0x2ee986+_0xd34f('0xbd'),'headers':{'Authorization':_0xd34f('0xb1')+_0x160540,'If-None-Match':null,'OData-Version':_0xd34f('0x96')},'json':!![]};return rp(_0x12fe51)['then'](function(_0x1236c0){var _0x26dc5c={'id':_0x9b2a9b+'_'+_0x1236c0[_0xd34f('0xb5')],'name':_0x1236c0[_0xd34f('0xb6')][_0xd34f('0xb4')]?_0x1236c0[_0xd34f('0xb6')][_0xd34f('0xb4')][_0xd34f('0xb3')]:_0x1236c0[_0xd34f('0xb5')],'custom':![],'options':[]};_0x467389[_0xd34f('0xa0')](_0x26dc5c);return _0x467389;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index a610373..6525da0 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x3f0c9d,_0x5ac4fd){var _0x33ca64=function(_0xe93592){while(--_0xe93592){_0x3f0c9d['push'](_0x3f0c9d['shift']());}};_0x33ca64(++_0x5ac4fd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _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(_0x2bcb3b,_0x2cbc91){var _0x19dd7f=function(_0x32238a){while(--_0x32238a){_0x2bcb3b['push'](_0x2bcb3b['shift']());}};_0x19dd7f(++_0x2cbc91);}(_0xe706,0xa3));var _0x6e70=function(_0x3793bb,_0x39dfdd){_0x3793bb=_0x3793bb-0x0;var _0x380006=_0xe706[_0x3793bb];return _0x380006;};'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 e375134..1dfa4a7 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 _0xbbc3=['debug','stringify','error','message','info','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit','include','map','model','ShowDynamics365Account','find','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent'];(function(_0x100b16,_0x2cc897){var _0x2e4e63=function(_0x38a274){while(--_0x38a274){_0x100b16['push'](_0x100b16['shift']());}};_0x2e4e63(++_0x2cc897);}(_0xbbc3,0x9b));var _0x3bbc=function(_0x889929,_0xd4d248){_0x889929=_0x889929-0x0;var _0x33b915=_0xbbc3[_0x889929];return _0x33b915;};'use strict';var _=require('lodash');var util=require(_0x3bbc('0x0'));var moment=require(_0x3bbc('0x1'));var BPromise=require('bluebird');var rs=require(_0x3bbc('0x2'));var fs=require('fs');var Redis=require(_0x3bbc('0x3'));var db=require(_0x3bbc('0x4'))['db'];var utils=require(_0x3bbc('0x5'));var logger=require('../../config/logger')(_0x3bbc('0x6'));var config=require(_0x3bbc('0x7'));var jayson=require(_0x3bbc('0x8'));var client=jayson[_0x3bbc('0x9')][_0x3bbc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bd915,_0x5c782f,_0x5d1315){return new BPromise(function(_0x3714f0,_0x2d9484){return client[_0x3bbc('0xb')](_0x5bd915,_0x5d1315)[_0x3bbc('0xc')](function(_0x52a5ce){logger['info'](_0x3bbc('0xd'),_0x5c782f,_0x3bbc('0xe'));logger[_0x3bbc('0xf')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x5c782f,_0x3bbc('0xe'),JSON[_0x3bbc('0x10')](_0x52a5ce));if(_0x52a5ce['error']){if(_0x52a5ce[_0x3bbc('0x11')]['code']===0x1f4){logger[_0x3bbc('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x5c782f,_0x52a5ce[_0x3bbc('0x11')][_0x3bbc('0x12')]);return _0x2d9484(_0x52a5ce[_0x3bbc('0x11')][_0x3bbc('0x12')]);}logger[_0x3bbc('0x11')](_0x3bbc('0xd'),_0x5c782f,_0x52a5ce[_0x3bbc('0x11')][_0x3bbc('0x12')]);return _0x3714f0(_0x52a5ce[_0x3bbc('0x11')][_0x3bbc('0x12')]);}else{logger[_0x3bbc('0x13')](_0x3bbc('0xd'),_0x5c782f,_0x3bbc('0xe'));_0x3714f0(_0x52a5ce[_0x3bbc('0x14')][_0x3bbc('0x12')]);}})[_0x3bbc('0x15')](function(_0x5cc01a){logger['error'](_0x3bbc('0xd'),_0x5c782f,_0x5cc01a);_0x2d9484(_0x5cc01a);});});}exports[_0x3bbc('0x16')]=function(_0x56f7f2){var _0x2c1462=this;return new Promise(function(_0x5cbc09,_0x3bcd4a){return db[_0x3bbc('0x17')]['findAll']({'raw':_0x56f7f2[_0x3bbc('0x18')]?_0x56f7f2[_0x3bbc('0x18')][_0x3bbc('0x19')]===undefined?!![]:![]:!![],'where':_0x56f7f2[_0x3bbc('0x18')]?_0x56f7f2[_0x3bbc('0x18')][_0x3bbc('0x1a')]||null:null,'attributes':_0x56f7f2[_0x3bbc('0x18')]?_0x56f7f2[_0x3bbc('0x18')][_0x3bbc('0x1b')]||null:null,'limit':_0x56f7f2[_0x3bbc('0x18')]?_0x56f7f2[_0x3bbc('0x18')][_0x3bbc('0x1c')]||null:null,'include':_0x56f7f2['options']?_0x56f7f2[_0x3bbc('0x18')][_0x3bbc('0x1d')]?_[_0x3bbc('0x1e')](_0x56f7f2[_0x3bbc('0x18')][_0x3bbc('0x1d')],function(_0x51119c){return{'model':db[_0x51119c[_0x3bbc('0x1f')]],'as':_0x51119c['as'],'attributes':_0x51119c[_0x3bbc('0x1b')],'include':_0x51119c[_0x3bbc('0x1d')]?_[_0x3bbc('0x1e')](_0x51119c[_0x3bbc('0x1d')],function(_0x19a6b4){return{'model':db[_0x19a6b4[_0x3bbc('0x1f')]],'as':_0x19a6b4['as'],'attributes':_0x19a6b4['attributes'],'include':_0x19a6b4[_0x3bbc('0x1d')]?_['map'](_0x19a6b4[_0x3bbc('0x1d')],function(_0x380a72){return{'model':db[_0x380a72['model']],'as':_0x380a72['as'],'attributes':_0x380a72[_0x3bbc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3bbc('0xc')](function(_0x37ebd6){logger[_0x3bbc('0x13')]('GetDynamics365Account',_0x56f7f2);logger[_0x3bbc('0xf')](_0x3bbc('0x16'),_0x56f7f2,JSON['stringify'](_0x37ebd6));_0x5cbc09(_0x37ebd6);})[_0x3bbc('0x15')](function(_0x25652a){logger[_0x3bbc('0x11')]('GetDynamics365Account',_0x25652a[_0x3bbc('0x12')],_0x56f7f2);_0x3bcd4a(_0x2c1462[_0x3bbc('0x11')](0x1f4,_0x25652a[_0x3bbc('0x12')]));});});};exports[_0x3bbc('0x20')]=function(_0x52142){var _0x1ee642=this;return new Promise(function(_0x3a1154,_0x131d69){return db[_0x3bbc('0x17')][_0x3bbc('0x21')]({'raw':_0x52142[_0x3bbc('0x18')]?_0x52142['options'][_0x3bbc('0x19')]===undefined?!![]:![]:!![],'where':_0x52142[_0x3bbc('0x18')]?_0x52142[_0x3bbc('0x18')]['where']||null:null,'attributes':_0x52142[_0x3bbc('0x18')]?_0x52142['options']['attributes']||null:null,'include':_0x52142[_0x3bbc('0x18')]?_0x52142['options'][_0x3bbc('0x1d')]?_[_0x3bbc('0x1e')](_0x52142[_0x3bbc('0x18')][_0x3bbc('0x1d')],function(_0x36faed){return{'model':db[_0x36faed[_0x3bbc('0x1f')]],'as':_0x36faed['as'],'attributes':_0x36faed[_0x3bbc('0x1b')],'include':_0x36faed['include']?_[_0x3bbc('0x1e')](_0x36faed['include'],function(_0x5809f4){return{'model':db[_0x5809f4[_0x3bbc('0x1f')]],'as':_0x5809f4['as'],'attributes':_0x5809f4[_0x3bbc('0x1b')],'include':_0x5809f4[_0x3bbc('0x1d')]?_[_0x3bbc('0x1e')](_0x5809f4[_0x3bbc('0x1d')],function(_0x536d4){return{'model':db[_0x536d4[_0x3bbc('0x1f')]],'as':_0x536d4['as'],'attributes':_0x536d4[_0x3bbc('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c9e1a){logger['info'](_0x3bbc('0x20'),_0x52142);logger[_0x3bbc('0xf')](_0x3bbc('0x20'),_0x52142,JSON[_0x3bbc('0x10')](_0x1c9e1a));_0x3a1154(_0x1c9e1a);})[_0x3bbc('0x15')](function(_0x1181e5){logger['error'](_0x3bbc('0x20'),_0x1181e5['message'],_0x52142);_0x131d69(_0x1ee642['error'](0x1f4,_0x1181e5['message']));});});}; \ No newline at end of file +var _0x852c=['debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','map','include','model','stringify','ShowDynamics365Account','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s'];(function(_0x6a3e29,_0x281702){var _0x4e2dba=function(_0x1eb081){while(--_0x1eb081){_0x6a3e29['push'](_0x6a3e29['shift']());}};_0x4e2dba(++_0x281702);}(_0x852c,0x174));var _0xc852=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x852c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc852('0x0'));var BPromise=require(_0xc852('0x1'));var rs=require(_0xc852('0x2'));var fs=require('fs');var Redis=require(_0xc852('0x3'));var db=require(_0xc852('0x4'))['db'];var utils=require(_0xc852('0x5'));var logger=require(_0xc852('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc852('0x7'));var client=jayson[_0xc852('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30bfa5,_0x5e96e1,_0x2c85a5){return new BPromise(function(_0x435750,_0x59d094){return client[_0xc852('0x9')](_0x30bfa5,_0x2c85a5)[_0xc852('0xa')](function(_0x537e6a){logger[_0xc852('0xb')](_0xc852('0xc'),_0x5e96e1,'request\x20sent');logger[_0xc852('0xd')](_0xc852('0xe'),_0x5e96e1,_0xc852('0xf'),JSON['stringify'](_0x537e6a));if(_0x537e6a[_0xc852('0x10')]){if(_0x537e6a[_0xc852('0x10')][_0xc852('0x11')]===0x1f4){logger[_0xc852('0x10')](_0xc852('0xc'),_0x5e96e1,_0x537e6a[_0xc852('0x10')][_0xc852('0x12')]);return _0x59d094(_0x537e6a[_0xc852('0x10')][_0xc852('0x12')]);}logger[_0xc852('0x10')](_0xc852('0xc'),_0x5e96e1,_0x537e6a['error'][_0xc852('0x12')]);return _0x435750(_0x537e6a[_0xc852('0x10')][_0xc852('0x12')]);}else{logger[_0xc852('0xb')](_0xc852('0xc'),_0x5e96e1,_0xc852('0xf'));_0x435750(_0x537e6a[_0xc852('0x13')]['message']);}})[_0xc852('0x14')](function(_0x51dd3d){logger[_0xc852('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x5e96e1,_0x51dd3d);_0x59d094(_0x51dd3d);});});}exports[_0xc852('0x15')]=function(_0x3e1100){var _0x3c267f=this;return new Promise(function(_0x5afad4,_0x4d4e27){return db[_0xc852('0x16')][_0xc852('0x17')]({'raw':_0x3e1100[_0xc852('0x18')]?_0x3e1100[_0xc852('0x18')][_0xc852('0x19')]===undefined?!![]:![]:!![],'where':_0x3e1100[_0xc852('0x18')]?_0x3e1100['options'][_0xc852('0x1a')]||null:null,'attributes':_0x3e1100[_0xc852('0x18')]?_0x3e1100['options'][_0xc852('0x1b')]||null:null,'limit':_0x3e1100[_0xc852('0x18')]?_0x3e1100[_0xc852('0x18')][_0xc852('0x1c')]||null:null,'include':_0x3e1100[_0xc852('0x18')]?_0x3e1100[_0xc852('0x18')]['include']?_[_0xc852('0x1d')](_0x3e1100[_0xc852('0x18')][_0xc852('0x1e')],function(_0x3e0972){return{'model':db[_0x3e0972[_0xc852('0x1f')]],'as':_0x3e0972['as'],'attributes':_0x3e0972['attributes'],'include':_0x3e0972[_0xc852('0x1e')]?_[_0xc852('0x1d')](_0x3e0972[_0xc852('0x1e')],function(_0x297db4){return{'model':db[_0x297db4[_0xc852('0x1f')]],'as':_0x297db4['as'],'attributes':_0x297db4[_0xc852('0x1b')],'include':_0x297db4[_0xc852('0x1e')]?_[_0xc852('0x1d')](_0x297db4[_0xc852('0x1e')],function(_0x59540f){return{'model':db[_0x59540f[_0xc852('0x1f')]],'as':_0x59540f['as'],'attributes':_0x59540f[_0xc852('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc852('0xa')](function(_0x22618c){logger[_0xc852('0xb')](_0xc852('0x15'),_0x3e1100);logger['debug'](_0xc852('0x15'),_0x3e1100,JSON[_0xc852('0x20')](_0x22618c));_0x5afad4(_0x22618c);})[_0xc852('0x14')](function(_0x615ebd){logger[_0xc852('0x10')](_0xc852('0x15'),_0x615ebd[_0xc852('0x12')],_0x3e1100);_0x4d4e27(_0x3c267f[_0xc852('0x10')](0x1f4,_0x615ebd[_0xc852('0x12')]));});});};exports[_0xc852('0x21')]=function(_0x29b307){var _0x26a030=this;return new Promise(function(_0x159b5f,_0x1c6bb2){return db[_0xc852('0x16')][_0xc852('0x22')]({'raw':_0x29b307['options']?_0x29b307[_0xc852('0x18')][_0xc852('0x19')]===undefined?!![]:![]:!![],'where':_0x29b307[_0xc852('0x18')]?_0x29b307[_0xc852('0x18')][_0xc852('0x1a')]||null:null,'attributes':_0x29b307[_0xc852('0x18')]?_0x29b307[_0xc852('0x18')][_0xc852('0x1b')]||null:null,'include':_0x29b307[_0xc852('0x18')]?_0x29b307['options'][_0xc852('0x1e')]?_[_0xc852('0x1d')](_0x29b307[_0xc852('0x18')][_0xc852('0x1e')],function(_0x146562){return{'model':db[_0x146562[_0xc852('0x1f')]],'as':_0x146562['as'],'attributes':_0x146562[_0xc852('0x1b')],'include':_0x146562[_0xc852('0x1e')]?_[_0xc852('0x1d')](_0x146562[_0xc852('0x1e')],function(_0x4b4561){return{'model':db[_0x4b4561['model']],'as':_0x4b4561['as'],'attributes':_0x4b4561['attributes'],'include':_0x4b4561['include']?_[_0xc852('0x1d')](_0x4b4561['include'],function(_0x2427c3){return{'model':db[_0x2427c3[_0xc852('0x1f')]],'as':_0x2427c3['as'],'attributes':_0x2427c3[_0xc852('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc852('0xa')](function(_0x2f3be7){logger[_0xc852('0xb')]('ShowDynamics365Account',_0x29b307);logger[_0xc852('0xd')](_0xc852('0x21'),_0x29b307,JSON[_0xc852('0x20')](_0x2f3be7));_0x159b5f(_0x2f3be7);})[_0xc852('0x14')](function(_0x5cbb50){logger[_0xc852('0x10')](_0xc852('0x21'),_0x5cbb50['message'],_0x29b307);_0x1c6bb2(_0x26a030[_0xc852('0x10')](0x1f4,_0x5cbb50[_0xc852('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index b709f15..e48362f 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 _0x756e=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x2440df,_0x453be8){var _0x1fa6fb=function(_0x1e0417){while(--_0x1e0417){_0x2440df['push'](_0x2440df['shift']());}};_0x1fa6fb(++_0x453be8);}(_0x756e,0x18d));var _0xe756=function(_0x438b25,_0x3e8085){_0x438b25=_0x438b25-0x0;var _0x213e46=_0x756e[_0x438b25];return _0x213e46;};'use strict';var multer=require('multer');var util=require(_0xe756('0x0'));var path=require('path');var timeout=require(_0xe756('0x1'));var express=require(_0xe756('0x2'));var router=express[_0xe756('0x3')]();var fs_extra=require(_0xe756('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe756('0x5'));var config=require(_0xe756('0x6'));var controller=require(_0xe756('0x7'));router[_0xe756('0x8')]('/',auth[_0xe756('0x9')](),controller[_0xe756('0xa')]);router[_0xe756('0x8')](_0xe756('0xb'),auth[_0xe756('0x9')](),controller[_0xe756('0xc')]);router[_0xe756('0x8')](_0xe756('0xd'),auth['isAuthenticated'](),controller[_0xe756('0xe')]);router['get']('/:id/subjects',auth[_0xe756('0x9')](),controller[_0xe756('0xf')]);router['get'](_0xe756('0x10'),auth[_0xe756('0x9')](),controller[_0xe756('0x11')]);router[_0xe756('0x12')]('/',auth[_0xe756('0x9')](),controller[_0xe756('0x13')]);router[_0xe756('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xe756('0x15')]);router[_0xe756('0x16')](_0xe756('0xb'),auth[_0xe756('0x9')](),controller[_0xe756('0x17')]);module[_0xe756('0x18')]=router; \ No newline at end of file +var _0xfa28=['fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','/:id','isAuthenticated','show','get','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x55a4a5,_0x426bd4){var _0x3cb5d3=function(_0x582d39){while(--_0x582d39){_0x55a4a5['push'](_0x55a4a5['shift']());}};_0x3cb5d3(++_0x426bd4);}(_0xfa28,0x1c6));var _0x8fa2=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xfa28[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0x8fa2('0x0'));var util=require(_0x8fa2('0x1'));var path=require(_0x8fa2('0x2'));var timeout=require(_0x8fa2('0x3'));var express=require(_0x8fa2('0x4'));var router=express[_0x8fa2('0x5')]();var fs_extra=require(_0x8fa2('0x6'));var auth=require(_0x8fa2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8fa2('0x8'));var controller=require(_0x8fa2('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8fa2('0xa'),auth[_0x8fa2('0xb')](),controller[_0x8fa2('0xc')]);router[_0x8fa2('0xd')]('/:id/fields',auth[_0x8fa2('0xb')](),controller[_0x8fa2('0xe')]);router[_0x8fa2('0xd')](_0x8fa2('0xf'),auth[_0x8fa2('0xb')](),controller['getSubjects']);router['get'](_0x8fa2('0x10'),auth[_0x8fa2('0xb')](),controller[_0x8fa2('0x11')]);router[_0x8fa2('0x12')]('/',auth[_0x8fa2('0xb')](),controller[_0x8fa2('0x13')]);router['put'](_0x8fa2('0xa'),auth[_0x8fa2('0xb')](),controller[_0x8fa2('0x14')]);router[_0x8fa2('0x15')]('/:id',auth[_0x8fa2('0xb')](),controller['destroy']);module[_0x8fa2('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 013ace6..e2fe218 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 _0x51d1=['STRING','ENUM','phonecall','incident','nothing','contact','BOOLEAN','sequelize','exports'];(function(_0x18e52d,_0x3f19df){var _0x2030e7=function(_0x1637c3){while(--_0x1637c3){_0x18e52d['push'](_0x18e52d['shift']());}};_0x2030e7(++_0x3f19df);}(_0x51d1,0x11e));var _0x151d=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x51d1[_0x56f7e2];return _0x36240b;};'use strict';var Sequelize=require(_0x151d('0x0'));module[_0x151d('0x1')]={'name':{'type':Sequelize[_0x151d('0x2')]},'description':{'type':Sequelize[_0x151d('0x2')]},'ticketType':{'type':Sequelize[_0x151d('0x3')]('incident',_0x151d('0x4')),'defaultValue':_0x151d('0x5')},'moduleCreate':{'type':Sequelize[_0x151d('0x3')]('contact',_0x151d('0x6')),'defaultValue':_0x151d('0x7'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x151d('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x151d('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3265=['sequelize','exports','STRING','ENUM','phonecall','incident','contact','nothing','BOOLEAN'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0x3265,0x195));var _0x5326=function(_0x7cd276,_0x35db85){_0x7cd276=_0x7cd276-0x0;var _0x599999=_0x3265[_0x7cd276];return _0x599999;};'use strict';var Sequelize=require(_0x5326('0x0'));module[_0x5326('0x1')]={'name':{'type':Sequelize[_0x5326('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x5326('0x3')]('incident',_0x5326('0x4')),'defaultValue':_0x5326('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0x5326('0x6'),_0x5326('0x7')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x5326('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 8787ea0..28a9870 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 _0x6c12=['pick','merge','VIRTUAL','filter','include','rows','catch','params','keys','includeAll','find','create','body','destroy','getFields','findOne','Dynamics365Field','getSubjects','options','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','count','Content-Range','update','then','error','stack','name','index','map','Dynamics365Configuration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1d1353,_0x4aca15){var _0x2694ce=function(_0x164d50){while(--_0x164d50){_0x1d1353['push'](_0x1d1353['shift']());}};_0x2694ce(++_0x4aca15);}(_0x6c12,0x1e2));var _0x26c1=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0x6c12[_0x41c381];return _0x427981;};'use strict';var emlformat=require(_0x26c1('0x0'));var rimraf=require(_0x26c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x26c1('0x2'));var moment=require(_0x26c1('0x3'));var BPromise=require(_0x26c1('0x4'));var Mustache=require('mustache');var util=require(_0x26c1('0x5'));var path=require(_0x26c1('0x6'));var sox=require(_0x26c1('0x7'));var csv=require(_0x26c1('0x8'));var ejs=require(_0x26c1('0x9'));var fs=require('fs');var fs_extra=require(_0x26c1('0xa'));var _=require(_0x26c1('0xb'));var squel=require(_0x26c1('0xc'));var crypto=require(_0x26c1('0xd'));var jsforce=require(_0x26c1('0xe'));var deskjs=require(_0x26c1('0xf'));var toCsv=require(_0x26c1('0x8'));var querystring=require(_0x26c1('0x10'));var Papa=require(_0x26c1('0x11'));var Redis=require(_0x26c1('0x12'));var authService=require(_0x26c1('0x13'));var qs=require(_0x26c1('0x14'));var as=require(_0x26c1('0x15'));var hardwareService=require(_0x26c1('0x16'));var logger=require(_0x26c1('0x17'))(_0x26c1('0x18'));var utils=require(_0x26c1('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x26c1('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x284933,_0x4ee5e5){_0x4ee5e5=_0x4ee5e5||0xcc;return function(_0x47ccea){if(_0x47ccea){return _0x284933[_0x26c1('0x1b')](_0x4ee5e5);}return _0x284933[_0x26c1('0x1c')](_0x4ee5e5)[_0x26c1('0x1d')]();};}function respondWithResult(_0xc32ccf,_0x1fdddd){_0x1fdddd=_0x1fdddd||0xc8;return function(_0x40a342){if(_0x40a342){return _0xc32ccf['status'](_0x1fdddd)['json'](_0x40a342);}};}function respondWithFilteredResult(_0x1803e7,_0x531b20){return function(_0x56b26c){if(_0x56b26c){var _0xb2a263=typeof _0x531b20[_0x26c1('0x1e')]==='undefined'&&typeof _0x531b20[_0x26c1('0x1f')]==='undefined';var _0x2c7375=_0x56b26c[_0x26c1('0x20')];var _0x140fc4=_0xb2a263?0x0:_0x531b20[_0x26c1('0x1e')];var _0x184a52=_0xb2a263?_0x56b26c[_0x26c1('0x20')]:_0x531b20[_0x26c1('0x1e')]+_0x531b20['limit'];var _0x5d43b2;if(_0x184a52>=_0x2c7375){_0x184a52=_0x2c7375;_0x5d43b2=0xc8;}else{_0x5d43b2=0xce;}_0x1803e7[_0x26c1('0x1c')](_0x5d43b2);return _0x1803e7['set'](_0x26c1('0x21'),_0x140fc4+'-'+_0x184a52+'/'+_0x2c7375)['json'](_0x56b26c);}return null;};}function patchUpdates(_0x1387bb){return function(_0x14f9e0){try{jsonpatch['apply'](_0x14f9e0,_0x1387bb,!![]);}catch(_0x368cdc){return BPromise['reject'](_0x368cdc);}return _0x14f9e0['save']();};}function saveUpdates(_0x3b2c56,_0x377080){return function(_0x1b912b){if(_0x1b912b){return _0x1b912b[_0x26c1('0x22')](_0x3b2c56)[_0x26c1('0x23')](function(_0x4c5a0e){return _0x4c5a0e;});}return null;};}function removeEntity(_0x971c7c,_0x5cf1e7){return function(_0x5b4941){if(_0x5b4941){return _0x5b4941['destroy']()[_0x26c1('0x23')](function(){_0x971c7c[_0x26c1('0x1c')](0xcc)[_0x26c1('0x1d')]();});}};}function handleEntityNotFound(_0x382509,_0x3d6eb5){return function(_0x1db55d){if(!_0x1db55d){_0x382509[_0x26c1('0x1b')](0x194);}return _0x1db55d;};}function handleError(_0x2db039,_0xe96ac3){_0xe96ac3=_0xe96ac3||0x1f4;return function(_0x4a2d9b){logger[_0x26c1('0x24')](_0x4a2d9b[_0x26c1('0x25')]);if(_0x4a2d9b[_0x26c1('0x26')]){delete _0x4a2d9b['name'];}_0x2db039['status'](_0xe96ac3)['send'](_0x4a2d9b);};}exports[_0x26c1('0x27')]=function(_0xc93eec,_0x1a2634){var _0x226dcb={},_0x443d54={},_0x3c6e9a={'count':0x0,'rows':[]};var _0x23eb88=_[_0x26c1('0x28')](db[_0x26c1('0x29')][_0x26c1('0x2a')],function(_0xa2bf72){return{'name':_0xa2bf72['fieldName'],'type':_0xa2bf72[_0x26c1('0x2b')][_0x26c1('0x2c')]};});_0x443d54[_0x26c1('0x2d')]=_[_0x26c1('0x28')](_0x23eb88,_0x26c1('0x26'));_0x443d54[_0x26c1('0x2e')]=_['keys'](_0xc93eec[_0x26c1('0x2e')]);_0x443d54[_0x26c1('0x2f')]=_[_0x26c1('0x30')](_0x443d54[_0x26c1('0x2d')],_0x443d54[_0x26c1('0x2e')]);_0x226dcb[_0x26c1('0x31')]=_['intersection'](_0x443d54[_0x26c1('0x2d')],qs[_0x26c1('0x32')](_0xc93eec[_0x26c1('0x2e')][_0x26c1('0x32')]));_0x226dcb[_0x26c1('0x31')]=_0x226dcb['attributes'][_0x26c1('0x33')]?_0x226dcb['attributes']:_0x443d54['model'];if(!_0xc93eec[_0x26c1('0x2e')][_0x26c1('0x34')](_0x26c1('0x35'))){_0x226dcb[_0x26c1('0x1f')]=qs[_0x26c1('0x1f')](_0xc93eec[_0x26c1('0x2e')]['limit']);_0x226dcb['offset']=qs[_0x26c1('0x1e')](_0xc93eec[_0x26c1('0x2e')][_0x26c1('0x1e')]);}_0x226dcb[_0x26c1('0x36')]=qs[_0x26c1('0x37')](_0xc93eec[_0x26c1('0x2e')][_0x26c1('0x37')]);_0x226dcb[_0x26c1('0x38')]=qs[_0x26c1('0x2f')](_[_0x26c1('0x39')](_0xc93eec[_0x26c1('0x2e')],_0x443d54['filters']),_0x23eb88);if(_0xc93eec[_0x26c1('0x2e')]['filter']){_0x226dcb['where']=_[_0x26c1('0x3a')](_0x226dcb[_0x26c1('0x38')],{'$or':_[_0x26c1('0x28')](_0x23eb88,function(_0x4facbe){if(_0x4facbe[_0x26c1('0x2b')]!==_0x26c1('0x3b')){var _0x1a7c3c={};_0x1a7c3c[_0x4facbe[_0x26c1('0x26')]]={'$like':'%'+_0xc93eec[_0x26c1('0x2e')][_0x26c1('0x3c')]+'%'};return _0x1a7c3c;}})});}_0x226dcb=_['merge']({},_0x226dcb,_0xc93eec['options']);var _0x432f77={'where':_0x226dcb[_0x26c1('0x38')]};return db[_0x26c1('0x29')][_0x26c1('0x20')](_0x432f77)[_0x26c1('0x23')](function(_0x336e9c){_0x3c6e9a['count']=_0x336e9c;if(_0xc93eec[_0x26c1('0x2e')]['includeAll']){_0x226dcb[_0x26c1('0x3d')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x226dcb);})[_0x26c1('0x23')](function(_0x166c19){_0x3c6e9a[_0x26c1('0x3e')]=_0x166c19;return _0x3c6e9a;})[_0x26c1('0x23')](respondWithFilteredResult(_0x1a2634,_0x226dcb))[_0x26c1('0x3f')](handleError(_0x1a2634,null));};exports['show']=function(_0x51e4c1,_0x50ea49){var _0x365ba7={'raw':![],'where':{'id':_0x51e4c1[_0x26c1('0x40')]['id']}},_0x73b1d5={};_0x73b1d5[_0x26c1('0x2d')]=_[_0x26c1('0x41')](db[_0x26c1('0x29')][_0x26c1('0x2a')]);_0x73b1d5[_0x26c1('0x2e')]=_[_0x26c1('0x41')](_0x51e4c1[_0x26c1('0x2e')]);_0x73b1d5[_0x26c1('0x2f')]=_['intersection'](_0x73b1d5[_0x26c1('0x2d')],_0x73b1d5[_0x26c1('0x2e')]);_0x365ba7[_0x26c1('0x31')]=_[_0x26c1('0x30')](_0x73b1d5[_0x26c1('0x2d')],qs['fields'](_0x51e4c1['query'][_0x26c1('0x32')]));_0x365ba7[_0x26c1('0x31')]=_0x365ba7[_0x26c1('0x31')][_0x26c1('0x33')]?_0x365ba7[_0x26c1('0x31')]:_0x73b1d5[_0x26c1('0x2d')];if(_0x51e4c1[_0x26c1('0x2e')][_0x26c1('0x42')]){_0x365ba7[_0x26c1('0x3d')]=[{'all':!![]}];}_0x365ba7=_[_0x26c1('0x3a')]({},_0x365ba7,_0x51e4c1['options']);return db[_0x26c1('0x29')][_0x26c1('0x43')](_0x365ba7)['then'](handleEntityNotFound(_0x50ea49,null))[_0x26c1('0x23')](respondWithResult(_0x50ea49,null))['catch'](handleError(_0x50ea49,null));};exports['create']=function(_0x2330ef,_0x15c40e){return db[_0x26c1('0x29')][_0x26c1('0x44')](_0x2330ef[_0x26c1('0x45')],{})[_0x26c1('0x23')](respondWithResult(_0x15c40e,0xc9))['catch'](handleError(_0x15c40e,null));};exports[_0x26c1('0x22')]=function(_0x30576d,_0x41adc3){if(_0x30576d[_0x26c1('0x45')]['id']){delete _0x30576d[_0x26c1('0x45')]['id'];}return db[_0x26c1('0x29')][_0x26c1('0x43')]({'where':{'id':_0x30576d[_0x26c1('0x40')]['id']}})[_0x26c1('0x23')](handleEntityNotFound(_0x41adc3,null))[_0x26c1('0x23')](saveUpdates(_0x30576d[_0x26c1('0x45')],null))[_0x26c1('0x23')](respondWithResult(_0x41adc3,null))[_0x26c1('0x3f')](handleError(_0x41adc3,null));};exports[_0x26c1('0x46')]=function(_0x52618a,_0x3bb2ac){return db['Dynamics365Configuration']['find']({'where':{'id':_0x52618a[_0x26c1('0x40')]['id']}})[_0x26c1('0x23')](handleEntityNotFound(_0x3bb2ac,null))[_0x26c1('0x23')](removeEntity(_0x3bb2ac,null))['catch'](handleError(_0x3bb2ac,null));};exports[_0x26c1('0x47')]=function(_0x588ef0,_0x2afca3,_0x4bd4e9){var _0x341f4c={};var _0x3290e3={};var _0xf72ee0;var _0x118f4f;return db['Dynamics365Configuration'][_0x26c1('0x48')]({'where':{'id':_0x588ef0[_0x26c1('0x40')]['id']}})[_0x26c1('0x23')](handleEntityNotFound(_0x2afca3,null))[_0x26c1('0x23')](function(_0x3e896f){if(_0x3e896f){_0xf72ee0=_0x3e896f;_0x3290e3[_0x26c1('0x2d')]=_['keys'](db[_0x26c1('0x49')]['rawAttributes']);_0x3290e3[_0x26c1('0x2e')]=_[_0x26c1('0x41')](_0x588ef0[_0x26c1('0x2e')]);_0x3290e3['filters']=_[_0x26c1('0x30')](_0x3290e3[_0x26c1('0x2d')],_0x3290e3[_0x26c1('0x2e')]);_0x341f4c[_0x26c1('0x31')]=_[_0x26c1('0x30')](_0x3290e3[_0x26c1('0x2d')],qs[_0x26c1('0x32')](_0x588ef0[_0x26c1('0x2e')][_0x26c1('0x32')]));_0x341f4c[_0x26c1('0x31')]=_0x341f4c[_0x26c1('0x31')]['length']?_0x341f4c[_0x26c1('0x31')]:_0x3290e3[_0x26c1('0x2d')];_0x341f4c[_0x26c1('0x36')]=qs[_0x26c1('0x37')](_0x588ef0[_0x26c1('0x2e')][_0x26c1('0x37')]);_0x341f4c[_0x26c1('0x38')]=qs[_0x26c1('0x2f')](_['pick'](_0x588ef0[_0x26c1('0x2e')],_0x3290e3[_0x26c1('0x2f')]));if(_0x588ef0['query'][_0x26c1('0x3c')]){_0x341f4c[_0x26c1('0x38')]=_[_0x26c1('0x3a')](_0x341f4c[_0x26c1('0x38')],{'$or':_[_0x26c1('0x28')](_0x341f4c[_0x26c1('0x31')],function(_0x51378b){var _0x13a735={};_0x13a735[_0x51378b]={'$like':'%'+_0x588ef0[_0x26c1('0x2e')]['filter']+'%'};return _0x13a735;})});}_0x341f4c=_[_0x26c1('0x3a')]({},_0x341f4c,_0x588ef0['options']);return _0xf72ee0[_0x26c1('0x47')](_0x341f4c);}})[_0x26c1('0x23')](function(_0x1d2827){if(_0x1d2827){_0x118f4f=_0x1d2827[_0x26c1('0x33')];if(!_0x588ef0[_0x26c1('0x2e')][_0x26c1('0x34')](_0x26c1('0x35'))){_0x341f4c[_0x26c1('0x1f')]=qs[_0x26c1('0x1f')](_0x588ef0[_0x26c1('0x2e')][_0x26c1('0x1f')]);_0x341f4c[_0x26c1('0x1e')]=qs[_0x26c1('0x1e')](_0x588ef0[_0x26c1('0x2e')][_0x26c1('0x1e')]);}return _0xf72ee0[_0x26c1('0x47')](_0x341f4c);}})[_0x26c1('0x23')](function(_0x2920a6){if(_0x2920a6){return _0x2920a6?{'count':_0x118f4f,'rows':_0x2920a6}:null;}})[_0x26c1('0x23')](respondWithResult(_0x2afca3,null))[_0x26c1('0x3f')](handleError(_0x2afca3,null));};exports[_0x26c1('0x4a')]=function(_0x1c753e,_0xd4d78e,_0x512912){var _0x52bea2={};var _0xabf7={};var _0x16b39a;var _0x65e042;return db[_0x26c1('0x29')][_0x26c1('0x48')]({'where':{'id':_0x1c753e['params']['id']}})[_0x26c1('0x23')](handleEntityNotFound(_0xd4d78e,null))[_0x26c1('0x23')](function(_0x595937){if(_0x595937){_0x16b39a=_0x595937;_0xabf7[_0x26c1('0x2d')]=_[_0x26c1('0x41')](db[_0x26c1('0x49')][_0x26c1('0x2a')]);_0xabf7[_0x26c1('0x2e')]=_[_0x26c1('0x41')](_0x1c753e[_0x26c1('0x2e')]);_0xabf7[_0x26c1('0x2f')]=_[_0x26c1('0x30')](_0xabf7[_0x26c1('0x2d')],_0xabf7[_0x26c1('0x2e')]);_0x52bea2[_0x26c1('0x31')]=_['intersection'](_0xabf7[_0x26c1('0x2d')],qs['fields'](_0x1c753e[_0x26c1('0x2e')]['fields']));_0x52bea2[_0x26c1('0x31')]=_0x52bea2[_0x26c1('0x31')][_0x26c1('0x33')]?_0x52bea2[_0x26c1('0x31')]:_0xabf7['model'];_0x52bea2[_0x26c1('0x36')]=qs['sort'](_0x1c753e['query'][_0x26c1('0x37')]);_0x52bea2[_0x26c1('0x38')]=qs[_0x26c1('0x2f')](_[_0x26c1('0x39')](_0x1c753e[_0x26c1('0x2e')],_0xabf7[_0x26c1('0x2f')]));if(_0x1c753e[_0x26c1('0x2e')][_0x26c1('0x3c')]){_0x52bea2['where']=_[_0x26c1('0x3a')](_0x52bea2[_0x26c1('0x38')],{'$or':_[_0x26c1('0x28')](_0x52bea2[_0x26c1('0x31')],function(_0x40b5e2){var _0x4037c1={};_0x4037c1[_0x40b5e2]={'$like':'%'+_0x1c753e[_0x26c1('0x2e')][_0x26c1('0x3c')]+'%'};return _0x4037c1;})});}_0x52bea2=_[_0x26c1('0x3a')]({},_0x52bea2,_0x1c753e[_0x26c1('0x4b')]);return _0x16b39a[_0x26c1('0x4a')](_0x52bea2);}})[_0x26c1('0x23')](function(_0x48a70f){if(_0x48a70f){_0x65e042=_0x48a70f[_0x26c1('0x33')];if(!_0x1c753e[_0x26c1('0x2e')][_0x26c1('0x34')](_0x26c1('0x35'))){_0x52bea2[_0x26c1('0x1f')]=qs[_0x26c1('0x1f')](_0x1c753e[_0x26c1('0x2e')]['limit']);_0x52bea2['offset']=qs['offset'](_0x1c753e[_0x26c1('0x2e')]['offset']);}return _0x16b39a[_0x26c1('0x4a')](_0x52bea2);}})['then'](function(_0x44e384){if(_0x44e384){return _0x44e384?{'count':_0x65e042,'rows':_0x44e384}:null;}})['then'](respondWithResult(_0xd4d78e,null))[_0x26c1('0x3f')](handleError(_0xd4d78e,null));};exports[_0x26c1('0x4c')]=function(_0x23c19b,_0x1e91a4,_0x366705){var _0xa8f09f={};var _0x2f19d8={};var _0xff236c;var _0x584a54;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x23c19b['params']['id']}})[_0x26c1('0x23')](handleEntityNotFound(_0x1e91a4,null))[_0x26c1('0x23')](function(_0x48c45c){if(_0x48c45c){_0xff236c=_0x48c45c;_0x2f19d8[_0x26c1('0x2d')]=_[_0x26c1('0x41')](db[_0x26c1('0x49')][_0x26c1('0x2a')]);_0x2f19d8['query']=_[_0x26c1('0x41')](_0x23c19b[_0x26c1('0x2e')]);_0x2f19d8[_0x26c1('0x2f')]=_[_0x26c1('0x30')](_0x2f19d8[_0x26c1('0x2d')],_0x2f19d8[_0x26c1('0x2e')]);_0xa8f09f[_0x26c1('0x31')]=_[_0x26c1('0x30')](_0x2f19d8[_0x26c1('0x2d')],qs[_0x26c1('0x32')](_0x23c19b[_0x26c1('0x2e')][_0x26c1('0x32')]));_0xa8f09f[_0x26c1('0x31')]=_0xa8f09f['attributes'][_0x26c1('0x33')]?_0xa8f09f[_0x26c1('0x31')]:_0x2f19d8[_0x26c1('0x2d')];_0xa8f09f[_0x26c1('0x36')]=qs['sort'](_0x23c19b[_0x26c1('0x2e')]['sort']);_0xa8f09f['where']=qs['filters'](_['pick'](_0x23c19b[_0x26c1('0x2e')],_0x2f19d8[_0x26c1('0x2f')]));if(_0x23c19b[_0x26c1('0x2e')][_0x26c1('0x3c')]){_0xa8f09f[_0x26c1('0x38')]=_[_0x26c1('0x3a')](_0xa8f09f['where'],{'$or':_[_0x26c1('0x28')](_0xa8f09f[_0x26c1('0x31')],function(_0x5121f6){var _0x5a608b={};_0x5a608b[_0x5121f6]={'$like':'%'+_0x23c19b[_0x26c1('0x2e')][_0x26c1('0x3c')]+'%'};return _0x5a608b;})});}_0xa8f09f=_[_0x26c1('0x3a')]({},_0xa8f09f,_0x23c19b[_0x26c1('0x4b')]);return _0xff236c[_0x26c1('0x4c')](_0xa8f09f);}})[_0x26c1('0x23')](function(_0x5ef355){if(_0x5ef355){_0x584a54=_0x5ef355[_0x26c1('0x33')];if(!_0x23c19b[_0x26c1('0x2e')]['hasOwnProperty'](_0x26c1('0x35'))){_0xa8f09f['limit']=qs[_0x26c1('0x1f')](_0x23c19b[_0x26c1('0x2e')][_0x26c1('0x1f')]);_0xa8f09f[_0x26c1('0x1e')]=qs[_0x26c1('0x1e')](_0x23c19b[_0x26c1('0x2e')][_0x26c1('0x1e')]);}return _0xff236c[_0x26c1('0x4c')](_0xa8f09f);}})[_0x26c1('0x23')](function(_0x8b0aba){if(_0x8b0aba){return _0x8b0aba?{'count':_0x584a54,'rows':_0x8b0aba}:null;}})[_0x26c1('0x23')](respondWithResult(_0x1e91a4,null))[_0x26c1('0x3f')](handleError(_0x1e91a4,null));}; \ No newline at end of file +var _0xeee3=['find','create','body','getFields','findOne','Dynamics365Field','order','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x45c4d9,_0x288673){var _0x3173aa=function(_0x1c33bc){while(--_0x1c33bc){_0x45c4d9['push'](_0x45c4d9['shift']());}};_0x3173aa(++_0x288673);}(_0xeee3,0xf9));var _0x3eee=function(_0x43be6c,_0x7f5e1d){_0x43be6c=_0x43be6c-0x0;var _0x3ad4e2=_0xeee3[_0x43be6c];return _0x3ad4e2;};'use strict';var emlformat=require(_0x3eee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3eee('0x1'));var jsonpatch=require(_0x3eee('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3eee('0x3'));var Mustache=require(_0x3eee('0x4'));var util=require(_0x3eee('0x5'));var path=require('path');var sox=require(_0x3eee('0x6'));var csv=require(_0x3eee('0x7'));var ejs=require(_0x3eee('0x8'));var fs=require('fs');var fs_extra=require(_0x3eee('0x9'));var _=require(_0x3eee('0xa'));var squel=require(_0x3eee('0xb'));var crypto=require(_0x3eee('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3eee('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3eee('0xe'));var Papa=require(_0x3eee('0xf'));var Redis=require(_0x3eee('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3eee('0x11'));var as=require(_0x3eee('0x12'));var hardwareService=require(_0x3eee('0x13'));var logger=require(_0x3eee('0x14'))(_0x3eee('0x15'));var utils=require(_0x3eee('0x16'));var config=require(_0x3eee('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3eee('0x18'))['db'];function respondWithStatusCode(_0x15befa,_0x56707b){_0x56707b=_0x56707b||0xcc;return function(_0x30b42c){if(_0x30b42c){return _0x15befa['sendStatus'](_0x56707b);}return _0x15befa['status'](_0x56707b)[_0x3eee('0x19')]();};}function respondWithResult(_0x1d40c6,_0x51ffc1){_0x51ffc1=_0x51ffc1||0xc8;return function(_0x368f33){if(_0x368f33){return _0x1d40c6[_0x3eee('0x1a')](_0x51ffc1)[_0x3eee('0x1b')](_0x368f33);}};}function respondWithFilteredResult(_0x5374ca,_0x5a0872){return function(_0x1ab5df){if(_0x1ab5df){var _0x2aabdf=typeof _0x5a0872[_0x3eee('0x1c')]===_0x3eee('0x1d')&&typeof _0x5a0872[_0x3eee('0x1e')]===_0x3eee('0x1d');var _0x305657=_0x1ab5df['count'];var _0x183ce8=_0x2aabdf?0x0:_0x5a0872[_0x3eee('0x1c')];var _0x26f984=_0x2aabdf?_0x1ab5df[_0x3eee('0x1f')]:_0x5a0872[_0x3eee('0x1c')]+_0x5a0872[_0x3eee('0x1e')];var _0x4eeedf;if(_0x26f984>=_0x305657){_0x26f984=_0x305657;_0x4eeedf=0xc8;}else{_0x4eeedf=0xce;}_0x5374ca[_0x3eee('0x1a')](_0x4eeedf);return _0x5374ca[_0x3eee('0x20')](_0x3eee('0x21'),_0x183ce8+'-'+_0x26f984+'/'+_0x305657)['json'](_0x1ab5df);}return null;};}function patchUpdates(_0x33479f){return function(_0x570347){try{jsonpatch['apply'](_0x570347,_0x33479f,!![]);}catch(_0x53d4d0){return BPromise['reject'](_0x53d4d0);}return _0x570347[_0x3eee('0x22')]();};}function saveUpdates(_0x1ee434,_0x7f71cf){return function(_0x2e10f4){if(_0x2e10f4){return _0x2e10f4[_0x3eee('0x23')](_0x1ee434)[_0x3eee('0x24')](function(_0x37f380){return _0x37f380;});}return null;};}function removeEntity(_0x234c26,_0x227092){return function(_0x2a1e4f){if(_0x2a1e4f){return _0x2a1e4f[_0x3eee('0x25')]()[_0x3eee('0x24')](function(){_0x234c26['status'](0xcc)[_0x3eee('0x19')]();});}};}function handleEntityNotFound(_0x1034dc,_0xe5b0f3){return function(_0x813249){if(!_0x813249){_0x1034dc[_0x3eee('0x26')](0x194);}return _0x813249;};}function handleError(_0x55a5d5,_0xc55248){_0xc55248=_0xc55248||0x1f4;return function(_0x5d8168){logger[_0x3eee('0x27')](_0x5d8168[_0x3eee('0x28')]);if(_0x5d8168[_0x3eee('0x29')]){delete _0x5d8168[_0x3eee('0x29')];}_0x55a5d5[_0x3eee('0x1a')](_0xc55248)[_0x3eee('0x2a')](_0x5d8168);};}exports[_0x3eee('0x2b')]=function(_0x36a7ac,_0x30148f){var _0x3b08f3={},_0x563472={},_0x434956={'count':0x0,'rows':[]};var _0x33a2b2=_['map'](db[_0x3eee('0x2c')][_0x3eee('0x2d')],function(_0x117c69){return{'name':_0x117c69['fieldName'],'type':_0x117c69['type']['key']};});_0x563472[_0x3eee('0x2e')]=_[_0x3eee('0x2f')](_0x33a2b2,_0x3eee('0x29'));_0x563472[_0x3eee('0x30')]=_[_0x3eee('0x31')](_0x36a7ac[_0x3eee('0x30')]);_0x563472[_0x3eee('0x32')]=_[_0x3eee('0x33')](_0x563472[_0x3eee('0x2e')],_0x563472[_0x3eee('0x30')]);_0x3b08f3[_0x3eee('0x34')]=_[_0x3eee('0x33')](_0x563472[_0x3eee('0x2e')],qs['fields'](_0x36a7ac[_0x3eee('0x30')][_0x3eee('0x35')]));_0x3b08f3['attributes']=_0x3b08f3['attributes'][_0x3eee('0x36')]?_0x3b08f3['attributes']:_0x563472[_0x3eee('0x2e')];if(!_0x36a7ac[_0x3eee('0x30')][_0x3eee('0x37')](_0x3eee('0x38'))){_0x3b08f3['limit']=qs['limit'](_0x36a7ac['query'][_0x3eee('0x1e')]);_0x3b08f3[_0x3eee('0x1c')]=qs['offset'](_0x36a7ac[_0x3eee('0x30')][_0x3eee('0x1c')]);}_0x3b08f3['order']=qs[_0x3eee('0x39')](_0x36a7ac['query']['sort']);_0x3b08f3[_0x3eee('0x3a')]=qs['filters'](_[_0x3eee('0x3b')](_0x36a7ac['query'],_0x563472[_0x3eee('0x32')]),_0x33a2b2);if(_0x36a7ac[_0x3eee('0x30')]['filter']){_0x3b08f3['where']=_[_0x3eee('0x3c')](_0x3b08f3[_0x3eee('0x3a')],{'$or':_[_0x3eee('0x2f')](_0x33a2b2,function(_0x726344){if(_0x726344[_0x3eee('0x3d')]!=='VIRTUAL'){var _0x295b80={};_0x295b80[_0x726344[_0x3eee('0x29')]]={'$like':'%'+_0x36a7ac[_0x3eee('0x30')][_0x3eee('0x3e')]+'%'};return _0x295b80;}})});}_0x3b08f3=_['merge']({},_0x3b08f3,_0x36a7ac[_0x3eee('0x3f')]);var _0x1245cc={'where':_0x3b08f3['where']};return db[_0x3eee('0x2c')][_0x3eee('0x1f')](_0x1245cc)[_0x3eee('0x24')](function(_0x18fa87){_0x434956[_0x3eee('0x1f')]=_0x18fa87;if(_0x36a7ac['query'][_0x3eee('0x40')]){_0x3b08f3[_0x3eee('0x41')]=[{'all':!![]}];}return db[_0x3eee('0x2c')][_0x3eee('0x42')](_0x3b08f3);})[_0x3eee('0x24')](function(_0x5a2188){_0x434956[_0x3eee('0x43')]=_0x5a2188;return _0x434956;})[_0x3eee('0x24')](respondWithFilteredResult(_0x30148f,_0x3b08f3))[_0x3eee('0x44')](handleError(_0x30148f,null));};exports[_0x3eee('0x45')]=function(_0x199851,_0x16f11d){var _0x5b8219={'raw':![],'where':{'id':_0x199851[_0x3eee('0x46')]['id']}},_0x33d1c2={};_0x33d1c2[_0x3eee('0x2e')]=_[_0x3eee('0x31')](db['Dynamics365Configuration'][_0x3eee('0x2d')]);_0x33d1c2[_0x3eee('0x30')]=_[_0x3eee('0x31')](_0x199851[_0x3eee('0x30')]);_0x33d1c2[_0x3eee('0x32')]=_['intersection'](_0x33d1c2['model'],_0x33d1c2['query']);_0x5b8219['attributes']=_['intersection'](_0x33d1c2[_0x3eee('0x2e')],qs[_0x3eee('0x35')](_0x199851['query'][_0x3eee('0x35')]));_0x5b8219[_0x3eee('0x34')]=_0x5b8219[_0x3eee('0x34')][_0x3eee('0x36')]?_0x5b8219['attributes']:_0x33d1c2[_0x3eee('0x2e')];if(_0x199851[_0x3eee('0x30')][_0x3eee('0x40')]){_0x5b8219[_0x3eee('0x41')]=[{'all':!![]}];}_0x5b8219=_['merge']({},_0x5b8219,_0x199851[_0x3eee('0x3f')]);return db['Dynamics365Configuration'][_0x3eee('0x47')](_0x5b8219)['then'](handleEntityNotFound(_0x16f11d,null))[_0x3eee('0x24')](respondWithResult(_0x16f11d,null))[_0x3eee('0x44')](handleError(_0x16f11d,null));};exports[_0x3eee('0x48')]=function(_0x12ad79,_0x1220c9){return db[_0x3eee('0x2c')][_0x3eee('0x48')](_0x12ad79['body'],{})['then'](respondWithResult(_0x1220c9,0xc9))['catch'](handleError(_0x1220c9,null));};exports['update']=function(_0x22303b,_0x5f13b5){if(_0x22303b['body']['id']){delete _0x22303b[_0x3eee('0x49')]['id'];}return db[_0x3eee('0x2c')][_0x3eee('0x47')]({'where':{'id':_0x22303b['params']['id']}})[_0x3eee('0x24')](handleEntityNotFound(_0x5f13b5,null))['then'](saveUpdates(_0x22303b[_0x3eee('0x49')],null))[_0x3eee('0x24')](respondWithResult(_0x5f13b5,null))[_0x3eee('0x44')](handleError(_0x5f13b5,null));};exports['destroy']=function(_0x1cc583,_0x5381e4){return db['Dynamics365Configuration'][_0x3eee('0x47')]({'where':{'id':_0x1cc583[_0x3eee('0x46')]['id']}})[_0x3eee('0x24')](handleEntityNotFound(_0x5381e4,null))[_0x3eee('0x24')](removeEntity(_0x5381e4,null))[_0x3eee('0x44')](handleError(_0x5381e4,null));};exports[_0x3eee('0x4a')]=function(_0x405e28,_0x16ad40,_0x1034a5){var _0x3062bb={};var _0x567757={};var _0x59dbc4;var _0x184c12;return db[_0x3eee('0x2c')][_0x3eee('0x4b')]({'where':{'id':_0x405e28['params']['id']}})['then'](handleEntityNotFound(_0x16ad40,null))[_0x3eee('0x24')](function(_0x4e16ac){if(_0x4e16ac){_0x59dbc4=_0x4e16ac;_0x567757[_0x3eee('0x2e')]=_[_0x3eee('0x31')](db[_0x3eee('0x4c')]['rawAttributes']);_0x567757[_0x3eee('0x30')]=_[_0x3eee('0x31')](_0x405e28[_0x3eee('0x30')]);_0x567757[_0x3eee('0x32')]=_[_0x3eee('0x33')](_0x567757[_0x3eee('0x2e')],_0x567757[_0x3eee('0x30')]);_0x3062bb[_0x3eee('0x34')]=_[_0x3eee('0x33')](_0x567757[_0x3eee('0x2e')],qs['fields'](_0x405e28['query'][_0x3eee('0x35')]));_0x3062bb[_0x3eee('0x34')]=_0x3062bb['attributes'][_0x3eee('0x36')]?_0x3062bb[_0x3eee('0x34')]:_0x567757[_0x3eee('0x2e')];_0x3062bb['order']=qs[_0x3eee('0x39')](_0x405e28[_0x3eee('0x30')][_0x3eee('0x39')]);_0x3062bb['where']=qs['filters'](_['pick'](_0x405e28[_0x3eee('0x30')],_0x567757['filters']));if(_0x405e28[_0x3eee('0x30')][_0x3eee('0x3e')]){_0x3062bb[_0x3eee('0x3a')]=_[_0x3eee('0x3c')](_0x3062bb[_0x3eee('0x3a')],{'$or':_[_0x3eee('0x2f')](_0x3062bb['attributes'],function(_0x3eb8d7){var _0x1a50d7={};_0x1a50d7[_0x3eb8d7]={'$like':'%'+_0x405e28[_0x3eee('0x30')][_0x3eee('0x3e')]+'%'};return _0x1a50d7;})});}_0x3062bb=_['merge']({},_0x3062bb,_0x405e28[_0x3eee('0x3f')]);return _0x59dbc4[_0x3eee('0x4a')](_0x3062bb);}})['then'](function(_0xee28d9){if(_0xee28d9){_0x184c12=_0xee28d9[_0x3eee('0x36')];if(!_0x405e28['query'][_0x3eee('0x37')](_0x3eee('0x38'))){_0x3062bb[_0x3eee('0x1e')]=qs[_0x3eee('0x1e')](_0x405e28['query'][_0x3eee('0x1e')]);_0x3062bb[_0x3eee('0x1c')]=qs[_0x3eee('0x1c')](_0x405e28[_0x3eee('0x30')]['offset']);}return _0x59dbc4[_0x3eee('0x4a')](_0x3062bb);}})[_0x3eee('0x24')](function(_0x39f076){if(_0x39f076){return _0x39f076?{'count':_0x184c12,'rows':_0x39f076}:null;}})[_0x3eee('0x24')](respondWithResult(_0x16ad40,null))[_0x3eee('0x44')](handleError(_0x16ad40,null));};exports['getSubjects']=function(_0x149f12,_0x20fef4,_0x3cb156){var _0x12690e={};var _0x419e42={};var _0x15d6a6;var _0x39c7af;return db[_0x3eee('0x2c')][_0x3eee('0x4b')]({'where':{'id':_0x149f12[_0x3eee('0x46')]['id']}})[_0x3eee('0x24')](handleEntityNotFound(_0x20fef4,null))[_0x3eee('0x24')](function(_0x16fa7e){if(_0x16fa7e){_0x15d6a6=_0x16fa7e;_0x419e42[_0x3eee('0x2e')]=_[_0x3eee('0x31')](db['Dynamics365Field']['rawAttributes']);_0x419e42[_0x3eee('0x30')]=_[_0x3eee('0x31')](_0x149f12[_0x3eee('0x30')]);_0x419e42[_0x3eee('0x32')]=_['intersection'](_0x419e42[_0x3eee('0x2e')],_0x419e42[_0x3eee('0x30')]);_0x12690e[_0x3eee('0x34')]=_[_0x3eee('0x33')](_0x419e42[_0x3eee('0x2e')],qs[_0x3eee('0x35')](_0x149f12[_0x3eee('0x30')][_0x3eee('0x35')]));_0x12690e[_0x3eee('0x34')]=_0x12690e[_0x3eee('0x34')]['length']?_0x12690e[_0x3eee('0x34')]:_0x419e42[_0x3eee('0x2e')];_0x12690e[_0x3eee('0x4d')]=qs[_0x3eee('0x39')](_0x149f12['query'][_0x3eee('0x39')]);_0x12690e[_0x3eee('0x3a')]=qs[_0x3eee('0x32')](_[_0x3eee('0x3b')](_0x149f12[_0x3eee('0x30')],_0x419e42[_0x3eee('0x32')]));if(_0x149f12['query']['filter']){_0x12690e[_0x3eee('0x3a')]=_[_0x3eee('0x3c')](_0x12690e[_0x3eee('0x3a')],{'$or':_[_0x3eee('0x2f')](_0x12690e[_0x3eee('0x34')],function(_0x3519cf){var _0x482c7c={};_0x482c7c[_0x3519cf]={'$like':'%'+_0x149f12[_0x3eee('0x30')]['filter']+'%'};return _0x482c7c;})});}_0x12690e=_[_0x3eee('0x3c')]({},_0x12690e,_0x149f12[_0x3eee('0x3f')]);return _0x15d6a6['getSubjects'](_0x12690e);}})[_0x3eee('0x24')](function(_0x32bb98){if(_0x32bb98){_0x39c7af=_0x32bb98[_0x3eee('0x36')];if(!_0x149f12[_0x3eee('0x30')][_0x3eee('0x37')](_0x3eee('0x38'))){_0x12690e[_0x3eee('0x1e')]=qs['limit'](_0x149f12['query']['limit']);_0x12690e[_0x3eee('0x1c')]=qs[_0x3eee('0x1c')](_0x149f12[_0x3eee('0x30')]['offset']);}return _0x15d6a6[_0x3eee('0x4e')](_0x12690e);}})[_0x3eee('0x24')](function(_0x3372c5){if(_0x3372c5){return _0x3372c5?{'count':_0x39c7af,'rows':_0x3372c5}:null;}})[_0x3eee('0x24')](respondWithResult(_0x20fef4,null))[_0x3eee('0x44')](handleError(_0x20fef4,null));};exports[_0x3eee('0x4f')]=function(_0x2a70c9,_0x31f478,_0x3e2c84){var _0x512aac={};var _0x23548c={};var _0x3206f6;var _0x3da727;return db['Dynamics365Configuration'][_0x3eee('0x4b')]({'where':{'id':_0x2a70c9[_0x3eee('0x46')]['id']}})[_0x3eee('0x24')](handleEntityNotFound(_0x31f478,null))['then'](function(_0x826668){if(_0x826668){_0x3206f6=_0x826668;_0x23548c[_0x3eee('0x2e')]=_[_0x3eee('0x31')](db[_0x3eee('0x4c')][_0x3eee('0x2d')]);_0x23548c[_0x3eee('0x30')]=_['keys'](_0x2a70c9['query']);_0x23548c['filters']=_[_0x3eee('0x33')](_0x23548c['model'],_0x23548c['query']);_0x512aac['attributes']=_[_0x3eee('0x33')](_0x23548c[_0x3eee('0x2e')],qs[_0x3eee('0x35')](_0x2a70c9[_0x3eee('0x30')]['fields']));_0x512aac[_0x3eee('0x34')]=_0x512aac[_0x3eee('0x34')][_0x3eee('0x36')]?_0x512aac['attributes']:_0x23548c['model'];_0x512aac['order']=qs[_0x3eee('0x39')](_0x2a70c9['query'][_0x3eee('0x39')]);_0x512aac[_0x3eee('0x3a')]=qs[_0x3eee('0x32')](_[_0x3eee('0x3b')](_0x2a70c9['query'],_0x23548c[_0x3eee('0x32')]));if(_0x2a70c9[_0x3eee('0x30')][_0x3eee('0x3e')]){_0x512aac[_0x3eee('0x3a')]=_[_0x3eee('0x3c')](_0x512aac[_0x3eee('0x3a')],{'$or':_[_0x3eee('0x2f')](_0x512aac[_0x3eee('0x34')],function(_0x6ed51e){var _0x20d4e1={};_0x20d4e1[_0x6ed51e]={'$like':'%'+_0x2a70c9['query'][_0x3eee('0x3e')]+'%'};return _0x20d4e1;})});}_0x512aac=_[_0x3eee('0x3c')]({},_0x512aac,_0x2a70c9[_0x3eee('0x3f')]);return _0x3206f6[_0x3eee('0x4f')](_0x512aac);}})[_0x3eee('0x24')](function(_0x11604a){if(_0x11604a){_0x3da727=_0x11604a[_0x3eee('0x36')];if(!_0x2a70c9[_0x3eee('0x30')]['hasOwnProperty']('nolimit')){_0x512aac[_0x3eee('0x1e')]=qs[_0x3eee('0x1e')](_0x2a70c9['query']['limit']);_0x512aac[_0x3eee('0x1c')]=qs['offset'](_0x2a70c9[_0x3eee('0x30')][_0x3eee('0x1c')]);}return _0x3206f6[_0x3eee('0x4f')](_0x512aac);}})['then'](function(_0x6cb26c){if(_0x6cb26c){return _0x6cb26c?{'count':_0x3da727,'rows':_0x6cb26c}:null;}})['then'](respondWithResult(_0x31f478,null))[_0x3eee('0x44')](handleError(_0x31f478,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index ef0624e..3c829f6 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 _0xe5b3=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0xe5b3,0x133));var _0x3e5b=function(_0x430290,_0x57fea2){_0x430290=_0x430290-0x0;var _0x151f6d=_0xe5b3[_0x430290];return _0x151f6d;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var fs=require('fs');var path=require(_0x3e5b('0x6'));var rimraf=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var attributes=require(_0x3e5b('0x9'));module[_0x3e5b('0xa')]=function(_0x54e1fb,_0x174923){return _0x54e1fb[_0x3e5b('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0x3e5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x483017,_0x73092c){var _0x3cc794=function(_0x28cb06){while(--_0x28cb06){_0x483017['push'](_0x483017['shift']());}};_0x3cc794(++_0x73092c);}(_0x3e74,0x175));var _0x43e7=function(_0x451466,_0x13281b){_0x451466=_0x451466-0x0;var _0x82aaea=_0x3e74[_0x451466];return _0x82aaea;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index f996bef..43993a2 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 _0xd82c=['then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x3521ab,_0x5c69ef){var _0xbca6a6=function(_0x1de193){while(--_0x1de193){_0x3521ab['push'](_0x3521ab['shift']());}};_0xbca6a6(++_0x5c69ef);}(_0xd82c,0x1af));var _0xcd82=function(_0x12b5de,_0x59d4af){_0x12b5de=_0x12b5de-0x0;var _0x5d5056=_0xd82c[_0x12b5de];return _0x5d5056;};'use strict';var _=require(_0xcd82('0x0'));var util=require('util');var moment=require(_0xcd82('0x1'));var BPromise=require(_0xcd82('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd82('0x3'))['db'];var utils=require(_0xcd82('0x4'));var logger=require(_0xcd82('0x5'))('rpc');var config=require(_0xcd82('0x6'));var jayson=require(_0xcd82('0x7'));var client=jayson[_0xcd82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb3f085,_0x10783d,_0x200e0d){return new BPromise(function(_0x23961c,_0x224c8b){return client[_0xcd82('0x9')](_0xb3f085,_0x200e0d)[_0xcd82('0xa')](function(_0x1990d6){logger['info'](_0xcd82('0xb'),_0x10783d,_0xcd82('0xc'));logger[_0xcd82('0xd')](_0xcd82('0xe'),_0x10783d,_0xcd82('0xc'),JSON[_0xcd82('0xf')](_0x1990d6));if(_0x1990d6['error']){if(_0x1990d6[_0xcd82('0x10')][_0xcd82('0x11')]===0x1f4){logger['error'](_0xcd82('0xb'),_0x10783d,_0x1990d6['error'][_0xcd82('0x12')]);return _0x224c8b(_0x1990d6[_0xcd82('0x10')][_0xcd82('0x12')]);}logger[_0xcd82('0x10')](_0xcd82('0xb'),_0x10783d,_0x1990d6[_0xcd82('0x10')]['message']);return _0x23961c(_0x1990d6['error'][_0xcd82('0x12')]);}else{logger['info'](_0xcd82('0xb'),_0x10783d,_0xcd82('0xc'));_0x23961c(_0x1990d6[_0xcd82('0x13')][_0xcd82('0x12')]);}})[_0xcd82('0x14')](function(_0xa3efe1){logger[_0xcd82('0x10')](_0xcd82('0xb'),_0x10783d,_0xa3efe1);_0x224c8b(_0xa3efe1);});});} \ No newline at end of file +var _0x8918=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x8918,0x19f));var _0x8891=function(_0x4f06fa,_0x31c38b){_0x4f06fa=_0x4f06fa-0x0;var _0x25c1a1=_0x8918[_0x4f06fa];return _0x25c1a1;};'use strict';var _=require('lodash');var util=require(_0x8891('0x0'));var moment=require('moment');var BPromise=require(_0x8891('0x1'));var rs=require(_0x8891('0x2'));var fs=require('fs');var Redis=require(_0x8891('0x3'));var db=require(_0x8891('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8891('0x5'));var config=require(_0x8891('0x6'));var jayson=require(_0x8891('0x7'));var client=jayson[_0x8891('0x8')][_0x8891('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9b216c,_0x198d76,_0x44e9bf){return new BPromise(function(_0x50be5f,_0x248efc){return client[_0x8891('0xa')](_0x9b216c,_0x44e9bf)[_0x8891('0xb')](function(_0x3ebe7d){logger[_0x8891('0xc')](_0x8891('0xd'),_0x198d76,'request\x20sent');logger[_0x8891('0xe')](_0x8891('0xf'),_0x198d76,_0x8891('0x10'),JSON[_0x8891('0x11')](_0x3ebe7d));if(_0x3ebe7d['error']){if(_0x3ebe7d['error']['code']===0x1f4){logger[_0x8891('0x12')](_0x8891('0xd'),_0x198d76,_0x3ebe7d[_0x8891('0x12')]['message']);return _0x248efc(_0x3ebe7d[_0x8891('0x12')][_0x8891('0x13')]);}logger['error'](_0x8891('0xd'),_0x198d76,_0x3ebe7d['error']['message']);return _0x50be5f(_0x3ebe7d[_0x8891('0x12')][_0x8891('0x13')]);}else{logger[_0x8891('0xc')](_0x8891('0xd'),_0x198d76,_0x8891('0x10'));_0x50be5f(_0x3ebe7d[_0x8891('0x14')]['message']);}})['catch'](function(_0x1bc662){logger[_0x8891('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x198d76,_0x1bc662);_0x248efc(_0x1bc662);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 861c04c..90651a5 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 _0x15ab=['show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x15ab,0xa8));var _0xb15a=function(_0xa4a31a,_0x27b9b8){_0xa4a31a=_0xa4a31a-0x0;var _0x865f70=_0x15ab[_0xa4a31a];return _0x865f70;};'use strict';var multer=require(_0xb15a('0x0'));var util=require('util');var path=require(_0xb15a('0x1'));var timeout=require(_0xb15a('0x2'));var express=require(_0xb15a('0x3'));var router=express['Router']();var fs_extra=require(_0xb15a('0x4'));var auth=require(_0xb15a('0x5'));var interaction=require(_0xb15a('0x6'));var config=require(_0xb15a('0x7'));var controller=require('./intDynamics365Field.controller');router[_0xb15a('0x8')]('/',auth[_0xb15a('0x9')](),controller[_0xb15a('0xa')]);router[_0xb15a('0x8')](_0xb15a('0xb'),auth[_0xb15a('0x9')](),controller[_0xb15a('0xc')]);router[_0xb15a('0xd')]('/',auth[_0xb15a('0x9')](),controller[_0xb15a('0xe')]);router[_0xb15a('0xf')](_0xb15a('0xb'),auth['isAuthenticated'](),controller[_0xb15a('0x10')]);router[_0xb15a('0x11')](_0xb15a('0xb'),auth['isAuthenticated'](),controller[_0xb15a('0x12')]);module[_0xb15a('0x13')]=router; \ No newline at end of file +var _0x9da5=['post','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x1c58e7,_0x3a2cab){var _0x54166c=function(_0x57dc79){while(--_0x57dc79){_0x1c58e7['push'](_0x1c58e7['shift']());}};_0x54166c(++_0x3a2cab);}(_0x9da5,0x16c));var _0x59da=function(_0x17d69e,_0x27717d){_0x17d69e=_0x17d69e-0x0;var _0x4b153f=_0x9da5[_0x17d69e];return _0x4b153f;};'use strict';var multer=require(_0x59da('0x0'));var util=require(_0x59da('0x1'));var path=require(_0x59da('0x2'));var timeout=require(_0x59da('0x3'));var express=require(_0x59da('0x4'));var router=express[_0x59da('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x59da('0x6'));var interaction=require(_0x59da('0x7'));var config=require(_0x59da('0x8'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0x59da('0x9')](),controller[_0x59da('0xa')]);router[_0x59da('0xb')](_0x59da('0xc'),auth[_0x59da('0x9')](),controller[_0x59da('0xd')]);router[_0x59da('0xe')]('/',auth[_0x59da('0x9')](),controller['create']);router[_0x59da('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x59da('0x10')](_0x59da('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x59da('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index d1b4175..7cef84b 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 _0x6284=['picklist','STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable'];(function(_0x561bcd,_0x40fc12){var _0x3be74b=function(_0x55be7a){while(--_0x55be7a){_0x561bcd['push'](_0x561bcd['shift']());}};_0x3be74b(++_0x40fc12);}(_0x6284,0x154));var _0x4628=function(_0x28b754,_0x17d72b){_0x28b754=_0x28b754-0x0;var _0x14eca2=_0x6284[_0x28b754];return _0x14eca2;};'use strict';var Sequelize=require(_0x4628('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x4628('0x1'),_0x4628('0x2'),_0x4628('0x3'),'keyValue',_0x4628('0x4')),'defaultValue':_0x4628('0x1')},'content':{'type':Sequelize[_0x4628('0x5')]},'key':{'type':Sequelize[_0x4628('0x5')]},'keyType':{'type':Sequelize[_0x4628('0x6')]('string','variable',_0x4628('0x3'))},'keyContent':{'type':Sequelize[_0x4628('0x5')]},'idField':{'type':Sequelize[_0x4628('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4628('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4628('0x5')]}}; \ No newline at end of file +var _0x449c=['variable','keyValue','picklist','string','STRING','sequelize','ENUM'];(function(_0x4286d0,_0x496c2a){var _0x31fad7=function(_0x27d88d){while(--_0x27d88d){_0x4286d0['push'](_0x4286d0['shift']());}};_0x31fad7(++_0x496c2a);}(_0x449c,0x15c));var _0xc449=function(_0x154c81,_0x523d49){_0x154c81=_0x154c81-0x0;var _0x955c6e=_0x449c[_0x154c81];return _0x955c6e;};'use strict';var Sequelize=require(_0xc449('0x0'));module['exports']={'type':{'type':Sequelize[_0xc449('0x1')]('string',_0xc449('0x2'),'customVariable',_0xc449('0x3'),_0xc449('0x4')),'defaultValue':_0xc449('0x5')},'content':{'type':Sequelize[_0xc449('0x6')]},'key':{'type':Sequelize[_0xc449('0x6')]},'keyType':{'type':Sequelize[_0xc449('0x1')](_0xc449('0x5'),_0xc449('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xc449('0x6')]},'idField':{'type':Sequelize[_0xc449('0x6')]},'nameField':{'type':Sequelize[_0xc449('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc449('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 5b0f8d3..e9f66a8 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 _0x1f2a=['request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','apply','reject','save','update','then','name','send','map','Dynamics365Field','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','type','VIRTUAL','filter','merge','options','includeAll','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x1f2a,0x160));var _0xa1f2=function(_0x53f897,_0x539857){_0x53f897=_0x53f897-0x0;var _0x6879f8=_0x1f2a[_0x53f897];return _0x6879f8;};'use strict';var emlformat=require(_0xa1f2('0x0'));var rimraf=require(_0xa1f2('0x1'));var zipdir=require(_0xa1f2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1f2('0x3'));var moment=require(_0xa1f2('0x4'));var BPromise=require(_0xa1f2('0x5'));var Mustache=require(_0xa1f2('0x6'));var util=require(_0xa1f2('0x7'));var path=require(_0xa1f2('0x8'));var sox=require('sox');var csv=require(_0xa1f2('0x9'));var ejs=require(_0xa1f2('0xa'));var fs=require('fs');var fs_extra=require(_0xa1f2('0xb'));var _=require(_0xa1f2('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa1f2('0xd'));var deskjs=require(_0xa1f2('0xe'));var toCsv=require(_0xa1f2('0x9'));var querystring=require(_0xa1f2('0xf'));var Papa=require(_0xa1f2('0x10'));var Redis=require(_0xa1f2('0x11'));var authService=require(_0xa1f2('0x12'));var qs=require(_0xa1f2('0x13'));var as=require(_0xa1f2('0x14'));var hardwareService=require(_0xa1f2('0x15'));var logger=require(_0xa1f2('0x16'))(_0xa1f2('0x17'));var utils=require(_0xa1f2('0x18'));var config=require(_0xa1f2('0x19'));var licenseUtil=require(_0xa1f2('0x1a'));var db=require(_0xa1f2('0x1b'))['db'];function respondWithStatusCode(_0x13ce60,_0x4bddd2){_0x4bddd2=_0x4bddd2||0xcc;return function(_0x44e00a){if(_0x44e00a){return _0x13ce60['sendStatus'](_0x4bddd2);}return _0x13ce60['status'](_0x4bddd2)[_0xa1f2('0x1c')]();};}function respondWithResult(_0x2545e8,_0x27716a){_0x27716a=_0x27716a||0xc8;return function(_0x48bc39){if(_0x48bc39){return _0x2545e8[_0xa1f2('0x1d')](_0x27716a)['json'](_0x48bc39);}};}function respondWithFilteredResult(_0xa49995,_0x51ef83){return function(_0x5a3421){if(_0x5a3421){var _0x2af99b=typeof _0x51ef83[_0xa1f2('0x1e')]===_0xa1f2('0x1f')&&typeof _0x51ef83[_0xa1f2('0x20')]===_0xa1f2('0x1f');var _0x41ea03=_0x5a3421[_0xa1f2('0x21')];var _0x134313=_0x2af99b?0x0:_0x51ef83['offset'];var _0x165269=_0x2af99b?_0x5a3421['count']:_0x51ef83[_0xa1f2('0x1e')]+_0x51ef83[_0xa1f2('0x20')];var _0x10f07b;if(_0x165269>=_0x41ea03){_0x165269=_0x41ea03;_0x10f07b=0xc8;}else{_0x10f07b=0xce;}_0xa49995['status'](_0x10f07b);return _0xa49995['set']('Content-Range',_0x134313+'-'+_0x165269+'/'+_0x41ea03)['json'](_0x5a3421);}return null;};}function patchUpdates(_0x2118d9){return function(_0x4abf42){try{jsonpatch[_0xa1f2('0x22')](_0x4abf42,_0x2118d9,!![]);}catch(_0x68ff7d){return BPromise[_0xa1f2('0x23')](_0x68ff7d);}return _0x4abf42[_0xa1f2('0x24')]();};}function saveUpdates(_0x22b1c8,_0x381ffe){return function(_0x1e80d8){if(_0x1e80d8){return _0x1e80d8[_0xa1f2('0x25')](_0x22b1c8)[_0xa1f2('0x26')](function(_0x35ba7c){return _0x35ba7c;});}return null;};}function removeEntity(_0x101830,_0x5daa12){return function(_0x3b403d){if(_0x3b403d){return _0x3b403d['destroy']()[_0xa1f2('0x26')](function(){_0x101830[_0xa1f2('0x1d')](0xcc)[_0xa1f2('0x1c')]();});}};}function handleEntityNotFound(_0x338f6f,_0x2c9d55){return function(_0x1f0aa2){if(!_0x1f0aa2){_0x338f6f['sendStatus'](0x194);}return _0x1f0aa2;};}function handleError(_0x330825,_0x5ac58b){_0x5ac58b=_0x5ac58b||0x1f4;return function(_0x5d64bd){logger['error'](_0x5d64bd['stack']);if(_0x5d64bd[_0xa1f2('0x27')]){delete _0x5d64bd[_0xa1f2('0x27')];}_0x330825[_0xa1f2('0x1d')](_0x5ac58b)[_0xa1f2('0x28')](_0x5d64bd);};}exports['index']=function(_0x524c69,_0x1bbac3){var _0x3b1ca9={},_0x35ed68={},_0xf191dc={'count':0x0,'rows':[]};var _0x368359=_[_0xa1f2('0x29')](db[_0xa1f2('0x2a')][_0xa1f2('0x2b')],function(_0x38c378){return{'name':_0x38c378[_0xa1f2('0x2c')],'type':_0x38c378['type']['key']};});_0x35ed68[_0xa1f2('0x2d')]=_['map'](_0x368359,'name');_0x35ed68[_0xa1f2('0x2e')]=_[_0xa1f2('0x2f')](_0x524c69[_0xa1f2('0x2e')]);_0x35ed68[_0xa1f2('0x30')]=_[_0xa1f2('0x31')](_0x35ed68[_0xa1f2('0x2d')],_0x35ed68['query']);_0x3b1ca9[_0xa1f2('0x32')]=_[_0xa1f2('0x31')](_0x35ed68[_0xa1f2('0x2d')],qs[_0xa1f2('0x33')](_0x524c69[_0xa1f2('0x2e')][_0xa1f2('0x33')]));_0x3b1ca9[_0xa1f2('0x32')]=_0x3b1ca9['attributes'][_0xa1f2('0x34')]?_0x3b1ca9[_0xa1f2('0x32')]:_0x35ed68['model'];if(!_0x524c69[_0xa1f2('0x2e')][_0xa1f2('0x35')](_0xa1f2('0x36'))){_0x3b1ca9[_0xa1f2('0x20')]=qs[_0xa1f2('0x20')](_0x524c69[_0xa1f2('0x2e')][_0xa1f2('0x20')]);_0x3b1ca9['offset']=qs['offset'](_0x524c69[_0xa1f2('0x2e')][_0xa1f2('0x1e')]);}_0x3b1ca9[_0xa1f2('0x37')]=qs['sort'](_0x524c69[_0xa1f2('0x2e')]['sort']);_0x3b1ca9[_0xa1f2('0x38')]=qs[_0xa1f2('0x30')](_[_0xa1f2('0x39')](_0x524c69['query'],_0x35ed68['filters']),_0x368359);if(_0x524c69[_0xa1f2('0x2e')]['filter']){_0x3b1ca9[_0xa1f2('0x38')]=_['merge'](_0x3b1ca9[_0xa1f2('0x38')],{'$or':_[_0xa1f2('0x29')](_0x368359,function(_0x40b91c){if(_0x40b91c[_0xa1f2('0x3a')]!==_0xa1f2('0x3b')){var _0x59e88b={};_0x59e88b[_0x40b91c[_0xa1f2('0x27')]]={'$like':'%'+_0x524c69[_0xa1f2('0x2e')][_0xa1f2('0x3c')]+'%'};return _0x59e88b;}})});}_0x3b1ca9=_[_0xa1f2('0x3d')]({},_0x3b1ca9,_0x524c69[_0xa1f2('0x3e')]);var _0x4d37db={'where':_0x3b1ca9[_0xa1f2('0x38')]};return db['Dynamics365Field'][_0xa1f2('0x21')](_0x4d37db)[_0xa1f2('0x26')](function(_0x269cc4){_0xf191dc['count']=_0x269cc4;if(_0x524c69[_0xa1f2('0x2e')][_0xa1f2('0x3f')]){_0x3b1ca9['include']=[{'all':!![]}];}return db[_0xa1f2('0x2a')]['findAll'](_0x3b1ca9);})[_0xa1f2('0x26')](function(_0x3d5900){_0xf191dc['rows']=_0x3d5900;return _0xf191dc;})['then'](respondWithFilteredResult(_0x1bbac3,_0x3b1ca9))[_0xa1f2('0x40')](handleError(_0x1bbac3,null));};exports[_0xa1f2('0x41')]=function(_0x11d941,_0x1e15ec){var _0x5106fe={'raw':!![],'where':{'id':_0x11d941[_0xa1f2('0x42')]['id']}},_0x18dd21={};_0x18dd21[_0xa1f2('0x2d')]=_[_0xa1f2('0x2f')](db['Dynamics365Field'][_0xa1f2('0x2b')]);_0x18dd21[_0xa1f2('0x2e')]=_[_0xa1f2('0x2f')](_0x11d941[_0xa1f2('0x2e')]);_0x18dd21[_0xa1f2('0x30')]=_['intersection'](_0x18dd21[_0xa1f2('0x2d')],_0x18dd21[_0xa1f2('0x2e')]);_0x5106fe['attributes']=_[_0xa1f2('0x31')](_0x18dd21[_0xa1f2('0x2d')],qs[_0xa1f2('0x33')](_0x11d941[_0xa1f2('0x2e')][_0xa1f2('0x33')]));_0x5106fe[_0xa1f2('0x32')]=_0x5106fe['attributes'][_0xa1f2('0x34')]?_0x5106fe[_0xa1f2('0x32')]:_0x18dd21[_0xa1f2('0x2d')];if(_0x11d941[_0xa1f2('0x2e')][_0xa1f2('0x3f')]){_0x5106fe[_0xa1f2('0x43')]=[{'all':!![]}];}_0x5106fe=_[_0xa1f2('0x3d')]({},_0x5106fe,_0x11d941[_0xa1f2('0x3e')]);return db[_0xa1f2('0x2a')][_0xa1f2('0x44')](_0x5106fe)[_0xa1f2('0x26')](handleEntityNotFound(_0x1e15ec,null))[_0xa1f2('0x26')](respondWithResult(_0x1e15ec,null))[_0xa1f2('0x40')](handleError(_0x1e15ec,null));};exports[_0xa1f2('0x45')]=function(_0x85f1bf,_0x55c1f3){return db[_0xa1f2('0x2a')][_0xa1f2('0x45')](_0x85f1bf[_0xa1f2('0x46')],{})[_0xa1f2('0x26')](respondWithResult(_0x55c1f3,0xc9))[_0xa1f2('0x40')](handleError(_0x55c1f3,null));};exports[_0xa1f2('0x25')]=function(_0x4f5a6a,_0xdda259){if(_0x4f5a6a[_0xa1f2('0x46')]['id']){delete _0x4f5a6a[_0xa1f2('0x46')]['id'];}return db[_0xa1f2('0x2a')][_0xa1f2('0x44')]({'where':{'id':_0x4f5a6a['params']['id']}})[_0xa1f2('0x26')](handleEntityNotFound(_0xdda259,null))[_0xa1f2('0x26')](saveUpdates(_0x4f5a6a[_0xa1f2('0x46')],null))[_0xa1f2('0x26')](respondWithResult(_0xdda259,null))[_0xa1f2('0x40')](handleError(_0xdda259,null));};exports['destroy']=function(_0x227cca,_0x3098c2){return db['Dynamics365Field'][_0xa1f2('0x44')]({'where':{'id':_0x227cca[_0xa1f2('0x42')]['id']}})['then'](handleEntityNotFound(_0x3098c2,null))['then'](removeEntity(_0x3098c2,null))[_0xa1f2('0x40')](handleError(_0x3098c2,null));}; \ No newline at end of file +var _0xe911=['apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Field','fieldName','key','query','keys','filters','model','attributes','intersection','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','rawAttributes','fields','length','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json'];(function(_0xd426d8,_0x351e8c){var _0x2b0879=function(_0x1fb23e){while(--_0x1fb23e){_0xd426d8['push'](_0xd426d8['shift']());}};_0x2b0879(++_0x351e8c);}(_0xe911,0x14d));var _0x1e91=function(_0x22404b,_0x3411ce){_0x22404b=_0x22404b-0x0;var _0x7d4704=_0xe911[_0x22404b];return _0x7d4704;};'use strict';var emlformat=require(_0x1e91('0x0'));var rimraf=require(_0x1e91('0x1'));var zipdir=require(_0x1e91('0x2'));var jsonpatch=require(_0x1e91('0x3'));var rp=require(_0x1e91('0x4'));var moment=require(_0x1e91('0x5'));var BPromise=require(_0x1e91('0x6'));var Mustache=require('mustache');var util=require(_0x1e91('0x7'));var path=require(_0x1e91('0x8'));var sox=require(_0x1e91('0x9'));var csv=require(_0x1e91('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e91('0xb'));var squel=require(_0x1e91('0xc'));var crypto=require(_0x1e91('0xd'));var jsforce=require(_0x1e91('0xe'));var deskjs=require(_0x1e91('0xf'));var toCsv=require(_0x1e91('0xa'));var querystring=require('querystring');var Papa=require(_0x1e91('0x10'));var Redis=require(_0x1e91('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1e91('0x12'));var hardwareService=require(_0x1e91('0x13'));var logger=require(_0x1e91('0x14'))('api');var utils=require(_0x1e91('0x15'));var config=require(_0x1e91('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e91('0x17'))['db'];function respondWithStatusCode(_0x3ce212,_0x1fa00c){_0x1fa00c=_0x1fa00c||0xcc;return function(_0xeea9bf){if(_0xeea9bf){return _0x3ce212['sendStatus'](_0x1fa00c);}return _0x3ce212['status'](_0x1fa00c)['end']();};}function respondWithResult(_0x5d9d75,_0xf9e47){_0xf9e47=_0xf9e47||0xc8;return function(_0x34949c){if(_0x34949c){return _0x5d9d75[_0x1e91('0x18')](_0xf9e47)['json'](_0x34949c);}};}function respondWithFilteredResult(_0x25e37b,_0x1274db){return function(_0x23cb18){if(_0x23cb18){var _0x2daeac=typeof _0x1274db[_0x1e91('0x19')]===_0x1e91('0x1a')&&typeof _0x1274db[_0x1e91('0x1b')]===_0x1e91('0x1a');var _0x2a9872=_0x23cb18[_0x1e91('0x1c')];var _0x2ce94c=_0x2daeac?0x0:_0x1274db[_0x1e91('0x19')];var _0x3b059e=_0x2daeac?_0x23cb18[_0x1e91('0x1c')]:_0x1274db[_0x1e91('0x19')]+_0x1274db['limit'];var _0xdb09c9;if(_0x3b059e>=_0x2a9872){_0x3b059e=_0x2a9872;_0xdb09c9=0xc8;}else{_0xdb09c9=0xce;}_0x25e37b[_0x1e91('0x18')](_0xdb09c9);return _0x25e37b[_0x1e91('0x1d')](_0x1e91('0x1e'),_0x2ce94c+'-'+_0x3b059e+'/'+_0x2a9872)[_0x1e91('0x1f')](_0x23cb18);}return null;};}function patchUpdates(_0x2262d0){return function(_0x4c940e){try{jsonpatch[_0x1e91('0x20')](_0x4c940e,_0x2262d0,!![]);}catch(_0x14a570){return BPromise['reject'](_0x14a570);}return _0x4c940e[_0x1e91('0x21')]();};}function saveUpdates(_0x3eced1,_0x170e28){return function(_0x37219d){if(_0x37219d){return _0x37219d[_0x1e91('0x22')](_0x3eced1)[_0x1e91('0x23')](function(_0x986a77){return _0x986a77;});}return null;};}function removeEntity(_0xa42cf2,_0x1601cc){return function(_0x51b98b){if(_0x51b98b){return _0x51b98b[_0x1e91('0x24')]()['then'](function(){_0xa42cf2[_0x1e91('0x18')](0xcc)[_0x1e91('0x25')]();});}};}function handleEntityNotFound(_0x22cc77,_0x55a21f){return function(_0x127f84){if(!_0x127f84){_0x22cc77[_0x1e91('0x26')](0x194);}return _0x127f84;};}function handleError(_0x57ddd8,_0x574039){_0x574039=_0x574039||0x1f4;return function(_0x38c775){logger[_0x1e91('0x27')](_0x38c775[_0x1e91('0x28')]);if(_0x38c775[_0x1e91('0x29')]){delete _0x38c775['name'];}_0x57ddd8[_0x1e91('0x18')](_0x574039)[_0x1e91('0x2a')](_0x38c775);};}exports[_0x1e91('0x2b')]=function(_0x4940ed,_0x42cba6){var _0x507207={},_0x5d5537={},_0x4de7bb={'count':0x0,'rows':[]};var _0x6f4c01=_[_0x1e91('0x2c')](db[_0x1e91('0x2d')]['rawAttributes'],function(_0x19be4d){return{'name':_0x19be4d[_0x1e91('0x2e')],'type':_0x19be4d['type'][_0x1e91('0x2f')]};});_0x5d5537['model']=_[_0x1e91('0x2c')](_0x6f4c01,_0x1e91('0x29'));_0x5d5537[_0x1e91('0x30')]=_[_0x1e91('0x31')](_0x4940ed[_0x1e91('0x30')]);_0x5d5537[_0x1e91('0x32')]=_['intersection'](_0x5d5537[_0x1e91('0x33')],_0x5d5537[_0x1e91('0x30')]);_0x507207[_0x1e91('0x34')]=_[_0x1e91('0x35')](_0x5d5537[_0x1e91('0x33')],qs['fields'](_0x4940ed[_0x1e91('0x30')]['fields']));_0x507207[_0x1e91('0x34')]=_0x507207[_0x1e91('0x34')]['length']?_0x507207[_0x1e91('0x34')]:_0x5d5537['model'];if(!_0x4940ed[_0x1e91('0x30')]['hasOwnProperty']('nolimit')){_0x507207[_0x1e91('0x1b')]=qs[_0x1e91('0x1b')](_0x4940ed['query'][_0x1e91('0x1b')]);_0x507207[_0x1e91('0x19')]=qs[_0x1e91('0x19')](_0x4940ed['query'][_0x1e91('0x19')]);}_0x507207['order']=qs['sort'](_0x4940ed[_0x1e91('0x30')]['sort']);_0x507207[_0x1e91('0x36')]=qs[_0x1e91('0x32')](_['pick'](_0x4940ed[_0x1e91('0x30')],_0x5d5537[_0x1e91('0x32')]),_0x6f4c01);if(_0x4940ed[_0x1e91('0x30')][_0x1e91('0x37')]){_0x507207[_0x1e91('0x36')]=_['merge'](_0x507207[_0x1e91('0x36')],{'$or':_['map'](_0x6f4c01,function(_0x27aa40){if(_0x27aa40[_0x1e91('0x38')]!==_0x1e91('0x39')){var _0x23e96a={};_0x23e96a[_0x27aa40[_0x1e91('0x29')]]={'$like':'%'+_0x4940ed[_0x1e91('0x30')][_0x1e91('0x37')]+'%'};return _0x23e96a;}})});}_0x507207=_[_0x1e91('0x3a')]({},_0x507207,_0x4940ed[_0x1e91('0x3b')]);var _0x49e775={'where':_0x507207[_0x1e91('0x36')]};return db[_0x1e91('0x2d')][_0x1e91('0x1c')](_0x49e775)[_0x1e91('0x23')](function(_0x368783){_0x4de7bb['count']=_0x368783;if(_0x4940ed[_0x1e91('0x30')][_0x1e91('0x3c')]){_0x507207[_0x1e91('0x3d')]=[{'all':!![]}];}return db[_0x1e91('0x2d')][_0x1e91('0x3e')](_0x507207);})[_0x1e91('0x23')](function(_0x548bfe){_0x4de7bb[_0x1e91('0x3f')]=_0x548bfe;return _0x4de7bb;})[_0x1e91('0x23')](respondWithFilteredResult(_0x42cba6,_0x507207))['catch'](handleError(_0x42cba6,null));};exports[_0x1e91('0x40')]=function(_0x770669,_0x597a6d){var _0x2424c0={'raw':!![],'where':{'id':_0x770669['params']['id']}},_0x489ad1={};_0x489ad1['model']=_[_0x1e91('0x31')](db['Dynamics365Field'][_0x1e91('0x41')]);_0x489ad1[_0x1e91('0x30')]=_['keys'](_0x770669[_0x1e91('0x30')]);_0x489ad1[_0x1e91('0x32')]=_[_0x1e91('0x35')](_0x489ad1['model'],_0x489ad1[_0x1e91('0x30')]);_0x2424c0[_0x1e91('0x34')]=_[_0x1e91('0x35')](_0x489ad1[_0x1e91('0x33')],qs['fields'](_0x770669['query'][_0x1e91('0x42')]));_0x2424c0[_0x1e91('0x34')]=_0x2424c0['attributes'][_0x1e91('0x43')]?_0x2424c0[_0x1e91('0x34')]:_0x489ad1[_0x1e91('0x33')];if(_0x770669['query'][_0x1e91('0x3c')]){_0x2424c0[_0x1e91('0x3d')]=[{'all':!![]}];}_0x2424c0=_[_0x1e91('0x3a')]({},_0x2424c0,_0x770669[_0x1e91('0x3b')]);return db['Dynamics365Field'][_0x1e91('0x44')](_0x2424c0)['then'](handleEntityNotFound(_0x597a6d,null))[_0x1e91('0x23')](respondWithResult(_0x597a6d,null))[_0x1e91('0x45')](handleError(_0x597a6d,null));};exports[_0x1e91('0x46')]=function(_0x1709e9,_0x21d797){return db[_0x1e91('0x2d')][_0x1e91('0x46')](_0x1709e9[_0x1e91('0x47')],{})[_0x1e91('0x23')](respondWithResult(_0x21d797,0xc9))['catch'](handleError(_0x21d797,null));};exports['update']=function(_0xe321f4,_0x331cf4){if(_0xe321f4[_0x1e91('0x47')]['id']){delete _0xe321f4[_0x1e91('0x47')]['id'];}return db[_0x1e91('0x2d')][_0x1e91('0x44')]({'where':{'id':_0xe321f4['params']['id']}})['then'](handleEntityNotFound(_0x331cf4,null))[_0x1e91('0x23')](saveUpdates(_0xe321f4[_0x1e91('0x47')],null))[_0x1e91('0x23')](respondWithResult(_0x331cf4,null))['catch'](handleError(_0x331cf4,null));};exports['destroy']=function(_0x13e39b,_0x5c33e4){return db['Dynamics365Field'][_0x1e91('0x44')]({'where':{'id':_0x13e39b[_0x1e91('0x48')]['id']}})[_0x1e91('0x23')](handleEntityNotFound(_0x5c33e4,null))[_0x1e91('0x23')](removeEntity(_0x5c33e4,null))[_0x1e91('0x45')](handleError(_0x5c33e4,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 7321548..b821fdc 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 _0x40f5=['./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0xf29853,_0x629ecb){var _0x5ac989=function(_0x38aaa5){while(--_0x38aaa5){_0xf29853['push'](_0xf29853['shift']());}};_0x5ac989(++_0x629ecb);}(_0x40f5,0x1d8));var _0x540f=function(_0x55cf9d,_0x2795b3){_0x55cf9d=_0x55cf9d-0x0;var _0x2fd425=_0x40f5[_0x55cf9d];return _0x2fd425;};'use strict';var _=require(_0x540f('0x0'));var util=require(_0x540f('0x1'));var logger=require(_0x540f('0x2'))(_0x540f('0x3'));var moment=require(_0x540f('0x4'));var BPromise=require('bluebird');var rp=require(_0x540f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x540f('0x6'));var config=require(_0x540f('0x7'));var attributes=require(_0x540f('0x8'));module[_0x540f('0x9')]=function(_0x2ffaef,_0x5727f3){return _0x2ffaef[_0x540f('0xa')](_0x540f('0xb'),attributes,{'tableName':_0x540f('0xc'),'paranoid':![],'indexes':[{'name':_0x540f('0xd'),'fields':[_0x540f('0xe'),_0x540f('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ce0=['util','../../config/logger','bluebird','request-promise','path','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','idField','FieldId'];(function(_0x1193ea,_0xc04ef0){var _0x5e4000=function(_0xe18bde){while(--_0xe18bde){_0x1193ea['push'](_0x1193ea['shift']());}};_0x5e4000(++_0xc04ef0);}(_0x8ce0,0x1d9));var _0x08ce=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x8ce0[_0x220f3f];return _0x1f170e;};'use strict';var _=require('lodash');var util=require(_0x08ce('0x0'));var logger=require(_0x08ce('0x1'))('api');var moment=require('moment');var BPromise=require(_0x08ce('0x2'));var rp=require(_0x08ce('0x3'));var fs=require('fs');var path=require(_0x08ce('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x08ce('0x5'));module[_0x08ce('0x6')]=function(_0xca7a52,_0x3f7e7c){return _0xca7a52['define'](_0x08ce('0x7'),attributes,{'tableName':_0x08ce('0x8'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x08ce('0x9'),_0x08ce('0xa')],'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 a41f7da..c6e480e 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 _0xca53=['http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x5e76d4,_0x4d6b28){var _0x52151b=function(_0x3ca419){while(--_0x3ca419){_0x5e76d4['push'](_0x5e76d4['shift']());}};_0x52151b(++_0x4d6b28);}(_0xca53,0x173));var _0x3ca5=function(_0x81a26e,_0x4a6f01){_0x81a26e=_0x81a26e-0x0;var _0x343910=_0xca53[_0x81a26e];return _0x343910;};'use strict';var _=require(_0x3ca5('0x0'));var util=require('util');var moment=require(_0x3ca5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ca5('0x2'));var db=require(_0x3ca5('0x3'))['db'];var utils=require(_0x3ca5('0x4'));var logger=require(_0x3ca5('0x5'))(_0x3ca5('0x6'));var config=require(_0x3ca5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3ca5('0x8')][_0x3ca5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x366695,_0x30b038,_0x479532){return new BPromise(function(_0x13b4d6,_0x446b28){return client[_0x3ca5('0xa')](_0x366695,_0x479532)[_0x3ca5('0xb')](function(_0x71750d){logger[_0x3ca5('0xc')](_0x3ca5('0xd'),_0x30b038,_0x3ca5('0xe'));logger[_0x3ca5('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x30b038,_0x3ca5('0xe'),JSON['stringify'](_0x71750d));if(_0x71750d[_0x3ca5('0x10')]){if(_0x71750d['error'][_0x3ca5('0x11')]===0x1f4){logger['error'](_0x3ca5('0xd'),_0x30b038,_0x71750d[_0x3ca5('0x10')]['message']);return _0x446b28(_0x71750d[_0x3ca5('0x10')][_0x3ca5('0x12')]);}logger[_0x3ca5('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x30b038,_0x71750d[_0x3ca5('0x10')][_0x3ca5('0x12')]);return _0x13b4d6(_0x71750d[_0x3ca5('0x10')][_0x3ca5('0x12')]);}else{logger['info'](_0x3ca5('0xd'),_0x30b038,_0x3ca5('0xe'));_0x13b4d6(_0x71750d[_0x3ca5('0x13')][_0x3ca5('0x12')]);}})['catch'](function(_0xc366cb){logger[_0x3ca5('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x30b038,_0xc366cb);_0x446b28(_0xc366cb);});});} \ No newline at end of file +var _0xe860=['rpc','../../config/environment','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x56ae6c,_0x2f1dbc){var _0x4a9397=function(_0x29f1a8){while(--_0x29f1a8){_0x56ae6c['push'](_0x56ae6c['shift']());}};_0x4a9397(++_0x2f1dbc);}(_0xe860,0x168));var _0x0e86=function(_0x1260db,_0x538538){_0x1260db=_0x1260db-0x0;var _0x48fc19=_0xe860[_0x1260db];return _0x48fc19;};'use strict';var _=require(_0x0e86('0x0'));var util=require(_0x0e86('0x1'));var moment=require(_0x0e86('0x2'));var BPromise=require(_0x0e86('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e86('0x4'));var db=require(_0x0e86('0x5'))['db'];var utils=require(_0x0e86('0x6'));var logger=require(_0x0e86('0x7'))(_0x0e86('0x8'));var config=require(_0x0e86('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a97a4,_0x59a0a4,_0x554a73){return new BPromise(function(_0x5a94e7,_0xbe49ba){return client[_0x0e86('0xa')](_0x2a97a4,_0x554a73)[_0x0e86('0xb')](function(_0x30bbd2){logger[_0x0e86('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x59a0a4,_0x0e86('0xd'));logger[_0x0e86('0xe')](_0x0e86('0xf'),_0x59a0a4,_0x0e86('0xd'),JSON[_0x0e86('0x10')](_0x30bbd2));if(_0x30bbd2[_0x0e86('0x11')]){if(_0x30bbd2[_0x0e86('0x11')][_0x0e86('0x12')]===0x1f4){logger[_0x0e86('0x11')](_0x0e86('0x13'),_0x59a0a4,_0x30bbd2[_0x0e86('0x11')][_0x0e86('0x14')]);return _0xbe49ba(_0x30bbd2[_0x0e86('0x11')]['message']);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x59a0a4,_0x30bbd2['error'][_0x0e86('0x14')]);return _0x5a94e7(_0x30bbd2['error'][_0x0e86('0x14')]);}else{logger[_0x0e86('0xc')](_0x0e86('0x13'),_0x59a0a4,_0x0e86('0xd'));_0x5a94e7(_0x30bbd2[_0x0e86('0x15')]['message']);}})[_0x0e86('0x16')](function(_0x4b7aac){logger[_0x0e86('0x11')](_0x0e86('0x13'),_0x59a0a4,_0x4b7aac);_0xbe49ba(_0x4b7aac);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index eaef0c4..01f92a7 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 _0x5072=['fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x232571,_0x5dc4e0){var _0xd2ca6f=function(_0x2b6ef4){while(--_0x2b6ef4){_0x232571['push'](_0x232571['shift']());}};_0xd2ca6f(++_0x5dc4e0);}(_0x5072,0x8b));var _0x2507=function(_0x4ee10d,_0x378c5c){_0x4ee10d=_0x4ee10d-0x0;var _0x56480f=_0x5072[_0x4ee10d];return _0x56480f;};'use strict';var multer=require('multer');var util=require(_0x2507('0x0'));var path=require(_0x2507('0x1'));var timeout=require(_0x2507('0x2'));var express=require(_0x2507('0x3'));var router=express[_0x2507('0x4')]();var fs_extra=require(_0x2507('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2507('0x6'));var config=require(_0x2507('0x7'));var controller=require(_0x2507('0x8'));router[_0x2507('0x9')]('/',auth[_0x2507('0xa')](),controller['index']);router['get'](_0x2507('0xb'),auth[_0x2507('0xa')](),controller[_0x2507('0xc')]);router[_0x2507('0x9')](_0x2507('0xd'),auth[_0x2507('0xa')](),controller[_0x2507('0xe')]);router[_0x2507('0x9')](_0x2507('0xf'),auth[_0x2507('0xa')](),controller[_0x2507('0x10')]);router[_0x2507('0x11')]('/',auth[_0x2507('0xa')](),controller[_0x2507('0x12')]);router[_0x2507('0x11')](_0x2507('0xd'),auth[_0x2507('0xa')](),controller[_0x2507('0x13')]);router[_0x2507('0x14')](_0x2507('0xb'),auth[_0x2507('0xa')](),controller['update']);router[_0x2507('0x15')](_0x2507('0xb'),auth[_0x2507('0xa')](),controller[_0x2507('0x16')]);module[_0x2507('0x17')]=router; \ No newline at end of file +var _0xc237=['isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xc237,0x8b));var _0x7c23=function(_0x2f2f32,_0x1d247d){_0x2f2f32=_0x2f2f32-0x0;var _0x42bb55=_0xc237[_0x2f2f32];return _0x42bb55;};'use strict';var multer=require(_0x7c23('0x0'));var util=require(_0x7c23('0x1'));var path=require(_0x7c23('0x2'));var timeout=require(_0x7c23('0x3'));var express=require('express');var router=express[_0x7c23('0x4')]();var fs_extra=require(_0x7c23('0x5'));var auth=require(_0x7c23('0x6'));var interaction=require(_0x7c23('0x7'));var config=require(_0x7c23('0x8'));var controller=require(_0x7c23('0x9'));router[_0x7c23('0xa')]('/',auth[_0x7c23('0xb')](),controller[_0x7c23('0xc')]);router[_0x7c23('0xa')](_0x7c23('0xd'),auth[_0x7c23('0xb')](),controller[_0x7c23('0xe')]);router['get']('/:id/configurations',auth[_0x7c23('0xb')](),controller[_0x7c23('0xf')]);router[_0x7c23('0xa')](_0x7c23('0x10'),auth[_0x7c23('0xb')](),controller[_0x7c23('0x11')]);router[_0x7c23('0x12')]('/',auth[_0x7c23('0xb')](),controller[_0x7c23('0x13')]);router[_0x7c23('0x12')]('/:id/configurations',auth[_0x7c23('0xb')](),controller['addConfiguration']);router[_0x7c23('0x14')](_0x7c23('0xd'),auth[_0x7c23('0xb')](),controller[_0x7c23('0x15')]);router[_0x7c23('0x16')](_0x7c23('0xd'),auth[_0x7c23('0xb')](),controller[_0x7c23('0x17')]);module[_0x7c23('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 48d2246..ec4487a 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 _0x9536=['username','remoteUri','sequelize','exports','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9536,0x179));var _0x6953=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0x9536[_0x5774be];return _0x4914b4;};'use strict';var Sequelize=require(_0x6953('0x0'));module[_0x6953('0x1')]={'name':{'type':Sequelize[_0x6953('0x2')]},'description':{'type':Sequelize[_0x6953('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6953('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6953('0x2')],'unique':_0x6953('0x4')},'serverUrl':{'type':Sequelize[_0x6953('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x583c=['exports','STRING','username','sequelize'];(function(_0x24a9cb,_0x2daa73){var _0x4c6519=function(_0x36e167){while(--_0x36e167){_0x24a9cb['push'](_0x24a9cb['shift']());}};_0x4c6519(++_0x2daa73);}(_0x583c,0x12b));var _0xc583=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0x583c[_0x39106e];return _0x892aec;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'name':{'type':Sequelize[_0xc583('0x2')]},'description':{'type':Sequelize[_0xc583('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc583('0x3')},'apiKey':{'type':Sequelize[_0xc583('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xc583('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 6110d2f..d2001db 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 _0x2e16=['Subjects','getSubjects','channel','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','GET','%s/%s','format','Basic\x20%s','%s:X','toString','base64','requester','agent','description','group','source','company','remove','custom_text','custom_dropdown','label','default','choices','capitalize','statusCode','stringify','test','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','json','apply','reject','update','then','error','name','send','map','FreshdeskAccount','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','keys','intersection','find','create','body','params','getConfigurations','findOne','nolimit','addConfiguration','AccountId'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x2e16,0x8d));var _0x62e1=function(_0x241756,_0x9df9d2){_0x241756=_0x241756-0x0;var _0x52d1f9=_0x2e16[_0x241756];return _0x52d1f9;};'use strict';var emlformat=require(_0x62e1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x62e1('0x1'));var moment=require(_0x62e1('0x2'));var BPromise=require(_0x62e1('0x3'));var Mustache=require(_0x62e1('0x4'));var util=require('util');var path=require(_0x62e1('0x5'));var sox=require(_0x62e1('0x6'));var csv=require(_0x62e1('0x7'));var ejs=require(_0x62e1('0x8'));var fs=require('fs');var fs_extra=require(_0x62e1('0x9'));var _=require(_0x62e1('0xa'));var squel=require(_0x62e1('0xb'));var crypto=require(_0x62e1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x62e1('0xd'));var toCsv=require(_0x62e1('0x7'));var querystring=require('querystring');var Papa=require(_0x62e1('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x62e1('0xf'));var as=require(_0x62e1('0x10'));var hardwareService=require(_0x62e1('0x11'));var logger=require(_0x62e1('0x12'))(_0x62e1('0x13'));var utils=require(_0x62e1('0x14'));var config=require(_0x62e1('0x15'));var licenseUtil=require(_0x62e1('0x16'));var db=require(_0x62e1('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x58661f,_0x321852){_0x321852=_0x321852||0xcc;return function(_0x327ce2){if(_0x327ce2){return _0x58661f[_0x62e1('0x18')](_0x321852);}return _0x58661f[_0x62e1('0x19')](_0x321852)[_0x62e1('0x1a')]();};}function respondWithResult(_0xbaa725,_0x5101e2){_0x5101e2=_0x5101e2||0xc8;return function(_0x27cd5c){if(_0x27cd5c){return _0xbaa725[_0x62e1('0x19')](_0x5101e2)['json'](_0x27cd5c);}};}function respondWithFilteredResult(_0x18ae71,_0x43bf9b){return function(_0x5b439e){if(_0x5b439e){var _0x46e103=typeof _0x43bf9b[_0x62e1('0x1b')]==='undefined'&&typeof _0x43bf9b[_0x62e1('0x1c')]==='undefined';var _0x3610e2=_0x5b439e[_0x62e1('0x1d')];var _0x573b94=_0x46e103?0x0:_0x43bf9b['offset'];var _0x4c9e9e=_0x46e103?_0x5b439e['count']:_0x43bf9b[_0x62e1('0x1b')]+_0x43bf9b[_0x62e1('0x1c')];var _0x52c946;if(_0x4c9e9e>=_0x3610e2){_0x4c9e9e=_0x3610e2;_0x52c946=0xc8;}else{_0x52c946=0xce;}_0x18ae71[_0x62e1('0x19')](_0x52c946);return _0x18ae71[_0x62e1('0x1e')]('Content-Range',_0x573b94+'-'+_0x4c9e9e+'/'+_0x3610e2)[_0x62e1('0x1f')](_0x5b439e);}return null;};}function patchUpdates(_0x3936a9){return function(_0x5dd62d){try{jsonpatch[_0x62e1('0x20')](_0x5dd62d,_0x3936a9,!![]);}catch(_0x256b4c){return BPromise[_0x62e1('0x21')](_0x256b4c);}return _0x5dd62d['save']();};}function saveUpdates(_0x23c244,_0x260d09){return function(_0x11ee84){if(_0x11ee84){return _0x11ee84[_0x62e1('0x22')](_0x23c244)[_0x62e1('0x23')](function(_0x40316b){return _0x40316b;});}return null;};}function removeEntity(_0x2bc190,_0x1f44af){return function(_0x2b1584){if(_0x2b1584){return _0x2b1584['destroy']()[_0x62e1('0x23')](function(){_0x2bc190['status'](0xcc)[_0x62e1('0x1a')]();});}};}function handleEntityNotFound(_0xfa73d3,_0xba9310){return function(_0x492dff){if(!_0x492dff){_0xfa73d3[_0x62e1('0x18')](0x194);}return _0x492dff;};}function handleError(_0xc8624d,_0x433d42){_0x433d42=_0x433d42||0x1f4;return function(_0x5ea67b){logger[_0x62e1('0x24')](_0x5ea67b['stack']);if(_0x5ea67b['name']){delete _0x5ea67b[_0x62e1('0x25')];}_0xc8624d[_0x62e1('0x19')](_0x433d42)[_0x62e1('0x26')](_0x5ea67b);};}exports['index']=function(_0x2f1349,_0x28fb00){var _0x1e7264={},_0x9b39f2={},_0x295365={'count':0x0,'rows':[]};var _0x50c459=_[_0x62e1('0x27')](db[_0x62e1('0x28')][_0x62e1('0x29')],function(_0x3910c2){return{'name':_0x3910c2[_0x62e1('0x2a')],'type':_0x3910c2['type'][_0x62e1('0x2b')]};});_0x9b39f2[_0x62e1('0x2c')]=_[_0x62e1('0x27')](_0x50c459,_0x62e1('0x25'));_0x9b39f2[_0x62e1('0x2d')]=_['keys'](_0x2f1349[_0x62e1('0x2d')]);_0x9b39f2[_0x62e1('0x2e')]=_['intersection'](_0x9b39f2[_0x62e1('0x2c')],_0x9b39f2['query']);_0x1e7264[_0x62e1('0x2f')]=_['intersection'](_0x9b39f2[_0x62e1('0x2c')],qs[_0x62e1('0x30')](_0x2f1349[_0x62e1('0x2d')][_0x62e1('0x30')]));_0x1e7264[_0x62e1('0x2f')]=_0x1e7264[_0x62e1('0x2f')][_0x62e1('0x31')]?_0x1e7264[_0x62e1('0x2f')]:_0x9b39f2['model'];if(!_0x2f1349[_0x62e1('0x2d')][_0x62e1('0x32')]('nolimit')){_0x1e7264[_0x62e1('0x1c')]=qs[_0x62e1('0x1c')](_0x2f1349[_0x62e1('0x2d')][_0x62e1('0x1c')]);_0x1e7264[_0x62e1('0x1b')]=qs[_0x62e1('0x1b')](_0x2f1349[_0x62e1('0x2d')]['offset']);}_0x1e7264[_0x62e1('0x33')]=qs[_0x62e1('0x34')](_0x2f1349[_0x62e1('0x2d')]['sort']);_0x1e7264[_0x62e1('0x35')]=qs['filters'](_[_0x62e1('0x36')](_0x2f1349[_0x62e1('0x2d')],_0x9b39f2['filters']),_0x50c459);if(_0x2f1349[_0x62e1('0x2d')]['filter']){_0x1e7264[_0x62e1('0x35')]=_[_0x62e1('0x37')](_0x1e7264['where'],{'$or':_[_0x62e1('0x27')](_0x50c459,function(_0x227c4d){if(_0x227c4d[_0x62e1('0x38')]!=='VIRTUAL'){var _0x23d050={};_0x23d050[_0x227c4d[_0x62e1('0x25')]]={'$like':'%'+_0x2f1349[_0x62e1('0x2d')][_0x62e1('0x39')]+'%'};return _0x23d050;}})});}_0x1e7264=_['merge']({},_0x1e7264,_0x2f1349[_0x62e1('0x3a')]);var _0x2fedc3={'where':_0x1e7264[_0x62e1('0x35')]};return db[_0x62e1('0x28')][_0x62e1('0x1d')](_0x2fedc3)[_0x62e1('0x23')](function(_0x5d2f22){_0x295365[_0x62e1('0x1d')]=_0x5d2f22;if(_0x2f1349[_0x62e1('0x2d')][_0x62e1('0x3b')]){_0x1e7264[_0x62e1('0x3c')]=[{'all':!![]}];}return db[_0x62e1('0x28')][_0x62e1('0x3d')](_0x1e7264);})[_0x62e1('0x23')](function(_0x256ec9){_0x295365[_0x62e1('0x3e')]=_0x256ec9;return _0x295365;})[_0x62e1('0x23')](respondWithFilteredResult(_0x28fb00,_0x1e7264))[_0x62e1('0x3f')](handleError(_0x28fb00,null));};exports['show']=function(_0x3171bc,_0xdc8579){var _0x40d332={'raw':![],'where':{'id':_0x3171bc['params']['id']}},_0x31fad6={};_0x31fad6[_0x62e1('0x2c')]=_['keys'](db[_0x62e1('0x28')]['rawAttributes']);_0x31fad6[_0x62e1('0x2d')]=_[_0x62e1('0x40')](_0x3171bc[_0x62e1('0x2d')]);_0x31fad6[_0x62e1('0x2e')]=_[_0x62e1('0x41')](_0x31fad6[_0x62e1('0x2c')],_0x31fad6[_0x62e1('0x2d')]);_0x40d332[_0x62e1('0x2f')]=_[_0x62e1('0x41')](_0x31fad6[_0x62e1('0x2c')],qs['fields'](_0x3171bc[_0x62e1('0x2d')][_0x62e1('0x30')]));_0x40d332['attributes']=_0x40d332[_0x62e1('0x2f')]['length']?_0x40d332[_0x62e1('0x2f')]:_0x31fad6[_0x62e1('0x2c')];if(_0x3171bc[_0x62e1('0x2d')][_0x62e1('0x3b')]){_0x40d332[_0x62e1('0x3c')]=[{'all':!![]}];}_0x40d332=_[_0x62e1('0x37')]({},_0x40d332,_0x3171bc[_0x62e1('0x3a')]);return db['FreshdeskAccount'][_0x62e1('0x42')](_0x40d332)[_0x62e1('0x23')](handleEntityNotFound(_0xdc8579,null))[_0x62e1('0x23')](respondWithResult(_0xdc8579,null))['catch'](handleError(_0xdc8579,null));};exports[_0x62e1('0x43')]=function(_0x4a4cb6,_0x4eb236){return db[_0x62e1('0x28')]['create'](_0x4a4cb6[_0x62e1('0x44')],{})['then'](respondWithResult(_0x4eb236,0xc9))[_0x62e1('0x3f')](handleError(_0x4eb236,null));};exports[_0x62e1('0x22')]=function(_0x3880d2,_0x1a0e9a){if(_0x3880d2[_0x62e1('0x44')]['id']){delete _0x3880d2[_0x62e1('0x44')]['id'];}return db[_0x62e1('0x28')][_0x62e1('0x42')]({'where':{'id':_0x3880d2[_0x62e1('0x45')]['id']}})[_0x62e1('0x23')](handleEntityNotFound(_0x1a0e9a,null))[_0x62e1('0x23')](saveUpdates(_0x3880d2[_0x62e1('0x44')],null))[_0x62e1('0x23')](respondWithResult(_0x1a0e9a,null))['catch'](handleError(_0x1a0e9a,null));};exports['destroy']=function(_0x8b61da,_0x12fffa){return db[_0x62e1('0x28')][_0x62e1('0x42')]({'where':{'id':_0x8b61da[_0x62e1('0x45')]['id']}})[_0x62e1('0x23')](handleEntityNotFound(_0x12fffa,null))[_0x62e1('0x23')](removeEntity(_0x12fffa,null))['catch'](handleError(_0x12fffa,null));};exports[_0x62e1('0x46')]=function(_0x3b687a,_0x5a6ed4,_0x251fe9){var _0x4ff566={};var _0x5e1515={};var _0x4078f1;var _0x5b61c1;return db[_0x62e1('0x28')][_0x62e1('0x47')]({'where':{'id':_0x3b687a[_0x62e1('0x45')]['id']}})[_0x62e1('0x23')](handleEntityNotFound(_0x5a6ed4,null))['then'](function(_0x985b48){if(_0x985b48){_0x4078f1=_0x985b48;_0x5e1515['model']=_['keys'](db['FreshdeskConfiguration'][_0x62e1('0x29')]);_0x5e1515[_0x62e1('0x2d')]=_[_0x62e1('0x40')](_0x3b687a['query']);_0x5e1515['filters']=_[_0x62e1('0x41')](_0x5e1515[_0x62e1('0x2c')],_0x5e1515[_0x62e1('0x2d')]);_0x4ff566['attributes']=_[_0x62e1('0x41')](_0x5e1515[_0x62e1('0x2c')],qs[_0x62e1('0x30')](_0x3b687a['query']['fields']));_0x4ff566[_0x62e1('0x2f')]=_0x4ff566[_0x62e1('0x2f')][_0x62e1('0x31')]?_0x4ff566['attributes']:_0x5e1515[_0x62e1('0x2c')];_0x4ff566['order']=qs[_0x62e1('0x34')](_0x3b687a[_0x62e1('0x2d')][_0x62e1('0x34')]);_0x4ff566[_0x62e1('0x35')]=qs[_0x62e1('0x2e')](_[_0x62e1('0x36')](_0x3b687a[_0x62e1('0x2d')],_0x5e1515['filters']));if(_0x3b687a[_0x62e1('0x2d')][_0x62e1('0x39')]){_0x4ff566[_0x62e1('0x35')]=_[_0x62e1('0x37')](_0x4ff566['where'],{'$or':_[_0x62e1('0x27')](_0x4ff566['attributes'],function(_0x42ae35){var _0x19e79e={};_0x19e79e[_0x42ae35]={'$like':'%'+_0x3b687a['query'][_0x62e1('0x39')]+'%'};return _0x19e79e;})});}_0x4ff566=_[_0x62e1('0x37')]({},_0x4ff566,_0x3b687a[_0x62e1('0x3a')]);return _0x4078f1[_0x62e1('0x46')](_0x4ff566);}})[_0x62e1('0x23')](function(_0x4d9ff6){if(_0x4d9ff6){_0x5b61c1=_0x4d9ff6[_0x62e1('0x31')];if(!_0x3b687a['query'][_0x62e1('0x32')](_0x62e1('0x48'))){_0x4ff566[_0x62e1('0x1c')]=qs['limit'](_0x3b687a['query'][_0x62e1('0x1c')]);_0x4ff566['offset']=qs[_0x62e1('0x1b')](_0x3b687a['query'][_0x62e1('0x1b')]);}return _0x4078f1[_0x62e1('0x46')](_0x4ff566);}})[_0x62e1('0x23')](function(_0x561554){if(_0x561554){return _0x561554?{'count':_0x5b61c1,'rows':_0x561554}:null;}})[_0x62e1('0x23')](respondWithResult(_0x5a6ed4,null))[_0x62e1('0x3f')](handleError(_0x5a6ed4,null));};exports[_0x62e1('0x49')]=function(_0x318172,_0x547227,_0x8e5682){if(_0x318172[_0x62e1('0x44')]['id']){delete _0x318172['body']['id'];}return db[_0x62e1('0x28')][_0x62e1('0x47')]({'where':{'id':_0x318172[_0x62e1('0x45')]['id']}})[_0x62e1('0x23')](handleEntityNotFound(_0x547227,null))[_0x62e1('0x23')](function(_0x45262a){if(_0x45262a){_0x318172[_0x62e1('0x44')][_0x62e1('0x4a')]=_0x45262a['id'];_0x318172['body'][_0x62e1('0x4b')]=integrations[_0x62e1('0x4c')](_0x318172[_0x62e1('0x44')][_0x62e1('0x4d')],_0x318172[_0x62e1('0x44')][_0x62e1('0x38')]);_0x318172[_0x62e1('0x44')]['Descriptions']=integrations['getDescriptions'](_0x318172[_0x62e1('0x44')][_0x62e1('0x4d')],_0x318172[_0x62e1('0x44')]['type']);return db['FreshdeskConfiguration'][_0x62e1('0x43')](_0x318172['body'],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db[_0x62e1('0x4e')],'as':_0x62e1('0x4f')}]});}return null;})[_0x62e1('0x23')](respondWithResult(_0x547227,null))[_0x62e1('0x3f')](handleError(_0x547227,null));};exports[_0x62e1('0x50')]=function(_0xeb4fa9,_0x5e54bc,_0x4dd329){var _0x1b5144='';return db[_0x62e1('0x28')]['findOne']({'where':{'id':_0xeb4fa9[_0x62e1('0x45')]['id']},'attributes':['id',_0x62e1('0x51'),_0x62e1('0x52')]})[_0x62e1('0x23')](handleEntityNotFound(_0x5e54bc,null))['then'](function(_0xddf25){if(_0xddf25){_0x1b5144=_0xddf25['remoteUri'];var _0x6cb56c=_0x1b5144[_0x62e1('0x53')](-0x1);if(_0x6cb56c==='/'){_0x1b5144=_0x1b5144[_0x62e1('0x54')](0x0,_0x1b5144['lastIndexOf'](_0x6cb56c));}return rp({'method':_0x62e1('0x55'),'uri':util['format'](_0x62e1('0x56'),_0x1b5144,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x62e1('0x57')](_0x62e1('0x58'),new Buffer(util['format'](_0x62e1('0x59'),_0xddf25[_0x62e1('0x52')]))[_0x62e1('0x5a')](_0x62e1('0x5b')))},'json':!![]});}})[_0x62e1('0x23')](function(_0xc5b011){if(_0xc5b011){var _0x2e65dd=[_0x62e1('0x5c'),'subject',_0x62e1('0x5d'),_0x62e1('0x5e'),_0x62e1('0x19'),'priority',_0x62e1('0x5f'),_0x62e1('0x60'),'ticket_type','group',_0x62e1('0x61')];_[_0x62e1('0x62')](_0xc5b011,function(_0x1cc51b){return _0x2e65dd['includes'](_0x1cc51b[_0x62e1('0x25')])||!_0x1cc51b['default']&&_0x1cc51b[_0x62e1('0x38')]!==_0x62e1('0x63')&&_0x1cc51b[_0x62e1('0x38')]!==_0x62e1('0x64');});return{'count':_0xc5b011[_0x62e1('0x31')],'rows':_[_0x62e1('0x27')](_0xc5b011,function(_0x33d8c1){return{'id':_0x33d8c1[_0x62e1('0x25')],'name':_0x33d8c1[_0x62e1('0x65')],'custom':!_0x33d8c1[_0x62e1('0x66')],'options':_0x33d8c1[_0x62e1('0x67')]?_[_0x62e1('0x27')](_0x33d8c1['choices'],function(_0x2a4b6c){return{'name':_[_0x62e1('0x68')](_0x2a4b6c),'value':_0x2a4b6c};}):[]};})};}})[_0x62e1('0x23')](respondWithResult(_0x5e54bc,null))[_0x62e1('0x3f')](function(_0x125c2d){var _0x51e264=_0xeb4fa9[_0x62e1('0x2d')]['test']?0x1f4:_0x125c2d[_0x62e1('0x69')]||0x1f4;logger[_0x62e1('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x62e1('0x50'),_0x51e264,JSON[_0x62e1('0x6a')](_0x125c2d));delete _0x125c2d['name'];if(_0x51e264===0x191){_0x51e264=0x190;}_0x5e54bc[_0x62e1('0x19')](_0x51e264)[_0x62e1('0x26')](_0xeb4fa9[_0x62e1('0x2d')][_0x62e1('0x6b')]?{'message':'Wrong\x20credentials','statusCode':_0x125c2d['statusCode']}:_0x125c2d);});}; \ No newline at end of file +var _0xd52a=['offset','undefined','count','set','apply','reject','save','then','stack','name','send','index','map','FreshdeskAccount','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','update','find','destroy','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','channel','type','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:X','toString','base64','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json'];(function(_0x2b0661,_0xa854f4){var _0x3cdd13=function(_0x435b7d){while(--_0x435b7d){_0x2b0661['push'](_0x2b0661['shift']());}};_0x3cdd13(++_0xa854f4);}(_0xd52a,0xca));var _0xad52=function(_0x24aaa4,_0x39e135){_0x24aaa4=_0x24aaa4-0x0;var _0x22c848=_0xd52a[_0x24aaa4];return _0x22c848;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad52('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad52('0x1'));var rp=require(_0xad52('0x2'));var moment=require(_0xad52('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xad52('0x4'));var util=require(_0xad52('0x5'));var path=require(_0xad52('0x6'));var sox=require(_0xad52('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad52('0x8'));var squel=require('squel');var crypto=require(_0xad52('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xad52('0xa'));var toCsv=require(_0xad52('0xb'));var querystring=require('querystring');var Papa=require(_0xad52('0xc'));var Redis=require('ioredis');var authService=require(_0xad52('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xad52('0xe'));var hardwareService=require(_0xad52('0xf'));var logger=require(_0xad52('0x10'))(_0xad52('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xad52('0x12'))['db'];var integrations=require(_0xad52('0x13'));function respondWithStatusCode(_0x378b0c,_0x41331e){_0x41331e=_0x41331e||0xcc;return function(_0x11127c){if(_0x11127c){return _0x378b0c[_0xad52('0x14')](_0x41331e);}return _0x378b0c[_0xad52('0x15')](_0x41331e)[_0xad52('0x16')]();};}function respondWithResult(_0x3d2df6,_0x5727a2){_0x5727a2=_0x5727a2||0xc8;return function(_0x330794){if(_0x330794){return _0x3d2df6[_0xad52('0x15')](_0x5727a2)[_0xad52('0x17')](_0x330794);}};}function respondWithFilteredResult(_0x42eb20,_0x38be7e){return function(_0xcb6cd5){if(_0xcb6cd5){var _0x2bbaad=typeof _0x38be7e[_0xad52('0x18')]===_0xad52('0x19')&&typeof _0x38be7e['limit']==='undefined';var _0x2f8ac5=_0xcb6cd5[_0xad52('0x1a')];var _0x351440=_0x2bbaad?0x0:_0x38be7e[_0xad52('0x18')];var _0x33da89=_0x2bbaad?_0xcb6cd5['count']:_0x38be7e[_0xad52('0x18')]+_0x38be7e['limit'];var _0x164ffd;if(_0x33da89>=_0x2f8ac5){_0x33da89=_0x2f8ac5;_0x164ffd=0xc8;}else{_0x164ffd=0xce;}_0x42eb20[_0xad52('0x15')](_0x164ffd);return _0x42eb20[_0xad52('0x1b')]('Content-Range',_0x351440+'-'+_0x33da89+'/'+_0x2f8ac5)[_0xad52('0x17')](_0xcb6cd5);}return null;};}function patchUpdates(_0x593dfd){return function(_0x1bc745){try{jsonpatch[_0xad52('0x1c')](_0x1bc745,_0x593dfd,!![]);}catch(_0x3262e4){return BPromise[_0xad52('0x1d')](_0x3262e4);}return _0x1bc745[_0xad52('0x1e')]();};}function saveUpdates(_0x2f1526,_0x4b5f2f){return function(_0x7de59d){if(_0x7de59d){return _0x7de59d['update'](_0x2f1526)[_0xad52('0x1f')](function(_0x2acbb4){return _0x2acbb4;});}return null;};}function removeEntity(_0x2fa90c,_0x5bce67){return function(_0x379f53){if(_0x379f53){return _0x379f53['destroy']()['then'](function(){_0x2fa90c[_0xad52('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x477b47,_0x3a54a1){return function(_0x537df0){if(!_0x537df0){_0x477b47['sendStatus'](0x194);}return _0x537df0;};}function handleError(_0xb526bf,_0x31b5e0){_0x31b5e0=_0x31b5e0||0x1f4;return function(_0x42db69){logger['error'](_0x42db69[_0xad52('0x20')]);if(_0x42db69['name']){delete _0x42db69[_0xad52('0x21')];}_0xb526bf[_0xad52('0x15')](_0x31b5e0)[_0xad52('0x22')](_0x42db69);};}exports[_0xad52('0x23')]=function(_0x503bd0,_0x426106){var _0x2a604c={},_0x534cc5={},_0x3f5757={'count':0x0,'rows':[]};var _0x3a0fd6=_[_0xad52('0x24')](db[_0xad52('0x25')][_0xad52('0x26')],function(_0x558f90){return{'name':_0x558f90['fieldName'],'type':_0x558f90['type'][_0xad52('0x27')]};});_0x534cc5[_0xad52('0x28')]=_[_0xad52('0x24')](_0x3a0fd6,'name');_0x534cc5['query']=_[_0xad52('0x29')](_0x503bd0[_0xad52('0x2a')]);_0x534cc5[_0xad52('0x2b')]=_[_0xad52('0x2c')](_0x534cc5[_0xad52('0x28')],_0x534cc5[_0xad52('0x2a')]);_0x2a604c['attributes']=_[_0xad52('0x2c')](_0x534cc5[_0xad52('0x28')],qs[_0xad52('0x2d')](_0x503bd0[_0xad52('0x2a')][_0xad52('0x2d')]));_0x2a604c[_0xad52('0x2e')]=_0x2a604c[_0xad52('0x2e')][_0xad52('0x2f')]?_0x2a604c[_0xad52('0x2e')]:_0x534cc5[_0xad52('0x28')];if(!_0x503bd0[_0xad52('0x2a')]['hasOwnProperty'](_0xad52('0x30'))){_0x2a604c[_0xad52('0x31')]=qs[_0xad52('0x31')](_0x503bd0[_0xad52('0x2a')][_0xad52('0x31')]);_0x2a604c[_0xad52('0x18')]=qs['offset'](_0x503bd0[_0xad52('0x2a')][_0xad52('0x18')]);}_0x2a604c[_0xad52('0x32')]=qs['sort'](_0x503bd0[_0xad52('0x2a')][_0xad52('0x33')]);_0x2a604c[_0xad52('0x34')]=qs['filters'](_[_0xad52('0x35')](_0x503bd0[_0xad52('0x2a')],_0x534cc5[_0xad52('0x2b')]),_0x3a0fd6);if(_0x503bd0['query'][_0xad52('0x36')]){_0x2a604c[_0xad52('0x34')]=_[_0xad52('0x37')](_0x2a604c[_0xad52('0x34')],{'$or':_[_0xad52('0x24')](_0x3a0fd6,function(_0x2dc1f2){if(_0x2dc1f2['type']!==_0xad52('0x38')){var _0x5775b4={};_0x5775b4[_0x2dc1f2[_0xad52('0x21')]]={'$like':'%'+_0x503bd0[_0xad52('0x2a')][_0xad52('0x36')]+'%'};return _0x5775b4;}})});}_0x2a604c=_[_0xad52('0x37')]({},_0x2a604c,_0x503bd0[_0xad52('0x39')]);var _0x4aa1d1={'where':_0x2a604c[_0xad52('0x34')]};return db[_0xad52('0x25')][_0xad52('0x1a')](_0x4aa1d1)['then'](function(_0x23faff){_0x3f5757[_0xad52('0x1a')]=_0x23faff;if(_0x503bd0[_0xad52('0x2a')]['includeAll']){_0x2a604c[_0xad52('0x3a')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xad52('0x3b')](_0x2a604c);})[_0xad52('0x1f')](function(_0x272907){_0x3f5757[_0xad52('0x3c')]=_0x272907;return _0x3f5757;})['then'](respondWithFilteredResult(_0x426106,_0x2a604c))[_0xad52('0x3d')](handleError(_0x426106,null));};exports[_0xad52('0x3e')]=function(_0x249724,_0x2bd94a){var _0x3886ec={'raw':![],'where':{'id':_0x249724[_0xad52('0x3f')]['id']}},_0x44a56b={};_0x44a56b[_0xad52('0x28')]=_['keys'](db[_0xad52('0x25')]['rawAttributes']);_0x44a56b[_0xad52('0x2a')]=_[_0xad52('0x29')](_0x249724[_0xad52('0x2a')]);_0x44a56b[_0xad52('0x2b')]=_[_0xad52('0x2c')](_0x44a56b[_0xad52('0x28')],_0x44a56b[_0xad52('0x2a')]);_0x3886ec[_0xad52('0x2e')]=_[_0xad52('0x2c')](_0x44a56b[_0xad52('0x28')],qs[_0xad52('0x2d')](_0x249724[_0xad52('0x2a')][_0xad52('0x2d')]));_0x3886ec[_0xad52('0x2e')]=_0x3886ec[_0xad52('0x2e')][_0xad52('0x2f')]?_0x3886ec[_0xad52('0x2e')]:_0x44a56b[_0xad52('0x28')];if(_0x249724[_0xad52('0x2a')][_0xad52('0x40')]){_0x3886ec['include']=[{'all':!![]}];}_0x3886ec=_[_0xad52('0x37')]({},_0x3886ec,_0x249724[_0xad52('0x39')]);return db[_0xad52('0x25')]['find'](_0x3886ec)[_0xad52('0x1f')](handleEntityNotFound(_0x2bd94a,null))['then'](respondWithResult(_0x2bd94a,null))[_0xad52('0x3d')](handleError(_0x2bd94a,null));};exports['create']=function(_0x4cf477,_0x35eaac){return db[_0xad52('0x25')][_0xad52('0x41')](_0x4cf477[_0xad52('0x42')],{})['then'](respondWithResult(_0x35eaac,0xc9))['catch'](handleError(_0x35eaac,null));};exports[_0xad52('0x43')]=function(_0x5dede4,_0x207096){if(_0x5dede4['body']['id']){delete _0x5dede4[_0xad52('0x42')]['id'];}return db[_0xad52('0x25')][_0xad52('0x44')]({'where':{'id':_0x5dede4[_0xad52('0x3f')]['id']}})[_0xad52('0x1f')](handleEntityNotFound(_0x207096,null))[_0xad52('0x1f')](saveUpdates(_0x5dede4['body'],null))[_0xad52('0x1f')](respondWithResult(_0x207096,null))[_0xad52('0x3d')](handleError(_0x207096,null));};exports[_0xad52('0x45')]=function(_0xb3a238,_0x4ab950){return db[_0xad52('0x25')][_0xad52('0x44')]({'where':{'id':_0xb3a238[_0xad52('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4ab950,null))[_0xad52('0x1f')](removeEntity(_0x4ab950,null))[_0xad52('0x3d')](handleError(_0x4ab950,null));};exports[_0xad52('0x46')]=function(_0xe9baec,_0x4a35ef,_0x32a6c3){var _0x36d038={};var _0x15533a={};var _0x35d509;var _0x197fac;return db['FreshdeskAccount']['findOne']({'where':{'id':_0xe9baec[_0xad52('0x3f')]['id']}})[_0xad52('0x1f')](handleEntityNotFound(_0x4a35ef,null))[_0xad52('0x1f')](function(_0x93114f){if(_0x93114f){_0x35d509=_0x93114f;_0x15533a[_0xad52('0x28')]=_['keys'](db[_0xad52('0x47')]['rawAttributes']);_0x15533a[_0xad52('0x2a')]=_[_0xad52('0x29')](_0xe9baec[_0xad52('0x2a')]);_0x15533a['filters']=_[_0xad52('0x2c')](_0x15533a['model'],_0x15533a[_0xad52('0x2a')]);_0x36d038[_0xad52('0x2e')]=_[_0xad52('0x2c')](_0x15533a['model'],qs['fields'](_0xe9baec[_0xad52('0x2a')]['fields']));_0x36d038[_0xad52('0x2e')]=_0x36d038[_0xad52('0x2e')]['length']?_0x36d038[_0xad52('0x2e')]:_0x15533a['model'];_0x36d038[_0xad52('0x32')]=qs[_0xad52('0x33')](_0xe9baec[_0xad52('0x2a')][_0xad52('0x33')]);_0x36d038['where']=qs['filters'](_[_0xad52('0x35')](_0xe9baec[_0xad52('0x2a')],_0x15533a['filters']));if(_0xe9baec[_0xad52('0x2a')][_0xad52('0x36')]){_0x36d038[_0xad52('0x34')]=_[_0xad52('0x37')](_0x36d038['where'],{'$or':_[_0xad52('0x24')](_0x36d038[_0xad52('0x2e')],function(_0x40b3e9){var _0x4082d7={};_0x4082d7[_0x40b3e9]={'$like':'%'+_0xe9baec[_0xad52('0x2a')][_0xad52('0x36')]+'%'};return _0x4082d7;})});}_0x36d038=_[_0xad52('0x37')]({},_0x36d038,_0xe9baec[_0xad52('0x39')]);return _0x35d509['getConfigurations'](_0x36d038);}})['then'](function(_0x1778fa){if(_0x1778fa){_0x197fac=_0x1778fa[_0xad52('0x2f')];if(!_0xe9baec[_0xad52('0x2a')]['hasOwnProperty'](_0xad52('0x30'))){_0x36d038[_0xad52('0x31')]=qs[_0xad52('0x31')](_0xe9baec['query'][_0xad52('0x31')]);_0x36d038['offset']=qs[_0xad52('0x18')](_0xe9baec['query']['offset']);}return _0x35d509[_0xad52('0x46')](_0x36d038);}})[_0xad52('0x1f')](function(_0x4fbc36){if(_0x4fbc36){return _0x4fbc36?{'count':_0x197fac,'rows':_0x4fbc36}:null;}})['then'](respondWithResult(_0x4a35ef,null))['catch'](handleError(_0x4a35ef,null));};exports[_0xad52('0x48')]=function(_0x46039d,_0x482f93,_0x42d855){if(_0x46039d[_0xad52('0x42')]['id']){delete _0x46039d[_0xad52('0x42')]['id'];}return db['FreshdeskAccount'][_0xad52('0x49')]({'where':{'id':_0x46039d[_0xad52('0x3f')]['id']}})[_0xad52('0x1f')](handleEntityNotFound(_0x482f93,null))['then'](function(_0x551aa6){if(_0x551aa6){_0x46039d[_0xad52('0x42')][_0xad52('0x4a')]=_0x551aa6['id'];_0x46039d[_0xad52('0x42')][_0xad52('0x4b')]=integrations['getSubjects'](_0x46039d[_0xad52('0x42')]['channel'],_0x46039d[_0xad52('0x42')]['type']);_0x46039d[_0xad52('0x42')][_0xad52('0x4c')]=integrations[_0xad52('0x4d')](_0x46039d[_0xad52('0x42')][_0xad52('0x4e')],_0x46039d[_0xad52('0x42')][_0xad52('0x4f')]);return db[_0xad52('0x47')][_0xad52('0x41')](_0x46039d[_0xad52('0x42')],{'include':[{'model':db[_0xad52('0x50')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0xad52('0x4c')}]});}return null;})['then'](respondWithResult(_0x482f93,null))[_0xad52('0x3d')](handleError(_0x482f93,null));};exports[_0xad52('0x51')]=function(_0x2b4d14,_0x500058,_0x3b865f){var _0x55b17b='';return db['FreshdeskAccount'][_0xad52('0x49')]({'where':{'id':_0x2b4d14[_0xad52('0x3f')]['id']},'attributes':['id',_0xad52('0x52'),_0xad52('0x53')]})[_0xad52('0x1f')](handleEntityNotFound(_0x500058,null))['then'](function(_0x290f9a){if(_0x290f9a){_0x55b17b=_0x290f9a['remoteUri'];var _0x2d160e=_0x55b17b[_0xad52('0x54')](-0x1);if(_0x2d160e==='/'){_0x55b17b=_0x55b17b['substring'](0x0,_0x55b17b[_0xad52('0x55')](_0x2d160e));}return rp({'method':_0xad52('0x56'),'uri':util[_0xad52('0x57')](_0xad52('0x58'),_0x55b17b,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xad52('0x57')](_0xad52('0x59'),new Buffer(util[_0xad52('0x57')](_0xad52('0x5a'),_0x290f9a[_0xad52('0x53')]))[_0xad52('0x5b')](_0xad52('0x5c')))},'json':!![]});}})[_0xad52('0x1f')](function(_0x3bc927){if(_0x3bc927){var _0x31422e=['requester',_0xad52('0x5d'),_0xad52('0x5e'),_0xad52('0x5f'),'status',_0xad52('0x60'),_0xad52('0x61'),_0xad52('0x62'),_0xad52('0x63'),_0xad52('0x61'),_0xad52('0x64')];_[_0xad52('0x65')](_0x3bc927,function(_0x233404){return _0x31422e[_0xad52('0x66')](_0x233404[_0xad52('0x21')])||!_0x233404[_0xad52('0x67')]&&_0x233404[_0xad52('0x4f')]!==_0xad52('0x68')&&_0x233404[_0xad52('0x4f')]!==_0xad52('0x69');});return{'count':_0x3bc927[_0xad52('0x2f')],'rows':_['map'](_0x3bc927,function(_0x13c1e0){return{'id':_0x13c1e0[_0xad52('0x21')],'name':_0x13c1e0[_0xad52('0x6a')],'custom':!_0x13c1e0[_0xad52('0x67')],'options':_0x13c1e0[_0xad52('0x6b')]?_[_0xad52('0x24')](_0x13c1e0[_0xad52('0x6b')],function(_0x236261){return{'name':_[_0xad52('0x6c')](_0x236261),'value':_0x236261};}):[]};})};}})[_0xad52('0x1f')](respondWithResult(_0x500058,null))['catch'](function(_0x461e3a){var _0x14e0de=_0x2b4d14[_0xad52('0x2a')][_0xad52('0x6d')]?0x1f4:_0x461e3a[_0xad52('0x6e')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x14e0de,JSON[_0xad52('0x6f')](_0x461e3a));delete _0x461e3a['name'];if(_0x14e0de===0x191){_0x14e0de=0x190;}_0x500058[_0xad52('0x15')](_0x14e0de)['send'](_0x2b4d14['query'][_0xad52('0x6d')]?{'message':_0xad52('0x70'),'statusCode':_0x461e3a[_0xad52('0x6e')]}:_0x461e3a);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 30ebbc0..608822d 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 _0x8631=['path','rimraf','./intFreshdeskAccount.attributes','exports','define','int_freshdesk_accounts','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x3b16e1,_0x3bda3e){var _0x311d1b=function(_0x2a979b){while(--_0x2a979b){_0x3b16e1['push'](_0x3b16e1['shift']());}};_0x311d1b(++_0x3bda3e);}(_0x8631,0x74));var _0x1863=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x8631[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x1863('0x0'));var util=require(_0x1863('0x1'));var logger=require(_0x1863('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1863('0x3'));var rp=require(_0x1863('0x4'));var fs=require('fs');var path=require(_0x1863('0x5'));var rimraf=require(_0x1863('0x6'));var config=require('../../config/environment');var attributes=require(_0x1863('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x1863('0x8')]=function(_0x10a078,_0x4eaafb){return _0x10a078[_0x1863('0x9')]('FreshdeskAccount',attributes,{'tableName':_0x1863('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe22f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0xe22f,0x11d));var _0xfe22=function(_0x4f22af,_0x5c1513){_0x4f22af=_0x4f22af-0x0;var _0x2da6b2=_0xe22f[_0x4f22af];return _0x2da6b2;};'use strict';var _=require(_0xfe22('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfe22('0x1'));var moment=require(_0xfe22('0x2'));var BPromise=require(_0xfe22('0x3'));var rp=require(_0xfe22('0x4'));var fs=require('fs');var path=require(_0xfe22('0x5'));var rimraf=require(_0xfe22('0x6'));var config=require(_0xfe22('0x7'));var attributes=require(_0xfe22('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xfe22('0x9')]=function(_0x4d621f,_0x2aa9ce){return _0x4d621f[_0xfe22('0xa')](_0xfe22('0xb'),attributes,{'tableName':_0xfe22('0xc'),'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 a91c245..8a2f313 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 _0xf0f1=['catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','limit','include','model','stringify','ShowFreshdeskAccount','where','map','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xf0f1,0x77));var _0x1f0f=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xf0f1[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0x1f0f('0x0'));var util=require(_0x1f0f('0x1'));var moment=require(_0x1f0f('0x2'));var BPromise=require(_0x1f0f('0x3'));var rs=require(_0x1f0f('0x4'));var fs=require('fs');var Redis=require(_0x1f0f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f0f('0x6'));var logger=require('../../config/logger')(_0x1f0f('0x7'));var config=require(_0x1f0f('0x8'));var jayson=require(_0x1f0f('0x9'));var client=jayson[_0x1f0f('0xa')][_0x1f0f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x596649,_0xa3f74b,_0x31ba14){return new BPromise(function(_0x105c44,_0x5ed554){return client['request'](_0x596649,_0x31ba14)[_0x1f0f('0xc')](function(_0x1cba61){logger[_0x1f0f('0xd')](_0x1f0f('0xe'),_0xa3f74b,_0x1f0f('0xf'));logger[_0x1f0f('0x10')](_0x1f0f('0x11'),_0xa3f74b,_0x1f0f('0xf'),JSON['stringify'](_0x1cba61));if(_0x1cba61[_0x1f0f('0x12')]){if(_0x1cba61['error']['code']===0x1f4){logger[_0x1f0f('0x12')](_0x1f0f('0xe'),_0xa3f74b,_0x1cba61[_0x1f0f('0x12')][_0x1f0f('0x13')]);return _0x5ed554(_0x1cba61[_0x1f0f('0x12')][_0x1f0f('0x13')]);}logger['error'](_0x1f0f('0xe'),_0xa3f74b,_0x1cba61[_0x1f0f('0x12')][_0x1f0f('0x13')]);return _0x105c44(_0x1cba61[_0x1f0f('0x12')][_0x1f0f('0x13')]);}else{logger[_0x1f0f('0xd')](_0x1f0f('0xe'),_0xa3f74b,_0x1f0f('0xf'));_0x105c44(_0x1cba61[_0x1f0f('0x14')]['message']);}})[_0x1f0f('0x15')](function(_0x2d71c5){logger['error'](_0x1f0f('0xe'),_0xa3f74b,_0x2d71c5);_0x5ed554(_0x2d71c5);});});}exports[_0x1f0f('0x16')]=function(_0x24aca8){var _0x4b7885=this;return new Promise(function(_0x24a4ec,_0x2db95d){return db[_0x1f0f('0x17')][_0x1f0f('0x18')]({'raw':_0x24aca8[_0x1f0f('0x19')]?_0x24aca8[_0x1f0f('0x19')][_0x1f0f('0x1a')]===undefined?!![]:![]:!![],'where':_0x24aca8[_0x1f0f('0x19')]?_0x24aca8[_0x1f0f('0x19')]['where']||null:null,'attributes':_0x24aca8[_0x1f0f('0x19')]?_0x24aca8['options'][_0x1f0f('0x1b')]||null:null,'limit':_0x24aca8['options']?_0x24aca8[_0x1f0f('0x19')][_0x1f0f('0x1c')]||null:null,'include':_0x24aca8[_0x1f0f('0x19')]?_0x24aca8[_0x1f0f('0x19')][_0x1f0f('0x1d')]?_['map'](_0x24aca8[_0x1f0f('0x19')][_0x1f0f('0x1d')],function(_0x19adaf){return{'model':db[_0x19adaf['model']],'as':_0x19adaf['as'],'attributes':_0x19adaf[_0x1f0f('0x1b')],'include':_0x19adaf[_0x1f0f('0x1d')]?_['map'](_0x19adaf['include'],function(_0xb094d){return{'model':db[_0xb094d[_0x1f0f('0x1e')]],'as':_0xb094d['as'],'attributes':_0xb094d[_0x1f0f('0x1b')],'include':_0xb094d[_0x1f0f('0x1d')]?_['map'](_0xb094d[_0x1f0f('0x1d')],function(_0x2d11e1){return{'model':db[_0x2d11e1[_0x1f0f('0x1e')]],'as':_0x2d11e1['as'],'attributes':_0x2d11e1[_0x1f0f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x390963){logger['info'](_0x1f0f('0x16'),_0x24aca8);logger[_0x1f0f('0x10')]('GetFreshdeskAccount',_0x24aca8,JSON[_0x1f0f('0x1f')](_0x390963));_0x24a4ec(_0x390963);})[_0x1f0f('0x15')](function(_0x14f68d){logger['error'](_0x1f0f('0x16'),_0x14f68d[_0x1f0f('0x13')],_0x24aca8);_0x2db95d(_0x4b7885[_0x1f0f('0x12')](0x1f4,_0x14f68d['message']));});});};exports[_0x1f0f('0x20')]=function(_0xd5e6a3){var _0x2cbf49=this;return new Promise(function(_0x4b9cbc,_0x2cc693){return db[_0x1f0f('0x17')]['find']({'raw':_0xd5e6a3[_0x1f0f('0x19')]?_0xd5e6a3[_0x1f0f('0x19')][_0x1f0f('0x1a')]===undefined?!![]:![]:!![],'where':_0xd5e6a3[_0x1f0f('0x19')]?_0xd5e6a3[_0x1f0f('0x19')][_0x1f0f('0x21')]||null:null,'attributes':_0xd5e6a3[_0x1f0f('0x19')]?_0xd5e6a3['options'][_0x1f0f('0x1b')]||null:null,'include':_0xd5e6a3['options']?_0xd5e6a3[_0x1f0f('0x19')][_0x1f0f('0x1d')]?_['map'](_0xd5e6a3[_0x1f0f('0x19')]['include'],function(_0x25c73b){return{'model':db[_0x25c73b[_0x1f0f('0x1e')]],'as':_0x25c73b['as'],'attributes':_0x25c73b[_0x1f0f('0x1b')],'include':_0x25c73b[_0x1f0f('0x1d')]?_[_0x1f0f('0x22')](_0x25c73b[_0x1f0f('0x1d')],function(_0x478555){return{'model':db[_0x478555[_0x1f0f('0x1e')]],'as':_0x478555['as'],'attributes':_0x478555[_0x1f0f('0x1b')],'include':_0x478555[_0x1f0f('0x1d')]?_[_0x1f0f('0x22')](_0x478555[_0x1f0f('0x1d')],function(_0xb541aa){return{'model':db[_0xb541aa['model']],'as':_0xb541aa['as'],'attributes':_0xb541aa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xeae546){logger[_0x1f0f('0xd')]('ShowFreshdeskAccount',_0xd5e6a3);logger[_0x1f0f('0x10')](_0x1f0f('0x20'),_0xd5e6a3,JSON[_0x1f0f('0x1f')](_0xeae546));_0x4b9cbc(_0xeae546);})[_0x1f0f('0x15')](function(_0x2f2054){logger[_0x1f0f('0x12')](_0x1f0f('0x20'),_0x2f2054['message'],_0xd5e6a3);_0x2cc693(_0x2cbf49[_0x1f0f('0x12')](0x1f4,_0x2f2054[_0x1f0f('0x13')]));});});}; \ No newline at end of file +var _0xf53a=['info','ShowFreshdeskAccount','FreshdeskAccount','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetFreshdeskAccount','raw','options','limit','include','map','model','attributes'];(function(_0xd01588,_0x594d47){var _0x53a90c=function(_0x3159b4){while(--_0x3159b4){_0xd01588['push'](_0xd01588['shift']());}};_0x53a90c(++_0x594d47);}(_0xf53a,0x1d3));var _0xaf53=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xf53a[_0x47fd36];return _0x21a0fc;};'use strict';var _=require(_0xaf53('0x0'));var util=require(_0xaf53('0x1'));var moment=require('moment');var BPromise=require(_0xaf53('0x2'));var rs=require(_0xaf53('0x3'));var fs=require('fs');var Redis=require(_0xaf53('0x4'));var db=require(_0xaf53('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf53('0x6'))('rpc');var config=require(_0xaf53('0x7'));var jayson=require(_0xaf53('0x8'));var client=jayson[_0xaf53('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3e22d,_0x590797,_0x3b1cd6){return new BPromise(function(_0xae5e16,_0x4d8e45){return client[_0xaf53('0xa')](_0xd3e22d,_0x3b1cd6)[_0xaf53('0xb')](function(_0x23497e){logger['info'](_0xaf53('0xc'),_0x590797,_0xaf53('0xd'));logger[_0xaf53('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x590797,_0xaf53('0xd'),JSON[_0xaf53('0xf')](_0x23497e));if(_0x23497e[_0xaf53('0x10')]){if(_0x23497e[_0xaf53('0x10')]['code']===0x1f4){logger['error'](_0xaf53('0xc'),_0x590797,_0x23497e[_0xaf53('0x10')][_0xaf53('0x11')]);return _0x4d8e45(_0x23497e['error'][_0xaf53('0x11')]);}logger[_0xaf53('0x10')](_0xaf53('0xc'),_0x590797,_0x23497e[_0xaf53('0x10')][_0xaf53('0x11')]);return _0xae5e16(_0x23497e['error'][_0xaf53('0x11')]);}else{logger['info'](_0xaf53('0xc'),_0x590797,_0xaf53('0xd'));_0xae5e16(_0x23497e[_0xaf53('0x12')][_0xaf53('0x11')]);}})[_0xaf53('0x13')](function(_0x2557a4){logger[_0xaf53('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x590797,_0x2557a4);_0x4d8e45(_0x2557a4);});});}exports[_0xaf53('0x14')]=function(_0x55219b){var _0x2c5298=this;return new Promise(function(_0x2aca71,_0xdf888a){return db['FreshdeskAccount']['findAll']({'raw':_0x55219b['options']?_0x55219b['options'][_0xaf53('0x15')]===undefined?!![]:![]:!![],'where':_0x55219b[_0xaf53('0x16')]?_0x55219b['options']['where']||null:null,'attributes':_0x55219b['options']?_0x55219b[_0xaf53('0x16')]['attributes']||null:null,'limit':_0x55219b[_0xaf53('0x16')]?_0x55219b[_0xaf53('0x16')][_0xaf53('0x17')]||null:null,'include':_0x55219b[_0xaf53('0x16')]?_0x55219b[_0xaf53('0x16')][_0xaf53('0x18')]?_[_0xaf53('0x19')](_0x55219b['options'][_0xaf53('0x18')],function(_0x2e1ffd){return{'model':db[_0x2e1ffd[_0xaf53('0x1a')]],'as':_0x2e1ffd['as'],'attributes':_0x2e1ffd[_0xaf53('0x1b')],'include':_0x2e1ffd[_0xaf53('0x18')]?_[_0xaf53('0x19')](_0x2e1ffd[_0xaf53('0x18')],function(_0x358868){return{'model':db[_0x358868[_0xaf53('0x1a')]],'as':_0x358868['as'],'attributes':_0x358868[_0xaf53('0x1b')],'include':_0x358868[_0xaf53('0x18')]?_['map'](_0x358868[_0xaf53('0x18')],function(_0x5357d6){return{'model':db[_0x5357d6[_0xaf53('0x1a')]],'as':_0x5357d6['as'],'attributes':_0x5357d6[_0xaf53('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9dd7fe){logger[_0xaf53('0x1c')]('GetFreshdeskAccount',_0x55219b);logger[_0xaf53('0xe')](_0xaf53('0x14'),_0x55219b,JSON['stringify'](_0x9dd7fe));_0x2aca71(_0x9dd7fe);})[_0xaf53('0x13')](function(_0x5bb8ab){logger[_0xaf53('0x10')](_0xaf53('0x14'),_0x5bb8ab[_0xaf53('0x11')],_0x55219b);_0xdf888a(_0x2c5298[_0xaf53('0x10')](0x1f4,_0x5bb8ab['message']));});});};exports[_0xaf53('0x1d')]=function(_0x14879f){var _0x9f405f=this;return new Promise(function(_0x3b24b0,_0x2fc074){return db[_0xaf53('0x1e')][_0xaf53('0x1f')]({'raw':_0x14879f[_0xaf53('0x16')]?_0x14879f['options'][_0xaf53('0x15')]===undefined?!![]:![]:!![],'where':_0x14879f[_0xaf53('0x16')]?_0x14879f[_0xaf53('0x16')][_0xaf53('0x20')]||null:null,'attributes':_0x14879f[_0xaf53('0x16')]?_0x14879f['options'][_0xaf53('0x1b')]||null:null,'include':_0x14879f['options']?_0x14879f[_0xaf53('0x16')][_0xaf53('0x18')]?_[_0xaf53('0x19')](_0x14879f[_0xaf53('0x16')][_0xaf53('0x18')],function(_0x58c695){return{'model':db[_0x58c695[_0xaf53('0x1a')]],'as':_0x58c695['as'],'attributes':_0x58c695[_0xaf53('0x1b')],'include':_0x58c695[_0xaf53('0x18')]?_[_0xaf53('0x19')](_0x58c695[_0xaf53('0x18')],function(_0x80a41a){return{'model':db[_0x80a41a[_0xaf53('0x1a')]],'as':_0x80a41a['as'],'attributes':_0x80a41a[_0xaf53('0x1b')],'include':_0x80a41a[_0xaf53('0x18')]?_[_0xaf53('0x19')](_0x80a41a[_0xaf53('0x18')],function(_0x3d994b){return{'model':db[_0x3d994b[_0xaf53('0x1a')]],'as':_0x3d994b['as'],'attributes':_0x3d994b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xe48027){logger[_0xaf53('0x1c')](_0xaf53('0x1d'),_0x14879f);logger['debug'](_0xaf53('0x1d'),_0x14879f,JSON['stringify'](_0xe48027));_0x3b24b0(_0xe48027);})[_0xaf53('0x13')](function(_0x527a8e){logger[_0xaf53('0x10')](_0xaf53('0x1d'),_0x527a8e[_0xaf53('0x11')],_0x14879f);_0x2fc074(_0x9f405f[_0xaf53('0x10')](0x1f4,_0x527a8e[_0xaf53('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 389a480..603fdbf 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 _0x30ad=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','setTags','put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x4fa738,_0x2a491c){var _0x55bf55=function(_0x185d53){while(--_0x185d53){_0x4fa738['push'](_0x4fa738['shift']());}};_0x55bf55(++_0x2a491c);}(_0x30ad,0x136));var _0xd30a=function(_0x10539c,_0x599648){_0x10539c=_0x10539c-0x0;var _0x1b19af=_0x30ad[_0x10539c];return _0x1b19af;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd30a('0x0'));var timeout=require(_0xd30a('0x1'));var express=require(_0xd30a('0x2'));var router=express['Router']();var fs_extra=require(_0xd30a('0x3'));var auth=require(_0xd30a('0x4'));var interaction=require(_0xd30a('0x5'));var config=require(_0xd30a('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xd30a('0x7')]('/',auth[_0xd30a('0x8')](),controller[_0xd30a('0x9')]);router[_0xd30a('0x7')](_0xd30a('0xa'),auth[_0xd30a('0x8')](),controller[_0xd30a('0xb')]);router[_0xd30a('0x7')](_0xd30a('0xc'),auth[_0xd30a('0x8')](),controller[_0xd30a('0xd')]);router['get'](_0xd30a('0xe'),auth['isAuthenticated'](),controller[_0xd30a('0xf')]);router[_0xd30a('0x7')](_0xd30a('0x10'),auth[_0xd30a('0x8')](),controller[_0xd30a('0x11')]);router[_0xd30a('0x7')](_0xd30a('0x12'),auth[_0xd30a('0x8')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0xd30a('0x13')]);router[_0xd30a('0x14')](_0xd30a('0x12'),auth[_0xd30a('0x8')](),controller[_0xd30a('0x15')]);router[_0xd30a('0x16')]('/:id',auth[_0xd30a('0x8')](),controller[_0xd30a('0x17')]);router[_0xd30a('0x18')](_0xd30a('0xa'),auth[_0xd30a('0x8')](),controller[_0xd30a('0x19')]);module[_0xd30a('0x1a')]=router; \ No newline at end of file +var _0x2d41=['/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','/:id/fields','getFields','getSubjects'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x2d41,0x1ac));var _0x12d4=function(_0x4e18ae,_0x3b30e6){_0x4e18ae=_0x4e18ae-0x0;var _0x50a076=_0x2d41[_0x4e18ae];return _0x50a076;};'use strict';var multer=require(_0x12d4('0x0'));var util=require(_0x12d4('0x1'));var path=require(_0x12d4('0x2'));var timeout=require(_0x12d4('0x3'));var express=require(_0x12d4('0x4'));var router=express[_0x12d4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x12d4('0x6'));var interaction=require(_0x12d4('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x12d4('0x8')]('/',auth[_0x12d4('0x9')](),controller['index']);router['get'](_0x12d4('0xa'),auth[_0x12d4('0x9')](),controller['show']);router[_0x12d4('0x8')](_0x12d4('0xb'),auth[_0x12d4('0x9')](),controller[_0x12d4('0xc')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x12d4('0xd')]);router[_0x12d4('0x8')](_0x12d4('0xe'),auth[_0x12d4('0x9')](),controller[_0x12d4('0xf')]);router[_0x12d4('0x8')](_0x12d4('0x10'),auth[_0x12d4('0x9')](),controller[_0x12d4('0x11')]);router[_0x12d4('0x12')]('/',auth['isAuthenticated'](),controller[_0x12d4('0x13')]);router['post'](_0x12d4('0x10'),auth[_0x12d4('0x9')](),controller[_0x12d4('0x14')]);router[_0x12d4('0x15')]('/:id',auth[_0x12d4('0x9')](),controller[_0x12d4('0x16')]);router[_0x12d4('0x17')]('/:id',auth[_0x12d4('0x9')](),controller[_0x12d4('0x18')]);module[_0x12d4('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 713c95b..d105f5d 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 _0xc6b0=['STRING','sequelize','exports'];(function(_0x56b891,_0x1c87cd){var _0x4b5e31=function(_0x5c95f8){while(--_0x5c95f8){_0x56b891['push'](_0x56b891['shift']());}};_0x4b5e31(++_0x1c87cd);}(_0xc6b0,0x73));var _0x0c6b=function(_0x548aae,_0x16ef87){_0x548aae=_0x548aae-0x0;var _0x2b2836=_0xc6b0[_0x548aae];return _0x2b2836;};'use strict';var Sequelize=require(_0x0c6b('0x0'));module[_0x0c6b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0c6b('0x2')]}}; \ No newline at end of file +var _0xaba2=['STRING','sequelize','exports'];(function(_0x259cef,_0x1f8832){var _0x2c8ac8=function(_0x52c471){while(--_0x52c471){_0x259cef['push'](_0x259cef['shift']());}};_0x2c8ac8(++_0x1f8832);}(_0xaba2,0x64));var _0x2aba=function(_0x32bebb,_0x558707){_0x32bebb=_0x32bebb-0x0;var _0x3a324c=_0xaba2[_0x32bebb];return _0x3a324c;};'use strict';var Sequelize=require(_0x2aba('0x0'));module[_0x2aba('0x1')]={'name':{'type':Sequelize[_0x2aba('0x2')]},'description':{'type':Sequelize[_0x2aba('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 0bfc4a4..079bec1 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 _0x08f1=['request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','FreshdeskConfiguration','create','body','find','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x385eb1,_0x497a94){var _0x5d40eb=function(_0x159029){while(--_0x159029){_0x385eb1['push'](_0x385eb1['shift']());}};_0x5d40eb(++_0x497a94);}(_0x08f1,0x1f4));var _0x108f=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x08f1[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x108f('0x0'));var rimraf=require(_0x108f('0x1'));var zipdir=require(_0x108f('0x2'));var jsonpatch=require(_0x108f('0x3'));var rp=require(_0x108f('0x4'));var moment=require(_0x108f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x108f('0x6'));var util=require(_0x108f('0x7'));var path=require(_0x108f('0x8'));var sox=require(_0x108f('0x9'));var csv=require(_0x108f('0xa'));var ejs=require(_0x108f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x108f('0xc'));var crypto=require(_0x108f('0xd'));var jsforce=require(_0x108f('0xe'));var deskjs=require(_0x108f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x108f('0x10'));var Papa=require(_0x108f('0x11'));var Redis=require('ioredis');var authService=require(_0x108f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x108f('0x13'));var hardwareService=require(_0x108f('0x14'));var logger=require(_0x108f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x108f('0x16'));var licenseUtil=require(_0x108f('0x17'));var db=require(_0x108f('0x18'))['db'];function respondWithStatusCode(_0x4e6517,_0x199306){_0x199306=_0x199306||0xcc;return function(_0x5a2361){if(_0x5a2361){return _0x4e6517[_0x108f('0x19')](_0x199306);}return _0x4e6517['status'](_0x199306)['end']();};}function respondWithResult(_0x44dd86,_0x37c828){_0x37c828=_0x37c828||0xc8;return function(_0x1403c4){if(_0x1403c4){return _0x44dd86[_0x108f('0x1a')](_0x37c828)[_0x108f('0x1b')](_0x1403c4);}};}function respondWithFilteredResult(_0x4dda98,_0x5384cf){return function(_0x43d62d){if(_0x43d62d){var _0x34072a=typeof _0x5384cf[_0x108f('0x1c')]==='undefined'&&typeof _0x5384cf[_0x108f('0x1d')]===_0x108f('0x1e');var _0x727af7=_0x43d62d['count'];var _0x1cc2b6=_0x34072a?0x0:_0x5384cf[_0x108f('0x1c')];var _0x2ee523=_0x34072a?_0x43d62d[_0x108f('0x1f')]:_0x5384cf[_0x108f('0x1c')]+_0x5384cf[_0x108f('0x1d')];var _0x52e9ae;if(_0x2ee523>=_0x727af7){_0x2ee523=_0x727af7;_0x52e9ae=0xc8;}else{_0x52e9ae=0xce;}_0x4dda98[_0x108f('0x1a')](_0x52e9ae);return _0x4dda98[_0x108f('0x20')](_0x108f('0x21'),_0x1cc2b6+'-'+_0x2ee523+'/'+_0x727af7)[_0x108f('0x1b')](_0x43d62d);}return null;};}function patchUpdates(_0x4ca514){return function(_0x1cd958){try{jsonpatch[_0x108f('0x22')](_0x1cd958,_0x4ca514,!![]);}catch(_0x39fd68){return BPromise[_0x108f('0x23')](_0x39fd68);}return _0x1cd958[_0x108f('0x24')]();};}function saveUpdates(_0x31ba6a,_0x1d13cd){return function(_0x3b5c54){if(_0x3b5c54){return _0x3b5c54[_0x108f('0x25')](_0x31ba6a)[_0x108f('0x26')](function(_0x479567){return _0x479567;});}return null;};}function removeEntity(_0x5c9f57,_0x291ae7){return function(_0x197553){if(_0x197553){return _0x197553[_0x108f('0x27')]()['then'](function(){_0x5c9f57['status'](0xcc)[_0x108f('0x28')]();});}};}function handleEntityNotFound(_0x379090,_0x2c03aa){return function(_0x3d3308){if(!_0x3d3308){_0x379090[_0x108f('0x19')](0x194);}return _0x3d3308;};}function handleError(_0x5dc948,_0x39db45){_0x39db45=_0x39db45||0x1f4;return function(_0x41e8b4){logger[_0x108f('0x29')](_0x41e8b4['stack']);if(_0x41e8b4['name']){delete _0x41e8b4[_0x108f('0x2a')];}_0x5dc948[_0x108f('0x1a')](_0x39db45)['send'](_0x41e8b4);};}exports[_0x108f('0x2b')]=function(_0x688ab8,_0x3b25ac){var _0x4f870c={},_0x5733e2={},_0xa9dede={'count':0x0,'rows':[]};var _0x4959ce=_[_0x108f('0x2c')](db['FreshdeskConfiguration'][_0x108f('0x2d')],function(_0x5b1fa4){return{'name':_0x5b1fa4[_0x108f('0x2e')],'type':_0x5b1fa4[_0x108f('0x2f')][_0x108f('0x30')]};});_0x5733e2[_0x108f('0x31')]=_['map'](_0x4959ce,_0x108f('0x2a'));_0x5733e2[_0x108f('0x32')]=_[_0x108f('0x33')](_0x688ab8[_0x108f('0x32')]);_0x5733e2['filters']=_[_0x108f('0x34')](_0x5733e2[_0x108f('0x31')],_0x5733e2[_0x108f('0x32')]);_0x4f870c[_0x108f('0x35')]=_[_0x108f('0x34')](_0x5733e2[_0x108f('0x31')],qs[_0x108f('0x36')](_0x688ab8['query'][_0x108f('0x36')]));_0x4f870c['attributes']=_0x4f870c[_0x108f('0x35')][_0x108f('0x37')]?_0x4f870c[_0x108f('0x35')]:_0x5733e2[_0x108f('0x31')];if(!_0x688ab8[_0x108f('0x32')][_0x108f('0x38')](_0x108f('0x39'))){_0x4f870c[_0x108f('0x1d')]=qs[_0x108f('0x1d')](_0x688ab8[_0x108f('0x32')]['limit']);_0x4f870c[_0x108f('0x1c')]=qs[_0x108f('0x1c')](_0x688ab8[_0x108f('0x32')]['offset']);}_0x4f870c[_0x108f('0x3a')]=qs[_0x108f('0x3b')](_0x688ab8[_0x108f('0x32')][_0x108f('0x3b')]);_0x4f870c[_0x108f('0x3c')]=qs[_0x108f('0x3d')](_[_0x108f('0x3e')](_0x688ab8[_0x108f('0x32')],_0x5733e2[_0x108f('0x3d')]),_0x4959ce);if(_0x688ab8['query'][_0x108f('0x3f')]){_0x4f870c['where']=_[_0x108f('0x40')](_0x4f870c[_0x108f('0x3c')],{'$or':_[_0x108f('0x2c')](_0x4959ce,function(_0x534e0f){if(_0x534e0f[_0x108f('0x2f')]!=='VIRTUAL'){var _0x361a29={};_0x361a29[_0x534e0f[_0x108f('0x2a')]]={'$like':'%'+_0x688ab8[_0x108f('0x32')][_0x108f('0x3f')]+'%'};return _0x361a29;}})});}_0x4f870c=_[_0x108f('0x40')]({},_0x4f870c,_0x688ab8[_0x108f('0x41')]);var _0x37781c={'where':_0x4f870c[_0x108f('0x3c')]};return db['FreshdeskConfiguration'][_0x108f('0x1f')](_0x37781c)[_0x108f('0x26')](function(_0x5a5889){_0xa9dede[_0x108f('0x1f')]=_0x5a5889;if(_0x688ab8['query']['includeAll']){_0x4f870c[_0x108f('0x42')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x108f('0x43')](_0x4f870c);})[_0x108f('0x26')](function(_0x1032ad){_0xa9dede[_0x108f('0x44')]=_0x1032ad;return _0xa9dede;})[_0x108f('0x26')](respondWithFilteredResult(_0x3b25ac,_0x4f870c))[_0x108f('0x45')](handleError(_0x3b25ac,null));};exports[_0x108f('0x46')]=function(_0x2e99b7,_0x212140){var _0x428294={'raw':![],'where':{'id':_0x2e99b7[_0x108f('0x47')]['id']}},_0xb005ca={};_0xb005ca[_0x108f('0x31')]=_[_0x108f('0x33')](db[_0x108f('0x48')][_0x108f('0x2d')]);_0xb005ca[_0x108f('0x32')]=_['keys'](_0x2e99b7[_0x108f('0x32')]);_0xb005ca['filters']=_[_0x108f('0x34')](_0xb005ca[_0x108f('0x31')],_0xb005ca[_0x108f('0x32')]);_0x428294[_0x108f('0x35')]=_[_0x108f('0x34')](_0xb005ca['model'],qs['fields'](_0x2e99b7[_0x108f('0x32')][_0x108f('0x36')]));_0x428294[_0x108f('0x35')]=_0x428294[_0x108f('0x35')][_0x108f('0x37')]?_0x428294[_0x108f('0x35')]:_0xb005ca['model'];if(_0x2e99b7[_0x108f('0x32')]['includeAll']){_0x428294[_0x108f('0x42')]=[{'all':!![]}];}_0x428294=_[_0x108f('0x40')]({},_0x428294,_0x2e99b7[_0x108f('0x41')]);return db['FreshdeskConfiguration']['find'](_0x428294)[_0x108f('0x26')](handleEntityNotFound(_0x212140,null))[_0x108f('0x26')](respondWithResult(_0x212140,null))[_0x108f('0x45')](handleError(_0x212140,null));};exports[_0x108f('0x49')]=function(_0x31bc69,_0x3a40b5){return db[_0x108f('0x48')][_0x108f('0x49')](_0x31bc69[_0x108f('0x4a')],{})['then'](respondWithResult(_0x3a40b5,0xc9))[_0x108f('0x45')](handleError(_0x3a40b5,null));};exports['update']=function(_0x3675d1,_0x59c95d){if(_0x3675d1[_0x108f('0x4a')]['id']){delete _0x3675d1['body']['id'];}return db['FreshdeskConfiguration'][_0x108f('0x4b')]({'where':{'id':_0x3675d1[_0x108f('0x47')]['id']}})[_0x108f('0x26')](handleEntityNotFound(_0x59c95d,null))[_0x108f('0x26')](saveUpdates(_0x3675d1[_0x108f('0x4a')],null))[_0x108f('0x26')](respondWithResult(_0x59c95d,null))[_0x108f('0x45')](handleError(_0x59c95d,null));};exports[_0x108f('0x27')]=function(_0x45f7eb,_0x40d377){return db[_0x108f('0x48')][_0x108f('0x4b')]({'where':{'id':_0x45f7eb['params']['id']}})[_0x108f('0x26')](handleEntityNotFound(_0x40d377,null))[_0x108f('0x26')](removeEntity(_0x40d377,null))[_0x108f('0x45')](handleError(_0x40d377,null));};exports[_0x108f('0x4c')]=function(_0x27901b,_0x5e2e1f,_0x5ef82b){var _0x5e5b40={};var _0x310cb1={};var _0x13f9ee;var _0x286d8e;return db[_0x108f('0x48')][_0x108f('0x4d')]({'where':{'id':_0x27901b['params']['id']}})[_0x108f('0x26')](handleEntityNotFound(_0x5e2e1f,null))[_0x108f('0x26')](function(_0x4cf5e2){if(_0x4cf5e2){_0x13f9ee=_0x4cf5e2;_0x310cb1['model']=_[_0x108f('0x33')](db[_0x108f('0x4e')][_0x108f('0x2d')]);_0x310cb1['query']=_['keys'](_0x27901b[_0x108f('0x32')]);_0x310cb1[_0x108f('0x3d')]=_[_0x108f('0x34')](_0x310cb1[_0x108f('0x31')],_0x310cb1[_0x108f('0x32')]);_0x5e5b40[_0x108f('0x35')]=_['intersection'](_0x310cb1[_0x108f('0x31')],qs[_0x108f('0x36')](_0x27901b[_0x108f('0x32')][_0x108f('0x36')]));_0x5e5b40[_0x108f('0x35')]=_0x5e5b40['attributes'][_0x108f('0x37')]?_0x5e5b40[_0x108f('0x35')]:_0x310cb1[_0x108f('0x31')];_0x5e5b40['order']=qs[_0x108f('0x3b')](_0x27901b[_0x108f('0x32')][_0x108f('0x3b')]);_0x5e5b40[_0x108f('0x3c')]=qs['filters'](_[_0x108f('0x3e')](_0x27901b[_0x108f('0x32')],_0x310cb1[_0x108f('0x3d')]));if(_0x27901b['query'][_0x108f('0x3f')]){_0x5e5b40[_0x108f('0x3c')]=_[_0x108f('0x40')](_0x5e5b40[_0x108f('0x3c')],{'$or':_[_0x108f('0x2c')](_0x5e5b40[_0x108f('0x35')],function(_0x40f7b2){var _0x295c97={};_0x295c97[_0x40f7b2]={'$like':'%'+_0x27901b[_0x108f('0x32')]['filter']+'%'};return _0x295c97;})});}_0x5e5b40=_[_0x108f('0x40')]({},_0x5e5b40,_0x27901b[_0x108f('0x41')]);return _0x13f9ee['getFields'](_0x5e5b40);}})['then'](function(_0x338584){if(_0x338584){_0x286d8e=_0x338584['length'];if(!_0x27901b[_0x108f('0x32')][_0x108f('0x38')](_0x108f('0x39'))){_0x5e5b40[_0x108f('0x1d')]=qs[_0x108f('0x1d')](_0x27901b[_0x108f('0x32')][_0x108f('0x1d')]);_0x5e5b40[_0x108f('0x1c')]=qs['offset'](_0x27901b[_0x108f('0x32')]['offset']);}return _0x13f9ee[_0x108f('0x4c')](_0x5e5b40);}})[_0x108f('0x26')](function(_0x47c758){if(_0x47c758){return _0x47c758?{'count':_0x286d8e,'rows':_0x47c758}:null;}})[_0x108f('0x26')](respondWithResult(_0x5e2e1f,null))[_0x108f('0x45')](handleError(_0x5e2e1f,null));};exports[_0x108f('0x4f')]=function(_0x2492d1,_0x79f999,_0x540dd0){var _0x1b00b0={};var _0x4126f2={};var _0x118670;var _0x90f48f;return db[_0x108f('0x48')][_0x108f('0x4d')]({'where':{'id':_0x2492d1[_0x108f('0x47')]['id']}})[_0x108f('0x26')](handleEntityNotFound(_0x79f999,null))[_0x108f('0x26')](function(_0x2b13d7){if(_0x2b13d7){_0x118670=_0x2b13d7;_0x4126f2['model']=_[_0x108f('0x33')](db[_0x108f('0x4e')][_0x108f('0x2d')]);_0x4126f2[_0x108f('0x32')]=_[_0x108f('0x33')](_0x2492d1['query']);_0x4126f2[_0x108f('0x3d')]=_['intersection'](_0x4126f2[_0x108f('0x31')],_0x4126f2[_0x108f('0x32')]);_0x1b00b0['attributes']=_['intersection'](_0x4126f2[_0x108f('0x31')],qs[_0x108f('0x36')](_0x2492d1['query'][_0x108f('0x36')]));_0x1b00b0['attributes']=_0x1b00b0[_0x108f('0x35')][_0x108f('0x37')]?_0x1b00b0[_0x108f('0x35')]:_0x4126f2['model'];_0x1b00b0['order']=qs['sort'](_0x2492d1['query']['sort']);_0x1b00b0[_0x108f('0x3c')]=qs['filters'](_['pick'](_0x2492d1[_0x108f('0x32')],_0x4126f2['filters']));if(_0x2492d1['query']['filter']){_0x1b00b0['where']=_[_0x108f('0x40')](_0x1b00b0[_0x108f('0x3c')],{'$or':_['map'](_0x1b00b0['attributes'],function(_0x426b0b){var _0x5333a9={};_0x5333a9[_0x426b0b]={'$like':'%'+_0x2492d1[_0x108f('0x32')]['filter']+'%'};return _0x5333a9;})});}_0x1b00b0=_[_0x108f('0x40')]({},_0x1b00b0,_0x2492d1[_0x108f('0x41')]);return _0x118670[_0x108f('0x4f')](_0x1b00b0);}})['then'](function(_0x3a7ecc){if(_0x3a7ecc){_0x90f48f=_0x3a7ecc['length'];if(!_0x2492d1[_0x108f('0x32')][_0x108f('0x38')](_0x108f('0x39'))){_0x1b00b0['limit']=qs['limit'](_0x2492d1[_0x108f('0x32')][_0x108f('0x1d')]);_0x1b00b0[_0x108f('0x1c')]=qs[_0x108f('0x1c')](_0x2492d1[_0x108f('0x32')][_0x108f('0x1c')]);}return _0x118670['getSubjects'](_0x1b00b0);}})[_0x108f('0x26')](function(_0x411bff){if(_0x411bff){return _0x411bff?{'count':_0x90f48f,'rows':_0x411bff}:null;}})[_0x108f('0x26')](respondWithResult(_0x79f999,null))[_0x108f('0x45')](handleError(_0x79f999,null));};exports[_0x108f('0x50')]=function(_0x5a96ea,_0x5305d7,_0x35eac6){var _0x1103f4={};var _0x144488={};var _0x3d43ba;var _0x33c5db;return db[_0x108f('0x48')]['findOne']({'where':{'id':_0x5a96ea[_0x108f('0x47')]['id']}})[_0x108f('0x26')](handleEntityNotFound(_0x5305d7,null))[_0x108f('0x26')](function(_0x344be9){if(_0x344be9){_0x3d43ba=_0x344be9;_0x144488[_0x108f('0x31')]=_[_0x108f('0x33')](db['FreshdeskField']['rawAttributes']);_0x144488['query']=_['keys'](_0x5a96ea[_0x108f('0x32')]);_0x144488[_0x108f('0x3d')]=_['intersection'](_0x144488[_0x108f('0x31')],_0x144488[_0x108f('0x32')]);_0x1103f4[_0x108f('0x35')]=_[_0x108f('0x34')](_0x144488['model'],qs[_0x108f('0x36')](_0x5a96ea[_0x108f('0x32')][_0x108f('0x36')]));_0x1103f4['attributes']=_0x1103f4['attributes'][_0x108f('0x37')]?_0x1103f4['attributes']:_0x144488[_0x108f('0x31')];_0x1103f4['order']=qs[_0x108f('0x3b')](_0x5a96ea['query']['sort']);_0x1103f4['where']=qs[_0x108f('0x3d')](_[_0x108f('0x3e')](_0x5a96ea[_0x108f('0x32')],_0x144488[_0x108f('0x3d')]));if(_0x5a96ea['query'][_0x108f('0x3f')]){_0x1103f4[_0x108f('0x3c')]=_[_0x108f('0x40')](_0x1103f4[_0x108f('0x3c')],{'$or':_[_0x108f('0x2c')](_0x1103f4[_0x108f('0x35')],function(_0x53bf3a){var _0x5738f2={};_0x5738f2[_0x53bf3a]={'$like':'%'+_0x5a96ea['query'][_0x108f('0x3f')]+'%'};return _0x5738f2;})});}_0x1103f4=_['merge']({},_0x1103f4,_0x5a96ea[_0x108f('0x41')]);return _0x3d43ba[_0x108f('0x50')](_0x1103f4);}})[_0x108f('0x26')](function(_0x34c5b1){if(_0x34c5b1){_0x33c5db=_0x34c5b1[_0x108f('0x37')];if(!_0x5a96ea['query'][_0x108f('0x38')]('nolimit')){_0x1103f4[_0x108f('0x1d')]=qs['limit'](_0x5a96ea['query'][_0x108f('0x1d')]);_0x1103f4[_0x108f('0x1c')]=qs['offset'](_0x5a96ea[_0x108f('0x32')][_0x108f('0x1c')]);}return _0x3d43ba[_0x108f('0x50')](_0x1103f4);}})['then'](function(_0x37870d){if(_0x37870d){return _0x37870d?{'count':_0x33c5db,'rows':_0x37870d}:null;}})[_0x108f('0x26')](respondWithResult(_0x5305d7,null))[_0x108f('0x45')](handleError(_0x5305d7,null));};exports['getTags']=function(_0x5b1daa,_0x4b503c,_0x2db66d){var _0x42f946={};var _0x5a062b={};var _0x43414b;var _0xb4a464;return db[_0x108f('0x48')][_0x108f('0x4d')]({'where':{'id':_0x5b1daa[_0x108f('0x47')]['id']}})[_0x108f('0x26')](handleEntityNotFound(_0x4b503c,null))[_0x108f('0x26')](function(_0x2d2faa){if(_0x2d2faa){_0x43414b=_0x2d2faa;_0x5a062b[_0x108f('0x31')]=_[_0x108f('0x33')](db[_0x108f('0x51')][_0x108f('0x2d')]);_0x5a062b[_0x108f('0x32')]=_[_0x108f('0x33')](_0x5b1daa[_0x108f('0x32')]);_0x5a062b[_0x108f('0x3d')]=_[_0x108f('0x34')](_0x5a062b[_0x108f('0x31')],_0x5a062b[_0x108f('0x32')]);_0x42f946[_0x108f('0x35')]=_[_0x108f('0x34')](_0x5a062b['model'],qs[_0x108f('0x36')](_0x5b1daa[_0x108f('0x32')][_0x108f('0x36')]));_0x42f946[_0x108f('0x35')]=_0x42f946[_0x108f('0x35')][_0x108f('0x37')]?_0x42f946['attributes']:_0x5a062b[_0x108f('0x31')];_0x42f946[_0x108f('0x3a')]=qs[_0x108f('0x3b')](_0x5b1daa['query'][_0x108f('0x3b')]);_0x42f946[_0x108f('0x3c')]=qs['filters'](_['pick'](_0x5b1daa['query'],_0x5a062b[_0x108f('0x3d')]));if(_0x5b1daa[_0x108f('0x32')][_0x108f('0x3f')]){_0x42f946[_0x108f('0x3c')]=_[_0x108f('0x40')](_0x42f946[_0x108f('0x3c')],{'$or':_[_0x108f('0x2c')](_0x42f946[_0x108f('0x35')],function(_0x2b4ef0){var _0x502ed1={};_0x502ed1[_0x2b4ef0]={'$like':'%'+_0x5b1daa[_0x108f('0x32')][_0x108f('0x3f')]+'%'};return _0x502ed1;})});}_0x42f946=_[_0x108f('0x40')]({},_0x42f946,_0x5b1daa['options']);return _0x43414b[_0x108f('0x52')](_0x42f946);}})[_0x108f('0x26')](function(_0x441851){if(_0x441851){_0xb4a464=_0x441851[_0x108f('0x37')];if(!_0x5b1daa['query'][_0x108f('0x38')](_0x108f('0x39'))){_0x42f946[_0x108f('0x1d')]=qs[_0x108f('0x1d')](_0x5b1daa[_0x108f('0x32')][_0x108f('0x1d')]);_0x42f946[_0x108f('0x1c')]=qs['offset'](_0x5b1daa[_0x108f('0x32')]['offset']);}return _0x43414b['getTags'](_0x42f946);}})[_0x108f('0x26')](function(_0x563e12){if(_0x563e12){return _0x563e12?{'count':_0xb4a464,'rows':_0x563e12}:null;}})[_0x108f('0x26')](respondWithResult(_0x4b503c,null))['catch'](handleError(_0x4b503c,null));};exports[_0x108f('0x53')]=function(_0x12ec81,_0x1600dd,_0x597584){if(_0x12ec81[_0x108f('0x4a')]['id']){delete _0x12ec81[_0x108f('0x4a')]['id'];}return db[_0x108f('0x48')][_0x108f('0x4d')]({'where':{'id':_0x12ec81[_0x108f('0x47')]['id']}})[_0x108f('0x26')](handleEntityNotFound(_0x1600dd,null))[_0x108f('0x26')](function(_0x32d437){if(_0x32d437){return _0x32d437[_0x108f('0x53')](_0x12ec81[_0x108f('0x4a')]['ids']||[]);}return null;})[_0x108f('0x26')](respondWithResult(_0x1600dd,null))[_0x108f('0x45')](handleError(_0x1600dd,null));}; \ No newline at end of file +var _0xaf8a=['ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','filter','options','includeAll','catch','show','merge','find','body','params','getFields','findOne','FreshdeskField','pick','length','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags'];(function(_0x5159d6,_0x16442a){var _0x1c07f0=function(_0x2ba211){while(--_0x2ba211){_0x5159d6['push'](_0x5159d6['shift']());}};_0x1c07f0(++_0x16442a);}(_0xaf8a,0x141));var _0xaaf8=function(_0x1ea7a4,_0x2cddfb){_0x1ea7a4=_0x1ea7a4-0x0;var _0x1b4552=_0xaf8a[_0x1ea7a4];return _0x1b4552;};'use strict';var emlformat=require(_0xaaf8('0x0'));var rimraf=require(_0xaaf8('0x1'));var zipdir=require(_0xaaf8('0x2'));var jsonpatch=require(_0xaaf8('0x3'));var rp=require(_0xaaf8('0x4'));var moment=require(_0xaaf8('0x5'));var BPromise=require(_0xaaf8('0x6'));var Mustache=require(_0xaaf8('0x7'));var util=require(_0xaaf8('0x8'));var path=require('path');var sox=require(_0xaaf8('0x9'));var csv=require(_0xaaf8('0xa'));var ejs=require(_0xaaf8('0xb'));var fs=require('fs');var fs_extra=require(_0xaaf8('0xc'));var _=require(_0xaaf8('0xd'));var squel=require(_0xaaf8('0xe'));var crypto=require(_0xaaf8('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaaf8('0xa'));var querystring=require(_0xaaf8('0x10'));var Papa=require(_0xaaf8('0x11'));var Redis=require(_0xaaf8('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaaf8('0x13'));var logger=require('../../config/logger')(_0xaaf8('0x14'));var utils=require(_0xaaf8('0x15'));var config=require(_0xaaf8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xaaf8('0x17'))['db'];function respondWithStatusCode(_0xdf9e52,_0x30a16f){_0x30a16f=_0x30a16f||0xcc;return function(_0x2d32bb){if(_0x2d32bb){return _0xdf9e52[_0xaaf8('0x18')](_0x30a16f);}return _0xdf9e52[_0xaaf8('0x19')](_0x30a16f)[_0xaaf8('0x1a')]();};}function respondWithResult(_0x1e64fb,_0x32fc4a){_0x32fc4a=_0x32fc4a||0xc8;return function(_0x19c8c4){if(_0x19c8c4){return _0x1e64fb[_0xaaf8('0x19')](_0x32fc4a)[_0xaaf8('0x1b')](_0x19c8c4);}};}function respondWithFilteredResult(_0x311ec2,_0x136de9){return function(_0x5d7118){if(_0x5d7118){var _0x111090=typeof _0x136de9['offset']===_0xaaf8('0x1c')&&typeof _0x136de9[_0xaaf8('0x1d')]==='undefined';var _0xb7d2cb=_0x5d7118['count'];var _0x367902=_0x111090?0x0:_0x136de9['offset'];var _0xc9c628=_0x111090?_0x5d7118[_0xaaf8('0x1e')]:_0x136de9[_0xaaf8('0x1f')]+_0x136de9[_0xaaf8('0x1d')];var _0x2e2a01;if(_0xc9c628>=_0xb7d2cb){_0xc9c628=_0xb7d2cb;_0x2e2a01=0xc8;}else{_0x2e2a01=0xce;}_0x311ec2[_0xaaf8('0x19')](_0x2e2a01);return _0x311ec2[_0xaaf8('0x20')](_0xaaf8('0x21'),_0x367902+'-'+_0xc9c628+'/'+_0xb7d2cb)[_0xaaf8('0x1b')](_0x5d7118);}return null;};}function patchUpdates(_0x2e1d31){return function(_0x48372d){try{jsonpatch[_0xaaf8('0x22')](_0x48372d,_0x2e1d31,!![]);}catch(_0x51269d){return BPromise[_0xaaf8('0x23')](_0x51269d);}return _0x48372d[_0xaaf8('0x24')]();};}function saveUpdates(_0x4169ea,_0x49e5b6){return function(_0x16da8c){if(_0x16da8c){return _0x16da8c[_0xaaf8('0x25')](_0x4169ea)[_0xaaf8('0x26')](function(_0x36d162){return _0x36d162;});}return null;};}function removeEntity(_0x34f0c6,_0x102b79){return function(_0x297675){if(_0x297675){return _0x297675[_0xaaf8('0x27')]()['then'](function(){_0x34f0c6['status'](0xcc)[_0xaaf8('0x1a')]();});}};}function handleEntityNotFound(_0x140b27,_0xde46a6){return function(_0x468b31){if(!_0x468b31){_0x140b27[_0xaaf8('0x18')](0x194);}return _0x468b31;};}function handleError(_0x14dee4,_0x5c9c7e){_0x5c9c7e=_0x5c9c7e||0x1f4;return function(_0x3ac80f){logger['error'](_0x3ac80f['stack']);if(_0x3ac80f[_0xaaf8('0x28')]){delete _0x3ac80f['name'];}_0x14dee4['status'](_0x5c9c7e)['send'](_0x3ac80f);};}exports[_0xaaf8('0x29')]=function(_0x4e6fc7,_0x3dbc59){var _0x3adb40={},_0x1127e5={},_0x2e6bde={'count':0x0,'rows':[]};var _0x188f74=_['map'](db[_0xaaf8('0x2a')][_0xaaf8('0x2b')],function(_0x5c6c26){return{'name':_0x5c6c26[_0xaaf8('0x2c')],'type':_0x5c6c26[_0xaaf8('0x2d')][_0xaaf8('0x2e')]};});_0x1127e5['model']=_[_0xaaf8('0x2f')](_0x188f74,_0xaaf8('0x28'));_0x1127e5[_0xaaf8('0x30')]=_[_0xaaf8('0x31')](_0x4e6fc7[_0xaaf8('0x30')]);_0x1127e5[_0xaaf8('0x32')]=_[_0xaaf8('0x33')](_0x1127e5['model'],_0x1127e5[_0xaaf8('0x30')]);_0x3adb40['attributes']=_[_0xaaf8('0x33')](_0x1127e5[_0xaaf8('0x34')],qs[_0xaaf8('0x35')](_0x4e6fc7[_0xaaf8('0x30')][_0xaaf8('0x35')]));_0x3adb40[_0xaaf8('0x36')]=_0x3adb40[_0xaaf8('0x36')]['length']?_0x3adb40[_0xaaf8('0x36')]:_0x1127e5[_0xaaf8('0x34')];if(!_0x4e6fc7['query']['hasOwnProperty'](_0xaaf8('0x37'))){_0x3adb40[_0xaaf8('0x1d')]=qs['limit'](_0x4e6fc7[_0xaaf8('0x30')][_0xaaf8('0x1d')]);_0x3adb40['offset']=qs[_0xaaf8('0x1f')](_0x4e6fc7[_0xaaf8('0x30')][_0xaaf8('0x1f')]);}_0x3adb40[_0xaaf8('0x38')]=qs[_0xaaf8('0x39')](_0x4e6fc7[_0xaaf8('0x30')]['sort']);_0x3adb40[_0xaaf8('0x3a')]=qs['filters'](_['pick'](_0x4e6fc7[_0xaaf8('0x30')],_0x1127e5[_0xaaf8('0x32')]),_0x188f74);if(_0x4e6fc7[_0xaaf8('0x30')]['filter']){_0x3adb40[_0xaaf8('0x3a')]=_['merge'](_0x3adb40['where'],{'$or':_['map'](_0x188f74,function(_0x78962e){if(_0x78962e[_0xaaf8('0x2d')]!=='VIRTUAL'){var _0x9a30b9={};_0x9a30b9[_0x78962e['name']]={'$like':'%'+_0x4e6fc7['query'][_0xaaf8('0x3b')]+'%'};return _0x9a30b9;}})});}_0x3adb40=_['merge']({},_0x3adb40,_0x4e6fc7[_0xaaf8('0x3c')]);var _0x5a2598={'where':_0x3adb40[_0xaaf8('0x3a')]};return db[_0xaaf8('0x2a')][_0xaaf8('0x1e')](_0x5a2598)[_0xaaf8('0x26')](function(_0x5b7aae){_0x2e6bde[_0xaaf8('0x1e')]=_0x5b7aae;if(_0x4e6fc7[_0xaaf8('0x30')][_0xaaf8('0x3d')]){_0x3adb40['include']=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x3adb40);})[_0xaaf8('0x26')](function(_0x289921){_0x2e6bde['rows']=_0x289921;return _0x2e6bde;})[_0xaaf8('0x26')](respondWithFilteredResult(_0x3dbc59,_0x3adb40))[_0xaaf8('0x3e')](handleError(_0x3dbc59,null));};exports[_0xaaf8('0x3f')]=function(_0x4d5ecf,_0x2ec6ac){var _0x1e5fdd={'raw':![],'where':{'id':_0x4d5ecf['params']['id']}},_0x437e18={};_0x437e18[_0xaaf8('0x34')]=_[_0xaaf8('0x31')](db[_0xaaf8('0x2a')][_0xaaf8('0x2b')]);_0x437e18['query']=_[_0xaaf8('0x31')](_0x4d5ecf[_0xaaf8('0x30')]);_0x437e18[_0xaaf8('0x32')]=_[_0xaaf8('0x33')](_0x437e18[_0xaaf8('0x34')],_0x437e18['query']);_0x1e5fdd[_0xaaf8('0x36')]=_[_0xaaf8('0x33')](_0x437e18['model'],qs[_0xaaf8('0x35')](_0x4d5ecf[_0xaaf8('0x30')]['fields']));_0x1e5fdd[_0xaaf8('0x36')]=_0x1e5fdd[_0xaaf8('0x36')]['length']?_0x1e5fdd[_0xaaf8('0x36')]:_0x437e18[_0xaaf8('0x34')];if(_0x4d5ecf[_0xaaf8('0x30')]['includeAll']){_0x1e5fdd['include']=[{'all':!![]}];}_0x1e5fdd=_[_0xaaf8('0x40')]({},_0x1e5fdd,_0x4d5ecf[_0xaaf8('0x3c')]);return db[_0xaaf8('0x2a')][_0xaaf8('0x41')](_0x1e5fdd)[_0xaaf8('0x26')](handleEntityNotFound(_0x2ec6ac,null))['then'](respondWithResult(_0x2ec6ac,null))[_0xaaf8('0x3e')](handleError(_0x2ec6ac,null));};exports['create']=function(_0x538462,_0x284189){return db[_0xaaf8('0x2a')]['create'](_0x538462['body'],{})[_0xaaf8('0x26')](respondWithResult(_0x284189,0xc9))[_0xaaf8('0x3e')](handleError(_0x284189,null));};exports['update']=function(_0x3995eb,_0x54d168){if(_0x3995eb[_0xaaf8('0x42')]['id']){delete _0x3995eb['body']['id'];}return db[_0xaaf8('0x2a')][_0xaaf8('0x41')]({'where':{'id':_0x3995eb['params']['id']}})[_0xaaf8('0x26')](handleEntityNotFound(_0x54d168,null))[_0xaaf8('0x26')](saveUpdates(_0x3995eb[_0xaaf8('0x42')],null))[_0xaaf8('0x26')](respondWithResult(_0x54d168,null))['catch'](handleError(_0x54d168,null));};exports['destroy']=function(_0x5e2593,_0x52d7f2){return db[_0xaaf8('0x2a')]['find']({'where':{'id':_0x5e2593[_0xaaf8('0x43')]['id']}})[_0xaaf8('0x26')](handleEntityNotFound(_0x52d7f2,null))[_0xaaf8('0x26')](removeEntity(_0x52d7f2,null))[_0xaaf8('0x3e')](handleError(_0x52d7f2,null));};exports[_0xaaf8('0x44')]=function(_0x6eaec5,_0x559b39,_0x4daa0e){var _0x9929d3={};var _0x5de859={};var _0x3ffd0a;var _0x3614aa;return db['FreshdeskConfiguration'][_0xaaf8('0x45')]({'where':{'id':_0x6eaec5[_0xaaf8('0x43')]['id']}})[_0xaaf8('0x26')](handleEntityNotFound(_0x559b39,null))[_0xaaf8('0x26')](function(_0x2b1690){if(_0x2b1690){_0x3ffd0a=_0x2b1690;_0x5de859[_0xaaf8('0x34')]=_['keys'](db[_0xaaf8('0x46')][_0xaaf8('0x2b')]);_0x5de859[_0xaaf8('0x30')]=_[_0xaaf8('0x31')](_0x6eaec5[_0xaaf8('0x30')]);_0x5de859[_0xaaf8('0x32')]=_[_0xaaf8('0x33')](_0x5de859[_0xaaf8('0x34')],_0x5de859[_0xaaf8('0x30')]);_0x9929d3['attributes']=_[_0xaaf8('0x33')](_0x5de859[_0xaaf8('0x34')],qs[_0xaaf8('0x35')](_0x6eaec5[_0xaaf8('0x30')][_0xaaf8('0x35')]));_0x9929d3[_0xaaf8('0x36')]=_0x9929d3[_0xaaf8('0x36')]['length']?_0x9929d3[_0xaaf8('0x36')]:_0x5de859[_0xaaf8('0x34')];_0x9929d3[_0xaaf8('0x38')]=qs['sort'](_0x6eaec5[_0xaaf8('0x30')]['sort']);_0x9929d3[_0xaaf8('0x3a')]=qs[_0xaaf8('0x32')](_[_0xaaf8('0x47')](_0x6eaec5[_0xaaf8('0x30')],_0x5de859[_0xaaf8('0x32')]));if(_0x6eaec5[_0xaaf8('0x30')][_0xaaf8('0x3b')]){_0x9929d3[_0xaaf8('0x3a')]=_[_0xaaf8('0x40')](_0x9929d3['where'],{'$or':_['map'](_0x9929d3['attributes'],function(_0x16cbb8){var _0x5bb20f={};_0x5bb20f[_0x16cbb8]={'$like':'%'+_0x6eaec5[_0xaaf8('0x30')][_0xaaf8('0x3b')]+'%'};return _0x5bb20f;})});}_0x9929d3=_[_0xaaf8('0x40')]({},_0x9929d3,_0x6eaec5[_0xaaf8('0x3c')]);return _0x3ffd0a[_0xaaf8('0x44')](_0x9929d3);}})['then'](function(_0x806055){if(_0x806055){_0x3614aa=_0x806055[_0xaaf8('0x48')];if(!_0x6eaec5['query'][_0xaaf8('0x49')]('nolimit')){_0x9929d3[_0xaaf8('0x1d')]=qs[_0xaaf8('0x1d')](_0x6eaec5[_0xaaf8('0x30')][_0xaaf8('0x1d')]);_0x9929d3['offset']=qs[_0xaaf8('0x1f')](_0x6eaec5[_0xaaf8('0x30')][_0xaaf8('0x1f')]);}return _0x3ffd0a[_0xaaf8('0x44')](_0x9929d3);}})[_0xaaf8('0x26')](function(_0x56cb19){if(_0x56cb19){return _0x56cb19?{'count':_0x3614aa,'rows':_0x56cb19}:null;}})[_0xaaf8('0x26')](respondWithResult(_0x559b39,null))['catch'](handleError(_0x559b39,null));};exports[_0xaaf8('0x4a')]=function(_0xc4f971,_0x143a6f,_0x32ff9d){var _0x35da05={};var _0x381c92={};var _0x1bfc88;var _0x45305d;return db['FreshdeskConfiguration'][_0xaaf8('0x45')]({'where':{'id':_0xc4f971['params']['id']}})[_0xaaf8('0x26')](handleEntityNotFound(_0x143a6f,null))[_0xaaf8('0x26')](function(_0x2d0f61){if(_0x2d0f61){_0x1bfc88=_0x2d0f61;_0x381c92[_0xaaf8('0x34')]=_[_0xaaf8('0x31')](db['FreshdeskField'][_0xaaf8('0x2b')]);_0x381c92[_0xaaf8('0x30')]=_['keys'](_0xc4f971[_0xaaf8('0x30')]);_0x381c92[_0xaaf8('0x32')]=_[_0xaaf8('0x33')](_0x381c92[_0xaaf8('0x34')],_0x381c92[_0xaaf8('0x30')]);_0x35da05[_0xaaf8('0x36')]=_['intersection'](_0x381c92[_0xaaf8('0x34')],qs[_0xaaf8('0x35')](_0xc4f971[_0xaaf8('0x30')][_0xaaf8('0x35')]));_0x35da05['attributes']=_0x35da05[_0xaaf8('0x36')][_0xaaf8('0x48')]?_0x35da05['attributes']:_0x381c92[_0xaaf8('0x34')];_0x35da05[_0xaaf8('0x38')]=qs[_0xaaf8('0x39')](_0xc4f971['query'][_0xaaf8('0x39')]);_0x35da05[_0xaaf8('0x3a')]=qs[_0xaaf8('0x32')](_['pick'](_0xc4f971['query'],_0x381c92[_0xaaf8('0x32')]));if(_0xc4f971['query']['filter']){_0x35da05[_0xaaf8('0x3a')]=_[_0xaaf8('0x40')](_0x35da05[_0xaaf8('0x3a')],{'$or':_['map'](_0x35da05[_0xaaf8('0x36')],function(_0xff6100){var _0x4e85a0={};_0x4e85a0[_0xff6100]={'$like':'%'+_0xc4f971[_0xaaf8('0x30')][_0xaaf8('0x3b')]+'%'};return _0x4e85a0;})});}_0x35da05=_[_0xaaf8('0x40')]({},_0x35da05,_0xc4f971[_0xaaf8('0x3c')]);return _0x1bfc88[_0xaaf8('0x4a')](_0x35da05);}})[_0xaaf8('0x26')](function(_0x422999){if(_0x422999){_0x45305d=_0x422999[_0xaaf8('0x48')];if(!_0xc4f971['query']['hasOwnProperty']('nolimit')){_0x35da05['limit']=qs['limit'](_0xc4f971[_0xaaf8('0x30')][_0xaaf8('0x1d')]);_0x35da05[_0xaaf8('0x1f')]=qs['offset'](_0xc4f971[_0xaaf8('0x30')][_0xaaf8('0x1f')]);}return _0x1bfc88['getSubjects'](_0x35da05);}})['then'](function(_0x54c1c4){if(_0x54c1c4){return _0x54c1c4?{'count':_0x45305d,'rows':_0x54c1c4}:null;}})[_0xaaf8('0x26')](respondWithResult(_0x143a6f,null))[_0xaaf8('0x3e')](handleError(_0x143a6f,null));};exports[_0xaaf8('0x4b')]=function(_0x32ad66,_0x4d5ec3,_0x1ee851){var _0x4fb27f={};var _0x461718={};var _0x11b9e0;var _0x6fe593;return db['FreshdeskConfiguration'][_0xaaf8('0x45')]({'where':{'id':_0x32ad66['params']['id']}})['then'](handleEntityNotFound(_0x4d5ec3,null))[_0xaaf8('0x26')](function(_0x112e9c){if(_0x112e9c){_0x11b9e0=_0x112e9c;_0x461718[_0xaaf8('0x34')]=_['keys'](db[_0xaaf8('0x46')][_0xaaf8('0x2b')]);_0x461718['query']=_[_0xaaf8('0x31')](_0x32ad66[_0xaaf8('0x30')]);_0x461718['filters']=_[_0xaaf8('0x33')](_0x461718['model'],_0x461718[_0xaaf8('0x30')]);_0x4fb27f[_0xaaf8('0x36')]=_[_0xaaf8('0x33')](_0x461718['model'],qs[_0xaaf8('0x35')](_0x32ad66[_0xaaf8('0x30')][_0xaaf8('0x35')]));_0x4fb27f[_0xaaf8('0x36')]=_0x4fb27f[_0xaaf8('0x36')][_0xaaf8('0x48')]?_0x4fb27f['attributes']:_0x461718[_0xaaf8('0x34')];_0x4fb27f[_0xaaf8('0x38')]=qs[_0xaaf8('0x39')](_0x32ad66[_0xaaf8('0x30')][_0xaaf8('0x39')]);_0x4fb27f[_0xaaf8('0x3a')]=qs[_0xaaf8('0x32')](_[_0xaaf8('0x47')](_0x32ad66[_0xaaf8('0x30')],_0x461718[_0xaaf8('0x32')]));if(_0x32ad66[_0xaaf8('0x30')][_0xaaf8('0x3b')]){_0x4fb27f[_0xaaf8('0x3a')]=_[_0xaaf8('0x40')](_0x4fb27f[_0xaaf8('0x3a')],{'$or':_[_0xaaf8('0x2f')](_0x4fb27f['attributes'],function(_0x254d8f){var _0x264030={};_0x264030[_0x254d8f]={'$like':'%'+_0x32ad66[_0xaaf8('0x30')][_0xaaf8('0x3b')]+'%'};return _0x264030;})});}_0x4fb27f=_[_0xaaf8('0x40')]({},_0x4fb27f,_0x32ad66['options']);return _0x11b9e0[_0xaaf8('0x4b')](_0x4fb27f);}})[_0xaaf8('0x26')](function(_0x224aa3){if(_0x224aa3){_0x6fe593=_0x224aa3[_0xaaf8('0x48')];if(!_0x32ad66[_0xaaf8('0x30')]['hasOwnProperty']('nolimit')){_0x4fb27f['limit']=qs['limit'](_0x32ad66[_0xaaf8('0x30')]['limit']);_0x4fb27f[_0xaaf8('0x1f')]=qs[_0xaaf8('0x1f')](_0x32ad66['query'][_0xaaf8('0x1f')]);}return _0x11b9e0[_0xaaf8('0x4b')](_0x4fb27f);}})[_0xaaf8('0x26')](function(_0x4c5188){if(_0x4c5188){return _0x4c5188?{'count':_0x6fe593,'rows':_0x4c5188}:null;}})[_0xaaf8('0x26')](respondWithResult(_0x4d5ec3,null))[_0xaaf8('0x3e')](handleError(_0x4d5ec3,null));};exports[_0xaaf8('0x4c')]=function(_0x2cb67a,_0x55e39f,_0x2a0502){var _0x4c578={};var _0xedfd99={};var _0x510514;var _0x3aaefa;return db[_0xaaf8('0x2a')][_0xaaf8('0x45')]({'where':{'id':_0x2cb67a[_0xaaf8('0x43')]['id']}})[_0xaaf8('0x26')](handleEntityNotFound(_0x55e39f,null))['then'](function(_0x1a2817){if(_0x1a2817){_0x510514=_0x1a2817;_0xedfd99[_0xaaf8('0x34')]=_[_0xaaf8('0x31')](db[_0xaaf8('0x4d')]['rawAttributes']);_0xedfd99[_0xaaf8('0x30')]=_[_0xaaf8('0x31')](_0x2cb67a['query']);_0xedfd99[_0xaaf8('0x32')]=_[_0xaaf8('0x33')](_0xedfd99['model'],_0xedfd99[_0xaaf8('0x30')]);_0x4c578[_0xaaf8('0x36')]=_['intersection'](_0xedfd99['model'],qs[_0xaaf8('0x35')](_0x2cb67a[_0xaaf8('0x30')][_0xaaf8('0x35')]));_0x4c578['attributes']=_0x4c578['attributes'][_0xaaf8('0x48')]?_0x4c578[_0xaaf8('0x36')]:_0xedfd99[_0xaaf8('0x34')];_0x4c578[_0xaaf8('0x38')]=qs[_0xaaf8('0x39')](_0x2cb67a['query'][_0xaaf8('0x39')]);_0x4c578[_0xaaf8('0x3a')]=qs['filters'](_[_0xaaf8('0x47')](_0x2cb67a[_0xaaf8('0x30')],_0xedfd99[_0xaaf8('0x32')]));if(_0x2cb67a[_0xaaf8('0x30')][_0xaaf8('0x3b')]){_0x4c578[_0xaaf8('0x3a')]=_[_0xaaf8('0x40')](_0x4c578[_0xaaf8('0x3a')],{'$or':_[_0xaaf8('0x2f')](_0x4c578['attributes'],function(_0x5500c2){var _0x23cc98={};_0x23cc98[_0x5500c2]={'$like':'%'+_0x2cb67a[_0xaaf8('0x30')][_0xaaf8('0x3b')]+'%'};return _0x23cc98;})});}_0x4c578=_[_0xaaf8('0x40')]({},_0x4c578,_0x2cb67a[_0xaaf8('0x3c')]);return _0x510514[_0xaaf8('0x4c')](_0x4c578);}})[_0xaaf8('0x26')](function(_0x2a9774){if(_0x2a9774){_0x3aaefa=_0x2a9774[_0xaaf8('0x48')];if(!_0x2cb67a[_0xaaf8('0x30')][_0xaaf8('0x49')](_0xaaf8('0x37'))){_0x4c578[_0xaaf8('0x1d')]=qs[_0xaaf8('0x1d')](_0x2cb67a[_0xaaf8('0x30')][_0xaaf8('0x1d')]);_0x4c578['offset']=qs['offset'](_0x2cb67a[_0xaaf8('0x30')][_0xaaf8('0x1f')]);}return _0x510514['getTags'](_0x4c578);}})[_0xaaf8('0x26')](function(_0x4921ba){if(_0x4921ba){return _0x4921ba?{'count':_0x3aaefa,'rows':_0x4921ba}:null;}})[_0xaaf8('0x26')](respondWithResult(_0x55e39f,null))['catch'](handleError(_0x55e39f,null));};exports[_0xaaf8('0x4e')]=function(_0x5ee893,_0x2d78cb,_0x22ac75){if(_0x5ee893[_0xaaf8('0x42')]['id']){delete _0x5ee893[_0xaaf8('0x42')]['id'];}return db[_0xaaf8('0x2a')][_0xaaf8('0x45')]({'where':{'id':_0x5ee893['params']['id']}})[_0xaaf8('0x26')](handleEntityNotFound(_0x2d78cb,null))[_0xaaf8('0x26')](function(_0x539677){if(_0x539677){return _0x539677['setTags'](_0x5ee893[_0xaaf8('0x42')][_0xaaf8('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x2d78cb,null))['catch'](handleError(_0x2d78cb,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 93533d4..52f513c 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 _0xa43b=['FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x12ab9c,_0x1ad557){var _0x2a3e39=function(_0x5f0653){while(--_0x5f0653){_0x12ab9c['push'](_0x12ab9c['shift']());}};_0x2a3e39(++_0x1ad557);}(_0xa43b,0x1ba));var _0xba43=function(_0x50fef7,_0x2847b2){_0x50fef7=_0x50fef7-0x0;var _0x12a216=_0xa43b[_0x50fef7];return _0x12a216;};'use strict';var _=require('lodash');var util=require(_0xba43('0x0'));var logger=require(_0xba43('0x1'))('api');var moment=require(_0xba43('0x2'));var BPromise=require(_0xba43('0x3'));var rp=require(_0xba43('0x4'));var fs=require('fs');var path=require(_0xba43('0x5'));var rimraf=require(_0xba43('0x6'));var config=require(_0xba43('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x465126,_0x2853e8){return _0x465126[_0xba43('0x8')](_0xba43('0x9'),attributes,{'tableName':_0xba43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb80=['int_freshdesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcb80,0x112));var _0x0cb8=function(_0x220a04,_0x5a114a){_0x220a04=_0x220a04-0x0;var _0x201376=_0xcb80[_0x220a04];return _0x201376;};'use strict';var _=require('lodash');var util=require(_0x0cb8('0x0'));var logger=require(_0x0cb8('0x1'))(_0x0cb8('0x2'));var moment=require(_0x0cb8('0x3'));var BPromise=require(_0x0cb8('0x4'));var rp=require(_0x0cb8('0x5'));var fs=require('fs');var path=require(_0x0cb8('0x6'));var rimraf=require(_0x0cb8('0x7'));var config=require(_0x0cb8('0x8'));var attributes=require(_0x0cb8('0x9'));module[_0x0cb8('0xa')]=function(_0x1c484d,_0x4ea531){return _0x1c484d[_0x0cb8('0xb')]('FreshdeskConfiguration',attributes,{'tableName':_0x0cb8('0xc'),'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 ca6d0be..54c855c 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 _0x64a7=['info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then'];(function(_0x28139b,_0x6d084b){var _0x40373c=function(_0x1fbd20){while(--_0x1fbd20){_0x28139b['push'](_0x28139b['shift']());}};_0x40373c(++_0x6d084b);}(_0x64a7,0x8e));var _0x764a=function(_0x40f477,_0x6425da){_0x40f477=_0x40f477-0x0;var _0x1d9075=_0x64a7[_0x40f477];return _0x1d9075;};'use strict';var _=require(_0x764a('0x0'));var util=require(_0x764a('0x1'));var moment=require(_0x764a('0x2'));var BPromise=require(_0x764a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x764a('0x4'));var db=require(_0x764a('0x5'))['db'];var utils=require(_0x764a('0x6'));var logger=require(_0x764a('0x7'))(_0x764a('0x8'));var config=require(_0x764a('0x9'));var jayson=require(_0x764a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46822d,_0x114a05,_0x1a5a0e){return new BPromise(function(_0x58c19f,_0x54305d){return client['request'](_0x46822d,_0x1a5a0e)[_0x764a('0xb')](function(_0x2bea09){logger[_0x764a('0xc')](_0x764a('0xd'),_0x114a05,'request\x20sent');logger[_0x764a('0xe')](_0x764a('0xf'),_0x114a05,_0x764a('0x10'),JSON[_0x764a('0x11')](_0x2bea09));if(_0x2bea09[_0x764a('0x12')]){if(_0x2bea09[_0x764a('0x12')][_0x764a('0x13')]===0x1f4){logger['error'](_0x764a('0xd'),_0x114a05,_0x2bea09[_0x764a('0x12')]['message']);return _0x54305d(_0x2bea09['error']['message']);}logger[_0x764a('0x12')](_0x764a('0xd'),_0x114a05,_0x2bea09[_0x764a('0x12')]['message']);return _0x58c19f(_0x2bea09['error'][_0x764a('0x14')]);}else{logger['info'](_0x764a('0xd'),_0x114a05,_0x764a('0x10'));_0x58c19f(_0x2bea09[_0x764a('0x15')]['message']);}})['catch'](function(_0x436f55){logger[_0x764a('0x12')](_0x764a('0xd'),_0x114a05,_0x436f55);_0x54305d(_0x436f55);});});} \ No newline at end of file +var _0xb73d=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xb73d,0x83));var _0xdb73=function(_0x405fe8,_0xa55e2f){_0x405fe8=_0x405fe8-0x0;var _0x50e490=_0xb73d[_0x405fe8];return _0x50e490;};'use strict';var _=require(_0xdb73('0x0'));var util=require(_0xdb73('0x1'));var moment=require(_0xdb73('0x2'));var BPromise=require(_0xdb73('0x3'));var rs=require(_0xdb73('0x4'));var fs=require('fs');var Redis=require(_0xdb73('0x5'));var db=require(_0xdb73('0x6'))['db'];var utils=require(_0xdb73('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xdb73('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdb73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4673b3,_0xe5f3a0,_0x597238){return new BPromise(function(_0x1c6d94,_0x5e3cc8){return client['request'](_0x4673b3,_0x597238)[_0xdb73('0xa')](function(_0x499daa){logger[_0xdb73('0xb')](_0xdb73('0xc'),_0xe5f3a0,_0xdb73('0xd'));logger[_0xdb73('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0xe5f3a0,_0xdb73('0xd'),JSON[_0xdb73('0xf')](_0x499daa));if(_0x499daa[_0xdb73('0x10')]){if(_0x499daa[_0xdb73('0x10')][_0xdb73('0x11')]===0x1f4){logger[_0xdb73('0x10')](_0xdb73('0xc'),_0xe5f3a0,_0x499daa['error']['message']);return _0x5e3cc8(_0x499daa[_0xdb73('0x10')]['message']);}logger[_0xdb73('0x10')](_0xdb73('0xc'),_0xe5f3a0,_0x499daa[_0xdb73('0x10')][_0xdb73('0x12')]);return _0x1c6d94(_0x499daa[_0xdb73('0x10')][_0xdb73('0x12')]);}else{logger[_0xdb73('0xb')](_0xdb73('0xc'),_0xe5f3a0,_0xdb73('0xd'));_0x1c6d94(_0x499daa[_0xdb73('0x13')][_0xdb73('0x12')]);}})[_0xdb73('0x14')](function(_0x1e6762){logger[_0xdb73('0x10')](_0xdb73('0xc'),_0xe5f3a0,_0x1e6762);_0x5e3cc8(_0x1e6762);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 3fc18d9..c9c2870 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 _0x6b75=['post','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show'];(function(_0x1cb025,_0x2b7b52){var _0xf7105e=function(_0x5823e8){while(--_0x5823e8){_0x1cb025['push'](_0x1cb025['shift']());}};_0xf7105e(++_0x2b7b52);}(_0x6b75,0x112));var _0x56b7=function(_0x3299d1,_0x545733){_0x3299d1=_0x3299d1-0x0;var _0x44356e=_0x6b75[_0x3299d1];return _0x44356e;};'use strict';var multer=require(_0x56b7('0x0'));var util=require('util');var path=require(_0x56b7('0x1'));var timeout=require(_0x56b7('0x2'));var express=require(_0x56b7('0x3'));var router=express[_0x56b7('0x4')]();var fs_extra=require(_0x56b7('0x5'));var auth=require(_0x56b7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x56b7('0x7'));var controller=require(_0x56b7('0x8'));router['get']('/',auth[_0x56b7('0x9')](),controller[_0x56b7('0xa')]);router[_0x56b7('0xb')](_0x56b7('0xc'),auth[_0x56b7('0x9')](),controller[_0x56b7('0xd')]);router[_0x56b7('0xe')]('/',auth[_0x56b7('0x9')](),controller['create']);router['put'](_0x56b7('0xc'),auth[_0x56b7('0x9')](),controller[_0x56b7('0xf')]);router['delete'](_0x56b7('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5062=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x1ef4cd,_0x52830d){var _0x59a248=function(_0x40257f){while(--_0x40257f){_0x1ef4cd['push'](_0x1ef4cd['shift']());}};_0x59a248(++_0x52830d);}(_0x5062,0x9e));var _0x2506=function(_0x4d2236,_0x2c37e3){_0x4d2236=_0x4d2236-0x0;var _0x4f5106=_0x5062[_0x4d2236];return _0x4f5106;};'use strict';var multer=require(_0x2506('0x0'));var util=require('util');var path=require(_0x2506('0x1'));var timeout=require(_0x2506('0x2'));var express=require(_0x2506('0x3'));var router=express[_0x2506('0x4')]();var fs_extra=require(_0x2506('0x5'));var auth=require(_0x2506('0x6'));var interaction=require(_0x2506('0x7'));var config=require(_0x2506('0x8'));var controller=require(_0x2506('0x9'));router[_0x2506('0xa')]('/',auth['isAuthenticated'](),controller[_0x2506('0xb')]);router[_0x2506('0xa')](_0x2506('0xc'),auth[_0x2506('0xd')](),controller[_0x2506('0xe')]);router[_0x2506('0xf')]('/',auth[_0x2506('0xd')](),controller[_0x2506('0x10')]);router[_0x2506('0x11')](_0x2506('0xc'),auth[_0x2506('0xd')](),controller[_0x2506('0x12')]);router[_0x2506('0x13')]('/:id',auth[_0x2506('0xd')](),controller[_0x2506('0x14')]);module[_0x2506('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index adb1653..92fac5b 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 _0xdbe1=['BOOLEAN','sequelize','exports','string','keyValue','STRING','variable','customVariable'];(function(_0x150cb6,_0x3b31b7){var _0x3dd21d=function(_0xfd6135){while(--_0xfd6135){_0x150cb6['push'](_0x150cb6['shift']());}};_0x3dd21d(++_0x3b31b7);}(_0xdbe1,0x111));var _0x1dbe=function(_0x32ff52,_0x4246b4){_0x32ff52=_0x32ff52-0x0;var _0x166ae2=_0xdbe1[_0x32ff52];return _0x166ae2;};'use strict';var Sequelize=require(_0x1dbe('0x0'));module[_0x1dbe('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1dbe('0x2'),'variable','customVariable',_0x1dbe('0x3'),'picklist'),'defaultValue':_0x1dbe('0x2')},'content':{'type':Sequelize[_0x1dbe('0x4')]},'key':{'type':Sequelize[_0x1dbe('0x4')]},'keyType':{'type':Sequelize['ENUM']('string',_0x1dbe('0x5'),_0x1dbe('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1dbe('0x4')]},'nameField':{'type':Sequelize[_0x1dbe('0x4')]},'customField':{'type':Sequelize[_0x1dbe('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1dbe('0x4')]}}; \ No newline at end of file +var _0x5388=['sequelize','exports','variable','customVariable','keyValue','string','STRING','ENUM','BOOLEAN'];(function(_0x5dfb47,_0x5b158c){var _0x48c85a=function(_0x5d9ccf){while(--_0x5d9ccf){_0x5dfb47['push'](_0x5dfb47['shift']());}};_0x48c85a(++_0x5b158c);}(_0x5388,0xd8));var _0x8538=function(_0x2269d9,_0x4f92c9){_0x2269d9=_0x2269d9-0x0;var _0x14f761=_0x5388[_0x2269d9];return _0x14f761;};'use strict';var Sequelize=require(_0x8538('0x0'));module[_0x8538('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x8538('0x2'),_0x8538('0x3'),_0x8538('0x4'),'picklist'),'defaultValue':_0x8538('0x5')},'content':{'type':Sequelize[_0x8538('0x6')]},'key':{'type':Sequelize[_0x8538('0x6')]},'keyType':{'type':Sequelize[_0x8538('0x7')](_0x8538('0x5'),_0x8538('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x8538('0x6')]},'idField':{'type':Sequelize[_0x8538('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8538('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index d8df687..dc2112e 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 _0x6f0d=['params','find','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','reject','update','destroy','then','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x13b019,_0x10b1ff){_0x13b019=_0x13b019-0x0;var _0x17fed9=_0x6f0d[_0x13b019];return _0x17fed9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6f0('0x0'));var zipdir=require(_0xd6f0('0x1'));var jsonpatch=require(_0xd6f0('0x2'));var rp=require(_0xd6f0('0x3'));var moment=require('moment');var BPromise=require(_0xd6f0('0x4'));var Mustache=require(_0xd6f0('0x5'));var util=require(_0xd6f0('0x6'));var path=require(_0xd6f0('0x7'));var sox=require(_0xd6f0('0x8'));var csv=require('to-csv');var ejs=require(_0xd6f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];function respondWithStatusCode(_0x306aad,_0x45973d){_0x45973d=_0x45973d||0xcc;return function(_0x109655){if(_0x109655){return _0x306aad[_0xd6f0('0x19')](_0x45973d);}return _0x306aad[_0xd6f0('0x1a')](_0x45973d)[_0xd6f0('0x1b')]();};}function respondWithResult(_0x246dad,_0x4ab979){_0x4ab979=_0x4ab979||0xc8;return function(_0x2b3f32){if(_0x2b3f32){return _0x246dad[_0xd6f0('0x1a')](_0x4ab979)['json'](_0x2b3f32);}};}function respondWithFilteredResult(_0x419b7e,_0x593abe){return function(_0x3f4851){if(_0x3f4851){var _0x154e3e=typeof _0x593abe[_0xd6f0('0x1c')]===_0xd6f0('0x1d')&&typeof _0x593abe[_0xd6f0('0x1e')]===_0xd6f0('0x1d');var _0x25da0c=_0x3f4851[_0xd6f0('0x1f')];var _0x2e71bd=_0x154e3e?0x0:_0x593abe[_0xd6f0('0x1c')];var _0x23ab6c=_0x154e3e?_0x3f4851[_0xd6f0('0x1f')]:_0x593abe[_0xd6f0('0x1c')]+_0x593abe[_0xd6f0('0x1e')];var _0x1f43d7;if(_0x23ab6c>=_0x25da0c){_0x23ab6c=_0x25da0c;_0x1f43d7=0xc8;}else{_0x1f43d7=0xce;}_0x419b7e[_0xd6f0('0x1a')](_0x1f43d7);return _0x419b7e['set']('Content-Range',_0x2e71bd+'-'+_0x23ab6c+'/'+_0x25da0c)[_0xd6f0('0x20')](_0x3f4851);}return null;};}function patchUpdates(_0x264104){return function(_0x1158dc){try{jsonpatch['apply'](_0x1158dc,_0x264104,!![]);}catch(_0x67afa7){return BPromise[_0xd6f0('0x21')](_0x67afa7);}return _0x1158dc['save']();};}function saveUpdates(_0x86dde0,_0x515687){return function(_0x1ee584){if(_0x1ee584){return _0x1ee584[_0xd6f0('0x22')](_0x86dde0)['then'](function(_0xb9e820){return _0xb9e820;});}return null;};}function removeEntity(_0x45e99c,_0x5ea2dd){return function(_0x3dbdc3){if(_0x3dbdc3){return _0x3dbdc3[_0xd6f0('0x23')]()[_0xd6f0('0x24')](function(){_0x45e99c['status'](0xcc)[_0xd6f0('0x1b')]();});}};}function handleEntityNotFound(_0x3dc166,_0x5ecb16){return function(_0xcea0ae){if(!_0xcea0ae){_0x3dc166['sendStatus'](0x194);}return _0xcea0ae;};}function handleError(_0x2042d5,_0x3fb5c3){_0x3fb5c3=_0x3fb5c3||0x1f4;return function(_0x1630dc){logger[_0xd6f0('0x25')](_0x1630dc[_0xd6f0('0x26')]);if(_0x1630dc[_0xd6f0('0x27')]){delete _0x1630dc[_0xd6f0('0x27')];}_0x2042d5[_0xd6f0('0x1a')](_0x3fb5c3)['send'](_0x1630dc);};}exports[_0xd6f0('0x28')]=function(_0x1982d3,_0x55656c){var _0x38a3e9={},_0x385947={},_0x27db5e={'count':0x0,'rows':[]};var _0xb61222=_[_0xd6f0('0x29')](db[_0xd6f0('0x2a')][_0xd6f0('0x2b')],function(_0x3151f8){return{'name':_0x3151f8[_0xd6f0('0x2c')],'type':_0x3151f8[_0xd6f0('0x2d')][_0xd6f0('0x2e')]};});_0x385947[_0xd6f0('0x2f')]=_[_0xd6f0('0x29')](_0xb61222,_0xd6f0('0x27'));_0x385947[_0xd6f0('0x30')]=_[_0xd6f0('0x31')](_0x1982d3[_0xd6f0('0x30')]);_0x385947[_0xd6f0('0x32')]=_[_0xd6f0('0x33')](_0x385947[_0xd6f0('0x2f')],_0x385947[_0xd6f0('0x30')]);_0x38a3e9[_0xd6f0('0x34')]=_['intersection'](_0x385947[_0xd6f0('0x2f')],qs['fields'](_0x1982d3['query'][_0xd6f0('0x35')]));_0x38a3e9[_0xd6f0('0x34')]=_0x38a3e9[_0xd6f0('0x34')][_0xd6f0('0x36')]?_0x38a3e9[_0xd6f0('0x34')]:_0x385947['model'];if(!_0x1982d3[_0xd6f0('0x30')]['hasOwnProperty'](_0xd6f0('0x37'))){_0x38a3e9[_0xd6f0('0x1e')]=qs[_0xd6f0('0x1e')](_0x1982d3[_0xd6f0('0x30')][_0xd6f0('0x1e')]);_0x38a3e9['offset']=qs['offset'](_0x1982d3[_0xd6f0('0x30')][_0xd6f0('0x1c')]);}_0x38a3e9['order']=qs[_0xd6f0('0x38')](_0x1982d3['query'][_0xd6f0('0x38')]);_0x38a3e9[_0xd6f0('0x39')]=qs[_0xd6f0('0x32')](_[_0xd6f0('0x3a')](_0x1982d3[_0xd6f0('0x30')],_0x385947[_0xd6f0('0x32')]),_0xb61222);if(_0x1982d3[_0xd6f0('0x30')]['filter']){_0x38a3e9['where']=_[_0xd6f0('0x3b')](_0x38a3e9[_0xd6f0('0x39')],{'$or':_[_0xd6f0('0x29')](_0xb61222,function(_0x5c2d9a){if(_0x5c2d9a['type']!==_0xd6f0('0x3c')){var _0x2def01={};_0x2def01[_0x5c2d9a[_0xd6f0('0x27')]]={'$like':'%'+_0x1982d3[_0xd6f0('0x30')][_0xd6f0('0x3d')]+'%'};return _0x2def01;}})});}_0x38a3e9=_[_0xd6f0('0x3b')]({},_0x38a3e9,_0x1982d3[_0xd6f0('0x3e')]);var _0x64359c={'where':_0x38a3e9['where']};return db[_0xd6f0('0x2a')][_0xd6f0('0x1f')](_0x64359c)[_0xd6f0('0x24')](function(_0x3964e6){_0x27db5e['count']=_0x3964e6;if(_0x1982d3[_0xd6f0('0x30')][_0xd6f0('0x3f')]){_0x38a3e9[_0xd6f0('0x40')]=[{'all':!![]}];}return db[_0xd6f0('0x2a')][_0xd6f0('0x41')](_0x38a3e9);})['then'](function(_0x332809){_0x27db5e[_0xd6f0('0x42')]=_0x332809;return _0x27db5e;})[_0xd6f0('0x24')](respondWithFilteredResult(_0x55656c,_0x38a3e9))['catch'](handleError(_0x55656c,null));};exports[_0xd6f0('0x43')]=function(_0x1ddc40,_0x4b8cc7){var _0x516ffd={'raw':!![],'where':{'id':_0x1ddc40[_0xd6f0('0x44')]['id']}},_0x9cffd4={};_0x9cffd4[_0xd6f0('0x2f')]=_['keys'](db[_0xd6f0('0x2a')][_0xd6f0('0x2b')]);_0x9cffd4['query']=_[_0xd6f0('0x31')](_0x1ddc40[_0xd6f0('0x30')]);_0x9cffd4[_0xd6f0('0x32')]=_[_0xd6f0('0x33')](_0x9cffd4['model'],_0x9cffd4[_0xd6f0('0x30')]);_0x516ffd[_0xd6f0('0x34')]=_[_0xd6f0('0x33')](_0x9cffd4[_0xd6f0('0x2f')],qs[_0xd6f0('0x35')](_0x1ddc40[_0xd6f0('0x30')][_0xd6f0('0x35')]));_0x516ffd[_0xd6f0('0x34')]=_0x516ffd['attributes'][_0xd6f0('0x36')]?_0x516ffd[_0xd6f0('0x34')]:_0x9cffd4['model'];if(_0x1ddc40[_0xd6f0('0x30')][_0xd6f0('0x3f')]){_0x516ffd[_0xd6f0('0x40')]=[{'all':!![]}];}_0x516ffd=_[_0xd6f0('0x3b')]({},_0x516ffd,_0x1ddc40['options']);return db[_0xd6f0('0x2a')][_0xd6f0('0x45')](_0x516ffd)['then'](handleEntityNotFound(_0x4b8cc7,null))['then'](respondWithResult(_0x4b8cc7,null))[_0xd6f0('0x46')](handleError(_0x4b8cc7,null));};exports['create']=function(_0x35a8f5,_0x61b354){return db[_0xd6f0('0x2a')]['create'](_0x35a8f5[_0xd6f0('0x47')],{})[_0xd6f0('0x24')](respondWithResult(_0x61b354,0xc9))[_0xd6f0('0x46')](handleError(_0x61b354,null));};exports[_0xd6f0('0x22')]=function(_0xc4147e,_0x4c42ce){if(_0xc4147e[_0xd6f0('0x47')]['id']){delete _0xc4147e['body']['id'];}return db[_0xd6f0('0x2a')][_0xd6f0('0x45')]({'where':{'id':_0xc4147e[_0xd6f0('0x44')]['id']}})[_0xd6f0('0x24')](handleEntityNotFound(_0x4c42ce,null))['then'](saveUpdates(_0xc4147e['body'],null))[_0xd6f0('0x24')](respondWithResult(_0x4c42ce,null))[_0xd6f0('0x46')](handleError(_0x4c42ce,null));};exports['destroy']=function(_0xa68b18,_0x56c448){return db[_0xd6f0('0x2a')][_0xd6f0('0x45')]({'where':{'id':_0xa68b18[_0xd6f0('0x44')]['id']}})[_0xd6f0('0x24')](handleEntityNotFound(_0x56c448,null))[_0xd6f0('0x24')](removeEntity(_0x56c448,null))['catch'](handleError(_0x56c448,null));}; \ No newline at end of file +var _0x44a3=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../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','FreshdeskField','rawAttributes','model','map','keys','query','filters','intersection','attributes','length','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x325d0c,_0x2e4b02){var _0x50f623=function(_0x33062d){while(--_0x33062d){_0x325d0c['push'](_0x325d0c['shift']());}};_0x50f623(++_0x2e4b02);}(_0x44a3,0x1a9));var _0x344a=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0x44a3[_0x280f4a];return _0x1bb157;};'use strict';var emlformat=require(_0x344a('0x0'));var rimraf=require(_0x344a('0x1'));var zipdir=require(_0x344a('0x2'));var jsonpatch=require(_0x344a('0x3'));var rp=require(_0x344a('0x4'));var moment=require(_0x344a('0x5'));var BPromise=require(_0x344a('0x6'));var Mustache=require(_0x344a('0x7'));var util=require('util');var path=require(_0x344a('0x8'));var sox=require(_0x344a('0x9'));var csv=require(_0x344a('0xa'));var ejs=require(_0x344a('0xb'));var fs=require('fs');var fs_extra=require(_0x344a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x344a('0xd'));var toCsv=require(_0x344a('0xa'));var querystring=require(_0x344a('0xe'));var Papa=require(_0x344a('0xf'));var Redis=require(_0x344a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x344a('0x11'));var as=require(_0x344a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x344a('0x13'))('api');var utils=require(_0x344a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x344a('0x15'));var db=require(_0x344a('0x16'))['db'];function respondWithStatusCode(_0x57e42e,_0x4a69ea){_0x4a69ea=_0x4a69ea||0xcc;return function(_0x304b70){if(_0x304b70){return _0x57e42e[_0x344a('0x17')](_0x4a69ea);}return _0x57e42e[_0x344a('0x18')](_0x4a69ea)[_0x344a('0x19')]();};}function respondWithResult(_0x5a0df6,_0x133ad4){_0x133ad4=_0x133ad4||0xc8;return function(_0x4ee562){if(_0x4ee562){return _0x5a0df6[_0x344a('0x18')](_0x133ad4)[_0x344a('0x1a')](_0x4ee562);}};}function respondWithFilteredResult(_0xce0f65,_0x6e1639){return function(_0x58c8cd){if(_0x58c8cd){var _0x54a643=typeof _0x6e1639[_0x344a('0x1b')]===_0x344a('0x1c')&&typeof _0x6e1639[_0x344a('0x1d')]===_0x344a('0x1c');var _0x48b3ab=_0x58c8cd[_0x344a('0x1e')];var _0x277c06=_0x54a643?0x0:_0x6e1639['offset'];var _0x9fe854=_0x54a643?_0x58c8cd[_0x344a('0x1e')]:_0x6e1639[_0x344a('0x1b')]+_0x6e1639[_0x344a('0x1d')];var _0x13b382;if(_0x9fe854>=_0x48b3ab){_0x9fe854=_0x48b3ab;_0x13b382=0xc8;}else{_0x13b382=0xce;}_0xce0f65[_0x344a('0x18')](_0x13b382);return _0xce0f65[_0x344a('0x1f')](_0x344a('0x20'),_0x277c06+'-'+_0x9fe854+'/'+_0x48b3ab)[_0x344a('0x1a')](_0x58c8cd);}return null;};}function patchUpdates(_0x450922){return function(_0x4b3552){try{jsonpatch[_0x344a('0x21')](_0x4b3552,_0x450922,!![]);}catch(_0x4232eb){return BPromise[_0x344a('0x22')](_0x4232eb);}return _0x4b3552[_0x344a('0x23')]();};}function saveUpdates(_0x240be3,_0x80ae12){return function(_0x185303){if(_0x185303){return _0x185303[_0x344a('0x24')](_0x240be3)[_0x344a('0x25')](function(_0x27f527){return _0x27f527;});}return null;};}function removeEntity(_0x90070c,_0x3b2ab9){return function(_0x5ce9da){if(_0x5ce9da){return _0x5ce9da[_0x344a('0x26')]()['then'](function(){_0x90070c[_0x344a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a5e49,_0x484f97){return function(_0x36c920){if(!_0x36c920){_0x2a5e49[_0x344a('0x17')](0x194);}return _0x36c920;};}function handleError(_0x2ebae9,_0x16d404){_0x16d404=_0x16d404||0x1f4;return function(_0x26f059){logger[_0x344a('0x27')](_0x26f059[_0x344a('0x28')]);if(_0x26f059[_0x344a('0x29')]){delete _0x26f059['name'];}_0x2ebae9[_0x344a('0x18')](_0x16d404)[_0x344a('0x2a')](_0x26f059);};}exports[_0x344a('0x2b')]=function(_0xc02d6,_0x14bd54){var _0x2d72c9={},_0x5b877d={},_0x3d25fe={'count':0x0,'rows':[]};var _0x49bbf8=_['map'](db[_0x344a('0x2c')][_0x344a('0x2d')],function(_0x5a36bb){return{'name':_0x5a36bb['fieldName'],'type':_0x5a36bb['type']['key']};});_0x5b877d[_0x344a('0x2e')]=_[_0x344a('0x2f')](_0x49bbf8,_0x344a('0x29'));_0x5b877d['query']=_[_0x344a('0x30')](_0xc02d6[_0x344a('0x31')]);_0x5b877d[_0x344a('0x32')]=_[_0x344a('0x33')](_0x5b877d[_0x344a('0x2e')],_0x5b877d[_0x344a('0x31')]);_0x2d72c9[_0x344a('0x34')]=_['intersection'](_0x5b877d[_0x344a('0x2e')],qs['fields'](_0xc02d6['query']['fields']));_0x2d72c9[_0x344a('0x34')]=_0x2d72c9[_0x344a('0x34')][_0x344a('0x35')]?_0x2d72c9[_0x344a('0x34')]:_0x5b877d[_0x344a('0x2e')];if(!_0xc02d6[_0x344a('0x31')]['hasOwnProperty'](_0x344a('0x36'))){_0x2d72c9[_0x344a('0x1d')]=qs[_0x344a('0x1d')](_0xc02d6['query'][_0x344a('0x1d')]);_0x2d72c9[_0x344a('0x1b')]=qs[_0x344a('0x1b')](_0xc02d6[_0x344a('0x31')][_0x344a('0x1b')]);}_0x2d72c9['order']=qs[_0x344a('0x37')](_0xc02d6[_0x344a('0x31')][_0x344a('0x37')]);_0x2d72c9[_0x344a('0x38')]=qs[_0x344a('0x32')](_['pick'](_0xc02d6[_0x344a('0x31')],_0x5b877d[_0x344a('0x32')]),_0x49bbf8);if(_0xc02d6[_0x344a('0x31')][_0x344a('0x39')]){_0x2d72c9[_0x344a('0x38')]=_['merge'](_0x2d72c9[_0x344a('0x38')],{'$or':_[_0x344a('0x2f')](_0x49bbf8,function(_0x1f52dc){if(_0x1f52dc[_0x344a('0x3a')]!==_0x344a('0x3b')){var _0x27d2d5={};_0x27d2d5[_0x1f52dc[_0x344a('0x29')]]={'$like':'%'+_0xc02d6[_0x344a('0x31')]['filter']+'%'};return _0x27d2d5;}})});}_0x2d72c9=_[_0x344a('0x3c')]({},_0x2d72c9,_0xc02d6[_0x344a('0x3d')]);var _0x3d34c3={'where':_0x2d72c9[_0x344a('0x38')]};return db[_0x344a('0x2c')]['count'](_0x3d34c3)[_0x344a('0x25')](function(_0x2736e9){_0x3d25fe[_0x344a('0x1e')]=_0x2736e9;if(_0xc02d6[_0x344a('0x31')][_0x344a('0x3e')]){_0x2d72c9[_0x344a('0x3f')]=[{'all':!![]}];}return db[_0x344a('0x2c')][_0x344a('0x40')](_0x2d72c9);})[_0x344a('0x25')](function(_0x4b1bac){_0x3d25fe[_0x344a('0x41')]=_0x4b1bac;return _0x3d25fe;})[_0x344a('0x25')](respondWithFilteredResult(_0x14bd54,_0x2d72c9))[_0x344a('0x42')](handleError(_0x14bd54,null));};exports[_0x344a('0x43')]=function(_0x4f9dc2,_0x32bfa6){var _0x3069ca={'raw':!![],'where':{'id':_0x4f9dc2[_0x344a('0x44')]['id']}},_0x2b0ee9={};_0x2b0ee9[_0x344a('0x2e')]=_[_0x344a('0x30')](db[_0x344a('0x2c')][_0x344a('0x2d')]);_0x2b0ee9[_0x344a('0x31')]=_[_0x344a('0x30')](_0x4f9dc2[_0x344a('0x31')]);_0x2b0ee9['filters']=_[_0x344a('0x33')](_0x2b0ee9[_0x344a('0x2e')],_0x2b0ee9['query']);_0x3069ca[_0x344a('0x34')]=_[_0x344a('0x33')](_0x2b0ee9['model'],qs[_0x344a('0x45')](_0x4f9dc2[_0x344a('0x31')]['fields']));_0x3069ca[_0x344a('0x34')]=_0x3069ca[_0x344a('0x34')][_0x344a('0x35')]?_0x3069ca['attributes']:_0x2b0ee9[_0x344a('0x2e')];if(_0x4f9dc2['query'][_0x344a('0x3e')]){_0x3069ca[_0x344a('0x3f')]=[{'all':!![]}];}_0x3069ca=_[_0x344a('0x3c')]({},_0x3069ca,_0x4f9dc2[_0x344a('0x3d')]);return db['FreshdeskField']['find'](_0x3069ca)[_0x344a('0x25')](handleEntityNotFound(_0x32bfa6,null))[_0x344a('0x25')](respondWithResult(_0x32bfa6,null))[_0x344a('0x42')](handleError(_0x32bfa6,null));};exports[_0x344a('0x46')]=function(_0x300c9f,_0xa3c8f0){return db[_0x344a('0x2c')][_0x344a('0x46')](_0x300c9f[_0x344a('0x47')],{})[_0x344a('0x25')](respondWithResult(_0xa3c8f0,0xc9))['catch'](handleError(_0xa3c8f0,null));};exports[_0x344a('0x24')]=function(_0x2d9858,_0x6fad37){if(_0x2d9858[_0x344a('0x47')]['id']){delete _0x2d9858['body']['id'];}return db[_0x344a('0x2c')]['find']({'where':{'id':_0x2d9858['params']['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x6fad37,null))[_0x344a('0x25')](saveUpdates(_0x2d9858['body'],null))[_0x344a('0x25')](respondWithResult(_0x6fad37,null))[_0x344a('0x42')](handleError(_0x6fad37,null));};exports[_0x344a('0x26')]=function(_0x226f41,_0x51e411){return db[_0x344a('0x2c')][_0x344a('0x48')]({'where':{'id':_0x226f41[_0x344a('0x44')]['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x51e411,null))[_0x344a('0x25')](removeEntity(_0x51e411,null))[_0x344a('0x42')](handleError(_0x51e411,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 0b605ab..8d5bf30 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 _0xd3b4=['api','moment','bluebird','request-promise','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xd3b4,0x1e9));var _0x4d3b=function(_0x463b06,_0xefde77){_0x463b06=_0x463b06-0x0;var _0x19f3d3=_0xd3b4[_0x463b06];return _0x19f3d3;};'use strict';var _=require(_0x4d3b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4d3b('0x1'));var moment=require(_0x4d3b('0x2'));var BPromise=require(_0x4d3b('0x3'));var rp=require(_0x4d3b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d3b('0x5'));var config=require('../../config/environment');var attributes=require(_0x4d3b('0x6'));module[_0x4d3b('0x7')]=function(_0x708cac,_0x338d10){return _0x708cac[_0x4d3b('0x8')](_0x4d3b('0x9'),attributes,{'tableName':_0x4d3b('0xa'),'paranoid':![],'indexes':[{'name':_0x4d3b('0xb'),'fields':[_0x4d3b('0xc'),_0x4d3b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x47d6=['../../config/logger','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util'];(function(_0x1e96e0,_0x5e8999){var _0x134745=function(_0x318660){while(--_0x318660){_0x1e96e0['push'](_0x1e96e0['shift']());}};_0x134745(++_0x5e8999);}(_0x47d6,0x1de));var _0x647d=function(_0x19b394,_0x41a28){_0x19b394=_0x19b394-0x0;var _0x78772d=_0x47d6[_0x19b394];return _0x78772d;};'use strict';var _=require(_0x647d('0x0'));var util=require(_0x647d('0x1'));var logger=require(_0x647d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x647d('0x3'));var rp=require(_0x647d('0x4'));var fs=require('fs');var path=require(_0x647d('0x5'));var rimraf=require('rimraf');var config=require(_0x647d('0x6'));var attributes=require(_0x647d('0x7'));module[_0x647d('0x8')]=function(_0x4e18a7,_0x13797c){return _0x4e18a7[_0x647d('0x9')](_0x647d('0xa'),attributes,{'tableName':_0x647d('0xb'),'paranoid':![],'indexes':[{'name':_0x647d('0xc'),'fields':[_0x647d('0xd'),_0x647d('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 908c4df..ef1c511 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 _0x68c9=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FreshdeskField,\x20%s,\x20%s'];(function(_0x1ac6a0,_0x5783e7){var _0x26de06=function(_0x4f3e6b){while(--_0x4f3e6b){_0x1ac6a0['push'](_0x1ac6a0['shift']());}};_0x26de06(++_0x5783e7);}(_0x68c9,0x114));var _0x968c=function(_0x126a29,_0x260c22){_0x126a29=_0x126a29-0x0;var _0x2e3ecd=_0x68c9[_0x126a29];return _0x2e3ecd;};'use strict';var _=require(_0x968c('0x0'));var util=require(_0x968c('0x1'));var moment=require(_0x968c('0x2'));var BPromise=require(_0x968c('0x3'));var rs=require(_0x968c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x968c('0x5'))['db'];var utils=require(_0x968c('0x6'));var logger=require('../../config/logger')(_0x968c('0x7'));var config=require(_0x968c('0x8'));var jayson=require(_0x968c('0x9'));var client=jayson['client'][_0x968c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5821b8,_0x1b696d,_0x449b3e){return new BPromise(function(_0x62fc1b,_0x4613db){return client['request'](_0x5821b8,_0x449b3e)[_0x968c('0xb')](function(_0x4a2d54){logger[_0x968c('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x1b696d,'request\x20sent');logger['debug'](_0x968c('0xd'),_0x1b696d,_0x968c('0xe'),JSON['stringify'](_0x4a2d54));if(_0x4a2d54[_0x968c('0xf')]){if(_0x4a2d54[_0x968c('0xf')][_0x968c('0x10')]===0x1f4){logger[_0x968c('0xf')](_0x968c('0x11'),_0x1b696d,_0x4a2d54[_0x968c('0xf')][_0x968c('0x12')]);return _0x4613db(_0x4a2d54['error'][_0x968c('0x12')]);}logger[_0x968c('0xf')](_0x968c('0x11'),_0x1b696d,_0x4a2d54[_0x968c('0xf')][_0x968c('0x12')]);return _0x62fc1b(_0x4a2d54['error'][_0x968c('0x12')]);}else{logger[_0x968c('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x1b696d,_0x968c('0xe'));_0x62fc1b(_0x4a2d54[_0x968c('0x13')][_0x968c('0x12')]);}})[_0x968c('0x14')](function(_0x3eae3c){logger[_0x968c('0xf')](_0x968c('0x11'),_0x1b696d,_0x3eae3c);_0x4613db(_0x3eae3c);});});} \ No newline at end of file +var _0x7184=['error','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1252f7,_0x4be45f){var _0x483f01=function(_0x4cad53){while(--_0x4cad53){_0x1252f7['push'](_0x1252f7['shift']());}};_0x483f01(++_0x4be45f);}(_0x7184,0xd5));var _0x4718=function(_0x3e478c,_0x152670){_0x3e478c=_0x3e478c-0x0;var _0x29ef89=_0x7184[_0x3e478c];return _0x29ef89;};'use strict';var _=require(_0x4718('0x0'));var util=require(_0x4718('0x1'));var moment=require('moment');var BPromise=require(_0x4718('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4718('0x3'));var db=require(_0x4718('0x4'))['db'];var utils=require(_0x4718('0x5'));var logger=require(_0x4718('0x6'))(_0x4718('0x7'));var config=require('../../config/environment');var jayson=require(_0x4718('0x8'));var client=jayson[_0x4718('0x9')][_0x4718('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x594c73,_0x5bf1ea,_0x4b808b){return new BPromise(function(_0x22f6ab,_0x40e5a9){return client['request'](_0x594c73,_0x4b808b)[_0x4718('0xb')](function(_0x9c2ebe){logger[_0x4718('0xc')](_0x4718('0xd'),_0x5bf1ea,_0x4718('0xe'));logger[_0x4718('0xf')](_0x4718('0x10'),_0x5bf1ea,'request\x20sent',JSON[_0x4718('0x11')](_0x9c2ebe));if(_0x9c2ebe[_0x4718('0x12')]){if(_0x9c2ebe[_0x4718('0x12')]['code']===0x1f4){logger['error'](_0x4718('0xd'),_0x5bf1ea,_0x9c2ebe[_0x4718('0x12')]['message']);return _0x40e5a9(_0x9c2ebe[_0x4718('0x12')][_0x4718('0x13')]);}logger[_0x4718('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x5bf1ea,_0x9c2ebe[_0x4718('0x12')][_0x4718('0x13')]);return _0x22f6ab(_0x9c2ebe['error'][_0x4718('0x13')]);}else{logger[_0x4718('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x5bf1ea,_0x4718('0xe'));_0x22f6ab(_0x9c2ebe['result'][_0x4718('0x13')]);}})[_0x4718('0x14')](function(_0x3f25d5){logger['error'](_0x4718('0xd'),_0x5bf1ea,_0x3f25d5);_0x40e5a9(_0x3f25d5);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 0dcbb7b..d513b3b 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 _0x087b=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4a2d17,_0x3b5da0){var _0x472b0b=function(_0x3d93f8){while(--_0x3d93f8){_0x4a2d17['push'](_0x4a2d17['shift']());}};_0x472b0b(++_0x3b5da0);}(_0x087b,0x11a));var _0xb087=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x087b[_0x59d89e];return _0x554e93;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/fields',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x10')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x10')](_0xb087('0xd'),auth['isAuthenticated'](),controller[_0xb087('0x12')]);router[_0xb087('0x13')](_0xb087('0xb'),auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x15')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);module[_0xb087('0x17')]=router; \ No newline at end of file +var _0xf7b4=['destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','update'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf7b4,0x152));var _0x4f7b=function(_0x47f5a5,_0x2f49b5){_0x47f5a5=_0x47f5a5-0x0;var _0x5a71a9=_0xf7b4[_0x47f5a5];return _0x5a71a9;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0x7')](_0x4f7b('0xc'),auth['isAuthenticated'](),controller[_0x4f7b('0xd')]);router[_0x4f7b('0x7')]('/:id/fields',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0xf')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x10')]);router['post'](_0x4f7b('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4f7b('0x11')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x12')]);router['delete'](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x13')]);module[_0x4f7b('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 753d070..e1e02c7 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 _0x5fdc=['sequelize','exports','STRING','username','remoteUri'];(function(_0x565d34,_0x4176da){var _0x3751e7=function(_0x42428b){while(--_0x42428b){_0x565d34['push'](_0x565d34['shift']());}};_0x3751e7(++_0x4176da);}(_0x5fdc,0x127));var _0xc5fd=function(_0x49fab2,_0x318a25){_0x49fab2=_0x49fab2-0x0;var _0x3d2992=_0x5fdc[_0x49fab2];return _0x3d2992;};'use strict';var Sequelize=require(_0xc5fd('0x0'));module[_0xc5fd('0x1')]={'name':{'type':Sequelize[_0xc5fd('0x2')]},'description':{'type':Sequelize[_0xc5fd('0x2')]},'username':{'type':Sequelize[_0xc5fd('0x2')],'unique':_0xc5fd('0x3')},'apiKey':{'type':Sequelize[_0xc5fd('0x2')]},'remoteUri':{'type':Sequelize[_0xc5fd('0x2')],'unique':_0xc5fd('0x4')},'serverUrl':{'type':Sequelize[_0xc5fd('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7096=['exports','STRING','username','remoteUri'];(function(_0xf0e1d,_0x4d4715){var _0x11b897=function(_0x3ba7a3){while(--_0x3ba7a3){_0xf0e1d['push'](_0xf0e1d['shift']());}};_0x11b897(++_0x4d4715);}(_0x7096,0x10c));var _0x6709=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x7096[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require('sequelize');module[_0x6709('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6709('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6709('0x2')},'apiKey':{'type':Sequelize[_0x6709('0x1')]},'remoteUri':{'type':Sequelize[_0x6709('0x1')],'unique':_0x6709('0x3')},'serverUrl':{'type':Sequelize[_0x6709('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index af9eb9b..da1240b 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 _0x4b27=['Subjects','getSubjects','channel','getDescriptions','FreshsalesField','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','save','then','destroy','sendStatus','error','name','send','index','map','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','FreshsalesAccount','includeAll','include','findAll','rows','catch','params','find','create','body','update','getConfigurations','FreshsalesConfiguration','pick','findOne'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4b27,0xdf));var _0x74b2=function(_0x2e5f03,_0x45b348){_0x2e5f03=_0x2e5f03-0x0;var _0x39c200=_0x4b27[_0x2e5f03];return _0x39c200;};'use strict';var emlformat=require(_0x74b2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x74b2('0x1'));var moment=require(_0x74b2('0x2'));var BPromise=require(_0x74b2('0x3'));var Mustache=require('mustache');var util=require(_0x74b2('0x4'));var path=require(_0x74b2('0x5'));var sox=require('sox');var csv=require(_0x74b2('0x6'));var ejs=require(_0x74b2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74b2('0x8'));var squel=require(_0x74b2('0x9'));var crypto=require(_0x74b2('0xa'));var jsforce=require(_0x74b2('0xb'));var deskjs=require(_0x74b2('0xc'));var toCsv=require('to-csv');var querystring=require(_0x74b2('0xd'));var Papa=require(_0x74b2('0xe'));var Redis=require('ioredis');var authService=require(_0x74b2('0xf'));var qs=require(_0x74b2('0x10'));var as=require(_0x74b2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74b2('0x12'))(_0x74b2('0x13'));var utils=require(_0x74b2('0x14'));var config=require(_0x74b2('0x15'));var licenseUtil=require(_0x74b2('0x16'));var db=require(_0x74b2('0x17'))['db'];var integrations=require(_0x74b2('0x18'));function respondWithStatusCode(_0x32d388,_0x5aad1d){_0x5aad1d=_0x5aad1d||0xcc;return function(_0x160b94){if(_0x160b94){return _0x32d388['sendStatus'](_0x5aad1d);}return _0x32d388[_0x74b2('0x19')](_0x5aad1d)[_0x74b2('0x1a')]();};}function respondWithResult(_0x25fd67,_0x40200c){_0x40200c=_0x40200c||0xc8;return function(_0x2b2f4c){if(_0x2b2f4c){return _0x25fd67['status'](_0x40200c)['json'](_0x2b2f4c);}};}function respondWithFilteredResult(_0x4c4690,_0x4e2919){return function(_0x3d14e7){if(_0x3d14e7){var _0x5bf633=typeof _0x4e2919['offset']===_0x74b2('0x1b')&&typeof _0x4e2919['limit']==='undefined';var _0x4b7411=_0x3d14e7[_0x74b2('0x1c')];var _0x5e1364=_0x5bf633?0x0:_0x4e2919[_0x74b2('0x1d')];var _0x74590d=_0x5bf633?_0x3d14e7[_0x74b2('0x1c')]:_0x4e2919[_0x74b2('0x1d')]+_0x4e2919[_0x74b2('0x1e')];var _0x50e9d5;if(_0x74590d>=_0x4b7411){_0x74590d=_0x4b7411;_0x50e9d5=0xc8;}else{_0x50e9d5=0xce;}_0x4c4690['status'](_0x50e9d5);return _0x4c4690[_0x74b2('0x1f')](_0x74b2('0x20'),_0x5e1364+'-'+_0x74590d+'/'+_0x4b7411)[_0x74b2('0x21')](_0x3d14e7);}return null;};}function patchUpdates(_0x57ee13){return function(_0x49ffd4){try{jsonpatch[_0x74b2('0x22')](_0x49ffd4,_0x57ee13,!![]);}catch(_0x21e715){return BPromise['reject'](_0x21e715);}return _0x49ffd4[_0x74b2('0x23')]();};}function saveUpdates(_0x571d32,_0x559ed4){return function(_0x1a9f3b){if(_0x1a9f3b){return _0x1a9f3b['update'](_0x571d32)[_0x74b2('0x24')](function(_0x526424){return _0x526424;});}return null;};}function removeEntity(_0x15a4f7,_0x186950){return function(_0x45e875){if(_0x45e875){return _0x45e875[_0x74b2('0x25')]()[_0x74b2('0x24')](function(){_0x15a4f7[_0x74b2('0x19')](0xcc)[_0x74b2('0x1a')]();});}};}function handleEntityNotFound(_0xee253f,_0x2b3ad8){return function(_0x337144){if(!_0x337144){_0xee253f[_0x74b2('0x26')](0x194);}return _0x337144;};}function handleError(_0x53340b,_0x49b303){_0x49b303=_0x49b303||0x1f4;return function(_0x51e659){logger[_0x74b2('0x27')](_0x51e659['stack']);if(_0x51e659[_0x74b2('0x28')]){delete _0x51e659[_0x74b2('0x28')];}_0x53340b[_0x74b2('0x19')](_0x49b303)[_0x74b2('0x29')](_0x51e659);};}exports[_0x74b2('0x2a')]=function(_0xcd18c7,_0x521b99){var _0x21468f={},_0x1d6fa9={},_0x109218={'count':0x0,'rows':[]};var _0x4d2e84=_[_0x74b2('0x2b')](db['FreshsalesAccount']['rawAttributes'],function(_0x50ab27){return{'name':_0x50ab27['fieldName'],'type':_0x50ab27[_0x74b2('0x2c')][_0x74b2('0x2d')]};});_0x1d6fa9['model']=_[_0x74b2('0x2b')](_0x4d2e84,_0x74b2('0x28'));_0x1d6fa9[_0x74b2('0x2e')]=_[_0x74b2('0x2f')](_0xcd18c7['query']);_0x1d6fa9[_0x74b2('0x30')]=_[_0x74b2('0x31')](_0x1d6fa9[_0x74b2('0x32')],_0x1d6fa9[_0x74b2('0x2e')]);_0x21468f[_0x74b2('0x33')]=_[_0x74b2('0x31')](_0x1d6fa9[_0x74b2('0x32')],qs[_0x74b2('0x34')](_0xcd18c7['query'][_0x74b2('0x34')]));_0x21468f['attributes']=_0x21468f[_0x74b2('0x33')][_0x74b2('0x35')]?_0x21468f[_0x74b2('0x33')]:_0x1d6fa9[_0x74b2('0x32')];if(!_0xcd18c7['query'][_0x74b2('0x36')](_0x74b2('0x37'))){_0x21468f[_0x74b2('0x1e')]=qs[_0x74b2('0x1e')](_0xcd18c7[_0x74b2('0x2e')]['limit']);_0x21468f[_0x74b2('0x1d')]=qs['offset'](_0xcd18c7[_0x74b2('0x2e')][_0x74b2('0x1d')]);}_0x21468f[_0x74b2('0x38')]=qs[_0x74b2('0x39')](_0xcd18c7[_0x74b2('0x2e')][_0x74b2('0x39')]);_0x21468f['where']=qs['filters'](_['pick'](_0xcd18c7[_0x74b2('0x2e')],_0x1d6fa9[_0x74b2('0x30')]),_0x4d2e84);if(_0xcd18c7[_0x74b2('0x2e')][_0x74b2('0x3a')]){_0x21468f[_0x74b2('0x3b')]=_[_0x74b2('0x3c')](_0x21468f[_0x74b2('0x3b')],{'$or':_[_0x74b2('0x2b')](_0x4d2e84,function(_0x18e1e3){if(_0x18e1e3[_0x74b2('0x2c')]!=='VIRTUAL'){var _0x352b3d={};_0x352b3d[_0x18e1e3[_0x74b2('0x28')]]={'$like':'%'+_0xcd18c7['query'][_0x74b2('0x3a')]+'%'};return _0x352b3d;}})});}_0x21468f=_['merge']({},_0x21468f,_0xcd18c7[_0x74b2('0x3d')]);var _0x2b1494={'where':_0x21468f['where']};return db[_0x74b2('0x3e')][_0x74b2('0x1c')](_0x2b1494)[_0x74b2('0x24')](function(_0x2d08fe){_0x109218[_0x74b2('0x1c')]=_0x2d08fe;if(_0xcd18c7[_0x74b2('0x2e')][_0x74b2('0x3f')]){_0x21468f[_0x74b2('0x40')]=[{'all':!![]}];}return db[_0x74b2('0x3e')][_0x74b2('0x41')](_0x21468f);})[_0x74b2('0x24')](function(_0x463305){_0x109218[_0x74b2('0x42')]=_0x463305;return _0x109218;})['then'](respondWithFilteredResult(_0x521b99,_0x21468f))[_0x74b2('0x43')](handleError(_0x521b99,null));};exports['show']=function(_0x5a9ff3,_0x59b767){var _0x2a6f38={'raw':![],'where':{'id':_0x5a9ff3[_0x74b2('0x44')]['id']}},_0x21df99={};_0x21df99[_0x74b2('0x32')]=_['keys'](db[_0x74b2('0x3e')]['rawAttributes']);_0x21df99[_0x74b2('0x2e')]=_['keys'](_0x5a9ff3['query']);_0x21df99['filters']=_[_0x74b2('0x31')](_0x21df99[_0x74b2('0x32')],_0x21df99[_0x74b2('0x2e')]);_0x2a6f38[_0x74b2('0x33')]=_[_0x74b2('0x31')](_0x21df99['model'],qs['fields'](_0x5a9ff3['query'][_0x74b2('0x34')]));_0x2a6f38[_0x74b2('0x33')]=_0x2a6f38['attributes']['length']?_0x2a6f38[_0x74b2('0x33')]:_0x21df99[_0x74b2('0x32')];if(_0x5a9ff3[_0x74b2('0x2e')][_0x74b2('0x3f')]){_0x2a6f38[_0x74b2('0x40')]=[{'all':!![]}];}_0x2a6f38=_[_0x74b2('0x3c')]({},_0x2a6f38,_0x5a9ff3['options']);return db['FreshsalesAccount'][_0x74b2('0x45')](_0x2a6f38)[_0x74b2('0x24')](handleEntityNotFound(_0x59b767,null))[_0x74b2('0x24')](respondWithResult(_0x59b767,null))['catch'](handleError(_0x59b767,null));};exports['create']=function(_0x3bb835,_0x2d2193){return db[_0x74b2('0x3e')][_0x74b2('0x46')](_0x3bb835[_0x74b2('0x47')],{})[_0x74b2('0x24')](respondWithResult(_0x2d2193,0xc9))['catch'](handleError(_0x2d2193,null));};exports[_0x74b2('0x48')]=function(_0xeb1b9a,_0x289a18){if(_0xeb1b9a[_0x74b2('0x47')]['id']){delete _0xeb1b9a['body']['id'];}return db['FreshsalesAccount'][_0x74b2('0x45')]({'where':{'id':_0xeb1b9a[_0x74b2('0x44')]['id']}})[_0x74b2('0x24')](handleEntityNotFound(_0x289a18,null))[_0x74b2('0x24')](saveUpdates(_0xeb1b9a[_0x74b2('0x47')],null))[_0x74b2('0x24')](respondWithResult(_0x289a18,null))[_0x74b2('0x43')](handleError(_0x289a18,null));};exports['destroy']=function(_0x1e70da,_0x60157c){return db[_0x74b2('0x3e')][_0x74b2('0x45')]({'where':{'id':_0x1e70da['params']['id']}})[_0x74b2('0x24')](handleEntityNotFound(_0x60157c,null))[_0x74b2('0x24')](removeEntity(_0x60157c,null))[_0x74b2('0x43')](handleError(_0x60157c,null));};exports[_0x74b2('0x49')]=function(_0x4366b0,_0x41bcb8,_0x195938){var _0x4933c1={};var _0x458845={};var _0x43d383;var _0x58609a;return db[_0x74b2('0x3e')]['findOne']({'where':{'id':_0x4366b0[_0x74b2('0x44')]['id']}})[_0x74b2('0x24')](handleEntityNotFound(_0x41bcb8,null))[_0x74b2('0x24')](function(_0x45d81d){if(_0x45d81d){_0x43d383=_0x45d81d;_0x458845[_0x74b2('0x32')]=_['keys'](db[_0x74b2('0x4a')]['rawAttributes']);_0x458845[_0x74b2('0x2e')]=_[_0x74b2('0x2f')](_0x4366b0[_0x74b2('0x2e')]);_0x458845[_0x74b2('0x30')]=_[_0x74b2('0x31')](_0x458845[_0x74b2('0x32')],_0x458845['query']);_0x4933c1[_0x74b2('0x33')]=_['intersection'](_0x458845['model'],qs[_0x74b2('0x34')](_0x4366b0[_0x74b2('0x2e')]['fields']));_0x4933c1[_0x74b2('0x33')]=_0x4933c1[_0x74b2('0x33')][_0x74b2('0x35')]?_0x4933c1[_0x74b2('0x33')]:_0x458845[_0x74b2('0x32')];_0x4933c1[_0x74b2('0x38')]=qs[_0x74b2('0x39')](_0x4366b0['query'][_0x74b2('0x39')]);_0x4933c1[_0x74b2('0x3b')]=qs[_0x74b2('0x30')](_[_0x74b2('0x4b')](_0x4366b0[_0x74b2('0x2e')],_0x458845[_0x74b2('0x30')]));if(_0x4366b0[_0x74b2('0x2e')][_0x74b2('0x3a')]){_0x4933c1[_0x74b2('0x3b')]=_['merge'](_0x4933c1['where'],{'$or':_[_0x74b2('0x2b')](_0x4933c1[_0x74b2('0x33')],function(_0x551e48){var _0xcd9281={};_0xcd9281[_0x551e48]={'$like':'%'+_0x4366b0[_0x74b2('0x2e')][_0x74b2('0x3a')]+'%'};return _0xcd9281;})});}_0x4933c1=_[_0x74b2('0x3c')]({},_0x4933c1,_0x4366b0[_0x74b2('0x3d')]);return _0x43d383[_0x74b2('0x49')](_0x4933c1);}})[_0x74b2('0x24')](function(_0xe854b6){if(_0xe854b6){_0x58609a=_0xe854b6[_0x74b2('0x35')];if(!_0x4366b0[_0x74b2('0x2e')]['hasOwnProperty']('nolimit')){_0x4933c1[_0x74b2('0x1e')]=qs[_0x74b2('0x1e')](_0x4366b0[_0x74b2('0x2e')][_0x74b2('0x1e')]);_0x4933c1['offset']=qs[_0x74b2('0x1d')](_0x4366b0[_0x74b2('0x2e')][_0x74b2('0x1d')]);}return _0x43d383[_0x74b2('0x49')](_0x4933c1);}})[_0x74b2('0x24')](function(_0xb1f178){if(_0xb1f178){return _0xb1f178?{'count':_0x58609a,'rows':_0xb1f178}:null;}})['then'](respondWithResult(_0x41bcb8,null))[_0x74b2('0x43')](handleError(_0x41bcb8,null));};exports['addConfiguration']=function(_0x4f1a3b,_0x441dde,_0x315426){if(_0x4f1a3b[_0x74b2('0x47')]['id']){delete _0x4f1a3b[_0x74b2('0x47')]['id'];}return db[_0x74b2('0x3e')][_0x74b2('0x4c')]({'where':{'id':_0x4f1a3b[_0x74b2('0x44')]['id']}})['then'](handleEntityNotFound(_0x441dde,null))[_0x74b2('0x24')](function(_0x381901){if(_0x381901){_0x4f1a3b[_0x74b2('0x47')]['AccountId']=_0x381901['id'];_0x4f1a3b[_0x74b2('0x47')][_0x74b2('0x4d')]=integrations[_0x74b2('0x4e')](_0x4f1a3b[_0x74b2('0x47')][_0x74b2('0x4f')],_0x4f1a3b[_0x74b2('0x47')]['type']);_0x4f1a3b[_0x74b2('0x47')]['Descriptions']=integrations[_0x74b2('0x50')](_0x4f1a3b[_0x74b2('0x47')]['channel'],_0x4f1a3b[_0x74b2('0x47')][_0x74b2('0x2c')]);return db['FreshsalesConfiguration'][_0x74b2('0x46')](_0x4f1a3b['body'],{'include':[{'model':db['FreshsalesField'],'as':_0x74b2('0x4d')},{'model':db[_0x74b2('0x51')],'as':'Descriptions'}]});}return null;})[_0x74b2('0x24')](respondWithResult(_0x441dde,null))[_0x74b2('0x43')](handleError(_0x441dde,null));};exports['getFields']=function(_0x4f396f,_0x114765,_0x4067a3){var _0x3c2a4a='';var _0x6a4605='';return db[_0x74b2('0x3e')][_0x74b2('0x4c')]({'where':{'id':_0x4f396f['params']['id']},'attributes':['id',_0x74b2('0x52'),_0x74b2('0x53'),_0x74b2('0x54')]})[_0x74b2('0x24')](handleEntityNotFound(_0x114765,null))['then'](function(_0x3cc1d4){if(_0x3cc1d4){_0x6a4605=_0x3cc1d4['username'];_0x3c2a4a=_0x3cc1d4[_0x74b2('0x53')];var _0x3782d4=_0x3cc1d4[_0x74b2('0x53')][_0x74b2('0x55')](-0x1);if(_0x3782d4==='/'){_0x3c2a4a=_0x3c2a4a[_0x74b2('0x56')](0x0,_0x3c2a4a[_0x74b2('0x57')](_0x3782d4));}return rp({'method':_0x74b2('0x58'),'uri':util[_0x74b2('0x59')](_0x74b2('0x5a'),_0x3c2a4a,_0x74b2('0x5b')),'headers':{'Authorization':_0x74b2('0x5c')+_0x3cc1d4[_0x74b2('0x54')]},'json':!![]});}})['then'](function(_0x4a12d8){if(_0x4a12d8){var _0x6c209d=_0x4a12d8['users'];var _0x23f25d=![];var _0x1b4dd5=null;for(_0x1b4dd5=0x0;_0x1b4dd5<_0x6c209d['length'];_0x1b4dd5++){if(_0x6c209d[_0x1b4dd5]['email']===_0x6a4605){_0x23f25d=!![];}}if(_0x23f25d){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x74b2('0x5d')});}}})['then'](respondWithResult(_0x114765,null))[_0x74b2('0x43')](function(_0x22492f){var _0x383a63=_0x4f396f[_0x74b2('0x2e')][_0x74b2('0x5e')]?0x1f4:_0x22492f[_0x74b2('0x5f')]||0x1f4;logger[_0x74b2('0x27')](_0x74b2('0x60'),_0x74b2('0x61'),_0x383a63,JSON[_0x74b2('0x62')](_0x22492f));delete _0x22492f['name'];if(_0x383a63===0x191){_0x383a63=0x190;}_0x114765[_0x74b2('0x19')](_0x383a63)[_0x74b2('0x29')](_0x4f396f[_0x74b2('0x2e')][_0x74b2('0x5e')]?{'message':_0x74b2('0x63'),'statusCode':_0x22492f[_0x74b2('0x5f')]}:_0x22492f);});}; \ No newline at end of file +var _0x8ec1=['include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','apiKey','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x4adbd0,_0x42c72){var _0x439f5d=function(_0x35e98c){while(--_0x35e98c){_0x4adbd0['push'](_0x4adbd0['shift']());}};_0x439f5d(++_0x42c72);}(_0x8ec1,0x100));var _0x18ec=function(_0x1e1fe9,_0x216dd9){_0x1e1fe9=_0x1e1fe9-0x0;var _0x4eeb06=_0x8ec1[_0x1e1fe9];return _0x4eeb06;};'use strict';var emlformat=require(_0x18ec('0x0'));var rimraf=require(_0x18ec('0x1'));var zipdir=require(_0x18ec('0x2'));var jsonpatch=require(_0x18ec('0x3'));var rp=require(_0x18ec('0x4'));var moment=require(_0x18ec('0x5'));var BPromise=require(_0x18ec('0x6'));var Mustache=require(_0x18ec('0x7'));var util=require(_0x18ec('0x8'));var path=require('path');var sox=require(_0x18ec('0x9'));var csv=require(_0x18ec('0xa'));var ejs=require(_0x18ec('0xb'));var fs=require('fs');var fs_extra=require(_0x18ec('0xc'));var _=require(_0x18ec('0xd'));var squel=require(_0x18ec('0xe'));var crypto=require(_0x18ec('0xf'));var jsforce=require(_0x18ec('0x10'));var deskjs=require(_0x18ec('0x11'));var toCsv=require(_0x18ec('0xa'));var querystring=require(_0x18ec('0x12'));var Papa=require(_0x18ec('0x13'));var Redis=require(_0x18ec('0x14'));var authService=require(_0x18ec('0x15'));var qs=require(_0x18ec('0x16'));var as=require(_0x18ec('0x17'));var hardwareService=require(_0x18ec('0x18'));var logger=require(_0x18ec('0x19'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x18ec('0x1a'));var db=require(_0x18ec('0x1b'))['db'];var integrations=require(_0x18ec('0x1c'));function respondWithStatusCode(_0x10218e,_0x161735){_0x161735=_0x161735||0xcc;return function(_0x4e92c1){if(_0x4e92c1){return _0x10218e[_0x18ec('0x1d')](_0x161735);}return _0x10218e[_0x18ec('0x1e')](_0x161735)[_0x18ec('0x1f')]();};}function respondWithResult(_0x1e3d0c,_0x51747b){_0x51747b=_0x51747b||0xc8;return function(_0x2dec9c){if(_0x2dec9c){return _0x1e3d0c[_0x18ec('0x1e')](_0x51747b)[_0x18ec('0x20')](_0x2dec9c);}};}function respondWithFilteredResult(_0x134197,_0x5e7380){return function(_0x200d16){if(_0x200d16){var _0x1e2462=typeof _0x5e7380['offset']==='undefined'&&typeof _0x5e7380['limit']==='undefined';var _0x167bc3=_0x200d16[_0x18ec('0x21')];var _0x367961=_0x1e2462?0x0:_0x5e7380[_0x18ec('0x22')];var _0x32dd8d=_0x1e2462?_0x200d16['count']:_0x5e7380[_0x18ec('0x22')]+_0x5e7380[_0x18ec('0x23')];var _0x3b5177;if(_0x32dd8d>=_0x167bc3){_0x32dd8d=_0x167bc3;_0x3b5177=0xc8;}else{_0x3b5177=0xce;}_0x134197[_0x18ec('0x1e')](_0x3b5177);return _0x134197[_0x18ec('0x24')]('Content-Range',_0x367961+'-'+_0x32dd8d+'/'+_0x167bc3)[_0x18ec('0x20')](_0x200d16);}return null;};}function patchUpdates(_0x434f7f){return function(_0x131cd7){try{jsonpatch[_0x18ec('0x25')](_0x131cd7,_0x434f7f,!![]);}catch(_0x5983b2){return BPromise[_0x18ec('0x26')](_0x5983b2);}return _0x131cd7[_0x18ec('0x27')]();};}function saveUpdates(_0x99d6a0,_0x1a3e58){return function(_0x20ced1){if(_0x20ced1){return _0x20ced1[_0x18ec('0x28')](_0x99d6a0)[_0x18ec('0x29')](function(_0x4c547b){return _0x4c547b;});}return null;};}function removeEntity(_0x563dc6,_0x4e3a93){return function(_0x53d1ab){if(_0x53d1ab){return _0x53d1ab[_0x18ec('0x2a')]()[_0x18ec('0x29')](function(){_0x563dc6[_0x18ec('0x1e')](0xcc)[_0x18ec('0x1f')]();});}};}function handleEntityNotFound(_0x31fb95,_0x42bad5){return function(_0x456213){if(!_0x456213){_0x31fb95[_0x18ec('0x1d')](0x194);}return _0x456213;};}function handleError(_0x555f5e,_0x29ba62){_0x29ba62=_0x29ba62||0x1f4;return function(_0x2c0cf8){logger[_0x18ec('0x2b')](_0x2c0cf8['stack']);if(_0x2c0cf8['name']){delete _0x2c0cf8[_0x18ec('0x2c')];}_0x555f5e[_0x18ec('0x1e')](_0x29ba62)[_0x18ec('0x2d')](_0x2c0cf8);};}exports[_0x18ec('0x2e')]=function(_0x390b2a,_0x3bc953){var _0x283856={},_0x20c776={},_0xb7b41f={'count':0x0,'rows':[]};var _0x2637cb=_[_0x18ec('0x2f')](db[_0x18ec('0x30')][_0x18ec('0x31')],function(_0x1ccdef){return{'name':_0x1ccdef[_0x18ec('0x32')],'type':_0x1ccdef[_0x18ec('0x33')][_0x18ec('0x34')]};});_0x20c776[_0x18ec('0x35')]=_['map'](_0x2637cb,_0x18ec('0x2c'));_0x20c776[_0x18ec('0x36')]=_[_0x18ec('0x37')](_0x390b2a['query']);_0x20c776[_0x18ec('0x38')]=_[_0x18ec('0x39')](_0x20c776['model'],_0x20c776[_0x18ec('0x36')]);_0x283856[_0x18ec('0x3a')]=_[_0x18ec('0x39')](_0x20c776[_0x18ec('0x35')],qs['fields'](_0x390b2a[_0x18ec('0x36')][_0x18ec('0x3b')]));_0x283856[_0x18ec('0x3a')]=_0x283856['attributes'][_0x18ec('0x3c')]?_0x283856[_0x18ec('0x3a')]:_0x20c776[_0x18ec('0x35')];if(!_0x390b2a[_0x18ec('0x36')][_0x18ec('0x3d')](_0x18ec('0x3e'))){_0x283856[_0x18ec('0x23')]=qs[_0x18ec('0x23')](_0x390b2a[_0x18ec('0x36')][_0x18ec('0x23')]);_0x283856['offset']=qs[_0x18ec('0x22')](_0x390b2a[_0x18ec('0x36')][_0x18ec('0x22')]);}_0x283856[_0x18ec('0x3f')]=qs['sort'](_0x390b2a[_0x18ec('0x36')]['sort']);_0x283856[_0x18ec('0x40')]=qs[_0x18ec('0x38')](_[_0x18ec('0x41')](_0x390b2a[_0x18ec('0x36')],_0x20c776[_0x18ec('0x38')]),_0x2637cb);if(_0x390b2a[_0x18ec('0x36')][_0x18ec('0x42')]){_0x283856['where']=_[_0x18ec('0x43')](_0x283856['where'],{'$or':_[_0x18ec('0x2f')](_0x2637cb,function(_0x272e9d){if(_0x272e9d['type']!==_0x18ec('0x44')){var _0xf34d60={};_0xf34d60[_0x272e9d[_0x18ec('0x2c')]]={'$like':'%'+_0x390b2a[_0x18ec('0x36')][_0x18ec('0x42')]+'%'};return _0xf34d60;}})});}_0x283856=_[_0x18ec('0x43')]({},_0x283856,_0x390b2a[_0x18ec('0x45')]);var _0x2326d6={'where':_0x283856[_0x18ec('0x40')]};return db['FreshsalesAccount']['count'](_0x2326d6)[_0x18ec('0x29')](function(_0x917fa2){_0xb7b41f[_0x18ec('0x21')]=_0x917fa2;if(_0x390b2a[_0x18ec('0x36')][_0x18ec('0x46')]){_0x283856[_0x18ec('0x47')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x18ec('0x48')](_0x283856);})[_0x18ec('0x29')](function(_0x39ec42){_0xb7b41f[_0x18ec('0x49')]=_0x39ec42;return _0xb7b41f;})[_0x18ec('0x29')](respondWithFilteredResult(_0x3bc953,_0x283856))[_0x18ec('0x4a')](handleError(_0x3bc953,null));};exports[_0x18ec('0x4b')]=function(_0x5d3252,_0x10c6d4){var _0x5fcba7={'raw':![],'where':{'id':_0x5d3252[_0x18ec('0x4c')]['id']}},_0x6f220e={};_0x6f220e[_0x18ec('0x35')]=_[_0x18ec('0x37')](db[_0x18ec('0x30')][_0x18ec('0x31')]);_0x6f220e[_0x18ec('0x36')]=_['keys'](_0x5d3252[_0x18ec('0x36')]);_0x6f220e['filters']=_[_0x18ec('0x39')](_0x6f220e[_0x18ec('0x35')],_0x6f220e['query']);_0x5fcba7['attributes']=_[_0x18ec('0x39')](_0x6f220e['model'],qs[_0x18ec('0x3b')](_0x5d3252['query']['fields']));_0x5fcba7[_0x18ec('0x3a')]=_0x5fcba7[_0x18ec('0x3a')][_0x18ec('0x3c')]?_0x5fcba7[_0x18ec('0x3a')]:_0x6f220e['model'];if(_0x5d3252['query'][_0x18ec('0x46')]){_0x5fcba7['include']=[{'all':!![]}];}_0x5fcba7=_[_0x18ec('0x43')]({},_0x5fcba7,_0x5d3252['options']);return db[_0x18ec('0x30')][_0x18ec('0x4d')](_0x5fcba7)[_0x18ec('0x29')](handleEntityNotFound(_0x10c6d4,null))[_0x18ec('0x29')](respondWithResult(_0x10c6d4,null))['catch'](handleError(_0x10c6d4,null));};exports[_0x18ec('0x4e')]=function(_0x694853,_0x513052){return db[_0x18ec('0x30')][_0x18ec('0x4e')](_0x694853[_0x18ec('0x4f')],{})[_0x18ec('0x29')](respondWithResult(_0x513052,0xc9))[_0x18ec('0x4a')](handleError(_0x513052,null));};exports[_0x18ec('0x28')]=function(_0x2082e4,_0x1970d0){if(_0x2082e4[_0x18ec('0x4f')]['id']){delete _0x2082e4[_0x18ec('0x4f')]['id'];}return db[_0x18ec('0x30')][_0x18ec('0x4d')]({'where':{'id':_0x2082e4[_0x18ec('0x4c')]['id']}})[_0x18ec('0x29')](handleEntityNotFound(_0x1970d0,null))[_0x18ec('0x29')](saveUpdates(_0x2082e4['body'],null))['then'](respondWithResult(_0x1970d0,null))[_0x18ec('0x4a')](handleError(_0x1970d0,null));};exports[_0x18ec('0x2a')]=function(_0x11643c,_0x282405){return db[_0x18ec('0x30')][_0x18ec('0x4d')]({'where':{'id':_0x11643c[_0x18ec('0x4c')]['id']}})[_0x18ec('0x29')](handleEntityNotFound(_0x282405,null))[_0x18ec('0x29')](removeEntity(_0x282405,null))[_0x18ec('0x4a')](handleError(_0x282405,null));};exports[_0x18ec('0x50')]=function(_0x5a7408,_0x5278f7,_0x45ad61){var _0x9e25b4={};var _0x5856c4={};var _0x38c6e2;var _0x17145b;return db[_0x18ec('0x30')][_0x18ec('0x51')]({'where':{'id':_0x5a7408[_0x18ec('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5278f7,null))[_0x18ec('0x29')](function(_0x30b419){if(_0x30b419){_0x38c6e2=_0x30b419;_0x5856c4[_0x18ec('0x35')]=_['keys'](db[_0x18ec('0x52')]['rawAttributes']);_0x5856c4[_0x18ec('0x36')]=_[_0x18ec('0x37')](_0x5a7408[_0x18ec('0x36')]);_0x5856c4[_0x18ec('0x38')]=_[_0x18ec('0x39')](_0x5856c4[_0x18ec('0x35')],_0x5856c4[_0x18ec('0x36')]);_0x9e25b4[_0x18ec('0x3a')]=_[_0x18ec('0x39')](_0x5856c4[_0x18ec('0x35')],qs['fields'](_0x5a7408[_0x18ec('0x36')]['fields']));_0x9e25b4[_0x18ec('0x3a')]=_0x9e25b4[_0x18ec('0x3a')][_0x18ec('0x3c')]?_0x9e25b4[_0x18ec('0x3a')]:_0x5856c4[_0x18ec('0x35')];_0x9e25b4[_0x18ec('0x3f')]=qs[_0x18ec('0x53')](_0x5a7408[_0x18ec('0x36')][_0x18ec('0x53')]);_0x9e25b4[_0x18ec('0x40')]=qs[_0x18ec('0x38')](_[_0x18ec('0x41')](_0x5a7408[_0x18ec('0x36')],_0x5856c4[_0x18ec('0x38')]));if(_0x5a7408[_0x18ec('0x36')][_0x18ec('0x42')]){_0x9e25b4['where']=_[_0x18ec('0x43')](_0x9e25b4['where'],{'$or':_[_0x18ec('0x2f')](_0x9e25b4[_0x18ec('0x3a')],function(_0x559fc8){var _0x19ec3c={};_0x19ec3c[_0x559fc8]={'$like':'%'+_0x5a7408[_0x18ec('0x36')][_0x18ec('0x42')]+'%'};return _0x19ec3c;})});}_0x9e25b4=_[_0x18ec('0x43')]({},_0x9e25b4,_0x5a7408['options']);return _0x38c6e2[_0x18ec('0x50')](_0x9e25b4);}})['then'](function(_0x2cf15c){if(_0x2cf15c){_0x17145b=_0x2cf15c[_0x18ec('0x3c')];if(!_0x5a7408['query']['hasOwnProperty'](_0x18ec('0x3e'))){_0x9e25b4[_0x18ec('0x23')]=qs[_0x18ec('0x23')](_0x5a7408[_0x18ec('0x36')][_0x18ec('0x23')]);_0x9e25b4[_0x18ec('0x22')]=qs['offset'](_0x5a7408['query'][_0x18ec('0x22')]);}return _0x38c6e2[_0x18ec('0x50')](_0x9e25b4);}})['then'](function(_0x1cc040){if(_0x1cc040){return _0x1cc040?{'count':_0x17145b,'rows':_0x1cc040}:null;}})[_0x18ec('0x29')](respondWithResult(_0x5278f7,null))['catch'](handleError(_0x5278f7,null));};exports[_0x18ec('0x54')]=function(_0x1111b4,_0x2aac4e,_0x30b6b9){if(_0x1111b4[_0x18ec('0x4f')]['id']){delete _0x1111b4[_0x18ec('0x4f')]['id'];}return db[_0x18ec('0x30')][_0x18ec('0x51')]({'where':{'id':_0x1111b4['params']['id']}})[_0x18ec('0x29')](handleEntityNotFound(_0x2aac4e,null))[_0x18ec('0x29')](function(_0x481392){if(_0x481392){_0x1111b4[_0x18ec('0x4f')][_0x18ec('0x55')]=_0x481392['id'];_0x1111b4[_0x18ec('0x4f')][_0x18ec('0x56')]=integrations[_0x18ec('0x57')](_0x1111b4['body'][_0x18ec('0x58')],_0x1111b4[_0x18ec('0x4f')][_0x18ec('0x33')]);_0x1111b4[_0x18ec('0x4f')][_0x18ec('0x59')]=integrations[_0x18ec('0x5a')](_0x1111b4['body'][_0x18ec('0x58')],_0x1111b4['body'][_0x18ec('0x33')]);return db['FreshsalesConfiguration'][_0x18ec('0x4e')](_0x1111b4[_0x18ec('0x4f')],{'include':[{'model':db[_0x18ec('0x5b')],'as':_0x18ec('0x56')},{'model':db[_0x18ec('0x5b')],'as':_0x18ec('0x59')}]});}return null;})[_0x18ec('0x29')](respondWithResult(_0x2aac4e,null))[_0x18ec('0x4a')](handleError(_0x2aac4e,null));};exports[_0x18ec('0x5c')]=function(_0x3d805f,_0x5eafa4,_0x332c0){var _0x10e24d='';var _0xd92bbf='';return db[_0x18ec('0x30')]['findOne']({'where':{'id':_0x3d805f['params']['id']},'attributes':['id',_0x18ec('0x5d'),'remoteUri','apiKey']})[_0x18ec('0x29')](handleEntityNotFound(_0x5eafa4,null))['then'](function(_0x31c427){if(_0x31c427){_0xd92bbf=_0x31c427[_0x18ec('0x5d')];_0x10e24d=_0x31c427[_0x18ec('0x5e')];var _0x53f234=_0x31c427[_0x18ec('0x5e')][_0x18ec('0x5f')](-0x1);if(_0x53f234==='/'){_0x10e24d=_0x10e24d['substring'](0x0,_0x10e24d[_0x18ec('0x60')](_0x53f234));}return rp({'method':_0x18ec('0x61'),'uri':util[_0x18ec('0x62')](_0x18ec('0x63'),_0x10e24d,_0x18ec('0x64')),'headers':{'Authorization':'Token\x20token='+_0x31c427[_0x18ec('0x65')]},'json':!![]});}})[_0x18ec('0x29')](function(_0xafe096){if(_0xafe096){var _0x1b2602=_0xafe096['users'];var _0x1753c9=![];var _0x3c40d4=null;for(_0x3c40d4=0x0;_0x3c40d4<_0x1b2602['length'];_0x3c40d4++){if(_0x1b2602[_0x3c40d4][_0x18ec('0x66')]===_0xd92bbf){_0x1753c9=!![];}}if(_0x1753c9){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x18ec('0x67')});}}})['then'](respondWithResult(_0x5eafa4,null))[_0x18ec('0x4a')](function(_0x326d74){var _0xe70875=_0x3d805f[_0x18ec('0x36')][_0x18ec('0x68')]?0x1f4:_0x326d74[_0x18ec('0x69')]||0x1f4;logger[_0x18ec('0x2b')](_0x18ec('0x6a'),_0x18ec('0x5c'),_0xe70875,JSON[_0x18ec('0x6b')](_0x326d74));delete _0x326d74[_0x18ec('0x2c')];if(_0xe70875===0x191){_0xe70875=0x190;}_0x5eafa4[_0x18ec('0x1e')](_0xe70875)[_0x18ec('0x2d')](_0x3d805f[_0x18ec('0x36')][_0x18ec('0x68')]?{'message':_0x18ec('0x6c'),'statusCode':_0x326d74[_0x18ec('0x69')]}:_0x326d74);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 7b61874..6e83055 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 _0x0295=['exports','lodash','api','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x0295,0x1f0));var _0x5029=function(_0x411d8c,_0x22d9ff){_0x411d8c=_0x411d8c-0x0;var _0x34f6e5=_0x0295[_0x411d8c];return _0x34f6e5;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));var integrations=require(_0x5029('0x7'));module[_0x5029('0x8')]=function(_0x215955,_0x5b3cd){return _0x215955['define']('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01d9=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x391fa1,_0x24adc0){var _0x2524c2=function(_0xf7c25d){while(--_0xf7c25d){_0x391fa1['push'](_0x391fa1['shift']());}};_0x2524c2(++_0x24adc0);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));var integrations=require(_0x901d('0xa'));module['exports']=function(_0x1e5d7d,_0x6c9ac8){return _0x1e5d7d[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index f6ac9c7..2a6fd73 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 _0x6343=['attributes','map','GetFreshsalesAccount','stringify','ShowFreshsalesAccount','find','where','debug','moment','bluebird','../../config/logger','rpc','jayson/promise','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FreshsalesAccount','findAll','options','raw','limit','include','model'];(function(_0x43dc81,_0x1aa19f){var _0x4c81de=function(_0x244e40){while(--_0x244e40){_0x43dc81['push'](_0x43dc81['shift']());}};_0x4c81de(++_0x1aa19f);}(_0x6343,0x168));var _0x3634=function(_0x3e12a2,_0x16adb7){_0x3e12a2=_0x3e12a2-0x0;var _0x169be1=_0x6343[_0x3e12a2];return _0x169be1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3634('0x0'));var BPromise=require(_0x3634('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3634('0x2'))(_0x3634('0x3'));var config=require('../../config/environment');var jayson=require(_0x3634('0x4'));var client=jayson[_0x3634('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x302828,_0xd40513,_0x4e6d71){return new BPromise(function(_0x5affba,_0x19170a){return client[_0x3634('0x6')](_0x302828,_0x4e6d71)[_0x3634('0x7')](function(_0x3c813b){logger[_0x3634('0x8')](_0x3634('0x9'),_0xd40513,'request\x20sent');logger['debug'](_0x3634('0xa'),_0xd40513,_0x3634('0xb'),JSON['stringify'](_0x3c813b));if(_0x3c813b[_0x3634('0xc')]){if(_0x3c813b[_0x3634('0xc')][_0x3634('0xd')]===0x1f4){logger[_0x3634('0xc')](_0x3634('0x9'),_0xd40513,_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);return _0x19170a(_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);}logger[_0x3634('0xc')](_0x3634('0x9'),_0xd40513,_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);return _0x5affba(_0x3c813b[_0x3634('0xc')]['message']);}else{logger[_0x3634('0x8')]('FreshsalesAccount,\x20%s,\x20%s',_0xd40513,_0x3634('0xb'));_0x5affba(_0x3c813b[_0x3634('0xf')][_0x3634('0xe')]);}})[_0x3634('0x10')](function(_0x91061e){logger['error'](_0x3634('0x9'),_0xd40513,_0x91061e);_0x19170a(_0x91061e);});});}exports['GetFreshsalesAccount']=function(_0x50350d){var _0x2aaac7=this;return new Promise(function(_0x4b2115,_0x2fac8b){return db[_0x3634('0x11')][_0x3634('0x12')]({'raw':_0x50350d['options']?_0x50350d[_0x3634('0x13')][_0x3634('0x14')]===undefined?!![]:![]:!![],'where':_0x50350d['options']?_0x50350d[_0x3634('0x13')]['where']||null:null,'attributes':_0x50350d[_0x3634('0x13')]?_0x50350d[_0x3634('0x13')]['attributes']||null:null,'limit':_0x50350d[_0x3634('0x13')]?_0x50350d[_0x3634('0x13')][_0x3634('0x15')]||null:null,'include':_0x50350d['options']?_0x50350d[_0x3634('0x13')][_0x3634('0x16')]?_['map'](_0x50350d[_0x3634('0x13')]['include'],function(_0x5e9188){return{'model':db[_0x5e9188[_0x3634('0x17')]],'as':_0x5e9188['as'],'attributes':_0x5e9188[_0x3634('0x18')],'include':_0x5e9188['include']?_[_0x3634('0x19')](_0x5e9188[_0x3634('0x16')],function(_0x17db44){return{'model':db[_0x17db44[_0x3634('0x17')]],'as':_0x17db44['as'],'attributes':_0x17db44[_0x3634('0x18')],'include':_0x17db44[_0x3634('0x16')]?_[_0x3634('0x19')](_0x17db44[_0x3634('0x16')],function(_0x22f1f1){return{'model':db[_0x22f1f1['model']],'as':_0x22f1f1['as'],'attributes':_0x22f1f1[_0x3634('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58841d){logger['info'](_0x3634('0x1a'),_0x50350d);logger['debug'](_0x3634('0x1a'),_0x50350d,JSON[_0x3634('0x1b')](_0x58841d));_0x4b2115(_0x58841d);})['catch'](function(_0x55a77f){logger[_0x3634('0xc')]('GetFreshsalesAccount',_0x55a77f[_0x3634('0xe')],_0x50350d);_0x2fac8b(_0x2aaac7['error'](0x1f4,_0x55a77f[_0x3634('0xe')]));});});};exports[_0x3634('0x1c')]=function(_0x1d88f7){var _0x17a0fd=this;return new Promise(function(_0x1f46d9,_0x20b062){return db[_0x3634('0x11')][_0x3634('0x1d')]({'raw':_0x1d88f7['options']?_0x1d88f7['options']['raw']===undefined?!![]:![]:!![],'where':_0x1d88f7[_0x3634('0x13')]?_0x1d88f7['options'][_0x3634('0x1e')]||null:null,'attributes':_0x1d88f7[_0x3634('0x13')]?_0x1d88f7[_0x3634('0x13')][_0x3634('0x18')]||null:null,'include':_0x1d88f7[_0x3634('0x13')]?_0x1d88f7[_0x3634('0x13')]['include']?_[_0x3634('0x19')](_0x1d88f7[_0x3634('0x13')][_0x3634('0x16')],function(_0x1b686c){return{'model':db[_0x1b686c[_0x3634('0x17')]],'as':_0x1b686c['as'],'attributes':_0x1b686c[_0x3634('0x18')],'include':_0x1b686c[_0x3634('0x16')]?_[_0x3634('0x19')](_0x1b686c[_0x3634('0x16')],function(_0x598c7e){return{'model':db[_0x598c7e[_0x3634('0x17')]],'as':_0x598c7e['as'],'attributes':_0x598c7e[_0x3634('0x18')],'include':_0x598c7e[_0x3634('0x16')]?_[_0x3634('0x19')](_0x598c7e['include'],function(_0x149840){return{'model':db[_0x149840[_0x3634('0x17')]],'as':_0x149840['as'],'attributes':_0x149840[_0x3634('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5efd00){logger['info'](_0x3634('0x1c'),_0x1d88f7);logger[_0x3634('0x1f')]('ShowFreshsalesAccount',_0x1d88f7,JSON[_0x3634('0x1b')](_0x5efd00));_0x1f46d9(_0x5efd00);})[_0x3634('0x10')](function(_0x105507){logger[_0x3634('0xc')](_0x3634('0x1c'),_0x105507[_0x3634('0xe')],_0x1d88f7);_0x20b062(_0x17a0fd[_0x3634('0xc')](0x1f4,_0x105507['message']));});});}; \ No newline at end of file +var _0x323f=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFreshsalesAccount','FreshsalesAccount','options','where','attributes','include','map','model','catch','ShowFreshsalesAccount','find','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x3a3e95,_0x3a8fcc){var _0x436148=function(_0x5ffb7d){while(--_0x5ffb7d){_0x3a3e95['push'](_0x3a3e95['shift']());}};_0x436148(++_0x3a8fcc);}(_0x323f,0x1ee));var _0xf323=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x323f[_0x311c35];return _0x5cc50c;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var moment=require('moment');var BPromise=require(_0xf323('0x1'));var rs=require(_0xf323('0x2'));var fs=require('fs');var Redis=require(_0xf323('0x3'));var db=require(_0xf323('0x4'))['db'];var utils=require(_0xf323('0x5'));var logger=require(_0xf323('0x6'))(_0xf323('0x7'));var config=require(_0xf323('0x8'));var jayson=require(_0xf323('0x9'));var client=jayson[_0xf323('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb9a667,_0x444cba,_0x1af70d){return new BPromise(function(_0x2c8271,_0x8abeac){return client[_0xf323('0xb')](_0xb9a667,_0x1af70d)[_0xf323('0xc')](function(_0x2b24a2){logger[_0xf323('0xd')](_0xf323('0xe'),_0x444cba,_0xf323('0xf'));logger[_0xf323('0x10')](_0xf323('0x11'),_0x444cba,_0xf323('0xf'),JSON[_0xf323('0x12')](_0x2b24a2));if(_0x2b24a2[_0xf323('0x13')]){if(_0x2b24a2[_0xf323('0x13')]['code']===0x1f4){logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0x2b24a2[_0xf323('0x13')]['message']);return _0x8abeac(_0x2b24a2[_0xf323('0x13')][_0xf323('0x14')]);}logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0x2b24a2[_0xf323('0x13')][_0xf323('0x14')]);return _0x2c8271(_0x2b24a2['error']['message']);}else{logger[_0xf323('0xd')](_0xf323('0xe'),_0x444cba,_0xf323('0xf'));_0x2c8271(_0x2b24a2[_0xf323('0x15')][_0xf323('0x14')]);}})['catch'](function(_0xd6c25){logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0xd6c25);_0x8abeac(_0xd6c25);});});}exports[_0xf323('0x16')]=function(_0x49b115){var _0x2db977=this;return new Promise(function(_0x272aec,_0x1a459d){return db[_0xf323('0x17')]['findAll']({'raw':_0x49b115[_0xf323('0x18')]?_0x49b115[_0xf323('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x49b115[_0xf323('0x18')]?_0x49b115[_0xf323('0x18')][_0xf323('0x19')]||null:null,'attributes':_0x49b115[_0xf323('0x18')]?_0x49b115['options'][_0xf323('0x1a')]||null:null,'limit':_0x49b115[_0xf323('0x18')]?_0x49b115[_0xf323('0x18')]['limit']||null:null,'include':_0x49b115[_0xf323('0x18')]?_0x49b115[_0xf323('0x18')][_0xf323('0x1b')]?_[_0xf323('0x1c')](_0x49b115[_0xf323('0x18')][_0xf323('0x1b')],function(_0x189b23){return{'model':db[_0x189b23[_0xf323('0x1d')]],'as':_0x189b23['as'],'attributes':_0x189b23[_0xf323('0x1a')],'include':_0x189b23['include']?_[_0xf323('0x1c')](_0x189b23[_0xf323('0x1b')],function(_0x33dc52){return{'model':db[_0x33dc52[_0xf323('0x1d')]],'as':_0x33dc52['as'],'attributes':_0x33dc52[_0xf323('0x1a')],'include':_0x33dc52[_0xf323('0x1b')]?_['map'](_0x33dc52[_0xf323('0x1b')],function(_0x56ce33){return{'model':db[_0x56ce33[_0xf323('0x1d')]],'as':_0x56ce33['as'],'attributes':_0x56ce33[_0xf323('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46663b){logger[_0xf323('0xd')](_0xf323('0x16'),_0x49b115);logger[_0xf323('0x10')](_0xf323('0x16'),_0x49b115,JSON['stringify'](_0x46663b));_0x272aec(_0x46663b);})[_0xf323('0x1e')](function(_0x34b536){logger[_0xf323('0x13')](_0xf323('0x16'),_0x34b536[_0xf323('0x14')],_0x49b115);_0x1a459d(_0x2db977[_0xf323('0x13')](0x1f4,_0x34b536[_0xf323('0x14')]));});});};exports[_0xf323('0x1f')]=function(_0x139adc){var _0x52300b=this;return new Promise(function(_0x3f23cf,_0x15187c){return db[_0xf323('0x17')][_0xf323('0x20')]({'raw':_0x139adc[_0xf323('0x18')]?_0x139adc['options'][_0xf323('0x21')]===undefined?!![]:![]:!![],'where':_0x139adc[_0xf323('0x18')]?_0x139adc[_0xf323('0x18')][_0xf323('0x19')]||null:null,'attributes':_0x139adc[_0xf323('0x18')]?_0x139adc['options'][_0xf323('0x1a')]||null:null,'include':_0x139adc[_0xf323('0x18')]?_0x139adc[_0xf323('0x18')][_0xf323('0x1b')]?_['map'](_0x139adc[_0xf323('0x18')]['include'],function(_0x372c47){return{'model':db[_0x372c47[_0xf323('0x1d')]],'as':_0x372c47['as'],'attributes':_0x372c47['attributes'],'include':_0x372c47[_0xf323('0x1b')]?_['map'](_0x372c47[_0xf323('0x1b')],function(_0x4a49d2){return{'model':db[_0x4a49d2[_0xf323('0x1d')]],'as':_0x4a49d2['as'],'attributes':_0x4a49d2['attributes'],'include':_0x4a49d2[_0xf323('0x1b')]?_[_0xf323('0x1c')](_0x4a49d2['include'],function(_0x4964a5){return{'model':db[_0x4964a5['model']],'as':_0x4964a5['as'],'attributes':_0x4964a5[_0xf323('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf323('0xc')](function(_0x79e636){logger[_0xf323('0xd')](_0xf323('0x1f'),_0x139adc);logger['debug']('ShowFreshsalesAccount',_0x139adc,JSON['stringify'](_0x79e636));_0x3f23cf(_0x79e636);})[_0xf323('0x1e')](function(_0x59fee2){logger[_0xf323('0x13')]('ShowFreshsalesAccount',_0x59fee2[_0xf323('0x14')],_0x139adc);_0x15187c(_0x52300b[_0xf323('0x13')](0x1f4,_0x59fee2[_0xf323('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 80e038b..477e09a 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 _0x3660=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x3660,0x177));var _0x0366=function(_0x728097,_0x5c6467){_0x728097=_0x728097-0x0;var _0x562a29=_0x3660[_0x728097];return _0x562a29;};'use strict';var multer=require(_0x0366('0x0'));var util=require(_0x0366('0x1'));var path=require('path');var timeout=require(_0x0366('0x2'));var express=require(_0x0366('0x3'));var router=express[_0x0366('0x4')]();var fs_extra=require(_0x0366('0x5'));var auth=require(_0x0366('0x6'));var interaction=require(_0x0366('0x7'));var config=require(_0x0366('0x8'));var controller=require(_0x0366('0x9'));router['get']('/',auth[_0x0366('0xa')](),controller[_0x0366('0xb')]);router[_0x0366('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x0366('0xd')]);router[_0x0366('0xc')](_0x0366('0xe'),auth['isAuthenticated'](),controller[_0x0366('0xf')]);router[_0x0366('0xc')](_0x0366('0x10'),auth[_0x0366('0xa')](),controller[_0x0366('0x11')]);router[_0x0366('0xc')](_0x0366('0x12'),auth[_0x0366('0xa')](),controller[_0x0366('0x13')]);router[_0x0366('0x14')]('/',auth[_0x0366('0xa')](),controller['create']);router[_0x0366('0x15')]('/:id',auth[_0x0366('0xa')](),controller[_0x0366('0x16')]);router[_0x0366('0x17')](_0x0366('0x18'),auth[_0x0366('0xa')](),controller[_0x0366('0x19')]);module[_0x0366('0x1a')]=router; \ No newline at end of file +var _0xf25d=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getDescriptions','/:id/fields','post','put','update','delete','multer','util','express'];(function(_0x5af7a9,_0x18517e){var _0x417b17=function(_0x52fd8f){while(--_0x52fd8f){_0x5af7a9['push'](_0x5af7a9['shift']());}};_0x417b17(++_0x18517e);}(_0xf25d,0x1c5));var _0xdf25=function(_0x1ea649,_0x488d02){_0x1ea649=_0x1ea649-0x0;var _0x35d78b=_0xf25d[_0x1ea649];return _0x35d78b;};'use strict';var multer=require(_0xdf25('0x0'));var util=require(_0xdf25('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdf25('0x2'));var router=express[_0xdf25('0x3')]();var fs_extra=require(_0xdf25('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdf25('0x5'));var config=require(_0xdf25('0x6'));var controller=require(_0xdf25('0x7'));router[_0xdf25('0x8')]('/',auth[_0xdf25('0x9')](),controller['index']);router[_0xdf25('0x8')](_0xdf25('0xa'),auth[_0xdf25('0x9')](),controller[_0xdf25('0xb')]);router[_0xdf25('0x8')](_0xdf25('0xc'),auth[_0xdf25('0x9')](),controller['getSubjects']);router[_0xdf25('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xdf25('0xd')]);router[_0xdf25('0x8')](_0xdf25('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xdf25('0xf')]('/',auth[_0xdf25('0x9')](),controller['create']);router[_0xdf25('0x10')](_0xdf25('0xa'),auth[_0xdf25('0x9')](),controller[_0xdf25('0x11')]);router[_0xdf25('0x12')](_0xdf25('0xa'),auth[_0xdf25('0x9')](),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 5a491ce..ae4a0a6 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 _0x0b7f=['sequelize','exports','STRING'];(function(_0x21183f,_0x450c04){var _0x2f43c2=function(_0xba156f){while(--_0xba156f){_0x21183f['push'](_0x21183f['shift']());}};_0x2f43c2(++_0x450c04);}(_0x0b7f,0x10b));var _0xf0b7=function(_0x55d386,_0x12e62c){_0x55d386=_0x55d386-0x0;var _0x5d5001=_0x0b7f[_0x55d386];return _0x5d5001;};'use strict';var Sequelize=require(_0xf0b7('0x0'));module[_0xf0b7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf0b7('0x2')]}}; \ No newline at end of file +var _0x7f7f=['STRING','sequelize','exports'];(function(_0x71a4ec,_0x2083ea){var _0x4f95f0=function(_0x244ead){while(--_0x244ead){_0x71a4ec['push'](_0x71a4ec['shift']());}};_0x4f95f0(++_0x2083ea);}(_0x7f7f,0x106));var _0xf7f7=function(_0x2734c8,_0x2f7019){_0x2734c8=_0x2734c8-0x0;var _0x4e35c2=_0x7f7f[_0x2734c8];return _0x4e35c2;};'use strict';var Sequelize=require(_0xf7f7('0x0'));module[_0xf7f7('0x1')]={'name':{'type':Sequelize[_0xf7f7('0x2')]},'description':{'type':Sequelize[_0xf7f7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 74ce14b..40204fe 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 _0x6c85=['order','sort','filters','pick','where','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','include','create','body','find','getSubjects','findOne','FreshsalesField','nolimit','merge','getDescriptions','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x34b307,_0x1a2bbe){var _0x32ce25=function(_0x4ab05e){while(--_0x4ab05e){_0x34b307['push'](_0x34b307['shift']());}};_0x32ce25(++_0x1a2bbe);}(_0x6c85,0x160));var _0x56c8=function(_0x5ec6a6,_0x515274){_0x5ec6a6=_0x5ec6a6-0x0;var _0x551e77=_0x6c85[_0x5ec6a6];return _0x551e77;};'use strict';var emlformat=require(_0x56c8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x56c8('0x1'));var jsonpatch=require(_0x56c8('0x2'));var rp=require(_0x56c8('0x3'));var moment=require(_0x56c8('0x4'));var BPromise=require(_0x56c8('0x5'));var Mustache=require(_0x56c8('0x6'));var util=require(_0x56c8('0x7'));var path=require(_0x56c8('0x8'));var sox=require('sox');var csv=require(_0x56c8('0x9'));var ejs=require(_0x56c8('0xa'));var fs=require('fs');var fs_extra=require(_0x56c8('0xb'));var _=require(_0x56c8('0xc'));var squel=require(_0x56c8('0xd'));var crypto=require(_0x56c8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x56c8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x56c8('0x10'));var Papa=require(_0x56c8('0x11'));var Redis=require('ioredis');var authService=require(_0x56c8('0x12'));var qs=require(_0x56c8('0x13'));var as=require(_0x56c8('0x14'));var hardwareService=require(_0x56c8('0x15'));var logger=require(_0x56c8('0x16'))(_0x56c8('0x17'));var utils=require('../../config/utils');var config=require(_0x56c8('0x18'));var licenseUtil=require(_0x56c8('0x19'));var db=require(_0x56c8('0x1a'))['db'];function respondWithStatusCode(_0x1b58eb,_0x557d11){_0x557d11=_0x557d11||0xcc;return function(_0x35c254){if(_0x35c254){return _0x1b58eb[_0x56c8('0x1b')](_0x557d11);}return _0x1b58eb[_0x56c8('0x1c')](_0x557d11)[_0x56c8('0x1d')]();};}function respondWithResult(_0x1326a9,_0x3dc631){_0x3dc631=_0x3dc631||0xc8;return function(_0x1bb4b3){if(_0x1bb4b3){return _0x1326a9[_0x56c8('0x1c')](_0x3dc631)[_0x56c8('0x1e')](_0x1bb4b3);}};}function respondWithFilteredResult(_0x2439fd,_0x299195){return function(_0x56c2ee){if(_0x56c2ee){var _0x57801f=typeof _0x299195[_0x56c8('0x1f')]===_0x56c8('0x20')&&typeof _0x299195[_0x56c8('0x21')]===_0x56c8('0x20');var _0x36ef99=_0x56c2ee[_0x56c8('0x22')];var _0xacbd9=_0x57801f?0x0:_0x299195[_0x56c8('0x1f')];var _0x3f3d71=_0x57801f?_0x56c2ee[_0x56c8('0x22')]:_0x299195[_0x56c8('0x1f')]+_0x299195[_0x56c8('0x21')];var _0x8939d9;if(_0x3f3d71>=_0x36ef99){_0x3f3d71=_0x36ef99;_0x8939d9=0xc8;}else{_0x8939d9=0xce;}_0x2439fd[_0x56c8('0x1c')](_0x8939d9);return _0x2439fd[_0x56c8('0x23')](_0x56c8('0x24'),_0xacbd9+'-'+_0x3f3d71+'/'+_0x36ef99)[_0x56c8('0x1e')](_0x56c2ee);}return null;};}function patchUpdates(_0x2d6eb5){return function(_0x3d9e6f){try{jsonpatch['apply'](_0x3d9e6f,_0x2d6eb5,!![]);}catch(_0x463c2c){return BPromise[_0x56c8('0x25')](_0x463c2c);}return _0x3d9e6f[_0x56c8('0x26')]();};}function saveUpdates(_0x300e9b,_0x12574e){return function(_0x1ab89f){if(_0x1ab89f){return _0x1ab89f[_0x56c8('0x27')](_0x300e9b)[_0x56c8('0x28')](function(_0x145605){return _0x145605;});}return null;};}function removeEntity(_0x17d5f5,_0x5290d4){return function(_0x509da2){if(_0x509da2){return _0x509da2[_0x56c8('0x29')]()['then'](function(){_0x17d5f5[_0x56c8('0x1c')](0xcc)[_0x56c8('0x1d')]();});}};}function handleEntityNotFound(_0x4b254e,_0x5a1340){return function(_0x2ac910){if(!_0x2ac910){_0x4b254e[_0x56c8('0x1b')](0x194);}return _0x2ac910;};}function handleError(_0x142a1c,_0x5bcece){_0x5bcece=_0x5bcece||0x1f4;return function(_0x52061a){logger[_0x56c8('0x2a')](_0x52061a['stack']);if(_0x52061a[_0x56c8('0x2b')]){delete _0x52061a[_0x56c8('0x2b')];}_0x142a1c[_0x56c8('0x1c')](_0x5bcece)['send'](_0x52061a);};}exports[_0x56c8('0x2c')]=function(_0x1a1eec,_0x4afa4d){var _0x9a0b1b={},_0x35eed0={},_0xd7a9a9={'count':0x0,'rows':[]};var _0x2e48c6=_[_0x56c8('0x2d')](db[_0x56c8('0x2e')][_0x56c8('0x2f')],function(_0x5dc471){return{'name':_0x5dc471[_0x56c8('0x30')],'type':_0x5dc471[_0x56c8('0x31')]['key']};});_0x35eed0[_0x56c8('0x32')]=_[_0x56c8('0x2d')](_0x2e48c6,_0x56c8('0x2b'));_0x35eed0[_0x56c8('0x33')]=_[_0x56c8('0x34')](_0x1a1eec[_0x56c8('0x33')]);_0x35eed0['filters']=_[_0x56c8('0x35')](_0x35eed0['model'],_0x35eed0[_0x56c8('0x33')]);_0x9a0b1b[_0x56c8('0x36')]=_[_0x56c8('0x35')](_0x35eed0[_0x56c8('0x32')],qs[_0x56c8('0x37')](_0x1a1eec['query']['fields']));_0x9a0b1b[_0x56c8('0x36')]=_0x9a0b1b[_0x56c8('0x36')][_0x56c8('0x38')]?_0x9a0b1b[_0x56c8('0x36')]:_0x35eed0['model'];if(!_0x1a1eec[_0x56c8('0x33')][_0x56c8('0x39')]('nolimit')){_0x9a0b1b[_0x56c8('0x21')]=qs[_0x56c8('0x21')](_0x1a1eec[_0x56c8('0x33')][_0x56c8('0x21')]);_0x9a0b1b['offset']=qs[_0x56c8('0x1f')](_0x1a1eec[_0x56c8('0x33')][_0x56c8('0x1f')]);}_0x9a0b1b[_0x56c8('0x3a')]=qs[_0x56c8('0x3b')](_0x1a1eec['query'][_0x56c8('0x3b')]);_0x9a0b1b['where']=qs[_0x56c8('0x3c')](_[_0x56c8('0x3d')](_0x1a1eec[_0x56c8('0x33')],_0x35eed0[_0x56c8('0x3c')]),_0x2e48c6);if(_0x1a1eec[_0x56c8('0x33')]['filter']){_0x9a0b1b[_0x56c8('0x3e')]=_['merge'](_0x9a0b1b[_0x56c8('0x3e')],{'$or':_[_0x56c8('0x2d')](_0x2e48c6,function(_0xd07623){if(_0xd07623[_0x56c8('0x31')]!==_0x56c8('0x3f')){var _0x5c844b={};_0x5c844b[_0xd07623[_0x56c8('0x2b')]]={'$like':'%'+_0x1a1eec[_0x56c8('0x33')][_0x56c8('0x40')]+'%'};return _0x5c844b;}})});}_0x9a0b1b=_['merge']({},_0x9a0b1b,_0x1a1eec[_0x56c8('0x41')]);var _0x1a2b56={'where':_0x9a0b1b[_0x56c8('0x3e')]};return db[_0x56c8('0x2e')][_0x56c8('0x22')](_0x1a2b56)[_0x56c8('0x28')](function(_0x8e30b8){_0xd7a9a9[_0x56c8('0x22')]=_0x8e30b8;if(_0x1a1eec[_0x56c8('0x33')][_0x56c8('0x42')]){_0x9a0b1b['include']=[{'all':!![]}];}return db[_0x56c8('0x2e')][_0x56c8('0x43')](_0x9a0b1b);})[_0x56c8('0x28')](function(_0x462dff){_0xd7a9a9['rows']=_0x462dff;return _0xd7a9a9;})[_0x56c8('0x28')](respondWithFilteredResult(_0x4afa4d,_0x9a0b1b))[_0x56c8('0x44')](handleError(_0x4afa4d,null));};exports[_0x56c8('0x45')]=function(_0x207096,_0x34f6ab){var _0x3243f4={'raw':![],'where':{'id':_0x207096[_0x56c8('0x46')]['id']}},_0x972379={};_0x972379['model']=_[_0x56c8('0x34')](db['FreshsalesConfiguration']['rawAttributes']);_0x972379[_0x56c8('0x33')]=_['keys'](_0x207096['query']);_0x972379[_0x56c8('0x3c')]=_[_0x56c8('0x35')](_0x972379[_0x56c8('0x32')],_0x972379[_0x56c8('0x33')]);_0x3243f4[_0x56c8('0x36')]=_['intersection'](_0x972379[_0x56c8('0x32')],qs[_0x56c8('0x37')](_0x207096['query'][_0x56c8('0x37')]));_0x3243f4[_0x56c8('0x36')]=_0x3243f4['attributes']['length']?_0x3243f4[_0x56c8('0x36')]:_0x972379[_0x56c8('0x32')];if(_0x207096[_0x56c8('0x33')][_0x56c8('0x42')]){_0x3243f4[_0x56c8('0x47')]=[{'all':!![]}];}_0x3243f4=_['merge']({},_0x3243f4,_0x207096[_0x56c8('0x41')]);return db[_0x56c8('0x2e')]['find'](_0x3243f4)[_0x56c8('0x28')](handleEntityNotFound(_0x34f6ab,null))[_0x56c8('0x28')](respondWithResult(_0x34f6ab,null))[_0x56c8('0x44')](handleError(_0x34f6ab,null));};exports['create']=function(_0xe31e01,_0x1f413b){return db[_0x56c8('0x2e')][_0x56c8('0x48')](_0xe31e01['body'],{})[_0x56c8('0x28')](respondWithResult(_0x1f413b,0xc9))[_0x56c8('0x44')](handleError(_0x1f413b,null));};exports[_0x56c8('0x27')]=function(_0x3aeb67,_0x116e0b){if(_0x3aeb67[_0x56c8('0x49')]['id']){delete _0x3aeb67['body']['id'];}return db[_0x56c8('0x2e')][_0x56c8('0x4a')]({'where':{'id':_0x3aeb67[_0x56c8('0x46')]['id']}})[_0x56c8('0x28')](handleEntityNotFound(_0x116e0b,null))['then'](saveUpdates(_0x3aeb67[_0x56c8('0x49')],null))[_0x56c8('0x28')](respondWithResult(_0x116e0b,null))['catch'](handleError(_0x116e0b,null));};exports['destroy']=function(_0x46f26d,_0x1648c6){return db[_0x56c8('0x2e')][_0x56c8('0x4a')]({'where':{'id':_0x46f26d[_0x56c8('0x46')]['id']}})[_0x56c8('0x28')](handleEntityNotFound(_0x1648c6,null))[_0x56c8('0x28')](removeEntity(_0x1648c6,null))[_0x56c8('0x44')](handleError(_0x1648c6,null));};exports[_0x56c8('0x4b')]=function(_0x46f6bd,_0x34d5b2,_0xdbea82){var _0x5cd11c={};var _0x5980e5={};var _0x3a2b94;var _0x1a9fc9;return db[_0x56c8('0x2e')][_0x56c8('0x4c')]({'where':{'id':_0x46f6bd[_0x56c8('0x46')]['id']}})['then'](handleEntityNotFound(_0x34d5b2,null))[_0x56c8('0x28')](function(_0xfe2925){if(_0xfe2925){_0x3a2b94=_0xfe2925;_0x5980e5['model']=_[_0x56c8('0x34')](db[_0x56c8('0x4d')]['rawAttributes']);_0x5980e5[_0x56c8('0x33')]=_['keys'](_0x46f6bd[_0x56c8('0x33')]);_0x5980e5[_0x56c8('0x3c')]=_['intersection'](_0x5980e5[_0x56c8('0x32')],_0x5980e5[_0x56c8('0x33')]);_0x5cd11c['attributes']=_['intersection'](_0x5980e5[_0x56c8('0x32')],qs[_0x56c8('0x37')](_0x46f6bd[_0x56c8('0x33')]['fields']));_0x5cd11c[_0x56c8('0x36')]=_0x5cd11c['attributes'][_0x56c8('0x38')]?_0x5cd11c[_0x56c8('0x36')]:_0x5980e5[_0x56c8('0x32')];_0x5cd11c[_0x56c8('0x3a')]=qs[_0x56c8('0x3b')](_0x46f6bd[_0x56c8('0x33')][_0x56c8('0x3b')]);_0x5cd11c[_0x56c8('0x3e')]=qs[_0x56c8('0x3c')](_[_0x56c8('0x3d')](_0x46f6bd[_0x56c8('0x33')],_0x5980e5['filters']));if(_0x46f6bd[_0x56c8('0x33')][_0x56c8('0x40')]){_0x5cd11c[_0x56c8('0x3e')]=_['merge'](_0x5cd11c[_0x56c8('0x3e')],{'$or':_[_0x56c8('0x2d')](_0x5cd11c['attributes'],function(_0x1fa43d){var _0x285d16={};_0x285d16[_0x1fa43d]={'$like':'%'+_0x46f6bd['query'][_0x56c8('0x40')]+'%'};return _0x285d16;})});}_0x5cd11c=_['merge']({},_0x5cd11c,_0x46f6bd[_0x56c8('0x41')]);return _0x3a2b94[_0x56c8('0x4b')](_0x5cd11c);}})['then'](function(_0x10f4db){if(_0x10f4db){_0x1a9fc9=_0x10f4db[_0x56c8('0x38')];if(!_0x46f6bd['query']['hasOwnProperty'](_0x56c8('0x4e'))){_0x5cd11c[_0x56c8('0x21')]=qs[_0x56c8('0x21')](_0x46f6bd[_0x56c8('0x33')]['limit']);_0x5cd11c[_0x56c8('0x1f')]=qs[_0x56c8('0x1f')](_0x46f6bd[_0x56c8('0x33')][_0x56c8('0x1f')]);}return _0x3a2b94[_0x56c8('0x4b')](_0x5cd11c);}})[_0x56c8('0x28')](function(_0x53f1df){if(_0x53f1df){return _0x53f1df?{'count':_0x1a9fc9,'rows':_0x53f1df}:null;}})[_0x56c8('0x28')](respondWithResult(_0x34d5b2,null))[_0x56c8('0x44')](handleError(_0x34d5b2,null));};exports['getDescriptions']=function(_0x37a407,_0x1a7ab6,_0x2da3c7){var _0x1bf14f={};var _0x2123e1={};var _0x4df257;var _0xe930e1;return db[_0x56c8('0x2e')][_0x56c8('0x4c')]({'where':{'id':_0x37a407[_0x56c8('0x46')]['id']}})[_0x56c8('0x28')](handleEntityNotFound(_0x1a7ab6,null))['then'](function(_0x3d2000){if(_0x3d2000){_0x4df257=_0x3d2000;_0x2123e1[_0x56c8('0x32')]=_[_0x56c8('0x34')](db[_0x56c8('0x4d')][_0x56c8('0x2f')]);_0x2123e1[_0x56c8('0x33')]=_[_0x56c8('0x34')](_0x37a407[_0x56c8('0x33')]);_0x2123e1[_0x56c8('0x3c')]=_[_0x56c8('0x35')](_0x2123e1[_0x56c8('0x32')],_0x2123e1['query']);_0x1bf14f[_0x56c8('0x36')]=_[_0x56c8('0x35')](_0x2123e1[_0x56c8('0x32')],qs[_0x56c8('0x37')](_0x37a407[_0x56c8('0x33')][_0x56c8('0x37')]));_0x1bf14f['attributes']=_0x1bf14f[_0x56c8('0x36')][_0x56c8('0x38')]?_0x1bf14f[_0x56c8('0x36')]:_0x2123e1[_0x56c8('0x32')];_0x1bf14f['order']=qs[_0x56c8('0x3b')](_0x37a407[_0x56c8('0x33')][_0x56c8('0x3b')]);_0x1bf14f[_0x56c8('0x3e')]=qs[_0x56c8('0x3c')](_['pick'](_0x37a407[_0x56c8('0x33')],_0x2123e1[_0x56c8('0x3c')]));if(_0x37a407[_0x56c8('0x33')][_0x56c8('0x40')]){_0x1bf14f['where']=_[_0x56c8('0x4f')](_0x1bf14f[_0x56c8('0x3e')],{'$or':_['map'](_0x1bf14f[_0x56c8('0x36')],function(_0x5c4bbd){var _0x1898a0={};_0x1898a0[_0x5c4bbd]={'$like':'%'+_0x37a407[_0x56c8('0x33')][_0x56c8('0x40')]+'%'};return _0x1898a0;})});}_0x1bf14f=_[_0x56c8('0x4f')]({},_0x1bf14f,_0x37a407[_0x56c8('0x41')]);return _0x4df257['getDescriptions'](_0x1bf14f);}})[_0x56c8('0x28')](function(_0x271f41){if(_0x271f41){_0xe930e1=_0x271f41[_0x56c8('0x38')];if(!_0x37a407[_0x56c8('0x33')]['hasOwnProperty'](_0x56c8('0x4e'))){_0x1bf14f[_0x56c8('0x21')]=qs[_0x56c8('0x21')](_0x37a407['query'][_0x56c8('0x21')]);_0x1bf14f['offset']=qs[_0x56c8('0x1f')](_0x37a407[_0x56c8('0x33')][_0x56c8('0x1f')]);}return _0x4df257[_0x56c8('0x50')](_0x1bf14f);}})[_0x56c8('0x28')](function(_0x50822a){if(_0x50822a){return _0x50822a?{'count':_0xe930e1,'rows':_0x50822a}:null;}})['then'](respondWithResult(_0x1a7ab6,null))['catch'](handleError(_0x1a7ab6,null));};exports[_0x56c8('0x51')]=function(_0x62c9cc,_0x4ebd21,_0x2051a3){var _0x194a07={};var _0x1aa2d8={};var _0x55d3dd;var _0x41e700;return db[_0x56c8('0x2e')][_0x56c8('0x4c')]({'where':{'id':_0x62c9cc[_0x56c8('0x46')]['id']}})[_0x56c8('0x28')](handleEntityNotFound(_0x4ebd21,null))[_0x56c8('0x28')](function(_0x491a20){if(_0x491a20){_0x55d3dd=_0x491a20;_0x1aa2d8['model']=_[_0x56c8('0x34')](db[_0x56c8('0x4d')][_0x56c8('0x2f')]);_0x1aa2d8['query']=_[_0x56c8('0x34')](_0x62c9cc[_0x56c8('0x33')]);_0x1aa2d8[_0x56c8('0x3c')]=_['intersection'](_0x1aa2d8[_0x56c8('0x32')],_0x1aa2d8[_0x56c8('0x33')]);_0x194a07[_0x56c8('0x36')]=_[_0x56c8('0x35')](_0x1aa2d8['model'],qs[_0x56c8('0x37')](_0x62c9cc[_0x56c8('0x33')][_0x56c8('0x37')]));_0x194a07[_0x56c8('0x36')]=_0x194a07[_0x56c8('0x36')][_0x56c8('0x38')]?_0x194a07[_0x56c8('0x36')]:_0x1aa2d8['model'];_0x194a07[_0x56c8('0x3a')]=qs[_0x56c8('0x3b')](_0x62c9cc[_0x56c8('0x33')]['sort']);_0x194a07[_0x56c8('0x3e')]=qs['filters'](_[_0x56c8('0x3d')](_0x62c9cc[_0x56c8('0x33')],_0x1aa2d8['filters']));if(_0x62c9cc[_0x56c8('0x33')][_0x56c8('0x40')]){_0x194a07[_0x56c8('0x3e')]=_['merge'](_0x194a07[_0x56c8('0x3e')],{'$or':_[_0x56c8('0x2d')](_0x194a07[_0x56c8('0x36')],function(_0x4e8427){var _0x49f096={};_0x49f096[_0x4e8427]={'$like':'%'+_0x62c9cc['query'][_0x56c8('0x40')]+'%'};return _0x49f096;})});}_0x194a07=_[_0x56c8('0x4f')]({},_0x194a07,_0x62c9cc['options']);return _0x55d3dd[_0x56c8('0x51')](_0x194a07);}})[_0x56c8('0x28')](function(_0x4b6ce1){if(_0x4b6ce1){_0x41e700=_0x4b6ce1['length'];if(!_0x62c9cc[_0x56c8('0x33')][_0x56c8('0x39')](_0x56c8('0x4e'))){_0x194a07[_0x56c8('0x21')]=qs[_0x56c8('0x21')](_0x62c9cc[_0x56c8('0x33')]['limit']);_0x194a07[_0x56c8('0x1f')]=qs[_0x56c8('0x1f')](_0x62c9cc['query'][_0x56c8('0x1f')]);}return _0x55d3dd[_0x56c8('0x51')](_0x194a07);}})[_0x56c8('0x28')](function(_0x258047){if(_0x258047){return _0x258047?{'count':_0x41e700,'rows':_0x258047}:null;}})['then'](respondWithResult(_0x4ebd21,null))[_0x56c8('0x44')](handleError(_0x4ebd21,null));}; \ No newline at end of file +var _0x03a3=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','sendStatus','error','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','VIRTUAL','name','merge','options','FreshsalesConfiguration','includeAll','include','catch','show','params','length','find','create','body','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','nolimit','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x4ad41e,_0x28080e){var _0x10c7a6=function(_0x48a3e0){while(--_0x48a3e0){_0x4ad41e['push'](_0x4ad41e['shift']());}};_0x10c7a6(++_0x28080e);}(_0x03a3,0x1dd));var _0x303a=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x03a3[_0xe66cf2];return _0x2d84e7;};'use strict';var emlformat=require(_0x303a('0x0'));var rimraf=require(_0x303a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x303a('0x2'));var rp=require(_0x303a('0x3'));var moment=require(_0x303a('0x4'));var BPromise=require(_0x303a('0x5'));var Mustache=require(_0x303a('0x6'));var util=require(_0x303a('0x7'));var path=require(_0x303a('0x8'));var sox=require(_0x303a('0x9'));var csv=require(_0x303a('0xa'));var ejs=require(_0x303a('0xb'));var fs=require('fs');var fs_extra=require(_0x303a('0xc'));var _=require(_0x303a('0xd'));var squel=require(_0x303a('0xe'));var crypto=require(_0x303a('0xf'));var jsforce=require(_0x303a('0x10'));var deskjs=require(_0x303a('0x11'));var toCsv=require('to-csv');var querystring=require(_0x303a('0x12'));var Papa=require(_0x303a('0x13'));var Redis=require(_0x303a('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x303a('0x15'));var logger=require(_0x303a('0x16'))(_0x303a('0x17'));var utils=require(_0x303a('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x303a('0x19'))['db'];function respondWithStatusCode(_0xe449bd,_0x1c8356){_0x1c8356=_0x1c8356||0xcc;return function(_0x39678c){if(_0x39678c){return _0xe449bd['sendStatus'](_0x1c8356);}return _0xe449bd[_0x303a('0x1a')](_0x1c8356)[_0x303a('0x1b')]();};}function respondWithResult(_0xede4c5,_0x561c1c){_0x561c1c=_0x561c1c||0xc8;return function(_0x6c3d36){if(_0x6c3d36){return _0xede4c5['status'](_0x561c1c)['json'](_0x6c3d36);}};}function respondWithFilteredResult(_0x3f02a5,_0x15527d){return function(_0x19a8e0){if(_0x19a8e0){var _0x305c63=typeof _0x15527d[_0x303a('0x1c')]===_0x303a('0x1d')&&typeof _0x15527d[_0x303a('0x1e')]===_0x303a('0x1d');var _0x167671=_0x19a8e0[_0x303a('0x1f')];var _0x22d03c=_0x305c63?0x0:_0x15527d[_0x303a('0x1c')];var _0x4dd7e2=_0x305c63?_0x19a8e0[_0x303a('0x1f')]:_0x15527d[_0x303a('0x1c')]+_0x15527d[_0x303a('0x1e')];var _0x5d7dab;if(_0x4dd7e2>=_0x167671){_0x4dd7e2=_0x167671;_0x5d7dab=0xc8;}else{_0x5d7dab=0xce;}_0x3f02a5['status'](_0x5d7dab);return _0x3f02a5[_0x303a('0x20')]('Content-Range',_0x22d03c+'-'+_0x4dd7e2+'/'+_0x167671)[_0x303a('0x21')](_0x19a8e0);}return null;};}function patchUpdates(_0x50870e){return function(_0x404de4){try{jsonpatch['apply'](_0x404de4,_0x50870e,!![]);}catch(_0x34e542){return BPromise[_0x303a('0x22')](_0x34e542);}return _0x404de4[_0x303a('0x23')]();};}function saveUpdates(_0x4ba05e,_0x389183){return function(_0x53d608){if(_0x53d608){return _0x53d608[_0x303a('0x24')](_0x4ba05e)[_0x303a('0x25')](function(_0x1d7f1d){return _0x1d7f1d;});}return null;};}function removeEntity(_0x34debb,_0x238f23){return function(_0x102838){if(_0x102838){return _0x102838[_0x303a('0x26')]()[_0x303a('0x25')](function(){_0x34debb[_0x303a('0x1a')](0xcc)[_0x303a('0x1b')]();});}};}function handleEntityNotFound(_0x36d1dc,_0x8ce5d2){return function(_0x259df6){if(!_0x259df6){_0x36d1dc[_0x303a('0x27')](0x194);}return _0x259df6;};}function handleError(_0x542ab6,_0x453939){_0x453939=_0x453939||0x1f4;return function(_0x44ee4e){logger[_0x303a('0x28')](_0x44ee4e['stack']);if(_0x44ee4e['name']){delete _0x44ee4e['name'];}_0x542ab6[_0x303a('0x1a')](_0x453939)[_0x303a('0x29')](_0x44ee4e);};}exports[_0x303a('0x2a')]=function(_0x3d1664,_0x564d75){var _0x583a39={},_0x523d2b={},_0x249657={'count':0x0,'rows':[]};var _0x580d29=_['map'](db['FreshsalesConfiguration'][_0x303a('0x2b')],function(_0x18df43){return{'name':_0x18df43[_0x303a('0x2c')],'type':_0x18df43[_0x303a('0x2d')][_0x303a('0x2e')]};});_0x523d2b[_0x303a('0x2f')]=_[_0x303a('0x30')](_0x580d29,'name');_0x523d2b[_0x303a('0x31')]=_[_0x303a('0x32')](_0x3d1664[_0x303a('0x31')]);_0x523d2b[_0x303a('0x33')]=_[_0x303a('0x34')](_0x523d2b['model'],_0x523d2b['query']);_0x583a39[_0x303a('0x35')]=_[_0x303a('0x34')](_0x523d2b[_0x303a('0x2f')],qs[_0x303a('0x36')](_0x3d1664[_0x303a('0x31')][_0x303a('0x36')]));_0x583a39[_0x303a('0x35')]=_0x583a39[_0x303a('0x35')]['length']?_0x583a39['attributes']:_0x523d2b[_0x303a('0x2f')];if(!_0x3d1664[_0x303a('0x31')]['hasOwnProperty']('nolimit')){_0x583a39['limit']=qs[_0x303a('0x1e')](_0x3d1664[_0x303a('0x31')][_0x303a('0x1e')]);_0x583a39[_0x303a('0x1c')]=qs[_0x303a('0x1c')](_0x3d1664[_0x303a('0x31')][_0x303a('0x1c')]);}_0x583a39[_0x303a('0x37')]=qs[_0x303a('0x38')](_0x3d1664[_0x303a('0x31')][_0x303a('0x38')]);_0x583a39[_0x303a('0x39')]=qs[_0x303a('0x33')](_[_0x303a('0x3a')](_0x3d1664[_0x303a('0x31')],_0x523d2b[_0x303a('0x33')]),_0x580d29);if(_0x3d1664[_0x303a('0x31')][_0x303a('0x3b')]){_0x583a39[_0x303a('0x39')]=_['merge'](_0x583a39[_0x303a('0x39')],{'$or':_[_0x303a('0x30')](_0x580d29,function(_0x32f9dc){if(_0x32f9dc[_0x303a('0x2d')]!==_0x303a('0x3c')){var _0x46d8fa={};_0x46d8fa[_0x32f9dc[_0x303a('0x3d')]]={'$like':'%'+_0x3d1664[_0x303a('0x31')]['filter']+'%'};return _0x46d8fa;}})});}_0x583a39=_[_0x303a('0x3e')]({},_0x583a39,_0x3d1664[_0x303a('0x3f')]);var _0x44009f={'where':_0x583a39['where']};return db[_0x303a('0x40')][_0x303a('0x1f')](_0x44009f)['then'](function(_0x8bd5f1){_0x249657[_0x303a('0x1f')]=_0x8bd5f1;if(_0x3d1664[_0x303a('0x31')][_0x303a('0x41')]){_0x583a39[_0x303a('0x42')]=[{'all':!![]}];}return db[_0x303a('0x40')]['findAll'](_0x583a39);})[_0x303a('0x25')](function(_0x1a9616){_0x249657['rows']=_0x1a9616;return _0x249657;})['then'](respondWithFilteredResult(_0x564d75,_0x583a39))[_0x303a('0x43')](handleError(_0x564d75,null));};exports[_0x303a('0x44')]=function(_0x32520d,_0xaba8c6){var _0x1f1be3={'raw':![],'where':{'id':_0x32520d[_0x303a('0x45')]['id']}},_0x47f32f={};_0x47f32f[_0x303a('0x2f')]=_[_0x303a('0x32')](db[_0x303a('0x40')][_0x303a('0x2b')]);_0x47f32f[_0x303a('0x31')]=_[_0x303a('0x32')](_0x32520d['query']);_0x47f32f['filters']=_[_0x303a('0x34')](_0x47f32f[_0x303a('0x2f')],_0x47f32f['query']);_0x1f1be3['attributes']=_[_0x303a('0x34')](_0x47f32f[_0x303a('0x2f')],qs['fields'](_0x32520d[_0x303a('0x31')]['fields']));_0x1f1be3[_0x303a('0x35')]=_0x1f1be3[_0x303a('0x35')][_0x303a('0x46')]?_0x1f1be3[_0x303a('0x35')]:_0x47f32f[_0x303a('0x2f')];if(_0x32520d[_0x303a('0x31')][_0x303a('0x41')]){_0x1f1be3[_0x303a('0x42')]=[{'all':!![]}];}_0x1f1be3=_[_0x303a('0x3e')]({},_0x1f1be3,_0x32520d[_0x303a('0x3f')]);return db[_0x303a('0x40')][_0x303a('0x47')](_0x1f1be3)[_0x303a('0x25')](handleEntityNotFound(_0xaba8c6,null))[_0x303a('0x25')](respondWithResult(_0xaba8c6,null))[_0x303a('0x43')](handleError(_0xaba8c6,null));};exports[_0x303a('0x48')]=function(_0x44ea30,_0x15fb82){return db['FreshsalesConfiguration']['create'](_0x44ea30[_0x303a('0x49')],{})[_0x303a('0x25')](respondWithResult(_0x15fb82,0xc9))['catch'](handleError(_0x15fb82,null));};exports[_0x303a('0x24')]=function(_0x1b09be,_0x30e0a2){if(_0x1b09be[_0x303a('0x49')]['id']){delete _0x1b09be[_0x303a('0x49')]['id'];}return db[_0x303a('0x40')][_0x303a('0x47')]({'where':{'id':_0x1b09be['params']['id']}})[_0x303a('0x25')](handleEntityNotFound(_0x30e0a2,null))['then'](saveUpdates(_0x1b09be[_0x303a('0x49')],null))[_0x303a('0x25')](respondWithResult(_0x30e0a2,null))[_0x303a('0x43')](handleError(_0x30e0a2,null));};exports[_0x303a('0x26')]=function(_0x29a583,_0x51c0f2){return db[_0x303a('0x40')][_0x303a('0x47')]({'where':{'id':_0x29a583['params']['id']}})[_0x303a('0x25')](handleEntityNotFound(_0x51c0f2,null))[_0x303a('0x25')](removeEntity(_0x51c0f2,null))[_0x303a('0x43')](handleError(_0x51c0f2,null));};exports[_0x303a('0x4a')]=function(_0x3c815c,_0x310b3e,_0x15af46){var _0x276c33={};var _0x18f444={};var _0x1f5cae;var _0x5e9736;return db['FreshsalesConfiguration'][_0x303a('0x4b')]({'where':{'id':_0x3c815c[_0x303a('0x45')]['id']}})[_0x303a('0x25')](handleEntityNotFound(_0x310b3e,null))[_0x303a('0x25')](function(_0x32f722){if(_0x32f722){_0x1f5cae=_0x32f722;_0x18f444['model']=_['keys'](db[_0x303a('0x4c')]['rawAttributes']);_0x18f444[_0x303a('0x31')]=_['keys'](_0x3c815c['query']);_0x18f444[_0x303a('0x33')]=_[_0x303a('0x34')](_0x18f444[_0x303a('0x2f')],_0x18f444[_0x303a('0x31')]);_0x276c33[_0x303a('0x35')]=_[_0x303a('0x34')](_0x18f444['model'],qs[_0x303a('0x36')](_0x3c815c['query'][_0x303a('0x36')]));_0x276c33[_0x303a('0x35')]=_0x276c33[_0x303a('0x35')][_0x303a('0x46')]?_0x276c33[_0x303a('0x35')]:_0x18f444[_0x303a('0x2f')];_0x276c33[_0x303a('0x37')]=qs[_0x303a('0x38')](_0x3c815c['query']['sort']);_0x276c33['where']=qs['filters'](_[_0x303a('0x3a')](_0x3c815c[_0x303a('0x31')],_0x18f444[_0x303a('0x33')]));if(_0x3c815c[_0x303a('0x31')][_0x303a('0x3b')]){_0x276c33['where']=_[_0x303a('0x3e')](_0x276c33[_0x303a('0x39')],{'$or':_[_0x303a('0x30')](_0x276c33[_0x303a('0x35')],function(_0x21ed13){var _0x2bdb72={};_0x2bdb72[_0x21ed13]={'$like':'%'+_0x3c815c[_0x303a('0x31')][_0x303a('0x3b')]+'%'};return _0x2bdb72;})});}_0x276c33=_['merge']({},_0x276c33,_0x3c815c[_0x303a('0x3f')]);return _0x1f5cae['getSubjects'](_0x276c33);}})[_0x303a('0x25')](function(_0x5120ed){if(_0x5120ed){_0x5e9736=_0x5120ed[_0x303a('0x46')];if(!_0x3c815c[_0x303a('0x31')][_0x303a('0x4d')]('nolimit')){_0x276c33['limit']=qs[_0x303a('0x1e')](_0x3c815c[_0x303a('0x31')]['limit']);_0x276c33['offset']=qs[_0x303a('0x1c')](_0x3c815c[_0x303a('0x31')][_0x303a('0x1c')]);}return _0x1f5cae[_0x303a('0x4a')](_0x276c33);}})[_0x303a('0x25')](function(_0x3ad118){if(_0x3ad118){return _0x3ad118?{'count':_0x5e9736,'rows':_0x3ad118}:null;}})[_0x303a('0x25')](respondWithResult(_0x310b3e,null))[_0x303a('0x43')](handleError(_0x310b3e,null));};exports[_0x303a('0x4e')]=function(_0x582499,_0x302bc9,_0x3112bb){var _0x237b8d={};var _0x5059a3={};var _0x16af03;var _0x318024;return db[_0x303a('0x40')][_0x303a('0x4b')]({'where':{'id':_0x582499['params']['id']}})['then'](handleEntityNotFound(_0x302bc9,null))['then'](function(_0x264224){if(_0x264224){_0x16af03=_0x264224;_0x5059a3[_0x303a('0x2f')]=_[_0x303a('0x32')](db[_0x303a('0x4c')][_0x303a('0x2b')]);_0x5059a3[_0x303a('0x31')]=_[_0x303a('0x32')](_0x582499['query']);_0x5059a3[_0x303a('0x33')]=_[_0x303a('0x34')](_0x5059a3[_0x303a('0x2f')],_0x5059a3[_0x303a('0x31')]);_0x237b8d['attributes']=_[_0x303a('0x34')](_0x5059a3['model'],qs[_0x303a('0x36')](_0x582499[_0x303a('0x31')][_0x303a('0x36')]));_0x237b8d[_0x303a('0x35')]=_0x237b8d[_0x303a('0x35')][_0x303a('0x46')]?_0x237b8d[_0x303a('0x35')]:_0x5059a3[_0x303a('0x2f')];_0x237b8d[_0x303a('0x37')]=qs[_0x303a('0x38')](_0x582499['query'][_0x303a('0x38')]);_0x237b8d[_0x303a('0x39')]=qs[_0x303a('0x33')](_['pick'](_0x582499['query'],_0x5059a3[_0x303a('0x33')]));if(_0x582499[_0x303a('0x31')][_0x303a('0x3b')]){_0x237b8d[_0x303a('0x39')]=_[_0x303a('0x3e')](_0x237b8d[_0x303a('0x39')],{'$or':_[_0x303a('0x30')](_0x237b8d[_0x303a('0x35')],function(_0x234e19){var _0x321d75={};_0x321d75[_0x234e19]={'$like':'%'+_0x582499[_0x303a('0x31')][_0x303a('0x3b')]+'%'};return _0x321d75;})});}_0x237b8d=_[_0x303a('0x3e')]({},_0x237b8d,_0x582499[_0x303a('0x3f')]);return _0x16af03['getDescriptions'](_0x237b8d);}})[_0x303a('0x25')](function(_0x2dbdb9){if(_0x2dbdb9){_0x318024=_0x2dbdb9[_0x303a('0x46')];if(!_0x582499['query'][_0x303a('0x4d')](_0x303a('0x4f'))){_0x237b8d[_0x303a('0x1e')]=qs[_0x303a('0x1e')](_0x582499['query']['limit']);_0x237b8d[_0x303a('0x1c')]=qs['offset'](_0x582499['query'][_0x303a('0x1c')]);}return _0x16af03[_0x303a('0x4e')](_0x237b8d);}})[_0x303a('0x25')](function(_0x194b5a){if(_0x194b5a){return _0x194b5a?{'count':_0x318024,'rows':_0x194b5a}:null;}})[_0x303a('0x25')](respondWithResult(_0x302bc9,null))[_0x303a('0x43')](handleError(_0x302bc9,null));};exports[_0x303a('0x50')]=function(_0x168d19,_0xc02afe,_0x19a18a){var _0x56b11b={};var _0x7c923b={};var _0x102239;var _0x4dbdc3;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x168d19['params']['id']}})[_0x303a('0x25')](handleEntityNotFound(_0xc02afe,null))[_0x303a('0x25')](function(_0x47b33c){if(_0x47b33c){_0x102239=_0x47b33c;_0x7c923b['model']=_['keys'](db[_0x303a('0x4c')][_0x303a('0x2b')]);_0x7c923b[_0x303a('0x31')]=_[_0x303a('0x32')](_0x168d19[_0x303a('0x31')]);_0x7c923b[_0x303a('0x33')]=_['intersection'](_0x7c923b[_0x303a('0x2f')],_0x7c923b['query']);_0x56b11b['attributes']=_[_0x303a('0x34')](_0x7c923b['model'],qs[_0x303a('0x36')](_0x168d19[_0x303a('0x31')][_0x303a('0x36')]));_0x56b11b[_0x303a('0x35')]=_0x56b11b['attributes']['length']?_0x56b11b[_0x303a('0x35')]:_0x7c923b[_0x303a('0x2f')];_0x56b11b[_0x303a('0x37')]=qs[_0x303a('0x38')](_0x168d19['query']['sort']);_0x56b11b['where']=qs['filters'](_[_0x303a('0x3a')](_0x168d19[_0x303a('0x31')],_0x7c923b[_0x303a('0x33')]));if(_0x168d19[_0x303a('0x31')][_0x303a('0x3b')]){_0x56b11b['where']=_['merge'](_0x56b11b[_0x303a('0x39')],{'$or':_[_0x303a('0x30')](_0x56b11b[_0x303a('0x35')],function(_0x5e5e7d){var _0x9a2b0b={};_0x9a2b0b[_0x5e5e7d]={'$like':'%'+_0x168d19[_0x303a('0x31')][_0x303a('0x3b')]+'%'};return _0x9a2b0b;})});}_0x56b11b=_[_0x303a('0x3e')]({},_0x56b11b,_0x168d19[_0x303a('0x3f')]);return _0x102239[_0x303a('0x50')](_0x56b11b);}})[_0x303a('0x25')](function(_0x32e7e0){if(_0x32e7e0){_0x4dbdc3=_0x32e7e0[_0x303a('0x46')];if(!_0x168d19[_0x303a('0x31')]['hasOwnProperty'](_0x303a('0x4f'))){_0x56b11b[_0x303a('0x1e')]=qs[_0x303a('0x1e')](_0x168d19[_0x303a('0x31')][_0x303a('0x1e')]);_0x56b11b[_0x303a('0x1c')]=qs[_0x303a('0x1c')](_0x168d19[_0x303a('0x31')][_0x303a('0x1c')]);}return _0x102239[_0x303a('0x50')](_0x56b11b);}})[_0x303a('0x25')](function(_0x23d7df){if(_0x23d7df){return _0x23d7df?{'count':_0x4dbdc3,'rows':_0x23d7df}:null;}})[_0x303a('0x25')](respondWithResult(_0xc02afe,null))['catch'](handleError(_0xc02afe,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index b2e1cd6..ca994f8 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 _0x1e23=['path','../../config/environment','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x50d27f,_0x5939cd){var _0xb16e56=function(_0x33191b){while(--_0x33191b){_0x50d27f['push'](_0x50d27f['shift']());}};_0xb16e56(++_0x5939cd);}(_0x1e23,0x19c));var _0x31e2=function(_0x67f3fc,_0x30b6c9){_0x67f3fc=_0x67f3fc-0x0;var _0x123fef=_0x1e23[_0x67f3fc];return _0x123fef;};'use strict';var _=require(_0x31e2('0x0'));var util=require(_0x31e2('0x1'));var logger=require(_0x31e2('0x2'))(_0x31e2('0x3'));var moment=require('moment');var BPromise=require(_0x31e2('0x4'));var rp=require(_0x31e2('0x5'));var fs=require('fs');var path=require(_0x31e2('0x6'));var rimraf=require('rimraf');var config=require(_0x31e2('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x26cbd0,_0x5c8c00){return _0x26cbd0[_0x31e2('0x8')](_0x31e2('0x9'),attributes,{'tableName':_0x31e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae9d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0xae9d,0x146));var _0xdae9=function(_0x28d2d2,_0x5723e5){_0x28d2d2=_0x28d2d2-0x0;var _0x41a8db=_0xae9d[_0x28d2d2];return _0x41a8db;};'use strict';var _=require(_0xdae9('0x0'));var util=require(_0xdae9('0x1'));var logger=require(_0xdae9('0x2'))(_0xdae9('0x3'));var moment=require(_0xdae9('0x4'));var BPromise=require(_0xdae9('0x5'));var rp=require(_0xdae9('0x6'));var fs=require('fs');var path=require(_0xdae9('0x7'));var rimraf=require(_0xdae9('0x8'));var config=require(_0xdae9('0x9'));var attributes=require(_0xdae9('0xa'));module[_0xdae9('0xb')]=function(_0x41bebb,_0x59ae8f){return _0x41bebb[_0xdae9('0xc')](_0xdae9('0xd'),attributes,{'tableName':_0xdae9('0xe'),'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 66a4ae3..01c2265 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 _0xade6=['request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xade6,0x163));var _0x6ade=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0xade6[_0x8af54b];return _0x27d8f0;};'use strict';var _=require(_0x6ade('0x0'));var util=require('util');var moment=require(_0x6ade('0x1'));var BPromise=require(_0x6ade('0x2'));var rs=require(_0x6ade('0x3'));var fs=require('fs');var Redis=require(_0x6ade('0x4'));var db=require(_0x6ade('0x5'))['db'];var utils=require(_0x6ade('0x6'));var logger=require('../../config/logger')(_0x6ade('0x7'));var config=require(_0x6ade('0x8'));var jayson=require(_0x6ade('0x9'));var client=jayson[_0x6ade('0xa')][_0x6ade('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x218f97,_0x3c3557,_0x49719e){return new BPromise(function(_0x124f4d,_0x425fdd){return client[_0x6ade('0xc')](_0x218f97,_0x49719e)['then'](function(_0x401872){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3c3557,_0x6ade('0xd'));logger[_0x6ade('0xe')](_0x6ade('0xf'),_0x3c3557,_0x6ade('0xd'),JSON[_0x6ade('0x10')](_0x401872));if(_0x401872['error']){if(_0x401872[_0x6ade('0x11')][_0x6ade('0x12')]===0x1f4){logger[_0x6ade('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3c3557,_0x401872[_0x6ade('0x11')][_0x6ade('0x13')]);return _0x425fdd(_0x401872[_0x6ade('0x11')][_0x6ade('0x13')]);}logger[_0x6ade('0x11')](_0x6ade('0x14'),_0x3c3557,_0x401872[_0x6ade('0x11')][_0x6ade('0x13')]);return _0x124f4d(_0x401872[_0x6ade('0x11')]['message']);}else{logger[_0x6ade('0x15')](_0x6ade('0x14'),_0x3c3557,_0x6ade('0xd'));_0x124f4d(_0x401872['result'][_0x6ade('0x13')]);}})[_0x6ade('0x16')](function(_0x110c4a){logger[_0x6ade('0x11')](_0x6ade('0x14'),_0x3c3557,_0x110c4a);_0x425fdd(_0x110c4a);});});} \ No newline at end of file +var _0xf30f=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','randomstring','ioredis'];(function(_0x40b50c,_0x1c1f08){var _0x135895=function(_0x238a0f){while(--_0x238a0f){_0x40b50c['push'](_0x40b50c['shift']());}};_0x135895(++_0x1c1f08);}(_0xf30f,0x9e));var _0xff30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf30f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xff30('0x0'));var moment=require(_0xff30('0x1'));var BPromise=require('bluebird');var rs=require(_0xff30('0x2'));var fs=require('fs');var Redis=require(_0xff30('0x3'));var db=require(_0xff30('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xff30('0x5'))('rpc');var config=require(_0xff30('0x6'));var jayson=require(_0xff30('0x7'));var client=jayson['client'][_0xff30('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58d70f,_0x554129,_0x5ec75a){return new BPromise(function(_0x5bc29d,_0x19744a){return client['request'](_0x58d70f,_0x5ec75a)[_0xff30('0x9')](function(_0x3e8c81){logger['info'](_0xff30('0xa'),_0x554129,_0xff30('0xb'));logger[_0xff30('0xc')](_0xff30('0xd'),_0x554129,_0xff30('0xb'),JSON['stringify'](_0x3e8c81));if(_0x3e8c81[_0xff30('0xe')]){if(_0x3e8c81[_0xff30('0xe')]['code']===0x1f4){logger[_0xff30('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x554129,_0x3e8c81[_0xff30('0xe')]['message']);return _0x19744a(_0x3e8c81['error'][_0xff30('0xf')]);}logger[_0xff30('0xe')](_0xff30('0xa'),_0x554129,_0x3e8c81[_0xff30('0xe')][_0xff30('0xf')]);return _0x5bc29d(_0x3e8c81[_0xff30('0xe')][_0xff30('0xf')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x554129,_0xff30('0xb'));_0x5bc29d(_0x3e8c81[_0xff30('0x10')][_0xff30('0xf')]);}})[_0xff30('0x11')](function(_0x4cd1c9){logger[_0xff30('0xe')](_0xff30('0xa'),_0x554129,_0x4cd1c9);_0x19744a(_0x4cd1c9);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 75d6fda..9609c30 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 _0xef38=['put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','/:id','show','post','create'];(function(_0x4605ee,_0x479fce){var _0x165f3f=function(_0x48afbe){while(--_0x48afbe){_0x4605ee['push'](_0x4605ee['shift']());}};_0x165f3f(++_0x479fce);}(_0xef38,0x122));var _0x8ef3=function(_0x291d50,_0x45fe6e){_0x291d50=_0x291d50-0x0;var _0x2f1b2f=_0xef38[_0x291d50];return _0x2f1b2f;};'use strict';var multer=require('multer');var util=require(_0x8ef3('0x0'));var path=require(_0x8ef3('0x1'));var timeout=require(_0x8ef3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8ef3('0x3'));var auth=require(_0x8ef3('0x4'));var interaction=require(_0x8ef3('0x5'));var config=require(_0x8ef3('0x6'));var controller=require(_0x8ef3('0x7'));router['get']('/',auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x9')]);router['get'](_0x8ef3('0xa'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0xb')]);router[_0x8ef3('0xc')]('/',auth[_0x8ef3('0x8')](),controller[_0x8ef3('0xd')]);router[_0x8ef3('0xe')]('/:id',auth[_0x8ef3('0x8')](),controller[_0x8ef3('0xf')]);router[_0x8ef3('0x10')](_0x8ef3('0xa'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x11')]);module[_0x8ef3('0x12')]=router; \ No newline at end of file +var _0xfe60=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','post','update','delete','destroy','exports'];(function(_0x36daa7,_0x45653a){var _0x9c4ff8=function(_0x6b49a){while(--_0x6b49a){_0x36daa7['push'](_0x36daa7['shift']());}};_0x9c4ff8(++_0x45653a);}(_0xfe60,0x1cb));var _0x0fe6=function(_0x528416,_0x5ea9c5){_0x528416=_0x528416-0x0;var _0x25d037=_0xfe60[_0x528416];return _0x25d037;};'use strict';var multer=require('multer');var util=require(_0x0fe6('0x0'));var path=require('path');var timeout=require(_0x0fe6('0x1'));var express=require(_0x0fe6('0x2'));var router=express[_0x0fe6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0fe6('0x4'));var interaction=require(_0x0fe6('0x5'));var config=require(_0x0fe6('0x6'));var controller=require(_0x0fe6('0x7'));router[_0x0fe6('0x8')]('/',auth[_0x0fe6('0x9')](),controller[_0x0fe6('0xa')]);router[_0x0fe6('0x8')](_0x0fe6('0xb'),auth[_0x0fe6('0x9')](),controller['show']);router[_0x0fe6('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0fe6('0xb'),auth['isAuthenticated'](),controller[_0x0fe6('0xd')]);router[_0x0fe6('0xe')](_0x0fe6('0xb'),auth[_0x0fe6('0x9')](),controller[_0x0fe6('0xf')]);module[_0x0fe6('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 9d0c840..b9741d1 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 _0x3d07=['customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x38f1a9,_0x59881d){var _0x3f715c=function(_0x330cf8){while(--_0x330cf8){_0x38f1a9['push'](_0x38f1a9['shift']());}};_0x3f715c(++_0x59881d);}(_0x3d07,0x19c));var _0x73d0=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0x3d07[_0x5e4563];return _0x8d1bf5;};'use strict';var Sequelize=require('sequelize');module[_0x73d0('0x0')]={'type':{'type':Sequelize[_0x73d0('0x1')](_0x73d0('0x2'),_0x73d0('0x3'),_0x73d0('0x4'),_0x73d0('0x5'),'picklist'),'defaultValue':_0x73d0('0x2')},'content':{'type':Sequelize[_0x73d0('0x6')]},'key':{'type':Sequelize[_0x73d0('0x6')]},'keyType':{'type':Sequelize[_0x73d0('0x1')](_0x73d0('0x2'),_0x73d0('0x3'),_0x73d0('0x4'))},'keyContent':{'type':Sequelize[_0x73d0('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x73d0('0x6')]},'customField':{'type':Sequelize[_0x73d0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x73d0('0x6')]}}; \ No newline at end of file +var _0x1aa4=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x50f0e9,_0x2f9300){var _0x12dae4=function(_0x2da321){while(--_0x2da321){_0x50f0e9['push'](_0x50f0e9['shift']());}};_0x12dae4(++_0x2f9300);}(_0x1aa4,0x150));var _0x41aa=function(_0xa97326,_0x4eb65d){_0xa97326=_0xa97326-0x0;var _0x26909a=_0x1aa4[_0xa97326];return _0x26909a;};'use strict';var Sequelize=require(_0x41aa('0x0'));module[_0x41aa('0x1')]={'type':{'type':Sequelize[_0x41aa('0x2')](_0x41aa('0x3'),_0x41aa('0x4'),_0x41aa('0x5'),_0x41aa('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x41aa('0x7')]},'key':{'type':Sequelize[_0x41aa('0x7')]},'keyType':{'type':Sequelize[_0x41aa('0x2')](_0x41aa('0x3'),_0x41aa('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x41aa('0x7')]},'idField':{'type':Sequelize[_0x41aa('0x7')]},'nameField':{'type':Sequelize[_0x41aa('0x7')]},'customField':{'type':Sequelize[_0x41aa('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x41aa('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index f690898..79d709c 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 _0xb619=['pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','stack','name','send','index','map','FreshsalesField','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x4e9500,_0x33fe39){var _0x5affad=function(_0x2247aa){while(--_0x2247aa){_0x4e9500['push'](_0x4e9500['shift']());}};_0x5affad(++_0x33fe39);}(_0xb619,0x12a));var _0x9b61=function(_0x47d1fa,_0x35832e){_0x47d1fa=_0x47d1fa-0x0;var _0x5b7bd4=_0xb619[_0x47d1fa];return _0x5b7bd4;};'use strict';var emlformat=require(_0x9b61('0x0'));var rimraf=require(_0x9b61('0x1'));var zipdir=require(_0x9b61('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9b61('0x3'));var Mustache=require(_0x9b61('0x4'));var util=require(_0x9b61('0x5'));var path=require(_0x9b61('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9b61('0x7'));var fs=require('fs');var fs_extra=require(_0x9b61('0x8'));var _=require('lodash');var squel=require(_0x9b61('0x9'));var crypto=require(_0x9b61('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9b61('0xb'));var querystring=require(_0x9b61('0xc'));var Papa=require(_0x9b61('0xd'));var Redis=require(_0x9b61('0xe'));var authService=require(_0x9b61('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9b61('0x10'));var hardwareService=require(_0x9b61('0x11'));var logger=require(_0x9b61('0x12'))(_0x9b61('0x13'));var utils=require(_0x9b61('0x14'));var config=require(_0x9b61('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b61('0x16'))['db'];function respondWithStatusCode(_0x5b9a8d,_0x5c217f){_0x5c217f=_0x5c217f||0xcc;return function(_0x315bd2){if(_0x315bd2){return _0x5b9a8d[_0x9b61('0x17')](_0x5c217f);}return _0x5b9a8d['status'](_0x5c217f)[_0x9b61('0x18')]();};}function respondWithResult(_0x15d79d,_0x26a415){_0x26a415=_0x26a415||0xc8;return function(_0xed1fce){if(_0xed1fce){return _0x15d79d[_0x9b61('0x19')](_0x26a415)[_0x9b61('0x1a')](_0xed1fce);}};}function respondWithFilteredResult(_0x501555,_0x249bb5){return function(_0x57999b){if(_0x57999b){var _0x52e1de=typeof _0x249bb5['offset']===_0x9b61('0x1b')&&typeof _0x249bb5[_0x9b61('0x1c')]==='undefined';var _0x1ea08a=_0x57999b[_0x9b61('0x1d')];var _0x3b1301=_0x52e1de?0x0:_0x249bb5['offset'];var _0x448200=_0x52e1de?_0x57999b[_0x9b61('0x1d')]:_0x249bb5[_0x9b61('0x1e')]+_0x249bb5[_0x9b61('0x1c')];var _0xc7c35b;if(_0x448200>=_0x1ea08a){_0x448200=_0x1ea08a;_0xc7c35b=0xc8;}else{_0xc7c35b=0xce;}_0x501555['status'](_0xc7c35b);return _0x501555[_0x9b61('0x1f')](_0x9b61('0x20'),_0x3b1301+'-'+_0x448200+'/'+_0x1ea08a)[_0x9b61('0x1a')](_0x57999b);}return null;};}function patchUpdates(_0x4663b2){return function(_0x2dabf0){try{jsonpatch['apply'](_0x2dabf0,_0x4663b2,!![]);}catch(_0x22e283){return BPromise[_0x9b61('0x21')](_0x22e283);}return _0x2dabf0[_0x9b61('0x22')]();};}function saveUpdates(_0x180235,_0x557d34){return function(_0x18f98c){if(_0x18f98c){return _0x18f98c[_0x9b61('0x23')](_0x180235)[_0x9b61('0x24')](function(_0x33305c){return _0x33305c;});}return null;};}function removeEntity(_0x1759ac,_0x29bb4e){return function(_0x50a030){if(_0x50a030){return _0x50a030['destroy']()[_0x9b61('0x24')](function(){_0x1759ac[_0x9b61('0x19')](0xcc)[_0x9b61('0x18')]();});}};}function handleEntityNotFound(_0x42104b,_0x367ef8){return function(_0x24d20c){if(!_0x24d20c){_0x42104b[_0x9b61('0x17')](0x194);}return _0x24d20c;};}function handleError(_0x3c59f9,_0x532932){_0x532932=_0x532932||0x1f4;return function(_0x4c9bed){logger['error'](_0x4c9bed[_0x9b61('0x25')]);if(_0x4c9bed[_0x9b61('0x26')]){delete _0x4c9bed[_0x9b61('0x26')];}_0x3c59f9[_0x9b61('0x19')](_0x532932)[_0x9b61('0x27')](_0x4c9bed);};}exports[_0x9b61('0x28')]=function(_0x35c666,_0x6e6892){var _0x12d61b={},_0x1750cb={},_0xb65983={'count':0x0,'rows':[]};var _0x4d5be4=_[_0x9b61('0x29')](db[_0x9b61('0x2a')][_0x9b61('0x2b')],function(_0x1c3488){return{'name':_0x1c3488['fieldName'],'type':_0x1c3488[_0x9b61('0x2c')]['key']};});_0x1750cb[_0x9b61('0x2d')]=_[_0x9b61('0x29')](_0x4d5be4,_0x9b61('0x26'));_0x1750cb[_0x9b61('0x2e')]=_[_0x9b61('0x2f')](_0x35c666['query']);_0x1750cb[_0x9b61('0x30')]=_[_0x9b61('0x31')](_0x1750cb[_0x9b61('0x2d')],_0x1750cb[_0x9b61('0x2e')]);_0x12d61b[_0x9b61('0x32')]=_[_0x9b61('0x31')](_0x1750cb[_0x9b61('0x2d')],qs[_0x9b61('0x33')](_0x35c666[_0x9b61('0x2e')]['fields']));_0x12d61b[_0x9b61('0x32')]=_0x12d61b['attributes'][_0x9b61('0x34')]?_0x12d61b[_0x9b61('0x32')]:_0x1750cb['model'];if(!_0x35c666['query']['hasOwnProperty'](_0x9b61('0x35'))){_0x12d61b[_0x9b61('0x1c')]=qs['limit'](_0x35c666[_0x9b61('0x2e')][_0x9b61('0x1c')]);_0x12d61b[_0x9b61('0x1e')]=qs[_0x9b61('0x1e')](_0x35c666[_0x9b61('0x2e')]['offset']);}_0x12d61b[_0x9b61('0x36')]=qs[_0x9b61('0x37')](_0x35c666[_0x9b61('0x2e')][_0x9b61('0x37')]);_0x12d61b[_0x9b61('0x38')]=qs[_0x9b61('0x30')](_[_0x9b61('0x39')](_0x35c666[_0x9b61('0x2e')],_0x1750cb[_0x9b61('0x30')]),_0x4d5be4);if(_0x35c666[_0x9b61('0x2e')]['filter']){_0x12d61b['where']=_[_0x9b61('0x3a')](_0x12d61b[_0x9b61('0x38')],{'$or':_[_0x9b61('0x29')](_0x4d5be4,function(_0x16618d){if(_0x16618d['type']!==_0x9b61('0x3b')){var _0xd350b6={};_0xd350b6[_0x16618d['name']]={'$like':'%'+_0x35c666['query'][_0x9b61('0x3c')]+'%'};return _0xd350b6;}})});}_0x12d61b=_[_0x9b61('0x3a')]({},_0x12d61b,_0x35c666[_0x9b61('0x3d')]);var _0x2ca588={'where':_0x12d61b[_0x9b61('0x38')]};return db[_0x9b61('0x2a')][_0x9b61('0x1d')](_0x2ca588)[_0x9b61('0x24')](function(_0x5c5df3){_0xb65983[_0x9b61('0x1d')]=_0x5c5df3;if(_0x35c666[_0x9b61('0x2e')]['includeAll']){_0x12d61b[_0x9b61('0x3e')]=[{'all':!![]}];}return db[_0x9b61('0x2a')][_0x9b61('0x3f')](_0x12d61b);})[_0x9b61('0x24')](function(_0x43174f){_0xb65983['rows']=_0x43174f;return _0xb65983;})[_0x9b61('0x24')](respondWithFilteredResult(_0x6e6892,_0x12d61b))[_0x9b61('0x40')](handleError(_0x6e6892,null));};exports[_0x9b61('0x41')]=function(_0x473bc4,_0x5762bc){var _0x29b1c8={'raw':!![],'where':{'id':_0x473bc4[_0x9b61('0x42')]['id']}},_0x24c594={};_0x24c594['model']=_['keys'](db[_0x9b61('0x2a')]['rawAttributes']);_0x24c594[_0x9b61('0x2e')]=_['keys'](_0x473bc4[_0x9b61('0x2e')]);_0x24c594[_0x9b61('0x30')]=_['intersection'](_0x24c594[_0x9b61('0x2d')],_0x24c594[_0x9b61('0x2e')]);_0x29b1c8[_0x9b61('0x32')]=_[_0x9b61('0x31')](_0x24c594[_0x9b61('0x2d')],qs[_0x9b61('0x33')](_0x473bc4[_0x9b61('0x2e')]['fields']));_0x29b1c8[_0x9b61('0x32')]=_0x29b1c8[_0x9b61('0x32')][_0x9b61('0x34')]?_0x29b1c8[_0x9b61('0x32')]:_0x24c594[_0x9b61('0x2d')];if(_0x473bc4[_0x9b61('0x2e')][_0x9b61('0x43')]){_0x29b1c8[_0x9b61('0x3e')]=[{'all':!![]}];}_0x29b1c8=_['merge']({},_0x29b1c8,_0x473bc4[_0x9b61('0x3d')]);return db[_0x9b61('0x2a')][_0x9b61('0x44')](_0x29b1c8)[_0x9b61('0x24')](handleEntityNotFound(_0x5762bc,null))[_0x9b61('0x24')](respondWithResult(_0x5762bc,null))[_0x9b61('0x40')](handleError(_0x5762bc,null));};exports[_0x9b61('0x45')]=function(_0x5c3673,_0x410777){return db[_0x9b61('0x2a')][_0x9b61('0x45')](_0x5c3673[_0x9b61('0x46')],{})['then'](respondWithResult(_0x410777,0xc9))[_0x9b61('0x40')](handleError(_0x410777,null));};exports[_0x9b61('0x23')]=function(_0x5e2db6,_0x18027d){if(_0x5e2db6[_0x9b61('0x46')]['id']){delete _0x5e2db6['body']['id'];}return db[_0x9b61('0x2a')][_0x9b61('0x44')]({'where':{'id':_0x5e2db6[_0x9b61('0x42')]['id']}})[_0x9b61('0x24')](handleEntityNotFound(_0x18027d,null))[_0x9b61('0x24')](saveUpdates(_0x5e2db6['body'],null))['then'](respondWithResult(_0x18027d,null))[_0x9b61('0x40')](handleError(_0x18027d,null));};exports['destroy']=function(_0x4625ce,_0xfe6480){return db[_0x9b61('0x2a')][_0x9b61('0x44')]({'where':{'id':_0x4625ce[_0x9b61('0x42')]['id']}})[_0x9b61('0x24')](handleEntityNotFound(_0xfe6480,null))[_0x9b61('0x24')](removeEntity(_0xfe6480,null))[_0x9b61('0x40')](handleError(_0xfe6480,null));}; \ No newline at end of file +var _0x9e0d=['rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','limit','undefined','count','offset','Content-Range','apply','update','then','destroy','sendStatus','error','name','send','index','FreshsalesField','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','pick','filter','merge','map','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','find','body','eml-format'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9e0d,0xc2));var _0xd9e0=function(_0x3ba7ef,_0x30e182){_0x3ba7ef=_0x3ba7ef-0x0;var _0x27343f=_0x9e0d[_0x3ba7ef];return _0x27343f;};'use strict';var emlformat=require(_0xd9e0('0x0'));var rimraf=require(_0xd9e0('0x1'));var zipdir=require(_0xd9e0('0x2'));var jsonpatch=require(_0xd9e0('0x3'));var rp=require(_0xd9e0('0x4'));var moment=require(_0xd9e0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd9e0('0x6'));var sox=require('sox');var csv=require(_0xd9e0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd9e0('0x8'));var _=require('lodash');var squel=require(_0xd9e0('0x9'));var crypto=require(_0xd9e0('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd9e0('0x7'));var querystring=require(_0xd9e0('0xb'));var Papa=require(_0xd9e0('0xc'));var Redis=require(_0xd9e0('0xd'));var authService=require(_0xd9e0('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9e0('0xf'));var logger=require(_0xd9e0('0x10'))(_0xd9e0('0x11'));var utils=require(_0xd9e0('0x12'));var config=require(_0xd9e0('0x13'));var licenseUtil=require(_0xd9e0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1217d4,_0x108f9b){_0x108f9b=_0x108f9b||0xcc;return function(_0x135983){if(_0x135983){return _0x1217d4['sendStatus'](_0x108f9b);}return _0x1217d4[_0xd9e0('0x15')](_0x108f9b)[_0xd9e0('0x16')]();};}function respondWithResult(_0x1ad561,_0x4a061f){_0x4a061f=_0x4a061f||0xc8;return function(_0x4d02cc){if(_0x4d02cc){return _0x1ad561[_0xd9e0('0x15')](_0x4a061f)['json'](_0x4d02cc);}};}function respondWithFilteredResult(_0x2096dd,_0x585604){return function(_0x8a0b1b){if(_0x8a0b1b){var _0x3009e4=typeof _0x585604['offset']==='undefined'&&typeof _0x585604[_0xd9e0('0x17')]===_0xd9e0('0x18');var _0x11ddde=_0x8a0b1b[_0xd9e0('0x19')];var _0x16ec55=_0x3009e4?0x0:_0x585604[_0xd9e0('0x1a')];var _0x55c177=_0x3009e4?_0x8a0b1b['count']:_0x585604[_0xd9e0('0x1a')]+_0x585604[_0xd9e0('0x17')];var _0x1a96ba;if(_0x55c177>=_0x11ddde){_0x55c177=_0x11ddde;_0x1a96ba=0xc8;}else{_0x1a96ba=0xce;}_0x2096dd['status'](_0x1a96ba);return _0x2096dd['set'](_0xd9e0('0x1b'),_0x16ec55+'-'+_0x55c177+'/'+_0x11ddde)['json'](_0x8a0b1b);}return null;};}function patchUpdates(_0x561999){return function(_0x150a14){try{jsonpatch[_0xd9e0('0x1c')](_0x150a14,_0x561999,!![]);}catch(_0x5768e5){return BPromise['reject'](_0x5768e5);}return _0x150a14['save']();};}function saveUpdates(_0x817b36,_0xfaa6ce){return function(_0x20e64e){if(_0x20e64e){return _0x20e64e[_0xd9e0('0x1d')](_0x817b36)[_0xd9e0('0x1e')](function(_0xa007f2){return _0xa007f2;});}return null;};}function removeEntity(_0x544bc2,_0x28b589){return function(_0x2ba5d1){if(_0x2ba5d1){return _0x2ba5d1[_0xd9e0('0x1f')]()[_0xd9e0('0x1e')](function(){_0x544bc2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bf2a7,_0x58161f){return function(_0x419b93){if(!_0x419b93){_0x2bf2a7[_0xd9e0('0x20')](0x194);}return _0x419b93;};}function handleError(_0x9d074,_0x5a55fa){_0x5a55fa=_0x5a55fa||0x1f4;return function(_0x49160b){logger[_0xd9e0('0x21')](_0x49160b['stack']);if(_0x49160b[_0xd9e0('0x22')]){delete _0x49160b[_0xd9e0('0x22')];}_0x9d074[_0xd9e0('0x15')](_0x5a55fa)[_0xd9e0('0x23')](_0x49160b);};}exports[_0xd9e0('0x24')]=function(_0x4f9ae1,_0x528682){var _0x44a6b1={},_0xd99c08={},_0x3a2835={'count':0x0,'rows':[]};var _0x314753=_['map'](db[_0xd9e0('0x25')][_0xd9e0('0x26')],function(_0x524e19){return{'name':_0x524e19[_0xd9e0('0x27')],'type':_0x524e19['type']['key']};});_0xd99c08[_0xd9e0('0x28')]=_['map'](_0x314753,'name');_0xd99c08['query']=_[_0xd9e0('0x29')](_0x4f9ae1[_0xd9e0('0x2a')]);_0xd99c08[_0xd9e0('0x2b')]=_[_0xd9e0('0x2c')](_0xd99c08[_0xd9e0('0x28')],_0xd99c08[_0xd9e0('0x2a')]);_0x44a6b1[_0xd9e0('0x2d')]=_[_0xd9e0('0x2c')](_0xd99c08[_0xd9e0('0x28')],qs[_0xd9e0('0x2e')](_0x4f9ae1[_0xd9e0('0x2a')][_0xd9e0('0x2e')]));_0x44a6b1[_0xd9e0('0x2d')]=_0x44a6b1[_0xd9e0('0x2d')]['length']?_0x44a6b1[_0xd9e0('0x2d')]:_0xd99c08[_0xd9e0('0x28')];if(!_0x4f9ae1['query']['hasOwnProperty'](_0xd9e0('0x2f'))){_0x44a6b1[_0xd9e0('0x17')]=qs[_0xd9e0('0x17')](_0x4f9ae1[_0xd9e0('0x2a')][_0xd9e0('0x17')]);_0x44a6b1['offset']=qs[_0xd9e0('0x1a')](_0x4f9ae1[_0xd9e0('0x2a')]['offset']);}_0x44a6b1['order']=qs['sort'](_0x4f9ae1[_0xd9e0('0x2a')][_0xd9e0('0x30')]);_0x44a6b1['where']=qs[_0xd9e0('0x2b')](_[_0xd9e0('0x31')](_0x4f9ae1[_0xd9e0('0x2a')],_0xd99c08[_0xd9e0('0x2b')]),_0x314753);if(_0x4f9ae1[_0xd9e0('0x2a')][_0xd9e0('0x32')]){_0x44a6b1['where']=_[_0xd9e0('0x33')](_0x44a6b1['where'],{'$or':_[_0xd9e0('0x34')](_0x314753,function(_0x3dd491){if(_0x3dd491['type']!==_0xd9e0('0x35')){var _0x17161d={};_0x17161d[_0x3dd491['name']]={'$like':'%'+_0x4f9ae1[_0xd9e0('0x2a')][_0xd9e0('0x32')]+'%'};return _0x17161d;}})});}_0x44a6b1=_[_0xd9e0('0x33')]({},_0x44a6b1,_0x4f9ae1[_0xd9e0('0x36')]);var _0x554440={'where':_0x44a6b1[_0xd9e0('0x37')]};return db[_0xd9e0('0x25')]['count'](_0x554440)['then'](function(_0x5bbfae){_0x3a2835[_0xd9e0('0x19')]=_0x5bbfae;if(_0x4f9ae1[_0xd9e0('0x2a')][_0xd9e0('0x38')]){_0x44a6b1[_0xd9e0('0x39')]=[{'all':!![]}];}return db[_0xd9e0('0x25')][_0xd9e0('0x3a')](_0x44a6b1);})[_0xd9e0('0x1e')](function(_0x57d0b7){_0x3a2835[_0xd9e0('0x3b')]=_0x57d0b7;return _0x3a2835;})['then'](respondWithFilteredResult(_0x528682,_0x44a6b1))[_0xd9e0('0x3c')](handleError(_0x528682,null));};exports[_0xd9e0('0x3d')]=function(_0xdadd6a,_0x3dd1a0){var _0x2d226c={'raw':!![],'where':{'id':_0xdadd6a[_0xd9e0('0x3e')]['id']}},_0x21ac0e={};_0x21ac0e['model']=_[_0xd9e0('0x29')](db[_0xd9e0('0x25')][_0xd9e0('0x26')]);_0x21ac0e[_0xd9e0('0x2a')]=_[_0xd9e0('0x29')](_0xdadd6a[_0xd9e0('0x2a')]);_0x21ac0e[_0xd9e0('0x2b')]=_[_0xd9e0('0x2c')](_0x21ac0e[_0xd9e0('0x28')],_0x21ac0e['query']);_0x2d226c[_0xd9e0('0x2d')]=_['intersection'](_0x21ac0e['model'],qs[_0xd9e0('0x2e')](_0xdadd6a[_0xd9e0('0x2a')][_0xd9e0('0x2e')]));_0x2d226c[_0xd9e0('0x2d')]=_0x2d226c['attributes']['length']?_0x2d226c[_0xd9e0('0x2d')]:_0x21ac0e[_0xd9e0('0x28')];if(_0xdadd6a[_0xd9e0('0x2a')][_0xd9e0('0x38')]){_0x2d226c[_0xd9e0('0x39')]=[{'all':!![]}];}_0x2d226c=_[_0xd9e0('0x33')]({},_0x2d226c,_0xdadd6a['options']);return db[_0xd9e0('0x25')][_0xd9e0('0x3f')](_0x2d226c)[_0xd9e0('0x1e')](handleEntityNotFound(_0x3dd1a0,null))[_0xd9e0('0x1e')](respondWithResult(_0x3dd1a0,null))[_0xd9e0('0x3c')](handleError(_0x3dd1a0,null));};exports['create']=function(_0x15bd75,_0x91a96e){return db[_0xd9e0('0x25')]['create'](_0x15bd75[_0xd9e0('0x40')],{})[_0xd9e0('0x1e')](respondWithResult(_0x91a96e,0xc9))[_0xd9e0('0x3c')](handleError(_0x91a96e,null));};exports['update']=function(_0x46e17f,_0x523b19){if(_0x46e17f[_0xd9e0('0x40')]['id']){delete _0x46e17f[_0xd9e0('0x40')]['id'];}return db[_0xd9e0('0x25')][_0xd9e0('0x3f')]({'where':{'id':_0x46e17f[_0xd9e0('0x3e')]['id']}})['then'](handleEntityNotFound(_0x523b19,null))['then'](saveUpdates(_0x46e17f[_0xd9e0('0x40')],null))[_0xd9e0('0x1e')](respondWithResult(_0x523b19,null))['catch'](handleError(_0x523b19,null));};exports[_0xd9e0('0x1f')]=function(_0x2fb40f,_0x4bd435){return db[_0xd9e0('0x25')][_0xd9e0('0x3f')]({'where':{'id':_0x2fb40f['params']['id']}})[_0xd9e0('0x1e')](handleEntityNotFound(_0x4bd435,null))[_0xd9e0('0x1e')](removeEntity(_0x4bd435,null))[_0xd9e0('0x3c')](handleError(_0x4bd435,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 0543356..ead5b0e 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 _0x8383=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','FieldId','lodash','api'];(function(_0x53eba7,_0x38744c){var _0x32491b=function(_0x61ea1d){while(--_0x61ea1d){_0x53eba7['push'](_0x53eba7['shift']());}};_0x32491b(++_0x38744c);}(_0x8383,0x98));var _0x3838=function(_0x251d73,_0x17d1a1){_0x251d73=_0x251d73-0x0;var _0x194446=_0x8383[_0x251d73];return _0x194446;};'use strict';var _=require(_0x3838('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3838('0x1'));var moment=require(_0x3838('0x2'));var BPromise=require(_0x3838('0x3'));var rp=require(_0x3838('0x4'));var fs=require('fs');var path=require(_0x3838('0x5'));var rimraf=require(_0x3838('0x6'));var config=require(_0x3838('0x7'));var attributes=require(_0x3838('0x8'));module[_0x3838('0x9')]=function(_0x7a4cc0,_0x509656){return _0x7a4cc0[_0x3838('0xa')](_0x3838('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x3838('0xc'),'fields':['idField',_0x3838('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x430c=['api','moment','bluebird','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash'];(function(_0x35bbce,_0x1e7dd6){var _0x30209e=function(_0x411c7e){while(--_0x411c7e){_0x35bbce['push'](_0x35bbce['shift']());}};_0x30209e(++_0x1e7dd6);}(_0x430c,0x1a1));var _0xc430=function(_0x2c534a,_0x18a19e){_0x2c534a=_0x2c534a-0x0;var _0x3f5c99=_0x430c[_0x2c534a];return _0x3f5c99;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('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(_0xc430('0x4'));module[_0xc430('0x5')]=function(_0x50b256,_0x42aa9c){return _0x50b256['define'](_0xc430('0x6'),attributes,{'tableName':_0xc430('0x7'),'paranoid':![],'indexes':[{'name':_0xc430('0x8'),'fields':[_0xc430('0x9'),_0xc430('0xa')],'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 61d090b..d11369f 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 _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x740fde,_0x490c95){var _0x15199f=function(_0x2f731c){while(--_0x2f731c){_0x740fde['push'](_0x740fde['shift']());}};_0x15199f(++_0x490c95);}(_0x33af,0xec));var _0xf33a=function(_0x4498a2,_0x143689){_0x4498a2=_0x4498a2-0x0;var _0x411aa8=_0x33af[_0x4498a2];return _0x411aa8;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});} \ No newline at end of file +var _0xe2fe=['then','info','FreshsalesField,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x4c5076,_0x52c9fc){var _0x58ac33=function(_0x1c38fc){while(--_0x1c38fc){_0x4c5076['push'](_0x4c5076['shift']());}};_0x58ac33(++_0x52c9fc);}(_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']('FreshsalesField,\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/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index d904c93..e285a39 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x2a1aba,_0x35bcd2){var _0x4a07ec=function(_0x30a0bd){while(--_0x30a0bd){_0x2a1aba['push'](_0x2a1aba['shift']());}};_0x4a07ec(++_0x35bcd2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3567dc,_0x26114f){var _0x17ff58=function(_0x3c1228){while(--_0x3c1228){_0x3567dc['push'](_0x3567dc['shift']());}};_0x17ff58(++_0x26114f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 5c56cd2..d4e7bac 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 _0xbd1c=['exports','STRING','username','ENUM','newTab','integrationTab'];(function(_0xe4d6c6,_0x3bdbf2){var _0x3a8935=function(_0x131483){while(--_0x131483){_0xe4d6c6['push'](_0xe4d6c6['shift']());}};_0x3a8935(++_0x3bdbf2);}(_0xbd1c,0x144));var _0xcbd1=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xbd1c[_0x35da42];return _0x370035;};'use strict';var Sequelize=require('sequelize');module[_0xcbd1('0x0')]={'name':{'type':Sequelize[_0xcbd1('0x1')]},'description':{'type':Sequelize[_0xcbd1('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xcbd1('0x2')},'remoteUri':{'type':Sequelize[_0xcbd1('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xcbd1('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xcbd1('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xcbd1('0x3')]('integrationTab',_0xcbd1('0x4')),'defaultValue':_0xcbd1('0x5')}}; \ No newline at end of file +var _0x0fc9=['integrationTab','sequelize','exports','STRING','username','ENUM','newTab'];(function(_0x3c0397,_0x259f7f){var _0x208e88=function(_0x19c007){while(--_0x19c007){_0x3c0397['push'](_0x3c0397['shift']());}};_0x208e88(++_0x259f7f);}(_0x0fc9,0x15f));var _0x90fc=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x0fc9[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0x90fc('0x0'));module[_0x90fc('0x1')]={'name':{'type':Sequelize[_0x90fc('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x90fc('0x2')],'unique':_0x90fc('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x90fc('0x2')]},'clientId':{'type':Sequelize[_0x90fc('0x2')]},'clientSecret':{'type':Sequelize[_0x90fc('0x2')]},'securityToken':{'type':Sequelize[_0x90fc('0x2')]},'serverUrl':{'type':Sequelize[_0x90fc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x90fc('0x4')]('integrationTab',_0x90fc('0x5')),'defaultValue':_0x90fc('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index e6219ea..17df7cd 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 _0x7ad9=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceAccount','findAll','rows','catch','includeAll','find','create','body','params','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','concat','isNil','ticketType','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','statusCode','stringify','send','test','Wrong\x20credentials','eml-format','rimraf'];(function(_0x2005e8,_0x5afc06){var _0x37e23d=function(_0x68bf58){while(--_0x68bf58){_0x2005e8['push'](_0x2005e8['shift']());}};_0x37e23d(++_0x5afc06);}(_0x7ad9,0x16f));var _0x97ad=function(_0x1a8c35,_0x3b9146){_0x1a8c35=_0x1a8c35-0x0;var _0x3172e4=_0x7ad9[_0x1a8c35];return _0x3172e4;};'use strict';var emlformat=require(_0x97ad('0x0'));var rimraf=require(_0x97ad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x97ad('0x2'));var rp=require(_0x97ad('0x3'));var moment=require(_0x97ad('0x4'));var BPromise=require(_0x97ad('0x5'));var Mustache=require(_0x97ad('0x6'));var util=require('util');var path=require(_0x97ad('0x7'));var sox=require(_0x97ad('0x8'));var csv=require('to-csv');var ejs=require(_0x97ad('0x9'));var fs=require('fs');var fs_extra=require(_0x97ad('0xa'));var _=require(_0x97ad('0xb'));var squel=require(_0x97ad('0xc'));var crypto=require('crypto');var jsforce=require(_0x97ad('0xd'));var deskjs=require(_0x97ad('0xe'));var toCsv=require(_0x97ad('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x97ad('0x10'));var authService=require(_0x97ad('0x11'));var qs=require(_0x97ad('0x12'));var as=require(_0x97ad('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97ad('0x14'))(_0x97ad('0x15'));var utils=require(_0x97ad('0x16'));var config=require(_0x97ad('0x17'));var licenseUtil=require(_0x97ad('0x18'));var db=require(_0x97ad('0x19'))['db'];var integrations=require(_0x97ad('0x1a'));function respondWithStatusCode(_0x2686a9,_0x5a1717){_0x5a1717=_0x5a1717||0xcc;return function(_0x45c625){if(_0x45c625){return _0x2686a9[_0x97ad('0x1b')](_0x5a1717);}return _0x2686a9[_0x97ad('0x1c')](_0x5a1717)[_0x97ad('0x1d')]();};}function respondWithResult(_0x2c3ec0,_0x216806){_0x216806=_0x216806||0xc8;return function(_0x142989){if(_0x142989){return _0x2c3ec0[_0x97ad('0x1c')](_0x216806)[_0x97ad('0x1e')](_0x142989);}};}function respondWithFilteredResult(_0x247c9e,_0x464c12){return function(_0x18dc12){if(_0x18dc12){var _0x5c0d37=typeof _0x464c12[_0x97ad('0x1f')]==='undefined'&&typeof _0x464c12[_0x97ad('0x20')]===_0x97ad('0x21');var _0x42b829=_0x18dc12[_0x97ad('0x22')];var _0x1e9bea=_0x5c0d37?0x0:_0x464c12[_0x97ad('0x1f')];var _0x9230ca=_0x5c0d37?_0x18dc12[_0x97ad('0x22')]:_0x464c12[_0x97ad('0x1f')]+_0x464c12[_0x97ad('0x20')];var _0x4de77f;if(_0x9230ca>=_0x42b829){_0x9230ca=_0x42b829;_0x4de77f=0xc8;}else{_0x4de77f=0xce;}_0x247c9e[_0x97ad('0x1c')](_0x4de77f);return _0x247c9e[_0x97ad('0x23')](_0x97ad('0x24'),_0x1e9bea+'-'+_0x9230ca+'/'+_0x42b829)[_0x97ad('0x1e')](_0x18dc12);}return null;};}function patchUpdates(_0x56fcf5){return function(_0xa6d8c1){try{jsonpatch[_0x97ad('0x25')](_0xa6d8c1,_0x56fcf5,!![]);}catch(_0x9f8d71){return BPromise['reject'](_0x9f8d71);}return _0xa6d8c1[_0x97ad('0x26')]();};}function saveUpdates(_0xbad85e,_0x2b05c7){return function(_0x36cd39){if(_0x36cd39){return _0x36cd39[_0x97ad('0x27')](_0xbad85e)['then'](function(_0x487d2d){return _0x487d2d;});}return null;};}function removeEntity(_0x2e7549,_0xb77139){return function(_0x10f4ed){if(_0x10f4ed){return _0x10f4ed[_0x97ad('0x28')]()[_0x97ad('0x29')](function(){_0x2e7549['status'](0xcc)[_0x97ad('0x1d')]();});}};}function handleEntityNotFound(_0x5b9802,_0x2bdba7){return function(_0x430b){if(!_0x430b){_0x5b9802[_0x97ad('0x1b')](0x194);}return _0x430b;};}function handleError(_0x92788f,_0x33589a){_0x33589a=_0x33589a||0x1f4;return function(_0x38debb){logger[_0x97ad('0x2a')](_0x38debb[_0x97ad('0x2b')]);if(_0x38debb[_0x97ad('0x2c')]){delete _0x38debb[_0x97ad('0x2c')];}_0x92788f[_0x97ad('0x1c')](_0x33589a)['send'](_0x38debb);};}exports['index']=function(_0xb825d9,_0x2c7ddc){var _0x19b3dd={},_0x18f85a={},_0x1b05ae={'count':0x0,'rows':[]};var _0x155ff9=_[_0x97ad('0x2d')](db['SalesforceAccount'][_0x97ad('0x2e')],function(_0x5789c6){return{'name':_0x5789c6[_0x97ad('0x2f')],'type':_0x5789c6[_0x97ad('0x30')][_0x97ad('0x31')]};});_0x18f85a[_0x97ad('0x32')]=_['map'](_0x155ff9,_0x97ad('0x2c'));_0x18f85a[_0x97ad('0x33')]=_[_0x97ad('0x34')](_0xb825d9[_0x97ad('0x33')]);_0x18f85a[_0x97ad('0x35')]=_[_0x97ad('0x36')](_0x18f85a[_0x97ad('0x32')],_0x18f85a[_0x97ad('0x33')]);_0x19b3dd[_0x97ad('0x37')]=_[_0x97ad('0x36')](_0x18f85a['model'],qs[_0x97ad('0x38')](_0xb825d9[_0x97ad('0x33')]['fields']));_0x19b3dd[_0x97ad('0x37')]=_0x19b3dd[_0x97ad('0x37')][_0x97ad('0x39')]?_0x19b3dd[_0x97ad('0x37')]:_0x18f85a['model'];if(!_0xb825d9[_0x97ad('0x33')][_0x97ad('0x3a')](_0x97ad('0x3b'))){_0x19b3dd['limit']=qs[_0x97ad('0x20')](_0xb825d9[_0x97ad('0x33')][_0x97ad('0x20')]);_0x19b3dd[_0x97ad('0x1f')]=qs['offset'](_0xb825d9[_0x97ad('0x33')][_0x97ad('0x1f')]);}_0x19b3dd[_0x97ad('0x3c')]=qs[_0x97ad('0x3d')](_0xb825d9[_0x97ad('0x33')]['sort']);_0x19b3dd[_0x97ad('0x3e')]=qs[_0x97ad('0x35')](_[_0x97ad('0x3f')](_0xb825d9[_0x97ad('0x33')],_0x18f85a[_0x97ad('0x35')]),_0x155ff9);if(_0xb825d9[_0x97ad('0x33')][_0x97ad('0x40')]){_0x19b3dd[_0x97ad('0x3e')]=_[_0x97ad('0x41')](_0x19b3dd[_0x97ad('0x3e')],{'$or':_['map'](_0x155ff9,function(_0x367bcd){if(_0x367bcd['type']!==_0x97ad('0x42')){var _0x15fbc1={};_0x15fbc1[_0x367bcd[_0x97ad('0x2c')]]={'$like':'%'+_0xb825d9['query'][_0x97ad('0x40')]+'%'};return _0x15fbc1;}})});}_0x19b3dd=_[_0x97ad('0x41')]({},_0x19b3dd,_0xb825d9[_0x97ad('0x43')]);var _0x10348c={'where':_0x19b3dd[_0x97ad('0x3e')]};return db[_0x97ad('0x44')][_0x97ad('0x22')](_0x10348c)[_0x97ad('0x29')](function(_0xeb3791){_0x1b05ae[_0x97ad('0x22')]=_0xeb3791;if(_0xb825d9[_0x97ad('0x33')]['includeAll']){_0x19b3dd['include']=[{'all':!![]}];}return db[_0x97ad('0x44')][_0x97ad('0x45')](_0x19b3dd);})['then'](function(_0x39f531){_0x1b05ae[_0x97ad('0x46')]=_0x39f531;return _0x1b05ae;})[_0x97ad('0x29')](respondWithFilteredResult(_0x2c7ddc,_0x19b3dd))[_0x97ad('0x47')](handleError(_0x2c7ddc,null));};exports['show']=function(_0x23facb,_0x161387){var _0x531690={'raw':![],'where':{'id':_0x23facb['params']['id']}},_0x491ab7={};_0x491ab7['model']=_[_0x97ad('0x34')](db[_0x97ad('0x44')][_0x97ad('0x2e')]);_0x491ab7['query']=_[_0x97ad('0x34')](_0x23facb[_0x97ad('0x33')]);_0x491ab7[_0x97ad('0x35')]=_[_0x97ad('0x36')](_0x491ab7[_0x97ad('0x32')],_0x491ab7[_0x97ad('0x33')]);_0x531690[_0x97ad('0x37')]=_[_0x97ad('0x36')](_0x491ab7[_0x97ad('0x32')],qs[_0x97ad('0x38')](_0x23facb[_0x97ad('0x33')][_0x97ad('0x38')]));_0x531690[_0x97ad('0x37')]=_0x531690[_0x97ad('0x37')][_0x97ad('0x39')]?_0x531690[_0x97ad('0x37')]:_0x491ab7[_0x97ad('0x32')];if(_0x23facb[_0x97ad('0x33')][_0x97ad('0x48')]){_0x531690['include']=[{'all':!![]}];}_0x531690=_[_0x97ad('0x41')]({},_0x531690,_0x23facb[_0x97ad('0x43')]);return db['SalesforceAccount'][_0x97ad('0x49')](_0x531690)[_0x97ad('0x29')](handleEntityNotFound(_0x161387,null))[_0x97ad('0x29')](respondWithResult(_0x161387,null))[_0x97ad('0x47')](handleError(_0x161387,null));};exports[_0x97ad('0x4a')]=function(_0x3526c1,_0x89deed){return db[_0x97ad('0x44')]['create'](_0x3526c1[_0x97ad('0x4b')],{})[_0x97ad('0x29')](respondWithResult(_0x89deed,0xc9))[_0x97ad('0x47')](handleError(_0x89deed,null));};exports[_0x97ad('0x27')]=function(_0x51982c,_0x188dec){if(_0x51982c[_0x97ad('0x4b')]['id']){delete _0x51982c[_0x97ad('0x4b')]['id'];}return db[_0x97ad('0x44')]['find']({'where':{'id':_0x51982c['params']['id']}})[_0x97ad('0x29')](handleEntityNotFound(_0x188dec,null))[_0x97ad('0x29')](saveUpdates(_0x51982c['body'],null))[_0x97ad('0x29')](respondWithResult(_0x188dec,null))[_0x97ad('0x47')](handleError(_0x188dec,null));};exports[_0x97ad('0x28')]=function(_0x4d6d51,_0x37705b){return db[_0x97ad('0x44')][_0x97ad('0x49')]({'where':{'id':_0x4d6d51[_0x97ad('0x4c')]['id']}})['then'](handleEntityNotFound(_0x37705b,null))[_0x97ad('0x29')](removeEntity(_0x37705b,null))[_0x97ad('0x47')](handleError(_0x37705b,null));};exports[_0x97ad('0x4d')]=function(_0x146e5e,_0x34ef73,_0x405dc6){var _0x1c0b84={};var _0x523038={};var _0x3f4687;var _0x2cb048;return db['SalesforceAccount'][_0x97ad('0x4e')]({'where':{'id':_0x146e5e[_0x97ad('0x4c')]['id']}})[_0x97ad('0x29')](handleEntityNotFound(_0x34ef73,null))[_0x97ad('0x29')](function(_0xa5bc3c){if(_0xa5bc3c){_0x3f4687=_0xa5bc3c;_0x523038[_0x97ad('0x32')]=_[_0x97ad('0x34')](db['SalesforceConfiguration']['rawAttributes']);_0x523038['query']=_['keys'](_0x146e5e[_0x97ad('0x33')]);_0x523038['filters']=_[_0x97ad('0x36')](_0x523038[_0x97ad('0x32')],_0x523038['query']);_0x1c0b84[_0x97ad('0x37')]=_['intersection'](_0x523038[_0x97ad('0x32')],qs[_0x97ad('0x38')](_0x146e5e[_0x97ad('0x33')][_0x97ad('0x38')]));_0x1c0b84[_0x97ad('0x37')]=_0x1c0b84['attributes'][_0x97ad('0x39')]?_0x1c0b84[_0x97ad('0x37')]:_0x523038[_0x97ad('0x32')];_0x1c0b84[_0x97ad('0x3c')]=qs[_0x97ad('0x3d')](_0x146e5e['query'][_0x97ad('0x3d')]);_0x1c0b84['where']=qs[_0x97ad('0x35')](_['pick'](_0x146e5e[_0x97ad('0x33')],_0x523038['filters']));if(_0x146e5e[_0x97ad('0x33')]['filter']){_0x1c0b84[_0x97ad('0x3e')]=_[_0x97ad('0x41')](_0x1c0b84[_0x97ad('0x3e')],{'$or':_[_0x97ad('0x2d')](_0x1c0b84[_0x97ad('0x37')],function(_0x5f2b0d){var _0x36bb9d={};_0x36bb9d[_0x5f2b0d]={'$like':'%'+_0x146e5e[_0x97ad('0x33')][_0x97ad('0x40')]+'%'};return _0x36bb9d;})});}_0x1c0b84=_['merge']({},_0x1c0b84,_0x146e5e[_0x97ad('0x43')]);return _0x3f4687[_0x97ad('0x4d')](_0x1c0b84);}})['then'](function(_0x5a37c8){if(_0x5a37c8){_0x2cb048=_0x5a37c8[_0x97ad('0x39')];if(!_0x146e5e['query'][_0x97ad('0x3a')](_0x97ad('0x3b'))){_0x1c0b84['limit']=qs['limit'](_0x146e5e[_0x97ad('0x33')][_0x97ad('0x20')]);_0x1c0b84[_0x97ad('0x1f')]=qs[_0x97ad('0x1f')](_0x146e5e[_0x97ad('0x33')][_0x97ad('0x1f')]);}return _0x3f4687['getConfigurations'](_0x1c0b84);}})[_0x97ad('0x29')](function(_0x26e079){if(_0x26e079){return _0x26e079?{'count':_0x2cb048,'rows':_0x26e079}:null;}})[_0x97ad('0x29')](respondWithResult(_0x34ef73,null))[_0x97ad('0x47')](handleError(_0x34ef73,null));};exports[_0x97ad('0x4f')]=function(_0x296b2b,_0x147ff7,_0x25ae89){if(_0x296b2b['body']['id']){delete _0x296b2b['body']['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x296b2b[_0x97ad('0x4c')]['id']}})[_0x97ad('0x29')](handleEntityNotFound(_0x147ff7,null))[_0x97ad('0x29')](function(_0x5b6a55){if(_0x5b6a55){_0x296b2b[_0x97ad('0x4b')][_0x97ad('0x50')]=_0x5b6a55['id'];_0x296b2b[_0x97ad('0x4b')][_0x97ad('0x51')]=integrations[_0x97ad('0x52')](_0x296b2b[_0x97ad('0x4b')]['channel'],_0x296b2b[_0x97ad('0x4b')][_0x97ad('0x30')]);_0x296b2b['body']['Descriptions']=integrations[_0x97ad('0x53')](_0x296b2b[_0x97ad('0x4b')][_0x97ad('0x54')],_0x296b2b[_0x97ad('0x4b')][_0x97ad('0x30')]);return db['SalesforceConfiguration'][_0x97ad('0x4a')](_0x296b2b['body'],{'include':[{'model':db[_0x97ad('0x55')],'as':_0x97ad('0x51')},{'model':db[_0x97ad('0x55')],'as':'Descriptions'}]});}return null;})[_0x97ad('0x29')](respondWithResult(_0x147ff7,null))[_0x97ad('0x47')](handleError(_0x147ff7,null));};exports[_0x97ad('0x56')]=function(_0x359f58,_0x3da758,_0x587322){var _0x4f92b8;var _0x39ea18='';var _0x374f6c=_0x97ad('0x57');return db['SalesforceAccount'][_0x97ad('0x4e')]({'where':{'id':_0x359f58[_0x97ad('0x4c')]['id']},'attributes':['id',_0x97ad('0x58'),'clientId',_0x97ad('0x59'),_0x97ad('0x5a'),_0x97ad('0x5b'),_0x97ad('0x5c')]})[_0x97ad('0x29')](handleEntityNotFound(_0x3da758,null))['then'](function(_0x2b6b8f){if(_0x2b6b8f){_0x39ea18=_0x2b6b8f[_0x97ad('0x58')];var _0x3c989a=_0x39ea18[_0x97ad('0x5d')](-0x1);if(_0x3c989a==='/'){_0x39ea18=_0x39ea18[_0x97ad('0x5e')](0x0,_0x39ea18[_0x97ad('0x5f')](_0x3c989a));}_0x4f92b8=new jsforce[(_0x97ad('0x60'))]({'oauth2':{'loginUrl':_0x39ea18,'clientId':_0x2b6b8f['clientId'],'clientSecret':_0x2b6b8f[_0x97ad('0x59')]}});return _0x4f92b8['login'](_0x2b6b8f[_0x97ad('0x5a')],_0x2b6b8f[_0x97ad('0x5b')][_0x97ad('0x61')](_0x2b6b8f[_0x97ad('0x5c')]));}})['then'](function(_0x1cc79d){if(_0x1cc79d){if(!_[_0x97ad('0x62')](_0x359f58[_0x97ad('0x33')][_0x97ad('0x63')])){_0x374f6c=_0x359f58[_0x97ad('0x33')]['ticketType'];}return _0x4f92b8['sobject'](_0x374f6c)['describe']();}})['then'](function(_0x4d3404){var _0x249fc2=[_0x97ad('0x64'),_0x97ad('0x65'),_0x97ad('0x66'),_0x97ad('0x67'),_0x97ad('0x68'),_0x97ad('0x69')];var _0x24195b=['string','int','picklist',_0x97ad('0x6a'),_0x97ad('0x6b'),_0x97ad('0x6c'),_0x97ad('0x6d')];if(_0x4d3404){_[_0x97ad('0x6e')](_0x4d3404[_0x97ad('0x38')],function(_0xcd7b64){return _0x249fc2['includes'](_0xcd7b64[_0x97ad('0x2c')])||!_0x24195b[_0x97ad('0x6f')](_0xcd7b64[_0x97ad('0x30')]);});return{'count':_0x4d3404[_0x97ad('0x38')][_0x97ad('0x39')],'rows':_['map'](_0x4d3404[_0x97ad('0x38')],function(_0x200af6){return{'id':_0x200af6[_0x97ad('0x2c')],'name':_0x200af6[_0x97ad('0x70')],'custom':_0x200af6[_0x97ad('0x71')],'options':_0x200af6[_0x97ad('0x72')][_0x97ad('0x39')]>0x0?_[_0x97ad('0x2d')](_0x200af6[_0x97ad('0x72')],function(_0x2bfae8){return{'name':_0x2bfae8[_0x97ad('0x70')],'value':_0x2bfae8[_0x97ad('0x73')]};}):_0x200af6[_0x97ad('0x30')]==_0x97ad('0x6a')?[{'name':_0x97ad('0x74'),'value':_0x97ad('0x75')},{'name':'False','value':'false'}]:[]};})};}})[_0x97ad('0x29')](respondWithResult(_0x3da758,null))['catch'](function(_0x509a6a){var _0x19a42e=_0x359f58[_0x97ad('0x33')]['test']?0x1f4:_0x509a6a[_0x97ad('0x76')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x97ad('0x56'),_0x19a42e,JSON[_0x97ad('0x77')](_0x509a6a));delete _0x509a6a[_0x97ad('0x2c')];if(_0x19a42e===0x191){_0x19a42e=0x190;}_0x3da758['status'](_0x19a42e)[_0x97ad('0x78')](_0x359f58[_0x97ad('0x33')][_0x97ad('0x79')]?{'message':_0x97ad('0x7a'),'statusCode':_0x509a6a[_0x97ad('0x76')]}:_0x509a6a);});}; \ No newline at end of file +var _0x8a22=['query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','map','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','keys','include','merge','options','find','create','body','getConfigurations','hasOwnProperty','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientSecret','password','securityToken','slice','substring','lastIndexOf','Connection','clientId','login','username','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','boolean','email','textarea','phone','remove','includes','custom','picklistValues','label','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','moment','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','limit','undefined','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','key','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a22,0x1bc));var _0x28a2=function(_0x25c271,_0x5da4ef){_0x25c271=_0x25c271-0x0;var _0x5c8016=_0x8a22[_0x25c271];return _0x5c8016;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28a2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x28a2('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x28a2('0x2'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x28a2('0x3'));var ejs=require(_0x28a2('0x4'));var fs=require('fs');var fs_extra=require(_0x28a2('0x5'));var _=require('lodash');var squel=require(_0x28a2('0x6'));var crypto=require(_0x28a2('0x7'));var jsforce=require(_0x28a2('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x28a2('0x3'));var querystring=require('querystring');var Papa=require(_0x28a2('0x9'));var Redis=require(_0x28a2('0xa'));var authService=require(_0x28a2('0xb'));var qs=require(_0x28a2('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28a2('0xd'));var logger=require(_0x28a2('0xe'))(_0x28a2('0xf'));var utils=require('../../config/utils');var config=require(_0x28a2('0x10'));var licenseUtil=require(_0x28a2('0x11'));var db=require(_0x28a2('0x12'))['db'];var integrations=require(_0x28a2('0x13'));function respondWithStatusCode(_0x5f0222,_0x7324a9){_0x7324a9=_0x7324a9||0xcc;return function(_0x149702){if(_0x149702){return _0x5f0222['sendStatus'](_0x7324a9);}return _0x5f0222['status'](_0x7324a9)[_0x28a2('0x14')]();};}function respondWithResult(_0x1e4e10,_0xf76054){_0xf76054=_0xf76054||0xc8;return function(_0x2eea6b){if(_0x2eea6b){return _0x1e4e10[_0x28a2('0x15')](_0xf76054)[_0x28a2('0x16')](_0x2eea6b);}};}function respondWithFilteredResult(_0xae6e3c,_0x585782){return function(_0x3c25f1){if(_0x3c25f1){var _0x1a3408=typeof _0x585782['offset']==='undefined'&&typeof _0x585782[_0x28a2('0x17')]===_0x28a2('0x18');var _0x57702d=_0x3c25f1['count'];var _0x2fa326=_0x1a3408?0x0:_0x585782[_0x28a2('0x19')];var _0x545f73=_0x1a3408?_0x3c25f1['count']:_0x585782[_0x28a2('0x19')]+_0x585782[_0x28a2('0x17')];var _0x14de26;if(_0x545f73>=_0x57702d){_0x545f73=_0x57702d;_0x14de26=0xc8;}else{_0x14de26=0xce;}_0xae6e3c[_0x28a2('0x15')](_0x14de26);return _0xae6e3c[_0x28a2('0x1a')](_0x28a2('0x1b'),_0x2fa326+'-'+_0x545f73+'/'+_0x57702d)['json'](_0x3c25f1);}return null;};}function patchUpdates(_0x2563f5){return function(_0x39f372){try{jsonpatch[_0x28a2('0x1c')](_0x39f372,_0x2563f5,!![]);}catch(_0x2f002b){return BPromise[_0x28a2('0x1d')](_0x2f002b);}return _0x39f372[_0x28a2('0x1e')]();};}function saveUpdates(_0x130c81,_0x15d27a){return function(_0x10c9f6){if(_0x10c9f6){return _0x10c9f6[_0x28a2('0x1f')](_0x130c81)[_0x28a2('0x20')](function(_0x320508){return _0x320508;});}return null;};}function removeEntity(_0x40d0f3,_0x5e803d){return function(_0x3f637a){if(_0x3f637a){return _0x3f637a['destroy']()[_0x28a2('0x20')](function(){_0x40d0f3[_0x28a2('0x15')](0xcc)[_0x28a2('0x14')]();});}};}function handleEntityNotFound(_0x1d8218,_0x33bda9){return function(_0x480db3){if(!_0x480db3){_0x1d8218[_0x28a2('0x21')](0x194);}return _0x480db3;};}function handleError(_0x176db6,_0x48a19f){_0x48a19f=_0x48a19f||0x1f4;return function(_0x32c743){logger[_0x28a2('0x22')](_0x32c743['stack']);if(_0x32c743[_0x28a2('0x23')]){delete _0x32c743[_0x28a2('0x23')];}_0x176db6['status'](_0x48a19f)[_0x28a2('0x24')](_0x32c743);};}exports[_0x28a2('0x25')]=function(_0x4ce61d,_0x672d14){var _0x423742={},_0x1e2505={},_0xf08b54={'count':0x0,'rows':[]};var _0x311267=_['map'](db[_0x28a2('0x26')][_0x28a2('0x27')],function(_0x2f2a0b){return{'name':_0x2f2a0b[_0x28a2('0x28')],'type':_0x2f2a0b[_0x28a2('0x29')][_0x28a2('0x2a')]};});_0x1e2505[_0x28a2('0x2b')]=_['map'](_0x311267,_0x28a2('0x23'));_0x1e2505[_0x28a2('0x2c')]=_['keys'](_0x4ce61d[_0x28a2('0x2c')]);_0x1e2505[_0x28a2('0x2d')]=_[_0x28a2('0x2e')](_0x1e2505['model'],_0x1e2505[_0x28a2('0x2c')]);_0x423742['attributes']=_['intersection'](_0x1e2505[_0x28a2('0x2b')],qs[_0x28a2('0x2f')](_0x4ce61d[_0x28a2('0x2c')]['fields']));_0x423742[_0x28a2('0x30')]=_0x423742[_0x28a2('0x30')][_0x28a2('0x31')]?_0x423742[_0x28a2('0x30')]:_0x1e2505[_0x28a2('0x2b')];if(!_0x4ce61d[_0x28a2('0x2c')]['hasOwnProperty'](_0x28a2('0x32'))){_0x423742['limit']=qs[_0x28a2('0x17')](_0x4ce61d['query'][_0x28a2('0x17')]);_0x423742['offset']=qs[_0x28a2('0x19')](_0x4ce61d['query']['offset']);}_0x423742[_0x28a2('0x33')]=qs[_0x28a2('0x34')](_0x4ce61d[_0x28a2('0x2c')][_0x28a2('0x34')]);_0x423742[_0x28a2('0x35')]=qs[_0x28a2('0x2d')](_[_0x28a2('0x36')](_0x4ce61d[_0x28a2('0x2c')],_0x1e2505[_0x28a2('0x2d')]),_0x311267);if(_0x4ce61d[_0x28a2('0x2c')][_0x28a2('0x37')]){_0x423742[_0x28a2('0x35')]=_['merge'](_0x423742[_0x28a2('0x35')],{'$or':_[_0x28a2('0x38')](_0x311267,function(_0x3864fa){if(_0x3864fa['type']!==_0x28a2('0x39')){var _0x5b38a0={};_0x5b38a0[_0x3864fa['name']]={'$like':'%'+_0x4ce61d[_0x28a2('0x2c')][_0x28a2('0x37')]+'%'};return _0x5b38a0;}})});}_0x423742=_['merge']({},_0x423742,_0x4ce61d['options']);var _0x185c75={'where':_0x423742[_0x28a2('0x35')]};return db[_0x28a2('0x26')]['count'](_0x185c75)[_0x28a2('0x20')](function(_0x3d78e7){_0xf08b54[_0x28a2('0x3a')]=_0x3d78e7;if(_0x4ce61d[_0x28a2('0x2c')][_0x28a2('0x3b')]){_0x423742['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0x28a2('0x3c')](_0x423742);})[_0x28a2('0x20')](function(_0x11d700){_0xf08b54[_0x28a2('0x3d')]=_0x11d700;return _0xf08b54;})[_0x28a2('0x20')](respondWithFilteredResult(_0x672d14,_0x423742))[_0x28a2('0x3e')](handleError(_0x672d14,null));};exports[_0x28a2('0x3f')]=function(_0x6b2c9,_0x260d1f){var _0x4244c8={'raw':![],'where':{'id':_0x6b2c9[_0x28a2('0x40')]['id']}},_0x396605={};_0x396605[_0x28a2('0x2b')]=_['keys'](db['SalesforceAccount'][_0x28a2('0x27')]);_0x396605['query']=_[_0x28a2('0x41')](_0x6b2c9[_0x28a2('0x2c')]);_0x396605[_0x28a2('0x2d')]=_['intersection'](_0x396605[_0x28a2('0x2b')],_0x396605[_0x28a2('0x2c')]);_0x4244c8[_0x28a2('0x30')]=_['intersection'](_0x396605[_0x28a2('0x2b')],qs[_0x28a2('0x2f')](_0x6b2c9[_0x28a2('0x2c')][_0x28a2('0x2f')]));_0x4244c8[_0x28a2('0x30')]=_0x4244c8[_0x28a2('0x30')][_0x28a2('0x31')]?_0x4244c8[_0x28a2('0x30')]:_0x396605[_0x28a2('0x2b')];if(_0x6b2c9['query'][_0x28a2('0x3b')]){_0x4244c8[_0x28a2('0x42')]=[{'all':!![]}];}_0x4244c8=_[_0x28a2('0x43')]({},_0x4244c8,_0x6b2c9[_0x28a2('0x44')]);return db[_0x28a2('0x26')][_0x28a2('0x45')](_0x4244c8)[_0x28a2('0x20')](handleEntityNotFound(_0x260d1f,null))['then'](respondWithResult(_0x260d1f,null))[_0x28a2('0x3e')](handleError(_0x260d1f,null));};exports[_0x28a2('0x46')]=function(_0x2a6c01,_0x16e15e){return db['SalesforceAccount']['create'](_0x2a6c01['body'],{})[_0x28a2('0x20')](respondWithResult(_0x16e15e,0xc9))[_0x28a2('0x3e')](handleError(_0x16e15e,null));};exports[_0x28a2('0x1f')]=function(_0x528b3f,_0x8e7390){if(_0x528b3f[_0x28a2('0x47')]['id']){delete _0x528b3f['body']['id'];}return db['SalesforceAccount'][_0x28a2('0x45')]({'where':{'id':_0x528b3f[_0x28a2('0x40')]['id']}})[_0x28a2('0x20')](handleEntityNotFound(_0x8e7390,null))[_0x28a2('0x20')](saveUpdates(_0x528b3f[_0x28a2('0x47')],null))[_0x28a2('0x20')](respondWithResult(_0x8e7390,null))['catch'](handleError(_0x8e7390,null));};exports['destroy']=function(_0x4e603f,_0x20830a){return db[_0x28a2('0x26')][_0x28a2('0x45')]({'where':{'id':_0x4e603f['params']['id']}})['then'](handleEntityNotFound(_0x20830a,null))['then'](removeEntity(_0x20830a,null))[_0x28a2('0x3e')](handleError(_0x20830a,null));};exports[_0x28a2('0x48')]=function(_0x5d7f74,_0x4b92f2,_0x5177cb){var _0x5610b2={};var _0x22c3ad={};var _0x1e61e9;var _0x23f37c;return db[_0x28a2('0x26')]['findOne']({'where':{'id':_0x5d7f74['params']['id']}})[_0x28a2('0x20')](handleEntityNotFound(_0x4b92f2,null))[_0x28a2('0x20')](function(_0xbc2e97){if(_0xbc2e97){_0x1e61e9=_0xbc2e97;_0x22c3ad[_0x28a2('0x2b')]=_[_0x28a2('0x41')](db['SalesforceConfiguration'][_0x28a2('0x27')]);_0x22c3ad[_0x28a2('0x2c')]=_[_0x28a2('0x41')](_0x5d7f74[_0x28a2('0x2c')]);_0x22c3ad[_0x28a2('0x2d')]=_[_0x28a2('0x2e')](_0x22c3ad[_0x28a2('0x2b')],_0x22c3ad[_0x28a2('0x2c')]);_0x5610b2[_0x28a2('0x30')]=_['intersection'](_0x22c3ad['model'],qs['fields'](_0x5d7f74[_0x28a2('0x2c')][_0x28a2('0x2f')]));_0x5610b2[_0x28a2('0x30')]=_0x5610b2[_0x28a2('0x30')][_0x28a2('0x31')]?_0x5610b2[_0x28a2('0x30')]:_0x22c3ad['model'];_0x5610b2[_0x28a2('0x33')]=qs['sort'](_0x5d7f74[_0x28a2('0x2c')][_0x28a2('0x34')]);_0x5610b2[_0x28a2('0x35')]=qs[_0x28a2('0x2d')](_[_0x28a2('0x36')](_0x5d7f74['query'],_0x22c3ad[_0x28a2('0x2d')]));if(_0x5d7f74[_0x28a2('0x2c')][_0x28a2('0x37')]){_0x5610b2[_0x28a2('0x35')]=_[_0x28a2('0x43')](_0x5610b2[_0x28a2('0x35')],{'$or':_[_0x28a2('0x38')](_0x5610b2['attributes'],function(_0x11c51d){var _0x15ba74={};_0x15ba74[_0x11c51d]={'$like':'%'+_0x5d7f74['query']['filter']+'%'};return _0x15ba74;})});}_0x5610b2=_['merge']({},_0x5610b2,_0x5d7f74[_0x28a2('0x44')]);return _0x1e61e9['getConfigurations'](_0x5610b2);}})['then'](function(_0x5d25be){if(_0x5d25be){_0x23f37c=_0x5d25be[_0x28a2('0x31')];if(!_0x5d7f74[_0x28a2('0x2c')][_0x28a2('0x49')]('nolimit')){_0x5610b2[_0x28a2('0x17')]=qs[_0x28a2('0x17')](_0x5d7f74['query']['limit']);_0x5610b2['offset']=qs[_0x28a2('0x19')](_0x5d7f74['query'][_0x28a2('0x19')]);}return _0x1e61e9[_0x28a2('0x48')](_0x5610b2);}})[_0x28a2('0x20')](function(_0x4253fe){if(_0x4253fe){return _0x4253fe?{'count':_0x23f37c,'rows':_0x4253fe}:null;}})['then'](respondWithResult(_0x4b92f2,null))[_0x28a2('0x3e')](handleError(_0x4b92f2,null));};exports[_0x28a2('0x4a')]=function(_0x28c7b9,_0x3e4f9c,_0xce1d35){if(_0x28c7b9[_0x28a2('0x47')]['id']){delete _0x28c7b9[_0x28a2('0x47')]['id'];}return db[_0x28a2('0x26')][_0x28a2('0x4b')]({'where':{'id':_0x28c7b9[_0x28a2('0x40')]['id']}})[_0x28a2('0x20')](handleEntityNotFound(_0x3e4f9c,null))['then'](function(_0x5aaf23){if(_0x5aaf23){_0x28c7b9[_0x28a2('0x47')]['AccountId']=_0x5aaf23['id'];_0x28c7b9['body'][_0x28a2('0x4c')]=integrations[_0x28a2('0x4d')](_0x28c7b9['body'][_0x28a2('0x4e')],_0x28c7b9[_0x28a2('0x47')]['type']);_0x28c7b9['body'][_0x28a2('0x4f')]=integrations['getDescriptions'](_0x28c7b9[_0x28a2('0x47')][_0x28a2('0x4e')],_0x28c7b9[_0x28a2('0x47')][_0x28a2('0x29')]);return db[_0x28a2('0x50')][_0x28a2('0x46')](_0x28c7b9[_0x28a2('0x47')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x28a2('0x51')],'as':_0x28a2('0x4f')}]});}return null;})[_0x28a2('0x20')](respondWithResult(_0x3e4f9c,null))[_0x28a2('0x3e')](handleError(_0x3e4f9c,null));};exports[_0x28a2('0x52')]=function(_0x1c0a18,_0x3bac6d,_0x2d16ff){var _0x101765;var _0x5b5032='';var _0x36ea68=_0x28a2('0x53');return db[_0x28a2('0x26')][_0x28a2('0x4b')]({'where':{'id':_0x1c0a18[_0x28a2('0x40')]['id']},'attributes':['id',_0x28a2('0x54'),'clientId',_0x28a2('0x55'),'username',_0x28a2('0x56'),_0x28a2('0x57')]})[_0x28a2('0x20')](handleEntityNotFound(_0x3bac6d,null))[_0x28a2('0x20')](function(_0x2bee65){if(_0x2bee65){_0x5b5032=_0x2bee65[_0x28a2('0x54')];var _0x47b05f=_0x5b5032[_0x28a2('0x58')](-0x1);if(_0x47b05f==='/'){_0x5b5032=_0x5b5032[_0x28a2('0x59')](0x0,_0x5b5032[_0x28a2('0x5a')](_0x47b05f));}_0x101765=new jsforce[(_0x28a2('0x5b'))]({'oauth2':{'loginUrl':_0x5b5032,'clientId':_0x2bee65[_0x28a2('0x5c')],'clientSecret':_0x2bee65[_0x28a2('0x55')]}});return _0x101765[_0x28a2('0x5d')](_0x2bee65[_0x28a2('0x5e')],_0x2bee65[_0x28a2('0x56')]['concat'](_0x2bee65[_0x28a2('0x57')]));}})['then'](function(_0x4a497b){if(_0x4a497b){if(!_[_0x28a2('0x5f')](_0x1c0a18['query'][_0x28a2('0x60')])){_0x36ea68=_0x1c0a18[_0x28a2('0x2c')]['ticketType'];}return _0x101765[_0x28a2('0x61')](_0x36ea68)['describe']();}})[_0x28a2('0x20')](function(_0x33e01f){var _0x255a48=[_0x28a2('0x62'),_0x28a2('0x63'),_0x28a2('0x64'),_0x28a2('0x65'),_0x28a2('0x66'),_0x28a2('0x67')];var _0x233abc=[_0x28a2('0x68'),'int','picklist',_0x28a2('0x69'),_0x28a2('0x6a'),_0x28a2('0x6b'),_0x28a2('0x6c')];if(_0x33e01f){_[_0x28a2('0x6d')](_0x33e01f[_0x28a2('0x2f')],function(_0x5a20da){return _0x255a48[_0x28a2('0x6e')](_0x5a20da[_0x28a2('0x23')])||!_0x233abc[_0x28a2('0x6e')](_0x5a20da[_0x28a2('0x29')]);});return{'count':_0x33e01f['fields']['length'],'rows':_[_0x28a2('0x38')](_0x33e01f[_0x28a2('0x2f')],function(_0x390616){return{'id':_0x390616[_0x28a2('0x23')],'name':_0x390616['label'],'custom':_0x390616[_0x28a2('0x6f')],'options':_0x390616[_0x28a2('0x70')]['length']>0x0?_['map'](_0x390616[_0x28a2('0x70')],function(_0x104f57){return{'name':_0x104f57[_0x28a2('0x71')],'value':_0x104f57['value']};}):_0x390616[_0x28a2('0x29')]==_0x28a2('0x69')?[{'name':_0x28a2('0x72'),'value':_0x28a2('0x73')},{'name':_0x28a2('0x74'),'value':_0x28a2('0x75')}]:[]};})};}})['then'](respondWithResult(_0x3bac6d,null))[_0x28a2('0x3e')](function(_0x4b7b12){var _0x55c4ef=_0x1c0a18[_0x28a2('0x2c')][_0x28a2('0x76')]?0x1f4:_0x4b7b12[_0x28a2('0x77')]||0x1f4;logger['error'](_0x28a2('0x78'),_0x28a2('0x52'),_0x55c4ef,JSON['stringify'](_0x4b7b12));delete _0x4b7b12[_0x28a2('0x23')];if(_0x55c4ef===0x191){_0x55c4ef=0x190;}_0x3bac6d[_0x28a2('0x15')](_0x55c4ef)['send'](_0x1c0a18[_0x28a2('0x2c')][_0x28a2('0x76')]?{'message':_0x28a2('0x79'),'statusCode':_0x4b7b12[_0x28a2('0x77')]}:_0x4b7b12);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index c0cf33f..8c0019d 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 _0xef89=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0x4feb58,_0x3d8ad5){var _0x32b719=function(_0x44790d){while(--_0x44790d){_0x4feb58['push'](_0x4feb58['shift']());}};_0x32b719(++_0x3d8ad5);}(_0xef89,0xf6));var _0x9ef8=function(_0x1d2f7b,_0x1e8dc6){_0x1d2f7b=_0x1d2f7b-0x0;var _0x268d8c=_0xef89[_0x1d2f7b];return _0x268d8c;};'use strict';var _=require(_0x9ef8('0x0'));var util=require(_0x9ef8('0x1'));var logger=require(_0x9ef8('0x2'))(_0x9ef8('0x3'));var moment=require(_0x9ef8('0x4'));var BPromise=require('bluebird');var rp=require(_0x9ef8('0x5'));var fs=require('fs');var path=require(_0x9ef8('0x6'));var rimraf=require(_0x9ef8('0x7'));var config=require(_0x9ef8('0x8'));var attributes=require(_0x9ef8('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x9ef8('0xa')]=function(_0x5d40f7,_0x4bf5bf){return _0x5d40f7['define'](_0x9ef8('0xb'),attributes,{'tableName':_0x9ef8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd245=['request-promise','path','rimraf','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment','bluebird'];(function(_0x12bec0,_0x3fbcb2){var _0x22b256=function(_0x31f0a1){while(--_0x31f0a1){_0x12bec0['push'](_0x12bec0['shift']());}};_0x22b256(++_0x3fbcb2);}(_0xd245,0xd3));var _0x5d24=function(_0x390a19,_0x5dd137){_0x390a19=_0x390a19-0x0;var _0x5d8230=_0xd245[_0x390a19];return _0x5d8230;};'use strict';var _=require(_0x5d24('0x0'));var util=require(_0x5d24('0x1'));var logger=require(_0x5d24('0x2'))('api');var moment=require(_0x5d24('0x3'));var BPromise=require(_0x5d24('0x4'));var rp=require(_0x5d24('0x5'));var fs=require('fs');var path=require(_0x5d24('0x6'));var rimraf=require(_0x5d24('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x5d24('0x8')]=function(_0x4e291d,_0x1e8dc1){return _0x4e291d[_0x5d24('0x9')](_0x5d24('0xa'),attributes,{'tableName':_0x5d24('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index d59352b..6b2fde3 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 _0x756f=['info','catch','find','ShowSalesforceAccount','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','limit','include','map','model','attributes'];(function(_0x162bb2,_0x5be1cb){var _0x40e8b9=function(_0x1ae1be){while(--_0x1ae1be){_0x162bb2['push'](_0x162bb2['shift']());}};_0x40e8b9(++_0x5be1cb);}(_0x756f,0x137));var _0xf756=function(_0x1257d,_0x4d1d0f){_0x1257d=_0x1257d-0x0;var _0x3994a2=_0x756f[_0x1257d];return _0x3994a2;};'use strict';var _=require(_0xf756('0x0'));var util=require(_0xf756('0x1'));var moment=require(_0xf756('0x2'));var BPromise=require(_0xf756('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf756('0x4'));var db=require(_0xf756('0x5'))['db'];var utils=require(_0xf756('0x6'));var logger=require(_0xf756('0x7'))(_0xf756('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf756('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e249d,_0x1d1ff3,_0x4257a3){return new BPromise(function(_0x3362ec,_0x4e5a8a){return client['request'](_0x3e249d,_0x4257a3)[_0xf756('0xa')](function(_0xe4affa){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x1d1ff3,_0xf756('0xb'));logger['debug'](_0xf756('0xc'),_0x1d1ff3,_0xf756('0xb'),JSON[_0xf756('0xd')](_0xe4affa));if(_0xe4affa[_0xf756('0xe')]){if(_0xe4affa[_0xf756('0xe')][_0xf756('0xf')]===0x1f4){logger[_0xf756('0xe')](_0xf756('0x10'),_0x1d1ff3,_0xe4affa[_0xf756('0xe')][_0xf756('0x11')]);return _0x4e5a8a(_0xe4affa[_0xf756('0xe')][_0xf756('0x11')]);}logger['error'](_0xf756('0x10'),_0x1d1ff3,_0xe4affa[_0xf756('0xe')][_0xf756('0x11')]);return _0x3362ec(_0xe4affa['error']['message']);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x1d1ff3,'request\x20sent');_0x3362ec(_0xe4affa['result'][_0xf756('0x11')]);}})['catch'](function(_0x56cf7c){logger[_0xf756('0xe')](_0xf756('0x10'),_0x1d1ff3,_0x56cf7c);_0x4e5a8a(_0x56cf7c);});});}exports[_0xf756('0x12')]=function(_0x2b6430){var _0x204951=this;return new Promise(function(_0x348fdc,_0x568406){return db[_0xf756('0x13')][_0xf756('0x14')]({'raw':_0x2b6430[_0xf756('0x15')]?_0x2b6430[_0xf756('0x15')][_0xf756('0x16')]===undefined?!![]:![]:!![],'where':_0x2b6430['options']?_0x2b6430[_0xf756('0x15')][_0xf756('0x17')]||null:null,'attributes':_0x2b6430[_0xf756('0x15')]?_0x2b6430[_0xf756('0x15')]['attributes']||null:null,'limit':_0x2b6430['options']?_0x2b6430[_0xf756('0x15')][_0xf756('0x18')]||null:null,'include':_0x2b6430[_0xf756('0x15')]?_0x2b6430[_0xf756('0x15')][_0xf756('0x19')]?_[_0xf756('0x1a')](_0x2b6430[_0xf756('0x15')][_0xf756('0x19')],function(_0x4075b5){return{'model':db[_0x4075b5[_0xf756('0x1b')]],'as':_0x4075b5['as'],'attributes':_0x4075b5[_0xf756('0x1c')],'include':_0x4075b5[_0xf756('0x19')]?_[_0xf756('0x1a')](_0x4075b5[_0xf756('0x19')],function(_0x22eb27){return{'model':db[_0x22eb27[_0xf756('0x1b')]],'as':_0x22eb27['as'],'attributes':_0x22eb27['attributes'],'include':_0x22eb27[_0xf756('0x19')]?_[_0xf756('0x1a')](_0x22eb27[_0xf756('0x19')],function(_0x2fb858){return{'model':db[_0x2fb858['model']],'as':_0x2fb858['as'],'attributes':_0x2fb858[_0xf756('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf756('0xa')](function(_0xf9d19e){logger[_0xf756('0x1d')](_0xf756('0x12'),_0x2b6430);logger['debug'](_0xf756('0x12'),_0x2b6430,JSON[_0xf756('0xd')](_0xf9d19e));_0x348fdc(_0xf9d19e);})[_0xf756('0x1e')](function(_0x2d84f4){logger[_0xf756('0xe')]('GetSalesforceAccount',_0x2d84f4['message'],_0x2b6430);_0x568406(_0x204951[_0xf756('0xe')](0x1f4,_0x2d84f4[_0xf756('0x11')]));});});};exports['ShowSalesforceAccount']=function(_0x1fa357){var _0x25cc47=this;return new Promise(function(_0x29599a,_0x450e13){return db[_0xf756('0x13')][_0xf756('0x1f')]({'raw':_0x1fa357[_0xf756('0x15')]?_0x1fa357[_0xf756('0x15')][_0xf756('0x16')]===undefined?!![]:![]:!![],'where':_0x1fa357[_0xf756('0x15')]?_0x1fa357[_0xf756('0x15')]['where']||null:null,'attributes':_0x1fa357[_0xf756('0x15')]?_0x1fa357['options'][_0xf756('0x1c')]||null:null,'include':_0x1fa357['options']?_0x1fa357[_0xf756('0x15')][_0xf756('0x19')]?_['map'](_0x1fa357[_0xf756('0x15')][_0xf756('0x19')],function(_0x1ec037){return{'model':db[_0x1ec037[_0xf756('0x1b')]],'as':_0x1ec037['as'],'attributes':_0x1ec037[_0xf756('0x1c')],'include':_0x1ec037[_0xf756('0x19')]?_[_0xf756('0x1a')](_0x1ec037[_0xf756('0x19')],function(_0x4720b8){return{'model':db[_0x4720b8[_0xf756('0x1b')]],'as':_0x4720b8['as'],'attributes':_0x4720b8[_0xf756('0x1c')],'include':_0x4720b8['include']?_[_0xf756('0x1a')](_0x4720b8[_0xf756('0x19')],function(_0x3ccb6a){return{'model':db[_0x3ccb6a[_0xf756('0x1b')]],'as':_0x3ccb6a['as'],'attributes':_0x3ccb6a['attributes']};}):[]};}):[]};}):[]:[]})[_0xf756('0xa')](function(_0xff2192){logger[_0xf756('0x1d')](_0xf756('0x20'),_0x1fa357);logger[_0xf756('0x21')]('ShowSalesforceAccount',_0x1fa357,JSON[_0xf756('0xd')](_0xff2192));_0x29599a(_0xff2192);})[_0xf756('0x1e')](function(_0x17d19c){logger[_0xf756('0xe')](_0xf756('0x20'),_0x17d19c[_0xf756('0x11')],_0x1fa357);_0x450e13(_0x25cc47[_0xf756('0xe')](0x1f4,_0x17d19c[_0xf756('0x11')]));});});}; \ No newline at end of file +var _0x5c88=['../../config/environment','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetSalesforceAccount','SalesforceAccount','options','include','model','attributes','map','catch','where','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x260668,_0x39ee1e){var _0x46c297=function(_0x21c8d9){while(--_0x21c8d9){_0x260668['push'](_0x260668['shift']());}};_0x46c297(++_0x39ee1e);}(_0x5c88,0x1e6));var _0x85c8=function(_0x158c15,_0x5e451e){_0x158c15=_0x158c15-0x0;var _0x1dfd4f=_0x5c88[_0x158c15];return _0x1dfd4f;};'use strict';var _=require(_0x85c8('0x0'));var util=require(_0x85c8('0x1'));var moment=require(_0x85c8('0x2'));var BPromise=require(_0x85c8('0x3'));var rs=require(_0x85c8('0x4'));var fs=require('fs');var Redis=require(_0x85c8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x85c8('0x6'));var logger=require(_0x85c8('0x7'))(_0x85c8('0x8'));var config=require(_0x85c8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x85c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bd650,_0x9fcbaf,_0x16a5ae){return new BPromise(function(_0x23cb7b,_0x2df95f){return client[_0x85c8('0xb')](_0x4bd650,_0x16a5ae)[_0x85c8('0xc')](function(_0x1324cb){logger['info'](_0x85c8('0xd'),_0x9fcbaf,_0x85c8('0xe'));logger[_0x85c8('0xf')](_0x85c8('0x10'),_0x9fcbaf,_0x85c8('0xe'),JSON[_0x85c8('0x11')](_0x1324cb));if(_0x1324cb['error']){if(_0x1324cb[_0x85c8('0x12')][_0x85c8('0x13')]===0x1f4){logger['error'](_0x85c8('0xd'),_0x9fcbaf,_0x1324cb[_0x85c8('0x12')][_0x85c8('0x14')]);return _0x2df95f(_0x1324cb[_0x85c8('0x12')][_0x85c8('0x14')]);}logger[_0x85c8('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x9fcbaf,_0x1324cb[_0x85c8('0x12')][_0x85c8('0x14')]);return _0x23cb7b(_0x1324cb[_0x85c8('0x12')][_0x85c8('0x14')]);}else{logger[_0x85c8('0x15')](_0x85c8('0xd'),_0x9fcbaf,_0x85c8('0xe'));_0x23cb7b(_0x1324cb[_0x85c8('0x16')]['message']);}})['catch'](function(_0x26369e){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x9fcbaf,_0x26369e);_0x2df95f(_0x26369e);});});}exports[_0x85c8('0x17')]=function(_0x388f8b){var _0x382210=this;return new Promise(function(_0x396af6,_0x467d9e){return db[_0x85c8('0x18')]['findAll']({'raw':_0x388f8b['options']?_0x388f8b[_0x85c8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x388f8b[_0x85c8('0x19')]?_0x388f8b[_0x85c8('0x19')]['where']||null:null,'attributes':_0x388f8b[_0x85c8('0x19')]?_0x388f8b[_0x85c8('0x19')]['attributes']||null:null,'limit':_0x388f8b[_0x85c8('0x19')]?_0x388f8b['options']['limit']||null:null,'include':_0x388f8b[_0x85c8('0x19')]?_0x388f8b[_0x85c8('0x19')][_0x85c8('0x1a')]?_['map'](_0x388f8b[_0x85c8('0x19')][_0x85c8('0x1a')],function(_0x1ef8a5){return{'model':db[_0x1ef8a5[_0x85c8('0x1b')]],'as':_0x1ef8a5['as'],'attributes':_0x1ef8a5[_0x85c8('0x1c')],'include':_0x1ef8a5[_0x85c8('0x1a')]?_[_0x85c8('0x1d')](_0x1ef8a5[_0x85c8('0x1a')],function(_0x5d4166){return{'model':db[_0x5d4166[_0x85c8('0x1b')]],'as':_0x5d4166['as'],'attributes':_0x5d4166['attributes'],'include':_0x5d4166['include']?_[_0x85c8('0x1d')](_0x5d4166[_0x85c8('0x1a')],function(_0x3f995c){return{'model':db[_0x3f995c[_0x85c8('0x1b')]],'as':_0x3f995c['as'],'attributes':_0x3f995c[_0x85c8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85c8('0xc')](function(_0x3b2a19){logger[_0x85c8('0x15')](_0x85c8('0x17'),_0x388f8b);logger['debug'](_0x85c8('0x17'),_0x388f8b,JSON[_0x85c8('0x11')](_0x3b2a19));_0x396af6(_0x3b2a19);})[_0x85c8('0x1e')](function(_0x5938d8){logger[_0x85c8('0x12')](_0x85c8('0x17'),_0x5938d8['message'],_0x388f8b);_0x467d9e(_0x382210[_0x85c8('0x12')](0x1f4,_0x5938d8['message']));});});};exports['ShowSalesforceAccount']=function(_0x9347f){var _0x428d1b=this;return new Promise(function(_0xeae963,_0x460668){return db[_0x85c8('0x18')]['find']({'raw':_0x9347f[_0x85c8('0x19')]?_0x9347f[_0x85c8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x9347f[_0x85c8('0x19')]?_0x9347f[_0x85c8('0x19')][_0x85c8('0x1f')]||null:null,'attributes':_0x9347f[_0x85c8('0x19')]?_0x9347f[_0x85c8('0x19')][_0x85c8('0x1c')]||null:null,'include':_0x9347f['options']?_0x9347f[_0x85c8('0x19')][_0x85c8('0x1a')]?_['map'](_0x9347f['options'][_0x85c8('0x1a')],function(_0x3ef9a7){return{'model':db[_0x3ef9a7[_0x85c8('0x1b')]],'as':_0x3ef9a7['as'],'attributes':_0x3ef9a7[_0x85c8('0x1c')],'include':_0x3ef9a7[_0x85c8('0x1a')]?_[_0x85c8('0x1d')](_0x3ef9a7[_0x85c8('0x1a')],function(_0x516207){return{'model':db[_0x516207[_0x85c8('0x1b')]],'as':_0x516207['as'],'attributes':_0x516207[_0x85c8('0x1c')],'include':_0x516207[_0x85c8('0x1a')]?_[_0x85c8('0x1d')](_0x516207[_0x85c8('0x1a')],function(_0x10caa6){return{'model':db[_0x10caa6['model']],'as':_0x10caa6['as'],'attributes':_0x10caa6[_0x85c8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85c8('0xc')](function(_0x3a11ce){logger[_0x85c8('0x15')](_0x85c8('0x20'),_0x9347f);logger[_0x85c8('0xf')](_0x85c8('0x20'),_0x9347f,JSON['stringify'](_0x3a11ce));_0xeae963(_0x3a11ce);})['catch'](function(_0x516a73){logger[_0x85c8('0x12')](_0x85c8('0x20'),_0x516a73[_0x85c8('0x14')],_0x9347f);_0x460668(_0x428d1b['error'](0x1f4,_0x516a73[_0x85c8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index bb870ed..c23b7ba 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x3bd090,_0x3bcb2e){var _0x203ab8=function(_0x3995e0){while(--_0x3995e0){_0x3bd090['push'](_0x3bd090['shift']());}};_0x203ab8(++_0x3bcb2e);}(_0x2ef3,0xba));var _0x32ef=function(_0x229b4d,_0x5014c2){_0x229b4d=_0x229b4d-0x0;var _0x3fbfb8=_0x2ef3[_0x229b4d];return _0x3fbfb8;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xadd8,_0x36a03a){var _0x220230=function(_0x5322a3){while(--_0x5322a3){_0xadd8['push'](_0xadd8['shift']());}};_0x220230(++_0x36a03a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5e8e82,_0x18f9ec){_0x5e8e82=_0x5e8e82-0x0;var _0x4e6805=_0x5f2f[_0x5e8e82];return _0x4e6805;};'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('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 330de2c..aba10c6 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 _0x5eda=['ENUM','Task','Case','lead','account_contact_lead','account','nothing','contact','STRING'];(function(_0x5cc556,_0x158710){var _0x12103b=function(_0x13ff4a){while(--_0x13ff4a){_0x5cc556['push'](_0x5cc556['shift']());}};_0x12103b(++_0x158710);}(_0x5eda,0x1af));var _0xa5ed=function(_0xa5d0e9,_0x4f02f9){_0xa5d0e9=_0xa5d0e9-0x0;var _0x18cbbc=_0x5eda[_0xa5d0e9];return _0x18cbbc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa5ed('0x0')]},'description':{'type':Sequelize[_0xa5ed('0x0')]},'ticketType':{'type':Sequelize[_0xa5ed('0x1')](_0xa5ed('0x2'),_0xa5ed('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xa5ed('0x1')]('contact_lead','contact',_0xa5ed('0x4'),_0xa5ed('0x5'),_0xa5ed('0x6')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xa5ed('0x1')](_0xa5ed('0x7'),_0xa5ed('0x8'),'lead',_0xa5ed('0x6')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xa5ed('0x0')]},'additionalSearchAccount':{'type':Sequelize[_0xa5ed('0x0')]},'additionalSearchContact':{'type':Sequelize[_0xa5ed('0x0')]},'additionalSearchLead':{'type':Sequelize[_0xa5ed('0x0')]}}; \ No newline at end of file +var _0xfbd4=['lead','account','nothing','sequelize','exports','STRING','ENUM','Task','Case','contact_lead'];(function(_0x1e53aa,_0x21399d){var _0x8d98ba=function(_0x3a80fa){while(--_0x3a80fa){_0x1e53aa['push'](_0x1e53aa['shift']());}};_0x8d98ba(++_0x21399d);}(_0xfbd4,0x11b));var _0x4fbd=function(_0x5c8a28,_0x5711e7){_0x5c8a28=_0x5c8a28-0x0;var _0x8ef23e=_0xfbd4[_0x5c8a28];return _0x8ef23e;};'use strict';var Sequelize=require(_0x4fbd('0x0'));module[_0x4fbd('0x1')]={'name':{'type':Sequelize[_0x4fbd('0x2')]},'description':{'type':Sequelize[_0x4fbd('0x2')]},'ticketType':{'type':Sequelize[_0x4fbd('0x3')](_0x4fbd('0x4'),_0x4fbd('0x5')),'defaultValue':_0x4fbd('0x4')},'moduleSearch':{'type':Sequelize[_0x4fbd('0x3')](_0x4fbd('0x6'),'contact',_0x4fbd('0x7'),'account_contact_lead',_0x4fbd('0x8')),'defaultValue':_0x4fbd('0x6')},'moduleCreate':{'type':Sequelize[_0x4fbd('0x3')](_0x4fbd('0x9'),'contact','lead',_0x4fbd('0x8')),'defaultValue':_0x4fbd('0x7')},'leadId':{'type':Sequelize[_0x4fbd('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x4fbd('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x4fbd('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x4fbd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 76cf2d4..bb188a6 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 _0x8464=['intersection','attributes','fields','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','getFields','order','hasOwnProperty','getSubjects','SalesforceField','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','apply','update','then','destroy','name','map','SalesforceConfiguration','rawAttributes','type','model','query','filters'];(function(_0x21c0de,_0x4a9720){var _0x32229e=function(_0x275c29){while(--_0x275c29){_0x21c0de['push'](_0x21c0de['shift']());}};_0x32229e(++_0x4a9720);}(_0x8464,0x145));var _0x4846=function(_0x2816ca,_0x4c990a){_0x2816ca=_0x2816ca-0x0;var _0x18fefe=_0x8464[_0x2816ca];return _0x18fefe;};'use strict';var emlformat=require(_0x4846('0x0'));var rimraf=require(_0x4846('0x1'));var zipdir=require(_0x4846('0x2'));var jsonpatch=require(_0x4846('0x3'));var rp=require(_0x4846('0x4'));var moment=require(_0x4846('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4846('0x6'));var util=require(_0x4846('0x7'));var path=require(_0x4846('0x8'));var sox=require(_0x4846('0x9'));var csv=require(_0x4846('0xa'));var ejs=require(_0x4846('0xb'));var fs=require('fs');var fs_extra=require(_0x4846('0xc'));var _=require('lodash');var squel=require(_0x4846('0xd'));var crypto=require(_0x4846('0xe'));var jsforce=require(_0x4846('0xf'));var deskjs=require(_0x4846('0x10'));var toCsv=require(_0x4846('0xa'));var querystring=require('querystring');var Papa=require(_0x4846('0x11'));var Redis=require(_0x4846('0x12'));var authService=require(_0x4846('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4846('0x14'))(_0x4846('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4846('0x16'));var db=require(_0x4846('0x17'))['db'];function respondWithStatusCode(_0x215e2b,_0x47d88a){_0x47d88a=_0x47d88a||0xcc;return function(_0x154df9){if(_0x154df9){return _0x215e2b[_0x4846('0x18')](_0x47d88a);}return _0x215e2b['status'](_0x47d88a)[_0x4846('0x19')]();};}function respondWithResult(_0x23d3d5,_0x5a75f1){_0x5a75f1=_0x5a75f1||0xc8;return function(_0x439b04){if(_0x439b04){return _0x23d3d5[_0x4846('0x1a')](_0x5a75f1)['json'](_0x439b04);}};}function respondWithFilteredResult(_0x170b30,_0x1c2e56){return function(_0xc6a863){if(_0xc6a863){var _0x5e7172=typeof _0x1c2e56[_0x4846('0x1b')]===_0x4846('0x1c')&&typeof _0x1c2e56['limit']===_0x4846('0x1c');var _0x585844=_0xc6a863[_0x4846('0x1d')];var _0x33437d=_0x5e7172?0x0:_0x1c2e56[_0x4846('0x1b')];var _0x119b01=_0x5e7172?_0xc6a863[_0x4846('0x1d')]:_0x1c2e56[_0x4846('0x1b')]+_0x1c2e56['limit'];var _0x4b368f;if(_0x119b01>=_0x585844){_0x119b01=_0x585844;_0x4b368f=0xc8;}else{_0x4b368f=0xce;}_0x170b30[_0x4846('0x1a')](_0x4b368f);return _0x170b30[_0x4846('0x1e')](_0x4846('0x1f'),_0x33437d+'-'+_0x119b01+'/'+_0x585844)[_0x4846('0x20')](_0xc6a863);}return null;};}function patchUpdates(_0x4f1cd5){return function(_0x1269e7){try{jsonpatch[_0x4846('0x21')](_0x1269e7,_0x4f1cd5,!![]);}catch(_0x309789){return BPromise['reject'](_0x309789);}return _0x1269e7['save']();};}function saveUpdates(_0x3ca48d,_0x29d263){return function(_0x271406){if(_0x271406){return _0x271406[_0x4846('0x22')](_0x3ca48d)[_0x4846('0x23')](function(_0x2cbc8d){return _0x2cbc8d;});}return null;};}function removeEntity(_0x148ea4,_0x4191cf){return function(_0x3b1cfd){if(_0x3b1cfd){return _0x3b1cfd[_0x4846('0x24')]()['then'](function(){_0x148ea4['status'](0xcc)[_0x4846('0x19')]();});}};}function handleEntityNotFound(_0x250199,_0x2e76b1){return function(_0x348491){if(!_0x348491){_0x250199[_0x4846('0x18')](0x194);}return _0x348491;};}function handleError(_0x61c508,_0x3e88e0){_0x3e88e0=_0x3e88e0||0x1f4;return function(_0x1bd302){logger['error'](_0x1bd302['stack']);if(_0x1bd302['name']){delete _0x1bd302[_0x4846('0x25')];}_0x61c508[_0x4846('0x1a')](_0x3e88e0)['send'](_0x1bd302);};}exports['index']=function(_0x51dbee,_0x365168){var _0x2ae55b={},_0x545ba4={},_0x4eeac0={'count':0x0,'rows':[]};var _0x2296df=_[_0x4846('0x26')](db[_0x4846('0x27')][_0x4846('0x28')],function(_0x5d5613){return{'name':_0x5d5613['fieldName'],'type':_0x5d5613[_0x4846('0x29')]['key']};});_0x545ba4[_0x4846('0x2a')]=_[_0x4846('0x26')](_0x2296df,_0x4846('0x25'));_0x545ba4[_0x4846('0x2b')]=_['keys'](_0x51dbee['query']);_0x545ba4[_0x4846('0x2c')]=_[_0x4846('0x2d')](_0x545ba4['model'],_0x545ba4[_0x4846('0x2b')]);_0x2ae55b[_0x4846('0x2e')]=_[_0x4846('0x2d')](_0x545ba4['model'],qs[_0x4846('0x2f')](_0x51dbee[_0x4846('0x2b')][_0x4846('0x2f')]));_0x2ae55b[_0x4846('0x2e')]=_0x2ae55b[_0x4846('0x2e')]['length']?_0x2ae55b['attributes']:_0x545ba4[_0x4846('0x2a')];if(!_0x51dbee[_0x4846('0x2b')]['hasOwnProperty'](_0x4846('0x30'))){_0x2ae55b[_0x4846('0x31')]=qs[_0x4846('0x31')](_0x51dbee[_0x4846('0x2b')]['limit']);_0x2ae55b[_0x4846('0x1b')]=qs[_0x4846('0x1b')](_0x51dbee[_0x4846('0x2b')][_0x4846('0x1b')]);}_0x2ae55b['order']=qs[_0x4846('0x32')](_0x51dbee['query']['sort']);_0x2ae55b[_0x4846('0x33')]=qs[_0x4846('0x2c')](_[_0x4846('0x34')](_0x51dbee[_0x4846('0x2b')],_0x545ba4[_0x4846('0x2c')]),_0x2296df);if(_0x51dbee[_0x4846('0x2b')][_0x4846('0x35')]){_0x2ae55b[_0x4846('0x33')]=_[_0x4846('0x36')](_0x2ae55b['where'],{'$or':_['map'](_0x2296df,function(_0x573b47){if(_0x573b47[_0x4846('0x29')]!==_0x4846('0x37')){var _0x419004={};_0x419004[_0x573b47[_0x4846('0x25')]]={'$like':'%'+_0x51dbee[_0x4846('0x2b')][_0x4846('0x35')]+'%'};return _0x419004;}})});}_0x2ae55b=_[_0x4846('0x36')]({},_0x2ae55b,_0x51dbee[_0x4846('0x38')]);var _0xdc6aed={'where':_0x2ae55b[_0x4846('0x33')]};return db[_0x4846('0x27')][_0x4846('0x1d')](_0xdc6aed)[_0x4846('0x23')](function(_0x523be0){_0x4eeac0[_0x4846('0x1d')]=_0x523be0;if(_0x51dbee[_0x4846('0x2b')][_0x4846('0x39')]){_0x2ae55b[_0x4846('0x3a')]=[{'all':!![]}];}return db[_0x4846('0x27')][_0x4846('0x3b')](_0x2ae55b);})[_0x4846('0x23')](function(_0x1c4016){_0x4eeac0[_0x4846('0x3c')]=_0x1c4016;return _0x4eeac0;})[_0x4846('0x23')](respondWithFilteredResult(_0x365168,_0x2ae55b))[_0x4846('0x3d')](handleError(_0x365168,null));};exports[_0x4846('0x3e')]=function(_0x123d33,_0x17cfda){var _0x3a0275={'raw':![],'where':{'id':_0x123d33[_0x4846('0x3f')]['id']}},_0x4aad21={};_0x4aad21['model']=_[_0x4846('0x40')](db['SalesforceConfiguration'][_0x4846('0x28')]);_0x4aad21[_0x4846('0x2b')]=_[_0x4846('0x40')](_0x123d33['query']);_0x4aad21[_0x4846('0x2c')]=_[_0x4846('0x2d')](_0x4aad21[_0x4846('0x2a')],_0x4aad21[_0x4846('0x2b')]);_0x3a0275[_0x4846('0x2e')]=_[_0x4846('0x2d')](_0x4aad21[_0x4846('0x2a')],qs['fields'](_0x123d33[_0x4846('0x2b')][_0x4846('0x2f')]));_0x3a0275[_0x4846('0x2e')]=_0x3a0275[_0x4846('0x2e')][_0x4846('0x41')]?_0x3a0275[_0x4846('0x2e')]:_0x4aad21[_0x4846('0x2a')];if(_0x123d33[_0x4846('0x2b')]['includeAll']){_0x3a0275[_0x4846('0x3a')]=[{'all':!![]}];}_0x3a0275=_['merge']({},_0x3a0275,_0x123d33['options']);return db[_0x4846('0x27')]['find'](_0x3a0275)[_0x4846('0x23')](handleEntityNotFound(_0x17cfda,null))[_0x4846('0x23')](respondWithResult(_0x17cfda,null))['catch'](handleError(_0x17cfda,null));};exports[_0x4846('0x42')]=function(_0x2dd6b4,_0x1dcaf4){return db[_0x4846('0x27')][_0x4846('0x42')](_0x2dd6b4[_0x4846('0x43')],{})[_0x4846('0x23')](respondWithResult(_0x1dcaf4,0xc9))['catch'](handleError(_0x1dcaf4,null));};exports['update']=function(_0x1c2229,_0x233c21){if(_0x1c2229[_0x4846('0x43')]['id']){delete _0x1c2229[_0x4846('0x43')]['id'];}return db[_0x4846('0x27')]['find']({'where':{'id':_0x1c2229['params']['id']}})[_0x4846('0x23')](handleEntityNotFound(_0x233c21,null))[_0x4846('0x23')](saveUpdates(_0x1c2229['body'],null))[_0x4846('0x23')](respondWithResult(_0x233c21,null))[_0x4846('0x3d')](handleError(_0x233c21,null));};exports['destroy']=function(_0x378bb1,_0x9eb83e){return db[_0x4846('0x27')]['find']({'where':{'id':_0x378bb1['params']['id']}})[_0x4846('0x23')](handleEntityNotFound(_0x9eb83e,null))[_0x4846('0x23')](removeEntity(_0x9eb83e,null))[_0x4846('0x3d')](handleError(_0x9eb83e,null));};exports[_0x4846('0x44')]=function(_0x22d21b,_0xe6a6fb,_0xef4687){var _0x3868f5={};var _0x4c35de={};var _0x4bf67d;var _0x1a37eb;return db[_0x4846('0x27')]['findOne']({'where':{'id':_0x22d21b['params']['id']}})['then'](handleEntityNotFound(_0xe6a6fb,null))[_0x4846('0x23')](function(_0x2fd5e4){if(_0x2fd5e4){_0x4bf67d=_0x2fd5e4;_0x4c35de[_0x4846('0x2a')]=_['keys'](db['SalesforceField'][_0x4846('0x28')]);_0x4c35de['query']=_[_0x4846('0x40')](_0x22d21b[_0x4846('0x2b')]);_0x4c35de['filters']=_[_0x4846('0x2d')](_0x4c35de[_0x4846('0x2a')],_0x4c35de[_0x4846('0x2b')]);_0x3868f5['attributes']=_['intersection'](_0x4c35de[_0x4846('0x2a')],qs[_0x4846('0x2f')](_0x22d21b['query'][_0x4846('0x2f')]));_0x3868f5[_0x4846('0x2e')]=_0x3868f5[_0x4846('0x2e')][_0x4846('0x41')]?_0x3868f5[_0x4846('0x2e')]:_0x4c35de['model'];_0x3868f5[_0x4846('0x45')]=qs[_0x4846('0x32')](_0x22d21b['query']['sort']);_0x3868f5[_0x4846('0x33')]=qs[_0x4846('0x2c')](_[_0x4846('0x34')](_0x22d21b[_0x4846('0x2b')],_0x4c35de[_0x4846('0x2c')]));if(_0x22d21b[_0x4846('0x2b')][_0x4846('0x35')]){_0x3868f5[_0x4846('0x33')]=_[_0x4846('0x36')](_0x3868f5[_0x4846('0x33')],{'$or':_[_0x4846('0x26')](_0x3868f5['attributes'],function(_0x46960b){var _0x30cd5d={};_0x30cd5d[_0x46960b]={'$like':'%'+_0x22d21b[_0x4846('0x2b')][_0x4846('0x35')]+'%'};return _0x30cd5d;})});}_0x3868f5=_[_0x4846('0x36')]({},_0x3868f5,_0x22d21b[_0x4846('0x38')]);return _0x4bf67d[_0x4846('0x44')](_0x3868f5);}})[_0x4846('0x23')](function(_0xa2fb64){if(_0xa2fb64){_0x1a37eb=_0xa2fb64[_0x4846('0x41')];if(!_0x22d21b['query'][_0x4846('0x46')]('nolimit')){_0x3868f5[_0x4846('0x31')]=qs['limit'](_0x22d21b[_0x4846('0x2b')][_0x4846('0x31')]);_0x3868f5[_0x4846('0x1b')]=qs['offset'](_0x22d21b['query'][_0x4846('0x1b')]);}return _0x4bf67d[_0x4846('0x44')](_0x3868f5);}})['then'](function(_0x18fa18){if(_0x18fa18){return _0x18fa18?{'count':_0x1a37eb,'rows':_0x18fa18}:null;}})[_0x4846('0x23')](respondWithResult(_0xe6a6fb,null))[_0x4846('0x3d')](handleError(_0xe6a6fb,null));};exports[_0x4846('0x47')]=function(_0x35a77c,_0x3d6b08,_0x1475c0){var _0xc32ce9={};var _0x375e37={};var _0x3e4424;var _0x36aa24;return db[_0x4846('0x27')]['findOne']({'where':{'id':_0x35a77c[_0x4846('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3d6b08,null))['then'](function(_0x13ec2f){if(_0x13ec2f){_0x3e4424=_0x13ec2f;_0x375e37[_0x4846('0x2a')]=_[_0x4846('0x40')](db[_0x4846('0x48')][_0x4846('0x28')]);_0x375e37[_0x4846('0x2b')]=_[_0x4846('0x40')](_0x35a77c[_0x4846('0x2b')]);_0x375e37[_0x4846('0x2c')]=_[_0x4846('0x2d')](_0x375e37['model'],_0x375e37[_0x4846('0x2b')]);_0xc32ce9[_0x4846('0x2e')]=_[_0x4846('0x2d')](_0x375e37[_0x4846('0x2a')],qs[_0x4846('0x2f')](_0x35a77c['query'][_0x4846('0x2f')]));_0xc32ce9[_0x4846('0x2e')]=_0xc32ce9[_0x4846('0x2e')][_0x4846('0x41')]?_0xc32ce9[_0x4846('0x2e')]:_0x375e37[_0x4846('0x2a')];_0xc32ce9[_0x4846('0x45')]=qs[_0x4846('0x32')](_0x35a77c[_0x4846('0x2b')][_0x4846('0x32')]);_0xc32ce9[_0x4846('0x33')]=qs[_0x4846('0x2c')](_[_0x4846('0x34')](_0x35a77c[_0x4846('0x2b')],_0x375e37[_0x4846('0x2c')]));if(_0x35a77c['query'][_0x4846('0x35')]){_0xc32ce9[_0x4846('0x33')]=_['merge'](_0xc32ce9[_0x4846('0x33')],{'$or':_[_0x4846('0x26')](_0xc32ce9['attributes'],function(_0x1a202f){var _0x451aaa={};_0x451aaa[_0x1a202f]={'$like':'%'+_0x35a77c[_0x4846('0x2b')][_0x4846('0x35')]+'%'};return _0x451aaa;})});}_0xc32ce9=_['merge']({},_0xc32ce9,_0x35a77c['options']);return _0x3e4424[_0x4846('0x47')](_0xc32ce9);}})[_0x4846('0x23')](function(_0x8e4623){if(_0x8e4623){_0x36aa24=_0x8e4623['length'];if(!_0x35a77c[_0x4846('0x2b')][_0x4846('0x46')](_0x4846('0x30'))){_0xc32ce9[_0x4846('0x31')]=qs[_0x4846('0x31')](_0x35a77c[_0x4846('0x2b')][_0x4846('0x31')]);_0xc32ce9[_0x4846('0x1b')]=qs['offset'](_0x35a77c['query'][_0x4846('0x1b')]);}return _0x3e4424[_0x4846('0x47')](_0xc32ce9);}})[_0x4846('0x23')](function(_0x5716d7){if(_0x5716d7){return _0x5716d7?{'count':_0x36aa24,'rows':_0x5716d7}:null;}})[_0x4846('0x23')](respondWithResult(_0x3d6b08,null))[_0x4846('0x3d')](handleError(_0x3d6b08,null));};exports['getDescriptions']=function(_0x54d47b,_0x145bf1,_0x18ab50){var _0x1fa84e={};var _0x22ac2b={};var _0x3a4b4d;var _0x31f6d2;return db[_0x4846('0x27')][_0x4846('0x49')]({'where':{'id':_0x54d47b[_0x4846('0x3f')]['id']}})['then'](handleEntityNotFound(_0x145bf1,null))[_0x4846('0x23')](function(_0x447ce6){if(_0x447ce6){_0x3a4b4d=_0x447ce6;_0x22ac2b[_0x4846('0x2a')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x22ac2b[_0x4846('0x2b')]=_['keys'](_0x54d47b['query']);_0x22ac2b[_0x4846('0x2c')]=_[_0x4846('0x2d')](_0x22ac2b['model'],_0x22ac2b['query']);_0x1fa84e[_0x4846('0x2e')]=_['intersection'](_0x22ac2b[_0x4846('0x2a')],qs[_0x4846('0x2f')](_0x54d47b[_0x4846('0x2b')][_0x4846('0x2f')]));_0x1fa84e['attributes']=_0x1fa84e[_0x4846('0x2e')]['length']?_0x1fa84e[_0x4846('0x2e')]:_0x22ac2b['model'];_0x1fa84e[_0x4846('0x45')]=qs[_0x4846('0x32')](_0x54d47b[_0x4846('0x2b')][_0x4846('0x32')]);_0x1fa84e[_0x4846('0x33')]=qs['filters'](_[_0x4846('0x34')](_0x54d47b[_0x4846('0x2b')],_0x22ac2b['filters']));if(_0x54d47b['query']['filter']){_0x1fa84e[_0x4846('0x33')]=_[_0x4846('0x36')](_0x1fa84e[_0x4846('0x33')],{'$or':_[_0x4846('0x26')](_0x1fa84e[_0x4846('0x2e')],function(_0x1c1eea){var _0x5cee06={};_0x5cee06[_0x1c1eea]={'$like':'%'+_0x54d47b['query'][_0x4846('0x35')]+'%'};return _0x5cee06;})});}_0x1fa84e=_[_0x4846('0x36')]({},_0x1fa84e,_0x54d47b[_0x4846('0x38')]);return _0x3a4b4d['getDescriptions'](_0x1fa84e);}})['then'](function(_0x4ccc8a){if(_0x4ccc8a){_0x31f6d2=_0x4ccc8a[_0x4846('0x41')];if(!_0x54d47b[_0x4846('0x2b')]['hasOwnProperty']('nolimit')){_0x1fa84e[_0x4846('0x31')]=qs[_0x4846('0x31')](_0x54d47b['query'][_0x4846('0x31')]);_0x1fa84e[_0x4846('0x1b')]=qs[_0x4846('0x1b')](_0x54d47b[_0x4846('0x2b')][_0x4846('0x1b')]);}return _0x3a4b4d['getDescriptions'](_0x1fa84e);}})['then'](function(_0x456099){if(_0x456099){return _0x456099?{'count':_0x31f6d2,'rows':_0x456099}:null;}})[_0x4846('0x23')](respondWithResult(_0x145bf1,null))[_0x4846('0x3d')](handleError(_0x145bf1,null));}; \ No newline at end of file +var _0x602c=['limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','SalesforceConfiguration','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','includeAll','include','rows','show','params','keys','options','find','catch','create','body','getFields','SalesforceField','pick','nolimit','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count'];(function(_0x1b51ea,_0x394fd9){var _0x18bbdc=function(_0x45b83f){while(--_0x45b83f){_0x1b51ea['push'](_0x1b51ea['shift']());}};_0x18bbdc(++_0x394fd9);}(_0x602c,0x11a));var _0xc602=function(_0x3d63f6,_0x8cd7e4){_0x3d63f6=_0x3d63f6-0x0;var _0x2ac67b=_0x602c[_0x3d63f6];return _0x2ac67b;};'use strict';var emlformat=require(_0xc602('0x0'));var rimraf=require(_0xc602('0x1'));var zipdir=require(_0xc602('0x2'));var jsonpatch=require(_0xc602('0x3'));var rp=require(_0xc602('0x4'));var moment=require(_0xc602('0x5'));var BPromise=require(_0xc602('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc602('0x7'));var sox=require(_0xc602('0x8'));var csv=require(_0xc602('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc602('0xa'));var crypto=require(_0xc602('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc602('0xc'));var toCsv=require(_0xc602('0x9'));var querystring=require(_0xc602('0xd'));var Papa=require(_0xc602('0xe'));var Redis=require(_0xc602('0xf'));var authService=require(_0xc602('0x10'));var qs=require(_0xc602('0x11'));var as=require(_0xc602('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc602('0x13'))(_0xc602('0x14'));var utils=require(_0xc602('0x15'));var config=require(_0xc602('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc602('0x17'))['db'];function respondWithStatusCode(_0x443f30,_0x3cc252){_0x3cc252=_0x3cc252||0xcc;return function(_0x3d86b9){if(_0x3d86b9){return _0x443f30[_0xc602('0x18')](_0x3cc252);}return _0x443f30[_0xc602('0x19')](_0x3cc252)['end']();};}function respondWithResult(_0x416e3a,_0x457ea6){_0x457ea6=_0x457ea6||0xc8;return function(_0x9c6a97){if(_0x9c6a97){return _0x416e3a[_0xc602('0x19')](_0x457ea6)[_0xc602('0x1a')](_0x9c6a97);}};}function respondWithFilteredResult(_0x271cd4,_0x29cbc2){return function(_0x2933e0){if(_0x2933e0){var _0x19f685=typeof _0x29cbc2[_0xc602('0x1b')]==='undefined'&&typeof _0x29cbc2['limit']===_0xc602('0x1c');var _0x52668c=_0x2933e0[_0xc602('0x1d')];var _0x781435=_0x19f685?0x0:_0x29cbc2[_0xc602('0x1b')];var _0x38238f=_0x19f685?_0x2933e0[_0xc602('0x1d')]:_0x29cbc2[_0xc602('0x1b')]+_0x29cbc2[_0xc602('0x1e')];var _0x119213;if(_0x38238f>=_0x52668c){_0x38238f=_0x52668c;_0x119213=0xc8;}else{_0x119213=0xce;}_0x271cd4[_0xc602('0x19')](_0x119213);return _0x271cd4[_0xc602('0x1f')](_0xc602('0x20'),_0x781435+'-'+_0x38238f+'/'+_0x52668c)[_0xc602('0x1a')](_0x2933e0);}return null;};}function patchUpdates(_0xfaf6b5){return function(_0x48044c){try{jsonpatch['apply'](_0x48044c,_0xfaf6b5,!![]);}catch(_0xde9e31){return BPromise[_0xc602('0x21')](_0xde9e31);}return _0x48044c[_0xc602('0x22')]();};}function saveUpdates(_0x4b78ba,_0x2934aa){return function(_0x49093b){if(_0x49093b){return _0x49093b[_0xc602('0x23')](_0x4b78ba)[_0xc602('0x24')](function(_0x5aac9d){return _0x5aac9d;});}return null;};}function removeEntity(_0x4d810b,_0x3a4005){return function(_0x5e9e34){if(_0x5e9e34){return _0x5e9e34[_0xc602('0x25')]()[_0xc602('0x24')](function(){_0x4d810b[_0xc602('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42d620,_0x18a4af){return function(_0x4bc05f){if(!_0x4bc05f){_0x42d620['sendStatus'](0x194);}return _0x4bc05f;};}function handleError(_0x39ff8b,_0x5bc389){_0x5bc389=_0x5bc389||0x1f4;return function(_0x2ad3ad){logger[_0xc602('0x26')](_0x2ad3ad[_0xc602('0x27')]);if(_0x2ad3ad[_0xc602('0x28')]){delete _0x2ad3ad['name'];}_0x39ff8b['status'](_0x5bc389)[_0xc602('0x29')](_0x2ad3ad);};}exports['index']=function(_0x4641a0,_0x7a0250){var _0x18f75a={},_0x20b334={},_0x1a665b={'count':0x0,'rows':[]};var _0x1c7105=_['map'](db[_0xc602('0x2a')][_0xc602('0x2b')],function(_0x2fcf04){return{'name':_0x2fcf04['fieldName'],'type':_0x2fcf04[_0xc602('0x2c')][_0xc602('0x2d')]};});_0x20b334[_0xc602('0x2e')]=_[_0xc602('0x2f')](_0x1c7105,_0xc602('0x28'));_0x20b334[_0xc602('0x30')]=_['keys'](_0x4641a0[_0xc602('0x30')]);_0x20b334['filters']=_[_0xc602('0x31')](_0x20b334[_0xc602('0x2e')],_0x20b334[_0xc602('0x30')]);_0x18f75a[_0xc602('0x32')]=_[_0xc602('0x31')](_0x20b334[_0xc602('0x2e')],qs[_0xc602('0x33')](_0x4641a0[_0xc602('0x30')][_0xc602('0x33')]));_0x18f75a[_0xc602('0x32')]=_0x18f75a[_0xc602('0x32')][_0xc602('0x34')]?_0x18f75a['attributes']:_0x20b334[_0xc602('0x2e')];if(!_0x4641a0[_0xc602('0x30')][_0xc602('0x35')]('nolimit')){_0x18f75a['limit']=qs[_0xc602('0x1e')](_0x4641a0[_0xc602('0x30')][_0xc602('0x1e')]);_0x18f75a[_0xc602('0x1b')]=qs[_0xc602('0x1b')](_0x4641a0[_0xc602('0x30')]['offset']);}_0x18f75a[_0xc602('0x36')]=qs[_0xc602('0x37')](_0x4641a0[_0xc602('0x30')][_0xc602('0x37')]);_0x18f75a[_0xc602('0x38')]=qs[_0xc602('0x39')](_['pick'](_0x4641a0[_0xc602('0x30')],_0x20b334['filters']),_0x1c7105);if(_0x4641a0[_0xc602('0x30')][_0xc602('0x3a')]){_0x18f75a['where']=_[_0xc602('0x3b')](_0x18f75a[_0xc602('0x38')],{'$or':_[_0xc602('0x2f')](_0x1c7105,function(_0x1dab84){if(_0x1dab84[_0xc602('0x2c')]!=='VIRTUAL'){var _0x42fbcb={};_0x42fbcb[_0x1dab84[_0xc602('0x28')]]={'$like':'%'+_0x4641a0[_0xc602('0x30')]['filter']+'%'};return _0x42fbcb;}})});}_0x18f75a=_[_0xc602('0x3b')]({},_0x18f75a,_0x4641a0['options']);var _0x173b27={'where':_0x18f75a['where']};return db['SalesforceConfiguration'][_0xc602('0x1d')](_0x173b27)['then'](function(_0x310f2f){_0x1a665b['count']=_0x310f2f;if(_0x4641a0['query'][_0xc602('0x3c')]){_0x18f75a[_0xc602('0x3d')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x18f75a);})[_0xc602('0x24')](function(_0x418cb4){_0x1a665b[_0xc602('0x3e')]=_0x418cb4;return _0x1a665b;})[_0xc602('0x24')](respondWithFilteredResult(_0x7a0250,_0x18f75a))['catch'](handleError(_0x7a0250,null));};exports[_0xc602('0x3f')]=function(_0x46a9fc,_0x241538){var _0x658698={'raw':![],'where':{'id':_0x46a9fc[_0xc602('0x40')]['id']}},_0x3737a9={};_0x3737a9[_0xc602('0x2e')]=_[_0xc602('0x41')](db[_0xc602('0x2a')]['rawAttributes']);_0x3737a9[_0xc602('0x30')]=_[_0xc602('0x41')](_0x46a9fc[_0xc602('0x30')]);_0x3737a9[_0xc602('0x39')]=_[_0xc602('0x31')](_0x3737a9['model'],_0x3737a9[_0xc602('0x30')]);_0x658698['attributes']=_['intersection'](_0x3737a9[_0xc602('0x2e')],qs[_0xc602('0x33')](_0x46a9fc['query'][_0xc602('0x33')]));_0x658698[_0xc602('0x32')]=_0x658698['attributes'][_0xc602('0x34')]?_0x658698[_0xc602('0x32')]:_0x3737a9['model'];if(_0x46a9fc[_0xc602('0x30')][_0xc602('0x3c')]){_0x658698[_0xc602('0x3d')]=[{'all':!![]}];}_0x658698=_[_0xc602('0x3b')]({},_0x658698,_0x46a9fc[_0xc602('0x42')]);return db['SalesforceConfiguration'][_0xc602('0x43')](_0x658698)['then'](handleEntityNotFound(_0x241538,null))[_0xc602('0x24')](respondWithResult(_0x241538,null))[_0xc602('0x44')](handleError(_0x241538,null));};exports[_0xc602('0x45')]=function(_0x2385c7,_0x249ed2){return db[_0xc602('0x2a')]['create'](_0x2385c7[_0xc602('0x46')],{})[_0xc602('0x24')](respondWithResult(_0x249ed2,0xc9))[_0xc602('0x44')](handleError(_0x249ed2,null));};exports[_0xc602('0x23')]=function(_0x2212cc,_0x442ad9){if(_0x2212cc[_0xc602('0x46')]['id']){delete _0x2212cc[_0xc602('0x46')]['id'];}return db['SalesforceConfiguration'][_0xc602('0x43')]({'where':{'id':_0x2212cc[_0xc602('0x40')]['id']}})['then'](handleEntityNotFound(_0x442ad9,null))['then'](saveUpdates(_0x2212cc[_0xc602('0x46')],null))[_0xc602('0x24')](respondWithResult(_0x442ad9,null))[_0xc602('0x44')](handleError(_0x442ad9,null));};exports['destroy']=function(_0x450c18,_0x45150e){return db['SalesforceConfiguration'][_0xc602('0x43')]({'where':{'id':_0x450c18[_0xc602('0x40')]['id']}})[_0xc602('0x24')](handleEntityNotFound(_0x45150e,null))['then'](removeEntity(_0x45150e,null))[_0xc602('0x44')](handleError(_0x45150e,null));};exports[_0xc602('0x47')]=function(_0x554407,_0x32fd1f,_0x2accf8){var _0x5aaa89={};var _0x160372={};var _0x4e7d56;var _0x9d9f1e;return db[_0xc602('0x2a')]['findOne']({'where':{'id':_0x554407['params']['id']}})[_0xc602('0x24')](handleEntityNotFound(_0x32fd1f,null))[_0xc602('0x24')](function(_0x20d373){if(_0x20d373){_0x4e7d56=_0x20d373;_0x160372['model']=_['keys'](db[_0xc602('0x48')][_0xc602('0x2b')]);_0x160372[_0xc602('0x30')]=_[_0xc602('0x41')](_0x554407[_0xc602('0x30')]);_0x160372['filters']=_[_0xc602('0x31')](_0x160372[_0xc602('0x2e')],_0x160372[_0xc602('0x30')]);_0x5aaa89[_0xc602('0x32')]=_[_0xc602('0x31')](_0x160372[_0xc602('0x2e')],qs[_0xc602('0x33')](_0x554407[_0xc602('0x30')][_0xc602('0x33')]));_0x5aaa89[_0xc602('0x32')]=_0x5aaa89[_0xc602('0x32')]['length']?_0x5aaa89[_0xc602('0x32')]:_0x160372[_0xc602('0x2e')];_0x5aaa89['order']=qs[_0xc602('0x37')](_0x554407['query'][_0xc602('0x37')]);_0x5aaa89['where']=qs[_0xc602('0x39')](_[_0xc602('0x49')](_0x554407[_0xc602('0x30')],_0x160372[_0xc602('0x39')]));if(_0x554407['query'][_0xc602('0x3a')]){_0x5aaa89[_0xc602('0x38')]=_[_0xc602('0x3b')](_0x5aaa89[_0xc602('0x38')],{'$or':_[_0xc602('0x2f')](_0x5aaa89[_0xc602('0x32')],function(_0x3d4b42){var _0x396c2b={};_0x396c2b[_0x3d4b42]={'$like':'%'+_0x554407['query'][_0xc602('0x3a')]+'%'};return _0x396c2b;})});}_0x5aaa89=_[_0xc602('0x3b')]({},_0x5aaa89,_0x554407['options']);return _0x4e7d56[_0xc602('0x47')](_0x5aaa89);}})[_0xc602('0x24')](function(_0x51759a){if(_0x51759a){_0x9d9f1e=_0x51759a[_0xc602('0x34')];if(!_0x554407[_0xc602('0x30')]['hasOwnProperty'](_0xc602('0x4a'))){_0x5aaa89[_0xc602('0x1e')]=qs['limit'](_0x554407[_0xc602('0x30')][_0xc602('0x1e')]);_0x5aaa89[_0xc602('0x1b')]=qs['offset'](_0x554407[_0xc602('0x30')][_0xc602('0x1b')]);}return _0x4e7d56[_0xc602('0x47')](_0x5aaa89);}})[_0xc602('0x24')](function(_0x288102){if(_0x288102){return _0x288102?{'count':_0x9d9f1e,'rows':_0x288102}:null;}})['then'](respondWithResult(_0x32fd1f,null))['catch'](handleError(_0x32fd1f,null));};exports[_0xc602('0x4b')]=function(_0x32876a,_0x403ea6,_0x53643a){var _0xb8bed3={};var _0x361e35={};var _0x4f53d8;var _0x14e553;return db[_0xc602('0x2a')][_0xc602('0x4c')]({'where':{'id':_0x32876a[_0xc602('0x40')]['id']}})[_0xc602('0x24')](handleEntityNotFound(_0x403ea6,null))[_0xc602('0x24')](function(_0x195c33){if(_0x195c33){_0x4f53d8=_0x195c33;_0x361e35['model']=_[_0xc602('0x41')](db['SalesforceField'][_0xc602('0x2b')]);_0x361e35[_0xc602('0x30')]=_[_0xc602('0x41')](_0x32876a[_0xc602('0x30')]);_0x361e35['filters']=_['intersection'](_0x361e35[_0xc602('0x2e')],_0x361e35[_0xc602('0x30')]);_0xb8bed3[_0xc602('0x32')]=_['intersection'](_0x361e35['model'],qs[_0xc602('0x33')](_0x32876a[_0xc602('0x30')][_0xc602('0x33')]));_0xb8bed3['attributes']=_0xb8bed3[_0xc602('0x32')][_0xc602('0x34')]?_0xb8bed3['attributes']:_0x361e35[_0xc602('0x2e')];_0xb8bed3[_0xc602('0x36')]=qs[_0xc602('0x37')](_0x32876a[_0xc602('0x30')][_0xc602('0x37')]);_0xb8bed3[_0xc602('0x38')]=qs['filters'](_[_0xc602('0x49')](_0x32876a['query'],_0x361e35['filters']));if(_0x32876a[_0xc602('0x30')]['filter']){_0xb8bed3['where']=_[_0xc602('0x3b')](_0xb8bed3[_0xc602('0x38')],{'$or':_[_0xc602('0x2f')](_0xb8bed3[_0xc602('0x32')],function(_0x22d01e){var _0x4fe035={};_0x4fe035[_0x22d01e]={'$like':'%'+_0x32876a['query'][_0xc602('0x3a')]+'%'};return _0x4fe035;})});}_0xb8bed3=_[_0xc602('0x3b')]({},_0xb8bed3,_0x32876a[_0xc602('0x42')]);return _0x4f53d8[_0xc602('0x4b')](_0xb8bed3);}})[_0xc602('0x24')](function(_0x5db893){if(_0x5db893){_0x14e553=_0x5db893[_0xc602('0x34')];if(!_0x32876a[_0xc602('0x30')][_0xc602('0x35')](_0xc602('0x4a'))){_0xb8bed3[_0xc602('0x1e')]=qs[_0xc602('0x1e')](_0x32876a[_0xc602('0x30')][_0xc602('0x1e')]);_0xb8bed3[_0xc602('0x1b')]=qs[_0xc602('0x1b')](_0x32876a['query'][_0xc602('0x1b')]);}return _0x4f53d8[_0xc602('0x4b')](_0xb8bed3);}})[_0xc602('0x24')](function(_0xfb3c4d){if(_0xfb3c4d){return _0xfb3c4d?{'count':_0x14e553,'rows':_0xfb3c4d}:null;}})[_0xc602('0x24')](respondWithResult(_0x403ea6,null))['catch'](handleError(_0x403ea6,null));};exports['getDescriptions']=function(_0x261821,_0x43b265,_0x5b0454){var _0x2728a7={};var _0x561aff={};var _0x5d4abf;var _0x14e6ba;return db[_0xc602('0x2a')][_0xc602('0x4c')]({'where':{'id':_0x261821[_0xc602('0x40')]['id']}})[_0xc602('0x24')](handleEntityNotFound(_0x43b265,null))['then'](function(_0x1d777e){if(_0x1d777e){_0x5d4abf=_0x1d777e;_0x561aff[_0xc602('0x2e')]=_['keys'](db[_0xc602('0x48')][_0xc602('0x2b')]);_0x561aff[_0xc602('0x30')]=_['keys'](_0x261821['query']);_0x561aff[_0xc602('0x39')]=_[_0xc602('0x31')](_0x561aff[_0xc602('0x2e')],_0x561aff['query']);_0x2728a7[_0xc602('0x32')]=_[_0xc602('0x31')](_0x561aff['model'],qs[_0xc602('0x33')](_0x261821[_0xc602('0x30')][_0xc602('0x33')]));_0x2728a7[_0xc602('0x32')]=_0x2728a7[_0xc602('0x32')][_0xc602('0x34')]?_0x2728a7[_0xc602('0x32')]:_0x561aff[_0xc602('0x2e')];_0x2728a7['order']=qs['sort'](_0x261821[_0xc602('0x30')][_0xc602('0x37')]);_0x2728a7['where']=qs['filters'](_[_0xc602('0x49')](_0x261821[_0xc602('0x30')],_0x561aff[_0xc602('0x39')]));if(_0x261821[_0xc602('0x30')][_0xc602('0x3a')]){_0x2728a7[_0xc602('0x38')]=_[_0xc602('0x3b')](_0x2728a7['where'],{'$or':_[_0xc602('0x2f')](_0x2728a7['attributes'],function(_0xa20d50){var _0x52f8c3={};_0x52f8c3[_0xa20d50]={'$like':'%'+_0x261821['query']['filter']+'%'};return _0x52f8c3;})});}_0x2728a7=_[_0xc602('0x3b')]({},_0x2728a7,_0x261821[_0xc602('0x42')]);return _0x5d4abf[_0xc602('0x4d')](_0x2728a7);}})[_0xc602('0x24')](function(_0x540163){if(_0x540163){_0x14e6ba=_0x540163['length'];if(!_0x261821[_0xc602('0x30')]['hasOwnProperty']('nolimit')){_0x2728a7['limit']=qs[_0xc602('0x1e')](_0x261821[_0xc602('0x30')][_0xc602('0x1e')]);_0x2728a7[_0xc602('0x1b')]=qs['offset'](_0x261821[_0xc602('0x30')]['offset']);}return _0x5d4abf[_0xc602('0x4d')](_0x2728a7);}})[_0xc602('0x24')](function(_0x62e93c){if(_0x62e93c){return _0x62e93c?{'count':_0x14e6ba,'rows':_0x62e93c}:null;}})[_0xc602('0x24')](respondWithResult(_0x43b265,null))[_0xc602('0x44')](handleError(_0x43b265,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index cdffef6..381559b 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 _0xa758=['path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','lodash','util','../../config/logger','api'];(function(_0x41d433,_0x4955c2){var _0x27fa4d=function(_0xda4e9e){while(--_0xda4e9e){_0x41d433['push'](_0x41d433['shift']());}};_0x27fa4d(++_0x4955c2);}(_0xa758,0x13c));var _0x8a75=function(_0x56f63f,_0x59b821){_0x56f63f=_0x56f63f-0x0;var _0x1930b5=_0xa758[_0x56f63f];return _0x1930b5;};'use strict';var _=require(_0x8a75('0x0'));var util=require(_0x8a75('0x1'));var logger=require(_0x8a75('0x2'))(_0x8a75('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a75('0x4'));var rimraf=require(_0x8a75('0x5'));var config=require(_0x8a75('0x6'));var attributes=require(_0x8a75('0x7'));module['exports']=function(_0x2b62f0,_0x3b0787){return _0x2b62f0['define']('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf4e=['./intSalesforceConfiguration.attributes','exports','define','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x571339,_0x5bcafb){var _0x5af8a6=function(_0x389251){while(--_0x389251){_0x571339['push'](_0x571339['shift']());}};_0x5af8a6(++_0x5bcafb);}(_0xaf4e,0xa8));var _0xeaf4=function(_0x1b4a53,_0x3bd549){_0x1b4a53=_0x1b4a53-0x0;var _0x5cd1ee=_0xaf4e[_0x1b4a53];return _0x5cd1ee;};'use strict';var _=require('lodash');var util=require(_0xeaf4('0x0'));var logger=require(_0xeaf4('0x1'))(_0xeaf4('0x2'));var moment=require(_0xeaf4('0x3'));var BPromise=require('bluebird');var rp=require(_0xeaf4('0x4'));var fs=require('fs');var path=require(_0xeaf4('0x5'));var rimraf=require(_0xeaf4('0x6'));var config=require(_0xeaf4('0x7'));var attributes=require(_0xeaf4('0x8'));module[_0xeaf4('0x9')]=function(_0x59c5e1,_0x2e862d){return _0x59c5e1[_0xeaf4('0xa')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','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 92c1e3d..f7fbeb8 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 _0x045c=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x045c,0x8a));var _0xc045=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x045c[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0xc045('0x0'));var util=require(_0xc045('0x1'));var moment=require(_0xc045('0x2'));var BPromise=require(_0xc045('0x3'));var rs=require(_0xc045('0x4'));var fs=require('fs');var Redis=require(_0xc045('0x5'));var db=require(_0xc045('0x6'))['db'];var utils=require(_0xc045('0x7'));var logger=require('../../config/logger')(_0xc045('0x8'));var config=require('../../config/environment');var jayson=require(_0xc045('0x9'));var client=jayson[_0xc045('0xa')][_0xc045('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39c23e,_0xb5293c,_0xf44351){return new BPromise(function(_0x30e3b7,_0x171aea){return client[_0xc045('0xc')](_0x39c23e,_0xf44351)[_0xc045('0xd')](function(_0x3d1746){logger[_0xc045('0xe')](_0xc045('0xf'),_0xb5293c,_0xc045('0x10'));logger[_0xc045('0x11')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0xb5293c,'request\x20sent',JSON[_0xc045('0x12')](_0x3d1746));if(_0x3d1746[_0xc045('0x13')]){if(_0x3d1746[_0xc045('0x13')][_0xc045('0x14')]===0x1f4){logger[_0xc045('0x13')](_0xc045('0xf'),_0xb5293c,_0x3d1746[_0xc045('0x13')][_0xc045('0x15')]);return _0x171aea(_0x3d1746['error'][_0xc045('0x15')]);}logger[_0xc045('0x13')](_0xc045('0xf'),_0xb5293c,_0x3d1746[_0xc045('0x13')][_0xc045('0x15')]);return _0x30e3b7(_0x3d1746[_0xc045('0x13')]['message']);}else{logger['info'](_0xc045('0xf'),_0xb5293c,_0xc045('0x10'));_0x30e3b7(_0x3d1746[_0xc045('0x16')][_0xc045('0x15')]);}})[_0xc045('0x17')](function(_0x266ff9){logger['error'](_0xc045('0xf'),_0xb5293c,_0x266ff9);_0x171aea(_0x266ff9);});});} \ No newline at end of file +var _0x4583=['error','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x40c596,_0x723936){var _0x3ab17d=function(_0x5425fd){while(--_0x5425fd){_0x40c596['push'](_0x40c596['shift']());}};_0x3ab17d(++_0x723936);}(_0x4583,0xb8));var _0x3458=function(_0x55d145,_0x350a15){_0x55d145=_0x55d145-0x0;var _0xc96ec4=_0x4583[_0x55d145];return _0xc96ec4;};'use strict';var _=require(_0x3458('0x0'));var util=require(_0x3458('0x1'));var moment=require(_0x3458('0x2'));var BPromise=require(_0x3458('0x3'));var rs=require(_0x3458('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3458('0x5'))['db'];var utils=require(_0x3458('0x6'));var logger=require(_0x3458('0x7'))('rpc');var config=require(_0x3458('0x8'));var jayson=require(_0x3458('0x9'));var client=jayson['client'][_0x3458('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x366e73,_0x1e3c1d,_0x59f69d){return new BPromise(function(_0x2dc8cd,_0x6887c6){return client[_0x3458('0xb')](_0x366e73,_0x59f69d)[_0x3458('0xc')](function(_0x19bfcb){logger['info'](_0x3458('0xd'),_0x1e3c1d,_0x3458('0xe'));logger['debug'](_0x3458('0xf'),_0x1e3c1d,_0x3458('0xe'),JSON['stringify'](_0x19bfcb));if(_0x19bfcb[_0x3458('0x10')]){if(_0x19bfcb[_0x3458('0x10')]['code']===0x1f4){logger[_0x3458('0x10')](_0x3458('0xd'),_0x1e3c1d,_0x19bfcb[_0x3458('0x10')][_0x3458('0x11')]);return _0x6887c6(_0x19bfcb[_0x3458('0x10')][_0x3458('0x11')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x1e3c1d,_0x19bfcb[_0x3458('0x10')][_0x3458('0x11')]);return _0x2dc8cd(_0x19bfcb[_0x3458('0x10')][_0x3458('0x11')]);}else{logger[_0x3458('0x12')](_0x3458('0xd'),_0x1e3c1d,_0x3458('0xe'));_0x2dc8cd(_0x19bfcb['result'][_0x3458('0x11')]);}})[_0x3458('0x13')](function(_0x288759){logger[_0x3458('0x10')](_0x3458('0xd'),_0x1e3c1d,_0x288759);_0x6887c6(_0x288759);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index d6504e8..d6bd740 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 _0x3448=['delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','put','update'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x3448,0xb2));var _0x8344=function(_0xcaed74,_0x54fb6d){_0xcaed74=_0xcaed74-0x0;var _0x15d61a=_0x3448[_0xcaed74];return _0x15d61a;};'use strict';var multer=require(_0x8344('0x0'));var util=require('util');var path=require(_0x8344('0x1'));var timeout=require(_0x8344('0x2'));var express=require(_0x8344('0x3'));var router=express[_0x8344('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8344('0x5'));var interaction=require(_0x8344('0x6'));var config=require(_0x8344('0x7'));var controller=require('./intSalesforceField.controller');router[_0x8344('0x8')]('/',auth[_0x8344('0x9')](),controller['index']);router[_0x8344('0x8')](_0x8344('0xa'),auth[_0x8344('0x9')](),controller['show']);router[_0x8344('0xb')]('/',auth[_0x8344('0x9')](),controller['create']);router[_0x8344('0xc')](_0x8344('0xa'),auth[_0x8344('0x9')](),controller[_0x8344('0xd')]);router[_0x8344('0xe')](_0x8344('0xa'),auth['isAuthenticated'](),controller[_0x8344('0xf')]);module['exports']=router; \ No newline at end of file +var _0x104f=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','get','/:id','show','post','create','put','delete','destroy'];(function(_0x452984,_0xba5fcf){var _0x15c5ae=function(_0x428304){while(--_0x428304){_0x452984['push'](_0x452984['shift']());}};_0x15c5ae(++_0xba5fcf);}(_0x104f,0xa1));var _0xf104=function(_0x371942,_0x598b55){_0x371942=_0x371942-0x0;var _0x1f61ae=_0x104f[_0x371942];return _0x1f61ae;};'use strict';var multer=require('multer');var util=require(_0xf104('0x0'));var path=require(_0xf104('0x1'));var timeout=require(_0xf104('0x2'));var express=require(_0xf104('0x3'));var router=express[_0xf104('0x4')]();var fs_extra=require(_0xf104('0x5'));var auth=require(_0xf104('0x6'));var interaction=require(_0xf104('0x7'));var config=require(_0xf104('0x8'));var controller=require(_0xf104('0x9'));router['get']('/',auth[_0xf104('0xa')](),controller['index']);router[_0xf104('0xb')](_0xf104('0xc'),auth[_0xf104('0xa')](),controller[_0xf104('0xd')]);router[_0xf104('0xe')]('/',auth['isAuthenticated'](),controller[_0xf104('0xf')]);router[_0xf104('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf104('0x11')](_0xf104('0xc'),auth[_0xf104('0xa')](),controller[_0xf104('0x12')]);module[_0xf104('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 00eacce..572c872 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 _0x7130=['ENUM','string','customVariable','keyValue','STRING','variable','exports'];(function(_0x2da25b,_0x235828){var _0x660393=function(_0x23ef8c){while(--_0x23ef8c){_0x2da25b['push'](_0x2da25b['shift']());}};_0x660393(++_0x235828);}(_0x7130,0x84));var _0x0713=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7130[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module[_0x0713('0x0')]={'type':{'type':Sequelize[_0x0713('0x1')](_0x0713('0x2'),'variable',_0x0713('0x3'),_0x0713('0x4'),'picklist'),'defaultValue':_0x0713('0x2')},'content':{'type':Sequelize[_0x0713('0x5')]},'key':{'type':Sequelize[_0x0713('0x5')]},'keyType':{'type':Sequelize[_0x0713('0x1')](_0x0713('0x2'),_0x0713('0x6'),_0x0713('0x3'))},'keyContent':{'type':Sequelize[_0x0713('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x0713('0x5')]}}; \ No newline at end of file +var _0xf004=['customVariable','keyValue','picklist','STRING','sequelize','ENUM','string','variable'];(function(_0x360cc7,_0x2373f4){var _0x36c3b7=function(_0x112d09){while(--_0x112d09){_0x360cc7['push'](_0x360cc7['shift']());}};_0x36c3b7(++_0x2373f4);}(_0xf004,0x1c4));var _0x4f00=function(_0x3d3cf2,_0x287c33){_0x3d3cf2=_0x3d3cf2-0x0;var _0x3ccf2a=_0xf004[_0x3d3cf2];return _0x3ccf2a;};'use strict';var Sequelize=require(_0x4f00('0x0'));module['exports']={'type':{'type':Sequelize[_0x4f00('0x1')](_0x4f00('0x2'),_0x4f00('0x3'),_0x4f00('0x4'),_0x4f00('0x5'),_0x4f00('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4f00('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4f00('0x1')]('string',_0x4f00('0x3'),_0x4f00('0x4'))},'keyContent':{'type':Sequelize[_0x4f00('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x4f00('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index c6c452d..5316585 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 _0x31e0=['save','update','then','destroy','end','sendStatus','error','stack','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','length','includeAll','find','create','body','rimraf','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x1dcf37,_0x150062){var _0x4323ea=function(_0x1743e3){while(--_0x1743e3){_0x1dcf37['push'](_0x1dcf37['shift']());}};_0x4323ea(++_0x150062);}(_0x31e0,0x1a2));var _0x031e=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x31e0[_0x556bb1];return _0x45455f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x031e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x031e('0x1'));var path=require('path');var sox=require(_0x031e('0x2'));var csv=require(_0x031e('0x3'));var ejs=require(_0x031e('0x4'));var fs=require('fs');var fs_extra=require(_0x031e('0x5'));var _=require(_0x031e('0x6'));var squel=require('squel');var crypto=require(_0x031e('0x7'));var jsforce=require(_0x031e('0x8'));var deskjs=require(_0x031e('0x9'));var toCsv=require('to-csv');var querystring=require(_0x031e('0xa'));var Papa=require(_0x031e('0xb'));var Redis=require(_0x031e('0xc'));var authService=require(_0x031e('0xd'));var qs=require(_0x031e('0xe'));var as=require(_0x031e('0xf'));var hardwareService=require(_0x031e('0x10'));var logger=require(_0x031e('0x11'))(_0x031e('0x12'));var utils=require(_0x031e('0x13'));var config=require(_0x031e('0x14'));var licenseUtil=require(_0x031e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb3a25d,_0x2c76f7){_0x2c76f7=_0x2c76f7||0xcc;return function(_0x55fc79){if(_0x55fc79){return _0xb3a25d['sendStatus'](_0x2c76f7);}return _0xb3a25d['status'](_0x2c76f7)['end']();};}function respondWithResult(_0x32243c,_0x13f4bf){_0x13f4bf=_0x13f4bf||0xc8;return function(_0x5852e3){if(_0x5852e3){return _0x32243c[_0x031e('0x16')](_0x13f4bf)[_0x031e('0x17')](_0x5852e3);}};}function respondWithFilteredResult(_0xe1097d,_0x3568df){return function(_0xa28b24){if(_0xa28b24){var _0x50a7b1=typeof _0x3568df[_0x031e('0x18')]==='undefined'&&typeof _0x3568df['limit']===_0x031e('0x19');var _0x2a99ad=_0xa28b24[_0x031e('0x1a')];var _0x3a8a71=_0x50a7b1?0x0:_0x3568df[_0x031e('0x18')];var _0x5b0d31=_0x50a7b1?_0xa28b24['count']:_0x3568df[_0x031e('0x18')]+_0x3568df[_0x031e('0x1b')];var _0x2e79c4;if(_0x5b0d31>=_0x2a99ad){_0x5b0d31=_0x2a99ad;_0x2e79c4=0xc8;}else{_0x2e79c4=0xce;}_0xe1097d['status'](_0x2e79c4);return _0xe1097d[_0x031e('0x1c')](_0x031e('0x1d'),_0x3a8a71+'-'+_0x5b0d31+'/'+_0x2a99ad)[_0x031e('0x17')](_0xa28b24);}return null;};}function patchUpdates(_0x38e48b){return function(_0x5294ab){try{jsonpatch[_0x031e('0x1e')](_0x5294ab,_0x38e48b,!![]);}catch(_0x18360e){return BPromise[_0x031e('0x1f')](_0x18360e);}return _0x5294ab[_0x031e('0x20')]();};}function saveUpdates(_0x428d85,_0x4f0711){return function(_0x124820){if(_0x124820){return _0x124820[_0x031e('0x21')](_0x428d85)[_0x031e('0x22')](function(_0x400a39){return _0x400a39;});}return null;};}function removeEntity(_0x134410,_0x28301e){return function(_0x5343ca){if(_0x5343ca){return _0x5343ca[_0x031e('0x23')]()[_0x031e('0x22')](function(){_0x134410['status'](0xcc)[_0x031e('0x24')]();});}};}function handleEntityNotFound(_0x5aaec8,_0x2ee34c){return function(_0x1f4d24){if(!_0x1f4d24){_0x5aaec8[_0x031e('0x25')](0x194);}return _0x1f4d24;};}function handleError(_0x35f37a,_0x1d006a){_0x1d006a=_0x1d006a||0x1f4;return function(_0x38d342){logger[_0x031e('0x26')](_0x38d342[_0x031e('0x27')]);if(_0x38d342['name']){delete _0x38d342['name'];}_0x35f37a[_0x031e('0x16')](_0x1d006a)[_0x031e('0x28')](_0x38d342);};}exports[_0x031e('0x29')]=function(_0x5a9d55,_0x14324f){var _0x36b0b2={},_0x3869a0={},_0x5e2489={'count':0x0,'rows':[]};var _0x359ac9=_[_0x031e('0x2a')](db[_0x031e('0x2b')][_0x031e('0x2c')],function(_0x74c497){return{'name':_0x74c497[_0x031e('0x2d')],'type':_0x74c497[_0x031e('0x2e')][_0x031e('0x2f')]};});_0x3869a0[_0x031e('0x30')]=_[_0x031e('0x2a')](_0x359ac9,_0x031e('0x31'));_0x3869a0['query']=_['keys'](_0x5a9d55[_0x031e('0x32')]);_0x3869a0[_0x031e('0x33')]=_['intersection'](_0x3869a0[_0x031e('0x30')],_0x3869a0[_0x031e('0x32')]);_0x36b0b2[_0x031e('0x34')]=_[_0x031e('0x35')](_0x3869a0[_0x031e('0x30')],qs[_0x031e('0x36')](_0x5a9d55[_0x031e('0x32')][_0x031e('0x36')]));_0x36b0b2[_0x031e('0x34')]=_0x36b0b2[_0x031e('0x34')]['length']?_0x36b0b2[_0x031e('0x34')]:_0x3869a0[_0x031e('0x30')];if(!_0x5a9d55[_0x031e('0x32')][_0x031e('0x37')]('nolimit')){_0x36b0b2['limit']=qs['limit'](_0x5a9d55[_0x031e('0x32')][_0x031e('0x1b')]);_0x36b0b2[_0x031e('0x18')]=qs[_0x031e('0x18')](_0x5a9d55['query'][_0x031e('0x18')]);}_0x36b0b2[_0x031e('0x38')]=qs[_0x031e('0x39')](_0x5a9d55['query']['sort']);_0x36b0b2[_0x031e('0x3a')]=qs[_0x031e('0x33')](_[_0x031e('0x3b')](_0x5a9d55[_0x031e('0x32')],_0x3869a0[_0x031e('0x33')]),_0x359ac9);if(_0x5a9d55[_0x031e('0x32')]['filter']){_0x36b0b2['where']=_[_0x031e('0x3c')](_0x36b0b2[_0x031e('0x3a')],{'$or':_[_0x031e('0x2a')](_0x359ac9,function(_0x357982){if(_0x357982['type']!==_0x031e('0x3d')){var _0x4cb53c={};_0x4cb53c[_0x357982[_0x031e('0x31')]]={'$like':'%'+_0x5a9d55['query']['filter']+'%'};return _0x4cb53c;}})});}_0x36b0b2=_[_0x031e('0x3c')]({},_0x36b0b2,_0x5a9d55[_0x031e('0x3e')]);var _0x4bc227={'where':_0x36b0b2['where']};return db[_0x031e('0x2b')][_0x031e('0x1a')](_0x4bc227)[_0x031e('0x22')](function(_0x2b9915){_0x5e2489['count']=_0x2b9915;if(_0x5a9d55[_0x031e('0x32')]['includeAll']){_0x36b0b2[_0x031e('0x3f')]=[{'all':!![]}];}return db[_0x031e('0x2b')][_0x031e('0x40')](_0x36b0b2);})[_0x031e('0x22')](function(_0x15680d){_0x5e2489[_0x031e('0x41')]=_0x15680d;return _0x5e2489;})[_0x031e('0x22')](respondWithFilteredResult(_0x14324f,_0x36b0b2))[_0x031e('0x42')](handleError(_0x14324f,null));};exports[_0x031e('0x43')]=function(_0x353f9d,_0x5e8d07){var _0x2c59e1={'raw':!![],'where':{'id':_0x353f9d[_0x031e('0x44')]['id']}},_0x58a1ca={};_0x58a1ca[_0x031e('0x30')]=_[_0x031e('0x45')](db[_0x031e('0x2b')]['rawAttributes']);_0x58a1ca[_0x031e('0x32')]=_[_0x031e('0x45')](_0x353f9d[_0x031e('0x32')]);_0x58a1ca[_0x031e('0x33')]=_[_0x031e('0x35')](_0x58a1ca['model'],_0x58a1ca[_0x031e('0x32')]);_0x2c59e1[_0x031e('0x34')]=_[_0x031e('0x35')](_0x58a1ca[_0x031e('0x30')],qs['fields'](_0x353f9d['query']['fields']));_0x2c59e1[_0x031e('0x34')]=_0x2c59e1[_0x031e('0x34')][_0x031e('0x46')]?_0x2c59e1['attributes']:_0x58a1ca[_0x031e('0x30')];if(_0x353f9d[_0x031e('0x32')][_0x031e('0x47')]){_0x2c59e1[_0x031e('0x3f')]=[{'all':!![]}];}_0x2c59e1=_['merge']({},_0x2c59e1,_0x353f9d['options']);return db[_0x031e('0x2b')][_0x031e('0x48')](_0x2c59e1)['then'](handleEntityNotFound(_0x5e8d07,null))[_0x031e('0x22')](respondWithResult(_0x5e8d07,null))[_0x031e('0x42')](handleError(_0x5e8d07,null));};exports[_0x031e('0x49')]=function(_0x2efc50,_0x18e762){return db[_0x031e('0x2b')]['create'](_0x2efc50[_0x031e('0x4a')],{})[_0x031e('0x22')](respondWithResult(_0x18e762,0xc9))[_0x031e('0x42')](handleError(_0x18e762,null));};exports[_0x031e('0x21')]=function(_0x1b96d5,_0x2e04d3){if(_0x1b96d5[_0x031e('0x4a')]['id']){delete _0x1b96d5[_0x031e('0x4a')]['id'];}return db['SalesforceField'][_0x031e('0x48')]({'where':{'id':_0x1b96d5['params']['id']}})[_0x031e('0x22')](handleEntityNotFound(_0x2e04d3,null))[_0x031e('0x22')](saveUpdates(_0x1b96d5['body'],null))[_0x031e('0x22')](respondWithResult(_0x2e04d3,null))['catch'](handleError(_0x2e04d3,null));};exports[_0x031e('0x23')]=function(_0x23689d,_0x3c5c04){return db[_0x031e('0x2b')]['find']({'where':{'id':_0x23689d[_0x031e('0x44')]['id']}})[_0x031e('0x22')](handleEntityNotFound(_0x3c5c04,null))[_0x031e('0x22')](removeEntity(_0x3c5c04,null))[_0x031e('0x42')](handleError(_0x3c5c04,null));}; \ No newline at end of file +var _0x33de=['moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','save','then','destroy','error','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','merge','find','create','body','params','rimraf','fast-json-patch','request-promise'];(function(_0x11c76b,_0x4afd30){var _0x1c2e80=function(_0x56a9c1){while(--_0x56a9c1){_0x11c76b['push'](_0x11c76b['shift']());}};_0x1c2e80(++_0x4afd30);}(_0x33de,0x129));var _0xe33d=function(_0x395b12,_0x3a396b){_0x395b12=_0x395b12-0x0;var _0x5cddfb=_0x33de[_0x395b12];return _0x5cddfb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe33d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe33d('0x1'));var rp=require(_0xe33d('0x2'));var moment=require(_0xe33d('0x3'));var BPromise=require(_0xe33d('0x4'));var Mustache=require(_0xe33d('0x5'));var util=require(_0xe33d('0x6'));var path=require(_0xe33d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe33d('0x8'));var fs=require('fs');var fs_extra=require(_0xe33d('0x9'));var _=require(_0xe33d('0xa'));var squel=require(_0xe33d('0xb'));var crypto=require('crypto');var jsforce=require(_0xe33d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe33d('0xd'));var querystring=require(_0xe33d('0xe'));var Papa=require(_0xe33d('0xf'));var Redis=require(_0xe33d('0x10'));var authService=require(_0xe33d('0x11'));var qs=require(_0xe33d('0x12'));var as=require(_0xe33d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe33d('0x14'));var utils=require(_0xe33d('0x15'));var config=require(_0xe33d('0x16'));var licenseUtil=require(_0xe33d('0x17'));var db=require(_0xe33d('0x18'))['db'];function respondWithStatusCode(_0x4bb72e,_0x259c9a){_0x259c9a=_0x259c9a||0xcc;return function(_0x4da31a){if(_0x4da31a){return _0x4bb72e[_0xe33d('0x19')](_0x259c9a);}return _0x4bb72e['status'](_0x259c9a)[_0xe33d('0x1a')]();};}function respondWithResult(_0x39744c,_0x5004ee){_0x5004ee=_0x5004ee||0xc8;return function(_0x592a15){if(_0x592a15){return _0x39744c[_0xe33d('0x1b')](_0x5004ee)[_0xe33d('0x1c')](_0x592a15);}};}function respondWithFilteredResult(_0x4bf9bb,_0x2005ad){return function(_0x4692a6){if(_0x4692a6){var _0x12f2d7=typeof _0x2005ad[_0xe33d('0x1d')]==='undefined'&&typeof _0x2005ad['limit']===_0xe33d('0x1e');var _0x370274=_0x4692a6['count'];var _0xb232c1=_0x12f2d7?0x0:_0x2005ad[_0xe33d('0x1d')];var _0x43b8f9=_0x12f2d7?_0x4692a6[_0xe33d('0x1f')]:_0x2005ad[_0xe33d('0x1d')]+_0x2005ad[_0xe33d('0x20')];var _0xeb0cd4;if(_0x43b8f9>=_0x370274){_0x43b8f9=_0x370274;_0xeb0cd4=0xc8;}else{_0xeb0cd4=0xce;}_0x4bf9bb[_0xe33d('0x1b')](_0xeb0cd4);return _0x4bf9bb[_0xe33d('0x21')](_0xe33d('0x22'),_0xb232c1+'-'+_0x43b8f9+'/'+_0x370274)[_0xe33d('0x1c')](_0x4692a6);}return null;};}function patchUpdates(_0xc7e60b){return function(_0x4a9595){try{jsonpatch['apply'](_0x4a9595,_0xc7e60b,!![]);}catch(_0x5f5aa4){return BPromise['reject'](_0x5f5aa4);}return _0x4a9595[_0xe33d('0x23')]();};}function saveUpdates(_0x204e83,_0x19635d){return function(_0x1c4b89){if(_0x1c4b89){return _0x1c4b89['update'](_0x204e83)[_0xe33d('0x24')](function(_0x30d8bf){return _0x30d8bf;});}return null;};}function removeEntity(_0x1b9f33,_0xa0f979){return function(_0x5c1201){if(_0x5c1201){return _0x5c1201[_0xe33d('0x25')]()['then'](function(){_0x1b9f33[_0xe33d('0x1b')](0xcc)[_0xe33d('0x1a')]();});}};}function handleEntityNotFound(_0x31aa62,_0x204632){return function(_0x24ce4b){if(!_0x24ce4b){_0x31aa62['sendStatus'](0x194);}return _0x24ce4b;};}function handleError(_0x138c87,_0x5748a8){_0x5748a8=_0x5748a8||0x1f4;return function(_0x3f9fac){logger[_0xe33d('0x26')](_0x3f9fac[_0xe33d('0x27')]);if(_0x3f9fac['name']){delete _0x3f9fac[_0xe33d('0x28')];}_0x138c87[_0xe33d('0x1b')](_0x5748a8)[_0xe33d('0x29')](_0x3f9fac);};}exports[_0xe33d('0x2a')]=function(_0x4ca2a8,_0x3e555c){var _0x282c8e={},_0x3cbdd6={},_0x2b3ac8={'count':0x0,'rows':[]};var _0x4d2310=_['map'](db[_0xe33d('0x2b')][_0xe33d('0x2c')],function(_0x9e8585){return{'name':_0x9e8585[_0xe33d('0x2d')],'type':_0x9e8585[_0xe33d('0x2e')][_0xe33d('0x2f')]};});_0x3cbdd6[_0xe33d('0x30')]=_[_0xe33d('0x31')](_0x4d2310,_0xe33d('0x28'));_0x3cbdd6[_0xe33d('0x32')]=_[_0xe33d('0x33')](_0x4ca2a8[_0xe33d('0x32')]);_0x3cbdd6[_0xe33d('0x34')]=_['intersection'](_0x3cbdd6[_0xe33d('0x30')],_0x3cbdd6[_0xe33d('0x32')]);_0x282c8e[_0xe33d('0x35')]=_[_0xe33d('0x36')](_0x3cbdd6[_0xe33d('0x30')],qs[_0xe33d('0x37')](_0x4ca2a8[_0xe33d('0x32')][_0xe33d('0x37')]));_0x282c8e[_0xe33d('0x35')]=_0x282c8e[_0xe33d('0x35')][_0xe33d('0x38')]?_0x282c8e[_0xe33d('0x35')]:_0x3cbdd6[_0xe33d('0x30')];if(!_0x4ca2a8[_0xe33d('0x32')][_0xe33d('0x39')](_0xe33d('0x3a'))){_0x282c8e[_0xe33d('0x20')]=qs[_0xe33d('0x20')](_0x4ca2a8['query'][_0xe33d('0x20')]);_0x282c8e['offset']=qs[_0xe33d('0x1d')](_0x4ca2a8[_0xe33d('0x32')][_0xe33d('0x1d')]);}_0x282c8e[_0xe33d('0x3b')]=qs[_0xe33d('0x3c')](_0x4ca2a8[_0xe33d('0x32')][_0xe33d('0x3c')]);_0x282c8e[_0xe33d('0x3d')]=qs[_0xe33d('0x34')](_['pick'](_0x4ca2a8[_0xe33d('0x32')],_0x3cbdd6['filters']),_0x4d2310);if(_0x4ca2a8[_0xe33d('0x32')][_0xe33d('0x3e')]){_0x282c8e[_0xe33d('0x3d')]=_['merge'](_0x282c8e[_0xe33d('0x3d')],{'$or':_['map'](_0x4d2310,function(_0x3c86f9){if(_0x3c86f9[_0xe33d('0x2e')]!==_0xe33d('0x3f')){var _0x4f6728={};_0x4f6728[_0x3c86f9[_0xe33d('0x28')]]={'$like':'%'+_0x4ca2a8[_0xe33d('0x32')][_0xe33d('0x3e')]+'%'};return _0x4f6728;}})});}_0x282c8e=_['merge']({},_0x282c8e,_0x4ca2a8[_0xe33d('0x40')]);var _0x4ce5ac={'where':_0x282c8e[_0xe33d('0x3d')]};return db[_0xe33d('0x2b')][_0xe33d('0x1f')](_0x4ce5ac)[_0xe33d('0x24')](function(_0x5c24b2){_0x2b3ac8[_0xe33d('0x1f')]=_0x5c24b2;if(_0x4ca2a8[_0xe33d('0x32')][_0xe33d('0x41')]){_0x282c8e['include']=[{'all':!![]}];}return db['SalesforceField'][_0xe33d('0x42')](_0x282c8e);})[_0xe33d('0x24')](function(_0x53175a){_0x2b3ac8[_0xe33d('0x43')]=_0x53175a;return _0x2b3ac8;})[_0xe33d('0x24')](respondWithFilteredResult(_0x3e555c,_0x282c8e))[_0xe33d('0x44')](handleError(_0x3e555c,null));};exports[_0xe33d('0x45')]=function(_0x1c480d,_0x2d64aa){var _0x38cf18={'raw':!![],'where':{'id':_0x1c480d['params']['id']}},_0x449da8={};_0x449da8[_0xe33d('0x30')]=_['keys'](db[_0xe33d('0x2b')][_0xe33d('0x2c')]);_0x449da8[_0xe33d('0x32')]=_[_0xe33d('0x33')](_0x1c480d[_0xe33d('0x32')]);_0x449da8[_0xe33d('0x34')]=_['intersection'](_0x449da8[_0xe33d('0x30')],_0x449da8[_0xe33d('0x32')]);_0x38cf18['attributes']=_[_0xe33d('0x36')](_0x449da8[_0xe33d('0x30')],qs[_0xe33d('0x37')](_0x1c480d[_0xe33d('0x32')]['fields']));_0x38cf18[_0xe33d('0x35')]=_0x38cf18[_0xe33d('0x35')]['length']?_0x38cf18[_0xe33d('0x35')]:_0x449da8[_0xe33d('0x30')];if(_0x1c480d[_0xe33d('0x32')]['includeAll']){_0x38cf18['include']=[{'all':!![]}];}_0x38cf18=_[_0xe33d('0x46')]({},_0x38cf18,_0x1c480d[_0xe33d('0x40')]);return db[_0xe33d('0x2b')][_0xe33d('0x47')](_0x38cf18)['then'](handleEntityNotFound(_0x2d64aa,null))[_0xe33d('0x24')](respondWithResult(_0x2d64aa,null))[_0xe33d('0x44')](handleError(_0x2d64aa,null));};exports[_0xe33d('0x48')]=function(_0x3c2191,_0x29d196){return db[_0xe33d('0x2b')][_0xe33d('0x48')](_0x3c2191['body'],{})['then'](respondWithResult(_0x29d196,0xc9))['catch'](handleError(_0x29d196,null));};exports['update']=function(_0x17a7a3,_0x4d6dc5){if(_0x17a7a3[_0xe33d('0x49')]['id']){delete _0x17a7a3[_0xe33d('0x49')]['id'];}return db[_0xe33d('0x2b')]['find']({'where':{'id':_0x17a7a3[_0xe33d('0x4a')]['id']}})[_0xe33d('0x24')](handleEntityNotFound(_0x4d6dc5,null))[_0xe33d('0x24')](saveUpdates(_0x17a7a3[_0xe33d('0x49')],null))[_0xe33d('0x24')](respondWithResult(_0x4d6dc5,null))[_0xe33d('0x44')](handleError(_0x4d6dc5,null));};exports[_0xe33d('0x25')]=function(_0xd13d51,_0x59910b){return db['SalesforceField'][_0xe33d('0x47')]({'where':{'id':_0xd13d51[_0xe33d('0x4a')]['id']}})[_0xe33d('0x24')](handleEntityNotFound(_0x59910b,null))[_0xe33d('0x24')](removeEntity(_0x59910b,null))[_0xe33d('0x44')](handleError(_0x59910b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index af16e14..cc1efd1 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 _0x28a8=['request-promise','path','./intSalesforceField.attributes','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','api','bluebird'];(function(_0x241e49,_0x548aed){var _0x375600=function(_0x316a4b){while(--_0x316a4b){_0x241e49['push'](_0x241e49['shift']());}};_0x375600(++_0x548aed);}(_0x28a8,0xbc));var _0x828a=function(_0x32a884,_0x183853){_0x32a884=_0x32a884-0x0;var _0x242f9b=_0x28a8[_0x32a884];return _0x242f9b;};'use strict';var _=require(_0x828a('0x0'));var util=require(_0x828a('0x1'));var logger=require('../../config/logger')(_0x828a('0x2'));var moment=require('moment');var BPromise=require(_0x828a('0x3'));var rp=require(_0x828a('0x4'));var fs=require('fs');var path=require(_0x828a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x828a('0x6'));module['exports']=function(_0x2c4a2f,_0x4589a6){return _0x2c4a2f[_0x828a('0x7')](_0x828a('0x8'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x828a('0x9'),'fields':[_0x828a('0xa'),_0x828a('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x66a1=['FieldId','../../config/logger','api','moment','bluebird','path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField'];(function(_0x56b067,_0x536dec){var _0x27f66a=function(_0x18ecf6){while(--_0x18ecf6){_0x56b067['push'](_0x56b067['shift']());}};_0x27f66a(++_0x536dec);}(_0x66a1,0x151));var _0x166a=function(_0x4b5588,_0x3b0002){_0x4b5588=_0x4b5588-0x0;var _0x22aa0c=_0x66a1[_0x4b5588];return _0x22aa0c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x166a('0x0'))(_0x166a('0x1'));var moment=require(_0x166a('0x2'));var BPromise=require(_0x166a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x166a('0x4'));var rimraf=require(_0x166a('0x5'));var config=require('../../config/environment');var attributes=require(_0x166a('0x6'));module[_0x166a('0x7')]=function(_0x36893f,_0x26d60d){return _0x36893f[_0x166a('0x8')](_0x166a('0x9'),attributes,{'tableName':_0x166a('0xa'),'paranoid':![],'indexes':[{'name':_0x166a('0xb'),'fields':[_0x166a('0xc'),_0x166a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 8c01443..0f9df34 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 _0xed71=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring'];(function(_0x7a52da,_0x49548d){var _0x4d62d2=function(_0x2bf274){while(--_0x2bf274){_0x7a52da['push'](_0x7a52da['shift']());}};_0x4d62d2(++_0x49548d);}(_0xed71,0x17c));var _0x1ed7=function(_0x4f6afc,_0x4dfa88){_0x4f6afc=_0x4f6afc-0x0;var _0x256eeb=_0xed71[_0x4f6afc];return _0x256eeb;};'use strict';var _=require(_0x1ed7('0x0'));var util=require(_0x1ed7('0x1'));var moment=require('moment');var BPromise=require(_0x1ed7('0x2'));var rs=require(_0x1ed7('0x3'));var fs=require('fs');var Redis=require(_0x1ed7('0x4'));var db=require(_0x1ed7('0x5'))['db'];var utils=require(_0x1ed7('0x6'));var logger=require(_0x1ed7('0x7'))(_0x1ed7('0x8'));var config=require(_0x1ed7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1ed7('0xa')][_0x1ed7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x472214,_0xc726f4,_0x5bb8c8){return new BPromise(function(_0x271ebb,_0x23b901){return client[_0x1ed7('0xc')](_0x472214,_0x5bb8c8)[_0x1ed7('0xd')](function(_0x406a66){logger[_0x1ed7('0xe')](_0x1ed7('0xf'),_0xc726f4,_0x1ed7('0x10'));logger[_0x1ed7('0x11')](_0x1ed7('0x12'),_0xc726f4,_0x1ed7('0x10'),JSON[_0x1ed7('0x13')](_0x406a66));if(_0x406a66[_0x1ed7('0x14')]){if(_0x406a66[_0x1ed7('0x14')][_0x1ed7('0x15')]===0x1f4){logger[_0x1ed7('0x14')](_0x1ed7('0xf'),_0xc726f4,_0x406a66[_0x1ed7('0x14')][_0x1ed7('0x16')]);return _0x23b901(_0x406a66[_0x1ed7('0x14')]['message']);}logger[_0x1ed7('0x14')]('SalesforceField,\x20%s,\x20%s',_0xc726f4,_0x406a66[_0x1ed7('0x14')]['message']);return _0x271ebb(_0x406a66['error']['message']);}else{logger[_0x1ed7('0xe')](_0x1ed7('0xf'),_0xc726f4,_0x1ed7('0x10'));_0x271ebb(_0x406a66['result'][_0x1ed7('0x16')]);}})[_0x1ed7('0x17')](function(_0x4be07c){logger[_0x1ed7('0x14')](_0x1ed7('0xf'),_0xc726f4,_0x4be07c);_0x23b901(_0x4be07c);});});} \ No newline at end of file +var _0xfb9f=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','SalesforceField,\x20%s,\x20%s','request\x20sent','lodash'];(function(_0x3a1b92,_0x28d1ff){var _0x3c35ae=function(_0x3a0de8){while(--_0x3a0de8){_0x3a1b92['push'](_0x3a1b92['shift']());}};_0x3c35ae(++_0x28d1ff);}(_0xfb9f,0x110));var _0xffb9=function(_0x3591e6,_0x47faef){_0x3591e6=_0x3591e6-0x0;var _0x4810f2=_0xfb9f[_0x3591e6];return _0x4810f2;};'use strict';var _=require(_0xffb9('0x0'));var util=require(_0xffb9('0x1'));var moment=require(_0xffb9('0x2'));var BPromise=require('bluebird');var rs=require(_0xffb9('0x3'));var fs=require('fs');var Redis=require(_0xffb9('0x4'));var db=require(_0xffb9('0x5'))['db'];var utils=require(_0xffb9('0x6'));var logger=require('../../config/logger')(_0xffb9('0x7'));var config=require(_0xffb9('0x8'));var jayson=require(_0xffb9('0x9'));var client=jayson[_0xffb9('0xa')][_0xffb9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e1680,_0x172a32,_0x4790e4){return new BPromise(function(_0x359aef,_0x459e99){return client[_0xffb9('0xc')](_0x4e1680,_0x4790e4)[_0xffb9('0xd')](function(_0x2a2af1){logger[_0xffb9('0xe')]('SalesforceField,\x20%s,\x20%s',_0x172a32,'request\x20sent');logger['debug'](_0xffb9('0xf'),_0x172a32,'request\x20sent',JSON['stringify'](_0x2a2af1));if(_0x2a2af1[_0xffb9('0x10')]){if(_0x2a2af1[_0xffb9('0x10')][_0xffb9('0x11')]===0x1f4){logger[_0xffb9('0x10')]('SalesforceField,\x20%s,\x20%s',_0x172a32,_0x2a2af1[_0xffb9('0x10')][_0xffb9('0x12')]);return _0x459e99(_0x2a2af1[_0xffb9('0x10')][_0xffb9('0x12')]);}logger[_0xffb9('0x10')](_0xffb9('0x13'),_0x172a32,_0x2a2af1[_0xffb9('0x10')][_0xffb9('0x12')]);return _0x359aef(_0x2a2af1[_0xffb9('0x10')][_0xffb9('0x12')]);}else{logger['info'](_0xffb9('0x13'),_0x172a32,_0xffb9('0x14'));_0x359aef(_0x2a2af1['result'][_0xffb9('0x12')]);}})['catch'](function(_0x2df8be){logger[_0xffb9('0x10')](_0xffb9('0x13'),_0x172a32,_0x2df8be);_0x459e99(_0x2df8be);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 5405f37..9015e99 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 _0x1060=['create','addConfiguration','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x1060,0x147));var _0x0106=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x1060[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require(_0x0106('0x0'));var util=require(_0x0106('0x1'));var path=require(_0x0106('0x2'));var timeout=require(_0x0106('0x3'));var express=require('express');var router=express[_0x0106('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0106('0x5'));var interaction=require(_0x0106('0x6'));var config=require(_0x0106('0x7'));var controller=require(_0x0106('0x8'));router['get']('/',auth[_0x0106('0x9')](),controller[_0x0106('0xa')]);router[_0x0106('0xb')](_0x0106('0xc'),auth[_0x0106('0x9')](),controller[_0x0106('0xd')]);router[_0x0106('0xb')](_0x0106('0xe'),auth[_0x0106('0x9')](),controller[_0x0106('0xf')]);router['get'](_0x0106('0x10'),auth[_0x0106('0x9')](),controller['getFields']);router[_0x0106('0x11')]('/',auth[_0x0106('0x9')](),controller[_0x0106('0x12')]);router[_0x0106('0x11')]('/:id/configurations',auth[_0x0106('0x9')](),controller[_0x0106('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0106('0x14')]);router[_0x0106('0x15')](_0x0106('0xc'),auth[_0x0106('0x9')](),controller[_0x0106('0x16')]);module['exports']=router; \ No newline at end of file +var _0x3979=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get'];(function(_0xc219e1,_0x5012d4){var _0x5cef44=function(_0x3f6e1b){while(--_0x3f6e1b){_0xc219e1['push'](_0xc219e1['shift']());}};_0x5cef44(++_0x5012d4);}(_0x3979,0x114));var _0x9397=function(_0x2acb20,_0x561cd3){_0x2acb20=_0x2acb20-0x0;var _0x3c92ca=_0x3979[_0x2acb20];return _0x3c92ca;};'use strict';var multer=require('multer');var util=require(_0x9397('0x0'));var path=require(_0x9397('0x1'));var timeout=require(_0x9397('0x2'));var express=require(_0x9397('0x3'));var router=express[_0x9397('0x4')]();var fs_extra=require(_0x9397('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9397('0x6'));var config=require(_0x9397('0x7'));var controller=require(_0x9397('0x8'));router['get']('/',auth[_0x9397('0x9')](),controller[_0x9397('0xa')]);router[_0x9397('0xb')](_0x9397('0xc'),auth[_0x9397('0x9')](),controller[_0x9397('0xd')]);router['get'](_0x9397('0xe'),auth['isAuthenticated'](),controller[_0x9397('0xf')]);router[_0x9397('0xb')](_0x9397('0x10'),auth[_0x9397('0x9')](),controller[_0x9397('0x11')]);router[_0x9397('0x12')]('/',auth[_0x9397('0x9')](),controller[_0x9397('0x13')]);router[_0x9397('0x12')](_0x9397('0xe'),auth['isAuthenticated'](),controller[_0x9397('0x14')]);router[_0x9397('0x15')]('/:id',auth[_0x9397('0x9')](),controller['update']);router['delete'](_0x9397('0xc'),auth[_0x9397('0x9')](),controller[_0x9397('0x16')]);module[_0x9397('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index bc585d9..859c96a 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 _0x64e1=['remoteUri','exports','STRING','username'];(function(_0x58cbde,_0x4b0f62){var _0x5799f3=function(_0x326eca){while(--_0x326eca){_0x58cbde['push'](_0x58cbde['shift']());}};_0x5799f3(++_0x4b0f62);}(_0x64e1,0x1b1));var _0x164e=function(_0x499642,_0x76cd3b){_0x499642=_0x499642-0x0;var _0xa93bdd=_0x64e1[_0x499642];return _0xa93bdd;};'use strict';var Sequelize=require('sequelize');module[_0x164e('0x0')]={'name':{'type':Sequelize[_0x164e('0x1')]},'description':{'type':Sequelize[_0x164e('0x1')]},'username':{'type':Sequelize[_0x164e('0x1')],'unique':_0x164e('0x2')},'password':{'type':Sequelize[_0x164e('0x1')]},'email':{'type':Sequelize[_0x164e('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x164e('0x3')},'serverUrl':{'type':Sequelize[_0x164e('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x46b9=['exports','STRING','username','remoteUri'];(function(_0x2a0f88,_0x43a5fa){var _0x39ce06=function(_0x5e3be2){while(--_0x5e3be2){_0x2a0f88['push'](_0x2a0f88['shift']());}};_0x39ce06(++_0x43a5fa);}(_0x46b9,0x148));var _0x946b=function(_0x32024a,_0x14312f){_0x32024a=_0x32024a-0x0;var _0x51afc8=_0x46b9[_0x32024a];return _0x51afc8;};'use strict';var Sequelize=require('sequelize');module[_0x946b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x946b('0x1')],'unique':_0x946b('0x2')},'password':{'type':Sequelize[_0x946b('0x1')]},'email':{'type':Sequelize[_0x946b('0x1')]},'remoteUri':{'type':Sequelize[_0x946b('0x1')],'unique':_0x946b('0x3')},'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 a88bfe1..1b19eb7 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 _0x646c=['push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','destroy','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','then','includeAll','findAll','rows','catch','params','include','create','body','find','getConfigurations','findOne','ServicenowConfiguration','sort','pick','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','notify','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','calendar_stc','closed_at','cmdb_ci','active','work_notes_list','business_service','sys_domain_path','time_worked','expected_start','business_duration','group_list','reopened_time','caller_id','correlation_display','delivery_task','assignment_group','additional_assignee_list','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','upon_approval','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','forEach','label'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0x646c,0x17a));var _0xc646=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0x646c[_0x391c55];return _0xa434e0;};'use strict';var emlformat=require(_0xc646('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc646('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc646('0x2'));var moment=require(_0xc646('0x3'));var BPromise=require(_0xc646('0x4'));var Mustache=require(_0xc646('0x5'));var util=require(_0xc646('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc646('0x7'));var ejs=require(_0xc646('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc646('0x9'));var squel=require(_0xc646('0xa'));var crypto=require(_0xc646('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc646('0xc'));var Redis=require(_0xc646('0xd'));var authService=require(_0xc646('0xe'));var qs=require(_0xc646('0xf'));var as=require(_0xc646('0x10'));var hardwareService=require(_0xc646('0x11'));var logger=require(_0xc646('0x12'))(_0xc646('0x13'));var utils=require(_0xc646('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc646('0x15'))['db'];var integrations=require(_0xc646('0x16'));function respondWithStatusCode(_0x18bb3d,_0x5e075f){_0x5e075f=_0x5e075f||0xcc;return function(_0xd58467){if(_0xd58467){return _0x18bb3d[_0xc646('0x17')](_0x5e075f);}return _0x18bb3d['status'](_0x5e075f)['end']();};}function respondWithResult(_0x28e0b4,_0x33a3b7){_0x33a3b7=_0x33a3b7||0xc8;return function(_0x487d67){if(_0x487d67){return _0x28e0b4['status'](_0x33a3b7)[_0xc646('0x18')](_0x487d67);}};}function respondWithFilteredResult(_0x3b7675,_0x4fa708){return function(_0x91fa2){if(_0x91fa2){var _0x4ddd0b=typeof _0x4fa708[_0xc646('0x19')]===_0xc646('0x1a')&&typeof _0x4fa708[_0xc646('0x1b')]===_0xc646('0x1a');var _0x3de4a5=_0x91fa2[_0xc646('0x1c')];var _0x5ccc72=_0x4ddd0b?0x0:_0x4fa708[_0xc646('0x19')];var _0x54e61e=_0x4ddd0b?_0x91fa2[_0xc646('0x1c')]:_0x4fa708['offset']+_0x4fa708[_0xc646('0x1b')];var _0x4baa1c;if(_0x54e61e>=_0x3de4a5){_0x54e61e=_0x3de4a5;_0x4baa1c=0xc8;}else{_0x4baa1c=0xce;}_0x3b7675[_0xc646('0x1d')](_0x4baa1c);return _0x3b7675[_0xc646('0x1e')](_0xc646('0x1f'),_0x5ccc72+'-'+_0x54e61e+'/'+_0x3de4a5)['json'](_0x91fa2);}return null;};}function patchUpdates(_0x3126e7){return function(_0x3f1726){try{jsonpatch['apply'](_0x3f1726,_0x3126e7,!![]);}catch(_0x425d26){return BPromise[_0xc646('0x20')](_0x425d26);}return _0x3f1726['save']();};}function saveUpdates(_0x5c6ab9,_0x3b8777){return function(_0x7bda2d){if(_0x7bda2d){return _0x7bda2d[_0xc646('0x21')](_0x5c6ab9)['then'](function(_0xeaf0d9){return _0xeaf0d9;});}return null;};}function removeEntity(_0x5f0b9d,_0x7af9fa){return function(_0x981580){if(_0x981580){return _0x981580[_0xc646('0x22')]()['then'](function(){_0x5f0b9d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc45de,_0x4e6f80){return function(_0x3cbdff){if(!_0x3cbdff){_0xfc45de['sendStatus'](0x194);}return _0x3cbdff;};}function handleError(_0x587928,_0x5e34f3){_0x5e34f3=_0x5e34f3||0x1f4;return function(_0x512f8c){logger[_0xc646('0x23')](_0x512f8c[_0xc646('0x24')]);if(_0x512f8c['name']){delete _0x512f8c[_0xc646('0x25')];}_0x587928['status'](_0x5e34f3)[_0xc646('0x26')](_0x512f8c);};}exports[_0xc646('0x27')]=function(_0x1316c0,_0x5007d8){var _0x87d545={},_0x4ace5d={},_0x5bbadd={'count':0x0,'rows':[]};var _0x5387af=_[_0xc646('0x28')](db[_0xc646('0x29')][_0xc646('0x2a')],function(_0x200794){return{'name':_0x200794[_0xc646('0x2b')],'type':_0x200794[_0xc646('0x2c')][_0xc646('0x2d')]};});_0x4ace5d['model']=_['map'](_0x5387af,_0xc646('0x25'));_0x4ace5d['query']=_[_0xc646('0x2e')](_0x1316c0[_0xc646('0x2f')]);_0x4ace5d[_0xc646('0x30')]=_[_0xc646('0x31')](_0x4ace5d[_0xc646('0x32')],_0x4ace5d[_0xc646('0x2f')]);_0x87d545[_0xc646('0x33')]=_[_0xc646('0x31')](_0x4ace5d[_0xc646('0x32')],qs[_0xc646('0x34')](_0x1316c0[_0xc646('0x2f')][_0xc646('0x34')]));_0x87d545[_0xc646('0x33')]=_0x87d545[_0xc646('0x33')][_0xc646('0x35')]?_0x87d545['attributes']:_0x4ace5d['model'];if(!_0x1316c0['query'][_0xc646('0x36')](_0xc646('0x37'))){_0x87d545[_0xc646('0x1b')]=qs[_0xc646('0x1b')](_0x1316c0[_0xc646('0x2f')][_0xc646('0x1b')]);_0x87d545['offset']=qs[_0xc646('0x19')](_0x1316c0[_0xc646('0x2f')][_0xc646('0x19')]);}_0x87d545[_0xc646('0x38')]=qs['sort'](_0x1316c0['query']['sort']);_0x87d545[_0xc646('0x39')]=qs[_0xc646('0x30')](_['pick'](_0x1316c0[_0xc646('0x2f')],_0x4ace5d[_0xc646('0x30')]),_0x5387af);if(_0x1316c0[_0xc646('0x2f')][_0xc646('0x3a')]){_0x87d545[_0xc646('0x39')]=_[_0xc646('0x3b')](_0x87d545[_0xc646('0x39')],{'$or':_[_0xc646('0x28')](_0x5387af,function(_0x502510){if(_0x502510[_0xc646('0x2c')]!=='VIRTUAL'){var _0x183df3={};_0x183df3[_0x502510['name']]={'$like':'%'+_0x1316c0[_0xc646('0x2f')][_0xc646('0x3a')]+'%'};return _0x183df3;}})});}_0x87d545=_[_0xc646('0x3b')]({},_0x87d545,_0x1316c0[_0xc646('0x3c')]);var _0x2e1e5f={'where':_0x87d545[_0xc646('0x39')]};return db[_0xc646('0x29')][_0xc646('0x1c')](_0x2e1e5f)[_0xc646('0x3d')](function(_0x14c7cd){_0x5bbadd[_0xc646('0x1c')]=_0x14c7cd;if(_0x1316c0[_0xc646('0x2f')][_0xc646('0x3e')]){_0x87d545['include']=[{'all':!![]}];}return db['ServicenowAccount'][_0xc646('0x3f')](_0x87d545);})[_0xc646('0x3d')](function(_0x21253e){_0x5bbadd[_0xc646('0x40')]=_0x21253e;return _0x5bbadd;})['then'](respondWithFilteredResult(_0x5007d8,_0x87d545))[_0xc646('0x41')](handleError(_0x5007d8,null));};exports['show']=function(_0x208e95,_0x537a15){var _0x305ac3={'raw':![],'where':{'id':_0x208e95[_0xc646('0x42')]['id']}},_0x43d4fc={};_0x43d4fc['model']=_['keys'](db[_0xc646('0x29')][_0xc646('0x2a')]);_0x43d4fc['query']=_[_0xc646('0x2e')](_0x208e95['query']);_0x43d4fc[_0xc646('0x30')]=_['intersection'](_0x43d4fc[_0xc646('0x32')],_0x43d4fc['query']);_0x305ac3[_0xc646('0x33')]=_[_0xc646('0x31')](_0x43d4fc['model'],qs[_0xc646('0x34')](_0x208e95[_0xc646('0x2f')][_0xc646('0x34')]));_0x305ac3[_0xc646('0x33')]=_0x305ac3[_0xc646('0x33')][_0xc646('0x35')]?_0x305ac3[_0xc646('0x33')]:_0x43d4fc['model'];if(_0x208e95[_0xc646('0x2f')][_0xc646('0x3e')]){_0x305ac3[_0xc646('0x43')]=[{'all':!![]}];}_0x305ac3=_[_0xc646('0x3b')]({},_0x305ac3,_0x208e95[_0xc646('0x3c')]);return db[_0xc646('0x29')]['find'](_0x305ac3)[_0xc646('0x3d')](handleEntityNotFound(_0x537a15,null))[_0xc646('0x3d')](respondWithResult(_0x537a15,null))[_0xc646('0x41')](handleError(_0x537a15,null));};exports[_0xc646('0x44')]=function(_0x156b1b,_0x29fd12){return db[_0xc646('0x29')][_0xc646('0x44')](_0x156b1b['body'],{})[_0xc646('0x3d')](respondWithResult(_0x29fd12,0xc9))[_0xc646('0x41')](handleError(_0x29fd12,null));};exports[_0xc646('0x21')]=function(_0x178486,_0x57e900){if(_0x178486['body']['id']){delete _0x178486[_0xc646('0x45')]['id'];}return db['ServicenowAccount'][_0xc646('0x46')]({'where':{'id':_0x178486[_0xc646('0x42')]['id']}})[_0xc646('0x3d')](handleEntityNotFound(_0x57e900,null))[_0xc646('0x3d')](saveUpdates(_0x178486[_0xc646('0x45')],null))[_0xc646('0x3d')](respondWithResult(_0x57e900,null))[_0xc646('0x41')](handleError(_0x57e900,null));};exports['destroy']=function(_0x53861b,_0x50e888){return db[_0xc646('0x29')]['find']({'where':{'id':_0x53861b[_0xc646('0x42')]['id']}})[_0xc646('0x3d')](handleEntityNotFound(_0x50e888,null))[_0xc646('0x3d')](removeEntity(_0x50e888,null))[_0xc646('0x41')](handleError(_0x50e888,null));};exports[_0xc646('0x47')]=function(_0x46e001,_0x26543a,_0x2285ea){var _0x33728e={};var _0x10d930={};var _0x5336b6;var _0x50c6ce;return db[_0xc646('0x29')][_0xc646('0x48')]({'where':{'id':_0x46e001['params']['id']}})[_0xc646('0x3d')](handleEntityNotFound(_0x26543a,null))[_0xc646('0x3d')](function(_0x87f869){if(_0x87f869){_0x5336b6=_0x87f869;_0x10d930['model']=_[_0xc646('0x2e')](db[_0xc646('0x49')][_0xc646('0x2a')]);_0x10d930[_0xc646('0x2f')]=_[_0xc646('0x2e')](_0x46e001[_0xc646('0x2f')]);_0x10d930[_0xc646('0x30')]=_[_0xc646('0x31')](_0x10d930['model'],_0x10d930[_0xc646('0x2f')]);_0x33728e[_0xc646('0x33')]=_[_0xc646('0x31')](_0x10d930['model'],qs[_0xc646('0x34')](_0x46e001['query'][_0xc646('0x34')]));_0x33728e[_0xc646('0x33')]=_0x33728e[_0xc646('0x33')][_0xc646('0x35')]?_0x33728e[_0xc646('0x33')]:_0x10d930['model'];_0x33728e[_0xc646('0x38')]=qs[_0xc646('0x4a')](_0x46e001[_0xc646('0x2f')][_0xc646('0x4a')]);_0x33728e[_0xc646('0x39')]=qs[_0xc646('0x30')](_[_0xc646('0x4b')](_0x46e001[_0xc646('0x2f')],_0x10d930[_0xc646('0x30')]));if(_0x46e001[_0xc646('0x2f')][_0xc646('0x3a')]){_0x33728e[_0xc646('0x39')]=_[_0xc646('0x3b')](_0x33728e[_0xc646('0x39')],{'$or':_['map'](_0x33728e[_0xc646('0x33')],function(_0x1f712c){var _0x8f6a72={};_0x8f6a72[_0x1f712c]={'$like':'%'+_0x46e001[_0xc646('0x2f')][_0xc646('0x3a')]+'%'};return _0x8f6a72;})});}_0x33728e=_['merge']({},_0x33728e,_0x46e001[_0xc646('0x3c')]);return _0x5336b6[_0xc646('0x47')](_0x33728e);}})[_0xc646('0x3d')](function(_0x2dcef5){if(_0x2dcef5){_0x50c6ce=_0x2dcef5['length'];if(!_0x46e001[_0xc646('0x2f')][_0xc646('0x36')](_0xc646('0x37'))){_0x33728e[_0xc646('0x1b')]=qs[_0xc646('0x1b')](_0x46e001[_0xc646('0x2f')][_0xc646('0x1b')]);_0x33728e[_0xc646('0x19')]=qs[_0xc646('0x19')](_0x46e001[_0xc646('0x2f')][_0xc646('0x19')]);}return _0x5336b6[_0xc646('0x47')](_0x33728e);}})[_0xc646('0x3d')](function(_0x2106e1){if(_0x2106e1){return _0x2106e1?{'count':_0x50c6ce,'rows':_0x2106e1}:null;}})[_0xc646('0x3d')](respondWithResult(_0x26543a,null))[_0xc646('0x41')](handleError(_0x26543a,null));};exports[_0xc646('0x4c')]=function(_0x36cfd5,_0x31eec1,_0x524637){if(_0x36cfd5[_0xc646('0x45')]['id']){delete _0x36cfd5[_0xc646('0x45')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x36cfd5['params']['id']}})['then'](handleEntityNotFound(_0x31eec1,null))[_0xc646('0x3d')](function(_0x43c7fb){if(_0x43c7fb){_0x36cfd5[_0xc646('0x45')][_0xc646('0x4d')]=_0x43c7fb['id'];_0x36cfd5[_0xc646('0x45')]['Subjects']=integrations[_0xc646('0x4e')](_0x36cfd5[_0xc646('0x45')][_0xc646('0x4f')],_0x36cfd5['body'][_0xc646('0x2c')]);_0x36cfd5[_0xc646('0x45')][_0xc646('0x50')]=integrations[_0xc646('0x51')](_0x36cfd5[_0xc646('0x45')][_0xc646('0x4f')],_0x36cfd5[_0xc646('0x45')][_0xc646('0x2c')]);return db[_0xc646('0x49')][_0xc646('0x44')](_0x36cfd5[_0xc646('0x45')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0xc646('0x52')],'as':_0xc646('0x50')}]});}return null;})['then'](respondWithResult(_0x31eec1,null))['catch'](handleError(_0x31eec1,null));};exports['getFields']=function(_0x464cd4,_0x9b0489,_0xef2615){var _0x310e95=[_0xc646('0x53'),_0xc646('0x54'),_0xc646('0x55'),_0xc646('0x56'),_0xc646('0x57'),_0xc646('0x58'),'incident_state','severity',_0xc646('0x59')];var _0x22c2ce=[_0xc646('0x5a'),_0xc646('0x53'),_0xc646('0x5b'),_0xc646('0x5c'),_0xc646('0x5d'),_0xc646('0x5e'),_0xc646('0x5f'),_0xc646('0x54'),_0xc646('0x60'),_0xc646('0x61'),_0xc646('0x62'),_0xc646('0x63'),_0xc646('0x64'),'user_input',_0xc646('0x65'),_0xc646('0x66'),'state','sys_created_by',_0xc646('0x55'),'order',_0xc646('0x67'),_0xc646('0x68'),_0xc646('0x69'),'delivery_plan','impact',_0xc646('0x6a'),_0xc646('0x6b'),_0xc646('0x6c'),'priority',_0xc646('0x6d'),'rfc',_0xc646('0x6e'),_0xc646('0x6f'),'opened_at',_0xc646('0x70'),_0xc646('0x71'),'work_end',_0xc646('0x72'),'resolved_at',_0xc646('0x73'),'approval_set',_0xc646('0x56'),'work_notes','short_description',_0xc646('0x57'),_0xc646('0x74'),_0xc646('0x75'),'work_start',_0xc646('0x76'),'business_stc',_0xc646('0x77'),'description',_0xc646('0x78'),_0xc646('0x58'),'sys_class_name',_0xc646('0x79'),_0xc646('0x7a'),_0xc646('0x7b'),_0xc646('0x7c'),_0xc646('0x7d'),'contact_type',_0xc646('0x7e'),_0xc646('0x7f'),_0xc646('0x80'),_0xc646('0x81'),_0xc646('0x82'),_0xc646('0x83'),_0xc646('0x84'),'assigned_to',_0xc646('0x85'),_0xc646('0x86'),_0xc646('0x87'),_0xc646('0x88'),_0xc646('0x89'),_0xc646('0x8a'),_0xc646('0x8b'),'reopen_count',_0xc646('0x8c'),_0xc646('0x8d'),_0xc646('0x8e'),'correlation_id',_0xc646('0x8f'),_0xc646('0x59')];var _0x2e225a='';var _0x3312eb='';var _0x4b5f78=[];var _0x22a71b='';var _0x413779='';var _0x18c81c=[];var _0x1ccb1c='';var _0x4fa0ad='';var _0x4a553f={};var _0x155a74='';return db['ServicenowAccount'][_0xc646('0x48')]({'where':{'id':_0x464cd4[_0xc646('0x42')]['id']},'attributes':['id',_0xc646('0x90'),_0xc646('0x91'),_0xc646('0x92'),_0xc646('0x93'),_0xc646('0x94')]})[_0xc646('0x3d')](handleEntityNotFound(_0x9b0489,null))[_0xc646('0x3d')](function(_0xb87406){if(_0xb87406){_0x155a74=_0xb87406[_0xc646('0x93')];var _0x13ca9b=_0x155a74[_0xc646('0x95')](-0x1);if(_0x13ca9b==='/'){_0x155a74=_0x155a74[_0xc646('0x96')](0x0,_0x155a74[_0xc646('0x97')](_0x13ca9b));}_0x4fa0ad=util[_0xc646('0x98')](_0xc646('0x99'),_0x155a74);_0x1ccb1c=util[_0xc646('0x98')](_0xc646('0x9a'),_0x155a74);_0x4a553f={'user':_0xb87406[_0xc646('0x90')],'pass':_0xb87406[_0xc646('0x91')]};var _0x3db2ae={'method':'GET','uri':_0x4fa0ad+_0xc646('0x9b'),'auth':_0x4a553f,'json':!![]};return rp(_0x3db2ae);}})[_0xc646('0x3d')](function(_0x4012a9){if(_0x4012a9[_0xc646('0x9c')][_0xc646('0x35')]>0x0){_0x2e225a=_0x4012a9['result'];}console[_0xc646('0x9d')](_0xc646('0x9e'),_0x2e225a);_0x18c81c=[];_0x3312eb=Object['assign']([],_0x2e225a);_[_0xc646('0x9f')](_0x3312eb,function(_0x5e5b04){return!_0x310e95['includes'](_0x5e5b04['name']);});_0x3312eb[_0xc646('0xa0')](function(_0x55f169){var _0x5267fc=createFieldObject(_0x1ccb1c,_0x4a553f,_0x55f169['internalType'],_0x55f169[_0xc646('0x25')],_0x55f169[_0xc646('0xa1')],![]);_0x18c81c[_0xc646('0xa2')](_0x5267fc);});return Promise[_0xc646('0xa3')](_0x18c81c);})['then'](function(_0x1c90c8){_0x4b5f78=_0x1c90c8;_0x22a71b=Object['assign']([],_0x2e225a);console['log'](_0xc646('0xa4'),_0x2e225a);_[_0xc646('0x9f')](_0x22a71b,function(_0x21562b){return _0x22c2ce[_0xc646('0xa5')](_0x21562b[_0xc646('0x25')]);});console[_0xc646('0x9d')](_0xc646('0xa6'),_0x22a71b);_0x18c81c=[];_0x22a71b[_0xc646('0xa0')](function(_0x220de4){var _0x33c109=createFieldObject(_0x1ccb1c,_0x4a553f,_0x220de4[_0xc646('0xa7')],_0x220de4[_0xc646('0x25')],_0x220de4['label'],!![]);_0x18c81c[_0xc646('0xa2')](_0x33c109);});return Promise[_0xc646('0xa3')](_0x18c81c);})[_0xc646('0x3d')](function(_0x151c71){_0x413779=_0x151c71;var _0x4e4d59=_0x4b5f78[_0xc646('0xa8')](_0x413779);return{'count':_0x4e4d59[_0xc646('0x35')],'rows':_0x4e4d59};})[_0xc646('0x3d')](respondWithResult(_0x9b0489,null))[_0xc646('0x41')](function(_0x16986e){console[_0xc646('0x9d')]('ServiceNow\x20error:\x20'+_0x16986e);var _0x23d6fa=_0x464cd4[_0xc646('0x2f')][_0xc646('0xa9')]?0x1f4:_0x16986e[_0xc646('0xaa')]||0x1f4;logger[_0xc646('0x23')](_0x16986e[_0xc646('0x24')]);delete _0x16986e[_0xc646('0x25')];if(_0x23d6fa===0x191){_0x23d6fa=0x190;}_0x9b0489[_0xc646('0x1d')](_0x23d6fa)[_0xc646('0x26')](_0x464cd4[_0xc646('0x2f')]['test']?{'message':_0xc646('0xab'),'statusCode':_0x16986e['statusCode']}:_0x16986e);});};function createFieldObject(_0x584191,_0x3fb4c7,_0x1dee0c,_0x3c1b44,_0x4c244a,_0x47a6be){return new Promise(function(_0xb6311f,_0x1097fd){var _0x38c618={'id':_0x3c1b44,'name':_0x4c244a,'custom':_0x47a6be};if(_0x1dee0c===_0xc646('0xac')){_0x38c618[_0xc646('0x3c')]=[{'name':_0xc646('0xad'),'value':_0xc646('0xae')},{'name':_0xc646('0xaf'),'value':_0xc646('0xb0')}];_0xb6311f(_0x38c618);}else{var _0x55e539={'method':'GET','uri':_0x584191+_0xc646('0xb1')+_0x3c1b44,'auth':_0x3fb4c7,'json':!![]};return rp(_0x55e539)['then'](function(_0x340abd){var _0x1b6c4e=[];if(_0x340abd['result'][_0xc646('0x35')]>0x0){_0x340abd['result'][_0xc646('0xa0')](function(_0x288f8a){if(_0x288f8a[_0xc646('0xb2')]==='false'){var _0x36fc93={'name':_0x288f8a[_0xc646('0xa1')],'value':_0x288f8a[_0xc646('0xb3')]};_0x1b6c4e['push'](_0x36fc93);}});}_0x38c618['options']=_0x1b6c4e;if(_0x38c618['options'][_0xc646('0x35')]>0x0){_0xb6311f(_0x38c618);}else{if(_0x47a6be==![]){_0xb6311f();}else{_0xb6311f(_0x38c618);}}});}});} \ No newline at end of file +var _0x9905=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','getConfigurations','ServicenowConfiguration','order','map','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','knowledge','subcategory','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','calendar_stc','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','sys_domain_path','expected_start','opened_at','business_duration','group_list','reopened_time','approval_set','work_notes','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','location','username','password','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','incident\x20table\x20objects','assign','remove','forEach','internalType','label','all','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where'];(function(_0x5640ff,_0x398f96){var _0x3e6b92=function(_0x318e50){while(--_0x318e50){_0x5640ff['push'](_0x5640ff['shift']());}};_0x3e6b92(++_0x398f96);}(_0x9905,0x131));var _0x5990=function(_0x4acf7d,_0x64032b){_0x4acf7d=_0x4acf7d-0x0;var _0x238bab=_0x9905[_0x4acf7d];return _0x238bab;};'use strict';var emlformat=require(_0x5990('0x0'));var rimraf=require(_0x5990('0x1'));var zipdir=require(_0x5990('0x2'));var jsonpatch=require(_0x5990('0x3'));var rp=require(_0x5990('0x4'));var moment=require(_0x5990('0x5'));var BPromise=require(_0x5990('0x6'));var Mustache=require(_0x5990('0x7'));var util=require('util');var path=require(_0x5990('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5990('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5990('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5990('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5990('0xc'));var Papa=require(_0x5990('0xd'));var Redis=require(_0x5990('0xe'));var authService=require(_0x5990('0xf'));var qs=require(_0x5990('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5990('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5990('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x5990('0x13'));var db=require(_0x5990('0x14'))['db'];var integrations=require(_0x5990('0x15'));function respondWithStatusCode(_0x553d0e,_0x3789a1){_0x3789a1=_0x3789a1||0xcc;return function(_0x32b75a){if(_0x32b75a){return _0x553d0e[_0x5990('0x16')](_0x3789a1);}return _0x553d0e[_0x5990('0x17')](_0x3789a1)[_0x5990('0x18')]();};}function respondWithResult(_0x472411,_0x26384b){_0x26384b=_0x26384b||0xc8;return function(_0x2ac8b4){if(_0x2ac8b4){return _0x472411[_0x5990('0x17')](_0x26384b)[_0x5990('0x19')](_0x2ac8b4);}};}function respondWithFilteredResult(_0x743c6b,_0x5e10ec){return function(_0x51cdf2){if(_0x51cdf2){var _0x3d6b8b=typeof _0x5e10ec[_0x5990('0x1a')]===_0x5990('0x1b')&&typeof _0x5e10ec[_0x5990('0x1c')]==='undefined';var _0x3ffa10=_0x51cdf2[_0x5990('0x1d')];var _0x137abf=_0x3d6b8b?0x0:_0x5e10ec[_0x5990('0x1a')];var _0x32beee=_0x3d6b8b?_0x51cdf2[_0x5990('0x1d')]:_0x5e10ec[_0x5990('0x1a')]+_0x5e10ec[_0x5990('0x1c')];var _0x945a99;if(_0x32beee>=_0x3ffa10){_0x32beee=_0x3ffa10;_0x945a99=0xc8;}else{_0x945a99=0xce;}_0x743c6b[_0x5990('0x17')](_0x945a99);return _0x743c6b['set'](_0x5990('0x1e'),_0x137abf+'-'+_0x32beee+'/'+_0x3ffa10)[_0x5990('0x19')](_0x51cdf2);}return null;};}function patchUpdates(_0x17da5c){return function(_0x270bdf){try{jsonpatch[_0x5990('0x1f')](_0x270bdf,_0x17da5c,!![]);}catch(_0x28a203){return BPromise[_0x5990('0x20')](_0x28a203);}return _0x270bdf[_0x5990('0x21')]();};}function saveUpdates(_0x381c2c,_0x1cc5b1){return function(_0xdd1a97){if(_0xdd1a97){return _0xdd1a97[_0x5990('0x22')](_0x381c2c)[_0x5990('0x23')](function(_0x37ee82){return _0x37ee82;});}return null;};}function removeEntity(_0xb30a2e,_0x4ecf17){return function(_0x4168e3){if(_0x4168e3){return _0x4168e3[_0x5990('0x24')]()[_0x5990('0x23')](function(){_0xb30a2e[_0x5990('0x17')](0xcc)[_0x5990('0x18')]();});}};}function handleEntityNotFound(_0x1dbc0d,_0x52740){return function(_0x8907f2){if(!_0x8907f2){_0x1dbc0d[_0x5990('0x16')](0x194);}return _0x8907f2;};}function handleError(_0x4c8648,_0x4fb0cd){_0x4fb0cd=_0x4fb0cd||0x1f4;return function(_0x83c2de){logger[_0x5990('0x25')](_0x83c2de[_0x5990('0x26')]);if(_0x83c2de['name']){delete _0x83c2de[_0x5990('0x27')];}_0x4c8648[_0x5990('0x17')](_0x4fb0cd)[_0x5990('0x28')](_0x83c2de);};}exports[_0x5990('0x29')]=function(_0xb91a94,_0x48e2fe){var _0x38e620={},_0x35ceb6={},_0xd7609e={'count':0x0,'rows':[]};var _0x17d31f=_['map'](db[_0x5990('0x2a')][_0x5990('0x2b')],function(_0x382d11){return{'name':_0x382d11[_0x5990('0x2c')],'type':_0x382d11[_0x5990('0x2d')][_0x5990('0x2e')]};});_0x35ceb6[_0x5990('0x2f')]=_['map'](_0x17d31f,'name');_0x35ceb6[_0x5990('0x30')]=_[_0x5990('0x31')](_0xb91a94['query']);_0x35ceb6[_0x5990('0x32')]=_[_0x5990('0x33')](_0x35ceb6[_0x5990('0x2f')],_0x35ceb6[_0x5990('0x30')]);_0x38e620[_0x5990('0x34')]=_[_0x5990('0x33')](_0x35ceb6[_0x5990('0x2f')],qs[_0x5990('0x35')](_0xb91a94[_0x5990('0x30')][_0x5990('0x35')]));_0x38e620[_0x5990('0x34')]=_0x38e620[_0x5990('0x34')][_0x5990('0x36')]?_0x38e620[_0x5990('0x34')]:_0x35ceb6[_0x5990('0x2f')];if(!_0xb91a94[_0x5990('0x30')][_0x5990('0x37')](_0x5990('0x38'))){_0x38e620[_0x5990('0x1c')]=qs[_0x5990('0x1c')](_0xb91a94['query'][_0x5990('0x1c')]);_0x38e620[_0x5990('0x1a')]=qs[_0x5990('0x1a')](_0xb91a94[_0x5990('0x30')][_0x5990('0x1a')]);}_0x38e620['order']=qs[_0x5990('0x39')](_0xb91a94[_0x5990('0x30')][_0x5990('0x39')]);_0x38e620['where']=qs[_0x5990('0x32')](_[_0x5990('0x3a')](_0xb91a94[_0x5990('0x30')],_0x35ceb6[_0x5990('0x32')]),_0x17d31f);if(_0xb91a94[_0x5990('0x30')][_0x5990('0x3b')]){_0x38e620[_0x5990('0x3c')]=_[_0x5990('0x3d')](_0x38e620['where'],{'$or':_['map'](_0x17d31f,function(_0x5b4d05){if(_0x5b4d05['type']!==_0x5990('0x3e')){var _0x27700c={};_0x27700c[_0x5b4d05[_0x5990('0x27')]]={'$like':'%'+_0xb91a94[_0x5990('0x30')][_0x5990('0x3b')]+'%'};return _0x27700c;}})});}_0x38e620=_[_0x5990('0x3d')]({},_0x38e620,_0xb91a94[_0x5990('0x3f')]);var _0x36b20a={'where':_0x38e620[_0x5990('0x3c')]};return db[_0x5990('0x2a')][_0x5990('0x1d')](_0x36b20a)['then'](function(_0xbba70d){_0xd7609e[_0x5990('0x1d')]=_0xbba70d;if(_0xb91a94[_0x5990('0x30')][_0x5990('0x40')]){_0x38e620[_0x5990('0x41')]=[{'all':!![]}];}return db[_0x5990('0x2a')][_0x5990('0x42')](_0x38e620);})[_0x5990('0x23')](function(_0x22b828){_0xd7609e[_0x5990('0x43')]=_0x22b828;return _0xd7609e;})[_0x5990('0x23')](respondWithFilteredResult(_0x48e2fe,_0x38e620))['catch'](handleError(_0x48e2fe,null));};exports[_0x5990('0x44')]=function(_0x390ffb,_0xfe420b){var _0x422fcc={'raw':![],'where':{'id':_0x390ffb[_0x5990('0x45')]['id']}},_0x32385d={};_0x32385d[_0x5990('0x2f')]=_['keys'](db['ServicenowAccount'][_0x5990('0x2b')]);_0x32385d[_0x5990('0x30')]=_['keys'](_0x390ffb[_0x5990('0x30')]);_0x32385d[_0x5990('0x32')]=_[_0x5990('0x33')](_0x32385d[_0x5990('0x2f')],_0x32385d['query']);_0x422fcc[_0x5990('0x34')]=_[_0x5990('0x33')](_0x32385d[_0x5990('0x2f')],qs[_0x5990('0x35')](_0x390ffb[_0x5990('0x30')]['fields']));_0x422fcc[_0x5990('0x34')]=_0x422fcc[_0x5990('0x34')][_0x5990('0x36')]?_0x422fcc[_0x5990('0x34')]:_0x32385d[_0x5990('0x2f')];if(_0x390ffb['query'][_0x5990('0x40')]){_0x422fcc[_0x5990('0x41')]=[{'all':!![]}];}_0x422fcc=_[_0x5990('0x3d')]({},_0x422fcc,_0x390ffb['options']);return db[_0x5990('0x2a')][_0x5990('0x46')](_0x422fcc)['then'](handleEntityNotFound(_0xfe420b,null))[_0x5990('0x23')](respondWithResult(_0xfe420b,null))[_0x5990('0x47')](handleError(_0xfe420b,null));};exports[_0x5990('0x48')]=function(_0x46b302,_0x1f444e){return db[_0x5990('0x2a')][_0x5990('0x48')](_0x46b302[_0x5990('0x49')],{})[_0x5990('0x23')](respondWithResult(_0x1f444e,0xc9))[_0x5990('0x47')](handleError(_0x1f444e,null));};exports[_0x5990('0x22')]=function(_0x33288e,_0x57c752){if(_0x33288e['body']['id']){delete _0x33288e[_0x5990('0x49')]['id'];}return db[_0x5990('0x2a')][_0x5990('0x46')]({'where':{'id':_0x33288e[_0x5990('0x45')]['id']}})[_0x5990('0x23')](handleEntityNotFound(_0x57c752,null))[_0x5990('0x23')](saveUpdates(_0x33288e[_0x5990('0x49')],null))['then'](respondWithResult(_0x57c752,null))['catch'](handleError(_0x57c752,null));};exports[_0x5990('0x24')]=function(_0x43293f,_0x5f0975){return db[_0x5990('0x2a')]['find']({'where':{'id':_0x43293f[_0x5990('0x45')]['id']}})[_0x5990('0x23')](handleEntityNotFound(_0x5f0975,null))[_0x5990('0x23')](removeEntity(_0x5f0975,null))[_0x5990('0x47')](handleError(_0x5f0975,null));};exports[_0x5990('0x4a')]=function(_0x223b19,_0x5d954a,_0x33a896){var _0x3f4cc1={};var _0x22fbd1={};var _0xad07c1;var _0x2dc23d;return db[_0x5990('0x2a')]['findOne']({'where':{'id':_0x223b19['params']['id']}})['then'](handleEntityNotFound(_0x5d954a,null))['then'](function(_0x3d8513){if(_0x3d8513){_0xad07c1=_0x3d8513;_0x22fbd1[_0x5990('0x2f')]=_[_0x5990('0x31')](db[_0x5990('0x4b')][_0x5990('0x2b')]);_0x22fbd1[_0x5990('0x30')]=_[_0x5990('0x31')](_0x223b19[_0x5990('0x30')]);_0x22fbd1[_0x5990('0x32')]=_['intersection'](_0x22fbd1[_0x5990('0x2f')],_0x22fbd1[_0x5990('0x30')]);_0x3f4cc1[_0x5990('0x34')]=_['intersection'](_0x22fbd1[_0x5990('0x2f')],qs[_0x5990('0x35')](_0x223b19[_0x5990('0x30')][_0x5990('0x35')]));_0x3f4cc1['attributes']=_0x3f4cc1[_0x5990('0x34')][_0x5990('0x36')]?_0x3f4cc1[_0x5990('0x34')]:_0x22fbd1[_0x5990('0x2f')];_0x3f4cc1[_0x5990('0x4c')]=qs[_0x5990('0x39')](_0x223b19['query'][_0x5990('0x39')]);_0x3f4cc1['where']=qs[_0x5990('0x32')](_[_0x5990('0x3a')](_0x223b19[_0x5990('0x30')],_0x22fbd1['filters']));if(_0x223b19[_0x5990('0x30')][_0x5990('0x3b')]){_0x3f4cc1['where']=_[_0x5990('0x3d')](_0x3f4cc1['where'],{'$or':_[_0x5990('0x4d')](_0x3f4cc1[_0x5990('0x34')],function(_0x2a989b){var _0x4ef6c0={};_0x4ef6c0[_0x2a989b]={'$like':'%'+_0x223b19[_0x5990('0x30')]['filter']+'%'};return _0x4ef6c0;})});}_0x3f4cc1=_['merge']({},_0x3f4cc1,_0x223b19['options']);return _0xad07c1[_0x5990('0x4a')](_0x3f4cc1);}})[_0x5990('0x23')](function(_0x55de33){if(_0x55de33){_0x2dc23d=_0x55de33[_0x5990('0x36')];if(!_0x223b19[_0x5990('0x30')][_0x5990('0x37')]('nolimit')){_0x3f4cc1['limit']=qs[_0x5990('0x1c')](_0x223b19[_0x5990('0x30')]['limit']);_0x3f4cc1[_0x5990('0x1a')]=qs[_0x5990('0x1a')](_0x223b19[_0x5990('0x30')][_0x5990('0x1a')]);}return _0xad07c1[_0x5990('0x4a')](_0x3f4cc1);}})[_0x5990('0x23')](function(_0x155f15){if(_0x155f15){return _0x155f15?{'count':_0x2dc23d,'rows':_0x155f15}:null;}})[_0x5990('0x23')](respondWithResult(_0x5d954a,null))['catch'](handleError(_0x5d954a,null));};exports[_0x5990('0x4e')]=function(_0x192567,_0x13a6fe,_0x45042b){if(_0x192567['body']['id']){delete _0x192567[_0x5990('0x49')]['id'];}return db[_0x5990('0x2a')][_0x5990('0x4f')]({'where':{'id':_0x192567['params']['id']}})[_0x5990('0x23')](handleEntityNotFound(_0x13a6fe,null))[_0x5990('0x23')](function(_0x206f81){if(_0x206f81){_0x192567['body'][_0x5990('0x50')]=_0x206f81['id'];_0x192567[_0x5990('0x49')][_0x5990('0x51')]=integrations[_0x5990('0x52')](_0x192567[_0x5990('0x49')][_0x5990('0x53')],_0x192567[_0x5990('0x49')][_0x5990('0x2d')]);_0x192567[_0x5990('0x49')][_0x5990('0x54')]=integrations[_0x5990('0x55')](_0x192567[_0x5990('0x49')][_0x5990('0x53')],_0x192567[_0x5990('0x49')][_0x5990('0x2d')]);return db[_0x5990('0x4b')][_0x5990('0x48')](_0x192567[_0x5990('0x49')],{'include':[{'model':db['ServicenowField'],'as':_0x5990('0x51')},{'model':db[_0x5990('0x56')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x13a6fe,null))['catch'](handleError(_0x13a6fe,null));};exports[_0x5990('0x57')]=function(_0x2f2c16,_0x3ef8be,_0x56ec77){var _0x50f6f6=['made_sla','hold_reason',_0x5990('0x58'),_0x5990('0x59'),'close_code',_0x5990('0x5a'),_0x5990('0x5b'),_0x5990('0x5c'),_0x5990('0x5d')];var _0x126822=[_0x5990('0x5e'),'made_sla',_0x5990('0x5f'),_0x5990('0x60'),_0x5990('0x61'),'sys_updated_on','child_incidents','hold_reason',_0x5990('0x62'),_0x5990('0x63'),_0x5990('0x64'),_0x5990('0x65'),_0x5990('0x66'),_0x5990('0x67'),_0x5990('0x68'),'sys_domain',_0x5990('0x69'),'sys_created_by',_0x5990('0x58'),_0x5990('0x4c'),_0x5990('0x6a'),'closed_at',_0x5990('0x6b'),_0x5990('0x6c'),_0x5990('0x6d'),'active',_0x5990('0x6e'),_0x5990('0x6f'),'priority',_0x5990('0x70'),'rfc','time_worked',_0x5990('0x71'),_0x5990('0x72'),_0x5990('0x73'),_0x5990('0x74'),'work_end',_0x5990('0x75'),'resolved_at','caller_id',_0x5990('0x76'),'subcategory',_0x5990('0x77'),'short_description',_0x5990('0x78'),_0x5990('0x79'),_0x5990('0x7a'),_0x5990('0x7b'),_0x5990('0x7c'),_0x5990('0x7d'),_0x5990('0x7e'),_0x5990('0x7f'),_0x5990('0x80'),'notify',_0x5990('0x81'),_0x5990('0x82'),'closed_by',_0x5990('0x83'),_0x5990('0x84'),'sys_id',_0x5990('0x85'),_0x5990('0x86'),_0x5990('0x5b'),_0x5990('0x87'),_0x5990('0x88'),_0x5990('0x89'),_0x5990('0x8a'),_0x5990('0x8b'),_0x5990('0x8c'),'severity',_0x5990('0x8d'),_0x5990('0x8e'),'approval',_0x5990('0x8f'),_0x5990('0x90'),_0x5990('0x91'),_0x5990('0x92'),_0x5990('0x93'),'escalation','upon_approval','correlation_id',_0x5990('0x94'),_0x5990('0x5d')];var _0x30e029='';var _0x2ee2e1='';var _0x5b9357=[];var _0x4b6905='';var _0x10df59='';var _0x11e46d=[];var _0x3c40b3='';var _0x46014d='';var _0x328892={};var _0x497539='';return db['ServicenowAccount'][_0x5990('0x4f')]({'where':{'id':_0x2f2c16['params']['id']},'attributes':['id',_0x5990('0x95'),_0x5990('0x96'),'email',_0x5990('0x97'),'serverUrl']})[_0x5990('0x23')](handleEntityNotFound(_0x3ef8be,null))[_0x5990('0x23')](function(_0xa041d2){if(_0xa041d2){_0x497539=_0xa041d2[_0x5990('0x97')];var _0x4c9c14=_0x497539[_0x5990('0x98')](-0x1);if(_0x4c9c14==='/'){_0x497539=_0x497539[_0x5990('0x99')](0x0,_0x497539[_0x5990('0x9a')](_0x4c9c14));}_0x46014d=util[_0x5990('0x9b')](_0x5990('0x9c'),_0x497539);_0x3c40b3=util[_0x5990('0x9b')](_0x5990('0x9d'),_0x497539);_0x328892={'user':_0xa041d2[_0x5990('0x95')],'pass':_0xa041d2[_0x5990('0x96')]};var _0x535f9b={'method':_0x5990('0x9e'),'uri':_0x46014d+'incident?sysparm_display_value=all','auth':_0x328892,'json':!![]};return rp(_0x535f9b);}})[_0x5990('0x23')](function(_0x5966b6){if(_0x5966b6[_0x5990('0x9f')][_0x5990('0x36')]>0x0){_0x30e029=_0x5966b6['result'];}console['log'](_0x5990('0xa0'),_0x30e029);_0x11e46d=[];_0x2ee2e1=Object[_0x5990('0xa1')]([],_0x30e029);_[_0x5990('0xa2')](_0x2ee2e1,function(_0x34f102){return!_0x50f6f6['includes'](_0x34f102[_0x5990('0x27')]);});_0x2ee2e1[_0x5990('0xa3')](function(_0x5c410f){var _0x4f2269=createFieldObject(_0x3c40b3,_0x328892,_0x5c410f[_0x5990('0xa4')],_0x5c410f[_0x5990('0x27')],_0x5c410f[_0x5990('0xa5')],![]);_0x11e46d['push'](_0x4f2269);});return Promise[_0x5990('0xa6')](_0x11e46d);})[_0x5990('0x23')](function(_0x2fe81a){_0x5b9357=_0x2fe81a;_0x4b6905=Object['assign']([],_0x30e029);console[_0x5990('0xa7')](_0x5990('0xa8'),_0x30e029);_[_0x5990('0xa2')](_0x4b6905,function(_0x3f5d4a){return _0x126822['includes'](_0x3f5d4a[_0x5990('0x27')]);});console[_0x5990('0xa7')](_0x5990('0xa9'),_0x4b6905);_0x11e46d=[];_0x4b6905[_0x5990('0xa3')](function(_0x4de74c){var _0x1f76fb=createFieldObject(_0x3c40b3,_0x328892,_0x4de74c[_0x5990('0xa4')],_0x4de74c['name'],_0x4de74c[_0x5990('0xa5')],!![]);_0x11e46d[_0x5990('0xaa')](_0x1f76fb);});return Promise[_0x5990('0xa6')](_0x11e46d);})[_0x5990('0x23')](function(_0xa739b9){_0x10df59=_0xa739b9;var _0x59c4b4=_0x5b9357[_0x5990('0xab')](_0x10df59);return{'count':_0x59c4b4['length'],'rows':_0x59c4b4};})[_0x5990('0x23')](respondWithResult(_0x3ef8be,null))[_0x5990('0x47')](function(_0x48adfc){console[_0x5990('0xa7')](_0x5990('0xac')+_0x48adfc);var _0x31757d=_0x2f2c16[_0x5990('0x30')][_0x5990('0xad')]?0x1f4:_0x48adfc[_0x5990('0xae')]||0x1f4;logger['error'](_0x48adfc[_0x5990('0x26')]);delete _0x48adfc[_0x5990('0x27')];if(_0x31757d===0x191){_0x31757d=0x190;}_0x3ef8be[_0x5990('0x17')](_0x31757d)[_0x5990('0x28')](_0x2f2c16[_0x5990('0x30')]['test']?{'message':_0x5990('0xaf'),'statusCode':_0x48adfc[_0x5990('0xae')]}:_0x48adfc);});};function createFieldObject(_0x51fb08,_0x29c9c3,_0x4e176a,_0x4d6256,_0x3f1910,_0x37170b){return new Promise(function(_0x239c2c,_0x24879a){var _0x29e550={'id':_0x4d6256,'name':_0x3f1910,'custom':_0x37170b};if(_0x4e176a===_0x5990('0xb0')){_0x29e550[_0x5990('0x3f')]=[{'name':_0x5990('0xb1'),'value':_0x5990('0xb2')},{'name':_0x5990('0xb3'),'value':_0x5990('0xb4')}];_0x239c2c(_0x29e550);}else{var _0x11836e={'method':_0x5990('0x9e'),'uri':_0x51fb08+'sys_choice?sysparm_query=name=incident^element='+_0x4d6256,'auth':_0x29c9c3,'json':!![]};return rp(_0x11836e)['then'](function(_0x39fa7e){var _0x388d6c=[];if(_0x39fa7e['result'][_0x5990('0x36')]>0x0){_0x39fa7e['result'][_0x5990('0xa3')](function(_0x5bcc01){if(_0x5bcc01[_0x5990('0xb5')]==='false'){var _0x2e7b65={'name':_0x5bcc01[_0x5990('0xa5')],'value':_0x5bcc01[_0x5990('0xb6')]};_0x388d6c[_0x5990('0xaa')](_0x2e7b65);}});}_0x29e550['options']=_0x388d6c;if(_0x29e550[_0x5990('0x3f')][_0x5990('0x36')]>0x0){_0x239c2c(_0x29e550);}else{if(_0x37170b==![]){_0x239c2c();}else{_0x239c2c(_0x29e550);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 4a9b5d1..39e78aa 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 _0xe14b=['bluebird','path','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','moment'];(function(_0x3411c5,_0x35ed13){var _0x275a51=function(_0x507519){while(--_0x507519){_0x3411c5['push'](_0x3411c5['shift']());}};_0x275a51(++_0x35ed13);}(_0xe14b,0x93));var _0xbe14=function(_0x114f5a,_0xdb5900){_0x114f5a=_0x114f5a-0x0;var _0x1ee984=_0xe14b[_0x114f5a];return _0x1ee984;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));var integrations=require(_0xbe14('0x6'));module[_0xbe14('0x7')]=function(_0x1ff100,_0x1d9ade){return _0x1ff100[_0xbe14('0x8')](_0xbe14('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eb2=['request-promise','rimraf','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x44215f,_0x534f90){var _0x53bc5c=function(_0x37ff01){while(--_0x37ff01){_0x44215f['push'](_0x44215f['shift']());}};_0x53bc5c(++_0x534f90);}(_0x2eb2,0x19f));var _0x22eb=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x2eb2[_0x92c450];return _0x2a9599;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x22eb('0x7'));module[_0x22eb('0x8')]=function(_0x35dd5b,_0x2a9850){return _0x35dd5b[_0x22eb('0x9')](_0x22eb('0xa'),attributes,{'tableName':_0x22eb('0xb'),'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 b54c165..e44dac0 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 _0xea49=['then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ServicenowAccount','findAll','options','where','attributes','limit','map','include','model','GetServicenowAccount','catch','ShowServicenowAccount','find','raw','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xea49,0xe4));var _0x9ea4=function(_0x2c843d,_0x144e01){_0x2c843d=_0x2c843d-0x0;var _0x159a78=_0xea49[_0x2c843d];return _0x159a78;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9ea4('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ea4('0x1'));var db=require(_0x9ea4('0x2'))['db'];var utils=require(_0x9ea4('0x3'));var logger=require(_0x9ea4('0x4'))(_0x9ea4('0x5'));var config=require('../../config/environment');var jayson=require(_0x9ea4('0x6'));var client=jayson[_0x9ea4('0x7')][_0x9ea4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x362876,_0x50b325,_0x18e8eb){return new BPromise(function(_0x54792e,_0x2c0894){return client[_0x9ea4('0x9')](_0x362876,_0x18e8eb)[_0x9ea4('0xa')](function(_0x5a0dbd){logger['info'](_0x9ea4('0xb'),_0x50b325,_0x9ea4('0xc'));logger[_0x9ea4('0xd')](_0x9ea4('0xe'),_0x50b325,_0x9ea4('0xc'),JSON[_0x9ea4('0xf')](_0x5a0dbd));if(_0x5a0dbd[_0x9ea4('0x10')]){if(_0x5a0dbd[_0x9ea4('0x10')][_0x9ea4('0x11')]===0x1f4){logger[_0x9ea4('0x10')](_0x9ea4('0xb'),_0x50b325,_0x5a0dbd[_0x9ea4('0x10')]['message']);return _0x2c0894(_0x5a0dbd[_0x9ea4('0x10')][_0x9ea4('0x12')]);}logger[_0x9ea4('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x50b325,_0x5a0dbd['error'][_0x9ea4('0x12')]);return _0x54792e(_0x5a0dbd[_0x9ea4('0x10')][_0x9ea4('0x12')]);}else{logger[_0x9ea4('0x13')](_0x9ea4('0xb'),_0x50b325,_0x9ea4('0xc'));_0x54792e(_0x5a0dbd['result'][_0x9ea4('0x12')]);}})['catch'](function(_0x459b18){logger[_0x9ea4('0x10')](_0x9ea4('0xb'),_0x50b325,_0x459b18);_0x2c0894(_0x459b18);});});}exports['GetServicenowAccount']=function(_0x34358){var _0x2b2315=this;return new Promise(function(_0x2c6ef1,_0x1119bc){return db[_0x9ea4('0x14')][_0x9ea4('0x15')]({'raw':_0x34358[_0x9ea4('0x16')]?_0x34358[_0x9ea4('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x34358[_0x9ea4('0x16')]?_0x34358[_0x9ea4('0x16')][_0x9ea4('0x17')]||null:null,'attributes':_0x34358[_0x9ea4('0x16')]?_0x34358[_0x9ea4('0x16')][_0x9ea4('0x18')]||null:null,'limit':_0x34358['options']?_0x34358['options'][_0x9ea4('0x19')]||null:null,'include':_0x34358[_0x9ea4('0x16')]?_0x34358[_0x9ea4('0x16')]['include']?_[_0x9ea4('0x1a')](_0x34358[_0x9ea4('0x16')][_0x9ea4('0x1b')],function(_0x2339d6){return{'model':db[_0x2339d6[_0x9ea4('0x1c')]],'as':_0x2339d6['as'],'attributes':_0x2339d6['attributes'],'include':_0x2339d6[_0x9ea4('0x1b')]?_['map'](_0x2339d6[_0x9ea4('0x1b')],function(_0x5a482c){return{'model':db[_0x5a482c[_0x9ea4('0x1c')]],'as':_0x5a482c['as'],'attributes':_0x5a482c[_0x9ea4('0x18')],'include':_0x5a482c['include']?_[_0x9ea4('0x1a')](_0x5a482c[_0x9ea4('0x1b')],function(_0x363a50){return{'model':db[_0x363a50[_0x9ea4('0x1c')]],'as':_0x363a50['as'],'attributes':_0x363a50[_0x9ea4('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9ea4('0xa')](function(_0x44e363){logger[_0x9ea4('0x13')](_0x9ea4('0x1d'),_0x34358);logger[_0x9ea4('0xd')](_0x9ea4('0x1d'),_0x34358,JSON[_0x9ea4('0xf')](_0x44e363));_0x2c6ef1(_0x44e363);})[_0x9ea4('0x1e')](function(_0x30d9a1){logger[_0x9ea4('0x10')](_0x9ea4('0x1d'),_0x30d9a1[_0x9ea4('0x12')],_0x34358);_0x1119bc(_0x2b2315['error'](0x1f4,_0x30d9a1[_0x9ea4('0x12')]));});});};exports[_0x9ea4('0x1f')]=function(_0x4015e3){var _0x574cbb=this;return new Promise(function(_0x4402fe,_0x480630){return db[_0x9ea4('0x14')][_0x9ea4('0x20')]({'raw':_0x4015e3[_0x9ea4('0x16')]?_0x4015e3[_0x9ea4('0x16')][_0x9ea4('0x21')]===undefined?!![]:![]:!![],'where':_0x4015e3[_0x9ea4('0x16')]?_0x4015e3['options'][_0x9ea4('0x17')]||null:null,'attributes':_0x4015e3['options']?_0x4015e3['options'][_0x9ea4('0x18')]||null:null,'include':_0x4015e3[_0x9ea4('0x16')]?_0x4015e3[_0x9ea4('0x16')]['include']?_[_0x9ea4('0x1a')](_0x4015e3[_0x9ea4('0x16')][_0x9ea4('0x1b')],function(_0xc4fce6){return{'model':db[_0xc4fce6['model']],'as':_0xc4fce6['as'],'attributes':_0xc4fce6[_0x9ea4('0x18')],'include':_0xc4fce6[_0x9ea4('0x1b')]?_[_0x9ea4('0x1a')](_0xc4fce6[_0x9ea4('0x1b')],function(_0x47370c){return{'model':db[_0x47370c[_0x9ea4('0x1c')]],'as':_0x47370c['as'],'attributes':_0x47370c['attributes'],'include':_0x47370c[_0x9ea4('0x1b')]?_[_0x9ea4('0x1a')](_0x47370c[_0x9ea4('0x1b')],function(_0x91736b){return{'model':db[_0x91736b[_0x9ea4('0x1c')]],'as':_0x91736b['as'],'attributes':_0x91736b[_0x9ea4('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9ea4('0xa')](function(_0x37c4cc){logger[_0x9ea4('0x13')](_0x9ea4('0x1f'),_0x4015e3);logger[_0x9ea4('0xd')](_0x9ea4('0x1f'),_0x4015e3,JSON[_0x9ea4('0xf')](_0x37c4cc));_0x4402fe(_0x37c4cc);})[_0x9ea4('0x1e')](function(_0x186191){logger[_0x9ea4('0x10')](_0x9ea4('0x1f'),_0x186191[_0x9ea4('0x12')],_0x4015e3);_0x480630(_0x574cbb[_0x9ea4('0x10')](0x1f4,_0x186191[_0x9ea4('0x12')]));});});}; \ No newline at end of file +var _0x82c4=['findAll','options','raw','attributes','include','map','model','ShowServicenowAccount','ServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetServicenowAccount'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x82c4,0x1ca));var _0x482c=function(_0x383e64,_0x2c3425){_0x383e64=_0x383e64-0x0;var _0x12725d=_0x82c4[_0x383e64];return _0x12725d;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rs=require(_0x482c('0x4'));var fs=require('fs');var Redis=require(_0x482c('0x5'));var db=require(_0x482c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x482c('0x7'))('rpc');var config=require(_0x482c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x482c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfdb92,_0x32a503,_0x35cdab){return new BPromise(function(_0x1c10f2,_0x3846d8){return client['request'](_0xfdb92,_0x35cdab)[_0x482c('0xa')](function(_0x135cc1){logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));logger[_0x482c('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x32a503,_0x482c('0xd'),JSON[_0x482c('0xf')](_0x135cc1));if(_0x135cc1[_0x482c('0x10')]){if(_0x135cc1['error'][_0x482c('0x11')]===0x1f4){logger[_0x482c('0x10')](_0x482c('0xc'),_0x32a503,_0x135cc1['error']['message']);return _0x3846d8(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x32a503,_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);return _0x1c10f2(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}else{logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));_0x1c10f2(_0x135cc1[_0x482c('0x13')][_0x482c('0x12')]);}})[_0x482c('0x14')](function(_0x363403){logger[_0x482c('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x32a503,_0x363403);_0x3846d8(_0x363403);});});}exports[_0x482c('0x15')]=function(_0x5b6f7e){var _0x3aed45=this;return new Promise(function(_0x258148,_0x4af05a){return db['ServicenowAccount'][_0x482c('0x16')]({'raw':_0x5b6f7e['options']?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'where':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')]['where']||null:null,'attributes':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x19')]||null:null,'limit':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')]['limit']||null:null,'include':_0x5b6f7e['options']?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x5b6f7e['options'][_0x482c('0x1a')],function(_0x579d2f){return{'model':db[_0x579d2f[_0x482c('0x1c')]],'as':_0x579d2f['as'],'attributes':_0x579d2f[_0x482c('0x19')],'include':_0x579d2f['include']?_[_0x482c('0x1b')](_0x579d2f['include'],function(_0x589bc6){return{'model':db[_0x589bc6[_0x482c('0x1c')]],'as':_0x589bc6['as'],'attributes':_0x589bc6[_0x482c('0x19')],'include':_0x589bc6[_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x589bc6[_0x482c('0x1a')],function(_0x215826){return{'model':db[_0x215826[_0x482c('0x1c')]],'as':_0x215826['as'],'attributes':_0x215826['attributes']};}):[]};}):[]};}):[]:[]})[_0x482c('0xa')](function(_0x255417){logger['info'](_0x482c('0x15'),_0x5b6f7e);logger['debug']('GetServicenowAccount',_0x5b6f7e,JSON[_0x482c('0xf')](_0x255417));_0x258148(_0x255417);})['catch'](function(_0x1ac1c4){logger[_0x482c('0x10')](_0x482c('0x15'),_0x1ac1c4[_0x482c('0x12')],_0x5b6f7e);_0x4af05a(_0x3aed45[_0x482c('0x10')](0x1f4,_0x1ac1c4[_0x482c('0x12')]));});});};exports[_0x482c('0x1d')]=function(_0x3e9b22){var _0x24b4df=this;return new Promise(function(_0x2d3800,_0x3135a7){return db[_0x482c('0x1e')][_0x482c('0x1f')]({'raw':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'where':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')]['where']||null:null,'attributes':_0x3e9b22['options']?_0x3e9b22['options'][_0x482c('0x19')]||null:null,'include':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')][_0x482c('0x1a')]?_['map'](_0x3e9b22[_0x482c('0x17')]['include'],function(_0x31428c){return{'model':db[_0x31428c[_0x482c('0x1c')]],'as':_0x31428c['as'],'attributes':_0x31428c[_0x482c('0x19')],'include':_0x31428c[_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x31428c[_0x482c('0x1a')],function(_0x129a31){return{'model':db[_0x129a31[_0x482c('0x1c')]],'as':_0x129a31['as'],'attributes':_0x129a31['attributes'],'include':_0x129a31['include']?_[_0x482c('0x1b')](_0x129a31['include'],function(_0xe62a02){return{'model':db[_0xe62a02[_0x482c('0x1c')]],'as':_0xe62a02['as'],'attributes':_0xe62a02[_0x482c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29cbaa){logger[_0x482c('0xb')](_0x482c('0x1d'),_0x3e9b22);logger[_0x482c('0xe')]('ShowServicenowAccount',_0x3e9b22,JSON[_0x482c('0xf')](_0x29cbaa));_0x2d3800(_0x29cbaa);})['catch'](function(_0x1de7f4){logger['error'](_0x482c('0x1d'),_0x1de7f4['message'],_0x3e9b22);_0x3135a7(_0x24b4df[_0x482c('0x10')](0x1f4,_0x1de7f4[_0x482c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index ed70f56..b08847a 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 _0x1eca=['update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1eca,0x96));var _0xa1ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1eca[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa1ec('0x0'));var timeout=require(_0xa1ec('0x1'));var express=require(_0xa1ec('0x2'));var router=express[_0xa1ec('0x3')]();var fs_extra=require(_0xa1ec('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa1ec('0x5'));var config=require(_0xa1ec('0x6'));var controller=require(_0xa1ec('0x7'));router[_0xa1ec('0x8')]('/',auth[_0xa1ec('0x9')](),controller['index']);router[_0xa1ec('0x8')](_0xa1ec('0xa'),auth[_0xa1ec('0x9')](),controller['show']);router[_0xa1ec('0x8')]('/:id/fields',auth[_0xa1ec('0x9')](),controller['getFields']);router[_0xa1ec('0x8')](_0xa1ec('0xb'),auth[_0xa1ec('0x9')](),controller[_0xa1ec('0xc')]);router[_0xa1ec('0x8')](_0xa1ec('0xd'),auth['isAuthenticated'](),controller[_0xa1ec('0xe')]);router[_0xa1ec('0xf')]('/',auth['isAuthenticated'](),controller[_0xa1ec('0x10')]);router[_0xa1ec('0x11')](_0xa1ec('0xa'),auth[_0xa1ec('0x9')](),controller[_0xa1ec('0x12')]);router[_0xa1ec('0x13')](_0xa1ec('0xa'),auth[_0xa1ec('0x9')](),controller['destroy']);module[_0xa1ec('0x14')]=router; \ No newline at end of file +var _0xd59b=['update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getDescriptions','post','create','put'];(function(_0xe7682c,_0x3395bc){var _0x5e0c94=function(_0x5698dd){while(--_0x5698dd){_0xe7682c['push'](_0xe7682c['shift']());}};_0x5e0c94(++_0x3395bc);}(_0xd59b,0x192));var _0xbd59=function(_0x1ddec5,_0x385073){_0x1ddec5=_0x1ddec5-0x0;var _0x43efd5=_0xd59b[_0x1ddec5];return _0x43efd5;};'use strict';var multer=require(_0xbd59('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbd59('0x1'));var express=require(_0xbd59('0x2'));var router=express[_0xbd59('0x3')]();var fs_extra=require(_0xbd59('0x4'));var auth=require(_0xbd59('0x5'));var interaction=require(_0xbd59('0x6'));var config=require(_0xbd59('0x7'));var controller=require(_0xbd59('0x8'));router[_0xbd59('0x9')]('/',auth[_0xbd59('0xa')](),controller['index']);router[_0xbd59('0x9')](_0xbd59('0xb'),auth[_0xbd59('0xa')](),controller[_0xbd59('0xc')]);router[_0xbd59('0x9')](_0xbd59('0xd'),auth[_0xbd59('0xa')](),controller['getFields']);router[_0xbd59('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xbd59('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xbd59('0xe')]);router[_0xbd59('0xf')]('/',auth[_0xbd59('0xa')](),controller[_0xbd59('0x10')]);router[_0xbd59('0x11')](_0xbd59('0xb'),auth[_0xbd59('0xa')](),controller[_0xbd59('0x12')]);router['delete'](_0xbd59('0xb'),auth[_0xbd59('0xa')](),controller[_0xbd59('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index b7354db..1807334 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 _0x667a=['exports','STRING','sequelize'];(function(_0x58ae8a,_0x3c619e){var _0x2f0b6b=function(_0x6db940){while(--_0x6db940){_0x58ae8a['push'](_0x58ae8a['shift']());}};_0x2f0b6b(++_0x3c619e);}(_0x667a,0xbc));var _0xa667=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x667a[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require(_0xa667('0x0'));module[_0xa667('0x1')]={'name':{'type':Sequelize[_0xa667('0x2')]},'description':{'type':Sequelize[_0xa667('0x2')]}}; \ No newline at end of file +var _0x85ec=['STRING','exports'];(function(_0x3ee333,_0x2b4535){var _0x3406e3=function(_0x31f483){while(--_0x31f483){_0x3ee333['push'](_0x3ee333['shift']());}};_0x3406e3(++_0x2b4535);}(_0x85ec,0xaf));var _0xc85e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x85ec[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc85e('0x0')]={'name':{'type':Sequelize[_0xc85e('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 5553e82..74ec2f2 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 _0x77e4=['limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','ServicenowConfiguration','include','findAll','rows','show','fields','find','create','body','catch','params','getFields','findOne','getSubjects','ServicenowField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0xfc444f,_0x5281c7){var _0x126d39=function(_0x271ea5){while(--_0x271ea5){_0xfc444f['push'](_0xfc444f['shift']());}};_0x126d39(++_0x5281c7);}(_0x77e4,0x1bb));var _0x477e=function(_0x2a791e,_0x29293a){_0x2a791e=_0x2a791e-0x0;var _0x84d3c7=_0x77e4[_0x2a791e];return _0x84d3c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x477e('0x0'));var zipdir=require(_0x477e('0x1'));var jsonpatch=require(_0x477e('0x2'));var rp=require(_0x477e('0x3'));var moment=require(_0x477e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x477e('0x5'));var sox=require(_0x477e('0x6'));var csv=require(_0x477e('0x7'));var ejs=require(_0x477e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x477e('0x9'));var squel=require(_0x477e('0xa'));var crypto=require(_0x477e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x477e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x477e('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x477e('0xe'));var qs=require(_0x477e('0xf'));var as=require(_0x477e('0x10'));var hardwareService=require(_0x477e('0x11'));var logger=require(_0x477e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x477e('0x13'))['db'];function respondWithStatusCode(_0x59ced4,_0x92a88){_0x92a88=_0x92a88||0xcc;return function(_0x20e355){if(_0x20e355){return _0x59ced4[_0x477e('0x14')](_0x92a88);}return _0x59ced4[_0x477e('0x15')](_0x92a88)['end']();};}function respondWithResult(_0x4bc347,_0x151764){_0x151764=_0x151764||0xc8;return function(_0x23c0a6){if(_0x23c0a6){return _0x4bc347[_0x477e('0x15')](_0x151764)[_0x477e('0x16')](_0x23c0a6);}};}function respondWithFilteredResult(_0x30f84a,_0x333275){return function(_0x246605){if(_0x246605){var _0x290006=typeof _0x333275[_0x477e('0x17')]===_0x477e('0x18')&&typeof _0x333275[_0x477e('0x19')]===_0x477e('0x18');var _0x5ca063=_0x246605[_0x477e('0x1a')];var _0x4b57be=_0x290006?0x0:_0x333275[_0x477e('0x17')];var _0x393e7c=_0x290006?_0x246605[_0x477e('0x1a')]:_0x333275[_0x477e('0x17')]+_0x333275[_0x477e('0x19')];var _0x10ea7e;if(_0x393e7c>=_0x5ca063){_0x393e7c=_0x5ca063;_0x10ea7e=0xc8;}else{_0x10ea7e=0xce;}_0x30f84a[_0x477e('0x15')](_0x10ea7e);return _0x30f84a[_0x477e('0x1b')](_0x477e('0x1c'),_0x4b57be+'-'+_0x393e7c+'/'+_0x5ca063)[_0x477e('0x16')](_0x246605);}return null;};}function patchUpdates(_0x233f4b){return function(_0x58e5f8){try{jsonpatch['apply'](_0x58e5f8,_0x233f4b,!![]);}catch(_0x1d9c62){return BPromise[_0x477e('0x1d')](_0x1d9c62);}return _0x58e5f8[_0x477e('0x1e')]();};}function saveUpdates(_0x47ba8b,_0x2a7928){return function(_0x4cfee5){if(_0x4cfee5){return _0x4cfee5[_0x477e('0x1f')](_0x47ba8b)[_0x477e('0x20')](function(_0x2155ed){return _0x2155ed;});}return null;};}function removeEntity(_0x34f9d7,_0x3c9b8e){return function(_0x268e56){if(_0x268e56){return _0x268e56[_0x477e('0x21')]()[_0x477e('0x20')](function(){_0x34f9d7[_0x477e('0x15')](0xcc)[_0x477e('0x22')]();});}};}function handleEntityNotFound(_0x34f97a,_0x4e2203){return function(_0x3c5b1d){if(!_0x3c5b1d){_0x34f97a['sendStatus'](0x194);}return _0x3c5b1d;};}function handleError(_0x454a60,_0x4147f5){_0x4147f5=_0x4147f5||0x1f4;return function(_0x1e590e){logger[_0x477e('0x23')](_0x1e590e[_0x477e('0x24')]);if(_0x1e590e[_0x477e('0x25')]){delete _0x1e590e[_0x477e('0x25')];}_0x454a60['status'](_0x4147f5)[_0x477e('0x26')](_0x1e590e);};}exports[_0x477e('0x27')]=function(_0x43d88e,_0x1f736c){var _0x250852={},_0x57eebc={},_0x430cef={'count':0x0,'rows':[]};var _0x5dfff2=_[_0x477e('0x28')](db['ServicenowConfiguration'][_0x477e('0x29')],function(_0x15f044){return{'name':_0x15f044[_0x477e('0x2a')],'type':_0x15f044[_0x477e('0x2b')][_0x477e('0x2c')]};});_0x57eebc['model']=_[_0x477e('0x28')](_0x5dfff2,'name');_0x57eebc[_0x477e('0x2d')]=_[_0x477e('0x2e')](_0x43d88e[_0x477e('0x2d')]);_0x57eebc[_0x477e('0x2f')]=_[_0x477e('0x30')](_0x57eebc[_0x477e('0x31')],_0x57eebc[_0x477e('0x2d')]);_0x250852[_0x477e('0x32')]=_[_0x477e('0x30')](_0x57eebc[_0x477e('0x31')],qs['fields'](_0x43d88e[_0x477e('0x2d')]['fields']));_0x250852['attributes']=_0x250852['attributes'][_0x477e('0x33')]?_0x250852[_0x477e('0x32')]:_0x57eebc['model'];if(!_0x43d88e[_0x477e('0x2d')][_0x477e('0x34')](_0x477e('0x35'))){_0x250852[_0x477e('0x19')]=qs[_0x477e('0x19')](_0x43d88e[_0x477e('0x2d')][_0x477e('0x19')]);_0x250852[_0x477e('0x17')]=qs[_0x477e('0x17')](_0x43d88e[_0x477e('0x2d')]['offset']);}_0x250852[_0x477e('0x36')]=qs[_0x477e('0x37')](_0x43d88e['query']['sort']);_0x250852[_0x477e('0x38')]=qs['filters'](_[_0x477e('0x39')](_0x43d88e['query'],_0x57eebc[_0x477e('0x2f')]),_0x5dfff2);if(_0x43d88e[_0x477e('0x2d')][_0x477e('0x3a')]){_0x250852[_0x477e('0x38')]=_['merge'](_0x250852[_0x477e('0x38')],{'$or':_['map'](_0x5dfff2,function(_0x5e23ce){if(_0x5e23ce[_0x477e('0x2b')]!==_0x477e('0x3b')){var _0xff5bd2={};_0xff5bd2[_0x5e23ce['name']]={'$like':'%'+_0x43d88e[_0x477e('0x2d')][_0x477e('0x3a')]+'%'};return _0xff5bd2;}})});}_0x250852=_[_0x477e('0x3c')]({},_0x250852,_0x43d88e[_0x477e('0x3d')]);var _0xb8a3ec={'where':_0x250852[_0x477e('0x38')]};return db[_0x477e('0x3e')][_0x477e('0x1a')](_0xb8a3ec)[_0x477e('0x20')](function(_0x22d3d6){_0x430cef[_0x477e('0x1a')]=_0x22d3d6;if(_0x43d88e[_0x477e('0x2d')]['includeAll']){_0x250852[_0x477e('0x3f')]=[{'all':!![]}];}return db[_0x477e('0x3e')][_0x477e('0x40')](_0x250852);})[_0x477e('0x20')](function(_0x8e2728){_0x430cef[_0x477e('0x41')]=_0x8e2728;return _0x430cef;})[_0x477e('0x20')](respondWithFilteredResult(_0x1f736c,_0x250852))['catch'](handleError(_0x1f736c,null));};exports[_0x477e('0x42')]=function(_0x5af299,_0x19d8b0){var _0xed55df={'raw':![],'where':{'id':_0x5af299['params']['id']}},_0x5c19ef={};_0x5c19ef[_0x477e('0x31')]=_['keys'](db[_0x477e('0x3e')][_0x477e('0x29')]);_0x5c19ef[_0x477e('0x2d')]=_[_0x477e('0x2e')](_0x5af299[_0x477e('0x2d')]);_0x5c19ef[_0x477e('0x2f')]=_[_0x477e('0x30')](_0x5c19ef[_0x477e('0x31')],_0x5c19ef[_0x477e('0x2d')]);_0xed55df[_0x477e('0x32')]=_[_0x477e('0x30')](_0x5c19ef[_0x477e('0x31')],qs[_0x477e('0x43')](_0x5af299[_0x477e('0x2d')][_0x477e('0x43')]));_0xed55df['attributes']=_0xed55df['attributes'][_0x477e('0x33')]?_0xed55df[_0x477e('0x32')]:_0x5c19ef[_0x477e('0x31')];if(_0x5af299[_0x477e('0x2d')]['includeAll']){_0xed55df[_0x477e('0x3f')]=[{'all':!![]}];}_0xed55df=_[_0x477e('0x3c')]({},_0xed55df,_0x5af299['options']);return db[_0x477e('0x3e')][_0x477e('0x44')](_0xed55df)[_0x477e('0x20')](handleEntityNotFound(_0x19d8b0,null))[_0x477e('0x20')](respondWithResult(_0x19d8b0,null))['catch'](handleError(_0x19d8b0,null));};exports[_0x477e('0x45')]=function(_0x12df4c,_0x466099){return db[_0x477e('0x3e')][_0x477e('0x45')](_0x12df4c[_0x477e('0x46')],{})[_0x477e('0x20')](respondWithResult(_0x466099,0xc9))[_0x477e('0x47')](handleError(_0x466099,null));};exports[_0x477e('0x1f')]=function(_0x126189,_0x1c3af1){if(_0x126189[_0x477e('0x46')]['id']){delete _0x126189[_0x477e('0x46')]['id'];}return db[_0x477e('0x3e')]['find']({'where':{'id':_0x126189[_0x477e('0x48')]['id']}})[_0x477e('0x20')](handleEntityNotFound(_0x1c3af1,null))[_0x477e('0x20')](saveUpdates(_0x126189['body'],null))['then'](respondWithResult(_0x1c3af1,null))[_0x477e('0x47')](handleError(_0x1c3af1,null));};exports[_0x477e('0x21')]=function(_0xf36e15,_0x45511e){return db[_0x477e('0x3e')][_0x477e('0x44')]({'where':{'id':_0xf36e15['params']['id']}})[_0x477e('0x20')](handleEntityNotFound(_0x45511e,null))[_0x477e('0x20')](removeEntity(_0x45511e,null))[_0x477e('0x47')](handleError(_0x45511e,null));};exports[_0x477e('0x49')]=function(_0x9fccf8,_0x4dc041,_0x17b068){var _0x10e849={};var _0x5d5f22={};var _0x27493c;var _0x5d59b7;return db['ServicenowConfiguration'][_0x477e('0x4a')]({'where':{'id':_0x9fccf8[_0x477e('0x48')]['id']}})[_0x477e('0x20')](handleEntityNotFound(_0x4dc041,null))[_0x477e('0x20')](function(_0x3d4a71){if(_0x3d4a71){_0x27493c=_0x3d4a71;_0x5d5f22['model']=_[_0x477e('0x2e')](db['ServicenowField']['rawAttributes']);_0x5d5f22[_0x477e('0x2d')]=_[_0x477e('0x2e')](_0x9fccf8['query']);_0x5d5f22[_0x477e('0x2f')]=_[_0x477e('0x30')](_0x5d5f22[_0x477e('0x31')],_0x5d5f22[_0x477e('0x2d')]);_0x10e849['attributes']=_['intersection'](_0x5d5f22['model'],qs[_0x477e('0x43')](_0x9fccf8[_0x477e('0x2d')][_0x477e('0x43')]));_0x10e849[_0x477e('0x32')]=_0x10e849['attributes']['length']?_0x10e849[_0x477e('0x32')]:_0x5d5f22[_0x477e('0x31')];_0x10e849[_0x477e('0x36')]=qs[_0x477e('0x37')](_0x9fccf8[_0x477e('0x2d')][_0x477e('0x37')]);_0x10e849[_0x477e('0x38')]=qs['filters'](_[_0x477e('0x39')](_0x9fccf8['query'],_0x5d5f22[_0x477e('0x2f')]));if(_0x9fccf8[_0x477e('0x2d')][_0x477e('0x3a')]){_0x10e849['where']=_[_0x477e('0x3c')](_0x10e849[_0x477e('0x38')],{'$or':_['map'](_0x10e849[_0x477e('0x32')],function(_0x452301){var _0xe1ebaa={};_0xe1ebaa[_0x452301]={'$like':'%'+_0x9fccf8['query'][_0x477e('0x3a')]+'%'};return _0xe1ebaa;})});}_0x10e849=_[_0x477e('0x3c')]({},_0x10e849,_0x9fccf8[_0x477e('0x3d')]);return _0x27493c['getFields'](_0x10e849);}})[_0x477e('0x20')](function(_0x3d7f5){if(_0x3d7f5){_0x5d59b7=_0x3d7f5['length'];if(!_0x9fccf8[_0x477e('0x2d')][_0x477e('0x34')]('nolimit')){_0x10e849[_0x477e('0x19')]=qs['limit'](_0x9fccf8[_0x477e('0x2d')]['limit']);_0x10e849[_0x477e('0x17')]=qs[_0x477e('0x17')](_0x9fccf8['query']['offset']);}return _0x27493c[_0x477e('0x49')](_0x10e849);}})['then'](function(_0x38a2a2){if(_0x38a2a2){return _0x38a2a2?{'count':_0x5d59b7,'rows':_0x38a2a2}:null;}})[_0x477e('0x20')](respondWithResult(_0x4dc041,null))['catch'](handleError(_0x4dc041,null));};exports[_0x477e('0x4b')]=function(_0x19e2e2,_0x108bd8,_0x368151){var _0x11d1ac={};var _0x1339f7={};var _0x1010b8;var _0x15fc4b;return db[_0x477e('0x3e')][_0x477e('0x4a')]({'where':{'id':_0x19e2e2['params']['id']}})[_0x477e('0x20')](handleEntityNotFound(_0x108bd8,null))[_0x477e('0x20')](function(_0x9c3493){if(_0x9c3493){_0x1010b8=_0x9c3493;_0x1339f7[_0x477e('0x31')]=_[_0x477e('0x2e')](db[_0x477e('0x4c')][_0x477e('0x29')]);_0x1339f7[_0x477e('0x2d')]=_[_0x477e('0x2e')](_0x19e2e2['query']);_0x1339f7[_0x477e('0x2f')]=_[_0x477e('0x30')](_0x1339f7[_0x477e('0x31')],_0x1339f7[_0x477e('0x2d')]);_0x11d1ac[_0x477e('0x32')]=_[_0x477e('0x30')](_0x1339f7[_0x477e('0x31')],qs[_0x477e('0x43')](_0x19e2e2[_0x477e('0x2d')][_0x477e('0x43')]));_0x11d1ac['attributes']=_0x11d1ac[_0x477e('0x32')]['length']?_0x11d1ac['attributes']:_0x1339f7[_0x477e('0x31')];_0x11d1ac['order']=qs[_0x477e('0x37')](_0x19e2e2[_0x477e('0x2d')][_0x477e('0x37')]);_0x11d1ac['where']=qs[_0x477e('0x2f')](_[_0x477e('0x39')](_0x19e2e2['query'],_0x1339f7['filters']));if(_0x19e2e2[_0x477e('0x2d')][_0x477e('0x3a')]){_0x11d1ac[_0x477e('0x38')]=_[_0x477e('0x3c')](_0x11d1ac['where'],{'$or':_['map'](_0x11d1ac[_0x477e('0x32')],function(_0x35899f){var _0x490216={};_0x490216[_0x35899f]={'$like':'%'+_0x19e2e2[_0x477e('0x2d')][_0x477e('0x3a')]+'%'};return _0x490216;})});}_0x11d1ac=_[_0x477e('0x3c')]({},_0x11d1ac,_0x19e2e2[_0x477e('0x3d')]);return _0x1010b8[_0x477e('0x4b')](_0x11d1ac);}})[_0x477e('0x20')](function(_0x4a66e8){if(_0x4a66e8){_0x15fc4b=_0x4a66e8[_0x477e('0x33')];if(!_0x19e2e2[_0x477e('0x2d')][_0x477e('0x34')](_0x477e('0x35'))){_0x11d1ac[_0x477e('0x19')]=qs[_0x477e('0x19')](_0x19e2e2['query'][_0x477e('0x19')]);_0x11d1ac['offset']=qs[_0x477e('0x17')](_0x19e2e2[_0x477e('0x2d')]['offset']);}return _0x1010b8['getSubjects'](_0x11d1ac);}})['then'](function(_0x57171a){if(_0x57171a){return _0x57171a?{'count':_0x15fc4b,'rows':_0x57171a}:null;}})[_0x477e('0x20')](respondWithResult(_0x108bd8,null))[_0x477e('0x47')](handleError(_0x108bd8,null));};exports[_0x477e('0x4d')]=function(_0x30ea52,_0x2dd731,_0x4c9f28){var _0x20561f={};var _0x3f0c15={};var _0x1fc230;var _0x50644f;return db[_0x477e('0x3e')][_0x477e('0x4a')]({'where':{'id':_0x30ea52[_0x477e('0x48')]['id']}})[_0x477e('0x20')](handleEntityNotFound(_0x2dd731,null))['then'](function(_0x9f3dff){if(_0x9f3dff){_0x1fc230=_0x9f3dff;_0x3f0c15['model']=_[_0x477e('0x2e')](db['ServicenowField'][_0x477e('0x29')]);_0x3f0c15[_0x477e('0x2d')]=_[_0x477e('0x2e')](_0x30ea52[_0x477e('0x2d')]);_0x3f0c15[_0x477e('0x2f')]=_['intersection'](_0x3f0c15[_0x477e('0x31')],_0x3f0c15[_0x477e('0x2d')]);_0x20561f[_0x477e('0x32')]=_[_0x477e('0x30')](_0x3f0c15['model'],qs[_0x477e('0x43')](_0x30ea52['query']['fields']));_0x20561f[_0x477e('0x32')]=_0x20561f[_0x477e('0x32')][_0x477e('0x33')]?_0x20561f[_0x477e('0x32')]:_0x3f0c15[_0x477e('0x31')];_0x20561f[_0x477e('0x36')]=qs['sort'](_0x30ea52['query']['sort']);_0x20561f[_0x477e('0x38')]=qs[_0x477e('0x2f')](_[_0x477e('0x39')](_0x30ea52[_0x477e('0x2d')],_0x3f0c15[_0x477e('0x2f')]));if(_0x30ea52[_0x477e('0x2d')][_0x477e('0x3a')]){_0x20561f['where']=_[_0x477e('0x3c')](_0x20561f[_0x477e('0x38')],{'$or':_[_0x477e('0x28')](_0x20561f[_0x477e('0x32')],function(_0x20d38a){var _0x2bc5e8={};_0x2bc5e8[_0x20d38a]={'$like':'%'+_0x30ea52['query'][_0x477e('0x3a')]+'%'};return _0x2bc5e8;})});}_0x20561f=_['merge']({},_0x20561f,_0x30ea52[_0x477e('0x3d')]);return _0x1fc230[_0x477e('0x4d')](_0x20561f);}})[_0x477e('0x20')](function(_0x3518bb){if(_0x3518bb){_0x50644f=_0x3518bb['length'];if(!_0x30ea52[_0x477e('0x2d')][_0x477e('0x34')]('nolimit')){_0x20561f['limit']=qs['limit'](_0x30ea52['query'][_0x477e('0x19')]);_0x20561f[_0x477e('0x17')]=qs[_0x477e('0x17')](_0x30ea52['query'][_0x477e('0x17')]);}return _0x1fc230[_0x477e('0x4d')](_0x20561f);}})[_0x477e('0x20')](function(_0x4deb3f){if(_0x4deb3f){return _0x4deb3f?{'count':_0x50644f,'rows':_0x4deb3f}:null;}})[_0x477e('0x20')](respondWithResult(_0x2dd731,null))['catch'](handleError(_0x2dd731,null));}; \ No newline at end of file +var _0xe593=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','ServicenowConfiguration','includeAll','include','then','rows','catch','show','params','find','create','body','getFields','order','pick','getSubjects','findOne','ServicenowField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','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','status'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xe593,0x13e));var _0x3e59=function(_0x9b4c9d,_0x471785){_0x9b4c9d=_0x9b4c9d-0x0;var _0x45423f=_0xe593[_0x9b4c9d];return _0x45423f;};'use strict';var emlformat=require(_0x3e59('0x0'));var rimraf=require(_0x3e59('0x1'));var zipdir=require(_0x3e59('0x2'));var jsonpatch=require(_0x3e59('0x3'));var rp=require(_0x3e59('0x4'));var moment=require(_0x3e59('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3e59('0x6'));var util=require(_0x3e59('0x7'));var path=require(_0x3e59('0x8'));var sox=require(_0x3e59('0x9'));var csv=require(_0x3e59('0xa'));var ejs=require(_0x3e59('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e59('0xc'));var squel=require('squel');var crypto=require(_0x3e59('0xd'));var jsforce=require(_0x3e59('0xe'));var deskjs=require(_0x3e59('0xf'));var toCsv=require(_0x3e59('0xa'));var querystring=require(_0x3e59('0x10'));var Papa=require(_0x3e59('0x11'));var Redis=require(_0x3e59('0x12'));var authService=require(_0x3e59('0x13'));var qs=require(_0x3e59('0x14'));var as=require(_0x3e59('0x15'));var hardwareService=require(_0x3e59('0x16'));var logger=require(_0x3e59('0x17'))(_0x3e59('0x18'));var utils=require('../../config/utils');var config=require(_0x3e59('0x19'));var licenseUtil=require(_0x3e59('0x1a'));var db=require(_0x3e59('0x1b'))['db'];function respondWithStatusCode(_0x358cca,_0x4fb447){_0x4fb447=_0x4fb447||0xcc;return function(_0x329c50){if(_0x329c50){return _0x358cca[_0x3e59('0x1c')](_0x4fb447);}return _0x358cca[_0x3e59('0x1d')](_0x4fb447)['end']();};}function respondWithResult(_0x192920,_0x5cdfb8){_0x5cdfb8=_0x5cdfb8||0xc8;return function(_0x10f4c8){if(_0x10f4c8){return _0x192920['status'](_0x5cdfb8)[_0x3e59('0x1e')](_0x10f4c8);}};}function respondWithFilteredResult(_0x5ccb07,_0x27851b){return function(_0xc55b6c){if(_0xc55b6c){var _0x3c7db0=typeof _0x27851b[_0x3e59('0x1f')]===_0x3e59('0x20')&&typeof _0x27851b[_0x3e59('0x21')]===_0x3e59('0x20');var _0x59182d=_0xc55b6c[_0x3e59('0x22')];var _0xe4cc3f=_0x3c7db0?0x0:_0x27851b[_0x3e59('0x1f')];var _0x376ee7=_0x3c7db0?_0xc55b6c[_0x3e59('0x22')]:_0x27851b[_0x3e59('0x1f')]+_0x27851b[_0x3e59('0x21')];var _0x464161;if(_0x376ee7>=_0x59182d){_0x376ee7=_0x59182d;_0x464161=0xc8;}else{_0x464161=0xce;}_0x5ccb07[_0x3e59('0x1d')](_0x464161);return _0x5ccb07[_0x3e59('0x23')](_0x3e59('0x24'),_0xe4cc3f+'-'+_0x376ee7+'/'+_0x59182d)['json'](_0xc55b6c);}return null;};}function patchUpdates(_0x5f2adf){return function(_0x1067cb){try{jsonpatch[_0x3e59('0x25')](_0x1067cb,_0x5f2adf,!![]);}catch(_0x465085){return BPromise[_0x3e59('0x26')](_0x465085);}return _0x1067cb[_0x3e59('0x27')]();};}function saveUpdates(_0x48e1c6,_0x34f00d){return function(_0x100cf1){if(_0x100cf1){return _0x100cf1[_0x3e59('0x28')](_0x48e1c6)['then'](function(_0x70bb76){return _0x70bb76;});}return null;};}function removeEntity(_0x3c226a,_0xdba5f1){return function(_0x9c23ac){if(_0x9c23ac){return _0x9c23ac[_0x3e59('0x29')]()['then'](function(){_0x3c226a[_0x3e59('0x1d')](0xcc)[_0x3e59('0x2a')]();});}};}function handleEntityNotFound(_0x584222,_0x42ede0){return function(_0x51d024){if(!_0x51d024){_0x584222[_0x3e59('0x1c')](0x194);}return _0x51d024;};}function handleError(_0x142628,_0x22b27e){_0x22b27e=_0x22b27e||0x1f4;return function(_0xa906d){logger[_0x3e59('0x2b')](_0xa906d[_0x3e59('0x2c')]);if(_0xa906d[_0x3e59('0x2d')]){delete _0xa906d[_0x3e59('0x2d')];}_0x142628[_0x3e59('0x1d')](_0x22b27e)[_0x3e59('0x2e')](_0xa906d);};}exports[_0x3e59('0x2f')]=function(_0x174bb6,_0x2d588b){var _0x1161c1={},_0x29bfe9={},_0x2eebee={'count':0x0,'rows':[]};var _0x4b0eed=_[_0x3e59('0x30')](db['ServicenowConfiguration'][_0x3e59('0x31')],function(_0x10b45d){return{'name':_0x10b45d[_0x3e59('0x32')],'type':_0x10b45d['type'][_0x3e59('0x33')]};});_0x29bfe9[_0x3e59('0x34')]=_[_0x3e59('0x30')](_0x4b0eed,_0x3e59('0x2d'));_0x29bfe9[_0x3e59('0x35')]=_[_0x3e59('0x36')](_0x174bb6[_0x3e59('0x35')]);_0x29bfe9[_0x3e59('0x37')]=_[_0x3e59('0x38')](_0x29bfe9[_0x3e59('0x34')],_0x29bfe9['query']);_0x1161c1[_0x3e59('0x39')]=_['intersection'](_0x29bfe9['model'],qs[_0x3e59('0x3a')](_0x174bb6[_0x3e59('0x35')][_0x3e59('0x3a')]));_0x1161c1[_0x3e59('0x39')]=_0x1161c1[_0x3e59('0x39')][_0x3e59('0x3b')]?_0x1161c1[_0x3e59('0x39')]:_0x29bfe9[_0x3e59('0x34')];if(!_0x174bb6[_0x3e59('0x35')][_0x3e59('0x3c')](_0x3e59('0x3d'))){_0x1161c1[_0x3e59('0x21')]=qs[_0x3e59('0x21')](_0x174bb6[_0x3e59('0x35')][_0x3e59('0x21')]);_0x1161c1[_0x3e59('0x1f')]=qs[_0x3e59('0x1f')](_0x174bb6['query'][_0x3e59('0x1f')]);}_0x1161c1['order']=qs[_0x3e59('0x3e')](_0x174bb6[_0x3e59('0x35')]['sort']);_0x1161c1[_0x3e59('0x3f')]=qs['filters'](_['pick'](_0x174bb6[_0x3e59('0x35')],_0x29bfe9[_0x3e59('0x37')]),_0x4b0eed);if(_0x174bb6[_0x3e59('0x35')][_0x3e59('0x40')]){_0x1161c1[_0x3e59('0x3f')]=_[_0x3e59('0x41')](_0x1161c1[_0x3e59('0x3f')],{'$or':_[_0x3e59('0x30')](_0x4b0eed,function(_0x551a3f){if(_0x551a3f[_0x3e59('0x42')]!==_0x3e59('0x43')){var _0x42107f={};_0x42107f[_0x551a3f[_0x3e59('0x2d')]]={'$like':'%'+_0x174bb6[_0x3e59('0x35')]['filter']+'%'};return _0x42107f;}})});}_0x1161c1=_[_0x3e59('0x41')]({},_0x1161c1,_0x174bb6[_0x3e59('0x44')]);var _0xde69cd={'where':_0x1161c1[_0x3e59('0x3f')]};return db[_0x3e59('0x45')][_0x3e59('0x22')](_0xde69cd)['then'](function(_0x20fab7){_0x2eebee['count']=_0x20fab7;if(_0x174bb6[_0x3e59('0x35')][_0x3e59('0x46')]){_0x1161c1[_0x3e59('0x47')]=[{'all':!![]}];}return db[_0x3e59('0x45')]['findAll'](_0x1161c1);})[_0x3e59('0x48')](function(_0x326efb){_0x2eebee[_0x3e59('0x49')]=_0x326efb;return _0x2eebee;})['then'](respondWithFilteredResult(_0x2d588b,_0x1161c1))[_0x3e59('0x4a')](handleError(_0x2d588b,null));};exports[_0x3e59('0x4b')]=function(_0x55a637,_0xa47b89){var _0x552161={'raw':![],'where':{'id':_0x55a637[_0x3e59('0x4c')]['id']}},_0x7cc9af={};_0x7cc9af[_0x3e59('0x34')]=_[_0x3e59('0x36')](db[_0x3e59('0x45')][_0x3e59('0x31')]);_0x7cc9af[_0x3e59('0x35')]=_[_0x3e59('0x36')](_0x55a637['query']);_0x7cc9af['filters']=_[_0x3e59('0x38')](_0x7cc9af[_0x3e59('0x34')],_0x7cc9af[_0x3e59('0x35')]);_0x552161[_0x3e59('0x39')]=_[_0x3e59('0x38')](_0x7cc9af[_0x3e59('0x34')],qs[_0x3e59('0x3a')](_0x55a637[_0x3e59('0x35')][_0x3e59('0x3a')]));_0x552161[_0x3e59('0x39')]=_0x552161[_0x3e59('0x39')][_0x3e59('0x3b')]?_0x552161[_0x3e59('0x39')]:_0x7cc9af[_0x3e59('0x34')];if(_0x55a637[_0x3e59('0x35')][_0x3e59('0x46')]){_0x552161[_0x3e59('0x47')]=[{'all':!![]}];}_0x552161=_[_0x3e59('0x41')]({},_0x552161,_0x55a637[_0x3e59('0x44')]);return db[_0x3e59('0x45')][_0x3e59('0x4d')](_0x552161)['then'](handleEntityNotFound(_0xa47b89,null))[_0x3e59('0x48')](respondWithResult(_0xa47b89,null))['catch'](handleError(_0xa47b89,null));};exports[_0x3e59('0x4e')]=function(_0x1a825b,_0x425049){return db[_0x3e59('0x45')][_0x3e59('0x4e')](_0x1a825b[_0x3e59('0x4f')],{})['then'](respondWithResult(_0x425049,0xc9))[_0x3e59('0x4a')](handleError(_0x425049,null));};exports[_0x3e59('0x28')]=function(_0x566534,_0x5ca961){if(_0x566534[_0x3e59('0x4f')]['id']){delete _0x566534['body']['id'];}return db[_0x3e59('0x45')][_0x3e59('0x4d')]({'where':{'id':_0x566534[_0x3e59('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5ca961,null))[_0x3e59('0x48')](saveUpdates(_0x566534['body'],null))[_0x3e59('0x48')](respondWithResult(_0x5ca961,null))['catch'](handleError(_0x5ca961,null));};exports[_0x3e59('0x29')]=function(_0xf1bb41,_0x56cf19){return db[_0x3e59('0x45')][_0x3e59('0x4d')]({'where':{'id':_0xf1bb41[_0x3e59('0x4c')]['id']}})[_0x3e59('0x48')](handleEntityNotFound(_0x56cf19,null))[_0x3e59('0x48')](removeEntity(_0x56cf19,null))[_0x3e59('0x4a')](handleError(_0x56cf19,null));};exports[_0x3e59('0x50')]=function(_0xe9b395,_0xa99e38,_0x7ad029){var _0x1dc7fc={};var _0xbbd187={};var _0x2739c0;var _0x4a4b5e;return db[_0x3e59('0x45')]['findOne']({'where':{'id':_0xe9b395[_0x3e59('0x4c')]['id']}})[_0x3e59('0x48')](handleEntityNotFound(_0xa99e38,null))[_0x3e59('0x48')](function(_0x1cea5f){if(_0x1cea5f){_0x2739c0=_0x1cea5f;_0xbbd187['model']=_[_0x3e59('0x36')](db['ServicenowField']['rawAttributes']);_0xbbd187[_0x3e59('0x35')]=_[_0x3e59('0x36')](_0xe9b395['query']);_0xbbd187[_0x3e59('0x37')]=_['intersection'](_0xbbd187['model'],_0xbbd187['query']);_0x1dc7fc[_0x3e59('0x39')]=_[_0x3e59('0x38')](_0xbbd187[_0x3e59('0x34')],qs[_0x3e59('0x3a')](_0xe9b395[_0x3e59('0x35')][_0x3e59('0x3a')]));_0x1dc7fc[_0x3e59('0x39')]=_0x1dc7fc[_0x3e59('0x39')][_0x3e59('0x3b')]?_0x1dc7fc[_0x3e59('0x39')]:_0xbbd187[_0x3e59('0x34')];_0x1dc7fc[_0x3e59('0x51')]=qs[_0x3e59('0x3e')](_0xe9b395[_0x3e59('0x35')][_0x3e59('0x3e')]);_0x1dc7fc[_0x3e59('0x3f')]=qs[_0x3e59('0x37')](_[_0x3e59('0x52')](_0xe9b395[_0x3e59('0x35')],_0xbbd187[_0x3e59('0x37')]));if(_0xe9b395[_0x3e59('0x35')][_0x3e59('0x40')]){_0x1dc7fc[_0x3e59('0x3f')]=_[_0x3e59('0x41')](_0x1dc7fc[_0x3e59('0x3f')],{'$or':_[_0x3e59('0x30')](_0x1dc7fc[_0x3e59('0x39')],function(_0x4c9331){var _0x328cf9={};_0x328cf9[_0x4c9331]={'$like':'%'+_0xe9b395['query'][_0x3e59('0x40')]+'%'};return _0x328cf9;})});}_0x1dc7fc=_[_0x3e59('0x41')]({},_0x1dc7fc,_0xe9b395['options']);return _0x2739c0[_0x3e59('0x50')](_0x1dc7fc);}})[_0x3e59('0x48')](function(_0x5d3a59){if(_0x5d3a59){_0x4a4b5e=_0x5d3a59[_0x3e59('0x3b')];if(!_0xe9b395[_0x3e59('0x35')][_0x3e59('0x3c')](_0x3e59('0x3d'))){_0x1dc7fc[_0x3e59('0x21')]=qs[_0x3e59('0x21')](_0xe9b395['query'][_0x3e59('0x21')]);_0x1dc7fc[_0x3e59('0x1f')]=qs['offset'](_0xe9b395[_0x3e59('0x35')][_0x3e59('0x1f')]);}return _0x2739c0[_0x3e59('0x50')](_0x1dc7fc);}})[_0x3e59('0x48')](function(_0x3dd2b3){if(_0x3dd2b3){return _0x3dd2b3?{'count':_0x4a4b5e,'rows':_0x3dd2b3}:null;}})[_0x3e59('0x48')](respondWithResult(_0xa99e38,null))[_0x3e59('0x4a')](handleError(_0xa99e38,null));};exports[_0x3e59('0x53')]=function(_0xf59f58,_0x3eb7d3,_0x334663){var _0x55f717={};var _0x2d9106={};var _0x1122b2;var _0x509a42;return db[_0x3e59('0x45')][_0x3e59('0x54')]({'where':{'id':_0xf59f58[_0x3e59('0x4c')]['id']}})[_0x3e59('0x48')](handleEntityNotFound(_0x3eb7d3,null))[_0x3e59('0x48')](function(_0x5593c6){if(_0x5593c6){_0x1122b2=_0x5593c6;_0x2d9106[_0x3e59('0x34')]=_[_0x3e59('0x36')](db[_0x3e59('0x55')][_0x3e59('0x31')]);_0x2d9106[_0x3e59('0x35')]=_['keys'](_0xf59f58['query']);_0x2d9106[_0x3e59('0x37')]=_[_0x3e59('0x38')](_0x2d9106[_0x3e59('0x34')],_0x2d9106[_0x3e59('0x35')]);_0x55f717[_0x3e59('0x39')]=_[_0x3e59('0x38')](_0x2d9106['model'],qs[_0x3e59('0x3a')](_0xf59f58[_0x3e59('0x35')][_0x3e59('0x3a')]));_0x55f717[_0x3e59('0x39')]=_0x55f717[_0x3e59('0x39')]['length']?_0x55f717['attributes']:_0x2d9106[_0x3e59('0x34')];_0x55f717[_0x3e59('0x51')]=qs[_0x3e59('0x3e')](_0xf59f58['query']['sort']);_0x55f717[_0x3e59('0x3f')]=qs['filters'](_[_0x3e59('0x52')](_0xf59f58['query'],_0x2d9106[_0x3e59('0x37')]));if(_0xf59f58[_0x3e59('0x35')]['filter']){_0x55f717[_0x3e59('0x3f')]=_[_0x3e59('0x41')](_0x55f717[_0x3e59('0x3f')],{'$or':_[_0x3e59('0x30')](_0x55f717[_0x3e59('0x39')],function(_0x34fddc){var _0x4a9404={};_0x4a9404[_0x34fddc]={'$like':'%'+_0xf59f58[_0x3e59('0x35')][_0x3e59('0x40')]+'%'};return _0x4a9404;})});}_0x55f717=_['merge']({},_0x55f717,_0xf59f58[_0x3e59('0x44')]);return _0x1122b2[_0x3e59('0x53')](_0x55f717);}})[_0x3e59('0x48')](function(_0x185afd){if(_0x185afd){_0x509a42=_0x185afd[_0x3e59('0x3b')];if(!_0xf59f58['query']['hasOwnProperty'](_0x3e59('0x3d'))){_0x55f717[_0x3e59('0x21')]=qs[_0x3e59('0x21')](_0xf59f58['query'][_0x3e59('0x21')]);_0x55f717[_0x3e59('0x1f')]=qs[_0x3e59('0x1f')](_0xf59f58[_0x3e59('0x35')][_0x3e59('0x1f')]);}return _0x1122b2[_0x3e59('0x53')](_0x55f717);}})[_0x3e59('0x48')](function(_0x8a1a67){if(_0x8a1a67){return _0x8a1a67?{'count':_0x509a42,'rows':_0x8a1a67}:null;}})[_0x3e59('0x48')](respondWithResult(_0x3eb7d3,null))['catch'](handleError(_0x3eb7d3,null));};exports[_0x3e59('0x56')]=function(_0x3accf7,_0x217672,_0x280edf){var _0x20f5d0={};var _0x12f874={};var _0x2475a3;var _0x55c450;return db[_0x3e59('0x45')][_0x3e59('0x54')]({'where':{'id':_0x3accf7[_0x3e59('0x4c')]['id']}})[_0x3e59('0x48')](handleEntityNotFound(_0x217672,null))[_0x3e59('0x48')](function(_0x420110){if(_0x420110){_0x2475a3=_0x420110;_0x12f874[_0x3e59('0x34')]=_[_0x3e59('0x36')](db['ServicenowField']['rawAttributes']);_0x12f874[_0x3e59('0x35')]=_[_0x3e59('0x36')](_0x3accf7[_0x3e59('0x35')]);_0x12f874[_0x3e59('0x37')]=_[_0x3e59('0x38')](_0x12f874[_0x3e59('0x34')],_0x12f874['query']);_0x20f5d0[_0x3e59('0x39')]=_[_0x3e59('0x38')](_0x12f874[_0x3e59('0x34')],qs['fields'](_0x3accf7['query'][_0x3e59('0x3a')]));_0x20f5d0[_0x3e59('0x39')]=_0x20f5d0[_0x3e59('0x39')]['length']?_0x20f5d0[_0x3e59('0x39')]:_0x12f874[_0x3e59('0x34')];_0x20f5d0[_0x3e59('0x51')]=qs[_0x3e59('0x3e')](_0x3accf7[_0x3e59('0x35')][_0x3e59('0x3e')]);_0x20f5d0[_0x3e59('0x3f')]=qs['filters'](_[_0x3e59('0x52')](_0x3accf7[_0x3e59('0x35')],_0x12f874[_0x3e59('0x37')]));if(_0x3accf7[_0x3e59('0x35')][_0x3e59('0x40')]){_0x20f5d0[_0x3e59('0x3f')]=_[_0x3e59('0x41')](_0x20f5d0[_0x3e59('0x3f')],{'$or':_[_0x3e59('0x30')](_0x20f5d0[_0x3e59('0x39')],function(_0x402e36){var _0x1f5f12={};_0x1f5f12[_0x402e36]={'$like':'%'+_0x3accf7[_0x3e59('0x35')][_0x3e59('0x40')]+'%'};return _0x1f5f12;})});}_0x20f5d0=_['merge']({},_0x20f5d0,_0x3accf7[_0x3e59('0x44')]);return _0x2475a3[_0x3e59('0x56')](_0x20f5d0);}})[_0x3e59('0x48')](function(_0x38073e){if(_0x38073e){_0x55c450=_0x38073e[_0x3e59('0x3b')];if(!_0x3accf7[_0x3e59('0x35')][_0x3e59('0x3c')](_0x3e59('0x3d'))){_0x20f5d0[_0x3e59('0x21')]=qs[_0x3e59('0x21')](_0x3accf7[_0x3e59('0x35')][_0x3e59('0x21')]);_0x20f5d0['offset']=qs[_0x3e59('0x1f')](_0x3accf7['query'][_0x3e59('0x1f')]);}return _0x2475a3['getDescriptions'](_0x20f5d0);}})['then'](function(_0x5644be){if(_0x5644be){return _0x5644be?{'count':_0x55c450,'rows':_0x5644be}:null;}})[_0x3e59('0x48')](respondWithResult(_0x217672,null))[_0x3e59('0x4a')](handleError(_0x217672,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 726e3c2..5269f62 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 _0x6836=['../../config/logger','moment','request-promise','rimraf','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util'];(function(_0x84ac92,_0x463eda){var _0x1539d5=function(_0xb0b93){while(--_0xb0b93){_0x84ac92['push'](_0x84ac92['shift']());}};_0x1539d5(++_0x463eda);}(_0x6836,0x1c0));var _0x6683=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x6836[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x6683('0x0'));var util=require(_0x6683('0x1'));var logger=require(_0x6683('0x2'))('api');var moment=require(_0x6683('0x3'));var BPromise=require('bluebird');var rp=require(_0x6683('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6683('0x5'));var config=require('../../config/environment');var attributes=require(_0x6683('0x6'));module[_0x6683('0x7')]=function(_0xd59091,_0x452f17){return _0xd59091['define'](_0x6683('0x8'),attributes,{'tableName':_0x6683('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b1a=['ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0xf9728a,_0x103ce6){var _0x1cba2b=function(_0x58b092){while(--_0x58b092){_0xf9728a['push'](_0xf9728a['shift']());}};_0x1cba2b(++_0x103ce6);}(_0x8b1a,0x152));var _0xa8b1=function(_0x2c3fe4,_0x5f3010){_0x2c3fe4=_0x2c3fe4-0x0;var _0xf8df96=_0x8b1a[_0x2c3fe4];return _0xf8df96;};'use strict';var _=require(_0xa8b1('0x0'));var util=require(_0xa8b1('0x1'));var logger=require(_0xa8b1('0x2'))('api');var moment=require(_0xa8b1('0x3'));var BPromise=require(_0xa8b1('0x4'));var rp=require(_0xa8b1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa8b1('0x6'));var config=require(_0xa8b1('0x7'));var attributes=require(_0xa8b1('0x8'));module[_0xa8b1('0x9')]=function(_0x493b8e,_0x90c588){return _0x493b8e['define'](_0xa8b1('0xa'),attributes,{'tableName':_0xa8b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index d070f82..51d02df 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 _0x3b6a=['ServicenowConfiguration,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x456a4b,_0x51df8){var _0x42957c=function(_0x431de8){while(--_0x431de8){_0x456a4b['push'](_0x456a4b['shift']());}};_0x42957c(++_0x51df8);}(_0x3b6a,0x19f));var _0xa3b6=function(_0xbc25e1,_0x27007d){_0xbc25e1=_0xbc25e1-0x0;var _0xaf0a85=_0x3b6a[_0xbc25e1];return _0xaf0a85;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa3b6('0x0'));var rs=require(_0xa3b6('0x1'));var fs=require('fs');var Redis=require(_0xa3b6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa3b6('0x3'));var logger=require(_0xa3b6('0x4'))(_0xa3b6('0x5'));var config=require(_0xa3b6('0x6'));var jayson=require(_0xa3b6('0x7'));var client=jayson['client'][_0xa3b6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8e72ec,_0x242518,_0x3a5bba){return new BPromise(function(_0x7addd6,_0x475b07){return client[_0xa3b6('0x9')](_0x8e72ec,_0x3a5bba)['then'](function(_0x20a67e){logger['info'](_0xa3b6('0xa'),_0x242518,'request\x20sent');logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x242518,'request\x20sent',JSON[_0xa3b6('0xb')](_0x20a67e));if(_0x20a67e[_0xa3b6('0xc')]){if(_0x20a67e['error']['code']===0x1f4){logger[_0xa3b6('0xc')](_0xa3b6('0xa'),_0x242518,_0x20a67e[_0xa3b6('0xc')][_0xa3b6('0xd')]);return _0x475b07(_0x20a67e[_0xa3b6('0xc')][_0xa3b6('0xd')]);}logger[_0xa3b6('0xc')](_0xa3b6('0xa'),_0x242518,_0x20a67e[_0xa3b6('0xc')]['message']);return _0x7addd6(_0x20a67e[_0xa3b6('0xc')][_0xa3b6('0xd')]);}else{logger[_0xa3b6('0xe')](_0xa3b6('0xa'),_0x242518,_0xa3b6('0xf'));_0x7addd6(_0x20a67e[_0xa3b6('0x10')][_0xa3b6('0xd')]);}})['catch'](function(_0x5ab38f){logger[_0xa3b6('0xc')](_0xa3b6('0xa'),_0x242518,_0x5ab38f);_0x475b07(_0x5ab38f);});});} \ No newline at end of file +var _0x119f=['moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util'];(function(_0x140e4f,_0x3d1020){var _0x2ff817=function(_0x51d75f){while(--_0x51d75f){_0x140e4f['push'](_0x140e4f['shift']());}};_0x2ff817(++_0x3d1020);}(_0x119f,0xf5));var _0xf119=function(_0x47af19,_0xfcb72b){_0x47af19=_0x47af19-0x0;var _0x406952=_0x119f[_0x47af19];return _0x406952;};'use strict';var _=require(_0xf119('0x0'));var util=require(_0xf119('0x1'));var moment=require(_0xf119('0x2'));var BPromise=require(_0xf119('0x3'));var rs=require(_0xf119('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf119('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf119('0x6'));var config=require('../../config/environment');var jayson=require(_0xf119('0x7'));var client=jayson['client'][_0xf119('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ea7e0,_0x341997,_0x38fef6){return new BPromise(function(_0x149e1a,_0x4c2a12){return client[_0xf119('0x9')](_0x5ea7e0,_0x38fef6)['then'](function(_0x208206){logger[_0xf119('0xa')](_0xf119('0xb'),_0x341997,_0xf119('0xc'));logger[_0xf119('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x341997,_0xf119('0xc'),JSON['stringify'](_0x208206));if(_0x208206[_0xf119('0xe')]){if(_0x208206[_0xf119('0xe')][_0xf119('0xf')]===0x1f4){logger[_0xf119('0xe')](_0xf119('0xb'),_0x341997,_0x208206[_0xf119('0xe')][_0xf119('0x10')]);return _0x4c2a12(_0x208206['error'][_0xf119('0x10')]);}logger[_0xf119('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x341997,_0x208206[_0xf119('0xe')][_0xf119('0x10')]);return _0x149e1a(_0x208206['error'][_0xf119('0x10')]);}else{logger[_0xf119('0xa')](_0xf119('0xb'),_0x341997,_0xf119('0xc'));_0x149e1a(_0x208206[_0xf119('0x11')][_0xf119('0x10')]);}})[_0xf119('0x12')](function(_0x22a8b3){logger['error'](_0xf119('0xb'),_0x341997,_0x22a8b3);_0x4c2a12(_0x22a8b3);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index c4ca60a..4029307 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 _0x5a9c=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x48d7aa,_0x52349c){var _0x138fc6=function(_0x273dd9){while(--_0x273dd9){_0x48d7aa['push'](_0x48d7aa['shift']());}};_0x138fc6(++_0x52349c);}(_0x5a9c,0x16b));var _0xc5a9=function(_0x1ce600,_0x213e42){_0x1ce600=_0x1ce600-0x0;var _0x26e0eb=_0x5a9c[_0x1ce600];return _0x26e0eb;};'use strict';var multer=require(_0xc5a9('0x0'));var util=require('util');var path=require(_0xc5a9('0x1'));var timeout=require(_0xc5a9('0x2'));var express=require(_0xc5a9('0x3'));var router=express[_0xc5a9('0x4')]();var fs_extra=require(_0xc5a9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc5a9('0x6'));var controller=require(_0xc5a9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc5a9('0x8')]);router[_0xc5a9('0x9')](_0xc5a9('0xa'),auth[_0xc5a9('0xb')](),controller[_0xc5a9('0xc')]);router[_0xc5a9('0xd')]('/',auth[_0xc5a9('0xb')](),controller[_0xc5a9('0xe')]);router[_0xc5a9('0xf')](_0xc5a9('0xa'),auth[_0xc5a9('0xb')](),controller[_0xc5a9('0x10')]);router[_0xc5a9('0x11')](_0xc5a9('0xa'),auth[_0xc5a9('0xb')](),controller['destroy']);module[_0xc5a9('0x12')]=router; \ No newline at end of file +var _0xbddc=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller'];(function(_0x1dcde7,_0x2fcb37){var _0x1393a4=function(_0x165564){while(--_0x165564){_0x1dcde7['push'](_0x1dcde7['shift']());}};_0x1393a4(++_0x2fcb37);}(_0xbddc,0xd3));var _0xcbdd=function(_0x590952,_0x588a22){_0x590952=_0x590952-0x0;var _0x34ff69=_0xbddc[_0x590952];return _0x34ff69;};'use strict';var multer=require(_0xcbdd('0x0'));var util=require(_0xcbdd('0x1'));var path=require(_0xcbdd('0x2'));var timeout=require('connect-timeout');var express=require(_0xcbdd('0x3'));var router=express[_0xcbdd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcbdd('0x5'));var interaction=require(_0xcbdd('0x6'));var config=require(_0xcbdd('0x7'));var controller=require(_0xcbdd('0x8'));router[_0xcbdd('0x9')]('/',auth[_0xcbdd('0xa')](),controller[_0xcbdd('0xb')]);router[_0xcbdd('0x9')](_0xcbdd('0xc'),auth[_0xcbdd('0xa')](),controller[_0xcbdd('0xd')]);router[_0xcbdd('0xe')]('/',auth[_0xcbdd('0xa')](),controller[_0xcbdd('0xf')]);router[_0xcbdd('0x10')](_0xcbdd('0xc'),auth[_0xcbdd('0xa')](),controller[_0xcbdd('0x11')]);router[_0xcbdd('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xcbdd('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 0597086..85938e6 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 _0x3a2e=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x1895ce,_0x81e9b2){var _0x4c3c7f=function(_0x2e4d0b){while(--_0x2e4d0b){_0x1895ce['push'](_0x1895ce['shift']());}};_0x4c3c7f(++_0x81e9b2);}(_0x3a2e,0x13c));var _0xe3a2=function(_0x2c1d30,_0x112879){_0x2c1d30=_0x2c1d30-0x0;var _0x248774=_0x3a2e[_0x2c1d30];return _0x248774;};'use strict';var Sequelize=require(_0xe3a2('0x0'));module[_0xe3a2('0x1')]={'type':{'type':Sequelize[_0xe3a2('0x2')](_0xe3a2('0x3'),_0xe3a2('0x4'),_0xe3a2('0x5'),_0xe3a2('0x6'),_0xe3a2('0x7')),'defaultValue':_0xe3a2('0x3')},'content':{'type':Sequelize[_0xe3a2('0x8')]},'key':{'type':Sequelize[_0xe3a2('0x8')]},'keyType':{'type':Sequelize[_0xe3a2('0x2')](_0xe3a2('0x3'),'variable',_0xe3a2('0x5'))},'keyContent':{'type':Sequelize[_0xe3a2('0x8')]},'idField':{'type':Sequelize[_0xe3a2('0x8')]},'nameField':{'type':Sequelize[_0xe3a2('0x8')]},'customField':{'type':Sequelize[_0xe3a2('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe3a2('0x8')]}}; \ No newline at end of file +var _0xbcdb=['sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0xad9879,_0x2b32bb){var _0x641ac4=function(_0x4a39bf){while(--_0x4a39bf){_0xad9879['push'](_0xad9879['shift']());}};_0x641ac4(++_0x2b32bb);}(_0xbcdb,0x15f));var _0xbbcd=function(_0x10f8e4,_0x286e2c){_0x10f8e4=_0x10f8e4-0x0;var _0x1d55bd=_0xbcdb[_0x10f8e4];return _0x1d55bd;};'use strict';var Sequelize=require(_0xbbcd('0x0'));module['exports']={'type':{'type':Sequelize[_0xbbcd('0x1')](_0xbbcd('0x2'),_0xbbcd('0x3'),_0xbbcd('0x4'),_0xbbcd('0x5'),_0xbbcd('0x6')),'defaultValue':_0xbbcd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xbbcd('0x7')]},'keyType':{'type':Sequelize[_0xbbcd('0x1')](_0xbbcd('0x2'),_0xbbcd('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xbbcd('0x7')]},'idField':{'type':Sequelize[_0xbbcd('0x7')]},'nameField':{'type':Sequelize[_0xbbcd('0x7')]},'customField':{'type':Sequelize[_0xbbcd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbbcd('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 1a2663a..355bc81 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 _0xe156=['model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','create','body','update','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','save','then','end','stack','name','send','index','ServicenowField','rawAttributes','fieldName','key'];(function(_0x2c388e,_0x514959){var _0x5f4540=function(_0x195273){while(--_0x195273){_0x2c388e['push'](_0x2c388e['shift']());}};_0x5f4540(++_0x514959);}(_0xe156,0x1e6));var _0x6e15=function(_0x2998db,_0x3424f1){_0x2998db=_0x2998db-0x0;var _0x115fea=_0xe156[_0x2998db];return _0x115fea;};'use strict';var emlformat=require(_0x6e15('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e15('0x1'));var jsonpatch=require(_0x6e15('0x2'));var rp=require(_0x6e15('0x3'));var moment=require(_0x6e15('0x4'));var BPromise=require(_0x6e15('0x5'));var Mustache=require(_0x6e15('0x6'));var util=require(_0x6e15('0x7'));var path=require('path');var sox=require(_0x6e15('0x8'));var csv=require(_0x6e15('0x9'));var ejs=require(_0x6e15('0xa'));var fs=require('fs');var fs_extra=require(_0x6e15('0xb'));var _=require('lodash');var squel=require(_0x6e15('0xc'));var crypto=require(_0x6e15('0xd'));var jsforce=require(_0x6e15('0xe'));var deskjs=require(_0x6e15('0xf'));var toCsv=require(_0x6e15('0x9'));var querystring=require('querystring');var Papa=require(_0x6e15('0x10'));var Redis=require(_0x6e15('0x11'));var authService=require(_0x6e15('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6e15('0x13'));var hardwareService=require(_0x6e15('0x14'));var logger=require(_0x6e15('0x15'))(_0x6e15('0x16'));var utils=require('../../config/utils');var config=require(_0x6e15('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6e15('0x18'))['db'];function respondWithStatusCode(_0x328f7a,_0x24c3d4){_0x24c3d4=_0x24c3d4||0xcc;return function(_0xd7c8e3){if(_0xd7c8e3){return _0x328f7a[_0x6e15('0x19')](_0x24c3d4);}return _0x328f7a['status'](_0x24c3d4)['end']();};}function respondWithResult(_0x22eff2,_0x4e6f5a){_0x4e6f5a=_0x4e6f5a||0xc8;return function(_0x108557){if(_0x108557){return _0x22eff2[_0x6e15('0x1a')](_0x4e6f5a)[_0x6e15('0x1b')](_0x108557);}};}function respondWithFilteredResult(_0x37bd7f,_0x183bd2){return function(_0x3d17ff){if(_0x3d17ff){var _0x52c1bc=typeof _0x183bd2['offset']==='undefined'&&typeof _0x183bd2['limit']===_0x6e15('0x1c');var _0x124e3a=_0x3d17ff[_0x6e15('0x1d')];var _0x5d8c9c=_0x52c1bc?0x0:_0x183bd2[_0x6e15('0x1e')];var _0x1b48d0=_0x52c1bc?_0x3d17ff[_0x6e15('0x1d')]:_0x183bd2[_0x6e15('0x1e')]+_0x183bd2[_0x6e15('0x1f')];var _0x567d0f;if(_0x1b48d0>=_0x124e3a){_0x1b48d0=_0x124e3a;_0x567d0f=0xc8;}else{_0x567d0f=0xce;}_0x37bd7f[_0x6e15('0x1a')](_0x567d0f);return _0x37bd7f[_0x6e15('0x20')]('Content-Range',_0x5d8c9c+'-'+_0x1b48d0+'/'+_0x124e3a)[_0x6e15('0x1b')](_0x3d17ff);}return null;};}function patchUpdates(_0x1f4e83){return function(_0x556975){try{jsonpatch[_0x6e15('0x21')](_0x556975,_0x1f4e83,!![]);}catch(_0x23407a){return BPromise[_0x6e15('0x22')](_0x23407a);}return _0x556975[_0x6e15('0x23')]();};}function saveUpdates(_0x625da9,_0x366552){return function(_0x183cfe){if(_0x183cfe){return _0x183cfe['update'](_0x625da9)[_0x6e15('0x24')](function(_0x3da1d5){return _0x3da1d5;});}return null;};}function removeEntity(_0x143b26,_0x43545f){return function(_0x34bf9e){if(_0x34bf9e){return _0x34bf9e['destroy']()[_0x6e15('0x24')](function(){_0x143b26[_0x6e15('0x1a')](0xcc)[_0x6e15('0x25')]();});}};}function handleEntityNotFound(_0x45d5c0,_0x5179ad){return function(_0x44c582){if(!_0x44c582){_0x45d5c0[_0x6e15('0x19')](0x194);}return _0x44c582;};}function handleError(_0x409159,_0x5756d2){_0x5756d2=_0x5756d2||0x1f4;return function(_0x54c274){logger['error'](_0x54c274[_0x6e15('0x26')]);if(_0x54c274[_0x6e15('0x27')]){delete _0x54c274[_0x6e15('0x27')];}_0x409159[_0x6e15('0x1a')](_0x5756d2)[_0x6e15('0x28')](_0x54c274);};}exports[_0x6e15('0x29')]=function(_0x2b25ed,_0x250c2a){var _0xa6e430={},_0x38c78e={},_0x9b07b5={'count':0x0,'rows':[]};var _0x412600=_['map'](db[_0x6e15('0x2a')][_0x6e15('0x2b')],function(_0x52bd57){return{'name':_0x52bd57[_0x6e15('0x2c')],'type':_0x52bd57['type'][_0x6e15('0x2d')]};});_0x38c78e[_0x6e15('0x2e')]=_[_0x6e15('0x2f')](_0x412600,_0x6e15('0x27'));_0x38c78e[_0x6e15('0x30')]=_[_0x6e15('0x31')](_0x2b25ed[_0x6e15('0x30')]);_0x38c78e[_0x6e15('0x32')]=_[_0x6e15('0x33')](_0x38c78e[_0x6e15('0x2e')],_0x38c78e['query']);_0xa6e430['attributes']=_['intersection'](_0x38c78e[_0x6e15('0x2e')],qs[_0x6e15('0x34')](_0x2b25ed[_0x6e15('0x30')][_0x6e15('0x34')]));_0xa6e430[_0x6e15('0x35')]=_0xa6e430[_0x6e15('0x35')][_0x6e15('0x36')]?_0xa6e430[_0x6e15('0x35')]:_0x38c78e[_0x6e15('0x2e')];if(!_0x2b25ed[_0x6e15('0x30')][_0x6e15('0x37')](_0x6e15('0x38'))){_0xa6e430[_0x6e15('0x1f')]=qs[_0x6e15('0x1f')](_0x2b25ed['query'][_0x6e15('0x1f')]);_0xa6e430[_0x6e15('0x1e')]=qs[_0x6e15('0x1e')](_0x2b25ed[_0x6e15('0x30')][_0x6e15('0x1e')]);}_0xa6e430[_0x6e15('0x39')]=qs[_0x6e15('0x3a')](_0x2b25ed[_0x6e15('0x30')][_0x6e15('0x3a')]);_0xa6e430['where']=qs['filters'](_[_0x6e15('0x3b')](_0x2b25ed[_0x6e15('0x30')],_0x38c78e[_0x6e15('0x32')]),_0x412600);if(_0x2b25ed['query'][_0x6e15('0x3c')]){_0xa6e430[_0x6e15('0x3d')]=_['merge'](_0xa6e430[_0x6e15('0x3d')],{'$or':_[_0x6e15('0x2f')](_0x412600,function(_0x1285b3){if(_0x1285b3[_0x6e15('0x3e')]!==_0x6e15('0x3f')){var _0x3625df={};_0x3625df[_0x1285b3['name']]={'$like':'%'+_0x2b25ed[_0x6e15('0x30')][_0x6e15('0x3c')]+'%'};return _0x3625df;}})});}_0xa6e430=_[_0x6e15('0x40')]({},_0xa6e430,_0x2b25ed[_0x6e15('0x41')]);var _0x15763b={'where':_0xa6e430[_0x6e15('0x3d')]};return db['ServicenowField']['count'](_0x15763b)[_0x6e15('0x24')](function(_0x2d9796){_0x9b07b5[_0x6e15('0x1d')]=_0x2d9796;if(_0x2b25ed[_0x6e15('0x30')][_0x6e15('0x42')]){_0xa6e430[_0x6e15('0x43')]=[{'all':!![]}];}return db[_0x6e15('0x2a')][_0x6e15('0x44')](_0xa6e430);})[_0x6e15('0x24')](function(_0x9f112a){_0x9b07b5['rows']=_0x9f112a;return _0x9b07b5;})['then'](respondWithFilteredResult(_0x250c2a,_0xa6e430))[_0x6e15('0x45')](handleError(_0x250c2a,null));};exports[_0x6e15('0x46')]=function(_0x5e8ee0,_0x548289){var _0x48158b={'raw':!![],'where':{'id':_0x5e8ee0[_0x6e15('0x47')]['id']}},_0x384046={};_0x384046[_0x6e15('0x2e')]=_[_0x6e15('0x31')](db[_0x6e15('0x2a')][_0x6e15('0x2b')]);_0x384046[_0x6e15('0x30')]=_[_0x6e15('0x31')](_0x5e8ee0[_0x6e15('0x30')]);_0x384046[_0x6e15('0x32')]=_['intersection'](_0x384046[_0x6e15('0x2e')],_0x384046[_0x6e15('0x30')]);_0x48158b[_0x6e15('0x35')]=_[_0x6e15('0x33')](_0x384046[_0x6e15('0x2e')],qs['fields'](_0x5e8ee0['query']['fields']));_0x48158b[_0x6e15('0x35')]=_0x48158b[_0x6e15('0x35')][_0x6e15('0x36')]?_0x48158b[_0x6e15('0x35')]:_0x384046[_0x6e15('0x2e')];if(_0x5e8ee0['query'][_0x6e15('0x42')]){_0x48158b['include']=[{'all':!![]}];}_0x48158b=_[_0x6e15('0x40')]({},_0x48158b,_0x5e8ee0[_0x6e15('0x41')]);return db[_0x6e15('0x2a')]['find'](_0x48158b)[_0x6e15('0x24')](handleEntityNotFound(_0x548289,null))[_0x6e15('0x24')](respondWithResult(_0x548289,null))[_0x6e15('0x45')](handleError(_0x548289,null));};exports[_0x6e15('0x48')]=function(_0x361170,_0x2bd3b4){return db[_0x6e15('0x2a')]['create'](_0x361170[_0x6e15('0x49')],{})[_0x6e15('0x24')](respondWithResult(_0x2bd3b4,0xc9))[_0x6e15('0x45')](handleError(_0x2bd3b4,null));};exports[_0x6e15('0x4a')]=function(_0x344752,_0x5c12e9){if(_0x344752['body']['id']){delete _0x344752[_0x6e15('0x49')]['id'];}return db[_0x6e15('0x2a')][_0x6e15('0x4b')]({'where':{'id':_0x344752['params']['id']}})[_0x6e15('0x24')](handleEntityNotFound(_0x5c12e9,null))['then'](saveUpdates(_0x344752['body'],null))[_0x6e15('0x24')](respondWithResult(_0x5c12e9,null))[_0x6e15('0x45')](handleError(_0x5c12e9,null));};exports['destroy']=function(_0x5e2286,_0x3f9dca){return db[_0x6e15('0x2a')]['find']({'where':{'id':_0x5e2286[_0x6e15('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f9dca,null))['then'](removeEntity(_0x3f9dca,null))[_0x6e15('0x45')](handleError(_0x3f9dca,null));}; \ No newline at end of file +var _0x684c=['json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','ServicenowField','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','include','merge','find','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x368501,_0x3c650e){var _0x24c18f=function(_0x659ce2){while(--_0x659ce2){_0x368501['push'](_0x368501['shift']());}};_0x24c18f(++_0x3c650e);}(_0x684c,0x1d6));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc684('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc684('0x1'));var rp=require(_0xc684('0x2'));var moment=require(_0xc684('0x3'));var BPromise=require(_0xc684('0x4'));var Mustache=require(_0xc684('0x5'));var util=require(_0xc684('0x6'));var path=require(_0xc684('0x7'));var sox=require(_0xc684('0x8'));var csv=require('to-csv');var ejs=require(_0xc684('0x9'));var fs=require('fs');var fs_extra=require(_0xc684('0xa'));var _=require(_0xc684('0xb'));var squel=require('squel');var crypto=require(_0xc684('0xc'));var jsforce=require(_0xc684('0xd'));var deskjs=require(_0xc684('0xe'));var toCsv=require(_0xc684('0xf'));var querystring=require(_0xc684('0x10'));var Papa=require(_0xc684('0x11'));var Redis=require(_0xc684('0x12'));var authService=require(_0xc684('0x13'));var qs=require(_0xc684('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc684('0x15'));var logger=require('../../config/logger')(_0xc684('0x16'));var utils=require('../../config/utils');var config=require(_0xc684('0x17'));var licenseUtil=require(_0xc684('0x18'));var db=require(_0xc684('0x19'))['db'];function respondWithStatusCode(_0x5dab16,_0xcc1f7d){_0xcc1f7d=_0xcc1f7d||0xcc;return function(_0x483083){if(_0x483083){return _0x5dab16['sendStatus'](_0xcc1f7d);}return _0x5dab16[_0xc684('0x1a')](_0xcc1f7d)['end']();};}function respondWithResult(_0x56a5f5,_0x210bed){_0x210bed=_0x210bed||0xc8;return function(_0xfbea34){if(_0xfbea34){return _0x56a5f5['status'](_0x210bed)[_0xc684('0x1b')](_0xfbea34);}};}function respondWithFilteredResult(_0x2b16db,_0x2dbbf4){return function(_0x308fa5){if(_0x308fa5){var _0x46bdfb=typeof _0x2dbbf4[_0xc684('0x1c')]==='undefined'&&typeof _0x2dbbf4[_0xc684('0x1d')]==='undefined';var _0x2175b7=_0x308fa5[_0xc684('0x1e')];var _0x3928ae=_0x46bdfb?0x0:_0x2dbbf4['offset'];var _0x4a0e4c=_0x46bdfb?_0x308fa5[_0xc684('0x1e')]:_0x2dbbf4[_0xc684('0x1c')]+_0x2dbbf4['limit'];var _0x7b9396;if(_0x4a0e4c>=_0x2175b7){_0x4a0e4c=_0x2175b7;_0x7b9396=0xc8;}else{_0x7b9396=0xce;}_0x2b16db[_0xc684('0x1a')](_0x7b9396);return _0x2b16db[_0xc684('0x1f')](_0xc684('0x20'),_0x3928ae+'-'+_0x4a0e4c+'/'+_0x2175b7)[_0xc684('0x1b')](_0x308fa5);}return null;};}function patchUpdates(_0xf6f4e9){return function(_0x55bd20){try{jsonpatch[_0xc684('0x21')](_0x55bd20,_0xf6f4e9,!![]);}catch(_0x3e8b1f){return BPromise['reject'](_0x3e8b1f);}return _0x55bd20[_0xc684('0x22')]();};}function saveUpdates(_0xed7cdd,_0x5f5cb2){return function(_0x2ea630){if(_0x2ea630){return _0x2ea630[_0xc684('0x23')](_0xed7cdd)[_0xc684('0x24')](function(_0x2082af){return _0x2082af;});}return null;};}function removeEntity(_0x6d298,_0x4cce74){return function(_0x5cea0b){if(_0x5cea0b){return _0x5cea0b[_0xc684('0x25')]()['then'](function(){_0x6d298[_0xc684('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x245262,_0x4f60b9){return function(_0x622562){if(!_0x622562){_0x245262['sendStatus'](0x194);}return _0x622562;};}function handleError(_0x42985f,_0x649fa5){_0x649fa5=_0x649fa5||0x1f4;return function(_0x39fc31){logger[_0xc684('0x26')](_0x39fc31['stack']);if(_0x39fc31['name']){delete _0x39fc31[_0xc684('0x27')];}_0x42985f[_0xc684('0x1a')](_0x649fa5)[_0xc684('0x28')](_0x39fc31);};}exports[_0xc684('0x29')]=function(_0xf83fc0,_0x2baf57){var _0xa47314={},_0x10cf37={},_0xb4dcbd={'count':0x0,'rows':[]};var _0x450b26=_['map'](db[_0xc684('0x2a')][_0xc684('0x2b')],function(_0x920806){return{'name':_0x920806['fieldName'],'type':_0x920806[_0xc684('0x2c')][_0xc684('0x2d')]};});_0x10cf37[_0xc684('0x2e')]=_['map'](_0x450b26,'name');_0x10cf37['query']=_[_0xc684('0x2f')](_0xf83fc0[_0xc684('0x30')]);_0x10cf37[_0xc684('0x31')]=_[_0xc684('0x32')](_0x10cf37[_0xc684('0x2e')],_0x10cf37['query']);_0xa47314[_0xc684('0x33')]=_[_0xc684('0x32')](_0x10cf37['model'],qs['fields'](_0xf83fc0['query'][_0xc684('0x34')]));_0xa47314[_0xc684('0x33')]=_0xa47314[_0xc684('0x33')][_0xc684('0x35')]?_0xa47314[_0xc684('0x33')]:_0x10cf37[_0xc684('0x2e')];if(!_0xf83fc0[_0xc684('0x30')][_0xc684('0x36')](_0xc684('0x37'))){_0xa47314[_0xc684('0x1d')]=qs['limit'](_0xf83fc0[_0xc684('0x30')][_0xc684('0x1d')]);_0xa47314['offset']=qs[_0xc684('0x1c')](_0xf83fc0[_0xc684('0x30')]['offset']);}_0xa47314['order']=qs['sort'](_0xf83fc0[_0xc684('0x30')]['sort']);_0xa47314[_0xc684('0x38')]=qs[_0xc684('0x31')](_[_0xc684('0x39')](_0xf83fc0[_0xc684('0x30')],_0x10cf37[_0xc684('0x31')]),_0x450b26);if(_0xf83fc0[_0xc684('0x30')]['filter']){_0xa47314[_0xc684('0x38')]=_['merge'](_0xa47314['where'],{'$or':_['map'](_0x450b26,function(_0x33b547){if(_0x33b547['type']!==_0xc684('0x3a')){var _0x3983fc={};_0x3983fc[_0x33b547['name']]={'$like':'%'+_0xf83fc0['query'][_0xc684('0x3b')]+'%'};return _0x3983fc;}})});}_0xa47314=_['merge']({},_0xa47314,_0xf83fc0[_0xc684('0x3c')]);var _0x38ad5a={'where':_0xa47314[_0xc684('0x38')]};return db['ServicenowField']['count'](_0x38ad5a)[_0xc684('0x24')](function(_0x3955d2){_0xb4dcbd[_0xc684('0x1e')]=_0x3955d2;if(_0xf83fc0['query'][_0xc684('0x3d')]){_0xa47314['include']=[{'all':!![]}];}return db[_0xc684('0x2a')][_0xc684('0x3e')](_0xa47314);})[_0xc684('0x24')](function(_0x1d4c9a){_0xb4dcbd[_0xc684('0x3f')]=_0x1d4c9a;return _0xb4dcbd;})[_0xc684('0x24')](respondWithFilteredResult(_0x2baf57,_0xa47314))[_0xc684('0x40')](handleError(_0x2baf57,null));};exports[_0xc684('0x41')]=function(_0x25d118,_0xce14f0){var _0x4be3ff={'raw':!![],'where':{'id':_0x25d118['params']['id']}},_0x1f35a3={};_0x1f35a3[_0xc684('0x2e')]=_['keys'](db[_0xc684('0x2a')]['rawAttributes']);_0x1f35a3['query']=_[_0xc684('0x2f')](_0x25d118[_0xc684('0x30')]);_0x1f35a3['filters']=_[_0xc684('0x32')](_0x1f35a3[_0xc684('0x2e')],_0x1f35a3[_0xc684('0x30')]);_0x4be3ff[_0xc684('0x33')]=_[_0xc684('0x32')](_0x1f35a3[_0xc684('0x2e')],qs['fields'](_0x25d118['query']['fields']));_0x4be3ff[_0xc684('0x33')]=_0x4be3ff[_0xc684('0x33')]['length']?_0x4be3ff[_0xc684('0x33')]:_0x1f35a3[_0xc684('0x2e')];if(_0x25d118[_0xc684('0x30')][_0xc684('0x3d')]){_0x4be3ff[_0xc684('0x42')]=[{'all':!![]}];}_0x4be3ff=_[_0xc684('0x43')]({},_0x4be3ff,_0x25d118['options']);return db[_0xc684('0x2a')][_0xc684('0x44')](_0x4be3ff)['then'](handleEntityNotFound(_0xce14f0,null))[_0xc684('0x24')](respondWithResult(_0xce14f0,null))['catch'](handleError(_0xce14f0,null));};exports['create']=function(_0x1720ed,_0xeff871){return db['ServicenowField']['create'](_0x1720ed[_0xc684('0x45')],{})['then'](respondWithResult(_0xeff871,0xc9))[_0xc684('0x40')](handleError(_0xeff871,null));};exports['update']=function(_0x5cde9f,_0x160492){if(_0x5cde9f['body']['id']){delete _0x5cde9f['body']['id'];}return db[_0xc684('0x2a')]['find']({'where':{'id':_0x5cde9f[_0xc684('0x46')]['id']}})[_0xc684('0x24')](handleEntityNotFound(_0x160492,null))[_0xc684('0x24')](saveUpdates(_0x5cde9f[_0xc684('0x45')],null))[_0xc684('0x24')](respondWithResult(_0x160492,null))[_0xc684('0x40')](handleError(_0x160492,null));};exports[_0xc684('0x25')]=function(_0xdf4f86,_0x66fdb2){return db['ServicenowField'][_0xc684('0x44')]({'where':{'id':_0xdf4f86['params']['id']}})['then'](handleEntityNotFound(_0x66fdb2,null))['then'](removeEntity(_0x66fdb2,null))[_0xc684('0x40')](handleError(_0x66fdb2,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 78c5b13..5ab1253 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 _0xecf0=['./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','FieldId','lodash','util','api','moment','request-promise','path','../../config/environment'];(function(_0x46bf71,_0x1d5ad4){var _0x39dcc1=function(_0x114660){while(--_0x114660){_0x46bf71['push'](_0x46bf71['shift']());}};_0x39dcc1(++_0x1d5ad4);}(_0xecf0,0x131));var _0x0ecf=function(_0x344d63,_0x200c6a){_0x344d63=_0x344d63-0x0;var _0x3241be=_0xecf0[_0x344d63];return _0x3241be;};'use strict';var _=require(_0x0ecf('0x0'));var util=require(_0x0ecf('0x1'));var logger=require('../../config/logger')(_0x0ecf('0x2'));var moment=require(_0x0ecf('0x3'));var BPromise=require('bluebird');var rp=require(_0x0ecf('0x4'));var fs=require('fs');var path=require(_0x0ecf('0x5'));var rimraf=require('rimraf');var config=require(_0x0ecf('0x6'));var attributes=require(_0x0ecf('0x7'));module[_0x0ecf('0x8')]=function(_0xf29df,_0x426873){return _0xf29df['define'](_0x0ecf('0x9'),attributes,{'tableName':_0x0ecf('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0x0ecf('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x04cf=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','FieldId'];(function(_0x5d3d74,_0x14d562){var _0x49e664=function(_0x5cdd47){while(--_0x5cdd47){_0x5d3d74['push'](_0x5d3d74['shift']());}};_0x49e664(++_0x14d562);}(_0x04cf,0x138));var _0xf04c=function(_0x95e420,_0x5c540a){_0x95e420=_0x95e420-0x0;var _0x25f1bd=_0x04cf[_0x95e420];return _0x25f1bd;};'use strict';var _=require(_0xf04c('0x0'));var util=require('util');var logger=require(_0xf04c('0x1'))(_0xf04c('0x2'));var moment=require('moment');var BPromise=require(_0xf04c('0x3'));var rp=require(_0xf04c('0x4'));var fs=require('fs');var path=require(_0xf04c('0x5'));var rimraf=require(_0xf04c('0x6'));var config=require(_0xf04c('0x7'));var attributes=require(_0xf04c('0x8'));module[_0xf04c('0x9')]=function(_0x381c8c,_0xf27574){return _0x381c8c[_0xf04c('0xa')]('ServicenowField',attributes,{'tableName':_0xf04c('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0xf04c('0xc')],'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 5471dc4..4ae4391 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x33a3c4,_0x1ec422){var _0x1fa161=function(_0x38f870){while(--_0x38f870){_0x33a3c4['push'](_0x33a3c4['shift']());}};_0x1fa161(++_0x1ec422);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0xcb91[_0x5b5cde];return _0x364ad2;};'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')]('ServicenowField,\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 _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xac4a,0x13f));var _0xaac4=function(_0x5ec394,_0x9ac48a){_0x5ec394=_0x5ec394-0x0;var _0x5c6d88=_0xac4a[_0x5ec394];return _0x5c6d88;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 87e3ef0..83dafe3 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(_0x2d5d45,_0x10278c){var _0x87dc4a=function(_0x37197d){while(--_0x37197d){_0x2d5d45['push'](_0x2d5d45['shift']());}};_0x87dc4a(++_0x10278c);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x1b3f95,_0x144c56){var _0x3c8283=function(_0x4a4784){while(--_0x4a4784){_0x1b3f95['push'](_0x1b3f95['shift']());}};_0x3c8283(++_0x144c56);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 0e0f107..d19de4e 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(_0x324339,_0x37659c){var _0x362103=function(_0x4ea64a){while(--_0x4ea64a){_0x324339['push'](_0x324339['shift']());}};_0x362103(++_0x37659c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x2a314e,_0x15eabf){var _0x259ad=function(_0x2cf4ab){while(--_0x2cf4ab){_0x2a314e['push'](_0x2a314e['shift']());}};_0x259ad(++_0x15eabf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 f709b7c..acafc43 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 _0xd0a4=['count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','SugarcrmConfiguration','getFields','assigned_user_id','created_by','duration_hours','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','module_fields','remove','label','endsWith','values','value','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd0a4,0x158));var _0x4d0a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd0a4[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x4d0a('0x0'));var rimraf=require(_0x4d0a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d0a('0x2'));var rp=require('request-promise');var moment=require(_0x4d0a('0x3'));var BPromise=require(_0x4d0a('0x4'));var Mustache=require(_0x4d0a('0x5'));var util=require(_0x4d0a('0x6'));var path=require('path');var sox=require(_0x4d0a('0x7'));var csv=require('to-csv');var ejs=require(_0x4d0a('0x8'));var fs=require('fs');var fs_extra=require(_0x4d0a('0x9'));var _=require(_0x4d0a('0xa'));var squel=require(_0x4d0a('0xb'));var crypto=require(_0x4d0a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4d0a('0xd'));var toCsv=require(_0x4d0a('0xe'));var querystring=require(_0x4d0a('0xf'));var Papa=require(_0x4d0a('0x10'));var Redis=require(_0x4d0a('0x11'));var authService=require(_0x4d0a('0x12'));var qs=require(_0x4d0a('0x13'));var as=require(_0x4d0a('0x14'));var hardwareService=require(_0x4d0a('0x15'));var logger=require(_0x4d0a('0x16'))(_0x4d0a('0x17'));var utils=require(_0x4d0a('0x18'));var config=require(_0x4d0a('0x19'));var licenseUtil=require(_0x4d0a('0x1a'));var db=require(_0x4d0a('0x1b'))['db'];var integrations=require(_0x4d0a('0x1c'));function respondWithStatusCode(_0x399bc8,_0x4c3d7a){_0x4c3d7a=_0x4c3d7a||0xcc;return function(_0x10d8e6){if(_0x10d8e6){return _0x399bc8[_0x4d0a('0x1d')](_0x4c3d7a);}return _0x399bc8[_0x4d0a('0x1e')](_0x4c3d7a)[_0x4d0a('0x1f')]();};}function respondWithResult(_0x45b518,_0x14def3){_0x14def3=_0x14def3||0xc8;return function(_0x52af9c){if(_0x52af9c){return _0x45b518['status'](_0x14def3)['json'](_0x52af9c);}};}function respondWithFilteredResult(_0x10f731,_0x574871){return function(_0x4d86aa){if(_0x4d86aa){var _0x290427=typeof _0x574871['offset']===_0x4d0a('0x20')&&typeof _0x574871[_0x4d0a('0x21')]===_0x4d0a('0x20');var _0x27cda8=_0x4d86aa[_0x4d0a('0x22')];var _0xa5a31c=_0x290427?0x0:_0x574871[_0x4d0a('0x23')];var _0x24cc34=_0x290427?_0x4d86aa['count']:_0x574871['offset']+_0x574871[_0x4d0a('0x21')];var _0x44c059;if(_0x24cc34>=_0x27cda8){_0x24cc34=_0x27cda8;_0x44c059=0xc8;}else{_0x44c059=0xce;}_0x10f731[_0x4d0a('0x1e')](_0x44c059);return _0x10f731[_0x4d0a('0x24')](_0x4d0a('0x25'),_0xa5a31c+'-'+_0x24cc34+'/'+_0x27cda8)[_0x4d0a('0x26')](_0x4d86aa);}return null;};}function patchUpdates(_0x1205fa){return function(_0x1adb03){try{jsonpatch[_0x4d0a('0x27')](_0x1adb03,_0x1205fa,!![]);}catch(_0x47216a){return BPromise[_0x4d0a('0x28')](_0x47216a);}return _0x1adb03[_0x4d0a('0x29')]();};}function saveUpdates(_0x1906a5,_0x2248db){return function(_0x549f0b){if(_0x549f0b){return _0x549f0b[_0x4d0a('0x2a')](_0x1906a5)[_0x4d0a('0x2b')](function(_0x530e27){return _0x530e27;});}return null;};}function removeEntity(_0x1e8401,_0x230134){return function(_0x180717){if(_0x180717){return _0x180717[_0x4d0a('0x2c')]()[_0x4d0a('0x2b')](function(){_0x1e8401[_0x4d0a('0x1e')](0xcc)[_0x4d0a('0x1f')]();});}};}function handleEntityNotFound(_0x52aaa6,_0x3ff16a){return function(_0x3fd401){if(!_0x3fd401){_0x52aaa6[_0x4d0a('0x1d')](0x194);}return _0x3fd401;};}function handleError(_0x33636e,_0xc7e9b8){_0xc7e9b8=_0xc7e9b8||0x1f4;return function(_0x107c8c){logger[_0x4d0a('0x2d')](_0x107c8c[_0x4d0a('0x2e')]);if(_0x107c8c[_0x4d0a('0x2f')]){delete _0x107c8c[_0x4d0a('0x2f')];}_0x33636e[_0x4d0a('0x1e')](_0xc7e9b8)[_0x4d0a('0x30')](_0x107c8c);};}exports[_0x4d0a('0x31')]=function(_0x1795f9,_0x391f8b){var _0x14ab93={},_0x21bd14={},_0x1b83ab={'count':0x0,'rows':[]};var _0x5970b6=_[_0x4d0a('0x32')](db[_0x4d0a('0x33')][_0x4d0a('0x34')],function(_0x12c96b){return{'name':_0x12c96b[_0x4d0a('0x35')],'type':_0x12c96b['type']['key']};});_0x21bd14[_0x4d0a('0x36')]=_[_0x4d0a('0x32')](_0x5970b6,'name');_0x21bd14[_0x4d0a('0x37')]=_[_0x4d0a('0x38')](_0x1795f9[_0x4d0a('0x37')]);_0x21bd14[_0x4d0a('0x39')]=_[_0x4d0a('0x3a')](_0x21bd14[_0x4d0a('0x36')],_0x21bd14[_0x4d0a('0x37')]);_0x14ab93[_0x4d0a('0x3b')]=_['intersection'](_0x21bd14['model'],qs['fields'](_0x1795f9['query'][_0x4d0a('0x3c')]));_0x14ab93[_0x4d0a('0x3b')]=_0x14ab93[_0x4d0a('0x3b')][_0x4d0a('0x3d')]?_0x14ab93['attributes']:_0x21bd14[_0x4d0a('0x36')];if(!_0x1795f9[_0x4d0a('0x37')]['hasOwnProperty'](_0x4d0a('0x3e'))){_0x14ab93[_0x4d0a('0x21')]=qs[_0x4d0a('0x21')](_0x1795f9[_0x4d0a('0x37')][_0x4d0a('0x21')]);_0x14ab93[_0x4d0a('0x23')]=qs[_0x4d0a('0x23')](_0x1795f9['query'][_0x4d0a('0x23')]);}_0x14ab93['order']=qs['sort'](_0x1795f9['query'][_0x4d0a('0x3f')]);_0x14ab93[_0x4d0a('0x40')]=qs[_0x4d0a('0x39')](_[_0x4d0a('0x41')](_0x1795f9[_0x4d0a('0x37')],_0x21bd14[_0x4d0a('0x39')]),_0x5970b6);if(_0x1795f9['query'][_0x4d0a('0x42')]){_0x14ab93[_0x4d0a('0x40')]=_[_0x4d0a('0x43')](_0x14ab93[_0x4d0a('0x40')],{'$or':_[_0x4d0a('0x32')](_0x5970b6,function(_0x4dc0fe){if(_0x4dc0fe['type']!==_0x4d0a('0x44')){var _0x4ce748={};_0x4ce748[_0x4dc0fe[_0x4d0a('0x2f')]]={'$like':'%'+_0x1795f9[_0x4d0a('0x37')]['filter']+'%'};return _0x4ce748;}})});}_0x14ab93=_[_0x4d0a('0x43')]({},_0x14ab93,_0x1795f9[_0x4d0a('0x45')]);var _0x26e760={'where':_0x14ab93[_0x4d0a('0x40')]};return db[_0x4d0a('0x33')][_0x4d0a('0x22')](_0x26e760)['then'](function(_0x24dbca){_0x1b83ab[_0x4d0a('0x22')]=_0x24dbca;if(_0x1795f9['query'][_0x4d0a('0x46')]){_0x14ab93['include']=[{'all':!![]}];}return db[_0x4d0a('0x33')][_0x4d0a('0x47')](_0x14ab93);})[_0x4d0a('0x2b')](function(_0xb3ce00){_0x1b83ab[_0x4d0a('0x48')]=_0xb3ce00;return _0x1b83ab;})[_0x4d0a('0x2b')](respondWithFilteredResult(_0x391f8b,_0x14ab93))[_0x4d0a('0x49')](handleError(_0x391f8b,null));};exports[_0x4d0a('0x4a')]=function(_0x12a894,_0x429861){var _0x4500a4={'raw':![],'where':{'id':_0x12a894[_0x4d0a('0x4b')]['id']}},_0x3fa242={};_0x3fa242[_0x4d0a('0x36')]=_[_0x4d0a('0x38')](db[_0x4d0a('0x33')][_0x4d0a('0x34')]);_0x3fa242[_0x4d0a('0x37')]=_[_0x4d0a('0x38')](_0x12a894[_0x4d0a('0x37')]);_0x3fa242[_0x4d0a('0x39')]=_[_0x4d0a('0x3a')](_0x3fa242['model'],_0x3fa242[_0x4d0a('0x37')]);_0x4500a4[_0x4d0a('0x3b')]=_['intersection'](_0x3fa242[_0x4d0a('0x36')],qs[_0x4d0a('0x3c')](_0x12a894['query'][_0x4d0a('0x3c')]));_0x4500a4[_0x4d0a('0x3b')]=_0x4500a4[_0x4d0a('0x3b')]['length']?_0x4500a4[_0x4d0a('0x3b')]:_0x3fa242[_0x4d0a('0x36')];if(_0x12a894['query']['includeAll']){_0x4500a4[_0x4d0a('0x4c')]=[{'all':!![]}];}_0x4500a4=_['merge']({},_0x4500a4,_0x12a894[_0x4d0a('0x45')]);return db[_0x4d0a('0x33')][_0x4d0a('0x4d')](_0x4500a4)[_0x4d0a('0x2b')](handleEntityNotFound(_0x429861,null))[_0x4d0a('0x2b')](respondWithResult(_0x429861,null))[_0x4d0a('0x49')](handleError(_0x429861,null));};exports[_0x4d0a('0x4e')]=function(_0x3717f0,_0x2ffdf8){return db[_0x4d0a('0x33')][_0x4d0a('0x4e')](_0x3717f0[_0x4d0a('0x4f')],{})[_0x4d0a('0x2b')](respondWithResult(_0x2ffdf8,0xc9))['catch'](handleError(_0x2ffdf8,null));};exports[_0x4d0a('0x2a')]=function(_0x3e0746,_0x1b1b82){if(_0x3e0746[_0x4d0a('0x4f')]['id']){delete _0x3e0746[_0x4d0a('0x4f')]['id'];}return db[_0x4d0a('0x33')]['find']({'where':{'id':_0x3e0746[_0x4d0a('0x4b')]['id']}})[_0x4d0a('0x2b')](handleEntityNotFound(_0x1b1b82,null))[_0x4d0a('0x2b')](saveUpdates(_0x3e0746[_0x4d0a('0x4f')],null))['then'](respondWithResult(_0x1b1b82,null))[_0x4d0a('0x49')](handleError(_0x1b1b82,null));};exports['destroy']=function(_0x1b2d66,_0x4d565f){return db['SugarcrmAccount'][_0x4d0a('0x4d')]({'where':{'id':_0x1b2d66[_0x4d0a('0x4b')]['id']}})[_0x4d0a('0x2b')](handleEntityNotFound(_0x4d565f,null))[_0x4d0a('0x2b')](removeEntity(_0x4d565f,null))[_0x4d0a('0x49')](handleError(_0x4d565f,null));};exports[_0x4d0a('0x50')]=function(_0x244b06,_0x2207c7,_0x1c1c11){var _0x5bd9ad={};var _0x10e619={};var _0xe8d97b;var _0x25240a;return db[_0x4d0a('0x33')]['findOne']({'where':{'id':_0x244b06[_0x4d0a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2207c7,null))[_0x4d0a('0x2b')](function(_0x96a166){if(_0x96a166){_0xe8d97b=_0x96a166;_0x10e619['model']=_[_0x4d0a('0x38')](db['SugarcrmConfiguration'][_0x4d0a('0x34')]);_0x10e619[_0x4d0a('0x37')]=_[_0x4d0a('0x38')](_0x244b06['query']);_0x10e619[_0x4d0a('0x39')]=_[_0x4d0a('0x3a')](_0x10e619[_0x4d0a('0x36')],_0x10e619['query']);_0x5bd9ad[_0x4d0a('0x3b')]=_[_0x4d0a('0x3a')](_0x10e619[_0x4d0a('0x36')],qs[_0x4d0a('0x3c')](_0x244b06[_0x4d0a('0x37')][_0x4d0a('0x3c')]));_0x5bd9ad[_0x4d0a('0x3b')]=_0x5bd9ad[_0x4d0a('0x3b')]['length']?_0x5bd9ad[_0x4d0a('0x3b')]:_0x10e619[_0x4d0a('0x36')];_0x5bd9ad['order']=qs[_0x4d0a('0x3f')](_0x244b06[_0x4d0a('0x37')]['sort']);_0x5bd9ad[_0x4d0a('0x40')]=qs[_0x4d0a('0x39')](_['pick'](_0x244b06[_0x4d0a('0x37')],_0x10e619[_0x4d0a('0x39')]));if(_0x244b06['query'][_0x4d0a('0x42')]){_0x5bd9ad[_0x4d0a('0x40')]=_['merge'](_0x5bd9ad[_0x4d0a('0x40')],{'$or':_[_0x4d0a('0x32')](_0x5bd9ad['attributes'],function(_0x264cf6){var _0xba5e81={};_0xba5e81[_0x264cf6]={'$like':'%'+_0x244b06[_0x4d0a('0x37')][_0x4d0a('0x42')]+'%'};return _0xba5e81;})});}_0x5bd9ad=_['merge']({},_0x5bd9ad,_0x244b06['options']);return _0xe8d97b['getConfigurations'](_0x5bd9ad);}})[_0x4d0a('0x2b')](function(_0x2edb3f){if(_0x2edb3f){_0x25240a=_0x2edb3f[_0x4d0a('0x3d')];if(!_0x244b06[_0x4d0a('0x37')][_0x4d0a('0x51')]('nolimit')){_0x5bd9ad[_0x4d0a('0x21')]=qs[_0x4d0a('0x21')](_0x244b06[_0x4d0a('0x37')]['limit']);_0x5bd9ad[_0x4d0a('0x23')]=qs[_0x4d0a('0x23')](_0x244b06[_0x4d0a('0x37')][_0x4d0a('0x23')]);}return _0xe8d97b[_0x4d0a('0x50')](_0x5bd9ad);}})[_0x4d0a('0x2b')](function(_0xe9be1b){if(_0xe9be1b){return _0xe9be1b?{'count':_0x25240a,'rows':_0xe9be1b}:null;}})[_0x4d0a('0x2b')](respondWithResult(_0x2207c7,null))[_0x4d0a('0x49')](handleError(_0x2207c7,null));};exports[_0x4d0a('0x52')]=function(_0x3aaa43,_0x4a54d4,_0x1debec){if(_0x3aaa43['body']['id']){delete _0x3aaa43[_0x4d0a('0x4f')]['id'];}return db[_0x4d0a('0x33')][_0x4d0a('0x53')]({'where':{'id':_0x3aaa43[_0x4d0a('0x4b')]['id']}})[_0x4d0a('0x2b')](handleEntityNotFound(_0x4a54d4,null))[_0x4d0a('0x2b')](function(_0x5e5392){if(_0x5e5392){_0x3aaa43['body'][_0x4d0a('0x54')]=_0x5e5392['id'];_0x3aaa43[_0x4d0a('0x4f')][_0x4d0a('0x55')]=integrations[_0x4d0a('0x56')](_0x3aaa43[_0x4d0a('0x4f')][_0x4d0a('0x57')],_0x3aaa43[_0x4d0a('0x4f')][_0x4d0a('0x58')]);_0x3aaa43['body'][_0x4d0a('0x59')]=integrations[_0x4d0a('0x5a')](_0x3aaa43['body'][_0x4d0a('0x57')],_0x3aaa43[_0x4d0a('0x4f')][_0x4d0a('0x58')]);return db[_0x4d0a('0x5b')]['create'](_0x3aaa43[_0x4d0a('0x4f')],{'include':[{'model':db['SugarcrmField'],'as':_0x4d0a('0x55')},{'model':db['SugarcrmField'],'as':_0x4d0a('0x59')}]});}return null;})['then'](respondWithResult(_0x4a54d4,null))[_0x4d0a('0x49')](handleError(_0x4a54d4,null));};exports[_0x4d0a('0x5c')]=function(_0x4f4587,_0x5e3e4b,_0xc2926a){var _0x44f412='';var _0x2b29d4=['id',_0x4d0a('0x2f'),_0x4d0a('0x5d'),_0x4d0a('0x5e'),'description','date_start',_0x4d0a('0x5f'),'duration_minutes',_0x4d0a('0x60'),_0x4d0a('0x61'),'parent_name',_0x4d0a('0x62')];return db[_0x4d0a('0x33')]['findOne']({'where':{'id':_0x4f4587[_0x4d0a('0x4b')]['id']},'attributes':['id',_0x4d0a('0x63'),_0x4d0a('0x64'),_0x4d0a('0x65')]})['then'](handleEntityNotFound(_0x5e3e4b,null))[_0x4d0a('0x2b')](function(_0x5a276e){if(_0x5a276e){_0x44f412=_0x5a276e[_0x4d0a('0x65')];var _0x53eabd=_0x44f412[_0x4d0a('0x66')](-0x1);if(_0x53eabd==='/'){_0x44f412=_0x44f412[_0x4d0a('0x67')](0x0,_0x44f412[_0x4d0a('0x68')](_0x53eabd));}return rp({'method':_0x4d0a('0x69'),'uri':util[_0x4d0a('0x6a')](_0x4d0a('0x6b'),_0x44f412,_0x4d0a('0x6c')),'json':!![],'form':{'method':'login','input_type':_0x4d0a('0x6d'),'response_type':_0x4d0a('0x6d'),'rest_data':JSON[_0x4d0a('0x6e')]({'user_auth':{'user_name':_0x5a276e[_0x4d0a('0x63')],'password':_0x5a276e[_0x4d0a('0x64')],'encryption':'PLAIN'},'application':_0x4d0a('0x6f')})}});}})[_0x4d0a('0x2b')](function(_0x542aed){if(_0x542aed&&_0x542aed[_0x4d0a('0x2f')]!==_0x4d0a('0x70')&&_0x542aed[_0x4d0a('0x2f')]!==_0x4d0a('0x71')){return rp({'method':_0x4d0a('0x69'),'uri':util[_0x4d0a('0x6a')]('%s%s',_0x44f412,_0x4d0a('0x6c')),'json':!![],'form':{'method':_0x4d0a('0x72'),'input_type':_0x4d0a('0x6d'),'response_type':_0x4d0a('0x6d'),'rest_data':JSON[_0x4d0a('0x6e')]({'session':_0x542aed['id'],'module_name':_0x4d0a('0x73')})}})[_0x4d0a('0x2b')](function(_0x4798dc){if(_0x4798dc){var _0x2f8aad=_['values'](_0x4798dc[_0x4d0a('0x74')]);_[_0x4d0a('0x75')](_0x2f8aad,function(_0x5cc269){return _0x2b29d4['includes'](_0x5cc269[_0x4d0a('0x2f')]);});return{'count':_0x2f8aad[_0x4d0a('0x3d')],'rows':_[_0x4d0a('0x32')](_0x2f8aad,function(_0xd09d82){return{'id':_0xd09d82[_0x4d0a('0x2f')],'name':_0xd09d82[_0x4d0a('0x76')],'custom':_[_0x4d0a('0x77')](_0xd09d82[_0x4d0a('0x2f')],'_c')?!![]:![],'options':_0xd09d82[_0x4d0a('0x45')]?_[_0x4d0a('0x32')](_[_0x4d0a('0x78')](_0xd09d82[_0x4d0a('0x45')]),function(_0x568a5a){return{'name':_0x568a5a[_0x4d0a('0x79')],'value':_0x568a5a[_0x4d0a('0x2f')]};}):[]};})};}})[_0x4d0a('0x2b')](respondWithResult(_0x5e3e4b,null))['catch'](function(_0x3ec837){var _0x19403f=_0x4f4587[_0x4d0a('0x37')][_0x4d0a('0x7a')]?0x1f4:_0x3ec837['statusCode']||0x1f4;logger[_0x4d0a('0x2d')](_0x4d0a('0x7b'),'getFields',_0x19403f,JSON[_0x4d0a('0x6e')](_0x3ec837));delete _0x3ec837[_0x4d0a('0x2f')];if(_0x19403f===0x191){_0x19403f=0x190;}_0x5e3e4b[_0x4d0a('0x1e')](_0x19403f)[_0x4d0a('0x30')](_0x4f4587[_0x4d0a('0x37')][_0x4d0a('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x3ec837[_0x4d0a('0x7c')]}:_0x3ec837);});}else{var _0x62e93a=0x1f4;_0x5e3e4b[_0x4d0a('0x1e')](_0x62e93a)[_0x4d0a('0x30')]({'message':_0x4d0a('0x7d'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x2a8d=['offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','include','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','assigned_user_id','created_by','description','date_start','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','remove','includes','label','endsWith','values','value','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2a8d,0xce));var _0xd2a8=function(_0x25e995,_0x143cdc){_0x25e995=_0x25e995-0x0;var _0x446a58=_0x2a8d[_0x25e995];return _0x446a58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd2a8('0x0'));var zipdir=require(_0xd2a8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd2a8('0x2'));var moment=require(_0xd2a8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd2a8('0x4'));var util=require('util');var path=require(_0xd2a8('0x5'));var sox=require(_0xd2a8('0x6'));var csv=require(_0xd2a8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd2a8('0x8'));var squel=require(_0xd2a8('0x9'));var crypto=require('crypto');var jsforce=require(_0xd2a8('0xa'));var deskjs=require(_0xd2a8('0xb'));var toCsv=require(_0xd2a8('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd2a8('0xc'));var authService=require(_0xd2a8('0xd'));var qs=require(_0xd2a8('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2a8('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xd2a8('0x10'));var licenseUtil=require(_0xd2a8('0x11'));var db=require(_0xd2a8('0x12'))['db'];var integrations=require(_0xd2a8('0x13'));function respondWithStatusCode(_0x12b2b2,_0x1b5ab1){_0x1b5ab1=_0x1b5ab1||0xcc;return function(_0x10bed5){if(_0x10bed5){return _0x12b2b2[_0xd2a8('0x14')](_0x1b5ab1);}return _0x12b2b2[_0xd2a8('0x15')](_0x1b5ab1)[_0xd2a8('0x16')]();};}function respondWithResult(_0x18342d,_0x27c47b){_0x27c47b=_0x27c47b||0xc8;return function(_0x507620){if(_0x507620){return _0x18342d[_0xd2a8('0x15')](_0x27c47b)[_0xd2a8('0x17')](_0x507620);}};}function respondWithFilteredResult(_0x48f3af,_0x54b1d4){return function(_0x201427){if(_0x201427){var _0x97446=typeof _0x54b1d4[_0xd2a8('0x18')]===_0xd2a8('0x19')&&typeof _0x54b1d4[_0xd2a8('0x1a')]===_0xd2a8('0x19');var _0x5bc40f=_0x201427[_0xd2a8('0x1b')];var _0x333e39=_0x97446?0x0:_0x54b1d4[_0xd2a8('0x18')];var _0x455f3b=_0x97446?_0x201427[_0xd2a8('0x1b')]:_0x54b1d4['offset']+_0x54b1d4['limit'];var _0x5ee4b5;if(_0x455f3b>=_0x5bc40f){_0x455f3b=_0x5bc40f;_0x5ee4b5=0xc8;}else{_0x5ee4b5=0xce;}_0x48f3af[_0xd2a8('0x15')](_0x5ee4b5);return _0x48f3af['set'](_0xd2a8('0x1c'),_0x333e39+'-'+_0x455f3b+'/'+_0x5bc40f)['json'](_0x201427);}return null;};}function patchUpdates(_0x1b9e21){return function(_0x4fcd48){try{jsonpatch[_0xd2a8('0x1d')](_0x4fcd48,_0x1b9e21,!![]);}catch(_0x3badff){return BPromise[_0xd2a8('0x1e')](_0x3badff);}return _0x4fcd48[_0xd2a8('0x1f')]();};}function saveUpdates(_0x488688,_0x169fdb){return function(_0x485485){if(_0x485485){return _0x485485[_0xd2a8('0x20')](_0x488688)['then'](function(_0x33d250){return _0x33d250;});}return null;};}function removeEntity(_0x1b573b,_0x12b9b2){return function(_0x23fcdc){if(_0x23fcdc){return _0x23fcdc['destroy']()[_0xd2a8('0x21')](function(){_0x1b573b['status'](0xcc)[_0xd2a8('0x16')]();});}};}function handleEntityNotFound(_0x599aac,_0x48030b){return function(_0x567ccf){if(!_0x567ccf){_0x599aac[_0xd2a8('0x14')](0x194);}return _0x567ccf;};}function handleError(_0x28fbb9,_0x6b966e){_0x6b966e=_0x6b966e||0x1f4;return function(_0x7107ad){logger[_0xd2a8('0x22')](_0x7107ad[_0xd2a8('0x23')]);if(_0x7107ad[_0xd2a8('0x24')]){delete _0x7107ad['name'];}_0x28fbb9[_0xd2a8('0x15')](_0x6b966e)[_0xd2a8('0x25')](_0x7107ad);};}exports[_0xd2a8('0x26')]=function(_0x4f0804,_0x504378){var _0x10792c={},_0x1590da={},_0x37488d={'count':0x0,'rows':[]};var _0x3a9cf3=_[_0xd2a8('0x27')](db[_0xd2a8('0x28')][_0xd2a8('0x29')],function(_0x143920){return{'name':_0x143920[_0xd2a8('0x2a')],'type':_0x143920[_0xd2a8('0x2b')]['key']};});_0x1590da[_0xd2a8('0x2c')]=_[_0xd2a8('0x27')](_0x3a9cf3,_0xd2a8('0x24'));_0x1590da[_0xd2a8('0x2d')]=_[_0xd2a8('0x2e')](_0x4f0804[_0xd2a8('0x2d')]);_0x1590da['filters']=_[_0xd2a8('0x2f')](_0x1590da[_0xd2a8('0x2c')],_0x1590da[_0xd2a8('0x2d')]);_0x10792c[_0xd2a8('0x30')]=_[_0xd2a8('0x2f')](_0x1590da[_0xd2a8('0x2c')],qs[_0xd2a8('0x31')](_0x4f0804[_0xd2a8('0x2d')][_0xd2a8('0x31')]));_0x10792c[_0xd2a8('0x30')]=_0x10792c[_0xd2a8('0x30')][_0xd2a8('0x32')]?_0x10792c[_0xd2a8('0x30')]:_0x1590da[_0xd2a8('0x2c')];if(!_0x4f0804['query'][_0xd2a8('0x33')](_0xd2a8('0x34'))){_0x10792c['limit']=qs[_0xd2a8('0x1a')](_0x4f0804[_0xd2a8('0x2d')][_0xd2a8('0x1a')]);_0x10792c[_0xd2a8('0x18')]=qs[_0xd2a8('0x18')](_0x4f0804['query'][_0xd2a8('0x18')]);}_0x10792c[_0xd2a8('0x35')]=qs['sort'](_0x4f0804['query'][_0xd2a8('0x36')]);_0x10792c[_0xd2a8('0x37')]=qs[_0xd2a8('0x38')](_[_0xd2a8('0x39')](_0x4f0804[_0xd2a8('0x2d')],_0x1590da[_0xd2a8('0x38')]),_0x3a9cf3);if(_0x4f0804[_0xd2a8('0x2d')][_0xd2a8('0x3a')]){_0x10792c['where']=_[_0xd2a8('0x3b')](_0x10792c[_0xd2a8('0x37')],{'$or':_[_0xd2a8('0x27')](_0x3a9cf3,function(_0x54101c){if(_0x54101c[_0xd2a8('0x2b')]!==_0xd2a8('0x3c')){var _0x487caf={};_0x487caf[_0x54101c[_0xd2a8('0x24')]]={'$like':'%'+_0x4f0804[_0xd2a8('0x2d')][_0xd2a8('0x3a')]+'%'};return _0x487caf;}})});}_0x10792c=_[_0xd2a8('0x3b')]({},_0x10792c,_0x4f0804[_0xd2a8('0x3d')]);var _0x6421b1={'where':_0x10792c[_0xd2a8('0x37')]};return db[_0xd2a8('0x28')]['count'](_0x6421b1)[_0xd2a8('0x21')](function(_0x58e0ff){_0x37488d[_0xd2a8('0x1b')]=_0x58e0ff;if(_0x4f0804[_0xd2a8('0x2d')][_0xd2a8('0x3e')]){_0x10792c['include']=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x10792c);})['then'](function(_0x3f215b){_0x37488d['rows']=_0x3f215b;return _0x37488d;})['then'](respondWithFilteredResult(_0x504378,_0x10792c))[_0xd2a8('0x3f')](handleError(_0x504378,null));};exports[_0xd2a8('0x40')]=function(_0xf08500,_0x295053){var _0x326edc={'raw':![],'where':{'id':_0xf08500[_0xd2a8('0x41')]['id']}},_0x26eab6={};_0x26eab6['model']=_['keys'](db[_0xd2a8('0x28')][_0xd2a8('0x29')]);_0x26eab6[_0xd2a8('0x2d')]=_[_0xd2a8('0x2e')](_0xf08500[_0xd2a8('0x2d')]);_0x26eab6[_0xd2a8('0x38')]=_[_0xd2a8('0x2f')](_0x26eab6[_0xd2a8('0x2c')],_0x26eab6[_0xd2a8('0x2d')]);_0x326edc[_0xd2a8('0x30')]=_[_0xd2a8('0x2f')](_0x26eab6[_0xd2a8('0x2c')],qs[_0xd2a8('0x31')](_0xf08500[_0xd2a8('0x2d')]['fields']));_0x326edc[_0xd2a8('0x30')]=_0x326edc['attributes']['length']?_0x326edc[_0xd2a8('0x30')]:_0x26eab6[_0xd2a8('0x2c')];if(_0xf08500[_0xd2a8('0x2d')][_0xd2a8('0x3e')]){_0x326edc[_0xd2a8('0x42')]=[{'all':!![]}];}_0x326edc=_[_0xd2a8('0x3b')]({},_0x326edc,_0xf08500[_0xd2a8('0x3d')]);return db['SugarcrmAccount'][_0xd2a8('0x43')](_0x326edc)[_0xd2a8('0x21')](handleEntityNotFound(_0x295053,null))[_0xd2a8('0x21')](respondWithResult(_0x295053,null))[_0xd2a8('0x3f')](handleError(_0x295053,null));};exports[_0xd2a8('0x44')]=function(_0x1b54d2,_0x4f7e1b){return db['SugarcrmAccount']['create'](_0x1b54d2[_0xd2a8('0x45')],{})[_0xd2a8('0x21')](respondWithResult(_0x4f7e1b,0xc9))[_0xd2a8('0x3f')](handleError(_0x4f7e1b,null));};exports['update']=function(_0x5c868b,_0x3dcd80){if(_0x5c868b['body']['id']){delete _0x5c868b[_0xd2a8('0x45')]['id'];}return db['SugarcrmAccount'][_0xd2a8('0x43')]({'where':{'id':_0x5c868b[_0xd2a8('0x41')]['id']}})[_0xd2a8('0x21')](handleEntityNotFound(_0x3dcd80,null))['then'](saveUpdates(_0x5c868b[_0xd2a8('0x45')],null))[_0xd2a8('0x21')](respondWithResult(_0x3dcd80,null))[_0xd2a8('0x3f')](handleError(_0x3dcd80,null));};exports[_0xd2a8('0x46')]=function(_0x13797f,_0x35faae){return db[_0xd2a8('0x28')][_0xd2a8('0x43')]({'where':{'id':_0x13797f['params']['id']}})[_0xd2a8('0x21')](handleEntityNotFound(_0x35faae,null))['then'](removeEntity(_0x35faae,null))[_0xd2a8('0x3f')](handleError(_0x35faae,null));};exports[_0xd2a8('0x47')]=function(_0x403629,_0x1c4013,_0x4b437a){var _0x15c137={};var _0x33936e={};var _0x546188;var _0x5bcf5a;return db[_0xd2a8('0x28')][_0xd2a8('0x48')]({'where':{'id':_0x403629['params']['id']}})[_0xd2a8('0x21')](handleEntityNotFound(_0x1c4013,null))[_0xd2a8('0x21')](function(_0x1876ee){if(_0x1876ee){_0x546188=_0x1876ee;_0x33936e[_0xd2a8('0x2c')]=_[_0xd2a8('0x2e')](db[_0xd2a8('0x49')][_0xd2a8('0x29')]);_0x33936e[_0xd2a8('0x2d')]=_['keys'](_0x403629[_0xd2a8('0x2d')]);_0x33936e[_0xd2a8('0x38')]=_[_0xd2a8('0x2f')](_0x33936e[_0xd2a8('0x2c')],_0x33936e['query']);_0x15c137[_0xd2a8('0x30')]=_[_0xd2a8('0x2f')](_0x33936e[_0xd2a8('0x2c')],qs[_0xd2a8('0x31')](_0x403629['query'][_0xd2a8('0x31')]));_0x15c137[_0xd2a8('0x30')]=_0x15c137[_0xd2a8('0x30')]['length']?_0x15c137[_0xd2a8('0x30')]:_0x33936e['model'];_0x15c137[_0xd2a8('0x35')]=qs['sort'](_0x403629[_0xd2a8('0x2d')][_0xd2a8('0x36')]);_0x15c137[_0xd2a8('0x37')]=qs['filters'](_[_0xd2a8('0x39')](_0x403629[_0xd2a8('0x2d')],_0x33936e[_0xd2a8('0x38')]));if(_0x403629[_0xd2a8('0x2d')]['filter']){_0x15c137['where']=_[_0xd2a8('0x3b')](_0x15c137['where'],{'$or':_[_0xd2a8('0x27')](_0x15c137[_0xd2a8('0x30')],function(_0x324bde){var _0x3f3d89={};_0x3f3d89[_0x324bde]={'$like':'%'+_0x403629[_0xd2a8('0x2d')][_0xd2a8('0x3a')]+'%'};return _0x3f3d89;})});}_0x15c137=_[_0xd2a8('0x3b')]({},_0x15c137,_0x403629['options']);return _0x546188['getConfigurations'](_0x15c137);}})['then'](function(_0x1f2a1d){if(_0x1f2a1d){_0x5bcf5a=_0x1f2a1d[_0xd2a8('0x32')];if(!_0x403629[_0xd2a8('0x2d')][_0xd2a8('0x33')](_0xd2a8('0x34'))){_0x15c137['limit']=qs['limit'](_0x403629['query']['limit']);_0x15c137['offset']=qs[_0xd2a8('0x18')](_0x403629[_0xd2a8('0x2d')][_0xd2a8('0x18')]);}return _0x546188[_0xd2a8('0x47')](_0x15c137);}})[_0xd2a8('0x21')](function(_0xa5b0f){if(_0xa5b0f){return _0xa5b0f?{'count':_0x5bcf5a,'rows':_0xa5b0f}:null;}})[_0xd2a8('0x21')](respondWithResult(_0x1c4013,null))[_0xd2a8('0x3f')](handleError(_0x1c4013,null));};exports[_0xd2a8('0x4a')]=function(_0x34074f,_0x5270d8,_0x4a203e){if(_0x34074f['body']['id']){delete _0x34074f['body']['id'];}return db[_0xd2a8('0x28')][_0xd2a8('0x48')]({'where':{'id':_0x34074f['params']['id']}})[_0xd2a8('0x21')](handleEntityNotFound(_0x5270d8,null))[_0xd2a8('0x21')](function(_0x8c3481){if(_0x8c3481){_0x34074f[_0xd2a8('0x45')]['AccountId']=_0x8c3481['id'];_0x34074f['body'][_0xd2a8('0x4b')]=integrations[_0xd2a8('0x4c')](_0x34074f[_0xd2a8('0x45')][_0xd2a8('0x4d')],_0x34074f[_0xd2a8('0x45')][_0xd2a8('0x2b')]);_0x34074f[_0xd2a8('0x45')][_0xd2a8('0x4e')]=integrations[_0xd2a8('0x4f')](_0x34074f[_0xd2a8('0x45')]['channel'],_0x34074f['body'][_0xd2a8('0x2b')]);return db[_0xd2a8('0x49')][_0xd2a8('0x44')](_0x34074f[_0xd2a8('0x45')],{'include':[{'model':db['SugarcrmField'],'as':_0xd2a8('0x4b')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0xd2a8('0x21')](respondWithResult(_0x5270d8,null))['catch'](handleError(_0x5270d8,null));};exports[_0xd2a8('0x50')]=function(_0x1c098b,_0x3630c0,_0x2636cf){var _0x17d38c='';var _0xde5e20=['id',_0xd2a8('0x24'),_0xd2a8('0x51'),_0xd2a8('0x52'),_0xd2a8('0x53'),_0xd2a8('0x54'),'duration_hours','duration_minutes',_0xd2a8('0x55'),_0xd2a8('0x56'),_0xd2a8('0x57'),_0xd2a8('0x58')];return db['SugarcrmAccount'][_0xd2a8('0x48')]({'where':{'id':_0x1c098b[_0xd2a8('0x41')]['id']},'attributes':['id',_0xd2a8('0x59'),_0xd2a8('0x5a'),_0xd2a8('0x5b')]})[_0xd2a8('0x21')](handleEntityNotFound(_0x3630c0,null))[_0xd2a8('0x21')](function(_0x485f3c){if(_0x485f3c){_0x17d38c=_0x485f3c['remoteUri'];var _0xdb77e2=_0x17d38c[_0xd2a8('0x5c')](-0x1);if(_0xdb77e2==='/'){_0x17d38c=_0x17d38c[_0xd2a8('0x5d')](0x0,_0x17d38c['lastIndexOf'](_0xdb77e2));}return rp({'method':_0xd2a8('0x5e'),'uri':util[_0xd2a8('0x5f')](_0xd2a8('0x60'),_0x17d38c,_0xd2a8('0x61')),'json':!![],'form':{'method':_0xd2a8('0x62'),'input_type':_0xd2a8('0x63'),'response_type':_0xd2a8('0x63'),'rest_data':JSON[_0xd2a8('0x64')]({'user_auth':{'user_name':_0x485f3c[_0xd2a8('0x59')],'password':_0x485f3c[_0xd2a8('0x5a')],'encryption':_0xd2a8('0x65')},'application':_0xd2a8('0x66')})}});}})[_0xd2a8('0x21')](function(_0x55d992){if(_0x55d992&&_0x55d992[_0xd2a8('0x24')]!=='Invalid\x20Login'&&_0x55d992['name']!==_0xd2a8('0x67')){return rp({'method':_0xd2a8('0x5e'),'uri':util[_0xd2a8('0x5f')](_0xd2a8('0x60'),_0x17d38c,_0xd2a8('0x61')),'json':!![],'form':{'method':_0xd2a8('0x68'),'input_type':_0xd2a8('0x63'),'response_type':_0xd2a8('0x63'),'rest_data':JSON[_0xd2a8('0x64')]({'session':_0x55d992['id'],'module_name':'Calls'})}})[_0xd2a8('0x21')](function(_0x4dfc69){if(_0x4dfc69){var _0x42f543=_['values'](_0x4dfc69['module_fields']);_[_0xd2a8('0x69')](_0x42f543,function(_0x392753){return _0xde5e20[_0xd2a8('0x6a')](_0x392753['name']);});return{'count':_0x42f543[_0xd2a8('0x32')],'rows':_[_0xd2a8('0x27')](_0x42f543,function(_0x16fe76){return{'id':_0x16fe76[_0xd2a8('0x24')],'name':_0x16fe76[_0xd2a8('0x6b')],'custom':_[_0xd2a8('0x6c')](_0x16fe76[_0xd2a8('0x24')],'_c')?!![]:![],'options':_0x16fe76['options']?_[_0xd2a8('0x27')](_[_0xd2a8('0x6d')](_0x16fe76['options']),function(_0x5a6d51){return{'name':_0x5a6d51[_0xd2a8('0x6e')],'value':_0x5a6d51[_0xd2a8('0x24')]};}):[]};})};}})[_0xd2a8('0x21')](respondWithResult(_0x3630c0,null))[_0xd2a8('0x3f')](function(_0x2fc7bd){var _0x15ef5e=_0x1c098b[_0xd2a8('0x2d')]['test']?0x1f4:_0x2fc7bd['statusCode']||0x1f4;logger['error'](_0xd2a8('0x6f'),_0xd2a8('0x50'),_0x15ef5e,JSON[_0xd2a8('0x64')](_0x2fc7bd));delete _0x2fc7bd[_0xd2a8('0x24')];if(_0x15ef5e===0x191){_0x15ef5e=0x190;}_0x3630c0[_0xd2a8('0x15')](_0x15ef5e)[_0xd2a8('0x25')](_0x1c098b[_0xd2a8('0x2d')][_0xd2a8('0x70')]?{'message':_0xd2a8('0x71'),'statusCode':_0x2fc7bd[_0xd2a8('0x72')]}:_0x2fc7bd);});}else{var _0x360400=0x1f4;_0x3630c0[_0xd2a8('0x15')](_0x360400)[_0xd2a8('0x25')]({'message':_0xd2a8('0x71'),'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 cc7eaad..8596d69 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 _0xde53=['define','int_sugarcrm_accounts','lodash','util','api','moment','bluebird','request-promise','path','./intSugarcrmAccount.attributes','exports'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0xde53,0x199));var _0x3de5=function(_0x565052,_0x1c7477){_0x565052=_0x565052-0x0;var _0xba1f55=_0xde53[_0x565052];return _0xba1f55;};'use strict';var _=require(_0x3de5('0x0'));var util=require(_0x3de5('0x1'));var logger=require('../../config/logger')(_0x3de5('0x2'));var moment=require(_0x3de5('0x3'));var BPromise=require(_0x3de5('0x4'));var rp=require(_0x3de5('0x5'));var fs=require('fs');var path=require(_0x3de5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3de5('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x3de5('0x8')]=function(_0x405c3f,_0x3d2563){return _0x405c3f[_0x3de5('0x9')]('SugarcrmAccount',attributes,{'tableName':_0x3de5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b74=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','int_sugarcrm_accounts','lodash'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0x4b74,0x103));var _0x44b7=function(_0x4e95fa,_0xa0d61){_0x4e95fa=_0x4e95fa-0x0;var _0x689dc6=_0x4b74[_0x4e95fa];return _0x689dc6;};'use strict';var _=require(_0x44b7('0x0'));var util=require(_0x44b7('0x1'));var logger=require(_0x44b7('0x2'))('api');var moment=require(_0x44b7('0x3'));var BPromise=require(_0x44b7('0x4'));var rp=require(_0x44b7('0x5'));var fs=require('fs');var path=require(_0x44b7('0x6'));var rimraf=require(_0x44b7('0x7'));var config=require(_0x44b7('0x8'));var attributes=require(_0x44b7('0x9'));var integrations=require(_0x44b7('0xa'));module['exports']=function(_0xdfcf5,_0x2174f2){return _0xdfcf5[_0x44b7('0xb')]('SugarcrmAccount',attributes,{'tableName':_0x44b7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index c52949a..8a6a9e5 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 _0x3782=['then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowSugarcrmAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0x3782,0x128));var _0x2378=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3782[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2378('0x0'));var BPromise=require(_0x2378('0x1'));var rs=require(_0x2378('0x2'));var fs=require('fs');var Redis=require(_0x2378('0x3'));var db=require(_0x2378('0x4'))['db'];var utils=require(_0x2378('0x5'));var logger=require(_0x2378('0x6'))(_0x2378('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2378('0x8')][_0x2378('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x431239,_0x408ddd,_0x2ae103){return new BPromise(function(_0x20490a,_0x49ceed){return client['request'](_0x431239,_0x2ae103)[_0x2378('0xa')](function(_0x2721ee){logger['info'](_0x2378('0xb'),_0x408ddd,_0x2378('0xc'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x408ddd,_0x2378('0xc'),JSON['stringify'](_0x2721ee));if(_0x2721ee['error']){if(_0x2721ee[_0x2378('0xd')][_0x2378('0xe')]===0x1f4){logger[_0x2378('0xd')](_0x2378('0xb'),_0x408ddd,_0x2721ee[_0x2378('0xd')][_0x2378('0xf')]);return _0x49ceed(_0x2721ee['error'][_0x2378('0xf')]);}logger['error'](_0x2378('0xb'),_0x408ddd,_0x2721ee[_0x2378('0xd')][_0x2378('0xf')]);return _0x20490a(_0x2721ee[_0x2378('0xd')][_0x2378('0xf')]);}else{logger[_0x2378('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x408ddd,_0x2378('0xc'));_0x20490a(_0x2721ee[_0x2378('0x11')][_0x2378('0xf')]);}})[_0x2378('0x12')](function(_0x24b6f2){logger[_0x2378('0xd')](_0x2378('0xb'),_0x408ddd,_0x24b6f2);_0x49ceed(_0x24b6f2);});});}exports[_0x2378('0x13')]=function(_0xc04512){var _0x2272a9=this;return new Promise(function(_0x33a2ce,_0x36d26e){return db[_0x2378('0x14')][_0x2378('0x15')]({'raw':_0xc04512[_0x2378('0x16')]?_0xc04512[_0x2378('0x16')][_0x2378('0x17')]===undefined?!![]:![]:!![],'where':_0xc04512[_0x2378('0x16')]?_0xc04512[_0x2378('0x16')][_0x2378('0x18')]||null:null,'attributes':_0xc04512[_0x2378('0x16')]?_0xc04512['options'][_0x2378('0x19')]||null:null,'limit':_0xc04512[_0x2378('0x16')]?_0xc04512[_0x2378('0x16')][_0x2378('0x1a')]||null:null,'include':_0xc04512[_0x2378('0x16')]?_0xc04512[_0x2378('0x16')]['include']?_['map'](_0xc04512['options'][_0x2378('0x1b')],function(_0x5c7c0b){return{'model':db[_0x5c7c0b['model']],'as':_0x5c7c0b['as'],'attributes':_0x5c7c0b[_0x2378('0x19')],'include':_0x5c7c0b[_0x2378('0x1b')]?_[_0x2378('0x1c')](_0x5c7c0b[_0x2378('0x1b')],function(_0x14ddb6){return{'model':db[_0x14ddb6[_0x2378('0x1d')]],'as':_0x14ddb6['as'],'attributes':_0x14ddb6[_0x2378('0x19')],'include':_0x14ddb6[_0x2378('0x1b')]?_[_0x2378('0x1c')](_0x14ddb6['include'],function(_0x3e97e2){return{'model':db[_0x3e97e2[_0x2378('0x1d')]],'as':_0x3e97e2['as'],'attributes':_0x3e97e2['attributes']};}):[]};}):[]};}):[]:[]})[_0x2378('0xa')](function(_0x345ba3){logger[_0x2378('0x10')]('GetSugarcrmAccount',_0xc04512);logger[_0x2378('0x1e')]('GetSugarcrmAccount',_0xc04512,JSON[_0x2378('0x1f')](_0x345ba3));_0x33a2ce(_0x345ba3);})['catch'](function(_0x334a34){logger[_0x2378('0xd')]('GetSugarcrmAccount',_0x334a34[_0x2378('0xf')],_0xc04512);_0x36d26e(_0x2272a9[_0x2378('0xd')](0x1f4,_0x334a34[_0x2378('0xf')]));});});};exports[_0x2378('0x20')]=function(_0x5a8e54){var _0x292008=this;return new Promise(function(_0x44905b,_0x7d6c51){return db[_0x2378('0x14')][_0x2378('0x21')]({'raw':_0x5a8e54[_0x2378('0x16')]?_0x5a8e54['options'][_0x2378('0x17')]===undefined?!![]:![]:!![],'where':_0x5a8e54[_0x2378('0x16')]?_0x5a8e54[_0x2378('0x16')][_0x2378('0x18')]||null:null,'attributes':_0x5a8e54[_0x2378('0x16')]?_0x5a8e54['options']['attributes']||null:null,'include':_0x5a8e54[_0x2378('0x16')]?_0x5a8e54[_0x2378('0x16')][_0x2378('0x1b')]?_['map'](_0x5a8e54[_0x2378('0x16')][_0x2378('0x1b')],function(_0xabb506){return{'model':db[_0xabb506[_0x2378('0x1d')]],'as':_0xabb506['as'],'attributes':_0xabb506[_0x2378('0x19')],'include':_0xabb506['include']?_[_0x2378('0x1c')](_0xabb506[_0x2378('0x1b')],function(_0x2027ea){return{'model':db[_0x2027ea[_0x2378('0x1d')]],'as':_0x2027ea['as'],'attributes':_0x2027ea[_0x2378('0x19')],'include':_0x2027ea[_0x2378('0x1b')]?_[_0x2378('0x1c')](_0x2027ea[_0x2378('0x1b')],function(_0x55b6a1){return{'model':db[_0x55b6a1[_0x2378('0x1d')]],'as':_0x55b6a1['as'],'attributes':_0x55b6a1[_0x2378('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2378('0xa')](function(_0x17a290){logger[_0x2378('0x10')](_0x2378('0x20'),_0x5a8e54);logger[_0x2378('0x1e')](_0x2378('0x20'),_0x5a8e54,JSON['stringify'](_0x17a290));_0x44905b(_0x17a290);})['catch'](function(_0xf33392){logger[_0x2378('0xd')](_0x2378('0x20'),_0xf33392[_0x2378('0xf')],_0x5a8e54);_0x7d6c51(_0x292008[_0x2378('0xd')](0x1f4,_0xf33392[_0x2378('0xf')]));});});}; \ No newline at end of file +var _0x5d9b=['SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','GetSugarcrmAccount','options','raw','limit','include','model','attributes','map','catch','ShowSugarcrmAccount','SugarcrmAccount','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x5d9b,0x7e));var _0xb5d9=function(_0x2744d4,_0x26840d){_0x2744d4=_0x2744d4-0x0;var _0x2e9b46=_0x5d9b[_0x2744d4];return _0x2e9b46;};'use strict';var _=require(_0xb5d9('0x0'));var util=require(_0xb5d9('0x1'));var moment=require('moment');var BPromise=require(_0xb5d9('0x2'));var rs=require(_0xb5d9('0x3'));var fs=require('fs');var Redis=require(_0xb5d9('0x4'));var db=require(_0xb5d9('0x5'))['db'];var utils=require(_0xb5d9('0x6'));var logger=require(_0xb5d9('0x7'))(_0xb5d9('0x8'));var config=require(_0xb5d9('0x9'));var jayson=require(_0xb5d9('0xa'));var client=jayson[_0xb5d9('0xb')][_0xb5d9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c797a,_0x28b2e9,_0x2a497e){return new BPromise(function(_0x39d34,_0x34798b){return client[_0xb5d9('0xd')](_0x1c797a,_0x2a497e)[_0xb5d9('0xe')](function(_0x43a0ce){logger[_0xb5d9('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x28b2e9,_0xb5d9('0x10'));logger[_0xb5d9('0x11')](_0xb5d9('0x12'),_0x28b2e9,_0xb5d9('0x10'),JSON[_0xb5d9('0x13')](_0x43a0ce));if(_0x43a0ce[_0xb5d9('0x14')]){if(_0x43a0ce[_0xb5d9('0x14')]['code']===0x1f4){logger['error'](_0xb5d9('0x15'),_0x28b2e9,_0x43a0ce[_0xb5d9('0x14')]['message']);return _0x34798b(_0x43a0ce[_0xb5d9('0x14')][_0xb5d9('0x16')]);}logger[_0xb5d9('0x14')](_0xb5d9('0x15'),_0x28b2e9,_0x43a0ce['error'][_0xb5d9('0x16')]);return _0x39d34(_0x43a0ce[_0xb5d9('0x14')]['message']);}else{logger[_0xb5d9('0xf')](_0xb5d9('0x15'),_0x28b2e9,_0xb5d9('0x10'));_0x39d34(_0x43a0ce['result'][_0xb5d9('0x16')]);}})['catch'](function(_0x54c372){logger[_0xb5d9('0x14')](_0xb5d9('0x15'),_0x28b2e9,_0x54c372);_0x34798b(_0x54c372);});});}exports[_0xb5d9('0x17')]=function(_0x50eefc){var _0x3f2a8d=this;return new Promise(function(_0x3ff0f0,_0x254726){return db['SugarcrmAccount']['findAll']({'raw':_0x50eefc[_0xb5d9('0x18')]?_0x50eefc[_0xb5d9('0x18')][_0xb5d9('0x19')]===undefined?!![]:![]:!![],'where':_0x50eefc[_0xb5d9('0x18')]?_0x50eefc['options']['where']||null:null,'attributes':_0x50eefc[_0xb5d9('0x18')]?_0x50eefc[_0xb5d9('0x18')]['attributes']||null:null,'limit':_0x50eefc[_0xb5d9('0x18')]?_0x50eefc[_0xb5d9('0x18')][_0xb5d9('0x1a')]||null:null,'include':_0x50eefc[_0xb5d9('0x18')]?_0x50eefc[_0xb5d9('0x18')][_0xb5d9('0x1b')]?_['map'](_0x50eefc[_0xb5d9('0x18')]['include'],function(_0x2d429e){return{'model':db[_0x2d429e[_0xb5d9('0x1c')]],'as':_0x2d429e['as'],'attributes':_0x2d429e[_0xb5d9('0x1d')],'include':_0x2d429e[_0xb5d9('0x1b')]?_[_0xb5d9('0x1e')](_0x2d429e[_0xb5d9('0x1b')],function(_0x25820e){return{'model':db[_0x25820e[_0xb5d9('0x1c')]],'as':_0x25820e['as'],'attributes':_0x25820e[_0xb5d9('0x1d')],'include':_0x25820e[_0xb5d9('0x1b')]?_[_0xb5d9('0x1e')](_0x25820e[_0xb5d9('0x1b')],function(_0x236882){return{'model':db[_0x236882['model']],'as':_0x236882['as'],'attributes':_0x236882[_0xb5d9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb5d9('0xe')](function(_0x100af5){logger[_0xb5d9('0xf')](_0xb5d9('0x17'),_0x50eefc);logger[_0xb5d9('0x11')](_0xb5d9('0x17'),_0x50eefc,JSON[_0xb5d9('0x13')](_0x100af5));_0x3ff0f0(_0x100af5);})[_0xb5d9('0x1f')](function(_0xf45a3){logger[_0xb5d9('0x14')](_0xb5d9('0x17'),_0xf45a3['message'],_0x50eefc);_0x254726(_0x3f2a8d[_0xb5d9('0x14')](0x1f4,_0xf45a3[_0xb5d9('0x16')]));});});};exports[_0xb5d9('0x20')]=function(_0x4703ed){var _0x41f1f4=this;return new Promise(function(_0x47731e,_0xa0cb12){return db[_0xb5d9('0x21')][_0xb5d9('0x22')]({'raw':_0x4703ed[_0xb5d9('0x18')]?_0x4703ed['options'][_0xb5d9('0x19')]===undefined?!![]:![]:!![],'where':_0x4703ed[_0xb5d9('0x18')]?_0x4703ed[_0xb5d9('0x18')][_0xb5d9('0x23')]||null:null,'attributes':_0x4703ed[_0xb5d9('0x18')]?_0x4703ed[_0xb5d9('0x18')][_0xb5d9('0x1d')]||null:null,'include':_0x4703ed[_0xb5d9('0x18')]?_0x4703ed[_0xb5d9('0x18')][_0xb5d9('0x1b')]?_['map'](_0x4703ed[_0xb5d9('0x18')][_0xb5d9('0x1b')],function(_0x4274c0){return{'model':db[_0x4274c0[_0xb5d9('0x1c')]],'as':_0x4274c0['as'],'attributes':_0x4274c0['attributes'],'include':_0x4274c0[_0xb5d9('0x1b')]?_[_0xb5d9('0x1e')](_0x4274c0[_0xb5d9('0x1b')],function(_0x4ae5a3){return{'model':db[_0x4ae5a3[_0xb5d9('0x1c')]],'as':_0x4ae5a3['as'],'attributes':_0x4ae5a3[_0xb5d9('0x1d')],'include':_0x4ae5a3['include']?_[_0xb5d9('0x1e')](_0x4ae5a3['include'],function(_0x175d15){return{'model':db[_0x175d15[_0xb5d9('0x1c')]],'as':_0x175d15['as'],'attributes':_0x175d15['attributes']};}):[]};}):[]};}):[]:[]})[_0xb5d9('0xe')](function(_0x2c9af8){logger[_0xb5d9('0xf')](_0xb5d9('0x20'),_0x4703ed);logger[_0xb5d9('0x11')]('ShowSugarcrmAccount',_0x4703ed,JSON[_0xb5d9('0x13')](_0x2c9af8));_0x47731e(_0x2c9af8);})['catch'](function(_0x4c5d8d){logger[_0xb5d9('0x14')](_0xb5d9('0x20'),_0x4c5d8d[_0xb5d9('0x16')],_0x4703ed);_0xa0cb12(_0x41f1f4[_0xb5d9('0x14')](0x1f4,_0x4c5d8d[_0xb5d9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index bfb8d10..90441ab 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 _0xec07=['getSubjects','/:id/descriptions','post','put','update','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects'];(function(_0x4a8a55,_0x2d3009){var _0x1de991=function(_0x5997ad){while(--_0x5997ad){_0x4a8a55['push'](_0x4a8a55['shift']());}};_0x1de991(++_0x2d3009);}(_0xec07,0xf8));var _0x7ec0=function(_0x2e2925,_0x82a160){_0x2e2925=_0x2e2925-0x0;var _0x595245=_0xec07[_0x2e2925];return _0x595245;};'use strict';var multer=require('multer');var util=require(_0x7ec0('0x0'));var path=require(_0x7ec0('0x1'));var timeout=require(_0x7ec0('0x2'));var express=require('express');var router=express[_0x7ec0('0x3')]();var fs_extra=require(_0x7ec0('0x4'));var auth=require(_0x7ec0('0x5'));var interaction=require(_0x7ec0('0x6'));var config=require(_0x7ec0('0x7'));var controller=require(_0x7ec0('0x8'));router[_0x7ec0('0x9')]('/',auth['isAuthenticated'](),controller[_0x7ec0('0xa')]);router[_0x7ec0('0x9')](_0x7ec0('0xb'),auth[_0x7ec0('0xc')](),controller[_0x7ec0('0xd')]);router['get'](_0x7ec0('0xe'),auth[_0x7ec0('0xc')](),controller['getFields']);router[_0x7ec0('0x9')](_0x7ec0('0xf'),auth[_0x7ec0('0xc')](),controller[_0x7ec0('0x10')]);router[_0x7ec0('0x9')](_0x7ec0('0x11'),auth[_0x7ec0('0xc')](),controller['getDescriptions']);router[_0x7ec0('0x12')]('/',auth[_0x7ec0('0xc')](),controller['create']);router[_0x7ec0('0x13')](_0x7ec0('0xb'),auth[_0x7ec0('0xc')](),controller[_0x7ec0('0x14')]);router['delete']('/:id',auth[_0x7ec0('0xc')](),controller[_0x7ec0('0x15')]);module['exports']=router; \ No newline at end of file +var _0xbc59=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','/:id','update','destroy','exports','multer','util','path'];(function(_0x496918,_0x22b207){var _0x5c875d=function(_0x9e940a){while(--_0x9e940a){_0x496918['push'](_0x496918['shift']());}};_0x5c875d(++_0x22b207);}(_0xbc59,0x75));var _0x9bc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc59[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9bc5('0x0'));var util=require(_0x9bc5('0x1'));var path=require(_0x9bc5('0x2'));var timeout=require(_0x9bc5('0x3'));var express=require(_0x9bc5('0x4'));var router=express[_0x9bc5('0x5')]();var fs_extra=require(_0x9bc5('0x6'));var auth=require(_0x9bc5('0x7'));var interaction=require(_0x9bc5('0x8'));var config=require(_0x9bc5('0x9'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x9bc5('0xa')]('/',auth[_0x9bc5('0xb')](),controller[_0x9bc5('0xc')]);router['get']('/:id',auth[_0x9bc5('0xb')](),controller[_0x9bc5('0xd')]);router[_0x9bc5('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x9bc5('0xe')]);router[_0x9bc5('0xa')](_0x9bc5('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x9bc5('0x10'),auth['isAuthenticated'](),controller[_0x9bc5('0x11')]);router[_0x9bc5('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9bc5('0x13')](_0x9bc5('0x14'),auth['isAuthenticated'](),controller[_0x9bc5('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9bc5('0x16')]);module[_0x9bc5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 88168df..0a5a2c8 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 _0xd9d7=['sequelize','exports','STRING'];(function(_0x161a9a,_0x11c775){var _0x2b95de=function(_0x385238){while(--_0x385238){_0x161a9a['push'](_0x161a9a['shift']());}};_0x2b95de(++_0x11c775);}(_0xd9d7,0xf9));var _0x7d9d=function(_0x5a979b,_0x17a473){_0x5a979b=_0x5a979b-0x0;var _0x1abd9a=_0xd9d7[_0x5a979b];return _0x1abd9a;};'use strict';var Sequelize=require(_0x7d9d('0x0'));module[_0x7d9d('0x1')]={'name':{'type':Sequelize[_0x7d9d('0x2')]},'description':{'type':Sequelize[_0x7d9d('0x2')]}}; \ No newline at end of file +var _0x788a=['STRING','sequelize'];(function(_0x5a3ba1,_0x23c154){var _0x5dcc34=function(_0x579d3e){while(--_0x579d3e){_0x5a3ba1['push'](_0x5a3ba1['shift']());}};_0x5dcc34(++_0x23c154);}(_0x788a,0xb9));var _0xa788=function(_0x444d2f,_0x2927b9){_0x444d2f=_0x444d2f-0x0;var _0x18ae46=_0x788a[_0x444d2f];return _0x18ae46;};'use strict';var Sequelize=require(_0xa788('0x0'));module['exports']={'name':{'type':Sequelize[_0xa788('0x1')]},'description':{'type':Sequelize[_0xa788('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 8ece508..467eb45 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 _0xdb85=['findOne','SugarcrmField','length','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','destroy','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body'];(function(_0x5b679b,_0x4f981d){var _0x337f99=function(_0x414596){while(--_0x414596){_0x5b679b['push'](_0x5b679b['shift']());}};_0x337f99(++_0x4f981d);}(_0xdb85,0x1a5));var _0x5db8=function(_0xed4881,_0x45771c){_0xed4881=_0xed4881-0x0;var _0x7fcbd5=_0xdb85[_0xed4881];return _0x7fcbd5;};'use strict';var emlformat=require(_0x5db8('0x0'));var rimraf=require(_0x5db8('0x1'));var zipdir=require(_0x5db8('0x2'));var jsonpatch=require(_0x5db8('0x3'));var rp=require(_0x5db8('0x4'));var moment=require(_0x5db8('0x5'));var BPromise=require(_0x5db8('0x6'));var Mustache=require(_0x5db8('0x7'));var util=require('util');var path=require(_0x5db8('0x8'));var sox=require(_0x5db8('0x9'));var csv=require(_0x5db8('0xa'));var ejs=require(_0x5db8('0xb'));var fs=require('fs');var fs_extra=require(_0x5db8('0xc'));var _=require(_0x5db8('0xd'));var squel=require(_0x5db8('0xe'));var crypto=require('crypto');var jsforce=require(_0x5db8('0xf'));var deskjs=require(_0x5db8('0x10'));var toCsv=require(_0x5db8('0xa'));var querystring=require('querystring');var Papa=require(_0x5db8('0x11'));var Redis=require(_0x5db8('0x12'));var authService=require(_0x5db8('0x13'));var qs=require(_0x5db8('0x14'));var as=require(_0x5db8('0x15'));var hardwareService=require(_0x5db8('0x16'));var logger=require(_0x5db8('0x17'))(_0x5db8('0x18'));var utils=require('../../config/utils');var config=require(_0x5db8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5db8('0x1a'))['db'];function respondWithStatusCode(_0x2c6d26,_0x8ba7e7){_0x8ba7e7=_0x8ba7e7||0xcc;return function(_0x6a437b){if(_0x6a437b){return _0x2c6d26[_0x5db8('0x1b')](_0x8ba7e7);}return _0x2c6d26[_0x5db8('0x1c')](_0x8ba7e7)[_0x5db8('0x1d')]();};}function respondWithResult(_0x7384e6,_0x507e69){_0x507e69=_0x507e69||0xc8;return function(_0xe58913){if(_0xe58913){return _0x7384e6[_0x5db8('0x1c')](_0x507e69)['json'](_0xe58913);}};}function respondWithFilteredResult(_0x38161e,_0xc0cdeb){return function(_0x4e9be5){if(_0x4e9be5){var _0x2b403b=typeof _0xc0cdeb['offset']===_0x5db8('0x1e')&&typeof _0xc0cdeb[_0x5db8('0x1f')]===_0x5db8('0x1e');var _0x84b4b4=_0x4e9be5[_0x5db8('0x20')];var _0x2557da=_0x2b403b?0x0:_0xc0cdeb[_0x5db8('0x21')];var _0x24b64e=_0x2b403b?_0x4e9be5[_0x5db8('0x20')]:_0xc0cdeb[_0x5db8('0x21')]+_0xc0cdeb[_0x5db8('0x1f')];var _0xd8f91a;if(_0x24b64e>=_0x84b4b4){_0x24b64e=_0x84b4b4;_0xd8f91a=0xc8;}else{_0xd8f91a=0xce;}_0x38161e['status'](_0xd8f91a);return _0x38161e[_0x5db8('0x22')]('Content-Range',_0x2557da+'-'+_0x24b64e+'/'+_0x84b4b4)[_0x5db8('0x23')](_0x4e9be5);}return null;};}function patchUpdates(_0x59a7ac){return function(_0x558855){try{jsonpatch[_0x5db8('0x24')](_0x558855,_0x59a7ac,!![]);}catch(_0x4f4ac7){return BPromise['reject'](_0x4f4ac7);}return _0x558855[_0x5db8('0x25')]();};}function saveUpdates(_0x3832aa,_0x4e01c0){return function(_0x40d16f){if(_0x40d16f){return _0x40d16f[_0x5db8('0x26')](_0x3832aa)[_0x5db8('0x27')](function(_0x485923){return _0x485923;});}return null;};}function removeEntity(_0x4ca820,_0x1e9254){return function(_0x16dcf1){if(_0x16dcf1){return _0x16dcf1[_0x5db8('0x28')]()['then'](function(){_0x4ca820['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15b88a,_0x5991a4){return function(_0x1b8e2c){if(!_0x1b8e2c){_0x15b88a[_0x5db8('0x1b')](0x194);}return _0x1b8e2c;};}function handleError(_0x231633,_0x27810b){_0x27810b=_0x27810b||0x1f4;return function(_0x2e61d4){logger[_0x5db8('0x29')](_0x2e61d4[_0x5db8('0x2a')]);if(_0x2e61d4[_0x5db8('0x2b')]){delete _0x2e61d4['name'];}_0x231633[_0x5db8('0x1c')](_0x27810b)[_0x5db8('0x2c')](_0x2e61d4);};}exports[_0x5db8('0x2d')]=function(_0x5480f0,_0x496035){var _0x2af031={},_0x596d5f={},_0x1addf7={'count':0x0,'rows':[]};var _0x1b5df7=_['map'](db[_0x5db8('0x2e')][_0x5db8('0x2f')],function(_0x3a4002){return{'name':_0x3a4002['fieldName'],'type':_0x3a4002[_0x5db8('0x30')][_0x5db8('0x31')]};});_0x596d5f[_0x5db8('0x32')]=_[_0x5db8('0x33')](_0x1b5df7,_0x5db8('0x2b'));_0x596d5f[_0x5db8('0x34')]=_[_0x5db8('0x35')](_0x5480f0[_0x5db8('0x34')]);_0x596d5f[_0x5db8('0x36')]=_[_0x5db8('0x37')](_0x596d5f[_0x5db8('0x32')],_0x596d5f[_0x5db8('0x34')]);_0x2af031[_0x5db8('0x38')]=_[_0x5db8('0x37')](_0x596d5f[_0x5db8('0x32')],qs[_0x5db8('0x39')](_0x5480f0[_0x5db8('0x34')][_0x5db8('0x39')]));_0x2af031[_0x5db8('0x38')]=_0x2af031[_0x5db8('0x38')]['length']?_0x2af031[_0x5db8('0x38')]:_0x596d5f[_0x5db8('0x32')];if(!_0x5480f0[_0x5db8('0x34')][_0x5db8('0x3a')](_0x5db8('0x3b'))){_0x2af031[_0x5db8('0x1f')]=qs['limit'](_0x5480f0[_0x5db8('0x34')][_0x5db8('0x1f')]);_0x2af031['offset']=qs[_0x5db8('0x21')](_0x5480f0[_0x5db8('0x34')][_0x5db8('0x21')]);}_0x2af031[_0x5db8('0x3c')]=qs[_0x5db8('0x3d')](_0x5480f0[_0x5db8('0x34')][_0x5db8('0x3d')]);_0x2af031[_0x5db8('0x3e')]=qs[_0x5db8('0x36')](_[_0x5db8('0x3f')](_0x5480f0[_0x5db8('0x34')],_0x596d5f[_0x5db8('0x36')]),_0x1b5df7);if(_0x5480f0[_0x5db8('0x34')][_0x5db8('0x40')]){_0x2af031[_0x5db8('0x3e')]=_[_0x5db8('0x41')](_0x2af031[_0x5db8('0x3e')],{'$or':_[_0x5db8('0x33')](_0x1b5df7,function(_0x24add6){if(_0x24add6[_0x5db8('0x30')]!==_0x5db8('0x42')){var _0x5d4774={};_0x5d4774[_0x24add6[_0x5db8('0x2b')]]={'$like':'%'+_0x5480f0[_0x5db8('0x34')][_0x5db8('0x40')]+'%'};return _0x5d4774;}})});}_0x2af031=_[_0x5db8('0x41')]({},_0x2af031,_0x5480f0[_0x5db8('0x43')]);var _0x5956bf={'where':_0x2af031['where']};return db[_0x5db8('0x2e')]['count'](_0x5956bf)['then'](function(_0x486dab){_0x1addf7[_0x5db8('0x20')]=_0x486dab;if(_0x5480f0[_0x5db8('0x34')][_0x5db8('0x44')]){_0x2af031['include']=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x5db8('0x45')](_0x2af031);})[_0x5db8('0x27')](function(_0x33e759){_0x1addf7[_0x5db8('0x46')]=_0x33e759;return _0x1addf7;})[_0x5db8('0x27')](respondWithFilteredResult(_0x496035,_0x2af031))[_0x5db8('0x47')](handleError(_0x496035,null));};exports[_0x5db8('0x48')]=function(_0x5cf9b6,_0x275740){var _0x3dd419={'raw':![],'where':{'id':_0x5cf9b6[_0x5db8('0x49')]['id']}},_0x1ca720={};_0x1ca720[_0x5db8('0x32')]=_['keys'](db['SugarcrmConfiguration'][_0x5db8('0x2f')]);_0x1ca720[_0x5db8('0x34')]=_[_0x5db8('0x35')](_0x5cf9b6['query']);_0x1ca720[_0x5db8('0x36')]=_[_0x5db8('0x37')](_0x1ca720['model'],_0x1ca720['query']);_0x3dd419[_0x5db8('0x38')]=_[_0x5db8('0x37')](_0x1ca720['model'],qs[_0x5db8('0x39')](_0x5cf9b6[_0x5db8('0x34')][_0x5db8('0x39')]));_0x3dd419[_0x5db8('0x38')]=_0x3dd419[_0x5db8('0x38')]['length']?_0x3dd419['attributes']:_0x1ca720['model'];if(_0x5cf9b6[_0x5db8('0x34')][_0x5db8('0x44')]){_0x3dd419['include']=[{'all':!![]}];}_0x3dd419=_['merge']({},_0x3dd419,_0x5cf9b6[_0x5db8('0x43')]);return db['SugarcrmConfiguration'][_0x5db8('0x4a')](_0x3dd419)[_0x5db8('0x27')](handleEntityNotFound(_0x275740,null))[_0x5db8('0x27')](respondWithResult(_0x275740,null))['catch'](handleError(_0x275740,null));};exports[_0x5db8('0x4b')]=function(_0x3d3a10,_0x31a0ab){return db[_0x5db8('0x2e')][_0x5db8('0x4b')](_0x3d3a10[_0x5db8('0x4c')],{})[_0x5db8('0x27')](respondWithResult(_0x31a0ab,0xc9))['catch'](handleError(_0x31a0ab,null));};exports[_0x5db8('0x26')]=function(_0x45655d,_0x131cdd){if(_0x45655d['body']['id']){delete _0x45655d[_0x5db8('0x4c')]['id'];}return db[_0x5db8('0x2e')][_0x5db8('0x4a')]({'where':{'id':_0x45655d[_0x5db8('0x49')]['id']}})[_0x5db8('0x27')](handleEntityNotFound(_0x131cdd,null))[_0x5db8('0x27')](saveUpdates(_0x45655d[_0x5db8('0x4c')],null))[_0x5db8('0x27')](respondWithResult(_0x131cdd,null))['catch'](handleError(_0x131cdd,null));};exports['destroy']=function(_0x1db7a1,_0x428cc4){return db[_0x5db8('0x2e')]['find']({'where':{'id':_0x1db7a1['params']['id']}})[_0x5db8('0x27')](handleEntityNotFound(_0x428cc4,null))[_0x5db8('0x27')](removeEntity(_0x428cc4,null))[_0x5db8('0x47')](handleError(_0x428cc4,null));};exports['getFields']=function(_0x20e401,_0xaba0ef,_0x547507){var _0x53c557={};var _0x5f4c43={};var _0x361e5b;var _0x3ba8ca;return db[_0x5db8('0x2e')][_0x5db8('0x4d')]({'where':{'id':_0x20e401[_0x5db8('0x49')]['id']}})[_0x5db8('0x27')](handleEntityNotFound(_0xaba0ef,null))[_0x5db8('0x27')](function(_0x1f9283){if(_0x1f9283){_0x361e5b=_0x1f9283;_0x5f4c43[_0x5db8('0x32')]=_[_0x5db8('0x35')](db[_0x5db8('0x4e')][_0x5db8('0x2f')]);_0x5f4c43[_0x5db8('0x34')]=_[_0x5db8('0x35')](_0x20e401[_0x5db8('0x34')]);_0x5f4c43[_0x5db8('0x36')]=_[_0x5db8('0x37')](_0x5f4c43[_0x5db8('0x32')],_0x5f4c43[_0x5db8('0x34')]);_0x53c557[_0x5db8('0x38')]=_[_0x5db8('0x37')](_0x5f4c43[_0x5db8('0x32')],qs[_0x5db8('0x39')](_0x20e401[_0x5db8('0x34')][_0x5db8('0x39')]));_0x53c557[_0x5db8('0x38')]=_0x53c557['attributes'][_0x5db8('0x4f')]?_0x53c557['attributes']:_0x5f4c43[_0x5db8('0x32')];_0x53c557[_0x5db8('0x3c')]=qs[_0x5db8('0x3d')](_0x20e401[_0x5db8('0x34')][_0x5db8('0x3d')]);_0x53c557[_0x5db8('0x3e')]=qs[_0x5db8('0x36')](_[_0x5db8('0x3f')](_0x20e401['query'],_0x5f4c43[_0x5db8('0x36')]));if(_0x20e401['query']['filter']){_0x53c557[_0x5db8('0x3e')]=_['merge'](_0x53c557['where'],{'$or':_[_0x5db8('0x33')](_0x53c557[_0x5db8('0x38')],function(_0x534dc2){var _0x41f5d5={};_0x41f5d5[_0x534dc2]={'$like':'%'+_0x20e401[_0x5db8('0x34')][_0x5db8('0x40')]+'%'};return _0x41f5d5;})});}_0x53c557=_[_0x5db8('0x41')]({},_0x53c557,_0x20e401[_0x5db8('0x43')]);return _0x361e5b[_0x5db8('0x50')](_0x53c557);}})[_0x5db8('0x27')](function(_0x1f10cf){if(_0x1f10cf){_0x3ba8ca=_0x1f10cf[_0x5db8('0x4f')];if(!_0x20e401[_0x5db8('0x34')][_0x5db8('0x3a')]('nolimit')){_0x53c557['limit']=qs[_0x5db8('0x1f')](_0x20e401[_0x5db8('0x34')][_0x5db8('0x1f')]);_0x53c557[_0x5db8('0x21')]=qs[_0x5db8('0x21')](_0x20e401['query'][_0x5db8('0x21')]);}return _0x361e5b[_0x5db8('0x50')](_0x53c557);}})[_0x5db8('0x27')](function(_0x3dd451){if(_0x3dd451){return _0x3dd451?{'count':_0x3ba8ca,'rows':_0x3dd451}:null;}})[_0x5db8('0x27')](respondWithResult(_0xaba0ef,null))['catch'](handleError(_0xaba0ef,null));};exports[_0x5db8('0x51')]=function(_0x4910b2,_0x17bf63,_0x32be01){var _0x560c92={};var _0x5246fe={};var _0x2f78d5;var _0x66ddbd;return db['SugarcrmConfiguration'][_0x5db8('0x4d')]({'where':{'id':_0x4910b2[_0x5db8('0x49')]['id']}})[_0x5db8('0x27')](handleEntityNotFound(_0x17bf63,null))['then'](function(_0x1e22bd){if(_0x1e22bd){_0x2f78d5=_0x1e22bd;_0x5246fe['model']=_[_0x5db8('0x35')](db[_0x5db8('0x4e')][_0x5db8('0x2f')]);_0x5246fe[_0x5db8('0x34')]=_['keys'](_0x4910b2[_0x5db8('0x34')]);_0x5246fe['filters']=_['intersection'](_0x5246fe['model'],_0x5246fe['query']);_0x560c92['attributes']=_['intersection'](_0x5246fe[_0x5db8('0x32')],qs[_0x5db8('0x39')](_0x4910b2['query'][_0x5db8('0x39')]));_0x560c92['attributes']=_0x560c92['attributes'][_0x5db8('0x4f')]?_0x560c92[_0x5db8('0x38')]:_0x5246fe[_0x5db8('0x32')];_0x560c92[_0x5db8('0x3c')]=qs['sort'](_0x4910b2[_0x5db8('0x34')]['sort']);_0x560c92[_0x5db8('0x3e')]=qs[_0x5db8('0x36')](_['pick'](_0x4910b2[_0x5db8('0x34')],_0x5246fe[_0x5db8('0x36')]));if(_0x4910b2[_0x5db8('0x34')][_0x5db8('0x40')]){_0x560c92[_0x5db8('0x3e')]=_[_0x5db8('0x41')](_0x560c92['where'],{'$or':_[_0x5db8('0x33')](_0x560c92[_0x5db8('0x38')],function(_0x1f936c){var _0x3ecb3a={};_0x3ecb3a[_0x1f936c]={'$like':'%'+_0x4910b2[_0x5db8('0x34')][_0x5db8('0x40')]+'%'};return _0x3ecb3a;})});}_0x560c92=_[_0x5db8('0x41')]({},_0x560c92,_0x4910b2[_0x5db8('0x43')]);return _0x2f78d5[_0x5db8('0x51')](_0x560c92);}})[_0x5db8('0x27')](function(_0x4d6b37){if(_0x4d6b37){_0x66ddbd=_0x4d6b37[_0x5db8('0x4f')];if(!_0x4910b2[_0x5db8('0x34')][_0x5db8('0x3a')](_0x5db8('0x3b'))){_0x560c92[_0x5db8('0x1f')]=qs[_0x5db8('0x1f')](_0x4910b2[_0x5db8('0x34')][_0x5db8('0x1f')]);_0x560c92[_0x5db8('0x21')]=qs[_0x5db8('0x21')](_0x4910b2['query']['offset']);}return _0x2f78d5[_0x5db8('0x51')](_0x560c92);}})['then'](function(_0x55dbf7){if(_0x55dbf7){return _0x55dbf7?{'count':_0x66ddbd,'rows':_0x55dbf7}:null;}})[_0x5db8('0x27')](respondWithResult(_0x17bf63,null))[_0x5db8('0x47')](handleError(_0x17bf63,null));};exports[_0x5db8('0x52')]=function(_0x598498,_0x474d45,_0x5b11b2){var _0x239fa3={};var _0x22d965={};var _0xc84a9e;var _0x1973fb;return db[_0x5db8('0x2e')][_0x5db8('0x4d')]({'where':{'id':_0x598498[_0x5db8('0x49')]['id']}})['then'](handleEntityNotFound(_0x474d45,null))['then'](function(_0x44e5a8){if(_0x44e5a8){_0xc84a9e=_0x44e5a8;_0x22d965['model']=_[_0x5db8('0x35')](db['SugarcrmField']['rawAttributes']);_0x22d965['query']=_['keys'](_0x598498[_0x5db8('0x34')]);_0x22d965[_0x5db8('0x36')]=_['intersection'](_0x22d965['model'],_0x22d965[_0x5db8('0x34')]);_0x239fa3[_0x5db8('0x38')]=_['intersection'](_0x22d965['model'],qs[_0x5db8('0x39')](_0x598498[_0x5db8('0x34')][_0x5db8('0x39')]));_0x239fa3['attributes']=_0x239fa3[_0x5db8('0x38')][_0x5db8('0x4f')]?_0x239fa3[_0x5db8('0x38')]:_0x22d965[_0x5db8('0x32')];_0x239fa3[_0x5db8('0x3c')]=qs[_0x5db8('0x3d')](_0x598498[_0x5db8('0x34')][_0x5db8('0x3d')]);_0x239fa3[_0x5db8('0x3e')]=qs[_0x5db8('0x36')](_['pick'](_0x598498[_0x5db8('0x34')],_0x22d965[_0x5db8('0x36')]));if(_0x598498[_0x5db8('0x34')][_0x5db8('0x40')]){_0x239fa3[_0x5db8('0x3e')]=_[_0x5db8('0x41')](_0x239fa3[_0x5db8('0x3e')],{'$or':_['map'](_0x239fa3[_0x5db8('0x38')],function(_0x2f4ec3){var _0x5a55ed={};_0x5a55ed[_0x2f4ec3]={'$like':'%'+_0x598498[_0x5db8('0x34')]['filter']+'%'};return _0x5a55ed;})});}_0x239fa3=_[_0x5db8('0x41')]({},_0x239fa3,_0x598498[_0x5db8('0x43')]);return _0xc84a9e[_0x5db8('0x52')](_0x239fa3);}})['then'](function(_0x3cc3c8){if(_0x3cc3c8){_0x1973fb=_0x3cc3c8['length'];if(!_0x598498[_0x5db8('0x34')][_0x5db8('0x3a')](_0x5db8('0x3b'))){_0x239fa3['limit']=qs[_0x5db8('0x1f')](_0x598498[_0x5db8('0x34')][_0x5db8('0x1f')]);_0x239fa3[_0x5db8('0x21')]=qs['offset'](_0x598498[_0x5db8('0x34')][_0x5db8('0x21')]);}return _0xc84a9e[_0x5db8('0x52')](_0x239fa3);}})[_0x5db8('0x27')](function(_0x43f73e){if(_0x43f73e){return _0x43f73e?{'count':_0x1973fb,'rows':_0x43f73e}:null;}})[_0x5db8('0x27')](respondWithResult(_0x474d45,null))[_0x5db8('0x47')](handleError(_0x474d45,null));}; \ No newline at end of file +var _0x97b9=['pick','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','name','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','keys','length','includeAll','find','catch','create','body','getFields','SugarcrmField','findOne','order','getSubjects','getDescriptions'];(function(_0x2d852b,_0x2e3378){var _0x5829b1=function(_0x6f922){while(--_0x6f922){_0x2d852b['push'](_0x2d852b['shift']());}};_0x5829b1(++_0x2e3378);}(_0x97b9,0x9f));var _0x997b=function(_0x9ae3d,_0x3c5d51){_0x9ae3d=_0x9ae3d-0x0;var _0x2b6cb1=_0x97b9[_0x9ae3d];return _0x2b6cb1;};'use strict';var emlformat=require(_0x997b('0x0'));var rimraf=require(_0x997b('0x1'));var zipdir=require(_0x997b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x997b('0x3'));var moment=require(_0x997b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x997b('0x5'));var path=require(_0x997b('0x6'));var sox=require(_0x997b('0x7'));var csv=require('to-csv');var ejs=require(_0x997b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x997b('0x9'));var squel=require(_0x997b('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x997b('0xb'));var Papa=require(_0x997b('0xc'));var Redis=require('ioredis');var authService=require(_0x997b('0xd'));var qs=require(_0x997b('0xe'));var as=require(_0x997b('0xf'));var hardwareService=require(_0x997b('0x10'));var logger=require(_0x997b('0x11'))(_0x997b('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x997b('0x13'));var db=require(_0x997b('0x14'))['db'];function respondWithStatusCode(_0x4e8a7e,_0x1ab35a){_0x1ab35a=_0x1ab35a||0xcc;return function(_0x245a86){if(_0x245a86){return _0x4e8a7e[_0x997b('0x15')](_0x1ab35a);}return _0x4e8a7e[_0x997b('0x16')](_0x1ab35a)[_0x997b('0x17')]();};}function respondWithResult(_0xe68a59,_0x42ec14){_0x42ec14=_0x42ec14||0xc8;return function(_0x18627c){if(_0x18627c){return _0xe68a59['status'](_0x42ec14)[_0x997b('0x18')](_0x18627c);}};}function respondWithFilteredResult(_0x244334,_0xf442e3){return function(_0x49eeb3){if(_0x49eeb3){var _0x389a02=typeof _0xf442e3['offset']===_0x997b('0x19')&&typeof _0xf442e3[_0x997b('0x1a')]===_0x997b('0x19');var _0x333dd4=_0x49eeb3[_0x997b('0x1b')];var _0x592c30=_0x389a02?0x0:_0xf442e3[_0x997b('0x1c')];var _0x31427d=_0x389a02?_0x49eeb3[_0x997b('0x1b')]:_0xf442e3[_0x997b('0x1c')]+_0xf442e3[_0x997b('0x1a')];var _0x187e10;if(_0x31427d>=_0x333dd4){_0x31427d=_0x333dd4;_0x187e10=0xc8;}else{_0x187e10=0xce;}_0x244334[_0x997b('0x16')](_0x187e10);return _0x244334[_0x997b('0x1d')](_0x997b('0x1e'),_0x592c30+'-'+_0x31427d+'/'+_0x333dd4)[_0x997b('0x18')](_0x49eeb3);}return null;};}function patchUpdates(_0x1c0f04){return function(_0x41765f){try{jsonpatch[_0x997b('0x1f')](_0x41765f,_0x1c0f04,!![]);}catch(_0x245eac){return BPromise[_0x997b('0x20')](_0x245eac);}return _0x41765f[_0x997b('0x21')]();};}function saveUpdates(_0x478182,_0x4a425f){return function(_0xee47b1){if(_0xee47b1){return _0xee47b1[_0x997b('0x22')](_0x478182)[_0x997b('0x23')](function(_0x382801){return _0x382801;});}return null;};}function removeEntity(_0x46a704,_0x9b52e5){return function(_0x28bf88){if(_0x28bf88){return _0x28bf88[_0x997b('0x24')]()[_0x997b('0x23')](function(){_0x46a704[_0x997b('0x16')](0xcc)[_0x997b('0x17')]();});}};}function handleEntityNotFound(_0x5ac09b,_0x23bf73){return function(_0x562cf2){if(!_0x562cf2){_0x5ac09b['sendStatus'](0x194);}return _0x562cf2;};}function handleError(_0x382c25,_0x45b647){_0x45b647=_0x45b647||0x1f4;return function(_0x3c0527){logger[_0x997b('0x25')](_0x3c0527[_0x997b('0x26')]);if(_0x3c0527['name']){delete _0x3c0527['name'];}_0x382c25[_0x997b('0x16')](_0x45b647)[_0x997b('0x27')](_0x3c0527);};}exports['index']=function(_0x4aeeba,_0x3f96e6){var _0x2f0b6a={},_0x19fcc1={},_0x13d600={'count':0x0,'rows':[]};var _0x17ee01=_[_0x997b('0x28')](db[_0x997b('0x29')][_0x997b('0x2a')],function(_0x17eef7){return{'name':_0x17eef7[_0x997b('0x2b')],'type':_0x17eef7[_0x997b('0x2c')][_0x997b('0x2d')]};});_0x19fcc1['model']=_[_0x997b('0x28')](_0x17ee01,_0x997b('0x2e'));_0x19fcc1[_0x997b('0x2f')]=_['keys'](_0x4aeeba[_0x997b('0x2f')]);_0x19fcc1[_0x997b('0x30')]=_['intersection'](_0x19fcc1[_0x997b('0x31')],_0x19fcc1['query']);_0x2f0b6a['attributes']=_[_0x997b('0x32')](_0x19fcc1[_0x997b('0x31')],qs[_0x997b('0x33')](_0x4aeeba[_0x997b('0x2f')]['fields']));_0x2f0b6a[_0x997b('0x34')]=_0x2f0b6a['attributes']['length']?_0x2f0b6a[_0x997b('0x34')]:_0x19fcc1[_0x997b('0x31')];if(!_0x4aeeba['query'][_0x997b('0x35')](_0x997b('0x36'))){_0x2f0b6a[_0x997b('0x1a')]=qs['limit'](_0x4aeeba[_0x997b('0x2f')][_0x997b('0x1a')]);_0x2f0b6a[_0x997b('0x1c')]=qs[_0x997b('0x1c')](_0x4aeeba['query'][_0x997b('0x1c')]);}_0x2f0b6a['order']=qs[_0x997b('0x37')](_0x4aeeba[_0x997b('0x2f')][_0x997b('0x37')]);_0x2f0b6a[_0x997b('0x38')]=qs[_0x997b('0x30')](_['pick'](_0x4aeeba['query'],_0x19fcc1['filters']),_0x17ee01);if(_0x4aeeba[_0x997b('0x2f')][_0x997b('0x39')]){_0x2f0b6a['where']=_[_0x997b('0x3a')](_0x2f0b6a[_0x997b('0x38')],{'$or':_[_0x997b('0x28')](_0x17ee01,function(_0x2ab047){if(_0x2ab047['type']!==_0x997b('0x3b')){var _0x4661d1={};_0x4661d1[_0x2ab047[_0x997b('0x2e')]]={'$like':'%'+_0x4aeeba['query'][_0x997b('0x39')]+'%'};return _0x4661d1;}})});}_0x2f0b6a=_[_0x997b('0x3a')]({},_0x2f0b6a,_0x4aeeba[_0x997b('0x3c')]);var _0x40cd0f={'where':_0x2f0b6a[_0x997b('0x38')]};return db['SugarcrmConfiguration'][_0x997b('0x1b')](_0x40cd0f)[_0x997b('0x23')](function(_0x216b02){_0x13d600[_0x997b('0x1b')]=_0x216b02;if(_0x4aeeba['query']['includeAll']){_0x2f0b6a[_0x997b('0x3d')]=[{'all':!![]}];}return db[_0x997b('0x29')][_0x997b('0x3e')](_0x2f0b6a);})[_0x997b('0x23')](function(_0x546606){_0x13d600[_0x997b('0x3f')]=_0x546606;return _0x13d600;})[_0x997b('0x23')](respondWithFilteredResult(_0x3f96e6,_0x2f0b6a))['catch'](handleError(_0x3f96e6,null));};exports['show']=function(_0x3645d7,_0x409cdd){var _0x2d6b8b={'raw':![],'where':{'id':_0x3645d7[_0x997b('0x40')]['id']}},_0x2cf4e6={};_0x2cf4e6[_0x997b('0x31')]=_[_0x997b('0x41')](db['SugarcrmConfiguration'][_0x997b('0x2a')]);_0x2cf4e6[_0x997b('0x2f')]=_[_0x997b('0x41')](_0x3645d7['query']);_0x2cf4e6[_0x997b('0x30')]=_[_0x997b('0x32')](_0x2cf4e6['model'],_0x2cf4e6[_0x997b('0x2f')]);_0x2d6b8b[_0x997b('0x34')]=_['intersection'](_0x2cf4e6[_0x997b('0x31')],qs[_0x997b('0x33')](_0x3645d7['query'][_0x997b('0x33')]));_0x2d6b8b[_0x997b('0x34')]=_0x2d6b8b[_0x997b('0x34')][_0x997b('0x42')]?_0x2d6b8b[_0x997b('0x34')]:_0x2cf4e6[_0x997b('0x31')];if(_0x3645d7[_0x997b('0x2f')][_0x997b('0x43')]){_0x2d6b8b[_0x997b('0x3d')]=[{'all':!![]}];}_0x2d6b8b=_[_0x997b('0x3a')]({},_0x2d6b8b,_0x3645d7[_0x997b('0x3c')]);return db['SugarcrmConfiguration'][_0x997b('0x44')](_0x2d6b8b)[_0x997b('0x23')](handleEntityNotFound(_0x409cdd,null))[_0x997b('0x23')](respondWithResult(_0x409cdd,null))[_0x997b('0x45')](handleError(_0x409cdd,null));};exports[_0x997b('0x46')]=function(_0x3e0893,_0x2eff72){return db[_0x997b('0x29')][_0x997b('0x46')](_0x3e0893['body'],{})[_0x997b('0x23')](respondWithResult(_0x2eff72,0xc9))[_0x997b('0x45')](handleError(_0x2eff72,null));};exports[_0x997b('0x22')]=function(_0xa3aad0,_0x32675d){if(_0xa3aad0[_0x997b('0x47')]['id']){delete _0xa3aad0[_0x997b('0x47')]['id'];}return db['SugarcrmConfiguration'][_0x997b('0x44')]({'where':{'id':_0xa3aad0[_0x997b('0x40')]['id']}})[_0x997b('0x23')](handleEntityNotFound(_0x32675d,null))[_0x997b('0x23')](saveUpdates(_0xa3aad0[_0x997b('0x47')],null))['then'](respondWithResult(_0x32675d,null))[_0x997b('0x45')](handleError(_0x32675d,null));};exports[_0x997b('0x24')]=function(_0x1fa498,_0x5180e3){return db[_0x997b('0x29')][_0x997b('0x44')]({'where':{'id':_0x1fa498[_0x997b('0x40')]['id']}})[_0x997b('0x23')](handleEntityNotFound(_0x5180e3,null))[_0x997b('0x23')](removeEntity(_0x5180e3,null))[_0x997b('0x45')](handleError(_0x5180e3,null));};exports[_0x997b('0x48')]=function(_0x29f2f7,_0x3d79d0,_0x50b20f){var _0x6b9198={};var _0x206e54={};var _0x45fce1;var _0x49671a;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x29f2f7[_0x997b('0x40')]['id']}})[_0x997b('0x23')](handleEntityNotFound(_0x3d79d0,null))[_0x997b('0x23')](function(_0x419008){if(_0x419008){_0x45fce1=_0x419008;_0x206e54['model']=_[_0x997b('0x41')](db[_0x997b('0x49')][_0x997b('0x2a')]);_0x206e54[_0x997b('0x2f')]=_[_0x997b('0x41')](_0x29f2f7[_0x997b('0x2f')]);_0x206e54[_0x997b('0x30')]=_[_0x997b('0x32')](_0x206e54[_0x997b('0x31')],_0x206e54[_0x997b('0x2f')]);_0x6b9198[_0x997b('0x34')]=_[_0x997b('0x32')](_0x206e54['model'],qs[_0x997b('0x33')](_0x29f2f7['query'][_0x997b('0x33')]));_0x6b9198[_0x997b('0x34')]=_0x6b9198[_0x997b('0x34')][_0x997b('0x42')]?_0x6b9198[_0x997b('0x34')]:_0x206e54[_0x997b('0x31')];_0x6b9198['order']=qs[_0x997b('0x37')](_0x29f2f7[_0x997b('0x2f')]['sort']);_0x6b9198[_0x997b('0x38')]=qs[_0x997b('0x30')](_['pick'](_0x29f2f7[_0x997b('0x2f')],_0x206e54[_0x997b('0x30')]));if(_0x29f2f7[_0x997b('0x2f')]['filter']){_0x6b9198[_0x997b('0x38')]=_[_0x997b('0x3a')](_0x6b9198[_0x997b('0x38')],{'$or':_[_0x997b('0x28')](_0x6b9198[_0x997b('0x34')],function(_0x4a72f9){var _0x4b8f94={};_0x4b8f94[_0x4a72f9]={'$like':'%'+_0x29f2f7[_0x997b('0x2f')]['filter']+'%'};return _0x4b8f94;})});}_0x6b9198=_['merge']({},_0x6b9198,_0x29f2f7[_0x997b('0x3c')]);return _0x45fce1[_0x997b('0x48')](_0x6b9198);}})[_0x997b('0x23')](function(_0x45e898){if(_0x45e898){_0x49671a=_0x45e898['length'];if(!_0x29f2f7[_0x997b('0x2f')][_0x997b('0x35')]('nolimit')){_0x6b9198[_0x997b('0x1a')]=qs[_0x997b('0x1a')](_0x29f2f7[_0x997b('0x2f')][_0x997b('0x1a')]);_0x6b9198[_0x997b('0x1c')]=qs[_0x997b('0x1c')](_0x29f2f7[_0x997b('0x2f')][_0x997b('0x1c')]);}return _0x45fce1[_0x997b('0x48')](_0x6b9198);}})[_0x997b('0x23')](function(_0x2ce1ef){if(_0x2ce1ef){return _0x2ce1ef?{'count':_0x49671a,'rows':_0x2ce1ef}:null;}})[_0x997b('0x23')](respondWithResult(_0x3d79d0,null))[_0x997b('0x45')](handleError(_0x3d79d0,null));};exports['getSubjects']=function(_0x12ddbf,_0x631f68,_0x71886a){var _0x16d695={};var _0x2c3de9={};var _0x5182c8;var _0x213464;return db[_0x997b('0x29')][_0x997b('0x4a')]({'where':{'id':_0x12ddbf[_0x997b('0x40')]['id']}})[_0x997b('0x23')](handleEntityNotFound(_0x631f68,null))[_0x997b('0x23')](function(_0x5258ae){if(_0x5258ae){_0x5182c8=_0x5258ae;_0x2c3de9[_0x997b('0x31')]=_[_0x997b('0x41')](db[_0x997b('0x49')][_0x997b('0x2a')]);_0x2c3de9['query']=_['keys'](_0x12ddbf['query']);_0x2c3de9[_0x997b('0x30')]=_[_0x997b('0x32')](_0x2c3de9[_0x997b('0x31')],_0x2c3de9[_0x997b('0x2f')]);_0x16d695[_0x997b('0x34')]=_[_0x997b('0x32')](_0x2c3de9[_0x997b('0x31')],qs[_0x997b('0x33')](_0x12ddbf[_0x997b('0x2f')][_0x997b('0x33')]));_0x16d695['attributes']=_0x16d695[_0x997b('0x34')][_0x997b('0x42')]?_0x16d695[_0x997b('0x34')]:_0x2c3de9[_0x997b('0x31')];_0x16d695[_0x997b('0x4b')]=qs[_0x997b('0x37')](_0x12ddbf['query'][_0x997b('0x37')]);_0x16d695['where']=qs[_0x997b('0x30')](_['pick'](_0x12ddbf['query'],_0x2c3de9[_0x997b('0x30')]));if(_0x12ddbf[_0x997b('0x2f')]['filter']){_0x16d695[_0x997b('0x38')]=_['merge'](_0x16d695[_0x997b('0x38')],{'$or':_[_0x997b('0x28')](_0x16d695['attributes'],function(_0x36b778){var _0x208191={};_0x208191[_0x36b778]={'$like':'%'+_0x12ddbf[_0x997b('0x2f')][_0x997b('0x39')]+'%'};return _0x208191;})});}_0x16d695=_['merge']({},_0x16d695,_0x12ddbf['options']);return _0x5182c8[_0x997b('0x4c')](_0x16d695);}})['then'](function(_0x198848){if(_0x198848){_0x213464=_0x198848['length'];if(!_0x12ddbf[_0x997b('0x2f')]['hasOwnProperty']('nolimit')){_0x16d695[_0x997b('0x1a')]=qs['limit'](_0x12ddbf[_0x997b('0x2f')][_0x997b('0x1a')]);_0x16d695[_0x997b('0x1c')]=qs[_0x997b('0x1c')](_0x12ddbf[_0x997b('0x2f')][_0x997b('0x1c')]);}return _0x5182c8[_0x997b('0x4c')](_0x16d695);}})[_0x997b('0x23')](function(_0x3115ab){if(_0x3115ab){return _0x3115ab?{'count':_0x213464,'rows':_0x3115ab}:null;}})[_0x997b('0x23')](respondWithResult(_0x631f68,null))['catch'](handleError(_0x631f68,null));};exports[_0x997b('0x4d')]=function(_0x2c2753,_0x371b2d,_0x357975){var _0x3d9583={};var _0x10e9c8={};var _0x2ac4c7;var _0x1403ee;return db['SugarcrmConfiguration'][_0x997b('0x4a')]({'where':{'id':_0x2c2753[_0x997b('0x40')]['id']}})[_0x997b('0x23')](handleEntityNotFound(_0x371b2d,null))[_0x997b('0x23')](function(_0xc4ebff){if(_0xc4ebff){_0x2ac4c7=_0xc4ebff;_0x10e9c8['model']=_['keys'](db[_0x997b('0x49')][_0x997b('0x2a')]);_0x10e9c8[_0x997b('0x2f')]=_[_0x997b('0x41')](_0x2c2753[_0x997b('0x2f')]);_0x10e9c8[_0x997b('0x30')]=_[_0x997b('0x32')](_0x10e9c8[_0x997b('0x31')],_0x10e9c8[_0x997b('0x2f')]);_0x3d9583[_0x997b('0x34')]=_[_0x997b('0x32')](_0x10e9c8[_0x997b('0x31')],qs['fields'](_0x2c2753[_0x997b('0x2f')][_0x997b('0x33')]));_0x3d9583[_0x997b('0x34')]=_0x3d9583['attributes']['length']?_0x3d9583['attributes']:_0x10e9c8[_0x997b('0x31')];_0x3d9583[_0x997b('0x4b')]=qs[_0x997b('0x37')](_0x2c2753[_0x997b('0x2f')][_0x997b('0x37')]);_0x3d9583['where']=qs[_0x997b('0x30')](_[_0x997b('0x4e')](_0x2c2753[_0x997b('0x2f')],_0x10e9c8[_0x997b('0x30')]));if(_0x2c2753[_0x997b('0x2f')][_0x997b('0x39')]){_0x3d9583[_0x997b('0x38')]=_[_0x997b('0x3a')](_0x3d9583[_0x997b('0x38')],{'$or':_[_0x997b('0x28')](_0x3d9583[_0x997b('0x34')],function(_0x25753b){var _0x183a04={};_0x183a04[_0x25753b]={'$like':'%'+_0x2c2753[_0x997b('0x2f')][_0x997b('0x39')]+'%'};return _0x183a04;})});}_0x3d9583=_[_0x997b('0x3a')]({},_0x3d9583,_0x2c2753['options']);return _0x2ac4c7[_0x997b('0x4d')](_0x3d9583);}})[_0x997b('0x23')](function(_0x12a8a2){if(_0x12a8a2){_0x1403ee=_0x12a8a2['length'];if(!_0x2c2753[_0x997b('0x2f')][_0x997b('0x35')](_0x997b('0x36'))){_0x3d9583[_0x997b('0x1a')]=qs[_0x997b('0x1a')](_0x2c2753[_0x997b('0x2f')][_0x997b('0x1a')]);_0x3d9583['offset']=qs[_0x997b('0x1c')](_0x2c2753[_0x997b('0x2f')][_0x997b('0x1c')]);}return _0x2ac4c7[_0x997b('0x4d')](_0x3d9583);}})[_0x997b('0x23')](function(_0x3f1bde){if(_0x3f1bde){return _0x3f1bde?{'count':_0x1403ee,'rows':_0x3f1bde}:null;}})['then'](respondWithResult(_0x371b2d,null))[_0x997b('0x45')](handleError(_0x371b2d,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index cfb129c..132f5b7 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 _0xa299=['rimraf','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x3850aa,_0x4764cc){var _0x5afcdb=function(_0x3166ff){while(--_0x3166ff){_0x3850aa['push'](_0x3850aa['shift']());}};_0x5afcdb(++_0x4764cc);}(_0xa299,0x123));var _0x9a29=function(_0x1ebb27,_0x25c59a){_0x1ebb27=_0x1ebb27-0x0;var _0x18cd7e=_0xa299[_0x1ebb27];return _0x18cd7e;};'use strict';var _=require(_0x9a29('0x0'));var util=require(_0x9a29('0x1'));var logger=require(_0x9a29('0x2'))('api');var moment=require(_0x9a29('0x3'));var BPromise=require('bluebird');var rp=require(_0x9a29('0x4'));var fs=require('fs');var path=require(_0x9a29('0x5'));var rimraf=require(_0x9a29('0x6'));var config=require('../../config/environment');var attributes=require(_0x9a29('0x7'));module[_0x9a29('0x8')]=function(_0x187957,_0xb0b1e8){return _0x187957[_0x9a29('0x9')]('SugarcrmConfiguration',attributes,{'tableName':_0x9a29('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bbb=['api','moment','bluebird','path','rimraf','./intSugarcrmConfiguration.attributes','util','../../config/logger'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x8bbb,0x18e));var _0xb8bb=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x8bbb[_0x48d6a3];return _0x38bfa0;};'use strict';var _=require('lodash');var util=require(_0xb8bb('0x0'));var logger=require(_0xb8bb('0x1'))(_0xb8bb('0x2'));var moment=require(_0xb8bb('0x3'));var BPromise=require(_0xb8bb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8bb('0x5'));var rimraf=require(_0xb8bb('0x6'));var config=require('../../config/environment');var attributes=require(_0xb8bb('0x7'));module['exports']=function(_0x196294,_0x5e3ffb){return _0x196294['define']('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 93b3619..cc2962f 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 _0xf133=['client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0xf133,0xa5));var _0x3f13=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xf133[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x3f13('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3f13('0x1'));var rs=require(_0x3f13('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3f13('0x3'));var logger=require(_0x3f13('0x4'))(_0x3f13('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3f13('0x6')][_0x3f13('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1c70cd,_0x58de83,_0x4df829){return new BPromise(function(_0x186cd5,_0x58d3b7){return client['request'](_0x1c70cd,_0x4df829)[_0x3f13('0x8')](function(_0x1486e3){logger[_0x3f13('0x9')](_0x3f13('0xa'),_0x58de83,'request\x20sent');logger[_0x3f13('0xb')](_0x3f13('0xc'),_0x58de83,_0x3f13('0xd'),JSON['stringify'](_0x1486e3));if(_0x1486e3[_0x3f13('0xe')]){if(_0x1486e3[_0x3f13('0xe')][_0x3f13('0xf')]===0x1f4){logger[_0x3f13('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x58de83,_0x1486e3[_0x3f13('0xe')][_0x3f13('0x10')]);return _0x58d3b7(_0x1486e3['error'][_0x3f13('0x10')]);}logger['error'](_0x3f13('0xa'),_0x58de83,_0x1486e3['error'][_0x3f13('0x10')]);return _0x186cd5(_0x1486e3[_0x3f13('0xe')]['message']);}else{logger[_0x3f13('0x9')](_0x3f13('0xa'),_0x58de83,_0x3f13('0xd'));_0x186cd5(_0x1486e3[_0x3f13('0x11')][_0x3f13('0x10')]);}})[_0x3f13('0x12')](function(_0x4cb074){logger[_0x3f13('0xe')](_0x3f13('0xa'),_0x58de83,_0x4cb074);_0x58d3b7(_0x4cb074);});});} \ No newline at end of file +var _0xe043=['then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../config/utils','jayson/promise','client','request'];(function(_0x5890d7,_0x1abc04){var _0x1c00f0=function(_0xc9ee32){while(--_0xc9ee32){_0x5890d7['push'](_0x5890d7['shift']());}};_0x1c00f0(++_0x1abc04);}(_0xe043,0x1c1));var _0x3e04=function(_0x5b585d,_0x230ced){_0x5b585d=_0x5b585d-0x0;var _0x223979=_0xe043[_0x5b585d];return _0x223979;};'use strict';var _=require(_0x3e04('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3e04('0x1'));var rs=require(_0x3e04('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3e04('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3e04('0x4'));var client=jayson[_0x3e04('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16bc56,_0x580672,_0x4bbec4){return new BPromise(function(_0x43b331,_0x51bd48){return client[_0x3e04('0x6')](_0x16bc56,_0x4bbec4)[_0x3e04('0x7')](function(_0x1e8bcd){logger[_0x3e04('0x8')](_0x3e04('0x9'),_0x580672,_0x3e04('0xa'));logger[_0x3e04('0xb')](_0x3e04('0xc'),_0x580672,_0x3e04('0xa'),JSON[_0x3e04('0xd')](_0x1e8bcd));if(_0x1e8bcd['error']){if(_0x1e8bcd[_0x3e04('0xe')][_0x3e04('0xf')]===0x1f4){logger[_0x3e04('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x580672,_0x1e8bcd[_0x3e04('0xe')]['message']);return _0x51bd48(_0x1e8bcd[_0x3e04('0xe')][_0x3e04('0x10')]);}logger[_0x3e04('0xe')](_0x3e04('0x9'),_0x580672,_0x1e8bcd[_0x3e04('0xe')]['message']);return _0x43b331(_0x1e8bcd[_0x3e04('0xe')][_0x3e04('0x10')]);}else{logger[_0x3e04('0x8')](_0x3e04('0x9'),_0x580672,_0x3e04('0xa'));_0x43b331(_0x1e8bcd[_0x3e04('0x11')][_0x3e04('0x10')]);}})[_0x3e04('0x12')](function(_0x3181c0){logger[_0x3e04('0xe')](_0x3e04('0x9'),_0x580672,_0x3181c0);_0x51bd48(_0x3181c0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index f433f09..cd59ff0 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 _0x9b65=['exports','util','path','connect-timeout','express','Router','../../config/environment','./intSugarcrmField.controller','get','index','isAuthenticated','show','post','create','put','update','delete','/:id'];(function(_0x291af0,_0x27c7ae){var _0x39dcff=function(_0x36fc73){while(--_0x36fc73){_0x291af0['push'](_0x291af0['shift']());}};_0x39dcff(++_0x27c7ae);}(_0x9b65,0xeb));var _0x59b6=function(_0x228b28,_0x2f7f93){_0x228b28=_0x228b28-0x0;var _0x24fb44=_0x9b65[_0x228b28];return _0x24fb44;};'use strict';var multer=require('multer');var util=require(_0x59b6('0x0'));var path=require(_0x59b6('0x1'));var timeout=require(_0x59b6('0x2'));var express=require(_0x59b6('0x3'));var router=express[_0x59b6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x59b6('0x5'));var controller=require(_0x59b6('0x6'));router[_0x59b6('0x7')]('/',auth['isAuthenticated'](),controller[_0x59b6('0x8')]);router[_0x59b6('0x7')]('/:id',auth[_0x59b6('0x9')](),controller[_0x59b6('0xa')]);router[_0x59b6('0xb')]('/',auth['isAuthenticated'](),controller[_0x59b6('0xc')]);router[_0x59b6('0xd')]('/:id',auth[_0x59b6('0x9')](),controller[_0x59b6('0xe')]);router[_0x59b6('0xf')](_0x59b6('0x10'),auth[_0x59b6('0x9')](),controller['destroy']);module[_0x59b6('0x11')]=router; \ No newline at end of file +var _0x36c3=['get','isAuthenticated','/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller'];(function(_0x3526fb,_0x416c51){var _0x6b57be=function(_0xf76545){while(--_0xf76545){_0x3526fb['push'](_0x3526fb['shift']());}};_0x6b57be(++_0x416c51);}(_0x36c3,0x1be));var _0x336c=function(_0x14af87,_0x149ac3){_0x14af87=_0x14af87-0x0;var _0x4ff770=_0x36c3[_0x14af87];return _0x4ff770;};'use strict';var multer=require(_0x336c('0x0'));var util=require(_0x336c('0x1'));var path=require('path');var timeout=require(_0x336c('0x2'));var express=require(_0x336c('0x3'));var router=express[_0x336c('0x4')]();var fs_extra=require(_0x336c('0x5'));var auth=require(_0x336c('0x6'));var interaction=require(_0x336c('0x7'));var config=require(_0x336c('0x8'));var controller=require(_0x336c('0x9'));router[_0x336c('0xa')]('/',auth[_0x336c('0xb')](),controller['index']);router['get'](_0x336c('0xc'),auth[_0x336c('0xb')](),controller[_0x336c('0xd')]);router[_0x336c('0xe')]('/',auth[_0x336c('0xb')](),controller[_0x336c('0xf')]);router[_0x336c('0x10')](_0x336c('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x336c('0x11')](_0x336c('0xc'),auth[_0x336c('0xb')](),controller['destroy']);module[_0x336c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 1d9c491..dc4704f 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 _0x278b=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x4f6ffd,_0x316dd8){var _0x34a32e=function(_0x386980){while(--_0x386980){_0x4f6ffd['push'](_0x4f6ffd['shift']());}};_0x34a32e(++_0x316dd8);}(_0x278b,0x138));var _0xb278=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x278b[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0xb278('0x0'));module['exports']={'type':{'type':Sequelize[_0xb278('0x1')]('string',_0xb278('0x2'),_0xb278('0x3'),_0xb278('0x4'),_0xb278('0x5')),'defaultValue':_0xb278('0x6')},'content':{'type':Sequelize[_0xb278('0x7')]},'key':{'type':Sequelize[_0xb278('0x7')]},'keyType':{'type':Sequelize[_0xb278('0x1')](_0xb278('0x6'),_0xb278('0x2'),_0xb278('0x3'))},'keyContent':{'type':Sequelize[_0xb278('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb278('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0d78=['picklist','STRING','BOOLEAN','exports','string','variable','customVariable','keyValue'];(function(_0x1502b2,_0x4dd2b2){var _0x166205=function(_0x225f8b){while(--_0x225f8b){_0x1502b2['push'](_0x1502b2['shift']());}};_0x166205(++_0x4dd2b2);}(_0x0d78,0x6b));var _0x80d7=function(_0x26d034,_0x2c22db){_0x26d034=_0x26d034-0x0;var _0x3015aa=_0x0d78[_0x26d034];return _0x3015aa;};'use strict';var Sequelize=require('sequelize');module[_0x80d7('0x0')]={'type':{'type':Sequelize['ENUM'](_0x80d7('0x1'),_0x80d7('0x2'),_0x80d7('0x3'),_0x80d7('0x4'),_0x80d7('0x5')),'defaultValue':_0x80d7('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x80d7('0x1'),_0x80d7('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x80d7('0x6')]},'nameField':{'type':Sequelize[_0x80d7('0x6')]},'customField':{'type':Sequelize[_0x80d7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x80d7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 7197bc0..a58c19e 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 _0x3a36=['create','body','update','destroy','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SugarcrmField','includeAll','findAll','rows','catch','params','include','options','find'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3a36,0x185));var _0x63a3=function(_0x47cf4a,_0x63635e){_0x47cf4a=_0x47cf4a-0x0;var _0x222a1d=_0x3a36[_0x47cf4a];return _0x222a1d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63a3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x63a3('0x1'));var rp=require(_0x63a3('0x2'));var moment=require(_0x63a3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x63a3('0x4'));var util=require('util');var path=require(_0x63a3('0x5'));var sox=require('sox');var csv=require(_0x63a3('0x6'));var ejs=require(_0x63a3('0x7'));var fs=require('fs');var fs_extra=require(_0x63a3('0x8'));var _=require(_0x63a3('0x9'));var squel=require(_0x63a3('0xa'));var crypto=require('crypto');var jsforce=require(_0x63a3('0xb'));var deskjs=require(_0x63a3('0xc'));var toCsv=require(_0x63a3('0x6'));var querystring=require(_0x63a3('0xd'));var Papa=require(_0x63a3('0xe'));var Redis=require(_0x63a3('0xf'));var authService=require(_0x63a3('0x10'));var qs=require(_0x63a3('0x11'));var as=require(_0x63a3('0x12'));var hardwareService=require(_0x63a3('0x13'));var logger=require(_0x63a3('0x14'))(_0x63a3('0x15'));var utils=require(_0x63a3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x63a3('0x17'));var db=require(_0x63a3('0x18'))['db'];function respondWithStatusCode(_0x579dc,_0x6a4d){_0x6a4d=_0x6a4d||0xcc;return function(_0x36d079){if(_0x36d079){return _0x579dc[_0x63a3('0x19')](_0x6a4d);}return _0x579dc[_0x63a3('0x1a')](_0x6a4d)[_0x63a3('0x1b')]();};}function respondWithResult(_0x16b74d,_0x36be25){_0x36be25=_0x36be25||0xc8;return function(_0x3d5c71){if(_0x3d5c71){return _0x16b74d[_0x63a3('0x1a')](_0x36be25)[_0x63a3('0x1c')](_0x3d5c71);}};}function respondWithFilteredResult(_0x2ddc73,_0xe4eae8){return function(_0x2461df){if(_0x2461df){var _0x48635d=typeof _0xe4eae8['offset']===_0x63a3('0x1d')&&typeof _0xe4eae8['limit']==='undefined';var _0x46e240=_0x2461df[_0x63a3('0x1e')];var _0xe450dc=_0x48635d?0x0:_0xe4eae8[_0x63a3('0x1f')];var _0x5c50e2=_0x48635d?_0x2461df['count']:_0xe4eae8[_0x63a3('0x1f')]+_0xe4eae8[_0x63a3('0x20')];var _0x6e875;if(_0x5c50e2>=_0x46e240){_0x5c50e2=_0x46e240;_0x6e875=0xc8;}else{_0x6e875=0xce;}_0x2ddc73[_0x63a3('0x1a')](_0x6e875);return _0x2ddc73['set'](_0x63a3('0x21'),_0xe450dc+'-'+_0x5c50e2+'/'+_0x46e240)[_0x63a3('0x1c')](_0x2461df);}return null;};}function patchUpdates(_0xb7e7aa){return function(_0x20fd86){try{jsonpatch[_0x63a3('0x22')](_0x20fd86,_0xb7e7aa,!![]);}catch(_0xd2215b){return BPromise[_0x63a3('0x23')](_0xd2215b);}return _0x20fd86[_0x63a3('0x24')]();};}function saveUpdates(_0x36c583,_0x5c3020){return function(_0x5d0d6f){if(_0x5d0d6f){return _0x5d0d6f['update'](_0x36c583)[_0x63a3('0x25')](function(_0x332560){return _0x332560;});}return null;};}function removeEntity(_0x12eb01,_0x5c1ba9){return function(_0x20b76c){if(_0x20b76c){return _0x20b76c['destroy']()[_0x63a3('0x25')](function(){_0x12eb01[_0x63a3('0x1a')](0xcc)[_0x63a3('0x1b')]();});}};}function handleEntityNotFound(_0x5432be,_0x496fa1){return function(_0x1d4ee0){if(!_0x1d4ee0){_0x5432be[_0x63a3('0x19')](0x194);}return _0x1d4ee0;};}function handleError(_0x4bb678,_0x10eee8){_0x10eee8=_0x10eee8||0x1f4;return function(_0x37fe89){logger[_0x63a3('0x26')](_0x37fe89[_0x63a3('0x27')]);if(_0x37fe89['name']){delete _0x37fe89[_0x63a3('0x28')];}_0x4bb678[_0x63a3('0x1a')](_0x10eee8)['send'](_0x37fe89);};}exports[_0x63a3('0x29')]=function(_0x4d2b9f,_0x1f7827){var _0x30ed4c={},_0x186b52={},_0x3c17a8={'count':0x0,'rows':[]};var _0x164478=_[_0x63a3('0x2a')](db['SugarcrmField'][_0x63a3('0x2b')],function(_0x55b5c5){return{'name':_0x55b5c5[_0x63a3('0x2c')],'type':_0x55b5c5[_0x63a3('0x2d')][_0x63a3('0x2e')]};});_0x186b52[_0x63a3('0x2f')]=_[_0x63a3('0x2a')](_0x164478,_0x63a3('0x28'));_0x186b52[_0x63a3('0x30')]=_[_0x63a3('0x31')](_0x4d2b9f[_0x63a3('0x30')]);_0x186b52[_0x63a3('0x32')]=_[_0x63a3('0x33')](_0x186b52[_0x63a3('0x2f')],_0x186b52[_0x63a3('0x30')]);_0x30ed4c[_0x63a3('0x34')]=_[_0x63a3('0x33')](_0x186b52[_0x63a3('0x2f')],qs[_0x63a3('0x35')](_0x4d2b9f[_0x63a3('0x30')][_0x63a3('0x35')]));_0x30ed4c[_0x63a3('0x34')]=_0x30ed4c['attributes'][_0x63a3('0x36')]?_0x30ed4c['attributes']:_0x186b52[_0x63a3('0x2f')];if(!_0x4d2b9f[_0x63a3('0x30')][_0x63a3('0x37')](_0x63a3('0x38'))){_0x30ed4c[_0x63a3('0x20')]=qs[_0x63a3('0x20')](_0x4d2b9f[_0x63a3('0x30')][_0x63a3('0x20')]);_0x30ed4c[_0x63a3('0x1f')]=qs[_0x63a3('0x1f')](_0x4d2b9f[_0x63a3('0x30')]['offset']);}_0x30ed4c[_0x63a3('0x39')]=qs['sort'](_0x4d2b9f[_0x63a3('0x30')][_0x63a3('0x3a')]);_0x30ed4c['where']=qs[_0x63a3('0x32')](_[_0x63a3('0x3b')](_0x4d2b9f[_0x63a3('0x30')],_0x186b52[_0x63a3('0x32')]),_0x164478);if(_0x4d2b9f['query'][_0x63a3('0x3c')]){_0x30ed4c[_0x63a3('0x3d')]=_[_0x63a3('0x3e')](_0x30ed4c['where'],{'$or':_[_0x63a3('0x2a')](_0x164478,function(_0x3b366d){if(_0x3b366d['type']!==_0x63a3('0x3f')){var _0x27d0b6={};_0x27d0b6[_0x3b366d['name']]={'$like':'%'+_0x4d2b9f[_0x63a3('0x30')]['filter']+'%'};return _0x27d0b6;}})});}_0x30ed4c=_[_0x63a3('0x3e')]({},_0x30ed4c,_0x4d2b9f['options']);var _0x424496={'where':_0x30ed4c[_0x63a3('0x3d')]};return db[_0x63a3('0x40')]['count'](_0x424496)[_0x63a3('0x25')](function(_0x36a0cc){_0x3c17a8[_0x63a3('0x1e')]=_0x36a0cc;if(_0x4d2b9f['query'][_0x63a3('0x41')]){_0x30ed4c['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x63a3('0x42')](_0x30ed4c);})[_0x63a3('0x25')](function(_0x20958a){_0x3c17a8[_0x63a3('0x43')]=_0x20958a;return _0x3c17a8;})[_0x63a3('0x25')](respondWithFilteredResult(_0x1f7827,_0x30ed4c))[_0x63a3('0x44')](handleError(_0x1f7827,null));};exports['show']=function(_0x5d2af8,_0x3b1f50){var _0x41d53d={'raw':!![],'where':{'id':_0x5d2af8[_0x63a3('0x45')]['id']}},_0x2fd642={};_0x2fd642['model']=_[_0x63a3('0x31')](db[_0x63a3('0x40')][_0x63a3('0x2b')]);_0x2fd642[_0x63a3('0x30')]=_['keys'](_0x5d2af8[_0x63a3('0x30')]);_0x2fd642[_0x63a3('0x32')]=_[_0x63a3('0x33')](_0x2fd642[_0x63a3('0x2f')],_0x2fd642[_0x63a3('0x30')]);_0x41d53d[_0x63a3('0x34')]=_[_0x63a3('0x33')](_0x2fd642[_0x63a3('0x2f')],qs[_0x63a3('0x35')](_0x5d2af8[_0x63a3('0x30')][_0x63a3('0x35')]));_0x41d53d['attributes']=_0x41d53d[_0x63a3('0x34')][_0x63a3('0x36')]?_0x41d53d[_0x63a3('0x34')]:_0x2fd642[_0x63a3('0x2f')];if(_0x5d2af8[_0x63a3('0x30')][_0x63a3('0x41')]){_0x41d53d[_0x63a3('0x46')]=[{'all':!![]}];}_0x41d53d=_['merge']({},_0x41d53d,_0x5d2af8[_0x63a3('0x47')]);return db[_0x63a3('0x40')][_0x63a3('0x48')](_0x41d53d)[_0x63a3('0x25')](handleEntityNotFound(_0x3b1f50,null))[_0x63a3('0x25')](respondWithResult(_0x3b1f50,null))[_0x63a3('0x44')](handleError(_0x3b1f50,null));};exports[_0x63a3('0x49')]=function(_0x139e93,_0xbc54e8){return db[_0x63a3('0x40')][_0x63a3('0x49')](_0x139e93[_0x63a3('0x4a')],{})[_0x63a3('0x25')](respondWithResult(_0xbc54e8,0xc9))['catch'](handleError(_0xbc54e8,null));};exports[_0x63a3('0x4b')]=function(_0x24120f,_0x4ba004){if(_0x24120f[_0x63a3('0x4a')]['id']){delete _0x24120f[_0x63a3('0x4a')]['id'];}return db[_0x63a3('0x40')][_0x63a3('0x48')]({'where':{'id':_0x24120f[_0x63a3('0x45')]['id']}})[_0x63a3('0x25')](handleEntityNotFound(_0x4ba004,null))[_0x63a3('0x25')](saveUpdates(_0x24120f[_0x63a3('0x4a')],null))[_0x63a3('0x25')](respondWithResult(_0x4ba004,null))[_0x63a3('0x44')](handleError(_0x4ba004,null));};exports[_0x63a3('0x4c')]=function(_0x89e308,_0x5d2640){return db['SugarcrmField'][_0x63a3('0x48')]({'where':{'id':_0x89e308[_0x63a3('0x45')]['id']}})[_0x63a3('0x25')](handleEntityNotFound(_0x5d2640,null))['then'](removeEntity(_0x5d2640,null))[_0x63a3('0x44')](handleError(_0x5d2640,null));}; \ No newline at end of file +var _0xac28=['SugarcrmField','rawAttributes','type','model','map','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','catch','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index'];(function(_0x10d5b3,_0x4f3017){var _0x5860fd=function(_0x5b4527){while(--_0x5b4527){_0x10d5b3['push'](_0x10d5b3['shift']());}};_0x5860fd(++_0x4f3017);}(_0xac28,0x19d));var _0x8ac2=function(_0x34b7e9,_0x4c3433){_0x34b7e9=_0x34b7e9-0x0;var _0x1fb521=_0xac28[_0x34b7e9];return _0x1fb521;};'use strict';var emlformat=require(_0x8ac2('0x0'));var rimraf=require(_0x8ac2('0x1'));var zipdir=require(_0x8ac2('0x2'));var jsonpatch=require(_0x8ac2('0x3'));var rp=require(_0x8ac2('0x4'));var moment=require(_0x8ac2('0x5'));var BPromise=require(_0x8ac2('0x6'));var Mustache=require(_0x8ac2('0x7'));var util=require(_0x8ac2('0x8'));var path=require('path');var sox=require(_0x8ac2('0x9'));var csv=require(_0x8ac2('0xa'));var ejs=require(_0x8ac2('0xb'));var fs=require('fs');var fs_extra=require(_0x8ac2('0xc'));var _=require('lodash');var squel=require(_0x8ac2('0xd'));var crypto=require(_0x8ac2('0xe'));var jsforce=require(_0x8ac2('0xf'));var deskjs=require(_0x8ac2('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8ac2('0x11'));var Papa=require(_0x8ac2('0x12'));var Redis=require(_0x8ac2('0x13'));var authService=require(_0x8ac2('0x14'));var qs=require(_0x8ac2('0x15'));var as=require(_0x8ac2('0x16'));var hardwareService=require(_0x8ac2('0x17'));var logger=require(_0x8ac2('0x18'))(_0x8ac2('0x19'));var utils=require(_0x8ac2('0x1a'));var config=require(_0x8ac2('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ac2('0x1c'))['db'];function respondWithStatusCode(_0xfff5a5,_0x3647c3){_0x3647c3=_0x3647c3||0xcc;return function(_0xfe3bde){if(_0xfe3bde){return _0xfff5a5[_0x8ac2('0x1d')](_0x3647c3);}return _0xfff5a5[_0x8ac2('0x1e')](_0x3647c3)[_0x8ac2('0x1f')]();};}function respondWithResult(_0x3a9dbe,_0x4ec82b){_0x4ec82b=_0x4ec82b||0xc8;return function(_0x47d988){if(_0x47d988){return _0x3a9dbe[_0x8ac2('0x1e')](_0x4ec82b)[_0x8ac2('0x20')](_0x47d988);}};}function respondWithFilteredResult(_0x1694da,_0x49e963){return function(_0x370505){if(_0x370505){var _0x585fb9=typeof _0x49e963[_0x8ac2('0x21')]===_0x8ac2('0x22')&&typeof _0x49e963[_0x8ac2('0x23')]==='undefined';var _0x5ddc1c=_0x370505[_0x8ac2('0x24')];var _0x4d1947=_0x585fb9?0x0:_0x49e963[_0x8ac2('0x21')];var _0x3d57e2=_0x585fb9?_0x370505[_0x8ac2('0x24')]:_0x49e963[_0x8ac2('0x21')]+_0x49e963[_0x8ac2('0x23')];var _0x568230;if(_0x3d57e2>=_0x5ddc1c){_0x3d57e2=_0x5ddc1c;_0x568230=0xc8;}else{_0x568230=0xce;}_0x1694da[_0x8ac2('0x1e')](_0x568230);return _0x1694da[_0x8ac2('0x25')](_0x8ac2('0x26'),_0x4d1947+'-'+_0x3d57e2+'/'+_0x5ddc1c)[_0x8ac2('0x20')](_0x370505);}return null;};}function patchUpdates(_0x37ac08){return function(_0x1583a9){try{jsonpatch[_0x8ac2('0x27')](_0x1583a9,_0x37ac08,!![]);}catch(_0x5d61dd){return BPromise[_0x8ac2('0x28')](_0x5d61dd);}return _0x1583a9['save']();};}function saveUpdates(_0x189260,_0x3cfabc){return function(_0x101778){if(_0x101778){return _0x101778[_0x8ac2('0x29')](_0x189260)[_0x8ac2('0x2a')](function(_0x1473e0){return _0x1473e0;});}return null;};}function removeEntity(_0x2cfb34,_0x84d788){return function(_0x2ff75e){if(_0x2ff75e){return _0x2ff75e[_0x8ac2('0x2b')]()[_0x8ac2('0x2a')](function(){_0x2cfb34[_0x8ac2('0x1e')](0xcc)[_0x8ac2('0x1f')]();});}};}function handleEntityNotFound(_0x21bdf8,_0x4fe52a){return function(_0x53848c){if(!_0x53848c){_0x21bdf8['sendStatus'](0x194);}return _0x53848c;};}function handleError(_0x5af961,_0x3d8b5a){_0x3d8b5a=_0x3d8b5a||0x1f4;return function(_0x1a75ca){logger[_0x8ac2('0x2c')](_0x1a75ca[_0x8ac2('0x2d')]);if(_0x1a75ca[_0x8ac2('0x2e')]){delete _0x1a75ca[_0x8ac2('0x2e')];}_0x5af961['status'](_0x3d8b5a)[_0x8ac2('0x2f')](_0x1a75ca);};}exports[_0x8ac2('0x30')]=function(_0x4e38ca,_0x2159b5){var _0x1b4cce={},_0x385fe9={},_0x3bf0a8={'count':0x0,'rows':[]};var _0x2839ff=_['map'](db[_0x8ac2('0x31')][_0x8ac2('0x32')],function(_0x41bcc0){return{'name':_0x41bcc0['fieldName'],'type':_0x41bcc0[_0x8ac2('0x33')]['key']};});_0x385fe9[_0x8ac2('0x34')]=_[_0x8ac2('0x35')](_0x2839ff,_0x8ac2('0x2e'));_0x385fe9['query']=_[_0x8ac2('0x36')](_0x4e38ca['query']);_0x385fe9[_0x8ac2('0x37')]=_[_0x8ac2('0x38')](_0x385fe9[_0x8ac2('0x34')],_0x385fe9[_0x8ac2('0x39')]);_0x1b4cce[_0x8ac2('0x3a')]=_[_0x8ac2('0x38')](_0x385fe9['model'],qs[_0x8ac2('0x3b')](_0x4e38ca[_0x8ac2('0x39')][_0x8ac2('0x3b')]));_0x1b4cce['attributes']=_0x1b4cce[_0x8ac2('0x3a')][_0x8ac2('0x3c')]?_0x1b4cce[_0x8ac2('0x3a')]:_0x385fe9['model'];if(!_0x4e38ca[_0x8ac2('0x39')]['hasOwnProperty'](_0x8ac2('0x3d'))){_0x1b4cce[_0x8ac2('0x23')]=qs[_0x8ac2('0x23')](_0x4e38ca[_0x8ac2('0x39')]['limit']);_0x1b4cce[_0x8ac2('0x21')]=qs[_0x8ac2('0x21')](_0x4e38ca[_0x8ac2('0x39')]['offset']);}_0x1b4cce[_0x8ac2('0x3e')]=qs['sort'](_0x4e38ca['query'][_0x8ac2('0x3f')]);_0x1b4cce['where']=qs[_0x8ac2('0x37')](_[_0x8ac2('0x40')](_0x4e38ca[_0x8ac2('0x39')],_0x385fe9['filters']),_0x2839ff);if(_0x4e38ca['query']['filter']){_0x1b4cce[_0x8ac2('0x41')]=_['merge'](_0x1b4cce[_0x8ac2('0x41')],{'$or':_[_0x8ac2('0x35')](_0x2839ff,function(_0x3b9d51){if(_0x3b9d51['type']!==_0x8ac2('0x42')){var _0x2c0e6a={};_0x2c0e6a[_0x3b9d51[_0x8ac2('0x2e')]]={'$like':'%'+_0x4e38ca['query'][_0x8ac2('0x43')]+'%'};return _0x2c0e6a;}})});}_0x1b4cce=_[_0x8ac2('0x44')]({},_0x1b4cce,_0x4e38ca[_0x8ac2('0x45')]);var _0x3cd35a={'where':_0x1b4cce['where']};return db[_0x8ac2('0x31')][_0x8ac2('0x24')](_0x3cd35a)[_0x8ac2('0x2a')](function(_0x5188af){_0x3bf0a8[_0x8ac2('0x24')]=_0x5188af;if(_0x4e38ca[_0x8ac2('0x39')][_0x8ac2('0x46')]){_0x1b4cce[_0x8ac2('0x47')]=[{'all':!![]}];}return db[_0x8ac2('0x31')]['findAll'](_0x1b4cce);})[_0x8ac2('0x2a')](function(_0x496ee){_0x3bf0a8['rows']=_0x496ee;return _0x3bf0a8;})[_0x8ac2('0x2a')](respondWithFilteredResult(_0x2159b5,_0x1b4cce))[_0x8ac2('0x48')](handleError(_0x2159b5,null));};exports['show']=function(_0x2fd481,_0x378302){var _0x384ef8={'raw':!![],'where':{'id':_0x2fd481[_0x8ac2('0x49')]['id']}},_0x328918={};_0x328918[_0x8ac2('0x34')]=_[_0x8ac2('0x36')](db[_0x8ac2('0x31')][_0x8ac2('0x32')]);_0x328918[_0x8ac2('0x39')]=_[_0x8ac2('0x36')](_0x2fd481['query']);_0x328918['filters']=_[_0x8ac2('0x38')](_0x328918[_0x8ac2('0x34')],_0x328918[_0x8ac2('0x39')]);_0x384ef8['attributes']=_[_0x8ac2('0x38')](_0x328918[_0x8ac2('0x34')],qs['fields'](_0x2fd481[_0x8ac2('0x39')][_0x8ac2('0x3b')]));_0x384ef8[_0x8ac2('0x3a')]=_0x384ef8[_0x8ac2('0x3a')]['length']?_0x384ef8[_0x8ac2('0x3a')]:_0x328918[_0x8ac2('0x34')];if(_0x2fd481[_0x8ac2('0x39')][_0x8ac2('0x46')]){_0x384ef8[_0x8ac2('0x47')]=[{'all':!![]}];}_0x384ef8=_['merge']({},_0x384ef8,_0x2fd481[_0x8ac2('0x45')]);return db['SugarcrmField']['find'](_0x384ef8)['then'](handleEntityNotFound(_0x378302,null))[_0x8ac2('0x2a')](respondWithResult(_0x378302,null))[_0x8ac2('0x48')](handleError(_0x378302,null));};exports[_0x8ac2('0x4a')]=function(_0x1de573,_0x2bacb7){return db['SugarcrmField'][_0x8ac2('0x4a')](_0x1de573['body'],{})[_0x8ac2('0x2a')](respondWithResult(_0x2bacb7,0xc9))[_0x8ac2('0x48')](handleError(_0x2bacb7,null));};exports['update']=function(_0x34d7df,_0x175df7){if(_0x34d7df[_0x8ac2('0x4b')]['id']){delete _0x34d7df[_0x8ac2('0x4b')]['id'];}return db['SugarcrmField'][_0x8ac2('0x4c')]({'where':{'id':_0x34d7df[_0x8ac2('0x49')]['id']}})['then'](handleEntityNotFound(_0x175df7,null))[_0x8ac2('0x2a')](saveUpdates(_0x34d7df[_0x8ac2('0x4b')],null))[_0x8ac2('0x2a')](respondWithResult(_0x175df7,null))[_0x8ac2('0x48')](handleError(_0x175df7,null));};exports['destroy']=function(_0x530472,_0x1b99a7){return db['SugarcrmField'][_0x8ac2('0x4c')]({'where':{'id':_0x530472[_0x8ac2('0x49')]['id']}})[_0x8ac2('0x2a')](handleEntityNotFound(_0x1b99a7,null))[_0x8ac2('0x2a')](removeEntity(_0x1b99a7,null))[_0x8ac2('0x48')](handleError(_0x1b99a7,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index aa4f248..e09bdf2 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 _0xdf87=['../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x2771a2,_0x3f69ff){var _0x3a1648=function(_0xf1a68){while(--_0xf1a68){_0x2771a2['push'](_0x2771a2['shift']());}};_0x3a1648(++_0x3f69ff);}(_0xdf87,0xcb));var _0x7df8=function(_0x4bfc47,_0x1c1966){_0x4bfc47=_0x4bfc47-0x0;var _0x5d305a=_0xdf87[_0x4bfc47];return _0x5d305a;};'use strict';var _=require(_0x7df8('0x0'));var util=require('util');var logger=require(_0x7df8('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7df8('0x2'));var rp=require(_0x7df8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7df8('0x4'));var config=require(_0x7df8('0x5'));var attributes=require(_0x7df8('0x6'));module[_0x7df8('0x7')]=function(_0x3d526f,_0x48ed82){return _0x3d526f[_0x7df8('0x8')](_0x7df8('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x7df8('0xa'),'fields':[_0x7df8('0xb'),_0x7df8('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf529=['FieldId','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','int_sugarcrm_fields','sugarcrm_unique_index','idField'];(function(_0x4bb6df,_0x3a7f33){var _0x272d32=function(_0x5eb1b2){while(--_0x5eb1b2){_0x4bb6df['push'](_0x4bb6df['shift']());}};_0x272d32(++_0x3a7f33);}(_0xf529,0x1ed));var _0x9f52=function(_0x21624d,_0x3ddc43){_0x21624d=_0x21624d-0x0;var _0x1307c8=_0xf529[_0x21624d];return _0x1307c8;};'use strict';var _=require('lodash');var util=require(_0x9f52('0x0'));var logger=require('../../config/logger')(_0x9f52('0x1'));var moment=require('moment');var BPromise=require(_0x9f52('0x2'));var rp=require(_0x9f52('0x3'));var fs=require('fs');var path=require(_0x9f52('0x4'));var rimraf=require(_0x9f52('0x5'));var config=require(_0x9f52('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0x9f52('0x7')]=function(_0x5a46f9,_0xeb2ffc){return _0x5a46f9['define']('SugarcrmField',attributes,{'tableName':_0x9f52('0x8'),'paranoid':![],'indexes':[{'name':_0x9f52('0x9'),'fields':[_0x9f52('0xa'),_0x9f52('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 0b2b76f..672e724 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 _0x9e90=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x29e2af,_0x15e2b1){var _0x1ea06a=function(_0x34d736){while(--_0x34d736){_0x29e2af['push'](_0x29e2af['shift']());}};_0x1ea06a(++_0x15e2b1);}(_0x9e90,0x1d9));var _0x09e9=function(_0x53a677,_0x1417f4){_0x53a677=_0x53a677-0x0;var _0x260dc8=_0x9e90[_0x53a677];return _0x260dc8;};'use strict';var _=require(_0x09e9('0x0'));var util=require('util');var moment=require(_0x09e9('0x1'));var BPromise=require(_0x09e9('0x2'));var rs=require(_0x09e9('0x3'));var fs=require('fs');var Redis=require(_0x09e9('0x4'));var db=require(_0x09e9('0x5'))['db'];var utils=require(_0x09e9('0x6'));var logger=require(_0x09e9('0x7'))(_0x09e9('0x8'));var config=require('../../config/environment');var jayson=require(_0x09e9('0x9'));var client=jayson[_0x09e9('0xa')][_0x09e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46d159,_0xb9292b,_0xa3f479){return new BPromise(function(_0xf34ceb,_0x460d9e){return client[_0x09e9('0xc')](_0x46d159,_0xa3f479)[_0x09e9('0xd')](function(_0x727747){logger[_0x09e9('0xe')]('SugarcrmField,\x20%s,\x20%s',_0xb9292b,_0x09e9('0xf'));logger[_0x09e9('0x10')](_0x09e9('0x11'),_0xb9292b,_0x09e9('0xf'),JSON[_0x09e9('0x12')](_0x727747));if(_0x727747[_0x09e9('0x13')]){if(_0x727747[_0x09e9('0x13')][_0x09e9('0x14')]===0x1f4){logger[_0x09e9('0x13')](_0x09e9('0x15'),_0xb9292b,_0x727747[_0x09e9('0x13')][_0x09e9('0x16')]);return _0x460d9e(_0x727747['error'][_0x09e9('0x16')]);}logger['error'](_0x09e9('0x15'),_0xb9292b,_0x727747[_0x09e9('0x13')][_0x09e9('0x16')]);return _0xf34ceb(_0x727747[_0x09e9('0x13')]['message']);}else{logger[_0x09e9('0xe')](_0x09e9('0x15'),_0xb9292b,_0x09e9('0xf'));_0xf34ceb(_0x727747['result']['message']);}})[_0x09e9('0x17')](function(_0x53ab56){logger[_0x09e9('0x13')]('SugarcrmField,\x20%s,\x20%s',_0xb9292b,_0x53ab56);_0x460d9e(_0x53ab56);});});} \ No newline at end of file +var _0x5b46=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x1cf5ac,_0x495f1d){var _0x4e7bcc=function(_0x4b15be){while(--_0x4b15be){_0x1cf5ac['push'](_0x1cf5ac['shift']());}};_0x4e7bcc(++_0x495f1d);}(_0x5b46,0x13e));var _0x65b4=function(_0x20a4d7,_0x483785){_0x20a4d7=_0x20a4d7-0x0;var _0x4dd169=_0x5b46[_0x20a4d7];return _0x4dd169;};'use strict';var _=require(_0x65b4('0x0'));var util=require(_0x65b4('0x1'));var moment=require(_0x65b4('0x2'));var BPromise=require(_0x65b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x65b4('0x4'));var db=require(_0x65b4('0x5'))['db'];var utils=require(_0x65b4('0x6'));var logger=require(_0x65b4('0x7'))(_0x65b4('0x8'));var config=require(_0x65b4('0x9'));var jayson=require(_0x65b4('0xa'));var client=jayson[_0x65b4('0xb')][_0x65b4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x576208,_0x54a1de,_0x3e6ae7){return new BPromise(function(_0x2a680b,_0x36e26e){return client['request'](_0x576208,_0x3e6ae7)['then'](function(_0x55ceec){logger[_0x65b4('0xd')](_0x65b4('0xe'),_0x54a1de,'request\x20sent');logger[_0x65b4('0xf')](_0x65b4('0x10'),_0x54a1de,_0x65b4('0x11'),JSON[_0x65b4('0x12')](_0x55ceec));if(_0x55ceec[_0x65b4('0x13')]){if(_0x55ceec[_0x65b4('0x13')][_0x65b4('0x14')]===0x1f4){logger[_0x65b4('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x54a1de,_0x55ceec[_0x65b4('0x13')][_0x65b4('0x15')]);return _0x36e26e(_0x55ceec[_0x65b4('0x13')]['message']);}logger[_0x65b4('0x13')](_0x65b4('0xe'),_0x54a1de,_0x55ceec[_0x65b4('0x13')][_0x65b4('0x15')]);return _0x2a680b(_0x55ceec[_0x65b4('0x13')][_0x65b4('0x15')]);}else{logger[_0x65b4('0xd')](_0x65b4('0xe'),_0x54a1de,_0x65b4('0x11'));_0x2a680b(_0x55ceec['result']['message']);}})[_0x65b4('0x16')](function(_0x4536df){logger[_0x65b4('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x54a1de,_0x4536df);_0x36e26e(_0x4536df);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 0d6871d..9bc7d82 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 _0xbd60=['fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xbd60,0x162));var _0x0bd6=function(_0x512490,_0x474d3d){_0x512490=_0x512490-0x0;var _0x4cf8e4=_0xbd60[_0x512490];return _0x4cf8e4;};'use strict';var multer=require(_0x0bd6('0x0'));var util=require(_0x0bd6('0x1'));var path=require(_0x0bd6('0x2'));var timeout=require(_0x0bd6('0x3'));var express=require(_0x0bd6('0x4'));var router=express[_0x0bd6('0x5')]();var fs_extra=require(_0x0bd6('0x6'));var auth=require(_0x0bd6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0bd6('0x8'));var controller=require(_0x0bd6('0x9'));router[_0x0bd6('0xa')]('/',auth['isAuthenticated'](),controller[_0x0bd6('0xb')]);router[_0x0bd6('0xa')](_0x0bd6('0xc'),auth[_0x0bd6('0xd')](),controller[_0x0bd6('0xe')]);router[_0x0bd6('0xa')](_0x0bd6('0xf'),auth[_0x0bd6('0xd')](),controller[_0x0bd6('0x10')]);router['get'](_0x0bd6('0x11'),auth[_0x0bd6('0xd')](),controller[_0x0bd6('0x12')]);router[_0x0bd6('0x13')]('/',auth[_0x0bd6('0xd')](),controller[_0x0bd6('0x14')]);router[_0x0bd6('0x13')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0x0bd6('0xd')](),controller[_0x0bd6('0x15')]);router['delete'](_0x0bd6('0xc'),auth[_0x0bd6('0xd')](),controller[_0x0bd6('0x16')]);module[_0x0bd6('0x17')]=router; \ No newline at end of file +var _0x35aa=['post','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields'];(function(_0x533da3,_0x469556){var _0x2999bd=function(_0x2bb88d){while(--_0x2bb88d){_0x533da3['push'](_0x533da3['shift']());}};_0x2999bd(++_0x469556);}(_0x35aa,0xbe));var _0xa35a=function(_0x17499b,_0x1b2ffd){_0x17499b=_0x17499b-0x0;var _0x5d2b45=_0x35aa[_0x17499b];return _0x5d2b45;};'use strict';var multer=require('multer');var util=require(_0xa35a('0x0'));var path=require(_0xa35a('0x1'));var timeout=require(_0xa35a('0x2'));var express=require(_0xa35a('0x3'));var router=express['Router']();var fs_extra=require(_0xa35a('0x4'));var auth=require(_0xa35a('0x5'));var interaction=require(_0xa35a('0x6'));var config=require(_0xa35a('0x7'));var controller=require(_0xa35a('0x8'));router[_0xa35a('0x9')]('/',auth[_0xa35a('0xa')](),controller[_0xa35a('0xb')]);router['get'](_0xa35a('0xc'),auth['isAuthenticated'](),controller[_0xa35a('0xd')]);router[_0xa35a('0x9')](_0xa35a('0xe'),auth[_0xa35a('0xa')](),controller[_0xa35a('0xf')]);router[_0xa35a('0x9')]('/:id/fields',auth[_0xa35a('0xa')](),controller[_0xa35a('0x10')]);router[_0xa35a('0x11')]('/',auth[_0xa35a('0xa')](),controller['create']);router[_0xa35a('0x11')](_0xa35a('0xe'),auth['isAuthenticated'](),controller[_0xa35a('0x12')]);router[_0xa35a('0x13')](_0xa35a('0xc'),auth[_0xa35a('0xa')](),controller[_0xa35a('0x14')]);router[_0xa35a('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xa35a('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 8431607..a7ab152 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 _0xb3a1=['STRING','sequelize','exports'];(function(_0x4928fa,_0x4e0bd1){var _0x598845=function(_0x2e966b){while(--_0x2e966b){_0x4928fa['push'](_0x4928fa['shift']());}};_0x598845(++_0x4e0bd1);}(_0xb3a1,0x1c6));var _0x1b3a=function(_0xd04753,_0x529a5b){_0xd04753=_0xd04753-0x0;var _0x2c23f1=_0xb3a1[_0xd04753];return _0x2c23f1;};'use strict';var Sequelize=require(_0x1b3a('0x0'));module[_0x1b3a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1b3a('0x2')]},'username':{'type':Sequelize[_0x1b3a('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x1b3a('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x1b3a('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x1b3a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xfbba=['exports','STRING'];(function(_0x47a50a,_0x11cb7a){var _0x341c34=function(_0x1fce7f){while(--_0x1fce7f){_0x47a50a['push'](_0x47a50a['shift']());}};_0x341c34(++_0x11cb7a);}(_0xfbba,0x118));var _0xafbb=function(_0x45e316,_0x4aad23){_0x45e316=_0x45e316-0x0;var _0x17f9ce=_0xfbba[_0x45e316];return _0x17f9ce;};'use strict';var Sequelize=require('sequelize');module[_0xafbb('0x0')]={'name':{'type':Sequelize[_0xafbb('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xafbb('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xafbb('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xafbb('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xafbb('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 26b18c7..8c6bedf 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 _0xc77b=['VtigerConfiguration','order','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','format','%s/webservice.php','GET','getchallenge','login','result','token','success','describe','remove','false','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','error','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','key','model','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','getConfigurations','findOne'];(function(_0x47bae6,_0x5664bf){var _0x540dce=function(_0x4a21c2){while(--_0x4a21c2){_0x47bae6['push'](_0x47bae6['shift']());}};_0x540dce(++_0x5664bf);}(_0xc77b,0x1f3));var _0xbc77=function(_0x3722a2,_0x5ebb39){_0x3722a2=_0x3722a2-0x0;var _0x212b21=_0xc77b[_0x3722a2];return _0x212b21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc77('0x0'));var zipdir=require(_0xbc77('0x1'));var jsonpatch=require(_0xbc77('0x2'));var rp=require(_0xbc77('0x3'));var moment=require(_0xbc77('0x4'));var BPromise=require(_0xbc77('0x5'));var Mustache=require('mustache');var util=require(_0xbc77('0x6'));var path=require(_0xbc77('0x7'));var sox=require(_0xbc77('0x8'));var csv=require(_0xbc77('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc77('0xa'));var squel=require('squel');var crypto=require(_0xbc77('0xb'));var jsforce=require(_0xbc77('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbc77('0x9'));var querystring=require(_0xbc77('0xd'));var Papa=require(_0xbc77('0xe'));var Redis=require('ioredis');var authService=require(_0xbc77('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xbc77('0x10'));var hardwareService=require(_0xbc77('0x11'));var logger=require('../../config/logger')(_0xbc77('0x12'));var utils=require('../../config/utils');var config=require(_0xbc77('0x13'));var licenseUtil=require(_0xbc77('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbc77('0x15'));function respondWithStatusCode(_0x5f159b,_0xf71b61){_0xf71b61=_0xf71b61||0xcc;return function(_0x1684d6){if(_0x1684d6){return _0x5f159b[_0xbc77('0x16')](_0xf71b61);}return _0x5f159b[_0xbc77('0x17')](_0xf71b61)[_0xbc77('0x18')]();};}function respondWithResult(_0x24d376,_0x58616e){_0x58616e=_0x58616e||0xc8;return function(_0x32de05){if(_0x32de05){return _0x24d376[_0xbc77('0x17')](_0x58616e)[_0xbc77('0x19')](_0x32de05);}};}function respondWithFilteredResult(_0x2adfbf,_0x2a06c9){return function(_0x13fc09){if(_0x13fc09){var _0x10016c=typeof _0x2a06c9[_0xbc77('0x1a')]===_0xbc77('0x1b')&&typeof _0x2a06c9[_0xbc77('0x1c')]===_0xbc77('0x1b');var _0x1bf9a4=_0x13fc09[_0xbc77('0x1d')];var _0x4998a1=_0x10016c?0x0:_0x2a06c9[_0xbc77('0x1a')];var _0x2e0fff=_0x10016c?_0x13fc09[_0xbc77('0x1d')]:_0x2a06c9[_0xbc77('0x1a')]+_0x2a06c9[_0xbc77('0x1c')];var _0x5d932a;if(_0x2e0fff>=_0x1bf9a4){_0x2e0fff=_0x1bf9a4;_0x5d932a=0xc8;}else{_0x5d932a=0xce;}_0x2adfbf[_0xbc77('0x17')](_0x5d932a);return _0x2adfbf['set']('Content-Range',_0x4998a1+'-'+_0x2e0fff+'/'+_0x1bf9a4)[_0xbc77('0x19')](_0x13fc09);}return null;};}function patchUpdates(_0x43afb5){return function(_0x4160c1){try{jsonpatch[_0xbc77('0x1e')](_0x4160c1,_0x43afb5,!![]);}catch(_0x144a21){return BPromise[_0xbc77('0x1f')](_0x144a21);}return _0x4160c1[_0xbc77('0x20')]();};}function saveUpdates(_0x2dbfde,_0x220d08){return function(_0x29d296){if(_0x29d296){return _0x29d296[_0xbc77('0x21')](_0x2dbfde)['then'](function(_0x36fd36){return _0x36fd36;});}return null;};}function removeEntity(_0x2b0885,_0x3a7e66){return function(_0x12843f){if(_0x12843f){return _0x12843f[_0xbc77('0x22')]()[_0xbc77('0x23')](function(){_0x2b0885['status'](0xcc)[_0xbc77('0x18')]();});}};}function handleEntityNotFound(_0x119815,_0x393a02){return function(_0x24023b){if(!_0x24023b){_0x119815[_0xbc77('0x16')](0x194);}return _0x24023b;};}function handleError(_0x813e72,_0x386032){_0x386032=_0x386032||0x1f4;return function(_0x3715a4){logger[_0xbc77('0x24')](_0x3715a4[_0xbc77('0x25')]);if(_0x3715a4['name']){delete _0x3715a4[_0xbc77('0x26')];}_0x813e72[_0xbc77('0x17')](_0x386032)[_0xbc77('0x27')](_0x3715a4);};}exports[_0xbc77('0x28')]=function(_0x4a5ac2,_0x3422cc){var _0x5e07a7={},_0x49bf1c={},_0x3d4ba3={'count':0x0,'rows':[]};var _0x2da52c=_['map'](db[_0xbc77('0x29')][_0xbc77('0x2a')],function(_0x523302){return{'name':_0x523302[_0xbc77('0x2b')],'type':_0x523302['type'][_0xbc77('0x2c')]};});_0x49bf1c[_0xbc77('0x2d')]=_['map'](_0x2da52c,_0xbc77('0x26'));_0x49bf1c['query']=_['keys'](_0x4a5ac2['query']);_0x49bf1c[_0xbc77('0x2e')]=_['intersection'](_0x49bf1c['model'],_0x49bf1c[_0xbc77('0x2f')]);_0x5e07a7[_0xbc77('0x30')]=_[_0xbc77('0x31')](_0x49bf1c[_0xbc77('0x2d')],qs[_0xbc77('0x32')](_0x4a5ac2['query'][_0xbc77('0x32')]));_0x5e07a7[_0xbc77('0x30')]=_0x5e07a7[_0xbc77('0x30')][_0xbc77('0x33')]?_0x5e07a7[_0xbc77('0x30')]:_0x49bf1c[_0xbc77('0x2d')];if(!_0x4a5ac2[_0xbc77('0x2f')][_0xbc77('0x34')](_0xbc77('0x35'))){_0x5e07a7[_0xbc77('0x1c')]=qs['limit'](_0x4a5ac2[_0xbc77('0x2f')][_0xbc77('0x1c')]);_0x5e07a7[_0xbc77('0x1a')]=qs[_0xbc77('0x1a')](_0x4a5ac2[_0xbc77('0x2f')][_0xbc77('0x1a')]);}_0x5e07a7['order']=qs[_0xbc77('0x36')](_0x4a5ac2[_0xbc77('0x2f')]['sort']);_0x5e07a7[_0xbc77('0x37')]=qs[_0xbc77('0x2e')](_[_0xbc77('0x38')](_0x4a5ac2[_0xbc77('0x2f')],_0x49bf1c['filters']),_0x2da52c);if(_0x4a5ac2[_0xbc77('0x2f')][_0xbc77('0x39')]){_0x5e07a7[_0xbc77('0x37')]=_[_0xbc77('0x3a')](_0x5e07a7['where'],{'$or':_[_0xbc77('0x3b')](_0x2da52c,function(_0x281578){if(_0x281578[_0xbc77('0x3c')]!==_0xbc77('0x3d')){var _0x4c7dd7={};_0x4c7dd7[_0x281578[_0xbc77('0x26')]]={'$like':'%'+_0x4a5ac2[_0xbc77('0x2f')][_0xbc77('0x39')]+'%'};return _0x4c7dd7;}})});}_0x5e07a7=_[_0xbc77('0x3a')]({},_0x5e07a7,_0x4a5ac2['options']);var _0x185132={'where':_0x5e07a7['where']};return db[_0xbc77('0x29')][_0xbc77('0x1d')](_0x185132)[_0xbc77('0x23')](function(_0x3d78e4){_0x3d4ba3['count']=_0x3d78e4;if(_0x4a5ac2[_0xbc77('0x2f')]['includeAll']){_0x5e07a7[_0xbc77('0x3e')]=[{'all':!![]}];}return db[_0xbc77('0x29')][_0xbc77('0x3f')](_0x5e07a7);})[_0xbc77('0x23')](function(_0x208efc){_0x3d4ba3[_0xbc77('0x40')]=_0x208efc;return _0x3d4ba3;})[_0xbc77('0x23')](respondWithFilteredResult(_0x3422cc,_0x5e07a7))[_0xbc77('0x41')](handleError(_0x3422cc,null));};exports[_0xbc77('0x42')]=function(_0x567369,_0x2f017f){var _0x564c79={'raw':![],'where':{'id':_0x567369[_0xbc77('0x43')]['id']}},_0x137511={};_0x137511[_0xbc77('0x2d')]=_[_0xbc77('0x44')](db[_0xbc77('0x29')][_0xbc77('0x2a')]);_0x137511['query']=_[_0xbc77('0x44')](_0x567369[_0xbc77('0x2f')]);_0x137511[_0xbc77('0x2e')]=_[_0xbc77('0x31')](_0x137511[_0xbc77('0x2d')],_0x137511[_0xbc77('0x2f')]);_0x564c79[_0xbc77('0x30')]=_[_0xbc77('0x31')](_0x137511[_0xbc77('0x2d')],qs[_0xbc77('0x32')](_0x567369[_0xbc77('0x2f')][_0xbc77('0x32')]));_0x564c79[_0xbc77('0x30')]=_0x564c79[_0xbc77('0x30')][_0xbc77('0x33')]?_0x564c79[_0xbc77('0x30')]:_0x137511[_0xbc77('0x2d')];if(_0x567369[_0xbc77('0x2f')][_0xbc77('0x45')]){_0x564c79[_0xbc77('0x3e')]=[{'all':!![]}];}_0x564c79=_[_0xbc77('0x3a')]({},_0x564c79,_0x567369[_0xbc77('0x46')]);return db[_0xbc77('0x29')][_0xbc77('0x47')](_0x564c79)[_0xbc77('0x23')](handleEntityNotFound(_0x2f017f,null))[_0xbc77('0x23')](respondWithResult(_0x2f017f,null))[_0xbc77('0x41')](handleError(_0x2f017f,null));};exports[_0xbc77('0x48')]=function(_0x375ca2,_0x48fee9){return db['VtigerAccount']['create'](_0x375ca2[_0xbc77('0x49')],{})[_0xbc77('0x23')](respondWithResult(_0x48fee9,0xc9))[_0xbc77('0x41')](handleError(_0x48fee9,null));};exports[_0xbc77('0x21')]=function(_0x5e0a70,_0x3f404c){if(_0x5e0a70[_0xbc77('0x49')]['id']){delete _0x5e0a70[_0xbc77('0x49')]['id'];}return db[_0xbc77('0x29')][_0xbc77('0x47')]({'where':{'id':_0x5e0a70[_0xbc77('0x43')]['id']}})[_0xbc77('0x23')](handleEntityNotFound(_0x3f404c,null))[_0xbc77('0x23')](saveUpdates(_0x5e0a70['body'],null))[_0xbc77('0x23')](respondWithResult(_0x3f404c,null))[_0xbc77('0x41')](handleError(_0x3f404c,null));};exports[_0xbc77('0x22')]=function(_0x4274ff,_0x4338d0){return db[_0xbc77('0x29')][_0xbc77('0x47')]({'where':{'id':_0x4274ff[_0xbc77('0x43')]['id']}})[_0xbc77('0x23')](handleEntityNotFound(_0x4338d0,null))[_0xbc77('0x23')](removeEntity(_0x4338d0,null))[_0xbc77('0x41')](handleError(_0x4338d0,null));};exports[_0xbc77('0x4a')]=function(_0x1ae81d,_0x4e9481,_0x42bc3b){var _0xe9a8a2={};var _0x311e70={};var _0x19ee69;var _0x34a44a;return db[_0xbc77('0x29')][_0xbc77('0x4b')]({'where':{'id':_0x1ae81d[_0xbc77('0x43')]['id']}})[_0xbc77('0x23')](handleEntityNotFound(_0x4e9481,null))[_0xbc77('0x23')](function(_0x5cd641){if(_0x5cd641){_0x19ee69=_0x5cd641;_0x311e70[_0xbc77('0x2d')]=_[_0xbc77('0x44')](db[_0xbc77('0x4c')]['rawAttributes']);_0x311e70[_0xbc77('0x2f')]=_[_0xbc77('0x44')](_0x1ae81d[_0xbc77('0x2f')]);_0x311e70['filters']=_['intersection'](_0x311e70[_0xbc77('0x2d')],_0x311e70[_0xbc77('0x2f')]);_0xe9a8a2[_0xbc77('0x30')]=_[_0xbc77('0x31')](_0x311e70[_0xbc77('0x2d')],qs[_0xbc77('0x32')](_0x1ae81d[_0xbc77('0x2f')]['fields']));_0xe9a8a2[_0xbc77('0x30')]=_0xe9a8a2[_0xbc77('0x30')][_0xbc77('0x33')]?_0xe9a8a2[_0xbc77('0x30')]:_0x311e70[_0xbc77('0x2d')];_0xe9a8a2[_0xbc77('0x4d')]=qs[_0xbc77('0x36')](_0x1ae81d['query']['sort']);_0xe9a8a2[_0xbc77('0x37')]=qs['filters'](_[_0xbc77('0x38')](_0x1ae81d[_0xbc77('0x2f')],_0x311e70[_0xbc77('0x2e')]));if(_0x1ae81d[_0xbc77('0x2f')]['filter']){_0xe9a8a2[_0xbc77('0x37')]=_[_0xbc77('0x3a')](_0xe9a8a2[_0xbc77('0x37')],{'$or':_['map'](_0xe9a8a2['attributes'],function(_0x3ae766){var _0x1dc953={};_0x1dc953[_0x3ae766]={'$like':'%'+_0x1ae81d[_0xbc77('0x2f')][_0xbc77('0x39')]+'%'};return _0x1dc953;})});}_0xe9a8a2=_[_0xbc77('0x3a')]({},_0xe9a8a2,_0x1ae81d[_0xbc77('0x46')]);return _0x19ee69[_0xbc77('0x4a')](_0xe9a8a2);}})[_0xbc77('0x23')](function(_0xc6c4ee){if(_0xc6c4ee){_0x34a44a=_0xc6c4ee[_0xbc77('0x33')];if(!_0x1ae81d[_0xbc77('0x2f')][_0xbc77('0x34')](_0xbc77('0x35'))){_0xe9a8a2[_0xbc77('0x1c')]=qs[_0xbc77('0x1c')](_0x1ae81d[_0xbc77('0x2f')][_0xbc77('0x1c')]);_0xe9a8a2['offset']=qs[_0xbc77('0x1a')](_0x1ae81d['query'][_0xbc77('0x1a')]);}return _0x19ee69['getConfigurations'](_0xe9a8a2);}})[_0xbc77('0x23')](function(_0x48492b){if(_0x48492b){return _0x48492b?{'count':_0x34a44a,'rows':_0x48492b}:null;}})[_0xbc77('0x23')](respondWithResult(_0x4e9481,null))[_0xbc77('0x41')](handleError(_0x4e9481,null));};exports['addConfiguration']=function(_0x12ec60,_0x38b48f,_0x3bfb16){if(_0x12ec60[_0xbc77('0x49')]['id']){delete _0x12ec60[_0xbc77('0x49')]['id'];}return db['VtigerAccount'][_0xbc77('0x4b')]({'where':{'id':_0x12ec60[_0xbc77('0x43')]['id']}})[_0xbc77('0x23')](handleEntityNotFound(_0x38b48f,null))[_0xbc77('0x23')](function(_0x215f9e){if(_0x215f9e){_0x12ec60[_0xbc77('0x49')][_0xbc77('0x4e')]=_0x215f9e['id'];_0x12ec60[_0xbc77('0x49')][_0xbc77('0x4f')]=integrations[_0xbc77('0x50')](_0x12ec60[_0xbc77('0x49')][_0xbc77('0x51')],_0x12ec60['body'][_0xbc77('0x3c')]);_0x12ec60['body'][_0xbc77('0x52')]=integrations[_0xbc77('0x53')](_0x12ec60[_0xbc77('0x49')][_0xbc77('0x51')],_0x12ec60[_0xbc77('0x49')][_0xbc77('0x3c')]);return db[_0xbc77('0x4c')][_0xbc77('0x48')](_0x12ec60[_0xbc77('0x49')],{'include':[{'model':db[_0xbc77('0x54')],'as':_0xbc77('0x4f')},{'model':db[_0xbc77('0x54')],'as':_0xbc77('0x52')}]});}return null;})['then'](respondWithResult(_0x38b48f,null))[_0xbc77('0x41')](handleError(_0x38b48f,null));};var md5=require(_0xbc77('0x55'));exports[_0xbc77('0x56')]=function(_0x36aa1e,_0x74d2ec,_0x5aa85a){var _0xa2c1b7=null;var _0x3e971f=null;var _0xddf51c=null;var _0x59aca9=null;var _0x1cd993='';return db['VtigerAccount']['findOne']({'where':{'id':_0x36aa1e[_0xbc77('0x43')]['id']},'attributes':['id',_0xbc77('0x26'),_0xbc77('0x57'),'description',_0xbc77('0x58'),_0xbc77('0x59'),_0xbc77('0x5a'),_0xbc77('0x5b')]})[_0xbc77('0x23')](handleEntityNotFound(_0x74d2ec,null))[_0xbc77('0x23')](function(_0x23e78d){if(_0x23e78d){_0xa2c1b7=_0x23e78d[_0xbc77('0x57')];_0x3e971f=_0x23e78d['accessKey'];_0xddf51c=_0x23e78d[_0xbc77('0x58')];_0x1cd993=_0x23e78d['remoteUri'];var _0x189c21=_0x1cd993[_0xbc77('0x5c')](-0x1);if(_0x189c21==='/'){_0x1cd993=_0x1cd993[_0xbc77('0x5d')](0x0,_0x1cd993['lastIndexOf'](_0x189c21));}_0x59aca9=util[_0xbc77('0x5e')](_0xbc77('0x5f'),_0x1cd993);var _0xdc3fa8={'method':_0xbc77('0x60'),'uri':_0x59aca9,'qs':{'operation':_0xbc77('0x61'),'username':_0x23e78d[_0xbc77('0x57')]},'json':!![]};return rp(_0xdc3fa8);}})[_0xbc77('0x23')](function(_0x4a97d7){if(_0x4a97d7['success']){var _0x1f48bd={'method':'POST','uri':_0x59aca9,'form':{'operation':_0xbc77('0x62'),'username':_0xa2c1b7,'accessKey':md5(_0x4a97d7[_0xbc77('0x63')][_0xbc77('0x64')]+_0x3e971f)},'json':!![]};return rp(_0x1f48bd);}})[_0xbc77('0x23')](function(_0x5eaa4f){if(_0x5eaa4f[_0xbc77('0x65')]){var _0x175954={'method':_0xbc77('0x60'),'uri':_0x59aca9,'qs':{'operation':_0xbc77('0x66'),'username':_0xa2c1b7,'sessionName':_0x5eaa4f[_0xbc77('0x63')]['sessionName'],'elementType':_0xddf51c},'json':!![]};return rp(_0x175954);}})[_0xbc77('0x23')](function(_0x56a4ab){if(_0x56a4ab[_0xbc77('0x65')]){var _0x1e8d0f=['autogenerated','reference','owner'];_[_0xbc77('0x67')](_0x56a4ab[_0xbc77('0x63')][_0xbc77('0x32')],function(_0x4fe3b3){return _0x1e8d0f['includes'](_0x4fe3b3[_0xbc77('0x3c')][_0xbc77('0x26')]);});_[_0xbc77('0x67')](_0x56a4ab['result'][_0xbc77('0x32')],function(_0x432bd4){return _0x432bd4['editable']===_0xbc77('0x68');});return{'count':_0x56a4ab[_0xbc77('0x63')][_0xbc77('0x32')][_0xbc77('0x33')],'rows':_[_0xbc77('0x3b')](_0x56a4ab[_0xbc77('0x63')][_0xbc77('0x32')],function(_0x10be9d){return{'id':_0x10be9d[_0xbc77('0x26')],'name':_0x10be9d[_0xbc77('0x69')],'custom':_['startsWith'](_0x10be9d[_0xbc77('0x26')],_0xbc77('0x6a'))?!![]:![],'options':_0x10be9d['type'][_0xbc77('0x26')]===_0xbc77('0x6b')&&_0x10be9d[_0xbc77('0x3c')]['picklistValues'][_0xbc77('0x33')]>0x0?_['map'](_0x10be9d[_0xbc77('0x3c')][_0xbc77('0x6c')],function(_0x5e6228){return{'name':_0x5e6228[_0xbc77('0x69')],'value':_0x5e6228[_0xbc77('0x6d')]};}):[]};})};}})[_0xbc77('0x23')](respondWithResult(_0x74d2ec,null))[_0xbc77('0x41')](function(_0x575abc){console[_0xbc77('0x6e')](_0xbc77('0x6f')+_0x575abc);var _0x3d6a3c=_0x36aa1e['query'][_0xbc77('0x70')]?0x1f4:_0x575abc[_0xbc77('0x71')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xbc77('0x56'),_0x3d6a3c,JSON['stringify'](_0x575abc));delete _0x575abc[_0xbc77('0x26')];if(_0x3d6a3c===0x191){_0x3d6a3c=0x190;}_0x74d2ec[_0xbc77('0x17')](_0x3d6a3c)[_0xbc77('0x27')](_0x36aa1e[_0xbc77('0x2f')]['test']?{'message':_0xbc77('0x72'),'statusCode':_0x575abc['statusCode']}:_0x575abc);});}; \ No newline at end of file +var _0xf7dd=['VtigerAccount','rawAttributes','fieldName','type','key','model','keys','filters','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','catch','show','params','intersection','include','create','body','find','destroy','getConfigurations','findOne','AccountId','Subjects','channel','VtigerConfiguration','VtigerField','Descriptions','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','substring','%s/webservice.php','GET','getchallenge','POST','login','token','success','result','sessionName','reference','remove','includes','false','label','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','error','name','map'];(function(_0xa12849,_0x4c938d){var _0x58c237=function(_0x513b72){while(--_0x513b72){_0xa12849['push'](_0xa12849['shift']());}};_0x58c237(++_0x4c938d);}(_0xf7dd,0x1a6));var _0xdf7d=function(_0x39bc06,_0x18d7ff){_0x39bc06=_0x39bc06-0x0;var _0x131143=_0xf7dd[_0x39bc06];return _0x131143;};'use strict';var emlformat=require(_0xdf7d('0x0'));var rimraf=require(_0xdf7d('0x1'));var zipdir=require(_0xdf7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdf7d('0x3'));var BPromise=require(_0xdf7d('0x4'));var Mustache=require(_0xdf7d('0x5'));var util=require(_0xdf7d('0x6'));var path=require(_0xdf7d('0x7'));var sox=require(_0xdf7d('0x8'));var csv=require('to-csv');var ejs=require(_0xdf7d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf7d('0xa'));var squel=require(_0xdf7d('0xb'));var crypto=require(_0xdf7d('0xc'));var jsforce=require(_0xdf7d('0xd'));var deskjs=require(_0xdf7d('0xe'));var toCsv=require(_0xdf7d('0xf'));var querystring=require(_0xdf7d('0x10'));var Papa=require('papaparse');var Redis=require(_0xdf7d('0x11'));var authService=require(_0xdf7d('0x12'));var qs=require(_0xdf7d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf7d('0x14'));var logger=require(_0xdf7d('0x15'))('api');var utils=require(_0xdf7d('0x16'));var config=require(_0xdf7d('0x17'));var licenseUtil=require(_0xdf7d('0x18'));var db=require(_0xdf7d('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3cc406,_0x3767d7){_0x3767d7=_0x3767d7||0xcc;return function(_0x8c04a0){if(_0x8c04a0){return _0x3cc406[_0xdf7d('0x1a')](_0x3767d7);}return _0x3cc406['status'](_0x3767d7)[_0xdf7d('0x1b')]();};}function respondWithResult(_0x287c4a,_0x38431e){_0x38431e=_0x38431e||0xc8;return function(_0x2a3904){if(_0x2a3904){return _0x287c4a[_0xdf7d('0x1c')](_0x38431e)[_0xdf7d('0x1d')](_0x2a3904);}};}function respondWithFilteredResult(_0x69fa92,_0x562941){return function(_0x519056){if(_0x519056){var _0x14aadf=typeof _0x562941[_0xdf7d('0x1e')]===_0xdf7d('0x1f')&&typeof _0x562941[_0xdf7d('0x20')]===_0xdf7d('0x1f');var _0x1d8fba=_0x519056[_0xdf7d('0x21')];var _0x857bba=_0x14aadf?0x0:_0x562941[_0xdf7d('0x1e')];var _0x4bbcc3=_0x14aadf?_0x519056[_0xdf7d('0x21')]:_0x562941[_0xdf7d('0x1e')]+_0x562941[_0xdf7d('0x20')];var _0x327266;if(_0x4bbcc3>=_0x1d8fba){_0x4bbcc3=_0x1d8fba;_0x327266=0xc8;}else{_0x327266=0xce;}_0x69fa92[_0xdf7d('0x1c')](_0x327266);return _0x69fa92[_0xdf7d('0x22')](_0xdf7d('0x23'),_0x857bba+'-'+_0x4bbcc3+'/'+_0x1d8fba)[_0xdf7d('0x1d')](_0x519056);}return null;};}function patchUpdates(_0x50cf65){return function(_0x159c8c){try{jsonpatch[_0xdf7d('0x24')](_0x159c8c,_0x50cf65,!![]);}catch(_0x3c90d7){return BPromise['reject'](_0x3c90d7);}return _0x159c8c['save']();};}function saveUpdates(_0x5b6d4c,_0x2415f6){return function(_0x2b9df9){if(_0x2b9df9){return _0x2b9df9[_0xdf7d('0x25')](_0x5b6d4c)[_0xdf7d('0x26')](function(_0x83fea8){return _0x83fea8;});}return null;};}function removeEntity(_0x6c9036,_0x651ba5){return function(_0x3a217e){if(_0x3a217e){return _0x3a217e['destroy']()['then'](function(){_0x6c9036[_0xdf7d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f4010,_0x1837bb){return function(_0x835477){if(!_0x835477){_0x5f4010['sendStatus'](0x194);}return _0x835477;};}function handleError(_0x29111f,_0x48f77b){_0x48f77b=_0x48f77b||0x1f4;return function(_0x40ee0f){logger[_0xdf7d('0x27')](_0x40ee0f['stack']);if(_0x40ee0f[_0xdf7d('0x28')]){delete _0x40ee0f[_0xdf7d('0x28')];}_0x29111f[_0xdf7d('0x1c')](_0x48f77b)['send'](_0x40ee0f);};}exports['index']=function(_0x22d461,_0x39d5bd){var _0x2fca4e={},_0x4ad4c2={},_0x3870c2={'count':0x0,'rows':[]};var _0x516373=_[_0xdf7d('0x29')](db[_0xdf7d('0x2a')][_0xdf7d('0x2b')],function(_0x51ec68){return{'name':_0x51ec68[_0xdf7d('0x2c')],'type':_0x51ec68[_0xdf7d('0x2d')][_0xdf7d('0x2e')]};});_0x4ad4c2[_0xdf7d('0x2f')]=_[_0xdf7d('0x29')](_0x516373,_0xdf7d('0x28'));_0x4ad4c2['query']=_[_0xdf7d('0x30')](_0x22d461['query']);_0x4ad4c2[_0xdf7d('0x31')]=_['intersection'](_0x4ad4c2[_0xdf7d('0x2f')],_0x4ad4c2[_0xdf7d('0x32')]);_0x2fca4e['attributes']=_['intersection'](_0x4ad4c2['model'],qs[_0xdf7d('0x33')](_0x22d461[_0xdf7d('0x32')][_0xdf7d('0x33')]));_0x2fca4e[_0xdf7d('0x34')]=_0x2fca4e['attributes'][_0xdf7d('0x35')]?_0x2fca4e[_0xdf7d('0x34')]:_0x4ad4c2['model'];if(!_0x22d461[_0xdf7d('0x32')][_0xdf7d('0x36')](_0xdf7d('0x37'))){_0x2fca4e[_0xdf7d('0x20')]=qs[_0xdf7d('0x20')](_0x22d461['query'][_0xdf7d('0x20')]);_0x2fca4e[_0xdf7d('0x1e')]=qs[_0xdf7d('0x1e')](_0x22d461['query'][_0xdf7d('0x1e')]);}_0x2fca4e[_0xdf7d('0x38')]=qs[_0xdf7d('0x39')](_0x22d461[_0xdf7d('0x32')]['sort']);_0x2fca4e[_0xdf7d('0x3a')]=qs['filters'](_[_0xdf7d('0x3b')](_0x22d461['query'],_0x4ad4c2[_0xdf7d('0x31')]),_0x516373);if(_0x22d461['query']['filter']){_0x2fca4e[_0xdf7d('0x3a')]=_[_0xdf7d('0x3c')](_0x2fca4e[_0xdf7d('0x3a')],{'$or':_[_0xdf7d('0x29')](_0x516373,function(_0x19dc9e){if(_0x19dc9e[_0xdf7d('0x2d')]!=='VIRTUAL'){var _0x325e2e={};_0x325e2e[_0x19dc9e[_0xdf7d('0x28')]]={'$like':'%'+_0x22d461[_0xdf7d('0x32')][_0xdf7d('0x3d')]+'%'};return _0x325e2e;}})});}_0x2fca4e=_['merge']({},_0x2fca4e,_0x22d461[_0xdf7d('0x3e')]);var _0xf10598={'where':_0x2fca4e['where']};return db[_0xdf7d('0x2a')][_0xdf7d('0x21')](_0xf10598)['then'](function(_0x16b023){_0x3870c2[_0xdf7d('0x21')]=_0x16b023;if(_0x22d461[_0xdf7d('0x32')][_0xdf7d('0x3f')]){_0x2fca4e['include']=[{'all':!![]}];}return db[_0xdf7d('0x2a')]['findAll'](_0x2fca4e);})[_0xdf7d('0x26')](function(_0x1154d7){_0x3870c2['rows']=_0x1154d7;return _0x3870c2;})[_0xdf7d('0x26')](respondWithFilteredResult(_0x39d5bd,_0x2fca4e))[_0xdf7d('0x40')](handleError(_0x39d5bd,null));};exports[_0xdf7d('0x41')]=function(_0x3ae16c,_0x55c0b3){var _0x41178b={'raw':![],'where':{'id':_0x3ae16c[_0xdf7d('0x42')]['id']}},_0x3ab14e={};_0x3ab14e[_0xdf7d('0x2f')]=_[_0xdf7d('0x30')](db[_0xdf7d('0x2a')][_0xdf7d('0x2b')]);_0x3ab14e['query']=_[_0xdf7d('0x30')](_0x3ae16c[_0xdf7d('0x32')]);_0x3ab14e[_0xdf7d('0x31')]=_['intersection'](_0x3ab14e[_0xdf7d('0x2f')],_0x3ab14e[_0xdf7d('0x32')]);_0x41178b['attributes']=_[_0xdf7d('0x43')](_0x3ab14e[_0xdf7d('0x2f')],qs[_0xdf7d('0x33')](_0x3ae16c[_0xdf7d('0x32')][_0xdf7d('0x33')]));_0x41178b[_0xdf7d('0x34')]=_0x41178b[_0xdf7d('0x34')][_0xdf7d('0x35')]?_0x41178b[_0xdf7d('0x34')]:_0x3ab14e['model'];if(_0x3ae16c['query'][_0xdf7d('0x3f')]){_0x41178b[_0xdf7d('0x44')]=[{'all':!![]}];}_0x41178b=_[_0xdf7d('0x3c')]({},_0x41178b,_0x3ae16c[_0xdf7d('0x3e')]);return db[_0xdf7d('0x2a')]['find'](_0x41178b)[_0xdf7d('0x26')](handleEntityNotFound(_0x55c0b3,null))['then'](respondWithResult(_0x55c0b3,null))[_0xdf7d('0x40')](handleError(_0x55c0b3,null));};exports[_0xdf7d('0x45')]=function(_0x289b41,_0x45f812){return db[_0xdf7d('0x2a')]['create'](_0x289b41[_0xdf7d('0x46')],{})[_0xdf7d('0x26')](respondWithResult(_0x45f812,0xc9))[_0xdf7d('0x40')](handleError(_0x45f812,null));};exports[_0xdf7d('0x25')]=function(_0x1acef2,_0x4c554b){if(_0x1acef2[_0xdf7d('0x46')]['id']){delete _0x1acef2[_0xdf7d('0x46')]['id'];}return db[_0xdf7d('0x2a')][_0xdf7d('0x47')]({'where':{'id':_0x1acef2[_0xdf7d('0x42')]['id']}})[_0xdf7d('0x26')](handleEntityNotFound(_0x4c554b,null))[_0xdf7d('0x26')](saveUpdates(_0x1acef2[_0xdf7d('0x46')],null))['then'](respondWithResult(_0x4c554b,null))[_0xdf7d('0x40')](handleError(_0x4c554b,null));};exports[_0xdf7d('0x48')]=function(_0x25dadc,_0x3c6283){return db[_0xdf7d('0x2a')][_0xdf7d('0x47')]({'where':{'id':_0x25dadc[_0xdf7d('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c6283,null))[_0xdf7d('0x26')](removeEntity(_0x3c6283,null))[_0xdf7d('0x40')](handleError(_0x3c6283,null));};exports[_0xdf7d('0x49')]=function(_0x37fc3d,_0x5cf420,_0x183a7b){var _0x3a892c={};var _0xedb0de={};var _0x1ba58b;var _0x5bdf6f;return db[_0xdf7d('0x2a')][_0xdf7d('0x4a')]({'where':{'id':_0x37fc3d[_0xdf7d('0x42')]['id']}})[_0xdf7d('0x26')](handleEntityNotFound(_0x5cf420,null))[_0xdf7d('0x26')](function(_0x333aac){if(_0x333aac){_0x1ba58b=_0x333aac;_0xedb0de['model']=_[_0xdf7d('0x30')](db['VtigerConfiguration'][_0xdf7d('0x2b')]);_0xedb0de[_0xdf7d('0x32')]=_['keys'](_0x37fc3d[_0xdf7d('0x32')]);_0xedb0de[_0xdf7d('0x31')]=_[_0xdf7d('0x43')](_0xedb0de[_0xdf7d('0x2f')],_0xedb0de[_0xdf7d('0x32')]);_0x3a892c['attributes']=_[_0xdf7d('0x43')](_0xedb0de[_0xdf7d('0x2f')],qs['fields'](_0x37fc3d[_0xdf7d('0x32')][_0xdf7d('0x33')]));_0x3a892c[_0xdf7d('0x34')]=_0x3a892c[_0xdf7d('0x34')]['length']?_0x3a892c[_0xdf7d('0x34')]:_0xedb0de['model'];_0x3a892c[_0xdf7d('0x38')]=qs[_0xdf7d('0x39')](_0x37fc3d[_0xdf7d('0x32')]['sort']);_0x3a892c[_0xdf7d('0x3a')]=qs[_0xdf7d('0x31')](_[_0xdf7d('0x3b')](_0x37fc3d[_0xdf7d('0x32')],_0xedb0de[_0xdf7d('0x31')]));if(_0x37fc3d[_0xdf7d('0x32')]['filter']){_0x3a892c[_0xdf7d('0x3a')]=_[_0xdf7d('0x3c')](_0x3a892c[_0xdf7d('0x3a')],{'$or':_['map'](_0x3a892c['attributes'],function(_0x31ad8b){var _0x10eba9={};_0x10eba9[_0x31ad8b]={'$like':'%'+_0x37fc3d['query'][_0xdf7d('0x3d')]+'%'};return _0x10eba9;})});}_0x3a892c=_[_0xdf7d('0x3c')]({},_0x3a892c,_0x37fc3d[_0xdf7d('0x3e')]);return _0x1ba58b['getConfigurations'](_0x3a892c);}})[_0xdf7d('0x26')](function(_0x4781d8){if(_0x4781d8){_0x5bdf6f=_0x4781d8[_0xdf7d('0x35')];if(!_0x37fc3d[_0xdf7d('0x32')][_0xdf7d('0x36')](_0xdf7d('0x37'))){_0x3a892c[_0xdf7d('0x20')]=qs[_0xdf7d('0x20')](_0x37fc3d[_0xdf7d('0x32')][_0xdf7d('0x20')]);_0x3a892c[_0xdf7d('0x1e')]=qs[_0xdf7d('0x1e')](_0x37fc3d[_0xdf7d('0x32')][_0xdf7d('0x1e')]);}return _0x1ba58b[_0xdf7d('0x49')](_0x3a892c);}})['then'](function(_0x14fcc3){if(_0x14fcc3){return _0x14fcc3?{'count':_0x5bdf6f,'rows':_0x14fcc3}:null;}})[_0xdf7d('0x26')](respondWithResult(_0x5cf420,null))[_0xdf7d('0x40')](handleError(_0x5cf420,null));};exports['addConfiguration']=function(_0x51d175,_0x100ef6,_0x2e741a){if(_0x51d175[_0xdf7d('0x46')]['id']){delete _0x51d175[_0xdf7d('0x46')]['id'];}return db[_0xdf7d('0x2a')][_0xdf7d('0x4a')]({'where':{'id':_0x51d175[_0xdf7d('0x42')]['id']}})[_0xdf7d('0x26')](handleEntityNotFound(_0x100ef6,null))[_0xdf7d('0x26')](function(_0xfca82d){if(_0xfca82d){_0x51d175[_0xdf7d('0x46')][_0xdf7d('0x4b')]=_0xfca82d['id'];_0x51d175[_0xdf7d('0x46')][_0xdf7d('0x4c')]=integrations['getSubjects'](_0x51d175[_0xdf7d('0x46')][_0xdf7d('0x4d')],_0x51d175[_0xdf7d('0x46')][_0xdf7d('0x2d')]);_0x51d175[_0xdf7d('0x46')]['Descriptions']=integrations['getDescriptions'](_0x51d175[_0xdf7d('0x46')][_0xdf7d('0x4d')],_0x51d175[_0xdf7d('0x46')][_0xdf7d('0x2d')]);return db[_0xdf7d('0x4e')][_0xdf7d('0x45')](_0x51d175['body'],{'include':[{'model':db[_0xdf7d('0x4f')],'as':'Subjects'},{'model':db[_0xdf7d('0x4f')],'as':_0xdf7d('0x50')}]});}return null;})[_0xdf7d('0x26')](respondWithResult(_0x100ef6,null))['catch'](handleError(_0x100ef6,null));};var md5=require(_0xdf7d('0x51'));exports[_0xdf7d('0x52')]=function(_0x499bd8,_0x5d3ebb,_0x1ac00f){var _0x1983f0=null;var _0x39bf78=null;var _0x4a1dfe=null;var _0x22de08=null;var _0x2ad207='';return db[_0xdf7d('0x2a')][_0xdf7d('0x4a')]({'where':{'id':_0x499bd8[_0xdf7d('0x42')]['id']},'attributes':['id',_0xdf7d('0x28'),_0xdf7d('0x53'),_0xdf7d('0x54'),'moduleName',_0xdf7d('0x55'),_0xdf7d('0x56'),_0xdf7d('0x57')]})['then'](handleEntityNotFound(_0x5d3ebb,null))['then'](function(_0x2b9586){if(_0x2b9586){_0x1983f0=_0x2b9586[_0xdf7d('0x53')];_0x39bf78=_0x2b9586[_0xdf7d('0x57')];_0x4a1dfe=_0x2b9586[_0xdf7d('0x58')];_0x2ad207=_0x2b9586[_0xdf7d('0x55')];var _0x569ab1=_0x2ad207[_0xdf7d('0x59')](-0x1);if(_0x569ab1==='/'){_0x2ad207=_0x2ad207[_0xdf7d('0x5a')](0x0,_0x2ad207['lastIndexOf'](_0x569ab1));}_0x22de08=util['format'](_0xdf7d('0x5b'),_0x2ad207);var _0x488cf2={'method':_0xdf7d('0x5c'),'uri':_0x22de08,'qs':{'operation':_0xdf7d('0x5d'),'username':_0x2b9586['username']},'json':!![]};return rp(_0x488cf2);}})[_0xdf7d('0x26')](function(_0x23e49a){if(_0x23e49a['success']){var _0x50e0c2={'method':_0xdf7d('0x5e'),'uri':_0x22de08,'form':{'operation':_0xdf7d('0x5f'),'username':_0x1983f0,'accessKey':md5(_0x23e49a['result'][_0xdf7d('0x60')]+_0x39bf78)},'json':!![]};return rp(_0x50e0c2);}})[_0xdf7d('0x26')](function(_0x16f842){if(_0x16f842[_0xdf7d('0x61')]){var _0x2e95c9={'method':'GET','uri':_0x22de08,'qs':{'operation':'describe','username':_0x1983f0,'sessionName':_0x16f842[_0xdf7d('0x62')][_0xdf7d('0x63')],'elementType':_0x4a1dfe},'json':!![]};return rp(_0x2e95c9);}})[_0xdf7d('0x26')](function(_0x42374a){if(_0x42374a[_0xdf7d('0x61')]){var _0x3e65ac=['autogenerated',_0xdf7d('0x64'),'owner'];_[_0xdf7d('0x65')](_0x42374a[_0xdf7d('0x62')][_0xdf7d('0x33')],function(_0x5cc088){return _0x3e65ac[_0xdf7d('0x66')](_0x5cc088['type'][_0xdf7d('0x28')]);});_[_0xdf7d('0x65')](_0x42374a[_0xdf7d('0x62')][_0xdf7d('0x33')],function(_0xc94053){return _0xc94053['editable']===_0xdf7d('0x67');});return{'count':_0x42374a[_0xdf7d('0x62')][_0xdf7d('0x33')]['length'],'rows':_[_0xdf7d('0x29')](_0x42374a[_0xdf7d('0x62')][_0xdf7d('0x33')],function(_0x1cccfb){return{'id':_0x1cccfb[_0xdf7d('0x28')],'name':_0x1cccfb[_0xdf7d('0x68')],'custom':_['startsWith'](_0x1cccfb[_0xdf7d('0x28')],_0xdf7d('0x69'))?!![]:![],'options':_0x1cccfb[_0xdf7d('0x2d')][_0xdf7d('0x28')]===_0xdf7d('0x6a')&&_0x1cccfb[_0xdf7d('0x2d')]['picklistValues'][_0xdf7d('0x35')]>0x0?_[_0xdf7d('0x29')](_0x1cccfb['type'][_0xdf7d('0x6b')],function(_0x2cdb3f){return{'name':_0x2cdb3f[_0xdf7d('0x68')],'value':_0x2cdb3f['value']};}):[]};})};}})[_0xdf7d('0x26')](respondWithResult(_0x5d3ebb,null))['catch'](function(_0x4661db){console[_0xdf7d('0x6c')](_0xdf7d('0x6d')+_0x4661db);var _0x5b93e1=_0x499bd8[_0xdf7d('0x32')]['test']?0x1f4:_0x4661db[_0xdf7d('0x6e')]||0x1f4;logger[_0xdf7d('0x27')](_0xdf7d('0x6f'),'getFields',_0x5b93e1,JSON[_0xdf7d('0x70')](_0x4661db));delete _0x4661db[_0xdf7d('0x28')];if(_0x5b93e1===0x191){_0x5b93e1=0x190;}_0x5d3ebb['status'](_0x5b93e1)[_0xdf7d('0x71')](_0x499bd8[_0xdf7d('0x32')][_0xdf7d('0x72')]?{'message':_0xdf7d('0x73'),'statusCode':_0x4661db['statusCode']}:_0x4661db);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 89f3248..21d3ed7 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 _0x8ac6=['int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define'];(function(_0x2a0d42,_0x585666){var _0x2884cb=function(_0x418fb9){while(--_0x418fb9){_0x2a0d42['push'](_0x2a0d42['shift']());}};_0x2884cb(++_0x585666);}(_0x8ac6,0x105));var _0x68ac=function(_0x4d8e32,_0x25e4df){_0x4d8e32=_0x4d8e32-0x0;var _0xcd57d=_0x8ac6[_0x4d8e32];return _0xcd57d;};'use strict';var _=require(_0x68ac('0x0'));var util=require(_0x68ac('0x1'));var logger=require(_0x68ac('0x2'))(_0x68ac('0x3'));var moment=require(_0x68ac('0x4'));var BPromise=require(_0x68ac('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x68ac('0x6'));var rimraf=require(_0x68ac('0x7'));var config=require(_0x68ac('0x8'));var attributes=require(_0x68ac('0x9'));var integrations=require(_0x68ac('0xa'));module['exports']=function(_0x16c9cc,_0x18cb7e){return _0x16c9cc[_0x68ac('0xb')]('VtigerAccount',attributes,{'tableName':_0x68ac('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcddb=['int_vtiger_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount'];(function(_0x366f98,_0x26a82d){var _0x5821ce=function(_0x2dee20){while(--_0x2dee20){_0x366f98['push'](_0x366f98['shift']());}};_0x5821ce(++_0x26a82d);}(_0xcddb,0x169));var _0xbcdd=function(_0x2d325f,_0x21f181){_0x2d325f=_0x2d325f-0x0;var _0x585182=_0xcddb[_0x2d325f];return _0x585182;};'use strict';var _=require('lodash');var util=require(_0xbcdd('0x0'));var logger=require(_0xbcdd('0x1'))(_0xbcdd('0x2'));var moment=require(_0xbcdd('0x3'));var BPromise=require(_0xbcdd('0x4'));var rp=require(_0xbcdd('0x5'));var fs=require('fs');var path=require(_0xbcdd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbcdd('0x7'));var integrations=require(_0xbcdd('0x8'));module[_0xbcdd('0x9')]=function(_0x18e75f,_0x5e328e){return _0x18e75f['define'](_0xbcdd('0xa'),attributes,{'tableName':_0xbcdd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 6d56ff1..0b0d528 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(_0x1f1366,_0x8232b9){var _0x155396=function(_0x56bfa3){while(--_0x56bfa3){_0x1f1366['push'](_0x1f1366['shift']());}};_0x155396(++_0x8232b9);}(_0x13f6,0x124));var _0x613f=function(_0x48db6f,_0x2c7f77){_0x48db6f=_0x48db6f-0x0;var _0x3ae269=_0x13f6[_0x48db6f];return _0x3ae269;};'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 _0xb9be=['VtigerAccount','findAll','options','limit','include','map','model','attributes','ShowVtigerAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','stringify','error','code','request\x20sent','result','message','catch','GetVtigerAccount'];(function(_0x4ff01f,_0x39748c){var _0x97b279=function(_0x5b2cc3){while(--_0x5b2cc3){_0x4ff01f['push'](_0x4ff01f['shift']());}};_0x97b279(++_0x39748c);}(_0xb9be,0xc5));var _0xeb9b=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0xb9be[_0x16e57d];return _0x40239c;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var moment=require(_0xeb9b('0x2'));var BPromise=require(_0xeb9b('0x3'));var rs=require(_0xeb9b('0x4'));var fs=require('fs');var Redis=require(_0xeb9b('0x5'));var db=require(_0xeb9b('0x6'))['db'];var utils=require(_0xeb9b('0x7'));var logger=require(_0xeb9b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeb9b('0x9'));var client=jayson[_0xeb9b('0xa')][_0xeb9b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49a8b9,_0x1ee7e0,_0x58ca1d){return new BPromise(function(_0x210eeb,_0x28dc5f){return client[_0xeb9b('0xc')](_0x49a8b9,_0x58ca1d)[_0xeb9b('0xd')](function(_0x418204){logger[_0xeb9b('0xe')](_0xeb9b('0xf'),_0x1ee7e0,'request\x20sent');logger[_0xeb9b('0x10')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1ee7e0,'request\x20sent',JSON[_0xeb9b('0x11')](_0x418204));if(_0x418204[_0xeb9b('0x12')]){if(_0x418204['error'][_0xeb9b('0x13')]===0x1f4){logger[_0xeb9b('0x12')](_0xeb9b('0xf'),_0x1ee7e0,_0x418204[_0xeb9b('0x12')]['message']);return _0x28dc5f(_0x418204['error']['message']);}logger[_0xeb9b('0x12')](_0xeb9b('0xf'),_0x1ee7e0,_0x418204[_0xeb9b('0x12')]['message']);return _0x210eeb(_0x418204['error']['message']);}else{logger[_0xeb9b('0xe')](_0xeb9b('0xf'),_0x1ee7e0,_0xeb9b('0x14'));_0x210eeb(_0x418204[_0xeb9b('0x15')][_0xeb9b('0x16')]);}})[_0xeb9b('0x17')](function(_0x239ccf){logger['error'](_0xeb9b('0xf'),_0x1ee7e0,_0x239ccf);_0x28dc5f(_0x239ccf);});});}exports[_0xeb9b('0x18')]=function(_0x21aca6){var _0x3a11e3=this;return new Promise(function(_0x3cbe3e,_0x1a140c){return db[_0xeb9b('0x19')][_0xeb9b('0x1a')]({'raw':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6[_0xeb9b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6['options']['where']||null:null,'attributes':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6[_0xeb9b('0x1b')]['attributes']||null:null,'limit':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6[_0xeb9b('0x1b')][_0xeb9b('0x1c')]||null:null,'include':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6[_0xeb9b('0x1b')][_0xeb9b('0x1d')]?_[_0xeb9b('0x1e')](_0x21aca6[_0xeb9b('0x1b')][_0xeb9b('0x1d')],function(_0x46df93){return{'model':db[_0x46df93[_0xeb9b('0x1f')]],'as':_0x46df93['as'],'attributes':_0x46df93[_0xeb9b('0x20')],'include':_0x46df93[_0xeb9b('0x1d')]?_[_0xeb9b('0x1e')](_0x46df93[_0xeb9b('0x1d')],function(_0x434461){return{'model':db[_0x434461['model']],'as':_0x434461['as'],'attributes':_0x434461[_0xeb9b('0x20')],'include':_0x434461['include']?_[_0xeb9b('0x1e')](_0x434461['include'],function(_0x347ec1){return{'model':db[_0x347ec1[_0xeb9b('0x1f')]],'as':_0x347ec1['as'],'attributes':_0x347ec1[_0xeb9b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xeb9b('0xd')](function(_0x52f6c1){logger[_0xeb9b('0xe')](_0xeb9b('0x18'),_0x21aca6);logger['debug'](_0xeb9b('0x18'),_0x21aca6,JSON[_0xeb9b('0x11')](_0x52f6c1));_0x3cbe3e(_0x52f6c1);})['catch'](function(_0x2a4b51){logger[_0xeb9b('0x12')](_0xeb9b('0x18'),_0x2a4b51['message'],_0x21aca6);_0x1a140c(_0x3a11e3[_0xeb9b('0x12')](0x1f4,_0x2a4b51['message']));});});};exports[_0xeb9b('0x21')]=function(_0x4c1331){var _0x411467=this;return new Promise(function(_0x54c659,_0x27578d){return db['VtigerAccount'][_0xeb9b('0x22')]({'raw':_0x4c1331['options']?_0x4c1331[_0xeb9b('0x1b')][_0xeb9b('0x23')]===undefined?!![]:![]:!![],'where':_0x4c1331[_0xeb9b('0x1b')]?_0x4c1331[_0xeb9b('0x1b')][_0xeb9b('0x24')]||null:null,'attributes':_0x4c1331[_0xeb9b('0x1b')]?_0x4c1331[_0xeb9b('0x1b')][_0xeb9b('0x20')]||null:null,'include':_0x4c1331[_0xeb9b('0x1b')]?_0x4c1331[_0xeb9b('0x1b')]['include']?_[_0xeb9b('0x1e')](_0x4c1331[_0xeb9b('0x1b')][_0xeb9b('0x1d')],function(_0x21ecfd){return{'model':db[_0x21ecfd[_0xeb9b('0x1f')]],'as':_0x21ecfd['as'],'attributes':_0x21ecfd[_0xeb9b('0x20')],'include':_0x21ecfd[_0xeb9b('0x1d')]?_['map'](_0x21ecfd[_0xeb9b('0x1d')],function(_0x2f3179){return{'model':db[_0x2f3179[_0xeb9b('0x1f')]],'as':_0x2f3179['as'],'attributes':_0x2f3179['attributes'],'include':_0x2f3179[_0xeb9b('0x1d')]?_[_0xeb9b('0x1e')](_0x2f3179[_0xeb9b('0x1d')],function(_0xab9ad5){return{'model':db[_0xab9ad5[_0xeb9b('0x1f')]],'as':_0xab9ad5['as'],'attributes':_0xab9ad5[_0xeb9b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24d235){logger[_0xeb9b('0xe')]('ShowVtigerAccount',_0x4c1331);logger[_0xeb9b('0x10')](_0xeb9b('0x21'),_0x4c1331,JSON[_0xeb9b('0x11')](_0x24d235));_0x54c659(_0x24d235);})[_0xeb9b('0x17')](function(_0x37c678){logger[_0xeb9b('0x12')](_0xeb9b('0x21'),_0x37c678['message'],_0x4c1331);_0x27578d(_0x411467[_0xeb9b('0x12')](0x1f4,_0x37c678[_0xeb9b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 89ea97a..118c01b 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 _0xae0f=['./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0xae0f,0xa7));var _0xfae0=function(_0x2379e8,_0x90be74){_0x2379e8=_0x2379e8-0x0;var _0x8a730e=_0xae0f[_0x2379e8];return _0x8a730e;};'use strict';var multer=require(_0xfae0('0x0'));var util=require(_0xfae0('0x1'));var path=require('path');var timeout=require(_0xfae0('0x2'));var express=require(_0xfae0('0x3'));var router=express[_0xfae0('0x4')]();var fs_extra=require(_0xfae0('0x5'));var auth=require(_0xfae0('0x6'));var interaction=require(_0xfae0('0x7'));var config=require('../../config/environment');var controller=require(_0xfae0('0x8'));router[_0xfae0('0x9')]('/',auth[_0xfae0('0xa')](),controller[_0xfae0('0xb')]);router[_0xfae0('0x9')](_0xfae0('0xc'),auth[_0xfae0('0xa')](),controller[_0xfae0('0xd')]);router[_0xfae0('0x9')]('/:id/fields',auth[_0xfae0('0xa')](),controller[_0xfae0('0xe')]);router[_0xfae0('0x9')](_0xfae0('0xf'),auth[_0xfae0('0xa')](),controller[_0xfae0('0x10')]);router[_0xfae0('0x9')](_0xfae0('0x11'),auth[_0xfae0('0xa')](),controller[_0xfae0('0x12')]);router[_0xfae0('0x13')]('/',auth[_0xfae0('0xa')](),controller[_0xfae0('0x14')]);router[_0xfae0('0x15')](_0xfae0('0xc'),auth[_0xfae0('0xa')](),controller[_0xfae0('0x16')]);router['delete']('/:id',auth[_0xfae0('0xa')](),controller[_0xfae0('0x17')]);module[_0xfae0('0x18')]=router; \ No newline at end of file +var _0xff39=['delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update'];(function(_0x3c08ea,_0x419b25){var _0x4b6e51=function(_0x4e53b3){while(--_0x4e53b3){_0x3c08ea['push'](_0x3c08ea['shift']());}};_0x4b6e51(++_0x419b25);}(_0xff39,0x1d0));var _0x9ff3=function(_0x23f8d2,_0x301fec){_0x23f8d2=_0x23f8d2-0x0;var _0x5d174b=_0xff39[_0x23f8d2];return _0x5d174b;};'use strict';var multer=require('multer');var util=require(_0x9ff3('0x0'));var path=require(_0x9ff3('0x1'));var timeout=require(_0x9ff3('0x2'));var express=require('express');var router=express[_0x9ff3('0x3')]();var fs_extra=require(_0x9ff3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9ff3('0x5'));var config=require(_0x9ff3('0x6'));var controller=require(_0x9ff3('0x7'));router[_0x9ff3('0x8')]('/',auth[_0x9ff3('0x9')](),controller['index']);router[_0x9ff3('0x8')]('/:id',auth[_0x9ff3('0x9')](),controller[_0x9ff3('0xa')]);router[_0x9ff3('0x8')]('/:id/fields',auth[_0x9ff3('0x9')](),controller['getFields']);router[_0x9ff3('0x8')](_0x9ff3('0xb'),auth[_0x9ff3('0x9')](),controller[_0x9ff3('0xc')]);router[_0x9ff3('0x8')](_0x9ff3('0xd'),auth[_0x9ff3('0x9')](),controller[_0x9ff3('0xe')]);router[_0x9ff3('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9ff3('0x10')](_0x9ff3('0x11'),auth['isAuthenticated'](),controller[_0x9ff3('0x12')]);router[_0x9ff3('0x13')](_0x9ff3('0x11'),auth[_0x9ff3('0x9')](),controller[_0x9ff3('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 1d2c196..a4963c0 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 _0x89f0=['STRING'];(function(_0x2aa850,_0x2c44ac){var _0x2efe7b=function(_0x1dd653){while(--_0x1dd653){_0x2aa850['push'](_0x2aa850['shift']());}};_0x2efe7b(++_0x2c44ac);}(_0x89f0,0x183));var _0x089f=function(_0x1c36a8,_0x58e354){_0x1c36a8=_0x1c36a8-0x0;var _0x16d020=_0x89f0[_0x1c36a8];return _0x16d020;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x089f('0x0')]}}; \ No newline at end of file +var _0x99d2=['STRING','sequelize','exports'];(function(_0x117dc9,_0x5bc9e9){var _0x38ee41=function(_0x3b558b){while(--_0x3b558b){_0x117dc9['push'](_0x117dc9['shift']());}};_0x38ee41(++_0x5bc9e9);}(_0x99d2,0x9d));var _0x299d=function(_0x3fd151,_0x5b9a0a){_0x3fd151=_0x3fd151-0x0;var _0x59a37b=_0x99d2[_0x3fd151];return _0x59a37b;};'use strict';var Sequelize=require(_0x299d('0x0'));module[_0x299d('0x1')]={'name':{'type':Sequelize[_0x299d('0x2')]},'description':{'type':Sequelize[_0x299d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 5042d49..62d7dca 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 _0x5b7c=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getFields','findOne','VtigerField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','name','send','index','map','VtigerConfiguration','rawAttributes','type'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0x5b7c,0x107));var _0xc5b7=function(_0x4cca02,_0x5bf4f7){_0x4cca02=_0x4cca02-0x0;var _0x43c8c6=_0x5b7c[_0x4cca02];return _0x43c8c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc5b7('0x0'));var zipdir=require(_0xc5b7('0x1'));var jsonpatch=require(_0xc5b7('0x2'));var rp=require(_0xc5b7('0x3'));var moment=require(_0xc5b7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc5b7('0x5'));var path=require(_0xc5b7('0x6'));var sox=require(_0xc5b7('0x7'));var csv=require(_0xc5b7('0x8'));var ejs=require(_0xc5b7('0x9'));var fs=require('fs');var fs_extra=require(_0xc5b7('0xa'));var _=require(_0xc5b7('0xb'));var squel=require(_0xc5b7('0xc'));var crypto=require(_0xc5b7('0xd'));var jsforce=require(_0xc5b7('0xe'));var deskjs=require(_0xc5b7('0xf'));var toCsv=require(_0xc5b7('0x8'));var querystring=require(_0xc5b7('0x10'));var Papa=require(_0xc5b7('0x11'));var Redis=require(_0xc5b7('0x12'));var authService=require(_0xc5b7('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5b7('0x14'));var logger=require('../../config/logger')(_0xc5b7('0x15'));var utils=require(_0xc5b7('0x16'));var config=require(_0xc5b7('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d7593,_0x41585d){_0x41585d=_0x41585d||0xcc;return function(_0x29836f){if(_0x29836f){return _0x4d7593[_0xc5b7('0x18')](_0x41585d);}return _0x4d7593[_0xc5b7('0x19')](_0x41585d)[_0xc5b7('0x1a')]();};}function respondWithResult(_0xe9886c,_0x399b99){_0x399b99=_0x399b99||0xc8;return function(_0x47a8e2){if(_0x47a8e2){return _0xe9886c[_0xc5b7('0x19')](_0x399b99)[_0xc5b7('0x1b')](_0x47a8e2);}};}function respondWithFilteredResult(_0x23cfd4,_0x17fe6b){return function(_0x5ade42){if(_0x5ade42){var _0x40bac3=typeof _0x17fe6b['offset']===_0xc5b7('0x1c')&&typeof _0x17fe6b[_0xc5b7('0x1d')]==='undefined';var _0x2b6baa=_0x5ade42[_0xc5b7('0x1e')];var _0x2a3969=_0x40bac3?0x0:_0x17fe6b['offset'];var _0x1d4305=_0x40bac3?_0x5ade42[_0xc5b7('0x1e')]:_0x17fe6b[_0xc5b7('0x1f')]+_0x17fe6b['limit'];var _0x319f71;if(_0x1d4305>=_0x2b6baa){_0x1d4305=_0x2b6baa;_0x319f71=0xc8;}else{_0x319f71=0xce;}_0x23cfd4[_0xc5b7('0x19')](_0x319f71);return _0x23cfd4[_0xc5b7('0x20')](_0xc5b7('0x21'),_0x2a3969+'-'+_0x1d4305+'/'+_0x2b6baa)['json'](_0x5ade42);}return null;};}function patchUpdates(_0x3a14fb){return function(_0x7d9516){try{jsonpatch['apply'](_0x7d9516,_0x3a14fb,!![]);}catch(_0x396a1b){return BPromise['reject'](_0x396a1b);}return _0x7d9516[_0xc5b7('0x22')]();};}function saveUpdates(_0x27ccd9,_0xd29819){return function(_0x37e177){if(_0x37e177){return _0x37e177[_0xc5b7('0x23')](_0x27ccd9)[_0xc5b7('0x24')](function(_0x1130da){return _0x1130da;});}return null;};}function removeEntity(_0x2de273,_0x23f2e6){return function(_0x120005){if(_0x120005){return _0x120005[_0xc5b7('0x25')]()[_0xc5b7('0x24')](function(){_0x2de273[_0xc5b7('0x19')](0xcc)[_0xc5b7('0x1a')]();});}};}function handleEntityNotFound(_0x319887,_0x2b601b){return function(_0x51a0d1){if(!_0x51a0d1){_0x319887[_0xc5b7('0x18')](0x194);}return _0x51a0d1;};}function handleError(_0x931f0f,_0x4d2340){_0x4d2340=_0x4d2340||0x1f4;return function(_0x2712ac){logger['error'](_0x2712ac['stack']);if(_0x2712ac[_0xc5b7('0x26')]){delete _0x2712ac[_0xc5b7('0x26')];}_0x931f0f[_0xc5b7('0x19')](_0x4d2340)[_0xc5b7('0x27')](_0x2712ac);};}exports[_0xc5b7('0x28')]=function(_0x56fca5,_0x15e531){var _0x31033a={},_0x1a4ca0={},_0xb1face={'count':0x0,'rows':[]};var _0x999c31=_[_0xc5b7('0x29')](db[_0xc5b7('0x2a')][_0xc5b7('0x2b')],function(_0x54c3df){return{'name':_0x54c3df['fieldName'],'type':_0x54c3df[_0xc5b7('0x2c')]['key']};});_0x1a4ca0[_0xc5b7('0x2d')]=_['map'](_0x999c31,_0xc5b7('0x26'));_0x1a4ca0[_0xc5b7('0x2e')]=_[_0xc5b7('0x2f')](_0x56fca5[_0xc5b7('0x2e')]);_0x1a4ca0[_0xc5b7('0x30')]=_[_0xc5b7('0x31')](_0x1a4ca0['model'],_0x1a4ca0[_0xc5b7('0x2e')]);_0x31033a['attributes']=_[_0xc5b7('0x31')](_0x1a4ca0['model'],qs['fields'](_0x56fca5[_0xc5b7('0x2e')][_0xc5b7('0x32')]));_0x31033a[_0xc5b7('0x33')]=_0x31033a[_0xc5b7('0x33')][_0xc5b7('0x34')]?_0x31033a[_0xc5b7('0x33')]:_0x1a4ca0['model'];if(!_0x56fca5[_0xc5b7('0x2e')][_0xc5b7('0x35')](_0xc5b7('0x36'))){_0x31033a[_0xc5b7('0x1d')]=qs[_0xc5b7('0x1d')](_0x56fca5[_0xc5b7('0x2e')][_0xc5b7('0x1d')]);_0x31033a[_0xc5b7('0x1f')]=qs[_0xc5b7('0x1f')](_0x56fca5[_0xc5b7('0x2e')][_0xc5b7('0x1f')]);}_0x31033a[_0xc5b7('0x37')]=qs['sort'](_0x56fca5[_0xc5b7('0x2e')][_0xc5b7('0x38')]);_0x31033a[_0xc5b7('0x39')]=qs['filters'](_[_0xc5b7('0x3a')](_0x56fca5[_0xc5b7('0x2e')],_0x1a4ca0[_0xc5b7('0x30')]),_0x999c31);if(_0x56fca5[_0xc5b7('0x2e')][_0xc5b7('0x3b')]){_0x31033a[_0xc5b7('0x39')]=_[_0xc5b7('0x3c')](_0x31033a['where'],{'$or':_['map'](_0x999c31,function(_0x2134d3){if(_0x2134d3[_0xc5b7('0x2c')]!=='VIRTUAL'){var _0x2b3aa3={};_0x2b3aa3[_0x2134d3[_0xc5b7('0x26')]]={'$like':'%'+_0x56fca5['query'][_0xc5b7('0x3b')]+'%'};return _0x2b3aa3;}})});}_0x31033a=_[_0xc5b7('0x3c')]({},_0x31033a,_0x56fca5[_0xc5b7('0x3d')]);var _0x59f859={'where':_0x31033a[_0xc5b7('0x39')]};return db[_0xc5b7('0x2a')][_0xc5b7('0x1e')](_0x59f859)[_0xc5b7('0x24')](function(_0x5217a6){_0xb1face[_0xc5b7('0x1e')]=_0x5217a6;if(_0x56fca5[_0xc5b7('0x2e')][_0xc5b7('0x3e')]){_0x31033a['include']=[{'all':!![]}];}return db['VtigerConfiguration'][_0xc5b7('0x3f')](_0x31033a);})[_0xc5b7('0x24')](function(_0x5688fb){_0xb1face[_0xc5b7('0x40')]=_0x5688fb;return _0xb1face;})[_0xc5b7('0x24')](respondWithFilteredResult(_0x15e531,_0x31033a))[_0xc5b7('0x41')](handleError(_0x15e531,null));};exports[_0xc5b7('0x42')]=function(_0xc90023,_0x5ebb99){var _0x3daf4e={'raw':![],'where':{'id':_0xc90023[_0xc5b7('0x43')]['id']}},_0x2f43b0={};_0x2f43b0[_0xc5b7('0x2d')]=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0x2f43b0['query']=_[_0xc5b7('0x2f')](_0xc90023[_0xc5b7('0x2e')]);_0x2f43b0['filters']=_[_0xc5b7('0x31')](_0x2f43b0[_0xc5b7('0x2d')],_0x2f43b0[_0xc5b7('0x2e')]);_0x3daf4e[_0xc5b7('0x33')]=_['intersection'](_0x2f43b0['model'],qs[_0xc5b7('0x32')](_0xc90023[_0xc5b7('0x2e')]['fields']));_0x3daf4e[_0xc5b7('0x33')]=_0x3daf4e[_0xc5b7('0x33')]['length']?_0x3daf4e[_0xc5b7('0x33')]:_0x2f43b0[_0xc5b7('0x2d')];if(_0xc90023[_0xc5b7('0x2e')][_0xc5b7('0x3e')]){_0x3daf4e[_0xc5b7('0x44')]=[{'all':!![]}];}_0x3daf4e=_[_0xc5b7('0x3c')]({},_0x3daf4e,_0xc90023[_0xc5b7('0x3d')]);return db[_0xc5b7('0x2a')][_0xc5b7('0x45')](_0x3daf4e)['then'](handleEntityNotFound(_0x5ebb99,null))['then'](respondWithResult(_0x5ebb99,null))[_0xc5b7('0x41')](handleError(_0x5ebb99,null));};exports['create']=function(_0x530797,_0x569fb0){return db[_0xc5b7('0x2a')][_0xc5b7('0x46')](_0x530797[_0xc5b7('0x47')],{})['then'](respondWithResult(_0x569fb0,0xc9))['catch'](handleError(_0x569fb0,null));};exports[_0xc5b7('0x23')]=function(_0x40e088,_0x15dd90){if(_0x40e088[_0xc5b7('0x47')]['id']){delete _0x40e088[_0xc5b7('0x47')]['id'];}return db['VtigerConfiguration'][_0xc5b7('0x45')]({'where':{'id':_0x40e088[_0xc5b7('0x43')]['id']}})['then'](handleEntityNotFound(_0x15dd90,null))['then'](saveUpdates(_0x40e088['body'],null))[_0xc5b7('0x24')](respondWithResult(_0x15dd90,null))[_0xc5b7('0x41')](handleError(_0x15dd90,null));};exports['destroy']=function(_0x434ac6,_0x329751){return db['VtigerConfiguration'][_0xc5b7('0x45')]({'where':{'id':_0x434ac6[_0xc5b7('0x43')]['id']}})['then'](handleEntityNotFound(_0x329751,null))['then'](removeEntity(_0x329751,null))[_0xc5b7('0x41')](handleError(_0x329751,null));};exports[_0xc5b7('0x48')]=function(_0x46da49,_0xd09f7,_0x520d8b){var _0x56b7e4={};var _0x147c03={};var _0x5895d6;var _0xf7b2d9;return db[_0xc5b7('0x2a')][_0xc5b7('0x49')]({'where':{'id':_0x46da49['params']['id']}})['then'](handleEntityNotFound(_0xd09f7,null))['then'](function(_0x17fb35){if(_0x17fb35){_0x5895d6=_0x17fb35;_0x147c03[_0xc5b7('0x2d')]=_[_0xc5b7('0x2f')](db[_0xc5b7('0x4a')]['rawAttributes']);_0x147c03[_0xc5b7('0x2e')]=_[_0xc5b7('0x2f')](_0x46da49[_0xc5b7('0x2e')]);_0x147c03[_0xc5b7('0x30')]=_['intersection'](_0x147c03[_0xc5b7('0x2d')],_0x147c03[_0xc5b7('0x2e')]);_0x56b7e4[_0xc5b7('0x33')]=_[_0xc5b7('0x31')](_0x147c03['model'],qs[_0xc5b7('0x32')](_0x46da49[_0xc5b7('0x2e')][_0xc5b7('0x32')]));_0x56b7e4[_0xc5b7('0x33')]=_0x56b7e4['attributes']['length']?_0x56b7e4['attributes']:_0x147c03[_0xc5b7('0x2d')];_0x56b7e4[_0xc5b7('0x37')]=qs['sort'](_0x46da49[_0xc5b7('0x2e')][_0xc5b7('0x38')]);_0x56b7e4[_0xc5b7('0x39')]=qs['filters'](_[_0xc5b7('0x3a')](_0x46da49[_0xc5b7('0x2e')],_0x147c03['filters']));if(_0x46da49['query'][_0xc5b7('0x3b')]){_0x56b7e4[_0xc5b7('0x39')]=_[_0xc5b7('0x3c')](_0x56b7e4['where'],{'$or':_[_0xc5b7('0x29')](_0x56b7e4[_0xc5b7('0x33')],function(_0x5a0744){var _0x25f96e={};_0x25f96e[_0x5a0744]={'$like':'%'+_0x46da49[_0xc5b7('0x2e')]['filter']+'%'};return _0x25f96e;})});}_0x56b7e4=_[_0xc5b7('0x3c')]({},_0x56b7e4,_0x46da49[_0xc5b7('0x3d')]);return _0x5895d6['getFields'](_0x56b7e4);}})[_0xc5b7('0x24')](function(_0x552543){if(_0x552543){_0xf7b2d9=_0x552543['length'];if(!_0x46da49[_0xc5b7('0x2e')][_0xc5b7('0x35')](_0xc5b7('0x36'))){_0x56b7e4['limit']=qs[_0xc5b7('0x1d')](_0x46da49[_0xc5b7('0x2e')][_0xc5b7('0x1d')]);_0x56b7e4[_0xc5b7('0x1f')]=qs['offset'](_0x46da49['query']['offset']);}return _0x5895d6[_0xc5b7('0x48')](_0x56b7e4);}})[_0xc5b7('0x24')](function(_0x2d068e){if(_0x2d068e){return _0x2d068e?{'count':_0xf7b2d9,'rows':_0x2d068e}:null;}})[_0xc5b7('0x24')](respondWithResult(_0xd09f7,null))[_0xc5b7('0x41')](handleError(_0xd09f7,null));};exports[_0xc5b7('0x4b')]=function(_0x5b0cc8,_0x2ba37e,_0x2ec764){var _0x6036fc={};var _0x109393={};var _0x403d6c;var _0xdc678a;return db[_0xc5b7('0x2a')]['findOne']({'where':{'id':_0x5b0cc8['params']['id']}})[_0xc5b7('0x24')](handleEntityNotFound(_0x2ba37e,null))[_0xc5b7('0x24')](function(_0x37ec51){if(_0x37ec51){_0x403d6c=_0x37ec51;_0x109393['model']=_[_0xc5b7('0x2f')](db[_0xc5b7('0x4a')][_0xc5b7('0x2b')]);_0x109393['query']=_['keys'](_0x5b0cc8['query']);_0x109393['filters']=_[_0xc5b7('0x31')](_0x109393[_0xc5b7('0x2d')],_0x109393[_0xc5b7('0x2e')]);_0x6036fc['attributes']=_['intersection'](_0x109393[_0xc5b7('0x2d')],qs['fields'](_0x5b0cc8['query'][_0xc5b7('0x32')]));_0x6036fc[_0xc5b7('0x33')]=_0x6036fc[_0xc5b7('0x33')][_0xc5b7('0x34')]?_0x6036fc['attributes']:_0x109393[_0xc5b7('0x2d')];_0x6036fc['order']=qs[_0xc5b7('0x38')](_0x5b0cc8[_0xc5b7('0x2e')][_0xc5b7('0x38')]);_0x6036fc[_0xc5b7('0x39')]=qs[_0xc5b7('0x30')](_[_0xc5b7('0x3a')](_0x5b0cc8[_0xc5b7('0x2e')],_0x109393[_0xc5b7('0x30')]));if(_0x5b0cc8['query']['filter']){_0x6036fc['where']=_[_0xc5b7('0x3c')](_0x6036fc[_0xc5b7('0x39')],{'$or':_[_0xc5b7('0x29')](_0x6036fc[_0xc5b7('0x33')],function(_0x28fd2e){var _0x478e32={};_0x478e32[_0x28fd2e]={'$like':'%'+_0x5b0cc8[_0xc5b7('0x2e')][_0xc5b7('0x3b')]+'%'};return _0x478e32;})});}_0x6036fc=_[_0xc5b7('0x3c')]({},_0x6036fc,_0x5b0cc8['options']);return _0x403d6c['getSubjects'](_0x6036fc);}})['then'](function(_0x271bb0){if(_0x271bb0){_0xdc678a=_0x271bb0[_0xc5b7('0x34')];if(!_0x5b0cc8[_0xc5b7('0x2e')]['hasOwnProperty']('nolimit')){_0x6036fc['limit']=qs[_0xc5b7('0x1d')](_0x5b0cc8[_0xc5b7('0x2e')][_0xc5b7('0x1d')]);_0x6036fc['offset']=qs['offset'](_0x5b0cc8[_0xc5b7('0x2e')][_0xc5b7('0x1f')]);}return _0x403d6c[_0xc5b7('0x4b')](_0x6036fc);}})[_0xc5b7('0x24')](function(_0x792703){if(_0x792703){return _0x792703?{'count':_0xdc678a,'rows':_0x792703}:null;}})[_0xc5b7('0x24')](respondWithResult(_0x2ba37e,null))[_0xc5b7('0x41')](handleError(_0x2ba37e,null));};exports[_0xc5b7('0x4c')]=function(_0x1e7d1b,_0x3e4e68,_0x13046a){var _0x58822b={};var _0x18641b={};var _0x32b302;var _0x366f9b;return db[_0xc5b7('0x2a')][_0xc5b7('0x49')]({'where':{'id':_0x1e7d1b['params']['id']}})[_0xc5b7('0x24')](handleEntityNotFound(_0x3e4e68,null))[_0xc5b7('0x24')](function(_0x9641c3){if(_0x9641c3){_0x32b302=_0x9641c3;_0x18641b['model']=_['keys'](db[_0xc5b7('0x4a')][_0xc5b7('0x2b')]);_0x18641b[_0xc5b7('0x2e')]=_['keys'](_0x1e7d1b[_0xc5b7('0x2e')]);_0x18641b[_0xc5b7('0x30')]=_[_0xc5b7('0x31')](_0x18641b[_0xc5b7('0x2d')],_0x18641b[_0xc5b7('0x2e')]);_0x58822b[_0xc5b7('0x33')]=_['intersection'](_0x18641b[_0xc5b7('0x2d')],qs[_0xc5b7('0x32')](_0x1e7d1b[_0xc5b7('0x2e')][_0xc5b7('0x32')]));_0x58822b[_0xc5b7('0x33')]=_0x58822b[_0xc5b7('0x33')][_0xc5b7('0x34')]?_0x58822b['attributes']:_0x18641b[_0xc5b7('0x2d')];_0x58822b[_0xc5b7('0x37')]=qs[_0xc5b7('0x38')](_0x1e7d1b[_0xc5b7('0x2e')][_0xc5b7('0x38')]);_0x58822b['where']=qs[_0xc5b7('0x30')](_[_0xc5b7('0x3a')](_0x1e7d1b[_0xc5b7('0x2e')],_0x18641b['filters']));if(_0x1e7d1b['query'][_0xc5b7('0x3b')]){_0x58822b['where']=_['merge'](_0x58822b[_0xc5b7('0x39')],{'$or':_[_0xc5b7('0x29')](_0x58822b[_0xc5b7('0x33')],function(_0x2a6a6b){var _0x43b57d={};_0x43b57d[_0x2a6a6b]={'$like':'%'+_0x1e7d1b[_0xc5b7('0x2e')][_0xc5b7('0x3b')]+'%'};return _0x43b57d;})});}_0x58822b=_['merge']({},_0x58822b,_0x1e7d1b[_0xc5b7('0x3d')]);return _0x32b302[_0xc5b7('0x4c')](_0x58822b);}})['then'](function(_0x32bc34){if(_0x32bc34){_0x366f9b=_0x32bc34[_0xc5b7('0x34')];if(!_0x1e7d1b[_0xc5b7('0x2e')][_0xc5b7('0x35')]('nolimit')){_0x58822b[_0xc5b7('0x1d')]=qs['limit'](_0x1e7d1b['query'][_0xc5b7('0x1d')]);_0x58822b[_0xc5b7('0x1f')]=qs['offset'](_0x1e7d1b[_0xc5b7('0x2e')]['offset']);}return _0x32b302[_0xc5b7('0x4c')](_0x58822b);}})[_0xc5b7('0x24')](function(_0xa862f4){if(_0xa862f4){return _0xa862f4?{'count':_0x366f9b,'rows':_0xa862f4}:null;}})[_0xc5b7('0x24')](respondWithResult(_0x3e4e68,null))[_0xc5b7('0x41')](handleError(_0x3e4e68,null));}; \ No newline at end of file +var _0x5f22=['VtigerField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','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','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','end','error','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','find','create','body','update','params','getFields','findOne'];(function(_0xeee1f8,_0x15a622){var _0x53f1d9=function(_0x5a4eaf){while(--_0x5a4eaf){_0xeee1f8['push'](_0xeee1f8['shift']());}};_0x53f1d9(++_0x15a622);}(_0x5f22,0x144));var _0x25f2=function(_0x2d36a6,_0x2f8cd0){_0x2d36a6=_0x2d36a6-0x0;var _0x59cec0=_0x5f22[_0x2d36a6];return _0x59cec0;};'use strict';var emlformat=require(_0x25f2('0x0'));var rimraf=require(_0x25f2('0x1'));var zipdir=require(_0x25f2('0x2'));var jsonpatch=require(_0x25f2('0x3'));var rp=require(_0x25f2('0x4'));var moment=require('moment');var BPromise=require(_0x25f2('0x5'));var Mustache=require(_0x25f2('0x6'));var util=require('util');var path=require('path');var sox=require(_0x25f2('0x7'));var csv=require('to-csv');var ejs=require(_0x25f2('0x8'));var fs=require('fs');var fs_extra=require(_0x25f2('0x9'));var _=require('lodash');var squel=require(_0x25f2('0xa'));var crypto=require(_0x25f2('0xb'));var jsforce=require(_0x25f2('0xc'));var deskjs=require(_0x25f2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x25f2('0xe'));var Papa=require(_0x25f2('0xf'));var Redis=require(_0x25f2('0x10'));var authService=require(_0x25f2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x25f2('0x12'));var hardwareService=require(_0x25f2('0x13'));var logger=require(_0x25f2('0x14'))('api');var utils=require(_0x25f2('0x15'));var config=require(_0x25f2('0x16'));var licenseUtil=require(_0x25f2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55c739,_0x3c367d){_0x3c367d=_0x3c367d||0xcc;return function(_0x5d4ec1){if(_0x5d4ec1){return _0x55c739[_0x25f2('0x18')](_0x3c367d);}return _0x55c739[_0x25f2('0x19')](_0x3c367d)['end']();};}function respondWithResult(_0x206c5f,_0x1ae15c){_0x1ae15c=_0x1ae15c||0xc8;return function(_0x3e0288){if(_0x3e0288){return _0x206c5f[_0x25f2('0x19')](_0x1ae15c)[_0x25f2('0x1a')](_0x3e0288);}};}function respondWithFilteredResult(_0x115429,_0x1fea17){return function(_0x9329a6){if(_0x9329a6){var _0x822fa8=typeof _0x1fea17[_0x25f2('0x1b')]===_0x25f2('0x1c')&&typeof _0x1fea17['limit']===_0x25f2('0x1c');var _0x4fd6bb=_0x9329a6[_0x25f2('0x1d')];var _0x2c4ae9=_0x822fa8?0x0:_0x1fea17[_0x25f2('0x1b')];var _0x35e6a2=_0x822fa8?_0x9329a6['count']:_0x1fea17[_0x25f2('0x1b')]+_0x1fea17[_0x25f2('0x1e')];var _0x1480fa;if(_0x35e6a2>=_0x4fd6bb){_0x35e6a2=_0x4fd6bb;_0x1480fa=0xc8;}else{_0x1480fa=0xce;}_0x115429[_0x25f2('0x19')](_0x1480fa);return _0x115429[_0x25f2('0x1f')](_0x25f2('0x20'),_0x2c4ae9+'-'+_0x35e6a2+'/'+_0x4fd6bb)[_0x25f2('0x1a')](_0x9329a6);}return null;};}function patchUpdates(_0x4bda34){return function(_0x2cc396){try{jsonpatch[_0x25f2('0x21')](_0x2cc396,_0x4bda34,!![]);}catch(_0x2ccc19){return BPromise['reject'](_0x2ccc19);}return _0x2cc396[_0x25f2('0x22')]();};}function saveUpdates(_0x2c4bf0,_0x1ae133){return function(_0x36ff3c){if(_0x36ff3c){return _0x36ff3c['update'](_0x2c4bf0)[_0x25f2('0x23')](function(_0x2e4a4e){return _0x2e4a4e;});}return null;};}function removeEntity(_0x1dfded,_0x28712a){return function(_0x3583aa){if(_0x3583aa){return _0x3583aa[_0x25f2('0x24')]()['then'](function(){_0x1dfded[_0x25f2('0x19')](0xcc)[_0x25f2('0x25')]();});}};}function handleEntityNotFound(_0x7bec3e,_0x503041){return function(_0x57e6c4){if(!_0x57e6c4){_0x7bec3e[_0x25f2('0x18')](0x194);}return _0x57e6c4;};}function handleError(_0x376cab,_0x4d7207){_0x4d7207=_0x4d7207||0x1f4;return function(_0x43752c){logger[_0x25f2('0x26')](_0x43752c['stack']);if(_0x43752c['name']){delete _0x43752c[_0x25f2('0x27')];}_0x376cab[_0x25f2('0x19')](_0x4d7207)[_0x25f2('0x28')](_0x43752c);};}exports[_0x25f2('0x29')]=function(_0x1886a8,_0x180cfa){var _0x47fe33={},_0x344b56={},_0x2f5e29={'count':0x0,'rows':[]};var _0x5c28a4=_[_0x25f2('0x2a')](db[_0x25f2('0x2b')][_0x25f2('0x2c')],function(_0x4bf545){return{'name':_0x4bf545[_0x25f2('0x2d')],'type':_0x4bf545[_0x25f2('0x2e')][_0x25f2('0x2f')]};});_0x344b56[_0x25f2('0x30')]=_[_0x25f2('0x2a')](_0x5c28a4,_0x25f2('0x27'));_0x344b56['query']=_[_0x25f2('0x31')](_0x1886a8[_0x25f2('0x32')]);_0x344b56[_0x25f2('0x33')]=_['intersection'](_0x344b56[_0x25f2('0x30')],_0x344b56[_0x25f2('0x32')]);_0x47fe33[_0x25f2('0x34')]=_[_0x25f2('0x35')](_0x344b56[_0x25f2('0x30')],qs[_0x25f2('0x36')](_0x1886a8[_0x25f2('0x32')][_0x25f2('0x36')]));_0x47fe33[_0x25f2('0x34')]=_0x47fe33[_0x25f2('0x34')][_0x25f2('0x37')]?_0x47fe33['attributes']:_0x344b56['model'];if(!_0x1886a8['query']['hasOwnProperty'](_0x25f2('0x38'))){_0x47fe33[_0x25f2('0x1e')]=qs[_0x25f2('0x1e')](_0x1886a8['query'][_0x25f2('0x1e')]);_0x47fe33['offset']=qs['offset'](_0x1886a8[_0x25f2('0x32')]['offset']);}_0x47fe33[_0x25f2('0x39')]=qs[_0x25f2('0x3a')](_0x1886a8[_0x25f2('0x32')]['sort']);_0x47fe33[_0x25f2('0x3b')]=qs[_0x25f2('0x33')](_[_0x25f2('0x3c')](_0x1886a8[_0x25f2('0x32')],_0x344b56[_0x25f2('0x33')]),_0x5c28a4);if(_0x1886a8[_0x25f2('0x32')][_0x25f2('0x3d')]){_0x47fe33[_0x25f2('0x3b')]=_[_0x25f2('0x3e')](_0x47fe33[_0x25f2('0x3b')],{'$or':_['map'](_0x5c28a4,function(_0x436661){if(_0x436661[_0x25f2('0x2e')]!==_0x25f2('0x3f')){var _0x3c2be1={};_0x3c2be1[_0x436661['name']]={'$like':'%'+_0x1886a8[_0x25f2('0x32')][_0x25f2('0x3d')]+'%'};return _0x3c2be1;}})});}_0x47fe33=_[_0x25f2('0x3e')]({},_0x47fe33,_0x1886a8[_0x25f2('0x40')]);var _0x95cd3a={'where':_0x47fe33[_0x25f2('0x3b')]};return db[_0x25f2('0x2b')][_0x25f2('0x1d')](_0x95cd3a)['then'](function(_0x1b15ab){_0x2f5e29[_0x25f2('0x1d')]=_0x1b15ab;if(_0x1886a8[_0x25f2('0x32')][_0x25f2('0x41')]){_0x47fe33[_0x25f2('0x42')]=[{'all':!![]}];}return db[_0x25f2('0x2b')][_0x25f2('0x43')](_0x47fe33);})[_0x25f2('0x23')](function(_0x5ddc1f){_0x2f5e29['rows']=_0x5ddc1f;return _0x2f5e29;})[_0x25f2('0x23')](respondWithFilteredResult(_0x180cfa,_0x47fe33))[_0x25f2('0x44')](handleError(_0x180cfa,null));};exports['show']=function(_0x477d8e,_0x4d60cb){var _0x2ef4a0={'raw':![],'where':{'id':_0x477d8e['params']['id']}},_0x5e0d87={};_0x5e0d87['model']=_[_0x25f2('0x31')](db[_0x25f2('0x2b')][_0x25f2('0x2c')]);_0x5e0d87['query']=_[_0x25f2('0x31')](_0x477d8e[_0x25f2('0x32')]);_0x5e0d87[_0x25f2('0x33')]=_[_0x25f2('0x35')](_0x5e0d87['model'],_0x5e0d87[_0x25f2('0x32')]);_0x2ef4a0[_0x25f2('0x34')]=_[_0x25f2('0x35')](_0x5e0d87[_0x25f2('0x30')],qs[_0x25f2('0x36')](_0x477d8e['query'][_0x25f2('0x36')]));_0x2ef4a0[_0x25f2('0x34')]=_0x2ef4a0[_0x25f2('0x34')][_0x25f2('0x37')]?_0x2ef4a0[_0x25f2('0x34')]:_0x5e0d87['model'];if(_0x477d8e[_0x25f2('0x32')][_0x25f2('0x41')]){_0x2ef4a0[_0x25f2('0x42')]=[{'all':!![]}];}_0x2ef4a0=_[_0x25f2('0x3e')]({},_0x2ef4a0,_0x477d8e[_0x25f2('0x40')]);return db['VtigerConfiguration'][_0x25f2('0x45')](_0x2ef4a0)[_0x25f2('0x23')](handleEntityNotFound(_0x4d60cb,null))[_0x25f2('0x23')](respondWithResult(_0x4d60cb,null))[_0x25f2('0x44')](handleError(_0x4d60cb,null));};exports[_0x25f2('0x46')]=function(_0x1966af,_0x51d0d8){return db[_0x25f2('0x2b')][_0x25f2('0x46')](_0x1966af[_0x25f2('0x47')],{})[_0x25f2('0x23')](respondWithResult(_0x51d0d8,0xc9))[_0x25f2('0x44')](handleError(_0x51d0d8,null));};exports[_0x25f2('0x48')]=function(_0x5b282b,_0x44fff9){if(_0x5b282b[_0x25f2('0x47')]['id']){delete _0x5b282b[_0x25f2('0x47')]['id'];}return db[_0x25f2('0x2b')][_0x25f2('0x45')]({'where':{'id':_0x5b282b[_0x25f2('0x49')]['id']}})[_0x25f2('0x23')](handleEntityNotFound(_0x44fff9,null))[_0x25f2('0x23')](saveUpdates(_0x5b282b[_0x25f2('0x47')],null))[_0x25f2('0x23')](respondWithResult(_0x44fff9,null))[_0x25f2('0x44')](handleError(_0x44fff9,null));};exports[_0x25f2('0x24')]=function(_0x2f500a,_0x40db4a){return db['VtigerConfiguration']['find']({'where':{'id':_0x2f500a[_0x25f2('0x49')]['id']}})[_0x25f2('0x23')](handleEntityNotFound(_0x40db4a,null))[_0x25f2('0x23')](removeEntity(_0x40db4a,null))[_0x25f2('0x44')](handleError(_0x40db4a,null));};exports[_0x25f2('0x4a')]=function(_0x435ee8,_0x1b2fe1,_0x3c68eb){var _0x1294de={};var _0x591455={};var _0xe973b4;var _0xfd14b;return db[_0x25f2('0x2b')][_0x25f2('0x4b')]({'where':{'id':_0x435ee8[_0x25f2('0x49')]['id']}})[_0x25f2('0x23')](handleEntityNotFound(_0x1b2fe1,null))[_0x25f2('0x23')](function(_0x19ba54){if(_0x19ba54){_0xe973b4=_0x19ba54;_0x591455[_0x25f2('0x30')]=_[_0x25f2('0x31')](db[_0x25f2('0x4c')][_0x25f2('0x2c')]);_0x591455['query']=_['keys'](_0x435ee8[_0x25f2('0x32')]);_0x591455[_0x25f2('0x33')]=_[_0x25f2('0x35')](_0x591455[_0x25f2('0x30')],_0x591455[_0x25f2('0x32')]);_0x1294de['attributes']=_[_0x25f2('0x35')](_0x591455[_0x25f2('0x30')],qs[_0x25f2('0x36')](_0x435ee8[_0x25f2('0x32')][_0x25f2('0x36')]));_0x1294de['attributes']=_0x1294de[_0x25f2('0x34')][_0x25f2('0x37')]?_0x1294de['attributes']:_0x591455[_0x25f2('0x30')];_0x1294de[_0x25f2('0x39')]=qs['sort'](_0x435ee8[_0x25f2('0x32')]['sort']);_0x1294de['where']=qs[_0x25f2('0x33')](_[_0x25f2('0x3c')](_0x435ee8[_0x25f2('0x32')],_0x591455[_0x25f2('0x33')]));if(_0x435ee8['query'][_0x25f2('0x3d')]){_0x1294de[_0x25f2('0x3b')]=_[_0x25f2('0x3e')](_0x1294de['where'],{'$or':_['map'](_0x1294de[_0x25f2('0x34')],function(_0x3771a6){var _0x46adfc={};_0x46adfc[_0x3771a6]={'$like':'%'+_0x435ee8[_0x25f2('0x32')][_0x25f2('0x3d')]+'%'};return _0x46adfc;})});}_0x1294de=_['merge']({},_0x1294de,_0x435ee8[_0x25f2('0x40')]);return _0xe973b4[_0x25f2('0x4a')](_0x1294de);}})[_0x25f2('0x23')](function(_0x2dcee1){if(_0x2dcee1){_0xfd14b=_0x2dcee1[_0x25f2('0x37')];if(!_0x435ee8[_0x25f2('0x32')][_0x25f2('0x4d')]('nolimit')){_0x1294de[_0x25f2('0x1e')]=qs[_0x25f2('0x1e')](_0x435ee8[_0x25f2('0x32')][_0x25f2('0x1e')]);_0x1294de[_0x25f2('0x1b')]=qs[_0x25f2('0x1b')](_0x435ee8[_0x25f2('0x32')][_0x25f2('0x1b')]);}return _0xe973b4[_0x25f2('0x4a')](_0x1294de);}})[_0x25f2('0x23')](function(_0x3d4bfe){if(_0x3d4bfe){return _0x3d4bfe?{'count':_0xfd14b,'rows':_0x3d4bfe}:null;}})[_0x25f2('0x23')](respondWithResult(_0x1b2fe1,null))['catch'](handleError(_0x1b2fe1,null));};exports[_0x25f2('0x4e')]=function(_0x1063b3,_0x5ec124,_0x2ae67b){var _0x19f634={};var _0x5e800d={};var _0x2e6f76;var _0x111fe7;return db[_0x25f2('0x2b')][_0x25f2('0x4b')]({'where':{'id':_0x1063b3[_0x25f2('0x49')]['id']}})['then'](handleEntityNotFound(_0x5ec124,null))[_0x25f2('0x23')](function(_0x76a263){if(_0x76a263){_0x2e6f76=_0x76a263;_0x5e800d[_0x25f2('0x30')]=_[_0x25f2('0x31')](db[_0x25f2('0x4c')][_0x25f2('0x2c')]);_0x5e800d['query']=_[_0x25f2('0x31')](_0x1063b3[_0x25f2('0x32')]);_0x5e800d[_0x25f2('0x33')]=_[_0x25f2('0x35')](_0x5e800d[_0x25f2('0x30')],_0x5e800d['query']);_0x19f634[_0x25f2('0x34')]=_['intersection'](_0x5e800d[_0x25f2('0x30')],qs[_0x25f2('0x36')](_0x1063b3[_0x25f2('0x32')]['fields']));_0x19f634[_0x25f2('0x34')]=_0x19f634[_0x25f2('0x34')][_0x25f2('0x37')]?_0x19f634[_0x25f2('0x34')]:_0x5e800d[_0x25f2('0x30')];_0x19f634[_0x25f2('0x39')]=qs[_0x25f2('0x3a')](_0x1063b3[_0x25f2('0x32')][_0x25f2('0x3a')]);_0x19f634[_0x25f2('0x3b')]=qs[_0x25f2('0x33')](_[_0x25f2('0x3c')](_0x1063b3['query'],_0x5e800d[_0x25f2('0x33')]));if(_0x1063b3[_0x25f2('0x32')]['filter']){_0x19f634['where']=_['merge'](_0x19f634[_0x25f2('0x3b')],{'$or':_[_0x25f2('0x2a')](_0x19f634['attributes'],function(_0x4a3276){var _0x3631cd={};_0x3631cd[_0x4a3276]={'$like':'%'+_0x1063b3['query'][_0x25f2('0x3d')]+'%'};return _0x3631cd;})});}_0x19f634=_['merge']({},_0x19f634,_0x1063b3['options']);return _0x2e6f76[_0x25f2('0x4e')](_0x19f634);}})[_0x25f2('0x23')](function(_0x481425){if(_0x481425){_0x111fe7=_0x481425[_0x25f2('0x37')];if(!_0x1063b3[_0x25f2('0x32')][_0x25f2('0x4d')](_0x25f2('0x38'))){_0x19f634[_0x25f2('0x1e')]=qs[_0x25f2('0x1e')](_0x1063b3['query'][_0x25f2('0x1e')]);_0x19f634[_0x25f2('0x1b')]=qs[_0x25f2('0x1b')](_0x1063b3[_0x25f2('0x32')][_0x25f2('0x1b')]);}return _0x2e6f76['getSubjects'](_0x19f634);}})['then'](function(_0x1f87cc){if(_0x1f87cc){return _0x1f87cc?{'count':_0x111fe7,'rows':_0x1f87cc}:null;}})[_0x25f2('0x23')](respondWithResult(_0x5ec124,null))[_0x25f2('0x44')](handleError(_0x5ec124,null));};exports[_0x25f2('0x4f')]=function(_0x121b1d,_0x8520d3,_0x5af10c){var _0x124640={};var _0x197b06={};var _0x1e7d91;var _0x412f8c;return db[_0x25f2('0x2b')][_0x25f2('0x4b')]({'where':{'id':_0x121b1d['params']['id']}})['then'](handleEntityNotFound(_0x8520d3,null))[_0x25f2('0x23')](function(_0x5edeb4){if(_0x5edeb4){_0x1e7d91=_0x5edeb4;_0x197b06['model']=_['keys'](db[_0x25f2('0x4c')][_0x25f2('0x2c')]);_0x197b06[_0x25f2('0x32')]=_[_0x25f2('0x31')](_0x121b1d[_0x25f2('0x32')]);_0x197b06[_0x25f2('0x33')]=_['intersection'](_0x197b06[_0x25f2('0x30')],_0x197b06[_0x25f2('0x32')]);_0x124640[_0x25f2('0x34')]=_['intersection'](_0x197b06[_0x25f2('0x30')],qs['fields'](_0x121b1d[_0x25f2('0x32')][_0x25f2('0x36')]));_0x124640[_0x25f2('0x34')]=_0x124640[_0x25f2('0x34')][_0x25f2('0x37')]?_0x124640[_0x25f2('0x34')]:_0x197b06[_0x25f2('0x30')];_0x124640[_0x25f2('0x39')]=qs[_0x25f2('0x3a')](_0x121b1d[_0x25f2('0x32')][_0x25f2('0x3a')]);_0x124640[_0x25f2('0x3b')]=qs[_0x25f2('0x33')](_['pick'](_0x121b1d['query'],_0x197b06[_0x25f2('0x33')]));if(_0x121b1d['query'][_0x25f2('0x3d')]){_0x124640['where']=_[_0x25f2('0x3e')](_0x124640[_0x25f2('0x3b')],{'$or':_[_0x25f2('0x2a')](_0x124640['attributes'],function(_0x3fcc0e){var _0x12bc60={};_0x12bc60[_0x3fcc0e]={'$like':'%'+_0x121b1d[_0x25f2('0x32')][_0x25f2('0x3d')]+'%'};return _0x12bc60;})});}_0x124640=_['merge']({},_0x124640,_0x121b1d[_0x25f2('0x40')]);return _0x1e7d91['getDescriptions'](_0x124640);}})['then'](function(_0xf4a27c){if(_0xf4a27c){_0x412f8c=_0xf4a27c[_0x25f2('0x37')];if(!_0x121b1d[_0x25f2('0x32')][_0x25f2('0x4d')](_0x25f2('0x38'))){_0x124640[_0x25f2('0x1e')]=qs[_0x25f2('0x1e')](_0x121b1d[_0x25f2('0x32')]['limit']);_0x124640['offset']=qs[_0x25f2('0x1b')](_0x121b1d[_0x25f2('0x32')][_0x25f2('0x1b')]);}return _0x1e7d91[_0x25f2('0x4f')](_0x124640);}})['then'](function(_0x242640){if(_0x242640){return _0x242640?{'count':_0x412f8c,'rows':_0x242640}:null;}})[_0x25f2('0x23')](respondWithResult(_0x8520d3,null))[_0x25f2('0x44')](handleError(_0x8520d3,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index f809f13..c446ed6 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 _0x3647=['exports','define','int_vtiger_configurations','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./intVtigerConfiguration.attributes'];(function(_0x22d832,_0x500c2f){var _0x2e69e1=function(_0x4f41d0){while(--_0x4f41d0){_0x22d832['push'](_0x22d832['shift']());}};_0x2e69e1(++_0x500c2f);}(_0x3647,0x12c));var _0x7364=function(_0x48e606,_0x45baf7){_0x48e606=_0x48e606-0x0;var _0x2e433b=_0x3647[_0x48e606];return _0x2e433b;};'use strict';var _=require(_0x7364('0x0'));var util=require('util');var logger=require(_0x7364('0x1'))(_0x7364('0x2'));var moment=require(_0x7364('0x3'));var BPromise=require('bluebird');var rp=require(_0x7364('0x4'));var fs=require('fs');var path=require(_0x7364('0x5'));var rimraf=require(_0x7364('0x6'));var config=require('../../config/environment');var attributes=require(_0x7364('0x7'));module[_0x7364('0x8')]=function(_0x1cb2cf,_0x578162){return _0x1cb2cf[_0x7364('0x9')]('VtigerConfiguration',attributes,{'tableName':_0x7364('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35fb=['bluebird','path','rimraf','../../config/environment','exports','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger'];(function(_0x51bf73,_0x4625ca){var _0x392b3e=function(_0x38965b){while(--_0x38965b){_0x51bf73['push'](_0x51bf73['shift']());}};_0x392b3e(++_0x4625ca);}(_0x35fb,0x1a5));var _0xb35f=function(_0x1aa3fe,_0x27c5fa){_0x1aa3fe=_0x1aa3fe-0x0;var _0x163cee=_0x35fb[_0x1aa3fe];return _0x163cee;};'use strict';var _=require(_0xb35f('0x0'));var util=require('util');var logger=require(_0xb35f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb35f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb35f('0x3'));var rimraf=require(_0xb35f('0x4'));var config=require(_0xb35f('0x5'));var attributes=require('./intVtigerConfiguration.attributes');module[_0xb35f('0x6')]=function(_0x131048,_0x3a4993){return _0x131048['define'](_0xb35f('0x7'),attributes,{'tableName':_0xb35f('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 ee6682f..8bb2f5f 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 _0xd0ca=['then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request'];(function(_0x260b66,_0x2ea36d){var _0x1effab=function(_0xb63e7){while(--_0xb63e7){_0x260b66['push'](_0x260b66['shift']());}};_0x1effab(++_0x2ea36d);}(_0xd0ca,0xb4));var _0xad0c=function(_0x34a1b2,_0x30488a){_0x34a1b2=_0x34a1b2-0x0;var _0x15e598=_0xd0ca[_0x34a1b2];return _0x15e598;};'use strict';var _=require('lodash');var util=require(_0xad0c('0x0'));var moment=require(_0xad0c('0x1'));var BPromise=require('bluebird');var rs=require(_0xad0c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad0c('0x3'))['db'];var utils=require(_0xad0c('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xad0c('0x5'));var jayson=require(_0xad0c('0x6'));var client=jayson[_0xad0c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b9eb5,_0x51aea8,_0x45f0f7){return new BPromise(function(_0xf3add1,_0x3e2081){return client[_0xad0c('0x8')](_0x3b9eb5,_0x45f0f7)[_0xad0c('0x9')](function(_0x548cb8){logger[_0xad0c('0xa')](_0xad0c('0xb'),_0x51aea8,'request\x20sent');logger[_0xad0c('0xc')](_0xad0c('0xd'),_0x51aea8,_0xad0c('0xe'),JSON[_0xad0c('0xf')](_0x548cb8));if(_0x548cb8[_0xad0c('0x10')]){if(_0x548cb8[_0xad0c('0x10')][_0xad0c('0x11')]===0x1f4){logger[_0xad0c('0x10')](_0xad0c('0xb'),_0x51aea8,_0x548cb8[_0xad0c('0x10')]['message']);return _0x3e2081(_0x548cb8[_0xad0c('0x10')][_0xad0c('0x12')]);}logger[_0xad0c('0x10')](_0xad0c('0xb'),_0x51aea8,_0x548cb8[_0xad0c('0x10')]['message']);return _0xf3add1(_0x548cb8[_0xad0c('0x10')]['message']);}else{logger[_0xad0c('0xa')](_0xad0c('0xb'),_0x51aea8,_0xad0c('0xe'));_0xf3add1(_0x548cb8[_0xad0c('0x13')][_0xad0c('0x12')]);}})[_0xad0c('0x14')](function(_0x22fd3b){logger['error'](_0xad0c('0xb'),_0x51aea8,_0x22fd3b);_0x3e2081(_0x22fd3b);});});} \ No newline at end of file +var _0xe7e4=['VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe7e4,0x94));var _0x4e7e=function(_0x174078,_0x14fe58){_0x174078=_0x174078-0x0;var _0x58af82=_0xe7e4[_0x174078];return _0x58af82;};'use strict';var _=require(_0x4e7e('0x0'));var util=require(_0x4e7e('0x1'));var moment=require(_0x4e7e('0x2'));var BPromise=require(_0x4e7e('0x3'));var rs=require(_0x4e7e('0x4'));var fs=require('fs');var Redis=require(_0x4e7e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e7e('0x6'));var logger=require(_0x4e7e('0x7'))(_0x4e7e('0x8'));var config=require(_0x4e7e('0x9'));var jayson=require(_0x4e7e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b7ecf,_0x31415e,_0x318a65){return new BPromise(function(_0x5033c1,_0x150208){return client[_0x4e7e('0xb')](_0x2b7ecf,_0x318a65)[_0x4e7e('0xc')](function(_0xa19857){logger['info'](_0x4e7e('0xd'),_0x31415e,_0x4e7e('0xe'));logger[_0x4e7e('0xf')](_0x4e7e('0x10'),_0x31415e,_0x4e7e('0xe'),JSON[_0x4e7e('0x11')](_0xa19857));if(_0xa19857['error']){if(_0xa19857[_0x4e7e('0x12')][_0x4e7e('0x13')]===0x1f4){logger[_0x4e7e('0x12')](_0x4e7e('0xd'),_0x31415e,_0xa19857[_0x4e7e('0x12')]['message']);return _0x150208(_0xa19857['error'][_0x4e7e('0x14')]);}logger['error'](_0x4e7e('0xd'),_0x31415e,_0xa19857[_0x4e7e('0x12')]['message']);return _0x5033c1(_0xa19857[_0x4e7e('0x12')][_0x4e7e('0x14')]);}else{logger[_0x4e7e('0x15')]('VtigerConfiguration,\x20%s,\x20%s',_0x31415e,_0x4e7e('0xe'));_0x5033c1(_0xa19857[_0x4e7e('0x16')][_0x4e7e('0x14')]);}})['catch'](function(_0x458195){logger[_0x4e7e('0x12')](_0x4e7e('0xd'),_0x31415e,_0x458195);_0x150208(_0x458195);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 6450561..7dca3ee 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 _0x152b=['../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1012c6,_0x23c161){var _0x414db5=function(_0x4c7913){while(--_0x4c7913){_0x1012c6['push'](_0x1012c6['shift']());}};_0x414db5(++_0x23c161);}(_0x152b,0x128));var _0xb152=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0x152b[_0x2f1114];return _0x2fe856;};'use strict';var multer=require(_0xb152('0x0'));var util=require(_0xb152('0x1'));var path=require(_0xb152('0x2'));var timeout=require(_0xb152('0x3'));var express=require(_0xb152('0x4'));var router=express[_0xb152('0x5')]();var fs_extra=require(_0xb152('0x6'));var auth=require(_0xb152('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb152('0x8'));var controller=require(_0xb152('0x9'));router[_0xb152('0xa')]('/',auth[_0xb152('0xb')](),controller[_0xb152('0xc')]);router[_0xb152('0xa')](_0xb152('0xd'),auth[_0xb152('0xb')](),controller[_0xb152('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xb152('0xf')](_0xb152('0xd'),auth[_0xb152('0xb')](),controller['update']);router[_0xb152('0x10')](_0xb152('0xd'),auth['isAuthenticated'](),controller[_0xb152('0x11')]);module[_0xb152('0x12')]=router; \ No newline at end of file +var _0xb4c4=['update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put'];(function(_0xa6efeb,_0x11ace7){var _0x214453=function(_0x133f58){while(--_0x133f58){_0xa6efeb['push'](_0xa6efeb['shift']());}};_0x214453(++_0x11ace7);}(_0xb4c4,0xac));var _0x4b4c=function(_0x189c9e,_0x1c3b55){_0x189c9e=_0x189c9e-0x0;var _0x3f38ca=_0xb4c4[_0x189c9e];return _0x3f38ca;};'use strict';var multer=require(_0x4b4c('0x0'));var util=require(_0x4b4c('0x1'));var path=require(_0x4b4c('0x2'));var timeout=require('connect-timeout');var express=require(_0x4b4c('0x3'));var router=express[_0x4b4c('0x4')]();var fs_extra=require(_0x4b4c('0x5'));var auth=require(_0x4b4c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4b4c('0x7'));var controller=require('./intVtigerField.controller');router[_0x4b4c('0x8')]('/',auth[_0x4b4c('0x9')](),controller['index']);router[_0x4b4c('0x8')](_0x4b4c('0xa'),auth[_0x4b4c('0x9')](),controller[_0x4b4c('0xb')]);router[_0x4b4c('0xc')]('/',auth[_0x4b4c('0x9')](),controller[_0x4b4c('0xd')]);router[_0x4b4c('0xe')](_0x4b4c('0xa'),auth[_0x4b4c('0x9')](),controller[_0x4b4c('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4b4c('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 3fe88bd..7bc0a85 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 _0xb30d=['variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xb30d,0x16e));var _0xdb30=function(_0x38841c,_0x1af0bf){_0x38841c=_0x38841c-0x0;var _0x500610=_0xb30d[_0x38841c];return _0x500610;};'use strict';var Sequelize=require(_0xdb30('0x0'));module[_0xdb30('0x1')]={'type':{'type':Sequelize[_0xdb30('0x2')](_0xdb30('0x3'),_0xdb30('0x4'),'customVariable',_0xdb30('0x5'),_0xdb30('0x6')),'defaultValue':_0xdb30('0x3')},'content':{'type':Sequelize[_0xdb30('0x7')]},'key':{'type':Sequelize[_0xdb30('0x7')]},'keyType':{'type':Sequelize[_0xdb30('0x2')]('string',_0xdb30('0x4'),_0xdb30('0x8'))},'keyContent':{'type':Sequelize[_0xdb30('0x7')]},'idField':{'type':Sequelize[_0xdb30('0x7')]},'nameField':{'type':Sequelize[_0xdb30('0x7')]},'customField':{'type':Sequelize[_0xdb30('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdb30('0x7')]}}; \ No newline at end of file +var _0x1133=['string','variable','customVariable','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x4d1dcb,_0x49df03){var _0x3088a7=function(_0xeb5143){while(--_0xeb5143){_0x4d1dcb['push'](_0x4d1dcb['shift']());}};_0x3088a7(++_0x49df03);}(_0x1133,0x15d));var _0x3113=function(_0x5b1d93,_0x394c14){_0x5b1d93=_0x5b1d93-0x0;var _0x4a72e6=_0x1133[_0x5b1d93];return _0x4a72e6;};'use strict';var Sequelize=require(_0x3113('0x0'));module[_0x3113('0x1')]={'type':{'type':Sequelize[_0x3113('0x2')](_0x3113('0x3'),_0x3113('0x4'),_0x3113('0x5'),'keyValue','picklist'),'defaultValue':_0x3113('0x3')},'content':{'type':Sequelize[_0x3113('0x6')]},'key':{'type':Sequelize[_0x3113('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x3113('0x4'),_0x3113('0x5'))},'keyContent':{'type':Sequelize[_0x3113('0x6')]},'idField':{'type':Sequelize[_0x3113('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3113('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3113('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index f15b6da..c3a9072 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 _0xb880=['status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','stack','send','index','map','VtigerField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','name','includeAll','include','findAll','rows','show','params','options','find','create','body','catch','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xe5aee3,_0x26a5ae){var _0x415332=function(_0x3a6b3a){while(--_0x3a6b3a){_0xe5aee3['push'](_0xe5aee3['shift']());}};_0x415332(++_0x26a5ae);}(_0xb880,0x7b));var _0x0b88=function(_0x1bce13,_0x17e615){_0x1bce13=_0x1bce13-0x0;var _0x4e5816=_0xb880[_0x1bce13];return _0x4e5816;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b88('0x0'));var zipdir=require(_0x0b88('0x1'));var jsonpatch=require(_0x0b88('0x2'));var rp=require(_0x0b88('0x3'));var moment=require(_0x0b88('0x4'));var BPromise=require(_0x0b88('0x5'));var Mustache=require(_0x0b88('0x6'));var util=require('util');var path=require(_0x0b88('0x7'));var sox=require('sox');var csv=require(_0x0b88('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0b88('0x9'));var _=require(_0x0b88('0xa'));var squel=require('squel');var crypto=require(_0x0b88('0xb'));var jsforce=require(_0x0b88('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0b88('0x8'));var querystring=require(_0x0b88('0xd'));var Papa=require(_0x0b88('0xe'));var Redis=require(_0x0b88('0xf'));var authService=require(_0x0b88('0x10'));var qs=require(_0x0b88('0x11'));var as=require(_0x0b88('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0b88('0x13'));var licenseUtil=require(_0x0b88('0x14'));var db=require(_0x0b88('0x15'))['db'];function respondWithStatusCode(_0x4fb206,_0x2191bc){_0x2191bc=_0x2191bc||0xcc;return function(_0x59fe7b){if(_0x59fe7b){return _0x4fb206[_0x0b88('0x16')](_0x2191bc);}return _0x4fb206[_0x0b88('0x17')](_0x2191bc)['end']();};}function respondWithResult(_0x1e6280,_0x1b963c){_0x1b963c=_0x1b963c||0xc8;return function(_0xae6f50){if(_0xae6f50){return _0x1e6280[_0x0b88('0x17')](_0x1b963c)[_0x0b88('0x18')](_0xae6f50);}};}function respondWithFilteredResult(_0x3ecd3e,_0x10fa5a){return function(_0x2923d6){if(_0x2923d6){var _0x2a020a=typeof _0x10fa5a[_0x0b88('0x19')]===_0x0b88('0x1a')&&typeof _0x10fa5a[_0x0b88('0x1b')]===_0x0b88('0x1a');var _0x432052=_0x2923d6['count'];var _0x2e9274=_0x2a020a?0x0:_0x10fa5a[_0x0b88('0x19')];var _0x9e714a=_0x2a020a?_0x2923d6[_0x0b88('0x1c')]:_0x10fa5a[_0x0b88('0x19')]+_0x10fa5a[_0x0b88('0x1b')];var _0x3fe3d2;if(_0x9e714a>=_0x432052){_0x9e714a=_0x432052;_0x3fe3d2=0xc8;}else{_0x3fe3d2=0xce;}_0x3ecd3e[_0x0b88('0x17')](_0x3fe3d2);return _0x3ecd3e[_0x0b88('0x1d')]('Content-Range',_0x2e9274+'-'+_0x9e714a+'/'+_0x432052)['json'](_0x2923d6);}return null;};}function patchUpdates(_0x26de9f){return function(_0xc5ad2e){try{jsonpatch[_0x0b88('0x1e')](_0xc5ad2e,_0x26de9f,!![]);}catch(_0x34537a){return BPromise[_0x0b88('0x1f')](_0x34537a);}return _0xc5ad2e[_0x0b88('0x20')]();};}function saveUpdates(_0x4c9ebc,_0x299593){return function(_0x46ab54){if(_0x46ab54){return _0x46ab54[_0x0b88('0x21')](_0x4c9ebc)[_0x0b88('0x22')](function(_0x5ca82e){return _0x5ca82e;});}return null;};}function removeEntity(_0x512fe2,_0x6d55e8){return function(_0x52ec80){if(_0x52ec80){return _0x52ec80['destroy']()[_0x0b88('0x22')](function(){_0x512fe2['status'](0xcc)[_0x0b88('0x23')]();});}};}function handleEntityNotFound(_0x493601,_0x550d84){return function(_0x33634e){if(!_0x33634e){_0x493601[_0x0b88('0x16')](0x194);}return _0x33634e;};}function handleError(_0x2b269e,_0x2a3480){_0x2a3480=_0x2a3480||0x1f4;return function(_0x1c198b){logger['error'](_0x1c198b[_0x0b88('0x24')]);if(_0x1c198b['name']){delete _0x1c198b['name'];}_0x2b269e['status'](_0x2a3480)[_0x0b88('0x25')](_0x1c198b);};}exports[_0x0b88('0x26')]=function(_0x570778,_0x39d152){var _0xfdce7={},_0x2c13c3={},_0x2e38c5={'count':0x0,'rows':[]};var _0x3f9152=_[_0x0b88('0x27')](db[_0x0b88('0x28')]['rawAttributes'],function(_0x12bce8){return{'name':_0x12bce8[_0x0b88('0x29')],'type':_0x12bce8[_0x0b88('0x2a')][_0x0b88('0x2b')]};});_0x2c13c3[_0x0b88('0x2c')]=_[_0x0b88('0x27')](_0x3f9152,'name');_0x2c13c3[_0x0b88('0x2d')]=_[_0x0b88('0x2e')](_0x570778['query']);_0x2c13c3[_0x0b88('0x2f')]=_[_0x0b88('0x30')](_0x2c13c3['model'],_0x2c13c3[_0x0b88('0x2d')]);_0xfdce7[_0x0b88('0x31')]=_[_0x0b88('0x30')](_0x2c13c3['model'],qs[_0x0b88('0x32')](_0x570778[_0x0b88('0x2d')]['fields']));_0xfdce7[_0x0b88('0x31')]=_0xfdce7['attributes'][_0x0b88('0x33')]?_0xfdce7[_0x0b88('0x31')]:_0x2c13c3[_0x0b88('0x2c')];if(!_0x570778[_0x0b88('0x2d')][_0x0b88('0x34')](_0x0b88('0x35'))){_0xfdce7['limit']=qs[_0x0b88('0x1b')](_0x570778['query'][_0x0b88('0x1b')]);_0xfdce7[_0x0b88('0x19')]=qs[_0x0b88('0x19')](_0x570778[_0x0b88('0x2d')][_0x0b88('0x19')]);}_0xfdce7[_0x0b88('0x36')]=qs[_0x0b88('0x37')](_0x570778[_0x0b88('0x2d')][_0x0b88('0x37')]);_0xfdce7[_0x0b88('0x38')]=qs[_0x0b88('0x2f')](_[_0x0b88('0x39')](_0x570778[_0x0b88('0x2d')],_0x2c13c3[_0x0b88('0x2f')]),_0x3f9152);if(_0x570778[_0x0b88('0x2d')][_0x0b88('0x3a')]){_0xfdce7[_0x0b88('0x38')]=_[_0x0b88('0x3b')](_0xfdce7[_0x0b88('0x38')],{'$or':_['map'](_0x3f9152,function(_0xac26cb){if(_0xac26cb[_0x0b88('0x2a')]!=='VIRTUAL'){var _0x292dbb={};_0x292dbb[_0xac26cb[_0x0b88('0x3c')]]={'$like':'%'+_0x570778['query'][_0x0b88('0x3a')]+'%'};return _0x292dbb;}})});}_0xfdce7=_['merge']({},_0xfdce7,_0x570778['options']);var _0x3a19c7={'where':_0xfdce7['where']};return db[_0x0b88('0x28')][_0x0b88('0x1c')](_0x3a19c7)['then'](function(_0x2ceeee){_0x2e38c5[_0x0b88('0x1c')]=_0x2ceeee;if(_0x570778[_0x0b88('0x2d')][_0x0b88('0x3d')]){_0xfdce7[_0x0b88('0x3e')]=[{'all':!![]}];}return db[_0x0b88('0x28')][_0x0b88('0x3f')](_0xfdce7);})[_0x0b88('0x22')](function(_0x3e5628){_0x2e38c5[_0x0b88('0x40')]=_0x3e5628;return _0x2e38c5;})[_0x0b88('0x22')](respondWithFilteredResult(_0x39d152,_0xfdce7))['catch'](handleError(_0x39d152,null));};exports[_0x0b88('0x41')]=function(_0x1ca1ed,_0x1111ef){var _0x4c7dbe={'raw':!![],'where':{'id':_0x1ca1ed[_0x0b88('0x42')]['id']}},_0x1e19cf={};_0x1e19cf['model']=_[_0x0b88('0x2e')](db[_0x0b88('0x28')]['rawAttributes']);_0x1e19cf['query']=_['keys'](_0x1ca1ed[_0x0b88('0x2d')]);_0x1e19cf['filters']=_['intersection'](_0x1e19cf[_0x0b88('0x2c')],_0x1e19cf[_0x0b88('0x2d')]);_0x4c7dbe[_0x0b88('0x31')]=_['intersection'](_0x1e19cf[_0x0b88('0x2c')],qs[_0x0b88('0x32')](_0x1ca1ed[_0x0b88('0x2d')][_0x0b88('0x32')]));_0x4c7dbe[_0x0b88('0x31')]=_0x4c7dbe[_0x0b88('0x31')]['length']?_0x4c7dbe[_0x0b88('0x31')]:_0x1e19cf[_0x0b88('0x2c')];if(_0x1ca1ed[_0x0b88('0x2d')][_0x0b88('0x3d')]){_0x4c7dbe[_0x0b88('0x3e')]=[{'all':!![]}];}_0x4c7dbe=_[_0x0b88('0x3b')]({},_0x4c7dbe,_0x1ca1ed[_0x0b88('0x43')]);return db['VtigerField'][_0x0b88('0x44')](_0x4c7dbe)['then'](handleEntityNotFound(_0x1111ef,null))['then'](respondWithResult(_0x1111ef,null))['catch'](handleError(_0x1111ef,null));};exports[_0x0b88('0x45')]=function(_0x19342f,_0x4fcf98){return db[_0x0b88('0x28')][_0x0b88('0x45')](_0x19342f[_0x0b88('0x46')],{})[_0x0b88('0x22')](respondWithResult(_0x4fcf98,0xc9))[_0x0b88('0x47')](handleError(_0x4fcf98,null));};exports[_0x0b88('0x21')]=function(_0x5f4592,_0xf43f27){if(_0x5f4592[_0x0b88('0x46')]['id']){delete _0x5f4592[_0x0b88('0x46')]['id'];}return db['VtigerField'][_0x0b88('0x44')]({'where':{'id':_0x5f4592['params']['id']}})['then'](handleEntityNotFound(_0xf43f27,null))[_0x0b88('0x22')](saveUpdates(_0x5f4592['body'],null))[_0x0b88('0x22')](respondWithResult(_0xf43f27,null))[_0x0b88('0x47')](handleError(_0xf43f27,null));};exports[_0x0b88('0x48')]=function(_0x2b66ff,_0x238316){return db[_0x0b88('0x28')][_0x0b88('0x44')]({'where':{'id':_0x2b66ff['params']['id']}})[_0x0b88('0x22')](handleEntityNotFound(_0x238316,null))['then'](removeEntity(_0x238316,null))[_0x0b88('0x47')](handleError(_0x238316,null));}; \ No newline at end of file +var _0x38eb=['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','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','VtigerField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x49a87f,_0x26703e){var _0x4fc34c=function(_0x1e8602){while(--_0x1e8602){_0x49a87f['push'](_0x49a87f['shift']());}};_0x4fc34c(++_0x26703e);}(_0x38eb,0x8c));var _0xb38e=function(_0x53cc8c,_0x50e881){_0x53cc8c=_0x53cc8c-0x0;var _0x305d30=_0x38eb[_0x53cc8c];return _0x305d30;};'use strict';var emlformat=require(_0xb38e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb38e('0x1'));var jsonpatch=require(_0xb38e('0x2'));var rp=require(_0xb38e('0x3'));var moment=require(_0xb38e('0x4'));var BPromise=require(_0xb38e('0x5'));var Mustache=require(_0xb38e('0x6'));var util=require('util');var path=require(_0xb38e('0x7'));var sox=require(_0xb38e('0x8'));var csv=require(_0xb38e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb38e('0xa'));var _=require(_0xb38e('0xb'));var squel=require(_0xb38e('0xc'));var crypto=require(_0xb38e('0xd'));var jsforce=require(_0xb38e('0xe'));var deskjs=require(_0xb38e('0xf'));var toCsv=require(_0xb38e('0x9'));var querystring=require(_0xb38e('0x10'));var Papa=require(_0xb38e('0x11'));var Redis=require(_0xb38e('0x12'));var authService=require(_0xb38e('0x13'));var qs=require(_0xb38e('0x14'));var as=require(_0xb38e('0x15'));var hardwareService=require(_0xb38e('0x16'));var logger=require(_0xb38e('0x17'))(_0xb38e('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb38e('0x19'))['db'];function respondWithStatusCode(_0x587655,_0x3f4827){_0x3f4827=_0x3f4827||0xcc;return function(_0xff1c20){if(_0xff1c20){return _0x587655[_0xb38e('0x1a')](_0x3f4827);}return _0x587655[_0xb38e('0x1b')](_0x3f4827)['end']();};}function respondWithResult(_0x4da419,_0x1d4246){_0x1d4246=_0x1d4246||0xc8;return function(_0x5d4546){if(_0x5d4546){return _0x4da419['status'](_0x1d4246)[_0xb38e('0x1c')](_0x5d4546);}};}function respondWithFilteredResult(_0xb40e8a,_0x17b2b3){return function(_0x47240d){if(_0x47240d){var _0x35dded=typeof _0x17b2b3[_0xb38e('0x1d')]==='undefined'&&typeof _0x17b2b3[_0xb38e('0x1e')]===_0xb38e('0x1f');var _0x328890=_0x47240d['count'];var _0x4bc684=_0x35dded?0x0:_0x17b2b3['offset'];var _0x52a0ba=_0x35dded?_0x47240d[_0xb38e('0x20')]:_0x17b2b3[_0xb38e('0x1d')]+_0x17b2b3[_0xb38e('0x1e')];var _0x307bbd;if(_0x52a0ba>=_0x328890){_0x52a0ba=_0x328890;_0x307bbd=0xc8;}else{_0x307bbd=0xce;}_0xb40e8a['status'](_0x307bbd);return _0xb40e8a[_0xb38e('0x21')](_0xb38e('0x22'),_0x4bc684+'-'+_0x52a0ba+'/'+_0x328890)[_0xb38e('0x1c')](_0x47240d);}return null;};}function patchUpdates(_0x28b136){return function(_0x18e54d){try{jsonpatch['apply'](_0x18e54d,_0x28b136,!![]);}catch(_0x3ff458){return BPromise[_0xb38e('0x23')](_0x3ff458);}return _0x18e54d[_0xb38e('0x24')]();};}function saveUpdates(_0x442c18,_0x4ffbea){return function(_0xbe3dde){if(_0xbe3dde){return _0xbe3dde[_0xb38e('0x25')](_0x442c18)[_0xb38e('0x26')](function(_0x49aed3){return _0x49aed3;});}return null;};}function removeEntity(_0x5e1e69,_0x4f660f){return function(_0x14d752){if(_0x14d752){return _0x14d752[_0xb38e('0x27')]()[_0xb38e('0x26')](function(){_0x5e1e69[_0xb38e('0x1b')](0xcc)[_0xb38e('0x28')]();});}};}function handleEntityNotFound(_0x44d51e,_0x1f9287){return function(_0x23d571){if(!_0x23d571){_0x44d51e[_0xb38e('0x1a')](0x194);}return _0x23d571;};}function handleError(_0x20147a,_0x51b157){_0x51b157=_0x51b157||0x1f4;return function(_0x46e02b){logger[_0xb38e('0x29')](_0x46e02b['stack']);if(_0x46e02b[_0xb38e('0x2a')]){delete _0x46e02b[_0xb38e('0x2a')];}_0x20147a[_0xb38e('0x1b')](_0x51b157)[_0xb38e('0x2b')](_0x46e02b);};}exports[_0xb38e('0x2c')]=function(_0x2ca843,_0x350f0b){var _0x27cca6={},_0x18fea1={},_0xf53ac3={'count':0x0,'rows':[]};var _0x2cb555=_[_0xb38e('0x2d')](db[_0xb38e('0x2e')]['rawAttributes'],function(_0x34c433){return{'name':_0x34c433[_0xb38e('0x2f')],'type':_0x34c433[_0xb38e('0x30')][_0xb38e('0x31')]};});_0x18fea1[_0xb38e('0x32')]=_[_0xb38e('0x2d')](_0x2cb555,_0xb38e('0x2a'));_0x18fea1[_0xb38e('0x33')]=_[_0xb38e('0x34')](_0x2ca843[_0xb38e('0x33')]);_0x18fea1[_0xb38e('0x35')]=_[_0xb38e('0x36')](_0x18fea1[_0xb38e('0x32')],_0x18fea1[_0xb38e('0x33')]);_0x27cca6['attributes']=_['intersection'](_0x18fea1[_0xb38e('0x32')],qs[_0xb38e('0x37')](_0x2ca843[_0xb38e('0x33')]['fields']));_0x27cca6[_0xb38e('0x38')]=_0x27cca6['attributes'][_0xb38e('0x39')]?_0x27cca6[_0xb38e('0x38')]:_0x18fea1[_0xb38e('0x32')];if(!_0x2ca843[_0xb38e('0x33')][_0xb38e('0x3a')]('nolimit')){_0x27cca6[_0xb38e('0x1e')]=qs[_0xb38e('0x1e')](_0x2ca843[_0xb38e('0x33')][_0xb38e('0x1e')]);_0x27cca6['offset']=qs['offset'](_0x2ca843[_0xb38e('0x33')]['offset']);}_0x27cca6[_0xb38e('0x3b')]=qs[_0xb38e('0x3c')](_0x2ca843[_0xb38e('0x33')]['sort']);_0x27cca6[_0xb38e('0x3d')]=qs[_0xb38e('0x35')](_[_0xb38e('0x3e')](_0x2ca843[_0xb38e('0x33')],_0x18fea1[_0xb38e('0x35')]),_0x2cb555);if(_0x2ca843[_0xb38e('0x33')]['filter']){_0x27cca6[_0xb38e('0x3d')]=_[_0xb38e('0x3f')](_0x27cca6['where'],{'$or':_['map'](_0x2cb555,function(_0x58b843){if(_0x58b843[_0xb38e('0x30')]!==_0xb38e('0x40')){var _0x587ecd={};_0x587ecd[_0x58b843['name']]={'$like':'%'+_0x2ca843[_0xb38e('0x33')][_0xb38e('0x41')]+'%'};return _0x587ecd;}})});}_0x27cca6=_[_0xb38e('0x3f')]({},_0x27cca6,_0x2ca843[_0xb38e('0x42')]);var _0x45f3bd={'where':_0x27cca6[_0xb38e('0x3d')]};return db['VtigerField'][_0xb38e('0x20')](_0x45f3bd)[_0xb38e('0x26')](function(_0x4e1035){_0xf53ac3[_0xb38e('0x20')]=_0x4e1035;if(_0x2ca843[_0xb38e('0x33')][_0xb38e('0x43')]){_0x27cca6[_0xb38e('0x44')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x27cca6);})[_0xb38e('0x26')](function(_0x1287c2){_0xf53ac3[_0xb38e('0x45')]=_0x1287c2;return _0xf53ac3;})[_0xb38e('0x26')](respondWithFilteredResult(_0x350f0b,_0x27cca6))[_0xb38e('0x46')](handleError(_0x350f0b,null));};exports[_0xb38e('0x47')]=function(_0x56924f,_0x17195e){var _0x460f36={'raw':!![],'where':{'id':_0x56924f[_0xb38e('0x48')]['id']}},_0x494428={};_0x494428[_0xb38e('0x32')]=_[_0xb38e('0x34')](db[_0xb38e('0x2e')][_0xb38e('0x49')]);_0x494428['query']=_[_0xb38e('0x34')](_0x56924f['query']);_0x494428[_0xb38e('0x35')]=_['intersection'](_0x494428['model'],_0x494428[_0xb38e('0x33')]);_0x460f36[_0xb38e('0x38')]=_[_0xb38e('0x36')](_0x494428['model'],qs[_0xb38e('0x37')](_0x56924f[_0xb38e('0x33')][_0xb38e('0x37')]));_0x460f36['attributes']=_0x460f36['attributes'][_0xb38e('0x39')]?_0x460f36[_0xb38e('0x38')]:_0x494428[_0xb38e('0x32')];if(_0x56924f[_0xb38e('0x33')]['includeAll']){_0x460f36[_0xb38e('0x44')]=[{'all':!![]}];}_0x460f36=_['merge']({},_0x460f36,_0x56924f[_0xb38e('0x42')]);return db[_0xb38e('0x2e')][_0xb38e('0x4a')](_0x460f36)[_0xb38e('0x26')](handleEntityNotFound(_0x17195e,null))['then'](respondWithResult(_0x17195e,null))['catch'](handleError(_0x17195e,null));};exports[_0xb38e('0x4b')]=function(_0xdec7a0,_0x404301){return db[_0xb38e('0x2e')][_0xb38e('0x4b')](_0xdec7a0[_0xb38e('0x4c')],{})['then'](respondWithResult(_0x404301,0xc9))[_0xb38e('0x46')](handleError(_0x404301,null));};exports[_0xb38e('0x25')]=function(_0x7a4eaf,_0x5e9476){if(_0x7a4eaf[_0xb38e('0x4c')]['id']){delete _0x7a4eaf[_0xb38e('0x4c')]['id'];}return db[_0xb38e('0x2e')][_0xb38e('0x4a')]({'where':{'id':_0x7a4eaf[_0xb38e('0x48')]['id']}})[_0xb38e('0x26')](handleEntityNotFound(_0x5e9476,null))[_0xb38e('0x26')](saveUpdates(_0x7a4eaf[_0xb38e('0x4c')],null))[_0xb38e('0x26')](respondWithResult(_0x5e9476,null))[_0xb38e('0x46')](handleError(_0x5e9476,null));};exports[_0xb38e('0x27')]=function(_0xaa8633,_0x572813){return db['VtigerField'][_0xb38e('0x4a')]({'where':{'id':_0xaa8633[_0xb38e('0x48')]['id']}})['then'](handleEntityNotFound(_0x572813,null))['then'](removeEntity(_0x572813,null))[_0xb38e('0x46')](handleError(_0x572813,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 7f1f0ad..3f15cc4 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 _0xbfa5=['exports','define','VtigerField','lodash','util','api','bluebird','request-promise','path','rimraf','./intVtigerField.attributes'];(function(_0x30e998,_0xe026ba){var _0x5ce82e=function(_0xabfaad){while(--_0xabfaad){_0x30e998['push'](_0x30e998['shift']());}};_0x5ce82e(++_0xe026ba);}(_0xbfa5,0xc9));var _0x5bfa=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xbfa5[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x5bfa('0x0'));var util=require(_0x5bfa('0x1'));var logger=require('../../config/logger')(_0x5bfa('0x2'));var moment=require('moment');var BPromise=require(_0x5bfa('0x3'));var rp=require(_0x5bfa('0x4'));var fs=require('fs');var path=require(_0x5bfa('0x5'));var rimraf=require(_0x5bfa('0x6'));var config=require('../../config/environment');var attributes=require(_0x5bfa('0x7'));module[_0x5bfa('0x8')]=function(_0x1813f6,_0x409e70){return _0x1813f6[_0x5bfa('0x9')](_0x5bfa('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5360=['define','int_vtiger_fields','idField','FieldId','lodash','api','request-promise','path','./intVtigerField.attributes'];(function(_0x4f4270,_0x5366d0){var _0x3209cf=function(_0x23d231){while(--_0x23d231){_0x4f4270['push'](_0x4f4270['shift']());}};_0x3209cf(++_0x5366d0);}(_0x5360,0x16c));var _0x0536=function(_0xcf4bf7,_0x27b174){_0xcf4bf7=_0xcf4bf7-0x0;var _0x4f8056=_0x5360[_0xcf4bf7];return _0x4f8056;};'use strict';var _=require(_0x0536('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0536('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0536('0x2'));var fs=require('fs');var path=require(_0x0536('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0536('0x4'));module['exports']=function(_0x238bf1,_0x34b424){return _0x238bf1[_0x0536('0x5')]('VtigerField',attributes,{'tableName':_0x0536('0x6'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x0536('0x7'),_0x0536('0x8')],'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 c339438..8f7d726 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 _0x4095=['debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','request\x20sent'];(function(_0x3fcef9,_0x2d8dc1){var _0x1e087d=function(_0x25f30d){while(--_0x25f30d){_0x3fcef9['push'](_0x3fcef9['shift']());}};_0x1e087d(++_0x2d8dc1);}(_0x4095,0xce));var _0x5409=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x4095[_0x381589];return _0x2a075d;};'use strict';var _=require(_0x5409('0x0'));var util=require(_0x5409('0x1'));var moment=require(_0x5409('0x2'));var BPromise=require(_0x5409('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5409('0x4'));var db=require(_0x5409('0x5'))['db'];var utils=require(_0x5409('0x6'));var logger=require(_0x5409('0x7'))('rpc');var config=require(_0x5409('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5409('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1db913,_0x1b2436,_0x5502d3){return new BPromise(function(_0x35d69c,_0x3d1c8d){return client[_0x5409('0xa')](_0x1db913,_0x5502d3)[_0x5409('0xb')](function(_0x46f3e0){logger[_0x5409('0xc')]('VtigerField,\x20%s,\x20%s',_0x1b2436,_0x5409('0xd'));logger[_0x5409('0xe')](_0x5409('0xf'),_0x1b2436,_0x5409('0xd'),JSON['stringify'](_0x46f3e0));if(_0x46f3e0[_0x5409('0x10')]){if(_0x46f3e0[_0x5409('0x10')][_0x5409('0x11')]===0x1f4){logger['error'](_0x5409('0x12'),_0x1b2436,_0x46f3e0[_0x5409('0x10')][_0x5409('0x13')]);return _0x3d1c8d(_0x46f3e0[_0x5409('0x10')]['message']);}logger['error']('VtigerField,\x20%s,\x20%s',_0x1b2436,_0x46f3e0[_0x5409('0x10')][_0x5409('0x13')]);return _0x35d69c(_0x46f3e0[_0x5409('0x10')][_0x5409('0x13')]);}else{logger[_0x5409('0xc')](_0x5409('0x12'),_0x1b2436,_0x5409('0xd'));_0x35d69c(_0x46f3e0[_0x5409('0x14')][_0x5409('0x13')]);}})[_0x5409('0x15')](function(_0x9683a0){logger['error'](_0x5409('0x12'),_0x1b2436,_0x9683a0);_0x3d1c8d(_0x9683a0);});});} \ No newline at end of file +var _0xb865=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x13c774,_0x27b6c6){var _0x5874ec=function(_0x3c40db){while(--_0x3c40db){_0x13c774['push'](_0x13c774['shift']());}};_0x5874ec(++_0x27b6c6);}(_0xb865,0x1e0));var _0x5b86=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0xb865[_0x2ca616];return _0x53155f;};'use strict';var _=require(_0x5b86('0x0'));var util=require(_0x5b86('0x1'));var moment=require(_0x5b86('0x2'));var BPromise=require(_0x5b86('0x3'));var rs=require(_0x5b86('0x4'));var fs=require('fs');var Redis=require(_0x5b86('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5b86('0x6'));var logger=require(_0x5b86('0x7'))(_0x5b86('0x8'));var config=require(_0x5b86('0x9'));var jayson=require(_0x5b86('0xa'));var client=jayson[_0x5b86('0xb')][_0x5b86('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9523a2,_0x518e4f,_0x146316){return new BPromise(function(_0x34b8b8,_0x5d7556){return client['request'](_0x9523a2,_0x146316)[_0x5b86('0xd')](function(_0x47ca4b){logger['info'](_0x5b86('0xe'),_0x518e4f,_0x5b86('0xf'));logger['debug'](_0x5b86('0x10'),_0x518e4f,_0x5b86('0xf'),JSON[_0x5b86('0x11')](_0x47ca4b));if(_0x47ca4b[_0x5b86('0x12')]){if(_0x47ca4b['error'][_0x5b86('0x13')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x518e4f,_0x47ca4b[_0x5b86('0x12')][_0x5b86('0x14')]);return _0x5d7556(_0x47ca4b['error'][_0x5b86('0x14')]);}logger[_0x5b86('0x12')](_0x5b86('0xe'),_0x518e4f,_0x47ca4b[_0x5b86('0x12')]['message']);return _0x34b8b8(_0x47ca4b[_0x5b86('0x12')][_0x5b86('0x14')]);}else{logger['info'](_0x5b86('0xe'),_0x518e4f,_0x5b86('0xf'));_0x34b8b8(_0x47ca4b[_0x5b86('0x15')][_0x5b86('0x14')]);}})['catch'](function(_0x497954){logger[_0x5b86('0x12')](_0x5b86('0xe'),_0x518e4f,_0x497954);_0x5d7556(_0x497954);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 9c7fec9..7df683d 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 _0x9147=['exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','getFields','post','addConfiguration','put','destroy'];(function(_0x5d03b8,_0x1c59c1){var _0x12a14d=function(_0x282838){while(--_0x282838){_0x5d03b8['push'](_0x5d03b8['shift']());}};_0x12a14d(++_0x1c59c1);}(_0x9147,0x7f));var _0x7914=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x9147[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x7914('0x0'));var util=require(_0x7914('0x1'));var path=require(_0x7914('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7914('0x3')]();var fs_extra=require(_0x7914('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7914('0x5'));var config=require(_0x7914('0x6'));var controller=require(_0x7914('0x7'));router[_0x7914('0x8')]('/',auth['isAuthenticated'](),controller[_0x7914('0x9')]);router['get'](_0x7914('0xa'),auth['isAuthenticated'](),controller[_0x7914('0xb')]);router[_0x7914('0x8')](_0x7914('0xc'),auth[_0x7914('0xd')](),controller[_0x7914('0xe')]);router[_0x7914('0x8')]('/:id/fields',auth[_0x7914('0xd')](),controller[_0x7914('0xf')]);router[_0x7914('0x10')]('/',auth[_0x7914('0xd')](),controller['create']);router[_0x7914('0x10')](_0x7914('0xc'),auth[_0x7914('0xd')](),controller[_0x7914('0x11')]);router[_0x7914('0x12')](_0x7914('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7914('0xa'),auth['isAuthenticated'](),controller[_0x7914('0x13')]);module[_0x7914('0x14')]=router; \ No newline at end of file +var _0xc359=['create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x1b572c,_0x4bf802){var _0x57950f=function(_0x36e976){while(--_0x36e976){_0x1b572c['push'](_0x1b572c['shift']());}};_0x57950f(++_0x4bf802);}(_0xc359,0xa8));var _0x9c35=function(_0x51821c,_0x2e39c5){_0x51821c=_0x51821c-0x0;var _0x20bde8=_0xc359[_0x51821c];return _0x20bde8;};'use strict';var multer=require(_0x9c35('0x0'));var util=require(_0x9c35('0x1'));var path=require(_0x9c35('0x2'));var timeout=require(_0x9c35('0x3'));var express=require('express');var router=express[_0x9c35('0x4')]();var fs_extra=require(_0x9c35('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9c35('0x6'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0x9c35('0x7')]('/',auth[_0x9c35('0x8')](),controller['index']);router[_0x9c35('0x7')](_0x9c35('0x9'),auth[_0x9c35('0x8')](),controller[_0x9c35('0xa')]);router[_0x9c35('0x7')](_0x9c35('0xb'),auth[_0x9c35('0x8')](),controller[_0x9c35('0xc')]);router['get'](_0x9c35('0xd'),auth['isAuthenticated'](),controller[_0x9c35('0xe')]);router[_0x9c35('0xf')]('/',auth[_0x9c35('0x8')](),controller[_0x9c35('0x10')]);router[_0x9c35('0xf')](_0x9c35('0xb'),auth['isAuthenticated'](),controller[_0x9c35('0x11')]);router[_0x9c35('0x12')](_0x9c35('0x9'),auth[_0x9c35('0x8')](),controller[_0x9c35('0x13')]);router[_0x9c35('0x14')](_0x9c35('0x9'),auth[_0x9c35('0x8')](),controller[_0x9c35('0x15')]);module[_0x9c35('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index dacf6c5..bebf72b 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 _0xdbb1=['ENUM','password','integrationTab','sequelize','STRING','remoteUri'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdbb1,0x105));var _0x1dbb=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xdbb1[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require(_0x1dbb('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1dbb('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x1dbb('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1dbb('0x2')},'authType':{'type':Sequelize[_0x1dbb('0x3')]('password','token'),'defaultValue':_0x1dbb('0x4')},'serverUrl':{'type':Sequelize[_0x1dbb('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1dbb('0x3')](_0x1dbb('0x5'),'newTab'),'defaultValue':_0x1dbb('0x5')}}; \ No newline at end of file +var _0xb96d=['ENUM','password','token','integrationTab','exports','STRING','username'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb96d,0x9e));var _0xdb96=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0xb96d[_0x2706da];return _0x3ba87e;};'use strict';var Sequelize=require('sequelize');module[_0xdb96('0x0')]={'name':{'type':Sequelize[_0xdb96('0x1')]},'description':{'type':Sequelize[_0xdb96('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xdb96('0x2')},'password':{'type':Sequelize[_0xdb96('0x1')]},'token':{'type':Sequelize[_0xdb96('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xdb96('0x3')](_0xdb96('0x4'),_0xdb96('0x5')),'defaultValue':_0xdb96('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xdb96('0x3')](_0xdb96('0x6'),'newTab'),'defaultValue':_0xdb96('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 6c1d673..13aa1b2 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 _0xefda=['getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','stringify','send','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','rawAttributes','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskAccount','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','AccountId','Subjects','channel','type','Descriptions'];(function(_0x9a7ea6,_0x1807a2){var _0x1c2040=function(_0x55b7ec){while(--_0x55b7ec){_0x9a7ea6['push'](_0x9a7ea6['shift']());}};_0x1c2040(++_0x1807a2);}(_0xefda,0x96));var _0xaefd=function(_0x796b1e,_0x4e447a){_0x796b1e=_0x796b1e-0x0;var _0x52ef1a=_0xefda[_0x796b1e];return _0x52ef1a;};'use strict';var emlformat=require(_0xaefd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaefd('0x1'));var rp=require(_0xaefd('0x2'));var moment=require('moment');var BPromise=require(_0xaefd('0x3'));var Mustache=require(_0xaefd('0x4'));var util=require(_0xaefd('0x5'));var path=require(_0xaefd('0x6'));var sox=require(_0xaefd('0x7'));var csv=require(_0xaefd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaefd('0x9'));var _=require(_0xaefd('0xa'));var squel=require(_0xaefd('0xb'));var crypto=require(_0xaefd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaefd('0xd'));var toCsv=require(_0xaefd('0x8'));var querystring=require(_0xaefd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaefd('0xf'));var as=require(_0xaefd('0x10'));var hardwareService=require(_0xaefd('0x11'));var logger=require(_0xaefd('0x12'))(_0xaefd('0x13'));var utils=require(_0xaefd('0x14'));var config=require(_0xaefd('0x15'));var licenseUtil=require(_0xaefd('0x16'));var db=require(_0xaefd('0x17'))['db'];var integrations=require(_0xaefd('0x18'));function respondWithStatusCode(_0x2a310c,_0x4b2b5c){_0x4b2b5c=_0x4b2b5c||0xcc;return function(_0x3172d3){if(_0x3172d3){return _0x2a310c['sendStatus'](_0x4b2b5c);}return _0x2a310c[_0xaefd('0x19')](_0x4b2b5c)[_0xaefd('0x1a')]();};}function respondWithResult(_0x9dfdf6,_0x43b82a){_0x43b82a=_0x43b82a||0xc8;return function(_0x4ec92a){if(_0x4ec92a){return _0x9dfdf6[_0xaefd('0x19')](_0x43b82a)[_0xaefd('0x1b')](_0x4ec92a);}};}function respondWithFilteredResult(_0x41f345,_0x411701){return function(_0x10ee28){if(_0x10ee28){var _0x32f75e=typeof _0x411701[_0xaefd('0x1c')]===_0xaefd('0x1d')&&typeof _0x411701['limit']===_0xaefd('0x1d');var _0x109604=_0x10ee28[_0xaefd('0x1e')];var _0x1737a1=_0x32f75e?0x0:_0x411701[_0xaefd('0x1c')];var _0x244956=_0x32f75e?_0x10ee28['count']:_0x411701[_0xaefd('0x1c')]+_0x411701[_0xaefd('0x1f')];var _0x24f131;if(_0x244956>=_0x109604){_0x244956=_0x109604;_0x24f131=0xc8;}else{_0x24f131=0xce;}_0x41f345[_0xaefd('0x19')](_0x24f131);return _0x41f345[_0xaefd('0x20')](_0xaefd('0x21'),_0x1737a1+'-'+_0x244956+'/'+_0x109604)['json'](_0x10ee28);}return null;};}function patchUpdates(_0x463d48){return function(_0x18e71c){try{jsonpatch[_0xaefd('0x22')](_0x18e71c,_0x463d48,!![]);}catch(_0x3d9823){return BPromise[_0xaefd('0x23')](_0x3d9823);}return _0x18e71c['save']();};}function saveUpdates(_0x479486,_0x5b9967){return function(_0x21680a){if(_0x21680a){return _0x21680a[_0xaefd('0x24')](_0x479486)[_0xaefd('0x25')](function(_0x5a44ed){return _0x5a44ed;});}return null;};}function removeEntity(_0x23060f,_0x4cd9b2){return function(_0x3deec8){if(_0x3deec8){return _0x3deec8[_0xaefd('0x26')]()[_0xaefd('0x25')](function(){_0x23060f['status'](0xcc)[_0xaefd('0x1a')]();});}};}function handleEntityNotFound(_0x3ffc9c,_0x18e720){return function(_0x14cc9d){if(!_0x14cc9d){_0x3ffc9c[_0xaefd('0x27')](0x194);}return _0x14cc9d;};}function handleError(_0x5a170c,_0x2fe27e){_0x2fe27e=_0x2fe27e||0x1f4;return function(_0x58c008){logger[_0xaefd('0x28')](_0x58c008[_0xaefd('0x29')]);if(_0x58c008['name']){delete _0x58c008[_0xaefd('0x2a')];}_0x5a170c[_0xaefd('0x19')](_0x2fe27e)['send'](_0x58c008);};}exports[_0xaefd('0x2b')]=function(_0x114ec0,_0x36b6b7){var _0x4c0898={},_0x45f0e8={},_0x5c573b={'count':0x0,'rows':[]};var _0x109e19=_['map'](db['ZendeskAccount'][_0xaefd('0x2c')],function(_0x1b470c){return{'name':_0x1b470c['fieldName'],'type':_0x1b470c['type']['key']};});_0x45f0e8[_0xaefd('0x2d')]=_[_0xaefd('0x2e')](_0x109e19,'name');_0x45f0e8['query']=_[_0xaefd('0x2f')](_0x114ec0[_0xaefd('0x30')]);_0x45f0e8[_0xaefd('0x31')]=_[_0xaefd('0x32')](_0x45f0e8['model'],_0x45f0e8[_0xaefd('0x30')]);_0x4c0898[_0xaefd('0x33')]=_[_0xaefd('0x32')](_0x45f0e8[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x34')]));_0x4c0898[_0xaefd('0x33')]=_0x4c0898[_0xaefd('0x33')][_0xaefd('0x35')]?_0x4c0898[_0xaefd('0x33')]:_0x45f0e8[_0xaefd('0x2d')];if(!_0x114ec0[_0xaefd('0x30')][_0xaefd('0x36')](_0xaefd('0x37'))){_0x4c0898[_0xaefd('0x1f')]=qs['limit'](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x1f')]);_0x4c0898[_0xaefd('0x1c')]=qs['offset'](_0x114ec0[_0xaefd('0x30')]['offset']);}_0x4c0898[_0xaefd('0x38')]=qs[_0xaefd('0x39')](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x39')]);_0x4c0898[_0xaefd('0x3a')]=qs[_0xaefd('0x31')](_[_0xaefd('0x3b')](_0x114ec0[_0xaefd('0x30')],_0x45f0e8[_0xaefd('0x31')]),_0x109e19);if(_0x114ec0[_0xaefd('0x30')][_0xaefd('0x3c')]){_0x4c0898[_0xaefd('0x3a')]=_[_0xaefd('0x3d')](_0x4c0898[_0xaefd('0x3a')],{'$or':_['map'](_0x109e19,function(_0x1cfd6d){if(_0x1cfd6d['type']!==_0xaefd('0x3e')){var _0x6562={};_0x6562[_0x1cfd6d[_0xaefd('0x2a')]]={'$like':'%'+_0x114ec0[_0xaefd('0x30')][_0xaefd('0x3c')]+'%'};return _0x6562;}})});}_0x4c0898=_[_0xaefd('0x3d')]({},_0x4c0898,_0x114ec0[_0xaefd('0x3f')]);var _0x145e9e={'where':_0x4c0898[_0xaefd('0x3a')]};return db[_0xaefd('0x40')]['count'](_0x145e9e)[_0xaefd('0x25')](function(_0x3296ac){_0x5c573b['count']=_0x3296ac;if(_0x114ec0[_0xaefd('0x30')][_0xaefd('0x41')]){_0x4c0898[_0xaefd('0x42')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x4c0898);})[_0xaefd('0x25')](function(_0x3d0abf){_0x5c573b[_0xaefd('0x43')]=_0x3d0abf;return _0x5c573b;})[_0xaefd('0x25')](respondWithFilteredResult(_0x36b6b7,_0x4c0898))[_0xaefd('0x44')](handleError(_0x36b6b7,null));};exports[_0xaefd('0x45')]=function(_0x2e17b5,_0x2e98aa){var _0x48a7af={'raw':![],'where':{'id':_0x2e17b5[_0xaefd('0x46')]['id']}},_0x26587e={};_0x26587e[_0xaefd('0x2d')]=_[_0xaefd('0x2f')](db[_0xaefd('0x40')][_0xaefd('0x2c')]);_0x26587e[_0xaefd('0x30')]=_[_0xaefd('0x2f')](_0x2e17b5['query']);_0x26587e['filters']=_[_0xaefd('0x32')](_0x26587e[_0xaefd('0x2d')],_0x26587e['query']);_0x48a7af['attributes']=_[_0xaefd('0x32')](_0x26587e[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x2e17b5[_0xaefd('0x30')][_0xaefd('0x34')]));_0x48a7af[_0xaefd('0x33')]=_0x48a7af[_0xaefd('0x33')][_0xaefd('0x35')]?_0x48a7af[_0xaefd('0x33')]:_0x26587e['model'];if(_0x2e17b5[_0xaefd('0x30')][_0xaefd('0x41')]){_0x48a7af[_0xaefd('0x42')]=[{'all':!![]}];}_0x48a7af=_[_0xaefd('0x3d')]({},_0x48a7af,_0x2e17b5[_0xaefd('0x3f')]);return db[_0xaefd('0x40')][_0xaefd('0x47')](_0x48a7af)['then'](handleEntityNotFound(_0x2e98aa,null))[_0xaefd('0x25')](respondWithResult(_0x2e98aa,null))['catch'](handleError(_0x2e98aa,null));};exports[_0xaefd('0x48')]=function(_0x374845,_0x16c664){return db[_0xaefd('0x40')]['create'](_0x374845['body'],{})[_0xaefd('0x25')](respondWithResult(_0x16c664,0xc9))[_0xaefd('0x44')](handleError(_0x16c664,null));};exports[_0xaefd('0x24')]=function(_0x4eeb56,_0x2a836a){if(_0x4eeb56[_0xaefd('0x49')]['id']){delete _0x4eeb56['body']['id'];}return db[_0xaefd('0x40')][_0xaefd('0x47')]({'where':{'id':_0x4eeb56[_0xaefd('0x46')]['id']}})[_0xaefd('0x25')](handleEntityNotFound(_0x2a836a,null))[_0xaefd('0x25')](saveUpdates(_0x4eeb56[_0xaefd('0x49')],null))[_0xaefd('0x25')](respondWithResult(_0x2a836a,null))[_0xaefd('0x44')](handleError(_0x2a836a,null));};exports['destroy']=function(_0x567ceb,_0x1406b8){return db[_0xaefd('0x40')]['find']({'where':{'id':_0x567ceb[_0xaefd('0x46')]['id']}})['then'](handleEntityNotFound(_0x1406b8,null))[_0xaefd('0x25')](removeEntity(_0x1406b8,null))[_0xaefd('0x44')](handleError(_0x1406b8,null));};exports[_0xaefd('0x4a')]=function(_0x69185e,_0x27fd3f,_0xf727cd){var _0x4b709a={};var _0x56e180={};var _0x1fd0b0;var _0x338823;return db['ZendeskAccount'][_0xaefd('0x4b')]({'where':{'id':_0x69185e[_0xaefd('0x46')]['id']}})[_0xaefd('0x25')](handleEntityNotFound(_0x27fd3f,null))[_0xaefd('0x25')](function(_0x4a883b){if(_0x4a883b){_0x1fd0b0=_0x4a883b;_0x56e180['model']=_[_0xaefd('0x2f')](db[_0xaefd('0x4c')][_0xaefd('0x2c')]);_0x56e180[_0xaefd('0x30')]=_[_0xaefd('0x2f')](_0x69185e['query']);_0x56e180[_0xaefd('0x31')]=_[_0xaefd('0x32')](_0x56e180['model'],_0x56e180[_0xaefd('0x30')]);_0x4b709a[_0xaefd('0x33')]=_['intersection'](_0x56e180[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x69185e[_0xaefd('0x30')]['fields']));_0x4b709a[_0xaefd('0x33')]=_0x4b709a[_0xaefd('0x33')]['length']?_0x4b709a[_0xaefd('0x33')]:_0x56e180[_0xaefd('0x2d')];_0x4b709a[_0xaefd('0x38')]=qs[_0xaefd('0x39')](_0x69185e['query']['sort']);_0x4b709a[_0xaefd('0x3a')]=qs[_0xaefd('0x31')](_[_0xaefd('0x3b')](_0x69185e[_0xaefd('0x30')],_0x56e180[_0xaefd('0x31')]));if(_0x69185e[_0xaefd('0x30')][_0xaefd('0x3c')]){_0x4b709a[_0xaefd('0x3a')]=_[_0xaefd('0x3d')](_0x4b709a[_0xaefd('0x3a')],{'$or':_['map'](_0x4b709a['attributes'],function(_0x324eb4){var _0x431c1a={};_0x431c1a[_0x324eb4]={'$like':'%'+_0x69185e[_0xaefd('0x30')][_0xaefd('0x3c')]+'%'};return _0x431c1a;})});}_0x4b709a=_['merge']({},_0x4b709a,_0x69185e[_0xaefd('0x3f')]);return _0x1fd0b0[_0xaefd('0x4a')](_0x4b709a);}})[_0xaefd('0x25')](function(_0x1ad04e){if(_0x1ad04e){_0x338823=_0x1ad04e[_0xaefd('0x35')];if(!_0x69185e[_0xaefd('0x30')][_0xaefd('0x36')](_0xaefd('0x37'))){_0x4b709a['limit']=qs[_0xaefd('0x1f')](_0x69185e[_0xaefd('0x30')][_0xaefd('0x1f')]);_0x4b709a[_0xaefd('0x1c')]=qs['offset'](_0x69185e[_0xaefd('0x30')]['offset']);}return _0x1fd0b0[_0xaefd('0x4a')](_0x4b709a);}})[_0xaefd('0x25')](function(_0x516913){if(_0x516913){return _0x516913?{'count':_0x338823,'rows':_0x516913}:null;}})['then'](respondWithResult(_0x27fd3f,null))[_0xaefd('0x44')](handleError(_0x27fd3f,null));};exports['addConfiguration']=function(_0x5e0068,_0x4e75bc,_0xe2397c){if(_0x5e0068[_0xaefd('0x49')]['id']){delete _0x5e0068[_0xaefd('0x49')]['id'];}return db[_0xaefd('0x40')][_0xaefd('0x4b')]({'where':{'id':_0x5e0068[_0xaefd('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e75bc,null))['then'](function(_0x4f8e16){if(_0x4f8e16){_0x5e0068['body'][_0xaefd('0x4d')]=_0x4f8e16['id'];_0x5e0068['body'][_0xaefd('0x4e')]=integrations['getSubjects'](_0x5e0068[_0xaefd('0x49')][_0xaefd('0x4f')],_0x5e0068[_0xaefd('0x49')][_0xaefd('0x50')]);_0x5e0068[_0xaefd('0x49')][_0xaefd('0x51')]=integrations[_0xaefd('0x52')](_0x5e0068['body'][_0xaefd('0x4f')],_0x5e0068[_0xaefd('0x49')][_0xaefd('0x50')]);return db[_0xaefd('0x4c')]['create'](_0x5e0068[_0xaefd('0x49')],{'include':[{'model':db['ZendeskField'],'as':_0xaefd('0x4e')},{'model':db[_0xaefd('0x53')],'as':_0xaefd('0x51')}]});}return null;})[_0xaefd('0x25')](respondWithResult(_0x4e75bc,null))[_0xaefd('0x44')](handleError(_0x4e75bc,null));};exports[_0xaefd('0x54')]=function(_0x57776e,_0x1a6195,_0x3b39db){var _0x4a9fa5='';return db[_0xaefd('0x40')][_0xaefd('0x4b')]({'where':{'id':_0x57776e['params']['id']},'attributes':['id',_0xaefd('0x55'),_0xaefd('0x56'),_0xaefd('0x57'),_0xaefd('0x58'),_0xaefd('0x59')]})[_0xaefd('0x25')](handleEntityNotFound(_0x1a6195,null))[_0xaefd('0x25')](function(_0x6f99b0){if(_0x6f99b0){_0x4a9fa5=_0x6f99b0[_0xaefd('0x59')];var _0x1ec9be=_0x4a9fa5[_0xaefd('0x5a')](-0x1);if(_0x1ec9be==='/'){_0x4a9fa5=_0x4a9fa5[_0xaefd('0x5b')](0x0,_0x4a9fa5[_0xaefd('0x5c')](_0x1ec9be));}var _0x43338b={'method':_0xaefd('0x5d'),'uri':util[_0xaefd('0x5e')](_0xaefd('0x5f'),_0x4a9fa5,'ticket_fields'),'json':!![]};switch(_0x6f99b0[_0xaefd('0x58')]){case _0xaefd('0x56'):_0x43338b[_0xaefd('0x60')]={'Authorization':util['format'](_0xaefd('0x61'),new Buffer(util[_0xaefd('0x5e')](_0xaefd('0x62'),_0x6f99b0[_0xaefd('0x55')],_0x6f99b0['password']))[_0xaefd('0x63')]('base64'))};break;case _0xaefd('0x57'):_0x43338b['headers']={'Authorization':util[_0xaefd('0x5e')](_0xaefd('0x61'),new Buffer(util[_0xaefd('0x5e')]('%s/token:%s',_0x6f99b0['username'],_0x6f99b0[_0xaefd('0x57')]))[_0xaefd('0x63')](_0xaefd('0x64')))};break;default:throw new db[(_0xaefd('0x65'))][(_0xaefd('0x66'))](_0xaefd('0x67'));}return rp(_0x43338b);}})['then'](function(_0x499d7d){if(_0x499d7d){var _0x58c97c=['subject','description',_0xaefd('0x68'),_0xaefd('0x69')];_[_0xaefd('0x6a')](_0x499d7d[_0xaefd('0x6b')],function(_0x5ae635){return _0x58c97c[_0xaefd('0x6c')](_0x5ae635[_0xaefd('0x50')]);});return{'count':_0x499d7d['ticket_fields'][_0xaefd('0x35')],'rows':_['map'](_0x499d7d[_0xaefd('0x6b')],function(_0x51b6f1){return{'id':_0x51b6f1['id'],'name':_0x51b6f1[_0xaefd('0x6d')]>0x7?_0x51b6f1['title']:_0x51b6f1[_0xaefd('0x50')],'custom':_0x51b6f1['position']>0x7?!![]:![],'options':_0x51b6f1[_0xaefd('0x6e')]?_0x51b6f1[_0xaefd('0x6e')]:_0x51b6f1['custom_field_options']?_0x51b6f1[_0xaefd('0x6f')]:[]};})};}})[_0xaefd('0x25')](respondWithResult(_0x1a6195,null))[_0xaefd('0x44')](function(_0x564c89){var _0x42c55c=_0x57776e[_0xaefd('0x30')][_0xaefd('0x70')]?0x1f4:_0x564c89[_0xaefd('0x71')]||0x1f4;logger[_0xaefd('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xaefd('0x54'),_0x42c55c,JSON[_0xaefd('0x72')](_0x564c89));delete _0x564c89['name'];if(_0x42c55c===0x191){_0x42c55c=0x190;}_0x1a6195[_0xaefd('0x19')](_0x42c55c)[_0xaefd('0x73')](_0x57776e[_0xaefd('0x30')][_0xaefd('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x564c89[_0xaefd('0x71')]}:_0x564c89);});}; \ No newline at end of file +var _0xbc9d=['merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','find','create','update','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','getSubjects','channel','ZendeskField','Subjects','Descriptions','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','stack','send','index','ZendeskAccount','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick'];(function(_0x1c6efd,_0xb2f3cd){var _0x53a918=function(_0x14c19b){while(--_0x14c19b){_0x1c6efd['push'](_0x1c6efd['shift']());}};_0x53a918(++_0xb2f3cd);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x22da61,_0x237ba9){_0x22da61=_0x22da61-0x0;var _0x40b728=_0xbc9d[_0x22da61];return _0x40b728;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];var integrations=require(_0xdbc9('0x19'));function respondWithStatusCode(_0x48bc83,_0x567e71){_0x567e71=_0x567e71||0xcc;return function(_0x3d0fdd){if(_0x3d0fdd){return _0x48bc83[_0xdbc9('0x1a')](_0x567e71);}return _0x48bc83[_0xdbc9('0x1b')](_0x567e71)[_0xdbc9('0x1c')]();};}function respondWithResult(_0x53495d,_0x4a9dcb){_0x4a9dcb=_0x4a9dcb||0xc8;return function(_0x2b7bd){if(_0x2b7bd){return _0x53495d[_0xdbc9('0x1b')](_0x4a9dcb)[_0xdbc9('0x1d')](_0x2b7bd);}};}function respondWithFilteredResult(_0x4c7b4f,_0x1b4616){return function(_0x1abee8){if(_0x1abee8){var _0x4fdb81=typeof _0x1b4616[_0xdbc9('0x1e')]===_0xdbc9('0x1f')&&typeof _0x1b4616[_0xdbc9('0x20')]===_0xdbc9('0x1f');var _0x1f22f4=_0x1abee8[_0xdbc9('0x21')];var _0x9f343d=_0x4fdb81?0x0:_0x1b4616[_0xdbc9('0x1e')];var _0x2ad952=_0x4fdb81?_0x1abee8[_0xdbc9('0x21')]:_0x1b4616['offset']+_0x1b4616[_0xdbc9('0x20')];var _0x497be2;if(_0x2ad952>=_0x1f22f4){_0x2ad952=_0x1f22f4;_0x497be2=0xc8;}else{_0x497be2=0xce;}_0x4c7b4f[_0xdbc9('0x1b')](_0x497be2);return _0x4c7b4f[_0xdbc9('0x22')]('Content-Range',_0x9f343d+'-'+_0x2ad952+'/'+_0x1f22f4)[_0xdbc9('0x1d')](_0x1abee8);}return null;};}function patchUpdates(_0x5367dc){return function(_0x569f32){try{jsonpatch['apply'](_0x569f32,_0x5367dc,!![]);}catch(_0x4f3b5d){return BPromise[_0xdbc9('0x23')](_0x4f3b5d);}return _0x569f32[_0xdbc9('0x24')]();};}function saveUpdates(_0x570ad9,_0x16dcf7){return function(_0x20563e){if(_0x20563e){return _0x20563e['update'](_0x570ad9)[_0xdbc9('0x25')](function(_0x6b788){return _0x6b788;});}return null;};}function removeEntity(_0x1b1c0d,_0x119230){return function(_0x3400e7){if(_0x3400e7){return _0x3400e7[_0xdbc9('0x26')]()[_0xdbc9('0x25')](function(){_0x1b1c0d[_0xdbc9('0x1b')](0xcc)[_0xdbc9('0x1c')]();});}};}function handleEntityNotFound(_0x4a868b,_0x550bef){return function(_0xe309ae){if(!_0xe309ae){_0x4a868b[_0xdbc9('0x1a')](0x194);}return _0xe309ae;};}function handleError(_0x1053ca,_0x24fdec){_0x24fdec=_0x24fdec||0x1f4;return function(_0x50c3ee){logger[_0xdbc9('0x27')](_0x50c3ee[_0xdbc9('0x28')]);if(_0x50c3ee['name']){delete _0x50c3ee['name'];}_0x1053ca[_0xdbc9('0x1b')](_0x24fdec)[_0xdbc9('0x29')](_0x50c3ee);};}exports[_0xdbc9('0x2a')]=function(_0x59bfd2,_0x13a432){var _0x539e57={},_0x561f8e={},_0x210a40={'count':0x0,'rows':[]};var _0x49da36=_['map'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')],function(_0x1cb557){return{'name':_0x1cb557['fieldName'],'type':_0x1cb557[_0xdbc9('0x2d')][_0xdbc9('0x2e')]};});_0x561f8e['model']=_['map'](_0x49da36,_0xdbc9('0x2f'));_0x561f8e[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x59bfd2[_0xdbc9('0x30')]);_0x561f8e[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],_0x561f8e['query']);_0x539e57[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],qs[_0xdbc9('0x36')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x539e57['attributes']=_0x539e57[_0xdbc9('0x35')]['length']?_0x539e57['attributes']:_0x561f8e['model'];if(!_0x59bfd2['query']['hasOwnProperty'](_0xdbc9('0x37'))){_0x539e57[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x59bfd2['query'][_0xdbc9('0x20')]);_0x539e57[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x1e')]);}_0x539e57[_0xdbc9('0x38')]=qs['sort'](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x39')]);_0x539e57[_0xdbc9('0x3a')]=qs['filters'](_[_0xdbc9('0x3b')](_0x59bfd2[_0xdbc9('0x30')],_0x561f8e[_0xdbc9('0x32')]),_0x49da36);if(_0x59bfd2[_0xdbc9('0x30')]['filter']){_0x539e57['where']=_[_0xdbc9('0x3c')](_0x539e57[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x49da36,function(_0x1ef970){if(_0x1ef970['type']!==_0xdbc9('0x3e')){var _0x3827be={};_0x3827be[_0x1ef970[_0xdbc9('0x2f')]]={'$like':'%'+_0x59bfd2['query'][_0xdbc9('0x3f')]+'%'};return _0x3827be;}})});}_0x539e57=_[_0xdbc9('0x3c')]({},_0x539e57,_0x59bfd2[_0xdbc9('0x40')]);var _0x523c79={'where':_0x539e57[_0xdbc9('0x3a')]};return db[_0xdbc9('0x2b')]['count'](_0x523c79)['then'](function(_0xfc34d5){_0x210a40[_0xdbc9('0x21')]=_0xfc34d5;if(_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x41')]){_0x539e57['include']=[{'all':!![]}];}return db[_0xdbc9('0x2b')][_0xdbc9('0x42')](_0x539e57);})['then'](function(_0x8445b8){_0x210a40[_0xdbc9('0x43')]=_0x8445b8;return _0x210a40;})['then'](respondWithFilteredResult(_0x13a432,_0x539e57))[_0xdbc9('0x44')](handleError(_0x13a432,null));};exports[_0xdbc9('0x45')]=function(_0x2adb23,_0x3415c3){var _0x3ed4de={'raw':![],'where':{'id':_0x2adb23[_0xdbc9('0x46')]['id']}},_0x1cd538={};_0x1cd538['model']=_['keys'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')]);_0x1cd538[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x2adb23[_0xdbc9('0x30')]);_0x1cd538[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x1cd538[_0xdbc9('0x34')],_0x1cd538[_0xdbc9('0x30')]);_0x3ed4de[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x1cd538['model'],qs['fields'](_0x2adb23[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x3ed4de[_0xdbc9('0x35')]=_0x3ed4de[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x3ed4de[_0xdbc9('0x35')]:_0x1cd538[_0xdbc9('0x34')];if(_0x2adb23[_0xdbc9('0x30')]['includeAll']){_0x3ed4de['include']=[{'all':!![]}];}_0x3ed4de=_[_0xdbc9('0x3c')]({},_0x3ed4de,_0x2adb23[_0xdbc9('0x40')]);return db[_0xdbc9('0x2b')][_0xdbc9('0x48')](_0x3ed4de)[_0xdbc9('0x25')](handleEntityNotFound(_0x3415c3,null))[_0xdbc9('0x25')](respondWithResult(_0x3415c3,null))[_0xdbc9('0x44')](handleError(_0x3415c3,null));};exports[_0xdbc9('0x49')]=function(_0x43e3ec,_0x589557){return db[_0xdbc9('0x2b')][_0xdbc9('0x49')](_0x43e3ec['body'],{})['then'](respondWithResult(_0x589557,0xc9))[_0xdbc9('0x44')](handleError(_0x589557,null));};exports[_0xdbc9('0x4a')]=function(_0x133a13,_0x49a55c){if(_0x133a13[_0xdbc9('0x4b')]['id']){delete _0x133a13[_0xdbc9('0x4b')]['id'];}return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x133a13['params']['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x49a55c,null))[_0xdbc9('0x25')](saveUpdates(_0x133a13[_0xdbc9('0x4b')],null))[_0xdbc9('0x25')](respondWithResult(_0x49a55c,null))['catch'](handleError(_0x49a55c,null));};exports[_0xdbc9('0x26')]=function(_0x36c70e,_0x3f49b7){return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x36c70e[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3f49b7,null))[_0xdbc9('0x25')](removeEntity(_0x3f49b7,null))['catch'](handleError(_0x3f49b7,null));};exports[_0xdbc9('0x4c')]=function(_0x4d09e1,_0x3f493e,_0x4279bc){var _0x53771a={};var _0x561737={};var _0xc7335d;var _0x4b55df;return db[_0xdbc9('0x2b')][_0xdbc9('0x4d')]({'where':{'id':_0x4d09e1[_0xdbc9('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f493e,null))[_0xdbc9('0x25')](function(_0x1c52e6){if(_0x1c52e6){_0xc7335d=_0x1c52e6;_0x561737[_0xdbc9('0x34')]=_[_0xdbc9('0x31')](db[_0xdbc9('0x4e')][_0xdbc9('0x2c')]);_0x561737[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x4d09e1['query']);_0x561737['filters']=_['intersection'](_0x561737[_0xdbc9('0x34')],_0x561737[_0xdbc9('0x30')]);_0x53771a[_0xdbc9('0x35')]=_['intersection'](_0x561737['model'],qs[_0xdbc9('0x36')](_0x4d09e1[_0xdbc9('0x30')]['fields']));_0x53771a['attributes']=_0x53771a[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x53771a[_0xdbc9('0x35')]:_0x561737[_0xdbc9('0x34')];_0x53771a[_0xdbc9('0x38')]=qs[_0xdbc9('0x39')](_0x4d09e1['query'][_0xdbc9('0x39')]);_0x53771a[_0xdbc9('0x3a')]=qs[_0xdbc9('0x32')](_['pick'](_0x4d09e1[_0xdbc9('0x30')],_0x561737[_0xdbc9('0x32')]));if(_0x4d09e1[_0xdbc9('0x30')]['filter']){_0x53771a[_0xdbc9('0x3a')]=_['merge'](_0x53771a[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x53771a[_0xdbc9('0x35')],function(_0x26ed1c){var _0x148061={};_0x148061[_0x26ed1c]={'$like':'%'+_0x4d09e1[_0xdbc9('0x30')]['filter']+'%'};return _0x148061;})});}_0x53771a=_[_0xdbc9('0x3c')]({},_0x53771a,_0x4d09e1['options']);return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})[_0xdbc9('0x25')](function(_0x53fcd6){if(_0x53fcd6){_0x4b55df=_0x53fcd6[_0xdbc9('0x47')];if(!_0x4d09e1[_0xdbc9('0x30')]['hasOwnProperty']('nolimit')){_0x53771a[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x4d09e1[_0xdbc9('0x30')]['limit']);_0x53771a[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x4d09e1['query'][_0xdbc9('0x1e')]);}return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})['then'](function(_0x4876f9){if(_0x4876f9){return _0x4876f9?{'count':_0x4b55df,'rows':_0x4876f9}:null;}})[_0xdbc9('0x25')](respondWithResult(_0x3f493e,null))[_0xdbc9('0x44')](handleError(_0x3f493e,null));};exports[_0xdbc9('0x4f')]=function(_0xa8b4d9,_0x3e93d3,_0x14cbf4){if(_0xa8b4d9[_0xdbc9('0x4b')]['id']){delete _0xa8b4d9[_0xdbc9('0x4b')]['id'];}return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0xa8b4d9[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3e93d3,null))[_0xdbc9('0x25')](function(_0x38f7da){if(_0x38f7da){_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x50')]=_0x38f7da['id'];_0xa8b4d9[_0xdbc9('0x4b')]['Subjects']=integrations[_0xdbc9('0x51')](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9['body'][_0xdbc9('0x2d')]);_0xa8b4d9[_0xdbc9('0x4b')]['Descriptions']=integrations['getDescriptions'](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x2d')]);return db['ZendeskConfiguration'][_0xdbc9('0x49')](_0xa8b4d9[_0xdbc9('0x4b')],{'include':[{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x54')},{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x55')}]});}return null;})[_0xdbc9('0x25')](respondWithResult(_0x3e93d3,null))[_0xdbc9('0x44')](handleError(_0x3e93d3,null));};exports[_0xdbc9('0x56')]=function(_0x5e6522,_0x2787d9,_0x2c3223){var _0x511778='';return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0x5e6522[_0xdbc9('0x46')]['id']},'attributes':['id',_0xdbc9('0x57'),_0xdbc9('0x58'),_0xdbc9('0x59'),_0xdbc9('0x5a'),_0xdbc9('0x5b')]})['then'](handleEntityNotFound(_0x2787d9,null))[_0xdbc9('0x25')](function(_0x19af46){if(_0x19af46){_0x511778=_0x19af46[_0xdbc9('0x5b')];var _0x4a412e=_0x511778[_0xdbc9('0x5c')](-0x1);if(_0x4a412e==='/'){_0x511778=_0x511778[_0xdbc9('0x5d')](0x0,_0x511778[_0xdbc9('0x5e')](_0x4a412e));}var _0x2b4905={'method':_0xdbc9('0x5f'),'uri':util[_0xdbc9('0x60')](_0xdbc9('0x61'),_0x511778,_0xdbc9('0x62')),'json':!![]};switch(_0x19af46[_0xdbc9('0x5a')]){case _0xdbc9('0x58'):_0x2b4905[_0xdbc9('0x63')]={'Authorization':util[_0xdbc9('0x60')]('Basic\x20%s',new Buffer(util['format'](_0xdbc9('0x64'),_0x19af46['username'],_0x19af46['password']))[_0xdbc9('0x65')](_0xdbc9('0x66')))};break;case _0xdbc9('0x59'):_0x2b4905['headers']={'Authorization':util[_0xdbc9('0x60')](_0xdbc9('0x67'),new Buffer(util[_0xdbc9('0x60')]('%s/token:%s',_0x19af46[_0xdbc9('0x57')],_0x19af46[_0xdbc9('0x59')]))['toString'](_0xdbc9('0x66')))};break;default:throw new db[(_0xdbc9('0x68'))][(_0xdbc9('0x69'))](_0xdbc9('0x6a'));}return rp(_0x2b4905);}})[_0xdbc9('0x25')](function(_0x501754){if(_0x501754){var _0x4f984b=[_0xdbc9('0x6b'),_0xdbc9('0x6c'),'group',_0xdbc9('0x6d')];_[_0xdbc9('0x6e')](_0x501754[_0xdbc9('0x62')],function(_0x5802fc){return _0x4f984b[_0xdbc9('0x6f')](_0x5802fc[_0xdbc9('0x2d')]);});return{'count':_0x501754[_0xdbc9('0x62')][_0xdbc9('0x47')],'rows':_[_0xdbc9('0x3d')](_0x501754[_0xdbc9('0x62')],function(_0x1b053a){return{'id':_0x1b053a['id'],'name':_0x1b053a[_0xdbc9('0x70')]>0x7?_0x1b053a['title']:_0x1b053a[_0xdbc9('0x2d')],'custom':_0x1b053a[_0xdbc9('0x70')]>0x7?!![]:![],'options':_0x1b053a[_0xdbc9('0x71')]?_0x1b053a[_0xdbc9('0x71')]:_0x1b053a['custom_field_options']?_0x1b053a[_0xdbc9('0x72')]:[]};})};}})['then'](respondWithResult(_0x2787d9,null))['catch'](function(_0x34ebeb){var _0x3400d0=_0x5e6522['query'][_0xdbc9('0x73')]?0x1f4:_0x34ebeb[_0xdbc9('0x74')]||0x1f4;logger[_0xdbc9('0x27')](_0xdbc9('0x75'),_0xdbc9('0x56'),_0x3400d0,JSON[_0xdbc9('0x76')](_0x34ebeb));delete _0x34ebeb[_0xdbc9('0x2f')];if(_0x3400d0===0x191){_0x3400d0=0x190;}_0x2787d9['status'](_0x3400d0)['send'](_0x5e6522[_0xdbc9('0x30')][_0xdbc9('0x73')]?{'message':_0xdbc9('0x77'),'statusCode':_0x34ebeb['statusCode']}:_0x34ebeb);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index a9ce456..5eb0269 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 _0xa44c=['ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','../../components/integrations/configuration','define'];(function(_0x40ccd5,_0x249280){var _0x6efa33=function(_0x3c2c61){while(--_0x3c2c61){_0x40ccd5['push'](_0x40ccd5['shift']());}};_0x6efa33(++_0x249280);}(_0xa44c,0xb2));var _0xca44=function(_0x59551d,_0x735d6e){_0x59551d=_0x59551d-0x0;var _0x26728b=_0xa44c[_0x59551d];return _0x26728b;};'use strict';var _=require(_0xca44('0x0'));var util=require(_0xca44('0x1'));var logger=require(_0xca44('0x2'))(_0xca44('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xca44('0x4'));var fs=require('fs');var path=require(_0xca44('0x5'));var rimraf=require('rimraf');var config=require(_0xca44('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xca44('0x7'));module['exports']=function(_0x5a420b,_0x5e0702){return _0x5a420b[_0xca44('0x8')](_0xca44('0x9'),attributes,{'tableName':_0xca44('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x270f=['request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','util','../../config/logger','api','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x270f,0x1cf));var _0xf270=function(_0x403f5f,_0x283f67){_0x403f5f=_0x403f5f-0x0;var _0x15b1cd=_0x270f[_0x403f5f];return _0x15b1cd;};'use strict';var _=require('lodash');var util=require(_0xf270('0x0'));var logger=require(_0xf270('0x1'))(_0xf270('0x2'));var moment=require(_0xf270('0x3'));var BPromise=require(_0xf270('0x4'));var rp=require(_0xf270('0x5'));var fs=require('fs');var path=require(_0xf270('0x6'));var rimraf=require(_0xf270('0x7'));var config=require(_0xf270('0x8'));var attributes=require(_0xf270('0x9'));var integrations=require(_0xf270('0xa'));module[_0xf270('0xb')]=function(_0x81514d,_0x203ee8){return _0x81514d['define'](_0xf270('0xc'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index a98f073..5510db2 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 _0xc15b=['debug','stringify','ShowZendeskAccount','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xc15b,0xe4));var _0xbc15=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0xc15b[_0x4b91c4];return _0x25cb80;};'use strict';var _=require(_0xbc15('0x0'));var util=require('util');var moment=require(_0xbc15('0x1'));var BPromise=require(_0xbc15('0x2'));var rs=require(_0xbc15('0x3'));var fs=require('fs');var Redis=require(_0xbc15('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbc15('0x5'))(_0xbc15('0x6'));var config=require(_0xbc15('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1231f0,_0x22576c,_0x3cb4b5){return new BPromise(function(_0x50a276,_0x5c6269){return client['request'](_0x1231f0,_0x3cb4b5)[_0xbc15('0x8')](function(_0x571348){logger[_0xbc15('0x9')](_0xbc15('0xa'),_0x22576c,_0xbc15('0xb'));logger['debug'](_0xbc15('0xc'),_0x22576c,_0xbc15('0xb'),JSON['stringify'](_0x571348));if(_0x571348[_0xbc15('0xd')]){if(_0x571348[_0xbc15('0xd')][_0xbc15('0xe')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x22576c,_0x571348['error'][_0xbc15('0xf')]);return _0x5c6269(_0x571348[_0xbc15('0xd')][_0xbc15('0xf')]);}logger[_0xbc15('0xd')](_0xbc15('0xa'),_0x22576c,_0x571348[_0xbc15('0xd')][_0xbc15('0xf')]);return _0x50a276(_0x571348[_0xbc15('0xd')][_0xbc15('0xf')]);}else{logger[_0xbc15('0x9')](_0xbc15('0xa'),_0x22576c,_0xbc15('0xb'));_0x50a276(_0x571348[_0xbc15('0x10')][_0xbc15('0xf')]);}})['catch'](function(_0x41a3e9){logger['error'](_0xbc15('0xa'),_0x22576c,_0x41a3e9);_0x5c6269(_0x41a3e9);});});}exports[_0xbc15('0x11')]=function(_0xa29e5f){var _0xc37530=this;return new Promise(function(_0x38a6b5,_0x3fa2b1){return db[_0xbc15('0x12')][_0xbc15('0x13')]({'raw':_0xa29e5f[_0xbc15('0x14')]?_0xa29e5f[_0xbc15('0x14')][_0xbc15('0x15')]===undefined?!![]:![]:!![],'where':_0xa29e5f[_0xbc15('0x14')]?_0xa29e5f['options'][_0xbc15('0x16')]||null:null,'attributes':_0xa29e5f[_0xbc15('0x14')]?_0xa29e5f['options'][_0xbc15('0x17')]||null:null,'limit':_0xa29e5f[_0xbc15('0x14')]?_0xa29e5f[_0xbc15('0x14')][_0xbc15('0x18')]||null:null,'include':_0xa29e5f[_0xbc15('0x14')]?_0xa29e5f[_0xbc15('0x14')][_0xbc15('0x19')]?_[_0xbc15('0x1a')](_0xa29e5f['options'][_0xbc15('0x19')],function(_0x128ce2){return{'model':db[_0x128ce2[_0xbc15('0x1b')]],'as':_0x128ce2['as'],'attributes':_0x128ce2['attributes'],'include':_0x128ce2[_0xbc15('0x19')]?_[_0xbc15('0x1a')](_0x128ce2[_0xbc15('0x19')],function(_0x15f6a9){return{'model':db[_0x15f6a9[_0xbc15('0x1b')]],'as':_0x15f6a9['as'],'attributes':_0x15f6a9[_0xbc15('0x17')],'include':_0x15f6a9['include']?_[_0xbc15('0x1a')](_0x15f6a9[_0xbc15('0x19')],function(_0x136852){return{'model':db[_0x136852[_0xbc15('0x1b')]],'as':_0x136852['as'],'attributes':_0x136852[_0xbc15('0x17')]};}):[]};}):[]};}):[]:[]})[_0xbc15('0x8')](function(_0x21284b){logger[_0xbc15('0x9')](_0xbc15('0x11'),_0xa29e5f);logger[_0xbc15('0x1c')](_0xbc15('0x11'),_0xa29e5f,JSON[_0xbc15('0x1d')](_0x21284b));_0x38a6b5(_0x21284b);})['catch'](function(_0x53f5c8){logger['error'](_0xbc15('0x11'),_0x53f5c8[_0xbc15('0xf')],_0xa29e5f);_0x3fa2b1(_0xc37530[_0xbc15('0xd')](0x1f4,_0x53f5c8[_0xbc15('0xf')]));});});};exports[_0xbc15('0x1e')]=function(_0x11dbf7){var _0xa9cf30=this;return new Promise(function(_0x574a36,_0x3d54e8){return db[_0xbc15('0x12')]['find']({'raw':_0x11dbf7[_0xbc15('0x14')]?_0x11dbf7['options'][_0xbc15('0x15')]===undefined?!![]:![]:!![],'where':_0x11dbf7[_0xbc15('0x14')]?_0x11dbf7['options'][_0xbc15('0x16')]||null:null,'attributes':_0x11dbf7['options']?_0x11dbf7[_0xbc15('0x14')]['attributes']||null:null,'include':_0x11dbf7['options']?_0x11dbf7['options'][_0xbc15('0x19')]?_['map'](_0x11dbf7['options'][_0xbc15('0x19')],function(_0x1fb430){return{'model':db[_0x1fb430['model']],'as':_0x1fb430['as'],'attributes':_0x1fb430['attributes'],'include':_0x1fb430['include']?_[_0xbc15('0x1a')](_0x1fb430['include'],function(_0x24ea42){return{'model':db[_0x24ea42[_0xbc15('0x1b')]],'as':_0x24ea42['as'],'attributes':_0x24ea42[_0xbc15('0x17')],'include':_0x24ea42[_0xbc15('0x19')]?_[_0xbc15('0x1a')](_0x24ea42['include'],function(_0x2c9f73){return{'model':db[_0x2c9f73[_0xbc15('0x1b')]],'as':_0x2c9f73['as'],'attributes':_0x2c9f73[_0xbc15('0x17')]};}):[]};}):[]};}):[]:[]})[_0xbc15('0x8')](function(_0x28b281){logger['info'](_0xbc15('0x1e'),_0x11dbf7);logger[_0xbc15('0x1c')](_0xbc15('0x1e'),_0x11dbf7,JSON[_0xbc15('0x1d')](_0x28b281));_0x574a36(_0x28b281);})[_0xbc15('0x1f')](function(_0xf921f2){logger[_0xbc15('0xd')]('ShowZendeskAccount',_0xf921f2['message'],_0x11dbf7);_0x3d54e8(_0xa9cf30['error'](0x1f4,_0xf921f2['message']));});});}; \ No newline at end of file +var _0xb7a7=['info','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','map','include','model','find','raw','ShowZendeskAccount','debug','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','stringify','error','code','message','ZendeskAccount,\x20%s,\x20%s'];(function(_0x44ce1b,_0x240413){var _0x3563af=function(_0x46dfb7){while(--_0x46dfb7){_0x44ce1b['push'](_0x44ce1b['shift']());}};_0x3563af(++_0x240413);}(_0xb7a7,0x98));var _0x7b7a=function(_0x3ac2dc,_0x406fa1){_0x3ac2dc=_0x3ac2dc-0x0;var _0x474721=_0xb7a7[_0x3ac2dc];return _0x474721;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7b7a('0x0'));var BPromise=require(_0x7b7a('0x1'));var rs=require(_0x7b7a('0x2'));var fs=require('fs');var Redis=require(_0x7b7a('0x3'));var db=require(_0x7b7a('0x4'))['db'];var utils=require(_0x7b7a('0x5'));var logger=require(_0x7b7a('0x6'))(_0x7b7a('0x7'));var config=require(_0x7b7a('0x8'));var jayson=require(_0x7b7a('0x9'));var client=jayson['client'][_0x7b7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dd368,_0x270c21,_0x1c21a5){return new BPromise(function(_0x550fdf,_0x4a56b9){return client['request'](_0x2dd368,_0x1c21a5)[_0x7b7a('0xb')](function(_0x544736){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x270c21,_0x7b7a('0xc'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x270c21,_0x7b7a('0xc'),JSON[_0x7b7a('0xd')](_0x544736));if(_0x544736[_0x7b7a('0xe')]){if(_0x544736[_0x7b7a('0xe')][_0x7b7a('0xf')]===0x1f4){logger[_0x7b7a('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x270c21,_0x544736[_0x7b7a('0xe')][_0x7b7a('0x10')]);return _0x4a56b9(_0x544736[_0x7b7a('0xe')]['message']);}logger[_0x7b7a('0xe')](_0x7b7a('0x11'),_0x270c21,_0x544736[_0x7b7a('0xe')][_0x7b7a('0x10')]);return _0x550fdf(_0x544736[_0x7b7a('0xe')]['message']);}else{logger[_0x7b7a('0x12')](_0x7b7a('0x11'),_0x270c21,_0x7b7a('0xc'));_0x550fdf(_0x544736['result'][_0x7b7a('0x10')]);}})['catch'](function(_0x354948){logger[_0x7b7a('0xe')](_0x7b7a('0x11'),_0x270c21,_0x354948);_0x4a56b9(_0x354948);});});}exports[_0x7b7a('0x13')]=function(_0x4fea19){var _0x480c90=this;return new Promise(function(_0x3698e6,_0x553064){return db[_0x7b7a('0x14')][_0x7b7a('0x15')]({'raw':_0x4fea19[_0x7b7a('0x16')]?_0x4fea19['options']['raw']===undefined?!![]:![]:!![],'where':_0x4fea19[_0x7b7a('0x16')]?_0x4fea19[_0x7b7a('0x16')][_0x7b7a('0x17')]||null:null,'attributes':_0x4fea19['options']?_0x4fea19['options'][_0x7b7a('0x18')]||null:null,'limit':_0x4fea19[_0x7b7a('0x16')]?_0x4fea19[_0x7b7a('0x16')][_0x7b7a('0x19')]||null:null,'include':_0x4fea19[_0x7b7a('0x16')]?_0x4fea19[_0x7b7a('0x16')]['include']?_[_0x7b7a('0x1a')](_0x4fea19['options'][_0x7b7a('0x1b')],function(_0x26fe39){return{'model':db[_0x26fe39[_0x7b7a('0x1c')]],'as':_0x26fe39['as'],'attributes':_0x26fe39[_0x7b7a('0x18')],'include':_0x26fe39[_0x7b7a('0x1b')]?_['map'](_0x26fe39[_0x7b7a('0x1b')],function(_0x1ac79f){return{'model':db[_0x1ac79f['model']],'as':_0x1ac79f['as'],'attributes':_0x1ac79f[_0x7b7a('0x18')],'include':_0x1ac79f[_0x7b7a('0x1b')]?_[_0x7b7a('0x1a')](_0x1ac79f[_0x7b7a('0x1b')],function(_0xc8e279){return{'model':db[_0xc8e279[_0x7b7a('0x1c')]],'as':_0xc8e279['as'],'attributes':_0xc8e279[_0x7b7a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7b7a('0xb')](function(_0xb3750){logger[_0x7b7a('0x12')](_0x7b7a('0x13'),_0x4fea19);logger['debug'](_0x7b7a('0x13'),_0x4fea19,JSON[_0x7b7a('0xd')](_0xb3750));_0x3698e6(_0xb3750);})['catch'](function(_0x1c35d3){logger['error'](_0x7b7a('0x13'),_0x1c35d3[_0x7b7a('0x10')],_0x4fea19);_0x553064(_0x480c90[_0x7b7a('0xe')](0x1f4,_0x1c35d3['message']));});});};exports['ShowZendeskAccount']=function(_0x17ba22){var _0x30d675=this;return new Promise(function(_0x27c4e6,_0x1406aa){return db[_0x7b7a('0x14')][_0x7b7a('0x1d')]({'raw':_0x17ba22['options']?_0x17ba22[_0x7b7a('0x16')][_0x7b7a('0x1e')]===undefined?!![]:![]:!![],'where':_0x17ba22[_0x7b7a('0x16')]?_0x17ba22[_0x7b7a('0x16')][_0x7b7a('0x17')]||null:null,'attributes':_0x17ba22['options']?_0x17ba22[_0x7b7a('0x16')][_0x7b7a('0x18')]||null:null,'include':_0x17ba22[_0x7b7a('0x16')]?_0x17ba22[_0x7b7a('0x16')][_0x7b7a('0x1b')]?_[_0x7b7a('0x1a')](_0x17ba22[_0x7b7a('0x16')][_0x7b7a('0x1b')],function(_0x47bc2c){return{'model':db[_0x47bc2c[_0x7b7a('0x1c')]],'as':_0x47bc2c['as'],'attributes':_0x47bc2c['attributes'],'include':_0x47bc2c[_0x7b7a('0x1b')]?_['map'](_0x47bc2c[_0x7b7a('0x1b')],function(_0x11edf7){return{'model':db[_0x11edf7['model']],'as':_0x11edf7['as'],'attributes':_0x11edf7[_0x7b7a('0x18')],'include':_0x11edf7[_0x7b7a('0x1b')]?_[_0x7b7a('0x1a')](_0x11edf7[_0x7b7a('0x1b')],function(_0x3a82e0){return{'model':db[_0x3a82e0['model']],'as':_0x3a82e0['as'],'attributes':_0x3a82e0[_0x7b7a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7b7a('0xb')](function(_0x542be7){logger[_0x7b7a('0x12')](_0x7b7a('0x1f'),_0x17ba22);logger[_0x7b7a('0x20')](_0x7b7a('0x1f'),_0x17ba22,JSON[_0x7b7a('0xd')](_0x542be7));_0x27c4e6(_0x542be7);})[_0x7b7a('0x21')](function(_0x199cb2){logger[_0x7b7a('0xe')](_0x7b7a('0x1f'),_0x199cb2[_0x7b7a('0x10')],_0x17ba22);_0x1406aa(_0x30d675[_0x7b7a('0xe')](0x1f4,_0x199cb2[_0x7b7a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 1477589..8f1265b 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','create','put','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x224247,_0x4b4c99){var _0x578c8c=function(_0xa569b5){while(--_0xa569b5){_0x224247['push'](_0x224247['shift']());}};_0x578c8c(++_0x4b4c99);}(_0xda3f,0xec));var _0xfda3=function(_0x2959a4,_0x41c444){_0x2959a4=_0x2959a4-0x0;var _0x5df094=_0xda3f[_0x2959a4];return _0x5df094;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./intZendeskConfiguration.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0x5')]('/:id/descriptions',auth[_0xfda3('0x6')](),controller[_0xfda3('0xd')]);router[_0xfda3('0x5')](_0xfda3('0xe'),auth[_0xfda3('0x6')](),controller['getTags']);router[_0xfda3('0xf')]('/',auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0xf')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0xfda3('0x11')](_0xfda3('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x12')]);module[_0xfda3('0x13')]=router; \ No newline at end of file +var _0x0abf=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x0abf,0xe8));var _0xf0ab=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0abf[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x7')](_0xf0ab('0xb'),auth['isAuthenticated'](),controller[_0xf0ab('0xc')]);router[_0xf0ab('0x7')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xf0ab('0x7')]('/:id/descriptions',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xe')]);router[_0xf0ab('0x7')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x10')]);router[_0xf0ab('0x11')]('/',auth['isAuthenticated'](),controller[_0xf0ab('0x12')]);router[_0xf0ab('0x11')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x13')]);router[_0xf0ab('0x14')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x16')]);router[_0xf0ab('0x17')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x18')]);module[_0xf0ab('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 84ae39f..3ee850a 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 _0xa617=['exports','STRING'];(function(_0x48db26,_0x51ac82){var _0x2cb310=function(_0x41f248){while(--_0x41f248){_0x48db26['push'](_0x48db26['shift']());}};_0x2cb310(++_0x51ac82);}(_0xa617,0x12c));var _0x7a61=function(_0x339cdd,_0x3a5877){_0x339cdd=_0x339cdd-0x0;var _0x5d2085=_0xa617[_0x339cdd];return _0x5d2085;};'use strict';var Sequelize=require('sequelize');module[_0x7a61('0x0')]={'name':{'type':Sequelize[_0x7a61('0x1')]},'description':{'type':Sequelize[_0x7a61('0x1')]}}; \ No newline at end of file +var _0x3d33=['STRING','sequelize','exports'];(function(_0x427d3a,_0x23724c){var _0xe5c521=function(_0x77b277){while(--_0x77b277){_0x427d3a['push'](_0x427d3a['shift']());}};_0xe5c521(++_0x23724c);}(_0x3d33,0x94));var _0x33d3=function(_0x2929a6,_0x1c6c50){_0x2929a6=_0x2929a6-0x0;var _0x173b09=_0x3d33[_0x2929a6];return _0x173b09;};'use strict';var Sequelize=require(_0x33d3('0x0'));module[_0x33d3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x33d3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index dae053c..40ef377 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 _0x4ea5=['destroy','getFields','findOne','ZendeskField','filter','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','rows','catch','show','params','keys','includeAll','find','create','body'];(function(_0x2d2d6a,_0x29a5b7){var _0x2bf511=function(_0xa60f1e){while(--_0xa60f1e){_0x2d2d6a['push'](_0x2d2d6a['shift']());}};_0x2bf511(++_0x29a5b7);}(_0x4ea5,0x10d));var _0x54ea=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x4ea5[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require(_0x54ea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x54ea('0x1'));var jsonpatch=require(_0x54ea('0x2'));var rp=require(_0x54ea('0x3'));var moment=require(_0x54ea('0x4'));var BPromise=require(_0x54ea('0x5'));var Mustache=require(_0x54ea('0x6'));var util=require(_0x54ea('0x7'));var path=require(_0x54ea('0x8'));var sox=require(_0x54ea('0x9'));var csv=require('to-csv');var ejs=require(_0x54ea('0xa'));var fs=require('fs');var fs_extra=require(_0x54ea('0xb'));var _=require('lodash');var squel=require(_0x54ea('0xc'));var crypto=require(_0x54ea('0xd'));var jsforce=require(_0x54ea('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x54ea('0xf'));var querystring=require(_0x54ea('0x10'));var Papa=require('papaparse');var Redis=require(_0x54ea('0x11'));var authService=require(_0x54ea('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x54ea('0x13'));var hardwareService=require(_0x54ea('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x54ea('0x15'));var config=require(_0x54ea('0x16'));var licenseUtil=require(_0x54ea('0x17'));var db=require(_0x54ea('0x18'))['db'];function respondWithStatusCode(_0x2264ff,_0x56a8c6){_0x56a8c6=_0x56a8c6||0xcc;return function(_0x14ec7d){if(_0x14ec7d){return _0x2264ff['sendStatus'](_0x56a8c6);}return _0x2264ff['status'](_0x56a8c6)[_0x54ea('0x19')]();};}function respondWithResult(_0x291bd5,_0x13265f){_0x13265f=_0x13265f||0xc8;return function(_0x45ad8f){if(_0x45ad8f){return _0x291bd5[_0x54ea('0x1a')](_0x13265f)[_0x54ea('0x1b')](_0x45ad8f);}};}function respondWithFilteredResult(_0x4b0cdb,_0x1ec95b){return function(_0x4ce783){if(_0x4ce783){var _0x1e4dd8=typeof _0x1ec95b['offset']===_0x54ea('0x1c')&&typeof _0x1ec95b[_0x54ea('0x1d')]===_0x54ea('0x1c');var _0x2928b7=_0x4ce783[_0x54ea('0x1e')];var _0x39f318=_0x1e4dd8?0x0:_0x1ec95b[_0x54ea('0x1f')];var _0xfe8c55=_0x1e4dd8?_0x4ce783['count']:_0x1ec95b[_0x54ea('0x1f')]+_0x1ec95b[_0x54ea('0x1d')];var _0x165a14;if(_0xfe8c55>=_0x2928b7){_0xfe8c55=_0x2928b7;_0x165a14=0xc8;}else{_0x165a14=0xce;}_0x4b0cdb['status'](_0x165a14);return _0x4b0cdb[_0x54ea('0x20')]('Content-Range',_0x39f318+'-'+_0xfe8c55+'/'+_0x2928b7)[_0x54ea('0x1b')](_0x4ce783);}return null;};}function patchUpdates(_0x4ce7c7){return function(_0x14a982){try{jsonpatch[_0x54ea('0x21')](_0x14a982,_0x4ce7c7,!![]);}catch(_0x486027){return BPromise[_0x54ea('0x22')](_0x486027);}return _0x14a982[_0x54ea('0x23')]();};}function saveUpdates(_0x38b966,_0x2340de){return function(_0x287f31){if(_0x287f31){return _0x287f31[_0x54ea('0x24')](_0x38b966)[_0x54ea('0x25')](function(_0x4c0fc1){return _0x4c0fc1;});}return null;};}function removeEntity(_0x259195,_0x420d1d){return function(_0x3456e2){if(_0x3456e2){return _0x3456e2['destroy']()[_0x54ea('0x25')](function(){_0x259195['status'](0xcc)[_0x54ea('0x19')]();});}};}function handleEntityNotFound(_0x57cb5c,_0x2f7600){return function(_0x596651){if(!_0x596651){_0x57cb5c[_0x54ea('0x26')](0x194);}return _0x596651;};}function handleError(_0x590283,_0x10f2f3){_0x10f2f3=_0x10f2f3||0x1f4;return function(_0x49cb64){logger[_0x54ea('0x27')](_0x49cb64[_0x54ea('0x28')]);if(_0x49cb64[_0x54ea('0x29')]){delete _0x49cb64['name'];}_0x590283[_0x54ea('0x1a')](_0x10f2f3)[_0x54ea('0x2a')](_0x49cb64);};}exports[_0x54ea('0x2b')]=function(_0x462d7f,_0xa120d8){var _0x25fd94={},_0x10970f={},_0x47ef8e={'count':0x0,'rows':[]};var _0x55a150=_[_0x54ea('0x2c')](db[_0x54ea('0x2d')][_0x54ea('0x2e')],function(_0x3c4fb8){return{'name':_0x3c4fb8[_0x54ea('0x2f')],'type':_0x3c4fb8[_0x54ea('0x30')]['key']};});_0x10970f[_0x54ea('0x31')]=_[_0x54ea('0x2c')](_0x55a150,_0x54ea('0x29'));_0x10970f['query']=_['keys'](_0x462d7f[_0x54ea('0x32')]);_0x10970f[_0x54ea('0x33')]=_[_0x54ea('0x34')](_0x10970f[_0x54ea('0x31')],_0x10970f[_0x54ea('0x32')]);_0x25fd94['attributes']=_[_0x54ea('0x34')](_0x10970f[_0x54ea('0x31')],qs[_0x54ea('0x35')](_0x462d7f[_0x54ea('0x32')]['fields']));_0x25fd94[_0x54ea('0x36')]=_0x25fd94['attributes'][_0x54ea('0x37')]?_0x25fd94[_0x54ea('0x36')]:_0x10970f['model'];if(!_0x462d7f[_0x54ea('0x32')][_0x54ea('0x38')](_0x54ea('0x39'))){_0x25fd94[_0x54ea('0x1d')]=qs['limit'](_0x462d7f['query']['limit']);_0x25fd94[_0x54ea('0x1f')]=qs[_0x54ea('0x1f')](_0x462d7f[_0x54ea('0x32')]['offset']);}_0x25fd94[_0x54ea('0x3a')]=qs[_0x54ea('0x3b')](_0x462d7f['query'][_0x54ea('0x3b')]);_0x25fd94[_0x54ea('0x3c')]=qs['filters'](_[_0x54ea('0x3d')](_0x462d7f['query'],_0x10970f['filters']),_0x55a150);if(_0x462d7f[_0x54ea('0x32')]['filter']){_0x25fd94[_0x54ea('0x3c')]=_[_0x54ea('0x3e')](_0x25fd94['where'],{'$or':_[_0x54ea('0x2c')](_0x55a150,function(_0x332213){if(_0x332213[_0x54ea('0x30')]!==_0x54ea('0x3f')){var _0x300d40={};_0x300d40[_0x332213['name']]={'$like':'%'+_0x462d7f[_0x54ea('0x32')]['filter']+'%'};return _0x300d40;}})});}_0x25fd94=_[_0x54ea('0x3e')]({},_0x25fd94,_0x462d7f[_0x54ea('0x40')]);var _0x565e24={'where':_0x25fd94[_0x54ea('0x3c')]};return db[_0x54ea('0x2d')][_0x54ea('0x1e')](_0x565e24)[_0x54ea('0x25')](function(_0x49f1c5){_0x47ef8e['count']=_0x49f1c5;if(_0x462d7f[_0x54ea('0x32')]['includeAll']){_0x25fd94[_0x54ea('0x41')]=[{'all':!![]}];}return db[_0x54ea('0x2d')]['findAll'](_0x25fd94);})[_0x54ea('0x25')](function(_0x83a9be){_0x47ef8e[_0x54ea('0x42')]=_0x83a9be;return _0x47ef8e;})[_0x54ea('0x25')](respondWithFilteredResult(_0xa120d8,_0x25fd94))[_0x54ea('0x43')](handleError(_0xa120d8,null));};exports[_0x54ea('0x44')]=function(_0x80b475,_0x366e2a){var _0x3094cf={'raw':![],'where':{'id':_0x80b475[_0x54ea('0x45')]['id']}},_0x4f8089={};_0x4f8089[_0x54ea('0x31')]=_['keys'](db['ZendeskConfiguration']['rawAttributes']);_0x4f8089[_0x54ea('0x32')]=_[_0x54ea('0x46')](_0x80b475[_0x54ea('0x32')]);_0x4f8089[_0x54ea('0x33')]=_['intersection'](_0x4f8089['model'],_0x4f8089[_0x54ea('0x32')]);_0x3094cf[_0x54ea('0x36')]=_['intersection'](_0x4f8089['model'],qs[_0x54ea('0x35')](_0x80b475[_0x54ea('0x32')]['fields']));_0x3094cf[_0x54ea('0x36')]=_0x3094cf[_0x54ea('0x36')][_0x54ea('0x37')]?_0x3094cf[_0x54ea('0x36')]:_0x4f8089['model'];if(_0x80b475[_0x54ea('0x32')][_0x54ea('0x47')]){_0x3094cf['include']=[{'all':!![]}];}_0x3094cf=_['merge']({},_0x3094cf,_0x80b475['options']);return db['ZendeskConfiguration'][_0x54ea('0x48')](_0x3094cf)[_0x54ea('0x25')](handleEntityNotFound(_0x366e2a,null))[_0x54ea('0x25')](respondWithResult(_0x366e2a,null))[_0x54ea('0x43')](handleError(_0x366e2a,null));};exports[_0x54ea('0x49')]=function(_0x5e887e,_0xc9e702){return db[_0x54ea('0x2d')][_0x54ea('0x49')](_0x5e887e[_0x54ea('0x4a')],{})[_0x54ea('0x25')](respondWithResult(_0xc9e702,0xc9))[_0x54ea('0x43')](handleError(_0xc9e702,null));};exports[_0x54ea('0x24')]=function(_0x541340,_0x1f8f88){if(_0x541340[_0x54ea('0x4a')]['id']){delete _0x541340[_0x54ea('0x4a')]['id'];}return db[_0x54ea('0x2d')][_0x54ea('0x48')]({'where':{'id':_0x541340[_0x54ea('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f8f88,null))[_0x54ea('0x25')](saveUpdates(_0x541340[_0x54ea('0x4a')],null))[_0x54ea('0x25')](respondWithResult(_0x1f8f88,null))[_0x54ea('0x43')](handleError(_0x1f8f88,null));};exports[_0x54ea('0x4b')]=function(_0x18e449,_0x3ba5a9){return db[_0x54ea('0x2d')][_0x54ea('0x48')]({'where':{'id':_0x18e449[_0x54ea('0x45')]['id']}})[_0x54ea('0x25')](handleEntityNotFound(_0x3ba5a9,null))[_0x54ea('0x25')](removeEntity(_0x3ba5a9,null))['catch'](handleError(_0x3ba5a9,null));};exports[_0x54ea('0x4c')]=function(_0x44b1b6,_0x4e6688,_0x43baed){var _0x8d71af={};var _0x1a5e4a={};var _0x2a231d;var _0x51957b;return db['ZendeskConfiguration'][_0x54ea('0x4d')]({'where':{'id':_0x44b1b6[_0x54ea('0x45')]['id']}})[_0x54ea('0x25')](handleEntityNotFound(_0x4e6688,null))[_0x54ea('0x25')](function(_0x17c7c1){if(_0x17c7c1){_0x2a231d=_0x17c7c1;_0x1a5e4a['model']=_[_0x54ea('0x46')](db[_0x54ea('0x4e')][_0x54ea('0x2e')]);_0x1a5e4a[_0x54ea('0x32')]=_[_0x54ea('0x46')](_0x44b1b6['query']);_0x1a5e4a['filters']=_[_0x54ea('0x34')](_0x1a5e4a[_0x54ea('0x31')],_0x1a5e4a[_0x54ea('0x32')]);_0x8d71af['attributes']=_[_0x54ea('0x34')](_0x1a5e4a[_0x54ea('0x31')],qs['fields'](_0x44b1b6[_0x54ea('0x32')][_0x54ea('0x35')]));_0x8d71af[_0x54ea('0x36')]=_0x8d71af[_0x54ea('0x36')][_0x54ea('0x37')]?_0x8d71af[_0x54ea('0x36')]:_0x1a5e4a['model'];_0x8d71af['order']=qs[_0x54ea('0x3b')](_0x44b1b6[_0x54ea('0x32')][_0x54ea('0x3b')]);_0x8d71af[_0x54ea('0x3c')]=qs['filters'](_['pick'](_0x44b1b6[_0x54ea('0x32')],_0x1a5e4a[_0x54ea('0x33')]));if(_0x44b1b6[_0x54ea('0x32')][_0x54ea('0x4f')]){_0x8d71af['where']=_[_0x54ea('0x3e')](_0x8d71af[_0x54ea('0x3c')],{'$or':_[_0x54ea('0x2c')](_0x8d71af[_0x54ea('0x36')],function(_0x3ae2d8){var _0x1f119c={};_0x1f119c[_0x3ae2d8]={'$like':'%'+_0x44b1b6['query']['filter']+'%'};return _0x1f119c;})});}_0x8d71af=_[_0x54ea('0x3e')]({},_0x8d71af,_0x44b1b6[_0x54ea('0x40')]);return _0x2a231d['getFields'](_0x8d71af);}})[_0x54ea('0x25')](function(_0xc64f36){if(_0xc64f36){_0x51957b=_0xc64f36[_0x54ea('0x37')];if(!_0x44b1b6['query'][_0x54ea('0x38')](_0x54ea('0x39'))){_0x8d71af[_0x54ea('0x1d')]=qs['limit'](_0x44b1b6['query'][_0x54ea('0x1d')]);_0x8d71af['offset']=qs[_0x54ea('0x1f')](_0x44b1b6[_0x54ea('0x32')]['offset']);}return _0x2a231d[_0x54ea('0x4c')](_0x8d71af);}})[_0x54ea('0x25')](function(_0x3b60ae){if(_0x3b60ae){return _0x3b60ae?{'count':_0x51957b,'rows':_0x3b60ae}:null;}})[_0x54ea('0x25')](respondWithResult(_0x4e6688,null))[_0x54ea('0x43')](handleError(_0x4e6688,null));};exports[_0x54ea('0x50')]=function(_0x559e32,_0x5dcec1,_0x2b0413){var _0x4e21c5={};var _0xf9ff90={};var _0x55384d;var _0xa17b5a;return db[_0x54ea('0x2d')][_0x54ea('0x4d')]({'where':{'id':_0x559e32[_0x54ea('0x45')]['id']}})[_0x54ea('0x25')](handleEntityNotFound(_0x5dcec1,null))[_0x54ea('0x25')](function(_0xc42f6){if(_0xc42f6){_0x55384d=_0xc42f6;_0xf9ff90['model']=_[_0x54ea('0x46')](db[_0x54ea('0x4e')]['rawAttributes']);_0xf9ff90[_0x54ea('0x32')]=_['keys'](_0x559e32[_0x54ea('0x32')]);_0xf9ff90[_0x54ea('0x33')]=_[_0x54ea('0x34')](_0xf9ff90[_0x54ea('0x31')],_0xf9ff90[_0x54ea('0x32')]);_0x4e21c5[_0x54ea('0x36')]=_[_0x54ea('0x34')](_0xf9ff90[_0x54ea('0x31')],qs[_0x54ea('0x35')](_0x559e32[_0x54ea('0x32')][_0x54ea('0x35')]));_0x4e21c5['attributes']=_0x4e21c5['attributes'][_0x54ea('0x37')]?_0x4e21c5[_0x54ea('0x36')]:_0xf9ff90['model'];_0x4e21c5[_0x54ea('0x3a')]=qs['sort'](_0x559e32['query'][_0x54ea('0x3b')]);_0x4e21c5['where']=qs[_0x54ea('0x33')](_[_0x54ea('0x3d')](_0x559e32[_0x54ea('0x32')],_0xf9ff90[_0x54ea('0x33')]));if(_0x559e32[_0x54ea('0x32')]['filter']){_0x4e21c5['where']=_[_0x54ea('0x3e')](_0x4e21c5[_0x54ea('0x3c')],{'$or':_[_0x54ea('0x2c')](_0x4e21c5['attributes'],function(_0x58d0d7){var _0x387db0={};_0x387db0[_0x58d0d7]={'$like':'%'+_0x559e32[_0x54ea('0x32')][_0x54ea('0x4f')]+'%'};return _0x387db0;})});}_0x4e21c5=_[_0x54ea('0x3e')]({},_0x4e21c5,_0x559e32[_0x54ea('0x40')]);return _0x55384d[_0x54ea('0x50')](_0x4e21c5);}})[_0x54ea('0x25')](function(_0x50c79d){if(_0x50c79d){_0xa17b5a=_0x50c79d[_0x54ea('0x37')];if(!_0x559e32[_0x54ea('0x32')][_0x54ea('0x38')]('nolimit')){_0x4e21c5['limit']=qs['limit'](_0x559e32[_0x54ea('0x32')][_0x54ea('0x1d')]);_0x4e21c5[_0x54ea('0x1f')]=qs[_0x54ea('0x1f')](_0x559e32['query'][_0x54ea('0x1f')]);}return _0x55384d['getSubjects'](_0x4e21c5);}})[_0x54ea('0x25')](function(_0x408547){if(_0x408547){return _0x408547?{'count':_0xa17b5a,'rows':_0x408547}:null;}})[_0x54ea('0x25')](respondWithResult(_0x5dcec1,null))[_0x54ea('0x43')](handleError(_0x5dcec1,null));};exports[_0x54ea('0x51')]=function(_0x3f9346,_0x209ff1,_0x19149c){var _0x59ca08={};var _0x12f3bc={};var _0x303fbf;var _0x9bd64e;return db[_0x54ea('0x2d')]['findOne']({'where':{'id':_0x3f9346[_0x54ea('0x45')]['id']}})['then'](handleEntityNotFound(_0x209ff1,null))['then'](function(_0x394a73){if(_0x394a73){_0x303fbf=_0x394a73;_0x12f3bc[_0x54ea('0x31')]=_['keys'](db['ZendeskField'][_0x54ea('0x2e')]);_0x12f3bc[_0x54ea('0x32')]=_[_0x54ea('0x46')](_0x3f9346[_0x54ea('0x32')]);_0x12f3bc[_0x54ea('0x33')]=_[_0x54ea('0x34')](_0x12f3bc[_0x54ea('0x31')],_0x12f3bc[_0x54ea('0x32')]);_0x59ca08[_0x54ea('0x36')]=_[_0x54ea('0x34')](_0x12f3bc['model'],qs['fields'](_0x3f9346['query'][_0x54ea('0x35')]));_0x59ca08[_0x54ea('0x36')]=_0x59ca08['attributes']['length']?_0x59ca08[_0x54ea('0x36')]:_0x12f3bc['model'];_0x59ca08['order']=qs[_0x54ea('0x3b')](_0x3f9346['query'][_0x54ea('0x3b')]);_0x59ca08[_0x54ea('0x3c')]=qs[_0x54ea('0x33')](_[_0x54ea('0x3d')](_0x3f9346[_0x54ea('0x32')],_0x12f3bc[_0x54ea('0x33')]));if(_0x3f9346['query'][_0x54ea('0x4f')]){_0x59ca08['where']=_[_0x54ea('0x3e')](_0x59ca08['where'],{'$or':_[_0x54ea('0x2c')](_0x59ca08['attributes'],function(_0x7426bb){var _0x270a4f={};_0x270a4f[_0x7426bb]={'$like':'%'+_0x3f9346[_0x54ea('0x32')]['filter']+'%'};return _0x270a4f;})});}_0x59ca08=_[_0x54ea('0x3e')]({},_0x59ca08,_0x3f9346[_0x54ea('0x40')]);return _0x303fbf[_0x54ea('0x51')](_0x59ca08);}})[_0x54ea('0x25')](function(_0x1a969e){if(_0x1a969e){_0x9bd64e=_0x1a969e[_0x54ea('0x37')];if(!_0x3f9346[_0x54ea('0x32')]['hasOwnProperty']('nolimit')){_0x59ca08[_0x54ea('0x1d')]=qs[_0x54ea('0x1d')](_0x3f9346[_0x54ea('0x32')][_0x54ea('0x1d')]);_0x59ca08['offset']=qs['offset'](_0x3f9346[_0x54ea('0x32')][_0x54ea('0x1f')]);}return _0x303fbf[_0x54ea('0x51')](_0x59ca08);}})['then'](function(_0x4b7203){if(_0x4b7203){return _0x4b7203?{'count':_0x9bd64e,'rows':_0x4b7203}:null;}})[_0x54ea('0x25')](respondWithResult(_0x209ff1,null))[_0x54ea('0x43')](handleError(_0x209ff1,null));};exports[_0x54ea('0x52')]=function(_0x5c5915,_0x128174,_0x37250e){var _0x20cd74={};var _0x1ac1d3={};var _0x107030;var _0x59422f;return db[_0x54ea('0x2d')][_0x54ea('0x4d')]({'where':{'id':_0x5c5915['params']['id']}})[_0x54ea('0x25')](handleEntityNotFound(_0x128174,null))['then'](function(_0x3f4885){if(_0x3f4885){_0x107030=_0x3f4885;_0x1ac1d3[_0x54ea('0x31')]=_[_0x54ea('0x46')](db[_0x54ea('0x53')][_0x54ea('0x2e')]);_0x1ac1d3[_0x54ea('0x32')]=_[_0x54ea('0x46')](_0x5c5915[_0x54ea('0x32')]);_0x1ac1d3[_0x54ea('0x33')]=_[_0x54ea('0x34')](_0x1ac1d3[_0x54ea('0x31')],_0x1ac1d3['query']);_0x20cd74[_0x54ea('0x36')]=_[_0x54ea('0x34')](_0x1ac1d3[_0x54ea('0x31')],qs['fields'](_0x5c5915['query']['fields']));_0x20cd74[_0x54ea('0x36')]=_0x20cd74[_0x54ea('0x36')]['length']?_0x20cd74[_0x54ea('0x36')]:_0x1ac1d3[_0x54ea('0x31')];_0x20cd74[_0x54ea('0x3a')]=qs['sort'](_0x5c5915[_0x54ea('0x32')][_0x54ea('0x3b')]);_0x20cd74[_0x54ea('0x3c')]=qs[_0x54ea('0x33')](_['pick'](_0x5c5915[_0x54ea('0x32')],_0x1ac1d3['filters']));if(_0x5c5915[_0x54ea('0x32')][_0x54ea('0x4f')]){_0x20cd74[_0x54ea('0x3c')]=_['merge'](_0x20cd74['where'],{'$or':_[_0x54ea('0x2c')](_0x20cd74['attributes'],function(_0x1de8b8){var _0x2f4ce8={};_0x2f4ce8[_0x1de8b8]={'$like':'%'+_0x5c5915[_0x54ea('0x32')]['filter']+'%'};return _0x2f4ce8;})});}_0x20cd74=_[_0x54ea('0x3e')]({},_0x20cd74,_0x5c5915['options']);return _0x107030['getTags'](_0x20cd74);}})[_0x54ea('0x25')](function(_0x1cd092){if(_0x1cd092){_0x59422f=_0x1cd092[_0x54ea('0x37')];if(!_0x5c5915[_0x54ea('0x32')][_0x54ea('0x38')](_0x54ea('0x39'))){_0x20cd74[_0x54ea('0x1d')]=qs[_0x54ea('0x1d')](_0x5c5915[_0x54ea('0x32')]['limit']);_0x20cd74[_0x54ea('0x1f')]=qs[_0x54ea('0x1f')](_0x5c5915['query'][_0x54ea('0x1f')]);}return _0x107030['getTags'](_0x20cd74);}})[_0x54ea('0x25')](function(_0x332f7a){if(_0x332f7a){return _0x332f7a?{'count':_0x59422f,'rows':_0x332f7a}:null;}})[_0x54ea('0x25')](respondWithResult(_0x128174,null))[_0x54ea('0x43')](handleError(_0x128174,null));};exports[_0x54ea('0x54')]=function(_0x230240,_0x24c3c5,_0x41531e){if(_0x230240[_0x54ea('0x4a')]['id']){delete _0x230240[_0x54ea('0x4a')]['id'];}return db[_0x54ea('0x2d')]['findOne']({'where':{'id':_0x230240[_0x54ea('0x45')]['id']}})[_0x54ea('0x25')](handleEntityNotFound(_0x24c3c5,null))[_0x54ea('0x25')](function(_0x264a41){if(_0x264a41){return _0x264a41[_0x54ea('0x54')](_0x230240[_0x54ea('0x4a')][_0x54ea('0x55')]||[]);}return null;})['then'](respondWithResult(_0x24c3c5,null))['catch'](handleError(_0x24c3c5,null));}; \ No newline at end of file +var _0xb5d6=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','show','params','find','create','body','catch','findOne','length','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0xb5d6,0x1ae));var _0x6b5d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb5d6[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x6b5d('0x0'));var rimraf=require(_0x6b5d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b5d('0x2'));var rp=require(_0x6b5d('0x3'));var moment=require(_0x6b5d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6b5d('0x5'));var util=require('util');var path=require(_0x6b5d('0x6'));var sox=require('sox');var csv=require(_0x6b5d('0x7'));var ejs=require(_0x6b5d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6b5d('0x9'));var crypto=require(_0x6b5d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6b5d('0xb'));var toCsv=require(_0x6b5d('0x7'));var querystring=require(_0x6b5d('0xc'));var Papa=require(_0x6b5d('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6b5d('0xe'));var as=require(_0x6b5d('0xf'));var hardwareService=require(_0x6b5d('0x10'));var logger=require(_0x6b5d('0x11'))(_0x6b5d('0x12'));var utils=require(_0x6b5d('0x13'));var config=require(_0x6b5d('0x14'));var licenseUtil=require(_0x6b5d('0x15'));var db=require(_0x6b5d('0x16'))['db'];function respondWithStatusCode(_0x3a44ff,_0x589f60){_0x589f60=_0x589f60||0xcc;return function(_0x9f76b3){if(_0x9f76b3){return _0x3a44ff[_0x6b5d('0x17')](_0x589f60);}return _0x3a44ff['status'](_0x589f60)[_0x6b5d('0x18')]();};}function respondWithResult(_0x2b9164,_0x38b2d7){_0x38b2d7=_0x38b2d7||0xc8;return function(_0x856f2b){if(_0x856f2b){return _0x2b9164[_0x6b5d('0x19')](_0x38b2d7)[_0x6b5d('0x1a')](_0x856f2b);}};}function respondWithFilteredResult(_0x11ed55,_0x2009b3){return function(_0x2cb696){if(_0x2cb696){var _0x4d9d32=typeof _0x2009b3[_0x6b5d('0x1b')]===_0x6b5d('0x1c')&&typeof _0x2009b3[_0x6b5d('0x1d')]===_0x6b5d('0x1c');var _0x318123=_0x2cb696['count'];var _0x2691b0=_0x4d9d32?0x0:_0x2009b3[_0x6b5d('0x1b')];var _0xa96a21=_0x4d9d32?_0x2cb696[_0x6b5d('0x1e')]:_0x2009b3[_0x6b5d('0x1b')]+_0x2009b3[_0x6b5d('0x1d')];var _0x29259a;if(_0xa96a21>=_0x318123){_0xa96a21=_0x318123;_0x29259a=0xc8;}else{_0x29259a=0xce;}_0x11ed55[_0x6b5d('0x19')](_0x29259a);return _0x11ed55[_0x6b5d('0x1f')](_0x6b5d('0x20'),_0x2691b0+'-'+_0xa96a21+'/'+_0x318123)['json'](_0x2cb696);}return null;};}function patchUpdates(_0x688d67){return function(_0x385935){try{jsonpatch[_0x6b5d('0x21')](_0x385935,_0x688d67,!![]);}catch(_0x13ee2f){return BPromise['reject'](_0x13ee2f);}return _0x385935[_0x6b5d('0x22')]();};}function saveUpdates(_0x51a4b5,_0x2170ab){return function(_0x4e4508){if(_0x4e4508){return _0x4e4508[_0x6b5d('0x23')](_0x51a4b5)[_0x6b5d('0x24')](function(_0x32ed58){return _0x32ed58;});}return null;};}function removeEntity(_0x19fb13,_0x2cf71f){return function(_0x2b98b6){if(_0x2b98b6){return _0x2b98b6[_0x6b5d('0x25')]()[_0x6b5d('0x24')](function(){_0x19fb13[_0x6b5d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b4426,_0x2c5983){return function(_0x59620f){if(!_0x59620f){_0x1b4426[_0x6b5d('0x17')](0x194);}return _0x59620f;};}function handleError(_0x2a0c73,_0x1173b1){_0x1173b1=_0x1173b1||0x1f4;return function(_0x253274){logger['error'](_0x253274['stack']);if(_0x253274[_0x6b5d('0x26')]){delete _0x253274[_0x6b5d('0x26')];}_0x2a0c73['status'](_0x1173b1)[_0x6b5d('0x27')](_0x253274);};}exports[_0x6b5d('0x28')]=function(_0x3c20ce,_0x557ef9){var _0x1179c2={},_0x2223cc={},_0x2606ad={'count':0x0,'rows':[]};var _0x5dc77b=_[_0x6b5d('0x29')](db[_0x6b5d('0x2a')][_0x6b5d('0x2b')],function(_0x351cc2){return{'name':_0x351cc2[_0x6b5d('0x2c')],'type':_0x351cc2['type'][_0x6b5d('0x2d')]};});_0x2223cc[_0x6b5d('0x2e')]=_[_0x6b5d('0x29')](_0x5dc77b,_0x6b5d('0x26'));_0x2223cc[_0x6b5d('0x2f')]=_[_0x6b5d('0x30')](_0x3c20ce['query']);_0x2223cc[_0x6b5d('0x31')]=_[_0x6b5d('0x32')](_0x2223cc['model'],_0x2223cc[_0x6b5d('0x2f')]);_0x1179c2[_0x6b5d('0x33')]=_['intersection'](_0x2223cc[_0x6b5d('0x2e')],qs[_0x6b5d('0x34')](_0x3c20ce[_0x6b5d('0x2f')][_0x6b5d('0x34')]));_0x1179c2['attributes']=_0x1179c2[_0x6b5d('0x33')]['length']?_0x1179c2[_0x6b5d('0x33')]:_0x2223cc['model'];if(!_0x3c20ce[_0x6b5d('0x2f')][_0x6b5d('0x35')](_0x6b5d('0x36'))){_0x1179c2[_0x6b5d('0x1d')]=qs[_0x6b5d('0x1d')](_0x3c20ce['query']['limit']);_0x1179c2[_0x6b5d('0x1b')]=qs[_0x6b5d('0x1b')](_0x3c20ce[_0x6b5d('0x2f')][_0x6b5d('0x1b')]);}_0x1179c2[_0x6b5d('0x37')]=qs[_0x6b5d('0x38')](_0x3c20ce[_0x6b5d('0x2f')][_0x6b5d('0x38')]);_0x1179c2[_0x6b5d('0x39')]=qs[_0x6b5d('0x31')](_[_0x6b5d('0x3a')](_0x3c20ce[_0x6b5d('0x2f')],_0x2223cc['filters']),_0x5dc77b);if(_0x3c20ce[_0x6b5d('0x2f')][_0x6b5d('0x3b')]){_0x1179c2[_0x6b5d('0x39')]=_[_0x6b5d('0x3c')](_0x1179c2['where'],{'$or':_['map'](_0x5dc77b,function(_0x2c1226){if(_0x2c1226[_0x6b5d('0x3d')]!=='VIRTUAL'){var _0x27f974={};_0x27f974[_0x2c1226['name']]={'$like':'%'+_0x3c20ce['query'][_0x6b5d('0x3b')]+'%'};return _0x27f974;}})});}_0x1179c2=_['merge']({},_0x1179c2,_0x3c20ce[_0x6b5d('0x3e')]);var _0x251544={'where':_0x1179c2[_0x6b5d('0x39')]};return db[_0x6b5d('0x2a')][_0x6b5d('0x1e')](_0x251544)[_0x6b5d('0x24')](function(_0x476fda){_0x2606ad['count']=_0x476fda;if(_0x3c20ce[_0x6b5d('0x2f')][_0x6b5d('0x3f')]){_0x1179c2[_0x6b5d('0x40')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x1179c2);})[_0x6b5d('0x24')](function(_0x46aafe){_0x2606ad['rows']=_0x46aafe;return _0x2606ad;})[_0x6b5d('0x24')](respondWithFilteredResult(_0x557ef9,_0x1179c2))['catch'](handleError(_0x557ef9,null));};exports[_0x6b5d('0x41')]=function(_0xa65359,_0x39323c){var _0x5e4725={'raw':![],'where':{'id':_0xa65359[_0x6b5d('0x42')]['id']}},_0x193ab6={};_0x193ab6[_0x6b5d('0x2e')]=_['keys'](db[_0x6b5d('0x2a')][_0x6b5d('0x2b')]);_0x193ab6['query']=_[_0x6b5d('0x30')](_0xa65359[_0x6b5d('0x2f')]);_0x193ab6[_0x6b5d('0x31')]=_[_0x6b5d('0x32')](_0x193ab6[_0x6b5d('0x2e')],_0x193ab6[_0x6b5d('0x2f')]);_0x5e4725[_0x6b5d('0x33')]=_[_0x6b5d('0x32')](_0x193ab6[_0x6b5d('0x2e')],qs[_0x6b5d('0x34')](_0xa65359[_0x6b5d('0x2f')][_0x6b5d('0x34')]));_0x5e4725['attributes']=_0x5e4725[_0x6b5d('0x33')]['length']?_0x5e4725[_0x6b5d('0x33')]:_0x193ab6[_0x6b5d('0x2e')];if(_0xa65359[_0x6b5d('0x2f')]['includeAll']){_0x5e4725[_0x6b5d('0x40')]=[{'all':!![]}];}_0x5e4725=_['merge']({},_0x5e4725,_0xa65359[_0x6b5d('0x3e')]);return db[_0x6b5d('0x2a')][_0x6b5d('0x43')](_0x5e4725)['then'](handleEntityNotFound(_0x39323c,null))[_0x6b5d('0x24')](respondWithResult(_0x39323c,null))['catch'](handleError(_0x39323c,null));};exports[_0x6b5d('0x44')]=function(_0x100079,_0x480a41){return db[_0x6b5d('0x2a')]['create'](_0x100079[_0x6b5d('0x45')],{})[_0x6b5d('0x24')](respondWithResult(_0x480a41,0xc9))[_0x6b5d('0x46')](handleError(_0x480a41,null));};exports[_0x6b5d('0x23')]=function(_0x5a0b47,_0xfd0966){if(_0x5a0b47[_0x6b5d('0x45')]['id']){delete _0x5a0b47[_0x6b5d('0x45')]['id'];}return db['ZendeskConfiguration'][_0x6b5d('0x43')]({'where':{'id':_0x5a0b47[_0x6b5d('0x42')]['id']}})['then'](handleEntityNotFound(_0xfd0966,null))['then'](saveUpdates(_0x5a0b47['body'],null))[_0x6b5d('0x24')](respondWithResult(_0xfd0966,null))['catch'](handleError(_0xfd0966,null));};exports['destroy']=function(_0x2b5b0f,_0x9eb1d6){return db[_0x6b5d('0x2a')][_0x6b5d('0x43')]({'where':{'id':_0x2b5b0f[_0x6b5d('0x42')]['id']}})[_0x6b5d('0x24')](handleEntityNotFound(_0x9eb1d6,null))[_0x6b5d('0x24')](removeEntity(_0x9eb1d6,null))['catch'](handleError(_0x9eb1d6,null));};exports['getFields']=function(_0x7c3bfc,_0x4db07a,_0x497ba1){var _0x121282={};var _0x2f5bdb={};var _0x55c857;var _0x498e2a;return db[_0x6b5d('0x2a')][_0x6b5d('0x47')]({'where':{'id':_0x7c3bfc[_0x6b5d('0x42')]['id']}})[_0x6b5d('0x24')](handleEntityNotFound(_0x4db07a,null))[_0x6b5d('0x24')](function(_0x34614b){if(_0x34614b){_0x55c857=_0x34614b;_0x2f5bdb[_0x6b5d('0x2e')]=_['keys'](db['ZendeskField'][_0x6b5d('0x2b')]);_0x2f5bdb['query']=_['keys'](_0x7c3bfc[_0x6b5d('0x2f')]);_0x2f5bdb[_0x6b5d('0x31')]=_[_0x6b5d('0x32')](_0x2f5bdb['model'],_0x2f5bdb[_0x6b5d('0x2f')]);_0x121282['attributes']=_[_0x6b5d('0x32')](_0x2f5bdb[_0x6b5d('0x2e')],qs[_0x6b5d('0x34')](_0x7c3bfc[_0x6b5d('0x2f')][_0x6b5d('0x34')]));_0x121282[_0x6b5d('0x33')]=_0x121282[_0x6b5d('0x33')][_0x6b5d('0x48')]?_0x121282['attributes']:_0x2f5bdb['model'];_0x121282[_0x6b5d('0x37')]=qs[_0x6b5d('0x38')](_0x7c3bfc[_0x6b5d('0x2f')][_0x6b5d('0x38')]);_0x121282[_0x6b5d('0x39')]=qs[_0x6b5d('0x31')](_[_0x6b5d('0x3a')](_0x7c3bfc['query'],_0x2f5bdb[_0x6b5d('0x31')]));if(_0x7c3bfc['query'][_0x6b5d('0x3b')]){_0x121282[_0x6b5d('0x39')]=_[_0x6b5d('0x3c')](_0x121282[_0x6b5d('0x39')],{'$or':_['map'](_0x121282['attributes'],function(_0x4dc4ec){var _0xa21ecf={};_0xa21ecf[_0x4dc4ec]={'$like':'%'+_0x7c3bfc[_0x6b5d('0x2f')][_0x6b5d('0x3b')]+'%'};return _0xa21ecf;})});}_0x121282=_[_0x6b5d('0x3c')]({},_0x121282,_0x7c3bfc['options']);return _0x55c857['getFields'](_0x121282);}})['then'](function(_0x16388e){if(_0x16388e){_0x498e2a=_0x16388e[_0x6b5d('0x48')];if(!_0x7c3bfc[_0x6b5d('0x2f')][_0x6b5d('0x35')](_0x6b5d('0x36'))){_0x121282[_0x6b5d('0x1d')]=qs['limit'](_0x7c3bfc['query'][_0x6b5d('0x1d')]);_0x121282[_0x6b5d('0x1b')]=qs[_0x6b5d('0x1b')](_0x7c3bfc[_0x6b5d('0x2f')]['offset']);}return _0x55c857['getFields'](_0x121282);}})[_0x6b5d('0x24')](function(_0x2bf06e){if(_0x2bf06e){return _0x2bf06e?{'count':_0x498e2a,'rows':_0x2bf06e}:null;}})[_0x6b5d('0x24')](respondWithResult(_0x4db07a,null))['catch'](handleError(_0x4db07a,null));};exports[_0x6b5d('0x49')]=function(_0x50efc8,_0x40b26f,_0x3d3ba0){var _0x37f386={};var _0x59e49f={};var _0x31dca8;var _0xd44f48;return db[_0x6b5d('0x2a')]['findOne']({'where':{'id':_0x50efc8['params']['id']}})[_0x6b5d('0x24')](handleEntityNotFound(_0x40b26f,null))['then'](function(_0x58ef2d){if(_0x58ef2d){_0x31dca8=_0x58ef2d;_0x59e49f[_0x6b5d('0x2e')]=_[_0x6b5d('0x30')](db[_0x6b5d('0x4a')][_0x6b5d('0x2b')]);_0x59e49f[_0x6b5d('0x2f')]=_[_0x6b5d('0x30')](_0x50efc8[_0x6b5d('0x2f')]);_0x59e49f[_0x6b5d('0x31')]=_[_0x6b5d('0x32')](_0x59e49f[_0x6b5d('0x2e')],_0x59e49f[_0x6b5d('0x2f')]);_0x37f386[_0x6b5d('0x33')]=_[_0x6b5d('0x32')](_0x59e49f['model'],qs['fields'](_0x50efc8[_0x6b5d('0x2f')][_0x6b5d('0x34')]));_0x37f386[_0x6b5d('0x33')]=_0x37f386[_0x6b5d('0x33')][_0x6b5d('0x48')]?_0x37f386[_0x6b5d('0x33')]:_0x59e49f['model'];_0x37f386['order']=qs[_0x6b5d('0x38')](_0x50efc8[_0x6b5d('0x2f')][_0x6b5d('0x38')]);_0x37f386['where']=qs[_0x6b5d('0x31')](_[_0x6b5d('0x3a')](_0x50efc8[_0x6b5d('0x2f')],_0x59e49f[_0x6b5d('0x31')]));if(_0x50efc8[_0x6b5d('0x2f')][_0x6b5d('0x3b')]){_0x37f386[_0x6b5d('0x39')]=_[_0x6b5d('0x3c')](_0x37f386[_0x6b5d('0x39')],{'$or':_[_0x6b5d('0x29')](_0x37f386[_0x6b5d('0x33')],function(_0x3dd5b4){var _0x1ee3d6={};_0x1ee3d6[_0x3dd5b4]={'$like':'%'+_0x50efc8['query'][_0x6b5d('0x3b')]+'%'};return _0x1ee3d6;})});}_0x37f386=_[_0x6b5d('0x3c')]({},_0x37f386,_0x50efc8[_0x6b5d('0x3e')]);return _0x31dca8['getSubjects'](_0x37f386);}})[_0x6b5d('0x24')](function(_0xd0e330){if(_0xd0e330){_0xd44f48=_0xd0e330[_0x6b5d('0x48')];if(!_0x50efc8[_0x6b5d('0x2f')][_0x6b5d('0x35')](_0x6b5d('0x36'))){_0x37f386['limit']=qs['limit'](_0x50efc8['query'][_0x6b5d('0x1d')]);_0x37f386[_0x6b5d('0x1b')]=qs[_0x6b5d('0x1b')](_0x50efc8[_0x6b5d('0x2f')][_0x6b5d('0x1b')]);}return _0x31dca8[_0x6b5d('0x49')](_0x37f386);}})[_0x6b5d('0x24')](function(_0x1d7f87){if(_0x1d7f87){return _0x1d7f87?{'count':_0xd44f48,'rows':_0x1d7f87}:null;}})['then'](respondWithResult(_0x40b26f,null))[_0x6b5d('0x46')](handleError(_0x40b26f,null));};exports['getDescriptions']=function(_0xe4fc23,_0x1b6a98,_0x189a30){var _0x13290a={};var _0x2ebe77={};var _0x2bbfd2;var _0x3bc4d7;return db[_0x6b5d('0x2a')]['findOne']({'where':{'id':_0xe4fc23[_0x6b5d('0x42')]['id']}})[_0x6b5d('0x24')](handleEntityNotFound(_0x1b6a98,null))[_0x6b5d('0x24')](function(_0x10cf15){if(_0x10cf15){_0x2bbfd2=_0x10cf15;_0x2ebe77[_0x6b5d('0x2e')]=_['keys'](db[_0x6b5d('0x4a')]['rawAttributes']);_0x2ebe77[_0x6b5d('0x2f')]=_[_0x6b5d('0x30')](_0xe4fc23[_0x6b5d('0x2f')]);_0x2ebe77['filters']=_[_0x6b5d('0x32')](_0x2ebe77[_0x6b5d('0x2e')],_0x2ebe77['query']);_0x13290a[_0x6b5d('0x33')]=_['intersection'](_0x2ebe77[_0x6b5d('0x2e')],qs[_0x6b5d('0x34')](_0xe4fc23[_0x6b5d('0x2f')][_0x6b5d('0x34')]));_0x13290a[_0x6b5d('0x33')]=_0x13290a[_0x6b5d('0x33')][_0x6b5d('0x48')]?_0x13290a[_0x6b5d('0x33')]:_0x2ebe77[_0x6b5d('0x2e')];_0x13290a['order']=qs[_0x6b5d('0x38')](_0xe4fc23['query'][_0x6b5d('0x38')]);_0x13290a[_0x6b5d('0x39')]=qs[_0x6b5d('0x31')](_['pick'](_0xe4fc23[_0x6b5d('0x2f')],_0x2ebe77[_0x6b5d('0x31')]));if(_0xe4fc23['query'][_0x6b5d('0x3b')]){_0x13290a[_0x6b5d('0x39')]=_['merge'](_0x13290a[_0x6b5d('0x39')],{'$or':_['map'](_0x13290a[_0x6b5d('0x33')],function(_0x932011){var _0x4c60c2={};_0x4c60c2[_0x932011]={'$like':'%'+_0xe4fc23[_0x6b5d('0x2f')][_0x6b5d('0x3b')]+'%'};return _0x4c60c2;})});}_0x13290a=_[_0x6b5d('0x3c')]({},_0x13290a,_0xe4fc23[_0x6b5d('0x3e')]);return _0x2bbfd2[_0x6b5d('0x4b')](_0x13290a);}})['then'](function(_0x29c7e7){if(_0x29c7e7){_0x3bc4d7=_0x29c7e7[_0x6b5d('0x48')];if(!_0xe4fc23[_0x6b5d('0x2f')][_0x6b5d('0x35')](_0x6b5d('0x36'))){_0x13290a[_0x6b5d('0x1d')]=qs[_0x6b5d('0x1d')](_0xe4fc23[_0x6b5d('0x2f')]['limit']);_0x13290a['offset']=qs[_0x6b5d('0x1b')](_0xe4fc23[_0x6b5d('0x2f')]['offset']);}return _0x2bbfd2[_0x6b5d('0x4b')](_0x13290a);}})['then'](function(_0x126784){if(_0x126784){return _0x126784?{'count':_0x3bc4d7,'rows':_0x126784}:null;}})['then'](respondWithResult(_0x1b6a98,null))[_0x6b5d('0x46')](handleError(_0x1b6a98,null));};exports[_0x6b5d('0x4c')]=function(_0x110218,_0x2d6927,_0x3cb518){var _0xdb5093={};var _0xdf91ea={};var _0x45ead7;var _0x4e30c7;return db[_0x6b5d('0x2a')]['findOne']({'where':{'id':_0x110218[_0x6b5d('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d6927,null))[_0x6b5d('0x24')](function(_0x12d468){if(_0x12d468){_0x45ead7=_0x12d468;_0xdf91ea[_0x6b5d('0x2e')]=_['keys'](db[_0x6b5d('0x4d')][_0x6b5d('0x2b')]);_0xdf91ea[_0x6b5d('0x2f')]=_[_0x6b5d('0x30')](_0x110218[_0x6b5d('0x2f')]);_0xdf91ea[_0x6b5d('0x31')]=_[_0x6b5d('0x32')](_0xdf91ea[_0x6b5d('0x2e')],_0xdf91ea[_0x6b5d('0x2f')]);_0xdb5093[_0x6b5d('0x33')]=_[_0x6b5d('0x32')](_0xdf91ea[_0x6b5d('0x2e')],qs[_0x6b5d('0x34')](_0x110218[_0x6b5d('0x2f')]['fields']));_0xdb5093[_0x6b5d('0x33')]=_0xdb5093[_0x6b5d('0x33')][_0x6b5d('0x48')]?_0xdb5093[_0x6b5d('0x33')]:_0xdf91ea['model'];_0xdb5093[_0x6b5d('0x37')]=qs[_0x6b5d('0x38')](_0x110218[_0x6b5d('0x2f')][_0x6b5d('0x38')]);_0xdb5093[_0x6b5d('0x39')]=qs[_0x6b5d('0x31')](_[_0x6b5d('0x3a')](_0x110218['query'],_0xdf91ea[_0x6b5d('0x31')]));if(_0x110218[_0x6b5d('0x2f')][_0x6b5d('0x3b')]){_0xdb5093[_0x6b5d('0x39')]=_['merge'](_0xdb5093[_0x6b5d('0x39')],{'$or':_[_0x6b5d('0x29')](_0xdb5093[_0x6b5d('0x33')],function(_0x20249b){var _0x42d62d={};_0x42d62d[_0x20249b]={'$like':'%'+_0x110218[_0x6b5d('0x2f')]['filter']+'%'};return _0x42d62d;})});}_0xdb5093=_[_0x6b5d('0x3c')]({},_0xdb5093,_0x110218[_0x6b5d('0x3e')]);return _0x45ead7[_0x6b5d('0x4c')](_0xdb5093);}})[_0x6b5d('0x24')](function(_0x141c6b){if(_0x141c6b){_0x4e30c7=_0x141c6b[_0x6b5d('0x48')];if(!_0x110218[_0x6b5d('0x2f')][_0x6b5d('0x35')](_0x6b5d('0x36'))){_0xdb5093[_0x6b5d('0x1d')]=qs[_0x6b5d('0x1d')](_0x110218['query'][_0x6b5d('0x1d')]);_0xdb5093['offset']=qs[_0x6b5d('0x1b')](_0x110218[_0x6b5d('0x2f')][_0x6b5d('0x1b')]);}return _0x45ead7[_0x6b5d('0x4c')](_0xdb5093);}})['then'](function(_0x29b487){if(_0x29b487){return _0x29b487?{'count':_0x4e30c7,'rows':_0x29b487}:null;}})['then'](respondWithResult(_0x2d6927,null))[_0x6b5d('0x46')](handleError(_0x2d6927,null));};exports['setTags']=function(_0x23168f,_0x3e17ab,_0x2e50ae){if(_0x23168f[_0x6b5d('0x45')]['id']){delete _0x23168f[_0x6b5d('0x45')]['id'];}return db[_0x6b5d('0x2a')][_0x6b5d('0x47')]({'where':{'id':_0x23168f[_0x6b5d('0x42')]['id']}})[_0x6b5d('0x24')](handleEntityNotFound(_0x3e17ab,null))[_0x6b5d('0x24')](function(_0x54a43a){if(_0x54a43a){return _0x54a43a[_0x6b5d('0x4e')](_0x23168f[_0x6b5d('0x45')][_0x6b5d('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x3e17ab,null))['catch'](handleError(_0x3e17ab,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 1333676..dd6ae71 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 _0x5f66=['request-promise','path','../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','util','api','moment','bluebird'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28f2=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations'];(function(_0x1272ab,_0x2e0972){var _0x3f8ced=function(_0x39f7ad){while(--_0x39f7ad){_0x1272ab['push'](_0x1272ab['shift']());}};_0x3f8ced(++_0x2e0972);}(_0x28f2,0x193));var _0x228f=function(_0x1f1386,_0x3aa7e7){_0x1f1386=_0x1f1386-0x0;var _0x5915e2=_0x28f2[_0x1f1386];return _0x5915e2;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var logger=require(_0x228f('0x2'))(_0x228f('0x3'));var moment=require(_0x228f('0x4'));var BPromise=require('bluebird');var rp=require(_0x228f('0x5'));var fs=require('fs');var path=require(_0x228f('0x6'));var rimraf=require(_0x228f('0x7'));var config=require(_0x228f('0x8'));var attributes=require(_0x228f('0x9'));module[_0x228f('0xa')]=function(_0x32c5c3,_0x485423){return _0x32c5c3[_0x228f('0xb')]('ZendeskConfiguration',attributes,{'tableName':_0x228f('0xc'),'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 3ab1e1f..1a83627 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 _0x8b25=['info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x52c731,_0x2499d6){var _0x4e06b5=function(_0x446428){while(--_0x446428){_0x52c731['push'](_0x52c731['shift']());}};_0x4e06b5(++_0x2499d6);}(_0x8b25,0x198));var _0x58b2=function(_0x14cec5,_0x4cab7e){_0x14cec5=_0x14cec5-0x0;var _0x3bfeee=_0x8b25[_0x14cec5];return _0x3bfeee;};'use strict';var _=require(_0x58b2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x58b2('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x58b2('0x2'))(_0x58b2('0x3'));var config=require(_0x58b2('0x4'));var jayson=require(_0x58b2('0x5'));var client=jayson[_0x58b2('0x6')][_0x58b2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e709c,_0x25b01b,_0x3e601f){return new BPromise(function(_0xd448f,_0x489850){return client[_0x58b2('0x8')](_0x5e709c,_0x3e601f)[_0x58b2('0x9')](function(_0xeb0186){logger[_0x58b2('0xa')](_0x58b2('0xb'),_0x25b01b,'request\x20sent');logger[_0x58b2('0xc')](_0x58b2('0xd'),_0x25b01b,'request\x20sent',JSON['stringify'](_0xeb0186));if(_0xeb0186[_0x58b2('0xe')]){if(_0xeb0186['error']['code']===0x1f4){logger[_0x58b2('0xe')](_0x58b2('0xb'),_0x25b01b,_0xeb0186[_0x58b2('0xe')][_0x58b2('0xf')]);return _0x489850(_0xeb0186[_0x58b2('0xe')][_0x58b2('0xf')]);}logger[_0x58b2('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x25b01b,_0xeb0186[_0x58b2('0xe')]['message']);return _0xd448f(_0xeb0186[_0x58b2('0xe')][_0x58b2('0xf')]);}else{logger['info'](_0x58b2('0xb'),_0x25b01b,_0x58b2('0x10'));_0xd448f(_0xeb0186[_0x58b2('0x11')][_0x58b2('0xf')]);}})[_0x58b2('0x12')](function(_0x3d4140){logger[_0x58b2('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x25b01b,_0x3d4140);_0x489850(_0x3d4140);});});} \ No newline at end of file +var _0x1f27=['client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1f27,0x141));var _0x71f2=function(_0x32831f,_0x245d95){_0x32831f=_0x32831f-0x0;var _0x501c14=_0x1f27[_0x32831f];return _0x501c14;};'use strict';var _=require(_0x71f2('0x0'));var util=require(_0x71f2('0x1'));var moment=require(_0x71f2('0x2'));var BPromise=require(_0x71f2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71f2('0x4'));var db=require(_0x71f2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x71f2('0x6'))(_0x71f2('0x7'));var config=require(_0x71f2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x71f2('0x9')][_0x71f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58cd3d,_0x2e5225,_0x29c14d){return new BPromise(function(_0x4957d4,_0x19695d){return client[_0x71f2('0xb')](_0x58cd3d,_0x29c14d)[_0x71f2('0xc')](function(_0x219cc5){logger['info'](_0x71f2('0xd'),_0x2e5225,'request\x20sent');logger[_0x71f2('0xe')](_0x71f2('0xf'),_0x2e5225,_0x71f2('0x10'),JSON[_0x71f2('0x11')](_0x219cc5));if(_0x219cc5[_0x71f2('0x12')]){if(_0x219cc5[_0x71f2('0x12')]['code']===0x1f4){logger[_0x71f2('0x12')](_0x71f2('0xd'),_0x2e5225,_0x219cc5[_0x71f2('0x12')][_0x71f2('0x13')]);return _0x19695d(_0x219cc5[_0x71f2('0x12')]['message']);}logger[_0x71f2('0x12')](_0x71f2('0xd'),_0x2e5225,_0x219cc5['error'][_0x71f2('0x13')]);return _0x4957d4(_0x219cc5[_0x71f2('0x12')][_0x71f2('0x13')]);}else{logger['info'](_0x71f2('0xd'),_0x2e5225,_0x71f2('0x10'));_0x4957d4(_0x219cc5[_0x71f2('0x14')][_0x71f2('0x13')]);}})[_0x71f2('0x15')](function(_0x466562){logger[_0x71f2('0x12')](_0x71f2('0xd'),_0x2e5225,_0x466562);_0x19695d(_0x466562);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 7b22710..a6b9b53 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 _0x3e29=['/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','post','isAuthenticated','create','put'];(function(_0x1ab669,_0x1c0438){var _0x7f0303=function(_0x33cc7c){while(--_0x33cc7c){_0x1ab669['push'](_0x1ab669['shift']());}};_0x7f0303(++_0x1c0438);}(_0x3e29,0x16e));var _0x93e2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3e29[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x93e2('0x0'));var util=require(_0x93e2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x93e2('0x2'));var router=express[_0x93e2('0x3')]();var fs_extra=require(_0x93e2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x93e2('0x5'));var config=require(_0x93e2('0x6'));var controller=require(_0x93e2('0x7'));router[_0x93e2('0x8')]('/',auth['isAuthenticated'](),controller[_0x93e2('0x9')]);router[_0x93e2('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x93e2('0xa')]('/',auth[_0x93e2('0xb')](),controller[_0x93e2('0xc')]);router[_0x93e2('0xd')](_0x93e2('0xe'),auth[_0x93e2('0xb')](),controller[_0x93e2('0xf')]);router[_0x93e2('0x10')](_0x93e2('0xe'),auth['isAuthenticated'](),controller[_0x93e2('0x11')]);module[_0x93e2('0x12')]=router; \ No newline at end of file +var _0x411d=['isAuthenticated','get','/:id','post','create','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3c691c,_0x75c10a){var _0x5703a0=function(_0x4ffc4a){while(--_0x4ffc4a){_0x3c691c['push'](_0x3c691c['shift']());}};_0x5703a0(++_0x75c10a);}(_0x411d,0x128));var _0xd411=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x411d[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xd411('0x0'));var util=require(_0xd411('0x1'));var path=require(_0xd411('0x2'));var timeout=require('connect-timeout');var express=require(_0xd411('0x3'));var router=express[_0xd411('0x4')]();var fs_extra=require(_0xd411('0x5'));var auth=require(_0xd411('0x6'));var interaction=require(_0xd411('0x7'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router['get']('/',auth[_0xd411('0x8')](),controller['index']);router[_0xd411('0x9')](_0xd411('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd411('0xb')]('/',auth[_0xd411('0x8')](),controller[_0xd411('0xc')]);router[_0xd411('0xd')]('/:id',auth[_0xd411('0x8')](),controller[_0xd411('0xe')]);router['delete'](_0xd411('0xa'),auth[_0xd411('0x8')](),controller[_0xd411('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 1cead46..1c08a62 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 _0xb79b=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x39aafc,_0x395606){var _0x954320=function(_0x134128){while(--_0x134128){_0x39aafc['push'](_0x39aafc['shift']());}};_0x954320(++_0x395606);}(_0xb79b,0x12f));var _0xbb79=function(_0x3e2d7c,_0x2a7245){_0x3e2d7c=_0x3e2d7c-0x0;var _0x4ed0b7=_0xb79b[_0x3e2d7c];return _0x4ed0b7;};'use strict';var Sequelize=require(_0xbb79('0x0'));module['exports']={'type':{'type':Sequelize[_0xbb79('0x1')](_0xbb79('0x2'),_0xbb79('0x3'),_0xbb79('0x4'),'keyValue','picklist'),'defaultValue':_0xbb79('0x2')},'content':{'type':Sequelize[_0xbb79('0x5')]},'key':{'type':Sequelize[_0xbb79('0x5')]},'keyType':{'type':Sequelize[_0xbb79('0x1')]('string',_0xbb79('0x3'),_0xbb79('0x4'))},'keyContent':{'type':Sequelize[_0xbb79('0x5')]},'idField':{'type':Sequelize[_0xbb79('0x5')]},'nameField':{'type':Sequelize[_0xbb79('0x5')]},'customField':{'type':Sequelize[_0xbb79('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4f6f=['STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable','keyValue','picklist'];(function(_0x1a3607,_0xd20c85){var _0x49504b=function(_0x50297e){while(--_0x50297e){_0x1a3607['push'](_0x1a3607['shift']());}};_0x49504b(++_0xd20c85);}(_0x4f6f,0x8a));var _0xf4f6=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0x4f6f[_0xa990b7];return _0x52c99c;};'use strict';var Sequelize=require(_0xf4f6('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xf4f6('0x1'),_0xf4f6('0x2'),_0xf4f6('0x3'),_0xf4f6('0x4'),_0xf4f6('0x5')),'defaultValue':_0xf4f6('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf4f6('0x6')]},'keyType':{'type':Sequelize[_0xf4f6('0x7')](_0xf4f6('0x1'),'variable',_0xf4f6('0x3'))},'keyContent':{'type':Sequelize[_0xf4f6('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf4f6('0x6')]},'customField':{'type':Sequelize[_0xf4f6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf4f6('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 426678a..791439d 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 _0xc420=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ZendeskField','include','rows','show','params','keys','includeAll','find','create','body','catch','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length'];(function(_0x577385,_0x1c2d69){var _0x5e52d0=function(_0x4e29b5){while(--_0x4e29b5){_0x577385['push'](_0x577385['shift']());}};_0x5e52d0(++_0x1c2d69);}(_0xc420,0x143));var _0x0c42=function(_0x3a53f2,_0x2e5f6f){_0x3a53f2=_0x3a53f2-0x0;var _0x1033bf=_0xc420[_0x3a53f2];return _0x1033bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c42('0x0'));var zipdir=require(_0x0c42('0x1'));var jsonpatch=require(_0x0c42('0x2'));var rp=require(_0x0c42('0x3'));var moment=require(_0x0c42('0x4'));var BPromise=require(_0x0c42('0x5'));var Mustache=require(_0x0c42('0x6'));var util=require(_0x0c42('0x7'));var path=require('path');var sox=require(_0x0c42('0x8'));var csv=require(_0x0c42('0x9'));var ejs=require(_0x0c42('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c42('0xb'));var squel=require('squel');var crypto=require(_0x0c42('0xc'));var jsforce=require(_0x0c42('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0c42('0xe'));var Redis=require('ioredis');var authService=require(_0x0c42('0xf'));var qs=require(_0x0c42('0x10'));var as=require(_0x0c42('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c42('0x12'))(_0x0c42('0x13'));var utils=require(_0x0c42('0x14'));var config=require(_0x0c42('0x15'));var licenseUtil=require(_0x0c42('0x16'));var db=require(_0x0c42('0x17'))['db'];function respondWithStatusCode(_0x2d63bd,_0x4e459e){_0x4e459e=_0x4e459e||0xcc;return function(_0x220624){if(_0x220624){return _0x2d63bd[_0x0c42('0x18')](_0x4e459e);}return _0x2d63bd[_0x0c42('0x19')](_0x4e459e)[_0x0c42('0x1a')]();};}function respondWithResult(_0x11dae2,_0x15339){_0x15339=_0x15339||0xc8;return function(_0xbe14bb){if(_0xbe14bb){return _0x11dae2[_0x0c42('0x19')](_0x15339)[_0x0c42('0x1b')](_0xbe14bb);}};}function respondWithFilteredResult(_0x38d566,_0x35b56e){return function(_0x4da891){if(_0x4da891){var _0x42d5c3=typeof _0x35b56e[_0x0c42('0x1c')]===_0x0c42('0x1d')&&typeof _0x35b56e[_0x0c42('0x1e')]==='undefined';var _0x3835ef=_0x4da891[_0x0c42('0x1f')];var _0x217a67=_0x42d5c3?0x0:_0x35b56e[_0x0c42('0x1c')];var _0x3bfc82=_0x42d5c3?_0x4da891[_0x0c42('0x1f')]:_0x35b56e[_0x0c42('0x1c')]+_0x35b56e[_0x0c42('0x1e')];var _0xdbfda3;if(_0x3bfc82>=_0x3835ef){_0x3bfc82=_0x3835ef;_0xdbfda3=0xc8;}else{_0xdbfda3=0xce;}_0x38d566[_0x0c42('0x19')](_0xdbfda3);return _0x38d566[_0x0c42('0x20')]('Content-Range',_0x217a67+'-'+_0x3bfc82+'/'+_0x3835ef)[_0x0c42('0x1b')](_0x4da891);}return null;};}function patchUpdates(_0x22c57a){return function(_0x497c55){try{jsonpatch[_0x0c42('0x21')](_0x497c55,_0x22c57a,!![]);}catch(_0x3668f8){return BPromise['reject'](_0x3668f8);}return _0x497c55[_0x0c42('0x22')]();};}function saveUpdates(_0x31ecf2,_0x388ef5){return function(_0x37a0d5){if(_0x37a0d5){return _0x37a0d5['update'](_0x31ecf2)[_0x0c42('0x23')](function(_0xe6bf3f){return _0xe6bf3f;});}return null;};}function removeEntity(_0x2d945a,_0x3e7d1f){return function(_0x3890df){if(_0x3890df){return _0x3890df[_0x0c42('0x24')]()[_0x0c42('0x23')](function(){_0x2d945a['status'](0xcc)[_0x0c42('0x1a')]();});}};}function handleEntityNotFound(_0x53135f,_0x4ec0e5){return function(_0x3de5d1){if(!_0x3de5d1){_0x53135f[_0x0c42('0x18')](0x194);}return _0x3de5d1;};}function handleError(_0x551cec,_0x36fdcf){_0x36fdcf=_0x36fdcf||0x1f4;return function(_0x42ded1){logger[_0x0c42('0x25')](_0x42ded1[_0x0c42('0x26')]);if(_0x42ded1[_0x0c42('0x27')]){delete _0x42ded1[_0x0c42('0x27')];}_0x551cec[_0x0c42('0x19')](_0x36fdcf)[_0x0c42('0x28')](_0x42ded1);};}exports['index']=function(_0x2b6d10,_0x3090c8){var _0xe3346={},_0x7331f={},_0x1554cb={'count':0x0,'rows':[]};var _0x35f4e5=_[_0x0c42('0x29')](db['ZendeskField'][_0x0c42('0x2a')],function(_0x51322b){return{'name':_0x51322b[_0x0c42('0x2b')],'type':_0x51322b['type'][_0x0c42('0x2c')]};});_0x7331f['model']=_['map'](_0x35f4e5,_0x0c42('0x27'));_0x7331f['query']=_['keys'](_0x2b6d10[_0x0c42('0x2d')]);_0x7331f[_0x0c42('0x2e')]=_[_0x0c42('0x2f')](_0x7331f[_0x0c42('0x30')],_0x7331f[_0x0c42('0x2d')]);_0xe3346[_0x0c42('0x31')]=_['intersection'](_0x7331f[_0x0c42('0x30')],qs[_0x0c42('0x32')](_0x2b6d10['query'][_0x0c42('0x32')]));_0xe3346[_0x0c42('0x31')]=_0xe3346[_0x0c42('0x31')][_0x0c42('0x33')]?_0xe3346[_0x0c42('0x31')]:_0x7331f[_0x0c42('0x30')];if(!_0x2b6d10[_0x0c42('0x2d')][_0x0c42('0x34')](_0x0c42('0x35'))){_0xe3346[_0x0c42('0x1e')]=qs['limit'](_0x2b6d10[_0x0c42('0x2d')]['limit']);_0xe3346[_0x0c42('0x1c')]=qs['offset'](_0x2b6d10[_0x0c42('0x2d')][_0x0c42('0x1c')]);}_0xe3346[_0x0c42('0x36')]=qs[_0x0c42('0x37')](_0x2b6d10[_0x0c42('0x2d')]['sort']);_0xe3346[_0x0c42('0x38')]=qs[_0x0c42('0x2e')](_[_0x0c42('0x39')](_0x2b6d10['query'],_0x7331f[_0x0c42('0x2e')]),_0x35f4e5);if(_0x2b6d10[_0x0c42('0x2d')][_0x0c42('0x3a')]){_0xe3346[_0x0c42('0x38')]=_[_0x0c42('0x3b')](_0xe3346[_0x0c42('0x38')],{'$or':_[_0x0c42('0x29')](_0x35f4e5,function(_0x558a11){if(_0x558a11[_0x0c42('0x3c')]!==_0x0c42('0x3d')){var _0x17d576={};_0x17d576[_0x558a11[_0x0c42('0x27')]]={'$like':'%'+_0x2b6d10[_0x0c42('0x2d')][_0x0c42('0x3a')]+'%'};return _0x17d576;}})});}_0xe3346=_['merge']({},_0xe3346,_0x2b6d10[_0x0c42('0x3e')]);var _0x3b7eaf={'where':_0xe3346[_0x0c42('0x38')]};return db[_0x0c42('0x3f')][_0x0c42('0x1f')](_0x3b7eaf)['then'](function(_0x474cad){_0x1554cb[_0x0c42('0x1f')]=_0x474cad;if(_0x2b6d10[_0x0c42('0x2d')]['includeAll']){_0xe3346[_0x0c42('0x40')]=[{'all':!![]}];}return db[_0x0c42('0x3f')]['findAll'](_0xe3346);})[_0x0c42('0x23')](function(_0x8c5670){_0x1554cb[_0x0c42('0x41')]=_0x8c5670;return _0x1554cb;})[_0x0c42('0x23')](respondWithFilteredResult(_0x3090c8,_0xe3346))['catch'](handleError(_0x3090c8,null));};exports[_0x0c42('0x42')]=function(_0x4e09fc,_0x651c79){var _0x2d01ef={'raw':!![],'where':{'id':_0x4e09fc[_0x0c42('0x43')]['id']}},_0x48cfa4={};_0x48cfa4[_0x0c42('0x30')]=_[_0x0c42('0x44')](db[_0x0c42('0x3f')]['rawAttributes']);_0x48cfa4[_0x0c42('0x2d')]=_[_0x0c42('0x44')](_0x4e09fc['query']);_0x48cfa4['filters']=_[_0x0c42('0x2f')](_0x48cfa4[_0x0c42('0x30')],_0x48cfa4['query']);_0x2d01ef[_0x0c42('0x31')]=_[_0x0c42('0x2f')](_0x48cfa4[_0x0c42('0x30')],qs['fields'](_0x4e09fc[_0x0c42('0x2d')][_0x0c42('0x32')]));_0x2d01ef['attributes']=_0x2d01ef[_0x0c42('0x31')][_0x0c42('0x33')]?_0x2d01ef[_0x0c42('0x31')]:_0x48cfa4[_0x0c42('0x30')];if(_0x4e09fc[_0x0c42('0x2d')][_0x0c42('0x45')]){_0x2d01ef[_0x0c42('0x40')]=[{'all':!![]}];}_0x2d01ef=_[_0x0c42('0x3b')]({},_0x2d01ef,_0x4e09fc['options']);return db[_0x0c42('0x3f')][_0x0c42('0x46')](_0x2d01ef)['then'](handleEntityNotFound(_0x651c79,null))[_0x0c42('0x23')](respondWithResult(_0x651c79,null))['catch'](handleError(_0x651c79,null));};exports[_0x0c42('0x47')]=function(_0x18db5c,_0x1d524a){return db[_0x0c42('0x3f')][_0x0c42('0x47')](_0x18db5c[_0x0c42('0x48')],{})[_0x0c42('0x23')](respondWithResult(_0x1d524a,0xc9))[_0x0c42('0x49')](handleError(_0x1d524a,null));};exports[_0x0c42('0x4a')]=function(_0x34c99d,_0x3b957b){if(_0x34c99d[_0x0c42('0x48')]['id']){delete _0x34c99d[_0x0c42('0x48')]['id'];}return db[_0x0c42('0x3f')][_0x0c42('0x46')]({'where':{'id':_0x34c99d[_0x0c42('0x43')]['id']}})['then'](handleEntityNotFound(_0x3b957b,null))[_0x0c42('0x23')](saveUpdates(_0x34c99d[_0x0c42('0x48')],null))[_0x0c42('0x23')](respondWithResult(_0x3b957b,null))[_0x0c42('0x49')](handleError(_0x3b957b,null));};exports[_0x0c42('0x24')]=function(_0x1b5f98,_0x4378f1){return db[_0x0c42('0x3f')]['find']({'where':{'id':_0x1b5f98[_0x0c42('0x43')]['id']}})[_0x0c42('0x23')](handleEntityNotFound(_0x4378f1,null))[_0x0c42('0x23')](removeEntity(_0x4378f1,null))[_0x0c42('0x49')](handleError(_0x4378f1,null));}; \ No newline at end of file +var _0x3445=['VIRTUAL','options','ZendeskField','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','eml-format','rimraf','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map'];(function(_0x1a59cf,_0x1ce9fe){var _0x49da6d=function(_0xedb193){while(--_0xedb193){_0x1a59cf['push'](_0x1a59cf['shift']());}};_0x49da6d(++_0x1ce9fe);}(_0x3445,0x13a));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5344('0x0'));var rimraf=require(_0x5344('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5344('0x2'));var moment=require(_0x5344('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5344('0x4'));var util=require(_0x5344('0x5'));var path=require(_0x5344('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5344('0x7'));var fs=require('fs');var fs_extra=require(_0x5344('0x8'));var _=require(_0x5344('0x9'));var squel=require(_0x5344('0xa'));var crypto=require(_0x5344('0xb'));var jsforce=require(_0x5344('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5344('0xd'));var querystring=require('querystring');var Papa=require(_0x5344('0xe'));var Redis=require('ioredis');var authService=require(_0x5344('0xf'));var qs=require(_0x5344('0x10'));var as=require(_0x5344('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5344('0x12'))(_0x5344('0x13'));var utils=require(_0x5344('0x14'));var config=require(_0x5344('0x15'));var licenseUtil=require(_0x5344('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39bb8e,_0x3f6820){_0x3f6820=_0x3f6820||0xcc;return function(_0x1e434d){if(_0x1e434d){return _0x39bb8e[_0x5344('0x17')](_0x3f6820);}return _0x39bb8e['status'](_0x3f6820)[_0x5344('0x18')]();};}function respondWithResult(_0x5a0c13,_0x18e0b2){_0x18e0b2=_0x18e0b2||0xc8;return function(_0x1c8482){if(_0x1c8482){return _0x5a0c13[_0x5344('0x19')](_0x18e0b2)['json'](_0x1c8482);}};}function respondWithFilteredResult(_0xde221d,_0x5b3c6a){return function(_0x5c1fa){if(_0x5c1fa){var _0x20c03c=typeof _0x5b3c6a[_0x5344('0x1a')]===_0x5344('0x1b')&&typeof _0x5b3c6a[_0x5344('0x1c')]===_0x5344('0x1b');var _0x5dab63=_0x5c1fa[_0x5344('0x1d')];var _0x5ee0a3=_0x20c03c?0x0:_0x5b3c6a[_0x5344('0x1a')];var _0x193492=_0x20c03c?_0x5c1fa[_0x5344('0x1d')]:_0x5b3c6a[_0x5344('0x1a')]+_0x5b3c6a['limit'];var _0x2c6a92;if(_0x193492>=_0x5dab63){_0x193492=_0x5dab63;_0x2c6a92=0xc8;}else{_0x2c6a92=0xce;}_0xde221d[_0x5344('0x19')](_0x2c6a92);return _0xde221d['set'](_0x5344('0x1e'),_0x5ee0a3+'-'+_0x193492+'/'+_0x5dab63)[_0x5344('0x1f')](_0x5c1fa);}return null;};}function patchUpdates(_0x3418da){return function(_0x476996){try{jsonpatch[_0x5344('0x20')](_0x476996,_0x3418da,!![]);}catch(_0x19223e){return BPromise[_0x5344('0x21')](_0x19223e);}return _0x476996[_0x5344('0x22')]();};}function saveUpdates(_0x15fe2d,_0x1ebec4){return function(_0xa2c6){if(_0xa2c6){return _0xa2c6['update'](_0x15fe2d)['then'](function(_0xa71828){return _0xa71828;});}return null;};}function removeEntity(_0x108343,_0x5391d3){return function(_0x487993){if(_0x487993){return _0x487993[_0x5344('0x23')]()[_0x5344('0x24')](function(){_0x108343[_0x5344('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b57b5,_0x431097){return function(_0x4ebe8e){if(!_0x4ebe8e){_0x2b57b5[_0x5344('0x17')](0x194);}return _0x4ebe8e;};}function handleError(_0x36ec7e,_0x228cb7){_0x228cb7=_0x228cb7||0x1f4;return function(_0x40a061){logger[_0x5344('0x25')](_0x40a061[_0x5344('0x26')]);if(_0x40a061[_0x5344('0x27')]){delete _0x40a061[_0x5344('0x27')];}_0x36ec7e[_0x5344('0x19')](_0x228cb7)[_0x5344('0x28')](_0x40a061);};}exports['index']=function(_0x6030a7,_0xf09839){var _0x31f662={},_0x33104c={},_0x5d5c09={'count':0x0,'rows':[]};var _0x5c930d=_['map'](db['ZendeskField'][_0x5344('0x29')],function(_0x37d4b0){return{'name':_0x37d4b0[_0x5344('0x2a')],'type':_0x37d4b0[_0x5344('0x2b')][_0x5344('0x2c')]};});_0x33104c[_0x5344('0x2d')]=_['map'](_0x5c930d,'name');_0x33104c['query']=_[_0x5344('0x2e')](_0x6030a7[_0x5344('0x2f')]);_0x33104c[_0x5344('0x30')]=_[_0x5344('0x31')](_0x33104c['model'],_0x33104c[_0x5344('0x2f')]);_0x31f662['attributes']=_[_0x5344('0x31')](_0x33104c['model'],qs[_0x5344('0x32')](_0x6030a7[_0x5344('0x2f')]['fields']));_0x31f662[_0x5344('0x33')]=_0x31f662[_0x5344('0x33')]['length']?_0x31f662[_0x5344('0x33')]:_0x33104c['model'];if(!_0x6030a7[_0x5344('0x2f')][_0x5344('0x34')](_0x5344('0x35'))){_0x31f662[_0x5344('0x1c')]=qs[_0x5344('0x1c')](_0x6030a7[_0x5344('0x2f')][_0x5344('0x1c')]);_0x31f662[_0x5344('0x1a')]=qs['offset'](_0x6030a7[_0x5344('0x2f')]['offset']);}_0x31f662[_0x5344('0x36')]=qs[_0x5344('0x37')](_0x6030a7['query'][_0x5344('0x37')]);_0x31f662[_0x5344('0x38')]=qs[_0x5344('0x30')](_[_0x5344('0x39')](_0x6030a7[_0x5344('0x2f')],_0x33104c[_0x5344('0x30')]),_0x5c930d);if(_0x6030a7['query'][_0x5344('0x3a')]){_0x31f662[_0x5344('0x38')]=_[_0x5344('0x3b')](_0x31f662[_0x5344('0x38')],{'$or':_[_0x5344('0x3c')](_0x5c930d,function(_0x931eab){if(_0x931eab[_0x5344('0x2b')]!==_0x5344('0x3d')){var _0x191341={};_0x191341[_0x931eab[_0x5344('0x27')]]={'$like':'%'+_0x6030a7['query'][_0x5344('0x3a')]+'%'};return _0x191341;}})});}_0x31f662=_[_0x5344('0x3b')]({},_0x31f662,_0x6030a7[_0x5344('0x3e')]);var _0x4654b2={'where':_0x31f662[_0x5344('0x38')]};return db[_0x5344('0x3f')][_0x5344('0x1d')](_0x4654b2)[_0x5344('0x24')](function(_0x272578){_0x5d5c09['count']=_0x272578;if(_0x6030a7[_0x5344('0x2f')][_0x5344('0x40')]){_0x31f662[_0x5344('0x41')]=[{'all':!![]}];}return db[_0x5344('0x3f')][_0x5344('0x42')](_0x31f662);})[_0x5344('0x24')](function(_0x12baaf){_0x5d5c09[_0x5344('0x43')]=_0x12baaf;return _0x5d5c09;})['then'](respondWithFilteredResult(_0xf09839,_0x31f662))[_0x5344('0x44')](handleError(_0xf09839,null));};exports[_0x5344('0x45')]=function(_0x1d886e,_0x559370){var _0x177c5f={'raw':!![],'where':{'id':_0x1d886e[_0x5344('0x46')]['id']}},_0x967d70={};_0x967d70['model']=_[_0x5344('0x2e')](db[_0x5344('0x3f')]['rawAttributes']);_0x967d70['query']=_[_0x5344('0x2e')](_0x1d886e['query']);_0x967d70[_0x5344('0x30')]=_[_0x5344('0x31')](_0x967d70[_0x5344('0x2d')],_0x967d70[_0x5344('0x2f')]);_0x177c5f[_0x5344('0x33')]=_[_0x5344('0x31')](_0x967d70[_0x5344('0x2d')],qs[_0x5344('0x32')](_0x1d886e[_0x5344('0x2f')][_0x5344('0x32')]));_0x177c5f[_0x5344('0x33')]=_0x177c5f[_0x5344('0x33')]['length']?_0x177c5f['attributes']:_0x967d70[_0x5344('0x2d')];if(_0x1d886e[_0x5344('0x2f')][_0x5344('0x40')]){_0x177c5f['include']=[{'all':!![]}];}_0x177c5f=_[_0x5344('0x3b')]({},_0x177c5f,_0x1d886e[_0x5344('0x3e')]);return db[_0x5344('0x3f')][_0x5344('0x47')](_0x177c5f)[_0x5344('0x24')](handleEntityNotFound(_0x559370,null))[_0x5344('0x24')](respondWithResult(_0x559370,null))[_0x5344('0x44')](handleError(_0x559370,null));};exports[_0x5344('0x48')]=function(_0x23793c,_0xb828d7){return db[_0x5344('0x3f')][_0x5344('0x48')](_0x23793c['body'],{})['then'](respondWithResult(_0xb828d7,0xc9))[_0x5344('0x44')](handleError(_0xb828d7,null));};exports[_0x5344('0x49')]=function(_0x85cb69,_0x4872ae){if(_0x85cb69['body']['id']){delete _0x85cb69['body']['id'];}return db[_0x5344('0x3f')][_0x5344('0x47')]({'where':{'id':_0x85cb69['params']['id']}})[_0x5344('0x24')](handleEntityNotFound(_0x4872ae,null))[_0x5344('0x24')](saveUpdates(_0x85cb69[_0x5344('0x4a')],null))[_0x5344('0x24')](respondWithResult(_0x4872ae,null))[_0x5344('0x44')](handleError(_0x4872ae,null));};exports[_0x5344('0x23')]=function(_0x1f10cf,_0x192b61){return db[_0x5344('0x3f')][_0x5344('0x47')]({'where':{'id':_0x1f10cf[_0x5344('0x46')]['id']}})[_0x5344('0x24')](handleEntityNotFound(_0x192b61,null))['then'](removeEntity(_0x192b61,null))[_0x5344('0x44')](handleError(_0x192b61,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index f76c392..5143010 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 _0xa2cf=['zendesk_unique_index','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZendeskField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2cf,0x195));var _0xfa2c=function(_0x4064b7,_0x19d402){_0x4064b7=_0x4064b7-0x0;var _0x3ad477=_0xa2cf[_0x4064b7];return _0x3ad477;};'use strict';var _=require('lodash');var util=require(_0xfa2c('0x0'));var logger=require(_0xfa2c('0x1'))('api');var moment=require(_0xfa2c('0x2'));var BPromise=require(_0xfa2c('0x3'));var rp=require(_0xfa2c('0x4'));var fs=require('fs');var path=require(_0xfa2c('0x5'));var rimraf=require(_0xfa2c('0x6'));var config=require(_0xfa2c('0x7'));var attributes=require('./intZendeskField.attributes');module[_0xfa2c('0x8')]=function(_0x578d55,_0x3d97e1){return _0x578d55[_0xfa2c('0x9')](_0xfa2c('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xfa2c('0xb'),'fields':['idField',_0xfa2c('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf8ac=['./intZendeskField.attributes','exports','define','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1fb866,_0xdd13e0){var _0xf508d5=function(_0x1b8603){while(--_0x1b8603){_0x1fb866['push'](_0x1fb866['shift']());}};_0xf508d5(++_0xdd13e0);}(_0xf8ac,0xa0));var _0xcf8a=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0xf8ac[_0x36f47c];return _0x296c55;};'use strict';var _=require(_0xcf8a('0x0'));var util=require(_0xcf8a('0x1'));var logger=require(_0xcf8a('0x2'))('api');var moment=require(_0xcf8a('0x3'));var BPromise=require(_0xcf8a('0x4'));var rp=require(_0xcf8a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf8a('0x6'));var config=require(_0xcf8a('0x7'));var attributes=require(_0xcf8a('0x8'));module[_0xcf8a('0x9')]=function(_0x4f5047,_0x43ba14){return _0x4f5047[_0xcf8a('0xa')]('ZendeskField',attributes,{'tableName':_0xcf8a('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xcf8a('0xc'),_0xcf8a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 99ebe3e..17b2811 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 _0x8d3f=['info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then'];(function(_0xceae8b,_0x1d9fd0){var _0x250303=function(_0x2dd5fb){while(--_0x2dd5fb){_0xceae8b['push'](_0xceae8b['shift']());}};_0x250303(++_0x1d9fd0);}(_0x8d3f,0x11e));var _0xf8d3=function(_0x2cd50b,_0xec6d64){_0x2cd50b=_0x2cd50b-0x0;var _0x36ffca=_0x8d3f[_0x2cd50b];return _0x36ffca;};'use strict';var _=require(_0xf8d3('0x0'));var util=require(_0xf8d3('0x1'));var moment=require(_0xf8d3('0x2'));var BPromise=require(_0xf8d3('0x3'));var rs=require(_0xf8d3('0x4'));var fs=require('fs');var Redis=require(_0xf8d3('0x5'));var db=require(_0xf8d3('0x6'))['db'];var utils=require(_0xf8d3('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf8d3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf8d3('0x9')][_0xf8d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x445630,_0x333723,_0x14f3df){return new BPromise(function(_0xfc16f4,_0x74fb76){return client[_0xf8d3('0xb')](_0x445630,_0x14f3df)[_0xf8d3('0xc')](function(_0x135813){logger[_0xf8d3('0xd')]('ZendeskField,\x20%s,\x20%s',_0x333723,_0xf8d3('0xe'));logger[_0xf8d3('0xf')](_0xf8d3('0x10'),_0x333723,_0xf8d3('0xe'),JSON[_0xf8d3('0x11')](_0x135813));if(_0x135813['error']){if(_0x135813[_0xf8d3('0x12')][_0xf8d3('0x13')]===0x1f4){logger['error'](_0xf8d3('0x14'),_0x333723,_0x135813[_0xf8d3('0x12')]['message']);return _0x74fb76(_0x135813[_0xf8d3('0x12')][_0xf8d3('0x15')]);}logger[_0xf8d3('0x12')]('ZendeskField,\x20%s,\x20%s',_0x333723,_0x135813[_0xf8d3('0x12')]['message']);return _0xfc16f4(_0x135813[_0xf8d3('0x12')][_0xf8d3('0x15')]);}else{logger[_0xf8d3('0xd')](_0xf8d3('0x14'),_0x333723,_0xf8d3('0xe'));_0xfc16f4(_0x135813[_0xf8d3('0x16')][_0xf8d3('0x15')]);}})['catch'](function(_0x243162){logger['error'](_0xf8d3('0x14'),_0x333723,_0x243162);_0x74fb76(_0x243162);});});} \ No newline at end of file +var _0xb9bd=['client','request','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x680821,_0x23e67f){var _0x3f132c=function(_0x1bbcea){while(--_0x1bbcea){_0x680821['push'](_0x680821['shift']());}};_0x3f132c(++_0x23e67f);}(_0xb9bd,0x170));var _0xdb9b=function(_0x38cd1a,_0xfd5008){_0x38cd1a=_0x38cd1a-0x0;var _0x43b6ce=_0xb9bd[_0x38cd1a];return _0x43b6ce;};'use strict';var _=require(_0xdb9b('0x0'));var util=require(_0xdb9b('0x1'));var moment=require(_0xdb9b('0x2'));var BPromise=require('bluebird');var rs=require(_0xdb9b('0x3'));var fs=require('fs');var Redis=require(_0xdb9b('0x4'));var db=require(_0xdb9b('0x5'))['db'];var utils=require(_0xdb9b('0x6'));var logger=require(_0xdb9b('0x7'))(_0xdb9b('0x8'));var config=require(_0xdb9b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdb9b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a456a,_0x4dfff0,_0x57b1e3){return new BPromise(function(_0x363c93,_0x25636b){return client[_0xdb9b('0xb')](_0x3a456a,_0x57b1e3)['then'](function(_0x3661d3){logger[_0xdb9b('0xc')](_0xdb9b('0xd'),_0x4dfff0,'request\x20sent');logger[_0xdb9b('0xe')](_0xdb9b('0xf'),_0x4dfff0,_0xdb9b('0x10'),JSON[_0xdb9b('0x11')](_0x3661d3));if(_0x3661d3['error']){if(_0x3661d3['error'][_0xdb9b('0x12')]===0x1f4){logger[_0xdb9b('0x13')](_0xdb9b('0xd'),_0x4dfff0,_0x3661d3[_0xdb9b('0x13')]['message']);return _0x25636b(_0x3661d3[_0xdb9b('0x13')]['message']);}logger[_0xdb9b('0x13')](_0xdb9b('0xd'),_0x4dfff0,_0x3661d3[_0xdb9b('0x13')]['message']);return _0x363c93(_0x3661d3[_0xdb9b('0x13')][_0xdb9b('0x14')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x4dfff0,'request\x20sent');_0x363c93(_0x3661d3['result'][_0xdb9b('0x14')]);}})['catch'](function(_0xa5edb4){logger[_0xdb9b('0x13')](_0xdb9b('0xd'),_0x4dfff0,_0xa5edb4);_0x25636b(_0xa5edb4);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 3de662b..1706562 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 _0xd407=['show','/:id/configurations','/:id/fields','getFields','post','create','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id'];(function(_0x3c96b6,_0xf57a10){var _0xfaa232=function(_0x25697b){while(--_0x25697b){_0x3c96b6['push'](_0x3c96b6['shift']());}};_0xfaa232(++_0xf57a10);}(_0xd407,0x111));var _0x7d40=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd407[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x7d40('0x0'));var path=require(_0x7d40('0x1'));var timeout=require(_0x7d40('0x2'));var express=require(_0x7d40('0x3'));var router=express[_0x7d40('0x4')]();var fs_extra=require(_0x7d40('0x5'));var auth=require(_0x7d40('0x6'));var interaction=require(_0x7d40('0x7'));var config=require(_0x7d40('0x8'));var controller=require(_0x7d40('0x9'));router[_0x7d40('0xa')]('/',auth[_0x7d40('0xb')](),controller['index']);router[_0x7d40('0xa')](_0x7d40('0xc'),auth['isAuthenticated'](),controller[_0x7d40('0xd')]);router[_0x7d40('0xa')](_0x7d40('0xe'),auth[_0x7d40('0xb')](),controller['getConfigurations']);router['get'](_0x7d40('0xf'),auth['isAuthenticated'](),controller[_0x7d40('0x10')]);router[_0x7d40('0x11')]('/',auth[_0x7d40('0xb')](),controller[_0x7d40('0x12')]);router[_0x7d40('0x11')]('/:id/configurations',auth[_0x7d40('0xb')](),controller['addConfiguration']);router[_0x7d40('0x13')](_0x7d40('0xc'),auth[_0x7d40('0xb')](),controller[_0x7d40('0x14')]);router[_0x7d40('0x15')](_0x7d40('0xc'),auth[_0x7d40('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x701e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x11d648,_0x1b3f99){var _0x2ab71a=function(_0x92a25a){while(--_0x92a25a){_0x11d648['push'](_0x11d648['shift']());}};_0x2ab71a(++_0x1b3f99);}(_0x701e,0x103));var _0xe701=function(_0x116efd,_0x382b8c){_0x116efd=_0x116efd-0x0;var _0x31d8ca=_0x701e[_0x116efd];return _0x31d8ca;};'use strict';var multer=require('multer');var util=require(_0xe701('0x0'));var path=require(_0xe701('0x1'));var timeout=require('connect-timeout');var express=require(_0xe701('0x2'));var router=express[_0xe701('0x3')]();var fs_extra=require(_0xe701('0x4'));var auth=require(_0xe701('0x5'));var interaction=require(_0xe701('0x6'));var config=require(_0xe701('0x7'));var controller=require('./intZohoAccount.controller');router[_0xe701('0x8')]('/',auth[_0xe701('0x9')](),controller[_0xe701('0xa')]);router[_0xe701('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe701('0x8')](_0xe701('0xb'),auth[_0xe701('0x9')](),controller[_0xe701('0xc')]);router[_0xe701('0x8')](_0xe701('0xd'),auth[_0xe701('0x9')](),controller[_0xe701('0xe')]);router[_0xe701('0xf')]('/',auth[_0xe701('0x9')](),controller[_0xe701('0x10')]);router[_0xe701('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xe701('0x11')]);router[_0xe701('0x12')](_0xe701('0x13'),auth[_0xe701('0x9')](),controller['update']);router['delete'](_0xe701('0x13'),auth[_0xe701('0x9')](),controller[_0xe701('0x14')]);module[_0xe701('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index ea05ac8..6b664bb 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 _0x5b02=['exports','STRING','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5b02,0xe9));var _0x25b0=function(_0x2a519f,_0x13d592){_0x2a519f=_0x2a519f-0x0;var _0x4a38dc=_0x5b02[_0x2a519f];return _0x4a38dc;};'use strict';var Sequelize=require(_0x25b0('0x0'));module[_0x25b0('0x1')]={'name':{'type':Sequelize[_0x25b0('0x2')]},'description':{'type':Sequelize[_0x25b0('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x25b0('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x25b0('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x25b0('0x2')]},'refreshToken':{'type':Sequelize[_0x25b0('0x2')]}}; \ No newline at end of file +var _0x99e9=['exports','STRING'];(function(_0x309429,_0x88f202){var _0x4f06a6=function(_0x12f0a6){while(--_0x12f0a6){_0x309429['push'](_0x309429['shift']());}};_0x4f06a6(++_0x88f202);}(_0x99e9,0xb4));var _0x999e=function(_0x35c300,_0x284351){_0x35c300=_0x35c300-0x0;var _0x59e44b=_0x99e9[_0x35c300];return _0x59e44b;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'name':{'type':Sequelize[_0x999e('0x1')]},'description':{'type':Sequelize[_0x999e('0x1')]},'host':{'type':Sequelize[_0x999e('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x999e('0x1')]},'clientSecret':{'type':Sequelize[_0x999e('0x1')]},'serverUrl':{'type':Sequelize[_0x999e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x999e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 64c4577..208e8f0 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 _0xacf4=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','limit','undefined','count','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ZohoAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getConfigurations','findOne','ZohoConfiguration','pick','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientId','serverUrl','com','slice','substring','lastIndexOf','refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0xacf4,0x76));var _0x4acf=function(_0x54bd6b,_0x4cc82e){_0x54bd6b=_0x54bd6b-0x0;var _0x25f308=_0xacf4[_0x54bd6b];return _0x25f308;};'use strict';var emlformat=require(_0x4acf('0x0'));var rimraf=require(_0x4acf('0x1'));var zipdir=require(_0x4acf('0x2'));var jsonpatch=require(_0x4acf('0x3'));var rp=require('request-promise');var moment=require(_0x4acf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4acf('0x5'));var util=require('util');var path=require(_0x4acf('0x6'));var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require(_0x4acf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require(_0x4acf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4acf('0xf'));var Papa=require(_0x4acf('0x10'));var Redis=require(_0x4acf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4acf('0x12'));var as=require(_0x4acf('0x13'));var hardwareService=require(_0x4acf('0x14'));var logger=require(_0x4acf('0x15'))(_0x4acf('0x16'));var utils=require(_0x4acf('0x17'));var config=require(_0x4acf('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4acf('0x19'))['db'];var integrations=require(_0x4acf('0x1a'));function respondWithStatusCode(_0xe7c9e5,_0x31707a){_0x31707a=_0x31707a||0xcc;return function(_0x319414){if(_0x319414){return _0xe7c9e5[_0x4acf('0x1b')](_0x31707a);}return _0xe7c9e5['status'](_0x31707a)['end']();};}function respondWithResult(_0x469173,_0x11a9b1){_0x11a9b1=_0x11a9b1||0xc8;return function(_0x8c820d){if(_0x8c820d){return _0x469173[_0x4acf('0x1c')](_0x11a9b1)['json'](_0x8c820d);}};}function respondWithFilteredResult(_0x17f68e,_0x21582d){return function(_0x249e44){if(_0x249e44){var _0x14194f=typeof _0x21582d[_0x4acf('0x1d')]==='undefined'&&typeof _0x21582d[_0x4acf('0x1e')]===_0x4acf('0x1f');var _0x3e0099=_0x249e44[_0x4acf('0x20')];var _0x25687b=_0x14194f?0x0:_0x21582d[_0x4acf('0x1d')];var _0x288a59=_0x14194f?_0x249e44[_0x4acf('0x20')]:_0x21582d[_0x4acf('0x1d')]+_0x21582d['limit'];var _0x1022ae;if(_0x288a59>=_0x3e0099){_0x288a59=_0x3e0099;_0x1022ae=0xc8;}else{_0x1022ae=0xce;}_0x17f68e[_0x4acf('0x1c')](_0x1022ae);return _0x17f68e['set']('Content-Range',_0x25687b+'-'+_0x288a59+'/'+_0x3e0099)[_0x4acf('0x21')](_0x249e44);}return null;};}function patchUpdates(_0x42dadc){return function(_0xf7f1a7){try{jsonpatch[_0x4acf('0x22')](_0xf7f1a7,_0x42dadc,!![]);}catch(_0x3781d2){return BPromise[_0x4acf('0x23')](_0x3781d2);}return _0xf7f1a7[_0x4acf('0x24')]();};}function saveUpdates(_0x58d83d,_0x3b939b){return function(_0x11f7f1){if(_0x11f7f1){return _0x11f7f1[_0x4acf('0x25')](_0x58d83d)[_0x4acf('0x26')](function(_0x3be6e5){return _0x3be6e5;});}return null;};}function removeEntity(_0x427237,_0x37bb8e){return function(_0x109098){if(_0x109098){return _0x109098[_0x4acf('0x27')]()[_0x4acf('0x26')](function(){_0x427237[_0x4acf('0x1c')](0xcc)[_0x4acf('0x28')]();});}};}function handleEntityNotFound(_0x4970a0,_0xfb56a7){return function(_0xdaa5e7){if(!_0xdaa5e7){_0x4970a0['sendStatus'](0x194);}return _0xdaa5e7;};}function handleError(_0x3447c9,_0x891991){_0x891991=_0x891991||0x1f4;return function(_0x163736){logger[_0x4acf('0x29')](_0x163736[_0x4acf('0x2a')]);if(_0x163736[_0x4acf('0x2b')]){delete _0x163736[_0x4acf('0x2b')];}_0x3447c9[_0x4acf('0x1c')](_0x891991)[_0x4acf('0x2c')](_0x163736);};}exports[_0x4acf('0x2d')]=function(_0x51ccaa,_0x4c8f0b){var _0x43a352={},_0x5719ed={},_0x589170={'count':0x0,'rows':[]};var _0x1285ed=_[_0x4acf('0x2e')](db[_0x4acf('0x2f')]['rawAttributes'],function(_0x1d715d){return{'name':_0x1d715d[_0x4acf('0x30')],'type':_0x1d715d[_0x4acf('0x31')]['key']};});_0x5719ed[_0x4acf('0x32')]=_[_0x4acf('0x2e')](_0x1285ed,_0x4acf('0x2b'));_0x5719ed[_0x4acf('0x33')]=_[_0x4acf('0x34')](_0x51ccaa['query']);_0x5719ed[_0x4acf('0x35')]=_[_0x4acf('0x36')](_0x5719ed[_0x4acf('0x32')],_0x5719ed['query']);_0x43a352[_0x4acf('0x37')]=_[_0x4acf('0x36')](_0x5719ed[_0x4acf('0x32')],qs[_0x4acf('0x38')](_0x51ccaa[_0x4acf('0x33')][_0x4acf('0x38')]));_0x43a352['attributes']=_0x43a352[_0x4acf('0x37')][_0x4acf('0x39')]?_0x43a352[_0x4acf('0x37')]:_0x5719ed[_0x4acf('0x32')];if(!_0x51ccaa[_0x4acf('0x33')][_0x4acf('0x3a')]('nolimit')){_0x43a352[_0x4acf('0x1e')]=qs[_0x4acf('0x1e')](_0x51ccaa[_0x4acf('0x33')][_0x4acf('0x1e')]);_0x43a352[_0x4acf('0x1d')]=qs[_0x4acf('0x1d')](_0x51ccaa[_0x4acf('0x33')][_0x4acf('0x1d')]);}_0x43a352[_0x4acf('0x3b')]=qs['sort'](_0x51ccaa[_0x4acf('0x33')][_0x4acf('0x3c')]);_0x43a352[_0x4acf('0x3d')]=qs[_0x4acf('0x35')](_['pick'](_0x51ccaa[_0x4acf('0x33')],_0x5719ed[_0x4acf('0x35')]),_0x1285ed);if(_0x51ccaa[_0x4acf('0x33')]['filter']){_0x43a352[_0x4acf('0x3d')]=_[_0x4acf('0x3e')](_0x43a352[_0x4acf('0x3d')],{'$or':_[_0x4acf('0x2e')](_0x1285ed,function(_0x11f5b3){if(_0x11f5b3['type']!==_0x4acf('0x3f')){var _0x5657c2={};_0x5657c2[_0x11f5b3[_0x4acf('0x2b')]]={'$like':'%'+_0x51ccaa[_0x4acf('0x33')][_0x4acf('0x40')]+'%'};return _0x5657c2;}})});}_0x43a352=_[_0x4acf('0x3e')]({},_0x43a352,_0x51ccaa[_0x4acf('0x41')]);var _0x387dec={'where':_0x43a352[_0x4acf('0x3d')]};return db[_0x4acf('0x2f')][_0x4acf('0x20')](_0x387dec)[_0x4acf('0x26')](function(_0x3ac842){_0x589170[_0x4acf('0x20')]=_0x3ac842;if(_0x51ccaa[_0x4acf('0x33')][_0x4acf('0x42')]){_0x43a352[_0x4acf('0x43')]=[{'all':!![]}];}return db[_0x4acf('0x2f')][_0x4acf('0x44')](_0x43a352);})[_0x4acf('0x26')](function(_0x87c9ce){_0x589170[_0x4acf('0x45')]=_0x87c9ce;return _0x589170;})[_0x4acf('0x26')](respondWithFilteredResult(_0x4c8f0b,_0x43a352))[_0x4acf('0x46')](handleError(_0x4c8f0b,null));};exports[_0x4acf('0x47')]=function(_0x387950,_0x3679c6){var _0x138330={'raw':![],'where':{'id':_0x387950[_0x4acf('0x48')]['id']}},_0x501b98={};_0x501b98['model']=_['keys'](db[_0x4acf('0x2f')][_0x4acf('0x49')]);_0x501b98['query']=_[_0x4acf('0x34')](_0x387950[_0x4acf('0x33')]);_0x501b98[_0x4acf('0x35')]=_['intersection'](_0x501b98[_0x4acf('0x32')],_0x501b98['query']);_0x138330['attributes']=_['intersection'](_0x501b98[_0x4acf('0x32')],qs[_0x4acf('0x38')](_0x387950['query']['fields']));_0x138330[_0x4acf('0x37')]=_0x138330[_0x4acf('0x37')][_0x4acf('0x39')]?_0x138330[_0x4acf('0x37')]:_0x501b98[_0x4acf('0x32')];if(_0x387950[_0x4acf('0x33')]['includeAll']){_0x138330['include']=[{'all':!![]}];}_0x138330=_[_0x4acf('0x3e')]({},_0x138330,_0x387950[_0x4acf('0x41')]);return db[_0x4acf('0x2f')][_0x4acf('0x4a')](_0x138330)[_0x4acf('0x26')](handleEntityNotFound(_0x3679c6,null))['then'](respondWithResult(_0x3679c6,null))['catch'](handleError(_0x3679c6,null));};exports[_0x4acf('0x4b')]=function(_0x781893,_0x4c68ee){return db['ZohoAccount'][_0x4acf('0x4b')](_0x781893[_0x4acf('0x4c')],{})[_0x4acf('0x26')](respondWithResult(_0x4c68ee,0xc9))[_0x4acf('0x46')](handleError(_0x4c68ee,null));};exports[_0x4acf('0x25')]=function(_0x332697,_0x1115a7){if(_0x332697[_0x4acf('0x4c')]['id']){delete _0x332697[_0x4acf('0x4c')]['id'];}return db[_0x4acf('0x2f')][_0x4acf('0x4a')]({'where':{'id':_0x332697[_0x4acf('0x48')]['id']}})['then'](handleEntityNotFound(_0x1115a7,null))[_0x4acf('0x26')](saveUpdates(_0x332697[_0x4acf('0x4c')],null))['then'](respondWithResult(_0x1115a7,null))[_0x4acf('0x46')](handleError(_0x1115a7,null));};exports[_0x4acf('0x27')]=function(_0x2e76ca,_0x4c1a03){return db[_0x4acf('0x2f')]['find']({'where':{'id':_0x2e76ca[_0x4acf('0x48')]['id']}})[_0x4acf('0x26')](handleEntityNotFound(_0x4c1a03,null))[_0x4acf('0x26')](removeEntity(_0x4c1a03,null))[_0x4acf('0x46')](handleError(_0x4c1a03,null));};exports[_0x4acf('0x4d')]=function(_0x525db0,_0x3c4a1d,_0x5e4251){var _0x47f5f3={};var _0x70b38b={};var _0x927ac4;var _0x2e92d1;return db[_0x4acf('0x2f')][_0x4acf('0x4e')]({'where':{'id':_0x525db0[_0x4acf('0x48')]['id']}})[_0x4acf('0x26')](handleEntityNotFound(_0x3c4a1d,null))[_0x4acf('0x26')](function(_0x54f2cd){if(_0x54f2cd){_0x927ac4=_0x54f2cd;_0x70b38b[_0x4acf('0x32')]=_[_0x4acf('0x34')](db[_0x4acf('0x4f')]['rawAttributes']);_0x70b38b['query']=_[_0x4acf('0x34')](_0x525db0['query']);_0x70b38b[_0x4acf('0x35')]=_[_0x4acf('0x36')](_0x70b38b[_0x4acf('0x32')],_0x70b38b['query']);_0x47f5f3[_0x4acf('0x37')]=_[_0x4acf('0x36')](_0x70b38b['model'],qs[_0x4acf('0x38')](_0x525db0[_0x4acf('0x33')]['fields']));_0x47f5f3['attributes']=_0x47f5f3[_0x4acf('0x37')]['length']?_0x47f5f3['attributes']:_0x70b38b[_0x4acf('0x32')];_0x47f5f3[_0x4acf('0x3b')]=qs[_0x4acf('0x3c')](_0x525db0[_0x4acf('0x33')][_0x4acf('0x3c')]);_0x47f5f3[_0x4acf('0x3d')]=qs[_0x4acf('0x35')](_[_0x4acf('0x50')](_0x525db0[_0x4acf('0x33')],_0x70b38b['filters']));if(_0x525db0[_0x4acf('0x33')][_0x4acf('0x40')]){_0x47f5f3[_0x4acf('0x3d')]=_[_0x4acf('0x3e')](_0x47f5f3[_0x4acf('0x3d')],{'$or':_[_0x4acf('0x2e')](_0x47f5f3[_0x4acf('0x37')],function(_0x246ad5){var _0x10fdb5={};_0x10fdb5[_0x246ad5]={'$like':'%'+_0x525db0[_0x4acf('0x33')]['filter']+'%'};return _0x10fdb5;})});}_0x47f5f3=_[_0x4acf('0x3e')]({},_0x47f5f3,_0x525db0[_0x4acf('0x41')]);return _0x927ac4[_0x4acf('0x4d')](_0x47f5f3);}})[_0x4acf('0x26')](function(_0x599050){if(_0x599050){_0x2e92d1=_0x599050[_0x4acf('0x39')];if(!_0x525db0['query']['hasOwnProperty'](_0x4acf('0x51'))){_0x47f5f3[_0x4acf('0x1e')]=qs['limit'](_0x525db0[_0x4acf('0x33')]['limit']);_0x47f5f3[_0x4acf('0x1d')]=qs[_0x4acf('0x1d')](_0x525db0[_0x4acf('0x33')]['offset']);}return _0x927ac4[_0x4acf('0x4d')](_0x47f5f3);}})[_0x4acf('0x26')](function(_0x32f7a9){if(_0x32f7a9){return _0x32f7a9?{'count':_0x2e92d1,'rows':_0x32f7a9}:null;}})[_0x4acf('0x26')](respondWithResult(_0x3c4a1d,null))['catch'](handleError(_0x3c4a1d,null));};exports[_0x4acf('0x52')]=function(_0x5b9ad4,_0x5d53d7,_0x39d010){if(_0x5b9ad4[_0x4acf('0x4c')]['id']){delete _0x5b9ad4['body']['id'];}return db[_0x4acf('0x2f')][_0x4acf('0x4e')]({'where':{'id':_0x5b9ad4[_0x4acf('0x48')]['id']}})[_0x4acf('0x26')](handleEntityNotFound(_0x5d53d7,null))[_0x4acf('0x26')](function(_0x2962c5){if(_0x2962c5){_0x5b9ad4[_0x4acf('0x4c')]['AccountId']=_0x2962c5['id'];_0x5b9ad4[_0x4acf('0x4c')][_0x4acf('0x53')]=integrations[_0x4acf('0x54')](_0x5b9ad4[_0x4acf('0x4c')][_0x4acf('0x55')],_0x5b9ad4['body'][_0x4acf('0x31')]);_0x5b9ad4[_0x4acf('0x4c')][_0x4acf('0x56')]=integrations[_0x4acf('0x57')](_0x5b9ad4['body'][_0x4acf('0x55')],_0x5b9ad4[_0x4acf('0x4c')][_0x4acf('0x31')]);return db[_0x4acf('0x4f')][_0x4acf('0x4b')](_0x5b9ad4[_0x4acf('0x4c')],{'include':[{'model':db[_0x4acf('0x58')],'as':_0x4acf('0x53')},{'model':db[_0x4acf('0x58')],'as':_0x4acf('0x56')}]});}return null;})[_0x4acf('0x26')](respondWithResult(_0x5d53d7,null))[_0x4acf('0x46')](handleError(_0x5d53d7,null));};function getAccessToken(_0x533230){return new Promise(function(_0x379dfb,_0x3d35c1){var _0x2e313b;switch(_0x533230[_0x4acf('0x59')]){case'US':_0x2e313b=_0x4acf('0x5a');break;case'AU':_0x2e313b=_0x4acf('0x5b');break;case'EU':_0x2e313b=_0x4acf('0x5c');break;case'IN':_0x2e313b='https://accounts.zoho.in';break;case'CN':_0x2e313b=_0x4acf('0x5d');break;default:_0x2e313b='https://accounts.zoho.eu';break;}var _0xbf241={'method':_0x4acf('0x5e'),'uri':_0x2e313b+_0x4acf('0x5f'),'qs':{'refresh_token':_0x533230['refreshToken'],'client_id':_0x533230['clientId'],'client_secret':_0x533230[_0x4acf('0x60')],'grant_type':'refresh_token'},'json':!![]};return rp(_0xbf241)[_0x4acf('0x26')](function(_0x8330c7){if(_0x8330c7[_0x4acf('0x61')]){_0x379dfb(_0x8330c7[_0x4acf('0x61')]);}else{_0x3d35c1(_0x4acf('0x62'));}})['catch'](function(_0x2d3895){_0x3d35c1(_0x2d3895);});});}exports['getFields']=function(_0x318753,_0x3464da,_0x2cebd5){var _0x2896eb,_0x4bc821,_0x24d6a5,_0x4abc20,_0x578116;return db[_0x4acf('0x2f')][_0x4acf('0x4e')]({'where':{'id':_0x318753['params']['id']},'attributes':['id',_0x4acf('0x63'),_0x4acf('0x59'),_0x4acf('0x64'),_0x4acf('0x60'),_0x4acf('0x65'),'code','refreshToken']})[_0x4acf('0x26')](handleEntityNotFound(_0x3464da,null))[_0x4acf('0x26')](function(_0x4abfa0){_0x578116=_0x4abfa0;_0x2896eb=_0x578116[_0x4acf('0x63')];_0x4bc821=_0x2896eb==='zoho.eu'?'eu':_0x4acf('0x66');_0x24d6a5=_0x578116['serverUrl'];var _0x403622=_0x24d6a5[_0x4acf('0x67')](-0x1);if(_0x403622==='/'||_0x403622==='\x5c'||_0x403622===':'){_0x24d6a5=_0x24d6a5[_0x4acf('0x68')](0x0,_0x24d6a5[_0x4acf('0x69')](_0x403622));}if(!_0x578116[_0x4acf('0x6a')]){throw new Error(_0x4acf('0x6b'));}return getAccessToken(_0x578116);})['then'](function(_0x4c5c55){if(_0x4c5c55){return rp({'method':_0x4acf('0x6c'),'uri':util[_0x4acf('0x6d')](_0x4acf('0x6e'),_0x4bc821),'qs':{'module':_0x4acf('0x6f')},'headers':{'Authorization':_0x4acf('0x70')+_0x4c5c55},'json':!![]});}})['then'](function(_0x278940){if(_0x278940){if(_0x278940[_0x4acf('0x71')]&&_0x278940[_0x4acf('0x71')][_0x4acf('0x29')]){throw new Error(_0x278940['response']['error'][_0x4acf('0x72')]);}var _0x31d0d4=[];var _0x2086ec=[];var _0x39f5ef=[_0x4acf('0x73'),_0x4acf('0x74'),_0x4acf('0x75'),_0x4acf('0x76'),'Call_Duration',_0x4acf('0x77'),'Call_Start_Time',_0x4acf('0x78')];_0x2086ec=_[_0x4acf('0x79')](_0x278940[_0x4acf('0x38')],function(_0x698e6e){return _0x39f5ef[_0x4acf('0x7a')](_0x698e6e[_0x4acf('0x7b')]);});for(var _0x147af2=0x0;_0x147af2<_0x2086ec[_0x4acf('0x39')];_0x147af2++){if(_0x2086ec[_0x147af2][_0x4acf('0x7c')]===![]){_0x31d0d4['push']({'id':_0x2086ec[_0x147af2]['id'],'name':_0x2086ec[_0x147af2][_0x4acf('0x7d')],'custom':_0x2086ec[_0x147af2][_0x4acf('0x7e')],'options':_0x2086ec[_0x147af2][_0x4acf('0x7f')]===_0x4acf('0x80')&&_0x2086ec[_0x147af2]['pick_list_values'][_0x4acf('0x39')]>-0x1?_['map'](_0x2086ec[_0x147af2][_0x4acf('0x81')],function(_0x21758b){return{'name':_0x21758b,'value':_0x21758b};}):[]});}}return{'count':_0x31d0d4[_0x4acf('0x39')],'rows':_0x31d0d4};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x3464da,null))[_0x4acf('0x46')](function(_0x4128ee){var _0x4dea55=_0x318753[_0x4acf('0x33')][_0x4acf('0x82')]?0x1f4:_0x4128ee[_0x4acf('0x83')]||0x1f4;logger[_0x4acf('0x29')](_0x4acf('0x84'),'getFields',_0x4dea55,JSON['stringify'](_0x4128ee));delete _0x4128ee[_0x4acf('0x2b')];if(_0x4dea55===0x191){_0x4dea55=0x190;}_0x3464da[_0x4acf('0x1c')](_0x4dea55)[_0x4acf('0x2c')](_0x318753[_0x4acf('0x33')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4128ee['statusCode']}:_0x4128ee);});}; \ No newline at end of file +var _0x2093=['then','name','index','map','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','filter','merge','where','VIRTUAL','options','ZohoAccount','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','catch','body','destroy','getConfigurations','ZohoConfiguration','pick','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','/oauth/v2/token','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','findOne','host','clientSecret','serverUrl','code','refreshToken','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','reject','save','update'];(function(_0x119974,_0x389452){var _0x36627e=function(_0x49b81e){while(--_0x49b81e){_0x119974['push'](_0x119974['shift']());}};_0x36627e(++_0x389452);}(_0x2093,0x166));var _0x3209=function(_0x1ed46f,_0x7691d7){_0x1ed46f=_0x1ed46f-0x0;var _0x43b931=_0x2093[_0x1ed46f];return _0x43b931;};'use strict';var emlformat=require(_0x3209('0x0'));var rimraf=require(_0x3209('0x1'));var zipdir=require(_0x3209('0x2'));var jsonpatch=require(_0x3209('0x3'));var rp=require(_0x3209('0x4'));var moment=require(_0x3209('0x5'));var BPromise=require(_0x3209('0x6'));var Mustache=require(_0x3209('0x7'));var util=require(_0x3209('0x8'));var path=require(_0x3209('0x9'));var sox=require(_0x3209('0xa'));var csv=require(_0x3209('0xb'));var ejs=require(_0x3209('0xc'));var fs=require('fs');var fs_extra=require(_0x3209('0xd'));var _=require(_0x3209('0xe'));var squel=require('squel');var crypto=require(_0x3209('0xf'));var jsforce=require(_0x3209('0x10'));var deskjs=require(_0x3209('0x11'));var toCsv=require(_0x3209('0xb'));var querystring=require(_0x3209('0x12'));var Papa=require(_0x3209('0x13'));var Redis=require(_0x3209('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x3209('0x15'));var as=require(_0x3209('0x16'));var hardwareService=require(_0x3209('0x17'));var logger=require(_0x3209('0x18'))(_0x3209('0x19'));var utils=require(_0x3209('0x1a'));var config=require(_0x3209('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x3209('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x43108b,_0x274b64){_0x274b64=_0x274b64||0xcc;return function(_0x17257b){if(_0x17257b){return _0x43108b[_0x3209('0x1d')](_0x274b64);}return _0x43108b[_0x3209('0x1e')](_0x274b64)[_0x3209('0x1f')]();};}function respondWithResult(_0x52bba8,_0x5cedc7){_0x5cedc7=_0x5cedc7||0xc8;return function(_0xadafd4){if(_0xadafd4){return _0x52bba8[_0x3209('0x1e')](_0x5cedc7)['json'](_0xadafd4);}};}function respondWithFilteredResult(_0x4f3555,_0x3f928c){return function(_0x283b8e){if(_0x283b8e){var _0x164646=typeof _0x3f928c['offset']===_0x3209('0x20')&&typeof _0x3f928c[_0x3209('0x21')]==='undefined';var _0x4c421b=_0x283b8e[_0x3209('0x22')];var _0x176656=_0x164646?0x0:_0x3f928c[_0x3209('0x23')];var _0x1ad37a=_0x164646?_0x283b8e[_0x3209('0x22')]:_0x3f928c[_0x3209('0x23')]+_0x3f928c['limit'];var _0x4b58c9;if(_0x1ad37a>=_0x4c421b){_0x1ad37a=_0x4c421b;_0x4b58c9=0xc8;}else{_0x4b58c9=0xce;}_0x4f3555[_0x3209('0x1e')](_0x4b58c9);return _0x4f3555[_0x3209('0x24')](_0x3209('0x25'),_0x176656+'-'+_0x1ad37a+'/'+_0x4c421b)['json'](_0x283b8e);}return null;};}function patchUpdates(_0x19bc82){return function(_0x5f1232){try{jsonpatch['apply'](_0x5f1232,_0x19bc82,!![]);}catch(_0x2f6904){return BPromise[_0x3209('0x26')](_0x2f6904);}return _0x5f1232[_0x3209('0x27')]();};}function saveUpdates(_0x2058a7,_0x2d6314){return function(_0x1dc3bc){if(_0x1dc3bc){return _0x1dc3bc[_0x3209('0x28')](_0x2058a7)[_0x3209('0x29')](function(_0x1c5d70){return _0x1c5d70;});}return null;};}function removeEntity(_0x31b875,_0x5002b2){return function(_0xfb017c){if(_0xfb017c){return _0xfb017c['destroy']()['then'](function(){_0x31b875[_0x3209('0x1e')](0xcc)[_0x3209('0x1f')]();});}};}function handleEntityNotFound(_0x56e95f,_0x2b8be3){return function(_0x1e491c){if(!_0x1e491c){_0x56e95f['sendStatus'](0x194);}return _0x1e491c;};}function handleError(_0x59cab3,_0x21b6b8){_0x21b6b8=_0x21b6b8||0x1f4;return function(_0x2f940e){logger['error'](_0x2f940e['stack']);if(_0x2f940e['name']){delete _0x2f940e[_0x3209('0x2a')];}_0x59cab3[_0x3209('0x1e')](_0x21b6b8)['send'](_0x2f940e);};}exports[_0x3209('0x2b')]=function(_0x1a9757,_0x39c153){var _0x49cb9a={},_0x1c32c4={},_0x5c570c={'count':0x0,'rows':[]};var _0x2a47d0=_[_0x3209('0x2c')](db['ZohoAccount']['rawAttributes'],function(_0x224c21){return{'name':_0x224c21[_0x3209('0x2d')],'type':_0x224c21[_0x3209('0x2e')]['key']};});_0x1c32c4['model']=_[_0x3209('0x2c')](_0x2a47d0,_0x3209('0x2a'));_0x1c32c4[_0x3209('0x2f')]=_[_0x3209('0x30')](_0x1a9757['query']);_0x1c32c4[_0x3209('0x31')]=_[_0x3209('0x32')](_0x1c32c4[_0x3209('0x33')],_0x1c32c4['query']);_0x49cb9a['attributes']=_['intersection'](_0x1c32c4[_0x3209('0x33')],qs[_0x3209('0x34')](_0x1a9757[_0x3209('0x2f')][_0x3209('0x34')]));_0x49cb9a[_0x3209('0x35')]=_0x49cb9a['attributes'][_0x3209('0x36')]?_0x49cb9a[_0x3209('0x35')]:_0x1c32c4[_0x3209('0x33')];if(!_0x1a9757[_0x3209('0x2f')]['hasOwnProperty'](_0x3209('0x37'))){_0x49cb9a['limit']=qs['limit'](_0x1a9757[_0x3209('0x2f')][_0x3209('0x21')]);_0x49cb9a[_0x3209('0x23')]=qs[_0x3209('0x23')](_0x1a9757['query']['offset']);}_0x49cb9a[_0x3209('0x38')]=qs['sort'](_0x1a9757[_0x3209('0x2f')][_0x3209('0x39')]);_0x49cb9a['where']=qs[_0x3209('0x31')](_['pick'](_0x1a9757[_0x3209('0x2f')],_0x1c32c4[_0x3209('0x31')]),_0x2a47d0);if(_0x1a9757[_0x3209('0x2f')][_0x3209('0x3a')]){_0x49cb9a['where']=_[_0x3209('0x3b')](_0x49cb9a[_0x3209('0x3c')],{'$or':_['map'](_0x2a47d0,function(_0x4f5181){if(_0x4f5181[_0x3209('0x2e')]!==_0x3209('0x3d')){var _0x1b34bb={};_0x1b34bb[_0x4f5181[_0x3209('0x2a')]]={'$like':'%'+_0x1a9757['query'][_0x3209('0x3a')]+'%'};return _0x1b34bb;}})});}_0x49cb9a=_[_0x3209('0x3b')]({},_0x49cb9a,_0x1a9757[_0x3209('0x3e')]);var _0x532a35={'where':_0x49cb9a[_0x3209('0x3c')]};return db[_0x3209('0x3f')]['count'](_0x532a35)['then'](function(_0x4480d0){_0x5c570c[_0x3209('0x22')]=_0x4480d0;if(_0x1a9757[_0x3209('0x2f')][_0x3209('0x40')]){_0x49cb9a['include']=[{'all':!![]}];}return db[_0x3209('0x3f')][_0x3209('0x41')](_0x49cb9a);})[_0x3209('0x29')](function(_0x28daf8){_0x5c570c[_0x3209('0x42')]=_0x28daf8;return _0x5c570c;})[_0x3209('0x29')](respondWithFilteredResult(_0x39c153,_0x49cb9a))['catch'](handleError(_0x39c153,null));};exports[_0x3209('0x43')]=function(_0x3b2225,_0x1380ea){var _0x27466c={'raw':![],'where':{'id':_0x3b2225[_0x3209('0x44')]['id']}},_0x334a7a={};_0x334a7a[_0x3209('0x33')]=_['keys'](db[_0x3209('0x3f')][_0x3209('0x45')]);_0x334a7a['query']=_[_0x3209('0x30')](_0x3b2225[_0x3209('0x2f')]);_0x334a7a[_0x3209('0x31')]=_[_0x3209('0x32')](_0x334a7a[_0x3209('0x33')],_0x334a7a[_0x3209('0x2f')]);_0x27466c['attributes']=_[_0x3209('0x32')](_0x334a7a[_0x3209('0x33')],qs['fields'](_0x3b2225['query'][_0x3209('0x34')]));_0x27466c['attributes']=_0x27466c[_0x3209('0x35')][_0x3209('0x36')]?_0x27466c[_0x3209('0x35')]:_0x334a7a['model'];if(_0x3b2225[_0x3209('0x2f')]['includeAll']){_0x27466c[_0x3209('0x46')]=[{'all':!![]}];}_0x27466c=_[_0x3209('0x3b')]({},_0x27466c,_0x3b2225[_0x3209('0x3e')]);return db[_0x3209('0x3f')][_0x3209('0x47')](_0x27466c)[_0x3209('0x29')](handleEntityNotFound(_0x1380ea,null))['then'](respondWithResult(_0x1380ea,null))['catch'](handleError(_0x1380ea,null));};exports[_0x3209('0x48')]=function(_0x30725e,_0x175bd9){return db[_0x3209('0x3f')][_0x3209('0x48')](_0x30725e['body'],{})['then'](respondWithResult(_0x175bd9,0xc9))[_0x3209('0x49')](handleError(_0x175bd9,null));};exports['update']=function(_0x3a31b9,_0x49f472){if(_0x3a31b9[_0x3209('0x4a')]['id']){delete _0x3a31b9[_0x3209('0x4a')]['id'];}return db['ZohoAccount'][_0x3209('0x47')]({'where':{'id':_0x3a31b9[_0x3209('0x44')]['id']}})[_0x3209('0x29')](handleEntityNotFound(_0x49f472,null))['then'](saveUpdates(_0x3a31b9[_0x3209('0x4a')],null))['then'](respondWithResult(_0x49f472,null))[_0x3209('0x49')](handleError(_0x49f472,null));};exports[_0x3209('0x4b')]=function(_0x845aa6,_0x31dbe9){return db['ZohoAccount']['find']({'where':{'id':_0x845aa6['params']['id']}})[_0x3209('0x29')](handleEntityNotFound(_0x31dbe9,null))[_0x3209('0x29')](removeEntity(_0x31dbe9,null))[_0x3209('0x49')](handleError(_0x31dbe9,null));};exports[_0x3209('0x4c')]=function(_0x11cddc,_0x15de50,_0x1590ba){var _0x5d9ef8={};var _0x1fd753={};var _0x4bcb6e;var _0x5f1c18;return db[_0x3209('0x3f')]['findOne']({'where':{'id':_0x11cddc[_0x3209('0x44')]['id']}})[_0x3209('0x29')](handleEntityNotFound(_0x15de50,null))[_0x3209('0x29')](function(_0x4deee2){if(_0x4deee2){_0x4bcb6e=_0x4deee2;_0x1fd753[_0x3209('0x33')]=_['keys'](db[_0x3209('0x4d')][_0x3209('0x45')]);_0x1fd753[_0x3209('0x2f')]=_[_0x3209('0x30')](_0x11cddc['query']);_0x1fd753[_0x3209('0x31')]=_['intersection'](_0x1fd753['model'],_0x1fd753[_0x3209('0x2f')]);_0x5d9ef8['attributes']=_['intersection'](_0x1fd753[_0x3209('0x33')],qs[_0x3209('0x34')](_0x11cddc[_0x3209('0x2f')][_0x3209('0x34')]));_0x5d9ef8[_0x3209('0x35')]=_0x5d9ef8['attributes']['length']?_0x5d9ef8[_0x3209('0x35')]:_0x1fd753['model'];_0x5d9ef8['order']=qs[_0x3209('0x39')](_0x11cddc[_0x3209('0x2f')][_0x3209('0x39')]);_0x5d9ef8[_0x3209('0x3c')]=qs['filters'](_[_0x3209('0x4e')](_0x11cddc[_0x3209('0x2f')],_0x1fd753[_0x3209('0x31')]));if(_0x11cddc['query'][_0x3209('0x3a')]){_0x5d9ef8['where']=_[_0x3209('0x3b')](_0x5d9ef8[_0x3209('0x3c')],{'$or':_[_0x3209('0x2c')](_0x5d9ef8['attributes'],function(_0x2ad4fe){var _0x526d19={};_0x526d19[_0x2ad4fe]={'$like':'%'+_0x11cddc[_0x3209('0x2f')][_0x3209('0x3a')]+'%'};return _0x526d19;})});}_0x5d9ef8=_[_0x3209('0x3b')]({},_0x5d9ef8,_0x11cddc[_0x3209('0x3e')]);return _0x4bcb6e[_0x3209('0x4c')](_0x5d9ef8);}})[_0x3209('0x29')](function(_0x1e84d0){if(_0x1e84d0){_0x5f1c18=_0x1e84d0[_0x3209('0x36')];if(!_0x11cddc[_0x3209('0x2f')]['hasOwnProperty'](_0x3209('0x37'))){_0x5d9ef8['limit']=qs[_0x3209('0x21')](_0x11cddc[_0x3209('0x2f')][_0x3209('0x21')]);_0x5d9ef8[_0x3209('0x23')]=qs[_0x3209('0x23')](_0x11cddc['query'][_0x3209('0x23')]);}return _0x4bcb6e['getConfigurations'](_0x5d9ef8);}})[_0x3209('0x29')](function(_0x664c29){if(_0x664c29){return _0x664c29?{'count':_0x5f1c18,'rows':_0x664c29}:null;}})[_0x3209('0x29')](respondWithResult(_0x15de50,null))[_0x3209('0x49')](handleError(_0x15de50,null));};exports[_0x3209('0x4f')]=function(_0x4a8958,_0xbce548,_0x20c3f0){if(_0x4a8958[_0x3209('0x4a')]['id']){delete _0x4a8958[_0x3209('0x4a')]['id'];}return db[_0x3209('0x3f')]['findOne']({'where':{'id':_0x4a8958[_0x3209('0x44')]['id']}})[_0x3209('0x29')](handleEntityNotFound(_0xbce548,null))[_0x3209('0x29')](function(_0x4e2ce3){if(_0x4e2ce3){_0x4a8958[_0x3209('0x4a')][_0x3209('0x50')]=_0x4e2ce3['id'];_0x4a8958[_0x3209('0x4a')][_0x3209('0x51')]=integrations['getSubjects'](_0x4a8958[_0x3209('0x4a')]['channel'],_0x4a8958[_0x3209('0x4a')]['type']);_0x4a8958[_0x3209('0x4a')][_0x3209('0x52')]=integrations[_0x3209('0x53')](_0x4a8958[_0x3209('0x4a')]['channel'],_0x4a8958['body'][_0x3209('0x2e')]);return db[_0x3209('0x4d')][_0x3209('0x48')](_0x4a8958[_0x3209('0x4a')],{'include':[{'model':db[_0x3209('0x54')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x3209('0x52')}]});}return null;})[_0x3209('0x29')](respondWithResult(_0xbce548,null))[_0x3209('0x49')](handleError(_0xbce548,null));};function getAccessToken(_0x2d5c10){return new Promise(function(_0x4ad58c,_0x24d1c2){var _0xb53149;switch(_0x2d5c10[_0x3209('0x55')]){case'US':_0xb53149=_0x3209('0x56');break;case'AU':_0xb53149='https://accounts.zoho.com.au';break;case'EU':_0xb53149=_0x3209('0x57');break;case'IN':_0xb53149='https://accounts.zoho.in';break;case'CN':_0xb53149='https://accounts.zoho.com.cn';break;default:_0xb53149=_0x3209('0x57');break;}var _0x19732d={'method':'POST','uri':_0xb53149+_0x3209('0x58'),'qs':{'refresh_token':_0x2d5c10['refreshToken'],'client_id':_0x2d5c10[_0x3209('0x59')],'client_secret':_0x2d5c10['clientSecret'],'grant_type':_0x3209('0x5a')},'json':!![]};return rp(_0x19732d)[_0x3209('0x29')](function(_0x52af86){if(_0x52af86[_0x3209('0x5b')]){_0x4ad58c(_0x52af86[_0x3209('0x5b')]);}else{_0x24d1c2(_0x3209('0x5c'));}})[_0x3209('0x49')](function(_0xe74280){_0x24d1c2(_0xe74280);});});}exports[_0x3209('0x5d')]=function(_0x17924f,_0x3a8d19,_0x14c2e8){var _0x45d929,_0xace87d,_0x224697,_0x366d27,_0x17ae05;return db['ZohoAccount'][_0x3209('0x5e')]({'where':{'id':_0x17924f[_0x3209('0x44')]['id']},'attributes':['id',_0x3209('0x5f'),_0x3209('0x55'),_0x3209('0x59'),_0x3209('0x60'),_0x3209('0x61'),_0x3209('0x62'),_0x3209('0x63')]})[_0x3209('0x29')](handleEntityNotFound(_0x3a8d19,null))[_0x3209('0x29')](function(_0x5f4025){_0x17ae05=_0x5f4025;_0x45d929=_0x17ae05[_0x3209('0x5f')];_0xace87d=_0x45d929===_0x3209('0x64')?'eu':'com';_0x224697=_0x17ae05[_0x3209('0x61')];var _0xa82b30=_0x224697[_0x3209('0x65')](-0x1);if(_0xa82b30==='/'||_0xa82b30==='\x5c'||_0xa82b30===':'){_0x224697=_0x224697[_0x3209('0x66')](0x0,_0x224697[_0x3209('0x67')](_0xa82b30));}if(!_0x17ae05[_0x3209('0x63')]){throw new Error(_0x3209('0x68'));}return getAccessToken(_0x17ae05);})['then'](function(_0x54d9f9){if(_0x54d9f9){return rp({'method':'GET','uri':util[_0x3209('0x69')](_0x3209('0x6a'),_0xace87d),'qs':{'module':_0x3209('0x6b')},'headers':{'Authorization':_0x3209('0x6c')+_0x54d9f9},'json':!![]});}})[_0x3209('0x29')](function(_0x810930){if(_0x810930){if(_0x810930['response']&&_0x810930[_0x3209('0x6d')][_0x3209('0x6e')]){throw new Error(_0x810930[_0x3209('0x6d')][_0x3209('0x6e')]['message']);}var _0x118d1b=[];var _0x2cb48f=[];var _0x220cc8=[_0x3209('0x6f'),_0x3209('0x70'),_0x3209('0x71'),_0x3209('0x72'),_0x3209('0x73'),_0x3209('0x74'),_0x3209('0x75'),_0x3209('0x76')];_0x2cb48f=_[_0x3209('0x77')](_0x810930[_0x3209('0x34')],function(_0x2a5338){return _0x220cc8[_0x3209('0x78')](_0x2a5338['api_name']);});for(var _0x1c2525=0x0;_0x1c2525<_0x2cb48f[_0x3209('0x36')];_0x1c2525++){if(_0x2cb48f[_0x1c2525][_0x3209('0x79')]===![]){_0x118d1b[_0x3209('0x7a')]({'id':_0x2cb48f[_0x1c2525]['id'],'name':_0x2cb48f[_0x1c2525][_0x3209('0x7b')],'custom':_0x2cb48f[_0x1c2525][_0x3209('0x7c')],'options':_0x2cb48f[_0x1c2525][_0x3209('0x7d')]===_0x3209('0x7e')&&_0x2cb48f[_0x1c2525][_0x3209('0x7f')]['length']>-0x1?_['map'](_0x2cb48f[_0x1c2525][_0x3209('0x7f')],function(_0xa2b87c){return{'name':_0xa2b87c,'value':_0xa2b87c};}):[]});}}return{'count':_0x118d1b['length'],'rows':_0x118d1b};}else{return{'count':0x0,'rows':[]};}})[_0x3209('0x29')](respondWithResult(_0x3a8d19,null))[_0x3209('0x49')](function(_0x546a23){var _0x1db3e4=_0x17924f[_0x3209('0x2f')][_0x3209('0x80')]?0x1f4:_0x546a23[_0x3209('0x81')]||0x1f4;logger['error'](_0x3209('0x82'),_0x3209('0x5d'),_0x1db3e4,JSON['stringify'](_0x546a23));delete _0x546a23[_0x3209('0x2a')];if(_0x1db3e4===0x191){_0x1db3e4=0x190;}_0x3a8d19[_0x3209('0x1e')](_0x1db3e4)[_0x3209('0x83')](_0x17924f[_0x3209('0x2f')][_0x3209('0x80')]?{'message':_0x3209('0x84'),'statusCode':_0x546a23['statusCode']}:_0x546a23);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 4f1cf67..4ee7fa3 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 _0x7d12=['request-promise','../../config/environment','./intZohoAccount.attributes','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','host','serverUrl','substring','lastIndexOf','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','authorization_code','clientSecret','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','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','slice','POST','parse','refreshToken','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7d12,0xa6));var _0x27d1=function(_0x326e5e,_0x491c33){_0x326e5e=_0x326e5e-0x0;var _0x4d0fde=_0x7d12[_0x326e5e];return _0x4d0fde;};'use strict';var _=require(_0x27d1('0x0'));var util=require(_0x27d1('0x1'));var logger=require(_0x27d1('0x2'))(_0x27d1('0x3'));var moment=require(_0x27d1('0x4'));var BPromise=require(_0x27d1('0x5'));var rp=require(_0x27d1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x27d1('0x7'));var attributes=require(_0x27d1('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x57573f,_0x573412){return _0x57573f[_0x27d1('0x9')](_0x27d1('0xa'),attributes,{'tableName':_0x27d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x18784f,_0x5bc1aa,_0x364905){if(_0x18784f[_0x27d1('0xc')](_0x27d1('0xd'))||_0x18784f[_0x27d1('0xc')]('serverUrl')||_0x18784f[_0x27d1('0xc')](_0x27d1('0xe'))||_0x18784f['changed']('clientSecret')||_0x18784f[_0x27d1('0xc')]('code')||_0x18784f[_0x27d1('0xc')](_0x27d1('0xf'))){var _0x4d0ad0,_0x4d896a;_0x4d0ad0=_0x18784f[_0x27d1('0x10')];var _0x22bc5a=_0x4d0ad0['slice'](-0x1);if(_0x22bc5a==='/'||_0x22bc5a==='\x5c'||_0x22bc5a===':'){_0x4d0ad0=_0x4d0ad0[_0x27d1('0x11')](0x0,_0x4d0ad0[_0x27d1('0x12')](_0x22bc5a));}switch(_0x18784f[_0x27d1('0xd')]){case'US':_0x4d896a=_0x27d1('0x13');break;case'AU':_0x4d896a=_0x27d1('0x14');break;case'IN':_0x4d896a=_0x27d1('0x15');break;case'CN':_0x4d896a=_0x27d1('0x16');break;default:_0x4d896a=_0x27d1('0x17');break;}var _0x583410={'method':'POST','uri':_0x4d896a+_0x27d1('0x18'),'form':{'grant_type':_0x27d1('0x19'),'client_id':_0x18784f[_0x27d1('0xe')],'client_secret':_0x18784f[_0x27d1('0x1a')],'redirect_uri':_0x18784f[_0x27d1('0x10')],'code':_0x18784f[_0x27d1('0x1b')]},'headers':{'Content-Type':_0x27d1('0x1c')}};return rp(_0x583410)[_0x27d1('0x1d')](function(_0x428b38){var _0x2df15d=JSON['parse'](_0x428b38);if(_0x2df15d[_0x27d1('0x1e')]){_0x18784f['refreshToken']=_0x2df15d[_0x27d1('0x1e')];logger[_0x27d1('0x1f')](util[_0x27d1('0x20')](_0x27d1('0x21'),_0x18784f[_0x27d1('0x22')],_0x18784f['id']));}else{logger[_0x27d1('0x23')](util[_0x27d1('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x18784f['name'],_0x18784f['id']),util[_0x27d1('0x24')](_0x2df15d,{'showHidden':![],'depth':null}));}return _0x364905(null,_0x5bc1aa);})[_0x27d1('0x25')](function(_0x702bbb){logger['error'](util[_0x27d1('0x20')](_0x27d1('0x26'),_0x18784f[_0x27d1('0x22')],_0x18784f['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x364905(_0x702bbb);});}else{return _0x364905(null,_0x5bc1aa);}},'beforeUpdate':function(_0x27dfee,_0x17f707,_0x5ab87e){if(_0x27dfee['changed'](_0x27d1('0xd'))||_0x27dfee['changed']('serverUrl')||_0x27dfee[_0x27d1('0xc')](_0x27d1('0xe'))||_0x27dfee[_0x27d1('0xc')](_0x27d1('0x1a'))||_0x27dfee[_0x27d1('0xc')](_0x27d1('0x1b'))||_0x27dfee[_0x27d1('0xc')]('host')){var _0x14bec1,_0x971012;_0x14bec1=_0x27dfee[_0x27d1('0x10')];var _0x2ae970=_0x14bec1[_0x27d1('0x27')](-0x1);if(_0x2ae970==='/'||_0x2ae970==='\x5c'||_0x2ae970===':'){_0x14bec1=_0x14bec1[_0x27d1('0x11')](0x0,_0x14bec1[_0x27d1('0x12')](_0x2ae970));}switch(_0x27dfee[_0x27d1('0xd')]){case'US':_0x971012=_0x27d1('0x13');break;case'AU':_0x971012=_0x27d1('0x14');break;case'IN':_0x971012='https://accounts.zoho.in';break;case'CN':_0x971012=_0x27d1('0x16');break;default:_0x971012='https://accounts.zoho.eu';break;}var _0x54307a={'method':_0x27d1('0x28'),'uri':_0x971012+_0x27d1('0x18'),'form':{'grant_type':_0x27d1('0x19'),'client_id':_0x27dfee['clientId'],'client_secret':_0x27dfee['clientSecret'],'redirect_uri':_0x27dfee[_0x27d1('0x10')],'code':_0x27dfee[_0x27d1('0x1b')]},'headers':{'Content-Type':_0x27d1('0x1c')}};return rp(_0x54307a)[_0x27d1('0x1d')](function(_0xdf42b7){var _0x4ebc0a=JSON[_0x27d1('0x29')](_0xdf42b7);if(_0x4ebc0a['refresh_token']){_0x27dfee[_0x27d1('0x2a')]=_0x4ebc0a[_0x27d1('0x1e')];logger[_0x27d1('0x1f')](util['format'](_0x27d1('0x21'),_0x27dfee['name'],_0x27dfee['id']));}else{logger[_0x27d1('0x23')](util[_0x27d1('0x20')](_0x27d1('0x26'),_0x27dfee[_0x27d1('0x22')],_0x27dfee['id']),util['inspect'](_0x4ebc0a,{'showHidden':![],'depth':null}));}return _0x5ab87e(null,_0x17f707);})[_0x27d1('0x25')](function(_0x53f7ad){logger[_0x27d1('0x23')](util[_0x27d1('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x27dfee[_0x27d1('0x22')],_0x27dfee['id']),util[_0x27d1('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5ab87e(_0x53f7ad);});}else{return _0x5ab87e(null,_0x17f707);}}}});}; \ No newline at end of file +var _0xae7e=['clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','error','https://accounts.zoho.com','/oauth/v2/token','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','serverUrl'];(function(_0x49eb5e,_0x456318){var _0x393698=function(_0x423603){while(--_0x423603){_0x49eb5e['push'](_0x49eb5e['shift']());}};_0x393698(++_0x456318);}(_0xae7e,0xed));var _0xeae7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xae7e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xeae7('0x0'));var util=require(_0xeae7('0x1'));var logger=require(_0xeae7('0x2'))('api');var moment=require('moment');var BPromise=require(_0xeae7('0x3'));var rp=require(_0xeae7('0x4'));var fs=require('fs');var path=require(_0xeae7('0x5'));var rimraf=require(_0xeae7('0x6'));var config=require(_0xeae7('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xeae7('0x8'));module[_0xeae7('0x9')]=function(_0x3a9411,_0x420c5b){return _0x3a9411[_0xeae7('0xa')](_0xeae7('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3f1ad4,_0xc8d9da,_0x3371b2){if(_0x3f1ad4[_0xeae7('0xc')](_0xeae7('0xd'))||_0x3f1ad4['changed'](_0xeae7('0xe'))||_0x3f1ad4[_0xeae7('0xc')](_0xeae7('0xf'))||_0x3f1ad4[_0xeae7('0xc')](_0xeae7('0x10'))||_0x3f1ad4[_0xeae7('0xc')](_0xeae7('0x11'))||_0x3f1ad4['changed'](_0xeae7('0x12'))){var _0x37eedb,_0x5e5be6;_0x37eedb=_0x3f1ad4['serverUrl'];var _0x974629=_0x37eedb[_0xeae7('0x13')](-0x1);if(_0x974629==='/'||_0x974629==='\x5c'||_0x974629===':'){_0x37eedb=_0x37eedb[_0xeae7('0x14')](0x0,_0x37eedb[_0xeae7('0x15')](_0x974629));}switch(_0x3f1ad4['zone']){case'US':_0x5e5be6='https://accounts.zoho.com';break;case'AU':_0x5e5be6=_0xeae7('0x16');break;case'IN':_0x5e5be6=_0xeae7('0x17');break;case'CN':_0x5e5be6=_0xeae7('0x18');break;default:_0x5e5be6=_0xeae7('0x19');break;}var _0x211a86={'method':_0xeae7('0x1a'),'uri':_0x5e5be6+'/oauth/v2/token','form':{'grant_type':_0xeae7('0x1b'),'client_id':_0x3f1ad4[_0xeae7('0xf')],'client_secret':_0x3f1ad4[_0xeae7('0x10')],'redirect_uri':_0x3f1ad4['serverUrl'],'code':_0x3f1ad4['code']},'headers':{'Content-Type':_0xeae7('0x1c')}};return rp(_0x211a86)[_0xeae7('0x1d')](function(_0x3c7f28){var _0xf489ae=JSON[_0xeae7('0x1e')](_0x3c7f28);if(_0xf489ae[_0xeae7('0x1f')]){_0x3f1ad4['refreshToken']=_0xf489ae[_0xeae7('0x1f')];logger[_0xeae7('0x20')](util[_0xeae7('0x21')](_0xeae7('0x22'),_0x3f1ad4[_0xeae7('0x23')],_0x3f1ad4['id']));}else{logger['error'](util[_0xeae7('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3f1ad4['name'],_0x3f1ad4['id']),util[_0xeae7('0x24')](_0xf489ae,{'showHidden':![],'depth':null}));}return _0x3371b2(null,_0xc8d9da);})[_0xeae7('0x25')](function(_0x35f6b2){logger[_0xeae7('0x26')](util[_0xeae7('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3f1ad4[_0xeae7('0x23')],_0x3f1ad4['id']),util[_0xeae7('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x3371b2(_0x35f6b2);});}else{return _0x3371b2(null,_0xc8d9da);}},'beforeUpdate':function(_0x223392,_0xf11596,_0x1acd01){if(_0x223392[_0xeae7('0xc')](_0xeae7('0xd'))||_0x223392[_0xeae7('0xc')](_0xeae7('0xe'))||_0x223392[_0xeae7('0xc')](_0xeae7('0xf'))||_0x223392[_0xeae7('0xc')](_0xeae7('0x10'))||_0x223392[_0xeae7('0xc')]('code')||_0x223392[_0xeae7('0xc')]('host')){var _0x4ea42c,_0x4abd3b;_0x4ea42c=_0x223392['serverUrl'];var _0x578eba=_0x4ea42c[_0xeae7('0x13')](-0x1);if(_0x578eba==='/'||_0x578eba==='\x5c'||_0x578eba===':'){_0x4ea42c=_0x4ea42c[_0xeae7('0x14')](0x0,_0x4ea42c[_0xeae7('0x15')](_0x578eba));}switch(_0x223392[_0xeae7('0xd')]){case'US':_0x4abd3b=_0xeae7('0x27');break;case'AU':_0x4abd3b='https://accounts.zoho.com.au';break;case'IN':_0x4abd3b='https://accounts.zoho.in';break;case'CN':_0x4abd3b=_0xeae7('0x18');break;default:_0x4abd3b=_0xeae7('0x19');break;}var _0x39904d={'method':'POST','uri':_0x4abd3b+_0xeae7('0x28'),'form':{'grant_type':_0xeae7('0x1b'),'client_id':_0x223392['clientId'],'client_secret':_0x223392['clientSecret'],'redirect_uri':_0x223392[_0xeae7('0xe')],'code':_0x223392[_0xeae7('0x11')]},'headers':{'Content-Type':_0xeae7('0x1c')}};return rp(_0x39904d)['then'](function(_0x48aac8){var _0x4cab15=JSON[_0xeae7('0x1e')](_0x48aac8);if(_0x4cab15[_0xeae7('0x1f')]){_0x223392['refreshToken']=_0x4cab15[_0xeae7('0x1f')];logger[_0xeae7('0x20')](util[_0xeae7('0x21')](_0xeae7('0x22'),_0x223392[_0xeae7('0x23')],_0x223392['id']));}else{logger[_0xeae7('0x26')](util['format'](_0xeae7('0x29'),_0x223392['name'],_0x223392['id']),util[_0xeae7('0x24')](_0x4cab15,{'showHidden':![],'depth':null}));}return _0x1acd01(null,_0xf11596);})[_0xeae7('0x25')](function(_0x3f2905){logger['error'](util[_0xeae7('0x21')](_0xeae7('0x29'),_0x223392['name'],_0x223392['id']),util[_0xeae7('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x1acd01(_0x3f2905);});}else{return _0x1acd01(null,_0xf11596);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 17048c5..d78ab73 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 _0xda2d=['../../config/environment','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','include','map','model','catch','find','where','ShowZohoAccount','util','moment','bluebird','randomstring','ioredis','rpc'];(function(_0x454db3,_0xcd150e){var _0x3b36da=function(_0xcbf82c){while(--_0xcbf82c){_0x454db3['push'](_0x454db3['shift']());}};_0x3b36da(++_0xcd150e);}(_0xda2d,0x102));var _0xdda2=function(_0x424747,_0x29bf74){_0x424747=_0x424747-0x0;var _0x3b8826=_0xda2d[_0x424747];return _0x3b8826;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});}exports[_0xdda2('0x14')]=function(_0x1a3b35){var _0x335fb5=this;return new Promise(function(_0x2b6ee8,_0x8d44b7){return db[_0xdda2('0x15')][_0xdda2('0x16')]({'raw':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')][_0xdda2('0x18')]===undefined?!![]:![]:!![],'where':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['where']||null:null,'attributes':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x19')]||null:null,'limit':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['limit']||null:null,'include':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x1a3b35['options'][_0xdda2('0x1a')],function(_0xfda248){return{'model':db[_0xfda248[_0xdda2('0x1c')]],'as':_0xfda248['as'],'attributes':_0xfda248[_0xdda2('0x19')],'include':_0xfda248[_0xdda2('0x1a')]?_['map'](_0xfda248[_0xdda2('0x1a')],function(_0x4be5ea){return{'model':db[_0x4be5ea[_0xdda2('0x1c')]],'as':_0x4be5ea['as'],'attributes':_0x4be5ea[_0xdda2('0x19')],'include':_0x4be5ea['include']?_['map'](_0x4be5ea[_0xdda2('0x1a')],function(_0x4567e7){return{'model':db[_0x4567e7[_0xdda2('0x1c')]],'as':_0x4567e7['as'],'attributes':_0x4567e7['attributes']};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x5d26ae){logger[_0xdda2('0x12')](_0xdda2('0x14'),_0x1a3b35);logger[_0xdda2('0xd')](_0xdda2('0x14'),_0x1a3b35,JSON['stringify'](_0x5d26ae));_0x2b6ee8(_0x5d26ae);})[_0xdda2('0x1d')](function(_0x255bbc){logger['error'](_0xdda2('0x14'),_0x255bbc[_0xdda2('0x11')],_0x1a3b35);_0x8d44b7(_0x335fb5[_0xdda2('0x10')](0x1f4,_0x255bbc[_0xdda2('0x11')]));});});};exports['ShowZohoAccount']=function(_0x129eba){var _0x5e107f=this;return new Promise(function(_0x4b19b7,_0x1ca9f3){return db['ZohoAccount'][_0xdda2('0x1e')]({'raw':_0x129eba['options']?_0x129eba['options']['raw']===undefined?!![]:![]:!![],'where':_0x129eba[_0xdda2('0x17')]?_0x129eba['options'][_0xdda2('0x1f')]||null:null,'attributes':_0x129eba['options']?_0x129eba['options']['attributes']||null:null,'include':_0x129eba[_0xdda2('0x17')]?_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')],function(_0x2bcfba){return{'model':db[_0x2bcfba[_0xdda2('0x1c')]],'as':_0x2bcfba['as'],'attributes':_0x2bcfba[_0xdda2('0x19')],'include':_0x2bcfba[_0xdda2('0x1a')]?_['map'](_0x2bcfba[_0xdda2('0x1a')],function(_0x4212da){return{'model':db[_0x4212da[_0xdda2('0x1c')]],'as':_0x4212da['as'],'attributes':_0x4212da[_0xdda2('0x19')],'include':_0x4212da[_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x4212da[_0xdda2('0x1a')],function(_0x5835cd){return{'model':db[_0x5835cd['model']],'as':_0x5835cd['as'],'attributes':_0x5835cd[_0xdda2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x40eb19){logger['info']('ShowZohoAccount',_0x129eba);logger[_0xdda2('0xd')](_0xdda2('0x20'),_0x129eba,JSON[_0xdda2('0xf')](_0x40eb19));_0x4b19b7(_0x40eb19);})[_0xdda2('0x1d')](function(_0x246001){logger['error'](_0xdda2('0x20'),_0x246001[_0xdda2('0x11')],_0x129eba);_0x1ca9f3(_0x5e107f['error'](0x1f4,_0x246001['message']));});});}; \ No newline at end of file +var _0x7708=['include','map','model','attributes','then','catch','ShowZohoAccount','find','lodash','util','bluebird','../../config/logger','rpc','jayson/promise','http','request','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetZohoAccount','ZohoAccount','findAll','options','raw','where','limit'];(function(_0xa3f0c9,_0x281090){var _0x168a1a=function(_0x2c9a81){while(--_0x2c9a81){_0xa3f0c9['push'](_0xa3f0c9['shift']());}};_0x168a1a(++_0x281090);}(_0x7708,0x188));var _0x8770=function(_0x3ab353,_0x5d5283){_0x3ab353=_0x3ab353-0x0;var _0x1e2285=_0x7708[_0x3ab353];return _0x1e2285;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var moment=require('moment');var BPromise=require(_0x8770('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8770('0x3'))(_0x8770('0x4'));var config=require('../../config/environment');var jayson=require(_0x8770('0x5'));var client=jayson['client'][_0x8770('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x42d305,_0x2b0295,_0x20e293){return new BPromise(function(_0x212b12,_0x3e1113){return client[_0x8770('0x7')](_0x42d305,_0x20e293)['then'](function(_0x396322){logger[_0x8770('0x8')](_0x8770('0x9'),_0x2b0295,'request\x20sent');logger[_0x8770('0xa')](_0x8770('0xb'),_0x2b0295,_0x8770('0xc'),JSON[_0x8770('0xd')](_0x396322));if(_0x396322['error']){if(_0x396322[_0x8770('0xe')][_0x8770('0xf')]===0x1f4){logger[_0x8770('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x2b0295,_0x396322[_0x8770('0xe')][_0x8770('0x10')]);return _0x3e1113(_0x396322[_0x8770('0xe')][_0x8770('0x10')]);}logger[_0x8770('0xe')](_0x8770('0x9'),_0x2b0295,_0x396322[_0x8770('0xe')][_0x8770('0x10')]);return _0x212b12(_0x396322['error'][_0x8770('0x10')]);}else{logger[_0x8770('0x8')]('ZohoAccount,\x20%s,\x20%s',_0x2b0295,_0x8770('0xc'));_0x212b12(_0x396322['result'][_0x8770('0x10')]);}})['catch'](function(_0x5b4716){logger['error'](_0x8770('0x9'),_0x2b0295,_0x5b4716);_0x3e1113(_0x5b4716);});});}exports[_0x8770('0x11')]=function(_0x17b634){var _0xe0d611=this;return new Promise(function(_0x4b0691,_0x550be9){return db[_0x8770('0x12')][_0x8770('0x13')]({'raw':_0x17b634[_0x8770('0x14')]?_0x17b634[_0x8770('0x14')][_0x8770('0x15')]===undefined?!![]:![]:!![],'where':_0x17b634['options']?_0x17b634[_0x8770('0x14')][_0x8770('0x16')]||null:null,'attributes':_0x17b634[_0x8770('0x14')]?_0x17b634[_0x8770('0x14')]['attributes']||null:null,'limit':_0x17b634['options']?_0x17b634[_0x8770('0x14')][_0x8770('0x17')]||null:null,'include':_0x17b634[_0x8770('0x14')]?_0x17b634[_0x8770('0x14')][_0x8770('0x18')]?_[_0x8770('0x19')](_0x17b634['options'][_0x8770('0x18')],function(_0x23ad66){return{'model':db[_0x23ad66[_0x8770('0x1a')]],'as':_0x23ad66['as'],'attributes':_0x23ad66[_0x8770('0x1b')],'include':_0x23ad66['include']?_[_0x8770('0x19')](_0x23ad66['include'],function(_0x7b4755){return{'model':db[_0x7b4755[_0x8770('0x1a')]],'as':_0x7b4755['as'],'attributes':_0x7b4755[_0x8770('0x1b')],'include':_0x7b4755[_0x8770('0x18')]?_[_0x8770('0x19')](_0x7b4755[_0x8770('0x18')],function(_0x293f53){return{'model':db[_0x293f53[_0x8770('0x1a')]],'as':_0x293f53['as'],'attributes':_0x293f53[_0x8770('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8770('0x1c')](function(_0x5f4973){logger[_0x8770('0x8')](_0x8770('0x11'),_0x17b634);logger[_0x8770('0xa')](_0x8770('0x11'),_0x17b634,JSON[_0x8770('0xd')](_0x5f4973));_0x4b0691(_0x5f4973);})[_0x8770('0x1d')](function(_0x5ae7b8){logger['error'](_0x8770('0x11'),_0x5ae7b8[_0x8770('0x10')],_0x17b634);_0x550be9(_0xe0d611[_0x8770('0xe')](0x1f4,_0x5ae7b8[_0x8770('0x10')]));});});};exports[_0x8770('0x1e')]=function(_0x4bc072){var _0x5282dd=this;return new Promise(function(_0x45fff4,_0x144c24){return db[_0x8770('0x12')][_0x8770('0x1f')]({'raw':_0x4bc072['options']?_0x4bc072[_0x8770('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x4bc072['options']?_0x4bc072[_0x8770('0x14')]['where']||null:null,'attributes':_0x4bc072[_0x8770('0x14')]?_0x4bc072[_0x8770('0x14')][_0x8770('0x1b')]||null:null,'include':_0x4bc072[_0x8770('0x14')]?_0x4bc072[_0x8770('0x14')][_0x8770('0x18')]?_[_0x8770('0x19')](_0x4bc072[_0x8770('0x14')][_0x8770('0x18')],function(_0x53197e){return{'model':db[_0x53197e[_0x8770('0x1a')]],'as':_0x53197e['as'],'attributes':_0x53197e[_0x8770('0x1b')],'include':_0x53197e[_0x8770('0x18')]?_['map'](_0x53197e['include'],function(_0x1b4b8f){return{'model':db[_0x1b4b8f[_0x8770('0x1a')]],'as':_0x1b4b8f['as'],'attributes':_0x1b4b8f[_0x8770('0x1b')],'include':_0x1b4b8f['include']?_[_0x8770('0x19')](_0x1b4b8f['include'],function(_0x255746){return{'model':db[_0x255746[_0x8770('0x1a')]],'as':_0x255746['as'],'attributes':_0x255746[_0x8770('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8770('0x1c')](function(_0x14a91c){logger[_0x8770('0x8')](_0x8770('0x1e'),_0x4bc072);logger[_0x8770('0xa')](_0x8770('0x1e'),_0x4bc072,JSON[_0x8770('0xd')](_0x14a91c));_0x45fff4(_0x14a91c);})['catch'](function(_0x565890){logger[_0x8770('0xe')](_0x8770('0x1e'),_0x565890['message'],_0x4bc072);_0x144c24(_0x5282dd[_0x8770('0xe')](0x1f4,_0x565890[_0x8770('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index a32738d..ff78c7e 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 _0x5b61=['post','create','put','/:id','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','./intZohoConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions'];(function(_0x5623cb,_0x20b099){var _0x368ce6=function(_0x3439ad){while(--_0x3439ad){_0x5623cb['push'](_0x5623cb['shift']());}};_0x368ce6(++_0x20b099);}(_0x5b61,0x16b));var _0x15b6=function(_0x4d2263,_0x3fbf0d){_0x4d2263=_0x4d2263-0x0;var _0x24aba0=_0x5b61[_0x4d2263];return _0x24aba0;};'use strict';var multer=require(_0x15b6('0x0'));var util=require(_0x15b6('0x1'));var path=require(_0x15b6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x15b6('0x3')]();var fs_extra=require(_0x15b6('0x4'));var auth=require(_0x15b6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x15b6('0x6'));router[_0x15b6('0x7')]('/',auth[_0x15b6('0x8')](),controller[_0x15b6('0x9')]);router[_0x15b6('0x7')]('/:id',auth[_0x15b6('0x8')](),controller[_0x15b6('0xa')]);router['get'](_0x15b6('0xb'),auth[_0x15b6('0x8')](),controller[_0x15b6('0xc')]);router[_0x15b6('0x7')](_0x15b6('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x15b6('0x7')]('/:id/descriptions',auth[_0x15b6('0x8')](),controller[_0x15b6('0xe')]);router[_0x15b6('0xf')]('/',auth[_0x15b6('0x8')](),controller[_0x15b6('0x10')]);router[_0x15b6('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x15b6('0x12'),auth[_0x15b6('0x8')](),controller[_0x15b6('0x13')]);module[_0x15b6('0x14')]=router; \ No newline at end of file +var _0x27de=['update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x27de,0xd1));var _0xe27d=function(_0x6ace3b,_0x48c949){_0x6ace3b=_0x6ace3b-0x0;var _0x464262=_0x27de[_0x6ace3b];return _0x464262;};'use strict';var multer=require(_0xe27d('0x0'));var util=require(_0xe27d('0x1'));var path=require(_0xe27d('0x2'));var timeout=require(_0xe27d('0x3'));var express=require(_0xe27d('0x4'));var router=express[_0xe27d('0x5')]();var fs_extra=require(_0xe27d('0x6'));var auth=require(_0xe27d('0x7'));var interaction=require(_0xe27d('0x8'));var config=require('../../config/environment');var controller=require(_0xe27d('0x9'));router[_0xe27d('0xa')]('/',auth[_0xe27d('0xb')](),controller['index']);router[_0xe27d('0xa')](_0xe27d('0xc'),auth[_0xe27d('0xb')](),controller[_0xe27d('0xd')]);router['get'](_0xe27d('0xe'),auth[_0xe27d('0xb')](),controller[_0xe27d('0xf')]);router[_0xe27d('0xa')]('/:id/subjects',auth[_0xe27d('0xb')](),controller[_0xe27d('0x10')]);router[_0xe27d('0xa')](_0xe27d('0x11'),auth[_0xe27d('0xb')](),controller['getDescriptions']);router[_0xe27d('0x12')]('/',auth[_0xe27d('0xb')](),controller[_0xe27d('0x13')]);router[_0xe27d('0x14')](_0xe27d('0xc'),auth[_0xe27d('0xb')](),controller[_0xe27d('0x15')]);router['delete'](_0xe27d('0xc'),auth[_0xe27d('0xb')](),controller[_0xe27d('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 8d4382b..255a198 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 _0x2afe=['ENUM','lead','nothing','contact_lead','contact','sequelize','STRING'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x2afe,0xbb));var _0xe2af=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2afe[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xe2af('0x0'));module['exports']={'name':{'type':Sequelize[_0xe2af('0x1')]},'moduleCreate':{'type':Sequelize[_0xe2af('0x2')](_0xe2af('0x3'),'contact',_0xe2af('0x4')),'defaultValue':_0xe2af('0x3')},'moduleSearch':{'type':Sequelize[_0xe2af('0x2')](_0xe2af('0x5'),_0xe2af('0x6'),_0xe2af('0x3')),'defaultValue':_0xe2af('0x5')},'description':{'type':Sequelize[_0xe2af('0x1')]}}; \ No newline at end of file +var _0x3d12=['nothing','lead','contact_lead','exports','STRING','ENUM','contact'];(function(_0x120dbc,_0x2ee946){var _0x57fd14=function(_0x5910c7){while(--_0x5910c7){_0x120dbc['push'](_0x120dbc['shift']());}};_0x57fd14(++_0x2ee946);}(_0x3d12,0x1e6));var _0x23d1=function(_0x342c55,_0x522805){_0x342c55=_0x342c55-0x0;var _0x3716fe=_0x3d12[_0x342c55];return _0x3716fe;};'use strict';var Sequelize=require('sequelize');module[_0x23d1('0x0')]={'name':{'type':Sequelize[_0x23d1('0x1')]},'moduleCreate':{'type':Sequelize[_0x23d1('0x2')]('lead',_0x23d1('0x3'),_0x23d1('0x4')),'defaultValue':_0x23d1('0x5')},'moduleSearch':{'type':Sequelize['ENUM'](_0x23d1('0x6'),_0x23d1('0x3'),_0x23d1('0x5')),'defaultValue':_0x23d1('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 9d621f4..f8a8d38 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 _0xacca=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','map','type','ZohoConfiguration','includeAll','include','findAll','rows','catch','intersection','options','create','find','params','getFields','ZohoField','pick','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','apply','reject','save','then','destroy','name','index','rawAttributes','fieldName','key','query','keys','filters','model'];(function(_0x2573bb,_0x4f1f34){var _0x155032=function(_0x5cc27f){while(--_0x5cc27f){_0x2573bb['push'](_0x2573bb['shift']());}};_0x155032(++_0x4f1f34);}(_0xacca,0x18f));var _0xaacc=function(_0x4718b4,_0x1c216c){_0x4718b4=_0x4718b4-0x0;var _0x23c24b=_0xacca[_0x4718b4];return _0x23c24b;};'use strict';var emlformat=require(_0xaacc('0x0'));var rimraf=require(_0xaacc('0x1'));var zipdir=require(_0xaacc('0x2'));var jsonpatch=require(_0xaacc('0x3'));var rp=require(_0xaacc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaacc('0x5'));var path=require('path');var sox=require(_0xaacc('0x6'));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(_0xaacc('0x7'));var crypto=require(_0xaacc('0x8'));var jsforce=require(_0xaacc('0x9'));var deskjs=require(_0xaacc('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaacc('0xb'));var Redis=require('ioredis');var authService=require(_0xaacc('0xc'));var qs=require(_0xaacc('0xd'));var as=require(_0xaacc('0xe'));var hardwareService=require(_0xaacc('0xf'));var logger=require(_0xaacc('0x10'))(_0xaacc('0x11'));var utils=require(_0xaacc('0x12'));var config=require(_0xaacc('0x13'));var licenseUtil=require(_0xaacc('0x14'));var db=require(_0xaacc('0x15'))['db'];function respondWithStatusCode(_0x4aac9f,_0x8ee577){_0x8ee577=_0x8ee577||0xcc;return function(_0x465786){if(_0x465786){return _0x4aac9f[_0xaacc('0x16')](_0x8ee577);}return _0x4aac9f['status'](_0x8ee577)[_0xaacc('0x17')]();};}function respondWithResult(_0x1ebac7,_0x23e9f8){_0x23e9f8=_0x23e9f8||0xc8;return function(_0x1528c4){if(_0x1528c4){return _0x1ebac7[_0xaacc('0x18')](_0x23e9f8)[_0xaacc('0x19')](_0x1528c4);}};}function respondWithFilteredResult(_0x4f6549,_0x419f90){return function(_0x4dd33c){if(_0x4dd33c){var _0x3e9852=typeof _0x419f90['offset']===_0xaacc('0x1a')&&typeof _0x419f90[_0xaacc('0x1b')]==='undefined';var _0x79fe86=_0x4dd33c['count'];var _0x471c7a=_0x3e9852?0x0:_0x419f90[_0xaacc('0x1c')];var _0x203af3=_0x3e9852?_0x4dd33c[_0xaacc('0x1d')]:_0x419f90[_0xaacc('0x1c')]+_0x419f90[_0xaacc('0x1b')];var _0x5446f7;if(_0x203af3>=_0x79fe86){_0x203af3=_0x79fe86;_0x5446f7=0xc8;}else{_0x5446f7=0xce;}_0x4f6549[_0xaacc('0x18')](_0x5446f7);return _0x4f6549[_0xaacc('0x1e')]('Content-Range',_0x471c7a+'-'+_0x203af3+'/'+_0x79fe86)[_0xaacc('0x19')](_0x4dd33c);}return null;};}function patchUpdates(_0x4886c1){return function(_0x7d1700){try{jsonpatch[_0xaacc('0x1f')](_0x7d1700,_0x4886c1,!![]);}catch(_0x4099cc){return BPromise[_0xaacc('0x20')](_0x4099cc);}return _0x7d1700[_0xaacc('0x21')]();};}function saveUpdates(_0x109110,_0x3df11a){return function(_0x3d9896){if(_0x3d9896){return _0x3d9896['update'](_0x109110)[_0xaacc('0x22')](function(_0x26518c){return _0x26518c;});}return null;};}function removeEntity(_0x5e61a7,_0x53272c){return function(_0x476638){if(_0x476638){return _0x476638[_0xaacc('0x23')]()[_0xaacc('0x22')](function(){_0x5e61a7[_0xaacc('0x18')](0xcc)[_0xaacc('0x17')]();});}};}function handleEntityNotFound(_0x287804,_0xefba6e){return function(_0x1985a6){if(!_0x1985a6){_0x287804['sendStatus'](0x194);}return _0x1985a6;};}function handleError(_0x1b84e9,_0x85b0fb){_0x85b0fb=_0x85b0fb||0x1f4;return function(_0x525903){logger['error'](_0x525903['stack']);if(_0x525903['name']){delete _0x525903[_0xaacc('0x24')];}_0x1b84e9[_0xaacc('0x18')](_0x85b0fb)['send'](_0x525903);};}exports[_0xaacc('0x25')]=function(_0x54c856,_0x31b328){var _0x5de96f={},_0x56046b={},_0x523c9d={'count':0x0,'rows':[]};var _0xa57ca8=_['map'](db['ZohoConfiguration'][_0xaacc('0x26')],function(_0x4346ec){return{'name':_0x4346ec[_0xaacc('0x27')],'type':_0x4346ec['type'][_0xaacc('0x28')]};});_0x56046b['model']=_['map'](_0xa57ca8,_0xaacc('0x24'));_0x56046b[_0xaacc('0x29')]=_[_0xaacc('0x2a')](_0x54c856[_0xaacc('0x29')]);_0x56046b[_0xaacc('0x2b')]=_['intersection'](_0x56046b[_0xaacc('0x2c')],_0x56046b[_0xaacc('0x29')]);_0x5de96f[_0xaacc('0x2d')]=_['intersection'](_0x56046b[_0xaacc('0x2c')],qs[_0xaacc('0x2e')](_0x54c856[_0xaacc('0x29')]['fields']));_0x5de96f[_0xaacc('0x2d')]=_0x5de96f[_0xaacc('0x2d')][_0xaacc('0x2f')]?_0x5de96f[_0xaacc('0x2d')]:_0x56046b[_0xaacc('0x2c')];if(!_0x54c856[_0xaacc('0x29')][_0xaacc('0x30')](_0xaacc('0x31'))){_0x5de96f[_0xaacc('0x1b')]=qs['limit'](_0x54c856['query']['limit']);_0x5de96f['offset']=qs[_0xaacc('0x1c')](_0x54c856['query'][_0xaacc('0x1c')]);}_0x5de96f[_0xaacc('0x32')]=qs[_0xaacc('0x33')](_0x54c856['query'][_0xaacc('0x33')]);_0x5de96f['where']=qs[_0xaacc('0x2b')](_['pick'](_0x54c856['query'],_0x56046b[_0xaacc('0x2b')]),_0xa57ca8);if(_0x54c856['query'][_0xaacc('0x34')]){_0x5de96f['where']=_[_0xaacc('0x35')](_0x5de96f[_0xaacc('0x36')],{'$or':_[_0xaacc('0x37')](_0xa57ca8,function(_0x4bcef0){if(_0x4bcef0[_0xaacc('0x38')]!=='VIRTUAL'){var _0x327488={};_0x327488[_0x4bcef0[_0xaacc('0x24')]]={'$like':'%'+_0x54c856['query'][_0xaacc('0x34')]+'%'};return _0x327488;}})});}_0x5de96f=_['merge']({},_0x5de96f,_0x54c856['options']);var _0x134e21={'where':_0x5de96f[_0xaacc('0x36')]};return db[_0xaacc('0x39')][_0xaacc('0x1d')](_0x134e21)['then'](function(_0x3a5116){_0x523c9d['count']=_0x3a5116;if(_0x54c856[_0xaacc('0x29')][_0xaacc('0x3a')]){_0x5de96f[_0xaacc('0x3b')]=[{'all':!![]}];}return db[_0xaacc('0x39')][_0xaacc('0x3c')](_0x5de96f);})[_0xaacc('0x22')](function(_0x5f38f1){_0x523c9d[_0xaacc('0x3d')]=_0x5f38f1;return _0x523c9d;})[_0xaacc('0x22')](respondWithFilteredResult(_0x31b328,_0x5de96f))[_0xaacc('0x3e')](handleError(_0x31b328,null));};exports['show']=function(_0x4eb864,_0x553b01){var _0xd43f7e={'raw':![],'where':{'id':_0x4eb864['params']['id']}},_0x364899={};_0x364899['model']=_[_0xaacc('0x2a')](db[_0xaacc('0x39')][_0xaacc('0x26')]);_0x364899[_0xaacc('0x29')]=_[_0xaacc('0x2a')](_0x4eb864[_0xaacc('0x29')]);_0x364899[_0xaacc('0x2b')]=_[_0xaacc('0x3f')](_0x364899[_0xaacc('0x2c')],_0x364899[_0xaacc('0x29')]);_0xd43f7e[_0xaacc('0x2d')]=_['intersection'](_0x364899[_0xaacc('0x2c')],qs[_0xaacc('0x2e')](_0x4eb864[_0xaacc('0x29')][_0xaacc('0x2e')]));_0xd43f7e[_0xaacc('0x2d')]=_0xd43f7e['attributes'][_0xaacc('0x2f')]?_0xd43f7e[_0xaacc('0x2d')]:_0x364899[_0xaacc('0x2c')];if(_0x4eb864[_0xaacc('0x29')][_0xaacc('0x3a')]){_0xd43f7e[_0xaacc('0x3b')]=[{'all':!![]}];}_0xd43f7e=_[_0xaacc('0x35')]({},_0xd43f7e,_0x4eb864[_0xaacc('0x40')]);return db[_0xaacc('0x39')]['find'](_0xd43f7e)[_0xaacc('0x22')](handleEntityNotFound(_0x553b01,null))[_0xaacc('0x22')](respondWithResult(_0x553b01,null))['catch'](handleError(_0x553b01,null));};exports[_0xaacc('0x41')]=function(_0x2403ca,_0x27e469){return db['ZohoConfiguration'][_0xaacc('0x41')](_0x2403ca['body'],{})['then'](respondWithResult(_0x27e469,0xc9))[_0xaacc('0x3e')](handleError(_0x27e469,null));};exports['update']=function(_0x2d6420,_0x394952){if(_0x2d6420['body']['id']){delete _0x2d6420['body']['id'];}return db[_0xaacc('0x39')][_0xaacc('0x42')]({'where':{'id':_0x2d6420[_0xaacc('0x43')]['id']}})[_0xaacc('0x22')](handleEntityNotFound(_0x394952,null))['then'](saveUpdates(_0x2d6420['body'],null))['then'](respondWithResult(_0x394952,null))['catch'](handleError(_0x394952,null));};exports['destroy']=function(_0xdbb874,_0x4c5e90){return db[_0xaacc('0x39')][_0xaacc('0x42')]({'where':{'id':_0xdbb874['params']['id']}})[_0xaacc('0x22')](handleEntityNotFound(_0x4c5e90,null))[_0xaacc('0x22')](removeEntity(_0x4c5e90,null))[_0xaacc('0x3e')](handleError(_0x4c5e90,null));};exports[_0xaacc('0x44')]=function(_0x31ec5d,_0xccbfc7,_0x4be999){var _0x2aa03e={};var _0x2f3182={};var _0x214fdb;var _0x5fe62a;return db[_0xaacc('0x39')]['findOne']({'where':{'id':_0x31ec5d['params']['id']}})[_0xaacc('0x22')](handleEntityNotFound(_0xccbfc7,null))[_0xaacc('0x22')](function(_0x1db3d8){if(_0x1db3d8){_0x214fdb=_0x1db3d8;_0x2f3182[_0xaacc('0x2c')]=_[_0xaacc('0x2a')](db[_0xaacc('0x45')][_0xaacc('0x26')]);_0x2f3182[_0xaacc('0x29')]=_['keys'](_0x31ec5d[_0xaacc('0x29')]);_0x2f3182['filters']=_['intersection'](_0x2f3182[_0xaacc('0x2c')],_0x2f3182[_0xaacc('0x29')]);_0x2aa03e['attributes']=_['intersection'](_0x2f3182[_0xaacc('0x2c')],qs['fields'](_0x31ec5d['query'][_0xaacc('0x2e')]));_0x2aa03e['attributes']=_0x2aa03e[_0xaacc('0x2d')][_0xaacc('0x2f')]?_0x2aa03e[_0xaacc('0x2d')]:_0x2f3182[_0xaacc('0x2c')];_0x2aa03e['order']=qs['sort'](_0x31ec5d[_0xaacc('0x29')][_0xaacc('0x33')]);_0x2aa03e[_0xaacc('0x36')]=qs[_0xaacc('0x2b')](_[_0xaacc('0x46')](_0x31ec5d[_0xaacc('0x29')],_0x2f3182[_0xaacc('0x2b')]));if(_0x31ec5d[_0xaacc('0x29')]['filter']){_0x2aa03e['where']=_[_0xaacc('0x35')](_0x2aa03e['where'],{'$or':_['map'](_0x2aa03e[_0xaacc('0x2d')],function(_0x4f7560){var _0x3f1484={};_0x3f1484[_0x4f7560]={'$like':'%'+_0x31ec5d[_0xaacc('0x29')][_0xaacc('0x34')]+'%'};return _0x3f1484;})});}_0x2aa03e=_[_0xaacc('0x35')]({},_0x2aa03e,_0x31ec5d[_0xaacc('0x40')]);return _0x214fdb[_0xaacc('0x44')](_0x2aa03e);}})['then'](function(_0x4efdf8){if(_0x4efdf8){_0x5fe62a=_0x4efdf8[_0xaacc('0x2f')];if(!_0x31ec5d[_0xaacc('0x29')][_0xaacc('0x30')](_0xaacc('0x31'))){_0x2aa03e[_0xaacc('0x1b')]=qs['limit'](_0x31ec5d[_0xaacc('0x29')][_0xaacc('0x1b')]);_0x2aa03e['offset']=qs[_0xaacc('0x1c')](_0x31ec5d[_0xaacc('0x29')][_0xaacc('0x1c')]);}return _0x214fdb[_0xaacc('0x44')](_0x2aa03e);}})[_0xaacc('0x22')](function(_0x3b0a55){if(_0x3b0a55){return _0x3b0a55?{'count':_0x5fe62a,'rows':_0x3b0a55}:null;}})[_0xaacc('0x22')](respondWithResult(_0xccbfc7,null))[_0xaacc('0x3e')](handleError(_0xccbfc7,null));};exports[_0xaacc('0x47')]=function(_0x37db1a,_0x123a18,_0x2f3060){var _0x123b67={};var _0x169099={};var _0x4bfe27;var _0x5085d1;return db[_0xaacc('0x39')][_0xaacc('0x48')]({'where':{'id':_0x37db1a[_0xaacc('0x43')]['id']}})['then'](handleEntityNotFound(_0x123a18,null))['then'](function(_0x37fd0d){if(_0x37fd0d){_0x4bfe27=_0x37fd0d;_0x169099[_0xaacc('0x2c')]=_[_0xaacc('0x2a')](db[_0xaacc('0x45')][_0xaacc('0x26')]);_0x169099['query']=_['keys'](_0x37db1a[_0xaacc('0x29')]);_0x169099['filters']=_['intersection'](_0x169099[_0xaacc('0x2c')],_0x169099[_0xaacc('0x29')]);_0x123b67[_0xaacc('0x2d')]=_[_0xaacc('0x3f')](_0x169099[_0xaacc('0x2c')],qs[_0xaacc('0x2e')](_0x37db1a[_0xaacc('0x29')][_0xaacc('0x2e')]));_0x123b67['attributes']=_0x123b67[_0xaacc('0x2d')]['length']?_0x123b67[_0xaacc('0x2d')]:_0x169099[_0xaacc('0x2c')];_0x123b67[_0xaacc('0x32')]=qs['sort'](_0x37db1a[_0xaacc('0x29')][_0xaacc('0x33')]);_0x123b67['where']=qs['filters'](_[_0xaacc('0x46')](_0x37db1a[_0xaacc('0x29')],_0x169099[_0xaacc('0x2b')]));if(_0x37db1a[_0xaacc('0x29')]['filter']){_0x123b67['where']=_[_0xaacc('0x35')](_0x123b67[_0xaacc('0x36')],{'$or':_[_0xaacc('0x37')](_0x123b67['attributes'],function(_0x3d8bc0){var _0x150461={};_0x150461[_0x3d8bc0]={'$like':'%'+_0x37db1a['query']['filter']+'%'};return _0x150461;})});}_0x123b67=_[_0xaacc('0x35')]({},_0x123b67,_0x37db1a[_0xaacc('0x40')]);return _0x4bfe27[_0xaacc('0x47')](_0x123b67);}})[_0xaacc('0x22')](function(_0x5e1b1e){if(_0x5e1b1e){_0x5085d1=_0x5e1b1e[_0xaacc('0x2f')];if(!_0x37db1a[_0xaacc('0x29')][_0xaacc('0x30')](_0xaacc('0x31'))){_0x123b67[_0xaacc('0x1b')]=qs[_0xaacc('0x1b')](_0x37db1a[_0xaacc('0x29')]['limit']);_0x123b67['offset']=qs[_0xaacc('0x1c')](_0x37db1a[_0xaacc('0x29')]['offset']);}return _0x4bfe27['getSubjects'](_0x123b67);}})[_0xaacc('0x22')](function(_0x5cb596){if(_0x5cb596){return _0x5cb596?{'count':_0x5085d1,'rows':_0x5cb596}:null;}})['then'](respondWithResult(_0x123a18,null))[_0xaacc('0x3e')](handleError(_0x123a18,null));};exports[_0xaacc('0x49')]=function(_0x314ff9,_0xadf53d,_0x63b50c){var _0xbc241b={};var _0x4bf45a={};var _0x335daf;var _0x3eaa14;return db[_0xaacc('0x39')][_0xaacc('0x48')]({'where':{'id':_0x314ff9[_0xaacc('0x43')]['id']}})['then'](handleEntityNotFound(_0xadf53d,null))[_0xaacc('0x22')](function(_0xd8e346){if(_0xd8e346){_0x335daf=_0xd8e346;_0x4bf45a['model']=_['keys'](db['ZohoField'][_0xaacc('0x26')]);_0x4bf45a['query']=_[_0xaacc('0x2a')](_0x314ff9['query']);_0x4bf45a['filters']=_[_0xaacc('0x3f')](_0x4bf45a[_0xaacc('0x2c')],_0x4bf45a[_0xaacc('0x29')]);_0xbc241b['attributes']=_[_0xaacc('0x3f')](_0x4bf45a[_0xaacc('0x2c')],qs['fields'](_0x314ff9[_0xaacc('0x29')]['fields']));_0xbc241b[_0xaacc('0x2d')]=_0xbc241b[_0xaacc('0x2d')]['length']?_0xbc241b['attributes']:_0x4bf45a[_0xaacc('0x2c')];_0xbc241b[_0xaacc('0x32')]=qs[_0xaacc('0x33')](_0x314ff9[_0xaacc('0x29')][_0xaacc('0x33')]);_0xbc241b[_0xaacc('0x36')]=qs[_0xaacc('0x2b')](_[_0xaacc('0x46')](_0x314ff9[_0xaacc('0x29')],_0x4bf45a[_0xaacc('0x2b')]));if(_0x314ff9[_0xaacc('0x29')][_0xaacc('0x34')]){_0xbc241b[_0xaacc('0x36')]=_[_0xaacc('0x35')](_0xbc241b[_0xaacc('0x36')],{'$or':_[_0xaacc('0x37')](_0xbc241b[_0xaacc('0x2d')],function(_0x21269f){var _0x27809d={};_0x27809d[_0x21269f]={'$like':'%'+_0x314ff9[_0xaacc('0x29')][_0xaacc('0x34')]+'%'};return _0x27809d;})});}_0xbc241b=_[_0xaacc('0x35')]({},_0xbc241b,_0x314ff9['options']);return _0x335daf['getDescriptions'](_0xbc241b);}})['then'](function(_0x37aae3){if(_0x37aae3){_0x3eaa14=_0x37aae3['length'];if(!_0x314ff9[_0xaacc('0x29')]['hasOwnProperty'](_0xaacc('0x31'))){_0xbc241b[_0xaacc('0x1b')]=qs[_0xaacc('0x1b')](_0x314ff9[_0xaacc('0x29')]['limit']);_0xbc241b[_0xaacc('0x1c')]=qs[_0xaacc('0x1c')](_0x314ff9[_0xaacc('0x29')][_0xaacc('0x1c')]);}return _0x335daf['getDescriptions'](_0xbc241b);}})[_0xaacc('0x22')](function(_0x58060a){if(_0x58060a){return _0x58060a?{'count':_0x3eaa14,'rows':_0x58060a}:null;}})['then'](respondWithResult(_0xadf53d,null))[_0xaacc('0x3e')](handleError(_0xadf53d,null));}; \ No newline at end of file +var _0x77b5=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','show','intersection','find','create','body','params','findOne','ZohoField','options','getFields','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2339a7,_0x4597df){var _0x1e72d5=function(_0x5583ca){while(--_0x5583ca){_0x2339a7['push'](_0x2339a7['shift']());}};_0x1e72d5(++_0x4597df);}(_0x77b5,0x181));var _0x577b=function(_0x1785a2,_0x15d901){_0x1785a2=_0x1785a2-0x0;var _0x58380c=_0x77b5[_0x1785a2];return _0x58380c;};'use strict';var emlformat=require(_0x577b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x577b('0x1'));var rp=require(_0x577b('0x2'));var moment=require(_0x577b('0x3'));var BPromise=require(_0x577b('0x4'));var Mustache=require(_0x577b('0x5'));var util=require(_0x577b('0x6'));var path=require(_0x577b('0x7'));var sox=require('sox');var csv=require(_0x577b('0x8'));var ejs=require(_0x577b('0x9'));var fs=require('fs');var fs_extra=require(_0x577b('0xa'));var _=require('lodash');var squel=require(_0x577b('0xb'));var crypto=require(_0x577b('0xc'));var jsforce=require(_0x577b('0xd'));var deskjs=require(_0x577b('0xe'));var toCsv=require(_0x577b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x577b('0xf'));var authService=require(_0x577b('0x10'));var qs=require(_0x577b('0x11'));var as=require(_0x577b('0x12'));var hardwareService=require(_0x577b('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x577b('0x14'));var config=require(_0x577b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x577b('0x16'))['db'];function respondWithStatusCode(_0x6b808b,_0x24372e){_0x24372e=_0x24372e||0xcc;return function(_0x109581){if(_0x109581){return _0x6b808b[_0x577b('0x17')](_0x24372e);}return _0x6b808b['status'](_0x24372e)['end']();};}function respondWithResult(_0x4c70ab,_0x44f37d){_0x44f37d=_0x44f37d||0xc8;return function(_0x1e7fb3){if(_0x1e7fb3){return _0x4c70ab[_0x577b('0x18')](_0x44f37d)[_0x577b('0x19')](_0x1e7fb3);}};}function respondWithFilteredResult(_0x117fed,_0x436ae7){return function(_0x2ad9db){if(_0x2ad9db){var _0x2fcf50=typeof _0x436ae7['offset']===_0x577b('0x1a')&&typeof _0x436ae7[_0x577b('0x1b')]==='undefined';var _0x36b3bf=_0x2ad9db[_0x577b('0x1c')];var _0xf98a6d=_0x2fcf50?0x0:_0x436ae7[_0x577b('0x1d')];var _0x48a13f=_0x2fcf50?_0x2ad9db[_0x577b('0x1c')]:_0x436ae7[_0x577b('0x1d')]+_0x436ae7[_0x577b('0x1b')];var _0x2160fb;if(_0x48a13f>=_0x36b3bf){_0x48a13f=_0x36b3bf;_0x2160fb=0xc8;}else{_0x2160fb=0xce;}_0x117fed[_0x577b('0x18')](_0x2160fb);return _0x117fed[_0x577b('0x1e')](_0x577b('0x1f'),_0xf98a6d+'-'+_0x48a13f+'/'+_0x36b3bf)['json'](_0x2ad9db);}return null;};}function patchUpdates(_0x45260e){return function(_0x59ab0d){try{jsonpatch[_0x577b('0x20')](_0x59ab0d,_0x45260e,!![]);}catch(_0x305b45){return BPromise[_0x577b('0x21')](_0x305b45);}return _0x59ab0d[_0x577b('0x22')]();};}function saveUpdates(_0x54c9d2,_0x25306d){return function(_0x24c44a){if(_0x24c44a){return _0x24c44a[_0x577b('0x23')](_0x54c9d2)[_0x577b('0x24')](function(_0x51dde0){return _0x51dde0;});}return null;};}function removeEntity(_0x50fe35,_0x226f29){return function(_0x4d2607){if(_0x4d2607){return _0x4d2607[_0x577b('0x25')]()[_0x577b('0x24')](function(){_0x50fe35[_0x577b('0x18')](0xcc)[_0x577b('0x26')]();});}};}function handleEntityNotFound(_0x1403ac,_0x10dd9c){return function(_0x3ca9ec){if(!_0x3ca9ec){_0x1403ac[_0x577b('0x17')](0x194);}return _0x3ca9ec;};}function handleError(_0x142af3,_0xa3f459){_0xa3f459=_0xa3f459||0x1f4;return function(_0x3c9c41){logger['error'](_0x3c9c41[_0x577b('0x27')]);if(_0x3c9c41[_0x577b('0x28')]){delete _0x3c9c41['name'];}_0x142af3[_0x577b('0x18')](_0xa3f459)[_0x577b('0x29')](_0x3c9c41);};}exports[_0x577b('0x2a')]=function(_0x28ca35,_0x5266a5){var _0xadfc49={},_0x32d30c={},_0x4cb530={'count':0x0,'rows':[]};var _0x37a91d=_[_0x577b('0x2b')](db[_0x577b('0x2c')][_0x577b('0x2d')],function(_0x14b604){return{'name':_0x14b604[_0x577b('0x2e')],'type':_0x14b604[_0x577b('0x2f')][_0x577b('0x30')]};});_0x32d30c[_0x577b('0x31')]=_['map'](_0x37a91d,'name');_0x32d30c[_0x577b('0x32')]=_[_0x577b('0x33')](_0x28ca35[_0x577b('0x32')]);_0x32d30c['filters']=_['intersection'](_0x32d30c[_0x577b('0x31')],_0x32d30c[_0x577b('0x32')]);_0xadfc49[_0x577b('0x34')]=_['intersection'](_0x32d30c['model'],qs[_0x577b('0x35')](_0x28ca35[_0x577b('0x32')][_0x577b('0x35')]));_0xadfc49[_0x577b('0x34')]=_0xadfc49[_0x577b('0x34')][_0x577b('0x36')]?_0xadfc49[_0x577b('0x34')]:_0x32d30c['model'];if(!_0x28ca35[_0x577b('0x32')][_0x577b('0x37')](_0x577b('0x38'))){_0xadfc49['limit']=qs[_0x577b('0x1b')](_0x28ca35['query']['limit']);_0xadfc49['offset']=qs['offset'](_0x28ca35['query'][_0x577b('0x1d')]);}_0xadfc49[_0x577b('0x39')]=qs[_0x577b('0x3a')](_0x28ca35[_0x577b('0x32')][_0x577b('0x3a')]);_0xadfc49[_0x577b('0x3b')]=qs[_0x577b('0x3c')](_[_0x577b('0x3d')](_0x28ca35[_0x577b('0x32')],_0x32d30c[_0x577b('0x3c')]),_0x37a91d);if(_0x28ca35[_0x577b('0x32')][_0x577b('0x3e')]){_0xadfc49[_0x577b('0x3b')]=_[_0x577b('0x3f')](_0xadfc49[_0x577b('0x3b')],{'$or':_[_0x577b('0x2b')](_0x37a91d,function(_0x58e36d){if(_0x58e36d[_0x577b('0x2f')]!=='VIRTUAL'){var _0x41cc83={};_0x41cc83[_0x58e36d[_0x577b('0x28')]]={'$like':'%'+_0x28ca35[_0x577b('0x32')]['filter']+'%'};return _0x41cc83;}})});}_0xadfc49=_[_0x577b('0x3f')]({},_0xadfc49,_0x28ca35['options']);var _0x31d13c={'where':_0xadfc49[_0x577b('0x3b')]};return db[_0x577b('0x2c')][_0x577b('0x1c')](_0x31d13c)[_0x577b('0x24')](function(_0x151154){_0x4cb530[_0x577b('0x1c')]=_0x151154;if(_0x28ca35['query'][_0x577b('0x40')]){_0xadfc49[_0x577b('0x41')]=[{'all':!![]}];}return db[_0x577b('0x2c')][_0x577b('0x42')](_0xadfc49);})[_0x577b('0x24')](function(_0x5d9e75){_0x4cb530[_0x577b('0x43')]=_0x5d9e75;return _0x4cb530;})[_0x577b('0x24')](respondWithFilteredResult(_0x5266a5,_0xadfc49))[_0x577b('0x44')](handleError(_0x5266a5,null));};exports[_0x577b('0x45')]=function(_0x1465ba,_0x2667de){var _0x39a814={'raw':![],'where':{'id':_0x1465ba['params']['id']}},_0x5cac64={};_0x5cac64[_0x577b('0x31')]=_[_0x577b('0x33')](db['ZohoConfiguration'][_0x577b('0x2d')]);_0x5cac64[_0x577b('0x32')]=_[_0x577b('0x33')](_0x1465ba[_0x577b('0x32')]);_0x5cac64[_0x577b('0x3c')]=_[_0x577b('0x46')](_0x5cac64[_0x577b('0x31')],_0x5cac64[_0x577b('0x32')]);_0x39a814[_0x577b('0x34')]=_[_0x577b('0x46')](_0x5cac64[_0x577b('0x31')],qs[_0x577b('0x35')](_0x1465ba[_0x577b('0x32')][_0x577b('0x35')]));_0x39a814[_0x577b('0x34')]=_0x39a814[_0x577b('0x34')][_0x577b('0x36')]?_0x39a814[_0x577b('0x34')]:_0x5cac64[_0x577b('0x31')];if(_0x1465ba['query'][_0x577b('0x40')]){_0x39a814[_0x577b('0x41')]=[{'all':!![]}];}_0x39a814=_[_0x577b('0x3f')]({},_0x39a814,_0x1465ba['options']);return db['ZohoConfiguration'][_0x577b('0x47')](_0x39a814)[_0x577b('0x24')](handleEntityNotFound(_0x2667de,null))[_0x577b('0x24')](respondWithResult(_0x2667de,null))[_0x577b('0x44')](handleError(_0x2667de,null));};exports[_0x577b('0x48')]=function(_0x5b6a5c,_0x52f31e){return db[_0x577b('0x2c')][_0x577b('0x48')](_0x5b6a5c[_0x577b('0x49')],{})[_0x577b('0x24')](respondWithResult(_0x52f31e,0xc9))[_0x577b('0x44')](handleError(_0x52f31e,null));};exports[_0x577b('0x23')]=function(_0x4c8e87,_0x53dabc){if(_0x4c8e87[_0x577b('0x49')]['id']){delete _0x4c8e87[_0x577b('0x49')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x4c8e87['params']['id']}})[_0x577b('0x24')](handleEntityNotFound(_0x53dabc,null))[_0x577b('0x24')](saveUpdates(_0x4c8e87[_0x577b('0x49')],null))['then'](respondWithResult(_0x53dabc,null))['catch'](handleError(_0x53dabc,null));};exports[_0x577b('0x25')]=function(_0x16b853,_0x4b8f7c){return db[_0x577b('0x2c')]['find']({'where':{'id':_0x16b853[_0x577b('0x4a')]['id']}})[_0x577b('0x24')](handleEntityNotFound(_0x4b8f7c,null))['then'](removeEntity(_0x4b8f7c,null))[_0x577b('0x44')](handleError(_0x4b8f7c,null));};exports['getFields']=function(_0xd53ced,_0x965f9a,_0x2c6191){var _0x329fa6={};var _0x473658={};var _0x142ef0;var _0x237289;return db[_0x577b('0x2c')][_0x577b('0x4b')]({'where':{'id':_0xd53ced['params']['id']}})[_0x577b('0x24')](handleEntityNotFound(_0x965f9a,null))[_0x577b('0x24')](function(_0x3b4a8f){if(_0x3b4a8f){_0x142ef0=_0x3b4a8f;_0x473658['model']=_[_0x577b('0x33')](db[_0x577b('0x4c')][_0x577b('0x2d')]);_0x473658[_0x577b('0x32')]=_[_0x577b('0x33')](_0xd53ced[_0x577b('0x32')]);_0x473658['filters']=_[_0x577b('0x46')](_0x473658[_0x577b('0x31')],_0x473658[_0x577b('0x32')]);_0x329fa6[_0x577b('0x34')]=_[_0x577b('0x46')](_0x473658['model'],qs['fields'](_0xd53ced['query'][_0x577b('0x35')]));_0x329fa6[_0x577b('0x34')]=_0x329fa6[_0x577b('0x34')]['length']?_0x329fa6[_0x577b('0x34')]:_0x473658[_0x577b('0x31')];_0x329fa6[_0x577b('0x39')]=qs[_0x577b('0x3a')](_0xd53ced[_0x577b('0x32')][_0x577b('0x3a')]);_0x329fa6[_0x577b('0x3b')]=qs[_0x577b('0x3c')](_[_0x577b('0x3d')](_0xd53ced[_0x577b('0x32')],_0x473658[_0x577b('0x3c')]));if(_0xd53ced['query']['filter']){_0x329fa6[_0x577b('0x3b')]=_[_0x577b('0x3f')](_0x329fa6['where'],{'$or':_[_0x577b('0x2b')](_0x329fa6[_0x577b('0x34')],function(_0x40feb2){var _0x46f63d={};_0x46f63d[_0x40feb2]={'$like':'%'+_0xd53ced['query'][_0x577b('0x3e')]+'%'};return _0x46f63d;})});}_0x329fa6=_['merge']({},_0x329fa6,_0xd53ced[_0x577b('0x4d')]);return _0x142ef0[_0x577b('0x4e')](_0x329fa6);}})[_0x577b('0x24')](function(_0x58887b){if(_0x58887b){_0x237289=_0x58887b['length'];if(!_0xd53ced[_0x577b('0x32')][_0x577b('0x37')](_0x577b('0x38'))){_0x329fa6['limit']=qs[_0x577b('0x1b')](_0xd53ced[_0x577b('0x32')][_0x577b('0x1b')]);_0x329fa6[_0x577b('0x1d')]=qs[_0x577b('0x1d')](_0xd53ced['query'][_0x577b('0x1d')]);}return _0x142ef0[_0x577b('0x4e')](_0x329fa6);}})['then'](function(_0xc8523d){if(_0xc8523d){return _0xc8523d?{'count':_0x237289,'rows':_0xc8523d}:null;}})[_0x577b('0x24')](respondWithResult(_0x965f9a,null))[_0x577b('0x44')](handleError(_0x965f9a,null));};exports['getSubjects']=function(_0x230228,_0x16fb33,_0x472284){var _0x4bea25={};var _0x3368c5={};var _0x507aad;var _0x4dc974;return db[_0x577b('0x2c')]['findOne']({'where':{'id':_0x230228[_0x577b('0x4a')]['id']}})[_0x577b('0x24')](handleEntityNotFound(_0x16fb33,null))['then'](function(_0x17048c){if(_0x17048c){_0x507aad=_0x17048c;_0x3368c5['model']=_[_0x577b('0x33')](db[_0x577b('0x4c')][_0x577b('0x2d')]);_0x3368c5[_0x577b('0x32')]=_[_0x577b('0x33')](_0x230228['query']);_0x3368c5[_0x577b('0x3c')]=_[_0x577b('0x46')](_0x3368c5['model'],_0x3368c5[_0x577b('0x32')]);_0x4bea25[_0x577b('0x34')]=_[_0x577b('0x46')](_0x3368c5[_0x577b('0x31')],qs['fields'](_0x230228[_0x577b('0x32')][_0x577b('0x35')]));_0x4bea25[_0x577b('0x34')]=_0x4bea25[_0x577b('0x34')]['length']?_0x4bea25[_0x577b('0x34')]:_0x3368c5[_0x577b('0x31')];_0x4bea25['order']=qs[_0x577b('0x3a')](_0x230228[_0x577b('0x32')][_0x577b('0x3a')]);_0x4bea25[_0x577b('0x3b')]=qs[_0x577b('0x3c')](_[_0x577b('0x3d')](_0x230228[_0x577b('0x32')],_0x3368c5[_0x577b('0x3c')]));if(_0x230228['query']['filter']){_0x4bea25['where']=_[_0x577b('0x3f')](_0x4bea25['where'],{'$or':_['map'](_0x4bea25[_0x577b('0x34')],function(_0x2415d2){var _0x5979e9={};_0x5979e9[_0x2415d2]={'$like':'%'+_0x230228[_0x577b('0x32')]['filter']+'%'};return _0x5979e9;})});}_0x4bea25=_[_0x577b('0x3f')]({},_0x4bea25,_0x230228[_0x577b('0x4d')]);return _0x507aad[_0x577b('0x4f')](_0x4bea25);}})['then'](function(_0x33fea5){if(_0x33fea5){_0x4dc974=_0x33fea5[_0x577b('0x36')];if(!_0x230228['query']['hasOwnProperty'](_0x577b('0x38'))){_0x4bea25[_0x577b('0x1b')]=qs[_0x577b('0x1b')](_0x230228[_0x577b('0x32')][_0x577b('0x1b')]);_0x4bea25[_0x577b('0x1d')]=qs[_0x577b('0x1d')](_0x230228['query'][_0x577b('0x1d')]);}return _0x507aad[_0x577b('0x4f')](_0x4bea25);}})['then'](function(_0x4930f5){if(_0x4930f5){return _0x4930f5?{'count':_0x4dc974,'rows':_0x4930f5}:null;}})[_0x577b('0x24')](respondWithResult(_0x16fb33,null))[_0x577b('0x44')](handleError(_0x16fb33,null));};exports[_0x577b('0x50')]=function(_0x308f63,_0x27e3cd,_0x332b68){var _0x46691d={};var _0x5be58e={};var _0x3d7b03;var _0xff37ea;return db[_0x577b('0x2c')][_0x577b('0x4b')]({'where':{'id':_0x308f63[_0x577b('0x4a')]['id']}})[_0x577b('0x24')](handleEntityNotFound(_0x27e3cd,null))[_0x577b('0x24')](function(_0x3421e1){if(_0x3421e1){_0x3d7b03=_0x3421e1;_0x5be58e[_0x577b('0x31')]=_['keys'](db[_0x577b('0x4c')][_0x577b('0x2d')]);_0x5be58e[_0x577b('0x32')]=_[_0x577b('0x33')](_0x308f63[_0x577b('0x32')]);_0x5be58e[_0x577b('0x3c')]=_[_0x577b('0x46')](_0x5be58e[_0x577b('0x31')],_0x5be58e[_0x577b('0x32')]);_0x46691d['attributes']=_['intersection'](_0x5be58e[_0x577b('0x31')],qs[_0x577b('0x35')](_0x308f63[_0x577b('0x32')]['fields']));_0x46691d['attributes']=_0x46691d[_0x577b('0x34')][_0x577b('0x36')]?_0x46691d['attributes']:_0x5be58e[_0x577b('0x31')];_0x46691d[_0x577b('0x39')]=qs[_0x577b('0x3a')](_0x308f63[_0x577b('0x32')][_0x577b('0x3a')]);_0x46691d[_0x577b('0x3b')]=qs[_0x577b('0x3c')](_[_0x577b('0x3d')](_0x308f63[_0x577b('0x32')],_0x5be58e[_0x577b('0x3c')]));if(_0x308f63[_0x577b('0x32')][_0x577b('0x3e')]){_0x46691d['where']=_[_0x577b('0x3f')](_0x46691d[_0x577b('0x3b')],{'$or':_[_0x577b('0x2b')](_0x46691d[_0x577b('0x34')],function(_0x5c7f67){var _0x137092={};_0x137092[_0x5c7f67]={'$like':'%'+_0x308f63[_0x577b('0x32')][_0x577b('0x3e')]+'%'};return _0x137092;})});}_0x46691d=_[_0x577b('0x3f')]({},_0x46691d,_0x308f63[_0x577b('0x4d')]);return _0x3d7b03[_0x577b('0x50')](_0x46691d);}})['then'](function(_0x1d190e){if(_0x1d190e){_0xff37ea=_0x1d190e[_0x577b('0x36')];if(!_0x308f63[_0x577b('0x32')][_0x577b('0x37')](_0x577b('0x38'))){_0x46691d['limit']=qs[_0x577b('0x1b')](_0x308f63['query'][_0x577b('0x1b')]);_0x46691d[_0x577b('0x1d')]=qs[_0x577b('0x1d')](_0x308f63[_0x577b('0x32')][_0x577b('0x1d')]);}return _0x3d7b03['getDescriptions'](_0x46691d);}})[_0x577b('0x24')](function(_0x587da1){if(_0x587da1){return _0x587da1?{'count':_0xff37ea,'rows':_0x587da1}:null;}})[_0x577b('0x24')](respondWithResult(_0x27e3cd,null))[_0x577b('0x44')](handleError(_0x27e3cd,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index dcbebe7..3b7bc0f 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 _0x635c=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations'];(function(_0xb72479,_0x5939fd){var _0x2ef029=function(_0x5736c8){while(--_0x5736c8){_0xb72479['push'](_0xb72479['shift']());}};_0x2ef029(++_0x5939fd);}(_0x635c,0xdc));var _0xc635=function(_0x2cd9d0,_0x814b00){_0x2cd9d0=_0x2cd9d0-0x0;var _0x597b1b=_0x635c[_0x2cd9d0];return _0x597b1b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc635('0x0'))(_0xc635('0x1'));var moment=require('moment');var BPromise=require(_0xc635('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc635('0x3'));var rimraf=require(_0xc635('0x4'));var config=require(_0xc635('0x5'));var attributes=require(_0xc635('0x6'));module[_0xc635('0x7')]=function(_0x21d8d2,_0x39da3c){return _0x21d8d2[_0xc635('0x8')]('ZohoConfiguration',attributes,{'tableName':_0xc635('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0956=['./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5ba34a,_0x55143b){var _0xc9695c=function(_0x47668a){while(--_0x47668a){_0x5ba34a['push'](_0x5ba34a['shift']());}};_0xc9695c(++_0x55143b);}(_0x0956,0x1f0));var _0x6095=function(_0x39983d,_0x34dc0a){_0x39983d=_0x39983d-0x0;var _0x56f5b1=_0x0956[_0x39983d];return _0x56f5b1;};'use strict';var _=require(_0x6095('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6095('0x1'));var moment=require(_0x6095('0x2'));var BPromise=require(_0x6095('0x3'));var rp=require(_0x6095('0x4'));var fs=require('fs');var path=require(_0x6095('0x5'));var rimraf=require(_0x6095('0x6'));var config=require(_0x6095('0x7'));var attributes=require(_0x6095('0x8'));module[_0x6095('0x9')]=function(_0x55dc23,_0x3b89df){return _0x55dc23[_0x6095('0xa')]('ZohoConfiguration',attributes,{'tableName':_0x6095('0xb'),'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 b44bd80..9bc5d81 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 _0x60bd=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x60bd,0x1cb));var _0xd60b=function(_0x5bb9f6,_0x2a892b){_0x5bb9f6=_0x5bb9f6-0x0;var _0x1f3db4=_0x60bd[_0x5bb9f6];return _0x1f3db4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd60b('0x0'));var BPromise=require(_0xd60b('0x1'));var rs=require(_0xd60b('0x2'));var fs=require('fs');var Redis=require(_0xd60b('0x3'));var db=require(_0xd60b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd60b('0x5'));var config=require(_0xd60b('0x6'));var jayson=require(_0xd60b('0x7'));var client=jayson[_0xd60b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b504c,_0x38f9ef,_0x2ada41){return new BPromise(function(_0x4bf219,_0x561cc5){return client[_0xd60b('0x9')](_0x5b504c,_0x2ada41)[_0xd60b('0xa')](function(_0x590cec){logger[_0xd60b('0xb')](_0xd60b('0xc'),_0x38f9ef,_0xd60b('0xd'));logger[_0xd60b('0xe')](_0xd60b('0xf'),_0x38f9ef,_0xd60b('0xd'),JSON[_0xd60b('0x10')](_0x590cec));if(_0x590cec[_0xd60b('0x11')]){if(_0x590cec['error'][_0xd60b('0x12')]===0x1f4){logger[_0xd60b('0x11')](_0xd60b('0xc'),_0x38f9ef,_0x590cec[_0xd60b('0x11')][_0xd60b('0x13')]);return _0x561cc5(_0x590cec[_0xd60b('0x11')][_0xd60b('0x13')]);}logger['error'](_0xd60b('0xc'),_0x38f9ef,_0x590cec[_0xd60b('0x11')]['message']);return _0x4bf219(_0x590cec['error'][_0xd60b('0x13')]);}else{logger['info'](_0xd60b('0xc'),_0x38f9ef,'request\x20sent');_0x4bf219(_0x590cec[_0xd60b('0x14')][_0xd60b('0x13')]);}})[_0xd60b('0x15')](function(_0x2d9b71){logger[_0xd60b('0x11')](_0xd60b('0xc'),_0x38f9ef,_0x2d9b71);_0x561cc5(_0x2d9b71);});});} \ No newline at end of file +var _0x6f62=['message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xf4b7da,_0x13a87b){var _0xe49849=function(_0x4f4285){while(--_0x4f4285){_0xf4b7da['push'](_0xf4b7da['shift']());}};_0xe49849(++_0x13a87b);}(_0x6f62,0x1a4));var _0x26f6=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x6f62[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require(_0x26f6('0x0'));var moment=require(_0x26f6('0x1'));var BPromise=require(_0x26f6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x26f6('0x3'));var db=require(_0x26f6('0x4'))['db'];var utils=require(_0x26f6('0x5'));var logger=require(_0x26f6('0x6'))(_0x26f6('0x7'));var config=require(_0x26f6('0x8'));var jayson=require(_0x26f6('0x9'));var client=jayson[_0x26f6('0xa')][_0x26f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12959f,_0x11b672,_0xd9eab3){return new BPromise(function(_0x35b9d0,_0x30f4e4){return client[_0x26f6('0xc')](_0x12959f,_0xd9eab3)[_0x26f6('0xd')](function(_0x331db0){logger['info'](_0x26f6('0xe'),_0x11b672,_0x26f6('0xf'));logger[_0x26f6('0x10')](_0x26f6('0x11'),_0x11b672,'request\x20sent',JSON[_0x26f6('0x12')](_0x331db0));if(_0x331db0[_0x26f6('0x13')]){if(_0x331db0['error']['code']===0x1f4){logger[_0x26f6('0x13')](_0x26f6('0xe'),_0x11b672,_0x331db0[_0x26f6('0x13')][_0x26f6('0x14')]);return _0x30f4e4(_0x331db0[_0x26f6('0x13')][_0x26f6('0x14')]);}logger[_0x26f6('0x13')](_0x26f6('0xe'),_0x11b672,_0x331db0[_0x26f6('0x13')][_0x26f6('0x14')]);return _0x35b9d0(_0x331db0[_0x26f6('0x13')][_0x26f6('0x14')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x11b672,_0x26f6('0xf'));_0x35b9d0(_0x331db0[_0x26f6('0x15')]['message']);}})['catch'](function(_0x407f3d){logger['error'](_0x26f6('0xe'),_0x11b672,_0x407f3d);_0x30f4e4(_0x407f3d);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 94f02de..919a62b 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 _0x8f34=['Router','../../components/auth/service','../../config/environment','./intZohoField.controller','get','/:id','isAuthenticated','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x36453b,_0x104046){var _0x1173aa=function(_0x132779){while(--_0x132779){_0x36453b['push'](_0x36453b['shift']());}};_0x1173aa(++_0x104046);}(_0x8f34,0xfa));var _0x48f3=function(_0x334127,_0xf665e){_0x334127=_0x334127-0x0;var _0x4076f2=_0x8f34[_0x334127];return _0x4076f2;};'use strict';var multer=require(_0x48f3('0x0'));var util=require(_0x48f3('0x1'));var path=require(_0x48f3('0x2'));var timeout=require(_0x48f3('0x3'));var express=require(_0x48f3('0x4'));var router=express[_0x48f3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x48f3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x48f3('0x7'));var controller=require(_0x48f3('0x8'));router[_0x48f3('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x48f3('0x9')](_0x48f3('0xa'),auth[_0x48f3('0xb')](),controller['show']);router['post']('/',auth[_0x48f3('0xb')](),controller[_0x48f3('0xc')]);router[_0x48f3('0xd')](_0x48f3('0xa'),auth[_0x48f3('0xb')](),controller[_0x48f3('0xe')]);router[_0x48f3('0xf')](_0x48f3('0xa'),auth[_0x48f3('0xb')](),controller['destroy']);module[_0x48f3('0x10')]=router; \ No newline at end of file +var _0x32dc=['/:id','show','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0x32dc,0x13a));var _0xc32d=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x32dc[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0xc32d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc32d('0x1'));var express=require(_0xc32d('0x2'));var router=express[_0xc32d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc32d('0x4'));var interaction=require(_0xc32d('0x5'));var config=require(_0xc32d('0x6'));var controller=require(_0xc32d('0x7'));router[_0xc32d('0x8')]('/',auth[_0xc32d('0x9')](),controller['index']);router['get'](_0xc32d('0xa'),auth['isAuthenticated'](),controller[_0xc32d('0xb')]);router[_0xc32d('0xc')]('/',auth[_0xc32d('0x9')](),controller['create']);router[_0xc32d('0xd')](_0xc32d('0xa'),auth[_0xc32d('0x9')](),controller[_0xc32d('0xe')]);router[_0xc32d('0xf')](_0xc32d('0xa'),auth[_0xc32d('0x9')](),controller[_0xc32d('0x10')]);module[_0xc32d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index e25cf8c..ded509f 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 _0xa67c=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x3fe6df,_0x5a04d4){var _0x372a0e=function(_0x144b98){while(--_0x144b98){_0x3fe6df['push'](_0x3fe6df['shift']());}};_0x372a0e(++_0x5a04d4);}(_0xa67c,0x6d));var _0xca67=function(_0xdba51b,_0x595244){_0xdba51b=_0xdba51b-0x0;var _0x2e572b=_0xa67c[_0xdba51b];return _0x2e572b;};'use strict';var Sequelize=require(_0xca67('0x0'));module['exports']={'type':{'type':Sequelize[_0xca67('0x1')](_0xca67('0x2'),'variable',_0xca67('0x3'),_0xca67('0x4'),_0xca67('0x5')),'defaultValue':_0xca67('0x2')},'content':{'type':Sequelize[_0xca67('0x6')]},'key':{'type':Sequelize[_0xca67('0x6')]},'keyType':{'type':Sequelize[_0xca67('0x1')](_0xca67('0x2'),'variable',_0xca67('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xca67('0x6')]},'nameField':{'type':Sequelize[_0xca67('0x6')]},'customField':{'type':Sequelize[_0xca67('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xca67('0x6')]}}; \ No newline at end of file +var _0xf9e6=['customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','STRING','string'];(function(_0x5b3822,_0x42e93f){var _0x13de98=function(_0x946515){while(--_0x946515){_0x5b3822['push'](_0x5b3822['shift']());}};_0x13de98(++_0x42e93f);}(_0xf9e6,0x110));var _0x6f9e=function(_0x2760c0,_0x46dc65){_0x2760c0=_0x2760c0-0x0;var _0x2bbb38=_0xf9e6[_0x2760c0];return _0x2bbb38;};'use strict';var Sequelize=require(_0x6f9e('0x0'));module[_0x6f9e('0x1')]={'type':{'type':Sequelize[_0x6f9e('0x2')]('string',_0x6f9e('0x3'),'customVariable',_0x6f9e('0x4'),_0x6f9e('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6f9e('0x6')]},'key':{'type':Sequelize[_0x6f9e('0x6')]},'keyType':{'type':Sequelize[_0x6f9e('0x2')](_0x6f9e('0x7'),_0x6f9e('0x3'),_0x6f9e('0x8'))},'keyContent':{'type':Sequelize[_0x6f9e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6f9e('0x6')]},'customField':{'type':Sequelize[_0x6f9e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6f9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 1c846c1..5390a72 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 _0xa8ff=['end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','options','ZohoField','include','findAll','catch','show','params','create','body','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xa8ff,0x110));var _0xfa8f=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xa8ff[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0xfa8f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfa8f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa8f('0x2'));var moment=require(_0xfa8f('0x3'));var BPromise=require(_0xfa8f('0x4'));var Mustache=require(_0xfa8f('0x5'));var util=require(_0xfa8f('0x6'));var path=require(_0xfa8f('0x7'));var sox=require(_0xfa8f('0x8'));var csv=require('to-csv');var ejs=require(_0xfa8f('0x9'));var fs=require('fs');var fs_extra=require(_0xfa8f('0xa'));var _=require(_0xfa8f('0xb'));var squel=require(_0xfa8f('0xc'));var crypto=require(_0xfa8f('0xd'));var jsforce=require(_0xfa8f('0xe'));var deskjs=require(_0xfa8f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfa8f('0x10'));var Papa=require(_0xfa8f('0x11'));var Redis=require(_0xfa8f('0x12'));var authService=require(_0xfa8f('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa8f('0x14'))(_0xfa8f('0x15'));var utils=require(_0xfa8f('0x16'));var config=require(_0xfa8f('0x17'));var licenseUtil=require(_0xfa8f('0x18'));var db=require(_0xfa8f('0x19'))['db'];function respondWithStatusCode(_0x296154,_0x1fd3ac){_0x1fd3ac=_0x1fd3ac||0xcc;return function(_0x3b9bc2){if(_0x3b9bc2){return _0x296154[_0xfa8f('0x1a')](_0x1fd3ac);}return _0x296154[_0xfa8f('0x1b')](_0x1fd3ac)[_0xfa8f('0x1c')]();};}function respondWithResult(_0x43ffd2,_0x3eee98){_0x3eee98=_0x3eee98||0xc8;return function(_0x253beb){if(_0x253beb){return _0x43ffd2[_0xfa8f('0x1b')](_0x3eee98)[_0xfa8f('0x1d')](_0x253beb);}};}function respondWithFilteredResult(_0x342133,_0x45d411){return function(_0x2e8473){if(_0x2e8473){var _0x338440=typeof _0x45d411[_0xfa8f('0x1e')]===_0xfa8f('0x1f')&&typeof _0x45d411[_0xfa8f('0x20')]==='undefined';var _0x541f2c=_0x2e8473['count'];var _0xa79b0=_0x338440?0x0:_0x45d411[_0xfa8f('0x1e')];var _0x1e586e=_0x338440?_0x2e8473[_0xfa8f('0x21')]:_0x45d411[_0xfa8f('0x1e')]+_0x45d411[_0xfa8f('0x20')];var _0x7e6530;if(_0x1e586e>=_0x541f2c){_0x1e586e=_0x541f2c;_0x7e6530=0xc8;}else{_0x7e6530=0xce;}_0x342133[_0xfa8f('0x1b')](_0x7e6530);return _0x342133[_0xfa8f('0x22')](_0xfa8f('0x23'),_0xa79b0+'-'+_0x1e586e+'/'+_0x541f2c)[_0xfa8f('0x1d')](_0x2e8473);}return null;};}function patchUpdates(_0x4d133d){return function(_0x5d8a56){try{jsonpatch['apply'](_0x5d8a56,_0x4d133d,!![]);}catch(_0x91ae6f){return BPromise[_0xfa8f('0x24')](_0x91ae6f);}return _0x5d8a56[_0xfa8f('0x25')]();};}function saveUpdates(_0x1b6841,_0x3ad09c){return function(_0x322faf){if(_0x322faf){return _0x322faf[_0xfa8f('0x26')](_0x1b6841)[_0xfa8f('0x27')](function(_0x57a9af){return _0x57a9af;});}return null;};}function removeEntity(_0x1afb1c,_0x13ba9f){return function(_0x1c7eaf){if(_0x1c7eaf){return _0x1c7eaf[_0xfa8f('0x28')]()[_0xfa8f('0x27')](function(){_0x1afb1c[_0xfa8f('0x1b')](0xcc)[_0xfa8f('0x1c')]();});}};}function handleEntityNotFound(_0x25f6d6,_0x24cbc0){return function(_0x178cad){if(!_0x178cad){_0x25f6d6[_0xfa8f('0x1a')](0x194);}return _0x178cad;};}function handleError(_0x7795db,_0x281aa6){_0x281aa6=_0x281aa6||0x1f4;return function(_0x3fb5dd){logger[_0xfa8f('0x29')](_0x3fb5dd[_0xfa8f('0x2a')]);if(_0x3fb5dd[_0xfa8f('0x2b')]){delete _0x3fb5dd[_0xfa8f('0x2b')];}_0x7795db[_0xfa8f('0x1b')](_0x281aa6)[_0xfa8f('0x2c')](_0x3fb5dd);};}exports[_0xfa8f('0x2d')]=function(_0x49dfd4,_0x3fd2a0){var _0xc06d96={},_0x42133a={},_0x362b35={'count':0x0,'rows':[]};var _0x572fff=_[_0xfa8f('0x2e')](db['ZohoField'][_0xfa8f('0x2f')],function(_0x552b38){return{'name':_0x552b38[_0xfa8f('0x30')],'type':_0x552b38['type'][_0xfa8f('0x31')]};});_0x42133a[_0xfa8f('0x32')]=_[_0xfa8f('0x2e')](_0x572fff,'name');_0x42133a[_0xfa8f('0x33')]=_[_0xfa8f('0x34')](_0x49dfd4[_0xfa8f('0x33')]);_0x42133a[_0xfa8f('0x35')]=_['intersection'](_0x42133a[_0xfa8f('0x32')],_0x42133a[_0xfa8f('0x33')]);_0xc06d96[_0xfa8f('0x36')]=_[_0xfa8f('0x37')](_0x42133a[_0xfa8f('0x32')],qs[_0xfa8f('0x38')](_0x49dfd4[_0xfa8f('0x33')][_0xfa8f('0x38')]));_0xc06d96[_0xfa8f('0x36')]=_0xc06d96[_0xfa8f('0x36')][_0xfa8f('0x39')]?_0xc06d96[_0xfa8f('0x36')]:_0x42133a[_0xfa8f('0x32')];if(!_0x49dfd4[_0xfa8f('0x33')]['hasOwnProperty']('nolimit')){_0xc06d96[_0xfa8f('0x20')]=qs[_0xfa8f('0x20')](_0x49dfd4[_0xfa8f('0x33')]['limit']);_0xc06d96[_0xfa8f('0x1e')]=qs[_0xfa8f('0x1e')](_0x49dfd4['query']['offset']);}_0xc06d96['order']=qs[_0xfa8f('0x3a')](_0x49dfd4[_0xfa8f('0x33')]['sort']);_0xc06d96[_0xfa8f('0x3b')]=qs['filters'](_[_0xfa8f('0x3c')](_0x49dfd4[_0xfa8f('0x33')],_0x42133a['filters']),_0x572fff);if(_0x49dfd4['query'][_0xfa8f('0x3d')]){_0xc06d96[_0xfa8f('0x3b')]=_[_0xfa8f('0x3e')](_0xc06d96[_0xfa8f('0x3b')],{'$or':_[_0xfa8f('0x2e')](_0x572fff,function(_0x27aaf1){if(_0x27aaf1[_0xfa8f('0x3f')]!==_0xfa8f('0x40')){var _0x361c54={};_0x361c54[_0x27aaf1[_0xfa8f('0x2b')]]={'$like':'%'+_0x49dfd4[_0xfa8f('0x33')][_0xfa8f('0x3d')]+'%'};return _0x361c54;}})});}_0xc06d96=_['merge']({},_0xc06d96,_0x49dfd4[_0xfa8f('0x41')]);var _0x2a190d={'where':_0xc06d96[_0xfa8f('0x3b')]};return db[_0xfa8f('0x42')][_0xfa8f('0x21')](_0x2a190d)['then'](function(_0x8b879b){_0x362b35[_0xfa8f('0x21')]=_0x8b879b;if(_0x49dfd4['query']['includeAll']){_0xc06d96[_0xfa8f('0x43')]=[{'all':!![]}];}return db[_0xfa8f('0x42')][_0xfa8f('0x44')](_0xc06d96);})[_0xfa8f('0x27')](function(_0x5e7b0f){_0x362b35['rows']=_0x5e7b0f;return _0x362b35;})[_0xfa8f('0x27')](respondWithFilteredResult(_0x3fd2a0,_0xc06d96))[_0xfa8f('0x45')](handleError(_0x3fd2a0,null));};exports[_0xfa8f('0x46')]=function(_0x15b2fc,_0x10f710){var _0x18874c={'raw':!![],'where':{'id':_0x15b2fc[_0xfa8f('0x47')]['id']}},_0x29ec8e={};_0x29ec8e[_0xfa8f('0x32')]=_[_0xfa8f('0x34')](db[_0xfa8f('0x42')][_0xfa8f('0x2f')]);_0x29ec8e[_0xfa8f('0x33')]=_[_0xfa8f('0x34')](_0x15b2fc['query']);_0x29ec8e[_0xfa8f('0x35')]=_[_0xfa8f('0x37')](_0x29ec8e['model'],_0x29ec8e[_0xfa8f('0x33')]);_0x18874c['attributes']=_['intersection'](_0x29ec8e[_0xfa8f('0x32')],qs['fields'](_0x15b2fc['query'][_0xfa8f('0x38')]));_0x18874c[_0xfa8f('0x36')]=_0x18874c[_0xfa8f('0x36')][_0xfa8f('0x39')]?_0x18874c[_0xfa8f('0x36')]:_0x29ec8e[_0xfa8f('0x32')];if(_0x15b2fc[_0xfa8f('0x33')]['includeAll']){_0x18874c[_0xfa8f('0x43')]=[{'all':!![]}];}_0x18874c=_[_0xfa8f('0x3e')]({},_0x18874c,_0x15b2fc[_0xfa8f('0x41')]);return db[_0xfa8f('0x42')]['find'](_0x18874c)[_0xfa8f('0x27')](handleEntityNotFound(_0x10f710,null))[_0xfa8f('0x27')](respondWithResult(_0x10f710,null))['catch'](handleError(_0x10f710,null));};exports[_0xfa8f('0x48')]=function(_0x5ed1e7,_0x5cced6){return db[_0xfa8f('0x42')][_0xfa8f('0x48')](_0x5ed1e7[_0xfa8f('0x49')],{})[_0xfa8f('0x27')](respondWithResult(_0x5cced6,0xc9))['catch'](handleError(_0x5cced6,null));};exports[_0xfa8f('0x26')]=function(_0x49148f,_0x1915e7){if(_0x49148f[_0xfa8f('0x49')]['id']){delete _0x49148f[_0xfa8f('0x49')]['id'];}return db[_0xfa8f('0x42')][_0xfa8f('0x4a')]({'where':{'id':_0x49148f[_0xfa8f('0x47')]['id']}})[_0xfa8f('0x27')](handleEntityNotFound(_0x1915e7,null))[_0xfa8f('0x27')](saveUpdates(_0x49148f[_0xfa8f('0x49')],null))[_0xfa8f('0x27')](respondWithResult(_0x1915e7,null))[_0xfa8f('0x45')](handleError(_0x1915e7,null));};exports[_0xfa8f('0x28')]=function(_0x31b874,_0x1baebd){return db[_0xfa8f('0x42')]['find']({'where':{'id':_0x31b874[_0xfa8f('0x47')]['id']}})[_0xfa8f('0x27')](handleEntityNotFound(_0x1baebd,null))[_0xfa8f('0x27')](removeEntity(_0x1baebd,null))[_0xfa8f('0x45')](handleError(_0x1baebd,null));}; \ No newline at end of file +var _0x5085=['model','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','length','create','body','find','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','ZohoField','rawAttributes','type','key','query','keys','filters','intersection','attributes'];(function(_0x3f5f08,_0x1ccd7f){var _0x566dd9=function(_0x952e6a){while(--_0x952e6a){_0x3f5f08['push'](_0x3f5f08['shift']());}};_0x566dd9(++_0x1ccd7f);}(_0x5085,0xe3));var _0x5508=function(_0x5482de,_0x162cad){_0x5482de=_0x5482de-0x0;var _0x191afb=_0x5085[_0x5482de];return _0x191afb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5508('0x0'));var zipdir=require(_0x5508('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5508('0x2'));var moment=require(_0x5508('0x3'));var BPromise=require(_0x5508('0x4'));var Mustache=require(_0x5508('0x5'));var util=require(_0x5508('0x6'));var path=require('path');var sox=require(_0x5508('0x7'));var csv=require('to-csv');var ejs=require(_0x5508('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5508('0x9'));var squel=require('squel');var crypto=require(_0x5508('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5508('0xb'));var toCsv=require(_0x5508('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5508('0xd'));var authService=require(_0x5508('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5508('0xf'));var hardwareService=require(_0x5508('0x10'));var logger=require(_0x5508('0x11'))(_0x5508('0x12'));var utils=require('../../config/utils');var config=require(_0x5508('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x124c55,_0x155521){_0x155521=_0x155521||0xcc;return function(_0x42f16d){if(_0x42f16d){return _0x124c55['sendStatus'](_0x155521);}return _0x124c55['status'](_0x155521)['end']();};}function respondWithResult(_0x3e4d0d,_0x4410ac){_0x4410ac=_0x4410ac||0xc8;return function(_0x1a92ac){if(_0x1a92ac){return _0x3e4d0d[_0x5508('0x14')](_0x4410ac)[_0x5508('0x15')](_0x1a92ac);}};}function respondWithFilteredResult(_0x28c7b5,_0x43b5b3){return function(_0x4ef95a){if(_0x4ef95a){var _0x428291=typeof _0x43b5b3[_0x5508('0x16')]===_0x5508('0x17')&&typeof _0x43b5b3[_0x5508('0x18')]===_0x5508('0x17');var _0x734f29=_0x4ef95a['count'];var _0xd80f9b=_0x428291?0x0:_0x43b5b3[_0x5508('0x16')];var _0x2558a7=_0x428291?_0x4ef95a[_0x5508('0x19')]:_0x43b5b3[_0x5508('0x16')]+_0x43b5b3[_0x5508('0x18')];var _0x181228;if(_0x2558a7>=_0x734f29){_0x2558a7=_0x734f29;_0x181228=0xc8;}else{_0x181228=0xce;}_0x28c7b5[_0x5508('0x14')](_0x181228);return _0x28c7b5[_0x5508('0x1a')](_0x5508('0x1b'),_0xd80f9b+'-'+_0x2558a7+'/'+_0x734f29)[_0x5508('0x15')](_0x4ef95a);}return null;};}function patchUpdates(_0x18333b){return function(_0x5dc78d){try{jsonpatch[_0x5508('0x1c')](_0x5dc78d,_0x18333b,!![]);}catch(_0x25d22e){return BPromise[_0x5508('0x1d')](_0x25d22e);}return _0x5dc78d['save']();};}function saveUpdates(_0x2f7811,_0x3f693f){return function(_0xe77339){if(_0xe77339){return _0xe77339[_0x5508('0x1e')](_0x2f7811)[_0x5508('0x1f')](function(_0x164ca2){return _0x164ca2;});}return null;};}function removeEntity(_0x4f1eb4,_0x54724b){return function(_0x220874){if(_0x220874){return _0x220874[_0x5508('0x20')]()[_0x5508('0x1f')](function(){_0x4f1eb4[_0x5508('0x14')](0xcc)[_0x5508('0x21')]();});}};}function handleEntityNotFound(_0x7696af,_0x265a47){return function(_0x437c69){if(!_0x437c69){_0x7696af[_0x5508('0x22')](0x194);}return _0x437c69;};}function handleError(_0x9d13ad,_0x1f553e){_0x1f553e=_0x1f553e||0x1f4;return function(_0x45f9a1){logger[_0x5508('0x23')](_0x45f9a1['stack']);if(_0x45f9a1[_0x5508('0x24')]){delete _0x45f9a1['name'];}_0x9d13ad[_0x5508('0x14')](_0x1f553e)[_0x5508('0x25')](_0x45f9a1);};}exports[_0x5508('0x26')]=function(_0xa0d1a6,_0x5019e6){var _0x10cccd={},_0x289e3c={},_0x47e878={'count':0x0,'rows':[]};var _0x2bef93=_[_0x5508('0x27')](db[_0x5508('0x28')][_0x5508('0x29')],function(_0x25fd9f){return{'name':_0x25fd9f['fieldName'],'type':_0x25fd9f[_0x5508('0x2a')][_0x5508('0x2b')]};});_0x289e3c['model']=_[_0x5508('0x27')](_0x2bef93,_0x5508('0x24'));_0x289e3c[_0x5508('0x2c')]=_[_0x5508('0x2d')](_0xa0d1a6[_0x5508('0x2c')]);_0x289e3c[_0x5508('0x2e')]=_[_0x5508('0x2f')](_0x289e3c['model'],_0x289e3c[_0x5508('0x2c')]);_0x10cccd[_0x5508('0x30')]=_[_0x5508('0x2f')](_0x289e3c[_0x5508('0x31')],qs[_0x5508('0x32')](_0xa0d1a6[_0x5508('0x2c')]['fields']));_0x10cccd['attributes']=_0x10cccd[_0x5508('0x30')]['length']?_0x10cccd[_0x5508('0x30')]:_0x289e3c[_0x5508('0x31')];if(!_0xa0d1a6['query'][_0x5508('0x33')]('nolimit')){_0x10cccd[_0x5508('0x18')]=qs[_0x5508('0x18')](_0xa0d1a6[_0x5508('0x2c')][_0x5508('0x18')]);_0x10cccd[_0x5508('0x16')]=qs['offset'](_0xa0d1a6['query']['offset']);}_0x10cccd[_0x5508('0x34')]=qs[_0x5508('0x35')](_0xa0d1a6[_0x5508('0x2c')]['sort']);_0x10cccd[_0x5508('0x36')]=qs[_0x5508('0x2e')](_[_0x5508('0x37')](_0xa0d1a6[_0x5508('0x2c')],_0x289e3c['filters']),_0x2bef93);if(_0xa0d1a6['query'][_0x5508('0x38')]){_0x10cccd['where']=_['merge'](_0x10cccd[_0x5508('0x36')],{'$or':_['map'](_0x2bef93,function(_0x29dabc){if(_0x29dabc[_0x5508('0x2a')]!==_0x5508('0x39')){var _0x59d0aa={};_0x59d0aa[_0x29dabc[_0x5508('0x24')]]={'$like':'%'+_0xa0d1a6['query']['filter']+'%'};return _0x59d0aa;}})});}_0x10cccd=_[_0x5508('0x3a')]({},_0x10cccd,_0xa0d1a6[_0x5508('0x3b')]);var _0x125634={'where':_0x10cccd[_0x5508('0x36')]};return db[_0x5508('0x28')][_0x5508('0x19')](_0x125634)['then'](function(_0x517d47){_0x47e878[_0x5508('0x19')]=_0x517d47;if(_0xa0d1a6['query'][_0x5508('0x3c')]){_0x10cccd[_0x5508('0x3d')]=[{'all':!![]}];}return db[_0x5508('0x28')][_0x5508('0x3e')](_0x10cccd);})[_0x5508('0x1f')](function(_0x4beaa5){_0x47e878['rows']=_0x4beaa5;return _0x47e878;})[_0x5508('0x1f')](respondWithFilteredResult(_0x5019e6,_0x10cccd))[_0x5508('0x3f')](handleError(_0x5019e6,null));};exports['show']=function(_0xd26991,_0x15160f){var _0x3e233b={'raw':!![],'where':{'id':_0xd26991['params']['id']}},_0x4ecd92={};_0x4ecd92[_0x5508('0x31')]=_[_0x5508('0x2d')](db[_0x5508('0x28')][_0x5508('0x29')]);_0x4ecd92[_0x5508('0x2c')]=_[_0x5508('0x2d')](_0xd26991['query']);_0x4ecd92['filters']=_['intersection'](_0x4ecd92[_0x5508('0x31')],_0x4ecd92[_0x5508('0x2c')]);_0x3e233b[_0x5508('0x30')]=_[_0x5508('0x2f')](_0x4ecd92[_0x5508('0x31')],qs[_0x5508('0x32')](_0xd26991[_0x5508('0x2c')][_0x5508('0x32')]));_0x3e233b['attributes']=_0x3e233b[_0x5508('0x30')][_0x5508('0x40')]?_0x3e233b['attributes']:_0x4ecd92['model'];if(_0xd26991[_0x5508('0x2c')]['includeAll']){_0x3e233b[_0x5508('0x3d')]=[{'all':!![]}];}_0x3e233b=_['merge']({},_0x3e233b,_0xd26991['options']);return db[_0x5508('0x28')]['find'](_0x3e233b)[_0x5508('0x1f')](handleEntityNotFound(_0x15160f,null))[_0x5508('0x1f')](respondWithResult(_0x15160f,null))['catch'](handleError(_0x15160f,null));};exports[_0x5508('0x41')]=function(_0x111a96,_0x5064cc){return db[_0x5508('0x28')][_0x5508('0x41')](_0x111a96[_0x5508('0x42')],{})['then'](respondWithResult(_0x5064cc,0xc9))[_0x5508('0x3f')](handleError(_0x5064cc,null));};exports[_0x5508('0x1e')]=function(_0x45b1b1,_0x2aac3f){if(_0x45b1b1[_0x5508('0x42')]['id']){delete _0x45b1b1[_0x5508('0x42')]['id'];}return db[_0x5508('0x28')][_0x5508('0x43')]({'where':{'id':_0x45b1b1[_0x5508('0x44')]['id']}})[_0x5508('0x1f')](handleEntityNotFound(_0x2aac3f,null))[_0x5508('0x1f')](saveUpdates(_0x45b1b1[_0x5508('0x42')],null))['then'](respondWithResult(_0x2aac3f,null))[_0x5508('0x3f')](handleError(_0x2aac3f,null));};exports[_0x5508('0x20')]=function(_0x242219,_0x4fab07){return db[_0x5508('0x28')][_0x5508('0x43')]({'where':{'id':_0x242219[_0x5508('0x44')]['id']}})[_0x5508('0x1f')](handleEntityNotFound(_0x4fab07,null))[_0x5508('0x1f')](removeEntity(_0x4fab07,null))[_0x5508('0x3f')](handleError(_0x4fab07,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 1d68561..93919f7 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 _0xed1c=['lodash','util','request-promise','path','rimraf','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId'];(function(_0x4cb272,_0x52c0e9){var _0x57b4aa=function(_0x1efefb){while(--_0x1efefb){_0x4cb272['push'](_0x4cb272['shift']());}};_0x57b4aa(++_0x52c0e9);}(_0xed1c,0xe4));var _0xced1=function(_0x1c4cc0,_0x310626){_0x1c4cc0=_0x1c4cc0-0x0;var _0x22e823=_0xed1c[_0x1c4cc0];return _0x22e823;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xced1('0x2'));var fs=require('fs');var path=require(_0xced1('0x3'));var rimraf=require(_0xced1('0x4'));var config=require('../../config/environment');var attributes=require(_0xced1('0x5'));module[_0xced1('0x6')]=function(_0x466657,_0x37b22b){return _0x466657['define'](_0xced1('0x7'),attributes,{'tableName':_0xced1('0x8'),'paranoid':![],'indexes':[{'name':_0xced1('0x9'),'fields':[_0xced1('0xa'),_0xced1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x25e7=['ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1f80ab,_0x705f36){var _0x151838=function(_0x2e9087){while(--_0x2e9087){_0x1f80ab['push'](_0x1f80ab['shift']());}};_0x151838(++_0x705f36);}(_0x25e7,0x1d6));var _0x725e=function(_0x295583,_0x4756aa){_0x295583=_0x295583-0x0;var _0x4c2ae6=_0x25e7[_0x295583];return _0x4c2ae6;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var logger=require(_0x725e('0x2'))(_0x725e('0x3'));var moment=require(_0x725e('0x4'));var BPromise=require(_0x725e('0x5'));var rp=require(_0x725e('0x6'));var fs=require('fs');var path=require(_0x725e('0x7'));var rimraf=require(_0x725e('0x8'));var config=require(_0x725e('0x9'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0x2497a5,_0x480945){return _0x2497a5['define'](_0x725e('0xa'),attributes,{'tableName':_0x725e('0xb'),'paranoid':![],'indexes':[{'name':_0x725e('0xc'),'fields':[_0x725e('0xd'),_0x725e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 5534e6b..6976b2a 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 _0x3f0c=['ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent'];(function(_0x1234a3,_0x262abe){var _0x34ae2a=function(_0x52f5fc){while(--_0x52f5fc){_0x1234a3['push'](_0x1234a3['shift']());}};_0x34ae2a(++_0x262abe);}(_0x3f0c,0x17b));var _0xc3f0=function(_0x292893,_0xda9f1a){_0x292893=_0x292893-0x0;var _0x434903=_0x3f0c[_0x292893];return _0x434903;};'use strict';var _=require('lodash');var util=require(_0xc3f0('0x0'));var moment=require(_0xc3f0('0x1'));var BPromise=require('bluebird');var rs=require(_0xc3f0('0x2'));var fs=require('fs');var Redis=require(_0xc3f0('0x3'));var db=require(_0xc3f0('0x4'))['db'];var utils=require(_0xc3f0('0x5'));var logger=require(_0xc3f0('0x6'))(_0xc3f0('0x7'));var config=require(_0xc3f0('0x8'));var jayson=require(_0xc3f0('0x9'));var client=jayson[_0xc3f0('0xa')][_0xc3f0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17021f,_0x5c238f,_0x13c31e){return new BPromise(function(_0x360424,_0x2f4565){return client[_0xc3f0('0xc')](_0x17021f,_0x13c31e)[_0xc3f0('0xd')](function(_0x58064c){logger[_0xc3f0('0xe')](_0xc3f0('0xf'),_0x5c238f,_0xc3f0('0x10'));logger['debug'](_0xc3f0('0x11'),_0x5c238f,_0xc3f0('0x10'),JSON['stringify'](_0x58064c));if(_0x58064c[_0xc3f0('0x12')]){if(_0x58064c[_0xc3f0('0x12')][_0xc3f0('0x13')]===0x1f4){logger[_0xc3f0('0x12')]('ZohoField,\x20%s,\x20%s',_0x5c238f,_0x58064c[_0xc3f0('0x12')][_0xc3f0('0x14')]);return _0x2f4565(_0x58064c[_0xc3f0('0x12')][_0xc3f0('0x14')]);}logger[_0xc3f0('0x12')](_0xc3f0('0xf'),_0x5c238f,_0x58064c[_0xc3f0('0x12')][_0xc3f0('0x14')]);return _0x360424(_0x58064c[_0xc3f0('0x12')][_0xc3f0('0x14')]);}else{logger[_0xc3f0('0xe')](_0xc3f0('0xf'),_0x5c238f,_0xc3f0('0x10'));_0x360424(_0x58064c['result'][_0xc3f0('0x14')]);}})[_0xc3f0('0x15')](function(_0x56dc56){logger[_0xc3f0('0x12')](_0xc3f0('0xf'),_0x5c238f,_0x56dc56);_0x2f4565(_0x56dc56);});});} \ No newline at end of file +var _0xe816=['ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1027c7,_0xa0cb0b){var _0x51dfb7=function(_0x44d62c){while(--_0x44d62c){_0x1027c7['push'](_0x1027c7['shift']());}};_0x51dfb7(++_0xa0cb0b);}(_0xe816,0x18d));var _0x6e81=function(_0x24a1bf,_0x23b50b){_0x24a1bf=_0x24a1bf-0x0;var _0x38f92d=_0xe816[_0x24a1bf];return _0x38f92d;};'use strict';var _=require('lodash');var util=require(_0x6e81('0x0'));var moment=require('moment');var BPromise=require(_0x6e81('0x1'));var rs=require(_0x6e81('0x2'));var fs=require('fs');var Redis=require(_0x6e81('0x3'));var db=require(_0x6e81('0x4'))['db'];var utils=require(_0x6e81('0x5'));var logger=require(_0x6e81('0x6'))(_0x6e81('0x7'));var config=require(_0x6e81('0x8'));var jayson=require(_0x6e81('0x9'));var client=jayson[_0x6e81('0xa')][_0x6e81('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c782b,_0x4265ec,_0x2eafac){return new BPromise(function(_0x3a3182,_0x274c23){return client['request'](_0x3c782b,_0x2eafac)[_0x6e81('0xc')](function(_0x80f390){logger[_0x6e81('0xd')](_0x6e81('0xe'),_0x4265ec,_0x6e81('0xf'));logger[_0x6e81('0x10')](_0x6e81('0x11'),_0x4265ec,_0x6e81('0xf'),JSON[_0x6e81('0x12')](_0x80f390));if(_0x80f390[_0x6e81('0x13')]){if(_0x80f390[_0x6e81('0x13')]['code']===0x1f4){logger[_0x6e81('0x13')](_0x6e81('0xe'),_0x4265ec,_0x80f390[_0x6e81('0x13')][_0x6e81('0x14')]);return _0x274c23(_0x80f390[_0x6e81('0x13')]['message']);}logger[_0x6e81('0x13')](_0x6e81('0xe'),_0x4265ec,_0x80f390['error'][_0x6e81('0x14')]);return _0x3a3182(_0x80f390[_0x6e81('0x13')]['message']);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x4265ec,_0x6e81('0xf'));_0x3a3182(_0x80f390[_0x6e81('0x15')][_0x6e81('0x14')]);}})[_0x6e81('0x16')](function(_0x587384){logger['error'](_0x6e81('0xe'),_0x4265ec,_0x587384);_0x274c23(_0x587384);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 34e7f25..71cc5b2 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(_0x2906d7,_0xbe0fa0){var _0x5c846b=function(_0x57eca2){while(--_0x57eca2){_0x2906d7['push'](_0x2906d7['shift']());}};_0x5c846b(++_0xbe0fa0);}(_0xe706,0xa3));var _0x6e70=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xe706[_0x550d12];return _0x12103d;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1e3cb8,_0x271000){var _0x426fc4=function(_0x4b1d0e){while(--_0x4b1d0e){_0x1e3cb8['push'](_0x1e3cb8['shift']());}};_0x426fc4(++_0x271000);}(_0xe706,0xa3));var _0x6e70=function(_0x3d86f5,_0x257914){_0x3d86f5=_0x3d86f5-0x0;var _0x2d6881=_0xe706[_0x3d86f5];return _0x2d6881;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 886c555..488b184 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 _0xa311=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x485f35,_0x45a0fc){var _0x2ad118=function(_0x296650){while(--_0x296650){_0x485f35['push'](_0x485f35['shift']());}};_0x2ad118(++_0x45a0fc);}(_0xa311,0x118));var _0x1a31=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xa311[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0x1a31('0x0'));module[_0x1a31('0x1')]={'name':{'type':Sequelize[_0x1a31('0x2')],'allowNull':![],'unique':_0x1a31('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1a31('0x3')},'main':{'type':Sequelize[_0x1a31('0x2')],'defaultValue':_0x1a31('0x4')},'filename':{'type':Sequelize[_0x1a31('0x2')]},'path':{'type':Sequelize[_0x1a31('0x2')]},'type':{'type':Sequelize[_0x1a31('0x2')]},'size':{'type':Sequelize[_0x1a31('0x5')]},'active':{'type':Sequelize[_0x1a31('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x1a31('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0x1a31('0x2')]},'title':{'type':Sequelize[_0x1a31('0x2')]},'remoteUri':{'type':Sequelize[_0x1a31('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x2e5f=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x562362,_0x5d54f4){var _0x3a18ce=function(_0x4b96ed){while(--_0x4b96ed){_0x562362['push'](_0x562362['shift']());}};_0x3a18ce(++_0x5d54f4);}(_0x2e5f,0xd1));var _0xf2e5=function(_0x3d35ea,_0x3878e0){_0x3d35ea=_0x3d35ea-0x0;var _0x478a03=_0x2e5f[_0x3d35ea];return _0x478a03;};'use strict';var Sequelize=require(_0xf2e5('0x0'));module[_0xf2e5('0x1')]={'name':{'type':Sequelize[_0xf2e5('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xf2e5('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xf2e5('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xf2e5('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf2e5('0x2')]},'size':{'type':Sequelize[_0xf2e5('0x3')]},'active':{'type':Sequelize[_0xf2e5('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xf2e5('0x2')]},'logo':{'type':Sequelize[_0xf2e5('0x2')]},'state':{'type':Sequelize[_0xf2e5('0x2')],'unique':'state'},'description':{'type':Sequelize[_0xf2e5('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf2e5('0x2')]},'link':{'type':Sequelize[_0xf2e5('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 6f76738..18940f2 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 _0x66fa=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','Integration','findAll','rows','catch','merge','options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x66fa,0x117));var _0xa66f=function(_0x499e90,_0x16e9af){_0x499e90=_0x499e90-0x0;var _0x16c9ea=_0x66fa[_0x499e90];return _0x16c9ea;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['Integration'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['Integration'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['Integration'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['Integration'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));}; \ No newline at end of file +var _0x47c5=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','Integration'];(function(_0x44349f,_0xdb439e){var _0x5b8d06=function(_0x483536){while(--_0x483536){_0x44349f['push'](_0x44349f['shift']());}};_0x5b8d06(++_0xdb439e);}(_0x47c5,0x165));var _0x547c=function(_0x241fd8,_0x568e21){_0x241fd8=_0x241fd8-0x0;var _0x3c260e=_0x47c5[_0x241fd8];return _0x3c260e;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['Integration'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['Integration']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['Integration'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['Integration'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index c722684..77d6e15 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 _0x8c4e=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','integrations','lodash','../../config/logger','api'];(function(_0x28b5be,_0x566849){var _0x5b46d5=function(_0x29099c){while(--_0x29099c){_0x28b5be['push'](_0x28b5be['shift']());}};_0x5b46d5(++_0x566849);}(_0x8c4e,0x168));var _0xe8c4=function(_0x2d13af,_0x33bd37){_0x2d13af=_0x2d13af-0x0;var _0x4753e1=_0x8c4e[_0x2d13af];return _0x4753e1;};'use strict';var _=require(_0xe8c4('0x0'));var util=require('util');var logger=require(_0xe8c4('0x1'))(_0xe8c4('0x2'));var moment=require('moment');var BPromise=require(_0xe8c4('0x3'));var rp=require(_0xe8c4('0x4'));var fs=require('fs');var path=require(_0xe8c4('0x5'));var rimraf=require(_0xe8c4('0x6'));var config=require(_0xe8c4('0x7'));var attributes=require('./integration.attributes');module[_0xe8c4('0x8')]=function(_0x216f5b,_0x59a6fc){return _0x216f5b[_0xe8c4('0x9')]('Integration',attributes,{'tableName':_0xe8c4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4811=['api','moment','rimraf','../../config/environment','./integration.attributes','define','integrations','lodash','../../config/logger'];(function(_0x3aa7de,_0x5d43b3){var _0x38e71e=function(_0xc1048c){while(--_0xc1048c){_0x3aa7de['push'](_0x3aa7de['shift']());}};_0x38e71e(++_0x5d43b3);}(_0x4811,0x154));var _0x1481=function(_0x12c076,_0x5bef17){_0x12c076=_0x12c076-0x0;var _0x2ddd18=_0x4811[_0x12c076];return _0x2ddd18;};'use strict';var _=require(_0x1481('0x0'));var util=require('util');var logger=require(_0x1481('0x1'))(_0x1481('0x2'));var moment=require(_0x1481('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1481('0x4'));var config=require(_0x1481('0x5'));var attributes=require(_0x1481('0x6'));module['exports']=function(_0x31bfce,_0x11b1e2){return _0x31bfce[_0x1481('0x7')]('Integration',attributes,{'tableName':_0x1481('0x8'),'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 2c783e2..2629c16 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 _0xc6ac=['http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5ee027,_0x530fb4){var _0x246ed4=function(_0x2be2fa){while(--_0x2be2fa){_0x5ee027['push'](_0x5ee027['shift']());}};_0x246ed4(++_0x530fb4);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x15e391,_0x12af10){_0x15e391=_0x15e391-0x0;var _0xc0444a=_0xc6ac[_0x15e391];return _0xc0444a;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file +var _0xdd4f=['lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x40358c,_0x2c4bd2){var _0x30f799=function(_0x164234){while(--_0x164234){_0x40358c['push'](_0x40358c['shift']());}};_0x30f799(++_0x2c4bd2);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x1459b2,_0x113eab){_0x1459b2=_0x1459b2-0x0;var _0x3d409f=_0xdd4f[_0x1459b2];return _0x3d409f;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdd4('0x1'));var fs=require('fs');var Redis=require(_0xfdd4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdd4('0x3'));var logger=require(_0xfdd4('0x4'))(_0xfdd4('0x5'));var config=require('../../config/environment');var jayson=require(_0xfdd4('0x6'));var client=jayson[_0xfdd4('0x7')][_0xfdd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x307ac6,_0x3c72d4,_0x51acd6){return new BPromise(function(_0x3cd8e6,_0x563ae6){return client[_0xfdd4('0x9')](_0x307ac6,_0x51acd6)[_0xfdd4('0xa')](function(_0x1e823e){logger['info'](_0xfdd4('0xb'),_0x3c72d4,'request\x20sent');logger[_0xfdd4('0xc')](_0xfdd4('0xd'),_0x3c72d4,_0xfdd4('0xe'),JSON[_0xfdd4('0xf')](_0x1e823e));if(_0x1e823e[_0xfdd4('0x10')]){if(_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x11')]===0x1f4){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x12')]);return _0x563ae6(_0x1e823e['error'][_0xfdd4('0x12')]);}logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e['error'][_0xfdd4('0x12')]);return _0x3cd8e6(_0x1e823e['error'][_0xfdd4('0x12')]);}else{logger[_0xfdd4('0x13')](_0xfdd4('0xb'),_0x3c72d4,_0xfdd4('0xe'));_0x3cd8e6(_0x1e823e[_0xfdd4('0x14')]['message']);}})['catch'](function(_0x559c77){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x559c77);_0x563ae6(_0x559c77);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 255184e..31fdc15 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xdb28,0x106));var _0x8db2=function(_0x859a3f,_0x2e965c){_0x859a3f=_0x859a3f-0x0;var _0xc810d0=_0xdb28[_0x859a3f];return _0xc810d0;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./integrationReport.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post']('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x11')]);router['delete'](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file +var _0x1967=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x1283d4,_0x36b6f1){var _0x433643=function(_0x4c9fbe){while(--_0x4c9fbe){_0x1283d4['push'](_0x1283d4['shift']());}};_0x433643(++_0x36b6f1);}(_0x1967,0x173));var _0x7196=function(_0x30d081,_0x5e85be){_0x30d081=_0x30d081-0x0;var _0x390c71=_0x1967[_0x30d081];return _0x390c71;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var fs_extra=require(_0x7196('0x5'));var auth=require(_0x7196('0x6'));var interaction=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var controller=require(_0x7196('0x9'));router['get']('/',auth[_0x7196('0xa')](),controller[_0x7196('0xb')]);router[_0x7196('0xc')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0xe')]);router['get'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x10')]);router[_0x7196('0x11')]('/',auth[_0x7196('0xa')](),controller['create']);router['put'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x12')]);router[_0x7196('0x13')](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x14')]);module[_0x7196('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index dbd364e..a6a63ab 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 _0x0cfa=['BOOLEAN','TEXT','SENT','RECEIVED','FAILED','STRING','INTEGER','DATE'];(function(_0x91d225,_0x308a3e){var _0x2da6bc=function(_0x12192a){while(--_0x12192a){_0x91d225['push'](_0x91d225['shift']());}};_0x2da6bc(++_0x308a3e);}(_0x0cfa,0x1ad));var _0xa0cf=function(_0xc5a41c,_0x2e4247){_0xc5a41c=_0xc5a41c-0x0;var _0x53569e=_0x0cfa[_0xc5a41c];return _0x53569e;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0xa0cf('0x0')]},'eventChannel':{'type':Sequelize[_0xa0cf('0x0')]},'exitStatus':{'type':Sequelize[_0xa0cf('0x0')]},'ticketId':{'type':Sequelize[_0xa0cf('0x0')]},'integrationId':{'type':Sequelize[_0xa0cf('0x1')]},'contacts':{'type':Sequelize[_0xa0cf('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa0cf('0x0')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa0cf('0x0')]},'interface':{'type':Sequelize[_0xa0cf('0x0')]},'membername':{'type':Sequelize[_0xa0cf('0x0')]},'agentcalledAt':{'type':Sequelize[_0xa0cf('0x2')]},'agentconnectAt':{'type':Sequelize[_0xa0cf('0x2')]},'holdtime':{'type':Sequelize[_0xa0cf('0x1')]},'agentcomplete':{'type':Sequelize[_0xa0cf('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa0cf('0x2')]},'talktime':{'type':Sequelize[_0xa0cf('0x1')]},'agentacw':{'type':Sequelize[_0xa0cf('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa0cf('0x1')]},'reason':{'type':Sequelize[_0xa0cf('0x0')]},'agentringnoanswer':{'type':Sequelize[_0xa0cf('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xa0cf('0x2')]},'agentdump':{'type':Sequelize[_0xa0cf('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xa0cf('0x0')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xa0cf('0x1')]},'channelstatedesc':{'type':Sequelize[_0xa0cf('0x0')]},'connectedlinenum':{'type':Sequelize[_0xa0cf('0x0')]},'connectedlinename':{'type':Sequelize[_0xa0cf('0x0')]},'language':{'type':Sequelize[_0xa0cf('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa0cf('0x0')]},'exten':{'type':Sequelize[_0xa0cf('0x0')]},'priority':{'type':Sequelize[_0xa0cf('0x0')]},'destchannel':{'type':Sequelize[_0xa0cf('0x0')]},'destchannelstate':{'type':Sequelize[_0xa0cf('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0xa0cf('0x0')]},'destcalleridnum':{'type':Sequelize[_0xa0cf('0x0')]},'destcalleridname':{'type':Sequelize[_0xa0cf('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0xa0cf('0x0')]},'destconnectedlinename':{'type':Sequelize[_0xa0cf('0x0')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xa0cf('0x0')]},'destcontext':{'type':Sequelize[_0xa0cf('0x0')]},'destexten':{'type':Sequelize[_0xa0cf('0x0')]},'destpriority':{'type':Sequelize[_0xa0cf('0x0')]},'destuniqueid':{'type':Sequelize[_0xa0cf('0x0')]},'messageId':{'type':Sequelize[_0xa0cf('0x0')]},'inReplyTo':{'type':Sequelize[_0xa0cf('0x0')]},'subject':{'type':Sequelize[_0xa0cf('0x0')]},'from':{'type':Sequelize[_0xa0cf('0x0')]},'to':{'type':Sequelize[_0xa0cf('0x0')]},'cc':{'type':Sequelize[_0xa0cf('0x0')]},'attachment':{'type':Sequelize[_0xa0cf('0x4')]},'html':{'type':Sequelize[_0xa0cf('0x4')]},'text':{'type':Sequelize[_0xa0cf('0x4')]},'status':{'type':Sequelize['ENUM'](_0xa0cf('0x5'),'SENDING',_0xa0cf('0x6'),_0xa0cf('0x7'))},'url':{'type':Sequelize[_0xa0cf('0x0')]},'app':{'type':Sequelize[_0xa0cf('0x0')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xa0cf('0x1')]}}; \ No newline at end of file +var _0x4dff=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','RECEIVED','FAILED'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0x4dff,0x75));var _0xf4df=function(_0x1206f9,_0x5c26e8){_0x1206f9=_0x1206f9-0x0;var _0x19adcf=_0x4dff[_0x1206f9];return _0x19adcf;};'use strict';var Sequelize=require('sequelize');module[_0xf4df('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xf4df('0x1')]},'integrationId':{'type':Sequelize[_0xf4df('0x2')]},'contacts':{'type':Sequelize[_0xf4df('0x1')]},'uniqueid':{'type':Sequelize[_0xf4df('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf4df('0x1')]},'queue':{'type':Sequelize[_0xf4df('0x1')]},'interface':{'type':Sequelize[_0xf4df('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xf4df('0x3')]},'agentconnectAt':{'type':Sequelize[_0xf4df('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xf4df('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf4df('0x3')]},'talktime':{'type':Sequelize[_0xf4df('0x2')]},'agentacw':{'type':Sequelize[_0xf4df('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf4df('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xf4df('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xf4df('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf4df('0x3')]},'lastevent':{'type':Sequelize[_0xf4df('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf4df('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xf4df('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf4df('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf4df('0x1')]},'exten':{'type':Sequelize[_0xf4df('0x1')]},'priority':{'type':Sequelize[_0xf4df('0x1')]},'destchannel':{'type':Sequelize[_0xf4df('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf4df('0x1')]},'destcalleridnum':{'type':Sequelize[_0xf4df('0x1')]},'destcalleridname':{'type':Sequelize[_0xf4df('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xf4df('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xf4df('0x1')]},'destaccountcode':{'type':Sequelize[_0xf4df('0x1')]},'destcontext':{'type':Sequelize[_0xf4df('0x1')]},'destexten':{'type':Sequelize[_0xf4df('0x1')]},'destpriority':{'type':Sequelize[_0xf4df('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xf4df('0x1')]},'inReplyTo':{'type':Sequelize[_0xf4df('0x1')]},'subject':{'type':Sequelize[_0xf4df('0x1')]},'from':{'type':Sequelize[_0xf4df('0x1')]},'to':{'type':Sequelize[_0xf4df('0x1')]},'cc':{'type':Sequelize[_0xf4df('0x1')]},'attachment':{'type':Sequelize[_0xf4df('0x5')]},'html':{'type':Sequelize[_0xf4df('0x5')]},'text':{'type':Sequelize[_0xf4df('0x5')]},'status':{'type':Sequelize['ENUM'](_0xf4df('0x6'),'SENDING',_0xf4df('0x7'),_0xf4df('0x8'))},'url':{'type':Sequelize[_0xf4df('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xf4df('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 671511b..2fc939a 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 _0x74b0=['sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','IntegrationReport','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x258399,_0x2e03ad){var _0x42e700=function(_0x567d23){while(--_0x567d23){_0x258399['push'](_0x258399['shift']());}};_0x42e700(++_0x2e03ad);}(_0x74b0,0x1bf));var _0x074b=function(_0x50d5ae,_0x22a349){_0x50d5ae=_0x50d5ae-0x0;var _0x1e8d74=_0x74b0[_0x50d5ae];return _0x1e8d74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x074b('0x0'));var zipdir=require(_0x074b('0x1'));var jsonpatch=require(_0x074b('0x2'));var rp=require(_0x074b('0x3'));var moment=require('moment');var BPromise=require(_0x074b('0x4'));var Mustache=require(_0x074b('0x5'));var util=require(_0x074b('0x6'));var path=require('path');var sox=require(_0x074b('0x7'));var csv=require('to-csv');var ejs=require(_0x074b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x074b('0x9'));var squel=require(_0x074b('0xa'));var crypto=require(_0x074b('0xb'));var jsforce=require(_0x074b('0xc'));var deskjs=require(_0x074b('0xd'));var toCsv=require(_0x074b('0xe'));var querystring=require(_0x074b('0xf'));var Papa=require(_0x074b('0x10'));var Redis=require(_0x074b('0x11'));var authService=require(_0x074b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x074b('0x13'));var hardwareService=require(_0x074b('0x14'));var logger=require(_0x074b('0x15'))(_0x074b('0x16'));var utils=require(_0x074b('0x17'));var config=require(_0x074b('0x18'));var licenseUtil=require(_0x074b('0x19'));var db=require(_0x074b('0x1a'))['db'];function respondWithStatusCode(_0x43846d,_0x35c469){_0x35c469=_0x35c469||0xcc;return function(_0x12d64f){if(_0x12d64f){return _0x43846d[_0x074b('0x1b')](_0x35c469);}return _0x43846d[_0x074b('0x1c')](_0x35c469)['end']();};}function respondWithResult(_0x59ab1b,_0x5d77fd){_0x5d77fd=_0x5d77fd||0xc8;return function(_0x5117c7){if(_0x5117c7){return _0x59ab1b['status'](_0x5d77fd)[_0x074b('0x1d')](_0x5117c7);}};}function respondWithFilteredResult(_0x4d21a6,_0xfb47c8){return function(_0x1e894b){if(_0x1e894b){var _0xface5f=typeof _0xfb47c8[_0x074b('0x1e')]==='undefined'&&typeof _0xfb47c8[_0x074b('0x1f')]===_0x074b('0x20');var _0x21d39f=_0x1e894b['count'];var _0x36b747=_0xface5f?0x0:_0xfb47c8[_0x074b('0x1e')];var _0xbe54bd=_0xface5f?_0x1e894b[_0x074b('0x21')]:_0xfb47c8[_0x074b('0x1e')]+_0xfb47c8['limit'];var _0xbbbbf0;if(_0xbe54bd>=_0x21d39f){_0xbe54bd=_0x21d39f;_0xbbbbf0=0xc8;}else{_0xbbbbf0=0xce;}_0x4d21a6[_0x074b('0x1c')](_0xbbbbf0);return _0x4d21a6['set'](_0x074b('0x22'),_0x36b747+'-'+_0xbe54bd+'/'+_0x21d39f)['json'](_0x1e894b);}return null;};}function patchUpdates(_0x25f50a){return function(_0x162e9e){try{jsonpatch[_0x074b('0x23')](_0x162e9e,_0x25f50a,!![]);}catch(_0x246954){return BPromise[_0x074b('0x24')](_0x246954);}return _0x162e9e[_0x074b('0x25')]();};}function saveUpdates(_0x504088,_0x23fd14){return function(_0x563be0){if(_0x563be0){return _0x563be0[_0x074b('0x26')](_0x504088)['then'](function(_0xb3e6a5){return _0xb3e6a5;});}return null;};}function removeEntity(_0x227270,_0x1942dc){return function(_0xf2a6c4){if(_0xf2a6c4){return _0xf2a6c4[_0x074b('0x27')]()[_0x074b('0x28')](function(){_0x227270[_0x074b('0x1c')](0xcc)[_0x074b('0x29')]();});}};}function handleEntityNotFound(_0x5a88a3,_0xbaea97){return function(_0x3cbaf3){if(!_0x3cbaf3){_0x5a88a3[_0x074b('0x1b')](0x194);}return _0x3cbaf3;};}function handleError(_0x1f21da,_0x257263){_0x257263=_0x257263||0x1f4;return function(_0x58bbf2){logger['error'](_0x58bbf2[_0x074b('0x2a')]);if(_0x58bbf2[_0x074b('0x2b')]){delete _0x58bbf2[_0x074b('0x2b')];}_0x1f21da[_0x074b('0x1c')](_0x257263)[_0x074b('0x2c')](_0x58bbf2);};}exports[_0x074b('0x2d')]=function(_0x2d31e4,_0x403114){var _0x1fe0f4={},_0x349918={},_0x390c36={'count':0x0,'rows':[]};var _0x552c04=_['map'](db['IntegrationReport'][_0x074b('0x2e')],function(_0x4c1225){return{'name':_0x4c1225['fieldName'],'type':_0x4c1225[_0x074b('0x2f')][_0x074b('0x30')]};});_0x349918[_0x074b('0x31')]=_[_0x074b('0x32')](_0x552c04,_0x074b('0x2b'));_0x349918[_0x074b('0x33')]=_[_0x074b('0x34')](_0x2d31e4[_0x074b('0x33')]);_0x349918['filters']=_[_0x074b('0x35')](_0x349918['model'],_0x349918[_0x074b('0x33')]);_0x1fe0f4['attributes']=_[_0x074b('0x35')](_0x349918[_0x074b('0x31')],qs['fields'](_0x2d31e4[_0x074b('0x33')][_0x074b('0x36')]));_0x1fe0f4[_0x074b('0x37')]=_0x1fe0f4['attributes'][_0x074b('0x38')]?_0x1fe0f4[_0x074b('0x37')]:_0x349918[_0x074b('0x31')];if(!_0x2d31e4[_0x074b('0x33')][_0x074b('0x39')](_0x074b('0x3a'))){_0x1fe0f4[_0x074b('0x1f')]=qs[_0x074b('0x1f')](_0x2d31e4[_0x074b('0x33')][_0x074b('0x1f')]);_0x1fe0f4['offset']=qs[_0x074b('0x1e')](_0x2d31e4['query'][_0x074b('0x1e')]);}_0x1fe0f4['order']=qs[_0x074b('0x3b')](_0x2d31e4[_0x074b('0x33')][_0x074b('0x3b')]);_0x1fe0f4[_0x074b('0x3c')]=qs[_0x074b('0x3d')](_[_0x074b('0x3e')](_0x2d31e4[_0x074b('0x33')],_0x349918[_0x074b('0x3d')]),_0x552c04);if(_0x2d31e4['query'][_0x074b('0x3f')]){_0x1fe0f4[_0x074b('0x3c')]=_[_0x074b('0x40')](_0x1fe0f4[_0x074b('0x3c')],{'$or':_[_0x074b('0x32')](_0x552c04,function(_0x4095ec){if(_0x4095ec[_0x074b('0x2f')]!==_0x074b('0x41')){var _0x1eac13={};_0x1eac13[_0x4095ec[_0x074b('0x2b')]]={'$like':'%'+_0x2d31e4[_0x074b('0x33')]['filter']+'%'};return _0x1eac13;}})});}_0x1fe0f4=_[_0x074b('0x40')]({},_0x1fe0f4,_0x2d31e4[_0x074b('0x42')]);var _0x506afb={'where':_0x1fe0f4[_0x074b('0x3c')]};return db[_0x074b('0x43')][_0x074b('0x21')](_0x506afb)[_0x074b('0x28')](function(_0x2d64c){_0x390c36[_0x074b('0x21')]=_0x2d64c;if(_0x2d31e4[_0x074b('0x33')][_0x074b('0x44')]){_0x1fe0f4[_0x074b('0x45')]=[{'all':!![]}];}return db[_0x074b('0x43')][_0x074b('0x46')](_0x1fe0f4);})[_0x074b('0x28')](function(_0x4736de){_0x390c36[_0x074b('0x47')]=_0x4736de;return _0x390c36;})[_0x074b('0x28')](respondWithFilteredResult(_0x403114,_0x1fe0f4))[_0x074b('0x48')](handleError(_0x403114,null));};exports[_0x074b('0x49')]=function(_0x1aaadd,_0x1b4ba3){var _0x4fe39a={'raw':![],'where':{'id':_0x1aaadd['params']['id']}},_0x289636={};_0x289636[_0x074b('0x31')]=_[_0x074b('0x34')](db[_0x074b('0x43')][_0x074b('0x2e')]);_0x289636[_0x074b('0x33')]=_[_0x074b('0x34')](_0x1aaadd[_0x074b('0x33')]);_0x289636[_0x074b('0x3d')]=_['intersection'](_0x289636['model'],_0x289636[_0x074b('0x33')]);_0x4fe39a[_0x074b('0x37')]=_[_0x074b('0x35')](_0x289636[_0x074b('0x31')],qs[_0x074b('0x36')](_0x1aaadd['query'][_0x074b('0x36')]));_0x4fe39a['attributes']=_0x4fe39a[_0x074b('0x37')][_0x074b('0x38')]?_0x4fe39a[_0x074b('0x37')]:_0x289636['model'];if(_0x1aaadd[_0x074b('0x33')][_0x074b('0x44')]){_0x4fe39a['include']=[{'all':!![]}];}_0x4fe39a=_[_0x074b('0x40')]({},_0x4fe39a,_0x1aaadd[_0x074b('0x42')]);return db['IntegrationReport'][_0x074b('0x4a')](_0x4fe39a)['then'](handleEntityNotFound(_0x1b4ba3,null))[_0x074b('0x28')](respondWithResult(_0x1b4ba3,null))[_0x074b('0x48')](handleError(_0x1b4ba3,null));};exports['create']=function(_0x222751,_0x9b08ff){return db[_0x074b('0x43')][_0x074b('0x4b')](_0x222751['body'],{})[_0x074b('0x28')](respondWithResult(_0x9b08ff,0xc9))[_0x074b('0x48')](handleError(_0x9b08ff,null));};exports[_0x074b('0x26')]=function(_0x63fbc1,_0x41d255){if(_0x63fbc1[_0x074b('0x4c')]['id']){delete _0x63fbc1['body']['id'];}return db['IntegrationReport'][_0x074b('0x4a')]({'where':{'id':_0x63fbc1[_0x074b('0x4d')]['id']}})[_0x074b('0x28')](handleEntityNotFound(_0x41d255,null))[_0x074b('0x28')](saveUpdates(_0x63fbc1[_0x074b('0x4c')],null))[_0x074b('0x28')](respondWithResult(_0x41d255,null))[_0x074b('0x48')](handleError(_0x41d255,null));};exports[_0x074b('0x27')]=function(_0x362465,_0x1a0a2d){return db['IntegrationReport'][_0x074b('0x4a')]({'where':{'id':_0x362465[_0x074b('0x4d')]['id']}})[_0x074b('0x28')](handleEntityNotFound(_0x1a0a2d,null))['then'](removeEntity(_0x1a0a2d,null))['catch'](handleError(_0x1a0a2d,null));};exports[_0x074b('0x4e')]=function(_0x5c7a53,_0x5a1938){return db[_0x074b('0x43')][_0x074b('0x4e')]()[_0x074b('0x28')](respondWithResult(_0x5a1938,null))[_0x074b('0x48')](handleError(_0x5a1938,null));}; \ No newline at end of file +var _0x9691=['show','params','includeAll','include','find','create','body','describe','eml-format','zip-dir','request-promise','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','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9691,0x144));var _0x1969=function(_0x9d5b55,_0x4b837a){_0x9d5b55=_0x9d5b55-0x0;var _0x56ba40=_0x9691[_0x9d5b55];return _0x56ba40;};'use strict';var emlformat=require(_0x1969('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1969('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1969('0x2'));var moment=require(_0x1969('0x3'));var BPromise=require(_0x1969('0x4'));var Mustache=require(_0x1969('0x5'));var util=require(_0x1969('0x6'));var path=require(_0x1969('0x7'));var sox=require(_0x1969('0x8'));var csv=require(_0x1969('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1969('0xa'));var _=require(_0x1969('0xb'));var squel=require(_0x1969('0xc'));var crypto=require(_0x1969('0xd'));var jsforce=require(_0x1969('0xe'));var deskjs=require(_0x1969('0xf'));var toCsv=require(_0x1969('0x9'));var querystring=require(_0x1969('0x10'));var Papa=require(_0x1969('0x11'));var Redis=require(_0x1969('0x12'));var authService=require(_0x1969('0x13'));var qs=require(_0x1969('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1969('0x15'))(_0x1969('0x16'));var utils=require(_0x1969('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1969('0x18'));var db=require(_0x1969('0x19'))['db'];function respondWithStatusCode(_0x2b4a36,_0x4f0bcf){_0x4f0bcf=_0x4f0bcf||0xcc;return function(_0x4b4f05){if(_0x4b4f05){return _0x2b4a36[_0x1969('0x1a')](_0x4f0bcf);}return _0x2b4a36[_0x1969('0x1b')](_0x4f0bcf)[_0x1969('0x1c')]();};}function respondWithResult(_0x2c367d,_0x33b2e7){_0x33b2e7=_0x33b2e7||0xc8;return function(_0x3ccf6d){if(_0x3ccf6d){return _0x2c367d[_0x1969('0x1b')](_0x33b2e7)[_0x1969('0x1d')](_0x3ccf6d);}};}function respondWithFilteredResult(_0x5784c8,_0x19bc4b){return function(_0x4b3e2b){if(_0x4b3e2b){var _0x1059d3=typeof _0x19bc4b['offset']===_0x1969('0x1e')&&typeof _0x19bc4b['limit']===_0x1969('0x1e');var _0x492f53=_0x4b3e2b[_0x1969('0x1f')];var _0x517838=_0x1059d3?0x0:_0x19bc4b[_0x1969('0x20')];var _0x2bfc21=_0x1059d3?_0x4b3e2b['count']:_0x19bc4b[_0x1969('0x20')]+_0x19bc4b[_0x1969('0x21')];var _0x4ccb7f;if(_0x2bfc21>=_0x492f53){_0x2bfc21=_0x492f53;_0x4ccb7f=0xc8;}else{_0x4ccb7f=0xce;}_0x5784c8['status'](_0x4ccb7f);return _0x5784c8[_0x1969('0x22')](_0x1969('0x23'),_0x517838+'-'+_0x2bfc21+'/'+_0x492f53)[_0x1969('0x1d')](_0x4b3e2b);}return null;};}function patchUpdates(_0x410383){return function(_0x4d964b){try{jsonpatch['apply'](_0x4d964b,_0x410383,!![]);}catch(_0x532859){return BPromise[_0x1969('0x24')](_0x532859);}return _0x4d964b[_0x1969('0x25')]();};}function saveUpdates(_0x35ad58,_0x4af9d6){return function(_0x320982){if(_0x320982){return _0x320982[_0x1969('0x26')](_0x35ad58)['then'](function(_0x2eb66a){return _0x2eb66a;});}return null;};}function removeEntity(_0x3b8b78,_0x272c46){return function(_0x569116){if(_0x569116){return _0x569116[_0x1969('0x27')]()[_0x1969('0x28')](function(){_0x3b8b78[_0x1969('0x1b')](0xcc)[_0x1969('0x1c')]();});}};}function handleEntityNotFound(_0x195df1,_0x26e441){return function(_0x73f7cc){if(!_0x73f7cc){_0x195df1['sendStatus'](0x194);}return _0x73f7cc;};}function handleError(_0x2be115,_0x4676b5){_0x4676b5=_0x4676b5||0x1f4;return function(_0x351159){logger[_0x1969('0x29')](_0x351159['stack']);if(_0x351159[_0x1969('0x2a')]){delete _0x351159[_0x1969('0x2a')];}_0x2be115[_0x1969('0x1b')](_0x4676b5)[_0x1969('0x2b')](_0x351159);};}exports[_0x1969('0x2c')]=function(_0x1cc3af,_0x2e4b0a){var _0x29bd18={},_0x111699={},_0x32a0e4={'count':0x0,'rows':[]};var _0x2191c2=_[_0x1969('0x2d')](db[_0x1969('0x2e')][_0x1969('0x2f')],function(_0x3fb4be){return{'name':_0x3fb4be[_0x1969('0x30')],'type':_0x3fb4be['type'][_0x1969('0x31')]};});_0x111699[_0x1969('0x32')]=_[_0x1969('0x2d')](_0x2191c2,'name');_0x111699[_0x1969('0x33')]=_[_0x1969('0x34')](_0x1cc3af[_0x1969('0x33')]);_0x111699[_0x1969('0x35')]=_[_0x1969('0x36')](_0x111699['model'],_0x111699[_0x1969('0x33')]);_0x29bd18[_0x1969('0x37')]=_[_0x1969('0x36')](_0x111699[_0x1969('0x32')],qs[_0x1969('0x38')](_0x1cc3af['query'][_0x1969('0x38')]));_0x29bd18[_0x1969('0x37')]=_0x29bd18[_0x1969('0x37')][_0x1969('0x39')]?_0x29bd18[_0x1969('0x37')]:_0x111699[_0x1969('0x32')];if(!_0x1cc3af['query'][_0x1969('0x3a')](_0x1969('0x3b'))){_0x29bd18['limit']=qs[_0x1969('0x21')](_0x1cc3af['query']['limit']);_0x29bd18[_0x1969('0x20')]=qs['offset'](_0x1cc3af[_0x1969('0x33')][_0x1969('0x20')]);}_0x29bd18[_0x1969('0x3c')]=qs[_0x1969('0x3d')](_0x1cc3af['query']['sort']);_0x29bd18[_0x1969('0x3e')]=qs[_0x1969('0x35')](_[_0x1969('0x3f')](_0x1cc3af[_0x1969('0x33')],_0x111699[_0x1969('0x35')]),_0x2191c2);if(_0x1cc3af['query'][_0x1969('0x40')]){_0x29bd18[_0x1969('0x3e')]=_[_0x1969('0x41')](_0x29bd18['where'],{'$or':_[_0x1969('0x2d')](_0x2191c2,function(_0x44c40a){if(_0x44c40a['type']!==_0x1969('0x42')){var _0xaf2f9e={};_0xaf2f9e[_0x44c40a['name']]={'$like':'%'+_0x1cc3af[_0x1969('0x33')][_0x1969('0x40')]+'%'};return _0xaf2f9e;}})});}_0x29bd18=_[_0x1969('0x41')]({},_0x29bd18,_0x1cc3af[_0x1969('0x43')]);var _0x32cac1={'where':_0x29bd18[_0x1969('0x3e')]};return db[_0x1969('0x2e')][_0x1969('0x1f')](_0x32cac1)[_0x1969('0x28')](function(_0x559e2a){_0x32a0e4[_0x1969('0x1f')]=_0x559e2a;if(_0x1cc3af[_0x1969('0x33')]['includeAll']){_0x29bd18['include']=[{'all':!![]}];}return db[_0x1969('0x2e')][_0x1969('0x44')](_0x29bd18);})[_0x1969('0x28')](function(_0x163094){_0x32a0e4[_0x1969('0x45')]=_0x163094;return _0x32a0e4;})[_0x1969('0x28')](respondWithFilteredResult(_0x2e4b0a,_0x29bd18))[_0x1969('0x46')](handleError(_0x2e4b0a,null));};exports[_0x1969('0x47')]=function(_0x1b3da0,_0x28f8ff){var _0x22845e={'raw':![],'where':{'id':_0x1b3da0[_0x1969('0x48')]['id']}},_0x4e8c75={};_0x4e8c75[_0x1969('0x32')]=_[_0x1969('0x34')](db[_0x1969('0x2e')][_0x1969('0x2f')]);_0x4e8c75[_0x1969('0x33')]=_[_0x1969('0x34')](_0x1b3da0[_0x1969('0x33')]);_0x4e8c75[_0x1969('0x35')]=_[_0x1969('0x36')](_0x4e8c75[_0x1969('0x32')],_0x4e8c75[_0x1969('0x33')]);_0x22845e[_0x1969('0x37')]=_[_0x1969('0x36')](_0x4e8c75[_0x1969('0x32')],qs[_0x1969('0x38')](_0x1b3da0[_0x1969('0x33')][_0x1969('0x38')]));_0x22845e[_0x1969('0x37')]=_0x22845e[_0x1969('0x37')][_0x1969('0x39')]?_0x22845e[_0x1969('0x37')]:_0x4e8c75[_0x1969('0x32')];if(_0x1b3da0['query'][_0x1969('0x49')]){_0x22845e[_0x1969('0x4a')]=[{'all':!![]}];}_0x22845e=_[_0x1969('0x41')]({},_0x22845e,_0x1b3da0[_0x1969('0x43')]);return db[_0x1969('0x2e')][_0x1969('0x4b')](_0x22845e)[_0x1969('0x28')](handleEntityNotFound(_0x28f8ff,null))[_0x1969('0x28')](respondWithResult(_0x28f8ff,null))[_0x1969('0x46')](handleError(_0x28f8ff,null));};exports[_0x1969('0x4c')]=function(_0xd41cb1,_0x1dd12d){return db['IntegrationReport'][_0x1969('0x4c')](_0xd41cb1[_0x1969('0x4d')],{})['then'](respondWithResult(_0x1dd12d,0xc9))[_0x1969('0x46')](handleError(_0x1dd12d,null));};exports[_0x1969('0x26')]=function(_0x5a1567,_0x34e56b){if(_0x5a1567[_0x1969('0x4d')]['id']){delete _0x5a1567[_0x1969('0x4d')]['id'];}return db[_0x1969('0x2e')][_0x1969('0x4b')]({'where':{'id':_0x5a1567[_0x1969('0x48')]['id']}})[_0x1969('0x28')](handleEntityNotFound(_0x34e56b,null))[_0x1969('0x28')](saveUpdates(_0x5a1567['body'],null))[_0x1969('0x28')](respondWithResult(_0x34e56b,null))[_0x1969('0x46')](handleError(_0x34e56b,null));};exports[_0x1969('0x27')]=function(_0x1f983d,_0x2ba9a8){return db['IntegrationReport'][_0x1969('0x4b')]({'where':{'id':_0x1f983d[_0x1969('0x48')]['id']}})[_0x1969('0x28')](handleEntityNotFound(_0x2ba9a8,null))[_0x1969('0x28')](removeEntity(_0x2ba9a8,null))[_0x1969('0x46')](handleError(_0x2ba9a8,null));};exports[_0x1969('0x4e')]=function(_0x253022,_0x357d16){return db['IntegrationReport'][_0x1969('0x4e')]()[_0x1969('0x28')](respondWithResult(_0x357d16,null))[_0x1969('0x46')](handleError(_0x357d16,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 01b400d..ab6e931 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 _0xb9f3=['./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xb9f3,0xf3));var _0x3b9f=function(_0x44bf0c,_0xe5a5a8){_0x44bf0c=_0x44bf0c-0x0;var _0x18972a=_0xb9f3[_0x44bf0c];return _0x18972a;};'use strict';var _=require(_0x3b9f('0x0'));var util=require(_0x3b9f('0x1'));var logger=require(_0x3b9f('0x2'))(_0x3b9f('0x3'));var moment=require(_0x3b9f('0x4'));var BPromise=require('bluebird');var rp=require(_0x3b9f('0x5'));var fs=require('fs');var path=require(_0x3b9f('0x6'));var rimraf=require(_0x3b9f('0x7'));var config=require(_0x3b9f('0x8'));var attributes=require(_0x3b9f('0x9'));module[_0x3b9f('0xa')]=function(_0x1436b5,_0x20345d){return _0x1436b5[_0x3b9f('0xb')](_0x3b9f('0xc'),attributes,{'tableName':_0x3b9f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf820=['../../config/environment','define','IntegrationReport','lodash','util','../../config/logger','request-promise','rimraf'];(function(_0x29ebb8,_0x51d0d8){var _0x10c623=function(_0x6266c2){while(--_0x6266c2){_0x29ebb8['push'](_0x29ebb8['shift']());}};_0x10c623(++_0x51d0d8);}(_0xf820,0x73));var _0x0f82=function(_0x42dc62,_0x433b94){_0x42dc62=_0x42dc62-0x0;var _0x3c696c=_0xf820[_0x42dc62];return _0x3c696c;};'use strict';var _=require(_0x0f82('0x0'));var util=require(_0x0f82('0x1'));var logger=require(_0x0f82('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0f82('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f82('0x4'));var config=require(_0x0f82('0x5'));var attributes=require('./integrationReport.attributes');module['exports']=function(_0x3a2887,_0x411c5d){return _0x3a2887[_0x0f82('0x6')](_0x0f82('0x7'),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 8f3efd9..6c776ae 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 _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(_0x4f3c3e,_0x2b7432){var _0x311415=function(_0x5b6cdb){while(--_0x5b6cdb){_0x4f3c3e['push'](_0x4f3c3e['shift']());}};_0x311415(++_0x2b7432);}(_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 +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x5a25f6,_0x3db5cb){var _0x5a524d=function(_0x11f0fd){while(--_0x11f0fd){_0x5a25f6['push'](_0x5a25f6['shift']());}};_0x5a524d(++_0x3db5cb);}(_0x2ef3,0xba));var _0x32ef=function(_0x4c872f,_0x1aba62){_0x4c872f=_0x4c872f-0x0;var _0x1d4b0e=_0x2ef3[_0x4c872f];return _0x1d4b0e;};'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')]('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 801b4d9..d159d34 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 _0x04f1=['/:id','isAuthenticated','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','index','get'];(function(_0x4965d7,_0x2b99c8){var _0x4acfd8=function(_0x22a16e){while(--_0x22a16e){_0x4965d7['push'](_0x4965d7['shift']());}};_0x4acfd8(++_0x2b99c8);}(_0x04f1,0x92));var _0x104f=function(_0x5b4fc0,_0xc317ea){_0x5b4fc0=_0x5b4fc0-0x0;var _0x15e56a=_0x04f1[_0x5b4fc0];return _0x15e56a;};'use strict';var multer=require(_0x104f('0x0'));var util=require(_0x104f('0x1'));var path=require(_0x104f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x104f('0x3')]();var fs_extra=require(_0x104f('0x4'));var auth=require(_0x104f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./interval.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x104f('0x6')]);router[_0x104f('0x7')](_0x104f('0x8'),auth[_0x104f('0x9')](),controller['show']);router[_0x104f('0x7')](_0x104f('0xa'),auth[_0x104f('0x9')](),controller[_0x104f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x104f('0xc')]);router[_0x104f('0xd')](_0x104f('0xa'),auth[_0x104f('0x9')](),controller[_0x104f('0xe')]);router[_0x104f('0xd')](_0x104f('0xf'),auth[_0x104f('0x9')](),controller[_0x104f('0x10')]);router[_0x104f('0x11')]('/:id',auth[_0x104f('0x9')](),controller[_0x104f('0x12')]);router[_0x104f('0x13')](_0x104f('0x8'),auth[_0x104f('0x9')](),controller[_0x104f('0x14')]);module[_0x104f('0x15')]=router; \ No newline at end of file +var _0xb453=['addIntervals','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many'];(function(_0x4860ed,_0x29ffab){var _0x37939e=function(_0x3a941d){while(--_0x3a941d){_0x4860ed['push'](_0x4860ed['shift']());}};_0x37939e(++_0x29ffab);}(_0xb453,0x1e8));var _0x3b45=function(_0x134919,_0x41325c){_0x134919=_0x134919-0x0;var _0x25f708=_0xb453[_0x134919];return _0x25f708;};'use strict';var multer=require(_0x3b45('0x0'));var util=require(_0x3b45('0x1'));var path=require('path');var timeout=require(_0x3b45('0x2'));var express=require(_0x3b45('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3b45('0x4'));var interaction=require(_0x3b45('0x5'));var config=require(_0x3b45('0x6'));var controller=require(_0x3b45('0x7'));router[_0x3b45('0x8')]('/',auth[_0x3b45('0x9')](),controller[_0x3b45('0xa')]);router[_0x3b45('0x8')](_0x3b45('0xb'),auth[_0x3b45('0x9')](),controller['show']);router[_0x3b45('0x8')](_0x3b45('0xc'),auth[_0x3b45('0x9')](),controller[_0x3b45('0xd')]);router[_0x3b45('0xe')]('/',auth[_0x3b45('0x9')](),controller[_0x3b45('0xf')]);router['post'](_0x3b45('0xc'),auth['isAuthenticated'](),controller[_0x3b45('0x10')]);router[_0x3b45('0xe')](_0x3b45('0x11'),auth[_0x3b45('0x9')](),controller[_0x3b45('0x12')]);router['put']('/:id',auth[_0x3b45('0x9')](),controller[_0x3b45('0x13')]);router['delete'](_0x3b45('0xb'),auth[_0x3b45('0x9')](),controller[_0x3b45('0x14')]);module[_0x3b45('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 4abab89..9ee44e4 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 _0x8191=['STRING','sequelize'];(function(_0x5677b1,_0x4cfe89){var _0x3324e5=function(_0x39fe8e){while(--_0x39fe8e){_0x5677b1['push'](_0x5677b1['shift']());}};_0x3324e5(++_0x4cfe89);}(_0x8191,0x1b3));var _0x1819=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0x8191[_0x5c4e16];return _0x36044a;};'use strict';var Sequelize=require(_0x1819('0x0'));module['exports']={'name':{'type':Sequelize[_0x1819('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1819('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x687e=['STRING','exports'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x687e,0x16f));var _0xe687=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x687e[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0xe687('0x0')]={'name':{'type':Sequelize[_0xe687('0x1')]},'description':{'type':Sequelize[_0xe687('0x1')]},'interval':{'type':Sequelize[_0xe687('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 7e18308..ab9cd32 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 _0x26df=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addInterval','IntervalId','getIntervals','findOne','addIntervals','transaction','bulkCreate','rimraf','request-promise','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','api','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','offset','limit','undefined','count','Content-Range','json','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','Interval','findAll','rows','catch','show','params','body'];(function(_0x2ef12d,_0x103abb){var _0x9d49ce=function(_0x3cf8b8){while(--_0x3cf8b8){_0x2ef12d['push'](_0x2ef12d['shift']());}};_0x9d49ce(++_0x103abb);}(_0x26df,0x125));var _0xf26d=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0x26df[_0x59eefb];return _0x1a49e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf26d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf26d('0x1'));var moment=require(_0xf26d('0x2'));var BPromise=require(_0xf26d('0x3'));var Mustache=require(_0xf26d('0x4'));var util=require(_0xf26d('0x5'));var path=require(_0xf26d('0x6'));var sox=require(_0xf26d('0x7'));var csv=require(_0xf26d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf26d('0x9'));var _=require(_0xf26d('0xa'));var squel=require(_0xf26d('0xb'));var crypto=require(_0xf26d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf26d('0xd'));var toCsv=require(_0xf26d('0x8'));var querystring=require(_0xf26d('0xe'));var Papa=require(_0xf26d('0xf'));var Redis=require(_0xf26d('0x10'));var authService=require(_0xf26d('0x11'));var qs=require(_0xf26d('0x12'));var as=require(_0xf26d('0x13'));var hardwareService=require(_0xf26d('0x14'));var logger=require('../../config/logger')(_0xf26d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf26d('0x16'));var db=require(_0xf26d('0x17'))['db'];var extensions=require(_0xf26d('0x18'));function respondWithStatusCode(_0x5848fc,_0x46702e){_0x46702e=_0x46702e||0xcc;return function(_0x4d5880){if(_0x4d5880){return _0x5848fc[_0xf26d('0x19')](_0x46702e);}return _0x5848fc['status'](_0x46702e)[_0xf26d('0x1a')]();};}function respondWithResult(_0x49ba82,_0x2d129f){_0x2d129f=_0x2d129f||0xc8;return function(_0x2ef5b5){if(_0x2ef5b5){return _0x49ba82[_0xf26d('0x1b')](_0x2d129f)['json'](_0x2ef5b5);}};}function respondWithFilteredResult(_0x50441b,_0x370553){return function(_0x21ff8f){if(_0x21ff8f){var _0x4962f8=typeof _0x370553[_0xf26d('0x1c')]==='undefined'&&typeof _0x370553[_0xf26d('0x1d')]===_0xf26d('0x1e');var _0x5afa76=_0x21ff8f[_0xf26d('0x1f')];var _0x57eed2=_0x4962f8?0x0:_0x370553[_0xf26d('0x1c')];var _0x3fbeaf=_0x4962f8?_0x21ff8f[_0xf26d('0x1f')]:_0x370553[_0xf26d('0x1c')]+_0x370553[_0xf26d('0x1d')];var _0x340dcf;if(_0x3fbeaf>=_0x5afa76){_0x3fbeaf=_0x5afa76;_0x340dcf=0xc8;}else{_0x340dcf=0xce;}_0x50441b['status'](_0x340dcf);return _0x50441b['set'](_0xf26d('0x20'),_0x57eed2+'-'+_0x3fbeaf+'/'+_0x5afa76)[_0xf26d('0x21')](_0x21ff8f);}return null;};}function patchUpdates(_0x275dfb){return function(_0x5bcee5){try{jsonpatch['apply'](_0x5bcee5,_0x275dfb,!![]);}catch(_0x5c7a98){return BPromise['reject'](_0x5c7a98);}return _0x5bcee5[_0xf26d('0x22')]();};}function saveUpdates(_0x522b81,_0x2a23a1){return function(_0x4c9126){if(_0x4c9126){return _0x4c9126[_0xf26d('0x23')](_0x522b81)[_0xf26d('0x24')](function(_0x3f462c){return _0x3f462c;});}return null;};}function removeEntity(_0x2c3701,_0x7ca104){return function(_0x3e4508){if(_0x3e4508){return _0x3e4508[_0xf26d('0x25')]()[_0xf26d('0x24')](function(){var _0x299e3c=_0x3e4508[_0xf26d('0x26')]({'plain':!![]});var _0x482efa='Intervals';return db[_0xf26d('0x27')][_0xf26d('0x25')]({'where':{'type':_0x482efa,'resourceId':_0x299e3c['id']}})[_0xf26d('0x24')](function(){return _0x3e4508;});})[_0xf26d('0x24')](function(){_0x2c3701[_0xf26d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cd0d7,_0x547877){return function(_0x190e83){if(!_0x190e83){_0x2cd0d7[_0xf26d('0x19')](0x194);}return _0x190e83;};}function handleError(_0x4c0e5a,_0x18ef5f){_0x18ef5f=_0x18ef5f||0x1f4;return function(_0x24362e){logger[_0xf26d('0x28')](_0x24362e[_0xf26d('0x29')]);if(_0x24362e[_0xf26d('0x2a')]){delete _0x24362e[_0xf26d('0x2a')];}_0x4c0e5a['status'](_0x18ef5f)[_0xf26d('0x2b')](_0x24362e);};}exports[_0xf26d('0x2c')]=function(_0x2b487b,_0x268d2c){var _0xc421d7={},_0x4e007f={},_0x27afc2={'count':0x0,'rows':[]};var _0x1465ad=_[_0xf26d('0x2d')](db['Interval'][_0xf26d('0x2e')],function(_0xb63d74){return{'name':_0xb63d74[_0xf26d('0x2f')],'type':_0xb63d74[_0xf26d('0x30')]['key']};});_0x4e007f['model']=_[_0xf26d('0x2d')](_0x1465ad,_0xf26d('0x2a'));_0x4e007f[_0xf26d('0x31')]=_[_0xf26d('0x32')](_0x2b487b['query']);_0x4e007f['filters']=_['intersection'](_0x4e007f[_0xf26d('0x33')],_0x4e007f[_0xf26d('0x31')]);_0xc421d7[_0xf26d('0x34')]=_[_0xf26d('0x35')](_0x4e007f[_0xf26d('0x33')],qs[_0xf26d('0x36')](_0x2b487b[_0xf26d('0x31')][_0xf26d('0x36')]));_0xc421d7['attributes']=_0xc421d7[_0xf26d('0x34')][_0xf26d('0x37')]?_0xc421d7[_0xf26d('0x34')]:_0x4e007f[_0xf26d('0x33')];if(!_0x2b487b[_0xf26d('0x31')]['hasOwnProperty'](_0xf26d('0x38'))){_0xc421d7['limit']=qs[_0xf26d('0x1d')](_0x2b487b[_0xf26d('0x31')][_0xf26d('0x1d')]);_0xc421d7['offset']=qs[_0xf26d('0x1c')](_0x2b487b[_0xf26d('0x31')][_0xf26d('0x1c')]);}_0xc421d7[_0xf26d('0x39')]=qs[_0xf26d('0x3a')](_0x2b487b[_0xf26d('0x31')][_0xf26d('0x3a')]);_0xc421d7[_0xf26d('0x3b')]=qs[_0xf26d('0x3c')](_[_0xf26d('0x3d')](_0x2b487b[_0xf26d('0x31')],_0x4e007f[_0xf26d('0x3c')]),_0x1465ad);if(_0x2b487b['query'][_0xf26d('0x3e')]){_0xc421d7[_0xf26d('0x3b')]=_[_0xf26d('0x3f')](_0xc421d7['where'],{'$or':_[_0xf26d('0x2d')](_0x1465ad,function(_0x4deaf5){if(_0x4deaf5[_0xf26d('0x30')]!==_0xf26d('0x40')){var _0x39c739={};_0x39c739[_0x4deaf5['name']]={'$like':'%'+_0x2b487b['query']['filter']+'%'};return _0x39c739;}})});}_0xc421d7=_[_0xf26d('0x3f')]({},_0xc421d7,_0x2b487b[_0xf26d('0x41')]);var _0x3cff3c={'where':_0xc421d7[_0xf26d('0x3b')]};return db['Interval'][_0xf26d('0x1f')](_0x3cff3c)[_0xf26d('0x24')](function(_0x4df268){_0x27afc2[_0xf26d('0x1f')]=_0x4df268;if(_0x2b487b[_0xf26d('0x31')][_0xf26d('0x42')]){_0xc421d7[_0xf26d('0x43')]=[{'all':!![]}];}return db[_0xf26d('0x44')][_0xf26d('0x45')](_0xc421d7);})[_0xf26d('0x24')](function(_0x54ade4){_0x27afc2[_0xf26d('0x46')]=_0x54ade4;return _0x27afc2;})[_0xf26d('0x24')](respondWithFilteredResult(_0x268d2c,_0xc421d7))[_0xf26d('0x47')](handleError(_0x268d2c,null));};exports[_0xf26d('0x48')]=function(_0x409516,_0x40c07b){var _0x2238e2={'raw':!![],'where':{'id':_0x409516[_0xf26d('0x49')]['id']}},_0x1481f6={};_0x1481f6['model']=_[_0xf26d('0x32')](db[_0xf26d('0x44')][_0xf26d('0x2e')]);_0x1481f6[_0xf26d('0x31')]=_[_0xf26d('0x32')](_0x409516[_0xf26d('0x31')]);_0x1481f6['filters']=_['intersection'](_0x1481f6['model'],_0x1481f6[_0xf26d('0x31')]);_0x2238e2[_0xf26d('0x34')]=_[_0xf26d('0x35')](_0x1481f6[_0xf26d('0x33')],qs['fields'](_0x409516[_0xf26d('0x31')]['fields']));_0x2238e2[_0xf26d('0x34')]=_0x2238e2[_0xf26d('0x34')][_0xf26d('0x37')]?_0x2238e2['attributes']:_0x1481f6[_0xf26d('0x33')];if(_0x409516[_0xf26d('0x31')][_0xf26d('0x42')]){_0x2238e2[_0xf26d('0x43')]=[{'all':!![]}];}_0x2238e2=_[_0xf26d('0x3f')]({},_0x2238e2,_0x409516[_0xf26d('0x41')]);return db[_0xf26d('0x44')]['find'](_0x2238e2)[_0xf26d('0x24')](handleEntityNotFound(_0x40c07b,null))['then'](respondWithResult(_0x40c07b,null))[_0xf26d('0x47')](handleError(_0x40c07b,null));};exports['create']=function(_0x5e67dc,_0x38f74e){return db['Interval']['create'](_0x5e67dc[_0xf26d('0x4a')],{})[_0xf26d('0x24')](function(_0x58f56b){var _0x2ad318=_0x5e67dc[_0xf26d('0x4b')]['get']({'plain':!![]});if(!_0x2ad318)throw new Error(_0xf26d('0x4c'));if(_0x2ad318[_0xf26d('0x4d')]==='user'){var _0x1ca076=_0x58f56b[_0xf26d('0x26')]({'plain':!![]});var _0x3fb133=_0xf26d('0x4e');return db[_0xf26d('0x4f')]['find']({'where':{'name':_0x3fb133,'userProfileId':_0x2ad318[_0xf26d('0x50')]},'raw':!![]})[_0xf26d('0x24')](function(_0x5230f7){if(_0x5230f7&&_0x5230f7[_0xf26d('0x51')]===0x0){return db[_0xf26d('0x27')][_0xf26d('0x52')]({'name':_0x1ca076['name'],'resourceId':_0x1ca076['id'],'type':_0x5230f7[_0xf26d('0x2a')],'sectionId':_0x5230f7['id']},{})[_0xf26d('0x24')](function(){return _0x58f56b;});}else{return _0x58f56b;}})['catch'](function(_0x50430e){logger[_0xf26d('0x28')](_0xf26d('0x53'),_0x50430e);throw _0x50430e;});}return _0x58f56b;})[_0xf26d('0x24')](respondWithResult(_0x38f74e,0xc9))[_0xf26d('0x47')](handleError(_0x38f74e,null));};exports[_0xf26d('0x23')]=function(_0x46df26,_0x503aae){if(_0x46df26[_0xf26d('0x4a')]['id']){delete _0x46df26[_0xf26d('0x4a')]['id'];}return db[_0xf26d('0x44')][_0xf26d('0x54')]({'where':{'id':_0x46df26[_0xf26d('0x49')]['id']}})['then'](handleEntityNotFound(_0x503aae,null))[_0xf26d('0x24')](saveUpdates(_0x46df26['body'],null))[_0xf26d('0x24')](respondWithResult(_0x503aae,null))[_0xf26d('0x47')](handleError(_0x503aae,null));};exports[_0xf26d('0x25')]=function(_0xfebb0a,_0x16664f){return db[_0xf26d('0x44')][_0xf26d('0x54')]({'where':{'id':_0xfebb0a[_0xf26d('0x49')]['id']}})[_0xf26d('0x24')](handleEntityNotFound(_0x16664f,null))['then'](removeEntity(_0x16664f,null))[_0xf26d('0x47')](handleError(_0x16664f,null));};exports[_0xf26d('0x55')]=function(_0x5e58fd,_0x2657df,_0x2fab4f){if(_0x5e58fd[_0xf26d('0x4a')]['id']){delete _0x5e58fd[_0xf26d('0x4a')]['id'];}return db[_0xf26d('0x44')][_0xf26d('0x54')]({'where':{'id':_0x5e58fd['params']['id']}})['then'](handleEntityNotFound(_0x2657df,null))['then'](function(_0x2c9636){if(_0x2c9636){_0x5e58fd[_0xf26d('0x4a')][_0xf26d('0x56')]=_0x2c9636['id'];return db[_0xf26d('0x44')][_0xf26d('0x52')](_0x5e58fd[_0xf26d('0x4a')]);}})[_0xf26d('0x24')](respondWithResult(_0x2657df,null))[_0xf26d('0x47')](handleError(_0x2657df,null));};exports[_0xf26d('0x57')]=function(_0x49dceb,_0x51e4f8,_0x1f7ac2){var _0x7e71f5={};var _0x487e2c={};var _0x4f9a5f;var _0x3e967b;return db[_0xf26d('0x44')][_0xf26d('0x58')]({'where':{'id':_0x49dceb[_0xf26d('0x49')]['id']}})['then'](handleEntityNotFound(_0x51e4f8,null))[_0xf26d('0x24')](function(_0x57214c){if(_0x57214c){_0x4f9a5f=_0x57214c;_0x487e2c[_0xf26d('0x33')]=_[_0xf26d('0x32')](db[_0xf26d('0x44')]['rawAttributes']);_0x487e2c['query']=_['keys'](_0x49dceb['query']);_0x487e2c[_0xf26d('0x3c')]=_[_0xf26d('0x35')](_0x487e2c['model'],_0x487e2c[_0xf26d('0x31')]);_0x7e71f5[_0xf26d('0x34')]=_[_0xf26d('0x35')](_0x487e2c[_0xf26d('0x33')],qs[_0xf26d('0x36')](_0x49dceb['query'][_0xf26d('0x36')]));_0x7e71f5[_0xf26d('0x34')]=_0x7e71f5[_0xf26d('0x34')][_0xf26d('0x37')]?_0x7e71f5[_0xf26d('0x34')]:_0x487e2c[_0xf26d('0x33')];_0x7e71f5[_0xf26d('0x39')]=qs['sort'](_0x49dceb[_0xf26d('0x31')][_0xf26d('0x3a')]);_0x7e71f5['where']=qs[_0xf26d('0x3c')](_[_0xf26d('0x3d')](_0x49dceb[_0xf26d('0x31')],_0x487e2c[_0xf26d('0x3c')]));if(_0x49dceb[_0xf26d('0x31')][_0xf26d('0x3e')]){_0x7e71f5[_0xf26d('0x3b')]=_['merge'](_0x7e71f5[_0xf26d('0x3b')],{'$or':_[_0xf26d('0x2d')](_0x7e71f5[_0xf26d('0x34')],function(_0x46f1d2){var _0x3564bd={};_0x3564bd[_0x46f1d2]={'$like':'%'+_0x49dceb['query'][_0xf26d('0x3e')]+'%'};return _0x3564bd;})});}_0x7e71f5=_['merge']({},_0x7e71f5,_0x49dceb[_0xf26d('0x41')]);return _0x4f9a5f[_0xf26d('0x57')](_0x7e71f5);}})[_0xf26d('0x24')](function(_0x2a87f6){if(_0x2a87f6){_0x3e967b=_0x2a87f6[_0xf26d('0x37')];if(!_0x49dceb['query']['hasOwnProperty'](_0xf26d('0x38'))){_0x7e71f5['limit']=qs['limit'](_0x49dceb[_0xf26d('0x31')][_0xf26d('0x1d')]);_0x7e71f5[_0xf26d('0x1c')]=qs[_0xf26d('0x1c')](_0x49dceb['query'][_0xf26d('0x1c')]);}return _0x4f9a5f[_0xf26d('0x57')](_0x7e71f5);}})[_0xf26d('0x24')](function(_0x48abf4){if(_0x48abf4){return _0x48abf4?{'count':_0x3e967b,'rows':_0x48abf4}:null;}})[_0xf26d('0x24')](respondWithResult(_0x51e4f8,null))[_0xf26d('0x47')](handleError(_0x51e4f8,null));};exports[_0xf26d('0x59')]=function(_0x459257,_0xe76bb9,_0x237be1){return db['Interval'][_0xf26d('0x58')]({'where':{'id':_0x459257['params']['id']}})['then'](handleEntityNotFound(_0xe76bb9,null))[_0xf26d('0x24')](function(_0x1e51e9){if(_0x1e51e9){return db['sequelize'][_0xf26d('0x5a')](function(_0x4c7c97){return db[_0xf26d('0x44')][_0xf26d('0x25')]({'where':{'IntervalId':_0x459257[_0xf26d('0x49')]['id']},'transaction':_0x4c7c97})[_0xf26d('0x24')](function(_0x438f4a){var _0x5e3128=_[_0xf26d('0x2d')](_0x459257[_0xf26d('0x4a')],function(_0x41dcfc){delete _0x41dcfc['id'];_0x41dcfc[_0xf26d('0x56')]=_0x459257[_0xf26d('0x49')]['id'];return _0x41dcfc;});return db[_0xf26d('0x44')][_0xf26d('0x5b')](_0x5e3128,{'transaction':_0x4c7c97});});})[_0xf26d('0x24')](function(){return db[_0xf26d('0x44')][_0xf26d('0x45')]({'where':{'IntervalId':_0x459257[_0xf26d('0x49')]['id']}});});}})['then'](respondWithResult(_0xe76bb9,null))['catch'](handleError(_0xe76bb9,null));}; \ No newline at end of file +var _0x7ac9=['filters','pick','filter','merge','VIRTUAL','options','Interval','count','includeAll','findAll','rows','params','include','find','catch','create','get','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getIntervals','addIntervals','findOne','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','Intervals','UserProfileResource','error','stack','name','send','index','rawAttributes','type','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x589514,_0x38e6fd){var _0x5c75eb=function(_0x55ab73){while(--_0x55ab73){_0x589514['push'](_0x589514['shift']());}};_0x5c75eb(++_0x38e6fd);}(_0x7ac9,0x18a));var _0x97ac=function(_0x1d8cd0,_0xab56b9){_0x1d8cd0=_0x1d8cd0-0x0;var _0x1b9761=_0x7ac9[_0x1d8cd0];return _0x1b9761;};'use strict';var emlformat=require(_0x97ac('0x0'));var rimraf=require(_0x97ac('0x1'));var zipdir=require(_0x97ac('0x2'));var jsonpatch=require(_0x97ac('0x3'));var rp=require(_0x97ac('0x4'));var moment=require(_0x97ac('0x5'));var BPromise=require(_0x97ac('0x6'));var Mustache=require('mustache');var util=require(_0x97ac('0x7'));var path=require(_0x97ac('0x8'));var sox=require(_0x97ac('0x9'));var csv=require(_0x97ac('0xa'));var ejs=require(_0x97ac('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x97ac('0xc'));var jsforce=require(_0x97ac('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x97ac('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x97ac('0xf'));var qs=require(_0x97ac('0x10'));var as=require(_0x97ac('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97ac('0x12'))('api');var utils=require(_0x97ac('0x13'));var config=require(_0x97ac('0x14'));var licenseUtil=require(_0x97ac('0x15'));var db=require(_0x97ac('0x16'))['db'];var extensions=require(_0x97ac('0x17'));function respondWithStatusCode(_0x380dce,_0x50fb65){_0x50fb65=_0x50fb65||0xcc;return function(_0x1753fd){if(_0x1753fd){return _0x380dce[_0x97ac('0x18')](_0x50fb65);}return _0x380dce[_0x97ac('0x19')](_0x50fb65)[_0x97ac('0x1a')]();};}function respondWithResult(_0x3ee98d,_0x4313b1){_0x4313b1=_0x4313b1||0xc8;return function(_0x3cd177){if(_0x3cd177){return _0x3ee98d[_0x97ac('0x19')](_0x4313b1)[_0x97ac('0x1b')](_0x3cd177);}};}function respondWithFilteredResult(_0xe5c1c5,_0x3ba55a){return function(_0x3b6659){if(_0x3b6659){var _0x1be07a=typeof _0x3ba55a[_0x97ac('0x1c')]===_0x97ac('0x1d')&&typeof _0x3ba55a[_0x97ac('0x1e')]===_0x97ac('0x1d');var _0x44148d=_0x3b6659['count'];var _0x5ed4e9=_0x1be07a?0x0:_0x3ba55a[_0x97ac('0x1c')];var _0x520966=_0x1be07a?_0x3b6659['count']:_0x3ba55a[_0x97ac('0x1c')]+_0x3ba55a['limit'];var _0x3b0c74;if(_0x520966>=_0x44148d){_0x520966=_0x44148d;_0x3b0c74=0xc8;}else{_0x3b0c74=0xce;}_0xe5c1c5['status'](_0x3b0c74);return _0xe5c1c5[_0x97ac('0x1f')](_0x97ac('0x20'),_0x5ed4e9+'-'+_0x520966+'/'+_0x44148d)[_0x97ac('0x1b')](_0x3b6659);}return null;};}function patchUpdates(_0x50803f){return function(_0x226a57){try{jsonpatch[_0x97ac('0x21')](_0x226a57,_0x50803f,!![]);}catch(_0x34cce0){return BPromise[_0x97ac('0x22')](_0x34cce0);}return _0x226a57[_0x97ac('0x23')]();};}function saveUpdates(_0x17602a,_0x3d3b4c){return function(_0x2e4313){if(_0x2e4313){return _0x2e4313[_0x97ac('0x24')](_0x17602a)[_0x97ac('0x25')](function(_0x3dd2a1){return _0x3dd2a1;});}return null;};}function removeEntity(_0x91adbc,_0x32cfe1){return function(_0x3b992a){if(_0x3b992a){return _0x3b992a[_0x97ac('0x26')]()[_0x97ac('0x25')](function(){var _0x166f6f=_0x3b992a['get']({'plain':!![]});var _0x2311a3=_0x97ac('0x27');return db[_0x97ac('0x28')][_0x97ac('0x26')]({'where':{'type':_0x2311a3,'resourceId':_0x166f6f['id']}})[_0x97ac('0x25')](function(){return _0x3b992a;});})[_0x97ac('0x25')](function(){_0x91adbc['status'](0xcc)[_0x97ac('0x1a')]();});}};}function handleEntityNotFound(_0x40482e,_0x13117c){return function(_0x193962){if(!_0x193962){_0x40482e[_0x97ac('0x18')](0x194);}return _0x193962;};}function handleError(_0x45cbdb,_0x5ed54e){_0x5ed54e=_0x5ed54e||0x1f4;return function(_0x437c42){logger[_0x97ac('0x29')](_0x437c42[_0x97ac('0x2a')]);if(_0x437c42[_0x97ac('0x2b')]){delete _0x437c42['name'];}_0x45cbdb[_0x97ac('0x19')](_0x5ed54e)[_0x97ac('0x2c')](_0x437c42);};}exports[_0x97ac('0x2d')]=function(_0x1e2f35,_0x1eb8cc){var _0x406154={},_0x28e92d={},_0x5680a0={'count':0x0,'rows':[]};var _0x43f214=_['map'](db['Interval'][_0x97ac('0x2e')],function(_0x5387fa){return{'name':_0x5387fa['fieldName'],'type':_0x5387fa[_0x97ac('0x2f')]['key']};});_0x28e92d[_0x97ac('0x30')]=_[_0x97ac('0x31')](_0x43f214,_0x97ac('0x2b'));_0x28e92d['query']=_[_0x97ac('0x32')](_0x1e2f35[_0x97ac('0x33')]);_0x28e92d['filters']=_[_0x97ac('0x34')](_0x28e92d[_0x97ac('0x30')],_0x28e92d[_0x97ac('0x33')]);_0x406154['attributes']=_[_0x97ac('0x34')](_0x28e92d[_0x97ac('0x30')],qs['fields'](_0x1e2f35[_0x97ac('0x33')][_0x97ac('0x35')]));_0x406154['attributes']=_0x406154[_0x97ac('0x36')][_0x97ac('0x37')]?_0x406154[_0x97ac('0x36')]:_0x28e92d[_0x97ac('0x30')];if(!_0x1e2f35[_0x97ac('0x33')][_0x97ac('0x38')](_0x97ac('0x39'))){_0x406154[_0x97ac('0x1e')]=qs[_0x97ac('0x1e')](_0x1e2f35[_0x97ac('0x33')][_0x97ac('0x1e')]);_0x406154['offset']=qs[_0x97ac('0x1c')](_0x1e2f35[_0x97ac('0x33')][_0x97ac('0x1c')]);}_0x406154[_0x97ac('0x3a')]=qs[_0x97ac('0x3b')](_0x1e2f35[_0x97ac('0x33')][_0x97ac('0x3b')]);_0x406154[_0x97ac('0x3c')]=qs[_0x97ac('0x3d')](_[_0x97ac('0x3e')](_0x1e2f35['query'],_0x28e92d[_0x97ac('0x3d')]),_0x43f214);if(_0x1e2f35[_0x97ac('0x33')][_0x97ac('0x3f')]){_0x406154[_0x97ac('0x3c')]=_[_0x97ac('0x40')](_0x406154[_0x97ac('0x3c')],{'$or':_['map'](_0x43f214,function(_0x14aeb7){if(_0x14aeb7[_0x97ac('0x2f')]!==_0x97ac('0x41')){var _0xac3ed7={};_0xac3ed7[_0x14aeb7[_0x97ac('0x2b')]]={'$like':'%'+_0x1e2f35[_0x97ac('0x33')][_0x97ac('0x3f')]+'%'};return _0xac3ed7;}})});}_0x406154=_['merge']({},_0x406154,_0x1e2f35[_0x97ac('0x42')]);var _0x25b953={'where':_0x406154[_0x97ac('0x3c')]};return db[_0x97ac('0x43')][_0x97ac('0x44')](_0x25b953)[_0x97ac('0x25')](function(_0x4ca988){_0x5680a0[_0x97ac('0x44')]=_0x4ca988;if(_0x1e2f35[_0x97ac('0x33')][_0x97ac('0x45')]){_0x406154['include']=[{'all':!![]}];}return db['Interval'][_0x97ac('0x46')](_0x406154);})[_0x97ac('0x25')](function(_0x5d3125){_0x5680a0[_0x97ac('0x47')]=_0x5d3125;return _0x5680a0;})[_0x97ac('0x25')](respondWithFilteredResult(_0x1eb8cc,_0x406154))['catch'](handleError(_0x1eb8cc,null));};exports['show']=function(_0x29149e,_0x333468){var _0x2e29f4={'raw':!![],'where':{'id':_0x29149e[_0x97ac('0x48')]['id']}},_0x21ad4a={};_0x21ad4a[_0x97ac('0x30')]=_[_0x97ac('0x32')](db[_0x97ac('0x43')][_0x97ac('0x2e')]);_0x21ad4a[_0x97ac('0x33')]=_['keys'](_0x29149e[_0x97ac('0x33')]);_0x21ad4a[_0x97ac('0x3d')]=_[_0x97ac('0x34')](_0x21ad4a['model'],_0x21ad4a[_0x97ac('0x33')]);_0x2e29f4[_0x97ac('0x36')]=_[_0x97ac('0x34')](_0x21ad4a[_0x97ac('0x30')],qs['fields'](_0x29149e[_0x97ac('0x33')][_0x97ac('0x35')]));_0x2e29f4[_0x97ac('0x36')]=_0x2e29f4[_0x97ac('0x36')]['length']?_0x2e29f4[_0x97ac('0x36')]:_0x21ad4a[_0x97ac('0x30')];if(_0x29149e[_0x97ac('0x33')][_0x97ac('0x45')]){_0x2e29f4[_0x97ac('0x49')]=[{'all':!![]}];}_0x2e29f4=_[_0x97ac('0x40')]({},_0x2e29f4,_0x29149e['options']);return db[_0x97ac('0x43')][_0x97ac('0x4a')](_0x2e29f4)['then'](handleEntityNotFound(_0x333468,null))[_0x97ac('0x25')](respondWithResult(_0x333468,null))[_0x97ac('0x4b')](handleError(_0x333468,null));};exports[_0x97ac('0x4c')]=function(_0x3bfbf7,_0x550b65){return db[_0x97ac('0x43')]['create'](_0x3bfbf7['body'],{})[_0x97ac('0x25')](function(_0x2bd455){var _0x1afca7=_0x3bfbf7['user'][_0x97ac('0x4d')]({'plain':!![]});if(!_0x1afca7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1afca7[_0x97ac('0x4e')]===_0x97ac('0x4f')){var _0xc83036=_0x2bd455[_0x97ac('0x4d')]({'plain':!![]});var _0x256fc6=_0x97ac('0x27');return db[_0x97ac('0x50')]['find']({'where':{'name':_0x256fc6,'userProfileId':_0x1afca7['userProfileId']},'raw':!![]})[_0x97ac('0x25')](function(_0x1965c1){if(_0x1965c1&&_0x1965c1[_0x97ac('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0xc83036[_0x97ac('0x2b')],'resourceId':_0xc83036['id'],'type':_0x1965c1[_0x97ac('0x2b')],'sectionId':_0x1965c1['id']},{})['then'](function(){return _0x2bd455;});}else{return _0x2bd455;}})[_0x97ac('0x4b')](function(_0x596c34){logger['error'](_0x97ac('0x52'),_0x596c34);throw _0x596c34;});}return _0x2bd455;})[_0x97ac('0x25')](respondWithResult(_0x550b65,0xc9))[_0x97ac('0x4b')](handleError(_0x550b65,null));};exports[_0x97ac('0x24')]=function(_0x460d00,_0x312bb4){if(_0x460d00['body']['id']){delete _0x460d00[_0x97ac('0x53')]['id'];}return db[_0x97ac('0x43')][_0x97ac('0x4a')]({'where':{'id':_0x460d00[_0x97ac('0x48')]['id']}})[_0x97ac('0x25')](handleEntityNotFound(_0x312bb4,null))[_0x97ac('0x25')](saveUpdates(_0x460d00[_0x97ac('0x53')],null))['then'](respondWithResult(_0x312bb4,null))['catch'](handleError(_0x312bb4,null));};exports[_0x97ac('0x26')]=function(_0x65b763,_0x44b56b){return db[_0x97ac('0x43')]['find']({'where':{'id':_0x65b763[_0x97ac('0x48')]['id']}})[_0x97ac('0x25')](handleEntityNotFound(_0x44b56b,null))['then'](removeEntity(_0x44b56b,null))[_0x97ac('0x4b')](handleError(_0x44b56b,null));};exports['addInterval']=function(_0x212b67,_0x34059d,_0x131a41){if(_0x212b67[_0x97ac('0x53')]['id']){delete _0x212b67[_0x97ac('0x53')]['id'];}return db[_0x97ac('0x43')]['find']({'where':{'id':_0x212b67['params']['id']}})['then'](handleEntityNotFound(_0x34059d,null))['then'](function(_0x302ed1){if(_0x302ed1){_0x212b67[_0x97ac('0x53')]['IntervalId']=_0x302ed1['id'];return db[_0x97ac('0x43')][_0x97ac('0x4c')](_0x212b67[_0x97ac('0x53')]);}})[_0x97ac('0x25')](respondWithResult(_0x34059d,null))[_0x97ac('0x4b')](handleError(_0x34059d,null));};exports[_0x97ac('0x54')]=function(_0x300405,_0xf8dcb1,_0x53424f){var _0x3899f3={};var _0x49090a={};var _0x3b9112;var _0x3823d6;return db[_0x97ac('0x43')]['findOne']({'where':{'id':_0x300405[_0x97ac('0x48')]['id']}})[_0x97ac('0x25')](handleEntityNotFound(_0xf8dcb1,null))['then'](function(_0x4eff98){if(_0x4eff98){_0x3b9112=_0x4eff98;_0x49090a['model']=_[_0x97ac('0x32')](db[_0x97ac('0x43')][_0x97ac('0x2e')]);_0x49090a[_0x97ac('0x33')]=_[_0x97ac('0x32')](_0x300405[_0x97ac('0x33')]);_0x49090a['filters']=_['intersection'](_0x49090a[_0x97ac('0x30')],_0x49090a[_0x97ac('0x33')]);_0x3899f3['attributes']=_[_0x97ac('0x34')](_0x49090a[_0x97ac('0x30')],qs[_0x97ac('0x35')](_0x300405[_0x97ac('0x33')][_0x97ac('0x35')]));_0x3899f3['attributes']=_0x3899f3[_0x97ac('0x36')][_0x97ac('0x37')]?_0x3899f3[_0x97ac('0x36')]:_0x49090a[_0x97ac('0x30')];_0x3899f3['order']=qs['sort'](_0x300405[_0x97ac('0x33')][_0x97ac('0x3b')]);_0x3899f3['where']=qs[_0x97ac('0x3d')](_[_0x97ac('0x3e')](_0x300405['query'],_0x49090a[_0x97ac('0x3d')]));if(_0x300405[_0x97ac('0x33')][_0x97ac('0x3f')]){_0x3899f3['where']=_[_0x97ac('0x40')](_0x3899f3['where'],{'$or':_['map'](_0x3899f3[_0x97ac('0x36')],function(_0x277660){var _0x61b71a={};_0x61b71a[_0x277660]={'$like':'%'+_0x300405['query']['filter']+'%'};return _0x61b71a;})});}_0x3899f3=_[_0x97ac('0x40')]({},_0x3899f3,_0x300405[_0x97ac('0x42')]);return _0x3b9112[_0x97ac('0x54')](_0x3899f3);}})[_0x97ac('0x25')](function(_0x8ba7f0){if(_0x8ba7f0){_0x3823d6=_0x8ba7f0['length'];if(!_0x300405['query'][_0x97ac('0x38')](_0x97ac('0x39'))){_0x3899f3[_0x97ac('0x1e')]=qs[_0x97ac('0x1e')](_0x300405['query'][_0x97ac('0x1e')]);_0x3899f3[_0x97ac('0x1c')]=qs[_0x97ac('0x1c')](_0x300405[_0x97ac('0x33')][_0x97ac('0x1c')]);}return _0x3b9112[_0x97ac('0x54')](_0x3899f3);}})[_0x97ac('0x25')](function(_0x3770f2){if(_0x3770f2){return _0x3770f2?{'count':_0x3823d6,'rows':_0x3770f2}:null;}})[_0x97ac('0x25')](respondWithResult(_0xf8dcb1,null))[_0x97ac('0x4b')](handleError(_0xf8dcb1,null));};exports[_0x97ac('0x55')]=function(_0x1284c0,_0xc22d2d,_0x5aa666){return db[_0x97ac('0x43')][_0x97ac('0x56')]({'where':{'id':_0x1284c0[_0x97ac('0x48')]['id']}})[_0x97ac('0x25')](handleEntityNotFound(_0xc22d2d,null))['then'](function(_0x25e8f2){if(_0x25e8f2){return db[_0x97ac('0x57')][_0x97ac('0x58')](function(_0x4eca5b){return db['Interval'][_0x97ac('0x26')]({'where':{'IntervalId':_0x1284c0[_0x97ac('0x48')]['id']},'transaction':_0x4eca5b})['then'](function(_0x386b72){var _0x46b95a=_[_0x97ac('0x31')](_0x1284c0[_0x97ac('0x53')],function(_0x5ec0e4){delete _0x5ec0e4['id'];_0x5ec0e4[_0x97ac('0x59')]=_0x1284c0[_0x97ac('0x48')]['id'];return _0x5ec0e4;});return db[_0x97ac('0x43')][_0x97ac('0x5a')](_0x46b95a,{'transaction':_0x4eca5b});});})[_0x97ac('0x25')](function(){return db[_0x97ac('0x43')]['findAll']({'where':{'IntervalId':_0x1284c0[_0x97ac('0x48')]['id']}});});}})[_0x97ac('0x25')](respondWithResult(_0xc22d2d,null))[_0x97ac('0x4b')](handleError(_0xc22d2d,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index c1b6740..9bbd857 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 _0xe923=['exports','define','Interval','tools_intervals','rewrite','interval','string','getIntervals','then','all','map','ifTime','reduce','./interval.attributes','../../utils/iftime'];(function(_0x59342a,_0x16827b){var _0x17abc9=function(_0x2f7bfc){while(--_0x2f7bfc){_0x59342a['push'](_0x59342a['shift']());}};_0x17abc9(++_0x16827b);}(_0xe923,0xd0));var _0x3e92=function(_0x2e914,_0x1c7566){_0x2e914=_0x2e914-0x0;var _0x936e45=_0xe923[_0x2e914];return _0x936e45;};'use strict';var attributes=require(_0x3e92('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x3e92('0x1'))['iftime'];module[_0x3e92('0x2')]=function(_0x1f8410){return _0x1f8410[_0x3e92('0x3')](_0x3e92('0x4'),attributes,{'tableName':_0x3e92('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x53303f){extensions['rewrite'](_0x1f8410,_0x53303f);},'afterBulkCreate':function(_0x2d3016,_0x45060c,_0x1f7f52){_0x1f7f52();extensions[_0x3e92('0x6')](_0x1f8410,_0x2d3016[0x0]);},'afterUpdate':function(_0x21854b){extensions[_0x3e92('0x6')](_0x1f8410,_0x21854b);},'afterDestroy':function(_0xed6721){extensions[_0x3e92('0x6')](_0x1f8410,_0xed6721);}},'instanceMethods':{'ifTime':function(_0x21aa2e=undefined,_0x2b0a3a=new Date()){if(typeof this[_0x3e92('0x7')]===_0x3e92('0x8')){return iftime(this[_0x3e92('0x7')],_0x21aa2e,_0x2b0a3a);}else{return this[_0x3e92('0x9')]()[_0x3e92('0xa')](function(_0x19f7a9){return Promise[_0x3e92('0xb')](_0x19f7a9[_0x3e92('0xc')](function(_0x24d298){return _0x24d298[_0x3e92('0xd')](_0x21aa2e,_0x2b0a3a);}));})[_0x3e92('0xa')](function(_0x29bc14){return _0x29bc14[_0x3e92('0xe')](function(_0x335709,_0x1ccc45){return _0x335709||_0x1ccc45;},![]);});}}}});}; \ No newline at end of file +var _0x2303=['reduce','../../components/extensions/rewrite','exports','define','Interval','rewrite','string','interval','then','all','map','ifTime'];(function(_0x174ea5,_0x59d78f){var _0x1bdc5d=function(_0x46f659){while(--_0x46f659){_0x174ea5['push'](_0x174ea5['shift']());}};_0x1bdc5d(++_0x59d78f);}(_0x2303,0xc1));var _0x3230=function(_0x42861d,_0x4c4df5){_0x42861d=_0x42861d-0x0;var _0x2b9fc4=_0x2303[_0x42861d];return _0x2b9fc4;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x3230('0x0'));var iftime=require('../../utils/iftime')['iftime'];module[_0x3230('0x1')]=function(_0x24d284){return _0x24d284[_0x3230('0x2')](_0x3230('0x3'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a9a19){extensions['rewrite'](_0x24d284,_0x5a9a19);},'afterBulkCreate':function(_0x227c0a,_0x2429f,_0x1fef6c){_0x1fef6c();extensions[_0x3230('0x4')](_0x24d284,_0x227c0a[0x0]);},'afterUpdate':function(_0x4113a1){extensions['rewrite'](_0x24d284,_0x4113a1);},'afterDestroy':function(_0x19fc0b){extensions[_0x3230('0x4')](_0x24d284,_0x19fc0b);}},'instanceMethods':{'ifTime':function(_0x34c557=undefined,_0xfec36c=new Date()){if(typeof this['interval']===_0x3230('0x5')){return iftime(this[_0x3230('0x6')],_0x34c557,_0xfec36c);}else{return this['getIntervals']()[_0x3230('0x7')](function(_0x4a5616){return Promise[_0x3230('0x8')](_0x4a5616[_0x3230('0x9')](function(_0x36f5f3){return _0x36f5f3[_0x3230('0xa')](_0x34c557,_0xfec36c);}));})[_0x3230('0x7')](function(_0xeb032f){return _0xeb032f[_0x3230('0xb')](function(_0x4d3419,_0x23fbca){return _0x4d3419||_0x23fbca;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index e43f55e..f74b3fa 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 _0xa0a9=['raw','where','then','ShowInterval','debug','findAll','reduce','format','name','join','findById','intervalIds','isArray','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','IntervalIftime','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','options','attributes','limit','include','map','model','info','stringify','catch','error','message','find'];(function(_0x7430b4,_0x3526ec){var _0x44bbd5=function(_0x112277){while(--_0x112277){_0x7430b4['push'](_0x7430b4['shift']());}};_0x44bbd5(++_0x3526ec);}(_0xa0a9,0x133));var _0x9a0a=function(_0x4741d8,_0x1bfda1){_0x4741d8=_0x4741d8-0x0;var _0x1437b0=_0xa0a9[_0x4741d8];return _0x1437b0;};'use strict';var _=require(_0x9a0a('0x0'));var util=require(_0x9a0a('0x1'));var db=require(_0x9a0a('0x2'))['db'];var iftime=require(_0x9a0a('0x3'))[_0x9a0a('0x4')];var logger=require(_0x9a0a('0x5'))(_0x9a0a('0x6'));exports[_0x9a0a('0x7')]=function(_0x1f11d8){var _0x1e0dff=this;return new Promise(function(_0x13a64b,_0xa7fc60){return db[_0x9a0a('0x8')]['findAll']({'raw':_0x1f11d8[_0x9a0a('0x9')]?_0x1f11d8['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f11d8[_0x9a0a('0x9')]?_0x1f11d8[_0x9a0a('0x9')]['where']||null:null,'attributes':_0x1f11d8['options']?_0x1f11d8[_0x9a0a('0x9')][_0x9a0a('0xa')]||null:null,'limit':_0x1f11d8[_0x9a0a('0x9')]?_0x1f11d8[_0x9a0a('0x9')][_0x9a0a('0xb')]||null:null,'include':_0x1f11d8[_0x9a0a('0x9')]?_0x1f11d8[_0x9a0a('0x9')][_0x9a0a('0xc')]?_[_0x9a0a('0xd')](_0x1f11d8[_0x9a0a('0x9')]['include'],function(_0x21e92c){return{'model':db[_0x21e92c[_0x9a0a('0xe')]],'as':_0x21e92c['as'],'attributes':_0x21e92c[_0x9a0a('0xa')],'include':_0x21e92c['include']?_['map'](_0x21e92c[_0x9a0a('0xc')],function(_0x5b5c21){return{'model':db[_0x5b5c21[_0x9a0a('0xe')]],'as':_0x5b5c21['as'],'attributes':_0x5b5c21[_0x9a0a('0xa')],'include':_0x5b5c21[_0x9a0a('0xc')]?_['map'](_0x5b5c21[_0x9a0a('0xc')],function(_0x41163f){return{'model':db[_0x41163f[_0x9a0a('0xe')]],'as':_0x41163f['as'],'attributes':_0x41163f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c29f4){logger[_0x9a0a('0xf')](_0x9a0a('0x7'),_0x1f11d8);logger['debug'](_0x9a0a('0x7'),_0x1f11d8,JSON[_0x9a0a('0x10')](_0x4c29f4));_0x13a64b(_0x4c29f4);})[_0x9a0a('0x11')](function(_0x2068ad){logger[_0x9a0a('0x12')](_0x9a0a('0x7'),_0x2068ad['message'],_0x1f11d8);_0xa7fc60(_0x1e0dff[_0x9a0a('0x12')](0x1f4,_0x2068ad[_0x9a0a('0x13')]));});});};exports['ShowInterval']=function(_0x13b39b){var _0x367daa=this;return new Promise(function(_0x5659b4,_0x28a1e5){return db[_0x9a0a('0x8')][_0x9a0a('0x14')]({'raw':_0x13b39b[_0x9a0a('0x9')]?_0x13b39b[_0x9a0a('0x9')][_0x9a0a('0x15')]===undefined?!![]:![]:!![],'where':_0x13b39b[_0x9a0a('0x9')]?_0x13b39b[_0x9a0a('0x9')][_0x9a0a('0x16')]||null:null,'attributes':_0x13b39b[_0x9a0a('0x9')]?_0x13b39b[_0x9a0a('0x9')][_0x9a0a('0xa')]||null:null,'include':_0x13b39b[_0x9a0a('0x9')]?_0x13b39b[_0x9a0a('0x9')][_0x9a0a('0xc')]?_[_0x9a0a('0xd')](_0x13b39b[_0x9a0a('0x9')]['include'],function(_0x17f95f){return{'model':db[_0x17f95f[_0x9a0a('0xe')]],'as':_0x17f95f['as'],'attributes':_0x17f95f[_0x9a0a('0xa')],'include':_0x17f95f['include']?_[_0x9a0a('0xd')](_0x17f95f[_0x9a0a('0xc')],function(_0x2f4262){return{'model':db[_0x2f4262[_0x9a0a('0xe')]],'as':_0x2f4262['as'],'attributes':_0x2f4262[_0x9a0a('0xa')],'include':_0x2f4262[_0x9a0a('0xc')]?_[_0x9a0a('0xd')](_0x2f4262[_0x9a0a('0xc')],function(_0x3574a9){return{'model':db[_0x3574a9[_0x9a0a('0xe')]],'as':_0x3574a9['as'],'attributes':_0x3574a9[_0x9a0a('0xa')]};}):[]};}):[]};}):[]:[]})[_0x9a0a('0x17')](function(_0x2ad782){logger[_0x9a0a('0xf')](_0x9a0a('0x18'),_0x13b39b);logger[_0x9a0a('0x19')]('ShowInterval',_0x13b39b,JSON['stringify'](_0x2ad782));_0x5659b4(_0x2ad782);})[_0x9a0a('0x11')](function(_0x2fa8ae){logger[_0x9a0a('0x12')](_0x9a0a('0x18'),_0x2fa8ae[_0x9a0a('0x13')],_0x13b39b);_0x28a1e5(_0x367daa[_0x9a0a('0x12')](0x1f4,_0x2fa8ae[_0x9a0a('0x13')]));});});};function checkArrayOfIntervals(_0x3cb7b4,_0x3c2a0e){var _0x5b14b0=[];return db[_0x9a0a('0x8')][_0x9a0a('0x1a')]({'where':{'id':_0x3cb7b4}})['then'](function(_0x59a4b8){_0x5b14b0=_0x59a4b8;return Promise['all'](_0x5b14b0[_0x9a0a('0xd')](function(_0x412414){return _0x412414['ifTime'](_0x3c2a0e);}));})[_0x9a0a('0x17')](function(_0x3c9213){var _0x163f17=_0x3c9213[_0x9a0a('0x1b')](function(_0x44d140,_0x461610){return _0x44d140||_0x461610;},![]);logger[_0x9a0a('0xf')](util[_0x9a0a('0x1c')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x5b14b0[_0x9a0a('0xd')](function(_0x3e7a7c){return _0x3e7a7c[_0x9a0a('0x1d')];})[_0x9a0a('0x1e')](',\x20'),_0x5b14b0[_0x9a0a('0xd')](function(_0x4e093f){return _0x4e093f['id'];})[_0x9a0a('0x1e')](',\x20')));return _0x163f17;});}function checkSingleInterval(_0x4eec99,_0x24286b){return db[_0x9a0a('0x8')][_0x9a0a('0x1f')](_0x4eec99)[_0x9a0a('0x17')](function(_0x522a95){if(_0x522a95){logger[_0x9a0a('0xf')](util[_0x9a0a('0x1c')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x522a95[_0x9a0a('0x1d')],_0x522a95['id']));return _0x522a95['ifTime'](_0x24286b);}});}exports['IntervalIftime']=function(_0x377e0c){var _0x3b8130=_0x377e0c[_0x9a0a('0x20')];var _0x33af60=Array[_0x9a0a('0x21')](_0x377e0c[_0x9a0a('0x22')])?_0x377e0c[_0x9a0a('0x22')]:typeof _0x377e0c['intervals']===_0x9a0a('0x23')?[_0x377e0c[_0x9a0a('0x22')]]:[];var _0x1a4583=_0x377e0c['timezone']||undefined;var _0x5b0b5d=![];if(_0x33af60[_0x9a0a('0x24')]){logger[_0x9a0a('0xf')](util[_0x9a0a('0x1c')](_0x9a0a('0x25'),_0x33af60[_0x9a0a('0x1e')](';\x20')));}if(_0x1a4583){logger['info'](util[_0x9a0a('0x1c')](_0x9a0a('0x26'),_0x1a4583));}logger[_0x9a0a('0x19')](_0x9a0a('0x27'),_0x5b0b5d);logger['silly']('IntervalIftime',_0x377e0c);return Promise['resolve']()['then'](function(){if(Array[_0x9a0a('0x21')](_0x3b8130)){return checkArrayOfIntervals(_0x3b8130,_0x1a4583);}else if(_0x3b8130){return checkSingleInterval(_0x3b8130,_0x1a4583);}})['then'](function(_0x4022e5){var _0x4c5195=_0x33af60[_0x9a0a('0x1b')](function(_0x98ee18,_0x1a9b74){return _0x98ee18||iftime(_0x1a9b74,_0x1a4583);},![]);_0x5b0b5d=_0x4022e5||_0x4c5195;return _0x5b0b5d;})[_0x9a0a('0x11')](function(_0x2aee10){logger['error'](_0x9a0a('0x28'),_0x377e0c,_0x2aee10);throw this[_0x9a0a('0x12')](0x1f4,_0x2aee10[_0x9a0a('0x13')]);});}; \ No newline at end of file +var _0x5cb0=['attributes','limit','include','map','model','then','info','catch','message','error','ShowInterval','Interval','find','debug','stringify','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','lodash','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','findAll','options','raw','where'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x5cb0,0x165));var _0x05cb=function(_0x14ec2c,_0x161f21){_0x14ec2c=_0x14ec2c-0x0;var _0x4528dc=_0x5cb0[_0x14ec2c];return _0x4528dc;};'use strict';var _=require(_0x05cb('0x0'));var util=require('util');var db=require(_0x05cb('0x1'))['db'];var iftime=require(_0x05cb('0x2'))[_0x05cb('0x3')];var logger=require(_0x05cb('0x4'))(_0x05cb('0x5'));exports[_0x05cb('0x6')]=function(_0x3c6384){var _0x1b54aa=this;return new Promise(function(_0x97c134,_0x43fb55){return db['Interval'][_0x05cb('0x7')]({'raw':_0x3c6384[_0x05cb('0x8')]?_0x3c6384[_0x05cb('0x8')][_0x05cb('0x9')]===undefined?!![]:![]:!![],'where':_0x3c6384[_0x05cb('0x8')]?_0x3c6384[_0x05cb('0x8')][_0x05cb('0xa')]||null:null,'attributes':_0x3c6384['options']?_0x3c6384[_0x05cb('0x8')][_0x05cb('0xb')]||null:null,'limit':_0x3c6384[_0x05cb('0x8')]?_0x3c6384[_0x05cb('0x8')][_0x05cb('0xc')]||null:null,'include':_0x3c6384[_0x05cb('0x8')]?_0x3c6384[_0x05cb('0x8')][_0x05cb('0xd')]?_[_0x05cb('0xe')](_0x3c6384[_0x05cb('0x8')]['include'],function(_0x437332){return{'model':db[_0x437332[_0x05cb('0xf')]],'as':_0x437332['as'],'attributes':_0x437332[_0x05cb('0xb')],'include':_0x437332['include']?_[_0x05cb('0xe')](_0x437332['include'],function(_0x33d66c){return{'model':db[_0x33d66c['model']],'as':_0x33d66c['as'],'attributes':_0x33d66c[_0x05cb('0xb')],'include':_0x33d66c[_0x05cb('0xd')]?_[_0x05cb('0xe')](_0x33d66c[_0x05cb('0xd')],function(_0x5030c8){return{'model':db[_0x5030c8[_0x05cb('0xf')]],'as':_0x5030c8['as'],'attributes':_0x5030c8['attributes']};}):[]};}):[]};}):[]:[]})[_0x05cb('0x10')](function(_0x551262){logger[_0x05cb('0x11')](_0x05cb('0x6'),_0x3c6384);logger['debug'](_0x05cb('0x6'),_0x3c6384,JSON['stringify'](_0x551262));_0x97c134(_0x551262);})[_0x05cb('0x12')](function(_0x142240){logger['error'](_0x05cb('0x6'),_0x142240[_0x05cb('0x13')],_0x3c6384);_0x43fb55(_0x1b54aa[_0x05cb('0x14')](0x1f4,_0x142240[_0x05cb('0x13')]));});});};exports[_0x05cb('0x15')]=function(_0x553df1){var _0x1f3874=this;return new Promise(function(_0x3b7b2b,_0x52271c){return db[_0x05cb('0x16')][_0x05cb('0x17')]({'raw':_0x553df1[_0x05cb('0x8')]?_0x553df1[_0x05cb('0x8')][_0x05cb('0x9')]===undefined?!![]:![]:!![],'where':_0x553df1['options']?_0x553df1[_0x05cb('0x8')]['where']||null:null,'attributes':_0x553df1[_0x05cb('0x8')]?_0x553df1[_0x05cb('0x8')][_0x05cb('0xb')]||null:null,'include':_0x553df1[_0x05cb('0x8')]?_0x553df1[_0x05cb('0x8')][_0x05cb('0xd')]?_['map'](_0x553df1[_0x05cb('0x8')][_0x05cb('0xd')],function(_0x201e09){return{'model':db[_0x201e09[_0x05cb('0xf')]],'as':_0x201e09['as'],'attributes':_0x201e09[_0x05cb('0xb')],'include':_0x201e09[_0x05cb('0xd')]?_['map'](_0x201e09['include'],function(_0xa42d9e){return{'model':db[_0xa42d9e[_0x05cb('0xf')]],'as':_0xa42d9e['as'],'attributes':_0xa42d9e[_0x05cb('0xb')],'include':_0xa42d9e[_0x05cb('0xd')]?_[_0x05cb('0xe')](_0xa42d9e[_0x05cb('0xd')],function(_0x43b7a0){return{'model':db[_0x43b7a0['model']],'as':_0x43b7a0['as'],'attributes':_0x43b7a0[_0x05cb('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4febbf){logger['info'](_0x05cb('0x15'),_0x553df1);logger[_0x05cb('0x18')](_0x05cb('0x15'),_0x553df1,JSON[_0x05cb('0x19')](_0x4febbf));_0x3b7b2b(_0x4febbf);})[_0x05cb('0x12')](function(_0x3ad04f){logger[_0x05cb('0x14')](_0x05cb('0x15'),_0x3ad04f['message'],_0x553df1);_0x52271c(_0x1f3874[_0x05cb('0x14')](0x1f4,_0x3ad04f[_0x05cb('0x13')]));});});};function checkArrayOfIntervals(_0x4cdc75,_0x426dca){var _0x3d26eb=[];return db['Interval'][_0x05cb('0x7')]({'where':{'id':_0x4cdc75}})[_0x05cb('0x10')](function(_0x32a19e){_0x3d26eb=_0x32a19e;return Promise[_0x05cb('0x1a')](_0x3d26eb['map'](function(_0x350813){return _0x350813[_0x05cb('0x1b')](_0x426dca);}));})[_0x05cb('0x10')](function(_0x5ecc1f){var _0x1f5c5d=_0x5ecc1f['reduce'](function(_0x2cd500,_0x3252ca){return _0x2cd500||_0x3252ca;},![]);logger['info'](util[_0x05cb('0x1c')](_0x05cb('0x1d'),_0x3d26eb[_0x05cb('0xe')](function(_0x1bea09){return _0x1bea09['name'];})[_0x05cb('0x1e')](',\x20'),_0x3d26eb[_0x05cb('0xe')](function(_0x30aa61){return _0x30aa61['id'];})['join'](',\x20')));return _0x1f5c5d;});}function checkSingleInterval(_0x53e489,_0x4a3306){return db[_0x05cb('0x16')][_0x05cb('0x1f')](_0x53e489)[_0x05cb('0x10')](function(_0x5cfaa8){if(_0x5cfaa8){logger[_0x05cb('0x11')](util[_0x05cb('0x1c')](_0x05cb('0x20'),_0x5cfaa8[_0x05cb('0x21')],_0x5cfaa8['id']));return _0x5cfaa8[_0x05cb('0x1b')](_0x4a3306);}});}exports['IntervalIftime']=function(_0x222fe2){var _0x1d2b98=_0x222fe2[_0x05cb('0x22')];var _0x3cbfc1=Array[_0x05cb('0x23')](_0x222fe2[_0x05cb('0x24')])?_0x222fe2[_0x05cb('0x24')]:typeof _0x222fe2[_0x05cb('0x24')]===_0x05cb('0x25')?[_0x222fe2['intervals']]:[];var _0x4da5e4=_0x222fe2[_0x05cb('0x26')]||undefined;var _0x271443=![];if(_0x3cbfc1[_0x05cb('0x27')]){logger['info'](util['format'](_0x05cb('0x28'),_0x3cbfc1[_0x05cb('0x1e')](';\x20')));}if(_0x4da5e4){logger[_0x05cb('0x11')](util[_0x05cb('0x1c')](_0x05cb('0x29'),_0x4da5e4));}logger[_0x05cb('0x18')](_0x05cb('0x2a'),_0x271443);logger[_0x05cb('0x2b')](_0x05cb('0x2c'),_0x222fe2);return Promise[_0x05cb('0x2d')]()['then'](function(){if(Array[_0x05cb('0x23')](_0x1d2b98)){return checkArrayOfIntervals(_0x1d2b98,_0x4da5e4);}else if(_0x1d2b98){return checkSingleInterval(_0x1d2b98,_0x4da5e4);}})['then'](function(_0x1a5fb5){var _0x453649=_0x3cbfc1['reduce'](function(_0x5afb61,_0x6767df){return _0x5afb61||iftime(_0x6767df,_0x4da5e4);},![]);_0x271443=_0x1a5fb5||_0x453649;return _0x271443;})[_0x05cb('0x12')](function(_0x3fe519){logger[_0x05cb('0x14')]('IntervalIftime',_0x222fe2,_0x3fe519);throw this[_0x05cb('0x14')](0x1f4,_0x3fe519[_0x05cb('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 6e74b6d..ed63345 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x6c31a8,_0x417cb7){var _0x138b37=function(_0x24c8f1){while(--_0x24c8f1){_0x6c31a8['push'](_0x6c31a8['shift']());}};_0x138b37(++_0x417cb7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x12f053,_0x2e6dec){_0x12f053=_0x12f053-0x0;var _0x10510e=_0x5f2f[_0x12f053];return _0x10510e;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x271298,_0x5a7672){var _0x2865de=function(_0x264eaa){while(--_0x264eaa){_0x271298['push'](_0x271298['shift']());}};_0x2865de(++_0x5a7672);}(_0x2032,0xd9));var _0x2203=function(_0x5c392d,_0x34999c){_0x5c392d=_0x5c392d-0x0;var _0x81d3ba=_0x2032[_0x5c392d];return _0x81d3ba;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index d193723..5d40a29 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 _0x61d3=['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','send','body','headers','connection','socket','remoteAddress','bluebird','https','api','support','key','MOTGUI','\x20from\x20','description','stringify','Bug','fields','customfield_11500','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','base64','setEncoding'];(function(_0x7929d8,_0x8be119){var _0x40ff94=function(_0x48beda){while(--_0x48beda){_0x7929d8['push'](_0x7929d8['shift']());}};_0x40ff94(++_0x8be119);}(_0x61d3,0x1df));var _0x361d=function(_0x5dcb2f,_0x402ca3){_0x5dcb2f=_0x5dcb2f-0x0;var _0x2cf625=_0x61d3[_0x5dcb2f];return _0x2cf625;};'use strict';var BPromise=require(_0x361d('0x0'));var https=require(_0x361d('0x1'));var logger=require('../../config/logger')(_0x361d('0x2'));var USERNAME=_0x361d('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x3efa37,_0x5bc900){var _0x531abd={'fields':{'project':{'key':_0x3efa37[_0x361d('0x4')]||_0x361d('0x5')},'summary':(_0x3efa37['summary']||'Report')+_0x361d('0x6')+_0x3efa37['ip'],'description':_0x3efa37[_0x361d('0x7')]||JSON[_0x361d('0x8')](_0x3efa37),'issuetype':{'name':_0x3efa37['issuetype']||_0x361d('0x9')}}};_0x531abd[_0x361d('0xa')][_0x361d('0xb')]=_0x3efa37['email'];_0x531abd[_0x361d('0xa')][_0x361d('0xc')]=_0x3efa37[_0x361d('0xd')];_0x531abd[_0x361d('0xa')]['customfield_11502']=_0x3efa37[_0x361d('0xe')];_0x531abd[_0x361d('0xa')][_0x361d('0xf')]=_0x3efa37[_0x361d('0x10')];_0x531abd[_0x361d('0xa')][_0x361d('0x11')]=_0x3efa37[_0x361d('0x12')];_0x531abd[_0x361d('0xa')][_0x361d('0x13')]=_0x3efa37['ip'];var _0x2bcbc2={'host':_0x361d('0x14'),'port':0x1bb,'path':_0x361d('0x15'),'method':_0x361d('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x361d('0x17'))}};var _0x2c0905=JSON[_0x361d('0x8')](_0x531abd);var _0xb92a59=https['request'](_0x2bcbc2,function(_0x5bba08){_0x5bba08[_0x361d('0x18')](_0x361d('0x19'));var _0x2772ba='';_0x5bba08['on'](_0x361d('0x1a'),function(_0x52795c){_0x2772ba+=_0x52795c;});_0x5bba08['on'](_0x361d('0x1b'),function(){if(_0x5bc900){return _0x5bc900[_0x361d('0x1c')](_0x5bba08[_0x361d('0x1d')])[_0x361d('0x1e')](JSON[_0x361d('0x1f')](_0x2772ba));}});});_0xb92a59['on'](_0x361d('0x20'),function(_0x36da8b){if(_0x5bc900){return _0x5bc900[_0x361d('0x1c')](0x1f4)['json']({'errors':[{'message':_0x361d('0x21'),'type':_0x361d('0x22')}]});}});_0xb92a59[_0x361d('0x23')](_0x2c0905);_0xb92a59[_0x361d('0x1b')]();}exports['openIssue']=openIssue;exports[_0x361d('0x24')]=function(_0x59fce3,_0x45df6f){_0x59fce3[_0x361d('0x25')]['ip']=_0x59fce3[_0x361d('0x26')]['x-forwarded-for']||_0x59fce3[_0x361d('0x27')]['remoteAddress']||_0x59fce3[_0x361d('0x28')][_0x361d('0x29')]||_0x59fce3[_0x361d('0x27')][_0x361d('0x28')][_0x361d('0x29')];return openIssue(_0x59fce3['body'],_0x45df6f);}; \ No newline at end of file +var _0xf305=['customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','send','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','customfield_11500','email','fields','customfield_11501','oldToken','customfield_11502','newToken'];(function(_0x21a2b3,_0x5d6564){var _0x4651a7=function(_0x285f59){while(--_0x285f59){_0x21a2b3['push'](_0x21a2b3['shift']());}};_0x4651a7(++_0x5d6564);}(_0xf305,0x1e7));var _0x5f30=function(_0x1f2d5e,_0x3957e0){_0x1f2d5e=_0x1f2d5e-0x0;var _0x19207f=_0xf305[_0x1f2d5e];return _0x19207f;};'use strict';var BPromise=require(_0x5f30('0x0'));var https=require(_0x5f30('0x1'));var logger=require('../../config/logger')('api');var USERNAME=_0x5f30('0x2');var PASSWORD=_0x5f30('0x3');function openIssue(_0x2bc5a6,_0x5ca236){var _0x292184={'fields':{'project':{'key':_0x2bc5a6[_0x5f30('0x4')]||_0x5f30('0x5')},'summary':(_0x2bc5a6[_0x5f30('0x6')]||_0x5f30('0x7'))+_0x5f30('0x8')+_0x2bc5a6['ip'],'description':_0x2bc5a6[_0x5f30('0x9')]||JSON[_0x5f30('0xa')](_0x2bc5a6),'issuetype':{'name':_0x2bc5a6['issuetype']||_0x5f30('0xb')}}};_0x292184['fields'][_0x5f30('0xc')]=_0x2bc5a6[_0x5f30('0xd')];_0x292184[_0x5f30('0xe')][_0x5f30('0xf')]=_0x2bc5a6[_0x5f30('0x10')];_0x292184[_0x5f30('0xe')][_0x5f30('0x11')]=_0x2bc5a6[_0x5f30('0x12')];_0x292184[_0x5f30('0xe')][_0x5f30('0x13')]=_0x2bc5a6[_0x5f30('0x14')];_0x292184[_0x5f30('0xe')][_0x5f30('0x15')]=_0x2bc5a6['reason'];_0x292184[_0x5f30('0xe')][_0x5f30('0x16')]=_0x2bc5a6['ip'];var _0x4203c5={'host':_0x5f30('0x17'),'port':0x1bb,'path':_0x5f30('0x18'),'method':_0x5f30('0x19'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x5f30('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0x5f30('0x1b')](_0x5f30('0x1c'))}};var _0x30f4fd=JSON[_0x5f30('0xa')](_0x292184);var _0x5505d4=https[_0x5f30('0x1d')](_0x4203c5,function(_0x3ffc13){_0x3ffc13[_0x5f30('0x1e')](_0x5f30('0x1f'));var _0x2fd60b='';_0x3ffc13['on'](_0x5f30('0x20'),function(_0x45a663){_0x2fd60b+=_0x45a663;});_0x3ffc13['on'](_0x5f30('0x21'),function(){if(_0x5ca236){return _0x5ca236[_0x5f30('0x22')](_0x3ffc13[_0x5f30('0x23')])['json'](JSON[_0x5f30('0x24')](_0x2fd60b));}});});_0x5505d4['on'](_0x5f30('0x25'),function(_0x42ea36){if(_0x5ca236){return _0x5ca236[_0x5f30('0x22')](0x1f4)['json']({'errors':[{'message':_0x5f30('0x26'),'type':'api.jira'}]});}});_0x5505d4[_0x5f30('0x27')](_0x30f4fd);_0x5505d4[_0x5f30('0x21')]();}exports['openIssue']=openIssue;exports[_0x5f30('0x28')]=function(_0x4adf13,_0x512b16){_0x4adf13['body']['ip']=_0x4adf13[_0x5f30('0x29')][_0x5f30('0x2a')]||_0x4adf13[_0x5f30('0x2b')]['remoteAddress']||_0x4adf13[_0x5f30('0x2c')][_0x5f30('0x2d')]||_0x4adf13[_0x5f30('0x2b')][_0x5f30('0x2c')][_0x5f30('0x2d')];return openIssue(_0x4adf13['body'],_0x512b16);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 77ebb24..3d329d1 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 _0xbec5=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated'];(function(_0x20ee92,_0x230b53){var _0x28a012=function(_0x557da1){while(--_0x557da1){_0x20ee92['push'](_0x20ee92['shift']());}};_0x28a012(++_0x230b53);}(_0xbec5,0xe5));var _0x5bec=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0xbec5[_0x35fabd];return _0x61a8ee;};'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'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0x9')](_0x5bec('0xe'),auth[_0x5bec('0xc')](),controller['show']);router[_0x5bec('0xf')]('/',auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0x11')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);router[_0x5bec('0x13')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x14')]);module[_0x5bec('0x15')]=router; \ No newline at end of file +var _0xbec5=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated'];(function(_0x426c1f,_0x4ed582){var _0x281dd3=function(_0xc606ca){while(--_0xc606ca){_0x426c1f['push'](_0x426c1f['shift']());}};_0x281dd3(++_0x4ed582);}(_0xbec5,0xe5));var _0x5bec=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0xbec5[_0x12d951];return _0x44de17;};'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'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0x9')](_0x5bec('0xe'),auth[_0x5bec('0xc')](),controller['show']);router[_0x5bec('0xf')]('/',auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0x11')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);router[_0x5bec('0x13')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x14')]);module[_0x5bec('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 22dccf8..2f16ecf 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(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0xff0292,_0x361e04){_0xff0292=_0xff0292-0x0;var _0x573940=_0x7a54[_0xff0292];return _0x573940;};'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(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x7a54,0x106));var _0x47a5=function(_0x28cc32,_0x3e5443){_0x28cc32=_0x28cc32-0x0;var _0x3a4341=_0x7a54[_0x28cc32];return _0x3a4341;};'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 fe26647..8ecfdf0 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 _0x3c94=['then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x10baba,_0x4d446c){var _0x3c4758=function(_0x279700){while(--_0x279700){_0x10baba['push'](_0x10baba['shift']());}};_0x3c4758(++_0x4d446c);}(_0x3c94,0xcd));var _0x43c9=function(_0xcdac34,_0x43f665){_0xcdac34=_0xcdac34-0x0;var _0x269d23=_0x3c94[_0xcdac34];return _0x269d23;};'use strict';var emlformat=require(_0x43c9('0x0'));var rimraf=require(_0x43c9('0x1'));var zipdir=require(_0x43c9('0x2'));var jsonpatch=require(_0x43c9('0x3'));var rp=require(_0x43c9('0x4'));var moment=require(_0x43c9('0x5'));var BPromise=require(_0x43c9('0x6'));var Mustache=require(_0x43c9('0x7'));var util=require(_0x43c9('0x8'));var path=require(_0x43c9('0x9'));var sox=require(_0x43c9('0xa'));var csv=require(_0x43c9('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43c9('0xc'));var _=require(_0x43c9('0xd'));var squel=require(_0x43c9('0xe'));var crypto=require(_0x43c9('0xf'));var jsforce=require(_0x43c9('0x10'));var deskjs=require(_0x43c9('0x11'));var toCsv=require(_0x43c9('0xb'));var querystring=require(_0x43c9('0x12'));var Papa=require(_0x43c9('0x13'));var Redis=require('ioredis');var authService=require(_0x43c9('0x14'));var qs=require(_0x43c9('0x15'));var as=require(_0x43c9('0x16'));var hardwareService=require(_0x43c9('0x17'));var logger=require(_0x43c9('0x18'))(_0x43c9('0x19'));var utils=require(_0x43c9('0x1a'));var config=require(_0x43c9('0x1b'));var licenseUtil=require(_0x43c9('0x1c'));var db=require(_0x43c9('0x1d'))['db'];function respondWithStatusCode(_0x62bb3b,_0x31faa1){_0x31faa1=_0x31faa1||0xcc;return function(_0x11fe24){if(_0x11fe24){return _0x62bb3b[_0x43c9('0x1e')](_0x31faa1);}return _0x62bb3b[_0x43c9('0x1f')](_0x31faa1)[_0x43c9('0x20')]();};}function respondWithResult(_0x275b2b,_0x569fa9){_0x569fa9=_0x569fa9||0xc8;return function(_0x37932f){if(_0x37932f){return _0x275b2b[_0x43c9('0x1f')](_0x569fa9)[_0x43c9('0x21')](_0x37932f);}};}function respondWithFilteredResult(_0xe02707,_0x3f908d){return function(_0x5cc1fa){if(_0x5cc1fa){var _0x549d3f=typeof _0x3f908d[_0x43c9('0x22')]===_0x43c9('0x23')&&typeof _0x3f908d[_0x43c9('0x24')]===_0x43c9('0x23');var _0x501856=_0x5cc1fa[_0x43c9('0x25')];var _0x1da149=_0x549d3f?0x0:_0x3f908d[_0x43c9('0x22')];var _0x22bf3d=_0x549d3f?_0x5cc1fa[_0x43c9('0x25')]:_0x3f908d[_0x43c9('0x22')]+_0x3f908d[_0x43c9('0x24')];var _0x1e3996;if(_0x22bf3d>=_0x501856){_0x22bf3d=_0x501856;_0x1e3996=0xc8;}else{_0x1e3996=0xce;}_0xe02707[_0x43c9('0x1f')](_0x1e3996);return _0xe02707[_0x43c9('0x26')](_0x43c9('0x27'),_0x1da149+'-'+_0x22bf3d+'/'+_0x501856)['json'](_0x5cc1fa);}return null;};}function patchUpdates(_0x39c6f1){return function(_0x772b71){try{jsonpatch[_0x43c9('0x28')](_0x772b71,_0x39c6f1,!![]);}catch(_0x4c2d7c){return BPromise[_0x43c9('0x29')](_0x4c2d7c);}return _0x772b71[_0x43c9('0x2a')]();};}function saveUpdates(_0x2ef8d9,_0x5705c6){return function(_0x28290a){if(_0x28290a){return _0x28290a[_0x43c9('0x2b')](_0x2ef8d9)[_0x43c9('0x2c')](function(_0x4d58d7){return _0x4d58d7;});}return null;};}function removeEntity(_0x4963d2,_0x2a40f4){return function(_0x3fd641){if(_0x3fd641){return _0x3fd641[_0x43c9('0x2d')]()['then'](function(){_0x4963d2[_0x43c9('0x1f')](0xcc)[_0x43c9('0x20')]();});}};}function handleEntityNotFound(_0x1e676a,_0x16fee9){return function(_0x2c69af){if(!_0x2c69af){_0x1e676a['sendStatus'](0x194);}return _0x2c69af;};}function handleError(_0x386078,_0x3b5c47){_0x3b5c47=_0x3b5c47||0x1f4;return function(_0x3910af){logger[_0x43c9('0x2e')](_0x3910af[_0x43c9('0x2f')]);if(_0x3910af[_0x43c9('0x30')]){delete _0x3910af[_0x43c9('0x30')];}_0x386078[_0x43c9('0x1f')](_0x3b5c47)[_0x43c9('0x31')](_0x3910af);};}exports[_0x43c9('0x32')]=function(_0x4eb970,_0x11e3c3){var _0x2cbfd7={},_0x15028c={},_0x519e2c={'count':0x0,'rows':[]};var _0x2c0ccc=_[_0x43c9('0x33')](db['JscriptyAnswerReport'][_0x43c9('0x34')],function(_0x497719){return{'name':_0x497719[_0x43c9('0x35')],'type':_0x497719[_0x43c9('0x36')][_0x43c9('0x37')]};});_0x15028c[_0x43c9('0x38')]=_['map'](_0x2c0ccc,_0x43c9('0x30'));_0x15028c[_0x43c9('0x39')]=_[_0x43c9('0x3a')](_0x4eb970['query']);_0x15028c[_0x43c9('0x3b')]=_['intersection'](_0x15028c[_0x43c9('0x38')],_0x15028c[_0x43c9('0x39')]);_0x2cbfd7[_0x43c9('0x3c')]=_[_0x43c9('0x3d')](_0x15028c['model'],qs[_0x43c9('0x3e')](_0x4eb970[_0x43c9('0x39')][_0x43c9('0x3e')]));_0x2cbfd7[_0x43c9('0x3c')]=_0x2cbfd7['attributes'][_0x43c9('0x3f')]?_0x2cbfd7[_0x43c9('0x3c')]:_0x15028c[_0x43c9('0x38')];if(!_0x4eb970[_0x43c9('0x39')][_0x43c9('0x40')](_0x43c9('0x41'))){_0x2cbfd7[_0x43c9('0x24')]=qs[_0x43c9('0x24')](_0x4eb970['query'][_0x43c9('0x24')]);_0x2cbfd7[_0x43c9('0x22')]=qs[_0x43c9('0x22')](_0x4eb970[_0x43c9('0x39')][_0x43c9('0x22')]);}_0x2cbfd7[_0x43c9('0x42')]=qs[_0x43c9('0x43')](_0x4eb970[_0x43c9('0x39')][_0x43c9('0x43')]);_0x2cbfd7['where']=qs[_0x43c9('0x3b')](_['pick'](_0x4eb970[_0x43c9('0x39')],_0x15028c[_0x43c9('0x3b')]),_0x2c0ccc);if(_0x4eb970[_0x43c9('0x39')][_0x43c9('0x44')]){_0x2cbfd7[_0x43c9('0x45')]=_[_0x43c9('0x46')](_0x2cbfd7[_0x43c9('0x45')],{'$or':_[_0x43c9('0x33')](_0x2c0ccc,function(_0x518bd3){if(_0x518bd3['type']!==_0x43c9('0x47')){var _0x2d63bd={};_0x2d63bd[_0x518bd3['name']]={'$like':'%'+_0x4eb970[_0x43c9('0x39')][_0x43c9('0x44')]+'%'};return _0x2d63bd;}})});}_0x2cbfd7=_[_0x43c9('0x46')]({},_0x2cbfd7,_0x4eb970['options']);var _0xb01a6e={'where':_0x2cbfd7[_0x43c9('0x45')]};return db[_0x43c9('0x48')][_0x43c9('0x25')](_0xb01a6e)[_0x43c9('0x2c')](function(_0x39601e){_0x519e2c[_0x43c9('0x25')]=_0x39601e;if(_0x4eb970[_0x43c9('0x39')][_0x43c9('0x49')]){_0x2cbfd7[_0x43c9('0x4a')]=[{'all':!![]}];}return db[_0x43c9('0x48')][_0x43c9('0x4b')](_0x2cbfd7);})['then'](function(_0x2d5dd5){_0x519e2c[_0x43c9('0x4c')]=_0x2d5dd5;return _0x519e2c;})[_0x43c9('0x2c')](respondWithFilteredResult(_0x11e3c3,_0x2cbfd7))[_0x43c9('0x4d')](handleError(_0x11e3c3,null));};exports['show']=function(_0xff891d,_0x66cac9){var _0x5ce14f={'raw':!![],'where':{'id':_0xff891d[_0x43c9('0x4e')]['id']}},_0x2a8f7d={};_0x2a8f7d[_0x43c9('0x38')]=_[_0x43c9('0x3a')](db[_0x43c9('0x48')][_0x43c9('0x34')]);_0x2a8f7d[_0x43c9('0x39')]=_[_0x43c9('0x3a')](_0xff891d[_0x43c9('0x39')]);_0x2a8f7d['filters']=_[_0x43c9('0x3d')](_0x2a8f7d['model'],_0x2a8f7d[_0x43c9('0x39')]);_0x5ce14f[_0x43c9('0x3c')]=_[_0x43c9('0x3d')](_0x2a8f7d[_0x43c9('0x38')],qs['fields'](_0xff891d[_0x43c9('0x39')][_0x43c9('0x3e')]));_0x5ce14f['attributes']=_0x5ce14f[_0x43c9('0x3c')][_0x43c9('0x3f')]?_0x5ce14f['attributes']:_0x2a8f7d[_0x43c9('0x38')];if(_0xff891d[_0x43c9('0x39')][_0x43c9('0x49')]){_0x5ce14f['include']=[{'all':!![]}];}_0x5ce14f=_[_0x43c9('0x46')]({},_0x5ce14f,_0xff891d['options']);return db['JscriptyAnswerReport'][_0x43c9('0x4f')](_0x5ce14f)[_0x43c9('0x2c')](handleEntityNotFound(_0x66cac9,null))[_0x43c9('0x2c')](respondWithResult(_0x66cac9,null))[_0x43c9('0x4d')](handleError(_0x66cac9,null));};exports[_0x43c9('0x50')]=function(_0x28fe5d,_0x1f966e){return db[_0x43c9('0x48')][_0x43c9('0x50')](_0x28fe5d[_0x43c9('0x51')],{})[_0x43c9('0x2c')](respondWithResult(_0x1f966e,0xc9))[_0x43c9('0x4d')](handleError(_0x1f966e,null));};exports[_0x43c9('0x2b')]=function(_0x5082e9,_0xc57086){if(_0x5082e9[_0x43c9('0x51')]['id']){delete _0x5082e9['body']['id'];}return db[_0x43c9('0x48')][_0x43c9('0x4f')]({'where':{'id':_0x5082e9[_0x43c9('0x4e')]['id']}})[_0x43c9('0x2c')](handleEntityNotFound(_0xc57086,null))[_0x43c9('0x2c')](saveUpdates(_0x5082e9[_0x43c9('0x51')],null))[_0x43c9('0x2c')](respondWithResult(_0xc57086,null))[_0x43c9('0x4d')](handleError(_0xc57086,null));};exports[_0x43c9('0x2d')]=function(_0x508b62,_0x27db89){return db[_0x43c9('0x48')][_0x43c9('0x4f')]({'where':{'id':_0x508b62[_0x43c9('0x4e')]['id']}})[_0x43c9('0x2c')](handleEntityNotFound(_0x27db89,null))[_0x43c9('0x2c')](removeEntity(_0x27db89,null))['catch'](handleError(_0x27db89,null));};exports[_0x43c9('0x52')]=function(_0x1bc3b5,_0x3aff2e){return db[_0x43c9('0x48')][_0x43c9('0x52')]()[_0x43c9('0x2c')](respondWithResult(_0x3aff2e,null))[_0x43c9('0x4d')](handleError(_0x3aff2e,null));}; \ No newline at end of file +var _0x6075=['end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','JscriptyAnswerReport','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x1fc6c4,_0x4316d3){var _0x340866=function(_0x4eea9a){while(--_0x4eea9a){_0x1fc6c4['push'](_0x1fc6c4['shift']());}};_0x340866(++_0x4316d3);}(_0x6075,0x191));var _0x5607=function(_0x51c392,_0x414ce6){_0x51c392=_0x51c392-0x0;var _0x3da072=_0x6075[_0x51c392];return _0x3da072;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5607('0x0'));var zipdir=require(_0x5607('0x1'));var jsonpatch=require(_0x5607('0x2'));var rp=require(_0x5607('0x3'));var moment=require(_0x5607('0x4'));var BPromise=require(_0x5607('0x5'));var Mustache=require(_0x5607('0x6'));var util=require(_0x5607('0x7'));var path=require(_0x5607('0x8'));var sox=require('sox');var csv=require(_0x5607('0x9'));var ejs=require(_0x5607('0xa'));var fs=require('fs');var fs_extra=require(_0x5607('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5607('0xc'));var jsforce=require(_0x5607('0xd'));var deskjs=require(_0x5607('0xe'));var toCsv=require(_0x5607('0x9'));var querystring=require(_0x5607('0xf'));var Papa=require('papaparse');var Redis=require(_0x5607('0x10'));var authService=require(_0x5607('0x11'));var qs=require(_0x5607('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5607('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5607('0x14'));var config=require(_0x5607('0x15'));var licenseUtil=require(_0x5607('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c8013,_0x42a405){_0x42a405=_0x42a405||0xcc;return function(_0xc534bd){if(_0xc534bd){return _0x2c8013[_0x5607('0x17')](_0x42a405);}return _0x2c8013[_0x5607('0x18')](_0x42a405)[_0x5607('0x19')]();};}function respondWithResult(_0x138d74,_0x1c8cbc){_0x1c8cbc=_0x1c8cbc||0xc8;return function(_0x2daf4c){if(_0x2daf4c){return _0x138d74['status'](_0x1c8cbc)[_0x5607('0x1a')](_0x2daf4c);}};}function respondWithFilteredResult(_0x275c5d,_0xe3e004){return function(_0x505b12){if(_0x505b12){var _0x556397=typeof _0xe3e004[_0x5607('0x1b')]==='undefined'&&typeof _0xe3e004[_0x5607('0x1c')]===_0x5607('0x1d');var _0x1fa238=_0x505b12[_0x5607('0x1e')];var _0x3eaaa0=_0x556397?0x0:_0xe3e004[_0x5607('0x1b')];var _0x55689e=_0x556397?_0x505b12[_0x5607('0x1e')]:_0xe3e004['offset']+_0xe3e004[_0x5607('0x1c')];var _0x3e071b;if(_0x55689e>=_0x1fa238){_0x55689e=_0x1fa238;_0x3e071b=0xc8;}else{_0x3e071b=0xce;}_0x275c5d[_0x5607('0x18')](_0x3e071b);return _0x275c5d['set'](_0x5607('0x1f'),_0x3eaaa0+'-'+_0x55689e+'/'+_0x1fa238)[_0x5607('0x1a')](_0x505b12);}return null;};}function patchUpdates(_0x303089){return function(_0x4e66f0){try{jsonpatch[_0x5607('0x20')](_0x4e66f0,_0x303089,!![]);}catch(_0x2fdc13){return BPromise[_0x5607('0x21')](_0x2fdc13);}return _0x4e66f0['save']();};}function saveUpdates(_0x44f7a2,_0x4feb1c){return function(_0x49f918){if(_0x49f918){return _0x49f918[_0x5607('0x22')](_0x44f7a2)[_0x5607('0x23')](function(_0x32d30a){return _0x32d30a;});}return null;};}function removeEntity(_0x2d983f,_0x351c32){return function(_0x34df69){if(_0x34df69){return _0x34df69[_0x5607('0x24')]()[_0x5607('0x23')](function(){_0x2d983f[_0x5607('0x18')](0xcc)[_0x5607('0x19')]();});}};}function handleEntityNotFound(_0x593df7,_0x20ae60){return function(_0x27e144){if(!_0x27e144){_0x593df7['sendStatus'](0x194);}return _0x27e144;};}function handleError(_0xa83081,_0x14dd08){_0x14dd08=_0x14dd08||0x1f4;return function(_0xdb07c8){logger[_0x5607('0x25')](_0xdb07c8[_0x5607('0x26')]);if(_0xdb07c8[_0x5607('0x27')]){delete _0xdb07c8[_0x5607('0x27')];}_0xa83081[_0x5607('0x18')](_0x14dd08)['send'](_0xdb07c8);};}exports[_0x5607('0x28')]=function(_0x309ede,_0x51b7d5){var _0x5932ae={},_0x12f58f={},_0x40f20e={'count':0x0,'rows':[]};var _0xe8788=_[_0x5607('0x29')](db[_0x5607('0x2a')]['rawAttributes'],function(_0x2575c3){return{'name':_0x2575c3['fieldName'],'type':_0x2575c3[_0x5607('0x2b')][_0x5607('0x2c')]};});_0x12f58f[_0x5607('0x2d')]=_['map'](_0xe8788,_0x5607('0x27'));_0x12f58f['query']=_[_0x5607('0x2e')](_0x309ede[_0x5607('0x2f')]);_0x12f58f[_0x5607('0x30')]=_[_0x5607('0x31')](_0x12f58f[_0x5607('0x2d')],_0x12f58f['query']);_0x5932ae[_0x5607('0x32')]=_['intersection'](_0x12f58f[_0x5607('0x2d')],qs[_0x5607('0x33')](_0x309ede['query'][_0x5607('0x33')]));_0x5932ae[_0x5607('0x32')]=_0x5932ae[_0x5607('0x32')]['length']?_0x5932ae[_0x5607('0x32')]:_0x12f58f[_0x5607('0x2d')];if(!_0x309ede[_0x5607('0x2f')][_0x5607('0x34')]('nolimit')){_0x5932ae[_0x5607('0x1c')]=qs[_0x5607('0x1c')](_0x309ede['query'][_0x5607('0x1c')]);_0x5932ae[_0x5607('0x1b')]=qs[_0x5607('0x1b')](_0x309ede['query'][_0x5607('0x1b')]);}_0x5932ae['order']=qs[_0x5607('0x35')](_0x309ede[_0x5607('0x2f')][_0x5607('0x35')]);_0x5932ae['where']=qs['filters'](_['pick'](_0x309ede[_0x5607('0x2f')],_0x12f58f[_0x5607('0x30')]),_0xe8788);if(_0x309ede[_0x5607('0x2f')][_0x5607('0x36')]){_0x5932ae[_0x5607('0x37')]=_[_0x5607('0x38')](_0x5932ae[_0x5607('0x37')],{'$or':_[_0x5607('0x29')](_0xe8788,function(_0x54cc53){if(_0x54cc53[_0x5607('0x2b')]!==_0x5607('0x39')){var _0x1671f0={};_0x1671f0[_0x54cc53[_0x5607('0x27')]]={'$like':'%'+_0x309ede['query'][_0x5607('0x36')]+'%'};return _0x1671f0;}})});}_0x5932ae=_[_0x5607('0x38')]({},_0x5932ae,_0x309ede['options']);var _0x4a5cef={'where':_0x5932ae[_0x5607('0x37')]};return db[_0x5607('0x2a')][_0x5607('0x1e')](_0x4a5cef)['then'](function(_0x562fa6){_0x40f20e['count']=_0x562fa6;if(_0x309ede[_0x5607('0x2f')][_0x5607('0x3a')]){_0x5932ae[_0x5607('0x3b')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x5607('0x3c')](_0x5932ae);})[_0x5607('0x23')](function(_0x458e15){_0x40f20e[_0x5607('0x3d')]=_0x458e15;return _0x40f20e;})[_0x5607('0x23')](respondWithFilteredResult(_0x51b7d5,_0x5932ae))[_0x5607('0x3e')](handleError(_0x51b7d5,null));};exports[_0x5607('0x3f')]=function(_0x5058b5,_0x57be05){var _0x2b34b4={'raw':!![],'where':{'id':_0x5058b5[_0x5607('0x40')]['id']}},_0x3b8397={};_0x3b8397['model']=_[_0x5607('0x2e')](db[_0x5607('0x2a')]['rawAttributes']);_0x3b8397[_0x5607('0x2f')]=_[_0x5607('0x2e')](_0x5058b5['query']);_0x3b8397['filters']=_[_0x5607('0x31')](_0x3b8397[_0x5607('0x2d')],_0x3b8397[_0x5607('0x2f')]);_0x2b34b4['attributes']=_[_0x5607('0x31')](_0x3b8397[_0x5607('0x2d')],qs['fields'](_0x5058b5[_0x5607('0x2f')][_0x5607('0x33')]));_0x2b34b4['attributes']=_0x2b34b4[_0x5607('0x32')][_0x5607('0x41')]?_0x2b34b4[_0x5607('0x32')]:_0x3b8397['model'];if(_0x5058b5[_0x5607('0x2f')][_0x5607('0x3a')]){_0x2b34b4[_0x5607('0x3b')]=[{'all':!![]}];}_0x2b34b4=_[_0x5607('0x38')]({},_0x2b34b4,_0x5058b5[_0x5607('0x42')]);return db['JscriptyAnswerReport'][_0x5607('0x43')](_0x2b34b4)[_0x5607('0x23')](handleEntityNotFound(_0x57be05,null))[_0x5607('0x23')](respondWithResult(_0x57be05,null))[_0x5607('0x3e')](handleError(_0x57be05,null));};exports[_0x5607('0x44')]=function(_0x51c1fc,_0x1a5483){return db['JscriptyAnswerReport'][_0x5607('0x44')](_0x51c1fc[_0x5607('0x45')],{})[_0x5607('0x23')](respondWithResult(_0x1a5483,0xc9))[_0x5607('0x3e')](handleError(_0x1a5483,null));};exports[_0x5607('0x22')]=function(_0x416060,_0x4a904b){if(_0x416060['body']['id']){delete _0x416060['body']['id'];}return db[_0x5607('0x2a')][_0x5607('0x43')]({'where':{'id':_0x416060['params']['id']}})[_0x5607('0x23')](handleEntityNotFound(_0x4a904b,null))[_0x5607('0x23')](saveUpdates(_0x416060[_0x5607('0x45')],null))[_0x5607('0x23')](respondWithResult(_0x4a904b,null))[_0x5607('0x3e')](handleError(_0x4a904b,null));};exports[_0x5607('0x24')]=function(_0xccd4f5,_0xf554a0){return db[_0x5607('0x2a')][_0x5607('0x43')]({'where':{'id':_0xccd4f5[_0x5607('0x40')]['id']}})[_0x5607('0x23')](handleEntityNotFound(_0xf554a0,null))[_0x5607('0x23')](removeEntity(_0xf554a0,null))[_0x5607('0x3e')](handleError(_0xf554a0,null));};exports[_0x5607('0x46')]=function(_0x3edc1d,_0x2955e8){return db['JscriptyAnswerReport'][_0x5607('0x46')]()['then'](respondWithResult(_0x2955e8,null))[_0x5607('0x3e')](handleError(_0x2955e8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index f2e3fdf..ea969d8 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 _0xbde0=['request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','util','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbde0,0x163));var _0x0bde=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xbde0[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x0bde('0x0'));var util=require(_0x0bde('0x1'));var logger=require(_0x0bde('0x2'))(_0x0bde('0x3'));var moment=require(_0x0bde('0x4'));var BPromise=require('bluebird');var rp=require(_0x0bde('0x5'));var fs=require('fs');var path=require(_0x0bde('0x6'));var rimraf=require(_0x0bde('0x7'));var config=require('../../config/environment');var attributes=require(_0x0bde('0x8'));module[_0x0bde('0x9')]=function(_0x369a34,_0x1724cf){return _0x369a34[_0x0bde('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0x0bde('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f03=['define','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x403b08,_0x27b863){var _0x38dde9=function(_0x2627d2){while(--_0x2627d2){_0x403b08['push'](_0x403b08['shift']());}};_0x38dde9(++_0x27b863);}(_0x7f03,0x1c9));var _0x37f0=function(_0x217c5e,_0x116ad4){_0x217c5e=_0x217c5e-0x0;var _0x412bd2=_0x7f03[_0x217c5e];return _0x412bd2;};'use strict';var _=require(_0x37f0('0x0'));var util=require(_0x37f0('0x1'));var logger=require(_0x37f0('0x2'))(_0x37f0('0x3'));var moment=require(_0x37f0('0x4'));var BPromise=require(_0x37f0('0x5'));var rp=require(_0x37f0('0x6'));var fs=require('fs');var path=require(_0x37f0('0x7'));var rimraf=require(_0x37f0('0x8'));var config=require(_0x37f0('0x9'));var attributes=require(_0x37f0('0xa'));module['exports']=function(_0xa78afc,_0x4b9ad5){return _0xa78afc[_0x37f0('0xb')]('JscriptyAnswerReport',attributes,{'tableName':_0x37f0('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 93571b6..8b19ada 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 _0x57e1=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x29e4ce,_0x1dac8e){var _0x52a7e4=function(_0x46c4db){while(--_0x46c4db){_0x29e4ce['push'](_0x29e4ce['shift']());}};_0x52a7e4(++_0x1dac8e);}(_0x57e1,0x17a));var _0x157e=function(_0x4a57b0,_0x3ee928){_0x4a57b0=_0x4a57b0-0x0;var _0x5e82c8=_0x57e1[_0x4a57b0];return _0x5e82c8;};'use strict';var _=require(_0x157e('0x0'));var util=require(_0x157e('0x1'));var moment=require('moment');var BPromise=require(_0x157e('0x2'));var rs=require(_0x157e('0x3'));var fs=require('fs');var Redis=require(_0x157e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x157e('0x5'));var logger=require(_0x157e('0x6'))(_0x157e('0x7'));var config=require(_0x157e('0x8'));var jayson=require(_0x157e('0x9'));var client=jayson[_0x157e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b484c,_0x486774,_0x3161c4){return new BPromise(function(_0x310390,_0x1b16f8){return client[_0x157e('0xb')](_0x2b484c,_0x3161c4)['then'](function(_0x4f87cc){logger['info'](_0x157e('0xc'),_0x486774,_0x157e('0xd'));logger['debug'](_0x157e('0xe'),_0x486774,_0x157e('0xd'),JSON['stringify'](_0x4f87cc));if(_0x4f87cc[_0x157e('0xf')]){if(_0x4f87cc[_0x157e('0xf')][_0x157e('0x10')]===0x1f4){logger[_0x157e('0xf')](_0x157e('0xc'),_0x486774,_0x4f87cc[_0x157e('0xf')][_0x157e('0x11')]);return _0x1b16f8(_0x4f87cc['error'][_0x157e('0x11')]);}logger[_0x157e('0xf')](_0x157e('0xc'),_0x486774,_0x4f87cc[_0x157e('0xf')]['message']);return _0x310390(_0x4f87cc['error'][_0x157e('0x11')]);}else{logger['info'](_0x157e('0xc'),_0x486774,'request\x20sent');_0x310390(_0x4f87cc['result'][_0x157e('0x11')]);}})['catch'](function(_0x3a679f){logger['error'](_0x157e('0xc'),_0x486774,_0x3a679f);_0x1b16f8(_0x3a679f);});});} \ No newline at end of file +var _0xcd7e=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug'];(function(_0x42ede8,_0x56d227){var _0x28e0f2=function(_0x26db9b){while(--_0x26db9b){_0x42ede8['push'](_0x42ede8['shift']());}};_0x28e0f2(++_0x56d227);}(_0xcd7e,0x14a));var _0xecd7=function(_0xd02def,_0x144f25){_0xd02def=_0xd02def-0x0;var _0x2e8374=_0xcd7e[_0xd02def];return _0x2e8374;};'use strict';var _=require('lodash');var util=require(_0xecd7('0x0'));var moment=require(_0xecd7('0x1'));var BPromise=require(_0xecd7('0x2'));var rs=require(_0xecd7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xecd7('0x4'))['db'];var utils=require(_0xecd7('0x5'));var logger=require(_0xecd7('0x6'))(_0xecd7('0x7'));var config=require(_0xecd7('0x8'));var jayson=require(_0xecd7('0x9'));var client=jayson['client'][_0xecd7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38e732,_0x14acd4,_0x29bbe2){return new BPromise(function(_0x6d633d,_0x1e1300){return client[_0xecd7('0xb')](_0x38e732,_0x29bbe2)['then'](function(_0x30df8e){logger[_0xecd7('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x14acd4,_0xecd7('0xd'));logger[_0xecd7('0xe')](_0xecd7('0xf'),_0x14acd4,_0xecd7('0xd'),JSON[_0xecd7('0x10')](_0x30df8e));if(_0x30df8e[_0xecd7('0x11')]){if(_0x30df8e[_0xecd7('0x11')][_0xecd7('0x12')]===0x1f4){logger[_0xecd7('0x11')](_0xecd7('0x13'),_0x14acd4,_0x30df8e['error'][_0xecd7('0x14')]);return _0x1e1300(_0x30df8e['error'][_0xecd7('0x14')]);}logger[_0xecd7('0x11')](_0xecd7('0x13'),_0x14acd4,_0x30df8e[_0xecd7('0x11')]['message']);return _0x6d633d(_0x30df8e[_0xecd7('0x11')]['message']);}else{logger['info'](_0xecd7('0x13'),_0x14acd4,_0xecd7('0xd'));_0x6d633d(_0x30df8e[_0xecd7('0x15')]['message']);}})[_0xecd7('0x16')](function(_0x4bdfde){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x14acd4,_0x4bdfde);_0x1e1300(_0x4bdfde);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 9d4adf7..0b76fdd 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 _0xbed7=['/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/sessions','getSessions'];(function(_0x2cfcc9,_0x503514){var _0x5e5e1f=function(_0x3b837a){while(--_0x3b837a){_0x2cfcc9['push'](_0x2cfcc9['shift']());}};_0x5e5e1f(++_0x503514);}(_0xbed7,0xed));var _0x7bed=function(_0x29526f,_0x51eaa1){_0x29526f=_0x29526f-0x0;var _0x442942=_0xbed7[_0x29526f];return _0x442942;};'use strict';var multer=require(_0x7bed('0x0'));var util=require(_0x7bed('0x1'));var path=require(_0x7bed('0x2'));var timeout=require(_0x7bed('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7bed('0x4'));var auth=require(_0x7bed('0x5'));var interaction=require(_0x7bed('0x6'));var config=require(_0x7bed('0x7'));var controller=require('./jscriptyProject.controller');router[_0x7bed('0x8')]('/',auth[_0x7bed('0x9')](),controller['index']);router[_0x7bed('0x8')](_0x7bed('0xa'),auth[_0x7bed('0x9')](),controller['show']);router[_0x7bed('0x8')](_0x7bed('0xb'),auth['isAuthenticated'](),controller[_0x7bed('0xc')]);router[_0x7bed('0x8')](_0x7bed('0xd'),auth['isAuthenticated'](),controller[_0x7bed('0xe')]);router[_0x7bed('0x8')](_0x7bed('0xf'),auth[_0x7bed('0x9')](),timeout(_0x7bed('0x10')),controller[_0x7bed('0x11')]);router[_0x7bed('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/clone',auth[_0x7bed('0x9')](),controller[_0x7bed('0x13')]);router[_0x7bed('0x14')](_0x7bed('0xa'),auth['isAuthenticated'](),controller[_0x7bed('0x15')]);router[_0x7bed('0x16')](_0x7bed('0xa'),auth[_0x7bed('0x9')](),controller[_0x7bed('0x17')]);module[_0x7bed('0x18')]=router; \ No newline at end of file +var _0x04c3=['update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','/:id/clone','put'];(function(_0x3512c3,_0x346843){var _0x3b2842=function(_0x49341b){while(--_0x49341b){_0x3512c3['push'](_0x3512c3['shift']());}};_0x3b2842(++_0x346843);}(_0x04c3,0x163));var _0x304c=function(_0x219749,_0x3d4cf1){_0x219749=_0x219749-0x0;var _0x315ce0=_0x04c3[_0x219749];return _0x315ce0;};'use strict';var multer=require(_0x304c('0x0'));var util=require(_0x304c('0x1'));var path=require(_0x304c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x304c('0x3')]();var fs_extra=require(_0x304c('0x4'));var auth=require(_0x304c('0x5'));var interaction=require(_0x304c('0x6'));var config=require(_0x304c('0x7'));var controller=require(_0x304c('0x8'));router[_0x304c('0x9')]('/',auth[_0x304c('0xa')](),controller[_0x304c('0xb')]);router[_0x304c('0x9')](_0x304c('0xc'),auth[_0x304c('0xa')](),controller[_0x304c('0xd')]);router[_0x304c('0x9')](_0x304c('0xe'),auth[_0x304c('0xa')](),controller[_0x304c('0xf')]);router['get'](_0x304c('0x10'),auth[_0x304c('0xa')](),controller[_0x304c('0x11')]);router[_0x304c('0x9')]('/:id/summary',auth[_0x304c('0xa')](),timeout(_0x304c('0x12')),controller[_0x304c('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x304c('0x14')](_0x304c('0x15'),auth[_0x304c('0xa')](),controller['clone']);router[_0x304c('0x16')]('/:id',auth[_0x304c('0xa')](),controller[_0x304c('0x17')]);router[_0x304c('0x18')]('/:id',auth[_0x304c('0xa')](),controller[_0x304c('0x19')]);module[_0x304c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 3c28300..b9780ed 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 _0xf645=['description','BOOLEAN','sequelize','lodash','util','STRING','TEXT','long','setDataValue','formData','stringify','isString','getDataValue','name'];(function(_0x817cf5,_0x329b83){var _0x1a7fb7=function(_0x4bef6b){while(--_0x4bef6b){_0x817cf5['push'](_0x817cf5['shift']());}};_0x1a7fb7(++_0x329b83);}(_0xf645,0x1d0));var _0x5f64=function(_0x3fb947,_0x162636){_0x3fb947=_0x3fb947-0x0;var _0x2ced66=_0xf645[_0x3fb947];return _0x2ced66;};'use strict';var Sequelize=require(_0x5f64('0x0'));var _=require(_0x5f64('0x1'));var util=require(_0x5f64('0x2'));module['exports']={'name':{'type':Sequelize[_0x5f64('0x3')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x5f64('0x4')](_0x5f64('0x5')),'set':function(_0xe98f2c){if(_['isObjectLike'](_0xe98f2c)){this[_0x5f64('0x6')](_0x5f64('0x7'),JSON[_0x5f64('0x8')](_0xe98f2c));}else if(_[_0x5f64('0x9')](_0xe98f2c)){this['setDataValue']('formData',_0xe98f2c);}else{this[_0x5f64('0x6')](_0x5f64('0x7'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x5f64('0xa')](_0x5f64('0xb'))||'',this[_0x5f64('0xa')](_0x5f64('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x5f64('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x5f64('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x9364=['isString','setDataValue','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','stringify'];(function(_0x5ebec4,_0x474731){var _0x3b9d3b=function(_0x3aa9da){while(--_0x3aa9da){_0x5ebec4['push'](_0x5ebec4['shift']());}};_0x3b9d3b(++_0x474731);}(_0x9364,0x9c));var _0x4936=function(_0x3583be,_0x3d9157){_0x3583be=_0x3583be-0x0;var _0x3f8800=_0x9364[_0x3583be];return _0x3f8800;};'use strict';var Sequelize=require(_0x4936('0x0'));var _=require(_0x4936('0x1'));var util=require(_0x4936('0x2'));module[_0x4936('0x3')]={'name':{'type':Sequelize[_0x4936('0x4')],'unique':_0x4936('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x4936('0x6')](_0x4936('0x7')),'set':function(_0x105f5f){if(_['isObjectLike'](_0x105f5f)){this['setDataValue']('formData',JSON[_0x4936('0x8')](_0x105f5f));}else if(_[_0x4936('0x9')](_0x105f5f)){this[_0x4936('0xa')]('formData',_0x105f5f);}else{this[_0x4936('0xa')]('formData',util['format'](_0x4936('0xb'),this[_0x4936('0xc')](_0x4936('0x5'))||'',this[_0x4936('0xc')](_0x4936('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x4936('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x4936('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 0e032fd..5faa5be 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 _0xf8ff=['map','query','keys','intersection','attributes','model','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','get','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','userProfileId','getSessions','findOne','JscriptySessionReport','nolimit','ProjectId','JscriptyAnswerReport','hasOwnProperty','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','/tmp/Jscripty_Project_%d_Summary_%s.csv','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','Projects','error','stack','name','index','JscriptyProject','fieldName','key'];(function(_0xd4ed2e,_0x7471ed){var _0x1fd436=function(_0x5a5ab1){while(--_0x5a5ab1){_0xd4ed2e['push'](_0xd4ed2e['shift']());}};_0x1fd436(++_0x7471ed);}(_0xf8ff,0x127));var _0xff8f=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0xf8ff[_0x1ac120];return _0x19b703;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xff8f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff8f('0x1'));var moment=require(_0xff8f('0x2'));var BPromise=require(_0xff8f('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xff8f('0x4'));var sox=require('sox');var csv=require(_0xff8f('0x5'));var ejs=require(_0xff8f('0x6'));var fs=require('fs');var fs_extra=require(_0xff8f('0x7'));var _=require('lodash');var squel=require(_0xff8f('0x8'));var crypto=require(_0xff8f('0x9'));var jsforce=require(_0xff8f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xff8f('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xff8f('0xb'));var authService=require(_0xff8f('0xc'));var qs=require(_0xff8f('0xd'));var as=require(_0xff8f('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff8f('0xf'))(_0xff8f('0x10'));var utils=require(_0xff8f('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xff8f('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8de29e,_0x41b45f){_0x41b45f=_0x41b45f||0xcc;return function(_0x99791b){if(_0x99791b){return _0x8de29e[_0xff8f('0x13')](_0x41b45f);}return _0x8de29e[_0xff8f('0x14')](_0x41b45f)[_0xff8f('0x15')]();};}function respondWithResult(_0x5af7da,_0x27ea91){_0x27ea91=_0x27ea91||0xc8;return function(_0x2b9cd1){if(_0x2b9cd1){return _0x5af7da['status'](_0x27ea91)['json'](_0x2b9cd1);}};}function respondWithFilteredResult(_0xb45836,_0x59e2a8){return function(_0x159441){if(_0x159441){var _0x55d2d3=typeof _0x59e2a8[_0xff8f('0x16')]==='undefined'&&typeof _0x59e2a8[_0xff8f('0x17')]===_0xff8f('0x18');var _0x411cc7=_0x159441[_0xff8f('0x19')];var _0x1aa37b=_0x55d2d3?0x0:_0x59e2a8[_0xff8f('0x16')];var _0x595c44=_0x55d2d3?_0x159441['count']:_0x59e2a8[_0xff8f('0x16')]+_0x59e2a8[_0xff8f('0x17')];var _0xb8bb32;if(_0x595c44>=_0x411cc7){_0x595c44=_0x411cc7;_0xb8bb32=0xc8;}else{_0xb8bb32=0xce;}_0xb45836[_0xff8f('0x14')](_0xb8bb32);return _0xb45836[_0xff8f('0x1a')]('Content-Range',_0x1aa37b+'-'+_0x595c44+'/'+_0x411cc7)['json'](_0x159441);}return null;};}function patchUpdates(_0x3a6c4b){return function(_0x5a58ee){try{jsonpatch[_0xff8f('0x1b')](_0x5a58ee,_0x3a6c4b,!![]);}catch(_0x5ce4be){return BPromise[_0xff8f('0x1c')](_0x5ce4be);}return _0x5a58ee[_0xff8f('0x1d')]();};}function saveUpdates(_0xb0f80a,_0x44fb06){return function(_0xeaf441){if(_0xeaf441){return _0xeaf441[_0xff8f('0x1e')](_0xb0f80a)['then'](function(_0x120a59){return _0x120a59;});}return null;};}function removeEntity(_0x30810d,_0x21058c){return function(_0x20c390){if(_0x20c390){return _0x20c390[_0xff8f('0x1f')]()[_0xff8f('0x20')](function(){var _0x51c599=_0x20c390['get']({'plain':!![]});var _0x59c197=_0xff8f('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x59c197,'resourceId':_0x51c599['id']}})['then'](function(){return _0x20c390;});})['then'](function(){_0x30810d[_0xff8f('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45359a,_0x5385fe){return function(_0x271252){if(!_0x271252){_0x45359a[_0xff8f('0x13')](0x194);}return _0x271252;};}function handleError(_0x3519ab,_0xb1ed64){_0xb1ed64=_0xb1ed64||0x1f4;return function(_0x4ea0f2){logger[_0xff8f('0x22')](_0x4ea0f2[_0xff8f('0x23')]);if(_0x4ea0f2[_0xff8f('0x24')]){delete _0x4ea0f2[_0xff8f('0x24')];}_0x3519ab[_0xff8f('0x14')](_0xb1ed64)['send'](_0x4ea0f2);};}exports[_0xff8f('0x25')]=function(_0x21b2ea,_0x2ee06c){var _0x186e21={},_0x575de7={},_0x269390={'count':0x0,'rows':[]};var _0x5e3e71=_['map'](db[_0xff8f('0x26')]['rawAttributes'],function(_0x2fc432){return{'name':_0x2fc432[_0xff8f('0x27')],'type':_0x2fc432['type'][_0xff8f('0x28')]};});_0x575de7['model']=_[_0xff8f('0x29')](_0x5e3e71,_0xff8f('0x24'));_0x575de7[_0xff8f('0x2a')]=_[_0xff8f('0x2b')](_0x21b2ea['query']);_0x575de7['filters']=_[_0xff8f('0x2c')](_0x575de7['model'],_0x575de7['query']);_0x186e21[_0xff8f('0x2d')]=_[_0xff8f('0x2c')](_0x575de7[_0xff8f('0x2e')],qs['fields'](_0x21b2ea['query'][_0xff8f('0x2f')]));_0x186e21[_0xff8f('0x2d')]=_0x186e21['attributes'][_0xff8f('0x30')]?_0x186e21[_0xff8f('0x2d')]:_0x575de7[_0xff8f('0x2e')];if(!_0x21b2ea[_0xff8f('0x2a')]['hasOwnProperty']('nolimit')){_0x186e21['limit']=qs['limit'](_0x21b2ea[_0xff8f('0x2a')][_0xff8f('0x17')]);_0x186e21[_0xff8f('0x16')]=qs[_0xff8f('0x16')](_0x21b2ea[_0xff8f('0x2a')][_0xff8f('0x16')]);}_0x186e21[_0xff8f('0x31')]=qs[_0xff8f('0x32')](_0x21b2ea[_0xff8f('0x2a')]['sort']);_0x186e21[_0xff8f('0x33')]=qs[_0xff8f('0x34')](_[_0xff8f('0x35')](_0x21b2ea[_0xff8f('0x2a')],_0x575de7[_0xff8f('0x34')]),_0x5e3e71);if(_0x21b2ea[_0xff8f('0x2a')][_0xff8f('0x36')]){_0x186e21[_0xff8f('0x33')]=_[_0xff8f('0x37')](_0x186e21['where'],{'$or':_['map'](_0x5e3e71,function(_0x5b9f72){if(_0x5b9f72['type']!==_0xff8f('0x38')){var _0xb51e0e={};_0xb51e0e[_0x5b9f72[_0xff8f('0x24')]]={'$like':'%'+_0x21b2ea[_0xff8f('0x2a')][_0xff8f('0x36')]+'%'};return _0xb51e0e;}})});}_0x186e21=_[_0xff8f('0x37')]({},_0x186e21,_0x21b2ea[_0xff8f('0x39')]);var _0x5c1d62={'where':_0x186e21[_0xff8f('0x33')]};return db[_0xff8f('0x26')]['count'](_0x5c1d62)['then'](function(_0x386685){_0x269390[_0xff8f('0x19')]=_0x386685;if(_0x21b2ea[_0xff8f('0x2a')][_0xff8f('0x3a')]){_0x186e21[_0xff8f('0x3b')]=[{'all':!![]}];}return db[_0xff8f('0x26')][_0xff8f('0x3c')](_0x186e21);})[_0xff8f('0x20')](function(_0x583a0f){_0x269390[_0xff8f('0x3d')]=_0x583a0f;return _0x269390;})[_0xff8f('0x20')](respondWithFilteredResult(_0x2ee06c,_0x186e21))[_0xff8f('0x3e')](handleError(_0x2ee06c,null));};exports[_0xff8f('0x3f')]=function(_0x142c78,_0x558968){var _0x1ad922={'raw':![],'where':{'id':_0x142c78[_0xff8f('0x40')]['id']}},_0x2385f4={};_0x2385f4[_0xff8f('0x2e')]=_[_0xff8f('0x2b')](db['JscriptyProject'][_0xff8f('0x41')]);_0x2385f4['query']=_[_0xff8f('0x2b')](_0x142c78[_0xff8f('0x2a')]);_0x2385f4[_0xff8f('0x34')]=_[_0xff8f('0x2c')](_0x2385f4[_0xff8f('0x2e')],_0x2385f4[_0xff8f('0x2a')]);_0x1ad922[_0xff8f('0x2d')]=_[_0xff8f('0x2c')](_0x2385f4[_0xff8f('0x2e')],qs['fields'](_0x142c78[_0xff8f('0x2a')][_0xff8f('0x2f')]));_0x1ad922[_0xff8f('0x2d')]=_0x1ad922[_0xff8f('0x2d')][_0xff8f('0x30')]?_0x1ad922[_0xff8f('0x2d')]:_0x2385f4['model'];if(_0x142c78[_0xff8f('0x2a')]['includeAll']){_0x1ad922[_0xff8f('0x3b')]=[{'all':!![]}];}_0x1ad922=_[_0xff8f('0x37')]({},_0x1ad922,_0x142c78[_0xff8f('0x39')]);return db[_0xff8f('0x26')][_0xff8f('0x42')](_0x1ad922)[_0xff8f('0x20')](handleEntityNotFound(_0x558968,null))[_0xff8f('0x20')](respondWithResult(_0x558968,null))[_0xff8f('0x3e')](handleError(_0x558968,null));};exports[_0xff8f('0x43')]=function(_0x16ff6d,_0x3e43b1){return db[_0xff8f('0x26')][_0xff8f('0x43')](_0x16ff6d['body'],{})[_0xff8f('0x20')](function(_0x5bcb6b){var _0xa4ed9e=_0x16ff6d['user'][_0xff8f('0x44')]({'plain':!![]});if(!_0xa4ed9e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa4ed9e[_0xff8f('0x45')]===_0xff8f('0x46')){var _0x3ea6aa=_0x5bcb6b[_0xff8f('0x44')]({'plain':!![]});var _0x1a1bdf=_0xff8f('0x21');return db[_0xff8f('0x47')][_0xff8f('0x42')]({'where':{'name':_0x1a1bdf,'userProfileId':_0xa4ed9e['userProfileId']},'raw':!![]})[_0xff8f('0x20')](function(_0x3f27cc){if(_0x3f27cc&&_0x3f27cc[_0xff8f('0x48')]===0x0){return db[_0xff8f('0x49')]['create']({'name':_0x3ea6aa[_0xff8f('0x24')],'resourceId':_0x3ea6aa['id'],'type':_0x3f27cc[_0xff8f('0x24')],'sectionId':_0x3f27cc['id']},{})[_0xff8f('0x20')](function(){return _0x5bcb6b;});}else{return _0x5bcb6b;}})[_0xff8f('0x3e')](function(_0x415e95){logger[_0xff8f('0x22')](_0xff8f('0x4a'),_0x415e95);throw _0x415e95;});}return _0x5bcb6b;})[_0xff8f('0x20')](respondWithResult(_0x3e43b1,0xc9))[_0xff8f('0x3e')](handleError(_0x3e43b1,null));};exports[_0xff8f('0x4b')]=function(_0x6e246e,_0x29c10c){var _0x1ea089={'where':{'id':_0x6e246e[_0xff8f('0x40')]['id']}},_0x5e007e={};_0x5e007e[_0xff8f('0x2e')]=_['keys'](db[_0xff8f('0x26')][_0xff8f('0x41')]);_0x1ea089[_0xff8f('0x2d')]=_[_0xff8f('0x2c')](_0x5e007e[_0xff8f('0x2e')],qs['fields'](_0x6e246e[_0xff8f('0x2a')][_0xff8f('0x2f')]));_0x1ea089[_0xff8f('0x2d')]=_0x1ea089['attributes']['length']?_0x1ea089[_0xff8f('0x2d')]:_0x5e007e[_0xff8f('0x2e')];if(_0x6e246e[_0xff8f('0x2a')]['includeAll']){_0x1ea089['include']=[{'all':!![]}];}_0x1ea089=_['merge']({},_0x1ea089,_0x6e246e[_0xff8f('0x39')]);return db[_0xff8f('0x26')][_0xff8f('0x42')](_0x1ea089)['then'](handleEntityNotFound(_0x29c10c,null))[_0xff8f('0x20')](function(_0x6f4d60){if(_0x6f4d60){var _0x349064=_0x6f4d60['get']({'plain':!![]});_0x349064=qs[_0xff8f('0x4c')](_0x349064,['id',_0xff8f('0x4d'),_0xff8f('0x4e')]);_0x6e246e['body']=_[_0xff8f('0x4c')](_0x6e246e[_0xff8f('0x4f')],['id',_0xff8f('0x4d'),'updatedAt']);return db[_0xff8f('0x26')][_0xff8f('0x43')](_[_0xff8f('0x37')](_0x349064,_0x6e246e[_0xff8f('0x4f')]),{'include':_0x6e246e[_0xff8f('0x2a')]['includeAll']?[{'all':!![]}]:undefined})[_0xff8f('0x20')](function(_0x163430){var _0x3e3d27=_0x6e246e[_0xff8f('0x46')][_0xff8f('0x44')]({'plain':!![]});if(!_0x3e3d27)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e3d27[_0xff8f('0x45')]==='user'){var _0x3247ec=_0x163430[_0xff8f('0x44')]({'plain':!![]});var _0x33a525='Projects';return db[_0xff8f('0x47')][_0xff8f('0x42')]({'where':{'name':_0x33a525,'userProfileId':_0x3e3d27[_0xff8f('0x50')]},'raw':!![]})[_0xff8f('0x20')](function(_0x16ede2){if(_0x16ede2&&_0x16ede2[_0xff8f('0x48')]===0x0){return db[_0xff8f('0x49')]['create']({'name':_0x3247ec[_0xff8f('0x24')],'resourceId':_0x3247ec['id'],'type':_0x16ede2['name'],'sectionId':_0x16ede2['id']},{})[_0xff8f('0x20')](function(){return _0x163430;});}else{return _0x163430;}})[_0xff8f('0x3e')](function(_0x13169d){logger[_0xff8f('0x22')](_0xff8f('0x4a'),_0x13169d);throw _0x13169d;});}return _0x163430;});}})['then'](respondWithResult(_0x29c10c,0xc9))[_0xff8f('0x3e')](handleError(_0x29c10c,null));};exports[_0xff8f('0x1e')]=function(_0x3bcecc,_0x390e85){if(_0x3bcecc[_0xff8f('0x4f')]['id']){delete _0x3bcecc[_0xff8f('0x4f')]['id'];}return db[_0xff8f('0x26')][_0xff8f('0x42')]({'where':{'id':_0x3bcecc['params']['id']}})[_0xff8f('0x20')](handleEntityNotFound(_0x390e85,null))[_0xff8f('0x20')](saveUpdates(_0x3bcecc[_0xff8f('0x4f')],null))[_0xff8f('0x20')](respondWithResult(_0x390e85,null))[_0xff8f('0x3e')](handleError(_0x390e85,null));};exports[_0xff8f('0x1f')]=function(_0x2c724f,_0x22be9c){return db[_0xff8f('0x26')][_0xff8f('0x42')]({'where':{'id':_0x2c724f[_0xff8f('0x40')]['id']}})['then'](handleEntityNotFound(_0x22be9c,null))[_0xff8f('0x20')](removeEntity(_0x22be9c,null))[_0xff8f('0x3e')](handleError(_0x22be9c,null));};exports[_0xff8f('0x51')]=function(_0x44ac79,_0x119340,_0x2a9b9f){var _0x5e8868={'raw':!![],'where':{}};var _0x374c9f={};var _0x5d8c01={'count':0x0,'rows':[]};return db[_0xff8f('0x26')][_0xff8f('0x52')]({'where':{'id':_0x44ac79[_0xff8f('0x40')]['id']}})['then'](handleEntityNotFound(_0x119340,null))[_0xff8f('0x20')](function(_0xb7db16){if(_0xb7db16){_0x374c9f[_0xff8f('0x2e')]=_['keys'](db[_0xff8f('0x53')][_0xff8f('0x41')]);_0x374c9f['query']=_[_0xff8f('0x2b')](_0x44ac79[_0xff8f('0x2a')]);_0x374c9f[_0xff8f('0x34')]=_[_0xff8f('0x2c')](_0x374c9f['model'],_0x374c9f[_0xff8f('0x2a')]);_0x5e8868[_0xff8f('0x2d')]=_[_0xff8f('0x2c')](_0x374c9f[_0xff8f('0x2e')],qs[_0xff8f('0x2f')](_0x44ac79[_0xff8f('0x2a')][_0xff8f('0x2f')]));_0x5e8868['attributes']=_0x5e8868[_0xff8f('0x2d')][_0xff8f('0x30')]?_0x5e8868[_0xff8f('0x2d')]:_0x374c9f[_0xff8f('0x2e')];if(!_0x44ac79['query']['hasOwnProperty'](_0xff8f('0x54'))){_0x5e8868['limit']=qs[_0xff8f('0x17')](_0x44ac79[_0xff8f('0x2a')][_0xff8f('0x17')]);_0x5e8868[_0xff8f('0x16')]=qs[_0xff8f('0x16')](_0x44ac79['query'][_0xff8f('0x16')]);}_0x5e8868[_0xff8f('0x31')]=qs[_0xff8f('0x32')](_0x44ac79[_0xff8f('0x2a')][_0xff8f('0x32')]);_0x5e8868[_0xff8f('0x33')]=qs[_0xff8f('0x34')](_['pick'](_0x44ac79['query'],_0x374c9f[_0xff8f('0x34')]));_0x5e8868['where'][_0xff8f('0x55')]=_0xb7db16['id'];if(_0x44ac79[_0xff8f('0x2a')]['filter']){_0x5e8868['where']=_[_0xff8f('0x37')](_0x5e8868[_0xff8f('0x33')],{'$or':_[_0xff8f('0x29')](_0x5e8868[_0xff8f('0x2d')],function(_0x5f3bfb){var _0x3b4303={};_0x3b4303[_0x5f3bfb]={'$like':'%'+_0x44ac79[_0xff8f('0x2a')][_0xff8f('0x36')]+'%'};return _0x3b4303;})});}_0x5e8868=_[_0xff8f('0x37')]({},_0x5e8868,_0x44ac79['options']);return db[_0xff8f('0x53')][_0xff8f('0x19')]({'where':_0x5e8868[_0xff8f('0x33')]})[_0xff8f('0x20')](function(_0x3d9905){_0x5d8c01['count']=_0x3d9905;if(_0x44ac79[_0xff8f('0x2a')][_0xff8f('0x3a')]){_0x5e8868[_0xff8f('0x3b')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xff8f('0x3c')](_0x5e8868);})[_0xff8f('0x20')](function(_0x4f31c4){_0x5d8c01[_0xff8f('0x3d')]=_0x4f31c4;return _0x5d8c01;});}})[_0xff8f('0x20')](respondWithFilteredResult(_0x119340,_0x5e8868))['catch'](handleError(_0x119340,null));};exports['getAnswers']=function(_0x176757,_0xa15761,_0x5091a3){var _0x33f18a={'raw':!![],'where':{}};var _0xff5b43={};var _0x75f44c={'count':0x0,'rows':[]};return db[_0xff8f('0x26')][_0xff8f('0x52')]({'where':{'id':_0x176757[_0xff8f('0x40')]['id']}})[_0xff8f('0x20')](handleEntityNotFound(_0xa15761,null))[_0xff8f('0x20')](function(_0x1bb2e4){if(_0x1bb2e4){_0xff5b43[_0xff8f('0x2e')]=_[_0xff8f('0x2b')](db[_0xff8f('0x56')][_0xff8f('0x41')]);_0xff5b43[_0xff8f('0x2a')]=_[_0xff8f('0x2b')](_0x176757[_0xff8f('0x2a')]);_0xff5b43[_0xff8f('0x34')]=_[_0xff8f('0x2c')](_0xff5b43[_0xff8f('0x2e')],_0xff5b43[_0xff8f('0x2a')]);_0x33f18a['attributes']=_[_0xff8f('0x2c')](_0xff5b43[_0xff8f('0x2e')],qs[_0xff8f('0x2f')](_0x176757['query']['fields']));_0x33f18a[_0xff8f('0x2d')]=_0x33f18a[_0xff8f('0x2d')][_0xff8f('0x30')]?_0x33f18a[_0xff8f('0x2d')]:_0xff5b43['model'];if(!_0x176757['query'][_0xff8f('0x57')]('nolimit')){_0x33f18a[_0xff8f('0x17')]=qs['limit'](_0x176757[_0xff8f('0x2a')]['limit']);_0x33f18a['offset']=qs[_0xff8f('0x16')](_0x176757['query'][_0xff8f('0x16')]);}_0x33f18a['order']=qs[_0xff8f('0x32')](_0x176757['query'][_0xff8f('0x32')]);_0x33f18a[_0xff8f('0x33')]=qs[_0xff8f('0x34')](_['pick'](_0x176757[_0xff8f('0x2a')],_0xff5b43[_0xff8f('0x34')]));_0x33f18a[_0xff8f('0x33')][_0xff8f('0x55')]=_0x1bb2e4['id'];if(_0x176757[_0xff8f('0x2a')][_0xff8f('0x36')]){_0x33f18a[_0xff8f('0x33')]=_[_0xff8f('0x37')](_0x33f18a['where'],{'$or':_[_0xff8f('0x29')](_0x33f18a[_0xff8f('0x2d')],function(_0x508840){var _0xd48ca4={};_0xd48ca4[_0x508840]={'$like':'%'+_0x176757['query'][_0xff8f('0x36')]+'%'};return _0xd48ca4;})});}_0x33f18a=_[_0xff8f('0x37')]({},_0x33f18a,_0x176757[_0xff8f('0x39')]);return db[_0xff8f('0x56')][_0xff8f('0x19')]({'where':_0x33f18a[_0xff8f('0x33')]})[_0xff8f('0x20')](function(_0x463ac0){_0x75f44c['count']=_0x463ac0;if(_0x176757[_0xff8f('0x2a')][_0xff8f('0x3a')]){_0x33f18a['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xff8f('0x3c')](_0x33f18a);})[_0xff8f('0x20')](function(_0x2defc0){_0x75f44c[_0xff8f('0x3d')]=_0x2defc0;return _0x75f44c;});}})[_0xff8f('0x20')](respondWithFilteredResult(_0xa15761,_0x33f18a))[_0xff8f('0x3e')](handleError(_0xa15761,null));};function char(_0x351dc5){return'number'===typeof _0x351dc5?String[_0xff8f('0x58')][_0xff8f('0x1b')](null,arguments):_0x351dc5;}function needsEncapsulation(_0x3a70b0){return!!_0x3a70b0&&(_0x3a70b0['toString']()[_0xff8f('0x59')](char(0xd))>=0x0||_0x3a70b0[_0xff8f('0x5a')]()['indexOf'](char(0xa))>=0x0||_0x3a70b0[_0xff8f('0x5a')]()[_0xff8f('0x59')](char(0x2c))>=0x0||_0x3a70b0[_0xff8f('0x5a')]()[_0xff8f('0x59')](char(0x22))>=0x0);}function encapsulate(_0x18a207){var _0x5125ad=char(0x22),_0x2569ce='\x5c'+char(0x22),_0x2bd7d1=_0x18a207[_0xff8f('0x5a')]()[_0xff8f('0x5b')](new RegExp(_0x5125ad,'g'),_0x2569ce);return _0x5125ad+_0x2bd7d1+_0x5125ad;}exports[_0xff8f('0x5c')]=function(_0xe6d6,_0x137ae7,_0x4c35c3){var _0x2179fe,_0x18bbfb;var _0x75e26a={'where':{'ProjectId':_0xe6d6[_0xff8f('0x40')]['id']}};if(_0xe6d6[_0xff8f('0x2a')][_0xff8f('0x5d')]){_0x75e26a[_0xff8f('0x33')][_0xff8f('0x5e')]=JSON[_0xff8f('0x5f')](_0xe6d6['query'][_0xff8f('0x5d')]);}return db[_0xff8f('0x53')][_0xff8f('0x3c')](_0x75e26a)[_0xff8f('0x20')](handleEntityNotFound(_0x137ae7,null))[_0xff8f('0x20')](function(_0x11003f){if(_0x11003f){_0x2179fe=_0x11003f;return db[_0xff8f('0x60')][_0xff8f('0x3c')]({'where':{'SessionId':{'$in':_['map'](_0x2179fe,'id')},'ProjectId':_0xe6d6[_0xff8f('0x40')]['id']},'order':_0xff8f('0x61')});}})['then'](handleEntityNotFound(_0x137ae7,null))['then'](function(_0x427c93){if(_0x427c93){_0x18bbfb=_0x427c93;var _0x4319a5={};for(var _0x5b2c19=0x0,_0x75fc16=_0x18bbfb['length'];_0x5b2c19<_0x75fc16;_0x5b2c19++){if(!_0x4319a5['hasOwnProperty'](_0x18bbfb[_0x5b2c19][_0xff8f('0x62')])){_0x4319a5[_0x18bbfb[_0x5b2c19]['questionId']]=needsEncapsulation(_0x18bbfb[_0x5b2c19][_0xff8f('0x63')])?encapsulate(_0x18bbfb[_0x5b2c19][_0xff8f('0x63')]):_0x18bbfb[_0x5b2c19]['question'];}}var _0x416dd6=[],_0x1b0ae5={};for(var _0x44c173=0x0,_0x889ceb=_0x2179fe[_0xff8f('0x30')];_0x44c173<_0x889ceb;_0x44c173++){_0x1b0ae5={'ProjectId':_0xe6d6['params']['id'],'SessionId':_0x2179fe[_0x44c173]['id'],'StartTime':moment(_0x2179fe[_0x44c173]['starttime'])[_0xff8f('0x64')](_0xff8f('0x65'))};for(var _0x2787f0=0x0,_0x503799=_0x18bbfb[_0xff8f('0x30')];_0x2787f0<_0x503799;_0x2787f0++){if(_0x18bbfb[_0x2787f0][_0xff8f('0x66')]==_0x2179fe[_0x44c173]['id']&&_0x4319a5[_0xff8f('0x57')](_0x18bbfb[_0x2787f0][_0xff8f('0x62')])){_0x1b0ae5[_0x4319a5[_0x18bbfb[_0x2787f0][_0xff8f('0x62')]]]=_0x18bbfb[_0x2787f0][_0xff8f('0x67')];}}for(var _0x28f3f9 in _0x4319a5){if(!_0x1b0ae5['hasOwnProperty'](_0x4319a5[_0x28f3f9])){_0x1b0ae5[_0x4319a5[_0x28f3f9]]=null;}}_0x416dd6[_0xff8f('0x68')](_0x1b0ae5);}return _0x416dd6;}})[_0xff8f('0x20')](function(_0x320004){if(!_[_0xff8f('0x69')](_0x320004)){var _0x416772=toCsv(_0x320004);var _0x28e5a0=Date[_0xff8f('0x6a')]();fs['writeFileSync'](util[_0xff8f('0x64')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xe6d6[_0xff8f('0x40')]['id'],_0x28e5a0),_0x416772);_0x137ae7['setHeader']('Content-disposition',_0xff8f('0x6b')+util[_0xff8f('0x64')](_0xff8f('0x6c'),_0xe6d6['params']['id'],_0x28e5a0));_0x137ae7[_0xff8f('0x6d')](_0xff8f('0x6e'),'text/csv');return _0x137ae7['download'](util[_0xff8f('0x64')](_0xff8f('0x6f'),_0xe6d6[_0xff8f('0x40')]['id'],_0x28e5a0));}else{return _0x137ae7[_0xff8f('0x13')](0xcc);}})['catch'](handleError(_0x137ae7,null));}; \ No newline at end of file +var _0xe486=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','destroy','then','get','Projects','UserProfileResource','sendStatus','name','send','map','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','JscriptyProject','include','findAll','catch','show','keys','intersection','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','createdAt','updatedAt','update','params','getSessions','findOne','JscriptySessionReport','pick','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv'];(function(_0x255efd,_0x46584d){var _0x395a8d=function(_0x1bbc42){while(--_0x1bbc42){_0x255efd['push'](_0x255efd['shift']());}};_0x395a8d(++_0x46584d);}(_0xe486,0x6a));var _0x6e48=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0xe486[_0x49a57c];return _0x4e0316;};'use strict';var emlformat=require(_0x6e48('0x0'));var rimraf=require(_0x6e48('0x1'));var zipdir=require(_0x6e48('0x2'));var jsonpatch=require(_0x6e48('0x3'));var rp=require(_0x6e48('0x4'));var moment=require(_0x6e48('0x5'));var BPromise=require(_0x6e48('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6e48('0x7'));var sox=require(_0x6e48('0x8'));var csv=require(_0x6e48('0x9'));var ejs=require(_0x6e48('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e48('0xb'));var squel=require(_0x6e48('0xc'));var crypto=require(_0x6e48('0xd'));var jsforce=require(_0x6e48('0xe'));var deskjs=require(_0x6e48('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6e48('0x10'));var Papa=require('papaparse');var Redis=require(_0x6e48('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6e48('0x12'));var as=require(_0x6e48('0x13'));var hardwareService=require(_0x6e48('0x14'));var logger=require(_0x6e48('0x15'))('api');var utils=require(_0x6e48('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6e48('0x17'))['db'];function respondWithStatusCode(_0x1f1ff4,_0x1bfa97){_0x1bfa97=_0x1bfa97||0xcc;return function(_0x199cbe){if(_0x199cbe){return _0x1f1ff4['sendStatus'](_0x1bfa97);}return _0x1f1ff4[_0x6e48('0x18')](_0x1bfa97)[_0x6e48('0x19')]();};}function respondWithResult(_0xa66f97,_0x45268d){_0x45268d=_0x45268d||0xc8;return function(_0x272a24){if(_0x272a24){return _0xa66f97[_0x6e48('0x18')](_0x45268d)[_0x6e48('0x1a')](_0x272a24);}};}function respondWithFilteredResult(_0x307d4c,_0x1687b7){return function(_0x48c10c){if(_0x48c10c){var _0x437f65=typeof _0x1687b7[_0x6e48('0x1b')]===_0x6e48('0x1c')&&typeof _0x1687b7[_0x6e48('0x1d')]==='undefined';var _0x45e94b=_0x48c10c[_0x6e48('0x1e')];var _0x4d3927=_0x437f65?0x0:_0x1687b7[_0x6e48('0x1b')];var _0x1c89f1=_0x437f65?_0x48c10c[_0x6e48('0x1e')]:_0x1687b7[_0x6e48('0x1b')]+_0x1687b7[_0x6e48('0x1d')];var _0x419fd8;if(_0x1c89f1>=_0x45e94b){_0x1c89f1=_0x45e94b;_0x419fd8=0xc8;}else{_0x419fd8=0xce;}_0x307d4c[_0x6e48('0x18')](_0x419fd8);return _0x307d4c[_0x6e48('0x1f')]('Content-Range',_0x4d3927+'-'+_0x1c89f1+'/'+_0x45e94b)[_0x6e48('0x1a')](_0x48c10c);}return null;};}function patchUpdates(_0x383ecb){return function(_0x84322b){try{jsonpatch[_0x6e48('0x20')](_0x84322b,_0x383ecb,!![]);}catch(_0x25f7d3){return BPromise[_0x6e48('0x21')](_0x25f7d3);}return _0x84322b['save']();};}function saveUpdates(_0x4518a7,_0x4cdded){return function(_0x371147){if(_0x371147){return _0x371147['update'](_0x4518a7)['then'](function(_0x52bbef){return _0x52bbef;});}return null;};}function removeEntity(_0x3d492f,_0xe57bbf){return function(_0x406611){if(_0x406611){return _0x406611[_0x6e48('0x22')]()[_0x6e48('0x23')](function(){var _0x5dcd9a=_0x406611[_0x6e48('0x24')]({'plain':!![]});var _0x195761=_0x6e48('0x25');return db[_0x6e48('0x26')][_0x6e48('0x22')]({'where':{'type':_0x195761,'resourceId':_0x5dcd9a['id']}})[_0x6e48('0x23')](function(){return _0x406611;});})[_0x6e48('0x23')](function(){_0x3d492f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x380eb5,_0x4147bd){return function(_0x50d01f){if(!_0x50d01f){_0x380eb5[_0x6e48('0x27')](0x194);}return _0x50d01f;};}function handleError(_0x484bb3,_0x13d1bb){_0x13d1bb=_0x13d1bb||0x1f4;return function(_0x502b67){logger['error'](_0x502b67['stack']);if(_0x502b67[_0x6e48('0x28')]){delete _0x502b67[_0x6e48('0x28')];}_0x484bb3[_0x6e48('0x18')](_0x13d1bb)[_0x6e48('0x29')](_0x502b67);};}exports['index']=function(_0xdc841a,_0x271769){var _0x4b5b4b={},_0x1e7f00={},_0x2ac4de={'count':0x0,'rows':[]};var _0x545bdc=_[_0x6e48('0x2a')](db['JscriptyProject'][_0x6e48('0x2b')],function(_0x2c4a72){return{'name':_0x2c4a72['fieldName'],'type':_0x2c4a72[_0x6e48('0x2c')][_0x6e48('0x2d')]};});_0x1e7f00[_0x6e48('0x2e')]=_['map'](_0x545bdc,_0x6e48('0x28'));_0x1e7f00[_0x6e48('0x2f')]=_['keys'](_0xdc841a[_0x6e48('0x2f')]);_0x1e7f00[_0x6e48('0x30')]=_['intersection'](_0x1e7f00['model'],_0x1e7f00['query']);_0x4b5b4b[_0x6e48('0x31')]=_['intersection'](_0x1e7f00[_0x6e48('0x2e')],qs[_0x6e48('0x32')](_0xdc841a[_0x6e48('0x2f')]['fields']));_0x4b5b4b['attributes']=_0x4b5b4b[_0x6e48('0x31')][_0x6e48('0x33')]?_0x4b5b4b['attributes']:_0x1e7f00['model'];if(!_0xdc841a[_0x6e48('0x2f')][_0x6e48('0x34')](_0x6e48('0x35'))){_0x4b5b4b[_0x6e48('0x1d')]=qs[_0x6e48('0x1d')](_0xdc841a[_0x6e48('0x2f')][_0x6e48('0x1d')]);_0x4b5b4b['offset']=qs['offset'](_0xdc841a[_0x6e48('0x2f')][_0x6e48('0x1b')]);}_0x4b5b4b[_0x6e48('0x36')]=qs[_0x6e48('0x37')](_0xdc841a['query'][_0x6e48('0x37')]);_0x4b5b4b[_0x6e48('0x38')]=qs['filters'](_['pick'](_0xdc841a[_0x6e48('0x2f')],_0x1e7f00[_0x6e48('0x30')]),_0x545bdc);if(_0xdc841a['query'][_0x6e48('0x39')]){_0x4b5b4b['where']=_[_0x6e48('0x3a')](_0x4b5b4b['where'],{'$or':_[_0x6e48('0x2a')](_0x545bdc,function(_0x5de5e7){if(_0x5de5e7['type']!==_0x6e48('0x3b')){var _0x808f99={};_0x808f99[_0x5de5e7[_0x6e48('0x28')]]={'$like':'%'+_0xdc841a['query'][_0x6e48('0x39')]+'%'};return _0x808f99;}})});}_0x4b5b4b=_[_0x6e48('0x3a')]({},_0x4b5b4b,_0xdc841a['options']);var _0x3b7c8d={'where':_0x4b5b4b[_0x6e48('0x38')]};return db[_0x6e48('0x3c')][_0x6e48('0x1e')](_0x3b7c8d)[_0x6e48('0x23')](function(_0x2fc08a){_0x2ac4de[_0x6e48('0x1e')]=_0x2fc08a;if(_0xdc841a[_0x6e48('0x2f')]['includeAll']){_0x4b5b4b[_0x6e48('0x3d')]=[{'all':!![]}];}return db[_0x6e48('0x3c')][_0x6e48('0x3e')](_0x4b5b4b);})['then'](function(_0x16a056){_0x2ac4de['rows']=_0x16a056;return _0x2ac4de;})[_0x6e48('0x23')](respondWithFilteredResult(_0x271769,_0x4b5b4b))[_0x6e48('0x3f')](handleError(_0x271769,null));};exports[_0x6e48('0x40')]=function(_0x1575a0,_0x198550){var _0x1ba239={'raw':![],'where':{'id':_0x1575a0['params']['id']}},_0x1173fd={};_0x1173fd[_0x6e48('0x2e')]=_['keys'](db['JscriptyProject'][_0x6e48('0x2b')]);_0x1173fd[_0x6e48('0x2f')]=_[_0x6e48('0x41')](_0x1575a0['query']);_0x1173fd['filters']=_[_0x6e48('0x42')](_0x1173fd[_0x6e48('0x2e')],_0x1173fd['query']);_0x1ba239[_0x6e48('0x31')]=_[_0x6e48('0x42')](_0x1173fd['model'],qs[_0x6e48('0x32')](_0x1575a0[_0x6e48('0x2f')][_0x6e48('0x32')]));_0x1ba239[_0x6e48('0x31')]=_0x1ba239[_0x6e48('0x31')]['length']?_0x1ba239['attributes']:_0x1173fd[_0x6e48('0x2e')];if(_0x1575a0['query'][_0x6e48('0x43')]){_0x1ba239[_0x6e48('0x3d')]=[{'all':!![]}];}_0x1ba239=_[_0x6e48('0x3a')]({},_0x1ba239,_0x1575a0['options']);return db['JscriptyProject']['find'](_0x1ba239)['then'](handleEntityNotFound(_0x198550,null))[_0x6e48('0x23')](respondWithResult(_0x198550,null))['catch'](handleError(_0x198550,null));};exports[_0x6e48('0x44')]=function(_0x25c5a6,_0x1801ca){return db[_0x6e48('0x3c')][_0x6e48('0x44')](_0x25c5a6[_0x6e48('0x45')],{})['then'](function(_0x16a44e){var _0x569266=_0x25c5a6[_0x6e48('0x46')][_0x6e48('0x24')]({'plain':!![]});if(!_0x569266)throw new Error(_0x6e48('0x47'));if(_0x569266[_0x6e48('0x48')]===_0x6e48('0x46')){var _0x20a520=_0x16a44e[_0x6e48('0x24')]({'plain':!![]});var _0x8af8de=_0x6e48('0x25');return db[_0x6e48('0x49')][_0x6e48('0x4a')]({'where':{'name':_0x8af8de,'userProfileId':_0x569266[_0x6e48('0x4b')]},'raw':!![]})[_0x6e48('0x23')](function(_0x46c1f9){if(_0x46c1f9&&_0x46c1f9[_0x6e48('0x4c')]===0x0){return db[_0x6e48('0x26')]['create']({'name':_0x20a520[_0x6e48('0x28')],'resourceId':_0x20a520['id'],'type':_0x46c1f9[_0x6e48('0x28')],'sectionId':_0x46c1f9['id']},{})['then'](function(){return _0x16a44e;});}else{return _0x16a44e;}})[_0x6e48('0x3f')](function(_0x364f31){logger[_0x6e48('0x4d')](_0x6e48('0x4e'),_0x364f31);throw _0x364f31;});}return _0x16a44e;})['then'](respondWithResult(_0x1801ca,0xc9))[_0x6e48('0x3f')](handleError(_0x1801ca,null));};exports[_0x6e48('0x4f')]=function(_0x1970fb,_0x3bfa9d){var _0x3c63c9={'where':{'id':_0x1970fb['params']['id']}},_0x1acd37={};_0x1acd37['model']=_[_0x6e48('0x41')](db[_0x6e48('0x3c')][_0x6e48('0x2b')]);_0x3c63c9[_0x6e48('0x31')]=_[_0x6e48('0x42')](_0x1acd37['model'],qs[_0x6e48('0x32')](_0x1970fb['query'][_0x6e48('0x32')]));_0x3c63c9[_0x6e48('0x31')]=_0x3c63c9[_0x6e48('0x31')][_0x6e48('0x33')]?_0x3c63c9[_0x6e48('0x31')]:_0x1acd37[_0x6e48('0x2e')];if(_0x1970fb[_0x6e48('0x2f')]['includeAll']){_0x3c63c9['include']=[{'all':!![]}];}_0x3c63c9=_[_0x6e48('0x3a')]({},_0x3c63c9,_0x1970fb[_0x6e48('0x50')]);return db[_0x6e48('0x3c')][_0x6e48('0x4a')](_0x3c63c9)['then'](handleEntityNotFound(_0x3bfa9d,null))[_0x6e48('0x23')](function(_0x2ee495){if(_0x2ee495){var _0x2a3d5d=_0x2ee495['get']({'plain':!![]});_0x2a3d5d=qs['omit'](_0x2a3d5d,['id',_0x6e48('0x51'),_0x6e48('0x52')]);_0x1970fb['body']=_['omit'](_0x1970fb[_0x6e48('0x45')],['id',_0x6e48('0x51'),_0x6e48('0x52')]);return db[_0x6e48('0x3c')][_0x6e48('0x44')](_[_0x6e48('0x3a')](_0x2a3d5d,_0x1970fb[_0x6e48('0x45')]),{'include':_0x1970fb[_0x6e48('0x2f')][_0x6e48('0x43')]?[{'all':!![]}]:undefined})[_0x6e48('0x23')](function(_0x2a4f31){var _0x2739eb=_0x1970fb[_0x6e48('0x46')][_0x6e48('0x24')]({'plain':!![]});if(!_0x2739eb)throw new Error(_0x6e48('0x47'));if(_0x2739eb[_0x6e48('0x48')]===_0x6e48('0x46')){var _0x5ab110=_0x2a4f31[_0x6e48('0x24')]({'plain':!![]});var _0x2f192c=_0x6e48('0x25');return db[_0x6e48('0x49')][_0x6e48('0x4a')]({'where':{'name':_0x2f192c,'userProfileId':_0x2739eb[_0x6e48('0x4b')]},'raw':!![]})[_0x6e48('0x23')](function(_0x2d8b6f){if(_0x2d8b6f&&_0x2d8b6f['autoAssociation']===0x0){return db[_0x6e48('0x26')][_0x6e48('0x44')]({'name':_0x5ab110['name'],'resourceId':_0x5ab110['id'],'type':_0x2d8b6f['name'],'sectionId':_0x2d8b6f['id']},{})['then'](function(){return _0x2a4f31;});}else{return _0x2a4f31;}})[_0x6e48('0x3f')](function(_0x362f48){logger['error'](_0x6e48('0x4e'),_0x362f48);throw _0x362f48;});}return _0x2a4f31;});}})[_0x6e48('0x23')](respondWithResult(_0x3bfa9d,0xc9))[_0x6e48('0x3f')](handleError(_0x3bfa9d,null));};exports[_0x6e48('0x53')]=function(_0x45588b,_0x4c6055){if(_0x45588b[_0x6e48('0x45')]['id']){delete _0x45588b[_0x6e48('0x45')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x45588b[_0x6e48('0x54')]['id']}})['then'](handleEntityNotFound(_0x4c6055,null))[_0x6e48('0x23')](saveUpdates(_0x45588b[_0x6e48('0x45')],null))[_0x6e48('0x23')](respondWithResult(_0x4c6055,null))[_0x6e48('0x3f')](handleError(_0x4c6055,null));};exports[_0x6e48('0x22')]=function(_0x45dfb1,_0xef219e){return db[_0x6e48('0x3c')][_0x6e48('0x4a')]({'where':{'id':_0x45dfb1['params']['id']}})[_0x6e48('0x23')](handleEntityNotFound(_0xef219e,null))[_0x6e48('0x23')](removeEntity(_0xef219e,null))[_0x6e48('0x3f')](handleError(_0xef219e,null));};exports[_0x6e48('0x55')]=function(_0x9c17d7,_0x39d8be,_0x32ee86){var _0x16a412={'raw':!![],'where':{}};var _0x5ed0d9={};var _0x9c5d37={'count':0x0,'rows':[]};return db[_0x6e48('0x3c')][_0x6e48('0x56')]({'where':{'id':_0x9c17d7[_0x6e48('0x54')]['id']}})[_0x6e48('0x23')](handleEntityNotFound(_0x39d8be,null))[_0x6e48('0x23')](function(_0x4b6a12){if(_0x4b6a12){_0x5ed0d9[_0x6e48('0x2e')]=_[_0x6e48('0x41')](db[_0x6e48('0x57')][_0x6e48('0x2b')]);_0x5ed0d9[_0x6e48('0x2f')]=_[_0x6e48('0x41')](_0x9c17d7['query']);_0x5ed0d9[_0x6e48('0x30')]=_[_0x6e48('0x42')](_0x5ed0d9['model'],_0x5ed0d9[_0x6e48('0x2f')]);_0x16a412['attributes']=_[_0x6e48('0x42')](_0x5ed0d9[_0x6e48('0x2e')],qs[_0x6e48('0x32')](_0x9c17d7[_0x6e48('0x2f')][_0x6e48('0x32')]));_0x16a412['attributes']=_0x16a412[_0x6e48('0x31')]['length']?_0x16a412[_0x6e48('0x31')]:_0x5ed0d9[_0x6e48('0x2e')];if(!_0x9c17d7[_0x6e48('0x2f')]['hasOwnProperty'](_0x6e48('0x35'))){_0x16a412[_0x6e48('0x1d')]=qs[_0x6e48('0x1d')](_0x9c17d7[_0x6e48('0x2f')][_0x6e48('0x1d')]);_0x16a412[_0x6e48('0x1b')]=qs['offset'](_0x9c17d7[_0x6e48('0x2f')][_0x6e48('0x1b')]);}_0x16a412[_0x6e48('0x36')]=qs['sort'](_0x9c17d7[_0x6e48('0x2f')][_0x6e48('0x37')]);_0x16a412['where']=qs[_0x6e48('0x30')](_[_0x6e48('0x58')](_0x9c17d7[_0x6e48('0x2f')],_0x5ed0d9[_0x6e48('0x30')]));_0x16a412[_0x6e48('0x38')][_0x6e48('0x59')]=_0x4b6a12['id'];if(_0x9c17d7[_0x6e48('0x2f')][_0x6e48('0x39')]){_0x16a412['where']=_[_0x6e48('0x3a')](_0x16a412['where'],{'$or':_[_0x6e48('0x2a')](_0x16a412[_0x6e48('0x31')],function(_0x50e381){var _0x4b9b49={};_0x4b9b49[_0x50e381]={'$like':'%'+_0x9c17d7['query'][_0x6e48('0x39')]+'%'};return _0x4b9b49;})});}_0x16a412=_[_0x6e48('0x3a')]({},_0x16a412,_0x9c17d7[_0x6e48('0x50')]);return db[_0x6e48('0x57')][_0x6e48('0x1e')]({'where':_0x16a412[_0x6e48('0x38')]})[_0x6e48('0x23')](function(_0x432d4b){_0x9c5d37[_0x6e48('0x1e')]=_0x432d4b;if(_0x9c17d7[_0x6e48('0x2f')][_0x6e48('0x43')]){_0x16a412[_0x6e48('0x3d')]=[{'all':!![]}];}return db[_0x6e48('0x57')][_0x6e48('0x3e')](_0x16a412);})[_0x6e48('0x23')](function(_0x414719){_0x9c5d37[_0x6e48('0x5a')]=_0x414719;return _0x9c5d37;});}})[_0x6e48('0x23')](respondWithFilteredResult(_0x39d8be,_0x16a412))[_0x6e48('0x3f')](handleError(_0x39d8be,null));};exports[_0x6e48('0x5b')]=function(_0x252d0e,_0x2a4c6f,_0x5e4d0a){var _0x452a3a={'raw':!![],'where':{}};var _0x267015={};var _0x3a5f56={'count':0x0,'rows':[]};return db[_0x6e48('0x3c')][_0x6e48('0x56')]({'where':{'id':_0x252d0e[_0x6e48('0x54')]['id']}})[_0x6e48('0x23')](handleEntityNotFound(_0x2a4c6f,null))[_0x6e48('0x23')](function(_0x40543d){if(_0x40543d){_0x267015[_0x6e48('0x2e')]=_[_0x6e48('0x41')](db[_0x6e48('0x5c')][_0x6e48('0x2b')]);_0x267015[_0x6e48('0x2f')]=_[_0x6e48('0x41')](_0x252d0e[_0x6e48('0x2f')]);_0x267015[_0x6e48('0x30')]=_['intersection'](_0x267015[_0x6e48('0x2e')],_0x267015[_0x6e48('0x2f')]);_0x452a3a[_0x6e48('0x31')]=_[_0x6e48('0x42')](_0x267015['model'],qs[_0x6e48('0x32')](_0x252d0e[_0x6e48('0x2f')][_0x6e48('0x32')]));_0x452a3a[_0x6e48('0x31')]=_0x452a3a['attributes'][_0x6e48('0x33')]?_0x452a3a[_0x6e48('0x31')]:_0x267015[_0x6e48('0x2e')];if(!_0x252d0e['query']['hasOwnProperty'](_0x6e48('0x35'))){_0x452a3a[_0x6e48('0x1d')]=qs[_0x6e48('0x1d')](_0x252d0e[_0x6e48('0x2f')][_0x6e48('0x1d')]);_0x452a3a['offset']=qs[_0x6e48('0x1b')](_0x252d0e['query'][_0x6e48('0x1b')]);}_0x452a3a[_0x6e48('0x36')]=qs[_0x6e48('0x37')](_0x252d0e['query']['sort']);_0x452a3a[_0x6e48('0x38')]=qs[_0x6e48('0x30')](_[_0x6e48('0x58')](_0x252d0e[_0x6e48('0x2f')],_0x267015[_0x6e48('0x30')]));_0x452a3a[_0x6e48('0x38')]['ProjectId']=_0x40543d['id'];if(_0x252d0e[_0x6e48('0x2f')][_0x6e48('0x39')]){_0x452a3a['where']=_[_0x6e48('0x3a')](_0x452a3a['where'],{'$or':_[_0x6e48('0x2a')](_0x452a3a['attributes'],function(_0x4d3488){var _0x26f74c={};_0x26f74c[_0x4d3488]={'$like':'%'+_0x252d0e[_0x6e48('0x2f')][_0x6e48('0x39')]+'%'};return _0x26f74c;})});}_0x452a3a=_[_0x6e48('0x3a')]({},_0x452a3a,_0x252d0e['options']);return db[_0x6e48('0x5c')]['count']({'where':_0x452a3a[_0x6e48('0x38')]})['then'](function(_0x3b7acb){_0x3a5f56[_0x6e48('0x1e')]=_0x3b7acb;if(_0x252d0e[_0x6e48('0x2f')][_0x6e48('0x43')]){_0x452a3a[_0x6e48('0x3d')]=[{'all':!![]}];}return db[_0x6e48('0x5c')][_0x6e48('0x3e')](_0x452a3a);})['then'](function(_0x44dd0c){_0x3a5f56['rows']=_0x44dd0c;return _0x3a5f56;});}})[_0x6e48('0x23')](respondWithFilteredResult(_0x2a4c6f,_0x452a3a))[_0x6e48('0x3f')](handleError(_0x2a4c6f,null));};function char(_0x3f91f){return _0x6e48('0x5d')===typeof _0x3f91f?String[_0x6e48('0x5e')][_0x6e48('0x20')](null,arguments):_0x3f91f;}function needsEncapsulation(_0xc953cb){return!!_0xc953cb&&(_0xc953cb[_0x6e48('0x5f')]()[_0x6e48('0x60')](char(0xd))>=0x0||_0xc953cb[_0x6e48('0x5f')]()[_0x6e48('0x60')](char(0xa))>=0x0||_0xc953cb[_0x6e48('0x5f')]()[_0x6e48('0x60')](char(0x2c))>=0x0||_0xc953cb['toString']()[_0x6e48('0x60')](char(0x22))>=0x0);}function encapsulate(_0x2f3458){var _0x1aae40=char(0x22),_0x161847='\x5c'+char(0x22),_0x4de85e=_0x2f3458[_0x6e48('0x5f')]()['replace'](new RegExp(_0x1aae40,'g'),_0x161847);return _0x1aae40+_0x4de85e+_0x1aae40;}exports['getSummary']=function(_0xad757a,_0x45d88e,_0x28a594){var _0xc9488,_0xdfdabb;var _0x10ba28={'where':{'ProjectId':_0xad757a[_0x6e48('0x54')]['id']}};if(_0xad757a[_0x6e48('0x2f')][_0x6e48('0x61')]){_0x10ba28[_0x6e48('0x38')][_0x6e48('0x62')]=JSON['parse'](_0xad757a['query'][_0x6e48('0x61')]);}return db[_0x6e48('0x57')][_0x6e48('0x3e')](_0x10ba28)['then'](handleEntityNotFound(_0x45d88e,null))[_0x6e48('0x23')](function(_0x260192){if(_0x260192){_0xc9488=_0x260192;return db[_0x6e48('0x63')][_0x6e48('0x3e')]({'where':{'SessionId':{'$in':_[_0x6e48('0x2a')](_0xc9488,'id')},'ProjectId':_0xad757a[_0x6e48('0x54')]['id']},'order':_0x6e48('0x64')});}})['then'](handleEntityNotFound(_0x45d88e,null))[_0x6e48('0x23')](function(_0x33b963){if(_0x33b963){_0xdfdabb=_0x33b963;var _0x3369e7={};for(var _0x2c26a5=0x0,_0x271937=_0xdfdabb[_0x6e48('0x33')];_0x2c26a5<_0x271937;_0x2c26a5++){if(!_0x3369e7[_0x6e48('0x34')](_0xdfdabb[_0x2c26a5][_0x6e48('0x65')])){_0x3369e7[_0xdfdabb[_0x2c26a5][_0x6e48('0x65')]]=needsEncapsulation(_0xdfdabb[_0x2c26a5][_0x6e48('0x66')])?encapsulate(_0xdfdabb[_0x2c26a5][_0x6e48('0x66')]):_0xdfdabb[_0x2c26a5]['question'];}}var _0x52579f=[],_0x3c601b={};for(var _0x1218ef=0x0,_0x7e2c34=_0xc9488['length'];_0x1218ef<_0x7e2c34;_0x1218ef++){_0x3c601b={'ProjectId':_0xad757a[_0x6e48('0x54')]['id'],'SessionId':_0xc9488[_0x1218ef]['id'],'StartTime':moment(_0xc9488[_0x1218ef][_0x6e48('0x62')])[_0x6e48('0x67')](_0x6e48('0x68'))};for(var _0x32ea1c=0x0,_0x58c1ef=_0xdfdabb[_0x6e48('0x33')];_0x32ea1c<_0x58c1ef;_0x32ea1c++){if(_0xdfdabb[_0x32ea1c]['SessionId']==_0xc9488[_0x1218ef]['id']&&_0x3369e7['hasOwnProperty'](_0xdfdabb[_0x32ea1c]['questionId'])){_0x3c601b[_0x3369e7[_0xdfdabb[_0x32ea1c][_0x6e48('0x65')]]]=_0xdfdabb[_0x32ea1c][_0x6e48('0x69')];}}for(var _0x3f6006 in _0x3369e7){if(!_0x3c601b[_0x6e48('0x34')](_0x3369e7[_0x3f6006])){_0x3c601b[_0x3369e7[_0x3f6006]]=null;}}_0x52579f[_0x6e48('0x6a')](_0x3c601b);}return _0x52579f;}})[_0x6e48('0x23')](function(_0x29cd77){if(!_[_0x6e48('0x6b')](_0x29cd77)){var _0x45985f=toCsv(_0x29cd77);var _0x2641f8=Date['now']();fs['writeFileSync'](util['format'](_0x6e48('0x6c'),_0xad757a[_0x6e48('0x54')]['id'],_0x2641f8),_0x45985f);_0x45d88e['setHeader'](_0x6e48('0x6d'),_0x6e48('0x6e')+util[_0x6e48('0x67')](_0x6e48('0x6f'),_0xad757a[_0x6e48('0x54')]['id'],_0x2641f8));_0x45d88e[_0x6e48('0x70')](_0x6e48('0x71'),_0x6e48('0x72'));return _0x45d88e[_0x6e48('0x73')](util['format'](_0x6e48('0x6c'),_0xad757a[_0x6e48('0x54')]['id'],_0x2641f8));}else{return _0x45d88e[_0x6e48('0x27')](0xcc);}})[_0x6e48('0x3f')](handleError(_0x45d88e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 77bc1f4..4bde22b 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 _0xcca7=['request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','jscripty_projects','lodash','util','../../config/logger','api'];(function(_0x4cbb8e,_0x1047c8){var _0x17846f=function(_0x29e1e0){while(--_0x29e1e0){_0x4cbb8e['push'](_0x4cbb8e['shift']());}};_0x17846f(++_0x1047c8);}(_0xcca7,0x1aa));var _0x7cca=function(_0x1afe61,_0x926691){_0x1afe61=_0x1afe61-0x0;var _0x44afb4=_0xcca7[_0x1afe61];return _0x44afb4;};'use strict';var _=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var logger=require(_0x7cca('0x2'))(_0x7cca('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7cca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7cca('0x5'));var config=require(_0x7cca('0x6'));var attributes=require(_0x7cca('0x7'));module[_0x7cca('0x8')]=function(_0x1c6c95,_0xe70805){return _0x1c6c95['define']('JscriptyProject',attributes,{'tableName':_0x7cca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf13b=['jscripty_projects','lodash','moment','bluebird','request-promise','path','./jscriptyProject.attributes','exports','define'];(function(_0x535869,_0xd983e6){var _0x3e9feb=function(_0x276d8e){while(--_0x276d8e){_0x535869['push'](_0x535869['shift']());}};_0x3e9feb(++_0xd983e6);}(_0xf13b,0x1f0));var _0xbf13=function(_0xea25aa,_0x4c3a90){_0xea25aa=_0xea25aa-0x0;var _0x45c7ac=_0xf13b[_0xea25aa];return _0x45c7ac;};'use strict';var _=require(_0xbf13('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xbf13('0x1'));var BPromise=require(_0xbf13('0x2'));var rp=require(_0xbf13('0x3'));var fs=require('fs');var path=require(_0xbf13('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbf13('0x5'));module[_0xbf13('0x6')]=function(_0x5f4b13,_0x325b03){return _0x5f4b13[_0xbf13('0x7')]('JscriptyProject',attributes,{'tableName':_0xbf13('0x8'),'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 4c82103..50f4f53 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 _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x15a6fe,_0x5caffa){var _0x2a84e5=function(_0x1f0321){while(--_0x1f0321){_0x15a6fe['push'](_0x15a6fe['shift']());}};_0x2a84e5(++_0x5caffa);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac4a,0x13f));var _0xaac4=function(_0x4c7ddf,_0x3ede13){_0x4c7ddf=_0x4c7ddf-0x0;var _0x32e25=_0xac4a[_0x4c7ddf];return _0x32e25;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 8a30143..ce257df 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 _0x1d6c=['create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1e0844,_0x2440df){var _0x32473f=function(_0x52fbfe){while(--_0x52fbfe){_0x1e0844['push'](_0x1e0844['shift']());}};_0x32473f(++_0x2440df);}(_0x1d6c,0x13f));var _0xc1d6=function(_0x2713bd,_0x1a3841){_0x2713bd=_0x2713bd-0x0;var _0x498e9e=_0x1d6c[_0x2713bd];return _0x498e9e;};'use strict';var multer=require(_0xc1d6('0x0'));var util=require(_0xc1d6('0x1'));var path=require(_0xc1d6('0x2'));var timeout=require(_0xc1d6('0x3'));var express=require(_0xc1d6('0x4'));var router=express[_0xc1d6('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc1d6('0x6'));var config=require(_0xc1d6('0x7'));var controller=require(_0xc1d6('0x8'));router[_0xc1d6('0x9')]('/',auth[_0xc1d6('0xa')](),controller[_0xc1d6('0xb')]);router['get'](_0xc1d6('0xc'),auth[_0xc1d6('0xa')](),controller[_0xc1d6('0xd')]);router[_0xc1d6('0x9')](_0xc1d6('0xe'),auth[_0xc1d6('0xa')](),controller[_0xc1d6('0xf')]);router[_0xc1d6('0x10')]('/',auth[_0xc1d6('0xa')](),controller[_0xc1d6('0x11')]);router[_0xc1d6('0x12')](_0xc1d6('0xe'),auth[_0xc1d6('0xa')](),controller['update']);router['delete'](_0xc1d6('0xe'),auth['isAuthenticated'](),controller[_0xc1d6('0x13')]);module[_0xc1d6('0x14')]=router; \ No newline at end of file +var _0xa478=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','delete','destroy','exports'];(function(_0x352240,_0xa44eb6){var _0x1ddaed=function(_0x2dd4ec){while(--_0x2dd4ec){_0x352240['push'](_0x352240['shift']());}};_0x1ddaed(++_0xa44eb6);}(_0xa478,0x17a));var _0x8a47=function(_0x4da382,_0x4cfc5d){_0x4da382=_0x4da382-0x0;var _0x10073f=_0xa478[_0x4da382];return _0x10073f;};'use strict';var multer=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var path=require(_0x8a47('0x2'));var timeout=require(_0x8a47('0x3'));var express=require(_0x8a47('0x4'));var router=express[_0x8a47('0x5')]();var fs_extra=require(_0x8a47('0x6'));var auth=require(_0x8a47('0x7'));var interaction=require(_0x8a47('0x8'));var config=require(_0x8a47('0x9'));var controller=require('./jscriptyQuestionReport.controller');router[_0x8a47('0xa')]('/',auth[_0x8a47('0xb')](),controller[_0x8a47('0xc')]);router[_0x8a47('0xa')]('/describe',auth[_0x8a47('0xb')](),controller[_0x8a47('0xd')]);router[_0x8a47('0xa')](_0x8a47('0xe'),auth[_0x8a47('0xb')](),controller[_0x8a47('0xf')]);router['post']('/',auth[_0x8a47('0xb')](),controller[_0x8a47('0x10')]);router[_0x8a47('0x11')](_0x8a47('0xe'),auth[_0x8a47('0xb')](),controller['update']);router[_0x8a47('0x12')]('/:id',auth[_0x8a47('0xb')](),controller[_0x8a47('0x13')]);module[_0x8a47('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 2dffd02..889d6d8 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(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7a54,0x106));var _0x47a5=function(_0x2aa58f,_0x260e1f){_0x2aa58f=_0x2aa58f-0x0;var _0x25cf5e=_0x7a54[_0x2aa58f];return _0x25cf5e;};'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(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0x1e3fb0,_0x2ef480){_0x1e3fb0=_0x1e3fb0-0x0;var _0x50b664=_0x7a54[_0x1e3fb0];return _0x50b664;};'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 8e02de7..3167431 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 _0x40f5=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','update','then','error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','keys','filters','attributes','model','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','params','intersection','options','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x56608c,_0x29eb74){var _0x3c7fb0=function(_0x154b1c){while(--_0x154b1c){_0x56608c['push'](_0x56608c['shift']());}};_0x3c7fb0(++_0x29eb74);}(_0x40f5,0xc7));var _0x540f=function(_0x5c7055,_0x550d42){_0x5c7055=_0x5c7055-0x0;var _0x20d196=_0x40f5[_0x5c7055];return _0x20d196;};'use strict';var emlformat=require(_0x540f('0x0'));var rimraf=require(_0x540f('0x1'));var zipdir=require(_0x540f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x540f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x540f('0x4'));var util=require('util');var path=require(_0x540f('0x5'));var sox=require(_0x540f('0x6'));var csv=require(_0x540f('0x7'));var ejs=require(_0x540f('0x8'));var fs=require('fs');var fs_extra=require(_0x540f('0x9'));var _=require(_0x540f('0xa'));var squel=require('squel');var crypto=require(_0x540f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x540f('0xc'));var toCsv=require(_0x540f('0x7'));var querystring=require(_0x540f('0xd'));var Papa=require(_0x540f('0xe'));var Redis=require(_0x540f('0xf'));var authService=require(_0x540f('0x10'));var qs=require(_0x540f('0x11'));var as=require(_0x540f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x540f('0x13'));var config=require(_0x540f('0x14'));var licenseUtil=require(_0x540f('0x15'));var db=require(_0x540f('0x16'))['db'];function respondWithStatusCode(_0x16ceed,_0x6e0b1f){_0x6e0b1f=_0x6e0b1f||0xcc;return function(_0x14bb64){if(_0x14bb64){return _0x16ceed[_0x540f('0x17')](_0x6e0b1f);}return _0x16ceed[_0x540f('0x18')](_0x6e0b1f)[_0x540f('0x19')]();};}function respondWithResult(_0x427738,_0x259330){_0x259330=_0x259330||0xc8;return function(_0x4f408f){if(_0x4f408f){return _0x427738[_0x540f('0x18')](_0x259330)[_0x540f('0x1a')](_0x4f408f);}};}function respondWithFilteredResult(_0x40a664,_0x2a1a8d){return function(_0x194b0a){if(_0x194b0a){var _0x37b40f=typeof _0x2a1a8d[_0x540f('0x1b')]===_0x540f('0x1c')&&typeof _0x2a1a8d[_0x540f('0x1d')]===_0x540f('0x1c');var _0x33fbbb=_0x194b0a['count'];var _0x15ceca=_0x37b40f?0x0:_0x2a1a8d[_0x540f('0x1b')];var _0x3c6889=_0x37b40f?_0x194b0a['count']:_0x2a1a8d[_0x540f('0x1b')]+_0x2a1a8d[_0x540f('0x1d')];var _0x58f799;if(_0x3c6889>=_0x33fbbb){_0x3c6889=_0x33fbbb;_0x58f799=0xc8;}else{_0x58f799=0xce;}_0x40a664['status'](_0x58f799);return _0x40a664[_0x540f('0x1e')]('Content-Range',_0x15ceca+'-'+_0x3c6889+'/'+_0x33fbbb)[_0x540f('0x1a')](_0x194b0a);}return null;};}function patchUpdates(_0x1aa4d1){return function(_0x4ebec4){try{jsonpatch[_0x540f('0x1f')](_0x4ebec4,_0x1aa4d1,!![]);}catch(_0x4caea1){return BPromise[_0x540f('0x20')](_0x4caea1);}return _0x4ebec4['save']();};}function saveUpdates(_0x162658,_0x23acd4){return function(_0x320160){if(_0x320160){return _0x320160[_0x540f('0x21')](_0x162658)['then'](function(_0x4a110a){return _0x4a110a;});}return null;};}function removeEntity(_0x17198f,_0x43962b){return function(_0x447f9a){if(_0x447f9a){return _0x447f9a['destroy']()[_0x540f('0x22')](function(){_0x17198f[_0x540f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bc19f,_0x4c1ebb){return function(_0x4e0426){if(!_0x4e0426){_0x5bc19f[_0x540f('0x17')](0x194);}return _0x4e0426;};}function handleError(_0x4546a4,_0x2312d2){_0x2312d2=_0x2312d2||0x1f4;return function(_0x819e1){logger[_0x540f('0x23')](_0x819e1[_0x540f('0x24')]);if(_0x819e1[_0x540f('0x25')]){delete _0x819e1[_0x540f('0x25')];}_0x4546a4['status'](_0x2312d2)['send'](_0x819e1);};}exports[_0x540f('0x26')]=function(_0x18e716,_0xe277cd){var _0x4b6892={},_0x1c7b35={},_0x12c9b8={'count':0x0,'rows':[]};var _0x8c9858=_[_0x540f('0x27')](db[_0x540f('0x28')][_0x540f('0x29')],function(_0x166c66){return{'name':_0x166c66[_0x540f('0x2a')],'type':_0x166c66[_0x540f('0x2b')][_0x540f('0x2c')]};});_0x1c7b35['model']=_[_0x540f('0x27')](_0x8c9858,_0x540f('0x25'));_0x1c7b35[_0x540f('0x2d')]=_[_0x540f('0x2e')](_0x18e716[_0x540f('0x2d')]);_0x1c7b35[_0x540f('0x2f')]=_['intersection'](_0x1c7b35['model'],_0x1c7b35['query']);_0x4b6892[_0x540f('0x30')]=_['intersection'](_0x1c7b35[_0x540f('0x31')],qs[_0x540f('0x32')](_0x18e716[_0x540f('0x2d')][_0x540f('0x32')]));_0x4b6892['attributes']=_0x4b6892[_0x540f('0x30')]['length']?_0x4b6892['attributes']:_0x1c7b35[_0x540f('0x31')];if(!_0x18e716[_0x540f('0x2d')]['hasOwnProperty'](_0x540f('0x33'))){_0x4b6892[_0x540f('0x1d')]=qs[_0x540f('0x1d')](_0x18e716['query'][_0x540f('0x1d')]);_0x4b6892[_0x540f('0x1b')]=qs['offset'](_0x18e716[_0x540f('0x2d')][_0x540f('0x1b')]);}_0x4b6892[_0x540f('0x34')]=qs['sort'](_0x18e716[_0x540f('0x2d')][_0x540f('0x35')]);_0x4b6892[_0x540f('0x36')]=qs[_0x540f('0x2f')](_['pick'](_0x18e716['query'],_0x1c7b35['filters']),_0x8c9858);if(_0x18e716[_0x540f('0x2d')][_0x540f('0x37')]){_0x4b6892[_0x540f('0x36')]=_[_0x540f('0x38')](_0x4b6892['where'],{'$or':_[_0x540f('0x27')](_0x8c9858,function(_0x3c9ec0){if(_0x3c9ec0[_0x540f('0x2b')]!==_0x540f('0x39')){var _0x512555={};_0x512555[_0x3c9ec0[_0x540f('0x25')]]={'$like':'%'+_0x18e716[_0x540f('0x2d')][_0x540f('0x37')]+'%'};return _0x512555;}})});}_0x4b6892=_[_0x540f('0x38')]({},_0x4b6892,_0x18e716['options']);var _0x1464b4={'where':_0x4b6892['where']};return db[_0x540f('0x28')][_0x540f('0x3a')](_0x1464b4)[_0x540f('0x22')](function(_0x11836c){_0x12c9b8[_0x540f('0x3a')]=_0x11836c;if(_0x18e716[_0x540f('0x2d')][_0x540f('0x3b')]){_0x4b6892[_0x540f('0x3c')]=[{'all':!![]}];}return db[_0x540f('0x28')][_0x540f('0x3d')](_0x4b6892);})[_0x540f('0x22')](function(_0x1df133){_0x12c9b8['rows']=_0x1df133;return _0x12c9b8;})[_0x540f('0x22')](respondWithFilteredResult(_0xe277cd,_0x4b6892))[_0x540f('0x3e')](handleError(_0xe277cd,null));};exports[_0x540f('0x3f')]=function(_0x5ad012,_0x1d23c4){var _0x983dba={'raw':!![],'where':{'id':_0x5ad012[_0x540f('0x40')]['id']}},_0x1ebc97={};_0x1ebc97[_0x540f('0x31')]=_[_0x540f('0x2e')](db[_0x540f('0x28')][_0x540f('0x29')]);_0x1ebc97[_0x540f('0x2d')]=_[_0x540f('0x2e')](_0x5ad012[_0x540f('0x2d')]);_0x1ebc97['filters']=_[_0x540f('0x41')](_0x1ebc97['model'],_0x1ebc97[_0x540f('0x2d')]);_0x983dba[_0x540f('0x30')]=_[_0x540f('0x41')](_0x1ebc97['model'],qs[_0x540f('0x32')](_0x5ad012[_0x540f('0x2d')]['fields']));_0x983dba[_0x540f('0x30')]=_0x983dba['attributes']['length']?_0x983dba[_0x540f('0x30')]:_0x1ebc97[_0x540f('0x31')];if(_0x5ad012[_0x540f('0x2d')][_0x540f('0x3b')]){_0x983dba[_0x540f('0x3c')]=[{'all':!![]}];}_0x983dba=_['merge']({},_0x983dba,_0x5ad012[_0x540f('0x42')]);return db[_0x540f('0x28')]['find'](_0x983dba)[_0x540f('0x22')](handleEntityNotFound(_0x1d23c4,null))[_0x540f('0x22')](respondWithResult(_0x1d23c4,null))['catch'](handleError(_0x1d23c4,null));};exports[_0x540f('0x43')]=function(_0x298c01,_0x120815){return db[_0x540f('0x28')][_0x540f('0x43')](_0x298c01[_0x540f('0x44')],{})[_0x540f('0x22')](respondWithResult(_0x120815,0xc9))[_0x540f('0x3e')](handleError(_0x120815,null));};exports['update']=function(_0x3ae23b,_0xed47ed){if(_0x3ae23b[_0x540f('0x44')]['id']){delete _0x3ae23b[_0x540f('0x44')]['id'];}return db['JscriptyQuestionReport'][_0x540f('0x45')]({'where':{'id':_0x3ae23b['params']['id']}})[_0x540f('0x22')](handleEntityNotFound(_0xed47ed,null))[_0x540f('0x22')](saveUpdates(_0x3ae23b['body'],null))[_0x540f('0x22')](respondWithResult(_0xed47ed,null))[_0x540f('0x3e')](handleError(_0xed47ed,null));};exports[_0x540f('0x46')]=function(_0x1a337c,_0x397642){return db[_0x540f('0x28')][_0x540f('0x45')]({'where':{'id':_0x1a337c['params']['id']}})[_0x540f('0x22')](handleEntityNotFound(_0x397642,null))[_0x540f('0x22')](removeEntity(_0x397642,null))['catch'](handleError(_0x397642,null));};exports[_0x540f('0x47')]=function(_0x4b15a2,_0xd5bf07){return db['JscriptyQuestionReport'][_0x540f('0x47')]()[_0x540f('0x22')](respondWithResult(_0xd5bf07,null))['catch'](handleError(_0xd5bf07,null));}; \ No newline at end of file +var _0xe703=['include','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','rows','catch','show','params','includeAll'];(function(_0x20c881,_0x413bbb){var _0x4bf4ec=function(_0x418043){while(--_0x418043){_0x20c881['push'](_0x20c881['shift']());}};_0x4bf4ec(++_0x413bbb);}(_0xe703,0x16c));var _0x3e70=function(_0x21cbcd,_0x4ba851){_0x21cbcd=_0x21cbcd-0x0;var _0x59a138=_0xe703[_0x21cbcd];return _0x59a138;};'use strict';var emlformat=require(_0x3e70('0x0'));var rimraf=require(_0x3e70('0x1'));var zipdir=require(_0x3e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3e70('0x3'));var BPromise=require(_0x3e70('0x4'));var Mustache=require(_0x3e70('0x5'));var util=require(_0x3e70('0x6'));var path=require(_0x3e70('0x7'));var sox=require('sox');var csv=require(_0x3e70('0x8'));var ejs=require(_0x3e70('0x9'));var fs=require('fs');var fs_extra=require(_0x3e70('0xa'));var _=require('lodash');var squel=require(_0x3e70('0xb'));var crypto=require(_0x3e70('0xc'));var jsforce=require(_0x3e70('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3e70('0x8'));var querystring=require(_0x3e70('0xe'));var Papa=require(_0x3e70('0xf'));var Redis=require('ioredis');var authService=require(_0x3e70('0x10'));var qs=require(_0x3e70('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e70('0x12'));var logger=require(_0x3e70('0x13'))(_0x3e70('0x14'));var utils=require(_0x3e70('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3e70('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x380f38,_0x549666){_0x549666=_0x549666||0xcc;return function(_0x11e13b){if(_0x11e13b){return _0x380f38['sendStatus'](_0x549666);}return _0x380f38[_0x3e70('0x17')](_0x549666)[_0x3e70('0x18')]();};}function respondWithResult(_0x20ba89,_0x25afed){_0x25afed=_0x25afed||0xc8;return function(_0x33789d){if(_0x33789d){return _0x20ba89[_0x3e70('0x17')](_0x25afed)[_0x3e70('0x19')](_0x33789d);}};}function respondWithFilteredResult(_0x4c09c7,_0x4ad229){return function(_0x611a1c){if(_0x611a1c){var _0x15e487=typeof _0x4ad229[_0x3e70('0x1a')]===_0x3e70('0x1b')&&typeof _0x4ad229[_0x3e70('0x1c')]===_0x3e70('0x1b');var _0x59fec6=_0x611a1c['count'];var _0x31f9b1=_0x15e487?0x0:_0x4ad229['offset'];var _0xe5e824=_0x15e487?_0x611a1c[_0x3e70('0x1d')]:_0x4ad229[_0x3e70('0x1a')]+_0x4ad229[_0x3e70('0x1c')];var _0x595f6e;if(_0xe5e824>=_0x59fec6){_0xe5e824=_0x59fec6;_0x595f6e=0xc8;}else{_0x595f6e=0xce;}_0x4c09c7[_0x3e70('0x17')](_0x595f6e);return _0x4c09c7['set'](_0x3e70('0x1e'),_0x31f9b1+'-'+_0xe5e824+'/'+_0x59fec6)['json'](_0x611a1c);}return null;};}function patchUpdates(_0x22154e){return function(_0xe18cce){try{jsonpatch['apply'](_0xe18cce,_0x22154e,!![]);}catch(_0x50f833){return BPromise[_0x3e70('0x1f')](_0x50f833);}return _0xe18cce[_0x3e70('0x20')]();};}function saveUpdates(_0x2cf275,_0x2f1299){return function(_0x2036bf){if(_0x2036bf){return _0x2036bf[_0x3e70('0x21')](_0x2cf275)['then'](function(_0x58c4d1){return _0x58c4d1;});}return null;};}function removeEntity(_0x3c4aee,_0xb2315b){return function(_0x2a42be){if(_0x2a42be){return _0x2a42be[_0x3e70('0x22')]()[_0x3e70('0x23')](function(){_0x3c4aee[_0x3e70('0x17')](0xcc)[_0x3e70('0x18')]();});}};}function handleEntityNotFound(_0x367b8d,_0x2bc5be){return function(_0x104809){if(!_0x104809){_0x367b8d[_0x3e70('0x24')](0x194);}return _0x104809;};}function handleError(_0x5da023,_0x49d815){_0x49d815=_0x49d815||0x1f4;return function(_0xb25eb3){logger[_0x3e70('0x25')](_0xb25eb3[_0x3e70('0x26')]);if(_0xb25eb3['name']){delete _0xb25eb3[_0x3e70('0x27')];}_0x5da023['status'](_0x49d815)[_0x3e70('0x28')](_0xb25eb3);};}exports['index']=function(_0x5c4b99,_0x2e48f7){var _0x4c76d6={},_0x50c3b8={},_0x175708={'count':0x0,'rows':[]};var _0x42f7fb=_[_0x3e70('0x29')](db[_0x3e70('0x2a')][_0x3e70('0x2b')],function(_0x91eafe){return{'name':_0x91eafe[_0x3e70('0x2c')],'type':_0x91eafe[_0x3e70('0x2d')]['key']};});_0x50c3b8[_0x3e70('0x2e')]=_['map'](_0x42f7fb,_0x3e70('0x27'));_0x50c3b8[_0x3e70('0x2f')]=_[_0x3e70('0x30')](_0x5c4b99['query']);_0x50c3b8['filters']=_[_0x3e70('0x31')](_0x50c3b8['model'],_0x50c3b8[_0x3e70('0x2f')]);_0x4c76d6[_0x3e70('0x32')]=_[_0x3e70('0x31')](_0x50c3b8['model'],qs[_0x3e70('0x33')](_0x5c4b99['query'][_0x3e70('0x33')]));_0x4c76d6[_0x3e70('0x32')]=_0x4c76d6[_0x3e70('0x32')][_0x3e70('0x34')]?_0x4c76d6[_0x3e70('0x32')]:_0x50c3b8[_0x3e70('0x2e')];if(!_0x5c4b99[_0x3e70('0x2f')][_0x3e70('0x35')](_0x3e70('0x36'))){_0x4c76d6[_0x3e70('0x1c')]=qs[_0x3e70('0x1c')](_0x5c4b99['query'][_0x3e70('0x1c')]);_0x4c76d6[_0x3e70('0x1a')]=qs[_0x3e70('0x1a')](_0x5c4b99['query']['offset']);}_0x4c76d6[_0x3e70('0x37')]=qs['sort'](_0x5c4b99[_0x3e70('0x2f')][_0x3e70('0x38')]);_0x4c76d6[_0x3e70('0x39')]=qs[_0x3e70('0x3a')](_[_0x3e70('0x3b')](_0x5c4b99['query'],_0x50c3b8[_0x3e70('0x3a')]),_0x42f7fb);if(_0x5c4b99['query'][_0x3e70('0x3c')]){_0x4c76d6[_0x3e70('0x39')]=_[_0x3e70('0x3d')](_0x4c76d6[_0x3e70('0x39')],{'$or':_[_0x3e70('0x29')](_0x42f7fb,function(_0x10ab54){if(_0x10ab54[_0x3e70('0x2d')]!=='VIRTUAL'){var _0x2f41d9={};_0x2f41d9[_0x10ab54['name']]={'$like':'%'+_0x5c4b99['query'][_0x3e70('0x3c')]+'%'};return _0x2f41d9;}})});}_0x4c76d6=_[_0x3e70('0x3d')]({},_0x4c76d6,_0x5c4b99[_0x3e70('0x3e')]);var _0x12e07f={'where':_0x4c76d6[_0x3e70('0x39')]};return db[_0x3e70('0x2a')][_0x3e70('0x1d')](_0x12e07f)['then'](function(_0x238fed){_0x175708[_0x3e70('0x1d')]=_0x238fed;if(_0x5c4b99[_0x3e70('0x2f')]['includeAll']){_0x4c76d6['include']=[{'all':!![]}];}return db[_0x3e70('0x2a')]['findAll'](_0x4c76d6);})['then'](function(_0x1e084a){_0x175708[_0x3e70('0x3f')]=_0x1e084a;return _0x175708;})[_0x3e70('0x23')](respondWithFilteredResult(_0x2e48f7,_0x4c76d6))[_0x3e70('0x40')](handleError(_0x2e48f7,null));};exports[_0x3e70('0x41')]=function(_0x117944,_0x561a03){var _0x412222={'raw':!![],'where':{'id':_0x117944[_0x3e70('0x42')]['id']}},_0x193fcb={};_0x193fcb[_0x3e70('0x2e')]=_[_0x3e70('0x30')](db[_0x3e70('0x2a')][_0x3e70('0x2b')]);_0x193fcb[_0x3e70('0x2f')]=_[_0x3e70('0x30')](_0x117944[_0x3e70('0x2f')]);_0x193fcb['filters']=_['intersection'](_0x193fcb[_0x3e70('0x2e')],_0x193fcb['query']);_0x412222[_0x3e70('0x32')]=_[_0x3e70('0x31')](_0x193fcb[_0x3e70('0x2e')],qs['fields'](_0x117944['query']['fields']));_0x412222[_0x3e70('0x32')]=_0x412222[_0x3e70('0x32')][_0x3e70('0x34')]?_0x412222[_0x3e70('0x32')]:_0x193fcb['model'];if(_0x117944['query'][_0x3e70('0x43')]){_0x412222[_0x3e70('0x44')]=[{'all':!![]}];}_0x412222=_[_0x3e70('0x3d')]({},_0x412222,_0x117944['options']);return db[_0x3e70('0x2a')][_0x3e70('0x45')](_0x412222)[_0x3e70('0x23')](handleEntityNotFound(_0x561a03,null))['then'](respondWithResult(_0x561a03,null))['catch'](handleError(_0x561a03,null));};exports[_0x3e70('0x46')]=function(_0x34ea88,_0x6a3193){return db[_0x3e70('0x2a')][_0x3e70('0x46')](_0x34ea88[_0x3e70('0x47')],{})[_0x3e70('0x23')](respondWithResult(_0x6a3193,0xc9))['catch'](handleError(_0x6a3193,null));};exports[_0x3e70('0x21')]=function(_0x27866b,_0x4948b2){if(_0x27866b[_0x3e70('0x47')]['id']){delete _0x27866b[_0x3e70('0x47')]['id'];}return db['JscriptyQuestionReport'][_0x3e70('0x45')]({'where':{'id':_0x27866b[_0x3e70('0x42')]['id']}})[_0x3e70('0x23')](handleEntityNotFound(_0x4948b2,null))[_0x3e70('0x23')](saveUpdates(_0x27866b[_0x3e70('0x47')],null))[_0x3e70('0x23')](respondWithResult(_0x4948b2,null))[_0x3e70('0x40')](handleError(_0x4948b2,null));};exports[_0x3e70('0x22')]=function(_0x37839c,_0xc1962e){return db['JscriptyQuestionReport'][_0x3e70('0x45')]({'where':{'id':_0x37839c[_0x3e70('0x42')]['id']}})['then'](handleEntityNotFound(_0xc1962e,null))[_0x3e70('0x23')](removeEntity(_0xc1962e,null))[_0x3e70('0x40')](handleError(_0xc1962e,null));};exports['describe']=function(_0x3898d7,_0x52cd41){return db[_0x3e70('0x2a')]['describe']()[_0x3e70('0x23')](respondWithResult(_0x52cd41,null))[_0x3e70('0x40')](handleError(_0x52cd41,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 05a3052..900693a 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 _0xd742=['exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x36d203,_0x3653f3){var _0x2f9e62=function(_0x461a77){while(--_0x461a77){_0x36d203['push'](_0x36d203['shift']());}};_0x2f9e62(++_0x3653f3);}(_0xd742,0xe7));var _0x2d74=function(_0x285894,_0x389b26){_0x285894=_0x285894-0x0;var _0x5f3a98=_0xd742[_0x285894];return _0x5f3a98;};'use strict';var _=require(_0x2d74('0x0'));var util=require(_0x2d74('0x1'));var logger=require(_0x2d74('0x2'))(_0x2d74('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2d74('0x4'));var fs=require('fs');var path=require(_0x2d74('0x5'));var rimraf=require(_0x2d74('0x6'));var config=require(_0x2d74('0x7'));var attributes=require(_0x2d74('0x8'));module[_0x2d74('0x9')]=function(_0x11d174,_0x236506){return _0x11d174['define'](_0x2d74('0xa'),attributes,{'tableName':_0x2d74('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfdc=['path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x403cbb,_0x117019){var _0x566496=function(_0x59addd){while(--_0x59addd){_0x403cbb['push'](_0x403cbb['shift']());}};_0x566496(++_0x117019);}(_0xbfdc,0x1db));var _0xcbfd=function(_0x3995b4,_0x57beb0){_0x3995b4=_0x3995b4-0x0;var _0x400ee5=_0xbfdc[_0x3995b4];return _0x400ee5;};'use strict';var _=require(_0xcbfd('0x0'));var util=require(_0xcbfd('0x1'));var logger=require(_0xcbfd('0x2'))('api');var moment=require(_0xcbfd('0x3'));var BPromise=require(_0xcbfd('0x4'));var rp=require(_0xcbfd('0x5'));var fs=require('fs');var path=require(_0xcbfd('0x6'));var rimraf=require(_0xcbfd('0x7'));var config=require(_0xcbfd('0x8'));var attributes=require(_0xcbfd('0x9'));module['exports']=function(_0x56e235,_0x510040){return _0x56e235[_0xcbfd('0xa')](_0xcbfd('0xb'),attributes,{'tableName':_0xcbfd('0xc'),'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 3b91135..d3c30de 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 _0x14cf=['../../config/logger','../../config/environment','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x14cf,0xfa));var _0xf14c=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x14cf[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf14c('0x0'));var BPromise=require(_0xf14c('0x1'));var rs=require(_0xf14c('0x2'));var fs=require('fs');var Redis=require(_0xf14c('0x3'));var db=require(_0xf14c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf14c('0x5'))('rpc');var config=require(_0xf14c('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30af6a,_0xdcfaa4,_0x20dac4){return new BPromise(function(_0x1fa58,_0x2cbe99){return client['request'](_0x30af6a,_0x20dac4)[_0xf14c('0x7')](function(_0x58418a){logger[_0xf14c('0x8')](_0xf14c('0x9'),_0xdcfaa4,_0xf14c('0xa'));logger[_0xf14c('0xb')](_0xf14c('0xc'),_0xdcfaa4,_0xf14c('0xa'),JSON[_0xf14c('0xd')](_0x58418a));if(_0x58418a[_0xf14c('0xe')]){if(_0x58418a[_0xf14c('0xe')]['code']===0x1f4){logger[_0xf14c('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xdcfaa4,_0x58418a['error']['message']);return _0x2cbe99(_0x58418a[_0xf14c('0xe')][_0xf14c('0xf')]);}logger[_0xf14c('0xe')](_0xf14c('0x9'),_0xdcfaa4,_0x58418a[_0xf14c('0xe')]['message']);return _0x1fa58(_0x58418a['error']['message']);}else{logger[_0xf14c('0x8')](_0xf14c('0x9'),_0xdcfaa4,'request\x20sent');_0x1fa58(_0x58418a[_0xf14c('0x10')]['message']);}})['catch'](function(_0x522cbd){logger['error'](_0xf14c('0x9'),_0xdcfaa4,_0x522cbd);_0x2cbe99(_0x522cbd);});});} \ No newline at end of file +var _0x1d61=['request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x2eb471,_0xc0df4b){var _0x5afe58=function(_0x38253d){while(--_0x38253d){_0x2eb471['push'](_0x2eb471['shift']());}};_0x5afe58(++_0xc0df4b);}(_0x1d61,0x155));var _0x11d6=function(_0xc7d28b,_0x4356fd){_0xc7d28b=_0xc7d28b-0x0;var _0xc43797=_0x1d61[_0xc7d28b];return _0xc43797;};'use strict';var _=require(_0x11d6('0x0'));var util=require(_0x11d6('0x1'));var moment=require(_0x11d6('0x2'));var BPromise=require('bluebird');var rs=require(_0x11d6('0x3'));var fs=require('fs');var Redis=require(_0x11d6('0x4'));var db=require(_0x11d6('0x5'))['db'];var utils=require(_0x11d6('0x6'));var logger=require(_0x11d6('0x7'))(_0x11d6('0x8'));var config=require('../../config/environment');var jayson=require(_0x11d6('0x9'));var client=jayson[_0x11d6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x177bc4,_0x3d7bc8,_0x1a4348){return new BPromise(function(_0x12942a,_0x35daa2){return client[_0x11d6('0xb')](_0x177bc4,_0x1a4348)[_0x11d6('0xc')](function(_0xcd31d5){logger[_0x11d6('0xd')](_0x11d6('0xe'),_0x3d7bc8,_0x11d6('0xf'));logger[_0x11d6('0x10')](_0x11d6('0x11'),_0x3d7bc8,'request\x20sent',JSON[_0x11d6('0x12')](_0xcd31d5));if(_0xcd31d5[_0x11d6('0x13')]){if(_0xcd31d5[_0x11d6('0x13')]['code']===0x1f4){logger[_0x11d6('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3d7bc8,_0xcd31d5[_0x11d6('0x13')][_0x11d6('0x14')]);return _0x35daa2(_0xcd31d5[_0x11d6('0x13')][_0x11d6('0x14')]);}logger[_0x11d6('0x13')](_0x11d6('0xe'),_0x3d7bc8,_0xcd31d5[_0x11d6('0x13')][_0x11d6('0x14')]);return _0x12942a(_0xcd31d5[_0x11d6('0x13')]['message']);}else{logger[_0x11d6('0xd')](_0x11d6('0xe'),_0x3d7bc8,_0x11d6('0xf'));_0x12942a(_0xcd31d5['result'][_0x11d6('0x14')]);}})[_0x11d6('0x15')](function(_0x177f94){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x3d7bc8,_0x177f94);_0x35daa2(_0x177f94);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 737fe4e..4f7d9ea 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 _0x0bc6=['getQuestions','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/questions'];(function(_0x3e8cae,_0x4cb96a){var _0x45c4d6=function(_0x4bf3a5){while(--_0x4bf3a5){_0x3e8cae['push'](_0x3e8cae['shift']());}};_0x45c4d6(++_0x4cb96a);}(_0x0bc6,0xbf));var _0x60bc=function(_0x38ac7b,_0x2dc75f){_0x38ac7b=_0x38ac7b-0x0;var _0x2c3cd5=_0x0bc6[_0x38ac7b];return _0x2c3cd5;};'use strict';var multer=require(_0x60bc('0x0'));var util=require(_0x60bc('0x1'));var path=require(_0x60bc('0x2'));var timeout=require(_0x60bc('0x3'));var express=require(_0x60bc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x60bc('0x5'));var interaction=require(_0x60bc('0x6'));var config=require('../../config/environment');var controller=require(_0x60bc('0x7'));router[_0x60bc('0x8')]('/',auth['isAuthenticated'](),controller[_0x60bc('0x9')]);router[_0x60bc('0x8')](_0x60bc('0xa'),auth[_0x60bc('0xb')](),controller[_0x60bc('0xc')]);router[_0x60bc('0x8')](_0x60bc('0xd'),auth[_0x60bc('0xb')](),controller[_0x60bc('0xe')]);router[_0x60bc('0x8')](_0x60bc('0xf'),auth['isAuthenticated'](),controller[_0x60bc('0x10')]);router[_0x60bc('0x11')]('/',auth['isAuthenticated'](),controller[_0x60bc('0x12')]);router[_0x60bc('0x13')](_0x60bc('0xd'),auth[_0x60bc('0xb')](),controller[_0x60bc('0x14')]);router['delete'](_0x60bc('0xd'),auth[_0x60bc('0xb')](),controller[_0x60bc('0x15')]);module[_0x60bc('0x16')]=router; \ No newline at end of file +var _0xaab6=['/:id/questions','create','put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x422d23,_0x3a9056){var _0x465a26=function(_0x4d796e){while(--_0x4d796e){_0x422d23['push'](_0x422d23['shift']());}};_0x465a26(++_0x3a9056);}(_0xaab6,0x132));var _0x6aab=function(_0x260ebf,_0x31c14d){_0x260ebf=_0x260ebf-0x0;var _0x1124a4=_0xaab6[_0x260ebf];return _0x1124a4;};'use strict';var multer=require(_0x6aab('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6aab('0x1'));var express=require(_0x6aab('0x2'));var router=express[_0x6aab('0x3')]();var fs_extra=require(_0x6aab('0x4'));var auth=require(_0x6aab('0x5'));var interaction=require(_0x6aab('0x6'));var config=require(_0x6aab('0x7'));var controller=require(_0x6aab('0x8'));router[_0x6aab('0x9')]('/',auth[_0x6aab('0xa')](),controller[_0x6aab('0xb')]);router['get'](_0x6aab('0xc'),auth[_0x6aab('0xa')](),controller['describe']);router[_0x6aab('0x9')](_0x6aab('0xd'),auth[_0x6aab('0xa')](),controller['show']);router[_0x6aab('0x9')](_0x6aab('0xe'),auth['isAuthenticated'](),controller['getQuestions']);router['post']('/',auth['isAuthenticated'](),controller[_0x6aab('0xf')]);router[_0x6aab('0x10')](_0x6aab('0xd'),auth[_0x6aab('0xa')](),controller[_0x6aab('0x11')]);router[_0x6aab('0x12')](_0x6aab('0xd'),auth['isAuthenticated'](),controller[_0x6aab('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index b2be94e..e648148 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 _0x9e92=['STRING','BOOLEAN','moment','sequelize','exports','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0xb66df,_0x4fb5ce){var _0x42a702=function(_0x252d1d){while(--_0x252d1d){_0xb66df['push'](_0xb66df['shift']());}};_0x42a702(++_0x4fb5ce);}(_0x9e92,0xac));var _0x29e9=function(_0x413f2e,_0x23224f){_0x413f2e=_0x413f2e-0x0;var _0x2a4c1f=_0x9e92[_0x413f2e];return _0x2a4c1f;};'use strict';var moment=require(_0x29e9('0x0'));var Sequelize=require(_0x29e9('0x1'));module[_0x29e9('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x273fdd){this[_0x29e9('0x3')]('starttime',_0x273fdd);this['setDataValue'](_0x29e9('0x4'),moment()[_0x29e9('0x5')](_0x29e9('0x6')));}},'endtime':{'type':Sequelize[_0x29e9('0x7')]},'membername':{'type':Sequelize[_0x29e9('0x8')]},'projectname':{'type':Sequelize[_0x29e9('0x8')]},'queue':{'type':Sequelize[_0x29e9('0x8')]},'uniqueid':{'type':Sequelize[_0x29e9('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x29e9('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x9539=['moment','sequelize','exports','DATE','starttime','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x49cb71,_0x2f0149){var _0x3a50fd=function(_0x48c304){while(--_0x48c304){_0x49cb71['push'](_0x49cb71['shift']());}};_0x3a50fd(++_0x2f0149);}(_0x9539,0x176));var _0x9953=function(_0x130393,_0x348c7a){_0x130393=_0x130393-0x0;var _0x22cd98=_0x9539[_0x130393];return _0x22cd98;};'use strict';var moment=require(_0x9953('0x0'));var Sequelize=require(_0x9953('0x1'));module[_0x9953('0x2')]={'starttime':{'type':Sequelize[_0x9953('0x3')],'set':function(_0x4fe597){this['setDataValue'](_0x9953('0x4'),_0x4fe597);this[_0x9953('0x5')](_0x9953('0x6'),moment()[_0x9953('0x7')](_0x9953('0x8')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x9953('0x9')]},'projectname':{'type':Sequelize[_0x9953('0x9')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9953('0x9')]},'calleridname':{'type':Sequelize[_0x9953('0x9')]},'calleridnum':{'type':Sequelize[_0x9953('0x9')]},'completed':{'type':Sequelize[_0x9953('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index ee4b3e5..8b5fc2d 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 _0xe72b=['../../config/environment','../../config/license/util','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','keys','find','create','body','describe','JscriptyQuestionReport','rawAttributes','nolimit','order','SessionId','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xe72b,0xe5));var _0xbe72=function(_0x5cbace,_0x33943c){_0x5cbace=_0x5cbace-0x0;var _0x6de5b8=_0xe72b[_0x5cbace];return _0x6de5b8;};'use strict';var emlformat=require(_0xbe72('0x0'));var rimraf=require(_0xbe72('0x1'));var zipdir=require(_0xbe72('0x2'));var jsonpatch=require(_0xbe72('0x3'));var rp=require(_0xbe72('0x4'));var moment=require(_0xbe72('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbe72('0x6'));var util=require(_0xbe72('0x7'));var path=require(_0xbe72('0x8'));var sox=require(_0xbe72('0x9'));var csv=require(_0xbe72('0xa'));var ejs=require(_0xbe72('0xb'));var fs=require('fs');var fs_extra=require(_0xbe72('0xc'));var _=require(_0xbe72('0xd'));var squel=require(_0xbe72('0xe'));var crypto=require(_0xbe72('0xf'));var jsforce=require(_0xbe72('0x10'));var deskjs=require(_0xbe72('0x11'));var toCsv=require(_0xbe72('0xa'));var querystring=require(_0xbe72('0x12'));var Papa=require('papaparse');var Redis=require(_0xbe72('0x13'));var authService=require(_0xbe72('0x14'));var qs=require(_0xbe72('0x15'));var as=require(_0xbe72('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe72('0x17'))(_0xbe72('0x18'));var utils=require(_0xbe72('0x19'));var config=require(_0xbe72('0x1a'));var licenseUtil=require(_0xbe72('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x466716,_0x5ac66d){_0x5ac66d=_0x5ac66d||0xcc;return function(_0x83b8f){if(_0x83b8f){return _0x466716['sendStatus'](_0x5ac66d);}return _0x466716[_0xbe72('0x1c')](_0x5ac66d)['end']();};}function respondWithResult(_0x3a0bfc,_0x25c886){_0x25c886=_0x25c886||0xc8;return function(_0x1ec09e){if(_0x1ec09e){return _0x3a0bfc[_0xbe72('0x1c')](_0x25c886)[_0xbe72('0x1d')](_0x1ec09e);}};}function respondWithFilteredResult(_0x397763,_0x454326){return function(_0x36bba0){if(_0x36bba0){var _0x1bc671=typeof _0x454326[_0xbe72('0x1e')]===_0xbe72('0x1f')&&typeof _0x454326['limit']===_0xbe72('0x1f');var _0x589350=_0x36bba0[_0xbe72('0x20')];var _0x2aaafe=_0x1bc671?0x0:_0x454326['offset'];var _0x136f78=_0x1bc671?_0x36bba0[_0xbe72('0x20')]:_0x454326[_0xbe72('0x1e')]+_0x454326[_0xbe72('0x21')];var _0x4964b9;if(_0x136f78>=_0x589350){_0x136f78=_0x589350;_0x4964b9=0xc8;}else{_0x4964b9=0xce;}_0x397763[_0xbe72('0x1c')](_0x4964b9);return _0x397763[_0xbe72('0x22')](_0xbe72('0x23'),_0x2aaafe+'-'+_0x136f78+'/'+_0x589350)[_0xbe72('0x1d')](_0x36bba0);}return null;};}function patchUpdates(_0x8001f2){return function(_0x4acc80){try{jsonpatch[_0xbe72('0x24')](_0x4acc80,_0x8001f2,!![]);}catch(_0xea343e){return BPromise[_0xbe72('0x25')](_0xea343e);}return _0x4acc80[_0xbe72('0x26')]();};}function saveUpdates(_0x5b2e46,_0x5a6a7f){return function(_0x597ba1){if(_0x597ba1){return _0x597ba1[_0xbe72('0x27')](_0x5b2e46)[_0xbe72('0x28')](function(_0x11eb07){return _0x11eb07;});}return null;};}function removeEntity(_0x3b8c8d,_0x52e53e){return function(_0x7ecc4e){if(_0x7ecc4e){return _0x7ecc4e[_0xbe72('0x29')]()[_0xbe72('0x28')](function(){_0x3b8c8d['status'](0xcc)[_0xbe72('0x2a')]();});}};}function handleEntityNotFound(_0x429a69,_0x25c715){return function(_0x1010ac){if(!_0x1010ac){_0x429a69[_0xbe72('0x2b')](0x194);}return _0x1010ac;};}function handleError(_0x18208b,_0x4ac3a9){_0x4ac3a9=_0x4ac3a9||0x1f4;return function(_0x45c878){logger[_0xbe72('0x2c')](_0x45c878[_0xbe72('0x2d')]);if(_0x45c878[_0xbe72('0x2e')]){delete _0x45c878[_0xbe72('0x2e')];}_0x18208b[_0xbe72('0x1c')](_0x4ac3a9)[_0xbe72('0x2f')](_0x45c878);};}exports[_0xbe72('0x30')]=function(_0x20c5ce,_0x3a42a8){var _0x11270b={},_0x3d03b7={},_0x567f93={'count':0x0,'rows':[]};var _0x124158=_[_0xbe72('0x31')](db[_0xbe72('0x32')]['rawAttributes'],function(_0x20aa69){return{'name':_0x20aa69[_0xbe72('0x33')],'type':_0x20aa69[_0xbe72('0x34')][_0xbe72('0x35')]};});_0x3d03b7[_0xbe72('0x36')]=_[_0xbe72('0x31')](_0x124158,_0xbe72('0x2e'));_0x3d03b7[_0xbe72('0x37')]=_['keys'](_0x20c5ce[_0xbe72('0x37')]);_0x3d03b7['filters']=_[_0xbe72('0x38')](_0x3d03b7[_0xbe72('0x36')],_0x3d03b7['query']);_0x11270b[_0xbe72('0x39')]=_[_0xbe72('0x38')](_0x3d03b7['model'],qs[_0xbe72('0x3a')](_0x20c5ce['query']['fields']));_0x11270b[_0xbe72('0x39')]=_0x11270b[_0xbe72('0x39')][_0xbe72('0x3b')]?_0x11270b['attributes']:_0x3d03b7[_0xbe72('0x36')];if(!_0x20c5ce[_0xbe72('0x37')][_0xbe72('0x3c')]('nolimit')){_0x11270b[_0xbe72('0x21')]=qs[_0xbe72('0x21')](_0x20c5ce[_0xbe72('0x37')]['limit']);_0x11270b['offset']=qs[_0xbe72('0x1e')](_0x20c5ce[_0xbe72('0x37')][_0xbe72('0x1e')]);}_0x11270b['order']=qs[_0xbe72('0x3d')](_0x20c5ce[_0xbe72('0x37')][_0xbe72('0x3d')]);_0x11270b[_0xbe72('0x3e')]=qs['filters'](_[_0xbe72('0x3f')](_0x20c5ce[_0xbe72('0x37')],_0x3d03b7[_0xbe72('0x40')]),_0x124158);if(_0x20c5ce['query'][_0xbe72('0x41')]){_0x11270b[_0xbe72('0x3e')]=_['merge'](_0x11270b[_0xbe72('0x3e')],{'$or':_[_0xbe72('0x31')](_0x124158,function(_0x2b7bef){if(_0x2b7bef[_0xbe72('0x34')]!==_0xbe72('0x42')){var _0x52c1d4={};_0x52c1d4[_0x2b7bef[_0xbe72('0x2e')]]={'$like':'%'+_0x20c5ce['query'][_0xbe72('0x41')]+'%'};return _0x52c1d4;}})});}_0x11270b=_[_0xbe72('0x43')]({},_0x11270b,_0x20c5ce[_0xbe72('0x44')]);var _0x27a8c2={'where':_0x11270b[_0xbe72('0x3e')]};return db[_0xbe72('0x32')][_0xbe72('0x20')](_0x27a8c2)[_0xbe72('0x28')](function(_0x1364f2){_0x567f93['count']=_0x1364f2;if(_0x20c5ce[_0xbe72('0x37')][_0xbe72('0x45')]){_0x11270b[_0xbe72('0x46')]=[{'all':!![]}];}return db[_0xbe72('0x32')][_0xbe72('0x47')](_0x11270b);})[_0xbe72('0x28')](function(_0x5d842a){_0x567f93['rows']=_0x5d842a;return _0x567f93;})[_0xbe72('0x28')](respondWithFilteredResult(_0x3a42a8,_0x11270b))[_0xbe72('0x48')](handleError(_0x3a42a8,null));};exports['show']=function(_0x496e5f,_0x4de619){var _0x5cec94={'raw':!![],'where':{'id':_0x496e5f[_0xbe72('0x49')]['id']}},_0x3a14ed={};_0x3a14ed[_0xbe72('0x36')]=_[_0xbe72('0x4a')](db[_0xbe72('0x32')]['rawAttributes']);_0x3a14ed['query']=_[_0xbe72('0x4a')](_0x496e5f[_0xbe72('0x37')]);_0x3a14ed[_0xbe72('0x40')]=_['intersection'](_0x3a14ed[_0xbe72('0x36')],_0x3a14ed[_0xbe72('0x37')]);_0x5cec94['attributes']=_[_0xbe72('0x38')](_0x3a14ed[_0xbe72('0x36')],qs['fields'](_0x496e5f[_0xbe72('0x37')]['fields']));_0x5cec94['attributes']=_0x5cec94['attributes'][_0xbe72('0x3b')]?_0x5cec94[_0xbe72('0x39')]:_0x3a14ed[_0xbe72('0x36')];if(_0x496e5f[_0xbe72('0x37')]['includeAll']){_0x5cec94['include']=[{'all':!![]}];}_0x5cec94=_[_0xbe72('0x43')]({},_0x5cec94,_0x496e5f[_0xbe72('0x44')]);return db['JscriptySessionReport'][_0xbe72('0x4b')](_0x5cec94)[_0xbe72('0x28')](handleEntityNotFound(_0x4de619,null))['then'](respondWithResult(_0x4de619,null))['catch'](handleError(_0x4de619,null));};exports[_0xbe72('0x4c')]=function(_0x2c5490,_0x2992d6){return db[_0xbe72('0x32')]['create'](_0x2c5490['body'],{})[_0xbe72('0x28')](respondWithResult(_0x2992d6,0xc9))[_0xbe72('0x48')](handleError(_0x2992d6,null));};exports[_0xbe72('0x27')]=function(_0x5bd27b,_0x2afa56){if(_0x5bd27b[_0xbe72('0x4d')]['id']){delete _0x5bd27b[_0xbe72('0x4d')]['id'];}return db[_0xbe72('0x32')][_0xbe72('0x4b')]({'where':{'id':_0x5bd27b['params']['id']}})[_0xbe72('0x28')](handleEntityNotFound(_0x2afa56,null))['then'](saveUpdates(_0x5bd27b['body'],null))['then'](respondWithResult(_0x2afa56,null))['catch'](handleError(_0x2afa56,null));};exports[_0xbe72('0x29')]=function(_0x5b9024,_0x3bd187){return db[_0xbe72('0x32')][_0xbe72('0x4b')]({'where':{'id':_0x5b9024['params']['id']}})[_0xbe72('0x28')](handleEntityNotFound(_0x3bd187,null))[_0xbe72('0x28')](removeEntity(_0x3bd187,null))[_0xbe72('0x48')](handleError(_0x3bd187,null));};exports[_0xbe72('0x4e')]=function(_0x355f4b,_0x196072){return db['JscriptySessionReport'][_0xbe72('0x4e')]()[_0xbe72('0x28')](respondWithResult(_0x196072,null))[_0xbe72('0x48')](handleError(_0x196072,null));};exports['getQuestions']=function(_0x261c6d,_0x5301e2,_0x3e6e6d){var _0x5c6b86={'raw':!![],'where':{}};var _0x2d7233={};var _0x2a5612={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x261c6d[_0xbe72('0x49')]['id']}})[_0xbe72('0x28')](handleEntityNotFound(_0x5301e2,null))['then'](function(_0x476684){if(_0x476684){_0x2d7233[_0xbe72('0x36')]=_['keys'](db[_0xbe72('0x4f')][_0xbe72('0x50')]);_0x2d7233[_0xbe72('0x37')]=_[_0xbe72('0x4a')](_0x261c6d['query']);_0x2d7233[_0xbe72('0x40')]=_[_0xbe72('0x38')](_0x2d7233[_0xbe72('0x36')],_0x2d7233[_0xbe72('0x37')]);_0x5c6b86[_0xbe72('0x39')]=_[_0xbe72('0x38')](_0x2d7233[_0xbe72('0x36')],qs[_0xbe72('0x3a')](_0x261c6d['query'][_0xbe72('0x3a')]));_0x5c6b86[_0xbe72('0x39')]=_0x5c6b86['attributes'][_0xbe72('0x3b')]?_0x5c6b86[_0xbe72('0x39')]:_0x2d7233[_0xbe72('0x36')];if(!_0x261c6d[_0xbe72('0x37')][_0xbe72('0x3c')](_0xbe72('0x51'))){_0x5c6b86[_0xbe72('0x21')]=qs['limit'](_0x261c6d['query'][_0xbe72('0x21')]);_0x5c6b86[_0xbe72('0x1e')]=qs['offset'](_0x261c6d['query'][_0xbe72('0x1e')]);}_0x5c6b86[_0xbe72('0x52')]=qs[_0xbe72('0x3d')](_0x261c6d[_0xbe72('0x37')]['sort']);_0x5c6b86['where']=qs[_0xbe72('0x40')](_[_0xbe72('0x3f')](_0x261c6d[_0xbe72('0x37')],_0x2d7233[_0xbe72('0x40')]));_0x5c6b86[_0xbe72('0x3e')][_0xbe72('0x53')]=_0x476684['id'];if(_0x261c6d[_0xbe72('0x37')][_0xbe72('0x41')]){_0x5c6b86[_0xbe72('0x3e')]=_[_0xbe72('0x43')](_0x5c6b86[_0xbe72('0x3e')],{'$or':_[_0xbe72('0x31')](_0x5c6b86['attributes'],function(_0x2ac311){var _0x287972={};_0x287972[_0x2ac311]={'$like':'%'+_0x261c6d['query'][_0xbe72('0x41')]+'%'};return _0x287972;})});}_0x5c6b86=_['merge']({},_0x5c6b86,_0x261c6d['options']);return db[_0xbe72('0x4f')][_0xbe72('0x20')]({'where':_0x5c6b86['where']})[_0xbe72('0x28')](function(_0x43cf54){_0x2a5612[_0xbe72('0x20')]=_0x43cf54;if(_0x261c6d[_0xbe72('0x37')]['includeAll']){_0x5c6b86[_0xbe72('0x46')]=[{'all':!![]}];}return db[_0xbe72('0x4f')][_0xbe72('0x47')](_0x5c6b86);})[_0xbe72('0x28')](function(_0x235b66){_0x2a5612[_0xbe72('0x54')]=_0x235b66;return _0x2a5612;});}})[_0xbe72('0x28')](respondWithFilteredResult(_0x5301e2,_0x5c6b86))[_0xbe72('0x48')](handleError(_0x5301e2,null));}; \ No newline at end of file +var _0x74e9=['key','model','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','intersection','find','create','body','destroy','describe','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','request-promise','bluebird','mustache','path','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','JscriptySessionReport'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x74e9,0x190));var _0x974e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x74e9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x974e('0x0'));var rimraf=require(_0x974e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x974e('0x2'));var moment=require('moment');var BPromise=require(_0x974e('0x3'));var Mustache=require(_0x974e('0x4'));var util=require('util');var path=require(_0x974e('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x974e('0x6'));var crypto=require(_0x974e('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x974e('0x8'));var toCsv=require(_0x974e('0x9'));var querystring=require(_0x974e('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x974e('0xb'));var as=require(_0x974e('0xc'));var hardwareService=require(_0x974e('0xd'));var logger=require(_0x974e('0xe'))(_0x974e('0xf'));var utils=require(_0x974e('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x974e('0x11'));var db=require(_0x974e('0x12'))['db'];function respondWithStatusCode(_0x3e0338,_0x5b67f7){_0x5b67f7=_0x5b67f7||0xcc;return function(_0x215a2d){if(_0x215a2d){return _0x3e0338['sendStatus'](_0x5b67f7);}return _0x3e0338[_0x974e('0x13')](_0x5b67f7)['end']();};}function respondWithResult(_0x463d5d,_0x1bbf3b){_0x1bbf3b=_0x1bbf3b||0xc8;return function(_0x3f9216){if(_0x3f9216){return _0x463d5d['status'](_0x1bbf3b)[_0x974e('0x14')](_0x3f9216);}};}function respondWithFilteredResult(_0xdde1bb,_0x3edcfc){return function(_0x172adc){if(_0x172adc){var _0x43ea85=typeof _0x3edcfc[_0x974e('0x15')]==='undefined'&&typeof _0x3edcfc['limit']===_0x974e('0x16');var _0x611b40=_0x172adc[_0x974e('0x17')];var _0x1f56bb=_0x43ea85?0x0:_0x3edcfc[_0x974e('0x15')];var _0x9f9391=_0x43ea85?_0x172adc[_0x974e('0x17')]:_0x3edcfc['offset']+_0x3edcfc[_0x974e('0x18')];var _0x186495;if(_0x9f9391>=_0x611b40){_0x9f9391=_0x611b40;_0x186495=0xc8;}else{_0x186495=0xce;}_0xdde1bb['status'](_0x186495);return _0xdde1bb[_0x974e('0x19')](_0x974e('0x1a'),_0x1f56bb+'-'+_0x9f9391+'/'+_0x611b40)[_0x974e('0x14')](_0x172adc);}return null;};}function patchUpdates(_0x441543){return function(_0x5340d3){try{jsonpatch[_0x974e('0x1b')](_0x5340d3,_0x441543,!![]);}catch(_0x1db6c0){return BPromise[_0x974e('0x1c')](_0x1db6c0);}return _0x5340d3[_0x974e('0x1d')]();};}function saveUpdates(_0x3e90d6,_0x1a22ec){return function(_0x3f7780){if(_0x3f7780){return _0x3f7780[_0x974e('0x1e')](_0x3e90d6)[_0x974e('0x1f')](function(_0xbf8a17){return _0xbf8a17;});}return null;};}function removeEntity(_0x4ef4f3,_0x8e9522){return function(_0x1ccd0f){if(_0x1ccd0f){return _0x1ccd0f['destroy']()[_0x974e('0x1f')](function(){_0x4ef4f3[_0x974e('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x392ff0,_0x4d23d7){return function(_0x303fdf){if(!_0x303fdf){_0x392ff0['sendStatus'](0x194);}return _0x303fdf;};}function handleError(_0x3e9c23,_0x26100b){_0x26100b=_0x26100b||0x1f4;return function(_0x1a4085){logger[_0x974e('0x20')](_0x1a4085['stack']);if(_0x1a4085[_0x974e('0x21')]){delete _0x1a4085[_0x974e('0x21')];}_0x3e9c23[_0x974e('0x13')](_0x26100b)[_0x974e('0x22')](_0x1a4085);};}exports[_0x974e('0x23')]=function(_0x5f1a40,_0x114b51){var _0x16f587={},_0x71d1f0={},_0x270438={'count':0x0,'rows':[]};var _0x15c5ba=_[_0x974e('0x24')](db[_0x974e('0x25')]['rawAttributes'],function(_0xa5324b){return{'name':_0xa5324b['fieldName'],'type':_0xa5324b['type'][_0x974e('0x26')]};});_0x71d1f0[_0x974e('0x27')]=_[_0x974e('0x24')](_0x15c5ba,'name');_0x71d1f0['query']=_['keys'](_0x5f1a40['query']);_0x71d1f0[_0x974e('0x28')]=_['intersection'](_0x71d1f0['model'],_0x71d1f0[_0x974e('0x29')]);_0x16f587[_0x974e('0x2a')]=_['intersection'](_0x71d1f0[_0x974e('0x27')],qs['fields'](_0x5f1a40[_0x974e('0x29')][_0x974e('0x2b')]));_0x16f587[_0x974e('0x2a')]=_0x16f587[_0x974e('0x2a')][_0x974e('0x2c')]?_0x16f587[_0x974e('0x2a')]:_0x71d1f0[_0x974e('0x27')];if(!_0x5f1a40[_0x974e('0x29')][_0x974e('0x2d')](_0x974e('0x2e'))){_0x16f587[_0x974e('0x18')]=qs[_0x974e('0x18')](_0x5f1a40[_0x974e('0x29')][_0x974e('0x18')]);_0x16f587[_0x974e('0x15')]=qs['offset'](_0x5f1a40[_0x974e('0x29')][_0x974e('0x15')]);}_0x16f587[_0x974e('0x2f')]=qs[_0x974e('0x30')](_0x5f1a40[_0x974e('0x29')][_0x974e('0x30')]);_0x16f587['where']=qs[_0x974e('0x28')](_[_0x974e('0x31')](_0x5f1a40[_0x974e('0x29')],_0x71d1f0[_0x974e('0x28')]),_0x15c5ba);if(_0x5f1a40['query'][_0x974e('0x32')]){_0x16f587[_0x974e('0x33')]=_[_0x974e('0x34')](_0x16f587[_0x974e('0x33')],{'$or':_['map'](_0x15c5ba,function(_0x33be60){if(_0x33be60[_0x974e('0x35')]!==_0x974e('0x36')){var _0x5e0b45={};_0x5e0b45[_0x33be60['name']]={'$like':'%'+_0x5f1a40['query'][_0x974e('0x32')]+'%'};return _0x5e0b45;}})});}_0x16f587=_[_0x974e('0x34')]({},_0x16f587,_0x5f1a40[_0x974e('0x37')]);var _0x11dd23={'where':_0x16f587['where']};return db[_0x974e('0x25')]['count'](_0x11dd23)['then'](function(_0xd6aac9){_0x270438['count']=_0xd6aac9;if(_0x5f1a40['query'][_0x974e('0x38')]){_0x16f587[_0x974e('0x39')]=[{'all':!![]}];}return db[_0x974e('0x25')][_0x974e('0x3a')](_0x16f587);})[_0x974e('0x1f')](function(_0x2c7dd8){_0x270438[_0x974e('0x3b')]=_0x2c7dd8;return _0x270438;})[_0x974e('0x1f')](respondWithFilteredResult(_0x114b51,_0x16f587))[_0x974e('0x3c')](handleError(_0x114b51,null));};exports['show']=function(_0x2da1c3,_0xe695a8){var _0x540ea9={'raw':!![],'where':{'id':_0x2da1c3[_0x974e('0x3d')]['id']}},_0x2406d4={};_0x2406d4[_0x974e('0x27')]=_['keys'](db['JscriptySessionReport'][_0x974e('0x3e')]);_0x2406d4[_0x974e('0x29')]=_[_0x974e('0x3f')](_0x2da1c3[_0x974e('0x29')]);_0x2406d4[_0x974e('0x28')]=_[_0x974e('0x40')](_0x2406d4[_0x974e('0x27')],_0x2406d4[_0x974e('0x29')]);_0x540ea9[_0x974e('0x2a')]=_['intersection'](_0x2406d4[_0x974e('0x27')],qs[_0x974e('0x2b')](_0x2da1c3['query']['fields']));_0x540ea9[_0x974e('0x2a')]=_0x540ea9[_0x974e('0x2a')][_0x974e('0x2c')]?_0x540ea9[_0x974e('0x2a')]:_0x2406d4[_0x974e('0x27')];if(_0x2da1c3['query'][_0x974e('0x38')]){_0x540ea9[_0x974e('0x39')]=[{'all':!![]}];}_0x540ea9=_[_0x974e('0x34')]({},_0x540ea9,_0x2da1c3['options']);return db[_0x974e('0x25')][_0x974e('0x41')](_0x540ea9)[_0x974e('0x1f')](handleEntityNotFound(_0xe695a8,null))['then'](respondWithResult(_0xe695a8,null))['catch'](handleError(_0xe695a8,null));};exports[_0x974e('0x42')]=function(_0x4e4a61,_0x251231){return db[_0x974e('0x25')][_0x974e('0x42')](_0x4e4a61['body'],{})[_0x974e('0x1f')](respondWithResult(_0x251231,0xc9))[_0x974e('0x3c')](handleError(_0x251231,null));};exports['update']=function(_0x4bc8cb,_0x30e2ac){if(_0x4bc8cb[_0x974e('0x43')]['id']){delete _0x4bc8cb[_0x974e('0x43')]['id'];}return db[_0x974e('0x25')][_0x974e('0x41')]({'where':{'id':_0x4bc8cb[_0x974e('0x3d')]['id']}})[_0x974e('0x1f')](handleEntityNotFound(_0x30e2ac,null))[_0x974e('0x1f')](saveUpdates(_0x4bc8cb['body'],null))[_0x974e('0x1f')](respondWithResult(_0x30e2ac,null))[_0x974e('0x3c')](handleError(_0x30e2ac,null));};exports[_0x974e('0x44')]=function(_0x32520d,_0x35008f){return db['JscriptySessionReport'][_0x974e('0x41')]({'where':{'id':_0x32520d[_0x974e('0x3d')]['id']}})[_0x974e('0x1f')](handleEntityNotFound(_0x35008f,null))[_0x974e('0x1f')](removeEntity(_0x35008f,null))[_0x974e('0x3c')](handleError(_0x35008f,null));};exports[_0x974e('0x45')]=function(_0x4a8d99,_0x29ae7b){return db[_0x974e('0x25')][_0x974e('0x45')]()['then'](respondWithResult(_0x29ae7b,null))[_0x974e('0x3c')](handleError(_0x29ae7b,null));};exports['getQuestions']=function(_0x2bad3f,_0x7ff64c,_0x46d423){var _0x823d20={'raw':!![],'where':{}};var _0x333618={};var _0x148e06={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x974e('0x46')]({'where':{'id':_0x2bad3f[_0x974e('0x3d')]['id']}})['then'](handleEntityNotFound(_0x7ff64c,null))[_0x974e('0x1f')](function(_0x562fd0){if(_0x562fd0){_0x333618['model']=_[_0x974e('0x3f')](db[_0x974e('0x47')][_0x974e('0x3e')]);_0x333618[_0x974e('0x29')]=_[_0x974e('0x3f')](_0x2bad3f[_0x974e('0x29')]);_0x333618['filters']=_[_0x974e('0x40')](_0x333618[_0x974e('0x27')],_0x333618[_0x974e('0x29')]);_0x823d20[_0x974e('0x2a')]=_[_0x974e('0x40')](_0x333618[_0x974e('0x27')],qs[_0x974e('0x2b')](_0x2bad3f[_0x974e('0x29')][_0x974e('0x2b')]));_0x823d20[_0x974e('0x2a')]=_0x823d20[_0x974e('0x2a')][_0x974e('0x2c')]?_0x823d20[_0x974e('0x2a')]:_0x333618['model'];if(!_0x2bad3f[_0x974e('0x29')][_0x974e('0x2d')](_0x974e('0x2e'))){_0x823d20[_0x974e('0x18')]=qs[_0x974e('0x18')](_0x2bad3f[_0x974e('0x29')][_0x974e('0x18')]);_0x823d20[_0x974e('0x15')]=qs[_0x974e('0x15')](_0x2bad3f[_0x974e('0x29')][_0x974e('0x15')]);}_0x823d20[_0x974e('0x2f')]=qs[_0x974e('0x30')](_0x2bad3f[_0x974e('0x29')][_0x974e('0x30')]);_0x823d20[_0x974e('0x33')]=qs[_0x974e('0x28')](_['pick'](_0x2bad3f[_0x974e('0x29')],_0x333618[_0x974e('0x28')]));_0x823d20[_0x974e('0x33')][_0x974e('0x48')]=_0x562fd0['id'];if(_0x2bad3f[_0x974e('0x29')][_0x974e('0x32')]){_0x823d20[_0x974e('0x33')]=_[_0x974e('0x34')](_0x823d20[_0x974e('0x33')],{'$or':_[_0x974e('0x24')](_0x823d20[_0x974e('0x2a')],function(_0x1d3dd3){var _0x521fdf={};_0x521fdf[_0x1d3dd3]={'$like':'%'+_0x2bad3f[_0x974e('0x29')]['filter']+'%'};return _0x521fdf;})});}_0x823d20=_[_0x974e('0x34')]({},_0x823d20,_0x2bad3f['options']);return db[_0x974e('0x47')]['count']({'where':_0x823d20['where']})[_0x974e('0x1f')](function(_0xd9bc57){_0x148e06[_0x974e('0x17')]=_0xd9bc57;if(_0x2bad3f[_0x974e('0x29')][_0x974e('0x38')]){_0x823d20[_0x974e('0x39')]=[{'all':!![]}];}return db[_0x974e('0x47')][_0x974e('0x3a')](_0x823d20);})[_0x974e('0x1f')](function(_0x36e591){_0x148e06[_0x974e('0x3b')]=_0x36e591;return _0x148e06;});}})[_0x974e('0x1f')](respondWithFilteredResult(_0x7ff64c,_0x823d20))[_0x974e('0x3c')](handleError(_0x7ff64c,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 031ec4d..96ad67e 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 _0x323f=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x21ce1b,_0x3e42fa){var _0x275dd6=function(_0x5b7daa){while(--_0x5b7daa){_0x21ce1b['push'](_0x21ce1b['shift']());}};_0x275dd6(++_0x3e42fa);}(_0x323f,0x1ee));var _0xf323=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x323f[_0x484e36];return _0xafc85d;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require(_0xf323('0x2'));var BPromise=require(_0xf323('0x3'));var rp=require(_0xf323('0x4'));var fs=require('fs');var path=require(_0xf323('0x5'));var rimraf=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var attributes=require(_0xf323('0x8'));module[_0xf323('0x9')]=function(_0x371707,_0x5d7d60){return _0x371707[_0xf323('0xa')](_0xf323('0xb'),attributes,{'tableName':_0xf323('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa3f=['rimraf','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4d8900,_0x2559a1){var _0x217e05=function(_0x323b12){while(--_0x323b12){_0x4d8900['push'](_0x4d8900['shift']());}};_0x217e05(++_0x2559a1);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x2a3e61,_0x4bbc4c){_0x2a3e61=_0x2a3e61-0x0;var _0x22cc53=_0xaa3f[_0x2a3e61];return _0x22cc53;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var logger=require(_0xfaa3('0x2'))(_0xfaa3('0x3'));var moment=require(_0xfaa3('0x4'));var BPromise=require(_0xfaa3('0x5'));var rp=require(_0xfaa3('0x6'));var fs=require('fs');var path=require(_0xfaa3('0x7'));var rimraf=require(_0xfaa3('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0xfaa3('0x9')]=function(_0x4bac92,_0x3d09aa){return _0x4bac92[_0xfaa3('0xa')](_0xfaa3('0xb'),attributes,{'tableName':_0xfaa3('0xc'),'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 e3ad623..caceb86 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 _0xc1c6=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch'];(function(_0x1341eb,_0x4f8b05){var _0x1916a9=function(_0x2ed093){while(--_0x2ed093){_0x1341eb['push'](_0x1341eb['shift']());}};_0x1916a9(++_0x4f8b05);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x371765,_0x1db68c){_0x371765=_0x371765-0x0;var _0x5e1ee1=_0xc1c6[_0x371765];return _0x5e1ee1;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});} \ No newline at end of file +var _0x77e6=['client','request','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x1f949e,_0x4b4614){var _0xd2c269=function(_0x1d2862){while(--_0x1d2862){_0x1f949e['push'](_0x1f949e['shift']());}};_0xd2c269(++_0x4b4614);}(_0x77e6,0x1a6));var _0x677e=function(_0x5213e1,_0x477d0c){_0x5213e1=_0x5213e1-0x0;var _0x392ab7=_0x77e6[_0x5213e1];return _0x392ab7;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var moment=require(_0x677e('0x2'));var BPromise=require(_0x677e('0x3'));var rs=require(_0x677e('0x4'));var fs=require('fs');var Redis=require(_0x677e('0x5'));var db=require(_0x677e('0x6'))['db'];var utils=require(_0x677e('0x7'));var logger=require('../../config/logger')(_0x677e('0x8'));var config=require(_0x677e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x677e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d314,_0x4d1a57,_0x5a5dd3){return new BPromise(function(_0x2eb40c,_0x4c519f){return client[_0x677e('0xb')](_0x40d314,_0x5a5dd3)[_0x677e('0xc')](function(_0x552931){logger[_0x677e('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x4d1a57,_0x677e('0xe'));logger[_0x677e('0xf')](_0x677e('0x10'),_0x4d1a57,_0x677e('0xe'),JSON[_0x677e('0x11')](_0x552931));if(_0x552931[_0x677e('0x12')]){if(_0x552931[_0x677e('0x12')][_0x677e('0x13')]===0x1f4){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x552931[_0x677e('0x12')][_0x677e('0x15')]);return _0x4c519f(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x4d1a57,_0x552931['error'][_0x677e('0x15')]);return _0x2eb40c(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}else{logger[_0x677e('0xd')](_0x677e('0x14'),_0x4d1a57,_0x677e('0xe'));_0x2eb40c(_0x552931[_0x677e('0x16')][_0x677e('0x15')]);}})[_0x677e('0x17')](function(_0x32d306){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x32d306);_0x4c519f(_0x32d306);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index b5c6335..5953a1b 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 _0xc08f=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','/download_log_file','downloadLogFile','exports','multer'];(function(_0x5c8e1f,_0x3cbbc7){var _0x124708=function(_0x12d58c){while(--_0x12d58c){_0x5c8e1f['push'](_0x5c8e1f['shift']());}};_0x124708(++_0x3cbbc7);}(_0xc08f,0x6f));var _0xfc08=function(_0x30bf6f,_0x5af96d){_0x30bf6f=_0x30bf6f-0x0;var _0x2122fa=_0xc08f[_0x30bf6f];return _0x2122fa;};'use strict';var multer=require(_0xfc08('0x0'));var util=require(_0xfc08('0x1'));var path=require(_0xfc08('0x2'));var timeout=require('connect-timeout');var express=require(_0xfc08('0x3'));var router=express['Router']();var fs_extra=require(_0xfc08('0x4'));var auth=require(_0xfc08('0x5'));var interaction=require(_0xfc08('0x6'));var config=require(_0xfc08('0x7'));var controller=require(_0xfc08('0x8'));router[_0xfc08('0x9')]('/',controller['index']);router[_0xfc08('0xa')](_0xfc08('0xb'),auth[_0xfc08('0xc')](),controller['update']);router['get'](_0xfc08('0xd'),auth[_0xfc08('0xc')](),controller[_0xfc08('0xe')]);module[_0xfc08('0xf')]=router; \ No newline at end of file +var _0xbfac=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','update','/download_log_file','isAuthenticated','downloadLogFile','multer','path'];(function(_0xe786c9,_0xfe074f){var _0x432bab=function(_0x14c1d1){while(--_0x14c1d1){_0xe786c9['push'](_0xe786c9['shift']());}};_0x432bab(++_0xfe074f);}(_0xbfac,0x67));var _0xcbfa=function(_0x58434d,_0x393b56){_0x58434d=_0x58434d-0x0;var _0x149a1b=_0xbfac[_0x58434d];return _0x149a1b;};'use strict';var multer=require(_0xcbfa('0x0'));var util=require('util');var path=require(_0xcbfa('0x1'));var timeout=require(_0xcbfa('0x2'));var express=require(_0xcbfa('0x3'));var router=express[_0xcbfa('0x4')]();var fs_extra=require(_0xcbfa('0x5'));var auth=require(_0xcbfa('0x6'));var interaction=require(_0xcbfa('0x7'));var config=require(_0xcbfa('0x8'));var controller=require('./license.controller');router[_0xcbfa('0x9')]('/',controller['index']);router['put'](_0xcbfa('0xa'),auth['isAuthenticated'](),controller[_0xcbfa('0xb')]);router[_0xcbfa('0x9')](_0xcbfa('0xc'),auth[_0xcbfa('0xd')](),controller[_0xcbfa('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index cb5f352..f1c4361 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 _0xe718=['sequelize','STRING','INTEGER'];(function(_0x5d7102,_0xec5c22){var _0x647c20=function(_0x8ca57e){while(--_0x8ca57e){_0x5d7102['push'](_0x5d7102['shift']());}};_0x647c20(++_0xec5c22);}(_0xe718,0x11d));var _0x8e71=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0xe718[_0x55fa03];return _0x2cd7cd;};'use strict';var Sequelize=require(_0x8e71('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x8e71('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x8e71('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6caa=['sequelize','exports','INTEGER'];(function(_0x5d61b4,_0x4f7b91){var _0x183fc5=function(_0x5ecf92){while(--_0x5ecf92){_0x5d61b4['push'](_0x5d61b4['shift']());}};_0x183fc5(++_0x4f7b91);}(_0x6caa,0x147));var _0xa6ca=function(_0x776580,_0x1502c4){_0x776580=_0x776580-0x0;var _0xa2e046=_0x6caa[_0x776580];return _0xa2e046;};'use strict';var Sequelize=require(_0xa6ca('0x0'));module[_0xa6ca('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xa6ca('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index e3b7b43..e905a6b 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 _0x8ac9=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','destroy','then','error','stack','License','keys','query','filters','model','attributes','fields','length','merge','options','catch','update','body','find','params','get','key','demo','downloadLogFile','license-info.log','join','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x28abd9,_0xbea4fb){var _0x12869d=function(_0x2cbb60){while(--_0x2cbb60){_0x28abd9['push'](_0x28abd9['shift']());}};_0x12869d(++_0xbea4fb);}(_0x8ac9,0x17e));var _0x98ac=function(_0x26d1ac,_0x1a959c){_0x26d1ac=_0x26d1ac-0x0;var _0x89f135=_0x8ac9[_0x26d1ac];return _0x89f135;};'use strict';var emlformat=require(_0x98ac('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x98ac('0x1'));var rp=require(_0x98ac('0x2'));var moment=require('moment');var BPromise=require(_0x98ac('0x3'));var Mustache=require(_0x98ac('0x4'));var util=require(_0x98ac('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x98ac('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98ac('0x7'));var _=require(_0x98ac('0x8'));var squel=require(_0x98ac('0x9'));var crypto=require(_0x98ac('0xa'));var jsforce=require(_0x98ac('0xb'));var deskjs=require(_0x98ac('0xc'));var toCsv=require(_0x98ac('0x6'));var querystring=require(_0x98ac('0xd'));var Papa=require('papaparse');var Redis=require(_0x98ac('0xe'));var authService=require(_0x98ac('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x98ac('0x10'));var hardwareService=require(_0x98ac('0x11'));var logger=require(_0x98ac('0x12'))(_0x98ac('0x13'));var utils=require(_0x98ac('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x98ac('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x320aeb,_0x1f9fac){_0x1f9fac=_0x1f9fac||0xcc;return function(_0x15dd6c){if(_0x15dd6c){return _0x320aeb[_0x98ac('0x16')](_0x1f9fac);}return _0x320aeb[_0x98ac('0x17')](_0x1f9fac)[_0x98ac('0x18')]();};}function respondWithResult(_0x59143c,_0x5a3a40){_0x5a3a40=_0x5a3a40||0xc8;return function(_0x52d488){if(_0x52d488){return _0x59143c['status'](_0x5a3a40)[_0x98ac('0x19')](_0x52d488);}};}function respondWithFilteredResult(_0x19ca93,_0x1376e3){return function(_0x903d29){if(_0x903d29){var _0x209873=typeof _0x1376e3['offset']===_0x98ac('0x1a')&&typeof _0x1376e3[_0x98ac('0x1b')]==='undefined';var _0x2e9fc2=_0x903d29[_0x98ac('0x1c')];var _0x4eb027=_0x209873?0x0:_0x1376e3[_0x98ac('0x1d')];var _0x370096=_0x209873?_0x903d29[_0x98ac('0x1c')]:_0x1376e3[_0x98ac('0x1d')]+_0x1376e3[_0x98ac('0x1b')];var _0x428e3f;if(_0x370096>=_0x2e9fc2){_0x370096=_0x2e9fc2;_0x428e3f=0xc8;}else{_0x428e3f=0xce;}_0x19ca93[_0x98ac('0x17')](_0x428e3f);return _0x19ca93[_0x98ac('0x1e')](_0x98ac('0x1f'),_0x4eb027+'-'+_0x370096+'/'+_0x2e9fc2)[_0x98ac('0x19')](_0x903d29);}return null;};}function patchUpdates(_0x3c58a2){return function(_0x51c7ed){try{jsonpatch['apply'](_0x51c7ed,_0x3c58a2,!![]);}catch(_0x1076f4){return BPromise['reject'](_0x1076f4);}return _0x51c7ed[_0x98ac('0x20')]();};}function saveUpdates(_0x39cfe2,_0x3842cd){return function(_0x83d85a){if(_0x83d85a){return _0x83d85a['update'](_0x39cfe2)['then'](function(_0x177bbb){return _0x177bbb;});}return null;};}function removeEntity(_0x2fdd11,_0x120834){return function(_0xe9df27){if(_0xe9df27){return _0xe9df27[_0x98ac('0x21')]()[_0x98ac('0x22')](function(){_0x2fdd11[_0x98ac('0x17')](0xcc)[_0x98ac('0x18')]();});}};}function handleEntityNotFound(_0x26ac22,_0x59f5b2){return function(_0x50980a){if(!_0x50980a){_0x26ac22[_0x98ac('0x16')](0x194);}return _0x50980a;};}function handleError(_0x407b78,_0x38d435){_0x38d435=_0x38d435||0x1f4;return function(_0x3bcd01){logger[_0x98ac('0x23')](_0x3bcd01[_0x98ac('0x24')]);if(_0x3bcd01['name']){delete _0x3bcd01['name'];}_0x407b78['status'](_0x38d435)['send'](_0x3bcd01);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x48d23b,_0x4cf013){var _0x5575e1={'raw':!![],'where':{'id':0x1}},_0xcf339b={};_0xcf339b['model']=_['keys'](db[_0x98ac('0x25')]['rawAttributes']);_0xcf339b['query']=_[_0x98ac('0x26')](_0x48d23b[_0x98ac('0x27')]);_0xcf339b[_0x98ac('0x28')]=_['intersection'](_0xcf339b[_0x98ac('0x29')],_0xcf339b[_0x98ac('0x27')]);_0x5575e1[_0x98ac('0x2a')]=_['intersection'](_0xcf339b['model'],qs[_0x98ac('0x2b')](_0x48d23b[_0x98ac('0x27')][_0x98ac('0x2b')]));_0x5575e1['attributes']=_0x5575e1[_0x98ac('0x2a')][_0x98ac('0x2c')]?_0x5575e1['attributes']:_0xcf339b[_0x98ac('0x29')];_0x5575e1=_[_0x98ac('0x2d')]({},_0x5575e1,_0x48d23b[_0x98ac('0x2e')]);return utilLicense['getLicense'](_0x5575e1)[_0x98ac('0x22')](respondWithResult(_0x4cf013,null))[_0x98ac('0x2f')](handleError(_0x4cf013,null));};exports[_0x98ac('0x30')]=function(_0x404d52,_0x3712ef){if(_0x404d52[_0x98ac('0x31')]['id']){delete _0x404d52[_0x98ac('0x31')]['id'];}return db[_0x98ac('0x25')][_0x98ac('0x32')]({'where':{'id':_0x404d52[_0x98ac('0x33')]['id']}})[_0x98ac('0x22')](handleEntityNotFound(_0x3712ef,null))[_0x98ac('0x22')](function(_0x30c8a5){var _0xacde28=_0x30c8a5[_0x98ac('0x34')]({'plain':!![]});return utilLicense['checkLicense'](_0xacde28,_0x404d52[_0x98ac('0x31')][_0x98ac('0x35')]);})[_0x98ac('0x22')](function(_0x8b20d){if(!_0x8b20d[_0x98ac('0x36')]){return saveUpdates(_0x404d52[_0x98ac('0x31')],null);}return _0x8b20d;})[_0x98ac('0x22')](respondWithResult(_0x3712ef,null))[_0x98ac('0x2f')](handleError(_0x3712ef,null));};exports[_0x98ac('0x37')]=function(_0x5f5a01,_0xd44249){var _0xce0bc4=_0x98ac('0x38');var _0x96703b=path[_0x98ac('0x39')]('/var',_0x98ac('0x3a'),_0x98ac('0x3b'),_0xce0bc4);_0xd44249[_0x98ac('0x3c')](_0x98ac('0x3d'),_0x98ac('0x3e')+_0xce0bc4);_0xd44249[_0x98ac('0x1e')](_0x98ac('0x3f'),_0x98ac('0x40'));_0xd44249[_0x98ac('0x41')](_0x96703b);}; \ No newline at end of file +var _0x3a70=['license-info.log','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','model','keys','License','query','filters','intersection','fields','attributes','length','merge','options','getLicense','update','body','find','params','get','checkLicense','key','demo','catch','downloadLogFile'];(function(_0xd89114,_0x23a4b6){var _0x5e0ae4=function(_0xe38cb5){while(--_0xe38cb5){_0xd89114['push'](_0xd89114['shift']());}};_0x5e0ae4(++_0x23a4b6);}(_0x3a70,0x181));var _0x03a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a70[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x03a7('0x0'));var rimraf=require(_0x03a7('0x1'));var zipdir=require(_0x03a7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03a7('0x3'));var moment=require(_0x03a7('0x4'));var BPromise=require(_0x03a7('0x5'));var Mustache=require(_0x03a7('0x6'));var util=require('util');var path=require(_0x03a7('0x7'));var sox=require(_0x03a7('0x8'));var csv=require('to-csv');var ejs=require(_0x03a7('0x9'));var fs=require('fs');var fs_extra=require(_0x03a7('0xa'));var _=require(_0x03a7('0xb'));var squel=require(_0x03a7('0xc'));var crypto=require(_0x03a7('0xd'));var jsforce=require(_0x03a7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x03a7('0xf'));var querystring=require('querystring');var Papa=require(_0x03a7('0x10'));var Redis=require(_0x03a7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x03a7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x03a7('0x13'));var logger=require(_0x03a7('0x14'))(_0x03a7('0x15'));var utils=require(_0x03a7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x03a7('0x17'));var db=require(_0x03a7('0x18'))['db'];function respondWithStatusCode(_0x57ae34,_0x174beb){_0x174beb=_0x174beb||0xcc;return function(_0x37b010){if(_0x37b010){return _0x57ae34['sendStatus'](_0x174beb);}return _0x57ae34[_0x03a7('0x19')](_0x174beb)[_0x03a7('0x1a')]();};}function respondWithResult(_0x1319b4,_0x45c1a6){_0x45c1a6=_0x45c1a6||0xc8;return function(_0x55eafe){if(_0x55eafe){return _0x1319b4[_0x03a7('0x19')](_0x45c1a6)[_0x03a7('0x1b')](_0x55eafe);}};}function respondWithFilteredResult(_0x5b01b7,_0x298d60){return function(_0x1eb440){if(_0x1eb440){var _0x57a064=typeof _0x298d60[_0x03a7('0x1c')]===_0x03a7('0x1d')&&typeof _0x298d60['limit']===_0x03a7('0x1d');var _0x24059c=_0x1eb440[_0x03a7('0x1e')];var _0x466b0b=_0x57a064?0x0:_0x298d60[_0x03a7('0x1c')];var _0xc586b0=_0x57a064?_0x1eb440[_0x03a7('0x1e')]:_0x298d60[_0x03a7('0x1c')]+_0x298d60[_0x03a7('0x1f')];var _0x5c036c;if(_0xc586b0>=_0x24059c){_0xc586b0=_0x24059c;_0x5c036c=0xc8;}else{_0x5c036c=0xce;}_0x5b01b7[_0x03a7('0x19')](_0x5c036c);return _0x5b01b7[_0x03a7('0x20')]('Content-Range',_0x466b0b+'-'+_0xc586b0+'/'+_0x24059c)[_0x03a7('0x1b')](_0x1eb440);}return null;};}function patchUpdates(_0xe4a1d5){return function(_0x46e6ef){try{jsonpatch[_0x03a7('0x21')](_0x46e6ef,_0xe4a1d5,!![]);}catch(_0x41ba6d){return BPromise[_0x03a7('0x22')](_0x41ba6d);}return _0x46e6ef[_0x03a7('0x23')]();};}function saveUpdates(_0x516254,_0x314ecf){return function(_0x59ce62){if(_0x59ce62){return _0x59ce62['update'](_0x516254)[_0x03a7('0x24')](function(_0x1952d8){return _0x1952d8;});}return null;};}function removeEntity(_0x18d6ca,_0x189c7d){return function(_0x577241){if(_0x577241){return _0x577241[_0x03a7('0x25')]()[_0x03a7('0x24')](function(){_0x18d6ca['status'](0xcc)[_0x03a7('0x1a')]();});}};}function handleEntityNotFound(_0x30cbff,_0x1642f2){return function(_0x27a0a3){if(!_0x27a0a3){_0x30cbff[_0x03a7('0x26')](0x194);}return _0x27a0a3;};}function handleError(_0x41478c,_0x4a1252){_0x4a1252=_0x4a1252||0x1f4;return function(_0x36583f){logger[_0x03a7('0x27')](_0x36583f[_0x03a7('0x28')]);if(_0x36583f[_0x03a7('0x29')]){delete _0x36583f[_0x03a7('0x29')];}_0x41478c['status'](_0x4a1252)[_0x03a7('0x2a')](_0x36583f);};}var utilLicense=require(_0x03a7('0x17'));exports['index']=function(_0x42bab1,_0x34dc58){var _0x3f7b5b={'raw':!![],'where':{'id':0x1}},_0x565221={};_0x565221[_0x03a7('0x2b')]=_[_0x03a7('0x2c')](db[_0x03a7('0x2d')]['rawAttributes']);_0x565221[_0x03a7('0x2e')]=_[_0x03a7('0x2c')](_0x42bab1[_0x03a7('0x2e')]);_0x565221[_0x03a7('0x2f')]=_[_0x03a7('0x30')](_0x565221[_0x03a7('0x2b')],_0x565221[_0x03a7('0x2e')]);_0x3f7b5b['attributes']=_[_0x03a7('0x30')](_0x565221[_0x03a7('0x2b')],qs[_0x03a7('0x31')](_0x42bab1['query']['fields']));_0x3f7b5b[_0x03a7('0x32')]=_0x3f7b5b[_0x03a7('0x32')][_0x03a7('0x33')]?_0x3f7b5b[_0x03a7('0x32')]:_0x565221[_0x03a7('0x2b')];_0x3f7b5b=_[_0x03a7('0x34')]({},_0x3f7b5b,_0x42bab1[_0x03a7('0x35')]);return utilLicense[_0x03a7('0x36')](_0x3f7b5b)['then'](respondWithResult(_0x34dc58,null))['catch'](handleError(_0x34dc58,null));};exports[_0x03a7('0x37')]=function(_0x2e75d9,_0x3cbd16){if(_0x2e75d9[_0x03a7('0x38')]['id']){delete _0x2e75d9[_0x03a7('0x38')]['id'];}return db[_0x03a7('0x2d')][_0x03a7('0x39')]({'where':{'id':_0x2e75d9[_0x03a7('0x3a')]['id']}})[_0x03a7('0x24')](handleEntityNotFound(_0x3cbd16,null))[_0x03a7('0x24')](function(_0x48fcea){var _0x53eed7=_0x48fcea[_0x03a7('0x3b')]({'plain':!![]});return utilLicense[_0x03a7('0x3c')](_0x53eed7,_0x2e75d9['body'][_0x03a7('0x3d')]);})[_0x03a7('0x24')](function(_0x15c618){if(!_0x15c618[_0x03a7('0x3e')]){return saveUpdates(_0x2e75d9[_0x03a7('0x38')],null);}return _0x15c618;})[_0x03a7('0x24')](respondWithResult(_0x3cbd16,null))[_0x03a7('0x3f')](handleError(_0x3cbd16,null));};exports[_0x03a7('0x40')]=function(_0x228dad,_0x4573d6){var _0x3f6eef=_0x03a7('0x41');var _0x388731=path[_0x03a7('0x42')](_0x03a7('0x43'),_0x03a7('0x44'),'xcally',_0x3f6eef);_0x4573d6[_0x03a7('0x45')](_0x03a7('0x46'),_0x03a7('0x47')+_0x3f6eef);_0x4573d6['set'](_0x03a7('0x48'),_0x03a7('0x49'));_0x4573d6[_0x03a7('0x4a')](_0x388731);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 1cc8181..5adb3a7 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 _0xf09b=['request-promise','path','rimraf','./license.attributes','exports','define','License','license','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf09b,0x68));var _0xbf09=function(_0x3c15d8,_0x501f56){_0x3c15d8=_0x3c15d8-0x0;var _0x35db8b=_0xf09b[_0x3c15d8];return _0x35db8b;};'use strict';var _=require('lodash');var util=require(_0xbf09('0x0'));var logger=require(_0xbf09('0x1'))(_0xbf09('0x2'));var moment=require(_0xbf09('0x3'));var BPromise=require('bluebird');var rp=require(_0xbf09('0x4'));var fs=require('fs');var path=require(_0xbf09('0x5'));var rimraf=require(_0xbf09('0x6'));var config=require('../../config/environment');var attributes=require(_0xbf09('0x7'));module[_0xbf09('0x8')]=function(_0x4d16e4,_0x1f3bdd){return _0x4d16e4[_0xbf09('0x9')](_0xbf09('0xa'),attributes,{'tableName':_0xbf09('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ad4=['moment','bluebird','request-promise','path','../../config/environment','./license.attributes','exports','define','License','util','../../config/logger'];(function(_0x2be7a4,_0x74ada3){var _0x4b40cb=function(_0x2d041a){while(--_0x2d041a){_0x2be7a4['push'](_0x2be7a4['shift']());}};_0x4b40cb(++_0x74ada3);}(_0x8ad4,0x82));var _0x48ad=function(_0xae3e0f,_0x4ce938){_0xae3e0f=_0xae3e0f-0x0;var _0x12a919=_0x8ad4[_0xae3e0f];return _0x12a919;};'use strict';var _=require('lodash');var util=require(_0x48ad('0x0'));var logger=require(_0x48ad('0x1'))('api');var moment=require(_0x48ad('0x2'));var BPromise=require(_0x48ad('0x3'));var rp=require(_0x48ad('0x4'));var fs=require('fs');var path=require(_0x48ad('0x5'));var rimraf=require('rimraf');var config=require(_0x48ad('0x6'));var attributes=require(_0x48ad('0x7'));module[_0x48ad('0x8')]=function(_0x1e72ca,_0x325881){return _0x1e72ca[_0x48ad('0x9')](_0x48ad('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index defdff3..16c6baf 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 _0xf5f3=['message','License,\x20%s,\x20%s','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x218a30,_0x278c2d){var _0x197dbf=function(_0x1d62ba){while(--_0x1d62ba){_0x218a30['push'](_0x218a30['shift']());}};_0x197dbf(++_0x278c2d);}(_0xf5f3,0x1d1));var _0x3f5f=function(_0x190db2,_0x18cebd){_0x190db2=_0x190db2-0x0;var _0x26b21e=_0xf5f3[_0x190db2];return _0x26b21e;};'use strict';var _=require(_0x3f5f('0x0'));var util=require(_0x3f5f('0x1'));var moment=require('moment');var BPromise=require(_0x3f5f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f5f('0x3'))['db'];var utils=require(_0x3f5f('0x4'));var logger=require(_0x3f5f('0x5'))(_0x3f5f('0x6'));var config=require(_0x3f5f('0x7'));var jayson=require(_0x3f5f('0x8'));var client=jayson['client'][_0x3f5f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x149bb7,_0xd2f211,_0x172b2c){return new BPromise(function(_0x5828af,_0x5cd8e7){return client['request'](_0x149bb7,_0x172b2c)[_0x3f5f('0xa')](function(_0x162b0f){logger[_0x3f5f('0xb')]('License,\x20%s,\x20%s',_0xd2f211,_0x3f5f('0xc'));logger[_0x3f5f('0xd')](_0x3f5f('0xe'),_0xd2f211,'request\x20sent',JSON[_0x3f5f('0xf')](_0x162b0f));if(_0x162b0f[_0x3f5f('0x10')]){if(_0x162b0f[_0x3f5f('0x10')][_0x3f5f('0x11')]===0x1f4){logger[_0x3f5f('0x10')]('License,\x20%s,\x20%s',_0xd2f211,_0x162b0f['error'][_0x3f5f('0x12')]);return _0x5cd8e7(_0x162b0f[_0x3f5f('0x10')][_0x3f5f('0x12')]);}logger[_0x3f5f('0x10')](_0x3f5f('0x13'),_0xd2f211,_0x162b0f[_0x3f5f('0x10')][_0x3f5f('0x12')]);return _0x5828af(_0x162b0f[_0x3f5f('0x10')]['message']);}else{logger['info'](_0x3f5f('0x13'),_0xd2f211,_0x3f5f('0xc'));_0x5828af(_0x162b0f['result'][_0x3f5f('0x12')]);}})[_0x3f5f('0x14')](function(_0x57c785){logger[_0x3f5f('0x10')]('License,\x20%s,\x20%s',_0xd2f211,_0x57c785);_0x5cd8e7(_0x57c785);});});} \ No newline at end of file +var _0x6f2f=['error','message','result','lodash','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f2f,0x124));var _0xf6f2=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x6f2f[_0x381589];return _0x2a075d;};'use strict';var _=require(_0xf6f2('0x0'));var util=require('util');var moment=require(_0xf6f2('0x1'));var BPromise=require(_0xf6f2('0x2'));var rs=require(_0xf6f2('0x3'));var fs=require('fs');var Redis=require(_0xf6f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf6f2('0x5'));var config=require('../../config/environment');var jayson=require(_0xf6f2('0x6'));var client=jayson[_0xf6f2('0x7')][_0xf6f2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dc79c,_0x19f5c4,_0x387133){return new BPromise(function(_0x25050f,_0x49cf8){return client[_0xf6f2('0x9')](_0x3dc79c,_0x387133)[_0xf6f2('0xa')](function(_0x5b3bdf){logger['info'](_0xf6f2('0xb'),_0x19f5c4,_0xf6f2('0xc'));logger[_0xf6f2('0xd')]('License,\x20%s,\x20%s,\x20%s',_0x19f5c4,_0xf6f2('0xc'),JSON['stringify'](_0x5b3bdf));if(_0x5b3bdf[_0xf6f2('0xe')]){if(_0x5b3bdf[_0xf6f2('0xe')]['code']===0x1f4){logger[_0xf6f2('0xe')](_0xf6f2('0xb'),_0x19f5c4,_0x5b3bdf[_0xf6f2('0xe')][_0xf6f2('0xf')]);return _0x49cf8(_0x5b3bdf['error'][_0xf6f2('0xf')]);}logger[_0xf6f2('0xe')](_0xf6f2('0xb'),_0x19f5c4,_0x5b3bdf['error'][_0xf6f2('0xf')]);return _0x25050f(_0x5b3bdf[_0xf6f2('0xe')][_0xf6f2('0xf')]);}else{logger['info']('License,\x20%s,\x20%s',_0x19f5c4,_0xf6f2('0xc'));_0x25050f(_0x5b3bdf[_0xf6f2('0x10')]['message']);}})['catch'](function(_0x2015b3){logger['error'](_0xf6f2('0xb'),_0x19f5c4,_0x2015b3);_0x49cf8(_0x2015b3);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index f31a5f7..53a5c84 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 _0x909c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/:id','show','getDispositions','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addDisposition','create','/:id/in_servers','addSmtp','addInteraction','addAgents','put','update','removeDispositions','delete','/:id/canned_answers','removeAnswers','removeImap','removeSmtp','destroy','exports','path','connect-timeout'];(function(_0x1f6835,_0xff3520){var _0x10aee2=function(_0x5600f0){while(--_0x5600f0){_0x1f6835['push'](_0x1f6835['shift']());}};_0x10aee2(++_0xff3520);}(_0x909c,0xb2));var _0xc909=function(_0x528b80,_0x282323){_0x528b80=_0x528b80-0x0;var _0x449365=_0x909c[_0x528b80];return _0x449365;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc909('0x0'));var timeout=require(_0xc909('0x1'));var express=require('express');var router=express[_0xc909('0x2')]();var fs_extra=require(_0xc909('0x3'));var auth=require(_0xc909('0x4'));var interaction=require(_0xc909('0x5'));var config=require(_0xc909('0x6'));var controller=require(_0xc909('0x7'));router[_0xc909('0x8')]('/',auth[_0xc909('0x9')](),controller[_0xc909('0xa')]);router['get']('/describe',auth[_0xc909('0x9')](),controller['describe']);router[_0xc909('0x8')](_0xc909('0xb'),auth[_0xc909('0x9')](),controller[_0xc909('0xc')]);router['get']('/:id/dispositions',auth[_0xc909('0x9')](),controller[_0xc909('0xd')]);router[_0xc909('0x8')]('/:id/canned_answers',auth[_0xc909('0x9')](),controller[_0xc909('0xe')]);router[_0xc909('0x8')]('/:id/in_servers',auth[_0xc909('0x9')](),controller[_0xc909('0xf')]);router['get'](_0xc909('0x10'),auth[_0xc909('0x9')](),controller[_0xc909('0x11')]);router[_0xc909('0x8')](_0xc909('0x12'),auth[_0xc909('0x9')](),controller[_0xc909('0x13')]);router[_0xc909('0x8')](_0xc909('0x14'),auth[_0xc909('0x9')](),controller[_0xc909('0x15')]);router['get']('/:id/messages',auth[_0xc909('0x9')](),controller[_0xc909('0x16')]);router[_0xc909('0x8')](_0xc909('0x17'),auth[_0xc909('0x9')](),controller[_0xc909('0x18')]);router[_0xc909('0x8')](_0xc909('0x19'),auth['isAuthenticated'](),controller[_0xc909('0x1a')]);router[_0xc909('0x1b')](_0xc909('0x1c'),auth['isAuthenticated'](),controller[_0xc909('0x1d')]);router[_0xc909('0x1b')]('/:id/canned_answers',auth[_0xc909('0x9')](),controller['addAnswer']);router[_0xc909('0x1b')]('/',auth[_0xc909('0x9')](),controller[_0xc909('0x1e')]);router[_0xc909('0x1b')](_0xc909('0x1f'),auth['isAuthenticated'](),controller['addImap']);router['post'](_0xc909('0x10'),auth[_0xc909('0x9')](),controller[_0xc909('0x20')]);router['post'](_0xc909('0x12'),auth['isAuthenticated'](),controller[_0xc909('0x21')]);router[_0xc909('0x1b')]('/:id/applications',auth[_0xc909('0x9')](),controller['addApplications']);router['post']('/:id/send',auth[_0xc909('0x9')](),controller['send']);router['post'](_0xc909('0x19'),auth[_0xc909('0x9')](),controller[_0xc909('0x22')]);router[_0xc909('0x23')]('/:id',auth[_0xc909('0x9')](),controller[_0xc909('0x24')]);router['delete'](_0xc909('0x1c'),auth['isAuthenticated'](),controller[_0xc909('0x25')]);router[_0xc909('0x26')](_0xc909('0x27'),auth[_0xc909('0x9')](),controller[_0xc909('0x28')]);router[_0xc909('0x26')](_0xc909('0x1f'),auth[_0xc909('0x9')](),controller[_0xc909('0x29')]);router[_0xc909('0x26')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xc909('0x2a')]);router[_0xc909('0x26')](_0xc909('0xb'),auth['isAuthenticated'](),controller[_0xc909('0x2b')]);router[_0xc909('0x26')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc909('0x2c')]=router; \ No newline at end of file +var _0xf58d=['delete','removeDispositions','removeAnswers','/:id/out_servers','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','create','addImap','addSmtp','/:id/interactions','send','addAgents','update'];(function(_0x50181e,_0x1a7fe7){var _0x1f4a41=function(_0x452793){while(--_0x452793){_0x50181e['push'](_0x50181e['shift']());}};_0x1f4a41(++_0x1a7fe7);}(_0xf58d,0xa9));var _0xdf58=function(_0x3f3c56,_0x568017){_0x3f3c56=_0x3f3c56-0x0;var _0x4810a1=_0xf58d[_0x3f3c56];return _0x4810a1;};'use strict';var multer=require(_0xdf58('0x0'));var util=require('util');var path=require(_0xdf58('0x1'));var timeout=require(_0xdf58('0x2'));var express=require(_0xdf58('0x3'));var router=express[_0xdf58('0x4')]();var fs_extra=require(_0xdf58('0x5'));var auth=require(_0xdf58('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdf58('0x7'));var controller=require(_0xdf58('0x8'));router[_0xdf58('0x9')]('/',auth[_0xdf58('0xa')](),controller[_0xdf58('0xb')]);router[_0xdf58('0x9')](_0xdf58('0xc'),auth['isAuthenticated'](),controller[_0xdf58('0xd')]);router['get'](_0xdf58('0xe'),auth[_0xdf58('0xa')](),controller[_0xdf58('0xf')]);router[_0xdf58('0x9')](_0xdf58('0x10'),auth[_0xdf58('0xa')](),controller[_0xdf58('0x11')]);router[_0xdf58('0x9')](_0xdf58('0x12'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xdf58('0x9')](_0xdf58('0x13'),auth[_0xdf58('0xa')](),controller['getImap']);router[_0xdf58('0x9')]('/:id/out_servers',auth[_0xdf58('0xa')](),controller['getSmtp']);router[_0xdf58('0x9')]('/:id/interactions',auth[_0xdf58('0xa')](),controller['getInteractions']);router['get'](_0xdf58('0x14'),auth[_0xdf58('0xa')](),controller[_0xdf58('0x15')]);router[_0xdf58('0x9')](_0xdf58('0x16'),auth[_0xdf58('0xa')](),controller[_0xdf58('0x17')]);router[_0xdf58('0x9')](_0xdf58('0x18'),auth[_0xdf58('0xa')](),controller[_0xdf58('0x19')]);router[_0xdf58('0x9')](_0xdf58('0x1a'),auth['isAuthenticated'](),controller[_0xdf58('0x1b')]);router['post'](_0xdf58('0x10'),auth[_0xdf58('0xa')](),controller['addDisposition']);router[_0xdf58('0x1c')](_0xdf58('0x12'),auth[_0xdf58('0xa')](),controller['addAnswer']);router['post']('/',auth['isAuthenticated'](),controller[_0xdf58('0x1d')]);router['post'](_0xdf58('0x13'),auth[_0xdf58('0xa')](),controller[_0xdf58('0x1e')]);router[_0xdf58('0x1c')]('/:id/out_servers',auth[_0xdf58('0xa')](),controller[_0xdf58('0x1f')]);router[_0xdf58('0x1c')](_0xdf58('0x20'),auth[_0xdf58('0xa')](),controller['addInteraction']);router[_0xdf58('0x1c')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0xdf58('0x21')]);router[_0xdf58('0x1c')](_0xdf58('0x1a'),auth[_0xdf58('0xa')](),controller[_0xdf58('0x22')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdf58('0x23')]);router[_0xdf58('0x24')]('/:id/dispositions',auth[_0xdf58('0xa')](),controller[_0xdf58('0x25')]);router[_0xdf58('0x24')](_0xdf58('0x12'),auth[_0xdf58('0xa')](),controller[_0xdf58('0x26')]);router['delete']('/:id/in_servers',auth[_0xdf58('0xa')](),controller['removeImap']);router[_0xdf58('0x24')](_0xdf58('0x27'),auth[_0xdf58('0xa')](),controller['removeSmtp']);router[_0xdf58('0x24')](_0xdf58('0xe'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xdf58('0x1a'),auth[_0xdf58('0xa')](),controller[_0xdf58('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index d1afca4..2d6908e 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 _0x5878=['hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail'];(function(_0x156274,_0x415487){var _0x46ae9c=function(_0x3d8226){while(--_0x3d8226){_0x156274['push'](_0x156274['shift']());}};_0x46ae9c(++_0x415487);}(_0x5878,0x92));var _0x8587=function(_0x560926,_0xaec809){_0x560926=_0x560926-0x0;var _0x244329=_0x5878[_0x560926];return _0x244329;};'use strict';var Sequelize=require(_0x8587('0x0'));module['exports']={'description':{'type':Sequelize[_0x8587('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x8587('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x8587('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x8587('0x3')]},'markAsUnread':{'type':Sequelize[_0x8587('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x8587('0x1')],'allowNull':![],'defaultValue':_0x8587('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x8587('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x8587('0x3')],'defaultValue':function(){return _0x8587('0x6');}},'notificationSound':{'type':Sequelize[_0x8587('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8587('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8587('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8587('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8587('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8587('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8587('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8587('0x2')],'defaultValue':![],'comment':_0x8587('0x8'),'set':function(_0x436284){if(!_0x436284)this[_0x8587('0x9')](_0x8587('0xa'),null);this[_0x8587('0x9')](_0x8587('0xb'),_0x436284);}},'provider':{'type':Sequelize[_0x8587('0xc')](_0x8587('0xd'),_0x8587('0xe'),_0x8587('0xf'),_0x8587('0x10')),'defaultValue':null,'get':function(){if(!this[_0x8587('0x11')](_0x8587('0x12')))return _0x8587('0x13');return this[_0x8587('0x11')](_0x8587('0x12'));},'set':function(_0x131400){if(_0x131400==='custom')_0x131400=null;return this[_0x8587('0x9')](_0x8587('0x12'),_0x131400);}}}; \ No newline at end of file +var _0x0751=['custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider'];(function(_0x332a78,_0x4d38b3){var _0x537ac5=function(_0x1a7526){while(--_0x1a7526){_0x332a78['push'](_0x332a78['shift']());}};_0x537ac5(++_0x4d38b3);}(_0x0751,0x1dc));var _0x1075=function(_0x30eb8b,_0x3f87ed){_0x30eb8b=_0x30eb8b-0x0;var _0x377ef4=_0x0751[_0x30eb8b];return _0x377ef4;};'use strict';var Sequelize=require(_0x1075('0x0'));module[_0x1075('0x1')]={'description':{'type':Sequelize[_0x1075('0x2')]},'name':{'type':Sequelize[_0x1075('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x1075('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x1075('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1075('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1075('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x1075('0x4')]},'markAsUnread':{'type':Sequelize[_0x1075('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x1075('0x2')],'allowNull':![],'defaultValue':_0x1075('0x5')},'fontSize':{'type':Sequelize[_0x1075('0x6')](0x2)[_0x1075('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1075('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x1075('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1075('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1075('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1075('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1075('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1075('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x1075('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x1075('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x22403f){if(!_0x22403f)this[_0x1075('0x9')](_0x1075('0xa'),null);this[_0x1075('0x9')]('mandatoryDisposition',_0x22403f);}},'provider':{'type':Sequelize[_0x1075('0xb')](_0x1075('0xc'),_0x1075('0xd'),_0x1075('0xe'),_0x1075('0xf')),'defaultValue':null,'get':function(){if(!this[_0x1075('0x10')](_0x1075('0x11')))return _0x1075('0x12');return this[_0x1075('0x10')]('provider');},'set':function(_0x9d40e9){if(_0x9d40e9===_0x1075('0x12'))_0x9d40e9=null;return this[_0x1075('0x9')]('provider',_0x9d40e9);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index a3f6074..0cf93e1 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 _0x1a1c=['Disposition','create','getDispositions','findOne','order','removeDispositions','ids','addAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','getImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','tag','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','stack','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','Contacts','subject','out','messageId','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','update','destroy','MailAccounts','UserProfileResource','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','smtp.gmail.com','smtp-mail.outlook.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','MailServerOut','length','body','custom','provider','find','describe','addDisposition','MailAccountId'];(function(_0x40494a,_0x319ceb){var _0x1afd85=function(_0x5afc55){while(--_0x5afc55){_0x40494a['push'](_0x40494a['shift']());}};_0x1afd85(++_0x319ceb);}(_0x1a1c,0x1cd));var _0xc1a1=function(_0x1d6c52,_0x2de97c){_0x1d6c52=_0x1d6c52-0x0;var _0x555a50=_0x1a1c[_0x1d6c52];return _0x555a50;};'use strict';var moment=require(_0xc1a1('0x0'));var BPromise=require('bluebird');var util=require(_0xc1a1('0x1'));var path=require(_0xc1a1('0x2'));var _=require(_0xc1a1('0x3'));var juice=require(_0xc1a1('0x4'));var Redis=require(_0xc1a1('0x5'));var qs=require(_0xc1a1('0x6'));var logger=require(_0xc1a1('0x7'))(_0xc1a1('0x8'));var config=require(_0xc1a1('0x9'));var db=require('../../mysqldb')['db'];config[_0xc1a1('0xa')]=_[_0xc1a1('0xb')](config[_0xc1a1('0xa')],{'host':_0xc1a1('0xc'),'port':0x18eb});var socket=require(_0xc1a1('0xd'))(new Redis(config[_0xc1a1('0xa')]));require(_0xc1a1('0xe'))[_0xc1a1('0xf')](socket);var jayson=require(_0xc1a1('0x10'));var client=jayson[_0xc1a1('0x11')]['http']({'port':0x232b});function respondWithRpcPromise(_0x3eaf0a,_0x58df7c,_0x9c22d,_0x33558a){return new BPromise(function(_0x28e207,_0xbab823){var _0x18332b=_0x33558a||client;return _0x18332b['request'](_0x3eaf0a,_0x9c22d)[_0xc1a1('0x12')](function(_0x553ef0){logger[_0xc1a1('0x13')](_0xc1a1('0x14'),_0x58df7c,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x58df7c,_0xc1a1('0x15'),JSON[_0xc1a1('0x16')](_0x553ef0));if(_0x553ef0[_0xc1a1('0x17')]){if(_0x553ef0[_0xc1a1('0x17')]['code']===0x1f4){logger[_0xc1a1('0x17')]('MailAccount,\x20%s,\x20%s',_0x58df7c,_0x553ef0[_0xc1a1('0x17')][_0xc1a1('0x18')]);return _0xbab823(_0x553ef0[_0xc1a1('0x17')]['message']);}logger['error'](_0xc1a1('0x14'),_0x58df7c,_0x553ef0[_0xc1a1('0x17')][_0xc1a1('0x18')]);return _0x28e207(_0x553ef0['error'][_0xc1a1('0x18')]);}else{logger[_0xc1a1('0x13')]('MailAccount,\x20%s,\x20%s',_0x58df7c,_0xc1a1('0x15'));_0x28e207(_0x553ef0['result']['message']);}})[_0xc1a1('0x19')](function(_0x272138){logger[_0xc1a1('0x17')](_0xc1a1('0x14'),_0x58df7c,_0x272138);_0xbab823(_0x272138);});});}function respondWithStatusCode(_0x3cdd0c,_0x344fe4){_0x344fe4=_0x344fe4||0xcc;return function(_0x22a3fd){if(_0x22a3fd){return _0x3cdd0c[_0xc1a1('0x1a')](_0x344fe4);}return _0x3cdd0c['status'](_0x344fe4)[_0xc1a1('0x1b')]();};}function respondWithResult(_0x22c7d1,_0x305322){_0x305322=_0x305322||0xc8;return function(_0x2687a3){if(_0x2687a3){return _0x22c7d1[_0xc1a1('0x1c')](_0x305322)[_0xc1a1('0x1d')](_0x2687a3);}};}function respondWithFilteredResult(_0xf610ad,_0x3f5bf3){return function(_0x14d07d){if(_0x14d07d){var _0x5c3634=typeof _0x3f5bf3[_0xc1a1('0x1e')]===_0xc1a1('0x1f')&&typeof _0x3f5bf3[_0xc1a1('0x20')]===_0xc1a1('0x1f');var _0x9749fc=_0x14d07d['count'];var _0x13cf03=_0x5c3634?0x0:_0x3f5bf3[_0xc1a1('0x1e')];var _0x461d83=_0x5c3634?_0x14d07d[_0xc1a1('0x21')]:_0x3f5bf3['offset']+_0x3f5bf3[_0xc1a1('0x20')];var _0x24f8cf;if(_0x461d83>=_0x9749fc){_0x461d83=_0x9749fc;_0x24f8cf=0xc8;}else{_0x24f8cf=0xce;}_0xf610ad[_0xc1a1('0x1c')](_0x24f8cf);return _0xf610ad['set']('Content-Range',_0x13cf03+'-'+_0x461d83+'/'+_0x9749fc)[_0xc1a1('0x1d')](_0x14d07d);}return null;};}function saveUpdates(_0x29114b){return function(_0x235342){if(_0x235342){return _0x235342[_0xc1a1('0x22')](_0x29114b)[_0xc1a1('0x12')](function(_0x464a0){return _0x464a0;});}return null;};}function removeEntity(_0x2f0055){return function(_0x37eb81){if(_0x37eb81){return _0x37eb81[_0xc1a1('0x23')]()[_0xc1a1('0x12')](function(){var _0x2a9426=_0x37eb81['get']({'plain':!![]});var _0x214f1b=_0xc1a1('0x24');return db[_0xc1a1('0x25')]['destroy']({'where':{'type':_0x214f1b,'resourceId':_0x2a9426['id']}})[_0xc1a1('0x12')](function(){return _0x37eb81;});})[_0xc1a1('0x12')](function(){_0x2f0055[_0xc1a1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ab6c4){return function(_0x192d1c){if(!_0x192d1c){_0x3ab6c4[_0xc1a1('0x1a')](0x194);}return _0x192d1c;};}function handleError(_0x4d1e01,_0x44a917){_0x44a917=_0x44a917||0x1f4;return function(_0xb8db15){logger[_0xc1a1('0x17')](_0xb8db15['stack']);if(_0xb8db15[_0xc1a1('0x26')]){delete _0xb8db15[_0xc1a1('0x26')];}_0x4d1e01[_0xc1a1('0x1c')](_0x44a917)[_0xc1a1('0x27')](_0xb8db15);};}function getImapHost(_0x27bfee){switch(_0x27bfee){case _0xc1a1('0x28'):return _0xc1a1('0x29');case _0xc1a1('0x2a'):return _0xc1a1('0x2b');case _0xc1a1('0x2c'):return'imap-mail.outlook.com';case _0xc1a1('0x2d'):return _0xc1a1('0x2e');}throw new Error('Unknown\x20email\x20service\x20provider',_0x27bfee);}function getSmtpHost(_0x13803c){switch(_0x13803c){case _0xc1a1('0x28'):return _0xc1a1('0x2f');case _0xc1a1('0x2a'):return'smtp.mail.yahoo.com';case _0xc1a1('0x2c'):return _0xc1a1('0x30');case _0xc1a1('0x2d'):return'smtp.office365.com';}throw new Error(_0xc1a1('0x31'),_0x13803c);}function getAuthenticationOptions(_0x541dab,_0x50e41b){var _0x2f16ad={};var _0x191b74={};if(_0x541dab){_0x2f16ad[_0xc1a1('0x32')]=_0x191b74[_0xc1a1('0x32')]=_0x50e41b[_0xc1a1('0x33')];_0x2f16ad[_0xc1a1('0x34')]=_0x191b74[_0xc1a1('0x35')]=_0x50e41b[_0xc1a1('0x34')];if(_0x50e41b[_0xc1a1('0x36')]){_0x2f16ad[_0xc1a1('0x36')]=_0x191b74['modernAuthentication']=!![];_0x2f16ad['CloudProviderId']=_0x191b74[_0xc1a1('0x37')]=_0x50e41b['CloudProviderId'];_0x2f16ad[_0xc1a1('0x34')]=_0x191b74['pass']=null;}else{_0x2f16ad[_0xc1a1('0x37')]=_0x191b74[_0xc1a1('0x37')]=null;}_0x2f16ad[_0xc1a1('0x38')]=getImapHost(_0x541dab);_0x2f16ad[_0xc1a1('0x39')]=0x3e1;_0x191b74['host']=getSmtpHost(_0x541dab);_0x191b74['port']=0x24b;_0x191b74[_0xc1a1('0x3a')]=![];_0x2f16ad[_0xc1a1('0x3b')]=_0x191b74[_0xc1a1('0x3b')]=null;}else{if(_0x50e41b['authentication']){_0x2f16ad['user']=_0x191b74['user']=_0x50e41b[_0xc1a1('0x33')];_0x2f16ad['password']=_0x191b74[_0xc1a1('0x35')]=_0x50e41b['password'];}else{_0x2f16ad[_0xc1a1('0x3c')]=_0x191b74['authentication']=![];_0x2f16ad[_0xc1a1('0x32')]=_0x191b74[_0xc1a1('0x32')]=null;_0x2f16ad[_0xc1a1('0x34')]=_0x191b74[_0xc1a1('0x35')]=null;}_0x2f16ad[_0xc1a1('0x38')]=_0x50e41b[_0xc1a1('0x3d')]['host'];_0x2f16ad[_0xc1a1('0x39')]=_0x50e41b[_0xc1a1('0x3d')]['port'];_0x191b74[_0xc1a1('0x38')]=_0x50e41b[_0xc1a1('0x3e')][_0xc1a1('0x38')];_0x191b74[_0xc1a1('0x39')]=_0x50e41b['Smtp'][_0xc1a1('0x39')];}return{'Imap':_0x2f16ad,'Smtp':_0x191b74};}exports[_0xc1a1('0x3f')]=function(_0xba0267,_0x521bcc){var _0x57fdc7={'include':[{'model':db[_0xc1a1('0x40')],'as':_0xc1a1('0x3d')},{'model':db['MailServerOut'],'as':_0xc1a1('0x3e')},{'model':db[_0xc1a1('0x41')],'as':_0xc1a1('0x42')}]},_0x5b9517={},_0x50533e={'count':0x0,'rows':[]};var _0x1e684f=_[_0xc1a1('0x43')](db[_0xc1a1('0x44')][_0xc1a1('0x45')],function(_0x59b45b){return{'name':_0x59b45b[_0xc1a1('0x46')],'type':_0x59b45b[_0xc1a1('0x47')][_0xc1a1('0x48')]};});_0x5b9517[_0xc1a1('0x49')]=_[_0xc1a1('0x43')](_0x1e684f,_0xc1a1('0x26'));_0x5b9517[_0xc1a1('0x4a')]=_[_0xc1a1('0x4b')](_0xba0267[_0xc1a1('0x4a')]);_0x5b9517[_0xc1a1('0x4c')]=_[_0xc1a1('0x4d')](_0x5b9517[_0xc1a1('0x49')],_0x5b9517[_0xc1a1('0x4a')]);_0x57fdc7['attributes']=_[_0xc1a1('0x4d')](_0x5b9517[_0xc1a1('0x49')],qs[_0xc1a1('0x4e')](_0xba0267[_0xc1a1('0x4a')][_0xc1a1('0x4e')]));_0x57fdc7[_0xc1a1('0x4f')]=_0x57fdc7[_0xc1a1('0x4f')]['length']?_0x57fdc7[_0xc1a1('0x4f')]:_0x5b9517[_0xc1a1('0x49')];if(!_0xba0267[_0xc1a1('0x4a')][_0xc1a1('0x50')]('nolimit')){_0x57fdc7[_0xc1a1('0x20')]=qs[_0xc1a1('0x20')](_0xba0267[_0xc1a1('0x4a')][_0xc1a1('0x20')]);_0x57fdc7['offset']=qs[_0xc1a1('0x1e')](_0xba0267[_0xc1a1('0x4a')]['offset']);}_0x57fdc7['order']=qs[_0xc1a1('0x51')](_0xba0267[_0xc1a1('0x4a')][_0xc1a1('0x51')]);_0x57fdc7[_0xc1a1('0x52')]=qs['filters'](_[_0xc1a1('0x53')](_0xba0267[_0xc1a1('0x4a')],_0x5b9517[_0xc1a1('0x4c')]),_0x1e684f);if(_0xba0267['query']['filter']){_0x57fdc7['where']=_[_0xc1a1('0x54')](_0x57fdc7[_0xc1a1('0x52')],{'$or':_[_0xc1a1('0x43')](_0x1e684f,function(_0x24bc6d){if(_0x24bc6d[_0xc1a1('0x47')]!==_0xc1a1('0x55')){var _0x1ead04={};_0x1ead04[_0x24bc6d['name']]={'$like':'%'+_0xba0267[_0xc1a1('0x4a')][_0xc1a1('0x56')]+'%'};return _0x1ead04;}})});}_0x57fdc7=_[_0xc1a1('0x54')]({},_0x57fdc7,_0xba0267[_0xc1a1('0x57')]);var _0x232b59={'where':_0x57fdc7['where']};return db[_0xc1a1('0x44')][_0xc1a1('0x21')](_0x232b59)[_0xc1a1('0x12')](function(_0x293dc9){_0x50533e[_0xc1a1('0x21')]=_0x293dc9;if(_0xba0267[_0xc1a1('0x4a')][_0xc1a1('0x58')]){_0x57fdc7[_0xc1a1('0x59')]=[{'all':!![]}];}return db['MailAccount'][_0xc1a1('0x5a')](_0x57fdc7);})[_0xc1a1('0x12')](function(_0x3f9c7c){_0x50533e[_0xc1a1('0x5b')]=_0x3f9c7c;return _0x50533e;})[_0xc1a1('0x12')](respondWithFilteredResult(_0x521bcc,_0x57fdc7))['catch'](handleError(_0x521bcc,null));};exports[_0xc1a1('0x5c')]=function(_0x2c80b8,_0x62aa18){var _0x493487={'raw':![],'where':{'id':_0x2c80b8[_0xc1a1('0x5d')]['id']},'include':[{'model':db[_0xc1a1('0x40')],'as':_0xc1a1('0x3d')},{'model':db[_0xc1a1('0x5e')],'as':_0xc1a1('0x3e')},{'model':db['Pause'],'as':_0xc1a1('0x42')}]},_0x34a1b8={};_0x34a1b8[_0xc1a1('0x49')]=_['keys'](db['MailAccount']['rawAttributes']);_0x34a1b8[_0xc1a1('0x4a')]=_[_0xc1a1('0x4b')](_0x2c80b8[_0xc1a1('0x4a')]);_0x34a1b8[_0xc1a1('0x4c')]=_[_0xc1a1('0x4d')](_0x34a1b8[_0xc1a1('0x49')],_0x34a1b8[_0xc1a1('0x4a')]);_0x493487[_0xc1a1('0x4f')]=_['intersection'](_0x34a1b8[_0xc1a1('0x49')],qs[_0xc1a1('0x4e')](_0x2c80b8['query'][_0xc1a1('0x4e')]));_0x493487[_0xc1a1('0x4f')]=_0x493487[_0xc1a1('0x4f')][_0xc1a1('0x5f')]?_0x493487[_0xc1a1('0x4f')]:_0x34a1b8[_0xc1a1('0x49')];if(_0x2c80b8[_0xc1a1('0x4a')][_0xc1a1('0x58')]){_0x493487['include']=[{'all':!![]}];}_0x493487=_[_0xc1a1('0x54')]({},_0x493487,_0x2c80b8['options']);return db[_0xc1a1('0x44')]['find'](_0x493487)[_0xc1a1('0x12')](handleEntityNotFound(_0x62aa18,null))[_0xc1a1('0x12')](respondWithResult(_0x62aa18,null))[_0xc1a1('0x19')](handleError(_0x62aa18,null));};exports[_0xc1a1('0x22')]=function(_0x4897f1,_0x71faab){if(_0x4897f1[_0xc1a1('0x60')]['id']){delete _0x4897f1[_0xc1a1('0x60')]['id'];}var _0x43f502=_0x4897f1['body']['provider']===_0xc1a1('0x61')?null:_0x4897f1[_0xc1a1('0x60')][_0xc1a1('0x62')];var _0xd455e=_0x4897f1[_0xc1a1('0x60')]['Imap']||{};var _0x2beb80=_0x4897f1[_0xc1a1('0x60')][_0xc1a1('0x3e')]||{};if(_0x43f502){_0xd455e[_0xc1a1('0x38')]=getImapHost(_0x43f502);_0xd455e['port']=0x3e1;_0x2beb80[_0xc1a1('0x38')]=getSmtpHost(_0x43f502);_0x2beb80['port']=0x24b;_0x2beb80[_0xc1a1('0x3a')]=![];}if(_0x2beb80[_0xc1a1('0x36')]){_0x2beb80[_0xc1a1('0x3a')]=![];}else{_0x2beb80[_0xc1a1('0x37')]=null;}if(!_0xd455e['modernAuthentication'])_0xd455e[_0xc1a1('0x37')]=null;_0x4897f1[_0xc1a1('0x60')][_0xc1a1('0x3d')]=_0xd455e;_0x4897f1[_0xc1a1('0x60')][_0xc1a1('0x3e')]=_0x2beb80;return db['MailAccount'][_0xc1a1('0x63')]({'where':{'id':_0x4897f1[_0xc1a1('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xc1a1('0x3d')},{'model':db['MailServerOut'],'as':_0xc1a1('0x3e')},{'model':db[_0xc1a1('0x41')],'as':_0xc1a1('0x42')}]})[_0xc1a1('0x12')](handleEntityNotFound(_0x71faab,null))[_0xc1a1('0x12')](function(_0x59c16d){if(!_0x59c16d)throw new Error('Mail\x20Account\x20not\x20found');if(_0x59c16d[_0xc1a1('0x3b')])delete _0x4897f1[_0xc1a1('0x60')]['Imap'];return _0x59c16d;})[_0xc1a1('0x12')](saveUpdates(_0x4897f1[_0xc1a1('0x60')],null))[_0xc1a1('0x12')](function(_0x2717e3){if(!_0x4897f1[_0xc1a1('0x60')][_0xc1a1('0x3d')])return _0x2717e3;return db[_0xc1a1('0x40')][_0xc1a1('0x22')](_0x4897f1['body'][_0xc1a1('0x3d')],{'where':{'MailAccountId':_0x2717e3['id']}})[_0xc1a1('0x12')](function(){return _0x2717e3;});})[_0xc1a1('0x12')](function(_0x30dfb6){if(!_0x4897f1['body'][_0xc1a1('0x3e')])return _0x30dfb6;return db[_0xc1a1('0x5e')][_0xc1a1('0x22')](_0x4897f1[_0xc1a1('0x60')][_0xc1a1('0x3e')],{'where':{'MailAccountId':_0x30dfb6['id']}})[_0xc1a1('0x12')](function(){return _0x30dfb6;});})[_0xc1a1('0x12')](respondWithResult(_0x71faab,null))['catch'](handleError(_0x71faab,null));};exports[_0xc1a1('0x64')]=function(_0x30a65a,_0x15cfc5){return db['MailAccount'][_0xc1a1('0x64')]()[_0xc1a1('0x12')](respondWithResult(_0x15cfc5,null))[_0xc1a1('0x19')](handleError(_0x15cfc5,null));};exports[_0xc1a1('0x65')]=function(_0x4cac9e,_0x28bd82){if(_0x4cac9e[_0xc1a1('0x60')]['id']){delete _0x4cac9e[_0xc1a1('0x60')]['id'];}return db[_0xc1a1('0x44')][_0xc1a1('0x63')]({'where':{'id':_0x4cac9e['params']['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x28bd82,null))[_0xc1a1('0x12')](function(_0x17c621){if(_0x17c621){_0x4cac9e[_0xc1a1('0x60')][_0xc1a1('0x66')]=_0x17c621['id'];return db[_0xc1a1('0x67')][_0xc1a1('0x68')](_0x4cac9e[_0xc1a1('0x60')]);}})[_0xc1a1('0x12')](respondWithResult(_0x28bd82,null))[_0xc1a1('0x19')](handleError(_0x28bd82,null));};exports[_0xc1a1('0x69')]=function(_0x4d89be,_0x83679f){var _0x3c2f20={'raw':![],'where':{}};var _0xcea2aa={};var _0xea074={'count':0x0,'rows':[]};return db[_0xc1a1('0x44')][_0xc1a1('0x6a')]({'where':{'id':_0x4d89be[_0xc1a1('0x5d')]['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x83679f,null))[_0xc1a1('0x12')](function(_0x1a37aa){if(_0x1a37aa){_0xcea2aa[_0xc1a1('0x49')]=_['keys'](db[_0xc1a1('0x67')][_0xc1a1('0x45')]);_0xcea2aa[_0xc1a1('0x4a')]=_[_0xc1a1('0x4b')](_0x4d89be[_0xc1a1('0x4a')]);_0xcea2aa[_0xc1a1('0x4c')]=_['intersection'](_0xcea2aa[_0xc1a1('0x49')],_0xcea2aa[_0xc1a1('0x4a')]);_0x3c2f20[_0xc1a1('0x4f')]=_[_0xc1a1('0x4d')](_0xcea2aa[_0xc1a1('0x49')],qs['fields'](_0x4d89be[_0xc1a1('0x4a')]['fields']));_0x3c2f20['attributes']=_0x3c2f20[_0xc1a1('0x4f')]['length']?_0x3c2f20[_0xc1a1('0x4f')]:_0xcea2aa[_0xc1a1('0x49')];if(!_0x4d89be['query'][_0xc1a1('0x50')]('nolimit')){_0x3c2f20[_0xc1a1('0x20')]=qs[_0xc1a1('0x20')](_0x4d89be[_0xc1a1('0x4a')][_0xc1a1('0x20')]);_0x3c2f20[_0xc1a1('0x1e')]=qs['offset'](_0x4d89be[_0xc1a1('0x4a')][_0xc1a1('0x1e')]);}_0x3c2f20[_0xc1a1('0x6b')]=qs[_0xc1a1('0x51')](_0x4d89be[_0xc1a1('0x4a')][_0xc1a1('0x51')]);_0x3c2f20[_0xc1a1('0x52')]=qs[_0xc1a1('0x4c')](_[_0xc1a1('0x53')](_0x4d89be[_0xc1a1('0x4a')],_0xcea2aa['filters']));_0x3c2f20['where'][_0xc1a1('0x66')]=_0x1a37aa['id'];if(_0x4d89be[_0xc1a1('0x4a')][_0xc1a1('0x56')]){_0x3c2f20[_0xc1a1('0x52')]=_[_0xc1a1('0x54')](_0x3c2f20['where'],{'$or':_[_0xc1a1('0x43')](_0x3c2f20[_0xc1a1('0x4f')],function(_0x54b3ce){var _0x3918e6={};_0x3918e6[_0x54b3ce]={'$like':'%'+_0x4d89be[_0xc1a1('0x4a')]['filter']+'%'};return _0x3918e6;})});}_0x3c2f20=_[_0xc1a1('0x54')]({},_0x3c2f20,_0x4d89be['options']);return db['Disposition'][_0xc1a1('0x21')]({'where':_0x3c2f20[_0xc1a1('0x52')]})[_0xc1a1('0x12')](function(_0x10fdb7){_0xea074[_0xc1a1('0x21')]=_0x10fdb7;if(_0x4d89be[_0xc1a1('0x4a')][_0xc1a1('0x58')]){_0x3c2f20[_0xc1a1('0x59')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3c2f20);})[_0xc1a1('0x12')](function(_0x5cf88a){_0xea074[_0xc1a1('0x5b')]=_0x5cf88a;return _0xea074;});}})[_0xc1a1('0x12')](respondWithFilteredResult(_0x83679f,_0x3c2f20))[_0xc1a1('0x19')](handleError(_0x83679f,null));};exports[_0xc1a1('0x6c')]=function(_0x5e00d6,_0x57be4f){return db[_0xc1a1('0x44')][_0xc1a1('0x63')]({'where':{'id':_0x5e00d6[_0xc1a1('0x5d')]['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x57be4f,null))[_0xc1a1('0x12')](function(_0x3917f8){if(_0x3917f8){return _0x3917f8['removeDispositions'](_0x5e00d6[_0xc1a1('0x4a')][_0xc1a1('0x6d')]);}})['then'](respondWithStatusCode(_0x57be4f,null))['catch'](handleError(_0x57be4f,null));};exports[_0xc1a1('0x6e')]=function(_0x221140,_0x5679db){if(_0x221140[_0xc1a1('0x60')]['id']){delete _0x221140[_0xc1a1('0x60')]['id'];}return db['MailAccount'][_0xc1a1('0x63')]({'where':{'id':_0x221140[_0xc1a1('0x5d')]['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x5679db,null))[_0xc1a1('0x12')](function(_0x424717){if(_0x424717){_0x221140[_0xc1a1('0x60')]['MailAccountId']=_0x424717['id'];return db['CannedAnswer'][_0xc1a1('0x68')](_0x221140[_0xc1a1('0x60')]);}})[_0xc1a1('0x12')](respondWithResult(_0x5679db,null))['catch'](handleError(_0x5679db,null));};exports[_0xc1a1('0x6f')]=function(_0x5e5579,_0x1c3fed){var _0xdfa021={'raw':![],'where':{}};var _0x319b86={};var _0x396f7f={'count':0x0,'rows':[]};return db['MailAccount'][_0xc1a1('0x6a')]({'where':{'id':_0x5e5579[_0xc1a1('0x5d')]['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x1c3fed,null))[_0xc1a1('0x12')](function(_0x5aa5f8){if(_0x5aa5f8){_0x319b86['model']=_[_0xc1a1('0x4b')](db['CannedAnswer'][_0xc1a1('0x45')]);_0x319b86[_0xc1a1('0x4a')]=_[_0xc1a1('0x4b')](_0x5e5579[_0xc1a1('0x4a')]);_0x319b86[_0xc1a1('0x4c')]=_['intersection'](_0x319b86['model'],_0x319b86['query']);_0xdfa021[_0xc1a1('0x4f')]=_[_0xc1a1('0x4d')](_0x319b86[_0xc1a1('0x49')],qs[_0xc1a1('0x4e')](_0x5e5579[_0xc1a1('0x4a')][_0xc1a1('0x4e')]));_0xdfa021['attributes']=_0xdfa021[_0xc1a1('0x4f')][_0xc1a1('0x5f')]?_0xdfa021[_0xc1a1('0x4f')]:_0x319b86[_0xc1a1('0x49')];if(!_0x5e5579[_0xc1a1('0x4a')]['hasOwnProperty']('nolimit')){_0xdfa021[_0xc1a1('0x20')]=qs['limit'](_0x5e5579['query'][_0xc1a1('0x20')]);_0xdfa021[_0xc1a1('0x1e')]=qs[_0xc1a1('0x1e')](_0x5e5579['query']['offset']);}_0xdfa021[_0xc1a1('0x6b')]=qs[_0xc1a1('0x51')](_0x5e5579[_0xc1a1('0x4a')][_0xc1a1('0x51')]);_0xdfa021['where']=qs[_0xc1a1('0x4c')](_[_0xc1a1('0x53')](_0x5e5579[_0xc1a1('0x4a')],_0x319b86['filters']));_0xdfa021[_0xc1a1('0x52')]['MailAccountId']=_0x5aa5f8['id'];if(_0x5e5579[_0xc1a1('0x4a')][_0xc1a1('0x56')]){_0xdfa021[_0xc1a1('0x52')]=_['merge'](_0xdfa021['where'],{'$or':_[_0xc1a1('0x43')](_0xdfa021['attributes'],function(_0x4e6ab1){var _0x484ea4={};_0x484ea4[_0x4e6ab1]={'$like':'%'+_0x5e5579[_0xc1a1('0x4a')]['filter']+'%'};return _0x484ea4;})});}_0xdfa021=_[_0xc1a1('0x54')]({},_0xdfa021,_0x5e5579['options']);return db['CannedAnswer']['count']({'where':_0xdfa021[_0xc1a1('0x52')]})[_0xc1a1('0x12')](function(_0x230be9){_0x396f7f[_0xc1a1('0x21')]=_0x230be9;if(_0x5e5579[_0xc1a1('0x4a')][_0xc1a1('0x58')]){_0xdfa021[_0xc1a1('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc1a1('0x5a')](_0xdfa021);})[_0xc1a1('0x12')](function(_0x48622e){_0x396f7f[_0xc1a1('0x5b')]=_0x48622e;return _0x396f7f;});}})['then'](respondWithFilteredResult(_0x1c3fed,_0xdfa021))[_0xc1a1('0x19')](handleError(_0x1c3fed,null));};exports[_0xc1a1('0x70')]=function(_0x33b04b,_0x3ed606){return db[_0xc1a1('0x44')][_0xc1a1('0x63')]({'where':{'id':_0x33b04b['params']['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x3ed606,null))['then'](function(_0x36e8d5){if(_0x36e8d5){return _0x36e8d5[_0xc1a1('0x70')](_0x33b04b[_0xc1a1('0x4a')][_0xc1a1('0x6d')]);}})[_0xc1a1('0x12')](respondWithStatusCode(_0x3ed606,null))[_0xc1a1('0x19')](handleError(_0x3ed606,null));};exports[_0xc1a1('0x68')]=function(_0x1298d3,_0x34bc0b){var _0x580bf5={'name':_0x1298d3[_0xc1a1('0x60')][_0xc1a1('0x26')],'key':_0x1298d3['body'][_0xc1a1('0x48')],'provider':_0x1298d3[_0xc1a1('0x60')]['provider']==='custom'?null:_0x1298d3[_0xc1a1('0x60')][_0xc1a1('0x62')],'email':_0x1298d3[_0xc1a1('0x60')][_0xc1a1('0x71')],'ListId':_0x1298d3[_0xc1a1('0x60')][_0xc1a1('0x72')],'active':!_[_0xc1a1('0x73')](_0x1298d3[_0xc1a1('0x60')]['active'])?_0x1298d3['body'][_0xc1a1('0x74')]:!![],'description':_0x1298d3['body'][_0xc1a1('0x75')]||null};var _0x261227=getAuthenticationOptions(_0x580bf5[_0xc1a1('0x62')],_0x1298d3[_0xc1a1('0x60')]);_0x580bf5[_0xc1a1('0x3d')]=_0x261227[_0xc1a1('0x3d')];_0x580bf5[_0xc1a1('0x3e')]=_0x261227[_0xc1a1('0x3e')];return db[_0xc1a1('0x44')]['create'](_0x580bf5,{'include':[{'model':db['MailServerOut'],'as':_0xc1a1('0x3e')},{'model':db['MailServerIn'],'as':_0xc1a1('0x3d')}]})[_0xc1a1('0x12')](function(_0x4372bb){var _0x1956c0=_0x1298d3['user'][_0xc1a1('0x76')]({'plain':!![]});if(!_0x1956c0)throw new Error(_0xc1a1('0x77'));if(_0x1956c0[_0xc1a1('0x78')]===_0xc1a1('0x32')){var _0x3fb835=_0x4372bb[_0xc1a1('0x76')]({'plain':!![]});return db[_0xc1a1('0x79')][_0xc1a1('0x63')]({'where':{'name':_0xc1a1('0x24'),'userProfileId':_0x1956c0['userProfileId']},'raw':!![]})[_0xc1a1('0x12')](function(_0x573fc9){if(_0x573fc9&&_0x573fc9[_0xc1a1('0x7a')]===0x0){return db['UserProfileResource']['create']({'name':_0x3fb835['name'],'resourceId':_0x3fb835['id'],'type':_0x573fc9[_0xc1a1('0x26')],'sectionId':_0x573fc9['id']},{})[_0xc1a1('0x12')](function(){return _0x4372bb;});}else{return _0x4372bb;}})[_0xc1a1('0x19')](function(_0x6a7790){logger[_0xc1a1('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6a7790);throw _0x6a7790;});}return _0x4372bb;})['then'](respondWithResult(_0x34bc0b,0xc9))[_0xc1a1('0x19')](handleError(_0x34bc0b,null));};exports[_0xc1a1('0x7b')]=function(_0x332731,_0x29a99d){return db['MailAccount'][_0xc1a1('0x6a')]({'where':{'id':_0x332731[_0xc1a1('0x5d')]['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x29a99d,null))[_0xc1a1('0x12')](function(_0x2c1339){if(_0x2c1339){return _0x2c1339[_0xc1a1('0x7b')]();}return null;})['then'](respondWithResult(_0x29a99d,null))[_0xc1a1('0x19')](handleError(_0x29a99d,null));};exports['addImap']=function(_0x3944ae,_0x13dc59){if(_0x3944ae['body']['id']){delete _0x3944ae[_0xc1a1('0x60')]['id'];}return db[_0xc1a1('0x44')][_0xc1a1('0x63')]({'where':{'id':_0x3944ae[_0xc1a1('0x5d')]['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x13dc59,null))['then'](function(_0x3f8b49){if(_0x3f8b49){_0x3944ae[_0xc1a1('0x60')][_0xc1a1('0x66')]=_0x3f8b49['id'];return db[_0xc1a1('0x40')][_0xc1a1('0x68')](_0x3944ae['body']);}})[_0xc1a1('0x12')](respondWithResult(_0x13dc59,null))['catch'](handleError(_0x13dc59,null));};exports[_0xc1a1('0x7c')]=function(_0x3ff03f,_0x37ac72){return db[_0xc1a1('0x44')][_0xc1a1('0x6a')]({'where':{'id':_0x3ff03f['params']['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x37ac72,null))[_0xc1a1('0x12')](function(_0x31fdf9){if(_0x31fdf9){return _0x31fdf9['setImap'](null);}return null;})[_0xc1a1('0x12')](respondWithStatusCode(_0x37ac72,null))['catch'](handleError(_0x37ac72,null));};exports[_0xc1a1('0x7d')]=function(_0x1c6bd0,_0x4b1fca){return db['MailAccount']['findOne']({'where':{'id':_0x1c6bd0[_0xc1a1('0x5d')]['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x4b1fca,null))[_0xc1a1('0x12')](function(_0x8e87f2){if(_0x8e87f2){return _0x8e87f2[_0xc1a1('0x7d')]();}return null;})[_0xc1a1('0x12')](respondWithResult(_0x4b1fca,null))['catch'](handleError(_0x4b1fca,null));};exports[_0xc1a1('0x7e')]=function(_0xb95e68,_0x523021){if(_0xb95e68['body']['id']){delete _0xb95e68[_0xc1a1('0x60')]['id'];}return db[_0xc1a1('0x44')][_0xc1a1('0x63')]({'where':{'id':_0xb95e68[_0xc1a1('0x5d')]['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x523021,null))['then'](function(_0x24bf8c){if(_0x24bf8c){_0xb95e68['body'][_0xc1a1('0x66')]=_0x24bf8c['id'];return db[_0xc1a1('0x5e')][_0xc1a1('0x68')](_0xb95e68['body']);}})[_0xc1a1('0x12')](respondWithResult(_0x523021,null))[_0xc1a1('0x19')](handleError(_0x523021,null));};exports[_0xc1a1('0x7f')]=function(_0x5a8d13,_0x1fa4f1){return db[_0xc1a1('0x44')]['findOne']({'where':{'id':_0x5a8d13['params']['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x1fa4f1,null))['then'](function(_0x56d5){if(_0x56d5){return _0x56d5[_0xc1a1('0x80')](null);}return null;})[_0xc1a1('0x12')](respondWithStatusCode(_0x1fa4f1,null))[_0xc1a1('0x19')](handleError(_0x1fa4f1,null));};exports[_0xc1a1('0x81')]=function(_0x16804a,_0x40c149){return db[_0xc1a1('0x82')][_0xc1a1('0x63')]({'where':{'id':_0x16804a['params']['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x40c149,null))[_0xc1a1('0x12')](function(_0xc936d7){if(_0xc936d7){return _0xc936d7[_0xc1a1('0x81')](_0x16804a[_0xc1a1('0x60')]['ids'],_[_0xc1a1('0x83')](_0x16804a[_0xc1a1('0x60')],[_0xc1a1('0x6d'),'id'])||{});}})[_0xc1a1('0x12')](respondWithResult(_0x40c149,null))[_0xc1a1('0x19')](handleError(_0x40c149,null));};exports[_0xc1a1('0x84')]=function(_0x4ba73c,_0x353506){var _0x380fa5={'raw':![],'where':{}};var _0x165bcc={};var _0x3e5ad8={'count':0x0,'rows':[]};return db[_0xc1a1('0x44')][_0xc1a1('0x6a')]({'where':{'id':_0x4ba73c[_0xc1a1('0x5d')]['id']}})['then'](handleEntityNotFound(_0x353506,null))[_0xc1a1('0x12')](function(_0x1b1ab8){if(_0x1b1ab8){_0x165bcc['model']=_[_0xc1a1('0x4b')](db[_0xc1a1('0x82')]['rawAttributes']);_0x165bcc['query']=_['keys'](_0x4ba73c[_0xc1a1('0x4a')]);_0x165bcc[_0xc1a1('0x4c')]=_['intersection'](_0x165bcc[_0xc1a1('0x49')],_0x165bcc[_0xc1a1('0x4a')]);_0x380fa5['attributes']=_['intersection'](_0x165bcc[_0xc1a1('0x49')],qs[_0xc1a1('0x4e')](_0x4ba73c[_0xc1a1('0x4a')][_0xc1a1('0x4e')]));_0x380fa5[_0xc1a1('0x4f')]=_0x380fa5[_0xc1a1('0x4f')][_0xc1a1('0x5f')]?_0x380fa5[_0xc1a1('0x4f')]:_0x165bcc['model'];if(!_0x4ba73c[_0xc1a1('0x4a')]['hasOwnProperty']('nolimit')){_0x380fa5['limit']=qs['limit'](_0x4ba73c[_0xc1a1('0x4a')][_0xc1a1('0x20')]);_0x380fa5[_0xc1a1('0x1e')]=qs[_0xc1a1('0x1e')](_0x4ba73c['query']['offset']);}_0x380fa5['order']=qs[_0xc1a1('0x51')](_0x4ba73c[_0xc1a1('0x4a')][_0xc1a1('0x51')]);_0x380fa5['where']=qs[_0xc1a1('0x4c')](_[_0xc1a1('0x53')](_0x4ba73c['query'],_0x165bcc[_0xc1a1('0x4c')]));_0x380fa5[_0xc1a1('0x52')]['MailAccountId']=_0x1b1ab8['id'];if(_0x4ba73c['query'][_0xc1a1('0x56')]){_0x380fa5['where']=_[_0xc1a1('0x54')](_0x380fa5['where'],{'$or':_[_0xc1a1('0x43')](_0x380fa5[_0xc1a1('0x4f')],function(_0x1edce1){var _0x529c0a={};_0x529c0a[_0x1edce1]={'$like':'%'+_0x4ba73c[_0xc1a1('0x4a')][_0xc1a1('0x56')]+'%'};return _0x529c0a;})});}_0x380fa5=_[_0xc1a1('0x54')]({},_0x380fa5,_0x4ba73c['options']);return db[_0xc1a1('0x82')]['count']({'where':_0x380fa5[_0xc1a1('0x52')]})['then'](function(_0xf92256){_0x3e5ad8[_0xc1a1('0x21')]=_0xf92256;if(_0x4ba73c[_0xc1a1('0x4a')][_0xc1a1('0x58')]){_0x380fa5[_0xc1a1('0x59')]=[{'model':db['CmContact'],'as':_0xc1a1('0x85'),'required':![]},{'model':db[_0xc1a1('0x86')],'as':_0xc1a1('0x87'),'attributes':[_0xc1a1('0x26'),_0xc1a1('0x88'),_0xc1a1('0x89')],'required':![]},{'model':db[_0xc1a1('0x8a')],'as':_0xc1a1('0x8b'),'attributes':['id','name','color'],'where':_0x4ba73c['query']['tag']?{'id':_0x4ba73c['query'][_0xc1a1('0x8c')]}:undefined,'required':_0x4ba73c['query'][_0xc1a1('0x8c')]?!![]:![]}];}return db['MailInteraction'][_0xc1a1('0x5a')](_0x380fa5);})[_0xc1a1('0x12')](function(_0x1fc830){_0x3e5ad8[_0xc1a1('0x5b')]=_0x1fc830;return _0x3e5ad8;});}})[_0xc1a1('0x12')](respondWithFilteredResult(_0x353506,_0x380fa5))[_0xc1a1('0x19')](handleError(_0x353506,null));};exports['addApplications']=function addApplications(_0x4de767,_0x2ba2c1){var _0x2c4adb=_0x4de767[_0xc1a1('0x5d')]['id'];var _0x1014d2=_0x4de767[_0xc1a1('0x60')];var _0x215eb1=0xc8;var _0x580ddc=null;return db[_0xc1a1('0x8d')][_0xc1a1('0x8e')]({'isolationLevel':db[_0xc1a1('0x8d')]['Transaction'][_0xc1a1('0x8f')][_0xc1a1('0x90')]},function(_0x47d8b3){return db[_0xc1a1('0x44')][_0xc1a1('0x6a')]({'where':{'id':_0x2c4adb},'transaction':_0x47d8b3})[_0xc1a1('0x12')](function(_0x17c753){if(_0x17c753){return db[_0xc1a1('0x91')][_0xc1a1('0x23')]({'where':{'MailAccountId':_0x2c4adb},'transaction':_0x47d8b3})[_0xc1a1('0x12')](function(){var _0x3821be=_[_0xc1a1('0x43')](_0x1014d2,function(_0x31ec0f){_0x31ec0f['MailAccountId']=_0x2c4adb;return _0x31ec0f;});return db['MailApplication']['bulkCreate'](_0x3821be,{'transaction':_0x47d8b3});});}else{_0x215eb1=0x194;_0x580ddc=[];}});})[_0xc1a1('0x12')](function(){if(_0x215eb1!==0x194){return db[_0xc1a1('0x91')][_0xc1a1('0x92')]({'where':{'MailAccountId':_0x2c4adb},'order':_0xc1a1('0x93')})[_0xc1a1('0x12')](function(_0x2a9c23){_0x580ddc=_0x2a9c23;});}})[_0xc1a1('0x19')](function(_0x416c99){_0x215eb1=0x1f4;logger[_0xc1a1('0x17')](_0x416c99[_0xc1a1('0x94')]);if(_0x416c99[_0xc1a1('0x26')]){delete _0x416c99[_0xc1a1('0x26')];}_0x580ddc=_0x416c99;})['finally'](function(){if(_0x580ddc===null){_0x2ba2c1[_0xc1a1('0x1a')](_0x215eb1);}else{if(_0x215eb1===0x1f4){_0x2ba2c1['status'](_0x215eb1)[_0xc1a1('0x27')](_0x580ddc);}else{_0x2ba2c1[_0xc1a1('0x1c')](_0x215eb1)['json'](_0x580ddc);}}});};exports[_0xc1a1('0x95')]=function(_0x5e3262,_0x20cfed){var _0x47c9ab={};var _0xf745e8={};var _0x21f7ae;var _0x252a9d;return db[_0xc1a1('0x44')][_0xc1a1('0x6a')]({'where':{'id':_0x5e3262[_0xc1a1('0x5d')]['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x20cfed,null))[_0xc1a1('0x12')](function(_0x34550c){if(_0x34550c){_0x21f7ae=_0x34550c;_0xf745e8[_0xc1a1('0x49')]=_[_0xc1a1('0x4b')](db[_0xc1a1('0x91')][_0xc1a1('0x45')]);_0xf745e8[_0xc1a1('0x4a')]=_[_0xc1a1('0x4b')](_0x5e3262[_0xc1a1('0x4a')]);_0xf745e8[_0xc1a1('0x4c')]=_[_0xc1a1('0x4d')](_0xf745e8['model'],_0xf745e8[_0xc1a1('0x4a')]);_0x47c9ab[_0xc1a1('0x4f')]=_[_0xc1a1('0x4d')](_0xf745e8[_0xc1a1('0x49')],qs[_0xc1a1('0x4e')](_0x5e3262[_0xc1a1('0x4a')][_0xc1a1('0x4e')]));_0x47c9ab['attributes']=_0x47c9ab[_0xc1a1('0x4f')][_0xc1a1('0x5f')]?_0x47c9ab['attributes']:_0xf745e8[_0xc1a1('0x49')];_0x47c9ab['order']=qs[_0xc1a1('0x51')](_0x5e3262[_0xc1a1('0x4a')][_0xc1a1('0x51')]);_0x47c9ab[_0xc1a1('0x52')]=qs['filters'](_[_0xc1a1('0x53')](_0x5e3262['query'],_0xf745e8[_0xc1a1('0x4c')]));if(_0x5e3262['query'][_0xc1a1('0x56')]){_0x47c9ab['where']=_['merge'](_0x47c9ab[_0xc1a1('0x52')],{'$or':_[_0xc1a1('0x43')](_0x47c9ab[_0xc1a1('0x4f')],function(_0xc3ce29){var _0x53e758={};_0x53e758[_0xc3ce29]={'$like':'%'+_0x5e3262[_0xc1a1('0x4a')][_0xc1a1('0x56')]+'%'};return _0x53e758;})});}_0x47c9ab=_[_0xc1a1('0x54')]({},_0x47c9ab,_0x5e3262[_0xc1a1('0x57')]);return _0x21f7ae[_0xc1a1('0x95')](_0x47c9ab);}})['then'](function(_0x1d5864){if(_0x1d5864){_0x252a9d=_0x1d5864['length'];if(!_0x5e3262['query'][_0xc1a1('0x50')]('nolimit')){_0x47c9ab['limit']=qs[_0xc1a1('0x20')](_0x5e3262[_0xc1a1('0x4a')][_0xc1a1('0x20')]);_0x47c9ab[_0xc1a1('0x1e')]=qs['offset'](_0x5e3262['query'][_0xc1a1('0x1e')]);}return _0x21f7ae['getApplications'](_0x47c9ab);}})['then'](function(_0x57be35){if(_0x57be35){return _0x57be35?{'count':_0x252a9d,'rows':_0x57be35}:null;}})[_0xc1a1('0x12')](respondWithResult(_0x20cfed,null))[_0xc1a1('0x19')](handleError(_0x20cfed,null));};exports[_0xc1a1('0x96')]=function(_0x105cef,_0x1d85c2){var _0x337294={'raw':!![],'where':{}};var _0x365b6f={};var _0x1aa0fb={'count':0x0,'rows':[]};return db[_0xc1a1('0x44')]['findOne']({'where':{'id':_0x105cef['params']['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x1d85c2,null))['then'](function(_0x4d04ff){if(_0x4d04ff){_0x365b6f[_0xc1a1('0x49')]=_[_0xc1a1('0x4b')](db[_0xc1a1('0x97')][_0xc1a1('0x45')]);_0x365b6f[_0xc1a1('0x4a')]=_[_0xc1a1('0x4b')](_0x105cef[_0xc1a1('0x4a')]);_0x365b6f[_0xc1a1('0x4c')]=_['intersection'](_0x365b6f[_0xc1a1('0x49')],_0x365b6f[_0xc1a1('0x4a')]);_0x337294[_0xc1a1('0x4f')]=_[_0xc1a1('0x4d')](_0x365b6f[_0xc1a1('0x49')],qs[_0xc1a1('0x4e')](_0x105cef[_0xc1a1('0x4a')]['fields']));_0x337294[_0xc1a1('0x4f')]=_0x337294[_0xc1a1('0x4f')]['length']?_0x337294['attributes']:_0x365b6f[_0xc1a1('0x49')];if(!_0x105cef[_0xc1a1('0x4a')]['hasOwnProperty']('nolimit')){_0x337294[_0xc1a1('0x20')]=qs[_0xc1a1('0x20')](_0x105cef[_0xc1a1('0x4a')][_0xc1a1('0x20')]);_0x337294[_0xc1a1('0x1e')]=qs[_0xc1a1('0x1e')](_0x105cef['query']['offset']);}_0x337294[_0xc1a1('0x6b')]=qs[_0xc1a1('0x51')](_0x105cef[_0xc1a1('0x4a')][_0xc1a1('0x51')]);_0x337294[_0xc1a1('0x52')]=qs['filters'](_[_0xc1a1('0x53')](_0x105cef[_0xc1a1('0x4a')],_0x365b6f['filters']));_0x337294[_0xc1a1('0x52')][_0xc1a1('0x66')]=_0x4d04ff['id'];if(_0x105cef[_0xc1a1('0x4a')]['filter']){_0x337294[_0xc1a1('0x52')]=_[_0xc1a1('0x54')](_0x337294[_0xc1a1('0x52')],{'$or':_['map'](_0x337294[_0xc1a1('0x4f')],function(_0x2f0083){var _0x477522={};_0x477522[_0x2f0083]={'$like':'%'+_0x105cef[_0xc1a1('0x4a')][_0xc1a1('0x56')]+'%'};return _0x477522;})});}if(_0x105cef[_0xc1a1('0x4a')][_0xc1a1('0x98')]){var _0x4d0335=_0x105cef[_0xc1a1('0x4a')][_0xc1a1('0x98')][_0xc1a1('0x99')](',');var _0xfd6fa4={};_0xfd6fa4[_0x4d0335[0x0]]={'$gte':moment(_0x4d0335[0x1])[_0xc1a1('0x9a')](_0xc1a1('0x9b'))};_0x337294[_0xc1a1('0x52')]=_['merge'](_0x337294[_0xc1a1('0x52')],_0xfd6fa4);}_0x337294=_['merge']({},_0x337294,_0x105cef[_0xc1a1('0x57')]);return db[_0xc1a1('0x97')][_0xc1a1('0x21')]({'where':_0x337294[_0xc1a1('0x52')]})[_0xc1a1('0x12')](function(_0x187072){_0x1aa0fb[_0xc1a1('0x21')]=_0x187072;if(_0x105cef[_0xc1a1('0x4a')][_0xc1a1('0x58')]){_0x337294[_0xc1a1('0x59')]=[{'all':!![]}];}return db[_0xc1a1('0x97')][_0xc1a1('0x5a')](_0x337294);})[_0xc1a1('0x12')](function(_0x2722c1){if(_0x105cef[_0xc1a1('0x4a')][_0xc1a1('0x9c')]==='true'){for(var _0x25898b=0x0;_0x25898b<_0x2722c1[_0xc1a1('0x5f')];_0x25898b++){_0x2722c1[_0x25898b][_0xc1a1('0x60')]=juice(_0x2722c1[_0x25898b][_0xc1a1('0x60')]);}}_0x1aa0fb[_0xc1a1('0x5b')]=_0x2722c1;return _0x1aa0fb;});}})[_0xc1a1('0x12')](respondWithFilteredResult(_0x1d85c2,_0x337294))['catch'](handleError(_0x1d85c2,null));};exports[_0xc1a1('0x27')]=function(_0x2e0281,_0x24dec4){var _0x109eb8,_0x25ede2={},_0x55b976;if(_0x2e0281['body']['to']){_0x55b976=_0x2e0281[_0xc1a1('0x60')]['to'][_0xc1a1('0x99')](',')[0x0];}return db['MailAccount'][_0xc1a1('0x63')]({'where':{'id':_0x2e0281[_0xc1a1('0x5d')]['id']},'include':[{'model':db[_0xc1a1('0x9d')],'as':_0xc1a1('0x9e'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x55b976},'limit':0x1,'order':[[_0xc1a1('0x9f'),_0xc1a1('0xa0')]]}]},{'model':db[_0xc1a1('0x5e')],'as':_0xc1a1('0x3e'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xc1a1('0xa1'),'raw':!![]}]}]})[_0xc1a1('0x12')](handleEntityNotFound(_0x24dec4,null))[_0xc1a1('0x12')](function(_0x90bca8){if(!_0x90bca8)return;_0x109eb8=_0x90bca8;if(!_0x90bca8[_0xc1a1('0x3e')])throw new Error(_0xc1a1('0xa2'));if(_[_0xc1a1('0x73')](_0x2e0281['body'][_0xc1a1('0xa3')])){_0x2e0281['body'][_0xc1a1('0xa3')]=util['format'](_0xc1a1('0xa4'),_0x90bca8[_0xc1a1('0x26')],_0x90bca8[_0xc1a1('0x71')]||_0x90bca8['Smtp'][_0xc1a1('0x32')]);}if(_0x2e0281[_0xc1a1('0x60')]['attachments']&&_0x2e0281[_0xc1a1('0x60')][_0xc1a1('0xa5')]['length']){for(var _0x31d753=0x0;_0x31d753<_0x2e0281[_0xc1a1('0x60')][_0xc1a1('0xa5')][_0xc1a1('0x5f')];_0x31d753+=0x1){_0x2e0281[_0xc1a1('0x60')][_0xc1a1('0xa5')][_0x31d753]={'filename':_0x2e0281[_0xc1a1('0x60')]['attachments'][_0x31d753][_0xc1a1('0x26')],'path':path[_0xc1a1('0xa6')](config[_0xc1a1('0xa7')],_0xc1a1('0xa8'),_0x2e0281[_0xc1a1('0x60')]['attachments'][_0x31d753][_0xc1a1('0xa9')])};}}var _0x4ca8ad=_0x90bca8[_0xc1a1('0xaa')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x4ca8ad,'message':_0x2e0281['body']});})[_0xc1a1('0x12')](function(_0x307ee6){if(!_0x307ee6)return;_0x25ede2=_0x307ee6;if(!_0x109eb8['List'])throw new Error('List\x20not\x20found');if(_0x109eb8[_0xc1a1('0x9e')][_0xc1a1('0xab')]['length'])return _0x109eb8[_0xc1a1('0x9e')]['Contacts'][0x0];return db['CmContact'][_0xc1a1('0x68')](_[_0xc1a1('0xb')](_0x2e0281[_0xc1a1('0x60')],{'firstName':_0x2e0281[_0xc1a1('0x60')]['to'],'email':_0x2e0281[_0xc1a1('0x60')]['to'],'phone':_0x2e0281[_0xc1a1('0x60')]['to'],'ListId':_0x109eb8[_0xc1a1('0x72')]}));})[_0xc1a1('0x12')](function(_0x4a1a1c){if(!_0x4a1a1c)return;var _0x5671ce={'UserId':_0x2e0281[_0xc1a1('0x32')]['id'],'ContactId':_0x4a1a1c['id'],'MailAccountId':_0x109eb8['id'],'inReplyTo':_0x25ede2['messageId'],'to':_0x2e0281['body'][_0xc1a1('0xa3')],'cc':_0x2e0281[_0xc1a1('0x60')]['cc'],'subject':_0x2e0281[_0xc1a1('0x60')][_0xc1a1('0xac')],'attach':_0x2e0281[_0xc1a1('0x60')]['attach'],'firstMsgDirection':_0xc1a1('0xad'),'lastMsgAt':moment()[_0xc1a1('0x9a')](_0xc1a1('0x9b')),'lastMsgDirection':_0xc1a1('0xad'),'Messages':[_['merge'](_0x2e0281[_0xc1a1('0x60')],{'messageId':_0x25ede2[_0xc1a1('0xae')],'sentAt':moment()['format'](_0xc1a1('0x9b')),'read':!![],'MailAccountId':_0x109eb8['id'],'UserId':_0x2e0281[_0xc1a1('0x32')]['id'],'ContactId':_0x4a1a1c['id']})]};if(_0x2e0281[_0xc1a1('0x60')]['Interaction']){_0x5671ce=_[_0xc1a1('0x54')](_0x5671ce,_0x2e0281[_0xc1a1('0x60')][_0xc1a1('0xaf')]);}return db[_0xc1a1('0x82')][_0xc1a1('0x68')](_0x5671ce,{'include':[{'model':db[_0xc1a1('0x97')],'as':_0xc1a1('0xb0')}]});})[_0xc1a1('0x12')](respondWithResult(_0x24dec4,null))[_0xc1a1('0x19')](handleError(_0x24dec4,null));};exports[_0xc1a1('0xb1')]=function(_0x2467ff,_0x1f48b0){return db['MailAccount'][_0xc1a1('0x63')]({'where':{'id':_0x2467ff[_0xc1a1('0x5d')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xc1a1('0x3e'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xc1a1('0xa1'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x1f48b0,null))[_0xc1a1('0x12')](function(_0x2f4020){if(!_0x2f4020[_0xc1a1('0x3e')])return;var _0x3d4293=_0x2f4020['getSmtpOptions']();return respondWithRpcPromise(_0xc1a1('0xb2'),'verifySmtp',{'account':_0x3d4293});})[_0xc1a1('0x12')](respondWithResult(_0x1f48b0,null))[_0xc1a1('0x19')](handleError(_0x1f48b0,null));};exports[_0xc1a1('0x23')]=function(_0x138c0d,_0x36b461){return db['MailAccount'][_0xc1a1('0x63')]({'where':{'id':_0x138c0d['params']['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x36b461,null))[_0xc1a1('0x12')](function(_0x4396e1){if(_0x4396e1&&_0x4396e1[_0xc1a1('0x3b')]){throw new db[(_0xc1a1('0xb3'))]['ValidationError'](_0xc1a1('0xb4'));}return _0x4396e1;})[_0xc1a1('0x12')](removeEntity(_0x36b461,null))['catch'](handleError(_0x36b461,null));};exports[_0xc1a1('0xb5')]=function(_0x385dba,_0x299585){return db[_0xc1a1('0x44')][_0xc1a1('0x63')]({'where':{'id':_0x385dba[_0xc1a1('0x5d')]['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x299585,null))[_0xc1a1('0x12')](function(_0x16c020){if(_0x16c020){return _0x16c020[_0xc1a1('0xb5')](_0x385dba[_0xc1a1('0x60')]['ids'],_[_0xc1a1('0x83')](_0x385dba[_0xc1a1('0x60')],[_0xc1a1('0x6d'),'id'])||{})[_0xc1a1('0xb6')](function(_0x58ec38){for(var _0x379ca0=0x0;_0x379ca0<_0x385dba[_0xc1a1('0x60')]['ids'][_0xc1a1('0x5f')];_0x379ca0+=0x1){socket[_0xc1a1('0xb7')]('userMailAccount:save',{'UserId':Number(_0x385dba[_0xc1a1('0x60')]['ids'][_0x379ca0]),'MailAccountId':Number(_0x385dba[_0xc1a1('0x5d')]['id'])});}return _0x58ec38;});}})['then'](respondWithResult(_0x299585,null))[_0xc1a1('0x19')](handleError(_0x299585,null));};exports[_0xc1a1('0xb8')]=function(_0x127310,_0x4b7bcf){return db['MailAccount'][_0xc1a1('0x63')]({'where':{'id':_0x127310[_0xc1a1('0x5d')]['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x4b7bcf,null))[_0xc1a1('0x12')](function(_0x295bfb){if(_0x295bfb){return _0x295bfb['removeAgents'](_0x127310['query']['ids'])['then'](function(){if(_[_0xc1a1('0xb9')](_0x127310[_0xc1a1('0x4a')][_0xc1a1('0x6d')])){for(var _0x13df66=0x0;_0x13df66<_0x127310['query'][_0xc1a1('0x6d')][_0xc1a1('0x5f')];_0x13df66+=0x1){socket['emit'](_0xc1a1('0xba'),{'UserId':Number(_0x127310['query'][_0xc1a1('0x6d')][_0x13df66]),'MailAccountId':Number(_0x127310[_0xc1a1('0x5d')]['id'])});}}else{socket[_0xc1a1('0xb7')](_0xc1a1('0xba'),{'UserId':Number(_0x127310['query'][_0xc1a1('0x6d')]),'MailAccountId':Number(_0x127310[_0xc1a1('0x5d')]['id'])});}});}})[_0xc1a1('0x12')](respondWithStatusCode(_0x4b7bcf,null))[_0xc1a1('0x19')](handleError(_0x4b7bcf,null));};exports[_0xc1a1('0xbb')]=function(_0x371f6e,_0x5121c){var _0x39dbd5={};var _0x49dc2f={};var _0x23ba73;var _0x404eab;return db['MailAccount'][_0xc1a1('0x6a')]({'where':{'id':_0x371f6e[_0xc1a1('0x5d')]['id']}})[_0xc1a1('0x12')](handleEntityNotFound(_0x5121c,null))[_0xc1a1('0x12')](function(_0x174b30){if(_0x174b30){_0x23ba73=_0x174b30;_0x49dc2f[_0xc1a1('0x49')]=_['keys'](db[_0xc1a1('0x86')][_0xc1a1('0x45')]);_0x49dc2f[_0xc1a1('0x4a')]=_[_0xc1a1('0x4b')](_0x371f6e['query']);_0x49dc2f[_0xc1a1('0x4c')]=_[_0xc1a1('0x4d')](_0x49dc2f[_0xc1a1('0x49')],_0x49dc2f['query']);_0x39dbd5[_0xc1a1('0x4f')]=_[_0xc1a1('0x4d')](_0x49dc2f[_0xc1a1('0x49')],qs[_0xc1a1('0x4e')](_0x371f6e[_0xc1a1('0x4a')][_0xc1a1('0x4e')]));_0x39dbd5['attributes']=_0x39dbd5['attributes'][_0xc1a1('0x5f')]?_0x39dbd5[_0xc1a1('0x4f')]:_0x49dc2f[_0xc1a1('0x49')];_0x39dbd5['order']=qs['sort'](_0x371f6e[_0xc1a1('0x4a')][_0xc1a1('0x51')]);_0x39dbd5['where']=qs[_0xc1a1('0x4c')](_[_0xc1a1('0x53')](_0x371f6e['query'],_0x49dc2f[_0xc1a1('0x4c')]));if(_0x371f6e[_0xc1a1('0x4a')][_0xc1a1('0x56')]){_0x39dbd5[_0xc1a1('0x52')]=_['merge'](_0x39dbd5[_0xc1a1('0x52')],{'$or':_[_0xc1a1('0x43')](_0x39dbd5[_0xc1a1('0x4f')],function(_0x339ddb){var _0x19fdb8={};_0x19fdb8[_0x339ddb]={'$like':'%'+_0x371f6e['query'][_0xc1a1('0x56')]+'%'};return _0x19fdb8;})});}_0x39dbd5=_[_0xc1a1('0x54')]({},_0x39dbd5,_0x371f6e['options']);return _0x23ba73[_0xc1a1('0xbb')](_0x39dbd5);}})[_0xc1a1('0x12')](function(_0xd83c2a){if(_0xd83c2a){_0x404eab=_0xd83c2a['length'];if(!_0x371f6e['query'][_0xc1a1('0x50')]('nolimit')){_0x39dbd5[_0xc1a1('0x20')]=qs[_0xc1a1('0x20')](_0x371f6e[_0xc1a1('0x4a')][_0xc1a1('0x20')]);_0x39dbd5[_0xc1a1('0x1e')]=qs[_0xc1a1('0x1e')](_0x371f6e[_0xc1a1('0x4a')][_0xc1a1('0x1e')]);}return _0x23ba73[_0xc1a1('0xbb')](_0x39dbd5);}})[_0xc1a1('0x12')](function(_0x10c625){if(_0x10c625){return _0x10c625?{'count':_0x404eab,'rows':_0x10c625}:null;}})['then'](respondWithResult(_0x5121c,null))['catch'](handleError(_0x5121c,null));}; \ No newline at end of file +var _0x3b88=['body','custom','provider','describe','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','create','getAnswers','MailAccountId','removeAnswers','ids','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MailAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','getSmtp','addSmtp','removeSmtp','MailInteraction','getInteractions','User','Owner','internal','Tag','Tags','color','tag','findAll','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','send','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','CmList','List','CmContact','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','getSmtpOptions','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','juice','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailAccount,\x20%s,\x20%s','result','catch','status','end','json','limit','undefined','count','offset','set','Content-Range','update','destroy','get','sendStatus','stack','name','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','gmail','smtp.gmail.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','rows','show','params','MailServerIn','length','merge','find'];(function(_0xbcaee2,_0x141904){var _0x3814fd=function(_0x1b0d7f){while(--_0x1b0d7f){_0xbcaee2['push'](_0xbcaee2['shift']());}};_0x3814fd(++_0x141904);}(_0x3b88,0x121));var _0x83b8=function(_0x276040,_0xd0136c){_0x276040=_0x276040-0x0;var _0x33cea5=_0x3b88[_0x276040];return _0x33cea5;};'use strict';var moment=require(_0x83b8('0x0'));var BPromise=require(_0x83b8('0x1'));var util=require(_0x83b8('0x2'));var path=require(_0x83b8('0x3'));var _=require('lodash');var juice=require(_0x83b8('0x4'));var Redis=require('ioredis');var qs=require(_0x83b8('0x5'));var logger=require('../../config/logger')(_0x83b8('0x6'));var config=require('../../config/environment');var db=require(_0x83b8('0x7'))['db'];config[_0x83b8('0x8')]=_[_0x83b8('0x9')](config[_0x83b8('0x8')],{'host':_0x83b8('0xa'),'port':0x18eb});var socket=require(_0x83b8('0xb'))(new Redis(config[_0x83b8('0x8')]));require('./mailAccount.socket')[_0x83b8('0xc')](socket);var jayson=require(_0x83b8('0xd'));var client=jayson[_0x83b8('0xe')][_0x83b8('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x42be13,_0x3b59fb,_0x3ecd3b,_0x1972fd){return new BPromise(function(_0x23a8fd,_0x213e12){var _0x450636=_0x1972fd||client;return _0x450636['request'](_0x42be13,_0x3ecd3b)[_0x83b8('0x10')](function(_0x38db90){logger[_0x83b8('0x11')]('MailAccount,\x20%s,\x20%s',_0x3b59fb,_0x83b8('0x12'));logger['debug'](_0x83b8('0x13'),_0x3b59fb,_0x83b8('0x12'),JSON[_0x83b8('0x14')](_0x38db90));if(_0x38db90[_0x83b8('0x15')]){if(_0x38db90[_0x83b8('0x15')][_0x83b8('0x16')]===0x1f4){logger[_0x83b8('0x15')]('MailAccount,\x20%s,\x20%s',_0x3b59fb,_0x38db90[_0x83b8('0x15')]['message']);return _0x213e12(_0x38db90[_0x83b8('0x15')][_0x83b8('0x17')]);}logger[_0x83b8('0x15')](_0x83b8('0x18'),_0x3b59fb,_0x38db90[_0x83b8('0x15')][_0x83b8('0x17')]);return _0x23a8fd(_0x38db90['error'][_0x83b8('0x17')]);}else{logger[_0x83b8('0x11')]('MailAccount,\x20%s,\x20%s',_0x3b59fb,_0x83b8('0x12'));_0x23a8fd(_0x38db90[_0x83b8('0x19')]['message']);}})[_0x83b8('0x1a')](function(_0x5d1fed){logger[_0x83b8('0x15')](_0x83b8('0x18'),_0x3b59fb,_0x5d1fed);_0x213e12(_0x5d1fed);});});}function respondWithStatusCode(_0x11d59c,_0xebd89f){_0xebd89f=_0xebd89f||0xcc;return function(_0x42628a){if(_0x42628a){return _0x11d59c['sendStatus'](_0xebd89f);}return _0x11d59c[_0x83b8('0x1b')](_0xebd89f)[_0x83b8('0x1c')]();};}function respondWithResult(_0x5d2848,_0xac0248){_0xac0248=_0xac0248||0xc8;return function(_0x7494ef){if(_0x7494ef){return _0x5d2848['status'](_0xac0248)[_0x83b8('0x1d')](_0x7494ef);}};}function respondWithFilteredResult(_0x38fd26,_0x1986b9){return function(_0x577730){if(_0x577730){var _0x30d7ab=typeof _0x1986b9['offset']==='undefined'&&typeof _0x1986b9[_0x83b8('0x1e')]===_0x83b8('0x1f');var _0x50c782=_0x577730[_0x83b8('0x20')];var _0x20c54b=_0x30d7ab?0x0:_0x1986b9[_0x83b8('0x21')];var _0x45f1d6=_0x30d7ab?_0x577730[_0x83b8('0x20')]:_0x1986b9[_0x83b8('0x21')]+_0x1986b9[_0x83b8('0x1e')];var _0x3e9abd;if(_0x45f1d6>=_0x50c782){_0x45f1d6=_0x50c782;_0x3e9abd=0xc8;}else{_0x3e9abd=0xce;}_0x38fd26[_0x83b8('0x1b')](_0x3e9abd);return _0x38fd26[_0x83b8('0x22')](_0x83b8('0x23'),_0x20c54b+'-'+_0x45f1d6+'/'+_0x50c782)['json'](_0x577730);}return null;};}function saveUpdates(_0x49f9b2){return function(_0x4180c5){if(_0x4180c5){return _0x4180c5[_0x83b8('0x24')](_0x49f9b2)[_0x83b8('0x10')](function(_0x4e6880){return _0x4e6880;});}return null;};}function removeEntity(_0x336815){return function(_0x4e207f){if(_0x4e207f){return _0x4e207f[_0x83b8('0x25')]()[_0x83b8('0x10')](function(){var _0xe660d4=_0x4e207f[_0x83b8('0x26')]({'plain':!![]});var _0x241171='MailAccounts';return db['UserProfileResource'][_0x83b8('0x25')]({'where':{'type':_0x241171,'resourceId':_0xe660d4['id']}})['then'](function(){return _0x4e207f;});})[_0x83b8('0x10')](function(){_0x336815['status'](0xcc)[_0x83b8('0x1c')]();});}};}function handleEntityNotFound(_0x2df42f){return function(_0x253a5b){if(!_0x253a5b){_0x2df42f[_0x83b8('0x27')](0x194);}return _0x253a5b;};}function handleError(_0x47fb28,_0x55e62a){_0x55e62a=_0x55e62a||0x1f4;return function(_0x47ef15){logger[_0x83b8('0x15')](_0x47ef15[_0x83b8('0x28')]);if(_0x47ef15[_0x83b8('0x29')]){delete _0x47ef15[_0x83b8('0x29')];}_0x47fb28[_0x83b8('0x1b')](_0x55e62a)['send'](_0x47ef15);};}function getImapHost(_0x324c3e){switch(_0x324c3e){case'gmail':return _0x83b8('0x2a');case _0x83b8('0x2b'):return'imap.mail.yahoo.com';case _0x83b8('0x2c'):return _0x83b8('0x2d');case _0x83b8('0x2e'):return _0x83b8('0x2f');}throw new Error('Unknown\x20email\x20service\x20provider',_0x324c3e);}function getSmtpHost(_0x15ceba){switch(_0x15ceba){case _0x83b8('0x30'):return _0x83b8('0x31');case _0x83b8('0x2b'):return'smtp.mail.yahoo.com';case _0x83b8('0x2c'):return _0x83b8('0x32');case _0x83b8('0x2e'):return _0x83b8('0x33');}throw new Error(_0x83b8('0x34'),_0x15ceba);}function getAuthenticationOptions(_0x264c3c,_0x3c82be){var _0x1a03c4={};var _0x26ca5d={};if(_0x264c3c){_0x1a03c4[_0x83b8('0x35')]=_0x26ca5d[_0x83b8('0x35')]=_0x3c82be[_0x83b8('0x36')];_0x1a03c4['password']=_0x26ca5d[_0x83b8('0x37')]=_0x3c82be[_0x83b8('0x38')];if(_0x3c82be['modernAuthentication']){_0x1a03c4[_0x83b8('0x39')]=_0x26ca5d['modernAuthentication']=!![];_0x1a03c4[_0x83b8('0x3a')]=_0x26ca5d[_0x83b8('0x3a')]=_0x3c82be[_0x83b8('0x3a')];_0x1a03c4[_0x83b8('0x38')]=_0x26ca5d['pass']=null;}else{_0x1a03c4[_0x83b8('0x3a')]=_0x26ca5d[_0x83b8('0x3a')]=null;}_0x1a03c4[_0x83b8('0x3b')]=getImapHost(_0x264c3c);_0x1a03c4[_0x83b8('0x3c')]=0x3e1;_0x26ca5d[_0x83b8('0x3b')]=getSmtpHost(_0x264c3c);_0x26ca5d[_0x83b8('0x3c')]=0x24b;_0x26ca5d[_0x83b8('0x3d')]=![];_0x1a03c4[_0x83b8('0x3e')]=_0x26ca5d[_0x83b8('0x3e')]=null;}else{if(_0x3c82be[_0x83b8('0x3f')]){_0x1a03c4[_0x83b8('0x35')]=_0x26ca5d[_0x83b8('0x35')]=_0x3c82be[_0x83b8('0x36')];_0x1a03c4[_0x83b8('0x38')]=_0x26ca5d[_0x83b8('0x37')]=_0x3c82be[_0x83b8('0x38')];}else{_0x1a03c4[_0x83b8('0x3f')]=_0x26ca5d[_0x83b8('0x3f')]=![];_0x1a03c4[_0x83b8('0x35')]=_0x26ca5d[_0x83b8('0x35')]=null;_0x1a03c4[_0x83b8('0x38')]=_0x26ca5d[_0x83b8('0x37')]=null;}_0x1a03c4[_0x83b8('0x3b')]=_0x3c82be[_0x83b8('0x40')][_0x83b8('0x3b')];_0x1a03c4[_0x83b8('0x3c')]=_0x3c82be[_0x83b8('0x40')]['port'];_0x26ca5d[_0x83b8('0x3b')]=_0x3c82be[_0x83b8('0x41')][_0x83b8('0x3b')];_0x26ca5d['port']=_0x3c82be[_0x83b8('0x41')]['port'];}return{'Imap':_0x1a03c4,'Smtp':_0x26ca5d};}exports['index']=function(_0x179915,_0x235a40){var _0x2552d2={'include':[{'model':db['MailServerIn'],'as':_0x83b8('0x40')},{'model':db[_0x83b8('0x42')],'as':_0x83b8('0x41')},{'model':db[_0x83b8('0x43')],'as':_0x83b8('0x44')}]},_0x4ec36e={},_0x5029c2={'count':0x0,'rows':[]};var _0xd40e1a=_[_0x83b8('0x45')](db[_0x83b8('0x46')][_0x83b8('0x47')],function(_0x3ee966){return{'name':_0x3ee966[_0x83b8('0x48')],'type':_0x3ee966[_0x83b8('0x49')][_0x83b8('0x4a')]};});_0x4ec36e['model']=_[_0x83b8('0x45')](_0xd40e1a,_0x83b8('0x29'));_0x4ec36e[_0x83b8('0x4b')]=_[_0x83b8('0x4c')](_0x179915[_0x83b8('0x4b')]);_0x4ec36e[_0x83b8('0x4d')]=_[_0x83b8('0x4e')](_0x4ec36e[_0x83b8('0x4f')],_0x4ec36e[_0x83b8('0x4b')]);_0x2552d2[_0x83b8('0x50')]=_[_0x83b8('0x4e')](_0x4ec36e[_0x83b8('0x4f')],qs[_0x83b8('0x51')](_0x179915[_0x83b8('0x4b')][_0x83b8('0x51')]));_0x2552d2[_0x83b8('0x50')]=_0x2552d2[_0x83b8('0x50')]['length']?_0x2552d2[_0x83b8('0x50')]:_0x4ec36e[_0x83b8('0x4f')];if(!_0x179915[_0x83b8('0x4b')][_0x83b8('0x52')](_0x83b8('0x53'))){_0x2552d2[_0x83b8('0x1e')]=qs[_0x83b8('0x1e')](_0x179915['query'][_0x83b8('0x1e')]);_0x2552d2[_0x83b8('0x21')]=qs[_0x83b8('0x21')](_0x179915['query'][_0x83b8('0x21')]);}_0x2552d2[_0x83b8('0x54')]=qs[_0x83b8('0x55')](_0x179915[_0x83b8('0x4b')][_0x83b8('0x55')]);_0x2552d2[_0x83b8('0x56')]=qs[_0x83b8('0x4d')](_[_0x83b8('0x57')](_0x179915[_0x83b8('0x4b')],_0x4ec36e[_0x83b8('0x4d')]),_0xd40e1a);if(_0x179915[_0x83b8('0x4b')][_0x83b8('0x58')]){_0x2552d2[_0x83b8('0x56')]=_['merge'](_0x2552d2[_0x83b8('0x56')],{'$or':_[_0x83b8('0x45')](_0xd40e1a,function(_0x26171e){if(_0x26171e['type']!=='VIRTUAL'){var _0x4a03cb={};_0x4a03cb[_0x26171e[_0x83b8('0x29')]]={'$like':'%'+_0x179915[_0x83b8('0x4b')][_0x83b8('0x58')]+'%'};return _0x4a03cb;}})});}_0x2552d2=_['merge']({},_0x2552d2,_0x179915[_0x83b8('0x59')]);var _0xd458b6={'where':_0x2552d2['where']};return db[_0x83b8('0x46')][_0x83b8('0x20')](_0xd458b6)[_0x83b8('0x10')](function(_0x53afe1){_0x5029c2[_0x83b8('0x20')]=_0x53afe1;if(_0x179915[_0x83b8('0x4b')][_0x83b8('0x5a')]){_0x2552d2[_0x83b8('0x5b')]=[{'all':!![]}];}return db[_0x83b8('0x46')]['findAll'](_0x2552d2);})[_0x83b8('0x10')](function(_0xd097b8){_0x5029c2[_0x83b8('0x5c')]=_0xd097b8;return _0x5029c2;})['then'](respondWithFilteredResult(_0x235a40,_0x2552d2))[_0x83b8('0x1a')](handleError(_0x235a40,null));};exports[_0x83b8('0x5d')]=function(_0x17b3af,_0x411698){var _0x5b3da5={'raw':![],'where':{'id':_0x17b3af[_0x83b8('0x5e')]['id']},'include':[{'model':db[_0x83b8('0x5f')],'as':_0x83b8('0x40')},{'model':db[_0x83b8('0x42')],'as':'Smtp'},{'model':db[_0x83b8('0x43')],'as':_0x83b8('0x44')}]},_0x1b45d0={};_0x1b45d0[_0x83b8('0x4f')]=_['keys'](db[_0x83b8('0x46')][_0x83b8('0x47')]);_0x1b45d0[_0x83b8('0x4b')]=_[_0x83b8('0x4c')](_0x17b3af['query']);_0x1b45d0[_0x83b8('0x4d')]=_[_0x83b8('0x4e')](_0x1b45d0[_0x83b8('0x4f')],_0x1b45d0['query']);_0x5b3da5['attributes']=_[_0x83b8('0x4e')](_0x1b45d0[_0x83b8('0x4f')],qs['fields'](_0x17b3af[_0x83b8('0x4b')][_0x83b8('0x51')]));_0x5b3da5[_0x83b8('0x50')]=_0x5b3da5[_0x83b8('0x50')][_0x83b8('0x60')]?_0x5b3da5[_0x83b8('0x50')]:_0x1b45d0[_0x83b8('0x4f')];if(_0x17b3af[_0x83b8('0x4b')][_0x83b8('0x5a')]){_0x5b3da5[_0x83b8('0x5b')]=[{'all':!![]}];}_0x5b3da5=_[_0x83b8('0x61')]({},_0x5b3da5,_0x17b3af[_0x83b8('0x59')]);return db['MailAccount'][_0x83b8('0x62')](_0x5b3da5)[_0x83b8('0x10')](handleEntityNotFound(_0x411698,null))[_0x83b8('0x10')](respondWithResult(_0x411698,null))['catch'](handleError(_0x411698,null));};exports['update']=function(_0x4f93fd,_0x348284){if(_0x4f93fd[_0x83b8('0x63')]['id']){delete _0x4f93fd[_0x83b8('0x63')]['id'];}var _0x3c581a=_0x4f93fd[_0x83b8('0x63')]['provider']===_0x83b8('0x64')?null:_0x4f93fd[_0x83b8('0x63')][_0x83b8('0x65')];var _0x51bdd6=_0x4f93fd[_0x83b8('0x63')][_0x83b8('0x40')]||{};var _0x344f71=_0x4f93fd[_0x83b8('0x63')][_0x83b8('0x41')]||{};if(_0x3c581a){_0x51bdd6[_0x83b8('0x3b')]=getImapHost(_0x3c581a);_0x51bdd6[_0x83b8('0x3c')]=0x3e1;_0x344f71[_0x83b8('0x3b')]=getSmtpHost(_0x3c581a);_0x344f71[_0x83b8('0x3c')]=0x24b;_0x344f71['secure']=![];}if(_0x344f71[_0x83b8('0x39')]){_0x344f71[_0x83b8('0x3d')]=![];}else{_0x344f71[_0x83b8('0x3a')]=null;}if(!_0x51bdd6[_0x83b8('0x39')])_0x51bdd6['CloudProviderId']=null;_0x4f93fd['body'][_0x83b8('0x40')]=_0x51bdd6;_0x4f93fd[_0x83b8('0x63')][_0x83b8('0x41')]=_0x344f71;return db['MailAccount'][_0x83b8('0x62')]({'where':{'id':_0x4f93fd[_0x83b8('0x5e')]['id']},'include':[{'model':db[_0x83b8('0x5f')],'as':_0x83b8('0x40')},{'model':db[_0x83b8('0x42')],'as':'Smtp'},{'model':db[_0x83b8('0x43')],'as':_0x83b8('0x44')}]})[_0x83b8('0x10')](handleEntityNotFound(_0x348284,null))[_0x83b8('0x10')](function(_0x151294){if(!_0x151294)throw new Error('Mail\x20Account\x20not\x20found');if(_0x151294['service'])delete _0x4f93fd[_0x83b8('0x63')][_0x83b8('0x40')];return _0x151294;})['then'](saveUpdates(_0x4f93fd[_0x83b8('0x63')],null))[_0x83b8('0x10')](function(_0x5c95b0){if(!_0x4f93fd[_0x83b8('0x63')][_0x83b8('0x40')])return _0x5c95b0;return db[_0x83b8('0x5f')][_0x83b8('0x24')](_0x4f93fd[_0x83b8('0x63')][_0x83b8('0x40')],{'where':{'MailAccountId':_0x5c95b0['id']}})[_0x83b8('0x10')](function(){return _0x5c95b0;});})['then'](function(_0x2e71e9){if(!_0x4f93fd['body']['Smtp'])return _0x2e71e9;return db[_0x83b8('0x42')]['update'](_0x4f93fd['body']['Smtp'],{'where':{'MailAccountId':_0x2e71e9['id']}})[_0x83b8('0x10')](function(){return _0x2e71e9;});})[_0x83b8('0x10')](respondWithResult(_0x348284,null))[_0x83b8('0x1a')](handleError(_0x348284,null));};exports[_0x83b8('0x66')]=function(_0x4c1846,_0x4f73c6){return db[_0x83b8('0x46')][_0x83b8('0x66')]()[_0x83b8('0x10')](respondWithResult(_0x4f73c6,null))[_0x83b8('0x1a')](handleError(_0x4f73c6,null));};exports['addDisposition']=function(_0x153a3a,_0x561663){if(_0x153a3a[_0x83b8('0x63')]['id']){delete _0x153a3a['body']['id'];}return db[_0x83b8('0x46')][_0x83b8('0x62')]({'where':{'id':_0x153a3a[_0x83b8('0x5e')]['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0x561663,null))[_0x83b8('0x10')](function(_0x36d092){if(_0x36d092){_0x153a3a[_0x83b8('0x63')]['MailAccountId']=_0x36d092['id'];return db[_0x83b8('0x67')]['create'](_0x153a3a['body']);}})[_0x83b8('0x10')](respondWithResult(_0x561663,null))[_0x83b8('0x1a')](handleError(_0x561663,null));};exports[_0x83b8('0x68')]=function(_0x143b5e,_0xf88acc){var _0x13531d={'raw':![],'where':{}};var _0x417877={};var _0x397d1e={'count':0x0,'rows':[]};return db[_0x83b8('0x46')][_0x83b8('0x69')]({'where':{'id':_0x143b5e['params']['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0xf88acc,null))[_0x83b8('0x10')](function(_0x1da9b8){if(_0x1da9b8){_0x417877[_0x83b8('0x4f')]=_[_0x83b8('0x4c')](db[_0x83b8('0x67')][_0x83b8('0x47')]);_0x417877['query']=_[_0x83b8('0x4c')](_0x143b5e['query']);_0x417877[_0x83b8('0x4d')]=_[_0x83b8('0x4e')](_0x417877[_0x83b8('0x4f')],_0x417877[_0x83b8('0x4b')]);_0x13531d[_0x83b8('0x50')]=_['intersection'](_0x417877[_0x83b8('0x4f')],qs['fields'](_0x143b5e[_0x83b8('0x4b')][_0x83b8('0x51')]));_0x13531d[_0x83b8('0x50')]=_0x13531d[_0x83b8('0x50')]['length']?_0x13531d[_0x83b8('0x50')]:_0x417877['model'];if(!_0x143b5e['query'][_0x83b8('0x52')]('nolimit')){_0x13531d[_0x83b8('0x1e')]=qs['limit'](_0x143b5e[_0x83b8('0x4b')][_0x83b8('0x1e')]);_0x13531d[_0x83b8('0x21')]=qs[_0x83b8('0x21')](_0x143b5e[_0x83b8('0x4b')][_0x83b8('0x21')]);}_0x13531d[_0x83b8('0x54')]=qs[_0x83b8('0x55')](_0x143b5e[_0x83b8('0x4b')][_0x83b8('0x55')]);_0x13531d[_0x83b8('0x56')]=qs[_0x83b8('0x4d')](_[_0x83b8('0x57')](_0x143b5e[_0x83b8('0x4b')],_0x417877[_0x83b8('0x4d')]));_0x13531d['where']['MailAccountId']=_0x1da9b8['id'];if(_0x143b5e[_0x83b8('0x4b')][_0x83b8('0x58')]){_0x13531d[_0x83b8('0x56')]=_[_0x83b8('0x61')](_0x13531d[_0x83b8('0x56')],{'$or':_[_0x83b8('0x45')](_0x13531d[_0x83b8('0x50')],function(_0x2e5eb9){var _0x207263={};_0x207263[_0x2e5eb9]={'$like':'%'+_0x143b5e[_0x83b8('0x4b')][_0x83b8('0x58')]+'%'};return _0x207263;})});}_0x13531d=_['merge']({},_0x13531d,_0x143b5e[_0x83b8('0x59')]);return db[_0x83b8('0x67')]['count']({'where':_0x13531d[_0x83b8('0x56')]})[_0x83b8('0x10')](function(_0x3da85f){_0x397d1e['count']=_0x3da85f;if(_0x143b5e[_0x83b8('0x4b')][_0x83b8('0x5a')]){_0x13531d[_0x83b8('0x5b')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x13531d);})[_0x83b8('0x10')](function(_0x4f27a3){_0x397d1e[_0x83b8('0x5c')]=_0x4f27a3;return _0x397d1e;});}})['then'](respondWithFilteredResult(_0xf88acc,_0x13531d))[_0x83b8('0x1a')](handleError(_0xf88acc,null));};exports[_0x83b8('0x6a')]=function(_0x33678d,_0x266183){return db[_0x83b8('0x46')][_0x83b8('0x62')]({'where':{'id':_0x33678d[_0x83b8('0x5e')]['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0x266183,null))[_0x83b8('0x10')](function(_0xa60bf4){if(_0xa60bf4){return _0xa60bf4['removeDispositions'](_0x33678d[_0x83b8('0x4b')]['ids']);}})[_0x83b8('0x10')](respondWithStatusCode(_0x266183,null))[_0x83b8('0x1a')](handleError(_0x266183,null));};exports[_0x83b8('0x6b')]=function(_0x9dbbe1,_0x57a9ed){if(_0x9dbbe1[_0x83b8('0x63')]['id']){delete _0x9dbbe1['body']['id'];}return db[_0x83b8('0x46')]['find']({'where':{'id':_0x9dbbe1[_0x83b8('0x5e')]['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0x57a9ed,null))['then'](function(_0xaca7e8){if(_0xaca7e8){_0x9dbbe1[_0x83b8('0x63')]['MailAccountId']=_0xaca7e8['id'];return db[_0x83b8('0x6c')][_0x83b8('0x6d')](_0x9dbbe1[_0x83b8('0x63')]);}})[_0x83b8('0x10')](respondWithResult(_0x57a9ed,null))[_0x83b8('0x1a')](handleError(_0x57a9ed,null));};exports[_0x83b8('0x6e')]=function(_0x505b64,_0xfcd799){var _0x27910f={'raw':![],'where':{}};var _0x1bc6c5={};var _0x2e4c77={'count':0x0,'rows':[]};return db[_0x83b8('0x46')][_0x83b8('0x69')]({'where':{'id':_0x505b64[_0x83b8('0x5e')]['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0xfcd799,null))[_0x83b8('0x10')](function(_0x283e65){if(_0x283e65){_0x1bc6c5[_0x83b8('0x4f')]=_[_0x83b8('0x4c')](db[_0x83b8('0x6c')][_0x83b8('0x47')]);_0x1bc6c5[_0x83b8('0x4b')]=_[_0x83b8('0x4c')](_0x505b64[_0x83b8('0x4b')]);_0x1bc6c5[_0x83b8('0x4d')]=_['intersection'](_0x1bc6c5[_0x83b8('0x4f')],_0x1bc6c5[_0x83b8('0x4b')]);_0x27910f[_0x83b8('0x50')]=_[_0x83b8('0x4e')](_0x1bc6c5[_0x83b8('0x4f')],qs[_0x83b8('0x51')](_0x505b64['query'][_0x83b8('0x51')]));_0x27910f[_0x83b8('0x50')]=_0x27910f[_0x83b8('0x50')]['length']?_0x27910f[_0x83b8('0x50')]:_0x1bc6c5['model'];if(!_0x505b64[_0x83b8('0x4b')][_0x83b8('0x52')](_0x83b8('0x53'))){_0x27910f[_0x83b8('0x1e')]=qs[_0x83b8('0x1e')](_0x505b64[_0x83b8('0x4b')][_0x83b8('0x1e')]);_0x27910f['offset']=qs['offset'](_0x505b64[_0x83b8('0x4b')][_0x83b8('0x21')]);}_0x27910f['order']=qs[_0x83b8('0x55')](_0x505b64[_0x83b8('0x4b')][_0x83b8('0x55')]);_0x27910f[_0x83b8('0x56')]=qs[_0x83b8('0x4d')](_[_0x83b8('0x57')](_0x505b64[_0x83b8('0x4b')],_0x1bc6c5['filters']));_0x27910f['where'][_0x83b8('0x6f')]=_0x283e65['id'];if(_0x505b64[_0x83b8('0x4b')][_0x83b8('0x58')]){_0x27910f[_0x83b8('0x56')]=_['merge'](_0x27910f['where'],{'$or':_[_0x83b8('0x45')](_0x27910f[_0x83b8('0x50')],function(_0x63ac5e){var _0x486076={};_0x486076[_0x63ac5e]={'$like':'%'+_0x505b64[_0x83b8('0x4b')][_0x83b8('0x58')]+'%'};return _0x486076;})});}_0x27910f=_[_0x83b8('0x61')]({},_0x27910f,_0x505b64[_0x83b8('0x59')]);return db[_0x83b8('0x6c')][_0x83b8('0x20')]({'where':_0x27910f['where']})[_0x83b8('0x10')](function(_0xc1c0f4){_0x2e4c77[_0x83b8('0x20')]=_0xc1c0f4;if(_0x505b64[_0x83b8('0x4b')]['includeAll']){_0x27910f[_0x83b8('0x5b')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x27910f);})[_0x83b8('0x10')](function(_0x30552a){_0x2e4c77[_0x83b8('0x5c')]=_0x30552a;return _0x2e4c77;});}})[_0x83b8('0x10')](respondWithFilteredResult(_0xfcd799,_0x27910f))['catch'](handleError(_0xfcd799,null));};exports['removeAnswers']=function(_0x513292,_0x34d0a1){return db['MailAccount']['find']({'where':{'id':_0x513292[_0x83b8('0x5e')]['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0x34d0a1,null))[_0x83b8('0x10')](function(_0x2b61c2){if(_0x2b61c2){return _0x2b61c2[_0x83b8('0x70')](_0x513292[_0x83b8('0x4b')][_0x83b8('0x71')]);}})[_0x83b8('0x10')](respondWithStatusCode(_0x34d0a1,null))['catch'](handleError(_0x34d0a1,null));};exports[_0x83b8('0x6d')]=function(_0x4db2b8,_0x13cd27){var _0x5e7563={'name':_0x4db2b8[_0x83b8('0x63')][_0x83b8('0x29')],'key':_0x4db2b8[_0x83b8('0x63')]['key'],'provider':_0x4db2b8['body'][_0x83b8('0x65')]===_0x83b8('0x64')?null:_0x4db2b8[_0x83b8('0x63')][_0x83b8('0x65')],'email':_0x4db2b8[_0x83b8('0x63')]['email'],'ListId':_0x4db2b8[_0x83b8('0x63')][_0x83b8('0x72')],'active':!_[_0x83b8('0x73')](_0x4db2b8['body']['active'])?_0x4db2b8[_0x83b8('0x63')][_0x83b8('0x74')]:!![],'description':_0x4db2b8['body'][_0x83b8('0x75')]||null};var _0x16161f=getAuthenticationOptions(_0x5e7563[_0x83b8('0x65')],_0x4db2b8[_0x83b8('0x63')]);_0x5e7563['Imap']=_0x16161f[_0x83b8('0x40')];_0x5e7563['Smtp']=_0x16161f[_0x83b8('0x41')];return db[_0x83b8('0x46')][_0x83b8('0x6d')](_0x5e7563,{'include':[{'model':db[_0x83b8('0x42')],'as':_0x83b8('0x41')},{'model':db[_0x83b8('0x5f')],'as':'Imap'}]})[_0x83b8('0x10')](function(_0x3abe77){var _0x5cf3e4=_0x4db2b8[_0x83b8('0x35')][_0x83b8('0x26')]({'plain':!![]});if(!_0x5cf3e4)throw new Error(_0x83b8('0x76'));if(_0x5cf3e4['role']==='user'){var _0x868874=_0x3abe77[_0x83b8('0x26')]({'plain':!![]});return db[_0x83b8('0x77')][_0x83b8('0x62')]({'where':{'name':_0x83b8('0x78'),'userProfileId':_0x5cf3e4[_0x83b8('0x79')]},'raw':!![]})['then'](function(_0x47b3dd){if(_0x47b3dd&&_0x47b3dd[_0x83b8('0x7a')]===0x0){return db[_0x83b8('0x7b')][_0x83b8('0x6d')]({'name':_0x868874[_0x83b8('0x29')],'resourceId':_0x868874['id'],'type':_0x47b3dd['name'],'sectionId':_0x47b3dd['id']},{})['then'](function(){return _0x3abe77;});}else{return _0x3abe77;}})[_0x83b8('0x1a')](function(_0x1d000d){logger[_0x83b8('0x15')](_0x83b8('0x7c'),_0x1d000d);throw _0x1d000d;});}return _0x3abe77;})['then'](respondWithResult(_0x13cd27,0xc9))[_0x83b8('0x1a')](handleError(_0x13cd27,null));};exports[_0x83b8('0x7d')]=function(_0x2c0619,_0x39c92b){return db[_0x83b8('0x46')]['findOne']({'where':{'id':_0x2c0619['params']['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0x39c92b,null))[_0x83b8('0x10')](function(_0x5e54a7){if(_0x5e54a7){return _0x5e54a7['getImap']();}return null;})[_0x83b8('0x10')](respondWithResult(_0x39c92b,null))[_0x83b8('0x1a')](handleError(_0x39c92b,null));};exports[_0x83b8('0x7e')]=function(_0x59cef2,_0x527c3a){if(_0x59cef2['body']['id']){delete _0x59cef2[_0x83b8('0x63')]['id'];}return db[_0x83b8('0x46')][_0x83b8('0x62')]({'where':{'id':_0x59cef2[_0x83b8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x527c3a,null))['then'](function(_0x246eca){if(_0x246eca){_0x59cef2['body'][_0x83b8('0x6f')]=_0x246eca['id'];return db['MailServerIn']['create'](_0x59cef2[_0x83b8('0x63')]);}})[_0x83b8('0x10')](respondWithResult(_0x527c3a,null))[_0x83b8('0x1a')](handleError(_0x527c3a,null));};exports['removeImap']=function(_0x381a38,_0x39edab){return db[_0x83b8('0x46')]['findOne']({'where':{'id':_0x381a38[_0x83b8('0x5e')]['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0x39edab,null))[_0x83b8('0x10')](function(_0x2ea032){if(_0x2ea032){return _0x2ea032['setImap'](null);}return null;})[_0x83b8('0x10')](respondWithStatusCode(_0x39edab,null))[_0x83b8('0x1a')](handleError(_0x39edab,null));};exports[_0x83b8('0x7f')]=function(_0x49aaf8,_0x1597fc){return db[_0x83b8('0x46')][_0x83b8('0x69')]({'where':{'id':_0x49aaf8[_0x83b8('0x5e')]['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0x1597fc,null))[_0x83b8('0x10')](function(_0x3e95d1){if(_0x3e95d1){return _0x3e95d1['getSmtp']();}return null;})[_0x83b8('0x10')](respondWithResult(_0x1597fc,null))['catch'](handleError(_0x1597fc,null));};exports[_0x83b8('0x80')]=function(_0x3cfe36,_0x965e0a){if(_0x3cfe36[_0x83b8('0x63')]['id']){delete _0x3cfe36[_0x83b8('0x63')]['id'];}return db[_0x83b8('0x46')][_0x83b8('0x62')]({'where':{'id':_0x3cfe36[_0x83b8('0x5e')]['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0x965e0a,null))[_0x83b8('0x10')](function(_0x1690d5){if(_0x1690d5){_0x3cfe36[_0x83b8('0x63')][_0x83b8('0x6f')]=_0x1690d5['id'];return db[_0x83b8('0x42')][_0x83b8('0x6d')](_0x3cfe36[_0x83b8('0x63')]);}})['then'](respondWithResult(_0x965e0a,null))[_0x83b8('0x1a')](handleError(_0x965e0a,null));};exports[_0x83b8('0x81')]=function(_0x3fe8c9,_0x4fba4c){return db[_0x83b8('0x46')][_0x83b8('0x69')]({'where':{'id':_0x3fe8c9[_0x83b8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4fba4c,null))[_0x83b8('0x10')](function(_0x4f38c1){if(_0x4f38c1){return _0x4f38c1['setSmtp'](null);}return null;})[_0x83b8('0x10')](respondWithStatusCode(_0x4fba4c,null))[_0x83b8('0x1a')](handleError(_0x4fba4c,null));};exports['addInteraction']=function(_0x2d94d7,_0x344e9a){return db[_0x83b8('0x82')][_0x83b8('0x62')]({'where':{'id':_0x2d94d7[_0x83b8('0x5e')]['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0x344e9a,null))[_0x83b8('0x10')](function(_0x5a02d5){if(_0x5a02d5){return _0x5a02d5['addInteraction'](_0x2d94d7[_0x83b8('0x63')]['ids'],_['omit'](_0x2d94d7['body'],[_0x83b8('0x71'),'id'])||{});}})[_0x83b8('0x10')](respondWithResult(_0x344e9a,null))[_0x83b8('0x1a')](handleError(_0x344e9a,null));};exports[_0x83b8('0x83')]=function(_0x4deee6,_0xc3f2e5){var _0x11f344={'raw':![],'where':{}};var _0xd7f7d1={};var _0x2dbb49={'count':0x0,'rows':[]};return db[_0x83b8('0x46')]['findOne']({'where':{'id':_0x4deee6[_0x83b8('0x5e')]['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0xc3f2e5,null))['then'](function(_0x3bbb80){if(_0x3bbb80){_0xd7f7d1['model']=_[_0x83b8('0x4c')](db['MailInteraction'][_0x83b8('0x47')]);_0xd7f7d1[_0x83b8('0x4b')]=_[_0x83b8('0x4c')](_0x4deee6[_0x83b8('0x4b')]);_0xd7f7d1[_0x83b8('0x4d')]=_[_0x83b8('0x4e')](_0xd7f7d1[_0x83b8('0x4f')],_0xd7f7d1[_0x83b8('0x4b')]);_0x11f344[_0x83b8('0x50')]=_['intersection'](_0xd7f7d1[_0x83b8('0x4f')],qs[_0x83b8('0x51')](_0x4deee6[_0x83b8('0x4b')]['fields']));_0x11f344[_0x83b8('0x50')]=_0x11f344['attributes']['length']?_0x11f344[_0x83b8('0x50')]:_0xd7f7d1['model'];if(!_0x4deee6[_0x83b8('0x4b')]['hasOwnProperty']('nolimit')){_0x11f344[_0x83b8('0x1e')]=qs[_0x83b8('0x1e')](_0x4deee6[_0x83b8('0x4b')][_0x83b8('0x1e')]);_0x11f344[_0x83b8('0x21')]=qs[_0x83b8('0x21')](_0x4deee6[_0x83b8('0x4b')][_0x83b8('0x21')]);}_0x11f344[_0x83b8('0x54')]=qs[_0x83b8('0x55')](_0x4deee6[_0x83b8('0x4b')][_0x83b8('0x55')]);_0x11f344[_0x83b8('0x56')]=qs[_0x83b8('0x4d')](_['pick'](_0x4deee6['query'],_0xd7f7d1[_0x83b8('0x4d')]));_0x11f344[_0x83b8('0x56')]['MailAccountId']=_0x3bbb80['id'];if(_0x4deee6[_0x83b8('0x4b')][_0x83b8('0x58')]){_0x11f344[_0x83b8('0x56')]=_['merge'](_0x11f344[_0x83b8('0x56')],{'$or':_[_0x83b8('0x45')](_0x11f344['attributes'],function(_0x3f2064){var _0xf1c6d6={};_0xf1c6d6[_0x3f2064]={'$like':'%'+_0x4deee6[_0x83b8('0x4b')][_0x83b8('0x58')]+'%'};return _0xf1c6d6;})});}_0x11f344=_[_0x83b8('0x61')]({},_0x11f344,_0x4deee6[_0x83b8('0x59')]);return db[_0x83b8('0x82')][_0x83b8('0x20')]({'where':_0x11f344['where']})[_0x83b8('0x10')](function(_0xd50c1f){_0x2dbb49[_0x83b8('0x20')]=_0xd50c1f;if(_0x4deee6['query'][_0x83b8('0x5a')]){_0x11f344['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x83b8('0x84')],'as':_0x83b8('0x85'),'attributes':[_0x83b8('0x29'),'fullname',_0x83b8('0x86')],'required':![]},{'model':db[_0x83b8('0x87')],'as':_0x83b8('0x88'),'attributes':['id',_0x83b8('0x29'),_0x83b8('0x89')],'where':_0x4deee6['query'][_0x83b8('0x8a')]?{'id':_0x4deee6[_0x83b8('0x4b')][_0x83b8('0x8a')]}:undefined,'required':_0x4deee6[_0x83b8('0x4b')][_0x83b8('0x8a')]?!![]:![]}];}return db['MailInteraction'][_0x83b8('0x8b')](_0x11f344);})['then'](function(_0x39cbd7){_0x2dbb49[_0x83b8('0x5c')]=_0x39cbd7;return _0x2dbb49;});}})[_0x83b8('0x10')](respondWithFilteredResult(_0xc3f2e5,_0x11f344))[_0x83b8('0x1a')](handleError(_0xc3f2e5,null));};exports[_0x83b8('0x8c')]=function addApplications(_0x2e5c04,_0x4b8289){var _0x175870=_0x2e5c04[_0x83b8('0x5e')]['id'];var _0x468190=_0x2e5c04[_0x83b8('0x63')];var _0x38dcfa=0xc8;var _0x5a0743=null;return db[_0x83b8('0x8d')][_0x83b8('0x8e')]({'isolationLevel':db['sequelize'][_0x83b8('0x8f')][_0x83b8('0x90')][_0x83b8('0x91')]},function(_0x1fd8fc){return db['MailAccount']['findOne']({'where':{'id':_0x175870},'transaction':_0x1fd8fc})[_0x83b8('0x10')](function(_0x24d65d){if(_0x24d65d){return db[_0x83b8('0x92')][_0x83b8('0x25')]({'where':{'MailAccountId':_0x175870},'transaction':_0x1fd8fc})[_0x83b8('0x10')](function(){var _0x5381b4=_[_0x83b8('0x45')](_0x468190,function(_0x40a7cd){_0x40a7cd[_0x83b8('0x6f')]=_0x175870;return _0x40a7cd;});return db[_0x83b8('0x92')]['bulkCreate'](_0x5381b4,{'transaction':_0x1fd8fc});});}else{_0x38dcfa=0x194;_0x5a0743=[];}});})[_0x83b8('0x10')](function(){if(_0x38dcfa!==0x194){return db[_0x83b8('0x92')][_0x83b8('0x93')]({'where':{'MailAccountId':_0x175870},'order':_0x83b8('0x94')})[_0x83b8('0x10')](function(_0x598878){_0x5a0743=_0x598878;});}})[_0x83b8('0x1a')](function(_0x5cbaf3){_0x38dcfa=0x1f4;logger[_0x83b8('0x15')](_0x5cbaf3[_0x83b8('0x28')]);if(_0x5cbaf3[_0x83b8('0x29')]){delete _0x5cbaf3[_0x83b8('0x29')];}_0x5a0743=_0x5cbaf3;})[_0x83b8('0x95')](function(){if(_0x5a0743===null){_0x4b8289['sendStatus'](_0x38dcfa);}else{if(_0x38dcfa===0x1f4){_0x4b8289[_0x83b8('0x1b')](_0x38dcfa)[_0x83b8('0x96')](_0x5a0743);}else{_0x4b8289[_0x83b8('0x1b')](_0x38dcfa)[_0x83b8('0x1d')](_0x5a0743);}}});};exports[_0x83b8('0x97')]=function(_0x2a722b,_0x5b9611){var _0x5391a0={};var _0x455c28={};var _0x1bc342;var _0x47761e;return db[_0x83b8('0x46')][_0x83b8('0x69')]({'where':{'id':_0x2a722b[_0x83b8('0x5e')]['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0x5b9611,null))[_0x83b8('0x10')](function(_0x1edd61){if(_0x1edd61){_0x1bc342=_0x1edd61;_0x455c28[_0x83b8('0x4f')]=_[_0x83b8('0x4c')](db[_0x83b8('0x92')][_0x83b8('0x47')]);_0x455c28[_0x83b8('0x4b')]=_['keys'](_0x2a722b[_0x83b8('0x4b')]);_0x455c28[_0x83b8('0x4d')]=_[_0x83b8('0x4e')](_0x455c28[_0x83b8('0x4f')],_0x455c28['query']);_0x5391a0[_0x83b8('0x50')]=_[_0x83b8('0x4e')](_0x455c28[_0x83b8('0x4f')],qs[_0x83b8('0x51')](_0x2a722b[_0x83b8('0x4b')][_0x83b8('0x51')]));_0x5391a0[_0x83b8('0x50')]=_0x5391a0[_0x83b8('0x50')][_0x83b8('0x60')]?_0x5391a0[_0x83b8('0x50')]:_0x455c28[_0x83b8('0x4f')];_0x5391a0['order']=qs[_0x83b8('0x55')](_0x2a722b['query']['sort']);_0x5391a0['where']=qs[_0x83b8('0x4d')](_[_0x83b8('0x57')](_0x2a722b[_0x83b8('0x4b')],_0x455c28[_0x83b8('0x4d')]));if(_0x2a722b['query'][_0x83b8('0x58')]){_0x5391a0[_0x83b8('0x56')]=_[_0x83b8('0x61')](_0x5391a0[_0x83b8('0x56')],{'$or':_[_0x83b8('0x45')](_0x5391a0['attributes'],function(_0x59fc5e){var _0x26f1f9={};_0x26f1f9[_0x59fc5e]={'$like':'%'+_0x2a722b[_0x83b8('0x4b')][_0x83b8('0x58')]+'%'};return _0x26f1f9;})});}_0x5391a0=_[_0x83b8('0x61')]({},_0x5391a0,_0x2a722b[_0x83b8('0x59')]);return _0x1bc342[_0x83b8('0x97')](_0x5391a0);}})[_0x83b8('0x10')](function(_0x44e7d1){if(_0x44e7d1){_0x47761e=_0x44e7d1['length'];if(!_0x2a722b[_0x83b8('0x4b')][_0x83b8('0x52')](_0x83b8('0x53'))){_0x5391a0[_0x83b8('0x1e')]=qs[_0x83b8('0x1e')](_0x2a722b[_0x83b8('0x4b')][_0x83b8('0x1e')]);_0x5391a0[_0x83b8('0x21')]=qs[_0x83b8('0x21')](_0x2a722b['query'][_0x83b8('0x21')]);}return _0x1bc342[_0x83b8('0x97')](_0x5391a0);}})[_0x83b8('0x10')](function(_0x941a4f){if(_0x941a4f){return _0x941a4f?{'count':_0x47761e,'rows':_0x941a4f}:null;}})['then'](respondWithResult(_0x5b9611,null))[_0x83b8('0x1a')](handleError(_0x5b9611,null));};exports[_0x83b8('0x98')]=function(_0x1d233a,_0x111c7a){var _0x1df18e={'raw':!![],'where':{}};var _0x1927f4={};var _0x42080c={'count':0x0,'rows':[]};return db[_0x83b8('0x46')][_0x83b8('0x69')]({'where':{'id':_0x1d233a['params']['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0x111c7a,null))[_0x83b8('0x10')](function(_0x18961e){if(_0x18961e){_0x1927f4['model']=_[_0x83b8('0x4c')](db['MailMessage'][_0x83b8('0x47')]);_0x1927f4[_0x83b8('0x4b')]=_[_0x83b8('0x4c')](_0x1d233a[_0x83b8('0x4b')]);_0x1927f4[_0x83b8('0x4d')]=_[_0x83b8('0x4e')](_0x1927f4[_0x83b8('0x4f')],_0x1927f4[_0x83b8('0x4b')]);_0x1df18e[_0x83b8('0x50')]=_[_0x83b8('0x4e')](_0x1927f4[_0x83b8('0x4f')],qs[_0x83b8('0x51')](_0x1d233a['query'][_0x83b8('0x51')]));_0x1df18e['attributes']=_0x1df18e[_0x83b8('0x50')][_0x83b8('0x60')]?_0x1df18e[_0x83b8('0x50')]:_0x1927f4[_0x83b8('0x4f')];if(!_0x1d233a['query'][_0x83b8('0x52')](_0x83b8('0x53'))){_0x1df18e[_0x83b8('0x1e')]=qs[_0x83b8('0x1e')](_0x1d233a[_0x83b8('0x4b')]['limit']);_0x1df18e['offset']=qs[_0x83b8('0x21')](_0x1d233a[_0x83b8('0x4b')][_0x83b8('0x21')]);}_0x1df18e[_0x83b8('0x54')]=qs['sort'](_0x1d233a[_0x83b8('0x4b')][_0x83b8('0x55')]);_0x1df18e[_0x83b8('0x56')]=qs[_0x83b8('0x4d')](_['pick'](_0x1d233a[_0x83b8('0x4b')],_0x1927f4[_0x83b8('0x4d')]));_0x1df18e['where']['MailAccountId']=_0x18961e['id'];if(_0x1d233a[_0x83b8('0x4b')][_0x83b8('0x58')]){_0x1df18e[_0x83b8('0x56')]=_[_0x83b8('0x61')](_0x1df18e[_0x83b8('0x56')],{'$or':_[_0x83b8('0x45')](_0x1df18e['attributes'],function(_0x1285d1){var _0x11a52b={};_0x11a52b[_0x1285d1]={'$like':'%'+_0x1d233a['query'][_0x83b8('0x58')]+'%'};return _0x11a52b;})});}if(_0x1d233a[_0x83b8('0x4b')][_0x83b8('0x99')]){var _0x34ed4d=_0x1d233a[_0x83b8('0x4b')][_0x83b8('0x99')][_0x83b8('0x9a')](',');var _0x51ea73={};_0x51ea73[_0x34ed4d[0x0]]={'$gte':moment(_0x34ed4d[0x1])[_0x83b8('0x9b')](_0x83b8('0x9c'))};_0x1df18e[_0x83b8('0x56')]=_[_0x83b8('0x61')](_0x1df18e['where'],_0x51ea73);}_0x1df18e=_['merge']({},_0x1df18e,_0x1d233a[_0x83b8('0x59')]);return db['MailMessage'][_0x83b8('0x20')]({'where':_0x1df18e[_0x83b8('0x56')]})['then'](function(_0x35b295){_0x42080c[_0x83b8('0x20')]=_0x35b295;if(_0x1d233a[_0x83b8('0x4b')][_0x83b8('0x5a')]){_0x1df18e['include']=[{'all':!![]}];}return db[_0x83b8('0x9d')]['findAll'](_0x1df18e);})[_0x83b8('0x10')](function(_0x2725d9){if(_0x1d233a[_0x83b8('0x4b')][_0x83b8('0x9e')]==='true'){for(var _0x3dc145=0x0;_0x3dc145<_0x2725d9['length'];_0x3dc145++){_0x2725d9[_0x3dc145][_0x83b8('0x63')]=juice(_0x2725d9[_0x3dc145][_0x83b8('0x63')]);}}_0x42080c[_0x83b8('0x5c')]=_0x2725d9;return _0x42080c;});}})[_0x83b8('0x10')](respondWithFilteredResult(_0x111c7a,_0x1df18e))[_0x83b8('0x1a')](handleError(_0x111c7a,null));};exports[_0x83b8('0x96')]=function(_0x87c9f,_0x239805){var _0xecc30c,_0x18f65c={},_0x463683;if(_0x87c9f[_0x83b8('0x63')]['to']){_0x463683=_0x87c9f[_0x83b8('0x63')]['to'][_0x83b8('0x9a')](',')[0x0];}return db[_0x83b8('0x46')][_0x83b8('0x62')]({'where':{'id':_0x87c9f[_0x83b8('0x5e')]['id']},'include':[{'model':db[_0x83b8('0x9f')],'as':_0x83b8('0xa0'),'include':[{'model':db[_0x83b8('0xa1')],'as':_0x83b8('0xa2'),'where':{'email':_0x463683},'limit':0x1,'order':[[_0x83b8('0xa3'),'DESC']]}]},{'model':db[_0x83b8('0x42')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x83b8('0xa4')],'as':'CloudProvider','raw':!![]}]}]})[_0x83b8('0x10')](handleEntityNotFound(_0x239805,null))[_0x83b8('0x10')](function(_0x1b753c){if(!_0x1b753c)return;_0xecc30c=_0x1b753c;if(!_0x1b753c[_0x83b8('0x41')])throw new Error(_0x83b8('0xa5'));if(_[_0x83b8('0x73')](_0x87c9f['body'][_0x83b8('0xa6')])){_0x87c9f[_0x83b8('0x63')][_0x83b8('0xa6')]=util[_0x83b8('0x9b')](_0x83b8('0xa7'),_0x1b753c[_0x83b8('0x29')],_0x1b753c[_0x83b8('0xa8')]||_0x1b753c['Smtp'][_0x83b8('0x35')]);}if(_0x87c9f[_0x83b8('0x63')][_0x83b8('0xa9')]&&_0x87c9f['body']['attachments'][_0x83b8('0x60')]){for(var _0x32f225=0x0;_0x32f225<_0x87c9f['body']['attachments']['length'];_0x32f225+=0x1){_0x87c9f[_0x83b8('0x63')][_0x83b8('0xa9')][_0x32f225]={'filename':_0x87c9f['body']['attachments'][_0x32f225][_0x83b8('0x29')],'path':path[_0x83b8('0xaa')](config[_0x83b8('0xab')],_0x83b8('0xac'),_0x87c9f[_0x83b8('0x63')][_0x83b8('0xa9')][_0x32f225]['basename'])};}}var _0x36b837=_0x1b753c[_0x83b8('0xad')]();return respondWithRpcPromise('SendMail',_0x83b8('0xae'),{'account':_0x36b837,'message':_0x87c9f[_0x83b8('0x63')]});})[_0x83b8('0x10')](function(_0x558f94){if(!_0x558f94)return;_0x18f65c=_0x558f94;if(!_0xecc30c[_0x83b8('0xa0')])throw new Error(_0x83b8('0xaf'));if(_0xecc30c['List']['Contacts']['length'])return _0xecc30c['List']['Contacts'][0x0];return db[_0x83b8('0xa1')][_0x83b8('0x6d')](_[_0x83b8('0x9')](_0x87c9f[_0x83b8('0x63')],{'firstName':_0x87c9f[_0x83b8('0x63')]['to'],'email':_0x87c9f['body']['to'],'phone':_0x87c9f['body']['to'],'ListId':_0xecc30c['ListId']}));})['then'](function(_0x13e295){if(!_0x13e295)return;var _0x161ef3={'UserId':_0x87c9f[_0x83b8('0x35')]['id'],'ContactId':_0x13e295['id'],'MailAccountId':_0xecc30c['id'],'inReplyTo':_0x18f65c[_0x83b8('0xb0')],'to':_0x87c9f['body'][_0x83b8('0xa6')],'cc':_0x87c9f[_0x83b8('0x63')]['cc'],'subject':_0x87c9f[_0x83b8('0x63')][_0x83b8('0xb1')],'attach':_0x87c9f[_0x83b8('0x63')][_0x83b8('0xb2')],'firstMsgDirection':_0x83b8('0xb3'),'lastMsgAt':moment()[_0x83b8('0x9b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x83b8('0xb3'),'Messages':[_[_0x83b8('0x61')](_0x87c9f[_0x83b8('0x63')],{'messageId':_0x18f65c[_0x83b8('0xb0')],'sentAt':moment()[_0x83b8('0x9b')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0xecc30c['id'],'UserId':_0x87c9f[_0x83b8('0x35')]['id'],'ContactId':_0x13e295['id']})]};if(_0x87c9f['body'][_0x83b8('0xb4')]){_0x161ef3=_[_0x83b8('0x61')](_0x161ef3,_0x87c9f[_0x83b8('0x63')][_0x83b8('0xb4')]);}return db[_0x83b8('0x82')][_0x83b8('0x6d')](_0x161ef3,{'include':[{'model':db[_0x83b8('0x9d')],'as':_0x83b8('0xb5')}]});})['then'](respondWithResult(_0x239805,null))[_0x83b8('0x1a')](handleError(_0x239805,null));};exports['verifySmtp']=function(_0x405c52,_0x5cf9cf){return db[_0x83b8('0x46')][_0x83b8('0x62')]({'where':{'id':_0x405c52['params']['id']},'include':[{'model':db[_0x83b8('0x42')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x83b8('0xa4'),'raw':!![]}]}]})[_0x83b8('0x10')](handleEntityNotFound(_0x5cf9cf,null))[_0x83b8('0x10')](function(_0x44eb26){if(!_0x44eb26[_0x83b8('0x41')])return;var _0x17ec2f=_0x44eb26[_0x83b8('0xad')]();return respondWithRpcPromise('VerifySmtp',_0x83b8('0xb6'),{'account':_0x17ec2f});})[_0x83b8('0x10')](respondWithResult(_0x5cf9cf,null))['catch'](handleError(_0x5cf9cf,null));};exports[_0x83b8('0x25')]=function(_0x406d15,_0x2a6e2c){return db[_0x83b8('0x46')]['find']({'where':{'id':_0x406d15[_0x83b8('0x5e')]['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0x2a6e2c,null))[_0x83b8('0x10')](function(_0x35d3e5){if(_0x35d3e5&&_0x35d3e5['service']){throw new db['Sequelize'][(_0x83b8('0xb7'))](_0x83b8('0xb8'));}return _0x35d3e5;})['then'](removeEntity(_0x2a6e2c,null))['catch'](handleError(_0x2a6e2c,null));};exports[_0x83b8('0xb9')]=function(_0x352a1b,_0x28fbd0){return db[_0x83b8('0x46')][_0x83b8('0x62')]({'where':{'id':_0x352a1b[_0x83b8('0x5e')]['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0x28fbd0,null))[_0x83b8('0x10')](function(_0x58f5d9){if(_0x58f5d9){return _0x58f5d9[_0x83b8('0xb9')](_0x352a1b[_0x83b8('0x63')][_0x83b8('0x71')],_[_0x83b8('0xba')](_0x352a1b[_0x83b8('0x63')],['ids','id'])||{})[_0x83b8('0xbb')](function(_0x33c042){for(var _0x34ef84=0x0;_0x34ef84<_0x352a1b[_0x83b8('0x63')][_0x83b8('0x71')][_0x83b8('0x60')];_0x34ef84+=0x1){socket[_0x83b8('0xbc')](_0x83b8('0xbd'),{'UserId':Number(_0x352a1b[_0x83b8('0x63')][_0x83b8('0x71')][_0x34ef84]),'MailAccountId':Number(_0x352a1b[_0x83b8('0x5e')]['id'])});}return _0x33c042;});}})[_0x83b8('0x10')](respondWithResult(_0x28fbd0,null))[_0x83b8('0x1a')](handleError(_0x28fbd0,null));};exports['removeAgents']=function(_0x2790b2,_0x2400db){return db[_0x83b8('0x46')][_0x83b8('0x62')]({'where':{'id':_0x2790b2[_0x83b8('0x5e')]['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0x2400db,null))[_0x83b8('0x10')](function(_0x5f5af5){if(_0x5f5af5){return _0x5f5af5[_0x83b8('0xbe')](_0x2790b2['query']['ids'])['then'](function(){if(_[_0x83b8('0xbf')](_0x2790b2[_0x83b8('0x4b')][_0x83b8('0x71')])){for(var _0x75beba=0x0;_0x75beba<_0x2790b2[_0x83b8('0x4b')][_0x83b8('0x71')][_0x83b8('0x60')];_0x75beba+=0x1){socket[_0x83b8('0xbc')](_0x83b8('0xc0'),{'UserId':Number(_0x2790b2[_0x83b8('0x4b')][_0x83b8('0x71')][_0x75beba]),'MailAccountId':Number(_0x2790b2['params']['id'])});}}else{socket[_0x83b8('0xbc')](_0x83b8('0xc0'),{'UserId':Number(_0x2790b2[_0x83b8('0x4b')][_0x83b8('0x71')]),'MailAccountId':Number(_0x2790b2[_0x83b8('0x5e')]['id'])});}});}})[_0x83b8('0x10')](respondWithStatusCode(_0x2400db,null))[_0x83b8('0x1a')](handleError(_0x2400db,null));};exports[_0x83b8('0xc1')]=function(_0x2085a7,_0x218535){var _0x518943={};var _0x2c0d89={};var _0xa1fc61;var _0x1561ec;return db[_0x83b8('0x46')][_0x83b8('0x69')]({'where':{'id':_0x2085a7[_0x83b8('0x5e')]['id']}})[_0x83b8('0x10')](handleEntityNotFound(_0x218535,null))[_0x83b8('0x10')](function(_0x46b16f){if(_0x46b16f){_0xa1fc61=_0x46b16f;_0x2c0d89[_0x83b8('0x4f')]=_['keys'](db['User'][_0x83b8('0x47')]);_0x2c0d89['query']=_['keys'](_0x2085a7[_0x83b8('0x4b')]);_0x2c0d89[_0x83b8('0x4d')]=_[_0x83b8('0x4e')](_0x2c0d89[_0x83b8('0x4f')],_0x2c0d89[_0x83b8('0x4b')]);_0x518943['attributes']=_[_0x83b8('0x4e')](_0x2c0d89[_0x83b8('0x4f')],qs['fields'](_0x2085a7['query'][_0x83b8('0x51')]));_0x518943['attributes']=_0x518943[_0x83b8('0x50')][_0x83b8('0x60')]?_0x518943[_0x83b8('0x50')]:_0x2c0d89[_0x83b8('0x4f')];_0x518943['order']=qs[_0x83b8('0x55')](_0x2085a7[_0x83b8('0x4b')]['sort']);_0x518943[_0x83b8('0x56')]=qs[_0x83b8('0x4d')](_[_0x83b8('0x57')](_0x2085a7[_0x83b8('0x4b')],_0x2c0d89[_0x83b8('0x4d')]));if(_0x2085a7[_0x83b8('0x4b')][_0x83b8('0x58')]){_0x518943[_0x83b8('0x56')]=_['merge'](_0x518943[_0x83b8('0x56')],{'$or':_[_0x83b8('0x45')](_0x518943[_0x83b8('0x50')],function(_0x3d59d0){var _0x2a591b={};_0x2a591b[_0x3d59d0]={'$like':'%'+_0x2085a7[_0x83b8('0x4b')][_0x83b8('0x58')]+'%'};return _0x2a591b;})});}_0x518943=_['merge']({},_0x518943,_0x2085a7[_0x83b8('0x59')]);return _0xa1fc61[_0x83b8('0xc1')](_0x518943);}})[_0x83b8('0x10')](function(_0x69f70){if(_0x69f70){_0x1561ec=_0x69f70[_0x83b8('0x60')];if(!_0x2085a7['query'][_0x83b8('0x52')]('nolimit')){_0x518943[_0x83b8('0x1e')]=qs[_0x83b8('0x1e')](_0x2085a7[_0x83b8('0x4b')][_0x83b8('0x1e')]);_0x518943[_0x83b8('0x21')]=qs['offset'](_0x2085a7[_0x83b8('0x4b')][_0x83b8('0x21')]);}return _0xa1fc61['getAgents'](_0x518943);}})['then'](function(_0x37b1bf){if(_0x37b1bf){return _0x37b1bf?{'count':_0x1561ec,'rows':_0x37b1bf}:null;}})[_0x83b8('0x10')](respondWithResult(_0x218535,null))['catch'](handleError(_0x218535,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 4d64b2b..d358ea6 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 _0x1a38=['events','../../mysqldb','MailAccount','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4b3618,_0x3f02d8){var _0x410aa5=function(_0x5e9847){while(--_0x5e9847){_0x4b3618['push'](_0x4b3618['shift']());}};_0x410aa5(++_0x3f02d8);}(_0x1a38,0xb0));var _0x81a3=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x1a38[_0x5416db];return _0x243e35;};'use strict';var EventEmitter=require(_0x81a3('0x0'));var MailAccount=require(_0x81a3('0x1'))['db'][_0x81a3('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x81a3('0x3')};function emitEvent(_0x2402ba){return function(_0x2faf46,_0x28fd86,_0x33a486){MailAccountEvents[_0x81a3('0x4')](_0x2402ba+':'+_0x2faf46['id'],_0x2faf46);MailAccountEvents[_0x81a3('0x4')](_0x2402ba,_0x2faf46);_0x33a486(null);};}for(var e in events){if(events[_0x81a3('0x5')](e)){var event=events[e];MailAccount[_0x81a3('0x6')](e,emitEvent(event));}}module[_0x81a3('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x4473=['update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x6a7409,_0x3b25b0){var _0x1bed59=function(_0x297d11){while(--_0x297d11){_0x6a7409['push'](_0x6a7409['shift']());}};_0x1bed59(++_0x3b25b0);}(_0x4473,0x15c));var _0x3447=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4473[_0x3bf83f];return _0x22c4a9;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3447('0x0'),'afterDestroy':_0x3447('0x1')};function emitEvent(_0x282ac0){return function(_0x540435,_0x58a9cd,_0x515303){MailAccountEvents[_0x3447('0x2')](_0x282ac0+':'+_0x540435['id'],_0x540435);MailAccountEvents[_0x3447('0x2')](_0x282ac0,_0x540435);_0x515303(null);};}for(var e in events){if(events[_0x3447('0x3')](e)){var event=events[e];MailAccount[_0x3447('0x4')](e,emitEvent(event));}}module[_0x3447('0x5')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index fb700b9..dcd9038 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 _0x1479=['define','MailAccount','mail_accounts','provider','custom','service','host','port','Smtp','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','data5','user','pass','./mailAccount.attributes','exports'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0x1479,0x152));var _0x9147=function(_0x594533,_0x28e8bf){_0x594533=_0x594533-0x0;var _0x450f3b=_0x1479[_0x594533];return _0x450f3b;};'use strict';var attributes=require(_0x9147('0x0'));module[_0x9147('0x1')]=function(_0x350151){return _0x350151[_0x9147('0x2')](_0x9147('0x3'),attributes,{'tableName':_0x9147('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3c294c=this;var _0x1cff34={'id':_0x3c294c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3c294c[_0x9147('0x5')]!==_0x9147('0x6')){_0x1cff34[_0x9147('0x7')]=_0x3c294c[_0x9147('0x5')];}else{_0x1cff34['host']=_0x3c294c['Smtp'][_0x9147('0x8')];_0x1cff34[_0x9147('0x9')]=_0x3c294c[_0x9147('0xa')][_0x9147('0x9')];_0x1cff34[_0x9147('0xb')]=_0x3c294c['Smtp'][_0x9147('0xb')];}if(_0x3c294c['Smtp']['authentication']){if(_0x3c294c[_0x9147('0xa')][_0x9147('0xc')]){if(!_0x3c294c['Smtp'][_0x9147('0xd')])throw new Error(_0x9147('0xe'));_0x1cff34[_0x9147('0xf')]={'type':_0x9147('0x10'),'user':_0x3c294c['Smtp']['user'],'accessToken':_0x3c294c['Smtp'][_0x9147('0xd')][_0x9147('0x11')]};}else{_0x1cff34[_0x9147('0xf')]={'user':_0x3c294c['Smtp'][_0x9147('0x12')],'pass':_0x3c294c[_0x9147('0xa')][_0x9147('0x13')]};}}return _0x1cff34;}}});}; \ No newline at end of file +var _0x860b=['data5','auth','user','pass','exports','MailAccount','provider','custom','service','host','port','Smtp','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2'];(function(_0x32986,_0x4489c8){var _0x355ebb=function(_0x338840){while(--_0x338840){_0x32986['push'](_0x32986['shift']());}};_0x355ebb(++_0x4489c8);}(_0x860b,0x112));var _0xb860=function(_0x3fb743,_0x5b6f91){_0x3fb743=_0x3fb743-0x0;var _0x9f2b98=_0x860b[_0x3fb743];return _0x9f2b98;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xb860('0x0')]=function(_0x22bd17){return _0x22bd17['define'](_0xb860('0x1'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x30fb66=this;var _0x6c39d5={'id':_0x30fb66['id'],'tls':{'rejectUnauthorized':![]}};if(_0x30fb66[_0xb860('0x2')]!==_0xb860('0x3')){_0x6c39d5[_0xb860('0x4')]=_0x30fb66['provider'];}else{_0x6c39d5[_0xb860('0x5')]=_0x30fb66['Smtp'][_0xb860('0x5')];_0x6c39d5[_0xb860('0x6')]=_0x30fb66[_0xb860('0x7')][_0xb860('0x6')];_0x6c39d5[_0xb860('0x8')]=_0x30fb66[_0xb860('0x7')][_0xb860('0x8')];}if(_0x30fb66['Smtp'][_0xb860('0x9')]){if(_0x30fb66['Smtp'][_0xb860('0xa')]){if(!_0x30fb66['Smtp'][_0xb860('0xb')])throw new Error(_0xb860('0xc'));_0x6c39d5['auth']={'type':_0xb860('0xd'),'user':_0x30fb66[_0xb860('0x7')]['user'],'accessToken':_0x30fb66[_0xb860('0x7')]['CloudProvider'][_0xb860('0xe')]};}else{_0x6c39d5[_0xb860('0xf')]={'user':_0x30fb66[_0xb860('0x7')][_0xb860('0x10')],'pass':_0x30fb66[_0xb860('0x7')][_0xb860('0x11')]};}}return _0x6c39d5;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index d8177ee..bcd6e37 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 _0xdbb1=['mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','List','Contacts','DESC','Applications','CloudProvider','get','getSmtpOptions','applications','orderBy','priority','autoclose','length','close','*,*,*,*','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','create','Contact\x20not\x20found','spread','interaction','created','attachments','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','unshift','name','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','ioredis','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty'];(function(_0x275caa,_0x166d5e){var _0x28d670=function(_0x2a20e1){while(--_0x2a20e1){_0x275caa['push'](_0x275caa['shift']());}};_0x28d670(++_0x166d5e);}(_0xdbb1,0x105));var _0x1dbb=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xdbb1[_0x10004e];return _0x5af990;};'use strict';var _=require(_0x1dbb('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var Redis=require(_0x1dbb('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x1dbb('0x2'));var config=require('../../config/environment');var jayson=require(_0x1dbb('0x3'));var client=jayson[_0x1dbb('0x4')]['http']({'port':0x232c});config['redis']=_[_0x1dbb('0x5')](config[_0x1dbb('0x6')],{'host':_0x1dbb('0x7'),'port':0x18eb});var socket=require(_0x1dbb('0x8'))(new Redis(config['redis']));require(_0x1dbb('0x9'))[_0x1dbb('0xa')](socket);function respondWithRpcPromise(_0x5d2d5c,_0x208220,_0x232c1c){return new BPromise(function(_0x1e7ac5,_0x3ce7e9){return client[_0x1dbb('0xb')](_0x5d2d5c,_0x232c1c)[_0x1dbb('0xc')](function(_0x111841){logger[_0x1dbb('0xd')](_0x1dbb('0xe'),_0x208220,_0x1dbb('0xf'));logger[_0x1dbb('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x208220,_0x1dbb('0xf'),JSON[_0x1dbb('0x11')](_0x111841));if(_0x111841[_0x1dbb('0x12')]){if(_0x111841[_0x1dbb('0x12')]['code']===0x1f4){logger['error'](_0x1dbb('0xe'),_0x208220,_0x111841[_0x1dbb('0x12')][_0x1dbb('0x13')]);return _0x3ce7e9(_0x111841[_0x1dbb('0x12')][_0x1dbb('0x13')]);}logger['error'](_0x1dbb('0xe'),_0x208220,_0x111841[_0x1dbb('0x12')][_0x1dbb('0x13')]);return _0x1e7ac5(_0x111841['error'][_0x1dbb('0x13')]);}else{logger[_0x1dbb('0xd')]('MailAccount,\x20%s,\x20%s',_0x208220,_0x1dbb('0xf'));_0x1e7ac5(_0x111841[_0x1dbb('0x14')][_0x1dbb('0x13')]);}})[_0x1dbb('0x15')](function(_0xb21bc5){logger[_0x1dbb('0x12')](_0x1dbb('0xe'),_0x208220,_0xb21bc5);_0x3ce7e9(_0xb21bc5);});});}exports[_0x1dbb('0x16')]=function(_0x58aa43){var _0x550dd4=this;return new Promise(function(_0x4802ba,_0x4248d7){return db[_0x1dbb('0x17')]['findAll']({'raw':_0x58aa43[_0x1dbb('0x18')]?_0x58aa43[_0x1dbb('0x18')][_0x1dbb('0x19')]===undefined?!![]:![]:!![],'where':_0x58aa43[_0x1dbb('0x18')]?_0x58aa43[_0x1dbb('0x18')][_0x1dbb('0x1a')]||null:null,'attributes':_0x58aa43[_0x1dbb('0x18')]?_0x58aa43[_0x1dbb('0x18')][_0x1dbb('0x1b')]||null:null,'limit':_0x58aa43[_0x1dbb('0x18')]?_0x58aa43[_0x1dbb('0x18')][_0x1dbb('0x1c')]||null:null,'include':_0x58aa43[_0x1dbb('0x18')]?_0x58aa43[_0x1dbb('0x18')][_0x1dbb('0x1d')]?_[_0x1dbb('0x1e')](_0x58aa43[_0x1dbb('0x18')][_0x1dbb('0x1d')],function(_0x18f188){return{'model':db[_0x18f188['model']],'as':_0x18f188['as'],'attributes':_0x18f188[_0x1dbb('0x1b')],'include':_0x18f188['include']?_[_0x1dbb('0x1e')](_0x18f188['include'],function(_0x72cfed){return{'model':db[_0x72cfed[_0x1dbb('0x1f')]],'as':_0x72cfed['as'],'attributes':_0x72cfed[_0x1dbb('0x1b')],'include':_0x72cfed[_0x1dbb('0x1d')]?_[_0x1dbb('0x1e')](_0x72cfed[_0x1dbb('0x1d')],function(_0x5e5059){return{'model':db[_0x5e5059[_0x1dbb('0x1f')]],'as':_0x5e5059['as'],'attributes':_0x5e5059[_0x1dbb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1dbb('0xc')](function(_0x4c0a9d){logger['info'](_0x1dbb('0x16'),_0x58aa43);logger['debug']('GetMailAccount',_0x58aa43,JSON[_0x1dbb('0x11')](_0x4c0a9d));_0x4802ba(_0x4c0a9d);})[_0x1dbb('0x15')](function(_0x4511b3){logger[_0x1dbb('0x12')](_0x1dbb('0x16'),_0x4511b3[_0x1dbb('0x13')],_0x58aa43);_0x4248d7(_0x550dd4[_0x1dbb('0x12')](0x1f4,_0x4511b3[_0x1dbb('0x13')]));});});};exports[_0x1dbb('0x20')]=function(_0x5126a3){var _0x4d70fc=this;return new Promise(function(_0x15672c,_0x110b7a){return db[_0x1dbb('0x17')]['find']({'raw':_0x5126a3['options']?_0x5126a3[_0x1dbb('0x18')][_0x1dbb('0x19')]===undefined?!![]:![]:!![],'where':_0x5126a3[_0x1dbb('0x18')]?_0x5126a3['options']['where']||null:null,'attributes':_0x5126a3[_0x1dbb('0x18')]?_0x5126a3[_0x1dbb('0x18')]['attributes']||null:null,'include':_0x5126a3[_0x1dbb('0x18')]?_0x5126a3[_0x1dbb('0x18')][_0x1dbb('0x1d')]?_[_0x1dbb('0x1e')](_0x5126a3['options'][_0x1dbb('0x1d')],function(_0x22e40b){return{'model':db[_0x22e40b[_0x1dbb('0x1f')]],'as':_0x22e40b['as'],'attributes':_0x22e40b[_0x1dbb('0x1b')],'include':_0x22e40b[_0x1dbb('0x1d')]?_[_0x1dbb('0x1e')](_0x22e40b['include'],function(_0x5a9c2){return{'model':db[_0x5a9c2[_0x1dbb('0x1f')]],'as':_0x5a9c2['as'],'attributes':_0x5a9c2['attributes'],'include':_0x5a9c2[_0x1dbb('0x1d')]?_[_0x1dbb('0x1e')](_0x5a9c2[_0x1dbb('0x1d')],function(_0xde3241){return{'model':db[_0xde3241[_0x1dbb('0x1f')]],'as':_0xde3241['as'],'attributes':_0xde3241['attributes']};}):[]};}):[]};}):[]:[]})[_0x1dbb('0xc')](function(_0x28db37){if(_0x5126a3[_0x1dbb('0x18')][_0x1dbb('0x21')]===!![])_0x28db37[_0x1dbb('0x22')](_0x1dbb('0x23'),_0x28db37['getSmtpOptions']());logger[_0x1dbb('0xd')](_0x1dbb('0x20'),_0x5126a3);logger['debug'](_0x1dbb('0x20'),_0x5126a3,JSON[_0x1dbb('0x11')](_0x28db37));_0x15672c(_0x28db37);})[_0x1dbb('0x15')](function(_0x311f6e){logger[_0x1dbb('0x12')](_0x1dbb('0x20'),_0x311f6e[_0x1dbb('0x13')],_0x5126a3);_0x110b7a(_0x4d70fc[_0x1dbb('0x12')](0x1f4,_0x311f6e[_0x1dbb('0x13')]));});});};exports[_0x1dbb('0x24')]=function(_0x3fed14){var _0x366f44=this;return new Promise(function(_0x2a74a3,_0x55a8f6){var _0x1b94ab={'body':_0x3fed14[_0x1dbb('0x25')],'channel':_0x1dbb('0x26')};var _0x2af34d=_[_0x1dbb('0x27')](_[_0x1dbb('0x28')](db[_0x1dbb('0x29')][_0x1dbb('0x2a')]),[_0x1dbb('0x2b'),_0x1dbb('0x2c'),_0x1dbb('0x2d'),_0x1dbb('0x2e')]);var _0x139cb4=![];if(_0x3fed14['body']['id']){delete _0x3fed14[_0x1dbb('0x25')]['id'];}if(_[_0x1dbb('0x2f')](_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x30')])){return _0x55a8f6(_0x366f44['error'](0x1f4,_0x1dbb('0x31')));}if(_[_0x1dbb('0x2f')](_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x25')])||_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x25')]===''){return _0x55a8f6(_0x366f44[_0x1dbb('0x12')](0x1f4,_0x1dbb('0x32')));}if(_['isNil'](_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x33')])){return _0x55a8f6(_0x366f44[_0x1dbb('0x12')](0x1f4,_0x1dbb('0x34')+_0x2af34d));}if(!_[_0x1dbb('0x35')](_0x2af34d,_0x3fed14[_0x1dbb('0x25')]['mapKey'])){return _0x55a8f6(_0x366f44[_0x1dbb('0x12')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2af34d));}var _0x11ae4c={};_0x11ae4c[_0x3fed14[_0x1dbb('0x25')]['mapKey']]=_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x30')];return db[_0x1dbb('0x17')][_0x1dbb('0x36')]({'where':{'id':_0x3fed14[_0x1dbb('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0x1dbb('0x38'),'include':[{'model':db[_0x1dbb('0x29')],'as':_0x1dbb('0x39'),'where':_0x11ae4c,'limit':0x1,'order':[[_0x1dbb('0x2c'),_0x1dbb('0x3a')]]}]},{'model':db['MailApplication'],'as':_0x1dbb('0x3b')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x1dbb('0x3c')],'as':'CloudProvider'}]}]})[_0x1dbb('0xc')](function(_0xb47fb7){if(_0xb47fb7&&_0xb47fb7[_0x1dbb('0x38')]){var _0x3085ab=_0xb47fb7[_0x1dbb('0x3d')]({'plain':!![]});_0x1b94ab[_0x1dbb('0x37')]=_['omit'](_0x3085ab,[_0x1dbb('0x3b'),_0x1dbb('0x38')]);_0x1b94ab[_0x1dbb('0x37')][_0x1dbb('0x23')]=_0xb47fb7[_0x1dbb('0x3e')]();_0x1b94ab[_0x1dbb('0x3f')]=_0x3085ab['Applications'];_0x1b94ab['list']=_0x3085ab[_0x1dbb('0x38')];_0x1b94ab['applications']=_[_0x1dbb('0x40')](_0x1b94ab[_0x1dbb('0x3f')],[_0x1dbb('0x41')],['asc']);if(_0x1b94ab[_0x1dbb('0x37')]&&_0x1b94ab[_0x1dbb('0x37')][_0x1dbb('0x42')]){_0x1b94ab[_0x1dbb('0x3f')]['push']({'id':0x0,'priority':_0x1b94ab[_0x1dbb('0x3f')][_0x1dbb('0x43')]+0x1,'app':_0x1dbb('0x44'),'appdata':_0x1dbb('0x42'),'interval':_0x1dbb('0x45')});}if(_0x1b94ab[_0x1dbb('0x37')][_0x1dbb('0x3b')]){delete _0x1b94ab[_0x1dbb('0x37')][_0x1dbb('0x3b')];}if(_0x1b94ab[_0x1dbb('0x37')][_0x1dbb('0x38')]){delete _0x1b94ab[_0x1dbb('0x37')][_0x1dbb('0x38')];}if(_0x3085ab[_0x1dbb('0x38')]['Contacts']['length']){return _0x3085ab[_0x1dbb('0x38')]['Contacts'][0x0];}var _0x100828=_[_0x1dbb('0x5')](_0x3fed14[_0x1dbb('0x25')],{'firstName':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x30')],'ListId':_0x3085ab[_0x1dbb('0x2e')]});_0x100828[_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x33')]]=_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x30')];return db[_0x1dbb('0x29')]['create'](_0x100828);}else{throw new Error(_0x1dbb('0x46'));}})[_0x1dbb('0xc')](function(_0x558ac9){_0x1b94ab[_0x1dbb('0x47')]=_0x558ac9;if(_0x558ac9){if(!_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')]['messageId']){_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x48')]=rs[_0x1dbb('0x49')]()+'\x20'+_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x30')];}var _0x3958f6={'ContactId':_0x558ac9['id'],'MailAccountId':_0x3fed14[_0x1dbb('0x37')]['id'],'inReplyTo':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x48')],'to':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x30')],'cc':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')]['cc'],'subject':_0x3fed14['body'][_0x1dbb('0x13')][_0x1dbb('0x4a')],'attach':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x4b')],'lastMsgAt':moment()[_0x1dbb('0x4c')](_0x1dbb('0x4d')),'lastMsgDirection':'in'};return db[_0x1dbb('0x4e')][_0x1dbb('0x36')]({'where':{'closed':![],'MailAccountId':_0x3fed14[_0x1dbb('0x37')]['id']},'include':[{'model':db[_0x1dbb('0x4f')],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x50')]}}]})[_0x1dbb('0xc')](function(_0x53004c){if(_0x53004c){return[_0x53004c,![]];}return db['MailInteraction'][_0x1dbb('0x51')](_0x3958f6)[_0x1dbb('0xc')](function(_0x3770c0){return[_0x3770c0,!![]];});});}else{throw new Error(_0x1dbb('0x52'));}})[_0x1dbb('0x53')](function(_0x322b54,_0x2b2746){if(_0x322b54){_0x139cb4=_0x2b2746;if(!_0x2b2746){return _0x322b54['update']({'inReplyTo':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x48')],'to':_0x3fed14[_0x1dbb('0x25')]['message'][_0x1dbb('0x30')],'cc':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')]['cc'],'subject':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x4a')],'attach':_0x322b54[_0x1dbb('0x4b')]?_0x322b54[_0x1dbb('0x4b')]:_0x3fed14[_0x1dbb('0x25')]['message'][_0x1dbb('0x4b')],'substatus':null,'substatusAt':moment()[_0x1dbb('0x4c')](_0x1dbb('0x4d')),'lastMsgAt':moment()[_0x1dbb('0x4c')](_0x1dbb('0x4d')),'lastMsgDirection':'in'});}else{return _0x322b54;}}})['then'](function(_0x40927c){_0x1b94ab[_0x1dbb('0x54')]=_0x40927c['get']({'plain':!![]});_0x1b94ab[_0x1dbb('0x54')][_0x1dbb('0x55')]=_0x139cb4;return db[_0x1dbb('0x4f')][_0x1dbb('0x51')]({'body':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x25')],'MailAccountId':_0x3fed14[_0x1dbb('0x37')]['id'],'MailInteractionId':_0x40927c['id'],'direction':'in','ContactId':_0x1b94ab['contact']['id'],'messageId':_0x3fed14['body'][_0x1dbb('0x13')][_0x1dbb('0x48')],'from':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x30')],'to':_0x3fed14[_0x1dbb('0x25')]['message']['to'],'cc':_0x3fed14[_0x1dbb('0x25')]['message']['cc'],'subject':_0x3fed14['body'][_0x1dbb('0x13')][_0x1dbb('0x4a')],'attach':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x4b')],'Attachments':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x56')],'originTo':_0x3fed14['body'][_0x1dbb('0x13')][_0x1dbb('0x57')],'originCc':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')]['originCc'],'bcc':_0x3fed14[_0x1dbb('0x25')]['message'][_0x1dbb('0x58')],'ChatWebsiteId':_0x3fed14[_0x1dbb('0x25')]['message'][_0x1dbb('0x59')]||null,'originChannel':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x5a')]||_0x1dbb('0x5b'),'ChatOfflineMessageId':_0x3fed14['body'][_0x1dbb('0x13')][_0x1dbb('0x5c')]||null},{'include':[{'model':db[_0x1dbb('0x5d')],'as':_0x1dbb('0x5e')}]});})[_0x1dbb('0xc')](function(_0x430bec){_0x1b94ab['message']=_0x430bec;if(!_0x1b94ab[_0x1dbb('0x54')]['UserId']){return;}return db['User'][_0x1dbb('0x36')]({'attributes':['id','name'],'where':{'id':_0x1b94ab[_0x1dbb('0x54')][_0x1dbb('0x5f')]}});})[_0x1dbb('0xc')](function(_0x3efd93){if(_0x3efd93){_0x1b94ab[_0x1dbb('0x3f')][_0x1dbb('0x60')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3efd93[_0x1dbb('0x61')]+','+(_0x1b94ab[_0x1dbb('0x37')][_0x1dbb('0x62')]||0xa),'interval':_0x1dbb('0x45')});}if(!_0x1b94ab[_0x1dbb('0x54')]['queueId']){return;}return db['MailQueue'][_0x1dbb('0x36')]({'attributes':['id',_0x1dbb('0x61')],'where':{'id':_0x1b94ab['interaction'][_0x1dbb('0x63')]}});})[_0x1dbb('0xc')](function(_0x12008c){if(_0x12008c){_0x1b94ab['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x1dbb('0x64'),'appdata':_0x12008c[_0x1dbb('0x61')]+','+(_0x1b94ab[_0x1dbb('0x37')][_0x1dbb('0x65')]||0x12c),'interval':_0x1dbb('0x45')});}return respondWithRpcPromise(_0x1dbb('0x66'),_0x1dbb('0x67'),_0x1b94ab);})[_0x1dbb('0xc')](function(_0x43788f){_0x2a74a3(_0x43788f);})[_0x1dbb('0x15')](function(_0x48f548){_0x55a8f6(_0x366f44[_0x1dbb('0x12')](0x1f4,_0x48f548[_0x1dbb('0x13')]));});});}; \ No newline at end of file +var _0x08d9=['stringify','error','code','message','catch','GetMailAccount','MailAccount','options','raw','attributes','limit','include','map','model','debug','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','body','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','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','from','account','CmContact','Contacts','DESC','Smtp','CloudProvider','List','get','omit','getSmtpOptions','list','applications','orderBy','priority','asc','autoclose','push','Applications','length','ListId','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','inReplyTo','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','agent','*,*,*,*','queueId','MailQueue','name','unshift','queue','waitForTheAssignedQueue','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5b69e5,_0x5a2682){var _0xbeab65=function(_0x51aecf){while(--_0x51aecf){_0x5b69e5['push'](_0x5b69e5['shift']());}};_0xbeab65(++_0x5a2682);}(_0x08d9,0xc2));var _0x908d=function(_0x104897,_0x3a023d){_0x104897=_0x104897-0x0;var _0x1cd646=_0x08d9[_0x104897];return _0x1cd646;};'use strict';var _=require(_0x908d('0x0'));var moment=require('moment');var BPromise=require(_0x908d('0x1'));var rs=require('randomstring');var Redis=require(_0x908d('0x2'));var db=require(_0x908d('0x3'))['db'];var logger=require(_0x908d('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x908d('0x5'));var client=jayson[_0x908d('0x6')][_0x908d('0x7')]({'port':0x232c});config[_0x908d('0x8')]=_[_0x908d('0x9')](config['redis'],{'host':_0x908d('0xa'),'port':0x18eb});var socket=require(_0x908d('0xb'))(new Redis(config[_0x908d('0x8')]));require(_0x908d('0xc'))[_0x908d('0xd')](socket);function respondWithRpcPromise(_0x44b888,_0x86662e,_0x24113f){return new BPromise(function(_0x41b147,_0x2ac2b7){return client['request'](_0x44b888,_0x24113f)[_0x908d('0xe')](function(_0x1a1666){logger[_0x908d('0xf')](_0x908d('0x10'),_0x86662e,_0x908d('0x11'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x86662e,'request\x20sent',JSON[_0x908d('0x12')](_0x1a1666));if(_0x1a1666[_0x908d('0x13')]){if(_0x1a1666[_0x908d('0x13')][_0x908d('0x14')]===0x1f4){logger[_0x908d('0x13')](_0x908d('0x10'),_0x86662e,_0x1a1666[_0x908d('0x13')]['message']);return _0x2ac2b7(_0x1a1666['error'][_0x908d('0x15')]);}logger[_0x908d('0x13')](_0x908d('0x10'),_0x86662e,_0x1a1666[_0x908d('0x13')]['message']);return _0x41b147(_0x1a1666['error'][_0x908d('0x15')]);}else{logger[_0x908d('0xf')](_0x908d('0x10'),_0x86662e,_0x908d('0x11'));_0x41b147(_0x1a1666['result'][_0x908d('0x15')]);}})[_0x908d('0x16')](function(_0x3dea46){logger[_0x908d('0x13')](_0x908d('0x10'),_0x86662e,_0x3dea46);_0x2ac2b7(_0x3dea46);});});}exports[_0x908d('0x17')]=function(_0x10137f){var _0x578bed=this;return new Promise(function(_0x34a524,_0x10848a){return db[_0x908d('0x18')]['findAll']({'raw':_0x10137f[_0x908d('0x19')]?_0x10137f[_0x908d('0x19')][_0x908d('0x1a')]===undefined?!![]:![]:!![],'where':_0x10137f[_0x908d('0x19')]?_0x10137f[_0x908d('0x19')]['where']||null:null,'attributes':_0x10137f[_0x908d('0x19')]?_0x10137f['options'][_0x908d('0x1b')]||null:null,'limit':_0x10137f[_0x908d('0x19')]?_0x10137f[_0x908d('0x19')][_0x908d('0x1c')]||null:null,'include':_0x10137f[_0x908d('0x19')]?_0x10137f[_0x908d('0x19')][_0x908d('0x1d')]?_[_0x908d('0x1e')](_0x10137f['options'][_0x908d('0x1d')],function(_0x1b5514){return{'model':db[_0x1b5514[_0x908d('0x1f')]],'as':_0x1b5514['as'],'attributes':_0x1b5514[_0x908d('0x1b')],'include':_0x1b5514[_0x908d('0x1d')]?_['map'](_0x1b5514['include'],function(_0x4488e8){return{'model':db[_0x4488e8[_0x908d('0x1f')]],'as':_0x4488e8['as'],'attributes':_0x4488e8[_0x908d('0x1b')],'include':_0x4488e8[_0x908d('0x1d')]?_[_0x908d('0x1e')](_0x4488e8['include'],function(_0x3c4157){return{'model':db[_0x3c4157[_0x908d('0x1f')]],'as':_0x3c4157['as'],'attributes':_0x3c4157['attributes']};}):[]};}):[]};}):[]:[]})[_0x908d('0xe')](function(_0x40b418){logger[_0x908d('0xf')](_0x908d('0x17'),_0x10137f);logger[_0x908d('0x20')](_0x908d('0x17'),_0x10137f,JSON[_0x908d('0x12')](_0x40b418));_0x34a524(_0x40b418);})[_0x908d('0x16')](function(_0x2b8fa3){logger[_0x908d('0x13')](_0x908d('0x17'),_0x2b8fa3['message'],_0x10137f);_0x10848a(_0x578bed[_0x908d('0x13')](0x1f4,_0x2b8fa3[_0x908d('0x15')]));});});};exports[_0x908d('0x21')]=function(_0x2d0e55){var _0x4e44b6=this;return new Promise(function(_0x28f130,_0x22e8dd){return db[_0x908d('0x18')][_0x908d('0x22')]({'raw':_0x2d0e55[_0x908d('0x19')]?_0x2d0e55[_0x908d('0x19')][_0x908d('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d0e55[_0x908d('0x19')]?_0x2d0e55[_0x908d('0x19')][_0x908d('0x23')]||null:null,'attributes':_0x2d0e55[_0x908d('0x19')]?_0x2d0e55['options']['attributes']||null:null,'include':_0x2d0e55[_0x908d('0x19')]?_0x2d0e55[_0x908d('0x19')]['include']?_['map'](_0x2d0e55[_0x908d('0x19')][_0x908d('0x1d')],function(_0x359ca4){return{'model':db[_0x359ca4[_0x908d('0x1f')]],'as':_0x359ca4['as'],'attributes':_0x359ca4[_0x908d('0x1b')],'include':_0x359ca4['include']?_[_0x908d('0x1e')](_0x359ca4[_0x908d('0x1d')],function(_0x2a766f){return{'model':db[_0x2a766f[_0x908d('0x1f')]],'as':_0x2a766f['as'],'attributes':_0x2a766f[_0x908d('0x1b')],'include':_0x2a766f['include']?_['map'](_0x2a766f[_0x908d('0x1d')],function(_0x522ef1){return{'model':db[_0x522ef1[_0x908d('0x1f')]],'as':_0x522ef1['as'],'attributes':_0x522ef1[_0x908d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x908d('0xe')](function(_0x302897){if(_0x2d0e55[_0x908d('0x19')][_0x908d('0x24')]===!![])_0x302897[_0x908d('0x25')](_0x908d('0x26'),_0x302897['getSmtpOptions']());logger['info'](_0x908d('0x21'),_0x2d0e55);logger[_0x908d('0x20')](_0x908d('0x21'),_0x2d0e55,JSON['stringify'](_0x302897));_0x28f130(_0x302897);})['catch'](function(_0x56fd99){logger[_0x908d('0x13')]('ShowMailAccount',_0x56fd99[_0x908d('0x15')],_0x2d0e55);_0x22e8dd(_0x4e44b6[_0x908d('0x13')](0x1f4,_0x56fd99[_0x908d('0x15')]));});});};exports['NotifyMailAccount']=function(_0x53ca81){var _0x48bf10=this;return new Promise(function(_0x1c14fb,_0x136115){var _0x59073d={'body':_0x53ca81[_0x908d('0x27')],'channel':'mail'};var _0x929529=_[_0x908d('0x28')](_[_0x908d('0x29')](db['CmContact'][_0x908d('0x2a')]),[_0x908d('0x2b'),_0x908d('0x2c'),_0x908d('0x2d'),'ListId']);var _0x1b1329=![];if(_0x53ca81[_0x908d('0x27')]['id']){delete _0x53ca81[_0x908d('0x27')]['id'];}if(_[_0x908d('0x2e')](_0x53ca81[_0x908d('0x27')]['from'])){return _0x136115(_0x48bf10[_0x908d('0x13')](0x1f4,_0x908d('0x2f')));}if(_[_0x908d('0x2e')](_0x53ca81[_0x908d('0x27')][_0x908d('0x27')])||_0x53ca81[_0x908d('0x27')]['body']===''){return _0x136115(_0x48bf10['error'](0x1f4,_0x908d('0x30')));}if(_['isNil'](_0x53ca81[_0x908d('0x27')][_0x908d('0x31')])){return _0x136115(_0x48bf10['error'](0x1f4,_0x908d('0x32')+_0x929529));}if(!_[_0x908d('0x33')](_0x929529,_0x53ca81['body'][_0x908d('0x31')])){return _0x136115(_0x48bf10[_0x908d('0x13')](0x1f4,_0x908d('0x34')+_0x929529));}var _0x447f75={};_0x447f75[_0x53ca81['body'][_0x908d('0x31')]]=_0x53ca81['body'][_0x908d('0x35')];return db[_0x908d('0x18')]['find']({'where':{'id':_0x53ca81[_0x908d('0x36')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x908d('0x37')],'as':_0x908d('0x38'),'where':_0x447f75,'limit':0x1,'order':[[_0x908d('0x2c'),_0x908d('0x39')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db['MailServerOut'],'as':_0x908d('0x3a'),'include':[{'model':db[_0x908d('0x3b')],'as':_0x908d('0x3b')}]}]})[_0x908d('0xe')](function(_0x44d091){if(_0x44d091&&_0x44d091[_0x908d('0x3c')]){var _0x3f5d4f=_0x44d091[_0x908d('0x3d')]({'plain':!![]});_0x59073d['account']=_[_0x908d('0x3e')](_0x3f5d4f,['Applications',_0x908d('0x3c')]);_0x59073d[_0x908d('0x36')][_0x908d('0x26')]=_0x44d091[_0x908d('0x3f')]();_0x59073d['applications']=_0x3f5d4f['Applications'];_0x59073d[_0x908d('0x40')]=_0x3f5d4f[_0x908d('0x3c')];_0x59073d[_0x908d('0x41')]=_[_0x908d('0x42')](_0x59073d[_0x908d('0x41')],[_0x908d('0x43')],[_0x908d('0x44')]);if(_0x59073d[_0x908d('0x36')]&&_0x59073d[_0x908d('0x36')][_0x908d('0x45')]){_0x59073d['applications'][_0x908d('0x46')]({'id':0x0,'priority':_0x59073d[_0x908d('0x41')]['length']+0x1,'app':'close','appdata':_0x908d('0x45'),'interval':'*,*,*,*'});}if(_0x59073d[_0x908d('0x36')][_0x908d('0x47')]){delete _0x59073d['account']['Applications'];}if(_0x59073d[_0x908d('0x36')][_0x908d('0x3c')]){delete _0x59073d['account'][_0x908d('0x3c')];}if(_0x3f5d4f[_0x908d('0x3c')][_0x908d('0x38')][_0x908d('0x48')]){return _0x3f5d4f[_0x908d('0x3c')][_0x908d('0x38')][0x0];}var _0x3dca56=_[_0x908d('0x9')](_0x53ca81[_0x908d('0x27')],{'firstName':_0x53ca81[_0x908d('0x27')][_0x908d('0x35')],'ListId':_0x3f5d4f[_0x908d('0x49')]});_0x3dca56[_0x53ca81['body']['mapKey']]=_0x53ca81[_0x908d('0x27')]['from'];return db[_0x908d('0x37')][_0x908d('0x4a')](_0x3dca56);}else{throw new Error(_0x908d('0x4b'));}})[_0x908d('0xe')](function(_0x3e959b){_0x59073d[_0x908d('0x4c')]=_0x3e959b;if(_0x3e959b){if(!_0x53ca81[_0x908d('0x27')][_0x908d('0x15')][_0x908d('0x4d')]){_0x53ca81[_0x908d('0x27')]['message'][_0x908d('0x4d')]=rs[_0x908d('0x4e')]()+'\x20'+_0x53ca81[_0x908d('0x27')][_0x908d('0x15')][_0x908d('0x35')];}var _0x31de32={'ContactId':_0x3e959b['id'],'MailAccountId':_0x53ca81['account']['id'],'inReplyTo':_0x53ca81[_0x908d('0x27')]['message'][_0x908d('0x4d')],'to':_0x53ca81[_0x908d('0x27')][_0x908d('0x15')][_0x908d('0x35')],'cc':_0x53ca81[_0x908d('0x27')][_0x908d('0x15')]['cc'],'subject':_0x53ca81['body'][_0x908d('0x15')][_0x908d('0x4f')],'attach':_0x53ca81[_0x908d('0x27')][_0x908d('0x15')][_0x908d('0x50')],'lastMsgAt':moment()[_0x908d('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x908d('0x52')][_0x908d('0x22')]({'where':{'closed':![],'MailAccountId':_0x53ca81[_0x908d('0x36')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x53ca81['body'][_0x908d('0x15')][_0x908d('0x53')]}}]})[_0x908d('0xe')](function(_0x57e708){if(_0x57e708){return[_0x57e708,![]];}return db[_0x908d('0x52')][_0x908d('0x4a')](_0x31de32)[_0x908d('0xe')](function(_0xa9b13a){return[_0xa9b13a,!![]];});});}else{throw new Error(_0x908d('0x54'));}})[_0x908d('0x55')](function(_0x488bf8,_0x2ed087){if(_0x488bf8){_0x1b1329=_0x2ed087;if(!_0x2ed087){return _0x488bf8[_0x908d('0x56')]({'inReplyTo':_0x53ca81[_0x908d('0x27')][_0x908d('0x15')][_0x908d('0x4d')],'to':_0x53ca81[_0x908d('0x27')][_0x908d('0x15')][_0x908d('0x35')],'cc':_0x53ca81['body'][_0x908d('0x15')]['cc'],'subject':_0x53ca81[_0x908d('0x27')][_0x908d('0x15')][_0x908d('0x4f')],'attach':_0x488bf8[_0x908d('0x50')]?_0x488bf8[_0x908d('0x50')]:_0x53ca81[_0x908d('0x27')][_0x908d('0x15')][_0x908d('0x50')],'substatus':null,'substatusAt':moment()['format'](_0x908d('0x57')),'lastMsgAt':moment()[_0x908d('0x51')](_0x908d('0x57')),'lastMsgDirection':'in'});}else{return _0x488bf8;}}})['then'](function(_0xf8f571){_0x59073d[_0x908d('0x58')]=_0xf8f571['get']({'plain':!![]});_0x59073d[_0x908d('0x58')]['created']=_0x1b1329;return db['MailMessage'][_0x908d('0x4a')]({'body':_0x53ca81[_0x908d('0x27')]['body'],'MailAccountId':_0x53ca81[_0x908d('0x36')]['id'],'MailInteractionId':_0xf8f571['id'],'direction':'in','ContactId':_0x59073d[_0x908d('0x4c')]['id'],'messageId':_0x53ca81[_0x908d('0x27')][_0x908d('0x15')][_0x908d('0x4d')],'from':_0x53ca81[_0x908d('0x27')][_0x908d('0x15')][_0x908d('0x35')],'to':_0x53ca81[_0x908d('0x27')][_0x908d('0x15')]['to'],'cc':_0x53ca81[_0x908d('0x27')][_0x908d('0x15')]['cc'],'subject':_0x53ca81[_0x908d('0x27')][_0x908d('0x15')][_0x908d('0x4f')],'attach':_0x53ca81[_0x908d('0x27')]['message'][_0x908d('0x50')],'Attachments':_0x53ca81['body'][_0x908d('0x15')]['attachments'],'originTo':_0x53ca81[_0x908d('0x27')][_0x908d('0x15')]['originTo'],'originCc':_0x53ca81[_0x908d('0x27')]['message'][_0x908d('0x59')],'bcc':_0x53ca81[_0x908d('0x27')][_0x908d('0x15')]['bcc'],'ChatWebsiteId':_0x53ca81['body'][_0x908d('0x15')][_0x908d('0x5a')]||null,'originChannel':_0x53ca81[_0x908d('0x27')][_0x908d('0x15')][_0x908d('0x5b')]||_0x908d('0x5c'),'ChatOfflineMessageId':_0x53ca81[_0x908d('0x27')]['message'][_0x908d('0x5d')]||null},{'include':[{'model':db[_0x908d('0x5e')],'as':_0x908d('0x5f')}]});})[_0x908d('0xe')](function(_0x67ced6){_0x59073d[_0x908d('0x15')]=_0x67ced6;if(!_0x59073d['interaction'][_0x908d('0x60')]){return;}return db[_0x908d('0x61')][_0x908d('0x22')]({'attributes':['id','name'],'where':{'id':_0x59073d[_0x908d('0x58')][_0x908d('0x60')]}});})[_0x908d('0xe')](function(_0x32fc44){if(_0x32fc44){_0x59073d['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x908d('0x62'),'appdata':_0x32fc44['name']+','+(_0x59073d[_0x908d('0x36')]['waitForTheAssignedAgent']||0xa),'interval':_0x908d('0x63')});}if(!_0x59073d[_0x908d('0x58')][_0x908d('0x64')]){return;}return db[_0x908d('0x65')][_0x908d('0x22')]({'attributes':['id',_0x908d('0x66')],'where':{'id':_0x59073d[_0x908d('0x58')][_0x908d('0x64')]}});})[_0x908d('0xe')](function(_0x49b490){if(_0x49b490){_0x59073d[_0x908d('0x41')][_0x908d('0x67')]({'id':0x0,'priority':0x1,'app':_0x908d('0x68'),'appdata':_0x49b490[_0x908d('0x66')]+','+(_0x59073d[_0x908d('0x36')][_0x908d('0x69')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x59073d);})[_0x908d('0xe')](function(_0x5e6a28){_0x1c14fb(_0x5e6a28);})[_0x908d('0x16')](function(_0x5cb18f){_0x136115(_0x48bf10[_0x908d('0x13')](0x1f4,_0x5cb18f['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 916933a..d61ab6e 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 _0xf8e9=['./mailAccount.events','save','remove','update','removeListener','register','length','mailAccount:'];(function(_0x9f8535,_0x45506c){var _0x183460=function(_0x5045a3){while(--_0x5045a3){_0x9f8535['push'](_0x9f8535['shift']());}};_0x183460(++_0x45506c);}(_0xf8e9,0x120));var _0x9f8e=function(_0x3d66f5,_0x29b765){_0x3d66f5=_0x3d66f5-0x0;var _0x1db86c=_0xf8e9[_0x3d66f5];return _0x1db86c;};'use strict';var MailAccountEvents=require(_0x9f8e('0x0'));var events=[_0x9f8e('0x1'),_0x9f8e('0x2'),_0x9f8e('0x3')];function createListener(_0x3ffb8e,_0x73dda4){return function(_0x700bcb){_0x73dda4['emit'](_0x3ffb8e,_0x700bcb);};}function removeListener(_0x11af92,_0x29acff){return function(){MailAccountEvents[_0x9f8e('0x4')](_0x11af92,_0x29acff);};}exports[_0x9f8e('0x5')]=function(_0x2a4e51){for(var _0x32e8b4=0x0,_0x237404=events[_0x9f8e('0x6')];_0x32e8b4<_0x237404;_0x32e8b4++){var _0x2ca672=events[_0x32e8b4];var _0x546f81=createListener(_0x9f8e('0x7')+_0x2ca672,_0x2a4e51);MailAccountEvents['on'](_0x2ca672,_0x546f81);}}; \ No newline at end of file +var _0x674e=['update','emit','removeListener','register','save'];(function(_0x901578,_0x2e4d8f){var _0x19a03c=function(_0x5683a9){while(--_0x5683a9){_0x901578['push'](_0x901578['shift']());}};_0x19a03c(++_0x2e4d8f);}(_0x674e,0x1f3));var _0xe674=function(_0x3b9c9d,_0x18bd7d){_0x3b9c9d=_0x3b9c9d-0x0;var _0xa3f221=_0x674e[_0x3b9c9d];return _0xa3f221;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xe674('0x0'),'remove',_0xe674('0x1')];function createListener(_0x1207b7,_0x4f1bc3){return function(_0x44b73f){_0x4f1bc3[_0xe674('0x2')](_0x1207b7,_0x44b73f);};}function removeListener(_0x36fcef,_0x130e95){return function(){MailAccountEvents[_0xe674('0x3')](_0x36fcef,_0x130e95);};}exports[_0xe674('0x4')]=function(_0x165455){for(var _0x19a210=0x0,_0x3c57a6=events['length'];_0x19a210<_0x3c57a6;_0x19a210++){var _0x1d54c6=events[_0x19a210];var _0x2097f6=createListener('mailAccount:'+_0x1d54c6,_0x165455);MailAccountEvents['on'](_0x1d54c6,_0x2097f6);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index dbbbf82..baf89df 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 _0x663f=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0x663f,0x89));var _0xf663=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0x663f[_0x1a595a];return _0x33f008;};'use strict';var multer=require(_0xf663('0x0'));var util=require(_0xf663('0x1'));var path=require(_0xf663('0x2'));var timeout=require(_0xf663('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf663('0x4'));var auth=require(_0xf663('0x5'));var interaction=require(_0xf663('0x6'));var config=require('../../config/environment');var controller=require(_0xf663('0x7'));router[_0xf663('0x8')](_0xf663('0x9'),auth[_0xf663('0xa')](),controller[_0xf663('0xb')]);router[_0xf663('0xc')]('/:id',auth[_0xf663('0xa')](),controller[_0xf663('0xd')]);router[_0xf663('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf663('0xf')]);module[_0xf663('0x10')]=router; \ No newline at end of file +var _0x21d3=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','show','/:id','isAuthenticated'];(function(_0x1f0116,_0x1a6b65){var _0x4658aa=function(_0x42a3f2){while(--_0x42a3f2){_0x1f0116['push'](_0x1f0116['shift']());}};_0x4658aa(++_0x1a6b65);}(_0x21d3,0x1a8));var _0x321d=function(_0x5b4529,_0x45849f){_0x5b4529=_0x5b4529-0x0;var _0x5f36fc=_0x21d3[_0x5b4529];return _0x5f36fc;};'use strict';var multer=require(_0x321d('0x0'));var util=require('util');var path=require(_0x321d('0x1'));var timeout=require(_0x321d('0x2'));var express=require('express');var router=express[_0x321d('0x3')]();var fs_extra=require(_0x321d('0x4'));var auth=require(_0x321d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x321d('0x6'));var controller=require('./mailApplication.controller');router[_0x321d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x321d('0x8')]);router['put'](_0x321d('0x9'),auth[_0x321d('0xa')](),controller[_0x321d('0xb')]);router[_0x321d('0xc')](_0x321d('0x9'),auth['isAuthenticated'](),controller[_0x321d('0xd')]);module[_0x321d('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 a5f7c09..64abbbe 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 _0xcaff=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x203b14,_0x441946){var _0x243751=function(_0x5dd777){while(--_0x5dd777){_0x203b14['push'](_0x203b14['shift']());}};_0x243751(++_0x441946);}(_0xcaff,0x96));var _0xfcaf=function(_0x19ad63,_0x5a3387){_0x19ad63=_0x19ad63-0x0;var _0x1d9d86=_0xcaff[_0x19ad63];return _0x1d9d86;};'use strict';var Sequelize=require(_0xfcaf('0x0'));module[_0xfcaf('0x1')]={'priority':{'type':Sequelize[_0xfcaf('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xfcaf('0x3')],'allowNull':![],'defaultValue':_0xfcaf('0x4')},'appdata':{'type':Sequelize[_0xfcaf('0x5')]()},'description':{'type':Sequelize[_0xfcaf('0x3')]},'interval':{'type':Sequelize[_0xfcaf('0x3')],'defaultValue':_0xfcaf('0x6')}}; \ No newline at end of file +var _0xaac0=['STRING','noop','TEXT','sequelize','exports'];(function(_0x3f3ee3,_0x4a7652){var _0x3a0c2b=function(_0x3879ed){while(--_0x3879ed){_0x3f3ee3['push'](_0x3f3ee3['shift']());}};_0x3a0c2b(++_0x4a7652);}(_0xaac0,0x10c));var _0x0aac=function(_0x3a4c07,_0x18440c){_0x3a4c07=_0x3a4c07-0x0;var _0x5a4943=_0xaac0[_0x3a4c07];return _0x5a4943;};'use strict';var Sequelize=require(_0x0aac('0x0'));module[_0x0aac('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0aac('0x2')],'allowNull':![],'defaultValue':_0x0aac('0x3')},'appdata':{'type':Sequelize[_0x0aac('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0aac('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 360d43a..6024097 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 _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x23b3d1,_0x1ee128){var _0xd2c70=function(_0x329cf9){while(--_0x329cf9){_0x23b3d1['push'](_0x23b3d1['shift']());}};_0xd2c70(++_0x1ee128);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5cc615,_0x45656c){_0x5cc615=_0x5cc615-0x0;var _0x78fd8b=_0xf4eb[_0x5cc615];return _0x78fd8b;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file +var _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x57a790,_0x28fa17){var _0x451587=function(_0x142a5d){while(--_0x142a5d){_0x57a790['push'](_0x57a790['shift']());}};_0x451587(++_0x28fa17);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index f868780..22cd269 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 _0x7036=['MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2aa3c9,_0x2d6064){var _0x13d13d=function(_0x4de5bc){while(--_0x4de5bc){_0x2aa3c9['push'](_0x2aa3c9['shift']());}};_0x13d13d(++_0x2d6064);}(_0x7036,0x19a));var _0x6703=function(_0x40b13e,_0x2837ab){_0x40b13e=_0x40b13e-0x0;var _0x3a949a=_0x7036[_0x40b13e];return _0x3a949a;};'use strict';var _=require(_0x6703('0x0'));var util=require(_0x6703('0x1'));var logger=require(_0x6703('0x2'))(_0x6703('0x3'));var moment=require('moment');var BPromise=require(_0x6703('0x4'));var rp=require(_0x6703('0x5'));var fs=require('fs');var path=require(_0x6703('0x6'));var rimraf=require(_0x6703('0x7'));var config=require(_0x6703('0x8'));var attributes=require('./mailApplication.attributes');module[_0x6703('0x9')]=function(_0x1f3c2f,_0x3653f2){return _0x1f3c2f['define'](_0x6703('0xa'),attributes,{'tableName':_0x6703('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6703('0xc'),'collate':_0x6703('0xd')});}; \ No newline at end of file +var _0x8e00=['moment','bluebird','request-promise','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','lodash','../../config/logger','api'];(function(_0x3697db,_0x384cb8){var _0x38886b=function(_0x363be7){while(--_0x363be7){_0x3697db['push'](_0x3697db['shift']());}};_0x38886b(++_0x384cb8);}(_0x8e00,0x99));var _0x08e0=function(_0x5bee95,_0xdf323a){_0x5bee95=_0x5bee95-0x0;var _0x2b62d2=_0x8e00[_0x5bee95];return _0x2b62d2;};'use strict';var _=require(_0x08e0('0x0'));var util=require('util');var logger=require(_0x08e0('0x1'))(_0x08e0('0x2'));var moment=require(_0x08e0('0x3'));var BPromise=require(_0x08e0('0x4'));var rp=require(_0x08e0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x08e0('0x6'));var attributes=require(_0x08e0('0x7'));module[_0x08e0('0x8')]=function(_0x5d66b9,_0x2b32dc){return _0x5d66b9[_0x08e0('0x9')](_0x08e0('0xa'),attributes,{'tableName':_0x08e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 9e5a911..dee1601 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 _0x089b=['body','options','raw','attributes','limit','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateMailApplication','MailApplication','update'];(function(_0x5012b6,_0x510fe6){var _0x3514d2=function(_0x5ef76c){while(--_0x5ef76c){_0x5012b6['push'](_0x5012b6['shift']());}};_0x3514d2(++_0x510fe6);}(_0x089b,0x192));var _0xb089=function(_0x189492,_0x123c81){_0x189492=_0x189492-0x0;var _0x54348a=_0x089b[_0x189492];return _0x54348a;};'use strict';var _=require(_0xb089('0x0'));var util=require(_0xb089('0x1'));var moment=require('moment');var BPromise=require(_0xb089('0x2'));var rs=require(_0xb089('0x3'));var fs=require('fs');var Redis=require(_0xb089('0x4'));var db=require(_0xb089('0x5'))['db'];var utils=require(_0xb089('0x6'));var logger=require(_0xb089('0x7'))(_0xb089('0x8'));var config=require('../../config/environment');var jayson=require(_0xb089('0x9'));var client=jayson[_0xb089('0xa')][_0xb089('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x200c49,_0x4dccc1,_0x20d2a6){return new BPromise(function(_0xa4184e,_0x15109f){return client[_0xb089('0xc')](_0x200c49,_0x20d2a6)[_0xb089('0xd')](function(_0x5a8a31){logger[_0xb089('0xe')](_0xb089('0xf'),_0x4dccc1,'request\x20sent');logger[_0xb089('0x10')](_0xb089('0x11'),_0x4dccc1,_0xb089('0x12'),JSON['stringify'](_0x5a8a31));if(_0x5a8a31[_0xb089('0x13')]){if(_0x5a8a31[_0xb089('0x13')][_0xb089('0x14')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x4dccc1,_0x5a8a31[_0xb089('0x13')][_0xb089('0x15')]);return _0x15109f(_0x5a8a31['error'][_0xb089('0x15')]);}logger[_0xb089('0x13')](_0xb089('0xf'),_0x4dccc1,_0x5a8a31[_0xb089('0x13')][_0xb089('0x15')]);return _0xa4184e(_0x5a8a31['error'][_0xb089('0x15')]);}else{logger[_0xb089('0xe')](_0xb089('0xf'),_0x4dccc1,'request\x20sent');_0xa4184e(_0x5a8a31[_0xb089('0x16')][_0xb089('0x15')]);}})[_0xb089('0x17')](function(_0x3ef895){logger[_0xb089('0x13')]('MailApplication,\x20%s,\x20%s',_0x4dccc1,_0x3ef895);_0x15109f(_0x3ef895);});});}exports[_0xb089('0x18')]=function(_0x2d2728){var _0x919775=this;return new Promise(function(_0x6a90af,_0x13786c){return db[_0xb089('0x19')][_0xb089('0x1a')](_0x2d2728[_0xb089('0x1b')],{'raw':_0x2d2728[_0xb089('0x1c')]?_0x2d2728[_0xb089('0x1c')][_0xb089('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d2728[_0xb089('0x1c')]?_0x2d2728['options']['where']||null:null,'attributes':_0x2d2728[_0xb089('0x1c')]?_0x2d2728['options'][_0xb089('0x1e')]||null:null,'limit':_0x2d2728['options']?_0x2d2728[_0xb089('0x1c')][_0xb089('0x1f')]||null:null})[_0xb089('0xd')](function(_0x15040e){logger['info'](_0xb089('0x18'),_0x2d2728);logger[_0xb089('0x10')](_0xb089('0x18'),_0x2d2728,JSON[_0xb089('0x20')](_0x15040e));_0x6a90af(_0x15040e);})[_0xb089('0x17')](function(_0x29b3d5){logger[_0xb089('0x13')]('UpdateMailApplication',_0x29b3d5[_0xb089('0x15')],_0x2d2728);_0x13786c(_0x919775[_0xb089('0x13')](0x1f4,_0x29b3d5[_0xb089('0x15')]));});});}; \ No newline at end of file +var _0x38d6=['MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailApplication,\x20%s,\x20%s','result','catch','MailApplication','update','body','raw','options','attributes','limit','info','UpdateMailApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug'];(function(_0x2ef5d4,_0x153023){var _0x33e21c=function(_0x3d89f7){while(--_0x3d89f7){_0x2ef5d4['push'](_0x2ef5d4['shift']());}};_0x33e21c(++_0x153023);}(_0x38d6,0x143));var _0x638d=function(_0x195c21,_0x332612){_0x195c21=_0x195c21-0x0;var _0x3576a8=_0x38d6[_0x195c21];return _0x3576a8;};'use strict';var _=require(_0x638d('0x0'));var util=require(_0x638d('0x1'));var moment=require(_0x638d('0x2'));var BPromise=require(_0x638d('0x3'));var rs=require(_0x638d('0x4'));var fs=require('fs');var Redis=require(_0x638d('0x5'));var db=require(_0x638d('0x6'))['db'];var utils=require(_0x638d('0x7'));var logger=require(_0x638d('0x8'))(_0x638d('0x9'));var config=require(_0x638d('0xa'));var jayson=require(_0x638d('0xb'));var client=jayson['client'][_0x638d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8924db,_0xdcfebd,_0x23e95d){return new BPromise(function(_0x32ef75,_0x3f9694){return client[_0x638d('0xd')](_0x8924db,_0x23e95d)[_0x638d('0xe')](function(_0x3ce221){logger['info']('MailApplication,\x20%s,\x20%s',_0xdcfebd,_0x638d('0xf'));logger[_0x638d('0x10')](_0x638d('0x11'),_0xdcfebd,'request\x20sent',JSON[_0x638d('0x12')](_0x3ce221));if(_0x3ce221[_0x638d('0x13')]){if(_0x3ce221[_0x638d('0x13')][_0x638d('0x14')]===0x1f4){logger[_0x638d('0x13')]('MailApplication,\x20%s,\x20%s',_0xdcfebd,_0x3ce221[_0x638d('0x13')][_0x638d('0x15')]);return _0x3f9694(_0x3ce221[_0x638d('0x13')]['message']);}logger[_0x638d('0x13')](_0x638d('0x16'),_0xdcfebd,_0x3ce221[_0x638d('0x13')][_0x638d('0x15')]);return _0x32ef75(_0x3ce221[_0x638d('0x13')][_0x638d('0x15')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0xdcfebd,_0x638d('0xf'));_0x32ef75(_0x3ce221[_0x638d('0x17')]['message']);}})[_0x638d('0x18')](function(_0x568110){logger['error'](_0x638d('0x16'),_0xdcfebd,_0x568110);_0x3f9694(_0x568110);});});}exports['UpdateMailApplication']=function(_0x36ac0f){var _0x61f80d=this;return new Promise(function(_0x10bfb0,_0x538f2a){return db[_0x638d('0x19')][_0x638d('0x1a')](_0x36ac0f[_0x638d('0x1b')],{'raw':_0x36ac0f['options']?_0x36ac0f['options'][_0x638d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36ac0f[_0x638d('0x1d')]?_0x36ac0f[_0x638d('0x1d')]['where']||null:null,'attributes':_0x36ac0f[_0x638d('0x1d')]?_0x36ac0f[_0x638d('0x1d')][_0x638d('0x1e')]||null:null,'limit':_0x36ac0f['options']?_0x36ac0f['options'][_0x638d('0x1f')]||null:null})[_0x638d('0xe')](function(_0x24d827){logger[_0x638d('0x20')](_0x638d('0x21'),_0x36ac0f);logger['debug'](_0x638d('0x21'),_0x36ac0f,JSON[_0x638d('0x12')](_0x24d827));_0x10bfb0(_0x24d827);})['catch'](function(_0x179e97){logger[_0x638d('0x13')]('UpdateMailApplication',_0x179e97[_0x638d('0x15')],_0x36ac0f);_0x538f2a(_0x61f80d[_0x638d('0x13')](0x1f4,_0x179e97[_0x638d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index c0393cb..1f222c6 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 _0xf2ab=['create','/:id/messages','addMessage','/:id/tags','tracked','mail','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','getMessages','/:id/download','download','post'];(function(_0x3cc43f,_0x3e0f45){var _0x1bc7ca=function(_0x4674d6){while(--_0x4674d6){_0x3cc43f['push'](_0x3cc43f['shift']());}};_0x1bc7ca(++_0x3e0f45);}(_0xf2ab,0xee));var _0xbf2a=function(_0x15024b,_0x5b63fe){_0x15024b=_0x15024b-0x0;var _0x5271da=_0xf2ab[_0x15024b];return _0x5271da;};'use strict';var express=require('express');var router=express[_0xbf2a('0x0')]();var auth=require(_0xbf2a('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0xbf2a('0x2'));router[_0xbf2a('0x3')]('/',auth[_0xbf2a('0x4')](),controller[_0xbf2a('0x5')]);router[_0xbf2a('0x3')](_0xbf2a('0x6'),auth[_0xbf2a('0x4')](),controller[_0xbf2a('0x7')]);router[_0xbf2a('0x3')]('/:id',auth[_0xbf2a('0x4')](),controller['show']);router[_0xbf2a('0x3')]('/:id/messages',auth[_0xbf2a('0x4')](),controller[_0xbf2a('0x8')]);router[_0xbf2a('0x3')](_0xbf2a('0x9'),auth[_0xbf2a('0x4')](),controller[_0xbf2a('0xa')]);router[_0xbf2a('0xb')]('/',auth['isAuthenticated'](),controller[_0xbf2a('0xc')]);router[_0xbf2a('0xb')](_0xbf2a('0xd'),auth['isAuthenticated'](),controller[_0xbf2a('0xe')]);router[_0xbf2a('0xb')](_0xbf2a('0xf'),auth[_0xbf2a('0x4')](),interaction[_0xbf2a('0x10')](_0xbf2a('0x11'),'mailinteraction:addtags'),controller['addTags']);router[_0xbf2a('0x12')](_0xbf2a('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0xbf2a('0x11'),_0xbf2a('0x14')),controller[_0xbf2a('0x15')]);router[_0xbf2a('0x16')]('/:id',auth[_0xbf2a('0x4')](),interaction[_0xbf2a('0x10')](_0xbf2a('0x11'),_0xbf2a('0x17')),controller[_0xbf2a('0x18')]);router[_0xbf2a('0x16')]('/:id/tags',auth[_0xbf2a('0x4')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xa946=['mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','/:id/messages','getMessages','/:id/download','download','post','/:id/tags','tracked','mailinteraction:addtags','put','/:id','mail','mailinteraction:update','update','delete'];(function(_0x10e983,_0x2f4eda){var _0x324138=function(_0x17a377){while(--_0x17a377){_0x10e983['push'](_0x10e983['shift']());}};_0x324138(++_0x2f4eda);}(_0xa946,0x17e));var _0x6a94=function(_0x5786f9,_0x59a148){_0x5786f9=_0x5786f9-0x0;var _0x22c3cf=_0xa946[_0x5786f9];return _0x22c3cf;};'use strict';var express=require(_0x6a94('0x0'));var router=express[_0x6a94('0x1')]();var auth=require(_0x6a94('0x2'));var interaction=require(_0x6a94('0x3'));var controller=require(_0x6a94('0x4'));router[_0x6a94('0x5')]('/',auth[_0x6a94('0x6')](),controller[_0x6a94('0x7')]);router[_0x6a94('0x5')](_0x6a94('0x8'),auth[_0x6a94('0x6')](),controller['describe']);router['get']('/:id',auth[_0x6a94('0x6')](),controller['show']);router[_0x6a94('0x5')](_0x6a94('0x9'),auth[_0x6a94('0x6')](),controller[_0x6a94('0xa')]);router[_0x6a94('0x5')](_0x6a94('0xb'),auth[_0x6a94('0x6')](),controller[_0x6a94('0xc')]);router[_0x6a94('0xd')]('/',auth[_0x6a94('0x6')](),controller['create']);router[_0x6a94('0xd')](_0x6a94('0x9'),auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x6a94('0xe'),auth['isAuthenticated'](),interaction[_0x6a94('0xf')]('mail',_0x6a94('0x10')),controller['addTags']);router[_0x6a94('0x11')](_0x6a94('0x12'),auth['isAuthenticated'](),interaction[_0x6a94('0xf')](_0x6a94('0x13'),_0x6a94('0x14')),controller[_0x6a94('0x15')]);router[_0x6a94('0x16')](_0x6a94('0x12'),auth['isAuthenticated'](),interaction[_0x6a94('0xf')](_0x6a94('0x13'),_0x6a94('0x17')),controller[_0x6a94('0x18')]);router[_0x6a94('0x16')]('/:id/tags',auth[_0x6a94('0x6')](),controller[_0x6a94('0x19')]);module[_0x6a94('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 73241d1..d9dd90d 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 _0xf3e1=['long','ENUM','out','INTEGER','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0x4a29a2,_0xca8689){var _0x260f19=function(_0x351e3e){while(--_0x351e3e){_0x4a29a2['push'](_0x4a29a2['shift']());}};_0x260f19(++_0xca8689);}(_0xf3e1,0x14e));var _0x1f3e=function(_0x9b4cda,_0x206ec1){_0x9b4cda=_0x9b4cda-0x0;var _0x1ac6c5=_0xf3e1[_0x9b4cda];return _0x1ac6c5;};'use strict';var Sequelize=require(_0x1f3e('0x0'));var iconv=require(_0x1f3e('0x1'));module[_0x1f3e('0x2')]={'closed':{'type':Sequelize[_0x1f3e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1f3e('0x4')]},'disposition':{'type':Sequelize[_0x1f3e('0x5')]},'secondDisposition':{'type':Sequelize[_0x1f3e('0x5')]},'thirdDisposition':{'type':Sequelize[_0x1f3e('0x5')]},'note':{'type':Sequelize[_0x1f3e('0x5')]},'inReplyTo':{'type':Sequelize[_0x1f3e('0x5')](0x1fe)},'to':{'type':Sequelize[_0x1f3e('0x5')]},'cc':{'type':Sequelize[_0x1f3e('0x6')](_0x1f3e('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x1f3e('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x1f3e('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1f3e('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1f3e('0x8')]('in',_0x1f3e('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1f3e('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x1f3e('0xa')]}}; \ No newline at end of file +var _0x26d0=['out','sequelize','iconv','DATE','STRING','TEXT','long','BOOLEAN','ENUM'];(function(_0x66f7eb,_0x42d755){var _0xd657fc=function(_0x31ce32){while(--_0x31ce32){_0x66f7eb['push'](_0x66f7eb['shift']());}};_0xd657fc(++_0x42d755);}(_0x26d0,0x1a8));var _0x026d=function(_0x5e9ff3,_0x513f9d){_0x5e9ff3=_0x5e9ff3-0x0;var _0x1f4f3a=_0x26d0[_0x5e9ff3];return _0x1f4f3a;};'use strict';var Sequelize=require(_0x026d('0x0'));var iconv=require(_0x026d('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x026d('0x2')]},'disposition':{'type':Sequelize[_0x026d('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x026d('0x3')]},'note':{'type':Sequelize[_0x026d('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x026d('0x3')]},'cc':{'type':Sequelize[_0x026d('0x4')](_0x026d('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x026d('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x026d('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x026d('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x026d('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x026d('0x7')]('in',_0x026d('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x026d('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 45cc9fc..4e2fc22 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 _0xb05f=['json','offset','undefined','limit','count','set','update','destroy','then','end','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','getOptions','findAll','mail','query','user','params','model','keys','attributes','intersection','fields','length','find','catch','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','inlineCss','rows','addTags','setTags','spread','Tag','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','files','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','from','bcc','subject','Messages','mkdirSync','each','missing.recipient@your.company.com','decode','headers','existsSync','type','readFileSync','build','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','juice','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','./mailInteraction.socket','register','sendStatus','status'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xb05f,0x137));var _0xfb05=function(_0x54d0fd,_0x20a4d8){_0x54d0fd=_0x54d0fd-0x0;var _0x49318c=_0xb05f[_0x54d0fd];return _0x49318c;};'use strict';var emlformat=require(_0xfb05('0x0'));var rimraf=require(_0xfb05('0x1'));var zipdir=require(_0xfb05('0x2'));var moment=require(_0xfb05('0x3'));var BPromise=require(_0xfb05('0x4'));var util=require(_0xfb05('0x5'));var path=require('path');var fs=require('fs');var _=require('lodash');var juice=require(_0xfb05('0x6'));var Redis=require(_0xfb05('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0xfb05('0x8'))(_0xfb05('0x9'));var config=require(_0xfb05('0xa'));var db=require(_0xfb05('0xb'))['db'];var htmlEntities=require(_0xfb05('0xc'));config[_0xfb05('0xd')]=_[_0xfb05('0xe')](config[_0xfb05('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb05('0xd')]));require(_0xfb05('0xf'))[_0xfb05('0x10')](socket);function respondWithStatusCode(_0x2963a4,_0x39e43d){_0x39e43d=_0x39e43d||0xcc;return function(_0x2ffde1){if(_0x2ffde1){return _0x2963a4[_0xfb05('0x11')](_0x39e43d);}return _0x2963a4[_0xfb05('0x12')](_0x39e43d)['end']();};}function respondWithResult(_0x1889f3,_0x30f7dc){_0x30f7dc=_0x30f7dc||0xc8;return function(_0xe124f){if(_0xe124f){return _0x1889f3[_0xfb05('0x12')](_0x30f7dc)[_0xfb05('0x13')](_0xe124f);}};}function respondWithFilteredResult(_0x477dc2,_0x370f36){return function(_0x2004ac){if(_0x2004ac){var _0x39b3e9=typeof _0x370f36[_0xfb05('0x14')]===_0xfb05('0x15')&&typeof _0x370f36[_0xfb05('0x16')]===_0xfb05('0x15');var _0x208241=_0x2004ac[_0xfb05('0x17')];var _0x5f0904=_0x39b3e9?0x0:_0x370f36[_0xfb05('0x14')];var _0x535451=_0x39b3e9?_0x2004ac[_0xfb05('0x17')]:_0x370f36[_0xfb05('0x14')]+_0x370f36['limit'];var _0x554e56;if(_0x535451>=_0x208241){_0x535451=_0x208241;_0x554e56=0xc8;}else{_0x554e56=0xce;}_0x477dc2[_0xfb05('0x12')](_0x554e56);return _0x477dc2[_0xfb05('0x18')]('Content-Range',_0x5f0904+'-'+_0x535451+'/'+_0x208241)[_0xfb05('0x13')](_0x2004ac);}return null;};}function saveUpdates(_0x3a5312){return function(_0x11d855){if(_0x11d855){return _0x11d855[_0xfb05('0x19')](_0x3a5312)['then'](function(_0x2badb7){return _0x2badb7;});}return null;};}function removeEntity(_0xe650cf){return function(_0x513109){if(_0x513109){return _0x513109[_0xfb05('0x1a')]()[_0xfb05('0x1b')](function(){_0xe650cf[_0xfb05('0x12')](0xcc)[_0xfb05('0x1c')]();});}};}function handleEntityNotFound(_0x34ec80){return function(_0x2dea89){if(!_0x2dea89){_0x34ec80[_0xfb05('0x11')](0x194);}return _0x2dea89;};}function handleError(_0x317768,_0x42b5ff){_0x42b5ff=_0x42b5ff||0x1f4;return function(_0x229ff6){logger['error'](_0x229ff6[_0xfb05('0x1d')]);if(_0x229ff6['name']){delete _0x229ff6[_0xfb05('0x1e')];}_0x317768[_0xfb05('0x12')](_0x42b5ff)[_0xfb05('0x1f')](_0x229ff6);};}exports[_0xfb05('0x20')]=function(_0x465997,_0x558cf1){var _0x13d68b={};var _0x248e40=_[_0xfb05('0x21')](db[_0xfb05('0x22')][_0xfb05('0x23')],function(_0x9320b1){return{'name':_0x9320b1[_0xfb05('0x24')],'type':_0x9320b1['type']['key']};});_0x13d68b=qs[_0xfb05('0x25')](_0x248e40,_0x465997);return interaction[_0xfb05('0x26')](_0xfb05('0x27'),_0x465997[_0xfb05('0x28')],_0x465997[_0xfb05('0x29')],_0x13d68b,_0x248e40)[_0xfb05('0x1b')](respondWithFilteredResult(_0x558cf1,_0x13d68b))['catch'](handleError(_0x558cf1,null));};exports['show']=function(_0x5f1173,_0x2bc1aa){var _0x1d63ca={'raw':![],'where':{'id':_0x5f1173[_0xfb05('0x2a')]['id']}},_0x36aec6={};_0x36aec6[_0xfb05('0x2b')]=_['keys'](db[_0xfb05('0x22')][_0xfb05('0x23')]);_0x36aec6['query']=_[_0xfb05('0x2c')](_0x5f1173[_0xfb05('0x28')]);_0x36aec6['filters']=_['intersection'](_0x36aec6[_0xfb05('0x2b')],_0x36aec6['query']);_0x1d63ca[_0xfb05('0x2d')]=_[_0xfb05('0x2e')](_0x36aec6[_0xfb05('0x2b')],qs['fields'](_0x5f1173[_0xfb05('0x28')][_0xfb05('0x2f')]));_0x1d63ca[_0xfb05('0x2d')]=_0x1d63ca['attributes'][_0xfb05('0x30')]?_0x1d63ca['attributes']:_0x36aec6[_0xfb05('0x2b')];if(_0x5f1173[_0xfb05('0x28')]['includeAll']){_0x1d63ca['include']=[{'all':!![]}];}_0x1d63ca=_['merge']({},_0x1d63ca,_0x5f1173['options']);return db[_0xfb05('0x22')][_0xfb05('0x31')](_0x1d63ca)[_0xfb05('0x1b')](handleEntityNotFound(_0x2bc1aa,null))[_0xfb05('0x1b')](respondWithResult(_0x2bc1aa,null))[_0xfb05('0x32')](handleError(_0x2bc1aa,null));};exports[_0xfb05('0x33')]=function(_0x29c8b7,_0x15b625){return db[_0xfb05('0x22')][_0xfb05('0x33')](_0x29c8b7[_0xfb05('0x34')],{})[_0xfb05('0x1b')](respondWithResult(_0x15b625,0xc9))['catch'](handleError(_0x15b625,null));};exports[_0xfb05('0x19')]=function(_0x5d6f86,_0x3b2898){if(_0x5d6f86[_0xfb05('0x34')]['id']){delete _0x5d6f86[_0xfb05('0x34')]['id'];}return db['MailInteraction'][_0xfb05('0x31')]({'where':{'id':_0x5d6f86[_0xfb05('0x2a')]['id']}})[_0xfb05('0x1b')](handleEntityNotFound(_0x3b2898,null))[_0xfb05('0x1b')](saveUpdates(_0x5d6f86[_0xfb05('0x34')],null))[_0xfb05('0x1b')](respondWithResult(_0x3b2898,null))['catch'](handleError(_0x3b2898,null));};exports['destroy']=function(_0x5abd86,_0x57517e){return db[_0xfb05('0x22')]['find']({'where':{'id':_0x5abd86['params']['id']}})[_0xfb05('0x1b')](handleEntityNotFound(_0x57517e,null))['then'](removeEntity(_0x57517e,null))['catch'](handleError(_0x57517e,null));};exports[_0xfb05('0x35')]=function(_0x591222,_0x29232d){return db[_0xfb05('0x22')][_0xfb05('0x35')]()['then'](respondWithResult(_0x29232d,null))[_0xfb05('0x32')](handleError(_0x29232d,null));};exports[_0xfb05('0x36')]=function(_0xeae671,_0x193cf4){return db[_0xfb05('0x37')]['find']({'where':{'id':_0xeae671[_0xfb05('0x2a')]['id']}})[_0xfb05('0x1b')](handleEntityNotFound(_0x193cf4,null))['then'](function(_0x26a413){if(_0x26a413){return _0x26a413[_0xfb05('0x36')](_0xeae671[_0xfb05('0x34')][_0xfb05('0x38')],_[_0xfb05('0x39')](_0xeae671[_0xfb05('0x34')],[_0xfb05('0x38'),'id'])||{});}})[_0xfb05('0x1b')](respondWithResult(_0x193cf4,null))[_0xfb05('0x32')](handleError(_0x193cf4,null));};exports[_0xfb05('0x3a')]=function(_0x1ac840,_0x4f2937){var _0x37726f={'raw':![],'where':{}};var _0x50e7f3={};var _0x4a4d3c={'count':0x0,'rows':[]};return db[_0xfb05('0x22')][_0xfb05('0x3b')]({'where':{'id':_0x1ac840[_0xfb05('0x2a')]['id']}})[_0xfb05('0x1b')](handleEntityNotFound(_0x4f2937,null))['then'](function(_0x1cf6db){if(_0x1cf6db){_0x50e7f3[_0xfb05('0x2b')]=_[_0xfb05('0x2c')](db['MailMessage']['rawAttributes']);_0x50e7f3['query']=_[_0xfb05('0x2c')](_0x1ac840[_0xfb05('0x28')]);_0x50e7f3['filters']=_[_0xfb05('0x2e')](_0x50e7f3[_0xfb05('0x2b')],_0x50e7f3[_0xfb05('0x28')]);_0x37726f[_0xfb05('0x2d')]=_[_0xfb05('0x2e')](_0x50e7f3[_0xfb05('0x2b')],qs['fields'](_0x1ac840[_0xfb05('0x28')][_0xfb05('0x2f')]));_0x37726f[_0xfb05('0x2d')]=_0x37726f[_0xfb05('0x2d')]['length']?_0x37726f[_0xfb05('0x2d')]:_0x50e7f3[_0xfb05('0x2b')];if(!_0x1ac840[_0xfb05('0x28')][_0xfb05('0x3c')](_0xfb05('0x3d'))){_0x37726f[_0xfb05('0x16')]=qs[_0xfb05('0x16')](_0x1ac840[_0xfb05('0x28')][_0xfb05('0x16')]);_0x37726f[_0xfb05('0x14')]=qs[_0xfb05('0x14')](_0x1ac840['query'][_0xfb05('0x14')]);}_0x37726f[_0xfb05('0x3e')]=qs[_0xfb05('0x3f')](_0x1ac840[_0xfb05('0x28')][_0xfb05('0x3f')]);_0x37726f[_0xfb05('0x40')]=qs[_0xfb05('0x41')](_[_0xfb05('0x42')](_0x1ac840[_0xfb05('0x28')],_0x50e7f3[_0xfb05('0x41')]));_0x37726f[_0xfb05('0x40')]['MailInteractionId']=_0x1cf6db['id'];if(_0x1ac840['query'][_0xfb05('0x43')]){_0x37726f[_0xfb05('0x40')]=_[_0xfb05('0x44')](_0x37726f['where'],{'$or':_['map'](_0x37726f[_0xfb05('0x2d')],function(_0xd0fdb6){var _0x35d6c4={};_0x35d6c4[_0xd0fdb6]={'$like':'%'+_0x1ac840[_0xfb05('0x28')][_0xfb05('0x43')]+'%'};return _0x35d6c4;})});}if(_0x1ac840[_0xfb05('0x28')][_0xfb05('0x45')]){var _0x5148a9=_0x1ac840[_0xfb05('0x28')][_0xfb05('0x45')][_0xfb05('0x46')](',');var _0x5e79e3={};_0x5e79e3[_0x5148a9[0x0]]={'$gte':moment(_0x5148a9[0x1])[_0xfb05('0x47')](_0xfb05('0x48'))};_0x37726f[_0xfb05('0x40')]=_[_0xfb05('0x44')](_0x37726f[_0xfb05('0x40')],_0x5e79e3);}_0x37726f=_[_0xfb05('0x44')]({},_0x37726f,_0x1ac840[_0xfb05('0x49')]);return db[_0xfb05('0x37')]['count']({'where':_0x37726f[_0xfb05('0x40')]})[_0xfb05('0x1b')](function(_0x398bf3){_0x4a4d3c['count']=_0x398bf3;if(_0x1ac840[_0xfb05('0x28')][_0xfb05('0x4a')]){_0x37726f['include']=[{'all':!![]}];}return db[_0xfb05('0x37')][_0xfb05('0x26')](_0x37726f);})['then'](function(_0x1cfe4e){if(_0x1ac840[_0xfb05('0x28')][_0xfb05('0x4b')]==='true'){for(var _0x26f1a6=0x0;_0x26f1a6<_0x1cfe4e[_0xfb05('0x30')];_0x26f1a6++){_0x1cfe4e[_0x26f1a6][_0xfb05('0x34')]=juice(_0x1cfe4e[_0x26f1a6][_0xfb05('0x34')]);}}_0x4a4d3c[_0xfb05('0x4c')]=_0x1cfe4e;return _0x4a4d3c;});}})[_0xfb05('0x1b')](respondWithFilteredResult(_0x4f2937,_0x37726f))[_0xfb05('0x32')](handleError(_0x4f2937,null));};exports[_0xfb05('0x4d')]=function(_0x1d4539,_0x5d101f){return db[_0xfb05('0x22')]['find']({'where':{'id':_0x1d4539['params']['id']}})[_0xfb05('0x1b')](handleEntityNotFound(_0x5d101f,null))[_0xfb05('0x1b')](function(_0x1f21c0){if(_0x1f21c0){return _0x1f21c0[_0xfb05('0x4e')](_0x1d4539[_0xfb05('0x34')][_0xfb05('0x38')],_[_0xfb05('0x39')](_0x1d4539['body'],[_0xfb05('0x38'),'id'])||{})[_0xfb05('0x4f')](function(){return db[_0xfb05('0x50')][_0xfb05('0x26')]({'attributes':['id',_0xfb05('0x1e'),'color'],'where':{'id':_0x1d4539['body']['ids']}});})[_0xfb05('0x1b')](function(_0x41e06d){socket[_0xfb05('0x51')](_0xfb05('0x52'),{'id':Number(_0x1d4539[_0xfb05('0x2a')]['id']),'tags':_0x41e06d||[]});return{'id':Number(_0x1d4539[_0xfb05('0x2a')]['id']),'tags':_0x41e06d||[]};});}})[_0xfb05('0x1b')](respondWithResult(_0x5d101f,null))[_0xfb05('0x32')](handleError(_0x5d101f,null));};exports[_0xfb05('0x53')]=function(_0x4d999b,_0xd3a012){return db[_0xfb05('0x22')]['find']({'where':{'id':_0x4d999b[_0xfb05('0x2a')]['id']}})[_0xfb05('0x1b')](handleEntityNotFound(_0xd3a012,null))[_0xfb05('0x1b')](function(_0x15c046){if(_0x15c046){return _0x15c046[_0xfb05('0x53')](_0x4d999b[_0xfb05('0x28')][_0xfb05('0x38')]);}})[_0xfb05('0x1b')](respondWithStatusCode(_0xd3a012,null))[_0xfb05('0x32')](handleError(_0xd3a012,null));};exports[_0xfb05('0x54')]=function(_0x3743be,_0x1daab6){var _0xe057f7=moment()[_0xfb05('0x55')]()[_0xfb05('0x56')]();var _0xa1e47c=path[_0xfb05('0x57')](config[_0xfb05('0x58')],'server',_0xfb05('0x59'),'tmp');var _0x4847ba=path[_0xfb05('0x57')](config['root'],'server',_0xfb05('0x59'),_0xfb05('0x5a'));var _0x2c9f9d=path[_0xfb05('0x57')](_0xa1e47c,_0xe057f7);var _0x4f7667=util[_0xfb05('0x47')](_0xfb05('0x5b'),_0x3743be[_0xfb05('0x2a')]['id'],_0xe057f7);var _0x150083=path[_0xfb05('0x57')](_0xa1e47c,_0x4f7667);var _0x392e50=[];if(_0x3743be[_0xfb05('0x28')][_0xfb05('0x5a')]){_0x392e50[_0xfb05('0x5c')]({'model':db[_0xfb05('0x5d')],'as':_0xfb05('0x5e'),'raw':!![]});}var _0x3bd23f=[{'model':db[_0xfb05('0x37')],'as':'Messages','attributes':['id','body',_0xfb05('0x5f'),'to','cc',_0xfb05('0x60'),_0xfb05('0x61'),'createdAt'],'where':{'secret':![]},'order':qs[_0xfb05('0x3f')]('id'),'include':_0x392e50}];return db[_0xfb05('0x22')]['find']({'where':{'id':_0x3743be[_0xfb05('0x2a')]['id']},'include':_0x3bd23f})[_0xfb05('0x1b')](handleEntityNotFound(_0x1daab6,null))[_0xfb05('0x1b')](function(_0x38c8d3){if(_0x38c8d3&&_0x38c8d3[_0xfb05('0x62')]){var _0x4004e0=_0x38c8d3['get']({'plain':!![]});fs[_0xfb05('0x63')](_0x2c9f9d);return BPromise[_0xfb05('0x64')](_0x4004e0[_0xfb05('0x62')],function(_0x32d6f7,_0x1841fe){var _0x559a39={'from':_0x32d6f7[_0xfb05('0x5f')],'to':_0x32d6f7['to']||_0xfb05('0x65'),'subject':_0x32d6f7[_0xfb05('0x61')],'html':htmlEntities[_0xfb05('0x66')](_0x32d6f7[_0xfb05('0x34')]),'headers':{'Date':moment(_0x32d6f7['createdAt'])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x32d6f7['cc']){_0x559a39[_0xfb05('0x67')]['Cc']=_0x32d6f7['cc'];}if(_0x32d6f7[_0xfb05('0x60')]){_0x559a39[_0xfb05('0x67')]['Bcc']=_0x32d6f7['bcc'];}return new BPromise(function(_0x1a08ac,_0x4c1d8e){if(_0x32d6f7['Attachments']){for(var _0x300d7b=0x0;_0x300d7b<_0x32d6f7[_0xfb05('0x5e')][_0xfb05('0x30')];_0x300d7b++){var _0x26a0a8=_0x32d6f7[_0xfb05('0x5e')][_0x300d7b];var _0x12a001=path[_0xfb05('0x57')](_0x4847ba,_0x26a0a8['basename']);if(fs[_0xfb05('0x68')](_0x12a001)){_0x559a39[_0xfb05('0x5a')][_0xfb05('0x5c')]({'name':_0x26a0a8[_0xfb05('0x1e')],'contentType':_0x26a0a8[_0xfb05('0x69')],'data':fs[_0xfb05('0x6a')](_0x12a001)});}}}emlformat[_0xfb05('0x6b')](_0x559a39,function(_0x18421a,_0x3b8175){if(_0x18421a)return _0x4c1d8e(_0x18421a);fs['writeFileSync'](path[_0xfb05('0x57')](_0x2c9f9d,util[_0xfb05('0x47')](_0xfb05('0x6c'),_0x1841fe)),_0x3b8175);return _0x1a08ac(_0x3b8175);});});})[_0xfb05('0x1b')](function(){return new BPromise(function(_0xc80ed7,_0x438a28){zipdir(_0x2c9f9d,{'saveTo':_0x150083},function(_0x3131ce,_0x3a7fda){if(_0x3131ce)return _0x438a28(_0x3131ce);return _0xc80ed7(_0x3a7fda);});})[_0xfb05('0x1b')](function(){return new BPromise(function(_0x2e6657,_0x155499){rimraf(_0x2c9f9d,function(_0x40b0bd){if(_0x40b0bd)_0x155499(_0x40b0bd);return _0x2e6657();});});})['then'](function(){return _0x1daab6['download'](_0x150083,_0x4f7667,function(_0x17ec41){if(!_0x17ec41)fs[_0xfb05('0x6d')](_0x150083);});});});}else{return _0x1daab6[_0xfb05('0x11')](0xc8);}})[_0xfb05('0x32')](handleError(_0x1daab6,null));}; \ No newline at end of file +var _0x34bb=['where','pick','MailInteractionId','filter','$gte','split','format','inlineCss','true','rows','addTags','setTags','spread','Tag','color','mailInteractionTags:save','removeTags','unix','toString','server','files','tmp','join','root','transcript-%d-%s.zip','attachments','push','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','headers','Bcc','basename','readFileSync','build','writeFileSync','eml-format','rimraf','zip-dir','moment','path','lodash','juice','ioredis','../../config/logger','../../config/environment','redis','localhost','./mailInteraction.socket','register','sendStatus','json','undefined','limit','count','status','set','Content-Range','update','destroy','then','error','name','map','rawAttributes','type','key','getOptions','findAll','mail','query','catch','show','params','model','keys','intersection','attributes','fields','includeAll','include','merge','options','find','create','MailInteraction','body','describe','addMessage','MailMessage','omit','ids','getMessages','findOne','filters','length','hasOwnProperty','offset','order','sort'];(function(_0x3d2ec9,_0x46db50){var _0x333e0a=function(_0xe37674){while(--_0xe37674){_0x3d2ec9['push'](_0x3d2ec9['shift']());}};_0x333e0a(++_0x46db50);}(_0x34bb,0x174));var _0xb34b=function(_0x1db7bf,_0x2d95b5){_0x1db7bf=_0x1db7bf-0x0;var _0x896e4d=_0x34bb[_0x1db7bf];return _0x896e4d;};'use strict';var emlformat=require(_0xb34b('0x0'));var rimraf=require(_0xb34b('0x1'));var zipdir=require(_0xb34b('0x2'));var moment=require(_0xb34b('0x3'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xb34b('0x4'));var fs=require('fs');var _=require(_0xb34b('0x5'));var juice=require(_0xb34b('0x6'));var Redis=require(_0xb34b('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0xb34b('0x8'))('api');var config=require(_0xb34b('0x9'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0xb34b('0xa')]=_['defaults'](config[_0xb34b('0xa')],{'host':_0xb34b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb34b('0xc'))[_0xb34b('0xd')](socket);function respondWithStatusCode(_0x5af26e,_0x37f493){_0x37f493=_0x37f493||0xcc;return function(_0x252ed4){if(_0x252ed4){return _0x5af26e[_0xb34b('0xe')](_0x37f493);}return _0x5af26e['status'](_0x37f493)['end']();};}function respondWithResult(_0x4872df,_0x59b4ac){_0x59b4ac=_0x59b4ac||0xc8;return function(_0x34f596){if(_0x34f596){return _0x4872df['status'](_0x59b4ac)[_0xb34b('0xf')](_0x34f596);}};}function respondWithFilteredResult(_0x5c7696,_0x5d59eb){return function(_0x5486bb){if(_0x5486bb){var _0x4f505a=typeof _0x5d59eb['offset']===_0xb34b('0x10')&&typeof _0x5d59eb[_0xb34b('0x11')]===_0xb34b('0x10');var _0xe7827a=_0x5486bb[_0xb34b('0x12')];var _0x63f369=_0x4f505a?0x0:_0x5d59eb['offset'];var _0x3bb97b=_0x4f505a?_0x5486bb['count']:_0x5d59eb['offset']+_0x5d59eb['limit'];var _0x10db4c;if(_0x3bb97b>=_0xe7827a){_0x3bb97b=_0xe7827a;_0x10db4c=0xc8;}else{_0x10db4c=0xce;}_0x5c7696[_0xb34b('0x13')](_0x10db4c);return _0x5c7696[_0xb34b('0x14')](_0xb34b('0x15'),_0x63f369+'-'+_0x3bb97b+'/'+_0xe7827a)['json'](_0x5486bb);}return null;};}function saveUpdates(_0x551c00){return function(_0x17add2){if(_0x17add2){return _0x17add2[_0xb34b('0x16')](_0x551c00)['then'](function(_0x356fe4){return _0x356fe4;});}return null;};}function removeEntity(_0x1f3080){return function(_0x198223){if(_0x198223){return _0x198223[_0xb34b('0x17')]()[_0xb34b('0x18')](function(){_0x1f3080[_0xb34b('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x534bab){return function(_0x3566f8){if(!_0x3566f8){_0x534bab[_0xb34b('0xe')](0x194);}return _0x3566f8;};}function handleError(_0x53dfb3,_0x11f84b){_0x11f84b=_0x11f84b||0x1f4;return function(_0x1ab914){logger[_0xb34b('0x19')](_0x1ab914['stack']);if(_0x1ab914[_0xb34b('0x1a')]){delete _0x1ab914[_0xb34b('0x1a')];}_0x53dfb3[_0xb34b('0x13')](_0x11f84b)['send'](_0x1ab914);};}exports['index']=function(_0x1129c1,_0x4a5002){var _0x326953={};var _0x340378=_[_0xb34b('0x1b')](db['MailInteraction'][_0xb34b('0x1c')],function(_0x44bd11){return{'name':_0x44bd11['fieldName'],'type':_0x44bd11[_0xb34b('0x1d')][_0xb34b('0x1e')]};});_0x326953=qs[_0xb34b('0x1f')](_0x340378,_0x1129c1);return interaction[_0xb34b('0x20')](_0xb34b('0x21'),_0x1129c1[_0xb34b('0x22')],_0x1129c1['user'],_0x326953,_0x340378)[_0xb34b('0x18')](respondWithFilteredResult(_0x4a5002,_0x326953))[_0xb34b('0x23')](handleError(_0x4a5002,null));};exports[_0xb34b('0x24')]=function(_0x980746,_0x5f32a6){var _0x1aa05f={'raw':![],'where':{'id':_0x980746[_0xb34b('0x25')]['id']}},_0x572501={};_0x572501[_0xb34b('0x26')]=_[_0xb34b('0x27')](db['MailInteraction']['rawAttributes']);_0x572501['query']=_['keys'](_0x980746['query']);_0x572501['filters']=_[_0xb34b('0x28')](_0x572501[_0xb34b('0x26')],_0x572501['query']);_0x1aa05f[_0xb34b('0x29')]=_[_0xb34b('0x28')](_0x572501[_0xb34b('0x26')],qs[_0xb34b('0x2a')](_0x980746[_0xb34b('0x22')][_0xb34b('0x2a')]));_0x1aa05f[_0xb34b('0x29')]=_0x1aa05f[_0xb34b('0x29')]['length']?_0x1aa05f[_0xb34b('0x29')]:_0x572501[_0xb34b('0x26')];if(_0x980746[_0xb34b('0x22')][_0xb34b('0x2b')]){_0x1aa05f[_0xb34b('0x2c')]=[{'all':!![]}];}_0x1aa05f=_[_0xb34b('0x2d')]({},_0x1aa05f,_0x980746[_0xb34b('0x2e')]);return db['MailInteraction'][_0xb34b('0x2f')](_0x1aa05f)['then'](handleEntityNotFound(_0x5f32a6,null))[_0xb34b('0x18')](respondWithResult(_0x5f32a6,null))[_0xb34b('0x23')](handleError(_0x5f32a6,null));};exports[_0xb34b('0x30')]=function(_0x3932a2,_0x19826b){return db[_0xb34b('0x31')][_0xb34b('0x30')](_0x3932a2[_0xb34b('0x32')],{})[_0xb34b('0x18')](respondWithResult(_0x19826b,0xc9))[_0xb34b('0x23')](handleError(_0x19826b,null));};exports['update']=function(_0x180a7c,_0x172e24){if(_0x180a7c[_0xb34b('0x32')]['id']){delete _0x180a7c['body']['id'];}return db[_0xb34b('0x31')][_0xb34b('0x2f')]({'where':{'id':_0x180a7c[_0xb34b('0x25')]['id']}})['then'](handleEntityNotFound(_0x172e24,null))[_0xb34b('0x18')](saveUpdates(_0x180a7c[_0xb34b('0x32')],null))['then'](respondWithResult(_0x172e24,null))[_0xb34b('0x23')](handleError(_0x172e24,null));};exports[_0xb34b('0x17')]=function(_0x12a460,_0x5d62d9){return db[_0xb34b('0x31')][_0xb34b('0x2f')]({'where':{'id':_0x12a460['params']['id']}})[_0xb34b('0x18')](handleEntityNotFound(_0x5d62d9,null))[_0xb34b('0x18')](removeEntity(_0x5d62d9,null))[_0xb34b('0x23')](handleError(_0x5d62d9,null));};exports[_0xb34b('0x33')]=function(_0x469d98,_0x1df0f2){return db[_0xb34b('0x31')]['describe']()[_0xb34b('0x18')](respondWithResult(_0x1df0f2,null))['catch'](handleError(_0x1df0f2,null));};exports[_0xb34b('0x34')]=function(_0x59eac7,_0x2aada9){return db[_0xb34b('0x35')][_0xb34b('0x2f')]({'where':{'id':_0x59eac7[_0xb34b('0x25')]['id']}})[_0xb34b('0x18')](handleEntityNotFound(_0x2aada9,null))['then'](function(_0x5bdb7e){if(_0x5bdb7e){return _0x5bdb7e[_0xb34b('0x34')](_0x59eac7['body']['ids'],_[_0xb34b('0x36')](_0x59eac7[_0xb34b('0x32')],[_0xb34b('0x37'),'id'])||{});}})[_0xb34b('0x18')](respondWithResult(_0x2aada9,null))[_0xb34b('0x23')](handleError(_0x2aada9,null));};exports[_0xb34b('0x38')]=function(_0x19c585,_0x2604bc){var _0x3f80e1={'raw':![],'where':{}};var _0x455eb1={};var _0x36d6e4={'count':0x0,'rows':[]};return db[_0xb34b('0x31')][_0xb34b('0x39')]({'where':{'id':_0x19c585['params']['id']}})[_0xb34b('0x18')](handleEntityNotFound(_0x2604bc,null))[_0xb34b('0x18')](function(_0x2b3b23){if(_0x2b3b23){_0x455eb1[_0xb34b('0x26')]=_[_0xb34b('0x27')](db[_0xb34b('0x35')][_0xb34b('0x1c')]);_0x455eb1['query']=_['keys'](_0x19c585['query']);_0x455eb1[_0xb34b('0x3a')]=_[_0xb34b('0x28')](_0x455eb1[_0xb34b('0x26')],_0x455eb1[_0xb34b('0x22')]);_0x3f80e1[_0xb34b('0x29')]=_['intersection'](_0x455eb1['model'],qs['fields'](_0x19c585[_0xb34b('0x22')]['fields']));_0x3f80e1[_0xb34b('0x29')]=_0x3f80e1['attributes'][_0xb34b('0x3b')]?_0x3f80e1[_0xb34b('0x29')]:_0x455eb1[_0xb34b('0x26')];if(!_0x19c585[_0xb34b('0x22')][_0xb34b('0x3c')]('nolimit')){_0x3f80e1[_0xb34b('0x11')]=qs[_0xb34b('0x11')](_0x19c585[_0xb34b('0x22')]['limit']);_0x3f80e1['offset']=qs[_0xb34b('0x3d')](_0x19c585[_0xb34b('0x22')][_0xb34b('0x3d')]);}_0x3f80e1[_0xb34b('0x3e')]=qs[_0xb34b('0x3f')](_0x19c585[_0xb34b('0x22')][_0xb34b('0x3f')]);_0x3f80e1[_0xb34b('0x40')]=qs[_0xb34b('0x3a')](_[_0xb34b('0x41')](_0x19c585[_0xb34b('0x22')],_0x455eb1['filters']));_0x3f80e1[_0xb34b('0x40')][_0xb34b('0x42')]=_0x2b3b23['id'];if(_0x19c585['query'][_0xb34b('0x43')]){_0x3f80e1[_0xb34b('0x40')]=_[_0xb34b('0x2d')](_0x3f80e1[_0xb34b('0x40')],{'$or':_[_0xb34b('0x1b')](_0x3f80e1[_0xb34b('0x29')],function(_0x38424d){var _0x29b12a={};_0x29b12a[_0x38424d]={'$like':'%'+_0x19c585[_0xb34b('0x22')]['filter']+'%'};return _0x29b12a;})});}if(_0x19c585[_0xb34b('0x22')][_0xb34b('0x44')]){var _0x43dabc=_0x19c585[_0xb34b('0x22')][_0xb34b('0x44')][_0xb34b('0x45')](',');var _0x392527={};_0x392527[_0x43dabc[0x0]]={'$gte':moment(_0x43dabc[0x1])[_0xb34b('0x46')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3f80e1[_0xb34b('0x40')]=_[_0xb34b('0x2d')](_0x3f80e1[_0xb34b('0x40')],_0x392527);}_0x3f80e1=_[_0xb34b('0x2d')]({},_0x3f80e1,_0x19c585[_0xb34b('0x2e')]);return db[_0xb34b('0x35')][_0xb34b('0x12')]({'where':_0x3f80e1['where']})[_0xb34b('0x18')](function(_0x537272){_0x36d6e4[_0xb34b('0x12')]=_0x537272;if(_0x19c585[_0xb34b('0x22')]['includeAll']){_0x3f80e1[_0xb34b('0x2c')]=[{'all':!![]}];}return db[_0xb34b('0x35')][_0xb34b('0x20')](_0x3f80e1);})[_0xb34b('0x18')](function(_0x55e1e6){if(_0x19c585['query'][_0xb34b('0x47')]===_0xb34b('0x48')){for(var _0x280ace=0x0;_0x280ace<_0x55e1e6[_0xb34b('0x3b')];_0x280ace++){_0x55e1e6[_0x280ace][_0xb34b('0x32')]=juice(_0x55e1e6[_0x280ace][_0xb34b('0x32')]);}}_0x36d6e4[_0xb34b('0x49')]=_0x55e1e6;return _0x36d6e4;});}})[_0xb34b('0x18')](respondWithFilteredResult(_0x2604bc,_0x3f80e1))[_0xb34b('0x23')](handleError(_0x2604bc,null));};exports[_0xb34b('0x4a')]=function(_0x4d99fa,_0x5b7e9e){return db[_0xb34b('0x31')][_0xb34b('0x2f')]({'where':{'id':_0x4d99fa['params']['id']}})[_0xb34b('0x18')](handleEntityNotFound(_0x5b7e9e,null))['then'](function(_0x5755a8){if(_0x5755a8){return _0x5755a8[_0xb34b('0x4b')](_0x4d99fa[_0xb34b('0x32')]['ids'],_[_0xb34b('0x36')](_0x4d99fa[_0xb34b('0x32')],['ids','id'])||{})[_0xb34b('0x4c')](function(){return db[_0xb34b('0x4d')][_0xb34b('0x20')]({'attributes':['id',_0xb34b('0x1a'),_0xb34b('0x4e')],'where':{'id':_0x4d99fa['body'][_0xb34b('0x37')]}});})['then'](function(_0x5b1a4d){socket['emit'](_0xb34b('0x4f'),{'id':Number(_0x4d99fa[_0xb34b('0x25')]['id']),'tags':_0x5b1a4d||[]});return{'id':Number(_0x4d99fa[_0xb34b('0x25')]['id']),'tags':_0x5b1a4d||[]};});}})[_0xb34b('0x18')](respondWithResult(_0x5b7e9e,null))[_0xb34b('0x23')](handleError(_0x5b7e9e,null));};exports[_0xb34b('0x50')]=function(_0x512859,_0x5b4c9c){return db['MailInteraction'][_0xb34b('0x2f')]({'where':{'id':_0x512859['params']['id']}})['then'](handleEntityNotFound(_0x5b4c9c,null))[_0xb34b('0x18')](function(_0x3995d4){if(_0x3995d4){return _0x3995d4[_0xb34b('0x50')](_0x512859[_0xb34b('0x22')][_0xb34b('0x37')]);}})[_0xb34b('0x18')](respondWithStatusCode(_0x5b4c9c,null))[_0xb34b('0x23')](handleError(_0x5b4c9c,null));};exports['download']=function(_0x2347a7,_0x432368){var _0x565ab1=moment()[_0xb34b('0x51')]()[_0xb34b('0x52')]();var _0x231880=path['join'](config['root'],_0xb34b('0x53'),_0xb34b('0x54'),_0xb34b('0x55'));var _0xbd6608=path[_0xb34b('0x56')](config[_0xb34b('0x57')],_0xb34b('0x53'),'files','attachments');var _0x4f0849=path[_0xb34b('0x56')](_0x231880,_0x565ab1);var _0xd90464=util[_0xb34b('0x46')](_0xb34b('0x58'),_0x2347a7[_0xb34b('0x25')]['id'],_0x565ab1);var _0xd86f4d=path[_0xb34b('0x56')](_0x231880,_0xd90464);var _0x45101a=[];if(_0x2347a7[_0xb34b('0x22')][_0xb34b('0x59')]){_0x45101a[_0xb34b('0x5a')]({'model':db[_0xb34b('0x5b')],'as':_0xb34b('0x5c'),'raw':!![]});}var _0x284b06=[{'model':db[_0xb34b('0x35')],'as':_0xb34b('0x5d'),'attributes':['id',_0xb34b('0x32'),_0xb34b('0x5e'),'to','cc',_0xb34b('0x5f'),_0xb34b('0x60'),_0xb34b('0x61')],'where':{'secret':![]},'order':qs[_0xb34b('0x3f')]('id'),'include':_0x45101a}];return db[_0xb34b('0x31')][_0xb34b('0x2f')]({'where':{'id':_0x2347a7[_0xb34b('0x25')]['id']},'include':_0x284b06})['then'](handleEntityNotFound(_0x432368,null))[_0xb34b('0x18')](function(_0xf0e3a5){if(_0xf0e3a5&&_0xf0e3a5[_0xb34b('0x5d')]){var _0x5250a1=_0xf0e3a5[_0xb34b('0x62')]({'plain':!![]});fs[_0xb34b('0x63')](_0x4f0849);return BPromise[_0xb34b('0x64')](_0x5250a1[_0xb34b('0x5d')],function(_0x334da4,_0x436208){var _0x4c1d60={'from':_0x334da4[_0xb34b('0x5e')],'to':_0x334da4['to']||_0xb34b('0x65'),'subject':_0x334da4['subject'],'html':htmlEntities[_0xb34b('0x66')](_0x334da4[_0xb34b('0x32')]),'headers':{'Date':moment(_0x334da4[_0xb34b('0x61')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x334da4['cc']){_0x4c1d60[_0xb34b('0x67')]['Cc']=_0x334da4['cc'];}if(_0x334da4[_0xb34b('0x5f')]){_0x4c1d60['headers'][_0xb34b('0x68')]=_0x334da4[_0xb34b('0x5f')];}return new BPromise(function(_0x5eb5eb,_0xe0010b){if(_0x334da4['Attachments']){for(var _0x3bac57=0x0;_0x3bac57<_0x334da4[_0xb34b('0x5c')][_0xb34b('0x3b')];_0x3bac57++){var _0x48ee26=_0x334da4[_0xb34b('0x5c')][_0x3bac57];var _0x2393f6=path[_0xb34b('0x56')](_0xbd6608,_0x48ee26[_0xb34b('0x69')]);if(fs['existsSync'](_0x2393f6)){_0x4c1d60[_0xb34b('0x59')][_0xb34b('0x5a')]({'name':_0x48ee26[_0xb34b('0x1a')],'contentType':_0x48ee26['type'],'data':fs[_0xb34b('0x6a')](_0x2393f6)});}}}emlformat[_0xb34b('0x6b')](_0x4c1d60,function(_0x22cf27,_0x5435e9){if(_0x22cf27)return _0xe0010b(_0x22cf27);fs[_0xb34b('0x6c')](path[_0xb34b('0x56')](_0x4f0849,util[_0xb34b('0x46')]('message%d.eml',_0x436208)),_0x5435e9);return _0x5eb5eb(_0x5435e9);});});})[_0xb34b('0x18')](function(){return new BPromise(function(_0x12a283,_0x2b2445){zipdir(_0x4f0849,{'saveTo':_0xd86f4d},function(_0x552957,_0x4b1542){if(_0x552957)return _0x2b2445(_0x552957);return _0x12a283(_0x4b1542);});})[_0xb34b('0x18')](function(){return new BPromise(function(_0x47a030,_0x231bab){rimraf(_0x4f0849,function(_0x2132ff){if(_0x2132ff)_0x231bab(_0x2132ff);return _0x47a030();});});})[_0xb34b('0x18')](function(){return _0x432368['download'](_0xd86f4d,_0xd90464,function(_0x17ec2c){if(!_0x17ec2c)fs['unlinkSync'](_0xd86f4d);});});});}else{return _0x432368[_0xb34b('0xe')](0xc8);}})[_0xb34b('0x23')](handleError(_0x432368,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index a60ab11..972d552 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 _0x1823=['unreadMessages','length','emit','hook','exports','events','../../mysqldb','save','update','remove','getUsers','then','Users','map','findAll'];(function(_0x44c12d,_0x260b95){var _0x31566e=function(_0x1bcc65){while(--_0x1bcc65){_0x44c12d['push'](_0x44c12d['shift']());}};_0x31566e(++_0x260b95);}(_0x1823,0xe6));var _0x3182=function(_0x3b4202,_0x1be12d){_0x3b4202=_0x3b4202-0x0;var _0x11ac04=_0x1823[_0x3b4202];return _0x11ac04;};'use strict';var EventEmitter=require(_0x3182('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0x3182('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3182('0x2'),'afterUpdate':_0x3182('0x3'),'afterDestroy':_0x3182('0x4')};function emitEvent(_0xabc6fe){return function(_0x134a7d,_0x5b8277,_0x2e45e4){_0x134a7d[_0x3182('0x5')]({'attributes':['id'],'raw':!![]})[_0x3182('0x6')](function(_0x281aa8){_0x134a7d['setDataValue'](_0x3182('0x7'),_0x281aa8[_0x3182('0x8')](function(_0x24d614){return{'id':_0x24d614['id']};}));return MailMessage[_0x3182('0x9')]({'where':{'MailInteractionId':_0x134a7d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3182('0x6')](function(_0x35a5a9){_0x134a7d['setDataValue'](_0x3182('0xa'),_0x35a5a9[_0x3182('0xb')]);MailInteractionEvents[_0x3182('0xc')](_0xabc6fe+':'+_0x134a7d['id'],_0x134a7d);MailInteractionEvents[_0x3182('0xc')](_0xabc6fe,_0x134a7d);_0x2e45e4(null);})['catch'](_0x2e45e4(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x3182('0xd')](e,emitEvent(event));}}module[_0x3182('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0xe59a=['update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners'];(function(_0x24875d,_0x4fb24d){var _0x181471=function(_0x4ecd6d){while(--_0x4ecd6d){_0x24875d['push'](_0x24875d['shift']());}};_0x181471(++_0x4fb24d);}(_0xe59a,0x163));var _0xae59=function(_0x4e02da,_0x20e94c){_0x4e02da=_0x4e02da-0x0;var _0x3aeaf6=_0xe59a[_0x4e02da];return _0x3aeaf6;};'use strict';var EventEmitter=require(_0xae59('0x0'));var MailInteraction=require(_0xae59('0x1'))['db'][_0xae59('0x2')];var MailMessage=require('../../mysqldb')['db'][_0xae59('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xae59('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xae59('0x5'),'afterDestroy':_0xae59('0x6')};function emitEvent(_0x34c2fb){return function(_0x126590,_0x5a2fe4,_0x587440){_0x126590[_0xae59('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2d117f){_0x126590[_0xae59('0x8')](_0xae59('0x9'),_0x2d117f[_0xae59('0xa')](function(_0x55d0e7){return{'id':_0x55d0e7['id']};}));return MailMessage[_0xae59('0xb')]({'where':{'MailInteractionId':_0x126590['id'],'direction':'in','read':![]},'raw':!![]});})[_0xae59('0xc')](function(_0x56e16d){_0x126590[_0xae59('0x8')](_0xae59('0xd'),_0x56e16d['length']);MailInteractionEvents['emit'](_0x34c2fb+':'+_0x126590['id'],_0x126590);MailInteractionEvents[_0xae59('0xe')](_0x34c2fb,_0x126590);_0x587440(null);})['catch'](_0x587440(null));};}for(var e in events){if(events[_0xae59('0xf')](e)){var event=events[e];MailInteraction[_0xae59('0x10')](e,emitEvent(event));}}module[_0xae59('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index e9b9965..a8601fb 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 _0xae36=['api','moment','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','substatusAt','changed','closed','closedAt','models','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x11f083,_0x38a7dd){var _0x1a41f3=function(_0x4570b5){while(--_0x4570b5){_0x11f083['push'](_0x11f083['shift']());}};_0x1a41f3(++_0x38a7dd);}(_0xae36,0x13c));var _0x6ae3=function(_0x219c6c,_0x4d299a){_0x219c6c=_0x219c6c-0x0;var _0x41d2d0=_0xae36[_0x219c6c];return _0x41d2d0;};'use strict';var _=require(_0x6ae3('0x0'));var util=require(_0x6ae3('0x1'));var logger=require(_0x6ae3('0x2'))(_0x6ae3('0x3'));var moment=require(_0x6ae3('0x4'));var BPromise=require(_0x6ae3('0x5'));var rp=require(_0x6ae3('0x6'));var fs=require('fs');var path=require(_0x6ae3('0x7'));var rimraf=require('rimraf');var config=require(_0x6ae3('0x8'));var attributes=require(_0x6ae3('0x9'));module[_0x6ae3('0xa')]=function(_0x53e1fa,_0x5768c7){return _0x53e1fa[_0x6ae3('0xb')](_0x6ae3('0xc'),attributes,{'tableName':_0x6ae3('0xd'),'paranoid':![],'indexes':[{'name':_0x6ae3('0xe'),'fields':[_0x6ae3('0xf'),'to'],'type':_0x6ae3('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x21df18,_0x582d64,_0x1bdadb){if(_0x21df18[_0x6ae3('0x11')]){_0x21df18['substatusAt']=moment()[_0x6ae3('0x12')](_0x6ae3('0x13'));}if(_0x21df18['closed']){_0x21df18['closedAt']=moment()['format'](_0x6ae3('0x13'));}_0x1bdadb(null,_0x582d64);},'beforeUpdate':function(_0x1b4e6f,_0x1d4bd3,_0x4de8fe){if(_0x1b4e6f['changed'](_0x6ae3('0x11'))){_0x1b4e6f[_0x6ae3('0x14')]=_0x1b4e6f[_0x6ae3('0x11')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x1b4e6f[_0x6ae3('0x15')](_0x6ae3('0x16'))){_0x1b4e6f[_0x6ae3('0x17')]=moment()[_0x6ae3('0x12')](_0x6ae3('0x13'));_0x1b4e6f[_0x6ae3('0x11')]=null;_0x1b4e6f['substatusAt']=null;}_0x4de8fe(null,_0x1b4e6f);},'afterUpdate':function(_0x2bd1c0,_0x2d24d9,_0x2a30e0){var _0x17bc3f=_0x53e1fa[_0x6ae3('0x18')];var _0x283747=_0x2bd1c0['get']({'plain':!![]});if(_0x283747[_0x6ae3('0x16')]){return _0x17bc3f['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x283747['id']}})[_0x6ae3('0x19')](function(){_0x2a30e0();})[_0x6ae3('0x1a')](function(_0xc5f6cc){_0x2a30e0(_0xc5f6cc);});}else{_0x2a30e0();}}},'charset':_0x6ae3('0x1b'),'collate':_0x6ae3('0x1c')});}; \ No newline at end of file +var _0xa160=['models','get','MailMessage','update','then','catch','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','closed','closedAt'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0xa160,0x1da));var _0x0a16=function(_0x54ae0d,_0xd4fae){_0x54ae0d=_0x54ae0d-0x0;var _0x456421=_0xa160[_0x54ae0d];return _0x456421;};'use strict';var _=require('lodash');var util=require(_0x0a16('0x0'));var logger=require(_0x0a16('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0a16('0x2'));var rp=require(_0x0a16('0x3'));var fs=require('fs');var path=require(_0x0a16('0x4'));var rimraf=require(_0x0a16('0x5'));var config=require(_0x0a16('0x6'));var attributes=require(_0x0a16('0x7'));module[_0x0a16('0x8')]=function(_0x5356ce,_0x1fd1bf){return _0x5356ce['define'](_0x0a16('0x9'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x0a16('0xa'),'fields':[_0x0a16('0xb'),'to'],'type':_0x0a16('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x44aa66,_0x1524e1,_0x1fe9ce){if(_0x44aa66['substatus']){_0x44aa66[_0x0a16('0xd')]=moment()[_0x0a16('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x44aa66['closed']){_0x44aa66['closedAt']=moment()['format'](_0x0a16('0xf'));}_0x1fe9ce(null,_0x1524e1);},'beforeUpdate':function(_0x30ac1d,_0x2521d0,_0x3e23c8){if(_0x30ac1d[_0x0a16('0x10')]('substatus')){_0x30ac1d['substatusAt']=_0x30ac1d[_0x0a16('0x11')]?moment()[_0x0a16('0xe')](_0x0a16('0xf')):null;}if(_0x30ac1d[_0x0a16('0x10')](_0x0a16('0x12'))){_0x30ac1d[_0x0a16('0x13')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x30ac1d[_0x0a16('0x11')]=null;_0x30ac1d[_0x0a16('0xd')]=null;}_0x3e23c8(null,_0x30ac1d);},'afterUpdate':function(_0x5e2086,_0x25e416,_0x50c218){var _0x50ab55=_0x5356ce[_0x0a16('0x14')];var _0x35f920=_0x5e2086[_0x0a16('0x15')]({'plain':!![]});if(_0x35f920['closed']){return _0x50ab55[_0x0a16('0x16')][_0x0a16('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x35f920['id']}})[_0x0a16('0x18')](function(){_0x50c218();})[_0x0a16('0x19')](function(_0x591f21){_0x50c218(_0x591f21);});}else{_0x50c218();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 6f9ce2d..e8660ad 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 _0x563e=['stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','options','raw','where','attributes','limit','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x48e615,_0x1b041e){var _0x5951ac=function(_0x1aa085){while(--_0x1aa085){_0x48e615['push'](_0x48e615['shift']());}};_0x5951ac(++_0x1b041e);}(_0x563e,0x1cb));var _0xe563=function(_0x4456a2,_0x376ff2){_0x4456a2=_0x4456a2-0x0;var _0xf36b56=_0x563e[_0x4456a2];return _0xf36b56;};'use strict';var _=require(_0xe563('0x0'));var util=require(_0xe563('0x1'));var moment=require(_0xe563('0x2'));var BPromise=require(_0xe563('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe563('0x4'));var db=require(_0xe563('0x5'))['db'];var utils=require(_0xe563('0x6'));var logger=require('../../config/logger')(_0xe563('0x7'));var config=require(_0xe563('0x8'));var jayson=require(_0xe563('0x9'));var client=jayson['client'][_0xe563('0xa')]({'port':0x232a});config[_0xe563('0xb')]=_['defaults'](config[_0xe563('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe563('0xb')]));require(_0xe563('0xc'))[_0xe563('0xd')](socket);function respondWithRpcPromise(_0x5a480b,_0x3e2eb5,_0x1356fd){return new BPromise(function(_0x282749,_0x5f01ab){return client[_0xe563('0xe')](_0x5a480b,_0x1356fd)[_0xe563('0xf')](function(_0x4e822e){logger[_0xe563('0x10')](_0xe563('0x11'),_0x3e2eb5,'request\x20sent');logger[_0xe563('0x12')](_0xe563('0x13'),_0x3e2eb5,_0xe563('0x14'),JSON[_0xe563('0x15')](_0x4e822e));if(_0x4e822e[_0xe563('0x16')]){if(_0x4e822e['error'][_0xe563('0x17')]===0x1f4){logger[_0xe563('0x16')](_0xe563('0x11'),_0x3e2eb5,_0x4e822e[_0xe563('0x16')][_0xe563('0x18')]);return _0x5f01ab(_0x4e822e[_0xe563('0x16')][_0xe563('0x18')]);}logger['error'](_0xe563('0x11'),_0x3e2eb5,_0x4e822e[_0xe563('0x16')][_0xe563('0x18')]);return _0x282749(_0x4e822e[_0xe563('0x16')][_0xe563('0x18')]);}else{logger['info'](_0xe563('0x11'),_0x3e2eb5,_0xe563('0x14'));_0x282749(_0x4e822e[_0xe563('0x19')][_0xe563('0x18')]);}})[_0xe563('0x1a')](function(_0x2ca35a){logger[_0xe563('0x16')](_0xe563('0x11'),_0x3e2eb5,_0x2ca35a);_0x5f01ab(_0x2ca35a);});});}exports[_0xe563('0x1b')]=function(_0x227765){var _0x445f09=this;return new Promise(function(_0x42a6a9,_0x348e33){return db[_0xe563('0x1c')]['update'](_0x227765['body'],{'raw':_0x227765['options']?_0x227765[_0xe563('0x1d')][_0xe563('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x227765[_0xe563('0x1d')]?_0x227765[_0xe563('0x1d')][_0xe563('0x1f')]||null:null,'attributes':_0x227765[_0xe563('0x1d')]?_0x227765[_0xe563('0x1d')][_0xe563('0x20')]||null:null,'limit':_0x227765[_0xe563('0x1d')]?_0x227765['options'][_0xe563('0x21')]||null:null})[_0xe563('0xf')](function(_0x489346){logger[_0xe563('0x10')](_0xe563('0x1b'),_0x227765);logger['debug']('UpdateMailInteraction',_0x227765,JSON[_0xe563('0x15')](_0x489346));_0x42a6a9(_0x489346);})[_0xe563('0x1a')](function(_0x5cbc42){logger['error'](_0xe563('0x1b'),_0x5cbc42[_0xe563('0x18')],_0x227765);_0x348e33(_0x445f09[_0xe563('0x16')](0x1f4,_0x5cbc42['message']));});});};exports['AddTagsToMailInteraction']=function(_0x2d1291){return new Promise(function(_0x1df770,_0x500f22){return db[_0xe563('0x1c')]['find']({'where':_0x2d1291['options']?_0x2d1291[_0xe563('0x1d')][_0xe563('0x1f')]||null:null})[_0xe563('0xf')](function(_0x3ddbce){if(_0x3ddbce){return _0x3ddbce[_0xe563('0x22')](_0x2d1291[_0xe563('0x23')][_0xe563('0x24')],_[_0xe563('0x25')](_0x2d1291[_0xe563('0x23')],[_0xe563('0x24'),'id'])||{});}})[_0xe563('0x26')](function(_0x1c287e){logger[_0xe563('0x10')](_0xe563('0x27'),_0x2d1291);logger['debug'](_0xe563('0x27'),_0x2d1291,JSON[_0xe563('0x15')](_0x1c287e));_0x1df770(_0x1c287e);})['catch'](function(_0xb0886f){logger[_0xe563('0x16')]('AddTags',_0xb0886f[_0xe563('0x18')],_0x2d1291);_0x500f22(_this[_0xe563('0x16')](0x1f4,_0xb0886f['message']));});});}; \ No newline at end of file +var _0xcaf2=['options','raw','where','limit','then','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body'];(function(_0x5e452a,_0x515366){var _0x5e337e=function(_0x4ce931){while(--_0x4ce931){_0x5e452a['push'](_0x5e452a['shift']());}};_0x5e337e(++_0x515366);}(_0xcaf2,0x8a));var _0x2caf=function(_0x9a138c,_0x2607f8){_0x9a138c=_0x9a138c-0x0;var _0x3771a3=_0xcaf2[_0x9a138c];return _0x3771a3;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var moment=require(_0x2caf('0x1'));var BPromise=require(_0x2caf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2caf('0x3'));var db=require(_0x2caf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2caf('0x5'))('rpc');var config=require(_0x2caf('0x6'));var jayson=require(_0x2caf('0x7'));var client=jayson[_0x2caf('0x8')]['http']({'port':0x232a});config[_0x2caf('0x9')]=_[_0x2caf('0xa')](config[_0x2caf('0x9')],{'host':_0x2caf('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2caf('0x9')]));require(_0x2caf('0xc'))[_0x2caf('0xd')](socket);function respondWithRpcPromise(_0x1ff859,_0x219d0f,_0x438434){return new BPromise(function(_0x1b20e3,_0x3b5631){return client[_0x2caf('0xe')](_0x1ff859,_0x438434)['then'](function(_0xd56396){logger[_0x2caf('0xf')](_0x2caf('0x10'),_0x219d0f,_0x2caf('0x11'));logger[_0x2caf('0x12')](_0x2caf('0x13'),_0x219d0f,_0x2caf('0x11'),JSON[_0x2caf('0x14')](_0xd56396));if(_0xd56396['error']){if(_0xd56396[_0x2caf('0x15')][_0x2caf('0x16')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x219d0f,_0xd56396['error'][_0x2caf('0x17')]);return _0x3b5631(_0xd56396['error'][_0x2caf('0x17')]);}logger[_0x2caf('0x15')](_0x2caf('0x10'),_0x219d0f,_0xd56396[_0x2caf('0x15')]['message']);return _0x1b20e3(_0xd56396[_0x2caf('0x15')]['message']);}else{logger[_0x2caf('0xf')]('MailInteraction,\x20%s,\x20%s',_0x219d0f,'request\x20sent');_0x1b20e3(_0xd56396[_0x2caf('0x18')]['message']);}})[_0x2caf('0x19')](function(_0x9c7302){logger['error'](_0x2caf('0x10'),_0x219d0f,_0x9c7302);_0x3b5631(_0x9c7302);});});}exports[_0x2caf('0x1a')]=function(_0x6b3778){var _0x255c08=this;return new Promise(function(_0x20f7d3,_0x595f2f){return db[_0x2caf('0x1b')][_0x2caf('0x1c')](_0x6b3778[_0x2caf('0x1d')],{'raw':_0x6b3778[_0x2caf('0x1e')]?_0x6b3778[_0x2caf('0x1e')][_0x2caf('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6b3778[_0x2caf('0x1e')]?_0x6b3778[_0x2caf('0x1e')][_0x2caf('0x20')]||null:null,'attributes':_0x6b3778[_0x2caf('0x1e')]?_0x6b3778[_0x2caf('0x1e')]['attributes']||null:null,'limit':_0x6b3778[_0x2caf('0x1e')]?_0x6b3778[_0x2caf('0x1e')][_0x2caf('0x21')]||null:null})[_0x2caf('0x22')](function(_0x3efa4e){logger[_0x2caf('0xf')](_0x2caf('0x1a'),_0x6b3778);logger[_0x2caf('0x12')](_0x2caf('0x1a'),_0x6b3778,JSON[_0x2caf('0x14')](_0x3efa4e));_0x20f7d3(_0x3efa4e);})['catch'](function(_0x6a32ac){logger[_0x2caf('0x15')](_0x2caf('0x1a'),_0x6a32ac[_0x2caf('0x17')],_0x6b3778);_0x595f2f(_0x255c08[_0x2caf('0x15')](0x1f4,_0x6a32ac[_0x2caf('0x17')]));});});};exports[_0x2caf('0x23')]=function(_0x135977){return new Promise(function(_0x23f765,_0x2304f1){return db[_0x2caf('0x1b')][_0x2caf('0x24')]({'where':_0x135977[_0x2caf('0x1e')]?_0x135977['options'][_0x2caf('0x20')]||null:null})[_0x2caf('0x22')](function(_0xea9297){if(_0xea9297){return _0xea9297[_0x2caf('0x25')](_0x135977[_0x2caf('0x1d')][_0x2caf('0x26')],_[_0x2caf('0x27')](_0x135977['body'],[_0x2caf('0x26'),'id'])||{});}})[_0x2caf('0x28')](function(_0x5493f4){logger[_0x2caf('0xf')](_0x2caf('0x29'),_0x135977);logger[_0x2caf('0x12')]('AddTags',_0x135977,JSON[_0x2caf('0x14')](_0x5493f4));_0x23f765(_0x5493f4);})['catch'](function(_0x5424ad){logger[_0x2caf('0x15')](_0x2caf('0x29'),_0x5424ad[_0x2caf('0x17')],_0x135977);_0x2304f1(_this[_0x2caf('0x15')](0x1f4,_0x5424ad[_0x2caf('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index d909357..bc72aba 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 _0xed8f=['removeListener','length','./mailInteraction.events','save','remove','update','emit'];(function(_0x13a5eb,_0x566f4b){var _0x5d047b=function(_0x1410fd){while(--_0x1410fd){_0x13a5eb['push'](_0x13a5eb['shift']());}};_0x5d047b(++_0x566f4b);}(_0xed8f,0x9c));var _0xfed8=function(_0x59d13e,_0x1cf33c){_0x59d13e=_0x59d13e-0x0;var _0xf3956b=_0xed8f[_0x59d13e];return _0xf3956b;};'use strict';var MailInteractionEvents=require(_0xfed8('0x0'));var events=[_0xfed8('0x1'),_0xfed8('0x2'),_0xfed8('0x3')];function createListener(_0x526cfd,_0x19c5a6){return function(_0x27ad81){_0x19c5a6[_0xfed8('0x4')](_0x526cfd,_0x27ad81);};}function removeListener(_0x513073,_0x42f0c3){return function(){MailInteractionEvents[_0xfed8('0x5')](_0x513073,_0x42f0c3);};}exports['register']=function(_0x5b9b1d){for(var _0x226fc7=0x0,_0x1badf3=events[_0xfed8('0x6')];_0x226fc7<_0x1badf3;_0x226fc7++){var _0x467ac9=events[_0x226fc7];var _0x4e714b=createListener('mailInteraction:'+_0x467ac9,_0x5b9b1d);MailInteractionEvents['on'](_0x467ac9,_0x4e714b);}}; \ No newline at end of file +var _0xb5ed=['./mailInteraction.events','save','update','emit','removeListener','length','mailInteraction:'];(function(_0x56406d,_0x53ce84){var _0x2b8f2b=function(_0x5707fc){while(--_0x5707fc){_0x56406d['push'](_0x56406d['shift']());}};_0x2b8f2b(++_0x53ce84);}(_0xb5ed,0xd2));var _0xdb5e=function(_0x5232fd,_0x141cd4){_0x5232fd=_0x5232fd-0x0;var _0x342e67=_0xb5ed[_0x5232fd];return _0x342e67;};'use strict';var MailInteractionEvents=require(_0xdb5e('0x0'));var events=[_0xdb5e('0x1'),'remove',_0xdb5e('0x2')];function createListener(_0x432a7c,_0x574328){return function(_0x29a119){_0x574328[_0xdb5e('0x3')](_0x432a7c,_0x29a119);};}function removeListener(_0x344f4c,_0x394df8){return function(){MailInteractionEvents[_0xdb5e('0x4')](_0x344f4c,_0x394df8);};}exports['register']=function(_0x120ce2){for(var _0x8e9402=0x0,_0x39c7b5=events[_0xdb5e('0x5')];_0x8e9402<_0x39c7b5;_0x8e9402++){var _0xa27d97=events[_0x8e9402];var _0x1ed292=createListener(_0xdb5e('0x6')+_0xa27d97,_0x120ce2);MailInteractionEvents['on'](_0xa27d97,_0x1ed292);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index b81103c..feae74f 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 _0x5706=['destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0xbed58e,_0x3a1272){var _0x295e44=function(_0x45755a){while(--_0x45755a){_0xbed58e['push'](_0xbed58e['shift']());}};_0x295e44(++_0x3a1272);}(_0x5706,0xb0));var _0x6570=function(_0x57eb36,_0x1e19ad){_0x57eb36=_0x57eb36-0x0;var _0x2f8d1b=_0x5706[_0x57eb36];return _0x2f8d1b;};'use strict';var multer=require(_0x6570('0x0'));var util=require(_0x6570('0x1'));var path=require(_0x6570('0x2'));var timeout=require('connect-timeout');var express=require(_0x6570('0x3'));var router=express['Router']();var fs_extra=require(_0x6570('0x4'));var auth=require(_0x6570('0x5'));var interaction=require(_0x6570('0x6'));var config=require(_0x6570('0x7'));var controller=require(_0x6570('0x8'));router[_0x6570('0x9')]('/',auth[_0x6570('0xa')](),controller[_0x6570('0xb')]);router[_0x6570('0x9')](_0x6570('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6570('0x9')](_0x6570('0xd'),auth[_0x6570('0xa')](),controller[_0x6570('0xe')]);router[_0x6570('0x9')](_0x6570('0xf'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x6570('0xa')](),interaction[_0x6570('0x10')](_0x6570('0x11'),_0x6570('0x12')),controller[_0x6570('0x13')]);router[_0x6570('0x14')](_0x6570('0xd'),auth[_0x6570('0xa')](),controller[_0x6570('0x15')]);router['put'](_0x6570('0x16'),auth[_0x6570('0xa')](),controller[_0x6570('0x17')]);router[_0x6570('0x14')](_0x6570('0x18'),auth[_0x6570('0xa')](),controller[_0x6570('0x19')]);router[_0x6570('0x1a')](_0x6570('0xd'),auth[_0x6570('0xa')](),controller[_0x6570('0x1b')]);module[_0x6570('0x1c')]=router; \ No newline at end of file +var _0x4ba0=['../../config/environment','isAuthenticated','get','/describe','describe','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id','/:id/reject','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0x4ba0,0xe0));var _0x04ba=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x4ba0[_0x22b68a];return _0x1ac67a;};'use strict';var multer=require(_0x04ba('0x0'));var util=require('util');var path=require(_0x04ba('0x1'));var timeout=require('connect-timeout');var express=require(_0x04ba('0x2'));var router=express[_0x04ba('0x3')]();var fs_extra=require(_0x04ba('0x4'));var auth=require(_0x04ba('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x04ba('0x6'));var controller=require('./mailMessage.controller');router['get']('/',auth[_0x04ba('0x7')](),controller['index']);router[_0x04ba('0x8')](_0x04ba('0x9'),auth[_0x04ba('0x7')](),controller[_0x04ba('0xa')]);router[_0x04ba('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x04ba('0xb')]);router['get'](_0x04ba('0xc'),auth['isAuthenticated'](),controller[_0x04ba('0xd')]);router[_0x04ba('0xe')]('/',auth['isAuthenticated'](),interaction[_0x04ba('0xf')](_0x04ba('0x10'),_0x04ba('0x11')),controller[_0x04ba('0x12')]);router[_0x04ba('0x13')](_0x04ba('0x14'),auth[_0x04ba('0x7')](),controller['update']);router['put']('/:id/accept',auth[_0x04ba('0x7')](),controller['accept']);router['put'](_0x04ba('0x15'),auth[_0x04ba('0x7')](),controller['reject']);router['delete']('/:id',auth[_0x04ba('0x7')](),controller['destroy']);module[_0x04ba('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index eff82c4..6fce1dc 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 _0xe07e=['medium','BOOLEAN','ENUM','out','long','DATE','INTEGER','Email','Chat','sequelize','lodash','exports','TEXT'];(function(_0x277fdc,_0x3169a7){var _0x1b7398=function(_0xb8f5cd){while(--_0xb8f5cd){_0x277fdc['push'](_0x277fdc['shift']());}};_0x1b7398(++_0x3169a7);}(_0xe07e,0x134));var _0xee07=function(_0x61b3ab,_0x1fc298){_0x61b3ab=_0x61b3ab-0x0;var _0x57097f=_0xe07e[_0x61b3ab];return _0x57097f;};'use strict';var Sequelize=require(_0xee07('0x0'));var _=require(_0xee07('0x1'));module[_0xee07('0x2')]={'body':{'type':Sequelize[_0xee07('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xee07('0x3')](_0xee07('0x4'))},'read':{'type':Sequelize[_0xee07('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xee07('0x6')]('in',_0xee07('0x7')),'defaultValue':_0xee07('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0xee07('0x3')]('long')},'bcc':{'type':Sequelize['TEXT'](_0xee07('0x8'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xee07('0x9')]},'attach':{'type':Sequelize[_0xee07('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xee07('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xee07('0x9')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0xee07('0x3')]('long')},'originChannel':{'type':Sequelize['ENUM'](_0xee07('0xb'),_0xee07('0xc')),'defaultValue':_0xee07('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xafd0=['sequelize','lodash','long','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email'];(function(_0x234e1a,_0x500d79){var _0x55aad2=function(_0x272396){while(--_0x272396){_0x234e1a['push'](_0x234e1a['shift']());}};_0x55aad2(++_0x500d79);}(_0xafd0,0xc0));var _0x0afd=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xafd0[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require(_0x0afd('0x0'));var _=require(_0x0afd('0x1'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x0afd('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x0afd('0x3')](_0x0afd('0x4'))},'read':{'type':Sequelize[_0x0afd('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0afd('0x6')]('in',_0x0afd('0x7')),'defaultValue':_0x0afd('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x0afd('0x8')]},'to':{'type':Sequelize[_0x0afd('0x3')]('long')},'cc':{'type':Sequelize['TEXT'](_0x0afd('0x2'))},'bcc':{'type':Sequelize[_0x0afd('0x3')](_0x0afd('0x2'))},'subject':{'type':Sequelize[_0x0afd('0x3')]},'sentAt':{'type':Sequelize[_0x0afd('0x9')]},'attach':{'type':Sequelize[_0x0afd('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x0afd('0x3')]('long')},'originCc':{'type':Sequelize[_0x0afd('0x3')](_0x0afd('0x2'))},'originChannel':{'type':Sequelize[_0x0afd('0x6')](_0x0afd('0xb'),'Chat'),'defaultValue':_0x0afd('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 5b8a837..3ae4387 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 _0xe72d=['UserId','agent','get','MailInteraction','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','accept','fromString','EventManager','acceptmessage','reject','MailInteractionId','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','unix','toString','server','files','join','from','bcc','subject','createdAt','Attachments','headers','Bcc','basename','existsSync','push','readFileSync','build','writeFileSync','download','unlinkSync','moment','util','path','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','show','find','body','params','describe','create','secret','split','findOne','MailAccountId','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','root','server/files/attachments','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt'];(function(_0x7a4c50,_0x10c6d4){var _0x2855cd=function(_0x2ce5a7){while(--_0x2ce5a7){_0x7a4c50['push'](_0x7a4c50['shift']());}};_0x2855cd(++_0x10c6d4);}(_0xe72d,0xda));var _0xde72=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xe72d[_0x342baa];return _0x1208f3;};'use strict';var emlformat=require('eml-format');var moment=require(_0xde72('0x0'));var BPromise=require('bluebird');var util=require(_0xde72('0x1'));var path=require(_0xde72('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xde72('0x3'));var htmlToText=require(_0xde72('0x4'));var qs=require(_0xde72('0x5'));var logger=require('../../config/logger')(_0xde72('0x6'));var interaction_log=require(_0xde72('0x7'))(_0xde72('0x8'));var config=require(_0xde72('0x9'));var db=require(_0xde72('0xa'))['db'];config[_0xde72('0xb')]=_[_0xde72('0xc')](config[_0xde72('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xde72('0xd'))(new Redis(config[_0xde72('0xb')]));var htmlEntities=require(_0xde72('0xe'));require(_0xde72('0xf'))[_0xde72('0x10')](socket);var jayson=require(_0xde72('0x11'));var client=jayson[_0xde72('0x12')][_0xde72('0x13')]({'port':0x232c});var client9003=jayson[_0xde72('0x12')]['http']({'port':0x232b});var client9002=jayson[_0xde72('0x12')][_0xde72('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x337cc5,_0xe33e15,_0x4195a0,_0x45f834){return new BPromise(function(_0x3b4514,_0x2a40d0){var _0x5299bf=_0x45f834||client;return _0x5299bf['request'](_0x337cc5,_0x4195a0)[_0xde72('0x14')](function(_0x166baf){logger[_0xde72('0x15')]('MailMessage,\x20%s,\x20%s',_0xe33e15,_0xde72('0x16'));logger[_0xde72('0x17')](_0xde72('0x18'),_0xe33e15,_0xde72('0x16'),JSON[_0xde72('0x19')](_0x166baf));if(_0x166baf[_0xde72('0x1a')]){if(_0x166baf[_0xde72('0x1a')][_0xde72('0x1b')]===0x1f4){logger[_0xde72('0x1a')]('MailMessage,\x20%s,\x20%s',_0xe33e15,_0x166baf['error'][_0xde72('0x1c')]);return _0x2a40d0(_0x166baf[_0xde72('0x1a')][_0xde72('0x1c')]);}logger[_0xde72('0x1a')](_0xde72('0x1d'),_0xe33e15,_0x166baf[_0xde72('0x1a')]['message']);return _0x3b4514(_0x166baf[_0xde72('0x1a')][_0xde72('0x1c')]);}else{logger[_0xde72('0x15')](_0xde72('0x1d'),_0xe33e15,_0xde72('0x16'));_0x3b4514(_0x166baf[_0xde72('0x1e')][_0xde72('0x1c')]);}})[_0xde72('0x1f')](function(_0x4846e5){logger[_0xde72('0x1a')]('MailMessage,\x20%s,\x20%s',_0xe33e15,_0x4846e5);_0x2a40d0(_0x4846e5);});});}function respondWithResult(_0x1d18c1,_0x4dfc7e){_0x4dfc7e=_0x4dfc7e||0xc8;return function(_0x46d97e){if(_0x46d97e){return _0x1d18c1[_0xde72('0x20')](_0x4dfc7e)[_0xde72('0x21')](_0x46d97e);}};}function respondWithFilteredResult(_0x41a2ca,_0x4d2066){return function(_0x40973d){if(_0x40973d){var _0x1f5e66=typeof _0x4d2066['offset']===_0xde72('0x22')&&typeof _0x4d2066[_0xde72('0x23')]===_0xde72('0x22');var _0x1e47bb=_0x40973d[_0xde72('0x24')];var _0xdc38fc=_0x1f5e66?0x0:_0x4d2066[_0xde72('0x25')];var _0x3dd9f9=_0x1f5e66?_0x40973d[_0xde72('0x24')]:_0x4d2066[_0xde72('0x25')]+_0x4d2066[_0xde72('0x23')];var _0x2ee460;if(_0x3dd9f9>=_0x1e47bb){_0x3dd9f9=_0x1e47bb;_0x2ee460=0xc8;}else{_0x2ee460=0xce;}_0x41a2ca[_0xde72('0x20')](_0x2ee460);return _0x41a2ca[_0xde72('0x26')](_0xde72('0x27'),_0xdc38fc+'-'+_0x3dd9f9+'/'+_0x1e47bb)[_0xde72('0x21')](_0x40973d);}return null;};}function saveUpdates(_0x376152){return function(_0xff06b5){if(_0xff06b5){return _0xff06b5[_0xde72('0x28')](_0x376152)[_0xde72('0x14')](function(_0x15da30){return _0x15da30;});}return null;};}function removeEntity(_0x41171f){return function(_0x3c925e){if(_0x3c925e){return _0x3c925e[_0xde72('0x29')]()[_0xde72('0x14')](function(){_0x41171f[_0xde72('0x20')](0xcc)[_0xde72('0x2a')]();});}};}function handleEntityNotFound(_0xbcf648){return function(_0x28bfd8){if(!_0x28bfd8){_0xbcf648[_0xde72('0x2b')](0x194);}return _0x28bfd8;};}function handleError(_0x4b844f,_0x506d69){_0x506d69=_0x506d69||0x1f4;return function(_0x49cef8){logger['error'](_0x49cef8[_0xde72('0x2c')]);if(_0x49cef8[_0xde72('0x2d')]){delete _0x49cef8[_0xde72('0x2d')];}_0x4b844f['status'](_0x506d69)[_0xde72('0x2e')](_0x49cef8);};}exports[_0xde72('0x2f')]=function(_0x6cd163,_0x2ac8e0){var _0x29a798={},_0x4f48f0={},_0x68e760={'count':0x0,'rows':[]};var _0x21b83b=_[_0xde72('0x30')](db[_0xde72('0x31')][_0xde72('0x32')],function(_0x631573){return{'name':_0x631573['fieldName'],'type':_0x631573['type'][_0xde72('0x33')]};});_0x4f48f0[_0xde72('0x34')]=_[_0xde72('0x30')](_0x21b83b,_0xde72('0x2d'));_0x4f48f0[_0xde72('0x35')]=_[_0xde72('0x36')](_0x6cd163[_0xde72('0x35')]);_0x4f48f0['filters']=_[_0xde72('0x37')](_0x4f48f0['model'],_0x4f48f0[_0xde72('0x35')]);_0x29a798['attributes']=_[_0xde72('0x37')](_0x4f48f0[_0xde72('0x34')],qs[_0xde72('0x38')](_0x6cd163[_0xde72('0x35')][_0xde72('0x38')]));_0x29a798['attributes']=_0x29a798[_0xde72('0x39')][_0xde72('0x3a')]?_0x29a798[_0xde72('0x39')]:_0x4f48f0['model'];if(!_0x6cd163[_0xde72('0x35')]['hasOwnProperty'](_0xde72('0x3b'))){_0x29a798[_0xde72('0x23')]=qs[_0xde72('0x23')](_0x6cd163[_0xde72('0x35')]['limit']);_0x29a798[_0xde72('0x25')]=qs['offset'](_0x6cd163[_0xde72('0x35')][_0xde72('0x25')]);}_0x29a798[_0xde72('0x3c')]=qs[_0xde72('0x3d')](_0x6cd163[_0xde72('0x35')][_0xde72('0x3d')]);_0x29a798['where']=qs[_0xde72('0x3e')](_[_0xde72('0x3f')](_0x6cd163['query'],_0x4f48f0[_0xde72('0x3e')]),_0x21b83b);if(_0x6cd163['query'][_0xde72('0x40')]){_0x29a798[_0xde72('0x41')]=_[_0xde72('0x42')](_0x29a798[_0xde72('0x41')],{'$or':_[_0xde72('0x30')](_0x21b83b,function(_0x5e7cde){if(_0x5e7cde[_0xde72('0x43')]!=='VIRTUAL'){var _0x21cbbc={};_0x21cbbc[_0x5e7cde[_0xde72('0x2d')]]={'$like':'%'+_0x6cd163[_0xde72('0x35')][_0xde72('0x40')]+'%'};return _0x21cbbc;}})});}_0x29a798=_[_0xde72('0x42')]({},_0x29a798,_0x6cd163[_0xde72('0x44')]);var _0x49a343={'where':_0x29a798['where']};return db[_0xde72('0x31')][_0xde72('0x24')](_0x49a343)[_0xde72('0x14')](function(_0x4cf7ee){_0x68e760['count']=_0x4cf7ee;if(_0x6cd163['query'][_0xde72('0x45')]){_0x29a798[_0xde72('0x46')]=[{'all':!![]}];}return db[_0xde72('0x31')][_0xde72('0x47')](_0x29a798);})[_0xde72('0x14')](function(_0x24da94){_0x68e760[_0xde72('0x48')]=_0x24da94;return _0x68e760;})['then'](respondWithFilteredResult(_0x2ac8e0,_0x29a798))[_0xde72('0x1f')](handleError(_0x2ac8e0,null));};exports[_0xde72('0x49')]=function(_0x2ec4ad,_0x17b3e4){var _0x5177fc={'raw':!![],'where':{'id':_0x2ec4ad['params']['id']}},_0x378dfe={};_0x378dfe['model']=_[_0xde72('0x36')](db['MailMessage'][_0xde72('0x32')]);_0x378dfe[_0xde72('0x35')]=_[_0xde72('0x36')](_0x2ec4ad[_0xde72('0x35')]);_0x378dfe[_0xde72('0x3e')]=_[_0xde72('0x37')](_0x378dfe[_0xde72('0x34')],_0x378dfe[_0xde72('0x35')]);_0x5177fc[_0xde72('0x39')]=_['intersection'](_0x378dfe['model'],qs['fields'](_0x2ec4ad[_0xde72('0x35')][_0xde72('0x38')]));_0x5177fc[_0xde72('0x39')]=_0x5177fc[_0xde72('0x39')]['length']?_0x5177fc[_0xde72('0x39')]:_0x378dfe[_0xde72('0x34')];if(_0x2ec4ad[_0xde72('0x35')][_0xde72('0x45')]){_0x5177fc[_0xde72('0x46')]=[{'all':!![]}];}_0x5177fc=_['merge']({},_0x5177fc,_0x2ec4ad['options']);return db[_0xde72('0x31')][_0xde72('0x4a')](_0x5177fc)[_0xde72('0x14')](handleEntityNotFound(_0x17b3e4,null))[_0xde72('0x14')](respondWithResult(_0x17b3e4,null))[_0xde72('0x1f')](handleError(_0x17b3e4,null));};exports[_0xde72('0x28')]=function(_0x125fc9,_0x48f047){if(_0x125fc9['body']['id']){delete _0x125fc9[_0xde72('0x4b')]['id'];}return db[_0xde72('0x31')][_0xde72('0x4a')]({'where':{'id':_0x125fc9[_0xde72('0x4c')]['id']}})[_0xde72('0x14')](handleEntityNotFound(_0x48f047,null))[_0xde72('0x14')](saveUpdates(_0x125fc9[_0xde72('0x4b')],null))[_0xde72('0x14')](respondWithResult(_0x48f047,null))[_0xde72('0x1f')](handleError(_0x48f047,null));};exports[_0xde72('0x29')]=function(_0x315711,_0x314f48){return db[_0xde72('0x31')][_0xde72('0x4a')]({'where':{'id':_0x315711[_0xde72('0x4c')]['id']}})[_0xde72('0x14')](handleEntityNotFound(_0x314f48,null))[_0xde72('0x14')](removeEntity(_0x314f48,null))[_0xde72('0x1f')](handleError(_0x314f48,null));};exports['describe']=function(_0x1a29ed,_0x3b5139){return db[_0xde72('0x31')][_0xde72('0x4d')]()['then'](respondWithResult(_0x3b5139,null))['catch'](handleError(_0x3b5139,null));};exports[_0xde72('0x4e')]=function(_0x492ea0,_0x4a9332){return db['MailMessage']['create'](_0x492ea0[_0xde72('0x4b')])[_0xde72('0x14')](function(_0x1d4aad){if(_0x1d4aad){if(_0x1d4aad['direction']==='out'&&!_0x1d4aad[_0xde72('0x4f')]){var _0x147b47,_0xf4a85d,_0x555013;if(_0x492ea0[_0xde72('0x4b')]['to']){_0xf4a85d=_0x492ea0[_0xde72('0x4b')]['to'][_0xde72('0x50')](',')[0x0];}return db['MailAccount'][_0xde72('0x51')]({'where':{'id':_0x1d4aad[_0xde72('0x52')]},'include':[{'model':db['CmList'],'as':_0xde72('0x53'),'include':[{'model':db[_0xde72('0x54')],'as':_0xde72('0x55'),'where':{'email':_0xf4a85d},'limit':0x1,'order':[[_0xde72('0x56'),_0xde72('0x57')]]}]},{'model':db[_0xde72('0x58')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xde72('0x59')],'as':_0xde72('0x59'),'raw':!![]}]}]})[_0xde72('0x14')](function(_0x475acb){_0x147b47=_0x475acb;if(!_0x147b47||!_0x147b47[_0xde72('0x5a')])return;var _0x1e3ffb=_0x147b47[_0xde72('0x5b')]();if(_0x492ea0[_0xde72('0x4b')][_0xde72('0x5c')]&&_0x492ea0[_0xde72('0x4b')][_0xde72('0x5c')]['length']){for(var _0x5c0277=0x0;_0x5c0277<_0x492ea0[_0xde72('0x4b')][_0xde72('0x5c')][_0xde72('0x3a')];_0x5c0277+=0x1){_0x492ea0['body'][_0xde72('0x5c')][_0x5c0277]={'filename':_0x492ea0[_0xde72('0x4b')]['attachments'][_0x5c0277]['name'],'path':path['join'](config[_0xde72('0x5d')],_0xde72('0x5e'),_0x492ea0[_0xde72('0x4b')][_0xde72('0x5c')][_0x5c0277]['basename'])};}}_0x555013={'account':_0x1e3ffb,'message':_0x492ea0[_0xde72('0x4b')]};return;})['then'](function(){if(_0x147b47[_0xde72('0x53')]){if(_0x147b47[_0xde72('0x53')][_0xde72('0x55')][_0xde72('0x3a')]){return _0x147b47[_0xde72('0x53')][_0xde72('0x55')][0x0];}else{return db[_0xde72('0x54')]['create'](_[_0xde72('0xc')](_0x492ea0['body'],{'firstName':_0x492ea0['body']['to'],'email':_0x492ea0[_0xde72('0x4b')]['to'],'phone':_0x492ea0[_0xde72('0x4b')]['to'],'ListId':_0x147b47['ListId']}));}}else{throw new Error(_0xde72('0x5f'));}})['then'](function(){if(_0x555013){return respondWithRpcPromise(_0xde72('0x60'),_0xde72('0x61'),_0x555013,client9003)[_0xde72('0x14')](function(_0x31e940){return _0x1d4aad['update']({'read':!![],'messageId':_0x31e940[_0xde72('0x62')],'sentAt':moment()[_0xde72('0x63')](_0xde72('0x64'))});})[_0xde72('0x1f')](function(_0x37ddb6){logger['error']('%s',JSON[_0xde72('0x19')](_0x37ddb6));return _0x1d4aad;});}return _0x1d4aad;});}return _0x1d4aad;}})[_0xde72('0x14')](respondWithResult(_0x4a9332,0xc9))[_0xde72('0x1f')](handleError(_0x4a9332,null));};exports['accept']=function(_0xeb707d,_0x296c97){var _0x2a53df={'agent':{},'channel':_0xde72('0x65')};if(_0xeb707d[_0xde72('0x4b')]['id']){delete _0xeb707d[_0xde72('0x4b')]['id'];}_0xeb707d[_0xde72('0x4b')][_0xde72('0x66')]=!![];_0xeb707d['body'][_0xde72('0x67')]=moment()['format'](_0xde72('0x64'));_0xeb707d[_0xde72('0x4b')][_0xde72('0x68')]=_0xeb707d['body']['UserId']||_0xeb707d['user']['id'];_0x2a53df[_0xde72('0x69')]['id']=_0xeb707d[_0xde72('0x4b')][_0xde72('0x68')];return db[_0xde72('0x31')][_0xde72('0x4a')]({'where':{'id':_0xeb707d[_0xde72('0x4c')]['id'],'UserId':null}})[_0xde72('0x14')](handleEntityNotFound(_0x296c97,null))[_0xde72('0x14')](saveUpdates(_0xeb707d[_0xde72('0x4b')],null))['then'](function(_0x2c49a4){if(_0x2c49a4){_0x2a53df['message']=_0x2c49a4[_0xde72('0x6a')]({'plain':!![]});return db[_0xde72('0x6b')][_0xde72('0x4a')]({'where':{'id':_0x2c49a4['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x296c97,null))[_0xde72('0x14')](function(_0xfb39b6){if(_0xfb39b6){return _0xfb39b6[_0xde72('0x28')]({'UserId':_0xeb707d[_0xde72('0x4b')]['UserId'],'read1stAt':_['isNil'](_0xfb39b6[_0xde72('0x6c')])?moment()['format'](_0xde72('0x64')):undefined});}return null;})['then'](function(_0x3972ba){if(_0x3972ba){_0x2a53df['interaction']=_0x3972ba[_0xde72('0x6a')]({'plain':!![]});interaction_log[_0xde72('0x15')](_0xde72('0x6d'),_0xeb707d[_0xde72('0x6e')]['id'],_0xeb707d['user']['name'],_0xeb707d[_0xde72('0x6e')][_0xde72('0x6f')],_0x2a53df['interaction']['id'],_0xeb707d[_0xde72('0x4b')]?JSON['stringify'](_0xeb707d[_0xde72('0x4b')]):_0xde72('0x70'));return respondWithRpcPromise(_0xde72('0x71'),_0xde72('0x72'),_0x2a53df);}return null;})[_0xde72('0x14')](function(_0x36cded){var _0x24e708=_0xde72('0x73')+_0x36cded[_0xde72('0x1c')][_0xde72('0x74')];return db['sequelize'][_0xde72('0x35')](_0x24e708,{'type':db[_0xde72('0x75')][_0xde72('0x76')][_0xde72('0x77')],'raw':!![]})[_0xde72('0x14')](function(_0xada7a1){return _0xada7a1;});})[_0xde72('0x14')](function(_0x1157ce){if(_0x1157ce){_0x2a53df[_0xde72('0x1c')][_0xde72('0x78')]=_0x1157ce[0x0];if(!_0xeb707d[_0xde72('0x4b')][_0xde72('0x68')])return;return db[_0xde72('0x79')][_0xde72('0x4a')]({'where':{'id':_0xeb707d[_0xde72('0x4b')]['UserId'],'role':_0xde72('0x69')},'attributes':['id',_0xde72('0x2d'),_0xde72('0x7a'),_0xde72('0x7b'),_0xde72('0x7c')],'raw':!![]});}return null;})[_0xde72('0x14')](function(_0x4dffd4){if(!_0x4dffd4)return null;_0x2a53df[_0xde72('0x1c')]['agent']=_0x4dffd4;return _0x2a53df;})['then'](function(_0x1008c8){if(_0x1008c8){if(_0xeb707d[_0xde72('0x4b')][_0xde72('0x7d')]){_0x2a53df[_0xde72('0x1c')][_0xde72('0x7e')]=util[_0xde72('0x63')]('SIP/%s',_0xeb707d[_0xde72('0x6e')][_0xde72('0x2d')]);_0x2a53df[_0xde72('0x1c')][_0xde72('0x7f')]=_0x2a53df[_0xde72('0x7f')];_0x2a53df[_0xde72('0x1c')][_0xde72('0x80')]=_0x2a53df[_0xde72('0x7f')];_0x2a53df[_0xde72('0x1c')][_0xde72('0x81')]=_0xde72('0x82');_0x2a53df[_0xde72('0x1c')]['body']=htmlToText[_0xde72('0x83')](_0x2a53df[_0xde72('0x1c')]['body']);return respondWithRpcPromise(_0xde72('0x84'),_0xde72('0x84'),{'event':_0xde72('0x85'),'message':_0x2a53df[_0xde72('0x1c')]},client9002)[_0xde72('0x14')](function(){return _0x2a53df;});}return _0x2a53df;}return null;})[_0xde72('0x14')](respondWithResult(_0x296c97,null))[_0xde72('0x1f')](handleError(_0x296c97,null));};exports[_0xde72('0x86')]=function(_0x54ecff,_0x266c46){var _0x28356f={'agent':{},'channel':_0xde72('0x65')};if(_0x54ecff[_0xde72('0x4b')]['id']){delete _0x54ecff[_0xde72('0x4b')]['id'];}_0x54ecff[_0xde72('0x4b')][_0xde72('0x68')]=_0x54ecff[_0xde72('0x4b')][_0xde72('0x68')]||_0x54ecff[_0xde72('0x6e')]['id'];_0x28356f['agent']['id']=_0x54ecff[_0xde72('0x4b')]['UserId'];return db['MailMessage'][_0xde72('0x4a')]({'where':{'id':_0x54ecff[_0xde72('0x4c')]['id'],'UserId':null}})[_0xde72('0x14')](handleEntityNotFound(_0x266c46,null))[_0xde72('0x14')](function(_0x365d8c){if(_0x365d8c){_0x28356f[_0xde72('0x1c')]=_0x365d8c[_0xde72('0x6a')]({'plain':!![]});return db[_0xde72('0x6b')]['find']({'where':{'id':_0x365d8c[_0xde72('0x87')]}});}return null;})[_0xde72('0x14')](handleEntityNotFound(_0x266c46,null))[_0xde72('0x14')](function(_0x1f3241){if(_0x1f3241){_0x28356f[_0xde72('0x88')]=_0x1f3241['get']({'plain':!![]});interaction_log[_0xde72('0x15')](_0xde72('0x89'),_0x54ecff[_0xde72('0x6e')]['id'],_0x54ecff['user']['name'],_0x54ecff['user'][_0xde72('0x6f')],_0x28356f[_0xde72('0x88')]['id'],_0x54ecff['body']?JSON[_0xde72('0x19')](_0x54ecff[_0xde72('0x4b')]):_0xde72('0x70'));return respondWithRpcPromise(_0xde72('0x8a'),_0xde72('0x8b'),_0x28356f);}return null;})['then'](function(_0x6605d2){var _0x3ac37d=_0xde72('0x73')+_0x6605d2[_0xde72('0x1c')][_0xde72('0x74')];return db['sequelize']['query'](_0x3ac37d,{'type':db[_0xde72('0x75')][_0xde72('0x76')][_0xde72('0x77')],'raw':!![]})['then'](function(_0x5b2dc2){return _0x5b2dc2;});})['then'](function(_0x444548){if(_0x444548){_0x28356f[_0xde72('0x1c')][_0xde72('0x78')]=_0x444548[0x0];if(!_0x54ecff[_0xde72('0x4b')][_0xde72('0x68')])return;return db[_0xde72('0x79')]['find']({'where':{'id':_0x54ecff['body'][_0xde72('0x68')],'role':'agent'},'attributes':['id',_0xde72('0x2d'),'fullname',_0xde72('0x7b'),_0xde72('0x7c')],'raw':!![]});}return null;})['then'](function(_0xfb7374){if(!_0xfb7374)return null;_0x28356f['message'][_0xde72('0x69')]=_0xfb7374;return _0x28356f;})[_0xde72('0x14')](function(_0x5db359){if(_0x5db359){_0x5db359[_0xde72('0x1c')][_0xde72('0x7e')]=util[_0xde72('0x63')]('SIP/%s',_0x54ecff[_0xde72('0x6e')][_0xde72('0x2d')]);_0x5db359[_0xde72('0x1c')][_0xde72('0x7f')]=_0x28356f[_0xde72('0x7f')];_0x5db359[_0xde72('0x1c')][_0xde72('0x80')]=_0x28356f['channel'];_0x5db359[_0xde72('0x1c')]['event']=_0xde72('0x86');_0x5db359['message']['body']=htmlToText[_0xde72('0x83')](_0x28356f['message'][_0xde72('0x4b')]);respondWithRpcPromise('EventManager',_0xde72('0x84'),{'event':_0xde72('0x8c'),'message':_0x5db359[_0xde72('0x1c')]},client9002);return _0x28356f;}return null;})['then'](respondWithResult(_0x266c46,null))['catch'](handleError(_0x266c46,null));};exports['download']=function(_0x5431ff,_0x568ee3){var _0x542529=moment()[_0xde72('0x8d')]()[_0xde72('0x8e')]();var _0x2c3e23=path['join'](config[_0xde72('0x5d')],_0xde72('0x8f'),_0xde72('0x90'),'tmp');var _0x190a4a=path[_0xde72('0x91')](config[_0xde72('0x5d')],'server',_0xde72('0x90'),_0xde72('0x5c'));var _0x4ad703=util[_0xde72('0x63')]('message-%s.eml',_0x542529);return db[_0xde72('0x31')][_0xde72('0x4a')]({'where':{'id':_0x5431ff['params']['id']},'attributes':['id',_0xde72('0x4b'),_0xde72('0x92'),'to','cc',_0xde72('0x93'),_0xde72('0x94'),_0xde72('0x95')],'include':_0x5431ff[_0xde72('0x35')][_0xde72('0x5c')]?[{'model':db['Attachment'],'as':_0xde72('0x96')}]:undefined})[_0xde72('0x14')](handleEntityNotFound(_0x568ee3,null))[_0xde72('0x14')](function(_0x4a0d18){if(_0x4a0d18){var _0x50139d=_0x4a0d18;var _0x429e18={'from':_0x50139d[_0xde72('0x92')],'to':_0x50139d['to'],'subject':_0x50139d[_0xde72('0x94')],'html':htmlEntities['decode'](_0x50139d['body']),'headers':{'Date':moment(_0x50139d[_0xde72('0x95')])[_0xde72('0x63')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x4a0d18['cc']){_0x429e18[_0xde72('0x97')]['Cc']=_0x4a0d18['cc'];}if(_0x4a0d18['bcc']){_0x429e18[_0xde72('0x97')][_0xde72('0x98')]=_0x4a0d18[_0xde72('0x93')];}return new BPromise(function(_0x4fbd52,_0xa4134f){if(_0x4a0d18[_0xde72('0x96')]){for(var _0x4c3cb8=0x0;_0x4c3cb8<_0x4a0d18[_0xde72('0x96')][_0xde72('0x3a')];_0x4c3cb8++){var _0x38d322=_0x4a0d18['Attachments'][_0x4c3cb8];var _0x2a3e12=path[_0xde72('0x91')](_0x190a4a,_0x38d322[_0xde72('0x99')]);if(fs[_0xde72('0x9a')](_0x2a3e12)){_0x429e18[_0xde72('0x5c')][_0xde72('0x9b')]({'name':_0x38d322[_0xde72('0x2d')],'contentType':_0x38d322[_0xde72('0x43')],'data':fs[_0xde72('0x9c')](_0x2a3e12)});}}}emlformat[_0xde72('0x9d')](_0x429e18,function(_0x44aff9,_0x1e5a7d){if(_0x44aff9)return _0xa4134f(_0x44aff9);fs[_0xde72('0x9e')](path[_0xde72('0x91')](_0x2c3e23,_0x4ad703),_0x1e5a7d);return _0x4fbd52(_0x1e5a7d);});});}})[_0xde72('0x14')](function(_0x531c52){if(_0x531c52){return _0x568ee3[_0xde72('0x9f')](path['join'](_0x2c3e23,_0x4ad703),_0x4ad703,function(_0x1ea0c1){if(!_0x1ea0c1)fs[_0xde72('0xa0')](path[_0xde72('0x91')](_0x2c3e23,_0x4ad703));});}})[_0xde72('0x1f')](handleError(_0x568ee3,null));}; \ No newline at end of file +var _0x5a90=['YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','UserId','user','agent','get','MailInteraction','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','User','reject','fromString','rejectmessage','unix','toString','server','files','message-%s.eml','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise','client','http','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','offset','limit','set','Content-Range','json','update','destroy','end','stack','name','index','map','MailMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','describe','create','out','secret','MailAccount','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','join','root','basename','defaults','ListId','SendMail','messageId','format'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x5a90,0x17a));var _0x05a9=function(_0x292c7c,_0x4586c9){_0x292c7c=_0x292c7c-0x0;var _0x3f403a=_0x5a90[_0x292c7c];return _0x3f403a;};'use strict';var emlformat=require(_0x05a9('0x0'));var moment=require(_0x05a9('0x1'));var BPromise=require(_0x05a9('0x2'));var util=require(_0x05a9('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x05a9('0x4'));var Redis=require(_0x05a9('0x5'));var htmlToText=require(_0x05a9('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x05a9('0x7'))(_0x05a9('0x8'));var interaction_log=require('../../config/logger')(_0x05a9('0x9'));var config=require(_0x05a9('0xa'));var db=require(_0x05a9('0xb'))['db'];config[_0x05a9('0xc')]=_['defaults'](config['redis'],{'host':_0x05a9('0xd'),'port':0x18eb});var socket=require(_0x05a9('0xe'))(new Redis(config[_0x05a9('0xc')]));var htmlEntities=require(_0x05a9('0xf'));require(_0x05a9('0x10'))['register'](socket);var jayson=require(_0x05a9('0x11'));var client=jayson[_0x05a9('0x12')]['http']({'port':0x232c});var client9003=jayson[_0x05a9('0x12')][_0x05a9('0x13')]({'port':0x232b});var client9002=jayson[_0x05a9('0x12')][_0x05a9('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x33bfda,_0x2115ea,_0x34fdae,_0x1a349a){return new BPromise(function(_0x843c4b,_0x27ea05){var _0x34e8f7=_0x1a349a||client;return _0x34e8f7[_0x05a9('0x14')](_0x33bfda,_0x34fdae)[_0x05a9('0x15')](function(_0x3f2376){logger[_0x05a9('0x16')]('MailMessage,\x20%s,\x20%s',_0x2115ea,_0x05a9('0x17'));logger['debug'](_0x05a9('0x18'),_0x2115ea,_0x05a9('0x17'),JSON[_0x05a9('0x19')](_0x3f2376));if(_0x3f2376['error']){if(_0x3f2376[_0x05a9('0x1a')][_0x05a9('0x1b')]===0x1f4){logger[_0x05a9('0x1a')](_0x05a9('0x1c'),_0x2115ea,_0x3f2376[_0x05a9('0x1a')][_0x05a9('0x1d')]);return _0x27ea05(_0x3f2376[_0x05a9('0x1a')][_0x05a9('0x1d')]);}logger[_0x05a9('0x1a')](_0x05a9('0x1c'),_0x2115ea,_0x3f2376[_0x05a9('0x1a')]['message']);return _0x843c4b(_0x3f2376[_0x05a9('0x1a')][_0x05a9('0x1d')]);}else{logger[_0x05a9('0x16')]('MailMessage,\x20%s,\x20%s',_0x2115ea,'request\x20sent');_0x843c4b(_0x3f2376[_0x05a9('0x1e')][_0x05a9('0x1d')]);}})[_0x05a9('0x1f')](function(_0x42848a){logger[_0x05a9('0x1a')]('MailMessage,\x20%s,\x20%s',_0x2115ea,_0x42848a);_0x27ea05(_0x42848a);});});}function respondWithResult(_0x58133f,_0x4c4e41){_0x4c4e41=_0x4c4e41||0xc8;return function(_0x31acc3){if(_0x31acc3){return _0x58133f[_0x05a9('0x20')](_0x4c4e41)['json'](_0x31acc3);}};}function respondWithFilteredResult(_0x3c6532,_0xe2496){return function(_0x2e504e){if(_0x2e504e){var _0x49e88e=typeof _0xe2496[_0x05a9('0x21')]==='undefined'&&typeof _0xe2496[_0x05a9('0x22')]==='undefined';var _0x4e048a=_0x2e504e['count'];var _0x452f1d=_0x49e88e?0x0:_0xe2496[_0x05a9('0x21')];var _0x7b476d=_0x49e88e?_0x2e504e['count']:_0xe2496['offset']+_0xe2496[_0x05a9('0x22')];var _0x8ac32d;if(_0x7b476d>=_0x4e048a){_0x7b476d=_0x4e048a;_0x8ac32d=0xc8;}else{_0x8ac32d=0xce;}_0x3c6532[_0x05a9('0x20')](_0x8ac32d);return _0x3c6532[_0x05a9('0x23')](_0x05a9('0x24'),_0x452f1d+'-'+_0x7b476d+'/'+_0x4e048a)[_0x05a9('0x25')](_0x2e504e);}return null;};}function saveUpdates(_0x519f0c){return function(_0x3d5190){if(_0x3d5190){return _0x3d5190[_0x05a9('0x26')](_0x519f0c)[_0x05a9('0x15')](function(_0x3f1263){return _0x3f1263;});}return null;};}function removeEntity(_0xc37580){return function(_0x59e304){if(_0x59e304){return _0x59e304[_0x05a9('0x27')]()[_0x05a9('0x15')](function(){_0xc37580['status'](0xcc)[_0x05a9('0x28')]();});}};}function handleEntityNotFound(_0x2ec395){return function(_0x4bbe1f){if(!_0x4bbe1f){_0x2ec395['sendStatus'](0x194);}return _0x4bbe1f;};}function handleError(_0x40f77d,_0x2155ae){_0x2155ae=_0x2155ae||0x1f4;return function(_0x382876){logger[_0x05a9('0x1a')](_0x382876[_0x05a9('0x29')]);if(_0x382876[_0x05a9('0x2a')]){delete _0x382876[_0x05a9('0x2a')];}_0x40f77d[_0x05a9('0x20')](_0x2155ae)['send'](_0x382876);};}exports[_0x05a9('0x2b')]=function(_0x5a1a75,_0x429b68){var _0x201f75={},_0x2ffe3d={},_0x24c001={'count':0x0,'rows':[]};var _0x37a143=_[_0x05a9('0x2c')](db[_0x05a9('0x2d')]['rawAttributes'],function(_0x583a03){return{'name':_0x583a03[_0x05a9('0x2e')],'type':_0x583a03[_0x05a9('0x2f')][_0x05a9('0x30')]};});_0x2ffe3d[_0x05a9('0x31')]=_[_0x05a9('0x2c')](_0x37a143,_0x05a9('0x2a'));_0x2ffe3d[_0x05a9('0x32')]=_[_0x05a9('0x33')](_0x5a1a75[_0x05a9('0x32')]);_0x2ffe3d[_0x05a9('0x34')]=_[_0x05a9('0x35')](_0x2ffe3d[_0x05a9('0x31')],_0x2ffe3d[_0x05a9('0x32')]);_0x201f75[_0x05a9('0x36')]=_[_0x05a9('0x35')](_0x2ffe3d[_0x05a9('0x31')],qs['fields'](_0x5a1a75['query'][_0x05a9('0x37')]));_0x201f75['attributes']=_0x201f75[_0x05a9('0x36')][_0x05a9('0x38')]?_0x201f75[_0x05a9('0x36')]:_0x2ffe3d[_0x05a9('0x31')];if(!_0x5a1a75[_0x05a9('0x32')][_0x05a9('0x39')](_0x05a9('0x3a'))){_0x201f75[_0x05a9('0x22')]=qs['limit'](_0x5a1a75[_0x05a9('0x32')][_0x05a9('0x22')]);_0x201f75[_0x05a9('0x21')]=qs[_0x05a9('0x21')](_0x5a1a75[_0x05a9('0x32')][_0x05a9('0x21')]);}_0x201f75[_0x05a9('0x3b')]=qs['sort'](_0x5a1a75[_0x05a9('0x32')][_0x05a9('0x3c')]);_0x201f75['where']=qs[_0x05a9('0x34')](_[_0x05a9('0x3d')](_0x5a1a75[_0x05a9('0x32')],_0x2ffe3d['filters']),_0x37a143);if(_0x5a1a75[_0x05a9('0x32')][_0x05a9('0x3e')]){_0x201f75[_0x05a9('0x3f')]=_[_0x05a9('0x40')](_0x201f75[_0x05a9('0x3f')],{'$or':_[_0x05a9('0x2c')](_0x37a143,function(_0x2b2f69){if(_0x2b2f69[_0x05a9('0x2f')]!==_0x05a9('0x41')){var _0x9e6634={};_0x9e6634[_0x2b2f69[_0x05a9('0x2a')]]={'$like':'%'+_0x5a1a75['query'][_0x05a9('0x3e')]+'%'};return _0x9e6634;}})});}_0x201f75=_[_0x05a9('0x40')]({},_0x201f75,_0x5a1a75[_0x05a9('0x42')]);var _0x5eed65={'where':_0x201f75['where']};return db[_0x05a9('0x2d')]['count'](_0x5eed65)[_0x05a9('0x15')](function(_0x391fe4){_0x24c001[_0x05a9('0x43')]=_0x391fe4;if(_0x5a1a75[_0x05a9('0x32')][_0x05a9('0x44')]){_0x201f75[_0x05a9('0x45')]=[{'all':!![]}];}return db[_0x05a9('0x2d')][_0x05a9('0x46')](_0x201f75);})[_0x05a9('0x15')](function(_0x2b2ba9){_0x24c001[_0x05a9('0x47')]=_0x2b2ba9;return _0x24c001;})['then'](respondWithFilteredResult(_0x429b68,_0x201f75))[_0x05a9('0x1f')](handleError(_0x429b68,null));};exports[_0x05a9('0x48')]=function(_0x436418,_0x49c903){var _0x53bd4c={'raw':!![],'where':{'id':_0x436418[_0x05a9('0x49')]['id']}},_0x4efbcf={};_0x4efbcf[_0x05a9('0x31')]=_[_0x05a9('0x33')](db['MailMessage'][_0x05a9('0x4a')]);_0x4efbcf['query']=_['keys'](_0x436418['query']);_0x4efbcf[_0x05a9('0x34')]=_[_0x05a9('0x35')](_0x4efbcf[_0x05a9('0x31')],_0x4efbcf[_0x05a9('0x32')]);_0x53bd4c[_0x05a9('0x36')]=_['intersection'](_0x4efbcf['model'],qs['fields'](_0x436418['query'][_0x05a9('0x37')]));_0x53bd4c[_0x05a9('0x36')]=_0x53bd4c[_0x05a9('0x36')][_0x05a9('0x38')]?_0x53bd4c[_0x05a9('0x36')]:_0x4efbcf[_0x05a9('0x31')];if(_0x436418[_0x05a9('0x32')][_0x05a9('0x44')]){_0x53bd4c[_0x05a9('0x45')]=[{'all':!![]}];}_0x53bd4c=_[_0x05a9('0x40')]({},_0x53bd4c,_0x436418[_0x05a9('0x42')]);return db['MailMessage'][_0x05a9('0x4b')](_0x53bd4c)[_0x05a9('0x15')](handleEntityNotFound(_0x49c903,null))[_0x05a9('0x15')](respondWithResult(_0x49c903,null))[_0x05a9('0x1f')](handleError(_0x49c903,null));};exports[_0x05a9('0x26')]=function(_0xc47d15,_0x499454){if(_0xc47d15['body']['id']){delete _0xc47d15[_0x05a9('0x4c')]['id'];}return db[_0x05a9('0x2d')][_0x05a9('0x4b')]({'where':{'id':_0xc47d15[_0x05a9('0x49')]['id']}})[_0x05a9('0x15')](handleEntityNotFound(_0x499454,null))['then'](saveUpdates(_0xc47d15[_0x05a9('0x4c')],null))[_0x05a9('0x15')](respondWithResult(_0x499454,null))[_0x05a9('0x1f')](handleError(_0x499454,null));};exports[_0x05a9('0x27')]=function(_0x1bccc0,_0x24fd96){return db[_0x05a9('0x2d')][_0x05a9('0x4b')]({'where':{'id':_0x1bccc0[_0x05a9('0x49')]['id']}})[_0x05a9('0x15')](handleEntityNotFound(_0x24fd96,null))[_0x05a9('0x15')](removeEntity(_0x24fd96,null))[_0x05a9('0x1f')](handleError(_0x24fd96,null));};exports[_0x05a9('0x4d')]=function(_0xd0fb1e,_0xecbea9){return db[_0x05a9('0x2d')][_0x05a9('0x4d')]()[_0x05a9('0x15')](respondWithResult(_0xecbea9,null))[_0x05a9('0x1f')](handleError(_0xecbea9,null));};exports[_0x05a9('0x4e')]=function(_0x340202,_0x5a1086){return db[_0x05a9('0x2d')][_0x05a9('0x4e')](_0x340202[_0x05a9('0x4c')])[_0x05a9('0x15')](function(_0x1c0a85){if(_0x1c0a85){if(_0x1c0a85['direction']===_0x05a9('0x4f')&&!_0x1c0a85[_0x05a9('0x50')]){var _0xaada8a,_0x21ade3,_0x3e217f;if(_0x340202[_0x05a9('0x4c')]['to']){_0x21ade3=_0x340202[_0x05a9('0x4c')]['to']['split'](',')[0x0];}return db[_0x05a9('0x51')][_0x05a9('0x52')]({'where':{'id':_0x1c0a85['MailAccountId']},'include':[{'model':db[_0x05a9('0x53')],'as':_0x05a9('0x54'),'include':[{'model':db[_0x05a9('0x55')],'as':_0x05a9('0x56'),'where':{'email':_0x21ade3},'limit':0x1,'order':[[_0x05a9('0x57'),_0x05a9('0x58')]]}]},{'model':db[_0x05a9('0x59')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x05a9('0x5a'),'raw':!![]}]}]})['then'](function(_0x1c839c){_0xaada8a=_0x1c839c;if(!_0xaada8a||!_0xaada8a[_0x05a9('0x5b')])return;var _0x577f0c=_0xaada8a[_0x05a9('0x5c')]();if(_0x340202[_0x05a9('0x4c')][_0x05a9('0x5d')]&&_0x340202['body'][_0x05a9('0x5d')]['length']){for(var _0x38653d=0x0;_0x38653d<_0x340202['body']['attachments'][_0x05a9('0x38')];_0x38653d+=0x1){_0x340202[_0x05a9('0x4c')][_0x05a9('0x5d')][_0x38653d]={'filename':_0x340202[_0x05a9('0x4c')][_0x05a9('0x5d')][_0x38653d]['name'],'path':path[_0x05a9('0x5e')](config[_0x05a9('0x5f')],'server/files/attachments',_0x340202[_0x05a9('0x4c')][_0x05a9('0x5d')][_0x38653d][_0x05a9('0x60')])};}}_0x3e217f={'account':_0x577f0c,'message':_0x340202[_0x05a9('0x4c')]};return;})[_0x05a9('0x15')](function(){if(_0xaada8a[_0x05a9('0x54')]){if(_0xaada8a['List'][_0x05a9('0x56')][_0x05a9('0x38')]){return _0xaada8a[_0x05a9('0x54')][_0x05a9('0x56')][0x0];}else{return db[_0x05a9('0x55')][_0x05a9('0x4e')](_[_0x05a9('0x61')](_0x340202['body'],{'firstName':_0x340202[_0x05a9('0x4c')]['to'],'email':_0x340202[_0x05a9('0x4c')]['to'],'phone':_0x340202[_0x05a9('0x4c')]['to'],'ListId':_0xaada8a[_0x05a9('0x62')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x05a9('0x15')](function(){if(_0x3e217f){return respondWithRpcPromise(_0x05a9('0x63'),'sendMail',_0x3e217f,client9003)[_0x05a9('0x15')](function(_0x2d975f){return _0x1c0a85[_0x05a9('0x26')]({'read':!![],'messageId':_0x2d975f[_0x05a9('0x64')],'sentAt':moment()[_0x05a9('0x65')](_0x05a9('0x66'))});})[_0x05a9('0x1f')](function(_0x432e0f){logger[_0x05a9('0x1a')]('%s',JSON[_0x05a9('0x19')](_0x432e0f));return _0x1c0a85;});}return _0x1c0a85;});}return _0x1c0a85;}})[_0x05a9('0x15')](respondWithResult(_0x5a1086,0xc9))[_0x05a9('0x1f')](handleError(_0x5a1086,null));};exports['accept']=function(_0x1eae50,_0x32b98d){var _0x4dd970={'agent':{},'channel':_0x05a9('0x67')};if(_0x1eae50[_0x05a9('0x4c')]['id']){delete _0x1eae50[_0x05a9('0x4c')]['id'];}_0x1eae50[_0x05a9('0x4c')][_0x05a9('0x68')]=!![];_0x1eae50[_0x05a9('0x4c')][_0x05a9('0x69')]=moment()['format'](_0x05a9('0x66'));_0x1eae50[_0x05a9('0x4c')][_0x05a9('0x6a')]=_0x1eae50[_0x05a9('0x4c')]['UserId']||_0x1eae50[_0x05a9('0x6b')]['id'];_0x4dd970[_0x05a9('0x6c')]['id']=_0x1eae50['body'][_0x05a9('0x6a')];return db[_0x05a9('0x2d')][_0x05a9('0x4b')]({'where':{'id':_0x1eae50['params']['id'],'UserId':null}})[_0x05a9('0x15')](handleEntityNotFound(_0x32b98d,null))[_0x05a9('0x15')](saveUpdates(_0x1eae50[_0x05a9('0x4c')],null))[_0x05a9('0x15')](function(_0x30ee28){if(_0x30ee28){_0x4dd970[_0x05a9('0x1d')]=_0x30ee28[_0x05a9('0x6d')]({'plain':!![]});return db[_0x05a9('0x6e')][_0x05a9('0x4b')]({'where':{'id':_0x30ee28['MailInteractionId']}});}return null;})[_0x05a9('0x15')](handleEntityNotFound(_0x32b98d,null))[_0x05a9('0x15')](function(_0x55bd72){if(_0x55bd72){return _0x55bd72[_0x05a9('0x26')]({'UserId':_0x1eae50[_0x05a9('0x4c')][_0x05a9('0x6a')],'read1stAt':_[_0x05a9('0x6f')](_0x55bd72[_0x05a9('0x70')])?moment()[_0x05a9('0x65')](_0x05a9('0x66')):undefined});}return null;})[_0x05a9('0x15')](function(_0x28700d){if(_0x28700d){_0x4dd970[_0x05a9('0x71')]=_0x28700d['get']({'plain':!![]});interaction_log[_0x05a9('0x16')](_0x05a9('0x72'),_0x1eae50['user']['id'],_0x1eae50[_0x05a9('0x6b')][_0x05a9('0x2a')],_0x1eae50[_0x05a9('0x6b')][_0x05a9('0x73')],_0x4dd970['interaction']['id'],_0x1eae50['body']?JSON[_0x05a9('0x19')](_0x1eae50[_0x05a9('0x4c')]):'null');return respondWithRpcPromise(_0x05a9('0x74'),'acceptMessage',_0x4dd970);}return null;})[_0x05a9('0x15')](function(_0x3265e0){var _0x1dcdcc=_0x05a9('0x75')+_0x3265e0[_0x05a9('0x1d')][_0x05a9('0x76')];return db[_0x05a9('0x77')][_0x05a9('0x32')](_0x1dcdcc,{'type':db[_0x05a9('0x78')][_0x05a9('0x79')][_0x05a9('0x7a')],'raw':!![]})[_0x05a9('0x15')](function(_0x48dd86){return _0x48dd86;});})[_0x05a9('0x15')](function(_0x5954b1){if(_0x5954b1){_0x4dd970[_0x05a9('0x1d')][_0x05a9('0x7b')]=_0x5954b1[0x0];if(!_0x1eae50['body']['UserId'])return;return db['User'][_0x05a9('0x4b')]({'where':{'id':_0x1eae50[_0x05a9('0x4c')]['UserId'],'role':_0x05a9('0x6c')},'attributes':['id','name',_0x05a9('0x7c'),_0x05a9('0x7d'),_0x05a9('0x7e')],'raw':!![]});}return null;})[_0x05a9('0x15')](function(_0x4b0055){if(!_0x4b0055)return null;_0x4dd970[_0x05a9('0x1d')]['agent']=_0x4b0055;return _0x4dd970;})[_0x05a9('0x15')](function(_0x45d35b){if(_0x45d35b){if(_0x1eae50[_0x05a9('0x4c')][_0x05a9('0x7f')]){_0x4dd970[_0x05a9('0x1d')][_0x05a9('0x80')]=util[_0x05a9('0x65')](_0x05a9('0x81'),_0x1eae50['user'][_0x05a9('0x2a')]);_0x4dd970[_0x05a9('0x1d')][_0x05a9('0x82')]=_0x4dd970['channel'];_0x4dd970[_0x05a9('0x1d')]['motionChannel']=_0x4dd970['channel'];_0x4dd970[_0x05a9('0x1d')][_0x05a9('0x83')]='accept';_0x4dd970[_0x05a9('0x1d')][_0x05a9('0x4c')]=htmlToText['fromString'](_0x4dd970[_0x05a9('0x1d')]['body']);return respondWithRpcPromise(_0x05a9('0x84'),_0x05a9('0x84'),{'event':'acceptmessage','message':_0x4dd970[_0x05a9('0x1d')]},client9002)[_0x05a9('0x15')](function(){return _0x4dd970;});}return _0x4dd970;}return null;})[_0x05a9('0x15')](respondWithResult(_0x32b98d,null))[_0x05a9('0x1f')](handleError(_0x32b98d,null));};exports['reject']=function(_0xc2938e,_0x3f32b5){var _0x504f82={'agent':{},'channel':_0x05a9('0x67')};if(_0xc2938e[_0x05a9('0x4c')]['id']){delete _0xc2938e[_0x05a9('0x4c')]['id'];}_0xc2938e[_0x05a9('0x4c')][_0x05a9('0x6a')]=_0xc2938e[_0x05a9('0x4c')][_0x05a9('0x6a')]||_0xc2938e[_0x05a9('0x6b')]['id'];_0x504f82[_0x05a9('0x6c')]['id']=_0xc2938e[_0x05a9('0x4c')][_0x05a9('0x6a')];return db[_0x05a9('0x2d')][_0x05a9('0x4b')]({'where':{'id':_0xc2938e['params']['id'],'UserId':null}})[_0x05a9('0x15')](handleEntityNotFound(_0x3f32b5,null))[_0x05a9('0x15')](function(_0x184563){if(_0x184563){_0x504f82['message']=_0x184563[_0x05a9('0x6d')]({'plain':!![]});return db[_0x05a9('0x6e')][_0x05a9('0x4b')]({'where':{'id':_0x184563[_0x05a9('0x85')]}});}return null;})[_0x05a9('0x15')](handleEntityNotFound(_0x3f32b5,null))[_0x05a9('0x15')](function(_0x30f6fc){if(_0x30f6fc){_0x504f82['interaction']=_0x30f6fc[_0x05a9('0x6d')]({'plain':!![]});interaction_log['info'](_0x05a9('0x86'),_0xc2938e['user']['id'],_0xc2938e[_0x05a9('0x6b')][_0x05a9('0x2a')],_0xc2938e[_0x05a9('0x6b')][_0x05a9('0x73')],_0x504f82[_0x05a9('0x71')]['id'],_0xc2938e[_0x05a9('0x4c')]?JSON[_0x05a9('0x19')](_0xc2938e[_0x05a9('0x4c')]):_0x05a9('0x87'));return respondWithRpcPromise(_0x05a9('0x88'),'rejectMessage',_0x504f82);}return null;})[_0x05a9('0x15')](function(_0x2f83cc){var _0x2468e5=_0x05a9('0x75')+_0x2f83cc['message'][_0x05a9('0x76')];return db[_0x05a9('0x77')][_0x05a9('0x32')](_0x2468e5,{'type':db[_0x05a9('0x78')][_0x05a9('0x79')][_0x05a9('0x7a')],'raw':!![]})[_0x05a9('0x15')](function(_0x5055af){return _0x5055af;});})['then'](function(_0x2e12da){if(_0x2e12da){_0x504f82['message'][_0x05a9('0x7b')]=_0x2e12da[0x0];if(!_0xc2938e[_0x05a9('0x4c')][_0x05a9('0x6a')])return;return db[_0x05a9('0x89')][_0x05a9('0x4b')]({'where':{'id':_0xc2938e[_0x05a9('0x4c')]['UserId'],'role':'agent'},'attributes':['id',_0x05a9('0x2a'),'fullname',_0x05a9('0x7d'),_0x05a9('0x7e')],'raw':!![]});}return null;})['then'](function(_0x44c9bb){if(!_0x44c9bb)return null;_0x504f82[_0x05a9('0x1d')][_0x05a9('0x6c')]=_0x44c9bb;return _0x504f82;})[_0x05a9('0x15')](function(_0x37fca8){if(_0x37fca8){_0x37fca8[_0x05a9('0x1d')][_0x05a9('0x80')]=util[_0x05a9('0x65')](_0x05a9('0x81'),_0xc2938e[_0x05a9('0x6b')][_0x05a9('0x2a')]);_0x37fca8['message'][_0x05a9('0x82')]=_0x504f82['channel'];_0x37fca8['message']['motionChannel']=_0x504f82[_0x05a9('0x82')];_0x37fca8[_0x05a9('0x1d')][_0x05a9('0x83')]=_0x05a9('0x8a');_0x37fca8[_0x05a9('0x1d')]['body']=htmlToText[_0x05a9('0x8b')](_0x504f82[_0x05a9('0x1d')][_0x05a9('0x4c')]);respondWithRpcPromise('EventManager','EventManager',{'event':_0x05a9('0x8c'),'message':_0x37fca8['message']},client9002);return _0x504f82;}return null;})[_0x05a9('0x15')](respondWithResult(_0x3f32b5,null))[_0x05a9('0x1f')](handleError(_0x3f32b5,null));};exports['download']=function(_0x1b80f8,_0x5e0045){var _0x46f965=moment()[_0x05a9('0x8d')]()[_0x05a9('0x8e')]();var _0x408798=path[_0x05a9('0x5e')](config[_0x05a9('0x5f')],_0x05a9('0x8f'),_0x05a9('0x90'),'tmp');var _0x38eded=path[_0x05a9('0x5e')](config[_0x05a9('0x5f')],'server',_0x05a9('0x90'),_0x05a9('0x5d'));var _0x57a851=util['format'](_0x05a9('0x91'),_0x46f965);return db[_0x05a9('0x2d')][_0x05a9('0x4b')]({'where':{'id':_0x1b80f8[_0x05a9('0x49')]['id']},'attributes':['id',_0x05a9('0x4c'),'from','to','cc',_0x05a9('0x92'),_0x05a9('0x93'),_0x05a9('0x94')],'include':_0x1b80f8['query'][_0x05a9('0x5d')]?[{'model':db[_0x05a9('0x95')],'as':_0x05a9('0x96')}]:undefined})['then'](handleEntityNotFound(_0x5e0045,null))[_0x05a9('0x15')](function(_0x431e55){if(_0x431e55){var _0x1d41d3=_0x431e55;var _0xdc65b5={'from':_0x1d41d3['from'],'to':_0x1d41d3['to'],'subject':_0x1d41d3[_0x05a9('0x93')],'html':htmlEntities[_0x05a9('0x97')](_0x1d41d3['body']),'headers':{'Date':moment(_0x1d41d3['createdAt'])[_0x05a9('0x65')](_0x05a9('0x98'))},'attachments':[]};if(_0x431e55['cc']){_0xdc65b5['headers']['Cc']=_0x431e55['cc'];}if(_0x431e55[_0x05a9('0x92')]){_0xdc65b5[_0x05a9('0x99')]['Bcc']=_0x431e55['bcc'];}return new BPromise(function(_0x282b47,_0x9dbfda){if(_0x431e55[_0x05a9('0x96')]){for(var _0x13fb45=0x0;_0x13fb45<_0x431e55[_0x05a9('0x96')][_0x05a9('0x38')];_0x13fb45++){var _0xc8a031=_0x431e55[_0x05a9('0x96')][_0x13fb45];var _0x5b3e6d=path[_0x05a9('0x5e')](_0x38eded,_0xc8a031[_0x05a9('0x60')]);if(fs[_0x05a9('0x9a')](_0x5b3e6d)){_0xdc65b5[_0x05a9('0x5d')]['push']({'name':_0xc8a031['name'],'contentType':_0xc8a031['type'],'data':fs[_0x05a9('0x9b')](_0x5b3e6d)});}}}emlformat[_0x05a9('0x9c')](_0xdc65b5,function(_0x4f7960,_0x277a48){if(_0x4f7960)return _0x9dbfda(_0x4f7960);fs[_0x05a9('0x9d')](path[_0x05a9('0x5e')](_0x408798,_0x57a851),_0x277a48);return _0x282b47(_0x277a48);});});}})[_0x05a9('0x15')](function(_0x4bd7ec){if(_0x4bd7ec){return _0x5e0045[_0x05a9('0x9e')](path[_0x05a9('0x5e')](_0x408798,_0x57a851),_0x57a851,function(_0x5f1f79){if(!_0x5f1f79)fs[_0x05a9('0x9f')](path[_0x05a9('0x5e')](_0x408798,_0x57a851));});}})['catch'](handleError(_0x5e0045,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index e3dab18..049f96a 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 _0xdf99=['events','../../mysqldb','MailMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x5ce68f,_0x1c468d){var _0x2a7421=function(_0x3e8270){while(--_0x3e8270){_0x5ce68f['push'](_0x5ce68f['shift']());}};_0x2a7421(++_0x1c468d);}(_0xdf99,0x1b9));var _0x9df9=function(_0x5e4b85,_0x6cf965){_0x5e4b85=_0x5e4b85-0x0;var _0x5cd3cb=_0xdf99[_0x5e4b85];return _0x5cd3cb;};'use strict';var EventEmitter=require(_0x9df9('0x0'));var MailMessage=require(_0x9df9('0x1'))['db'][_0x9df9('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9df9('0x3')](0x0);var events={'afterCreate':_0x9df9('0x4'),'afterUpdate':'update','afterDestroy':_0x9df9('0x5')};function emitEvent(_0x3ba3e9){return function(_0x5036c1,_0x232cbb,_0x4b9134){MailMessageEvents[_0x9df9('0x6')](_0x3ba3e9+':'+_0x5036c1['id'],_0x5036c1);MailMessageEvents['emit'](_0x3ba3e9,_0x5036c1);_0x4b9134(null);};}for(var e in events){if(events[_0x9df9('0x7')](e)){var event=events[e];MailMessage[_0x9df9('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x3e24=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','MailMessage'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0x3e24,0x9d));var _0x43e2=function(_0x5b2c50,_0x4db66b){_0x5b2c50=_0x5b2c50-0x0;var _0x47f2f9=_0x3e24[_0x5b2c50];return _0x47f2f9;};'use strict';var EventEmitter=require(_0x43e2('0x0'));var MailMessage=require(_0x43e2('0x1'))['db'][_0x43e2('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x43e2('0x3')](0x0);var events={'afterCreate':_0x43e2('0x4'),'afterUpdate':_0x43e2('0x5'),'afterDestroy':_0x43e2('0x6')};function emitEvent(_0x5b1cdc){return function(_0x261e32,_0x1e9a7f,_0x27ff3f){MailMessageEvents[_0x43e2('0x7')](_0x5b1cdc+':'+_0x261e32['id'],_0x261e32);MailMessageEvents[_0x43e2('0x7')](_0x5b1cdc,_0x261e32);_0x27ff3f(null);};}for(var e in events){if(events[_0x43e2('0x8')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x43e2('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 441c080..f4ed6cb 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 _0x184a=['api','moment','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','models','get','toLowerCase','direction','isNil','MailInteraction','findOne','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x1c0c58,_0x25b689){var _0x6938d2=function(_0x201bce){while(--_0x201bce){_0x1c0c58['push'](_0x1c0c58['shift']());}};_0x6938d2(++_0x25b689);}(_0x184a,0x184));var _0xa184=function(_0x394edf,_0x41dce4){_0x394edf=_0x394edf-0x0;var _0x19e197=_0x184a[_0x394edf];return _0x19e197;};'use strict';var _=require(_0xa184('0x0'));var util=require(_0xa184('0x1'));var logger=require('../../config/logger')(_0xa184('0x2'));var moment=require(_0xa184('0x3'));var BPromise=require('bluebird');var rp=require(_0xa184('0x4'));var htmlToText=require(_0xa184('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa184('0x6'));var config=require(_0xa184('0x7'));var attributes=require(_0xa184('0x8'));module[_0xa184('0x9')]=function(_0x44fab1,_0x2fee62){return _0x44fab1['define'](_0xa184('0xa'),attributes,{'tableName':_0xa184('0xb'),'paranoid':![],'indexes':[{'name':_0xa184('0xc'),'fields':['messageId']},{'name':_0xa184('0xd'),'fields':[_0xa184('0xe'),_0xa184('0xf')],'type':_0xa184('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x469f56,_0x3a06e3,_0x16d241){if(_0x469f56['body']){_0x469f56['plainBody']=htmlToText['fromString'](_0x469f56['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x16d241(null,_0x3a06e3);},'afterCreate':function(_0x377be4,_0x3c61b9,_0x41fa67){var _0x3f4883=_0x44fab1[_0xa184('0x11')];var _0x10eaa8=_0x377be4[_0xa184('0x12')]({'plain':!![]});if(_0x10eaa8['direction'][_0xa184('0x13')]()==='in'||_0x10eaa8[_0xa184('0x14')][_0xa184('0x13')]()==='out'&&!_0x10eaa8['secret']&&!_[_0xa184('0x15')](_0x10eaa8['UserId'])){_0x3f4883[_0xa184('0x16')][_0xa184('0x17')]({'where':{'id':_0x10eaa8['MailInteractionId']}})[_0xa184('0x18')](function(_0x24d279){if(_0x24d279){_0x24d279[_0xa184('0x19')]({'lastMsgAt':_0x10eaa8[_0xa184('0x1a')],'lastMsgDirection':_0x10eaa8[_0xa184('0x14')][_0xa184('0x13')]()});}})['catch'](function(_0xade1ef){console[_0xa184('0x1b')](_0xade1ef);});}_0x41fa67();}},'charset':_0xa184('0x1c'),'collate':_0xa184('0x1d')});}; \ No newline at end of file +var _0x7667=['subject','FULLTEXT','body','plainBody','models','get','toLowerCase','direction','out','secret','isNil','UserId','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','html-to-text','path','exports','MailMessage','messageId','fti_mail_messages'];(function(_0x561f25,_0x2d95c1){var _0x150e4c=function(_0x266e99){while(--_0x266e99){_0x561f25['push'](_0x561f25['shift']());}};_0x150e4c(++_0x2d95c1);}(_0x7667,0x1a7));var _0x7766=function(_0x24e164,_0x540d4b){_0x24e164=_0x24e164-0x0;var _0x2fb756=_0x7667[_0x24e164];return _0x2fb756;};'use strict';var _=require(_0x7766('0x0'));var util=require('util');var logger=require(_0x7766('0x1'))('api');var moment=require(_0x7766('0x2'));var BPromise=require(_0x7766('0x3'));var rp=require(_0x7766('0x4'));var htmlToText=require(_0x7766('0x5'));var fs=require('fs');var path=require(_0x7766('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0x7766('0x7')]=function(_0xd196cb,_0x2edb52){return _0xd196cb['define'](_0x7766('0x8'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x7766('0x9'),'fields':['messageId']},{'name':_0x7766('0xa'),'fields':['plainBody',_0x7766('0xb')],'type':_0x7766('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x201af4,_0xe60f80,_0x366553){if(_0x201af4[_0x7766('0xd')]){_0x201af4[_0x7766('0xe')]=htmlToText['fromString'](_0x201af4['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x366553(null,_0xe60f80);},'afterCreate':function(_0x3348e3,_0x22af9e,_0x4e8ccf){var _0x5efd92=_0xd196cb[_0x7766('0xf')];var _0x3fff3b=_0x3348e3[_0x7766('0x10')]({'plain':!![]});if(_0x3fff3b['direction'][_0x7766('0x11')]()==='in'||_0x3fff3b[_0x7766('0x12')]['toLowerCase']()===_0x7766('0x13')&&!_0x3fff3b[_0x7766('0x14')]&&!_[_0x7766('0x15')](_0x3fff3b[_0x7766('0x16')])){_0x5efd92[_0x7766('0x17')][_0x7766('0x18')]({'where':{'id':_0x3fff3b['MailInteractionId']}})[_0x7766('0x19')](function(_0x3f7c92){if(_0x3f7c92){_0x3f7c92[_0x7766('0x1a')]({'lastMsgAt':_0x3fff3b[_0x7766('0x1b')],'lastMsgDirection':_0x3fff3b[_0x7766('0x12')]['toLowerCase']()});}})[_0x7766('0x1c')](function(_0x1de71e){console[_0x7766('0x1d')](_0x1de71e);});}_0x4e8ccf();}},'charset':'utf8mb4','collate':_0x7766('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 9d54557..37cba1c 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 _0x8f4c=['body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','defaults','localhost','socket.io-emitter','redis','./mailMessage.socket','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8f4c,0x113));var _0xc8f4=function(_0x52bb76,_0x325703){_0x52bb76=_0x52bb76-0x0;var _0x2f2f21=_0x8f4c[_0x52bb76];return _0x2f2f21;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xc8f4('0xa')](config['redis'],{'host':_0xc8f4('0xb'),'port':0x18eb});var socket=require(_0xc8f4('0xc'))(new Redis(config[_0xc8f4('0xd')]));require(_0xc8f4('0xe'))[_0xc8f4('0xf')](socket);function respondWithRpcPromise(_0x599de3,_0x38c41b,_0x191b92){return new BPromise(function(_0x2fba62,_0x3a2f8a){return client['request'](_0x599de3,_0x191b92)[_0xc8f4('0x10')](function(_0x52c699){logger[_0xc8f4('0x11')](_0xc8f4('0x12'),_0x38c41b,_0xc8f4('0x13'));logger[_0xc8f4('0x14')](_0xc8f4('0x15'),_0x38c41b,'request\x20sent',JSON[_0xc8f4('0x16')](_0x52c699));if(_0x52c699[_0xc8f4('0x17')]){if(_0x52c699[_0xc8f4('0x17')][_0xc8f4('0x18')]===0x1f4){logger[_0xc8f4('0x17')](_0xc8f4('0x12'),_0x38c41b,_0x52c699['error'][_0xc8f4('0x19')]);return _0x3a2f8a(_0x52c699[_0xc8f4('0x17')][_0xc8f4('0x19')]);}logger[_0xc8f4('0x17')](_0xc8f4('0x12'),_0x38c41b,_0x52c699['error'][_0xc8f4('0x19')]);return _0x2fba62(_0x52c699['error']['message']);}else{logger[_0xc8f4('0x11')](_0xc8f4('0x12'),_0x38c41b,_0xc8f4('0x13'));_0x2fba62(_0x52c699[_0xc8f4('0x1a')][_0xc8f4('0x19')]);}})[_0xc8f4('0x1b')](function(_0x2459ac){logger[_0xc8f4('0x17')](_0xc8f4('0x12'),_0x38c41b,_0x2459ac);_0x3a2f8a(_0x2459ac);});});}exports[_0xc8f4('0x1c')]=function(_0x3cd90c){var _0x3126e5=this;return new Promise(function(_0x22236c,_0x5f3264){return db[_0xc8f4('0x1d')][_0xc8f4('0x1e')](_0x3cd90c[_0xc8f4('0x1f')],{'raw':_0x3cd90c[_0xc8f4('0x20')]?_0x3cd90c[_0xc8f4('0x20')][_0xc8f4('0x21')]===undefined?!![]:![]:!![]})[_0xc8f4('0x10')](function(_0x43eb57){logger['info'](_0xc8f4('0x1c'),_0x3cd90c);logger[_0xc8f4('0x14')](_0xc8f4('0x1c'),_0x3cd90c,JSON[_0xc8f4('0x16')](_0x43eb57));_0x22236c(_0x43eb57);})['catch'](function(_0x39174f){logger['error'](_0xc8f4('0x1c'),_0x39174f['message'],_0x3cd90c);_0x5f3264(_0x3126e5[_0xc8f4('0x17')](0x1f4,_0x39174f[_0xc8f4('0x19')]));});});}; \ No newline at end of file +var _0x236c=['http','defaults','redis','./mailMessage.socket','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','info','debug','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0x236c,0x155));var _0xc236=function(_0x147198,_0x7fada5){_0x147198=_0x147198-0x0;var _0x1bad78=_0x236c[_0x147198];return _0x1bad78;};'use strict';var _=require(_0xc236('0x0'));var util=require('util');var moment=require(_0xc236('0x1'));var BPromise=require(_0xc236('0x2'));var rs=require(_0xc236('0x3'));var fs=require('fs');var Redis=require(_0xc236('0x4'));var db=require(_0xc236('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc236('0x6'))(_0xc236('0x7'));var config=require(_0xc236('0x8'));var jayson=require(_0xc236('0x9'));var client=jayson[_0xc236('0xa')][_0xc236('0xb')]({'port':0x232a});config['redis']=_[_0xc236('0xc')](config[_0xc236('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc236('0xe'))['register'](socket);function respondWithRpcPromise(_0x30a28d,_0x381ed1,_0x18f33b){return new BPromise(function(_0x2f8b72,_0xaf651b){return client['request'](_0x30a28d,_0x18f33b)[_0xc236('0xf')](function(_0x3311f7){logger['info'](_0xc236('0x10'),_0x381ed1,_0xc236('0x11'));logger['debug'](_0xc236('0x12'),_0x381ed1,'request\x20sent',JSON['stringify'](_0x3311f7));if(_0x3311f7[_0xc236('0x13')]){if(_0x3311f7[_0xc236('0x13')][_0xc236('0x14')]===0x1f4){logger[_0xc236('0x13')]('MailMessage,\x20%s,\x20%s',_0x381ed1,_0x3311f7[_0xc236('0x13')]['message']);return _0xaf651b(_0x3311f7['error'][_0xc236('0x15')]);}logger[_0xc236('0x13')](_0xc236('0x10'),_0x381ed1,_0x3311f7[_0xc236('0x13')][_0xc236('0x15')]);return _0x2f8b72(_0x3311f7['error']['message']);}else{logger['info'](_0xc236('0x10'),_0x381ed1,_0xc236('0x11'));_0x2f8b72(_0x3311f7[_0xc236('0x16')]['message']);}})[_0xc236('0x17')](function(_0x506974){logger['error'](_0xc236('0x10'),_0x381ed1,_0x506974);_0xaf651b(_0x506974);});});}exports[_0xc236('0x18')]=function(_0x3a6183){var _0x46bc69=this;return new Promise(function(_0x2b6d3f,_0x27c6ab){return db[_0xc236('0x19')][_0xc236('0x1a')](_0x3a6183[_0xc236('0x1b')],{'raw':_0x3a6183[_0xc236('0x1c')]?_0x3a6183[_0xc236('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xc236('0xf')](function(_0x34d73a){logger[_0xc236('0x1d')](_0xc236('0x18'),_0x3a6183);logger[_0xc236('0x1e')](_0xc236('0x18'),_0x3a6183,JSON[_0xc236('0x1f')](_0x34d73a));_0x2b6d3f(_0x34d73a);})[_0xc236('0x17')](function(_0x1d65e2){logger[_0xc236('0x13')](_0xc236('0x18'),_0x1d65e2['message'],_0x3a6183);_0x27c6ab(_0x46bc69[_0xc236('0x13')](0x1f4,_0x1d65e2[_0xc236('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index f653192..3fad28f 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 _0xf0dd=['removeListener','register','length','mailMessage:','./mailMessage.events','remove','update','emit'];(function(_0x2756ef,_0x2176ea){var _0x3cc180=function(_0x481b68){while(--_0x481b68){_0x2756ef['push'](_0x2756ef['shift']());}};_0x3cc180(++_0x2176ea);}(_0xf0dd,0x84));var _0xdf0d=function(_0x336f33,_0x43cc91){_0x336f33=_0x336f33-0x0;var _0x3ea123=_0xf0dd[_0x336f33];return _0x3ea123;};'use strict';var MailMessageEvents=require(_0xdf0d('0x0'));var events=['save',_0xdf0d('0x1'),_0xdf0d('0x2')];function createListener(_0x4f80f4,_0x249ce3){return function(_0x4e5302){_0x249ce3[_0xdf0d('0x3')](_0x4f80f4,_0x4e5302);};}function removeListener(_0x3f5427,_0x470df4){return function(){MailMessageEvents[_0xdf0d('0x4')](_0x3f5427,_0x470df4);};}exports[_0xdf0d('0x5')]=function(_0x1a3108){for(var _0x864f40=0x0,_0x5b1b91=events[_0xdf0d('0x6')];_0x864f40<_0x5b1b91;_0x864f40++){var _0x1b3854=events[_0x864f40];var _0x402448=createListener(_0xdf0d('0x7')+_0x1b3854,_0x1a3108);MailMessageEvents['on'](_0x1b3854,_0x402448);}}; \ No newline at end of file +var _0x1aa8=['emit','removeListener','register','length','mailMessage:','./mailMessage.events','save','update'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x1aa8,0x145));var _0x81aa=function(_0x4ad964,_0x466aac){_0x4ad964=_0x4ad964-0x0;var _0x2dc00d=_0x1aa8[_0x4ad964];return _0x2dc00d;};'use strict';var MailMessageEvents=require(_0x81aa('0x0'));var events=[_0x81aa('0x1'),'remove',_0x81aa('0x2')];function createListener(_0x57a3a2,_0x51ade2){return function(_0x354b15){_0x51ade2[_0x81aa('0x3')](_0x57a3a2,_0x354b15);};}function removeListener(_0x58f0b1,_0x10aafe){return function(){MailMessageEvents[_0x81aa('0x4')](_0x58f0b1,_0x10aafe);};}exports[_0x81aa('0x5')]=function(_0x31ea68){for(var _0x4b2df5=0x0,_0x3268a6=events[_0x81aa('0x6')];_0x4b2df5<_0x3268a6;_0x4b2df5++){var _0x2bbb55=events[_0x4b2df5];var _0x4d85e8=createListener(_0x81aa('0x7')+_0x2bbb55,_0x31ea68);MailMessageEvents['on'](_0x2bbb55,_0x4d85e8);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 5da2b66..4dbf8d3 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 _0xc9f3=['get','/describe','isAuthenticated','describe','/:id','getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x43516d,_0x18279a){var _0x2ea369=function(_0x2e6530){while(--_0x2e6530){_0x43516d['push'](_0x43516d['shift']());}};_0x2ea369(++_0x18279a);}(_0xc9f3,0x10c));var _0x3c9f=function(_0x449489,_0x41dc4a){_0x449489=_0x449489-0x0;var _0x45684a=_0xc9f3[_0x449489];return _0x45684a;};'use strict';var multer=require(_0x3c9f('0x0'));var util=require(_0x3c9f('0x1'));var path=require(_0x3c9f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3c9f('0x3')]();var fs_extra=require(_0x3c9f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3c9f('0x5'));var config=require(_0x3c9f('0x6'));var controller=require('./mailQueue.controller');router[_0x3c9f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3c9f('0x7')](_0x3c9f('0x8'),auth[_0x3c9f('0x9')](),controller[_0x3c9f('0xa')]);router['get'](_0x3c9f('0xb'),auth[_0x3c9f('0x9')](),controller['show']);router[_0x3c9f('0x7')]('/:id/members',auth[_0x3c9f('0x9')](),controller[_0x3c9f('0xc')]);router[_0x3c9f('0x7')](_0x3c9f('0xd'),auth[_0x3c9f('0x9')](),controller[_0x3c9f('0xe')]);router[_0x3c9f('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x3c9f('0xf')]('/',auth[_0x3c9f('0x9')](),controller[_0x3c9f('0x10')]);router[_0x3c9f('0xf')](_0x3c9f('0xd'),auth[_0x3c9f('0x9')](),controller[_0x3c9f('0x11')]);router[_0x3c9f('0xf')](_0x3c9f('0x12'),auth[_0x3c9f('0x9')](),controller[_0x3c9f('0x13')]);router[_0x3c9f('0x14')](_0x3c9f('0xb'),auth[_0x3c9f('0x9')](),controller['update']);router[_0x3c9f('0x15')](_0x3c9f('0xb'),auth[_0x3c9f('0x9')](),controller[_0x3c9f('0x16')]);router[_0x3c9f('0x15')]('/:id/teams',auth[_0x3c9f('0x9')](),controller[_0x3c9f('0x17')]);router['delete']('/:id/users',auth[_0x3c9f('0x9')](),controller['removeAgents']);module[_0x3c9f('0x18')]=router; \ No newline at end of file +var _0x9280=['update','delete','removeTeams','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x9280,0xdc));var _0x0928=function(_0x4e123f,_0x11ac84){_0x4e123f=_0x4e123f-0x0;var _0xff4731=_0x9280[_0x4e123f];return _0xff4731;};'use strict';var multer=require('multer');var util=require(_0x0928('0x0'));var path=require(_0x0928('0x1'));var timeout=require(_0x0928('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0928('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0928('0x4'));var config=require(_0x0928('0x5'));var controller=require('./mailQueue.controller');router[_0x0928('0x6')]('/',auth[_0x0928('0x7')](),controller[_0x0928('0x8')]);router[_0x0928('0x6')](_0x0928('0x9'),auth[_0x0928('0x7')](),controller[_0x0928('0xa')]);router[_0x0928('0x6')](_0x0928('0xb'),auth[_0x0928('0x7')](),controller[_0x0928('0xc')]);router[_0x0928('0x6')](_0x0928('0xd'),auth['isAuthenticated'](),controller[_0x0928('0xe')]);router['get'](_0x0928('0xf'),auth[_0x0928('0x7')](),controller[_0x0928('0x10')]);router[_0x0928('0x6')](_0x0928('0x11'),auth[_0x0928('0x7')](),controller[_0x0928('0x12')]);router[_0x0928('0x13')]('/',auth[_0x0928('0x7')](),controller[_0x0928('0x14')]);router[_0x0928('0x13')]('/:id/teams',auth[_0x0928('0x7')](),controller[_0x0928('0x15')]);router[_0x0928('0x13')](_0x0928('0x11'),auth[_0x0928('0x7')](),controller[_0x0928('0x16')]);router['put']('/:id',auth[_0x0928('0x7')](),controller[_0x0928('0x17')]);router[_0x0928('0x18')](_0x0928('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x0928('0x18')](_0x0928('0xf'),auth[_0x0928('0x7')](),controller[_0x0928('0x19')]);router['delete'](_0x0928('0x11'),auth[_0x0928('0x7')](),controller['removeAgents']);module[_0x0928('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 52fa178..7441cf7 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 _0x4adf=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x398779,_0x1bf84f){var _0x58d41a=function(_0x523a4c){while(--_0x523a4c){_0x398779['push'](_0x398779['shift']());}};_0x58d41a(++_0x1bf84f);}(_0x4adf,0x118));var _0xf4ad=function(_0x3b85aa,_0x122e51){_0x3b85aa=_0x3b85aa-0x0;var _0x3c455c=_0x4adf[_0x3b85aa];return _0x3c455c;};'use strict';var Sequelize=require(_0xf4ad('0x0'));module[_0xf4ad('0x1')]={'name':{'type':Sequelize[_0xf4ad('0x2')],'unique':_0xf4ad('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf4ad('0x2')]},'timeout':{'type':Sequelize[_0xf4ad('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf4ad('0x5')](_0xf4ad('0x6'),_0xf4ad('0x7'),'roundrobin')}}; \ No newline at end of file +var _0xae3a=['rrmemory','beepall','exports','STRING','INTEGER','ENUM'];(function(_0x40f5b7,_0xb3243e){var _0x3c884a=function(_0x4fc27b){while(--_0x4fc27b){_0x40f5b7['push'](_0x40f5b7['shift']());}};_0x3c884a(++_0xb3243e);}(_0xae3a,0xa4));var _0xaae3=function(_0x25948f,_0x4ac7e4){_0x25948f=_0x25948f-0x0;var _0x2b1976=_0xae3a[_0x25948f];return _0x2b1976;};'use strict';var Sequelize=require('sequelize');module[_0xaae3('0x0')]={'name':{'type':Sequelize[_0xaae3('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xaae3('0x1')]},'timeout':{'type':Sequelize[_0xaae3('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaae3('0x3')](_0xaae3('0x4'),_0xaae3('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 121cc56..b34d469 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 _0x2051=['index','map','MailQueue','rawAttributes','fieldName','type','key','where','include','query','findAll','rows','catch','params','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','order','sort','MailQueueId','filter','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','SIP','getTeams','Team','nolimit','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','emit','removeTeams','select','field','tq.TeamId','team_has_mail_queues','join','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','every','union','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','userMailQueue:save','isArray','getAgents','pick','bluebird','lodash','squel','../../components/parsers/qs','../../config/environment','redis','localhost','socket.io-emitter','./mailQueue.socket','register','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','get','sendStatus','error','stack','name'];(function(_0x133baa,_0x39264a){var _0x26bf81=function(_0x175abf){while(--_0x175abf){_0x133baa['push'](_0x133baa['shift']());}};_0x26bf81(++_0x39264a);}(_0x2051,0x1a9));var _0x1205=function(_0x278362,_0x3bf61c){_0x278362=_0x278362-0x0;var _0x2201a1=_0x2051[_0x278362];return _0x2201a1;};'use strict';var BPromise=require(_0x1205('0x0'));var util=require('util');var _=require(_0x1205('0x1'));var squel=require(_0x1205('0x2'));var Redis=require('ioredis');var qs=require(_0x1205('0x3'));var logger=require('../../config/logger')('api');var config=require(_0x1205('0x4'));var db=require('../../mysqldb')['db'];config[_0x1205('0x5')]=_['defaults'](config[_0x1205('0x5')],{'host':_0x1205('0x6'),'port':0x18eb});var socket=require(_0x1205('0x7'))(new Redis(config[_0x1205('0x5')]));require(_0x1205('0x8'))[_0x1205('0x9')](socket);function respondWithStatusCode(_0x20adac,_0x3f8ee0){_0x3f8ee0=_0x3f8ee0||0xcc;return function(_0x4206de){if(_0x4206de){return _0x20adac['sendStatus'](_0x3f8ee0);}return _0x20adac['status'](_0x3f8ee0)[_0x1205('0xa')]();};}function respondWithResult(_0x5d3e92,_0xd50522){_0xd50522=_0xd50522||0xc8;return function(_0x464d5c){if(_0x464d5c){return _0x5d3e92[_0x1205('0xb')](_0xd50522)[_0x1205('0xc')](_0x464d5c);}};}function respondWithFilteredResult(_0x5d99cf,_0x1753b6){return function(_0x4204bb){if(_0x4204bb){var _0x2f6ba6=typeof _0x1753b6[_0x1205('0xd')]===_0x1205('0xe')&&typeof _0x1753b6['limit']==='undefined';var _0x5464a6=_0x4204bb['count'];var _0x34db5d=_0x2f6ba6?0x0:_0x1753b6['offset'];var _0x21cd7e=_0x2f6ba6?_0x4204bb[_0x1205('0xf')]:_0x1753b6[_0x1205('0xd')]+_0x1753b6[_0x1205('0x10')];var _0x1b71fd;if(_0x21cd7e>=_0x5464a6){_0x21cd7e=_0x5464a6;_0x1b71fd=0xc8;}else{_0x1b71fd=0xce;}_0x5d99cf[_0x1205('0xb')](_0x1b71fd);return _0x5d99cf[_0x1205('0x11')](_0x1205('0x12'),_0x34db5d+'-'+_0x21cd7e+'/'+_0x5464a6)[_0x1205('0xc')](_0x4204bb);}return null;};}function saveUpdates(_0x4ff391){return function(_0x438350){if(_0x438350){return _0x438350[_0x1205('0x13')](_0x4ff391)[_0x1205('0x14')](function(_0x8fe48f){return _0x8fe48f;});}return null;};}function removeEntity(_0x2e4aee){return function(_0x4a0849){if(_0x4a0849){return _0x4a0849[_0x1205('0x15')]()[_0x1205('0x14')](function(){var _0x323ef4=_0x4a0849[_0x1205('0x16')]({'plain':!![]});var _0x336f90='MailQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x336f90,'resourceId':_0x323ef4['id']}})[_0x1205('0x14')](function(){return _0x4a0849;});})[_0x1205('0x14')](function(){_0x2e4aee[_0x1205('0xb')](0xcc)[_0x1205('0xa')]();});}};}function handleEntityNotFound(_0x1ba134){return function(_0x3729e6){if(!_0x3729e6){_0x1ba134[_0x1205('0x17')](0x194);}return _0x3729e6;};}function handleError(_0x47d520,_0x38ddb4){_0x38ddb4=_0x38ddb4||0x1f4;return function(_0x4f5941){logger[_0x1205('0x18')](_0x4f5941[_0x1205('0x19')]);if(_0x4f5941[_0x1205('0x1a')]){delete _0x4f5941[_0x1205('0x1a')];}_0x47d520[_0x1205('0xb')](_0x38ddb4)['send'](_0x4f5941);};}exports[_0x1205('0x1b')]=function(_0x5bd588,_0x581f2b){var _0x4befe6={};var _0x39438f={'count':0x0,'rows':[]};var _0x377514=_[_0x1205('0x1c')](db[_0x1205('0x1d')][_0x1205('0x1e')],function(_0x267eec){return{'name':_0x267eec[_0x1205('0x1f')],'type':_0x267eec[_0x1205('0x20')][_0x1205('0x21')]};});_0x4befe6=qs['getOptions'](_0x377514,_0x5bd588);var _0xf397c9={'where':_0x4befe6[_0x1205('0x22')]};return db['MailQueue'][_0x1205('0xf')](_0xf397c9)[_0x1205('0x14')](function(_0x11b7d2){_0x39438f[_0x1205('0xf')]=_0x11b7d2;_0x4befe6[_0x1205('0x23')]=qs[_0x1205('0x23')](_0x5bd588[_0x1205('0x24')]);return db[_0x1205('0x1d')][_0x1205('0x25')](_0x4befe6);})['then'](function(_0x14d2f3){_0x39438f[_0x1205('0x26')]=_0x14d2f3;return _0x39438f;})[_0x1205('0x14')](respondWithFilteredResult(_0x581f2b,_0x4befe6))[_0x1205('0x27')](handleError(_0x581f2b,null));};exports['show']=function(_0x544f91,_0x4c5406){var _0x3cabb6={'raw':!![],'where':{'id':_0x544f91[_0x1205('0x28')]['id']}},_0x2683e6={};_0x2683e6['model']=_[_0x1205('0x29')](db[_0x1205('0x1d')]['rawAttributes']);_0x2683e6[_0x1205('0x24')]=_[_0x1205('0x29')](_0x544f91[_0x1205('0x24')]);_0x2683e6[_0x1205('0x2a')]=_[_0x1205('0x2b')](_0x2683e6[_0x1205('0x2c')],_0x2683e6[_0x1205('0x24')]);_0x3cabb6[_0x1205('0x2d')]=_[_0x1205('0x2b')](_0x2683e6['model'],qs['fields'](_0x544f91[_0x1205('0x24')][_0x1205('0x2e')]));_0x3cabb6[_0x1205('0x2d')]=_0x3cabb6['attributes'][_0x1205('0x2f')]?_0x3cabb6['attributes']:_0x2683e6[_0x1205('0x2c')];if(_0x544f91[_0x1205('0x24')][_0x1205('0x30')]){_0x3cabb6[_0x1205('0x23')]=[{'all':!![]}];}_0x3cabb6=_[_0x1205('0x31')]({},_0x3cabb6,_0x544f91[_0x1205('0x32')]);return db[_0x1205('0x1d')][_0x1205('0x33')](_0x3cabb6)[_0x1205('0x14')](handleEntityNotFound(_0x4c5406,null))[_0x1205('0x14')](respondWithResult(_0x4c5406,null))[_0x1205('0x27')](handleError(_0x4c5406,null));};exports[_0x1205('0x34')]=function(_0x472f4d,_0x320236){return db['MailQueue']['create'](_0x472f4d[_0x1205('0x35')],{})['then'](function(_0x558760){var _0x3c5b29=_0x472f4d[_0x1205('0x36')][_0x1205('0x16')]({'plain':!![]});if(!_0x3c5b29)throw new Error(_0x1205('0x37'));if(_0x3c5b29['role']===_0x1205('0x36')){var _0x12ef12=_0x558760['get']({'plain':!![]});var _0x3b9420=_0x1205('0x38');return db[_0x1205('0x39')][_0x1205('0x33')]({'where':{'name':_0x3b9420,'userProfileId':_0x3c5b29[_0x1205('0x3a')]},'raw':!![]})[_0x1205('0x14')](function(_0x4692d1){if(_0x4692d1&&_0x4692d1[_0x1205('0x3b')]===0x0){return db[_0x1205('0x3c')][_0x1205('0x34')]({'name':_0x12ef12[_0x1205('0x1a')],'resourceId':_0x12ef12['id'],'type':_0x4692d1[_0x1205('0x1a')],'sectionId':_0x4692d1['id']},{})[_0x1205('0x14')](function(){return _0x558760;});}else{return _0x558760;}})[_0x1205('0x27')](function(_0x254d6b){logger['error'](_0x1205('0x3d'),_0x254d6b);throw _0x254d6b;});}return _0x558760;})[_0x1205('0x14')](respondWithResult(_0x320236,0xc9))[_0x1205('0x27')](handleError(_0x320236,null));};exports['update']=function(_0x57c9bc,_0x22b285){if(_0x57c9bc[_0x1205('0x35')]['id']){delete _0x57c9bc[_0x1205('0x35')]['id'];}return db[_0x1205('0x1d')][_0x1205('0x33')]({'where':{'id':_0x57c9bc['params']['id']}})[_0x1205('0x14')](handleEntityNotFound(_0x22b285,null))['then'](saveUpdates(_0x57c9bc['body'],null))[_0x1205('0x14')](respondWithResult(_0x22b285,null))['catch'](handleError(_0x22b285,null));};exports['destroy']=function(_0x48097d,_0x4f6275){return db[_0x1205('0x1d')][_0x1205('0x33')]({'where':{'id':_0x48097d['params']['id']}})['then'](handleEntityNotFound(_0x4f6275,null))[_0x1205('0x14')](removeEntity(_0x4f6275,null))['catch'](handleError(_0x4f6275,null));};exports[_0x1205('0x3e')]=function(_0x1e18e7,_0x2f4069){return db[_0x1205('0x1d')][_0x1205('0x3e')]()[_0x1205('0x14')](respondWithResult(_0x2f4069,null))['catch'](handleError(_0x2f4069,null));};exports[_0x1205('0x3f')]=function(_0x373623,_0xcb0bef){var _0x44b4fb={'raw':!![],'where':{}},_0x181139={},_0x1cf154;return db[_0x1205('0x1d')][_0x1205('0x40')]({'where':{'id':_0x373623[_0x1205('0x28')]['id']}})[_0x1205('0x14')](handleEntityNotFound(_0xcb0bef,null))[_0x1205('0x14')](function(_0x41f012){if(_0x41f012){_0x1cf154=_0x41f012[_0x1205('0x16')]({'plain':!![]});_0x181139['model']=_[_0x1205('0x29')](db['UserMailQueue']['rawAttributes']);_0x181139[_0x1205('0x24')]=_[_0x1205('0x29')](_0x373623[_0x1205('0x24')]);_0x181139[_0x1205('0x2a')]=_[_0x1205('0x2b')](_0x181139[_0x1205('0x2c')],_0x181139[_0x1205('0x24')]);_0x44b4fb[_0x1205('0x2d')]=_['intersection'](_0x181139[_0x1205('0x2c')],qs['fields'](_0x373623[_0x1205('0x24')][_0x1205('0x2e')]));_0x44b4fb[_0x1205('0x2d')]=_0x44b4fb['attributes']['length']?_0x44b4fb[_0x1205('0x2d')]:_0x181139['model'];if(!_0x373623[_0x1205('0x24')][_0x1205('0x41')]('nolimit')){_0x44b4fb['limit']=qs[_0x1205('0x10')](_0x373623[_0x1205('0x24')][_0x1205('0x10')]);_0x44b4fb[_0x1205('0xd')]=qs[_0x1205('0xd')](_0x373623[_0x1205('0x24')][_0x1205('0xd')]);}_0x44b4fb[_0x1205('0x42')]=qs[_0x1205('0x43')](_0x373623[_0x1205('0x24')]['sort']);_0x44b4fb['where']=qs[_0x1205('0x2a')](_['pick'](_0x373623[_0x1205('0x24')],_0x181139['filters']));_0x44b4fb[_0x1205('0x22')][_0x1205('0x44')]=_0x41f012['id'];if(_0x373623[_0x1205('0x24')][_0x1205('0x45')]){_0x44b4fb[_0x1205('0x22')]=_['merge'](_0x44b4fb[_0x1205('0x22')],{'$or':_[_0x1205('0x1c')](_0x44b4fb[_0x1205('0x2d')],function(_0x119869){var _0x12705d={};_0x12705d[_0x119869]={'$like':'%'+_0x373623[_0x1205('0x24')][_0x1205('0x45')]+'%'};return _0x12705d;})});}_0x44b4fb=_[_0x1205('0x31')]({},_0x44b4fb,_0x373623[_0x1205('0x32')]);return db['UserMailQueue']['findAll'](_0x44b4fb);}})['then'](function(_0x1b85d6){if(_0x1b85d6){return db[_0x1205('0x46')][_0x1205('0x47')]({'where':{'id':_[_0x1205('0x1c')](_0x1b85d6,_0x1205('0x48')),'role':'agent'},'attributes':['id',_0x1205('0x1a'),_0x1205('0x49'),_0x1205('0x4a'),_0x1205('0x4b')]});}})[_0x1205('0x14')](function(_0xfee00b){if(_0xfee00b){return{'count':_0xfee00b['count'],'rows':_['map'](_0xfee00b['rows'],function(_0x30ff75){return{'membername':_0x30ff75[_0x1205('0x1a')],'UserId':_0x30ff75['id'],'queue_name':_0x1cf154[_0x1205('0x1a')],'MailQueueId':_0x1cf154['id'],'interface':util[_0x1205('0x4c')]('%s/%s',_0x1205('0x4d'),_0x30ff75[_0x1205('0x1a')]),'penalty':0x0,'paused':_0x30ff75[_0x1205('0x49')],'createdAt':_0x30ff75['createdAt'],'updatedAt':_0x30ff75[_0x1205('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1205('0x14')](respondWithFilteredResult(_0xcb0bef,_0x44b4fb))[_0x1205('0x27')](handleError(_0xcb0bef,null));};exports[_0x1205('0x4e')]=function(_0x53bc12,_0x5d3a91){var _0x2794cf={};var _0x151a84={};var _0x6f08f4;var _0x1289c4;return db[_0x1205('0x1d')][_0x1205('0x40')]({'where':{'id':_0x53bc12[_0x1205('0x28')]['id']}})['then'](handleEntityNotFound(_0x5d3a91,null))['then'](function(_0x1f5f52){if(_0x1f5f52){_0x6f08f4=_0x1f5f52;_0x151a84[_0x1205('0x2c')]=_['keys'](db[_0x1205('0x4f')][_0x1205('0x1e')]);_0x151a84[_0x1205('0x24')]=_['keys'](_0x53bc12[_0x1205('0x24')]);_0x151a84[_0x1205('0x2a')]=_['intersection'](_0x151a84['model'],_0x151a84[_0x1205('0x24')]);_0x2794cf[_0x1205('0x2d')]=_[_0x1205('0x2b')](_0x151a84['model'],qs[_0x1205('0x2e')](_0x53bc12[_0x1205('0x24')][_0x1205('0x2e')]));_0x2794cf[_0x1205('0x2d')]=_0x2794cf[_0x1205('0x2d')][_0x1205('0x2f')]?_0x2794cf[_0x1205('0x2d')]:_0x151a84[_0x1205('0x2c')];_0x2794cf['order']=qs[_0x1205('0x43')](_0x53bc12[_0x1205('0x24')][_0x1205('0x43')]);_0x2794cf[_0x1205('0x22')]=qs[_0x1205('0x2a')](_['pick'](_0x53bc12[_0x1205('0x24')],_0x151a84[_0x1205('0x2a')]));if(_0x53bc12[_0x1205('0x24')]['filter']){_0x2794cf[_0x1205('0x22')]=_['merge'](_0x2794cf['where'],{'$or':_[_0x1205('0x1c')](_0x2794cf[_0x1205('0x2d')],function(_0x38f034){var _0x437a3e={};_0x437a3e[_0x38f034]={'$like':'%'+_0x53bc12[_0x1205('0x24')][_0x1205('0x45')]+'%'};return _0x437a3e;})});}_0x2794cf=_[_0x1205('0x31')]({},_0x2794cf,_0x53bc12['options']);return _0x6f08f4[_0x1205('0x4e')](_0x2794cf);}})[_0x1205('0x14')](function(_0x4123a4){if(_0x4123a4){_0x1289c4=_0x4123a4[_0x1205('0x2f')];if(!_0x53bc12[_0x1205('0x24')][_0x1205('0x41')](_0x1205('0x50'))){_0x2794cf['limit']=qs[_0x1205('0x10')](_0x53bc12[_0x1205('0x24')][_0x1205('0x10')]);_0x2794cf['offset']=qs[_0x1205('0xd')](_0x53bc12[_0x1205('0x24')][_0x1205('0xd')]);}return _0x6f08f4[_0x1205('0x4e')](_0x2794cf);}})[_0x1205('0x14')](function(_0x2ee850){if(_0x2ee850){return _0x2ee850?{'count':_0x1289c4,'rows':_0x2ee850}:null;}})[_0x1205('0x14')](respondWithResult(_0x5d3a91,null))[_0x1205('0x27')](handleError(_0x5d3a91,null));};exports[_0x1205('0x51')]=function(_0x5bf015,_0x1d3fd7){var _0x4e4e8a=_0x5bf015[_0x1205('0x35')][_0x1205('0x52')];return db['Team'][_0x1205('0x25')]({'where':{'id':_0x4e4e8a},'attributes':['id'],'include':[{'model':db[_0x1205('0x46')],'as':_0x1205('0x53'),'attributes':['id',_0x1205('0x1a'),_0x1205('0x54'),_0x1205('0x55'),_0x1205('0x56')],'raw':!![]}]})[_0x1205('0x14')](function(_0x21e7f8){if(_0x21e7f8){var _0x3f8710=_['flatMap'](_0x21e7f8,function(_0x4f1b01){var _0x3a2ffc=_0x4f1b01['get']({'plain':!![]});return _0x3a2ffc['Agents'];});return db[_0x1205('0x1d')][_0x1205('0x33')]({'where':{'id':_0x5bf015[_0x1205('0x28')]['id']}})[_0x1205('0x14')](function(_0x5c045b){return db[_0x1205('0x57')][_0x1205('0x58')](function(_0x43f091){return _0x5c045b[_0x1205('0x51')](_0x4e4e8a,{'transaction':_0x43f091})[_0x1205('0x14')](function(){return BPromise[_0x1205('0x59')](_0x3f8710,function(_0x8b577d){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x8b577d['id'],'MailQueueId':_0x5bf015[_0x1205('0x28')]['id']},'transaction':_0x43f091});});})[_0x1205('0x14')](function(){_0x3f8710['forEach'](function(_0x392119){socket[_0x1205('0x5a')]('userMailQueue:save',{'UserId':_0x392119['id'],'MailQueueId':_0x5c045b['id']});});});});});}})[_0x1205('0x14')](respondWithStatusCode(_0x1d3fd7,null))[_0x1205('0x27')](handleError(_0x1d3fd7,null));};exports[_0x1205('0x5b')]=function(_0x2690c6,_0x3e00f0){return db['Team'][_0x1205('0x25')]({'where':{'id':_0x2690c6[_0x1205('0x24')][_0x1205('0x52')]},'attributes':['id'],'include':[{'model':db[_0x1205('0x46')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x1205('0x14')](handleEntityNotFound(_0x3e00f0,null))[_0x1205('0x14')](function(_0x36d9f7){var _0x282030=_['map'](_0x36d9f7,'id');var _0x2893c8=[];var _0x550540=[];var _0x3d9789=squel[_0x1205('0x5c')]();_0x3d9789[_0x1205('0x5d')](_0x1205('0x5e'))['from'](_0x1205('0x5f'),'tq')[_0x1205('0x60')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x1205('0x22')](_0x1205('0x61'),_0x2690c6[_0x1205('0x28')]['id']);for(var _0xd6f1a5=0x0;_0xd6f1a5<_0x36d9f7[_0x1205('0x2f')];_0xd6f1a5+=0x1){let _0x573e2a=_0x36d9f7[_0xd6f1a5];for(var _0x3cf254=0x0;_0x3cf254<_0x573e2a[_0x1205('0x53')]['length'];_0x3cf254+=0x1){let _0x195420=_0x573e2a[_0x1205('0x53')][_0x3cf254];var _0x2f1457=_0x3d9789['clone']();_0x2f1457[_0x1205('0x22')](_0x1205('0x62'),_0x195420['id']);_0x550540[_0x1205('0x63')](db['sequelize'][_0x1205('0x24')](_0x2f1457[_0x1205('0x64')](),{'type':db[_0x1205('0x57')]['QueryTypes']['SELECT']})[_0x1205('0x14')](function(_0x446a54){if(_0x446a54[_0x1205('0x2f')]===0x1){return _0x195420['id'];}else{var _0x4f68bf=_[_0x1205('0x65')](_['map'](_0x446a54,'TeamId'),function(_0x3fcbb5){return _['includes'](_0x282030,_0x3fcbb5);});if(_0x4f68bf){return _0x195420['id'];}}}));}}return BPromise['all'](_0x550540)[_0x1205('0x14')](function(_0x1217fd){_0x2893c8=_(_0x2893c8)[_0x1205('0x66')](_0x1217fd)['compact']()[_0x1205('0x67')]();return db[_0x1205('0x1d')][_0x1205('0x33')]({'where':{'id':_0x2690c6['params']['id']}})[_0x1205('0x14')](function(_0x38748a){return db[_0x1205('0x57')][_0x1205('0x58')](function(_0x46b1be){return _0x38748a[_0x1205('0x5b')](_0x2690c6[_0x1205('0x24')][_0x1205('0x52')],{'transaction':_0x46b1be})[_0x1205('0x14')](function(){if(!_[_0x1205('0x68')](_0x2893c8)){return _0x38748a[_0x1205('0x69')](_0x2893c8,{'transaction':_0x46b1be});}})[_0x1205('0x14')](function(){_0x2893c8['forEach'](function(_0x5a77cb){socket['emit'](_0x1205('0x6a'),{'UserId':_0x5a77cb,'MailQueueId':_0x38748a['id']});});});});});});})['then'](respondWithStatusCode(_0x3e00f0,null))[_0x1205('0x27')](handleError(_0x3e00f0,null));};exports[_0x1205('0x6b')]=function(_0x1a968e,_0x534424){return db['MailQueue']['find']({'where':{'id':_0x1a968e[_0x1205('0x28')]['id']}})['then'](handleEntityNotFound(_0x534424,null))[_0x1205('0x14')](function(_0x1ad6fd){if(_0x1ad6fd){return _0x1ad6fd[_0x1205('0x6b')](_0x1a968e[_0x1205('0x35')][_0x1205('0x52')],_[_0x1205('0x6c')](_0x1a968e[_0x1205('0x35')],['ids','id'])||{})['spread'](function(_0x26f356){for(var _0x57c8a8=0x0;_0x57c8a8<_0x1a968e[_0x1205('0x35')]['ids']['length'];_0x57c8a8+=0x1){socket[_0x1205('0x5a')](_0x1205('0x6d'),{'UserId':Number(_0x1a968e[_0x1205('0x35')][_0x1205('0x52')][_0x57c8a8]),'MailQueueId':Number(_0x1a968e[_0x1205('0x28')]['id'])});}return _0x26f356;});}})[_0x1205('0x14')](respondWithResult(_0x534424,null))[_0x1205('0x27')](handleError(_0x534424,null));};exports['removeAgents']=function(_0x16e9b9,_0x2ba4c9){return db[_0x1205('0x1d')][_0x1205('0x33')]({'where':{'id':_0x16e9b9['params']['id']}})[_0x1205('0x14')](handleEntityNotFound(_0x2ba4c9,null))[_0x1205('0x14')](function(_0x2dcfb0){if(_0x2dcfb0){return _0x2dcfb0[_0x1205('0x69')](_0x16e9b9['query']['ids'])[_0x1205('0x14')](function(){if(_[_0x1205('0x6e')](_0x16e9b9[_0x1205('0x24')]['ids'])){for(var _0x5ac3c2=0x0;_0x5ac3c2<_0x16e9b9[_0x1205('0x24')][_0x1205('0x52')][_0x1205('0x2f')];_0x5ac3c2+=0x1){socket[_0x1205('0x5a')](_0x1205('0x6a'),{'UserId':Number(_0x16e9b9[_0x1205('0x24')][_0x1205('0x52')][_0x5ac3c2]),'MailQueueId':Number(_0x16e9b9[_0x1205('0x28')]['id'])});}}else{socket[_0x1205('0x5a')]('userMailQueue:remove',{'UserId':Number(_0x16e9b9[_0x1205('0x24')][_0x1205('0x52')]),'MailQueueId':Number(_0x16e9b9[_0x1205('0x28')]['id'])});}});}})[_0x1205('0x14')](respondWithStatusCode(_0x2ba4c9,null))[_0x1205('0x27')](handleError(_0x2ba4c9,null));};exports[_0x1205('0x6f')]=function(_0x4faff9,_0x241306){var _0x482bb7={};var _0x1d535c={};var _0x55e00f;var _0x46a5bf;return db['MailQueue'][_0x1205('0x40')]({'where':{'id':_0x4faff9[_0x1205('0x28')]['id']}})[_0x1205('0x14')](handleEntityNotFound(_0x241306,null))['then'](function(_0x7415e3){if(_0x7415e3){_0x55e00f=_0x7415e3;_0x1d535c['model']=_[_0x1205('0x29')](db[_0x1205('0x46')][_0x1205('0x1e')]);_0x1d535c[_0x1205('0x24')]=_[_0x1205('0x29')](_0x4faff9[_0x1205('0x24')]);_0x1d535c[_0x1205('0x2a')]=_['intersection'](_0x1d535c['model'],_0x1d535c['query']);_0x482bb7[_0x1205('0x2d')]=_[_0x1205('0x2b')](_0x1d535c['model'],qs[_0x1205('0x2e')](_0x4faff9[_0x1205('0x24')][_0x1205('0x2e')]));_0x482bb7['attributes']=_0x482bb7[_0x1205('0x2d')]['length']?_0x482bb7[_0x1205('0x2d')]:_0x1d535c[_0x1205('0x2c')];_0x482bb7[_0x1205('0x42')]=qs[_0x1205('0x43')](_0x4faff9[_0x1205('0x24')][_0x1205('0x43')]);_0x482bb7[_0x1205('0x22')]=qs[_0x1205('0x2a')](_[_0x1205('0x70')](_0x4faff9[_0x1205('0x24')],_0x1d535c[_0x1205('0x2a')]));if(_0x4faff9[_0x1205('0x24')][_0x1205('0x45')]){_0x482bb7[_0x1205('0x22')]=_['merge'](_0x482bb7[_0x1205('0x22')],{'$or':_[_0x1205('0x1c')](_0x482bb7[_0x1205('0x2d')],function(_0x23ec67){var _0x4d2f59={};_0x4d2f59[_0x23ec67]={'$like':'%'+_0x4faff9[_0x1205('0x24')][_0x1205('0x45')]+'%'};return _0x4d2f59;})});}_0x482bb7=_[_0x1205('0x31')]({},_0x482bb7,_0x4faff9['options']);return _0x55e00f[_0x1205('0x6f')](_0x482bb7);}})[_0x1205('0x14')](function(_0x24deb0){if(_0x24deb0){_0x46a5bf=_0x24deb0[_0x1205('0x2f')];if(!_0x4faff9[_0x1205('0x24')][_0x1205('0x41')](_0x1205('0x50'))){_0x482bb7[_0x1205('0x10')]=qs[_0x1205('0x10')](_0x4faff9['query'][_0x1205('0x10')]);_0x482bb7['offset']=qs[_0x1205('0xd')](_0x4faff9[_0x1205('0x24')][_0x1205('0xd')]);}return _0x55e00f[_0x1205('0x6f')](_0x482bb7);}})[_0x1205('0x14')](function(_0x3df4d0){if(_0x3df4d0){return _0x3df4d0?{'count':_0x46a5bf,'rows':_0x3df4d0}:null;}})['then'](respondWithResult(_0x241306,null))[_0x1205('0x27')](handleError(_0x241306,null));}; \ No newline at end of file +var _0xc351=['then','destroy','get','MailQueues','UserProfileResource','end','error','name','send','index','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','rows','catch','show','model','keys','filters','intersection','attributes','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','hasOwnProperty','order','sort','merge','map','filter','UserMailQueue','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','Team','fields','pick','getTeams','nolimit','ids','Agents','online','voicePause','sequelize','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','from','team_has_mail_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','emit','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status','offset','undefined','count','limit','Content-Range','json','update'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0xc351,0x1e8));var _0x1c35=function(_0x577210,_0x1a0966){_0x577210=_0x577210-0x0;var _0x1991b1=_0xc351[_0x577210];return _0x1991b1;};'use strict';var BPromise=require(_0x1c35('0x0'));var util=require(_0x1c35('0x1'));var _=require(_0x1c35('0x2'));var squel=require(_0x1c35('0x3'));var Redis=require(_0x1c35('0x4'));var qs=require(_0x1c35('0x5'));var logger=require(_0x1c35('0x6'))(_0x1c35('0x7'));var config=require(_0x1c35('0x8'));var db=require(_0x1c35('0x9'))['db'];config[_0x1c35('0xa')]=_[_0x1c35('0xb')](config['redis'],{'host':_0x1c35('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c35('0xa')]));require(_0x1c35('0xd'))[_0x1c35('0xe')](socket);function respondWithStatusCode(_0x29b9ae,_0x233700){_0x233700=_0x233700||0xcc;return function(_0x3c8b5c){if(_0x3c8b5c){return _0x29b9ae[_0x1c35('0xf')](_0x233700);}return _0x29b9ae[_0x1c35('0x10')](_0x233700)['end']();};}function respondWithResult(_0x49797f,_0x56def4){_0x56def4=_0x56def4||0xc8;return function(_0x13a292){if(_0x13a292){return _0x49797f[_0x1c35('0x10')](_0x56def4)['json'](_0x13a292);}};}function respondWithFilteredResult(_0x148201,_0x1e26f2){return function(_0x27e10e){if(_0x27e10e){var _0x23a6b4=typeof _0x1e26f2[_0x1c35('0x11')]===_0x1c35('0x12')&&typeof _0x1e26f2['limit']==='undefined';var _0xd77758=_0x27e10e[_0x1c35('0x13')];var _0x276158=_0x23a6b4?0x0:_0x1e26f2['offset'];var _0x82063b=_0x23a6b4?_0x27e10e[_0x1c35('0x13')]:_0x1e26f2[_0x1c35('0x11')]+_0x1e26f2[_0x1c35('0x14')];var _0x1819a4;if(_0x82063b>=_0xd77758){_0x82063b=_0xd77758;_0x1819a4=0xc8;}else{_0x1819a4=0xce;}_0x148201[_0x1c35('0x10')](_0x1819a4);return _0x148201['set'](_0x1c35('0x15'),_0x276158+'-'+_0x82063b+'/'+_0xd77758)[_0x1c35('0x16')](_0x27e10e);}return null;};}function saveUpdates(_0x190ba2){return function(_0x164b16){if(_0x164b16){return _0x164b16[_0x1c35('0x17')](_0x190ba2)[_0x1c35('0x18')](function(_0x5c3d3a){return _0x5c3d3a;});}return null;};}function removeEntity(_0x1455c8){return function(_0x158b24){if(_0x158b24){return _0x158b24[_0x1c35('0x19')]()[_0x1c35('0x18')](function(){var _0x1a8d21=_0x158b24[_0x1c35('0x1a')]({'plain':!![]});var _0x45c3bc=_0x1c35('0x1b');return db[_0x1c35('0x1c')]['destroy']({'where':{'type':_0x45c3bc,'resourceId':_0x1a8d21['id']}})[_0x1c35('0x18')](function(){return _0x158b24;});})['then'](function(){_0x1455c8[_0x1c35('0x10')](0xcc)[_0x1c35('0x1d')]();});}};}function handleEntityNotFound(_0x50d4fc){return function(_0x4d3c5c){if(!_0x4d3c5c){_0x50d4fc[_0x1c35('0xf')](0x194);}return _0x4d3c5c;};}function handleError(_0x27839f,_0x44e021){_0x44e021=_0x44e021||0x1f4;return function(_0x48b497){logger[_0x1c35('0x1e')](_0x48b497['stack']);if(_0x48b497[_0x1c35('0x1f')]){delete _0x48b497['name'];}_0x27839f[_0x1c35('0x10')](_0x44e021)[_0x1c35('0x20')](_0x48b497);};}exports[_0x1c35('0x21')]=function(_0x532b13,_0x13e014){var _0x5406df={};var _0x2c8bc3={'count':0x0,'rows':[]};var _0x30b424=_['map'](db[_0x1c35('0x22')][_0x1c35('0x23')],function(_0x361ecd){return{'name':_0x361ecd[_0x1c35('0x24')],'type':_0x361ecd[_0x1c35('0x25')][_0x1c35('0x26')]};});_0x5406df=qs[_0x1c35('0x27')](_0x30b424,_0x532b13);var _0x3f62cb={'where':_0x5406df[_0x1c35('0x28')]};return db['MailQueue'][_0x1c35('0x13')](_0x3f62cb)[_0x1c35('0x18')](function(_0x21485e){_0x2c8bc3[_0x1c35('0x13')]=_0x21485e;_0x5406df[_0x1c35('0x29')]=qs[_0x1c35('0x29')](_0x532b13[_0x1c35('0x2a')]);return db[_0x1c35('0x22')]['findAll'](_0x5406df);})[_0x1c35('0x18')](function(_0x2cab19){_0x2c8bc3[_0x1c35('0x2b')]=_0x2cab19;return _0x2c8bc3;})['then'](respondWithFilteredResult(_0x13e014,_0x5406df))[_0x1c35('0x2c')](handleError(_0x13e014,null));};exports[_0x1c35('0x2d')]=function(_0xd4f76f,_0x571806){var _0x23399e={'raw':!![],'where':{'id':_0xd4f76f['params']['id']}},_0x9cd90d={};_0x9cd90d[_0x1c35('0x2e')]=_[_0x1c35('0x2f')](db[_0x1c35('0x22')][_0x1c35('0x23')]);_0x9cd90d[_0x1c35('0x2a')]=_[_0x1c35('0x2f')](_0xd4f76f['query']);_0x9cd90d[_0x1c35('0x30')]=_[_0x1c35('0x31')](_0x9cd90d['model'],_0x9cd90d['query']);_0x23399e[_0x1c35('0x32')]=_['intersection'](_0x9cd90d[_0x1c35('0x2e')],qs['fields'](_0xd4f76f[_0x1c35('0x2a')]['fields']));_0x23399e['attributes']=_0x23399e[_0x1c35('0x32')][_0x1c35('0x33')]?_0x23399e[_0x1c35('0x32')]:_0x9cd90d[_0x1c35('0x2e')];if(_0xd4f76f[_0x1c35('0x2a')][_0x1c35('0x34')]){_0x23399e[_0x1c35('0x29')]=[{'all':!![]}];}_0x23399e=_['merge']({},_0x23399e,_0xd4f76f[_0x1c35('0x35')]);return db[_0x1c35('0x22')][_0x1c35('0x36')](_0x23399e)[_0x1c35('0x18')](handleEntityNotFound(_0x571806,null))['then'](respondWithResult(_0x571806,null))[_0x1c35('0x2c')](handleError(_0x571806,null));};exports[_0x1c35('0x37')]=function(_0x18f794,_0x5bae47){return db[_0x1c35('0x22')]['create'](_0x18f794[_0x1c35('0x38')],{})[_0x1c35('0x18')](function(_0x23800d){var _0xfeefc5=_0x18f794[_0x1c35('0x39')]['get']({'plain':!![]});if(!_0xfeefc5)throw new Error(_0x1c35('0x3a'));if(_0xfeefc5[_0x1c35('0x3b')]===_0x1c35('0x39')){var _0x4a4102=_0x23800d[_0x1c35('0x1a')]({'plain':!![]});var _0x3b12ea='MailQueues';return db[_0x1c35('0x3c')][_0x1c35('0x36')]({'where':{'name':_0x3b12ea,'userProfileId':_0xfeefc5[_0x1c35('0x3d')]},'raw':!![]})[_0x1c35('0x18')](function(_0xf57de){if(_0xf57de&&_0xf57de[_0x1c35('0x3e')]===0x0){return db['UserProfileResource'][_0x1c35('0x37')]({'name':_0x4a4102[_0x1c35('0x1f')],'resourceId':_0x4a4102['id'],'type':_0xf57de[_0x1c35('0x1f')],'sectionId':_0xf57de['id']},{})[_0x1c35('0x18')](function(){return _0x23800d;});}else{return _0x23800d;}})[_0x1c35('0x2c')](function(_0x3ee662){logger[_0x1c35('0x1e')](_0x1c35('0x3f'),_0x3ee662);throw _0x3ee662;});}return _0x23800d;})['then'](respondWithResult(_0x5bae47,0xc9))[_0x1c35('0x2c')](handleError(_0x5bae47,null));};exports[_0x1c35('0x17')]=function(_0x56dd51,_0x4ebe2d){if(_0x56dd51['body']['id']){delete _0x56dd51[_0x1c35('0x38')]['id'];}return db[_0x1c35('0x22')]['find']({'where':{'id':_0x56dd51[_0x1c35('0x40')]['id']}})['then'](handleEntityNotFound(_0x4ebe2d,null))['then'](saveUpdates(_0x56dd51[_0x1c35('0x38')],null))[_0x1c35('0x18')](respondWithResult(_0x4ebe2d,null))[_0x1c35('0x2c')](handleError(_0x4ebe2d,null));};exports[_0x1c35('0x19')]=function(_0x62d46b,_0xba52d5){return db[_0x1c35('0x22')][_0x1c35('0x36')]({'where':{'id':_0x62d46b['params']['id']}})[_0x1c35('0x18')](handleEntityNotFound(_0xba52d5,null))['then'](removeEntity(_0xba52d5,null))[_0x1c35('0x2c')](handleError(_0xba52d5,null));};exports[_0x1c35('0x41')]=function(_0x21dbd8,_0x43dc09){return db['MailQueue']['describe']()[_0x1c35('0x18')](respondWithResult(_0x43dc09,null))[_0x1c35('0x2c')](handleError(_0x43dc09,null));};exports['getMembers']=function(_0xd8ab4c,_0x4acfe6){var _0x521fe8={'raw':!![],'where':{}},_0x43dda3={},_0x44953e;return db['MailQueue'][_0x1c35('0x42')]({'where':{'id':_0xd8ab4c[_0x1c35('0x40')]['id']}})[_0x1c35('0x18')](handleEntityNotFound(_0x4acfe6,null))[_0x1c35('0x18')](function(_0x92a8c9){if(_0x92a8c9){_0x44953e=_0x92a8c9['get']({'plain':!![]});_0x43dda3[_0x1c35('0x2e')]=_[_0x1c35('0x2f')](db['UserMailQueue'][_0x1c35('0x23')]);_0x43dda3['query']=_[_0x1c35('0x2f')](_0xd8ab4c[_0x1c35('0x2a')]);_0x43dda3[_0x1c35('0x30')]=_[_0x1c35('0x31')](_0x43dda3[_0x1c35('0x2e')],_0x43dda3[_0x1c35('0x2a')]);_0x521fe8['attributes']=_[_0x1c35('0x31')](_0x43dda3[_0x1c35('0x2e')],qs['fields'](_0xd8ab4c[_0x1c35('0x2a')]['fields']));_0x521fe8['attributes']=_0x521fe8[_0x1c35('0x32')][_0x1c35('0x33')]?_0x521fe8[_0x1c35('0x32')]:_0x43dda3[_0x1c35('0x2e')];if(!_0xd8ab4c[_0x1c35('0x2a')][_0x1c35('0x43')]('nolimit')){_0x521fe8[_0x1c35('0x14')]=qs[_0x1c35('0x14')](_0xd8ab4c[_0x1c35('0x2a')][_0x1c35('0x14')]);_0x521fe8['offset']=qs[_0x1c35('0x11')](_0xd8ab4c[_0x1c35('0x2a')][_0x1c35('0x11')]);}_0x521fe8[_0x1c35('0x44')]=qs[_0x1c35('0x45')](_0xd8ab4c['query'][_0x1c35('0x45')]);_0x521fe8[_0x1c35('0x28')]=qs[_0x1c35('0x30')](_['pick'](_0xd8ab4c[_0x1c35('0x2a')],_0x43dda3[_0x1c35('0x30')]));_0x521fe8[_0x1c35('0x28')]['MailQueueId']=_0x92a8c9['id'];if(_0xd8ab4c[_0x1c35('0x2a')]['filter']){_0x521fe8[_0x1c35('0x28')]=_[_0x1c35('0x46')](_0x521fe8[_0x1c35('0x28')],{'$or':_[_0x1c35('0x47')](_0x521fe8[_0x1c35('0x32')],function(_0x2c9240){var _0x31556a={};_0x31556a[_0x2c9240]={'$like':'%'+_0xd8ab4c[_0x1c35('0x2a')][_0x1c35('0x48')]+'%'};return _0x31556a;})});}_0x521fe8=_['merge']({},_0x521fe8,_0xd8ab4c['options']);return db[_0x1c35('0x49')][_0x1c35('0x4a')](_0x521fe8);}})[_0x1c35('0x18')](function(_0x110968){if(_0x110968){return db[_0x1c35('0x4b')][_0x1c35('0x4c')]({'where':{'id':_[_0x1c35('0x47')](_0x110968,_0x1c35('0x4d')),'role':_0x1c35('0x4e')},'attributes':['id',_0x1c35('0x1f'),_0x1c35('0x4f'),_0x1c35('0x50'),_0x1c35('0x51')]});}})[_0x1c35('0x18')](function(_0xbc03c){if(_0xbc03c){return{'count':_0xbc03c[_0x1c35('0x13')],'rows':_[_0x1c35('0x47')](_0xbc03c[_0x1c35('0x2b')],function(_0x57915c){return{'membername':_0x57915c[_0x1c35('0x1f')],'UserId':_0x57915c['id'],'queue_name':_0x44953e[_0x1c35('0x1f')],'MailQueueId':_0x44953e['id'],'interface':util[_0x1c35('0x52')](_0x1c35('0x53'),_0x1c35('0x54'),_0x57915c[_0x1c35('0x1f')]),'penalty':0x0,'paused':_0x57915c[_0x1c35('0x4f')],'createdAt':_0x57915c['createdAt'],'updatedAt':_0x57915c[_0x1c35('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4acfe6,_0x521fe8))[_0x1c35('0x2c')](handleError(_0x4acfe6,null));};exports['getTeams']=function(_0x367d8d,_0x371981){var _0x5e0531={};var _0x5414c0={};var _0x4d34c9;var _0x30967e;return db['MailQueue']['findOne']({'where':{'id':_0x367d8d['params']['id']}})[_0x1c35('0x18')](handleEntityNotFound(_0x371981,null))[_0x1c35('0x18')](function(_0x5cbd9d){if(_0x5cbd9d){_0x4d34c9=_0x5cbd9d;_0x5414c0[_0x1c35('0x2e')]=_[_0x1c35('0x2f')](db[_0x1c35('0x55')]['rawAttributes']);_0x5414c0[_0x1c35('0x2a')]=_[_0x1c35('0x2f')](_0x367d8d[_0x1c35('0x2a')]);_0x5414c0['filters']=_['intersection'](_0x5414c0['model'],_0x5414c0[_0x1c35('0x2a')]);_0x5e0531[_0x1c35('0x32')]=_[_0x1c35('0x31')](_0x5414c0[_0x1c35('0x2e')],qs[_0x1c35('0x56')](_0x367d8d[_0x1c35('0x2a')][_0x1c35('0x56')]));_0x5e0531[_0x1c35('0x32')]=_0x5e0531[_0x1c35('0x32')]['length']?_0x5e0531[_0x1c35('0x32')]:_0x5414c0['model'];_0x5e0531[_0x1c35('0x44')]=qs[_0x1c35('0x45')](_0x367d8d[_0x1c35('0x2a')]['sort']);_0x5e0531[_0x1c35('0x28')]=qs['filters'](_[_0x1c35('0x57')](_0x367d8d[_0x1c35('0x2a')],_0x5414c0['filters']));if(_0x367d8d['query'][_0x1c35('0x48')]){_0x5e0531[_0x1c35('0x28')]=_[_0x1c35('0x46')](_0x5e0531['where'],{'$or':_[_0x1c35('0x47')](_0x5e0531[_0x1c35('0x32')],function(_0x4d8cf7){var _0x26a583={};_0x26a583[_0x4d8cf7]={'$like':'%'+_0x367d8d['query'][_0x1c35('0x48')]+'%'};return _0x26a583;})});}_0x5e0531=_[_0x1c35('0x46')]({},_0x5e0531,_0x367d8d[_0x1c35('0x35')]);return _0x4d34c9[_0x1c35('0x58')](_0x5e0531);}})[_0x1c35('0x18')](function(_0x4e1d9f){if(_0x4e1d9f){_0x30967e=_0x4e1d9f[_0x1c35('0x33')];if(!_0x367d8d[_0x1c35('0x2a')]['hasOwnProperty'](_0x1c35('0x59'))){_0x5e0531[_0x1c35('0x14')]=qs[_0x1c35('0x14')](_0x367d8d[_0x1c35('0x2a')][_0x1c35('0x14')]);_0x5e0531[_0x1c35('0x11')]=qs[_0x1c35('0x11')](_0x367d8d[_0x1c35('0x2a')][_0x1c35('0x11')]);}return _0x4d34c9[_0x1c35('0x58')](_0x5e0531);}})[_0x1c35('0x18')](function(_0x356ebd){if(_0x356ebd){return _0x356ebd?{'count':_0x30967e,'rows':_0x356ebd}:null;}})['then'](respondWithResult(_0x371981,null))[_0x1c35('0x2c')](handleError(_0x371981,null));};exports['addTeams']=function(_0x1cab45,_0x26ca36){var _0xe6f7f=_0x1cab45['body'][_0x1c35('0x5a')];return db[_0x1c35('0x55')][_0x1c35('0x4a')]({'where':{'id':_0xe6f7f},'attributes':['id'],'include':[{'model':db[_0x1c35('0x4b')],'as':_0x1c35('0x5b'),'attributes':['id',_0x1c35('0x1f'),_0x1c35('0x5c'),_0x1c35('0x5d'),'interface'],'raw':!![]}]})['then'](function(_0x105104){if(_0x105104){var _0x573e2b=_['flatMap'](_0x105104,function(_0x21ecb6){var _0x2dd1b1=_0x21ecb6[_0x1c35('0x1a')]({'plain':!![]});return _0x2dd1b1[_0x1c35('0x5b')];});return db[_0x1c35('0x22')][_0x1c35('0x36')]({'where':{'id':_0x1cab45[_0x1c35('0x40')]['id']}})[_0x1c35('0x18')](function(_0x2812eb){return db[_0x1c35('0x5e')]['transaction'](function(_0x38a773){return _0x2812eb['addTeams'](_0xe6f7f,{'transaction':_0x38a773})[_0x1c35('0x18')](function(){return BPromise[_0x1c35('0x5f')](_0x573e2b,function(_0x560262){return db[_0x1c35('0x49')][_0x1c35('0x60')]({'where':{'UserId':_0x560262['id'],'MailQueueId':_0x1cab45[_0x1c35('0x40')]['id']},'transaction':_0x38a773});});})['then'](function(){_0x573e2b[_0x1c35('0x61')](function(_0x3929af){socket['emit'](_0x1c35('0x62'),{'UserId':_0x3929af['id'],'MailQueueId':_0x2812eb['id']});});});});});}})['then'](respondWithStatusCode(_0x26ca36,null))[_0x1c35('0x2c')](handleError(_0x26ca36,null));};exports[_0x1c35('0x63')]=function(_0x414243,_0x4bebe4){return db[_0x1c35('0x55')][_0x1c35('0x4a')]({'where':{'id':_0x414243[_0x1c35('0x2a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1c35('0x4b')],'as':_0x1c35('0x5b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4bebe4,null))['then'](function(_0x3afdcc){var _0x50462b=_['map'](_0x3afdcc,'id');var _0x1404f9=[];var _0x486e43=[];var _0x359f98=squel[_0x1c35('0x64')]();_0x359f98[_0x1c35('0x65')]('tq.TeamId')[_0x1c35('0x66')](_0x1c35('0x67'),'tq')[_0x1c35('0x68')](_0x1c35('0x69'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('MailQueueId\x20=\x20?',_0x414243[_0x1c35('0x40')]['id']);for(var _0x477adc=0x0;_0x477adc<_0x3afdcc[_0x1c35('0x33')];_0x477adc+=0x1){let _0x481777=_0x3afdcc[_0x477adc];for(var _0x2cc2b9=0x0;_0x2cc2b9<_0x481777[_0x1c35('0x5b')][_0x1c35('0x33')];_0x2cc2b9+=0x1){let _0x596283=_0x481777[_0x1c35('0x5b')][_0x2cc2b9];var _0x3b85a3=_0x359f98[_0x1c35('0x6a')]();_0x3b85a3[_0x1c35('0x28')](_0x1c35('0x6b'),_0x596283['id']);_0x486e43[_0x1c35('0x6c')](db[_0x1c35('0x5e')]['query'](_0x3b85a3[_0x1c35('0x6d')](),{'type':db[_0x1c35('0x5e')][_0x1c35('0x6e')]['SELECT']})[_0x1c35('0x18')](function(_0x43c362){if(_0x43c362['length']===0x1){return _0x596283['id'];}else{var _0x4222d3=_[_0x1c35('0x6f')](_[_0x1c35('0x47')](_0x43c362,_0x1c35('0x70')),function(_0x33610c){return _[_0x1c35('0x71')](_0x50462b,_0x33610c);});if(_0x4222d3){return _0x596283['id'];}}}));}}return BPromise[_0x1c35('0x72')](_0x486e43)[_0x1c35('0x18')](function(_0x548606){_0x1404f9=_(_0x1404f9)[_0x1c35('0x73')](_0x548606)[_0x1c35('0x74')]()[_0x1c35('0x75')]();return db[_0x1c35('0x22')][_0x1c35('0x36')]({'where':{'id':_0x414243['params']['id']}})[_0x1c35('0x18')](function(_0x3aece2){return db[_0x1c35('0x5e')][_0x1c35('0x76')](function(_0x1c5066){return _0x3aece2[_0x1c35('0x63')](_0x414243[_0x1c35('0x2a')]['ids'],{'transaction':_0x1c5066})[_0x1c35('0x18')](function(){if(!_[_0x1c35('0x77')](_0x1404f9)){return _0x3aece2['removeAgents'](_0x1404f9,{'transaction':_0x1c5066});}})['then'](function(){_0x1404f9[_0x1c35('0x61')](function(_0x57897b){socket['emit'](_0x1c35('0x78'),{'UserId':_0x57897b,'MailQueueId':_0x3aece2['id']});});});});});});})[_0x1c35('0x18')](respondWithStatusCode(_0x4bebe4,null))[_0x1c35('0x2c')](handleError(_0x4bebe4,null));};exports[_0x1c35('0x79')]=function(_0x2e9f44,_0x584aa8){return db[_0x1c35('0x22')][_0x1c35('0x36')]({'where':{'id':_0x2e9f44[_0x1c35('0x40')]['id']}})['then'](handleEntityNotFound(_0x584aa8,null))[_0x1c35('0x18')](function(_0x36c299){if(_0x36c299){return _0x36c299['addAgents'](_0x2e9f44[_0x1c35('0x38')][_0x1c35('0x5a')],_[_0x1c35('0x7a')](_0x2e9f44[_0x1c35('0x38')],[_0x1c35('0x5a'),'id'])||{})[_0x1c35('0x7b')](function(_0x253c36){for(var _0x211809=0x0;_0x211809<_0x2e9f44['body'][_0x1c35('0x5a')][_0x1c35('0x33')];_0x211809+=0x1){socket['emit'](_0x1c35('0x62'),{'UserId':Number(_0x2e9f44[_0x1c35('0x38')][_0x1c35('0x5a')][_0x211809]),'MailQueueId':Number(_0x2e9f44[_0x1c35('0x40')]['id'])});}return _0x253c36;});}})[_0x1c35('0x18')](respondWithResult(_0x584aa8,null))[_0x1c35('0x2c')](handleError(_0x584aa8,null));};exports[_0x1c35('0x7c')]=function(_0x38e9e2,_0x40dd79){return db['MailQueue']['find']({'where':{'id':_0x38e9e2[_0x1c35('0x40')]['id']}})[_0x1c35('0x18')](handleEntityNotFound(_0x40dd79,null))[_0x1c35('0x18')](function(_0x6fca07){if(_0x6fca07){return _0x6fca07[_0x1c35('0x7c')](_0x38e9e2[_0x1c35('0x2a')]['ids'])[_0x1c35('0x18')](function(){if(_[_0x1c35('0x7d')](_0x38e9e2['query'][_0x1c35('0x5a')])){for(var _0x4b5944=0x0;_0x4b5944<_0x38e9e2[_0x1c35('0x2a')][_0x1c35('0x5a')][_0x1c35('0x33')];_0x4b5944+=0x1){socket[_0x1c35('0x7e')](_0x1c35('0x78'),{'UserId':Number(_0x38e9e2[_0x1c35('0x2a')][_0x1c35('0x5a')][_0x4b5944]),'MailQueueId':Number(_0x38e9e2[_0x1c35('0x40')]['id'])});}}else{socket['emit'](_0x1c35('0x78'),{'UserId':Number(_0x38e9e2['query'][_0x1c35('0x5a')]),'MailQueueId':Number(_0x38e9e2[_0x1c35('0x40')]['id'])});}});}})[_0x1c35('0x18')](respondWithStatusCode(_0x40dd79,null))[_0x1c35('0x2c')](handleError(_0x40dd79,null));};exports[_0x1c35('0x7f')]=function(_0x16b99c,_0x17e8ed){var _0x502f39={};var _0x39756a={};var _0x14fe35;var _0x29c73d;return db[_0x1c35('0x22')]['findOne']({'where':{'id':_0x16b99c[_0x1c35('0x40')]['id']}})[_0x1c35('0x18')](handleEntityNotFound(_0x17e8ed,null))['then'](function(_0x4aecd3){if(_0x4aecd3){_0x14fe35=_0x4aecd3;_0x39756a[_0x1c35('0x2e')]=_[_0x1c35('0x2f')](db[_0x1c35('0x4b')][_0x1c35('0x23')]);_0x39756a['query']=_['keys'](_0x16b99c[_0x1c35('0x2a')]);_0x39756a[_0x1c35('0x30')]=_[_0x1c35('0x31')](_0x39756a[_0x1c35('0x2e')],_0x39756a[_0x1c35('0x2a')]);_0x502f39[_0x1c35('0x32')]=_[_0x1c35('0x31')](_0x39756a[_0x1c35('0x2e')],qs[_0x1c35('0x56')](_0x16b99c[_0x1c35('0x2a')][_0x1c35('0x56')]));_0x502f39[_0x1c35('0x32')]=_0x502f39[_0x1c35('0x32')]['length']?_0x502f39[_0x1c35('0x32')]:_0x39756a[_0x1c35('0x2e')];_0x502f39[_0x1c35('0x44')]=qs['sort'](_0x16b99c[_0x1c35('0x2a')][_0x1c35('0x45')]);_0x502f39['where']=qs[_0x1c35('0x30')](_['pick'](_0x16b99c['query'],_0x39756a['filters']));if(_0x16b99c['query'][_0x1c35('0x48')]){_0x502f39[_0x1c35('0x28')]=_['merge'](_0x502f39[_0x1c35('0x28')],{'$or':_['map'](_0x502f39[_0x1c35('0x32')],function(_0x5edd6e){var _0x3f01b6={};_0x3f01b6[_0x5edd6e]={'$like':'%'+_0x16b99c[_0x1c35('0x2a')][_0x1c35('0x48')]+'%'};return _0x3f01b6;})});}_0x502f39=_[_0x1c35('0x46')]({},_0x502f39,_0x16b99c[_0x1c35('0x35')]);return _0x14fe35[_0x1c35('0x7f')](_0x502f39);}})[_0x1c35('0x18')](function(_0x392ec2){if(_0x392ec2){_0x29c73d=_0x392ec2['length'];if(!_0x16b99c[_0x1c35('0x2a')][_0x1c35('0x43')](_0x1c35('0x59'))){_0x502f39[_0x1c35('0x14')]=qs['limit'](_0x16b99c['query'][_0x1c35('0x14')]);_0x502f39[_0x1c35('0x11')]=qs[_0x1c35('0x11')](_0x16b99c['query'][_0x1c35('0x11')]);}return _0x14fe35[_0x1c35('0x7f')](_0x502f39);}})[_0x1c35('0x18')](function(_0x251a71){if(_0x251a71){return _0x251a71?{'count':_0x29c73d,'rows':_0x251a71}:null;}})[_0x1c35('0x18')](respondWithResult(_0x17e8ed,null))[_0x1c35('0x2c')](handleError(_0x17e8ed,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index f92a930..06bf799 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 _0xfb8c=['MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x487ed4,_0x312026){var _0xa1193e=function(_0x608154){while(--_0x608154){_0x487ed4['push'](_0x487ed4['shift']());}};_0xa1193e(++_0x312026);}(_0xfb8c,0x104));var _0xcfb8=function(_0x17f9be,_0x41a34a){_0x17f9be=_0x17f9be-0x0;var _0x447656=_0xfb8c[_0x17f9be];return _0x447656;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xcfb8('0x0'))['db'][_0xcfb8('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xcfb8('0x2')](0x0);var events={'afterCreate':_0xcfb8('0x3'),'afterUpdate':_0xcfb8('0x4'),'afterDestroy':_0xcfb8('0x5')};function emitEvent(_0x34c06e){return function(_0x479240,_0x6b8610,_0x4e77cb){MailQueueEvents[_0xcfb8('0x6')](_0x34c06e+':'+_0x479240['id'],_0x479240);MailQueueEvents[_0xcfb8('0x6')](_0x34c06e,_0x479240);_0x4e77cb(null);};}for(var e in events){if(events[_0xcfb8('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xcfb8('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xc0fc=['emit','hook','exports','events','../../mysqldb','MailQueue','update'];(function(_0x54bffd,_0x325cb0){var _0x1d4e36=function(_0x38bbb9){while(--_0x38bbb9){_0x54bffd['push'](_0x54bffd['shift']());}};_0x1d4e36(++_0x325cb0);}(_0xc0fc,0x1d8));var _0xcc0f=function(_0x146bda,_0x5c75a9){_0x146bda=_0x146bda-0x0;var _0x5d1e73=_0xc0fc[_0x146bda];return _0x5d1e73;};'use strict';var EventEmitter=require(_0xcc0f('0x0'));var MailQueue=require(_0xcc0f('0x1'))['db'][_0xcc0f('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xcc0f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x125181){return function(_0x140849,_0x49417b,_0x135616){MailQueueEvents[_0xcc0f('0x4')](_0x125181+':'+_0x140849['id'],_0x140849);MailQueueEvents[_0xcc0f('0x4')](_0x125181,_0x140849);_0x135616(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xcc0f('0x5')](e,emitEvent(event));}}module[_0xcc0f('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index d34ef3f..cdcf92f 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 _0x7b4e=['bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash','util','../../config/logger','api'];(function(_0x3c2d2d,_0x1bf240){var _0x1034ec=function(_0x8907df){while(--_0x8907df){_0x3c2d2d['push'](_0x3c2d2d['shift']());}};_0x1034ec(++_0x1bf240);}(_0x7b4e,0xb2));var _0xe7b4=function(_0x550c82,_0x2c8be0){_0x550c82=_0x550c82-0x0;var _0x278f09=_0x7b4e[_0x550c82];return _0x278f09;};'use strict';var _=require(_0xe7b4('0x0'));var util=require(_0xe7b4('0x1'));var logger=require(_0xe7b4('0x2'))(_0xe7b4('0x3'));var moment=require('moment');var BPromise=require(_0xe7b4('0x4'));var rp=require(_0xe7b4('0x5'));var fs=require('fs');var path=require(_0xe7b4('0x6'));var rimraf=require(_0xe7b4('0x7'));var config=require(_0xe7b4('0x8'));var attributes=require(_0xe7b4('0x9'));module['exports']=function(_0x347357,_0x42a8e1){return _0x347357[_0xe7b4('0xa')](_0xe7b4('0xb'),attributes,{'tableName':_0xe7b4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb8c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','mail_queues','lodash','util','../../config/logger'];(function(_0x113734,_0x23af59){var _0x3eab32=function(_0x479783){while(--_0x479783){_0x113734['push'](_0x113734['shift']());}};_0x3eab32(++_0x23af59);}(_0xeb8c,0x1d1));var _0xceb8=function(_0x4cd333,_0x215541){_0x4cd333=_0x4cd333-0x0;var _0x38d9e8=_0xeb8c[_0x4cd333];return _0x38d9e8;};'use strict';var _=require(_0xceb8('0x0'));var util=require(_0xceb8('0x1'));var logger=require(_0xceb8('0x2'))('api');var moment=require(_0xceb8('0x3'));var BPromise=require(_0xceb8('0x4'));var rp=require(_0xceb8('0x5'));var fs=require('fs');var path=require(_0xceb8('0x6'));var rimraf=require(_0xceb8('0x7'));var config=require(_0xceb8('0x8'));var attributes=require(_0xceb8('0x9'));module[_0xceb8('0xa')]=function(_0x32d1b7,_0x397426){return _0x32d1b7[_0xceb8('0xb')]('MailQueue',attributes,{'tableName':_0xceb8('0xc'),'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 67b44db..4a3131f 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 _0xca93=['where','attributes','limit','include','map','model','debug','ShowMailQueue','MailQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','options','raw'];(function(_0x1a0f7d,_0x481abd){var _0x3c20a7=function(_0xdc91f9){while(--_0xdc91f9){_0x1a0f7d['push'](_0x1a0f7d['shift']());}};_0x3c20a7(++_0x481abd);}(_0xca93,0x1a4));var _0x3ca9=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xca93[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x3ca9('0x0'));var util=require(_0x3ca9('0x1'));var moment=require('moment');var BPromise=require(_0x3ca9('0x2'));var rs=require(_0x3ca9('0x3'));var fs=require('fs');var Redis=require(_0x3ca9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ca9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3ca9('0x6'));var jayson=require(_0x3ca9('0x7'));var client=jayson[_0x3ca9('0x8')][_0x3ca9('0x9')]({'port':0x232a});config[_0x3ca9('0xa')]=_[_0x3ca9('0xb')](config[_0x3ca9('0xa')],{'host':_0x3ca9('0xc'),'port':0x18eb});var socket=require(_0x3ca9('0xd'))(new Redis(config[_0x3ca9('0xa')]));require(_0x3ca9('0xe'))[_0x3ca9('0xf')](socket);function respondWithRpcPromise(_0x5e40b1,_0x2d8505,_0x267bc5){return new BPromise(function(_0x2cd3c1,_0x598d1e){return client[_0x3ca9('0x10')](_0x5e40b1,_0x267bc5)[_0x3ca9('0x11')](function(_0x3ca241){logger[_0x3ca9('0x12')](_0x3ca9('0x13'),_0x2d8505,_0x3ca9('0x14'));logger['debug'](_0x3ca9('0x15'),_0x2d8505,_0x3ca9('0x14'),JSON[_0x3ca9('0x16')](_0x3ca241));if(_0x3ca241['error']){if(_0x3ca241[_0x3ca9('0x17')][_0x3ca9('0x18')]===0x1f4){logger[_0x3ca9('0x17')]('MailQueue,\x20%s,\x20%s',_0x2d8505,_0x3ca241['error'][_0x3ca9('0x19')]);return _0x598d1e(_0x3ca241['error'][_0x3ca9('0x19')]);}logger[_0x3ca9('0x17')](_0x3ca9('0x13'),_0x2d8505,_0x3ca241[_0x3ca9('0x17')][_0x3ca9('0x19')]);return _0x2cd3c1(_0x3ca241['error'][_0x3ca9('0x19')]);}else{logger[_0x3ca9('0x12')](_0x3ca9('0x13'),_0x2d8505,_0x3ca9('0x14'));_0x2cd3c1(_0x3ca241[_0x3ca9('0x1a')]['message']);}})[_0x3ca9('0x1b')](function(_0x400b84){logger[_0x3ca9('0x17')](_0x3ca9('0x13'),_0x2d8505,_0x400b84);_0x598d1e(_0x400b84);});});}exports[_0x3ca9('0x1c')]=function(_0x29beaf){var _0x35bea8=this;return new Promise(function(_0x5b39a2,_0x1d7f5e){return db['MailQueue']['findAll']({'raw':_0x29beaf['options']?_0x29beaf[_0x3ca9('0x1d')][_0x3ca9('0x1e')]===undefined?!![]:![]:!![],'where':_0x29beaf['options']?_0x29beaf[_0x3ca9('0x1d')][_0x3ca9('0x1f')]||null:null,'attributes':_0x29beaf['options']?_0x29beaf[_0x3ca9('0x1d')][_0x3ca9('0x20')]||null:null,'limit':_0x29beaf[_0x3ca9('0x1d')]?_0x29beaf[_0x3ca9('0x1d')][_0x3ca9('0x21')]||null:null,'include':_0x29beaf[_0x3ca9('0x1d')]?_0x29beaf[_0x3ca9('0x1d')][_0x3ca9('0x22')]?_[_0x3ca9('0x23')](_0x29beaf[_0x3ca9('0x1d')][_0x3ca9('0x22')],function(_0x412978){return{'model':db[_0x412978[_0x3ca9('0x24')]],'as':_0x412978['as'],'attributes':_0x412978[_0x3ca9('0x20')],'include':_0x412978[_0x3ca9('0x22')]?_[_0x3ca9('0x23')](_0x412978[_0x3ca9('0x22')],function(_0x3e299d){return{'model':db[_0x3e299d[_0x3ca9('0x24')]],'as':_0x3e299d['as'],'attributes':_0x3e299d[_0x3ca9('0x20')],'include':_0x3e299d['include']?_[_0x3ca9('0x23')](_0x3e299d['include'],function(_0x47126a){return{'model':db[_0x47126a[_0x3ca9('0x24')]],'as':_0x47126a['as'],'attributes':_0x47126a['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ca9('0x11')](function(_0x22a4d5){logger[_0x3ca9('0x12')](_0x3ca9('0x1c'),_0x29beaf);logger[_0x3ca9('0x25')]('GetMailQueue',_0x29beaf,JSON[_0x3ca9('0x16')](_0x22a4d5));_0x5b39a2(_0x22a4d5);})[_0x3ca9('0x1b')](function(_0x519a50){logger['error']('GetMailQueue',_0x519a50['message'],_0x29beaf);_0x1d7f5e(_0x35bea8['error'](0x1f4,_0x519a50[_0x3ca9('0x19')]));});});};exports[_0x3ca9('0x26')]=function(_0x2ee79a){var _0x132d0a=this;return new Promise(function(_0x2b6570,_0x2b7e99){return db[_0x3ca9('0x27')][_0x3ca9('0x28')]({'raw':_0x2ee79a[_0x3ca9('0x1d')]?_0x2ee79a['options'][_0x3ca9('0x1e')]===undefined?!![]:![]:!![],'where':_0x2ee79a['options']?_0x2ee79a[_0x3ca9('0x1d')]['where']||null:null,'attributes':_0x2ee79a[_0x3ca9('0x1d')]?_0x2ee79a[_0x3ca9('0x1d')][_0x3ca9('0x20')]||null:null,'include':_0x2ee79a[_0x3ca9('0x1d')]?_0x2ee79a['options'][_0x3ca9('0x22')]?_[_0x3ca9('0x23')](_0x2ee79a['options']['include'],function(_0x5c4ce0){return{'model':db[_0x5c4ce0[_0x3ca9('0x24')]],'as':_0x5c4ce0['as'],'attributes':_0x5c4ce0[_0x3ca9('0x20')],'include':_0x5c4ce0[_0x3ca9('0x22')]?_['map'](_0x5c4ce0[_0x3ca9('0x22')],function(_0x5ce992){return{'model':db[_0x5ce992[_0x3ca9('0x24')]],'as':_0x5ce992['as'],'attributes':_0x5ce992[_0x3ca9('0x20')],'include':_0x5ce992[_0x3ca9('0x22')]?_[_0x3ca9('0x23')](_0x5ce992[_0x3ca9('0x22')],function(_0x183d61){return{'model':db[_0x183d61[_0x3ca9('0x24')]],'as':_0x183d61['as'],'attributes':_0x183d61['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ca9('0x11')](function(_0x20d9f1){logger['info']('ShowMailQueue',_0x2ee79a);logger['debug'](_0x3ca9('0x26'),_0x2ee79a,JSON['stringify'](_0x20d9f1));_0x2b6570(_0x20d9f1);})[_0x3ca9('0x1b')](function(_0x6838bb){logger['error'](_0x3ca9('0x26'),_0x6838bb['message'],_0x2ee79a);_0x2b7e99(_0x132d0a[_0x3ca9('0x17')](0x1f4,_0x6838bb[_0x3ca9('0x19')]));});});}; \ No newline at end of file +var _0xdecb=['error','code','message','result','catch','GetMailQueue','findAll','options','where','attributes','limit','map','include','model','ShowMailQueue','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xdecb,0x8f));var _0xbdec=function(_0x30c57e,_0x56ecc5){_0x30c57e=_0x30c57e-0x0;var _0x21d96b=_0xdecb[_0x30c57e];return _0x21d96b;};'use strict';var _=require(_0xbdec('0x0'));var util=require(_0xbdec('0x1'));var moment=require(_0xbdec('0x2'));var BPromise=require(_0xbdec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbdec('0x4'));var db=require(_0xbdec('0x5'))['db'];var utils=require(_0xbdec('0x6'));var logger=require(_0xbdec('0x7'))(_0xbdec('0x8'));var config=require(_0xbdec('0x9'));var jayson=require(_0xbdec('0xa'));var client=jayson[_0xbdec('0xb')][_0xbdec('0xc')]({'port':0x232a});config[_0xbdec('0xd')]=_[_0xbdec('0xe')](config[_0xbdec('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xbdec('0xf'))(new Redis(config['redis']));require(_0xbdec('0x10'))[_0xbdec('0x11')](socket);function respondWithRpcPromise(_0x18e51b,_0x4837e0,_0x54e372){return new BPromise(function(_0x9ebbfa,_0x341fa5){return client[_0xbdec('0x12')](_0x18e51b,_0x54e372)[_0xbdec('0x13')](function(_0x1dce2f){logger[_0xbdec('0x14')](_0xbdec('0x15'),_0x4837e0,'request\x20sent');logger[_0xbdec('0x16')](_0xbdec('0x17'),_0x4837e0,_0xbdec('0x18'),JSON['stringify'](_0x1dce2f));if(_0x1dce2f[_0xbdec('0x19')]){if(_0x1dce2f[_0xbdec('0x19')][_0xbdec('0x1a')]===0x1f4){logger[_0xbdec('0x19')](_0xbdec('0x15'),_0x4837e0,_0x1dce2f[_0xbdec('0x19')][_0xbdec('0x1b')]);return _0x341fa5(_0x1dce2f['error'][_0xbdec('0x1b')]);}logger[_0xbdec('0x19')](_0xbdec('0x15'),_0x4837e0,_0x1dce2f[_0xbdec('0x19')][_0xbdec('0x1b')]);return _0x9ebbfa(_0x1dce2f[_0xbdec('0x19')]['message']);}else{logger[_0xbdec('0x14')]('MailQueue,\x20%s,\x20%s',_0x4837e0,'request\x20sent');_0x9ebbfa(_0x1dce2f[_0xbdec('0x1c')][_0xbdec('0x1b')]);}})[_0xbdec('0x1d')](function(_0x3dc5d8){logger['error'](_0xbdec('0x15'),_0x4837e0,_0x3dc5d8);_0x341fa5(_0x3dc5d8);});});}exports[_0xbdec('0x1e')]=function(_0x3d834d){var _0x4a7ed3=this;return new Promise(function(_0x58e56e,_0x1a9ac9){return db['MailQueue'][_0xbdec('0x1f')]({'raw':_0x3d834d[_0xbdec('0x20')]?_0x3d834d['options']['raw']===undefined?!![]:![]:!![],'where':_0x3d834d[_0xbdec('0x20')]?_0x3d834d['options'][_0xbdec('0x21')]||null:null,'attributes':_0x3d834d[_0xbdec('0x20')]?_0x3d834d['options'][_0xbdec('0x22')]||null:null,'limit':_0x3d834d['options']?_0x3d834d[_0xbdec('0x20')][_0xbdec('0x23')]||null:null,'include':_0x3d834d[_0xbdec('0x20')]?_0x3d834d[_0xbdec('0x20')]['include']?_[_0xbdec('0x24')](_0x3d834d[_0xbdec('0x20')][_0xbdec('0x25')],function(_0x1bfa41){return{'model':db[_0x1bfa41[_0xbdec('0x26')]],'as':_0x1bfa41['as'],'attributes':_0x1bfa41[_0xbdec('0x22')],'include':_0x1bfa41[_0xbdec('0x25')]?_[_0xbdec('0x24')](_0x1bfa41[_0xbdec('0x25')],function(_0x185f38){return{'model':db[_0x185f38[_0xbdec('0x26')]],'as':_0x185f38['as'],'attributes':_0x185f38['attributes'],'include':_0x185f38[_0xbdec('0x25')]?_[_0xbdec('0x24')](_0x185f38[_0xbdec('0x25')],function(_0x415164){return{'model':db[_0x415164[_0xbdec('0x26')]],'as':_0x415164['as'],'attributes':_0x415164[_0xbdec('0x22')]};}):[]};}):[]};}):[]:[]})[_0xbdec('0x13')](function(_0x498647){logger[_0xbdec('0x14')](_0xbdec('0x1e'),_0x3d834d);logger['debug'](_0xbdec('0x1e'),_0x3d834d,JSON['stringify'](_0x498647));_0x58e56e(_0x498647);})[_0xbdec('0x1d')](function(_0x4f4ddf){logger[_0xbdec('0x19')](_0xbdec('0x1e'),_0x4f4ddf[_0xbdec('0x1b')],_0x3d834d);_0x1a9ac9(_0x4a7ed3[_0xbdec('0x19')](0x1f4,_0x4f4ddf['message']));});});};exports[_0xbdec('0x27')]=function(_0xe13020){var _0x559462=this;return new Promise(function(_0x25fe90,_0x464d7f){return db['MailQueue']['find']({'raw':_0xe13020[_0xbdec('0x20')]?_0xe13020[_0xbdec('0x20')][_0xbdec('0x28')]===undefined?!![]:![]:!![],'where':_0xe13020[_0xbdec('0x20')]?_0xe13020[_0xbdec('0x20')][_0xbdec('0x21')]||null:null,'attributes':_0xe13020[_0xbdec('0x20')]?_0xe13020[_0xbdec('0x20')][_0xbdec('0x22')]||null:null,'include':_0xe13020['options']?_0xe13020[_0xbdec('0x20')][_0xbdec('0x25')]?_['map'](_0xe13020['options'][_0xbdec('0x25')],function(_0x470a5e){return{'model':db[_0x470a5e[_0xbdec('0x26')]],'as':_0x470a5e['as'],'attributes':_0x470a5e['attributes'],'include':_0x470a5e[_0xbdec('0x25')]?_[_0xbdec('0x24')](_0x470a5e['include'],function(_0x4623f4){return{'model':db[_0x4623f4[_0xbdec('0x26')]],'as':_0x4623f4['as'],'attributes':_0x4623f4[_0xbdec('0x22')],'include':_0x4623f4[_0xbdec('0x25')]?_['map'](_0x4623f4[_0xbdec('0x25')],function(_0x2260a7){return{'model':db[_0x2260a7['model']],'as':_0x2260a7['as'],'attributes':_0x2260a7['attributes']};}):[]};}):[]};}):[]:[]})[_0xbdec('0x13')](function(_0x902607){logger['info'](_0xbdec('0x27'),_0xe13020);logger['debug'](_0xbdec('0x27'),_0xe13020,JSON[_0xbdec('0x29')](_0x902607));_0x25fe90(_0x902607);})[_0xbdec('0x1d')](function(_0x16e5af){logger['error']('ShowMailQueue',_0x16e5af['message'],_0xe13020);_0x464d7f(_0x559462[_0xbdec('0x19')](0x1f4,_0x16e5af[_0xbdec('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 755fefe..93cfde3 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 _0x7d98=['./mailQueue.events','remove','update','emit','removeListener','length','mailQueue:'];(function(_0xd8aaf6,_0x893286){var _0x36d08d=function(_0x36b144){while(--_0x36b144){_0xd8aaf6['push'](_0xd8aaf6['shift']());}};_0x36d08d(++_0x893286);}(_0x7d98,0xe7));var _0x87d9=function(_0xad57ee,_0x2823a6){_0xad57ee=_0xad57ee-0x0;var _0x3eaea9=_0x7d98[_0xad57ee];return _0x3eaea9;};'use strict';var MailQueueEvents=require(_0x87d9('0x0'));var events=['save',_0x87d9('0x1'),_0x87d9('0x2')];function createListener(_0x3fdc56,_0xbee750){return function(_0x47cceb){_0xbee750[_0x87d9('0x3')](_0x3fdc56,_0x47cceb);};}function removeListener(_0x317ba8,_0x4b4f58){return function(){MailQueueEvents[_0x87d9('0x4')](_0x317ba8,_0x4b4f58);};}exports['register']=function(_0x5ed6d2){for(var _0x510ba4=0x0,_0x3fe56d=events[_0x87d9('0x5')];_0x510ba4<_0x3fe56d;_0x510ba4++){var _0x2dc542=events[_0x510ba4];var _0x5f2693=createListener(_0x87d9('0x6')+_0x2dc542,_0x5ed6d2);MailQueueEvents['on'](_0x2dc542,_0x5f2693);}}; \ No newline at end of file +var _0xe9b4=['mailQueue:','save','remove','update','emit','removeListener','register','length'];(function(_0x271875,_0x1728a0){var _0x79c1c2=function(_0x40f091){while(--_0x40f091){_0x271875['push'](_0x271875['shift']());}};_0x79c1c2(++_0x1728a0);}(_0xe9b4,0x1f1));var _0x4e9b=function(_0x34ade2,_0x51ed88){_0x34ade2=_0x34ade2-0x0;var _0x5cd91d=_0xe9b4[_0x34ade2];return _0x5cd91d;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x4e9b('0x0'),_0x4e9b('0x1'),_0x4e9b('0x2')];function createListener(_0x29a8ac,_0x38ed05){return function(_0xd2275){_0x38ed05[_0x4e9b('0x3')](_0x29a8ac,_0xd2275);};}function removeListener(_0x2537e3,_0x38c114){return function(){MailQueueEvents[_0x4e9b('0x4')](_0x2537e3,_0x38c114);};}exports[_0x4e9b('0x5')]=function(_0xa7cd01){for(var _0x5d063b=0x0,_0x5d863a=events[_0x4e9b('0x6')];_0x5d063b<_0x5d863a;_0x5d063b++){var _0x3d95b8=events[_0x5d063b];var _0x564242=createListener(_0x4e9b('0x7')+_0x3d95b8,_0xa7cd01);MailQueueEvents['on'](_0x3d95b8,_0x564242);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 6285c64..69e8dd3 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 _0x8cd4=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','create'];(function(_0x271697,_0x6897d6){var _0x426093=function(_0x4d4dfe){while(--_0x4d4dfe){_0x271697['push'](_0x271697['shift']());}};_0x426093(++_0x6897d6);}(_0x8cd4,0x1e9));var _0x48cd=function(_0x49a17d,_0x38066e){_0x49a17d=_0x49a17d-0x0;var _0x1810c0=_0x8cd4[_0x49a17d];return _0x1810c0;};'use strict';var multer=require(_0x48cd('0x0'));var util=require(_0x48cd('0x1'));var path=require(_0x48cd('0x2'));var timeout=require(_0x48cd('0x3'));var express=require(_0x48cd('0x4'));var router=express['Router']();var fs_extra=require(_0x48cd('0x5'));var auth=require(_0x48cd('0x6'));var interaction=require(_0x48cd('0x7'));var config=require(_0x48cd('0x8'));var controller=require(_0x48cd('0x9'));router[_0x48cd('0xa')]('/',auth[_0x48cd('0xb')](),controller[_0x48cd('0xc')]);router[_0x48cd('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x48cd('0xd')]);router[_0x48cd('0xa')](_0x48cd('0xe'),auth[_0x48cd('0xb')](),controller[_0x48cd('0xf')]);router['post']('/',auth[_0x48cd('0xb')](),controller[_0x48cd('0x10')]);router[_0x48cd('0x11')]('/:id',auth[_0x48cd('0xb')](),controller[_0x48cd('0x12')]);router[_0x48cd('0x13')](_0x48cd('0xe'),auth[_0x48cd('0xb')](),controller[_0x48cd('0x14')]);module[_0x48cd('0x15')]=router; \ No newline at end of file +var _0xcebc=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xcebc,0x110));var _0xcceb=function(_0x45c5fe,_0x4efa6b){_0x45c5fe=_0x45c5fe-0x0;var _0x23f6da=_0xcebc[_0x45c5fe];return _0x23f6da;};'use strict';var multer=require(_0xcceb('0x0'));var util=require(_0xcceb('0x1'));var path=require(_0xcceb('0x2'));var timeout=require(_0xcceb('0x3'));var express=require(_0xcceb('0x4'));var router=express[_0xcceb('0x5')]();var fs_extra=require(_0xcceb('0x6'));var auth=require(_0xcceb('0x7'));var interaction=require(_0xcceb('0x8'));var config=require(_0xcceb('0x9'));var controller=require(_0xcceb('0xa'));router[_0xcceb('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xcceb('0xc')](),controller[_0xcceb('0xd')]);router['get'](_0xcceb('0xe'),auth[_0xcceb('0xc')](),controller[_0xcceb('0xf')]);router[_0xcceb('0x10')]('/',auth['isAuthenticated'](),controller[_0xcceb('0x11')]);router[_0xcceb('0x12')](_0xcceb('0xe'),auth[_0xcceb('0xc')](),controller[_0xcceb('0x13')]);router[_0xcceb('0x14')]('/:id',auth[_0xcceb('0xc')](),controller[_0xcceb('0x15')]);module[_0xcceb('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 65615c8..af07e9f 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 _0xd540=['STRING','sequelize','exports'];(function(_0x269039,_0x1e24df){var _0x688200=function(_0x117c77){while(--_0x117c77){_0x269039['push'](_0x269039['shift']());}};_0x688200(++_0x1e24df);}(_0xd540,0x124));var _0x0d54=function(_0x12a237,_0x1433f7){_0x12a237=_0x12a237-0x0;var _0x557e9d=_0xd540[_0x12a237];return _0x557e9d;};'use strict';var moment=require('moment');var Sequelize=require(_0x0d54('0x0'));module[_0x0d54('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0d54('0x2')]}}; \ No newline at end of file +var _0x33b4=['sequelize','exports','STRING','DATE','moment'];(function(_0xbee49b,_0x23a9b4){var _0x412dca=function(_0x54448c){while(--_0x54448c){_0xbee49b['push'](_0xbee49b['shift']());}};_0x412dca(++_0x23a9b4);}(_0x33b4,0x81));var _0x433b=function(_0x174a84,_0x313c90){_0x174a84=_0x174a84-0x0;var _0x28f08c=_0x33b4[_0x174a84];return _0x28f08c;};'use strict';var moment=require(_0x433b('0x0'));var Sequelize=require(_0x433b('0x1'));module[_0x433b('0x2')]={'uniqueid':{'type':Sequelize[_0x433b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x433b('0x3')]},'joinAt':{'type':Sequelize[_0x433b('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x433b('0x4')]},'exitAt':{'type':Sequelize[_0x433b('0x4')]},'reason':{'type':Sequelize[_0x433b('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 40e09dc..9136abc 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 _0xffd6=['rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','name','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','catch','create','body','describe','eml-format'];(function(_0x895358,_0x32f914){var _0x26e26e=function(_0xf2da4a){while(--_0xf2da4a){_0x895358['push'](_0x895358['shift']());}};_0x26e26e(++_0x32f914);}(_0xffd6,0x97));var _0x6ffd=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0xffd6[_0x18d631];return _0x50d708;};'use strict';var emlformat=require(_0x6ffd('0x0'));var rimraf=require(_0x6ffd('0x1'));var zipdir=require(_0x6ffd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6ffd('0x3'));var BPromise=require(_0x6ffd('0x4'));var Mustache=require(_0x6ffd('0x5'));var util=require('util');var path=require(_0x6ffd('0x6'));var sox=require(_0x6ffd('0x7'));var csv=require(_0x6ffd('0x8'));var ejs=require(_0x6ffd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ffd('0xa'));var squel=require(_0x6ffd('0xb'));var crypto=require(_0x6ffd('0xc'));var jsforce=require(_0x6ffd('0xd'));var deskjs=require(_0x6ffd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6ffd('0xf'));var Papa=require(_0x6ffd('0x10'));var Redis=require('ioredis');var authService=require(_0x6ffd('0x11'));var qs=require(_0x6ffd('0x12'));var as=require(_0x6ffd('0x13'));var hardwareService=require(_0x6ffd('0x14'));var logger=require(_0x6ffd('0x15'))(_0x6ffd('0x16'));var utils=require(_0x6ffd('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6ffd('0x18'));var db=require(_0x6ffd('0x19'))['db'];function respondWithStatusCode(_0x5e8d6d,_0x2d0b63){_0x2d0b63=_0x2d0b63||0xcc;return function(_0x2ec8a5){if(_0x2ec8a5){return _0x5e8d6d[_0x6ffd('0x1a')](_0x2d0b63);}return _0x5e8d6d[_0x6ffd('0x1b')](_0x2d0b63)['end']();};}function respondWithResult(_0x259235,_0x594cb3){_0x594cb3=_0x594cb3||0xc8;return function(_0x468ecc){if(_0x468ecc){return _0x259235['status'](_0x594cb3)[_0x6ffd('0x1c')](_0x468ecc);}};}function respondWithFilteredResult(_0x261ed7,_0x45db49){return function(_0x5d8aff){if(_0x5d8aff){var _0x15fca6=typeof _0x45db49[_0x6ffd('0x1d')]===_0x6ffd('0x1e')&&typeof _0x45db49[_0x6ffd('0x1f')]===_0x6ffd('0x1e');var _0x19a772=_0x5d8aff[_0x6ffd('0x20')];var _0x889a4b=_0x15fca6?0x0:_0x45db49['offset'];var _0x11a609=_0x15fca6?_0x5d8aff['count']:_0x45db49['offset']+_0x45db49[_0x6ffd('0x1f')];var _0x359d09;if(_0x11a609>=_0x19a772){_0x11a609=_0x19a772;_0x359d09=0xc8;}else{_0x359d09=0xce;}_0x261ed7['status'](_0x359d09);return _0x261ed7[_0x6ffd('0x21')](_0x6ffd('0x22'),_0x889a4b+'-'+_0x11a609+'/'+_0x19a772)['json'](_0x5d8aff);}return null;};}function patchUpdates(_0x564a11){return function(_0x465971){try{jsonpatch[_0x6ffd('0x23')](_0x465971,_0x564a11,!![]);}catch(_0x4dcc50){return BPromise[_0x6ffd('0x24')](_0x4dcc50);}return _0x465971[_0x6ffd('0x25')]();};}function saveUpdates(_0x327fee,_0x53128a){return function(_0x3ba429){if(_0x3ba429){return _0x3ba429[_0x6ffd('0x26')](_0x327fee)['then'](function(_0x356c9c){return _0x356c9c;});}return null;};}function removeEntity(_0x438d1a,_0x50c19a){return function(_0x31fb22){if(_0x31fb22){return _0x31fb22[_0x6ffd('0x27')]()[_0x6ffd('0x28')](function(){_0x438d1a['status'](0xcc)[_0x6ffd('0x29')]();});}};}function handleEntityNotFound(_0x3e5726,_0x46b03f){return function(_0x4ae7ac){if(!_0x4ae7ac){_0x3e5726[_0x6ffd('0x1a')](0x194);}return _0x4ae7ac;};}function handleError(_0x5a55e2,_0x41ab4a){_0x41ab4a=_0x41ab4a||0x1f4;return function(_0x43269c){logger['error'](_0x43269c['stack']);if(_0x43269c[_0x6ffd('0x2a')]){delete _0x43269c[_0x6ffd('0x2a')];}_0x5a55e2[_0x6ffd('0x1b')](_0x41ab4a)['send'](_0x43269c);};}exports['index']=function(_0x32c399,_0x48feb4){var _0x470021={},_0x20c007={},_0x51fdb6={'count':0x0,'rows':[]};var _0x6b5aba=_[_0x6ffd('0x2b')](db[_0x6ffd('0x2c')][_0x6ffd('0x2d')],function(_0x235735){return{'name':_0x235735[_0x6ffd('0x2e')],'type':_0x235735[_0x6ffd('0x2f')][_0x6ffd('0x30')]};});_0x20c007[_0x6ffd('0x31')]=_[_0x6ffd('0x2b')](_0x6b5aba,_0x6ffd('0x2a'));_0x20c007[_0x6ffd('0x32')]=_[_0x6ffd('0x33')](_0x32c399['query']);_0x20c007['filters']=_['intersection'](_0x20c007[_0x6ffd('0x31')],_0x20c007[_0x6ffd('0x32')]);_0x470021[_0x6ffd('0x34')]=_[_0x6ffd('0x35')](_0x20c007[_0x6ffd('0x31')],qs[_0x6ffd('0x36')](_0x32c399[_0x6ffd('0x32')][_0x6ffd('0x36')]));_0x470021[_0x6ffd('0x34')]=_0x470021[_0x6ffd('0x34')][_0x6ffd('0x37')]?_0x470021[_0x6ffd('0x34')]:_0x20c007[_0x6ffd('0x31')];if(!_0x32c399['query'][_0x6ffd('0x38')](_0x6ffd('0x39'))){_0x470021[_0x6ffd('0x1f')]=qs[_0x6ffd('0x1f')](_0x32c399['query'][_0x6ffd('0x1f')]);_0x470021['offset']=qs['offset'](_0x32c399[_0x6ffd('0x32')][_0x6ffd('0x1d')]);}_0x470021[_0x6ffd('0x3a')]=qs[_0x6ffd('0x3b')](_0x32c399['query'][_0x6ffd('0x3b')]);_0x470021['where']=qs[_0x6ffd('0x3c')](_[_0x6ffd('0x3d')](_0x32c399[_0x6ffd('0x32')],_0x20c007[_0x6ffd('0x3c')]),_0x6b5aba);if(_0x32c399[_0x6ffd('0x32')]['filter']){_0x470021['where']=_[_0x6ffd('0x3e')](_0x470021['where'],{'$or':_[_0x6ffd('0x2b')](_0x6b5aba,function(_0x98bf46){if(_0x98bf46[_0x6ffd('0x2f')]!==_0x6ffd('0x3f')){var _0x6ee6f0={};_0x6ee6f0[_0x98bf46[_0x6ffd('0x2a')]]={'$like':'%'+_0x32c399['query'][_0x6ffd('0x40')]+'%'};return _0x6ee6f0;}})});}_0x470021=_[_0x6ffd('0x3e')]({},_0x470021,_0x32c399[_0x6ffd('0x41')]);var _0x3ad5ef={'where':_0x470021['where']};return db[_0x6ffd('0x2c')]['count'](_0x3ad5ef)[_0x6ffd('0x28')](function(_0x13b409){_0x51fdb6[_0x6ffd('0x20')]=_0x13b409;if(_0x32c399['query'][_0x6ffd('0x42')]){_0x470021[_0x6ffd('0x43')]=[{'all':!![]}];}return db[_0x6ffd('0x2c')][_0x6ffd('0x44')](_0x470021);})[_0x6ffd('0x28')](function(_0x2894f5){_0x51fdb6[_0x6ffd('0x45')]=_0x2894f5;return _0x51fdb6;})['then'](respondWithFilteredResult(_0x48feb4,_0x470021))['catch'](handleError(_0x48feb4,null));};exports['show']=function(_0x3bcac8,_0x162259){var _0x51ae8d={'raw':!![],'where':{'id':_0x3bcac8[_0x6ffd('0x46')]['id']}},_0x3d5193={};_0x3d5193[_0x6ffd('0x31')]=_[_0x6ffd('0x33')](db['MailQueueReport'][_0x6ffd('0x2d')]);_0x3d5193[_0x6ffd('0x32')]=_[_0x6ffd('0x33')](_0x3bcac8[_0x6ffd('0x32')]);_0x3d5193[_0x6ffd('0x3c')]=_[_0x6ffd('0x35')](_0x3d5193[_0x6ffd('0x31')],_0x3d5193[_0x6ffd('0x32')]);_0x51ae8d[_0x6ffd('0x34')]=_[_0x6ffd('0x35')](_0x3d5193[_0x6ffd('0x31')],qs['fields'](_0x3bcac8['query']['fields']));_0x51ae8d[_0x6ffd('0x34')]=_0x51ae8d[_0x6ffd('0x34')]['length']?_0x51ae8d[_0x6ffd('0x34')]:_0x3d5193[_0x6ffd('0x31')];if(_0x3bcac8[_0x6ffd('0x32')][_0x6ffd('0x42')]){_0x51ae8d[_0x6ffd('0x43')]=[{'all':!![]}];}_0x51ae8d=_['merge']({},_0x51ae8d,_0x3bcac8[_0x6ffd('0x41')]);return db[_0x6ffd('0x2c')][_0x6ffd('0x47')](_0x51ae8d)['then'](handleEntityNotFound(_0x162259,null))[_0x6ffd('0x28')](respondWithResult(_0x162259,null))[_0x6ffd('0x48')](handleError(_0x162259,null));};exports[_0x6ffd('0x49')]=function(_0xc513d4,_0x4184fe){return db[_0x6ffd('0x2c')]['create'](_0xc513d4[_0x6ffd('0x4a')],{})[_0x6ffd('0x28')](respondWithResult(_0x4184fe,0xc9))[_0x6ffd('0x48')](handleError(_0x4184fe,null));};exports[_0x6ffd('0x26')]=function(_0x43399c,_0x3d6221){if(_0x43399c[_0x6ffd('0x4a')]['id']){delete _0x43399c['body']['id'];}return db[_0x6ffd('0x2c')][_0x6ffd('0x47')]({'where':{'id':_0x43399c['params']['id']}})['then'](handleEntityNotFound(_0x3d6221,null))['then'](saveUpdates(_0x43399c[_0x6ffd('0x4a')],null))['then'](respondWithResult(_0x3d6221,null))[_0x6ffd('0x48')](handleError(_0x3d6221,null));};exports[_0x6ffd('0x27')]=function(_0x212578,_0x1fe3a4){return db['MailQueueReport'][_0x6ffd('0x47')]({'where':{'id':_0x212578[_0x6ffd('0x46')]['id']}})[_0x6ffd('0x28')](handleEntityNotFound(_0x1fe3a4,null))['then'](removeEntity(_0x1fe3a4,null))[_0x6ffd('0x48')](handleError(_0x1fe3a4,null));};exports[_0x6ffd('0x4b')]=function(_0x4aa024,_0x528284){return db[_0x6ffd('0x2c')][_0x6ffd('0x4b')]()[_0x6ffd('0x28')](respondWithResult(_0x528284,null))[_0x6ffd('0x48')](handleError(_0x528284,null));}; \ No newline at end of file +var _0x8aad=['sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x334ac8,_0x15db30){var _0x280798=function(_0xac8c19){while(--_0xac8c19){_0x334ac8['push'](_0x334ac8['shift']());}};_0x280798(++_0x15db30);}(_0x8aad,0x146));var _0xd8aa=function(_0x5974b9,_0x41cbfa){_0x5974b9=_0x5974b9-0x0;var _0x1e5d43=_0x8aad[_0x5974b9];return _0x1e5d43;};'use strict';var emlformat=require(_0xd8aa('0x0'));var rimraf=require(_0xd8aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8aa('0x2'));var rp=require('request-promise');var moment=require(_0xd8aa('0x3'));var BPromise=require(_0xd8aa('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd8aa('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd8aa('0x6'));var fs=require('fs');var fs_extra=require(_0xd8aa('0x7'));var _=require(_0xd8aa('0x8'));var squel=require('squel');var crypto=require(_0xd8aa('0x9'));var jsforce=require(_0xd8aa('0xa'));var deskjs=require(_0xd8aa('0xb'));var toCsv=require(_0xd8aa('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd8aa('0xd'));var authService=require(_0xd8aa('0xe'));var qs=require(_0xd8aa('0xf'));var as=require(_0xd8aa('0x10'));var hardwareService=require(_0xd8aa('0x11'));var logger=require('../../config/logger')(_0xd8aa('0x12'));var utils=require(_0xd8aa('0x13'));var config=require(_0xd8aa('0x14'));var licenseUtil=require(_0xd8aa('0x15'));var db=require(_0xd8aa('0x16'))['db'];function respondWithStatusCode(_0x6ec0eb,_0x549fad){_0x549fad=_0x549fad||0xcc;return function(_0x1e7db8){if(_0x1e7db8){return _0x6ec0eb[_0xd8aa('0x17')](_0x549fad);}return _0x6ec0eb[_0xd8aa('0x18')](_0x549fad)['end']();};}function respondWithResult(_0x5a8c79,_0x275eff){_0x275eff=_0x275eff||0xc8;return function(_0x319ffe){if(_0x319ffe){return _0x5a8c79[_0xd8aa('0x18')](_0x275eff)['json'](_0x319ffe);}};}function respondWithFilteredResult(_0x2678ed,_0x180c56){return function(_0x39b5bc){if(_0x39b5bc){var _0x404ed6=typeof _0x180c56['offset']===_0xd8aa('0x19')&&typeof _0x180c56[_0xd8aa('0x1a')]==='undefined';var _0x16d5c6=_0x39b5bc[_0xd8aa('0x1b')];var _0x32e2cd=_0x404ed6?0x0:_0x180c56[_0xd8aa('0x1c')];var _0x2d34ac=_0x404ed6?_0x39b5bc['count']:_0x180c56[_0xd8aa('0x1c')]+_0x180c56[_0xd8aa('0x1a')];var _0xb156e6;if(_0x2d34ac>=_0x16d5c6){_0x2d34ac=_0x16d5c6;_0xb156e6=0xc8;}else{_0xb156e6=0xce;}_0x2678ed[_0xd8aa('0x18')](_0xb156e6);return _0x2678ed['set'](_0xd8aa('0x1d'),_0x32e2cd+'-'+_0x2d34ac+'/'+_0x16d5c6)[_0xd8aa('0x1e')](_0x39b5bc);}return null;};}function patchUpdates(_0x46d69b){return function(_0x3588ee){try{jsonpatch[_0xd8aa('0x1f')](_0x3588ee,_0x46d69b,!![]);}catch(_0x4fe5d8){return BPromise[_0xd8aa('0x20')](_0x4fe5d8);}return _0x3588ee[_0xd8aa('0x21')]();};}function saveUpdates(_0xc4f55c,_0x5910b3){return function(_0xa7cf85){if(_0xa7cf85){return _0xa7cf85[_0xd8aa('0x22')](_0xc4f55c)[_0xd8aa('0x23')](function(_0x290849){return _0x290849;});}return null;};}function removeEntity(_0x3ef3a9,_0x16758a){return function(_0x1f64f8){if(_0x1f64f8){return _0x1f64f8[_0xd8aa('0x24')]()[_0xd8aa('0x23')](function(){_0x3ef3a9[_0xd8aa('0x18')](0xcc)[_0xd8aa('0x25')]();});}};}function handleEntityNotFound(_0x370d6f,_0x26cc66){return function(_0x5f1027){if(!_0x5f1027){_0x370d6f[_0xd8aa('0x17')](0x194);}return _0x5f1027;};}function handleError(_0x59eb3f,_0xd4d204){_0xd4d204=_0xd4d204||0x1f4;return function(_0x1f6ab2){logger[_0xd8aa('0x26')](_0x1f6ab2[_0xd8aa('0x27')]);if(_0x1f6ab2[_0xd8aa('0x28')]){delete _0x1f6ab2[_0xd8aa('0x28')];}_0x59eb3f[_0xd8aa('0x18')](_0xd4d204)[_0xd8aa('0x29')](_0x1f6ab2);};}exports['index']=function(_0x1f2a28,_0x34b792){var _0x214393={},_0x49a7c8={},_0x19a59d={'count':0x0,'rows':[]};var _0x51c6f4=_[_0xd8aa('0x2a')](db[_0xd8aa('0x2b')][_0xd8aa('0x2c')],function(_0x168a2e){return{'name':_0x168a2e[_0xd8aa('0x2d')],'type':_0x168a2e[_0xd8aa('0x2e')][_0xd8aa('0x2f')]};});_0x49a7c8[_0xd8aa('0x30')]=_['map'](_0x51c6f4,_0xd8aa('0x28'));_0x49a7c8[_0xd8aa('0x31')]=_[_0xd8aa('0x32')](_0x1f2a28[_0xd8aa('0x31')]);_0x49a7c8[_0xd8aa('0x33')]=_[_0xd8aa('0x34')](_0x49a7c8[_0xd8aa('0x30')],_0x49a7c8[_0xd8aa('0x31')]);_0x214393['attributes']=_[_0xd8aa('0x34')](_0x49a7c8[_0xd8aa('0x30')],qs[_0xd8aa('0x35')](_0x1f2a28['query'][_0xd8aa('0x35')]));_0x214393[_0xd8aa('0x36')]=_0x214393[_0xd8aa('0x36')][_0xd8aa('0x37')]?_0x214393[_0xd8aa('0x36')]:_0x49a7c8[_0xd8aa('0x30')];if(!_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x38')](_0xd8aa('0x39'))){_0x214393['limit']=qs[_0xd8aa('0x1a')](_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x1a')]);_0x214393[_0xd8aa('0x1c')]=qs[_0xd8aa('0x1c')](_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x1c')]);}_0x214393[_0xd8aa('0x3a')]=qs[_0xd8aa('0x3b')](_0x1f2a28['query'][_0xd8aa('0x3b')]);_0x214393['where']=qs[_0xd8aa('0x33')](_[_0xd8aa('0x3c')](_0x1f2a28['query'],_0x49a7c8[_0xd8aa('0x33')]),_0x51c6f4);if(_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x3d')]){_0x214393[_0xd8aa('0x3e')]=_[_0xd8aa('0x3f')](_0x214393['where'],{'$or':_['map'](_0x51c6f4,function(_0x25145c){if(_0x25145c['type']!==_0xd8aa('0x40')){var _0x7a6df2={};_0x7a6df2[_0x25145c[_0xd8aa('0x28')]]={'$like':'%'+_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x3d')]+'%'};return _0x7a6df2;}})});}_0x214393=_[_0xd8aa('0x3f')]({},_0x214393,_0x1f2a28[_0xd8aa('0x41')]);var _0x3b0220={'where':_0x214393[_0xd8aa('0x3e')]};return db[_0xd8aa('0x2b')][_0xd8aa('0x1b')](_0x3b0220)['then'](function(_0x17ebb4){_0x19a59d[_0xd8aa('0x1b')]=_0x17ebb4;if(_0x1f2a28[_0xd8aa('0x31')]['includeAll']){_0x214393[_0xd8aa('0x42')]=[{'all':!![]}];}return db[_0xd8aa('0x2b')][_0xd8aa('0x43')](_0x214393);})[_0xd8aa('0x23')](function(_0x3a0284){_0x19a59d[_0xd8aa('0x44')]=_0x3a0284;return _0x19a59d;})[_0xd8aa('0x23')](respondWithFilteredResult(_0x34b792,_0x214393))[_0xd8aa('0x45')](handleError(_0x34b792,null));};exports[_0xd8aa('0x46')]=function(_0x3f5857,_0x20c7a0){var _0x3ec42f={'raw':!![],'where':{'id':_0x3f5857[_0xd8aa('0x47')]['id']}},_0x3b26c9={};_0x3b26c9[_0xd8aa('0x30')]=_[_0xd8aa('0x32')](db[_0xd8aa('0x2b')][_0xd8aa('0x2c')]);_0x3b26c9['query']=_[_0xd8aa('0x32')](_0x3f5857[_0xd8aa('0x31')]);_0x3b26c9[_0xd8aa('0x33')]=_[_0xd8aa('0x34')](_0x3b26c9[_0xd8aa('0x30')],_0x3b26c9[_0xd8aa('0x31')]);_0x3ec42f['attributes']=_[_0xd8aa('0x34')](_0x3b26c9['model'],qs[_0xd8aa('0x35')](_0x3f5857['query'][_0xd8aa('0x35')]));_0x3ec42f['attributes']=_0x3ec42f['attributes'][_0xd8aa('0x37')]?_0x3ec42f[_0xd8aa('0x36')]:_0x3b26c9[_0xd8aa('0x30')];if(_0x3f5857[_0xd8aa('0x31')][_0xd8aa('0x48')]){_0x3ec42f[_0xd8aa('0x42')]=[{'all':!![]}];}_0x3ec42f=_['merge']({},_0x3ec42f,_0x3f5857[_0xd8aa('0x41')]);return db[_0xd8aa('0x2b')][_0xd8aa('0x49')](_0x3ec42f)[_0xd8aa('0x23')](handleEntityNotFound(_0x20c7a0,null))[_0xd8aa('0x23')](respondWithResult(_0x20c7a0,null))['catch'](handleError(_0x20c7a0,null));};exports['create']=function(_0x58cf42,_0x1fd1dc){return db[_0xd8aa('0x2b')][_0xd8aa('0x4a')](_0x58cf42[_0xd8aa('0x4b')],{})[_0xd8aa('0x23')](respondWithResult(_0x1fd1dc,0xc9))[_0xd8aa('0x45')](handleError(_0x1fd1dc,null));};exports['update']=function(_0x221e2b,_0x241e23){if(_0x221e2b['body']['id']){delete _0x221e2b[_0xd8aa('0x4b')]['id'];}return db[_0xd8aa('0x2b')][_0xd8aa('0x49')]({'where':{'id':_0x221e2b['params']['id']}})[_0xd8aa('0x23')](handleEntityNotFound(_0x241e23,null))[_0xd8aa('0x23')](saveUpdates(_0x221e2b[_0xd8aa('0x4b')],null))[_0xd8aa('0x23')](respondWithResult(_0x241e23,null))[_0xd8aa('0x45')](handleError(_0x241e23,null));};exports[_0xd8aa('0x24')]=function(_0x4f494d,_0x566d52){return db[_0xd8aa('0x2b')][_0xd8aa('0x49')]({'where':{'id':_0x4f494d[_0xd8aa('0x47')]['id']}})[_0xd8aa('0x23')](handleEntityNotFound(_0x566d52,null))[_0xd8aa('0x23')](removeEntity(_0x566d52,null))[_0xd8aa('0x45')](handleError(_0x566d52,null));};exports[_0xd8aa('0x4c')]=function(_0x4f9d21,_0x9db7e3){return db[_0xd8aa('0x2b')]['describe']()[_0xd8aa('0x23')](respondWithResult(_0x9db7e3,null))['catch'](handleError(_0x9db7e3,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index edf3d98..f22bb46 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 _0x9983=['moment','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9983,0x159));var _0x3998=function(_0x2923bb,_0xe54bff){_0x2923bb=_0x2923bb-0x0;var _0x1de0dd=_0x9983[_0x2923bb];return _0x1de0dd;};'use strict';var _=require(_0x3998('0x0'));var util=require('util');var logger=require(_0x3998('0x1'))(_0x3998('0x2'));var moment=require(_0x3998('0x3'));var BPromise=require('bluebird');var rp=require(_0x3998('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3998('0x5'));var config=require(_0x3998('0x6'));var attributes=require(_0x3998('0x7'));module[_0x3998('0x8')]=function(_0x582c83,_0x4832b6){return _0x582c83['define'](_0x3998('0x9'),attributes,{'tableName':_0x3998('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3998('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b36=['../../config/logger','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','report_mail_queue','uniqueid','lodash','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0b36,0x10c));var _0x60b3=function(_0x5f1c3e,_0x532f71){_0x5f1c3e=_0x5f1c3e-0x0;var _0x19b1ca=_0x0b36[_0x5f1c3e];return _0x19b1ca;};'use strict';var _=require(_0x60b3('0x0'));var util=require(_0x60b3('0x1'));var logger=require(_0x60b3('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x60b3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x60b3('0x4'));var config=require(_0x60b3('0x5'));var attributes=require(_0x60b3('0x6'));module[_0x60b3('0x7')]=function(_0x990e40,_0x167de0){return _0x990e40['define']('MailQueueReport',attributes,{'tableName':_0x60b3('0x8'),'paranoid':![],'indexes':[{'name':_0x60b3('0x9'),'fields':[_0x60b3('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index a972d01..d7043a9 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(_0x3f4070,_0x3ff2a6){var _0x1063be=function(_0x13aa61){while(--_0x13aa61){_0x3f4070['push'](_0x3f4070['shift']());}};_0x1063be(++_0x3ff2a6);}(_0x2ef3,0xba));var _0x32ef=function(_0x313180,_0x3c96b6){_0x313180=_0x313180-0x0;var _0x49f7be=_0x2ef3[_0x313180];return _0x49f7be;};'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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x52065c,_0x2449d2){var _0x5da1e=function(_0xfc6f8b){while(--_0xfc6f8b){_0x52065c['push'](_0x52065c['shift']());}};_0x5da1e(++_0x2449d2);}(_0xdb28,0x106));var _0x8db2=function(_0x7f1977,_0x245c44){_0x7f1977=_0x7f1977-0x0;var _0x19a0a2=_0xdb28[_0x7f1977];return _0x19a0a2;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index fc535e9..7a3dc3d 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x10b434,_0x521745){var _0x31050b=function(_0x5c72e7){while(--_0x5c72e7){_0x10b434['push'](_0x10b434['shift']());}};_0x31050b(++_0x521745);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x15a3fb,_0x520fe4){var _0x57f488=function(_0x35be3a){while(--_0x35be3a){_0x15a3fb['push'](_0x15a3fb['shift']());}};_0x57f488(++_0x520fe4);}(_0x70e0,0x17b));var _0x070e=function(_0x4a3624,_0x262de1){_0x4a3624=_0x4a3624-0x0;var _0x35aeac=_0x70e0[_0x4a3624];return _0x35aeac;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 58c9336..50b74bb 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 _0x99d5=['exports','STRING','INTEGER','BOOLEAN','INBOX','sequelize'];(function(_0x334e4a,_0xdefcb0){var _0x484442=function(_0x28e63d){while(--_0x28e63d){_0x334e4a['push'](_0x334e4a['shift']());}};_0x484442(++_0xdefcb0);}(_0x99d5,0x77));var _0x599d=function(_0xa42d8a,_0x3e16c4){_0xa42d8a=_0xa42d8a-0x0;var _0x235595=_0x99d5[_0xa42d8a];return _0x235595;};'use strict';var Sequelize=require(_0x599d('0x0'));module[_0x599d('0x1')]={'description':{'type':Sequelize[_0x599d('0x2')]},'host':{'type':Sequelize[_0x599d('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x599d('0x3')]},'tls':{'type':Sequelize[_0x599d('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x599d('0x5')},'connTimeout':{'type':Sequelize[_0x599d('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x599d('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x599d('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x68cf=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x24f68e,_0x139064){var _0x58b286=function(_0x3cf3a1){while(--_0x3cf3a1){_0x24f68e['push'](_0x24f68e['shift']());}};_0x58b286(++_0x139064);}(_0x68cf,0x11b));var _0xf68c=function(_0x30e519,_0x498484){_0x30e519=_0x30e519-0x0;var _0x590c93=_0x68cf[_0x30e519];return _0x590c93;};'use strict';var Sequelize=require(_0xf68c('0x0'));module[_0xf68c('0x1')]={'description':{'type':Sequelize[_0xf68c('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf68c('0x3')]},'tls':{'type':Sequelize[_0xf68c('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf68c('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xf68c('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf68c('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xf68c('0x2')]},'modernAuthentication':{'type':Sequelize[_0xf68c('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 3f90b49..18f1ac4 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 _0xd61d=['../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x4260f3,_0x4988d6){var _0x31b726=function(_0x5a5513){while(--_0x5a5513){_0x4260f3['push'](_0x4260f3['shift']());}};_0x31b726(++_0x4988d6);}(_0xd61d,0x165));var _0xdd61=function(_0x536970,_0x55190b){_0x536970=_0x536970-0x0;var _0x4ea95d=_0xd61d[_0x536970];return _0x4ea95d;};'use strict';var _=require(_0xdd61('0x0'));var util=require(_0xdd61('0x1'));var logger=require(_0xdd61('0x2'))(_0xdd61('0x3'));var moment=require('moment');var BPromise=require(_0xdd61('0x4'));var rp=require(_0xdd61('0x5'));var fs=require('fs');var path=require(_0xdd61('0x6'));var rimraf=require('rimraf');var config=require(_0xdd61('0x7'));var attributes=require(_0xdd61('0x8'));module[_0xdd61('0x9')]=function(_0x41fadb,_0x834840){return _0x41fadb[_0xdd61('0xa')](_0xdd61('0xb'),attributes,{'tableName':_0xdd61('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95cc=['bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment'];(function(_0xbc159e,_0x115058){var _0x289e1b=function(_0x21d923){while(--_0x21d923){_0xbc159e['push'](_0xbc159e['shift']());}};_0x289e1b(++_0x115058);}(_0x95cc,0xf8));var _0xc95c=function(_0x229c74,_0x3de5a0){_0x229c74=_0x229c74-0x0;var _0x3cb9e0=_0x95cc[_0x229c74];return _0x3cb9e0;};'use strict';var _=require(_0xc95c('0x0'));var util=require(_0xc95c('0x1'));var logger=require(_0xc95c('0x2'))('api');var moment=require(_0xc95c('0x3'));var BPromise=require(_0xc95c('0x4'));var rp=require(_0xc95c('0x5'));var fs=require('fs');var path=require(_0xc95c('0x6'));var rimraf=require('rimraf');var config=require(_0xc95c('0x7'));var attributes=require(_0xc95c('0x8'));module[_0xc95c('0x9')]=function(_0x5f71af,_0x2bdbdc){return _0x5f71af['define'](_0xc95c('0xa'),attributes,{'tableName':_0xc95c('0xb'),'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 68c18e7..1e1b825 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 _0x92aa=['then','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','options','where','attributes','limit','map','model','include','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','request'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x92aa,0xf3));var _0xa92a=function(_0x359b79,_0x34bde4){_0x359b79=_0x359b79-0x0;var _0x2b9545=_0x92aa[_0x359b79];return _0x2b9545;};'use strict';var _=require(_0xa92a('0x0'));var util=require(_0xa92a('0x1'));var moment=require(_0xa92a('0x2'));var BPromise=require(_0xa92a('0x3'));var rs=require(_0xa92a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa92a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa92a('0x6'));var config=require('../../config/environment');var jayson=require(_0xa92a('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x172966,_0x1fba88,_0x595f11){return new BPromise(function(_0x38c479,_0x270dbe){return client[_0xa92a('0x8')](_0x172966,_0x595f11)[_0xa92a('0x9')](function(_0x3c6b4c){logger['info'](_0xa92a('0xa'),_0x1fba88,_0xa92a('0xb'));logger['debug'](_0xa92a('0xc'),_0x1fba88,_0xa92a('0xb'),JSON[_0xa92a('0xd')](_0x3c6b4c));if(_0x3c6b4c['error']){if(_0x3c6b4c[_0xa92a('0xe')][_0xa92a('0xf')]===0x1f4){logger[_0xa92a('0xe')](_0xa92a('0xa'),_0x1fba88,_0x3c6b4c[_0xa92a('0xe')][_0xa92a('0x10')]);return _0x270dbe(_0x3c6b4c[_0xa92a('0xe')][_0xa92a('0x10')]);}logger[_0xa92a('0xe')](_0xa92a('0xa'),_0x1fba88,_0x3c6b4c[_0xa92a('0xe')][_0xa92a('0x10')]);return _0x38c479(_0x3c6b4c['error']['message']);}else{logger['info'](_0xa92a('0xa'),_0x1fba88,_0xa92a('0xb'));_0x38c479(_0x3c6b4c[_0xa92a('0x11')][_0xa92a('0x10')]);}})[_0xa92a('0x12')](function(_0x160a99){logger[_0xa92a('0xe')](_0xa92a('0xa'),_0x1fba88,_0x160a99);_0x270dbe(_0x160a99);});});}exports[_0xa92a('0x13')]=function(_0x371f1a){var _0x5284de=this;return new Promise(function(_0x379322,_0x3f2154){return db['MailServerIn']['findAll']({'raw':_0x371f1a[_0xa92a('0x14')]?_0x371f1a[_0xa92a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x371f1a[_0xa92a('0x14')]?_0x371f1a['options'][_0xa92a('0x15')]||null:null,'attributes':_0x371f1a['options']?_0x371f1a[_0xa92a('0x14')][_0xa92a('0x16')]||null:null,'limit':_0x371f1a[_0xa92a('0x14')]?_0x371f1a[_0xa92a('0x14')][_0xa92a('0x17')]||null:null,'include':_0x371f1a[_0xa92a('0x14')]?_0x371f1a[_0xa92a('0x14')]['include']?_[_0xa92a('0x18')](_0x371f1a[_0xa92a('0x14')]['include'],function(_0x3ccc6e){return{'model':db[_0x3ccc6e[_0xa92a('0x19')]],'as':_0x3ccc6e['as'],'attributes':_0x3ccc6e['attributes'],'include':_0x3ccc6e[_0xa92a('0x1a')]?_['map'](_0x3ccc6e[_0xa92a('0x1a')],function(_0x120508){return{'model':db[_0x120508[_0xa92a('0x19')]],'as':_0x120508['as'],'attributes':_0x120508[_0xa92a('0x16')],'include':_0x120508[_0xa92a('0x1a')]?_[_0xa92a('0x18')](_0x120508[_0xa92a('0x1a')],function(_0x53d560){return{'model':db[_0x53d560[_0xa92a('0x19')]],'as':_0x53d560['as'],'attributes':_0x53d560['attributes']};}):[]};}):[]};}):[]:[]})[_0xa92a('0x9')](function(_0x28e3a4){logger[_0xa92a('0x1b')](_0xa92a('0x13'),_0x371f1a);logger['debug'](_0xa92a('0x13'),_0x371f1a,JSON[_0xa92a('0xd')](_0x28e3a4));_0x379322(_0x28e3a4);})[_0xa92a('0x12')](function(_0x3c099b){logger[_0xa92a('0xe')](_0xa92a('0x13'),_0x3c099b[_0xa92a('0x10')],_0x371f1a);_0x3f2154(_0x5284de[_0xa92a('0xe')](0x1f4,_0x3c099b[_0xa92a('0x10')]));});});}; \ No newline at end of file +var _0x4b3e=['rpc','../../config/environment','jayson/promise','http','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailServerIn','findAll','options','raw','attributes','limit','include','map','model','then','GetMailServerIn','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x1fea2c,_0x4ecda6){var _0x2a4ab4=function(_0x589d0d){while(--_0x589d0d){_0x1fea2c['push'](_0x1fea2c['shift']());}};_0x2a4ab4(++_0x4ecda6);}(_0x4b3e,0x1cc));var _0xe4b3=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0x4b3e[_0x24392f];return _0x591e33;};'use strict';var _=require(_0xe4b3('0x0'));var util=require(_0xe4b3('0x1'));var moment=require(_0xe4b3('0x2'));var BPromise=require(_0xe4b3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4b3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe4b3('0x5'));var config=require(_0xe4b3('0x6'));var jayson=require(_0xe4b3('0x7'));var client=jayson['client'][_0xe4b3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x101ca9,_0x3c464d,_0x1aedea){return new BPromise(function(_0x56c8d6,_0xd1da4a){return client['request'](_0x101ca9,_0x1aedea)['then'](function(_0x48fee3){logger[_0xe4b3('0x9')](_0xe4b3('0xa'),_0x3c464d,_0xe4b3('0xb'));logger[_0xe4b3('0xc')](_0xe4b3('0xd'),_0x3c464d,_0xe4b3('0xb'),JSON[_0xe4b3('0xe')](_0x48fee3));if(_0x48fee3[_0xe4b3('0xf')]){if(_0x48fee3[_0xe4b3('0xf')][_0xe4b3('0x10')]===0x1f4){logger[_0xe4b3('0xf')]('MailServerIn,\x20%s,\x20%s',_0x3c464d,_0x48fee3[_0xe4b3('0xf')][_0xe4b3('0x11')]);return _0xd1da4a(_0x48fee3['error'][_0xe4b3('0x11')]);}logger[_0xe4b3('0xf')](_0xe4b3('0xa'),_0x3c464d,_0x48fee3[_0xe4b3('0xf')][_0xe4b3('0x11')]);return _0x56c8d6(_0x48fee3['error']['message']);}else{logger[_0xe4b3('0x9')](_0xe4b3('0xa'),_0x3c464d,_0xe4b3('0xb'));_0x56c8d6(_0x48fee3[_0xe4b3('0x12')][_0xe4b3('0x11')]);}})[_0xe4b3('0x13')](function(_0x259fcc){logger[_0xe4b3('0xf')](_0xe4b3('0xa'),_0x3c464d,_0x259fcc);_0xd1da4a(_0x259fcc);});});}exports['GetMailServerIn']=function(_0x3cfdb1){var _0x4b409c=this;return new Promise(function(_0x3ab11f,_0x6f92b4){return db[_0xe4b3('0x14')][_0xe4b3('0x15')]({'raw':_0x3cfdb1[_0xe4b3('0x16')]?_0x3cfdb1[_0xe4b3('0x16')][_0xe4b3('0x17')]===undefined?!![]:![]:!![],'where':_0x3cfdb1[_0xe4b3('0x16')]?_0x3cfdb1[_0xe4b3('0x16')]['where']||null:null,'attributes':_0x3cfdb1[_0xe4b3('0x16')]?_0x3cfdb1[_0xe4b3('0x16')][_0xe4b3('0x18')]||null:null,'limit':_0x3cfdb1[_0xe4b3('0x16')]?_0x3cfdb1['options'][_0xe4b3('0x19')]||null:null,'include':_0x3cfdb1['options']?_0x3cfdb1[_0xe4b3('0x16')][_0xe4b3('0x1a')]?_[_0xe4b3('0x1b')](_0x3cfdb1[_0xe4b3('0x16')][_0xe4b3('0x1a')],function(_0xbc2402){return{'model':db[_0xbc2402['model']],'as':_0xbc2402['as'],'attributes':_0xbc2402[_0xe4b3('0x18')],'include':_0xbc2402[_0xe4b3('0x1a')]?_['map'](_0xbc2402[_0xe4b3('0x1a')],function(_0x2923b5){return{'model':db[_0x2923b5[_0xe4b3('0x1c')]],'as':_0x2923b5['as'],'attributes':_0x2923b5[_0xe4b3('0x18')],'include':_0x2923b5[_0xe4b3('0x1a')]?_['map'](_0x2923b5[_0xe4b3('0x1a')],function(_0x178a12){return{'model':db[_0x178a12[_0xe4b3('0x1c')]],'as':_0x178a12['as'],'attributes':_0x178a12['attributes']};}):[]};}):[]};}):[]:[]})[_0xe4b3('0x1d')](function(_0x1de2d8){logger['info'](_0xe4b3('0x1e'),_0x3cfdb1);logger[_0xe4b3('0xc')](_0xe4b3('0x1e'),_0x3cfdb1,JSON['stringify'](_0x1de2d8));_0x3ab11f(_0x1de2d8);})['catch'](function(_0x44d30c){logger[_0xe4b3('0xf')](_0xe4b3('0x1e'),_0x44d30c[_0xe4b3('0x11')],_0x3cfdb1);_0x6f92b4(_0x4b409c['error'](0x1f4,_0x44d30c[_0xe4b3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index c91588e..1dbbbcc 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(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x7a54,0x106));var _0x47a5=function(_0xcd827,_0x24d1f7){_0xcd827=_0xcd827-0x0;var _0xeadeef=_0x7a54[_0xcd827];return _0xeadeef;};'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(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_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('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 8de22bf..5e07ffe 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 _0xbfcc=['sequelize','STRING','INTEGER'];(function(_0x4626ff,_0x3da66c){var _0x418d56=function(_0x183b08){while(--_0x183b08){_0x4626ff['push'](_0x4626ff['shift']());}};_0x418d56(++_0x3da66c);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x4d7116,_0xdb8175){_0x4d7116=_0x4d7116-0x0;var _0x4593dc=_0xbfcc[_0x4d7116];return _0x4593dc;};'use strict';var Sequelize=require(_0xcbfc('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xcbfc('0x1')]},'user':{'type':Sequelize[_0xcbfc('0x1')]},'pass':{'type':Sequelize[_0xcbfc('0x1')]},'port':{'type':Sequelize[_0xcbfc('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe605=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0xe605,0x92));var _0x5e60=function(_0x4ee737,_0xb6340a){_0x4ee737=_0x4ee737-0x0;var _0x1a91c5=_0xe605[_0x4ee737];return _0x1a91c5;};'use strict';var Sequelize=require(_0x5e60('0x0'));module[_0x5e60('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5e60('0x2')]},'user':{'type':Sequelize[_0x5e60('0x2')]},'pass':{'type':Sequelize[_0x5e60('0x2')]},'port':{'type':Sequelize[_0x5e60('0x3')]},'secure':{'type':Sequelize[_0x5e60('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x5e60('0x2')]},'authentication':{'type':Sequelize[_0x5e60('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x5e60('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 86a7fb7..8648b97 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 _0x9fa8=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','MailServerOut','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9fa8,0xd3));var _0x89fa=function(_0x216c4d,_0x223528){_0x216c4d=_0x216c4d-0x0;var _0x1b443b=_0x9fa8[_0x216c4d];return _0x1b443b;};'use strict';var emlformat=require(_0x89fa('0x0'));var rimraf=require(_0x89fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x89fa('0x2'));var rp=require(_0x89fa('0x3'));var moment=require('moment');var BPromise=require(_0x89fa('0x4'));var Mustache=require(_0x89fa('0x5'));var util=require(_0x89fa('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x89fa('0x7'));var ejs=require(_0x89fa('0x8'));var fs=require('fs');var fs_extra=require(_0x89fa('0x9'));var _=require('lodash');var squel=require(_0x89fa('0xa'));var crypto=require(_0x89fa('0xb'));var jsforce=require(_0x89fa('0xc'));var deskjs=require(_0x89fa('0xd'));var toCsv=require(_0x89fa('0x7'));var querystring=require(_0x89fa('0xe'));var Papa=require(_0x89fa('0xf'));var Redis=require(_0x89fa('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x89fa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89fa('0x12'));var logger=require(_0x89fa('0x13'))(_0x89fa('0x14'));var utils=require('../../config/utils');var config=require(_0x89fa('0x15'));var licenseUtil=require(_0x89fa('0x16'));var db=require(_0x89fa('0x17'))['db'];function respondWithStatusCode(_0x2733e4,_0x4d7400){_0x4d7400=_0x4d7400||0xcc;return function(_0xfde6e0){if(_0xfde6e0){return _0x2733e4[_0x89fa('0x18')](_0x4d7400);}return _0x2733e4[_0x89fa('0x19')](_0x4d7400)[_0x89fa('0x1a')]();};}function respondWithResult(_0x5ba2d4,_0x165f14){_0x165f14=_0x165f14||0xc8;return function(_0x3014e4){if(_0x3014e4){return _0x5ba2d4[_0x89fa('0x19')](_0x165f14)[_0x89fa('0x1b')](_0x3014e4);}};}function respondWithFilteredResult(_0x8ecfb1,_0x340037){return function(_0x58ee2b){if(_0x58ee2b){var _0x30b347=typeof _0x340037[_0x89fa('0x1c')]==='undefined'&&typeof _0x340037[_0x89fa('0x1d')]===_0x89fa('0x1e');var _0x2e8fff=_0x58ee2b['count'];var _0x322cab=_0x30b347?0x0:_0x340037[_0x89fa('0x1c')];var _0x1ff899=_0x30b347?_0x58ee2b[_0x89fa('0x1f')]:_0x340037[_0x89fa('0x1c')]+_0x340037['limit'];var _0x3c1800;if(_0x1ff899>=_0x2e8fff){_0x1ff899=_0x2e8fff;_0x3c1800=0xc8;}else{_0x3c1800=0xce;}_0x8ecfb1['status'](_0x3c1800);return _0x8ecfb1[_0x89fa('0x20')](_0x89fa('0x21'),_0x322cab+'-'+_0x1ff899+'/'+_0x2e8fff)[_0x89fa('0x1b')](_0x58ee2b);}return null;};}function patchUpdates(_0x455cc5){return function(_0x411b6f){try{jsonpatch[_0x89fa('0x22')](_0x411b6f,_0x455cc5,!![]);}catch(_0x12727f){return BPromise[_0x89fa('0x23')](_0x12727f);}return _0x411b6f[_0x89fa('0x24')]();};}function saveUpdates(_0x4854e0,_0x4a916d){return function(_0x17955f){if(_0x17955f){return _0x17955f['update'](_0x4854e0)[_0x89fa('0x25')](function(_0x4dc6f5){return _0x4dc6f5;});}return null;};}function removeEntity(_0x938003,_0x54943c){return function(_0x5e0014){if(_0x5e0014){return _0x5e0014[_0x89fa('0x26')]()[_0x89fa('0x25')](function(){_0x938003[_0x89fa('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43dc9f,_0x18903b){return function(_0x3095fb){if(!_0x3095fb){_0x43dc9f['sendStatus'](0x194);}return _0x3095fb;};}function handleError(_0x1a5db7,_0x3dcbf4){_0x3dcbf4=_0x3dcbf4||0x1f4;return function(_0x55549f){logger[_0x89fa('0x27')](_0x55549f[_0x89fa('0x28')]);if(_0x55549f[_0x89fa('0x29')]){delete _0x55549f[_0x89fa('0x29')];}_0x1a5db7[_0x89fa('0x19')](_0x3dcbf4)[_0x89fa('0x2a')](_0x55549f);};}exports[_0x89fa('0x2b')]=function(_0x522140,_0x1bbbb8){var _0x451cd2={},_0x493593={},_0x5cf655={'count':0x0,'rows':[]};var _0x31fa82=_[_0x89fa('0x2c')](db[_0x89fa('0x2d')]['rawAttributes'],function(_0x619c11){return{'name':_0x619c11[_0x89fa('0x2e')],'type':_0x619c11[_0x89fa('0x2f')][_0x89fa('0x30')]};});_0x493593[_0x89fa('0x31')]=_['map'](_0x31fa82,_0x89fa('0x29'));_0x493593[_0x89fa('0x32')]=_[_0x89fa('0x33')](_0x522140[_0x89fa('0x32')]);_0x493593[_0x89fa('0x34')]=_[_0x89fa('0x35')](_0x493593[_0x89fa('0x31')],_0x493593[_0x89fa('0x32')]);_0x451cd2['attributes']=_[_0x89fa('0x35')](_0x493593[_0x89fa('0x31')],qs[_0x89fa('0x36')](_0x522140[_0x89fa('0x32')]['fields']));_0x451cd2[_0x89fa('0x37')]=_0x451cd2['attributes'][_0x89fa('0x38')]?_0x451cd2['attributes']:_0x493593[_0x89fa('0x31')];if(!_0x522140[_0x89fa('0x32')][_0x89fa('0x39')](_0x89fa('0x3a'))){_0x451cd2['limit']=qs['limit'](_0x522140['query']['limit']);_0x451cd2[_0x89fa('0x1c')]=qs['offset'](_0x522140[_0x89fa('0x32')]['offset']);}_0x451cd2['order']=qs[_0x89fa('0x3b')](_0x522140[_0x89fa('0x32')]['sort']);_0x451cd2[_0x89fa('0x3c')]=qs[_0x89fa('0x34')](_[_0x89fa('0x3d')](_0x522140[_0x89fa('0x32')],_0x493593['filters']),_0x31fa82);if(_0x522140[_0x89fa('0x32')][_0x89fa('0x3e')]){_0x451cd2['where']=_[_0x89fa('0x3f')](_0x451cd2[_0x89fa('0x3c')],{'$or':_[_0x89fa('0x2c')](_0x31fa82,function(_0x420ac8){if(_0x420ac8[_0x89fa('0x2f')]!=='VIRTUAL'){var _0x53cb07={};_0x53cb07[_0x420ac8[_0x89fa('0x29')]]={'$like':'%'+_0x522140['query']['filter']+'%'};return _0x53cb07;}})});}_0x451cd2=_[_0x89fa('0x3f')]({},_0x451cd2,_0x522140[_0x89fa('0x40')]);var _0x5756f0={'where':_0x451cd2[_0x89fa('0x3c')]};return db[_0x89fa('0x2d')]['count'](_0x5756f0)[_0x89fa('0x25')](function(_0x1cb255){_0x5cf655['count']=_0x1cb255;if(_0x522140[_0x89fa('0x32')][_0x89fa('0x41')]){_0x451cd2[_0x89fa('0x42')]=[{'all':!![]}];}return db['MailServerOut'][_0x89fa('0x43')](_0x451cd2);})['then'](function(_0x3074be){_0x5cf655['rows']=_0x3074be;return _0x5cf655;})[_0x89fa('0x25')](respondWithFilteredResult(_0x1bbbb8,_0x451cd2))[_0x89fa('0x44')](handleError(_0x1bbbb8,null));};exports[_0x89fa('0x45')]=function(_0xc93d2,_0x573ae6){var _0x42d4be={'raw':!![],'where':{'id':_0xc93d2[_0x89fa('0x46')]['id']}},_0x3e6196={};_0x3e6196['model']=_[_0x89fa('0x33')](db[_0x89fa('0x2d')][_0x89fa('0x47')]);_0x3e6196[_0x89fa('0x32')]=_[_0x89fa('0x33')](_0xc93d2[_0x89fa('0x32')]);_0x3e6196[_0x89fa('0x34')]=_['intersection'](_0x3e6196[_0x89fa('0x31')],_0x3e6196['query']);_0x42d4be[_0x89fa('0x37')]=_[_0x89fa('0x35')](_0x3e6196[_0x89fa('0x31')],qs[_0x89fa('0x36')](_0xc93d2[_0x89fa('0x32')]['fields']));_0x42d4be[_0x89fa('0x37')]=_0x42d4be[_0x89fa('0x37')][_0x89fa('0x38')]?_0x42d4be['attributes']:_0x3e6196[_0x89fa('0x31')];if(_0xc93d2[_0x89fa('0x32')][_0x89fa('0x41')]){_0x42d4be[_0x89fa('0x42')]=[{'all':!![]}];}_0x42d4be=_[_0x89fa('0x3f')]({},_0x42d4be,_0xc93d2[_0x89fa('0x40')]);return db[_0x89fa('0x2d')][_0x89fa('0x48')](_0x42d4be)['then'](handleEntityNotFound(_0x573ae6,null))[_0x89fa('0x25')](respondWithResult(_0x573ae6,null))['catch'](handleError(_0x573ae6,null));};exports[_0x89fa('0x49')]=function(_0x55400c,_0x28c98a){return db[_0x89fa('0x2d')][_0x89fa('0x49')](_0x55400c[_0x89fa('0x4a')],{})[_0x89fa('0x25')](respondWithResult(_0x28c98a,0xc9))[_0x89fa('0x44')](handleError(_0x28c98a,null));};exports[_0x89fa('0x4b')]=function(_0xfdcc9d,_0x1c6a2f){if(_0xfdcc9d['body']['id']){delete _0xfdcc9d[_0x89fa('0x4a')]['id'];}return db[_0x89fa('0x2d')]['find']({'where':{'id':_0xfdcc9d[_0x89fa('0x46')]['id']}})[_0x89fa('0x25')](handleEntityNotFound(_0x1c6a2f,null))[_0x89fa('0x25')](saveUpdates(_0xfdcc9d[_0x89fa('0x4a')],null))['then'](respondWithResult(_0x1c6a2f,null))[_0x89fa('0x44')](handleError(_0x1c6a2f,null));};exports[_0x89fa('0x26')]=function(_0x27c57c,_0x5116cc){return db[_0x89fa('0x2d')][_0x89fa('0x48')]({'where':{'id':_0x27c57c[_0x89fa('0x46')]['id']}})['then'](handleEntityNotFound(_0x5116cc,null))[_0x89fa('0x25')](removeEntity(_0x5116cc,null))[_0x89fa('0x44')](handleError(_0x5116cc,null));}; \ No newline at end of file +var _0x10b0=['count','includeAll','include','params','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','end','status','json','undefined','limit','offset','Content-Range','apply','save','then','sendStatus','error','stack','name','send','MailServerOut','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options'];(function(_0x4d692a,_0x5c1506){var _0x9ef565=function(_0x2e17c8){while(--_0x2e17c8){_0x4d692a['push'](_0x4d692a['shift']());}};_0x9ef565(++_0x5c1506);}(_0x10b0,0x125));var _0x010b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x10b0[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x010b('0x0'));var rimraf=require(_0x010b('0x1'));var zipdir=require(_0x010b('0x2'));var jsonpatch=require(_0x010b('0x3'));var rp=require(_0x010b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x010b('0x5'));var util=require(_0x010b('0x6'));var path=require(_0x010b('0x7'));var sox=require(_0x010b('0x8'));var csv=require(_0x010b('0x9'));var ejs=require(_0x010b('0xa'));var fs=require('fs');var fs_extra=require(_0x010b('0xb'));var _=require(_0x010b('0xc'));var squel=require(_0x010b('0xd'));var crypto=require(_0x010b('0xe'));var jsforce=require(_0x010b('0xf'));var deskjs=require(_0x010b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x010b('0x11'));var Papa=require(_0x010b('0x12'));var Redis=require('ioredis');var authService=require(_0x010b('0x13'));var qs=require(_0x010b('0x14'));var as=require(_0x010b('0x15'));var hardwareService=require(_0x010b('0x16'));var logger=require('../../config/logger')(_0x010b('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x010b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5382fe,_0x4dd68d){_0x4dd68d=_0x4dd68d||0xcc;return function(_0x5a17d5){if(_0x5a17d5){return _0x5382fe['sendStatus'](_0x4dd68d);}return _0x5382fe['status'](_0x4dd68d)[_0x010b('0x19')]();};}function respondWithResult(_0x12fbb1,_0x23d6c9){_0x23d6c9=_0x23d6c9||0xc8;return function(_0x1de32a){if(_0x1de32a){return _0x12fbb1[_0x010b('0x1a')](_0x23d6c9)[_0x010b('0x1b')](_0x1de32a);}};}function respondWithFilteredResult(_0x3cdd7b,_0x2d22d1){return function(_0x4f01d7){if(_0x4f01d7){var _0x466452=typeof _0x2d22d1['offset']===_0x010b('0x1c')&&typeof _0x2d22d1[_0x010b('0x1d')]===_0x010b('0x1c');var _0x4692ea=_0x4f01d7['count'];var _0x36c151=_0x466452?0x0:_0x2d22d1[_0x010b('0x1e')];var _0x232ec2=_0x466452?_0x4f01d7['count']:_0x2d22d1[_0x010b('0x1e')]+_0x2d22d1[_0x010b('0x1d')];var _0x553b79;if(_0x232ec2>=_0x4692ea){_0x232ec2=_0x4692ea;_0x553b79=0xc8;}else{_0x553b79=0xce;}_0x3cdd7b[_0x010b('0x1a')](_0x553b79);return _0x3cdd7b['set'](_0x010b('0x1f'),_0x36c151+'-'+_0x232ec2+'/'+_0x4692ea)[_0x010b('0x1b')](_0x4f01d7);}return null;};}function patchUpdates(_0x109915){return function(_0x4341bd){try{jsonpatch[_0x010b('0x20')](_0x4341bd,_0x109915,!![]);}catch(_0x33f92e){return BPromise['reject'](_0x33f92e);}return _0x4341bd[_0x010b('0x21')]();};}function saveUpdates(_0x3022e5,_0x3d9f42){return function(_0x13c731){if(_0x13c731){return _0x13c731['update'](_0x3022e5)[_0x010b('0x22')](function(_0x5f1744){return _0x5f1744;});}return null;};}function removeEntity(_0x6ec94f,_0x184884){return function(_0xbba826){if(_0xbba826){return _0xbba826['destroy']()[_0x010b('0x22')](function(){_0x6ec94f['status'](0xcc)[_0x010b('0x19')]();});}};}function handleEntityNotFound(_0x22eb6b,_0x328a5c){return function(_0x4b4e53){if(!_0x4b4e53){_0x22eb6b[_0x010b('0x23')](0x194);}return _0x4b4e53;};}function handleError(_0x6d6554,_0x4a91bb){_0x4a91bb=_0x4a91bb||0x1f4;return function(_0x3ba5a5){logger[_0x010b('0x24')](_0x3ba5a5[_0x010b('0x25')]);if(_0x3ba5a5[_0x010b('0x26')]){delete _0x3ba5a5['name'];}_0x6d6554[_0x010b('0x1a')](_0x4a91bb)[_0x010b('0x27')](_0x3ba5a5);};}exports['index']=function(_0x5ebccf,_0x5698ab){var _0x668423={},_0x10451f={},_0x26a2e5={'count':0x0,'rows':[]};var _0x2c8c7d=_['map'](db[_0x010b('0x28')][_0x010b('0x29')],function(_0x463f1e){return{'name':_0x463f1e['fieldName'],'type':_0x463f1e[_0x010b('0x2a')][_0x010b('0x2b')]};});_0x10451f[_0x010b('0x2c')]=_[_0x010b('0x2d')](_0x2c8c7d,_0x010b('0x26'));_0x10451f[_0x010b('0x2e')]=_[_0x010b('0x2f')](_0x5ebccf[_0x010b('0x2e')]);_0x10451f[_0x010b('0x30')]=_[_0x010b('0x31')](_0x10451f[_0x010b('0x2c')],_0x10451f['query']);_0x668423[_0x010b('0x32')]=_[_0x010b('0x31')](_0x10451f[_0x010b('0x2c')],qs[_0x010b('0x33')](_0x5ebccf[_0x010b('0x2e')][_0x010b('0x33')]));_0x668423['attributes']=_0x668423[_0x010b('0x32')][_0x010b('0x34')]?_0x668423[_0x010b('0x32')]:_0x10451f[_0x010b('0x2c')];if(!_0x5ebccf[_0x010b('0x2e')][_0x010b('0x35')](_0x010b('0x36'))){_0x668423[_0x010b('0x1d')]=qs[_0x010b('0x1d')](_0x5ebccf[_0x010b('0x2e')]['limit']);_0x668423['offset']=qs[_0x010b('0x1e')](_0x5ebccf[_0x010b('0x2e')]['offset']);}_0x668423[_0x010b('0x37')]=qs['sort'](_0x5ebccf[_0x010b('0x2e')][_0x010b('0x38')]);_0x668423[_0x010b('0x39')]=qs[_0x010b('0x30')](_[_0x010b('0x3a')](_0x5ebccf[_0x010b('0x2e')],_0x10451f['filters']),_0x2c8c7d);if(_0x5ebccf[_0x010b('0x2e')]['filter']){_0x668423[_0x010b('0x39')]=_[_0x010b('0x3b')](_0x668423[_0x010b('0x39')],{'$or':_['map'](_0x2c8c7d,function(_0x4c7a17){if(_0x4c7a17[_0x010b('0x2a')]!=='VIRTUAL'){var _0x58ad89={};_0x58ad89[_0x4c7a17['name']]={'$like':'%'+_0x5ebccf[_0x010b('0x2e')][_0x010b('0x3c')]+'%'};return _0x58ad89;}})});}_0x668423=_[_0x010b('0x3b')]({},_0x668423,_0x5ebccf[_0x010b('0x3d')]);var _0x12e151={'where':_0x668423['where']};return db[_0x010b('0x28')]['count'](_0x12e151)[_0x010b('0x22')](function(_0x52c194){_0x26a2e5[_0x010b('0x3e')]=_0x52c194;if(_0x5ebccf[_0x010b('0x2e')][_0x010b('0x3f')]){_0x668423[_0x010b('0x40')]=[{'all':!![]}];}return db[_0x010b('0x28')]['findAll'](_0x668423);})[_0x010b('0x22')](function(_0x5777e4){_0x26a2e5['rows']=_0x5777e4;return _0x26a2e5;})[_0x010b('0x22')](respondWithFilteredResult(_0x5698ab,_0x668423))['catch'](handleError(_0x5698ab,null));};exports['show']=function(_0x3d7e5c,_0x18393d){var _0x4b7257={'raw':!![],'where':{'id':_0x3d7e5c[_0x010b('0x41')]['id']}},_0x27554f={};_0x27554f[_0x010b('0x2c')]=_['keys'](db[_0x010b('0x28')][_0x010b('0x29')]);_0x27554f[_0x010b('0x2e')]=_[_0x010b('0x2f')](_0x3d7e5c['query']);_0x27554f[_0x010b('0x30')]=_[_0x010b('0x31')](_0x27554f[_0x010b('0x2c')],_0x27554f[_0x010b('0x2e')]);_0x4b7257[_0x010b('0x32')]=_[_0x010b('0x31')](_0x27554f['model'],qs[_0x010b('0x33')](_0x3d7e5c['query'][_0x010b('0x33')]));_0x4b7257['attributes']=_0x4b7257[_0x010b('0x32')][_0x010b('0x34')]?_0x4b7257[_0x010b('0x32')]:_0x27554f['model'];if(_0x3d7e5c[_0x010b('0x2e')][_0x010b('0x3f')]){_0x4b7257[_0x010b('0x40')]=[{'all':!![]}];}_0x4b7257=_[_0x010b('0x3b')]({},_0x4b7257,_0x3d7e5c[_0x010b('0x3d')]);return db['MailServerOut'][_0x010b('0x42')](_0x4b7257)[_0x010b('0x22')](handleEntityNotFound(_0x18393d,null))[_0x010b('0x22')](respondWithResult(_0x18393d,null))[_0x010b('0x43')](handleError(_0x18393d,null));};exports[_0x010b('0x44')]=function(_0x3cc1e9,_0x44e155){return db[_0x010b('0x28')][_0x010b('0x44')](_0x3cc1e9[_0x010b('0x45')],{})[_0x010b('0x22')](respondWithResult(_0x44e155,0xc9))[_0x010b('0x43')](handleError(_0x44e155,null));};exports[_0x010b('0x46')]=function(_0x115def,_0x38ed8e){if(_0x115def['body']['id']){delete _0x115def['body']['id'];}return db[_0x010b('0x28')][_0x010b('0x42')]({'where':{'id':_0x115def[_0x010b('0x41')]['id']}})[_0x010b('0x22')](handleEntityNotFound(_0x38ed8e,null))[_0x010b('0x22')](saveUpdates(_0x115def[_0x010b('0x45')],null))['then'](respondWithResult(_0x38ed8e,null))[_0x010b('0x43')](handleError(_0x38ed8e,null));};exports['destroy']=function(_0x1fef49,_0xfd8062){return db['MailServerOut']['find']({'where':{'id':_0x1fef49[_0x010b('0x41')]['id']}})[_0x010b('0x22')](handleEntityNotFound(_0xfd8062,null))[_0x010b('0x22')](removeEntity(_0xfd8062,null))[_0x010b('0x43')](handleError(_0xfd8062,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 30b3813..4170cc9 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 _0xd044=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd044,0x14f));var _0x4d04=function(_0x53041a,_0x4612d5){_0x53041a=_0x53041a-0x0;var _0xbd67ec=_0xd044[_0x53041a];return _0xbd67ec;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4d04('0x0'))(_0x4d04('0x1'));var moment=require('moment');var BPromise=require(_0x4d04('0x2'));var rp=require(_0x4d04('0x3'));var fs=require('fs');var path=require(_0x4d04('0x4'));var rimraf=require(_0x4d04('0x5'));var config=require(_0x4d04('0x6'));var attributes=require(_0x4d04('0x7'));module[_0x4d04('0x8')]=function(_0x157a26,_0x3c15dd){return _0x157a26[_0x4d04('0x9')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a2c=['util','api','moment','bluebird','request-promise','path','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash'];(function(_0xa1f354,_0x2f46f1){var _0x4bfa52=function(_0x1fe97b){while(--_0x1fe97b){_0xa1f354['push'](_0xa1f354['shift']());}};_0x4bfa52(++_0x2f46f1);}(_0x7a2c,0x180));var _0xc7a2=function(_0x3ef4b5,_0x4fdf0d){_0x3ef4b5=_0x3ef4b5-0x0;var _0x5cc5bc=_0x7a2c[_0x3ef4b5];return _0x5cc5bc;};'use strict';var _=require(_0xc7a2('0x0'));var util=require(_0xc7a2('0x1'));var logger=require('../../config/logger')(_0xc7a2('0x2'));var moment=require(_0xc7a2('0x3'));var BPromise=require(_0xc7a2('0x4'));var rp=require(_0xc7a2('0x5'));var fs=require('fs');var path=require(_0xc7a2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc7a2('0x7'));module[_0xc7a2('0x8')]=function(_0x1ac0f1,_0x44e50a){return _0x1ac0f1['define'](_0xc7a2('0x9'),attributes,{'tableName':_0xc7a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index ef2bd7f..c7da6fd 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 _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(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x2ef3,0xba));var _0x32ef=function(_0x566ed4,_0x46b54f){_0x566ed4=_0x566ed4-0x0;var _0x2a7f4f=_0x2ef3[_0x566ed4];return _0x2a7f4f;};'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 +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x20241e,_0x189bc0){var _0x17e8a8=function(_0x58814f){while(--_0x58814f){_0x20241e['push'](_0x20241e['shift']());}};_0x17e8a8(++_0x189bc0);}(_0xadb5,0xad));var _0x5adb=function(_0x54d6ab,_0x55d1c4){_0x54d6ab=_0x54d6ab-0x0;var _0x4bd5b9=_0xadb5[_0x54d6ab];return _0x4bd5b9;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 4285bdd..4daecfd 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 _0x6fd7=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','post','create','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0xf4129c,_0x44fcf1){var _0x426611=function(_0x3b5bcd){while(--_0x3b5bcd){_0xf4129c['push'](_0xf4129c['shift']());}};_0x426611(++_0x44fcf1);}(_0x6fd7,0x1b3));var _0x76fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fd7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x76fd('0x0'));var util=require(_0x76fd('0x1'));var path=require(_0x76fd('0x2'));var timeout=require(_0x76fd('0x3'));var express=require(_0x76fd('0x4'));var router=express['Router']();var fs_extra=require(_0x76fd('0x5'));var auth=require(_0x76fd('0x6'));var interaction=require(_0x76fd('0x7'));var config=require(_0x76fd('0x8'));var controller=require(_0x76fd('0x9'));router[_0x76fd('0xa')]('/',auth[_0x76fd('0xb')](),controller['index']);router[_0x76fd('0xa')](_0x76fd('0xc'),auth['isAuthenticated'](),controller[_0x76fd('0xd')]);router['get'](_0x76fd('0xe'),auth[_0x76fd('0xb')](),controller['show']);router[_0x76fd('0xf')]('/',auth[_0x76fd('0xb')](),controller[_0x76fd('0x10')]);router['put'](_0x76fd('0xe'),auth['isAuthenticated'](),controller[_0x76fd('0x11')]);router[_0x76fd('0x12')](_0x76fd('0xe'),auth[_0x76fd('0xb')](),controller[_0x76fd('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7ca6=['create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated','describe','post'];(function(_0x1b0f71,_0x8e3d31){var _0x435ffb=function(_0x46a772){while(--_0x46a772){_0x1b0f71['push'](_0x1b0f71['shift']());}};_0x435ffb(++_0x8e3d31);}(_0x7ca6,0xf9));var _0x67ca=function(_0x20f374,_0x3e04c4){_0x20f374=_0x20f374-0x0;var _0x59c52b=_0x7ca6[_0x20f374];return _0x59c52b;};'use strict';var multer=require(_0x67ca('0x0'));var util=require(_0x67ca('0x1'));var path=require('path');var timeout=require(_0x67ca('0x2'));var express=require('express');var router=express[_0x67ca('0x3')]();var fs_extra=require(_0x67ca('0x4'));var auth=require(_0x67ca('0x5'));var interaction=require(_0x67ca('0x6'));var config=require(_0x67ca('0x7'));var controller=require(_0x67ca('0x8'));router[_0x67ca('0x9')]('/',auth['isAuthenticated'](),controller[_0x67ca('0xa')]);router[_0x67ca('0x9')](_0x67ca('0xb'),auth[_0x67ca('0xc')](),controller[_0x67ca('0xd')]);router['get']('/:id',auth[_0x67ca('0xc')](),controller['show']);router[_0x67ca('0xe')]('/',auth[_0x67ca('0xc')](),controller[_0x67ca('0xf')]);router[_0x67ca('0x10')](_0x67ca('0x11'),auth[_0x67ca('0xc')](),controller[_0x67ca('0x12')]);router[_0x67ca('0x13')]('/:id',auth[_0x67ca('0xc')](),controller[_0x67ca('0x14')]);module[_0x67ca('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 6309c44..e794134 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 _0xe626=['name','sequelize','exports','STRING'];(function(_0x58b301,_0x45e991){var _0x2171b3=function(_0x30b475){while(--_0x30b475){_0x58b301['push'](_0x58b301['shift']());}};_0x2171b3(++_0x45e991);}(_0xe626,0x9d));var _0x6e62=function(_0x42c30b,_0x56d764){_0x42c30b=_0x42c30b-0x0;var _0x1c9547=_0xe626[_0x42c30b];return _0x1c9547;};'use strict';var Sequelize=require(_0x6e62('0x0'));module[_0x6e62('0x1')]={'name':{'type':Sequelize[_0x6e62('0x2')],'unique':_0x6e62('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x02a7=['exports','STRING'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0x02a7,0x7a));var _0x702a=function(_0x40f4d8,_0x22ebb4){_0x40f4d8=_0x40f4d8-0x0;var _0x4dbc6d=_0x02a7[_0x40f4d8];return _0x4dbc6d;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x702a('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 070a356..5c9a228 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 _0xd464=['params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','error','name','index','map','MailSubstatus','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','find','create','body','update'];(function(_0x4a209a,_0x575ff9){var _0x4b3c20=function(_0x1a50c1){while(--_0x1a50c1){_0x4a209a['push'](_0x4a209a['shift']());}};_0x4b3c20(++_0x575ff9);}(_0xd464,0x132));var _0x4d46=function(_0x47d50b,_0x44a5e9){_0x47d50b=_0x47d50b-0x0;var _0x452740=_0xd464[_0x47d50b];return _0x452740;};'use strict';var emlformat=require(_0x4d46('0x0'));var rimraf=require(_0x4d46('0x1'));var zipdir=require(_0x4d46('0x2'));var jsonpatch=require(_0x4d46('0x3'));var rp=require(_0x4d46('0x4'));var moment=require(_0x4d46('0x5'));var BPromise=require(_0x4d46('0x6'));var Mustache=require(_0x4d46('0x7'));var util=require(_0x4d46('0x8'));var path=require('path');var sox=require(_0x4d46('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4d46('0xa'));var _=require(_0x4d46('0xb'));var squel=require('squel');var crypto=require(_0x4d46('0xc'));var jsforce=require(_0x4d46('0xd'));var deskjs=require(_0x4d46('0xe'));var toCsv=require(_0x4d46('0xf'));var querystring=require(_0x4d46('0x10'));var Papa=require(_0x4d46('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(_0x4d46('0x12'));var logger=require(_0x4d46('0x13'))(_0x4d46('0x14'));var utils=require(_0x4d46('0x15'));var config=require(_0x4d46('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4d46('0x17'))['db'];function respondWithStatusCode(_0x10da4c,_0x50cb9c){_0x50cb9c=_0x50cb9c||0xcc;return function(_0x51a3d6){if(_0x51a3d6){return _0x10da4c[_0x4d46('0x18')](_0x50cb9c);}return _0x10da4c[_0x4d46('0x19')](_0x50cb9c)[_0x4d46('0x1a')]();};}function respondWithResult(_0x345257,_0x88bb67){_0x88bb67=_0x88bb67||0xc8;return function(_0x4b525e){if(_0x4b525e){return _0x345257[_0x4d46('0x19')](_0x88bb67)[_0x4d46('0x1b')](_0x4b525e);}};}function respondWithFilteredResult(_0x5ba0e6,_0x4629fe){return function(_0x4c57ca){if(_0x4c57ca){var _0x318e0c=typeof _0x4629fe[_0x4d46('0x1c')]==='undefined'&&typeof _0x4629fe[_0x4d46('0x1d')]===_0x4d46('0x1e');var _0xfedc2e=_0x4c57ca[_0x4d46('0x1f')];var _0x51628d=_0x318e0c?0x0:_0x4629fe[_0x4d46('0x1c')];var _0x2b8342=_0x318e0c?_0x4c57ca[_0x4d46('0x1f')]:_0x4629fe[_0x4d46('0x1c')]+_0x4629fe[_0x4d46('0x1d')];var _0x332470;if(_0x2b8342>=_0xfedc2e){_0x2b8342=_0xfedc2e;_0x332470=0xc8;}else{_0x332470=0xce;}_0x5ba0e6[_0x4d46('0x19')](_0x332470);return _0x5ba0e6['set'](_0x4d46('0x20'),_0x51628d+'-'+_0x2b8342+'/'+_0xfedc2e)[_0x4d46('0x1b')](_0x4c57ca);}return null;};}function patchUpdates(_0x407b48){return function(_0x171bf7){try{jsonpatch[_0x4d46('0x21')](_0x171bf7,_0x407b48,!![]);}catch(_0x5f14d2){return BPromise[_0x4d46('0x22')](_0x5f14d2);}return _0x171bf7[_0x4d46('0x23')]();};}function saveUpdates(_0x47cd76,_0xeb3ead){return function(_0xba2ec3){if(_0xba2ec3){return _0xba2ec3['update'](_0x47cd76)[_0x4d46('0x24')](function(_0x3072de){return _0x3072de;});}return null;};}function removeEntity(_0x367846,_0x2e9324){return function(_0x278c92){if(_0x278c92){return _0x278c92[_0x4d46('0x25')]()[_0x4d46('0x24')](function(){_0x367846[_0x4d46('0x19')](0xcc)[_0x4d46('0x1a')]();});}};}function handleEntityNotFound(_0x1d4247,_0x2ef809){return function(_0x27037c){if(!_0x27037c){_0x1d4247[_0x4d46('0x18')](0x194);}return _0x27037c;};}function handleError(_0xd05675,_0x1acaa8){_0x1acaa8=_0x1acaa8||0x1f4;return function(_0x17225e){logger[_0x4d46('0x26')](_0x17225e['stack']);if(_0x17225e[_0x4d46('0x27')]){delete _0x17225e[_0x4d46('0x27')];}_0xd05675[_0x4d46('0x19')](_0x1acaa8)['send'](_0x17225e);};}exports[_0x4d46('0x28')]=function(_0x427cfa,_0x2074b5){var _0x4370ed={},_0x4f7e04={},_0x45447e={'count':0x0,'rows':[]};var _0x33a3f9=_[_0x4d46('0x29')](db[_0x4d46('0x2a')][_0x4d46('0x2b')],function(_0x448a87){return{'name':_0x448a87[_0x4d46('0x2c')],'type':_0x448a87[_0x4d46('0x2d')]['key']};});_0x4f7e04[_0x4d46('0x2e')]=_['map'](_0x33a3f9,'name');_0x4f7e04[_0x4d46('0x2f')]=_[_0x4d46('0x30')](_0x427cfa[_0x4d46('0x2f')]);_0x4f7e04[_0x4d46('0x31')]=_[_0x4d46('0x32')](_0x4f7e04[_0x4d46('0x2e')],_0x4f7e04[_0x4d46('0x2f')]);_0x4370ed['attributes']=_[_0x4d46('0x32')](_0x4f7e04[_0x4d46('0x2e')],qs[_0x4d46('0x33')](_0x427cfa[_0x4d46('0x2f')][_0x4d46('0x33')]));_0x4370ed[_0x4d46('0x34')]=_0x4370ed[_0x4d46('0x34')][_0x4d46('0x35')]?_0x4370ed[_0x4d46('0x34')]:_0x4f7e04[_0x4d46('0x2e')];if(!_0x427cfa[_0x4d46('0x2f')][_0x4d46('0x36')](_0x4d46('0x37'))){_0x4370ed[_0x4d46('0x1d')]=qs['limit'](_0x427cfa[_0x4d46('0x2f')][_0x4d46('0x1d')]);_0x4370ed['offset']=qs[_0x4d46('0x1c')](_0x427cfa[_0x4d46('0x2f')][_0x4d46('0x1c')]);}_0x4370ed[_0x4d46('0x38')]=qs[_0x4d46('0x39')](_0x427cfa[_0x4d46('0x2f')][_0x4d46('0x39')]);_0x4370ed['where']=qs[_0x4d46('0x31')](_[_0x4d46('0x3a')](_0x427cfa['query'],_0x4f7e04[_0x4d46('0x31')]),_0x33a3f9);if(_0x427cfa[_0x4d46('0x2f')][_0x4d46('0x3b')]){_0x4370ed[_0x4d46('0x3c')]=_[_0x4d46('0x3d')](_0x4370ed[_0x4d46('0x3c')],{'$or':_[_0x4d46('0x29')](_0x33a3f9,function(_0x2cb265){if(_0x2cb265[_0x4d46('0x2d')]!==_0x4d46('0x3e')){var _0x31c38f={};_0x31c38f[_0x2cb265['name']]={'$like':'%'+_0x427cfa[_0x4d46('0x2f')][_0x4d46('0x3b')]+'%'};return _0x31c38f;}})});}_0x4370ed=_[_0x4d46('0x3d')]({},_0x4370ed,_0x427cfa[_0x4d46('0x3f')]);var _0x215adb={'where':_0x4370ed[_0x4d46('0x3c')]};return db[_0x4d46('0x2a')][_0x4d46('0x1f')](_0x215adb)['then'](function(_0x485589){_0x45447e['count']=_0x485589;if(_0x427cfa[_0x4d46('0x2f')]['includeAll']){_0x4370ed['include']=[{'all':!![]}];}return db[_0x4d46('0x2a')][_0x4d46('0x40')](_0x4370ed);})[_0x4d46('0x24')](function(_0x305248){_0x45447e[_0x4d46('0x41')]=_0x305248;return _0x45447e;})[_0x4d46('0x24')](respondWithFilteredResult(_0x2074b5,_0x4370ed))[_0x4d46('0x42')](handleError(_0x2074b5,null));};exports[_0x4d46('0x43')]=function(_0x46faf2,_0x4e0caf){var _0x1670de={'raw':!![],'where':{'id':_0x46faf2['params']['id']}},_0x378a7d={};_0x378a7d[_0x4d46('0x2e')]=_[_0x4d46('0x30')](db[_0x4d46('0x2a')][_0x4d46('0x2b')]);_0x378a7d[_0x4d46('0x2f')]=_[_0x4d46('0x30')](_0x46faf2[_0x4d46('0x2f')]);_0x378a7d['filters']=_[_0x4d46('0x32')](_0x378a7d[_0x4d46('0x2e')],_0x378a7d['query']);_0x1670de['attributes']=_[_0x4d46('0x32')](_0x378a7d['model'],qs[_0x4d46('0x33')](_0x46faf2[_0x4d46('0x2f')][_0x4d46('0x33')]));_0x1670de['attributes']=_0x1670de[_0x4d46('0x34')][_0x4d46('0x35')]?_0x1670de[_0x4d46('0x34')]:_0x378a7d[_0x4d46('0x2e')];if(_0x46faf2[_0x4d46('0x2f')][_0x4d46('0x44')]){_0x1670de[_0x4d46('0x45')]=[{'all':!![]}];}_0x1670de=_['merge']({},_0x1670de,_0x46faf2[_0x4d46('0x3f')]);return db['MailSubstatus'][_0x4d46('0x46')](_0x1670de)['then'](handleEntityNotFound(_0x4e0caf,null))[_0x4d46('0x24')](respondWithResult(_0x4e0caf,null))[_0x4d46('0x42')](handleError(_0x4e0caf,null));};exports[_0x4d46('0x47')]=function(_0x17bd96,_0x48fb47){return db[_0x4d46('0x2a')][_0x4d46('0x47')](_0x17bd96[_0x4d46('0x48')],{})[_0x4d46('0x24')](respondWithResult(_0x48fb47,0xc9))['catch'](handleError(_0x48fb47,null));};exports[_0x4d46('0x49')]=function(_0x192712,_0x48ff66){if(_0x192712[_0x4d46('0x48')]['id']){delete _0x192712[_0x4d46('0x48')]['id'];}return db[_0x4d46('0x2a')][_0x4d46('0x46')]({'where':{'id':_0x192712[_0x4d46('0x4a')]['id']}})[_0x4d46('0x24')](handleEntityNotFound(_0x48ff66,null))[_0x4d46('0x24')](saveUpdates(_0x192712['body'],null))['then'](respondWithResult(_0x48ff66,null))['catch'](handleError(_0x48ff66,null));};exports[_0x4d46('0x25')]=function(_0x1d43a7,_0x214c71){return db['MailSubstatus'][_0x4d46('0x46')]({'where':{'id':_0x1d43a7[_0x4d46('0x4a')]['id']}})[_0x4d46('0x24')](handleEntityNotFound(_0x214c71,null))['then'](removeEntity(_0x214c71,null))[_0x4d46('0x42')](handleError(_0x214c71,null));};exports[_0x4d46('0x4b')]=function(_0x155f41,_0x4f678b){return db['MailSubstatus'][_0x4d46('0x4b')]()[_0x4d46('0x24')](respondWithResult(_0x4f678b,null))[_0x4d46('0x42')](handleError(_0x4f678b,null));}; \ No newline at end of file +var _0xb0b2=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','status','end','json','offset','undefined','limit','set','reject','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','keys','query','filters','model','intersection','fields','length','attributes','hasOwnProperty','nolimit','where','merge','VIRTUAL','count','includeAll','include','catch','options','find','create','body','params','describe'];(function(_0x368792,_0x154762){var _0x13f3d6=function(_0x18b6ed){while(--_0x18b6ed){_0x368792['push'](_0x368792['shift']());}};_0x13f3d6(++_0x154762);}(_0xb0b2,0x1bc));var _0x2b0b=function(_0x4d4828,_0x2063c1){_0x4d4828=_0x4d4828-0x0;var _0x506f9b=_0xb0b2[_0x4d4828];return _0x506f9b;};'use strict';var emlformat=require(_0x2b0b('0x0'));var rimraf=require(_0x2b0b('0x1'));var zipdir=require(_0x2b0b('0x2'));var jsonpatch=require(_0x2b0b('0x3'));var rp=require(_0x2b0b('0x4'));var moment=require(_0x2b0b('0x5'));var BPromise=require(_0x2b0b('0x6'));var Mustache=require('mustache');var util=require(_0x2b0b('0x7'));var path=require(_0x2b0b('0x8'));var sox=require(_0x2b0b('0x9'));var csv=require(_0x2b0b('0xa'));var ejs=require(_0x2b0b('0xb'));var fs=require('fs');var fs_extra=require(_0x2b0b('0xc'));var _=require(_0x2b0b('0xd'));var squel=require(_0x2b0b('0xe'));var crypto=require('crypto');var jsforce=require(_0x2b0b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2b0b('0xa'));var querystring=require(_0x2b0b('0x10'));var Papa=require(_0x2b0b('0x11'));var Redis=require(_0x2b0b('0x12'));var authService=require(_0x2b0b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2b0b('0x14'));var hardwareService=require(_0x2b0b('0x15'));var logger=require(_0x2b0b('0x16'))(_0x2b0b('0x17'));var utils=require(_0x2b0b('0x18'));var config=require(_0x2b0b('0x19'));var licenseUtil=require(_0x2b0b('0x1a'));var db=require(_0x2b0b('0x1b'))['db'];function respondWithStatusCode(_0x224b0b,_0xd89f35){_0xd89f35=_0xd89f35||0xcc;return function(_0x150449){if(_0x150449){return _0x224b0b[_0x2b0b('0x1c')](_0xd89f35);}return _0x224b0b[_0x2b0b('0x1d')](_0xd89f35)[_0x2b0b('0x1e')]();};}function respondWithResult(_0x37bf8f,_0x41d892){_0x41d892=_0x41d892||0xc8;return function(_0x289cd1){if(_0x289cd1){return _0x37bf8f['status'](_0x41d892)[_0x2b0b('0x1f')](_0x289cd1);}};}function respondWithFilteredResult(_0x1f771f,_0x17d140){return function(_0x3bf46d){if(_0x3bf46d){var _0x5491e7=typeof _0x17d140[_0x2b0b('0x20')]===_0x2b0b('0x21')&&typeof _0x17d140[_0x2b0b('0x22')]===_0x2b0b('0x21');var _0x244462=_0x3bf46d['count'];var _0x1ac622=_0x5491e7?0x0:_0x17d140['offset'];var _0x3bac43=_0x5491e7?_0x3bf46d['count']:_0x17d140[_0x2b0b('0x20')]+_0x17d140[_0x2b0b('0x22')];var _0x10ae56;if(_0x3bac43>=_0x244462){_0x3bac43=_0x244462;_0x10ae56=0xc8;}else{_0x10ae56=0xce;}_0x1f771f[_0x2b0b('0x1d')](_0x10ae56);return _0x1f771f[_0x2b0b('0x23')]('Content-Range',_0x1ac622+'-'+_0x3bac43+'/'+_0x244462)['json'](_0x3bf46d);}return null;};}function patchUpdates(_0x2cfe91){return function(_0x6a8d88){try{jsonpatch['apply'](_0x6a8d88,_0x2cfe91,!![]);}catch(_0x55b358){return BPromise[_0x2b0b('0x24')](_0x55b358);}return _0x6a8d88['save']();};}function saveUpdates(_0x1b06a7,_0x66087){return function(_0x1b6d8b){if(_0x1b6d8b){return _0x1b6d8b[_0x2b0b('0x25')](_0x1b06a7)[_0x2b0b('0x26')](function(_0x3edd18){return _0x3edd18;});}return null;};}function removeEntity(_0x2fd2f9,_0x32c962){return function(_0x57345b){if(_0x57345b){return _0x57345b[_0x2b0b('0x27')]()[_0x2b0b('0x26')](function(){_0x2fd2f9['status'](0xcc)[_0x2b0b('0x1e')]();});}};}function handleEntityNotFound(_0x36a5be,_0x165dad){return function(_0x34ddd4){if(!_0x34ddd4){_0x36a5be['sendStatus'](0x194);}return _0x34ddd4;};}function handleError(_0x195296,_0x1b3dd7){_0x1b3dd7=_0x1b3dd7||0x1f4;return function(_0x506334){logger[_0x2b0b('0x28')](_0x506334[_0x2b0b('0x29')]);if(_0x506334['name']){delete _0x506334[_0x2b0b('0x2a')];}_0x195296[_0x2b0b('0x1d')](_0x1b3dd7)[_0x2b0b('0x2b')](_0x506334);};}exports[_0x2b0b('0x2c')]=function(_0x4e24b5,_0x511b98){var _0x258950={},_0x164ead={},_0x48623={'count':0x0,'rows':[]};var _0x2fbeac=_[_0x2b0b('0x2d')](db[_0x2b0b('0x2e')][_0x2b0b('0x2f')],function(_0x4ffe34){return{'name':_0x4ffe34[_0x2b0b('0x30')],'type':_0x4ffe34[_0x2b0b('0x31')][_0x2b0b('0x32')]};});_0x164ead['model']=_[_0x2b0b('0x2d')](_0x2fbeac,_0x2b0b('0x2a'));_0x164ead['query']=_[_0x2b0b('0x33')](_0x4e24b5[_0x2b0b('0x34')]);_0x164ead[_0x2b0b('0x35')]=_['intersection'](_0x164ead[_0x2b0b('0x36')],_0x164ead['query']);_0x258950['attributes']=_[_0x2b0b('0x37')](_0x164ead[_0x2b0b('0x36')],qs['fields'](_0x4e24b5[_0x2b0b('0x34')][_0x2b0b('0x38')]));_0x258950['attributes']=_0x258950['attributes'][_0x2b0b('0x39')]?_0x258950[_0x2b0b('0x3a')]:_0x164ead['model'];if(!_0x4e24b5[_0x2b0b('0x34')][_0x2b0b('0x3b')](_0x2b0b('0x3c'))){_0x258950[_0x2b0b('0x22')]=qs[_0x2b0b('0x22')](_0x4e24b5[_0x2b0b('0x34')][_0x2b0b('0x22')]);_0x258950['offset']=qs[_0x2b0b('0x20')](_0x4e24b5['query'][_0x2b0b('0x20')]);}_0x258950['order']=qs['sort'](_0x4e24b5[_0x2b0b('0x34')]['sort']);_0x258950[_0x2b0b('0x3d')]=qs[_0x2b0b('0x35')](_['pick'](_0x4e24b5[_0x2b0b('0x34')],_0x164ead[_0x2b0b('0x35')]),_0x2fbeac);if(_0x4e24b5[_0x2b0b('0x34')]['filter']){_0x258950[_0x2b0b('0x3d')]=_[_0x2b0b('0x3e')](_0x258950['where'],{'$or':_[_0x2b0b('0x2d')](_0x2fbeac,function(_0x340754){if(_0x340754['type']!==_0x2b0b('0x3f')){var _0x53a6c8={};_0x53a6c8[_0x340754[_0x2b0b('0x2a')]]={'$like':'%'+_0x4e24b5[_0x2b0b('0x34')]['filter']+'%'};return _0x53a6c8;}})});}_0x258950=_[_0x2b0b('0x3e')]({},_0x258950,_0x4e24b5['options']);var _0x34a99c={'where':_0x258950[_0x2b0b('0x3d')]};return db[_0x2b0b('0x2e')][_0x2b0b('0x40')](_0x34a99c)['then'](function(_0x5d1142){_0x48623[_0x2b0b('0x40')]=_0x5d1142;if(_0x4e24b5[_0x2b0b('0x34')][_0x2b0b('0x41')]){_0x258950[_0x2b0b('0x42')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x258950);})[_0x2b0b('0x26')](function(_0x3e0a53){_0x48623['rows']=_0x3e0a53;return _0x48623;})[_0x2b0b('0x26')](respondWithFilteredResult(_0x511b98,_0x258950))[_0x2b0b('0x43')](handleError(_0x511b98,null));};exports['show']=function(_0xb30645,_0x72d3ea){var _0x2d9c60={'raw':!![],'where':{'id':_0xb30645['params']['id']}},_0x26dd24={};_0x26dd24[_0x2b0b('0x36')]=_[_0x2b0b('0x33')](db[_0x2b0b('0x2e')][_0x2b0b('0x2f')]);_0x26dd24[_0x2b0b('0x34')]=_[_0x2b0b('0x33')](_0xb30645[_0x2b0b('0x34')]);_0x26dd24[_0x2b0b('0x35')]=_[_0x2b0b('0x37')](_0x26dd24[_0x2b0b('0x36')],_0x26dd24['query']);_0x2d9c60['attributes']=_[_0x2b0b('0x37')](_0x26dd24[_0x2b0b('0x36')],qs[_0x2b0b('0x38')](_0xb30645['query'][_0x2b0b('0x38')]));_0x2d9c60['attributes']=_0x2d9c60[_0x2b0b('0x3a')]['length']?_0x2d9c60[_0x2b0b('0x3a')]:_0x26dd24[_0x2b0b('0x36')];if(_0xb30645['query'][_0x2b0b('0x41')]){_0x2d9c60[_0x2b0b('0x42')]=[{'all':!![]}];}_0x2d9c60=_[_0x2b0b('0x3e')]({},_0x2d9c60,_0xb30645[_0x2b0b('0x44')]);return db['MailSubstatus'][_0x2b0b('0x45')](_0x2d9c60)[_0x2b0b('0x26')](handleEntityNotFound(_0x72d3ea,null))[_0x2b0b('0x26')](respondWithResult(_0x72d3ea,null))['catch'](handleError(_0x72d3ea,null));};exports[_0x2b0b('0x46')]=function(_0x2a8727,_0x196e25){return db['MailSubstatus']['create'](_0x2a8727[_0x2b0b('0x47')],{})['then'](respondWithResult(_0x196e25,0xc9))[_0x2b0b('0x43')](handleError(_0x196e25,null));};exports['update']=function(_0x4425f5,_0x5999df){if(_0x4425f5['body']['id']){delete _0x4425f5['body']['id'];}return db['MailSubstatus'][_0x2b0b('0x45')]({'where':{'id':_0x4425f5[_0x2b0b('0x48')]['id']}})[_0x2b0b('0x26')](handleEntityNotFound(_0x5999df,null))['then'](saveUpdates(_0x4425f5[_0x2b0b('0x47')],null))[_0x2b0b('0x26')](respondWithResult(_0x5999df,null))[_0x2b0b('0x43')](handleError(_0x5999df,null));};exports[_0x2b0b('0x27')]=function(_0x46c395,_0x162376){return db[_0x2b0b('0x2e')][_0x2b0b('0x45')]({'where':{'id':_0x46c395[_0x2b0b('0x48')]['id']}})[_0x2b0b('0x26')](handleEntityNotFound(_0x162376,null))[_0x2b0b('0x26')](removeEntity(_0x162376,null))[_0x2b0b('0x43')](handleError(_0x162376,null));};exports[_0x2b0b('0x49')]=function(_0x5e1d61,_0x2f2c4d){return db[_0x2b0b('0x2e')][_0x2b0b('0x49')]()['then'](respondWithResult(_0x2f2c4d,null))[_0x2b0b('0x43')](handleError(_0x2f2c4d,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index b24651d..ee18597 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 _0xdc1c=['events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x41c400,_0x3998e1){var _0x148439=function(_0x291cab){while(--_0x291cab){_0x41c400['push'](_0x41c400['shift']());}};_0x148439(++_0x3998e1);}(_0xdc1c,0x1a7));var _0xcdc1=function(_0x30fc17,_0x43b50f){_0x30fc17=_0x30fc17-0x0;var _0x38ec11=_0xdc1c[_0x30fc17];return _0x38ec11;};'use strict';var EventEmitter=require(_0xcdc1('0x0'));var MailSubstatus=require(_0xcdc1('0x1'))['db'][_0xcdc1('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xcdc1('0x3')](0x0);var events={'afterUpdate':_0xcdc1('0x4')};function emitEvent(_0x1ceebf){return function(_0x244ca7,_0x54686d,_0x58bebd){MailSubstatusEvents['emit'](_0x1ceebf+':'+_0x244ca7['id'],_0x244ca7);MailSubstatusEvents[_0xcdc1('0x5')](_0x1ceebf,_0x244ca7);_0x58bebd(null);};}for(var e in events){if(events[_0xcdc1('0x6')](e)){var event=events[e];MailSubstatus[_0xcdc1('0x7')](e,emitEvent(event));}}module[_0xcdc1('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0x5841=['events','MailSubstatus','update','emit','hasOwnProperty','hook','exports'];(function(_0x214377,_0x5d8d2a){var _0x275dbd=function(_0x15aac3){while(--_0x15aac3){_0x214377['push'](_0x214377['shift']());}};_0x275dbd(++_0x5d8d2a);}(_0x5841,0x111));var _0x1584=function(_0x246003,_0x457551){_0x246003=_0x246003-0x0;var _0x41cbac=_0x5841[_0x246003];return _0x41cbac;};'use strict';var EventEmitter=require(_0x1584('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x1584('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x1584('0x2')};function emitEvent(_0x48833c){return function(_0x3fb5ef,_0xcf5c63,_0x3a62c4){MailSubstatusEvents[_0x1584('0x3')](_0x48833c+':'+_0x3fb5ef['id'],_0x3fb5ef);MailSubstatusEvents[_0x1584('0x3')](_0x48833c,_0x3fb5ef);_0x3a62c4(null);};}for(var e in events){if(events[_0x1584('0x4')](e)){var event=events[e];MailSubstatus[_0x1584('0x5')](e,emitEvent(event));}}module[_0x1584('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 93b506e..6023c22 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 _0x420d=['name','then','catch','./mailSubstatus.attributes','exports','define','MailSubstatus','Condition','update','mailSubstatus','_previousDataValues'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0x420d,0xb3));var _0xd420=function(_0x53b93b,_0x1bfab1){_0x53b93b=_0x53b93b-0x0;var _0x485761=_0x420d[_0x53b93b];return _0x485761;};'use strict';var attributes=require(_0xd420('0x0'));module[_0xd420('0x1')]=function(_0x3138e8){var _0x4f5c12=_0x3138e8['models'];return _0x3138e8[_0xd420('0x2')](_0xd420('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3f7cc9,_0x266b4e,_0x52599c){return _0x4f5c12[_0xd420('0x4')][_0xd420('0x5')]({'value':_0x3f7cc9['name']},{'where':{'field':_0xd420('0x6'),'value':_0x3f7cc9[_0xd420('0x7')][_0xd420('0x8')]}})[_0xd420('0x9')](function(){_0x52599c();})[_0xd420('0xa')](function(_0x1d597a){_0x52599c(_0x1d597a);});}}});}; \ No newline at end of file +var _0xcab3=['Condition','update','name','_previousDataValues','then','./mailSubstatus.attributes','exports','models','define','mail_substatuses'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xcab3,0x181));var _0x3cab=function(_0x40400e,_0x2767cd){_0x40400e=_0x40400e-0x0;var _0x3a51d1=_0xcab3[_0x40400e];return _0x3a51d1;};'use strict';var attributes=require(_0x3cab('0x0'));module[_0x3cab('0x1')]=function(_0x303e7a){var _0x3d748b=_0x303e7a[_0x3cab('0x2')];return _0x303e7a[_0x3cab('0x3')]('MailSubstatus',attributes,{'tableName':_0x3cab('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5ace5c,_0x33a8bb,_0x38c0e5){return _0x3d748b[_0x3cab('0x5')][_0x3cab('0x6')]({'value':_0x5ace5c[_0x3cab('0x7')]},{'where':{'field':'mailSubstatus','value':_0x5ace5c[_0x3cab('0x8')][_0x3cab('0x7')]}})[_0x3cab('0x9')](function(){_0x38c0e5();})['catch'](function(_0x1a1888){_0x38c0e5(_0x1a1888);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 834b4c9..d069c1e 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 _0xe277=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0xb2eb9,_0x30c85b){var _0x53d698=function(_0x532900){while(--_0x532900){_0xb2eb9['push'](_0xb2eb9['shift']());}};_0x53d698(++_0x30c85b);}(_0xe277,0xe6));var _0x7e27=function(_0xf41988,_0x39da45){_0xf41988=_0xf41988-0x0;var _0x1ac5bc=_0xe277[_0xf41988];return _0x1ac5bc;};'use strict';var _=require('lodash');var util=require(_0x7e27('0x0'));var moment=require('moment');var BPromise=require(_0x7e27('0x1'));var rs=require(_0x7e27('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e27('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e27('0x4'))(_0x7e27('0x5'));var config=require('../../config/environment');var jayson=require(_0x7e27('0x6'));var client=jayson[_0x7e27('0x7')][_0x7e27('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30e38a,_0x279b9c,_0x1464c3){return new BPromise(function(_0x1dcd1c,_0x5d3804){return client[_0x7e27('0x9')](_0x30e38a,_0x1464c3)[_0x7e27('0xa')](function(_0x27ae46){logger[_0x7e27('0xb')](_0x7e27('0xc'),_0x279b9c,'request\x20sent');logger['debug'](_0x7e27('0xd'),_0x279b9c,_0x7e27('0xe'),JSON[_0x7e27('0xf')](_0x27ae46));if(_0x27ae46[_0x7e27('0x10')]){if(_0x27ae46[_0x7e27('0x10')][_0x7e27('0x11')]===0x1f4){logger[_0x7e27('0x10')](_0x7e27('0xc'),_0x279b9c,_0x27ae46[_0x7e27('0x10')][_0x7e27('0x12')]);return _0x5d3804(_0x27ae46[_0x7e27('0x10')]['message']);}logger[_0x7e27('0x10')](_0x7e27('0xc'),_0x279b9c,_0x27ae46[_0x7e27('0x10')][_0x7e27('0x12')]);return _0x1dcd1c(_0x27ae46['error']['message']);}else{logger[_0x7e27('0xb')](_0x7e27('0xc'),_0x279b9c,_0x7e27('0xe'));_0x1dcd1c(_0x27ae46[_0x7e27('0x13')][_0x7e27('0x12')]);}})[_0x7e27('0x14')](function(_0x32f275){logger[_0x7e27('0x10')](_0x7e27('0xc'),_0x279b9c,_0x32f275);_0x5d3804(_0x32f275);});});} \ No newline at end of file +var _0xb0e2=['http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xb0e2,0xac));var _0x2b0e=function(_0xe1c8a,_0x41f9a0){_0xe1c8a=_0xe1c8a-0x0;var _0x54923d=_0xb0e2[_0xe1c8a];return _0x54923d;};'use strict';var _=require(_0x2b0e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2b0e('0x1'));var rs=require(_0x2b0e('0x2'));var fs=require('fs');var Redis=require(_0x2b0e('0x3'));var db=require(_0x2b0e('0x4'))['db'];var utils=require(_0x2b0e('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2b0e('0x6'));var client=jayson[_0x2b0e('0x7')][_0x2b0e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2680b4,_0x4b08bd,_0x5cc03e){return new BPromise(function(_0x606d37,_0x44c9f7){return client[_0x2b0e('0x9')](_0x2680b4,_0x5cc03e)[_0x2b0e('0xa')](function(_0x29da4c){logger['info'](_0x2b0e('0xb'),_0x4b08bd,_0x2b0e('0xc'));logger['debug'](_0x2b0e('0xd'),_0x4b08bd,_0x2b0e('0xc'),JSON[_0x2b0e('0xe')](_0x29da4c));if(_0x29da4c[_0x2b0e('0xf')]){if(_0x29da4c['error'][_0x2b0e('0x10')]===0x1f4){logger[_0x2b0e('0xf')](_0x2b0e('0xb'),_0x4b08bd,_0x29da4c[_0x2b0e('0xf')][_0x2b0e('0x11')]);return _0x44c9f7(_0x29da4c[_0x2b0e('0xf')][_0x2b0e('0x11')]);}logger[_0x2b0e('0xf')](_0x2b0e('0xb'),_0x4b08bd,_0x29da4c[_0x2b0e('0xf')][_0x2b0e('0x11')]);return _0x606d37(_0x29da4c[_0x2b0e('0xf')]['message']);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x4b08bd,'request\x20sent');_0x606d37(_0x29da4c[_0x2b0e('0x12')][_0x2b0e('0x11')]);}})[_0x2b0e('0x13')](function(_0x4949de){logger[_0x2b0e('0xf')](_0x2b0e('0xb'),_0x4b08bd,_0x4949de);_0x44c9f7(_0x4949de);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index c88df57..5113a1b 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 _0x8a2d=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete'];(function(_0x55b50c,_0x17e17b){var _0x11a691=function(_0x16d926){while(--_0x16d926){_0x55b50c['push'](_0x55b50c['shift']());}};_0x11a691(++_0x17e17b);}(_0x8a2d,0xd2));var _0xd8a2=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x8a2d[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0xd8a2('0x0'));var util=require(_0xd8a2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd8a2('0x2'));var router=express[_0xd8a2('0x3')]();var fs_extra=require(_0xd8a2('0x4'));var auth=require(_0xd8a2('0x5'));var interaction=require(_0xd8a2('0x6'));var config=require(_0xd8a2('0x7'));var controller=require('./mailTransferReport.controller');router[_0xd8a2('0x8')]('/',auth[_0xd8a2('0x9')](),controller[_0xd8a2('0xa')]);router[_0xd8a2('0x8')](_0xd8a2('0xb'),auth[_0xd8a2('0x9')](),controller[_0xd8a2('0xc')]);router[_0xd8a2('0x8')](_0xd8a2('0xd'),auth[_0xd8a2('0x9')](),controller[_0xd8a2('0xe')]);router[_0xd8a2('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xd8a2('0x9')](),controller[_0xd8a2('0x10')]);router[_0xd8a2('0x11')](_0xd8a2('0xd'),auth[_0xd8a2('0x9')](),controller['destroy']);module[_0xd8a2('0x12')]=router; \ No newline at end of file +var _0x3b5a=['/describe','show','create','put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index'];(function(_0x4e7d17,_0x5d75de){var _0x7d8a4=function(_0x13611a){while(--_0x13611a){_0x4e7d17['push'](_0x4e7d17['shift']());}};_0x7d8a4(++_0x5d75de);}(_0x3b5a,0x180));var _0xa3b5=function(_0x1ba3f0,_0x3b220d){_0x1ba3f0=_0x1ba3f0-0x0;var _0x53064d=_0x3b5a[_0x1ba3f0];return _0x53064d;};'use strict';var multer=require(_0xa3b5('0x0'));var util=require(_0xa3b5('0x1'));var path=require(_0xa3b5('0x2'));var timeout=require(_0xa3b5('0x3'));var express=require(_0xa3b5('0x4'));var router=express['Router']();var fs_extra=require(_0xa3b5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa3b5('0x6'));var config=require(_0xa3b5('0x7'));var controller=require(_0xa3b5('0x8'));router[_0xa3b5('0x9')]('/',auth[_0xa3b5('0xa')](),controller[_0xa3b5('0xb')]);router['get'](_0xa3b5('0xc'),auth[_0xa3b5('0xa')](),controller['describe']);router[_0xa3b5('0x9')]('/:id',auth[_0xa3b5('0xa')](),controller[_0xa3b5('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa3b5('0xe')]);router[_0xa3b5('0xf')]('/:id',auth[_0xa3b5('0xa')](),controller['update']);router['delete']('/:id',auth[_0xa3b5('0xa')](),controller[_0xa3b5('0x10')]);module[_0xa3b5('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index fe8163d..2c2dc51 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(_0x41f33c,_0xdba0f5){var _0x3e8ee3=function(_0x249b09){while(--_0x249b09){_0x41f33c['push'](_0x41f33c['shift']());}};_0x3e8ee3(++_0xdba0f5);}(_0x34e8,0x12c));var _0x834e=function(_0x1f7d5c,_0x38563c){_0x1f7d5c=_0x1f7d5c-0x0;var _0x105c38=_0x34e8[_0x1f7d5c];return _0x105c38;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x356b45,_0x4f6bfa){var _0x51bb26=function(_0x451759){while(--_0x451759){_0x356b45['push'](_0x356b45['shift']());}};_0x51bb26(++_0x4f6bfa);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2fd326,_0x263295){_0x2fd326=_0x2fd326-0x0;var _0x24ac11=_0xf4eb[_0x2fd326];return _0x24ac11;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 47f5581..178899a 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 _0x172c=['VIRTUAL','MailTransferReport','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','filters','query','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x172c,0x1d0));var _0xc172=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0x172c[_0x74892f];return _0x10ee61;};'use strict';var emlformat=require(_0xc172('0x0'));var rimraf=require(_0xc172('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc172('0x2'));var rp=require(_0xc172('0x3'));var moment=require(_0xc172('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc172('0x5'));var util=require(_0xc172('0x6'));var path=require(_0xc172('0x7'));var sox=require(_0xc172('0x8'));var csv=require(_0xc172('0x9'));var ejs=require(_0xc172('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc172('0xb'));var crypto=require(_0xc172('0xc'));var jsforce=require(_0xc172('0xd'));var deskjs=require(_0xc172('0xe'));var toCsv=require(_0xc172('0x9'));var querystring=require(_0xc172('0xf'));var Papa=require(_0xc172('0x10'));var Redis=require(_0xc172('0x11'));var authService=require(_0xc172('0x12'));var qs=require(_0xc172('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc172('0x14'))(_0xc172('0x15'));var utils=require(_0xc172('0x16'));var config=require(_0xc172('0x17'));var licenseUtil=require(_0xc172('0x18'));var db=require(_0xc172('0x19'))['db'];function respondWithStatusCode(_0x3748fa,_0x296e7f){_0x296e7f=_0x296e7f||0xcc;return function(_0x416d21){if(_0x416d21){return _0x3748fa['sendStatus'](_0x296e7f);}return _0x3748fa[_0xc172('0x1a')](_0x296e7f)[_0xc172('0x1b')]();};}function respondWithResult(_0x27288b,_0x187915){_0x187915=_0x187915||0xc8;return function(_0x783de){if(_0x783de){return _0x27288b[_0xc172('0x1a')](_0x187915)['json'](_0x783de);}};}function respondWithFilteredResult(_0x1e9600,_0x23a926){return function(_0x38e3dc){if(_0x38e3dc){var _0x30463c=typeof _0x23a926[_0xc172('0x1c')]===_0xc172('0x1d')&&typeof _0x23a926[_0xc172('0x1e')]==='undefined';var _0x3c67a4=_0x38e3dc[_0xc172('0x1f')];var _0xaee72f=_0x30463c?0x0:_0x23a926['offset'];var _0x2e5723=_0x30463c?_0x38e3dc[_0xc172('0x1f')]:_0x23a926[_0xc172('0x1c')]+_0x23a926[_0xc172('0x1e')];var _0x5ea88a;if(_0x2e5723>=_0x3c67a4){_0x2e5723=_0x3c67a4;_0x5ea88a=0xc8;}else{_0x5ea88a=0xce;}_0x1e9600[_0xc172('0x1a')](_0x5ea88a);return _0x1e9600[_0xc172('0x20')]('Content-Range',_0xaee72f+'-'+_0x2e5723+'/'+_0x3c67a4)[_0xc172('0x21')](_0x38e3dc);}return null;};}function patchUpdates(_0x470235){return function(_0x51945b){try{jsonpatch['apply'](_0x51945b,_0x470235,!![]);}catch(_0x2f6d36){return BPromise[_0xc172('0x22')](_0x2f6d36);}return _0x51945b[_0xc172('0x23')]();};}function saveUpdates(_0x389a7c,_0x1133fe){return function(_0x570fae){if(_0x570fae){return _0x570fae[_0xc172('0x24')](_0x389a7c)[_0xc172('0x25')](function(_0x2d924b){return _0x2d924b;});}return null;};}function removeEntity(_0x40c68c,_0x46f00e){return function(_0x2c44ae){if(_0x2c44ae){return _0x2c44ae['destroy']()['then'](function(){_0x40c68c[_0xc172('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b0025,_0x1ee1ae){return function(_0x134373){if(!_0x134373){_0x3b0025['sendStatus'](0x194);}return _0x134373;};}function handleError(_0x1c1661,_0x5c1513){_0x5c1513=_0x5c1513||0x1f4;return function(_0xb098d9){logger['error'](_0xb098d9[_0xc172('0x26')]);if(_0xb098d9[_0xc172('0x27')]){delete _0xb098d9[_0xc172('0x27')];}_0x1c1661[_0xc172('0x1a')](_0x5c1513)[_0xc172('0x28')](_0xb098d9);};}exports[_0xc172('0x29')]=function(_0x245f6a,_0x2b7149){var _0x572874={},_0x151761={},_0x1a39ff={'count':0x0,'rows':[]};var _0x2ba025=_[_0xc172('0x2a')](db['MailTransferReport'][_0xc172('0x2b')],function(_0x1128ee){return{'name':_0x1128ee[_0xc172('0x2c')],'type':_0x1128ee[_0xc172('0x2d')][_0xc172('0x2e')]};});_0x151761['model']=_[_0xc172('0x2a')](_0x2ba025,_0xc172('0x27'));_0x151761['query']=_[_0xc172('0x2f')](_0x245f6a['query']);_0x151761[_0xc172('0x30')]=_['intersection'](_0x151761['model'],_0x151761[_0xc172('0x31')]);_0x572874[_0xc172('0x32')]=_[_0xc172('0x33')](_0x151761[_0xc172('0x34')],qs[_0xc172('0x35')](_0x245f6a[_0xc172('0x31')][_0xc172('0x35')]));_0x572874[_0xc172('0x32')]=_0x572874[_0xc172('0x32')]['length']?_0x572874[_0xc172('0x32')]:_0x151761['model'];if(!_0x245f6a[_0xc172('0x31')][_0xc172('0x36')](_0xc172('0x37'))){_0x572874[_0xc172('0x1e')]=qs[_0xc172('0x1e')](_0x245f6a[_0xc172('0x31')][_0xc172('0x1e')]);_0x572874[_0xc172('0x1c')]=qs[_0xc172('0x1c')](_0x245f6a[_0xc172('0x31')][_0xc172('0x1c')]);}_0x572874[_0xc172('0x38')]=qs[_0xc172('0x39')](_0x245f6a[_0xc172('0x31')][_0xc172('0x39')]);_0x572874[_0xc172('0x3a')]=qs[_0xc172('0x30')](_['pick'](_0x245f6a[_0xc172('0x31')],_0x151761['filters']),_0x2ba025);if(_0x245f6a[_0xc172('0x31')][_0xc172('0x3b')]){_0x572874[_0xc172('0x3a')]=_[_0xc172('0x3c')](_0x572874[_0xc172('0x3a')],{'$or':_[_0xc172('0x2a')](_0x2ba025,function(_0x5d9758){if(_0x5d9758[_0xc172('0x2d')]!==_0xc172('0x3d')){var _0x2002b6={};_0x2002b6[_0x5d9758['name']]={'$like':'%'+_0x245f6a[_0xc172('0x31')]['filter']+'%'};return _0x2002b6;}})});}_0x572874=_[_0xc172('0x3c')]({},_0x572874,_0x245f6a['options']);var _0x18f249={'where':_0x572874[_0xc172('0x3a')]};return db[_0xc172('0x3e')]['count'](_0x18f249)['then'](function(_0x18ac81){_0x1a39ff[_0xc172('0x1f')]=_0x18ac81;if(_0x245f6a[_0xc172('0x31')][_0xc172('0x3f')]){_0x572874[_0xc172('0x40')]=[{'all':!![]}];}return db[_0xc172('0x3e')][_0xc172('0x41')](_0x572874);})[_0xc172('0x25')](function(_0x4cc547){_0x1a39ff[_0xc172('0x42')]=_0x4cc547;return _0x1a39ff;})[_0xc172('0x25')](respondWithFilteredResult(_0x2b7149,_0x572874))['catch'](handleError(_0x2b7149,null));};exports[_0xc172('0x43')]=function(_0x27ee77,_0x1bdc31){var _0xc916a6={'raw':!![],'where':{'id':_0x27ee77[_0xc172('0x44')]['id']}},_0x24eaea={};_0x24eaea[_0xc172('0x34')]=_[_0xc172('0x2f')](db[_0xc172('0x3e')][_0xc172('0x2b')]);_0x24eaea['query']=_['keys'](_0x27ee77[_0xc172('0x31')]);_0x24eaea[_0xc172('0x30')]=_[_0xc172('0x33')](_0x24eaea[_0xc172('0x34')],_0x24eaea['query']);_0xc916a6[_0xc172('0x32')]=_[_0xc172('0x33')](_0x24eaea[_0xc172('0x34')],qs[_0xc172('0x35')](_0x27ee77[_0xc172('0x31')][_0xc172('0x35')]));_0xc916a6[_0xc172('0x32')]=_0xc916a6[_0xc172('0x32')][_0xc172('0x45')]?_0xc916a6['attributes']:_0x24eaea[_0xc172('0x34')];if(_0x27ee77[_0xc172('0x31')]['includeAll']){_0xc916a6[_0xc172('0x40')]=[{'all':!![]}];}_0xc916a6=_[_0xc172('0x3c')]({},_0xc916a6,_0x27ee77['options']);return db[_0xc172('0x3e')][_0xc172('0x46')](_0xc916a6)[_0xc172('0x25')](handleEntityNotFound(_0x1bdc31,null))['then'](respondWithResult(_0x1bdc31,null))[_0xc172('0x47')](handleError(_0x1bdc31,null));};exports[_0xc172('0x48')]=function(_0x2ac20b,_0x18dacf){return db['MailTransferReport'][_0xc172('0x48')](_0x2ac20b[_0xc172('0x49')],{})[_0xc172('0x25')](respondWithResult(_0x18dacf,0xc9))['catch'](handleError(_0x18dacf,null));};exports[_0xc172('0x24')]=function(_0x15fb84,_0x56615d){if(_0x15fb84[_0xc172('0x49')]['id']){delete _0x15fb84[_0xc172('0x49')]['id'];}return db[_0xc172('0x3e')][_0xc172('0x46')]({'where':{'id':_0x15fb84[_0xc172('0x44')]['id']}})[_0xc172('0x25')](handleEntityNotFound(_0x56615d,null))[_0xc172('0x25')](saveUpdates(_0x15fb84[_0xc172('0x49')],null))[_0xc172('0x25')](respondWithResult(_0x56615d,null))[_0xc172('0x47')](handleError(_0x56615d,null));};exports['destroy']=function(_0x444df1,_0x5a9ff3){return db['MailTransferReport'][_0xc172('0x46')]({'where':{'id':_0x444df1['params']['id']}})[_0xc172('0x25')](handleEntityNotFound(_0x5a9ff3,null))[_0xc172('0x25')](removeEntity(_0x5a9ff3,null))['catch'](handleError(_0x5a9ff3,null));};exports[_0xc172('0x4a')]=function(_0x4f561f,_0x59cf1e){return db[_0xc172('0x3e')][_0xc172('0x4a')]()[_0xc172('0x25')](respondWithResult(_0x59cf1e,null))[_0xc172('0x47')](handleError(_0x59cf1e,null));}; \ No newline at end of file +var _0xe3fa=['request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','catch','show','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3eaafa,_0x1a41b7){var _0x16e821=function(_0xbdb543){while(--_0xbdb543){_0x3eaafa['push'](_0x3eaafa['shift']());}};_0x16e821(++_0x1a41b7);}(_0xe3fa,0x1ca));var _0xae3f=function(_0x442d7c,_0x35a6e1){_0x442d7c=_0x442d7c-0x0;var _0x31dd86=_0xe3fa[_0x442d7c];return _0x31dd86;};'use strict';var emlformat=require(_0xae3f('0x0'));var rimraf=require(_0xae3f('0x1'));var zipdir=require(_0xae3f('0x2'));var jsonpatch=require(_0xae3f('0x3'));var rp=require(_0xae3f('0x4'));var moment=require(_0xae3f('0x5'));var BPromise=require(_0xae3f('0x6'));var Mustache=require('mustache');var util=require(_0xae3f('0x7'));var path=require(_0xae3f('0x8'));var sox=require('sox');var csv=require(_0xae3f('0x9'));var ejs=require(_0xae3f('0xa'));var fs=require('fs');var fs_extra=require(_0xae3f('0xb'));var _=require(_0xae3f('0xc'));var squel=require(_0xae3f('0xd'));var crypto=require(_0xae3f('0xe'));var jsforce=require(_0xae3f('0xf'));var deskjs=require(_0xae3f('0x10'));var toCsv=require(_0xae3f('0x9'));var querystring=require(_0xae3f('0x11'));var Papa=require(_0xae3f('0x12'));var Redis=require(_0xae3f('0x13'));var authService=require(_0xae3f('0x14'));var qs=require(_0xae3f('0x15'));var as=require(_0xae3f('0x16'));var hardwareService=require(_0xae3f('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xae3f('0x18'));var config=require(_0xae3f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xae3f('0x1a'))['db'];function respondWithStatusCode(_0x5ef085,_0x3ad8a2){_0x3ad8a2=_0x3ad8a2||0xcc;return function(_0x25f7cf){if(_0x25f7cf){return _0x5ef085[_0xae3f('0x1b')](_0x3ad8a2);}return _0x5ef085[_0xae3f('0x1c')](_0x3ad8a2)[_0xae3f('0x1d')]();};}function respondWithResult(_0x2118d7,_0x34d25f){_0x34d25f=_0x34d25f||0xc8;return function(_0x17146f){if(_0x17146f){return _0x2118d7[_0xae3f('0x1c')](_0x34d25f)[_0xae3f('0x1e')](_0x17146f);}};}function respondWithFilteredResult(_0x57f772,_0x3a3536){return function(_0x5b2171){if(_0x5b2171){var _0x4d6c23=typeof _0x3a3536[_0xae3f('0x1f')]==='undefined'&&typeof _0x3a3536[_0xae3f('0x20')]===_0xae3f('0x21');var _0x227c21=_0x5b2171[_0xae3f('0x22')];var _0x464a0c=_0x4d6c23?0x0:_0x3a3536[_0xae3f('0x1f')];var _0x5453c2=_0x4d6c23?_0x5b2171[_0xae3f('0x22')]:_0x3a3536['offset']+_0x3a3536[_0xae3f('0x20')];var _0x25ac3c;if(_0x5453c2>=_0x227c21){_0x5453c2=_0x227c21;_0x25ac3c=0xc8;}else{_0x25ac3c=0xce;}_0x57f772['status'](_0x25ac3c);return _0x57f772[_0xae3f('0x23')](_0xae3f('0x24'),_0x464a0c+'-'+_0x5453c2+'/'+_0x227c21)['json'](_0x5b2171);}return null;};}function patchUpdates(_0x2b41bc){return function(_0x414797){try{jsonpatch['apply'](_0x414797,_0x2b41bc,!![]);}catch(_0x3d8abd){return BPromise[_0xae3f('0x25')](_0x3d8abd);}return _0x414797[_0xae3f('0x26')]();};}function saveUpdates(_0x23c9d4,_0x389c2b){return function(_0x960ac3){if(_0x960ac3){return _0x960ac3[_0xae3f('0x27')](_0x23c9d4)[_0xae3f('0x28')](function(_0x2ef0e7){return _0x2ef0e7;});}return null;};}function removeEntity(_0x41625d,_0x4d92a6){return function(_0x9aac7){if(_0x9aac7){return _0x9aac7[_0xae3f('0x29')]()['then'](function(){_0x41625d[_0xae3f('0x1c')](0xcc)[_0xae3f('0x1d')]();});}};}function handleEntityNotFound(_0x4f7efc,_0x295e75){return function(_0x2ca7cf){if(!_0x2ca7cf){_0x4f7efc[_0xae3f('0x1b')](0x194);}return _0x2ca7cf;};}function handleError(_0x2b4b03,_0x3e37d6){_0x3e37d6=_0x3e37d6||0x1f4;return function(_0x3e0cfe){logger[_0xae3f('0x2a')](_0x3e0cfe[_0xae3f('0x2b')]);if(_0x3e0cfe[_0xae3f('0x2c')]){delete _0x3e0cfe[_0xae3f('0x2c')];}_0x2b4b03[_0xae3f('0x1c')](_0x3e37d6)[_0xae3f('0x2d')](_0x3e0cfe);};}exports[_0xae3f('0x2e')]=function(_0x5abce9,_0x16edba){var _0x3eed1f={},_0x367ef6={},_0x72adbb={'count':0x0,'rows':[]};var _0x1e7a0a=_[_0xae3f('0x2f')](db[_0xae3f('0x30')][_0xae3f('0x31')],function(_0x471daf){return{'name':_0x471daf[_0xae3f('0x32')],'type':_0x471daf[_0xae3f('0x33')]['key']};});_0x367ef6[_0xae3f('0x34')]=_[_0xae3f('0x2f')](_0x1e7a0a,_0xae3f('0x2c'));_0x367ef6[_0xae3f('0x35')]=_[_0xae3f('0x36')](_0x5abce9[_0xae3f('0x35')]);_0x367ef6[_0xae3f('0x37')]=_[_0xae3f('0x38')](_0x367ef6['model'],_0x367ef6[_0xae3f('0x35')]);_0x3eed1f[_0xae3f('0x39')]=_['intersection'](_0x367ef6[_0xae3f('0x34')],qs[_0xae3f('0x3a')](_0x5abce9[_0xae3f('0x35')][_0xae3f('0x3a')]));_0x3eed1f['attributes']=_0x3eed1f[_0xae3f('0x39')][_0xae3f('0x3b')]?_0x3eed1f[_0xae3f('0x39')]:_0x367ef6[_0xae3f('0x34')];if(!_0x5abce9[_0xae3f('0x35')]['hasOwnProperty'](_0xae3f('0x3c'))){_0x3eed1f[_0xae3f('0x20')]=qs[_0xae3f('0x20')](_0x5abce9['query']['limit']);_0x3eed1f[_0xae3f('0x1f')]=qs['offset'](_0x5abce9['query'][_0xae3f('0x1f')]);}_0x3eed1f[_0xae3f('0x3d')]=qs[_0xae3f('0x3e')](_0x5abce9[_0xae3f('0x35')][_0xae3f('0x3e')]);_0x3eed1f[_0xae3f('0x3f')]=qs['filters'](_[_0xae3f('0x40')](_0x5abce9['query'],_0x367ef6[_0xae3f('0x37')]),_0x1e7a0a);if(_0x5abce9[_0xae3f('0x35')]['filter']){_0x3eed1f[_0xae3f('0x3f')]=_[_0xae3f('0x41')](_0x3eed1f[_0xae3f('0x3f')],{'$or':_[_0xae3f('0x2f')](_0x1e7a0a,function(_0x561970){if(_0x561970[_0xae3f('0x33')]!=='VIRTUAL'){var _0x14c2f0={};_0x14c2f0[_0x561970['name']]={'$like':'%'+_0x5abce9[_0xae3f('0x35')][_0xae3f('0x42')]+'%'};return _0x14c2f0;}})});}_0x3eed1f=_[_0xae3f('0x41')]({},_0x3eed1f,_0x5abce9[_0xae3f('0x43')]);var _0x3a06e7={'where':_0x3eed1f[_0xae3f('0x3f')]};return db[_0xae3f('0x30')][_0xae3f('0x22')](_0x3a06e7)[_0xae3f('0x28')](function(_0x33148a){_0x72adbb[_0xae3f('0x22')]=_0x33148a;if(_0x5abce9[_0xae3f('0x35')]['includeAll']){_0x3eed1f[_0xae3f('0x44')]=[{'all':!![]}];}return db[_0xae3f('0x30')][_0xae3f('0x45')](_0x3eed1f);})[_0xae3f('0x28')](function(_0x59ba91){_0x72adbb['rows']=_0x59ba91;return _0x72adbb;})['then'](respondWithFilteredResult(_0x16edba,_0x3eed1f))[_0xae3f('0x46')](handleError(_0x16edba,null));};exports[_0xae3f('0x47')]=function(_0x60cabe,_0x509488){var _0x3d4c03={'raw':!![],'where':{'id':_0x60cabe['params']['id']}},_0x2f4da9={};_0x2f4da9[_0xae3f('0x34')]=_[_0xae3f('0x36')](db[_0xae3f('0x30')][_0xae3f('0x31')]);_0x2f4da9['query']=_[_0xae3f('0x36')](_0x60cabe[_0xae3f('0x35')]);_0x2f4da9[_0xae3f('0x37')]=_['intersection'](_0x2f4da9[_0xae3f('0x34')],_0x2f4da9[_0xae3f('0x35')]);_0x3d4c03['attributes']=_[_0xae3f('0x38')](_0x2f4da9[_0xae3f('0x34')],qs[_0xae3f('0x3a')](_0x60cabe[_0xae3f('0x35')][_0xae3f('0x3a')]));_0x3d4c03[_0xae3f('0x39')]=_0x3d4c03[_0xae3f('0x39')][_0xae3f('0x3b')]?_0x3d4c03[_0xae3f('0x39')]:_0x2f4da9[_0xae3f('0x34')];if(_0x60cabe[_0xae3f('0x35')]['includeAll']){_0x3d4c03['include']=[{'all':!![]}];}_0x3d4c03=_['merge']({},_0x3d4c03,_0x60cabe[_0xae3f('0x43')]);return db[_0xae3f('0x30')]['find'](_0x3d4c03)['then'](handleEntityNotFound(_0x509488,null))[_0xae3f('0x28')](respondWithResult(_0x509488,null))[_0xae3f('0x46')](handleError(_0x509488,null));};exports[_0xae3f('0x48')]=function(_0x4a5347,_0xe80a96){return db[_0xae3f('0x30')][_0xae3f('0x48')](_0x4a5347[_0xae3f('0x49')],{})[_0xae3f('0x28')](respondWithResult(_0xe80a96,0xc9))[_0xae3f('0x46')](handleError(_0xe80a96,null));};exports['update']=function(_0x18a5bf,_0xc0c077){if(_0x18a5bf['body']['id']){delete _0x18a5bf['body']['id'];}return db['MailTransferReport'][_0xae3f('0x4a')]({'where':{'id':_0x18a5bf[_0xae3f('0x4b')]['id']}})[_0xae3f('0x28')](handleEntityNotFound(_0xc0c077,null))[_0xae3f('0x28')](saveUpdates(_0x18a5bf[_0xae3f('0x49')],null))[_0xae3f('0x28')](respondWithResult(_0xc0c077,null))[_0xae3f('0x46')](handleError(_0xc0c077,null));};exports[_0xae3f('0x29')]=function(_0x519898,_0x370cbf){return db[_0xae3f('0x30')]['find']({'where':{'id':_0x519898['params']['id']}})[_0xae3f('0x28')](handleEntityNotFound(_0x370cbf,null))[_0xae3f('0x28')](removeEntity(_0x370cbf,null))['catch'](handleError(_0x370cbf,null));};exports['describe']=function(_0x5715a6,_0x3f6958){return db[_0xae3f('0x30')][_0xae3f('0x4c')]()[_0xae3f('0x28')](respondWithResult(_0x3f6958,null))[_0xae3f('0x46')](handleError(_0x3f6958,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 651d87e..fd82a71 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 _0x338e=['bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x1eaec5,_0xdd486){var _0x3748ff=function(_0x40d0e9){while(--_0x40d0e9){_0x1eaec5['push'](_0x1eaec5['shift']());}};_0x3748ff(++_0xdd486);}(_0x338e,0x137));var _0xe338=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x338e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xe338('0x0'));var util=require(_0xe338('0x1'));var logger=require(_0xe338('0x2'))(_0xe338('0x3'));var moment=require('moment');var BPromise=require(_0xe338('0x4'));var rp=require(_0xe338('0x5'));var fs=require('fs');var path=require(_0xe338('0x6'));var rimraf=require(_0xe338('0x7'));var config=require(_0xe338('0x8'));var attributes=require(_0xe338('0x9'));module[_0xe338('0xa')]=function(_0x1ba631,_0x43f90c){return _0x1ba631[_0xe338('0xb')](_0xe338('0xc'),attributes,{'tableName':_0xe338('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe338('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac21=['report_mail_transfer','uniqueid','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define','MailTransferReport'];(function(_0x597e38,_0x551ac2){var _0x5305d2=function(_0x47dc5e){while(--_0x47dc5e){_0x597e38['push'](_0x597e38['shift']());}};_0x5305d2(++_0x551ac2);}(_0xac21,0x1af));var _0x1ac2=function(_0x23f562,_0x1794ba){_0x23f562=_0x23f562-0x0;var _0x17fa8f=_0xac21[_0x23f562];return _0x17fa8f;};'use strict';var _=require('lodash');var util=require(_0x1ac2('0x0'));var logger=require(_0x1ac2('0x1'))('api');var moment=require(_0x1ac2('0x2'));var BPromise=require('bluebird');var rp=require(_0x1ac2('0x3'));var fs=require('fs');var path=require(_0x1ac2('0x4'));var rimraf=require('rimraf');var config=require(_0x1ac2('0x5'));var attributes=require('./mailTransferReport.attributes');module[_0x1ac2('0x6')]=function(_0x21a183,_0x2c4cf2){return _0x21a183[_0x1ac2('0x7')](_0x1ac2('0x8'),attributes,{'tableName':_0x1ac2('0x9'),'paranoid':![],'indexes':[{'name':_0x1ac2('0xa'),'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 4995e92..084764c 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 _0xeaf5=['MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x40b46c,_0x510299){var _0x4bc1f9=function(_0x85180d){while(--_0x85180d){_0x40b46c['push'](_0x40b46c['shift']());}};_0x4bc1f9(++_0x510299);}(_0xeaf5,0x17e));var _0x5eaf=function(_0x18d5d7,_0x19074b){_0x18d5d7=_0x18d5d7-0x0;var _0x30a9ea=_0xeaf5[_0x18d5d7];return _0x30a9ea;};'use strict';var _=require(_0x5eaf('0x0'));var util=require(_0x5eaf('0x1'));var moment=require(_0x5eaf('0x2'));var BPromise=require(_0x5eaf('0x3'));var rs=require(_0x5eaf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5eaf('0x5'))['db'];var utils=require(_0x5eaf('0x6'));var logger=require(_0x5eaf('0x7'))(_0x5eaf('0x8'));var config=require(_0x5eaf('0x9'));var jayson=require(_0x5eaf('0xa'));var client=jayson[_0x5eaf('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39390a,_0xef0d9e,_0x400eba){return new BPromise(function(_0xf62d4b,_0x26ada3){return client[_0x5eaf('0xc')](_0x39390a,_0x400eba)['then'](function(_0x10c5af){logger[_0x5eaf('0xd')](_0x5eaf('0xe'),_0xef0d9e,_0x5eaf('0xf'));logger['debug'](_0x5eaf('0x10'),_0xef0d9e,'request\x20sent',JSON['stringify'](_0x10c5af));if(_0x10c5af[_0x5eaf('0x11')]){if(_0x10c5af['error'][_0x5eaf('0x12')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0xef0d9e,_0x10c5af[_0x5eaf('0x11')][_0x5eaf('0x13')]);return _0x26ada3(_0x10c5af[_0x5eaf('0x11')][_0x5eaf('0x13')]);}logger[_0x5eaf('0x11')](_0x5eaf('0xe'),_0xef0d9e,_0x10c5af['error'][_0x5eaf('0x13')]);return _0xf62d4b(_0x10c5af['error'][_0x5eaf('0x13')]);}else{logger['info'](_0x5eaf('0xe'),_0xef0d9e,_0x5eaf('0xf'));_0xf62d4b(_0x10c5af[_0x5eaf('0x14')][_0x5eaf('0x13')]);}})[_0x5eaf('0x15')](function(_0x1e8c39){logger['error'](_0x5eaf('0xe'),_0xef0d9e,_0x1e8c39);_0x26ada3(_0x1e8c39);});});} \ No newline at end of file +var _0x8a96=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','MailTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x59250f,_0x13a768){var _0x48818d=function(_0x7fcb0c){while(--_0x7fcb0c){_0x59250f['push'](_0x59250f['shift']());}};_0x48818d(++_0x13a768);}(_0x8a96,0x1ed));var _0x68a9=function(_0x2914c1,_0x41c88a){_0x2914c1=_0x2914c1-0x0;var _0x2907cf=_0x8a96[_0x2914c1];return _0x2907cf;};'use strict';var _=require(_0x68a9('0x0'));var util=require(_0x68a9('0x1'));var moment=require(_0x68a9('0x2'));var BPromise=require(_0x68a9('0x3'));var rs=require(_0x68a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68a9('0x5'))['db'];var utils=require(_0x68a9('0x6'));var logger=require(_0x68a9('0x7'))(_0x68a9('0x8'));var config=require(_0x68a9('0x9'));var jayson=require(_0x68a9('0xa'));var client=jayson[_0x68a9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x281d7d,_0x2e0f51,_0x275658){return new BPromise(function(_0x2c40e7,_0x32790a){return client[_0x68a9('0xc')](_0x281d7d,_0x275658)[_0x68a9('0xd')](function(_0x5e4064){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x2e0f51,_0x68a9('0xe'));logger[_0x68a9('0xf')](_0x68a9('0x10'),_0x2e0f51,_0x68a9('0xe'),JSON[_0x68a9('0x11')](_0x5e4064));if(_0x5e4064['error']){if(_0x5e4064['error'][_0x68a9('0x12')]===0x1f4){logger[_0x68a9('0x13')](_0x68a9('0x14'),_0x2e0f51,_0x5e4064[_0x68a9('0x13')][_0x68a9('0x15')]);return _0x32790a(_0x5e4064[_0x68a9('0x13')][_0x68a9('0x15')]);}logger['error'](_0x68a9('0x14'),_0x2e0f51,_0x5e4064[_0x68a9('0x13')][_0x68a9('0x15')]);return _0x2c40e7(_0x5e4064[_0x68a9('0x13')][_0x68a9('0x15')]);}else{logger[_0x68a9('0x16')](_0x68a9('0x14'),_0x2e0f51,_0x68a9('0xe'));_0x2c40e7(_0x5e4064[_0x68a9('0x17')][_0x68a9('0x15')]);}})[_0x68a9('0x18')](function(_0x2ec827){logger[_0x68a9('0x13')](_0x68a9('0x14'),_0x2e0f51,_0x2ec827);_0x32790a(_0x2ec827);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 00feb48..f4204d3 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 _0x01ef=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x98e069,_0x164a7d){var _0x3a4f28=function(_0x16a15a){while(--_0x16a15a){_0x98e069['push'](_0x98e069['shift']());}};_0x3a4f28(++_0x164a7d);}(_0x01ef,0x18a));var _0xf01e=function(_0x19bdf5,_0x3a6395){_0x19bdf5=_0x19bdf5-0x0;var _0x140930=_0x01ef[_0x19bdf5];return _0x140930;};'use strict';var multer=require(_0xf01e('0x0'));var util=require(_0xf01e('0x1'));var path=require('path');var timeout=require(_0xf01e('0x2'));var express=require('express');var router=express[_0xf01e('0x3')]();var fs_extra=require(_0xf01e('0x4'));var auth=require(_0xf01e('0x5'));var interaction=require(_0xf01e('0x6'));var config=require(_0xf01e('0x7'));var controller=require('./memberReport.controller');router[_0xf01e('0x8')]('/',auth['isAuthenticated'](),controller[_0xf01e('0x9')]);router[_0xf01e('0x8')]('/describe',auth[_0xf01e('0xa')](),controller['describe']);router[_0xf01e('0x8')](_0xf01e('0xb'),auth[_0xf01e('0xa')](),controller[_0xf01e('0xc')]);router['post']('/',auth[_0xf01e('0xa')](),controller[_0xf01e('0xd')]);router[_0xf01e('0xe')]('/:id',auth[_0xf01e('0xa')](),controller[_0xf01e('0xf')]);router[_0xf01e('0x10')]('/:id',auth[_0xf01e('0xa')](),controller[_0xf01e('0x11')]);module[_0xf01e('0x12')]=router; \ No newline at end of file +var _0x2aef=['create','put','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1ed0a6,_0x29610e){var _0x522dba=function(_0xb5679d){while(--_0xb5679d){_0x1ed0a6['push'](_0x1ed0a6['shift']());}};_0x522dba(++_0x29610e);}(_0x2aef,0x195));var _0xf2ae=function(_0x1e06b3,_0x34dc88){_0x1e06b3=_0x1e06b3-0x0;var _0x105b30=_0x2aef[_0x1e06b3];return _0x105b30;};'use strict';var multer=require(_0xf2ae('0x0'));var util=require('util');var path=require(_0xf2ae('0x1'));var timeout=require(_0xf2ae('0x2'));var express=require(_0xf2ae('0x3'));var router=express['Router']();var fs_extra=require(_0xf2ae('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf2ae('0x5'));var config=require('../../config/environment');var controller=require(_0xf2ae('0x6'));router[_0xf2ae('0x7')]('/',auth[_0xf2ae('0x8')](),controller[_0xf2ae('0x9')]);router[_0xf2ae('0x7')](_0xf2ae('0xa'),auth['isAuthenticated'](),controller[_0xf2ae('0xb')]);router[_0xf2ae('0x7')](_0xf2ae('0xc'),auth['isAuthenticated'](),controller[_0xf2ae('0xd')]);router[_0xf2ae('0xe')]('/',auth[_0xf2ae('0x8')](),controller[_0xf2ae('0xf')]);router[_0xf2ae('0x10')](_0xf2ae('0xc'),auth[_0xf2ae('0x8')](),controller[_0xf2ae('0x11')]);router['delete'](_0xf2ae('0xc'),auth[_0xf2ae('0x8')](),controller[_0xf2ae('0x12')]);module[_0xf2ae('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 0e8b538..be17862 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 _0x6a98=['exitAt','setDataValue','talk:[start]','talk:[destination]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds'];(function(_0x1324c2,_0x3e8b67){var _0x5e3869=function(_0x1e8015){while(--_0x1e8015){_0x1324c2['push'](_0x1324c2['shift']());}};_0x5e3869(++_0x3e8b67);}(_0x6a98,0x115));var _0x86a9=function(_0x488163,_0x51204f){_0x488163=_0x488163-0x0;var _0x1ba13b=_0x6a98[_0x488163];return _0x1ba13b;};'use strict';var Sequelize=require(_0x86a9('0x0'));var moment=require(_0x86a9('0x1'));module[_0x86a9('0x2')]={'channel':{'type':Sequelize[_0x86a9('0x3')]},'membername':{'type':Sequelize[_0x86a9('0x3')]},'interface':{'type':Sequelize[_0x86a9('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x86a9('0x4'),'comment':_0x86a9('0x5')},'duration':{'type':Sequelize[_0x86a9('0x6')]},'enterAt':{'type':Sequelize[_0x86a9('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x1bdba1){var _0x12df98=moment(_0x1bdba1);var _0x46302b=moment(this[_0x86a9('0x8')]('enterAt'));var _0x33ea09=_0x12df98[_0x86a9('0x9')](_0x46302b,_0x86a9('0xa'));this['setDataValue'](_0x86a9('0xb'),_0x1bdba1);this[_0x86a9('0xc')]('duration',_0x33ea09>=0x0?_0x33ea09:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0x86a9('0xd')},'data3':{'type':Sequelize[_0x86a9('0x3')],'comment':_0x86a9('0xe')},'data4':{'type':Sequelize[_0x86a9('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x86a9('0x3')],'comment':_0x86a9('0xf')},'role':{'type':Sequelize[_0x86a9('0x3')]},'internal':{'type':Sequelize[_0x86a9('0x6')]},'uniqueid':{'type':Sequelize[_0x86a9('0x3')]}}; \ No newline at end of file +var _0x3247=['INTEGER','DATE','getDataValue','enterAt','diff','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x5e4599,_0xb4d97a){var _0x481042=function(_0x16ee1c){while(--_0x16ee1c){_0x5e4599['push'](_0x5e4599['shift']());}};_0x481042(++_0xb4d97a);}(_0x3247,0x1dc));var _0x7324=function(_0x418170,_0x2eba26){_0x418170=_0x418170-0x0;var _0x2ec637=_0x3247[_0x418170];return _0x2ec637;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7324('0x0'));module['exports']={'channel':{'type':Sequelize[_0x7324('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7324('0x1')],'defaultValue':_0x7324('0x2'),'comment':_0x7324('0x3')},'duration':{'type':Sequelize[_0x7324('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7324('0x5')],'set':function(_0x179fb7){var _0x26c2a9=moment(_0x179fb7);var _0x378e69=moment(this[_0x7324('0x6')](_0x7324('0x7')));var _0x1d3ec9=_0x26c2a9[_0x7324('0x8')](_0x378e69,'seconds');this[_0x7324('0x9')]('exitAt',_0x179fb7);this[_0x7324('0x9')](_0x7324('0xa'),_0x1d3ec9>=0x0?_0x1d3ec9:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x7324('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0x7324('0xc')},'data3':{'type':Sequelize['STRING'],'comment':_0x7324('0xd')},'data4':{'type':Sequelize[_0x7324('0x1')],'comment':_0x7324('0xe')},'data5':{'type':Sequelize[_0x7324('0x1')],'comment':_0x7324('0xf')},'role':{'type':Sequelize[_0x7324('0x1')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x7324('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index ef32eba..7dc75fc 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 _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x2ecc74,_0xb640f1){var _0xdb59d2=function(_0x4e1f09){while(--_0x4e1f09){_0x2ecc74['push'](_0x2ecc74['shift']());}};_0xdb59d2(++_0xb640f1);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x55ca,0x126));var _0xa55c=function(_0x594867,_0x2ee5d3){_0x594867=_0x594867-0x0;var _0x9ac5b1=_0x55ca[_0x594867];return _0x9ac5b1;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 15709ef..ec02c72 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 _0x993f=['../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x488064,_0x308f2c){var _0x34630b=function(_0x4ba8a2){while(--_0x4ba8a2){_0x488064['push'](_0x488064['shift']());}};_0x34630b(++_0x308f2c);}(_0x993f,0x129));var _0xf993=function(_0x4a048a,_0x4de409){_0x4a048a=_0x4a048a-0x0;var _0x19f366=_0x993f[_0x4a048a];return _0x19f366;};'use strict';var _=require(_0xf993('0x0'));var util=require(_0xf993('0x1'));var logger=require(_0xf993('0x2'))(_0xf993('0x3'));var moment=require('moment');var BPromise=require(_0xf993('0x4'));var rp=require(_0xf993('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf993('0x6'));var config=require(_0xf993('0x7'));var attributes=require(_0xf993('0x8'));module[_0xf993('0x9')]=function(_0x14b05b,_0x4429eb){return _0x14b05b[_0xf993('0xa')](_0xf993('0xb'),attributes,{'tableName':_0xf993('0xc'),'paranoid':![],'indexes':[{'name':_0xf993('0xd'),'fields':[_0xf993('0xe'),_0xf993('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb934=['exports','define','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2cdfb8,_0x19ab27){var _0x598ad5=function(_0x571078){while(--_0x571078){_0x2cdfb8['push'](_0x2cdfb8['shift']());}};_0x598ad5(++_0x19ab27);}(_0xb934,0x92));var _0x4b93=function(_0x4add21,_0x5cd6d0){_0x4add21=_0x4add21-0x0;var _0x12d4f8=_0xb934[_0x4add21];return _0x12d4f8;};'use strict';var _=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var logger=require(_0x4b93('0x2'))('api');var moment=require(_0x4b93('0x3'));var BPromise=require(_0x4b93('0x4'));var rp=require(_0x4b93('0x5'));var fs=require('fs');var path=require(_0x4b93('0x6'));var rimraf=require(_0x4b93('0x7'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0x4b93('0x8')]=function(_0x1fa8af,_0x2ea5ad){return _0x1fa8af[_0x4b93('0x9')]('MemberReport',attributes,{'tableName':_0x4b93('0xa'),'paranoid':![],'indexes':[{'name':_0x4b93('0xb'),'fields':[_0x4b93('0xc'),_0x4b93('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 789644a..ab6d54f 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 _0xdcfa=['map','model','stringify','CreateMemberReport','create','body','debug','UpdateMemberReport','update','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xdcfa,0xad));var _0xadcf=function(_0x483a68,_0x2acc85){_0x483a68=_0x483a68-0x0;var _0x5d8176=_0xdcfa[_0x483a68];return _0x5d8176;};'use strict';var _=require(_0xadcf('0x0'));var util=require('util');var moment=require(_0xadcf('0x1'));var BPromise=require('bluebird');var rs=require(_0xadcf('0x2'));var fs=require('fs');var Redis=require(_0xadcf('0x3'));var db=require(_0xadcf('0x4'))['db'];var utils=require(_0xadcf('0x5'));var logger=require(_0xadcf('0x6'))(_0xadcf('0x7'));var config=require(_0xadcf('0x8'));var jayson=require(_0xadcf('0x9'));var client=jayson[_0xadcf('0xa')][_0xadcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x182f1c,_0x381b4c,_0x5a98ab){return new BPromise(function(_0x41cdbf,_0x5db108){return client[_0xadcf('0xc')](_0x182f1c,_0x5a98ab)[_0xadcf('0xd')](function(_0x58be29){logger[_0xadcf('0xe')]('MemberReport,\x20%s,\x20%s',_0x381b4c,_0xadcf('0xf'));logger['debug'](_0xadcf('0x10'),_0x381b4c,_0xadcf('0xf'),JSON['stringify'](_0x58be29));if(_0x58be29[_0xadcf('0x11')]){if(_0x58be29[_0xadcf('0x11')][_0xadcf('0x12')]===0x1f4){logger[_0xadcf('0x11')](_0xadcf('0x13'),_0x381b4c,_0x58be29[_0xadcf('0x11')]['message']);return _0x5db108(_0x58be29[_0xadcf('0x11')][_0xadcf('0x14')]);}logger[_0xadcf('0x11')](_0xadcf('0x13'),_0x381b4c,_0x58be29[_0xadcf('0x11')]['message']);return _0x41cdbf(_0x58be29[_0xadcf('0x11')][_0xadcf('0x14')]);}else{logger['info'](_0xadcf('0x13'),_0x381b4c,_0xadcf('0xf'));_0x41cdbf(_0x58be29[_0xadcf('0x15')][_0xadcf('0x14')]);}})[_0xadcf('0x16')](function(_0x4d9333){logger[_0xadcf('0x11')]('MemberReport,\x20%s,\x20%s',_0x381b4c,_0x4d9333);_0x5db108(_0x4d9333);});});}exports[_0xadcf('0x17')]=function(_0x1bf6fc){var _0x577885=this;return new Promise(function(_0x22aeb0,_0x576bf0){return db[_0xadcf('0x18')][_0xadcf('0x19')]({'raw':_0x1bf6fc[_0xadcf('0x1a')]?_0x1bf6fc[_0xadcf('0x1a')][_0xadcf('0x1b')]===undefined?!![]:![]:!![],'where':_0x1bf6fc['options']?_0x1bf6fc[_0xadcf('0x1a')][_0xadcf('0x1c')]||null:null,'attributes':_0x1bf6fc[_0xadcf('0x1a')]?_0x1bf6fc[_0xadcf('0x1a')][_0xadcf('0x1d')]||null:null,'limit':_0x1bf6fc[_0xadcf('0x1a')]?_0x1bf6fc[_0xadcf('0x1a')][_0xadcf('0x1e')]||null:null,'include':_0x1bf6fc[_0xadcf('0x1a')]?_0x1bf6fc['options'][_0xadcf('0x1f')]?_[_0xadcf('0x20')](_0x1bf6fc[_0xadcf('0x1a')]['include'],function(_0x407e5f){return{'model':db[_0x407e5f[_0xadcf('0x21')]],'as':_0x407e5f['as'],'attributes':_0x407e5f[_0xadcf('0x1d')],'include':_0x407e5f[_0xadcf('0x1f')]?_['map'](_0x407e5f[_0xadcf('0x1f')],function(_0x455dd7){return{'model':db[_0x455dd7[_0xadcf('0x21')]],'as':_0x455dd7['as'],'attributes':_0x455dd7[_0xadcf('0x1d')],'include':_0x455dd7['include']?_['map'](_0x455dd7[_0xadcf('0x1f')],function(_0x46c210){return{'model':db[_0x46c210['model']],'as':_0x46c210['as'],'attributes':_0x46c210[_0xadcf('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xadcf('0xd')](function(_0x52936f){logger[_0xadcf('0xe')]('GetMemberReport',_0x1bf6fc);logger['debug']('GetMemberReport',_0x1bf6fc,JSON[_0xadcf('0x22')](_0x52936f));_0x22aeb0(_0x52936f);})['catch'](function(_0x159787){logger[_0xadcf('0x11')]('GetMemberReport',_0x159787[_0xadcf('0x14')],_0x1bf6fc);_0x576bf0(_0x577885[_0xadcf('0x11')](0x1f4,_0x159787[_0xadcf('0x14')]));});});};exports[_0xadcf('0x23')]=function(_0xf50eaa){var _0x4c31bd=this;return new Promise(function(_0x26864f,_0x33be18){return db[_0xadcf('0x18')][_0xadcf('0x24')](_0xf50eaa[_0xadcf('0x25')],{'raw':_0xf50eaa[_0xadcf('0x1a')]?_0xf50eaa['options'][_0xadcf('0x1b')]===undefined?!![]:![]:!![]})[_0xadcf('0xd')](function(_0x527514){logger[_0xadcf('0xe')](_0xadcf('0x23'),_0xf50eaa);logger[_0xadcf('0x26')](_0xadcf('0x23'),_0xf50eaa,JSON[_0xadcf('0x22')](_0x527514));_0x26864f(_0x527514);})[_0xadcf('0x16')](function(_0x4474cd){logger[_0xadcf('0x11')](_0xadcf('0x23'),_0x4474cd['message'],_0xf50eaa);_0x33be18(_0x4c31bd[_0xadcf('0x11')](0x1f4,_0x4474cd[_0xadcf('0x14')]));});});};exports[_0xadcf('0x27')]=function(_0x1bcab4){var _0x57a2c9=this;return new Promise(function(_0xcd066b,_0x3f642c){return db[_0xadcf('0x18')][_0xadcf('0x28')](_0x1bcab4['body'],{'raw':_0x1bcab4[_0xadcf('0x1a')]?_0x1bcab4[_0xadcf('0x1a')][_0xadcf('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bcab4[_0xadcf('0x1a')]?_0x1bcab4['options'][_0xadcf('0x1c')]||null:null,'attributes':_0x1bcab4[_0xadcf('0x1a')]?_0x1bcab4[_0xadcf('0x1a')][_0xadcf('0x1d')]||null:null,'limit':_0x1bcab4[_0xadcf('0x1a')]?_0x1bcab4[_0xadcf('0x1a')][_0xadcf('0x1e')]||null:null})[_0xadcf('0xd')](function(_0x3a48d6){logger[_0xadcf('0xe')](_0xadcf('0x27'),_0x1bcab4);logger['debug'](_0xadcf('0x27'),_0x1bcab4,JSON[_0xadcf('0x22')](_0x3a48d6));_0xcd066b(_0x3a48d6);})[_0xadcf('0x16')](function(_0x16a0f5){logger[_0xadcf('0x11')](_0xadcf('0x27'),_0x16a0f5[_0xadcf('0x14')],_0x1bcab4);_0x3f642c(_0x57a2c9['error'](0x1f4,_0x16a0f5['message']));});});}; \ No newline at end of file +var _0xef17=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','message','result','MemberReport','options','attributes','limit','map','include','model','GetMemberReport','stringify','create','CreateMemberReport','UpdateMemberReport','body','raw','where','lodash','util','moment','bluebird','randomstring'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xef17,0x136));var _0x7ef1=function(_0x5ab6f4,_0x3736b1){_0x5ab6f4=_0x5ab6f4-0x0;var _0x559752=_0xef17[_0x5ab6f4];return _0x559752;};'use strict';var _=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var moment=require(_0x7ef1('0x2'));var BPromise=require(_0x7ef1('0x3'));var rs=require(_0x7ef1('0x4'));var fs=require('fs');var Redis=require(_0x7ef1('0x5'));var db=require(_0x7ef1('0x6'))['db'];var utils=require(_0x7ef1('0x7'));var logger=require(_0x7ef1('0x8'))('rpc');var config=require(_0x7ef1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7ef1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34a040,_0x4ba2f0,_0x5aec63){return new BPromise(function(_0x10c896,_0x3398a6){return client['request'](_0x34a040,_0x5aec63)[_0x7ef1('0xb')](function(_0x1d5b33){logger[_0x7ef1('0xc')](_0x7ef1('0xd'),_0x4ba2f0,_0x7ef1('0xe'));logger[_0x7ef1('0xf')](_0x7ef1('0x10'),_0x4ba2f0,'request\x20sent',JSON['stringify'](_0x1d5b33));if(_0x1d5b33[_0x7ef1('0x11')]){if(_0x1d5b33['error']['code']===0x1f4){logger['error'](_0x7ef1('0xd'),_0x4ba2f0,_0x1d5b33['error'][_0x7ef1('0x12')]);return _0x3398a6(_0x1d5b33[_0x7ef1('0x11')][_0x7ef1('0x12')]);}logger[_0x7ef1('0x11')](_0x7ef1('0xd'),_0x4ba2f0,_0x1d5b33[_0x7ef1('0x11')][_0x7ef1('0x12')]);return _0x10c896(_0x1d5b33[_0x7ef1('0x11')]['message']);}else{logger['info'](_0x7ef1('0xd'),_0x4ba2f0,'request\x20sent');_0x10c896(_0x1d5b33[_0x7ef1('0x13')][_0x7ef1('0x12')]);}})['catch'](function(_0x4e26d1){logger['error'](_0x7ef1('0xd'),_0x4ba2f0,_0x4e26d1);_0x3398a6(_0x4e26d1);});});}exports['GetMemberReport']=function(_0x3a5835){var _0x5c6333=this;return new Promise(function(_0x5a7b2b,_0x5b7e36){return db[_0x7ef1('0x14')]['findAll']({'raw':_0x3a5835[_0x7ef1('0x15')]?_0x3a5835[_0x7ef1('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3a5835['options']?_0x3a5835[_0x7ef1('0x15')]['where']||null:null,'attributes':_0x3a5835[_0x7ef1('0x15')]?_0x3a5835[_0x7ef1('0x15')][_0x7ef1('0x16')]||null:null,'limit':_0x3a5835[_0x7ef1('0x15')]?_0x3a5835[_0x7ef1('0x15')][_0x7ef1('0x17')]||null:null,'include':_0x3a5835[_0x7ef1('0x15')]?_0x3a5835[_0x7ef1('0x15')]['include']?_[_0x7ef1('0x18')](_0x3a5835[_0x7ef1('0x15')][_0x7ef1('0x19')],function(_0x3324d4){return{'model':db[_0x3324d4[_0x7ef1('0x1a')]],'as':_0x3324d4['as'],'attributes':_0x3324d4[_0x7ef1('0x16')],'include':_0x3324d4[_0x7ef1('0x19')]?_[_0x7ef1('0x18')](_0x3324d4['include'],function(_0x4b1ace){return{'model':db[_0x4b1ace[_0x7ef1('0x1a')]],'as':_0x4b1ace['as'],'attributes':_0x4b1ace[_0x7ef1('0x16')],'include':_0x4b1ace[_0x7ef1('0x19')]?_[_0x7ef1('0x18')](_0x4b1ace[_0x7ef1('0x19')],function(_0x4cfa16){return{'model':db[_0x4cfa16[_0x7ef1('0x1a')]],'as':_0x4cfa16['as'],'attributes':_0x4cfa16[_0x7ef1('0x16')]};}):[]};}):[]};}):[]:[]})[_0x7ef1('0xb')](function(_0x4af5f5){logger[_0x7ef1('0xc')](_0x7ef1('0x1b'),_0x3a5835);logger[_0x7ef1('0xf')]('GetMemberReport',_0x3a5835,JSON[_0x7ef1('0x1c')](_0x4af5f5));_0x5a7b2b(_0x4af5f5);})['catch'](function(_0x3306b0){logger[_0x7ef1('0x11')]('GetMemberReport',_0x3306b0['message'],_0x3a5835);_0x5b7e36(_0x5c6333[_0x7ef1('0x11')](0x1f4,_0x3306b0[_0x7ef1('0x12')]));});});};exports['CreateMemberReport']=function(_0xbf918d){var _0x56fe40=this;return new Promise(function(_0x3aa113,_0x47d6eb){return db[_0x7ef1('0x14')][_0x7ef1('0x1d')](_0xbf918d['body'],{'raw':_0xbf918d['options']?_0xbf918d['options']['raw']===undefined?!![]:![]:!![]})[_0x7ef1('0xb')](function(_0x36b83f){logger['info'](_0x7ef1('0x1e'),_0xbf918d);logger['debug']('CreateMemberReport',_0xbf918d,JSON[_0x7ef1('0x1c')](_0x36b83f));_0x3aa113(_0x36b83f);})['catch'](function(_0xa0d198){logger[_0x7ef1('0x11')](_0x7ef1('0x1e'),_0xa0d198[_0x7ef1('0x12')],_0xbf918d);_0x47d6eb(_0x56fe40['error'](0x1f4,_0xa0d198[_0x7ef1('0x12')]));});});};exports[_0x7ef1('0x1f')]=function(_0x525915){var _0x52cf62=this;return new Promise(function(_0x4b8e6f,_0x507053){return db[_0x7ef1('0x14')]['update'](_0x525915[_0x7ef1('0x20')],{'raw':_0x525915[_0x7ef1('0x15')]?_0x525915[_0x7ef1('0x15')][_0x7ef1('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x525915[_0x7ef1('0x15')]?_0x525915[_0x7ef1('0x15')][_0x7ef1('0x22')]||null:null,'attributes':_0x525915[_0x7ef1('0x15')]?_0x525915[_0x7ef1('0x15')][_0x7ef1('0x16')]||null:null,'limit':_0x525915[_0x7ef1('0x15')]?_0x525915['options'][_0x7ef1('0x17')]||null:null})[_0x7ef1('0xb')](function(_0x59dcce){logger[_0x7ef1('0xc')](_0x7ef1('0x1f'),_0x525915);logger[_0x7ef1('0xf')](_0x7ef1('0x1f'),_0x525915,JSON[_0x7ef1('0x1c')](_0x59dcce));_0x4b8e6f(_0x59dcce);})['catch'](function(_0xd89a7c){logger[_0x7ef1('0x11')](_0x7ef1('0x1f'),_0xd89a7c[_0x7ef1('0x12')],_0x525915);_0x507053(_0x52cf62[_0x7ef1('0x11')](0x1f4,_0xd89a7c[_0x7ef1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index f51e4d5..f0e357e 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 _0xe2dc=['get','index','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x16812e,_0x121d50){var _0x59c5ff=function(_0x349e75){while(--_0x349e75){_0x16812e['push'](_0x16812e['shift']());}};_0x59c5ff(++_0x121d50);}(_0xe2dc,0x1c6));var _0xce2d=function(_0x33f108,_0x4a9208){_0x33f108=_0x33f108-0x0;var _0x3bf98e=_0xe2dc[_0x33f108];return _0x3bf98e;};'use strict';var multer=require(_0xce2d('0x0'));var util=require(_0xce2d('0x1'));var path=require(_0xce2d('0x2'));var timeout=require(_0xce2d('0x3'));var express=require(_0xce2d('0x4'));var router=express['Router']();var fs_extra=require(_0xce2d('0x5'));var auth=require(_0xce2d('0x6'));var interaction=require(_0xce2d('0x7'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0xce2d('0x8')]('/',controller[_0xce2d('0x9')]);module[_0xce2d('0xa')]=router; \ No newline at end of file +var _0x91f6=['../../config/environment','./migration.controller','get','exports','path','express','fs-extra','../../components/interaction/service'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x91f6,0x7c));var _0x691f=function(_0x46ae45,_0x3a54fc){_0x46ae45=_0x46ae45-0x0;var _0x536779=_0x91f6[_0x46ae45];return _0x536779;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x691f('0x0'));var timeout=require('connect-timeout');var express=require(_0x691f('0x1'));var router=express['Router']();var fs_extra=require(_0x691f('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x691f('0x3'));var config=require(_0x691f('0x4'));var controller=require(_0x691f('0x5'));router[_0x691f('0x6')]('/',controller['index']);module[_0x691f('0x7')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 7df4746..220d31f 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 _0x3dc3=['exports','STRING','version'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x3dc3,0xde));var _0x33dc=function(_0x24914f,_0x5b68ef){_0x24914f=_0x24914f-0x0;var _0x79156a=_0x3dc3[_0x24914f];return _0x79156a;};'use strict';var Sequelize=require('sequelize');module[_0x33dc('0x0')]={'version':{'type':Sequelize[_0x33dc('0x1')],'unique':_0x33dc('0x2')}}; \ No newline at end of file +var _0x6aa5=['exports','STRING','version','sequelize'];(function(_0x59d6e7,_0x1c99b7){var _0x5a4555=function(_0x55d0bc){while(--_0x55d0bc){_0x59d6e7['push'](_0x59d6e7['shift']());}};_0x5a4555(++_0x1c99b7);}(_0x6aa5,0x1d3));var _0x56aa=function(_0x571d83,_0x4cb677){_0x571d83=_0x571d83-0x0;var _0x36e67f=_0x6aa5[_0x571d83];return _0x36e67f;};'use strict';var Sequelize=require(_0x56aa('0x0'));module[_0x56aa('0x1')]={'version':{'type':Sequelize[_0x56aa('0x2')],'unique':_0x56aa('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index d9a4868..6ede32d 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 _0x8ae5=['fieldName','type','key','keys','query','filters','intersection','attributes','model','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','stack','name','send','index','map','Migration','rawAttributes'];(function(_0x142da9,_0x2cbe0b){var _0x529112=function(_0x52bee5){while(--_0x52bee5){_0x142da9['push'](_0x142da9['shift']());}};_0x529112(++_0x2cbe0b);}(_0x8ae5,0xab));var _0x58ae=function(_0x490ec4,_0x4972f3){_0x490ec4=_0x490ec4-0x0;var _0x4dc6fb=_0x8ae5[_0x490ec4];return _0x4dc6fb;};'use strict';var emlformat=require(_0x58ae('0x0'));var rimraf=require(_0x58ae('0x1'));var zipdir=require(_0x58ae('0x2'));var jsonpatch=require(_0x58ae('0x3'));var rp=require(_0x58ae('0x4'));var moment=require(_0x58ae('0x5'));var BPromise=require(_0x58ae('0x6'));var Mustache=require(_0x58ae('0x7'));var util=require(_0x58ae('0x8'));var path=require(_0x58ae('0x9'));var sox=require(_0x58ae('0xa'));var csv=require(_0x58ae('0xb'));var ejs=require(_0x58ae('0xc'));var fs=require('fs');var fs_extra=require(_0x58ae('0xd'));var _=require(_0x58ae('0xe'));var squel=require(_0x58ae('0xf'));var crypto=require(_0x58ae('0x10'));var jsforce=require(_0x58ae('0x11'));var deskjs=require(_0x58ae('0x12'));var toCsv=require('to-csv');var querystring=require(_0x58ae('0x13'));var Papa=require(_0x58ae('0x14'));var Redis=require(_0x58ae('0x15'));var authService=require(_0x58ae('0x16'));var qs=require(_0x58ae('0x17'));var as=require(_0x58ae('0x18'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x58ae('0x19'));var utils=require(_0x58ae('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x58ae('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaaece9,_0x5980e2){_0x5980e2=_0x5980e2||0xcc;return function(_0x4551b8){if(_0x4551b8){return _0xaaece9[_0x58ae('0x1c')](_0x5980e2);}return _0xaaece9[_0x58ae('0x1d')](_0x5980e2)[_0x58ae('0x1e')]();};}function respondWithResult(_0x2a07a0,_0x25e1fe){_0x25e1fe=_0x25e1fe||0xc8;return function(_0x201f6f){if(_0x201f6f){return _0x2a07a0['status'](_0x25e1fe)['json'](_0x201f6f);}};}function respondWithFilteredResult(_0x244e89,_0x34f4c6){return function(_0x43eb16){if(_0x43eb16){var _0x341d9a=typeof _0x34f4c6[_0x58ae('0x1f')]===_0x58ae('0x20')&&typeof _0x34f4c6['limit']==='undefined';var _0xfed6b2=_0x43eb16[_0x58ae('0x21')];var _0x330d14=_0x341d9a?0x0:_0x34f4c6[_0x58ae('0x1f')];var _0x517f14=_0x341d9a?_0x43eb16['count']:_0x34f4c6[_0x58ae('0x1f')]+_0x34f4c6['limit'];var _0x2a29bb;if(_0x517f14>=_0xfed6b2){_0x517f14=_0xfed6b2;_0x2a29bb=0xc8;}else{_0x2a29bb=0xce;}_0x244e89[_0x58ae('0x1d')](_0x2a29bb);return _0x244e89[_0x58ae('0x22')](_0x58ae('0x23'),_0x330d14+'-'+_0x517f14+'/'+_0xfed6b2)[_0x58ae('0x24')](_0x43eb16);}return null;};}function patchUpdates(_0x2f8cc0){return function(_0x2d2f70){try{jsonpatch[_0x58ae('0x25')](_0x2d2f70,_0x2f8cc0,!![]);}catch(_0x25f08b){return BPromise[_0x58ae('0x26')](_0x25f08b);}return _0x2d2f70['save']();};}function saveUpdates(_0x84307e,_0x23585b){return function(_0x175bb7){if(_0x175bb7){return _0x175bb7[_0x58ae('0x27')](_0x84307e)[_0x58ae('0x28')](function(_0x407088){return _0x407088;});}return null;};}function removeEntity(_0x362598,_0x422495){return function(_0x364a2c){if(_0x364a2c){return _0x364a2c['destroy']()['then'](function(){_0x362598[_0x58ae('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14e968,_0x2626df){return function(_0x1ee9d8){if(!_0x1ee9d8){_0x14e968[_0x58ae('0x1c')](0x194);}return _0x1ee9d8;};}function handleError(_0x2441c2,_0x4cb5f0){_0x4cb5f0=_0x4cb5f0||0x1f4;return function(_0x107d2e){logger['error'](_0x107d2e[_0x58ae('0x29')]);if(_0x107d2e[_0x58ae('0x2a')]){delete _0x107d2e['name'];}_0x2441c2[_0x58ae('0x1d')](_0x4cb5f0)[_0x58ae('0x2b')](_0x107d2e);};}exports[_0x58ae('0x2c')]=function(_0x35858c,_0x261098){var _0x1a73ce={},_0x1e7ff0={},_0x3eab21={'count':0x0,'rows':[]};var _0x409901=_[_0x58ae('0x2d')](db[_0x58ae('0x2e')][_0x58ae('0x2f')],function(_0xd3bfab){return{'name':_0xd3bfab[_0x58ae('0x30')],'type':_0xd3bfab[_0x58ae('0x31')][_0x58ae('0x32')]};});_0x1e7ff0['model']=_[_0x58ae('0x2d')](_0x409901,'name');_0x1e7ff0['query']=_[_0x58ae('0x33')](_0x35858c[_0x58ae('0x34')]);_0x1e7ff0[_0x58ae('0x35')]=_[_0x58ae('0x36')](_0x1e7ff0['model'],_0x1e7ff0[_0x58ae('0x34')]);_0x1a73ce[_0x58ae('0x37')]=_['intersection'](_0x1e7ff0[_0x58ae('0x38')],qs['fields'](_0x35858c['query']['fields']));_0x1a73ce['attributes']=_0x1a73ce['attributes'][_0x58ae('0x39')]?_0x1a73ce[_0x58ae('0x37')]:_0x1e7ff0[_0x58ae('0x38')];if(!_0x35858c[_0x58ae('0x34')]['hasOwnProperty'](_0x58ae('0x3a'))){_0x1a73ce[_0x58ae('0x3b')]=qs[_0x58ae('0x3b')](_0x35858c[_0x58ae('0x34')]['limit']);_0x1a73ce[_0x58ae('0x1f')]=qs[_0x58ae('0x1f')](_0x35858c[_0x58ae('0x34')][_0x58ae('0x1f')]);}_0x1a73ce[_0x58ae('0x3c')]=qs[_0x58ae('0x3d')](_0x35858c[_0x58ae('0x34')][_0x58ae('0x3d')]);_0x1a73ce[_0x58ae('0x3e')]=qs[_0x58ae('0x35')](_[_0x58ae('0x3f')](_0x35858c[_0x58ae('0x34')],_0x1e7ff0[_0x58ae('0x35')]),_0x409901);if(_0x35858c[_0x58ae('0x34')][_0x58ae('0x40')]){_0x1a73ce[_0x58ae('0x3e')]=_[_0x58ae('0x41')](_0x1a73ce['where'],{'$or':_[_0x58ae('0x2d')](_0x409901,function(_0x567252){if(_0x567252[_0x58ae('0x31')]!==_0x58ae('0x42')){var _0x1b6d54={};_0x1b6d54[_0x567252['name']]={'$like':'%'+_0x35858c[_0x58ae('0x34')][_0x58ae('0x40')]+'%'};return _0x1b6d54;}})});}_0x1a73ce=_['merge']({},_0x1a73ce,_0x35858c[_0x58ae('0x43')]);var _0x45efc6={'where':_0x1a73ce['where']};return db[_0x58ae('0x2e')][_0x58ae('0x21')](_0x45efc6)[_0x58ae('0x28')](function(_0x499d56){_0x3eab21[_0x58ae('0x21')]=_0x499d56;if(_0x35858c[_0x58ae('0x34')][_0x58ae('0x44')]){_0x1a73ce[_0x58ae('0x45')]=[{'all':!![]}];}return db[_0x58ae('0x2e')][_0x58ae('0x46')](_0x1a73ce);})['then'](function(_0x1191c7){_0x3eab21[_0x58ae('0x47')]=_0x1191c7;return _0x3eab21;})[_0x58ae('0x28')](respondWithFilteredResult(_0x261098,_0x1a73ce))[_0x58ae('0x48')](handleError(_0x261098,null));}; \ No newline at end of file +var _0xcea7=['request-promise','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','sendStatus','error','stack','name','send','index','Migration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','merge','where','map','VIRTUAL','filter','options','includeAll','include','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcea7,0x13c));var _0x7cea=function(_0x44f81e,_0x2f7c6f){_0x44f81e=_0x44f81e-0x0;var _0x126bcb=_0xcea7[_0x44f81e];return _0x126bcb;};'use strict';var emlformat=require(_0x7cea('0x0'));var rimraf=require(_0x7cea('0x1'));var zipdir=require(_0x7cea('0x2'));var jsonpatch=require(_0x7cea('0x3'));var rp=require(_0x7cea('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7cea('0x5'));var util=require(_0x7cea('0x6'));var path=require(_0x7cea('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7cea('0x8'));var fs=require('fs');var fs_extra=require(_0x7cea('0x9'));var _=require('lodash');var squel=require(_0x7cea('0xa'));var crypto=require('crypto');var jsforce=require(_0x7cea('0xb'));var deskjs=require(_0x7cea('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7cea('0xd'));var Redis=require(_0x7cea('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7cea('0xf'));var as=require(_0x7cea('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7cea('0x11'));var utils=require(_0x7cea('0x12'));var config=require(_0x7cea('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7cea('0x14'))['db'];function respondWithStatusCode(_0xb302bb,_0x3159c1){_0x3159c1=_0x3159c1||0xcc;return function(_0xc76e07){if(_0xc76e07){return _0xb302bb['sendStatus'](_0x3159c1);}return _0xb302bb[_0x7cea('0x15')](_0x3159c1)[_0x7cea('0x16')]();};}function respondWithResult(_0x17ac62,_0x13367a){_0x13367a=_0x13367a||0xc8;return function(_0x2268a3){if(_0x2268a3){return _0x17ac62[_0x7cea('0x15')](_0x13367a)[_0x7cea('0x17')](_0x2268a3);}};}function respondWithFilteredResult(_0x5f5954,_0x13cebb){return function(_0x5bc7f6){if(_0x5bc7f6){var _0x18abd2=typeof _0x13cebb['offset']===_0x7cea('0x18')&&typeof _0x13cebb[_0x7cea('0x19')]===_0x7cea('0x18');var _0x30c3a4=_0x5bc7f6[_0x7cea('0x1a')];var _0x3ec52b=_0x18abd2?0x0:_0x13cebb[_0x7cea('0x1b')];var _0x2b183e=_0x18abd2?_0x5bc7f6[_0x7cea('0x1a')]:_0x13cebb['offset']+_0x13cebb[_0x7cea('0x19')];var _0x20a011;if(_0x2b183e>=_0x30c3a4){_0x2b183e=_0x30c3a4;_0x20a011=0xc8;}else{_0x20a011=0xce;}_0x5f5954[_0x7cea('0x15')](_0x20a011);return _0x5f5954[_0x7cea('0x1c')](_0x7cea('0x1d'),_0x3ec52b+'-'+_0x2b183e+'/'+_0x30c3a4)[_0x7cea('0x17')](_0x5bc7f6);}return null;};}function patchUpdates(_0x50b82c){return function(_0x4c5422){try{jsonpatch[_0x7cea('0x1e')](_0x4c5422,_0x50b82c,!![]);}catch(_0x2890bf){return BPromise['reject'](_0x2890bf);}return _0x4c5422[_0x7cea('0x1f')]();};}function saveUpdates(_0x49be23,_0x4ee57d){return function(_0x16e43d){if(_0x16e43d){return _0x16e43d['update'](_0x49be23)[_0x7cea('0x20')](function(_0x10aa76){return _0x10aa76;});}return null;};}function removeEntity(_0x1ce08e,_0x2bcf07){return function(_0x3e210f){if(_0x3e210f){return _0x3e210f['destroy']()['then'](function(){_0x1ce08e[_0x7cea('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aef9,_0x5abae6){return function(_0x4664ce){if(!_0x4664ce){_0x2aef9[_0x7cea('0x21')](0x194);}return _0x4664ce;};}function handleError(_0x568abb,_0x1cc86e){_0x1cc86e=_0x1cc86e||0x1f4;return function(_0x1f0b35){logger[_0x7cea('0x22')](_0x1f0b35[_0x7cea('0x23')]);if(_0x1f0b35[_0x7cea('0x24')]){delete _0x1f0b35[_0x7cea('0x24')];}_0x568abb['status'](_0x1cc86e)[_0x7cea('0x25')](_0x1f0b35);};}exports[_0x7cea('0x26')]=function(_0xeebca7,_0x3504b6){var _0x5c5b6c={},_0x25611a={},_0x441055={'count':0x0,'rows':[]};var _0x42f6ce=_['map'](db[_0x7cea('0x27')][_0x7cea('0x28')],function(_0x597f0f){return{'name':_0x597f0f[_0x7cea('0x29')],'type':_0x597f0f[_0x7cea('0x2a')]['key']};});_0x25611a[_0x7cea('0x2b')]=_['map'](_0x42f6ce,'name');_0x25611a[_0x7cea('0x2c')]=_[_0x7cea('0x2d')](_0xeebca7[_0x7cea('0x2c')]);_0x25611a[_0x7cea('0x2e')]=_[_0x7cea('0x2f')](_0x25611a[_0x7cea('0x2b')],_0x25611a['query']);_0x5c5b6c[_0x7cea('0x30')]=_['intersection'](_0x25611a[_0x7cea('0x2b')],qs[_0x7cea('0x31')](_0xeebca7[_0x7cea('0x2c')][_0x7cea('0x31')]));_0x5c5b6c[_0x7cea('0x30')]=_0x5c5b6c[_0x7cea('0x30')][_0x7cea('0x32')]?_0x5c5b6c[_0x7cea('0x30')]:_0x25611a[_0x7cea('0x2b')];if(!_0xeebca7[_0x7cea('0x2c')]['hasOwnProperty'](_0x7cea('0x33'))){_0x5c5b6c[_0x7cea('0x19')]=qs[_0x7cea('0x19')](_0xeebca7[_0x7cea('0x2c')][_0x7cea('0x19')]);_0x5c5b6c[_0x7cea('0x1b')]=qs['offset'](_0xeebca7[_0x7cea('0x2c')][_0x7cea('0x1b')]);}_0x5c5b6c[_0x7cea('0x34')]=qs[_0x7cea('0x35')](_0xeebca7[_0x7cea('0x2c')][_0x7cea('0x35')]);_0x5c5b6c['where']=qs[_0x7cea('0x2e')](_['pick'](_0xeebca7[_0x7cea('0x2c')],_0x25611a[_0x7cea('0x2e')]),_0x42f6ce);if(_0xeebca7[_0x7cea('0x2c')]['filter']){_0x5c5b6c['where']=_[_0x7cea('0x36')](_0x5c5b6c[_0x7cea('0x37')],{'$or':_[_0x7cea('0x38')](_0x42f6ce,function(_0x1cdd74){if(_0x1cdd74[_0x7cea('0x2a')]!==_0x7cea('0x39')){var _0x1a1344={};_0x1a1344[_0x1cdd74[_0x7cea('0x24')]]={'$like':'%'+_0xeebca7[_0x7cea('0x2c')][_0x7cea('0x3a')]+'%'};return _0x1a1344;}})});}_0x5c5b6c=_[_0x7cea('0x36')]({},_0x5c5b6c,_0xeebca7[_0x7cea('0x3b')]);var _0x47cb45={'where':_0x5c5b6c[_0x7cea('0x37')]};return db[_0x7cea('0x27')][_0x7cea('0x1a')](_0x47cb45)[_0x7cea('0x20')](function(_0x1b869f){_0x441055['count']=_0x1b869f;if(_0xeebca7[_0x7cea('0x2c')][_0x7cea('0x3c')]){_0x5c5b6c[_0x7cea('0x3d')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x5c5b6c);})[_0x7cea('0x20')](function(_0x441d70){_0x441055[_0x7cea('0x3e')]=_0x441d70;return _0x441055;})[_0x7cea('0x20')](respondWithFilteredResult(_0x3504b6,_0x5c5b6c))[_0x7cea('0x3f')](handleError(_0x3504b6,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index b6c4df0..73c2a0a 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 _0x86d9=['lodash','util','moment','request-promise','path','rimraf','./migration.attributes','exports','define','migrations'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x86d9,0x8c));var _0x986d=function(_0x5ae3dd,_0x113d8d){_0x5ae3dd=_0x5ae3dd-0x0;var _0x4db386=_0x86d9[_0x5ae3dd];return _0x4db386;};'use strict';var _=require(_0x986d('0x0'));var util=require(_0x986d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x986d('0x2'));var BPromise=require('bluebird');var rp=require(_0x986d('0x3'));var fs=require('fs');var path=require(_0x986d('0x4'));var rimraf=require(_0x986d('0x5'));var config=require('../../config/environment');var attributes=require(_0x986d('0x6'));module[_0x986d('0x7')]=function(_0x2bc4d3,_0x2ee1a1){return _0x2bc4d3[_0x986d('0x8')]('Migration',attributes,{'tableName':_0x986d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2445=['rimraf','./migration.attributes','exports','define','Migration','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x425bbb,_0x234b90){var _0x3e72c7=function(_0x13fe79){while(--_0x13fe79){_0x425bbb['push'](_0x425bbb['shift']());}};_0x3e72c7(++_0x234b90);}(_0x2445,0x65));var _0x5244=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x2445[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x5244('0x0'));var util=require(_0x5244('0x1'));var logger=require(_0x5244('0x2'))(_0x5244('0x3'));var moment=require(_0x5244('0x4'));var BPromise=require(_0x5244('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5244('0x6'));var rimraf=require(_0x5244('0x7'));var config=require('../../config/environment');var attributes=require(_0x5244('0x8'));module[_0x5244('0x9')]=function(_0x137ec8,_0x5592b7){return _0x137ec8[_0x5244('0xa')](_0x5244('0xb'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 6f5b00d..f7b2c9d 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 _0xf257=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird'];(function(_0xb51ba6,_0x4e2f6c){var _0x46bcbe=function(_0x50488d){while(--_0x50488d){_0xb51ba6['push'](_0xb51ba6['shift']());}};_0x46bcbe(++_0x4e2f6c);}(_0xf257,0x82));var _0x7f25=function(_0x213c03,_0x22ba9d){_0x213c03=_0x213c03-0x0;var _0x478e2d=_0xf257[_0x213c03];return _0x478e2d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7f25('0x0'));var BPromise=require(_0x7f25('0x1'));var rs=require(_0x7f25('0x2'));var fs=require('fs');var Redis=require(_0x7f25('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f25('0x4'));var logger=require(_0x7f25('0x5'))(_0x7f25('0x6'));var config=require(_0x7f25('0x7'));var jayson=require(_0x7f25('0x8'));var client=jayson[_0x7f25('0x9')][_0x7f25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x242a3e,_0x369a09,_0x16e278){return new BPromise(function(_0x31a5d8,_0x1ae607){return client[_0x7f25('0xb')](_0x242a3e,_0x16e278)[_0x7f25('0xc')](function(_0x57ba17){logger[_0x7f25('0xd')](_0x7f25('0xe'),_0x369a09,'request\x20sent');logger['debug'](_0x7f25('0xf'),_0x369a09,'request\x20sent',JSON[_0x7f25('0x10')](_0x57ba17));if(_0x57ba17[_0x7f25('0x11')]){if(_0x57ba17[_0x7f25('0x11')][_0x7f25('0x12')]===0x1f4){logger[_0x7f25('0x11')](_0x7f25('0xe'),_0x369a09,_0x57ba17[_0x7f25('0x11')]['message']);return _0x1ae607(_0x57ba17['error'][_0x7f25('0x13')]);}logger['error'](_0x7f25('0xe'),_0x369a09,_0x57ba17[_0x7f25('0x11')][_0x7f25('0x13')]);return _0x31a5d8(_0x57ba17[_0x7f25('0x11')][_0x7f25('0x13')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x369a09,'request\x20sent');_0x31a5d8(_0x57ba17[_0x7f25('0x14')][_0x7f25('0x13')]);}})[_0x7f25('0x15')](function(_0x167363){logger[_0x7f25('0x11')](_0x7f25('0xe'),_0x369a09,_0x167363);_0x1ae607(_0x167363);});});} \ No newline at end of file +var _0x5ff3=['message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','Migration,\x20%s,\x20%s'];(function(_0x122951,_0x46b7df){var _0x20d413=function(_0x4565d2){while(--_0x4565d2){_0x122951['push'](_0x122951['shift']());}};_0x20d413(++_0x46b7df);}(_0x5ff3,0x17d));var _0x35ff=function(_0x1423c8,_0x178515){_0x1423c8=_0x1423c8-0x0;var _0x14d1c4=_0x5ff3[_0x1423c8];return _0x14d1c4;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var moment=require('moment');var BPromise=require(_0x35ff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ff('0x2'));var db=require(_0x35ff('0x3'))['db'];var utils=require(_0x35ff('0x4'));var logger=require(_0x35ff('0x5'))('rpc');var config=require(_0x35ff('0x6'));var jayson=require(_0x35ff('0x7'));var client=jayson[_0x35ff('0x8')][_0x35ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30c3ff,_0x495c31,_0x92b403){return new BPromise(function(_0x4c9fab,_0x2e7470){return client[_0x35ff('0xa')](_0x30c3ff,_0x92b403)[_0x35ff('0xb')](function(_0x51967a){logger[_0x35ff('0xc')]('Migration,\x20%s,\x20%s',_0x495c31,_0x35ff('0xd'));logger[_0x35ff('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x495c31,'request\x20sent',JSON[_0x35ff('0xf')](_0x51967a));if(_0x51967a['error']){if(_0x51967a['error']['code']===0x1f4){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);return _0x2e7470(_0x51967a['error'][_0x35ff('0x12')]);}logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a['error'][_0x35ff('0x12')]);return _0x4c9fab(_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);}else{logger[_0x35ff('0xc')](_0x35ff('0x11'),_0x495c31,_0x35ff('0xd'));_0x4c9fab(_0x51967a[_0x35ff('0x13')][_0x35ff('0x12')]);}})[_0x35ff('0x14')](function(_0x2f3456){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x2f3456);_0x2e7470(_0x2f3456);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index d1958c4..4f2ece1 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 _0xfe39=['exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','./network.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x18653f,_0x267d53){var _0x28a739=function(_0x96b5b4){while(--_0x96b5b4){_0x18653f['push'](_0x18653f['shift']());}};_0x28a739(++_0x267d53);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xfe39[_0x29d915];return _0x160f86;};'use strict';var multer=require(_0x9fe3('0x0'));var util=require(_0x9fe3('0x1'));var path=require('path');var timeout=require(_0x9fe3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9fe3('0x3'));var auth=require(_0x9fe3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9fe3('0x5'));router[_0x9fe3('0x6')]('/',auth[_0x9fe3('0x7')](),controller[_0x9fe3('0x8')]);router[_0x9fe3('0x6')](_0x9fe3('0x9'),auth[_0x9fe3('0x7')](),controller['show']);router[_0x9fe3('0xa')]('/',auth[_0x9fe3('0x7')](),controller[_0x9fe3('0xb')]);router[_0x9fe3('0xc')](_0x9fe3('0x9'),auth[_0x9fe3('0x7')](),controller['update']);router['delete'](_0x9fe3('0x9'),auth[_0x9fe3('0x7')](),controller['destroy']);module[_0x9fe3('0xd')]=router; \ No newline at end of file +var _0xa1c5=['Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','index','isAuthenticated','post','create','put','/:id','update','exports','multer','util','path'];(function(_0x2aac2d,_0x43db2f){var _0x22a99e=function(_0x47fa9b){while(--_0x47fa9b){_0x2aac2d['push'](_0x2aac2d['shift']());}};_0x22a99e(++_0x43db2f);}(_0xa1c5,0x96));var _0x5a1c=function(_0x2e3672,_0x236642){_0x2e3672=_0x2e3672-0x0;var _0x4e81b1=_0xa1c5[_0x2e3672];return _0x4e81b1;};'use strict';var multer=require(_0x5a1c('0x0'));var util=require(_0x5a1c('0x1'));var path=require(_0x5a1c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5a1c('0x3')]();var fs_extra=require(_0x5a1c('0x4'));var auth=require(_0x5a1c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5a1c('0x6'));var controller=require(_0x5a1c('0x7'));router[_0x5a1c('0x8')]('/',auth['isAuthenticated'](),controller[_0x5a1c('0x9')]);router[_0x5a1c('0x8')]('/:id',auth[_0x5a1c('0xa')](),controller['show']);router[_0x5a1c('0xb')]('/',auth[_0x5a1c('0xa')](),controller[_0x5a1c('0xc')]);router[_0x5a1c('0xd')](_0x5a1c('0xe'),auth['isAuthenticated'](),controller[_0x5a1c('0xf')]);router['delete'](_0x5a1c('0xe'),auth[_0x5a1c('0xa')](),controller['destroy']);module[_0x5a1c('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 70aee6a..853bbe1 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 _0x6569=['stun','turn','STRING','sequelize','exports','ENUM','externip'];(function(_0x1486ce,_0x233c7f){var _0x10a7b2=function(_0xd96f47){while(--_0xd96f47){_0x1486ce['push'](_0x1486ce['shift']());}};_0x10a7b2(++_0x233c7f);}(_0x6569,0x184));var _0x9656=function(_0x13e526,_0x217edf){_0x13e526=_0x13e526-0x0;var _0x1f84aa=_0x6569[_0x13e526];return _0x1f84aa;};'use strict';var Sequelize=require(_0x9656('0x0'));module[_0x9656('0x1')]={'type':{'type':Sequelize[_0x9656('0x2')]('localnet',_0x9656('0x3'),_0x9656('0x4'),_0x9656('0x5'))},'value':{'type':Sequelize[_0x9656('0x6')]},'username':{'type':Sequelize[_0x9656('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9915=['externip','stun','turn','STRING','sequelize','exports'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x9915,0x1ae));var _0x5991=function(_0x291b0b,_0x13c07f){_0x291b0b=_0x291b0b-0x0;var _0x22f128=_0x9915[_0x291b0b];return _0x22f128;};'use strict';var Sequelize=require(_0x5991('0x0'));module[_0x5991('0x1')]={'type':{'type':Sequelize['ENUM']('localnet',_0x5991('0x2'),_0x5991('0x3'),_0x5991('0x4'))},'value':{'type':Sequelize[_0x5991('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x5991('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index a80da44..1f397f4 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 _0xe40c=['server/files/templates/turn_multiple.ejs','readFileSync','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','update','params','toUpperCase','server/files/templates/stun_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','toLowerCase','destroy','util','path','ejs','lodash','../../components/parsers/qs','jayson/promise','client','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','Network,\x20%s,\x20%s','status','json','offset','undefined','count','then','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','find','create','body','STUN','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN'];(function(_0x27125a,_0x252d0d){var _0x391f7a=function(_0x4068fb){while(--_0x4068fb){_0x27125a['push'](_0x27125a['shift']());}};_0x391f7a(++_0x252d0d);}(_0xe40c,0x100));var _0xce40=function(_0x131627,_0x642b7a){_0x131627=_0x131627-0x0;var _0x10a0b1=_0xe40c[_0x131627];return _0x10a0b1;};'use strict';var util=require(_0xce40('0x0'));var path=require(_0xce40('0x1'));var ejs=require(_0xce40('0x2'));var fs=require('fs');var _=require(_0xce40('0x3'));var qs=require(_0xce40('0x4'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xce40('0x5'));var client=jayson[_0xce40('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cc17a,_0x2a8946,_0x213078,_0x1a5902){return new Promise(function(_0x16d9b6,_0x16a367){var _0x3b6282=_0x1a5902||client;return _0x3b6282['request'](_0x2cc17a,_0x213078)['then'](function(_0x33897d){logger['info']('Network,\x20%s,\x20%s',_0x2a8946,_0xce40('0x7'));logger[_0xce40('0x8')](_0xce40('0x9'),_0x2a8946,_0xce40('0x7'),JSON[_0xce40('0xa')](_0x33897d));if(_0x33897d[_0xce40('0xb')]){if(_0x33897d[_0xce40('0xb')]['code']===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x2a8946,_0x33897d[_0xce40('0xb')]['message']);return _0x16a367(_0x33897d[_0xce40('0xb')][_0xce40('0xc')]);}logger[_0xce40('0xb')]('Network,\x20%s,\x20%s',_0x2a8946,_0x33897d[_0xce40('0xb')][_0xce40('0xc')]);return _0x16d9b6(_0x33897d[_0xce40('0xb')][_0xce40('0xc')]);}else{logger[_0xce40('0xd')]('Network,\x20%s,\x20%s',_0x2a8946,_0xce40('0x7'));_0x16d9b6(_0x33897d['result'][_0xce40('0xc')]);}})[_0xce40('0xe')](function(_0x31c084){logger[_0xce40('0xb')](_0xce40('0xf'),_0x2a8946,_0x31c084);_0x16a367(_0x31c084);});});}function respondWithResult(_0x4c6f32,_0x88fed9){_0x88fed9=_0x88fed9||0xc8;return function(_0x5c4526){if(_0x5c4526){return _0x4c6f32[_0xce40('0x10')](_0x88fed9)[_0xce40('0x11')](_0x5c4526);}};}function respondWithFilteredResult(_0x39665d,_0x1e8825){return function(_0x330bd2){if(_0x330bd2){var _0x53ed1b=typeof _0x1e8825[_0xce40('0x12')]==='undefined'&&typeof _0x1e8825['limit']===_0xce40('0x13');var _0x51ca47=_0x330bd2[_0xce40('0x14')];var _0x1c93c1=_0x53ed1b?0x0:_0x1e8825[_0xce40('0x12')];var _0x3c5902=_0x53ed1b?_0x330bd2[_0xce40('0x14')]:_0x1e8825[_0xce40('0x12')]+_0x1e8825['limit'];var _0x2b0c68;if(_0x3c5902>=_0x51ca47){_0x3c5902=_0x51ca47;_0x2b0c68=0xc8;}else{_0x2b0c68=0xce;}_0x39665d[_0xce40('0x10')](_0x2b0c68);return _0x39665d['set']('Content-Range',_0x1c93c1+'-'+_0x3c5902+'/'+_0x51ca47)[_0xce40('0x11')](_0x330bd2);}return null;};}function saveUpdates(_0x1b67d6){return function(_0x3260d3){if(_0x3260d3){return _0x3260d3['update'](_0x1b67d6)[_0xce40('0x15')](function(_0x2539e6){return _0x2539e6;});}return null;};}function removeEntity(_0x3f581c){return function(_0x1fef38){if(_0x1fef38){return _0x1fef38['destroy']()[_0xce40('0x15')](function(){_0x3f581c[_0xce40('0x10')](0xcc)[_0xce40('0x16')]();});}};}function handleEntityNotFound(_0x5d5dfb){return function(_0x144da7){if(!_0x144da7){_0x5d5dfb[_0xce40('0x17')](0x194);}return _0x144da7;};}function handleError(_0x3e1c4b,_0x1e27aa){_0x1e27aa=_0x1e27aa||0x1f4;return function(_0x40b00e){logger[_0xce40('0xb')](_0x40b00e[_0xce40('0x18')]);if(_0x40b00e[_0xce40('0x19')]){delete _0x40b00e[_0xce40('0x19')];}_0x3e1c4b[_0xce40('0x10')](_0x1e27aa)[_0xce40('0x1a')](_0x40b00e);};}exports[_0xce40('0x1b')]=function(_0x250e09,_0x5dd510){var _0x1665ce={},_0x97de4b={},_0x176c2e={'count':0x0,'rows':[]};var _0x346f52=_[_0xce40('0x1c')](db[_0xce40('0x1d')][_0xce40('0x1e')],function(_0x4960e6){return{'name':_0x4960e6['fieldName'],'type':_0x4960e6[_0xce40('0x1f')][_0xce40('0x20')]};});_0x97de4b['model']=_[_0xce40('0x1c')](_0x346f52,_0xce40('0x19'));_0x97de4b[_0xce40('0x21')]=_[_0xce40('0x22')](_0x250e09[_0xce40('0x21')]);_0x97de4b[_0xce40('0x23')]=_['intersection'](_0x97de4b[_0xce40('0x24')],_0x97de4b[_0xce40('0x21')]);_0x1665ce[_0xce40('0x25')]=_[_0xce40('0x26')](_0x97de4b[_0xce40('0x24')],qs[_0xce40('0x27')](_0x250e09[_0xce40('0x21')]['fields']));_0x1665ce[_0xce40('0x25')]=_0x1665ce[_0xce40('0x25')][_0xce40('0x28')]?_0x1665ce[_0xce40('0x25')]:_0x97de4b[_0xce40('0x24')];if(!_0x250e09[_0xce40('0x21')][_0xce40('0x29')](_0xce40('0x2a'))){_0x1665ce[_0xce40('0x2b')]=qs[_0xce40('0x2b')](_0x250e09[_0xce40('0x21')]['limit']);_0x1665ce[_0xce40('0x12')]=qs[_0xce40('0x12')](_0x250e09[_0xce40('0x21')][_0xce40('0x12')]);}_0x1665ce['order']=qs[_0xce40('0x2c')](_0x250e09[_0xce40('0x21')][_0xce40('0x2c')]);_0x1665ce[_0xce40('0x2d')]=qs[_0xce40('0x23')](_[_0xce40('0x2e')](_0x250e09[_0xce40('0x21')],_0x97de4b['filters']),_0x346f52);if(_0x250e09[_0xce40('0x21')]['filter']){_0x1665ce[_0xce40('0x2d')]=_[_0xce40('0x2f')](_0x1665ce[_0xce40('0x2d')],{'$or':_[_0xce40('0x1c')](_0x346f52,function(_0x223c34){if(_0x223c34['type']!==_0xce40('0x30')){var _0x4d9309={};_0x4d9309[_0x223c34[_0xce40('0x19')]]={'$like':'%'+_0x250e09[_0xce40('0x21')][_0xce40('0x31')]+'%'};return _0x4d9309;}})});}_0x1665ce=_[_0xce40('0x2f')]({},_0x1665ce,_0x250e09[_0xce40('0x32')]);var _0x211110={'where':_0x1665ce[_0xce40('0x2d')]};return db[_0xce40('0x1d')][_0xce40('0x14')](_0x211110)[_0xce40('0x15')](function(_0x29181b){_0x176c2e[_0xce40('0x14')]=_0x29181b;if(_0x250e09[_0xce40('0x21')][_0xce40('0x33')]){_0x1665ce[_0xce40('0x34')]=[{'all':!![]}];}return db['Network'][_0xce40('0x35')](_0x1665ce);})[_0xce40('0x15')](function(_0x3d8e31){_0x176c2e[_0xce40('0x36')]=_0x3d8e31;return _0x176c2e;})[_0xce40('0x15')](respondWithFilteredResult(_0x5dd510,_0x1665ce))['catch'](handleError(_0x5dd510,null));};exports['show']=function(_0x22df9d,_0x1ba124){var _0x148f2c={'raw':!![],'where':{'id':_0x22df9d['params']['id']}},_0x47127b={};_0x47127b[_0xce40('0x24')]=_[_0xce40('0x22')](db[_0xce40('0x1d')][_0xce40('0x1e')]);_0x47127b[_0xce40('0x21')]=_[_0xce40('0x22')](_0x22df9d[_0xce40('0x21')]);_0x47127b[_0xce40('0x23')]=_[_0xce40('0x26')](_0x47127b[_0xce40('0x24')],_0x47127b[_0xce40('0x21')]);_0x148f2c[_0xce40('0x25')]=_[_0xce40('0x26')](_0x47127b[_0xce40('0x24')],qs[_0xce40('0x27')](_0x22df9d[_0xce40('0x21')][_0xce40('0x27')]));_0x148f2c[_0xce40('0x25')]=_0x148f2c[_0xce40('0x25')]['length']?_0x148f2c[_0xce40('0x25')]:_0x47127b[_0xce40('0x24')];if(_0x22df9d[_0xce40('0x21')][_0xce40('0x33')]){_0x148f2c[_0xce40('0x34')]=[{'all':!![]}];}_0x148f2c=_['merge']({},_0x148f2c,_0x22df9d['options']);return db[_0xce40('0x1d')][_0xce40('0x37')](_0x148f2c)[_0xce40('0x15')](handleEntityNotFound(_0x1ba124,null))[_0xce40('0x15')](respondWithResult(_0x1ba124,null))[_0xce40('0xe')](handleError(_0x1ba124,null));};exports[_0xce40('0x38')]=function(_0x4b50f0,_0x2be429){var _0x16ed63;return db[_0xce40('0x1d')][_0xce40('0x38')](_0x4b50f0[_0xce40('0x39')],{'raw':!![]})[_0xce40('0x15')](function(_0xaaf241){_0x16ed63=_0xaaf241;return db['Network'][_0xce40('0x35')]({'where':{'type':_0x4b50f0[_0xce40('0x39')][_0xce40('0x1f')]},'raw':!![]});})[_0xce40('0x15')](function(_0x255838){if(_0x16ed63[_0xce40('0x1f')]['toUpperCase']()==_0xce40('0x3a')){var _0x42f8d5=fs['readFileSync'](path[_0xce40('0x3b')](config[_0xce40('0x3c')],'server/files/templates/stun_multiple.ejs'),_0xce40('0x3d'));var _0x5505a7=ejs[_0xce40('0x3e')](_0x42f8d5,{'networks':_0x255838||[]});fs[_0xce40('0x3f')](_0xce40('0x40'),_0x5505a7);return respondWithRpcPromise(_0xce40('0x41'),_0xce40('0x38'),{'module':_0xce40('0x42')});}else if(_0x16ed63['type']['toUpperCase']()==_0xce40('0x43')){var _0xd170c3=fs['readFileSync'](path[_0xce40('0x3b')](config['root'],_0xce40('0x44')),_0xce40('0x3d'));var _0x541214=ejs[_0xce40('0x3e')](_0xd170c3,{'networks':_0x255838||[]});fs[_0xce40('0x3f')]('/etc/asterisk/turn_xcally.conf',_0x541214);return respondWithRpcPromise(_0xce40('0x41'),'create',{'module':_0xce40('0x42')});}else{var _0x483c37=fs[_0xce40('0x45')](path['join'](config[_0xce40('0x3c')],'server/files/templates/network.ejs'),_0xce40('0x3d'));var _0x24704d=ejs['render'](_0x483c37,{'networks':_0x255838||[]});fs['writeFileSync'](util[_0xce40('0x46')](_0xce40('0x47'),_0x4b50f0[_0xce40('0x39')][_0xce40('0x1f')]['toLowerCase']()),_0x24704d);return respondWithRpcPromise(_0xce40('0x41'),_0xce40('0x38'),{'module':_0xce40('0x48')});}})['then'](function(){return _0x16ed63;})['then'](respondWithResult(_0x2be429,0xc9))['catch'](handleError(_0x2be429,null));};exports[_0xce40('0x49')]=function(_0x423322,_0xb09fd){var _0x1de440;return db['Network'][_0xce40('0x37')]({'where':{'id':_0x423322[_0xce40('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb09fd,null))['then'](saveUpdates(_0x423322[_0xce40('0x39')],null))['then'](function(_0x5cf71c){if(_0x5cf71c){_0x1de440=_0x5cf71c;return db[_0xce40('0x1d')][_0xce40('0x35')]({'where':{'type':_0x1de440[_0xce40('0x1f')]},'raw':!![]});}return null;})['then'](function(_0x5edcdc){if(_0x1de440[_0xce40('0x1f')][_0xce40('0x4b')]()=='STUN'){var _0x198586=fs[_0xce40('0x45')](path[_0xce40('0x3b')](config[_0xce40('0x3c')],_0xce40('0x4c')),_0xce40('0x3d'));var _0x28adee=ejs[_0xce40('0x3e')](_0x198586,{'networks':_0x5edcdc||[]});fs['writeFileSync'](_0xce40('0x40'),_0x28adee);return respondWithRpcPromise(_0xce40('0x41'),_0xce40('0x49'),{'module':_0xce40('0x42')});}else if(_0x1de440[_0xce40('0x1f')][_0xce40('0x4b')]()==_0xce40('0x43')){var _0x4dd548=fs[_0xce40('0x45')](path['join'](config[_0xce40('0x3c')],_0xce40('0x44')),_0xce40('0x3d'));var _0x104c78=ejs[_0xce40('0x3e')](_0x4dd548,{'networks':_0x5edcdc||[]});fs[_0xce40('0x3f')](_0xce40('0x4d'),_0x104c78);return respondWithRpcPromise(_0xce40('0x41'),'update',{'module':'res_stun_monitor.so'});}else{var _0x4faa25=fs[_0xce40('0x45')](path[_0xce40('0x3b')](config[_0xce40('0x3c')],_0xce40('0x4e')),_0xce40('0x3d'));var _0x6d7c66=ejs['render'](_0x4faa25,{'networks':_0x5edcdc||[]});fs[_0xce40('0x3f')](util[_0xce40('0x46')]('/etc/asterisk/sip_xcally_%s.conf',_0x423322['body'][_0xce40('0x1f')][_0xce40('0x4f')]()),_0x6d7c66);return respondWithRpcPromise(_0xce40('0x41'),'update',{'module':_0xce40('0x48')});}})[_0xce40('0x15')](function(_0x97d5e2){if(_0x97d5e2){return _0x1de440;}return null;})[_0xce40('0x15')](respondWithResult(_0xb09fd,null))[_0xce40('0xe')](handleError(_0xb09fd,null));};exports['destroy']=function(_0x3b3c51,_0x3772a1){var _0x3c09c3;return db[_0xce40('0x1d')][_0xce40('0x37')]({'where':{'id':_0x3b3c51[_0xce40('0x4a')]['id']}})[_0xce40('0x15')](function(_0x5cb571){_0x3c09c3=_0x5cb571;return _0x5cb571;})['then'](handleEntityNotFound(_0x3772a1,null))[_0xce40('0x15')](removeEntity(_0x3772a1,null))[_0xce40('0x15')](function(){if(_0x3c09c3){return db[_0xce40('0x1d')][_0xce40('0x35')]({'where':{'type':_0x3c09c3[_0xce40('0x1f')]},'raw':!![]});}})[_0xce40('0x15')](function(_0x1d720d){if(_0x3c09c3['type'][_0xce40('0x4b')]()==_0xce40('0x3a')){var _0x1562c1=fs[_0xce40('0x45')](path[_0xce40('0x3b')](config[_0xce40('0x3c')],_0xce40('0x4c')),_0xce40('0x3d'));var _0x4c8646=ejs[_0xce40('0x3e')](_0x1562c1,{'networks':_0x1d720d||[]});fs[_0xce40('0x3f')](_0xce40('0x40'),_0x4c8646);return respondWithRpcPromise('Reload','destroy',{'module':_0xce40('0x42')});}else if(_0x3c09c3[_0xce40('0x1f')][_0xce40('0x4b')]()=='TURN'){var _0x2a265b=fs[_0xce40('0x45')](path[_0xce40('0x3b')](config['root'],_0xce40('0x44')),_0xce40('0x3d'));var _0x4dd538=ejs[_0xce40('0x3e')](_0x2a265b,{'networks':_0x1d720d||[]});fs[_0xce40('0x3f')](_0xce40('0x4d'),_0x4dd538);return respondWithRpcPromise('Reload',_0xce40('0x50'),{'module':_0xce40('0x42')});}else{var _0x25772a=fs[_0xce40('0x45')](path[_0xce40('0x3b')](config[_0xce40('0x3c')],_0xce40('0x4e')),'utf8');var _0x393c88=ejs[_0xce40('0x3e')](_0x25772a,{'networks':_0x1d720d||[]});fs[_0xce40('0x3f')](util[_0xce40('0x46')]('/etc/asterisk/sip_xcally_%s.conf',_0x3c09c3[_0xce40('0x1f')][_0xce40('0x4f')]()),_0x393c88);return respondWithRpcPromise(_0xce40('0x41'),'destroy',{'module':'chan_sip.so'});}})[_0xce40('0xe')](handleError(_0x3772a1,null));}; \ No newline at end of file +var _0x62fd=['TURN','util','path','../../components/parsers/qs','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','stack','name','send','index','map','Network','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','include','find','create','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','/etc/asterisk/turn_xcally.conf','Reload','readFileSync','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs'];(function(_0x2fc704,_0x24a7e0){var _0x53f75d=function(_0x5a1b8d){while(--_0x5a1b8d){_0x2fc704['push'](_0x2fc704['shift']());}};_0x53f75d(++_0x24a7e0);}(_0x62fd,0xf7));var _0xd62f=function(_0x40135f,_0x36ca6f){_0x40135f=_0x40135f-0x0;var _0x3c9f38=_0x62fd[_0x40135f];return _0x3c9f38;};'use strict';var util=require(_0xd62f('0x0'));var path=require(_0xd62f('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require(_0xd62f('0x2'));var logger=require(_0xd62f('0x3'))('api');var config=require(_0xd62f('0x4'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd62f('0x5'));var client=jayson[_0xd62f('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41078e,_0x84110e,_0x38cc5c,_0x289edf){return new Promise(function(_0x342630,_0xe2b6e4){var _0x5a7476=_0x289edf||client;return _0x5a7476[_0xd62f('0x7')](_0x41078e,_0x38cc5c)[_0xd62f('0x8')](function(_0x5dd9e6){logger[_0xd62f('0x9')](_0xd62f('0xa'),_0x84110e,'request\x20sent');logger[_0xd62f('0xb')](_0xd62f('0xc'),_0x84110e,'request\x20sent',JSON[_0xd62f('0xd')](_0x5dd9e6));if(_0x5dd9e6['error']){if(_0x5dd9e6[_0xd62f('0xe')][_0xd62f('0xf')]===0x1f4){logger[_0xd62f('0xe')](_0xd62f('0xa'),_0x84110e,_0x5dd9e6[_0xd62f('0xe')][_0xd62f('0x10')]);return _0xe2b6e4(_0x5dd9e6[_0xd62f('0xe')][_0xd62f('0x10')]);}logger['error']('Network,\x20%s,\x20%s',_0x84110e,_0x5dd9e6[_0xd62f('0xe')][_0xd62f('0x10')]);return _0x342630(_0x5dd9e6['error'][_0xd62f('0x10')]);}else{logger[_0xd62f('0x9')](_0xd62f('0xa'),_0x84110e,_0xd62f('0x11'));_0x342630(_0x5dd9e6['result']['message']);}})['catch'](function(_0x810b9e){logger[_0xd62f('0xe')](_0xd62f('0xa'),_0x84110e,_0x810b9e);_0xe2b6e4(_0x810b9e);});});}function respondWithResult(_0xacca32,_0x3ace89){_0x3ace89=_0x3ace89||0xc8;return function(_0x31e434){if(_0x31e434){return _0xacca32[_0xd62f('0x12')](_0x3ace89)['json'](_0x31e434);}};}function respondWithFilteredResult(_0xfc9c8f,_0x4855a3){return function(_0x2695f1){if(_0x2695f1){var _0xf08cdc=typeof _0x4855a3[_0xd62f('0x13')]===_0xd62f('0x14')&&typeof _0x4855a3[_0xd62f('0x15')]===_0xd62f('0x14');var _0x2e2e8d=_0x2695f1[_0xd62f('0x16')];var _0x202168=_0xf08cdc?0x0:_0x4855a3[_0xd62f('0x13')];var _0x5fb882=_0xf08cdc?_0x2695f1[_0xd62f('0x16')]:_0x4855a3[_0xd62f('0x13')]+_0x4855a3[_0xd62f('0x15')];var _0x5bdea9;if(_0x5fb882>=_0x2e2e8d){_0x5fb882=_0x2e2e8d;_0x5bdea9=0xc8;}else{_0x5bdea9=0xce;}_0xfc9c8f[_0xd62f('0x12')](_0x5bdea9);return _0xfc9c8f[_0xd62f('0x17')](_0xd62f('0x18'),_0x202168+'-'+_0x5fb882+'/'+_0x2e2e8d)[_0xd62f('0x19')](_0x2695f1);}return null;};}function saveUpdates(_0x2e1f49){return function(_0x328daa){if(_0x328daa){return _0x328daa[_0xd62f('0x1a')](_0x2e1f49)[_0xd62f('0x8')](function(_0x48b6e9){return _0x48b6e9;});}return null;};}function removeEntity(_0xf8b790){return function(_0x2974eb){if(_0x2974eb){return _0x2974eb[_0xd62f('0x1b')]()['then'](function(){_0xf8b790['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x593a1b){return function(_0xba7a9e){if(!_0xba7a9e){_0x593a1b['sendStatus'](0x194);}return _0xba7a9e;};}function handleError(_0x43bee2,_0x330f31){_0x330f31=_0x330f31||0x1f4;return function(_0x4e5d43){logger['error'](_0x4e5d43[_0xd62f('0x1c')]);if(_0x4e5d43[_0xd62f('0x1d')]){delete _0x4e5d43['name'];}_0x43bee2['status'](_0x330f31)[_0xd62f('0x1e')](_0x4e5d43);};}exports[_0xd62f('0x1f')]=function(_0x47a785,_0x43a35d){var _0x38fdde={},_0x42d04b={},_0x11869e={'count':0x0,'rows':[]};var _0x47d51d=_[_0xd62f('0x20')](db[_0xd62f('0x21')][_0xd62f('0x22')],function(_0x417d0a){return{'name':_0x417d0a['fieldName'],'type':_0x417d0a[_0xd62f('0x23')]['key']};});_0x42d04b[_0xd62f('0x24')]=_['map'](_0x47d51d,_0xd62f('0x1d'));_0x42d04b['query']=_[_0xd62f('0x25')](_0x47a785[_0xd62f('0x26')]);_0x42d04b[_0xd62f('0x27')]=_[_0xd62f('0x28')](_0x42d04b[_0xd62f('0x24')],_0x42d04b[_0xd62f('0x26')]);_0x38fdde['attributes']=_[_0xd62f('0x28')](_0x42d04b[_0xd62f('0x24')],qs['fields'](_0x47a785[_0xd62f('0x26')][_0xd62f('0x29')]));_0x38fdde[_0xd62f('0x2a')]=_0x38fdde['attributes'][_0xd62f('0x2b')]?_0x38fdde[_0xd62f('0x2a')]:_0x42d04b[_0xd62f('0x24')];if(!_0x47a785['query'][_0xd62f('0x2c')]('nolimit')){_0x38fdde['limit']=qs['limit'](_0x47a785[_0xd62f('0x26')][_0xd62f('0x15')]);_0x38fdde[_0xd62f('0x13')]=qs[_0xd62f('0x13')](_0x47a785[_0xd62f('0x26')][_0xd62f('0x13')]);}_0x38fdde[_0xd62f('0x2d')]=qs[_0xd62f('0x2e')](_0x47a785[_0xd62f('0x26')][_0xd62f('0x2e')]);_0x38fdde['where']=qs[_0xd62f('0x27')](_[_0xd62f('0x2f')](_0x47a785['query'],_0x42d04b[_0xd62f('0x27')]),_0x47d51d);if(_0x47a785['query']['filter']){_0x38fdde[_0xd62f('0x30')]=_[_0xd62f('0x31')](_0x38fdde[_0xd62f('0x30')],{'$or':_[_0xd62f('0x20')](_0x47d51d,function(_0x37e444){if(_0x37e444['type']!==_0xd62f('0x32')){var _0x389cd6={};_0x389cd6[_0x37e444[_0xd62f('0x1d')]]={'$like':'%'+_0x47a785[_0xd62f('0x26')][_0xd62f('0x33')]+'%'};return _0x389cd6;}})});}_0x38fdde=_['merge']({},_0x38fdde,_0x47a785[_0xd62f('0x34')]);var _0x587126={'where':_0x38fdde[_0xd62f('0x30')]};return db[_0xd62f('0x21')][_0xd62f('0x16')](_0x587126)[_0xd62f('0x8')](function(_0x129463){_0x11869e[_0xd62f('0x16')]=_0x129463;if(_0x47a785[_0xd62f('0x26')][_0xd62f('0x35')]){_0x38fdde['include']=[{'all':!![]}];}return db[_0xd62f('0x21')][_0xd62f('0x36')](_0x38fdde);})[_0xd62f('0x8')](function(_0x51f373){_0x11869e['rows']=_0x51f373;return _0x11869e;})[_0xd62f('0x8')](respondWithFilteredResult(_0x43a35d,_0x38fdde))[_0xd62f('0x37')](handleError(_0x43a35d,null));};exports[_0xd62f('0x38')]=function(_0x49a8f0,_0x1e1057){var _0x1e7127={'raw':!![],'where':{'id':_0x49a8f0[_0xd62f('0x39')]['id']}},_0x2d6d06={};_0x2d6d06['model']=_[_0xd62f('0x25')](db[_0xd62f('0x21')]['rawAttributes']);_0x2d6d06[_0xd62f('0x26')]=_[_0xd62f('0x25')](_0x49a8f0[_0xd62f('0x26')]);_0x2d6d06[_0xd62f('0x27')]=_[_0xd62f('0x28')](_0x2d6d06[_0xd62f('0x24')],_0x2d6d06[_0xd62f('0x26')]);_0x1e7127[_0xd62f('0x2a')]=_[_0xd62f('0x28')](_0x2d6d06[_0xd62f('0x24')],qs[_0xd62f('0x29')](_0x49a8f0[_0xd62f('0x26')][_0xd62f('0x29')]));_0x1e7127[_0xd62f('0x2a')]=_0x1e7127[_0xd62f('0x2a')][_0xd62f('0x2b')]?_0x1e7127[_0xd62f('0x2a')]:_0x2d6d06['model'];if(_0x49a8f0[_0xd62f('0x26')]['includeAll']){_0x1e7127[_0xd62f('0x3a')]=[{'all':!![]}];}_0x1e7127=_['merge']({},_0x1e7127,_0x49a8f0[_0xd62f('0x34')]);return db[_0xd62f('0x21')][_0xd62f('0x3b')](_0x1e7127)[_0xd62f('0x8')](handleEntityNotFound(_0x1e1057,null))[_0xd62f('0x8')](respondWithResult(_0x1e1057,null))[_0xd62f('0x37')](handleError(_0x1e1057,null));};exports['create']=function(_0x1b8c4d,_0x33fdef){var _0x382b0d;return db[_0xd62f('0x21')][_0xd62f('0x3c')](_0x1b8c4d[_0xd62f('0x3d')],{'raw':!![]})['then'](function(_0x458bef){_0x382b0d=_0x458bef;return db['Network'][_0xd62f('0x36')]({'where':{'type':_0x1b8c4d['body'][_0xd62f('0x23')]},'raw':!![]});})[_0xd62f('0x8')](function(_0x310daa){if(_0x382b0d['type'][_0xd62f('0x3e')]()==_0xd62f('0x3f')){var _0x5e2b76=fs['readFileSync'](path[_0xd62f('0x40')](config[_0xd62f('0x41')],_0xd62f('0x42')),_0xd62f('0x43'));var _0x56649a=ejs[_0xd62f('0x44')](_0x5e2b76,{'networks':_0x310daa||[]});fs[_0xd62f('0x45')](_0xd62f('0x46'),_0x56649a);return respondWithRpcPromise('Reload',_0xd62f('0x3c'),{'module':_0xd62f('0x47')});}else if(_0x382b0d['type'][_0xd62f('0x3e')]()=='TURN'){var _0x4a5c93=fs['readFileSync'](path[_0xd62f('0x40')](config[_0xd62f('0x41')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x57ef04=ejs['render'](_0x4a5c93,{'networks':_0x310daa||[]});fs[_0xd62f('0x45')](_0xd62f('0x48'),_0x57ef04);return respondWithRpcPromise(_0xd62f('0x49'),'create',{'module':_0xd62f('0x47')});}else{var _0xe1bb55=fs[_0xd62f('0x4a')](path[_0xd62f('0x40')](config[_0xd62f('0x41')],'server/files/templates/network.ejs'),_0xd62f('0x43'));var _0x1c2e19=ejs[_0xd62f('0x44')](_0xe1bb55,{'networks':_0x310daa||[]});fs[_0xd62f('0x45')](util[_0xd62f('0x4b')](_0xd62f('0x4c'),_0x1b8c4d[_0xd62f('0x3d')][_0xd62f('0x23')][_0xd62f('0x4d')]()),_0x1c2e19);return respondWithRpcPromise(_0xd62f('0x49'),_0xd62f('0x3c'),{'module':_0xd62f('0x4e')});}})[_0xd62f('0x8')](function(){return _0x382b0d;})[_0xd62f('0x8')](respondWithResult(_0x33fdef,0xc9))[_0xd62f('0x37')](handleError(_0x33fdef,null));};exports['update']=function(_0x40b205,_0x90814f){var _0x449040;return db[_0xd62f('0x21')][_0xd62f('0x3b')]({'where':{'id':_0x40b205[_0xd62f('0x39')]['id']}})[_0xd62f('0x8')](handleEntityNotFound(_0x90814f,null))[_0xd62f('0x8')](saveUpdates(_0x40b205['body'],null))[_0xd62f('0x8')](function(_0x3b03be){if(_0x3b03be){_0x449040=_0x3b03be;return db['Network'][_0xd62f('0x36')]({'where':{'type':_0x449040[_0xd62f('0x23')]},'raw':!![]});}return null;})['then'](function(_0x592adb){if(_0x449040[_0xd62f('0x23')][_0xd62f('0x3e')]()==_0xd62f('0x3f')){var _0x3ac296=fs['readFileSync'](path['join'](config['root'],_0xd62f('0x42')),_0xd62f('0x43'));var _0x2654c1=ejs['render'](_0x3ac296,{'networks':_0x592adb||[]});fs[_0xd62f('0x45')](_0xd62f('0x46'),_0x2654c1);return respondWithRpcPromise(_0xd62f('0x49'),_0xd62f('0x1a'),{'module':'res_stun_monitor.so'});}else if(_0x449040['type'][_0xd62f('0x3e')]()=='TURN'){var _0x284d48=fs[_0xd62f('0x4a')](path['join'](config[_0xd62f('0x41')],_0xd62f('0x4f')),_0xd62f('0x43'));var _0x58f51f=ejs[_0xd62f('0x44')](_0x284d48,{'networks':_0x592adb||[]});fs['writeFileSync'](_0xd62f('0x48'),_0x58f51f);return respondWithRpcPromise(_0xd62f('0x49'),_0xd62f('0x1a'),{'module':_0xd62f('0x47')});}else{var _0x325256=fs['readFileSync'](path['join'](config[_0xd62f('0x41')],_0xd62f('0x50')),_0xd62f('0x43'));var _0x2f5b02=ejs[_0xd62f('0x44')](_0x325256,{'networks':_0x592adb||[]});fs[_0xd62f('0x45')](util[_0xd62f('0x4b')](_0xd62f('0x4c'),_0x40b205[_0xd62f('0x3d')][_0xd62f('0x23')][_0xd62f('0x4d')]()),_0x2f5b02);return respondWithRpcPromise('Reload',_0xd62f('0x1a'),{'module':_0xd62f('0x4e')});}})['then'](function(_0x285f5f){if(_0x285f5f){return _0x449040;}return null;})[_0xd62f('0x8')](respondWithResult(_0x90814f,null))[_0xd62f('0x37')](handleError(_0x90814f,null));};exports[_0xd62f('0x1b')]=function(_0xff113f,_0x5ef63b){var _0x45d76e;return db[_0xd62f('0x21')]['find']({'where':{'id':_0xff113f[_0xd62f('0x39')]['id']}})[_0xd62f('0x8')](function(_0x11d2c5){_0x45d76e=_0x11d2c5;return _0x11d2c5;})[_0xd62f('0x8')](handleEntityNotFound(_0x5ef63b,null))['then'](removeEntity(_0x5ef63b,null))[_0xd62f('0x8')](function(){if(_0x45d76e){return db['Network'][_0xd62f('0x36')]({'where':{'type':_0x45d76e[_0xd62f('0x23')]},'raw':!![]});}})[_0xd62f('0x8')](function(_0x396750){if(_0x45d76e[_0xd62f('0x23')]['toUpperCase']()=='STUN'){var _0x2e55ac=fs[_0xd62f('0x4a')](path[_0xd62f('0x40')](config['root'],_0xd62f('0x42')),_0xd62f('0x43'));var _0x26d535=ejs[_0xd62f('0x44')](_0x2e55ac,{'networks':_0x396750||[]});fs[_0xd62f('0x45')](_0xd62f('0x46'),_0x26d535);return respondWithRpcPromise(_0xd62f('0x49'),_0xd62f('0x1b'),{'module':'res_stun_monitor.so'});}else if(_0x45d76e['type'][_0xd62f('0x3e')]()==_0xd62f('0x51')){var _0x494f19=fs[_0xd62f('0x4a')](path[_0xd62f('0x40')](config[_0xd62f('0x41')],_0xd62f('0x4f')),'utf8');var _0x2b7cc2=ejs[_0xd62f('0x44')](_0x494f19,{'networks':_0x396750||[]});fs['writeFileSync'](_0xd62f('0x48'),_0x2b7cc2);return respondWithRpcPromise(_0xd62f('0x49'),_0xd62f('0x1b'),{'module':_0xd62f('0x47')});}else{var _0x283601=fs[_0xd62f('0x4a')](path[_0xd62f('0x40')](config[_0xd62f('0x41')],_0xd62f('0x50')),'utf8');var _0x1d6c8f=ejs[_0xd62f('0x44')](_0x283601,{'networks':_0x396750||[]});fs['writeFileSync'](util[_0xd62f('0x4b')]('/etc/asterisk/sip_xcally_%s.conf',_0x45d76e[_0xd62f('0x23')]['toLowerCase']()),_0x1d6c8f);return respondWithRpcPromise(_0xd62f('0x49'),_0xd62f('0x1b'),{'module':_0xd62f('0x4e')});}})[_0xd62f('0x37')](handleError(_0x5ef63b,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index bd4f897..f188493 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 _0xac4a=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./network.attributes','define','network'];(function(_0x2f7315,_0x4db338){var _0x3abc74=function(_0x266d15){while(--_0x266d15){_0x2f7315['push'](_0x2f7315['shift']());}};_0x3abc74(++_0x4db338);}(_0xac4a,0x13f));var _0xaac4=function(_0xeb5973,_0x3f08cb){_0xeb5973=_0xeb5973-0x0;var _0x2792a2=_0xac4a[_0xeb5973];return _0x2792a2;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var attributes=require(_0xaac4('0x8'));module['exports']=function(_0x1283a5,_0x53d03a){return _0x1283a5[_0xaac4('0x9')]('Network',attributes,{'tableName':_0xaac4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x684c=['../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x332a78,_0x4d38b3){var _0x537ac5=function(_0x1a7526){while(--_0x1a7526){_0x332a78['push'](_0x332a78['shift']());}};_0x537ac5(++_0x4d38b3);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc684('0x0'));var util=require(_0xc684('0x1'));var logger=require('../../config/logger')(_0xc684('0x2'));var moment=require(_0xc684('0x3'));var BPromise=require(_0xc684('0x4'));var rp=require(_0xc684('0x5'));var fs=require('fs');var path=require(_0xc684('0x6'));var rimraf=require('rimraf');var config=require(_0xc684('0x7'));var attributes=require(_0xc684('0x8'));module[_0xc684('0x9')]=function(_0x4487f6,_0x46cb0e){return _0x4487f6[_0xc684('0xa')](_0xc684('0xb'),attributes,{'tableName':_0xc684('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 2ec5eb3..8d6b492 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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x513b8f,_0x2af392){_0x513b8f=_0x513b8f-0x0;var _0x47f5c2=_0x7a54[_0x513b8f];return _0x47f5c2;};'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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x3c6580,_0x47313d){_0x3c6580=_0x3c6580-0x0;var _0x5043ac=_0x7a54[_0x3c6580];return _0x5043ac;};'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 5839a50..3da1bb1 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 _0x26f2=['notify','addApplications','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','Router','../../components/auth/service','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','getInteractions','/:id/users','post','create','addAnswer'];(function(_0x2a1491,_0x5a339b){var _0x19987c=function(_0xed0614){while(--_0xed0614){_0x2a1491['push'](_0x2a1491['shift']());}};_0x19987c(++_0x5a339b);}(_0x26f2,0x173));var _0x226f=function(_0x16b70f,_0x6352da){_0x16b70f=_0x16b70f-0x0;var _0x30637a=_0x26f2[_0x16b70f];return _0x30637a;};'use strict';var multer=require(_0x226f('0x0'));var util=require(_0x226f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x226f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x226f('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x226f('0x4'));router[_0x226f('0x5')]('/',auth[_0x226f('0x6')](),controller[_0x226f('0x7')]);router[_0x226f('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x226f('0x8')]);router[_0x226f('0x5')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x226f('0x5')](_0x226f('0x9'),auth['isAuthenticated'](),controller[_0x226f('0xa')]);router[_0x226f('0x5')](_0x226f('0xb'),auth[_0x226f('0x6')](),controller['getAnswers']);router[_0x226f('0x5')](_0x226f('0xc'),auth[_0x226f('0x6')](),controller[_0x226f('0xd')]);router[_0x226f('0x5')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x226f('0xe')]);router['get'](_0x226f('0xf'),auth[_0x226f('0x6')](),controller['getAgents']);router[_0x226f('0x10')]('/',auth[_0x226f('0x6')](),controller[_0x226f('0x11')]);router[_0x226f('0x10')]('/:id/dispositions',auth[_0x226f('0x6')](),controller['addDisposition']);router[_0x226f('0x10')]('/:id/canned_answers',auth[_0x226f('0x6')](),controller[_0x226f('0x12')]);router[_0x226f('0x10')]('/:id/notify',controller[_0x226f('0x13')]);router[_0x226f('0x10')](_0x226f('0xc'),auth['isAuthenticated'](),controller[_0x226f('0x14')]);router[_0x226f('0x10')](_0x226f('0xf'),auth[_0x226f('0x6')](),controller['addAgents']);router[_0x226f('0x10')]('/:id/send',auth[_0x226f('0x6')](),controller[_0x226f('0x15')]);router[_0x226f('0x16')](_0x226f('0x17'),auth['isAuthenticated'](),controller[_0x226f('0x18')]);router[_0x226f('0x19')](_0x226f('0x17'),auth['isAuthenticated'](),controller[_0x226f('0x1a')]);router[_0x226f('0x19')](_0x226f('0x9'),auth[_0x226f('0x6')](),controller[_0x226f('0x1b')]);router[_0x226f('0x19')](_0x226f('0xb'),auth[_0x226f('0x6')](),controller[_0x226f('0x1c')]);router[_0x226f('0x19')](_0x226f('0xf'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x226f('0x1d')]=router; \ No newline at end of file +var _0x93f8=['delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents','post','create','/:id/notify','notify','addApplications','addAgents','send','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93f8,0x19d));var _0x893f=function(_0x40a458,_0x463e0f){_0x40a458=_0x40a458-0x0;var _0x4387c3=_0x93f8[_0x40a458];return _0x4387c3;};'use strict';var multer=require('multer');var util=require(_0x893f('0x0'));var path=require(_0x893f('0x1'));var timeout=require(_0x893f('0x2'));var express=require(_0x893f('0x3'));var router=express[_0x893f('0x4')]();var fs_extra=require(_0x893f('0x5'));var auth=require(_0x893f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x893f('0x7'));var controller=require(_0x893f('0x8'));router[_0x893f('0x9')]('/',auth[_0x893f('0xa')](),controller['index']);router[_0x893f('0x9')](_0x893f('0xb'),auth['isAuthenticated'](),controller[_0x893f('0xc')]);router[_0x893f('0x9')](_0x893f('0xd'),auth[_0x893f('0xa')](),controller['show']);router['get'](_0x893f('0xe'),auth[_0x893f('0xa')](),controller[_0x893f('0xf')]);router[_0x893f('0x9')](_0x893f('0x10'),auth['isAuthenticated'](),controller[_0x893f('0x11')]);router[_0x893f('0x9')](_0x893f('0x12'),auth['isAuthenticated'](),controller[_0x893f('0x13')]);router[_0x893f('0x9')](_0x893f('0x14'),auth[_0x893f('0xa')](),controller['getInteractions']);router['get'](_0x893f('0x15'),auth[_0x893f('0xa')](),controller[_0x893f('0x16')]);router[_0x893f('0x17')]('/',auth['isAuthenticated'](),controller[_0x893f('0x18')]);router[_0x893f('0x17')](_0x893f('0xe'),auth[_0x893f('0xa')](),controller['addDisposition']);router['post'](_0x893f('0x10'),auth[_0x893f('0xa')](),controller['addAnswer']);router['post'](_0x893f('0x19'),controller[_0x893f('0x1a')]);router[_0x893f('0x17')](_0x893f('0x12'),auth[_0x893f('0xa')](),controller[_0x893f('0x1b')]);router[_0x893f('0x17')](_0x893f('0x15'),auth[_0x893f('0xa')](),controller[_0x893f('0x1c')]);router[_0x893f('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0x893f('0x1d')]);router[_0x893f('0x1e')](_0x893f('0xd'),auth[_0x893f('0xa')](),controller['update']);router[_0x893f('0x1f')]('/:id',auth[_0x893f('0xa')](),controller[_0x893f('0x20')]);router[_0x893f('0x1f')]('/:id/dispositions',auth[_0x893f('0xa')](),controller[_0x893f('0x21')]);router['delete'](_0x893f('0x10'),auth[_0x893f('0xa')](),controller[_0x893f('0x22')]);router['delete'](_0x893f('0x15'),auth[_0x893f('0xa')](),controller[_0x893f('0x23')]);module[_0x893f('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index cb765f5..7a18aa9 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 _0x63d5=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','name','STRING','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x18ca74,_0x1fe2aa){var _0x5c853b=function(_0x396362){while(--_0x396362){_0x18ca74['push'](_0x18ca74['shift']());}};_0x5c853b(++_0x1fe2aa);}(_0x63d5,0x122));var _0x563d=function(_0x15a346,_0x46d825){_0x15a346=_0x15a346-0x0;var _0x275a0f=_0x63d5[_0x15a346];return _0x275a0f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x563d('0x0'));module[_0x563d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x563d('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x563d('0x3')]},'token':{'type':Sequelize[_0x563d('0x3')],'defaultValue':function(){return rs[_0x563d('0x4')]();}},'replyUri':{'type':Sequelize[_0x563d('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x563d('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x563d('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x563d('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x563d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x563d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x563d('0x3')]},'queueTransfer':{'type':Sequelize[_0x563d('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x563d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x563d('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x563d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x563d('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x563d('0x6')],'defaultValue':![],'comment':_0x563d('0x9'),'set':function(_0xf5fc3f){if(!_0xf5fc3f)this[_0x563d('0xa')](_0x563d('0xb'),null);this[_0x563d('0xa')](_0x563d('0xc'),_0xf5fc3f);}}}; \ No newline at end of file +var _0xb9d5=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','randomstring','exports','name','STRING'];(function(_0x3da093,_0x3c3205){var _0x58f37d=function(_0x45bb9f){while(--_0x45bb9f){_0x3da093['push'](_0x3da093['shift']());}};_0x58f37d(++_0x3c3205);}(_0xb9d5,0x16e));var _0x5b9d=function(_0x2e6734,_0x4c6daa){_0x2e6734=_0x2e6734-0x0;var _0x36aef9=_0xb9d5[_0x2e6734];return _0x36aef9;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x5b9d('0x0'));module[_0x5b9d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5b9d('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x5b9d('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x5b9d('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5b9d('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5b9d('0x4')],'defaultValue':function(){return _0x5b9d('0x5');}},'notificationSound':{'type':Sequelize[_0x5b9d('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5b9d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5b9d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5b9d('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5b9d('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5b9d('0x6')],'defaultValue':![],'comment':_0x5b9d('0x8'),'set':function(_0x186853){if(!_0x186853)this[_0x5b9d('0x9')]('mandatoryDispositionPauseId',null);this[_0x5b9d('0x9')]('mandatoryDisposition',_0x186853);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 1b46008..7f1fb9e 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 _0x5d17=['removeAnswers','notify','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','OpenchannelApplication','List','account','Applications','list','applications','orderBy','priority','asc','defaults','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','waitForTheAssignedQueue','Start','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','sendStatus','send','getApplications','getInteractions','Contact','User','Owner','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','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','redis','localhost','socket.io-emitter','client','http','request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','status','json','undefined','count','offset','limit','set','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','end','stack','name','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','describe','OpenchannelAccountId','Disposition','getDispositions','hasOwnProperty','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x5d17,0x114));var _0x75d1=function(_0x154d1e,_0x1f705a){_0x154d1e=_0x154d1e-0x0;var _0x17568e=_0x5d17[_0x154d1e];return _0x17568e;};'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'];config[_0x75d1('0x17')]=_['defaults'](config[_0x75d1('0x17')],{'host':_0x75d1('0x18'),'port':0x18eb});var socket=require(_0x75d1('0x19'))(new Redis(config[_0x75d1('0x17')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x75d1('0x1a')][_0x75d1('0x1b')]({'port':0x232c});var client9002=jayson[_0x75d1('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f9620,_0x3fff9b,_0x1d30f3,_0x269e82){return new BPromise(function(_0x1160ca,_0x39a26b){var _0x2845bc=_0x269e82||client;return _0x2845bc[_0x75d1('0x1c')](_0x1f9620,_0x1d30f3)[_0x75d1('0x1d')](function(_0x3d0717){logger[_0x75d1('0x1e')]('OpenchannelAccount,\x20%s,\x20%s',_0x3fff9b,'request\x20sent');logger[_0x75d1('0x1f')](_0x75d1('0x20'),_0x3fff9b,'request\x20sent',JSON[_0x75d1('0x21')](_0x3d0717));if(_0x3d0717[_0x75d1('0x22')]){if(_0x3d0717[_0x75d1('0x22')][_0x75d1('0x23')]===0x1f4){logger[_0x75d1('0x22')](_0x75d1('0x24'),_0x3fff9b,_0x3d0717['error'][_0x75d1('0x25')]);return _0x39a26b(_0x3d0717[_0x75d1('0x22')]['message']);}logger[_0x75d1('0x22')](_0x75d1('0x24'),_0x3fff9b,_0x3d0717['error'][_0x75d1('0x25')]);return _0x1160ca(_0x3d0717['error'][_0x75d1('0x25')]);}else{logger[_0x75d1('0x1e')](_0x75d1('0x24'),_0x3fff9b,'request\x20sent');_0x1160ca(_0x3d0717['result'][_0x75d1('0x25')]);}})[_0x75d1('0x26')](function(_0x315ce5){logger[_0x75d1('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x3fff9b,_0x315ce5);_0x39a26b(_0x315ce5);});});}function respondWithStatusCode(_0x280498,_0x2b5848){_0x2b5848=_0x2b5848||0xcc;return function(_0x367238){if(_0x367238){return _0x280498['sendStatus'](_0x2b5848);}return _0x280498['status'](_0x2b5848)['end']();};}function respondWithResult(_0x364dc9,_0x30d9f3){_0x30d9f3=_0x30d9f3||0xc8;return function(_0x45c182){if(_0x45c182){return _0x364dc9[_0x75d1('0x27')](_0x30d9f3)[_0x75d1('0x28')](_0x45c182);}};}function respondWithFilteredResult(_0x519ceb,_0x4d292e){return function(_0x410e16){if(_0x410e16){var _0x197f52=typeof _0x4d292e['offset']===_0x75d1('0x29')&&typeof _0x4d292e['limit']===_0x75d1('0x29');var _0x244da6=_0x410e16[_0x75d1('0x2a')];var _0x3fb7b9=_0x197f52?0x0:_0x4d292e[_0x75d1('0x2b')];var _0x506b93=_0x197f52?_0x410e16[_0x75d1('0x2a')]:_0x4d292e[_0x75d1('0x2b')]+_0x4d292e[_0x75d1('0x2c')];var _0x84d9ae;if(_0x506b93>=_0x244da6){_0x506b93=_0x244da6;_0x84d9ae=0xc8;}else{_0x84d9ae=0xce;}_0x519ceb['status'](_0x84d9ae);return _0x519ceb[_0x75d1('0x2d')]('Content-Range',_0x3fb7b9+'-'+_0x506b93+'/'+_0x244da6)[_0x75d1('0x28')](_0x410e16);}return null;};}function patchUpdates(_0x31e072){return function(_0x4c449d){try{jsonpatch[_0x75d1('0x2e')](_0x4c449d,_0x31e072,!![]);}catch(_0x39d0ff){return BPromise[_0x75d1('0x2f')](_0x39d0ff);}return _0x4c449d[_0x75d1('0x30')]();};}function saveUpdates(_0x22b190,_0x495aa4){return function(_0x23f94a){if(_0x23f94a){return _0x23f94a[_0x75d1('0x31')](_0x22b190)[_0x75d1('0x1d')](function(_0xa0f4c9){return _0xa0f4c9;});}return null;};}function removeEntity(_0x4b936c,_0x5bd3d7){return function(_0x551723){if(_0x551723){return _0x551723[_0x75d1('0x32')]()[_0x75d1('0x1d')](function(){var _0x40dc07=_0x551723[_0x75d1('0x33')]({'plain':!![]});var _0x38972c=_0x75d1('0x34');return db[_0x75d1('0x35')][_0x75d1('0x32')]({'where':{'type':_0x38972c,'resourceId':_0x40dc07['id']}})[_0x75d1('0x1d')](function(){return _0x551723;});})['then'](function(){_0x4b936c[_0x75d1('0x27')](0xcc)[_0x75d1('0x36')]();});}};}function handleEntityNotFound(_0x39ac3e,_0x62b37e){return function(_0x6d48a5){if(!_0x6d48a5){_0x39ac3e['sendStatus'](0x194);}return _0x6d48a5;};}function handleError(_0x4f79d9,_0x487431){_0x487431=_0x487431||0x1f4;return function(_0x1058b7){logger[_0x75d1('0x22')](_0x1058b7[_0x75d1('0x37')]);if(_0x1058b7[_0x75d1('0x38')]){delete _0x1058b7[_0x75d1('0x38')];}_0x4f79d9[_0x75d1('0x27')](_0x487431)['send'](_0x1058b7);};}exports['index']=function(_0x5efaea,_0x3f2569){var _0x4cb084={'include':[{'model':db[_0x75d1('0x39')],'as':_0x75d1('0x3a')}]},_0x53a1af={},_0x450aa5={'count':0x0,'rows':[]};var _0x46854c=_['map'](db[_0x75d1('0x3b')][_0x75d1('0x3c')],function(_0x38bf47){return{'name':_0x38bf47[_0x75d1('0x3d')],'type':_0x38bf47[_0x75d1('0x3e')][_0x75d1('0x3f')]};});_0x53a1af[_0x75d1('0x40')]=_[_0x75d1('0x41')](_0x46854c,_0x75d1('0x38'));_0x53a1af[_0x75d1('0x42')]=_[_0x75d1('0x43')](_0x5efaea[_0x75d1('0x42')]);_0x53a1af[_0x75d1('0x44')]=_[_0x75d1('0x45')](_0x53a1af[_0x75d1('0x40')],_0x53a1af[_0x75d1('0x42')]);_0x4cb084[_0x75d1('0x46')]=_[_0x75d1('0x45')](_0x53a1af[_0x75d1('0x40')],qs[_0x75d1('0x47')](_0x5efaea[_0x75d1('0x42')][_0x75d1('0x47')]));_0x4cb084['attributes']=_0x4cb084['attributes'][_0x75d1('0x48')]?_0x4cb084[_0x75d1('0x46')]:_0x53a1af[_0x75d1('0x40')];if(!_0x5efaea[_0x75d1('0x42')]['hasOwnProperty'](_0x75d1('0x49'))){_0x4cb084[_0x75d1('0x2c')]=qs[_0x75d1('0x2c')](_0x5efaea[_0x75d1('0x42')]['limit']);_0x4cb084[_0x75d1('0x2b')]=qs[_0x75d1('0x2b')](_0x5efaea[_0x75d1('0x42')][_0x75d1('0x2b')]);}_0x4cb084['order']=qs[_0x75d1('0x4a')](_0x5efaea['query'][_0x75d1('0x4a')]);_0x4cb084[_0x75d1('0x4b')]=qs[_0x75d1('0x44')](_[_0x75d1('0x4c')](_0x5efaea[_0x75d1('0x42')],_0x53a1af[_0x75d1('0x44')]),_0x46854c);if(_0x5efaea['query'][_0x75d1('0x4d')]){_0x4cb084['where']=_['merge'](_0x4cb084[_0x75d1('0x4b')],{'$or':_[_0x75d1('0x41')](_0x46854c,function(_0x4760cf){if(_0x4760cf[_0x75d1('0x3e')]!==_0x75d1('0x4e')){var _0x15567a={};_0x15567a[_0x4760cf[_0x75d1('0x38')]]={'$like':'%'+_0x5efaea['query']['filter']+'%'};return _0x15567a;}})});}_0x4cb084=_[_0x75d1('0x4f')]({},_0x4cb084,_0x5efaea[_0x75d1('0x50')]);var _0x50def3={'where':_0x4cb084[_0x75d1('0x4b')]};return db[_0x75d1('0x3b')][_0x75d1('0x2a')](_0x50def3)['then'](function(_0x1c70ba){_0x450aa5[_0x75d1('0x2a')]=_0x1c70ba;if(_0x5efaea[_0x75d1('0x42')][_0x75d1('0x51')]){_0x4cb084[_0x75d1('0x52')]=[{'all':!![]}];}return db[_0x75d1('0x3b')][_0x75d1('0x53')](_0x4cb084);})['then'](function(_0x1eaa66){_0x450aa5[_0x75d1('0x54')]=_0x1eaa66;return _0x450aa5;})[_0x75d1('0x1d')](respondWithFilteredResult(_0x3f2569,_0x4cb084))[_0x75d1('0x26')](handleError(_0x3f2569,null));};exports[_0x75d1('0x55')]=function(_0x326f42,_0x40a179){var _0x595ec7={'raw':![],'where':{'id':_0x326f42[_0x75d1('0x56')]['id']},'include':[{'model':db[_0x75d1('0x39')],'as':'mandatoryDispositionPause'}]},_0x7da202={};_0x7da202[_0x75d1('0x40')]=_[_0x75d1('0x43')](db[_0x75d1('0x3b')][_0x75d1('0x3c')]);_0x7da202[_0x75d1('0x42')]=_[_0x75d1('0x43')](_0x326f42['query']);_0x7da202[_0x75d1('0x44')]=_[_0x75d1('0x45')](_0x7da202[_0x75d1('0x40')],_0x7da202[_0x75d1('0x42')]);_0x595ec7[_0x75d1('0x46')]=_[_0x75d1('0x45')](_0x7da202[_0x75d1('0x40')],qs[_0x75d1('0x47')](_0x326f42[_0x75d1('0x42')][_0x75d1('0x47')]));_0x595ec7[_0x75d1('0x46')]=_0x595ec7[_0x75d1('0x46')]['length']?_0x595ec7['attributes']:_0x7da202[_0x75d1('0x40')];if(_0x326f42['query'][_0x75d1('0x51')]){_0x595ec7[_0x75d1('0x52')]=[{'all':!![]}];}_0x595ec7=_['merge']({},_0x595ec7,_0x326f42[_0x75d1('0x50')]);return db[_0x75d1('0x3b')][_0x75d1('0x57')](_0x595ec7)[_0x75d1('0x1d')](handleEntityNotFound(_0x40a179,null))[_0x75d1('0x1d')](respondWithResult(_0x40a179,null))[_0x75d1('0x26')](handleError(_0x40a179,null));};exports[_0x75d1('0x58')]=function(_0x5048ef,_0x3c5da6){return db[_0x75d1('0x3b')][_0x75d1('0x58')](_0x5048ef[_0x75d1('0x59')],{})[_0x75d1('0x1d')](function(_0x434512){var _0x41f98f=_0x5048ef[_0x75d1('0x5a')][_0x75d1('0x33')]({'plain':!![]});if(!_0x41f98f)throw new Error(_0x75d1('0x5b'));if(_0x41f98f['role']==='user'){var _0x81bd8d=_0x434512[_0x75d1('0x33')]({'plain':!![]});var _0xd6a332='OpenchannelAccounts';return db[_0x75d1('0x5c')]['find']({'where':{'name':_0xd6a332,'userProfileId':_0x41f98f[_0x75d1('0x5d')]},'raw':!![]})[_0x75d1('0x1d')](function(_0x349852){if(_0x349852&&_0x349852[_0x75d1('0x5e')]===0x0){return db['UserProfileResource'][_0x75d1('0x58')]({'name':_0x81bd8d['name'],'resourceId':_0x81bd8d['id'],'type':_0x349852['name'],'sectionId':_0x349852['id']},{})[_0x75d1('0x1d')](function(){return _0x434512;});}else{return _0x434512;}})[_0x75d1('0x26')](function(_0x286658){logger[_0x75d1('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x286658);throw _0x286658;});}return _0x434512;})['then'](respondWithResult(_0x3c5da6,0xc9))[_0x75d1('0x26')](handleError(_0x3c5da6,null));};exports[_0x75d1('0x31')]=function(_0x4ec3c5,_0x1a52fa){if(_0x4ec3c5[_0x75d1('0x59')]['id']){delete _0x4ec3c5['body']['id'];}return db[_0x75d1('0x3b')][_0x75d1('0x57')]({'where':{'id':_0x4ec3c5[_0x75d1('0x56')]['id']},'include':[{'model':db[_0x75d1('0x39')],'as':_0x75d1('0x3a')}]})[_0x75d1('0x1d')](handleEntityNotFound(_0x1a52fa,null))[_0x75d1('0x1d')](saveUpdates(_0x4ec3c5[_0x75d1('0x59')],null))[_0x75d1('0x1d')](respondWithResult(_0x1a52fa,null))[_0x75d1('0x26')](handleError(_0x1a52fa,null));};exports[_0x75d1('0x32')]=function(_0x59c1f1,_0x245953){return db[_0x75d1('0x3b')][_0x75d1('0x57')]({'where':{'id':_0x59c1f1[_0x75d1('0x56')]['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x245953,null))[_0x75d1('0x1d')](removeEntity(_0x245953,null))[_0x75d1('0x26')](handleError(_0x245953,null));};exports['describe']=function(_0x5f4395,_0x1b1cc4){return db[_0x75d1('0x3b')][_0x75d1('0x5f')]()[_0x75d1('0x1d')](respondWithResult(_0x1b1cc4,null))[_0x75d1('0x26')](handleError(_0x1b1cc4,null));};exports['addDisposition']=function(_0x4a2ee9,_0x15c5e8,_0x3754d5){if(_0x4a2ee9['body']['id']){delete _0x4a2ee9[_0x75d1('0x59')]['id'];}return db[_0x75d1('0x3b')][_0x75d1('0x57')]({'where':{'id':_0x4a2ee9[_0x75d1('0x56')]['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x15c5e8,null))[_0x75d1('0x1d')](function(_0x5a4abc){if(_0x5a4abc){_0x4a2ee9['body'][_0x75d1('0x60')]=_0x5a4abc['id'];return db[_0x75d1('0x61')]['create'](_0x4a2ee9[_0x75d1('0x59')]);}})['then'](respondWithResult(_0x15c5e8,null))[_0x75d1('0x26')](handleError(_0x15c5e8,null));};exports[_0x75d1('0x62')]=function(_0x30fd13,_0x4a049e,_0x254cfe){var _0x1f9ac2={'raw':![],'where':{}};var _0x290587={};var _0x1baaca={'count':0x0,'rows':[]};return db[_0x75d1('0x3b')]['findOne']({'where':{'id':_0x30fd13['params']['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x4a049e,null))['then'](function(_0x3f15f3){if(_0x3f15f3){_0x290587[_0x75d1('0x40')]=_[_0x75d1('0x43')](db['Disposition']['rawAttributes']);_0x290587[_0x75d1('0x42')]=_['keys'](_0x30fd13[_0x75d1('0x42')]);_0x290587[_0x75d1('0x44')]=_[_0x75d1('0x45')](_0x290587['model'],_0x290587[_0x75d1('0x42')]);_0x1f9ac2[_0x75d1('0x46')]=_[_0x75d1('0x45')](_0x290587[_0x75d1('0x40')],qs[_0x75d1('0x47')](_0x30fd13[_0x75d1('0x42')][_0x75d1('0x47')]));_0x1f9ac2[_0x75d1('0x46')]=_0x1f9ac2[_0x75d1('0x46')][_0x75d1('0x48')]?_0x1f9ac2[_0x75d1('0x46')]:_0x290587[_0x75d1('0x40')];if(!_0x30fd13[_0x75d1('0x42')][_0x75d1('0x63')]('nolimit')){_0x1f9ac2['limit']=qs[_0x75d1('0x2c')](_0x30fd13[_0x75d1('0x42')]['limit']);_0x1f9ac2[_0x75d1('0x2b')]=qs['offset'](_0x30fd13['query']['offset']);}_0x1f9ac2[_0x75d1('0x64')]=qs[_0x75d1('0x4a')](_0x30fd13[_0x75d1('0x42')][_0x75d1('0x4a')]);_0x1f9ac2[_0x75d1('0x4b')]=qs['filters'](_[_0x75d1('0x4c')](_0x30fd13[_0x75d1('0x42')],_0x290587[_0x75d1('0x44')]));_0x1f9ac2[_0x75d1('0x4b')][_0x75d1('0x60')]=_0x3f15f3['id'];if(_0x30fd13['query'][_0x75d1('0x4d')]){_0x1f9ac2['where']=_[_0x75d1('0x4f')](_0x1f9ac2[_0x75d1('0x4b')],{'$or':_[_0x75d1('0x41')](_0x1f9ac2['attributes'],function(_0x506e05){var _0x4e88e9={};_0x4e88e9[_0x506e05]={'$like':'%'+_0x30fd13[_0x75d1('0x42')][_0x75d1('0x4d')]+'%'};return _0x4e88e9;})});}_0x1f9ac2=_[_0x75d1('0x4f')]({},_0x1f9ac2,_0x30fd13[_0x75d1('0x50')]);return db[_0x75d1('0x61')][_0x75d1('0x2a')]({'where':_0x1f9ac2['where']})[_0x75d1('0x1d')](function(_0x30508a){_0x1baaca['count']=_0x30508a;if(_0x30fd13[_0x75d1('0x42')]['includeAll']){_0x1f9ac2['include']=[{'all':!![]}];}return db['Disposition'][_0x75d1('0x53')](_0x1f9ac2);})['then'](function(_0x5852b3){_0x1baaca[_0x75d1('0x54')]=_0x5852b3;return _0x1baaca;});}})['then'](respondWithFilteredResult(_0x4a049e,_0x1f9ac2))[_0x75d1('0x26')](handleError(_0x4a049e,null));};exports[_0x75d1('0x65')]=function(_0x739cc2,_0xc939c9,_0x1cc123){return db[_0x75d1('0x3b')][_0x75d1('0x57')]({'where':{'id':_0x739cc2[_0x75d1('0x56')]['id']}})['then'](handleEntityNotFound(_0xc939c9,null))[_0x75d1('0x1d')](function(_0x479e60){if(_0x479e60){return _0x479e60[_0x75d1('0x65')](_0x739cc2[_0x75d1('0x42')][_0x75d1('0x66')]);}})['then'](respondWithStatusCode(_0xc939c9,null))[_0x75d1('0x26')](handleError(_0xc939c9,null));};exports[_0x75d1('0x67')]=function(_0x3ae1ad,_0x13ff2f,_0x3e24d0){if(_0x3ae1ad[_0x75d1('0x59')]['id']){delete _0x3ae1ad[_0x75d1('0x59')]['id'];}return db['OpenchannelAccount'][_0x75d1('0x57')]({'where':{'id':_0x3ae1ad[_0x75d1('0x56')]['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x13ff2f,null))[_0x75d1('0x1d')](function(_0x44143e){if(_0x44143e){_0x3ae1ad['body']['OpenchannelAccountId']=_0x44143e['id'];return db[_0x75d1('0x68')]['create'](_0x3ae1ad[_0x75d1('0x59')]);}})[_0x75d1('0x1d')](respondWithResult(_0x13ff2f,null))[_0x75d1('0x26')](handleError(_0x13ff2f,null));};exports[_0x75d1('0x69')]=function(_0x498137,_0x576ff0,_0x2e6c31){var _0x37c682={'raw':![],'where':{}};var _0x2cf6e0={};var _0x26ab88={'count':0x0,'rows':[]};return db[_0x75d1('0x3b')]['findOne']({'where':{'id':_0x498137[_0x75d1('0x56')]['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x576ff0,null))['then'](function(_0x16895a){if(_0x16895a){_0x2cf6e0[_0x75d1('0x40')]=_[_0x75d1('0x43')](db[_0x75d1('0x68')][_0x75d1('0x3c')]);_0x2cf6e0[_0x75d1('0x42')]=_['keys'](_0x498137[_0x75d1('0x42')]);_0x2cf6e0[_0x75d1('0x44')]=_[_0x75d1('0x45')](_0x2cf6e0[_0x75d1('0x40')],_0x2cf6e0[_0x75d1('0x42')]);_0x37c682[_0x75d1('0x46')]=_['intersection'](_0x2cf6e0[_0x75d1('0x40')],qs['fields'](_0x498137[_0x75d1('0x42')][_0x75d1('0x47')]));_0x37c682[_0x75d1('0x46')]=_0x37c682[_0x75d1('0x46')][_0x75d1('0x48')]?_0x37c682[_0x75d1('0x46')]:_0x2cf6e0['model'];if(!_0x498137[_0x75d1('0x42')][_0x75d1('0x63')](_0x75d1('0x49'))){_0x37c682['limit']=qs[_0x75d1('0x2c')](_0x498137[_0x75d1('0x42')]['limit']);_0x37c682[_0x75d1('0x2b')]=qs[_0x75d1('0x2b')](_0x498137[_0x75d1('0x42')][_0x75d1('0x2b')]);}_0x37c682[_0x75d1('0x64')]=qs[_0x75d1('0x4a')](_0x498137[_0x75d1('0x42')][_0x75d1('0x4a')]);_0x37c682[_0x75d1('0x4b')]=qs['filters'](_[_0x75d1('0x4c')](_0x498137[_0x75d1('0x42')],_0x2cf6e0['filters']));_0x37c682[_0x75d1('0x4b')][_0x75d1('0x60')]=_0x16895a['id'];if(_0x498137['query']['filter']){_0x37c682[_0x75d1('0x4b')]=_[_0x75d1('0x4f')](_0x37c682[_0x75d1('0x4b')],{'$or':_[_0x75d1('0x41')](_0x37c682['attributes'],function(_0x3f4df3){var _0x559b80={};_0x559b80[_0x3f4df3]={'$like':'%'+_0x498137[_0x75d1('0x42')][_0x75d1('0x4d')]+'%'};return _0x559b80;})});}_0x37c682=_[_0x75d1('0x4f')]({},_0x37c682,_0x498137[_0x75d1('0x50')]);return db[_0x75d1('0x68')][_0x75d1('0x2a')]({'where':_0x37c682[_0x75d1('0x4b')]})[_0x75d1('0x1d')](function(_0x425b3b){_0x26ab88[_0x75d1('0x2a')]=_0x425b3b;if(_0x498137[_0x75d1('0x42')][_0x75d1('0x51')]){_0x37c682[_0x75d1('0x52')]=[{'all':!![]}];}return db[_0x75d1('0x68')][_0x75d1('0x53')](_0x37c682);})[_0x75d1('0x1d')](function(_0x17be97){_0x26ab88['rows']=_0x17be97;return _0x26ab88;});}})[_0x75d1('0x1d')](respondWithFilteredResult(_0x576ff0,_0x37c682))[_0x75d1('0x26')](handleError(_0x576ff0,null));};exports[_0x75d1('0x6a')]=function(_0x6ec97a,_0x644bb7,_0x104ef2){return db[_0x75d1('0x3b')]['find']({'where':{'id':_0x6ec97a[_0x75d1('0x56')]['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x644bb7,null))[_0x75d1('0x1d')](function(_0x215d0f){if(_0x215d0f){return _0x215d0f[_0x75d1('0x6a')](_0x6ec97a[_0x75d1('0x42')][_0x75d1('0x66')]);}})[_0x75d1('0x1d')](respondWithStatusCode(_0x644bb7,null))[_0x75d1('0x26')](handleError(_0x644bb7,null));};exports[_0x75d1('0x6b')]=function(_0x393c7c,_0x368ced,_0x2cdee2){var _0x3487b7={'body':_0x393c7c[_0x75d1('0x59')],'channel':'openchannel'};var _0x4e50bd=[];var _0x15b51a=[];var _0x48317b={};var _0x190489=![];return db[_0x75d1('0x6c')]['describe']()[_0x75d1('0x1d')](function(_0x31f687){if(!_0x31f687){throw new db['Sequelize'][(_0x75d1('0x6d'))](_0x75d1('0x6e'));}_0x4e50bd=_[_0x75d1('0x6f')](_[_0x75d1('0x43')](_0x31f687),['createdAt',_0x75d1('0x70')]);_0x15b51a=_['difference'](_[_0x75d1('0x43')](_0x31f687),[_0x75d1('0x71'),_0x75d1('0x70'),_0x75d1('0x72'),_0x75d1('0x73')]);if(_0x393c7c['body']['id']){delete _0x393c7c['body']['id'];}if(_[_0x75d1('0x74')](_0x393c7c[_0x75d1('0x59')][_0x75d1('0x75')])){throw new db[(_0x75d1('0x76'))][(_0x75d1('0x6d'))](_0x75d1('0x77'));}if(_[_0x75d1('0x74')](_0x393c7c[_0x75d1('0x59')][_0x75d1('0x59')])||_0x393c7c[_0x75d1('0x59')][_0x75d1('0x59')]===''){throw new db[(_0x75d1('0x76'))][(_0x75d1('0x6d'))](_0x75d1('0x78'));}if(_[_0x75d1('0x74')](_0x393c7c['body'][_0x75d1('0x79')])){throw new db[(_0x75d1('0x76'))][(_0x75d1('0x6d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x15b51a);}if(!_[_0x75d1('0x7a')](_0x15b51a,_0x393c7c['body'][_0x75d1('0x79')])){throw new db[(_0x75d1('0x76'))][(_0x75d1('0x6d'))](_0x75d1('0x7b')+_0x15b51a);}_0x48317b[_0x393c7c['body'][_0x75d1('0x79')]]=_0x393c7c[_0x75d1('0x59')]['from'];})['then'](function(){return db['OpenchannelAccount'][_0x75d1('0x57')]({'where':{'id':_0x393c7c[_0x75d1('0x56')]['id']},'include':[{'model':db[_0x75d1('0x7c')],'as':'List','include':[{'model':db[_0x75d1('0x6c')],'as':_0x75d1('0x7d'),'where':_0x48317b,'limit':0x1,'order':[[_0x75d1('0x70'),_0x75d1('0x7e')]]}]},{'model':db[_0x75d1('0x7f')],'as':'Applications'}]});})[_0x75d1('0x1d')](handleEntityNotFound(_0x368ced,null))[_0x75d1('0x1d')](function(_0x38e11e){if(_0x38e11e&&_0x38e11e[_0x75d1('0x80')]){_0x3487b7[_0x75d1('0x81')]=_0x38e11e;_0x3487b7['applications']=_0x38e11e[_0x75d1('0x82')];_0x3487b7[_0x75d1('0x83')]=_0x38e11e[_0x75d1('0x80')];_0x3487b7[_0x75d1('0x84')]=_[_0x75d1('0x85')](_0x3487b7['applications'],[_0x75d1('0x86')],[_0x75d1('0x87')]);if(_0x3487b7[_0x75d1('0x81')][_0x75d1('0x82')]){delete _0x3487b7[_0x75d1('0x81')][_0x75d1('0x82')];}if(_0x3487b7[_0x75d1('0x81')][_0x75d1('0x80')]&&_0x3487b7[_0x75d1('0x81')][_0x75d1('0x80')][_0x75d1('0x7d')]['length']){return _0x3487b7[_0x75d1('0x81')][_0x75d1('0x80')]['Contacts'][0x0];}var _0x2f9892=_[_0x75d1('0x88')](_0x393c7c[_0x75d1('0x59')],{'firstName':_0x393c7c[_0x75d1('0x59')][_0x75d1('0x75')],'ListId':_0x38e11e[_0x75d1('0x73')]});_0x2f9892[_0x393c7c[_0x75d1('0x59')][_0x75d1('0x79')]]=_0x393c7c[_0x75d1('0x59')][_0x75d1('0x75')];return db[_0x75d1('0x6c')][_0x75d1('0x58')](_0x2f9892,{'fields':_0x4e50bd,'raw':!![]});}})[_0x75d1('0x1d')](handleEntityNotFound(_0x368ced,null))['then'](function(_0x122a61){_0x3487b7[_0x75d1('0x89')]=_0x122a61;if(_0x122a61){var _0x3c378c={'ContactId':_0x122a61['id'],'OpenchannelAccountId':_0x393c7c[_0x75d1('0x56')]['id'],'from':(_0x122a61[_0x75d1('0x8a')]||'')+'\x20'+(_0x122a61['lastName']||'')};var _0x3a903d={'OpenchannelAccountId':_0x393c7c[_0x75d1('0x56')]['id'],'closed':![]};if(_0x393c7c[_0x75d1('0x59')][_0x75d1('0x8b')]){_0x3a903d[_0x75d1('0x8b')]=_0x393c7c[_0x75d1('0x59')][_0x75d1('0x8b')];return db[_0x75d1('0x8c')][_0x75d1('0x57')]({'where':_0x3a903d})['then'](function(_0x454232){if(_0x454232){return[_0x454232,![]];}_0x3c378c[_0x75d1('0x8b')]=_0x393c7c[_0x75d1('0x59')][_0x75d1('0x8b')];_0x3c378c[_0x75d1('0x8d')]=_0x393c7c['body']['externalUrl'];return db[_0x75d1('0x8c')][_0x75d1('0x58')](_0x3c378c)[_0x75d1('0x1d')](function(_0x1ad8a9){return[_0x1ad8a9,!![]];});});}else{_0x3a903d[_0x75d1('0x8b')]=null;}_0x3a903d[_0x75d1('0x8e')]=_0x122a61['id'];return db[_0x75d1('0x8c')][_0x75d1('0x57')]({'where':_0x3a903d})[_0x75d1('0x1d')](function(_0x185bd6){if(_0x185bd6){return[_0x185bd6,![]];}return db[_0x75d1('0x8c')][_0x75d1('0x58')](_0x3c378c)[_0x75d1('0x1d')](function(_0x5d44ff){return[_0x5d44ff,!![]];});});}})[_0x75d1('0x8f')](function(_0x43a883,_0x594256){if(_0x43a883){_0x190489=_0x594256;if(!_0x594256){var _0x40efa2={'from':(_0x3487b7[_0x75d1('0x89')][_0x75d1('0x8a')]||'')+'\x20'+(_0x3487b7[_0x75d1('0x89')][_0x75d1('0x90')]||'')};if(_0x393c7c[_0x75d1('0x59')][_0x75d1('0x8b')]&&_0x393c7c[_0x75d1('0x59')][_0x75d1('0x91')]&&_0x393c7c[_0x75d1('0x59')][_0x75d1('0x8b')]!=_0x393c7c[_0x75d1('0x59')]['messageId']){_0x40efa2['threadId']=_0x393c7c[_0x75d1('0x59')]['messageId'];}return _0x43a883['update'](_0x40efa2);}else{return _0x43a883;}}})[_0x75d1('0x1d')](function(_0x317848){_0x3487b7[_0x75d1('0x92')]=_0x317848[_0x75d1('0x33')]({'plain':!![]});_0x3487b7[_0x75d1('0x92')][_0x75d1('0x93')]=_0x190489;if(_0x3487b7[_0x75d1('0x92')][_0x75d1('0x93')]){if(_0x3487b7[_0x75d1('0x81')]['autoclose']){_0x3487b7[_0x75d1('0x84')][_0x75d1('0x94')]({'id':0x0,'priority':_0x3487b7['applications'][_0x75d1('0x48')]+0x1,'app':_0x75d1('0x95'),'appdata':'unmanaged','interval':_0x75d1('0x96')});}}return db[_0x75d1('0x97')]['create']({'body':_0x393c7c[_0x75d1('0x59')][_0x75d1('0x59')],'OpenchannelAccountId':_0x393c7c[_0x75d1('0x56')]['id'],'OpenchannelInteractionId':_0x317848['id'],'direction':'in','ContactId':_0x3487b7['contact']['id'],'AttachmentId':_0x393c7c[_0x75d1('0x59')][_0x75d1('0x98')]});})[_0x75d1('0x1d')](function(_0x4b7436){_0x3487b7[_0x75d1('0x25')]=_0x4b7436;if(!_0x3487b7['interaction'][_0x75d1('0x99')])return;return db['User']['find']({'attributes':['id',_0x75d1('0x38')],'where':{'id':_0x3487b7[_0x75d1('0x92')][_0x75d1('0x99')]}});})['then'](function(_0x7fed80){if(_0x7fed80){_0x3487b7['applications'][_0x75d1('0x9a')]({'id':0x0,'priority':0x0,'app':_0x75d1('0x9b'),'appdata':_0x7fed80[_0x75d1('0x38')]+','+(_0x3487b7[_0x75d1('0x81')][_0x75d1('0x9c')]||0xa),'interval':_0x75d1('0x96')});}if(!_0x3487b7['interaction'][_0x75d1('0x9d')])return;return db[_0x75d1('0x9e')][_0x75d1('0x57')]({'attributes':['id',_0x75d1('0x38')],'where':{'id':_0x3487b7['interaction'][_0x75d1('0x9d')]}});})[_0x75d1('0x1d')](function(_0x201ee4){if(_0x201ee4){_0x3487b7['applications'][_0x75d1('0x9a')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x201ee4['name']+','+(_0x3487b7[_0x75d1('0x81')][_0x75d1('0x9f')]||0x12c),'interval':_0x75d1('0x96')});}return respondWithRpcPromise(_0x75d1('0xa0'),'startRouting',_0x3487b7);})[_0x75d1('0x1d')](function(_0x1b3e9a){respondWithRpcPromise(_0x75d1('0xa1'),'EventManager',{'event':_0x75d1('0x6b'),'message':_0x1b3e9a},client9002);return _0x1b3e9a;})[_0x75d1('0x1d')](respondWithResult(_0x368ced,null))['catch'](handleError(_0x368ced,null));};exports[_0x75d1('0xa2')]=function(_0x50b0a5,_0x15f84c){var _0x580ebf=_0x50b0a5[_0x75d1('0x56')]['id'];var _0x806a80=_0x50b0a5[_0x75d1('0x59')];var _0x554043=0xc8;var _0x3c9f88=null;return db[_0x75d1('0xa3')][_0x75d1('0xa4')]({'isolationLevel':db[_0x75d1('0xa3')]['Transaction'][_0x75d1('0xa5')][_0x75d1('0xa6')]},function(_0x1dd6c9){return db[_0x75d1('0x3b')]['findOne']({'where':{'id':_0x580ebf},'transaction':_0x1dd6c9})[_0x75d1('0x1d')](function(_0x585db6){if(_0x585db6){return db[_0x75d1('0x7f')][_0x75d1('0x32')]({'where':{'OpenchannelAccountId':_0x580ebf},'transaction':_0x1dd6c9})[_0x75d1('0x1d')](function(){var _0x17737f=_[_0x75d1('0x41')](_0x806a80,function(_0x2a106b){_0x2a106b['OpenchannelAccountId']=_0x580ebf;return _0x2a106b;});return db[_0x75d1('0x7f')][_0x75d1('0xa7')](_0x17737f,{'transaction':_0x1dd6c9});});}else{_0x554043=0x194;_0x3c9f88=[];}});})[_0x75d1('0x1d')](function(){if(_0x554043!==0x194){return db[_0x75d1('0x7f')][_0x75d1('0xa8')]({'where':{'OpenchannelAccountId':_0x580ebf},'order':_0x75d1('0x86')})[_0x75d1('0x1d')](function(_0x5ffbfc){_0x3c9f88=_0x5ffbfc;});}})[_0x75d1('0x26')](function(_0x392efc){_0x554043=0x1f4;logger['error'](_0x392efc[_0x75d1('0x37')]);if(_0x392efc['name']){delete _0x392efc[_0x75d1('0x38')];}_0x3c9f88=_0x392efc;})[_0x75d1('0xa9')](function(){if(_0x3c9f88===null){_0x15f84c[_0x75d1('0xaa')](_0x554043);}else{if(_0x554043===0x1f4){_0x15f84c[_0x75d1('0x27')](_0x554043)[_0x75d1('0xab')](_0x3c9f88);}else{_0x15f84c[_0x75d1('0x27')](_0x554043)[_0x75d1('0x28')](_0x3c9f88);}}});};exports[_0x75d1('0xac')]=function(_0x2c1251,_0x5a9604,_0x240b68){var _0x3eafc6={};var _0x1cfd74={};var _0x45bc61;var _0x11c9a1;return db[_0x75d1('0x3b')]['findOne']({'where':{'id':_0x2c1251[_0x75d1('0x56')]['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x5a9604,null))[_0x75d1('0x1d')](function(_0x543d2e){if(_0x543d2e){_0x45bc61=_0x543d2e;_0x1cfd74[_0x75d1('0x40')]=_[_0x75d1('0x43')](db[_0x75d1('0x7f')][_0x75d1('0x3c')]);_0x1cfd74[_0x75d1('0x42')]=_[_0x75d1('0x43')](_0x2c1251[_0x75d1('0x42')]);_0x1cfd74[_0x75d1('0x44')]=_[_0x75d1('0x45')](_0x1cfd74[_0x75d1('0x40')],_0x1cfd74[_0x75d1('0x42')]);_0x3eafc6['attributes']=_[_0x75d1('0x45')](_0x1cfd74[_0x75d1('0x40')],qs[_0x75d1('0x47')](_0x2c1251[_0x75d1('0x42')][_0x75d1('0x47')]));_0x3eafc6[_0x75d1('0x46')]=_0x3eafc6[_0x75d1('0x46')][_0x75d1('0x48')]?_0x3eafc6[_0x75d1('0x46')]:_0x1cfd74[_0x75d1('0x40')];_0x3eafc6[_0x75d1('0x64')]=qs[_0x75d1('0x4a')](_0x2c1251[_0x75d1('0x42')]['sort']);_0x3eafc6[_0x75d1('0x4b')]=qs['filters'](_['pick'](_0x2c1251[_0x75d1('0x42')],_0x1cfd74[_0x75d1('0x44')]));if(_0x2c1251[_0x75d1('0x42')][_0x75d1('0x4d')]){_0x3eafc6[_0x75d1('0x4b')]=_[_0x75d1('0x4f')](_0x3eafc6[_0x75d1('0x4b')],{'$or':_['map'](_0x3eafc6['attributes'],function(_0x280dfc){var _0x3c8943={};_0x3c8943[_0x280dfc]={'$like':'%'+_0x2c1251[_0x75d1('0x42')]['filter']+'%'};return _0x3c8943;})});}_0x3eafc6=_[_0x75d1('0x4f')]({},_0x3eafc6,_0x2c1251['options']);return _0x45bc61[_0x75d1('0xac')](_0x3eafc6);}})[_0x75d1('0x1d')](function(_0x2f4d9f){if(_0x2f4d9f){_0x11c9a1=_0x2f4d9f[_0x75d1('0x48')];if(!_0x2c1251[_0x75d1('0x42')][_0x75d1('0x63')]('nolimit')){_0x3eafc6['limit']=qs[_0x75d1('0x2c')](_0x2c1251[_0x75d1('0x42')][_0x75d1('0x2c')]);_0x3eafc6[_0x75d1('0x2b')]=qs['offset'](_0x2c1251['query'][_0x75d1('0x2b')]);}return _0x45bc61[_0x75d1('0xac')](_0x3eafc6);}})[_0x75d1('0x1d')](function(_0x148c71){if(_0x148c71){return _0x148c71?{'count':_0x11c9a1,'rows':_0x148c71}:null;}})[_0x75d1('0x1d')](respondWithResult(_0x5a9604,null))['catch'](handleError(_0x5a9604,null));};exports[_0x75d1('0xad')]=function(_0xebad70,_0x1ac7b7,_0x271752){var _0x2b7d00={'raw':![],'where':{}};var _0x5022f0={};var _0x16c91d={'count':0x0,'rows':[]};return db[_0x75d1('0x3b')]['findOne']({'where':{'id':_0xebad70['params']['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x1ac7b7,null))['then'](function(_0x49e8ab){if(_0x49e8ab){_0x5022f0[_0x75d1('0x40')]=_['keys'](db[_0x75d1('0x8c')][_0x75d1('0x3c')]);_0x5022f0[_0x75d1('0x42')]=_[_0x75d1('0x43')](_0xebad70[_0x75d1('0x42')]);_0x5022f0[_0x75d1('0x44')]=_[_0x75d1('0x45')](_0x5022f0[_0x75d1('0x40')],_0x5022f0['query']);_0x2b7d00[_0x75d1('0x46')]=_[_0x75d1('0x45')](_0x5022f0[_0x75d1('0x40')],qs[_0x75d1('0x47')](_0xebad70[_0x75d1('0x42')]['fields']));_0x2b7d00['attributes']=_0x2b7d00['attributes']['length']?_0x2b7d00[_0x75d1('0x46')]:_0x5022f0[_0x75d1('0x40')];if(!_0xebad70[_0x75d1('0x42')][_0x75d1('0x63')](_0x75d1('0x49'))){_0x2b7d00[_0x75d1('0x2c')]=qs[_0x75d1('0x2c')](_0xebad70[_0x75d1('0x42')][_0x75d1('0x2c')]);_0x2b7d00[_0x75d1('0x2b')]=qs[_0x75d1('0x2b')](_0xebad70[_0x75d1('0x42')][_0x75d1('0x2b')]);}_0x2b7d00['order']=qs[_0x75d1('0x4a')](_0xebad70[_0x75d1('0x42')][_0x75d1('0x4a')]);_0x2b7d00[_0x75d1('0x4b')]=qs['filters'](_['pick'](_0xebad70['query'],_0x5022f0['filters']));_0x2b7d00[_0x75d1('0x4b')][_0x75d1('0x60')]=_0x49e8ab['id'];if(_0xebad70[_0x75d1('0x42')][_0x75d1('0x4d')]){_0x2b7d00['where']=_[_0x75d1('0x4f')](_0x2b7d00[_0x75d1('0x4b')],{'$or':_[_0x75d1('0x41')](_0x2b7d00['attributes'],function(_0x3cb26d){var _0x646ea7={};_0x646ea7[_0x3cb26d]={'$like':'%'+_0xebad70[_0x75d1('0x42')][_0x75d1('0x4d')]+'%'};return _0x646ea7;})});}_0x2b7d00=_[_0x75d1('0x4f')]({},_0x2b7d00,_0xebad70[_0x75d1('0x50')]);return db[_0x75d1('0x8c')][_0x75d1('0x2a')]({'where':_0x2b7d00['where']})[_0x75d1('0x1d')](function(_0x574ab4){_0x16c91d[_0x75d1('0x2a')]=_0x574ab4;if(_0xebad70['query'][_0x75d1('0x51')]){_0x2b7d00[_0x75d1('0x52')]=[{'model':db['CmContact'],'as':_0x75d1('0xae'),'required':![]},{'model':db[_0x75d1('0xaf')],'as':_0x75d1('0xb0'),'attributes':[_0x75d1('0x38'),'fullname','internal'],'required':![]},{'model':db[_0x75d1('0xb1')],'as':_0x75d1('0xb2'),'attributes':['id',_0x75d1('0x38'),_0x75d1('0xb3')],'where':_0xebad70[_0x75d1('0x42')]['tag']?{'id':_0xebad70[_0x75d1('0x42')][_0x75d1('0xb4')]}:undefined,'required':_0xebad70[_0x75d1('0x42')][_0x75d1('0xb4')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x75d1('0x53')](_0x2b7d00);})[_0x75d1('0x1d')](function(_0x365126){_0x16c91d[_0x75d1('0x54')]=_0x365126;return _0x16c91d;});}})[_0x75d1('0x1d')](respondWithFilteredResult(_0x1ac7b7,_0x2b7d00))['catch'](handleError(_0x1ac7b7,null));};exports['addAgents']=function(_0x375dca,_0x22314d,_0x54b635){return db[_0x75d1('0x3b')][_0x75d1('0x57')]({'where':{'id':_0x375dca[_0x75d1('0x56')]['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x22314d,null))[_0x75d1('0x1d')](function(_0x2852eb){if(_0x2852eb){return _0x2852eb[_0x75d1('0xb5')](_0x375dca[_0x75d1('0x59')][_0x75d1('0x66')],_[_0x75d1('0xb6')](_0x375dca[_0x75d1('0x59')],[_0x75d1('0x66'),'id'])||{})[_0x75d1('0x8f')](function(_0x4e0a54){for(var _0xd5cbcb=0x0;_0xd5cbcb<_0x375dca['body'][_0x75d1('0x66')][_0x75d1('0x48')];_0xd5cbcb+=0x1){socket['emit'](_0x75d1('0xb7'),{'UserId':Number(_0x375dca['body'][_0x75d1('0x66')][_0xd5cbcb]),'OpenchannelAccountId':Number(_0x375dca[_0x75d1('0x56')]['id'])});}return _0x4e0a54;});}})['then'](respondWithResult(_0x22314d,null))[_0x75d1('0x26')](handleError(_0x22314d,null));};exports[_0x75d1('0xb8')]=function(_0xed04f7,_0x317b2e,_0x3c80b2){return db[_0x75d1('0x3b')][_0x75d1('0x57')]({'where':{'id':_0xed04f7['params']['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x317b2e,null))['then'](function(_0x27ab53){if(_0x27ab53){return _0x27ab53['removeAgents'](_0xed04f7[_0x75d1('0x42')][_0x75d1('0x66')])[_0x75d1('0x1d')](function(){if(_[_0x75d1('0xb9')](_0xed04f7[_0x75d1('0x42')][_0x75d1('0x66')])){for(var _0x136a3f=0x0;_0x136a3f<_0xed04f7[_0x75d1('0x42')][_0x75d1('0x66')][_0x75d1('0x48')];_0x136a3f+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0xed04f7[_0x75d1('0x42')][_0x75d1('0x66')][_0x136a3f]),'OpenchannelAccountId':Number(_0xed04f7['params']['id'])});}}else{socket['emit'](_0x75d1('0xba'),{'UserId':Number(_0xed04f7[_0x75d1('0x42')][_0x75d1('0x66')]),'OpenchannelAccountId':Number(_0xed04f7[_0x75d1('0x56')]['id'])});}});}})[_0x75d1('0x1d')](respondWithStatusCode(_0x317b2e,null))[_0x75d1('0x26')](handleError(_0x317b2e,null));};exports[_0x75d1('0xbb')]=function(_0x352282,_0x302bdc,_0x1f9c4b){var _0x2e9ccf={};var _0x54aaf2={};var _0x16127c;var _0x519911;return db[_0x75d1('0x3b')]['findOne']({'where':{'id':_0x352282[_0x75d1('0x56')]['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x302bdc,null))['then'](function(_0x1a7b1d){if(_0x1a7b1d){_0x16127c=_0x1a7b1d;_0x54aaf2[_0x75d1('0x40')]=_[_0x75d1('0x43')](db['User'][_0x75d1('0x3c')]);_0x54aaf2['query']=_[_0x75d1('0x43')](_0x352282[_0x75d1('0x42')]);_0x54aaf2[_0x75d1('0x44')]=_[_0x75d1('0x45')](_0x54aaf2[_0x75d1('0x40')],_0x54aaf2['query']);_0x2e9ccf[_0x75d1('0x46')]=_[_0x75d1('0x45')](_0x54aaf2[_0x75d1('0x40')],qs[_0x75d1('0x47')](_0x352282[_0x75d1('0x42')][_0x75d1('0x47')]));_0x2e9ccf['attributes']=_0x2e9ccf['attributes'][_0x75d1('0x48')]?_0x2e9ccf[_0x75d1('0x46')]:_0x54aaf2[_0x75d1('0x40')];_0x2e9ccf[_0x75d1('0x64')]=qs[_0x75d1('0x4a')](_0x352282[_0x75d1('0x42')][_0x75d1('0x4a')]);_0x2e9ccf[_0x75d1('0x4b')]=qs[_0x75d1('0x44')](_['pick'](_0x352282['query'],_0x54aaf2['filters']));if(_0x352282[_0x75d1('0x42')]['filter']){_0x2e9ccf[_0x75d1('0x4b')]=_['merge'](_0x2e9ccf[_0x75d1('0x4b')],{'$or':_[_0x75d1('0x41')](_0x2e9ccf[_0x75d1('0x46')],function(_0x38a890){var _0x20ac7b={};_0x20ac7b[_0x38a890]={'$like':'%'+_0x352282['query'][_0x75d1('0x4d')]+'%'};return _0x20ac7b;})});}_0x2e9ccf=_[_0x75d1('0x4f')]({},_0x2e9ccf,_0x352282[_0x75d1('0x50')]);return _0x16127c[_0x75d1('0xbb')](_0x2e9ccf);}})[_0x75d1('0x1d')](function(_0x131c29){if(_0x131c29){_0x519911=_0x131c29[_0x75d1('0x48')];if(!_0x352282[_0x75d1('0x42')][_0x75d1('0x63')](_0x75d1('0x49'))){_0x2e9ccf[_0x75d1('0x2c')]=qs['limit'](_0x352282[_0x75d1('0x42')][_0x75d1('0x2c')]);_0x2e9ccf[_0x75d1('0x2b')]=qs[_0x75d1('0x2b')](_0x352282['query'][_0x75d1('0x2b')]);}return _0x16127c[_0x75d1('0xbb')](_0x2e9ccf);}})[_0x75d1('0x1d')](function(_0x353788){if(_0x353788){return _0x353788?{'count':_0x519911,'rows':_0x353788}:null;}})[_0x75d1('0x1d')](respondWithResult(_0x302bdc,null))[_0x75d1('0x26')](handleError(_0x302bdc,null));};exports[_0x75d1('0xab')]=function(_0x595ed0,_0x20ffa6,_0x6eec16){var _0x3ca9cc,_0x417572,_0x3241d8;if(_[_0x75d1('0x74')](_0x595ed0['body'][_0x75d1('0x59')])||_0x595ed0[_0x75d1('0x59')][_0x75d1('0x59')]===''){throw new db['Sequelize']['ValidationError'](_0x75d1('0x78'));}if(_[_0x75d1('0x74')](_0x595ed0[_0x75d1('0x59')]['to'])){}_0x3ca9cc=_0x595ed0[_0x75d1('0x59')]['to'];return db[_0x75d1('0x3b')]['findOne']({'where':{'id':_0x595ed0['params']['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x20ffa6,null))[_0x75d1('0x1d')](function(_0x290683){if(_0x290683){return db[_0x75d1('0x3b')][_0x75d1('0x57')]({'where':{'id':_0x290683['id']},'include':[{'model':db[_0x75d1('0x7c')],'as':'List','include':[{'model':db[_0x75d1('0x6c')],'as':'Contacts','where':{[_0x290683[_0x75d1('0x79')]]:_0x3ca9cc},'limit':0x1,'order':[[_0x75d1('0x70'),_0x75d1('0x7e')]]}]}]})[_0x75d1('0x1d')](handleEntityNotFound(_0x20ffa6,null))['then'](function(_0x85841){if(_0x85841&&_0x85841[_0x75d1('0x80')]){_0x417572=_0x85841[_0x75d1('0x33')]({'plain':!![]});if(_0x417572[_0x75d1('0x80')]&&_0x417572[_0x75d1('0x80')]['Contacts']['length']){return _0x417572[_0x75d1('0x80')]['Contacts'][0x0];}return db['CmContact'][_0x75d1('0x58')](_[_0x75d1('0x88')](_0x595ed0['body'],{'firstName':_0x3ca9cc,[_0x85841[_0x75d1('0x79')]]:_0x3ca9cc,'phone':_0x3ca9cc,'ListId':_0x417572[_0x75d1('0x73')]}));}})[_0x75d1('0x1d')](handleEntityNotFound(_0x20ffa6,null))[_0x75d1('0x1d')](function(_0x41cb41){if(_0x41cb41){_0x3241d8=_0x41cb41;return db['OpenchannelInteraction'][_0x75d1('0x57')]({'where':{'ContactId':_0x3241d8['id'],'closed':![],'OpenchannelAccountId':_0x417572['id']}})[_0x75d1('0x1d')](function(_0x5059a2){if(_0x5059a2){return[_0x5059a2,![]];}return db[_0x75d1('0x8c')][_0x75d1('0x58')]({'UserId':_0x595ed0[_0x75d1('0x5a')]['id'],'ContactId':_0x3241d8['id'],'OpenchannelAccountId':_0x417572['id'],'lastMsgDirection':_0x75d1('0xbc'),'firstMsgDirection':'out','Messages':[_['merge'](_0x595ed0[_0x75d1('0x59')],{'read':![],'body':_0x595ed0[_0x75d1('0x59')][_0x75d1('0x59')],'OpenchannelAccountId':_0x417572['id'],'UserId':_0x595ed0[_0x75d1('0x5a')]['id'],'ContactId':_0x3241d8['id']})]},{'include':[{'model':db[_0x75d1('0x97')],'as':_0x75d1('0xbd')}]})['then'](function(_0x23ae18){return[_0x23ae18,!![]];});});}})[_0x75d1('0x8f')](function(_0x55ae18,_0x534a2a){if(_0x534a2a){return _0x55ae18;}return db[_0x75d1('0x97')][_0x75d1('0x58')](_[_0x75d1('0x4f')](_0x595ed0[_0x75d1('0x59')],{'read':![],'body':_0x595ed0[_0x75d1('0x59')]['body'],'OpenchannelAccountId':_0x417572['id'],'OpenchannelInteractionId':_0x55ae18['id'],'UserId':_0x595ed0[_0x75d1('0x5a')]['id'],'ContactId':_0x3241d8['id']}))[_0x75d1('0x1d')](function(_0x4ab153){_0x55ae18[_0x75d1('0xbe')][_0x75d1('0xbd')]=[];_0x55ae18[_0x75d1('0xbe')][_0x75d1('0xbd')]['push'](_0x4ab153['dataValues']);return _0x55ae18;});});}})[_0x75d1('0x1d')](respondWithResult(_0x20ffa6,null))[_0x75d1('0x26')](handleError(_0x20ffa6,null));}; \ No newline at end of file +var _0xb234=['mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','rawAttributes','includeAll','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','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','CannedAnswer','order','removeAnswers','notify','openchannel','CmContact','ValidationError','difference','createdAt','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','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','Applications','account','applications','List','priority','asc','contact','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','firstName','lastName','interaction','created','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','findAndCountAll','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause'];(function(_0x27f0c0,_0x31c3de){var _0x3208fe=function(_0xe23d54){while(--_0xe23d54){_0x27f0c0['push'](_0x27f0c0['shift']());}};_0x3208fe(++_0x31c3de);}(_0xb234,0x13f));var _0x4b23=function(_0x1d2ab3,_0x14f3d8){_0x1d2ab3=_0x1d2ab3-0x0;var _0x41f45c=_0xb234[_0x1d2ab3];return _0x41f45c;};'use strict';var emlformat=require(_0x4b23('0x0'));var rimraf=require(_0x4b23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b23('0x2'));var rp=require(_0x4b23('0x3'));var moment=require(_0x4b23('0x4'));var BPromise=require(_0x4b23('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4b23('0x6'));var sox=require(_0x4b23('0x7'));var csv=require('to-csv');var ejs=require(_0x4b23('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b23('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4b23('0xa'));var deskjs=require(_0x4b23('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4b23('0xc'));var Papa=require(_0x4b23('0xd'));var Redis=require('ioredis');var authService=require(_0x4b23('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4b23('0xf'));var hardwareService=require(_0x4b23('0x10'));var logger=require(_0x4b23('0x11'))(_0x4b23('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b23('0x13'))['db'];config[_0x4b23('0x14')]=_[_0x4b23('0x15')](config[_0x4b23('0x14')],{'host':_0x4b23('0x16'),'port':0x18eb});var socket=require(_0x4b23('0x17'))(new Redis(config[_0x4b23('0x14')]));require(_0x4b23('0x18'))[_0x4b23('0x19')](socket);var jayson=require(_0x4b23('0x1a'));var client=jayson['client'][_0x4b23('0x1b')]({'port':0x232c});var client9002=jayson[_0x4b23('0x1c')][_0x4b23('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x19938c,_0x2c37bc,_0x509904,_0x3788ab){return new BPromise(function(_0x41d9f8,_0x10f2ba){var _0xd4a985=_0x3788ab||client;return _0xd4a985[_0x4b23('0x1d')](_0x19938c,_0x509904)[_0x4b23('0x1e')](function(_0x56673a){logger[_0x4b23('0x1f')](_0x4b23('0x20'),_0x2c37bc,_0x4b23('0x21'));logger[_0x4b23('0x22')](_0x4b23('0x23'),_0x2c37bc,_0x4b23('0x21'),JSON[_0x4b23('0x24')](_0x56673a));if(_0x56673a[_0x4b23('0x25')]){if(_0x56673a['error']['code']===0x1f4){logger[_0x4b23('0x25')](_0x4b23('0x20'),_0x2c37bc,_0x56673a[_0x4b23('0x25')][_0x4b23('0x26')]);return _0x10f2ba(_0x56673a[_0x4b23('0x25')][_0x4b23('0x26')]);}logger[_0x4b23('0x25')](_0x4b23('0x20'),_0x2c37bc,_0x56673a[_0x4b23('0x25')][_0x4b23('0x26')]);return _0x41d9f8(_0x56673a['error'][_0x4b23('0x26')]);}else{logger['info'](_0x4b23('0x20'),_0x2c37bc,_0x4b23('0x21'));_0x41d9f8(_0x56673a['result'][_0x4b23('0x26')]);}})[_0x4b23('0x27')](function(_0x5331c2){logger['error'](_0x4b23('0x20'),_0x2c37bc,_0x5331c2);_0x10f2ba(_0x5331c2);});});}function respondWithStatusCode(_0xc01968,_0x2813b5){_0x2813b5=_0x2813b5||0xcc;return function(_0x1b8d5e){if(_0x1b8d5e){return _0xc01968['sendStatus'](_0x2813b5);}return _0xc01968[_0x4b23('0x28')](_0x2813b5)[_0x4b23('0x29')]();};}function respondWithResult(_0x2f73bd,_0x7dec61){_0x7dec61=_0x7dec61||0xc8;return function(_0x4e1f99){if(_0x4e1f99){return _0x2f73bd[_0x4b23('0x28')](_0x7dec61)[_0x4b23('0x2a')](_0x4e1f99);}};}function respondWithFilteredResult(_0x3ae265,_0x58bdc1){return function(_0x3f6df2){if(_0x3f6df2){var _0xbd04c3=typeof _0x58bdc1['offset']===_0x4b23('0x2b')&&typeof _0x58bdc1['limit']===_0x4b23('0x2b');var _0x3d6324=_0x3f6df2[_0x4b23('0x2c')];var _0x32a409=_0xbd04c3?0x0:_0x58bdc1[_0x4b23('0x2d')];var _0x4fbf51=_0xbd04c3?_0x3f6df2[_0x4b23('0x2c')]:_0x58bdc1[_0x4b23('0x2d')]+_0x58bdc1[_0x4b23('0x2e')];var _0x180383;if(_0x4fbf51>=_0x3d6324){_0x4fbf51=_0x3d6324;_0x180383=0xc8;}else{_0x180383=0xce;}_0x3ae265['status'](_0x180383);return _0x3ae265[_0x4b23('0x2f')](_0x4b23('0x30'),_0x32a409+'-'+_0x4fbf51+'/'+_0x3d6324)['json'](_0x3f6df2);}return null;};}function patchUpdates(_0x4f46ba){return function(_0x105414){try{jsonpatch['apply'](_0x105414,_0x4f46ba,!![]);}catch(_0x3d85a1){return BPromise['reject'](_0x3d85a1);}return _0x105414[_0x4b23('0x31')]();};}function saveUpdates(_0x323589,_0x3ff24f){return function(_0x301f5a){if(_0x301f5a){return _0x301f5a[_0x4b23('0x32')](_0x323589)['then'](function(_0x52d01a){return _0x52d01a;});}return null;};}function removeEntity(_0x20b5b8,_0x15c721){return function(_0x3d54a3){if(_0x3d54a3){return _0x3d54a3[_0x4b23('0x33')]()[_0x4b23('0x1e')](function(){var _0x480db5=_0x3d54a3[_0x4b23('0x34')]({'plain':!![]});var _0x49ef23=_0x4b23('0x35');return db[_0x4b23('0x36')][_0x4b23('0x33')]({'where':{'type':_0x49ef23,'resourceId':_0x480db5['id']}})[_0x4b23('0x1e')](function(){return _0x3d54a3;});})[_0x4b23('0x1e')](function(){_0x20b5b8[_0x4b23('0x28')](0xcc)[_0x4b23('0x29')]();});}};}function handleEntityNotFound(_0x3e4b36,_0xd3fb19){return function(_0x1ea199){if(!_0x1ea199){_0x3e4b36[_0x4b23('0x37')](0x194);}return _0x1ea199;};}function handleError(_0x50fdd8,_0x306d19){_0x306d19=_0x306d19||0x1f4;return function(_0x11a4d7){logger[_0x4b23('0x25')](_0x11a4d7[_0x4b23('0x38')]);if(_0x11a4d7[_0x4b23('0x39')]){delete _0x11a4d7['name'];}_0x50fdd8[_0x4b23('0x28')](_0x306d19)[_0x4b23('0x3a')](_0x11a4d7);};}exports[_0x4b23('0x3b')]=function(_0x392cc6,_0x1d730b){var _0x5a5d29={'include':[{'model':db[_0x4b23('0x3c')],'as':_0x4b23('0x3d')}]},_0x329af5={},_0x5c8bf2={'count':0x0,'rows':[]};var _0x5435bc=_[_0x4b23('0x3e')](db[_0x4b23('0x3f')]['rawAttributes'],function(_0x39653d){return{'name':_0x39653d[_0x4b23('0x40')],'type':_0x39653d[_0x4b23('0x41')][_0x4b23('0x42')]};});_0x329af5['model']=_[_0x4b23('0x3e')](_0x5435bc,_0x4b23('0x39'));_0x329af5[_0x4b23('0x43')]=_[_0x4b23('0x44')](_0x392cc6[_0x4b23('0x43')]);_0x329af5[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x329af5[_0x4b23('0x47')],_0x329af5[_0x4b23('0x43')]);_0x5a5d29[_0x4b23('0x48')]=_[_0x4b23('0x46')](_0x329af5[_0x4b23('0x47')],qs['fields'](_0x392cc6['query'][_0x4b23('0x49')]));_0x5a5d29[_0x4b23('0x48')]=_0x5a5d29[_0x4b23('0x48')][_0x4b23('0x4a')]?_0x5a5d29[_0x4b23('0x48')]:_0x329af5[_0x4b23('0x47')];if(!_0x392cc6[_0x4b23('0x43')]['hasOwnProperty'](_0x4b23('0x4b'))){_0x5a5d29[_0x4b23('0x2e')]=qs[_0x4b23('0x2e')](_0x392cc6['query'][_0x4b23('0x2e')]);_0x5a5d29['offset']=qs[_0x4b23('0x2d')](_0x392cc6[_0x4b23('0x43')][_0x4b23('0x2d')]);}_0x5a5d29['order']=qs['sort'](_0x392cc6['query'][_0x4b23('0x4c')]);_0x5a5d29['where']=qs['filters'](_[_0x4b23('0x4d')](_0x392cc6[_0x4b23('0x43')],_0x329af5[_0x4b23('0x45')]),_0x5435bc);if(_0x392cc6['query'][_0x4b23('0x4e')]){_0x5a5d29[_0x4b23('0x4f')]=_['merge'](_0x5a5d29[_0x4b23('0x4f')],{'$or':_[_0x4b23('0x3e')](_0x5435bc,function(_0x18c302){if(_0x18c302[_0x4b23('0x41')]!==_0x4b23('0x50')){var _0x3317f7={};_0x3317f7[_0x18c302[_0x4b23('0x39')]]={'$like':'%'+_0x392cc6['query'][_0x4b23('0x4e')]+'%'};return _0x3317f7;}})});}_0x5a5d29=_[_0x4b23('0x51')]({},_0x5a5d29,_0x392cc6[_0x4b23('0x52')]);var _0xf9d2c6={'where':_0x5a5d29[_0x4b23('0x4f')]};return db['OpenchannelAccount'][_0x4b23('0x2c')](_0xf9d2c6)[_0x4b23('0x1e')](function(_0x136a91){_0x5c8bf2[_0x4b23('0x2c')]=_0x136a91;if(_0x392cc6[_0x4b23('0x43')]['includeAll']){_0x5a5d29[_0x4b23('0x53')]=[{'all':!![]}];}return db[_0x4b23('0x3f')][_0x4b23('0x54')](_0x5a5d29);})[_0x4b23('0x1e')](function(_0x4a5204){_0x5c8bf2[_0x4b23('0x55')]=_0x4a5204;return _0x5c8bf2;})[_0x4b23('0x1e')](respondWithFilteredResult(_0x1d730b,_0x5a5d29))['catch'](handleError(_0x1d730b,null));};exports['show']=function(_0x18b112,_0x151681){var _0xcfe6d5={'raw':![],'where':{'id':_0x18b112['params']['id']},'include':[{'model':db['Pause'],'as':_0x4b23('0x3d')}]},_0x248374={};_0x248374['model']=_[_0x4b23('0x44')](db['OpenchannelAccount'][_0x4b23('0x56')]);_0x248374[_0x4b23('0x43')]=_[_0x4b23('0x44')](_0x18b112[_0x4b23('0x43')]);_0x248374[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x248374[_0x4b23('0x47')],_0x248374['query']);_0xcfe6d5[_0x4b23('0x48')]=_[_0x4b23('0x46')](_0x248374[_0x4b23('0x47')],qs[_0x4b23('0x49')](_0x18b112['query']['fields']));_0xcfe6d5[_0x4b23('0x48')]=_0xcfe6d5[_0x4b23('0x48')][_0x4b23('0x4a')]?_0xcfe6d5['attributes']:_0x248374['model'];if(_0x18b112[_0x4b23('0x43')][_0x4b23('0x57')]){_0xcfe6d5['include']=[{'all':!![]}];}_0xcfe6d5=_[_0x4b23('0x51')]({},_0xcfe6d5,_0x18b112[_0x4b23('0x52')]);return db['OpenchannelAccount'][_0x4b23('0x58')](_0xcfe6d5)['then'](handleEntityNotFound(_0x151681,null))[_0x4b23('0x1e')](respondWithResult(_0x151681,null))[_0x4b23('0x27')](handleError(_0x151681,null));};exports[_0x4b23('0x59')]=function(_0x11e672,_0x4d09a4){return db[_0x4b23('0x3f')]['create'](_0x11e672[_0x4b23('0x5a')],{})['then'](function(_0x564d95){var _0x23bb32=_0x11e672['user'][_0x4b23('0x34')]({'plain':!![]});if(!_0x23bb32)throw new Error(_0x4b23('0x5b'));if(_0x23bb32[_0x4b23('0x5c')]===_0x4b23('0x5d')){var _0x254c4c=_0x564d95[_0x4b23('0x34')]({'plain':!![]});var _0x4e6cd9=_0x4b23('0x35');return db[_0x4b23('0x5e')][_0x4b23('0x58')]({'where':{'name':_0x4e6cd9,'userProfileId':_0x23bb32[_0x4b23('0x5f')]},'raw':!![]})['then'](function(_0x442209){if(_0x442209&&_0x442209[_0x4b23('0x60')]===0x0){return db[_0x4b23('0x36')][_0x4b23('0x59')]({'name':_0x254c4c[_0x4b23('0x39')],'resourceId':_0x254c4c['id'],'type':_0x442209[_0x4b23('0x39')],'sectionId':_0x442209['id']},{})['then'](function(){return _0x564d95;});}else{return _0x564d95;}})[_0x4b23('0x27')](function(_0x3d6844){logger[_0x4b23('0x25')](_0x4b23('0x61'),_0x3d6844);throw _0x3d6844;});}return _0x564d95;})[_0x4b23('0x1e')](respondWithResult(_0x4d09a4,0xc9))['catch'](handleError(_0x4d09a4,null));};exports[_0x4b23('0x32')]=function(_0x41c697,_0x49bc0e){if(_0x41c697[_0x4b23('0x5a')]['id']){delete _0x41c697[_0x4b23('0x5a')]['id'];}return db[_0x4b23('0x3f')][_0x4b23('0x58')]({'where':{'id':_0x41c697[_0x4b23('0x62')]['id']},'include':[{'model':db[_0x4b23('0x3c')],'as':_0x4b23('0x3d')}]})[_0x4b23('0x1e')](handleEntityNotFound(_0x49bc0e,null))[_0x4b23('0x1e')](saveUpdates(_0x41c697[_0x4b23('0x5a')],null))[_0x4b23('0x1e')](respondWithResult(_0x49bc0e,null))[_0x4b23('0x27')](handleError(_0x49bc0e,null));};exports[_0x4b23('0x33')]=function(_0x743151,_0x124bff){return db['OpenchannelAccount'][_0x4b23('0x58')]({'where':{'id':_0x743151[_0x4b23('0x62')]['id']}})[_0x4b23('0x1e')](handleEntityNotFound(_0x124bff,null))[_0x4b23('0x1e')](removeEntity(_0x124bff,null))['catch'](handleError(_0x124bff,null));};exports['describe']=function(_0x9c1d9a,_0x591167){return db['OpenchannelAccount'][_0x4b23('0x63')]()[_0x4b23('0x1e')](respondWithResult(_0x591167,null))[_0x4b23('0x27')](handleError(_0x591167,null));};exports[_0x4b23('0x64')]=function(_0x491163,_0x26ac1b,_0x3c26e9){if(_0x491163['body']['id']){delete _0x491163['body']['id'];}return db[_0x4b23('0x3f')]['find']({'where':{'id':_0x491163['params']['id']}})[_0x4b23('0x1e')](handleEntityNotFound(_0x26ac1b,null))[_0x4b23('0x1e')](function(_0x1128ca){if(_0x1128ca){_0x491163[_0x4b23('0x5a')][_0x4b23('0x65')]=_0x1128ca['id'];return db[_0x4b23('0x66')]['create'](_0x491163[_0x4b23('0x5a')]);}})[_0x4b23('0x1e')](respondWithResult(_0x26ac1b,null))[_0x4b23('0x27')](handleError(_0x26ac1b,null));};exports[_0x4b23('0x67')]=function(_0x5489e8,_0x1076b2,_0x3f9909){var _0x5e4cab={'raw':![],'where':{}};var _0x2bf833={};var _0x27c8e4={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x4b23('0x68')]({'where':{'id':_0x5489e8[_0x4b23('0x62')]['id']}})[_0x4b23('0x1e')](handleEntityNotFound(_0x1076b2,null))[_0x4b23('0x1e')](function(_0x9ab730){if(_0x9ab730){_0x2bf833[_0x4b23('0x47')]=_[_0x4b23('0x44')](db[_0x4b23('0x66')][_0x4b23('0x56')]);_0x2bf833[_0x4b23('0x43')]=_[_0x4b23('0x44')](_0x5489e8[_0x4b23('0x43')]);_0x2bf833[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x2bf833[_0x4b23('0x47')],_0x2bf833['query']);_0x5e4cab[_0x4b23('0x48')]=_[_0x4b23('0x46')](_0x2bf833[_0x4b23('0x47')],qs[_0x4b23('0x49')](_0x5489e8[_0x4b23('0x43')][_0x4b23('0x49')]));_0x5e4cab[_0x4b23('0x48')]=_0x5e4cab['attributes'][_0x4b23('0x4a')]?_0x5e4cab[_0x4b23('0x48')]:_0x2bf833['model'];if(!_0x5489e8[_0x4b23('0x43')][_0x4b23('0x69')](_0x4b23('0x4b'))){_0x5e4cab['limit']=qs['limit'](_0x5489e8[_0x4b23('0x43')][_0x4b23('0x2e')]);_0x5e4cab['offset']=qs[_0x4b23('0x2d')](_0x5489e8[_0x4b23('0x43')][_0x4b23('0x2d')]);}_0x5e4cab['order']=qs[_0x4b23('0x4c')](_0x5489e8['query'][_0x4b23('0x4c')]);_0x5e4cab[_0x4b23('0x4f')]=qs[_0x4b23('0x45')](_['pick'](_0x5489e8['query'],_0x2bf833[_0x4b23('0x45')]));_0x5e4cab[_0x4b23('0x4f')][_0x4b23('0x65')]=_0x9ab730['id'];if(_0x5489e8['query'][_0x4b23('0x4e')]){_0x5e4cab[_0x4b23('0x4f')]=_[_0x4b23('0x51')](_0x5e4cab[_0x4b23('0x4f')],{'$or':_['map'](_0x5e4cab[_0x4b23('0x48')],function(_0x525dec){var _0x3ee560={};_0x3ee560[_0x525dec]={'$like':'%'+_0x5489e8['query'][_0x4b23('0x4e')]+'%'};return _0x3ee560;})});}_0x5e4cab=_[_0x4b23('0x51')]({},_0x5e4cab,_0x5489e8['options']);return db[_0x4b23('0x66')][_0x4b23('0x2c')]({'where':_0x5e4cab[_0x4b23('0x4f')]})['then'](function(_0x25d25c){_0x27c8e4[_0x4b23('0x2c')]=_0x25d25c;if(_0x5489e8[_0x4b23('0x43')][_0x4b23('0x57')]){_0x5e4cab[_0x4b23('0x53')]=[{'all':!![]}];}return db[_0x4b23('0x66')][_0x4b23('0x54')](_0x5e4cab);})[_0x4b23('0x1e')](function(_0x4b7fd6){_0x27c8e4[_0x4b23('0x55')]=_0x4b7fd6;return _0x27c8e4;});}})[_0x4b23('0x1e')](respondWithFilteredResult(_0x1076b2,_0x5e4cab))['catch'](handleError(_0x1076b2,null));};exports[_0x4b23('0x6a')]=function(_0x35c1a0,_0x6c6da9,_0x1ddc9a){return db[_0x4b23('0x3f')][_0x4b23('0x58')]({'where':{'id':_0x35c1a0[_0x4b23('0x62')]['id']}})[_0x4b23('0x1e')](handleEntityNotFound(_0x6c6da9,null))[_0x4b23('0x1e')](function(_0x308d25){if(_0x308d25){return _0x308d25['removeDispositions'](_0x35c1a0[_0x4b23('0x43')][_0x4b23('0x6b')]);}})[_0x4b23('0x1e')](respondWithStatusCode(_0x6c6da9,null))[_0x4b23('0x27')](handleError(_0x6c6da9,null));};exports['addAnswer']=function(_0x4298eb,_0x334353,_0x5d3bc9){if(_0x4298eb['body']['id']){delete _0x4298eb['body']['id'];}return db[_0x4b23('0x3f')]['find']({'where':{'id':_0x4298eb[_0x4b23('0x62')]['id']}})[_0x4b23('0x1e')](handleEntityNotFound(_0x334353,null))[_0x4b23('0x1e')](function(_0x458f68){if(_0x458f68){_0x4298eb['body']['OpenchannelAccountId']=_0x458f68['id'];return db[_0x4b23('0x6c')][_0x4b23('0x59')](_0x4298eb[_0x4b23('0x5a')]);}})[_0x4b23('0x1e')](respondWithResult(_0x334353,null))[_0x4b23('0x27')](handleError(_0x334353,null));};exports['getAnswers']=function(_0x21f5cd,_0x490838,_0x5d5749){var _0x22c63b={'raw':![],'where':{}};var _0x39b2a6={};var _0xdbeb1f={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x4b23('0x68')]({'where':{'id':_0x21f5cd['params']['id']}})['then'](handleEntityNotFound(_0x490838,null))[_0x4b23('0x1e')](function(_0x3112ca){if(_0x3112ca){_0x39b2a6[_0x4b23('0x47')]=_[_0x4b23('0x44')](db[_0x4b23('0x6c')][_0x4b23('0x56')]);_0x39b2a6['query']=_[_0x4b23('0x44')](_0x21f5cd[_0x4b23('0x43')]);_0x39b2a6[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x39b2a6[_0x4b23('0x47')],_0x39b2a6[_0x4b23('0x43')]);_0x22c63b['attributes']=_[_0x4b23('0x46')](_0x39b2a6[_0x4b23('0x47')],qs[_0x4b23('0x49')](_0x21f5cd[_0x4b23('0x43')][_0x4b23('0x49')]));_0x22c63b['attributes']=_0x22c63b[_0x4b23('0x48')]['length']?_0x22c63b[_0x4b23('0x48')]:_0x39b2a6[_0x4b23('0x47')];if(!_0x21f5cd[_0x4b23('0x43')][_0x4b23('0x69')](_0x4b23('0x4b'))){_0x22c63b['limit']=qs[_0x4b23('0x2e')](_0x21f5cd['query'][_0x4b23('0x2e')]);_0x22c63b[_0x4b23('0x2d')]=qs[_0x4b23('0x2d')](_0x21f5cd['query'][_0x4b23('0x2d')]);}_0x22c63b[_0x4b23('0x6d')]=qs[_0x4b23('0x4c')](_0x21f5cd['query'][_0x4b23('0x4c')]);_0x22c63b[_0x4b23('0x4f')]=qs[_0x4b23('0x45')](_[_0x4b23('0x4d')](_0x21f5cd[_0x4b23('0x43')],_0x39b2a6[_0x4b23('0x45')]));_0x22c63b['where']['OpenchannelAccountId']=_0x3112ca['id'];if(_0x21f5cd[_0x4b23('0x43')][_0x4b23('0x4e')]){_0x22c63b[_0x4b23('0x4f')]=_[_0x4b23('0x51')](_0x22c63b['where'],{'$or':_[_0x4b23('0x3e')](_0x22c63b[_0x4b23('0x48')],function(_0xa0f7f1){var _0x535c80={};_0x535c80[_0xa0f7f1]={'$like':'%'+_0x21f5cd[_0x4b23('0x43')]['filter']+'%'};return _0x535c80;})});}_0x22c63b=_['merge']({},_0x22c63b,_0x21f5cd['options']);return db[_0x4b23('0x6c')][_0x4b23('0x2c')]({'where':_0x22c63b[_0x4b23('0x4f')]})['then'](function(_0x470a8c){_0xdbeb1f['count']=_0x470a8c;if(_0x21f5cd['query'][_0x4b23('0x57')]){_0x22c63b['include']=[{'all':!![]}];}return db[_0x4b23('0x6c')]['findAll'](_0x22c63b);})[_0x4b23('0x1e')](function(_0x171f88){_0xdbeb1f['rows']=_0x171f88;return _0xdbeb1f;});}})['then'](respondWithFilteredResult(_0x490838,_0x22c63b))['catch'](handleError(_0x490838,null));};exports[_0x4b23('0x6e')]=function(_0x56de32,_0x51b733,_0x101753){return db[_0x4b23('0x3f')][_0x4b23('0x58')]({'where':{'id':_0x56de32['params']['id']}})[_0x4b23('0x1e')](handleEntityNotFound(_0x51b733,null))[_0x4b23('0x1e')](function(_0x4dd1d2){if(_0x4dd1d2){return _0x4dd1d2[_0x4b23('0x6e')](_0x56de32[_0x4b23('0x43')]['ids']);}})[_0x4b23('0x1e')](respondWithStatusCode(_0x51b733,null))['catch'](handleError(_0x51b733,null));};exports[_0x4b23('0x6f')]=function(_0x421c7e,_0x2a0f48,_0x3cb27c){var _0x3ee768={'body':_0x421c7e[_0x4b23('0x5a')],'channel':_0x4b23('0x70')};var _0x10d22d=[];var _0x11557e=[];var _0x312af9={};var _0x3e4087=![];return db[_0x4b23('0x71')]['describe']()[_0x4b23('0x1e')](function(_0x41dbba){if(!_0x41dbba){throw new db['Sequelize'][(_0x4b23('0x72'))]('no\x20available\x20attributes');}_0x10d22d=_[_0x4b23('0x73')](_[_0x4b23('0x44')](_0x41dbba),[_0x4b23('0x74'),_0x4b23('0x75')]);_0x11557e=_[_0x4b23('0x73')](_['keys'](_0x41dbba),['createdAt','updatedAt',_0x4b23('0x76'),_0x4b23('0x77')]);if(_0x421c7e['body']['id']){delete _0x421c7e[_0x4b23('0x5a')]['id'];}if(_[_0x4b23('0x78')](_0x421c7e['body'][_0x4b23('0x79')])){throw new db[(_0x4b23('0x7a'))][(_0x4b23('0x72'))](_0x4b23('0x7b'));}if(_[_0x4b23('0x78')](_0x421c7e[_0x4b23('0x5a')][_0x4b23('0x5a')])||_0x421c7e['body'][_0x4b23('0x5a')]===''){throw new db[(_0x4b23('0x7a'))][(_0x4b23('0x72'))](_0x4b23('0x7c'));}if(_[_0x4b23('0x78')](_0x421c7e[_0x4b23('0x5a')][_0x4b23('0x7d')])){throw new db[(_0x4b23('0x7a'))][(_0x4b23('0x72'))](_0x4b23('0x7e')+_0x11557e);}if(!_['includes'](_0x11557e,_0x421c7e[_0x4b23('0x5a')]['mapKey'])){throw new db[(_0x4b23('0x7a'))][(_0x4b23('0x72'))](_0x4b23('0x7f')+_0x11557e);}_0x312af9[_0x421c7e[_0x4b23('0x5a')]['mapKey']]=_0x421c7e[_0x4b23('0x5a')][_0x4b23('0x79')];})['then'](function(){return db[_0x4b23('0x3f')]['find']({'where':{'id':_0x421c7e['params']['id']},'include':[{'model':db[_0x4b23('0x80')],'as':'List','include':[{'model':db['CmContact'],'as':_0x4b23('0x81'),'where':_0x312af9,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x4b23('0x82')}]});})['then'](handleEntityNotFound(_0x2a0f48,null))['then'](function(_0x2ef0ad){if(_0x2ef0ad&&_0x2ef0ad['List']){_0x3ee768[_0x4b23('0x83')]=_0x2ef0ad;_0x3ee768[_0x4b23('0x84')]=_0x2ef0ad[_0x4b23('0x82')];_0x3ee768['list']=_0x2ef0ad[_0x4b23('0x85')];_0x3ee768[_0x4b23('0x84')]=_['orderBy'](_0x3ee768[_0x4b23('0x84')],[_0x4b23('0x86')],[_0x4b23('0x87')]);if(_0x3ee768[_0x4b23('0x83')][_0x4b23('0x82')]){delete _0x3ee768[_0x4b23('0x83')]['Applications'];}if(_0x3ee768[_0x4b23('0x83')][_0x4b23('0x85')]&&_0x3ee768['account']['List'][_0x4b23('0x81')][_0x4b23('0x4a')]){return _0x3ee768[_0x4b23('0x83')][_0x4b23('0x85')][_0x4b23('0x81')][0x0];}var _0x5c0c9f=_[_0x4b23('0x15')](_0x421c7e[_0x4b23('0x5a')],{'firstName':_0x421c7e[_0x4b23('0x5a')]['from'],'ListId':_0x2ef0ad['ListId']});_0x5c0c9f[_0x421c7e[_0x4b23('0x5a')][_0x4b23('0x7d')]]=_0x421c7e['body'][_0x4b23('0x79')];return db['CmContact'][_0x4b23('0x59')](_0x5c0c9f,{'fields':_0x10d22d,'raw':!![]});}})['then'](handleEntityNotFound(_0x2a0f48,null))['then'](function(_0x30471d){_0x3ee768[_0x4b23('0x88')]=_0x30471d;if(_0x30471d){var _0x349556={'ContactId':_0x30471d['id'],'OpenchannelAccountId':_0x421c7e[_0x4b23('0x62')]['id'],'from':(_0x30471d['firstName']||'')+'\x20'+(_0x30471d['lastName']||'')};var _0x14fcf5={'OpenchannelAccountId':_0x421c7e[_0x4b23('0x62')]['id'],'closed':![]};if(_0x421c7e[_0x4b23('0x5a')][_0x4b23('0x89')]){_0x14fcf5[_0x4b23('0x89')]=_0x421c7e['body']['threadId'];return db['OpenchannelInteraction']['find']({'where':_0x14fcf5})[_0x4b23('0x1e')](function(_0x46b510){if(_0x46b510){return[_0x46b510,![]];}_0x349556['threadId']=_0x421c7e['body'][_0x4b23('0x89')];_0x349556[_0x4b23('0x8a')]=_0x421c7e[_0x4b23('0x5a')]['externalUrl'];return db[_0x4b23('0x8b')]['create'](_0x349556)[_0x4b23('0x1e')](function(_0x2b401c){return[_0x2b401c,!![]];});});}else{_0x14fcf5[_0x4b23('0x89')]=null;}_0x14fcf5[_0x4b23('0x8c')]=_0x30471d['id'];return db[_0x4b23('0x8b')][_0x4b23('0x58')]({'where':_0x14fcf5})[_0x4b23('0x1e')](function(_0x15700a){if(_0x15700a){return[_0x15700a,![]];}return db['OpenchannelInteraction']['create'](_0x349556)[_0x4b23('0x1e')](function(_0x2bee19){return[_0x2bee19,!![]];});});}})[_0x4b23('0x8d')](function(_0x1e1854,_0x30ab54){if(_0x1e1854){_0x3e4087=_0x30ab54;if(!_0x30ab54){var _0x1ede2e={'from':(_0x3ee768[_0x4b23('0x88')][_0x4b23('0x8e')]||'')+'\x20'+(_0x3ee768['contact'][_0x4b23('0x8f')]||'')};if(_0x421c7e[_0x4b23('0x5a')][_0x4b23('0x89')]&&_0x421c7e['body']['messageId']&&_0x421c7e[_0x4b23('0x5a')][_0x4b23('0x89')]!=_0x421c7e[_0x4b23('0x5a')]['messageId']){_0x1ede2e['threadId']=_0x421c7e[_0x4b23('0x5a')]['messageId'];}return _0x1e1854[_0x4b23('0x32')](_0x1ede2e);}else{return _0x1e1854;}}})[_0x4b23('0x1e')](function(_0xfcb5f){_0x3ee768[_0x4b23('0x90')]=_0xfcb5f[_0x4b23('0x34')]({'plain':!![]});_0x3ee768['interaction'][_0x4b23('0x91')]=_0x3e4087;if(_0x3ee768[_0x4b23('0x90')][_0x4b23('0x91')]){if(_0x3ee768[_0x4b23('0x83')]['autoclose']){_0x3ee768['applications'][_0x4b23('0x92')]({'id':0x0,'priority':_0x3ee768[_0x4b23('0x84')][_0x4b23('0x4a')]+0x1,'app':_0x4b23('0x93'),'appdata':'unmanaged','interval':_0x4b23('0x94')});}}return db[_0x4b23('0x95')]['create']({'body':_0x421c7e[_0x4b23('0x5a')][_0x4b23('0x5a')],'OpenchannelAccountId':_0x421c7e[_0x4b23('0x62')]['id'],'OpenchannelInteractionId':_0xfcb5f['id'],'direction':'in','ContactId':_0x3ee768[_0x4b23('0x88')]['id'],'AttachmentId':_0x421c7e[_0x4b23('0x5a')][_0x4b23('0x96')]});})['then'](function(_0xf5ed04){_0x3ee768[_0x4b23('0x26')]=_0xf5ed04;if(!_0x3ee768[_0x4b23('0x90')][_0x4b23('0x97')])return;return db[_0x4b23('0x98')][_0x4b23('0x58')]({'attributes':['id',_0x4b23('0x39')],'where':{'id':_0x3ee768[_0x4b23('0x90')]['UserId']}});})[_0x4b23('0x1e')](function(_0x563d88){if(_0x563d88){_0x3ee768[_0x4b23('0x84')][_0x4b23('0x99')]({'id':0x0,'priority':0x0,'app':_0x4b23('0x9a'),'appdata':_0x563d88[_0x4b23('0x39')]+','+(_0x3ee768[_0x4b23('0x83')][_0x4b23('0x9b')]||0xa),'interval':_0x4b23('0x94')});}if(!_0x3ee768['interaction'][_0x4b23('0x9c')])return;return db[_0x4b23('0x9d')][_0x4b23('0x58')]({'attributes':['id','name'],'where':{'id':_0x3ee768['interaction']['queueId']}});})[_0x4b23('0x1e')](function(_0x325348){if(_0x325348){_0x3ee768[_0x4b23('0x84')][_0x4b23('0x99')]({'id':0x0,'priority':0x1,'app':_0x4b23('0x9e'),'appdata':_0x325348['name']+','+(_0x3ee768[_0x4b23('0x83')][_0x4b23('0x9f')]||0x12c),'interval':_0x4b23('0x94')});}return respondWithRpcPromise('Start',_0x4b23('0xa0'),_0x3ee768);})[_0x4b23('0x1e')](function(_0x6f9a57){respondWithRpcPromise(_0x4b23('0xa1'),_0x4b23('0xa1'),{'event':_0x4b23('0x6f'),'message':_0x6f9a57},client9002);return _0x6f9a57;})[_0x4b23('0x1e')](respondWithResult(_0x2a0f48,null))[_0x4b23('0x27')](handleError(_0x2a0f48,null));};exports[_0x4b23('0xa2')]=function(_0x5b550b,_0x1eaddc){var _0x5db523=_0x5b550b[_0x4b23('0x62')]['id'];var _0x39bd83=_0x5b550b[_0x4b23('0x5a')];var _0x3c36b3=0xc8;var _0xea2cdb=null;return db[_0x4b23('0xa3')][_0x4b23('0xa4')]({'isolationLevel':db[_0x4b23('0xa3')][_0x4b23('0xa5')][_0x4b23('0xa6')][_0x4b23('0xa7')]},function(_0x2cc0e5){return db['OpenchannelAccount'][_0x4b23('0x68')]({'where':{'id':_0x5db523},'transaction':_0x2cc0e5})[_0x4b23('0x1e')](function(_0x337343){if(_0x337343){return db[_0x4b23('0xa8')][_0x4b23('0x33')]({'where':{'OpenchannelAccountId':_0x5db523},'transaction':_0x2cc0e5})[_0x4b23('0x1e')](function(){var _0xc7ef3c=_[_0x4b23('0x3e')](_0x39bd83,function(_0x18516c){_0x18516c[_0x4b23('0x65')]=_0x5db523;return _0x18516c;});return db['OpenchannelApplication']['bulkCreate'](_0xc7ef3c,{'transaction':_0x2cc0e5});});}else{_0x3c36b3=0x194;_0xea2cdb=[];}});})['then'](function(){if(_0x3c36b3!==0x194){return db[_0x4b23('0xa8')][_0x4b23('0xa9')]({'where':{'OpenchannelAccountId':_0x5db523},'order':'priority'})['then'](function(_0x8978e1){_0xea2cdb=_0x8978e1;});}})[_0x4b23('0x27')](function(_0x40572a){_0x3c36b3=0x1f4;logger['error'](_0x40572a[_0x4b23('0x38')]);if(_0x40572a[_0x4b23('0x39')]){delete _0x40572a[_0x4b23('0x39')];}_0xea2cdb=_0x40572a;})[_0x4b23('0xaa')](function(){if(_0xea2cdb===null){_0x1eaddc['sendStatus'](_0x3c36b3);}else{if(_0x3c36b3===0x1f4){_0x1eaddc['status'](_0x3c36b3)['send'](_0xea2cdb);}else{_0x1eaddc[_0x4b23('0x28')](_0x3c36b3)[_0x4b23('0x2a')](_0xea2cdb);}}});};exports[_0x4b23('0xab')]=function(_0x4d3461,_0x2c3aa8,_0x5e235a){var _0x7c407c={};var _0x6c9d5={};var _0x3badb0;var _0x351e44;return db['OpenchannelAccount'][_0x4b23('0x68')]({'where':{'id':_0x4d3461[_0x4b23('0x62')]['id']}})[_0x4b23('0x1e')](handleEntityNotFound(_0x2c3aa8,null))['then'](function(_0x4e2106){if(_0x4e2106){_0x3badb0=_0x4e2106;_0x6c9d5['model']=_['keys'](db['OpenchannelApplication'][_0x4b23('0x56')]);_0x6c9d5[_0x4b23('0x43')]=_['keys'](_0x4d3461[_0x4b23('0x43')]);_0x6c9d5[_0x4b23('0x45')]=_['intersection'](_0x6c9d5[_0x4b23('0x47')],_0x6c9d5[_0x4b23('0x43')]);_0x7c407c[_0x4b23('0x48')]=_[_0x4b23('0x46')](_0x6c9d5[_0x4b23('0x47')],qs[_0x4b23('0x49')](_0x4d3461[_0x4b23('0x43')]['fields']));_0x7c407c[_0x4b23('0x48')]=_0x7c407c[_0x4b23('0x48')][_0x4b23('0x4a')]?_0x7c407c[_0x4b23('0x48')]:_0x6c9d5[_0x4b23('0x47')];_0x7c407c[_0x4b23('0x6d')]=qs[_0x4b23('0x4c')](_0x4d3461['query'][_0x4b23('0x4c')]);_0x7c407c[_0x4b23('0x4f')]=qs['filters'](_[_0x4b23('0x4d')](_0x4d3461[_0x4b23('0x43')],_0x6c9d5[_0x4b23('0x45')]));if(_0x4d3461[_0x4b23('0x43')][_0x4b23('0x4e')]){_0x7c407c[_0x4b23('0x4f')]=_[_0x4b23('0x51')](_0x7c407c['where'],{'$or':_[_0x4b23('0x3e')](_0x7c407c[_0x4b23('0x48')],function(_0x17a3ca){var _0x2e7f53={};_0x2e7f53[_0x17a3ca]={'$like':'%'+_0x4d3461[_0x4b23('0x43')][_0x4b23('0x4e')]+'%'};return _0x2e7f53;})});}_0x7c407c=_['merge']({},_0x7c407c,_0x4d3461['options']);return _0x3badb0[_0x4b23('0xab')](_0x7c407c);}})[_0x4b23('0x1e')](function(_0x564534){if(_0x564534){_0x351e44=_0x564534[_0x4b23('0x4a')];if(!_0x4d3461[_0x4b23('0x43')]['hasOwnProperty']('nolimit')){_0x7c407c['limit']=qs[_0x4b23('0x2e')](_0x4d3461[_0x4b23('0x43')][_0x4b23('0x2e')]);_0x7c407c[_0x4b23('0x2d')]=qs['offset'](_0x4d3461['query'][_0x4b23('0x2d')]);}return _0x3badb0[_0x4b23('0xab')](_0x7c407c);}})[_0x4b23('0x1e')](function(_0x4728e5){if(_0x4728e5){return _0x4728e5?{'count':_0x351e44,'rows':_0x4728e5}:null;}})[_0x4b23('0x1e')](respondWithResult(_0x2c3aa8,null))['catch'](handleError(_0x2c3aa8,null));};exports[_0x4b23('0xac')]=function(_0x2cce4b,_0x2f6f1e,_0x1e1b26){var _0x42e815={'raw':![],'where':{}};var _0x48cc1f={};var _0x3a273f={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x4b23('0x68')]({'where':{'id':_0x2cce4b[_0x4b23('0x62')]['id']}})['then'](handleEntityNotFound(_0x2f6f1e,null))[_0x4b23('0x1e')](function(_0x5f5323){if(_0x5f5323){_0x48cc1f['model']=_[_0x4b23('0x44')](db[_0x4b23('0x8b')]['rawAttributes']);_0x48cc1f['query']=_[_0x4b23('0x44')](_0x2cce4b['query']);_0x48cc1f[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x48cc1f[_0x4b23('0x47')],_0x48cc1f[_0x4b23('0x43')]);_0x42e815[_0x4b23('0x48')]=_[_0x4b23('0x46')](_0x48cc1f[_0x4b23('0x47')],qs[_0x4b23('0x49')](_0x2cce4b[_0x4b23('0x43')]['fields']));_0x42e815[_0x4b23('0x48')]=_0x42e815[_0x4b23('0x48')][_0x4b23('0x4a')]?_0x42e815['attributes']:_0x48cc1f[_0x4b23('0x47')];if(!_0x2cce4b[_0x4b23('0x43')][_0x4b23('0x69')](_0x4b23('0x4b'))){_0x42e815['limit']=qs[_0x4b23('0x2e')](_0x2cce4b['query'][_0x4b23('0x2e')]);_0x42e815[_0x4b23('0x2d')]=qs[_0x4b23('0x2d')](_0x2cce4b[_0x4b23('0x43')][_0x4b23('0x2d')]);}_0x42e815[_0x4b23('0x6d')]=qs['sort'](_0x2cce4b[_0x4b23('0x43')][_0x4b23('0x4c')]);_0x42e815['where']=qs[_0x4b23('0x45')](_[_0x4b23('0x4d')](_0x2cce4b[_0x4b23('0x43')],_0x48cc1f[_0x4b23('0x45')]));_0x42e815[_0x4b23('0x4f')]['OpenchannelAccountId']=_0x5f5323['id'];if(_0x2cce4b['query'][_0x4b23('0x4e')]){_0x42e815['where']=_['merge'](_0x42e815[_0x4b23('0x4f')],{'$or':_['map'](_0x42e815[_0x4b23('0x48')],function(_0x1510b5){var _0x2b123c={};_0x2b123c[_0x1510b5]={'$like':'%'+_0x2cce4b[_0x4b23('0x43')]['filter']+'%'};return _0x2b123c;})});}_0x42e815=_[_0x4b23('0x51')]({},_0x42e815,_0x2cce4b[_0x4b23('0x52')]);return db[_0x4b23('0x8b')][_0x4b23('0x2c')]({'where':_0x42e815[_0x4b23('0x4f')]})[_0x4b23('0x1e')](function(_0x4ee66f){_0x3a273f[_0x4b23('0x2c')]=_0x4ee66f;if(_0x2cce4b[_0x4b23('0x43')][_0x4b23('0x57')]){_0x42e815['include']=[{'model':db[_0x4b23('0x71')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x4b23('0xad'),'attributes':[_0x4b23('0x39'),_0x4b23('0xae'),_0x4b23('0xaf')],'required':![]},{'model':db[_0x4b23('0xb0')],'as':_0x4b23('0xb1'),'attributes':['id','name',_0x4b23('0xb2')],'where':_0x2cce4b[_0x4b23('0x43')][_0x4b23('0xb3')]?{'id':_0x2cce4b[_0x4b23('0x43')]['tag']}:undefined,'required':_0x2cce4b[_0x4b23('0x43')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x4b23('0x54')](_0x42e815);})[_0x4b23('0x1e')](function(_0x384cf6){_0x3a273f['rows']=_0x384cf6;return _0x3a273f;});}})['then'](respondWithFilteredResult(_0x2f6f1e,_0x42e815))[_0x4b23('0x27')](handleError(_0x2f6f1e,null));};exports[_0x4b23('0xb4')]=function(_0x3e66b7,_0x12b8d6,_0x3aace5){return db[_0x4b23('0x3f')][_0x4b23('0x58')]({'where':{'id':_0x3e66b7[_0x4b23('0x62')]['id']}})[_0x4b23('0x1e')](handleEntityNotFound(_0x12b8d6,null))[_0x4b23('0x1e')](function(_0x59cb00){if(_0x59cb00){return _0x59cb00[_0x4b23('0xb4')](_0x3e66b7[_0x4b23('0x5a')][_0x4b23('0x6b')],_[_0x4b23('0xb5')](_0x3e66b7[_0x4b23('0x5a')],['ids','id'])||{})[_0x4b23('0x8d')](function(_0x5a5dc7){for(var _0x1519ce=0x0;_0x1519ce<_0x3e66b7[_0x4b23('0x5a')][_0x4b23('0x6b')][_0x4b23('0x4a')];_0x1519ce+=0x1){socket[_0x4b23('0xb6')]('userOpenchannelAccount:save',{'UserId':Number(_0x3e66b7[_0x4b23('0x5a')]['ids'][_0x1519ce]),'OpenchannelAccountId':Number(_0x3e66b7[_0x4b23('0x62')]['id'])});}return _0x5a5dc7;});}})['then'](respondWithResult(_0x12b8d6,null))[_0x4b23('0x27')](handleError(_0x12b8d6,null));};exports[_0x4b23('0xb7')]=function(_0x33a978,_0x3a3d7e,_0x4299ed){return db[_0x4b23('0x3f')][_0x4b23('0x58')]({'where':{'id':_0x33a978[_0x4b23('0x62')]['id']}})['then'](handleEntityNotFound(_0x3a3d7e,null))[_0x4b23('0x1e')](function(_0xe3e09c){if(_0xe3e09c){return _0xe3e09c[_0x4b23('0xb7')](_0x33a978[_0x4b23('0x43')][_0x4b23('0x6b')])[_0x4b23('0x1e')](function(){if(_['isArray'](_0x33a978[_0x4b23('0x43')][_0x4b23('0x6b')])){for(var _0x142d7a=0x0;_0x142d7a<_0x33a978[_0x4b23('0x43')]['ids']['length'];_0x142d7a+=0x1){socket[_0x4b23('0xb6')](_0x4b23('0xb8'),{'UserId':Number(_0x33a978[_0x4b23('0x43')][_0x4b23('0x6b')][_0x142d7a]),'OpenchannelAccountId':Number(_0x33a978[_0x4b23('0x62')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x33a978[_0x4b23('0x43')][_0x4b23('0x6b')]),'OpenchannelAccountId':Number(_0x33a978[_0x4b23('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0x3a3d7e,null))[_0x4b23('0x27')](handleError(_0x3a3d7e,null));};exports[_0x4b23('0xb9')]=function(_0x5bf284,_0xa6bc64,_0x34226e){var _0x349f2b={};var _0x552062={};var _0x4c9238;var _0x545664;return db[_0x4b23('0x3f')][_0x4b23('0x68')]({'where':{'id':_0x5bf284[_0x4b23('0x62')]['id']}})[_0x4b23('0x1e')](handleEntityNotFound(_0xa6bc64,null))['then'](function(_0x206a4){if(_0x206a4){_0x4c9238=_0x206a4;_0x552062['model']=_[_0x4b23('0x44')](db[_0x4b23('0x98')][_0x4b23('0x56')]);_0x552062['query']=_[_0x4b23('0x44')](_0x5bf284[_0x4b23('0x43')]);_0x552062[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x552062['model'],_0x552062[_0x4b23('0x43')]);_0x349f2b[_0x4b23('0x48')]=_[_0x4b23('0x46')](_0x552062[_0x4b23('0x47')],qs[_0x4b23('0x49')](_0x5bf284[_0x4b23('0x43')]['fields']));_0x349f2b[_0x4b23('0x48')]=_0x349f2b[_0x4b23('0x48')][_0x4b23('0x4a')]?_0x349f2b['attributes']:_0x552062[_0x4b23('0x47')];_0x349f2b[_0x4b23('0x6d')]=qs['sort'](_0x5bf284['query'][_0x4b23('0x4c')]);_0x349f2b[_0x4b23('0x4f')]=qs[_0x4b23('0x45')](_[_0x4b23('0x4d')](_0x5bf284['query'],_0x552062[_0x4b23('0x45')]));if(_0x5bf284['query'][_0x4b23('0x4e')]){_0x349f2b[_0x4b23('0x4f')]=_['merge'](_0x349f2b[_0x4b23('0x4f')],{'$or':_[_0x4b23('0x3e')](_0x349f2b['attributes'],function(_0x55fc63){var _0x2b65cf={};_0x2b65cf[_0x55fc63]={'$like':'%'+_0x5bf284['query'][_0x4b23('0x4e')]+'%'};return _0x2b65cf;})});}_0x349f2b=_[_0x4b23('0x51')]({},_0x349f2b,_0x5bf284[_0x4b23('0x52')]);return _0x4c9238[_0x4b23('0xb9')](_0x349f2b);}})[_0x4b23('0x1e')](function(_0x438235){if(_0x438235){_0x545664=_0x438235[_0x4b23('0x4a')];if(!_0x5bf284[_0x4b23('0x43')][_0x4b23('0x69')](_0x4b23('0x4b'))){_0x349f2b[_0x4b23('0x2e')]=qs[_0x4b23('0x2e')](_0x5bf284[_0x4b23('0x43')][_0x4b23('0x2e')]);_0x349f2b[_0x4b23('0x2d')]=qs[_0x4b23('0x2d')](_0x5bf284[_0x4b23('0x43')][_0x4b23('0x2d')]);}return _0x4c9238['getAgents'](_0x349f2b);}})['then'](function(_0x49b125){if(_0x49b125){return _0x49b125?{'count':_0x545664,'rows':_0x49b125}:null;}})[_0x4b23('0x1e')](respondWithResult(_0xa6bc64,null))['catch'](handleError(_0xa6bc64,null));};exports[_0x4b23('0x3a')]=function(_0x1c048,_0xc5c5dc,_0x59ca4c){var _0x13f24d,_0x50b9d9,_0x4a3a83;if(_['isNil'](_0x1c048['body'][_0x4b23('0x5a')])||_0x1c048[_0x4b23('0x5a')][_0x4b23('0x5a')]===''){throw new db[(_0x4b23('0x7a'))][(_0x4b23('0x72'))](_0x4b23('0x7c'));}if(_[_0x4b23('0x78')](_0x1c048[_0x4b23('0x5a')]['to'])){}_0x13f24d=_0x1c048['body']['to'];return db[_0x4b23('0x3f')][_0x4b23('0x68')]({'where':{'id':_0x1c048[_0x4b23('0x62')]['id']}})['then'](handleEntityNotFound(_0xc5c5dc,null))[_0x4b23('0x1e')](function(_0x57f2d7){if(_0x57f2d7){return db[_0x4b23('0x3f')][_0x4b23('0x58')]({'where':{'id':_0x57f2d7['id']},'include':[{'model':db['CmList'],'as':_0x4b23('0x85'),'include':[{'model':db[_0x4b23('0x71')],'as':_0x4b23('0x81'),'where':{[_0x57f2d7[_0x4b23('0x7d')]]:_0x13f24d},'limit':0x1,'order':[[_0x4b23('0x75'),_0x4b23('0xba')]]}]}]})[_0x4b23('0x1e')](handleEntityNotFound(_0xc5c5dc,null))[_0x4b23('0x1e')](function(_0x57e84e){if(_0x57e84e&&_0x57e84e['List']){_0x50b9d9=_0x57e84e[_0x4b23('0x34')]({'plain':!![]});if(_0x50b9d9[_0x4b23('0x85')]&&_0x50b9d9[_0x4b23('0x85')][_0x4b23('0x81')][_0x4b23('0x4a')]){return _0x50b9d9[_0x4b23('0x85')][_0x4b23('0x81')][0x0];}return db[_0x4b23('0x71')][_0x4b23('0x59')](_[_0x4b23('0x15')](_0x1c048[_0x4b23('0x5a')],{'firstName':_0x13f24d,[_0x57e84e[_0x4b23('0x7d')]]:_0x13f24d,'phone':_0x13f24d,'ListId':_0x50b9d9['ListId']}));}})[_0x4b23('0x1e')](handleEntityNotFound(_0xc5c5dc,null))['then'](function(_0x12c448){if(_0x12c448){_0x4a3a83=_0x12c448;return db['OpenchannelInteraction'][_0x4b23('0x58')]({'where':{'ContactId':_0x4a3a83['id'],'closed':![],'OpenchannelAccountId':_0x50b9d9['id']}})[_0x4b23('0x1e')](function(_0x5605a1){if(_0x5605a1){return[_0x5605a1,![]];}return db[_0x4b23('0x8b')][_0x4b23('0x59')]({'UserId':_0x1c048['user']['id'],'ContactId':_0x4a3a83['id'],'OpenchannelAccountId':_0x50b9d9['id'],'lastMsgDirection':_0x4b23('0xbb'),'firstMsgDirection':_0x4b23('0xbb'),'Messages':[_['merge'](_0x1c048[_0x4b23('0x5a')],{'read':![],'body':_0x1c048['body'][_0x4b23('0x5a')],'OpenchannelAccountId':_0x50b9d9['id'],'UserId':_0x1c048[_0x4b23('0x5d')]['id'],'ContactId':_0x4a3a83['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x4b23('0xbc')}]})[_0x4b23('0x1e')](function(_0x48d886){return[_0x48d886,!![]];});});}})[_0x4b23('0x8d')](function(_0x964921,_0x1d5041){if(_0x1d5041){return _0x964921;}return db[_0x4b23('0x95')][_0x4b23('0x59')](_[_0x4b23('0x51')](_0x1c048[_0x4b23('0x5a')],{'read':![],'body':_0x1c048[_0x4b23('0x5a')][_0x4b23('0x5a')],'OpenchannelAccountId':_0x50b9d9['id'],'OpenchannelInteractionId':_0x964921['id'],'UserId':_0x1c048[_0x4b23('0x5d')]['id'],'ContactId':_0x4a3a83['id']}))['then'](function(_0x223dd7){_0x964921[_0x4b23('0xbd')][_0x4b23('0xbc')]=[];_0x964921[_0x4b23('0xbd')][_0x4b23('0xbc')][_0x4b23('0x92')](_0x223dd7[_0x4b23('0xbd')]);return _0x964921;});});}})[_0x4b23('0x1e')](respondWithResult(_0xc5c5dc,null))[_0x4b23('0x27')](handleError(_0xc5c5dc,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index bf995ac..8c57682 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 _0xbdb7=['save','update','remove','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x139d7b,_0x39fdf3){var _0x35c32d=function(_0x2a7a02){while(--_0x2a7a02){_0x139d7b['push'](_0x139d7b['shift']());}};_0x35c32d(++_0x39fdf3);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5d19f8,_0x56a7bb){_0x5d19f8=_0x5d19f8-0x0;var _0x42e896=_0xbdb7[_0x5d19f8];return _0x42e896;};'use strict';var EventEmitter=require(_0x7bdb('0x0'));var OpenchannelAccount=require(_0x7bdb('0x1'))['db'][_0x7bdb('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x7bdb('0x3')](0x0);var events={'afterCreate':_0x7bdb('0x4'),'afterUpdate':_0x7bdb('0x5'),'afterDestroy':_0x7bdb('0x6')};function emitEvent(_0x2c7e07){return function(_0x46c068,_0x47aec5,_0x28542c){OpenchannelAccountEvents['emit'](_0x2c7e07+':'+_0x46c068['id'],_0x46c068);OpenchannelAccountEvents['emit'](_0x2c7e07,_0x46c068);_0x28542c(null);};}for(var e in events){if(events[_0x7bdb('0x7')](e)){var event=events[e];OpenchannelAccount[_0x7bdb('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xf4eb=['hook','events','update','emit','hasOwnProperty'];(function(_0x282665,_0x11ce7d){var _0x21e9ac=function(_0x11e1d1){while(--_0x11e1d1){_0x282665['push'](_0x282665['shift']());}};_0x21e9ac(++_0x11ce7d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2915b4,_0x345238){_0x2915b4=_0x2915b4-0x0;var _0x53f5c1=_0xf4eb[_0x2915b4];return _0x53f5c1;};'use strict';var EventEmitter=require(_0xbf4e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbf4e('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4e7fa7){return function(_0x2e3070,_0x1c7606,_0x32d1d7){OpenchannelAccountEvents[_0xbf4e('0x2')](_0x4e7fa7+':'+_0x2e3070['id'],_0x2e3070);OpenchannelAccountEvents[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070);_0x32d1d7(null);};}for(var e in events){if(events[_0xbf4e('0x3')](e)){var event=events[e];OpenchannelAccount[_0xbf4e('0x4')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 71d14d8..39dc97b 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(_0x31c4f5,_0x295737){var _0xb60cd6=function(_0x42566e){while(--_0x42566e){_0x31c4f5['push'](_0x31c4f5['shift']());}};_0xb60cd6(++_0x295737);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x2cd45a,_0x53aab2){var _0x2b40d6=function(_0x27c429){while(--_0x27c429){_0x2cd45a['push'](_0x2cd45a['shift']());}};_0x2b40d6(++_0x53aab2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 22014d6..1c1d6e4 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 _0x282b=['request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register'];(function(_0x374eaf,_0x2e6dd5){var _0x240ec8=function(_0xae1fbc){while(--_0xae1fbc){_0x374eaf['push'](_0x374eaf['shift']());}};_0x240ec8(++_0x2e6dd5);}(_0x282b,0xec));var _0xb282=function(_0x1dff74,_0x162e4a){_0x1dff74=_0x1dff74-0x0;var _0x49089e=_0x282b[_0x1dff74];return _0x49089e;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var moment=require(_0xb282('0x2'));var BPromise=require(_0xb282('0x3'));var rs=require(_0xb282('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb282('0x5'));var logger=require('../../config/logger')(_0xb282('0x6'));var config=require(_0xb282('0x7'));var jayson=require(_0xb282('0x8'));var client=jayson[_0xb282('0x9')][_0xb282('0xa')]({'port':0x232a});config[_0xb282('0xb')]=_['defaults'](config['redis'],{'host':_0xb282('0xc'),'port':0x18eb});var socket=require(_0xb282('0xd'))(new Redis(config['redis']));require(_0xb282('0xe'))[_0xb282('0xf')](socket);function respondWithRpcPromise(_0x3435fc,_0x2d86ba,_0x56caf2){return new BPromise(function(_0x47e62e,_0x36b984){return client[_0xb282('0x10')](_0x3435fc,_0x56caf2)[_0xb282('0x11')](function(_0x1cbe28){logger[_0xb282('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x2d86ba,'request\x20sent');logger[_0xb282('0x13')](_0xb282('0x14'),_0x2d86ba,_0xb282('0x15'),JSON[_0xb282('0x16')](_0x1cbe28));if(_0x1cbe28[_0xb282('0x17')]){if(_0x1cbe28['error'][_0xb282('0x18')]===0x1f4){logger['error'](_0xb282('0x19'),_0x2d86ba,_0x1cbe28[_0xb282('0x17')]['message']);return _0x36b984(_0x1cbe28['error']['message']);}logger[_0xb282('0x17')](_0xb282('0x19'),_0x2d86ba,_0x1cbe28[_0xb282('0x17')][_0xb282('0x1a')]);return _0x47e62e(_0x1cbe28[_0xb282('0x17')]['message']);}else{logger[_0xb282('0x12')](_0xb282('0x19'),_0x2d86ba,_0xb282('0x15'));_0x47e62e(_0x1cbe28[_0xb282('0x1b')][_0xb282('0x1a')]);}})['catch'](function(_0x52e305){logger[_0xb282('0x17')](_0xb282('0x19'),_0x2d86ba,_0x52e305);_0x36b984(_0x52e305);});});} \ No newline at end of file +var _0xd914=['OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','info'];(function(_0x228e96,_0x2e5957){var _0x4a428f=function(_0x37707b){while(--_0x37707b){_0x228e96['push'](_0x228e96['shift']());}};_0x4a428f(++_0x2e5957);}(_0xd914,0x17f));var _0x4d91=function(_0x57966a,_0x477964){_0x57966a=_0x57966a-0x0;var _0x191765=_0xd914[_0x57966a];return _0x191765;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var moment=require('moment');var BPromise=require(_0x4d91('0x2'));var rs=require(_0x4d91('0x3'));var fs=require('fs');var Redis=require(_0x4d91('0x4'));var db=require(_0x4d91('0x5'))['db'];var utils=require(_0x4d91('0x6'));var logger=require(_0x4d91('0x7'))('rpc');var config=require(_0x4d91('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4d91('0x9')][_0x4d91('0xa')]({'port':0x232a});config[_0x4d91('0xb')]=_[_0x4d91('0xc')](config[_0x4d91('0xb')],{'host':_0x4d91('0xd'),'port':0x18eb});var socket=require(_0x4d91('0xe'))(new Redis(config[_0x4d91('0xb')]));require('./openchannelAccount.socket')[_0x4d91('0xf')](socket);function respondWithRpcPromise(_0xa4bb25,_0xc07c64,_0x278648){return new BPromise(function(_0xb234d2,_0x266b31){return client['request'](_0xa4bb25,_0x278648)['then'](function(_0x2ccd08){logger[_0x4d91('0x10')](_0x4d91('0x11'),_0xc07c64,_0x4d91('0x12'));logger[_0x4d91('0x13')](_0x4d91('0x14'),_0xc07c64,'request\x20sent',JSON['stringify'](_0x2ccd08));if(_0x2ccd08[_0x4d91('0x15')]){if(_0x2ccd08[_0x4d91('0x15')][_0x4d91('0x16')]===0x1f4){logger[_0x4d91('0x15')](_0x4d91('0x11'),_0xc07c64,_0x2ccd08[_0x4d91('0x15')][_0x4d91('0x17')]);return _0x266b31(_0x2ccd08['error'][_0x4d91('0x17')]);}logger[_0x4d91('0x15')](_0x4d91('0x11'),_0xc07c64,_0x2ccd08[_0x4d91('0x15')][_0x4d91('0x17')]);return _0xb234d2(_0x2ccd08['error'][_0x4d91('0x17')]);}else{logger[_0x4d91('0x10')](_0x4d91('0x11'),_0xc07c64,_0x4d91('0x12'));_0xb234d2(_0x2ccd08['result'][_0x4d91('0x17')]);}})[_0x4d91('0x18')](function(_0x13254c){logger['error'](_0x4d91('0x11'),_0xc07c64,_0x13254c);_0x266b31(_0x13254c);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index dc8cace..b994e18 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 _0xba33=['remove','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x4bd2e2,_0x34d1a9){var _0x39097b=function(_0x5cfe9e){while(--_0x5cfe9e){_0x4bd2e2['push'](_0x4bd2e2['shift']());}};_0x39097b(++_0x34d1a9);}(_0xba33,0xf1));var _0x3ba3=function(_0x4c3a0b,_0x131a14){_0x4c3a0b=_0x4c3a0b-0x0;var _0x2b1774=_0xba33[_0x4c3a0b];return _0x2b1774;};'use strict';var OpenchannelAccountEvents=require(_0x3ba3('0x0'));var events=[_0x3ba3('0x1'),_0x3ba3('0x2'),_0x3ba3('0x3')];function createListener(_0x4a52a9,_0xaa35e6){return function(_0x25b7ef){_0xaa35e6[_0x3ba3('0x4')](_0x4a52a9,_0x25b7ef);};}function removeListener(_0x77ca36,_0x2658bf){return function(){OpenchannelAccountEvents[_0x3ba3('0x5')](_0x77ca36,_0x2658bf);};}exports[_0x3ba3('0x6')]=function(_0xd24f52){for(var _0xe9e300=0x0,_0xfbfa81=events[_0x3ba3('0x7')];_0xe9e300<_0xfbfa81;_0xe9e300++){var _0x55f171=events[_0xe9e300];var _0x17a6d3=createListener(_0x3ba3('0x8')+_0x55f171,_0xd24f52);OpenchannelAccountEvents['on'](_0x55f171,_0x17a6d3);}}; \ No newline at end of file +var _0x1cf3=['emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','remove','update'];(function(_0xf1b916,_0x66ad2c){var _0x1363f3=function(_0x4ed5b0){while(--_0x4ed5b0){_0xf1b916['push'](_0xf1b916['shift']());}};_0x1363f3(++_0x66ad2c);}(_0x1cf3,0x1be));var _0x31cf=function(_0x57c512,_0x4c40ec){_0x57c512=_0x57c512-0x0;var _0x4461e3=_0x1cf3[_0x57c512];return _0x4461e3;};'use strict';var OpenchannelAccountEvents=require(_0x31cf('0x0'));var events=[_0x31cf('0x1'),_0x31cf('0x2'),_0x31cf('0x3')];function createListener(_0x54dff7,_0x20aa57){return function(_0x5a2ae7){_0x20aa57[_0x31cf('0x4')](_0x54dff7,_0x5a2ae7);};}function removeListener(_0x442009,_0x44d64d){return function(){OpenchannelAccountEvents[_0x31cf('0x5')](_0x442009,_0x44d64d);};}exports[_0x31cf('0x6')]=function(_0x44dd04){for(var _0x2b7cd4=0x0,_0x1830b4=events[_0x31cf('0x7')];_0x2b7cd4<_0x1830b4;_0x2b7cd4++){var _0x6be80=events[_0x2b7cd4];var _0x3f7b2e=createListener(_0x31cf('0x8')+_0x6be80,_0x44dd04);OpenchannelAccountEvents['on'](_0x6be80,_0x3f7b2e);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index b8bc3d6..7c680c0 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 _0xab77=['put','/:id','update','delete','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','show'];(function(_0x110e42,_0x134a3e){var _0x343f58=function(_0x58f189){while(--_0x58f189){_0x110e42['push'](_0x110e42['shift']());}};_0x343f58(++_0x134a3e);}(_0xab77,0xd6));var _0x7ab7=function(_0x3b2f28,_0xef1370){_0x3b2f28=_0x3b2f28-0x0;var _0x192dd4=_0xab77[_0x3b2f28];return _0x192dd4;};'use strict';var multer=require(_0x7ab7('0x0'));var util=require(_0x7ab7('0x1'));var path=require('path');var timeout=require(_0x7ab7('0x2'));var express=require(_0x7ab7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7ab7('0x4'));var interaction=require(_0x7ab7('0x5'));var config=require('../../config/environment');var controller=require(_0x7ab7('0x6'));router[_0x7ab7('0x7')]('/',auth[_0x7ab7('0x8')](),controller[_0x7ab7('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7ab7('0xa')]);router['post']('/',auth[_0x7ab7('0x8')](),controller['create']);router[_0x7ab7('0xb')](_0x7ab7('0xc'),auth['isAuthenticated'](),controller[_0x7ab7('0xd')]);router[_0x7ab7('0xe')](_0x7ab7('0xc'),auth[_0x7ab7('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0c19=['/:id','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','isAuthenticated','show'];(function(_0x1343af,_0x2b9205){var _0x14f1c1=function(_0x1fddc3){while(--_0x1fddc3){_0x1343af['push'](_0x1343af['shift']());}};_0x14f1c1(++_0x2b9205);}(_0x0c19,0xd0));var _0x90c1=function(_0x4f7d5c,_0x451c12){_0x4f7d5c=_0x4f7d5c-0x0;var _0x3a75c2=_0x0c19[_0x4f7d5c];return _0x3a75c2;};'use strict';var multer=require('multer');var util=require(_0x90c1('0x0'));var path=require(_0x90c1('0x1'));var timeout=require(_0x90c1('0x2'));var express=require('express');var router=express[_0x90c1('0x3')]();var fs_extra=require(_0x90c1('0x4'));var auth=require(_0x90c1('0x5'));var interaction=require(_0x90c1('0x6'));var config=require(_0x90c1('0x7'));var controller=require(_0x90c1('0x8'));router[_0x90c1('0x9')]('/',auth['isAuthenticated'](),controller[_0x90c1('0xa')]);router[_0x90c1('0x9')]('/:id',auth[_0x90c1('0xb')](),controller[_0x90c1('0xc')]);router['post']('/',auth[_0x90c1('0xb')](),controller['create']);router['put'](_0x90c1('0xd'),auth[_0x90c1('0xb')](),controller['update']);router[_0x90c1('0xe')](_0x90c1('0xd'),auth['isAuthenticated'](),controller[_0x90c1('0xf')]);module[_0x90c1('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 55604d4..cae9879 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 _0x430e=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x5744b2,_0x1d7aad){var _0x2f3a26=function(_0x443128){while(--_0x443128){_0x5744b2['push'](_0x5744b2['shift']());}};_0x2f3a26(++_0x1d7aad);}(_0x430e,0x109));var _0xe430=function(_0x5baf32,_0x103278){_0x5baf32=_0x5baf32-0x0;var _0x539cae=_0x430e[_0x5baf32];return _0x539cae;};'use strict';var Sequelize=require(_0xe430('0x0'));module[_0xe430('0x1')]={'priority':{'type':Sequelize[_0xe430('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe430('0x3')],'allowNull':![],'defaultValue':_0xe430('0x4')},'appdata':{'type':Sequelize[_0xe430('0x5')]()},'description':{'type':Sequelize[_0xe430('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xe1f9=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x1fee29,_0x1aa1b5){var _0x2d2c2b=function(_0x1db2d2){while(--_0x1db2d2){_0x1fee29['push'](_0x1fee29['shift']());}};_0x2d2c2b(++_0x1aa1b5);}(_0xe1f9,0x1b2));var _0x9e1f=function(_0x5ade7f,_0x79ded4){_0x5ade7f=_0x5ade7f-0x0;var _0x5b277c=_0xe1f9[_0x5ade7f];return _0x5b277c;};'use strict';var Sequelize=require(_0x9e1f('0x0'));module[_0x9e1f('0x1')]={'priority':{'type':Sequelize[_0x9e1f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9e1f('0x3')],'allowNull':![],'defaultValue':_0x9e1f('0x4')},'appdata':{'type':Sequelize[_0x9e1f('0x5')]()},'description':{'type':Sequelize[_0x9e1f('0x3')]},'interval':{'type':Sequelize[_0x9e1f('0x3')],'defaultValue':_0x9e1f('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index c1d9e91..ddbb192 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 _0xfa92=['desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','OpenchannelApplication','includeAll','catch','show','params','keys','length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x4f4c2a,_0x5f5a28){var _0xd15be6=function(_0x1bc725){while(--_0x1bc725){_0x4f4c2a['push'](_0x4f4c2a['shift']());}};_0xd15be6(++_0x5f5a28);}(_0xfa92,0x11e));var _0x2fa9=function(_0x467887,_0x3148a5){_0x467887=_0x467887-0x0;var _0x5cddc7=_0xfa92[_0x467887];return _0x5cddc7;};'use strict';var emlformat=require(_0x2fa9('0x0'));var rimraf=require(_0x2fa9('0x1'));var zipdir=require(_0x2fa9('0x2'));var jsonpatch=require(_0x2fa9('0x3'));var rp=require(_0x2fa9('0x4'));var moment=require(_0x2fa9('0x5'));var BPromise=require(_0x2fa9('0x6'));var Mustache=require(_0x2fa9('0x7'));var util=require('util');var path=require(_0x2fa9('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2fa9('0x9'));var fs=require('fs');var fs_extra=require(_0x2fa9('0xa'));var _=require(_0x2fa9('0xb'));var squel=require(_0x2fa9('0xc'));var crypto=require('crypto');var jsforce=require(_0x2fa9('0xd'));var deskjs=require(_0x2fa9('0xe'));var toCsv=require(_0x2fa9('0xf'));var querystring=require('querystring');var Papa=require(_0x2fa9('0x10'));var Redis=require(_0x2fa9('0x11'));var authService=require(_0x2fa9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2fa9('0x13'));var hardwareService=require(_0x2fa9('0x14'));var logger=require(_0x2fa9('0x15'))(_0x2fa9('0x16'));var utils=require(_0x2fa9('0x17'));var config=require(_0x2fa9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2fa9('0x19'))['db'];function respondWithStatusCode(_0x4c113b,_0x384a42){_0x384a42=_0x384a42||0xcc;return function(_0x284549){if(_0x284549){return _0x4c113b[_0x2fa9('0x1a')](_0x384a42);}return _0x4c113b[_0x2fa9('0x1b')](_0x384a42)['end']();};}function respondWithResult(_0x487e63,_0x17edd5){_0x17edd5=_0x17edd5||0xc8;return function(_0x6100f3){if(_0x6100f3){return _0x487e63[_0x2fa9('0x1b')](_0x17edd5)['json'](_0x6100f3);}};}function respondWithFilteredResult(_0x172e1e,_0x1fb590){return function(_0x54caa8){if(_0x54caa8){var _0x4aa2f5=typeof _0x1fb590[_0x2fa9('0x1c')]==='undefined'&&typeof _0x1fb590[_0x2fa9('0x1d')]==='undefined';var _0x568daf=_0x54caa8[_0x2fa9('0x1e')];var _0x495067=_0x4aa2f5?0x0:_0x1fb590[_0x2fa9('0x1c')];var _0x4515ea=_0x4aa2f5?_0x54caa8[_0x2fa9('0x1e')]:_0x1fb590[_0x2fa9('0x1c')]+_0x1fb590[_0x2fa9('0x1d')];var _0x443a1f;if(_0x4515ea>=_0x568daf){_0x4515ea=_0x568daf;_0x443a1f=0xc8;}else{_0x443a1f=0xce;}_0x172e1e[_0x2fa9('0x1b')](_0x443a1f);return _0x172e1e['set'](_0x2fa9('0x1f'),_0x495067+'-'+_0x4515ea+'/'+_0x568daf)[_0x2fa9('0x20')](_0x54caa8);}return null;};}function patchUpdates(_0x3f090e){return function(_0x1b78dd){try{jsonpatch[_0x2fa9('0x21')](_0x1b78dd,_0x3f090e,!![]);}catch(_0x4aae3c){return BPromise[_0x2fa9('0x22')](_0x4aae3c);}return _0x1b78dd[_0x2fa9('0x23')]();};}function saveUpdates(_0x573cc2,_0x5e0b64){return function(_0xd96ef3){if(_0xd96ef3){return _0xd96ef3[_0x2fa9('0x24')](_0x573cc2)[_0x2fa9('0x25')](function(_0x4fd20f){return _0x4fd20f;});}return null;};}function removeEntity(_0x415995,_0x208df8){return function(_0x1cf480){if(_0x1cf480){return _0x1cf480[_0x2fa9('0x26')]()[_0x2fa9('0x25')](function(){_0x415995['status'](0xcc)[_0x2fa9('0x27')]();});}};}function handleEntityNotFound(_0x5bdaf1,_0x1c3c40){return function(_0x4a54c6){if(!_0x4a54c6){_0x5bdaf1['sendStatus'](0x194);}return _0x4a54c6;};}function handleError(_0x229451,_0x2260da){_0x2260da=_0x2260da||0x1f4;return function(_0xc8ba8c){logger[_0x2fa9('0x28')](_0xc8ba8c[_0x2fa9('0x29')]);if(_0xc8ba8c[_0x2fa9('0x2a')]){delete _0xc8ba8c[_0x2fa9('0x2a')];}_0x229451[_0x2fa9('0x1b')](_0x2260da)[_0x2fa9('0x2b')](_0xc8ba8c);};}exports['index']=function(_0x1c98af,_0x144fe9){var _0x4fdbd8={},_0x236e55={},_0x1bcf4d={'count':0x0,'rows':[]};var _0x24af74=_[_0x2fa9('0x2c')](db['OpenchannelApplication'][_0x2fa9('0x2d')],function(_0x34d222){return{'name':_0x34d222[_0x2fa9('0x2e')],'type':_0x34d222['type'][_0x2fa9('0x2f')]};});_0x236e55['model']=_[_0x2fa9('0x2c')](_0x24af74,_0x2fa9('0x2a'));_0x236e55[_0x2fa9('0x30')]=_['keys'](_0x1c98af[_0x2fa9('0x30')]);_0x236e55[_0x2fa9('0x31')]=_[_0x2fa9('0x32')](_0x236e55[_0x2fa9('0x33')],_0x236e55['query']);_0x4fdbd8[_0x2fa9('0x34')]=_[_0x2fa9('0x32')](_0x236e55['model'],qs[_0x2fa9('0x35')](_0x1c98af['query']['fields']));_0x4fdbd8[_0x2fa9('0x34')]=_0x4fdbd8['attributes']['length']?_0x4fdbd8[_0x2fa9('0x34')]:_0x236e55[_0x2fa9('0x33')];if(!_0x1c98af['query'][_0x2fa9('0x36')]('nolimit')){_0x4fdbd8[_0x2fa9('0x1d')]=qs[_0x2fa9('0x1d')](_0x1c98af[_0x2fa9('0x30')][_0x2fa9('0x1d')]);_0x4fdbd8[_0x2fa9('0x1c')]=qs[_0x2fa9('0x1c')](_0x1c98af['query']['offset']);}_0x4fdbd8[_0x2fa9('0x37')]=qs[_0x2fa9('0x38')](_0x1c98af['query']['sort']);_0x4fdbd8['where']=qs[_0x2fa9('0x31')](_[_0x2fa9('0x39')](_0x1c98af[_0x2fa9('0x30')],_0x236e55[_0x2fa9('0x31')]),_0x24af74);if(_0x1c98af[_0x2fa9('0x30')][_0x2fa9('0x3a')]){_0x4fdbd8[_0x2fa9('0x3b')]=_[_0x2fa9('0x3c')](_0x4fdbd8[_0x2fa9('0x3b')],{'$or':_[_0x2fa9('0x2c')](_0x24af74,function(_0x276735){if(_0x276735[_0x2fa9('0x3d')]!==_0x2fa9('0x3e')){var _0x3e6698={};_0x3e6698[_0x276735[_0x2fa9('0x2a')]]={'$like':'%'+_0x1c98af['query'][_0x2fa9('0x3a')]+'%'};return _0x3e6698;}})});}_0x4fdbd8=_['merge']({},_0x4fdbd8,_0x1c98af[_0x2fa9('0x3f')]);var _0x5d2145={'where':_0x4fdbd8['where']};return db[_0x2fa9('0x40')][_0x2fa9('0x1e')](_0x5d2145)[_0x2fa9('0x25')](function(_0x74948d){_0x1bcf4d[_0x2fa9('0x1e')]=_0x74948d;if(_0x1c98af[_0x2fa9('0x30')][_0x2fa9('0x41')]){_0x4fdbd8['include']=[{'all':!![]}];}return db[_0x2fa9('0x40')]['findAll'](_0x4fdbd8);})[_0x2fa9('0x25')](function(_0x2756d7){_0x1bcf4d['rows']=_0x2756d7;return _0x1bcf4d;})['then'](respondWithFilteredResult(_0x144fe9,_0x4fdbd8))[_0x2fa9('0x42')](handleError(_0x144fe9,null));};exports[_0x2fa9('0x43')]=function(_0x512f56,_0x4a67ae){var _0x4547ac={'raw':!![],'where':{'id':_0x512f56[_0x2fa9('0x44')]['id']}},_0x488143={};_0x488143[_0x2fa9('0x33')]=_[_0x2fa9('0x45')](db[_0x2fa9('0x40')][_0x2fa9('0x2d')]);_0x488143['query']=_['keys'](_0x512f56['query']);_0x488143[_0x2fa9('0x31')]=_[_0x2fa9('0x32')](_0x488143[_0x2fa9('0x33')],_0x488143[_0x2fa9('0x30')]);_0x4547ac['attributes']=_[_0x2fa9('0x32')](_0x488143[_0x2fa9('0x33')],qs[_0x2fa9('0x35')](_0x512f56[_0x2fa9('0x30')][_0x2fa9('0x35')]));_0x4547ac['attributes']=_0x4547ac[_0x2fa9('0x34')][_0x2fa9('0x46')]?_0x4547ac[_0x2fa9('0x34')]:_0x488143['model'];if(_0x512f56[_0x2fa9('0x30')]['includeAll']){_0x4547ac[_0x2fa9('0x47')]=[{'all':!![]}];}_0x4547ac=_[_0x2fa9('0x3c')]({},_0x4547ac,_0x512f56[_0x2fa9('0x3f')]);return db[_0x2fa9('0x40')][_0x2fa9('0x48')](_0x4547ac)[_0x2fa9('0x25')](handleEntityNotFound(_0x4a67ae,null))[_0x2fa9('0x25')](respondWithResult(_0x4a67ae,null))[_0x2fa9('0x42')](handleError(_0x4a67ae,null));};exports[_0x2fa9('0x49')]=function(_0x2cb258,_0x18f8f5){return db['OpenchannelApplication'][_0x2fa9('0x49')](_0x2cb258[_0x2fa9('0x4a')],{})[_0x2fa9('0x25')](respondWithResult(_0x18f8f5,0xc9))[_0x2fa9('0x42')](handleError(_0x18f8f5,null));};exports[_0x2fa9('0x24')]=function(_0x112240,_0x1ef9f7){if(_0x112240[_0x2fa9('0x4a')]['id']){delete _0x112240['body']['id'];}return db[_0x2fa9('0x40')][_0x2fa9('0x48')]({'where':{'id':_0x112240[_0x2fa9('0x44')]['id']}})[_0x2fa9('0x25')](handleEntityNotFound(_0x1ef9f7,null))[_0x2fa9('0x25')](saveUpdates(_0x112240[_0x2fa9('0x4a')],null))[_0x2fa9('0x25')](respondWithResult(_0x1ef9f7,null))[_0x2fa9('0x42')](handleError(_0x1ef9f7,null));};exports['destroy']=function(_0x40387c,_0x33919d){return db[_0x2fa9('0x40')][_0x2fa9('0x48')]({'where':{'id':_0x40387c[_0x2fa9('0x44')]['id']}})[_0x2fa9('0x25')](handleEntityNotFound(_0x33919d,null))[_0x2fa9('0x25')](removeEntity(_0x33919d,null))[_0x2fa9('0x42')](handleError(_0x33919d,null));}; \ No newline at end of file +var _0xbf95=['rows','catch','show','params','rawAttributes','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','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','OpenchannelApplication','findAll'];(function(_0x5cf809,_0x2995c5){var _0x320563=function(_0x4e4c0d){while(--_0x4e4c0d){_0x5cf809['push'](_0x5cf809['shift']());}};_0x320563(++_0x2995c5);}(_0xbf95,0x18e));var _0x5bf9=function(_0xfbd8a,_0x394310){_0xfbd8a=_0xfbd8a-0x0;var _0x7349ff=_0xbf95[_0xfbd8a];return _0x7349ff;};'use strict';var emlformat=require(_0x5bf9('0x0'));var rimraf=require(_0x5bf9('0x1'));var zipdir=require(_0x5bf9('0x2'));var jsonpatch=require(_0x5bf9('0x3'));var rp=require(_0x5bf9('0x4'));var moment=require(_0x5bf9('0x5'));var BPromise=require(_0x5bf9('0x6'));var Mustache=require(_0x5bf9('0x7'));var util=require(_0x5bf9('0x8'));var path=require(_0x5bf9('0x9'));var sox=require(_0x5bf9('0xa'));var csv=require(_0x5bf9('0xb'));var ejs=require(_0x5bf9('0xc'));var fs=require('fs');var fs_extra=require(_0x5bf9('0xd'));var _=require(_0x5bf9('0xe'));var squel=require('squel');var crypto=require(_0x5bf9('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5bf9('0x10'));var toCsv=require(_0x5bf9('0xb'));var querystring=require('querystring');var Papa=require(_0x5bf9('0x11'));var Redis=require(_0x5bf9('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bf9('0x13'));var logger=require('../../config/logger')(_0x5bf9('0x14'));var utils=require(_0x5bf9('0x15'));var config=require(_0x5bf9('0x16'));var licenseUtil=require(_0x5bf9('0x17'));var db=require(_0x5bf9('0x18'))['db'];function respondWithStatusCode(_0x4e544c,_0x1d58e6){_0x1d58e6=_0x1d58e6||0xcc;return function(_0x3ad3e7){if(_0x3ad3e7){return _0x4e544c[_0x5bf9('0x19')](_0x1d58e6);}return _0x4e544c[_0x5bf9('0x1a')](_0x1d58e6)[_0x5bf9('0x1b')]();};}function respondWithResult(_0x4d7e5a,_0x4df976){_0x4df976=_0x4df976||0xc8;return function(_0x58a014){if(_0x58a014){return _0x4d7e5a[_0x5bf9('0x1a')](_0x4df976)[_0x5bf9('0x1c')](_0x58a014);}};}function respondWithFilteredResult(_0x15b739,_0x56d0d0){return function(_0x4ce77a){if(_0x4ce77a){var _0x39951d=typeof _0x56d0d0['offset']==='undefined'&&typeof _0x56d0d0[_0x5bf9('0x1d')]===_0x5bf9('0x1e');var _0x3cb969=_0x4ce77a[_0x5bf9('0x1f')];var _0x23a459=_0x39951d?0x0:_0x56d0d0[_0x5bf9('0x20')];var _0x76d473=_0x39951d?_0x4ce77a[_0x5bf9('0x1f')]:_0x56d0d0[_0x5bf9('0x20')]+_0x56d0d0[_0x5bf9('0x1d')];var _0x368ebd;if(_0x76d473>=_0x3cb969){_0x76d473=_0x3cb969;_0x368ebd=0xc8;}else{_0x368ebd=0xce;}_0x15b739[_0x5bf9('0x1a')](_0x368ebd);return _0x15b739[_0x5bf9('0x21')](_0x5bf9('0x22'),_0x23a459+'-'+_0x76d473+'/'+_0x3cb969)[_0x5bf9('0x1c')](_0x4ce77a);}return null;};}function patchUpdates(_0x1b674f){return function(_0x4797f6){try{jsonpatch[_0x5bf9('0x23')](_0x4797f6,_0x1b674f,!![]);}catch(_0x3812fa){return BPromise[_0x5bf9('0x24')](_0x3812fa);}return _0x4797f6[_0x5bf9('0x25')]();};}function saveUpdates(_0x165739,_0xfd59b3){return function(_0xd40070){if(_0xd40070){return _0xd40070[_0x5bf9('0x26')](_0x165739)['then'](function(_0x137b9d){return _0x137b9d;});}return null;};}function removeEntity(_0x4c010c,_0x1e3a5b){return function(_0x496dad){if(_0x496dad){return _0x496dad[_0x5bf9('0x27')]()['then'](function(){_0x4c010c[_0x5bf9('0x1a')](0xcc)[_0x5bf9('0x1b')]();});}};}function handleEntityNotFound(_0x2d1d34,_0x1b5901){return function(_0x5f1882){if(!_0x5f1882){_0x2d1d34[_0x5bf9('0x19')](0x194);}return _0x5f1882;};}function handleError(_0x595ec9,_0x2fe65c){_0x2fe65c=_0x2fe65c||0x1f4;return function(_0x488f50){logger[_0x5bf9('0x28')](_0x488f50[_0x5bf9('0x29')]);if(_0x488f50[_0x5bf9('0x2a')]){delete _0x488f50['name'];}_0x595ec9[_0x5bf9('0x1a')](_0x2fe65c)[_0x5bf9('0x2b')](_0x488f50);};}exports['index']=function(_0xcd0ffa,_0x1061dc){var _0x529301={},_0x5503b3={},_0xf99c98={'count':0x0,'rows':[]};var _0x599e52=_[_0x5bf9('0x2c')](db['OpenchannelApplication']['rawAttributes'],function(_0x5d3436){return{'name':_0x5d3436['fieldName'],'type':_0x5d3436[_0x5bf9('0x2d')][_0x5bf9('0x2e')]};});_0x5503b3['model']=_[_0x5bf9('0x2c')](_0x599e52,_0x5bf9('0x2a'));_0x5503b3['query']=_[_0x5bf9('0x2f')](_0xcd0ffa[_0x5bf9('0x30')]);_0x5503b3[_0x5bf9('0x31')]=_[_0x5bf9('0x32')](_0x5503b3[_0x5bf9('0x33')],_0x5503b3[_0x5bf9('0x30')]);_0x529301['attributes']=_[_0x5bf9('0x32')](_0x5503b3['model'],qs[_0x5bf9('0x34')](_0xcd0ffa[_0x5bf9('0x30')][_0x5bf9('0x34')]));_0x529301[_0x5bf9('0x35')]=_0x529301[_0x5bf9('0x35')][_0x5bf9('0x36')]?_0x529301['attributes']:_0x5503b3['model'];if(!_0xcd0ffa[_0x5bf9('0x30')][_0x5bf9('0x37')](_0x5bf9('0x38'))){_0x529301[_0x5bf9('0x1d')]=qs[_0x5bf9('0x1d')](_0xcd0ffa[_0x5bf9('0x30')]['limit']);_0x529301[_0x5bf9('0x20')]=qs[_0x5bf9('0x20')](_0xcd0ffa[_0x5bf9('0x30')][_0x5bf9('0x20')]);}_0x529301[_0x5bf9('0x39')]=qs[_0x5bf9('0x3a')](_0xcd0ffa['query'][_0x5bf9('0x3a')]);_0x529301['where']=qs[_0x5bf9('0x31')](_[_0x5bf9('0x3b')](_0xcd0ffa[_0x5bf9('0x30')],_0x5503b3[_0x5bf9('0x31')]),_0x599e52);if(_0xcd0ffa['query'][_0x5bf9('0x3c')]){_0x529301[_0x5bf9('0x3d')]=_[_0x5bf9('0x3e')](_0x529301[_0x5bf9('0x3d')],{'$or':_['map'](_0x599e52,function(_0x12bd52){if(_0x12bd52[_0x5bf9('0x2d')]!==_0x5bf9('0x3f')){var _0x1e3d2d={};_0x1e3d2d[_0x12bd52[_0x5bf9('0x2a')]]={'$like':'%'+_0xcd0ffa['query'][_0x5bf9('0x3c')]+'%'};return _0x1e3d2d;}})});}_0x529301=_[_0x5bf9('0x3e')]({},_0x529301,_0xcd0ffa[_0x5bf9('0x40')]);var _0x2e1d13={'where':_0x529301[_0x5bf9('0x3d')]};return db['OpenchannelApplication'][_0x5bf9('0x1f')](_0x2e1d13)[_0x5bf9('0x41')](function(_0x4d904d){_0xf99c98[_0x5bf9('0x1f')]=_0x4d904d;if(_0xcd0ffa[_0x5bf9('0x30')][_0x5bf9('0x42')]){_0x529301[_0x5bf9('0x43')]=[{'all':!![]}];}return db[_0x5bf9('0x44')][_0x5bf9('0x45')](_0x529301);})['then'](function(_0x473845){_0xf99c98[_0x5bf9('0x46')]=_0x473845;return _0xf99c98;})[_0x5bf9('0x41')](respondWithFilteredResult(_0x1061dc,_0x529301))[_0x5bf9('0x47')](handleError(_0x1061dc,null));};exports[_0x5bf9('0x48')]=function(_0x2d25ee,_0x613f30){var _0x5cba1f={'raw':!![],'where':{'id':_0x2d25ee[_0x5bf9('0x49')]['id']}},_0x4d05e1={};_0x4d05e1[_0x5bf9('0x33')]=_[_0x5bf9('0x2f')](db['OpenchannelApplication'][_0x5bf9('0x4a')]);_0x4d05e1[_0x5bf9('0x30')]=_['keys'](_0x2d25ee[_0x5bf9('0x30')]);_0x4d05e1['filters']=_[_0x5bf9('0x32')](_0x4d05e1[_0x5bf9('0x33')],_0x4d05e1[_0x5bf9('0x30')]);_0x5cba1f[_0x5bf9('0x35')]=_[_0x5bf9('0x32')](_0x4d05e1[_0x5bf9('0x33')],qs[_0x5bf9('0x34')](_0x2d25ee[_0x5bf9('0x30')][_0x5bf9('0x34')]));_0x5cba1f[_0x5bf9('0x35')]=_0x5cba1f[_0x5bf9('0x35')]['length']?_0x5cba1f[_0x5bf9('0x35')]:_0x4d05e1[_0x5bf9('0x33')];if(_0x2d25ee[_0x5bf9('0x30')][_0x5bf9('0x42')]){_0x5cba1f[_0x5bf9('0x43')]=[{'all':!![]}];}_0x5cba1f=_[_0x5bf9('0x3e')]({},_0x5cba1f,_0x2d25ee['options']);return db['OpenchannelApplication'][_0x5bf9('0x4b')](_0x5cba1f)[_0x5bf9('0x41')](handleEntityNotFound(_0x613f30,null))[_0x5bf9('0x41')](respondWithResult(_0x613f30,null))[_0x5bf9('0x47')](handleError(_0x613f30,null));};exports[_0x5bf9('0x4c')]=function(_0x4d9ac8,_0x140afc){return db[_0x5bf9('0x44')][_0x5bf9('0x4c')](_0x4d9ac8[_0x5bf9('0x4d')],{})['then'](respondWithResult(_0x140afc,0xc9))[_0x5bf9('0x47')](handleError(_0x140afc,null));};exports['update']=function(_0x13c507,_0x27f085){if(_0x13c507[_0x5bf9('0x4d')]['id']){delete _0x13c507[_0x5bf9('0x4d')]['id'];}return db['OpenchannelApplication'][_0x5bf9('0x4b')]({'where':{'id':_0x13c507['params']['id']}})[_0x5bf9('0x41')](handleEntityNotFound(_0x27f085,null))[_0x5bf9('0x41')](saveUpdates(_0x13c507[_0x5bf9('0x4d')],null))[_0x5bf9('0x41')](respondWithResult(_0x27f085,null))['catch'](handleError(_0x27f085,null));};exports[_0x5bf9('0x27')]=function(_0x192227,_0x258265){return db[_0x5bf9('0x44')][_0x5bf9('0x4b')]({'where':{'id':_0x192227[_0x5bf9('0x49')]['id']}})[_0x5bf9('0x41')](handleEntityNotFound(_0x258265,null))[_0x5bf9('0x41')](removeEntity(_0x258265,null))[_0x5bf9('0x47')](handleError(_0x258265,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 3110fab..c33292e 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 _0x7082=['./openchannelApplication.attributes','exports','OpenchannelApplication','utf8mb4','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5476c9,_0x190dcd){var _0x33b3ac=function(_0x4a3382){while(--_0x4a3382){_0x5476c9['push'](_0x5476c9['shift']());}};_0x33b3ac(++_0x190dcd);}(_0x7082,0xd6));var _0x2708=function(_0x357702,_0x203968){_0x357702=_0x357702-0x0;var _0x4dd94a=_0x7082[_0x357702];return _0x4dd94a;};'use strict';var _=require(_0x2708('0x0'));var util=require(_0x2708('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2708('0x2'));var rp=require(_0x2708('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2708('0x4'));var config=require(_0x2708('0x5'));var attributes=require(_0x2708('0x6'));module[_0x2708('0x7')]=function(_0x1fe4a1,_0x117b18){return _0x1fe4a1['define'](_0x2708('0x8'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2708('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0c9c=['rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x225400,_0x4b39b5){var _0x10e30a=function(_0x270e40){while(--_0x270e40){_0x225400['push'](_0x225400['shift']());}};_0x10e30a(++_0x4b39b5);}(_0x0c9c,0x158));var _0xc0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc0c9('0x0'));var util=require(_0xc0c9('0x1'));var logger=require(_0xc0c9('0x2'))(_0xc0c9('0x3'));var moment=require(_0xc0c9('0x4'));var BPromise=require(_0xc0c9('0x5'));var rp=require(_0xc0c9('0x6'));var fs=require('fs');var path=require(_0xc0c9('0x7'));var rimraf=require(_0xc0c9('0x8'));var config=require(_0xc0c9('0x9'));var attributes=require(_0xc0c9('0xa'));module[_0xc0c9('0xb')]=function(_0x530ddf,_0x2b55bd){return _0x530ddf[_0xc0c9('0xc')](_0xc0c9('0xd'),attributes,{'tableName':_0xc0c9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc0c9('0xf')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 9699027..aa0c62e 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 _0xc0ed=['debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','info'];(function(_0x3c5cb8,_0x18f1b2){var _0x51fadd=function(_0x2f3292){while(--_0x2f3292){_0x3c5cb8['push'](_0x3c5cb8['shift']());}};_0x51fadd(++_0x18f1b2);}(_0xc0ed,0x1ed));var _0xdc0e=function(_0x5671e0,_0xd59bec){_0x5671e0=_0x5671e0-0x0;var _0x3c1836=_0xc0ed[_0x5671e0];return _0x3c1836;};'use strict';var _=require(_0xdc0e('0x0'));var util=require('util');var moment=require(_0xdc0e('0x1'));var BPromise=require(_0xdc0e('0x2'));var rs=require(_0xdc0e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc0e('0x4'))['db'];var utils=require(_0xdc0e('0x5'));var logger=require('../../config/logger')(_0xdc0e('0x6'));var config=require(_0xdc0e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdc0e('0x8')][_0xdc0e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37e53d,_0x534628,_0x429027){return new BPromise(function(_0x1ec66d,_0x4332de){return client['request'](_0x37e53d,_0x429027)['then'](function(_0x13d40b){logger[_0xdc0e('0xa')]('OpenchannelApplication,\x20%s,\x20%s',_0x534628,'request\x20sent');logger[_0xdc0e('0xb')](_0xdc0e('0xc'),_0x534628,_0xdc0e('0xd'),JSON[_0xdc0e('0xe')](_0x13d40b));if(_0x13d40b[_0xdc0e('0xf')]){if(_0x13d40b['error']['code']===0x1f4){logger[_0xdc0e('0xf')](_0xdc0e('0x10'),_0x534628,_0x13d40b[_0xdc0e('0xf')][_0xdc0e('0x11')]);return _0x4332de(_0x13d40b[_0xdc0e('0xf')]['message']);}logger[_0xdc0e('0xf')](_0xdc0e('0x10'),_0x534628,_0x13d40b['error']['message']);return _0x1ec66d(_0x13d40b['error'][_0xdc0e('0x11')]);}else{logger[_0xdc0e('0xa')]('OpenchannelApplication,\x20%s,\x20%s',_0x534628,_0xdc0e('0xd'));_0x1ec66d(_0x13d40b[_0xdc0e('0x12')]['message']);}})[_0xdc0e('0x13')](function(_0x6fb32c){logger[_0xdc0e('0xf')](_0xdc0e('0x10'),_0x534628,_0x6fb32c);_0x4332de(_0x6fb32c);});});}exports[_0xdc0e('0x14')]=function(_0x41caf0){var _0x1be6e6=this;return new Promise(function(_0xf091c9,_0x40a4f6){return db[_0xdc0e('0x15')][_0xdc0e('0x16')](_0x41caf0['body'],{'raw':_0x41caf0[_0xdc0e('0x17')]?_0x41caf0['options'][_0xdc0e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41caf0[_0xdc0e('0x17')]?_0x41caf0['options'][_0xdc0e('0x19')]||null:null,'attributes':_0x41caf0[_0xdc0e('0x17')]?_0x41caf0[_0xdc0e('0x17')][_0xdc0e('0x1a')]||null:null,'limit':_0x41caf0[_0xdc0e('0x17')]?_0x41caf0[_0xdc0e('0x17')]['limit']||null:null})[_0xdc0e('0x1b')](function(_0x16b8c2){logger[_0xdc0e('0xa')](_0xdc0e('0x14'),_0x41caf0);logger[_0xdc0e('0xb')](_0xdc0e('0x14'),_0x41caf0,JSON[_0xdc0e('0xe')](_0x16b8c2));_0xf091c9(_0x16b8c2);})[_0xdc0e('0x13')](function(_0x5db868){logger['error'](_0xdc0e('0x14'),_0x5db868['message'],_0x41caf0);_0x40a4f6(_0x1be6e6[_0xdc0e('0xf')](0x1f4,_0x5db868[_0xdc0e('0x11')]));});});}; \ No newline at end of file +var _0x21bc=['moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateOpenchannelApplication','body','options','raw','attributes','info','lodash','util'];(function(_0x5e8c98,_0xf42c9c){var _0x487a2a=function(_0x3457a1){while(--_0x3457a1){_0x5e8c98['push'](_0x5e8c98['shift']());}};_0x487a2a(++_0xf42c9c);}(_0x21bc,0x193));var _0xc21b=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x21bc[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xc21b('0x0'));var util=require(_0xc21b('0x1'));var moment=require(_0xc21b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc21b('0x3'))['db'];var utils=require(_0xc21b('0x4'));var logger=require(_0xc21b('0x5'))(_0xc21b('0x6'));var config=require('../../config/environment');var jayson=require(_0xc21b('0x7'));var client=jayson[_0xc21b('0x8')][_0xc21b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c44f4,_0x35362e,_0x4c26ce){return new BPromise(function(_0x2acdf8,_0x2ee2a4){return client[_0xc21b('0xa')](_0x1c44f4,_0x4c26ce)[_0xc21b('0xb')](function(_0x4adc16){logger['info'](_0xc21b('0xc'),_0x35362e,'request\x20sent');logger[_0xc21b('0xd')](_0xc21b('0xe'),_0x35362e,_0xc21b('0xf'),JSON[_0xc21b('0x10')](_0x4adc16));if(_0x4adc16[_0xc21b('0x11')]){if(_0x4adc16[_0xc21b('0x11')][_0xc21b('0x12')]===0x1f4){logger[_0xc21b('0x11')](_0xc21b('0xc'),_0x35362e,_0x4adc16[_0xc21b('0x11')][_0xc21b('0x13')]);return _0x2ee2a4(_0x4adc16['error'][_0xc21b('0x13')]);}logger['error'](_0xc21b('0xc'),_0x35362e,_0x4adc16[_0xc21b('0x11')]['message']);return _0x2acdf8(_0x4adc16['error'][_0xc21b('0x13')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x35362e,_0xc21b('0xf'));_0x2acdf8(_0x4adc16['result'][_0xc21b('0x13')]);}})[_0xc21b('0x14')](function(_0x4cd9da){logger[_0xc21b('0x11')](_0xc21b('0xc'),_0x35362e,_0x4cd9da);_0x2ee2a4(_0x4cd9da);});});}exports[_0xc21b('0x15')]=function(_0xe00450){var _0x4fbba3=this;return new Promise(function(_0x16616d,_0x2a5116){return db['OpenchannelApplication']['update'](_0xe00450[_0xc21b('0x16')],{'raw':_0xe00450[_0xc21b('0x17')]?_0xe00450[_0xc21b('0x17')][_0xc21b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe00450['options']?_0xe00450[_0xc21b('0x17')]['where']||null:null,'attributes':_0xe00450[_0xc21b('0x17')]?_0xe00450[_0xc21b('0x17')][_0xc21b('0x19')]||null:null,'limit':_0xe00450['options']?_0xe00450[_0xc21b('0x17')]['limit']||null:null})[_0xc21b('0xb')](function(_0x213533){logger[_0xc21b('0x1a')](_0xc21b('0x15'),_0xe00450);logger[_0xc21b('0xd')](_0xc21b('0x15'),_0xe00450,JSON[_0xc21b('0x10')](_0x213533));_0x16616d(_0x213533);})[_0xc21b('0x14')](function(_0x1222ad){logger[_0xc21b('0x11')](_0xc21b('0x15'),_0x1222ad[_0xc21b('0x13')],_0xe00450);_0x2a5116(_0x4fbba3[_0xc21b('0x11')](0x1f4,_0x1222ad[_0xc21b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index b5448c2..2cbeb9d 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 _0x798c=['put','openchannelinteraction:update','update','openchannel','destroy','delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x798c,0x86));var _0xc798=function(_0x4c86e8,_0x3cbde1){_0x4c86e8=_0x4c86e8-0x0;var _0xddc75=_0x798c[_0x4c86e8];return _0xddc75;};'use strict';var multer=require(_0xc798('0x0'));var util=require(_0xc798('0x1'));var path=require('path');var timeout=require(_0xc798('0x2'));var express=require(_0xc798('0x3'));var router=express['Router']();var fs_extra=require(_0xc798('0x4'));var auth=require(_0xc798('0x5'));var interaction=require(_0xc798('0x6'));var config=require(_0xc798('0x7'));var controller=require(_0xc798('0x8'));router[_0xc798('0x9')]('/',auth[_0xc798('0xa')](),controller[_0xc798('0xb')]);router['get']('/describe',auth[_0xc798('0xa')](),controller[_0xc798('0xc')]);router[_0xc798('0x9')](_0xc798('0xd'),auth[_0xc798('0xa')](),controller[_0xc798('0xe')]);router[_0xc798('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0xc798('0xf')]);router[_0xc798('0x9')](_0xc798('0x10'),auth[_0xc798('0xa')](),controller[_0xc798('0x11')]);router[_0xc798('0x12')]('/',auth[_0xc798('0xa')](),controller[_0xc798('0x13')]);router[_0xc798('0x12')](_0xc798('0x14'),auth[_0xc798('0xa')](),controller[_0xc798('0x15')]);router['post'](_0xc798('0x16'),auth['isAuthenticated'](),interaction[_0xc798('0x17')]('openchannel',_0xc798('0x18')),controller[_0xc798('0x19')]);router[_0xc798('0x1a')](_0xc798('0xd'),auth[_0xc798('0xa')](),interaction['tracked']('openchannel',_0xc798('0x1b')),controller[_0xc798('0x1c')]);router['delete'](_0xc798('0xd'),auth[_0xc798('0xa')](),interaction[_0xc798('0x17')](_0xc798('0x1d'),'openchannelinteraction:destroy'),controller[_0xc798('0x1e')]);router[_0xc798('0x1f')](_0xc798('0x16'),auth[_0xc798('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xde2d=['/:id','show','/:id/messages','/:id/download','download','post','create','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe'];(function(_0x458edc,_0x9baf98){var _0x44af29=function(_0x41929c){while(--_0x41929c){_0x458edc['push'](_0x458edc['shift']());}};_0x44af29(++_0x9baf98);}(_0xde2d,0x1a5));var _0xdde2=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0xde2d[_0x33bc64];return _0x3fdd34;};'use strict';var multer=require(_0xdde2('0x0'));var util=require(_0xdde2('0x1'));var path=require(_0xdde2('0x2'));var timeout=require(_0xdde2('0x3'));var express=require(_0xdde2('0x4'));var router=express[_0xdde2('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdde2('0x6'));var config=require(_0xdde2('0x7'));var controller=require(_0xdde2('0x8'));router[_0xdde2('0x9')]('/',auth[_0xdde2('0xa')](),controller['index']);router[_0xdde2('0x9')](_0xdde2('0xb'),auth[_0xdde2('0xa')](),controller[_0xdde2('0xc')]);router['get'](_0xdde2('0xd'),auth[_0xdde2('0xa')](),controller[_0xdde2('0xe')]);router[_0xdde2('0x9')](_0xdde2('0xf'),auth[_0xdde2('0xa')](),controller['getMessages']);router[_0xdde2('0x9')](_0xdde2('0x10'),auth['isAuthenticated'](),controller[_0xdde2('0x11')]);router[_0xdde2('0x12')]('/',auth[_0xdde2('0xa')](),controller[_0xdde2('0x13')]);router[_0xdde2('0x12')]('/:id/messages',auth[_0xdde2('0xa')](),controller['addMessage']);router['post'](_0xdde2('0x14'),auth[_0xdde2('0xa')](),interaction[_0xdde2('0x15')](_0xdde2('0x16'),_0xdde2('0x17')),controller[_0xdde2('0x18')]);router[_0xdde2('0x19')](_0xdde2('0xd'),auth['isAuthenticated'](),interaction[_0xdde2('0x15')]('openchannel',_0xdde2('0x1a')),controller[_0xdde2('0x1b')]);router[_0xdde2('0x1c')](_0xdde2('0xd'),auth[_0xdde2('0xa')](),interaction[_0xdde2('0x15')](_0xdde2('0x16'),_0xdde2('0x1d')),controller[_0xdde2('0x1e')]);router[_0xdde2('0x1c')](_0xdde2('0x14'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index bbe6fad..7a9407c 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 _0x63ad=['BOOLEAN','STRING','DATE','ENUM','out','exports'];(function(_0x45ae7b,_0xa7577d){var _0x2298fc=function(_0x4c0922){while(--_0x4c0922){_0x45ae7b['push'](_0x45ae7b['shift']());}};_0x2298fc(++_0xa7577d);}(_0x63ad,0x7d));var _0xd63a=function(_0x729bfe,_0x144569){_0x729bfe=_0x729bfe-0x0;var _0xe794b3=_0x63ad[_0x729bfe];return _0xe794b3;};'use strict';var Sequelize=require('sequelize');module[_0xd63a('0x0')]={'closed':{'type':Sequelize[_0xd63a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd63a('0x2')]},'read1stAt':{'type':Sequelize[_0xd63a('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xd63a('0x2')]},'lastMsgAt':{'type':Sequelize[_0xd63a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd63a('0x4')]('in',_0xd63a('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xd63a('0x4')]('in',_0xd63a('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xd63a('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa03c=['INTEGER','sequelize','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x15f3c0,_0x165a64){var _0x1adfe0=function(_0x212cfc){while(--_0x212cfc){_0x15f3c0['push'](_0x15f3c0['shift']());}};_0x1adfe0(++_0x165a64);}(_0xa03c,0x94));var _0xca03=function(_0x47f9c2,_0x434c7e){_0x47f9c2=_0x47f9c2-0x0;var _0x1cfc04=_0xa03c[_0x47f9c2];return _0x1cfc04;};'use strict';var Sequelize=require(_0xca03('0x0'));module['exports']={'closed':{'type':Sequelize[_0xca03('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xca03('0x2')]},'disposition':{'type':Sequelize[_0xca03('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xca03('0x3')]},'note':{'type':Sequelize[_0xca03('0x3')]},'read1stAt':{'type':Sequelize[_0xca03('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xca03('0x3')]},'lastMsgAt':{'type':Sequelize[_0xca03('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xca03('0x4')]('in',_0xca03('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xca03('0x4')]('in',_0xca03('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xca03('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xca03('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 1476de1..46e615f 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 _0xf087=['views','downloadInteraction.ejs','transcript-','rimraf','moment','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','localhost','./openchannelInteraction.socket','status','end','json','undefined','limit','offset','count','Content-Range','update','destroy','then','sendStatus','error','stack','name','send','index','OpenchannelInteraction','rawAttributes','fieldName','type','findAll','openchannel','query','user','catch','from','params','model','keys','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','describe','addMessage','OpenchannelMessage','find','omit','ids','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','where','OpenchannelInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','push','CmContact','firstName','Attachment','Messages','direction','read','OpenchannelAccount','Owner','fullname','get','Openchannel','closed','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','createdAt','out','System','Contact','lastName','secret','value','renderFile'];(function(_0x5744b5,_0x325462){var _0x3042d8=function(_0x1e64ad){while(--_0x1e64ad){_0x5744b5['push'](_0x5744b5['shift']());}};_0x3042d8(++_0x325462);}(_0xf087,0x81));var _0x7f08=function(_0x3ae151,_0x43e8ec){_0x3ae151=_0x3ae151-0x0;var _0x445318=_0xf087[_0x3ae151];return _0x445318;};'use strict';var rimraf=require(_0x7f08('0x0'));var zipdir=require('zip-dir');var moment=require(_0x7f08('0x1'));var util=require(_0x7f08('0x2'));var path=require(_0x7f08('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x7f08('0x4'));var interaction=require(_0x7f08('0x5'));var qs=require(_0x7f08('0x6'));var pdf=require(_0x7f08('0x7'));var logger=require(_0x7f08('0x8'))('api');var config=require(_0x7f08('0x9'));var db=require('../../mysqldb')['db'];config[_0x7f08('0xa')]=_[_0x7f08('0xb')](config[_0x7f08('0xa')],{'host':_0x7f08('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f08('0xa')]));require(_0x7f08('0xd'))['register'](socket);function respondWithStatusCode(_0x2aa062,_0x665dc6){_0x665dc6=_0x665dc6||0xcc;return function(_0xd6b919){if(_0xd6b919){return _0x2aa062['sendStatus'](_0x665dc6);}return _0x2aa062[_0x7f08('0xe')](_0x665dc6)[_0x7f08('0xf')]();};}function respondWithResult(_0x4c800e,_0x1e2cd1){_0x1e2cd1=_0x1e2cd1||0xc8;return function(_0xdc64b6){if(_0xdc64b6){return _0x4c800e[_0x7f08('0xe')](_0x1e2cd1)[_0x7f08('0x10')](_0xdc64b6);}};}function respondWithFilteredResult(_0x555ddf,_0x51d3c2){return function(_0x15ec9e){if(_0x15ec9e){var _0x441d27=typeof _0x51d3c2['offset']===_0x7f08('0x11')&&typeof _0x51d3c2[_0x7f08('0x12')]===_0x7f08('0x11');var _0x148608=_0x15ec9e['count'];var _0x2f8fb6=_0x441d27?0x0:_0x51d3c2[_0x7f08('0x13')];var _0x5972ed=_0x441d27?_0x15ec9e[_0x7f08('0x14')]:_0x51d3c2['offset']+_0x51d3c2['limit'];var _0x4d9585;if(_0x5972ed>=_0x148608){_0x5972ed=_0x148608;_0x4d9585=0xc8;}else{_0x4d9585=0xce;}_0x555ddf[_0x7f08('0xe')](_0x4d9585);return _0x555ddf['set'](_0x7f08('0x15'),_0x2f8fb6+'-'+_0x5972ed+'/'+_0x148608)[_0x7f08('0x10')](_0x15ec9e);}return null;};}function saveUpdates(_0x115ab4){return function(_0x227a5d){if(_0x227a5d){return _0x227a5d[_0x7f08('0x16')](_0x115ab4)['then'](function(_0x1dff50){return _0x1dff50;});}return null;};}function removeEntity(_0x3dedc9){return function(_0x33cc4e){if(_0x33cc4e){return _0x33cc4e[_0x7f08('0x17')]()[_0x7f08('0x18')](function(){_0x3dedc9[_0x7f08('0xe')](0xcc)[_0x7f08('0xf')]();});}};}function handleEntityNotFound(_0x4d68d7){return function(_0x14f366){if(!_0x14f366){_0x4d68d7[_0x7f08('0x19')](0x194);}return _0x14f366;};}function handleError(_0x1bdc0f,_0xa3374b){_0xa3374b=_0xa3374b||0x1f4;return function(_0x37404e){logger[_0x7f08('0x1a')](_0x37404e[_0x7f08('0x1b')]);if(_0x37404e[_0x7f08('0x1c')]){delete _0x37404e[_0x7f08('0x1c')];}_0x1bdc0f[_0x7f08('0xe')](_0xa3374b)[_0x7f08('0x1d')](_0x37404e);};}exports[_0x7f08('0x1e')]=function(_0x1da335,_0x39f23a){var _0x482d07={};var _0x31230d=_['map'](db[_0x7f08('0x1f')][_0x7f08('0x20')],function(_0x2c5d78){return{'name':_0x2c5d78[_0x7f08('0x21')],'type':_0x2c5d78[_0x7f08('0x22')]['key']};});_0x482d07=qs['getOptions'](_0x31230d,_0x1da335);return interaction[_0x7f08('0x23')](_0x7f08('0x24'),_0x1da335[_0x7f08('0x25')],_0x1da335[_0x7f08('0x26')],_0x482d07,_0x31230d)[_0x7f08('0x18')](respondWithFilteredResult(_0x39f23a,_0x482d07))[_0x7f08('0x27')](handleError(_0x39f23a,null));};exports['show']=function(_0x4a6a5c,_0x7d6ecb){var _0x1a1810={};if(_0x4a6a5c[_0x7f08('0x25')][_0x7f08('0x22')]&&_0x4a6a5c[_0x7f08('0x25')][_0x7f08('0x22')]===_0x7f08('0x28')){_0x1a1810[_0x7f08('0x28')]=_0x4a6a5c[_0x7f08('0x29')]['id'];}else{_0x1a1810['id']=_0x4a6a5c[_0x7f08('0x29')]['id'];}var _0x222bd2={'raw':![],'where':_0x1a1810},_0xf1bcee={};_0xf1bcee[_0x7f08('0x2a')]=_['keys'](db[_0x7f08('0x1f')][_0x7f08('0x20')]);_0xf1bcee['query']=_[_0x7f08('0x2b')](_0x4a6a5c[_0x7f08('0x25')]);_0xf1bcee['filters']=_[_0x7f08('0x2c')](_0xf1bcee[_0x7f08('0x2a')],_0xf1bcee[_0x7f08('0x25')]);_0x222bd2[_0x7f08('0x2d')]=_[_0x7f08('0x2c')](_0xf1bcee['model'],qs[_0x7f08('0x2e')](_0x4a6a5c['query'][_0x7f08('0x2e')]));_0x222bd2[_0x7f08('0x2d')]=_0x222bd2[_0x7f08('0x2d')][_0x7f08('0x2f')]?_0x222bd2[_0x7f08('0x2d')]:_0xf1bcee[_0x7f08('0x2a')];if(_0x4a6a5c[_0x7f08('0x25')][_0x7f08('0x30')]){_0x222bd2[_0x7f08('0x31')]=[{'all':!![]}];}_0x222bd2=_[_0x7f08('0x32')]({},_0x222bd2,_0x4a6a5c[_0x7f08('0x33')]);return db['OpenchannelInteraction']['find'](_0x222bd2)[_0x7f08('0x18')](handleEntityNotFound(_0x7d6ecb,null))[_0x7f08('0x18')](respondWithResult(_0x7d6ecb,null))['catch'](handleError(_0x7d6ecb,null));};exports[_0x7f08('0x34')]=function(_0x27e06f,_0x5b2a9b){return db['OpenchannelInteraction'][_0x7f08('0x34')](_0x27e06f[_0x7f08('0x35')],{})[_0x7f08('0x18')](respondWithResult(_0x5b2a9b,0xc9))[_0x7f08('0x27')](handleError(_0x5b2a9b,null));};exports[_0x7f08('0x16')]=function(_0x3e2a5b,_0x5c5ca4){if(_0x3e2a5b[_0x7f08('0x35')]['id']){delete _0x3e2a5b[_0x7f08('0x35')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x3e2a5b[_0x7f08('0x29')]['id']}})['then'](handleEntityNotFound(_0x5c5ca4,null))['then'](saveUpdates(_0x3e2a5b['body'],null))['then'](respondWithResult(_0x5c5ca4,null))[_0x7f08('0x27')](handleError(_0x5c5ca4,null));};exports[_0x7f08('0x17')]=function(_0x21bfcb,_0x5e13bf){return db[_0x7f08('0x1f')]['find']({'where':{'id':_0x21bfcb[_0x7f08('0x29')]['id']}})[_0x7f08('0x18')](handleEntityNotFound(_0x5e13bf,null))[_0x7f08('0x18')](removeEntity(_0x5e13bf,null))[_0x7f08('0x27')](handleError(_0x5e13bf,null));};exports[_0x7f08('0x36')]=function(_0x395766,_0x20dfaf){return db[_0x7f08('0x1f')][_0x7f08('0x36')]()[_0x7f08('0x18')](respondWithResult(_0x20dfaf,null))[_0x7f08('0x27')](handleError(_0x20dfaf,null));};exports[_0x7f08('0x37')]=function(_0xa647df,_0xe0a1ee){return db[_0x7f08('0x38')][_0x7f08('0x39')]({'where':{'id':_0xa647df[_0x7f08('0x29')]['id']}})[_0x7f08('0x18')](handleEntityNotFound(_0xe0a1ee,null))[_0x7f08('0x18')](function(_0x1e96ed){if(_0x1e96ed){return _0x1e96ed[_0x7f08('0x37')](_0xa647df[_0x7f08('0x35')]['ids'],_[_0x7f08('0x3a')](_0xa647df[_0x7f08('0x35')],[_0x7f08('0x3b'),'id'])||{});}})[_0x7f08('0x18')](respondWithResult(_0xe0a1ee,null))[_0x7f08('0x27')](handleError(_0xe0a1ee,null));};exports[_0x7f08('0x3c')]=function(_0x2ea7ad,_0x7abba0){var _0x425242={'raw':![],'where':{}};var _0x42e130={};var _0xc71d87={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x7f08('0x3d')]({'where':{'id':_0x2ea7ad[_0x7f08('0x29')]['id']}})['then'](handleEntityNotFound(_0x7abba0,null))[_0x7f08('0x18')](function(_0x8de4f6){if(_0x8de4f6){_0x42e130[_0x7f08('0x2a')]=_[_0x7f08('0x2b')](db[_0x7f08('0x38')][_0x7f08('0x20')]);_0x42e130[_0x7f08('0x25')]=_[_0x7f08('0x2b')](_0x2ea7ad[_0x7f08('0x25')]);_0x42e130[_0x7f08('0x3e')]=_['intersection'](_0x42e130[_0x7f08('0x2a')],_0x42e130[_0x7f08('0x25')]);_0x425242['attributes']=_[_0x7f08('0x2c')](_0x42e130[_0x7f08('0x2a')],qs[_0x7f08('0x2e')](_0x2ea7ad[_0x7f08('0x25')]['fields']));_0x425242['attributes']=_0x425242[_0x7f08('0x2d')][_0x7f08('0x2f')]?_0x425242[_0x7f08('0x2d')]:_0x42e130[_0x7f08('0x2a')];if(!_0x2ea7ad[_0x7f08('0x25')][_0x7f08('0x3f')](_0x7f08('0x40'))){_0x425242[_0x7f08('0x12')]=qs[_0x7f08('0x12')](_0x2ea7ad['query'][_0x7f08('0x12')]);_0x425242[_0x7f08('0x13')]=qs[_0x7f08('0x13')](_0x2ea7ad[_0x7f08('0x25')][_0x7f08('0x13')]);}_0x425242[_0x7f08('0x41')]=qs['sort'](_0x2ea7ad[_0x7f08('0x25')][_0x7f08('0x42')]);_0x425242['where']=qs[_0x7f08('0x3e')](_['pick'](_0x2ea7ad[_0x7f08('0x25')],_0x42e130[_0x7f08('0x3e')]));_0x425242[_0x7f08('0x43')][_0x7f08('0x44')]=_0x8de4f6['id'];if(_0x2ea7ad[_0x7f08('0x25')][_0x7f08('0x45')]){_0x425242[_0x7f08('0x43')]=_[_0x7f08('0x32')](_0x425242[_0x7f08('0x43')],{'$or':_[_0x7f08('0x46')](_0x425242[_0x7f08('0x2d')],function(_0x18d1d6){var _0x3eda15={};_0x3eda15[_0x18d1d6]={'$like':'%'+_0x2ea7ad[_0x7f08('0x25')][_0x7f08('0x45')]+'%'};return _0x3eda15;})});}if(_0x2ea7ad[_0x7f08('0x25')][_0x7f08('0x47')]){var _0x23ae78=_0x2ea7ad[_0x7f08('0x25')][_0x7f08('0x47')][_0x7f08('0x48')](',');var _0x3900f5={};_0x3900f5[_0x23ae78[0x0]]={'$gte':moment(_0x23ae78[0x1])[_0x7f08('0x49')](_0x7f08('0x4a'))};_0x425242[_0x7f08('0x43')]=_[_0x7f08('0x32')](_0x425242['where'],_0x3900f5);}_0x425242=_[_0x7f08('0x32')]({},_0x425242,_0x2ea7ad[_0x7f08('0x33')]);return db[_0x7f08('0x38')]['count']({'where':_0x425242['where']})[_0x7f08('0x18')](function(_0x57db53){_0xc71d87[_0x7f08('0x14')]=_0x57db53;if(_0x2ea7ad[_0x7f08('0x25')][_0x7f08('0x30')]){_0x425242[_0x7f08('0x31')]=[{'all':!![]}];}return db[_0x7f08('0x38')][_0x7f08('0x23')](_0x425242);})['then'](function(_0x17e8f8){_0xc71d87[_0x7f08('0x4b')]=_0x17e8f8;return _0xc71d87;});}})[_0x7f08('0x18')](respondWithFilteredResult(_0x7abba0,_0x425242))[_0x7f08('0x27')](handleError(_0x7abba0,null));};exports[_0x7f08('0x4c')]=function(_0x293b9e,_0x1542fc){return db['OpenchannelInteraction'][_0x7f08('0x39')]({'where':{'id':_0x293b9e[_0x7f08('0x29')]['id']}})[_0x7f08('0x18')](handleEntityNotFound(_0x1542fc,null))['then'](function(_0x4e385a){if(_0x4e385a){return _0x4e385a[_0x7f08('0x4d')](_0x293b9e['body'][_0x7f08('0x3b')],_[_0x7f08('0x3a')](_0x293b9e['body'],[_0x7f08('0x3b'),'id'])||{})[_0x7f08('0x4e')](function(){return db[_0x7f08('0x4f')]['findAll']({'attributes':['id',_0x7f08('0x1c'),'color'],'where':{'id':_0x293b9e[_0x7f08('0x35')][_0x7f08('0x3b')]}});})['then'](function(_0x2a014c){socket[_0x7f08('0x50')](_0x7f08('0x51'),{'id':Number(_0x293b9e[_0x7f08('0x29')]['id']),'tags':_0x2a014c||[]});return{'id':Number(_0x293b9e[_0x7f08('0x29')]['id']),'tags':_0x2a014c||[]};});}})[_0x7f08('0x18')](respondWithResult(_0x1542fc,null))['catch'](handleError(_0x1542fc,null));};exports[_0x7f08('0x52')]=function(_0x7d4007,_0x1ba856){return db[_0x7f08('0x1f')][_0x7f08('0x39')]({'where':{'id':_0x7d4007[_0x7f08('0x29')]['id']}})[_0x7f08('0x18')](handleEntityNotFound(_0x1ba856,null))[_0x7f08('0x18')](function(_0x3e2a51){if(_0x3e2a51){return _0x3e2a51[_0x7f08('0x52')](_0x7d4007[_0x7f08('0x25')][_0x7f08('0x3b')]);}})[_0x7f08('0x18')](respondWithStatusCode(_0x1ba856,null))['catch'](handleError(_0x1ba856,null));};exports[_0x7f08('0x53')]=function(_0x5653e3,_0x1a1ee1){var _0x110a3c=moment()[_0x7f08('0x54')]()[_0x7f08('0x55')]();var _0x24d41e=path[_0x7f08('0x56')](config[_0x7f08('0x57')],_0x7f08('0x58'),_0x7f08('0x59'),_0x7f08('0x5a'));var _0x2a7d6b=path[_0x7f08('0x56')](config['root'],_0x7f08('0x58'),'files',_0x7f08('0x5b'));var _0x3db638=path['join'](_0x24d41e,_0x110a3c);var _0x5cd045=util['format'](_0x7f08('0x5c'),_0x5653e3[_0x7f08('0x29')]['id'],_0x110a3c);var _0x26dec3=path[_0x7f08('0x56')](_0x24d41e,_0x5cd045);var _0x579321=[];_0x579321['push']({'model':db[_0x7f08('0x5d')],'as':_0x7f08('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0x579321[_0x7f08('0x5e')]({'model':db[_0x7f08('0x5f')],'as':'Contact','attributes':['id',_0x7f08('0x60'),'lastName'],'raw':!![]});if(_0x5653e3['query'][_0x7f08('0x5b')]){_0x579321['push']({'model':db[_0x7f08('0x61')],'as':_0x7f08('0x61'),'raw':!![]});}var _0x34dae9=[{'model':db['OpenchannelMessage'],'as':_0x7f08('0x62'),'attributes':['id','body','createdAt',_0x7f08('0x63'),'secret',_0x7f08('0x64')],'include':_0x579321}];_0x34dae9['push']({'model':db[_0x7f08('0x65')],'as':'Account','attributes':['id',_0x7f08('0x1c')]});_0x34dae9[_0x7f08('0x5e')]({'model':db[_0x7f08('0x5d')],'as':_0x7f08('0x66'),'attributes':['id',_0x7f08('0x67')]});return db[_0x7f08('0x1f')][_0x7f08('0x39')]({'where':{'id':_0x5653e3[_0x7f08('0x29')]['id']},'include':_0x34dae9})[_0x7f08('0x18')](handleEntityNotFound(_0x1a1ee1,null))[_0x7f08('0x18')](function(_0x29da87){if(_0x29da87){var _0x51212c=_0x29da87[_0x7f08('0x68')]({'plain':!![]});fs['mkdirSync'](_0x3db638);var _0x339668={'channel':_0x7f08('0x69'),'account':_0x51212c['Account'][_0x7f08('0x1c')],'agent':_0x51212c[_0x7f08('0x66')]?_0x51212c[_0x7f08('0x66')][_0x7f08('0x67')]:'N.A.','createdAt':moment(_0x51212c['createdAt'])[_0x7f08('0x49')](_0x7f08('0x4a'))[_0x7f08('0x55')](),'closedAt':_0x51212c[_0x7f08('0x6a')]?moment(_0x51212c['closedAt'])['format'](_0x7f08('0x4a'))[_0x7f08('0x55')]():'','disposition':_0x51212c[_0x7f08('0x6b')],'visibility':_0x51212c[_0x7f08('0x6c')]?_0x7f08('0x6d'):'Private','messages':_(_0x51212c[_0x7f08('0x62')])[_0x7f08('0x45')]({'secret':![]})['map'](function(_0x562e6b){if(_0x562e6b[_0x7f08('0x61')]){var _0x16c7a2=path[_0x7f08('0x56')](_0x2a7d6b,_0x562e6b[_0x7f08('0x61')][_0x7f08('0x6e')]);if(fs[_0x7f08('0x6f')](_0x16c7a2)){fs[_0x7f08('0x70')](_0x16c7a2)[_0x7f08('0x71')](fs[_0x7f08('0x72')](path[_0x7f08('0x56')](_0x3db638,_0x562e6b[_0x7f08('0x61')][_0x7f08('0x6e')])));}}return{'date':moment(_0x562e6b[_0x7f08('0x73')])[_0x7f08('0x49')](_0x7f08('0x4a'))[_0x7f08('0x55')](),'sender':_0x562e6b[_0x7f08('0x63')]===_0x7f08('0x74')?_0x562e6b[_0x7f08('0x5d')]?_0x562e6b['User']['fullname']:_0x7f08('0x75'):_0x562e6b[_0x7f08('0x76')][_0x7f08('0x60')]+(_0x562e6b[_0x7f08('0x76')][_0x7f08('0x77')]?'\x20'+_0x562e6b[_0x7f08('0x76')][_0x7f08('0x77')]:''),'body':_0x562e6b[_0x7f08('0x61')]?_0x562e6b['Attachment']['basename']:_0x562e6b[_0x7f08('0x35')],'direction':_0x562e6b[_0x7f08('0x63')]==='out'?'A':'C','secret':_0x562e6b[_0x7f08('0x78')],'read':_0x562e6b[_0x7f08('0x64')],'attachment':_0x562e6b['Attachment']};})[_0x7f08('0x79')]()};return ejs[_0x7f08('0x7a')](path[_0x7f08('0x56')](config[_0x7f08('0x57')],_0x7f08('0x58'),_0x7f08('0x7b'),_0x7f08('0x7c')),{'interaction':_0x339668})[_0x7f08('0x18')](function(_0x463f8c){var _0x32c7f6=path['join'](_0x3db638,_0x7f08('0x7d')+_0x51212c['id']+'-'+_0x110a3c+'.pdf');var _0x93e59f={'path':_0x32c7f6,'channel':'Openchannel','interactionId':_0x51212c['id']};return pdf['createPdfFromHTML'](_0x463f8c,_0x93e59f);})[_0x7f08('0x18')](function(){return new Promise(function(_0x532547,_0x5d21d4){zipdir(_0x3db638,{'saveTo':_0x26dec3},function(_0x5a02c4,_0x1804c2){if(_0x5a02c4)return _0x5d21d4(_0x5a02c4);return _0x532547(_0x1804c2);});})[_0x7f08('0x18')](function(){return new Promise(function(_0x4ca85b,_0x462b5f){rimraf(_0x3db638,function(_0x3aa51c){if(_0x3aa51c)_0x462b5f(_0x3aa51c);return _0x4ca85b();});});})[_0x7f08('0x18')](function(){return _0x1a1ee1[_0x7f08('0x53')](_0x26dec3,_0x5cd045,function(_0x5218b0){if(_0x5218b0){logger[_0x7f08('0x1a')]('Unable\x20to\x20delete\x20zip\x20file',_0x5218b0);}else{fs['unlinkSync'](_0x26dec3);}});});});}else{return _0x1a1ee1[_0x7f08('0x19')](0xc8);}})[_0x7f08('0x27')](handleError(_0x1a1ee1,null));}; \ No newline at end of file +var _0x0034=['params','OpenchannelInteraction','filters','intersection','model','fields','attributes','length','includeAll','include','options','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','hasOwnProperty','sort','where','OpenchannelInteractionId','filter','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','find','omit','color','openchannelInteractionTags:save','removeTags','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','User','push','CmContact','lastName','Attachment','Messages','createdAt','secret','read','OpenchannelAccount','Owner','fullname','Account','closed','closedAt','threadId','Public','Private','existsSync','createReadStream','pipe','createWriteStream','basename','direction','out','System','Contact','firstName','value','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','ejs','lodash','../../components/export/pdf','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','getOptions','findAll','openchannel','query','catch','type','from'];(function(_0x4ae912,_0xbaf67d){var _0x54b3bb=function(_0x26d77a){while(--_0x26d77a){_0x4ae912['push'](_0x4ae912['shift']());}};_0x54b3bb(++_0xbaf67d);}(_0x0034,0x1b7));var _0x4003=function(_0x378a48,_0x5b012f){_0x378a48=_0x378a48-0x0;var _0x1538c5=_0x0034[_0x378a48];return _0x1538c5;};'use strict';var rimraf=require(_0x4003('0x0'));var zipdir=require(_0x4003('0x1'));var moment=require(_0x4003('0x2'));var util=require('util');var path=require('path');var ejs=require(_0x4003('0x3'));var fs=require('fs');var _=require(_0x4003('0x4'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x4003('0x5'));var logger=require(_0x4003('0x6'))('api');var config=require(_0x4003('0x7'));var db=require('../../mysqldb')['db'];config[_0x4003('0x8')]=_['defaults'](config[_0x4003('0x8')],{'host':_0x4003('0x9'),'port':0x18eb});var socket=require(_0x4003('0xa'))(new Redis(config[_0x4003('0x8')]));require(_0x4003('0xb'))['register'](socket);function respondWithStatusCode(_0x497911,_0x38591){_0x38591=_0x38591||0xcc;return function(_0x2c66d7){if(_0x2c66d7){return _0x497911[_0x4003('0xc')](_0x38591);}return _0x497911[_0x4003('0xd')](_0x38591)[_0x4003('0xe')]();};}function respondWithResult(_0x304e05,_0x41452c){_0x41452c=_0x41452c||0xc8;return function(_0x145a41){if(_0x145a41){return _0x304e05[_0x4003('0xd')](_0x41452c)[_0x4003('0xf')](_0x145a41);}};}function respondWithFilteredResult(_0xf1bcca,_0xdbac2e){return function(_0x2e25c6){if(_0x2e25c6){var _0x14eb34=typeof _0xdbac2e[_0x4003('0x10')]===_0x4003('0x11')&&typeof _0xdbac2e['limit']===_0x4003('0x11');var _0x1473a4=_0x2e25c6['count'];var _0x2a2a04=_0x14eb34?0x0:_0xdbac2e[_0x4003('0x10')];var _0x54c9c0=_0x14eb34?_0x2e25c6[_0x4003('0x12')]:_0xdbac2e[_0x4003('0x10')]+_0xdbac2e[_0x4003('0x13')];var _0x3a8e8a;if(_0x54c9c0>=_0x1473a4){_0x54c9c0=_0x1473a4;_0x3a8e8a=0xc8;}else{_0x3a8e8a=0xce;}_0xf1bcca[_0x4003('0xd')](_0x3a8e8a);return _0xf1bcca[_0x4003('0x14')](_0x4003('0x15'),_0x2a2a04+'-'+_0x54c9c0+'/'+_0x1473a4)[_0x4003('0xf')](_0x2e25c6);}return null;};}function saveUpdates(_0x56638f){return function(_0x4e9c5f){if(_0x4e9c5f){return _0x4e9c5f[_0x4003('0x16')](_0x56638f)[_0x4003('0x17')](function(_0x477ae){return _0x477ae;});}return null;};}function removeEntity(_0x105beb){return function(_0x4e642f){if(_0x4e642f){return _0x4e642f[_0x4003('0x18')]()[_0x4003('0x17')](function(){_0x105beb[_0x4003('0xd')](0xcc)[_0x4003('0xe')]();});}};}function handleEntityNotFound(_0x5a5056){return function(_0x264c68){if(!_0x264c68){_0x5a5056[_0x4003('0xc')](0x194);}return _0x264c68;};}function handleError(_0x3751b3,_0x94d2af){_0x94d2af=_0x94d2af||0x1f4;return function(_0x280963){logger[_0x4003('0x19')](_0x280963[_0x4003('0x1a')]);if(_0x280963['name']){delete _0x280963[_0x4003('0x1b')];}_0x3751b3[_0x4003('0xd')](_0x94d2af)[_0x4003('0x1c')](_0x280963);};}exports[_0x4003('0x1d')]=function(_0x526517,_0x59ed16){var _0x55836c={};var _0x289555=_[_0x4003('0x1e')](db['OpenchannelInteraction'][_0x4003('0x1f')],function(_0x7a17df){return{'name':_0x7a17df[_0x4003('0x20')],'type':_0x7a17df['type'][_0x4003('0x21')]};});_0x55836c=qs[_0x4003('0x22')](_0x289555,_0x526517);return interaction[_0x4003('0x23')](_0x4003('0x24'),_0x526517[_0x4003('0x25')],_0x526517['user'],_0x55836c,_0x289555)['then'](respondWithFilteredResult(_0x59ed16,_0x55836c))[_0x4003('0x26')](handleError(_0x59ed16,null));};exports['show']=function(_0x5006d1,_0x13aa26){var _0x29c527={};if(_0x5006d1[_0x4003('0x25')][_0x4003('0x27')]&&_0x5006d1[_0x4003('0x25')]['type']===_0x4003('0x28')){_0x29c527['from']=_0x5006d1[_0x4003('0x29')]['id'];}else{_0x29c527['id']=_0x5006d1[_0x4003('0x29')]['id'];}var _0x1b28eb={'raw':![],'where':_0x29c527},_0x445468={};_0x445468['model']=_['keys'](db[_0x4003('0x2a')]['rawAttributes']);_0x445468[_0x4003('0x25')]=_['keys'](_0x5006d1[_0x4003('0x25')]);_0x445468[_0x4003('0x2b')]=_['intersection'](_0x445468['model'],_0x445468[_0x4003('0x25')]);_0x1b28eb['attributes']=_[_0x4003('0x2c')](_0x445468[_0x4003('0x2d')],qs[_0x4003('0x2e')](_0x5006d1[_0x4003('0x25')][_0x4003('0x2e')]));_0x1b28eb[_0x4003('0x2f')]=_0x1b28eb['attributes'][_0x4003('0x30')]?_0x1b28eb[_0x4003('0x2f')]:_0x445468[_0x4003('0x2d')];if(_0x5006d1[_0x4003('0x25')][_0x4003('0x31')]){_0x1b28eb[_0x4003('0x32')]=[{'all':!![]}];}_0x1b28eb=_['merge']({},_0x1b28eb,_0x5006d1[_0x4003('0x33')]);return db[_0x4003('0x2a')]['find'](_0x1b28eb)[_0x4003('0x17')](handleEntityNotFound(_0x13aa26,null))['then'](respondWithResult(_0x13aa26,null))[_0x4003('0x26')](handleError(_0x13aa26,null));};exports[_0x4003('0x34')]=function(_0x1d8db8,_0x39883d){return db[_0x4003('0x2a')][_0x4003('0x34')](_0x1d8db8['body'],{})['then'](respondWithResult(_0x39883d,0xc9))[_0x4003('0x26')](handleError(_0x39883d,null));};exports[_0x4003('0x16')]=function(_0x190871,_0xebc5c2){if(_0x190871[_0x4003('0x35')]['id']){delete _0x190871[_0x4003('0x35')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x190871[_0x4003('0x29')]['id']}})[_0x4003('0x17')](handleEntityNotFound(_0xebc5c2,null))['then'](saveUpdates(_0x190871[_0x4003('0x35')],null))[_0x4003('0x17')](respondWithResult(_0xebc5c2,null))[_0x4003('0x26')](handleError(_0xebc5c2,null));};exports[_0x4003('0x18')]=function(_0x379f2a,_0x35cfd9){return db[_0x4003('0x2a')]['find']({'where':{'id':_0x379f2a[_0x4003('0x29')]['id']}})[_0x4003('0x17')](handleEntityNotFound(_0x35cfd9,null))[_0x4003('0x17')](removeEntity(_0x35cfd9,null))['catch'](handleError(_0x35cfd9,null));};exports['describe']=function(_0x568c35,_0x4e99f5){return db['OpenchannelInteraction'][_0x4003('0x36')]()[_0x4003('0x17')](respondWithResult(_0x4e99f5,null))[_0x4003('0x26')](handleError(_0x4e99f5,null));};exports[_0x4003('0x37')]=function(_0x272919,_0x11b5ef){return db[_0x4003('0x38')]['find']({'where':{'id':_0x272919[_0x4003('0x29')]['id']}})[_0x4003('0x17')](handleEntityNotFound(_0x11b5ef,null))[_0x4003('0x17')](function(_0x37cd28){if(_0x37cd28){return _0x37cd28[_0x4003('0x37')](_0x272919[_0x4003('0x35')][_0x4003('0x39')],_['omit'](_0x272919[_0x4003('0x35')],[_0x4003('0x39'),'id'])||{});}})[_0x4003('0x17')](respondWithResult(_0x11b5ef,null))[_0x4003('0x26')](handleError(_0x11b5ef,null));};exports[_0x4003('0x3a')]=function(_0x254ede,_0x661948){var _0xeab1f1={'raw':![],'where':{}};var _0xcd7986={};var _0xa573a9={'count':0x0,'rows':[]};return db[_0x4003('0x2a')]['findOne']({'where':{'id':_0x254ede[_0x4003('0x29')]['id']}})['then'](handleEntityNotFound(_0x661948,null))[_0x4003('0x17')](function(_0x44e973){if(_0x44e973){_0xcd7986['model']=_['keys'](db[_0x4003('0x38')][_0x4003('0x1f')]);_0xcd7986[_0x4003('0x25')]=_['keys'](_0x254ede[_0x4003('0x25')]);_0xcd7986['filters']=_[_0x4003('0x2c')](_0xcd7986['model'],_0xcd7986['query']);_0xeab1f1[_0x4003('0x2f')]=_[_0x4003('0x2c')](_0xcd7986[_0x4003('0x2d')],qs[_0x4003('0x2e')](_0x254ede['query'][_0x4003('0x2e')]));_0xeab1f1[_0x4003('0x2f')]=_0xeab1f1['attributes'][_0x4003('0x30')]?_0xeab1f1[_0x4003('0x2f')]:_0xcd7986[_0x4003('0x2d')];if(!_0x254ede[_0x4003('0x25')][_0x4003('0x3b')]('nolimit')){_0xeab1f1[_0x4003('0x13')]=qs[_0x4003('0x13')](_0x254ede[_0x4003('0x25')][_0x4003('0x13')]);_0xeab1f1[_0x4003('0x10')]=qs[_0x4003('0x10')](_0x254ede[_0x4003('0x25')][_0x4003('0x10')]);}_0xeab1f1['order']=qs[_0x4003('0x3c')](_0x254ede[_0x4003('0x25')][_0x4003('0x3c')]);_0xeab1f1[_0x4003('0x3d')]=qs['filters'](_['pick'](_0x254ede['query'],_0xcd7986[_0x4003('0x2b')]));_0xeab1f1[_0x4003('0x3d')][_0x4003('0x3e')]=_0x44e973['id'];if(_0x254ede['query'][_0x4003('0x3f')]){_0xeab1f1[_0x4003('0x3d')]=_[_0x4003('0x40')](_0xeab1f1['where'],{'$or':_[_0x4003('0x1e')](_0xeab1f1[_0x4003('0x2f')],function(_0x13a755){var _0x22fef4={};_0x22fef4[_0x13a755]={'$like':'%'+_0x254ede['query'][_0x4003('0x3f')]+'%'};return _0x22fef4;})});}if(_0x254ede[_0x4003('0x25')][_0x4003('0x41')]){var _0x47a583=_0x254ede[_0x4003('0x25')][_0x4003('0x41')]['split'](',');var _0x4c81db={};_0x4c81db[_0x47a583[0x0]]={'$gte':moment(_0x47a583[0x1])[_0x4003('0x42')](_0x4003('0x43'))};_0xeab1f1[_0x4003('0x3d')]=_[_0x4003('0x40')](_0xeab1f1[_0x4003('0x3d')],_0x4c81db);}_0xeab1f1=_[_0x4003('0x40')]({},_0xeab1f1,_0x254ede[_0x4003('0x33')]);return db['OpenchannelMessage'][_0x4003('0x12')]({'where':_0xeab1f1['where']})[_0x4003('0x17')](function(_0x4b688a){_0xa573a9['count']=_0x4b688a;if(_0x254ede[_0x4003('0x25')]['includeAll']){_0xeab1f1[_0x4003('0x32')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x4003('0x23')](_0xeab1f1);})['then'](function(_0x3db72e){_0xa573a9[_0x4003('0x44')]=_0x3db72e;return _0xa573a9;});}})[_0x4003('0x17')](respondWithFilteredResult(_0x661948,_0xeab1f1))['catch'](handleError(_0x661948,null));};exports[_0x4003('0x45')]=function(_0x488df3,_0x3d73d8){return db[_0x4003('0x2a')][_0x4003('0x46')]({'where':{'id':_0x488df3[_0x4003('0x29')]['id']}})[_0x4003('0x17')](handleEntityNotFound(_0x3d73d8,null))[_0x4003('0x17')](function(_0x4f20a1){if(_0x4f20a1){return _0x4f20a1['setTags'](_0x488df3['body'][_0x4003('0x39')],_[_0x4003('0x47')](_0x488df3['body'],[_0x4003('0x39'),'id'])||{})['spread'](function(){return db['Tag'][_0x4003('0x23')]({'attributes':['id',_0x4003('0x1b'),_0x4003('0x48')],'where':{'id':_0x488df3[_0x4003('0x35')][_0x4003('0x39')]}});})[_0x4003('0x17')](function(_0xbc12ce){socket['emit'](_0x4003('0x49'),{'id':Number(_0x488df3[_0x4003('0x29')]['id']),'tags':_0xbc12ce||[]});return{'id':Number(_0x488df3[_0x4003('0x29')]['id']),'tags':_0xbc12ce||[]};});}})['then'](respondWithResult(_0x3d73d8,null))[_0x4003('0x26')](handleError(_0x3d73d8,null));};exports[_0x4003('0x4a')]=function(_0x29f015,_0x560f54){return db[_0x4003('0x2a')][_0x4003('0x46')]({'where':{'id':_0x29f015[_0x4003('0x29')]['id']}})[_0x4003('0x17')](handleEntityNotFound(_0x560f54,null))['then'](function(_0x292b4a){if(_0x292b4a){return _0x292b4a[_0x4003('0x4a')](_0x29f015[_0x4003('0x25')][_0x4003('0x39')]);}})['then'](respondWithStatusCode(_0x560f54,null))[_0x4003('0x26')](handleError(_0x560f54,null));};exports['download']=function(_0x2c7d6b,_0x2d1a20){var _0x204411=moment()['unix']()[_0x4003('0x4b')]();var _0x291095=path[_0x4003('0x4c')](config[_0x4003('0x4d')],'server',_0x4003('0x4e'),_0x4003('0x4f'));var _0x3e922a=path['join'](config[_0x4003('0x4d')],_0x4003('0x50'),_0x4003('0x4e'),_0x4003('0x51'));var _0x51979f=path['join'](_0x291095,_0x204411);var _0xa33a46=util[_0x4003('0x42')](_0x4003('0x52'),_0x2c7d6b[_0x4003('0x29')]['id'],_0x204411);var _0x553ba0=path['join'](_0x291095,_0xa33a46);var _0x563dd4=[];_0x563dd4['push']({'model':db[_0x4003('0x53')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x563dd4[_0x4003('0x54')]({'model':db[_0x4003('0x55')],'as':'Contact','attributes':['id','firstName',_0x4003('0x56')],'raw':!![]});if(_0x2c7d6b['query'][_0x4003('0x51')]){_0x563dd4[_0x4003('0x54')]({'model':db[_0x4003('0x57')],'as':'Attachment','raw':!![]});}var _0x3d1d0c=[{'model':db[_0x4003('0x38')],'as':_0x4003('0x58'),'attributes':['id',_0x4003('0x35'),_0x4003('0x59'),'direction',_0x4003('0x5a'),_0x4003('0x5b')],'include':_0x563dd4}];_0x3d1d0c[_0x4003('0x54')]({'model':db[_0x4003('0x5c')],'as':'Account','attributes':['id',_0x4003('0x1b')]});_0x3d1d0c['push']({'model':db['User'],'as':_0x4003('0x5d'),'attributes':['id',_0x4003('0x5e')]});return db[_0x4003('0x2a')]['find']({'where':{'id':_0x2c7d6b[_0x4003('0x29')]['id']},'include':_0x3d1d0c})['then'](handleEntityNotFound(_0x2d1a20,null))[_0x4003('0x17')](function(_0x251297){if(_0x251297){var _0x4795cd=_0x251297['get']({'plain':!![]});fs['mkdirSync'](_0x51979f);var _0x4286d3={'channel':'Openchannel','account':_0x4795cd[_0x4003('0x5f')]['name'],'agent':_0x4795cd[_0x4003('0x5d')]?_0x4795cd[_0x4003('0x5d')]['fullname']:'N.A.','createdAt':moment(_0x4795cd[_0x4003('0x59')])[_0x4003('0x42')](_0x4003('0x43'))[_0x4003('0x4b')](),'closedAt':_0x4795cd[_0x4003('0x60')]?moment(_0x4795cd[_0x4003('0x61')])[_0x4003('0x42')](_0x4003('0x43'))[_0x4003('0x4b')]():'','disposition':_0x4795cd['disposition'],'visibility':_0x4795cd[_0x4003('0x62')]?_0x4003('0x63'):_0x4003('0x64'),'messages':_(_0x4795cd['Messages'])[_0x4003('0x3f')]({'secret':![]})['map'](function(_0x21df72){if(_0x21df72[_0x4003('0x57')]){var _0x449ffc=path[_0x4003('0x4c')](_0x3e922a,_0x21df72['Attachment']['basename']);if(fs[_0x4003('0x65')](_0x449ffc)){fs[_0x4003('0x66')](_0x449ffc)[_0x4003('0x67')](fs[_0x4003('0x68')](path[_0x4003('0x4c')](_0x51979f,_0x21df72['Attachment'][_0x4003('0x69')])));}}return{'date':moment(_0x21df72[_0x4003('0x59')])[_0x4003('0x42')](_0x4003('0x43'))[_0x4003('0x4b')](),'sender':_0x21df72[_0x4003('0x6a')]===_0x4003('0x6b')?_0x21df72['User']?_0x21df72[_0x4003('0x53')][_0x4003('0x5e')]:_0x4003('0x6c'):_0x21df72[_0x4003('0x6d')][_0x4003('0x6e')]+(_0x21df72[_0x4003('0x6d')][_0x4003('0x56')]?'\x20'+_0x21df72[_0x4003('0x6d')][_0x4003('0x56')]:''),'body':_0x21df72[_0x4003('0x57')]?_0x21df72[_0x4003('0x57')][_0x4003('0x69')]:_0x21df72['body'],'direction':_0x21df72[_0x4003('0x6a')]===_0x4003('0x6b')?'A':'C','secret':_0x21df72[_0x4003('0x5a')],'read':_0x21df72[_0x4003('0x5b')],'attachment':_0x21df72['Attachment']};})[_0x4003('0x6f')]()};return ejs['renderFile'](path[_0x4003('0x4c')](config['root'],_0x4003('0x50'),'views',_0x4003('0x70')),{'interaction':_0x4286d3})[_0x4003('0x17')](function(_0x35da2e){var _0x49ddf1=path[_0x4003('0x4c')](_0x51979f,_0x4003('0x71')+_0x4795cd['id']+'-'+_0x204411+_0x4003('0x72'));var _0x11092e={'path':_0x49ddf1,'channel':_0x4003('0x73'),'interactionId':_0x4795cd['id']};return pdf[_0x4003('0x74')](_0x35da2e,_0x11092e);})[_0x4003('0x17')](function(){return new Promise(function(_0xbdd4b6,_0x18cbeb){zipdir(_0x51979f,{'saveTo':_0x553ba0},function(_0x4bb9b7,_0xc7fc79){if(_0x4bb9b7)return _0x18cbeb(_0x4bb9b7);return _0xbdd4b6(_0xc7fc79);});})[_0x4003('0x17')](function(){return new Promise(function(_0x6ba47a,_0x2f65ab){rimraf(_0x51979f,function(_0x43c78c){if(_0x43c78c)_0x2f65ab(_0x43c78c);return _0x6ba47a();});});})[_0x4003('0x17')](function(){return _0x2d1a20[_0x4003('0x75')](_0x553ba0,_0xa33a46,function(_0x4306b7){if(_0x4306b7){logger[_0x4003('0x19')](_0x4003('0x76'),_0x4306b7);}else{fs[_0x4003('0x77')](_0x553ba0);}});});});}else{return _0x2d1a20['sendStatus'](0xc8);}})[_0x4003('0x26')](handleError(_0x2d1a20,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index bf9c123..3e6eb7c 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 _0xb998=['update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xb998,0x1b5));var _0x8b99=function(_0x21fc68,_0x459828){_0x21fc68=_0x21fc68-0x0;var _0x3561e1=_0xb998[_0x21fc68];return _0x3561e1;};'use strict';var EventEmitter=require(_0x8b99('0x0'));var OpenchannelInteraction=require(_0x8b99('0x1'))['db'][_0x8b99('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8b99('0x3')](0x0);var events={'afterCreate':_0x8b99('0x4'),'afterUpdate':_0x8b99('0x5'),'afterDestroy':_0x8b99('0x6')};function emitEvent(_0xca779f){return function(_0x59c203,_0x5b76f1,_0x42521c){_0x59c203[_0x8b99('0x7')]({'attributes':['id'],'raw':!![]})[_0x8b99('0x8')](function(_0x373031){_0x59c203[_0x8b99('0x9')]('Users',_0x373031[_0x8b99('0xa')](function(_0x100c7e){return{'id':_0x100c7e['id']};}));return OpenchannelMessage[_0x8b99('0xb')]({'where':{'OpenchannelInteractionId':_0x59c203['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8b99('0x8')](function(_0x289c88){_0x59c203[_0x8b99('0x9')](_0x8b99('0xc'),_0x289c88[_0x8b99('0xd')]);OpenchannelInteractionEvents[_0x8b99('0xe')](_0xca779f+':'+_0x59c203['id'],_0x59c203);OpenchannelInteractionEvents['emit'](_0xca779f,_0x59c203);_0x42521c(null);})['catch'](_0x42521c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x8b99('0xf')](e,emitEvent(event));}}module[_0x8b99('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xd4b0=['hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','emit','catch'];(function(_0x14ae6d,_0x260006){var _0x73d8e9=function(_0x12428d){while(--_0x12428d){_0x14ae6d['push'](_0x14ae6d['shift']());}};_0x73d8e9(++_0x260006);}(_0xd4b0,0x159));var _0x0d4b=function(_0x4e7b9c,_0x5d7e56){_0x4e7b9c=_0x4e7b9c-0x0;var _0x102f51=_0xd4b0[_0x4e7b9c];return _0x102f51;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x0d4b('0x0'))['db'][_0x0d4b('0x1')];var OpenchannelMessage=require(_0x0d4b('0x0'))['db'][_0x0d4b('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0d4b('0x3')](0x0);var events={'afterCreate':_0x0d4b('0x4'),'afterUpdate':_0x0d4b('0x5'),'afterDestroy':_0x0d4b('0x6')};function emitEvent(_0x486f7a){return function(_0x5c2d71,_0xe71cd1,_0x5d3324){_0x5c2d71[_0x0d4b('0x7')]({'attributes':['id'],'raw':!![]})[_0x0d4b('0x8')](function(_0x28c6fc){_0x5c2d71['setDataValue'](_0x0d4b('0x9'),_0x28c6fc[_0x0d4b('0xa')](function(_0x503c46){return{'id':_0x503c46['id']};}));return OpenchannelMessage[_0x0d4b('0xb')]({'where':{'OpenchannelInteractionId':_0x5c2d71['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0d4b('0x8')](function(_0x41d119){_0x5c2d71[_0x0d4b('0xc')]('unreadMessages',_0x41d119['length']);OpenchannelInteractionEvents[_0x0d4b('0xd')](_0x486f7a+':'+_0x5c2d71['id'],_0x5c2d71);OpenchannelInteractionEvents[_0x0d4b('0xd')](_0x486f7a,_0x5c2d71);_0x5d3324(null);})[_0x0d4b('0xe')](_0x5d3324(null));};}for(var e in events){if(events[_0x0d4b('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x0d4b('0x10')](e,emitEvent(event));}}module[_0x0d4b('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 4bbd3a3..f88e5b7 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 _0x27ea=['rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','path'];(function(_0x4611df,_0x215f3f){var _0x27eecd=function(_0x3823eb){while(--_0x3823eb){_0x4611df['push'](_0x4611df['shift']());}};_0x27eecd(++_0x215f3f);}(_0x27ea,0xc7));var _0xa27e=function(_0x50d848,_0xea929f){_0x50d848=_0x50d848-0x0;var _0x56f314=_0x27ea[_0x50d848];return _0x56f314;};'use strict';var _=require(_0xa27e('0x0'));var util=require('util');var logger=require(_0xa27e('0x1'))(_0xa27e('0x2'));var moment=require('moment');var BPromise=require(_0xa27e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa27e('0x4'));var rimraf=require(_0xa27e('0x5'));var config=require(_0xa27e('0x6'));var attributes=require(_0xa27e('0x7'));module[_0xa27e('0x8')]=function(_0x40d37b,_0x3560f9){return _0x40d37b[_0xa27e('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0xa27e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa27e('0xb'),'hooks':{'beforeUpdate':function(_0x3f98b9,_0x4686fc,_0x4e48e1){if(_0x3f98b9[_0xa27e('0xc')](_0xa27e('0xd'))){_0x3f98b9[_0xa27e('0xe')]=moment()[_0xa27e('0xf')](_0xa27e('0x10'));}_0x4e48e1(null,_0x3f98b9);}}});}; \ No newline at end of file +var _0x8084=['rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8084,0x13b));var _0x4808=function(_0x810c55,_0x269ee9){_0x810c55=_0x810c55-0x0;var _0x51e8ba=_0x8084[_0x810c55];return _0x51e8ba;};'use strict';var _=require(_0x4808('0x0'));var util=require(_0x4808('0x1'));var logger=require(_0x4808('0x2'))(_0x4808('0x3'));var moment=require(_0x4808('0x4'));var BPromise=require(_0x4808('0x5'));var rp=require(_0x4808('0x6'));var fs=require('fs');var path=require(_0x4808('0x7'));var rimraf=require(_0x4808('0x8'));var config=require(_0x4808('0x9'));var attributes=require(_0x4808('0xa'));module[_0x4808('0xb')]=function(_0x409ae5,_0x31f3c7){return _0x409ae5[_0x4808('0xc')](_0x4808('0xd'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4808('0xe'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x318b96,_0x533aab,_0xabc8a0){if(_0x318b96[_0x4808('0xf')](_0x4808('0x10'))){_0x318b96[_0x4808('0x11')]=moment()['format'](_0x4808('0x12'));}_0xabc8a0(null,_0x318b96);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e9a852b..007b8d5 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 _0x70e0=['find','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','limit','AddTagsToOpenchannelInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x70e0,0x1ea));var _0x070e=function(_0x3181b3,_0x1f48fa){_0x3181b3=_0x3181b3-0x0;var _0x3a27e8=_0x70e0[_0x3181b3];return _0x3a27e8;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require(_0x070e('0x3'));var rs=require(_0x070e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x070e('0x5'))['db'];var utils=require(_0x070e('0x6'));var logger=require(_0x070e('0x7'))(_0x070e('0x8'));var config=require(_0x070e('0x9'));var jayson=require(_0x070e('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x070e('0xb')],{'host':_0x070e('0xc'),'port':0x18eb});var socket=require(_0x070e('0xd'))(new Redis(config[_0x070e('0xb')]));require(_0x070e('0xe'))[_0x070e('0xf')](socket);function respondWithRpcPromise(_0x58567a,_0x50075b,_0x5e464b){return new BPromise(function(_0x271915,_0x2c1593){return client[_0x070e('0x10')](_0x58567a,_0x5e464b)[_0x070e('0x11')](function(_0x111c60){logger['info'](_0x070e('0x12'),_0x50075b,_0x070e('0x13'));logger[_0x070e('0x14')](_0x070e('0x15'),_0x50075b,_0x070e('0x13'),JSON[_0x070e('0x16')](_0x111c60));if(_0x111c60[_0x070e('0x17')]){if(_0x111c60['error'][_0x070e('0x18')]===0x1f4){logger[_0x070e('0x17')](_0x070e('0x12'),_0x50075b,_0x111c60[_0x070e('0x17')]['message']);return _0x2c1593(_0x111c60['error'][_0x070e('0x19')]);}logger[_0x070e('0x17')](_0x070e('0x12'),_0x50075b,_0x111c60[_0x070e('0x17')][_0x070e('0x19')]);return _0x271915(_0x111c60['error']['message']);}else{logger[_0x070e('0x1a')]('OpenchannelInteraction,\x20%s,\x20%s',_0x50075b,_0x070e('0x13'));_0x271915(_0x111c60[_0x070e('0x1b')][_0x070e('0x19')]);}})[_0x070e('0x1c')](function(_0x477bec){logger[_0x070e('0x17')](_0x070e('0x12'),_0x50075b,_0x477bec);_0x2c1593(_0x477bec);});});}exports[_0x070e('0x1d')]=function(_0x5d577f){var _0x21afde=this;return new Promise(function(_0x557b64,_0x2327a5){return db[_0x070e('0x1e')][_0x070e('0x1f')](_0x5d577f[_0x070e('0x20')],{'raw':_0x5d577f[_0x070e('0x21')]?_0x5d577f['options'][_0x070e('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d577f[_0x070e('0x21')]?_0x5d577f[_0x070e('0x21')][_0x070e('0x23')]||null:null,'attributes':_0x5d577f[_0x070e('0x21')]?_0x5d577f['options']['attributes']||null:null,'limit':_0x5d577f[_0x070e('0x21')]?_0x5d577f['options'][_0x070e('0x24')]||null:null})[_0x070e('0x11')](function(_0x5b3473){logger[_0x070e('0x1a')]('UpdateOpenchannelInteraction',_0x5d577f);logger[_0x070e('0x14')](_0x070e('0x1d'),_0x5d577f,JSON[_0x070e('0x16')](_0x5b3473));_0x557b64(_0x5b3473);})[_0x070e('0x1c')](function(_0x16f4b1){logger[_0x070e('0x17')](_0x070e('0x1d'),_0x16f4b1[_0x070e('0x19')],_0x5d577f);_0x2327a5(_0x21afde[_0x070e('0x17')](0x1f4,_0x16f4b1[_0x070e('0x19')]));});});};exports[_0x070e('0x25')]=function(_0x32a8e4){return new Promise(function(_0x37b15e,_0xea51e7){return db[_0x070e('0x1e')][_0x070e('0x26')]({'where':_0x32a8e4[_0x070e('0x21')]?_0x32a8e4[_0x070e('0x21')][_0x070e('0x23')]||null:null})[_0x070e('0x11')](function(_0x297d8c){if(_0x297d8c){return _0x297d8c[_0x070e('0x27')](_0x32a8e4[_0x070e('0x20')]['ids'],_[_0x070e('0x28')](_0x32a8e4[_0x070e('0x20')],[_0x070e('0x29'),'id'])||{});}})[_0x070e('0x2a')](function(_0x269c5c){logger['info'](_0x070e('0x2b'),_0x32a8e4);logger[_0x070e('0x14')]('AddTags',_0x32a8e4,JSON[_0x070e('0x16')](_0x269c5c));_0x37b15e(_0x269c5c);})['catch'](function(_0x87a48e){logger[_0x070e('0x17')](_0x070e('0x2b'),_0x87a48e[_0x070e('0x19')],_0x32a8e4);_0xea51e7(_this[_0x070e('0x17')](0x1f4,_0x87a48e[_0x070e('0x19')]));});});}; \ No newline at end of file +var _0xe53a=['result','catch','OpenchannelInteraction','update','body','options','raw','where','attributes','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','./openchannelInteraction.socket','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent'];(function(_0x2102fd,_0x5eb187){var _0x5d4ef5=function(_0x5c8b40){while(--_0x5c8b40){_0x2102fd['push'](_0x2102fd['shift']());}};_0x5d4ef5(++_0x5eb187);}(_0xe53a,0xd8));var _0xae53=function(_0x2b9f2d,_0xacae96){_0x2b9f2d=_0x2b9f2d-0x0;var _0x829d5c=_0xe53a[_0x2b9f2d];return _0x829d5c;};'use strict';var _=require(_0xae53('0x0'));var util=require(_0xae53('0x1'));var moment=require(_0xae53('0x2'));var BPromise=require(_0xae53('0x3'));var rs=require(_0xae53('0x4'));var fs=require('fs');var Redis=require(_0xae53('0x5'));var db=require(_0xae53('0x6'))['db'];var utils=require(_0xae53('0x7'));var logger=require('../../config/logger')(_0xae53('0x8'));var config=require(_0xae53('0x9'));var jayson=require(_0xae53('0xa'));var client=jayson[_0xae53('0xb')]['http']({'port':0x232a});config[_0xae53('0xc')]=_[_0xae53('0xd')](config[_0xae53('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae53('0xc')]));require(_0xae53('0xe'))['register'](socket);function respondWithRpcPromise(_0x347188,_0x3c3500,_0x49eb5d){return new BPromise(function(_0x31da78,_0x34c3db){return client['request'](_0x347188,_0x49eb5d)[_0xae53('0xf')](function(_0xb66be4){logger[_0xae53('0x10')](_0xae53('0x11'),_0x3c3500,'request\x20sent');logger[_0xae53('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x3c3500,'request\x20sent',JSON[_0xae53('0x13')](_0xb66be4));if(_0xb66be4[_0xae53('0x14')]){if(_0xb66be4[_0xae53('0x14')][_0xae53('0x15')]===0x1f4){logger[_0xae53('0x14')](_0xae53('0x11'),_0x3c3500,_0xb66be4[_0xae53('0x14')][_0xae53('0x16')]);return _0x34c3db(_0xb66be4['error']['message']);}logger['error'](_0xae53('0x11'),_0x3c3500,_0xb66be4[_0xae53('0x14')][_0xae53('0x16')]);return _0x31da78(_0xb66be4[_0xae53('0x14')]['message']);}else{logger[_0xae53('0x10')](_0xae53('0x11'),_0x3c3500,_0xae53('0x17'));_0x31da78(_0xb66be4[_0xae53('0x18')][_0xae53('0x16')]);}})[_0xae53('0x19')](function(_0x2fc531){logger[_0xae53('0x14')](_0xae53('0x11'),_0x3c3500,_0x2fc531);_0x34c3db(_0x2fc531);});});}exports['UpdateOpenchannelInteraction']=function(_0x47fe82){var _0x323f22=this;return new Promise(function(_0xbb4f70,_0x23c22b){return db[_0xae53('0x1a')][_0xae53('0x1b')](_0x47fe82[_0xae53('0x1c')],{'raw':_0x47fe82[_0xae53('0x1d')]?_0x47fe82[_0xae53('0x1d')][_0xae53('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47fe82[_0xae53('0x1d')]?_0x47fe82[_0xae53('0x1d')][_0xae53('0x1f')]||null:null,'attributes':_0x47fe82[_0xae53('0x1d')]?_0x47fe82[_0xae53('0x1d')][_0xae53('0x20')]||null:null,'limit':_0x47fe82[_0xae53('0x1d')]?_0x47fe82[_0xae53('0x1d')]['limit']||null:null})[_0xae53('0xf')](function(_0x5da69f){logger['info'](_0xae53('0x21'),_0x47fe82);logger[_0xae53('0x12')](_0xae53('0x21'),_0x47fe82,JSON[_0xae53('0x13')](_0x5da69f));_0xbb4f70(_0x5da69f);})['catch'](function(_0x19f3c0){logger['error'](_0xae53('0x21'),_0x19f3c0[_0xae53('0x16')],_0x47fe82);_0x23c22b(_0x323f22[_0xae53('0x14')](0x1f4,_0x19f3c0[_0xae53('0x16')]));});});};exports[_0xae53('0x22')]=function(_0x15209a){return new Promise(function(_0x1e5e2b,_0x4dbb08){return db['OpenchannelInteraction'][_0xae53('0x23')]({'where':_0x15209a[_0xae53('0x1d')]?_0x15209a[_0xae53('0x1d')][_0xae53('0x1f')]||null:null})[_0xae53('0xf')](function(_0x2b6053){if(_0x2b6053){return _0x2b6053['addTags'](_0x15209a['body'][_0xae53('0x24')],_[_0xae53('0x25')](_0x15209a[_0xae53('0x1c')],['ids','id'])||{});}})[_0xae53('0x26')](function(_0x37660f){logger[_0xae53('0x10')]('AddTags',_0x15209a);logger[_0xae53('0x12')](_0xae53('0x27'),_0x15209a,JSON[_0xae53('0x13')](_0x37660f));_0x1e5e2b(_0x37660f);})[_0xae53('0x19')](function(_0x2b1940){logger[_0xae53('0x14')](_0xae53('0x27'),_0x2b1940['message'],_0x15209a);_0x4dbb08(_this[_0xae53('0x14')](0x1f4,_0x2b1940['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 14fd1fe..a9a478f 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 _0x61c3=['openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener','length'];(function(_0x1bbb5a,_0x186179){var _0x4e27af=function(_0x3aa53d){while(--_0x3aa53d){_0x1bbb5a['push'](_0x1bbb5a['shift']());}};_0x4e27af(++_0x186179);}(_0x61c3,0xe9));var _0x361c=function(_0xd8192b,_0x1060c4){_0xd8192b=_0xd8192b-0x0;var _0x3c3a12=_0x61c3[_0xd8192b];return _0x3c3a12;};'use strict';var OpenchannelInteractionEvents=require(_0x361c('0x0'));var events=[_0x361c('0x1'),_0x361c('0x2'),_0x361c('0x3')];function createListener(_0x5799ef,_0x26732f){return function(_0x4c5566){_0x26732f[_0x361c('0x4')](_0x5799ef,_0x4c5566);};}function removeListener(_0x42d60b,_0x1dad30){return function(){OpenchannelInteractionEvents[_0x361c('0x5')](_0x42d60b,_0x1dad30);};}exports['register']=function(_0x3e7075){for(var _0x108bc4=0x0,_0x4a891e=events[_0x361c('0x6')];_0x108bc4<_0x4a891e;_0x108bc4++){var _0x193f68=events[_0x108bc4];var _0x2621f5=createListener(_0x361c('0x7')+_0x193f68,_0x3e7075);OpenchannelInteractionEvents['on'](_0x193f68,_0x2621f5);}}; \ No newline at end of file +var _0xab22=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','remove','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xab22,0x6d));var _0x2ab2=function(_0x5a99aa,_0x142eaa){_0x5a99aa=_0x5a99aa-0x0;var _0x32d9a5=_0xab22[_0x5a99aa];return _0x32d9a5;};'use strict';var OpenchannelInteractionEvents=require(_0x2ab2('0x0'));var events=['save',_0x2ab2('0x1'),_0x2ab2('0x2')];function createListener(_0x5f3ffb,_0x3f13ef){return function(_0x581129){_0x3f13ef[_0x2ab2('0x3')](_0x5f3ffb,_0x581129);};}function removeListener(_0x102a2f,_0x56866c){return function(){OpenchannelInteractionEvents[_0x2ab2('0x4')](_0x102a2f,_0x56866c);};}exports[_0x2ab2('0x5')]=function(_0x426863){for(var _0x361563=0x0,_0x3897b8=events[_0x2ab2('0x6')];_0x361563<_0x3897b8;_0x361563++){var _0x4a2b65=events[_0x361563];var _0x311fee=createListener(_0x2ab2('0x7')+_0x4a2b65,_0x426863);OpenchannelInteractionEvents['on'](_0x4a2b65,_0x311fee);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 7669c68..c6cd4ed 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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x39df29,_0x450cdc){var _0x4cecc6=function(_0x32c11d){while(--_0x32c11d){_0x39df29['push'](_0x39df29['shift']());}};_0x4cecc6(++_0x450cdc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ed7d1,_0x363741){_0x2ed7d1=_0x2ed7d1-0x0;var _0x38ae3c=_0xcb91[_0x2ed7d1];return _0x38ae3c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x441847,_0x21da34){var _0x5b109c=function(_0x1ec126){while(--_0x1ec126){_0x441847['push'](_0x441847['shift']());}};_0x5b109c(++_0x21da34);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 26532a2..60c3608 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 _0x793b=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x793b,0x189));var _0xb793=function(_0x2ae800,_0x10bc24){_0x2ae800=_0x2ae800-0x0;var _0x4ba266=_0x793b[_0x2ae800];return _0x4ba266;};'use strict';var Sequelize=require(_0xb793('0x0'));module[_0xb793('0x1')]={'body':{'type':Sequelize[_0xb793('0x2')](_0xb793('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb793('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xb793('0x5')]('in',_0xb793('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xb793('0x7')]},'providerResponse':{'type':Sequelize[_0xb793('0x2')]}}; \ No newline at end of file +var _0x0490=['DATE','STRING','TEXT','exports','ENUM','out'];(function(_0x459c7d,_0x1771b5){var _0x2e676f=function(_0x1e31e0){while(--_0x1e31e0){_0x459c7d['push'](_0x459c7d['shift']());}};_0x2e676f(++_0x1771b5);}(_0x0490,0x147));var _0x0049=function(_0x599bb8,_0x1f7b8c){_0x599bb8=_0x599bb8-0x0;var _0x1dee4=_0x0490[_0x599bb8];return _0x1dee4;};'use strict';var Sequelize=require('sequelize');module[_0x0049('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0049('0x1')]('in',_0x0049('0x2')),'defaultValue':_0x0049('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0049('0x3')]},'providerName':{'type':Sequelize[_0x0049('0x4')]},'providerResponse':{'type':Sequelize[_0x0049('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 67c82c8..0a09831 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 _0x3805=['RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','name','filter','options','OpenchannelMessage','includeAll','include','findAll','rows','params','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x3ade66,_0x55ed5f){var _0x4adbd3=function(_0x11b865){while(--_0x11b865){_0x3ade66['push'](_0x3ade66['shift']());}};_0x4adbd3(++_0x55ed5f);}(_0x3805,0x111));var _0x5380=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0x3805[_0x2fb87c];return _0x43038b;};'use strict';var emlformat=require(_0x5380('0x0'));var rimraf=require(_0x5380('0x1'));var zipdir=require(_0x5380('0x2'));var jsonpatch=require(_0x5380('0x3'));var rp=require(_0x5380('0x4'));var moment=require(_0x5380('0x5'));var BPromise=require(_0x5380('0x6'));var Mustache=require(_0x5380('0x7'));var util=require(_0x5380('0x8'));var path=require(_0x5380('0x9'));var sox=require(_0x5380('0xa'));var csv=require('to-csv');var ejs=require(_0x5380('0xb'));var fs=require('fs');var fs_extra=require(_0x5380('0xc'));var _=require(_0x5380('0xd'));var squel=require(_0x5380('0xe'));var crypto=require(_0x5380('0xf'));var jsforce=require(_0x5380('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x5380('0x11'));var querystring=require(_0x5380('0x12'));var Papa=require(_0x5380('0x13'));var Redis=require(_0x5380('0x14'));var authService=require(_0x5380('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x5380('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5380('0x17'))('api');var utils=require(_0x5380('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5380('0x19'));var db=require(_0x5380('0x1a'))['db'];config[_0x5380('0x1b')]=_[_0x5380('0x1c')](config[_0x5380('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x5380('0x1d'))(new Redis(config[_0x5380('0x1b')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x5380('0x1e'));var client=jayson[_0x5380('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x5380('0x1f')][_0x5380('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x15b26e,_0x365aeb,_0x2d7d85,_0x528962){return new BPromise(function(_0x4e884d,_0x39f638){var _0x4942c7=_0x528962||client;return _0x4942c7[_0x5380('0x21')](_0x15b26e,_0x2d7d85)[_0x5380('0x22')](function(_0x10a1b4){logger[_0x5380('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x365aeb,_0x5380('0x24'));logger[_0x5380('0x25')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x365aeb,_0x5380('0x24'),JSON['stringify'](_0x10a1b4));if(_0x10a1b4[_0x5380('0x26')]){if(_0x10a1b4['error'][_0x5380('0x27')]===0x1f4){logger['error'](_0x5380('0x28'),_0x365aeb,_0x10a1b4[_0x5380('0x26')][_0x5380('0x29')]);return _0x39f638(_0x10a1b4[_0x5380('0x26')][_0x5380('0x29')]);}logger[_0x5380('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x365aeb,_0x10a1b4['error'][_0x5380('0x29')]);return _0x4e884d(_0x10a1b4[_0x5380('0x26')][_0x5380('0x29')]);}else{logger[_0x5380('0x23')](_0x5380('0x28'),_0x365aeb,_0x5380('0x24'));_0x4e884d(_0x10a1b4[_0x5380('0x2a')][_0x5380('0x29')]);}})[_0x5380('0x2b')](function(_0x219626){logger[_0x5380('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x365aeb,_0x219626);_0x39f638(_0x219626);});});}function respondWithStatusCode(_0x3787d1,_0x5e95e4){_0x5e95e4=_0x5e95e4||0xcc;return function(_0x2b1260){if(_0x2b1260){return _0x3787d1['sendStatus'](_0x5e95e4);}return _0x3787d1['status'](_0x5e95e4)[_0x5380('0x2c')]();};}function respondWithResult(_0x39b109,_0x272e10){_0x272e10=_0x272e10||0xc8;return function(_0x1bf7bd){if(_0x1bf7bd){return _0x39b109['status'](_0x272e10)['json'](_0x1bf7bd);}};}function respondWithFilteredResult(_0x58b891,_0x3e5f53){return function(_0x575313){if(_0x575313){var _0x46042d=typeof _0x3e5f53[_0x5380('0x2d')]===_0x5380('0x2e')&&typeof _0x3e5f53[_0x5380('0x2f')]==='undefined';var _0x1a9a05=_0x575313[_0x5380('0x30')];var _0x353fb3=_0x46042d?0x0:_0x3e5f53[_0x5380('0x2d')];var _0x170a7f=_0x46042d?_0x575313[_0x5380('0x30')]:_0x3e5f53[_0x5380('0x2d')]+_0x3e5f53['limit'];var _0xbff15d;if(_0x170a7f>=_0x1a9a05){_0x170a7f=_0x1a9a05;_0xbff15d=0xc8;}else{_0xbff15d=0xce;}_0x58b891[_0x5380('0x31')](_0xbff15d);return _0x58b891[_0x5380('0x32')](_0x5380('0x33'),_0x353fb3+'-'+_0x170a7f+'/'+_0x1a9a05)[_0x5380('0x34')](_0x575313);}return null;};}function patchUpdates(_0x44a418){return function(_0x57747f){try{jsonpatch[_0x5380('0x35')](_0x57747f,_0x44a418,!![]);}catch(_0x34b39e){return BPromise[_0x5380('0x36')](_0x34b39e);}return _0x57747f[_0x5380('0x37')]();};}function saveUpdates(_0x23af6c,_0x4465ae){return function(_0x5311f7){if(_0x5311f7){return _0x5311f7[_0x5380('0x38')](_0x23af6c)[_0x5380('0x22')](function(_0x2c2394){return _0x2c2394;});}return null;};}function removeEntity(_0x526e2e,_0x30c44a){return function(_0xb7d31d){if(_0xb7d31d){return _0xb7d31d[_0x5380('0x39')]()['then'](function(){_0x526e2e['status'](0xcc)[_0x5380('0x2c')]();});}};}function handleEntityNotFound(_0x86370c,_0x7e3669){return function(_0x4d435b){if(!_0x4d435b){_0x86370c[_0x5380('0x3a')](0x194);}return _0x4d435b;};}function handleError(_0x8babc0,_0x483050){_0x483050=_0x483050||0x1f4;return function(_0x556ec3){logger[_0x5380('0x26')](_0x556ec3[_0x5380('0x3b')]);if(_0x556ec3['name']){delete _0x556ec3['name'];}_0x8babc0[_0x5380('0x31')](_0x483050)[_0x5380('0x3c')](_0x556ec3);};}exports[_0x5380('0x3d')]=function(_0x872b92,_0x2e27eb){var _0x550a8a={},_0x25e7f2={},_0x239cd9={'count':0x0,'rows':[]};var _0x10a48f=_['map'](db['OpenchannelMessage'][_0x5380('0x3e')],function(_0x215310){return{'name':_0x215310[_0x5380('0x3f')],'type':_0x215310[_0x5380('0x40')]['key']};});_0x25e7f2[_0x5380('0x41')]=_[_0x5380('0x42')](_0x10a48f,'name');_0x25e7f2[_0x5380('0x43')]=_[_0x5380('0x44')](_0x872b92['query']);_0x25e7f2[_0x5380('0x45')]=_[_0x5380('0x46')](_0x25e7f2['model'],_0x25e7f2[_0x5380('0x43')]);_0x550a8a[_0x5380('0x47')]=_[_0x5380('0x46')](_0x25e7f2[_0x5380('0x41')],qs[_0x5380('0x48')](_0x872b92[_0x5380('0x43')][_0x5380('0x48')]));_0x550a8a[_0x5380('0x47')]=_0x550a8a[_0x5380('0x47')][_0x5380('0x49')]?_0x550a8a[_0x5380('0x47')]:_0x25e7f2['model'];if(!_0x872b92[_0x5380('0x43')][_0x5380('0x4a')](_0x5380('0x4b'))){_0x550a8a[_0x5380('0x2f')]=qs['limit'](_0x872b92[_0x5380('0x43')][_0x5380('0x2f')]);_0x550a8a['offset']=qs[_0x5380('0x2d')](_0x872b92[_0x5380('0x43')][_0x5380('0x2d')]);}_0x550a8a['order']=qs[_0x5380('0x4c')](_0x872b92[_0x5380('0x43')][_0x5380('0x4c')]);_0x550a8a['where']=qs[_0x5380('0x45')](_[_0x5380('0x4d')](_0x872b92['query'],_0x25e7f2[_0x5380('0x45')]),_0x10a48f);if(_0x872b92[_0x5380('0x43')]['filter']){_0x550a8a[_0x5380('0x4e')]=_[_0x5380('0x4f')](_0x550a8a[_0x5380('0x4e')],{'$or':_[_0x5380('0x42')](_0x10a48f,function(_0x266ae9){if(_0x266ae9[_0x5380('0x40')]!==_0x5380('0x50')){var _0x2e5f08={};_0x2e5f08[_0x266ae9[_0x5380('0x51')]]={'$like':'%'+_0x872b92[_0x5380('0x43')][_0x5380('0x52')]+'%'};return _0x2e5f08;}})});}_0x550a8a=_['merge']({},_0x550a8a,_0x872b92[_0x5380('0x53')]);var _0x1ea83a={'where':_0x550a8a[_0x5380('0x4e')]};return db[_0x5380('0x54')][_0x5380('0x30')](_0x1ea83a)[_0x5380('0x22')](function(_0x530746){_0x239cd9[_0x5380('0x30')]=_0x530746;if(_0x872b92[_0x5380('0x43')][_0x5380('0x55')]){_0x550a8a[_0x5380('0x56')]=[{'all':!![]}];}return db[_0x5380('0x54')][_0x5380('0x57')](_0x550a8a);})[_0x5380('0x22')](function(_0x52d3e8){_0x239cd9[_0x5380('0x58')]=_0x52d3e8;return _0x239cd9;})[_0x5380('0x22')](respondWithFilteredResult(_0x2e27eb,_0x550a8a))[_0x5380('0x2b')](handleError(_0x2e27eb,null));};exports['show']=function(_0x1473bb,_0x40aa3d){var _0x5d7559={'raw':!![],'where':{'id':_0x1473bb[_0x5380('0x59')]['id']}},_0x3df54e={};_0x3df54e[_0x5380('0x41')]=_['keys'](db[_0x5380('0x54')]['rawAttributes']);_0x3df54e[_0x5380('0x43')]=_[_0x5380('0x44')](_0x1473bb[_0x5380('0x43')]);_0x3df54e[_0x5380('0x45')]=_[_0x5380('0x46')](_0x3df54e[_0x5380('0x41')],_0x3df54e[_0x5380('0x43')]);_0x5d7559[_0x5380('0x47')]=_[_0x5380('0x46')](_0x3df54e['model'],qs[_0x5380('0x48')](_0x1473bb[_0x5380('0x43')]['fields']));_0x5d7559[_0x5380('0x47')]=_0x5d7559['attributes'][_0x5380('0x49')]?_0x5d7559[_0x5380('0x47')]:_0x3df54e[_0x5380('0x41')];if(_0x1473bb[_0x5380('0x43')][_0x5380('0x55')]){_0x5d7559[_0x5380('0x56')]=[{'all':!![]}];}_0x5d7559=_[_0x5380('0x4f')]({},_0x5d7559,_0x1473bb[_0x5380('0x53')]);return db[_0x5380('0x54')][_0x5380('0x5a')](_0x5d7559)[_0x5380('0x22')](handleEntityNotFound(_0x40aa3d,null))[_0x5380('0x22')](respondWithResult(_0x40aa3d,null))[_0x5380('0x2b')](handleError(_0x40aa3d,null));};exports[_0x5380('0x5b')]=function(_0x338501,_0x20c6c2){return db['OpenchannelMessage'][_0x5380('0x5b')](_0x338501[_0x5380('0x5c')],{})[_0x5380('0x22')](respondWithResult(_0x20c6c2,0xc9))[_0x5380('0x2b')](handleError(_0x20c6c2,null));};exports['update']=function(_0x3dedd5,_0x1cb578){if(_0x3dedd5['body']['id']){delete _0x3dedd5[_0x5380('0x5c')]['id'];}return db[_0x5380('0x54')]['find']({'where':{'id':_0x3dedd5['params']['id']}})[_0x5380('0x22')](handleEntityNotFound(_0x1cb578,null))[_0x5380('0x22')](saveUpdates(_0x3dedd5[_0x5380('0x5c')],null))[_0x5380('0x22')](respondWithResult(_0x1cb578,null))['catch'](handleError(_0x1cb578,null));};exports[_0x5380('0x39')]=function(_0x4118ec,_0x4f2281){return db['OpenchannelMessage']['find']({'where':{'id':_0x4118ec[_0x5380('0x59')]['id']}})[_0x5380('0x22')](handleEntityNotFound(_0x4f2281,null))[_0x5380('0x22')](removeEntity(_0x4f2281,null))[_0x5380('0x2b')](handleError(_0x4f2281,null));};exports[_0x5380('0x5d')]=function(_0x27863f,_0x46b94d){return db['OpenchannelMessage'][_0x5380('0x5d')]()[_0x5380('0x22')](respondWithResult(_0x46b94d,null))[_0x5380('0x2b')](handleError(_0x46b94d,null));};var interaction_log=require(_0x5380('0x17'))(_0x5380('0x5e'));exports[_0x5380('0x5f')]=function(_0x341769,_0x4d8e62,_0x1d560f){var _0xf81b76={'agent':{},'channel':_0x5380('0x60')};if(_0x341769['body']['id']){delete _0x341769[_0x5380('0x5c')]['id'];}_0x341769[_0x5380('0x5c')][_0x5380('0x61')]=!![];_0x341769[_0x5380('0x5c')][_0x5380('0x62')]=moment()[_0x5380('0x63')](_0x5380('0x64'));_0x341769[_0x5380('0x5c')][_0x5380('0x65')]=_0x341769[_0x5380('0x5c')]['UserId']||_0x341769[_0x5380('0x66')]['id'];_0xf81b76[_0x5380('0x67')]['id']=_0x341769[_0x5380('0x5c')][_0x5380('0x65')];return db[_0x5380('0x54')][_0x5380('0x5a')]({'where':{'id':_0x341769['params']['id'],'UserId':null}})[_0x5380('0x22')](handleEntityNotFound(_0x4d8e62,null))[_0x5380('0x22')](saveUpdates(_0x341769[_0x5380('0x5c')],null))[_0x5380('0x22')](function(_0x15ddc3){if(_0x15ddc3){_0xf81b76['message']=_0x15ddc3[_0x5380('0x68')]({'plain':!![]});return db[_0x5380('0x69')][_0x5380('0x5a')]({'where':{'id':_0x15ddc3['OpenchannelInteractionId']}});}return null;})[_0x5380('0x22')](handleEntityNotFound(_0x4d8e62,null))[_0x5380('0x22')](function(_0x170374){if(_0x170374){return _0x170374[_0x5380('0x38')]({'UserId':_0x341769[_0x5380('0x5c')][_0x5380('0x65')],'read1stAt':_[_0x5380('0x6a')](_0x170374[_0x5380('0x6b')])?moment()[_0x5380('0x63')](_0x5380('0x64')):undefined});}return null;})[_0x5380('0x22')](function(_0x38dab1){if(_0x38dab1){_0xf81b76[_0x5380('0x6c')]=_0x38dab1[_0x5380('0x68')]({'plain':!![]});interaction_log[_0x5380('0x23')](_0x5380('0x6d'),_0x341769[_0x5380('0x66')]['id'],_0x341769['user'][_0x5380('0x51')],_0x341769[_0x5380('0x66')][_0x5380('0x6e')],_0xf81b76[_0x5380('0x6c')]['id'],_0x341769[_0x5380('0x5c')]?JSON[_0x5380('0x6f')](_0x341769['body']):_0x5380('0x70'));return respondWithRpcPromise('AcceptMessage',_0x5380('0x71'),_0xf81b76);}return null;})[_0x5380('0x22')](function(_0x51fa89){var _0x3d7124=_0x5380('0x72')+_0x51fa89[_0x5380('0x29')][_0x5380('0x73')];return db[_0x5380('0x74')][_0x5380('0x43')](_0x3d7124,{'type':db[_0x5380('0x75')][_0x5380('0x76')][_0x5380('0x77')],'raw':!![]})[_0x5380('0x22')](function(_0x20cd19){return _0x20cd19;});})[_0x5380('0x22')](function(_0x270c5e){if(_0x270c5e){_0xf81b76[_0x5380('0x29')][_0x5380('0x78')]=_0x270c5e[0x0];if(!_0x341769[_0x5380('0x5c')][_0x5380('0x65')])return;return db['User']['find']({'where':{'id':_0x341769[_0x5380('0x5c')][_0x5380('0x65')],'role':_0x5380('0x67')},'attributes':['id',_0x5380('0x51'),_0x5380('0x79'),_0x5380('0x7a'),'internal'],'raw':!![]});}return null;})[_0x5380('0x22')](function(_0x541460){if(!_0x541460)return null;_0xf81b76[_0x5380('0x29')]['agent']=_0x541460;return _0xf81b76;})[_0x5380('0x22')](function(_0x1eec3a){if(_0x1eec3a){if(_0x341769['body']['manual']){_0xf81b76[_0x5380('0x29')][_0x5380('0x7b')]=util[_0x5380('0x63')](_0x5380('0x7c'),_0x341769[_0x5380('0x66')][_0x5380('0x51')]);_0xf81b76[_0x5380('0x29')]['channel']=_0xf81b76[_0x5380('0x7d')];_0xf81b76[_0x5380('0x29')][_0x5380('0x7e')]=_0xf81b76[_0x5380('0x7d')];_0xf81b76[_0x5380('0x29')][_0x5380('0x7f')]=_0x5380('0x5f');return respondWithRpcPromise(_0x5380('0x80'),'EventManager',{'event':_0x5380('0x81'),'message':_0xf81b76[_0x5380('0x29')]},client9002)[_0x5380('0x22')](function(){return _0xf81b76;});}return _0xf81b76;}return null;})[_0x5380('0x22')](respondWithResult(_0x4d8e62,null))[_0x5380('0x2b')](handleError(_0x4d8e62,null));};var interaction_log=require(_0x5380('0x17'))('openchannel-interactions');exports[_0x5380('0x36')]=function(_0x427d8d,_0x1f357c,_0x1cec1c){var _0xe4b04d={'agent':{},'channel':_0x5380('0x60')};if(_0x427d8d[_0x5380('0x5c')]['id']){delete _0x427d8d[_0x5380('0x5c')]['id'];}_0x427d8d[_0x5380('0x5c')][_0x5380('0x65')]=_0x427d8d[_0x5380('0x5c')][_0x5380('0x65')]||_0x427d8d['user']['id'];_0xe4b04d['agent']['id']=_0x427d8d[_0x5380('0x5c')][_0x5380('0x65')];return db['OpenchannelMessage'][_0x5380('0x5a')]({'where':{'id':_0x427d8d[_0x5380('0x59')]['id'],'UserId':null}})[_0x5380('0x22')](handleEntityNotFound(_0x1f357c,null))[_0x5380('0x22')](function(_0x5c885f){if(_0x5c885f){_0xe4b04d[_0x5380('0x29')]=_0x5c885f[_0x5380('0x68')]({'plain':!![]});return db[_0x5380('0x69')][_0x5380('0x5a')]({'where':{'id':_0x5c885f[_0x5380('0x82')]}});}return null;})[_0x5380('0x22')](handleEntityNotFound(_0x1f357c,null))[_0x5380('0x22')](function(_0x2ea711){if(_0x2ea711){_0xe4b04d[_0x5380('0x6c')]=_0x2ea711['get']({'plain':!![]});interaction_log[_0x5380('0x23')](_0x5380('0x83'),_0x427d8d[_0x5380('0x66')]['id'],_0x427d8d['user']['name'],_0x427d8d[_0x5380('0x66')]['role'],_0xe4b04d['interaction']['id'],_0x427d8d[_0x5380('0x5c')]?JSON['stringify'](_0x427d8d['body']):_0x5380('0x70'));return respondWithRpcPromise(_0x5380('0x84'),_0x5380('0x85'),_0xe4b04d);}return null;})[_0x5380('0x22')](function(_0x3110fa){var _0x328908=_0x5380('0x72')+_0x3110fa['message'][_0x5380('0x73')];return db[_0x5380('0x74')][_0x5380('0x43')](_0x328908,{'type':db[_0x5380('0x75')][_0x5380('0x76')]['SELECT'],'raw':!![]})['then'](function(_0x108ebf){return _0x108ebf;});})['then'](function(_0x167652){if(_0x167652){_0xe4b04d[_0x5380('0x29')]['contact']=_0x167652[0x0];if(!_0x427d8d[_0x5380('0x5c')][_0x5380('0x65')])return;return db['User'][_0x5380('0x5a')]({'where':{'id':_0x427d8d[_0x5380('0x5c')]['UserId'],'role':'agent'},'attributes':['id',_0x5380('0x51'),'fullname',_0x5380('0x7a'),'internal'],'raw':!![]});}return null;})[_0x5380('0x22')](function(_0x5a19dc){if(!_0x5a19dc)return null;_0xe4b04d[_0x5380('0x29')][_0x5380('0x67')]=_0x5a19dc;return _0xe4b04d;})[_0x5380('0x22')](function(_0xb63c58){if(_0xb63c58){_0xb63c58['message'][_0x5380('0x7b')]=util[_0x5380('0x63')](_0x5380('0x7c'),_0x427d8d[_0x5380('0x66')]['name']);_0xb63c58[_0x5380('0x29')][_0x5380('0x7d')]=_0xe4b04d[_0x5380('0x7d')];_0xb63c58[_0x5380('0x29')]['motionChannel']=_0xe4b04d[_0x5380('0x7d')];_0xb63c58[_0x5380('0x29')][_0x5380('0x7f')]=_0x5380('0x36');respondWithRpcPromise(_0x5380('0x80'),'EventManager',{'event':_0x5380('0x86'),'message':_0xb63c58[_0x5380('0x29')]},client9002);return _0xe4b04d;}return null;})['then'](respondWithResult(_0x1f357c,null))[_0x5380('0x2b')](handleError(_0x1f357c,null));}; \ No newline at end of file +var _0x42ec=['request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','name','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','include','find','body','update','destroy','describe','openchannel-interactions','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteractionId','read1stAt','format','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','reject','interaction','RejectMessage','rejectMessage','motionChannel','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1ac134,_0x2df545){var _0x4a6338=function(_0x271da3){while(--_0x271da3){_0x1ac134['push'](_0x1ac134['shift']());}};_0x4a6338(++_0x2df545);}(_0x42ec,0x1e8));var _0xc42e=function(_0x3f5ead,_0x547c30){_0x3f5ead=_0x3f5ead-0x0;var _0x344ef5=_0x42ec[_0x3f5ead];return _0x344ef5;};'use strict';var emlformat=require(_0xc42e('0x0'));var rimraf=require(_0xc42e('0x1'));var zipdir=require(_0xc42e('0x2'));var jsonpatch=require(_0xc42e('0x3'));var rp=require(_0xc42e('0x4'));var moment=require('moment');var BPromise=require(_0xc42e('0x5'));var Mustache=require('mustache');var util=require(_0xc42e('0x6'));var path=require(_0xc42e('0x7'));var sox=require(_0xc42e('0x8'));var csv=require(_0xc42e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc42e('0xa'));var _=require('lodash');var squel=require(_0xc42e('0xb'));var crypto=require(_0xc42e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc42e('0xd'));var toCsv=require(_0xc42e('0x9'));var querystring=require(_0xc42e('0xe'));var Papa=require(_0xc42e('0xf'));var Redis=require('ioredis');var authService=require(_0xc42e('0x10'));var qs=require(_0xc42e('0x11'));var as=require(_0xc42e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc42e('0x13'))(_0xc42e('0x14'));var utils=require(_0xc42e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc42e('0x16'));var db=require(_0xc42e('0x17'))['db'];config[_0xc42e('0x18')]=_[_0xc42e('0x19')](config['redis'],{'host':_0xc42e('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc42e('0x18')]));require(_0xc42e('0x1b'))[_0xc42e('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc42e('0x1d')][_0xc42e('0x1e')]({'port':0x232c});var client9002=jayson[_0xc42e('0x1d')][_0xc42e('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x257bb8,_0x247f0b,_0xaecbad,_0x569626){return new BPromise(function(_0x179ee0,_0x4fdda0){var _0x2b70b3=_0x569626||client;return _0x2b70b3[_0xc42e('0x1f')](_0x257bb8,_0xaecbad)[_0xc42e('0x20')](function(_0x19dbf0){logger[_0xc42e('0x21')](_0xc42e('0x22'),_0x247f0b,_0xc42e('0x23'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x247f0b,'request\x20sent',JSON[_0xc42e('0x24')](_0x19dbf0));if(_0x19dbf0[_0xc42e('0x25')]){if(_0x19dbf0['error']['code']===0x1f4){logger[_0xc42e('0x25')](_0xc42e('0x22'),_0x247f0b,_0x19dbf0[_0xc42e('0x25')][_0xc42e('0x26')]);return _0x4fdda0(_0x19dbf0['error'][_0xc42e('0x26')]);}logger[_0xc42e('0x25')](_0xc42e('0x22'),_0x247f0b,_0x19dbf0[_0xc42e('0x25')][_0xc42e('0x26')]);return _0x179ee0(_0x19dbf0[_0xc42e('0x25')][_0xc42e('0x26')]);}else{logger[_0xc42e('0x21')](_0xc42e('0x22'),_0x247f0b,_0xc42e('0x23'));_0x179ee0(_0x19dbf0[_0xc42e('0x27')]['message']);}})['catch'](function(_0x28a73f){logger[_0xc42e('0x25')](_0xc42e('0x22'),_0x247f0b,_0x28a73f);_0x4fdda0(_0x28a73f);});});}function respondWithStatusCode(_0x471102,_0x4be45c){_0x4be45c=_0x4be45c||0xcc;return function(_0x226790){if(_0x226790){return _0x471102[_0xc42e('0x28')](_0x4be45c);}return _0x471102[_0xc42e('0x29')](_0x4be45c)[_0xc42e('0x2a')]();};}function respondWithResult(_0x4dbe3a,_0x545c81){_0x545c81=_0x545c81||0xc8;return function(_0x285a50){if(_0x285a50){return _0x4dbe3a['status'](_0x545c81)['json'](_0x285a50);}};}function respondWithFilteredResult(_0x37060b,_0x393448){return function(_0x373ad0){if(_0x373ad0){var _0x4e3dbe=typeof _0x393448[_0xc42e('0x2b')]===_0xc42e('0x2c')&&typeof _0x393448[_0xc42e('0x2d')]===_0xc42e('0x2c');var _0x40b8ad=_0x373ad0[_0xc42e('0x2e')];var _0x1a41de=_0x4e3dbe?0x0:_0x393448['offset'];var _0x1ba828=_0x4e3dbe?_0x373ad0[_0xc42e('0x2e')]:_0x393448[_0xc42e('0x2b')]+_0x393448[_0xc42e('0x2d')];var _0x4285c6;if(_0x1ba828>=_0x40b8ad){_0x1ba828=_0x40b8ad;_0x4285c6=0xc8;}else{_0x4285c6=0xce;}_0x37060b['status'](_0x4285c6);return _0x37060b[_0xc42e('0x2f')](_0xc42e('0x30'),_0x1a41de+'-'+_0x1ba828+'/'+_0x40b8ad)[_0xc42e('0x31')](_0x373ad0);}return null;};}function patchUpdates(_0x4173f7){return function(_0x10eaa8){try{jsonpatch['apply'](_0x10eaa8,_0x4173f7,!![]);}catch(_0x33df7e){return BPromise['reject'](_0x33df7e);}return _0x10eaa8[_0xc42e('0x32')]();};}function saveUpdates(_0x34a605,_0x584db9){return function(_0x326dcf){if(_0x326dcf){return _0x326dcf['update'](_0x34a605)[_0xc42e('0x20')](function(_0x5d9a60){return _0x5d9a60;});}return null;};}function removeEntity(_0x54dcd1,_0x44d3a8){return function(_0xce4d5){if(_0xce4d5){return _0xce4d5['destroy']()[_0xc42e('0x20')](function(){_0x54dcd1[_0xc42e('0x29')](0xcc)[_0xc42e('0x2a')]();});}};}function handleEntityNotFound(_0x3d8e3d,_0x3dc833){return function(_0x22e972){if(!_0x22e972){_0x3d8e3d[_0xc42e('0x28')](0x194);}return _0x22e972;};}function handleError(_0x3a7b70,_0x1a2aa1){_0x1a2aa1=_0x1a2aa1||0x1f4;return function(_0x317002){logger[_0xc42e('0x25')](_0x317002['stack']);if(_0x317002[_0xc42e('0x33')]){delete _0x317002[_0xc42e('0x33')];}_0x3a7b70[_0xc42e('0x29')](_0x1a2aa1)['send'](_0x317002);};}exports['index']=function(_0xb6f000,_0x30b739){var _0x26a223={},_0x2a0c78={},_0x2f94dd={'count':0x0,'rows':[]};var _0x456342=_[_0xc42e('0x34')](db[_0xc42e('0x35')][_0xc42e('0x36')],function(_0x12f3d2){return{'name':_0x12f3d2[_0xc42e('0x37')],'type':_0x12f3d2[_0xc42e('0x38')][_0xc42e('0x39')]};});_0x2a0c78['model']=_[_0xc42e('0x34')](_0x456342,'name');_0x2a0c78[_0xc42e('0x3a')]=_[_0xc42e('0x3b')](_0xb6f000[_0xc42e('0x3a')]);_0x2a0c78[_0xc42e('0x3c')]=_['intersection'](_0x2a0c78[_0xc42e('0x3d')],_0x2a0c78[_0xc42e('0x3a')]);_0x26a223[_0xc42e('0x3e')]=_[_0xc42e('0x3f')](_0x2a0c78[_0xc42e('0x3d')],qs[_0xc42e('0x40')](_0xb6f000[_0xc42e('0x3a')][_0xc42e('0x40')]));_0x26a223['attributes']=_0x26a223[_0xc42e('0x3e')][_0xc42e('0x41')]?_0x26a223[_0xc42e('0x3e')]:_0x2a0c78[_0xc42e('0x3d')];if(!_0xb6f000[_0xc42e('0x3a')]['hasOwnProperty'](_0xc42e('0x42'))){_0x26a223['limit']=qs[_0xc42e('0x2d')](_0xb6f000[_0xc42e('0x3a')][_0xc42e('0x2d')]);_0x26a223[_0xc42e('0x2b')]=qs[_0xc42e('0x2b')](_0xb6f000[_0xc42e('0x3a')]['offset']);}_0x26a223[_0xc42e('0x43')]=qs[_0xc42e('0x44')](_0xb6f000[_0xc42e('0x3a')][_0xc42e('0x44')]);_0x26a223['where']=qs[_0xc42e('0x3c')](_[_0xc42e('0x45')](_0xb6f000[_0xc42e('0x3a')],_0x2a0c78[_0xc42e('0x3c')]),_0x456342);if(_0xb6f000[_0xc42e('0x3a')][_0xc42e('0x46')]){_0x26a223[_0xc42e('0x47')]=_[_0xc42e('0x48')](_0x26a223[_0xc42e('0x47')],{'$or':_[_0xc42e('0x34')](_0x456342,function(_0x494312){if(_0x494312[_0xc42e('0x38')]!=='VIRTUAL'){var _0x3bd535={};_0x3bd535[_0x494312[_0xc42e('0x33')]]={'$like':'%'+_0xb6f000['query'][_0xc42e('0x46')]+'%'};return _0x3bd535;}})});}_0x26a223=_[_0xc42e('0x48')]({},_0x26a223,_0xb6f000[_0xc42e('0x49')]);var _0xd5b96f={'where':_0x26a223[_0xc42e('0x47')]};return db[_0xc42e('0x35')][_0xc42e('0x2e')](_0xd5b96f)['then'](function(_0x3643d8){_0x2f94dd[_0xc42e('0x2e')]=_0x3643d8;if(_0xb6f000['query'][_0xc42e('0x4a')]){_0x26a223['include']=[{'all':!![]}];}return db[_0xc42e('0x35')][_0xc42e('0x4b')](_0x26a223);})['then'](function(_0x3c0b08){_0x2f94dd[_0xc42e('0x4c')]=_0x3c0b08;return _0x2f94dd;})['then'](respondWithFilteredResult(_0x30b739,_0x26a223))[_0xc42e('0x4d')](handleError(_0x30b739,null));};exports[_0xc42e('0x4e')]=function(_0x8a859c,_0x374fb8){var _0x4ec4f5={'raw':!![],'where':{'id':_0x8a859c[_0xc42e('0x4f')]['id']}},_0xb1d1d1={};_0xb1d1d1[_0xc42e('0x3d')]=_[_0xc42e('0x3b')](db[_0xc42e('0x35')][_0xc42e('0x36')]);_0xb1d1d1[_0xc42e('0x3a')]=_['keys'](_0x8a859c[_0xc42e('0x3a')]);_0xb1d1d1[_0xc42e('0x3c')]=_[_0xc42e('0x3f')](_0xb1d1d1[_0xc42e('0x3d')],_0xb1d1d1['query']);_0x4ec4f5[_0xc42e('0x3e')]=_[_0xc42e('0x3f')](_0xb1d1d1[_0xc42e('0x3d')],qs[_0xc42e('0x40')](_0x8a859c[_0xc42e('0x3a')][_0xc42e('0x40')]));_0x4ec4f5[_0xc42e('0x3e')]=_0x4ec4f5['attributes'][_0xc42e('0x41')]?_0x4ec4f5[_0xc42e('0x3e')]:_0xb1d1d1[_0xc42e('0x3d')];if(_0x8a859c[_0xc42e('0x3a')]['includeAll']){_0x4ec4f5[_0xc42e('0x50')]=[{'all':!![]}];}_0x4ec4f5=_[_0xc42e('0x48')]({},_0x4ec4f5,_0x8a859c[_0xc42e('0x49')]);return db[_0xc42e('0x35')][_0xc42e('0x51')](_0x4ec4f5)[_0xc42e('0x20')](handleEntityNotFound(_0x374fb8,null))['then'](respondWithResult(_0x374fb8,null))[_0xc42e('0x4d')](handleError(_0x374fb8,null));};exports['create']=function(_0x75fa09,_0x4c59a7){return db[_0xc42e('0x35')]['create'](_0x75fa09[_0xc42e('0x52')],{})[_0xc42e('0x20')](respondWithResult(_0x4c59a7,0xc9))[_0xc42e('0x4d')](handleError(_0x4c59a7,null));};exports[_0xc42e('0x53')]=function(_0xf76d02,_0x541b94){if(_0xf76d02[_0xc42e('0x52')]['id']){delete _0xf76d02['body']['id'];}return db[_0xc42e('0x35')][_0xc42e('0x51')]({'where':{'id':_0xf76d02[_0xc42e('0x4f')]['id']}})[_0xc42e('0x20')](handleEntityNotFound(_0x541b94,null))[_0xc42e('0x20')](saveUpdates(_0xf76d02[_0xc42e('0x52')],null))[_0xc42e('0x20')](respondWithResult(_0x541b94,null))['catch'](handleError(_0x541b94,null));};exports[_0xc42e('0x54')]=function(_0x1bd70e,_0x3fd866){return db[_0xc42e('0x35')][_0xc42e('0x51')]({'where':{'id':_0x1bd70e['params']['id']}})[_0xc42e('0x20')](handleEntityNotFound(_0x3fd866,null))[_0xc42e('0x20')](removeEntity(_0x3fd866,null))[_0xc42e('0x4d')](handleError(_0x3fd866,null));};exports[_0xc42e('0x55')]=function(_0x238f65,_0x1b6d19){return db[_0xc42e('0x35')]['describe']()[_0xc42e('0x20')](respondWithResult(_0x1b6d19,null))['catch'](handleError(_0x1b6d19,null));};var interaction_log=require(_0xc42e('0x13'))(_0xc42e('0x56'));exports['accept']=function(_0x3de241,_0x59bc08,_0x4a1839){var _0x1e72b4={'agent':{},'channel':_0xc42e('0x57')};if(_0x3de241[_0xc42e('0x52')]['id']){delete _0x3de241['body']['id'];}_0x3de241[_0xc42e('0x52')][_0xc42e('0x58')]=!![];_0x3de241[_0xc42e('0x52')][_0xc42e('0x59')]=moment()['format'](_0xc42e('0x5a'));_0x3de241['body'][_0xc42e('0x5b')]=_0x3de241[_0xc42e('0x52')][_0xc42e('0x5b')]||_0x3de241[_0xc42e('0x5c')]['id'];_0x1e72b4['agent']['id']=_0x3de241[_0xc42e('0x52')][_0xc42e('0x5b')];return db[_0xc42e('0x35')][_0xc42e('0x51')]({'where':{'id':_0x3de241['params']['id'],'UserId':null}})[_0xc42e('0x20')](handleEntityNotFound(_0x59bc08,null))[_0xc42e('0x20')](saveUpdates(_0x3de241['body'],null))[_0xc42e('0x20')](function(_0x8f659){if(_0x8f659){_0x1e72b4[_0xc42e('0x26')]=_0x8f659[_0xc42e('0x5d')]({'plain':!![]});return db['OpenchannelInteraction'][_0xc42e('0x51')]({'where':{'id':_0x8f659[_0xc42e('0x5e')]}});}return null;})[_0xc42e('0x20')](handleEntityNotFound(_0x59bc08,null))['then'](function(_0x7c4e7){if(_0x7c4e7){return _0x7c4e7[_0xc42e('0x53')]({'UserId':_0x3de241[_0xc42e('0x52')][_0xc42e('0x5b')],'read1stAt':_['isNil'](_0x7c4e7[_0xc42e('0x5f')])?moment()[_0xc42e('0x60')](_0xc42e('0x5a')):undefined});}return null;})[_0xc42e('0x20')](function(_0x2793e6){if(_0x2793e6){_0x1e72b4['interaction']=_0x2793e6['get']({'plain':!![]});interaction_log[_0xc42e('0x21')](_0xc42e('0x61'),_0x3de241['user']['id'],_0x3de241['user'][_0xc42e('0x33')],_0x3de241[_0xc42e('0x5c')]['role'],_0x1e72b4['interaction']['id'],_0x3de241[_0xc42e('0x52')]?JSON[_0xc42e('0x24')](_0x3de241[_0xc42e('0x52')]):_0xc42e('0x62'));return respondWithRpcPromise('AcceptMessage',_0xc42e('0x63'),_0x1e72b4);}return null;})[_0xc42e('0x20')](function(_0x4b22b1){var _0x9765ed=_0xc42e('0x64')+_0x4b22b1[_0xc42e('0x26')][_0xc42e('0x65')];return db[_0xc42e('0x66')]['query'](_0x9765ed,{'type':db[_0xc42e('0x67')][_0xc42e('0x68')][_0xc42e('0x69')],'raw':!![]})[_0xc42e('0x20')](function(_0x441206){return _0x441206;});})[_0xc42e('0x20')](function(_0x19a6d4){if(_0x19a6d4){_0x1e72b4[_0xc42e('0x26')][_0xc42e('0x6a')]=_0x19a6d4[0x0];if(!_0x3de241[_0xc42e('0x52')]['UserId'])return;return db[_0xc42e('0x6b')][_0xc42e('0x51')]({'where':{'id':_0x3de241[_0xc42e('0x52')]['UserId'],'role':_0xc42e('0x6c')},'attributes':['id',_0xc42e('0x33'),_0xc42e('0x6d'),_0xc42e('0x6e'),_0xc42e('0x6f')],'raw':!![]});}return null;})[_0xc42e('0x20')](function(_0x3c8f7c){if(!_0x3c8f7c)return null;_0x1e72b4[_0xc42e('0x26')][_0xc42e('0x6c')]=_0x3c8f7c;return _0x1e72b4;})[_0xc42e('0x20')](function(_0x5b8b76){if(_0x5b8b76){if(_0x3de241[_0xc42e('0x52')][_0xc42e('0x70')]){_0x1e72b4['message'][_0xc42e('0x71')]=util[_0xc42e('0x60')](_0xc42e('0x72'),_0x3de241[_0xc42e('0x5c')]['name']);_0x1e72b4['message'][_0xc42e('0x73')]=_0x1e72b4[_0xc42e('0x73')];_0x1e72b4[_0xc42e('0x26')]['motionChannel']=_0x1e72b4[_0xc42e('0x73')];_0x1e72b4['message'][_0xc42e('0x74')]='accept';return respondWithRpcPromise(_0xc42e('0x75'),_0xc42e('0x75'),{'event':'acceptmessage','message':_0x1e72b4['message']},client9002)[_0xc42e('0x20')](function(){return _0x1e72b4;});}return _0x1e72b4;}return null;})[_0xc42e('0x20')](respondWithResult(_0x59bc08,null))[_0xc42e('0x4d')](handleError(_0x59bc08,null));};var interaction_log=require(_0xc42e('0x13'))(_0xc42e('0x56'));exports[_0xc42e('0x76')]=function(_0x56d536,_0x4d9e30,_0x5425dc){var _0x31fc2d={'agent':{},'channel':'openchannel'};if(_0x56d536['body']['id']){delete _0x56d536['body']['id'];}_0x56d536['body'][_0xc42e('0x5b')]=_0x56d536[_0xc42e('0x52')][_0xc42e('0x5b')]||_0x56d536[_0xc42e('0x5c')]['id'];_0x31fc2d[_0xc42e('0x6c')]['id']=_0x56d536[_0xc42e('0x52')][_0xc42e('0x5b')];return db[_0xc42e('0x35')]['find']({'where':{'id':_0x56d536[_0xc42e('0x4f')]['id'],'UserId':null}})[_0xc42e('0x20')](handleEntityNotFound(_0x4d9e30,null))[_0xc42e('0x20')](function(_0x85543b){if(_0x85543b){_0x31fc2d['message']=_0x85543b[_0xc42e('0x5d')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x85543b[_0xc42e('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x4d9e30,null))[_0xc42e('0x20')](function(_0x5b9c30){if(_0x5b9c30){_0x31fc2d[_0xc42e('0x77')]=_0x5b9c30['get']({'plain':!![]});interaction_log[_0xc42e('0x21')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x56d536[_0xc42e('0x5c')]['id'],_0x56d536['user'][_0xc42e('0x33')],_0x56d536['user']['role'],_0x31fc2d['interaction']['id'],_0x56d536[_0xc42e('0x52')]?JSON[_0xc42e('0x24')](_0x56d536[_0xc42e('0x52')]):_0xc42e('0x62'));return respondWithRpcPromise(_0xc42e('0x78'),_0xc42e('0x79'),_0x31fc2d);}return null;})[_0xc42e('0x20')](function(_0x325b7b){var _0x1c7076='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x325b7b[_0xc42e('0x26')][_0xc42e('0x65')];return db['sequelize']['query'](_0x1c7076,{'type':db[_0xc42e('0x67')]['QueryTypes'][_0xc42e('0x69')],'raw':!![]})[_0xc42e('0x20')](function(_0x4868ef){return _0x4868ef;});})[_0xc42e('0x20')](function(_0x793f3){if(_0x793f3){_0x31fc2d[_0xc42e('0x26')]['contact']=_0x793f3[0x0];if(!_0x56d536['body'][_0xc42e('0x5b')])return;return db[_0xc42e('0x6b')][_0xc42e('0x51')]({'where':{'id':_0x56d536[_0xc42e('0x52')]['UserId'],'role':_0xc42e('0x6c')},'attributes':['id',_0xc42e('0x33'),'fullname',_0xc42e('0x6e'),'internal'],'raw':!![]});}return null;})[_0xc42e('0x20')](function(_0x5c765e){if(!_0x5c765e)return null;_0x31fc2d['message'][_0xc42e('0x6c')]=_0x5c765e;return _0x31fc2d;})[_0xc42e('0x20')](function(_0x2932a2){if(_0x2932a2){_0x2932a2[_0xc42e('0x26')][_0xc42e('0x71')]=util['format'](_0xc42e('0x72'),_0x56d536[_0xc42e('0x5c')][_0xc42e('0x33')]);_0x2932a2[_0xc42e('0x26')]['channel']=_0x31fc2d[_0xc42e('0x73')];_0x2932a2[_0xc42e('0x26')][_0xc42e('0x7a')]=_0x31fc2d[_0xc42e('0x73')];_0x2932a2[_0xc42e('0x26')][_0xc42e('0x74')]=_0xc42e('0x76');respondWithRpcPromise('EventManager',_0xc42e('0x75'),{'event':'rejectmessage','message':_0x2932a2['message']},client9002);return _0x31fc2d;}return null;})[_0xc42e('0x20')](respondWithResult(_0x4d9e30,null))[_0xc42e('0x4d')](handleError(_0x4d9e30,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 0448120..e87369a 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 _0x9c16=['OpenchannelMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x5da704,_0x48e72d){var _0x414961=function(_0x154eb7){while(--_0x154eb7){_0x5da704['push'](_0x5da704['shift']());}};_0x414961(++_0x48e72d);}(_0x9c16,0x15e));var _0x69c1=function(_0x1e90f4,_0x4e2e1b){_0x1e90f4=_0x1e90f4-0x0;var _0x4c2f01=_0x9c16[_0x1e90f4];return _0x4c2f01;};'use strict';var EventEmitter=require(_0x69c1('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x69c1('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x69c1('0x2')](0x0);var events={'afterCreate':_0x69c1('0x3'),'afterUpdate':_0x69c1('0x4'),'afterDestroy':'remove'};function emitEvent(_0xc41a60){return function(_0x4d5176,_0x4b545e,_0x319e73){OpenchannelMessageEvents[_0x69c1('0x5')](_0xc41a60+':'+_0x4d5176['id'],_0x4d5176);OpenchannelMessageEvents[_0x69c1('0x5')](_0xc41a60,_0x4d5176);_0x319e73(null);};}for(var e in events){if(events[_0x69c1('0x6')](e)){var event=events[e];OpenchannelMessage[_0x69c1('0x7')](e,emitEvent(event));}}module[_0x69c1('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x1b3e=['remove','emit','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0x1b3e,0x1a2));var _0xe1b3=function(_0x3229fd,_0x64074f){_0x3229fd=_0x3229fd-0x0;var _0x312d75=_0x1b3e[_0x3229fd];return _0x312d75;};'use strict';var EventEmitter=require(_0xe1b3('0x0'));var OpenchannelMessage=require(_0xe1b3('0x1'))['db'][_0xe1b3('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xe1b3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe1b3('0x4'),'afterDestroy':_0xe1b3('0x5')};function emitEvent(_0x1c024b){return function(_0x47fd0c,_0x3e80fe,_0x45aa06){OpenchannelMessageEvents[_0xe1b3('0x6')](_0x1c024b+':'+_0x47fd0c['id'],_0x47fd0c);OpenchannelMessageEvents[_0xe1b3('0x6')](_0x1c024b,_0x47fd0c);_0x45aa06(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xe1b3('0x7')](e,emitEvent(event));}}module[_0xe1b3('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index b1d94df..9bc9a89 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 _0x88f1=['error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','Contact','POST','method','GET','body','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','define','fti_openchannel_messages','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','OpenchannelInteraction','findOne','then','createdAt','catch'];(function(_0x333752,_0x11b776){var _0x2c3de5=function(_0x2cc0fb){while(--_0x2cc0fb){_0x333752['push'](_0x333752['shift']());}};_0x2c3de5(++_0x11b776);}(_0x88f1,0xb7));var _0x188f=function(_0x144d53,_0x3f52ab){_0x144d53=_0x144d53-0x0;var _0x2664a3=_0x88f1[_0x144d53];return _0x2664a3;};'use strict';var _=require(_0x188f('0x0'));var util=require(_0x188f('0x1'));var logger=require(_0x188f('0x2'))(_0x188f('0x3'));var moment=require('moment');var BPromise=require(_0x188f('0x4'));var rp=require(_0x188f('0x5'));var fs=require('fs');var path=require(_0x188f('0x6'));var rimraf=require('rimraf');var config=require(_0x188f('0x7'));var attributes=require(_0x188f('0x8'));module['exports']=function(_0x2c96f4,_0x2888c3){return _0x2c96f4[_0x188f('0x9')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x188f('0xa'),'fields':['body'],'type':_0x188f('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e8778,_0x4f5c7c,_0x3daa04){var _0x3b8e62=_0x2c96f4[_0x188f('0xc')];var _0x1822f6=_0x3e8778[_0x188f('0xd')]({'plain':!![]});if(_0x1822f6['direction'][_0x188f('0xe')]()==='in'||_0x1822f6[_0x188f('0xf')][_0x188f('0xe')]()===_0x188f('0x10')&&!_0x1822f6[_0x188f('0x11')]&&!_[_0x188f('0x12')](_0x1822f6[_0x188f('0x13')])){_0x3b8e62[_0x188f('0x14')][_0x188f('0x15')]({'where':{'id':_0x1822f6['OpenchannelInteractionId']}})[_0x188f('0x16')](function(_0x4aec37){if(_0x4aec37){_0x4aec37['update']({'lastMsgAt':_0x1822f6[_0x188f('0x17')],'lastMsgDirection':_0x1822f6[_0x188f('0xf')]['toLowerCase']()});}})[_0x188f('0x18')](function(_0x3d30c9){console[_0x188f('0x19')](_0x3d30c9);});}if(_0x1822f6[_0x188f('0xf')]===_0x188f('0x10')&&!_0x1822f6[_0x188f('0x11')]){var _0x36a677;_0x3b8e62[_0x188f('0x1a')][_0x188f('0x1b')]()[_0x188f('0x16')](function(_0x24bd34){return _0x3b8e62[_0x188f('0x1c')][_0x188f('0x1d')]({'where':{'id':_0x1822f6[_0x188f('0x1e')]},'include':[{'model':_0x3b8e62[_0x188f('0x14')],'as':_0x188f('0x1f'),'where':{'id':_0x1822f6['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x3b8e62[_0x188f('0x1a')],'as':'Contact','attributes':_[_0x188f('0x20')](_0x24bd34)}]}]});})[_0x188f('0x16')](function(_0x550e17){_0x36a677=_0x550e17[_0x188f('0xd')]({'plain':!![]});if(_0x36a677&&_0x36a677[_0x188f('0x21')]){logger['info'](_0x188f('0x22'),'afterCreate',util['format'](_0x188f('0x23'),_0x1822f6['id'],_0x36a677[_0x188f('0x21')]));if(_0x36a677[_0x188f('0x1f')]&&_0x36a677[_0x188f('0x1f')]['length']){_0x1822f6[_0x188f('0x24')]=_[_0x188f('0x25')](_0x36a677['Interactions'][0x0],_0x188f('0x26'));_0x1822f6[_0x188f('0x26')]=_0x36a677[_0x188f('0x1f')][0x0][_0x188f('0x26')];}var _0x4f5c7c={'method':_0x188f('0x27'),'uri':encodeURI(_0x36a677['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4f5c7c[_0x188f('0x28')]){case _0x188f('0x29'):_0x4f5c7c['qs']=_0x1822f6;break;case _0x188f('0x27'):_0x4f5c7c[_0x188f('0x2a')]=_0x1822f6;break;}return rp(_0x4f5c7c)[_0x188f('0x16')](function(_0x5d171b){logger['info'](_0x188f('0x22'),'afterCreate',util[_0x188f('0x2b')](_0x188f('0x2c'),_0x1822f6['id'],_0x36a677[_0x188f('0x21')]));if(_0x5d171b[_0x188f('0x2a')][_0x188f('0x2d')]&&_0x5d171b['body'][_0x188f('0x2d')]!=_0x1822f6[_0x188f('0x24')][_0x188f('0x2d')]){return _0x3b8e62[_0x188f('0x14')][_0x188f('0x2e')]({'threadId':_0x5d171b[_0x188f('0x2a')][_0x188f('0x2d')]},{'where':{'id':_0x1822f6['Interaction']['id']}});}else{return;}})['then'](function(){return _0x3e8778[_0x188f('0x2e')]({'read':!![]});})[_0x188f('0x18')](function(_0x19eedd){logger[_0x188f('0x19')]('OpenchannelMessage,\x20%s,\x20%s',_0x188f('0x2f'),util[_0x188f('0x30')](_0x19eedd,{'showHidden':![],'depth':null}));_0x3daa04();});}else{_0x3daa04();}})[_0x188f('0x31')](function(){_0x3daa04();});}else{_0x3daa04();}}},'charset':_0x188f('0x32'),'collate':_0x188f('0x33')});}; \ No newline at end of file +var _0x66c0=['replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','GET','POST','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','inspect','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','toLowerCase','direction','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','error','CmContact','OpenchannelAccount','OpenchannelAccountId','Interactions','Contact','keys'];(function(_0x1ddfd2,_0xdbf3e1){var _0x56aa0e=function(_0x1de7e3){while(--_0x1de7e3){_0x1ddfd2['push'](_0x1ddfd2['shift']());}};_0x56aa0e(++_0xdbf3e1);}(_0x66c0,0x75));var _0x066c=function(_0x432aa8,_0x1a421d){_0x432aa8=_0x432aa8-0x0;var _0x570261=_0x66c0[_0x432aa8];return _0x570261;};'use strict';var _=require(_0x066c('0x0'));var util=require(_0x066c('0x1'));var logger=require(_0x066c('0x2'))('api');var moment=require(_0x066c('0x3'));var BPromise=require(_0x066c('0x4'));var rp=require(_0x066c('0x5'));var fs=require('fs');var path=require(_0x066c('0x6'));var rimraf=require(_0x066c('0x7'));var config=require(_0x066c('0x8'));var attributes=require('./openchannelMessage.attributes');module[_0x066c('0x9')]=function(_0x45b78c,_0xf97faa){return _0x45b78c[_0x066c('0xa')](_0x066c('0xb'),attributes,{'tableName':_0x066c('0xc'),'paranoid':![],'indexes':[{'name':_0x066c('0xd'),'fields':[_0x066c('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x20f9be,_0x157277,_0x409688){var _0x1f7738=_0x45b78c['models'];var _0x3a64ae=_0x20f9be['get']({'plain':!![]});if(_0x3a64ae['direction'][_0x066c('0xf')]()==='in'||_0x3a64ae[_0x066c('0x10')][_0x066c('0xf')]()===_0x066c('0x11')&&!_0x3a64ae[_0x066c('0x12')]&&!_[_0x066c('0x13')](_0x3a64ae[_0x066c('0x14')])){_0x1f7738[_0x066c('0x15')]['findOne']({'where':{'id':_0x3a64ae[_0x066c('0x16')]}})[_0x066c('0x17')](function(_0x1577e1){if(_0x1577e1){_0x1577e1[_0x066c('0x18')]({'lastMsgAt':_0x3a64ae[_0x066c('0x19')],'lastMsgDirection':_0x3a64ae[_0x066c('0x10')]['toLowerCase']()});}})['catch'](function(_0x533c05){console[_0x066c('0x1a')](_0x533c05);});}if(_0x3a64ae[_0x066c('0x10')]==='out'&&!_0x3a64ae[_0x066c('0x12')]){var _0x211f15;_0x1f7738[_0x066c('0x1b')]['describe']()['then'](function(_0x48a229){return _0x1f7738[_0x066c('0x1c')]['find']({'where':{'id':_0x3a64ae[_0x066c('0x1d')]},'include':[{'model':_0x1f7738[_0x066c('0x15')],'as':_0x066c('0x1e'),'where':{'id':_0x3a64ae['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x1f7738[_0x066c('0x1b')],'as':_0x066c('0x1f'),'attributes':_[_0x066c('0x20')](_0x48a229)}]}]});})[_0x066c('0x17')](function(_0x54e365){_0x211f15=_0x54e365['get']({'plain':!![]});if(_0x211f15&&_0x211f15[_0x066c('0x21')]){logger[_0x066c('0x22')](_0x066c('0x23'),_0x066c('0x24'),util['format'](_0x066c('0x25'),_0x3a64ae['id'],_0x211f15[_0x066c('0x21')]));if(_0x211f15[_0x066c('0x1e')]&&_0x211f15[_0x066c('0x1e')][_0x066c('0x26')]){_0x3a64ae[_0x066c('0x27')]=_[_0x066c('0x28')](_0x211f15[_0x066c('0x1e')][0x0],_0x066c('0x1f'));_0x3a64ae[_0x066c('0x1f')]=_0x211f15[_0x066c('0x1e')][0x0][_0x066c('0x1f')];}var _0x157277={'method':'POST','uri':encodeURI(_0x211f15[_0x066c('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x157277[_0x066c('0x29')]){case _0x066c('0x2a'):_0x157277['qs']=_0x3a64ae;break;case _0x066c('0x2b'):_0x157277[_0x066c('0xe')]=_0x3a64ae;break;}return rp(_0x157277)[_0x066c('0x17')](function(_0x2de587){logger[_0x066c('0x22')](_0x066c('0x23'),_0x066c('0x24'),util[_0x066c('0x2c')](_0x066c('0x2d'),_0x3a64ae['id'],_0x211f15['replyUri']));if(_0x2de587[_0x066c('0xe')]['threadId']&&_0x2de587['body']['threadId']!=_0x3a64ae[_0x066c('0x27')][_0x066c('0x2e')]){return _0x1f7738['OpenchannelInteraction']['update']({'threadId':_0x2de587[_0x066c('0xe')][_0x066c('0x2e')]},{'where':{'id':_0x3a64ae[_0x066c('0x27')]['id']}});}else{return;}})['then'](function(){return _0x20f9be[_0x066c('0x18')]({'read':!![]});})[_0x066c('0x2f')](function(_0x59c3e0){logger[_0x066c('0x1a')](_0x066c('0x23'),'afterCreate',util[_0x066c('0x30')](_0x59c3e0,{'showHidden':![],'depth':null}));_0x409688();});}else{_0x409688();}})['finally'](function(){_0x409688();});}else{_0x409688();}}},'charset':_0x066c('0x31'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 7ab016c..2e9021b 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x478de7,_0x319ab7){var _0x10fb93=function(_0x2ab5c1){while(--_0x2ab5c1){_0x478de7['push'](_0x478de7['shift']());}};_0x10fb93(++_0x319ab7);}(_0x1261,0x144));var _0x1126=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x1261[_0x4aba15];return _0x1c8122;};'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});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x446aff,_0x46563a){var _0x4701df=function(_0x3368ae){while(--_0x3368ae){_0x446aff['push'](_0x446aff['shift']());}};_0x4701df(++_0x46563a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 8131bdc..583b199 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 _0xfdbd=['removeListener','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit'];(function(_0x23c2c3,_0x27ecc8){var _0x41e09f=function(_0x5e6873){while(--_0x5e6873){_0x23c2c3['push'](_0x23c2c3['shift']());}};_0x41e09f(++_0x27ecc8);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0xfdbd[_0x237f8b];return _0x423f94;};'use strict';var OpenchannelMessageEvents=require(_0xdfdb('0x0'));var events=[_0xdfdb('0x1'),_0xdfdb('0x2'),_0xdfdb('0x3')];function createListener(_0x28f05d,_0x3078f0){return function(_0x11218a){_0x3078f0[_0xdfdb('0x4')](_0x28f05d,_0x11218a);};}function removeListener(_0x330ad3,_0x5945e0){return function(){OpenchannelMessageEvents[_0xdfdb('0x5')](_0x330ad3,_0x5945e0);};}exports['register']=function(_0x453ef6){for(var _0x41bd5e=0x0,_0x489f19=events['length'];_0x41bd5e<_0x489f19;_0x41bd5e++){var _0x590b5d=events[_0x41bd5e];var _0x188508=createListener(_0xdfdb('0x6')+_0x590b5d,_0x453ef6);OpenchannelMessageEvents['on'](_0x590b5d,_0x188508);}}; \ No newline at end of file +var _0x9aef=['save','remove','update','emit','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9aef,0xfc));var _0xf9ae=function(_0x207c32,_0x2a179f){_0x207c32=_0x207c32-0x0;var _0x24ad34=_0x9aef[_0x207c32];return _0x24ad34;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xf9ae('0x0'),_0xf9ae('0x1'),_0xf9ae('0x2')];function createListener(_0x3475ea,_0x22fe1c){return function(_0x466ae1){_0x22fe1c[_0xf9ae('0x3')](_0x3475ea,_0x466ae1);};}function removeListener(_0x4f1050,_0x37647f){return function(){OpenchannelMessageEvents['removeListener'](_0x4f1050,_0x37647f);};}exports[_0xf9ae('0x4')]=function(_0x12fee1){for(var _0x57c986=0x0,_0x42e2a9=events[_0xf9ae('0x5')];_0x57c986<_0x42e2a9;_0x57c986++){var _0xc29d03=events[_0x57c986];var _0x56541a=createListener('openchannelMessage:'+_0xc29d03,_0x12fee1);OpenchannelMessageEvents['on'](_0xc29d03,_0x56541a);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 2b293fa..c59e370 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 _0x9a32=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','update','delete','destroy','removeTeams','removeAgents'];(function(_0x32fa8b,_0x330d88){var _0xc81a43=function(_0x391c91){while(--_0x391c91){_0x32fa8b['push'](_0x32fa8b['shift']());}};_0xc81a43(++_0x330d88);}(_0x9a32,0x197));var _0x29a3=function(_0x1f25ec,_0x34020b){_0x1f25ec=_0x1f25ec-0x0;var _0x581f50=_0x9a32[_0x1f25ec];return _0x581f50;};'use strict';var multer=require(_0x29a3('0x0'));var util=require(_0x29a3('0x1'));var path=require(_0x29a3('0x2'));var timeout=require(_0x29a3('0x3'));var express=require(_0x29a3('0x4'));var router=express[_0x29a3('0x5')]();var fs_extra=require(_0x29a3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x29a3('0x7'));var config=require('../../config/environment');var controller=require(_0x29a3('0x8'));router[_0x29a3('0x9')]('/',auth[_0x29a3('0xa')](),controller[_0x29a3('0xb')]);router[_0x29a3('0x9')]('/describe',auth[_0x29a3('0xa')](),controller[_0x29a3('0xc')]);router[_0x29a3('0x9')](_0x29a3('0xd'),auth[_0x29a3('0xa')](),controller['show']);router[_0x29a3('0x9')](_0x29a3('0xe'),auth[_0x29a3('0xa')](),controller[_0x29a3('0xf')]);router[_0x29a3('0x9')](_0x29a3('0x10'),auth[_0x29a3('0xa')](),controller[_0x29a3('0x11')]);router[_0x29a3('0x9')](_0x29a3('0x12'),auth[_0x29a3('0xa')](),controller[_0x29a3('0x13')]);router[_0x29a3('0x14')]('/',auth[_0x29a3('0xa')](),controller['create']);router[_0x29a3('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x29a3('0x15')]);router['post'](_0x29a3('0x12'),auth[_0x29a3('0xa')](),controller['addAgents']);router[_0x29a3('0x16')](_0x29a3('0xd'),auth['isAuthenticated'](),controller[_0x29a3('0x17')]);router[_0x29a3('0x18')](_0x29a3('0xd'),auth[_0x29a3('0xa')](),controller[_0x29a3('0x19')]);router[_0x29a3('0x18')](_0x29a3('0x10'),auth[_0x29a3('0xa')](),controller[_0x29a3('0x1a')]);router[_0x29a3('0x18')]('/:id/users',auth[_0x29a3('0xa')](),controller[_0x29a3('0x1b')]);module[_0x29a3('0x1c')]=router; \ No newline at end of file +var _0xfbe0=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer'];(function(_0x7f677f,_0x5f2c1c){var _0x5acea1=function(_0x21e95e){while(--_0x21e95e){_0x7f677f['push'](_0x7f677f['shift']());}};_0x5acea1(++_0x5f2c1c);}(_0xfbe0,0x10d));var _0x0fbe=function(_0x4c8a84,_0x2e8b97){_0x4c8a84=_0x4c8a84-0x0;var _0x35aa97=_0xfbe0[_0x4c8a84];return _0x35aa97;};'use strict';var multer=require(_0x0fbe('0x0'));var util=require('util');var path=require(_0x0fbe('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0fbe('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0fbe('0x3'));var interaction=require(_0x0fbe('0x4'));var config=require(_0x0fbe('0x5'));var controller=require(_0x0fbe('0x6'));router[_0x0fbe('0x7')]('/',auth[_0x0fbe('0x8')](),controller[_0x0fbe('0x9')]);router[_0x0fbe('0x7')](_0x0fbe('0xa'),auth[_0x0fbe('0x8')](),controller[_0x0fbe('0xb')]);router[_0x0fbe('0x7')](_0x0fbe('0xc'),auth[_0x0fbe('0x8')](),controller[_0x0fbe('0xd')]);router[_0x0fbe('0x7')]('/:id/members',auth[_0x0fbe('0x8')](),controller['getMembers']);router['get'](_0x0fbe('0xe'),auth[_0x0fbe('0x8')](),controller[_0x0fbe('0xf')]);router[_0x0fbe('0x7')](_0x0fbe('0x10'),auth[_0x0fbe('0x8')](),controller[_0x0fbe('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0fbe('0x12')]);router['post'](_0x0fbe('0xe'),auth[_0x0fbe('0x8')](),controller['addTeams']);router[_0x0fbe('0x13')](_0x0fbe('0x10'),auth[_0x0fbe('0x8')](),controller[_0x0fbe('0x14')]);router[_0x0fbe('0x15')]('/:id',auth[_0x0fbe('0x8')](),controller[_0x0fbe('0x16')]);router[_0x0fbe('0x17')](_0x0fbe('0xc'),auth[_0x0fbe('0x8')](),controller['destroy']);router['delete'](_0x0fbe('0xe'),auth[_0x0fbe('0x8')](),controller[_0x0fbe('0x18')]);router[_0x0fbe('0x17')](_0x0fbe('0x10'),auth[_0x0fbe('0x8')](),controller[_0x0fbe('0x19')]);module[_0x0fbe('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 1da0cdf..ff7a460 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 _0x5afa=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5afa,0x8e));var _0xa5af=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x5afa[_0x2bf141];return _0x48277b;};'use strict';var Sequelize=require(_0xa5af('0x0'));module[_0xa5af('0x1')]={'name':{'type':Sequelize[_0xa5af('0x2')],'unique':_0xa5af('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa5af('0x2')]},'timeout':{'type':Sequelize[_0xa5af('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa5af('0x5')](_0xa5af('0x6'),'beepall',_0xa5af('0x7'))}}; \ No newline at end of file +var _0x71cf=['beepall','roundrobin','sequelize','name'];(function(_0x204299,_0x14ccf5){var _0x4852a3=function(_0xca2c96){while(--_0xca2c96){_0x204299['push'](_0x204299['shift']());}};_0x4852a3(++_0x14ccf5);}(_0x71cf,0x12e));var _0xf71c=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0x71cf[_0x183b97];return _0x629cf7;};'use strict';var Sequelize=require(_0xf71c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xf71c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xf71c('0x2'),_0xf71c('0x3'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 0d17c99..aaf0142 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 _0x5db3=['../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range','update','then','destroy','get','end','error','stack','name','send','map','OpenchannelQueue','rawAttributes','fieldName','getOptions','where','include','findAll','rows','show','params','keys','filters','model','query','intersection','fields','attributes','length','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelQueues','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','sort','pick','OpenchannelQueueId','filter','merge','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','order','addTeams','online','voicePause','Agents','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','addAgents','isArray','getAgents','bluebird','util','lodash','squel','ioredis'];(function(_0x1e93c9,_0x2f85b0){var _0x346a87=function(_0x2fd2a3){while(--_0x2fd2a3){_0x1e93c9['push'](_0x1e93c9['shift']());}};_0x346a87(++_0x2f85b0);}(_0x5db3,0x15a));var _0x35db=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x5db3[_0x1d24eb];return _0x1dc576;};'use strict';var BPromise=require(_0x35db('0x0'));var util=require(_0x35db('0x1'));var _=require(_0x35db('0x2'));var squel=require(_0x35db('0x3'));var Redis=require(_0x35db('0x4'));var qs=require(_0x35db('0x5'));var logger=require(_0x35db('0x6'))(_0x35db('0x7'));var config=require(_0x35db('0x8'));var db=require(_0x35db('0x9'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x35db('0xa'),'port':0x18eb});var socket=require(_0x35db('0xb'))(new Redis(config[_0x35db('0xc')]));require('./openchannelQueue.socket')[_0x35db('0xd')](socket);function respondWithStatusCode(_0x34c4a2,_0x1a1661){_0x1a1661=_0x1a1661||0xcc;return function(_0x2e5368){if(_0x2e5368){return _0x34c4a2[_0x35db('0xe')](_0x1a1661);}return _0x34c4a2[_0x35db('0xf')](_0x1a1661)['end']();};}function respondWithResult(_0x2262a8,_0x337fa8){_0x337fa8=_0x337fa8||0xc8;return function(_0x57ceb0){if(_0x57ceb0){return _0x2262a8[_0x35db('0xf')](_0x337fa8)[_0x35db('0x10')](_0x57ceb0);}};}function respondWithFilteredResult(_0x1070af,_0x5dd988){return function(_0x2d400e){if(_0x2d400e){var _0x346181=typeof _0x5dd988[_0x35db('0x11')]==='undefined'&&typeof _0x5dd988[_0x35db('0x12')]===_0x35db('0x13');var _0x47f3c0=_0x2d400e[_0x35db('0x14')];var _0x1107a6=_0x346181?0x0:_0x5dd988[_0x35db('0x11')];var _0x333988=_0x346181?_0x2d400e[_0x35db('0x14')]:_0x5dd988[_0x35db('0x11')]+_0x5dd988['limit'];var _0x6e2163;if(_0x333988>=_0x47f3c0){_0x333988=_0x47f3c0;_0x6e2163=0xc8;}else{_0x6e2163=0xce;}_0x1070af[_0x35db('0xf')](_0x6e2163);return _0x1070af['set'](_0x35db('0x15'),_0x1107a6+'-'+_0x333988+'/'+_0x47f3c0)[_0x35db('0x10')](_0x2d400e);}return null;};}function saveUpdates(_0x49c16a){return function(_0x367294){if(_0x367294){return _0x367294[_0x35db('0x16')](_0x49c16a)[_0x35db('0x17')](function(_0x38b5ab){return _0x38b5ab;});}return null;};}function removeEntity(_0x500717){return function(_0x88e28d){if(_0x88e28d){return _0x88e28d[_0x35db('0x18')]()[_0x35db('0x17')](function(){var _0x19ac8e=_0x88e28d[_0x35db('0x19')]({'plain':!![]});var _0x40b88d='OpenchannelQueues';return db['UserProfileResource'][_0x35db('0x18')]({'where':{'type':_0x40b88d,'resourceId':_0x19ac8e['id']}})['then'](function(){return _0x88e28d;});})['then'](function(){_0x500717[_0x35db('0xf')](0xcc)[_0x35db('0x1a')]();});}};}function handleEntityNotFound(_0x5bb19d){return function(_0x33d2a0){if(!_0x33d2a0){_0x5bb19d['sendStatus'](0x194);}return _0x33d2a0;};}function handleError(_0x4af5ab,_0x5c6861){_0x5c6861=_0x5c6861||0x1f4;return function(_0x2c4c16){logger[_0x35db('0x1b')](_0x2c4c16[_0x35db('0x1c')]);if(_0x2c4c16['name']){delete _0x2c4c16[_0x35db('0x1d')];}_0x4af5ab['status'](_0x5c6861)[_0x35db('0x1e')](_0x2c4c16);};}exports['index']=function(_0x44f543,_0x47fa66){var _0x3e17f6={};var _0x36d4b0={'count':0x0,'rows':[]};var _0x37fddc=_[_0x35db('0x1f')](db[_0x35db('0x20')][_0x35db('0x21')],function(_0x2cd6ea){return{'name':_0x2cd6ea[_0x35db('0x22')],'type':_0x2cd6ea['type']['key']};});_0x3e17f6=qs[_0x35db('0x23')](_0x37fddc,_0x44f543);var _0x47fc2e={'where':_0x3e17f6[_0x35db('0x24')]};return db[_0x35db('0x20')][_0x35db('0x14')](_0x47fc2e)[_0x35db('0x17')](function(_0x4bcb59){_0x36d4b0[_0x35db('0x14')]=_0x4bcb59;_0x3e17f6[_0x35db('0x25')]=qs[_0x35db('0x25')](_0x44f543['query']);return db[_0x35db('0x20')][_0x35db('0x26')](_0x3e17f6);})[_0x35db('0x17')](function(_0x50c1f6){_0x36d4b0[_0x35db('0x27')]=_0x50c1f6;return _0x36d4b0;})[_0x35db('0x17')](respondWithFilteredResult(_0x47fa66,_0x3e17f6))['catch'](handleError(_0x47fa66,null));};exports[_0x35db('0x28')]=function(_0x1f9137,_0x43a92e){var _0xbf9262={'raw':!![],'where':{'id':_0x1f9137[_0x35db('0x29')]['id']}},_0x3386eb={};_0x3386eb['model']=_[_0x35db('0x2a')](db[_0x35db('0x20')][_0x35db('0x21')]);_0x3386eb['query']=_[_0x35db('0x2a')](_0x1f9137['query']);_0x3386eb[_0x35db('0x2b')]=_['intersection'](_0x3386eb[_0x35db('0x2c')],_0x3386eb[_0x35db('0x2d')]);_0xbf9262['attributes']=_[_0x35db('0x2e')](_0x3386eb[_0x35db('0x2c')],qs[_0x35db('0x2f')](_0x1f9137[_0x35db('0x2d')][_0x35db('0x2f')]));_0xbf9262[_0x35db('0x30')]=_0xbf9262[_0x35db('0x30')][_0x35db('0x31')]?_0xbf9262[_0x35db('0x30')]:_0x3386eb[_0x35db('0x2c')];if(_0x1f9137[_0x35db('0x2d')][_0x35db('0x32')]){_0xbf9262['include']=[{'all':!![]}];}_0xbf9262=_['merge']({},_0xbf9262,_0x1f9137[_0x35db('0x33')]);return db['OpenchannelQueue'][_0x35db('0x34')](_0xbf9262)[_0x35db('0x17')](handleEntityNotFound(_0x43a92e,null))[_0x35db('0x17')](respondWithResult(_0x43a92e,null))[_0x35db('0x35')](handleError(_0x43a92e,null));};exports[_0x35db('0x36')]=function(_0x58dbb5,_0x2b12ea){return db['OpenchannelQueue'][_0x35db('0x36')](_0x58dbb5[_0x35db('0x37')],{})[_0x35db('0x17')](function(_0x8f0d4b){var _0x5716ec=_0x58dbb5[_0x35db('0x38')][_0x35db('0x19')]({'plain':!![]});if(!_0x5716ec)throw new Error(_0x35db('0x39'));if(_0x5716ec['role']===_0x35db('0x38')){var _0x84fcae=_0x8f0d4b[_0x35db('0x19')]({'plain':!![]});var _0x473167=_0x35db('0x3a');return db['UserProfileSection'][_0x35db('0x34')]({'where':{'name':_0x473167,'userProfileId':_0x5716ec['userProfileId']},'raw':!![]})[_0x35db('0x17')](function(_0x15f007){if(_0x15f007&&_0x15f007[_0x35db('0x3b')]===0x0){return db[_0x35db('0x3c')]['create']({'name':_0x84fcae[_0x35db('0x1d')],'resourceId':_0x84fcae['id'],'type':_0x15f007[_0x35db('0x1d')],'sectionId':_0x15f007['id']},{})[_0x35db('0x17')](function(){return _0x8f0d4b;});}else{return _0x8f0d4b;}})[_0x35db('0x35')](function(_0x47e67a){logger[_0x35db('0x1b')](_0x35db('0x3d'),_0x47e67a);throw _0x47e67a;});}return _0x8f0d4b;})['then'](respondWithResult(_0x2b12ea,0xc9))[_0x35db('0x35')](handleError(_0x2b12ea,null));};exports['update']=function(_0x1ef769,_0x3f5fe2){if(_0x1ef769[_0x35db('0x37')]['id']){delete _0x1ef769['body']['id'];}return db['OpenchannelQueue'][_0x35db('0x34')]({'where':{'id':_0x1ef769[_0x35db('0x29')]['id']}})[_0x35db('0x17')](handleEntityNotFound(_0x3f5fe2,null))[_0x35db('0x17')](saveUpdates(_0x1ef769['body'],null))[_0x35db('0x17')](respondWithResult(_0x3f5fe2,null))[_0x35db('0x35')](handleError(_0x3f5fe2,null));};exports['destroy']=function(_0x42ea83,_0x51426d){return db[_0x35db('0x20')][_0x35db('0x34')]({'where':{'id':_0x42ea83[_0x35db('0x29')]['id']}})[_0x35db('0x17')](handleEntityNotFound(_0x51426d,null))[_0x35db('0x17')](removeEntity(_0x51426d,null))['catch'](handleError(_0x51426d,null));};exports[_0x35db('0x3e')]=function(_0x11dad1,_0x405a7e){return db[_0x35db('0x20')]['describe']()[_0x35db('0x17')](respondWithResult(_0x405a7e,null))[_0x35db('0x35')](handleError(_0x405a7e,null));};exports[_0x35db('0x3f')]=function(_0x4835cb,_0x2d27a5){var _0x33ca38={'raw':!![],'where':{}},_0x5c209e={},_0x1adb53;return db['OpenchannelQueue'][_0x35db('0x40')]({'where':{'id':_0x4835cb[_0x35db('0x29')]['id']}})[_0x35db('0x17')](handleEntityNotFound(_0x2d27a5,null))[_0x35db('0x17')](function(_0x2f68b9){if(_0x2f68b9){_0x1adb53=_0x2f68b9[_0x35db('0x19')]({'plain':!![]});_0x5c209e[_0x35db('0x2c')]=_[_0x35db('0x2a')](db[_0x35db('0x41')][_0x35db('0x21')]);_0x5c209e['query']=_['keys'](_0x4835cb[_0x35db('0x2d')]);_0x5c209e[_0x35db('0x2b')]=_[_0x35db('0x2e')](_0x5c209e[_0x35db('0x2c')],_0x5c209e[_0x35db('0x2d')]);_0x33ca38[_0x35db('0x30')]=_[_0x35db('0x2e')](_0x5c209e[_0x35db('0x2c')],qs[_0x35db('0x2f')](_0x4835cb['query'][_0x35db('0x2f')]));_0x33ca38[_0x35db('0x30')]=_0x33ca38[_0x35db('0x30')][_0x35db('0x31')]?_0x33ca38[_0x35db('0x30')]:_0x5c209e[_0x35db('0x2c')];if(!_0x4835cb[_0x35db('0x2d')][_0x35db('0x42')](_0x35db('0x43'))){_0x33ca38['limit']=qs['limit'](_0x4835cb[_0x35db('0x2d')]['limit']);_0x33ca38[_0x35db('0x11')]=qs[_0x35db('0x11')](_0x4835cb['query'][_0x35db('0x11')]);}_0x33ca38['order']=qs[_0x35db('0x44')](_0x4835cb['query'][_0x35db('0x44')]);_0x33ca38[_0x35db('0x24')]=qs['filters'](_[_0x35db('0x45')](_0x4835cb['query'],_0x5c209e['filters']));_0x33ca38['where'][_0x35db('0x46')]=_0x2f68b9['id'];if(_0x4835cb[_0x35db('0x2d')][_0x35db('0x47')]){_0x33ca38[_0x35db('0x24')]=_[_0x35db('0x48')](_0x33ca38[_0x35db('0x24')],{'$or':_[_0x35db('0x1f')](_0x33ca38[_0x35db('0x30')],function(_0xc9c434){var _0x4db9b7={};_0x4db9b7[_0xc9c434]={'$like':'%'+_0x4835cb[_0x35db('0x2d')][_0x35db('0x47')]+'%'};return _0x4db9b7;})});}_0x33ca38=_['merge']({},_0x33ca38,_0x4835cb['options']);return db[_0x35db('0x41')]['findAll'](_0x33ca38);}})[_0x35db('0x17')](function(_0x3aaeba){if(_0x3aaeba){return db[_0x35db('0x49')][_0x35db('0x4a')]({'where':{'id':_[_0x35db('0x1f')](_0x3aaeba,_0x35db('0x4b')),'role':_0x35db('0x4c')},'attributes':['id',_0x35db('0x1d'),_0x35db('0x4d'),_0x35db('0x4e'),_0x35db('0x4f')]});}})['then'](function(_0x159a89){if(_0x159a89){return{'count':_0x159a89[_0x35db('0x14')],'rows':_[_0x35db('0x1f')](_0x159a89[_0x35db('0x27')],function(_0x2331b0){return{'membername':_0x2331b0[_0x35db('0x1d')],'UserId':_0x2331b0['id'],'queue_name':_0x1adb53[_0x35db('0x1d')],'OpenchannelQueueId':_0x1adb53['id'],'interface':util[_0x35db('0x50')](_0x35db('0x51'),'SIP',_0x2331b0[_0x35db('0x1d')]),'penalty':0x0,'paused':_0x2331b0[_0x35db('0x4d')],'createdAt':_0x2331b0['createdAt'],'updatedAt':_0x2331b0[_0x35db('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x35db('0x17')](respondWithFilteredResult(_0x2d27a5,_0x33ca38))['catch'](handleError(_0x2d27a5,null));};exports[_0x35db('0x52')]=function(_0x5cdcfb,_0x415d28){var _0x34388d={};var _0x142fbd={};var _0x4abf7e;var _0x3ec705;return db[_0x35db('0x20')]['findOne']({'where':{'id':_0x5cdcfb[_0x35db('0x29')]['id']}})['then'](handleEntityNotFound(_0x415d28,null))[_0x35db('0x17')](function(_0x1c0717){if(_0x1c0717){_0x4abf7e=_0x1c0717;_0x142fbd[_0x35db('0x2c')]=_[_0x35db('0x2a')](db[_0x35db('0x53')][_0x35db('0x21')]);_0x142fbd[_0x35db('0x2d')]=_[_0x35db('0x2a')](_0x5cdcfb[_0x35db('0x2d')]);_0x142fbd[_0x35db('0x2b')]=_[_0x35db('0x2e')](_0x142fbd[_0x35db('0x2c')],_0x142fbd[_0x35db('0x2d')]);_0x34388d[_0x35db('0x30')]=_['intersection'](_0x142fbd[_0x35db('0x2c')],qs[_0x35db('0x2f')](_0x5cdcfb[_0x35db('0x2d')][_0x35db('0x2f')]));_0x34388d[_0x35db('0x30')]=_0x34388d[_0x35db('0x30')][_0x35db('0x31')]?_0x34388d['attributes']:_0x142fbd[_0x35db('0x2c')];_0x34388d[_0x35db('0x54')]=qs[_0x35db('0x44')](_0x5cdcfb[_0x35db('0x2d')]['sort']);_0x34388d['where']=qs[_0x35db('0x2b')](_[_0x35db('0x45')](_0x5cdcfb['query'],_0x142fbd[_0x35db('0x2b')]));if(_0x5cdcfb['query']['filter']){_0x34388d['where']=_['merge'](_0x34388d[_0x35db('0x24')],{'$or':_['map'](_0x34388d['attributes'],function(_0x41e60b){var _0x467700={};_0x467700[_0x41e60b]={'$like':'%'+_0x5cdcfb['query'][_0x35db('0x47')]+'%'};return _0x467700;})});}_0x34388d=_['merge']({},_0x34388d,_0x5cdcfb['options']);return _0x4abf7e[_0x35db('0x52')](_0x34388d);}})[_0x35db('0x17')](function(_0x23e745){if(_0x23e745){_0x3ec705=_0x23e745[_0x35db('0x31')];if(!_0x5cdcfb['query'][_0x35db('0x42')](_0x35db('0x43'))){_0x34388d['limit']=qs[_0x35db('0x12')](_0x5cdcfb[_0x35db('0x2d')][_0x35db('0x12')]);_0x34388d[_0x35db('0x11')]=qs[_0x35db('0x11')](_0x5cdcfb['query'][_0x35db('0x11')]);}return _0x4abf7e[_0x35db('0x52')](_0x34388d);}})[_0x35db('0x17')](function(_0x3ab985){if(_0x3ab985){return _0x3ab985?{'count':_0x3ec705,'rows':_0x3ab985}:null;}})[_0x35db('0x17')](respondWithResult(_0x415d28,null))[_0x35db('0x35')](handleError(_0x415d28,null));};exports[_0x35db('0x55')]=function(_0x3c84de,_0x2755bc){var _0x1a7948=_0x3c84de[_0x35db('0x37')]['ids'];return db[_0x35db('0x53')][_0x35db('0x26')]({'where':{'id':_0x1a7948},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x35db('0x56'),_0x35db('0x57'),'interface'],'raw':!![]}]})[_0x35db('0x17')](function(_0x330f5b){if(_0x330f5b){var _0xd0e496=_['flatMap'](_0x330f5b,function(_0x3960ca){var _0x48bd04=_0x3960ca[_0x35db('0x19')]({'plain':!![]});return _0x48bd04[_0x35db('0x58')];});return db[_0x35db('0x20')][_0x35db('0x34')]({'where':{'id':_0x3c84de[_0x35db('0x29')]['id']}})['then'](function(_0x5466f2){return db['sequelize']['transaction'](function(_0x5b5389){return _0x5466f2[_0x35db('0x55')](_0x1a7948,{'transaction':_0x5b5389})[_0x35db('0x17')](function(){return BPromise[_0x35db('0x59')](_0xd0e496,function(_0x67dd9e){return db[_0x35db('0x41')][_0x35db('0x5a')]({'where':{'UserId':_0x67dd9e['id'],'OpenchannelQueueId':_0x3c84de[_0x35db('0x29')]['id']},'transaction':_0x5b5389});});})['then'](function(){_0xd0e496[_0x35db('0x5b')](function(_0x196967){socket[_0x35db('0x5c')](_0x35db('0x5d'),{'UserId':_0x196967['id'],'OpenchannelQueueId':_0x5466f2['id']});});});});});}})[_0x35db('0x17')](respondWithStatusCode(_0x2755bc,null))[_0x35db('0x35')](handleError(_0x2755bc,null));};exports[_0x35db('0x5e')]=function(_0x38e16a,_0x157cc4){return db[_0x35db('0x53')][_0x35db('0x26')]({'where':{'id':_0x38e16a['query'][_0x35db('0x5f')]},'attributes':['id'],'include':[{'model':db[_0x35db('0x49')],'as':_0x35db('0x58'),'attributes':['id'],'raw':!![]}]})[_0x35db('0x17')](handleEntityNotFound(_0x157cc4,null))['then'](function(_0x35bd06){var _0x2f2542=_[_0x35db('0x1f')](_0x35bd06,'id');var _0x4925cf=[];var _0x3bd295=[];var _0x5d451d=squel[_0x35db('0x60')]();_0x5d451d[_0x35db('0x61')]('tq.TeamId')['from'](_0x35db('0x62'),'tq')[_0x35db('0x63')](_0x35db('0x64'),'ut',_0x35db('0x65'))['where'](_0x35db('0x66'),_0x38e16a[_0x35db('0x29')]['id']);for(var _0x2af0fd=0x0;_0x2af0fd<_0x35bd06[_0x35db('0x31')];_0x2af0fd+=0x1){let _0x587118=_0x35bd06[_0x2af0fd];for(var _0x4166fa=0x0;_0x4166fa<_0x587118['Agents']['length'];_0x4166fa+=0x1){let _0x1b423e=_0x587118[_0x35db('0x58')][_0x4166fa];var _0x1dedb4=_0x5d451d[_0x35db('0x67')]();_0x1dedb4[_0x35db('0x24')](_0x35db('0x68'),_0x1b423e['id']);_0x3bd295['push'](db['sequelize'][_0x35db('0x2d')](_0x1dedb4['toString'](),{'type':db[_0x35db('0x69')][_0x35db('0x6a')][_0x35db('0x6b')]})[_0x35db('0x17')](function(_0x583e8d){if(_0x583e8d[_0x35db('0x31')]===0x1){return _0x1b423e['id'];}else{var _0x4dd814=_['every'](_[_0x35db('0x1f')](_0x583e8d,'TeamId'),function(_0x2f94b3){return _[_0x35db('0x6c')](_0x2f2542,_0x2f94b3);});if(_0x4dd814){return _0x1b423e['id'];}}}));}}return BPromise[_0x35db('0x6d')](_0x3bd295)[_0x35db('0x17')](function(_0x1d9dfd){_0x4925cf=_(_0x4925cf)['union'](_0x1d9dfd)[_0x35db('0x6e')]()[_0x35db('0x6f')]();return db[_0x35db('0x20')][_0x35db('0x34')]({'where':{'id':_0x38e16a['params']['id']}})[_0x35db('0x17')](function(_0x3fbb08){return db[_0x35db('0x69')]['transaction'](function(_0x1870cc){return _0x3fbb08['removeTeams'](_0x38e16a['query'][_0x35db('0x5f')],{'transaction':_0x1870cc})[_0x35db('0x17')](function(){if(!_[_0x35db('0x70')](_0x4925cf)){return _0x3fbb08[_0x35db('0x71')](_0x4925cf,{'transaction':_0x1870cc});}})[_0x35db('0x17')](function(){_0x4925cf[_0x35db('0x5b')](function(_0x7825a6){socket[_0x35db('0x5c')]('userOpenchannelQueue:remove',{'UserId':_0x7825a6,'OpenchannelQueueId':_0x3fbb08['id']});});});});});});})['then'](respondWithStatusCode(_0x157cc4,null))[_0x35db('0x35')](handleError(_0x157cc4,null));};exports[_0x35db('0x72')]=function(_0x17bcd1,_0x39f797){return db[_0x35db('0x20')][_0x35db('0x34')]({'where':{'id':_0x17bcd1[_0x35db('0x29')]['id']}})['then'](handleEntityNotFound(_0x39f797,null))[_0x35db('0x17')](function(_0x599a43){if(_0x599a43){return _0x599a43[_0x35db('0x72')](_0x17bcd1[_0x35db('0x37')][_0x35db('0x5f')],_['omit'](_0x17bcd1[_0x35db('0x37')],['ids','id'])||{})['spread'](function(_0x2d1b8d){for(var _0x4929e8=0x0;_0x4929e8<_0x17bcd1[_0x35db('0x37')][_0x35db('0x5f')][_0x35db('0x31')];_0x4929e8+=0x1){socket[_0x35db('0x5c')](_0x35db('0x5d'),{'UserId':Number(_0x17bcd1[_0x35db('0x37')]['ids'][_0x4929e8]),'OpenchannelQueueId':Number(_0x17bcd1[_0x35db('0x29')]['id'])});}return _0x2d1b8d;});}})[_0x35db('0x17')](respondWithResult(_0x39f797,null))[_0x35db('0x35')](handleError(_0x39f797,null));};exports[_0x35db('0x71')]=function(_0x30d2f0,_0x5c8793){return db['OpenchannelQueue'][_0x35db('0x34')]({'where':{'id':_0x30d2f0[_0x35db('0x29')]['id']}})[_0x35db('0x17')](handleEntityNotFound(_0x5c8793,null))[_0x35db('0x17')](function(_0x36da06){if(_0x36da06){return _0x36da06[_0x35db('0x71')](_0x30d2f0['query']['ids'])[_0x35db('0x17')](function(){if(_[_0x35db('0x73')](_0x30d2f0['query'][_0x35db('0x5f')])){for(var _0x5b29c6=0x0;_0x5b29c6<_0x30d2f0['query'][_0x35db('0x5f')][_0x35db('0x31')];_0x5b29c6+=0x1){socket[_0x35db('0x5c')]('userOpenchannelQueue:remove',{'UserId':Number(_0x30d2f0['query'][_0x35db('0x5f')][_0x5b29c6]),'OpenchannelQueueId':Number(_0x30d2f0['params']['id'])});}}else{socket[_0x35db('0x5c')]('userOpenchannelQueue:remove',{'UserId':Number(_0x30d2f0[_0x35db('0x2d')][_0x35db('0x5f')]),'OpenchannelQueueId':Number(_0x30d2f0['params']['id'])});}});}})[_0x35db('0x17')](respondWithStatusCode(_0x5c8793,null))[_0x35db('0x35')](handleError(_0x5c8793,null));};exports[_0x35db('0x74')]=function(_0x400d48,_0x4b17ec){var _0x4e184e={};var _0x1ab84e={};var _0x3b553f;var _0x416a81;return db[_0x35db('0x20')][_0x35db('0x40')]({'where':{'id':_0x400d48[_0x35db('0x29')]['id']}})[_0x35db('0x17')](handleEntityNotFound(_0x4b17ec,null))[_0x35db('0x17')](function(_0x50b3ab){if(_0x50b3ab){_0x3b553f=_0x50b3ab;_0x1ab84e[_0x35db('0x2c')]=_[_0x35db('0x2a')](db[_0x35db('0x49')][_0x35db('0x21')]);_0x1ab84e[_0x35db('0x2d')]=_[_0x35db('0x2a')](_0x400d48[_0x35db('0x2d')]);_0x1ab84e['filters']=_[_0x35db('0x2e')](_0x1ab84e[_0x35db('0x2c')],_0x1ab84e[_0x35db('0x2d')]);_0x4e184e[_0x35db('0x30')]=_[_0x35db('0x2e')](_0x1ab84e[_0x35db('0x2c')],qs['fields'](_0x400d48[_0x35db('0x2d')][_0x35db('0x2f')]));_0x4e184e[_0x35db('0x30')]=_0x4e184e['attributes']['length']?_0x4e184e['attributes']:_0x1ab84e[_0x35db('0x2c')];_0x4e184e[_0x35db('0x54')]=qs[_0x35db('0x44')](_0x400d48[_0x35db('0x2d')][_0x35db('0x44')]);_0x4e184e['where']=qs[_0x35db('0x2b')](_[_0x35db('0x45')](_0x400d48['query'],_0x1ab84e['filters']));if(_0x400d48[_0x35db('0x2d')][_0x35db('0x47')]){_0x4e184e[_0x35db('0x24')]=_['merge'](_0x4e184e['where'],{'$or':_[_0x35db('0x1f')](_0x4e184e[_0x35db('0x30')],function(_0x23ac24){var _0x5207f6={};_0x5207f6[_0x23ac24]={'$like':'%'+_0x400d48[_0x35db('0x2d')][_0x35db('0x47')]+'%'};return _0x5207f6;})});}_0x4e184e=_[_0x35db('0x48')]({},_0x4e184e,_0x400d48['options']);return _0x3b553f[_0x35db('0x74')](_0x4e184e);}})[_0x35db('0x17')](function(_0x1634a5){if(_0x1634a5){_0x416a81=_0x1634a5[_0x35db('0x31')];if(!_0x400d48['query'][_0x35db('0x42')]('nolimit')){_0x4e184e['limit']=qs['limit'](_0x400d48['query'][_0x35db('0x12')]);_0x4e184e[_0x35db('0x11')]=qs[_0x35db('0x11')](_0x400d48['query'][_0x35db('0x11')]);}return _0x3b553f['getAgents'](_0x4e184e);}})[_0x35db('0x17')](function(_0x45a22f){if(_0x45a22f){return _0x45a22f?{'count':_0x416a81,'rows':_0x45a22f}:null;}})[_0x35db('0x17')](respondWithResult(_0x4b17ec,null))[_0x35db('0x35')](handleError(_0x4b17ec,null));}; \ No newline at end of file +var _0x60fc=['socket.io-emitter','./openchannelQueue.socket','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','update','destroy','then','get','error','stack','name','send','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','include','query','rows','show','params','model','keys','filters','attributes','intersection','fields','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','length','hasOwnProperty','order','sort','where','pick','filter','UserOpenchannelQueue','User','UserId','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','Team','nolimit','addTeams','findAll','Agents','online','interface','userOpenchannelQueue:save','select','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','SELECT','every','TeamId','includes','all','union','compact','value','ids','removeAgents','forEach','emit','addAgents','omit','spread','userOpenchannelQueue:remove','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost'];(function(_0x2bc9d5,_0x554f80){var _0x1ced7c=function(_0x443a5a){while(--_0x443a5a){_0x2bc9d5['push'](_0x2bc9d5['shift']());}};_0x1ced7c(++_0x554f80);}(_0x60fc,0x157));var _0xc60f=function(_0x4d9aca,_0x125aef){_0x4d9aca=_0x4d9aca-0x0;var _0x5d2b59=_0x60fc[_0x4d9aca];return _0x5d2b59;};'use strict';var BPromise=require(_0xc60f('0x0'));var util=require(_0xc60f('0x1'));var _=require(_0xc60f('0x2'));var squel=require('squel');var Redis=require(_0xc60f('0x3'));var qs=require(_0xc60f('0x4'));var logger=require(_0xc60f('0x5'))(_0xc60f('0x6'));var config=require('../../config/environment');var db=require(_0xc60f('0x7'))['db'];config[_0xc60f('0x8')]=_[_0xc60f('0x9')](config[_0xc60f('0x8')],{'host':_0xc60f('0xa'),'port':0x18eb});var socket=require(_0xc60f('0xb'))(new Redis(config[_0xc60f('0x8')]));require(_0xc60f('0xc'))['register'](socket);function respondWithStatusCode(_0x3c46f4,_0x24b662){_0x24b662=_0x24b662||0xcc;return function(_0x5ddce3){if(_0x5ddce3){return _0x3c46f4[_0xc60f('0xd')](_0x24b662);}return _0x3c46f4['status'](_0x24b662)[_0xc60f('0xe')]();};}function respondWithResult(_0x5f217f,_0x380c39){_0x380c39=_0x380c39||0xc8;return function(_0x237cba){if(_0x237cba){return _0x5f217f[_0xc60f('0xf')](_0x380c39)['json'](_0x237cba);}};}function respondWithFilteredResult(_0x247b8a,_0x2317ca){return function(_0x297bff){if(_0x297bff){var _0x1fc0dc=typeof _0x2317ca[_0xc60f('0x10')]===_0xc60f('0x11')&&typeof _0x2317ca['limit']==='undefined';var _0x430068=_0x297bff[_0xc60f('0x12')];var _0x1de8ec=_0x1fc0dc?0x0:_0x2317ca[_0xc60f('0x10')];var _0x1ce01f=_0x1fc0dc?_0x297bff[_0xc60f('0x12')]:_0x2317ca[_0xc60f('0x10')]+_0x2317ca[_0xc60f('0x13')];var _0x1ed082;if(_0x1ce01f>=_0x430068){_0x1ce01f=_0x430068;_0x1ed082=0xc8;}else{_0x1ed082=0xce;}_0x247b8a[_0xc60f('0xf')](_0x1ed082);return _0x247b8a[_0xc60f('0x14')](_0xc60f('0x15'),_0x1de8ec+'-'+_0x1ce01f+'/'+_0x430068)['json'](_0x297bff);}return null;};}function saveUpdates(_0x5c28c7){return function(_0xc1fbc1){if(_0xc1fbc1){return _0xc1fbc1[_0xc60f('0x16')](_0x5c28c7)['then'](function(_0x38c25a){return _0x38c25a;});}return null;};}function removeEntity(_0x312abb){return function(_0x48bba8){if(_0x48bba8){return _0x48bba8[_0xc60f('0x17')]()[_0xc60f('0x18')](function(){var _0x39f61d=_0x48bba8[_0xc60f('0x19')]({'plain':!![]});var _0x536e91='OpenchannelQueues';return db['UserProfileResource'][_0xc60f('0x17')]({'where':{'type':_0x536e91,'resourceId':_0x39f61d['id']}})['then'](function(){return _0x48bba8;});})[_0xc60f('0x18')](function(){_0x312abb[_0xc60f('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bb324){return function(_0x2d17a2){if(!_0x2d17a2){_0x4bb324[_0xc60f('0xd')](0x194);}return _0x2d17a2;};}function handleError(_0x63dd5c,_0x3956b8){_0x3956b8=_0x3956b8||0x1f4;return function(_0x5ac535){logger[_0xc60f('0x1a')](_0x5ac535[_0xc60f('0x1b')]);if(_0x5ac535[_0xc60f('0x1c')]){delete _0x5ac535[_0xc60f('0x1c')];}_0x63dd5c['status'](_0x3956b8)[_0xc60f('0x1d')](_0x5ac535);};}exports['index']=function(_0x55dd81,_0x118c03){var _0x29b2f8={};var _0x1a51e2={'count':0x0,'rows':[]};var _0x3360b7=_[_0xc60f('0x1e')](db[_0xc60f('0x1f')][_0xc60f('0x20')],function(_0x62817f){return{'name':_0x62817f[_0xc60f('0x21')],'type':_0x62817f[_0xc60f('0x22')][_0xc60f('0x23')]};});_0x29b2f8=qs[_0xc60f('0x24')](_0x3360b7,_0x55dd81);var _0x246881={'where':_0x29b2f8['where']};return db[_0xc60f('0x1f')][_0xc60f('0x12')](_0x246881)[_0xc60f('0x18')](function(_0x4ef327){_0x1a51e2[_0xc60f('0x12')]=_0x4ef327;_0x29b2f8['include']=qs[_0xc60f('0x25')](_0x55dd81[_0xc60f('0x26')]);return db[_0xc60f('0x1f')]['findAll'](_0x29b2f8);})[_0xc60f('0x18')](function(_0x1d2f25){_0x1a51e2[_0xc60f('0x27')]=_0x1d2f25;return _0x1a51e2;})['then'](respondWithFilteredResult(_0x118c03,_0x29b2f8))['catch'](handleError(_0x118c03,null));};exports[_0xc60f('0x28')]=function(_0x27813a,_0x457372){var _0x184a20={'raw':!![],'where':{'id':_0x27813a[_0xc60f('0x29')]['id']}},_0x4603cd={};_0x4603cd[_0xc60f('0x2a')]=_[_0xc60f('0x2b')](db['OpenchannelQueue'][_0xc60f('0x20')]);_0x4603cd[_0xc60f('0x26')]=_[_0xc60f('0x2b')](_0x27813a['query']);_0x4603cd[_0xc60f('0x2c')]=_['intersection'](_0x4603cd[_0xc60f('0x2a')],_0x4603cd[_0xc60f('0x26')]);_0x184a20[_0xc60f('0x2d')]=_[_0xc60f('0x2e')](_0x4603cd['model'],qs['fields'](_0x27813a[_0xc60f('0x26')][_0xc60f('0x2f')]));_0x184a20[_0xc60f('0x2d')]=_0x184a20['attributes']['length']?_0x184a20[_0xc60f('0x2d')]:_0x4603cd[_0xc60f('0x2a')];if(_0x27813a['query'][_0xc60f('0x30')]){_0x184a20[_0xc60f('0x25')]=[{'all':!![]}];}_0x184a20=_[_0xc60f('0x31')]({},_0x184a20,_0x27813a[_0xc60f('0x32')]);return db[_0xc60f('0x1f')][_0xc60f('0x33')](_0x184a20)[_0xc60f('0x18')](handleEntityNotFound(_0x457372,null))[_0xc60f('0x18')](respondWithResult(_0x457372,null))['catch'](handleError(_0x457372,null));};exports[_0xc60f('0x34')]=function(_0x8a91eb,_0x11d8af){return db[_0xc60f('0x1f')][_0xc60f('0x34')](_0x8a91eb[_0xc60f('0x35')],{})[_0xc60f('0x18')](function(_0x2bc6b9){var _0x4cd46d=_0x8a91eb['user'][_0xc60f('0x19')]({'plain':!![]});if(!_0x4cd46d)throw new Error(_0xc60f('0x36'));if(_0x4cd46d[_0xc60f('0x37')]==='user'){var _0x380495=_0x2bc6b9[_0xc60f('0x19')]({'plain':!![]});var _0x169d62='OpenchannelQueues';return db[_0xc60f('0x38')][_0xc60f('0x33')]({'where':{'name':_0x169d62,'userProfileId':_0x4cd46d[_0xc60f('0x39')]},'raw':!![]})['then'](function(_0x136b8a){if(_0x136b8a&&_0x136b8a[_0xc60f('0x3a')]===0x0){return db[_0xc60f('0x3b')][_0xc60f('0x34')]({'name':_0x380495['name'],'resourceId':_0x380495['id'],'type':_0x136b8a[_0xc60f('0x1c')],'sectionId':_0x136b8a['id']},{})[_0xc60f('0x18')](function(){return _0x2bc6b9;});}else{return _0x2bc6b9;}})[_0xc60f('0x3c')](function(_0x1b415e){logger['error'](_0xc60f('0x3d'),_0x1b415e);throw _0x1b415e;});}return _0x2bc6b9;})[_0xc60f('0x18')](respondWithResult(_0x11d8af,0xc9))[_0xc60f('0x3c')](handleError(_0x11d8af,null));};exports[_0xc60f('0x16')]=function(_0xf2d508,_0x36fe09){if(_0xf2d508[_0xc60f('0x35')]['id']){delete _0xf2d508[_0xc60f('0x35')]['id'];}return db[_0xc60f('0x1f')][_0xc60f('0x33')]({'where':{'id':_0xf2d508['params']['id']}})['then'](handleEntityNotFound(_0x36fe09,null))[_0xc60f('0x18')](saveUpdates(_0xf2d508[_0xc60f('0x35')],null))[_0xc60f('0x18')](respondWithResult(_0x36fe09,null))[_0xc60f('0x3c')](handleError(_0x36fe09,null));};exports[_0xc60f('0x17')]=function(_0x4fd06e,_0x3a4875){return db[_0xc60f('0x1f')][_0xc60f('0x33')]({'where':{'id':_0x4fd06e[_0xc60f('0x29')]['id']}})['then'](handleEntityNotFound(_0x3a4875,null))['then'](removeEntity(_0x3a4875,null))['catch'](handleError(_0x3a4875,null));};exports[_0xc60f('0x3e')]=function(_0x5c3b53,_0x497712){return db['OpenchannelQueue'][_0xc60f('0x3e')]()[_0xc60f('0x18')](respondWithResult(_0x497712,null))[_0xc60f('0x3c')](handleError(_0x497712,null));};exports[_0xc60f('0x3f')]=function(_0x12dec2,_0x113153){var _0x5d7e79={'raw':!![],'where':{}},_0x55930b={},_0x3e2fdb;return db[_0xc60f('0x1f')][_0xc60f('0x40')]({'where':{'id':_0x12dec2[_0xc60f('0x29')]['id']}})[_0xc60f('0x18')](handleEntityNotFound(_0x113153,null))['then'](function(_0x5926de){if(_0x5926de){_0x3e2fdb=_0x5926de['get']({'plain':!![]});_0x55930b[_0xc60f('0x2a')]=_[_0xc60f('0x2b')](db['UserOpenchannelQueue'][_0xc60f('0x20')]);_0x55930b[_0xc60f('0x26')]=_[_0xc60f('0x2b')](_0x12dec2[_0xc60f('0x26')]);_0x55930b[_0xc60f('0x2c')]=_[_0xc60f('0x2e')](_0x55930b[_0xc60f('0x2a')],_0x55930b[_0xc60f('0x26')]);_0x5d7e79[_0xc60f('0x2d')]=_[_0xc60f('0x2e')](_0x55930b[_0xc60f('0x2a')],qs[_0xc60f('0x2f')](_0x12dec2[_0xc60f('0x26')][_0xc60f('0x2f')]));_0x5d7e79[_0xc60f('0x2d')]=_0x5d7e79[_0xc60f('0x2d')][_0xc60f('0x41')]?_0x5d7e79[_0xc60f('0x2d')]:_0x55930b[_0xc60f('0x2a')];if(!_0x12dec2[_0xc60f('0x26')][_0xc60f('0x42')]('nolimit')){_0x5d7e79[_0xc60f('0x13')]=qs[_0xc60f('0x13')](_0x12dec2['query'][_0xc60f('0x13')]);_0x5d7e79[_0xc60f('0x10')]=qs['offset'](_0x12dec2[_0xc60f('0x26')]['offset']);}_0x5d7e79[_0xc60f('0x43')]=qs[_0xc60f('0x44')](_0x12dec2[_0xc60f('0x26')]['sort']);_0x5d7e79[_0xc60f('0x45')]=qs['filters'](_[_0xc60f('0x46')](_0x12dec2[_0xc60f('0x26')],_0x55930b[_0xc60f('0x2c')]));_0x5d7e79[_0xc60f('0x45')]['OpenchannelQueueId']=_0x5926de['id'];if(_0x12dec2[_0xc60f('0x26')]['filter']){_0x5d7e79[_0xc60f('0x45')]=_[_0xc60f('0x31')](_0x5d7e79[_0xc60f('0x45')],{'$or':_[_0xc60f('0x1e')](_0x5d7e79[_0xc60f('0x2d')],function(_0x46d022){var _0x56fbe8={};_0x56fbe8[_0x46d022]={'$like':'%'+_0x12dec2[_0xc60f('0x26')][_0xc60f('0x47')]+'%'};return _0x56fbe8;})});}_0x5d7e79=_['merge']({},_0x5d7e79,_0x12dec2['options']);return db[_0xc60f('0x48')]['findAll'](_0x5d7e79);}})[_0xc60f('0x18')](function(_0x4ff70e){if(_0x4ff70e){return db[_0xc60f('0x49')]['findAndCountAll']({'where':{'id':_[_0xc60f('0x1e')](_0x4ff70e,_0xc60f('0x4a')),'role':'agent'},'attributes':['id','name',_0xc60f('0x4b'),_0xc60f('0x4c'),_0xc60f('0x4d')]});}})['then'](function(_0x35f196){if(_0x35f196){return{'count':_0x35f196[_0xc60f('0x12')],'rows':_[_0xc60f('0x1e')](_0x35f196['rows'],function(_0x3b5a66){return{'membername':_0x3b5a66['name'],'UserId':_0x3b5a66['id'],'queue_name':_0x3e2fdb['name'],'OpenchannelQueueId':_0x3e2fdb['id'],'interface':util[_0xc60f('0x4e')]('%s/%s',_0xc60f('0x4f'),_0x3b5a66[_0xc60f('0x1c')]),'penalty':0x0,'paused':_0x3b5a66[_0xc60f('0x4b')],'createdAt':_0x3b5a66[_0xc60f('0x4d')],'updatedAt':_0x3b5a66[_0xc60f('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc60f('0x18')](respondWithFilteredResult(_0x113153,_0x5d7e79))[_0xc60f('0x3c')](handleError(_0x113153,null));};exports[_0xc60f('0x50')]=function(_0x416783,_0x49e2cd){var _0x1f2194={};var _0x20ead0={};var _0x1a4c53;var _0x4390b;return db[_0xc60f('0x1f')]['findOne']({'where':{'id':_0x416783['params']['id']}})['then'](handleEntityNotFound(_0x49e2cd,null))[_0xc60f('0x18')](function(_0x4879ad){if(_0x4879ad){_0x1a4c53=_0x4879ad;_0x20ead0[_0xc60f('0x2a')]=_[_0xc60f('0x2b')](db[_0xc60f('0x51')]['rawAttributes']);_0x20ead0[_0xc60f('0x26')]=_[_0xc60f('0x2b')](_0x416783['query']);_0x20ead0['filters']=_[_0xc60f('0x2e')](_0x20ead0[_0xc60f('0x2a')],_0x20ead0[_0xc60f('0x26')]);_0x1f2194[_0xc60f('0x2d')]=_['intersection'](_0x20ead0[_0xc60f('0x2a')],qs[_0xc60f('0x2f')](_0x416783[_0xc60f('0x26')]['fields']));_0x1f2194['attributes']=_0x1f2194[_0xc60f('0x2d')][_0xc60f('0x41')]?_0x1f2194[_0xc60f('0x2d')]:_0x20ead0['model'];_0x1f2194[_0xc60f('0x43')]=qs[_0xc60f('0x44')](_0x416783[_0xc60f('0x26')][_0xc60f('0x44')]);_0x1f2194[_0xc60f('0x45')]=qs[_0xc60f('0x2c')](_['pick'](_0x416783[_0xc60f('0x26')],_0x20ead0[_0xc60f('0x2c')]));if(_0x416783[_0xc60f('0x26')]['filter']){_0x1f2194[_0xc60f('0x45')]=_[_0xc60f('0x31')](_0x1f2194[_0xc60f('0x45')],{'$or':_[_0xc60f('0x1e')](_0x1f2194[_0xc60f('0x2d')],function(_0x4e9ea0){var _0x4be128={};_0x4be128[_0x4e9ea0]={'$like':'%'+_0x416783['query']['filter']+'%'};return _0x4be128;})});}_0x1f2194=_[_0xc60f('0x31')]({},_0x1f2194,_0x416783['options']);return _0x1a4c53['getTeams'](_0x1f2194);}})['then'](function(_0xeab0f4){if(_0xeab0f4){_0x4390b=_0xeab0f4[_0xc60f('0x41')];if(!_0x416783[_0xc60f('0x26')]['hasOwnProperty'](_0xc60f('0x52'))){_0x1f2194[_0xc60f('0x13')]=qs[_0xc60f('0x13')](_0x416783[_0xc60f('0x26')][_0xc60f('0x13')]);_0x1f2194[_0xc60f('0x10')]=qs[_0xc60f('0x10')](_0x416783[_0xc60f('0x26')]['offset']);}return _0x1a4c53[_0xc60f('0x50')](_0x1f2194);}})[_0xc60f('0x18')](function(_0x1b6035){if(_0x1b6035){return _0x1b6035?{'count':_0x4390b,'rows':_0x1b6035}:null;}})[_0xc60f('0x18')](respondWithResult(_0x49e2cd,null))['catch'](handleError(_0x49e2cd,null));};exports[_0xc60f('0x53')]=function(_0x59a59c,_0x139778){var _0x29824a=_0x59a59c[_0xc60f('0x35')]['ids'];return db[_0xc60f('0x51')][_0xc60f('0x54')]({'where':{'id':_0x29824a},'attributes':['id'],'include':[{'model':db[_0xc60f('0x49')],'as':_0xc60f('0x55'),'attributes':['id',_0xc60f('0x1c'),_0xc60f('0x56'),'voicePause',_0xc60f('0x57')],'raw':!![]}]})['then'](function(_0x55c916){if(_0x55c916){var _0x56c63f=_['flatMap'](_0x55c916,function(_0x10c8fe){var _0x2904d9=_0x10c8fe['get']({'plain':!![]});return _0x2904d9[_0xc60f('0x55')];});return db[_0xc60f('0x1f')][_0xc60f('0x33')]({'where':{'id':_0x59a59c[_0xc60f('0x29')]['id']}})[_0xc60f('0x18')](function(_0x2a87eb){return db['sequelize']['transaction'](function(_0x2d3078){return _0x2a87eb[_0xc60f('0x53')](_0x29824a,{'transaction':_0x2d3078})[_0xc60f('0x18')](function(){return BPromise['each'](_0x56c63f,function(_0x2df6cc){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x2df6cc['id'],'OpenchannelQueueId':_0x59a59c[_0xc60f('0x29')]['id']},'transaction':_0x2d3078});});})[_0xc60f('0x18')](function(){_0x56c63f['forEach'](function(_0x122c33){socket['emit'](_0xc60f('0x58'),{'UserId':_0x122c33['id'],'OpenchannelQueueId':_0x2a87eb['id']});});});});});}})['then'](respondWithStatusCode(_0x139778,null))[_0xc60f('0x3c')](handleError(_0x139778,null));};exports['removeTeams']=function(_0x1b45e1,_0x17a5b7){return db[_0xc60f('0x51')][_0xc60f('0x54')]({'where':{'id':_0x1b45e1[_0xc60f('0x26')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc60f('0x18')](handleEntityNotFound(_0x17a5b7,null))[_0xc60f('0x18')](function(_0x52b417){var _0xd51d1a=_[_0xc60f('0x1e')](_0x52b417,'id');var _0x52aeac=[];var _0x3212d7=[];var _0x4d4656=squel[_0xc60f('0x59')]();_0x4d4656[_0xc60f('0x5a')](_0xc60f('0x5b'))[_0xc60f('0x5c')](_0xc60f('0x5d'),'tq')[_0xc60f('0x5e')]('user_has_teams','ut',_0xc60f('0x5f'))[_0xc60f('0x45')](_0xc60f('0x60'),_0x1b45e1[_0xc60f('0x29')]['id']);for(var _0x1a1b23=0x0;_0x1a1b23<_0x52b417['length'];_0x1a1b23+=0x1){let _0x3986e3=_0x52b417[_0x1a1b23];for(var _0x13ca64=0x0;_0x13ca64<_0x3986e3[_0xc60f('0x55')]['length'];_0x13ca64+=0x1){let _0x98dc77=_0x3986e3[_0xc60f('0x55')][_0x13ca64];var _0x3c420e=_0x4d4656[_0xc60f('0x61')]();_0x3c420e[_0xc60f('0x45')](_0xc60f('0x62'),_0x98dc77['id']);_0x3212d7['push'](db[_0xc60f('0x63')][_0xc60f('0x26')](_0x3c420e[_0xc60f('0x64')](),{'type':db['sequelize']['QueryTypes'][_0xc60f('0x65')]})[_0xc60f('0x18')](function(_0x1dd716){if(_0x1dd716['length']===0x1){return _0x98dc77['id'];}else{var _0x4e4625=_[_0xc60f('0x66')](_[_0xc60f('0x1e')](_0x1dd716,_0xc60f('0x67')),function(_0x1e0dec){return _[_0xc60f('0x68')](_0xd51d1a,_0x1e0dec);});if(_0x4e4625){return _0x98dc77['id'];}}}));}}return BPromise[_0xc60f('0x69')](_0x3212d7)['then'](function(_0x19182d){_0x52aeac=_(_0x52aeac)[_0xc60f('0x6a')](_0x19182d)[_0xc60f('0x6b')]()[_0xc60f('0x6c')]();return db[_0xc60f('0x1f')]['find']({'where':{'id':_0x1b45e1[_0xc60f('0x29')]['id']}})['then'](function(_0x30958f){return db[_0xc60f('0x63')]['transaction'](function(_0x1567d2){return _0x30958f['removeTeams'](_0x1b45e1[_0xc60f('0x26')][_0xc60f('0x6d')],{'transaction':_0x1567d2})[_0xc60f('0x18')](function(){if(!_['isEmpty'](_0x52aeac)){return _0x30958f[_0xc60f('0x6e')](_0x52aeac,{'transaction':_0x1567d2});}})['then'](function(){_0x52aeac[_0xc60f('0x6f')](function(_0x416ceb){socket[_0xc60f('0x70')]('userOpenchannelQueue:remove',{'UserId':_0x416ceb,'OpenchannelQueueId':_0x30958f['id']});});});});});});})[_0xc60f('0x18')](respondWithStatusCode(_0x17a5b7,null))[_0xc60f('0x3c')](handleError(_0x17a5b7,null));};exports['addAgents']=function(_0x1905d6,_0x553b63){return db[_0xc60f('0x1f')]['find']({'where':{'id':_0x1905d6[_0xc60f('0x29')]['id']}})[_0xc60f('0x18')](handleEntityNotFound(_0x553b63,null))[_0xc60f('0x18')](function(_0x1e7398){if(_0x1e7398){return _0x1e7398[_0xc60f('0x71')](_0x1905d6['body'][_0xc60f('0x6d')],_[_0xc60f('0x72')](_0x1905d6['body'],['ids','id'])||{})[_0xc60f('0x73')](function(_0x9f14d7){for(var _0x11cb98=0x0;_0x11cb98<_0x1905d6[_0xc60f('0x35')][_0xc60f('0x6d')][_0xc60f('0x41')];_0x11cb98+=0x1){socket[_0xc60f('0x70')](_0xc60f('0x58'),{'UserId':Number(_0x1905d6[_0xc60f('0x35')]['ids'][_0x11cb98]),'OpenchannelQueueId':Number(_0x1905d6[_0xc60f('0x29')]['id'])});}return _0x9f14d7;});}})[_0xc60f('0x18')](respondWithResult(_0x553b63,null))[_0xc60f('0x3c')](handleError(_0x553b63,null));};exports[_0xc60f('0x6e')]=function(_0x1f0619,_0x291efe){return db['OpenchannelQueue'][_0xc60f('0x33')]({'where':{'id':_0x1f0619[_0xc60f('0x29')]['id']}})[_0xc60f('0x18')](handleEntityNotFound(_0x291efe,null))[_0xc60f('0x18')](function(_0x4edfc2){if(_0x4edfc2){return _0x4edfc2[_0xc60f('0x6e')](_0x1f0619[_0xc60f('0x26')][_0xc60f('0x6d')])['then'](function(){if(_['isArray'](_0x1f0619[_0xc60f('0x26')]['ids'])){for(var _0x2b929b=0x0;_0x2b929b<_0x1f0619[_0xc60f('0x26')][_0xc60f('0x6d')]['length'];_0x2b929b+=0x1){socket[_0xc60f('0x70')]('userOpenchannelQueue:remove',{'UserId':Number(_0x1f0619[_0xc60f('0x26')]['ids'][_0x2b929b]),'OpenchannelQueueId':Number(_0x1f0619['params']['id'])});}}else{socket[_0xc60f('0x70')](_0xc60f('0x74'),{'UserId':Number(_0x1f0619[_0xc60f('0x26')][_0xc60f('0x6d')]),'OpenchannelQueueId':Number(_0x1f0619[_0xc60f('0x29')]['id'])});}});}})[_0xc60f('0x18')](respondWithStatusCode(_0x291efe,null))[_0xc60f('0x3c')](handleError(_0x291efe,null));};exports['getAgents']=function(_0x71371d,_0x4b119f){var _0x116ed4={};var _0x514961={};var _0x122029;var _0x241d9b;return db[_0xc60f('0x1f')][_0xc60f('0x40')]({'where':{'id':_0x71371d[_0xc60f('0x29')]['id']}})['then'](handleEntityNotFound(_0x4b119f,null))[_0xc60f('0x18')](function(_0x5d10e0){if(_0x5d10e0){_0x122029=_0x5d10e0;_0x514961[_0xc60f('0x2a')]=_['keys'](db[_0xc60f('0x49')][_0xc60f('0x20')]);_0x514961[_0xc60f('0x26')]=_['keys'](_0x71371d[_0xc60f('0x26')]);_0x514961['filters']=_[_0xc60f('0x2e')](_0x514961[_0xc60f('0x2a')],_0x514961['query']);_0x116ed4[_0xc60f('0x2d')]=_[_0xc60f('0x2e')](_0x514961[_0xc60f('0x2a')],qs[_0xc60f('0x2f')](_0x71371d['query']['fields']));_0x116ed4[_0xc60f('0x2d')]=_0x116ed4[_0xc60f('0x2d')][_0xc60f('0x41')]?_0x116ed4[_0xc60f('0x2d')]:_0x514961['model'];_0x116ed4[_0xc60f('0x43')]=qs['sort'](_0x71371d['query'][_0xc60f('0x44')]);_0x116ed4[_0xc60f('0x45')]=qs['filters'](_[_0xc60f('0x46')](_0x71371d[_0xc60f('0x26')],_0x514961[_0xc60f('0x2c')]));if(_0x71371d[_0xc60f('0x26')][_0xc60f('0x47')]){_0x116ed4['where']=_['merge'](_0x116ed4[_0xc60f('0x45')],{'$or':_[_0xc60f('0x1e')](_0x116ed4[_0xc60f('0x2d')],function(_0x21b218){var _0x37b442={};_0x37b442[_0x21b218]={'$like':'%'+_0x71371d[_0xc60f('0x26')][_0xc60f('0x47')]+'%'};return _0x37b442;})});}_0x116ed4=_[_0xc60f('0x31')]({},_0x116ed4,_0x71371d[_0xc60f('0x32')]);return _0x122029[_0xc60f('0x75')](_0x116ed4);}})[_0xc60f('0x18')](function(_0x9fa46){if(_0x9fa46){_0x241d9b=_0x9fa46[_0xc60f('0x41')];if(!_0x71371d[_0xc60f('0x26')][_0xc60f('0x42')](_0xc60f('0x52'))){_0x116ed4[_0xc60f('0x13')]=qs[_0xc60f('0x13')](_0x71371d[_0xc60f('0x26')][_0xc60f('0x13')]);_0x116ed4['offset']=qs[_0xc60f('0x10')](_0x71371d[_0xc60f('0x26')][_0xc60f('0x10')]);}return _0x122029[_0xc60f('0x75')](_0x116ed4);}})[_0xc60f('0x18')](function(_0x5fc078){if(_0x5fc078){return _0x5fc078?{'count':_0x241d9b,'rows':_0x5fc078}:null;}})[_0xc60f('0x18')](respondWithResult(_0x4b119f,null))[_0xc60f('0x3c')](handleError(_0x4b119f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 8db97db..138dcae 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 _0x9ff4=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0x9ff4,0x1ad));var _0x49ff=function(_0x4b8b44,_0x4bdc69){_0x4b8b44=_0x4b8b44-0x0;var _0x3d1fd1=_0x9ff4[_0x4b8b44];return _0x3d1fd1;};'use strict';var EventEmitter=require(_0x49ff('0x0'));var OpenchannelQueue=require(_0x49ff('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x49ff('0x2')](0x0);var events={'afterCreate':_0x49ff('0x3'),'afterUpdate':'update','afterDestroy':_0x49ff('0x4')};function emitEvent(_0x5adb84){return function(_0x3e16f5,_0x1a612e,_0x296e0f){OpenchannelQueueEvents['emit'](_0x5adb84+':'+_0x3e16f5['id'],_0x3e16f5);OpenchannelQueueEvents[_0x49ff('0x5')](_0x5adb84,_0x3e16f5);_0x296e0f(null);};}for(var e in events){if(events[_0x49ff('0x6')](e)){var event=events[e];OpenchannelQueue[_0x49ff('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xa2f4=['update','emit','hook','exports','events','OpenchannelQueue','setMaxListeners','save'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa2f4,0x1a4));var _0x4a2f=function(_0x29107e,_0x26c7e7){_0x29107e=_0x29107e-0x0;var _0x55e177=_0xa2f4[_0x29107e];return _0x55e177;};'use strict';var EventEmitter=require(_0x4a2f('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x4a2f('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x4a2f('0x2')](0x0);var events={'afterCreate':_0x4a2f('0x3'),'afterUpdate':_0x4a2f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x91bd71){return function(_0x3073cf,_0x5a16dd,_0x465b46){OpenchannelQueueEvents[_0x4a2f('0x5')](_0x91bd71+':'+_0x3073cf['id'],_0x3073cf);OpenchannelQueueEvents[_0x4a2f('0x5')](_0x91bd71,_0x3073cf);_0x465b46(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x4a2f('0x6')](e,emitEvent(event));}}module[_0x4a2f('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 68d1a8f..f2d9d96 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 _0xcd7c=['OpenchannelQueue','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define'];(function(_0x207aff,_0x45d8d7){var _0x76daad=function(_0x3d7c31){while(--_0x3d7c31){_0x207aff['push'](_0x207aff['shift']());}};_0x76daad(++_0x45d8d7);}(_0xcd7c,0x11f));var _0xccd7=function(_0x86c22d,_0x254478){_0x86c22d=_0x86c22d-0x0;var _0x1c3eff=_0xcd7c[_0x86c22d];return _0x1c3eff;};'use strict';var _=require(_0xccd7('0x0'));var util=require(_0xccd7('0x1'));var logger=require(_0xccd7('0x2'))(_0xccd7('0x3'));var moment=require(_0xccd7('0x4'));var BPromise=require('bluebird');var rp=require(_0xccd7('0x5'));var fs=require('fs');var path=require(_0xccd7('0x6'));var rimraf=require(_0xccd7('0x7'));var config=require(_0xccd7('0x8'));var attributes=require(_0xccd7('0x9'));module[_0xccd7('0xa')]=function(_0x1e7cdc,_0x339c87){return _0x1e7cdc[_0xccd7('0xb')](_0xccd7('0xc'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe030=['moment','request-promise','path','rimraf','exports','define','OpenchannelQueue','lodash','../../config/logger','api'];(function(_0x28d05a,_0x4345c3){var _0x5c2ca0=function(_0x1b5006){while(--_0x1b5006){_0x28d05a['push'](_0x28d05a['shift']());}};_0x5c2ca0(++_0x4345c3);}(_0xe030,0x75));var _0x0e03=function(_0x33b59b,_0x20fb08){_0x33b59b=_0x33b59b-0x0;var _0xc188d5=_0xe030[_0x33b59b];return _0xc188d5;};'use strict';var _=require(_0x0e03('0x0'));var util=require('util');var logger=require(_0x0e03('0x1'))(_0x0e03('0x2'));var moment=require(_0x0e03('0x3'));var BPromise=require('bluebird');var rp=require(_0x0e03('0x4'));var fs=require('fs');var path=require(_0x0e03('0x5'));var rimraf=require(_0x0e03('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x0e03('0x7')]=function(_0x11e48f,_0x356634){return _0x11e48f[_0x0e03('0x8')](_0x0e03('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 766b5f9..9fa06d0 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 _0x0446=['OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','GetOpenchannelQueue','find','ShowOpenchannelQueue','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x1daffe,_0x1cb8e9){var _0x42fada=function(_0x25a7c3){while(--_0x25a7c3){_0x1daffe['push'](_0x1daffe['shift']());}};_0x42fada(++_0x1cb8e9);}(_0x0446,0xc1));var _0x6044=function(_0x3f3353,_0x502cfb){_0x3f3353=_0x3f3353-0x0;var _0x1d7fc4=_0x0446[_0x3f3353];return _0x1d7fc4;};'use strict';var _=require(_0x6044('0x0'));var util=require(_0x6044('0x1'));var moment=require(_0x6044('0x2'));var BPromise=require('bluebird');var rs=require(_0x6044('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6044('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6044('0x5'))(_0x6044('0x6'));var config=require(_0x6044('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6044('0x8')][_0x6044('0x9')]({'port':0x232a});config[_0x6044('0xa')]=_['defaults'](config[_0x6044('0xa')],{'host':_0x6044('0xb'),'port':0x18eb});var socket=require(_0x6044('0xc'))(new Redis(config[_0x6044('0xa')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x46e9c6,_0x23e4a2,_0xfae9fc){return new BPromise(function(_0x26eb9f,_0x4039b9){return client['request'](_0x46e9c6,_0xfae9fc)[_0x6044('0xd')](function(_0x3801c6){logger[_0x6044('0xe')](_0x6044('0xf'),_0x23e4a2,_0x6044('0x10'));logger[_0x6044('0x11')](_0x6044('0x12'),_0x23e4a2,_0x6044('0x10'),JSON['stringify'](_0x3801c6));if(_0x3801c6[_0x6044('0x13')]){if(_0x3801c6[_0x6044('0x13')][_0x6044('0x14')]===0x1f4){logger[_0x6044('0x13')](_0x6044('0xf'),_0x23e4a2,_0x3801c6[_0x6044('0x13')][_0x6044('0x15')]);return _0x4039b9(_0x3801c6[_0x6044('0x13')][_0x6044('0x15')]);}logger[_0x6044('0x13')](_0x6044('0xf'),_0x23e4a2,_0x3801c6['error']['message']);return _0x26eb9f(_0x3801c6[_0x6044('0x13')][_0x6044('0x15')]);}else{logger[_0x6044('0xe')](_0x6044('0xf'),_0x23e4a2,_0x6044('0x10'));_0x26eb9f(_0x3801c6['result'][_0x6044('0x15')]);}})[_0x6044('0x16')](function(_0x50051c){logger[_0x6044('0x13')](_0x6044('0xf'),_0x23e4a2,_0x50051c);_0x4039b9(_0x50051c);});});}exports['GetOpenchannelQueue']=function(_0x30c3b9){var _0x55348f=this;return new Promise(function(_0xfbdce,_0x536ca1){return db[_0x6044('0x17')][_0x6044('0x18')]({'raw':_0x30c3b9[_0x6044('0x19')]?_0x30c3b9[_0x6044('0x19')][_0x6044('0x1a')]===undefined?!![]:![]:!![],'where':_0x30c3b9[_0x6044('0x19')]?_0x30c3b9[_0x6044('0x19')][_0x6044('0x1b')]||null:null,'attributes':_0x30c3b9[_0x6044('0x19')]?_0x30c3b9[_0x6044('0x19')][_0x6044('0x1c')]||null:null,'limit':_0x30c3b9[_0x6044('0x19')]?_0x30c3b9[_0x6044('0x19')]['limit']||null:null,'include':_0x30c3b9['options']?_0x30c3b9[_0x6044('0x19')][_0x6044('0x1d')]?_[_0x6044('0x1e')](_0x30c3b9[_0x6044('0x19')][_0x6044('0x1d')],function(_0x584647){return{'model':db[_0x584647['model']],'as':_0x584647['as'],'attributes':_0x584647['attributes'],'include':_0x584647[_0x6044('0x1d')]?_[_0x6044('0x1e')](_0x584647[_0x6044('0x1d')],function(_0x5ae618){return{'model':db[_0x5ae618[_0x6044('0x1f')]],'as':_0x5ae618['as'],'attributes':_0x5ae618['attributes'],'include':_0x5ae618[_0x6044('0x1d')]?_['map'](_0x5ae618[_0x6044('0x1d')],function(_0x1ba6bf){return{'model':db[_0x1ba6bf['model']],'as':_0x1ba6bf['as'],'attributes':_0x1ba6bf['attributes']};}):[]};}):[]};}):[]:[]})[_0x6044('0xd')](function(_0xde7dc5){logger[_0x6044('0xe')]('GetOpenchannelQueue',_0x30c3b9);logger['debug'](_0x6044('0x20'),_0x30c3b9,JSON['stringify'](_0xde7dc5));_0xfbdce(_0xde7dc5);})[_0x6044('0x16')](function(_0x2f22c0){logger[_0x6044('0x13')]('GetOpenchannelQueue',_0x2f22c0[_0x6044('0x15')],_0x30c3b9);_0x536ca1(_0x55348f['error'](0x1f4,_0x2f22c0['message']));});});};exports['ShowOpenchannelQueue']=function(_0x116af3){var _0x233a47=this;return new Promise(function(_0x34b5fe,_0x2eb0ec){return db[_0x6044('0x17')][_0x6044('0x21')]({'raw':_0x116af3[_0x6044('0x19')]?_0x116af3[_0x6044('0x19')][_0x6044('0x1a')]===undefined?!![]:![]:!![],'where':_0x116af3[_0x6044('0x19')]?_0x116af3[_0x6044('0x19')][_0x6044('0x1b')]||null:null,'attributes':_0x116af3[_0x6044('0x19')]?_0x116af3[_0x6044('0x19')]['attributes']||null:null,'include':_0x116af3[_0x6044('0x19')]?_0x116af3[_0x6044('0x19')][_0x6044('0x1d')]?_[_0x6044('0x1e')](_0x116af3[_0x6044('0x19')][_0x6044('0x1d')],function(_0x3dcdfa){return{'model':db[_0x3dcdfa['model']],'as':_0x3dcdfa['as'],'attributes':_0x3dcdfa['attributes'],'include':_0x3dcdfa['include']?_[_0x6044('0x1e')](_0x3dcdfa[_0x6044('0x1d')],function(_0x271abb){return{'model':db[_0x271abb[_0x6044('0x1f')]],'as':_0x271abb['as'],'attributes':_0x271abb[_0x6044('0x1c')],'include':_0x271abb[_0x6044('0x1d')]?_['map'](_0x271abb[_0x6044('0x1d')],function(_0x205fb6){return{'model':db[_0x205fb6[_0x6044('0x1f')]],'as':_0x205fb6['as'],'attributes':_0x205fb6[_0x6044('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e591b){logger[_0x6044('0xe')]('ShowOpenchannelQueue',_0x116af3);logger[_0x6044('0x11')](_0x6044('0x22'),_0x116af3,JSON[_0x6044('0x23')](_0x3e591b));_0x34b5fe(_0x3e591b);})['catch'](function(_0x501e5c){logger[_0x6044('0x13')](_0x6044('0x22'),_0x501e5c['message'],_0x116af3);_0x2eb0ec(_0x233a47[_0x6044('0x13')](0x1f4,_0x501e5c['message']));});});}; \ No newline at end of file +var _0xe6b6=['defaults','localhost','./openchannelQueue.socket','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x432455,_0x16b2b7){var _0xcc19b2=function(_0x22b852){while(--_0x22b852){_0x432455['push'](_0x432455['shift']());}};_0xcc19b2(++_0x16b2b7);}(_0xe6b6,0x98));var _0x6e6b=function(_0x4d5615,_0x531870){_0x4d5615=_0x4d5615-0x0;var _0x2c2059=_0xe6b6[_0x4d5615];return _0x2c2059;};'use strict';var _=require(_0x6e6b('0x0'));var util=require('util');var moment=require(_0x6e6b('0x1'));var BPromise=require(_0x6e6b('0x2'));var rs=require(_0x6e6b('0x3'));var fs=require('fs');var Redis=require(_0x6e6b('0x4'));var db=require(_0x6e6b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e6b('0x6'))(_0x6e6b('0x7'));var config=require(_0x6e6b('0x8'));var jayson=require(_0x6e6b('0x9'));var client=jayson[_0x6e6b('0xa')]['http']({'port':0x232a});config[_0x6e6b('0xb')]=_[_0x6e6b('0xc')](config[_0x6e6b('0xb')],{'host':_0x6e6b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6e6b('0xe'))['register'](socket);function respondWithRpcPromise(_0x5584ed,_0x5c8139,_0x91dca1){return new BPromise(function(_0x36a084,_0x5f2992){return client[_0x6e6b('0xf')](_0x5584ed,_0x91dca1)[_0x6e6b('0x10')](function(_0x41a02c){logger['info'](_0x6e6b('0x11'),_0x5c8139,_0x6e6b('0x12'));logger[_0x6e6b('0x13')](_0x6e6b('0x14'),_0x5c8139,'request\x20sent',JSON[_0x6e6b('0x15')](_0x41a02c));if(_0x41a02c[_0x6e6b('0x16')]){if(_0x41a02c[_0x6e6b('0x16')][_0x6e6b('0x17')]===0x1f4){logger[_0x6e6b('0x16')](_0x6e6b('0x11'),_0x5c8139,_0x41a02c[_0x6e6b('0x16')][_0x6e6b('0x18')]);return _0x5f2992(_0x41a02c[_0x6e6b('0x16')][_0x6e6b('0x18')]);}logger[_0x6e6b('0x16')](_0x6e6b('0x11'),_0x5c8139,_0x41a02c[_0x6e6b('0x16')][_0x6e6b('0x18')]);return _0x36a084(_0x41a02c[_0x6e6b('0x16')]['message']);}else{logger[_0x6e6b('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x5c8139,_0x6e6b('0x12'));_0x36a084(_0x41a02c[_0x6e6b('0x1a')][_0x6e6b('0x18')]);}})[_0x6e6b('0x1b')](function(_0x52ef9e){logger[_0x6e6b('0x16')](_0x6e6b('0x11'),_0x5c8139,_0x52ef9e);_0x5f2992(_0x52ef9e);});});}exports[_0x6e6b('0x1c')]=function(_0x54990c){var _0xf94ed4=this;return new Promise(function(_0xc6af8d,_0x5e24c6){return db[_0x6e6b('0x1d')][_0x6e6b('0x1e')]({'raw':_0x54990c[_0x6e6b('0x1f')]?_0x54990c['options'][_0x6e6b('0x20')]===undefined?!![]:![]:!![],'where':_0x54990c['options']?_0x54990c[_0x6e6b('0x1f')][_0x6e6b('0x21')]||null:null,'attributes':_0x54990c[_0x6e6b('0x1f')]?_0x54990c[_0x6e6b('0x1f')][_0x6e6b('0x22')]||null:null,'limit':_0x54990c[_0x6e6b('0x1f')]?_0x54990c[_0x6e6b('0x1f')][_0x6e6b('0x23')]||null:null,'include':_0x54990c[_0x6e6b('0x1f')]?_0x54990c[_0x6e6b('0x1f')][_0x6e6b('0x24')]?_[_0x6e6b('0x25')](_0x54990c[_0x6e6b('0x1f')]['include'],function(_0x4901ee){return{'model':db[_0x4901ee[_0x6e6b('0x26')]],'as':_0x4901ee['as'],'attributes':_0x4901ee[_0x6e6b('0x22')],'include':_0x4901ee[_0x6e6b('0x24')]?_[_0x6e6b('0x25')](_0x4901ee[_0x6e6b('0x24')],function(_0x3f2a1a){return{'model':db[_0x3f2a1a[_0x6e6b('0x26')]],'as':_0x3f2a1a['as'],'attributes':_0x3f2a1a[_0x6e6b('0x22')],'include':_0x3f2a1a[_0x6e6b('0x24')]?_[_0x6e6b('0x25')](_0x3f2a1a['include'],function(_0x2c8edb){return{'model':db[_0x2c8edb[_0x6e6b('0x26')]],'as':_0x2c8edb['as'],'attributes':_0x2c8edb[_0x6e6b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6e6b('0x10')](function(_0x2d4486){logger[_0x6e6b('0x19')](_0x6e6b('0x1c'),_0x54990c);logger[_0x6e6b('0x13')]('GetOpenchannelQueue',_0x54990c,JSON[_0x6e6b('0x15')](_0x2d4486));_0xc6af8d(_0x2d4486);})[_0x6e6b('0x1b')](function(_0x22e669){logger[_0x6e6b('0x16')]('GetOpenchannelQueue',_0x22e669[_0x6e6b('0x18')],_0x54990c);_0x5e24c6(_0xf94ed4[_0x6e6b('0x16')](0x1f4,_0x22e669['message']));});});};exports[_0x6e6b('0x27')]=function(_0x52ed77){var _0x487e05=this;return new Promise(function(_0x305087,_0x2dda3e){return db['OpenchannelQueue'][_0x6e6b('0x28')]({'raw':_0x52ed77['options']?_0x52ed77[_0x6e6b('0x1f')][_0x6e6b('0x20')]===undefined?!![]:![]:!![],'where':_0x52ed77[_0x6e6b('0x1f')]?_0x52ed77[_0x6e6b('0x1f')][_0x6e6b('0x21')]||null:null,'attributes':_0x52ed77[_0x6e6b('0x1f')]?_0x52ed77[_0x6e6b('0x1f')][_0x6e6b('0x22')]||null:null,'include':_0x52ed77[_0x6e6b('0x1f')]?_0x52ed77[_0x6e6b('0x1f')][_0x6e6b('0x24')]?_['map'](_0x52ed77['options'][_0x6e6b('0x24')],function(_0x470c03){return{'model':db[_0x470c03[_0x6e6b('0x26')]],'as':_0x470c03['as'],'attributes':_0x470c03[_0x6e6b('0x22')],'include':_0x470c03[_0x6e6b('0x24')]?_[_0x6e6b('0x25')](_0x470c03[_0x6e6b('0x24')],function(_0x125a8b){return{'model':db[_0x125a8b[_0x6e6b('0x26')]],'as':_0x125a8b['as'],'attributes':_0x125a8b[_0x6e6b('0x22')],'include':_0x125a8b['include']?_[_0x6e6b('0x25')](_0x125a8b[_0x6e6b('0x24')],function(_0x2d49f8){return{'model':db[_0x2d49f8[_0x6e6b('0x26')]],'as':_0x2d49f8['as'],'attributes':_0x2d49f8['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e6b('0x10')](function(_0x22fa8b){logger[_0x6e6b('0x19')](_0x6e6b('0x27'),_0x52ed77);logger['debug'](_0x6e6b('0x27'),_0x52ed77,JSON[_0x6e6b('0x15')](_0x22fa8b));_0x305087(_0x22fa8b);})[_0x6e6b('0x1b')](function(_0x1cb8bc){logger['error'](_0x6e6b('0x27'),_0x1cb8bc[_0x6e6b('0x18')],_0x52ed77);_0x2dda3e(_0x487e05[_0x6e6b('0x16')](0x1f4,_0x1cb8bc[_0x6e6b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 17b63a8..eece504 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 _0xd1d8=['./openchannelQueue.events','save','remove','emit','removeListener','register','length','openchannelQueue:'];(function(_0x225fc5,_0x283553){var _0x62625f=function(_0x1e65fa){while(--_0x1e65fa){_0x225fc5['push'](_0x225fc5['shift']());}};_0x62625f(++_0x283553);}(_0xd1d8,0x1b0));var _0x8d1d=function(_0x41c99a,_0x12414d){_0x41c99a=_0x41c99a-0x0;var _0x303bf9=_0xd1d8[_0x41c99a];return _0x303bf9;};'use strict';var OpenchannelQueueEvents=require(_0x8d1d('0x0'));var events=[_0x8d1d('0x1'),_0x8d1d('0x2'),'update'];function createListener(_0x4e7309,_0xb247dd){return function(_0x5a20e1){_0xb247dd[_0x8d1d('0x3')](_0x4e7309,_0x5a20e1);};}function removeListener(_0x1256a3,_0xc41392){return function(){OpenchannelQueueEvents[_0x8d1d('0x4')](_0x1256a3,_0xc41392);};}exports[_0x8d1d('0x5')]=function(_0x1c8b66){for(var _0x43ba89=0x0,_0x1bb4dc=events[_0x8d1d('0x6')];_0x43ba89<_0x1bb4dc;_0x43ba89++){var _0x20c581=events[_0x43ba89];var _0xe3aee7=createListener(_0x8d1d('0x7')+_0x20c581,_0x1c8b66);OpenchannelQueueEvents['on'](_0x20c581,_0xe3aee7);}}; \ No newline at end of file +var _0xdeab=['openchannelQueue:','./openchannelQueue.events','save','remove','emit','removeListener','register','length'];(function(_0x122633,_0x22057b){var _0x2d02e5=function(_0x420024){while(--_0x420024){_0x122633['push'](_0x122633['shift']());}};_0x2d02e5(++_0x22057b);}(_0xdeab,0x1a9));var _0xbdea=function(_0x116611,_0x491d7b){_0x116611=_0x116611-0x0;var _0xb7b767=_0xdeab[_0x116611];return _0xb7b767;};'use strict';var OpenchannelQueueEvents=require(_0xbdea('0x0'));var events=[_0xbdea('0x1'),_0xbdea('0x2'),'update'];function createListener(_0x352639,_0x12013f){return function(_0x21b147){_0x12013f[_0xbdea('0x3')](_0x352639,_0x21b147);};}function removeListener(_0x364799,_0x138bf7){return function(){OpenchannelQueueEvents[_0xbdea('0x4')](_0x364799,_0x138bf7);};}exports[_0xbdea('0x5')]=function(_0x5c2217){for(var _0x509dda=0x0,_0x7c2b43=events[_0xbdea('0x6')];_0x509dda<_0x7c2b43;_0x509dda++){var _0x1d9bb1=events[_0x509dda];var _0x2cd736=createListener(_0xbdea('0x7')+_0x1d9bb1,_0x5c2217);OpenchannelQueueEvents['on'](_0x1d9bb1,_0x2cd736);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 7329b55..1a62afa 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 _0xee39=['update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xee39,0x1a6));var _0x9ee3=function(_0x2c760e,_0x3ec654){_0x2c760e=_0x2c760e-0x0;var _0x167283=_0xee39[_0x2c760e];return _0x167283;};'use strict';var multer=require(_0x9ee3('0x0'));var util=require('util');var path=require(_0x9ee3('0x1'));var timeout=require(_0x9ee3('0x2'));var express=require(_0x9ee3('0x3'));var router=express['Router']();var fs_extra=require(_0x9ee3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9ee3('0x5'));var config=require('../../config/environment');var controller=require(_0x9ee3('0x6'));router[_0x9ee3('0x7')]('/',auth[_0x9ee3('0x8')](),controller['index']);router['get'](_0x9ee3('0x9'),auth[_0x9ee3('0x8')](),controller[_0x9ee3('0xa')]);router[_0x9ee3('0x7')](_0x9ee3('0xb'),auth[_0x9ee3('0x8')](),controller[_0x9ee3('0xc')]);router[_0x9ee3('0xd')]('/',auth[_0x9ee3('0x8')](),controller['create']);router[_0x9ee3('0xe')]('/:id',auth[_0x9ee3('0x8')](),controller[_0x9ee3('0xf')]);router[_0x9ee3('0x10')](_0x9ee3('0xb'),auth[_0x9ee3('0x8')](),controller[_0x9ee3('0x11')]);module[_0x9ee3('0x12')]=router; \ No newline at end of file +var _0xa7a8=['show','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7a8,0x1c2));var _0x8a7a=function(_0x256a23,_0x9f873a){_0x256a23=_0x256a23-0x0;var _0x1eb6ee=_0xa7a8[_0x256a23];return _0x1eb6ee;};'use strict';var multer=require(_0x8a7a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8a7a('0x1'));var express=require(_0x8a7a('0x2'));var router=express[_0x8a7a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8a7a('0x4'));var config=require(_0x8a7a('0x5'));var controller=require(_0x8a7a('0x6'));router[_0x8a7a('0x7')]('/',auth['isAuthenticated'](),controller[_0x8a7a('0x8')]);router['get'](_0x8a7a('0x9'),auth[_0x8a7a('0xa')](),controller[_0x8a7a('0xb')]);router['get']('/:id',auth[_0x8a7a('0xa')](),controller[_0x8a7a('0xc')]);router[_0x8a7a('0xd')]('/',auth[_0x8a7a('0xa')](),controller[_0x8a7a('0xe')]);router[_0x8a7a('0xf')](_0x8a7a('0x10'),auth[_0x8a7a('0xa')](),controller[_0x8a7a('0x11')]);router[_0x8a7a('0x12')](_0x8a7a('0x10'),auth[_0x8a7a('0xa')](),controller[_0x8a7a('0x13')]);module[_0x8a7a('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 62556c8..16a5b4e 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 _0x84cc=['STRING','DATE','moment','exports'];(function(_0x497aaa,_0x4cae2b){var _0x4dcd92=function(_0x1dc3a9){while(--_0x1dc3a9){_0x497aaa['push'](_0x497aaa['shift']());}};_0x4dcd92(++_0x4cae2b);}(_0x84cc,0x1c6));var _0xc84c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x84cc[_0x1ac595];return _0x455fff;};'use strict';var moment=require(_0xc84c('0x0'));var Sequelize=require('sequelize');module[_0xc84c('0x1')]={'uniqueid':{'type':Sequelize[_0xc84c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc84c('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc84c('0x3')]},'acceptAt':{'type':Sequelize[_0xc84c('0x3')]},'exitAt':{'type':Sequelize[_0xc84c('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x28ff=['STRING','DATE','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28ff,0x7a));var _0xf28f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x28ff[_0x3ab51d];return _0x29a04e;};'use strict';var moment=require('moment');var Sequelize=require(_0xf28f('0x0'));module[_0xf28f('0x1')]={'uniqueid':{'type':Sequelize[_0xf28f('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf28f('0x3')]},'leaveAt':{'type':Sequelize[_0xf28f('0x3')]},'acceptAt':{'type':Sequelize[_0xf28f('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xf28f('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 9d4a8ce..bf48b7a 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 _0x8dc5=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','index','OpenchannelQueueReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis'];(function(_0x22b4ba,_0x2cf957){var _0x5433b6=function(_0xbff899){while(--_0xbff899){_0x22b4ba['push'](_0x22b4ba['shift']());}};_0x5433b6(++_0x2cf957);}(_0x8dc5,0x122));var _0x58dc=function(_0x46aa6f,_0xf7b072){_0x46aa6f=_0x46aa6f-0x0;var _0x44759c=_0x8dc5[_0x46aa6f];return _0x44759c;};'use strict';var emlformat=require(_0x58dc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x58dc('0x1'));var jsonpatch=require(_0x58dc('0x2'));var rp=require(_0x58dc('0x3'));var moment=require(_0x58dc('0x4'));var BPromise=require(_0x58dc('0x5'));var Mustache=require(_0x58dc('0x6'));var util=require(_0x58dc('0x7'));var path=require(_0x58dc('0x8'));var sox=require(_0x58dc('0x9'));var csv=require(_0x58dc('0xa'));var ejs=require(_0x58dc('0xb'));var fs=require('fs');var fs_extra=require(_0x58dc('0xc'));var _=require(_0x58dc('0xd'));var squel=require(_0x58dc('0xe'));var crypto=require(_0x58dc('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x58dc('0x10'));var toCsv=require(_0x58dc('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x58dc('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x58dc('0x12'));var hardwareService=require(_0x58dc('0x13'));var logger=require(_0x58dc('0x14'))(_0x58dc('0x15'));var utils=require(_0x58dc('0x16'));var config=require(_0x58dc('0x17'));var licenseUtil=require(_0x58dc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d269f,_0x244e89){_0x244e89=_0x244e89||0xcc;return function(_0x5983b5){if(_0x5983b5){return _0x5d269f[_0x58dc('0x19')](_0x244e89);}return _0x5d269f[_0x58dc('0x1a')](_0x244e89)[_0x58dc('0x1b')]();};}function respondWithResult(_0x1be8b4,_0x2f2078){_0x2f2078=_0x2f2078||0xc8;return function(_0xb8aa2b){if(_0xb8aa2b){return _0x1be8b4[_0x58dc('0x1a')](_0x2f2078)[_0x58dc('0x1c')](_0xb8aa2b);}};}function respondWithFilteredResult(_0x55660b,_0xa244d8){return function(_0xcd6abe){if(_0xcd6abe){var _0x465cbe=typeof _0xa244d8[_0x58dc('0x1d')]===_0x58dc('0x1e')&&typeof _0xa244d8[_0x58dc('0x1f')]===_0x58dc('0x1e');var _0x574bcb=_0xcd6abe[_0x58dc('0x20')];var _0x13e83e=_0x465cbe?0x0:_0xa244d8[_0x58dc('0x1d')];var _0x1c2247=_0x465cbe?_0xcd6abe['count']:_0xa244d8[_0x58dc('0x1d')]+_0xa244d8[_0x58dc('0x1f')];var _0x1ae0e4;if(_0x1c2247>=_0x574bcb){_0x1c2247=_0x574bcb;_0x1ae0e4=0xc8;}else{_0x1ae0e4=0xce;}_0x55660b['status'](_0x1ae0e4);return _0x55660b[_0x58dc('0x21')]('Content-Range',_0x13e83e+'-'+_0x1c2247+'/'+_0x574bcb)[_0x58dc('0x1c')](_0xcd6abe);}return null;};}function patchUpdates(_0x5b2427){return function(_0x39491c){try{jsonpatch[_0x58dc('0x22')](_0x39491c,_0x5b2427,!![]);}catch(_0x49a994){return BPromise[_0x58dc('0x23')](_0x49a994);}return _0x39491c[_0x58dc('0x24')]();};}function saveUpdates(_0x20a951,_0x34a52a){return function(_0x1bfff1){if(_0x1bfff1){return _0x1bfff1[_0x58dc('0x25')](_0x20a951)[_0x58dc('0x26')](function(_0x1db62a){return _0x1db62a;});}return null;};}function removeEntity(_0x11b966,_0x2b1e81){return function(_0x5c15b1){if(_0x5c15b1){return _0x5c15b1[_0x58dc('0x27')]()[_0x58dc('0x26')](function(){_0x11b966[_0x58dc('0x1a')](0xcc)[_0x58dc('0x1b')]();});}};}function handleEntityNotFound(_0x323e94,_0x2a9458){return function(_0x1818c1){if(!_0x1818c1){_0x323e94[_0x58dc('0x19')](0x194);}return _0x1818c1;};}function handleError(_0x46aa13,_0x4739aa){_0x4739aa=_0x4739aa||0x1f4;return function(_0x328400){logger['error'](_0x328400[_0x58dc('0x28')]);if(_0x328400[_0x58dc('0x29')]){delete _0x328400[_0x58dc('0x29')];}_0x46aa13[_0x58dc('0x1a')](_0x4739aa)['send'](_0x328400);};}exports[_0x58dc('0x2a')]=function(_0x2326cb,_0x4a7b98){var _0x232d52={},_0xb63860={},_0x5436b7={'count':0x0,'rows':[]};var _0x5f2e9e=_['map'](db[_0x58dc('0x2b')][_0x58dc('0x2c')],function(_0x41c13e){return{'name':_0x41c13e[_0x58dc('0x2d')],'type':_0x41c13e[_0x58dc('0x2e')]['key']};});_0xb63860[_0x58dc('0x2f')]=_[_0x58dc('0x30')](_0x5f2e9e,_0x58dc('0x29'));_0xb63860[_0x58dc('0x31')]=_[_0x58dc('0x32')](_0x2326cb['query']);_0xb63860['filters']=_[_0x58dc('0x33')](_0xb63860[_0x58dc('0x2f')],_0xb63860[_0x58dc('0x31')]);_0x232d52['attributes']=_[_0x58dc('0x33')](_0xb63860[_0x58dc('0x2f')],qs[_0x58dc('0x34')](_0x2326cb['query'][_0x58dc('0x34')]));_0x232d52['attributes']=_0x232d52['attributes'][_0x58dc('0x35')]?_0x232d52[_0x58dc('0x36')]:_0xb63860['model'];if(!_0x2326cb[_0x58dc('0x31')][_0x58dc('0x37')](_0x58dc('0x38'))){_0x232d52[_0x58dc('0x1f')]=qs[_0x58dc('0x1f')](_0x2326cb[_0x58dc('0x31')][_0x58dc('0x1f')]);_0x232d52[_0x58dc('0x1d')]=qs[_0x58dc('0x1d')](_0x2326cb[_0x58dc('0x31')][_0x58dc('0x1d')]);}_0x232d52[_0x58dc('0x39')]=qs[_0x58dc('0x3a')](_0x2326cb[_0x58dc('0x31')][_0x58dc('0x3a')]);_0x232d52[_0x58dc('0x3b')]=qs['filters'](_[_0x58dc('0x3c')](_0x2326cb[_0x58dc('0x31')],_0xb63860[_0x58dc('0x3d')]),_0x5f2e9e);if(_0x2326cb[_0x58dc('0x31')][_0x58dc('0x3e')]){_0x232d52['where']=_[_0x58dc('0x3f')](_0x232d52[_0x58dc('0x3b')],{'$or':_[_0x58dc('0x30')](_0x5f2e9e,function(_0x1e74ae){if(_0x1e74ae[_0x58dc('0x2e')]!==_0x58dc('0x40')){var _0xaee8d6={};_0xaee8d6[_0x1e74ae[_0x58dc('0x29')]]={'$like':'%'+_0x2326cb[_0x58dc('0x31')][_0x58dc('0x3e')]+'%'};return _0xaee8d6;}})});}_0x232d52=_[_0x58dc('0x3f')]({},_0x232d52,_0x2326cb[_0x58dc('0x41')]);var _0x4f5273={'where':_0x232d52[_0x58dc('0x3b')]};return db[_0x58dc('0x2b')][_0x58dc('0x20')](_0x4f5273)[_0x58dc('0x26')](function(_0x14ce1d){_0x5436b7[_0x58dc('0x20')]=_0x14ce1d;if(_0x2326cb[_0x58dc('0x31')]['includeAll']){_0x232d52[_0x58dc('0x42')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x58dc('0x43')](_0x232d52);})[_0x58dc('0x26')](function(_0x2d8e03){_0x5436b7[_0x58dc('0x44')]=_0x2d8e03;return _0x5436b7;})[_0x58dc('0x26')](respondWithFilteredResult(_0x4a7b98,_0x232d52))[_0x58dc('0x45')](handleError(_0x4a7b98,null));};exports[_0x58dc('0x46')]=function(_0x5bd7c4,_0x453d1f){var _0x2361eb={'raw':!![],'where':{'id':_0x5bd7c4[_0x58dc('0x47')]['id']}},_0x2e2f38={};_0x2e2f38[_0x58dc('0x2f')]=_[_0x58dc('0x32')](db[_0x58dc('0x2b')][_0x58dc('0x2c')]);_0x2e2f38[_0x58dc('0x31')]=_[_0x58dc('0x32')](_0x5bd7c4[_0x58dc('0x31')]);_0x2e2f38[_0x58dc('0x3d')]=_[_0x58dc('0x33')](_0x2e2f38[_0x58dc('0x2f')],_0x2e2f38[_0x58dc('0x31')]);_0x2361eb[_0x58dc('0x36')]=_['intersection'](_0x2e2f38[_0x58dc('0x2f')],qs[_0x58dc('0x34')](_0x5bd7c4[_0x58dc('0x31')][_0x58dc('0x34')]));_0x2361eb['attributes']=_0x2361eb['attributes']['length']?_0x2361eb[_0x58dc('0x36')]:_0x2e2f38[_0x58dc('0x2f')];if(_0x5bd7c4[_0x58dc('0x31')][_0x58dc('0x48')]){_0x2361eb['include']=[{'all':!![]}];}_0x2361eb=_[_0x58dc('0x3f')]({},_0x2361eb,_0x5bd7c4['options']);return db[_0x58dc('0x2b')][_0x58dc('0x49')](_0x2361eb)[_0x58dc('0x26')](handleEntityNotFound(_0x453d1f,null))['then'](respondWithResult(_0x453d1f,null))[_0x58dc('0x45')](handleError(_0x453d1f,null));};exports[_0x58dc('0x4a')]=function(_0x58ffb7,_0x586e55){return db[_0x58dc('0x2b')][_0x58dc('0x4a')](_0x58ffb7['body'],{})[_0x58dc('0x26')](respondWithResult(_0x586e55,0xc9))['catch'](handleError(_0x586e55,null));};exports[_0x58dc('0x25')]=function(_0x7585dd,_0x424988){if(_0x7585dd[_0x58dc('0x4b')]['id']){delete _0x7585dd[_0x58dc('0x4b')]['id'];}return db[_0x58dc('0x2b')]['find']({'where':{'id':_0x7585dd[_0x58dc('0x47')]['id']}})[_0x58dc('0x26')](handleEntityNotFound(_0x424988,null))[_0x58dc('0x26')](saveUpdates(_0x7585dd[_0x58dc('0x4b')],null))[_0x58dc('0x26')](respondWithResult(_0x424988,null))[_0x58dc('0x45')](handleError(_0x424988,null));};exports[_0x58dc('0x27')]=function(_0x699144,_0x177612){return db[_0x58dc('0x2b')][_0x58dc('0x49')]({'where':{'id':_0x699144['params']['id']}})[_0x58dc('0x26')](handleEntityNotFound(_0x177612,null))[_0x58dc('0x26')](removeEntity(_0x177612,null))[_0x58dc('0x45')](handleError(_0x177612,null));};exports['describe']=function(_0x48231d,_0x4abb03){return db[_0x58dc('0x2b')][_0x58dc('0x4c')]()[_0x58dc('0x26')](respondWithResult(_0x4abb03,null))[_0x58dc('0x45')](handleError(_0x4abb03,null));}; \ No newline at end of file +var _0x00f5=['filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','params','keys','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','type','key','model','query'];(function(_0x190c2a,_0x2a593c){var _0x5f0a60=function(_0x4a5f23){while(--_0x4a5f23){_0x190c2a['push'](_0x190c2a['shift']());}};_0x5f0a60(++_0x2a593c);}(_0x00f5,0x183));var _0x500f=function(_0x3d7494,_0x5c7816){_0x3d7494=_0x3d7494-0x0;var _0xc56fa5=_0x00f5[_0x3d7494];return _0xc56fa5;};'use strict';var emlformat=require(_0x500f('0x0'));var rimraf=require(_0x500f('0x1'));var zipdir=require(_0x500f('0x2'));var jsonpatch=require(_0x500f('0x3'));var rp=require(_0x500f('0x4'));var moment=require(_0x500f('0x5'));var BPromise=require(_0x500f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x500f('0x7'));var sox=require('sox');var csv=require(_0x500f('0x8'));var ejs=require(_0x500f('0x9'));var fs=require('fs');var fs_extra=require(_0x500f('0xa'));var _=require('lodash');var squel=require(_0x500f('0xb'));var crypto=require(_0x500f('0xc'));var jsforce=require(_0x500f('0xd'));var deskjs=require(_0x500f('0xe'));var toCsv=require(_0x500f('0x8'));var querystring=require('querystring');var Papa=require(_0x500f('0xf'));var Redis=require('ioredis');var authService=require(_0x500f('0x10'));var qs=require(_0x500f('0x11'));var as=require(_0x500f('0x12'));var hardwareService=require(_0x500f('0x13'));var logger=require(_0x500f('0x14'))(_0x500f('0x15'));var utils=require(_0x500f('0x16'));var config=require(_0x500f('0x17'));var licenseUtil=require(_0x500f('0x18'));var db=require(_0x500f('0x19'))['db'];function respondWithStatusCode(_0x3c8e65,_0x45d402){_0x45d402=_0x45d402||0xcc;return function(_0x8d977b){if(_0x8d977b){return _0x3c8e65[_0x500f('0x1a')](_0x45d402);}return _0x3c8e65[_0x500f('0x1b')](_0x45d402)[_0x500f('0x1c')]();};}function respondWithResult(_0x130cc3,_0x2ab577){_0x2ab577=_0x2ab577||0xc8;return function(_0x3c3fa0){if(_0x3c3fa0){return _0x130cc3[_0x500f('0x1b')](_0x2ab577)['json'](_0x3c3fa0);}};}function respondWithFilteredResult(_0x2731a6,_0x35fa85){return function(_0x3e8b1a){if(_0x3e8b1a){var _0x1871f2=typeof _0x35fa85['offset']===_0x500f('0x1d')&&typeof _0x35fa85[_0x500f('0x1e')]===_0x500f('0x1d');var _0x4d39d6=_0x3e8b1a['count'];var _0x19ae73=_0x1871f2?0x0:_0x35fa85[_0x500f('0x1f')];var _0x188373=_0x1871f2?_0x3e8b1a[_0x500f('0x20')]:_0x35fa85['offset']+_0x35fa85['limit'];var _0x2c92e1;if(_0x188373>=_0x4d39d6){_0x188373=_0x4d39d6;_0x2c92e1=0xc8;}else{_0x2c92e1=0xce;}_0x2731a6[_0x500f('0x1b')](_0x2c92e1);return _0x2731a6[_0x500f('0x21')](_0x500f('0x22'),_0x19ae73+'-'+_0x188373+'/'+_0x4d39d6)['json'](_0x3e8b1a);}return null;};}function patchUpdates(_0xd0c5a5){return function(_0x2c6b7d){try{jsonpatch['apply'](_0x2c6b7d,_0xd0c5a5,!![]);}catch(_0x269372){return BPromise['reject'](_0x269372);}return _0x2c6b7d[_0x500f('0x23')]();};}function saveUpdates(_0x34944e,_0x4c6b08){return function(_0x2a3fd0){if(_0x2a3fd0){return _0x2a3fd0[_0x500f('0x24')](_0x34944e)[_0x500f('0x25')](function(_0x247543){return _0x247543;});}return null;};}function removeEntity(_0x81140f,_0x2ffa59){return function(_0x13b456){if(_0x13b456){return _0x13b456[_0x500f('0x26')]()[_0x500f('0x25')](function(){_0x81140f[_0x500f('0x1b')](0xcc)[_0x500f('0x1c')]();});}};}function handleEntityNotFound(_0x52f3e6,_0x1ce019){return function(_0x1b1d4a){if(!_0x1b1d4a){_0x52f3e6['sendStatus'](0x194);}return _0x1b1d4a;};}function handleError(_0x3eeac5,_0x384575){_0x384575=_0x384575||0x1f4;return function(_0x5298a7){logger[_0x500f('0x27')](_0x5298a7[_0x500f('0x28')]);if(_0x5298a7[_0x500f('0x29')]){delete _0x5298a7[_0x500f('0x29')];}_0x3eeac5[_0x500f('0x1b')](_0x384575)[_0x500f('0x2a')](_0x5298a7);};}exports[_0x500f('0x2b')]=function(_0x39bf7d,_0x816754){var _0x5dfa83={},_0x42dd8f={},_0x2f1e4e={'count':0x0,'rows':[]};var _0x33add3=_[_0x500f('0x2c')](db[_0x500f('0x2d')][_0x500f('0x2e')],function(_0x406ea0){return{'name':_0x406ea0['fieldName'],'type':_0x406ea0[_0x500f('0x2f')][_0x500f('0x30')]};});_0x42dd8f[_0x500f('0x31')]=_[_0x500f('0x2c')](_0x33add3,'name');_0x42dd8f[_0x500f('0x32')]=_['keys'](_0x39bf7d[_0x500f('0x32')]);_0x42dd8f[_0x500f('0x33')]=_[_0x500f('0x34')](_0x42dd8f[_0x500f('0x31')],_0x42dd8f['query']);_0x5dfa83[_0x500f('0x35')]=_[_0x500f('0x34')](_0x42dd8f[_0x500f('0x31')],qs[_0x500f('0x36')](_0x39bf7d[_0x500f('0x32')]['fields']));_0x5dfa83['attributes']=_0x5dfa83[_0x500f('0x35')][_0x500f('0x37')]?_0x5dfa83[_0x500f('0x35')]:_0x42dd8f[_0x500f('0x31')];if(!_0x39bf7d[_0x500f('0x32')][_0x500f('0x38')]('nolimit')){_0x5dfa83[_0x500f('0x1e')]=qs[_0x500f('0x1e')](_0x39bf7d['query']['limit']);_0x5dfa83['offset']=qs[_0x500f('0x1f')](_0x39bf7d[_0x500f('0x32')][_0x500f('0x1f')]);}_0x5dfa83['order']=qs[_0x500f('0x39')](_0x39bf7d[_0x500f('0x32')]['sort']);_0x5dfa83[_0x500f('0x3a')]=qs['filters'](_[_0x500f('0x3b')](_0x39bf7d[_0x500f('0x32')],_0x42dd8f[_0x500f('0x33')]),_0x33add3);if(_0x39bf7d[_0x500f('0x32')][_0x500f('0x3c')]){_0x5dfa83[_0x500f('0x3a')]=_[_0x500f('0x3d')](_0x5dfa83[_0x500f('0x3a')],{'$or':_[_0x500f('0x2c')](_0x33add3,function(_0x40180f){if(_0x40180f[_0x500f('0x2f')]!==_0x500f('0x3e')){var _0x4e75e3={};_0x4e75e3[_0x40180f[_0x500f('0x29')]]={'$like':'%'+_0x39bf7d[_0x500f('0x32')][_0x500f('0x3c')]+'%'};return _0x4e75e3;}})});}_0x5dfa83=_[_0x500f('0x3d')]({},_0x5dfa83,_0x39bf7d['options']);var _0x54eb71={'where':_0x5dfa83[_0x500f('0x3a')]};return db['OpenchannelQueueReport'][_0x500f('0x20')](_0x54eb71)[_0x500f('0x25')](function(_0x261675){_0x2f1e4e[_0x500f('0x20')]=_0x261675;if(_0x39bf7d[_0x500f('0x32')][_0x500f('0x3f')]){_0x5dfa83[_0x500f('0x40')]=[{'all':!![]}];}return db[_0x500f('0x2d')]['findAll'](_0x5dfa83);})['then'](function(_0x1d23de){_0x2f1e4e['rows']=_0x1d23de;return _0x2f1e4e;})[_0x500f('0x25')](respondWithFilteredResult(_0x816754,_0x5dfa83))[_0x500f('0x41')](handleError(_0x816754,null));};exports['show']=function(_0x39ac33,_0x485184){var _0x59a516={'raw':!![],'where':{'id':_0x39ac33[_0x500f('0x42')]['id']}},_0x58486d={};_0x58486d[_0x500f('0x31')]=_['keys'](db[_0x500f('0x2d')][_0x500f('0x2e')]);_0x58486d['query']=_[_0x500f('0x43')](_0x39ac33[_0x500f('0x32')]);_0x58486d[_0x500f('0x33')]=_[_0x500f('0x34')](_0x58486d[_0x500f('0x31')],_0x58486d['query']);_0x59a516['attributes']=_[_0x500f('0x34')](_0x58486d[_0x500f('0x31')],qs[_0x500f('0x36')](_0x39ac33[_0x500f('0x32')][_0x500f('0x36')]));_0x59a516['attributes']=_0x59a516[_0x500f('0x35')]['length']?_0x59a516[_0x500f('0x35')]:_0x58486d[_0x500f('0x31')];if(_0x39ac33[_0x500f('0x32')][_0x500f('0x3f')]){_0x59a516['include']=[{'all':!![]}];}_0x59a516=_[_0x500f('0x3d')]({},_0x59a516,_0x39ac33[_0x500f('0x44')]);return db['OpenchannelQueueReport']['find'](_0x59a516)['then'](handleEntityNotFound(_0x485184,null))[_0x500f('0x25')](respondWithResult(_0x485184,null))['catch'](handleError(_0x485184,null));};exports[_0x500f('0x45')]=function(_0xf81319,_0x197d9e){return db[_0x500f('0x2d')][_0x500f('0x45')](_0xf81319[_0x500f('0x46')],{})['then'](respondWithResult(_0x197d9e,0xc9))[_0x500f('0x41')](handleError(_0x197d9e,null));};exports[_0x500f('0x24')]=function(_0xff1f1a,_0xf5f154){if(_0xff1f1a[_0x500f('0x46')]['id']){delete _0xff1f1a[_0x500f('0x46')]['id'];}return db[_0x500f('0x2d')][_0x500f('0x47')]({'where':{'id':_0xff1f1a[_0x500f('0x42')]['id']}})[_0x500f('0x25')](handleEntityNotFound(_0xf5f154,null))[_0x500f('0x25')](saveUpdates(_0xff1f1a[_0x500f('0x46')],null))[_0x500f('0x25')](respondWithResult(_0xf5f154,null))[_0x500f('0x41')](handleError(_0xf5f154,null));};exports[_0x500f('0x26')]=function(_0x47b33a,_0x5d8be4){return db[_0x500f('0x2d')][_0x500f('0x47')]({'where':{'id':_0x47b33a[_0x500f('0x42')]['id']}})['then'](handleEntityNotFound(_0x5d8be4,null))[_0x500f('0x25')](removeEntity(_0x5d8be4,null))[_0x500f('0x41')](handleError(_0x5d8be4,null));};exports[_0x500f('0x48')]=function(_0x48c3d3,_0x5d4849){return db[_0x500f('0x2d')][_0x500f('0x48')]()[_0x500f('0x25')](respondWithResult(_0x5d4849,null))[_0x500f('0x41')](handleError(_0x5d4849,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 02900db..b1a335b 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x814b,0x1a2));var _0xb814=function(_0x17823f,_0xffd807){_0x17823f=_0x17823f-0x0;var _0x51fc21=_0x814b[_0x17823f];return _0x51fc21;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'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(_0xe4d91c,_0x55ccb1){var _0x4c6a31=function(_0xa39f50){while(--_0xa39f50){_0xe4d91c['push'](_0xe4d91c['shift']());}};_0x4c6a31(++_0x55ccb1);}(_0x1261,0x144));var _0x1126=function(_0x40e3e6,_0x141bc1){_0x40e3e6=_0x40e3e6-0x0;var _0x601283=_0x1261[_0x40e3e6];return _0x601283;};'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 09e4f47..fc83c07 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 _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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0447,0x8b));var _0x7044=function(_0x34ef0d,_0xd93b88){_0x34ef0d=_0x34ef0d-0x0;var _0xbb8d17=_0x0447[_0x34ef0d];return _0xbb8d17;};'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 +var _0x4f7b=['where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','raw','CreateOpenchannelQueueReport','debug','UpdateOpenchannelQueueReport','update','options'];(function(_0x1119f3,_0x159868){var _0x384b95=function(_0x2b9f02){while(--_0x2b9f02){_0x1119f3['push'](_0x1119f3['shift']());}};_0x384b95(++_0x159868);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x244cb4,_0x33ccd6){_0x244cb4=_0x244cb4-0x0;var _0xef7905=_0x4f7b[_0x244cb4];return _0xef7905;};'use strict';var _=require(_0xb4f7('0x0'));var util=require(_0xb4f7('0x1'));var moment=require(_0xb4f7('0x2'));var BPromise=require(_0xb4f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4f7('0x4'));var db=require(_0xb4f7('0x5'))['db'];var utils=require(_0xb4f7('0x6'));var logger=require(_0xb4f7('0x7'))(_0xb4f7('0x8'));var config=require(_0xb4f7('0x9'));var jayson=require(_0xb4f7('0xa'));var client=jayson[_0xb4f7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27872e,_0x5e7b94,_0x179391){return new BPromise(function(_0xf56d08,_0x2849ed){return client['request'](_0x27872e,_0x179391)[_0xb4f7('0xc')](function(_0x5af41f){logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));logger['debug'](_0xb4f7('0x10'),_0x5e7b94,_0xb4f7('0xf'),JSON[_0xb4f7('0x11')](_0x5af41f));if(_0x5af41f[_0xb4f7('0x12')]){if(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x13')]===0x1f4){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f['error'][_0xb4f7('0x14')]);return _0x2849ed(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x14')]);}logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f[_0xb4f7('0x12')]['message']);return _0xf56d08(_0x5af41f[_0xb4f7('0x12')]['message']);}else{logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));_0xf56d08(_0x5af41f[_0xb4f7('0x15')][_0xb4f7('0x14')]);}})[_0xb4f7('0x16')](function(_0xbc599a){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0xbc599a);_0x2849ed(_0xbc599a);});});}exports['CreateOpenchannelQueueReport']=function(_0x53b135){var _0x3a78b7=this;return new Promise(function(_0x22e273,_0x4b93fc){return db[_0xb4f7('0x17')][_0xb4f7('0x18')](_0x53b135[_0xb4f7('0x19')],{'raw':_0x53b135['options']?_0x53b135['options'][_0xb4f7('0x1a')]===undefined?!![]:![]:!![]})[_0xb4f7('0xc')](function(_0x5cc40e){logger[_0xb4f7('0xd')](_0xb4f7('0x1b'),_0x53b135);logger[_0xb4f7('0x1c')](_0xb4f7('0x1b'),_0x53b135,JSON['stringify'](_0x5cc40e));_0x22e273(_0x5cc40e);})[_0xb4f7('0x16')](function(_0x56bac5){logger[_0xb4f7('0x12')](_0xb4f7('0x1b'),_0x56bac5[_0xb4f7('0x14')],_0x53b135);_0x4b93fc(_0x3a78b7[_0xb4f7('0x12')](0x1f4,_0x56bac5[_0xb4f7('0x14')]));});});};exports[_0xb4f7('0x1d')]=function(_0x493d81){var _0x1fe0cf=this;return new Promise(function(_0x291166,_0x19e549){return db[_0xb4f7('0x17')][_0xb4f7('0x1e')](_0x493d81[_0xb4f7('0x19')],{'raw':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x493d81[_0xb4f7('0x1f')]?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x20')]||null:null,'attributes':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x21')]||null:null,'limit':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x22')]||null:null})[_0xb4f7('0xc')](function(_0x35582a){logger['info'](_0xb4f7('0x1d'),_0x493d81);logger[_0xb4f7('0x1c')](_0xb4f7('0x1d'),_0x493d81,JSON[_0xb4f7('0x11')](_0x35582a));_0x291166(_0x35582a);})['catch'](function(_0x4ea802){logger[_0xb4f7('0x12')]('UpdateOpenchannelQueueReport',_0x4ea802[_0xb4f7('0x14')],_0x493d81);_0x19e549(_0x1fe0cf[_0xb4f7('0x12')](0x1f4,_0x4ea802['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 4d1b9fd..74d504d 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 _0x4aaf=['../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','describe','/:id','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4aaf,0x19b));var _0xf4aa=function(_0x14d546,_0x27278f){_0x14d546=_0x14d546-0x0;var _0x2d4662=_0x4aaf[_0x14d546];return _0x2d4662;};'use strict';var multer=require(_0xf4aa('0x0'));var util=require(_0xf4aa('0x1'));var path=require('path');var timeout=require(_0xf4aa('0x2'));var express=require(_0xf4aa('0x3'));var router=express[_0xf4aa('0x4')]();var fs_extra=require(_0xf4aa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf4aa('0x6'));var config=require(_0xf4aa('0x7'));var controller=require(_0xf4aa('0x8'));router[_0xf4aa('0x9')]('/',auth[_0xf4aa('0xa')](),controller[_0xf4aa('0xb')]);router[_0xf4aa('0x9')]('/describe',auth[_0xf4aa('0xa')](),controller[_0xf4aa('0xc')]);router['get'](_0xf4aa('0xd'),auth[_0xf4aa('0xa')](),controller['show']);router['post']('/',auth[_0xf4aa('0xa')](),controller[_0xf4aa('0xe')]);router[_0xf4aa('0xf')](_0xf4aa('0xd'),auth[_0xf4aa('0xa')](),controller[_0xf4aa('0x10')]);router[_0xf4aa('0x11')]('/:id',auth[_0xf4aa('0xa')](),controller[_0xf4aa('0x12')]);module['exports']=router; \ No newline at end of file +var _0x72d0=['util','path','connect-timeout','express','Router','../../components/auth/service','./openchannelTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x407d41,_0x4aa3f1){var _0x27baf6=function(_0x334f35){while(--_0x334f35){_0x407d41['push'](_0x407d41['shift']());}};_0x27baf6(++_0x4aa3f1);}(_0x72d0,0x12f));var _0x072d=function(_0x57a6e5,_0x57d7e9){_0x57a6e5=_0x57a6e5-0x0;var _0x540d07=_0x72d0[_0x57a6e5];return _0x540d07;};'use strict';var multer=require(_0x072d('0x0'));var util=require(_0x072d('0x1'));var path=require(_0x072d('0x2'));var timeout=require(_0x072d('0x3'));var express=require(_0x072d('0x4'));var router=express[_0x072d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x072d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x072d('0x7'));router[_0x072d('0x8')]('/',auth[_0x072d('0x9')](),controller['index']);router[_0x072d('0x8')]('/describe',auth[_0x072d('0x9')](),controller[_0x072d('0xa')]);router[_0x072d('0x8')](_0x072d('0xb'),auth['isAuthenticated'](),controller[_0x072d('0xc')]);router[_0x072d('0xd')]('/',auth[_0x072d('0x9')](),controller[_0x072d('0xe')]);router['put'](_0x072d('0xb'),auth[_0x072d('0x9')](),controller[_0x072d('0xf')]);router[_0x072d('0x10')](_0x072d('0xb'),auth[_0x072d('0x9')](),controller[_0x072d('0x11')]);module[_0x072d('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index defb6ec..6d2d378 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x4f4ac6,_0x425ed2){var _0x50f026=function(_0x2385e1){while(--_0x2385e1){_0x4f4ac6['push'](_0x4f4ac6['shift']());}};_0x50f026(++_0x425ed2);}(_0xe706,0xa3));var _0x6e70=function(_0x530f50,_0x5da7d6){_0x530f50=_0x530f50-0x0;var _0x373031=_0xe706[_0x530f50];return _0x373031;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x16da5c,_0x17ede2){var _0x9e2d4e=function(_0x3066de){while(--_0x3066de){_0x16da5c['push'](_0x16da5c['shift']());}};_0x9e2d4e(++_0x17ede2);}(_0xedd9,0xfc));var _0x9edd=function(_0x4cdb9b,_0x8d8ca7){_0x4cdb9b=_0x4cdb9b-0x0;var _0xe35c34=_0xedd9[_0x4cdb9b];return _0xe35c34;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 3a92db3..6046196 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 _0x2dde=['update','then','destroy','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','json'];(function(_0x1a9a10,_0x3c264){var _0x3dc0bf=function(_0x1ace8c){while(--_0x1ace8c){_0x1a9a10['push'](_0x1a9a10['shift']());}};_0x3dc0bf(++_0x3c264);}(_0x2dde,0x19a));var _0xe2dd=function(_0x5857f6,_0x5317d6){_0x5857f6=_0x5857f6-0x0;var _0x207848=_0x2dde[_0x5857f6];return _0x207848;};'use strict';var emlformat=require(_0xe2dd('0x0'));var rimraf=require(_0xe2dd('0x1'));var zipdir=require(_0xe2dd('0x2'));var jsonpatch=require(_0xe2dd('0x3'));var rp=require(_0xe2dd('0x4'));var moment=require('moment');var BPromise=require(_0xe2dd('0x5'));var Mustache=require(_0xe2dd('0x6'));var util=require('util');var path=require(_0xe2dd('0x7'));var sox=require('sox');var csv=require(_0xe2dd('0x8'));var ejs=require(_0xe2dd('0x9'));var fs=require('fs');var fs_extra=require(_0xe2dd('0xa'));var _=require(_0xe2dd('0xb'));var squel=require(_0xe2dd('0xc'));var crypto=require(_0xe2dd('0xd'));var jsforce=require(_0xe2dd('0xe'));var deskjs=require(_0xe2dd('0xf'));var toCsv=require(_0xe2dd('0x8'));var querystring=require(_0xe2dd('0x10'));var Papa=require(_0xe2dd('0x11'));var Redis=require('ioredis');var authService=require(_0xe2dd('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe2dd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe2dd('0x14'))('api');var utils=require(_0xe2dd('0x15'));var config=require(_0xe2dd('0x16'));var licenseUtil=require(_0xe2dd('0x17'));var db=require(_0xe2dd('0x18'))['db'];function respondWithStatusCode(_0x23f63d,_0x33e530){_0x33e530=_0x33e530||0xcc;return function(_0x566bc4){if(_0x566bc4){return _0x23f63d[_0xe2dd('0x19')](_0x33e530);}return _0x23f63d['status'](_0x33e530)[_0xe2dd('0x1a')]();};}function respondWithResult(_0x2bab0f,_0x267cf7){_0x267cf7=_0x267cf7||0xc8;return function(_0x156ef5){if(_0x156ef5){return _0x2bab0f['status'](_0x267cf7)['json'](_0x156ef5);}};}function respondWithFilteredResult(_0x1cfe54,_0x47cc70){return function(_0x349d0a){if(_0x349d0a){var _0x26207f=typeof _0x47cc70[_0xe2dd('0x1b')]==='undefined'&&typeof _0x47cc70[_0xe2dd('0x1c')]===_0xe2dd('0x1d');var _0x301fb1=_0x349d0a[_0xe2dd('0x1e')];var _0x46930d=_0x26207f?0x0:_0x47cc70['offset'];var _0xa1059a=_0x26207f?_0x349d0a[_0xe2dd('0x1e')]:_0x47cc70[_0xe2dd('0x1b')]+_0x47cc70[_0xe2dd('0x1c')];var _0x470c6d;if(_0xa1059a>=_0x301fb1){_0xa1059a=_0x301fb1;_0x470c6d=0xc8;}else{_0x470c6d=0xce;}_0x1cfe54[_0xe2dd('0x1f')](_0x470c6d);return _0x1cfe54[_0xe2dd('0x20')]('Content-Range',_0x46930d+'-'+_0xa1059a+'/'+_0x301fb1)[_0xe2dd('0x21')](_0x349d0a);}return null;};}function patchUpdates(_0x3fc0c9){return function(_0x2b1349){try{jsonpatch['apply'](_0x2b1349,_0x3fc0c9,!![]);}catch(_0x4d257a){return BPromise['reject'](_0x4d257a);}return _0x2b1349['save']();};}function saveUpdates(_0x3e8f3b,_0x295968){return function(_0x3beefa){if(_0x3beefa){return _0x3beefa[_0xe2dd('0x22')](_0x3e8f3b)[_0xe2dd('0x23')](function(_0x57d5c4){return _0x57d5c4;});}return null;};}function removeEntity(_0x227993,_0x33c1b0){return function(_0x375b44){if(_0x375b44){return _0x375b44[_0xe2dd('0x24')]()[_0xe2dd('0x23')](function(){_0x227993['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3875ee,_0x23f33d){return function(_0x59d47d){if(!_0x59d47d){_0x3875ee[_0xe2dd('0x19')](0x194);}return _0x59d47d;};}function handleError(_0x313cb8,_0x10201f){_0x10201f=_0x10201f||0x1f4;return function(_0x42cc60){logger['error'](_0x42cc60[_0xe2dd('0x25')]);if(_0x42cc60['name']){delete _0x42cc60[_0xe2dd('0x26')];}_0x313cb8[_0xe2dd('0x1f')](_0x10201f)[_0xe2dd('0x27')](_0x42cc60);};}exports[_0xe2dd('0x28')]=function(_0x189406,_0x5803d4){var _0x5e47df={},_0x10902a={},_0x570af3={'count':0x0,'rows':[]};var _0x195115=_[_0xe2dd('0x29')](db[_0xe2dd('0x2a')][_0xe2dd('0x2b')],function(_0x28a0cc){return{'name':_0x28a0cc[_0xe2dd('0x2c')],'type':_0x28a0cc[_0xe2dd('0x2d')][_0xe2dd('0x2e')]};});_0x10902a[_0xe2dd('0x2f')]=_['map'](_0x195115,_0xe2dd('0x26'));_0x10902a[_0xe2dd('0x30')]=_['keys'](_0x189406[_0xe2dd('0x30')]);_0x10902a['filters']=_['intersection'](_0x10902a[_0xe2dd('0x2f')],_0x10902a[_0xe2dd('0x30')]);_0x5e47df[_0xe2dd('0x31')]=_[_0xe2dd('0x32')](_0x10902a[_0xe2dd('0x2f')],qs[_0xe2dd('0x33')](_0x189406[_0xe2dd('0x30')]['fields']));_0x5e47df['attributes']=_0x5e47df[_0xe2dd('0x31')][_0xe2dd('0x34')]?_0x5e47df[_0xe2dd('0x31')]:_0x10902a[_0xe2dd('0x2f')];if(!_0x189406[_0xe2dd('0x30')]['hasOwnProperty'](_0xe2dd('0x35'))){_0x5e47df[_0xe2dd('0x1c')]=qs['limit'](_0x189406[_0xe2dd('0x30')][_0xe2dd('0x1c')]);_0x5e47df[_0xe2dd('0x1b')]=qs[_0xe2dd('0x1b')](_0x189406['query'][_0xe2dd('0x1b')]);}_0x5e47df[_0xe2dd('0x36')]=qs[_0xe2dd('0x37')](_0x189406[_0xe2dd('0x30')]['sort']);_0x5e47df[_0xe2dd('0x38')]=qs[_0xe2dd('0x39')](_[_0xe2dd('0x3a')](_0x189406[_0xe2dd('0x30')],_0x10902a['filters']),_0x195115);if(_0x189406[_0xe2dd('0x30')]['filter']){_0x5e47df[_0xe2dd('0x38')]=_[_0xe2dd('0x3b')](_0x5e47df[_0xe2dd('0x38')],{'$or':_[_0xe2dd('0x29')](_0x195115,function(_0x114d12){if(_0x114d12[_0xe2dd('0x2d')]!==_0xe2dd('0x3c')){var _0x4882cd={};_0x4882cd[_0x114d12[_0xe2dd('0x26')]]={'$like':'%'+_0x189406['query']['filter']+'%'};return _0x4882cd;}})});}_0x5e47df=_[_0xe2dd('0x3b')]({},_0x5e47df,_0x189406[_0xe2dd('0x3d')]);var _0x1e20b7={'where':_0x5e47df[_0xe2dd('0x38')]};return db['OpenchannelTransferReport'][_0xe2dd('0x1e')](_0x1e20b7)['then'](function(_0x472187){_0x570af3['count']=_0x472187;if(_0x189406[_0xe2dd('0x30')][_0xe2dd('0x3e')]){_0x5e47df[_0xe2dd('0x3f')]=[{'all':!![]}];}return db[_0xe2dd('0x2a')][_0xe2dd('0x40')](_0x5e47df);})[_0xe2dd('0x23')](function(_0x4dbcc2){_0x570af3[_0xe2dd('0x41')]=_0x4dbcc2;return _0x570af3;})[_0xe2dd('0x23')](respondWithFilteredResult(_0x5803d4,_0x5e47df))[_0xe2dd('0x42')](handleError(_0x5803d4,null));};exports[_0xe2dd('0x43')]=function(_0x2227b3,_0x301823){var _0x4eca1f={'raw':!![],'where':{'id':_0x2227b3[_0xe2dd('0x44')]['id']}},_0x1aa41d={};_0x1aa41d[_0xe2dd('0x2f')]=_[_0xe2dd('0x45')](db[_0xe2dd('0x2a')][_0xe2dd('0x2b')]);_0x1aa41d['query']=_[_0xe2dd('0x45')](_0x2227b3[_0xe2dd('0x30')]);_0x1aa41d['filters']=_['intersection'](_0x1aa41d[_0xe2dd('0x2f')],_0x1aa41d['query']);_0x4eca1f['attributes']=_[_0xe2dd('0x32')](_0x1aa41d[_0xe2dd('0x2f')],qs[_0xe2dd('0x33')](_0x2227b3[_0xe2dd('0x30')][_0xe2dd('0x33')]));_0x4eca1f[_0xe2dd('0x31')]=_0x4eca1f[_0xe2dd('0x31')]['length']?_0x4eca1f['attributes']:_0x1aa41d[_0xe2dd('0x2f')];if(_0x2227b3[_0xe2dd('0x30')][_0xe2dd('0x3e')]){_0x4eca1f['include']=[{'all':!![]}];}_0x4eca1f=_[_0xe2dd('0x3b')]({},_0x4eca1f,_0x2227b3['options']);return db[_0xe2dd('0x2a')]['find'](_0x4eca1f)[_0xe2dd('0x23')](handleEntityNotFound(_0x301823,null))[_0xe2dd('0x23')](respondWithResult(_0x301823,null))[_0xe2dd('0x42')](handleError(_0x301823,null));};exports[_0xe2dd('0x46')]=function(_0x3da77e,_0x44fb60){return db['OpenchannelTransferReport'][_0xe2dd('0x46')](_0x3da77e['body'],{})['then'](respondWithResult(_0x44fb60,0xc9))['catch'](handleError(_0x44fb60,null));};exports[_0xe2dd('0x22')]=function(_0x42114e,_0x5099e1){if(_0x42114e[_0xe2dd('0x47')]['id']){delete _0x42114e[_0xe2dd('0x47')]['id'];}return db[_0xe2dd('0x2a')][_0xe2dd('0x48')]({'where':{'id':_0x42114e[_0xe2dd('0x44')]['id']}})['then'](handleEntityNotFound(_0x5099e1,null))['then'](saveUpdates(_0x42114e[_0xe2dd('0x47')],null))[_0xe2dd('0x23')](respondWithResult(_0x5099e1,null))[_0xe2dd('0x42')](handleError(_0x5099e1,null));};exports[_0xe2dd('0x24')]=function(_0x490f28,_0x312f8d){return db[_0xe2dd('0x2a')]['find']({'where':{'id':_0x490f28[_0xe2dd('0x44')]['id']}})[_0xe2dd('0x23')](handleEntityNotFound(_0x312f8d,null))[_0xe2dd('0x23')](removeEntity(_0x312f8d,null))[_0xe2dd('0x42')](handleError(_0x312f8d,null));};exports[_0xe2dd('0x49')]=function(_0x59fbf3,_0x2e1646){return db[_0xe2dd('0x2a')][_0xe2dd('0x49')]()[_0xe2dd('0x23')](respondWithResult(_0x2e1646,null))[_0xe2dd('0x42')](handleError(_0x2e1646,null));}; \ No newline at end of file +var _0x0e0a=['bluebird','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','create','update','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5c73f6,_0x2fa779){var _0x15824d=function(_0x403c28){while(--_0x403c28){_0x5c73f6['push'](_0x5c73f6['shift']());}};_0x15824d(++_0x2fa779);}(_0x0e0a,0x91));var _0xa0e0=function(_0x35caa8,_0x100229){_0x35caa8=_0x35caa8-0x0;var _0x72dcf0=_0x0e0a[_0x35caa8];return _0x72dcf0;};'use strict';var emlformat=require(_0xa0e0('0x0'));var rimraf=require(_0xa0e0('0x1'));var zipdir=require(_0xa0e0('0x2'));var jsonpatch=require(_0xa0e0('0x3'));var rp=require(_0xa0e0('0x4'));var moment=require('moment');var BPromise=require(_0xa0e0('0x5'));var Mustache=require('mustache');var util=require(_0xa0e0('0x6'));var path=require(_0xa0e0('0x7'));var sox=require(_0xa0e0('0x8'));var csv=require(_0xa0e0('0x9'));var ejs=require(_0xa0e0('0xa'));var fs=require('fs');var fs_extra=require(_0xa0e0('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa0e0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa0e0('0x9'));var querystring=require(_0xa0e0('0xd'));var Papa=require(_0xa0e0('0xe'));var Redis=require(_0xa0e0('0xf'));var authService=require(_0xa0e0('0x10'));var qs=require(_0xa0e0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0e0('0x12'))(_0xa0e0('0x13'));var utils=require(_0xa0e0('0x14'));var config=require(_0xa0e0('0x15'));var licenseUtil=require(_0xa0e0('0x16'));var db=require(_0xa0e0('0x17'))['db'];function respondWithStatusCode(_0x1146c0,_0x2aca91){_0x2aca91=_0x2aca91||0xcc;return function(_0x1e9b75){if(_0x1e9b75){return _0x1146c0[_0xa0e0('0x18')](_0x2aca91);}return _0x1146c0[_0xa0e0('0x19')](_0x2aca91)[_0xa0e0('0x1a')]();};}function respondWithResult(_0xb43ab9,_0x122891){_0x122891=_0x122891||0xc8;return function(_0x3bfb36){if(_0x3bfb36){return _0xb43ab9['status'](_0x122891)[_0xa0e0('0x1b')](_0x3bfb36);}};}function respondWithFilteredResult(_0x28c8a8,_0x3be882){return function(_0x21bbcf){if(_0x21bbcf){var _0x201b29=typeof _0x3be882[_0xa0e0('0x1c')]===_0xa0e0('0x1d')&&typeof _0x3be882[_0xa0e0('0x1e')]===_0xa0e0('0x1d');var _0x4019e1=_0x21bbcf[_0xa0e0('0x1f')];var _0x2d68d5=_0x201b29?0x0:_0x3be882['offset'];var _0x2a89c5=_0x201b29?_0x21bbcf[_0xa0e0('0x1f')]:_0x3be882[_0xa0e0('0x1c')]+_0x3be882['limit'];var _0x406326;if(_0x2a89c5>=_0x4019e1){_0x2a89c5=_0x4019e1;_0x406326=0xc8;}else{_0x406326=0xce;}_0x28c8a8[_0xa0e0('0x19')](_0x406326);return _0x28c8a8[_0xa0e0('0x20')]('Content-Range',_0x2d68d5+'-'+_0x2a89c5+'/'+_0x4019e1)[_0xa0e0('0x1b')](_0x21bbcf);}return null;};}function patchUpdates(_0x58de2a){return function(_0x124412){try{jsonpatch[_0xa0e0('0x21')](_0x124412,_0x58de2a,!![]);}catch(_0xa6772b){return BPromise[_0xa0e0('0x22')](_0xa6772b);}return _0x124412[_0xa0e0('0x23')]();};}function saveUpdates(_0x157bbb,_0x108ceb){return function(_0xb264fb){if(_0xb264fb){return _0xb264fb['update'](_0x157bbb)[_0xa0e0('0x24')](function(_0x34ca85){return _0x34ca85;});}return null;};}function removeEntity(_0x4d6f0f,_0x452dfc){return function(_0x5ef176){if(_0x5ef176){return _0x5ef176[_0xa0e0('0x25')]()[_0xa0e0('0x24')](function(){_0x4d6f0f[_0xa0e0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c6cfc,_0xba3744){return function(_0x1dc8ff){if(!_0x1dc8ff){_0x2c6cfc[_0xa0e0('0x18')](0x194);}return _0x1dc8ff;};}function handleError(_0x5e654e,_0x123896){_0x123896=_0x123896||0x1f4;return function(_0x1728ea){logger[_0xa0e0('0x26')](_0x1728ea[_0xa0e0('0x27')]);if(_0x1728ea[_0xa0e0('0x28')]){delete _0x1728ea[_0xa0e0('0x28')];}_0x5e654e[_0xa0e0('0x19')](_0x123896)[_0xa0e0('0x29')](_0x1728ea);};}exports[_0xa0e0('0x2a')]=function(_0x278d80,_0x230812){var _0x5d36e1={},_0x393c57={},_0x468421={'count':0x0,'rows':[]};var _0x1f19d5=_[_0xa0e0('0x2b')](db[_0xa0e0('0x2c')][_0xa0e0('0x2d')],function(_0x26f620){return{'name':_0x26f620[_0xa0e0('0x2e')],'type':_0x26f620[_0xa0e0('0x2f')]['key']};});_0x393c57[_0xa0e0('0x30')]=_['map'](_0x1f19d5,_0xa0e0('0x28'));_0x393c57[_0xa0e0('0x31')]=_[_0xa0e0('0x32')](_0x278d80[_0xa0e0('0x31')]);_0x393c57['filters']=_[_0xa0e0('0x33')](_0x393c57[_0xa0e0('0x30')],_0x393c57[_0xa0e0('0x31')]);_0x5d36e1['attributes']=_[_0xa0e0('0x33')](_0x393c57[_0xa0e0('0x30')],qs[_0xa0e0('0x34')](_0x278d80[_0xa0e0('0x31')][_0xa0e0('0x34')]));_0x5d36e1[_0xa0e0('0x35')]=_0x5d36e1[_0xa0e0('0x35')][_0xa0e0('0x36')]?_0x5d36e1[_0xa0e0('0x35')]:_0x393c57[_0xa0e0('0x30')];if(!_0x278d80[_0xa0e0('0x31')][_0xa0e0('0x37')]('nolimit')){_0x5d36e1[_0xa0e0('0x1e')]=qs[_0xa0e0('0x1e')](_0x278d80[_0xa0e0('0x31')][_0xa0e0('0x1e')]);_0x5d36e1[_0xa0e0('0x1c')]=qs['offset'](_0x278d80[_0xa0e0('0x31')][_0xa0e0('0x1c')]);}_0x5d36e1['order']=qs[_0xa0e0('0x38')](_0x278d80[_0xa0e0('0x31')][_0xa0e0('0x38')]);_0x5d36e1[_0xa0e0('0x39')]=qs[_0xa0e0('0x3a')](_[_0xa0e0('0x3b')](_0x278d80[_0xa0e0('0x31')],_0x393c57['filters']),_0x1f19d5);if(_0x278d80['query'][_0xa0e0('0x3c')]){_0x5d36e1['where']=_[_0xa0e0('0x3d')](_0x5d36e1[_0xa0e0('0x39')],{'$or':_[_0xa0e0('0x2b')](_0x1f19d5,function(_0x8af138){if(_0x8af138['type']!=='VIRTUAL'){var _0x1f1835={};_0x1f1835[_0x8af138[_0xa0e0('0x28')]]={'$like':'%'+_0x278d80['query'][_0xa0e0('0x3c')]+'%'};return _0x1f1835;}})});}_0x5d36e1=_[_0xa0e0('0x3d')]({},_0x5d36e1,_0x278d80['options']);var _0x11e85d={'where':_0x5d36e1[_0xa0e0('0x39')]};return db[_0xa0e0('0x2c')][_0xa0e0('0x1f')](_0x11e85d)['then'](function(_0x4bcc9c){_0x468421[_0xa0e0('0x1f')]=_0x4bcc9c;if(_0x278d80[_0xa0e0('0x31')][_0xa0e0('0x3e')]){_0x5d36e1[_0xa0e0('0x3f')]=[{'all':!![]}];}return db[_0xa0e0('0x2c')][_0xa0e0('0x40')](_0x5d36e1);})[_0xa0e0('0x24')](function(_0x2fffb0){_0x468421[_0xa0e0('0x41')]=_0x2fffb0;return _0x468421;})[_0xa0e0('0x24')](respondWithFilteredResult(_0x230812,_0x5d36e1))[_0xa0e0('0x42')](handleError(_0x230812,null));};exports[_0xa0e0('0x43')]=function(_0x3827c0,_0x2e34ce){var _0xe47180={'raw':!![],'where':{'id':_0x3827c0[_0xa0e0('0x44')]['id']}},_0x45193c={};_0x45193c[_0xa0e0('0x30')]=_[_0xa0e0('0x32')](db[_0xa0e0('0x2c')][_0xa0e0('0x2d')]);_0x45193c[_0xa0e0('0x31')]=_[_0xa0e0('0x32')](_0x3827c0[_0xa0e0('0x31')]);_0x45193c[_0xa0e0('0x3a')]=_['intersection'](_0x45193c[_0xa0e0('0x30')],_0x45193c[_0xa0e0('0x31')]);_0xe47180[_0xa0e0('0x35')]=_[_0xa0e0('0x33')](_0x45193c[_0xa0e0('0x30')],qs['fields'](_0x3827c0[_0xa0e0('0x31')]['fields']));_0xe47180['attributes']=_0xe47180[_0xa0e0('0x35')][_0xa0e0('0x36')]?_0xe47180[_0xa0e0('0x35')]:_0x45193c[_0xa0e0('0x30')];if(_0x3827c0[_0xa0e0('0x31')][_0xa0e0('0x3e')]){_0xe47180[_0xa0e0('0x3f')]=[{'all':!![]}];}_0xe47180=_[_0xa0e0('0x3d')]({},_0xe47180,_0x3827c0[_0xa0e0('0x45')]);return db['OpenchannelTransferReport']['find'](_0xe47180)[_0xa0e0('0x24')](handleEntityNotFound(_0x2e34ce,null))['then'](respondWithResult(_0x2e34ce,null))[_0xa0e0('0x42')](handleError(_0x2e34ce,null));};exports[_0xa0e0('0x46')]=function(_0xf2db,_0x55b69c){return db['OpenchannelTransferReport']['create'](_0xf2db['body'],{})[_0xa0e0('0x24')](respondWithResult(_0x55b69c,0xc9))[_0xa0e0('0x42')](handleError(_0x55b69c,null));};exports[_0xa0e0('0x47')]=function(_0x508413,_0x498fc1){if(_0x508413[_0xa0e0('0x48')]['id']){delete _0x508413[_0xa0e0('0x48')]['id'];}return db[_0xa0e0('0x2c')]['find']({'where':{'id':_0x508413[_0xa0e0('0x44')]['id']}})[_0xa0e0('0x24')](handleEntityNotFound(_0x498fc1,null))[_0xa0e0('0x24')](saveUpdates(_0x508413[_0xa0e0('0x48')],null))[_0xa0e0('0x24')](respondWithResult(_0x498fc1,null))[_0xa0e0('0x42')](handleError(_0x498fc1,null));};exports[_0xa0e0('0x25')]=function(_0x475bc9,_0x43b98d){return db[_0xa0e0('0x2c')][_0xa0e0('0x49')]({'where':{'id':_0x475bc9['params']['id']}})[_0xa0e0('0x24')](handleEntityNotFound(_0x43b98d,null))[_0xa0e0('0x24')](removeEntity(_0x43b98d,null))['catch'](handleError(_0x43b98d,null));};exports[_0xa0e0('0x4a')]=function(_0x48bf32,_0xc4cc6e){return db[_0xa0e0('0x2c')]['describe']()[_0xa0e0('0x24')](respondWithResult(_0xc4cc6e,null))['catch'](handleError(_0xc4cc6e,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 032abba..38cd01d 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 _0x0847=['./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','request-promise','rimraf'];(function(_0x333767,_0x3e6f9c){var _0x51661b=function(_0x46e5d6){while(--_0x46e5d6){_0x333767['push'](_0x333767['shift']());}};_0x51661b(++_0x3e6f9c);}(_0x0847,0xeb));var _0x7084=function(_0x241dbf,_0x2fffa5){_0x241dbf=_0x241dbf-0x0;var _0x34b554=_0x0847[_0x241dbf];return _0x34b554;};'use strict';var _=require(_0x7084('0x0'));var util=require('util');var logger=require(_0x7084('0x1'))(_0x7084('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7084('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7084('0x4'));var config=require('../../config/environment');var attributes=require(_0x7084('0x5'));module['exports']=function(_0xaf851d,_0x48d529){return _0xaf851d[_0x7084('0x6')](_0x7084('0x7'),attributes,{'tableName':_0x7084('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7084('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f11=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x3b0631,_0x8d8b09){var _0x229add=function(_0x29bcc6){while(--_0x29bcc6){_0x3b0631['push'](_0x3b0631['shift']());}};_0x229add(++_0x8d8b09);}(_0x6f11,0x8f));var _0x16f1=function(_0xffe2b3,_0x454ed1){_0xffe2b3=_0xffe2b3-0x0;var _0x2a2531=_0x6f11[_0xffe2b3];return _0x2a2531;};'use strict';var _=require(_0x16f1('0x0'));var util=require(_0x16f1('0x1'));var logger=require('../../config/logger')(_0x16f1('0x2'));var moment=require(_0x16f1('0x3'));var BPromise=require(_0x16f1('0x4'));var rp=require(_0x16f1('0x5'));var fs=require('fs');var path=require(_0x16f1('0x6'));var rimraf=require(_0x16f1('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0x16f1('0x8')]=function(_0x3de358,_0xfa79ed){return _0x3de358[_0x16f1('0x9')](_0x16f1('0xa'),attributes,{'tableName':_0x16f1('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x16f1('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 6af9de2..542c594 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 _0xe132=['debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x53f0fe,_0x4daa99){var _0x87b7d2=function(_0x9e1ac0){while(--_0x9e1ac0){_0x53f0fe['push'](_0x53f0fe['shift']());}};_0x87b7d2(++_0x4daa99);}(_0xe132,0x162));var _0x2e13=function(_0x1488a2,_0x25aa66){_0x1488a2=_0x1488a2-0x0;var _0x47f842=_0xe132[_0x1488a2];return _0x47f842;};'use strict';var _=require(_0x2e13('0x0'));var util=require('util');var moment=require(_0x2e13('0x1'));var BPromise=require(_0x2e13('0x2'));var rs=require(_0x2e13('0x3'));var fs=require('fs');var Redis=require(_0x2e13('0x4'));var db=require(_0x2e13('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e13('0x6'))(_0x2e13('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e13('0x8')][_0x2e13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c670b,_0x71f9d3,_0x3be5dc){return new BPromise(function(_0x2d9487,_0x370a85){return client[_0x2e13('0xa')](_0x1c670b,_0x3be5dc)[_0x2e13('0xb')](function(_0x240bc3){logger['info'](_0x2e13('0xc'),_0x71f9d3,_0x2e13('0xd'));logger[_0x2e13('0xe')](_0x2e13('0xf'),_0x71f9d3,_0x2e13('0xd'),JSON[_0x2e13('0x10')](_0x240bc3));if(_0x240bc3[_0x2e13('0x11')]){if(_0x240bc3['error'][_0x2e13('0x12')]===0x1f4){logger[_0x2e13('0x11')](_0x2e13('0xc'),_0x71f9d3,_0x240bc3[_0x2e13('0x11')][_0x2e13('0x13')]);return _0x370a85(_0x240bc3[_0x2e13('0x11')][_0x2e13('0x13')]);}logger['error'](_0x2e13('0xc'),_0x71f9d3,_0x240bc3[_0x2e13('0x11')][_0x2e13('0x13')]);return _0x2d9487(_0x240bc3['error'][_0x2e13('0x13')]);}else{logger[_0x2e13('0x14')](_0x2e13('0xc'),_0x71f9d3,'request\x20sent');_0x2d9487(_0x240bc3[_0x2e13('0x15')][_0x2e13('0x13')]);}})[_0x2e13('0x16')](function(_0x4a466b){logger['error'](_0x2e13('0xc'),_0x71f9d3,_0x4a466b);_0x370a85(_0x4a466b);});});} \ No newline at end of file +var _0xcd59=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd59,0x14b));var _0x9cd5=function(_0x3aa6ab,_0x3b5f7c){_0x3aa6ab=_0x3aa6ab-0x0;var _0x5789d7=_0xcd59[_0x3aa6ab];return _0x5789d7;};'use strict';var _=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var moment=require(_0x9cd5('0x2'));var BPromise=require(_0x9cd5('0x3'));var rs=require(_0x9cd5('0x4'));var fs=require('fs');var Redis=require(_0x9cd5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9cd5('0x6'));var logger=require(_0x9cd5('0x7'))(_0x9cd5('0x8'));var config=require(_0x9cd5('0x9'));var jayson=require(_0x9cd5('0xa'));var client=jayson[_0x9cd5('0xb')][_0x9cd5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cd19a,_0x214256,_0x3f888f){return new BPromise(function(_0x545407,_0x10162d){return client[_0x9cd5('0xd')](_0x2cd19a,_0x3f888f)[_0x9cd5('0xe')](function(_0x23e524){logger[_0x9cd5('0xf')](_0x9cd5('0x10'),_0x214256,_0x9cd5('0x11'));logger[_0x9cd5('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x214256,_0x9cd5('0x11'),JSON[_0x9cd5('0x13')](_0x23e524));if(_0x23e524[_0x9cd5('0x14')]){if(_0x23e524[_0x9cd5('0x14')]['code']===0x1f4){logger['error'](_0x9cd5('0x10'),_0x214256,_0x23e524[_0x9cd5('0x14')][_0x9cd5('0x15')]);return _0x10162d(_0x23e524[_0x9cd5('0x14')][_0x9cd5('0x15')]);}logger[_0x9cd5('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x214256,_0x23e524[_0x9cd5('0x14')][_0x9cd5('0x15')]);return _0x545407(_0x23e524[_0x9cd5('0x14')]['message']);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x214256,_0x9cd5('0x11'));_0x545407(_0x23e524[_0x9cd5('0x16')]['message']);}})[_0x9cd5('0x17')](function(_0x11a7d2){logger[_0x9cd5('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x214256,_0x11a7d2);_0x10162d(_0x11a7d2);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 94872da..ecc52cc 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 _0x93ec=['isAuthenticated','index','/:id','post','update','delete','destroy','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller'];(function(_0x125a81,_0x4fa502){var _0x4e506d=function(_0x4074ec){while(--_0x4074ec){_0x125a81['push'](_0x125a81['shift']());}};_0x4e506d(++_0x4fa502);}(_0x93ec,0x78));var _0xc93e=function(_0x2ac512,_0x18d0fc){_0x2ac512=_0x2ac512-0x0;var _0x41a20e=_0x93ec[_0x2ac512];return _0x41a20e;};'use strict';var multer=require(_0xc93e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc93e('0x1')]();var fs_extra=require(_0xc93e('0x2'));var auth=require(_0xc93e('0x3'));var interaction=require(_0xc93e('0x4'));var config=require('../../config/environment');var controller=require(_0xc93e('0x5'));router['get']('/',auth[_0xc93e('0x6')](),controller[_0xc93e('0x7')]);router['get'](_0xc93e('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xc93e('0x9')]('/',auth[_0xc93e('0x6')](),controller['create']);router['put'](_0xc93e('0x8'),auth[_0xc93e('0x6')](),controller[_0xc93e('0xa')]);router[_0xc93e('0xb')](_0xc93e('0x8'),auth[_0xc93e('0x6')](),controller[_0xc93e('0xc')]);module[_0xc93e('0xd')]=router; \ No newline at end of file +var _0x9cfa=['get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./pause.controller'];(function(_0x402885,_0x4b9b38){var _0x18a502=function(_0x2efb71){while(--_0x2efb71){_0x402885['push'](_0x402885['shift']());}};_0x18a502(++_0x4b9b38);}(_0x9cfa,0xfc));var _0xa9cf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9cfa[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0xa9cf('0x0'));var path=require(_0xa9cf('0x1'));var timeout=require(_0xa9cf('0x2'));var express=require(_0xa9cf('0x3'));var router=express[_0xa9cf('0x4')]();var fs_extra=require(_0xa9cf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa9cf('0x6'));var controller=require(_0xa9cf('0x7'));router[_0xa9cf('0x8')]('/',auth[_0xa9cf('0x9')](),controller[_0xa9cf('0xa')]);router[_0xa9cf('0x8')]('/:id',auth[_0xa9cf('0x9')](),controller[_0xa9cf('0xb')]);router[_0xa9cf('0xc')]('/',auth[_0xa9cf('0x9')](),controller[_0xa9cf('0xd')]);router[_0xa9cf('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xa9cf('0xf')]);router[_0xa9cf('0x10')](_0xa9cf('0x11'),auth['isAuthenticated'](),controller[_0xa9cf('0x12')]);module[_0xa9cf('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 42c8881..04afbbc 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 _0xf1cf=['STRING','name'];(function(_0x12aed4,_0x5bebaf){var _0x5dbf23=function(_0x401a9b){while(--_0x401a9b){_0x12aed4['push'](_0x12aed4['shift']());}};_0x5dbf23(++_0x5bebaf);}(_0xf1cf,0xda));var _0xff1c=function(_0x504c8a,_0x206d71){_0x504c8a=_0x504c8a-0x0;var _0x3e0057=_0xf1cf[_0x504c8a];return _0x3e0057;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xff1c('0x0')],'unique':_0xff1c('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc4ab=['STRING','name','sequelize'];(function(_0x3f94f9,_0x42774b){var _0x46f84f=function(_0xa080d8){while(--_0xa080d8){_0x3f94f9['push'](_0x3f94f9['shift']());}};_0x46f84f(++_0x42774b);}(_0xc4ab,0xef));var _0xbc4a=function(_0xff0639,_0x3124d4){_0xff0639=_0xff0639-0x0;var _0x111ff7=_0xc4ab[_0xff0639];return _0x111ff7;};'use strict';var Sequelize=require(_0xbc4a('0x0'));module['exports']={'name':{'type':Sequelize[_0xbc4a('0x1')],'unique':_0xbc4a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xbc4a('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index bcfbec7..bde2f84 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 _0xcaf0=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','get','Pauses','error','stack','name','send','index','Pause','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','crypto','desk.js','to-csv'];(function(_0x40fea4,_0x8757e0){var _0x10197c=function(_0x42c986){while(--_0x42c986){_0x40fea4['push'](_0x40fea4['shift']());}};_0x10197c(++_0x8757e0);}(_0xcaf0,0x191));var _0x0caf=function(_0x333159,_0x68262e){_0x333159=_0x333159-0x0;var _0x2e29ac=_0xcaf0[_0x333159];return _0x2e29ac;};'use strict';var emlformat=require(_0x0caf('0x0'));var rimraf=require(_0x0caf('0x1'));var zipdir=require(_0x0caf('0x2'));var jsonpatch=require(_0x0caf('0x3'));var rp=require(_0x0caf('0x4'));var moment=require(_0x0caf('0x5'));var BPromise=require(_0x0caf('0x6'));var Mustache=require('mustache');var util=require(_0x0caf('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0caf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0caf('0x9'));var squel=require(_0x0caf('0xa'));var crypto=require(_0x0caf('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0caf('0xc'));var toCsv=require(_0x0caf('0xd'));var querystring=require(_0x0caf('0xe'));var Papa=require(_0x0caf('0xf'));var Redis=require(_0x0caf('0x10'));var authService=require(_0x0caf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0caf('0x12'));var hardwareService=require(_0x0caf('0x13'));var logger=require(_0x0caf('0x14'))('api');var utils=require(_0x0caf('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0caf('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cbdb8,_0x587014){_0x587014=_0x587014||0xcc;return function(_0xe869f){if(_0xe869f){return _0x3cbdb8[_0x0caf('0x17')](_0x587014);}return _0x3cbdb8[_0x0caf('0x18')](_0x587014)[_0x0caf('0x19')]();};}function respondWithResult(_0x2bf3ad,_0x447f2a){_0x447f2a=_0x447f2a||0xc8;return function(_0x4d6a57){if(_0x4d6a57){return _0x2bf3ad[_0x0caf('0x18')](_0x447f2a)[_0x0caf('0x1a')](_0x4d6a57);}};}function respondWithFilteredResult(_0x2a040e,_0x38138b){return function(_0x1a3c34){if(_0x1a3c34){var _0x30b508=typeof _0x38138b[_0x0caf('0x1b')]==='undefined'&&typeof _0x38138b[_0x0caf('0x1c')]===_0x0caf('0x1d');var _0x2f7a64=_0x1a3c34[_0x0caf('0x1e')];var _0x165929=_0x30b508?0x0:_0x38138b[_0x0caf('0x1b')];var _0x31822c=_0x30b508?_0x1a3c34[_0x0caf('0x1e')]:_0x38138b[_0x0caf('0x1b')]+_0x38138b['limit'];var _0x242fe2;if(_0x31822c>=_0x2f7a64){_0x31822c=_0x2f7a64;_0x242fe2=0xc8;}else{_0x242fe2=0xce;}_0x2a040e[_0x0caf('0x18')](_0x242fe2);return _0x2a040e[_0x0caf('0x1f')](_0x0caf('0x20'),_0x165929+'-'+_0x31822c+'/'+_0x2f7a64)[_0x0caf('0x1a')](_0x1a3c34);}return null;};}function patchUpdates(_0x12ab3c){return function(_0x5953c9){try{jsonpatch[_0x0caf('0x21')](_0x5953c9,_0x12ab3c,!![]);}catch(_0x597b5b){return BPromise['reject'](_0x597b5b);}return _0x5953c9['save']();};}function saveUpdates(_0x134bec,_0xfad087){return function(_0x18e3c5){if(_0x18e3c5){return _0x18e3c5[_0x0caf('0x22')](_0x134bec)[_0x0caf('0x23')](function(_0x33ebc7){return _0x33ebc7;});}return null;};}function removeEntity(_0x2a26a8,_0x12c557){return function(_0x4052fe){if(_0x4052fe){return _0x4052fe[_0x0caf('0x24')]()[_0x0caf('0x23')](function(){var _0x457a20=_0x4052fe[_0x0caf('0x25')]({'plain':!![]});var _0x9a6458=_0x0caf('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x9a6458,'resourceId':_0x457a20['id']}})['then'](function(){return _0x4052fe;});})['then'](function(){_0x2a26a8[_0x0caf('0x18')](0xcc)[_0x0caf('0x19')]();});}};}function handleEntityNotFound(_0x554485,_0x5d692a){return function(_0x3e0a1b){if(!_0x3e0a1b){_0x554485[_0x0caf('0x17')](0x194);}return _0x3e0a1b;};}function handleError(_0x3e83d8,_0x521561){_0x521561=_0x521561||0x1f4;return function(_0x59a776){logger[_0x0caf('0x27')](_0x59a776[_0x0caf('0x28')]);if(_0x59a776['name']){delete _0x59a776[_0x0caf('0x29')];}_0x3e83d8[_0x0caf('0x18')](_0x521561)[_0x0caf('0x2a')](_0x59a776);};}exports[_0x0caf('0x2b')]=function(_0x10b71f,_0x20bdfe){var _0x2129ae={},_0x11c3e5={},_0x256e48={'count':0x0,'rows':[]};var _0x456155=_['map'](db[_0x0caf('0x2c')]['rawAttributes'],function(_0x310135){return{'name':_0x310135[_0x0caf('0x2d')],'type':_0x310135[_0x0caf('0x2e')][_0x0caf('0x2f')]};});_0x11c3e5[_0x0caf('0x30')]=_[_0x0caf('0x31')](_0x456155,'name');_0x11c3e5[_0x0caf('0x32')]=_[_0x0caf('0x33')](_0x10b71f[_0x0caf('0x32')]);_0x11c3e5['filters']=_[_0x0caf('0x34')](_0x11c3e5[_0x0caf('0x30')],_0x11c3e5['query']);_0x2129ae['attributes']=_[_0x0caf('0x34')](_0x11c3e5[_0x0caf('0x30')],qs[_0x0caf('0x35')](_0x10b71f[_0x0caf('0x32')][_0x0caf('0x35')]));_0x2129ae['attributes']=_0x2129ae[_0x0caf('0x36')]['length']?_0x2129ae[_0x0caf('0x36')]:_0x11c3e5[_0x0caf('0x30')];if(!_0x10b71f[_0x0caf('0x32')][_0x0caf('0x37')](_0x0caf('0x38'))){_0x2129ae[_0x0caf('0x1c')]=qs[_0x0caf('0x1c')](_0x10b71f[_0x0caf('0x32')][_0x0caf('0x1c')]);_0x2129ae[_0x0caf('0x1b')]=qs[_0x0caf('0x1b')](_0x10b71f['query']['offset']);}_0x2129ae['order']=qs['sort'](_0x10b71f[_0x0caf('0x32')][_0x0caf('0x39')]);_0x2129ae[_0x0caf('0x3a')]=qs['filters'](_[_0x0caf('0x3b')](_0x10b71f[_0x0caf('0x32')],_0x11c3e5[_0x0caf('0x3c')]),_0x456155);if(_0x10b71f['query'][_0x0caf('0x3d')]){_0x2129ae[_0x0caf('0x3a')]=_[_0x0caf('0x3e')](_0x2129ae[_0x0caf('0x3a')],{'$or':_['map'](_0x456155,function(_0x514d15){if(_0x514d15[_0x0caf('0x2e')]!==_0x0caf('0x3f')){var _0x3050ea={};_0x3050ea[_0x514d15['name']]={'$like':'%'+_0x10b71f[_0x0caf('0x32')][_0x0caf('0x3d')]+'%'};return _0x3050ea;}})});}_0x2129ae=_['merge']({},_0x2129ae,_0x10b71f[_0x0caf('0x40')]);var _0x27e1d0={'where':_0x2129ae['where']};return db['Pause'][_0x0caf('0x1e')](_0x27e1d0)[_0x0caf('0x23')](function(_0x3a3184){_0x256e48['count']=_0x3a3184;if(_0x10b71f[_0x0caf('0x32')][_0x0caf('0x41')]){_0x2129ae['include']=[{'all':!![]}];}return db[_0x0caf('0x2c')][_0x0caf('0x42')](_0x2129ae);})['then'](function(_0x3ead7a){_0x256e48[_0x0caf('0x43')]=_0x3ead7a;return _0x256e48;})[_0x0caf('0x23')](respondWithFilteredResult(_0x20bdfe,_0x2129ae))['catch'](handleError(_0x20bdfe,null));};exports[_0x0caf('0x44')]=function(_0x474cd3,_0x597e6f){var _0x11d3af={'raw':!![],'where':{'id':_0x474cd3[_0x0caf('0x45')]['id']}},_0x95ad5e={};_0x95ad5e[_0x0caf('0x30')]=_[_0x0caf('0x33')](db['Pause'][_0x0caf('0x46')]);_0x95ad5e['query']=_[_0x0caf('0x33')](_0x474cd3[_0x0caf('0x32')]);_0x95ad5e[_0x0caf('0x3c')]=_[_0x0caf('0x34')](_0x95ad5e['model'],_0x95ad5e['query']);_0x11d3af[_0x0caf('0x36')]=_[_0x0caf('0x34')](_0x95ad5e[_0x0caf('0x30')],qs[_0x0caf('0x35')](_0x474cd3[_0x0caf('0x32')]['fields']));_0x11d3af[_0x0caf('0x36')]=_0x11d3af[_0x0caf('0x36')][_0x0caf('0x47')]?_0x11d3af[_0x0caf('0x36')]:_0x95ad5e[_0x0caf('0x30')];if(_0x474cd3['query'][_0x0caf('0x41')]){_0x11d3af[_0x0caf('0x48')]=[{'all':!![]}];}_0x11d3af=_[_0x0caf('0x3e')]({},_0x11d3af,_0x474cd3['options']);return db[_0x0caf('0x2c')][_0x0caf('0x49')](_0x11d3af)['then'](handleEntityNotFound(_0x597e6f,null))['then'](respondWithResult(_0x597e6f,null))[_0x0caf('0x4a')](handleError(_0x597e6f,null));};exports['create']=function(_0x3d42df,_0x1ef27f){return db['Pause'][_0x0caf('0x4b')](_0x3d42df[_0x0caf('0x4c')],{})['then'](function(_0x147b8a){var _0x297cee=_0x3d42df[_0x0caf('0x4d')]['get']({'plain':!![]});if(!_0x297cee)throw new Error(_0x0caf('0x4e'));if(_0x297cee[_0x0caf('0x4f')]===_0x0caf('0x4d')){var _0x5aa698=_0x147b8a['get']({'plain':!![]});var _0x12c97f=_0x0caf('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x12c97f,'userProfileId':_0x297cee['userProfileId']},'raw':!![]})[_0x0caf('0x23')](function(_0x47882e){if(_0x47882e&&_0x47882e[_0x0caf('0x50')]===0x0){return db[_0x0caf('0x51')][_0x0caf('0x4b')]({'name':_0x5aa698[_0x0caf('0x29')],'resourceId':_0x5aa698['id'],'type':_0x47882e[_0x0caf('0x29')],'sectionId':_0x47882e['id']},{})[_0x0caf('0x23')](function(){return _0x147b8a;});}else{return _0x147b8a;}})[_0x0caf('0x4a')](function(_0x5dccec){logger[_0x0caf('0x27')](_0x0caf('0x52'),_0x5dccec);throw _0x5dccec;});}return _0x147b8a;})[_0x0caf('0x23')](respondWithResult(_0x1ef27f,0xc9))['catch'](handleError(_0x1ef27f,null));};exports[_0x0caf('0x22')]=function(_0x141f5f,_0x505be0){if(_0x141f5f['body']['id']){delete _0x141f5f['body']['id'];}return db[_0x0caf('0x2c')][_0x0caf('0x49')]({'where':{'id':_0x141f5f[_0x0caf('0x45')]['id']}})[_0x0caf('0x23')](handleEntityNotFound(_0x505be0,null))[_0x0caf('0x23')](saveUpdates(_0x141f5f['body'],null))[_0x0caf('0x23')](respondWithResult(_0x505be0,null))[_0x0caf('0x4a')](handleError(_0x505be0,null));};exports['destroy']=function(_0x260a6c,_0x285a45){return db[_0x0caf('0x2c')][_0x0caf('0x49')]({'where':{'id':_0x260a6c['params']['id']}})[_0x0caf('0x23')](handleEntityNotFound(_0x285a45,null))['then'](removeEntity(_0x285a45,null))['catch'](handleError(_0x285a45,null));}; \ No newline at end of file +var _0xe7a1=['save','update','destroy','then','error','stack','name','send','index','Pause','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject'];(function(_0x248cc9,_0x55d41b){var _0x43485d=function(_0x1db2bd){while(--_0x1db2bd){_0x248cc9['push'](_0x248cc9['shift']());}};_0x43485d(++_0x55d41b);}(_0xe7a1,0x81));var _0x1e7a=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xe7a1[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0x1e7a('0x0'));var rimraf=require(_0x1e7a('0x1'));var zipdir=require(_0x1e7a('0x2'));var jsonpatch=require(_0x1e7a('0x3'));var rp=require(_0x1e7a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1e7a('0x5'));var path=require(_0x1e7a('0x6'));var sox=require(_0x1e7a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e7a('0x8'));var _=require(_0x1e7a('0x9'));var squel=require('squel');var crypto=require(_0x1e7a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1e7a('0xb'));var toCsv=require(_0x1e7a('0xc'));var querystring=require(_0x1e7a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1e7a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1e7a('0xf'));var hardwareService=require(_0x1e7a('0x10'));var logger=require(_0x1e7a('0x11'))(_0x1e7a('0x12'));var utils=require(_0x1e7a('0x13'));var config=require(_0x1e7a('0x14'));var licenseUtil=require(_0x1e7a('0x15'));var db=require(_0x1e7a('0x16'))['db'];function respondWithStatusCode(_0x8e1ac8,_0x2b13a4){_0x2b13a4=_0x2b13a4||0xcc;return function(_0x1bccae){if(_0x1bccae){return _0x8e1ac8[_0x1e7a('0x17')](_0x2b13a4);}return _0x8e1ac8[_0x1e7a('0x18')](_0x2b13a4)[_0x1e7a('0x19')]();};}function respondWithResult(_0xdb22b0,_0x339470){_0x339470=_0x339470||0xc8;return function(_0x25cdb3){if(_0x25cdb3){return _0xdb22b0['status'](_0x339470)[_0x1e7a('0x1a')](_0x25cdb3);}};}function respondWithFilteredResult(_0x41a2e8,_0x1e559d){return function(_0x421659){if(_0x421659){var _0x3447db=typeof _0x1e559d[_0x1e7a('0x1b')]===_0x1e7a('0x1c')&&typeof _0x1e559d['limit']==='undefined';var _0x423601=_0x421659[_0x1e7a('0x1d')];var _0x4f2b82=_0x3447db?0x0:_0x1e559d[_0x1e7a('0x1b')];var _0x10b1ff=_0x3447db?_0x421659[_0x1e7a('0x1d')]:_0x1e559d[_0x1e7a('0x1b')]+_0x1e559d['limit'];var _0x5c63fb;if(_0x10b1ff>=_0x423601){_0x10b1ff=_0x423601;_0x5c63fb=0xc8;}else{_0x5c63fb=0xce;}_0x41a2e8[_0x1e7a('0x18')](_0x5c63fb);return _0x41a2e8['set'](_0x1e7a('0x1e'),_0x4f2b82+'-'+_0x10b1ff+'/'+_0x423601)[_0x1e7a('0x1a')](_0x421659);}return null;};}function patchUpdates(_0xa2b98c){return function(_0x117473){try{jsonpatch[_0x1e7a('0x1f')](_0x117473,_0xa2b98c,!![]);}catch(_0x11e5a7){return BPromise[_0x1e7a('0x20')](_0x11e5a7);}return _0x117473[_0x1e7a('0x21')]();};}function saveUpdates(_0x183472,_0x213be9){return function(_0x2e73e3){if(_0x2e73e3){return _0x2e73e3[_0x1e7a('0x22')](_0x183472)['then'](function(_0x353895){return _0x353895;});}return null;};}function removeEntity(_0x3826a1,_0x2c3c77){return function(_0x52e95c){if(_0x52e95c){return _0x52e95c[_0x1e7a('0x23')]()[_0x1e7a('0x24')](function(){var _0x12fcb7=_0x52e95c['get']({'plain':!![]});var _0x39500e='Pauses';return db['UserProfileResource'][_0x1e7a('0x23')]({'where':{'type':_0x39500e,'resourceId':_0x12fcb7['id']}})['then'](function(){return _0x52e95c;});})['then'](function(){_0x3826a1[_0x1e7a('0x18')](0xcc)[_0x1e7a('0x19')]();});}};}function handleEntityNotFound(_0x1df1c8,_0x45d427){return function(_0x3dfb28){if(!_0x3dfb28){_0x1df1c8[_0x1e7a('0x17')](0x194);}return _0x3dfb28;};}function handleError(_0x37fa3f,_0x16d0dc){_0x16d0dc=_0x16d0dc||0x1f4;return function(_0x496068){logger[_0x1e7a('0x25')](_0x496068[_0x1e7a('0x26')]);if(_0x496068[_0x1e7a('0x27')]){delete _0x496068['name'];}_0x37fa3f[_0x1e7a('0x18')](_0x16d0dc)[_0x1e7a('0x28')](_0x496068);};}exports[_0x1e7a('0x29')]=function(_0x3e220c,_0x21b5b5){var _0x43ee92={},_0x372616={},_0x623666={'count':0x0,'rows':[]};var _0x3e6ff6=_['map'](db[_0x1e7a('0x2a')][_0x1e7a('0x2b')],function(_0x214ddc){return{'name':_0x214ddc[_0x1e7a('0x2c')],'type':_0x214ddc['type'][_0x1e7a('0x2d')]};});_0x372616['model']=_[_0x1e7a('0x2e')](_0x3e6ff6,_0x1e7a('0x27'));_0x372616[_0x1e7a('0x2f')]=_['keys'](_0x3e220c['query']);_0x372616[_0x1e7a('0x30')]=_[_0x1e7a('0x31')](_0x372616[_0x1e7a('0x32')],_0x372616[_0x1e7a('0x2f')]);_0x43ee92[_0x1e7a('0x33')]=_[_0x1e7a('0x31')](_0x372616[_0x1e7a('0x32')],qs['fields'](_0x3e220c[_0x1e7a('0x2f')][_0x1e7a('0x34')]));_0x43ee92['attributes']=_0x43ee92['attributes'][_0x1e7a('0x35')]?_0x43ee92[_0x1e7a('0x33')]:_0x372616[_0x1e7a('0x32')];if(!_0x3e220c['query'][_0x1e7a('0x36')](_0x1e7a('0x37'))){_0x43ee92[_0x1e7a('0x38')]=qs[_0x1e7a('0x38')](_0x3e220c[_0x1e7a('0x2f')][_0x1e7a('0x38')]);_0x43ee92[_0x1e7a('0x1b')]=qs[_0x1e7a('0x1b')](_0x3e220c[_0x1e7a('0x2f')]['offset']);}_0x43ee92[_0x1e7a('0x39')]=qs[_0x1e7a('0x3a')](_0x3e220c['query'][_0x1e7a('0x3a')]);_0x43ee92[_0x1e7a('0x3b')]=qs[_0x1e7a('0x30')](_[_0x1e7a('0x3c')](_0x3e220c['query'],_0x372616[_0x1e7a('0x30')]),_0x3e6ff6);if(_0x3e220c[_0x1e7a('0x2f')][_0x1e7a('0x3d')]){_0x43ee92[_0x1e7a('0x3b')]=_[_0x1e7a('0x3e')](_0x43ee92[_0x1e7a('0x3b')],{'$or':_[_0x1e7a('0x2e')](_0x3e6ff6,function(_0x52a29b){if(_0x52a29b['type']!=='VIRTUAL'){var _0x41d797={};_0x41d797[_0x52a29b[_0x1e7a('0x27')]]={'$like':'%'+_0x3e220c[_0x1e7a('0x2f')]['filter']+'%'};return _0x41d797;}})});}_0x43ee92=_[_0x1e7a('0x3e')]({},_0x43ee92,_0x3e220c[_0x1e7a('0x3f')]);var _0xab1e11={'where':_0x43ee92[_0x1e7a('0x3b')]};return db[_0x1e7a('0x2a')]['count'](_0xab1e11)['then'](function(_0x165e25){_0x623666[_0x1e7a('0x1d')]=_0x165e25;if(_0x3e220c[_0x1e7a('0x2f')][_0x1e7a('0x40')]){_0x43ee92[_0x1e7a('0x41')]=[{'all':!![]}];}return db[_0x1e7a('0x2a')][_0x1e7a('0x42')](_0x43ee92);})[_0x1e7a('0x24')](function(_0x33d932){_0x623666[_0x1e7a('0x43')]=_0x33d932;return _0x623666;})[_0x1e7a('0x24')](respondWithFilteredResult(_0x21b5b5,_0x43ee92))[_0x1e7a('0x44')](handleError(_0x21b5b5,null));};exports[_0x1e7a('0x45')]=function(_0x2a62d1,_0x3d799c){var _0x2c4f69={'raw':!![],'where':{'id':_0x2a62d1[_0x1e7a('0x46')]['id']}},_0x43004c={};_0x43004c[_0x1e7a('0x32')]=_[_0x1e7a('0x47')](db[_0x1e7a('0x2a')][_0x1e7a('0x2b')]);_0x43004c[_0x1e7a('0x2f')]=_[_0x1e7a('0x47')](_0x2a62d1['query']);_0x43004c[_0x1e7a('0x30')]=_[_0x1e7a('0x31')](_0x43004c[_0x1e7a('0x32')],_0x43004c[_0x1e7a('0x2f')]);_0x2c4f69[_0x1e7a('0x33')]=_[_0x1e7a('0x31')](_0x43004c[_0x1e7a('0x32')],qs[_0x1e7a('0x34')](_0x2a62d1[_0x1e7a('0x2f')][_0x1e7a('0x34')]));_0x2c4f69['attributes']=_0x2c4f69[_0x1e7a('0x33')][_0x1e7a('0x35')]?_0x2c4f69['attributes']:_0x43004c['model'];if(_0x2a62d1[_0x1e7a('0x2f')][_0x1e7a('0x40')]){_0x2c4f69[_0x1e7a('0x41')]=[{'all':!![]}];}_0x2c4f69=_[_0x1e7a('0x3e')]({},_0x2c4f69,_0x2a62d1[_0x1e7a('0x3f')]);return db[_0x1e7a('0x2a')][_0x1e7a('0x48')](_0x2c4f69)[_0x1e7a('0x24')](handleEntityNotFound(_0x3d799c,null))['then'](respondWithResult(_0x3d799c,null))[_0x1e7a('0x44')](handleError(_0x3d799c,null));};exports[_0x1e7a('0x49')]=function(_0x1b69ae,_0x3a30f5){return db['Pause']['create'](_0x1b69ae[_0x1e7a('0x4a')],{})[_0x1e7a('0x24')](function(_0x4bc47d){var _0xae25df=_0x1b69ae['user'][_0x1e7a('0x4b')]({'plain':!![]});if(!_0xae25df)throw new Error(_0x1e7a('0x4c'));if(_0xae25df['role']===_0x1e7a('0x4d')){var _0x161bae=_0x4bc47d['get']({'plain':!![]});var _0x16ae69='Pauses';return db['UserProfileSection']['find']({'where':{'name':_0x16ae69,'userProfileId':_0xae25df[_0x1e7a('0x4e')]},'raw':!![]})[_0x1e7a('0x24')](function(_0x54ba01){if(_0x54ba01&&_0x54ba01[_0x1e7a('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x161bae[_0x1e7a('0x27')],'resourceId':_0x161bae['id'],'type':_0x54ba01[_0x1e7a('0x27')],'sectionId':_0x54ba01['id']},{})[_0x1e7a('0x24')](function(){return _0x4bc47d;});}else{return _0x4bc47d;}})['catch'](function(_0x28def2){logger[_0x1e7a('0x25')](_0x1e7a('0x50'),_0x28def2);throw _0x28def2;});}return _0x4bc47d;})[_0x1e7a('0x24')](respondWithResult(_0x3a30f5,0xc9))[_0x1e7a('0x44')](handleError(_0x3a30f5,null));};exports[_0x1e7a('0x22')]=function(_0x2e5517,_0x4b60d2){if(_0x2e5517[_0x1e7a('0x4a')]['id']){delete _0x2e5517[_0x1e7a('0x4a')]['id'];}return db[_0x1e7a('0x2a')][_0x1e7a('0x48')]({'where':{'id':_0x2e5517[_0x1e7a('0x46')]['id']}})[_0x1e7a('0x24')](handleEntityNotFound(_0x4b60d2,null))['then'](saveUpdates(_0x2e5517[_0x1e7a('0x4a')],null))[_0x1e7a('0x24')](respondWithResult(_0x4b60d2,null))[_0x1e7a('0x44')](handleError(_0x4b60d2,null));};exports[_0x1e7a('0x23')]=function(_0x3952ce,_0x4b9227){return db['Pause'][_0x1e7a('0x48')]({'where':{'id':_0x3952ce[_0x1e7a('0x46')]['id']}})['then'](handleEntityNotFound(_0x4b9227,null))[_0x1e7a('0x24')](removeEntity(_0x4b9227,null))[_0x1e7a('0x44')](handleError(_0x4b9227,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 698e535..bc58bdd 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 _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x205407,_0x4147dc){var _0x52671d=function(_0x5220ba){while(--_0x5220ba){_0x205407['push'](_0x205407['shift']());}};_0x52671d(++_0x4147dc);}(_0xe14b,0x93));var _0xbe14=function(_0x9a9afc,_0x57615a){_0x9a9afc=_0x9a9afc-0x0;var _0xc2014=_0xe14b[_0x9a9afc];return _0xc2014;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x51d71a,_0x596fda){var _0xff01f1=function(_0x30480f){while(--_0x30480f){_0x51d71a['push'](_0x51d71a['shift']());}};_0xff01f1(++_0x596fda);}(_0x7217,0x19e));var _0x7721=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x7217[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 1cdab26..e27f394 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x542c08,_0x38dc31){var _0x505ae5=function(_0x4b9a88){while(--_0x4b9a88){_0x542c08['push'](_0x542c08['shift']());}};_0x505ae5(++_0x38dc31);}(_0x7a54,0x106));var _0x47a5=function(_0x4dd9bb,_0x4bd92b){_0x4dd9bb=_0x4dd9bb-0x0;var _0x22da26=_0x7a54[_0x4dd9bb];return _0x22da26;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x48e5a2,_0x24fbba){var _0x3cb42d=function(_0x12d321){while(--_0x12d321){_0x48e5a2['push'](_0x48e5a2['shift']());}};_0x3cb42d(++_0x24fbba);}(_0x7a54,0x106));var _0x47a5=function(_0x4adb9d,_0x2ce893){_0x4adb9d=_0x4adb9d-0x0;var _0xbbbce0=_0x7a54[_0x4adb9d];return _0xbbbce0;};'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 877e619..a738498 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 _0x207c=['file','upload','post','webhookPost','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/webhook','/:id','isAuthenticated','/:id/download','download','diskStorage','root','originalname','replace','format','%s-%s%s','extname','now','single'];(function(_0x5191e2,_0x11637c){var _0x5d47ae=function(_0x4328f6){while(--_0x4328f6){_0x5191e2['push'](_0x5191e2['shift']());}};_0x5d47ae(++_0x11637c);}(_0x207c,0x1e8));var _0xc207=function(_0x57f91f,_0x21cf17){_0x57f91f=_0x57f91f-0x0;var _0x4deca6=_0x207c[_0x57f91f];return _0x4deca6;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var fs_extra=require(_0xc207('0x5'));var auth=require(_0xc207('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc207('0x7'));var controller=require('./plugin.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc207('0x8')]);router[_0xc207('0x9')](_0xc207('0xa'),controller['webhookGet']);router[_0xc207('0x9')](_0xc207('0xb'),auth[_0xc207('0xc')](),controller['show']);router[_0xc207('0x9')](_0xc207('0xd'),auth[_0xc207('0xc')](),controller[_0xc207('0xe')]);var upload=multer({'storage':multer[_0xc207('0xf')]({'destination':function(_0x347549,_0x487d95,_0x574425){_0x574425(null,path['join'](config[_0xc207('0x10')],'server/files/plugins'));},'filename':function(_0x2741f3,_0x2782ce,_0x59d401){_0x2782ce[_0xc207('0x11')]=_0x2782ce[_0xc207('0x11')][_0xc207('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59d401(null,util[_0xc207('0x13')](_0xc207('0x14'),path['basename'](_0x2782ce[_0xc207('0x11')],path[_0xc207('0x15')](_0x2782ce[_0xc207('0x11')])),Date[_0xc207('0x16')](),path['extname'](_0x2782ce['originalname'])));}})});router['post']('/',upload[_0xc207('0x17')](_0xc207('0x18')),controller[_0xc207('0x19')]);router[_0xc207('0x1a')]('/webhook',controller[_0xc207('0x1b')]);router[_0xc207('0x1c')](_0xc207('0xb'),auth['isAuthenticated'](),controller[_0xc207('0x1d')]);router['delete'](_0xc207('0xb'),auth[_0xc207('0xc')](),controller[_0xc207('0x1e')]);module[_0xc207('0x1f')]=router; \ No newline at end of file +var _0xb458=['show','/:id/download','diskStorage','server/files/plugins','originalname','replace','format','%s-%s%s','basename','now','extname','post','single','file','upload','webhookPost','put','/:id','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','index','get','/webhook','webhookGet','isAuthenticated'];(function(_0x310f10,_0x15991a){var _0x4c7c25=function(_0x1439af){while(--_0x1439af){_0x310f10['push'](_0x310f10['shift']());}};_0x4c7c25(++_0x15991a);}(_0xb458,0x103));var _0x8b45=function(_0x301112,_0x352b2d){_0x301112=_0x301112-0x0;var _0x429557=_0xb458[_0x301112];return _0x429557;};'use strict';var multer=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b45('0x3')]();var fs_extra=require(_0x8b45('0x4'));var auth=require(_0x8b45('0x5'));var interaction=require(_0x8b45('0x6'));var config=require('../../config/environment');var controller=require(_0x8b45('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8b45('0x8')]);router[_0x8b45('0x9')](_0x8b45('0xa'),controller[_0x8b45('0xb')]);router[_0x8b45('0x9')]('/:id',auth[_0x8b45('0xc')](),controller[_0x8b45('0xd')]);router[_0x8b45('0x9')](_0x8b45('0xe'),auth[_0x8b45('0xc')](),controller['download']);var upload=multer({'storage':multer[_0x8b45('0xf')]({'destination':function(_0x7cc49b,_0x57faf9,_0x5316af){_0x5316af(null,path['join'](config['root'],_0x8b45('0x10')));},'filename':function(_0x285728,_0x37c220,_0x52c4db){_0x37c220[_0x8b45('0x11')]=_0x37c220[_0x8b45('0x11')][_0x8b45('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52c4db(null,util[_0x8b45('0x13')](_0x8b45('0x14'),path[_0x8b45('0x15')](_0x37c220['originalname'],path['extname'](_0x37c220[_0x8b45('0x11')])),Date[_0x8b45('0x16')](),path[_0x8b45('0x17')](_0x37c220[_0x8b45('0x11')])));}})});router[_0x8b45('0x18')]('/',upload[_0x8b45('0x19')](_0x8b45('0x1a')),controller[_0x8b45('0x1b')]);router[_0x8b45('0x18')](_0x8b45('0xa'),controller[_0x8b45('0x1c')]);router[_0x8b45('0x1d')](_0x8b45('0x1e'),auth[_0x8b45('0xc')](),controller[_0x8b45('0x1f')]);router[_0x8b45('0x20')](_0x8b45('0x1e'),auth[_0x8b45('0xc')](),controller['delete']);module[_0x8b45('0x21')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index a20cec5..c04de91 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 _0x4754=['ENUM','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','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING'];(function(_0x22ee1e,_0x3eff80){var _0x49a5c9=function(_0x373480){while(--_0x373480){_0x22ee1e['push'](_0x22ee1e['shift']());}};_0x49a5c9(++_0x3eff80);}(_0x4754,0x135));var _0x4475=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4754[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4475('0x0'));module[_0x4475('0x1')]={'name':{'type':Sequelize[_0x4475('0x2')]},'type':{'type':Sequelize[_0x4475('0x3')]('html',_0x4475('0x4'))},'description':{'type':Sequelize[_0x4475('0x5')]},'version':{'type':Sequelize[_0x4475('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x4475('0x6')},'active':{'type':Sequelize[_0x4475('0x7')],'defaultValue':0x0,'comment':_0x4475('0x8')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0x4475('0x9'),_0x4475('0xa'),'never'),'defaultValue':_0x4475('0xa'),'comment':_0x4475('0xb')},'icon':{'type':Sequelize[_0x4475('0x2')]},'adminUrl':{'type':Sequelize[_0x4475('0x2')]},'agentUrl':{'type':Sequelize[_0x4475('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x4475('0x2')]}}; \ No newline at end of file +var _0x9fa2=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','html','TEXT','STRING'];(function(_0xf3371,_0x28b83a){var _0xba9296=function(_0x59f0f8){while(--_0x59f0f8){_0xf3371['push'](_0xf3371['shift']());}};_0xba9296(++_0x28b83a);}(_0x9fa2,0xec));var _0x29fa=function(_0x24d24e,_0x4e17a4){_0x24d24e=_0x24d24e-0x0;var _0x20e068=_0x9fa2[_0x24d24e];return _0x20e068;};'use strict';var Sequelize=require(_0x29fa('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x29fa('0x1'),'script')},'description':{'type':Sequelize[_0x29fa('0x2')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x29fa('0x3')],'comment':_0x29fa('0x4')},'active':{'type':Sequelize[_0x29fa('0x5')],'defaultValue':0x0,'comment':_0x29fa('0x6')},'sidebar':{'type':Sequelize[_0x29fa('0x7')](_0x29fa('0x8'),_0x29fa('0x9'),'always','never'),'defaultValue':_0x29fa('0xa'),'comment':_0x29fa('0xb')},'icon':{'type':Sequelize[_0x29fa('0x3')]},'adminUrl':{'type':Sequelize[_0x29fa('0x3')]},'agentUrl':{'type':Sequelize[_0x29fa('0x3')]},'scriptName':{'type':Sequelize[_0x29fa('0x3')]},'scriptPath':{'type':Sequelize[_0x29fa('0x3')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 7990a26..76efef1 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 _0x1632=['extname','root','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','role','UserProfileSection','Plugins','userProfileId','create','send','Extracted\x20folder\x20removed','body','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','http://localhost:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','Plugin','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','length','download','find','server/files/plugins','%s.zip','createWriteStream','zip','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','join','dirname','basename','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename'];(function(_0x42d63a,_0x36fa2e){var _0x5065d4=function(_0x26a595){while(--_0x26a595){_0x42d63a['push'](_0x42d63a['shift']());}};_0x5065d4(++_0x36fa2e);}(_0x1632,0xec));var _0x2163=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1632[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x2163('0x0'));var rimraf=require(_0x2163('0x1'));var zipdir=require(_0x2163('0x2'));var jsonpatch=require(_0x2163('0x3'));var rp=require(_0x2163('0x4'));var moment=require('moment');var BPromise=require(_0x2163('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2163('0x6'));var sox=require(_0x2163('0x7'));var csv=require(_0x2163('0x8'));var ejs=require(_0x2163('0x9'));var fs=require('fs');var fs_extra=require(_0x2163('0xa'));var _=require(_0x2163('0xb'));var squel=require(_0x2163('0xc'));var crypto=require('crypto');var jsforce=require(_0x2163('0xd'));var deskjs=require(_0x2163('0xe'));var toCsv=require(_0x2163('0x8'));var querystring=require('querystring');var Papa=require(_0x2163('0xf'));var extract=require(_0x2163('0x10'));var rimraf=require(_0x2163('0x1'));var archiver=require('archiver');var Redis=require(_0x2163('0x11'));var authService=require(_0x2163('0x12'));var qs=require(_0x2163('0x13'));var as=require(_0x2163('0x14'));var hardwareService=require(_0x2163('0x15'));var logger=require(_0x2163('0x16'))(_0x2163('0x17'));var utils=require('../../config/utils');var config=require(_0x2163('0x18'));var licenseUtil=require(_0x2163('0x19'));var db=require(_0x2163('0x1a'))['db'];config[_0x2163('0x1b')]=_[_0x2163('0x1c')](config[_0x2163('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x2163('0x1d'))(new Redis(config['redis']));require(_0x2163('0x1e'))[_0x2163('0x1f')](socket);function respondWithStatusCode(_0x1ddbd9,_0x4448f9){_0x4448f9=_0x4448f9||0xcc;return function(_0x4b7c7d){if(_0x4b7c7d){return _0x1ddbd9[_0x2163('0x20')](_0x4448f9);}return _0x1ddbd9[_0x2163('0x21')](_0x4448f9)[_0x2163('0x22')]();};}function respondWithResult(_0x59868e,_0x2f2d90){_0x2f2d90=_0x2f2d90||0xc8;return function(_0x2173bb){if(_0x2173bb){return _0x59868e[_0x2163('0x21')](_0x2f2d90)[_0x2163('0x23')](_0x2173bb);}};}function respondWithFilteredResult(_0x4ab5f0,_0x3511b4){return function(_0x3dae36){if(_0x3dae36){var _0x4365a1=typeof _0x3511b4[_0x2163('0x24')]===_0x2163('0x25')&&typeof _0x3511b4[_0x2163('0x26')]===_0x2163('0x25');var _0xec6bea=_0x3dae36['count'];var _0x5a262c=_0x4365a1?0x0:_0x3511b4[_0x2163('0x24')];var _0x547ccb=_0x4365a1?_0x3dae36['count']:_0x3511b4['offset']+_0x3511b4[_0x2163('0x26')];var _0x5ad666;if(_0x547ccb>=_0xec6bea){_0x547ccb=_0xec6bea;_0x5ad666=0xc8;}else{_0x5ad666=0xce;}_0x4ab5f0[_0x2163('0x21')](_0x5ad666);return _0x4ab5f0[_0x2163('0x27')](_0x2163('0x28'),_0x5a262c+'-'+_0x547ccb+'/'+_0xec6bea)[_0x2163('0x23')](_0x3dae36);}return null;};}function patchUpdates(_0x3a38bf){return function(_0x3dc385){try{jsonpatch[_0x2163('0x29')](_0x3dc385,_0x3a38bf,!![]);}catch(_0x115341){return BPromise[_0x2163('0x2a')](_0x115341);}return _0x3dc385[_0x2163('0x2b')]();};}function saveUpdates(_0x7e3a6b,_0x230b45){return function(_0x3452ca){if(_0x3452ca){return _0x3452ca[_0x2163('0x2c')](_0x7e3a6b)[_0x2163('0x2d')](function(_0x4d2b32){return _0x4d2b32;});}return null;};}function removeEntity(_0x548e48,_0x449c92){return function(_0x1d4993){if(_0x1d4993){return _0x1d4993[_0x2163('0x2e')]()[_0x2163('0x2d')](function(){var _0x3afbc9=_0x1d4993[_0x2163('0x2f')]({'plain':!![]});var _0xc96ea6='Plugins';return db[_0x2163('0x30')][_0x2163('0x2e')]({'where':{'type':_0xc96ea6,'resourceId':_0x3afbc9['id']}})['then'](function(){return _0x1d4993;});})[_0x2163('0x2d')](function(){_0x548e48[_0x2163('0x21')](0xcc)[_0x2163('0x22')]();});}};}function handleEntityNotFound(_0x4f8fda,_0x267587){return function(_0x4afdec){if(!_0x4afdec){_0x4f8fda[_0x2163('0x20')](0x194);}return _0x4afdec;};}function handleError(_0x1b1f7b,_0x39a39a){_0x39a39a=_0x39a39a||0x1f4;return function(_0x2e4dfb){logger[_0x2163('0x31')](_0x2e4dfb[_0x2163('0x32')]);if(_0x2e4dfb[_0x2163('0x33')]){delete _0x2e4dfb[_0x2163('0x33')];}_0x1b1f7b[_0x2163('0x21')](_0x39a39a)['send'](_0x2e4dfb);};}exports['index']=function(_0x1520a8,_0x2373bb){var _0x703b0c={},_0x2319a5={},_0xc19cd0={'count':0x0,'rows':[]};var _0x59dd1a=_[_0x2163('0x34')](db[_0x2163('0x35')][_0x2163('0x36')],function(_0x45fc8b){return{'name':_0x45fc8b['fieldName'],'type':_0x45fc8b[_0x2163('0x37')][_0x2163('0x38')]};});_0x2319a5['model']=_[_0x2163('0x34')](_0x59dd1a,_0x2163('0x33'));_0x2319a5[_0x2163('0x39')]=_[_0x2163('0x3a')](_0x1520a8[_0x2163('0x39')]);_0x2319a5[_0x2163('0x3b')]=_[_0x2163('0x3c')](_0x2319a5['model'],_0x2319a5[_0x2163('0x39')]);_0x703b0c[_0x2163('0x3d')]=_[_0x2163('0x3c')](_0x2319a5[_0x2163('0x3e')],qs[_0x2163('0x3f')](_0x1520a8[_0x2163('0x39')][_0x2163('0x3f')]));_0x703b0c['attributes']=_0x703b0c[_0x2163('0x3d')]['length']?_0x703b0c[_0x2163('0x3d')]:_0x2319a5['model'];if(!_0x1520a8[_0x2163('0x39')][_0x2163('0x40')](_0x2163('0x41'))){_0x703b0c[_0x2163('0x26')]=qs[_0x2163('0x26')](_0x1520a8['query'][_0x2163('0x26')]);_0x703b0c[_0x2163('0x24')]=qs[_0x2163('0x24')](_0x1520a8['query'][_0x2163('0x24')]);}_0x703b0c[_0x2163('0x42')]=qs[_0x2163('0x43')](_0x1520a8[_0x2163('0x39')][_0x2163('0x43')]);_0x703b0c[_0x2163('0x44')]=qs[_0x2163('0x3b')](_[_0x2163('0x45')](_0x1520a8[_0x2163('0x39')],_0x2319a5[_0x2163('0x3b')]),_0x59dd1a);if(_0x1520a8['query'][_0x2163('0x46')]){_0x703b0c[_0x2163('0x44')]=_[_0x2163('0x47')](_0x703b0c['where'],{'$or':_[_0x2163('0x34')](_0x59dd1a,function(_0x1c52c9){if(_0x1c52c9[_0x2163('0x37')]!=='VIRTUAL'){var _0x1d1b58={};_0x1d1b58[_0x1c52c9['name']]={'$like':'%'+_0x1520a8[_0x2163('0x39')][_0x2163('0x46')]+'%'};return _0x1d1b58;}})});}_0x703b0c=_['merge']({},_0x703b0c,_0x1520a8[_0x2163('0x48')]);var _0x8f5e9a={'where':_0x703b0c['where']};return db[_0x2163('0x35')]['count'](_0x8f5e9a)[_0x2163('0x2d')](function(_0x23a69c){_0xc19cd0[_0x2163('0x49')]=_0x23a69c;if(_0x1520a8['query'][_0x2163('0x4a')]){_0x703b0c[_0x2163('0x4b')]=[{'all':!![]}];}return db['Plugin'][_0x2163('0x4c')](_0x703b0c);})[_0x2163('0x2d')](function(_0x589aa7){_0xc19cd0[_0x2163('0x4d')]=_0x589aa7;return _0xc19cd0;})['then'](respondWithFilteredResult(_0x2373bb,_0x703b0c))[_0x2163('0x4e')](handleError(_0x2373bb,null));};exports[_0x2163('0x4f')]=function(_0x58b4c3,_0x23cf4b){var _0x269d12={'raw':!![],'where':{'id':_0x58b4c3[_0x2163('0x50')]['id']}},_0x343855={};_0x343855[_0x2163('0x3e')]=_['keys'](db[_0x2163('0x35')][_0x2163('0x36')]);_0x343855[_0x2163('0x39')]=_[_0x2163('0x3a')](_0x58b4c3[_0x2163('0x39')]);_0x343855[_0x2163('0x3b')]=_[_0x2163('0x3c')](_0x343855[_0x2163('0x3e')],_0x343855[_0x2163('0x39')]);_0x269d12[_0x2163('0x3d')]=_[_0x2163('0x3c')](_0x343855[_0x2163('0x3e')],qs[_0x2163('0x3f')](_0x58b4c3[_0x2163('0x39')][_0x2163('0x3f')]));_0x269d12[_0x2163('0x3d')]=_0x269d12[_0x2163('0x3d')][_0x2163('0x51')]?_0x269d12[_0x2163('0x3d')]:_0x343855[_0x2163('0x3e')];if(_0x58b4c3['query']['includeAll']){_0x269d12[_0x2163('0x4b')]=[{'all':!![]}];}_0x269d12=_[_0x2163('0x47')]({},_0x269d12,_0x58b4c3[_0x2163('0x48')]);return db['Plugin']['find'](_0x269d12)[_0x2163('0x2d')](handleEntityNotFound(_0x23cf4b,null))['then'](respondWithResult(_0x23cf4b,null))[_0x2163('0x4e')](handleError(_0x23cf4b,null));};exports[_0x2163('0x52')]=function(_0x47c94c,_0x3f2bfd,_0x4392df){return db[_0x2163('0x35')][_0x2163('0x53')]({'where':{'id':_0x47c94c[_0x2163('0x50')]['id']},'attributes':[_0x2163('0x33'),_0x2163('0x6')],'raw':!![]})[_0x2163('0x2d')](handleEntityNotFound(_0x3f2bfd,null))[_0x2163('0x2d')](function(_0x20b301){if(_0x20b301){var _0x8f4b7a=path['join'](config['root'],_0x2163('0x54'),util['format'](_0x2163('0x55'),path['basename'](_0x20b301[_0x2163('0x6')])));var _0x204130=fs[_0x2163('0x56')](_0x8f4b7a);var _0x38ba7d=archiver(_0x2163('0x57'),{'zlib':{'level':0x9}});_0x38ba7d['on']('warning',function(_0x33865d){if(_0x33865d[_0x2163('0x58')]==='ENOENT'){logger[_0x2163('0x31')](_0x33865d);}else{throw new db[(_0x2163('0x59'))][(_0x2163('0x5a'))](_0x2163('0x5b'));}});_0x38ba7d['on'](_0x2163('0x31'),function(_0x7eb27a){throw new db['Sequelize'][(_0x2163('0x5a'))](_0x2163('0x5b'));});_0x38ba7d['pipe'](_0x204130);_0x38ba7d[_0x2163('0x5c')](_0x2163('0x5d'),{'cwd':path[_0x2163('0x5e')](config['root'],_0x2163('0x54'),path[_0x2163('0x5f')](_0x20b301[_0x2163('0x6')])),'ignore':[path[_0x2163('0x5e')](path[_0x2163('0x60')](_0x20b301['path']),_0x2163('0x61')),path[_0x2163('0x5e')](path['basename'](_0x20b301[_0x2163('0x6')]),_0x2163('0x62'))],'nodir':!![]})['finalize']();_0x204130['on'](_0x2163('0x63'),function(){if(!fs[_0x2163('0x64')](_0x8f4b7a)){throw new db['Sequelize'][(_0x2163('0x5a'))](_0x2163('0x65'));}return _0x3f2bfd['download'](_0x8f4b7a,util[_0x2163('0x66')](_0x2163('0x55'),path[_0x2163('0x60')](_0x20b301[_0x2163('0x6')])),function(_0x893c48){if(_0x893c48){throw new db[(_0x2163('0x59'))][(_0x2163('0x5a'))](_0x2163('0x67'));}fs[_0x2163('0x68')](_0x8f4b7a);logger[_0x2163('0x69')]('Download\x20completed');logger['info'](_0x2163('0x6a'));});});}return null;})[_0x2163('0x4e')](handleError(_0x3f2bfd,null));};exports[_0x2163('0x6b')]=function(_0x57978c,_0x4a75d4,_0x3d8a79){var _0x138a2a=path[_0x2163('0x60')](_0x57978c[_0x2163('0x6c')][_0x2163('0x6d')],path[_0x2163('0x6e')](_0x57978c['file'][_0x2163('0x6d')]));var _0x2b16bb=path['join'](config[_0x2163('0x6f')],_0x2163('0x54'),_0x57978c['file'][_0x2163('0x6d')]);var _0x5c04d5=path[_0x2163('0x5e')](config[_0x2163('0x6f')],_0x2163('0x54'),_0x138a2a);logger[_0x2163('0x69')](_0x2163('0x70'),_0x2b16bb);logger['info'](_0x2163('0x71'),_0x5c04d5);try{fs[_0x2163('0x72')](_0x2b16bb,parseInt(_0x2163('0x73'),0x8));extract(_0x2b16bb,{'dir':_0x5c04d5},function(_0x45bc95){if(_0x45bc95){logger[_0x2163('0x31')](_0x45bc95);handleError(_0x45bc95,!![]);};var _0x4af2ae=fs[_0x2163('0x74')](_0x5c04d5);if(_0x4af2ae[_0x2163('0x51')]>0x1){removeReferences(_0x2b16bb,_0x5c04d5);logger[_0x2163('0x31')]('Invalid\x20plugin\x20structure');return _0x3d8a79(new Error(_0x2163('0x75')));}var _0x36137c=fs['lstatSync'](path[_0x2163('0x5e')](_0x5c04d5,_0x4af2ae[0x0]));if(_0x36137c[_0x2163('0x76')]()){removeReferences(_0x2b16bb,_0x5c04d5);logger[_0x2163('0x31')]('Invalid\x20plugin\x20structure');return _0x3d8a79(new Error(_0x2163('0x75')));}if(_0x36137c[_0x2163('0x77')]()){var _0x4da3b1=fs[_0x2163('0x74')](path[_0x2163('0x5e')](_0x5c04d5,_0x4af2ae[0x0]));if(_0x4da3b1['length']===0x0){removeReferences(_0x2b16bb,_0x5c04d5);logger[_0x2163('0x31')](_0x2163('0x75'));return _0x3d8a79(new Error('Invalid\x20plugin\x20structure'));}var _0x2e7778=_0x4da3b1[_0x2163('0x78')](function(_0xcd8304){return _0xcd8304===_0x2163('0x79');});if(!_0x2e7778){return _0x3d8a79(new Error(_0x2163('0x7a')));}var _0x19031e=fs[_0x2163('0x7b')](path[_0x2163('0x5e')](_0x5c04d5,_0x4af2ae[0x0],_0x2163('0x79')));var _0x4eeddf=JSON[_0x2163('0x7c')](_0x19031e);if(_0x2163('0x25')==typeof _0x4eeddf['name']){return _0x3d8a79(new Error(_0x2163('0x7d')));}if('undefined'==typeof _0x4eeddf['type']){return _0x3d8a79(new Error(_0x2163('0x7e')));}if(_0x2163('0x25')==typeof _0x4eeddf[_0x2163('0x7f')]){return _0x3d8a79(new Error(_0x2163('0x80')));}if(_0x2163('0x25')==typeof _0x4eeddf[_0x2163('0x81')]){return _0x3d8a79(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x4eeddf[_0x2163('0x37')]===_0x2163('0x82')){if(_0x2163('0x25')==typeof _0x4eeddf[_0x2163('0x81')][_0x2163('0x83')]){return _0x3d8a79(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x2163('0x25')==typeof _0x4eeddf[_0x2163('0x81')][_0x2163('0x83')][_0x2163('0x84')]&&_0x2163('0x25')==typeof _0x4eeddf[_0x2163('0x81')][_0x2163('0x83')][_0x2163('0x85')]){return _0x3d8a79(new Error(_0x2163('0x86')));}}else if(_0x4eeddf['type']===_0x2163('0x87')){if('undefined'==typeof _0x4eeddf[_0x2163('0x81')][_0x2163('0x88')]){return _0x3d8a79(new Error(_0x2163('0x89')));}if(_0x2163('0x25')==typeof _0x4eeddf[_0x2163('0x81')][_0x2163('0x8a')]){return _0x3d8a79(new Error(_0x2163('0x8b')));}}else{return _0x3d8a79(new Error(_0x2163('0x8c')));}var _0xc9db44=_0x4eeddf[_0x2163('0x33')];var _0x49c24a=_0x4eeddf[_0x2163('0x8d')];var _0x5b70ff=_0x4eeddf[_0x2163('0x37')];var _0x25908d=_0x4eeddf[_0x2163('0x8e')]?_0x4eeddf[_0x2163('0x8e')]:_0x2163('0x8f');var _0x57a3c=_0x4eeddf['icon']?_0x4eeddf[_0x2163('0x90')]:'icon-apps';var _0x1302c6='';var _0x3764fb='';var _0xcae213='';var _0x4889ab='';var _0xe22da6=_0x4eeddf[_0x2163('0x7f')];if(_0x5b70ff===_0x2163('0x82')){if('undefined'!=typeof _0x4eeddf[_0x2163('0x81')]['views'][_0x2163('0x84')]){var _0x5bf668=_0x4eeddf[_0x2163('0x81')][_0x2163('0x83')][_0x2163('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x2163('0x91')](_0x5bf668)){_0x1302c6=path[_0x2163('0x5e')]('plugins',_0x138a2a,_0x4af2ae[0x0],_0x5bf668);}else{_0x1302c6=_0x5bf668;}}else{logger[_0x2163('0x69')](_0x2163('0x92'));}if(_0x2163('0x25')!=typeof _0x4eeddf[_0x2163('0x81')][_0x2163('0x83')][_0x2163('0x85')]){var _0x331de3=_0x4eeddf['parameters']['views'][_0x2163('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x2163('0x91')](_0x331de3)){_0x3764fb=path[_0x2163('0x5e')]('plugins',_0x138a2a,_0x4af2ae[0x0],_0x331de3);}else{_0x3764fb=_0x331de3;}}else{logger[_0x2163('0x69')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x5b70ff===_0x2163('0x87')){_0xcae213=_0x4eeddf[_0x2163('0x81')][_0x2163('0x88')];_0x4889ab=_0x4eeddf[_0x2163('0x81')][_0x2163('0x8a')];if('undefined'!=typeof _0x4eeddf['parameters'][_0x2163('0x83')]){if(_0x2163('0x25')!=typeof _0x4eeddf[_0x2163('0x81')][_0x2163('0x83')]['admin']){var _0x5bf668=_0x4eeddf[_0x2163('0x81')][_0x2163('0x83')][_0x2163('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x2163('0x91')](_0x5bf668)){_0x1302c6=path[_0x2163('0x5e')](_0x2163('0x93'),_0x138a2a,_0x4af2ae[0x0],_0x5bf668);}else{_0x1302c6=_0x5bf668;}}if(_0x2163('0x25')!=typeof _0x4eeddf['parameters']['views'][_0x2163('0x85')]){var _0x331de3=_0x4eeddf[_0x2163('0x81')]['views'][_0x2163('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x2163('0x91')](_0x331de3)){_0x3764fb=path['join'](_0x2163('0x93'),_0x138a2a,_0x4af2ae[0x0],_0x331de3);}else{_0x3764fb=_0x331de3;}}}}var _0x80df86={'name':_0xc9db44,'description':_0x49c24a,'path':path['join'](_0x138a2a,_0x4af2ae[0x0]),'type':_0x5b70ff,'sidebar':_0x25908d,'icon':_0x57a3c,'adminUrl':_0x1302c6,'agentUrl':_0x3764fb,'scriptName':_0xcae213,'scriptPath':_0x4889ab,'version':_0xe22da6};removeReferences(_0x2b16bb,null);return db['Plugin']['create'](_0x80df86)['then'](function(_0x252eef){var _0x44dd97={'role':_0x57978c['body'][_0x2163('0x94')],'userProfileId':_0x57978c['body']['userProfileId']};if(!_0x44dd97)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44dd97['role']==='user'){var _0x2a04b3=_0x252eef[_0x2163('0x2f')]({'plain':!![]});return db[_0x2163('0x95')][_0x2163('0x53')]({'where':{'name':_0x2163('0x96'),'userProfileId':_0x44dd97[_0x2163('0x97')]},'raw':!![]})[_0x2163('0x2d')](function(_0x2ab7c2){if(_0x2ab7c2&&_0x2ab7c2['autoAssociation']===0x0){return db[_0x2163('0x30')][_0x2163('0x98')]({'name':_0x2a04b3[_0x2163('0x33')],'resourceId':_0x2a04b3['id'],'type':_0x2ab7c2[_0x2163('0x33')],'sectionId':_0x2ab7c2['id']},{})[_0x2163('0x2d')](function(){return _0x252eef;});}else{return _0x252eef;}})[_0x2163('0x4e')](function(_0x303bdc){logger[_0x2163('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x303bdc);throw _0x303bdc;});}return _0x252eef;})['then'](respondWithResult(_0x4a75d4,null))[_0x2163('0x4e')](handleError(_0x4a75d4,null));}});}catch(_0x1914f8){_0x4a75d4[_0x2163('0x21')](0x1f4)[_0x2163('0x99')](_0x1914f8);}};function removeReferences(_0x23fd23,_0xa2f222){try{if(_0x23fd23){fs['unlinkSync'](_0x23fd23);logger['info']('Zip\x20archive\x20removed');}if(_0xa2f222){rimraf(_0xa2f222,function(){});logger[_0x2163('0x69')](_0x2163('0x9a'));}}catch(_0x34304f){logger[_0x2163('0x31')](_0x34304f);}}exports['update']=function(_0x1e7978,_0xd106ea,_0x35118c){return db[_0x2163('0x35')]['find']({'where':{'id':_0x1e7978[_0x2163('0x50')]['id']}})[_0x2163('0x2d')](handleEntityNotFound(_0xd106ea,null))[_0x2163('0x2d')](saveUpdates(_0x1e7978[_0x2163('0x9b')],null))[_0x2163('0x2d')](respondWithResult(_0xd106ea,null))[_0x2163('0x4e')](handleError(_0xd106ea,null));};exports[_0x2163('0x9c')]=function(_0xff84f3,_0x1bf65f,_0x27661e){return db['Plugin'][_0x2163('0x53')]({'where':{'id':_0xff84f3[_0x2163('0x50')]['id']}})['then'](function(_0x154cb8){if(_0x154cb8){return _0x154cb8[_0x2163('0x2e')]();}})[_0x2163('0x2d')](function(_0x4d87aa){rimraf(path[_0x2163('0x5e')](config[_0x2163('0x6f')],_0x2163('0x54'),path[_0x2163('0x5f')](_0x4d87aa[_0x2163('0x6')])),function(){});return _0x4d87aa;})['then'](handleEntityNotFound(_0x1bf65f,null))[_0x2163('0x2d')](respondWithStatusCode(_0x1bf65f,null))[_0x2163('0x4e')](handleError(_0x1bf65f,null));};exports[_0x2163('0x9d')]=function(_0x2a2227,_0x140c78,_0x406e7f){return BPromise[_0x2163('0x9e')]()[_0x2163('0x2d')](function(){if(!_0x2a2227[_0x2163('0x39')][_0x2163('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2a2227[_0x2163('0x39')][_0x2163('0x9f')]){throw new Error(_0x2163('0xa0'));}var _0x3871ac=_0x2a2227[_0x2163('0x39')][_0x2163('0xa1')]?_0x2a2227[_0x2163('0x39')][_0x2163('0xa1')]+':'+_0x2a2227[_0x2163('0x39')]['port']:'http://localhost:'+_0x2a2227[_0x2163('0x39')][_0x2163('0x9f')];var _0x2835a2=_0x2a2227[_0x2163('0x39')]['json']?_0x2a2227[_0x2163('0x39')]['json']:!![];var _0x2a9484=_0x2a2227[_0x2163('0x39')][_0x2163('0xa2')]?_0x2a2227['query']['encoding']:null;var _0x246ece={'method':_0x2a2227[_0x2163('0xa3')],'uri':util[_0x2163('0x66')](_0x2163('0xa4'),_0x3871ac,_0x2a2227[_0x2163('0x39')][_0x2163('0x6')]),'json':_0x2835a2,'resolveWithFullResponse':!![],'encoding':_0x2a9484,'qs':_0x2a2227[_0x2163('0x39')]};if(_0x2a2227[_0x2163('0xa5')]){_0x246ece[_0x2163('0xa5')]=_0x2a2227['headers'];if(_0x246ece['headers'][_0x2163('0xa6')]){delete _0x246ece['headers']['content-length'];}}if(_0x246ece[_0x2163('0xa5')][_0x2163('0xa7')]){delete _0x246ece[_0x2163('0xa5')][_0x2163('0xa7')];}return rp(_0x246ece);})['then'](function(_0x2a8821){if(_0x2a8821){_0x140c78[_0x2163('0x27')](_0x2a8821[_0x2163('0xa5')]);logger['info'](_0x2a8821['body']);if(_[_0x2163('0xa8')](_0x2a2227[_0x2163('0x39')]['path'],_0x2163('0x52'))&&_0x2a8821[_0x2163('0xa9')]==0x1f4){return _0x140c78[_0x2163('0x20')](_0x2a8821[_0x2163('0xa9')]);}else{return _0x140c78['status'](_0x2a8821['statusCode'])[_0x2163('0x99')](_0x2a8821[_0x2163('0x9b')]);}}else{return _0x140c78[_0x2163('0x20')](0xc8);}})[_0x2163('0x4e')](handleError(_0x140c78,null));};exports[_0x2163('0xaa')]=function(_0x1fceb8,_0x2fbb57,_0x249821){return BPromise[_0x2163('0x9e')]()[_0x2163('0x2d')](function(){if(!_0x1fceb8[_0x2163('0x39')][_0x2163('0x6')]){throw new Error(_0x2163('0xab'));}if(!_0x1fceb8['query'][_0x2163('0x9f')]){throw new Error(_0x2163('0xa0'));}var _0x260e9d=_0x1fceb8['query'][_0x2163('0xa1')]?_0x1fceb8[_0x2163('0x39')]['hostname']+':'+_0x1fceb8['query'][_0x2163('0x9f')]:_0x2163('0xac')+_0x1fceb8[_0x2163('0x39')][_0x2163('0x9f')];var _0x37bc00=_0x1fceb8[_0x2163('0x39')][_0x2163('0x23')]?_0x1fceb8[_0x2163('0x39')][_0x2163('0x23')]:!![];var _0xd59c7=_0x1fceb8['query'][_0x2163('0xa2')]?_0x1fceb8['query'][_0x2163('0xa2')]:null;var _0x33ba3e={'method':_0x1fceb8['method'],'uri':util[_0x2163('0x66')](_0x2163('0xa4'),_0x260e9d,_0x1fceb8[_0x2163('0x39')][_0x2163('0x6')]),'json':_0x37bc00,'resolveWithFullResponse':!![],'encoding':_0xd59c7,'body':_0x1fceb8[_0x2163('0x9b')]};if(_0x1fceb8[_0x2163('0xa5')]){_0x33ba3e['headers']=_0x1fceb8[_0x2163('0xa5')];if(_0x33ba3e[_0x2163('0xa5')]['content-length']){delete _0x33ba3e[_0x2163('0xa5')][_0x2163('0xa6')];}}if(_0x33ba3e[_0x2163('0xa5')][_0x2163('0xa7')]){delete _0x33ba3e[_0x2163('0xa5')]['content-type'];}return rp(_0x33ba3e);})['then'](function(_0x148e17){if(_0x148e17){_0x2fbb57['set'](_0x148e17[_0x2163('0xa5')]);logger[_0x2163('0x69')](_0x148e17[_0x2163('0x9b')]);return _0x2fbb57[_0x2163('0x21')](_0x148e17[_0x2163('0xa9')])[_0x2163('0x99')](_0x148e17[_0x2163('0x9b')]);}else{return _0x2fbb57[_0x2163('0x20')](0xc8);}})[_0x2163('0x4e')](handleError(_0x2fbb57,null));}; \ No newline at end of file +var _0x3f4d=['%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','get','Plugins','UserProfileResource','destroy','end','sendStatus','stack','name','send','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','includeAll','include','rows','catch','show','params','find','download','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','glob','**/*','join','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','agent','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','create','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method'];(function(_0x3c61d9,_0x3a87cb){var _0x1ff5ca=function(_0xfb8913){while(--_0xfb8913){_0x3c61d9['push'](_0x3c61d9['shift']());}};_0x1ff5ca(++_0x3a87cb);}(_0x3f4d,0x158));var _0xd3f4=function(_0xf35672,_0x3833af){_0xf35672=_0xf35672-0x0;var _0x26afcf=_0x3f4d[_0xf35672];return _0x26afcf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd3f4('0x0'));var zipdir=require(_0xd3f4('0x1'));var jsonpatch=require(_0xd3f4('0x2'));var rp=require(_0xd3f4('0x3'));var moment=require(_0xd3f4('0x4'));var BPromise=require(_0xd3f4('0x5'));var Mustache=require('mustache');var util=require(_0xd3f4('0x6'));var path=require(_0xd3f4('0x7'));var sox=require(_0xd3f4('0x8'));var csv=require(_0xd3f4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd3f4('0xa'));var squel=require(_0xd3f4('0xb'));var crypto=require(_0xd3f4('0xc'));var jsforce=require(_0xd3f4('0xd'));var deskjs=require(_0xd3f4('0xe'));var toCsv=require(_0xd3f4('0x9'));var querystring=require(_0xd3f4('0xf'));var Papa=require('papaparse');var extract=require(_0xd3f4('0x10'));var rimraf=require(_0xd3f4('0x0'));var archiver=require(_0xd3f4('0x11'));var Redis=require(_0xd3f4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd3f4('0x13'));var as=require(_0xd3f4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3f4('0x15'))('api');var utils=require(_0xd3f4('0x16'));var config=require(_0xd3f4('0x17'));var licenseUtil=require(_0xd3f4('0x18'));var db=require(_0xd3f4('0x19'))['db'];config[_0xd3f4('0x1a')]=_[_0xd3f4('0x1b')](config[_0xd3f4('0x1a')],{'host':_0xd3f4('0x1c'),'port':0x18eb});var socket=require(_0xd3f4('0x1d'))(new Redis(config[_0xd3f4('0x1a')]));require(_0xd3f4('0x1e'))[_0xd3f4('0x1f')](socket);function respondWithStatusCode(_0x119a72,_0x537a24){_0x537a24=_0x537a24||0xcc;return function(_0x52769a){if(_0x52769a){return _0x119a72['sendStatus'](_0x537a24);}return _0x119a72['status'](_0x537a24)['end']();};}function respondWithResult(_0x366922,_0x5897ff){_0x5897ff=_0x5897ff||0xc8;return function(_0x5c83ad){if(_0x5c83ad){return _0x366922[_0xd3f4('0x20')](_0x5897ff)[_0xd3f4('0x21')](_0x5c83ad);}};}function respondWithFilteredResult(_0x3a8c0f,_0x2b800e){return function(_0x16d845){if(_0x16d845){var _0x18fa4f=typeof _0x2b800e[_0xd3f4('0x22')]==='undefined'&&typeof _0x2b800e[_0xd3f4('0x23')]==='undefined';var _0x8076c9=_0x16d845[_0xd3f4('0x24')];var _0x10a42d=_0x18fa4f?0x0:_0x2b800e['offset'];var _0x56cc12=_0x18fa4f?_0x16d845[_0xd3f4('0x24')]:_0x2b800e[_0xd3f4('0x22')]+_0x2b800e[_0xd3f4('0x23')];var _0x4ec0a2;if(_0x56cc12>=_0x8076c9){_0x56cc12=_0x8076c9;_0x4ec0a2=0xc8;}else{_0x4ec0a2=0xce;}_0x3a8c0f['status'](_0x4ec0a2);return _0x3a8c0f[_0xd3f4('0x25')](_0xd3f4('0x26'),_0x10a42d+'-'+_0x56cc12+'/'+_0x8076c9)[_0xd3f4('0x21')](_0x16d845);}return null;};}function patchUpdates(_0x333f41){return function(_0x5d23e0){try{jsonpatch[_0xd3f4('0x27')](_0x5d23e0,_0x333f41,!![]);}catch(_0x1abfc3){return BPromise[_0xd3f4('0x28')](_0x1abfc3);}return _0x5d23e0[_0xd3f4('0x29')]();};}function saveUpdates(_0x7be2,_0x428b36){return function(_0x383ec8){if(_0x383ec8){return _0x383ec8[_0xd3f4('0x2a')](_0x7be2)[_0xd3f4('0x2b')](function(_0x2699f8){return _0x2699f8;});}return null;};}function removeEntity(_0xbc8604,_0x19fb43){return function(_0x501a12){if(_0x501a12){return _0x501a12['destroy']()[_0xd3f4('0x2b')](function(){var _0x564873=_0x501a12[_0xd3f4('0x2c')]({'plain':!![]});var _0x3d0a66=_0xd3f4('0x2d');return db[_0xd3f4('0x2e')][_0xd3f4('0x2f')]({'where':{'type':_0x3d0a66,'resourceId':_0x564873['id']}})[_0xd3f4('0x2b')](function(){return _0x501a12;});})['then'](function(){_0xbc8604['status'](0xcc)[_0xd3f4('0x30')]();});}};}function handleEntityNotFound(_0x204984,_0x1dd661){return function(_0x40fd8d){if(!_0x40fd8d){_0x204984[_0xd3f4('0x31')](0x194);}return _0x40fd8d;};}function handleError(_0xeab57f,_0x4ece70){_0x4ece70=_0x4ece70||0x1f4;return function(_0x4220cb){logger['error'](_0x4220cb[_0xd3f4('0x32')]);if(_0x4220cb[_0xd3f4('0x33')]){delete _0x4220cb[_0xd3f4('0x33')];}_0xeab57f[_0xd3f4('0x20')](_0x4ece70)[_0xd3f4('0x34')](_0x4220cb);};}exports['index']=function(_0x53dedf,_0x48c494){var _0x186690={},_0x2ebc38={},_0x2a992d={'count':0x0,'rows':[]};var _0x43fbe1=_[_0xd3f4('0x35')](db[_0xd3f4('0x36')][_0xd3f4('0x37')],function(_0x24fadd){return{'name':_0x24fadd[_0xd3f4('0x38')],'type':_0x24fadd[_0xd3f4('0x39')][_0xd3f4('0x3a')]};});_0x2ebc38[_0xd3f4('0x3b')]=_['map'](_0x43fbe1,_0xd3f4('0x33'));_0x2ebc38[_0xd3f4('0x3c')]=_[_0xd3f4('0x3d')](_0x53dedf[_0xd3f4('0x3c')]);_0x2ebc38['filters']=_[_0xd3f4('0x3e')](_0x2ebc38[_0xd3f4('0x3b')],_0x2ebc38['query']);_0x186690[_0xd3f4('0x3f')]=_['intersection'](_0x2ebc38[_0xd3f4('0x3b')],qs[_0xd3f4('0x40')](_0x53dedf[_0xd3f4('0x3c')][_0xd3f4('0x40')]));_0x186690['attributes']=_0x186690['attributes'][_0xd3f4('0x41')]?_0x186690['attributes']:_0x2ebc38[_0xd3f4('0x3b')];if(!_0x53dedf[_0xd3f4('0x3c')][_0xd3f4('0x42')](_0xd3f4('0x43'))){_0x186690[_0xd3f4('0x23')]=qs[_0xd3f4('0x23')](_0x53dedf[_0xd3f4('0x3c')][_0xd3f4('0x23')]);_0x186690[_0xd3f4('0x22')]=qs['offset'](_0x53dedf[_0xd3f4('0x3c')]['offset']);}_0x186690['order']=qs['sort'](_0x53dedf[_0xd3f4('0x3c')][_0xd3f4('0x44')]);_0x186690[_0xd3f4('0x45')]=qs[_0xd3f4('0x46')](_['pick'](_0x53dedf[_0xd3f4('0x3c')],_0x2ebc38[_0xd3f4('0x46')]),_0x43fbe1);if(_0x53dedf[_0xd3f4('0x3c')][_0xd3f4('0x47')]){_0x186690[_0xd3f4('0x45')]=_[_0xd3f4('0x48')](_0x186690[_0xd3f4('0x45')],{'$or':_['map'](_0x43fbe1,function(_0x4fadcd){if(_0x4fadcd[_0xd3f4('0x39')]!=='VIRTUAL'){var _0x205fb1={};_0x205fb1[_0x4fadcd[_0xd3f4('0x33')]]={'$like':'%'+_0x53dedf['query'][_0xd3f4('0x47')]+'%'};return _0x205fb1;}})});}_0x186690=_['merge']({},_0x186690,_0x53dedf['options']);var _0x38ab5f={'where':_0x186690['where']};return db[_0xd3f4('0x36')]['count'](_0x38ab5f)[_0xd3f4('0x2b')](function(_0x40cf4e){_0x2a992d['count']=_0x40cf4e;if(_0x53dedf[_0xd3f4('0x3c')][_0xd3f4('0x49')]){_0x186690[_0xd3f4('0x4a')]=[{'all':!![]}];}return db[_0xd3f4('0x36')]['findAll'](_0x186690);})[_0xd3f4('0x2b')](function(_0x2032c){_0x2a992d[_0xd3f4('0x4b')]=_0x2032c;return _0x2a992d;})['then'](respondWithFilteredResult(_0x48c494,_0x186690))[_0xd3f4('0x4c')](handleError(_0x48c494,null));};exports[_0xd3f4('0x4d')]=function(_0xbccdf9,_0x3fdfc0){var _0x4204c7={'raw':!![],'where':{'id':_0xbccdf9[_0xd3f4('0x4e')]['id']}},_0x39ae8b={};_0x39ae8b[_0xd3f4('0x3b')]=_[_0xd3f4('0x3d')](db[_0xd3f4('0x36')]['rawAttributes']);_0x39ae8b[_0xd3f4('0x3c')]=_['keys'](_0xbccdf9[_0xd3f4('0x3c')]);_0x39ae8b[_0xd3f4('0x46')]=_[_0xd3f4('0x3e')](_0x39ae8b[_0xd3f4('0x3b')],_0x39ae8b['query']);_0x4204c7[_0xd3f4('0x3f')]=_[_0xd3f4('0x3e')](_0x39ae8b[_0xd3f4('0x3b')],qs[_0xd3f4('0x40')](_0xbccdf9[_0xd3f4('0x3c')]['fields']));_0x4204c7[_0xd3f4('0x3f')]=_0x4204c7[_0xd3f4('0x3f')][_0xd3f4('0x41')]?_0x4204c7[_0xd3f4('0x3f')]:_0x39ae8b['model'];if(_0xbccdf9[_0xd3f4('0x3c')][_0xd3f4('0x49')]){_0x4204c7[_0xd3f4('0x4a')]=[{'all':!![]}];}_0x4204c7=_['merge']({},_0x4204c7,_0xbccdf9['options']);return db[_0xd3f4('0x36')][_0xd3f4('0x4f')](_0x4204c7)[_0xd3f4('0x2b')](handleEntityNotFound(_0x3fdfc0,null))[_0xd3f4('0x2b')](respondWithResult(_0x3fdfc0,null))[_0xd3f4('0x4c')](handleError(_0x3fdfc0,null));};exports[_0xd3f4('0x50')]=function(_0x4fd001,_0x3acc48,_0x515c82){return db['Plugin'][_0xd3f4('0x4f')]({'where':{'id':_0x4fd001['params']['id']},'attributes':[_0xd3f4('0x33'),_0xd3f4('0x7')],'raw':!![]})[_0xd3f4('0x2b')](handleEntityNotFound(_0x3acc48,null))[_0xd3f4('0x2b')](function(_0x456470){if(_0x456470){var _0x3819c4=path['join'](config[_0xd3f4('0x51')],_0xd3f4('0x52'),util[_0xd3f4('0x53')](_0xd3f4('0x54'),path[_0xd3f4('0x55')](_0x456470[_0xd3f4('0x7')])));var _0x20e755=fs[_0xd3f4('0x56')](_0x3819c4);var _0x32144e=archiver(_0xd3f4('0x57'),{'zlib':{'level':0x9}});_0x32144e['on'](_0xd3f4('0x58'),function(_0x3ccc3c){if(_0x3ccc3c[_0xd3f4('0x59')]==='ENOENT'){logger[_0xd3f4('0x5a')](_0x3ccc3c);}else{throw new db['Sequelize'][(_0xd3f4('0x5b'))](_0xd3f4('0x5c'));}});_0x32144e['on'](_0xd3f4('0x5a'),function(_0x573ad3){throw new db[(_0xd3f4('0x5d'))][(_0xd3f4('0x5b'))](_0xd3f4('0x5c'));});_0x32144e['pipe'](_0x20e755);_0x32144e[_0xd3f4('0x5e')](_0xd3f4('0x5f'),{'cwd':path[_0xd3f4('0x60')](config[_0xd3f4('0x51')],_0xd3f4('0x52'),path['dirname'](_0x456470[_0xd3f4('0x7')])),'ignore':[path[_0xd3f4('0x60')](path['basename'](_0x456470[_0xd3f4('0x7')]),_0xd3f4('0x61')),path['join'](path[_0xd3f4('0x55')](_0x456470[_0xd3f4('0x7')]),_0xd3f4('0x62'))],'nodir':!![]})[_0xd3f4('0x63')]();_0x20e755['on'](_0xd3f4('0x64'),function(){if(!fs[_0xd3f4('0x65')](_0x3819c4)){throw new db['Sequelize'][(_0xd3f4('0x5b'))]('Plugin\x20not\x20found');}return _0x3acc48[_0xd3f4('0x50')](_0x3819c4,util[_0xd3f4('0x53')](_0xd3f4('0x54'),path[_0xd3f4('0x55')](_0x456470[_0xd3f4('0x7')])),function(_0x2abb8a){if(_0x2abb8a){throw new db[(_0xd3f4('0x5d'))][(_0xd3f4('0x5b'))](_0xd3f4('0x66'));}fs[_0xd3f4('0x67')](_0x3819c4);logger[_0xd3f4('0x68')]('Download\x20completed');logger[_0xd3f4('0x68')]('Temporary\x20file\x20removed');});});}return null;})[_0xd3f4('0x4c')](handleError(_0x3acc48,null));};exports[_0xd3f4('0x69')]=function(_0x328f70,_0x4b15c9,_0x12bb67){var _0x197327=path[_0xd3f4('0x55')](_0x328f70[_0xd3f4('0x6a')][_0xd3f4('0x6b')],path[_0xd3f4('0x6c')](_0x328f70[_0xd3f4('0x6a')][_0xd3f4('0x6b')]));var _0x3ec200=path[_0xd3f4('0x60')](config['root'],_0xd3f4('0x52'),_0x328f70['file'][_0xd3f4('0x6b')]);var _0x46787a=path[_0xd3f4('0x60')](config[_0xd3f4('0x51')],_0xd3f4('0x52'),_0x197327);logger[_0xd3f4('0x68')](_0xd3f4('0x6d'),_0x3ec200);logger[_0xd3f4('0x68')]('Plugin\x20upload\x20destination:\x20%s',_0x46787a);try{fs[_0xd3f4('0x6e')](_0x3ec200,parseInt(_0xd3f4('0x6f'),0x8));extract(_0x3ec200,{'dir':_0x46787a},function(_0x8e68a9){if(_0x8e68a9){logger[_0xd3f4('0x5a')](_0x8e68a9);handleError(_0x8e68a9,!![]);};var _0x2bc8a1=fs[_0xd3f4('0x70')](_0x46787a);if(_0x2bc8a1[_0xd3f4('0x41')]>0x1){removeReferences(_0x3ec200,_0x46787a);logger[_0xd3f4('0x5a')](_0xd3f4('0x71'));return _0x12bb67(new Error(_0xd3f4('0x71')));}var _0x32714a=fs[_0xd3f4('0x72')](path[_0xd3f4('0x60')](_0x46787a,_0x2bc8a1[0x0]));if(_0x32714a['isFile']()){removeReferences(_0x3ec200,_0x46787a);logger[_0xd3f4('0x5a')]('Invalid\x20plugin\x20structure');return _0x12bb67(new Error(_0xd3f4('0x71')));}if(_0x32714a[_0xd3f4('0x73')]()){var _0x34f072=fs[_0xd3f4('0x70')](path[_0xd3f4('0x60')](_0x46787a,_0x2bc8a1[0x0]));if(_0x34f072[_0xd3f4('0x41')]===0x0){removeReferences(_0x3ec200,_0x46787a);logger[_0xd3f4('0x5a')](_0xd3f4('0x71'));return _0x12bb67(new Error(_0xd3f4('0x71')));}var _0x25d250=_0x34f072[_0xd3f4('0x74')](function(_0xc4a6f8){return _0xc4a6f8===_0xd3f4('0x75');});if(!_0x25d250){return _0x12bb67(new Error('Plugin\x20manifest\x20missing'));}var _0x59df6e=fs[_0xd3f4('0x76')](path[_0xd3f4('0x60')](_0x46787a,_0x2bc8a1[0x0],_0xd3f4('0x75')));var _0x43a66c=JSON[_0xd3f4('0x77')](_0x59df6e);if(_0xd3f4('0x78')==typeof _0x43a66c['name']){return _0x12bb67(new Error(_0xd3f4('0x79')));}if('undefined'==typeof _0x43a66c[_0xd3f4('0x39')]){return _0x12bb67(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xd3f4('0x78')==typeof _0x43a66c[_0xd3f4('0x7a')]){return _0x12bb67(new Error(_0xd3f4('0x7b')));}if(_0xd3f4('0x78')==typeof _0x43a66c[_0xd3f4('0x7c')]){return _0x12bb67(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x43a66c[_0xd3f4('0x39')]===_0xd3f4('0x7d')){if(_0xd3f4('0x78')==typeof _0x43a66c['parameters'][_0xd3f4('0x7e')]){return _0x12bb67(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xd3f4('0x78')==typeof _0x43a66c[_0xd3f4('0x7c')]['views'][_0xd3f4('0x7f')]&&_0xd3f4('0x78')==typeof _0x43a66c[_0xd3f4('0x7c')][_0xd3f4('0x7e')]['agent']){return _0x12bb67(new Error(_0xd3f4('0x80')));}}else if(_0x43a66c[_0xd3f4('0x39')]===_0xd3f4('0x81')){if(_0xd3f4('0x78')==typeof _0x43a66c['parameters'][_0xd3f4('0x82')]){return _0x12bb67(new Error(_0xd3f4('0x83')));}if(_0xd3f4('0x78')==typeof _0x43a66c['parameters'][_0xd3f4('0x84')]){return _0x12bb67(new Error(_0xd3f4('0x85')));}}else{return _0x12bb67(new Error(_0xd3f4('0x86')));}var _0x5433d1=_0x43a66c[_0xd3f4('0x33')];var _0x229038=_0x43a66c[_0xd3f4('0x87')];var _0x76d5fa=_0x43a66c['type'];var _0x554292=_0x43a66c[_0xd3f4('0x88')]?_0x43a66c['sidebar']:_0xd3f4('0x89');var _0x5731e6=_0x43a66c[_0xd3f4('0x8a')]?_0x43a66c['icon']:_0xd3f4('0x8b');var _0x22ff83='';var _0x10098d='';var _0x33f12c='';var _0x3894da='';var _0x596d83=_0x43a66c[_0xd3f4('0x7a')];if(_0x76d5fa===_0xd3f4('0x7d')){if(_0xd3f4('0x78')!=typeof _0x43a66c[_0xd3f4('0x7c')][_0xd3f4('0x7e')][_0xd3f4('0x7f')]){var _0x34ee44=_0x43a66c[_0xd3f4('0x7c')][_0xd3f4('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xd3f4('0x8c')](_0x34ee44)){_0x22ff83=path[_0xd3f4('0x60')](_0xd3f4('0x8d'),_0x197327,_0x2bc8a1[0x0],_0x34ee44);}else{_0x22ff83=_0x34ee44;}}else{logger[_0xd3f4('0x68')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xd3f4('0x78')!=typeof _0x43a66c['parameters'][_0xd3f4('0x7e')]['agent']){var _0x47bd74=_0x43a66c[_0xd3f4('0x7c')]['views'][_0xd3f4('0x8e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x47bd74)){_0x10098d=path[_0xd3f4('0x60')]('plugins',_0x197327,_0x2bc8a1[0x0],_0x47bd74);}else{_0x10098d=_0x47bd74;}}else{logger[_0xd3f4('0x68')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x76d5fa===_0xd3f4('0x81')){_0x33f12c=_0x43a66c[_0xd3f4('0x7c')]['scriptName'];_0x3894da=_0x43a66c[_0xd3f4('0x7c')]['scriptPath'];if(_0xd3f4('0x78')!=typeof _0x43a66c[_0xd3f4('0x7c')][_0xd3f4('0x7e')]){if(_0xd3f4('0x78')!=typeof _0x43a66c[_0xd3f4('0x7c')][_0xd3f4('0x7e')]['admin']){var _0x34ee44=_0x43a66c['parameters'][_0xd3f4('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xd3f4('0x8c')](_0x34ee44)){_0x22ff83=path[_0xd3f4('0x60')](_0xd3f4('0x8d'),_0x197327,_0x2bc8a1[0x0],_0x34ee44);}else{_0x22ff83=_0x34ee44;}}if('undefined'!=typeof _0x43a66c[_0xd3f4('0x7c')][_0xd3f4('0x7e')]['agent']){var _0x47bd74=_0x43a66c['parameters'][_0xd3f4('0x7e')][_0xd3f4('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0xd3f4('0x8c')](_0x47bd74)){_0x10098d=path[_0xd3f4('0x60')]('plugins',_0x197327,_0x2bc8a1[0x0],_0x47bd74);}else{_0x10098d=_0x47bd74;}}}}var _0x43b02b={'name':_0x5433d1,'description':_0x229038,'path':path['join'](_0x197327,_0x2bc8a1[0x0]),'type':_0x76d5fa,'sidebar':_0x554292,'icon':_0x5731e6,'adminUrl':_0x22ff83,'agentUrl':_0x10098d,'scriptName':_0x33f12c,'scriptPath':_0x3894da,'version':_0x596d83};removeReferences(_0x3ec200,null);return db[_0xd3f4('0x36')]['create'](_0x43b02b)[_0xd3f4('0x2b')](function(_0x4d1307){var _0x995918={'role':_0x328f70[_0xd3f4('0x8f')][_0xd3f4('0x90')],'userProfileId':_0x328f70['body']['userProfileId']};if(!_0x995918)throw new Error(_0xd3f4('0x91'));if(_0x995918[_0xd3f4('0x90')]==='user'){var _0x1a946a=_0x4d1307[_0xd3f4('0x2c')]({'plain':!![]});return db[_0xd3f4('0x92')][_0xd3f4('0x4f')]({'where':{'name':'Plugins','userProfileId':_0x995918[_0xd3f4('0x93')]},'raw':!![]})['then'](function(_0x23f00e){if(_0x23f00e&&_0x23f00e['autoAssociation']===0x0){return db[_0xd3f4('0x2e')][_0xd3f4('0x94')]({'name':_0x1a946a[_0xd3f4('0x33')],'resourceId':_0x1a946a['id'],'type':_0x23f00e[_0xd3f4('0x33')],'sectionId':_0x23f00e['id']},{})[_0xd3f4('0x2b')](function(){return _0x4d1307;});}else{return _0x4d1307;}})['catch'](function(_0x25a2ba){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25a2ba);throw _0x25a2ba;});}return _0x4d1307;})['then'](respondWithResult(_0x4b15c9,null))[_0xd3f4('0x4c')](handleError(_0x4b15c9,null));}});}catch(_0x249ae6){_0x4b15c9[_0xd3f4('0x20')](0x1f4)[_0xd3f4('0x34')](_0x249ae6);}};function removeReferences(_0x2198f5,_0xdbc8a0){try{if(_0x2198f5){fs['unlinkSync'](_0x2198f5);logger['info'](_0xd3f4('0x95'));}if(_0xdbc8a0){rimraf(_0xdbc8a0,function(){});logger[_0xd3f4('0x68')](_0xd3f4('0x96'));}}catch(_0x1de23c){logger[_0xd3f4('0x5a')](_0x1de23c);}}exports[_0xd3f4('0x2a')]=function(_0x234de9,_0x220da4,_0x385ff2){return db[_0xd3f4('0x36')][_0xd3f4('0x4f')]({'where':{'id':_0x234de9['params']['id']}})[_0xd3f4('0x2b')](handleEntityNotFound(_0x220da4,null))[_0xd3f4('0x2b')](saveUpdates(_0x234de9[_0xd3f4('0x8f')],null))[_0xd3f4('0x2b')](respondWithResult(_0x220da4,null))[_0xd3f4('0x4c')](handleError(_0x220da4,null));};exports['delete']=function(_0x5cba49,_0x61c390,_0x54d354){return db[_0xd3f4('0x36')]['find']({'where':{'id':_0x5cba49['params']['id']}})[_0xd3f4('0x2b')](function(_0x371e6d){if(_0x371e6d){return _0x371e6d[_0xd3f4('0x2f')]();}})['then'](function(_0x14baf9){rimraf(path[_0xd3f4('0x60')](config[_0xd3f4('0x51')],_0xd3f4('0x52'),path[_0xd3f4('0x97')](_0x14baf9[_0xd3f4('0x7')])),function(){});return _0x14baf9;})['then'](handleEntityNotFound(_0x61c390,null))[_0xd3f4('0x2b')](respondWithStatusCode(_0x61c390,null))[_0xd3f4('0x4c')](handleError(_0x61c390,null));};exports[_0xd3f4('0x98')]=function(_0x168d32,_0x2f636f,_0xeb1e38){return BPromise[_0xd3f4('0x99')]()[_0xd3f4('0x2b')](function(){if(!_0x168d32[_0xd3f4('0x3c')][_0xd3f4('0x7')]){throw new Error(_0xd3f4('0x9a'));}if(!_0x168d32[_0xd3f4('0x3c')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x17897f=_0x168d32[_0xd3f4('0x3c')][_0xd3f4('0x9b')]?_0x168d32[_0xd3f4('0x3c')]['hostname']+':'+_0x168d32[_0xd3f4('0x3c')][_0xd3f4('0x9c')]:_0xd3f4('0x9d')+_0x168d32[_0xd3f4('0x3c')][_0xd3f4('0x9c')];var _0x677766=_0x168d32[_0xd3f4('0x3c')][_0xd3f4('0x21')]?_0x168d32['query'][_0xd3f4('0x21')]:!![];var _0x4ad181=_0x168d32[_0xd3f4('0x3c')][_0xd3f4('0x9e')]?_0x168d32[_0xd3f4('0x3c')]['encoding']:null;var _0x46a67c={'method':_0x168d32[_0xd3f4('0x9f')],'uri':util['format'](_0xd3f4('0xa0'),_0x17897f,_0x168d32['query']['path']),'json':_0x677766,'resolveWithFullResponse':!![],'encoding':_0x4ad181,'qs':_0x168d32[_0xd3f4('0x3c')]};if(_0x168d32['headers']){_0x46a67c[_0xd3f4('0xa1')]=_0x168d32[_0xd3f4('0xa1')];if(_0x46a67c[_0xd3f4('0xa1')][_0xd3f4('0xa2')]){delete _0x46a67c[_0xd3f4('0xa1')][_0xd3f4('0xa2')];}}if(_0x46a67c[_0xd3f4('0xa1')]['content-type']){delete _0x46a67c[_0xd3f4('0xa1')][_0xd3f4('0xa3')];}return rp(_0x46a67c);})['then'](function(_0x203d34){if(_0x203d34){_0x2f636f[_0xd3f4('0x25')](_0x203d34[_0xd3f4('0xa1')]);logger['info'](_0x203d34['body']);if(_[_0xd3f4('0xa4')](_0x168d32[_0xd3f4('0x3c')][_0xd3f4('0x7')],_0xd3f4('0x50'))&&_0x203d34[_0xd3f4('0xa5')]==0x1f4){return _0x2f636f[_0xd3f4('0x31')](_0x203d34[_0xd3f4('0xa5')]);}else{return _0x2f636f[_0xd3f4('0x20')](_0x203d34['statusCode'])[_0xd3f4('0x34')](_0x203d34[_0xd3f4('0x8f')]);}}else{return _0x2f636f[_0xd3f4('0x31')](0xc8);}})[_0xd3f4('0x4c')](handleError(_0x2f636f,null));};exports[_0xd3f4('0xa6')]=function(_0x350bb6,_0x2d262e,_0x4e79e7){return BPromise[_0xd3f4('0x99')]()[_0xd3f4('0x2b')](function(){if(!_0x350bb6[_0xd3f4('0x3c')][_0xd3f4('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x350bb6['query']['port']){throw new Error(_0xd3f4('0xa7'));}var _0x4e48c9=_0x350bb6[_0xd3f4('0x3c')][_0xd3f4('0x9b')]?_0x350bb6[_0xd3f4('0x3c')][_0xd3f4('0x9b')]+':'+_0x350bb6[_0xd3f4('0x3c')][_0xd3f4('0x9c')]:_0xd3f4('0x9d')+_0x350bb6[_0xd3f4('0x3c')][_0xd3f4('0x9c')];var _0xdd437=_0x350bb6[_0xd3f4('0x3c')][_0xd3f4('0x21')]?_0x350bb6['query'][_0xd3f4('0x21')]:!![];var _0x2cee48=_0x350bb6[_0xd3f4('0x3c')][_0xd3f4('0x9e')]?_0x350bb6['query'][_0xd3f4('0x9e')]:null;var _0x2b239a={'method':_0x350bb6['method'],'uri':util[_0xd3f4('0x53')]('%s%s',_0x4e48c9,_0x350bb6['query'][_0xd3f4('0x7')]),'json':_0xdd437,'resolveWithFullResponse':!![],'encoding':_0x2cee48,'body':_0x350bb6[_0xd3f4('0x8f')]};if(_0x350bb6[_0xd3f4('0xa1')]){_0x2b239a['headers']=_0x350bb6[_0xd3f4('0xa1')];if(_0x2b239a[_0xd3f4('0xa1')][_0xd3f4('0xa2')]){delete _0x2b239a[_0xd3f4('0xa1')]['content-length'];}}if(_0x2b239a[_0xd3f4('0xa1')][_0xd3f4('0xa3')]){delete _0x2b239a['headers'][_0xd3f4('0xa3')];}return rp(_0x2b239a);})[_0xd3f4('0x2b')](function(_0x228efc){if(_0x228efc){_0x2d262e[_0xd3f4('0x25')](_0x228efc[_0xd3f4('0xa1')]);logger[_0xd3f4('0x68')](_0x228efc[_0xd3f4('0x8f')]);return _0x2d262e[_0xd3f4('0x20')](_0x228efc[_0xd3f4('0xa5')])[_0xd3f4('0x34')](_0x228efc[_0xd3f4('0x8f')]);}else{return _0x2d262e[_0xd3f4('0x31')](0xc8);}})[_0xd3f4('0x4c')](handleError(_0x2d262e,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 5c7b252..5e23cef 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 _0x37cc=['../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x14651c,_0x192495){var _0x20e480=function(_0x250717){while(--_0x250717){_0x14651c['push'](_0x14651c['shift']());}};_0x20e480(++_0x192495);}(_0x37cc,0x185));var _0xc37c=function(_0xcc7f5c,_0x407eb1){_0xcc7f5c=_0xcc7f5c-0x0;var _0x4cd2b9=_0x37cc[_0xcc7f5c];return _0x4cd2b9;};'use strict';var EventEmitter=require(_0xc37c('0x0'));var Plugin=require(_0xc37c('0x1'))['db'][_0xc37c('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xc37c('0x3')](0x0);var events={'afterCreate':_0xc37c('0x4'),'afterUpdate':_0xc37c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x55b158){return function(_0x334d3c,_0x946e3b,_0x310b02){PluginEvents[_0xc37c('0x6')](_0x55b158+':'+_0x334d3c['id'],_0x334d3c);PluginEvents[_0xc37c('0x6')](_0x55b158,_0x334d3c);_0x310b02(null);};}for(var e in events){if(events[_0xc37c('0x7')](e)){var event=events[e];Plugin[_0xc37c('0x8')](e,emitEvent(event));}}module[_0xc37c('0x9')]=PluginEvents; \ No newline at end of file +var _0x1af5=['emit','hasOwnProperty','hook','events','Plugin','setMaxListeners','save','update','remove'];(function(_0x398e24,_0xc01f8d){var _0x391262=function(_0x22a193){while(--_0x22a193){_0x398e24['push'](_0x398e24['shift']());}};_0x391262(++_0xc01f8d);}(_0x1af5,0x17d));var _0x51af=function(_0x58a405,_0x25c4a5){_0x58a405=_0x58a405-0x0;var _0x46e94b=_0x1af5[_0x58a405];return _0x46e94b;};'use strict';var EventEmitter=require(_0x51af('0x0'));var Plugin=require('../../mysqldb')['db'][_0x51af('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x51af('0x2')](0x0);var events={'afterCreate':_0x51af('0x3'),'afterUpdate':_0x51af('0x4'),'afterDestroy':_0x51af('0x5')};function emitEvent(_0x3fa933){return function(_0x3e09ac,_0x1ef226,_0x115556){PluginEvents[_0x51af('0x6')](_0x3fa933+':'+_0x3e09ac['id'],_0x3e09ac);PluginEvents[_0x51af('0x6')](_0x3fa933,_0x3e09ac);_0x115556(null);};}for(var e in events){if(events[_0x51af('0x7')](e)){var event=events[e];Plugin[_0x51af('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 25b1722..a5328a8 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 _0x8e48=['moment','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','lodash','util','../../config/logger','api'];(function(_0x4623b1,_0x33d46c){var _0x4152fd=function(_0x294684){while(--_0x294684){_0x4623b1['push'](_0x4623b1['shift']());}};_0x4152fd(++_0x33d46c);}(_0x8e48,0xc2));var _0x88e4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8e48[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x88e4('0x0'));var util=require(_0x88e4('0x1'));var logger=require(_0x88e4('0x2'))(_0x88e4('0x3'));var moment=require(_0x88e4('0x4'));var BPromise=require('bluebird');var rp=require(_0x88e4('0x5'));var fs=require('fs');var path=require(_0x88e4('0x6'));var rimraf=require(_0x88e4('0x7'));var config=require(_0x88e4('0x8'));var attributes=require(_0x88e4('0x9'));module[_0x88e4('0xa')]=function(_0x57dab9,_0x44da7c){return _0x57dab9['define']('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x070b=['bluebird','request-promise','path','rimraf','exports','Plugin','plugins','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x070b,0x103));var _0xb070=function(_0x2c4615,_0x55b2e8){_0x2c4615=_0x2c4615-0x0;var _0x5a73f1=_0x070b[_0x2c4615];return _0x5a73f1;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb070('0x0'));var moment=require(_0xb070('0x1'));var BPromise=require(_0xb070('0x2'));var rp=require(_0xb070('0x3'));var fs=require('fs');var path=require(_0xb070('0x4'));var rimraf=require(_0xb070('0x5'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0xb070('0x6')]=function(_0x4c8554,_0x46d553){return _0x4c8554['define'](_0xb070('0x7'),attributes,{'tableName':_0xb070('0x8'),'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 c5b75a5..e04321d 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 _0xd2fc=['then','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','CreatePlugin','Plugin','create','body','options','info','stringify','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2fc,0xf8));var _0xcd2f=function(_0x4a0fdc,_0xe1310c){_0x4a0fdc=_0x4a0fdc-0x0;var _0x591329=_0xd2fc[_0x4a0fdc];return _0x591329;};'use strict';var _=require('lodash');var util=require(_0xcd2f('0x0'));var moment=require('moment');var BPromise=require(_0xcd2f('0x1'));var rs=require(_0xcd2f('0x2'));var fs=require('fs');var Redis=require(_0xcd2f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcd2f('0x4'))('rpc');var config=require(_0xcd2f('0x5'));var jayson=require(_0xcd2f('0x6'));var client=jayson[_0xcd2f('0x7')]['http']({'port':0x232a});config[_0xcd2f('0x8')]=_[_0xcd2f('0x9')](config['redis'],{'host':_0xcd2f('0xa'),'port':0x18eb});var socket=require(_0xcd2f('0xb'))(new Redis(config[_0xcd2f('0x8')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x59fb7f,_0x154225,_0x52aea2){return new BPromise(function(_0x1209be,_0x12375b){return client[_0xcd2f('0xc')](_0x59fb7f,_0x52aea2)[_0xcd2f('0xd')](function(_0x560f2c){logger['info'](_0xcd2f('0xe'),_0x154225,'request\x20sent');logger[_0xcd2f('0xf')](_0xcd2f('0x10'),_0x154225,'request\x20sent',JSON['stringify'](_0x560f2c));if(_0x560f2c['error']){if(_0x560f2c[_0xcd2f('0x11')]['code']===0x1f4){logger['error'](_0xcd2f('0xe'),_0x154225,_0x560f2c['error'][_0xcd2f('0x12')]);return _0x12375b(_0x560f2c[_0xcd2f('0x11')][_0xcd2f('0x12')]);}logger[_0xcd2f('0x11')](_0xcd2f('0xe'),_0x154225,_0x560f2c['error']['message']);return _0x1209be(_0x560f2c[_0xcd2f('0x11')]['message']);}else{logger['info'](_0xcd2f('0xe'),_0x154225,_0xcd2f('0x13'));_0x1209be(_0x560f2c[_0xcd2f('0x14')][_0xcd2f('0x12')]);}})[_0xcd2f('0x15')](function(_0x5450c4){logger[_0xcd2f('0x11')]('Plugin,\x20%s,\x20%s',_0x154225,_0x5450c4);_0x12375b(_0x5450c4);});});}exports[_0xcd2f('0x16')]=function(_0x4a948f){var _0x3888ac=this;return new Promise(function(_0x122af5,_0x487723){return db[_0xcd2f('0x17')][_0xcd2f('0x18')](_0x4a948f[_0xcd2f('0x19')],{'raw':_0x4a948f[_0xcd2f('0x1a')]?_0x4a948f[_0xcd2f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xcd2f('0xd')](function(_0x145297){logger[_0xcd2f('0x1b')]('CreatePlugin',_0x4a948f);logger[_0xcd2f('0xf')](_0xcd2f('0x16'),_0x4a948f,JSON[_0xcd2f('0x1c')](_0x145297));_0x122af5(_0x145297);})[_0xcd2f('0x15')](function(_0xfc15b9){logger[_0xcd2f('0x11')]('CreatePlugin',_0xfc15b9[_0xcd2f('0x12')],_0x4a948f);_0x487723(_0x3888ac[_0xcd2f('0x11')](0x1f4,_0xfc15b9[_0xcd2f('0x12')]));});});}; \ No newline at end of file +var _0x8683=['message','catch','CreatePlugin','Plugin','create','body','options','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x283b00,_0x12da02){var _0x2ccedf=function(_0x22dc96){while(--_0x22dc96){_0x283b00['push'](_0x283b00['shift']());}};_0x2ccedf(++_0x12da02);}(_0x8683,0x1a7));var _0x3868=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x8683[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x3868('0x0'));var util=require(_0x3868('0x1'));var moment=require(_0x3868('0x2'));var BPromise=require('bluebird');var rs=require(_0x3868('0x3'));var fs=require('fs');var Redis=require(_0x3868('0x4'));var db=require(_0x3868('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3868('0x6'))(_0x3868('0x7'));var config=require(_0x3868('0x8'));var jayson=require(_0x3868('0x9'));var client=jayson['client'][_0x3868('0xa')]({'port':0x232a});config[_0x3868('0xb')]=_[_0x3868('0xc')](config['redis'],{'host':_0x3868('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3868('0xb')]));require(_0x3868('0xe'))[_0x3868('0xf')](socket);function respondWithRpcPromise(_0xfac23,_0x527115,_0x8e0ed7){return new BPromise(function(_0x6ecab0,_0x281d8d){return client[_0x3868('0x10')](_0xfac23,_0x8e0ed7)[_0x3868('0x11')](function(_0x26b0d6){logger[_0x3868('0x12')](_0x3868('0x13'),_0x527115,'request\x20sent');logger['debug'](_0x3868('0x14'),_0x527115,_0x3868('0x15'),JSON[_0x3868('0x16')](_0x26b0d6));if(_0x26b0d6['error']){if(_0x26b0d6[_0x3868('0x17')][_0x3868('0x18')]===0x1f4){logger[_0x3868('0x17')](_0x3868('0x13'),_0x527115,_0x26b0d6['error'][_0x3868('0x19')]);return _0x281d8d(_0x26b0d6['error'][_0x3868('0x19')]);}logger['error'](_0x3868('0x13'),_0x527115,_0x26b0d6['error']['message']);return _0x6ecab0(_0x26b0d6[_0x3868('0x17')]['message']);}else{logger[_0x3868('0x12')](_0x3868('0x13'),_0x527115,_0x3868('0x15'));_0x6ecab0(_0x26b0d6['result']['message']);}})[_0x3868('0x1a')](function(_0x58f458){logger[_0x3868('0x17')](_0x3868('0x13'),_0x527115,_0x58f458);_0x281d8d(_0x58f458);});});}exports[_0x3868('0x1b')]=function(_0x6500a5){var _0x2b21f4=this;return new Promise(function(_0x587b9f,_0x3f4cd7){return db[_0x3868('0x1c')][_0x3868('0x1d')](_0x6500a5[_0x3868('0x1e')],{'raw':_0x6500a5[_0x3868('0x1f')]?_0x6500a5[_0x3868('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x3868('0x11')](function(_0x1e4213){logger[_0x3868('0x12')](_0x3868('0x1b'),_0x6500a5);logger['debug'](_0x3868('0x1b'),_0x6500a5,JSON['stringify'](_0x1e4213));_0x587b9f(_0x1e4213);})[_0x3868('0x1a')](function(_0x1100de){logger[_0x3868('0x17')]('CreatePlugin',_0x1100de[_0x3868('0x19')],_0x6500a5);_0x3f4cd7(_0x2b21f4[_0x3868('0x17')](0x1f4,_0x1100de['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 320fb62..3246869 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 _0x06c4=['removeListener','register','plugin:','emit'];(function(_0x2a5b8d,_0x57b822){var _0x2da6d6=function(_0x530067){while(--_0x530067){_0x2a5b8d['push'](_0x2a5b8d['shift']());}};_0x2da6d6(++_0x57b822);}(_0x06c4,0x97));var _0x406c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06c4[_0x14add3];return _0x4a174f;};'use strict';var PluginEvents=require('./plugin.events');var events=['save','remove','update'];function createListener(_0x4b7815,_0x547f14){return function(_0x382bc7){_0x547f14[_0x406c('0x0')](_0x4b7815,_0x382bc7);};}function removeListener(_0x5c4ed5,_0x176fb3){return function(){PluginEvents[_0x406c('0x1')](_0x5c4ed5,_0x176fb3);};}exports[_0x406c('0x2')]=function(_0xcc34da){for(var _0x3c4c8b=0x0,_0x3a555e=events['length'];_0x3c4c8b<_0x3a555e;_0x3c4c8b++){var _0x3d6f06=events[_0x3c4c8b];var _0xada323=createListener(_0x406c('0x3')+_0x3d6f06,_0xcc34da);PluginEvents['on'](_0x3d6f06,_0xada323);}}; \ No newline at end of file +var _0x0485=['removeListener','register','plugin:','./plugin.events','save','remove','update','emit'];(function(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0x0485,0x7b));var _0x5048=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0x0485[_0x40df5f];return _0x1573f1;};'use strict';var PluginEvents=require(_0x5048('0x0'));var events=[_0x5048('0x1'),_0x5048('0x2'),_0x5048('0x3')];function createListener(_0x34b19c,_0x30eac2){return function(_0x43d7a5){_0x30eac2[_0x5048('0x4')](_0x34b19c,_0x43d7a5);};}function removeListener(_0x593661,_0x170b53){return function(){PluginEvents[_0x5048('0x5')](_0x593661,_0x170b53);};}exports[_0x5048('0x6')]=function(_0x4847e0){for(var _0x2a0a51=0x0,_0x354fbf=events['length'];_0x2a0a51<_0x354fbf;_0x2a0a51++){var _0x55820c=events[_0x2a0a51];var _0x225ad4=createListener(_0x5048('0x7')+_0x55820c,_0x4847e0);PluginEvents['on'](_0x55820c,_0x225ad4);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 36b65ae..eacf8a4 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(_0x328daf,_0x3b42ae){var _0xef3b17=function(_0x4996b3){while(--_0x4996b3){_0x328daf['push'](_0x328daf['shift']());}};_0xef3b17(++_0x3b42ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x525aeb,_0xedc6db){var _0x228693=function(_0x547161){while(--_0x547161){_0x525aeb['push'](_0x525aeb['shift']());}};_0x228693(++_0xedc6db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 611976c..7816e29 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 _0x7072=['update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','sendStatus','status','json','name','send','npm\x20install','info','error','list','then','reject','express','length','catch','show','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump'];(function(_0x1fe2cd,_0x4685f1){var _0x2f3b06=function(_0x22f09b){while(--_0x22f09b){_0x1fe2cd['push'](_0x1fe2cd['shift']());}};_0x2f3b06(++_0x4685f1);}(_0x7072,0x138));var _0x2707=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x7072[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require('lodash');var pm2=require(_0x2707('0x0'));var logger=require(_0x2707('0x1'))(_0x2707('0x2'));var path=require(_0x2707('0x3'));var exec=require(_0x2707('0x4'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0xfdfa7a,_0x5f3c1c){return function(_0xd36287){if(!_0xd36287){_0xfdfa7a[_0x2707('0x5')](0x194);;}return _0xd36287;};}function respondWithResult(_0x1e86f2,_0x194132){_0x194132=_0x194132||0xc8;return function(_0x2fd8ff){if(_0x2fd8ff){return _0x1e86f2[_0x2707('0x6')](_0x194132)[_0x2707('0x7')](_0x2fd8ff);}return null;};}function handleError(_0x745cfd,_0x4062b6){_0x4062b6=_0x4062b6||0x1f4;return function(_0x2820ef){logger['error'](_0x2820ef['stack']);if(_0x2820ef[_0x2707('0x8')]){delete _0x2820ef[_0x2707('0x8')];}_0x745cfd[_0x2707('0x6')](_0x4062b6)[_0x2707('0x9')](_0x2820ef);};}function execChildProcess(){return new BPromise(function(_0x30090e,_0x2e1a46){exec(_0x2707('0xa'),function(_0x19881c,_0x115535,_0x478717){logger[_0x2707('0xb')](_0x115535);logger[_0x2707('0xb')](_0x478717);if(_0x19881c){logger[_0x2707('0xc')](_0x19881c);return _0x2e1a46(_0x19881c);}return _0x30090e(_0x115535);});});}exports['index']=function(_0x44c1d7,_0x590152){return pm2[_0x2707('0xd')]()[_0x2707('0xe')](function(_0xfe975c){if(_0xfe975c){var _0x3a67f2=_[_0x2707('0xf')](_0xfe975c,function(_0x4e52a3){return _0x4e52a3[_0x2707('0x8')]===_0x2707('0x10')||_0x4e52a3[_0x2707('0x8')]==='motion2';});return{'rows':_0x3a67f2,'count':_0x3a67f2[_0x2707('0x11')]};}return null;})[_0x2707('0xe')](respondWithResult(_0x590152,null))[_0x2707('0x12')](handleError(_0x590152,null));};exports[_0x2707('0x13')]=function(_0x7ed037,_0x27a3ea){return pm2['describe'](_0x7ed037[_0x2707('0x14')]['id'])[_0x2707('0xe')](respondWithResult(_0x27a3ea,null))[_0x2707('0xe')](handleEntityNotFound(_0x27a3ea,null))['catch'](handleError(_0x27a3ea,null));};exports['create']=function(_0x58a4ee,_0x1da4a6){if(_0x58a4ee[_0x2707('0x15')][_0x2707('0x8')]&&_0x58a4ee[_0x2707('0x15')][_0x2707('0x16')]){var _0x3c2935=path[_0x2707('0x17')](__dirname,_0x2707('0x18'),_0x58a4ee[_0x2707('0x15')][_0x2707('0x16')]);var _0x37c475=process[_0x2707('0x19')]();process[_0x2707('0x1a')](path[_0x2707('0x1b')](_0x3c2935));return execChildProcess()['then'](function(_0x1acf22){process[_0x2707('0x1a')](_0x37c475);return pm2[_0x2707('0x1c')]({'name':_0x58a4ee[_0x2707('0x15')][_0x2707('0x8')],'script':_0x3c2935});})[_0x2707('0xe')](function(_0x4831ed){pm2[_0x2707('0x1d')]();return _0x4831ed[0x0];})[_0x2707('0xe')](respondWithResult(_0x1da4a6,0xc9))[_0x2707('0x12')](handleError(_0x1da4a6,null));}else{return _0x1da4a6[_0x2707('0x6')](0x1f4)[_0x2707('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x2707('0x1e')]=function(_0x4ca05d,_0x29dad2){if(_0x4ca05d[_0x2707('0x15')]['id']){delete _0x4ca05d[_0x2707('0x15')]['id'];}var _0x57da26={'online':_0x2707('0x1f'),'stopped':_0x2707('0x20')};if(_0x57da26[_0x2707('0x21')](_0x4ca05d['body'][_0x2707('0x6')])){return pm2[_0x57da26[_0x4ca05d[_0x2707('0x15')]['status']]](_0x4ca05d[_0x2707('0x14')]['id'])['then'](respondWithResult(_0x29dad2,0xc8))['catch'](handleError(_0x29dad2,null));}else{return _0x29dad2[_0x2707('0x6')](0x1f4)['send']({'message':_0x2707('0x22')});}};exports[_0x2707('0x23')]=function(_0x417a97,_0x36b2e9){if(_0x417a97['body']['id']){delete _0x417a97[_0x2707('0x15')]['id'];}if(_0x417a97[_0x2707('0x14')]['id']){return pm2[_0x2707('0x24')](_0x417a97[_0x2707('0x14')]['id'])[_0x2707('0xe')](function(_0x341e14){pm2[_0x2707('0x1d')]();return _0x341e14[0x0];})[_0x2707('0xe')](respondWithResult(_0x36b2e9,null))[_0x2707('0x12')](handleError(_0x36b2e9,null));}else{return _0x36b2e9['status'](0x1f4)[_0x2707('0x9')]({'message':_0x2707('0x25')});}}; \ No newline at end of file +var _0xbc9d=['hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','sendStatus','json','error','name','status','send','npm\x20install','info','list','then','reject','motion2','catch','show','describe','params','body','script','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','stop'];(function(_0xbffc96,_0x3a2d60){var _0x288a0e=function(_0x301e98){while(--_0x301e98){_0xbffc96['push'](_0xbffc96['shift']());}};_0x288a0e(++_0x3a2d60);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x151418,_0x2cbffa){_0x151418=_0x151418-0x0;var _0x40e29a=_0xbc9d[_0x151418];return _0x40e29a;};'use strict';var _=require(_0xdbc9('0x0'));var pm2=require(_0xdbc9('0x1'));var logger=require(_0xdbc9('0x2'))(_0xdbc9('0x3'));var path=require(_0xdbc9('0x4'));var exec=require('child_process')['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x2aba48,_0x404513){return function(_0x3e63f1){if(!_0x3e63f1){_0x2aba48[_0xdbc9('0x5')](0x194);;}return _0x3e63f1;};}function respondWithResult(_0x6ab397,_0x7c4c55){_0x7c4c55=_0x7c4c55||0xc8;return function(_0x381a0e){if(_0x381a0e){return _0x6ab397['status'](_0x7c4c55)[_0xdbc9('0x6')](_0x381a0e);}return null;};}function handleError(_0x181f8a,_0x3d4918){_0x3d4918=_0x3d4918||0x1f4;return function(_0x4d6493){logger[_0xdbc9('0x7')](_0x4d6493['stack']);if(_0x4d6493['name']){delete _0x4d6493[_0xdbc9('0x8')];}_0x181f8a[_0xdbc9('0x9')](_0x3d4918)[_0xdbc9('0xa')](_0x4d6493);};}function execChildProcess(){return new BPromise(function(_0x2f5e6d,_0x531f09){exec(_0xdbc9('0xb'),function(_0x187149,_0xcc898,_0xd026bc){logger[_0xdbc9('0xc')](_0xcc898);logger[_0xdbc9('0xc')](_0xd026bc);if(_0x187149){logger['error'](_0x187149);return _0x531f09(_0x187149);}return _0x2f5e6d(_0xcc898);});});}exports['index']=function(_0x3d0fdd,_0x15c0a6){return pm2[_0xdbc9('0xd')]()[_0xdbc9('0xe')](function(_0x53495d){if(_0x53495d){var _0x4a9dcb=_[_0xdbc9('0xf')](_0x53495d,function(_0x1e41cf){return _0x1e41cf[_0xdbc9('0x8')]==='express'||_0x1e41cf[_0xdbc9('0x8')]===_0xdbc9('0x10');});return{'rows':_0x4a9dcb,'count':_0x4a9dcb['length']};}return null;})[_0xdbc9('0xe')](respondWithResult(_0x15c0a6,null))[_0xdbc9('0x11')](handleError(_0x15c0a6,null));};exports[_0xdbc9('0x12')]=function(_0x14e655,_0x1f22f4){return pm2[_0xdbc9('0x13')](_0x14e655[_0xdbc9('0x14')]['id'])[_0xdbc9('0xe')](respondWithResult(_0x1f22f4,null))[_0xdbc9('0xe')](handleEntityNotFound(_0x1f22f4,null))[_0xdbc9('0x11')](handleError(_0x1f22f4,null));};exports['create']=function(_0x1ca5fd,_0x497be2){if(_0x1ca5fd[_0xdbc9('0x15')][_0xdbc9('0x8')]&&_0x1ca5fd['body'][_0xdbc9('0x16')]){var _0x5367dc=path['join'](__dirname,'../../files/plugins',_0x1ca5fd['body'][_0xdbc9('0x16')]);var _0x2011a2=process['cwd']();process[_0xdbc9('0x17')](path[_0xdbc9('0x18')](_0x5367dc));return execChildProcess()['then'](function(_0x1bc073){process[_0xdbc9('0x17')](_0x2011a2);return pm2[_0xdbc9('0x19')]({'name':_0x1ca5fd[_0xdbc9('0x15')][_0xdbc9('0x8')],'script':_0x5367dc});})[_0xdbc9('0xe')](function(_0x32822f){pm2[_0xdbc9('0x1a')]();return _0x32822f[0x0];})[_0xdbc9('0xe')](respondWithResult(_0x497be2,0xc9))['catch'](handleError(_0x497be2,null));}else{return _0x497be2[_0xdbc9('0x9')](0x1f4)[_0xdbc9('0xa')]({'message':_0xdbc9('0x1b')});}};exports[_0xdbc9('0x1c')]=function(_0x24fdec,_0x50c3ee){if(_0x24fdec[_0xdbc9('0x15')]['id']){delete _0x24fdec[_0xdbc9('0x15')]['id'];}var _0x5300bd={'online':'restart','stopped':_0xdbc9('0x1d')};if(_0x5300bd[_0xdbc9('0x1e')](_0x24fdec[_0xdbc9('0x15')]['status'])){return pm2[_0x5300bd[_0x24fdec[_0xdbc9('0x15')]['status']]](_0x24fdec['params']['id'])[_0xdbc9('0xe')](respondWithResult(_0x50c3ee,0xc8))['catch'](handleError(_0x50c3ee,null));}else{return _0x50c3ee['status'](0x1f4)[_0xdbc9('0xa')]({'message':_0xdbc9('0x1f')});}};exports[_0xdbc9('0x20')]=function(_0x4db824,_0x35eaf8){if(_0x4db824[_0xdbc9('0x15')]['id']){delete _0x4db824['body']['id'];}if(_0x4db824['params']['id']){return pm2[_0xdbc9('0x21')](_0x4db824[_0xdbc9('0x14')]['id'])[_0xdbc9('0xe')](function(_0x3ce701){pm2[_0xdbc9('0x1a')]();return _0x3ce701[0x0];})[_0xdbc9('0xe')](respondWithResult(_0x35eaf8,null))[_0xdbc9('0x11')](handleError(_0x35eaf8,null));}else{return _0x35eaf8['status'](0x1f4)[_0xdbc9('0xa')]({'message':_0xdbc9('0x22')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index e09d00e..209a653 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 _0x3f56=['Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3f56,0x160));var _0x63f5=function(_0x4d6bbe,_0x1c4f91){_0x4d6bbe=_0x4d6bbe-0x0;var _0x2e09a3=_0x3f56[_0x4d6bbe];return _0x2e09a3;};'use strict';var express=require('express');var router=express[_0x63f5('0x0')]();var auth=require(_0x63f5('0x1'));var controller=require(_0x63f5('0x2'));router[_0x63f5('0x3')](_0x63f5('0x4'),auth[_0x63f5('0x5')](),controller[_0x63f5('0x6')]);router[_0x63f5('0x3')](_0x63f5('0x7'),auth[_0x63f5('0x5')](),controller['getQueues']);module['exports']=router; \ No newline at end of file +var _0xa345=['./realtime.controller','get','/agents','getAgents','/queues','isAuthenticated','Router','../../components/auth/service'];(function(_0x48e348,_0x3e7b30){var _0x29016a=function(_0x1fcfc4){while(--_0x1fcfc4){_0x48e348['push'](_0x48e348['shift']());}};_0x29016a(++_0x3e7b30);}(_0xa345,0xee));var _0x5a34=function(_0x528ee4,_0x247935){_0x528ee4=_0x528ee4-0x0;var _0x1369ec=_0xa345[_0x528ee4];return _0x1369ec;};'use strict';var express=require('express');var router=express[_0x5a34('0x0')]();var auth=require(_0x5a34('0x1'));var controller=require(_0x5a34('0x2'));router[_0x5a34('0x3')](_0x5a34('0x4'),auth['isAuthenticated'](),controller[_0x5a34('0x5')]);router[_0x5a34('0x3')](_0x5a34('0x6'),auth[_0x5a34('0x7')](),controller['getQueues']);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 88ddb24..5dd303e 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 _0x734a=['merge','user','userProfileId','Agents','extraQueryConditions','assign','UserProfile','User','findAndCountAll','count','find','globalStatus','getAgentStatus','voice','voiceStatus','talking','pick','startCase','Queue','type','name','outbound','dialActive','dialMethod','filter','getResources','getRealtimeQueues','initializeQueues','catch','lodash','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','handleError','offset','limit','undefined','status','Content-Range','json','getAgents','getChannels','fullname','role','userpic','internal','online','voicePause','openchannelPause','chatPause','smsPause','whatsappPause','mailPause','pauseType','lastPauseAt','lastLoginAt','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','query','globalStatusFilter','pause','*pause','resolve','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','includes','sort','getUpdatedSortOptions','fields','join','order','then','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','rawAttributes','fieldName','key','agent','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','where'];(function(_0x45ece3,_0x13a1cc){var _0x3e5c1a=function(_0x561cde){while(--_0x561cde){_0x45ece3['push'](_0x45ece3['shift']());}};_0x3e5c1a(++_0x13a1cc);}(_0x734a,0x83));var _0xa734=function(_0x54128a,_0x128d4d){_0x54128a=_0x54128a-0x0;var _0x6b9354=_0x734a[_0x54128a];return _0x6b9354;};'use strict';var _=require(_0xa734('0x0'));var util=require('util');var rta=require(_0xa734('0x1'));var rtq=require(_0xa734('0x2'));var qs=require(_0xa734('0x3'));var utils=require(_0xa734('0x4'));var db=require(_0xa734('0x5'))['db'];var APIBadRequestError=require(_0xa734('0x6'))['APIBadRequestError'];var APIHandleError=require('../../errors/api')[_0xa734('0x7')];function respondWithFilteredResult(_0x56e48e,_0x120211){return function(_0x5977e5){if(_0x5977e5){var _0x338a48=typeof _0x120211[_0xa734('0x8')]==='undefined'&&typeof _0x120211[_0xa734('0x9')]===_0xa734('0xa');var _0x141fed=_0x5977e5['count'];var _0x15c82b=_0x338a48?0x0:_0x120211['offset'];var _0x263cdc=_0x338a48?_0x5977e5['count']:_0x120211[_0xa734('0x8')]+_0x120211['limit'];var _0x5bccd4;if(_0x263cdc>=_0x141fed){_0x263cdc=_0x141fed;_0x5bccd4=0xc8;}else{_0x5bccd4=0xce;}_0x56e48e[_0xa734('0xb')](_0x5bccd4);return _0x56e48e['set'](_0xa734('0xc'),_0x15c82b+'-'+_0x263cdc+'/'+_0x141fed)[_0xa734('0xd')](_0x5977e5);}return null;};}exports[_0xa734('0xe')]=function(_0x16a934,_0x3f613a){var _0x2461fe={'count':0x0,'rows':[]};var _0x43958d={};var _0xca5230;var _0x2b61db=utils[_0xa734('0xf')]();var _0x776a4d=['id','name',_0xa734('0x10'),_0xa734('0x11'),_0xa734('0x12'),_0xa734('0x13'),_0xa734('0x14'),_0xa734('0x15'),_0xa734('0x16'),'faxPause',_0xa734('0x17'),_0xa734('0x18'),_0xa734('0x19'),_0xa734('0x1a'),_0xa734('0x1b'),_0xa734('0x1c'),_0xa734('0x1d'),'lastPauseAt',_0xa734('0x1e'),'mailCapacity',_0xa734('0x1f'),'faxCapacity',_0xa734('0x20'),_0xa734('0x21'),_0xa734('0x22'),_0xa734('0x23'),_0xa734('0x24')];var _0x524e7d;var _0x172415;var _0x5686f7=_0x16a934['query']['globalQueueFilter'];var _0x9600fc=_0x16a934[_0xa734('0x25')][_0xa734('0x26')];var _0x4b2a07=_0x16a934[_0xa734('0x25')]['pauseTypeFilter'];var _0x43df1e=_0x9600fc===_0xa734('0x27')||_0x9600fc===_0xa734('0x28')?!![]:![];var _0x3c566c=[];var _0x1c0b64;var _0x40e7c2;Promise[_0xa734('0x29')]()['then'](function(){if(_0x16a934[_0xa734('0x25')][_0xa734('0x2a')]){if(!utils[_0xa734('0x2b')](_0x16a934[_0xa734('0x25')][_0xa734('0x2a')])){throw new APIBadRequestError(util[_0xa734('0x2c')](_0xa734('0x2d'),_0x16a934[_0xa734('0x25')][_0xa734('0x2a')]));}_0xca5230=_0x16a934['query'][_0xa734('0x2a')][_0xa734('0x2e')]();}if(!_0x16a934[_0xa734('0x25')]['sort']||!_0x16a934[_0xa734('0x25')]['sort'][_0xa734('0x2f')]('globalStatus')){_0x16a934[_0xa734('0x25')]['sort']=rta['validateSortParameter'](_0x16a934[_0xa734('0x25')][_0xa734('0x30')]);return;}var _0x499355=rta[_0xa734('0x31')](_0x16a934[_0xa734('0x25')]['sort']);_0x16a934['query'][_0xa734('0x30')]=_0x499355[_0xa734('0x32')][_0xa734('0x33')](',');_0x1c0b64=_0x499355[_0xa734('0x34')];})[_0xa734('0x35')](function(){if(!_0x5686f7){return[];}return rta[_0xa734('0x36')](_0x5686f7,_0xca5230);})[_0xa734('0x35')](function(_0xd808db){_0x3c566c=_0xd808db;return rta[_0xa734('0x37')]();})[_0xa734('0x35')](function(_0x439e51){_0x172415=_0x439e51[_0xa734('0x38')];if((!_0x9600fc||_0x43df1e)&&!_0x1c0b64){return _0x3c566c;}if(_0x1c0b64&&!_0x9600fc){return rta[_0xa734('0x39')](_0x172415,_0x3c566c,_0x1c0b64);}else{return rta[_0xa734('0x3a')](_0x172415,_0x3c566c,_0x9600fc);}})['then'](function(_0x63de61){_0x3c566c=_0x63de61;var _0x50b74a=![];if(_0x3c566c['length']===0x0){if(_0x5686f7||_0x9600fc){_0x50b74a=!![];}if(_0x43df1e){_0x50b74a=![];}}if(_0x50b74a){return _0x2461fe;}var _0x3ab502=_[_0xa734('0x3b')](db['User'][_0xa734('0x3c')],function(_0x51c02c){return{'name':_0x51c02c[_0xa734('0x3d')],'type':_0x51c02c['type'][_0xa734('0x3e')]};});_0x16a934[_0xa734('0x25')][_0xa734('0x11')]=_0xa734('0x3f');_0x43958d=qs[_0xa734('0x40')](_0x3ab502,_0x16a934);_0x43958d[_0xa734('0x41')]=!![];var _0x2cc082=[];if(_0x3c566c['length']>0x0){_0x2cc082[_0xa734('0x42')]({'id':{'$in':_0x3c566c}});if(_0x1c0b64&&!_0x9600fc){_0x40e7c2=[db[_0xa734('0x43')][_0xa734('0x44')](_0xa734('0x45')+_0x3c566c+')')];_0x43958d['order']=_0x40e7c2;}}if(_0x43df1e){_0x2b61db[_0xa734('0x46')](function(_0x17b89a){var _0x58c18c=!![];if(_0x9600fc==='*pause'&&_0xca5230!==_0x17b89a){_0x58c18c=![];}_0x2cc082[_0xa734('0x42')]({[_0x17b89a+_0xa734('0x47')]:_0x58c18c});});if(_0x4b2a07){_0x2cc082[_0xa734('0x42')]({'pauseType':_0x4b2a07});}}else if(_0x9600fc){_0x2b61db[_0xa734('0x46')](function(_0x214eaa){_0x2cc082[_0xa734('0x42')]({[_0x214eaa+_0xa734('0x47')]:![]});});}_0x43958d[_0xa734('0x48')]=_[_0xa734('0x49')](_0x43958d['where'],{'$and':_0x2cc082});if(_0x16a934[_0xa734('0x4a')]['role']==='user'){var _0x1f1017={'params':{'id':_0x16a934['user'][_0xa734('0x4b')]},'query':{'section':_0xa734('0x4c'),'role':_0xa734('0x3f'),'raw':!![],'ids':_0x3c566c,'customSorting':_0x40e7c2}};if(_0x16a934[_0xa734('0x25')][_0xa734('0x14')]){_0x1f1017[_0xa734('0x25')][_0xa734('0x14')]=!![];}if(_0x43df1e){_0x1f1017[_0xa734('0x25')][_0xa734('0x4d')]=_0x2cc082;}_0x1f1017['query']=Object[_0xa734('0x4e')](_0x1f1017['query'],_0x16a934[_0xa734('0x25')]);return db[_0xa734('0x4f')]['getResources'](_0x1f1017);}return db[_0xa734('0x50')][_0xa734('0x51')](_0x43958d);})['then'](function(_0x17f8c6){_0x2461fe[_0xa734('0x52')]=_0x17f8c6[_0xa734('0x52')];_0x524e7d=_0x17f8c6[_0xa734('0x38')];return _0x524e7d[_0xa734('0x3b')](function(_0xe69d03){var _0x393019=_[_0xa734('0x53')](_0x172415,['id',_0xe69d03['id']]);if(_0x393019){var _0x4c8805=rta['filterAgentAttributes'](_0x393019);_['merge'](_0xe69d03,_0x4c8805);}_0xe69d03[_0xa734('0x54')]=rta[_0xa734('0x55')](_0xe69d03);if(_0xe69d03[_0xa734('0x54')][_0xa734('0x2f')](_0xa734('0x27'))){_0x2b61db[_0xa734('0x46')](function(_0xdd01a9){if(_0xe69d03[_0xdd01a9+'Pause']){if(_0xdd01a9===_0xa734('0x56')){if(_0xe69d03[_0xa734('0x57')]!==_0xa734('0x58')){_0xe69d03[_0xa734('0x57')]=_0xa734('0x27');}}else{_0xe69d03[_0xdd01a9+'Status']=_0xa734('0x27');}}});}return _0xe69d03;});})[_0xa734('0x35')](function(_0x2c4f56){if(!_0x1c0b64||_0x40e7c2){return _0x2c4f56;}return rta['sortAgentsByStatus'](_0x2c4f56,_0x1c0b64);})['then'](function(_0x3dffc8){_0x2461fe[_0xa734('0x38')]=_0x3dffc8[_0xa734('0x3b')](function(_0x27bf3e){return _[_0xa734('0x59')](_0x27bf3e,_0x776a4d);});return _0x2461fe;})[_0xa734('0x35')](respondWithFilteredResult(_0x3f613a,_0x43958d))['catch'](APIHandleError(_0x3f613a));};exports['getQueues']=function(_0x211e77,_0x5998de){var _0x58f339={'count':0x0,'rows':[]};var _0x2e185a={};var _0x1df880;var _0x50fdb5;var _0x38fbab;Promise[_0xa734('0x29')]()[_0xa734('0x35')](function(){if(_0x211e77[_0xa734('0x25')]['channel']){if(!utils[_0xa734('0x2b')](_0x211e77[_0xa734('0x25')][_0xa734('0x2a')])){throw new APIBadRequestError(util[_0xa734('0x2c')](_0xa734('0x2d'),_0x211e77[_0xa734('0x25')]['channel']));}_0x1df880=_0x211e77[_0xa734('0x25')][_0xa734('0x2a')][_0xa734('0x2e')]();}var _0x446fe2=_[_0xa734('0x5a')](_0x1df880)+_0xa734('0x5b');var _0x2f0f90=_[_0xa734('0x3b')](db[_0x446fe2]['rawAttributes'],function(_0x553ef6){return{'name':_0x553ef6['fieldName'],'type':_0x553ef6[_0xa734('0x5c')][_0xa734('0x3e')]};});if(!_0x211e77['query']['fields']){var _0x27392b=['id',_0xa734('0x5d')];if(_0x1df880===_0xa734('0x56')){_0x27392b[_0xa734('0x42')](_0xa734('0x5c'));if(_0x211e77[_0xa734('0x25')][_0xa734('0x5c')]===_0xa734('0x5e')){_0x27392b[_0xa734('0x42')]([_0xa734('0x5f'),_0xa734('0x60')]);}}_0x211e77[_0xa734('0x25')][_0xa734('0x32')]=_0x27392b[_0xa734('0x33')](',');}_0x2e185a=qs[_0xa734('0x40')](_0x2f0f90,_0x211e77);if(_0x211e77[_0xa734('0x4a')][_0xa734('0x11')]==='user'){var _0x5c0d27={'params':{'id':_0x211e77[_0xa734('0x4a')][_0xa734('0x4b')]},'query':{'section':_0x1df880==='voice'&&_0x211e77[_0xa734('0x25')]['type']===_0xa734('0x5e')?'QueueCampaigns':_[_0xa734('0x5a')](_0x1df880)+'Queues','type':_0x211e77[_0xa734('0x25')]['type'],'nolimit':!![],'sort':_0xa734('0x5d'),'filter':_0x211e77['query'][_0xa734('0x61')]}};_0x5c0d27['query']=Object[_0xa734('0x4e')](_0x5c0d27['query'],_0x211e77[_0xa734('0x25')]);delete _0x5c0d27[_0xa734('0x25')]['id'];return db[_0xa734('0x4f')][_0xa734('0x62')](_0x5c0d27);}return db[_0x446fe2][_0xa734('0x51')](_0x2e185a);})['then'](function(_0x572c05){_0x58f339[_0xa734('0x52')]=_0x572c05[_0xa734('0x52')];_0x50fdb5=_0x572c05['rows'];return rtq[_0xa734('0x63')](_0x211e77,_0x1df880);})[_0xa734('0x35')](function(_0x555f13){_0x38fbab=_0x555f13[_0xa734('0x38')];return rtq[_0xa734('0x64')](_0x50fdb5,_0x38fbab,_0x1df880,_0x211e77['query'][_0xa734('0x5c')]);})[_0xa734('0x35')](function(_0x4f84ca){_0x58f339[_0xa734('0x38')]=_0x4f84ca;return _0x58f339;})[_0xa734('0x35')](respondWithFilteredResult(_0x5998de,_0x2e185a))[_0xa734('0x65')](APIHandleError(_0x5998de));}; \ No newline at end of file +var _0x41bb=['chatStatus','chatPause','whatsappPause','mailPause','pauseType','lastPauseAt','chatCapacity','mailCapacity','openchannelCapacity','faxCapacity','smsCapacity','whatsappCapacity','phoneBarEnableAutomaticScreenRecording','onhold','queue','routealias','voiceStatusTime','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','*pause','resolve','then','isValidChannel','format','channel','sort','includes','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getAgentIdsByStatus','length','rawAttributes','type','key','agent','raw','push','sequelize','literal','FIELD(id,','forEach','where','merge','user','userProfileId','Agents','extraQueryConditions','UserProfile','getResources','User','findAndCountAll','find','filterAgentAttributes','getAgentStatus','voice','Status','pause','sortAgentsByStatus','map','pick','catch','getQueues','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','startCase','Queue','fieldName','name','outbound','dialActive','dialMethod','getOptions','QueueCampaigns','Queues','filter','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/queues','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','undefined','limit','count','offset','set','Content-Range','json','getAgents','getChannels','role','userpic','internal','online','globalStatus','voicePause','openchannelStatus','openchannelPause','faxStatus','faxPause'];(function(_0x55f2c0,_0x464ade){var _0x17d047=function(_0x44280e){while(--_0x44280e){_0x55f2c0['push'](_0x55f2c0['shift']());}};_0x17d047(++_0x464ade);}(_0x41bb,0xc5));var _0xb41b=function(_0x263dbf,_0x1c515f){_0x263dbf=_0x263dbf-0x0;var _0x3fab4e=_0x41bb[_0x263dbf];return _0x3fab4e;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0xb41b('0x2'));var qs=require('../../components/parsers/qs');var utils=require(_0xb41b('0x3'));var db=require(_0xb41b('0x4'))['db'];var APIBadRequestError=require(_0xb41b('0x5'))[_0xb41b('0x6')];var APIHandleError=require('../../errors/api')[_0xb41b('0x7')];function respondWithFilteredResult(_0x2c9f9e,_0x2dbaa3){return function(_0x50bc62){if(_0x50bc62){var _0x5455ce=typeof _0x2dbaa3['offset']===_0xb41b('0x8')&&typeof _0x2dbaa3[_0xb41b('0x9')]==='undefined';var _0x13d44e=_0x50bc62[_0xb41b('0xa')];var _0x11b8b2=_0x5455ce?0x0:_0x2dbaa3[_0xb41b('0xb')];var _0x26d531=_0x5455ce?_0x50bc62[_0xb41b('0xa')]:_0x2dbaa3[_0xb41b('0xb')]+_0x2dbaa3['limit'];var _0x1a9e2c;if(_0x26d531>=_0x13d44e){_0x26d531=_0x13d44e;_0x1a9e2c=0xc8;}else{_0x1a9e2c=0xce;}_0x2c9f9e['status'](_0x1a9e2c);return _0x2c9f9e[_0xb41b('0xc')](_0xb41b('0xd'),_0x11b8b2+'-'+_0x26d531+'/'+_0x13d44e)[_0xb41b('0xe')](_0x50bc62);}return null;};}exports[_0xb41b('0xf')]=function(_0x2066d5,_0x5f1ea4){var _0x353ba3={'count':0x0,'rows':[]};var _0x2d947a={};var _0x33d1b5;var _0x26d821=utils[_0xb41b('0x10')]();var _0x4e8603=['id','name','fullname',_0xb41b('0x11'),_0xb41b('0x12'),_0xb41b('0x13'),_0xb41b('0x14'),_0xb41b('0x15'),'voiceStatus',_0xb41b('0x16'),_0xb41b('0x17'),_0xb41b('0x18'),_0xb41b('0x19'),_0xb41b('0x1a'),_0xb41b('0x1b'),_0xb41b('0x1c'),'smsStatus','smsPause','whatsappStatus',_0xb41b('0x1d'),'mailStatus',_0xb41b('0x1e'),_0xb41b('0x1f'),_0xb41b('0x20'),'lastLoginAt','lastPauseAt',_0xb41b('0x21'),_0xb41b('0x22'),_0xb41b('0x23'),_0xb41b('0x24'),_0xb41b('0x25'),_0xb41b('0x26'),'screenrecording','phoneBarEnableScreenRecordingByAgent',_0xb41b('0x27'),_0xb41b('0x28'),_0xb41b('0x29'),'destconnectedlinenum',_0xb41b('0x2a'),_0xb41b('0x2b')];var _0x546101;var _0x2a5306;var _0x34f908=_0x2066d5['query'][_0xb41b('0x2c')];var _0x4a7992=_0x2066d5[_0xb41b('0x2d')][_0xb41b('0x2e')];var _0x53e3a2=_0x2066d5[_0xb41b('0x2d')][_0xb41b('0x2f')];var _0x583099=_0x4a7992==='pause'||_0x4a7992===_0xb41b('0x30')?!![]:![];var _0x46aecf=[];var _0x6b98aa;var _0x36dda8;Promise[_0xb41b('0x31')]()[_0xb41b('0x32')](function(){if(_0x2066d5[_0xb41b('0x2d')]['channel']){if(!utils[_0xb41b('0x33')](_0x2066d5[_0xb41b('0x2d')]['channel'])){throw new APIBadRequestError(util[_0xb41b('0x34')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x2066d5[_0xb41b('0x2d')][_0xb41b('0x35')]));}_0x33d1b5=_0x2066d5['query'][_0xb41b('0x35')]['toLowerCase']();}if(!_0x2066d5[_0xb41b('0x2d')][_0xb41b('0x36')]||!_0x2066d5['query'][_0xb41b('0x36')][_0xb41b('0x37')](_0xb41b('0x15'))){_0x2066d5[_0xb41b('0x2d')][_0xb41b('0x36')]=rta[_0xb41b('0x38')](_0x2066d5[_0xb41b('0x2d')][_0xb41b('0x36')]);return;}var _0x29ad07=rta[_0xb41b('0x39')](_0x2066d5['query'][_0xb41b('0x36')]);_0x2066d5['query']['sort']=_0x29ad07[_0xb41b('0x3a')][_0xb41b('0x3b')](',');_0x6b98aa=_0x29ad07[_0xb41b('0x3c')];})[_0xb41b('0x32')](function(){if(!_0x34f908){return[];}return rta[_0xb41b('0x3d')](_0x34f908,_0x33d1b5);})[_0xb41b('0x32')](function(_0x1de31b){_0x46aecf=_0x1de31b;return rta[_0xb41b('0x3e')]();})[_0xb41b('0x32')](function(_0x1d3e90){_0x2a5306=_0x1d3e90[_0xb41b('0x3f')];if((!_0x4a7992||_0x583099)&&!_0x6b98aa){return _0x46aecf;}if(_0x6b98aa&&!_0x4a7992){return rta['getSortedAgentsIdsByStatus'](_0x2a5306,_0x46aecf,_0x6b98aa);}else{return rta[_0xb41b('0x40')](_0x2a5306,_0x46aecf,_0x4a7992);}})[_0xb41b('0x32')](function(_0x2f95b9){_0x46aecf=_0x2f95b9;var _0x23ac00=![];if(_0x46aecf[_0xb41b('0x41')]===0x0){if(_0x34f908||_0x4a7992){_0x23ac00=!![];}if(_0x583099){_0x23ac00=![];}}if(_0x23ac00){return _0x353ba3;}var _0x10b3f6=_['map'](db['User'][_0xb41b('0x42')],function(_0x375bb9){return{'name':_0x375bb9['fieldName'],'type':_0x375bb9[_0xb41b('0x43')][_0xb41b('0x44')]};});_0x2066d5[_0xb41b('0x2d')][_0xb41b('0x11')]=_0xb41b('0x45');_0x2d947a=qs['getOptions'](_0x10b3f6,_0x2066d5);_0x2d947a[_0xb41b('0x46')]=!![];var _0x5775d3=[];if(_0x46aecf[_0xb41b('0x41')]>0x0){_0x5775d3[_0xb41b('0x47')]({'id':{'$in':_0x46aecf}});if(_0x6b98aa&&!_0x4a7992){_0x36dda8=[db[_0xb41b('0x48')][_0xb41b('0x49')](_0xb41b('0x4a')+_0x46aecf+')')];_0x2d947a[_0xb41b('0x3c')]=_0x36dda8;}}if(_0x583099){_0x26d821[_0xb41b('0x4b')](function(_0x321f1b){var _0x2b0721=!![];if(_0x4a7992==='*pause'&&_0x33d1b5!==_0x321f1b){_0x2b0721=![];}_0x5775d3['push']({[_0x321f1b+'Pause']:_0x2b0721});});if(_0x53e3a2){_0x5775d3[_0xb41b('0x47')]({'pauseType':_0x53e3a2});}}else if(_0x4a7992){_0x26d821['forEach'](function(_0x56a415){_0x5775d3[_0xb41b('0x47')]({[_0x56a415+'Pause']:![]});});}_0x2d947a[_0xb41b('0x4c')]=_[_0xb41b('0x4d')](_0x2d947a[_0xb41b('0x4c')],{'$and':_0x5775d3});if(_0x2066d5[_0xb41b('0x4e')][_0xb41b('0x11')]===_0xb41b('0x4e')){var _0xddb59c={'params':{'id':_0x2066d5['user'][_0xb41b('0x4f')]},'query':{'section':_0xb41b('0x50'),'role':_0xb41b('0x45'),'raw':!![],'ids':_0x46aecf,'customSorting':_0x36dda8}};if(_0x2066d5[_0xb41b('0x2d')]['online']){_0xddb59c[_0xb41b('0x2d')]['online']=!![];}if(_0x583099){_0xddb59c[_0xb41b('0x2d')][_0xb41b('0x51')]=_0x5775d3;}_0xddb59c[_0xb41b('0x2d')]=Object['assign'](_0xddb59c['query'],_0x2066d5[_0xb41b('0x2d')]);return db[_0xb41b('0x52')][_0xb41b('0x53')](_0xddb59c);}return db[_0xb41b('0x54')][_0xb41b('0x55')](_0x2d947a);})[_0xb41b('0x32')](function(_0x4253bd){_0x353ba3['count']=_0x4253bd['count'];_0x546101=_0x4253bd[_0xb41b('0x3f')];return _0x546101['map'](function(_0x324f5a){var _0x5b64b4=_[_0xb41b('0x56')](_0x2a5306,['id',_0x324f5a['id']]);if(_0x5b64b4){var _0x4973a7=rta[_0xb41b('0x57')](_0x5b64b4);_['merge'](_0x324f5a,_0x4973a7);}_0x324f5a[_0xb41b('0x15')]=rta[_0xb41b('0x58')](_0x324f5a);if(_0x324f5a[_0xb41b('0x15')][_0xb41b('0x37')]('pause')){_0x26d821[_0xb41b('0x4b')](function(_0x347a4c){if(_0x324f5a[_0x347a4c+'Pause']){if(_0x347a4c===_0xb41b('0x59')){if(_0x324f5a['voiceStatus']!=='talking'){_0x324f5a['voiceStatus']='pause';}}else{_0x324f5a[_0x347a4c+_0xb41b('0x5a')]=_0xb41b('0x5b');}}});}return _0x324f5a;});})[_0xb41b('0x32')](function(_0x3128a7){if(!_0x6b98aa||_0x36dda8){return _0x3128a7;}return rta[_0xb41b('0x5c')](_0x3128a7,_0x6b98aa);})[_0xb41b('0x32')](function(_0x34d076){_0x353ba3[_0xb41b('0x3f')]=_0x34d076[_0xb41b('0x5d')](function(_0x226031){return _[_0xb41b('0x5e')](_0x226031,_0x4e8603);});return _0x353ba3;})[_0xb41b('0x32')](respondWithFilteredResult(_0x5f1ea4,_0x2d947a))[_0xb41b('0x5f')](APIHandleError(_0x5f1ea4));};exports[_0xb41b('0x60')]=function(_0x1b1f81,_0x19893d){var _0x587270={'count':0x0,'rows':[]};var _0x2398f8={};var _0x5e041d;var _0x4a7aa3;var _0x326145;Promise[_0xb41b('0x31')]()[_0xb41b('0x32')](function(){if(_0x1b1f81[_0xb41b('0x2d')][_0xb41b('0x35')]){if(!utils[_0xb41b('0x33')](_0x1b1f81[_0xb41b('0x2d')][_0xb41b('0x35')])){throw new APIBadRequestError(util[_0xb41b('0x34')](_0xb41b('0x61'),_0x1b1f81[_0xb41b('0x2d')][_0xb41b('0x35')]));}_0x5e041d=_0x1b1f81[_0xb41b('0x2d')][_0xb41b('0x35')][_0xb41b('0x62')]();}var _0x29bd4a=_[_0xb41b('0x63')](_0x5e041d)+_0xb41b('0x64');var _0x3973e7=_[_0xb41b('0x5d')](db[_0x29bd4a][_0xb41b('0x42')],function(_0x571a8c){return{'name':_0x571a8c[_0xb41b('0x65')],'type':_0x571a8c['type'][_0xb41b('0x44')]};});if(!_0x1b1f81[_0xb41b('0x2d')][_0xb41b('0x3a')]){var _0x29df34=['id',_0xb41b('0x66')];if(_0x5e041d===_0xb41b('0x59')){_0x29df34[_0xb41b('0x47')]('type');if(_0x1b1f81[_0xb41b('0x2d')][_0xb41b('0x43')]===_0xb41b('0x67')){_0x29df34['push']([_0xb41b('0x68'),_0xb41b('0x69')]);}}_0x1b1f81[_0xb41b('0x2d')][_0xb41b('0x3a')]=_0x29df34[_0xb41b('0x3b')](',');}_0x2398f8=qs[_0xb41b('0x6a')](_0x3973e7,_0x1b1f81);if(_0x1b1f81[_0xb41b('0x4e')]['role']==='user'){var _0xaeb50e={'params':{'id':_0x1b1f81[_0xb41b('0x4e')]['userProfileId']},'query':{'section':_0x5e041d===_0xb41b('0x59')&&_0x1b1f81[_0xb41b('0x2d')]['type']===_0xb41b('0x67')?_0xb41b('0x6b'):_[_0xb41b('0x63')](_0x5e041d)+_0xb41b('0x6c'),'type':_0x1b1f81[_0xb41b('0x2d')][_0xb41b('0x43')],'nolimit':!![],'sort':_0xb41b('0x66'),'filter':_0x1b1f81[_0xb41b('0x2d')][_0xb41b('0x6d')]}};_0xaeb50e[_0xb41b('0x2d')]=Object['assign'](_0xaeb50e[_0xb41b('0x2d')],_0x1b1f81[_0xb41b('0x2d')]);delete _0xaeb50e['query']['id'];return db['UserProfile'][_0xb41b('0x53')](_0xaeb50e);}return db[_0x29bd4a][_0xb41b('0x55')](_0x2398f8);})[_0xb41b('0x32')](function(_0x4f6b2b){_0x587270[_0xb41b('0xa')]=_0x4f6b2b[_0xb41b('0xa')];_0x4a7aa3=_0x4f6b2b[_0xb41b('0x3f')];return rtq[_0xb41b('0x6e')](_0x1b1f81,_0x5e041d);})[_0xb41b('0x32')](function(_0x1553f5){_0x326145=_0x1553f5[_0xb41b('0x3f')];return rtq[_0xb41b('0x6f')](_0x4a7aa3,_0x326145,_0x5e041d,_0x1b1f81[_0xb41b('0x2d')][_0xb41b('0x43')]);})['then'](function(_0x44a12e){_0x587270[_0xb41b('0x3f')]=_0x44a12e;return _0x587270;})['then'](respondWithFilteredResult(_0x19893d,_0x2398f8))[_0xb41b('0x5f')](APIHandleError(_0x19893d));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index dd55c13..78128e8 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x19ecb5,_0x8fc0b9){var _0x4f2ae3=function(_0x2d358a){while(--_0x2d358a){_0x19ecb5['push'](_0x19ecb5['shift']());}};_0x4f2ae3(++_0x8fc0b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x10ff4c,_0x35c7e2){var _0x28bac8=function(_0x5129ba){while(--_0x5129ba){_0x10ff4c['push'](_0x10ff4c['shift']());}};_0x28bac8(++_0x35c7e2);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index c523410..1aaa8c4 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 _0x2f2e=['DATE','STRING','exports','INTEGER'];(function(_0x7a112,_0x2eb4a0){var _0x136dc5=function(_0x437650){while(--_0x437650){_0x7a112['push'](_0x7a112['shift']());}};_0x136dc5(++_0x2eb4a0);}(_0x2f2e,0x146));var _0xe2f2=function(_0x2fc6cf,_0x2bb133){_0x2fc6cf=_0x2fc6cf-0x0;var _0xf2ade3=_0x2f2e[_0x2fc6cf];return _0xf2ade3;};'use strict';var Sequelize=require('sequelize');module[_0xe2f2('0x0')]={'state':{'type':Sequelize[_0xe2f2('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xe2f2('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe2f2('0x2')]},'responsetime':{'type':Sequelize[_0xe2f2('0x2')]},'ringtime':{'type':Sequelize[_0xe2f2('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xe2f2('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x038b=['exports','INTEGER','STRING','DATE'];(function(_0x2d344f,_0x25fa84){var _0x2e796b=function(_0x10466a){while(--_0x10466a){_0x2d344f['push'](_0x2d344f['shift']());}};_0x2e796b(++_0x25fa84);}(_0x038b,0x114));var _0xb038=function(_0x44d1bc,_0x3145ed){_0x44d1bc=_0x44d1bc-0x0;var _0x48df69=_0x038b[_0x44d1bc];return _0x48df69;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'state':{'type':Sequelize[_0xb038('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xb038('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xb038('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xb038('0x3')]},'ringtime':{'type':Sequelize[_0xb038('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xb038('0x2')]},'membername':{'type':Sequelize[_0xb038('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 9cef12d..a842daa 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 _0x52d4=['report_agent_preview','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview'];(function(_0x33d397,_0x5350bd){var _0x37b73b=function(_0x1059cb){while(--_0x1059cb){_0x33d397['push'](_0x33d397['shift']());}};_0x37b73b(++_0x5350bd);}(_0x52d4,0x11f));var _0x452d=function(_0x109412,_0x2b5eb0){_0x109412=_0x109412-0x0;var _0x28ee3f=_0x52d4[_0x109412];return _0x28ee3f;};'use strict';var _=require('lodash');var util=require(_0x452d('0x0'));var logger=require(_0x452d('0x1'))(_0x452d('0x2'));var moment=require(_0x452d('0x3'));var BPromise=require(_0x452d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x452d('0x5'));var rimraf=require(_0x452d('0x6'));var config=require(_0x452d('0x7'));var attributes=require(_0x452d('0x8'));module[_0x452d('0x9')]=function(_0x5bc9fe,_0x55be3c){return _0x5bc9fe[_0x452d('0xa')](_0x452d('0xb'),attributes,{'tableName':_0x452d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48a8=['lodash','moment','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview'];(function(_0x97def9,_0x320c56){var _0x53c5ad=function(_0x24cb55){while(--_0x24cb55){_0x97def9['push'](_0x97def9['shift']());}};_0x53c5ad(++_0x320c56);}(_0x48a8,0x171));var _0x848a=function(_0x534ffd,_0x51e83d){_0x534ffd=_0x534ffd-0x0;var _0x51d6aa=_0x48a8[_0x534ffd];return _0x51d6aa;};'use strict';var _=require(_0x848a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x848a('0x1'));var BPromise=require(_0x848a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x848a('0x3'));var rimraf=require(_0x848a('0x4'));var config=require(_0x848a('0x5'));var attributes=require(_0x848a('0x6'));module[_0x848a('0x7')]=function(_0x2ba9eb,_0x437859){return _0x2ba9eb['define'](_0x848a('0x8'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 77187ad..913b4a9 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 _0x3054=['request','then','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ReportAgentPreview,\x20%s,\x20%s','info','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x34ab65,_0x2077fb){var _0x18536d=function(_0x528178){while(--_0x528178){_0x34ab65['push'](_0x34ab65['shift']());}};_0x18536d(++_0x2077fb);}(_0x3054,0x9d));var _0x4305=function(_0x4212a7,_0x1f9c62){_0x4212a7=_0x4212a7-0x0;var _0x3a7573=_0x3054[_0x4212a7];return _0x3a7573;};'use strict';var _=require(_0x4305('0x0'));var util=require('util');var moment=require(_0x4305('0x1'));var BPromise=require(_0x4305('0x2'));var rs=require(_0x4305('0x3'));var fs=require('fs');var Redis=require(_0x4305('0x4'));var db=require(_0x4305('0x5'))['db'];var utils=require(_0x4305('0x6'));var logger=require(_0x4305('0x7'))(_0x4305('0x8'));var config=require(_0x4305('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4305('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xeb2647,_0x1b9e04,_0xbc747d){return new BPromise(function(_0x521815,_0x564308){return client[_0x4305('0xb')](_0xeb2647,_0xbc747d)[_0x4305('0xc')](function(_0x1d9679){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x1b9e04,_0x4305('0xd'));logger[_0x4305('0xe')](_0x4305('0xf'),_0x1b9e04,'request\x20sent',JSON[_0x4305('0x10')](_0x1d9679));if(_0x1d9679[_0x4305('0x11')]){if(_0x1d9679[_0x4305('0x11')][_0x4305('0x12')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x1b9e04,_0x1d9679[_0x4305('0x11')]['message']);return _0x564308(_0x1d9679[_0x4305('0x11')][_0x4305('0x13')]);}logger[_0x4305('0x11')](_0x4305('0x14'),_0x1b9e04,_0x1d9679[_0x4305('0x11')]['message']);return _0x521815(_0x1d9679['error'][_0x4305('0x13')]);}else{logger[_0x4305('0x15')](_0x4305('0x14'),_0x1b9e04,_0x4305('0xd'));_0x521815(_0x1d9679['result'][_0x4305('0x13')]);}})[_0x4305('0x16')](function(_0x140257){logger[_0x4305('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x1b9e04,_0x140257);_0x564308(_0x140257);});});}exports[_0x4305('0x17')]=function(_0x41d1b8){var _0x27099d=this;return new Promise(function(_0x201d40,_0x25a3de){return db[_0x4305('0x18')]['create'](_0x41d1b8[_0x4305('0x19')],{'raw':_0x41d1b8['options']?_0x41d1b8[_0x4305('0x1a')][_0x4305('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x176f50){logger[_0x4305('0x15')](_0x4305('0x17'),_0x41d1b8);logger['debug']('CreateReportAgentPreview',_0x41d1b8,JSON[_0x4305('0x10')](_0x176f50));_0x201d40(_0x176f50);})[_0x4305('0x16')](function(_0x1f7d8f){logger[_0x4305('0x11')](_0x4305('0x17'),_0x1f7d8f[_0x4305('0x13')],_0x41d1b8);_0x25a3de(_0x27099d[_0x4305('0x11')](0x1f4,_0x1f7d8f[_0x4305('0x13')]));});});}; \ No newline at end of file +var _0x20fc=['ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ReportAgentPreview','create','body','options','raw','then','CreateReportAgentPreview','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x20fc,0xf1));var _0xc20f=function(_0x5a99db,_0x1cece5){_0x5a99db=_0x5a99db-0x0;var _0x3aad62=_0x20fc[_0x5a99db];return _0x3aad62;};'use strict';var _=require('lodash');var util=require(_0xc20f('0x0'));var moment=require(_0xc20f('0x1'));var BPromise=require(_0xc20f('0x2'));var rs=require(_0xc20f('0x3'));var fs=require('fs');var Redis=require(_0xc20f('0x4'));var db=require(_0xc20f('0x5'))['db'];var utils=require(_0xc20f('0x6'));var logger=require(_0xc20f('0x7'))(_0xc20f('0x8'));var config=require(_0xc20f('0x9'));var jayson=require(_0xc20f('0xa'));var client=jayson[_0xc20f('0xb')][_0xc20f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x24fe53,_0x2a1cbf,_0x3784fc){return new BPromise(function(_0x279553,_0x54d976){return client[_0xc20f('0xd')](_0x24fe53,_0x3784fc)['then'](function(_0x2b44c4){logger[_0xc20f('0xe')](_0xc20f('0xf'),_0x2a1cbf,_0xc20f('0x10'));logger[_0xc20f('0x11')](_0xc20f('0x12'),_0x2a1cbf,_0xc20f('0x10'),JSON[_0xc20f('0x13')](_0x2b44c4));if(_0x2b44c4[_0xc20f('0x14')]){if(_0x2b44c4['error'][_0xc20f('0x15')]===0x1f4){logger['error'](_0xc20f('0xf'),_0x2a1cbf,_0x2b44c4[_0xc20f('0x14')][_0xc20f('0x16')]);return _0x54d976(_0x2b44c4[_0xc20f('0x14')][_0xc20f('0x16')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x2a1cbf,_0x2b44c4['error']['message']);return _0x279553(_0x2b44c4[_0xc20f('0x14')][_0xc20f('0x16')]);}else{logger[_0xc20f('0xe')](_0xc20f('0xf'),_0x2a1cbf,_0xc20f('0x10'));_0x279553(_0x2b44c4[_0xc20f('0x17')]['message']);}})['catch'](function(_0x4ae4dd){logger['error'](_0xc20f('0xf'),_0x2a1cbf,_0x4ae4dd);_0x54d976(_0x4ae4dd);});});}exports['CreateReportAgentPreview']=function(_0xaac238){var _0x4b6579=this;return new Promise(function(_0x4c9241,_0x483fb1){return db[_0xc20f('0x18')][_0xc20f('0x19')](_0xaac238[_0xc20f('0x1a')],{'raw':_0xaac238[_0xc20f('0x1b')]?_0xaac238[_0xc20f('0x1b')][_0xc20f('0x1c')]===undefined?!![]:![]:!![]})[_0xc20f('0x1d')](function(_0x4c8cb0){logger[_0xc20f('0xe')](_0xc20f('0x1e'),_0xaac238);logger['debug'](_0xc20f('0x1e'),_0xaac238,JSON[_0xc20f('0x13')](_0x4c8cb0));_0x4c9241(_0x4c8cb0);})[_0xc20f('0x1f')](function(_0x4cf54e){logger[_0xc20f('0x14')](_0xc20f('0x1e'),_0x4cf54e[_0xc20f('0x16')],_0xaac238);_0x483fb1(_0x4b6579[_0xc20f('0x14')](0x1f4,_0x4cf54e['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 65941bf..6028e27 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 _0x79c4=['/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','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','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','faxQueues','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','put','/outbound','outbound','agents','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions'];(function(_0x39e41f,_0x575626){var _0x2d1164=function(_0x500dbe){while(--_0x500dbe){_0x39e41f['push'](_0x39e41f['shift']());}};_0x2d1164(++_0x575626);}(_0x79c4,0x1ad));var _0x479c=function(_0x6c5832,_0x2a9730){_0x6c5832=_0x6c5832-0x0;var _0x11993c=_0x79c4[_0x6c5832];return _0x11993c;};'use strict';var multer=require(_0x479c('0x0'));var util=require(_0x479c('0x1'));var path=require(_0x479c('0x2'));var express=require(_0x479c('0x3'));var router=express[_0x479c('0x4')]();var auth=require(_0x479c('0x5'));var controller=require(_0x479c('0x6'));router[_0x479c('0x7')]('/voice/channels',auth[_0x479c('0x8')](),controller[_0x479c('0x9')]);router['get'](_0x479c('0xa'),auth[_0x479c('0x8')](),controller[_0x479c('0xb')]);router['get'](_0x479c('0xc'),auth[_0x479c('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0x479c('0x7')](_0x479c('0xd'),auth[_0x479c('0x8')](),controller[_0x479c('0xe')]);router[_0x479c('0x7')](_0x479c('0xf'),auth[_0x479c('0x8')](),controller['chatQueues']);router[_0x479c('0x7')]('/mail/queues',auth[_0x479c('0x8')](),controller[_0x479c('0x10')]);router[_0x479c('0x7')](_0x479c('0x11'),auth[_0x479c('0x8')](),controller[_0x479c('0x12')]);router[_0x479c('0x7')]('/openchannel/queues',auth['isAuthenticated'](),controller[_0x479c('0x13')]);router['get'](_0x479c('0x14'),auth['isAuthenticated'](),controller[_0x479c('0x15')]);router['get']('/whatsapp/queues',auth[_0x479c('0x8')](),controller[_0x479c('0x16')]);router[_0x479c('0x7')]('/fax/queues',auth[_0x479c('0x8')](),controller[_0x479c('0x17')]);router['get']('/voice/queues/preview/:id',auth[_0x479c('0x8')](),controller['voiceQueuesPreview']);router['get'](_0x479c('0x18'),auth[_0x479c('0x8')](),controller[_0x479c('0x19')]);router[_0x479c('0x7')](_0x479c('0x1a'),auth[_0x479c('0x8')](),controller[_0x479c('0x1b')]);router[_0x479c('0x7')](_0x479c('0x1c'),auth[_0x479c('0x8')](),controller['voiceQueuesChannelHangup']);router['get'](_0x479c('0x1d'),auth[_0x479c('0x8')](),controller['voiceQueuesChannelRedirect']);router[_0x479c('0x7')](_0x479c('0x1e'),auth[_0x479c('0x8')](),controller['showVoiceQueues']);router[_0x479c('0x1f')](_0x479c('0x1e'),auth[_0x479c('0x8')](),controller['updateVoiceQueue']);router[_0x479c('0x7')](_0x479c('0x20'),auth[_0x479c('0x8')](),controller[_0x479c('0x21')]);router['get']('/outbound/channels',auth[_0x479c('0x8')](),controller['outboundChannels']);router[_0x479c('0x7')]('/agents',auth['isAuthenticated'](),controller[_0x479c('0x22')]);router['put']('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x479c('0x23')]);router[_0x479c('0x7')](_0x479c('0x24'),auth[_0x479c('0x8')](),controller[_0x479c('0x25')]);router[_0x479c('0x7')](_0x479c('0x26'),auth[_0x479c('0x8')](),controller[_0x479c('0x27')]);router['get'](_0x479c('0x28'),auth[_0x479c('0x8')](),controller['campaigns']);router[_0x479c('0x7')](_0x479c('0x29'),auth[_0x479c('0x8')](),controller[_0x479c('0x2a')]);router[_0x479c('0x7')](_0x479c('0x2b'),auth['isAuthenticated'](),controller[_0x479c('0x2c')]);router[_0x479c('0x7')](_0x479c('0x2d'),auth[_0x479c('0x8')](),controller[_0x479c('0x2e')]);router[_0x479c('0x7')](_0x479c('0x2f'),auth[_0x479c('0x8')](),controller[_0x479c('0x30')]);router['get'](_0x479c('0x31'),auth[_0x479c('0x8')](),controller[_0x479c('0x32')]);router['get'](_0x479c('0x33'),auth['isAuthenticated'](),controller[_0x479c('0x34')]);router[_0x479c('0x7')]('/whatsapp/queues/waitinginteractions',auth[_0x479c('0x8')](),controller[_0x479c('0x35')]);router[_0x479c('0x7')](_0x479c('0x36'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router['post'](_0x479c('0x37'),auth[_0x479c('0x8')](),controller[_0x479c('0x38')](_0x479c('0x39')));router[_0x479c('0x7')](_0x479c('0x3a'),auth[_0x479c('0x8')](),controller[_0x479c('0x3b')]);router[_0x479c('0x3c')](_0x479c('0x3d'),auth['isAuthenticated'](),controller[_0x479c('0x38')](_0x479c('0x3e')));router['get']('/chat/queues/:id',auth[_0x479c('0x8')](),controller[_0x479c('0x3f')]);router['post'](_0x479c('0x40'),auth[_0x479c('0x8')](),controller[_0x479c('0x38')](_0x479c('0x41')));router[_0x479c('0x7')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x479c('0x42')]);router['post'](_0x479c('0x43'),auth[_0x479c('0x8')](),controller[_0x479c('0x38')](_0x479c('0x44')));router[_0x479c('0x7')](_0x479c('0x45'),auth[_0x479c('0x8')](),controller[_0x479c('0x46')]);router['post'](_0x479c('0x47'),auth[_0x479c('0x8')](),controller['queueNotify'](_0x479c('0x48')));router[_0x479c('0x3c')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x479c('0x49')));router[_0x479c('0x7')](_0x479c('0x4a'),auth[_0x479c('0x8')](),controller[_0x479c('0x4b')]);router[_0x479c('0x7')](_0x479c('0x4c'),auth[_0x479c('0x8')](),controller[_0x479c('0x4d')]);router[_0x479c('0x3c')](_0x479c('0x4e'),auth['isAuthenticated'](),controller['agentNotify']);module[_0x479c('0x4f')]=router; \ No newline at end of file +var _0xd88a=['faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','path','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannelMixMonitor','get','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0xd88a,0x1d9));var _0xad88=function(_0x333755,_0x47aadf){_0x333755=_0x333755-0x0;var _0x1335ce=_0xd88a[_0x333755];return _0x1335ce;};'use strict';var multer=require('multer');var util=require(_0xad88('0x0'));var path=require(_0xad88('0x1'));var express=require('express');var router=express[_0xad88('0x2')]();var auth=require(_0xad88('0x3'));var controller=require(_0xad88('0x4'));router['get'](_0xad88('0x5'),auth[_0xad88('0x6')](),controller['voiceChannels']);router['get']('/voice/channels/:uniqueid/mixmonitor',auth[_0xad88('0x6')](),controller[_0xad88('0x7')]);router[_0xad88('0x8')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xad88('0x6')](),controller[_0xad88('0x9')]);router[_0xad88('0x8')](_0xad88('0xa'),auth['isAuthenticated'](),controller[_0xad88('0xb')]);router[_0xad88('0x8')](_0xad88('0xc'),auth[_0xad88('0x6')](),controller[_0xad88('0xd')]);router['get'](_0xad88('0xe'),auth['isAuthenticated'](),controller['mailQueues']);router[_0xad88('0x8')](_0xad88('0xf'),auth[_0xad88('0x6')](),controller[_0xad88('0x10')]);router[_0xad88('0x8')]('/openchannel/queues',auth[_0xad88('0x6')](),controller[_0xad88('0x11')]);router[_0xad88('0x8')](_0xad88('0x12'),auth[_0xad88('0x6')](),controller['smsQueues']);router['get']('/whatsapp/queues',auth[_0xad88('0x6')](),controller[_0xad88('0x13')]);router[_0xad88('0x8')](_0xad88('0x14'),auth['isAuthenticated'](),controller[_0xad88('0x15')]);router[_0xad88('0x8')](_0xad88('0x16'),auth[_0xad88('0x6')](),controller[_0xad88('0x17')]);router[_0xad88('0x8')](_0xad88('0x18'),auth[_0xad88('0x6')](),controller['voiceQueuesChannels']);router['get'](_0xad88('0x19'),auth[_0xad88('0x6')](),controller[_0xad88('0x1a')]);router[_0xad88('0x8')](_0xad88('0x1b'),auth[_0xad88('0x6')](),controller[_0xad88('0x1c')]);router[_0xad88('0x8')](_0xad88('0x1d'),auth[_0xad88('0x6')](),controller[_0xad88('0x1e')]);router[_0xad88('0x8')](_0xad88('0x1f'),auth[_0xad88('0x6')](),controller[_0xad88('0x20')]);router['put'](_0xad88('0x1f'),auth[_0xad88('0x6')](),controller[_0xad88('0x21')]);router['get'](_0xad88('0x22'),auth[_0xad88('0x6')](),controller[_0xad88('0x23')]);router[_0xad88('0x8')](_0xad88('0x24'),auth[_0xad88('0x6')](),controller[_0xad88('0x25')]);router[_0xad88('0x8')](_0xad88('0x26'),auth['isAuthenticated'](),controller[_0xad88('0x27')]);router[_0xad88('0x28')](_0xad88('0x29'),auth['isAuthenticated'](),controller[_0xad88('0x2a')]);router[_0xad88('0x8')](_0xad88('0x2b'),auth[_0xad88('0x6')](),controller['telephones']);router[_0xad88('0x8')](_0xad88('0x2c'),auth['isAuthenticated'](),controller[_0xad88('0x2d')]);router[_0xad88('0x8')](_0xad88('0x2e'),auth[_0xad88('0x6')](),controller[_0xad88('0x2f')]);router[_0xad88('0x8')](_0xad88('0x30'),auth['isAuthenticated'](),controller[_0xad88('0x31')]);router['get'](_0xad88('0x32'),auth[_0xad88('0x6')](),controller[_0xad88('0x33')]);router[_0xad88('0x8')](_0xad88('0x34'),auth[_0xad88('0x6')](),controller[_0xad88('0x35')]);router[_0xad88('0x8')](_0xad88('0x36'),auth[_0xad88('0x6')](),controller[_0xad88('0x37')]);router[_0xad88('0x8')](_0xad88('0x38'),auth[_0xad88('0x6')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xad88('0x8')](_0xad88('0x39'),auth['isAuthenticated'](),controller[_0xad88('0x3a')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0xad88('0x6')](),controller[_0xad88('0x3b')]);router[_0xad88('0x8')](_0xad88('0x3c'),auth[_0xad88('0x6')](),controller[_0xad88('0x3d')]);router[_0xad88('0x3e')](_0xad88('0x3f'),auth['isAuthenticated'](),controller[_0xad88('0x40')](_0xad88('0x41')));router['get'](_0xad88('0x42'),auth[_0xad88('0x6')](),controller[_0xad88('0x43')]);router[_0xad88('0x3e')](_0xad88('0x44'),auth[_0xad88('0x6')](),controller['queueNotify'](_0xad88('0x45')));router[_0xad88('0x8')]('/chat/queues/:id',auth[_0xad88('0x6')](),controller[_0xad88('0x46')]);router[_0xad88('0x3e')](_0xad88('0x47'),auth[_0xad88('0x6')](),controller[_0xad88('0x40')](_0xad88('0x48')));router['get'](_0xad88('0x49'),auth[_0xad88('0x6')](),controller['showFaxQueues']);router[_0xad88('0x3e')]('/openchannel/queues/:id/notify',auth[_0xad88('0x6')](),controller[_0xad88('0x40')]('openchannel'));router['get'](_0xad88('0x4a'),auth['isAuthenticated'](),controller[_0xad88('0x4b')]);router[_0xad88('0x3e')](_0xad88('0x4c'),auth[_0xad88('0x6')](),controller[_0xad88('0x40')](_0xad88('0x4d')));router[_0xad88('0x3e')](_0xad88('0x4e'),auth[_0xad88('0x6')](),controller[_0xad88('0x40')](_0xad88('0x4f')));router[_0xad88('0x8')](_0xad88('0x50'),auth[_0xad88('0x6')](),controller[_0xad88('0x51')]);router[_0xad88('0x8')](_0xad88('0x52'),auth[_0xad88('0x6')](),controller[_0xad88('0x53')]);router['post'](_0xad88('0x54'),auth[_0xad88('0x6')](),controller[_0xad88('0x55')]);module[_0xad88('0x56')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 5bfce62..c68f3de 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 _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,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(_0x1a6e76,_0x39a834){var _0x1a1511=function(_0x31c7b7){while(--_0x31c7b7){_0x1a6e76['push'](_0x1a6e76['shift']());}};_0x1a1511(++_0x39a834);}(_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 6f55f2e..9fd66fc 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 _0x0afb=['put','update','exports','util','connect-timeout','express','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post','create'];(function(_0x28cf58,_0x2fe21e){var _0x33d0d5=function(_0x374aa6){while(--_0x374aa6){_0x28cf58['push'](_0x28cf58['shift']());}};_0x33d0d5(++_0x2fe21e);}(_0x0afb,0x93));var _0xb0af=function(_0x97d873,_0x130de5){_0x97d873=_0x97d873-0x0;var _0x17c93d=_0x0afb[_0x97d873];return _0x17c93d;};'use strict';var multer=require('multer');var util=require(_0xb0af('0x0'));var path=require('path');var timeout=require(_0xb0af('0x1'));var express=require(_0xb0af('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb0af('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb0af('0x4'));var controller=require(_0xb0af('0x5'));router[_0xb0af('0x6')]('/',auth[_0xb0af('0x7')](),controller[_0xb0af('0x8')]);router['get'](_0xb0af('0x9'),auth[_0xb0af('0x7')](),controller[_0xb0af('0xa')]);router['get'](_0xb0af('0xb'),auth[_0xb0af('0x7')](),controller[_0xb0af('0xc')]);router[_0xb0af('0xd')]('/',auth['isAuthenticated'](),controller[_0xb0af('0xe')]);router[_0xb0af('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb0af('0x10')]);router['delete'](_0xb0af('0x9'),auth[_0xb0af('0x7')](),controller['destroy']);module[_0xb0af('0x11')]=router; \ No newline at end of file +var _0xef03=['run','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','/:id','isAuthenticated','/:id/run'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xef03,0x124));var _0x3ef0=function(_0x51da12,_0x13596d){_0x51da12=_0x51da12-0x0;var _0x451e80=_0xef03[_0x51da12];return _0x451e80;};'use strict';var multer=require(_0x3ef0('0x0'));var util=require(_0x3ef0('0x1'));var path=require(_0x3ef0('0x2'));var timeout=require(_0x3ef0('0x3'));var express=require(_0x3ef0('0x4'));var router=express[_0x3ef0('0x5')]();var fs_extra=require(_0x3ef0('0x6'));var auth=require(_0x3ef0('0x7'));var interaction=require(_0x3ef0('0x8'));var config=require(_0x3ef0('0x9'));var controller=require(_0x3ef0('0xa'));router[_0x3ef0('0xb')]('/',auth['isAuthenticated'](),controller[_0x3ef0('0xc')]);router[_0x3ef0('0xb')](_0x3ef0('0xd'),auth[_0x3ef0('0xe')](),controller['show']);router[_0x3ef0('0xb')](_0x3ef0('0xf'),auth[_0x3ef0('0xe')](),controller[_0x3ef0('0x10')]);router[_0x3ef0('0x11')]('/',auth[_0x3ef0('0xe')](),controller[_0x3ef0('0x12')]);router['put'](_0x3ef0('0xd'),auth[_0x3ef0('0xe')](),controller[_0x3ef0('0x13')]);router[_0x3ef0('0x14')](_0x3ef0('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x3ef0('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 68dd37d..c8656c1 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 _0x6fd3=['DATE','ENUM','quarters','months','days','minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6fd3,0xb6));var _0x36fd=function(_0x52b5f5,_0x45adab){_0x52b5f5=_0x52b5f5-0x0;var _0x247d67=_0x6fd3[_0x52b5f5];return _0x247d67;};'use strict';var Sequelize=require(_0x36fd('0x0'));module[_0x36fd('0x1')]={'name':{'type':Sequelize[_0x36fd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x36fd('0x2')]},'active':{'type':Sequelize[_0x36fd('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x36fd('0x2')],'allowNull':![],'defaultValue':_0x36fd('0x4')},'startAt':{'type':Sequelize[_0x36fd('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x36fd('0x6')]('years',_0x36fd('0x7'),_0x36fd('0x8'),'weeks',_0x36fd('0x9'),'hours',_0x36fd('0xa')),'allowNull':![],'defaultValue':_0x36fd('0x9')},'output':{'type':Sequelize['ENUM'](_0x36fd('0xb'),_0x36fd('0xc'),_0x36fd('0xd')),'allowNull':![],'defaultValue':_0x36fd('0xb')},'type':{'type':Sequelize[_0x36fd('0x6')](_0x36fd('0xe'),_0x36fd('0xf')),'allowNull':![],'defaultValue':_0x36fd('0xe')},'sendMail':{'type':Sequelize[_0x36fd('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x36fd('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x36fd('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x36fd('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5de8=['minutes','ENUM','pdf','csv','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years','months','days','hours'];(function(_0x8347e3,_0x4027a3){var _0x19e4d9=function(_0x5ea6e6){while(--_0x5ea6e6){_0x8347e3['push'](_0x8347e3['shift']());}};_0x19e4d9(++_0x4027a3);}(_0x5de8,0xe6));var _0x85de=function(_0x118adc,_0x3e574a){_0x118adc=_0x118adc-0x0;var _0x36ab26=_0x5de8[_0x118adc];return _0x36ab26;};'use strict';var Sequelize=require(_0x85de('0x0'));module[_0x85de('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x85de('0x2')]},'active':{'type':Sequelize[_0x85de('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x85de('0x2')],'allowNull':![],'defaultValue':_0x85de('0x4')},'startAt':{'type':Sequelize[_0x85de('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x85de('0x6'),'quarters',_0x85de('0x7'),'weeks',_0x85de('0x8'),_0x85de('0x9'),_0x85de('0xa')),'allowNull':![],'defaultValue':_0x85de('0x8')},'output':{'type':Sequelize[_0x85de('0xb')]('csv',_0x85de('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0x85de('0xd')},'type':{'type':Sequelize[_0x85de('0xb')](_0x85de('0xe'),'default'),'allowNull':![],'defaultValue':_0x85de('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x85de('0xf')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x85de('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 96710c5..14ffc3e 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 _0x1a42=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','role','UserProfileSection','userProfileId','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x47be24,_0x2c9983){var _0x26c866=function(_0x3bfd49){while(--_0x3bfd49){_0x47be24['push'](_0x47be24['shift']());}};_0x26c866(++_0x2c9983);}(_0x1a42,0x19a));var _0x21a4=function(_0x15f80e,_0x28a721){_0x15f80e=_0x15f80e-0x0;var _0x4c8a21=_0x1a42[_0x15f80e];return _0x4c8a21;};'use strict';var emlformat=require(_0x21a4('0x0'));var rimraf=require(_0x21a4('0x1'));var zipdir=require(_0x21a4('0x2'));var jsonpatch=require(_0x21a4('0x3'));var rp=require(_0x21a4('0x4'));var moment=require(_0x21a4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x21a4('0x6'));var util=require(_0x21a4('0x7'));var path=require(_0x21a4('0x8'));var sox=require('sox');var csv=require(_0x21a4('0x9'));var ejs=require(_0x21a4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x21a4('0xb'));var squel=require('squel');var crypto=require(_0x21a4('0xc'));var jsforce=require(_0x21a4('0xd'));var deskjs=require(_0x21a4('0xe'));var toCsv=require(_0x21a4('0x9'));var querystring=require(_0x21a4('0xf'));var Papa=require(_0x21a4('0x10'));var Redis=require(_0x21a4('0x11'));var authService=require(_0x21a4('0x12'));var qs=require(_0x21a4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21a4('0x14'));var logger=require(_0x21a4('0x15'))('api');var utils=require(_0x21a4('0x16'));var config=require(_0x21a4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x21a4('0x18'))['db'];function respondWithStatusCode(_0x2b4ce2,_0xa196df){_0xa196df=_0xa196df||0xcc;return function(_0x5e66b9){if(_0x5e66b9){return _0x2b4ce2['sendStatus'](_0xa196df);}return _0x2b4ce2['status'](_0xa196df)[_0x21a4('0x19')]();};}function respondWithResult(_0x4063ce,_0x5640dd){_0x5640dd=_0x5640dd||0xc8;return function(_0x33df2b){if(_0x33df2b){return _0x4063ce[_0x21a4('0x1a')](_0x5640dd)[_0x21a4('0x1b')](_0x33df2b);}};}function respondWithFilteredResult(_0x679c9e,_0x15328b){return function(_0x56e10a){if(_0x56e10a){var _0x442164=typeof _0x15328b[_0x21a4('0x1c')]===_0x21a4('0x1d')&&typeof _0x15328b[_0x21a4('0x1e')]===_0x21a4('0x1d');var _0x24cd53=_0x56e10a[_0x21a4('0x1f')];var _0x2b9382=_0x442164?0x0:_0x15328b['offset'];var _0x3ef1de=_0x442164?_0x56e10a[_0x21a4('0x1f')]:_0x15328b['offset']+_0x15328b['limit'];var _0x86645d;if(_0x3ef1de>=_0x24cd53){_0x3ef1de=_0x24cd53;_0x86645d=0xc8;}else{_0x86645d=0xce;}_0x679c9e[_0x21a4('0x1a')](_0x86645d);return _0x679c9e['set'](_0x21a4('0x20'),_0x2b9382+'-'+_0x3ef1de+'/'+_0x24cd53)[_0x21a4('0x1b')](_0x56e10a);}return null;};}function patchUpdates(_0x30f63d){return function(_0x247527){try{jsonpatch[_0x21a4('0x21')](_0x247527,_0x30f63d,!![]);}catch(_0x4e14a5){return BPromise[_0x21a4('0x22')](_0x4e14a5);}return _0x247527['save']();};}function saveUpdates(_0x4d54e4,_0x2839f6){return function(_0x261e17){if(_0x261e17){return _0x261e17[_0x21a4('0x23')](_0x4d54e4)[_0x21a4('0x24')](function(_0x44d2bf){return _0x44d2bf;});}return null;};}function removeEntity(_0x147c83,_0x385105){return function(_0x457115){if(_0x457115){return _0x457115[_0x21a4('0x25')]()[_0x21a4('0x24')](function(){var _0x8850d3=_0x457115[_0x21a4('0x26')]({'plain':!![]});var _0x1819fb=_0x21a4('0x27');return db[_0x21a4('0x28')][_0x21a4('0x25')]({'where':{'type':_0x1819fb,'resourceId':_0x8850d3['id']}})['then'](function(){return _0x457115;});})[_0x21a4('0x24')](function(){_0x147c83[_0x21a4('0x1a')](0xcc)[_0x21a4('0x19')]();});}};}function handleEntityNotFound(_0x39b1d8,_0x401b5f){return function(_0x4f3d90){if(!_0x4f3d90){_0x39b1d8[_0x21a4('0x29')](0x194);}return _0x4f3d90;};}function handleError(_0x57d11c,_0x386aa1){_0x386aa1=_0x386aa1||0x1f4;return function(_0x2f6ab9){logger[_0x21a4('0x2a')](_0x2f6ab9['stack']);if(_0x2f6ab9[_0x21a4('0x2b')]){delete _0x2f6ab9['name'];}_0x57d11c[_0x21a4('0x1a')](_0x386aa1)[_0x21a4('0x2c')](_0x2f6ab9);};}exports[_0x21a4('0x2d')]=function(_0x7b9372,_0x44a5c6){var _0x45bcf7={},_0x3408bc={},_0x279eab={'count':0x0,'rows':[]};var _0x38aaf0=_[_0x21a4('0x2e')](db[_0x21a4('0x2f')][_0x21a4('0x30')],function(_0x16f434){return{'name':_0x16f434[_0x21a4('0x31')],'type':_0x16f434[_0x21a4('0x32')][_0x21a4('0x33')]};});_0x3408bc['model']=_[_0x21a4('0x2e')](_0x38aaf0,'name');_0x3408bc[_0x21a4('0x34')]=_[_0x21a4('0x35')](_0x7b9372[_0x21a4('0x34')]);_0x3408bc[_0x21a4('0x36')]=_[_0x21a4('0x37')](_0x3408bc[_0x21a4('0x38')],_0x3408bc[_0x21a4('0x34')]);_0x45bcf7[_0x21a4('0x39')]=_[_0x21a4('0x37')](_0x3408bc[_0x21a4('0x38')],qs[_0x21a4('0x3a')](_0x7b9372[_0x21a4('0x34')][_0x21a4('0x3a')]));_0x45bcf7[_0x21a4('0x39')]=_0x45bcf7[_0x21a4('0x39')][_0x21a4('0x3b')]?_0x45bcf7[_0x21a4('0x39')]:_0x3408bc['model'];if(!_0x7b9372[_0x21a4('0x34')][_0x21a4('0x3c')](_0x21a4('0x3d'))){_0x45bcf7['limit']=qs['limit'](_0x7b9372[_0x21a4('0x34')][_0x21a4('0x1e')]);_0x45bcf7[_0x21a4('0x1c')]=qs['offset'](_0x7b9372['query'][_0x21a4('0x1c')]);}_0x45bcf7[_0x21a4('0x3e')]=qs[_0x21a4('0x3f')](_0x7b9372[_0x21a4('0x34')]['sort']);_0x45bcf7[_0x21a4('0x40')]=qs[_0x21a4('0x36')](_[_0x21a4('0x41')](_0x7b9372[_0x21a4('0x34')],_0x3408bc[_0x21a4('0x36')]),_0x38aaf0);if(_0x7b9372[_0x21a4('0x34')]['filter']){_0x45bcf7[_0x21a4('0x40')]=_[_0x21a4('0x42')](_0x45bcf7[_0x21a4('0x40')],{'$or':_[_0x21a4('0x2e')](_0x38aaf0,function(_0x3181b8){if(_0x3181b8[_0x21a4('0x32')]!==_0x21a4('0x43')){var _0x5c1520={};_0x5c1520[_0x3181b8[_0x21a4('0x2b')]]={'$like':'%'+_0x7b9372[_0x21a4('0x34')][_0x21a4('0x44')]+'%'};return _0x5c1520;}})});}_0x45bcf7=_[_0x21a4('0x42')]({},_0x45bcf7,_0x7b9372['options']);var _0x483045={'where':_0x45bcf7[_0x21a4('0x40')]};return db[_0x21a4('0x2f')][_0x21a4('0x1f')](_0x483045)[_0x21a4('0x24')](function(_0x53a20c){_0x279eab[_0x21a4('0x1f')]=_0x53a20c;if(_0x7b9372[_0x21a4('0x34')][_0x21a4('0x45')]){_0x45bcf7[_0x21a4('0x46')]=[{'all':!![]}];}return db[_0x21a4('0x2f')][_0x21a4('0x47')](_0x45bcf7);})[_0x21a4('0x24')](function(_0x305c8e){_0x279eab[_0x21a4('0x48')]=_0x305c8e;return _0x279eab;})[_0x21a4('0x24')](respondWithFilteredResult(_0x44a5c6,_0x45bcf7))[_0x21a4('0x49')](handleError(_0x44a5c6,null));};exports[_0x21a4('0x4a')]=function(_0x323e55,_0x35868a){var _0x5ab9fc={'raw':![],'where':{'id':_0x323e55[_0x21a4('0x4b')]['id']}},_0x44958d={};_0x44958d[_0x21a4('0x38')]=_[_0x21a4('0x35')](db['Schedule']['rawAttributes']);_0x44958d[_0x21a4('0x34')]=_['keys'](_0x323e55[_0x21a4('0x34')]);_0x44958d[_0x21a4('0x36')]=_[_0x21a4('0x37')](_0x44958d['model'],_0x44958d['query']);_0x5ab9fc[_0x21a4('0x39')]=_[_0x21a4('0x37')](_0x44958d[_0x21a4('0x38')],qs[_0x21a4('0x3a')](_0x323e55[_0x21a4('0x34')]['fields']));_0x5ab9fc[_0x21a4('0x39')]=_0x5ab9fc['attributes'][_0x21a4('0x3b')]?_0x5ab9fc[_0x21a4('0x39')]:_0x44958d['model'];if(_0x323e55[_0x21a4('0x34')][_0x21a4('0x45')]){_0x5ab9fc[_0x21a4('0x46')]=[{'all':!![]}];}_0x5ab9fc=_[_0x21a4('0x42')]({},_0x5ab9fc,_0x323e55[_0x21a4('0x4c')]);return db[_0x21a4('0x2f')][_0x21a4('0x4d')](_0x5ab9fc)[_0x21a4('0x24')](handleEntityNotFound(_0x35868a,null))[_0x21a4('0x24')](respondWithResult(_0x35868a,null))[_0x21a4('0x49')](handleError(_0x35868a,null));};exports[_0x21a4('0x4e')]=function(_0x104e07,_0x20e9ee){return db['Schedule'][_0x21a4('0x4e')](_0x104e07[_0x21a4('0x4f')],{})[_0x21a4('0x24')](function(_0x1788d6){var _0x23f597=_0x104e07[_0x21a4('0x50')][_0x21a4('0x26')]({'plain':!![]});if(!_0x23f597)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23f597[_0x21a4('0x51')]===_0x21a4('0x50')){var _0x41fd8a=_0x1788d6[_0x21a4('0x26')]({'plain':!![]});var _0x47fb89=_0x21a4('0x27');return db[_0x21a4('0x52')][_0x21a4('0x4d')]({'where':{'name':_0x47fb89,'userProfileId':_0x23f597[_0x21a4('0x53')]},'raw':!![]})['then'](function(_0x4b07e6){if(_0x4b07e6&&_0x4b07e6['autoAssociation']===0x0){return db['UserProfileResource'][_0x21a4('0x4e')]({'name':_0x41fd8a[_0x21a4('0x2b')],'resourceId':_0x41fd8a['id'],'type':_0x4b07e6[_0x21a4('0x2b')],'sectionId':_0x4b07e6['id']},{})[_0x21a4('0x24')](function(){return _0x1788d6;});}else{return _0x1788d6;}})[_0x21a4('0x49')](function(_0x1f54e9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f54e9);throw _0x1f54e9;});}return _0x1788d6;})['then'](respondWithResult(_0x20e9ee,0xc9))[_0x21a4('0x49')](handleError(_0x20e9ee,null));};exports[_0x21a4('0x23')]=function(_0x24e617,_0x52e357){if(_0x24e617['body']['id']){delete _0x24e617['body']['id'];}return db[_0x21a4('0x2f')][_0x21a4('0x4d')]({'where':{'id':_0x24e617['params']['id']}})[_0x21a4('0x24')](handleEntityNotFound(_0x52e357,null))[_0x21a4('0x24')](saveUpdates(_0x24e617['body'],null))[_0x21a4('0x24')](respondWithResult(_0x52e357,null))[_0x21a4('0x49')](handleError(_0x52e357,null));};exports[_0x21a4('0x25')]=function(_0x5f49c4,_0x3e1ba7){return db[_0x21a4('0x2f')][_0x21a4('0x4d')]({'where':{'id':_0x5f49c4[_0x21a4('0x4b')]['id']}})[_0x21a4('0x24')](handleEntityNotFound(_0x3e1ba7,null))[_0x21a4('0x24')](removeEntity(_0x3e1ba7,null))['catch'](handleError(_0x3e1ba7,null));};exports[_0x21a4('0x54')]=function(_0x484223,_0x13ea55,_0x4438e0){var _0x4fca27=require('../../config/schedule');return db[_0x21a4('0x2f')][_0x21a4('0x4d')]({'where':{'id':_0x484223['params']['id']},'raw':!![]})[_0x21a4('0x24')](handleEntityNotFound(_0x13ea55,null))[_0x21a4('0x24')](function(){_0x4fca27['run'](_0x484223[_0x21a4('0x4b')]['id']);})[_0x21a4('0x24')](respondWithStatusCode(_0x13ea55,null))['catch'](handleError(_0x13ea55,null));}; \ No newline at end of file +var _0xb435=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','destroy','end','error','name','send','index','Schedule','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','run','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x35dc45,_0x5e9288){var _0x18c961=function(_0x589513){while(--_0x589513){_0x35dc45['push'](_0x35dc45['shift']());}};_0x18c961(++_0x5e9288);}(_0xb435,0x17f));var _0x5b43=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb435[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5b43('0x0'));var moment=require(_0x5b43('0x1'));var BPromise=require(_0x5b43('0x2'));var Mustache=require(_0x5b43('0x3'));var util=require(_0x5b43('0x4'));var path=require(_0x5b43('0x5'));var sox=require('sox');var csv=require(_0x5b43('0x6'));var ejs=require(_0x5b43('0x7'));var fs=require('fs');var fs_extra=require(_0x5b43('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5b43('0x9'));var jsforce=require(_0x5b43('0xa'));var deskjs=require(_0x5b43('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5b43('0xc'));var Papa=require(_0x5b43('0xd'));var Redis=require(_0x5b43('0xe'));var authService=require(_0x5b43('0xf'));var qs=require(_0x5b43('0x10'));var as=require(_0x5b43('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b43('0x12'))(_0x5b43('0x13'));var utils=require('../../config/utils');var config=require(_0x5b43('0x14'));var licenseUtil=require(_0x5b43('0x15'));var db=require(_0x5b43('0x16'))['db'];function respondWithStatusCode(_0x262174,_0x33f249){_0x33f249=_0x33f249||0xcc;return function(_0x4920cf){if(_0x4920cf){return _0x262174[_0x5b43('0x17')](_0x33f249);}return _0x262174[_0x5b43('0x18')](_0x33f249)['end']();};}function respondWithResult(_0x10770f,_0x2289dc){_0x2289dc=_0x2289dc||0xc8;return function(_0x29510f){if(_0x29510f){return _0x10770f[_0x5b43('0x18')](_0x2289dc)[_0x5b43('0x19')](_0x29510f);}};}function respondWithFilteredResult(_0x2c25c7,_0x5e2eab){return function(_0x182ce8){if(_0x182ce8){var _0xf02e3a=typeof _0x5e2eab[_0x5b43('0x1a')]===_0x5b43('0x1b')&&typeof _0x5e2eab[_0x5b43('0x1c')]==='undefined';var _0x5bd23c=_0x182ce8[_0x5b43('0x1d')];var _0x5b7ef2=_0xf02e3a?0x0:_0x5e2eab['offset'];var _0x197c8f=_0xf02e3a?_0x182ce8['count']:_0x5e2eab['offset']+_0x5e2eab[_0x5b43('0x1c')];var _0x2d11ab;if(_0x197c8f>=_0x5bd23c){_0x197c8f=_0x5bd23c;_0x2d11ab=0xc8;}else{_0x2d11ab=0xce;}_0x2c25c7[_0x5b43('0x18')](_0x2d11ab);return _0x2c25c7[_0x5b43('0x1e')](_0x5b43('0x1f'),_0x5b7ef2+'-'+_0x197c8f+'/'+_0x5bd23c)[_0x5b43('0x19')](_0x182ce8);}return null;};}function patchUpdates(_0x3b85b4){return function(_0x360466){try{jsonpatch[_0x5b43('0x20')](_0x360466,_0x3b85b4,!![]);}catch(_0x274036){return BPromise[_0x5b43('0x21')](_0x274036);}return _0x360466[_0x5b43('0x22')]();};}function saveUpdates(_0x4696af,_0x1357e9){return function(_0x220749){if(_0x220749){return _0x220749[_0x5b43('0x23')](_0x4696af)[_0x5b43('0x24')](function(_0xd75147){return _0xd75147;});}return null;};}function removeEntity(_0x199791,_0x432315){return function(_0x439abe){if(_0x439abe){return _0x439abe['destroy']()[_0x5b43('0x24')](function(){var _0x3d136b=_0x439abe[_0x5b43('0x25')]({'plain':!![]});var _0x1f9df7='Scheduler';return db['UserProfileResource'][_0x5b43('0x26')]({'where':{'type':_0x1f9df7,'resourceId':_0x3d136b['id']}})[_0x5b43('0x24')](function(){return _0x439abe;});})[_0x5b43('0x24')](function(){_0x199791[_0x5b43('0x18')](0xcc)[_0x5b43('0x27')]();});}};}function handleEntityNotFound(_0x5baf2c,_0x1eb399){return function(_0x462db5){if(!_0x462db5){_0x5baf2c[_0x5b43('0x17')](0x194);}return _0x462db5;};}function handleError(_0x5a8215,_0x10aef9){_0x10aef9=_0x10aef9||0x1f4;return function(_0x222d42){logger[_0x5b43('0x28')](_0x222d42['stack']);if(_0x222d42[_0x5b43('0x29')]){delete _0x222d42[_0x5b43('0x29')];}_0x5a8215['status'](_0x10aef9)[_0x5b43('0x2a')](_0x222d42);};}exports[_0x5b43('0x2b')]=function(_0x5b3aa1,_0x1787b9){var _0x5accb9={},_0x2e18f2={},_0x531b58={'count':0x0,'rows':[]};var _0x3165b4=_['map'](db[_0x5b43('0x2c')]['rawAttributes'],function(_0x53842b){return{'name':_0x53842b[_0x5b43('0x2d')],'type':_0x53842b['type'][_0x5b43('0x2e')]};});_0x2e18f2[_0x5b43('0x2f')]=_[_0x5b43('0x30')](_0x3165b4,'name');_0x2e18f2[_0x5b43('0x31')]=_[_0x5b43('0x32')](_0x5b3aa1[_0x5b43('0x31')]);_0x2e18f2[_0x5b43('0x33')]=_[_0x5b43('0x34')](_0x2e18f2[_0x5b43('0x2f')],_0x2e18f2[_0x5b43('0x31')]);_0x5accb9[_0x5b43('0x35')]=_[_0x5b43('0x34')](_0x2e18f2[_0x5b43('0x2f')],qs[_0x5b43('0x36')](_0x5b3aa1[_0x5b43('0x31')][_0x5b43('0x36')]));_0x5accb9['attributes']=_0x5accb9[_0x5b43('0x35')][_0x5b43('0x37')]?_0x5accb9[_0x5b43('0x35')]:_0x2e18f2['model'];if(!_0x5b3aa1[_0x5b43('0x31')]['hasOwnProperty'](_0x5b43('0x38'))){_0x5accb9['limit']=qs[_0x5b43('0x1c')](_0x5b3aa1[_0x5b43('0x31')]['limit']);_0x5accb9[_0x5b43('0x1a')]=qs[_0x5b43('0x1a')](_0x5b3aa1[_0x5b43('0x31')][_0x5b43('0x1a')]);}_0x5accb9['order']=qs[_0x5b43('0x39')](_0x5b3aa1['query'][_0x5b43('0x39')]);_0x5accb9['where']=qs[_0x5b43('0x33')](_['pick'](_0x5b3aa1[_0x5b43('0x31')],_0x2e18f2[_0x5b43('0x33')]),_0x3165b4);if(_0x5b3aa1[_0x5b43('0x31')][_0x5b43('0x3a')]){_0x5accb9[_0x5b43('0x3b')]=_[_0x5b43('0x3c')](_0x5accb9[_0x5b43('0x3b')],{'$or':_[_0x5b43('0x30')](_0x3165b4,function(_0x405109){if(_0x405109['type']!=='VIRTUAL'){var _0x5a4078={};_0x5a4078[_0x405109['name']]={'$like':'%'+_0x5b3aa1[_0x5b43('0x31')][_0x5b43('0x3a')]+'%'};return _0x5a4078;}})});}_0x5accb9=_['merge']({},_0x5accb9,_0x5b3aa1[_0x5b43('0x3d')]);var _0x3b2d6c={'where':_0x5accb9[_0x5b43('0x3b')]};return db[_0x5b43('0x2c')][_0x5b43('0x1d')](_0x3b2d6c)['then'](function(_0x12333c){_0x531b58[_0x5b43('0x1d')]=_0x12333c;if(_0x5b3aa1[_0x5b43('0x31')][_0x5b43('0x3e')]){_0x5accb9['include']=[{'all':!![]}];}return db['Schedule'][_0x5b43('0x3f')](_0x5accb9);})[_0x5b43('0x24')](function(_0x141a50){_0x531b58[_0x5b43('0x40')]=_0x141a50;return _0x531b58;})['then'](respondWithFilteredResult(_0x1787b9,_0x5accb9))[_0x5b43('0x41')](handleError(_0x1787b9,null));};exports[_0x5b43('0x42')]=function(_0x2f899,_0x4836a2){var _0x21252e={'raw':![],'where':{'id':_0x2f899[_0x5b43('0x43')]['id']}},_0x1914ca={};_0x1914ca[_0x5b43('0x2f')]=_[_0x5b43('0x32')](db[_0x5b43('0x2c')][_0x5b43('0x44')]);_0x1914ca[_0x5b43('0x31')]=_[_0x5b43('0x32')](_0x2f899[_0x5b43('0x31')]);_0x1914ca[_0x5b43('0x33')]=_[_0x5b43('0x34')](_0x1914ca['model'],_0x1914ca[_0x5b43('0x31')]);_0x21252e[_0x5b43('0x35')]=_['intersection'](_0x1914ca[_0x5b43('0x2f')],qs['fields'](_0x2f899[_0x5b43('0x31')]['fields']));_0x21252e['attributes']=_0x21252e[_0x5b43('0x35')]['length']?_0x21252e[_0x5b43('0x35')]:_0x1914ca['model'];if(_0x2f899['query'][_0x5b43('0x3e')]){_0x21252e[_0x5b43('0x45')]=[{'all':!![]}];}_0x21252e=_[_0x5b43('0x3c')]({},_0x21252e,_0x2f899['options']);return db[_0x5b43('0x2c')]['find'](_0x21252e)[_0x5b43('0x24')](handleEntityNotFound(_0x4836a2,null))[_0x5b43('0x24')](respondWithResult(_0x4836a2,null))[_0x5b43('0x41')](handleError(_0x4836a2,null));};exports['create']=function(_0x4b9b81,_0x39af8c){return db[_0x5b43('0x2c')]['create'](_0x4b9b81[_0x5b43('0x46')],{})['then'](function(_0x20fa55){var _0x3c3037=_0x4b9b81[_0x5b43('0x47')][_0x5b43('0x25')]({'plain':!![]});if(!_0x3c3037)throw new Error(_0x5b43('0x48'));if(_0x3c3037[_0x5b43('0x49')]===_0x5b43('0x47')){var _0x5ba838=_0x20fa55[_0x5b43('0x25')]({'plain':!![]});var _0x32fb4e='Scheduler';return db[_0x5b43('0x4a')]['find']({'where':{'name':_0x32fb4e,'userProfileId':_0x3c3037[_0x5b43('0x4b')]},'raw':!![]})['then'](function(_0x2550a9){if(_0x2550a9&&_0x2550a9[_0x5b43('0x4c')]===0x0){return db['UserProfileResource'][_0x5b43('0x4d')]({'name':_0x5ba838[_0x5b43('0x29')],'resourceId':_0x5ba838['id'],'type':_0x2550a9['name'],'sectionId':_0x2550a9['id']},{})[_0x5b43('0x24')](function(){return _0x20fa55;});}else{return _0x20fa55;}})['catch'](function(_0x432992){logger[_0x5b43('0x28')](_0x5b43('0x4e'),_0x432992);throw _0x432992;});}return _0x20fa55;})[_0x5b43('0x24')](respondWithResult(_0x39af8c,0xc9))[_0x5b43('0x41')](handleError(_0x39af8c,null));};exports['update']=function(_0x3d823c,_0x3b3bc5){if(_0x3d823c['body']['id']){delete _0x3d823c[_0x5b43('0x46')]['id'];}return db[_0x5b43('0x2c')][_0x5b43('0x4f')]({'where':{'id':_0x3d823c[_0x5b43('0x43')]['id']}})[_0x5b43('0x24')](handleEntityNotFound(_0x3b3bc5,null))[_0x5b43('0x24')](saveUpdates(_0x3d823c[_0x5b43('0x46')],null))[_0x5b43('0x24')](respondWithResult(_0x3b3bc5,null))['catch'](handleError(_0x3b3bc5,null));};exports[_0x5b43('0x26')]=function(_0x5d937d,_0xaa4fa0){return db[_0x5b43('0x2c')][_0x5b43('0x4f')]({'where':{'id':_0x5d937d['params']['id']}})['then'](handleEntityNotFound(_0xaa4fa0,null))[_0x5b43('0x24')](removeEntity(_0xaa4fa0,null))[_0x5b43('0x41')](handleError(_0xaa4fa0,null));};exports[_0x5b43('0x50')]=function(_0x4f2d2c,_0x213acb,_0x4fc5ca){var _0x27179e=require('../../config/schedule');return db[_0x5b43('0x2c')][_0x5b43('0x4f')]({'where':{'id':_0x4f2d2c[_0x5b43('0x43')]['id']},'raw':!![]})[_0x5b43('0x24')](handleEntityNotFound(_0x213acb,null))['then'](function(){_0x27179e[_0x5b43('0x50')](_0x4f2d2c['params']['id']);})['then'](respondWithStatusCode(_0x213acb,null))[_0x5b43('0x41')](handleError(_0x213acb,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 78d5bdd..88a687f 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 _0x078f=['../../config/environment','./schedule.attributes','exports','define','Schedule','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x274b75,_0x1bf6dc){var _0x248f5c=function(_0x151997){while(--_0x151997){_0x274b75['push'](_0x274b75['shift']());}};_0x248f5c(++_0x1bf6dc);}(_0x078f,0x1e6));var _0xf078=function(_0x58f8f7,_0x3178cc){_0x58f8f7=_0x58f8f7-0x0;var _0x57f07e=_0x078f[_0x58f8f7];return _0x57f07e;};'use strict';var _=require(_0xf078('0x0'));var util=require(_0xf078('0x1'));var logger=require(_0xf078('0x2'))('api');var moment=require(_0xf078('0x3'));var BPromise=require(_0xf078('0x4'));var rp=require(_0xf078('0x5'));var fs=require('fs');var path=require(_0xf078('0x6'));var rimraf=require(_0xf078('0x7'));var config=require(_0xf078('0x8'));var attributes=require(_0xf078('0x9'));module[_0xf078('0xa')]=function(_0x43c3d7,_0x13749e){return _0x43c3d7[_0xf078('0xb')](_0xf078('0xc'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x681f=['moment','bluebird','path','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','../../config/logger','api'];(function(_0x9681b5,_0x3a646b){var _0x14cf34=function(_0x383692){while(--_0x383692){_0x9681b5['push'](_0x9681b5['shift']());}};_0x14cf34(++_0x3a646b);}(_0x681f,0xd5));var _0xf681=function(_0x5ac856,_0x1109ed){_0x5ac856=_0x5ac856-0x0;var _0x3ff07b=_0x681f[_0x5ac856];return _0x3ff07b;};'use strict';var _=require(_0xf681('0x0'));var util=require('util');var logger=require(_0xf681('0x1'))(_0xf681('0x2'));var moment=require(_0xf681('0x3'));var BPromise=require(_0xf681('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf681('0x5'));var rimraf=require('rimraf');var config=require(_0xf681('0x6'));var attributes=require(_0xf681('0x7'));module[_0xf681('0x8')]=function(_0x5328b4,_0x4032c1){return _0x5328b4[_0xf681('0x9')](_0xf681('0xa'),attributes,{'tableName':_0xf681('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index b6bf96d..03e55a9 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 _0x0a63=['client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3ddbb,_0x133266){var _0xf7c254=function(_0x4a4322){while(--_0x4a4322){_0x3ddbb['push'](_0x3ddbb['shift']());}};_0xf7c254(++_0x133266);}(_0x0a63,0x155));var _0x30a6=function(_0x3cec7e,_0x9decf5){_0x3cec7e=_0x3cec7e-0x0;var _0xdb488d=_0x0a63[_0x3cec7e];return _0xdb488d;};'use strict';var _=require(_0x30a6('0x0'));var util=require(_0x30a6('0x1'));var moment=require(_0x30a6('0x2'));var BPromise=require(_0x30a6('0x3'));var rs=require(_0x30a6('0x4'));var fs=require('fs');var Redis=require(_0x30a6('0x5'));var db=require(_0x30a6('0x6'))['db'];var utils=require(_0x30a6('0x7'));var logger=require(_0x30a6('0x8'))('rpc');var config=require(_0x30a6('0x9'));var jayson=require(_0x30a6('0xa'));var client=jayson[_0x30a6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10daf1,_0xdceacf,_0x10fd9d){return new BPromise(function(_0x598b75,_0x29ed05){return client[_0x30a6('0xc')](_0x10daf1,_0x10fd9d)[_0x30a6('0xd')](function(_0x4681fc){logger[_0x30a6('0xe')](_0x30a6('0xf'),_0xdceacf,_0x30a6('0x10'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0xdceacf,'request\x20sent',JSON[_0x30a6('0x11')](_0x4681fc));if(_0x4681fc[_0x30a6('0x12')]){if(_0x4681fc[_0x30a6('0x12')][_0x30a6('0x13')]===0x1f4){logger[_0x30a6('0x12')](_0x30a6('0xf'),_0xdceacf,_0x4681fc[_0x30a6('0x12')][_0x30a6('0x14')]);return _0x29ed05(_0x4681fc[_0x30a6('0x12')][_0x30a6('0x14')]);}logger[_0x30a6('0x12')](_0x30a6('0xf'),_0xdceacf,_0x4681fc[_0x30a6('0x12')]['message']);return _0x598b75(_0x4681fc[_0x30a6('0x12')][_0x30a6('0x14')]);}else{logger['info'](_0x30a6('0xf'),_0xdceacf,_0x30a6('0x10'));_0x598b75(_0x4681fc[_0x30a6('0x15')][_0x30a6('0x14')]);}})['catch'](function(_0x314c6a){logger[_0x30a6('0x12')]('Schedule,\x20%s,\x20%s',_0xdceacf,_0x314c6a);_0x29ed05(_0x314c6a);});});} \ No newline at end of file +var _0x2c75=['request\x20sent','debug','stringify','error','code','Schedule,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x2c75,0x181));var _0x52c7=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0x2c75[_0xfc406a];return _0x395473;};'use strict';var _=require('lodash');var util=require(_0x52c7('0x0'));var moment=require(_0x52c7('0x1'));var BPromise=require(_0x52c7('0x2'));var rs=require(_0x52c7('0x3'));var fs=require('fs');var Redis=require(_0x52c7('0x4'));var db=require(_0x52c7('0x5'))['db'];var utils=require(_0x52c7('0x6'));var logger=require(_0x52c7('0x7'))(_0x52c7('0x8'));var config=require(_0x52c7('0x9'));var jayson=require(_0x52c7('0xa'));var client=jayson[_0x52c7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x421957,_0x421c0a,_0x6ba3ff){return new BPromise(function(_0xda9f81,_0x46f99a){return client['request'](_0x421957,_0x6ba3ff)[_0x52c7('0xc')](function(_0x541def){logger[_0x52c7('0xd')]('Schedule,\x20%s,\x20%s',_0x421c0a,_0x52c7('0xe'));logger[_0x52c7('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x421c0a,_0x52c7('0xe'),JSON[_0x52c7('0x10')](_0x541def));if(_0x541def[_0x52c7('0x11')]){if(_0x541def[_0x52c7('0x11')][_0x52c7('0x12')]===0x1f4){logger['error'](_0x52c7('0x13'),_0x421c0a,_0x541def[_0x52c7('0x11')]['message']);return _0x46f99a(_0x541def[_0x52c7('0x11')][_0x52c7('0x14')]);}logger[_0x52c7('0x11')](_0x52c7('0x13'),_0x421c0a,_0x541def[_0x52c7('0x11')]['message']);return _0xda9f81(_0x541def[_0x52c7('0x11')]['message']);}else{logger[_0x52c7('0xd')](_0x52c7('0x13'),_0x421c0a,_0x52c7('0xe'));_0xda9f81(_0x541def['result'][_0x52c7('0x14')]);}})['catch'](function(_0x3aa138){logger[_0x52c7('0x11')]('Schedule,\x20%s,\x20%s',_0x421c0a,_0x3aa138);_0x46f99a(_0x3aa138);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index e33635c..1fbfe05 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 _0x44d9=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','isAuthenticated','index','get','/describe','describe','show','download','post','create','/:id','delete'];(function(_0x249d51,_0x1953cc){var _0x21e36f=function(_0x132671){while(--_0x132671){_0x249d51['push'](_0x249d51['shift']());}};_0x21e36f(++_0x1953cc);}(_0x44d9,0x155));var _0x944d=function(_0x5ee55b,_0x7a1de5){_0x5ee55b=_0x5ee55b-0x0;var _0x22886d=_0x44d9[_0x5ee55b];return _0x22886d;};'use strict';var multer=require(_0x944d('0x0'));var util=require(_0x944d('0x1'));var path=require(_0x944d('0x2'));var timeout=require(_0x944d('0x3'));var express=require(_0x944d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x944d('0x5'));var interaction=require(_0x944d('0x6'));var config=require('../../config/environment');var controller=require(_0x944d('0x7'));router['get']('/',auth[_0x944d('0x8')](),controller[_0x944d('0x9')]);router[_0x944d('0xa')](_0x944d('0xb'),auth[_0x944d('0x8')](),controller[_0x944d('0xc')]);router[_0x944d('0xa')]('/:id',auth[_0x944d('0x8')](),controller[_0x944d('0xd')]);router[_0x944d('0xa')]('/:id/download',auth[_0x944d('0x8')](),controller[_0x944d('0xe')]);router[_0x944d('0xf')]('/',auth[_0x944d('0x8')](),controller[_0x944d('0x10')]);router['put'](_0x944d('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x944d('0x12')](_0x944d('0x11'),auth[_0x944d('0x8')](),controller['destroy']);module[_0x944d('0x13')]=router; \ No newline at end of file +var _0x5f63=['../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','/describe','/:id','download','post','put','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x176f93,_0x4ceb71){var _0x18b63e=function(_0x4b4b0b){while(--_0x4b4b0b){_0x176f93['push'](_0x176f93['shift']());}};_0x18b63e(++_0x4ceb71);}(_0x5f63,0x185));var _0x35f6=function(_0x4bac53,_0x2f9c3f){_0x4bac53=_0x4bac53-0x0;var _0x2c91a9=_0x5f63[_0x4bac53];return _0x2c91a9;};'use strict';var multer=require(_0x35f6('0x0'));var util=require(_0x35f6('0x1'));var path=require(_0x35f6('0x2'));var timeout=require(_0x35f6('0x3'));var express=require(_0x35f6('0x4'));var router=express['Router']();var fs_extra=require(_0x35f6('0x5'));var auth=require(_0x35f6('0x6'));var interaction=require(_0x35f6('0x7'));var config=require('../../config/environment');var controller=require(_0x35f6('0x8'));router[_0x35f6('0x9')]('/',auth[_0x35f6('0xa')](),controller['index']);router[_0x35f6('0x9')](_0x35f6('0xb'),auth[_0x35f6('0xa')](),controller['describe']);router[_0x35f6('0x9')](_0x35f6('0xc'),auth[_0x35f6('0xa')](),controller['show']);router['get']('/:id/download',auth[_0x35f6('0xa')](),controller[_0x35f6('0xd')]);router[_0x35f6('0xe')]('/',auth[_0x35f6('0xa')](),controller['create']);router[_0x35f6('0xf')](_0x35f6('0xc'),auth[_0x35f6('0xa')](),controller[_0x35f6('0x10')]);router['delete'](_0x35f6('0xc'),auth[_0x35f6('0xa')](),controller[_0x35f6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 13ba01c..5cce9a1 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 _0x5324=['sequelize','moment','path','../../config/environment','VIRTUAL','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','format','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5324,0x154));var _0x4532=function(_0x589c57,_0x5064a9){_0x589c57=_0x589c57-0x0;var _0x1c8a9c=_0x5324[_0x589c57];return _0x1c8a9c;};'use strict';var Sequelize=require(_0x4532('0x0'));var moment=require(_0x4532('0x1'));var path=require(_0x4532('0x2'));var config=require(_0x4532('0x3'));module['exports']={'format':{'type':Sequelize[_0x4532('0x4')],'get':function(){return this['getDataValue'](_0x4532('0x5'))?path[_0x4532('0x6')](this[_0x4532('0x7')](_0x4532('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x4532('0x8')]},'channel':{'type':Sequelize[_0x4532('0x8')]},'value':{'type':Sequelize[_0x4532('0x8')],'set':function(_0x352b6a){var _0x58e28c=_0x352b6a[_0x4532('0x9')](/\\/g,'/');this[_0x4532('0xa')](_0x4532('0x5'),_0x58e28c);}},'rating':{'type':Sequelize[_0x4532('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x4532('0xb')],'set':function(_0x4340a7){this[_0x4532('0xa')](_0x4532('0xc'),moment()[_0x4532('0xd')](_0x4340a7,'ms'));this[_0x4532('0xa')](_0x4532('0xe'),moment());this[_0x4532('0xa')]('duration',_0x4340a7);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4532('0x7')]('startedAt'))[_0x4532('0xf')](_0x4532('0x10'))[_0x4532('0x11')]();}},'closedAt':{'type':Sequelize[_0x4532('0x12')],'get':function(){return moment(this['getDataValue'](_0x4532('0xe')))[_0x4532('0xf')](_0x4532('0x10'))[_0x4532('0x11')]();}},'createdAt':{'type':Sequelize[_0x4532('0x12')],'get':function(){return moment(this['getDataValue']('createdAt'))['format'](_0x4532('0x10'))[_0x4532('0x11')]();}},'updatedAt':{'type':Sequelize[_0x4532('0x12')],'get':function(){return moment(this[_0x4532('0x7')](_0x4532('0x13')))[_0x4532('0xf')](_0x4532('0x10'))[_0x4532('0x11')]();}}}; \ No newline at end of file +var _0x5464=['startedAt','closedAt','DATE','format','toString','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','moment','path','exports','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER'];(function(_0x18fcc6,_0x1bbe3b){var _0x153fed=function(_0x394b21){while(--_0x394b21){_0x18fcc6['push'](_0x18fcc6['shift']());}};_0x153fed(++_0x1bbe3b);}(_0x5464,0x15d));var _0x4546=function(_0x4609d5,_0x5de29b){_0x4609d5=_0x4609d5-0x0;var _0x225640=_0x5464[_0x4609d5];return _0x225640;};'use strict';var Sequelize=require(_0x4546('0x0'));var moment=require(_0x4546('0x1'));var path=require(_0x4546('0x2'));var config=require('../../config/environment');module[_0x4546('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4546('0x4')]('value')?path[_0x4546('0x5')](this[_0x4546('0x4')](_0x4546('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x4546('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x5c5e09){var _0x224c7c=_0x5c5e09[_0x4546('0x8')](/\\/g,'/');this[_0x4546('0x9')](_0x4546('0x6'),_0x224c7c);}},'rating':{'type':Sequelize[_0x4546('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x4546('0xa')],'set':function(_0x11d63e){this[_0x4546('0x9')](_0x4546('0xb'),moment()['subtract'](_0x11d63e,'ms'));this[_0x4546('0x9')](_0x4546('0xc'),moment());this[_0x4546('0x9')]('duration',_0x11d63e);}},'startedAt':{'type':Sequelize[_0x4546('0xd')],'get':function(){return moment(this[_0x4546('0x4')](_0x4546('0xb')))[_0x4546('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0x4546('0xd')],'get':function(){return moment(this['getDataValue']('closedAt'))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4546('0x4')]('createdAt'))[_0x4546('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x4546('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4546('0x4')](_0x4546('0x10')))[_0x4546('0xe')](_0x4546('0x11'))[_0x4546('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 9655fee..85b8d3d 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 _0x6f47=['zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','ScreenRecording','fieldName','type','key','model','format','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','catch','create','body','duration','createdAt','closedAt','value','find','describe','uniqueid','join','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','root','server/files/screen_recordings','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','rimraf'];(function(_0x2966a4,_0xb6d06a){var _0x270e6f=function(_0x348b10){while(--_0x348b10){_0x2966a4['push'](_0x2966a4['shift']());}};_0x270e6f(++_0xb6d06a);}(_0x6f47,0xc7));var _0x76f4=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x6f47[_0x4d8ed9];return _0x1e2140;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76f4('0x0'));var zipdir=require(_0x76f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76f4('0x2'));var moment=require('moment');var BPromise=require(_0x76f4('0x3'));var Mustache=require('mustache');var util=require(_0x76f4('0x4'));var path=require(_0x76f4('0x5'));var sox=require(_0x76f4('0x6'));var csv=require(_0x76f4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76f4('0x8'));var _=require(_0x76f4('0x9'));var squel=require(_0x76f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x76f4('0xb'));var deskjs=require(_0x76f4('0xc'));var toCsv=require(_0x76f4('0x7'));var querystring=require(_0x76f4('0xd'));var Papa=require(_0x76f4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76f4('0xf'));var as=require(_0x76f4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76f4('0x11'));var utils=require(_0x76f4('0x12'));var config=require(_0x76f4('0x13'));var licenseUtil=require(_0x76f4('0x14'));var db=require(_0x76f4('0x15'))['db'];function respondWithStatusCode(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xcc;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0x16')](_0xf7e347);}return _0xafd21e['status'](_0xf7e347)[_0x76f4('0x17')]();};}function respondWithResult(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0xc8;return function(_0x4b6021){if(_0x4b6021){return _0x30dabf['status'](_0x5da1ff)[_0x76f4('0x18')](_0x4b6021);}};}function respondWithFilteredResult(_0x3dd240,_0x979946){return function(_0x40252d){if(_0x40252d){var _0x3d8f5a=typeof _0x979946[_0x76f4('0x19')]===_0x76f4('0x1a')&&typeof _0x979946[_0x76f4('0x1b')]===_0x76f4('0x1a');var _0xb159a9=_0x40252d[_0x76f4('0x1c')];var _0x2d4bd1=_0x3d8f5a?0x0:_0x979946[_0x76f4('0x19')];var _0x38450e=_0x3d8f5a?_0x40252d[_0x76f4('0x1c')]:_0x979946[_0x76f4('0x19')]+_0x979946[_0x76f4('0x1b')];var _0x3e809f;if(_0x38450e>=_0xb159a9){_0x38450e=_0xb159a9;_0x3e809f=0xc8;}else{_0x3e809f=0xce;}_0x3dd240[_0x76f4('0x1d')](_0x3e809f);return _0x3dd240[_0x76f4('0x1e')](_0x76f4('0x1f'),_0x2d4bd1+'-'+_0x38450e+'/'+_0xb159a9)[_0x76f4('0x18')](_0x40252d);}return null;};}function patchUpdates(_0x5bf3d5){return function(_0x262937){try{jsonpatch['apply'](_0x262937,_0x5bf3d5,!![]);}catch(_0x13f3b1){return BPromise[_0x76f4('0x20')](_0x13f3b1);}return _0x262937[_0x76f4('0x21')]();};}function saveUpdates(_0x517c00,_0x567f2a){return function(_0x52da65){if(_0x52da65){return _0x52da65[_0x76f4('0x22')](_0x517c00)[_0x76f4('0x23')](function(_0x14bfe5){return _0x14bfe5;});}return null;};}function removeEntity(_0x2b6d51,_0x42ef70){return function(_0x4786c9){if(_0x4786c9){return _0x4786c9[_0x76f4('0x24')]()['then'](function(){_0x2b6d51['status'](0xcc)[_0x76f4('0x17')]();});}};}function handleEntityNotFound(_0x497913,_0x288365){return function(_0x5355bd){if(!_0x5355bd){_0x497913['sendStatus'](0x194);}return _0x5355bd;};}function handleError(_0x4f6087,_0x470242){_0x470242=_0x470242||0x1f4;return function(_0x38300d){logger[_0x76f4('0x25')](_0x38300d[_0x76f4('0x26')]);if(_0x38300d[_0x76f4('0x27')]){delete _0x38300d[_0x76f4('0x27')];}_0x4f6087['status'](_0x470242)[_0x76f4('0x28')](_0x38300d);};}exports['index']=function(_0x5346be,_0x5b3f07){var _0x10ddb4={},_0x30f02e={},_0x41dea4={'count':0x0,'rows':[]};var _0x1dea0e=_['map'](db[_0x76f4('0x29')]['rawAttributes'],function(_0x259c26){return{'name':_0x259c26[_0x76f4('0x2a')],'type':_0x259c26[_0x76f4('0x2b')][_0x76f4('0x2c')]};});_0x30f02e[_0x76f4('0x2d')]=_['differenceBy'](_['map'](_0x1dea0e,_0x76f4('0x27')),[_0x76f4('0x2e')]);_0x30f02e[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0x5346be[_0x76f4('0x2f')]);_0x30f02e[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],_0x30f02e[_0x76f4('0x2f')]);_0x10ddb4[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],qs['fields'](_0x5346be['query']['fields']));_0x10ddb4['attributes']=_0x10ddb4[_0x76f4('0x33')][_0x76f4('0x34')]?_0x10ddb4[_0x76f4('0x33')]:_0x30f02e[_0x76f4('0x2d')];if(!_0x5346be[_0x76f4('0x2f')]['hasOwnProperty'](_0x76f4('0x35'))){_0x10ddb4[_0x76f4('0x1b')]=qs[_0x76f4('0x1b')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x1b')]);_0x10ddb4[_0x76f4('0x19')]=qs[_0x76f4('0x19')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x19')]);}_0x10ddb4[_0x76f4('0x36')]=qs[_0x76f4('0x37')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x37')]);_0x10ddb4[_0x76f4('0x38')]=qs[_0x76f4('0x31')](_[_0x76f4('0x39')](_0x5346be[_0x76f4('0x2f')],_0x30f02e[_0x76f4('0x31')]),_0x1dea0e);if(_0x5346be['query'][_0x76f4('0x3a')]){_0x10ddb4[_0x76f4('0x38')]=_[_0x76f4('0x3b')](_0x10ddb4['where'],{'$or':_['map'](_0x1dea0e,function(_0x237fba){if(_0x237fba['type']!==_0x76f4('0x3c')){var _0x5ac18f={};_0x5ac18f[_0x237fba[_0x76f4('0x27')]]={'$like':'%'+_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3a')]+'%'};return _0x5ac18f;}})});}_0x10ddb4=_[_0x76f4('0x3b')]({},_0x10ddb4,_0x5346be[_0x76f4('0x3d')]);var _0x2d99e3={'where':_0x10ddb4[_0x76f4('0x38')]};return db[_0x76f4('0x29')][_0x76f4('0x1c')](_0x2d99e3)[_0x76f4('0x23')](function(_0x5340a9){_0x41dea4['count']=_0x5340a9;if(_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3e')]){_0x10ddb4[_0x76f4('0x3f')]=[{'all':!![]}];}return db[_0x76f4('0x29')][_0x76f4('0x40')](_0x10ddb4);})[_0x76f4('0x23')](function(_0x42754d){_0x41dea4[_0x76f4('0x41')]=_0x42754d;return _0x41dea4;})[_0x76f4('0x23')](respondWithFilteredResult(_0x5b3f07,_0x10ddb4))['catch'](handleError(_0x5b3f07,null));};exports[_0x76f4('0x42')]=function(_0xe744af,_0x4f0d1a){var _0x5ad90a={'raw':![],'where':{'id':_0xe744af[_0x76f4('0x43')]['id']}},_0x26c411={};_0x26c411[_0x76f4('0x2d')]=_[_0x76f4('0x30')](db[_0x76f4('0x29')]['rawAttributes']);_0x26c411[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0xe744af[_0x76f4('0x2f')]);_0x26c411[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],_0x26c411['query']);_0x5ad90a[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],qs['fields'](_0xe744af['query'][_0x76f4('0x44')]));_0x5ad90a[_0x76f4('0x33')]=_0x5ad90a[_0x76f4('0x33')][_0x76f4('0x34')]?_0x5ad90a[_0x76f4('0x33')]:_0x26c411['model'];if(_0xe744af['query'][_0x76f4('0x3e')]){_0x5ad90a['include']=[{'all':!![]}];}_0x5ad90a=_[_0x76f4('0x3b')]({},_0x5ad90a,_0xe744af[_0x76f4('0x3d')]);return db['ScreenRecording']['find'](_0x5ad90a)[_0x76f4('0x23')](handleEntityNotFound(_0x4f0d1a,null))[_0x76f4('0x23')](respondWithResult(_0x4f0d1a,null))[_0x76f4('0x45')](handleError(_0x4f0d1a,null));};exports[_0x76f4('0x46')]=function(_0x55e4cc,_0x9baa0f){return db[_0x76f4('0x29')][_0x76f4('0x46')](_0x55e4cc['body'],{})[_0x76f4('0x23')](respondWithResult(_0x9baa0f,0xc9))[_0x76f4('0x45')](handleError(_0x9baa0f,null));};exports['update']=function(_0x56d905,_0x4ab620){if(_0x56d905[_0x76f4('0x47')]['id']){delete _0x56d905[_0x76f4('0x47')]['id'];}delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x48')];delete _0x56d905['body'][_0x76f4('0x49')];delete _0x56d905['body'][_0x76f4('0x4a')];delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x4b')];return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x56d905[_0x76f4('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ab620,null))[_0x76f4('0x23')](saveUpdates(_0x56d905[_0x76f4('0x47')],null))[_0x76f4('0x23')](respondWithResult(_0x4ab620,null))[_0x76f4('0x45')](handleError(_0x4ab620,null));};exports[_0x76f4('0x4d')]=function(_0x479c4b,_0x1041da){return db['ScreenRecording'][_0x76f4('0x4d')]()[_0x76f4('0x23')](respondWithResult(_0x1041da,null))[_0x76f4('0x45')](handleError(_0x1041da,null));};exports['download']=function(_0x141b1c,_0x46c944,_0x3fc794){var _0x3bec16=require('../../components/encryptor');var _0x2028e9=![];var _0xf11e07={};if(_0x141b1c[_0x76f4('0x2f')][_0x76f4('0x2b')]&&_0x141b1c['query'][_0x76f4('0x2b')]==='uniqueid'){_0xf11e07[_0x76f4('0x4e')]=_0x141b1c[_0x76f4('0x43')]['id'];}else{_0xf11e07['id']=_0x141b1c['params']['id'];}return db['ScreenRecording'][_0x76f4('0x4c')]({'where':_0xf11e07,'attributes':['id',_0x76f4('0x4b')],'raw':!![]})[_0x76f4('0x23')](handleEntityNotFound(_0x46c944,null))['then'](function(_0x27ba06){if(_0x27ba06){var _0x15ec0f=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x27ba06[_0x76f4('0x4b')]);var _0x367238=util['format']('%s.cypher',_0x15ec0f);if(fs[_0x76f4('0x50')](_0x367238)){_0x2028e9=!![];return _0x3bec16[_0x76f4('0x51')](_0x367238,_0x15ec0f,config[_0x76f4('0x52')][_0x76f4('0x53')])[_0x76f4('0x23')](function(){return _0x27ba06;});}return _0x27ba06;}})[_0x76f4('0x23')](function(_0x97be11){if(_0x97be11){var _0x36a52a=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x97be11['value']);if(!fs[_0x76f4('0x50')](_0x36a52a)){throw new db[(_0x76f4('0x54'))][(_0x76f4('0x55'))](_0x76f4('0x56'));}if(_0x97be11['filename']){return _0x46c944['download'](_0x36a52a,_0x97be11[_0x76f4('0x57')]+path['extname'](_0x36a52a),function(){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}else{return _0x46c944['download'](_0x36a52a,function(_0x4285dd){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}}})[_0x76f4('0x45')](function(_0x3317a4){if(_0x3317a4['message']===_0x76f4('0x56')){_0x46c944[_0x76f4('0x1d')](0x194)[_0x76f4('0x28')](_0x76f4('0x59'));}else{return handleError(_0x46c944,null);}});};exports[_0x76f4('0x24')]=function(_0x2a6f19,_0x46245f){return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x2a6f19[_0x76f4('0x43')]['id']}})[_0x76f4('0x23')](function(_0x320a87){if(_[_0x76f4('0x5a')](_0x320a87)){throw new ReferenceError(_0x76f4('0x5b'));}return _0x320a87;})[_0x76f4('0x23')](function(_0x551d38){var _0x5724c3=path['join'](config[_0x76f4('0x5c')],_0x76f4('0x5d'),_0x551d38[_0x76f4('0x4b')]);logger['info'](_0x76f4('0x5e'),_0x5724c3);if(!_['isNil'](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger['info'](_0x76f4('0x5f')+_0x5724c3+_0x76f4('0x60'));fs[_0x76f4('0x61')](_0x5724c3);}_0x5724c3=_0x5724c3+_0x76f4('0x62');if(!_[_0x76f4('0x5a')](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger[_0x76f4('0x63')](_0x76f4('0x5f')+_0x5724c3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76f4('0x61')](_0x5724c3);}return _0x551d38;})['then'](function(_0x318fcb){if(!_0x318fcb)throw new InternalError();return _0x318fcb[_0x76f4('0x24')]();})[_0x76f4('0x23')](function(){_0x46245f[_0x76f4('0x1d')](0xcc)[_0x76f4('0x17')]();})[_0x76f4('0x45')](handleError(_0x46245f,null));}; \ No newline at end of file +var _0xb4c7=['rawAttributes','fieldName','type','format','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','params','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','root','ValidationError','download','filename','extname','unlink','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/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','ScreenRecording'];(function(_0x463683,_0x403c60){var _0x1c7fa1=function(_0x224c11){while(--_0x224c11){_0x463683['push'](_0x463683['shift']());}};_0x1c7fa1(++_0x403c60);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x184ab8,_0x560ed4){_0x184ab8=_0x184ab8-0x0;var _0x1a59e3=_0xb4c7[_0x184ab8];return _0x1a59e3;};'use strict';var emlformat=require(_0x7b4c('0x0'));var rimraf=require(_0x7b4c('0x1'));var zipdir=require(_0x7b4c('0x2'));var jsonpatch=require(_0x7b4c('0x3'));var rp=require(_0x7b4c('0x4'));var moment=require('moment');var BPromise=require(_0x7b4c('0x5'));var Mustache=require(_0x7b4c('0x6'));var util=require(_0x7b4c('0x7'));var path=require(_0x7b4c('0x8'));var sox=require(_0x7b4c('0x9'));var csv=require('to-csv');var ejs=require(_0x7b4c('0xa'));var fs=require('fs');var fs_extra=require(_0x7b4c('0xb'));var _=require(_0x7b4c('0xc'));var squel=require('squel');var crypto=require(_0x7b4c('0xd'));var jsforce=require(_0x7b4c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b4c('0xf'));var querystring=require(_0x7b4c('0x10'));var Papa=require(_0x7b4c('0x11'));var Redis=require(_0x7b4c('0x12'));var authService=require(_0x7b4c('0x13'));var qs=require(_0x7b4c('0x14'));var as=require(_0x7b4c('0x15'));var hardwareService=require(_0x7b4c('0x16'));var logger=require(_0x7b4c('0x17'))(_0x7b4c('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7b4c('0x19'));var db=require(_0x7b4c('0x1a'))['db'];function respondWithStatusCode(_0x38656b,_0x1722ad){_0x1722ad=_0x1722ad||0xcc;return function(_0x3e1558){if(_0x3e1558){return _0x38656b[_0x7b4c('0x1b')](_0x1722ad);}return _0x38656b[_0x7b4c('0x1c')](_0x1722ad)[_0x7b4c('0x1d')]();};}function respondWithResult(_0x25b90b,_0x387488){_0x387488=_0x387488||0xc8;return function(_0x593a19){if(_0x593a19){return _0x25b90b[_0x7b4c('0x1c')](_0x387488)[_0x7b4c('0x1e')](_0x593a19);}};}function respondWithFilteredResult(_0xdc71cd,_0x2a0e2f){return function(_0xa0a812){if(_0xa0a812){var _0x2471b3=typeof _0x2a0e2f[_0x7b4c('0x1f')]===_0x7b4c('0x20')&&typeof _0x2a0e2f['limit']===_0x7b4c('0x20');var _0xe71d88=_0xa0a812[_0x7b4c('0x21')];var _0x36c02a=_0x2471b3?0x0:_0x2a0e2f['offset'];var _0x3ce10c=_0x2471b3?_0xa0a812[_0x7b4c('0x21')]:_0x2a0e2f[_0x7b4c('0x1f')]+_0x2a0e2f[_0x7b4c('0x22')];var _0x2d4c72;if(_0x3ce10c>=_0xe71d88){_0x3ce10c=_0xe71d88;_0x2d4c72=0xc8;}else{_0x2d4c72=0xce;}_0xdc71cd[_0x7b4c('0x1c')](_0x2d4c72);return _0xdc71cd[_0x7b4c('0x23')](_0x7b4c('0x24'),_0x36c02a+'-'+_0x3ce10c+'/'+_0xe71d88)[_0x7b4c('0x1e')](_0xa0a812);}return null;};}function patchUpdates(_0x55e3df){return function(_0x1f06ec){try{jsonpatch[_0x7b4c('0x25')](_0x1f06ec,_0x55e3df,!![]);}catch(_0x11996d){return BPromise[_0x7b4c('0x26')](_0x11996d);}return _0x1f06ec[_0x7b4c('0x27')]();};}function saveUpdates(_0x168ac9,_0x176704){return function(_0x3d4826){if(_0x3d4826){return _0x3d4826[_0x7b4c('0x28')](_0x168ac9)[_0x7b4c('0x29')](function(_0x5eec1e){return _0x5eec1e;});}return null;};}function removeEntity(_0x45438c,_0x4350c9){return function(_0x276271){if(_0x276271){return _0x276271[_0x7b4c('0x2a')]()[_0x7b4c('0x29')](function(){_0x45438c[_0x7b4c('0x1c')](0xcc)[_0x7b4c('0x1d')]();});}};}function handleEntityNotFound(_0x459eb4,_0x1f311e){return function(_0x1a69db){if(!_0x1a69db){_0x459eb4[_0x7b4c('0x1b')](0x194);}return _0x1a69db;};}function handleError(_0x257da2,_0x316e5f){_0x316e5f=_0x316e5f||0x1f4;return function(_0x501f75){logger[_0x7b4c('0x2b')](_0x501f75[_0x7b4c('0x2c')]);if(_0x501f75[_0x7b4c('0x2d')]){delete _0x501f75[_0x7b4c('0x2d')];}_0x257da2[_0x7b4c('0x1c')](_0x316e5f)[_0x7b4c('0x2e')](_0x501f75);};}exports[_0x7b4c('0x2f')]=function(_0x2552f9,_0x3e4a46){var _0x9a799b={},_0x3585cd={},_0x130ace={'count':0x0,'rows':[]};var _0x3544bc=_[_0x7b4c('0x30')](db[_0x7b4c('0x31')][_0x7b4c('0x32')],function(_0x1d0724){return{'name':_0x1d0724[_0x7b4c('0x33')],'type':_0x1d0724[_0x7b4c('0x34')]['key']};});_0x3585cd['model']=_['differenceBy'](_[_0x7b4c('0x30')](_0x3544bc,_0x7b4c('0x2d')),[_0x7b4c('0x35')]);_0x3585cd[_0x7b4c('0x36')]=_['keys'](_0x2552f9[_0x7b4c('0x36')]);_0x3585cd[_0x7b4c('0x37')]=_['intersection'](_0x3585cd[_0x7b4c('0x38')],_0x3585cd['query']);_0x9a799b[_0x7b4c('0x39')]=_[_0x7b4c('0x3a')](_0x3585cd[_0x7b4c('0x38')],qs['fields'](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x3b')]));_0x9a799b['attributes']=_0x9a799b[_0x7b4c('0x39')][_0x7b4c('0x3c')]?_0x9a799b[_0x7b4c('0x39')]:_0x3585cd[_0x7b4c('0x38')];if(!_0x2552f9['query']['hasOwnProperty'](_0x7b4c('0x3d'))){_0x9a799b[_0x7b4c('0x22')]=qs['limit'](_0x2552f9[_0x7b4c('0x36')]['limit']);_0x9a799b['offset']=qs[_0x7b4c('0x1f')](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x1f')]);}_0x9a799b[_0x7b4c('0x3e')]=qs['sort'](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x3f')]);_0x9a799b[_0x7b4c('0x40')]=qs[_0x7b4c('0x37')](_[_0x7b4c('0x41')](_0x2552f9[_0x7b4c('0x36')],_0x3585cd[_0x7b4c('0x37')]),_0x3544bc);if(_0x2552f9['query']['filter']){_0x9a799b[_0x7b4c('0x40')]=_[_0x7b4c('0x42')](_0x9a799b[_0x7b4c('0x40')],{'$or':_[_0x7b4c('0x30')](_0x3544bc,function(_0xb8486d){if(_0xb8486d['type']!==_0x7b4c('0x43')){var _0x902367={};_0x902367[_0xb8486d[_0x7b4c('0x2d')]]={'$like':'%'+_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x44')]+'%'};return _0x902367;}})});}_0x9a799b=_[_0x7b4c('0x42')]({},_0x9a799b,_0x2552f9[_0x7b4c('0x45')]);var _0x1080fc={'where':_0x9a799b[_0x7b4c('0x40')]};return db['ScreenRecording'][_0x7b4c('0x21')](_0x1080fc)['then'](function(_0x2a3a74){_0x130ace['count']=_0x2a3a74;if(_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x46')]){_0x9a799b['include']=[{'all':!![]}];}return db['ScreenRecording'][_0x7b4c('0x47')](_0x9a799b);})[_0x7b4c('0x29')](function(_0x1def44){_0x130ace[_0x7b4c('0x48')]=_0x1def44;return _0x130ace;})['then'](respondWithFilteredResult(_0x3e4a46,_0x9a799b))[_0x7b4c('0x49')](handleError(_0x3e4a46,null));};exports[_0x7b4c('0x4a')]=function(_0x100774,_0x5d4ed8){var _0x45ad59={'raw':![],'where':{'id':_0x100774['params']['id']}},_0x4b4757={};_0x4b4757[_0x7b4c('0x38')]=_['keys'](db[_0x7b4c('0x31')][_0x7b4c('0x32')]);_0x4b4757[_0x7b4c('0x36')]=_[_0x7b4c('0x4b')](_0x100774[_0x7b4c('0x36')]);_0x4b4757[_0x7b4c('0x37')]=_[_0x7b4c('0x3a')](_0x4b4757[_0x7b4c('0x38')],_0x4b4757[_0x7b4c('0x36')]);_0x45ad59['attributes']=_[_0x7b4c('0x3a')](_0x4b4757['model'],qs['fields'](_0x100774[_0x7b4c('0x36')][_0x7b4c('0x3b')]));_0x45ad59['attributes']=_0x45ad59['attributes'][_0x7b4c('0x3c')]?_0x45ad59[_0x7b4c('0x39')]:_0x4b4757[_0x7b4c('0x38')];if(_0x100774[_0x7b4c('0x36')][_0x7b4c('0x46')]){_0x45ad59[_0x7b4c('0x4c')]=[{'all':!![]}];}_0x45ad59=_[_0x7b4c('0x42')]({},_0x45ad59,_0x100774[_0x7b4c('0x45')]);return db['ScreenRecording'][_0x7b4c('0x4d')](_0x45ad59)[_0x7b4c('0x29')](handleEntityNotFound(_0x5d4ed8,null))[_0x7b4c('0x29')](respondWithResult(_0x5d4ed8,null))[_0x7b4c('0x49')](handleError(_0x5d4ed8,null));};exports[_0x7b4c('0x4e')]=function(_0x379f15,_0x11a6f9){return db[_0x7b4c('0x31')][_0x7b4c('0x4e')](_0x379f15['body'],{})['then'](respondWithResult(_0x11a6f9,0xc9))[_0x7b4c('0x49')](handleError(_0x11a6f9,null));};exports[_0x7b4c('0x28')]=function(_0x97eadf,_0x5d4192){if(_0x97eadf[_0x7b4c('0x4f')]['id']){delete _0x97eadf[_0x7b4c('0x4f')]['id'];}delete _0x97eadf['body'][_0x7b4c('0x50')];delete _0x97eadf['body'][_0x7b4c('0x51')];delete _0x97eadf['body'][_0x7b4c('0x52')];delete _0x97eadf['body'][_0x7b4c('0x53')];return db[_0x7b4c('0x31')]['find']({'where':{'id':_0x97eadf['params']['id']}})[_0x7b4c('0x29')](handleEntityNotFound(_0x5d4192,null))[_0x7b4c('0x29')](saveUpdates(_0x97eadf[_0x7b4c('0x4f')],null))['then'](respondWithResult(_0x5d4192,null))['catch'](handleError(_0x5d4192,null));};exports[_0x7b4c('0x54')]=function(_0x1c118a,_0x4cbf1b){return db['ScreenRecording'][_0x7b4c('0x54')]()[_0x7b4c('0x29')](respondWithResult(_0x4cbf1b,null))[_0x7b4c('0x49')](handleError(_0x4cbf1b,null));};exports['download']=function(_0x1d017d,_0x2f009a,_0x4aaf57){var _0x484e80=require(_0x7b4c('0x55'));var _0x4d8491=![];var _0x59db20={};if(_0x1d017d[_0x7b4c('0x36')]['type']&&_0x1d017d['query'][_0x7b4c('0x34')]===_0x7b4c('0x56')){_0x59db20[_0x7b4c('0x56')]=_0x1d017d[_0x7b4c('0x57')]['id'];}else{_0x59db20['id']=_0x1d017d['params']['id'];}return db['ScreenRecording'][_0x7b4c('0x4d')]({'where':_0x59db20,'attributes':['id',_0x7b4c('0x53')],'raw':!![]})[_0x7b4c('0x29')](handleEntityNotFound(_0x2f009a,null))['then'](function(_0x255262){if(_0x255262){var _0x3d81fb=path[_0x7b4c('0x58')](config['root'],_0x7b4c('0x59'),_0x255262[_0x7b4c('0x53')]);var _0x529803=util[_0x7b4c('0x35')](_0x7b4c('0x5a'),_0x3d81fb);if(fs[_0x7b4c('0x5b')](_0x529803)){_0x4d8491=!![];return _0x484e80[_0x7b4c('0x5c')](_0x529803,_0x3d81fb,config[_0x7b4c('0x5d')][_0x7b4c('0x5e')])[_0x7b4c('0x29')](function(){return _0x255262;});}return _0x255262;}})['then'](function(_0x4443d0){if(_0x4443d0){var _0x2dc79a=path['join'](config[_0x7b4c('0x5f')],_0x7b4c('0x59'),_0x4443d0[_0x7b4c('0x53')]);if(!fs[_0x7b4c('0x5b')](_0x2dc79a)){throw new db['Sequelize'][(_0x7b4c('0x60'))]('ScreenRecording\x20not\x20found');}if(_0x4443d0['filename']){return _0x2f009a[_0x7b4c('0x61')](_0x2dc79a,_0x4443d0[_0x7b4c('0x62')]+path[_0x7b4c('0x63')](_0x2dc79a),function(){if(_0x4d8491){fs[_0x7b4c('0x64')](_0x2dc79a);}});}else{return _0x2f009a[_0x7b4c('0x61')](_0x2dc79a,function(_0x5b24f6){if(_0x4d8491){fs['unlink'](_0x2dc79a);}});}}})[_0x7b4c('0x49')](function(_0x3c84af){if(_0x3c84af[_0x7b4c('0x65')]==='ScreenRecording\x20not\x20found'){_0x2f009a[_0x7b4c('0x1c')](0x194)[_0x7b4c('0x2e')](_0x7b4c('0x66'));}else{return handleError(_0x2f009a,null);}});};exports['destroy']=function(_0x222b47,_0x3b2144){return db[_0x7b4c('0x31')]['find']({'where':{'id':_0x222b47[_0x7b4c('0x57')]['id']}})[_0x7b4c('0x29')](function(_0x4ac03e){if(_[_0x7b4c('0x67')](_0x4ac03e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4ac03e;})[_0x7b4c('0x29')](function(_0x11ae6e){var _0x3a3713=path['join'](config['root'],_0x7b4c('0x59'),_0x11ae6e[_0x7b4c('0x53')]);logger[_0x7b4c('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x3a3713);if(!_[_0x7b4c('0x67')](_0x11ae6e['value'])&&fs[_0x7b4c('0x5b')](_0x3a3713)){logger[_0x7b4c('0x68')](_0x7b4c('0x69')+_0x3a3713+_0x7b4c('0x6a'));fs[_0x7b4c('0x6b')](_0x3a3713);}_0x3a3713=_0x3a3713+'.cypher';if(!_[_0x7b4c('0x67')](_0x11ae6e[_0x7b4c('0x53')])&&fs['existsSync'](_0x3a3713)){logger[_0x7b4c('0x68')](_0x7b4c('0x69')+_0x3a3713+_0x7b4c('0x6a'));fs[_0x7b4c('0x6b')](_0x3a3713);}return _0x11ae6e;})[_0x7b4c('0x29')](function(_0x2befd7){if(!_0x2befd7)throw new InternalError();return _0x2befd7[_0x7b4c('0x2a')]();})[_0x7b4c('0x29')](function(){_0x3b2144['status'](0xcc)[_0x7b4c('0x1d')]();})[_0x7b4c('0x49')](handleError(_0x3b2144,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 85784db..876dab6 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 _0x468a=['api','bluebird','request-promise','path','rimraf','../../config/environment','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger'];(function(_0x31e6fe,_0x39c227){var _0x1ec3f2=function(_0x58c8cd){while(--_0x58c8cd){_0x31e6fe['push'](_0x31e6fe['shift']());}};_0x1ec3f2(++_0x39c227);}(_0x468a,0xda));var _0xa468=function(_0x111640,_0x1f0ca7){_0x111640=_0x111640-0x0;var _0x251af3=_0x468a[_0x111640];return _0x251af3;};'use strict';var _=require(_0xa468('0x0'));var util=require(_0xa468('0x1'));var logger=require(_0xa468('0x2'))(_0xa468('0x3'));var moment=require('moment');var BPromise=require(_0xa468('0x4'));var rp=require(_0xa468('0x5'));var fs=require('fs');var path=require(_0xa468('0x6'));var rimraf=require(_0xa468('0x7'));var config=require(_0xa468('0x8'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x23d17d,_0x171b53){return _0x23d17d[_0xa468('0x9')](_0xa468('0xa'),attributes,{'tableName':_0xa468('0xb'),'paranoid':![],'indexes':[{'name':_0xa468('0xc'),'fields':[_0xa468('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x162c=['../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x54cf6d,_0x3e256e){var _0x2f3cef=function(_0x575817){while(--_0x575817){_0x54cf6d['push'](_0x54cf6d['shift']());}};_0x2f3cef(++_0x3e256e);}(_0x162c,0x180));var _0xc162=function(_0x411df2,_0x223016){_0x411df2=_0x411df2-0x0;var _0x5a71aa=_0x162c[_0x411df2];return _0x5a71aa;};'use strict';var _=require(_0xc162('0x0'));var util=require(_0xc162('0x1'));var logger=require(_0xc162('0x2'))('api');var moment=require(_0xc162('0x3'));var BPromise=require(_0xc162('0x4'));var rp=require(_0xc162('0x5'));var fs=require('fs');var path=require(_0xc162('0x6'));var rimraf=require(_0xc162('0x7'));var config=require(_0xc162('0x8'));var attributes=require(_0xc162('0x9'));module[_0xc162('0xa')]=function(_0x23e669,_0x3e9e4b){return _0x23e669[_0xc162('0xb')]('ScreenRecording',attributes,{'tableName':_0xc162('0xc'),'paranoid':![],'indexes':[{'name':_0xc162('0xd'),'fields':[_0xc162('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 9ae6e3c..1118bcd 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 _0xaed0=['http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1ecc9f,_0x45db8f){var _0x264b8e=function(_0x5d0042){while(--_0x5d0042){_0x1ecc9f['push'](_0x1ecc9f['shift']());}};_0x264b8e(++_0x45db8f);}(_0xaed0,0x1ae));var _0x0aed=function(_0x404d8f,_0xb7ddb8){_0x404d8f=_0x404d8f-0x0;var _0x599a8c=_0xaed0[_0x404d8f];return _0x599a8c;};'use strict';var _=require(_0x0aed('0x0'));var util=require(_0x0aed('0x1'));var moment=require(_0x0aed('0x2'));var BPromise=require(_0x0aed('0x3'));var rs=require(_0x0aed('0x4'));var fs=require('fs');var Redis=require(_0x0aed('0x5'));var db=require(_0x0aed('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0aed('0x7'))(_0x0aed('0x8'));var config=require(_0x0aed('0x9'));var jayson=require(_0x0aed('0xa'));var client=jayson[_0x0aed('0xb')][_0x0aed('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf397a3,_0x5bdbd1,_0x5a74c8){return new BPromise(function(_0xc67776,_0x46fc70){return client[_0x0aed('0xd')](_0xf397a3,_0x5a74c8)[_0x0aed('0xe')](function(_0xaa222c){logger[_0x0aed('0xf')](_0x0aed('0x10'),_0x5bdbd1,_0x0aed('0x11'));logger[_0x0aed('0x12')](_0x0aed('0x13'),_0x5bdbd1,_0x0aed('0x11'),JSON[_0x0aed('0x14')](_0xaa222c));if(_0xaa222c[_0x0aed('0x15')]){if(_0xaa222c[_0x0aed('0x15')][_0x0aed('0x16')]===0x1f4){logger[_0x0aed('0x15')](_0x0aed('0x10'),_0x5bdbd1,_0xaa222c[_0x0aed('0x15')]['message']);return _0x46fc70(_0xaa222c[_0x0aed('0x15')]['message']);}logger[_0x0aed('0x15')](_0x0aed('0x10'),_0x5bdbd1,_0xaa222c[_0x0aed('0x15')][_0x0aed('0x17')]);return _0xc67776(_0xaa222c['error'][_0x0aed('0x17')]);}else{logger['info'](_0x0aed('0x10'),_0x5bdbd1,'request\x20sent');_0xc67776(_0xaa222c[_0x0aed('0x18')]['message']);}})[_0x0aed('0x19')](function(_0x5951c0){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x5bdbd1,_0x5951c0);_0x46fc70(_0x5951c0);});});} \ No newline at end of file +var _0xa8ce=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util'];(function(_0x5389fa,_0x42f874){var _0x3bdc39=function(_0x16f8d1){while(--_0x16f8d1){_0x5389fa['push'](_0x5389fa['shift']());}};_0x3bdc39(++_0x42f874);}(_0xa8ce,0xd1));var _0xea8c=function(_0x18c211,_0x5f45a3){_0x18c211=_0x18c211-0x0;var _0x513107=_0xa8ce[_0x18c211];return _0x513107;};'use strict';var _=require('lodash');var util=require(_0xea8c('0x0'));var moment=require(_0xea8c('0x1'));var BPromise=require('bluebird');var rs=require(_0xea8c('0x2'));var fs=require('fs');var Redis=require(_0xea8c('0x3'));var db=require(_0xea8c('0x4'))['db'];var utils=require(_0xea8c('0x5'));var logger=require('../../config/logger')(_0xea8c('0x6'));var config=require(_0xea8c('0x7'));var jayson=require(_0xea8c('0x8'));var client=jayson[_0xea8c('0x9')][_0xea8c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20033c,_0x19c30c,_0x5ab228){return new BPromise(function(_0x574230,_0x4d6535){return client['request'](_0x20033c,_0x5ab228)[_0xea8c('0xb')](function(_0x3d7f90){logger[_0xea8c('0xc')](_0xea8c('0xd'),_0x19c30c,_0xea8c('0xe'));logger[_0xea8c('0xf')](_0xea8c('0x10'),_0x19c30c,_0xea8c('0xe'),JSON[_0xea8c('0x11')](_0x3d7f90));if(_0x3d7f90[_0xea8c('0x12')]){if(_0x3d7f90[_0xea8c('0x12')]['code']===0x1f4){logger[_0xea8c('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x19c30c,_0x3d7f90[_0xea8c('0x12')]['message']);return _0x4d6535(_0x3d7f90[_0xea8c('0x12')][_0xea8c('0x13')]);}logger['error'](_0xea8c('0xd'),_0x19c30c,_0x3d7f90[_0xea8c('0x12')][_0xea8c('0x13')]);return _0x574230(_0x3d7f90[_0xea8c('0x12')][_0xea8c('0x13')]);}else{logger[_0xea8c('0xc')](_0xea8c('0xd'),_0x19c30c,_0xea8c('0xe'));_0x574230(_0x3d7f90['result'][_0xea8c('0x13')]);}})[_0xea8c('0x14')](function(_0x1c3f94){logger['error'](_0xea8c('0xd'),_0x19c30c,_0x1c3f94);_0x4d6535(_0x1c3f94);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 2d6472e..c416c26 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 _0xfe5b=['isAuthenticated','index','/now','getDate','/:id','show','getLogo','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','format','%s%s','extname','post','addLogo','server/files/images/logos/','logologin','originalname','/:id/logo_login','single','file','addPreferred','favicon','addFavicon','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get'];(function(_0x57cd25,_0x45e142){var _0xbae36f=function(_0x179928){while(--_0x179928){_0x57cd25['push'](_0x57cd25['shift']());}};_0xbae36f(++_0x45e142);}(_0xfe5b,0x1b8));var _0xbfe5=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xfe5b[_0x5416db];return _0x243e35;};'use strict';var multer=require(_0xbfe5('0x0'));var util=require('util');var path=require(_0xbfe5('0x1'));var timeout=require(_0xbfe5('0x2'));var express=require(_0xbfe5('0x3'));var router=express[_0xbfe5('0x4')]();var fs_extra=require(_0xbfe5('0x5'));var auth=require(_0xbfe5('0x6'));var interaction=require(_0xbfe5('0x7'));var config=require(_0xbfe5('0x8'));var controller=require(_0xbfe5('0x9'));router[_0xbfe5('0xa')]('/',auth[_0xbfe5('0xb')](),controller[_0xbfe5('0xc')]);router[_0xbfe5('0xa')](_0xbfe5('0xd'),controller[_0xbfe5('0xe')]);router[_0xbfe5('0xa')](_0xbfe5('0xf'),controller[_0xbfe5('0x10')]);router[_0xbfe5('0xa')]('/:id/logo',controller[_0xbfe5('0x11')]);router[_0xbfe5('0xa')]('/:id/logo_login',controller['getLogoLogin']);router['get'](_0xbfe5('0x12'),controller['gdpr']);router['get'](_0xbfe5('0x13'),controller[_0xbfe5('0x14')]);router[_0xbfe5('0xa')](_0xbfe5('0x15'),controller[_0xbfe5('0x16')]);var upload=multer({'storage':multer[_0xbfe5('0x17')]({'destination':function(_0xea1a82,_0x1d6838,_0x3e3e16){_0x3e3e16(null,path[_0xbfe5('0x18')](config[_0xbfe5('0x19')],'server/files/images/logos/'));},'filename':function(_0x528d7e,_0x35ea0e,_0x5416ae){_0x5416ae(null,util[_0xbfe5('0x1a')](_0xbfe5('0x1b'),'logo',path[_0xbfe5('0x1c')](_0x35ea0e['originalname'])));}})});router[_0xbfe5('0x1d')]('/:id/logo',upload['single']('file'),controller[_0xbfe5('0x1e')]);var upload=multer({'storage':multer[_0xbfe5('0x17')]({'destination':function(_0x249967,_0x236a69,_0x2b470a){_0x2b470a(null,path['join'](config[_0xbfe5('0x19')],_0xbfe5('0x1f')));},'filename':function(_0x3f1254,_0xa02ca0,_0x181ed6){_0x181ed6(null,util[_0xbfe5('0x1a')]('%s%s',_0xbfe5('0x20'),path[_0xbfe5('0x1c')](_0xa02ca0[_0xbfe5('0x21')])));}})});router[_0xbfe5('0x1d')](_0xbfe5('0x22'),upload[_0xbfe5('0x23')](_0xbfe5('0x24')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x19a37b,_0x2069f5,_0x489925){_0x489925(null,path['join'](config[_0xbfe5('0x19')],_0xbfe5('0x1f')));},'filename':function(_0x350e3f,_0x3ce183,_0x54ef98){_0x54ef98(null,util['format'](_0xbfe5('0x1b'),'preferred',path[_0xbfe5('0x1c')](_0x3ce183[_0xbfe5('0x21')])));}})});router[_0xbfe5('0x1d')]('/:id/preferred',upload['single'](_0xbfe5('0x24')),controller[_0xbfe5('0x25')]);var upload=multer({'storage':multer[_0xbfe5('0x17')]({'destination':function(_0x10a093,_0x30236c,_0x345d70){_0x345d70(null,path[_0xbfe5('0x18')](config[_0xbfe5('0x19')],'server/files/images/logos/'));},'filename':function(_0x198119,_0x203018,_0x2c736f){_0x2c736f(null,util[_0xbfe5('0x1a')](_0xbfe5('0x1b'),_0xbfe5('0x26'),path[_0xbfe5('0x1c')](_0x203018['originalname'])));}})});router['post'](_0xbfe5('0x15'),upload[_0xbfe5('0x23')](_0xbfe5('0x24')),controller[_0xbfe5('0x27')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xbfe5('0x28')]);module['exports']=router; \ No newline at end of file +var _0xe72f=['root','server/files/images/logos/','%s%s','logo','extname','originalname','post','file','format','logologin','addLogoLogin','preferred','single','favicon','update','exports','multer','connect-timeout','express','../../components/auth/service','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join'];(function(_0x5e643d,_0x44df36){var _0x50e3aa=function(_0x3e2f53){while(--_0x3e2f53){_0x5e643d['push'](_0x5e643d['shift']());}};_0x50e3aa(++_0x44df36);}(_0xe72f,0x128));var _0xfe72=function(_0x43f7ff,_0x5ae219){_0x43f7ff=_0x43f7ff-0x0;var _0x4068f9=_0xe72f[_0x43f7ff];return _0x4068f9;};'use strict';var multer=require(_0xfe72('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfe72('0x1'));var express=require(_0xfe72('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfe72('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfe72('0x4'));router[_0xfe72('0x5')]('/',auth[_0xfe72('0x6')](),controller[_0xfe72('0x7')]);router[_0xfe72('0x5')](_0xfe72('0x8'),controller[_0xfe72('0x9')]);router['get'](_0xfe72('0xa'),controller[_0xfe72('0xb')]);router[_0xfe72('0x5')](_0xfe72('0xc'),controller[_0xfe72('0xd')]);router[_0xfe72('0x5')](_0xfe72('0xe'),controller[_0xfe72('0xf')]);router[_0xfe72('0x5')](_0xfe72('0x10'),controller[_0xfe72('0x11')]);router['get'](_0xfe72('0x12'),controller[_0xfe72('0x13')]);router['get'](_0xfe72('0x14'),controller[_0xfe72('0x15')]);var upload=multer({'storage':multer[_0xfe72('0x16')]({'destination':function(_0x4924ba,_0x37d149,_0x3dc5fd){_0x3dc5fd(null,path[_0xfe72('0x17')](config[_0xfe72('0x18')],_0xfe72('0x19')));},'filename':function(_0x439b0f,_0x9e507d,_0x29043b){_0x29043b(null,util['format'](_0xfe72('0x1a'),_0xfe72('0x1b'),path[_0xfe72('0x1c')](_0x9e507d[_0xfe72('0x1d')])));}})});router[_0xfe72('0x1e')](_0xfe72('0xc'),upload['single'](_0xfe72('0x1f')),controller['addLogo']);var upload=multer({'storage':multer[_0xfe72('0x16')]({'destination':function(_0x175f6c,_0x370913,_0x258915){_0x258915(null,path[_0xfe72('0x17')](config[_0xfe72('0x18')],'server/files/images/logos/'));},'filename':function(_0x20efe,_0x1c2f29,_0x5ace65){_0x5ace65(null,util[_0xfe72('0x20')]('%s%s',_0xfe72('0x21'),path[_0xfe72('0x1c')](_0x1c2f29[_0xfe72('0x1d')])));}})});router['post']('/:id/logo_login',upload['single']('file'),controller[_0xfe72('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1eb2bf,_0x3cdfa3,_0x565dd4){_0x565dd4(null,path[_0xfe72('0x17')](config['root'],'server/files/images/logos/'));},'filename':function(_0x204adf,_0x51ce58,_0x2ea2ef){_0x2ea2ef(null,util[_0xfe72('0x20')](_0xfe72('0x1a'),_0xfe72('0x23'),path['extname'](_0x51ce58[_0xfe72('0x1d')])));}})});router[_0xfe72('0x1e')](_0xfe72('0x12'),upload[_0xfe72('0x24')](_0xfe72('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer[_0xfe72('0x16')]({'destination':function(_0x519525,_0x3671af,_0x21a145){_0x21a145(null,path[_0xfe72('0x17')](config[_0xfe72('0x18')],'server/files/images/logos/'));},'filename':function(_0x418d20,_0x3e3030,_0x635eb3){_0x635eb3(null,util[_0xfe72('0x20')]('%s%s',_0xfe72('0x25'),path[_0xfe72('0x1c')](_0x3e3030[_0xfe72('0x1d')])));}})});router[_0xfe72('0x1e')](_0xfe72('0x14'),upload[_0xfe72('0x24')](_0xfe72('0x1f')),controller['addFavicon']);router['put'](_0xfe72('0xa'),auth[_0xfe72('0x6')](),controller[_0xfe72('0x26')]);module[_0xfe72('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 25def9b..1fce5f1 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x56b540,_0x4faa5d){var _0xcd691c=function(_0x24ddf1){while(--_0x24ddf1){_0x56b540['push'](_0x56b540['shift']());}};_0xcd691c(++_0x4faa5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x1bf235,_0xb561cd){var _0x4c3e0b=function(_0x1ed6f2){while(--_0x1ed6f2){_0x1bf235['push'](_0x1bf235['shift']());}};_0x4c3e0b(++_0xb561cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 3f4bac9..98ab668 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 _0xe5d5=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','client','http','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','Setting','includeAll','findAll','rows','show','params','include','find','body','file','filename','logo','catch','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','join','root','toLower','default_logo.svg','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','existsSync','default_loginLogo.svg','gdpr','addPreferred','defaultFavicon','default','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x70371f,_0x5ca4ca){var _0x5e63e1=function(_0x1ed30b){while(--_0x1ed30b){_0x70371f['push'](_0x70371f['shift']());}};_0x5e63e1(++_0x5ca4ca);}(_0xe5d5,0x156));var _0x5e5d=function(_0xc7cd96,_0x34229c){_0xc7cd96=_0xc7cd96-0x0;var _0xf4070=_0xe5d5[_0xc7cd96];return _0xf4070;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5e5d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e5d('0x1'));var moment=require('moment');var BPromise=require(_0x5e5d('0x2'));var Mustache=require('mustache');var util=require(_0x5e5d('0x3'));var path=require(_0x5e5d('0x4'));var sox=require(_0x5e5d('0x5'));var csv=require(_0x5e5d('0x6'));var ejs=require(_0x5e5d('0x7'));var fs=require('fs');var fs_extra=require(_0x5e5d('0x8'));var _=require(_0x5e5d('0x9'));var squel=require(_0x5e5d('0xa'));var crypto=require(_0x5e5d('0xb'));var jsforce=require(_0x5e5d('0xc'));var deskjs=require(_0x5e5d('0xd'));var toCsv=require(_0x5e5d('0x6'));var querystring=require(_0x5e5d('0xe'));var Papa=require(_0x5e5d('0xf'));var Redis=require('ioredis');var authService=require(_0x5e5d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5e5d('0x11'));var hardwareService=require(_0x5e5d('0x12'));var logger=require('../../config/logger')(_0x5e5d('0x13'));var utils=require(_0x5e5d('0x14'));var config=require(_0x5e5d('0x15'));var licenseUtil=require(_0x5e5d('0x16'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x5e5d('0x17')][_0x5e5d('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x51018d,_0x2a743d,_0x2cf150,_0x5a4474){return new BPromise(function(_0x42f1f8,_0x3402cf){var _0x5a5258=_0x5a4474||client;return _0x5a5258['request'](_0x51018d,_0x2cf150)['then'](function(_0x1a3e5c){logger[_0x5e5d('0x19')](_0x5e5d('0x1a'),_0x2a743d,_0x5e5d('0x1b'));logger['debug'](_0x5e5d('0x1c'),_0x2a743d,_0x5e5d('0x1b'),JSON[_0x5e5d('0x1d')](_0x1a3e5c));if(_0x1a3e5c[_0x5e5d('0x1e')]){if(_0x1a3e5c[_0x5e5d('0x1e')][_0x5e5d('0x1f')]===0x1f4){logger[_0x5e5d('0x1e')](_0x5e5d('0x1a'),_0x2a743d,_0x1a3e5c['error'][_0x5e5d('0x20')]);return _0x3402cf(_0x1a3e5c[_0x5e5d('0x1e')][_0x5e5d('0x20')]);}logger[_0x5e5d('0x1e')](_0x5e5d('0x1a'),_0x2a743d,_0x1a3e5c[_0x5e5d('0x1e')]['message']);return _0x42f1f8(_0x1a3e5c[_0x5e5d('0x1e')]['message']);}else{logger[_0x5e5d('0x19')](_0x5e5d('0x1a'),_0x2a743d,_0x5e5d('0x1b'));_0x42f1f8(_0x1a3e5c['result'][_0x5e5d('0x20')]);}})['catch'](function(_0x35b65a){logger[_0x5e5d('0x1e')](_0x5e5d('0x1a'),_0x2a743d,_0x35b65a);_0x3402cf(_0x35b65a);});});}function respondWithStatusCode(_0x49a558,_0x49d2e5){_0x49d2e5=_0x49d2e5||0xcc;return function(_0x271af4){if(_0x271af4){return _0x49a558[_0x5e5d('0x21')](_0x49d2e5);}return _0x49a558['status'](_0x49d2e5)['end']();};}function respondWithResult(_0x28620d,_0x4063d5){_0x4063d5=_0x4063d5||0xc8;return function(_0xd466f7){if(_0xd466f7){return _0x28620d['status'](_0x4063d5)[_0x5e5d('0x22')](_0xd466f7);}};}function respondWithFilteredResult(_0x4de26a,_0x477d54){return function(_0x4ed6e5){if(_0x4ed6e5){var _0x15abf2=typeof _0x477d54[_0x5e5d('0x23')]===_0x5e5d('0x24')&&typeof _0x477d54[_0x5e5d('0x25')]===_0x5e5d('0x24');var _0x4254c6=_0x4ed6e5[_0x5e5d('0x26')];var _0x56b166=_0x15abf2?0x0:_0x477d54[_0x5e5d('0x23')];var _0x29a123=_0x15abf2?_0x4ed6e5[_0x5e5d('0x26')]:_0x477d54[_0x5e5d('0x23')]+_0x477d54[_0x5e5d('0x25')];var _0x45d9f8;if(_0x29a123>=_0x4254c6){_0x29a123=_0x4254c6;_0x45d9f8=0xc8;}else{_0x45d9f8=0xce;}_0x4de26a[_0x5e5d('0x27')](_0x45d9f8);return _0x4de26a[_0x5e5d('0x28')](_0x5e5d('0x29'),_0x56b166+'-'+_0x29a123+'/'+_0x4254c6)['json'](_0x4ed6e5);}return null;};}function patchUpdates(_0x34d678){return function(_0x4ddd70){try{jsonpatch['apply'](_0x4ddd70,_0x34d678,!![]);}catch(_0x1e715b){return BPromise[_0x5e5d('0x2a')](_0x1e715b);}return _0x4ddd70[_0x5e5d('0x2b')]();};}function saveUpdates(_0x2e788f,_0x45f424){return function(_0x4a54a0){if(_0x4a54a0){return _0x4a54a0[_0x5e5d('0x2c')](_0x2e788f)[_0x5e5d('0x2d')](function(_0x33b5fd){return _0x33b5fd;});}return null;};}function removeEntity(_0x409b10,_0x230198){return function(_0x14ea2e){if(_0x14ea2e){return _0x14ea2e[_0x5e5d('0x2e')]()['then'](function(){_0x409b10[_0x5e5d('0x27')](0xcc)[_0x5e5d('0x2f')]();});}};}function handleEntityNotFound(_0x4a7eac,_0x53ad07){return function(_0x1d9887){if(!_0x1d9887){_0x4a7eac[_0x5e5d('0x21')](0x194);}return _0x1d9887;};}function handleError(_0x3dfe39,_0x1c4dea){_0x1c4dea=_0x1c4dea||0x1f4;return function(_0xd220d1){logger[_0x5e5d('0x1e')](_0xd220d1['stack']);if(_0xd220d1[_0x5e5d('0x30')]){delete _0xd220d1['name'];}_0x3dfe39[_0x5e5d('0x27')](_0x1c4dea)[_0x5e5d('0x31')](_0xd220d1);};}exports[_0x5e5d('0x32')]=function(_0x3f1721,_0x12d758){var _0x5ba035={},_0x1301ef={},_0xf68677={'count':0x0,'rows':[]};var _0x49d6f8=_[_0x5e5d('0x33')](db['Setting'][_0x5e5d('0x34')],function(_0x20516e){return{'name':_0x20516e[_0x5e5d('0x35')],'type':_0x20516e[_0x5e5d('0x36')][_0x5e5d('0x37')]};});_0x1301ef[_0x5e5d('0x38')]=_[_0x5e5d('0x33')](_0x49d6f8,_0x5e5d('0x30'));_0x1301ef[_0x5e5d('0x39')]=_[_0x5e5d('0x3a')](_0x3f1721[_0x5e5d('0x39')]);_0x1301ef[_0x5e5d('0x3b')]=_['intersection'](_0x1301ef[_0x5e5d('0x38')],_0x1301ef[_0x5e5d('0x39')]);_0x5ba035[_0x5e5d('0x3c')]=_[_0x5e5d('0x3d')](_0x1301ef[_0x5e5d('0x38')],qs[_0x5e5d('0x3e')](_0x3f1721['query'][_0x5e5d('0x3e')]));_0x5ba035[_0x5e5d('0x3c')]=_0x5ba035['attributes'][_0x5e5d('0x3f')]?_0x5ba035[_0x5e5d('0x3c')]:_0x1301ef[_0x5e5d('0x38')];if(!_0x3f1721[_0x5e5d('0x39')][_0x5e5d('0x40')](_0x5e5d('0x41'))){_0x5ba035['limit']=qs['limit'](_0x3f1721[_0x5e5d('0x39')]['limit']);_0x5ba035[_0x5e5d('0x23')]=qs['offset'](_0x3f1721['query'][_0x5e5d('0x23')]);}_0x5ba035['order']=qs['sort'](_0x3f1721[_0x5e5d('0x39')][_0x5e5d('0x42')]);_0x5ba035[_0x5e5d('0x43')]=qs[_0x5e5d('0x3b')](_[_0x5e5d('0x44')](_0x3f1721[_0x5e5d('0x39')],_0x1301ef['filters']),_0x49d6f8);if(_0x3f1721['query']['filter']){_0x5ba035[_0x5e5d('0x43')]=_['merge'](_0x5ba035[_0x5e5d('0x43')],{'$or':_[_0x5e5d('0x33')](_0x49d6f8,function(_0x49941a){if(_0x49941a[_0x5e5d('0x36')]!==_0x5e5d('0x45')){var _0x5469c0={};_0x5469c0[_0x49941a[_0x5e5d('0x30')]]={'$like':'%'+_0x3f1721[_0x5e5d('0x39')][_0x5e5d('0x46')]+'%'};return _0x5469c0;}})});}_0x5ba035=_[_0x5e5d('0x47')]({},_0x5ba035,_0x3f1721[_0x5e5d('0x48')]);var _0x4b6fc9={'where':_0x5ba035[_0x5e5d('0x43')]};return db[_0x5e5d('0x49')][_0x5e5d('0x26')](_0x4b6fc9)[_0x5e5d('0x2d')](function(_0x6bf443){_0xf68677[_0x5e5d('0x26')]=_0x6bf443;if(_0x3f1721[_0x5e5d('0x39')][_0x5e5d('0x4a')]){_0x5ba035['include']=[{'all':!![]}];}return db[_0x5e5d('0x49')][_0x5e5d('0x4b')](_0x5ba035);})[_0x5e5d('0x2d')](function(_0x5d6369){_0xf68677[_0x5e5d('0x4c')]=_0x5d6369;return _0xf68677;})[_0x5e5d('0x2d')](respondWithFilteredResult(_0x12d758,_0x5ba035))['catch'](handleError(_0x12d758,null));};exports[_0x5e5d('0x4d')]=function(_0x22b8fd,_0x2ca071){var _0x56e0ac={'raw':![],'where':{'id':_0x22b8fd[_0x5e5d('0x4e')]['id']}},_0x3df625={};_0x3df625[_0x5e5d('0x38')]=_[_0x5e5d('0x3a')](db[_0x5e5d('0x49')]['rawAttributes']);_0x3df625[_0x5e5d('0x39')]=_['keys'](_0x22b8fd['query']);_0x3df625[_0x5e5d('0x3b')]=_['intersection'](_0x3df625[_0x5e5d('0x38')],_0x3df625[_0x5e5d('0x39')]);_0x56e0ac['attributes']=_[_0x5e5d('0x3d')](_0x3df625[_0x5e5d('0x38')],qs['fields'](_0x22b8fd['query'][_0x5e5d('0x3e')]));_0x56e0ac[_0x5e5d('0x3c')]=_0x56e0ac['attributes'][_0x5e5d('0x3f')]?_0x56e0ac[_0x5e5d('0x3c')]:_0x3df625[_0x5e5d('0x38')];if(_0x22b8fd['query'][_0x5e5d('0x4a')]){_0x56e0ac[_0x5e5d('0x4f')]=[{'all':!![]}];}_0x56e0ac=_[_0x5e5d('0x47')]({},_0x56e0ac,_0x22b8fd['options']);return db[_0x5e5d('0x49')][_0x5e5d('0x50')](_0x56e0ac)[_0x5e5d('0x2d')](handleEntityNotFound(_0x2ca071,null))['then'](respondWithResult(_0x2ca071,null))['catch'](handleError(_0x2ca071,null));};exports['update']=function(_0x40b3cd,_0x59bd89){if(_0x40b3cd[_0x5e5d('0x51')]['id']){delete _0x40b3cd['body']['id'];}return db[_0x5e5d('0x49')]['find']({'where':{'id':_0x40b3cd[_0x5e5d('0x4e')]['id']}})[_0x5e5d('0x2d')](handleEntityNotFound(_0x59bd89,null))['then'](saveUpdates(_0x40b3cd[_0x5e5d('0x51')],null))['then'](respondWithResult(_0x59bd89,null))['catch'](handleError(_0x59bd89,null));};exports['addLogo']=function(_0x25992a,_0x2e4338,_0x5d6e70){if(_0x25992a[_0x5e5d('0x52')]&&_0x25992a[_0x5e5d('0x52')][_0x5e5d('0x53')]){_0x25992a[_0x5e5d('0x51')][_0x5e5d('0x54')]=_0x25992a[_0x5e5d('0x52')]['filename'];}return db[_0x5e5d('0x49')][_0x5e5d('0x50')]({'where':{'id':_0x25992a['params']['id']}})['then'](handleEntityNotFound(_0x2e4338,null))[_0x5e5d('0x2d')](saveUpdates(_0x25992a[_0x5e5d('0x51')],null))[_0x5e5d('0x2d')](respondWithResult(_0x2e4338,null))[_0x5e5d('0x55')](handleError(_0x2e4338,null));};exports[_0x5e5d('0x56')]=function(_0x5a80ed,_0x3ba251,_0x5bd936){if(_0x5a80ed[_0x5e5d('0x52')]&&_0x5a80ed[_0x5e5d('0x52')][_0x5e5d('0x53')]){_0x5a80ed[_0x5e5d('0x51')][_0x5e5d('0x57')]=_0x5a80ed[_0x5e5d('0x52')]['filename'];}return db[_0x5e5d('0x49')]['find']({'where':{'id':_0x5a80ed['params']['id']}})[_0x5e5d('0x2d')](handleEntityNotFound(_0x3ba251,null))[_0x5e5d('0x2d')](saveUpdates(_0x5a80ed[_0x5e5d('0x51')],null))[_0x5e5d('0x2d')](respondWithResult(_0x3ba251,null))[_0x5e5d('0x55')](handleError(_0x3ba251,null));};var utilLicense=require(_0x5e5d('0x16'));exports['getLogo']=function(_0x2d2063,_0x34b114,_0x3bc311){var _0xab1de4=_0x5e5d('0x58');var _0x590b57={'custom':![]};return utilLicense[_0x5e5d('0x59')]()[_0x5e5d('0x2d')](function(_0xb3148e){if(_0xb3148e){_0x590b57=_0xb3148e;}return db[_0x5e5d('0x49')][_0x5e5d('0x50')]({'where':{'id':_0x2d2063[_0x5e5d('0x4e')]['id']},'attributes':['logo','loginLogo',_0x5e5d('0x5a'),_0x5e5d('0x5b'),_0x5e5d('0x5c'),_0x5e5d('0x5d'),_0x5e5d('0x5e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x34b114,null))[_0x5e5d('0x2d')](function(_0x53989a){if(_0x53989a){var _0x30a340=_0x53989a[_0x5e5d('0x54')]&&fs['existsSync'](path[_0x5e5d('0x5f')](config[_0x5e5d('0x60')],_0xab1de4,_['toLower'](_0x53989a[_0x5e5d('0x54')])))?path[_0x5e5d('0x5f')](config[_0x5e5d('0x60')],_0xab1de4,_[_0x5e5d('0x61')](_0x53989a['logo'])):path['join'](config['root'],_0xab1de4,_[_0x5e5d('0x61')](_0x5e5d('0x62')));var _0x4bb8c8='default'+_[_0x5e5d('0x63')](_0x5e5d('0x54'));if(_0x53989a[_0x4bb8c8]||!_0x590b57[_0x5e5d('0x64')]){_0x30a340=path[_0x5e5d('0x5f')](config[_0x5e5d('0x60')],_0xab1de4,_[_0x5e5d('0x61')]('default_logo.svg'));}if(!fs['existsSync'](_0x30a340)){throw new db[(_0x5e5d('0x65'))][(_0x5e5d('0x66'))](_['upperFirst'](_0x5e5d('0x54'))+_0x5e5d('0x67'));}return _0x34b114[_0x5e5d('0x68')](_0x30a340);}})[_0x5e5d('0x55')](handleError(_0x34b114,null));};var utilLicense=require(_0x5e5d('0x16'));exports[_0x5e5d('0x69')]=function(_0x1c0894,_0x1fb370,_0x880ae8){var _0x5a1dd8=_0x5e5d('0x58');var _0x53b2e4={'custom':![]};return utilLicense[_0x5e5d('0x59')]()[_0x5e5d('0x2d')](function(_0x2c4f0f){if(_0x2c4f0f){_0x53b2e4=_0x2c4f0f;}return db[_0x5e5d('0x49')]['find']({'where':{'id':_0x1c0894[_0x5e5d('0x4e')]['id']},'attributes':[_0x5e5d('0x54'),'loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo',_0x5e5d('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x5e5d('0x2d')](handleEntityNotFound(_0x1fb370,null))[_0x5e5d('0x2d')](function(_0x3b4fde){if(_0x3b4fde){var _0x14a117=_0x3b4fde['loginLogo']&&fs[_0x5e5d('0x6a')](path[_0x5e5d('0x5f')](config[_0x5e5d('0x60')],_0x5a1dd8,_[_0x5e5d('0x61')](_0x3b4fde[_0x5e5d('0x57')])))?path['join'](config[_0x5e5d('0x60')],_0x5a1dd8,_[_0x5e5d('0x61')](_0x3b4fde[_0x5e5d('0x57')])):path[_0x5e5d('0x5f')](config[_0x5e5d('0x60')],_0x5a1dd8,_[_0x5e5d('0x61')](_0x5e5d('0x6b')));var _0x383a30='default'+_['upperFirst'](_0x5e5d('0x57'));if(_0x3b4fde[_0x383a30]||!_0x53b2e4[_0x5e5d('0x64')]){_0x14a117=path[_0x5e5d('0x5f')](config[_0x5e5d('0x60')],_0x5a1dd8,_['toLower'](_0x5e5d('0x6b')));}if(!fs[_0x5e5d('0x6a')](_0x14a117)){throw new db[(_0x5e5d('0x65'))]['ValidationError'](_['upperFirst'](_0x5e5d('0x57'))+_0x5e5d('0x67'));}return _0x1fb370['download'](_0x14a117);}})['catch'](handleError(_0x1fb370,null));};exports[_0x5e5d('0x6c')]=function(_0x461f66,_0x40f8e5){return db['Setting'][_0x5e5d('0x50')]({'where':{'id':_0x461f66[_0x5e5d('0x4e')]['id']},'attributes':['securePassword']})[_0x5e5d('0x2d')](respondWithResult(_0x40f8e5,null))['catch'](handleError(_0x40f8e5,null));};exports[_0x5e5d('0x6d')]=function(_0x211ea4,_0x5c34a3,_0xd29bb7){if(_0x211ea4[_0x5e5d('0x52')]&&_0x211ea4[_0x5e5d('0x52')][_0x5e5d('0x53')]){_0x211ea4['body']['preferred']=_0x211ea4[_0x5e5d('0x52')][_0x5e5d('0x53')];}return db[_0x5e5d('0x49')][_0x5e5d('0x50')]({'where':{'id':_0x211ea4[_0x5e5d('0x4e')]['id']}})[_0x5e5d('0x2d')](handleEntityNotFound(_0x5c34a3,null))[_0x5e5d('0x2d')](saveUpdates(_0x211ea4['body'],null))[_0x5e5d('0x2d')](respondWithResult(_0x5c34a3,null))['catch'](handleError(_0x5c34a3,null));};var utilLicense=require(_0x5e5d('0x16'));exports['getPreferred']=function(_0x51eb17,_0x13e760,_0x5d30df){var _0x5bb5a2=_0x5e5d('0x58');var _0x47c158={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x179621){if(_0x179621){_0x47c158=_0x179621;}return db[_0x5e5d('0x49')][_0x5e5d('0x50')]({'where':{'id':_0x51eb17[_0x5e5d('0x4e')]['id']},'attributes':[_0x5e5d('0x54'),'loginLogo',_0x5e5d('0x5a'),_0x5e5d('0x5b'),_0x5e5d('0x5c'),_0x5e5d('0x5d'),_0x5e5d('0x5e'),_0x5e5d('0x6e')],'raw':!![]});})['then'](handleEntityNotFound(_0x13e760,null))[_0x5e5d('0x2d')](function(_0x15f895){if(_0x15f895){var _0x1c50aa=_0x15f895['preferred']&&fs[_0x5e5d('0x6a')](path[_0x5e5d('0x5f')](config[_0x5e5d('0x60')],_0x5bb5a2,_[_0x5e5d('0x61')](_0x15f895['preferred'])))?path[_0x5e5d('0x5f')](config[_0x5e5d('0x60')],_0x5bb5a2,_[_0x5e5d('0x61')](_0x15f895[_0x5e5d('0x5a')])):path[_0x5e5d('0x5f')](config[_0x5e5d('0x60')],_0x5bb5a2,_[_0x5e5d('0x61')]('default_preferred.png'));var _0x3b39b4=_0x5e5d('0x6f')+_['upperFirst'](_0x5e5d('0x5a'));if(_0x15f895[_0x3b39b4]||!_0x47c158[_0x5e5d('0x64')]||!_0x47c158[_0x5e5d('0x5a')]){_0x1c50aa=path['join'](config[_0x5e5d('0x60')],_0x5bb5a2,_[_0x5e5d('0x61')](_0x5e5d('0x70')));}if(!fs[_0x5e5d('0x6a')](_0x1c50aa)){throw new db[(_0x5e5d('0x65'))][(_0x5e5d('0x66'))](_[_0x5e5d('0x63')](_0x5e5d('0x5a'))+_0x5e5d('0x67'));}return _0x13e760[_0x5e5d('0x68')](_0x1c50aa);}})[_0x5e5d('0x55')](handleError(_0x13e760,null));};exports[_0x5e5d('0x71')]=function(_0x5bcdfe,_0x3cd941,_0xf80257){if(_0x5bcdfe[_0x5e5d('0x52')]&&_0x5bcdfe['file'][_0x5e5d('0x53')]){_0x5bcdfe['body'][_0x5e5d('0x5b')]=_0x5bcdfe[_0x5e5d('0x52')]['filename'];}return db[_0x5e5d('0x49')][_0x5e5d('0x50')]({'where':{'id':_0x5bcdfe[_0x5e5d('0x4e')]['id']}})[_0x5e5d('0x2d')](handleEntityNotFound(_0x3cd941,null))[_0x5e5d('0x2d')](saveUpdates(_0x5bcdfe[_0x5e5d('0x51')],null))[_0x5e5d('0x2d')](respondWithResult(_0x3cd941,null))[_0x5e5d('0x55')](handleError(_0x3cd941,null));};var utilLicense=require(_0x5e5d('0x16'));exports[_0x5e5d('0x72')]=function(_0x2da96b,_0x3e75d3,_0x47582a){var _0xac647e=_0x5e5d('0x58');var _0x3517ae={'custom':![]};return utilLicense['getLicense']()[_0x5e5d('0x2d')](function(_0x104061){if(_0x104061){_0x3517ae=_0x104061;}return db['Setting'][_0x5e5d('0x50')]({'where':{'id':_0x2da96b['params']['id']},'attributes':[_0x5e5d('0x54'),_0x5e5d('0x57'),_0x5e5d('0x5a'),_0x5e5d('0x5b'),_0x5e5d('0x5c'),_0x5e5d('0x5d'),_0x5e5d('0x5e'),_0x5e5d('0x6e')],'raw':!![]});})['then'](handleEntityNotFound(_0x3e75d3,null))['then'](function(_0x4569f5){if(_0x4569f5){var _0x1947c3=_0x4569f5[_0x5e5d('0x5b')]&&fs[_0x5e5d('0x6a')](path['join'](config['root'],_0xac647e,_[_0x5e5d('0x61')](_0x4569f5[_0x5e5d('0x5b')])))?path[_0x5e5d('0x5f')](config[_0x5e5d('0x60')],_0xac647e,_[_0x5e5d('0x61')](_0x4569f5['favicon'])):path[_0x5e5d('0x5f')](config[_0x5e5d('0x60')],_0xac647e,_[_0x5e5d('0x61')]('default_favicon.ico'));var _0xe76dff=_0x5e5d('0x6f')+_[_0x5e5d('0x63')](_0x5e5d('0x5b'));if(_0x4569f5[_0xe76dff]||!_0x3517ae[_0x5e5d('0x64')]){_0x1947c3=path[_0x5e5d('0x5f')](config[_0x5e5d('0x60')],_0xac647e,_[_0x5e5d('0x61')](_0x5e5d('0x73')));}if(!fs[_0x5e5d('0x6a')](_0x1947c3)){throw new db['Sequelize'][(_0x5e5d('0x66'))](_[_0x5e5d('0x63')]('favicon')+_0x5e5d('0x67'));}return _0x3e75d3[_0x5e5d('0x68')](_0x1947c3);}})['catch'](handleError(_0x3e75d3,null));};exports[_0x5e5d('0x74')]=function(_0x408b30,_0x82ada9){var _0xc2141e={'offset':moment()[_0x5e5d('0x75')]()};_0xc2141e['now']=moment()['utcOffset'](_0xc2141e['offset'])[_0x5e5d('0x76')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x82ada9[_0x5e5d('0x27')](0xc8)[_0x5e5d('0x31')](_0xc2141e);}; \ No newline at end of file +var _0xd06e=['favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','custom','Sequelize','upperFirst','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','ValidationError','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','getLicense','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','stack','name','index','map','Setting','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','body','addLogo','file','filename','find','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','logo','preferred'];(function(_0x5e9b84,_0x41bd6f){var _0x274bd8=function(_0x497f92){while(--_0x497f92){_0x5e9b84['push'](_0x5e9b84['shift']());}};_0x274bd8(++_0x41bd6f);}(_0xd06e,0x124));var _0xed06=function(_0x11a37d,_0x2f6cdf){_0x11a37d=_0x11a37d-0x0;var _0x466e2e=_0xd06e[_0x11a37d];return _0x466e2e;};'use strict';var emlformat=require(_0xed06('0x0'));var rimraf=require(_0xed06('0x1'));var zipdir=require(_0xed06('0x2'));var jsonpatch=require(_0xed06('0x3'));var rp=require('request-promise');var moment=require(_0xed06('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed06('0x5'));var util=require(_0xed06('0x6'));var path=require(_0xed06('0x7'));var sox=require(_0xed06('0x8'));var csv=require(_0xed06('0x9'));var ejs=require(_0xed06('0xa'));var fs=require('fs');var fs_extra=require(_0xed06('0xb'));var _=require(_0xed06('0xc'));var squel=require(_0xed06('0xd'));var crypto=require(_0xed06('0xe'));var jsforce=require(_0xed06('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xed06('0x9'));var querystring=require(_0xed06('0x10'));var Papa=require(_0xed06('0x11'));var Redis=require(_0xed06('0x12'));var authService=require(_0xed06('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xed06('0x14'));var hardwareService=require(_0xed06('0x15'));var logger=require(_0xed06('0x16'))(_0xed06('0x17'));var utils=require(_0xed06('0x18'));var config=require(_0xed06('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xed06('0x1a'));var client=jayson[_0xed06('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd01f75,_0x4b23e1,_0x4f24cc,_0x120621){return new BPromise(function(_0x50f169,_0x281511){var _0x47e5d9=_0x120621||client;return _0x47e5d9['request'](_0xd01f75,_0x4f24cc)['then'](function(_0x480f8b){logger[_0xed06('0x1c')](_0xed06('0x1d'),_0x4b23e1,_0xed06('0x1e'));logger[_0xed06('0x1f')](_0xed06('0x20'),_0x4b23e1,_0xed06('0x1e'),JSON[_0xed06('0x21')](_0x480f8b));if(_0x480f8b['error']){if(_0x480f8b[_0xed06('0x22')][_0xed06('0x23')]===0x1f4){logger[_0xed06('0x22')](_0xed06('0x1d'),_0x4b23e1,_0x480f8b['error'][_0xed06('0x24')]);return _0x281511(_0x480f8b['error'][_0xed06('0x24')]);}logger[_0xed06('0x22')](_0xed06('0x1d'),_0x4b23e1,_0x480f8b['error'][_0xed06('0x24')]);return _0x50f169(_0x480f8b['error'][_0xed06('0x24')]);}else{logger[_0xed06('0x1c')](_0xed06('0x1d'),_0x4b23e1,'request\x20sent');_0x50f169(_0x480f8b[_0xed06('0x25')]['message']);}})[_0xed06('0x26')](function(_0x2f19b3){logger[_0xed06('0x22')](_0xed06('0x1d'),_0x4b23e1,_0x2f19b3);_0x281511(_0x2f19b3);});});}function respondWithStatusCode(_0x2e43a8,_0x58bd54){_0x58bd54=_0x58bd54||0xcc;return function(_0x10f751){if(_0x10f751){return _0x2e43a8[_0xed06('0x27')](_0x58bd54);}return _0x2e43a8['status'](_0x58bd54)[_0xed06('0x28')]();};}function respondWithResult(_0x5792d7,_0x4ddf3d){_0x4ddf3d=_0x4ddf3d||0xc8;return function(_0xcdf29e){if(_0xcdf29e){return _0x5792d7[_0xed06('0x29')](_0x4ddf3d)[_0xed06('0x2a')](_0xcdf29e);}};}function respondWithFilteredResult(_0x526465,_0x23b844){return function(_0x27c887){if(_0x27c887){var _0x3b99c2=typeof _0x23b844['offset']===_0xed06('0x2b')&&typeof _0x23b844[_0xed06('0x2c')]===_0xed06('0x2b');var _0x30c6a3=_0x27c887['count'];var _0x53a8b3=_0x3b99c2?0x0:_0x23b844[_0xed06('0x2d')];var _0x4bbcff=_0x3b99c2?_0x27c887[_0xed06('0x2e')]:_0x23b844[_0xed06('0x2d')]+_0x23b844[_0xed06('0x2c')];var _0xb6b2f3;if(_0x4bbcff>=_0x30c6a3){_0x4bbcff=_0x30c6a3;_0xb6b2f3=0xc8;}else{_0xb6b2f3=0xce;}_0x526465['status'](_0xb6b2f3);return _0x526465[_0xed06('0x2f')](_0xed06('0x30'),_0x53a8b3+'-'+_0x4bbcff+'/'+_0x30c6a3)[_0xed06('0x2a')](_0x27c887);}return null;};}function patchUpdates(_0x2ceee7){return function(_0x19a942){try{jsonpatch[_0xed06('0x31')](_0x19a942,_0x2ceee7,!![]);}catch(_0x2fb839){return BPromise['reject'](_0x2fb839);}return _0x19a942[_0xed06('0x32')]();};}function saveUpdates(_0x2524ff,_0x6627c5){return function(_0x270468){if(_0x270468){return _0x270468[_0xed06('0x33')](_0x2524ff)[_0xed06('0x34')](function(_0x544ef4){return _0x544ef4;});}return null;};}function removeEntity(_0x4a833a,_0x154f69){return function(_0xcda3cd){if(_0xcda3cd){return _0xcda3cd['destroy']()[_0xed06('0x34')](function(){_0x4a833a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x525fc2,_0xea9bed){return function(_0x51685a){if(!_0x51685a){_0x525fc2[_0xed06('0x27')](0x194);}return _0x51685a;};}function handleError(_0x1a4770,_0x4aad10){_0x4aad10=_0x4aad10||0x1f4;return function(_0x3333ef){logger[_0xed06('0x22')](_0x3333ef[_0xed06('0x35')]);if(_0x3333ef[_0xed06('0x36')]){delete _0x3333ef[_0xed06('0x36')];}_0x1a4770[_0xed06('0x29')](_0x4aad10)['send'](_0x3333ef);};}exports[_0xed06('0x37')]=function(_0x125852,_0x27320c){var _0x10d753={},_0x293f94={},_0x31051b={'count':0x0,'rows':[]};var _0x2de444=_[_0xed06('0x38')](db[_0xed06('0x39')][_0xed06('0x3a')],function(_0x9accb3){return{'name':_0x9accb3[_0xed06('0x3b')],'type':_0x9accb3[_0xed06('0x3c')][_0xed06('0x3d')]};});_0x293f94[_0xed06('0x3e')]=_['map'](_0x2de444,_0xed06('0x36'));_0x293f94['query']=_[_0xed06('0x3f')](_0x125852[_0xed06('0x40')]);_0x293f94[_0xed06('0x41')]=_['intersection'](_0x293f94[_0xed06('0x3e')],_0x293f94[_0xed06('0x40')]);_0x10d753[_0xed06('0x42')]=_[_0xed06('0x43')](_0x293f94[_0xed06('0x3e')],qs[_0xed06('0x44')](_0x125852[_0xed06('0x40')][_0xed06('0x44')]));_0x10d753[_0xed06('0x42')]=_0x10d753[_0xed06('0x42')][_0xed06('0x45')]?_0x10d753[_0xed06('0x42')]:_0x293f94['model'];if(!_0x125852[_0xed06('0x40')][_0xed06('0x46')](_0xed06('0x47'))){_0x10d753['limit']=qs[_0xed06('0x2c')](_0x125852[_0xed06('0x40')][_0xed06('0x2c')]);_0x10d753[_0xed06('0x2d')]=qs['offset'](_0x125852[_0xed06('0x40')][_0xed06('0x2d')]);}_0x10d753[_0xed06('0x48')]=qs['sort'](_0x125852[_0xed06('0x40')][_0xed06('0x49')]);_0x10d753[_0xed06('0x4a')]=qs[_0xed06('0x41')](_[_0xed06('0x4b')](_0x125852[_0xed06('0x40')],_0x293f94[_0xed06('0x41')]),_0x2de444);if(_0x125852[_0xed06('0x40')][_0xed06('0x4c')]){_0x10d753[_0xed06('0x4a')]=_[_0xed06('0x4d')](_0x10d753[_0xed06('0x4a')],{'$or':_[_0xed06('0x38')](_0x2de444,function(_0x30a550){if(_0x30a550[_0xed06('0x3c')]!==_0xed06('0x4e')){var _0x2d3268={};_0x2d3268[_0x30a550['name']]={'$like':'%'+_0x125852[_0xed06('0x40')][_0xed06('0x4c')]+'%'};return _0x2d3268;}})});}_0x10d753=_[_0xed06('0x4d')]({},_0x10d753,_0x125852[_0xed06('0x4f')]);var _0x128d1e={'where':_0x10d753[_0xed06('0x4a')]};return db[_0xed06('0x39')][_0xed06('0x2e')](_0x128d1e)[_0xed06('0x34')](function(_0x22cefe){_0x31051b[_0xed06('0x2e')]=_0x22cefe;if(_0x125852['query'][_0xed06('0x50')]){_0x10d753[_0xed06('0x51')]=[{'all':!![]}];}return db[_0xed06('0x39')][_0xed06('0x52')](_0x10d753);})[_0xed06('0x34')](function(_0x40a5f4){_0x31051b[_0xed06('0x53')]=_0x40a5f4;return _0x31051b;})[_0xed06('0x34')](respondWithFilteredResult(_0x27320c,_0x10d753))[_0xed06('0x26')](handleError(_0x27320c,null));};exports[_0xed06('0x54')]=function(_0xfe2d1f,_0xaf1df0){var _0x1bf4df={'raw':![],'where':{'id':_0xfe2d1f[_0xed06('0x55')]['id']}},_0x3a6f6e={};_0x3a6f6e['model']=_[_0xed06('0x3f')](db[_0xed06('0x39')][_0xed06('0x3a')]);_0x3a6f6e[_0xed06('0x40')]=_['keys'](_0xfe2d1f[_0xed06('0x40')]);_0x3a6f6e['filters']=_[_0xed06('0x43')](_0x3a6f6e[_0xed06('0x3e')],_0x3a6f6e[_0xed06('0x40')]);_0x1bf4df['attributes']=_[_0xed06('0x43')](_0x3a6f6e[_0xed06('0x3e')],qs[_0xed06('0x44')](_0xfe2d1f['query'][_0xed06('0x44')]));_0x1bf4df[_0xed06('0x42')]=_0x1bf4df['attributes'][_0xed06('0x45')]?_0x1bf4df[_0xed06('0x42')]:_0x3a6f6e[_0xed06('0x3e')];if(_0xfe2d1f['query'][_0xed06('0x50')]){_0x1bf4df['include']=[{'all':!![]}];}_0x1bf4df=_[_0xed06('0x4d')]({},_0x1bf4df,_0xfe2d1f[_0xed06('0x4f')]);return db[_0xed06('0x39')]['find'](_0x1bf4df)[_0xed06('0x34')](handleEntityNotFound(_0xaf1df0,null))[_0xed06('0x34')](respondWithResult(_0xaf1df0,null))[_0xed06('0x26')](handleError(_0xaf1df0,null));};exports['update']=function(_0x3bdd4b,_0x31fb12){if(_0x3bdd4b[_0xed06('0x56')]['id']){delete _0x3bdd4b[_0xed06('0x56')]['id'];}return db[_0xed06('0x39')]['find']({'where':{'id':_0x3bdd4b[_0xed06('0x55')]['id']}})[_0xed06('0x34')](handleEntityNotFound(_0x31fb12,null))[_0xed06('0x34')](saveUpdates(_0x3bdd4b[_0xed06('0x56')],null))[_0xed06('0x34')](respondWithResult(_0x31fb12,null))[_0xed06('0x26')](handleError(_0x31fb12,null));};exports[_0xed06('0x57')]=function(_0x28bf75,_0x1b7f8f,_0x2f9a13){if(_0x28bf75[_0xed06('0x58')]&&_0x28bf75[_0xed06('0x58')][_0xed06('0x59')]){_0x28bf75[_0xed06('0x56')]['logo']=_0x28bf75[_0xed06('0x58')][_0xed06('0x59')];}return db[_0xed06('0x39')][_0xed06('0x5a')]({'where':{'id':_0x28bf75['params']['id']}})['then'](handleEntityNotFound(_0x1b7f8f,null))[_0xed06('0x34')](saveUpdates(_0x28bf75[_0xed06('0x56')],null))[_0xed06('0x34')](respondWithResult(_0x1b7f8f,null))[_0xed06('0x26')](handleError(_0x1b7f8f,null));};exports[_0xed06('0x5b')]=function(_0xd2fb29,_0x5c0000,_0x4862b5){if(_0xd2fb29[_0xed06('0x58')]&&_0xd2fb29['file'][_0xed06('0x59')]){_0xd2fb29[_0xed06('0x56')][_0xed06('0x5c')]=_0xd2fb29[_0xed06('0x58')][_0xed06('0x59')];}return db[_0xed06('0x39')][_0xed06('0x5a')]({'where':{'id':_0xd2fb29[_0xed06('0x55')]['id']}})[_0xed06('0x34')](handleEntityNotFound(_0x5c0000,null))['then'](saveUpdates(_0xd2fb29[_0xed06('0x56')],null))[_0xed06('0x34')](respondWithResult(_0x5c0000,null))['catch'](handleError(_0x5c0000,null));};var utilLicense=require(_0xed06('0x5d'));exports[_0xed06('0x5e')]=function(_0x4d0248,_0x3c7033,_0x176da5){var _0x3c8de1=_0xed06('0x5f');var _0x1aa8cf={'custom':![]};return utilLicense['getLicense']()[_0xed06('0x34')](function(_0x1bb6a0){if(_0x1bb6a0){_0x1aa8cf=_0x1bb6a0;}return db[_0xed06('0x39')][_0xed06('0x5a')]({'where':{'id':_0x4d0248[_0xed06('0x55')]['id']},'attributes':[_0xed06('0x60'),'loginLogo',_0xed06('0x61'),_0xed06('0x62'),_0xed06('0x63'),_0xed06('0x64'),_0xed06('0x65'),_0xed06('0x66')],'raw':!![]});})['then'](handleEntityNotFound(_0x3c7033,null))[_0xed06('0x34')](function(_0x56d03e){if(_0x56d03e){var _0x2c3fbc=_0x56d03e[_0xed06('0x60')]&&fs[_0xed06('0x67')](path[_0xed06('0x68')](config[_0xed06('0x69')],_0x3c8de1,_[_0xed06('0x6a')](_0x56d03e[_0xed06('0x60')])))?path[_0xed06('0x68')](config['root'],_0x3c8de1,_[_0xed06('0x6a')](_0x56d03e[_0xed06('0x60')])):path[_0xed06('0x68')](config['root'],_0x3c8de1,_[_0xed06('0x6a')](_0xed06('0x6b')));var _0x1d8bce=_0xed06('0x6c')+_['upperFirst']('logo');if(_0x56d03e[_0x1d8bce]||!_0x1aa8cf[_0xed06('0x6d')]){_0x2c3fbc=path[_0xed06('0x68')](config[_0xed06('0x69')],_0x3c8de1,_[_0xed06('0x6a')]('default_logo.svg'));}if(!fs['existsSync'](_0x2c3fbc)){throw new db[(_0xed06('0x6e'))]['ValidationError'](_[_0xed06('0x6f')](_0xed06('0x60'))+_0xed06('0x70'));}return _0x3c7033[_0xed06('0x71')](_0x2c3fbc);}})[_0xed06('0x26')](handleError(_0x3c7033,null));};var utilLicense=require(_0xed06('0x5d'));exports[_0xed06('0x72')]=function(_0x510c71,_0x1d95a3,_0x4a9977){var _0x53cdc0=_0xed06('0x5f');var _0x1ba3ab={'custom':![]};return utilLicense['getLicense']()[_0xed06('0x34')](function(_0x387b63){if(_0x387b63){_0x1ba3ab=_0x387b63;}return db[_0xed06('0x39')][_0xed06('0x5a')]({'where':{'id':_0x510c71['params']['id']},'attributes':[_0xed06('0x60'),'loginLogo',_0xed06('0x61'),_0xed06('0x62'),'defaultLogo',_0xed06('0x64'),_0xed06('0x65'),_0xed06('0x66')],'raw':!![]});})[_0xed06('0x34')](handleEntityNotFound(_0x1d95a3,null))[_0xed06('0x34')](function(_0x2148ff){if(_0x2148ff){var _0x50ed87=_0x2148ff[_0xed06('0x5c')]&&fs['existsSync'](path[_0xed06('0x68')](config['root'],_0x53cdc0,_[_0xed06('0x6a')](_0x2148ff[_0xed06('0x5c')])))?path[_0xed06('0x68')](config['root'],_0x53cdc0,_[_0xed06('0x6a')](_0x2148ff[_0xed06('0x5c')])):path['join'](config['root'],_0x53cdc0,_['toLower'](_0xed06('0x73')));var _0x4254de=_0xed06('0x6c')+_[_0xed06('0x6f')](_0xed06('0x5c'));if(_0x2148ff[_0x4254de]||!_0x1ba3ab[_0xed06('0x6d')]){_0x50ed87=path['join'](config[_0xed06('0x69')],_0x53cdc0,_[_0xed06('0x6a')](_0xed06('0x73')));}if(!fs[_0xed06('0x67')](_0x50ed87)){throw new db['Sequelize'][(_0xed06('0x74'))](_['upperFirst'](_0xed06('0x5c'))+_0xed06('0x70'));}return _0x1d95a3['download'](_0x50ed87);}})[_0xed06('0x26')](handleError(_0x1d95a3,null));};exports['gdpr']=function(_0x4150c0,_0x488df4){return db[_0xed06('0x39')][_0xed06('0x5a')]({'where':{'id':_0x4150c0[_0xed06('0x55')]['id']},'attributes':[_0xed06('0x75')]})[_0xed06('0x34')](respondWithResult(_0x488df4,null))[_0xed06('0x26')](handleError(_0x488df4,null));};exports[_0xed06('0x76')]=function(_0x19c06a,_0x18f3d9,_0x362c3d){if(_0x19c06a[_0xed06('0x58')]&&_0x19c06a[_0xed06('0x58')][_0xed06('0x59')]){_0x19c06a[_0xed06('0x56')][_0xed06('0x61')]=_0x19c06a[_0xed06('0x58')][_0xed06('0x59')];}return db[_0xed06('0x39')]['find']({'where':{'id':_0x19c06a['params']['id']}})['then'](handleEntityNotFound(_0x18f3d9,null))[_0xed06('0x34')](saveUpdates(_0x19c06a[_0xed06('0x56')],null))[_0xed06('0x34')](respondWithResult(_0x18f3d9,null))['catch'](handleError(_0x18f3d9,null));};var utilLicense=require(_0xed06('0x5d'));exports[_0xed06('0x77')]=function(_0x310ae7,_0x419ba4,_0xb22292){var _0x41805b=_0xed06('0x5f');var _0x3364d2={'custom':![]};return utilLicense['getLicense']()[_0xed06('0x34')](function(_0xdcb681){if(_0xdcb681){_0x3364d2=_0xdcb681;}return db[_0xed06('0x39')]['find']({'where':{'id':_0x310ae7[_0xed06('0x55')]['id']},'attributes':['logo',_0xed06('0x5c'),_0xed06('0x61'),_0xed06('0x62'),'defaultLogo',_0xed06('0x64'),_0xed06('0x65'),'defaultFavicon'],'raw':!![]});})[_0xed06('0x34')](handleEntityNotFound(_0x419ba4,null))[_0xed06('0x34')](function(_0xf5d9ba){if(_0xf5d9ba){var _0x3d4d86=_0xf5d9ba[_0xed06('0x61')]&&fs[_0xed06('0x67')](path[_0xed06('0x68')](config[_0xed06('0x69')],_0x41805b,_[_0xed06('0x6a')](_0xf5d9ba['preferred'])))?path[_0xed06('0x68')](config[_0xed06('0x69')],_0x41805b,_[_0xed06('0x6a')](_0xf5d9ba[_0xed06('0x61')])):path['join'](config[_0xed06('0x69')],_0x41805b,_[_0xed06('0x6a')](_0xed06('0x78')));var _0x4283e2=_0xed06('0x6c')+_['upperFirst'](_0xed06('0x61'));if(_0xf5d9ba[_0x4283e2]||!_0x3364d2['custom']||!_0x3364d2['preferred']){_0x3d4d86=path[_0xed06('0x68')](config[_0xed06('0x69')],_0x41805b,_[_0xed06('0x6a')]('default_preferred.png'));}if(!fs[_0xed06('0x67')](_0x3d4d86)){throw new db['Sequelize'][(_0xed06('0x74'))](_['upperFirst']('preferred')+_0xed06('0x70'));}return _0x419ba4['download'](_0x3d4d86);}})['catch'](handleError(_0x419ba4,null));};exports[_0xed06('0x79')]=function(_0x53aa27,_0x37d19f,_0x28e99d){if(_0x53aa27[_0xed06('0x58')]&&_0x53aa27['file'][_0xed06('0x59')]){_0x53aa27[_0xed06('0x56')]['favicon']=_0x53aa27['file'][_0xed06('0x59')];}return db[_0xed06('0x39')]['find']({'where':{'id':_0x53aa27[_0xed06('0x55')]['id']}})[_0xed06('0x34')](handleEntityNotFound(_0x37d19f,null))[_0xed06('0x34')](saveUpdates(_0x53aa27['body'],null))['then'](respondWithResult(_0x37d19f,null))[_0xed06('0x26')](handleError(_0x37d19f,null));};var utilLicense=require(_0xed06('0x5d'));exports[_0xed06('0x7a')]=function(_0x2e72b5,_0x2bdb9f,_0x398a4f){var _0x199eee=_0xed06('0x5f');var _0x3514f2={'custom':![]};return utilLicense[_0xed06('0x7b')]()[_0xed06('0x34')](function(_0x3d0550){if(_0x3d0550){_0x3514f2=_0x3d0550;}return db['Setting'][_0xed06('0x5a')]({'where':{'id':_0x2e72b5['params']['id']},'attributes':['logo',_0xed06('0x5c'),'preferred',_0xed06('0x62'),_0xed06('0x63'),_0xed06('0x64'),'defaultPreferred',_0xed06('0x66')],'raw':!![]});})[_0xed06('0x34')](handleEntityNotFound(_0x2bdb9f,null))['then'](function(_0xb10746){if(_0xb10746){var _0x5e8411=_0xb10746[_0xed06('0x62')]&&fs[_0xed06('0x67')](path[_0xed06('0x68')](config['root'],_0x199eee,_[_0xed06('0x6a')](_0xb10746['favicon'])))?path[_0xed06('0x68')](config[_0xed06('0x69')],_0x199eee,_[_0xed06('0x6a')](_0xb10746[_0xed06('0x62')])):path[_0xed06('0x68')](config[_0xed06('0x69')],_0x199eee,_[_0xed06('0x6a')](_0xed06('0x7c')));var _0xf8f3bd=_0xed06('0x6c')+_[_0xed06('0x6f')]('favicon');if(_0xb10746[_0xf8f3bd]||!_0x3514f2[_0xed06('0x6d')]){_0x5e8411=path['join'](config[_0xed06('0x69')],_0x199eee,_[_0xed06('0x6a')](_0xed06('0x7c')));}if(!fs[_0xed06('0x67')](_0x5e8411)){throw new db[(_0xed06('0x6e'))][(_0xed06('0x74'))](_[_0xed06('0x6f')](_0xed06('0x62'))+_0xed06('0x70'));}return _0x2bdb9f[_0xed06('0x71')](_0x5e8411);}})[_0xed06('0x26')](handleError(_0x2bdb9f,null));};exports[_0xed06('0x7d')]=function(_0x448006,_0x7b801a){var _0xd1ca16={'offset':moment()[_0xed06('0x7e')]()};_0xd1ca16[_0xed06('0x7f')]=moment()[_0xed06('0x7e')](_0xd1ca16[_0xed06('0x2d')])[_0xed06('0x80')](_0xed06('0x81'));return _0x7b801a[_0xed06('0x29')](0xc8)['send'](_0xd1ca16);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index b296226..46bbcfe 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x3e74,0x175));var _0x43e7=function(_0xeeb7e3,_0x34491e){_0xeeb7e3=_0xeeb7e3-0x0;var _0x599ff3=_0x3e74[_0xeeb7e3];return _0x599ff3;};'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 _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x33007f,_0x4b38d2){var _0x10d38c=function(_0x497992){while(--_0x497992){_0x33007f['push'](_0x33007f['shift']());}};_0x10d38c(++_0x4b38d2);}(_0x3e74,0x175));var _0x43e7=function(_0x5d5314,_0x21ad02){_0x5d5314=_0x5d5314-0x0;var _0x3224d7=_0x3e74[_0x5d5314];return _0x3224d7;};'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 29418c5..7eee3de 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 _0x43a2=['info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','Setting','raw','options','where','attributes','map','model','include','debug','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x4c164d,_0x3a6063){var _0x355eec=function(_0x179f27){while(--_0x179f27){_0x4c164d['push'](_0x4c164d['shift']());}};_0x355eec(++_0x3a6063);}(_0x43a2,0x1f4));var _0x243a=function(_0x3b385a,_0x52c0fd){_0x3b385a=_0x3b385a-0x0;var _0x37095b=_0x43a2[_0x3b385a];return _0x37095b;};'use strict';var _=require('lodash');var util=require(_0x243a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x243a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x243a('0x2'))['db'];var utils=require(_0x243a('0x3'));var logger=require('../../config/logger')(_0x243a('0x4'));var config=require(_0x243a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x243a('0x6')][_0x243a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5ca763,_0x1a6377,_0x371e0c){return new BPromise(function(_0x2cb49a,_0x412a37){return client[_0x243a('0x8')](_0x5ca763,_0x371e0c)[_0x243a('0x9')](function(_0x324361){logger[_0x243a('0xa')](_0x243a('0xb'),_0x1a6377,_0x243a('0xc'));logger['debug'](_0x243a('0xd'),_0x1a6377,'request\x20sent',JSON[_0x243a('0xe')](_0x324361));if(_0x324361[_0x243a('0xf')]){if(_0x324361['error'][_0x243a('0x10')]===0x1f4){logger[_0x243a('0xf')](_0x243a('0xb'),_0x1a6377,_0x324361['error'][_0x243a('0x11')]);return _0x412a37(_0x324361[_0x243a('0xf')]['message']);}logger[_0x243a('0xf')](_0x243a('0xb'),_0x1a6377,_0x324361[_0x243a('0xf')][_0x243a('0x11')]);return _0x2cb49a(_0x324361[_0x243a('0xf')][_0x243a('0x11')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x1a6377,'request\x20sent');_0x2cb49a(_0x324361[_0x243a('0x12')]['message']);}})[_0x243a('0x13')](function(_0x22c1de){logger[_0x243a('0xf')](_0x243a('0xb'),_0x1a6377,_0x22c1de);_0x412a37(_0x22c1de);});});}exports[_0x243a('0x14')]=function(_0xc004cb){var _0x18a3a5=this;return new Promise(function(_0x1ee11f,_0x41dcee){return db[_0x243a('0x15')]['find']({'raw':_0xc004cb['options']?_0xc004cb['options'][_0x243a('0x16')]===undefined?!![]:![]:!![],'where':_0xc004cb[_0x243a('0x17')]?_0xc004cb['options'][_0x243a('0x18')]||null:null,'attributes':_0xc004cb[_0x243a('0x17')]?_0xc004cb[_0x243a('0x17')][_0x243a('0x19')]||null:null,'include':_0xc004cb[_0x243a('0x17')]?_0xc004cb[_0x243a('0x17')]['include']?_[_0x243a('0x1a')](_0xc004cb[_0x243a('0x17')]['include'],function(_0x294ca2){return{'model':db[_0x294ca2[_0x243a('0x1b')]],'as':_0x294ca2['as'],'attributes':_0x294ca2[_0x243a('0x19')],'include':_0x294ca2[_0x243a('0x1c')]?_[_0x243a('0x1a')](_0x294ca2['include'],function(_0x13904a){return{'model':db[_0x13904a[_0x243a('0x1b')]],'as':_0x13904a['as'],'attributes':_0x13904a['attributes'],'include':_0x13904a[_0x243a('0x1c')]?_['map'](_0x13904a[_0x243a('0x1c')],function(_0xec07fe){return{'model':db[_0xec07fe[_0x243a('0x1b')]],'as':_0xec07fe['as'],'attributes':_0xec07fe[_0x243a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x243a('0x9')](function(_0x3472a1){logger[_0x243a('0xa')](_0x243a('0x14'),_0xc004cb);logger[_0x243a('0x1d')](_0x243a('0x14'),_0xc004cb,JSON['stringify'](_0x3472a1));_0x1ee11f(_0x3472a1);})[_0x243a('0x13')](function(_0x8f4d68){logger['error'](_0x243a('0x14'),_0x8f4d68['message'],_0xc004cb);_0x41dcee(_0x18a3a5['error'](0x1f4,_0x8f4d68[_0x243a('0x11')]));});});}; \ No newline at end of file +var _0x2e4e=['Setting','find','options','raw','where','attributes','include','map','model','stringify','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','Setting,\x20%s,\x20%s','result','ShowSetting'];(function(_0x48b3d6,_0x4eaedf){var _0x3ac80a=function(_0x320a3e){while(--_0x320a3e){_0x48b3d6['push'](_0x48b3d6['shift']());}};_0x3ac80a(++_0x4eaedf);}(_0x2e4e,0x15f));var _0xe2e4=function(_0x10c27a,_0x2b9486){_0x10c27a=_0x10c27a-0x0;var _0x315238=_0x2e4e[_0x10c27a];return _0x315238;};'use strict';var _=require('lodash');var util=require(_0xe2e4('0x0'));var moment=require('moment');var BPromise=require(_0xe2e4('0x1'));var rs=require(_0xe2e4('0x2'));var fs=require('fs');var Redis=require(_0xe2e4('0x3'));var db=require(_0xe2e4('0x4'))['db'];var utils=require(_0xe2e4('0x5'));var logger=require(_0xe2e4('0x6'))(_0xe2e4('0x7'));var config=require(_0xe2e4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe2e4('0x9')][_0xe2e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e4b73,_0x70a636,_0x59594c){return new BPromise(function(_0x116f4d,_0x396db6){return client[_0xe2e4('0xb')](_0x4e4b73,_0x59594c)[_0xe2e4('0xc')](function(_0x18a0e4){logger[_0xe2e4('0xd')]('Setting,\x20%s,\x20%s',_0x70a636,_0xe2e4('0xe'));logger[_0xe2e4('0xf')](_0xe2e4('0x10'),_0x70a636,'request\x20sent',JSON['stringify'](_0x18a0e4));if(_0x18a0e4[_0xe2e4('0x11')]){if(_0x18a0e4['error'][_0xe2e4('0x12')]===0x1f4){logger[_0xe2e4('0x11')]('Setting,\x20%s,\x20%s',_0x70a636,_0x18a0e4[_0xe2e4('0x11')]['message']);return _0x396db6(_0x18a0e4[_0xe2e4('0x11')][_0xe2e4('0x13')]);}logger['error']('Setting,\x20%s,\x20%s',_0x70a636,_0x18a0e4[_0xe2e4('0x11')][_0xe2e4('0x13')]);return _0x116f4d(_0x18a0e4[_0xe2e4('0x11')][_0xe2e4('0x13')]);}else{logger[_0xe2e4('0xd')](_0xe2e4('0x14'),_0x70a636,_0xe2e4('0xe'));_0x116f4d(_0x18a0e4[_0xe2e4('0x15')][_0xe2e4('0x13')]);}})['catch'](function(_0xb18b6b){logger[_0xe2e4('0x11')](_0xe2e4('0x14'),_0x70a636,_0xb18b6b);_0x396db6(_0xb18b6b);});});}exports[_0xe2e4('0x16')]=function(_0x2d7724){var _0xf00f3f=this;return new Promise(function(_0x3160d0,_0x5a9ca8){return db[_0xe2e4('0x17')][_0xe2e4('0x18')]({'raw':_0x2d7724[_0xe2e4('0x19')]?_0x2d7724[_0xe2e4('0x19')][_0xe2e4('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d7724[_0xe2e4('0x19')]?_0x2d7724['options'][_0xe2e4('0x1b')]||null:null,'attributes':_0x2d7724[_0xe2e4('0x19')]?_0x2d7724[_0xe2e4('0x19')][_0xe2e4('0x1c')]||null:null,'include':_0x2d7724[_0xe2e4('0x19')]?_0x2d7724['options'][_0xe2e4('0x1d')]?_[_0xe2e4('0x1e')](_0x2d7724[_0xe2e4('0x19')]['include'],function(_0x598291){return{'model':db[_0x598291[_0xe2e4('0x1f')]],'as':_0x598291['as'],'attributes':_0x598291['attributes'],'include':_0x598291[_0xe2e4('0x1d')]?_[_0xe2e4('0x1e')](_0x598291[_0xe2e4('0x1d')],function(_0xa6ef31){return{'model':db[_0xa6ef31[_0xe2e4('0x1f')]],'as':_0xa6ef31['as'],'attributes':_0xa6ef31[_0xe2e4('0x1c')],'include':_0xa6ef31['include']?_[_0xe2e4('0x1e')](_0xa6ef31[_0xe2e4('0x1d')],function(_0x2f26a9){return{'model':db[_0x2f26a9['model']],'as':_0x2f26a9['as'],'attributes':_0x2f26a9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x40a29d){logger[_0xe2e4('0xd')](_0xe2e4('0x16'),_0x2d7724);logger[_0xe2e4('0xf')](_0xe2e4('0x16'),_0x2d7724,JSON[_0xe2e4('0x20')](_0x40a29d));_0x3160d0(_0x40a29d);})[_0xe2e4('0x21')](function(_0x55525d){logger[_0xe2e4('0x11')]('ShowSetting',_0x55525d[_0xe2e4('0x13')],_0x2d7724);_0x5a9ca8(_0xf00f3f[_0xe2e4('0x11')](0x1f4,_0x55525d[_0xe2e4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d8c3daf..3f95d90 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(_0x50696d,_0xa93340){var _0x2449c2=function(_0x29ce03){while(--_0x29ce03){_0x50696d['push'](_0x50696d['shift']());}};_0x2449c2(++_0xa93340);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',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(_0x46ee4d,_0x21ae2d){var _0x4bce9e=function(_0x5ec52b){while(--_0x5ec52b){_0x46ee4d['push'](_0x46ee4d['shift']());}};_0x4bce9e(++_0x21ae2d);}(_0x7a54,0x106));var _0x47a5=function(_0x3b90e6,_0x5b9af8){_0x3b90e6=_0x3b90e6-0x0;var _0x30136c=_0x7a54[_0x3b90e6];return _0x30136c;};'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 17a7049..4dfe214 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 _0x6115=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','generate','plivo','csc','infobip','intelepeer','ENUM','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x5ea326,_0x3d52fa){var _0x48cf87=function(_0xb15ba1){while(--_0xb15ba1){_0x5ea326['push'](_0x5ea326['shift']());}};_0x48cf87(++_0x3d52fa);}(_0x6115,0x132));var _0x5611=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6115[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5611('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x5611('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x5611('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5611('0x2')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('twilio','skebby','connectel','clicksend',_0x5611('0x3'),'clickatell','bandwidth',_0x5611('0x4'),_0x5611('0x5'),_0x5611('0x6'))},'accountSid':{'type':Sequelize[_0x5611('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x5611('0x1')]},'smsMethod':{'type':Sequelize[_0x5611('0x7')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x5611('0x1')]},'apiKey':{'type':Sequelize[_0x5611('0x1')]},'applicationId':{'type':Sequelize[_0x5611('0x1')]},'accountId':{'type':Sequelize[_0x5611('0x1')]},'senderString':{'type':Sequelize[_0x5611('0x1')]},'deliveryReport':{'type':Sequelize[_0x5611('0x8')],'defaultValue':![]},'description':{'type':Sequelize[_0x5611('0x1')]},'notificationTemplate':{'type':Sequelize[_0x5611('0x9')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5611('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5611('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5611('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5611('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5611('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5611('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x5611('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5611('0xa')],'comment':_0x5611('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x5611('0x8')],'defaultValue':![],'comment':_0x5611('0xc'),'set':function(_0x1ea4b5){if(!_0x1ea4b5)this[_0x5611('0xd')](_0x5611('0xe'),null);this[_0x5611('0xd')](_0x5611('0xf'),_0x1ea4b5);}}}; \ No newline at end of file +var _0x51b6=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER'];(function(_0x93714c,_0x5906d2){var _0x5bc167=function(_0x2053f5){while(--_0x2053f5){_0x93714c['push'](_0x93714c['shift']());}};_0x5bc167(++_0x5906d2);}(_0x51b6,0x9d));var _0x651b=function(_0x3a8771,_0x2e0b8e){_0x3a8771=_0x3a8771-0x0;var _0x2dcb53=_0x51b6[_0x3a8771];return _0x2dcb53;};'use strict';var Sequelize=require(_0x651b('0x0'));var rs=require(_0x651b('0x1'));module[_0x651b('0x2')]={'name':{'type':Sequelize[_0x651b('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x651b('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x651b('0x3')],'defaultValue':function(){return rs[_0x651b('0x4')]();}},'phone':{'type':Sequelize[_0x651b('0x3')]},'type':{'type':Sequelize[_0x651b('0x5')](_0x651b('0x6'),_0x651b('0x7'),_0x651b('0x8'),_0x651b('0x9'),_0x651b('0xa'),_0x651b('0xb'),_0x651b('0xc'),_0x651b('0xd'),_0x651b('0xe'),_0x651b('0xf'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x651b('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x651b('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x651b('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x651b('0x3')]},'senderString':{'type':Sequelize[_0x651b('0x3')]},'deliveryReport':{'type':Sequelize[_0x651b('0x10')],'defaultValue':![]},'description':{'type':Sequelize[_0x651b('0x3')]},'notificationTemplate':{'type':Sequelize[_0x651b('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x651b('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x651b('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x651b('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x651b('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x651b('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x651b('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x651b('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x651b('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x651b('0x12')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x651b('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x590ae8){if(!_0x590ae8)this[_0x651b('0x13')](_0x651b('0x14'),null);this[_0x651b('0x13')](_0x651b('0x15'),_0x590ae8);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 4bb7ac0..1a948b9 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 _0xd571=['findAll','rows','catch','show','params','Pause','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','nolimit','SmsAccountId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','message_id','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','replyMessageId','bandwidth','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','ListId','CmContact','Contacts','defaults','contact','SmsInteraction','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','User','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','addApplications','transaction','sequelize','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','out','SmsMessage','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','intelepeer','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x327e1d,_0x3223f5){var _0x161d3b=function(_0x4ae352){while(--_0x4ae352){_0x327e1d['push'](_0x327e1d['shift']());}};_0x161d3b(++_0x3223f5);}(_0xd571,0x8e));var _0x1d57=function(_0x5eafeb,_0x916bb7){_0x5eafeb=_0x5eafeb-0x0;var _0x29e1c5=_0xd571[_0x5eafeb];return _0x29e1c5;};'use strict';var emlformat=require(_0x1d57('0x0'));var rimraf=require(_0x1d57('0x1'));var zipdir=require(_0x1d57('0x2'));var jsonpatch=require(_0x1d57('0x3'));var rp=require(_0x1d57('0x4'));var moment=require('moment');var BPromise=require(_0x1d57('0x5'));var Mustache=require('mustache');var util=require(_0x1d57('0x6'));var path=require(_0x1d57('0x7'));var sox=require(_0x1d57('0x8'));var csv=require(_0x1d57('0x9'));var ejs=require(_0x1d57('0xa'));var fs=require('fs');var fs_extra=require(_0x1d57('0xb'));var _=require('lodash');var squel=require(_0x1d57('0xc'));var crypto=require(_0x1d57('0xd'));var jsforce=require(_0x1d57('0xe'));var deskjs=require(_0x1d57('0xf'));var toCsv=require(_0x1d57('0x9'));var querystring=require(_0x1d57('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1d57('0x11'));var hardwareService=require(_0x1d57('0x12'));var logger=require(_0x1d57('0x13'))(_0x1d57('0x14'));var utils=require(_0x1d57('0x15'));var config=require(_0x1d57('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1d57('0x17'))['db'];config[_0x1d57('0x18')]=_['defaults'](config[_0x1d57('0x18')],{'host':_0x1d57('0x19'),'port':0x18eb});var socket=require(_0x1d57('0x1a'))(new Redis(config[_0x1d57('0x18')]));require(_0x1d57('0x1b'))[_0x1d57('0x1c')](socket);var jayson=require(_0x1d57('0x1d'));var client=jayson['client'][_0x1d57('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x2e9346,_0x360164,_0x4b4433,_0x4eb0db){return new BPromise(function(_0x117f26,_0x2cb2fb){var _0x2a6b86=_0x4eb0db||client;return _0x2a6b86['request'](_0x2e9346,_0x4b4433)[_0x1d57('0x1f')](function(_0x211659){logger[_0x1d57('0x20')](_0x1d57('0x21'),_0x360164,'request\x20sent');logger[_0x1d57('0x22')](_0x1d57('0x23'),_0x360164,_0x1d57('0x24'),JSON[_0x1d57('0x25')](_0x211659));if(_0x211659['error']){if(_0x211659['error']['code']===0x1f4){logger[_0x1d57('0x26')]('SmsAccount,\x20%s,\x20%s',_0x360164,_0x211659[_0x1d57('0x26')]['message']);return _0x2cb2fb(_0x211659['error'][_0x1d57('0x27')]);}logger[_0x1d57('0x26')](_0x1d57('0x21'),_0x360164,_0x211659[_0x1d57('0x26')][_0x1d57('0x27')]);return _0x117f26(_0x211659[_0x1d57('0x26')][_0x1d57('0x27')]);}else{logger[_0x1d57('0x20')](_0x1d57('0x21'),_0x360164,'request\x20sent');_0x117f26(_0x211659[_0x1d57('0x28')]['message']);}})['catch'](function(_0x5b6d81){logger[_0x1d57('0x26')](_0x1d57('0x21'),_0x360164,_0x5b6d81);_0x2cb2fb(_0x5b6d81);});});}function respondWithStatusCode(_0x39ec83,_0x4ae713){_0x4ae713=_0x4ae713||0xcc;return function(_0xee6017){if(_0xee6017){return _0x39ec83['sendStatus'](_0x4ae713);}return _0x39ec83[_0x1d57('0x29')](_0x4ae713)[_0x1d57('0x2a')]();};}function respondWithResult(_0x301069,_0x2ed837){_0x2ed837=_0x2ed837||0xc8;return function(_0x4e9e50){if(_0x4e9e50){return _0x301069[_0x1d57('0x29')](_0x2ed837)['json'](_0x4e9e50);}};}function respondWithFilteredResult(_0x457db1,_0xf4f2e){return function(_0x1e95b4){if(_0x1e95b4){var _0x1ce3a5=typeof _0xf4f2e[_0x1d57('0x2b')]===_0x1d57('0x2c')&&typeof _0xf4f2e['limit']===_0x1d57('0x2c');var _0x2bf470=_0x1e95b4[_0x1d57('0x2d')];var _0x40d544=_0x1ce3a5?0x0:_0xf4f2e[_0x1d57('0x2b')];var _0x48ef5a=_0x1ce3a5?_0x1e95b4[_0x1d57('0x2d')]:_0xf4f2e['offset']+_0xf4f2e[_0x1d57('0x2e')];var _0x3813a9;if(_0x48ef5a>=_0x2bf470){_0x48ef5a=_0x2bf470;_0x3813a9=0xc8;}else{_0x3813a9=0xce;}_0x457db1[_0x1d57('0x29')](_0x3813a9);return _0x457db1[_0x1d57('0x2f')](_0x1d57('0x30'),_0x40d544+'-'+_0x48ef5a+'/'+_0x2bf470)[_0x1d57('0x31')](_0x1e95b4);}return null;};}function patchUpdates(_0x4cb027){return function(_0x16a21a){try{jsonpatch[_0x1d57('0x32')](_0x16a21a,_0x4cb027,!![]);}catch(_0x56093a){return BPromise[_0x1d57('0x33')](_0x56093a);}return _0x16a21a['save']();};}function saveUpdates(_0x3a92aa,_0x41213d){return function(_0x302c07){if(_0x302c07){return _0x302c07[_0x1d57('0x34')](_0x3a92aa)[_0x1d57('0x1f')](function(_0x20d638){return _0x20d638;});}return null;};}function removeEntity(_0x1f6b4b,_0x1f6caf){return function(_0x171b6b){if(_0x171b6b){return _0x171b6b[_0x1d57('0x35')]()[_0x1d57('0x1f')](function(){var _0x18423a=_0x171b6b[_0x1d57('0x36')]({'plain':!![]});var _0x3a48bb=_0x1d57('0x37');return db[_0x1d57('0x38')][_0x1d57('0x35')]({'where':{'type':_0x3a48bb,'resourceId':_0x18423a['id']}})[_0x1d57('0x1f')](function(){return _0x171b6b;});})[_0x1d57('0x1f')](function(){_0x1f6b4b[_0x1d57('0x29')](0xcc)[_0x1d57('0x2a')]();});}};}function handleEntityNotFound(_0x416342,_0x4f4d82){return function(_0xe34bbd){if(!_0xe34bbd){_0x416342[_0x1d57('0x39')](0x194);}return _0xe34bbd;};}function handleError(_0x302221,_0x34d2ae){_0x34d2ae=_0x34d2ae||0x1f4;return function(_0x4af16c){logger[_0x1d57('0x26')](_0x4af16c[_0x1d57('0x3a')]);if(_0x4af16c['name']){delete _0x4af16c[_0x1d57('0x3b')];}_0x302221[_0x1d57('0x29')](_0x34d2ae)[_0x1d57('0x3c')](_0x4af16c);};}exports['index']=function(_0x2ee586,_0x50bc4f){var _0x286683={'include':[{'model':db['Pause'],'as':_0x1d57('0x3d')}]},_0x4b265c={},_0x4ec670={'count':0x0,'rows':[]};var _0xdad4d8=_[_0x1d57('0x3e')](db[_0x1d57('0x3f')][_0x1d57('0x40')],function(_0x47af1d){return{'name':_0x47af1d[_0x1d57('0x41')],'type':_0x47af1d[_0x1d57('0x42')]['key']};});_0x4b265c[_0x1d57('0x43')]=_['map'](_0xdad4d8,'name');_0x4b265c[_0x1d57('0x44')]=_[_0x1d57('0x45')](_0x2ee586['query']);_0x4b265c[_0x1d57('0x46')]=_['intersection'](_0x4b265c[_0x1d57('0x43')],_0x4b265c['query']);_0x286683[_0x1d57('0x47')]=_[_0x1d57('0x48')](_0x4b265c['model'],qs['fields'](_0x2ee586[_0x1d57('0x44')][_0x1d57('0x49')]));_0x286683['attributes']=_0x286683[_0x1d57('0x47')]['length']?_0x286683['attributes']:_0x4b265c[_0x1d57('0x43')];if(!_0x2ee586[_0x1d57('0x44')][_0x1d57('0x4a')]('nolimit')){_0x286683[_0x1d57('0x2e')]=qs[_0x1d57('0x2e')](_0x2ee586[_0x1d57('0x44')]['limit']);_0x286683[_0x1d57('0x2b')]=qs['offset'](_0x2ee586[_0x1d57('0x44')][_0x1d57('0x2b')]);}_0x286683[_0x1d57('0x4b')]=qs[_0x1d57('0x4c')](_0x2ee586[_0x1d57('0x44')][_0x1d57('0x4c')]);_0x286683[_0x1d57('0x4d')]=qs['filters'](_[_0x1d57('0x4e')](_0x2ee586[_0x1d57('0x44')],_0x4b265c[_0x1d57('0x46')]),_0xdad4d8);if(_0x2ee586['query'][_0x1d57('0x4f')]){_0x286683['where']=_[_0x1d57('0x50')](_0x286683['where'],{'$or':_[_0x1d57('0x3e')](_0xdad4d8,function(_0x58dd57){if(_0x58dd57['type']!==_0x1d57('0x51')){var _0x41149e={};_0x41149e[_0x58dd57[_0x1d57('0x3b')]]={'$like':'%'+_0x2ee586[_0x1d57('0x44')][_0x1d57('0x4f')]+'%'};return _0x41149e;}})});}_0x286683=_[_0x1d57('0x50')]({},_0x286683,_0x2ee586[_0x1d57('0x52')]);var _0xd8f3b4={'where':_0x286683[_0x1d57('0x4d')]};return db[_0x1d57('0x3f')][_0x1d57('0x2d')](_0xd8f3b4)[_0x1d57('0x1f')](function(_0x1df7a3){_0x4ec670[_0x1d57('0x2d')]=_0x1df7a3;if(_0x2ee586[_0x1d57('0x44')][_0x1d57('0x53')]){_0x286683['include']=[{'all':!![]}];}return db['SmsAccount'][_0x1d57('0x54')](_0x286683);})[_0x1d57('0x1f')](function(_0x477c1e){_0x4ec670[_0x1d57('0x55')]=_0x477c1e;return _0x4ec670;})[_0x1d57('0x1f')](respondWithFilteredResult(_0x50bc4f,_0x286683))[_0x1d57('0x56')](handleError(_0x50bc4f,null));};exports[_0x1d57('0x57')]=function(_0x46bf05,_0x1f4bac){var _0x4b554c={'raw':![],'where':{'id':_0x46bf05[_0x1d57('0x58')]['id']},'include':[{'model':db[_0x1d57('0x59')],'as':'mandatoryDispositionPause'}]},_0x45d762={};_0x45d762[_0x1d57('0x43')]=_[_0x1d57('0x45')](db['SmsAccount'][_0x1d57('0x40')]);_0x45d762[_0x1d57('0x44')]=_[_0x1d57('0x45')](_0x46bf05[_0x1d57('0x44')]);_0x45d762[_0x1d57('0x46')]=_[_0x1d57('0x48')](_0x45d762['model'],_0x45d762[_0x1d57('0x44')]);_0x4b554c[_0x1d57('0x47')]=_['intersection'](_0x45d762[_0x1d57('0x43')],qs[_0x1d57('0x49')](_0x46bf05[_0x1d57('0x44')][_0x1d57('0x49')]));_0x4b554c[_0x1d57('0x47')]=_0x4b554c['attributes'][_0x1d57('0x5a')]?_0x4b554c[_0x1d57('0x47')]:_0x45d762['model'];if(_0x46bf05[_0x1d57('0x44')][_0x1d57('0x53')]){_0x4b554c[_0x1d57('0x5b')]=[{'all':!![]}];}_0x4b554c=_[_0x1d57('0x50')]({},_0x4b554c,_0x46bf05[_0x1d57('0x52')]);return db[_0x1d57('0x3f')][_0x1d57('0x5c')](_0x4b554c)[_0x1d57('0x1f')](handleEntityNotFound(_0x1f4bac,null))[_0x1d57('0x1f')](respondWithResult(_0x1f4bac,null))['catch'](handleError(_0x1f4bac,null));};exports[_0x1d57('0x5d')]=function(_0x564f12,_0x55bc90){return db[_0x1d57('0x3f')][_0x1d57('0x5d')](_0x564f12[_0x1d57('0x5e')],{})[_0x1d57('0x1f')](function(_0xa9980b){var _0x224177=_0x564f12['user'][_0x1d57('0x36')]({'plain':!![]});if(!_0x224177)throw new Error(_0x1d57('0x5f'));if(_0x224177[_0x1d57('0x60')]===_0x1d57('0x61')){var _0x34320c=_0xa9980b[_0x1d57('0x36')]({'plain':!![]});var _0x35b58b=_0x1d57('0x37');return db[_0x1d57('0x62')]['find']({'where':{'name':_0x35b58b,'userProfileId':_0x224177['userProfileId']},'raw':!![]})['then'](function(_0xaa8d6b){if(_0xaa8d6b&&_0xaa8d6b[_0x1d57('0x63')]===0x0){return db[_0x1d57('0x38')]['create']({'name':_0x34320c[_0x1d57('0x3b')],'resourceId':_0x34320c['id'],'type':_0xaa8d6b[_0x1d57('0x3b')],'sectionId':_0xaa8d6b['id']},{})[_0x1d57('0x1f')](function(){return _0xa9980b;});}else{return _0xa9980b;}})[_0x1d57('0x56')](function(_0x3fa5b1){logger[_0x1d57('0x26')](_0x1d57('0x64'),_0x3fa5b1);throw _0x3fa5b1;});}return _0xa9980b;})[_0x1d57('0x1f')](respondWithResult(_0x55bc90,0xc9))['catch'](handleError(_0x55bc90,null));};exports[_0x1d57('0x34')]=function(_0x3d0430,_0x135002){if(_0x3d0430['body']['id']){delete _0x3d0430[_0x1d57('0x5e')]['id'];}return db[_0x1d57('0x3f')][_0x1d57('0x5c')]({'where':{'id':_0x3d0430[_0x1d57('0x58')]['id']},'include':[{'model':db[_0x1d57('0x59')],'as':'mandatoryDispositionPause'}]})[_0x1d57('0x1f')](handleEntityNotFound(_0x135002,null))['then'](saveUpdates(_0x3d0430[_0x1d57('0x5e')],null))[_0x1d57('0x1f')](respondWithResult(_0x135002,null))[_0x1d57('0x56')](handleError(_0x135002,null));};exports[_0x1d57('0x35')]=function(_0x67ffb7,_0x2dcd87){return db[_0x1d57('0x3f')][_0x1d57('0x5c')]({'where':{'id':_0x67ffb7[_0x1d57('0x58')]['id']}})[_0x1d57('0x1f')](handleEntityNotFound(_0x2dcd87,null))[_0x1d57('0x1f')](removeEntity(_0x2dcd87,null))[_0x1d57('0x56')](handleError(_0x2dcd87,null));};exports['describe']=function(_0x31deb2,_0x341dd1){return db[_0x1d57('0x3f')][_0x1d57('0x65')]()[_0x1d57('0x1f')](respondWithResult(_0x341dd1,null))[_0x1d57('0x56')](handleError(_0x341dd1,null));};exports[_0x1d57('0x66')]=function(_0x4d7d0e,_0x3d0cd2,_0x1ec80e){if(_0x4d7d0e[_0x1d57('0x5e')]['id']){delete _0x4d7d0e[_0x1d57('0x5e')]['id'];}return db[_0x1d57('0x3f')][_0x1d57('0x5c')]({'where':{'id':_0x4d7d0e['params']['id']}})[_0x1d57('0x1f')](handleEntityNotFound(_0x3d0cd2,null))['then'](function(_0x198711){if(_0x198711){_0x4d7d0e[_0x1d57('0x5e')]['SmsAccountId']=_0x198711['id'];return db['Disposition']['create'](_0x4d7d0e[_0x1d57('0x5e')]);}})[_0x1d57('0x1f')](respondWithResult(_0x3d0cd2,null))[_0x1d57('0x56')](handleError(_0x3d0cd2,null));};exports[_0x1d57('0x67')]=function(_0x3de9a0,_0x1a9bcc,_0x52bf86){var _0xfe8ba2={'raw':![],'where':{}};var _0x2b2a0f={};var _0x258777={'count':0x0,'rows':[]};return db[_0x1d57('0x3f')][_0x1d57('0x68')]({'where':{'id':_0x3de9a0[_0x1d57('0x58')]['id']}})['then'](handleEntityNotFound(_0x1a9bcc,null))[_0x1d57('0x1f')](function(_0x242043){if(_0x242043){_0x2b2a0f[_0x1d57('0x43')]=_['keys'](db[_0x1d57('0x69')]['rawAttributes']);_0x2b2a0f[_0x1d57('0x44')]=_[_0x1d57('0x45')](_0x3de9a0[_0x1d57('0x44')]);_0x2b2a0f[_0x1d57('0x46')]=_['intersection'](_0x2b2a0f['model'],_0x2b2a0f[_0x1d57('0x44')]);_0xfe8ba2['attributes']=_[_0x1d57('0x48')](_0x2b2a0f[_0x1d57('0x43')],qs[_0x1d57('0x49')](_0x3de9a0['query'][_0x1d57('0x49')]));_0xfe8ba2[_0x1d57('0x47')]=_0xfe8ba2[_0x1d57('0x47')][_0x1d57('0x5a')]?_0xfe8ba2[_0x1d57('0x47')]:_0x2b2a0f[_0x1d57('0x43')];if(!_0x3de9a0[_0x1d57('0x44')][_0x1d57('0x4a')](_0x1d57('0x6a'))){_0xfe8ba2[_0x1d57('0x2e')]=qs[_0x1d57('0x2e')](_0x3de9a0[_0x1d57('0x44')][_0x1d57('0x2e')]);_0xfe8ba2[_0x1d57('0x2b')]=qs['offset'](_0x3de9a0[_0x1d57('0x44')]['offset']);}_0xfe8ba2['order']=qs['sort'](_0x3de9a0['query'][_0x1d57('0x4c')]);_0xfe8ba2['where']=qs['filters'](_[_0x1d57('0x4e')](_0x3de9a0[_0x1d57('0x44')],_0x2b2a0f['filters']));_0xfe8ba2[_0x1d57('0x4d')][_0x1d57('0x6b')]=_0x242043['id'];if(_0x3de9a0['query']['filter']){_0xfe8ba2['where']=_[_0x1d57('0x50')](_0xfe8ba2['where'],{'$or':_[_0x1d57('0x3e')](_0xfe8ba2[_0x1d57('0x47')],function(_0x1af046){var _0x552f43={};_0x552f43[_0x1af046]={'$like':'%'+_0x3de9a0[_0x1d57('0x44')]['filter']+'%'};return _0x552f43;})});}_0xfe8ba2=_[_0x1d57('0x50')]({},_0xfe8ba2,_0x3de9a0[_0x1d57('0x52')]);return db[_0x1d57('0x69')][_0x1d57('0x2d')]({'where':_0xfe8ba2[_0x1d57('0x4d')]})[_0x1d57('0x1f')](function(_0xf2160b){_0x258777[_0x1d57('0x2d')]=_0xf2160b;if(_0x3de9a0[_0x1d57('0x44')][_0x1d57('0x53')]){_0xfe8ba2[_0x1d57('0x5b')]=[{'all':!![]}];}return db[_0x1d57('0x69')][_0x1d57('0x54')](_0xfe8ba2);})[_0x1d57('0x1f')](function(_0x18a0bb){_0x258777[_0x1d57('0x55')]=_0x18a0bb;return _0x258777;});}})[_0x1d57('0x1f')](respondWithFilteredResult(_0x1a9bcc,_0xfe8ba2))[_0x1d57('0x56')](handleError(_0x1a9bcc,null));};exports[_0x1d57('0x6c')]=function(_0xc184c5,_0x35d0a0,_0x548bcb){return db[_0x1d57('0x3f')][_0x1d57('0x5c')]({'where':{'id':_0xc184c5['params']['id']}})[_0x1d57('0x1f')](handleEntityNotFound(_0x35d0a0,null))[_0x1d57('0x1f')](function(_0x2499e7){if(_0x2499e7){return _0x2499e7[_0x1d57('0x6c')](_0xc184c5['query'][_0x1d57('0x6d')]);}})['then'](respondWithStatusCode(_0x35d0a0,null))['catch'](handleError(_0x35d0a0,null));};exports[_0x1d57('0x6e')]=function(_0x1e88ff,_0x52a9ed,_0x43e3c0){if(_0x1e88ff[_0x1d57('0x5e')]['id']){delete _0x1e88ff[_0x1d57('0x5e')]['id'];}return db[_0x1d57('0x3f')][_0x1d57('0x5c')]({'where':{'id':_0x1e88ff[_0x1d57('0x58')]['id']}})[_0x1d57('0x1f')](handleEntityNotFound(_0x52a9ed,null))[_0x1d57('0x1f')](function(_0x5399f4){if(_0x5399f4){_0x1e88ff[_0x1d57('0x5e')]['SmsAccountId']=_0x5399f4['id'];return db[_0x1d57('0x6f')]['create'](_0x1e88ff[_0x1d57('0x5e')]);}})[_0x1d57('0x1f')](respondWithResult(_0x52a9ed,null))['catch'](handleError(_0x52a9ed,null));};exports['getAnswers']=function(_0x5c88c0,_0x10e32a,_0x2c2207){var _0x549eb0={'raw':![],'where':{}};var _0x4b343e={};var _0x272328={'count':0x0,'rows':[]};return db[_0x1d57('0x3f')]['findOne']({'where':{'id':_0x5c88c0[_0x1d57('0x58')]['id']}})['then'](handleEntityNotFound(_0x10e32a,null))[_0x1d57('0x1f')](function(_0x5d9b52){if(_0x5d9b52){_0x4b343e['model']=_[_0x1d57('0x45')](db[_0x1d57('0x6f')]['rawAttributes']);_0x4b343e['query']=_['keys'](_0x5c88c0['query']);_0x4b343e['filters']=_[_0x1d57('0x48')](_0x4b343e[_0x1d57('0x43')],_0x4b343e['query']);_0x549eb0[_0x1d57('0x47')]=_['intersection'](_0x4b343e[_0x1d57('0x43')],qs[_0x1d57('0x49')](_0x5c88c0[_0x1d57('0x44')][_0x1d57('0x49')]));_0x549eb0['attributes']=_0x549eb0[_0x1d57('0x47')][_0x1d57('0x5a')]?_0x549eb0[_0x1d57('0x47')]:_0x4b343e[_0x1d57('0x43')];if(!_0x5c88c0[_0x1d57('0x44')]['hasOwnProperty'](_0x1d57('0x6a'))){_0x549eb0[_0x1d57('0x2e')]=qs[_0x1d57('0x2e')](_0x5c88c0[_0x1d57('0x44')][_0x1d57('0x2e')]);_0x549eb0[_0x1d57('0x2b')]=qs[_0x1d57('0x2b')](_0x5c88c0[_0x1d57('0x44')][_0x1d57('0x2b')]);}_0x549eb0[_0x1d57('0x4b')]=qs[_0x1d57('0x4c')](_0x5c88c0[_0x1d57('0x44')][_0x1d57('0x4c')]);_0x549eb0[_0x1d57('0x4d')]=qs[_0x1d57('0x46')](_[_0x1d57('0x4e')](_0x5c88c0[_0x1d57('0x44')],_0x4b343e[_0x1d57('0x46')]));_0x549eb0[_0x1d57('0x4d')][_0x1d57('0x6b')]=_0x5d9b52['id'];if(_0x5c88c0['query'][_0x1d57('0x4f')]){_0x549eb0[_0x1d57('0x4d')]=_['merge'](_0x549eb0['where'],{'$or':_['map'](_0x549eb0[_0x1d57('0x47')],function(_0x159602){var _0x6a9157={};_0x6a9157[_0x159602]={'$like':'%'+_0x5c88c0[_0x1d57('0x44')][_0x1d57('0x4f')]+'%'};return _0x6a9157;})});}_0x549eb0=_[_0x1d57('0x50')]({},_0x549eb0,_0x5c88c0['options']);return db[_0x1d57('0x6f')][_0x1d57('0x2d')]({'where':_0x549eb0['where']})['then'](function(_0x450ba5){_0x272328[_0x1d57('0x2d')]=_0x450ba5;if(_0x5c88c0['query']['includeAll']){_0x549eb0['include']=[{'all':!![]}];}return db[_0x1d57('0x6f')][_0x1d57('0x54')](_0x549eb0);})[_0x1d57('0x1f')](function(_0x5e8c2c){_0x272328['rows']=_0x5e8c2c;return _0x272328;});}})[_0x1d57('0x1f')](respondWithFilteredResult(_0x10e32a,_0x549eb0))[_0x1d57('0x56')](handleError(_0x10e32a,null));};exports['removeAnswers']=function(_0x50faca,_0x250488,_0x454377){return db['SmsAccount'][_0x1d57('0x5c')]({'where':{'id':_0x50faca[_0x1d57('0x58')]['id']}})[_0x1d57('0x1f')](handleEntityNotFound(_0x250488,null))[_0x1d57('0x1f')](function(_0x1d65d8){if(_0x1d65d8){return _0x1d65d8[_0x1d57('0x70')](_0x50faca[_0x1d57('0x44')]['ids']);}})[_0x1d57('0x1f')](respondWithStatusCode(_0x250488,null))[_0x1d57('0x56')](handleError(_0x250488,null));};exports[_0x1d57('0x71')]=function(_0x46dd52,_0xbd6ff,_0xcf72f1){var _0x1dbdbe={'channel':_0x1d57('0x72')};var _0xc30fae=[];var _0x16dcac=[];var _0x23c266={};return db[_0x1d57('0x3f')]['find']({'where':{'id':_0x46dd52[_0x1d57('0x58')]['id']},'include':[{'model':db[_0x1d57('0x73')],'as':_0x1d57('0x74')}]})['then'](handleEntityNotFound(_0xbd6ff,null))[_0x1d57('0x1f')](function(_0x29cfaa){_0x1dbdbe[_0x1d57('0x75')]=_0x29cfaa;_0x1dbdbe[_0x1d57('0x76')]=_[_0x1d57('0x77')](_0x29cfaa[_0x1d57('0x74')],[_0x1d57('0x78')],[_0x1d57('0x79')]);if(_0x1dbdbe['account'][_0x1d57('0x74')]){delete _0x1dbdbe[_0x1d57('0x75')]['Applications'];}return db['CmContact']['describe']();})[_0x1d57('0x1f')](function(_0x1eebb0){if(!_0x1eebb0){throw new db[(_0x1d57('0x7a'))][(_0x1d57('0x7b'))](_0x1d57('0x7c'));}_0xc30fae=_[_0x1d57('0x7d')](_['keys'](_0x1eebb0),[_0x1d57('0x7e'),'updatedAt']);_0x16dcac=_[_0x1d57('0x7d')](_[_0x1d57('0x45')](_0x1eebb0),[_0x1d57('0x7e'),_0x1d57('0x7f'),_0x1d57('0x80'),'ListId']);_0x1dbdbe[_0x1d57('0x5e')]={'mapKey':_0x1d57('0x81')};if(_0x1dbdbe[_0x1d57('0x75')][_0x1d57('0x42')]){switch(_0x1dbdbe[_0x1d57('0x75')][_0x1d57('0x42')]){case _0x1d57('0x82'):_0x1dbdbe['body'][_0x1d57('0x83')]=_0x46dd52[_0x1d57('0x5e')]['From'];_0x1dbdbe['body'][_0x1d57('0x5e')]=_0x46dd52[_0x1d57('0x5e')][_0x1d57('0x84')];_0x1dbdbe['body'][_0x1d57('0x85')]=_0x46dd52[_0x1d57('0x5e')][_0x1d57('0x86')];break;case _0x1d57('0x87'):_0x1dbdbe[_0x1d57('0x5e')]['from']='+'+_0x46dd52['body'][_0x1d57('0x88')];_0x1dbdbe[_0x1d57('0x5e')][_0x1d57('0x5e')]=_0x46dd52['body'][_0x1d57('0x89')];break;case _0x1d57('0x8a'):_0x1dbdbe['body'][_0x1d57('0x83')]=_0x46dd52[_0x1d57('0x5e')][_0x1d57('0x83')];_0x1dbdbe[_0x1d57('0x5e')]['body']=_0x46dd52[_0x1d57('0x5e')][_0x1d57('0x27')];break;case'clicksend':_0x1dbdbe[_0x1d57('0x5e')][_0x1d57('0x83')]=_0x46dd52[_0x1d57('0x5e')][_0x1d57('0x83')];_0x1dbdbe[_0x1d57('0x5e')][_0x1d57('0x5e')]=_0x46dd52[_0x1d57('0x5e')][_0x1d57('0x5e')];_0x1dbdbe['body'][_0x1d57('0x85')]=_0x46dd52[_0x1d57('0x5e')][_0x1d57('0x8b')];break;case'plivo':_0x1dbdbe['body'][_0x1d57('0x83')]=_0x46dd52[_0x1d57('0x5e')]['From'];_0x1dbdbe['body']['body']=_0x46dd52[_0x1d57('0x5e')][_0x1d57('0x8c')];_0x1dbdbe[_0x1d57('0x5e')][_0x1d57('0x85')]=_0x46dd52['body'][_0x1d57('0x8d')];break;case _0x1d57('0x8e'):_0x1dbdbe[_0x1d57('0x5e')]['from']='+'+_0x46dd52[_0x1d57('0x5e')][_0x1d57('0x8f')][0x0][_0x1d57('0x83')];_0x1dbdbe[_0x1d57('0x5e')][_0x1d57('0x5e')]=_0x46dd52[_0x1d57('0x5e')]['results'][0x0][_0x1d57('0x89')];_0x1dbdbe['body']['messageId']=_0x46dd52['body'][_0x1d57('0x8f')][0x0][_0x1d57('0x85')];break;case _0x1d57('0x90'):_0x1dbdbe[_0x1d57('0x5e')][_0x1d57('0x83')]=_0x46dd52['body']['originatingAddress'];_0x1dbdbe['body']['body']=_0x46dd52[_0x1d57('0x5e')][_0x1d57('0x91')][_0x1d57('0x27')];break;case _0x1d57('0x92'):_0x1dbdbe['body'][_0x1d57('0x83')]=_0x46dd52[_0x1d57('0x5e')]['fromNumber'];_0x1dbdbe[_0x1d57('0x5e')][_0x1d57('0x5e')]=_0x46dd52['body']['text'];_0x1dbdbe['body'][_0x1d57('0x85')]=_0x46dd52[_0x1d57('0x5e')][_0x1d57('0x93')];break;case _0x1d57('0x94'):_0x1dbdbe[_0x1d57('0x5e')][_0x1d57('0x85')]=_0x46dd52['body'][0x0][_0x1d57('0x27')]['id'];_0x1dbdbe[_0x1d57('0x5e')]['from']=_0x46dd52[_0x1d57('0x5e')][0x0]['message']['from'];_0x1dbdbe['body'][_0x1d57('0x5e')]=_0x46dd52[_0x1d57('0x5e')][0x0]['message'][_0x1d57('0x89')];break;case'intelepeer':_0x1dbdbe[_0x1d57('0x5e')][_0x1d57('0x83')]=_0x46dd52['body']['from'];_0x1dbdbe[_0x1d57('0x5e')][_0x1d57('0x5e')]=_0x46dd52['body'][_0x1d57('0x27')];_0x1dbdbe['body'][_0x1d57('0x85')]=_0x46dd52[_0x1d57('0x5e')]['refid'];break;}}if(_0x1dbdbe[_0x1d57('0x5e')]['id']){delete _0x1dbdbe[_0x1d57('0x5e')]['id'];}if(_[_0x1d57('0x95')](_0x1dbdbe['body']['from'])){throw new db[(_0x1d57('0x7a'))][(_0x1d57('0x7b'))]('from\x20is\x20mandatory');}if(_[_0x1d57('0x95')](_0x1dbdbe['body']['body'])||_0x1dbdbe['body']['body']===''){throw new db['Sequelize'][(_0x1d57('0x7b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1d57('0x95')](_0x1dbdbe[_0x1d57('0x5e')][_0x1d57('0x96')])){throw new db[(_0x1d57('0x7a'))][(_0x1d57('0x7b'))](_0x1d57('0x97')+_0x16dcac);}if(!_[_0x1d57('0x98')](_0x16dcac,_0x1dbdbe[_0x1d57('0x5e')][_0x1d57('0x96')])){throw new db[(_0x1d57('0x7a'))][(_0x1d57('0x7b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x16dcac);}_0x23c266[_0x1dbdbe[_0x1d57('0x5e')][_0x1d57('0x96')]]=_0x1dbdbe[_0x1d57('0x5e')][_0x1d57('0x83')];return db['CmList'][_0x1d57('0x5c')]({'where':{'id':_0x1dbdbe['account'][_0x1d57('0x99')]},'include':[{'model':db[_0x1d57('0x9a')],'as':'Contacts','where':_0x23c266,'limit':0x1,'order':[[_0x1d57('0x7f'),'DESC']]}]});})[_0x1d57('0x1f')](handleEntityNotFound(_0xbd6ff,null))[_0x1d57('0x1f')](function(_0x457868){if(_0x457868){_0x1dbdbe['list']=_['omit'](_0x457868,[_0x1d57('0x9b')]);if(_0x457868['Contacts'][_0x1d57('0x5a')]){return _0x457868['Contacts'][0x0];}var _0x36e778=_[_0x1d57('0x9c')](_0x1dbdbe['body'],{'firstName':_0x1dbdbe['body']['from'],'ListId':_0x457868['id']});_0x36e778[_0x1dbdbe['body'][_0x1d57('0x96')]]=_0x1dbdbe[_0x1d57('0x5e')][_0x1d57('0x83')];return db[_0x1d57('0x9a')]['create'](_0x36e778,{'fields':_0xc30fae,'raw':!![]});}})[_0x1d57('0x1f')](handleEntityNotFound(_0xbd6ff,null))[_0x1d57('0x1f')](function(_0x374c53){if(_0x374c53){_0x1dbdbe[_0x1d57('0x9d')]=_0x374c53;var _0x344b2f={'ContactId':_0x374c53['id'],'phone':_0x1dbdbe[_0x1d57('0x5e')]['from'],'SmsAccountId':_0x46dd52[_0x1d57('0x58')]['id']};var _0x4b71ef={'ContactId':_0x374c53['id'],'SmsAccountId':_0x46dd52['params']['id'],'closed':![]};return db[_0x1d57('0x9e')][_0x1d57('0x5c')]({'where':_0x4b71ef})[_0x1d57('0x1f')](function(_0x3a4ddf){if(_0x3a4ddf){return[_0x3a4ddf,![]];}return db[_0x1d57('0x9e')][_0x1d57('0x5d')](_0x344b2f)['then'](function(_0xe4bad9){return[_0xe4bad9,!![]];});});}})['spread'](function(_0x3a3ab1,_0x6493f){_0x1dbdbe[_0x1d57('0x9f')]=_0x3a3ab1['get']({'plain':!![]});_0x1dbdbe[_0x1d57('0x9f')][_0x1d57('0xa0')]=![];if(_0x6493f){if(_0x1dbdbe[_0x1d57('0x75')]['autoclose']){_0x1dbdbe['applications'][_0x1d57('0xa1')]({'id':0x0,'priority':_0x1dbdbe[_0x1d57('0x76')][_0x1d57('0x5a')]+0x1,'app':_0x1d57('0xa2'),'appdata':_0x1d57('0xa3'),'interval':_0x1d57('0xa4')});}_0x1dbdbe[_0x1d57('0x9f')][_0x1d57('0xa0')]=!![];}return db['SmsMessage'][_0x1d57('0x5d')]({'phone':_0x1dbdbe[_0x1d57('0x5e')][_0x1d57('0x83')],'messageId':_0x1dbdbe[_0x1d57('0x5e')]['messageId'],'body':_0x1dbdbe[_0x1d57('0x5e')]['body'],'SmsAccountId':_0x46dd52[_0x1d57('0x58')]['id'],'SmsInteractionId':_0x3a3ab1['id'],'direction':'in','ContactId':_0x3a3ab1[_0x1d57('0xa5')],'AttachmentId':_0x1dbdbe[_0x1d57('0x5e')][_0x1d57('0xa6')]});})[_0x1d57('0x1f')](function(_0x278b53){_0x1dbdbe[_0x1d57('0x27')]=_0x278b53;if(!_0x1dbdbe['interaction']['UserId'])return;return db[_0x1d57('0xa7')][_0x1d57('0x5c')]({'attributes':['id',_0x1d57('0x3b')],'where':{'id':_0x1dbdbe['interaction'][_0x1d57('0xa8')]}});})[_0x1d57('0x1f')](function(_0x2a5180){if(_0x2a5180){_0x1dbdbe['applications'][_0x1d57('0xa9')]({'id':0x0,'priority':0x0,'app':_0x1d57('0xaa'),'appdata':_0x2a5180[_0x1d57('0x3b')]+','+(_0x1dbdbe[_0x1d57('0x75')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x1dbdbe['interaction']['queueId'])return;return db['SmsQueue'][_0x1d57('0x5c')]({'attributes':['id',_0x1d57('0x3b')],'where':{'id':_0x1dbdbe[_0x1d57('0x9f')]['queueId']}});})[_0x1d57('0x1f')](function(_0x4a8ba6){if(_0x4a8ba6){_0x1dbdbe['applications'][_0x1d57('0xa9')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4a8ba6['name']+','+(_0x1dbdbe['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x1d57('0xa4')});}return respondWithRpcPromise(_0x1d57('0xab'),_0x1d57('0xac'),_0x1dbdbe);})[_0x1d57('0x1f')](function(_0xfe80d6){if(_0xfe80d6){var _0x211906=0xc8;var _0x2a2a3d=_0x1d57('0xad');logger[_0x1d57('0x20')](_0x1d57('0x23'),_0x2a2a3d,_0x211906,_0x1d57('0xae'));logger[_0x1d57('0x22')](_0x1d57('0xaf'),_0x2a2a3d,_0x211906,_0x1d57('0xae'),JSON[_0x1d57('0x25')](_0xfe80d6));if(_0x1dbdbe['account'][_0x1d57('0x42')]===_0x1d57('0x82')){return _0xbd6ff[_0x1d57('0x29')](_0x211906)[_0x1d57('0x2f')](_0x1d57('0xb0'),_0x1d57('0xb1'))[_0x1d57('0x3c')]('\x0a');}else{return _0xbd6ff[_0x1d57('0x29')](_0x211906)[_0x1d57('0x31')](_0xfe80d6);}}})[_0x1d57('0x56')](handleError(_0xbd6ff,null));};exports[_0x1d57('0xb2')]=function(_0x581dae,_0x149446){var _0x312f5b=_0x581dae['params']['id'];var _0x5cd3a3=_0x581dae['body'];var _0x5c8477=0xc8;var _0x5abea8=null;return db['sequelize'][_0x1d57('0xb3')]({'isolationLevel':db[_0x1d57('0xb4')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x573e69){return db[_0x1d57('0x3f')][_0x1d57('0x68')]({'where':{'id':_0x312f5b},'transaction':_0x573e69})[_0x1d57('0x1f')](function(_0x5244b9){if(_0x5244b9){return db['SmsApplication'][_0x1d57('0x35')]({'where':{'SmsAccountId':_0x312f5b},'transaction':_0x573e69})[_0x1d57('0x1f')](function(){var _0x41e363=_['map'](_0x5cd3a3,function(_0x5f4e69){_0x5f4e69[_0x1d57('0x6b')]=_0x312f5b;return _0x5f4e69;});return db[_0x1d57('0x73')][_0x1d57('0xb5')](_0x41e363,{'transaction':_0x573e69});});}else{_0x5c8477=0x194;_0x5abea8=[];}});})[_0x1d57('0x1f')](function(){if(_0x5c8477!==0x194){return db['SmsApplication'][_0x1d57('0xb6')]({'where':{'SmsAccountId':_0x312f5b},'order':_0x1d57('0x78')})[_0x1d57('0x1f')](function(_0x1efe23){_0x5abea8=_0x1efe23;});}})[_0x1d57('0x56')](function(_0x340930){_0x5c8477=0x1f4;logger['error'](_0x340930[_0x1d57('0x3a')]);if(_0x340930[_0x1d57('0x3b')]){delete _0x340930[_0x1d57('0x3b')];}_0x5abea8=_0x340930;})['finally'](function(){if(_0x5abea8===null){_0x149446['sendStatus'](_0x5c8477);}else{if(_0x5c8477===0x1f4){_0x149446['status'](_0x5c8477)['send'](_0x5abea8);}else{_0x149446[_0x1d57('0x29')](_0x5c8477)[_0x1d57('0x31')](_0x5abea8);}}});};exports[_0x1d57('0xb7')]=function(_0x3860b8,_0x465c2b,_0x328a70){var _0x11f266={};var _0x379533={};var _0x363c4b;var _0x47b637;return db[_0x1d57('0x3f')][_0x1d57('0x68')]({'where':{'id':_0x3860b8[_0x1d57('0x58')]['id']}})[_0x1d57('0x1f')](handleEntityNotFound(_0x465c2b,null))[_0x1d57('0x1f')](function(_0x95948a){if(_0x95948a){_0x363c4b=_0x95948a;_0x379533[_0x1d57('0x43')]=_[_0x1d57('0x45')](db[_0x1d57('0x73')][_0x1d57('0x40')]);_0x379533[_0x1d57('0x44')]=_['keys'](_0x3860b8[_0x1d57('0x44')]);_0x379533[_0x1d57('0x46')]=_[_0x1d57('0x48')](_0x379533['model'],_0x379533[_0x1d57('0x44')]);_0x11f266[_0x1d57('0x47')]=_[_0x1d57('0x48')](_0x379533['model'],qs[_0x1d57('0x49')](_0x3860b8[_0x1d57('0x44')][_0x1d57('0x49')]));_0x11f266[_0x1d57('0x47')]=_0x11f266[_0x1d57('0x47')][_0x1d57('0x5a')]?_0x11f266[_0x1d57('0x47')]:_0x379533[_0x1d57('0x43')];_0x11f266['order']=qs['sort'](_0x3860b8['query']['sort']);_0x11f266[_0x1d57('0x4d')]=qs['filters'](_[_0x1d57('0x4e')](_0x3860b8['query'],_0x379533[_0x1d57('0x46')]));if(_0x3860b8[_0x1d57('0x44')][_0x1d57('0x4f')]){_0x11f266[_0x1d57('0x4d')]=_[_0x1d57('0x50')](_0x11f266[_0x1d57('0x4d')],{'$or':_[_0x1d57('0x3e')](_0x11f266[_0x1d57('0x47')],function(_0x228842){var _0x3f9e3a={};_0x3f9e3a[_0x228842]={'$like':'%'+_0x3860b8[_0x1d57('0x44')][_0x1d57('0x4f')]+'%'};return _0x3f9e3a;})});}_0x11f266=_['merge']({},_0x11f266,_0x3860b8['options']);return _0x363c4b[_0x1d57('0xb7')](_0x11f266);}})[_0x1d57('0x1f')](function(_0x50fb16){if(_0x50fb16){_0x47b637=_0x50fb16[_0x1d57('0x5a')];if(!_0x3860b8[_0x1d57('0x44')]['hasOwnProperty'](_0x1d57('0x6a'))){_0x11f266['limit']=qs['limit'](_0x3860b8[_0x1d57('0x44')]['limit']);_0x11f266['offset']=qs[_0x1d57('0x2b')](_0x3860b8[_0x1d57('0x44')][_0x1d57('0x2b')]);}return _0x363c4b[_0x1d57('0xb7')](_0x11f266);}})[_0x1d57('0x1f')](function(_0x592ac7){if(_0x592ac7){return _0x592ac7?{'count':_0x47b637,'rows':_0x592ac7}:null;}})[_0x1d57('0x1f')](respondWithResult(_0x465c2b,null))[_0x1d57('0x56')](handleError(_0x465c2b,null));};exports['getInteractions']=function(_0x5b5803,_0xccffe2,_0x554c1c){var _0x4dd5ed={'raw':![],'where':{}};var _0x49f578={};var _0x3f4140={'count':0x0,'rows':[]};return db['SmsAccount'][_0x1d57('0x68')]({'where':{'id':_0x5b5803[_0x1d57('0x58')]['id']}})['then'](handleEntityNotFound(_0xccffe2,null))[_0x1d57('0x1f')](function(_0x4f403b){if(_0x4f403b){_0x49f578[_0x1d57('0x43')]=_[_0x1d57('0x45')](db[_0x1d57('0x9e')][_0x1d57('0x40')]);_0x49f578['query']=_['keys'](_0x5b5803[_0x1d57('0x44')]);_0x49f578[_0x1d57('0x46')]=_[_0x1d57('0x48')](_0x49f578[_0x1d57('0x43')],_0x49f578['query']);_0x4dd5ed[_0x1d57('0x47')]=_[_0x1d57('0x48')](_0x49f578[_0x1d57('0x43')],qs[_0x1d57('0x49')](_0x5b5803[_0x1d57('0x44')][_0x1d57('0x49')]));_0x4dd5ed['attributes']=_0x4dd5ed['attributes'][_0x1d57('0x5a')]?_0x4dd5ed[_0x1d57('0x47')]:_0x49f578[_0x1d57('0x43')];if(!_0x5b5803[_0x1d57('0x44')][_0x1d57('0x4a')](_0x1d57('0x6a'))){_0x4dd5ed[_0x1d57('0x2e')]=qs[_0x1d57('0x2e')](_0x5b5803['query']['limit']);_0x4dd5ed[_0x1d57('0x2b')]=qs[_0x1d57('0x2b')](_0x5b5803[_0x1d57('0x44')][_0x1d57('0x2b')]);}_0x4dd5ed['order']=qs[_0x1d57('0x4c')](_0x5b5803[_0x1d57('0x44')][_0x1d57('0x4c')]);_0x4dd5ed[_0x1d57('0x4d')]=qs[_0x1d57('0x46')](_[_0x1d57('0x4e')](_0x5b5803[_0x1d57('0x44')],_0x49f578[_0x1d57('0x46')]));_0x4dd5ed[_0x1d57('0x4d')][_0x1d57('0x6b')]=_0x4f403b['id'];if(_0x5b5803['query'][_0x1d57('0x4f')]){_0x4dd5ed['where']=_[_0x1d57('0x50')](_0x4dd5ed[_0x1d57('0x4d')],{'$or':_[_0x1d57('0x3e')](_0x4dd5ed[_0x1d57('0x47')],function(_0x34976b){var _0x3ca2ec={};_0x3ca2ec[_0x34976b]={'$like':'%'+_0x5b5803['query'][_0x1d57('0x4f')]+'%'};return _0x3ca2ec;})});}_0x4dd5ed=_[_0x1d57('0x50')]({},_0x4dd5ed,_0x5b5803[_0x1d57('0x52')]);return db['SmsInteraction']['count']({'where':_0x4dd5ed[_0x1d57('0x4d')]})['then'](function(_0x5eef88){_0x3f4140['count']=_0x5eef88;if(_0x5b5803['query'][_0x1d57('0x53')]){_0x4dd5ed[_0x1d57('0x5b')]=[{'model':db['CmContact'],'as':_0x1d57('0xb8'),'required':![]},{'model':db[_0x1d57('0xa7')],'as':_0x1d57('0xb9'),'attributes':[_0x1d57('0x3b'),_0x1d57('0xba'),_0x1d57('0xbb')],'required':![]},{'model':db[_0x1d57('0xbc')],'as':_0x1d57('0xbd'),'attributes':['id',_0x1d57('0x3b'),_0x1d57('0xbe')],'where':_0x5b5803[_0x1d57('0x44')][_0x1d57('0xbf')]?{'id':_0x5b5803[_0x1d57('0x44')][_0x1d57('0xbf')]}:undefined,'required':_0x5b5803[_0x1d57('0x44')]['tag']?!![]:![]}];}return db[_0x1d57('0x9e')][_0x1d57('0x54')](_0x4dd5ed);})['then'](function(_0xbb6a06){_0x3f4140[_0x1d57('0x55')]=_0xbb6a06;return _0x3f4140;});}})[_0x1d57('0x1f')](respondWithFilteredResult(_0xccffe2,_0x4dd5ed))['catch'](handleError(_0xccffe2,null));};exports['send']=function(_0x3083ab,_0x5bcc54,_0x132362){var _0x735390,_0x2310ba,_0x498d19;if(_[_0x1d57('0x95')](_0x3083ab[_0x1d57('0x5e')][_0x1d57('0x5e')])||_0x3083ab[_0x1d57('0x5e')][_0x1d57('0x5e')]===''){throw new db[(_0x1d57('0x7a'))]['ValidationError'](_0x1d57('0xc0'));}if(_[_0x1d57('0x95')](_0x3083ab['body']['to'])){throw new db[(_0x1d57('0x7a'))][(_0x1d57('0x7b'))](_0x1d57('0xc1'));}_0x735390=_0x3083ab[_0x1d57('0x5e')]['to'];return db[_0x1d57('0x3f')]['find']({'where':{'id':_0x3083ab[_0x1d57('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x1d57('0xc2'),'include':[{'model':db[_0x1d57('0x9a')],'as':_0x1d57('0x9b'),'where':{'mobile':_0x735390},'limit':0x1,'order':[[_0x1d57('0x7f'),_0x1d57('0xc3')]]}]}]})['then'](handleEntityNotFound(_0x5bcc54,null))[_0x1d57('0x1f')](function(_0x48f675){if(_0x48f675&&_0x48f675[_0x1d57('0xc2')]){_0x2310ba=_0x48f675[_0x1d57('0x36')]({'plain':!![]});if(_0x2310ba[_0x1d57('0xc2')]&&_0x2310ba[_0x1d57('0xc2')]['Contacts']['length']){return _0x2310ba[_0x1d57('0xc2')][_0x1d57('0x9b')][0x0];}return db[_0x1d57('0x9a')]['create'](_[_0x1d57('0x9c')](_0x3083ab['body'],{'firstName':_0x735390,'mobile':_0x735390,'phone':_0x735390,'ListId':_0x2310ba['ListId']}));}})[_0x1d57('0x1f')](handleEntityNotFound(_0x5bcc54,null))[_0x1d57('0x1f')](function(_0x26466d){if(_0x26466d){_0x498d19=_0x26466d;return db['SmsInteraction'][_0x1d57('0x5c')]({'where':{'ContactId':_0x498d19['id'],'closed':![],'SmsAccountId':_0x2310ba['id']}})[_0x1d57('0x1f')](function(_0x599021){if(_0x599021){return[_0x599021,![]];}return db['SmsInteraction']['create']({'UserId':_0x3083ab[_0x1d57('0x61')]['id'],'ContactId':_0x498d19['id'],'SmsAccountId':_0x2310ba['id'],'phone':_0x735390,'firstMsgDirection':_0x1d57('0xc4'),'Messages':[_['merge'](_0x3083ab['body'],{'read':![],'body':_0x3083ab['body']['body'],'phone':_0x735390,'SmsAccountId':_0x2310ba['id'],'UserId':_0x3083ab[_0x1d57('0x61')]['id'],'ContactId':_0x498d19['id']})]},{'include':[{'model':db[_0x1d57('0xc5')],'as':_0x1d57('0xc6')}]})[_0x1d57('0x1f')](function(_0x2f5fb0){return[_0x2f5fb0,!![]];});});}})[_0x1d57('0xc7')](function(_0x3f3a7c,_0x59ac7a){if(_0x59ac7a){return _0x3f3a7c;}return db[_0x1d57('0xc5')][_0x1d57('0x5d')](_['merge'](_0x3083ab[_0x1d57('0x5e')],{'read':![],'body':_0x3083ab[_0x1d57('0x5e')]['body'],'phone':_0x735390,'SmsAccountId':_0x2310ba['id'],'SmsInteractionId':_0x3f3a7c['id'],'UserId':_0x3083ab['user']['id'],'ContactId':_0x498d19['id']}))[_0x1d57('0x1f')](function(_0x567c35){_0x3f3a7c['dataValues'][_0x1d57('0xc6')]=[];_0x3f3a7c[_0x1d57('0xc8')][_0x1d57('0xc6')][_0x1d57('0xa1')](_0x567c35[_0x1d57('0xc8')]);return _0x3f3a7c;});})['then'](respondWithResult(_0x5bcc54,null))[_0x1d57('0x56')](handleError(_0x5bcc54,null));};exports[_0x1d57('0x29')]=function(_0x51353d,_0x14ebe0,_0x167e36){if(_0x51353d[_0x1d57('0x5e')]['id']){delete _0x51353d[_0x1d57('0x5e')]['id'];}var _0x483670,_0x1577bb,_0x58a539;return db[_0x1d57('0x3f')][_0x1d57('0x5c')]({'where':{'id':_0x51353d['params']['id']}})[_0x1d57('0x1f')](handleEntityNotFound(_0x14ebe0,null))[_0x1d57('0x1f')](function(_0x44ae93){if(_0x44ae93){_0x58a539=_0x44ae93;logger[_0x1d57('0x22')](_0x1d57('0x23'),'status',_0x1d57('0xc9'),_0x44ae93['type'],util[_0x1d57('0xca')](_0x51353d[_0x1d57('0x5e')],{'showHidden':![],'depth':null}));switch(_0x44ae93[_0x1d57('0x42')]){case _0x1d57('0x87'):if(_0x51353d['body'][_0x1d57('0xcb')]&&_0x51353d[_0x1d57('0x5e')][_0x1d57('0x29')]){_0x1577bb=_0x51353d[_0x1d57('0x5e')]['status'];return db[_0x1d57('0xc5')][_0x1d57('0x5c')]({'where':{'messageId':_0x51353d[_0x1d57('0x5e')][_0x1d57('0xcb')]}});}break;case'connectel':if(_0x51353d[_0x1d57('0x5e')][_0x1d57('0xcc')]&&_0x51353d['body'][_0x1d57('0xcd')]){_0x1577bb=_0x51353d[_0x1d57('0x5e')]['statusInt'];return db[_0x1d57('0xc5')]['find']({'where':{'messageId':_0x51353d['body']['requestid']}});}break;case _0x1d57('0xce'):if(_0x51353d[_0x1d57('0x5e')][_0x1d57('0x8b')]&&_0x51353d['body'][_0x1d57('0xcf')]){_0x1577bb=_0x51353d[_0x1d57('0x5e')][_0x1d57('0xcf')];return db['SmsMessage'][_0x1d57('0x5c')]({'where':{'messageId':_0x51353d[_0x1d57('0x5e')]['message_id']}});}break;case'infobip':var _0x506ca2=_0x51353d[_0x1d57('0x5e')][_0x1d57('0x8f')][0x0];if(_0x506ca2['messageId']&&_0x506ca2['status'][_0x1d57('0xd0')]==='DELIVERED'){_0x1577bb=_0x506ca2[_0x1d57('0x29')][_0x1d57('0xd0')];return db[_0x1d57('0xc5')][_0x1d57('0x5c')]({'where':{'messageId':_0x506ca2[_0x1d57('0x85')]}});}break;case _0x1d57('0x92'):if(_0x51353d[_0x1d57('0x5e')][_0x1d57('0x85')]&&_0x51353d[_0x1d57('0x5e')][_0x1d57('0x29')]){_0x1577bb=_0x51353d[_0x1d57('0x5e')][_0x1d57('0x29')];return db[_0x1d57('0xc5')][_0x1d57('0x5c')]({'where':{'messageId':_0x51353d[_0x1d57('0x5e')][_0x1d57('0x85')]}});}break;case _0x1d57('0x94'):if(_0x51353d['body'][0x0][_0x1d57('0x27')]['id']){_0x1577bb=_0x51353d[_0x1d57('0x5e')][0x0][_0x1d57('0x42')];return db['SmsMessage'][_0x1d57('0x5c')]({'where':{'messageId':_0x51353d[_0x1d57('0x5e')][0x0]['message']['id']}});}break;case _0x1d57('0xd1'):if(_0x51353d[_0x1d57('0x5e')]['redif']&&_0x51353d[_0x1d57('0x5e')][_0x1d57('0x29')]){_0x1577bb=_0x51353d['body']['status'];return db['SmsMessage'][_0x1d57('0x5c')]({'where':{'messageId':_0x51353d[_0x1d57('0x5e')][_0x1d57('0xd2')]}});}break;}}})[_0x1d57('0x1f')](handleEntityNotFound(_0x14ebe0,null))[_0x1d57('0x1f')](function(_0x2d9098){if(_0x2d9098){_0x483670=_0x2d9098;switch(_0x58a539[_0x1d57('0x42')]){case _0x1d57('0x87'):if(_0x1577bb===_0x1d57('0xd3')){return _0x483670[_0x1d57('0x34')]({'read':!![]});}else{logger[_0x1d57('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0x1d57('0xca')](_0x51353d[_0x1d57('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x1d57('0x8a'):if(_0x1577bb==='1'){return _0x483670[_0x1d57('0x34')]({'read':!![]});}else{logger[_0x1d57('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1d57('0x87'),util[_0x1d57('0xca')](_0x51353d['body'],{'showHidden':![],'depth':null}));}break;case _0x1d57('0xce'):if(!_0x51353d[_0x1d57('0x5e')][_0x1d57('0xd4')]&&_0x1577bb>=0xc8&&_0x1577bb<=0xce){return _0x483670[_0x1d57('0x34')]({'read':!![]});}else{logger[_0x1d57('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1d57('0x29'),_0x1d57('0xce'),util[_0x1d57('0xca')](_0x51353d['body'],{'showHidden':![],'depth':null}));}break;case _0x1d57('0x8e'):var _0x5a1d4d=_0x51353d['body'][_0x1d57('0x8f')][0x0];if(_0x5a1d4d['status'][_0x1d57('0xd0')]===_0x1d57('0xd3')){return _0x483670['update']({'read':!![]});}else{logger[_0x1d57('0x26')](_0x1d57('0x23'),'status',_0x1d57('0x8e'),util[_0x1d57('0xca')](_0x51353d[_0x1d57('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x1d57('0x92'):if(_0x1577bb==_0x1d57('0xd5')||_0x1577bb=='RECEIVED_BY_RECIPIENT'){return _0x483670[_0x1d57('0x34')]({'read':!![]});}else{logger[_0x1d57('0x26')](_0x1d57('0x23'),_0x1d57('0x29'),'clickatell',util[_0x1d57('0xca')](_0x51353d['body'],{'showHidden':![],'depth':null}));}break;case _0x1d57('0x94'):if(_0x1577bb==_0x1d57('0xd6')){return _0x483670['update']({'read':!![]});}else{logger[_0x1d57('0x26')](_0x1d57('0x23'),_0x1d57('0x29'),_0x1d57('0x94'),util['inspect'](_0x51353d[_0x1d57('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x1d57('0xd1'):if(_0x1577bb===_0x1d57('0xd7')||_0x1577bb===_0x1d57('0xd8')){return _0x483670['update']({'read':!![]});}else{logger[_0x1d57('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1d57('0x29'),'intelepeer',util[_0x1d57('0xca')](_0x51353d[_0x1d57('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x483670;}})['then'](respondWithResult(_0x14ebe0,null))['catch'](handleError(_0x14ebe0,null));};exports[_0x1d57('0xd9')]=function(_0x4c766a,_0xdbfebd,_0x17e23f){var _0x29e43d,_0x19a795,_0x2651a8;return db[_0x1d57('0x3f')][_0x1d57('0x5c')]({'where':{'id':_0x4c766a['params']['id']}})[_0x1d57('0x1f')](handleEntityNotFound(_0xdbfebd,null))[_0x1d57('0x1f')](function(_0x1cc310){if(_0x1cc310){_0x2651a8=_0x1cc310;logger[_0x1d57('0x22')](_0x1d57('0x23'),'status',_0x1d57('0xc9'),_0x1cc310[_0x1d57('0x42')],util[_0x1d57('0xca')](_0x4c766a['query'],{'showHidden':![],'depth':null}));switch(_0x1cc310[_0x1d57('0x42')]){case'csc':if(_0x4c766a[_0x1d57('0x44')][_0x1d57('0xda')]&&_0x4c766a[_0x1d57('0x44')][_0x1d57('0xdb')]){_0x19a795=_0x4c766a['query'][_0x1d57('0xdb')];return db[_0x1d57('0xc5')]['find']({'where':{'messageId':_0x4c766a['query'][_0x1d57('0xda')]}});}break;}}})[_0x1d57('0x1f')](handleEntityNotFound(_0xdbfebd,null))['then'](function(_0x4a2b68){if(_0x4a2b68){_0x29e43d=_0x4a2b68;switch(_0x2651a8[_0x1d57('0x42')]){case _0x1d57('0x90'):if(_0x19a795==='2'||_0x19a795==='6'){return _0x29e43d[_0x1d57('0x34')]({'read':!![]});}else{logger[_0x1d57('0x26')](_0x1d57('0x23'),_0x1d57('0x29'),_0x1d57('0x90'),util[_0x1d57('0xca')](_0x4c766a[_0x1d57('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x29e43d;}})[_0x1d57('0x1f')](respondWithResult(_0xdbfebd,null))[_0x1d57('0x56')](handleError(_0xdbfebd,null));};exports['addAgents']=function(_0x27a2ed,_0x2f3fc6,_0x3ca887){return db['SmsAccount'][_0x1d57('0x5c')]({'where':{'id':_0x27a2ed[_0x1d57('0x58')]['id']}})[_0x1d57('0x1f')](handleEntityNotFound(_0x2f3fc6,null))[_0x1d57('0x1f')](function(_0x486425){if(_0x486425){return _0x486425['addAgents'](_0x27a2ed[_0x1d57('0x5e')][_0x1d57('0x6d')],_['omit'](_0x27a2ed[_0x1d57('0x5e')],['ids','id'])||{})[_0x1d57('0xc7')](function(_0x26c5af){for(var _0x353bdb=0x0;_0x353bdb<_0x27a2ed[_0x1d57('0x5e')][_0x1d57('0x6d')][_0x1d57('0x5a')];_0x353bdb+=0x1){socket[_0x1d57('0xdc')](_0x1d57('0xdd'),{'UserId':Number(_0x27a2ed[_0x1d57('0x5e')][_0x1d57('0x6d')][_0x353bdb]),'SmsAccountId':Number(_0x27a2ed[_0x1d57('0x58')]['id'])});}return _0x26c5af;});}})[_0x1d57('0x1f')](respondWithResult(_0x2f3fc6,null))['catch'](handleError(_0x2f3fc6,null));};exports[_0x1d57('0xde')]=function(_0x37dc58,_0x26be89,_0x3462f4){return db[_0x1d57('0x3f')][_0x1d57('0x5c')]({'where':{'id':_0x37dc58[_0x1d57('0x58')]['id']}})[_0x1d57('0x1f')](handleEntityNotFound(_0x26be89,null))[_0x1d57('0x1f')](function(_0x4bfb58){if(_0x4bfb58){return _0x4bfb58[_0x1d57('0xde')](_0x37dc58[_0x1d57('0x44')][_0x1d57('0x6d')])[_0x1d57('0x1f')](function(){if(_[_0x1d57('0xdf')](_0x37dc58[_0x1d57('0x44')]['ids'])){for(var _0x3f4f90=0x0;_0x3f4f90<_0x37dc58[_0x1d57('0x44')][_0x1d57('0x6d')][_0x1d57('0x5a')];_0x3f4f90+=0x1){socket[_0x1d57('0xdc')](_0x1d57('0xe0'),{'UserId':Number(_0x37dc58[_0x1d57('0x44')][_0x1d57('0x6d')][_0x3f4f90]),'SmsAccountId':Number(_0x37dc58[_0x1d57('0x58')]['id'])});}}else{socket[_0x1d57('0xdc')](_0x1d57('0xe0'),{'UserId':Number(_0x37dc58['query'][_0x1d57('0x6d')]),'SmsAccountId':Number(_0x37dc58[_0x1d57('0x58')]['id'])});}});}})[_0x1d57('0x1f')](respondWithStatusCode(_0x26be89,null))[_0x1d57('0x56')](handleError(_0x26be89,null));};exports[_0x1d57('0xe1')]=function(_0x5af0e3,_0x26384,_0x425204){var _0x4b3566={};var _0xd44170={};var _0x126fb9;var _0x341fe9;return db[_0x1d57('0x3f')][_0x1d57('0x68')]({'where':{'id':_0x5af0e3[_0x1d57('0x58')]['id']}})['then'](handleEntityNotFound(_0x26384,null))[_0x1d57('0x1f')](function(_0x18d389){if(_0x18d389){_0x126fb9=_0x18d389;_0xd44170[_0x1d57('0x43')]=_['keys'](db['User'][_0x1d57('0x40')]);_0xd44170['query']=_[_0x1d57('0x45')](_0x5af0e3[_0x1d57('0x44')]);_0xd44170[_0x1d57('0x46')]=_[_0x1d57('0x48')](_0xd44170[_0x1d57('0x43')],_0xd44170['query']);_0x4b3566['attributes']=_['intersection'](_0xd44170['model'],qs[_0x1d57('0x49')](_0x5af0e3[_0x1d57('0x44')][_0x1d57('0x49')]));_0x4b3566[_0x1d57('0x47')]=_0x4b3566[_0x1d57('0x47')][_0x1d57('0x5a')]?_0x4b3566[_0x1d57('0x47')]:_0xd44170[_0x1d57('0x43')];_0x4b3566[_0x1d57('0x4b')]=qs['sort'](_0x5af0e3['query'][_0x1d57('0x4c')]);_0x4b3566[_0x1d57('0x4d')]=qs['filters'](_[_0x1d57('0x4e')](_0x5af0e3['query'],_0xd44170[_0x1d57('0x46')]));if(_0x5af0e3[_0x1d57('0x44')][_0x1d57('0x4f')]){_0x4b3566[_0x1d57('0x4d')]=_['merge'](_0x4b3566[_0x1d57('0x4d')],{'$or':_[_0x1d57('0x3e')](_0x4b3566['attributes'],function(_0x519fce){var _0x4842c4={};_0x4842c4[_0x519fce]={'$like':'%'+_0x5af0e3[_0x1d57('0x44')][_0x1d57('0x4f')]+'%'};return _0x4842c4;})});}_0x4b3566=_[_0x1d57('0x50')]({},_0x4b3566,_0x5af0e3[_0x1d57('0x52')]);return _0x126fb9['getAgents'](_0x4b3566);}})['then'](function(_0x4f09d0){if(_0x4f09d0){_0x341fe9=_0x4f09d0[_0x1d57('0x5a')];if(!_0x5af0e3[_0x1d57('0x44')][_0x1d57('0x4a')](_0x1d57('0x6a'))){_0x4b3566['limit']=qs['limit'](_0x5af0e3[_0x1d57('0x44')][_0x1d57('0x2e')]);_0x4b3566[_0x1d57('0x2b')]=qs[_0x1d57('0x2b')](_0x5af0e3['query'][_0x1d57('0x2b')]);}return _0x126fb9[_0x1d57('0xe1')](_0x4b3566);}})['then'](function(_0x2c11ce){if(_0x2c11ce){return _0x2c11ce?{'count':_0x341fe9,'rows':_0x2c11ce}:null;}})['then'](respondWithResult(_0x26384,null))[_0x1d57('0x56')](handleError(_0x26384,null));}; \ No newline at end of file +var _0x0419=['http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','Pause','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SmsAccount','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','SmsAccountId','getDispositions','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','SmsApplication','applications','orderBy','Applications','priority','asc','account','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','clicksend','message_id','plivo','Text','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','created','autoclose','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','fullname','internal','Tags','color','tag','to\x20is\x20mandatory','List','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','DELIVERED','redif','connectel','error_code','groupName','RECEIVED_BY_RECIPIENT','message-delivered','statusGet','state','message-id','csc','addAgents','userSmsAccount:save','removeAgents','emit','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./smsAccount.socket','jayson/promise'];(function(_0x9861ff,_0x41fb17){var _0x48852b=function(_0x557001){while(--_0x557001){_0x9861ff['push'](_0x9861ff['shift']());}};_0x48852b(++_0x41fb17);}(_0x0419,0x1b2));var _0x9041=function(_0x47e8c9,_0x2e6edc){_0x47e8c9=_0x47e8c9-0x0;var _0x31ea20=_0x0419[_0x47e8c9];return _0x31ea20;};'use strict';var emlformat=require(_0x9041('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9041('0x1'));var jsonpatch=require(_0x9041('0x2'));var rp=require(_0x9041('0x3'));var moment=require(_0x9041('0x4'));var BPromise=require(_0x9041('0x5'));var Mustache=require(_0x9041('0x6'));var util=require(_0x9041('0x7'));var path=require('path');var sox=require(_0x9041('0x8'));var csv=require(_0x9041('0x9'));var ejs=require(_0x9041('0xa'));var fs=require('fs');var fs_extra=require(_0x9041('0xb'));var _=require(_0x9041('0xc'));var squel=require(_0x9041('0xd'));var crypto=require(_0x9041('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9041('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9041('0x10'));var Papa=require(_0x9041('0x11'));var Redis=require(_0x9041('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9041('0x13'));var as=require(_0x9041('0x14'));var hardwareService=require(_0x9041('0x15'));var logger=require(_0x9041('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x9041('0x17'));var licenseUtil=require(_0x9041('0x18'));var db=require('../../mysqldb')['db'];config[_0x9041('0x19')]=_[_0x9041('0x1a')](config[_0x9041('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9041('0x1b'))(new Redis(config[_0x9041('0x19')]));require(_0x9041('0x1c'))['register'](socket);var jayson=require(_0x9041('0x1d'));var client=jayson['client'][_0x9041('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x1893a7,_0x4c08e7,_0x5c92b,_0x1ba39b){return new BPromise(function(_0x289dc3,_0x2bb029){var _0x2211d0=_0x1ba39b||client;return _0x2211d0[_0x9041('0x1f')](_0x1893a7,_0x5c92b)[_0x9041('0x20')](function(_0x4fbeda){logger['info'](_0x9041('0x21'),_0x4c08e7,_0x9041('0x22'));logger[_0x9041('0x23')](_0x9041('0x24'),_0x4c08e7,_0x9041('0x22'),JSON[_0x9041('0x25')](_0x4fbeda));if(_0x4fbeda[_0x9041('0x26')]){if(_0x4fbeda[_0x9041('0x26')][_0x9041('0x27')]===0x1f4){logger[_0x9041('0x26')](_0x9041('0x21'),_0x4c08e7,_0x4fbeda['error'][_0x9041('0x28')]);return _0x2bb029(_0x4fbeda[_0x9041('0x26')][_0x9041('0x28')]);}logger[_0x9041('0x26')](_0x9041('0x21'),_0x4c08e7,_0x4fbeda['error'][_0x9041('0x28')]);return _0x289dc3(_0x4fbeda[_0x9041('0x26')]['message']);}else{logger[_0x9041('0x29')]('SmsAccount,\x20%s,\x20%s',_0x4c08e7,_0x9041('0x22'));_0x289dc3(_0x4fbeda[_0x9041('0x2a')][_0x9041('0x28')]);}})[_0x9041('0x2b')](function(_0x506a13){logger[_0x9041('0x26')](_0x9041('0x21'),_0x4c08e7,_0x506a13);_0x2bb029(_0x506a13);});});}function respondWithStatusCode(_0x18f586,_0x5afd5e){_0x5afd5e=_0x5afd5e||0xcc;return function(_0x3d859c){if(_0x3d859c){return _0x18f586['sendStatus'](_0x5afd5e);}return _0x18f586[_0x9041('0x2c')](_0x5afd5e)[_0x9041('0x2d')]();};}function respondWithResult(_0x1f0ca0,_0x569cb9){_0x569cb9=_0x569cb9||0xc8;return function(_0x4295e9){if(_0x4295e9){return _0x1f0ca0[_0x9041('0x2c')](_0x569cb9)[_0x9041('0x2e')](_0x4295e9);}};}function respondWithFilteredResult(_0x64f5bd,_0x2ae797){return function(_0x292149){if(_0x292149){var _0x2f6dd2=typeof _0x2ae797[_0x9041('0x2f')]==='undefined'&&typeof _0x2ae797[_0x9041('0x30')]===_0x9041('0x31');var _0x54986f=_0x292149['count'];var _0x27b7df=_0x2f6dd2?0x0:_0x2ae797[_0x9041('0x2f')];var _0x50e657=_0x2f6dd2?_0x292149[_0x9041('0x32')]:_0x2ae797[_0x9041('0x2f')]+_0x2ae797[_0x9041('0x30')];var _0x19c10a;if(_0x50e657>=_0x54986f){_0x50e657=_0x54986f;_0x19c10a=0xc8;}else{_0x19c10a=0xce;}_0x64f5bd['status'](_0x19c10a);return _0x64f5bd[_0x9041('0x33')](_0x9041('0x34'),_0x27b7df+'-'+_0x50e657+'/'+_0x54986f)[_0x9041('0x2e')](_0x292149);}return null;};}function patchUpdates(_0x19d9ce){return function(_0x11885b){try{jsonpatch[_0x9041('0x35')](_0x11885b,_0x19d9ce,!![]);}catch(_0x221641){return BPromise[_0x9041('0x36')](_0x221641);}return _0x11885b[_0x9041('0x37')]();};}function saveUpdates(_0xf44984,_0x37860d){return function(_0xd0945c){if(_0xd0945c){return _0xd0945c[_0x9041('0x38')](_0xf44984)[_0x9041('0x20')](function(_0x4ae0ca){return _0x4ae0ca;});}return null;};}function removeEntity(_0x21cbab,_0x53fe57){return function(_0x34672b){if(_0x34672b){return _0x34672b[_0x9041('0x39')]()[_0x9041('0x20')](function(){var _0x41ee56=_0x34672b[_0x9041('0x3a')]({'plain':!![]});var _0x2ce9b4=_0x9041('0x3b');return db[_0x9041('0x3c')]['destroy']({'where':{'type':_0x2ce9b4,'resourceId':_0x41ee56['id']}})[_0x9041('0x20')](function(){return _0x34672b;});})[_0x9041('0x20')](function(){_0x21cbab[_0x9041('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36e302,_0x27426a){return function(_0x392955){if(!_0x392955){_0x36e302[_0x9041('0x3d')](0x194);}return _0x392955;};}function handleError(_0x35a11d,_0x2b24ec){_0x2b24ec=_0x2b24ec||0x1f4;return function(_0x3c68be){logger[_0x9041('0x26')](_0x3c68be[_0x9041('0x3e')]);if(_0x3c68be[_0x9041('0x3f')]){delete _0x3c68be[_0x9041('0x3f')];}_0x35a11d[_0x9041('0x2c')](_0x2b24ec)[_0x9041('0x40')](_0x3c68be);};}exports['index']=function(_0x500801,_0x3311bd){var _0x55a6c6={'include':[{'model':db[_0x9041('0x41')],'as':'mandatoryDispositionPause'}]},_0x4fab4d={},_0x1accdd={'count':0x0,'rows':[]};var _0x248d87=_[_0x9041('0x42')](db['SmsAccount'][_0x9041('0x43')],function(_0x2b8ab1){return{'name':_0x2b8ab1[_0x9041('0x44')],'type':_0x2b8ab1[_0x9041('0x45')]['key']};});_0x4fab4d[_0x9041('0x46')]=_['map'](_0x248d87,_0x9041('0x3f'));_0x4fab4d['query']=_[_0x9041('0x47')](_0x500801[_0x9041('0x48')]);_0x4fab4d[_0x9041('0x49')]=_[_0x9041('0x4a')](_0x4fab4d[_0x9041('0x46')],_0x4fab4d[_0x9041('0x48')]);_0x55a6c6[_0x9041('0x4b')]=_[_0x9041('0x4a')](_0x4fab4d[_0x9041('0x46')],qs[_0x9041('0x4c')](_0x500801[_0x9041('0x48')][_0x9041('0x4c')]));_0x55a6c6[_0x9041('0x4b')]=_0x55a6c6[_0x9041('0x4b')][_0x9041('0x4d')]?_0x55a6c6['attributes']:_0x4fab4d[_0x9041('0x46')];if(!_0x500801[_0x9041('0x48')][_0x9041('0x4e')](_0x9041('0x4f'))){_0x55a6c6[_0x9041('0x30')]=qs['limit'](_0x500801[_0x9041('0x48')][_0x9041('0x30')]);_0x55a6c6[_0x9041('0x2f')]=qs[_0x9041('0x2f')](_0x500801['query'][_0x9041('0x2f')]);}_0x55a6c6[_0x9041('0x50')]=qs[_0x9041('0x51')](_0x500801['query']['sort']);_0x55a6c6[_0x9041('0x52')]=qs['filters'](_[_0x9041('0x53')](_0x500801[_0x9041('0x48')],_0x4fab4d[_0x9041('0x49')]),_0x248d87);if(_0x500801[_0x9041('0x48')][_0x9041('0x54')]){_0x55a6c6['where']=_[_0x9041('0x55')](_0x55a6c6[_0x9041('0x52')],{'$or':_['map'](_0x248d87,function(_0x98b958){if(_0x98b958[_0x9041('0x45')]!=='VIRTUAL'){var _0x617f07={};_0x617f07[_0x98b958[_0x9041('0x3f')]]={'$like':'%'+_0x500801['query']['filter']+'%'};return _0x617f07;}})});}_0x55a6c6=_[_0x9041('0x55')]({},_0x55a6c6,_0x500801[_0x9041('0x56')]);var _0x363905={'where':_0x55a6c6['where']};return db[_0x9041('0x57')][_0x9041('0x32')](_0x363905)['then'](function(_0x232b0e){_0x1accdd[_0x9041('0x32')]=_0x232b0e;if(_0x500801[_0x9041('0x48')][_0x9041('0x58')]){_0x55a6c6[_0x9041('0x59')]=[{'all':!![]}];}return db[_0x9041('0x57')][_0x9041('0x5a')](_0x55a6c6);})['then'](function(_0x40b042){_0x1accdd[_0x9041('0x5b')]=_0x40b042;return _0x1accdd;})[_0x9041('0x20')](respondWithFilteredResult(_0x3311bd,_0x55a6c6))[_0x9041('0x2b')](handleError(_0x3311bd,null));};exports[_0x9041('0x5c')]=function(_0x23c791,_0x576654){var _0x3eb387={'raw':![],'where':{'id':_0x23c791[_0x9041('0x5d')]['id']},'include':[{'model':db[_0x9041('0x41')],'as':_0x9041('0x5e')}]},_0x1b9a43={};_0x1b9a43[_0x9041('0x46')]=_[_0x9041('0x47')](db['SmsAccount'][_0x9041('0x43')]);_0x1b9a43[_0x9041('0x48')]=_[_0x9041('0x47')](_0x23c791[_0x9041('0x48')]);_0x1b9a43[_0x9041('0x49')]=_[_0x9041('0x4a')](_0x1b9a43[_0x9041('0x46')],_0x1b9a43[_0x9041('0x48')]);_0x3eb387[_0x9041('0x4b')]=_[_0x9041('0x4a')](_0x1b9a43[_0x9041('0x46')],qs['fields'](_0x23c791[_0x9041('0x48')][_0x9041('0x4c')]));_0x3eb387[_0x9041('0x4b')]=_0x3eb387[_0x9041('0x4b')][_0x9041('0x4d')]?_0x3eb387[_0x9041('0x4b')]:_0x1b9a43[_0x9041('0x46')];if(_0x23c791['query'][_0x9041('0x58')]){_0x3eb387[_0x9041('0x59')]=[{'all':!![]}];}_0x3eb387=_[_0x9041('0x55')]({},_0x3eb387,_0x23c791['options']);return db[_0x9041('0x57')][_0x9041('0x5f')](_0x3eb387)[_0x9041('0x20')](handleEntityNotFound(_0x576654,null))[_0x9041('0x20')](respondWithResult(_0x576654,null))['catch'](handleError(_0x576654,null));};exports['create']=function(_0x3a8238,_0x2dc1e1){return db[_0x9041('0x57')][_0x9041('0x60')](_0x3a8238[_0x9041('0x61')],{})[_0x9041('0x20')](function(_0x1c4243){var _0x25ac96=_0x3a8238[_0x9041('0x62')][_0x9041('0x3a')]({'plain':!![]});if(!_0x25ac96)throw new Error(_0x9041('0x63'));if(_0x25ac96[_0x9041('0x64')]==='user'){var _0x1f285b=_0x1c4243[_0x9041('0x3a')]({'plain':!![]});var _0x2cb9ca='SmsAccounts';return db[_0x9041('0x65')][_0x9041('0x5f')]({'where':{'name':_0x2cb9ca,'userProfileId':_0x25ac96[_0x9041('0x66')]},'raw':!![]})['then'](function(_0x2a44d7){if(_0x2a44d7&&_0x2a44d7[_0x9041('0x67')]===0x0){return db[_0x9041('0x3c')][_0x9041('0x60')]({'name':_0x1f285b[_0x9041('0x3f')],'resourceId':_0x1f285b['id'],'type':_0x2a44d7[_0x9041('0x3f')],'sectionId':_0x2a44d7['id']},{})[_0x9041('0x20')](function(){return _0x1c4243;});}else{return _0x1c4243;}})[_0x9041('0x2b')](function(_0x386b4b){logger[_0x9041('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x386b4b);throw _0x386b4b;});}return _0x1c4243;})['then'](respondWithResult(_0x2dc1e1,0xc9))[_0x9041('0x2b')](handleError(_0x2dc1e1,null));};exports[_0x9041('0x38')]=function(_0x1b87e5,_0x1f4e2a){if(_0x1b87e5[_0x9041('0x61')]['id']){delete _0x1b87e5[_0x9041('0x61')]['id'];}return db[_0x9041('0x57')]['find']({'where':{'id':_0x1b87e5[_0x9041('0x5d')]['id']},'include':[{'model':db[_0x9041('0x41')],'as':_0x9041('0x5e')}]})['then'](handleEntityNotFound(_0x1f4e2a,null))[_0x9041('0x20')](saveUpdates(_0x1b87e5[_0x9041('0x61')],null))[_0x9041('0x20')](respondWithResult(_0x1f4e2a,null))['catch'](handleError(_0x1f4e2a,null));};exports[_0x9041('0x39')]=function(_0x4bf70b,_0x5e9390){return db[_0x9041('0x57')][_0x9041('0x5f')]({'where':{'id':_0x4bf70b[_0x9041('0x5d')]['id']}})[_0x9041('0x20')](handleEntityNotFound(_0x5e9390,null))['then'](removeEntity(_0x5e9390,null))[_0x9041('0x2b')](handleError(_0x5e9390,null));};exports['describe']=function(_0x1d93fb,_0x5cc0b5){return db[_0x9041('0x57')]['describe']()['then'](respondWithResult(_0x5cc0b5,null))[_0x9041('0x2b')](handleError(_0x5cc0b5,null));};exports['addDisposition']=function(_0x5f1575,_0x34bc8b,_0x1a5612){if(_0x5f1575[_0x9041('0x61')]['id']){delete _0x5f1575['body']['id'];}return db[_0x9041('0x57')][_0x9041('0x5f')]({'where':{'id':_0x5f1575[_0x9041('0x5d')]['id']}})[_0x9041('0x20')](handleEntityNotFound(_0x34bc8b,null))[_0x9041('0x20')](function(_0x3733ce){if(_0x3733ce){_0x5f1575[_0x9041('0x61')][_0x9041('0x68')]=_0x3733ce['id'];return db['Disposition'][_0x9041('0x60')](_0x5f1575['body']);}})[_0x9041('0x20')](respondWithResult(_0x34bc8b,null))[_0x9041('0x2b')](handleError(_0x34bc8b,null));};exports[_0x9041('0x69')]=function(_0x56419e,_0x5a1799,_0x3955ea){var _0x2b621f={'raw':![],'where':{}};var _0x3895a5={};var _0x35eca8={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x56419e[_0x9041('0x5d')]['id']}})[_0x9041('0x20')](handleEntityNotFound(_0x5a1799,null))[_0x9041('0x20')](function(_0x4d899e){if(_0x4d899e){_0x3895a5['model']=_[_0x9041('0x47')](db['Disposition'][_0x9041('0x43')]);_0x3895a5[_0x9041('0x48')]=_[_0x9041('0x47')](_0x56419e[_0x9041('0x48')]);_0x3895a5[_0x9041('0x49')]=_['intersection'](_0x3895a5[_0x9041('0x46')],_0x3895a5[_0x9041('0x48')]);_0x2b621f[_0x9041('0x4b')]=_[_0x9041('0x4a')](_0x3895a5[_0x9041('0x46')],qs[_0x9041('0x4c')](_0x56419e[_0x9041('0x48')][_0x9041('0x4c')]));_0x2b621f['attributes']=_0x2b621f[_0x9041('0x4b')][_0x9041('0x4d')]?_0x2b621f[_0x9041('0x4b')]:_0x3895a5[_0x9041('0x46')];if(!_0x56419e[_0x9041('0x48')][_0x9041('0x4e')]('nolimit')){_0x2b621f['limit']=qs['limit'](_0x56419e[_0x9041('0x48')]['limit']);_0x2b621f['offset']=qs[_0x9041('0x2f')](_0x56419e[_0x9041('0x48')][_0x9041('0x2f')]);}_0x2b621f[_0x9041('0x50')]=qs[_0x9041('0x51')](_0x56419e[_0x9041('0x48')][_0x9041('0x51')]);_0x2b621f['where']=qs['filters'](_[_0x9041('0x53')](_0x56419e[_0x9041('0x48')],_0x3895a5[_0x9041('0x49')]));_0x2b621f[_0x9041('0x52')][_0x9041('0x68')]=_0x4d899e['id'];if(_0x56419e[_0x9041('0x48')][_0x9041('0x54')]){_0x2b621f[_0x9041('0x52')]=_[_0x9041('0x55')](_0x2b621f['where'],{'$or':_[_0x9041('0x42')](_0x2b621f[_0x9041('0x4b')],function(_0x24d112){var _0x2046a0={};_0x2046a0[_0x24d112]={'$like':'%'+_0x56419e[_0x9041('0x48')][_0x9041('0x54')]+'%'};return _0x2046a0;})});}_0x2b621f=_['merge']({},_0x2b621f,_0x56419e[_0x9041('0x56')]);return db[_0x9041('0x6a')][_0x9041('0x32')]({'where':_0x2b621f[_0x9041('0x52')]})[_0x9041('0x20')](function(_0x358b0d){_0x35eca8[_0x9041('0x32')]=_0x358b0d;if(_0x56419e['query'][_0x9041('0x58')]){_0x2b621f[_0x9041('0x59')]=[{'all':!![]}];}return db[_0x9041('0x6a')][_0x9041('0x5a')](_0x2b621f);})[_0x9041('0x20')](function(_0xcee256){_0x35eca8[_0x9041('0x5b')]=_0xcee256;return _0x35eca8;});}})[_0x9041('0x20')](respondWithFilteredResult(_0x5a1799,_0x2b621f))[_0x9041('0x2b')](handleError(_0x5a1799,null));};exports[_0x9041('0x6b')]=function(_0x235bc6,_0x5f0355,_0x55370d){return db[_0x9041('0x57')][_0x9041('0x5f')]({'where':{'id':_0x235bc6[_0x9041('0x5d')]['id']}})[_0x9041('0x20')](handleEntityNotFound(_0x5f0355,null))[_0x9041('0x20')](function(_0x3a09d5){if(_0x3a09d5){return _0x3a09d5[_0x9041('0x6b')](_0x235bc6[_0x9041('0x48')][_0x9041('0x6c')]);}})['then'](respondWithStatusCode(_0x5f0355,null))[_0x9041('0x2b')](handleError(_0x5f0355,null));};exports[_0x9041('0x6d')]=function(_0x38c355,_0x4fb665,_0x2a5a88){if(_0x38c355[_0x9041('0x61')]['id']){delete _0x38c355[_0x9041('0x61')]['id'];}return db[_0x9041('0x57')][_0x9041('0x5f')]({'where':{'id':_0x38c355[_0x9041('0x5d')]['id']}})[_0x9041('0x20')](handleEntityNotFound(_0x4fb665,null))[_0x9041('0x20')](function(_0x2e0a3c){if(_0x2e0a3c){_0x38c355[_0x9041('0x61')][_0x9041('0x68')]=_0x2e0a3c['id'];return db[_0x9041('0x6e')][_0x9041('0x60')](_0x38c355[_0x9041('0x61')]);}})['then'](respondWithResult(_0x4fb665,null))['catch'](handleError(_0x4fb665,null));};exports[_0x9041('0x6f')]=function(_0x46654f,_0x101c99,_0x3e6251){var _0x19d25e={'raw':![],'where':{}};var _0x134d47={};var _0x6720a1={'count':0x0,'rows':[]};return db['SmsAccount'][_0x9041('0x70')]({'where':{'id':_0x46654f[_0x9041('0x5d')]['id']}})[_0x9041('0x20')](handleEntityNotFound(_0x101c99,null))[_0x9041('0x20')](function(_0xa886f1){if(_0xa886f1){_0x134d47[_0x9041('0x46')]=_[_0x9041('0x47')](db[_0x9041('0x6e')]['rawAttributes']);_0x134d47[_0x9041('0x48')]=_['keys'](_0x46654f[_0x9041('0x48')]);_0x134d47[_0x9041('0x49')]=_[_0x9041('0x4a')](_0x134d47[_0x9041('0x46')],_0x134d47[_0x9041('0x48')]);_0x19d25e[_0x9041('0x4b')]=_[_0x9041('0x4a')](_0x134d47[_0x9041('0x46')],qs['fields'](_0x46654f[_0x9041('0x48')][_0x9041('0x4c')]));_0x19d25e['attributes']=_0x19d25e['attributes'][_0x9041('0x4d')]?_0x19d25e[_0x9041('0x4b')]:_0x134d47[_0x9041('0x46')];if(!_0x46654f[_0x9041('0x48')][_0x9041('0x4e')]('nolimit')){_0x19d25e[_0x9041('0x30')]=qs[_0x9041('0x30')](_0x46654f[_0x9041('0x48')][_0x9041('0x30')]);_0x19d25e[_0x9041('0x2f')]=qs[_0x9041('0x2f')](_0x46654f[_0x9041('0x48')][_0x9041('0x2f')]);}_0x19d25e[_0x9041('0x50')]=qs[_0x9041('0x51')](_0x46654f[_0x9041('0x48')][_0x9041('0x51')]);_0x19d25e[_0x9041('0x52')]=qs[_0x9041('0x49')](_[_0x9041('0x53')](_0x46654f[_0x9041('0x48')],_0x134d47[_0x9041('0x49')]));_0x19d25e[_0x9041('0x52')][_0x9041('0x68')]=_0xa886f1['id'];if(_0x46654f[_0x9041('0x48')][_0x9041('0x54')]){_0x19d25e[_0x9041('0x52')]=_[_0x9041('0x55')](_0x19d25e['where'],{'$or':_[_0x9041('0x42')](_0x19d25e[_0x9041('0x4b')],function(_0x47f25f){var _0xb642f7={};_0xb642f7[_0x47f25f]={'$like':'%'+_0x46654f[_0x9041('0x48')][_0x9041('0x54')]+'%'};return _0xb642f7;})});}_0x19d25e=_[_0x9041('0x55')]({},_0x19d25e,_0x46654f[_0x9041('0x56')]);return db[_0x9041('0x6e')]['count']({'where':_0x19d25e[_0x9041('0x52')]})[_0x9041('0x20')](function(_0x18a35c){_0x6720a1[_0x9041('0x32')]=_0x18a35c;if(_0x46654f[_0x9041('0x48')][_0x9041('0x58')]){_0x19d25e[_0x9041('0x59')]=[{'all':!![]}];}return db[_0x9041('0x6e')][_0x9041('0x5a')](_0x19d25e);})['then'](function(_0x12509e){_0x6720a1[_0x9041('0x5b')]=_0x12509e;return _0x6720a1;});}})[_0x9041('0x20')](respondWithFilteredResult(_0x101c99,_0x19d25e))[_0x9041('0x2b')](handleError(_0x101c99,null));};exports[_0x9041('0x71')]=function(_0x4bbeed,_0x3ab145,_0x28e946){return db[_0x9041('0x57')][_0x9041('0x5f')]({'where':{'id':_0x4bbeed[_0x9041('0x5d')]['id']}})[_0x9041('0x20')](handleEntityNotFound(_0x3ab145,null))['then'](function(_0x5978e1){if(_0x5978e1){return _0x5978e1[_0x9041('0x71')](_0x4bbeed['query']['ids']);}})['then'](respondWithStatusCode(_0x3ab145,null))[_0x9041('0x2b')](handleError(_0x3ab145,null));};exports['notify']=function(_0x5a07ec,_0x1ea60f,_0x342f53){var _0x52af3f={'channel':'sms'};var _0x3fd7c9=[];var _0x55c0e7=[];var _0x51dd7a={};return db[_0x9041('0x57')][_0x9041('0x5f')]({'where':{'id':_0x5a07ec['params']['id']},'include':[{'model':db[_0x9041('0x72')],'as':'Applications'}]})[_0x9041('0x20')](handleEntityNotFound(_0x1ea60f,null))[_0x9041('0x20')](function(_0x12544d){_0x52af3f['account']=_0x12544d;_0x52af3f[_0x9041('0x73')]=_[_0x9041('0x74')](_0x12544d[_0x9041('0x75')],[_0x9041('0x76')],[_0x9041('0x77')]);if(_0x52af3f['account']['Applications']){delete _0x52af3f[_0x9041('0x78')][_0x9041('0x75')];}return db[_0x9041('0x79')][_0x9041('0x7a')]();})[_0x9041('0x20')](function(_0x283283){if(!_0x283283){throw new db['Sequelize'][(_0x9041('0x7b'))](_0x9041('0x7c'));}_0x3fd7c9=_[_0x9041('0x7d')](_[_0x9041('0x47')](_0x283283),[_0x9041('0x7e'),_0x9041('0x7f')]);_0x55c0e7=_['difference'](_[_0x9041('0x47')](_0x283283),[_0x9041('0x7e'),_0x9041('0x7f'),_0x9041('0x80'),_0x9041('0x81')]);_0x52af3f[_0x9041('0x61')]={'mapKey':_0x9041('0x82')};if(_0x52af3f[_0x9041('0x78')][_0x9041('0x45')]){switch(_0x52af3f[_0x9041('0x78')][_0x9041('0x45')]){case _0x9041('0x83'):_0x52af3f['body'][_0x9041('0x84')]=_0x5a07ec[_0x9041('0x61')][_0x9041('0x85')];_0x52af3f[_0x9041('0x61')][_0x9041('0x61')]=_0x5a07ec[_0x9041('0x61')][_0x9041('0x86')];_0x52af3f[_0x9041('0x61')][_0x9041('0x87')]=_0x5a07ec[_0x9041('0x61')][_0x9041('0x88')];break;case _0x9041('0x89'):_0x52af3f[_0x9041('0x61')][_0x9041('0x84')]='+'+_0x5a07ec['body'][_0x9041('0x8a')];_0x52af3f['body'][_0x9041('0x61')]=_0x5a07ec[_0x9041('0x61')][_0x9041('0x8b')];break;case'connectel':_0x52af3f[_0x9041('0x61')][_0x9041('0x84')]=_0x5a07ec[_0x9041('0x61')][_0x9041('0x84')];_0x52af3f[_0x9041('0x61')][_0x9041('0x61')]=_0x5a07ec['body']['message'];break;case _0x9041('0x8c'):_0x52af3f[_0x9041('0x61')]['from']=_0x5a07ec['body'][_0x9041('0x84')];_0x52af3f[_0x9041('0x61')][_0x9041('0x61')]=_0x5a07ec[_0x9041('0x61')][_0x9041('0x61')];_0x52af3f[_0x9041('0x61')]['messageId']=_0x5a07ec[_0x9041('0x61')][_0x9041('0x8d')];break;case _0x9041('0x8e'):_0x52af3f['body'][_0x9041('0x84')]=_0x5a07ec[_0x9041('0x61')][_0x9041('0x85')];_0x52af3f['body'][_0x9041('0x61')]=_0x5a07ec[_0x9041('0x61')][_0x9041('0x8f')];_0x52af3f[_0x9041('0x61')][_0x9041('0x87')]=_0x5a07ec[_0x9041('0x61')]['MessageUUID'];break;case _0x9041('0x90'):_0x52af3f['body'][_0x9041('0x84')]='+'+_0x5a07ec[_0x9041('0x61')][_0x9041('0x91')][0x0][_0x9041('0x84')];_0x52af3f[_0x9041('0x61')][_0x9041('0x61')]=_0x5a07ec[_0x9041('0x61')]['results'][0x0][_0x9041('0x8b')];_0x52af3f[_0x9041('0x61')][_0x9041('0x87')]=_0x5a07ec[_0x9041('0x61')][_0x9041('0x91')][0x0][_0x9041('0x87')];break;case'csc':_0x52af3f[_0x9041('0x61')][_0x9041('0x84')]=_0x5a07ec[_0x9041('0x61')][_0x9041('0x92')];_0x52af3f[_0x9041('0x61')][_0x9041('0x61')]=_0x5a07ec['body'][_0x9041('0x93')]['message'];break;case _0x9041('0x94'):_0x52af3f[_0x9041('0x61')][_0x9041('0x84')]=_0x5a07ec[_0x9041('0x61')][_0x9041('0x95')];_0x52af3f[_0x9041('0x61')][_0x9041('0x61')]=_0x5a07ec[_0x9041('0x61')][_0x9041('0x8b')];_0x52af3f[_0x9041('0x61')][_0x9041('0x87')]=_0x5a07ec[_0x9041('0x61')][_0x9041('0x96')];break;case _0x9041('0x97'):_0x52af3f['body'][_0x9041('0x87')]=_0x5a07ec[_0x9041('0x61')][0x0][_0x9041('0x28')]['id'];_0x52af3f[_0x9041('0x61')][_0x9041('0x84')]=_0x5a07ec[_0x9041('0x61')][0x0]['message'][_0x9041('0x84')];_0x52af3f[_0x9041('0x61')]['body']=_0x5a07ec[_0x9041('0x61')][0x0][_0x9041('0x28')][_0x9041('0x8b')];break;case _0x9041('0x98'):_0x52af3f[_0x9041('0x61')][_0x9041('0x84')]=_0x5a07ec[_0x9041('0x61')][_0x9041('0x84')];_0x52af3f['body']['body']=_0x5a07ec[_0x9041('0x61')][_0x9041('0x28')];_0x52af3f[_0x9041('0x61')]['messageId']=_0x5a07ec[_0x9041('0x61')]['refid'];break;}}if(_0x52af3f['body']['id']){delete _0x52af3f[_0x9041('0x61')]['id'];}if(_[_0x9041('0x99')](_0x52af3f[_0x9041('0x61')][_0x9041('0x84')])){throw new db[(_0x9041('0x9a'))][(_0x9041('0x7b'))](_0x9041('0x9b'));}if(_[_0x9041('0x99')](_0x52af3f['body'][_0x9041('0x61')])||_0x52af3f[_0x9041('0x61')][_0x9041('0x61')]===''){throw new db[(_0x9041('0x9a'))][(_0x9041('0x7b'))](_0x9041('0x9c'));}if(_[_0x9041('0x99')](_0x52af3f[_0x9041('0x61')][_0x9041('0x9d')])){throw new db[(_0x9041('0x9a'))][(_0x9041('0x7b'))](_0x9041('0x9e')+_0x55c0e7);}if(!_['includes'](_0x55c0e7,_0x52af3f[_0x9041('0x61')][_0x9041('0x9d')])){throw new db[(_0x9041('0x9a'))]['ValidationError'](_0x9041('0x9f')+_0x55c0e7);}_0x51dd7a[_0x52af3f['body'][_0x9041('0x9d')]]=_0x52af3f[_0x9041('0x61')][_0x9041('0x84')];return db[_0x9041('0xa0')][_0x9041('0x5f')]({'where':{'id':_0x52af3f[_0x9041('0x78')][_0x9041('0x81')]},'include':[{'model':db[_0x9041('0x79')],'as':_0x9041('0xa1'),'where':_0x51dd7a,'limit':0x1,'order':[[_0x9041('0x7f'),_0x9041('0xa2')]]}]});})[_0x9041('0x20')](handleEntityNotFound(_0x1ea60f,null))[_0x9041('0x20')](function(_0x2c3af6){if(_0x2c3af6){_0x52af3f[_0x9041('0xa3')]=_[_0x9041('0xa4')](_0x2c3af6,[_0x9041('0xa1')]);if(_0x2c3af6['Contacts']['length']){return _0x2c3af6[_0x9041('0xa1')][0x0];}var _0x509aa0=_[_0x9041('0x1a')](_0x52af3f[_0x9041('0x61')],{'firstName':_0x52af3f['body'][_0x9041('0x84')],'ListId':_0x2c3af6['id']});_0x509aa0[_0x52af3f[_0x9041('0x61')][_0x9041('0x9d')]]=_0x52af3f[_0x9041('0x61')]['from'];return db['CmContact']['create'](_0x509aa0,{'fields':_0x3fd7c9,'raw':!![]});}})['then'](handleEntityNotFound(_0x1ea60f,null))['then'](function(_0x5a76bd){if(_0x5a76bd){_0x52af3f['contact']=_0x5a76bd;var _0x23a9ae={'ContactId':_0x5a76bd['id'],'phone':_0x52af3f[_0x9041('0x61')][_0x9041('0x84')],'SmsAccountId':_0x5a07ec[_0x9041('0x5d')]['id']};var _0x4d028e={'ContactId':_0x5a76bd['id'],'SmsAccountId':_0x5a07ec[_0x9041('0x5d')]['id'],'closed':![]};return db[_0x9041('0xa5')][_0x9041('0x5f')]({'where':_0x4d028e})[_0x9041('0x20')](function(_0x2b86bc){if(_0x2b86bc){return[_0x2b86bc,![]];}return db[_0x9041('0xa5')]['create'](_0x23a9ae)[_0x9041('0x20')](function(_0x263d5d){return[_0x263d5d,!![]];});});}})[_0x9041('0xa6')](function(_0x3c321a,_0x4be235){_0x52af3f[_0x9041('0xa7')]=_0x3c321a[_0x9041('0x3a')]({'plain':!![]});_0x52af3f['interaction'][_0x9041('0xa8')]=![];if(_0x4be235){if(_0x52af3f[_0x9041('0x78')][_0x9041('0xa9')]){_0x52af3f['applications']['push']({'id':0x0,'priority':_0x52af3f[_0x9041('0x73')][_0x9041('0x4d')]+0x1,'app':'close','appdata':_0x9041('0xaa'),'interval':_0x9041('0xab')});}_0x52af3f['interaction'][_0x9041('0xa8')]=!![];}return db['SmsMessage'][_0x9041('0x60')]({'phone':_0x52af3f[_0x9041('0x61')][_0x9041('0x84')],'messageId':_0x52af3f[_0x9041('0x61')]['messageId'],'body':_0x52af3f[_0x9041('0x61')][_0x9041('0x61')],'SmsAccountId':_0x5a07ec[_0x9041('0x5d')]['id'],'SmsInteractionId':_0x3c321a['id'],'direction':'in','ContactId':_0x3c321a['ContactId'],'AttachmentId':_0x52af3f['body'][_0x9041('0xac')]});})[_0x9041('0x20')](function(_0x18f4de){_0x52af3f['message']=_0x18f4de;if(!_0x52af3f['interaction'][_0x9041('0xad')])return;return db[_0x9041('0xae')]['find']({'attributes':['id',_0x9041('0x3f')],'where':{'id':_0x52af3f[_0x9041('0xa7')]['UserId']}});})[_0x9041('0x20')](function(_0x3dd08f){if(_0x3dd08f){_0x52af3f[_0x9041('0x73')][_0x9041('0xaf')]({'id':0x0,'priority':0x0,'app':_0x9041('0xb0'),'appdata':_0x3dd08f[_0x9041('0x3f')]+','+(_0x52af3f[_0x9041('0x78')][_0x9041('0xb1')]||0xa),'interval':'*,*,*,*'});}if(!_0x52af3f[_0x9041('0xa7')][_0x9041('0xb2')])return;return db[_0x9041('0xb3')][_0x9041('0x5f')]({'attributes':['id',_0x9041('0x3f')],'where':{'id':_0x52af3f[_0x9041('0xa7')]['queueId']}});})[_0x9041('0x20')](function(_0x2f4d14){if(_0x2f4d14){_0x52af3f[_0x9041('0x73')][_0x9041('0xaf')]({'id':0x0,'priority':0x1,'app':_0x9041('0xb4'),'appdata':_0x2f4d14[_0x9041('0x3f')]+','+(_0x52af3f[_0x9041('0x78')][_0x9041('0xb5')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x9041('0xb6'),'startRouting',_0x52af3f);})[_0x9041('0x20')](function(_0x29477f){if(_0x29477f){var _0x13d014=0xc8;var _0x10fa54=_0x9041('0xb7');logger['info'](_0x9041('0x24'),_0x10fa54,_0x13d014,_0x9041('0xb8'));logger[_0x9041('0x23')](_0x9041('0xb9'),_0x10fa54,_0x13d014,_0x9041('0xb8'),JSON[_0x9041('0x25')](_0x29477f));if(_0x52af3f[_0x9041('0x78')]['type']==='twilio'){return _0x1ea60f[_0x9041('0x2c')](_0x13d014)[_0x9041('0x33')](_0x9041('0xba'),_0x9041('0xbb'))['send'](_0x9041('0xbc'));}else{return _0x1ea60f[_0x9041('0x2c')](_0x13d014)['json'](_0x29477f);}}})[_0x9041('0x2b')](handleError(_0x1ea60f,null));};exports[_0x9041('0xbd')]=function(_0x5f4479,_0x44852f){var _0x146699=_0x5f4479[_0x9041('0x5d')]['id'];var _0x462e0c=_0x5f4479[_0x9041('0x61')];var _0x3ac714=0xc8;var _0x4d81ee=null;return db['sequelize'][_0x9041('0xbe')]({'isolationLevel':db['sequelize'][_0x9041('0xbf')][_0x9041('0xc0')]['READ_COMMITTED']},function(_0x169d21){return db[_0x9041('0x57')][_0x9041('0x70')]({'where':{'id':_0x146699},'transaction':_0x169d21})['then'](function(_0x172e0b){if(_0x172e0b){return db[_0x9041('0x72')][_0x9041('0x39')]({'where':{'SmsAccountId':_0x146699},'transaction':_0x169d21})[_0x9041('0x20')](function(){var _0x2d0529=_[_0x9041('0x42')](_0x462e0c,function(_0x537cb5){_0x537cb5[_0x9041('0x68')]=_0x146699;return _0x537cb5;});return db[_0x9041('0x72')][_0x9041('0xc1')](_0x2d0529,{'transaction':_0x169d21});});}else{_0x3ac714=0x194;_0x4d81ee=[];}});})[_0x9041('0x20')](function(){if(_0x3ac714!==0x194){return db['SmsApplication'][_0x9041('0xc2')]({'where':{'SmsAccountId':_0x146699},'order':_0x9041('0x76')})[_0x9041('0x20')](function(_0x2a4ad1){_0x4d81ee=_0x2a4ad1;});}})['catch'](function(_0x1bbf87){_0x3ac714=0x1f4;logger['error'](_0x1bbf87[_0x9041('0x3e')]);if(_0x1bbf87[_0x9041('0x3f')]){delete _0x1bbf87[_0x9041('0x3f')];}_0x4d81ee=_0x1bbf87;})[_0x9041('0xc3')](function(){if(_0x4d81ee===null){_0x44852f[_0x9041('0x3d')](_0x3ac714);}else{if(_0x3ac714===0x1f4){_0x44852f[_0x9041('0x2c')](_0x3ac714)[_0x9041('0x40')](_0x4d81ee);}else{_0x44852f[_0x9041('0x2c')](_0x3ac714)['json'](_0x4d81ee);}}});};exports[_0x9041('0xc4')]=function(_0x2c46f8,_0x3707a5,_0xa2f751){var _0x9992ae={};var _0x491f59={};var _0x372bdb;var _0x223c47;return db['SmsAccount'][_0x9041('0x70')]({'where':{'id':_0x2c46f8[_0x9041('0x5d')]['id']}})[_0x9041('0x20')](handleEntityNotFound(_0x3707a5,null))[_0x9041('0x20')](function(_0x36f15f){if(_0x36f15f){_0x372bdb=_0x36f15f;_0x491f59[_0x9041('0x46')]=_[_0x9041('0x47')](db[_0x9041('0x72')]['rawAttributes']);_0x491f59[_0x9041('0x48')]=_[_0x9041('0x47')](_0x2c46f8[_0x9041('0x48')]);_0x491f59[_0x9041('0x49')]=_['intersection'](_0x491f59['model'],_0x491f59[_0x9041('0x48')]);_0x9992ae['attributes']=_['intersection'](_0x491f59[_0x9041('0x46')],qs[_0x9041('0x4c')](_0x2c46f8[_0x9041('0x48')][_0x9041('0x4c')]));_0x9992ae[_0x9041('0x4b')]=_0x9992ae[_0x9041('0x4b')]['length']?_0x9992ae[_0x9041('0x4b')]:_0x491f59[_0x9041('0x46')];_0x9992ae[_0x9041('0x50')]=qs[_0x9041('0x51')](_0x2c46f8['query'][_0x9041('0x51')]);_0x9992ae[_0x9041('0x52')]=qs[_0x9041('0x49')](_[_0x9041('0x53')](_0x2c46f8['query'],_0x491f59[_0x9041('0x49')]));if(_0x2c46f8[_0x9041('0x48')][_0x9041('0x54')]){_0x9992ae['where']=_[_0x9041('0x55')](_0x9992ae[_0x9041('0x52')],{'$or':_['map'](_0x9992ae[_0x9041('0x4b')],function(_0x294203){var _0xcd70a={};_0xcd70a[_0x294203]={'$like':'%'+_0x2c46f8[_0x9041('0x48')]['filter']+'%'};return _0xcd70a;})});}_0x9992ae=_[_0x9041('0x55')]({},_0x9992ae,_0x2c46f8[_0x9041('0x56')]);return _0x372bdb['getApplications'](_0x9992ae);}})[_0x9041('0x20')](function(_0x3d4716){if(_0x3d4716){_0x223c47=_0x3d4716['length'];if(!_0x2c46f8[_0x9041('0x48')]['hasOwnProperty']('nolimit')){_0x9992ae[_0x9041('0x30')]=qs[_0x9041('0x30')](_0x2c46f8[_0x9041('0x48')][_0x9041('0x30')]);_0x9992ae['offset']=qs[_0x9041('0x2f')](_0x2c46f8['query'][_0x9041('0x2f')]);}return _0x372bdb[_0x9041('0xc4')](_0x9992ae);}})['then'](function(_0x39fbf7){if(_0x39fbf7){return _0x39fbf7?{'count':_0x223c47,'rows':_0x39fbf7}:null;}})['then'](respondWithResult(_0x3707a5,null))['catch'](handleError(_0x3707a5,null));};exports[_0x9041('0xc5')]=function(_0x7b9340,_0x44d46b,_0x5d2a53){var _0x594ced={'raw':![],'where':{}};var _0x281ad3={};var _0x126e56={'count':0x0,'rows':[]};return db[_0x9041('0x57')][_0x9041('0x70')]({'where':{'id':_0x7b9340[_0x9041('0x5d')]['id']}})[_0x9041('0x20')](handleEntityNotFound(_0x44d46b,null))[_0x9041('0x20')](function(_0x4ac26b){if(_0x4ac26b){_0x281ad3[_0x9041('0x46')]=_[_0x9041('0x47')](db[_0x9041('0xa5')][_0x9041('0x43')]);_0x281ad3[_0x9041('0x48')]=_[_0x9041('0x47')](_0x7b9340[_0x9041('0x48')]);_0x281ad3[_0x9041('0x49')]=_[_0x9041('0x4a')](_0x281ad3[_0x9041('0x46')],_0x281ad3[_0x9041('0x48')]);_0x594ced[_0x9041('0x4b')]=_[_0x9041('0x4a')](_0x281ad3['model'],qs[_0x9041('0x4c')](_0x7b9340['query']['fields']));_0x594ced[_0x9041('0x4b')]=_0x594ced[_0x9041('0x4b')]['length']?_0x594ced['attributes']:_0x281ad3['model'];if(!_0x7b9340[_0x9041('0x48')]['hasOwnProperty'](_0x9041('0x4f'))){_0x594ced[_0x9041('0x30')]=qs[_0x9041('0x30')](_0x7b9340[_0x9041('0x48')][_0x9041('0x30')]);_0x594ced[_0x9041('0x2f')]=qs[_0x9041('0x2f')](_0x7b9340[_0x9041('0x48')][_0x9041('0x2f')]);}_0x594ced[_0x9041('0x50')]=qs[_0x9041('0x51')](_0x7b9340['query'][_0x9041('0x51')]);_0x594ced[_0x9041('0x52')]=qs[_0x9041('0x49')](_[_0x9041('0x53')](_0x7b9340[_0x9041('0x48')],_0x281ad3['filters']));_0x594ced[_0x9041('0x52')][_0x9041('0x68')]=_0x4ac26b['id'];if(_0x7b9340[_0x9041('0x48')][_0x9041('0x54')]){_0x594ced[_0x9041('0x52')]=_[_0x9041('0x55')](_0x594ced[_0x9041('0x52')],{'$or':_['map'](_0x594ced['attributes'],function(_0x46815a){var _0x30bd9d={};_0x30bd9d[_0x46815a]={'$like':'%'+_0x7b9340[_0x9041('0x48')][_0x9041('0x54')]+'%'};return _0x30bd9d;})});}_0x594ced=_['merge']({},_0x594ced,_0x7b9340[_0x9041('0x56')]);return db[_0x9041('0xa5')]['count']({'where':_0x594ced[_0x9041('0x52')]})[_0x9041('0x20')](function(_0x5a0f09){_0x126e56[_0x9041('0x32')]=_0x5a0f09;if(_0x7b9340[_0x9041('0x48')][_0x9041('0x58')]){_0x594ced['include']=[{'model':db[_0x9041('0x79')],'as':_0x9041('0xc6'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x9041('0x3f'),_0x9041('0xc7'),_0x9041('0xc8')],'required':![]},{'model':db['Tag'],'as':_0x9041('0xc9'),'attributes':['id',_0x9041('0x3f'),_0x9041('0xca')],'where':_0x7b9340[_0x9041('0x48')][_0x9041('0xcb')]?{'id':_0x7b9340[_0x9041('0x48')][_0x9041('0xcb')]}:undefined,'required':_0x7b9340[_0x9041('0x48')][_0x9041('0xcb')]?!![]:![]}];}return db[_0x9041('0xa5')][_0x9041('0x5a')](_0x594ced);})[_0x9041('0x20')](function(_0x4f6195){_0x126e56['rows']=_0x4f6195;return _0x126e56;});}})[_0x9041('0x20')](respondWithFilteredResult(_0x44d46b,_0x594ced))[_0x9041('0x2b')](handleError(_0x44d46b,null));};exports[_0x9041('0x40')]=function(_0x52e8d5,_0x6bb291,_0x1fa242){var _0x4b737a,_0x1cf223,_0x246822;if(_['isNil'](_0x52e8d5[_0x9041('0x61')]['body'])||_0x52e8d5[_0x9041('0x61')]['body']===''){throw new db[(_0x9041('0x9a'))]['ValidationError'](_0x9041('0x9c'));}if(_[_0x9041('0x99')](_0x52e8d5['body']['to'])){throw new db[(_0x9041('0x9a'))][(_0x9041('0x7b'))](_0x9041('0xcc'));}_0x4b737a=_0x52e8d5[_0x9041('0x61')]['to'];return db[_0x9041('0x57')][_0x9041('0x5f')]({'where':{'id':_0x52e8d5[_0x9041('0x5d')]['id']},'include':[{'model':db[_0x9041('0xa0')],'as':'List','include':[{'model':db[_0x9041('0x79')],'as':_0x9041('0xa1'),'where':{'mobile':_0x4b737a},'limit':0x1,'order':[['updatedAt',_0x9041('0xa2')]]}]}]})[_0x9041('0x20')](handleEntityNotFound(_0x6bb291,null))['then'](function(_0x554ed7){if(_0x554ed7&&_0x554ed7[_0x9041('0xcd')]){_0x1cf223=_0x554ed7[_0x9041('0x3a')]({'plain':!![]});if(_0x1cf223[_0x9041('0xcd')]&&_0x1cf223[_0x9041('0xcd')][_0x9041('0xa1')]['length']){return _0x1cf223[_0x9041('0xcd')]['Contacts'][0x0];}return db[_0x9041('0x79')][_0x9041('0x60')](_[_0x9041('0x1a')](_0x52e8d5['body'],{'firstName':_0x4b737a,'mobile':_0x4b737a,'phone':_0x4b737a,'ListId':_0x1cf223[_0x9041('0x81')]}));}})[_0x9041('0x20')](handleEntityNotFound(_0x6bb291,null))['then'](function(_0x4a2b42){if(_0x4a2b42){_0x246822=_0x4a2b42;return db[_0x9041('0xa5')][_0x9041('0x5f')]({'where':{'ContactId':_0x246822['id'],'closed':![],'SmsAccountId':_0x1cf223['id']}})[_0x9041('0x20')](function(_0x2f63b8){if(_0x2f63b8){return[_0x2f63b8,![]];}return db[_0x9041('0xa5')]['create']({'UserId':_0x52e8d5[_0x9041('0x62')]['id'],'ContactId':_0x246822['id'],'SmsAccountId':_0x1cf223['id'],'phone':_0x4b737a,'firstMsgDirection':'out','Messages':[_[_0x9041('0x55')](_0x52e8d5[_0x9041('0x61')],{'read':![],'body':_0x52e8d5[_0x9041('0x61')]['body'],'phone':_0x4b737a,'SmsAccountId':_0x1cf223['id'],'UserId':_0x52e8d5[_0x9041('0x62')]['id'],'ContactId':_0x246822['id']})]},{'include':[{'model':db[_0x9041('0xce')],'as':_0x9041('0xcf')}]})['then'](function(_0x1354b5){return[_0x1354b5,!![]];});});}})[_0x9041('0xa6')](function(_0x5b3e84,_0x4be612){if(_0x4be612){return _0x5b3e84;}return db[_0x9041('0xce')]['create'](_[_0x9041('0x55')](_0x52e8d5[_0x9041('0x61')],{'read':![],'body':_0x52e8d5[_0x9041('0x61')][_0x9041('0x61')],'phone':_0x4b737a,'SmsAccountId':_0x1cf223['id'],'SmsInteractionId':_0x5b3e84['id'],'UserId':_0x52e8d5['user']['id'],'ContactId':_0x246822['id']}))['then'](function(_0x1675d0){_0x5b3e84[_0x9041('0xd0')][_0x9041('0xcf')]=[];_0x5b3e84[_0x9041('0xd0')][_0x9041('0xcf')]['push'](_0x1675d0['dataValues']);return _0x5b3e84;});})[_0x9041('0x20')](respondWithResult(_0x6bb291,null))[_0x9041('0x2b')](handleError(_0x6bb291,null));};exports[_0x9041('0x2c')]=function(_0x3c43d3,_0x287ea7,_0x18b9f6){if(_0x3c43d3[_0x9041('0x61')]['id']){delete _0x3c43d3[_0x9041('0x61')]['id'];}var _0x39afbc,_0x46f353,_0x2a2612;return db['SmsAccount'][_0x9041('0x5f')]({'where':{'id':_0x3c43d3[_0x9041('0x5d')]['id']}})[_0x9041('0x20')](handleEntityNotFound(_0x287ea7,null))[_0x9041('0x20')](function(_0x50c2ba){if(_0x50c2ba){_0x2a2612=_0x50c2ba;logger[_0x9041('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9041('0x2c'),_0x9041('0xd1'),_0x50c2ba[_0x9041('0x45')],util[_0x9041('0xd2')](_0x3c43d3['body'],{'showHidden':![],'depth':null}));switch(_0x50c2ba[_0x9041('0x45')]){case _0x9041('0x89'):if(_0x3c43d3[_0x9041('0x61')][_0x9041('0xd3')]&&_0x3c43d3[_0x9041('0x61')][_0x9041('0x2c')]){_0x46f353=_0x3c43d3[_0x9041('0x61')][_0x9041('0x2c')];return db[_0x9041('0xce')][_0x9041('0x5f')]({'where':{'messageId':_0x3c43d3['body'][_0x9041('0xd3')]}});}break;case'connectel':if(_0x3c43d3[_0x9041('0x61')][_0x9041('0xd4')]&&_0x3c43d3[_0x9041('0x61')][_0x9041('0xd5')]){_0x46f353=_0x3c43d3[_0x9041('0x61')][_0x9041('0xd5')];return db[_0x9041('0xce')][_0x9041('0x5f')]({'where':{'messageId':_0x3c43d3[_0x9041('0x61')][_0x9041('0xd4')]}});}break;case'clicksend':if(_0x3c43d3['body']['message_id']&&_0x3c43d3[_0x9041('0x61')]['status_code']){_0x46f353=_0x3c43d3[_0x9041('0x61')][_0x9041('0xd6')];return db[_0x9041('0xce')][_0x9041('0x5f')]({'where':{'messageId':_0x3c43d3['body'][_0x9041('0x8d')]}});}break;case'infobip':var _0x4fe31f=_0x3c43d3[_0x9041('0x61')][_0x9041('0x91')][0x0];if(_0x4fe31f[_0x9041('0x87')]&&_0x4fe31f[_0x9041('0x2c')]['groupName']===_0x9041('0xd7')){_0x46f353=_0x4fe31f[_0x9041('0x2c')]['groupName'];return db[_0x9041('0xce')]['find']({'where':{'messageId':_0x4fe31f[_0x9041('0x87')]}});}break;case _0x9041('0x94'):if(_0x3c43d3[_0x9041('0x61')][_0x9041('0x87')]&&_0x3c43d3[_0x9041('0x61')][_0x9041('0x2c')]){_0x46f353=_0x3c43d3[_0x9041('0x61')][_0x9041('0x2c')];return db[_0x9041('0xce')][_0x9041('0x5f')]({'where':{'messageId':_0x3c43d3['body'][_0x9041('0x87')]}});}break;case _0x9041('0x97'):if(_0x3c43d3[_0x9041('0x61')][0x0][_0x9041('0x28')]['id']){_0x46f353=_0x3c43d3['body'][0x0]['type'];return db['SmsMessage'][_0x9041('0x5f')]({'where':{'messageId':_0x3c43d3['body'][0x0][_0x9041('0x28')]['id']}});}break;case _0x9041('0x98'):if(_0x3c43d3[_0x9041('0x61')][_0x9041('0xd8')]&&_0x3c43d3[_0x9041('0x61')][_0x9041('0x2c')]){_0x46f353=_0x3c43d3[_0x9041('0x61')][_0x9041('0x2c')];return db[_0x9041('0xce')]['find']({'where':{'messageId':_0x3c43d3[_0x9041('0x61')][_0x9041('0xd8')]}});}break;}}})['then'](handleEntityNotFound(_0x287ea7,null))['then'](function(_0x42d057){if(_0x42d057){_0x39afbc=_0x42d057;switch(_0x2a2612[_0x9041('0x45')]){case _0x9041('0x89'):if(_0x46f353==='DELIVERED'){return _0x39afbc[_0x9041('0x38')]({'read':!![]});}else{logger[_0x9041('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9041('0x2c'),_0x9041('0x89'),util[_0x9041('0xd2')](_0x3c43d3[_0x9041('0x61')],{'showHidden':![],'depth':null}));}break;case _0x9041('0xd9'):if(_0x46f353==='1'){return _0x39afbc['update']({'read':!![]});}else{logger[_0x9041('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9041('0x2c'),_0x9041('0x89'),util['inspect'](_0x3c43d3[_0x9041('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x3c43d3[_0x9041('0x61')][_0x9041('0xda')]&&_0x46f353>=0xc8&&_0x46f353<=0xce){return _0x39afbc[_0x9041('0x38')]({'read':!![]});}else{logger[_0x9041('0x26')](_0x9041('0x24'),'status',_0x9041('0x8c'),util[_0x9041('0xd2')](_0x3c43d3['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x14651f=_0x3c43d3[_0x9041('0x61')]['results'][0x0];if(_0x14651f['status'][_0x9041('0xdb')]==='DELIVERED'){return _0x39afbc[_0x9041('0x38')]({'read':!![]});}else{logger['error'](_0x9041('0x24'),_0x9041('0x2c'),_0x9041('0x90'),util[_0x9041('0xd2')](_0x3c43d3['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x46f353=='DELIVERED_TO_GATEWAY'||_0x46f353==_0x9041('0xdc')){return _0x39afbc[_0x9041('0x38')]({'read':!![]});}else{logger[_0x9041('0x26')](_0x9041('0x24'),_0x9041('0x2c'),_0x9041('0x94'),util[_0x9041('0xd2')](_0x3c43d3[_0x9041('0x61')],{'showHidden':![],'depth':null}));}break;case _0x9041('0x97'):if(_0x46f353==_0x9041('0xdd')){return _0x39afbc[_0x9041('0x38')]({'read':!![]});}else{logger[_0x9041('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9041('0x2c'),_0x9041('0x97'),util['inspect'](_0x3c43d3[_0x9041('0x61')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x46f353==='DELIVRD'||_0x46f353==='ACCEPTD'){return _0x39afbc['update']({'read':!![]});}else{logger['error'](_0x9041('0x24'),'status',_0x9041('0x98'),util[_0x9041('0xd2')](_0x3c43d3[_0x9041('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x39afbc;}})[_0x9041('0x20')](respondWithResult(_0x287ea7,null))[_0x9041('0x2b')](handleError(_0x287ea7,null));};exports[_0x9041('0xde')]=function(_0x266416,_0x262989,_0x20fd96){var _0x2e9ead,_0x51f104,_0x1da65c;return db[_0x9041('0x57')][_0x9041('0x5f')]({'where':{'id':_0x266416[_0x9041('0x5d')]['id']}})[_0x9041('0x20')](handleEntityNotFound(_0x262989,null))[_0x9041('0x20')](function(_0x4cbff0){if(_0x4cbff0){_0x1da65c=_0x4cbff0;logger[_0x9041('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9041('0x2c'),'received\x20delivery\x20report\x20from',_0x4cbff0[_0x9041('0x45')],util[_0x9041('0xd2')](_0x266416[_0x9041('0x48')],{'showHidden':![],'depth':null}));switch(_0x4cbff0[_0x9041('0x45')]){case'csc':if(_0x266416[_0x9041('0x48')]['message-id']&&_0x266416[_0x9041('0x48')]['state']){_0x51f104=_0x266416[_0x9041('0x48')][_0x9041('0xdf')];return db[_0x9041('0xce')][_0x9041('0x5f')]({'where':{'messageId':_0x266416['query'][_0x9041('0xe0')]}});}break;}}})[_0x9041('0x20')](handleEntityNotFound(_0x262989,null))['then'](function(_0x195362){if(_0x195362){_0x2e9ead=_0x195362;switch(_0x1da65c[_0x9041('0x45')]){case _0x9041('0xe1'):if(_0x51f104==='2'||_0x51f104==='6'){return _0x2e9ead[_0x9041('0x38')]({'read':!![]});}else{logger[_0x9041('0x26')](_0x9041('0x24'),_0x9041('0x2c'),_0x9041('0xe1'),util[_0x9041('0xd2')](_0x266416['query'],{'showHidden':![],'depth':null}));};break;}return _0x2e9ead;}})[_0x9041('0x20')](respondWithResult(_0x262989,null))[_0x9041('0x2b')](handleError(_0x262989,null));};exports['addAgents']=function(_0x460264,_0x38cbc9,_0x56ea00){return db['SmsAccount'][_0x9041('0x5f')]({'where':{'id':_0x460264['params']['id']}})[_0x9041('0x20')](handleEntityNotFound(_0x38cbc9,null))['then'](function(_0x1ecd2b){if(_0x1ecd2b){return _0x1ecd2b[_0x9041('0xe2')](_0x460264[_0x9041('0x61')][_0x9041('0x6c')],_['omit'](_0x460264[_0x9041('0x61')],['ids','id'])||{})[_0x9041('0xa6')](function(_0x1375ce){for(var _0xd03f93=0x0;_0xd03f93<_0x460264[_0x9041('0x61')][_0x9041('0x6c')][_0x9041('0x4d')];_0xd03f93+=0x1){socket['emit'](_0x9041('0xe3'),{'UserId':Number(_0x460264['body'][_0x9041('0x6c')][_0xd03f93]),'SmsAccountId':Number(_0x460264[_0x9041('0x5d')]['id'])});}return _0x1375ce;});}})['then'](respondWithResult(_0x38cbc9,null))[_0x9041('0x2b')](handleError(_0x38cbc9,null));};exports[_0x9041('0xe4')]=function(_0x31ad13,_0x29bf91,_0x234347){return db['SmsAccount'][_0x9041('0x5f')]({'where':{'id':_0x31ad13[_0x9041('0x5d')]['id']}})[_0x9041('0x20')](handleEntityNotFound(_0x29bf91,null))['then'](function(_0x27b5cc){if(_0x27b5cc){return _0x27b5cc[_0x9041('0xe4')](_0x31ad13['query'][_0x9041('0x6c')])[_0x9041('0x20')](function(){if(_['isArray'](_0x31ad13[_0x9041('0x48')][_0x9041('0x6c')])){for(var _0x21a054=0x0;_0x21a054<_0x31ad13[_0x9041('0x48')][_0x9041('0x6c')][_0x9041('0x4d')];_0x21a054+=0x1){socket[_0x9041('0xe5')](_0x9041('0xe6'),{'UserId':Number(_0x31ad13[_0x9041('0x48')][_0x9041('0x6c')][_0x21a054]),'SmsAccountId':Number(_0x31ad13['params']['id'])});}}else{socket[_0x9041('0xe5')](_0x9041('0xe6'),{'UserId':Number(_0x31ad13[_0x9041('0x48')]['ids']),'SmsAccountId':Number(_0x31ad13[_0x9041('0x5d')]['id'])});}});}})[_0x9041('0x20')](respondWithStatusCode(_0x29bf91,null))['catch'](handleError(_0x29bf91,null));};exports['getAgents']=function(_0x444437,_0x24d5ec,_0x385396){var _0x3f23b7={};var _0x51678e={};var _0xec7ce5;var _0x541808;return db[_0x9041('0x57')][_0x9041('0x70')]({'where':{'id':_0x444437['params']['id']}})[_0x9041('0x20')](handleEntityNotFound(_0x24d5ec,null))['then'](function(_0x3ee8a4){if(_0x3ee8a4){_0xec7ce5=_0x3ee8a4;_0x51678e[_0x9041('0x46')]=_[_0x9041('0x47')](db['User'][_0x9041('0x43')]);_0x51678e[_0x9041('0x48')]=_[_0x9041('0x47')](_0x444437[_0x9041('0x48')]);_0x51678e[_0x9041('0x49')]=_[_0x9041('0x4a')](_0x51678e[_0x9041('0x46')],_0x51678e[_0x9041('0x48')]);_0x3f23b7[_0x9041('0x4b')]=_[_0x9041('0x4a')](_0x51678e['model'],qs[_0x9041('0x4c')](_0x444437[_0x9041('0x48')]['fields']));_0x3f23b7[_0x9041('0x4b')]=_0x3f23b7[_0x9041('0x4b')][_0x9041('0x4d')]?_0x3f23b7[_0x9041('0x4b')]:_0x51678e[_0x9041('0x46')];_0x3f23b7[_0x9041('0x50')]=qs[_0x9041('0x51')](_0x444437[_0x9041('0x48')][_0x9041('0x51')]);_0x3f23b7[_0x9041('0x52')]=qs[_0x9041('0x49')](_[_0x9041('0x53')](_0x444437[_0x9041('0x48')],_0x51678e[_0x9041('0x49')]));if(_0x444437[_0x9041('0x48')][_0x9041('0x54')]){_0x3f23b7[_0x9041('0x52')]=_['merge'](_0x3f23b7[_0x9041('0x52')],{'$or':_[_0x9041('0x42')](_0x3f23b7[_0x9041('0x4b')],function(_0x38a7f5){var _0x2c0634={};_0x2c0634[_0x38a7f5]={'$like':'%'+_0x444437[_0x9041('0x48')]['filter']+'%'};return _0x2c0634;})});}_0x3f23b7=_['merge']({},_0x3f23b7,_0x444437[_0x9041('0x56')]);return _0xec7ce5[_0x9041('0xe7')](_0x3f23b7);}})['then'](function(_0x3eb7c3){if(_0x3eb7c3){_0x541808=_0x3eb7c3[_0x9041('0x4d')];if(!_0x444437['query'][_0x9041('0x4e')](_0x9041('0x4f'))){_0x3f23b7[_0x9041('0x30')]=qs[_0x9041('0x30')](_0x444437['query'][_0x9041('0x30')]);_0x3f23b7[_0x9041('0x2f')]=qs['offset'](_0x444437[_0x9041('0x48')][_0x9041('0x2f')]);}return _0xec7ce5[_0x9041('0xe7')](_0x3f23b7);}})['then'](function(_0x3baad9){if(_0x3baad9){return _0x3baad9?{'count':_0x541808,'rows':_0x3baad9}:null;}})[_0x9041('0x20')](respondWithResult(_0x24d5ec,null))['catch'](handleError(_0x24d5ec,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index a4e9c5b..78cfea2 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 _0x6fa0=['setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x250c4a,_0x52d17d){var _0x1ba095=function(_0x47c343){while(--_0x47c343){_0x250c4a['push'](_0x250c4a['shift']());}};_0x1ba095(++_0x52d17d);}(_0x6fa0,0x90));var _0x06fa=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6fa0[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x06fa('0x0')](0x0);var events={'afterCreate':_0x06fa('0x1'),'afterUpdate':'update','afterDestroy':_0x06fa('0x2')};function emitEvent(_0x43028d){return function(_0x4afed9,_0x43b520,_0x428175){SmsAccountEvents[_0x06fa('0x3')](_0x43028d+':'+_0x4afed9['id'],_0x4afed9);SmsAccountEvents['emit'](_0x43028d,_0x4afed9);_0x428175(null);};}for(var e in events){if(events[_0x06fa('0x4')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x06fa('0x5')]=SmsAccountEvents; \ No newline at end of file +var _0x1356=['update','emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount','setMaxListeners','save'];(function(_0x577519,_0x346daf){var _0x5b12f7=function(_0x4aecb6){while(--_0x4aecb6){_0x577519['push'](_0x577519['shift']());}};_0x5b12f7(++_0x346daf);}(_0x1356,0xdc));var _0x6135=function(_0x529dff,_0x315763){_0x529dff=_0x529dff-0x0;var _0x3ada90=_0x1356[_0x529dff];return _0x3ada90;};'use strict';var EventEmitter=require(_0x6135('0x0'));var SmsAccount=require(_0x6135('0x1'))['db'][_0x6135('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6135('0x3')](0x0);var events={'afterCreate':_0x6135('0x4'),'afterUpdate':_0x6135('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4ca1f1){return function(_0x5086e6,_0x1ba7c5,_0x45fbef){SmsAccountEvents[_0x6135('0x6')](_0x4ca1f1+':'+_0x5086e6['id'],_0x5086e6);SmsAccountEvents[_0x6135('0x6')](_0x4ca1f1,_0x5086e6);_0x45fbef(null);};}for(var e in events){if(events[_0x6135('0x7')](e)){var event=events[e];SmsAccount[_0x6135('0x8')](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 2eb863e..114ecb9 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 _0x40af=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','util','../../config/logger'];(function(_0xacea04,_0x8e5296){var _0x376df4=function(_0x5105a5){while(--_0x5105a5){_0xacea04['push'](_0xacea04['shift']());}};_0x376df4(++_0x8e5296);}(_0x40af,0x8d));var _0xf40a=function(_0x516200,_0x5848ae){_0x516200=_0x516200-0x0;var _0x522210=_0x40af[_0x516200];return _0x522210;};'use strict';var _=require('lodash');var util=require(_0xf40a('0x0'));var logger=require(_0xf40a('0x1'))(_0xf40a('0x2'));var moment=require(_0xf40a('0x3'));var BPromise=require(_0xf40a('0x4'));var rp=require(_0xf40a('0x5'));var fs=require('fs');var path=require(_0xf40a('0x6'));var rimraf=require(_0xf40a('0x7'));var config=require(_0xf40a('0x8'));var attributes=require(_0xf40a('0x9'));module[_0xf40a('0xa')]=function(_0x4fae23,_0x264c16){return _0x4fae23[_0xf40a('0xb')](_0xf40a('0xc'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9662=['rimraf','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x44c001,_0x327d7f){var _0x19468f=function(_0x2911c9){while(--_0x2911c9){_0x44c001['push'](_0x44c001['shift']());}};_0x19468f(++_0x327d7f);}(_0x9662,0x68));var _0x2966=function(_0x41eb90,_0x452309){_0x41eb90=_0x41eb90-0x0;var _0xb0c7e2=_0x9662[_0x41eb90];return _0xb0c7e2;};'use strict';var _=require(_0x2966('0x0'));var util=require(_0x2966('0x1'));var logger=require(_0x2966('0x2'))('api');var moment=require(_0x2966('0x3'));var BPromise=require(_0x2966('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2966('0x5'));var rimraf=require(_0x2966('0x6'));var config=require('../../config/environment');var attributes=require(_0x2966('0x7'));module['exports']=function(_0x47504f,_0x457611){return _0x47504f[_0x2966('0x8')](_0x2966('0x9'),attributes,{'tableName':_0x2966('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 2a00ad9..f38067f 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 _0x455c=['stringify','error','code','message','result','catch','ShowSmsAccount','find','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s'];(function(_0x34bcaf,_0x47885c){var _0x116602=function(_0x594d6e){while(--_0x594d6e){_0x34bcaf['push'](_0x34bcaf['shift']());}};_0x116602(++_0x47885c);}(_0x455c,0xc8));var _0xc455=function(_0x3a607e,_0x54d530){_0x3a607e=_0x3a607e-0x0;var _0x37b106=_0x455c[_0x3a607e];return _0x37b106;};'use strict';var _=require(_0xc455('0x0'));var util=require(_0xc455('0x1'));var moment=require('moment');var BPromise=require(_0xc455('0x2'));var rs=require(_0xc455('0x3'));var fs=require('fs');var Redis=require(_0xc455('0x4'));var db=require(_0xc455('0x5'))['db'];var utils=require(_0xc455('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc455('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc455('0x8')][_0xc455('0x9')]({'port':0x232a});config['redis']=_[_0xc455('0xa')](config[_0xc455('0xb')],{'host':_0xc455('0xc'),'port':0x18eb});var socket=require(_0xc455('0xd'))(new Redis(config[_0xc455('0xb')]));require(_0xc455('0xe'))[_0xc455('0xf')](socket);function respondWithRpcPromise(_0x3a6f15,_0x5617d9,_0x3d6832){return new BPromise(function(_0x4418cd,_0x353501){return client[_0xc455('0x10')](_0x3a6f15,_0x3d6832)[_0xc455('0x11')](function(_0x47637f){logger[_0xc455('0x12')](_0xc455('0x13'),_0x5617d9,_0xc455('0x14'));logger['debug'](_0xc455('0x15'),_0x5617d9,_0xc455('0x14'),JSON[_0xc455('0x16')](_0x47637f));if(_0x47637f[_0xc455('0x17')]){if(_0x47637f['error'][_0xc455('0x18')]===0x1f4){logger['error'](_0xc455('0x13'),_0x5617d9,_0x47637f['error'][_0xc455('0x19')]);return _0x353501(_0x47637f['error'][_0xc455('0x19')]);}logger[_0xc455('0x17')](_0xc455('0x13'),_0x5617d9,_0x47637f[_0xc455('0x17')][_0xc455('0x19')]);return _0x4418cd(_0x47637f['error']['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x5617d9,'request\x20sent');_0x4418cd(_0x47637f[_0xc455('0x1a')][_0xc455('0x19')]);}})[_0xc455('0x1b')](function(_0xa35da7){logger[_0xc455('0x17')](_0xc455('0x13'),_0x5617d9,_0xa35da7);_0x353501(_0xa35da7);});});}exports[_0xc455('0x1c')]=function(_0x30697a){var _0x5d282c=this;return new Promise(function(_0x584c02,_0x451b24){return db['SmsAccount'][_0xc455('0x1d')]({'raw':_0x30697a[_0xc455('0x1e')]?_0x30697a['options'][_0xc455('0x1f')]===undefined?!![]:![]:!![],'where':_0x30697a[_0xc455('0x1e')]?_0x30697a['options'][_0xc455('0x20')]||null:null,'attributes':_0x30697a['options']?_0x30697a[_0xc455('0x1e')][_0xc455('0x21')]||null:null,'include':_0x30697a[_0xc455('0x1e')]?_0x30697a[_0xc455('0x1e')][_0xc455('0x22')]?_[_0xc455('0x23')](_0x30697a['options'][_0xc455('0x22')],function(_0x3d0f25){return{'model':db[_0x3d0f25[_0xc455('0x24')]],'as':_0x3d0f25['as'],'attributes':_0x3d0f25['attributes'],'include':_0x3d0f25[_0xc455('0x22')]?_[_0xc455('0x23')](_0x3d0f25[_0xc455('0x22')],function(_0x34fa5d){return{'model':db[_0x34fa5d[_0xc455('0x24')]],'as':_0x34fa5d['as'],'attributes':_0x34fa5d[_0xc455('0x21')],'include':_0x34fa5d[_0xc455('0x22')]?_['map'](_0x34fa5d[_0xc455('0x22')],function(_0x2b4ed6){return{'model':db[_0x2b4ed6['model']],'as':_0x2b4ed6['as'],'attributes':_0x2b4ed6[_0xc455('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15eb64){logger[_0xc455('0x12')](_0xc455('0x1c'),_0x30697a);logger['debug']('ShowSmsAccount',_0x30697a,JSON[_0xc455('0x16')](_0x15eb64));_0x584c02(_0x15eb64);})[_0xc455('0x1b')](function(_0x39a2c4){logger['error']('ShowSmsAccount',_0x39a2c4[_0xc455('0x19')],_0x30697a);_0x451b24(_0x5d282c[_0xc455('0x17')](0x1f4,_0x39a2c4[_0xc455('0x19')]));});});}; \ No newline at end of file +var _0x4c53=['include','map','model','attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw'];(function(_0x73345e,_0x21239a){var _0x10450e=function(_0x61893b){while(--_0x61893b){_0x73345e['push'](_0x73345e['shift']());}};_0x10450e(++_0x21239a);}(_0x4c53,0x9c));var _0x34c5=function(_0x231ad2,_0x3cc870){_0x231ad2=_0x231ad2-0x0;var _0xd995d=_0x4c53[_0x231ad2];return _0xd995d;};'use strict';var _=require(_0x34c5('0x0'));var util=require('util');var moment=require(_0x34c5('0x1'));var BPromise=require(_0x34c5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34c5('0x3'));var db=require(_0x34c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x34c5('0x5'))(_0x34c5('0x6'));var config=require(_0x34c5('0x7'));var jayson=require(_0x34c5('0x8'));var client=jayson[_0x34c5('0x9')][_0x34c5('0xa')]({'port':0x232a});config[_0x34c5('0xb')]=_[_0x34c5('0xc')](config[_0x34c5('0xb')],{'host':_0x34c5('0xd'),'port':0x18eb});var socket=require(_0x34c5('0xe'))(new Redis(config['redis']));require(_0x34c5('0xf'))[_0x34c5('0x10')](socket);function respondWithRpcPromise(_0x2b4d8c,_0x167844,_0x48777b){return new BPromise(function(_0x3f4457,_0x4fe840){return client['request'](_0x2b4d8c,_0x48777b)[_0x34c5('0x11')](function(_0x2d686e){logger[_0x34c5('0x12')](_0x34c5('0x13'),_0x167844,_0x34c5('0x14'));logger[_0x34c5('0x15')](_0x34c5('0x16'),_0x167844,_0x34c5('0x14'),JSON[_0x34c5('0x17')](_0x2d686e));if(_0x2d686e[_0x34c5('0x18')]){if(_0x2d686e[_0x34c5('0x18')][_0x34c5('0x19')]===0x1f4){logger[_0x34c5('0x18')]('SmsAccount,\x20%s,\x20%s',_0x167844,_0x2d686e[_0x34c5('0x18')][_0x34c5('0x1a')]);return _0x4fe840(_0x2d686e['error'][_0x34c5('0x1a')]);}logger[_0x34c5('0x18')]('SmsAccount,\x20%s,\x20%s',_0x167844,_0x2d686e[_0x34c5('0x18')][_0x34c5('0x1a')]);return _0x3f4457(_0x2d686e[_0x34c5('0x18')][_0x34c5('0x1a')]);}else{logger[_0x34c5('0x12')](_0x34c5('0x13'),_0x167844,'request\x20sent');_0x3f4457(_0x2d686e[_0x34c5('0x1b')][_0x34c5('0x1a')]);}})[_0x34c5('0x1c')](function(_0x46ce62){logger[_0x34c5('0x18')](_0x34c5('0x13'),_0x167844,_0x46ce62);_0x4fe840(_0x46ce62);});});}exports[_0x34c5('0x1d')]=function(_0x3611a0){var _0x52b35b=this;return new Promise(function(_0x2fe5ab,_0x5aad7f){return db[_0x34c5('0x1e')][_0x34c5('0x1f')]({'raw':_0x3611a0[_0x34c5('0x20')]?_0x3611a0[_0x34c5('0x20')][_0x34c5('0x21')]===undefined?!![]:![]:!![],'where':_0x3611a0[_0x34c5('0x20')]?_0x3611a0['options']['where']||null:null,'attributes':_0x3611a0['options']?_0x3611a0[_0x34c5('0x20')]['attributes']||null:null,'include':_0x3611a0['options']?_0x3611a0['options'][_0x34c5('0x22')]?_[_0x34c5('0x23')](_0x3611a0[_0x34c5('0x20')][_0x34c5('0x22')],function(_0x2dcbcb){return{'model':db[_0x2dcbcb[_0x34c5('0x24')]],'as':_0x2dcbcb['as'],'attributes':_0x2dcbcb[_0x34c5('0x25')],'include':_0x2dcbcb[_0x34c5('0x22')]?_[_0x34c5('0x23')](_0x2dcbcb['include'],function(_0xdb7b8a){return{'model':db[_0xdb7b8a[_0x34c5('0x24')]],'as':_0xdb7b8a['as'],'attributes':_0xdb7b8a[_0x34c5('0x25')],'include':_0xdb7b8a[_0x34c5('0x22')]?_[_0x34c5('0x23')](_0xdb7b8a[_0x34c5('0x22')],function(_0x2fe199){return{'model':db[_0x2fe199[_0x34c5('0x24')]],'as':_0x2fe199['as'],'attributes':_0x2fe199[_0x34c5('0x25')]};}):[]};}):[]};}):[]:[]})[_0x34c5('0x11')](function(_0x346b0a){logger[_0x34c5('0x12')](_0x34c5('0x1d'),_0x3611a0);logger[_0x34c5('0x15')](_0x34c5('0x1d'),_0x3611a0,JSON['stringify'](_0x346b0a));_0x2fe5ab(_0x346b0a);})['catch'](function(_0x389d4d){logger[_0x34c5('0x18')](_0x34c5('0x1d'),_0x389d4d[_0x34c5('0x1a')],_0x3611a0);_0x5aad7f(_0x52b35b[_0x34c5('0x18')](0x1f4,_0x389d4d[_0x34c5('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 4d9c277..b80f096 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 9e8fe53..370cfd7 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3486b0,_0x248021){var _0x2c8a3f=function(_0x7b5568){while(--_0x7b5568){_0x3486b0['push'](_0x3486b0['shift']());}};_0x2c8a3f(++_0x248021);}(_0x34e8,0x12c));var _0x834e=function(_0x2108b2,_0x1cf811){_0x2108b2=_0x2108b2-0x0;var _0x3706b6=_0x34e8[_0x2108b2];return _0x3706b6;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 4db86fb..1013838 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 _0x7ff7=['TEXT','sequelize','INTEGER','STRING','noop'];(function(_0x3b20c2,_0x888661){var _0x5b4482=function(_0x15b274){while(--_0x15b274){_0x3b20c2['push'](_0x3b20c2['shift']());}};_0x5b4482(++_0x888661);}(_0x7ff7,0xc4));var _0x77ff=function(_0x244c19,_0x51c8f7){_0x244c19=_0x244c19-0x0;var _0x29c4cc=_0x7ff7[_0x244c19];return _0x29c4cc;};'use strict';var Sequelize=require(_0x77ff('0x0'));module['exports']={'priority':{'type':Sequelize[_0x77ff('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x77ff('0x2')],'allowNull':![],'defaultValue':_0x77ff('0x3')},'appdata':{'type':Sequelize[_0x77ff('0x4')]()},'description':{'type':Sequelize[_0x77ff('0x2')]},'interval':{'type':Sequelize[_0x77ff('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xbb83=['sequelize','INTEGER','noop','STRING','*,*,*,*'];(function(_0x520b74,_0x3a92d8){var _0x13dec1=function(_0x1f701c){while(--_0x1f701c){_0x520b74['push'](_0x520b74['shift']());}};_0x13dec1(++_0x3a92d8);}(_0xbb83,0x1e0));var _0x3bb8=function(_0x110d44,_0x1e5848){_0x110d44=_0x110d44-0x0;var _0x2b4586=_0xbb83[_0x110d44];return _0x2b4586;};'use strict';var Sequelize=require(_0x3bb8('0x0'));module['exports']={'priority':{'type':Sequelize[_0x3bb8('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3bb8('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3bb8('0x3')],'defaultValue':_0x3bb8('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 2b9e1b1..90224a6 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 _0x848f=['lodash','squel','crypto','desk.js','querystring','papaparse','../../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','undefined','limit','count','set','Content-Range','apply','then','error','stack','name','index','map','SmsApplication','fieldName','type','key','keys','query','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x575c13,_0x32d2f9){var _0x47cd1f=function(_0x2f6c18){while(--_0x2f6c18){_0x575c13['push'](_0x575c13['shift']());}};_0x47cd1f(++_0x32d2f9);}(_0x848f,0x8d));var _0xf848=function(_0xec4e66,_0x16f49d){_0xec4e66=_0xec4e66-0x0;var _0x391b73=_0x848f[_0xec4e66];return _0x391b73;};'use strict';var emlformat=require(_0xf848('0x0'));var rimraf=require(_0xf848('0x1'));var zipdir=require(_0xf848('0x2'));var jsonpatch=require(_0xf848('0x3'));var rp=require(_0xf848('0x4'));var moment=require(_0xf848('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf848('0x6'));var util=require(_0xf848('0x7'));var path=require(_0xf848('0x8'));var sox=require(_0xf848('0x9'));var csv=require(_0xf848('0xa'));var ejs=require(_0xf848('0xb'));var fs=require('fs');var fs_extra=require(_0xf848('0xc'));var _=require(_0xf848('0xd'));var squel=require(_0xf848('0xe'));var crypto=require(_0xf848('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf848('0x10'));var toCsv=require(_0xf848('0xa'));var querystring=require(_0xf848('0x11'));var Papa=require(_0xf848('0x12'));var Redis=require('ioredis');var authService=require(_0xf848('0x13'));var qs=require(_0xf848('0x14'));var as=require(_0xf848('0x15'));var hardwareService=require(_0xf848('0x16'));var logger=require(_0xf848('0x17'))(_0xf848('0x18'));var utils=require(_0xf848('0x19'));var config=require(_0xf848('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf848('0x1b'))['db'];function respondWithStatusCode(_0x304b76,_0x24cae1){_0x24cae1=_0x24cae1||0xcc;return function(_0x32cee7){if(_0x32cee7){return _0x304b76[_0xf848('0x1c')](_0x24cae1);}return _0x304b76[_0xf848('0x1d')](_0x24cae1)[_0xf848('0x1e')]();};}function respondWithResult(_0x152b0b,_0x5f19e8){_0x5f19e8=_0x5f19e8||0xc8;return function(_0xcd7a24){if(_0xcd7a24){return _0x152b0b['status'](_0x5f19e8)[_0xf848('0x1f')](_0xcd7a24);}};}function respondWithFilteredResult(_0x149315,_0x12e3ba){return function(_0x55e82){if(_0x55e82){var _0x5ca8d2=typeof _0x12e3ba[_0xf848('0x20')]===_0xf848('0x21')&&typeof _0x12e3ba[_0xf848('0x22')]===_0xf848('0x21');var _0x36d3c7=_0x55e82[_0xf848('0x23')];var _0xda06c6=_0x5ca8d2?0x0:_0x12e3ba[_0xf848('0x20')];var _0x343e40=_0x5ca8d2?_0x55e82['count']:_0x12e3ba[_0xf848('0x20')]+_0x12e3ba[_0xf848('0x22')];var _0x4f029c;if(_0x343e40>=_0x36d3c7){_0x343e40=_0x36d3c7;_0x4f029c=0xc8;}else{_0x4f029c=0xce;}_0x149315[_0xf848('0x1d')](_0x4f029c);return _0x149315[_0xf848('0x24')](_0xf848('0x25'),_0xda06c6+'-'+_0x343e40+'/'+_0x36d3c7)[_0xf848('0x1f')](_0x55e82);}return null;};}function patchUpdates(_0x150b84){return function(_0x480777){try{jsonpatch[_0xf848('0x26')](_0x480777,_0x150b84,!![]);}catch(_0x418744){return BPromise['reject'](_0x418744);}return _0x480777['save']();};}function saveUpdates(_0x22eef6,_0x154740){return function(_0x59d473){if(_0x59d473){return _0x59d473['update'](_0x22eef6)[_0xf848('0x27')](function(_0x4c9037){return _0x4c9037;});}return null;};}function removeEntity(_0x8a8da6,_0x4b2782){return function(_0x565a5b){if(_0x565a5b){return _0x565a5b['destroy']()[_0xf848('0x27')](function(){_0x8a8da6[_0xf848('0x1d')](0xcc)[_0xf848('0x1e')]();});}};}function handleEntityNotFound(_0x2d797d,_0x4c3182){return function(_0xd935c8){if(!_0xd935c8){_0x2d797d[_0xf848('0x1c')](0x194);}return _0xd935c8;};}function handleError(_0xd167d1,_0x5d8a25){_0x5d8a25=_0x5d8a25||0x1f4;return function(_0x4161ac){logger[_0xf848('0x28')](_0x4161ac[_0xf848('0x29')]);if(_0x4161ac[_0xf848('0x2a')]){delete _0x4161ac['name'];}_0xd167d1[_0xf848('0x1d')](_0x5d8a25)['send'](_0x4161ac);};}exports[_0xf848('0x2b')]=function(_0x5cf0b9,_0x3a63db){var _0x326005={},_0x1ea23e={},_0x1901e8={'count':0x0,'rows':[]};var _0x1566e8=_[_0xf848('0x2c')](db[_0xf848('0x2d')]['rawAttributes'],function(_0x692f4e){return{'name':_0x692f4e[_0xf848('0x2e')],'type':_0x692f4e[_0xf848('0x2f')][_0xf848('0x30')]};});_0x1ea23e['model']=_[_0xf848('0x2c')](_0x1566e8,_0xf848('0x2a'));_0x1ea23e['query']=_[_0xf848('0x31')](_0x5cf0b9[_0xf848('0x32')]);_0x1ea23e['filters']=_['intersection'](_0x1ea23e[_0xf848('0x33')],_0x1ea23e['query']);_0x326005[_0xf848('0x34')]=_['intersection'](_0x1ea23e[_0xf848('0x33')],qs['fields'](_0x5cf0b9[_0xf848('0x32')][_0xf848('0x35')]));_0x326005['attributes']=_0x326005[_0xf848('0x34')][_0xf848('0x36')]?_0x326005['attributes']:_0x1ea23e[_0xf848('0x33')];if(!_0x5cf0b9[_0xf848('0x32')][_0xf848('0x37')]('nolimit')){_0x326005[_0xf848('0x22')]=qs[_0xf848('0x22')](_0x5cf0b9[_0xf848('0x32')][_0xf848('0x22')]);_0x326005['offset']=qs['offset'](_0x5cf0b9[_0xf848('0x32')][_0xf848('0x20')]);}_0x326005[_0xf848('0x38')]=qs[_0xf848('0x39')](_0x5cf0b9[_0xf848('0x32')][_0xf848('0x39')]);_0x326005[_0xf848('0x3a')]=qs[_0xf848('0x3b')](_[_0xf848('0x3c')](_0x5cf0b9['query'],_0x1ea23e['filters']),_0x1566e8);if(_0x5cf0b9[_0xf848('0x32')]['filter']){_0x326005[_0xf848('0x3a')]=_[_0xf848('0x3d')](_0x326005['where'],{'$or':_[_0xf848('0x2c')](_0x1566e8,function(_0x534ffc){if(_0x534ffc[_0xf848('0x2f')]!==_0xf848('0x3e')){var _0x55b661={};_0x55b661[_0x534ffc[_0xf848('0x2a')]]={'$like':'%'+_0x5cf0b9[_0xf848('0x32')]['filter']+'%'};return _0x55b661;}})});}_0x326005=_[_0xf848('0x3d')]({},_0x326005,_0x5cf0b9[_0xf848('0x3f')]);var _0xf3dc8c={'where':_0x326005[_0xf848('0x3a')]};return db[_0xf848('0x2d')]['count'](_0xf3dc8c)[_0xf848('0x27')](function(_0x5c359b){_0x1901e8[_0xf848('0x23')]=_0x5c359b;if(_0x5cf0b9[_0xf848('0x32')][_0xf848('0x40')]){_0x326005[_0xf848('0x41')]=[{'all':!![]}];}return db[_0xf848('0x2d')][_0xf848('0x42')](_0x326005);})[_0xf848('0x27')](function(_0x5c629a){_0x1901e8[_0xf848('0x43')]=_0x5c629a;return _0x1901e8;})[_0xf848('0x27')](respondWithFilteredResult(_0x3a63db,_0x326005))[_0xf848('0x44')](handleError(_0x3a63db,null));};exports[_0xf848('0x45')]=function(_0x974576,_0x1b4896){var _0x1877f7={'raw':!![],'where':{'id':_0x974576[_0xf848('0x46')]['id']}},_0x2e60dc={};_0x2e60dc['model']=_['keys'](db[_0xf848('0x2d')][_0xf848('0x47')]);_0x2e60dc[_0xf848('0x32')]=_[_0xf848('0x31')](_0x974576[_0xf848('0x32')]);_0x2e60dc[_0xf848('0x3b')]=_[_0xf848('0x48')](_0x2e60dc[_0xf848('0x33')],_0x2e60dc['query']);_0x1877f7[_0xf848('0x34')]=_[_0xf848('0x48')](_0x2e60dc[_0xf848('0x33')],qs['fields'](_0x974576[_0xf848('0x32')][_0xf848('0x35')]));_0x1877f7['attributes']=_0x1877f7[_0xf848('0x34')][_0xf848('0x36')]?_0x1877f7[_0xf848('0x34')]:_0x2e60dc[_0xf848('0x33')];if(_0x974576[_0xf848('0x32')]['includeAll']){_0x1877f7[_0xf848('0x41')]=[{'all':!![]}];}_0x1877f7=_[_0xf848('0x3d')]({},_0x1877f7,_0x974576[_0xf848('0x3f')]);return db['SmsApplication'][_0xf848('0x49')](_0x1877f7)[_0xf848('0x27')](handleEntityNotFound(_0x1b4896,null))[_0xf848('0x27')](respondWithResult(_0x1b4896,null))[_0xf848('0x44')](handleError(_0x1b4896,null));};exports[_0xf848('0x4a')]=function(_0x5c09bb,_0x55a628){return db[_0xf848('0x2d')]['create'](_0x5c09bb[_0xf848('0x4b')],{})['then'](respondWithResult(_0x55a628,0xc9))[_0xf848('0x44')](handleError(_0x55a628,null));};exports[_0xf848('0x4c')]=function(_0x409fd5,_0xe1ed89){if(_0x409fd5[_0xf848('0x4b')]['id']){delete _0x409fd5['body']['id'];}return db[_0xf848('0x2d')][_0xf848('0x49')]({'where':{'id':_0x409fd5[_0xf848('0x46')]['id']}})['then'](handleEntityNotFound(_0xe1ed89,null))[_0xf848('0x27')](saveUpdates(_0x409fd5[_0xf848('0x4b')],null))[_0xf848('0x27')](respondWithResult(_0xe1ed89,null))[_0xf848('0x44')](handleError(_0xe1ed89,null));};exports['destroy']=function(_0x57a7ab,_0x5a2dce){return db[_0xf848('0x2d')][_0xf848('0x49')]({'where':{'id':_0x57a7ab[_0xf848('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a2dce,null))[_0xf848('0x27')](removeEntity(_0x5a2dce,null))[_0xf848('0x44')](handleError(_0x5a2dce,null));}; \ No newline at end of file +var _0x1615=['squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../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','update','destroy','stack','name','index','map','SmsApplication','rawAttributes','fieldName','key','query','keys','attributes','intersection','model','fields','length','order','sort','where','filters','filter','type','VIRTUAL','options','then','include','findAll','params','includeAll','merge','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x435ba5,_0x55875f){var _0x5af51d=function(_0x35b1ed){while(--_0x35b1ed){_0x435ba5['push'](_0x435ba5['shift']());}};_0x5af51d(++_0x55875f);}(_0x1615,0x1ec));var _0x5161=function(_0x3ac90f,_0x2bba86){_0x3ac90f=_0x3ac90f-0x0;var _0x51b266=_0x1615[_0x3ac90f];return _0x51b266;};'use strict';var emlformat=require(_0x5161('0x0'));var rimraf=require(_0x5161('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5161('0x2'));var rp=require(_0x5161('0x3'));var moment=require(_0x5161('0x4'));var BPromise=require(_0x5161('0x5'));var Mustache=require(_0x5161('0x6'));var util=require(_0x5161('0x7'));var path=require('path');var sox=require(_0x5161('0x8'));var csv=require(_0x5161('0x9'));var ejs=require(_0x5161('0xa'));var fs=require('fs');var fs_extra=require(_0x5161('0xb'));var _=require('lodash');var squel=require(_0x5161('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5161('0xd'));var toCsv=require(_0x5161('0x9'));var querystring=require(_0x5161('0xe'));var Papa=require(_0x5161('0xf'));var Redis=require('ioredis');var authService=require(_0x5161('0x10'));var qs=require(_0x5161('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5161('0x12'));var logger=require('../../config/logger')(_0x5161('0x13'));var utils=require(_0x5161('0x14'));var config=require(_0x5161('0x15'));var licenseUtil=require(_0x5161('0x16'));var db=require(_0x5161('0x17'))['db'];function respondWithStatusCode(_0xdd9d33,_0x18d04a){_0x18d04a=_0x18d04a||0xcc;return function(_0x45d67d){if(_0x45d67d){return _0xdd9d33[_0x5161('0x18')](_0x18d04a);}return _0xdd9d33[_0x5161('0x19')](_0x18d04a)[_0x5161('0x1a')]();};}function respondWithResult(_0x4991c1,_0x2264e5){_0x2264e5=_0x2264e5||0xc8;return function(_0x1c410b){if(_0x1c410b){return _0x4991c1[_0x5161('0x19')](_0x2264e5)[_0x5161('0x1b')](_0x1c410b);}};}function respondWithFilteredResult(_0x22a273,_0x3baaf1){return function(_0x3d5cd6){if(_0x3d5cd6){var _0x30996a=typeof _0x3baaf1[_0x5161('0x1c')]===_0x5161('0x1d')&&typeof _0x3baaf1[_0x5161('0x1e')]==='undefined';var _0x28724a=_0x3d5cd6[_0x5161('0x1f')];var _0x54ecb6=_0x30996a?0x0:_0x3baaf1['offset'];var _0x55438c=_0x30996a?_0x3d5cd6['count']:_0x3baaf1[_0x5161('0x1c')]+_0x3baaf1[_0x5161('0x1e')];var _0x514326;if(_0x55438c>=_0x28724a){_0x55438c=_0x28724a;_0x514326=0xc8;}else{_0x514326=0xce;}_0x22a273['status'](_0x514326);return _0x22a273[_0x5161('0x20')](_0x5161('0x21'),_0x54ecb6+'-'+_0x55438c+'/'+_0x28724a)[_0x5161('0x1b')](_0x3d5cd6);}return null;};}function patchUpdates(_0x14f6c3){return function(_0x5b7491){try{jsonpatch[_0x5161('0x22')](_0x5b7491,_0x14f6c3,!![]);}catch(_0x4dac7c){return BPromise[_0x5161('0x23')](_0x4dac7c);}return _0x5b7491[_0x5161('0x24')]();};}function saveUpdates(_0x3ea19c,_0x2734e8){return function(_0x10541f){if(_0x10541f){return _0x10541f[_0x5161('0x25')](_0x3ea19c)['then'](function(_0x55715f){return _0x55715f;});}return null;};}function removeEntity(_0x273ac8,_0x43ccd6){return function(_0x2d7a37){if(_0x2d7a37){return _0x2d7a37[_0x5161('0x26')]()['then'](function(){_0x273ac8[_0x5161('0x19')](0xcc)[_0x5161('0x1a')]();});}};}function handleEntityNotFound(_0x8bd8a9,_0x3d8564){return function(_0x3f0e3f){if(!_0x3f0e3f){_0x8bd8a9[_0x5161('0x18')](0x194);}return _0x3f0e3f;};}function handleError(_0x58c673,_0x505295){_0x505295=_0x505295||0x1f4;return function(_0x416d54){logger['error'](_0x416d54[_0x5161('0x27')]);if(_0x416d54[_0x5161('0x28')]){delete _0x416d54['name'];}_0x58c673[_0x5161('0x19')](_0x505295)['send'](_0x416d54);};}exports[_0x5161('0x29')]=function(_0x3a522c,_0x2e1adb){var _0x10d5a5={},_0x57664f={},_0x4c9a1a={'count':0x0,'rows':[]};var _0x5f4a8c=_[_0x5161('0x2a')](db[_0x5161('0x2b')][_0x5161('0x2c')],function(_0x103832){return{'name':_0x103832[_0x5161('0x2d')],'type':_0x103832['type'][_0x5161('0x2e')]};});_0x57664f['model']=_[_0x5161('0x2a')](_0x5f4a8c,_0x5161('0x28'));_0x57664f[_0x5161('0x2f')]=_[_0x5161('0x30')](_0x3a522c[_0x5161('0x2f')]);_0x57664f['filters']=_['intersection'](_0x57664f['model'],_0x57664f[_0x5161('0x2f')]);_0x10d5a5[_0x5161('0x31')]=_[_0x5161('0x32')](_0x57664f[_0x5161('0x33')],qs[_0x5161('0x34')](_0x3a522c['query']['fields']));_0x10d5a5[_0x5161('0x31')]=_0x10d5a5[_0x5161('0x31')][_0x5161('0x35')]?_0x10d5a5[_0x5161('0x31')]:_0x57664f['model'];if(!_0x3a522c[_0x5161('0x2f')]['hasOwnProperty']('nolimit')){_0x10d5a5['limit']=qs[_0x5161('0x1e')](_0x3a522c[_0x5161('0x2f')][_0x5161('0x1e')]);_0x10d5a5[_0x5161('0x1c')]=qs['offset'](_0x3a522c[_0x5161('0x2f')]['offset']);}_0x10d5a5[_0x5161('0x36')]=qs['sort'](_0x3a522c['query'][_0x5161('0x37')]);_0x10d5a5[_0x5161('0x38')]=qs[_0x5161('0x39')](_['pick'](_0x3a522c[_0x5161('0x2f')],_0x57664f[_0x5161('0x39')]),_0x5f4a8c);if(_0x3a522c['query'][_0x5161('0x3a')]){_0x10d5a5['where']=_['merge'](_0x10d5a5['where'],{'$or':_['map'](_0x5f4a8c,function(_0x44b1ee){if(_0x44b1ee[_0x5161('0x3b')]!==_0x5161('0x3c')){var _0x320a2d={};_0x320a2d[_0x44b1ee[_0x5161('0x28')]]={'$like':'%'+_0x3a522c['query'][_0x5161('0x3a')]+'%'};return _0x320a2d;}})});}_0x10d5a5=_['merge']({},_0x10d5a5,_0x3a522c[_0x5161('0x3d')]);var _0xf5dbfd={'where':_0x10d5a5[_0x5161('0x38')]};return db[_0x5161('0x2b')][_0x5161('0x1f')](_0xf5dbfd)[_0x5161('0x3e')](function(_0x29dbf4){_0x4c9a1a[_0x5161('0x1f')]=_0x29dbf4;if(_0x3a522c['query']['includeAll']){_0x10d5a5[_0x5161('0x3f')]=[{'all':!![]}];}return db['SmsApplication'][_0x5161('0x40')](_0x10d5a5);})[_0x5161('0x3e')](function(_0x51cd7f){_0x4c9a1a['rows']=_0x51cd7f;return _0x4c9a1a;})['then'](respondWithFilteredResult(_0x2e1adb,_0x10d5a5))['catch'](handleError(_0x2e1adb,null));};exports['show']=function(_0x119ad8,_0xf8050){var _0x1bda96={'raw':!![],'where':{'id':_0x119ad8[_0x5161('0x41')]['id']}},_0x23f60d={};_0x23f60d[_0x5161('0x33')]=_['keys'](db[_0x5161('0x2b')][_0x5161('0x2c')]);_0x23f60d[_0x5161('0x2f')]=_[_0x5161('0x30')](_0x119ad8['query']);_0x23f60d[_0x5161('0x39')]=_[_0x5161('0x32')](_0x23f60d[_0x5161('0x33')],_0x23f60d[_0x5161('0x2f')]);_0x1bda96['attributes']=_[_0x5161('0x32')](_0x23f60d[_0x5161('0x33')],qs[_0x5161('0x34')](_0x119ad8[_0x5161('0x2f')]['fields']));_0x1bda96[_0x5161('0x31')]=_0x1bda96[_0x5161('0x31')][_0x5161('0x35')]?_0x1bda96[_0x5161('0x31')]:_0x23f60d[_0x5161('0x33')];if(_0x119ad8['query'][_0x5161('0x42')]){_0x1bda96[_0x5161('0x3f')]=[{'all':!![]}];}_0x1bda96=_[_0x5161('0x43')]({},_0x1bda96,_0x119ad8['options']);return db[_0x5161('0x2b')][_0x5161('0x44')](_0x1bda96)[_0x5161('0x3e')](handleEntityNotFound(_0xf8050,null))[_0x5161('0x3e')](respondWithResult(_0xf8050,null))[_0x5161('0x45')](handleError(_0xf8050,null));};exports['create']=function(_0x1ffa37,_0x3b6c96){return db['SmsApplication'][_0x5161('0x46')](_0x1ffa37[_0x5161('0x47')],{})['then'](respondWithResult(_0x3b6c96,0xc9))[_0x5161('0x45')](handleError(_0x3b6c96,null));};exports[_0x5161('0x25')]=function(_0x599ac0,_0x54abcf){if(_0x599ac0[_0x5161('0x47')]['id']){delete _0x599ac0[_0x5161('0x47')]['id'];}return db['SmsApplication'][_0x5161('0x44')]({'where':{'id':_0x599ac0[_0x5161('0x41')]['id']}})[_0x5161('0x3e')](handleEntityNotFound(_0x54abcf,null))[_0x5161('0x3e')](saveUpdates(_0x599ac0['body'],null))['then'](respondWithResult(_0x54abcf,null))['catch'](handleError(_0x54abcf,null));};exports[_0x5161('0x26')]=function(_0x160b5f,_0x1e8fda){return db[_0x5161('0x2b')][_0x5161('0x44')]({'where':{'id':_0x160b5f[_0x5161('0x41')]['id']}})['then'](handleEntityNotFound(_0x1e8fda,null))[_0x5161('0x3e')](removeEntity(_0x1e8fda,null))[_0x5161('0x45')](handleError(_0x1e8fda,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index c90f455..bdcb580 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 _0x9df1=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','../../config/environment','./smsApplication.attributes','exports','SmsApplication','sms_applications'];(function(_0x55f20b,_0x4ee231){var _0x1b6f7f=function(_0x466d83){while(--_0x466d83){_0x55f20b['push'](_0x55f20b['shift']());}};_0x1b6f7f(++_0x4ee231);}(_0x9df1,0xcd));var _0x19df=function(_0x29986d,_0x145e65){_0x29986d=_0x29986d-0x0;var _0xee22bb=_0x9df1[_0x29986d];return _0xee22bb;};'use strict';var _=require(_0x19df('0x0'));var util=require(_0x19df('0x1'));var logger=require(_0x19df('0x2'))(_0x19df('0x3'));var moment=require(_0x19df('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x19df('0x5'));var rimraf=require('rimraf');var config=require(_0x19df('0x6'));var attributes=require(_0x19df('0x7'));module[_0x19df('0x8')]=function(_0x4ad1f1,_0xd010ae){return _0x4ad1f1['define'](_0x19df('0x9'),attributes,{'tableName':_0x19df('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x19df('0xb')});}; \ No newline at end of file +var _0xf3c0=['api','request-promise','path','../../config/environment','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x1cf351,_0x563b9b){var _0x3e82e9=function(_0x59c99e){while(--_0x59c99e){_0x1cf351['push'](_0x1cf351['shift']());}};_0x3e82e9(++_0x563b9b);}(_0xf3c0,0x77));var _0x0f3c=function(_0x1045fc,_0x32d79e){_0x1045fc=_0x1045fc-0x0;var _0x3206dd=_0xf3c0[_0x1045fc];return _0x3206dd;};'use strict';var _=require(_0x0f3c('0x0'));var util=require('util');var logger=require(_0x0f3c('0x1'))(_0x0f3c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0f3c('0x3'));var fs=require('fs');var path=require(_0x0f3c('0x4'));var rimraf=require('rimraf');var config=require(_0x0f3c('0x5'));var attributes=require('./smsApplication.attributes');module[_0x0f3c('0x6')]=function(_0x4d8e74,_0x1fe21c){return _0x4d8e74['define'](_0x0f3c('0x7'),attributes,{'tableName':_0x0f3c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0f3c('0x9'),'collate':_0x0f3c('0xa')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index cbfdc89..7bf14f7 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 _0xb1ad=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment'];(function(_0xe5f3ac,_0x5a01d8){var _0x360f40=function(_0x2b3a0a){while(--_0x2b3a0a){_0xe5f3ac['push'](_0xe5f3ac['shift']());}};_0x360f40(++_0x5a01d8);}(_0xb1ad,0x184));var _0xdb1a=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xb1ad[_0x4e6ae6];return _0x23c108;};'use strict';var _=require(_0xdb1a('0x0'));var util=require(_0xdb1a('0x1'));var moment=require(_0xdb1a('0x2'));var BPromise=require(_0xdb1a('0x3'));var rs=require(_0xdb1a('0x4'));var fs=require('fs');var Redis=require(_0xdb1a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb1a('0x6'));var logger=require(_0xdb1a('0x7'))(_0xdb1a('0x8'));var config=require(_0xdb1a('0x9'));var jayson=require(_0xdb1a('0xa'));var client=jayson[_0xdb1a('0xb')][_0xdb1a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12b8c5,_0x2712fe,_0x2a24f2){return new BPromise(function(_0x5fc831,_0x188988){return client[_0xdb1a('0xd')](_0x12b8c5,_0x2a24f2)[_0xdb1a('0xe')](function(_0x122af8){logger['info'](_0xdb1a('0xf'),_0x2712fe,_0xdb1a('0x10'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x2712fe,'request\x20sent',JSON[_0xdb1a('0x11')](_0x122af8));if(_0x122af8[_0xdb1a('0x12')]){if(_0x122af8[_0xdb1a('0x12')][_0xdb1a('0x13')]===0x1f4){logger[_0xdb1a('0x12')](_0xdb1a('0xf'),_0x2712fe,_0x122af8[_0xdb1a('0x12')][_0xdb1a('0x14')]);return _0x188988(_0x122af8[_0xdb1a('0x12')][_0xdb1a('0x14')]);}logger[_0xdb1a('0x12')](_0xdb1a('0xf'),_0x2712fe,_0x122af8[_0xdb1a('0x12')]['message']);return _0x5fc831(_0x122af8[_0xdb1a('0x12')][_0xdb1a('0x14')]);}else{logger[_0xdb1a('0x15')]('SmsApplication,\x20%s,\x20%s',_0x2712fe,_0xdb1a('0x10'));_0x5fc831(_0x122af8['result'][_0xdb1a('0x14')]);}})[_0xdb1a('0x16')](function(_0x1637fa){logger['error'](_0xdb1a('0xf'),_0x2712fe,_0x1637fa);_0x188988(_0x1637fa);});});} \ No newline at end of file +var _0x3d04=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','stringify','error','SmsApplication,\x20%s,\x20%s','message','info'];(function(_0x19c002,_0x1acc29){var _0x1234dc=function(_0x11a0fc){while(--_0x11a0fc){_0x19c002['push'](_0x19c002['shift']());}};_0x1234dc(++_0x1acc29);}(_0x3d04,0xbe));var _0x43d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3d04[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var moment=require(_0x43d0('0x2'));var BPromise=require(_0x43d0('0x3'));var rs=require(_0x43d0('0x4'));var fs=require('fs');var Redis=require(_0x43d0('0x5'));var db=require(_0x43d0('0x6'))['db'];var utils=require(_0x43d0('0x7'));var logger=require('../../config/logger')(_0x43d0('0x8'));var config=require(_0x43d0('0x9'));var jayson=require(_0x43d0('0xa'));var client=jayson[_0x43d0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484271,_0x50919e,_0x5efb95){return new BPromise(function(_0x457550,_0x3344d3){return client[_0x43d0('0xc')](_0x484271,_0x5efb95)[_0x43d0('0xd')](function(_0x44a763){logger['info']('SmsApplication,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'),JSON[_0x43d0('0xf')](_0x44a763));if(_0x44a763[_0x43d0('0x10')]){if(_0x44a763[_0x43d0('0x10')]['code']===0x1f4){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x44a763['error'][_0x43d0('0x12')]);return _0x3344d3(_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);}logger['error'](_0x43d0('0x11'),_0x50919e,_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);return _0x457550(_0x44a763['error'][_0x43d0('0x12')]);}else{logger[_0x43d0('0x13')](_0x43d0('0x11'),_0x50919e,_0x43d0('0xe'));_0x457550(_0x44a763[_0x43d0('0x14')]['message']);}})['catch'](function(_0x1e91a7){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x1e91a7);_0x3344d3(_0x1e91a7);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index ee21de9..360272e 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 _0x8f4c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','smsinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout'];(function(_0x625441,_0x5ded20){var _0x223c35=function(_0x1659c4){while(--_0x1659c4){_0x625441['push'](_0x625441['shift']());}};_0x223c35(++_0x5ded20);}(_0x8f4c,0x113));var _0xc8f4=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0x8f4c[_0x16bb4b];return _0x8aeb84;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8f4('0x6'));var interaction=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var controller=require('./smsInteraction.controller');router[_0xc8f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0xb')]);router[_0xc8f4('0x9')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0xe')]);router['get'](_0xc8f4('0xf'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x10')]);router[_0xc8f4('0x9')]('/:id/download',auth[_0xc8f4('0xd')](),controller['download']);router[_0xc8f4('0x11')]('/',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x12')]);router[_0xc8f4('0x11')](_0xc8f4('0xf'),auth['isAuthenticated'](),controller[_0xc8f4('0x13')]);router[_0xc8f4('0x11')](_0xc8f4('0x14'),auth[_0xc8f4('0xd')](),interaction[_0xc8f4('0x15')](_0xc8f4('0x16'),'smsinteraction:addtags'),controller[_0xc8f4('0x17')]);router[_0xc8f4('0x18')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),interaction[_0xc8f4('0x15')]('sms',_0xc8f4('0x19')),controller['update']);router['delete'](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),interaction[_0xc8f4('0x15')](_0xc8f4('0x16'),_0xc8f4('0x1a')),controller[_0xc8f4('0x1b')]);router[_0xc8f4('0x1c')](_0xc8f4('0x14'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x1d')]);module[_0xc8f4('0x1e')]=router; \ No newline at end of file +var _0xefda=['../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','/:id','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','update','smsinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3e04fd,_0x542fff){var _0xf06cfb=function(_0x322ec4){while(--_0x322ec4){_0x3e04fd['push'](_0x3e04fd['shift']());}};_0xf06cfb(++_0x542fff);}(_0xefda,0x96));var _0xaefd=function(_0xa56e2a,_0x3aac89){_0xa56e2a=_0xa56e2a-0x0;var _0x5d4674=_0xefda[_0xa56e2a];return _0x5d4674;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var fs_extra=require(_0xaefd('0x3'));var auth=require(_0xaefd('0x4'));var interaction=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var controller=require(_0xaefd('0x7'));router[_0xaefd('0x8')]('/',auth['isAuthenticated'](),controller[_0xaefd('0x9')]);router[_0xaefd('0x8')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller['describe']);router[_0xaefd('0x8')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),controller['show']);router['get']('/:id/messages',auth[_0xaefd('0xb')](),controller[_0xaefd('0xd')]);router[_0xaefd('0x8')](_0xaefd('0xe'),auth[_0xaefd('0xb')](),controller[_0xaefd('0xf')]);router[_0xaefd('0x10')]('/',auth[_0xaefd('0xb')](),controller[_0xaefd('0x11')]);router[_0xaefd('0x10')](_0xaefd('0x12'),auth['isAuthenticated'](),controller[_0xaefd('0x13')]);router['post'](_0xaefd('0x14'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),'smsinteraction:addtags'),controller[_0xaefd('0x17')]);router[_0xaefd('0x18')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),_0xaefd('0x19')),controller[_0xaefd('0x1a')]);router['delete'](_0xaefd('0xc'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),_0xaefd('0x1b')),controller[_0xaefd('0x1c')]);router['delete'](_0xaefd('0x14'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x1d')]);module[_0xaefd('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 2854ad7..b852965 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 _0xc274=['ENUM','out','moment','DATE','STRING'];(function(_0xbc1a4b,_0x4dfbe4){var _0x108b87=function(_0x409062){while(--_0x409062){_0xbc1a4b['push'](_0xbc1a4b['shift']());}};_0x108b87(++_0x4dfbe4);}(_0xc274,0x151));var _0x4c27=function(_0x1de829,_0x4b90ae){_0x1de829=_0x1de829-0x0;var _0x1e6382=_0xc274[_0x1de829];return _0x1e6382;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4c27('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4c27('0x1')]},'disposition':{'type':Sequelize[_0x4c27('0x2')]},'secondDisposition':{'type':Sequelize[_0x4c27('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4c27('0x2')]},'note':{'type':Sequelize[_0x4c27('0x2')]},'phone':{'type':Sequelize[_0x4c27('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x4c27('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4c27('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x4c27('0x3')]('in',_0x4c27('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7497=['INTEGER','sequelize','moment','exports','STRING','DATE','ENUM','out','BOOLEAN'];(function(_0xcb967a,_0x16aa84){var _0x3c4c4f=function(_0x3582c3){while(--_0x3582c3){_0xcb967a['push'](_0xcb967a['shift']());}};_0x3c4c4f(++_0x16aa84);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7749('0x0'));var moment=require(_0x7749('0x1'));module[_0x7749('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7749('0x3')]},'thirdDisposition':{'type':Sequelize[_0x7749('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x7749('0x3')]},'read1stAt':{'type':Sequelize[_0x7749('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7749('0x5')]('in',_0x7749('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7749('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x7749('0x5')]('in',_0x7749('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7749('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7749('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 82d1147..371d917 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 _0xc869=['User','fullname','firstName','Messages','createdAt','read','SmsAccount','Account','Owner','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','direction','System','Contact','lastName','secret','value','views','downloadInteraction.ejs','transcript-','.pdf','Sms','unlinkSync','rimraf','moment','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsInteraction.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','findAll','user','show','params','model','keys','SmsInteraction','query','intersection','fields','attributes','includeAll','merge','options','find','catch','body','describe','addMessage','SmsMessage','ids','getMessages','length','nolimit','sort','filters','pick','where','SmsInteractionId','filter','$gte','split','include','rows','addTags','setTags','omit','spread','Tag','color','emit','removeTags','download','unix','toString','join','root','server','tmp','format','push'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xc869,0x173));var _0x9c86=function(_0x28d2fe,_0x221c5f){_0x28d2fe=_0x28d2fe-0x0;var _0x4ffe63=_0xc869[_0x28d2fe];return _0x4ffe63;};'use strict';var rimraf=require(_0x9c86('0x0'));var zipdir=require('zip-dir');var moment=require(_0x9c86('0x1'));var BPromise=require(_0x9c86('0x2'));var util=require(_0x9c86('0x3'));var path=require('path');var ejs=require(_0x9c86('0x4'));var fs=require('fs');var _=require(_0x9c86('0x5'));var Redis=require(_0x9c86('0x6'));var interaction=require(_0x9c86('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x9c86('0x8'));var config=require(_0x9c86('0x9'));var db=require(_0x9c86('0xa'))['db'];config['redis']=_[_0x9c86('0xb')](config['redis'],{'host':_0x9c86('0xc'),'port':0x18eb});var socket=require(_0x9c86('0xd'))(new Redis(config[_0x9c86('0xe')]));require(_0x9c86('0xf'))[_0x9c86('0x10')](socket);function respondWithStatusCode(_0xb2d8b7,_0x556be9){_0x556be9=_0x556be9||0xcc;return function(_0x415c28){if(_0x415c28){return _0xb2d8b7[_0x9c86('0x11')](_0x556be9);}return _0xb2d8b7[_0x9c86('0x12')](_0x556be9)[_0x9c86('0x13')]();};}function respondWithResult(_0x17359c,_0x17179b){_0x17179b=_0x17179b||0xc8;return function(_0x4edac8){if(_0x4edac8){return _0x17359c[_0x9c86('0x12')](_0x17179b)[_0x9c86('0x14')](_0x4edac8);}};}function respondWithFilteredResult(_0x373fd9,_0xea880e){return function(_0x1365d2){if(_0x1365d2){var _0x2e806f=typeof _0xea880e['offset']===_0x9c86('0x15')&&typeof _0xea880e[_0x9c86('0x16')]==='undefined';var _0x15e124=_0x1365d2['count'];var _0x3e923a=_0x2e806f?0x0:_0xea880e[_0x9c86('0x17')];var _0x302599=_0x2e806f?_0x1365d2[_0x9c86('0x18')]:_0xea880e[_0x9c86('0x17')]+_0xea880e[_0x9c86('0x16')];var _0x7a8a7a;if(_0x302599>=_0x15e124){_0x302599=_0x15e124;_0x7a8a7a=0xc8;}else{_0x7a8a7a=0xce;}_0x373fd9[_0x9c86('0x12')](_0x7a8a7a);return _0x373fd9['set'](_0x9c86('0x19'),_0x3e923a+'-'+_0x302599+'/'+_0x15e124)[_0x9c86('0x14')](_0x1365d2);}return null;};}function saveUpdates(_0x46fbac){return function(_0x4eec88){if(_0x4eec88){return _0x4eec88[_0x9c86('0x1a')](_0x46fbac)[_0x9c86('0x1b')](function(_0x383b9d){return _0x383b9d;});}return null;};}function removeEntity(_0x1f10a1){return function(_0x4c0042){if(_0x4c0042){return _0x4c0042[_0x9c86('0x1c')]()[_0x9c86('0x1b')](function(){_0x1f10a1[_0x9c86('0x12')](0xcc)[_0x9c86('0x13')]();});}};}function handleEntityNotFound(_0x2004ac){return function(_0x566232){if(!_0x566232){_0x2004ac['sendStatus'](0x194);}return _0x566232;};}function handleError(_0x4144c5,_0x1099bc){_0x1099bc=_0x1099bc||0x1f4;return function(_0x10147a){logger[_0x9c86('0x1d')](_0x10147a[_0x9c86('0x1e')]);if(_0x10147a[_0x9c86('0x1f')]){delete _0x10147a[_0x9c86('0x1f')];}_0x4144c5[_0x9c86('0x12')](_0x1099bc)[_0x9c86('0x20')](_0x10147a);};}exports[_0x9c86('0x21')]=function(_0xabbb67,_0x33e4a7){var _0x49f05d={};var _0xacf84b=_[_0x9c86('0x22')](db['SmsInteraction'][_0x9c86('0x23')],function(_0x2c7a42){return{'name':_0x2c7a42[_0x9c86('0x24')],'type':_0x2c7a42[_0x9c86('0x25')]['key']};});_0x49f05d=qs['getOptions'](_0xacf84b,_0xabbb67);return interaction[_0x9c86('0x26')]('sms',_0xabbb67['query'],_0xabbb67[_0x9c86('0x27')],_0x49f05d,_0xacf84b)[_0x9c86('0x1b')](respondWithFilteredResult(_0x33e4a7,_0x49f05d))['catch'](handleError(_0x33e4a7,null));};exports[_0x9c86('0x28')]=function(_0xfec4c6,_0x575720){var _0x54332b={'raw':![],'where':{'id':_0xfec4c6[_0x9c86('0x29')]['id']}},_0x5697b7={};_0x5697b7[_0x9c86('0x2a')]=_[_0x9c86('0x2b')](db[_0x9c86('0x2c')]['rawAttributes']);_0x5697b7[_0x9c86('0x2d')]=_['keys'](_0xfec4c6[_0x9c86('0x2d')]);_0x5697b7['filters']=_[_0x9c86('0x2e')](_0x5697b7['model'],_0x5697b7[_0x9c86('0x2d')]);_0x54332b['attributes']=_['intersection'](_0x5697b7['model'],qs[_0x9c86('0x2f')](_0xfec4c6[_0x9c86('0x2d')][_0x9c86('0x2f')]));_0x54332b[_0x9c86('0x30')]=_0x54332b[_0x9c86('0x30')]['length']?_0x54332b[_0x9c86('0x30')]:_0x5697b7['model'];if(_0xfec4c6[_0x9c86('0x2d')][_0x9c86('0x31')]){_0x54332b['include']=[{'all':!![]}];}_0x54332b=_[_0x9c86('0x32')]({},_0x54332b,_0xfec4c6[_0x9c86('0x33')]);return db[_0x9c86('0x2c')][_0x9c86('0x34')](_0x54332b)['then'](handleEntityNotFound(_0x575720,null))['then'](respondWithResult(_0x575720,null))[_0x9c86('0x35')](handleError(_0x575720,null));};exports['create']=function(_0x2a1d68,_0x1c83f6){return db[_0x9c86('0x2c')]['create'](_0x2a1d68[_0x9c86('0x36')],{})['then'](respondWithResult(_0x1c83f6,0xc9))['catch'](handleError(_0x1c83f6,null));};exports['update']=function(_0x539ef5,_0x475f94){if(_0x539ef5[_0x9c86('0x36')]['id']){delete _0x539ef5[_0x9c86('0x36')]['id'];}return db[_0x9c86('0x2c')][_0x9c86('0x34')]({'where':{'id':_0x539ef5[_0x9c86('0x29')]['id']}})[_0x9c86('0x1b')](handleEntityNotFound(_0x475f94,null))['then'](saveUpdates(_0x539ef5[_0x9c86('0x36')],null))['then'](respondWithResult(_0x475f94,null))[_0x9c86('0x35')](handleError(_0x475f94,null));};exports[_0x9c86('0x1c')]=function(_0x6407ff,_0x436ed1){return db[_0x9c86('0x2c')][_0x9c86('0x34')]({'where':{'id':_0x6407ff[_0x9c86('0x29')]['id']}})[_0x9c86('0x1b')](handleEntityNotFound(_0x436ed1,null))[_0x9c86('0x1b')](removeEntity(_0x436ed1,null))['catch'](handleError(_0x436ed1,null));};exports[_0x9c86('0x37')]=function(_0xc25231,_0x2b8dea){return db[_0x9c86('0x2c')][_0x9c86('0x37')]()['then'](respondWithResult(_0x2b8dea,null))['catch'](handleError(_0x2b8dea,null));};exports[_0x9c86('0x38')]=function(_0x191cd3,_0x21cec9){return db[_0x9c86('0x39')][_0x9c86('0x34')]({'where':{'id':_0x191cd3[_0x9c86('0x29')]['id']}})[_0x9c86('0x1b')](handleEntityNotFound(_0x21cec9,null))[_0x9c86('0x1b')](function(_0x1e22fd){if(_0x1e22fd){return _0x1e22fd['addMessage'](_0x191cd3[_0x9c86('0x36')][_0x9c86('0x3a')],_['omit'](_0x191cd3[_0x9c86('0x36')],['ids','id'])||{});}})['then'](respondWithResult(_0x21cec9,null))[_0x9c86('0x35')](handleError(_0x21cec9,null));};exports[_0x9c86('0x3b')]=function(_0x29aad4,_0x826ede){var _0x192a79={'raw':![],'where':{}};var _0x4221c5={};var _0x6d7af3={'count':0x0,'rows':[]};return db[_0x9c86('0x2c')]['findOne']({'where':{'id':_0x29aad4[_0x9c86('0x29')]['id']}})[_0x9c86('0x1b')](handleEntityNotFound(_0x826ede,null))[_0x9c86('0x1b')](function(_0x457675){if(_0x457675){_0x4221c5['model']=_[_0x9c86('0x2b')](db[_0x9c86('0x39')][_0x9c86('0x23')]);_0x4221c5[_0x9c86('0x2d')]=_[_0x9c86('0x2b')](_0x29aad4[_0x9c86('0x2d')]);_0x4221c5['filters']=_[_0x9c86('0x2e')](_0x4221c5[_0x9c86('0x2a')],_0x4221c5['query']);_0x192a79[_0x9c86('0x30')]=_[_0x9c86('0x2e')](_0x4221c5['model'],qs[_0x9c86('0x2f')](_0x29aad4[_0x9c86('0x2d')][_0x9c86('0x2f')]));_0x192a79[_0x9c86('0x30')]=_0x192a79['attributes'][_0x9c86('0x3c')]?_0x192a79[_0x9c86('0x30')]:_0x4221c5[_0x9c86('0x2a')];if(!_0x29aad4[_0x9c86('0x2d')]['hasOwnProperty'](_0x9c86('0x3d'))){_0x192a79[_0x9c86('0x16')]=qs[_0x9c86('0x16')](_0x29aad4['query'][_0x9c86('0x16')]);_0x192a79[_0x9c86('0x17')]=qs['offset'](_0x29aad4[_0x9c86('0x2d')][_0x9c86('0x17')]);}_0x192a79['order']=qs[_0x9c86('0x3e')](_0x29aad4[_0x9c86('0x2d')][_0x9c86('0x3e')]);_0x192a79['where']=qs[_0x9c86('0x3f')](_[_0x9c86('0x40')](_0x29aad4[_0x9c86('0x2d')],_0x4221c5[_0x9c86('0x3f')]));_0x192a79[_0x9c86('0x41')][_0x9c86('0x42')]=_0x457675['id'];if(_0x29aad4[_0x9c86('0x2d')][_0x9c86('0x43')]){_0x192a79[_0x9c86('0x41')]=_[_0x9c86('0x32')](_0x192a79[_0x9c86('0x41')],{'$or':_[_0x9c86('0x22')](_0x192a79['attributes'],function(_0x433a1b){var _0x3c7c42={};_0x3c7c42[_0x433a1b]={'$like':'%'+_0x29aad4[_0x9c86('0x2d')][_0x9c86('0x43')]+'%'};return _0x3c7c42;})});}if(_0x29aad4[_0x9c86('0x2d')][_0x9c86('0x44')]){var _0x3632cc=_0x29aad4[_0x9c86('0x2d')][_0x9c86('0x44')][_0x9c86('0x45')](',');var _0x6f7d2a={};_0x6f7d2a[_0x3632cc[0x0]]={'$gte':moment(_0x3632cc[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x192a79[_0x9c86('0x41')]=_[_0x9c86('0x32')](_0x192a79[_0x9c86('0x41')],_0x6f7d2a);}_0x192a79=_[_0x9c86('0x32')]({},_0x192a79,_0x29aad4[_0x9c86('0x33')]);return db[_0x9c86('0x39')][_0x9c86('0x18')]({'where':_0x192a79[_0x9c86('0x41')]})[_0x9c86('0x1b')](function(_0x449732){_0x6d7af3['count']=_0x449732;if(_0x29aad4['query'][_0x9c86('0x31')]){_0x192a79[_0x9c86('0x46')]=[{'all':!![]}];}return db[_0x9c86('0x39')][_0x9c86('0x26')](_0x192a79);})[_0x9c86('0x1b')](function(_0x1bf3a7){_0x6d7af3[_0x9c86('0x47')]=_0x1bf3a7;return _0x6d7af3;});}})['then'](respondWithFilteredResult(_0x826ede,_0x192a79))['catch'](handleError(_0x826ede,null));};exports[_0x9c86('0x48')]=function(_0x353701,_0x11d3e8){return db[_0x9c86('0x2c')]['find']({'where':{'id':_0x353701[_0x9c86('0x29')]['id']}})[_0x9c86('0x1b')](handleEntityNotFound(_0x11d3e8,null))[_0x9c86('0x1b')](function(_0x4a3a0e){if(_0x4a3a0e){return _0x4a3a0e[_0x9c86('0x49')](_0x353701['body'][_0x9c86('0x3a')],_[_0x9c86('0x4a')](_0x353701['body'],[_0x9c86('0x3a'),'id'])||{})[_0x9c86('0x4b')](function(){return db[_0x9c86('0x4c')][_0x9c86('0x26')]({'attributes':['id','name',_0x9c86('0x4d')],'where':{'id':_0x353701['body'][_0x9c86('0x3a')]}});})[_0x9c86('0x1b')](function(_0x3996d0){socket[_0x9c86('0x4e')]('smsInteractionTags:save',{'id':Number(_0x353701[_0x9c86('0x29')]['id']),'tags':_0x3996d0||[]});return{'id':Number(_0x353701[_0x9c86('0x29')]['id']),'tags':_0x3996d0||[]};});}})['then'](respondWithResult(_0x11d3e8,null))['catch'](handleError(_0x11d3e8,null));};exports[_0x9c86('0x4f')]=function(_0xebdf60,_0x3d820d){return db[_0x9c86('0x2c')][_0x9c86('0x34')]({'where':{'id':_0xebdf60['params']['id']}})[_0x9c86('0x1b')](handleEntityNotFound(_0x3d820d,null))[_0x9c86('0x1b')](function(_0x48dc23){if(_0x48dc23){return _0x48dc23[_0x9c86('0x4f')](_0xebdf60[_0x9c86('0x2d')]['ids']);}})[_0x9c86('0x1b')](respondWithStatusCode(_0x3d820d,null))[_0x9c86('0x35')](handleError(_0x3d820d,null));};exports[_0x9c86('0x50')]=function(_0x3bbfe4,_0x4db4c7){var _0x447a39=moment()[_0x9c86('0x51')]()[_0x9c86('0x52')]();var _0x3827d0=path[_0x9c86('0x53')](config[_0x9c86('0x54')],_0x9c86('0x55'),'files',_0x9c86('0x56'));var _0x5217ba=path['join'](_0x3827d0,_0x447a39);var _0x456523=util[_0x9c86('0x57')]('transcript-%d-%s.zip',_0x3bbfe4[_0x9c86('0x29')]['id'],_0x447a39);var _0x308e7d=path[_0x9c86('0x53')](_0x3827d0,_0x456523);var _0xc54666=[];_0xc54666[_0x9c86('0x58')]({'model':db[_0x9c86('0x59')],'as':'User','attributes':['id',_0x9c86('0x5a')],'raw':!![]});_0xc54666[_0x9c86('0x58')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x9c86('0x5b'),'lastName'],'raw':!![]});var _0x11011f=[{'model':db[_0x9c86('0x39')],'as':_0x9c86('0x5c'),'attributes':['id',_0x9c86('0x36'),_0x9c86('0x5d'),'direction','secret',_0x9c86('0x5e')],'include':_0xc54666}];_0x11011f[_0x9c86('0x58')]({'model':db[_0x9c86('0x5f')],'as':_0x9c86('0x60'),'attributes':['id',_0x9c86('0x1f')]});_0x11011f[_0x9c86('0x58')]({'model':db['User'],'as':'Owner','attributes':['id',_0x9c86('0x5a')]});return db[_0x9c86('0x2c')]['find']({'where':{'id':_0x3bbfe4[_0x9c86('0x29')]['id']},'include':_0x11011f})[_0x9c86('0x1b')](handleEntityNotFound(_0x4db4c7,null))['then'](function(_0x52a8d2){if(_0x52a8d2){var _0x151863=_0x52a8d2['get']({'plain':!![]});fs['mkdirSync'](_0x5217ba);var _0x45c9ef={'channel':'Sms','account':_0x151863[_0x9c86('0x60')]['name'],'agent':_0x151863[_0x9c86('0x61')]?_0x151863[_0x9c86('0x61')][_0x9c86('0x5a')]:_0x9c86('0x62'),'createdAt':moment(_0x151863[_0x9c86('0x5d')])[_0x9c86('0x57')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x151863[_0x9c86('0x63')]?moment(_0x151863[_0x9c86('0x64')])['format'](_0x9c86('0x65'))[_0x9c86('0x52')]():'','disposition':_0x151863[_0x9c86('0x66')],'messages':_(_0x151863[_0x9c86('0x5c')])['filter']({'secret':![]})['map'](function(_0x2c6613){return{'date':moment(_0x2c6613['createdAt'])['format'](_0x9c86('0x65'))[_0x9c86('0x52')](),'sender':_0x2c6613[_0x9c86('0x67')]==='out'?_0x2c6613[_0x9c86('0x59')]?_0x2c6613[_0x9c86('0x59')][_0x9c86('0x5a')]:_0x9c86('0x68'):_0x2c6613[_0x9c86('0x69')][_0x9c86('0x5b')]+(_0x2c6613[_0x9c86('0x69')][_0x9c86('0x6a')]?'\x20'+_0x2c6613[_0x9c86('0x69')]['lastName']:''),'body':_0x2c6613[_0x9c86('0x36')],'direction':_0x2c6613[_0x9c86('0x67')]==='out'?'A':'C','secret':_0x2c6613[_0x9c86('0x6b')],'read':_0x2c6613[_0x9c86('0x5e')]};})[_0x9c86('0x6c')]()};return ejs['renderFile'](path['join'](config[_0x9c86('0x54')],_0x9c86('0x55'),_0x9c86('0x6d'),_0x9c86('0x6e')),{'interaction':_0x45c9ef})['then'](function(_0x9dbb15){var _0x10cae3=path[_0x9c86('0x53')](_0x5217ba,_0x9c86('0x6f')+_0x151863['id']+'-'+_0x447a39+_0x9c86('0x70'));var _0x1c1170={'path':_0x10cae3,'channel':_0x9c86('0x71'),'interactionId':_0x151863['id']};return pdf['createPdfFromHTML'](_0x9dbb15,_0x1c1170);})['then'](function(){return new BPromise(function(_0x4fa22f,_0x428667){zipdir(_0x5217ba,{'saveTo':_0x308e7d},function(_0x2ad9f1,_0x10a96b){if(_0x2ad9f1)return _0x428667(_0x2ad9f1);return _0x4fa22f(_0x10a96b);});})['then'](function(){return new BPromise(function(_0x234388,_0x39f1b6){rimraf(_0x5217ba,function(_0x5753dd){if(_0x5753dd)_0x39f1b6(_0x5753dd);return _0x234388();});});})[_0x9c86('0x1b')](function(){return _0x4db4c7[_0x9c86('0x50')](_0x308e7d,_0x456523,function(_0x33bb09){if(_0x33bb09){console['log']('err',_0x33bb09);}else{fs[_0x9c86('0x72')](_0x308e7d);}});});});}else{return _0x4db4c7[_0x9c86('0x11')](0xc8);}})['catch'](handleError(_0x4db4c7,null));}; \ No newline at end of file +var _0xcfdb=['localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','query','user','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','create','body','params','destroy','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','nolimit','sort','where','pick','SmsInteractionId','filter','map','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','unix','toString','join','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','Messages','createdAt','direction','secret','Account','Owner','Sms','N.A.','format','closedAt','disposition','System','lastName','out','value','renderFile','root','views','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','rimraf','bluebird','util','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults'];(function(_0x4dadcb,_0x471507){var _0x5cc413=function(_0x45d625){while(--_0x45d625){_0x4dadcb['push'](_0x4dadcb['shift']());}};_0x5cc413(++_0x471507);}(_0xcfdb,0x6b));var _0xbcfd=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0xcfdb[_0x25e109];return _0xc0f7d6;};'use strict';var rimraf=require(_0xbcfd('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xbcfd('0x1'));var util=require(_0xbcfd('0x2'));var path=require('path');var ejs=require(_0xbcfd('0x3'));var fs=require('fs');var _=require(_0xbcfd('0x4'));var Redis=require(_0xbcfd('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xbcfd('0x6'));var pdf=require(_0xbcfd('0x7'));var logger=require(_0xbcfd('0x8'))('api');var config=require(_0xbcfd('0x9'));var db=require('../../mysqldb')['db'];config[_0xbcfd('0xa')]=_[_0xbcfd('0xb')](config['redis'],{'host':_0xbcfd('0xc'),'port':0x18eb});var socket=require(_0xbcfd('0xd'))(new Redis(config[_0xbcfd('0xa')]));require(_0xbcfd('0xe'))['register'](socket);function respondWithStatusCode(_0x41a7d8,_0x32aab9){_0x32aab9=_0x32aab9||0xcc;return function(_0x5b9074){if(_0x5b9074){return _0x41a7d8[_0xbcfd('0xf')](_0x32aab9);}return _0x41a7d8[_0xbcfd('0x10')](_0x32aab9)[_0xbcfd('0x11')]();};}function respondWithResult(_0x5ac63a,_0x3fc2d9){_0x3fc2d9=_0x3fc2d9||0xc8;return function(_0x1ab5b0){if(_0x1ab5b0){return _0x5ac63a[_0xbcfd('0x10')](_0x3fc2d9)['json'](_0x1ab5b0);}};}function respondWithFilteredResult(_0x476b40,_0x58c7ed){return function(_0x40722f){if(_0x40722f){var _0x2015e9=typeof _0x58c7ed[_0xbcfd('0x12')]===_0xbcfd('0x13')&&typeof _0x58c7ed[_0xbcfd('0x14')]===_0xbcfd('0x13');var _0x262e76=_0x40722f[_0xbcfd('0x15')];var _0x37add9=_0x2015e9?0x0:_0x58c7ed[_0xbcfd('0x12')];var _0x21a4a7=_0x2015e9?_0x40722f[_0xbcfd('0x15')]:_0x58c7ed[_0xbcfd('0x12')]+_0x58c7ed[_0xbcfd('0x14')];var _0x4ddd66;if(_0x21a4a7>=_0x262e76){_0x21a4a7=_0x262e76;_0x4ddd66=0xc8;}else{_0x4ddd66=0xce;}_0x476b40[_0xbcfd('0x10')](_0x4ddd66);return _0x476b40[_0xbcfd('0x16')](_0xbcfd('0x17'),_0x37add9+'-'+_0x21a4a7+'/'+_0x262e76)[_0xbcfd('0x18')](_0x40722f);}return null;};}function saveUpdates(_0x2f09c5){return function(_0x15e330){if(_0x15e330){return _0x15e330[_0xbcfd('0x19')](_0x2f09c5)[_0xbcfd('0x1a')](function(_0x842741){return _0x842741;});}return null;};}function removeEntity(_0x1dbcfd){return function(_0x3c7633){if(_0x3c7633){return _0x3c7633['destroy']()[_0xbcfd('0x1a')](function(){_0x1dbcfd['status'](0xcc)[_0xbcfd('0x11')]();});}};}function handleEntityNotFound(_0x41284c){return function(_0x52618c){if(!_0x52618c){_0x41284c[_0xbcfd('0xf')](0x194);}return _0x52618c;};}function handleError(_0xa86dab,_0x277786){_0x277786=_0x277786||0x1f4;return function(_0x454b26){logger['error'](_0x454b26[_0xbcfd('0x1b')]);if(_0x454b26[_0xbcfd('0x1c')]){delete _0x454b26['name'];}_0xa86dab[_0xbcfd('0x10')](_0x277786)[_0xbcfd('0x1d')](_0x454b26);};}exports[_0xbcfd('0x1e')]=function(_0x510abf,_0x2a7c9c){var _0xfcf6da={};var _0x207081=_['map'](db[_0xbcfd('0x1f')][_0xbcfd('0x20')],function(_0x48ad39){return{'name':_0x48ad39[_0xbcfd('0x21')],'type':_0x48ad39[_0xbcfd('0x22')][_0xbcfd('0x23')]};});_0xfcf6da=qs[_0xbcfd('0x24')](_0x207081,_0x510abf);return interaction['findAll']('sms',_0x510abf[_0xbcfd('0x25')],_0x510abf[_0xbcfd('0x26')],_0xfcf6da,_0x207081)[_0xbcfd('0x1a')](respondWithFilteredResult(_0x2a7c9c,_0xfcf6da))['catch'](handleError(_0x2a7c9c,null));};exports['show']=function(_0x3f9775,_0x5f4ed1){var _0x5c46cc={'raw':![],'where':{'id':_0x3f9775['params']['id']}},_0x34ab50={};_0x34ab50[_0xbcfd('0x27')]=_[_0xbcfd('0x28')](db[_0xbcfd('0x1f')][_0xbcfd('0x20')]);_0x34ab50[_0xbcfd('0x25')]=_[_0xbcfd('0x28')](_0x3f9775[_0xbcfd('0x25')]);_0x34ab50[_0xbcfd('0x29')]=_[_0xbcfd('0x2a')](_0x34ab50[_0xbcfd('0x27')],_0x34ab50[_0xbcfd('0x25')]);_0x5c46cc['attributes']=_[_0xbcfd('0x2a')](_0x34ab50[_0xbcfd('0x27')],qs[_0xbcfd('0x2b')](_0x3f9775[_0xbcfd('0x25')][_0xbcfd('0x2b')]));_0x5c46cc[_0xbcfd('0x2c')]=_0x5c46cc[_0xbcfd('0x2c')][_0xbcfd('0x2d')]?_0x5c46cc['attributes']:_0x34ab50[_0xbcfd('0x27')];if(_0x3f9775['query'][_0xbcfd('0x2e')]){_0x5c46cc[_0xbcfd('0x2f')]=[{'all':!![]}];}_0x5c46cc=_[_0xbcfd('0x30')]({},_0x5c46cc,_0x3f9775[_0xbcfd('0x31')]);return db[_0xbcfd('0x1f')][_0xbcfd('0x32')](_0x5c46cc)[_0xbcfd('0x1a')](handleEntityNotFound(_0x5f4ed1,null))[_0xbcfd('0x1a')](respondWithResult(_0x5f4ed1,null))[_0xbcfd('0x33')](handleError(_0x5f4ed1,null));};exports[_0xbcfd('0x34')]=function(_0x425f89,_0x2991c4){return db[_0xbcfd('0x1f')][_0xbcfd('0x34')](_0x425f89[_0xbcfd('0x35')],{})[_0xbcfd('0x1a')](respondWithResult(_0x2991c4,0xc9))['catch'](handleError(_0x2991c4,null));};exports[_0xbcfd('0x19')]=function(_0x12b301,_0xc6d20e){if(_0x12b301[_0xbcfd('0x35')]['id']){delete _0x12b301[_0xbcfd('0x35')]['id'];}return db[_0xbcfd('0x1f')][_0xbcfd('0x32')]({'where':{'id':_0x12b301[_0xbcfd('0x36')]['id']}})[_0xbcfd('0x1a')](handleEntityNotFound(_0xc6d20e,null))['then'](saveUpdates(_0x12b301[_0xbcfd('0x35')],null))[_0xbcfd('0x1a')](respondWithResult(_0xc6d20e,null))[_0xbcfd('0x33')](handleError(_0xc6d20e,null));};exports[_0xbcfd('0x37')]=function(_0x316386,_0xae2af5){return db[_0xbcfd('0x1f')]['find']({'where':{'id':_0x316386[_0xbcfd('0x36')]['id']}})['then'](handleEntityNotFound(_0xae2af5,null))['then'](removeEntity(_0xae2af5,null))['catch'](handleError(_0xae2af5,null));};exports[_0xbcfd('0x38')]=function(_0x491373,_0x3eed66){return db[_0xbcfd('0x1f')][_0xbcfd('0x38')]()[_0xbcfd('0x1a')](respondWithResult(_0x3eed66,null))[_0xbcfd('0x33')](handleError(_0x3eed66,null));};exports[_0xbcfd('0x39')]=function(_0x14002c,_0xe2b865){return db[_0xbcfd('0x3a')]['find']({'where':{'id':_0x14002c[_0xbcfd('0x36')]['id']}})[_0xbcfd('0x1a')](handleEntityNotFound(_0xe2b865,null))['then'](function(_0x12dfcf){if(_0x12dfcf){return _0x12dfcf[_0xbcfd('0x39')](_0x14002c[_0xbcfd('0x35')][_0xbcfd('0x3b')],_[_0xbcfd('0x3c')](_0x14002c[_0xbcfd('0x35')],[_0xbcfd('0x3b'),'id'])||{});}})[_0xbcfd('0x1a')](respondWithResult(_0xe2b865,null))['catch'](handleError(_0xe2b865,null));};exports[_0xbcfd('0x3d')]=function(_0x2dcccb,_0x8ce6a5){var _0x15e310={'raw':![],'where':{}};var _0x27aef3={};var _0xc54eef={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xbcfd('0x3e')]({'where':{'id':_0x2dcccb[_0xbcfd('0x36')]['id']}})['then'](handleEntityNotFound(_0x8ce6a5,null))['then'](function(_0x4a0b88){if(_0x4a0b88){_0x27aef3[_0xbcfd('0x27')]=_[_0xbcfd('0x28')](db[_0xbcfd('0x3a')][_0xbcfd('0x20')]);_0x27aef3[_0xbcfd('0x25')]=_[_0xbcfd('0x28')](_0x2dcccb[_0xbcfd('0x25')]);_0x27aef3[_0xbcfd('0x29')]=_[_0xbcfd('0x2a')](_0x27aef3[_0xbcfd('0x27')],_0x27aef3[_0xbcfd('0x25')]);_0x15e310[_0xbcfd('0x2c')]=_[_0xbcfd('0x2a')](_0x27aef3[_0xbcfd('0x27')],qs['fields'](_0x2dcccb[_0xbcfd('0x25')][_0xbcfd('0x2b')]));_0x15e310['attributes']=_0x15e310[_0xbcfd('0x2c')]['length']?_0x15e310[_0xbcfd('0x2c')]:_0x27aef3[_0xbcfd('0x27')];if(!_0x2dcccb[_0xbcfd('0x25')]['hasOwnProperty'](_0xbcfd('0x3f'))){_0x15e310[_0xbcfd('0x14')]=qs[_0xbcfd('0x14')](_0x2dcccb[_0xbcfd('0x25')]['limit']);_0x15e310[_0xbcfd('0x12')]=qs[_0xbcfd('0x12')](_0x2dcccb[_0xbcfd('0x25')][_0xbcfd('0x12')]);}_0x15e310['order']=qs[_0xbcfd('0x40')](_0x2dcccb[_0xbcfd('0x25')][_0xbcfd('0x40')]);_0x15e310[_0xbcfd('0x41')]=qs[_0xbcfd('0x29')](_[_0xbcfd('0x42')](_0x2dcccb[_0xbcfd('0x25')],_0x27aef3[_0xbcfd('0x29')]));_0x15e310[_0xbcfd('0x41')][_0xbcfd('0x43')]=_0x4a0b88['id'];if(_0x2dcccb[_0xbcfd('0x25')][_0xbcfd('0x44')]){_0x15e310['where']=_[_0xbcfd('0x30')](_0x15e310[_0xbcfd('0x41')],{'$or':_[_0xbcfd('0x45')](_0x15e310[_0xbcfd('0x2c')],function(_0x4e93fb){var _0x2128d1={};_0x2128d1[_0x4e93fb]={'$like':'%'+_0x2dcccb[_0xbcfd('0x25')][_0xbcfd('0x44')]+'%'};return _0x2128d1;})});}if(_0x2dcccb['query'][_0xbcfd('0x46')]){var _0x5ea176=_0x2dcccb['query'][_0xbcfd('0x46')]['split'](',');var _0x1a1d38={};_0x1a1d38[_0x5ea176[0x0]]={'$gte':moment(_0x5ea176[0x1])['format'](_0xbcfd('0x47'))};_0x15e310[_0xbcfd('0x41')]=_[_0xbcfd('0x30')](_0x15e310[_0xbcfd('0x41')],_0x1a1d38);}_0x15e310=_[_0xbcfd('0x30')]({},_0x15e310,_0x2dcccb[_0xbcfd('0x31')]);return db['SmsMessage'][_0xbcfd('0x15')]({'where':_0x15e310[_0xbcfd('0x41')]})[_0xbcfd('0x1a')](function(_0x5c4662){_0xc54eef[_0xbcfd('0x15')]=_0x5c4662;if(_0x2dcccb[_0xbcfd('0x25')][_0xbcfd('0x2e')]){_0x15e310['include']=[{'all':!![]}];}return db[_0xbcfd('0x3a')][_0xbcfd('0x48')](_0x15e310);})['then'](function(_0x35cd11){_0xc54eef[_0xbcfd('0x49')]=_0x35cd11;return _0xc54eef;});}})[_0xbcfd('0x1a')](respondWithFilteredResult(_0x8ce6a5,_0x15e310))['catch'](handleError(_0x8ce6a5,null));};exports[_0xbcfd('0x4a')]=function(_0x5ca554,_0x584450){return db[_0xbcfd('0x1f')][_0xbcfd('0x32')]({'where':{'id':_0x5ca554[_0xbcfd('0x36')]['id']}})[_0xbcfd('0x1a')](handleEntityNotFound(_0x584450,null))[_0xbcfd('0x1a')](function(_0x26ce5b){if(_0x26ce5b){return _0x26ce5b['setTags'](_0x5ca554[_0xbcfd('0x35')][_0xbcfd('0x3b')],_[_0xbcfd('0x3c')](_0x5ca554[_0xbcfd('0x35')],[_0xbcfd('0x3b'),'id'])||{})[_0xbcfd('0x4b')](function(){return db[_0xbcfd('0x4c')][_0xbcfd('0x48')]({'attributes':['id',_0xbcfd('0x1c'),_0xbcfd('0x4d')],'where':{'id':_0x5ca554[_0xbcfd('0x35')][_0xbcfd('0x3b')]}});})[_0xbcfd('0x1a')](function(_0x2e2df2){socket[_0xbcfd('0x4e')](_0xbcfd('0x4f'),{'id':Number(_0x5ca554[_0xbcfd('0x36')]['id']),'tags':_0x2e2df2||[]});return{'id':Number(_0x5ca554[_0xbcfd('0x36')]['id']),'tags':_0x2e2df2||[]};});}})['then'](respondWithResult(_0x584450,null))[_0xbcfd('0x33')](handleError(_0x584450,null));};exports[_0xbcfd('0x50')]=function(_0x5ca9a4,_0x46e33f){return db['SmsInteraction'][_0xbcfd('0x32')]({'where':{'id':_0x5ca9a4[_0xbcfd('0x36')]['id']}})[_0xbcfd('0x1a')](handleEntityNotFound(_0x46e33f,null))['then'](function(_0x4c875d){if(_0x4c875d){return _0x4c875d[_0xbcfd('0x50')](_0x5ca9a4[_0xbcfd('0x25')]['ids']);}})[_0xbcfd('0x1a')](respondWithStatusCode(_0x46e33f,null))[_0xbcfd('0x33')](handleError(_0x46e33f,null));};exports['download']=function(_0x568c77,_0x258fe0){var _0x53b4e8=moment()[_0xbcfd('0x51')]()[_0xbcfd('0x52')]();var _0x29bd33=path[_0xbcfd('0x53')](config['root'],_0xbcfd('0x54'),_0xbcfd('0x55'),_0xbcfd('0x56'));var _0x1aedb0=path[_0xbcfd('0x53')](_0x29bd33,_0x53b4e8);var _0x4f51fb=util['format'](_0xbcfd('0x57'),_0x568c77[_0xbcfd('0x36')]['id'],_0x53b4e8);var _0x5b02e4=path[_0xbcfd('0x53')](_0x29bd33,_0x4f51fb);var _0x3c38fd=[];_0x3c38fd[_0xbcfd('0x58')]({'model':db[_0xbcfd('0x59')],'as':'User','attributes':['id',_0xbcfd('0x5a')],'raw':!![]});_0x3c38fd['push']({'model':db[_0xbcfd('0x5b')],'as':_0xbcfd('0x5c'),'attributes':['id',_0xbcfd('0x5d'),'lastName'],'raw':!![]});var _0x57c754=[{'model':db[_0xbcfd('0x3a')],'as':_0xbcfd('0x5e'),'attributes':['id','body',_0xbcfd('0x5f'),_0xbcfd('0x60'),_0xbcfd('0x61'),'read'],'include':_0x3c38fd}];_0x57c754['push']({'model':db['SmsAccount'],'as':_0xbcfd('0x62'),'attributes':['id',_0xbcfd('0x1c')]});_0x57c754[_0xbcfd('0x58')]({'model':db['User'],'as':_0xbcfd('0x63'),'attributes':['id','fullname']});return db[_0xbcfd('0x1f')][_0xbcfd('0x32')]({'where':{'id':_0x568c77[_0xbcfd('0x36')]['id']},'include':_0x57c754})[_0xbcfd('0x1a')](handleEntityNotFound(_0x258fe0,null))['then'](function(_0x484acd){if(_0x484acd){var _0x4b8640=_0x484acd['get']({'plain':!![]});fs['mkdirSync'](_0x1aedb0);var _0x1e09d4={'channel':_0xbcfd('0x64'),'account':_0x4b8640[_0xbcfd('0x62')]['name'],'agent':_0x4b8640['Owner']?_0x4b8640[_0xbcfd('0x63')][_0xbcfd('0x5a')]:_0xbcfd('0x65'),'createdAt':moment(_0x4b8640[_0xbcfd('0x5f')])[_0xbcfd('0x66')](_0xbcfd('0x47'))['toString'](),'closedAt':_0x4b8640['closed']?moment(_0x4b8640[_0xbcfd('0x67')])[_0xbcfd('0x66')](_0xbcfd('0x47'))[_0xbcfd('0x52')]():'','disposition':_0x4b8640[_0xbcfd('0x68')],'messages':_(_0x4b8640['Messages'])['filter']({'secret':![]})[_0xbcfd('0x45')](function(_0x480763){return{'date':moment(_0x480763[_0xbcfd('0x5f')])[_0xbcfd('0x66')](_0xbcfd('0x47'))[_0xbcfd('0x52')](),'sender':_0x480763[_0xbcfd('0x60')]==='out'?_0x480763[_0xbcfd('0x59')]?_0x480763[_0xbcfd('0x59')][_0xbcfd('0x5a')]:_0xbcfd('0x69'):_0x480763['Contact'][_0xbcfd('0x5d')]+(_0x480763[_0xbcfd('0x5c')][_0xbcfd('0x6a')]?'\x20'+_0x480763[_0xbcfd('0x5c')]['lastName']:''),'body':_0x480763[_0xbcfd('0x35')],'direction':_0x480763['direction']===_0xbcfd('0x6b')?'A':'C','secret':_0x480763[_0xbcfd('0x61')],'read':_0x480763['read']};})[_0xbcfd('0x6c')]()};return ejs[_0xbcfd('0x6d')](path[_0xbcfd('0x53')](config[_0xbcfd('0x6e')],_0xbcfd('0x54'),_0xbcfd('0x6f'),'downloadInteraction.ejs'),{'interaction':_0x1e09d4})['then'](function(_0x31e5b5){var _0x2c2ee3=path[_0xbcfd('0x53')](_0x1aedb0,_0xbcfd('0x70')+_0x4b8640['id']+'-'+_0x53b4e8+_0xbcfd('0x71'));var _0x28af44={'path':_0x2c2ee3,'channel':_0xbcfd('0x64'),'interactionId':_0x4b8640['id']};return pdf[_0xbcfd('0x72')](_0x31e5b5,_0x28af44);})[_0xbcfd('0x1a')](function(){return new BPromise(function(_0x4c0959,_0x319935){zipdir(_0x1aedb0,{'saveTo':_0x5b02e4},function(_0x4183c7,_0x2074b1){if(_0x4183c7)return _0x319935(_0x4183c7);return _0x4c0959(_0x2074b1);});})[_0xbcfd('0x1a')](function(){return new BPromise(function(_0x51d376,_0x41f4cd){rimraf(_0x1aedb0,function(_0x4ed835){if(_0x4ed835)_0x41f4cd(_0x4ed835);return _0x51d376();});});})['then'](function(){return _0x258fe0[_0xbcfd('0x73')](_0x5b02e4,_0x4f51fb,function(_0x54f076){if(_0x54f076){console[_0xbcfd('0x74')](_0xbcfd('0x75'),_0x54f076);}else{fs[_0xbcfd('0x76')](_0x5b02e4);}});});});}else{return _0x258fe0['sendStatus'](0xc8);}})[_0xbcfd('0x33')](handleError(_0x258fe0,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 995eb91..9a7de64 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 _0xef0f=['SmsInteraction','../../mysqldb','SmsMessage','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xef0f,0x168));var _0xfef0=function(_0x276f46,_0x4d52be){_0x276f46=_0x276f46-0x0;var _0x1fe2b2=_0xef0f[_0x276f46];return _0x1fe2b2;};'use strict';var EventEmitter=require(_0xfef0('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xfef0('0x1')];var SmsMessage=require(_0xfef0('0x2'))['db'][_0xfef0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfef0('0x4'),'afterUpdate':_0xfef0('0x5'),'afterDestroy':_0xfef0('0x6')};function emitEvent(_0x4e1af6){return function(_0x2a6fcf,_0x9b8b9e,_0x2697df){_0x2a6fcf[_0xfef0('0x7')]({'attributes':['id'],'raw':!![]})[_0xfef0('0x8')](function(_0x11dfd7){_0x2a6fcf['setDataValue'](_0xfef0('0x9'),_0x11dfd7['map'](function(_0x82e37a){return{'id':_0x82e37a['id']};}));return SmsMessage[_0xfef0('0xa')]({'where':{'SmsInteractionId':_0x2a6fcf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfef0('0x8')](function(_0x2d42dc){_0x2a6fcf[_0xfef0('0xb')](_0xfef0('0xc'),_0x2d42dc[_0xfef0('0xd')]);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6+':'+_0x2a6fcf['id'],_0x2a6fcf);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6,_0x2a6fcf);_0x2697df(null);})[_0xfef0('0xf')](_0x2697df(null));};}for(var e in events){if(events[_0xfef0('0x10')](e)){var event=events[e];SmsInteraction[_0xfef0('0x11')](e,emitEvent(event));}}module[_0xfef0('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x53a471,_0x50773d){var _0x1c1ead=function(_0x134fbe){while(--_0x134fbe){_0x53a471['push'](_0x53a471['shift']());}};_0x1c1ead(++_0x50773d);}(_0xadb5,0xad));var _0x5adb=function(_0x3ec30e,_0x10cc3e){_0x3ec30e=_0x3ec30e-0x0;var _0xe6504f=_0xadb5[_0x3ec30e];return _0xe6504f;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5adb('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return SmsMessage[_0x5adb('0xa')]({'where':{'SmsInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);SmsInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);SmsInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 3fec70d..40e9662 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 _0x5cf7=['closed','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed'];(function(_0x21af4a,_0x456750){var _0x5c3499=function(_0xf95e70){while(--_0xf95e70){_0x21af4a['push'](_0x21af4a['shift']());}};_0x5c3499(++_0x456750);}(_0x5cf7,0x65));var _0x75cf=function(_0x158aa3,_0x5a645a){_0x158aa3=_0x158aa3-0x0;var _0x30a0d0=_0x5cf7[_0x158aa3];return _0x30a0d0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x75cf('0x0'))(_0x75cf('0x1'));var moment=require('moment');var BPromise=require(_0x75cf('0x2'));var rp=require(_0x75cf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75cf('0x4'));var config=require(_0x75cf('0x5'));var attributes=require(_0x75cf('0x6'));module[_0x75cf('0x7')]=function(_0x19a874,_0x50c826){return _0x19a874['define'](_0x75cf('0x8'),attributes,{'tableName':_0x75cf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c2c4a,_0x3d9c17,_0x3b7c29){if(_0x3c2c4a[_0x75cf('0xa')](_0x75cf('0xb'))){_0x3c2c4a['closedAt']=moment()[_0x75cf('0xc')](_0x75cf('0xd'));}_0x3b7c29(null,_0x3c2c4a);}}});}; \ No newline at end of file +var _0x58ef=['SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','rimraf','./smsInteraction.attributes','define'];(function(_0x40c49a,_0x2d53d0){var _0x38a75e=function(_0x5a0475){while(--_0x5a0475){_0x40c49a['push'](_0x40c49a['shift']());}};_0x38a75e(++_0x2d53d0);}(_0x58ef,0xa7));var _0xf58e=function(_0x5320c1,_0x1f41bd){_0x5320c1=_0x5320c1-0x0;var _0x451574=_0x58ef[_0x5320c1];return _0x451574;};'use strict';var _=require('lodash');var util=require(_0xf58e('0x0'));var logger=require(_0xf58e('0x1'))(_0xf58e('0x2'));var moment=require(_0xf58e('0x3'));var BPromise=require('bluebird');var rp=require(_0xf58e('0x4'));var fs=require('fs');var path=require(_0xf58e('0x5'));var rimraf=require(_0xf58e('0x6'));var config=require('../../config/environment');var attributes=require(_0xf58e('0x7'));module['exports']=function(_0x463e2c,_0xc1c06b){return _0x463e2c[_0xf58e('0x8')](_0xf58e('0x9'),attributes,{'tableName':_0xf58e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x187a39,_0x5e9324,_0x3d3067){if(_0x187a39[_0xf58e('0xb')](_0xf58e('0xc'))){_0x187a39[_0xf58e('0xd')]=moment()[_0xf58e('0xe')](_0xf58e('0xf'));}_0x3d3067(null,_0x187a39);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 6af49ab..d6d0c27 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 _0xff0d=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','options','where','attributes','limit','debug','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','ioredis'];(function(_0x220031,_0x2a7bbf){var _0x1c1a8d=function(_0xbac80a){while(--_0xbac80a){_0x220031['push'](_0x220031['shift']());}};_0x1c1a8d(++_0x2a7bbf);}(_0xff0d,0x100));var _0xdff0=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0xff0d[_0x40b3f2];return _0x4ce90c;};'use strict';var _=require(_0xdff0('0x0'));var util=require(_0xdff0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdff0('0x2'));var db=require(_0xdff0('0x3'))['db'];var utils=require(_0xdff0('0x4'));var logger=require(_0xdff0('0x5'))(_0xdff0('0x6'));var config=require('../../config/environment');var jayson=require(_0xdff0('0x7'));var client=jayson[_0xdff0('0x8')]['http']({'port':0x232a});config[_0xdff0('0x9')]=_['defaults'](config[_0xdff0('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdff0('0x9')]));require(_0xdff0('0xa'))[_0xdff0('0xb')](socket);function respondWithRpcPromise(_0x5c9beb,_0x3ee5a0,_0x2ab28c){return new BPromise(function(_0x835190,_0x39016b){return client[_0xdff0('0xc')](_0x5c9beb,_0x2ab28c)[_0xdff0('0xd')](function(_0x141ae5){logger[_0xdff0('0xe')](_0xdff0('0xf'),_0x3ee5a0,'request\x20sent');logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x3ee5a0,_0xdff0('0x10'),JSON[_0xdff0('0x11')](_0x141ae5));if(_0x141ae5['error']){if(_0x141ae5[_0xdff0('0x12')][_0xdff0('0x13')]===0x1f4){logger[_0xdff0('0x12')](_0xdff0('0xf'),_0x3ee5a0,_0x141ae5[_0xdff0('0x12')][_0xdff0('0x14')]);return _0x39016b(_0x141ae5[_0xdff0('0x12')][_0xdff0('0x14')]);}logger['error'](_0xdff0('0xf'),_0x3ee5a0,_0x141ae5['error'][_0xdff0('0x14')]);return _0x835190(_0x141ae5[_0xdff0('0x12')][_0xdff0('0x14')]);}else{logger[_0xdff0('0xe')](_0xdff0('0xf'),_0x3ee5a0,_0xdff0('0x10'));_0x835190(_0x141ae5['result'][_0xdff0('0x14')]);}})[_0xdff0('0x15')](function(_0xb20382){logger[_0xdff0('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x3ee5a0,_0xb20382);_0x39016b(_0xb20382);});});}exports[_0xdff0('0x16')]=function(_0x23a92f){var _0x23cad9=this;return new Promise(function(_0x264a74,_0x4bcab6){return db[_0xdff0('0x17')]['update'](_0x23a92f['body'],{'raw':_0x23a92f[_0xdff0('0x18')]?_0x23a92f[_0xdff0('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23a92f[_0xdff0('0x18')]?_0x23a92f[_0xdff0('0x18')][_0xdff0('0x19')]||null:null,'attributes':_0x23a92f[_0xdff0('0x18')]?_0x23a92f[_0xdff0('0x18')][_0xdff0('0x1a')]||null:null,'limit':_0x23a92f[_0xdff0('0x18')]?_0x23a92f[_0xdff0('0x18')][_0xdff0('0x1b')]||null:null})['then'](function(_0x270999){logger[_0xdff0('0xe')](_0xdff0('0x16'),_0x23a92f);logger[_0xdff0('0x1c')](_0xdff0('0x16'),_0x23a92f,JSON['stringify'](_0x270999));_0x264a74(_0x270999);})[_0xdff0('0x15')](function(_0x3990b5){logger[_0xdff0('0x12')]('UpdateSmsInteraction',_0x3990b5[_0xdff0('0x14')],_0x23a92f);_0x4bcab6(_0x23cad9[_0xdff0('0x12')](0x1f4,_0x3990b5[_0xdff0('0x14')]));});});};exports[_0xdff0('0x1d')]=function(_0x3cec19){return new Promise(function(_0x294a7e,_0x53e4f8){return db['SmsInteraction'][_0xdff0('0x1e')]({'where':_0x3cec19['options']?_0x3cec19[_0xdff0('0x18')][_0xdff0('0x19')]||null:null})[_0xdff0('0xd')](function(_0x28511b){if(_0x28511b){return _0x28511b[_0xdff0('0x1f')](_0x3cec19[_0xdff0('0x20')][_0xdff0('0x21')],_[_0xdff0('0x22')](_0x3cec19['body'],[_0xdff0('0x21'),'id'])||{});}})[_0xdff0('0x23')](function(_0x5941c0){logger[_0xdff0('0xe')](_0xdff0('0x24'),_0x3cec19);logger[_0xdff0('0x1c')](_0xdff0('0x24'),_0x3cec19,JSON[_0xdff0('0x11')](_0x5941c0));_0x294a7e(_0x5941c0);})[_0xdff0('0x15')](function(_0x16f608){logger[_0xdff0('0x12')](_0xdff0('0x24'),_0x16f608['message'],_0x3cec19);_0x53e4f8(_this[_0xdff0('0x12')](0x1f4,_0x16f608['message']));});});}; \ No newline at end of file +var _0x8121=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','omit','body','ids','spread','AddTags','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4b7e4d,_0x82d2ab){var _0x38d6af=function(_0x227432){while(--_0x227432){_0x4b7e4d['push'](_0x4b7e4d['shift']());}};_0x38d6af(++_0x82d2ab);}(_0x8121,0x7a));var _0x1812=function(_0x200c65,_0x151486){_0x200c65=_0x200c65-0x0;var _0x3ea67f=_0x8121[_0x200c65];return _0x3ea67f;};'use strict';var _=require(_0x1812('0x0'));var util=require(_0x1812('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1812('0x2'));var db=require(_0x1812('0x3'))['db'];var utils=require(_0x1812('0x4'));var logger=require(_0x1812('0x5'))(_0x1812('0x6'));var config=require(_0x1812('0x7'));var jayson=require(_0x1812('0x8'));var client=jayson[_0x1812('0x9')][_0x1812('0xa')]({'port':0x232a});config[_0x1812('0xb')]=_[_0x1812('0xc')](config['redis'],{'host':_0x1812('0xd'),'port':0x18eb});var socket=require(_0x1812('0xe'))(new Redis(config['redis']));require(_0x1812('0xf'))[_0x1812('0x10')](socket);function respondWithRpcPromise(_0x405931,_0x230f54,_0x1641d){return new BPromise(function(_0x1181b2,_0xfc7c08){return client['request'](_0x405931,_0x1641d)[_0x1812('0x11')](function(_0x5533b9){logger[_0x1812('0x12')](_0x1812('0x13'),_0x230f54,_0x1812('0x14'));logger[_0x1812('0x15')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x230f54,_0x1812('0x14'),JSON[_0x1812('0x16')](_0x5533b9));if(_0x5533b9[_0x1812('0x17')]){if(_0x5533b9[_0x1812('0x17')][_0x1812('0x18')]===0x1f4){logger['error'](_0x1812('0x13'),_0x230f54,_0x5533b9[_0x1812('0x17')][_0x1812('0x19')]);return _0xfc7c08(_0x5533b9[_0x1812('0x17')][_0x1812('0x19')]);}logger[_0x1812('0x17')](_0x1812('0x13'),_0x230f54,_0x5533b9[_0x1812('0x17')][_0x1812('0x19')]);return _0x1181b2(_0x5533b9['error'][_0x1812('0x19')]);}else{logger[_0x1812('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x230f54,_0x1812('0x14'));_0x1181b2(_0x5533b9['result']['message']);}})[_0x1812('0x1a')](function(_0x5a303b){logger[_0x1812('0x17')](_0x1812('0x13'),_0x230f54,_0x5a303b);_0xfc7c08(_0x5a303b);});});}exports[_0x1812('0x1b')]=function(_0x52216d){var _0x542ca4=this;return new Promise(function(_0x3591de,_0x1feec8){return db[_0x1812('0x1c')][_0x1812('0x1d')](_0x52216d['body'],{'raw':_0x52216d[_0x1812('0x1e')]?_0x52216d[_0x1812('0x1e')][_0x1812('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52216d[_0x1812('0x1e')]?_0x52216d[_0x1812('0x1e')][_0x1812('0x20')]||null:null,'attributes':_0x52216d[_0x1812('0x1e')]?_0x52216d[_0x1812('0x1e')][_0x1812('0x21')]||null:null,'limit':_0x52216d['options']?_0x52216d[_0x1812('0x1e')][_0x1812('0x22')]||null:null})['then'](function(_0x26f5b9){logger['info'](_0x1812('0x1b'),_0x52216d);logger['debug'](_0x1812('0x1b'),_0x52216d,JSON[_0x1812('0x16')](_0x26f5b9));_0x3591de(_0x26f5b9);})[_0x1812('0x1a')](function(_0x4300f2){logger[_0x1812('0x17')](_0x1812('0x1b'),_0x4300f2[_0x1812('0x19')],_0x52216d);_0x1feec8(_0x542ca4[_0x1812('0x17')](0x1f4,_0x4300f2['message']));});});};exports[_0x1812('0x23')]=function(_0x32ccc4){return new Promise(function(_0x56202b,_0x202dce){return db[_0x1812('0x1c')][_0x1812('0x24')]({'where':_0x32ccc4[_0x1812('0x1e')]?_0x32ccc4[_0x1812('0x1e')]['where']||null:null})[_0x1812('0x11')](function(_0x30cf34){if(_0x30cf34){return _0x30cf34[_0x1812('0x25')](_0x32ccc4['body']['ids'],_[_0x1812('0x26')](_0x32ccc4[_0x1812('0x27')],[_0x1812('0x28'),'id'])||{});}})[_0x1812('0x29')](function(_0x147758){logger[_0x1812('0x12')]('AddTags',_0x32ccc4);logger[_0x1812('0x15')]('AddTags',_0x32ccc4,JSON[_0x1812('0x16')](_0x147758));_0x56202b(_0x147758);})[_0x1812('0x1a')](function(_0x5aebe1){logger[_0x1812('0x17')](_0x1812('0x2a'),_0x5aebe1['message'],_0x32ccc4);_0x202dce(_this['error'](0x1f4,_0x5aebe1[_0x1812('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 12aca80..b29a03a 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 _0x57a6=['./smsInteraction.events','remove','update','emit','removeListener','register'];(function(_0x174583,_0x468485){var _0x14e46f=function(_0x227127){while(--_0x227127){_0x174583['push'](_0x174583['shift']());}};_0x14e46f(++_0x468485);}(_0x57a6,0x126));var _0x657a=function(_0x545c26,_0x433422){_0x545c26=_0x545c26-0x0;var _0x147063=_0x57a6[_0x545c26];return _0x147063;};'use strict';var SmsInteractionEvents=require(_0x657a('0x0'));var events=['save',_0x657a('0x1'),_0x657a('0x2')];function createListener(_0x257360,_0x3e0949){return function(_0x238900){_0x3e0949[_0x657a('0x3')](_0x257360,_0x238900);};}function removeListener(_0x3f8c7b,_0x1fbaf3){return function(){SmsInteractionEvents[_0x657a('0x4')](_0x3f8c7b,_0x1fbaf3);};}exports[_0x657a('0x5')]=function(_0x30b818){for(var _0x137137=0x0,_0x56264c=events['length'];_0x137137<_0x56264c;_0x137137++){var _0x763186=events[_0x137137];var _0x553565=createListener('smsInteraction:'+_0x763186,_0x30b818);SmsInteractionEvents['on'](_0x763186,_0x553565);}}; \ No newline at end of file +var _0x5fa7=['./smsInteraction.events','save','remove','update','emit','removeListener','smsInteraction:'];(function(_0x512bdc,_0x2fcdcb){var _0x51a7f0=function(_0x4d279b){while(--_0x4d279b){_0x512bdc['push'](_0x512bdc['shift']());}};_0x51a7f0(++_0x2fcdcb);}(_0x5fa7,0xfc));var _0x75fa=function(_0x9cd23a,_0xee570b){_0x9cd23a=_0x9cd23a-0x0;var _0x1fbe49=_0x5fa7[_0x9cd23a];return _0x1fbe49;};'use strict';var SmsInteractionEvents=require(_0x75fa('0x0'));var events=[_0x75fa('0x1'),_0x75fa('0x2'),_0x75fa('0x3')];function createListener(_0x10fb87,_0x3436ae){return function(_0x577fa1){_0x3436ae[_0x75fa('0x4')](_0x10fb87,_0x577fa1);};}function removeListener(_0x3db14d,_0x3c9a9a){return function(){SmsInteractionEvents[_0x75fa('0x5')](_0x3db14d,_0x3c9a9a);};}exports['register']=function(_0x449ae3){for(var _0x2fcd72=0x0,_0x12f826=events['length'];_0x2fcd72<_0x12f826;_0x2fcd72++){var _0x16f1c6=events[_0x2fcd72];var _0x16ddfe=createListener(_0x75fa('0x6')+_0x16f1c6,_0x449ae3);SmsInteractionEvents['on'](_0x16f1c6,_0x16ddfe);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 52b7f67..9f4d81d 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 _0x3d5d=['get','index','/describe','isAuthenticated','describe','post','sms','smsmessage:create','/:id/status','status','update','/:id/accept','accept','put','/:id/reject','delete','/:id','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller'];(function(_0xcd49de,_0x67cdbf){var _0x73aa86=function(_0x23a0c7){while(--_0x23a0c7){_0xcd49de['push'](_0xcd49de['shift']());}};_0x73aa86(++_0x67cdbf);}(_0x3d5d,0xe2));var _0xd3d5=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x3d5d[_0xbec8e6];return _0x4aa6f2;};'use strict';var multer=require(_0xd3d5('0x0'));var util=require('util');var path=require(_0xd3d5('0x1'));var timeout=require(_0xd3d5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd3d5('0x3'));var auth=require(_0xd3d5('0x4'));var interaction=require(_0xd3d5('0x5'));var config=require(_0xd3d5('0x6'));var controller=require(_0xd3d5('0x7'));router[_0xd3d5('0x8')]('/',auth['isAuthenticated'](),controller[_0xd3d5('0x9')]);router[_0xd3d5('0x8')](_0xd3d5('0xa'),auth[_0xd3d5('0xb')](),controller[_0xd3d5('0xc')]);router[_0xd3d5('0x8')]('/:id',auth[_0xd3d5('0xb')](),controller['show']);router[_0xd3d5('0xd')]('/',auth[_0xd3d5('0xb')](),interaction['tracked'](_0xd3d5('0xe'),_0xd3d5('0xf')),controller['create']);router[_0xd3d5('0xd')](_0xd3d5('0x10'),controller[_0xd3d5('0x11')]);router['put']('/:id',auth[_0xd3d5('0xb')](),controller[_0xd3d5('0x12')]);router['put'](_0xd3d5('0x13'),auth['isAuthenticated'](),controller[_0xd3d5('0x14')]);router[_0xd3d5('0x15')](_0xd3d5('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0xd3d5('0x17')](_0xd3d5('0x18'),auth['isAuthenticated'](),controller[_0xd3d5('0x19')]);module['exports']=router; \ No newline at end of file +var _0x6262=['/:id/reject','reject','destroy','exports','util','connect-timeout','express','Router','../../config/environment','get','index','isAuthenticated','describe','/:id','tracked','sms','smsmessage:create','create','status','update','/:id/accept','put'];(function(_0x3d3ba2,_0x125f49){var _0x3a72e5=function(_0x166620){while(--_0x166620){_0x3d3ba2['push'](_0x3d3ba2['shift']());}};_0x3a72e5(++_0x125f49);}(_0x6262,0x72));var _0x2626=function(_0x51ed46,_0x4b7ad2){_0x51ed46=_0x51ed46-0x0;var _0xc2b1e7=_0x6262[_0x51ed46];return _0xc2b1e7;};'use strict';var multer=require('multer');var util=require(_0x2626('0x0'));var path=require('path');var timeout=require(_0x2626('0x1'));var express=require(_0x2626('0x2'));var router=express[_0x2626('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2626('0x4'));var controller=require('./smsMessage.controller');router[_0x2626('0x5')]('/',auth['isAuthenticated'](),controller[_0x2626('0x6')]);router['get']('/describe',auth[_0x2626('0x7')](),controller[_0x2626('0x8')]);router[_0x2626('0x5')](_0x2626('0x9'),auth[_0x2626('0x7')](),controller['show']);router['post']('/',auth[_0x2626('0x7')](),interaction[_0x2626('0xa')](_0x2626('0xb'),_0x2626('0xc')),controller[_0x2626('0xd')]);router['post']('/:id/status',controller[_0x2626('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2626('0xf')]);router['put'](_0x2626('0x10'),auth[_0x2626('0x7')](),controller['accept']);router[_0x2626('0x11')](_0x2626('0x12'),auth[_0x2626('0x7')](),controller[_0x2626('0x13')]);router['delete'](_0x2626('0x9'),auth[_0x2626('0x7')](),controller[_0x2626('0x14')]);module[_0x2626('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 93a1887..43ca857 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 _0xc922=['STRING','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x5dee44,_0x115b60){var _0x46f720=function(_0x169927){while(--_0x169927){_0x5dee44['push'](_0x5dee44['shift']());}};_0x46f720(++_0x115b60);}(_0xc922,0x132));var _0x2c92=function(_0x20b32c,_0x3342d8){_0x20b32c=_0x20b32c-0x0;var _0x28fbff=_0xc922[_0x20b32c];return _0x28fbff;};'use strict';var Sequelize=require(_0x2c92('0x0'));module[_0x2c92('0x1')]={'body':{'type':Sequelize[_0x2c92('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2c92('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2c92('0x4')]('in',_0x2c92('0x5')),'defaultValue':_0x2c92('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x2c92('0x6')]},'readAt':{'type':Sequelize[_0x2c92('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2c92('0x6')]},'providerResponse':{'type':Sequelize[_0x2c92('0x2')]}}; \ No newline at end of file +var _0xfb3b=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x1fb1d8,_0x5aeade){var _0x1ef96d=function(_0x205e6a){while(--_0x205e6a){_0x1fb1d8['push'](_0x1fb1d8['shift']());}};_0x1ef96d(++_0x5aeade);}(_0xfb3b,0x109));var _0xbfb3=function(_0x37d70d,_0x334ef7){_0x37d70d=_0x37d70d-0x0;var _0x282418=_0xfb3b[_0x37d70d];return _0x282418;};'use strict';var Sequelize=require(_0xbfb3('0x0'));module[_0xbfb3('0x1')]={'body':{'type':Sequelize[_0xbfb3('0x2')](_0xbfb3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xbfb3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbfb3('0x5')]('in',_0xbfb3('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xbfb3('0x7')](0xbe)},'phone':{'type':Sequelize[_0xbfb3('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xbfb3('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xbfb3('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 82b9a22..2e15390 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 _0x84c6=['sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','params','keys','length','options','find','create','body','describe','sms-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','SmsInteraction','UserId','isNil','read1stAt','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','sms','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','RejectMessage','rejectMessage','QueryTypes','SIP/%s','reject','rejectmessage','SmsAccountId','debug','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','inspect','plivo','MessageUUID','indexOf','sent','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','error','code','SmsMessage,\x20%s,\x20%s','message','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','end','name','index','map','SmsMessage','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84c6,0xe7));var _0x684c=function(_0x48f382,_0x5527f5){_0x48f382=_0x48f382-0x0;var _0x42fdbd=_0x84c6[_0x48f382];return _0x42fdbd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x684c('0x0'));var jsonpatch=require(_0x684c('0x1'));var rp=require(_0x684c('0x2'));var moment=require('moment');var BPromise=require(_0x684c('0x3'));var Mustache=require('mustache');var util=require(_0x684c('0x4'));var path=require(_0x684c('0x5'));var sox=require(_0x684c('0x6'));var csv=require(_0x684c('0x7'));var ejs=require(_0x684c('0x8'));var fs=require('fs');var fs_extra=require(_0x684c('0x9'));var _=require(_0x684c('0xa'));var squel=require(_0x684c('0xb'));var crypto=require(_0x684c('0xc'));var jsforce=require(_0x684c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x684c('0x7'));var querystring=require(_0x684c('0xe'));var Papa=require('papaparse');var Redis=require(_0x684c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x684c('0x10'));var as=require(_0x684c('0x11'));var hardwareService=require(_0x684c('0x12'));var logger=require(_0x684c('0x13'))(_0x684c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x684c('0x15'));var db=require('../../mysqldb')['db'];config[_0x684c('0x16')]=_[_0x684c('0x17')](config[_0x684c('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x684c('0x18'))(new Redis(config['redis']));require(_0x684c('0x19'))[_0x684c('0x1a')](socket);var jayson=require(_0x684c('0x1b'));var client=jayson[_0x684c('0x1c')][_0x684c('0x1d')]({'port':0x232c});var client9002=jayson[_0x684c('0x1c')][_0x684c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x125c77,_0x319df7,_0x5cf7c8,_0x41b04b){return new BPromise(function(_0x5dd4f1,_0x4d47de){var _0xaae9f4=_0x41b04b||client;return _0xaae9f4[_0x684c('0x1e')](_0x125c77,_0x5cf7c8)[_0x684c('0x1f')](function(_0x1dc55d){logger[_0x684c('0x20')]('SmsMessage,\x20%s,\x20%s',_0x319df7,_0x684c('0x21'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x319df7,_0x684c('0x21'),JSON['stringify'](_0x1dc55d));if(_0x1dc55d[_0x684c('0x22')]){if(_0x1dc55d['error'][_0x684c('0x23')]===0x1f4){logger[_0x684c('0x22')](_0x684c('0x24'),_0x319df7,_0x1dc55d['error'][_0x684c('0x25')]);return _0x4d47de(_0x1dc55d[_0x684c('0x22')][_0x684c('0x25')]);}logger[_0x684c('0x22')](_0x684c('0x24'),_0x319df7,_0x1dc55d['error'][_0x684c('0x25')]);return _0x5dd4f1(_0x1dc55d[_0x684c('0x22')][_0x684c('0x25')]);}else{logger[_0x684c('0x20')](_0x684c('0x24'),_0x319df7,_0x684c('0x21'));_0x5dd4f1(_0x1dc55d['result'][_0x684c('0x25')]);}})[_0x684c('0x26')](function(_0x1962a0){logger[_0x684c('0x22')](_0x684c('0x24'),_0x319df7,_0x1962a0);_0x4d47de(_0x1962a0);});});}function respondWithStatusCode(_0xfa7426,_0x6e0408){_0x6e0408=_0x6e0408||0xcc;return function(_0xe7294c){if(_0xe7294c){return _0xfa7426[_0x684c('0x27')](_0x6e0408);}return _0xfa7426['status'](_0x6e0408)['end']();};}function respondWithResult(_0x59ac0a,_0x1d3445){_0x1d3445=_0x1d3445||0xc8;return function(_0xdbb423){if(_0xdbb423){return _0x59ac0a[_0x684c('0x28')](_0x1d3445)[_0x684c('0x29')](_0xdbb423);}};}function respondWithFilteredResult(_0x5d8bf9,_0xb9435d){return function(_0x478eb1){if(_0x478eb1){var _0x63a41f=typeof _0xb9435d['offset']===_0x684c('0x2a')&&typeof _0xb9435d[_0x684c('0x2b')]===_0x684c('0x2a');var _0x4e995d=_0x478eb1[_0x684c('0x2c')];var _0x7b3900=_0x63a41f?0x0:_0xb9435d['offset'];var _0xadb242=_0x63a41f?_0x478eb1[_0x684c('0x2c')]:_0xb9435d[_0x684c('0x2d')]+_0xb9435d['limit'];var _0x347a5f;if(_0xadb242>=_0x4e995d){_0xadb242=_0x4e995d;_0x347a5f=0xc8;}else{_0x347a5f=0xce;}_0x5d8bf9[_0x684c('0x28')](_0x347a5f);return _0x5d8bf9[_0x684c('0x2e')](_0x684c('0x2f'),_0x7b3900+'-'+_0xadb242+'/'+_0x4e995d)['json'](_0x478eb1);}return null;};}function patchUpdates(_0x3c77e8){return function(_0x361c9d){try{jsonpatch[_0x684c('0x30')](_0x361c9d,_0x3c77e8,!![]);}catch(_0x126e8b){return BPromise['reject'](_0x126e8b);}return _0x361c9d[_0x684c('0x31')]();};}function saveUpdates(_0x4d220b,_0x335ec1){return function(_0x21cad8){if(_0x21cad8){return _0x21cad8[_0x684c('0x32')](_0x4d220b)['then'](function(_0x27e190){return _0x27e190;});}return null;};}function removeEntity(_0x1e6952,_0x43df6e){return function(_0x2164e7){if(_0x2164e7){return _0x2164e7[_0x684c('0x33')]()[_0x684c('0x1f')](function(){_0x1e6952[_0x684c('0x28')](0xcc)[_0x684c('0x34')]();});}};}function handleEntityNotFound(_0x202701,_0x2fda47){return function(_0x2b9412){if(!_0x2b9412){_0x202701[_0x684c('0x27')](0x194);}return _0x2b9412;};}function handleError(_0x585f5c,_0x34239e){_0x34239e=_0x34239e||0x1f4;return function(_0x5a167d){logger[_0x684c('0x22')](_0x5a167d['stack']);if(_0x5a167d[_0x684c('0x35')]){delete _0x5a167d['name'];}_0x585f5c[_0x684c('0x28')](_0x34239e)['send'](_0x5a167d);};}exports[_0x684c('0x36')]=function(_0x524cf9,_0x38a215){var _0x46e064={},_0x2a3f9e={},_0x1307c7={'count':0x0,'rows':[]};var _0x101e02=_[_0x684c('0x37')](db[_0x684c('0x38')][_0x684c('0x39')],function(_0x166e67){return{'name':_0x166e67[_0x684c('0x3a')],'type':_0x166e67['type'][_0x684c('0x3b')]};});_0x2a3f9e['model']=_[_0x684c('0x37')](_0x101e02,_0x684c('0x35'));_0x2a3f9e['query']=_['keys'](_0x524cf9[_0x684c('0x3c')]);_0x2a3f9e[_0x684c('0x3d')]=_[_0x684c('0x3e')](_0x2a3f9e[_0x684c('0x3f')],_0x2a3f9e[_0x684c('0x3c')]);_0x46e064[_0x684c('0x40')]=_[_0x684c('0x3e')](_0x2a3f9e['model'],qs[_0x684c('0x41')](_0x524cf9[_0x684c('0x3c')][_0x684c('0x41')]));_0x46e064[_0x684c('0x40')]=_0x46e064['attributes']['length']?_0x46e064['attributes']:_0x2a3f9e[_0x684c('0x3f')];if(!_0x524cf9[_0x684c('0x3c')][_0x684c('0x42')](_0x684c('0x43'))){_0x46e064[_0x684c('0x2b')]=qs['limit'](_0x524cf9[_0x684c('0x3c')]['limit']);_0x46e064[_0x684c('0x2d')]=qs[_0x684c('0x2d')](_0x524cf9['query'][_0x684c('0x2d')]);}_0x46e064[_0x684c('0x44')]=qs['sort'](_0x524cf9['query'][_0x684c('0x45')]);_0x46e064[_0x684c('0x46')]=qs[_0x684c('0x3d')](_[_0x684c('0x47')](_0x524cf9['query'],_0x2a3f9e['filters']),_0x101e02);if(_0x524cf9[_0x684c('0x3c')]['filter']){_0x46e064['where']=_[_0x684c('0x48')](_0x46e064[_0x684c('0x46')],{'$or':_[_0x684c('0x37')](_0x101e02,function(_0xd20b49){if(_0xd20b49[_0x684c('0x49')]!==_0x684c('0x4a')){var _0x255149={};_0x255149[_0xd20b49[_0x684c('0x35')]]={'$like':'%'+_0x524cf9[_0x684c('0x3c')][_0x684c('0x4b')]+'%'};return _0x255149;}})});}_0x46e064=_[_0x684c('0x48')]({},_0x46e064,_0x524cf9['options']);var _0x318634={'where':_0x46e064[_0x684c('0x46')]};return db[_0x684c('0x38')]['count'](_0x318634)['then'](function(_0x1a3cfc){_0x1307c7[_0x684c('0x2c')]=_0x1a3cfc;if(_0x524cf9[_0x684c('0x3c')][_0x684c('0x4c')]){_0x46e064[_0x684c('0x4d')]=[{'all':!![]}];}return db[_0x684c('0x38')]['findAll'](_0x46e064);})[_0x684c('0x1f')](function(_0x237bac){_0x1307c7['rows']=_0x237bac;return _0x1307c7;})[_0x684c('0x1f')](respondWithFilteredResult(_0x38a215,_0x46e064))[_0x684c('0x26')](handleError(_0x38a215,null));};exports['show']=function(_0xcb6105,_0x40eed8){var _0x205227={'raw':!![],'where':{'id':_0xcb6105[_0x684c('0x4e')]['id']}},_0xfb5cf7={};_0xfb5cf7[_0x684c('0x3f')]=_[_0x684c('0x4f')](db['SmsMessage'][_0x684c('0x39')]);_0xfb5cf7[_0x684c('0x3c')]=_[_0x684c('0x4f')](_0xcb6105[_0x684c('0x3c')]);_0xfb5cf7['filters']=_[_0x684c('0x3e')](_0xfb5cf7[_0x684c('0x3f')],_0xfb5cf7[_0x684c('0x3c')]);_0x205227[_0x684c('0x40')]=_['intersection'](_0xfb5cf7[_0x684c('0x3f')],qs[_0x684c('0x41')](_0xcb6105[_0x684c('0x3c')][_0x684c('0x41')]));_0x205227['attributes']=_0x205227[_0x684c('0x40')][_0x684c('0x50')]?_0x205227[_0x684c('0x40')]:_0xfb5cf7['model'];if(_0xcb6105['query'][_0x684c('0x4c')]){_0x205227[_0x684c('0x4d')]=[{'all':!![]}];}_0x205227=_['merge']({},_0x205227,_0xcb6105[_0x684c('0x51')]);return db['SmsMessage'][_0x684c('0x52')](_0x205227)[_0x684c('0x1f')](handleEntityNotFound(_0x40eed8,null))[_0x684c('0x1f')](respondWithResult(_0x40eed8,null))[_0x684c('0x26')](handleError(_0x40eed8,null));};exports[_0x684c('0x53')]=function(_0x5db72f,_0x30c12d){return db[_0x684c('0x38')][_0x684c('0x53')](_0x5db72f['body'],{})[_0x684c('0x1f')](respondWithResult(_0x30c12d,0xc9))[_0x684c('0x26')](handleError(_0x30c12d,null));};exports[_0x684c('0x32')]=function(_0x2908c9,_0x211dc8){if(_0x2908c9[_0x684c('0x54')]['id']){delete _0x2908c9['body']['id'];}return db[_0x684c('0x38')][_0x684c('0x52')]({'where':{'id':_0x2908c9['params']['id']}})[_0x684c('0x1f')](handleEntityNotFound(_0x211dc8,null))[_0x684c('0x1f')](saveUpdates(_0x2908c9[_0x684c('0x54')],null))[_0x684c('0x1f')](respondWithResult(_0x211dc8,null))['catch'](handleError(_0x211dc8,null));};exports[_0x684c('0x33')]=function(_0x2312bf,_0x202ba5){return db['SmsMessage']['find']({'where':{'id':_0x2312bf[_0x684c('0x4e')]['id']}})[_0x684c('0x1f')](handleEntityNotFound(_0x202ba5,null))[_0x684c('0x1f')](removeEntity(_0x202ba5,null))[_0x684c('0x26')](handleError(_0x202ba5,null));};exports[_0x684c('0x55')]=function(_0x5e963d,_0x819ba4){return db[_0x684c('0x38')][_0x684c('0x55')]()[_0x684c('0x1f')](respondWithResult(_0x819ba4,null))[_0x684c('0x26')](handleError(_0x819ba4,null));};var interaction_log=require(_0x684c('0x13'))(_0x684c('0x56'));exports[_0x684c('0x57')]=function(_0x5d746c,_0x23cd38,_0x74dc34){var _0x2ea3a4={'agent':{},'channel':'sms'};if(_0x5d746c[_0x684c('0x54')]['id']){delete _0x5d746c[_0x684c('0x54')]['id'];}_0x5d746c[_0x684c('0x54')]['read']=!![];_0x5d746c[_0x684c('0x54')][_0x684c('0x58')]=moment()[_0x684c('0x59')](_0x684c('0x5a'));_0x5d746c[_0x684c('0x54')]['UserId']=_0x5d746c[_0x684c('0x54')]['UserId']||_0x5d746c[_0x684c('0x5b')]['id'];_0x2ea3a4['agent']['id']=_0x5d746c[_0x684c('0x54')]['UserId'];return db[_0x684c('0x38')][_0x684c('0x52')]({'where':{'id':_0x5d746c[_0x684c('0x4e')]['id'],'UserId':null}})[_0x684c('0x1f')](handleEntityNotFound(_0x23cd38,null))['then'](saveUpdates(_0x5d746c['body'],null))[_0x684c('0x1f')](function(_0xfd9ed7){if(_0xfd9ed7){_0x2ea3a4['message']=_0xfd9ed7['get']({'plain':!![]});return db[_0x684c('0x5c')][_0x684c('0x52')]({'where':{'id':_0xfd9ed7['SmsInteractionId']}});}return null;})[_0x684c('0x1f')](handleEntityNotFound(_0x23cd38,null))[_0x684c('0x1f')](function(_0x1e0758){if(_0x1e0758){return _0x1e0758[_0x684c('0x32')]({'UserId':_0x5d746c['body'][_0x684c('0x5d')],'read1stAt':_[_0x684c('0x5e')](_0x1e0758[_0x684c('0x5f')])?moment()[_0x684c('0x59')](_0x684c('0x5a')):undefined});}return null;})[_0x684c('0x1f')](function(_0x339c19){if(_0x339c19){_0x2ea3a4['interaction']=_0x339c19[_0x684c('0x60')]({'plain':!![]});interaction_log[_0x684c('0x20')](_0x684c('0x61'),_0x5d746c[_0x684c('0x5b')]['id'],_0x5d746c['user'][_0x684c('0x35')],_0x5d746c[_0x684c('0x5b')][_0x684c('0x62')],_0x2ea3a4['interaction']['id'],_0x5d746c[_0x684c('0x54')]?JSON[_0x684c('0x63')](_0x5d746c[_0x684c('0x54')]):_0x684c('0x64'));return respondWithRpcPromise(_0x684c('0x65'),_0x684c('0x66'),_0x2ea3a4);}return null;})[_0x684c('0x1f')](function(_0x1b75d){var _0x1b4941=_0x684c('0x67')+_0x1b75d['message'][_0x684c('0x68')];return db[_0x684c('0x69')][_0x684c('0x3c')](_0x1b4941,{'type':db[_0x684c('0x6a')]['QueryTypes'][_0x684c('0x6b')],'raw':!![]})[_0x684c('0x1f')](function(_0x359981){return _0x359981;});})[_0x684c('0x1f')](function(_0x56f2aa){if(_0x56f2aa){_0x2ea3a4['message'][_0x684c('0x6c')]=_0x56f2aa[0x0];if(!_0x5d746c[_0x684c('0x54')]['UserId'])return;return db[_0x684c('0x6d')][_0x684c('0x52')]({'where':{'id':_0x5d746c[_0x684c('0x54')][_0x684c('0x5d')],'role':_0x684c('0x6e')},'attributes':['id',_0x684c('0x35'),_0x684c('0x6f'),_0x684c('0x70'),_0x684c('0x71')],'raw':!![]});}return null;})[_0x684c('0x1f')](function(_0x46d432){if(!_0x46d432)return null;_0x2ea3a4[_0x684c('0x25')][_0x684c('0x6e')]=_0x46d432;return _0x2ea3a4;})[_0x684c('0x1f')](function(_0x10b0d9){if(_0x10b0d9){if(_0x5d746c[_0x684c('0x54')][_0x684c('0x72')]){_0x2ea3a4['message'][_0x684c('0x73')]=util[_0x684c('0x59')]('SIP/%s',_0x5d746c[_0x684c('0x5b')][_0x684c('0x35')]);_0x2ea3a4[_0x684c('0x25')][_0x684c('0x74')]=_0x2ea3a4[_0x684c('0x74')];_0x2ea3a4[_0x684c('0x25')][_0x684c('0x75')]=_0x2ea3a4[_0x684c('0x74')];_0x2ea3a4[_0x684c('0x25')][_0x684c('0x76')]=_0x684c('0x57');return respondWithRpcPromise('EventManager',_0x684c('0x77'),{'event':_0x684c('0x78'),'message':_0x2ea3a4[_0x684c('0x25')]},client9002)[_0x684c('0x1f')](function(){return _0x2ea3a4;});}return _0x2ea3a4;}return null;})['then'](respondWithResult(_0x23cd38,null))[_0x684c('0x26')](handleError(_0x23cd38,null));};var interaction_log=require(_0x684c('0x13'))(_0x684c('0x56'));exports['reject']=function(_0x5c6bfb,_0x416940,_0xf4291f){var _0x1e8f3d={'agent':{},'channel':_0x684c('0x79')};if(_0x5c6bfb['body']['id']){delete _0x5c6bfb[_0x684c('0x54')]['id'];}_0x5c6bfb[_0x684c('0x54')]['UserId']=_0x5c6bfb['body'][_0x684c('0x5d')]||_0x5c6bfb[_0x684c('0x5b')]['id'];_0x1e8f3d['agent']['id']=_0x5c6bfb['body'][_0x684c('0x5d')];return db[_0x684c('0x38')][_0x684c('0x52')]({'where':{'id':_0x5c6bfb[_0x684c('0x4e')]['id'],'UserId':null}})[_0x684c('0x1f')](handleEntityNotFound(_0x416940,null))[_0x684c('0x1f')](function(_0x18a119){if(_0x18a119){_0x1e8f3d[_0x684c('0x25')]=_0x18a119['get']({'plain':!![]});return db[_0x684c('0x5c')][_0x684c('0x52')]({'where':{'id':_0x18a119[_0x684c('0x7a')]}});}return null;})[_0x684c('0x1f')](handleEntityNotFound(_0x416940,null))[_0x684c('0x1f')](function(_0x452ee8){if(_0x452ee8){_0x1e8f3d['interaction']=_0x452ee8['get']({'plain':!![]});interaction_log['info'](_0x684c('0x7b'),_0x5c6bfb[_0x684c('0x5b')]['id'],_0x5c6bfb[_0x684c('0x5b')][_0x684c('0x35')],_0x5c6bfb['user'][_0x684c('0x62')],_0x1e8f3d[_0x684c('0x7c')]['id'],_0x5c6bfb['body']?JSON['stringify'](_0x5c6bfb[_0x684c('0x54')]):_0x684c('0x64'));return respondWithRpcPromise(_0x684c('0x7d'),_0x684c('0x7e'),_0x1e8f3d);}return null;})[_0x684c('0x1f')](function(_0x41ed18){var _0x2d57cc=_0x684c('0x67')+_0x41ed18[_0x684c('0x25')][_0x684c('0x68')];return db[_0x684c('0x69')][_0x684c('0x3c')](_0x2d57cc,{'type':db['Sequelize'][_0x684c('0x7f')][_0x684c('0x6b')],'raw':!![]})[_0x684c('0x1f')](function(_0xc5791e){return _0xc5791e;});})['then'](function(_0x3b0890){if(_0x3b0890){_0x1e8f3d['message'][_0x684c('0x6c')]=_0x3b0890[0x0];if(!_0x5c6bfb[_0x684c('0x54')][_0x684c('0x5d')])return;return db[_0x684c('0x6d')][_0x684c('0x52')]({'where':{'id':_0x5c6bfb[_0x684c('0x54')][_0x684c('0x5d')],'role':_0x684c('0x6e')},'attributes':['id','name',_0x684c('0x6f'),_0x684c('0x70'),'internal'],'raw':!![]});}return null;})[_0x684c('0x1f')](function(_0x34361c){if(!_0x34361c)return null;_0x1e8f3d[_0x684c('0x25')][_0x684c('0x6e')]=_0x34361c;return _0x1e8f3d;})['then'](function(_0x5bda8c){if(_0x5bda8c){_0x5bda8c[_0x684c('0x25')]['interface']=util[_0x684c('0x59')](_0x684c('0x80'),_0x5c6bfb['user'][_0x684c('0x35')]);_0x5bda8c['message']['channel']=_0x1e8f3d[_0x684c('0x74')];_0x5bda8c[_0x684c('0x25')][_0x684c('0x75')]=_0x1e8f3d[_0x684c('0x74')];_0x5bda8c['message'][_0x684c('0x76')]=_0x684c('0x81');respondWithRpcPromise('EventManager',_0x684c('0x77'),{'event':_0x684c('0x82'),'message':_0x5bda8c[_0x684c('0x25')]},client9002);return _0x1e8f3d;}return null;})[_0x684c('0x1f')](respondWithResult(_0x416940,null))['catch'](handleError(_0x416940,null));};exports[_0x684c('0x28')]=function(_0xce7c97,_0x1dcb99,_0x126e27){if(_0xce7c97['body']['id']){delete _0xce7c97[_0x684c('0x54')]['id'];}var _0x53f745;return db[_0x684c('0x38')][_0x684c('0x52')]({'where':{'id':_0xce7c97['params']['id']}})[_0x684c('0x1f')](handleEntityNotFound(_0x1dcb99,null))['then'](function(_0xc60cbe){if(_0xc60cbe){_0x53f745=_0xc60cbe;return db['SmsAccount'][_0x684c('0x52')]({'where':{'id':_0xc60cbe[_0x684c('0x83')]}});}})[_0x684c('0x1f')](handleEntityNotFound(_0x1dcb99,null))[_0x684c('0x1f')](function(_0x5c354b){if(_0x5c354b){logger[_0x684c('0x84')](_0x684c('0x85'),_0x684c('0x28'),_0x684c('0x86'),_0x5c354b[_0x684c('0x49')],util['inspect'](_0xce7c97[_0x684c('0x54')],{'showHidden':![],'depth':null}));switch(_0x5c354b[_0x684c('0x49')]){case _0x684c('0x87'):if(_0xce7c97[_0x684c('0x54')][_0x684c('0x88')]&&_0xce7c97[_0x684c('0x54')][_0x684c('0x88')]===_0x53f745[_0x684c('0x89')]){return _0x53f745[_0x684c('0x32')]({'read':!![]});}else{logger[_0x684c('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x684c('0x28'),'twilio',util[_0x684c('0x8a')](_0xce7c97[_0x684c('0x54')],{'showHidden':![],'depth':null}));}break;case _0x684c('0x8b'):if(_0xce7c97[_0x684c('0x54')][_0x684c('0x8c')]&&_0xce7c97[_0x684c('0x54')][_0x684c('0x8c')]===_0x53f745[_0x684c('0x89')]&&_[_0x684c('0x8d')]([_0x684c('0x8e'),'delivered'],_0xce7c97['body'][_0x684c('0x8f')])>=0x0){return _0x53f745['update']({'read':!![]});}else{logger[_0x684c('0x22')](_0x684c('0x90'),_0x684c('0x28'),_0x684c('0x91'),util[_0x684c('0x8a')](_0xce7c97[_0x684c('0x54')],{'showHidden':![],'depth':null}));}break;case _0x684c('0x92'):var _0x153695=_0xce7c97[_0x684c('0x54')][_0x684c('0x93')][0x0];if(_0x153695['status'][_0x684c('0x94')]===_0x684c('0x95')){return _0x53f745[_0x684c('0x32')]({'read':!![]});}else{logger[_0x684c('0x22')](_0x684c('0x90'),'status',_0x684c('0x92'),util['inspect'](_0xce7c97[_0x684c('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x53f745;}})[_0x684c('0x1f')](respondWithResult(_0x1dcb99,null))[_0x684c('0x26')](handleError(_0x1dcb99,null));}; \ No newline at end of file +var _0x6d5e=['SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','params','length','create','body','find','describe','sms-interactions','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','SmsInteraction','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','contact','internal','motionChannel','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','sent','delivered','Status','plivio','inspect','infobip','groupName','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','client','http','request','SmsMessage,\x20%s,\x20%s'];(function(_0x5a0e32,_0x347ae2){var _0xea8f24=function(_0x47f773){while(--_0x47f773){_0x5a0e32['push'](_0x5a0e32['shift']());}};_0xea8f24(++_0x347ae2);}(_0x6d5e,0x103));var _0xe6d5=function(_0x197570,_0x55e129){_0x197570=_0x197570-0x0;var _0x340d4b=_0x6d5e[_0x197570];return _0x340d4b;};'use strict';var emlformat=require(_0xe6d5('0x0'));var rimraf=require(_0xe6d5('0x1'));var zipdir=require(_0xe6d5('0x2'));var jsonpatch=require(_0xe6d5('0x3'));var rp=require('request-promise');var moment=require(_0xe6d5('0x4'));var BPromise=require(_0xe6d5('0x5'));var Mustache=require(_0xe6d5('0x6'));var util=require(_0xe6d5('0x7'));var path=require(_0xe6d5('0x8'));var sox=require(_0xe6d5('0x9'));var csv=require(_0xe6d5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe6d5('0xb'));var _=require('lodash');var squel=require(_0xe6d5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe6d5('0xd'));var Papa=require(_0xe6d5('0xe'));var Redis=require(_0xe6d5('0xf'));var authService=require(_0xe6d5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe6d5('0x11'));var hardwareService=require(_0xe6d5('0x12'));var logger=require(_0xe6d5('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xe6d5('0x14'));var licenseUtil=require(_0xe6d5('0x15'));var db=require(_0xe6d5('0x16'))['db'];config[_0xe6d5('0x17')]=_[_0xe6d5('0x18')](config[_0xe6d5('0x17')],{'host':_0xe6d5('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe6d5('0x17')]));require(_0xe6d5('0x1a'))[_0xe6d5('0x1b')](socket);var jayson=require(_0xe6d5('0x1c'));var client=jayson[_0xe6d5('0x1d')][_0xe6d5('0x1e')]({'port':0x232c});var client9002=jayson[_0xe6d5('0x1d')][_0xe6d5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3c7b7a,_0x49adf8,_0x2a8aa7,_0x2adb34){return new BPromise(function(_0x268ced,_0x4ecc63){var _0x3847d1=_0x2adb34||client;return _0x3847d1[_0xe6d5('0x1f')](_0x3c7b7a,_0x2a8aa7)['then'](function(_0x1f4ce6){logger['info'](_0xe6d5('0x20'),_0x49adf8,'request\x20sent');logger['debug'](_0xe6d5('0x21'),_0x49adf8,'request\x20sent',JSON[_0xe6d5('0x22')](_0x1f4ce6));if(_0x1f4ce6[_0xe6d5('0x23')]){if(_0x1f4ce6[_0xe6d5('0x23')]['code']===0x1f4){logger['error'](_0xe6d5('0x20'),_0x49adf8,_0x1f4ce6[_0xe6d5('0x23')][_0xe6d5('0x24')]);return _0x4ecc63(_0x1f4ce6[_0xe6d5('0x23')][_0xe6d5('0x24')]);}logger['error'](_0xe6d5('0x20'),_0x49adf8,_0x1f4ce6[_0xe6d5('0x23')]['message']);return _0x268ced(_0x1f4ce6[_0xe6d5('0x23')][_0xe6d5('0x24')]);}else{logger[_0xe6d5('0x25')]('SmsMessage,\x20%s,\x20%s',_0x49adf8,_0xe6d5('0x26'));_0x268ced(_0x1f4ce6[_0xe6d5('0x27')][_0xe6d5('0x24')]);}})[_0xe6d5('0x28')](function(_0x1be7b0){logger[_0xe6d5('0x23')](_0xe6d5('0x20'),_0x49adf8,_0x1be7b0);_0x4ecc63(_0x1be7b0);});});}function respondWithStatusCode(_0x7f7bcd,_0x5546e6){_0x5546e6=_0x5546e6||0xcc;return function(_0x347343){if(_0x347343){return _0x7f7bcd[_0xe6d5('0x29')](_0x5546e6);}return _0x7f7bcd[_0xe6d5('0x2a')](_0x5546e6)[_0xe6d5('0x2b')]();};}function respondWithResult(_0x543934,_0x3c90dc){_0x3c90dc=_0x3c90dc||0xc8;return function(_0x4a4b27){if(_0x4a4b27){return _0x543934[_0xe6d5('0x2a')](_0x3c90dc)[_0xe6d5('0x2c')](_0x4a4b27);}};}function respondWithFilteredResult(_0x4d8a35,_0x2bab45){return function(_0x526786){if(_0x526786){var _0x4377bc=typeof _0x2bab45[_0xe6d5('0x2d')]===_0xe6d5('0x2e')&&typeof _0x2bab45[_0xe6d5('0x2f')]===_0xe6d5('0x2e');var _0x4754a8=_0x526786[_0xe6d5('0x30')];var _0x53da30=_0x4377bc?0x0:_0x2bab45[_0xe6d5('0x2d')];var _0x2973b6=_0x4377bc?_0x526786[_0xe6d5('0x30')]:_0x2bab45[_0xe6d5('0x2d')]+_0x2bab45['limit'];var _0x30e550;if(_0x2973b6>=_0x4754a8){_0x2973b6=_0x4754a8;_0x30e550=0xc8;}else{_0x30e550=0xce;}_0x4d8a35[_0xe6d5('0x2a')](_0x30e550);return _0x4d8a35['set'](_0xe6d5('0x31'),_0x53da30+'-'+_0x2973b6+'/'+_0x4754a8)['json'](_0x526786);}return null;};}function patchUpdates(_0x1fe99a){return function(_0x513cbd){try{jsonpatch[_0xe6d5('0x32')](_0x513cbd,_0x1fe99a,!![]);}catch(_0x5354b0){return BPromise[_0xe6d5('0x33')](_0x5354b0);}return _0x513cbd[_0xe6d5('0x34')]();};}function saveUpdates(_0x15c847,_0x14960b){return function(_0x556198){if(_0x556198){return _0x556198[_0xe6d5('0x35')](_0x15c847)[_0xe6d5('0x36')](function(_0x5adc1e){return _0x5adc1e;});}return null;};}function removeEntity(_0x4280b6,_0x38c757){return function(_0x5cf193){if(_0x5cf193){return _0x5cf193[_0xe6d5('0x37')]()[_0xe6d5('0x36')](function(){_0x4280b6['status'](0xcc)[_0xe6d5('0x2b')]();});}};}function handleEntityNotFound(_0xaa505e,_0x274b18){return function(_0x27a9c0){if(!_0x27a9c0){_0xaa505e[_0xe6d5('0x29')](0x194);}return _0x27a9c0;};}function handleError(_0x15e4ce,_0x22a229){_0x22a229=_0x22a229||0x1f4;return function(_0x2fb0c6){logger['error'](_0x2fb0c6['stack']);if(_0x2fb0c6[_0xe6d5('0x38')]){delete _0x2fb0c6[_0xe6d5('0x38')];}_0x15e4ce[_0xe6d5('0x2a')](_0x22a229)[_0xe6d5('0x39')](_0x2fb0c6);};}exports[_0xe6d5('0x3a')]=function(_0x4f604d,_0x2c308d){var _0x1ca90a={},_0x7cc756={},_0x348b47={'count':0x0,'rows':[]};var _0x2c1eb9=_[_0xe6d5('0x3b')](db[_0xe6d5('0x3c')][_0xe6d5('0x3d')],function(_0x46fd58){return{'name':_0x46fd58[_0xe6d5('0x3e')],'type':_0x46fd58[_0xe6d5('0x3f')][_0xe6d5('0x40')]};});_0x7cc756[_0xe6d5('0x41')]=_[_0xe6d5('0x3b')](_0x2c1eb9,_0xe6d5('0x38'));_0x7cc756[_0xe6d5('0x42')]=_[_0xe6d5('0x43')](_0x4f604d[_0xe6d5('0x42')]);_0x7cc756[_0xe6d5('0x44')]=_['intersection'](_0x7cc756[_0xe6d5('0x41')],_0x7cc756[_0xe6d5('0x42')]);_0x1ca90a[_0xe6d5('0x45')]=_[_0xe6d5('0x46')](_0x7cc756[_0xe6d5('0x41')],qs[_0xe6d5('0x47')](_0x4f604d[_0xe6d5('0x42')][_0xe6d5('0x47')]));_0x1ca90a[_0xe6d5('0x45')]=_0x1ca90a[_0xe6d5('0x45')]['length']?_0x1ca90a['attributes']:_0x7cc756[_0xe6d5('0x41')];if(!_0x4f604d['query']['hasOwnProperty'](_0xe6d5('0x48'))){_0x1ca90a[_0xe6d5('0x2f')]=qs[_0xe6d5('0x2f')](_0x4f604d[_0xe6d5('0x42')][_0xe6d5('0x2f')]);_0x1ca90a[_0xe6d5('0x2d')]=qs['offset'](_0x4f604d[_0xe6d5('0x42')]['offset']);}_0x1ca90a[_0xe6d5('0x49')]=qs[_0xe6d5('0x4a')](_0x4f604d['query'][_0xe6d5('0x4a')]);_0x1ca90a['where']=qs['filters'](_[_0xe6d5('0x4b')](_0x4f604d['query'],_0x7cc756[_0xe6d5('0x44')]),_0x2c1eb9);if(_0x4f604d[_0xe6d5('0x42')][_0xe6d5('0x4c')]){_0x1ca90a['where']=_[_0xe6d5('0x4d')](_0x1ca90a[_0xe6d5('0x4e')],{'$or':_[_0xe6d5('0x3b')](_0x2c1eb9,function(_0x39b190){if(_0x39b190[_0xe6d5('0x3f')]!=='VIRTUAL'){var _0x422245={};_0x422245[_0x39b190[_0xe6d5('0x38')]]={'$like':'%'+_0x4f604d[_0xe6d5('0x42')]['filter']+'%'};return _0x422245;}})});}_0x1ca90a=_[_0xe6d5('0x4d')]({},_0x1ca90a,_0x4f604d[_0xe6d5('0x4f')]);var _0x544e87={'where':_0x1ca90a[_0xe6d5('0x4e')]};return db[_0xe6d5('0x3c')][_0xe6d5('0x30')](_0x544e87)[_0xe6d5('0x36')](function(_0x5a9fd7){_0x348b47['count']=_0x5a9fd7;if(_0x4f604d['query'][_0xe6d5('0x50')]){_0x1ca90a[_0xe6d5('0x51')]=[{'all':!![]}];}return db[_0xe6d5('0x3c')][_0xe6d5('0x52')](_0x1ca90a);})[_0xe6d5('0x36')](function(_0x4bce95){_0x348b47[_0xe6d5('0x53')]=_0x4bce95;return _0x348b47;})[_0xe6d5('0x36')](respondWithFilteredResult(_0x2c308d,_0x1ca90a))[_0xe6d5('0x28')](handleError(_0x2c308d,null));};exports['show']=function(_0x1d5281,_0x16b3f5){var _0xed04ac={'raw':!![],'where':{'id':_0x1d5281[_0xe6d5('0x54')]['id']}},_0x2e5062={};_0x2e5062['model']=_[_0xe6d5('0x43')](db[_0xe6d5('0x3c')]['rawAttributes']);_0x2e5062[_0xe6d5('0x42')]=_[_0xe6d5('0x43')](_0x1d5281[_0xe6d5('0x42')]);_0x2e5062[_0xe6d5('0x44')]=_[_0xe6d5('0x46')](_0x2e5062[_0xe6d5('0x41')],_0x2e5062[_0xe6d5('0x42')]);_0xed04ac['attributes']=_[_0xe6d5('0x46')](_0x2e5062['model'],qs[_0xe6d5('0x47')](_0x1d5281[_0xe6d5('0x42')]['fields']));_0xed04ac[_0xe6d5('0x45')]=_0xed04ac['attributes'][_0xe6d5('0x55')]?_0xed04ac[_0xe6d5('0x45')]:_0x2e5062[_0xe6d5('0x41')];if(_0x1d5281['query'][_0xe6d5('0x50')]){_0xed04ac['include']=[{'all':!![]}];}_0xed04ac=_[_0xe6d5('0x4d')]({},_0xed04ac,_0x1d5281[_0xe6d5('0x4f')]);return db[_0xe6d5('0x3c')]['find'](_0xed04ac)[_0xe6d5('0x36')](handleEntityNotFound(_0x16b3f5,null))[_0xe6d5('0x36')](respondWithResult(_0x16b3f5,null))[_0xe6d5('0x28')](handleError(_0x16b3f5,null));};exports[_0xe6d5('0x56')]=function(_0x6b2147,_0x4553f4){return db[_0xe6d5('0x3c')][_0xe6d5('0x56')](_0x6b2147[_0xe6d5('0x57')],{})['then'](respondWithResult(_0x4553f4,0xc9))[_0xe6d5('0x28')](handleError(_0x4553f4,null));};exports['update']=function(_0x28d039,_0x1c5e88){if(_0x28d039[_0xe6d5('0x57')]['id']){delete _0x28d039['body']['id'];}return db[_0xe6d5('0x3c')]['find']({'where':{'id':_0x28d039[_0xe6d5('0x54')]['id']}})[_0xe6d5('0x36')](handleEntityNotFound(_0x1c5e88,null))[_0xe6d5('0x36')](saveUpdates(_0x28d039['body'],null))['then'](respondWithResult(_0x1c5e88,null))[_0xe6d5('0x28')](handleError(_0x1c5e88,null));};exports[_0xe6d5('0x37')]=function(_0x3b8810,_0x177c30){return db[_0xe6d5('0x3c')][_0xe6d5('0x58')]({'where':{'id':_0x3b8810[_0xe6d5('0x54')]['id']}})['then'](handleEntityNotFound(_0x177c30,null))[_0xe6d5('0x36')](removeEntity(_0x177c30,null))['catch'](handleError(_0x177c30,null));};exports['describe']=function(_0x4b716b,_0x4f9e28){return db[_0xe6d5('0x3c')][_0xe6d5('0x59')]()['then'](respondWithResult(_0x4f9e28,null))[_0xe6d5('0x28')](handleError(_0x4f9e28,null));};var interaction_log=require(_0xe6d5('0x13'))(_0xe6d5('0x5a'));exports['accept']=function(_0x74e59d,_0x1b067f,_0x5f4b18){var _0x367f54={'agent':{},'channel':_0xe6d5('0x5b')};if(_0x74e59d[_0xe6d5('0x57')]['id']){delete _0x74e59d['body']['id'];}_0x74e59d[_0xe6d5('0x57')]['read']=!![];_0x74e59d[_0xe6d5('0x57')][_0xe6d5('0x5c')]=moment()[_0xe6d5('0x5d')](_0xe6d5('0x5e'));_0x74e59d[_0xe6d5('0x57')][_0xe6d5('0x5f')]=_0x74e59d[_0xe6d5('0x57')][_0xe6d5('0x5f')]||_0x74e59d[_0xe6d5('0x60')]['id'];_0x367f54[_0xe6d5('0x61')]['id']=_0x74e59d[_0xe6d5('0x57')][_0xe6d5('0x5f')];return db['SmsMessage'][_0xe6d5('0x58')]({'where':{'id':_0x74e59d['params']['id'],'UserId':null}})[_0xe6d5('0x36')](handleEntityNotFound(_0x1b067f,null))[_0xe6d5('0x36')](saveUpdates(_0x74e59d[_0xe6d5('0x57')],null))['then'](function(_0x4f20c4){if(_0x4f20c4){_0x367f54['message']=_0x4f20c4['get']({'plain':!![]});return db['SmsInteraction'][_0xe6d5('0x58')]({'where':{'id':_0x4f20c4[_0xe6d5('0x62')]}});}return null;})[_0xe6d5('0x36')](handleEntityNotFound(_0x1b067f,null))[_0xe6d5('0x36')](function(_0x1e21c9){if(_0x1e21c9){return _0x1e21c9[_0xe6d5('0x35')]({'UserId':_0x74e59d[_0xe6d5('0x57')][_0xe6d5('0x5f')],'read1stAt':_['isNil'](_0x1e21c9[_0xe6d5('0x63')])?moment()[_0xe6d5('0x5d')](_0xe6d5('0x5e')):undefined});}return null;})[_0xe6d5('0x36')](function(_0x5d0553){if(_0x5d0553){_0x367f54[_0xe6d5('0x64')]=_0x5d0553['get']({'plain':!![]});interaction_log[_0xe6d5('0x25')](_0xe6d5('0x65'),_0x74e59d['user']['id'],_0x74e59d[_0xe6d5('0x60')]['name'],_0x74e59d[_0xe6d5('0x60')][_0xe6d5('0x66')],_0x367f54[_0xe6d5('0x64')]['id'],_0x74e59d[_0xe6d5('0x57')]?JSON['stringify'](_0x74e59d[_0xe6d5('0x57')]):_0xe6d5('0x67'));return respondWithRpcPromise('AcceptMessage',_0xe6d5('0x68'),_0x367f54);}return null;})[_0xe6d5('0x36')](function(_0x15645c){var _0x25480c=_0xe6d5('0x69')+_0x15645c['message'][_0xe6d5('0x6a')];return db[_0xe6d5('0x6b')][_0xe6d5('0x42')](_0x25480c,{'type':db[_0xe6d5('0x6c')][_0xe6d5('0x6d')][_0xe6d5('0x6e')],'raw':!![]})[_0xe6d5('0x36')](function(_0x3efd2c){return _0x3efd2c;});})[_0xe6d5('0x36')](function(_0x47020d){if(_0x47020d){_0x367f54['message']['contact']=_0x47020d[0x0];if(!_0x74e59d[_0xe6d5('0x57')]['UserId'])return;return db[_0xe6d5('0x6f')][_0xe6d5('0x58')]({'where':{'id':_0x74e59d[_0xe6d5('0x57')][_0xe6d5('0x5f')],'role':_0xe6d5('0x61')},'attributes':['id',_0xe6d5('0x38'),_0xe6d5('0x70'),_0xe6d5('0x71'),'internal'],'raw':!![]});}return null;})[_0xe6d5('0x36')](function(_0x547cf8){if(!_0x547cf8)return null;_0x367f54[_0xe6d5('0x24')][_0xe6d5('0x61')]=_0x547cf8;return _0x367f54;})[_0xe6d5('0x36')](function(_0x5a0667){if(_0x5a0667){if(_0x74e59d['body'][_0xe6d5('0x72')]){_0x367f54[_0xe6d5('0x24')][_0xe6d5('0x73')]=util['format'](_0xe6d5('0x74'),_0x74e59d[_0xe6d5('0x60')]['name']);_0x367f54[_0xe6d5('0x24')][_0xe6d5('0x75')]=_0x367f54[_0xe6d5('0x75')];_0x367f54[_0xe6d5('0x24')]['motionChannel']=_0x367f54[_0xe6d5('0x75')];_0x367f54[_0xe6d5('0x24')][_0xe6d5('0x76')]=_0xe6d5('0x77');return respondWithRpcPromise('EventManager',_0xe6d5('0x78'),{'event':_0xe6d5('0x79'),'message':_0x367f54[_0xe6d5('0x24')]},client9002)[_0xe6d5('0x36')](function(){return _0x367f54;});}return _0x367f54;}return null;})[_0xe6d5('0x36')](respondWithResult(_0x1b067f,null))['catch'](handleError(_0x1b067f,null));};var interaction_log=require(_0xe6d5('0x13'))('sms-interactions');exports[_0xe6d5('0x33')]=function(_0x1ab6ca,_0x5f312a,_0x3e5f20){var _0x3982b8={'agent':{},'channel':_0xe6d5('0x5b')};if(_0x1ab6ca['body']['id']){delete _0x1ab6ca['body']['id'];}_0x1ab6ca[_0xe6d5('0x57')][_0xe6d5('0x5f')]=_0x1ab6ca[_0xe6d5('0x57')]['UserId']||_0x1ab6ca['user']['id'];_0x3982b8[_0xe6d5('0x61')]['id']=_0x1ab6ca[_0xe6d5('0x57')][_0xe6d5('0x5f')];return db[_0xe6d5('0x3c')]['find']({'where':{'id':_0x1ab6ca['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5f312a,null))[_0xe6d5('0x36')](function(_0x19d61f){if(_0x19d61f){_0x3982b8[_0xe6d5('0x24')]=_0x19d61f['get']({'plain':!![]});return db[_0xe6d5('0x7a')][_0xe6d5('0x58')]({'where':{'id':_0x19d61f[_0xe6d5('0x62')]}});}return null;})[_0xe6d5('0x36')](handleEntityNotFound(_0x5f312a,null))[_0xe6d5('0x36')](function(_0xeadaea){if(_0xeadaea){_0x3982b8['interaction']=_0xeadaea[_0xe6d5('0x7b')]({'plain':!![]});interaction_log[_0xe6d5('0x25')](_0xe6d5('0x7c'),_0x1ab6ca[_0xe6d5('0x60')]['id'],_0x1ab6ca['user'][_0xe6d5('0x38')],_0x1ab6ca[_0xe6d5('0x60')]['role'],_0x3982b8[_0xe6d5('0x64')]['id'],_0x1ab6ca[_0xe6d5('0x57')]?JSON[_0xe6d5('0x22')](_0x1ab6ca[_0xe6d5('0x57')]):'null');return respondWithRpcPromise('RejectMessage',_0xe6d5('0x7d'),_0x3982b8);}return null;})[_0xe6d5('0x36')](function(_0x42e035){var _0x570e68=_0xe6d5('0x69')+_0x42e035['message']['ContactId'];return db[_0xe6d5('0x6b')]['query'](_0x570e68,{'type':db[_0xe6d5('0x6c')][_0xe6d5('0x6d')][_0xe6d5('0x6e')],'raw':!![]})['then'](function(_0x1cc029){return _0x1cc029;});})[_0xe6d5('0x36')](function(_0x89ab06){if(_0x89ab06){_0x3982b8['message'][_0xe6d5('0x7e')]=_0x89ab06[0x0];if(!_0x1ab6ca[_0xe6d5('0x57')]['UserId'])return;return db[_0xe6d5('0x6f')][_0xe6d5('0x58')]({'where':{'id':_0x1ab6ca[_0xe6d5('0x57')][_0xe6d5('0x5f')],'role':'agent'},'attributes':['id',_0xe6d5('0x38'),_0xe6d5('0x70'),_0xe6d5('0x71'),_0xe6d5('0x7f')],'raw':!![]});}return null;})['then'](function(_0x5a04b0){if(!_0x5a04b0)return null;_0x3982b8['message'][_0xe6d5('0x61')]=_0x5a04b0;return _0x3982b8;})[_0xe6d5('0x36')](function(_0x61fd21){if(_0x61fd21){_0x61fd21[_0xe6d5('0x24')]['interface']=util[_0xe6d5('0x5d')](_0xe6d5('0x74'),_0x1ab6ca[_0xe6d5('0x60')]['name']);_0x61fd21[_0xe6d5('0x24')][_0xe6d5('0x75')]=_0x3982b8['channel'];_0x61fd21['message'][_0xe6d5('0x80')]=_0x3982b8['channel'];_0x61fd21[_0xe6d5('0x24')][_0xe6d5('0x76')]=_0xe6d5('0x33');respondWithRpcPromise(_0xe6d5('0x78'),_0xe6d5('0x78'),{'event':_0xe6d5('0x81'),'message':_0x61fd21[_0xe6d5('0x24')]},client9002);return _0x3982b8;}return null;})[_0xe6d5('0x36')](respondWithResult(_0x5f312a,null))[_0xe6d5('0x28')](handleError(_0x5f312a,null));};exports['status']=function(_0x34bdb8,_0x454e60,_0x33b1d0){if(_0x34bdb8[_0xe6d5('0x57')]['id']){delete _0x34bdb8['body']['id'];}var _0x15befb;return db['SmsMessage'][_0xe6d5('0x58')]({'where':{'id':_0x34bdb8[_0xe6d5('0x54')]['id']}})[_0xe6d5('0x36')](handleEntityNotFound(_0x454e60,null))['then'](function(_0x21c13c){if(_0x21c13c){_0x15befb=_0x21c13c;return db[_0xe6d5('0x82')][_0xe6d5('0x58')]({'where':{'id':_0x21c13c[_0xe6d5('0x83')]}});}})[_0xe6d5('0x36')](handleEntityNotFound(_0x454e60,null))[_0xe6d5('0x36')](function(_0x4ccc92){if(_0x4ccc92){logger[_0xe6d5('0x84')](_0xe6d5('0x21'),_0xe6d5('0x2a'),_0xe6d5('0x85'),_0x4ccc92[_0xe6d5('0x3f')],util['inspect'](_0x34bdb8[_0xe6d5('0x57')],{'showHidden':![],'depth':null}));switch(_0x4ccc92['type']){case _0xe6d5('0x86'):if(_0x34bdb8['body'][_0xe6d5('0x87')]&&_0x34bdb8[_0xe6d5('0x57')][_0xe6d5('0x87')]===_0x15befb[_0xe6d5('0x88')]){return _0x15befb[_0xe6d5('0x35')]({'read':!![]});}else{logger[_0xe6d5('0x23')](_0xe6d5('0x89'),_0xe6d5('0x2a'),_0xe6d5('0x86'),util['inspect'](_0x34bdb8[_0xe6d5('0x57')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x34bdb8[_0xe6d5('0x57')][_0xe6d5('0x8a')]&&_0x34bdb8[_0xe6d5('0x57')][_0xe6d5('0x8a')]===_0x15befb[_0xe6d5('0x88')]&&_['indexOf']([_0xe6d5('0x8b'),_0xe6d5('0x8c')],_0x34bdb8[_0xe6d5('0x57')][_0xe6d5('0x8d')])>=0x0){return _0x15befb[_0xe6d5('0x35')]({'read':!![]});}else{logger[_0xe6d5('0x23')](_0xe6d5('0x89'),_0xe6d5('0x2a'),_0xe6d5('0x8e'),util[_0xe6d5('0x8f')](_0x34bdb8[_0xe6d5('0x57')],{'showHidden':![],'depth':null}));}break;case _0xe6d5('0x90'):var _0x18e42a=_0x34bdb8[_0xe6d5('0x57')]['results'][0x0];if(_0x18e42a[_0xe6d5('0x2a')][_0xe6d5('0x91')]==='DELIVERED'){return _0x15befb[_0xe6d5('0x35')]({'read':!![]});}else{logger[_0xe6d5('0x23')](_0xe6d5('0x89'),_0xe6d5('0x2a'),_0xe6d5('0x90'),util[_0xe6d5('0x8f')](_0x34bdb8[_0xe6d5('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x15befb;}})[_0xe6d5('0x36')](respondWithResult(_0x454e60,null))['catch'](handleError(_0x454e60,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 9d72f65..190d4c5 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 _0x7b69=['../../mysqldb','SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0xaada43,_0x2a7219){var _0x40ba33=function(_0x340859){while(--_0x340859){_0xaada43['push'](_0xaada43['shift']());}};_0x40ba33(++_0x2a7219);}(_0x7b69,0x17b));var _0x97b6=function(_0x200622,_0x2f7bdf){_0x200622=_0x200622-0x0;var _0x509647=_0x7b69[_0x200622];return _0x509647;};'use strict';var EventEmitter=require(_0x97b6('0x0'));var SmsMessage=require(_0x97b6('0x1'))['db'][_0x97b6('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x97b6('0x3')](0x0);var events={'afterCreate':_0x97b6('0x4'),'afterUpdate':_0x97b6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x510220){return function(_0x1ef30d,_0x3a0c0f,_0x1d299d){SmsMessageEvents[_0x97b6('0x6')](_0x510220+':'+_0x1ef30d['id'],_0x1ef30d);SmsMessageEvents[_0x97b6('0x6')](_0x510220,_0x1ef30d);_0x1d299d(null);};}for(var e in events){if(events[_0x97b6('0x7')](e)){var event=events[e];SmsMessage[_0x97b6('0x8')](e,emitEvent(event));}}module[_0x97b6('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x9454=['events','SmsMessage','setMaxListeners','save','update','remove','emit'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9454,0xa8));var _0x4945=function(_0x287257,_0x5398cb){_0x287257=_0x287257-0x0;var _0x5660ca=_0x9454[_0x287257];return _0x5660ca;};'use strict';var EventEmitter=require(_0x4945('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x4945('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4945('0x2')](0x0);var events={'afterCreate':_0x4945('0x3'),'afterUpdate':_0x4945('0x4'),'afterDestroy':_0x4945('0x5')};function emitEvent(_0xfeab52){return function(_0x1be229,_0x1c4da4,_0x35dca4){SmsMessageEvents[_0x4945('0x6')](_0xfeab52+':'+_0x1be229['id'],_0x1be229);SmsMessageEvents['emit'](_0xfeab52,_0x1be229);_0x35dca4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](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 2a0f3d3..6e06a05 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 _0x7fb8=['session_key','total_sent','internal_order_id','deliveryReport','read','inspect','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','message_id','clickSend','plivo','authId','/api/sms/messages/','token','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','login','text','timestamp','keys','sort','length','apiKey','md5','digest','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','uuid','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','createdAt','catch','error','SmsAccount','find','then','type','twilio','authToken','accountSid','messages','create','phone','remote','/status?token=','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','sms','user_key'];(function(_0x5be6e6,_0x5eb129){var _0xe2b850=function(_0x2fca20){while(--_0x2fca20){_0x5be6e6['push'](_0x5be6e6['shift']());}};_0xe2b850(++_0x5eb129);}(_0x7fb8,0x146));var _0x87fb=function(_0x1b9d79,_0x440b03){_0x1b9d79=_0x1b9d79-0x0;var _0x156fca=_0x7fb8[_0x1b9d79];return _0x156fca;};'use strict';var _=require('lodash');var util=require(_0x87fb('0x0'));var logger=require(_0x87fb('0x1'))(_0x87fb('0x2'));var moment=require(_0x87fb('0x3'));var BPromise=require(_0x87fb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87fb('0x5'));var rimraf=require(_0x87fb('0x6'));var config=require(_0x87fb('0x7'));var attributes=require(_0x87fb('0x8'));module[_0x87fb('0x9')]=function(_0x2f9e08,_0x4ee26f){return _0x2f9e08['define'](_0x87fb('0xa'),attributes,{'tableName':_0x87fb('0xb'),'paranoid':![],'indexes':[{'name':_0x87fb('0xc'),'fields':[_0x87fb('0xc')]},{'name':_0x87fb('0xd'),'fields':[_0x87fb('0xe')],'type':_0x87fb('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x21686d,_0x2047aa,_0x1267a1){var _0xa081d3=_0x2f9e08[_0x87fb('0x10')];var _0x4e2b4b=_0x21686d[_0x87fb('0x11')]({'plain':!![]});if(_0x4e2b4b[_0x87fb('0x12')][_0x87fb('0x13')]()==='in'||_0x4e2b4b[_0x87fb('0x12')][_0x87fb('0x13')]()===_0x87fb('0x14')&&!_0x4e2b4b[_0x87fb('0x15')]&&!_[_0x87fb('0x16')](_0x4e2b4b[_0x87fb('0x17')])&&!_[_0x87fb('0x16')](_0x4e2b4b[_0x87fb('0x18')])){_0xa081d3[_0x87fb('0x19')][_0x87fb('0x1a')]({'where':{'id':_0x4e2b4b[_0x87fb('0x18')]}})['then'](function(_0x84580b){if(_0x84580b){_0x84580b['update']({'lastMsgAt':_0x4e2b4b[_0x87fb('0x1b')],'lastMsgDirection':_0x4e2b4b[_0x87fb('0x12')][_0x87fb('0x13')]()});}})[_0x87fb('0x1c')](function(_0x10e8c1){console[_0x87fb('0x1d')](_0x10e8c1);});}if(_0x4e2b4b[_0x87fb('0x12')]==='out'&&!_0x4e2b4b['secret']){var _0x53236b;_0xa081d3[_0x87fb('0x1e')][_0x87fb('0x1f')]({'where':{'id':_0x4e2b4b['SmsAccountId']},'raw':!![]})[_0x87fb('0x20')](function(_0x1a446a){_0x53236b=_0x1a446a;if(_0x53236b&&_0x53236b['type']){switch(_0x53236b[_0x87fb('0x21')]){case _0x87fb('0x22'):var _0x3280ec=require(_0x87fb('0x22'));if(_0x53236b['accountSid']&&_0x53236b[_0x87fb('0x23')]&&_0x53236b['phone']){var _0x2ce543=new _0x3280ec(_0x53236b[_0x87fb('0x24')],_0x53236b[_0x87fb('0x23')]);_0x2ce543[_0x87fb('0x25')][_0x87fb('0x26')]({'body':_0x4e2b4b[_0x87fb('0xe')],'to':_0x4e2b4b['phone'],'from':_0x53236b[_0x87fb('0x27')],'statusCallback':_0x53236b[_0x87fb('0x28')]+'/api/sms/messages/'+_0x4e2b4b['id']+_0x87fb('0x29')+_0x53236b['token']})[_0x87fb('0x20')](function(_0x67e681){if(_0x67e681[_0x87fb('0x2a')]){return _0x21686d[_0x87fb('0x2b')]({'messageId':_0x67e681[_0x87fb('0x2a')]});}})['catch'](function(_0xb174f8){logger[_0x87fb('0x1d')](_0x87fb('0x2c'),_0x87fb('0x2d'),_0x87fb('0x22'),util['inspect'](_0xb174f8,{'showHidden':![],'depth':null}));});}else{logger[_0x87fb('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x87fb('0x2d'),'twilio',_0x87fb('0x2e'));}break;case _0x87fb('0x2f'):var _0x4c9d92=_0x87fb('0x30');if(_0x53236b[_0x87fb('0x31')]&&_0x53236b[_0x87fb('0x32')]){var _0xe3dd32={'recipient':[_0x4e2b4b['phone']],'message':_0x4e2b4b[_0x87fb('0xe')],'message_type':_0x53236b['smsMethod']};if(_0x53236b[_0x87fb('0x33')]&&_0x53236b[_0x87fb('0x33')]!=='SI'){_0xe3dd32[_0x87fb('0x34')]=_0x53236b['phone'];}var _0x18c5b0={'url':_0x4c9d92+'login?username='+_0x53236b[_0x87fb('0x31')]+_0x87fb('0x35')+_0x53236b[_0x87fb('0x32')],'method':_0x87fb('0x36')};rp(_0x18c5b0)[_0x87fb('0x20')](function(_0x1e5278){var _0x533610=_0x1e5278[_0x87fb('0x37')](';');var _0x3dff2a={'user_key':_0x533610[0x0],'session_key':_0x533610[0x1]};_0x18c5b0={'url':_0x4c9d92+_0x87fb('0x38'),'method':'POST','headers':{'user_key':_0x3dff2a[_0x87fb('0x39')],'Session_key':_0x3dff2a[_0x87fb('0x3a')]},'json':!![],'body':_0xe3dd32};return rp(_0x18c5b0);})[_0x87fb('0x20')](function(_0x112478){if(_0x112478[_0x87fb('0x3b')]>=0x1){var _0x4ec782={'messageId':_0x112478[_0x87fb('0x3c')]};if(_0x53236b[_0x87fb('0x33')]!=='GP'||!_0x53236b[_0x87fb('0x3d')]){_0x4ec782[_0x87fb('0x3e')]=!![];}return _0x21686d['update'](_0x4ec782);}else{return logger[_0x87fb('0x1d')](_0x87fb('0x2c'),_0x87fb('0x2d'),'skebby',util['inspect'](_0x112478,{'showHidden':![],'depth':null}));}})[_0x87fb('0x1c')](function(_0x4fe71a){return logger[_0x87fb('0x1d')](_0x87fb('0x2c'),'afterCreate',_0x87fb('0x2f'),util[_0x87fb('0x3f')](_0x4fe71a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x87fb('0x2c'),'afterCreate',_0x87fb('0x2f'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x53236b[_0x87fb('0x23')]){var _0x1d3c08={'recipient':_0x4e2b4b['phone'],'message':_0x4e2b4b[_0x87fb('0xe')],'sender':_0x53236b[_0x87fb('0x40')]||_0x53236b[_0x87fb('0x27')],'authorization':_0x53236b[_0x87fb('0x23')]};var _0x2047aa={'method':_0x87fb('0x41'),'uri':_0x87fb('0x42'),'body':_0x1d3c08,'json':!![]};rp(_0x2047aa)['then'](function(_0x1c2429){var _0x55235a={'messageId':_0x1c2429[_0x87fb('0x43')]};if(!_0x53236b[_0x87fb('0x3d')]){_0x55235a[_0x87fb('0x3e')]=!![];}return _0x21686d[_0x87fb('0x2b')](_0x55235a);})[_0x87fb('0x1c')](function(_0xae2ef3){logger[_0x87fb('0x1d')](_0x87fb('0x2c'),'afterCreate',_0x87fb('0x44'),util[_0x87fb('0x3f')](_0xae2ef3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x87fb('0x2c'),_0x87fb('0x2d'),_0x87fb('0x44'),_0x87fb('0x45'));}break;case _0x87fb('0x46'):if(_0x53236b[_0x87fb('0x31')]&&_0x53236b[_0x87fb('0x32')]){var _0x1d3c08={'messages':[{'source':'xCALLY\x20Motion','to':_0x4e2b4b['phone'],'body':_0x4e2b4b[_0x87fb('0xe')],'from':_0x53236b[_0x87fb('0x40')]||_0x53236b[_0x87fb('0x27')]}]};var _0x25a1ae=util[_0x87fb('0x47')](_0x87fb('0x48'),_0x53236b['username'],_0x53236b['password']);var _0x2047aa={'method':_0x87fb('0x41'),'uri':_0x87fb('0x49'),'body':_0x1d3c08,'headers':{'Authorization':util[_0x87fb('0x47')](_0x87fb('0x4a'),new Buffer(_0x25a1ae)['toString'](_0x87fb('0x4b')))},'json':!![]};rp(_0x2047aa)[_0x87fb('0x20')](function(_0x5bc5f0){if(_0x5bc5f0['http_code']>=0xc8&&_0x5bc5f0[_0x87fb('0x4c')]<=0xce){if(_0x5bc5f0[_0x87fb('0x4d')]&&_0x5bc5f0[_0x87fb('0x4d')][_0x87fb('0x4e')]>0x0){var _0x4ae099=_['head'](_0x5bc5f0[_0x87fb('0x4d')][_0x87fb('0x25')]);var _0x3d7b98={'messageId':_0x4ae099[_0x87fb('0x4f')]};if(!_0x53236b[_0x87fb('0x3d')]){_0x3d7b98[_0x87fb('0x3e')]=!![];}return _0x21686d[_0x87fb('0x2b')](_0x3d7b98);}else{logger[_0x87fb('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x87fb('0x2d'),_0x87fb('0x50'),util[_0x87fb('0x3f')](_0x5bc5f0,{'showHidden':![],'depth':null}));}}else{logger[_0x87fb('0x1d')](_0x87fb('0x2c'),_0x87fb('0x2d'),_0x87fb('0x50'),util[_0x87fb('0x3f')](_0x5bc5f0,{'showHidden':![],'depth':null}));}})[_0x87fb('0x1c')](function(_0x427170){logger[_0x87fb('0x1d')](_0x87fb('0x2c'),_0x87fb('0x2d'),_0x87fb('0x50'),util[_0x87fb('0x3f')](_0x427170,{'showHidden':![],'depth':null}));});}else{logger[_0x87fb('0x1d')](_0x87fb('0x2c'),_0x87fb('0x2d'),_0x87fb('0x50'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x87fb('0x51'):if(_0x53236b[_0x87fb('0x52')]&&_0x53236b[_0x87fb('0x23')]){var _0x1d3c08={'dst':_0x4e2b4b[_0x87fb('0x27')],'text':_0x4e2b4b[_0x87fb('0xe')],'src':_0x53236b[_0x87fb('0x40')]||_0x53236b[_0x87fb('0x27')],'url':_0x53236b[_0x87fb('0x28')]+_0x87fb('0x53')+_0x4e2b4b['id']+_0x87fb('0x29')+_0x53236b[_0x87fb('0x54')]};var _0x25a1ae=util[_0x87fb('0x47')]('%s:%s',_0x53236b[_0x87fb('0x52')],_0x53236b['authToken']);var _0x2047aa={'method':_0x87fb('0x41'),'uri':util['format'](_0x87fb('0x55'),_0x53236b[_0x87fb('0x52')]),'body':_0x1d3c08,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x25a1ae)[_0x87fb('0x56')]('base64'))},'json':!![]};rp(_0x2047aa)[_0x87fb('0x20')](function(_0x134a9c){var _0x1703b2={'messageId':_0x134a9c[_0x87fb('0x57')][0x0]};return _0x21686d['update'](_0x1703b2);})[_0x87fb('0x1c')](function(_0x48161d){logger[_0x87fb('0x1d')](_0x87fb('0x2c'),_0x87fb('0x2d'),_0x87fb('0x51'),util['inspect'](_0x48161d,{'showHidden':![],'depth':null}));});}else{logger[_0x87fb('0x1d')](_0x87fb('0x2c'),_0x87fb('0x2d'),_0x87fb('0x51'),_0x87fb('0x58'));}break;case _0x87fb('0x59'):if(_0x53236b[_0x87fb('0x31')]&&_0x53236b[_0x87fb('0x32')]){if(_0x53236b[_0x87fb('0x5a')]){var _0x9ebe0a={'method':_0x87fb('0x41'),'uri':_0x53236b[_0x87fb('0x5a')]+_0x87fb('0x5b'),'body':{'username':_0x53236b[_0x87fb('0x31')],'password':_0x53236b['password']},'json':!![]};return rp(_0x9ebe0a)['then'](function(_0x564122){var _0x5b2df2={'method':_0x87fb('0x41'),'uri':_0x53236b[_0x87fb('0x5a')]+_0x87fb('0x5c'),'body':{'messages':[{'from':_0x53236b[_0x87fb('0x27')],'destinations':[{'to':_0x4e2b4b['phone']}],'text':_0x4e2b4b['body'],'notifyUrl':_0x53236b[_0x87fb('0x28')]+_0x87fb('0x53')+_0x4e2b4b['id']+_0x87fb('0x29')+_0x53236b[_0x87fb('0x54')],'notifyContentType':_0x87fb('0x5d'),'callbackData':_0x53236b[_0x87fb('0x27')]+';'+_0x4e2b4b[_0x87fb('0xe')]}]},'headers':{'Authorization':_0x87fb('0x5e')+_0x564122['token']},'json':!![]};return rp(_0x5b2df2)[_0x87fb('0x20')](function(_0x37966d){if(_0x37966d[_0x87fb('0x25')]){var _0x29b330={'messageId':_0x37966d[_0x87fb('0x25')][0x0]['messageId']};if(!_0x53236b[_0x87fb('0x3d')]){_0x29b330[_0x87fb('0x3e')]=!![];}return _0x21686d[_0x87fb('0x2b')](_0x29b330);}else{return logger[_0x87fb('0x1d')](_0x87fb('0x2c'),'afterCreate',_0x87fb('0x59'),util[_0x87fb('0x3f')](_0x37966d,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x48dc8f){return logger[_0x87fb('0x1d')](_0x87fb('0x2c'),_0x87fb('0x2d'),_0x87fb('0x59'),util[_0x87fb('0x3f')](_0x48dc8f,{'showHidden':![],'depth':null}));});}else{logger[_0x87fb('0x1d')](_0x87fb('0x2c'),_0x87fb('0x2d'),_0x87fb('0x59'),_0x87fb('0x5f'));}}else{logger[_0x87fb('0x1d')](_0x87fb('0x2c'),'afterCreate',_0x87fb('0x59'),_0x87fb('0x60'));}break;case _0x87fb('0x61'):var _0x1f981c=require('crypto');if(_0x53236b['apiKey']){var _0x2ca889={};_0x2ca889[_0x87fb('0x62')]=_0x53236b['username'];_0x2ca889[_0x87fb('0x27')]=_0x4e2b4b[_0x87fb('0x27')];_0x2ca889[_0x87fb('0x34')]=_0x53236b['phone'];_0x2ca889[_0x87fb('0x63')]=_0x4e2b4b[_0x87fb('0xe')];_0x2ca889[_0x87fb('0x64')]=+new Date();var _0x39618e='';var _0x5dd5dd='';var _0x130619=Object[_0x87fb('0x65')](_0x2ca889);_0x130619[_0x87fb('0x66')]();for(var _0x57d74e=0x0;_0x57d74e<_0x130619[_0x87fb('0x67')];_0x57d74e++){if(_0x39618e!=''){_0x39618e+='&';}_0x39618e+=_0x130619[_0x57d74e]+'='+encodeURIComponent(_0x2ca889[_0x130619[_0x57d74e]]);_0x5dd5dd+=_0x2ca889[_0x130619[_0x57d74e]];}_0x5dd5dd+=_0x53236b[_0x87fb('0x68')];_0x5dd5dd=_0x1f981c['createHash'](_0x87fb('0x69'))[_0x87fb('0x2b')](_0x5dd5dd)[_0x87fb('0x6a')](_0x87fb('0x6b'));if(_0x39618e!==''){_0x39618e+='&';}_0x39618e+=_0x87fb('0x6c')+_0x5dd5dd;var _0x18c5b0={'method':_0x87fb('0x36'),'uri':_0x53236b[_0x87fb('0x5a')]+_0x87fb('0x6d')+_0x39618e,'json':!![]};return rp(_0x18c5b0)[_0x87fb('0x20')](function(_0x1a257d){var _0x238c0e=Object[_0x87fb('0x65')](_0x1a257d);if(_0x1a257d[_0x238c0e[0x0]]['error']&&parseInt(_0x1a257d[_0x238c0e[0x0]]['error'])===0x0){var _0x3f330e={'messageId':_0x1a257d[_0x238c0e[0x0]]['id_sms']};if(!_0x53236b[_0x87fb('0x3d')]){_0x3f330e[_0x87fb('0x3e')]=!![];}return _0x21686d[_0x87fb('0x2b')](_0x3f330e);}else{return logger[_0x87fb('0x1d')](_0x87fb('0x2c'),_0x87fb('0x2d'),'csc',util[_0x87fb('0x3f')](_0x1a257d['error'],{'showHidden':![],'depth':null}));}})[_0x87fb('0x1c')](function(_0xee1c){return logger[_0x87fb('0x1d')](_0x87fb('0x2c'),_0x87fb('0x2d'),'csc',util[_0x87fb('0x3f')](_0xee1c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x87fb('0x2c'),'afterCreate',_0x87fb('0x61'),_0x87fb('0x6e'));}break;case'clickatell':if(_0x53236b[_0x87fb('0x68')]){var _0x3b7bbf={'method':_0x87fb('0x41'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x53236b[_0x87fb('0x68')]},'body':{'content':_0x4e2b4b[_0x87fb('0xe')],'to':[_0x4e2b4b[_0x87fb('0x27')]],'from':_0x53236b['phone'],'binary':![],'clientMessageId':_0x87fb('0x6f'),'charset':'UTF-8'},'json':!![]};rp(_0x3b7bbf)[_0x87fb('0x20')](function(_0x35dc58){if(!_0x35dc58[_0x87fb('0x1d')]){var _0x50a6b7={'messageId':_0x35dc58['messages'][0x0]['apiMessageId']};if(!_0x53236b[_0x87fb('0x3d')]){_0x50a6b7[_0x87fb('0x3e')]=!![];}return _0x21686d[_0x87fb('0x2b')](_0x50a6b7);}else{return logger[_0x87fb('0x1d')](_0x87fb('0x2c'),_0x87fb('0x2d'),_0x87fb('0x70'),util[_0x87fb('0x3f')](_0x35dc58[_0x87fb('0x1d')],{'showHidden':![],'depth':null}));}})[_0x87fb('0x1c')](function(_0x1be0b6){return logger[_0x87fb('0x1d')](_0x87fb('0x2c'),_0x87fb('0x2d'),'clickatell',util['inspect'](_0x1be0b6,{'showHidden':![],'depth':null}));});}else{logger[_0x87fb('0x1d')](_0x87fb('0x2c'),_0x87fb('0x2d'),_0x87fb('0x70'),_0x87fb('0x6e'));}break;case _0x87fb('0x71'):if(_0x53236b['username']&&_0x53236b[_0x87fb('0x32')]){var _0x25a1ae=util[_0x87fb('0x47')](_0x87fb('0x48'),_0x53236b[_0x87fb('0x31')],_0x53236b['password']);var _0x2047aa={'method':'POST','uri':_0x87fb('0x72')+_0x53236b[_0x87fb('0x73')]+_0x87fb('0x74'),'body':{'to':[_0x4e2b4b[_0x87fb('0x27')]],'text':_0x4e2b4b['body'],'from':_0x53236b[_0x87fb('0x27')],'applicationId':_0x53236b['applicationId']},'headers':{'Authorization':util[_0x87fb('0x47')](_0x87fb('0x4a'),new Buffer(_0x25a1ae)[_0x87fb('0x56')](_0x87fb('0x4b')))},'json':!![]};rp(_0x2047aa)['then'](function(_0x25f60e){if(_0x25f60e['id']){var _0x115a4a={'messageId':_0x25f60e['id']};return _0x21686d[_0x87fb('0x2b')](_0x115a4a);}else{logger[_0x87fb('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x87fb('0x2d'),_0x87fb('0x71'),util[_0x87fb('0x3f')](_0x25f60e,{'showHidden':![],'depth':null}));}})[_0x87fb('0x1c')](function(_0x191143){logger[_0x87fb('0x1d')](_0x87fb('0x2c'),_0x87fb('0x2d'),_0x87fb('0x71'),util[_0x87fb('0x3f')](_0x191143,{'showHidden':![],'depth':null}));});}else{logger[_0x87fb('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x87fb('0x2d'),_0x87fb('0x71'),_0x87fb('0x60'));}break;case _0x87fb('0x75'):if(_0x53236b[_0x87fb('0x68')]){var _0x8a112a={};var _0x18c5b0={'method':_0x87fb('0x41'),'uri':_0x87fb('0x76'),'headers':{'Authorization':_0x87fb('0x77')+_0x53236b['apiKey'],'Content-Type':_0x87fb('0x5d')},'body':{'from':_0x53236b['phone'],'to':_0x4e2b4b[_0x87fb('0x27')],'text':_0x4e2b4b[_0x87fb('0xe')]},'json':!![]};return rp(_0x18c5b0)[_0x87fb('0x20')](function(_0x4bbd1f){if(_0x4bbd1f[_0x87fb('0x78')]==0xca){_0x8a112a[_0x87fb('0x79')]=_0x4bbd1f;var _0x14f4be={'method':'POST','uri':_0x87fb('0x7a'),'headers':{'Authorization':_0x87fb('0x77')+_0x53236b[_0x87fb('0x68')],'Content-Type':_0x87fb('0x5d')},'body':{'refid':_0x8a112a['message']['refid']},'json':!![]};return rp(_0x14f4be)[_0x87fb('0x20')](function(_0x3b1d78){_0x8a112a[_0x87fb('0x7b')]=_0x3b1d78;var _0x356980={'messageId':_0x8a112a[_0x87fb('0x79')]['refid'],'read':!![]};return _0x21686d[_0x87fb('0x2b')](_0x356980);});}else{return logger[_0x87fb('0x1d')](_0x87fb('0x2c'),'afterCreate',_0x87fb('0x75'),util[_0x87fb('0x3f')](_0x4bbd1f,{'showHidden':![],'depth':null}));}})[_0x87fb('0x1c')](function(_0x154fac){return logger[_0x87fb('0x1d')](_0x87fb('0x2c'),_0x87fb('0x2d'),_0x87fb('0x75'),util['inspect'](_0x154fac,{'showHidden':![],'depth':null}));});}else{return logger[_0x87fb('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x87fb('0x2d'),'intelepeer',_0x87fb('0x7c'));}break;}}})[_0x87fb('0x7d')](function(){_0x1267a1();});}else{_0x1267a1();}}},'charset':_0x87fb('0x7e'),'collate':_0x87fb('0x7f')});}; \ No newline at end of file +var _0x8aaa=['deliveryReport','read','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','head','message_id','clickSend','plivo','authId','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','text','timestamp','keys','sort','createHash','hex','signature=','/external/get/send.php?','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','find','SmsAccountId','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','GET','split','sms','POST','session_key','total_sent'];(function(_0x5e3cbd,_0x2fd5cd){var _0x1ed1ce=function(_0x4bae94){while(--_0x4bae94){_0x5e3cbd['push'](_0x5e3cbd['shift']());}};_0x1ed1ce(++_0x2fd5cd);}(_0x8aaa,0x1ae));var _0xa8aa=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0x8aaa[_0x381379];return _0x3e1063;};'use strict';var _=require(_0xa8aa('0x0'));var util=require(_0xa8aa('0x1'));var logger=require(_0xa8aa('0x2'))('api');var moment=require(_0xa8aa('0x3'));var BPromise=require(_0xa8aa('0x4'));var rp=require(_0xa8aa('0x5'));var fs=require('fs');var path=require(_0xa8aa('0x6'));var rimraf=require(_0xa8aa('0x7'));var config=require(_0xa8aa('0x8'));var attributes=require(_0xa8aa('0x9'));module[_0xa8aa('0xa')]=function(_0x1a37c4,_0x2c2e12){return _0x1a37c4[_0xa8aa('0xb')](_0xa8aa('0xc'),attributes,{'tableName':_0xa8aa('0xd'),'paranoid':![],'indexes':[{'name':_0xa8aa('0xe'),'fields':[_0xa8aa('0xe')]},{'name':'fti_sms_messages','fields':[_0xa8aa('0xf')],'type':_0xa8aa('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b7fca,_0x13c57e,_0x407499){var _0x454b97=_0x1a37c4[_0xa8aa('0x11')];var _0x11a209=_0x3b7fca[_0xa8aa('0x12')]({'plain':!![]});if(_0x11a209[_0xa8aa('0x13')][_0xa8aa('0x14')]()==='in'||_0x11a209[_0xa8aa('0x13')][_0xa8aa('0x14')]()===_0xa8aa('0x15')&&!_0x11a209[_0xa8aa('0x16')]&&!_['isNil'](_0x11a209[_0xa8aa('0x17')])&&!_['isNil'](_0x11a209[_0xa8aa('0x18')])){_0x454b97[_0xa8aa('0x19')][_0xa8aa('0x1a')]({'where':{'id':_0x11a209[_0xa8aa('0x18')]}})[_0xa8aa('0x1b')](function(_0x1f1733){if(_0x1f1733){_0x1f1733[_0xa8aa('0x1c')]({'lastMsgAt':_0x11a209[_0xa8aa('0x1d')],'lastMsgDirection':_0x11a209['direction'][_0xa8aa('0x14')]()});}})[_0xa8aa('0x1e')](function(_0x21e973){console[_0xa8aa('0x1f')](_0x21e973);});}if(_0x11a209[_0xa8aa('0x13')]===_0xa8aa('0x15')&&!_0x11a209['secret']){var _0x379452;_0x454b97['SmsAccount'][_0xa8aa('0x20')]({'where':{'id':_0x11a209[_0xa8aa('0x21')]},'raw':!![]})[_0xa8aa('0x1b')](function(_0x43cde6){_0x379452=_0x43cde6;if(_0x379452&&_0x379452['type']){switch(_0x379452['type']){case _0xa8aa('0x22'):var _0x1aeacb=require(_0xa8aa('0x22'));if(_0x379452[_0xa8aa('0x23')]&&_0x379452[_0xa8aa('0x24')]&&_0x379452[_0xa8aa('0x25')]){var _0x5e9e8d=new _0x1aeacb(_0x379452[_0xa8aa('0x23')],_0x379452['authToken']);_0x5e9e8d[_0xa8aa('0x26')]['create']({'body':_0x11a209['body'],'to':_0x11a209[_0xa8aa('0x25')],'from':_0x379452[_0xa8aa('0x25')],'statusCallback':_0x379452[_0xa8aa('0x27')]+_0xa8aa('0x28')+_0x11a209['id']+_0xa8aa('0x29')+_0x379452[_0xa8aa('0x2a')]})[_0xa8aa('0x1b')](function(_0x565944){if(_0x565944[_0xa8aa('0x2b')]){return _0x3b7fca[_0xa8aa('0x1c')]({'messageId':_0x565944[_0xa8aa('0x2b')]});}})['catch'](function(_0x417697){logger['error'](_0xa8aa('0x2c'),_0xa8aa('0x2d'),_0xa8aa('0x22'),util[_0xa8aa('0x2e')](_0x417697,{'showHidden':![],'depth':null}));});}else{logger[_0xa8aa('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa8aa('0x2d'),_0xa8aa('0x22'),_0xa8aa('0x2f'));}break;case _0xa8aa('0x30'):var _0x5cb0f8=_0xa8aa('0x31');if(_0x379452[_0xa8aa('0x32')]&&_0x379452['password']){var _0x169b56={'recipient':[_0x11a209[_0xa8aa('0x25')]],'message':_0x11a209[_0xa8aa('0xf')],'message_type':_0x379452[_0xa8aa('0x33')]};if(_0x379452[_0xa8aa('0x33')]&&_0x379452['smsMethod']!=='SI'){_0x169b56[_0xa8aa('0x34')]=_0x379452[_0xa8aa('0x25')];}var _0xe34470={'url':_0x5cb0f8+_0xa8aa('0x35')+_0x379452[_0xa8aa('0x32')]+_0xa8aa('0x36')+_0x379452[_0xa8aa('0x37')],'method':_0xa8aa('0x38')};rp(_0xe34470)['then'](function(_0x5f2ef8){var _0x451645=_0x5f2ef8[_0xa8aa('0x39')](';');var _0x320ad5={'user_key':_0x451645[0x0],'session_key':_0x451645[0x1]};_0xe34470={'url':_0x5cb0f8+_0xa8aa('0x3a'),'method':_0xa8aa('0x3b'),'headers':{'user_key':_0x320ad5['user_key'],'Session_key':_0x320ad5[_0xa8aa('0x3c')]},'json':!![],'body':_0x169b56};return rp(_0xe34470);})[_0xa8aa('0x1b')](function(_0x326766){if(_0x326766[_0xa8aa('0x3d')]>=0x1){var _0x1444cd={'messageId':_0x326766['internal_order_id']};if(_0x379452[_0xa8aa('0x33')]!=='GP'||!_0x379452[_0xa8aa('0x3e')]){_0x1444cd[_0xa8aa('0x3f')]=!![];}return _0x3b7fca[_0xa8aa('0x1c')](_0x1444cd);}else{return logger[_0xa8aa('0x1f')](_0xa8aa('0x2c'),'afterCreate',_0xa8aa('0x30'),util[_0xa8aa('0x2e')](_0x326766,{'showHidden':![],'depth':null}));}})[_0xa8aa('0x1e')](function(_0x61dd25){return logger[_0xa8aa('0x1f')](_0xa8aa('0x2c'),'afterCreate','skebby',util[_0xa8aa('0x2e')](_0x61dd25,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa8aa('0x2d'),'skebby',_0xa8aa('0x40'));}break;case'connectel':if(_0x379452[_0xa8aa('0x24')]){var _0x2c11ae={'recipient':_0x11a209[_0xa8aa('0x25')],'message':_0x11a209[_0xa8aa('0xf')],'sender':_0x379452[_0xa8aa('0x41')]||_0x379452[_0xa8aa('0x25')],'authorization':_0x379452[_0xa8aa('0x24')]};var _0x13c57e={'method':'POST','uri':_0xa8aa('0x42'),'body':_0x2c11ae,'json':!![]};rp(_0x13c57e)[_0xa8aa('0x1b')](function(_0x3841c5){var _0x56f14d={'messageId':_0x3841c5[_0xa8aa('0x43')]};if(!_0x379452[_0xa8aa('0x3e')]){_0x56f14d['read']=!![];}return _0x3b7fca[_0xa8aa('0x1c')](_0x56f14d);})[_0xa8aa('0x1e')](function(_0x10af49){logger[_0xa8aa('0x1f')](_0xa8aa('0x2c'),'afterCreate',_0xa8aa('0x44'),util['inspect'](_0x10af49,{'showHidden':![],'depth':null}));});}else{logger[_0xa8aa('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa8aa('0x2d'),_0xa8aa('0x44'),_0xa8aa('0x45'));}break;case _0xa8aa('0x46'):if(_0x379452[_0xa8aa('0x32')]&&_0x379452['password']){var _0x2c11ae={'messages':[{'source':_0xa8aa('0x47'),'to':_0x11a209[_0xa8aa('0x25')],'body':_0x11a209['body'],'from':_0x379452[_0xa8aa('0x41')]||_0x379452['phone']}]};var _0x1e3bee=util[_0xa8aa('0x48')](_0xa8aa('0x49'),_0x379452[_0xa8aa('0x32')],_0x379452[_0xa8aa('0x37')]);var _0x13c57e={'method':_0xa8aa('0x3b'),'uri':_0xa8aa('0x4a'),'body':_0x2c11ae,'headers':{'Authorization':util[_0xa8aa('0x48')](_0xa8aa('0x4b'),new Buffer(_0x1e3bee)[_0xa8aa('0x4c')]('base64'))},'json':!![]};rp(_0x13c57e)['then'](function(_0x190452){if(_0x190452[_0xa8aa('0x4d')]>=0xc8&&_0x190452['http_code']<=0xce){if(_0x190452[_0xa8aa('0x4e')]&&_0x190452[_0xa8aa('0x4e')]['queued_count']>0x0){var _0x3bcad7=_[_0xa8aa('0x4f')](_0x190452[_0xa8aa('0x4e')][_0xa8aa('0x26')]);var _0x4ed630={'messageId':_0x3bcad7[_0xa8aa('0x50')]};if(!_0x379452[_0xa8aa('0x3e')]){_0x4ed630['read']=!![];}return _0x3b7fca[_0xa8aa('0x1c')](_0x4ed630);}else{logger[_0xa8aa('0x1f')](_0xa8aa('0x2c'),_0xa8aa('0x2d'),_0xa8aa('0x51'),util[_0xa8aa('0x2e')](_0x190452,{'showHidden':![],'depth':null}));}}else{logger[_0xa8aa('0x1f')](_0xa8aa('0x2c'),_0xa8aa('0x2d'),_0xa8aa('0x51'),util[_0xa8aa('0x2e')](_0x190452,{'showHidden':![],'depth':null}));}})[_0xa8aa('0x1e')](function(_0x5aa287){logger['error'](_0xa8aa('0x2c'),'afterCreate',_0xa8aa('0x51'),util[_0xa8aa('0x2e')](_0x5aa287,{'showHidden':![],'depth':null}));});}else{logger[_0xa8aa('0x1f')](_0xa8aa('0x2c'),_0xa8aa('0x2d'),_0xa8aa('0x51'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xa8aa('0x52'):if(_0x379452[_0xa8aa('0x53')]&&_0x379452[_0xa8aa('0x24')]){var _0x2c11ae={'dst':_0x11a209['phone'],'text':_0x11a209[_0xa8aa('0xf')],'src':_0x379452[_0xa8aa('0x41')]||_0x379452[_0xa8aa('0x25')],'url':_0x379452[_0xa8aa('0x27')]+_0xa8aa('0x28')+_0x11a209['id']+_0xa8aa('0x29')+_0x379452[_0xa8aa('0x2a')]};var _0x1e3bee=util['format'](_0xa8aa('0x49'),_0x379452[_0xa8aa('0x53')],_0x379452[_0xa8aa('0x24')]);var _0x13c57e={'method':_0xa8aa('0x3b'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x379452[_0xa8aa('0x53')]),'body':_0x2c11ae,'headers':{'Authorization':util[_0xa8aa('0x48')](_0xa8aa('0x4b'),new Buffer(_0x1e3bee)[_0xa8aa('0x4c')](_0xa8aa('0x54')))},'json':!![]};rp(_0x13c57e)[_0xa8aa('0x1b')](function(_0x328a17){var _0x483a6c={'messageId':_0x328a17[_0xa8aa('0x55')][0x0]};return _0x3b7fca[_0xa8aa('0x1c')](_0x483a6c);})[_0xa8aa('0x1e')](function(_0x131bff){logger[_0xa8aa('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa8aa('0x52'),util[_0xa8aa('0x2e')](_0x131bff,{'showHidden':![],'depth':null}));});}else{logger[_0xa8aa('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa8aa('0x2d'),_0xa8aa('0x52'),_0xa8aa('0x56'));}break;case _0xa8aa('0x57'):if(_0x379452[_0xa8aa('0x32')]&&_0x379452[_0xa8aa('0x37')]){if(_0x379452[_0xa8aa('0x58')]){var _0x59bd27={'method':_0xa8aa('0x3b'),'uri':_0x379452[_0xa8aa('0x58')]+_0xa8aa('0x59'),'body':{'username':_0x379452[_0xa8aa('0x32')],'password':_0x379452[_0xa8aa('0x37')]},'json':!![]};return rp(_0x59bd27)[_0xa8aa('0x1b')](function(_0x1b1c40){var _0x18a568={'method':_0xa8aa('0x3b'),'uri':_0x379452[_0xa8aa('0x58')]+_0xa8aa('0x5a'),'body':{'messages':[{'from':_0x379452[_0xa8aa('0x25')],'destinations':[{'to':_0x11a209[_0xa8aa('0x25')]}],'text':_0x11a209[_0xa8aa('0xf')],'notifyUrl':_0x379452[_0xa8aa('0x27')]+'/api/sms/messages/'+_0x11a209['id']+'/status?token='+_0x379452['token'],'notifyContentType':'application/json','callbackData':_0x379452[_0xa8aa('0x25')]+';'+_0x11a209['body']}]},'headers':{'Authorization':_0xa8aa('0x5b')+_0x1b1c40[_0xa8aa('0x2a')]},'json':!![]};return rp(_0x18a568)['then'](function(_0x215b6d){if(_0x215b6d['messages']){var _0x3b0c76={'messageId':_0x215b6d[_0xa8aa('0x26')][0x0]['messageId']};if(!_0x379452['deliveryReport']){_0x3b0c76[_0xa8aa('0x3f')]=!![];}return _0x3b7fca[_0xa8aa('0x1c')](_0x3b0c76);}else{return logger[_0xa8aa('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa8aa('0x57'),util[_0xa8aa('0x2e')](_0x215b6d,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x36b8bc){return logger[_0xa8aa('0x1f')](_0xa8aa('0x2c'),_0xa8aa('0x2d'),_0xa8aa('0x57'),util[_0xa8aa('0x2e')](_0x36b8bc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa8aa('0x2c'),'afterCreate',_0xa8aa('0x57'),_0xa8aa('0x5c'));}}else{logger[_0xa8aa('0x1f')](_0xa8aa('0x2c'),_0xa8aa('0x2d'),_0xa8aa('0x57'),_0xa8aa('0x40'));}break;case _0xa8aa('0x5d'):var _0x2f6c8d=require('crypto');if(_0x379452[_0xa8aa('0x5e')]){var _0x102bd4={};_0x102bd4['login']=_0x379452[_0xa8aa('0x32')];_0x102bd4[_0xa8aa('0x25')]=_0x11a209[_0xa8aa('0x25')];_0x102bd4['sender']=_0x379452[_0xa8aa('0x25')];_0x102bd4[_0xa8aa('0x5f')]=_0x11a209[_0xa8aa('0xf')];_0x102bd4[_0xa8aa('0x60')]=+new Date();var _0x140005='';var _0x1a7e96='';var _0x3e44f0=Object[_0xa8aa('0x61')](_0x102bd4);_0x3e44f0[_0xa8aa('0x62')]();for(var _0x222bfc=0x0;_0x222bfc<_0x3e44f0['length'];_0x222bfc++){if(_0x140005!=''){_0x140005+='&';}_0x140005+=_0x3e44f0[_0x222bfc]+'='+encodeURIComponent(_0x102bd4[_0x3e44f0[_0x222bfc]]);_0x1a7e96+=_0x102bd4[_0x3e44f0[_0x222bfc]];}_0x1a7e96+=_0x379452[_0xa8aa('0x5e')];_0x1a7e96=_0x2f6c8d[_0xa8aa('0x63')]('md5')[_0xa8aa('0x1c')](_0x1a7e96)['digest'](_0xa8aa('0x64'));if(_0x140005!==''){_0x140005+='&';}_0x140005+=_0xa8aa('0x65')+_0x1a7e96;var _0xe34470={'method':_0xa8aa('0x38'),'uri':_0x379452[_0xa8aa('0x58')]+_0xa8aa('0x66')+_0x140005,'json':!![]};return rp(_0xe34470)['then'](function(_0x158319){var _0x473615=Object[_0xa8aa('0x61')](_0x158319);if(_0x158319[_0x473615[0x0]][_0xa8aa('0x1f')]&&parseInt(_0x158319[_0x473615[0x0]][_0xa8aa('0x1f')])===0x0){var _0x2d4b38={'messageId':_0x158319[_0x473615[0x0]]['id_sms']};if(!_0x379452[_0xa8aa('0x3e')]){_0x2d4b38[_0xa8aa('0x3f')]=!![];}return _0x3b7fca[_0xa8aa('0x1c')](_0x2d4b38);}else{return logger[_0xa8aa('0x1f')](_0xa8aa('0x2c'),'afterCreate',_0xa8aa('0x5d'),util['inspect'](_0x158319['error'],{'showHidden':![],'depth':null}));}})[_0xa8aa('0x1e')](function(_0x24f544){return logger[_0xa8aa('0x1f')](_0xa8aa('0x2c'),_0xa8aa('0x2d'),_0xa8aa('0x5d'),util['inspect'](_0x24f544,{'showHidden':![],'depth':null}));});}else{logger[_0xa8aa('0x1f')](_0xa8aa('0x2c'),_0xa8aa('0x2d'),_0xa8aa('0x5d'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x379452['apiKey']){var _0x228f8c={'method':_0xa8aa('0x3b'),'uri':_0xa8aa('0x67'),'headers':{'Authorization':_0x379452[_0xa8aa('0x5e')]},'body':{'content':_0x11a209[_0xa8aa('0xf')],'to':[_0x11a209['phone']],'from':_0x379452['phone'],'binary':![],'clientMessageId':_0xa8aa('0x68'),'charset':_0xa8aa('0x69')},'json':!![]};rp(_0x228f8c)['then'](function(_0x362404){if(!_0x362404[_0xa8aa('0x1f')]){var _0x1df71b={'messageId':_0x362404[_0xa8aa('0x26')][0x0][_0xa8aa('0x6a')]};if(!_0x379452[_0xa8aa('0x3e')]){_0x1df71b[_0xa8aa('0x3f')]=!![];}return _0x3b7fca[_0xa8aa('0x1c')](_0x1df71b);}else{return logger[_0xa8aa('0x1f')](_0xa8aa('0x2c'),_0xa8aa('0x2d'),_0xa8aa('0x6b'),util[_0xa8aa('0x2e')](_0x362404['error'],{'showHidden':![],'depth':null}));}})[_0xa8aa('0x1e')](function(_0x5de266){return logger['error'](_0xa8aa('0x2c'),_0xa8aa('0x2d'),_0xa8aa('0x6b'),util[_0xa8aa('0x2e')](_0x5de266,{'showHidden':![],'depth':null}));});}else{logger[_0xa8aa('0x1f')](_0xa8aa('0x2c'),_0xa8aa('0x2d'),_0xa8aa('0x6b'),_0xa8aa('0x6c'));}break;case _0xa8aa('0x6d'):if(_0x379452[_0xa8aa('0x32')]&&_0x379452[_0xa8aa('0x37')]){var _0x1e3bee=util[_0xa8aa('0x48')](_0xa8aa('0x49'),_0x379452[_0xa8aa('0x32')],_0x379452[_0xa8aa('0x37')]);var _0x13c57e={'method':_0xa8aa('0x3b'),'uri':_0xa8aa('0x6e')+_0x379452[_0xa8aa('0x6f')]+'/messages','body':{'to':[_0x11a209[_0xa8aa('0x25')]],'text':_0x11a209['body'],'from':_0x379452['phone'],'applicationId':_0x379452['applicationId']},'headers':{'Authorization':util[_0xa8aa('0x48')](_0xa8aa('0x4b'),new Buffer(_0x1e3bee)[_0xa8aa('0x4c')](_0xa8aa('0x54')))},'json':!![]};rp(_0x13c57e)['then'](function(_0x1b21c5){if(_0x1b21c5['id']){var _0x18f5cf={'messageId':_0x1b21c5['id']};return _0x3b7fca[_0xa8aa('0x1c')](_0x18f5cf);}else{logger[_0xa8aa('0x1f')](_0xa8aa('0x2c'),_0xa8aa('0x2d'),_0xa8aa('0x6d'),util[_0xa8aa('0x2e')](_0x1b21c5,{'showHidden':![],'depth':null}));}})[_0xa8aa('0x1e')](function(_0x120d39){logger[_0xa8aa('0x1f')](_0xa8aa('0x2c'),_0xa8aa('0x2d'),_0xa8aa('0x6d'),util[_0xa8aa('0x2e')](_0x120d39,{'showHidden':![],'depth':null}));});}else{logger[_0xa8aa('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa8aa('0x2d'),_0xa8aa('0x6d'),_0xa8aa('0x40'));}break;case _0xa8aa('0x70'):if(_0x379452[_0xa8aa('0x5e')]){var _0x326357={};var _0xe34470={'method':_0xa8aa('0x3b'),'uri':_0xa8aa('0x71'),'headers':{'Authorization':_0xa8aa('0x72')+_0x379452[_0xa8aa('0x5e')],'Content-Type':_0xa8aa('0x73')},'body':{'from':_0x379452[_0xa8aa('0x25')],'to':_0x11a209[_0xa8aa('0x25')],'text':_0x11a209[_0xa8aa('0xf')]},'json':!![]};return rp(_0xe34470)[_0xa8aa('0x1b')](function(_0x19f8f1){if(_0x19f8f1[_0xa8aa('0x74')]==0xca){_0x326357[_0xa8aa('0x75')]=_0x19f8f1;var _0x2059a4={'method':_0xa8aa('0x3b'),'uri':_0xa8aa('0x76'),'headers':{'Authorization':'Bearer\x20'+_0x379452[_0xa8aa('0x5e')],'Content-Type':'application/json'},'body':{'refid':_0x326357[_0xa8aa('0x75')][_0xa8aa('0x77')]},'json':!![]};return rp(_0x2059a4)['then'](function(_0x3bdd68){_0x326357[_0xa8aa('0x78')]=_0x3bdd68;var _0x19daff={'messageId':_0x326357[_0xa8aa('0x75')][_0xa8aa('0x77')],'read':!![]};return _0x3b7fca[_0xa8aa('0x1c')](_0x19daff);});}else{return logger[_0xa8aa('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa8aa('0x2d'),_0xa8aa('0x70'),util['inspect'](_0x19f8f1,{'showHidden':![],'depth':null}));}})[_0xa8aa('0x1e')](function(_0x16cb5f){return logger[_0xa8aa('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa8aa('0x2d'),_0xa8aa('0x70'),util[_0xa8aa('0x2e')](_0x16cb5f,{'showHidden':![],'depth':null}));});}else{return logger[_0xa8aa('0x1f')](_0xa8aa('0x2c'),_0xa8aa('0x2d'),_0xa8aa('0x70'),'Token\x20not\x20received');}break;}}})[_0xa8aa('0x79')](function(){_0x407499();});}else{_0x407499();}}},'charset':_0xa8aa('0x7a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index b351599..1e07c67 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 _0x8d90=['SmsMessage','create','body','options','raw','CreateSmsMessage','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x2c5dd4,_0x3b9578){var _0x555b01=function(_0x419bb5){while(--_0x419bb5){_0x2c5dd4['push'](_0x2c5dd4['shift']());}};_0x555b01(++_0x3b9578);}(_0x8d90,0x1b7));var _0x08d9=function(_0x40f179,_0x5436a3){_0x40f179=_0x40f179-0x0;var _0x588f7b=_0x8d90[_0x40f179];return _0x588f7b;};'use strict';var _=require(_0x08d9('0x0'));var util=require(_0x08d9('0x1'));var moment=require(_0x08d9('0x2'));var BPromise=require(_0x08d9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08d9('0x4'));var db=require(_0x08d9('0x5'))['db'];var utils=require(_0x08d9('0x6'));var logger=require(_0x08d9('0x7'))(_0x08d9('0x8'));var config=require('../../config/environment');var jayson=require(_0x08d9('0x9'));var client=jayson[_0x08d9('0xa')][_0x08d9('0xb')]({'port':0x232a});config[_0x08d9('0xc')]=_[_0x08d9('0xd')](config[_0x08d9('0xc')],{'host':_0x08d9('0xe'),'port':0x18eb});var socket=require(_0x08d9('0xf'))(new Redis(config[_0x08d9('0xc')]));require(_0x08d9('0x10'))[_0x08d9('0x11')](socket);function respondWithRpcPromise(_0x59aa46,_0x192c2e,_0x9f15c1){return new BPromise(function(_0x530b2b,_0x45bde3){return client[_0x08d9('0x12')](_0x59aa46,_0x9f15c1)[_0x08d9('0x13')](function(_0x1a5e64){logger[_0x08d9('0x14')](_0x08d9('0x15'),_0x192c2e,_0x08d9('0x16'));logger['debug'](_0x08d9('0x17'),_0x192c2e,_0x08d9('0x16'),JSON[_0x08d9('0x18')](_0x1a5e64));if(_0x1a5e64[_0x08d9('0x19')]){if(_0x1a5e64[_0x08d9('0x19')][_0x08d9('0x1a')]===0x1f4){logger['error'](_0x08d9('0x15'),_0x192c2e,_0x1a5e64[_0x08d9('0x19')]['message']);return _0x45bde3(_0x1a5e64[_0x08d9('0x19')]['message']);}logger[_0x08d9('0x19')](_0x08d9('0x15'),_0x192c2e,_0x1a5e64[_0x08d9('0x19')]['message']);return _0x530b2b(_0x1a5e64[_0x08d9('0x19')]['message']);}else{logger[_0x08d9('0x14')](_0x08d9('0x15'),_0x192c2e,_0x08d9('0x16'));_0x530b2b(_0x1a5e64['result'][_0x08d9('0x1b')]);}})[_0x08d9('0x1c')](function(_0x3d8638){logger[_0x08d9('0x19')](_0x08d9('0x15'),_0x192c2e,_0x3d8638);_0x45bde3(_0x3d8638);});});}exports['CreateSmsMessage']=function(_0x47d362){var _0x3ca1a3=this;return new Promise(function(_0x32f91c,_0x472577){return db[_0x08d9('0x1d')][_0x08d9('0x1e')](_0x47d362[_0x08d9('0x1f')],{'raw':_0x47d362['options']?_0x47d362[_0x08d9('0x20')][_0x08d9('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0xa058f3){logger['info'](_0x08d9('0x22'),_0x47d362);logger[_0x08d9('0x23')](_0x08d9('0x22'),_0x47d362,JSON[_0x08d9('0x18')](_0xa058f3));_0x32f91c(_0xa058f3);})['catch'](function(_0xd8be60){logger[_0x08d9('0x19')](_0x08d9('0x22'),_0xd8be60['message'],_0x47d362);_0x472577(_0x3ca1a3[_0x08d9('0x19')](0x1f4,_0xd8be60['message']));});});}; \ No newline at end of file +var _0x6ebf=['client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','result','SmsMessage','create','body','options','raw','CreateSmsMessage','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3a0a52,_0x208e01){var _0x3aac74=function(_0x583a9c){while(--_0x583a9c){_0x3a0a52['push'](_0x3a0a52['shift']());}};_0x3aac74(++_0x208e01);}(_0x6ebf,0x14b));var _0xf6eb=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0x6ebf[_0x1ebeea];return _0x576465;};'use strict';var _=require(_0xf6eb('0x0'));var util=require(_0xf6eb('0x1'));var moment=require(_0xf6eb('0x2'));var BPromise=require(_0xf6eb('0x3'));var rs=require(_0xf6eb('0x4'));var fs=require('fs');var Redis=require(_0xf6eb('0x5'));var db=require(_0xf6eb('0x6'))['db'];var utils=require(_0xf6eb('0x7'));var logger=require('../../config/logger')(_0xf6eb('0x8'));var config=require(_0xf6eb('0x9'));var jayson=require(_0xf6eb('0xa'));var client=jayson[_0xf6eb('0xb')][_0xf6eb('0xc')]({'port':0x232a});config[_0xf6eb('0xd')]=_[_0xf6eb('0xe')](config['redis'],{'host':_0xf6eb('0xf'),'port':0x18eb});var socket=require(_0xf6eb('0x10'))(new Redis(config[_0xf6eb('0xd')]));require(_0xf6eb('0x11'))[_0xf6eb('0x12')](socket);function respondWithRpcPromise(_0x53dc53,_0x317fd9,_0x14c92e){return new BPromise(function(_0x5ed4ea,_0xe4dd47){return client[_0xf6eb('0x13')](_0x53dc53,_0x14c92e)[_0xf6eb('0x14')](function(_0x5df0f4){logger[_0xf6eb('0x15')]('SmsMessage,\x20%s,\x20%s',_0x317fd9,_0xf6eb('0x16'));logger[_0xf6eb('0x17')](_0xf6eb('0x18'),_0x317fd9,_0xf6eb('0x16'),JSON['stringify'](_0x5df0f4));if(_0x5df0f4[_0xf6eb('0x19')]){if(_0x5df0f4[_0xf6eb('0x19')][_0xf6eb('0x1a')]===0x1f4){logger['error'](_0xf6eb('0x1b'),_0x317fd9,_0x5df0f4[_0xf6eb('0x19')]['message']);return _0xe4dd47(_0x5df0f4[_0xf6eb('0x19')][_0xf6eb('0x1c')]);}logger['error'](_0xf6eb('0x1b'),_0x317fd9,_0x5df0f4[_0xf6eb('0x19')][_0xf6eb('0x1c')]);return _0x5ed4ea(_0x5df0f4[_0xf6eb('0x19')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x317fd9,_0xf6eb('0x16'));_0x5ed4ea(_0x5df0f4[_0xf6eb('0x1d')][_0xf6eb('0x1c')]);}})['catch'](function(_0x4491a3){logger[_0xf6eb('0x19')](_0xf6eb('0x1b'),_0x317fd9,_0x4491a3);_0xe4dd47(_0x4491a3);});});}exports['CreateSmsMessage']=function(_0x124349){var _0x29f516=this;return new Promise(function(_0x1941c6,_0x273897){return db[_0xf6eb('0x1e')][_0xf6eb('0x1f')](_0x124349[_0xf6eb('0x20')],{'raw':_0x124349[_0xf6eb('0x21')]?_0x124349[_0xf6eb('0x21')][_0xf6eb('0x22')]===undefined?!![]:![]:!![]})[_0xf6eb('0x14')](function(_0x1357ca){logger[_0xf6eb('0x15')](_0xf6eb('0x23'),_0x124349);logger[_0xf6eb('0x17')](_0xf6eb('0x23'),_0x124349,JSON[_0xf6eb('0x24')](_0x1357ca));_0x1941c6(_0x1357ca);})[_0xf6eb('0x25')](function(_0x27536a){logger[_0xf6eb('0x19')]('CreateSmsMessage',_0x27536a[_0xf6eb('0x1c')],_0x124349);_0x273897(_0x29f516['error'](0x1f4,_0x27536a[_0xf6eb('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index ffd44e6..478fcf1 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 _0x97d9=['length','./smsMessage.events','save','remove','update','emit','removeListener'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0x97d9,0x166));var _0x997d=function(_0xb91cbd,_0x3c9933){_0xb91cbd=_0xb91cbd-0x0;var _0x196cc4=_0x97d9[_0xb91cbd];return _0x196cc4;};'use strict';var SmsMessageEvents=require(_0x997d('0x0'));var events=[_0x997d('0x1'),_0x997d('0x2'),_0x997d('0x3')];function createListener(_0x3954ca,_0x5c7b28){return function(_0x1ecb27){_0x5c7b28[_0x997d('0x4')](_0x3954ca,_0x1ecb27);};}function removeListener(_0x2c3a8a,_0x4306a7){return function(){SmsMessageEvents[_0x997d('0x5')](_0x2c3a8a,_0x4306a7);};}exports['register']=function(_0x5804d3){for(var _0xb06af9=0x0,_0x23489a=events[_0x997d('0x6')];_0xb06af9<_0x23489a;_0xb06af9++){var _0x1f6d28=events[_0xb06af9];var _0x589d87=createListener('smsMessage:'+_0x1f6d28,_0x5804d3);SmsMessageEvents['on'](_0x1f6d28,_0x589d87);}}; \ No newline at end of file +var _0x3096=['emit','removeListener','register','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0x3096,0x1f4));var _0x6309=function(_0x4c57a9,_0x48bd67){_0x4c57a9=_0x4c57a9-0x0;var _0x2c9186=_0x3096[_0x4c57a9];return _0x2c9186;};'use strict';var SmsMessageEvents=require(_0x6309('0x0'));var events=[_0x6309('0x1'),_0x6309('0x2'),_0x6309('0x3')];function createListener(_0x2d83ab,_0x512938){return function(_0x18467d){_0x512938[_0x6309('0x4')](_0x2d83ab,_0x18467d);};}function removeListener(_0x39dd6e,_0x588e75){return function(){SmsMessageEvents[_0x6309('0x5')](_0x39dd6e,_0x588e75);};}exports[_0x6309('0x6')]=function(_0x505076){for(var _0x1ebb9e=0x0,_0x4bef05=events['length'];_0x1ebb9e<_0x4bef05;_0x1ebb9e++){var _0x5f564f=events[_0x1ebb9e];var _0x3c9e45=createListener(_0x6309('0x7')+_0x5f564f,_0x505076);SmsMessageEvents['on'](_0x5f564f,_0x3c9e45);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index b98d228..8d022e2 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 _0xbf59=['delete','destroy','/:id/teams','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','post','addTeams','addAgents','put','update'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xbf59,0x149));var _0x9bf5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf59[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9bf5('0x0'));var util=require('util');var path=require(_0x9bf5('0x1'));var timeout=require(_0x9bf5('0x2'));var express=require(_0x9bf5('0x3'));var router=express['Router']();var fs_extra=require(_0x9bf5('0x4'));var auth=require(_0x9bf5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9bf5('0x6'));var controller=require(_0x9bf5('0x7'));router[_0x9bf5('0x8')]('/',auth[_0x9bf5('0x9')](),controller['index']);router['get'](_0x9bf5('0xa'),auth[_0x9bf5('0x9')](),controller['describe']);router[_0x9bf5('0x8')](_0x9bf5('0xb'),auth[_0x9bf5('0x9')](),controller[_0x9bf5('0xc')]);router[_0x9bf5('0x8')](_0x9bf5('0xd'),auth[_0x9bf5('0x9')](),controller[_0x9bf5('0xe')]);router[_0x9bf5('0x8')]('/:id/teams',auth[_0x9bf5('0x9')](),controller[_0x9bf5('0xf')]);router[_0x9bf5('0x8')](_0x9bf5('0x10'),auth[_0x9bf5('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9bf5('0x11')]('/:id/teams',auth[_0x9bf5('0x9')](),controller[_0x9bf5('0x12')]);router[_0x9bf5('0x11')](_0x9bf5('0x10'),auth['isAuthenticated'](),controller[_0x9bf5('0x13')]);router[_0x9bf5('0x14')](_0x9bf5('0xb'),auth[_0x9bf5('0x9')](),controller[_0x9bf5('0x15')]);router[_0x9bf5('0x16')](_0x9bf5('0xb'),auth['isAuthenticated'](),controller[_0x9bf5('0x17')]);router[_0x9bf5('0x16')](_0x9bf5('0x18'),auth[_0x9bf5('0x9')](),controller['removeTeams']);router[_0x9bf5('0x16')]('/:id/users',auth[_0x9bf5('0x9')](),controller[_0x9bf5('0x19')]);module[_0x9bf5('0x1a')]=router; \ No newline at end of file +var _0xe86e=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getAgents','post','/:id/users','put','update','delete','destroy','removeTeams','removeAgents','multer','path'];(function(_0x395b75,_0x5e4170){var _0x21f76c=function(_0x18851e){while(--_0x18851e){_0x395b75['push'](_0x395b75['shift']());}};_0x21f76c(++_0x5e4170);}(_0xe86e,0x1c6));var _0xee86=function(_0x2aa24b,_0x220066){_0x2aa24b=_0x2aa24b-0x0;var _0x3320ad=_0xe86e[_0x2aa24b];return _0x3320ad;};'use strict';var multer=require(_0xee86('0x0'));var util=require('util');var path=require(_0xee86('0x1'));var timeout=require('connect-timeout');var express=require(_0xee86('0x2'));var router=express['Router']();var fs_extra=require(_0xee86('0x3'));var auth=require(_0xee86('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xee86('0x5'));var controller=require('./smsQueue.controller');router[_0xee86('0x6')]('/',auth[_0xee86('0x7')](),controller[_0xee86('0x8')]);router[_0xee86('0x6')](_0xee86('0x9'),auth['isAuthenticated'](),controller[_0xee86('0xa')]);router[_0xee86('0x6')](_0xee86('0xb'),auth[_0xee86('0x7')](),controller[_0xee86('0xc')]);router[_0xee86('0x6')](_0xee86('0xd'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xee86('0xe'),auth[_0xee86('0x7')](),controller['getTeams']);router['get']('/:id/users',auth[_0xee86('0x7')](),controller[_0xee86('0xf')]);router[_0xee86('0x10')]('/',auth[_0xee86('0x7')](),controller['create']);router['post'](_0xee86('0xe'),auth[_0xee86('0x7')](),controller['addTeams']);router[_0xee86('0x10')](_0xee86('0x11'),auth[_0xee86('0x7')](),controller['addAgents']);router[_0xee86('0x12')](_0xee86('0xb'),auth['isAuthenticated'](),controller[_0xee86('0x13')]);router[_0xee86('0x14')](_0xee86('0xb'),auth[_0xee86('0x7')](),controller[_0xee86('0x15')]);router['delete']('/:id/teams',auth[_0xee86('0x7')](),controller[_0xee86('0x16')]);router['delete'](_0xee86('0x11'),auth[_0xee86('0x7')](),controller[_0xee86('0x17')]);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 af87373..63dbdd9 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 _0xfed4=['INTEGER','ENUM','rrmemory','beepall','exports','STRING','name'];(function(_0x7177a3,_0x520624){var _0x37ce67=function(_0x47eecd){while(--_0x47eecd){_0x7177a3['push'](_0x7177a3['shift']());}};_0x37ce67(++_0x520624);}(_0xfed4,0xeb));var _0x4fed=function(_0x315406,_0xb5c21a){_0x315406=_0x315406-0x0;var _0x55a7d3=_0xfed4[_0x315406];return _0x55a7d3;};'use strict';var Sequelize=require('sequelize');module[_0x4fed('0x0')]={'name':{'type':Sequelize[_0x4fed('0x1')],'unique':_0x4fed('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4fed('0x1')]},'timeout':{'type':Sequelize[_0x4fed('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4fed('0x4')](_0x4fed('0x5'),_0x4fed('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x74d6=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x25f83a,_0x552bb1){var _0x41cc0f=function(_0x2be101){while(--_0x2be101){_0x25f83a['push'](_0x25f83a['shift']());}};_0x41cc0f(++_0x552bb1);}(_0x74d6,0x84));var _0x674d=function(_0x58d786,_0x254f3c){_0x58d786=_0x58d786-0x0;var _0x12db4f=_0x74d6[_0x58d786];return _0x12db4f;};'use strict';var Sequelize=require(_0x674d('0x0'));module[_0x674d('0x1')]={'name':{'type':Sequelize[_0x674d('0x2')],'unique':_0x674d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x674d('0x2')]},'timeout':{'type':Sequelize[_0x674d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x674d('0x5')](_0x674d('0x6'),_0x674d('0x7'),_0x674d('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index f27b29a..4c0d4fe 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 _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','SmsQueueId','merge','UserSmsQueue','User','findAndCountAll','map','UserId','agent','smsPause','updatedAt','createdAt','format'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0xadb5,0xad));var _0x5adb=function(_0x21bc28,_0x1e5297){_0x21bc28=_0x21bc28-0x0;var _0x1a4266=_0xadb5[_0x21bc28];return _0x1a4266;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserSmsQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'SmsQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['SmsQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['SmsQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'SmsQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'SmsQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'SmsQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'SmsQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['SmsQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,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(_0x4d400d,_0x30a6e6){var _0x327fc4=function(_0x1aa2db){while(--_0x1aa2db){_0x4d400d['push'](_0x4d400d['shift']());}};_0x327fc4(++_0x30a6e6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3c4047,_0x26c881){_0x3c4047=_0x3c4047-0x0;var _0xea78a2=_0x5f2f[_0x3c4047];return _0xea78a2;};'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 94c03bc..a3c8fe1 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 _0x8cd6=['emit','hasOwnProperty','hook','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x44d992,_0x5b740f){var _0x8c2130=function(_0x1cc0f8){while(--_0x1cc0f8){_0x44d992['push'](_0x44d992['shift']());}};_0x8c2130(++_0x5b740f);}(_0x8cd6,0x19b));var _0x68cd=function(_0x4f3f71,_0x1e35ce){_0x4f3f71=_0x4f3f71-0x0;var _0x559c25=_0x8cd6[_0x4f3f71];return _0x559c25;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x68cd('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x68cd('0x1')](0x0);var events={'afterCreate':_0x68cd('0x2'),'afterUpdate':_0x68cd('0x3'),'afterDestroy':_0x68cd('0x4')};function emitEvent(_0x4367bc){return function(_0x342a75,_0x330865,_0x3027d1){SmsQueueEvents[_0x68cd('0x5')](_0x4367bc+':'+_0x342a75['id'],_0x342a75);SmsQueueEvents[_0x68cd('0x5')](_0x4367bc,_0x342a75);_0x3027d1(null);};}for(var e in events){if(events[_0x68cd('0x6')](e)){var event=events[e];SmsQueue[_0x68cd('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xab31=['emit','hasOwnProperty','exports','events','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xab31,0xb7));var _0x1ab3=function(_0x2aec6f,_0x3d0f15){_0x2aec6f=_0x2aec6f-0x0;var _0x1376bc=_0xab31[_0x2aec6f];return _0x1376bc;};'use strict';var EventEmitter=require(_0x1ab3('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x1ab3('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1ab3('0x2')](0x0);var events={'afterCreate':_0x1ab3('0x3'),'afterUpdate':_0x1ab3('0x4'),'afterDestroy':_0x1ab3('0x5')};function emitEvent(_0x23e16b){return function(_0xc0b69a,_0x34f7b9,_0x5d2936){SmsQueueEvents[_0x1ab3('0x6')](_0x23e16b+':'+_0xc0b69a['id'],_0xc0b69a);SmsQueueEvents[_0x1ab3('0x6')](_0x23e16b,_0xc0b69a);_0x5d2936(null);};}for(var e in events){if(events[_0x1ab3('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x1ab3('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index c6dfac8..e823bf7 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 _0xb589=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues'];(function(_0x243087,_0x14e197){var _0x3c7b95=function(_0x114da0){while(--_0x114da0){_0x243087['push'](_0x243087['shift']());}};_0x3c7b95(++_0x14e197);}(_0xb589,0x138));var _0x9b58=function(_0x411bd1,_0x416106){_0x411bd1=_0x411bd1-0x0;var _0x320464=_0xb589[_0x411bd1];return _0x320464;};'use strict';var _=require(_0x9b58('0x0'));var util=require(_0x9b58('0x1'));var logger=require(_0x9b58('0x2'))(_0x9b58('0x3'));var moment=require(_0x9b58('0x4'));var BPromise=require('bluebird');var rp=require(_0x9b58('0x5'));var fs=require('fs');var path=require(_0x9b58('0x6'));var rimraf=require(_0x9b58('0x7'));var config=require(_0x9b58('0x8'));var attributes=require(_0x9b58('0x9'));module['exports']=function(_0x238bb2,_0x3da098){return _0x238bb2[_0x9b58('0xa')](_0x9b58('0xb'),attributes,{'tableName':_0x9b58('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe315=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','sms_queues'];(function(_0x26e2a2,_0x2781c2){var _0x30062a=function(_0x698862){while(--_0x698862){_0x26e2a2['push'](_0x26e2a2['shift']());}};_0x30062a(++_0x2781c2);}(_0xe315,0x9a));var _0x5e31=function(_0x465093,_0x49392f){_0x465093=_0x465093-0x0;var _0x3cb539=_0xe315[_0x465093];return _0x3cb539;};'use strict';var _=require(_0x5e31('0x0'));var util=require(_0x5e31('0x1'));var logger=require(_0x5e31('0x2'))(_0x5e31('0x3'));var moment=require('moment');var BPromise=require(_0x5e31('0x4'));var rp=require(_0x5e31('0x5'));var fs=require('fs');var path=require(_0x5e31('0x6'));var rimraf=require('rimraf');var config=require(_0x5e31('0x7'));var attributes=require('./smsQueue.attributes');module[_0x5e31('0x8')]=function(_0x39bd5,_0x96b81a){return _0x39bd5[_0x5e31('0x9')]('SmsQueue',attributes,{'tableName':_0x5e31('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 731240d..c972bce 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 _0x8ba2=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','defaults','redis','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetSmsQueue','ShowSmsQueue','find'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x8ba2,0x1ad));var _0x28ba=function(_0x40f607,_0x4b61cb){_0x40f607=_0x40f607-0x0;var _0x385c15=_0x8ba2[_0x40f607];return _0x385c15;};'use strict';var _=require(_0x28ba('0x0'));var util=require(_0x28ba('0x1'));var moment=require(_0x28ba('0x2'));var BPromise=require(_0x28ba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28ba('0x4'));var db=require(_0x28ba('0x5'))['db'];var utils=require(_0x28ba('0x6'));var logger=require(_0x28ba('0x7'))('rpc');var config=require(_0x28ba('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x28ba('0x9')]({'port':0x232a});config['redis']=_[_0x28ba('0xa')](config[_0x28ba('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x28ba('0xc'))(new Redis(config[_0x28ba('0xb')]));require(_0x28ba('0xd'))[_0x28ba('0xe')](socket);function respondWithRpcPromise(_0x13faf5,_0x9d51ca,_0x91d8c4){return new BPromise(function(_0x261673,_0x13bd8a){return client[_0x28ba('0xf')](_0x13faf5,_0x91d8c4)[_0x28ba('0x10')](function(_0x30af6c){logger[_0x28ba('0x11')](_0x28ba('0x12'),_0x9d51ca,_0x28ba('0x13'));logger[_0x28ba('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x9d51ca,_0x28ba('0x13'),JSON[_0x28ba('0x15')](_0x30af6c));if(_0x30af6c['error']){if(_0x30af6c[_0x28ba('0x16')][_0x28ba('0x17')]===0x1f4){logger[_0x28ba('0x16')](_0x28ba('0x12'),_0x9d51ca,_0x30af6c[_0x28ba('0x16')][_0x28ba('0x18')]);return _0x13bd8a(_0x30af6c[_0x28ba('0x16')][_0x28ba('0x18')]);}logger[_0x28ba('0x16')](_0x28ba('0x12'),_0x9d51ca,_0x30af6c[_0x28ba('0x16')][_0x28ba('0x18')]);return _0x261673(_0x30af6c['error'][_0x28ba('0x18')]);}else{logger[_0x28ba('0x11')](_0x28ba('0x12'),_0x9d51ca,_0x28ba('0x13'));_0x261673(_0x30af6c['result'][_0x28ba('0x18')]);}})[_0x28ba('0x19')](function(_0x2fd090){logger['error']('SmsQueue,\x20%s,\x20%s',_0x9d51ca,_0x2fd090);_0x13bd8a(_0x2fd090);});});}exports['GetSmsQueue']=function(_0xbf6e08){var _0x748cc6=this;return new Promise(function(_0x2faf8d,_0x232568){return db[_0x28ba('0x1a')][_0x28ba('0x1b')]({'raw':_0xbf6e08[_0x28ba('0x1c')]?_0xbf6e08[_0x28ba('0x1c')][_0x28ba('0x1d')]===undefined?!![]:![]:!![],'where':_0xbf6e08[_0x28ba('0x1c')]?_0xbf6e08[_0x28ba('0x1c')][_0x28ba('0x1e')]||null:null,'attributes':_0xbf6e08['options']?_0xbf6e08[_0x28ba('0x1c')][_0x28ba('0x1f')]||null:null,'limit':_0xbf6e08[_0x28ba('0x1c')]?_0xbf6e08['options'][_0x28ba('0x20')]||null:null,'include':_0xbf6e08['options']?_0xbf6e08[_0x28ba('0x1c')][_0x28ba('0x21')]?_[_0x28ba('0x22')](_0xbf6e08[_0x28ba('0x1c')][_0x28ba('0x21')],function(_0x51902e){return{'model':db[_0x51902e[_0x28ba('0x23')]],'as':_0x51902e['as'],'attributes':_0x51902e[_0x28ba('0x1f')],'include':_0x51902e[_0x28ba('0x21')]?_[_0x28ba('0x22')](_0x51902e['include'],function(_0xa068b0){return{'model':db[_0xa068b0[_0x28ba('0x23')]],'as':_0xa068b0['as'],'attributes':_0xa068b0[_0x28ba('0x1f')],'include':_0xa068b0[_0x28ba('0x21')]?_['map'](_0xa068b0[_0x28ba('0x21')],function(_0x43ad6a){return{'model':db[_0x43ad6a[_0x28ba('0x23')]],'as':_0x43ad6a['as'],'attributes':_0x43ad6a[_0x28ba('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x28ba('0x10')](function(_0x1ed6a2){logger[_0x28ba('0x11')](_0x28ba('0x24'),_0xbf6e08);logger[_0x28ba('0x14')]('GetSmsQueue',_0xbf6e08,JSON[_0x28ba('0x15')](_0x1ed6a2));_0x2faf8d(_0x1ed6a2);})[_0x28ba('0x19')](function(_0x444fcd){logger['error'](_0x28ba('0x24'),_0x444fcd[_0x28ba('0x18')],_0xbf6e08);_0x232568(_0x748cc6['error'](0x1f4,_0x444fcd[_0x28ba('0x18')]));});});};exports[_0x28ba('0x25')]=function(_0x587309){var _0x186fca=this;return new Promise(function(_0x5bf6c5,_0x46933f){return db[_0x28ba('0x1a')][_0x28ba('0x26')]({'raw':_0x587309[_0x28ba('0x1c')]?_0x587309[_0x28ba('0x1c')][_0x28ba('0x1d')]===undefined?!![]:![]:!![],'where':_0x587309[_0x28ba('0x1c')]?_0x587309['options'][_0x28ba('0x1e')]||null:null,'attributes':_0x587309[_0x28ba('0x1c')]?_0x587309[_0x28ba('0x1c')]['attributes']||null:null,'include':_0x587309[_0x28ba('0x1c')]?_0x587309[_0x28ba('0x1c')][_0x28ba('0x21')]?_[_0x28ba('0x22')](_0x587309[_0x28ba('0x1c')][_0x28ba('0x21')],function(_0x17b2a1){return{'model':db[_0x17b2a1[_0x28ba('0x23')]],'as':_0x17b2a1['as'],'attributes':_0x17b2a1[_0x28ba('0x1f')],'include':_0x17b2a1[_0x28ba('0x21')]?_[_0x28ba('0x22')](_0x17b2a1[_0x28ba('0x21')],function(_0xf68d1){return{'model':db[_0xf68d1[_0x28ba('0x23')]],'as':_0xf68d1['as'],'attributes':_0xf68d1[_0x28ba('0x1f')],'include':_0xf68d1[_0x28ba('0x21')]?_[_0x28ba('0x22')](_0xf68d1[_0x28ba('0x21')],function(_0x16f2c9){return{'model':db[_0x16f2c9[_0x28ba('0x23')]],'as':_0x16f2c9['as'],'attributes':_0x16f2c9[_0x28ba('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x28ba('0x10')](function(_0x4c296f){logger[_0x28ba('0x11')]('ShowSmsQueue',_0x587309);logger['debug']('ShowSmsQueue',_0x587309,JSON[_0x28ba('0x15')](_0x4c296f));_0x5bf6c5(_0x4c296f);})[_0x28ba('0x19')](function(_0x44e29f){logger['error']('ShowSmsQueue',_0x44e29f[_0x28ba('0x18')],_0x587309);_0x46933f(_0x186fca[_0x28ba('0x16')](0x1f4,_0x44e29f[_0x28ba('0x18')]));});});}; \ No newline at end of file +var _0x26a7=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','info','SmsQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetSmsQueue','findAll','options','raw','where','limit','include','model','attributes','map','then','stringify','ShowSmsQueue','SmsQueue','find','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2f4c39,_0x1146b1){var _0x3426ab=function(_0x3d35f9){while(--_0x3d35f9){_0x2f4c39['push'](_0x2f4c39['shift']());}};_0x3426ab(++_0x1146b1);}(_0x26a7,0x1d7));var _0x726a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x26a7[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x726a('0x0'));var util=require(_0x726a('0x1'));var moment=require(_0x726a('0x2'));var BPromise=require(_0x726a('0x3'));var rs=require(_0x726a('0x4'));var fs=require('fs');var Redis=require(_0x726a('0x5'));var db=require(_0x726a('0x6'))['db'];var utils=require(_0x726a('0x7'));var logger=require(_0x726a('0x8'))('rpc');var config=require(_0x726a('0x9'));var jayson=require(_0x726a('0xa'));var client=jayson[_0x726a('0xb')][_0x726a('0xc')]({'port':0x232a});config[_0x726a('0xd')]=_[_0x726a('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x726a('0xf'))(new Redis(config['redis']));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x40f4c6,_0x5371c5,_0x53c699){return new BPromise(function(_0x6dcb32,_0x5ac570){return client['request'](_0x40f4c6,_0x53c699)['then'](function(_0x323e67){logger[_0x726a('0x10')](_0x726a('0x11'),_0x5371c5,'request\x20sent');logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x5371c5,_0x726a('0x12'),JSON['stringify'](_0x323e67));if(_0x323e67[_0x726a('0x13')]){if(_0x323e67['error'][_0x726a('0x14')]===0x1f4){logger[_0x726a('0x13')](_0x726a('0x11'),_0x5371c5,_0x323e67['error'][_0x726a('0x15')]);return _0x5ac570(_0x323e67[_0x726a('0x13')][_0x726a('0x15')]);}logger[_0x726a('0x13')](_0x726a('0x11'),_0x5371c5,_0x323e67[_0x726a('0x13')][_0x726a('0x15')]);return _0x6dcb32(_0x323e67[_0x726a('0x13')][_0x726a('0x15')]);}else{logger[_0x726a('0x10')](_0x726a('0x11'),_0x5371c5,_0x726a('0x12'));_0x6dcb32(_0x323e67[_0x726a('0x16')][_0x726a('0x15')]);}})[_0x726a('0x17')](function(_0x47aa63){logger['error'](_0x726a('0x11'),_0x5371c5,_0x47aa63);_0x5ac570(_0x47aa63);});});}exports[_0x726a('0x18')]=function(_0x55d310){var _0x107372=this;return new Promise(function(_0x4b905b,_0xc17e){return db['SmsQueue'][_0x726a('0x19')]({'raw':_0x55d310[_0x726a('0x1a')]?_0x55d310['options'][_0x726a('0x1b')]===undefined?!![]:![]:!![],'where':_0x55d310[_0x726a('0x1a')]?_0x55d310[_0x726a('0x1a')][_0x726a('0x1c')]||null:null,'attributes':_0x55d310[_0x726a('0x1a')]?_0x55d310[_0x726a('0x1a')]['attributes']||null:null,'limit':_0x55d310['options']?_0x55d310[_0x726a('0x1a')][_0x726a('0x1d')]||null:null,'include':_0x55d310[_0x726a('0x1a')]?_0x55d310[_0x726a('0x1a')][_0x726a('0x1e')]?_['map'](_0x55d310[_0x726a('0x1a')]['include'],function(_0x24762e){return{'model':db[_0x24762e[_0x726a('0x1f')]],'as':_0x24762e['as'],'attributes':_0x24762e[_0x726a('0x20')],'include':_0x24762e[_0x726a('0x1e')]?_[_0x726a('0x21')](_0x24762e[_0x726a('0x1e')],function(_0x15bc4b){return{'model':db[_0x15bc4b[_0x726a('0x1f')]],'as':_0x15bc4b['as'],'attributes':_0x15bc4b[_0x726a('0x20')],'include':_0x15bc4b['include']?_[_0x726a('0x21')](_0x15bc4b[_0x726a('0x1e')],function(_0x2819f3){return{'model':db[_0x2819f3[_0x726a('0x1f')]],'as':_0x2819f3['as'],'attributes':_0x2819f3[_0x726a('0x20')]};}):[]};}):[]};}):[]:[]})[_0x726a('0x22')](function(_0x485e56){logger[_0x726a('0x10')](_0x726a('0x18'),_0x55d310);logger['debug'](_0x726a('0x18'),_0x55d310,JSON[_0x726a('0x23')](_0x485e56));_0x4b905b(_0x485e56);})[_0x726a('0x17')](function(_0x179928){logger[_0x726a('0x13')](_0x726a('0x18'),_0x179928[_0x726a('0x15')],_0x55d310);_0xc17e(_0x107372[_0x726a('0x13')](0x1f4,_0x179928[_0x726a('0x15')]));});});};exports[_0x726a('0x24')]=function(_0x18e637){var _0xdb29d7=this;return new Promise(function(_0x1118a0,_0x43af50){return db[_0x726a('0x25')][_0x726a('0x26')]({'raw':_0x18e637[_0x726a('0x1a')]?_0x18e637['options'][_0x726a('0x1b')]===undefined?!![]:![]:!![],'where':_0x18e637[_0x726a('0x1a')]?_0x18e637[_0x726a('0x1a')][_0x726a('0x1c')]||null:null,'attributes':_0x18e637['options']?_0x18e637[_0x726a('0x1a')][_0x726a('0x20')]||null:null,'include':_0x18e637[_0x726a('0x1a')]?_0x18e637[_0x726a('0x1a')]['include']?_['map'](_0x18e637[_0x726a('0x1a')][_0x726a('0x1e')],function(_0x2130b9){return{'model':db[_0x2130b9[_0x726a('0x1f')]],'as':_0x2130b9['as'],'attributes':_0x2130b9['attributes'],'include':_0x2130b9[_0x726a('0x1e')]?_[_0x726a('0x21')](_0x2130b9[_0x726a('0x1e')],function(_0x4d53f7){return{'model':db[_0x4d53f7['model']],'as':_0x4d53f7['as'],'attributes':_0x4d53f7['attributes'],'include':_0x4d53f7[_0x726a('0x1e')]?_[_0x726a('0x21')](_0x4d53f7[_0x726a('0x1e')],function(_0x1d554c){return{'model':db[_0x1d554c[_0x726a('0x1f')]],'as':_0x1d554c['as'],'attributes':_0x1d554c[_0x726a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ab797){logger[_0x726a('0x10')]('ShowSmsQueue',_0x18e637);logger[_0x726a('0x27')](_0x726a('0x24'),_0x18e637,JSON[_0x726a('0x23')](_0x1ab797));_0x1118a0(_0x1ab797);})[_0x726a('0x17')](function(_0x20e0c5){logger['error']('ShowSmsQueue',_0x20e0c5['message'],_0x18e637);_0x43af50(_0xdb29d7[_0x726a('0x13')](0x1f4,_0x20e0c5[_0x726a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 3b3d5b7..fa2de4c 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 _0x7644=['removeListener','register','smsQueue:','save','update'];(function(_0x4baeec,_0x156ecf){var _0x39fbb0=function(_0x32d9cb){while(--_0x32d9cb){_0x4baeec['push'](_0x4baeec['shift']());}};_0x39fbb0(++_0x156ecf);}(_0x7644,0x139));var _0x4764=function(_0x3cc36d,_0x2e752b){_0x3cc36d=_0x3cc36d-0x0;var _0x4a72eb=_0x7644[_0x3cc36d];return _0x4a72eb;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x4764('0x0'),'remove',_0x4764('0x1')];function createListener(_0x2de61c,_0x1d805c){return function(_0x4ba218){_0x1d805c['emit'](_0x2de61c,_0x4ba218);};}function removeListener(_0x46bb4f,_0x1546a9){return function(){SmsQueueEvents[_0x4764('0x2')](_0x46bb4f,_0x1546a9);};}exports[_0x4764('0x3')]=function(_0x5d89ad){for(var _0x5b81ea=0x0,_0x1b043b=events['length'];_0x5b81ea<_0x1b043b;_0x5b81ea++){var _0x1c6644=events[_0x5b81ea];var _0x41279d=createListener(_0x4764('0x4')+_0x1c6644,_0x5d89ad);SmsQueueEvents['on'](_0x1c6644,_0x41279d);}}; \ No newline at end of file +var _0x3115=['update','emit','removeListener','register','./smsQueue.events','save','remove'];(function(_0x3f4dcb,_0x44e0e7){var _0x24310d=function(_0x5edeee){while(--_0x5edeee){_0x3f4dcb['push'](_0x3f4dcb['shift']());}};_0x24310d(++_0x44e0e7);}(_0x3115,0x169));var _0x5311=function(_0x40aaca,_0x4803f4){_0x40aaca=_0x40aaca-0x0;var _0x1252f7=_0x3115[_0x40aaca];return _0x1252f7;};'use strict';var SmsQueueEvents=require(_0x5311('0x0'));var events=[_0x5311('0x1'),_0x5311('0x2'),_0x5311('0x3')];function createListener(_0x929fa2,_0x5b331f){return function(_0x449b09){_0x5b331f[_0x5311('0x4')](_0x929fa2,_0x449b09);};}function removeListener(_0x138b4f,_0x166e79){return function(){SmsQueueEvents[_0x5311('0x5')](_0x138b4f,_0x166e79);};}exports[_0x5311('0x6')]=function(_0x404a4c){for(var _0x28f866=0x0,_0x30a01d=events['length'];_0x28f866<_0x30a01d;_0x28f866++){var _0x474d7f=events[_0x28f866];var _0x4ae42d=createListener('smsQueue:'+_0x474d7f,_0x404a4c);SmsQueueEvents['on'](_0x474d7f,_0x4ae42d);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 62eda1a..389a288 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 _0x7e69=['index','isAuthenticated','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get'];(function(_0x41c4e2,_0x193393){var _0x15085b=function(_0x54dd92){while(--_0x54dd92){_0x41c4e2['push'](_0x41c4e2['shift']());}};_0x15085b(++_0x193393);}(_0x7e69,0x1b8));var _0x97e6=function(_0x3dda00,_0x392dca){_0x3dda00=_0x3dda00-0x0;var _0x2a6b26=_0x7e69[_0x3dda00];return _0x2a6b26;};'use strict';var multer=require(_0x97e6('0x0'));var util=require('util');var path=require(_0x97e6('0x1'));var timeout=require(_0x97e6('0x2'));var express=require(_0x97e6('0x3'));var router=express[_0x97e6('0x4')]();var fs_extra=require(_0x97e6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x97e6('0x6'));var config=require(_0x97e6('0x7'));var controller=require(_0x97e6('0x8'));router[_0x97e6('0x9')]('/',auth['isAuthenticated'](),controller[_0x97e6('0xa')]);router[_0x97e6('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x97e6('0x9')]('/:id',auth[_0x97e6('0xb')](),controller['show']);router['post']('/',auth[_0x97e6('0xb')](),controller[_0x97e6('0xc')]);router[_0x97e6('0xd')](_0x97e6('0xe'),auth['isAuthenticated'](),controller[_0x97e6('0xf')]);router['delete'](_0x97e6('0xe'),auth['isAuthenticated'](),controller[_0x97e6('0x10')]);module[_0x97e6('0x11')]=router; \ No newline at end of file +var _0xb9c6=['isAuthenticated','get','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsQueueReport.controller','index','/describe'];(function(_0x3fa1d8,_0x1f5bb3){var _0x266d52=function(_0xa21206){while(--_0xa21206){_0x3fa1d8['push'](_0x3fa1d8['shift']());}};_0x266d52(++_0x1f5bb3);}(_0xb9c6,0x1d8));var _0x6b9c=function(_0x15aab0,_0x333fb8){_0x15aab0=_0x15aab0-0x0;var _0x37fc85=_0xb9c6[_0x15aab0];return _0x37fc85;};'use strict';var multer=require(_0x6b9c('0x0'));var util=require(_0x6b9c('0x1'));var path=require(_0x6b9c('0x2'));var timeout=require(_0x6b9c('0x3'));var express=require(_0x6b9c('0x4'));var router=express[_0x6b9c('0x5')]();var fs_extra=require(_0x6b9c('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6b9c('0x7'));var controller=require(_0x6b9c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6b9c('0x9')]);router['get'](_0x6b9c('0xa'),auth[_0x6b9c('0xb')](),controller['describe']);router[_0x6b9c('0xc')](_0x6b9c('0xd'),auth[_0x6b9c('0xb')](),controller[_0x6b9c('0xe')]);router[_0x6b9c('0xf')]('/',auth[_0x6b9c('0xb')](),controller[_0x6b9c('0x10')]);router[_0x6b9c('0x11')]('/:id',auth[_0x6b9c('0xb')](),controller[_0x6b9c('0x12')]);router[_0x6b9c('0x13')](_0x6b9c('0xd'),auth[_0x6b9c('0xb')](),controller['destroy']);module[_0x6b9c('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index ab7eea1..a286979 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 _0x3098=['sequelize','STRING','DATE','moment'];(function(_0x1f1bf6,_0x85aafd){var _0x5c99b9=function(_0xc4ea07){while(--_0xc4ea07){_0x1f1bf6['push'](_0x1f1bf6['shift']());}};_0x5c99b9(++_0x85aafd);}(_0x3098,0x117));var _0x8309=function(_0x37ae26,_0x2ecd70){_0x37ae26=_0x37ae26-0x0;var _0x1b1902=_0x3098[_0x37ae26];return _0x1b1902;};'use strict';var moment=require(_0x8309('0x0'));var Sequelize=require(_0x8309('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8309('0x2')]},'joinAt':{'type':Sequelize[_0x8309('0x3')]},'leaveAt':{'type':Sequelize[_0x8309('0x3')]},'acceptAt':{'type':Sequelize[_0x8309('0x3')]},'exitAt':{'type':Sequelize[_0x8309('0x3')]},'reason':{'type':Sequelize[_0x8309('0x2')]}}; \ No newline at end of file +var _0x1a2d=['sequelize','STRING','DATE'];(function(_0x2dc553,_0x2828c3){var _0x480580=function(_0x3a39b5){while(--_0x3a39b5){_0x2dc553['push'](_0x2dc553['shift']());}};_0x480580(++_0x2828c3);}(_0x1a2d,0x144));var _0xd1a2=function(_0x268e74,_0x56fe52){_0x268e74=_0x268e74-0x0;var _0x5c0a30=_0x1a2d[_0x268e74];return _0x5c0a30;};'use strict';var moment=require('moment');var Sequelize=require(_0xd1a2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xd1a2('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xd1a2('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd1a2('0x2')]},'acceptAt':{'type':Sequelize[_0xd1a2('0x2')]},'exitAt':{'type':Sequelize[_0xd1a2('0x2')]},'reason':{'type':Sequelize[_0xd1a2('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index c12af19..99b426e 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 _0x5fa1=['end','status','json','offset','undefined','limit','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','SmsQueueReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','count','include','findAll','show','params','includeAll','options','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4d14c9,_0x18fdc7){var _0x2e6b68=function(_0x353462){while(--_0x353462){_0x4d14c9['push'](_0x4d14c9['shift']());}};_0x2e6b68(++_0x18fdc7);}(_0x5fa1,0xbf));var _0x15fa=function(_0x28648e,_0x5349fe){_0x28648e=_0x28648e-0x0;var _0x27bf60=_0x5fa1[_0x28648e];return _0x27bf60;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x15fa('0x0'));var zipdir=require(_0x15fa('0x1'));var jsonpatch=require(_0x15fa('0x2'));var rp=require(_0x15fa('0x3'));var moment=require('moment');var BPromise=require(_0x15fa('0x4'));var Mustache=require('mustache');var util=require(_0x15fa('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x15fa('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15fa('0x7'));var squel=require(_0x15fa('0x8'));var crypto=require(_0x15fa('0x9'));var jsforce=require(_0x15fa('0xa'));var deskjs=require(_0x15fa('0xb'));var toCsv=require(_0x15fa('0xc'));var querystring=require(_0x15fa('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x15fa('0xe'));var as=require(_0x15fa('0xf'));var hardwareService=require(_0x15fa('0x10'));var logger=require(_0x15fa('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x15fa('0x12'));var licenseUtil=require(_0x15fa('0x13'));var db=require(_0x15fa('0x14'))['db'];function respondWithStatusCode(_0x4eefe8,_0x5c4a86){_0x5c4a86=_0x5c4a86||0xcc;return function(_0x2dd67c){if(_0x2dd67c){return _0x4eefe8[_0x15fa('0x15')](_0x5c4a86);}return _0x4eefe8['status'](_0x5c4a86)[_0x15fa('0x16')]();};}function respondWithResult(_0x55205f,_0x34dfd4){_0x34dfd4=_0x34dfd4||0xc8;return function(_0x4505ca){if(_0x4505ca){return _0x55205f[_0x15fa('0x17')](_0x34dfd4)[_0x15fa('0x18')](_0x4505ca);}};}function respondWithFilteredResult(_0x42e855,_0x3f0306){return function(_0xd5baa1){if(_0xd5baa1){var _0x131a11=typeof _0x3f0306[_0x15fa('0x19')]===_0x15fa('0x1a')&&typeof _0x3f0306[_0x15fa('0x1b')]===_0x15fa('0x1a');var _0x2077bb=_0xd5baa1['count'];var _0xb14f06=_0x131a11?0x0:_0x3f0306['offset'];var _0x3974ff=_0x131a11?_0xd5baa1['count']:_0x3f0306[_0x15fa('0x19')]+_0x3f0306['limit'];var _0x5e8b12;if(_0x3974ff>=_0x2077bb){_0x3974ff=_0x2077bb;_0x5e8b12=0xc8;}else{_0x5e8b12=0xce;}_0x42e855[_0x15fa('0x17')](_0x5e8b12);return _0x42e855['set'](_0x15fa('0x1c'),_0xb14f06+'-'+_0x3974ff+'/'+_0x2077bb)[_0x15fa('0x18')](_0xd5baa1);}return null;};}function patchUpdates(_0x2de026){return function(_0x391047){try{jsonpatch[_0x15fa('0x1d')](_0x391047,_0x2de026,!![]);}catch(_0x47d7b2){return BPromise[_0x15fa('0x1e')](_0x47d7b2);}return _0x391047['save']();};}function saveUpdates(_0x145085,_0x4463d9){return function(_0x5a6cbf){if(_0x5a6cbf){return _0x5a6cbf[_0x15fa('0x1f')](_0x145085)[_0x15fa('0x20')](function(_0x120430){return _0x120430;});}return null;};}function removeEntity(_0x207630,_0x339cff){return function(_0x1cbb92){if(_0x1cbb92){return _0x1cbb92[_0x15fa('0x21')]()['then'](function(){_0x207630[_0x15fa('0x17')](0xcc)[_0x15fa('0x16')]();});}};}function handleEntityNotFound(_0x12763a,_0x5b3e82){return function(_0x24e1b4){if(!_0x24e1b4){_0x12763a[_0x15fa('0x15')](0x194);}return _0x24e1b4;};}function handleError(_0x4feca8,_0x180102){_0x180102=_0x180102||0x1f4;return function(_0xc0aa1f){logger['error'](_0xc0aa1f[_0x15fa('0x22')]);if(_0xc0aa1f[_0x15fa('0x23')]){delete _0xc0aa1f['name'];}_0x4feca8[_0x15fa('0x17')](_0x180102)[_0x15fa('0x24')](_0xc0aa1f);};}exports[_0x15fa('0x25')]=function(_0x3521ef,_0x2ae94b){var _0x39d8cf={},_0x1fe40d={},_0x16134={'count':0x0,'rows':[]};var _0x3253f5=_[_0x15fa('0x26')](db[_0x15fa('0x27')][_0x15fa('0x28')],function(_0x58da0e){return{'name':_0x58da0e['fieldName'],'type':_0x58da0e['type'][_0x15fa('0x29')]};});_0x1fe40d[_0x15fa('0x2a')]=_[_0x15fa('0x26')](_0x3253f5,_0x15fa('0x23'));_0x1fe40d[_0x15fa('0x2b')]=_[_0x15fa('0x2c')](_0x3521ef['query']);_0x1fe40d[_0x15fa('0x2d')]=_[_0x15fa('0x2e')](_0x1fe40d[_0x15fa('0x2a')],_0x1fe40d[_0x15fa('0x2b')]);_0x39d8cf['attributes']=_[_0x15fa('0x2e')](_0x1fe40d[_0x15fa('0x2a')],qs[_0x15fa('0x2f')](_0x3521ef[_0x15fa('0x2b')][_0x15fa('0x2f')]));_0x39d8cf[_0x15fa('0x30')]=_0x39d8cf[_0x15fa('0x30')][_0x15fa('0x31')]?_0x39d8cf['attributes']:_0x1fe40d[_0x15fa('0x2a')];if(!_0x3521ef[_0x15fa('0x2b')][_0x15fa('0x32')](_0x15fa('0x33'))){_0x39d8cf[_0x15fa('0x1b')]=qs[_0x15fa('0x1b')](_0x3521ef[_0x15fa('0x2b')][_0x15fa('0x1b')]);_0x39d8cf[_0x15fa('0x19')]=qs[_0x15fa('0x19')](_0x3521ef[_0x15fa('0x2b')][_0x15fa('0x19')]);}_0x39d8cf[_0x15fa('0x34')]=qs['sort'](_0x3521ef[_0x15fa('0x2b')][_0x15fa('0x35')]);_0x39d8cf[_0x15fa('0x36')]=qs[_0x15fa('0x2d')](_['pick'](_0x3521ef[_0x15fa('0x2b')],_0x1fe40d['filters']),_0x3253f5);if(_0x3521ef[_0x15fa('0x2b')][_0x15fa('0x37')]){_0x39d8cf[_0x15fa('0x36')]=_[_0x15fa('0x38')](_0x39d8cf[_0x15fa('0x36')],{'$or':_[_0x15fa('0x26')](_0x3253f5,function(_0x557b01){if(_0x557b01[_0x15fa('0x39')]!==_0x15fa('0x3a')){var _0x46cebb={};_0x46cebb[_0x557b01[_0x15fa('0x23')]]={'$like':'%'+_0x3521ef['query'][_0x15fa('0x37')]+'%'};return _0x46cebb;}})});}_0x39d8cf=_[_0x15fa('0x38')]({},_0x39d8cf,_0x3521ef['options']);var _0x32ee71={'where':_0x39d8cf[_0x15fa('0x36')]};return db['SmsQueueReport'][_0x15fa('0x3b')](_0x32ee71)[_0x15fa('0x20')](function(_0x34bb6f){_0x16134['count']=_0x34bb6f;if(_0x3521ef['query']['includeAll']){_0x39d8cf[_0x15fa('0x3c')]=[{'all':!![]}];}return db[_0x15fa('0x27')][_0x15fa('0x3d')](_0x39d8cf);})[_0x15fa('0x20')](function(_0x3f78b2){_0x16134['rows']=_0x3f78b2;return _0x16134;})[_0x15fa('0x20')](respondWithFilteredResult(_0x2ae94b,_0x39d8cf))['catch'](handleError(_0x2ae94b,null));};exports[_0x15fa('0x3e')]=function(_0x32a88c,_0x32ec91){var _0x13029d={'raw':!![],'where':{'id':_0x32a88c[_0x15fa('0x3f')]['id']}},_0x3672b2={};_0x3672b2[_0x15fa('0x2a')]=_[_0x15fa('0x2c')](db['SmsQueueReport'][_0x15fa('0x28')]);_0x3672b2[_0x15fa('0x2b')]=_['keys'](_0x32a88c[_0x15fa('0x2b')]);_0x3672b2[_0x15fa('0x2d')]=_[_0x15fa('0x2e')](_0x3672b2['model'],_0x3672b2['query']);_0x13029d[_0x15fa('0x30')]=_['intersection'](_0x3672b2[_0x15fa('0x2a')],qs[_0x15fa('0x2f')](_0x32a88c[_0x15fa('0x2b')][_0x15fa('0x2f')]));_0x13029d['attributes']=_0x13029d[_0x15fa('0x30')]['length']?_0x13029d[_0x15fa('0x30')]:_0x3672b2[_0x15fa('0x2a')];if(_0x32a88c[_0x15fa('0x2b')][_0x15fa('0x40')]){_0x13029d[_0x15fa('0x3c')]=[{'all':!![]}];}_0x13029d=_[_0x15fa('0x38')]({},_0x13029d,_0x32a88c[_0x15fa('0x41')]);return db[_0x15fa('0x27')][_0x15fa('0x42')](_0x13029d)[_0x15fa('0x20')](handleEntityNotFound(_0x32ec91,null))['then'](respondWithResult(_0x32ec91,null))[_0x15fa('0x43')](handleError(_0x32ec91,null));};exports['create']=function(_0x389474,_0x1ec00d){return db[_0x15fa('0x27')][_0x15fa('0x44')](_0x389474[_0x15fa('0x45')],{})[_0x15fa('0x20')](respondWithResult(_0x1ec00d,0xc9))[_0x15fa('0x43')](handleError(_0x1ec00d,null));};exports[_0x15fa('0x1f')]=function(_0x42827d,_0x2104bc){if(_0x42827d['body']['id']){delete _0x42827d[_0x15fa('0x45')]['id'];}return db[_0x15fa('0x27')][_0x15fa('0x42')]({'where':{'id':_0x42827d[_0x15fa('0x3f')]['id']}})[_0x15fa('0x20')](handleEntityNotFound(_0x2104bc,null))['then'](saveUpdates(_0x42827d[_0x15fa('0x45')],null))[_0x15fa('0x20')](respondWithResult(_0x2104bc,null))['catch'](handleError(_0x2104bc,null));};exports['destroy']=function(_0x507547,_0x742d57){return db[_0x15fa('0x27')][_0x15fa('0x42')]({'where':{'id':_0x507547[_0x15fa('0x3f')]['id']}})[_0x15fa('0x20')](handleEntityNotFound(_0x742d57,null))[_0x15fa('0x20')](removeEntity(_0x742d57,null))['catch'](handleError(_0x742d57,null));};exports[_0x15fa('0x46')]=function(_0x403d39,_0x24239e){return db[_0x15fa('0x27')]['describe']()['then'](respondWithResult(_0x24239e,null))['catch'](handleError(_0x24239e,null));}; \ No newline at end of file +var _0xf12c=['jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','error','stack','name','send','index','SmsQueueReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','options','find','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','fs-extra','lodash','squel','crypto'];(function(_0xee71d0,_0x465ead){var _0x3de744=function(_0x4afdbf){while(--_0x4afdbf){_0xee71d0['push'](_0xee71d0['shift']());}};_0x3de744(++_0x465ead);}(_0xf12c,0xcb));var _0xcf12=function(_0x55cb14,_0x1d0c0c){_0x55cb14=_0x55cb14-0x0;var _0x20e5b7=_0xf12c[_0x55cb14];return _0x20e5b7;};'use strict';var emlformat=require(_0xcf12('0x0'));var rimraf=require(_0xcf12('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcf12('0x2'));var rp=require(_0xcf12('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcf12('0x4'));var util=require('util');var path=require('path');var sox=require(_0xcf12('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf12('0x6'));var _=require(_0xcf12('0x7'));var squel=require(_0xcf12('0x8'));var crypto=require(_0xcf12('0x9'));var jsforce=require(_0xcf12('0xa'));var deskjs=require(_0xcf12('0xb'));var toCsv=require(_0xcf12('0xc'));var querystring=require('querystring');var Papa=require(_0xcf12('0xd'));var Redis=require(_0xcf12('0xe'));var authService=require(_0xcf12('0xf'));var qs=require(_0xcf12('0x10'));var as=require(_0xcf12('0x11'));var hardwareService=require(_0xcf12('0x12'));var logger=require(_0xcf12('0x13'))(_0xcf12('0x14'));var utils=require(_0xcf12('0x15'));var config=require(_0xcf12('0x16'));var licenseUtil=require(_0xcf12('0x17'));var db=require(_0xcf12('0x18'))['db'];function respondWithStatusCode(_0x456776,_0x39a381){_0x39a381=_0x39a381||0xcc;return function(_0x18a0d8){if(_0x18a0d8){return _0x456776[_0xcf12('0x19')](_0x39a381);}return _0x456776[_0xcf12('0x1a')](_0x39a381)[_0xcf12('0x1b')]();};}function respondWithResult(_0x45f9cc,_0x3beb7d){_0x3beb7d=_0x3beb7d||0xc8;return function(_0x20e9fe){if(_0x20e9fe){return _0x45f9cc[_0xcf12('0x1a')](_0x3beb7d)[_0xcf12('0x1c')](_0x20e9fe);}};}function respondWithFilteredResult(_0x12805c,_0x19236a){return function(_0x53d4f4){if(_0x53d4f4){var _0x23b42c=typeof _0x19236a['offset']===_0xcf12('0x1d')&&typeof _0x19236a[_0xcf12('0x1e')]===_0xcf12('0x1d');var _0x1af5f4=_0x53d4f4[_0xcf12('0x1f')];var _0x346255=_0x23b42c?0x0:_0x19236a['offset'];var _0x305ce6=_0x23b42c?_0x53d4f4[_0xcf12('0x1f')]:_0x19236a[_0xcf12('0x20')]+_0x19236a[_0xcf12('0x1e')];var _0x19a43a;if(_0x305ce6>=_0x1af5f4){_0x305ce6=_0x1af5f4;_0x19a43a=0xc8;}else{_0x19a43a=0xce;}_0x12805c[_0xcf12('0x1a')](_0x19a43a);return _0x12805c[_0xcf12('0x21')]('Content-Range',_0x346255+'-'+_0x305ce6+'/'+_0x1af5f4)[_0xcf12('0x1c')](_0x53d4f4);}return null;};}function patchUpdates(_0x380a66){return function(_0x3ddf51){try{jsonpatch['apply'](_0x3ddf51,_0x380a66,!![]);}catch(_0x1efe43){return BPromise[_0xcf12('0x22')](_0x1efe43);}return _0x3ddf51[_0xcf12('0x23')]();};}function saveUpdates(_0x27c59c,_0x8e0b17){return function(_0x47dc3b){if(_0x47dc3b){return _0x47dc3b[_0xcf12('0x24')](_0x27c59c)[_0xcf12('0x25')](function(_0x4517ad){return _0x4517ad;});}return null;};}function removeEntity(_0x35e991,_0xc66bd){return function(_0x4565c2){if(_0x4565c2){return _0x4565c2['destroy']()[_0xcf12('0x25')](function(){_0x35e991[_0xcf12('0x1a')](0xcc)[_0xcf12('0x1b')]();});}};}function handleEntityNotFound(_0x3e7a57,_0x106bfb){return function(_0x5c29be){if(!_0x5c29be){_0x3e7a57[_0xcf12('0x19')](0x194);}return _0x5c29be;};}function handleError(_0x5483f2,_0x1ca29a){_0x1ca29a=_0x1ca29a||0x1f4;return function(_0x10b9a7){logger[_0xcf12('0x26')](_0x10b9a7[_0xcf12('0x27')]);if(_0x10b9a7[_0xcf12('0x28')]){delete _0x10b9a7[_0xcf12('0x28')];}_0x5483f2[_0xcf12('0x1a')](_0x1ca29a)[_0xcf12('0x29')](_0x10b9a7);};}exports[_0xcf12('0x2a')]=function(_0x567ead,_0x4223d3){var _0x4eee8b={},_0x528834={},_0x19731a={'count':0x0,'rows':[]};var _0x168093=_['map'](db[_0xcf12('0x2b')][_0xcf12('0x2c')],function(_0x3b1f59){return{'name':_0x3b1f59['fieldName'],'type':_0x3b1f59[_0xcf12('0x2d')][_0xcf12('0x2e')]};});_0x528834[_0xcf12('0x2f')]=_[_0xcf12('0x30')](_0x168093,_0xcf12('0x28'));_0x528834[_0xcf12('0x31')]=_[_0xcf12('0x32')](_0x567ead[_0xcf12('0x31')]);_0x528834[_0xcf12('0x33')]=_[_0xcf12('0x34')](_0x528834[_0xcf12('0x2f')],_0x528834[_0xcf12('0x31')]);_0x4eee8b[_0xcf12('0x35')]=_[_0xcf12('0x34')](_0x528834['model'],qs[_0xcf12('0x36')](_0x567ead['query'][_0xcf12('0x36')]));_0x4eee8b[_0xcf12('0x35')]=_0x4eee8b['attributes']['length']?_0x4eee8b['attributes']:_0x528834[_0xcf12('0x2f')];if(!_0x567ead[_0xcf12('0x31')]['hasOwnProperty'](_0xcf12('0x37'))){_0x4eee8b[_0xcf12('0x1e')]=qs[_0xcf12('0x1e')](_0x567ead[_0xcf12('0x31')][_0xcf12('0x1e')]);_0x4eee8b['offset']=qs[_0xcf12('0x20')](_0x567ead[_0xcf12('0x31')]['offset']);}_0x4eee8b[_0xcf12('0x38')]=qs[_0xcf12('0x39')](_0x567ead['query'][_0xcf12('0x39')]);_0x4eee8b[_0xcf12('0x3a')]=qs[_0xcf12('0x33')](_['pick'](_0x567ead[_0xcf12('0x31')],_0x528834[_0xcf12('0x33')]),_0x168093);if(_0x567ead[_0xcf12('0x31')][_0xcf12('0x3b')]){_0x4eee8b[_0xcf12('0x3a')]=_[_0xcf12('0x3c')](_0x4eee8b['where'],{'$or':_[_0xcf12('0x30')](_0x168093,function(_0x3f707c){if(_0x3f707c[_0xcf12('0x2d')]!=='VIRTUAL'){var _0x53c1cf={};_0x53c1cf[_0x3f707c['name']]={'$like':'%'+_0x567ead[_0xcf12('0x31')][_0xcf12('0x3b')]+'%'};return _0x53c1cf;}})});}_0x4eee8b=_[_0xcf12('0x3c')]({},_0x4eee8b,_0x567ead['options']);var _0x4b7634={'where':_0x4eee8b['where']};return db[_0xcf12('0x2b')][_0xcf12('0x1f')](_0x4b7634)[_0xcf12('0x25')](function(_0x3d2d19){_0x19731a[_0xcf12('0x1f')]=_0x3d2d19;if(_0x567ead[_0xcf12('0x31')][_0xcf12('0x3d')]){_0x4eee8b[_0xcf12('0x3e')]=[{'all':!![]}];}return db[_0xcf12('0x2b')][_0xcf12('0x3f')](_0x4eee8b);})[_0xcf12('0x25')](function(_0x45f1eb){_0x19731a[_0xcf12('0x40')]=_0x45f1eb;return _0x19731a;})[_0xcf12('0x25')](respondWithFilteredResult(_0x4223d3,_0x4eee8b))[_0xcf12('0x41')](handleError(_0x4223d3,null));};exports['show']=function(_0x511033,_0x4d2b7d){var _0x22afe9={'raw':!![],'where':{'id':_0x511033['params']['id']}},_0x3fb14f={};_0x3fb14f[_0xcf12('0x2f')]=_[_0xcf12('0x32')](db[_0xcf12('0x2b')][_0xcf12('0x2c')]);_0x3fb14f[_0xcf12('0x31')]=_[_0xcf12('0x32')](_0x511033[_0xcf12('0x31')]);_0x3fb14f[_0xcf12('0x33')]=_[_0xcf12('0x34')](_0x3fb14f[_0xcf12('0x2f')],_0x3fb14f[_0xcf12('0x31')]);_0x22afe9[_0xcf12('0x35')]=_[_0xcf12('0x34')](_0x3fb14f[_0xcf12('0x2f')],qs['fields'](_0x511033[_0xcf12('0x31')][_0xcf12('0x36')]));_0x22afe9['attributes']=_0x22afe9[_0xcf12('0x35')]['length']?_0x22afe9[_0xcf12('0x35')]:_0x3fb14f[_0xcf12('0x2f')];if(_0x511033[_0xcf12('0x31')][_0xcf12('0x3d')]){_0x22afe9[_0xcf12('0x3e')]=[{'all':!![]}];}_0x22afe9=_[_0xcf12('0x3c')]({},_0x22afe9,_0x511033[_0xcf12('0x42')]);return db['SmsQueueReport'][_0xcf12('0x43')](_0x22afe9)['then'](handleEntityNotFound(_0x4d2b7d,null))[_0xcf12('0x25')](respondWithResult(_0x4d2b7d,null))['catch'](handleError(_0x4d2b7d,null));};exports['create']=function(_0x57a318,_0x22d8d3){return db[_0xcf12('0x2b')]['create'](_0x57a318[_0xcf12('0x44')],{})[_0xcf12('0x25')](respondWithResult(_0x22d8d3,0xc9))[_0xcf12('0x41')](handleError(_0x22d8d3,null));};exports['update']=function(_0x265d62,_0x4c2bcc){if(_0x265d62[_0xcf12('0x44')]['id']){delete _0x265d62[_0xcf12('0x44')]['id'];}return db[_0xcf12('0x2b')]['find']({'where':{'id':_0x265d62[_0xcf12('0x45')]['id']}})['then'](handleEntityNotFound(_0x4c2bcc,null))[_0xcf12('0x25')](saveUpdates(_0x265d62[_0xcf12('0x44')],null))[_0xcf12('0x25')](respondWithResult(_0x4c2bcc,null))[_0xcf12('0x41')](handleError(_0x4c2bcc,null));};exports['destroy']=function(_0x42c053,_0x171346){return db[_0xcf12('0x2b')][_0xcf12('0x43')]({'where':{'id':_0x42c053[_0xcf12('0x45')]['id']}})['then'](handleEntityNotFound(_0x171346,null))[_0xcf12('0x25')](removeEntity(_0x171346,null))[_0xcf12('0x41')](handleError(_0x171346,null));};exports[_0xcf12('0x46')]=function(_0xfdcf0a,_0x52213e){return db[_0xcf12('0x2b')][_0xcf12('0x46')]()[_0xcf12('0x25')](respondWithResult(_0x52213e,null))[_0xcf12('0x41')](handleError(_0x52213e,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 3c3d841..3c5eb71 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x2e58c7,_0x23d092){var _0x26eb00=function(_0x343124){while(--_0x343124){_0x2e58c7['push'](_0x2e58c7['shift']());}};_0x26eb00(++_0x23d092);}(_0xe706,0xa3));var _0x6e70=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0xe706[_0x4e5552];return _0x60a338;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index ff16b18..b79f5bc 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 _0x9347=['jayson/promise','client','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSmsQueueReport','body','raw','then','catch','UpdateSmsQueueReport','update','options','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0x9347,0x119));var _0x7934=function(_0x1166d3,_0x5b8f38){_0x1166d3=_0x1166d3-0x0;var _0x2b0a5b=_0x9347[_0x1166d3];return _0x2b0a5b;};'use strict';var _=require(_0x7934('0x0'));var util=require(_0x7934('0x1'));var moment=require(_0x7934('0x2'));var BPromise=require(_0x7934('0x3'));var rs=require(_0x7934('0x4'));var fs=require('fs');var Redis=require(_0x7934('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7934('0x6'));var logger=require('../../config/logger')(_0x7934('0x7'));var config=require(_0x7934('0x8'));var jayson=require(_0x7934('0x9'));var client=jayson[_0x7934('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d532e,_0x3ab94e,_0x5d0a25){return new BPromise(function(_0x121a46,_0x2b90aa){return client['request'](_0x1d532e,_0x5d0a25)['then'](function(_0x41a027){logger[_0x7934('0xb')](_0x7934('0xc'),_0x3ab94e,_0x7934('0xd'));logger[_0x7934('0xe')](_0x7934('0xf'),_0x3ab94e,_0x7934('0xd'),JSON[_0x7934('0x10')](_0x41a027));if(_0x41a027[_0x7934('0x11')]){if(_0x41a027[_0x7934('0x11')]['code']===0x1f4){logger[_0x7934('0x11')](_0x7934('0xc'),_0x3ab94e,_0x41a027[_0x7934('0x11')][_0x7934('0x12')]);return _0x2b90aa(_0x41a027[_0x7934('0x11')][_0x7934('0x12')]);}logger['error'](_0x7934('0xc'),_0x3ab94e,_0x41a027[_0x7934('0x11')][_0x7934('0x12')]);return _0x121a46(_0x41a027[_0x7934('0x11')][_0x7934('0x12')]);}else{logger[_0x7934('0xb')](_0x7934('0xc'),_0x3ab94e,_0x7934('0xd'));_0x121a46(_0x41a027[_0x7934('0x13')][_0x7934('0x12')]);}})['catch'](function(_0x373013){logger[_0x7934('0x11')](_0x7934('0xc'),_0x3ab94e,_0x373013);_0x2b90aa(_0x373013);});});}exports[_0x7934('0x14')]=function(_0x1226db){var _0x57e002=this;return new Promise(function(_0x18747b,_0x4b91d5){return db['SmsQueueReport']['create'](_0x1226db[_0x7934('0x15')],{'raw':_0x1226db['options']?_0x1226db['options'][_0x7934('0x16')]===undefined?!![]:![]:!![]})[_0x7934('0x17')](function(_0x53e3fc){logger['info']('CreateSmsQueueReport',_0x1226db);logger[_0x7934('0xe')](_0x7934('0x14'),_0x1226db,JSON[_0x7934('0x10')](_0x53e3fc));_0x18747b(_0x53e3fc);})[_0x7934('0x18')](function(_0x4dd0cd){logger[_0x7934('0x11')](_0x7934('0x14'),_0x4dd0cd['message'],_0x1226db);_0x4b91d5(_0x57e002[_0x7934('0x11')](0x1f4,_0x4dd0cd['message']));});});};exports[_0x7934('0x19')]=function(_0x461e2c){var _0x2716a8=this;return new Promise(function(_0x4949d9,_0x321ca0){return db['SmsQueueReport'][_0x7934('0x1a')](_0x461e2c['body'],{'raw':_0x461e2c[_0x7934('0x1b')]?_0x461e2c[_0x7934('0x1b')][_0x7934('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x461e2c[_0x7934('0x1b')]?_0x461e2c[_0x7934('0x1b')][_0x7934('0x1c')]||null:null,'attributes':_0x461e2c['options']?_0x461e2c[_0x7934('0x1b')]['attributes']||null:null,'limit':_0x461e2c[_0x7934('0x1b')]?_0x461e2c['options']['limit']||null:null})[_0x7934('0x17')](function(_0x3fe5e5){logger[_0x7934('0xb')](_0x7934('0x19'),_0x461e2c);logger[_0x7934('0xe')](_0x7934('0x19'),_0x461e2c,JSON['stringify'](_0x3fe5e5));_0x4949d9(_0x3fe5e5);})[_0x7934('0x18')](function(_0x2d3859){logger[_0x7934('0x11')]('UpdateSmsQueueReport',_0x2d3859[_0x7934('0x12')],_0x461e2c);_0x321ca0(_0x2716a8[_0x7934('0x11')](0x1f4,_0x2d3859[_0x7934('0x12')]));});});}; \ No newline at end of file +var _0x8947=['UpdateSmsQueueReport','update','raw','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options'];(function(_0x6d1093,_0x4a45b5){var _0x3ae40a=function(_0x2adcbb){while(--_0x2adcbb){_0x6d1093['push'](_0x6d1093['shift']());}};_0x3ae40a(++_0x4a45b5);}(_0x8947,0x1d5));var _0x7894=function(_0x41db2d,_0x44b304){_0x41db2d=_0x41db2d-0x0;var _0x5a9136=_0x8947[_0x41db2d];return _0x5a9136;};'use strict';var _=require(_0x7894('0x0'));var util=require(_0x7894('0x1'));var moment=require('moment');var BPromise=require(_0x7894('0x2'));var rs=require(_0x7894('0x3'));var fs=require('fs');var Redis=require(_0x7894('0x4'));var db=require(_0x7894('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7894('0x6'))(_0x7894('0x7'));var config=require('../../config/environment');var jayson=require(_0x7894('0x8'));var client=jayson[_0x7894('0x9')][_0x7894('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b5b79,_0x32a511,_0x507dab){return new BPromise(function(_0x3f47c9,_0x339264){return client['request'](_0x5b5b79,_0x507dab)[_0x7894('0xb')](function(_0x1299bd){logger[_0x7894('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x32a511,_0x7894('0xd'));logger[_0x7894('0xe')](_0x7894('0xf'),_0x32a511,_0x7894('0xd'),JSON[_0x7894('0x10')](_0x1299bd));if(_0x1299bd[_0x7894('0x11')]){if(_0x1299bd[_0x7894('0x11')]['code']===0x1f4){logger[_0x7894('0x11')](_0x7894('0x12'),_0x32a511,_0x1299bd['error'][_0x7894('0x13')]);return _0x339264(_0x1299bd[_0x7894('0x11')][_0x7894('0x13')]);}logger[_0x7894('0x11')](_0x7894('0x12'),_0x32a511,_0x1299bd['error'][_0x7894('0x13')]);return _0x3f47c9(_0x1299bd[_0x7894('0x11')][_0x7894('0x13')]);}else{logger[_0x7894('0xc')](_0x7894('0x12'),_0x32a511,'request\x20sent');_0x3f47c9(_0x1299bd[_0x7894('0x14')][_0x7894('0x13')]);}})[_0x7894('0x15')](function(_0x1c295d){logger[_0x7894('0x11')](_0x7894('0x12'),_0x32a511,_0x1c295d);_0x339264(_0x1c295d);});});}exports[_0x7894('0x16')]=function(_0x11e8c9){var _0x58c7d3=this;return new Promise(function(_0x21310e,_0x2d5adc){return db[_0x7894('0x17')][_0x7894('0x18')](_0x11e8c9[_0x7894('0x19')],{'raw':_0x11e8c9['options']?_0x11e8c9[_0x7894('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x7894('0xb')](function(_0x1d801b){logger[_0x7894('0xc')](_0x7894('0x16'),_0x11e8c9);logger[_0x7894('0xe')]('CreateSmsQueueReport',_0x11e8c9,JSON[_0x7894('0x10')](_0x1d801b));_0x21310e(_0x1d801b);})[_0x7894('0x15')](function(_0xcfb41f){logger[_0x7894('0x11')](_0x7894('0x16'),_0xcfb41f[_0x7894('0x13')],_0x11e8c9);_0x2d5adc(_0x58c7d3[_0x7894('0x11')](0x1f4,_0xcfb41f['message']));});});};exports[_0x7894('0x1b')]=function(_0x1689ea){var _0x2bdf16=this;return new Promise(function(_0x4077f4,_0x394af8){return db[_0x7894('0x17')][_0x7894('0x1c')](_0x1689ea[_0x7894('0x19')],{'raw':_0x1689ea[_0x7894('0x1a')]?_0x1689ea[_0x7894('0x1a')][_0x7894('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1689ea[_0x7894('0x1a')]?_0x1689ea[_0x7894('0x1a')]['where']||null:null,'attributes':_0x1689ea['options']?_0x1689ea[_0x7894('0x1a')]['attributes']||null:null,'limit':_0x1689ea[_0x7894('0x1a')]?_0x1689ea['options'][_0x7894('0x1e')]||null:null})[_0x7894('0xb')](function(_0x289e6d){logger['info'](_0x7894('0x1b'),_0x1689ea);logger[_0x7894('0xe')](_0x7894('0x1b'),_0x1689ea,JSON[_0x7894('0x10')](_0x289e6d));_0x4077f4(_0x289e6d);})[_0x7894('0x15')](function(_0x3c2064){logger['error'](_0x7894('0x1b'),_0x3c2064['message'],_0x1689ea);_0x394af8(_0x2bdf16[_0x7894('0x11')](0x1f4,_0x3c2064[_0x7894('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index befd137..6c4a787 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 _0xe14b=['delete','destroy','exports','multer','util','express','Router','../../components/auth/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','show','post','/:id'];(function(_0x579b7b,_0x5f1629){var _0x35ee78=function(_0x2bc59e){while(--_0x2bc59e){_0x579b7b['push'](_0x579b7b['shift']());}};_0x35ee78(++_0x5f1629);}(_0xe14b,0x93));var _0xbe14=function(_0x5bb6ce,_0x1a7ed8){_0x5bb6ce=_0x5bb6ce-0x0;var _0x22d5b5=_0xe14b[_0x5bb6ce];return _0x22d5b5;};'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('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xd')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xe')]);module[_0xbe14('0xf')]=router; \ No newline at end of file +var _0x0bde=['get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller'];(function(_0x50003d,_0x4250c2){var _0x20b6ca=function(_0x469f5b){while(--_0x469f5b){_0x50003d['push'](_0x50003d['shift']());}};_0x20b6ca(++_0x4250c2);}(_0x0bde,0x110));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xe0bd('0x0'));var util=require('util');var path=require(_0xe0bd('0x1'));var timeout=require(_0xe0bd('0x2'));var express=require('express');var router=express[_0xe0bd('0x3')]();var fs_extra=require(_0xe0bd('0x4'));var auth=require(_0xe0bd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe0bd('0x6'));var controller=require(_0xe0bd('0x7'));router[_0xe0bd('0x8')]('/',auth[_0xe0bd('0x9')](),controller[_0xe0bd('0xa')]);router[_0xe0bd('0x8')](_0xe0bd('0xb'),auth[_0xe0bd('0x9')](),controller[_0xe0bd('0xc')]);router[_0xe0bd('0x8')](_0xe0bd('0xd'),auth[_0xe0bd('0x9')](),controller[_0xe0bd('0xe')]);router['post']('/',auth[_0xe0bd('0x9')](),controller[_0xe0bd('0xf')]);router['put'](_0xe0bd('0xd'),auth['isAuthenticated'](),controller[_0xe0bd('0x10')]);router[_0xe0bd('0x11')](_0xe0bd('0xd'),auth[_0xe0bd('0x9')](),controller[_0xe0bd('0x12')]);module[_0xe0bd('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index d59a895..f45fb63 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x168c60,_0x539d96){var _0x29bea4=function(_0x1f7f4e){while(--_0x1f7f4e){_0x168c60['push'](_0x168c60['shift']());}};_0x29bea4(++_0x539d96);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x7d5a8b,_0x2aedef){var _0x56ac46=function(_0x55a1ab){while(--_0x55a1ab){_0x7d5a8b['push'](_0x7d5a8b['shift']());}};_0x56ac46(++_0x2aedef);}(_0x54ef,0x112));var _0xf54e=function(_0x501da0,_0x5da923){_0x501da0=_0x501da0-0x0;var _0xca1007=_0x54ef[_0x501da0];return _0xca1007;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 0af77f4..5f6e1ce 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 _0x2310=['then','destroy','name','map','SmsTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update'];(function(_0x17081c,_0x1f4856){var _0x369ea3=function(_0x1a1425){while(--_0x1a1425){_0x17081c['push'](_0x17081c['shift']());}};_0x369ea3(++_0x1f4856);}(_0x2310,0x157));var _0x0231=function(_0x28cde3,_0x5d4fc6){_0x28cde3=_0x28cde3-0x0;var _0x2dba45=_0x2310[_0x28cde3];return _0x2dba45;};'use strict';var emlformat=require(_0x0231('0x0'));var rimraf=require(_0x0231('0x1'));var zipdir=require(_0x0231('0x2'));var jsonpatch=require(_0x0231('0x3'));var rp=require(_0x0231('0x4'));var moment=require(_0x0231('0x5'));var BPromise=require(_0x0231('0x6'));var Mustache=require(_0x0231('0x7'));var util=require(_0x0231('0x8'));var path=require(_0x0231('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0231('0xa'));var _=require('lodash');var squel=require(_0x0231('0xb'));var crypto=require(_0x0231('0xc'));var jsforce=require(_0x0231('0xd'));var deskjs=require(_0x0231('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0231('0xf'));var Papa=require(_0x0231('0x10'));var Redis=require(_0x0231('0x11'));var authService=require(_0x0231('0x12'));var qs=require(_0x0231('0x13'));var as=require(_0x0231('0x14'));var hardwareService=require(_0x0231('0x15'));var logger=require(_0x0231('0x16'))(_0x0231('0x17'));var utils=require(_0x0231('0x18'));var config=require(_0x0231('0x19'));var licenseUtil=require(_0x0231('0x1a'));var db=require(_0x0231('0x1b'))['db'];function respondWithStatusCode(_0x2eab0d,_0x26ae69){_0x26ae69=_0x26ae69||0xcc;return function(_0x155500){if(_0x155500){return _0x2eab0d[_0x0231('0x1c')](_0x26ae69);}return _0x2eab0d[_0x0231('0x1d')](_0x26ae69)[_0x0231('0x1e')]();};}function respondWithResult(_0xa74e15,_0x36e92f){_0x36e92f=_0x36e92f||0xc8;return function(_0x31660a){if(_0x31660a){return _0xa74e15[_0x0231('0x1d')](_0x36e92f)['json'](_0x31660a);}};}function respondWithFilteredResult(_0x360dd1,_0x2c31c8){return function(_0x5ed5ec){if(_0x5ed5ec){var _0x2abe19=typeof _0x2c31c8['offset']===_0x0231('0x1f')&&typeof _0x2c31c8[_0x0231('0x20')]==='undefined';var _0x4a8058=_0x5ed5ec[_0x0231('0x21')];var _0x172fc1=_0x2abe19?0x0:_0x2c31c8['offset'];var _0x237fcb=_0x2abe19?_0x5ed5ec['count']:_0x2c31c8[_0x0231('0x22')]+_0x2c31c8['limit'];var _0x4c63c3;if(_0x237fcb>=_0x4a8058){_0x237fcb=_0x4a8058;_0x4c63c3=0xc8;}else{_0x4c63c3=0xce;}_0x360dd1['status'](_0x4c63c3);return _0x360dd1[_0x0231('0x23')](_0x0231('0x24'),_0x172fc1+'-'+_0x237fcb+'/'+_0x4a8058)[_0x0231('0x25')](_0x5ed5ec);}return null;};}function patchUpdates(_0x5a7b54){return function(_0x583e78){try{jsonpatch[_0x0231('0x26')](_0x583e78,_0x5a7b54,!![]);}catch(_0x4458ea){return BPromise[_0x0231('0x27')](_0x4458ea);}return _0x583e78[_0x0231('0x28')]();};}function saveUpdates(_0x3e7ee6,_0x4cccfa){return function(_0x4e45e5){if(_0x4e45e5){return _0x4e45e5[_0x0231('0x29')](_0x3e7ee6)[_0x0231('0x2a')](function(_0x490d21){return _0x490d21;});}return null;};}function removeEntity(_0x252bf3,_0x141e82){return function(_0xe14a37){if(_0xe14a37){return _0xe14a37[_0x0231('0x2b')]()[_0x0231('0x2a')](function(){_0x252bf3[_0x0231('0x1d')](0xcc)[_0x0231('0x1e')]();});}};}function handleEntityNotFound(_0x41359e,_0x3b0663){return function(_0x474935){if(!_0x474935){_0x41359e[_0x0231('0x1c')](0x194);}return _0x474935;};}function handleError(_0x484649,_0x304892){_0x304892=_0x304892||0x1f4;return function(_0x34a483){logger['error'](_0x34a483['stack']);if(_0x34a483['name']){delete _0x34a483[_0x0231('0x2c')];}_0x484649[_0x0231('0x1d')](_0x304892)['send'](_0x34a483);};}exports['index']=function(_0x13effb,_0x2180af){var _0x57cf0f={},_0x522b62={},_0x72a771={'count':0x0,'rows':[]};var _0x41f2ba=_[_0x0231('0x2d')](db[_0x0231('0x2e')][_0x0231('0x2f')],function(_0x19835c){return{'name':_0x19835c[_0x0231('0x30')],'type':_0x19835c[_0x0231('0x31')]['key']};});_0x522b62[_0x0231('0x32')]=_[_0x0231('0x2d')](_0x41f2ba,'name');_0x522b62['query']=_[_0x0231('0x33')](_0x13effb[_0x0231('0x34')]);_0x522b62[_0x0231('0x35')]=_['intersection'](_0x522b62[_0x0231('0x32')],_0x522b62['query']);_0x57cf0f['attributes']=_[_0x0231('0x36')](_0x522b62[_0x0231('0x32')],qs[_0x0231('0x37')](_0x13effb[_0x0231('0x34')][_0x0231('0x37')]));_0x57cf0f[_0x0231('0x38')]=_0x57cf0f[_0x0231('0x38')][_0x0231('0x39')]?_0x57cf0f[_0x0231('0x38')]:_0x522b62[_0x0231('0x32')];if(!_0x13effb[_0x0231('0x34')][_0x0231('0x3a')](_0x0231('0x3b'))){_0x57cf0f[_0x0231('0x20')]=qs[_0x0231('0x20')](_0x13effb['query'][_0x0231('0x20')]);_0x57cf0f[_0x0231('0x22')]=qs['offset'](_0x13effb[_0x0231('0x34')]['offset']);}_0x57cf0f[_0x0231('0x3c')]=qs[_0x0231('0x3d')](_0x13effb[_0x0231('0x34')][_0x0231('0x3d')]);_0x57cf0f[_0x0231('0x3e')]=qs[_0x0231('0x35')](_[_0x0231('0x3f')](_0x13effb['query'],_0x522b62[_0x0231('0x35')]),_0x41f2ba);if(_0x13effb[_0x0231('0x34')][_0x0231('0x40')]){_0x57cf0f[_0x0231('0x3e')]=_['merge'](_0x57cf0f['where'],{'$or':_[_0x0231('0x2d')](_0x41f2ba,function(_0x3bcf61){if(_0x3bcf61['type']!=='VIRTUAL'){var _0x53e7d0={};_0x53e7d0[_0x3bcf61['name']]={'$like':'%'+_0x13effb['query'][_0x0231('0x40')]+'%'};return _0x53e7d0;}})});}_0x57cf0f=_[_0x0231('0x41')]({},_0x57cf0f,_0x13effb[_0x0231('0x42')]);var _0x57f1f3={'where':_0x57cf0f[_0x0231('0x3e')]};return db[_0x0231('0x2e')]['count'](_0x57f1f3)[_0x0231('0x2a')](function(_0x452595){_0x72a771[_0x0231('0x21')]=_0x452595;if(_0x13effb['query'][_0x0231('0x43')]){_0x57cf0f[_0x0231('0x44')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x0231('0x45')](_0x57cf0f);})[_0x0231('0x2a')](function(_0x24926d){_0x72a771[_0x0231('0x46')]=_0x24926d;return _0x72a771;})[_0x0231('0x2a')](respondWithFilteredResult(_0x2180af,_0x57cf0f))[_0x0231('0x47')](handleError(_0x2180af,null));};exports[_0x0231('0x48')]=function(_0x3f9935,_0x5d6069){var _0x47d801={'raw':!![],'where':{'id':_0x3f9935['params']['id']}},_0x100766={};_0x100766[_0x0231('0x32')]=_[_0x0231('0x33')](db[_0x0231('0x2e')][_0x0231('0x2f')]);_0x100766[_0x0231('0x34')]=_[_0x0231('0x33')](_0x3f9935['query']);_0x100766[_0x0231('0x35')]=_[_0x0231('0x36')](_0x100766[_0x0231('0x32')],_0x100766[_0x0231('0x34')]);_0x47d801[_0x0231('0x38')]=_[_0x0231('0x36')](_0x100766['model'],qs['fields'](_0x3f9935[_0x0231('0x34')][_0x0231('0x37')]));_0x47d801[_0x0231('0x38')]=_0x47d801['attributes'][_0x0231('0x39')]?_0x47d801[_0x0231('0x38')]:_0x100766['model'];if(_0x3f9935[_0x0231('0x34')][_0x0231('0x43')]){_0x47d801[_0x0231('0x44')]=[{'all':!![]}];}_0x47d801=_[_0x0231('0x41')]({},_0x47d801,_0x3f9935[_0x0231('0x42')]);return db[_0x0231('0x2e')][_0x0231('0x49')](_0x47d801)[_0x0231('0x2a')](handleEntityNotFound(_0x5d6069,null))[_0x0231('0x2a')](respondWithResult(_0x5d6069,null))[_0x0231('0x47')](handleError(_0x5d6069,null));};exports[_0x0231('0x4a')]=function(_0x1bbb12,_0x106317){return db[_0x0231('0x2e')]['create'](_0x1bbb12[_0x0231('0x4b')],{})[_0x0231('0x2a')](respondWithResult(_0x106317,0xc9))[_0x0231('0x47')](handleError(_0x106317,null));};exports['update']=function(_0x1afeb6,_0x44a3c8){if(_0x1afeb6['body']['id']){delete _0x1afeb6[_0x0231('0x4b')]['id'];}return db[_0x0231('0x2e')][_0x0231('0x49')]({'where':{'id':_0x1afeb6[_0x0231('0x4c')]['id']}})[_0x0231('0x2a')](handleEntityNotFound(_0x44a3c8,null))[_0x0231('0x2a')](saveUpdates(_0x1afeb6[_0x0231('0x4b')],null))[_0x0231('0x2a')](respondWithResult(_0x44a3c8,null))[_0x0231('0x47')](handleError(_0x44a3c8,null));};exports['destroy']=function(_0x25b7ee,_0x35ea0e){return db[_0x0231('0x2e')]['find']({'where':{'id':_0x25b7ee['params']['id']}})[_0x0231('0x2a')](handleEntityNotFound(_0x35ea0e,null))[_0x0231('0x2a')](removeEntity(_0x35ea0e,null))[_0x0231('0x47')](handleError(_0x35ea0e,null));};exports['describe']=function(_0x15f9de,_0x479f29){return db[_0x0231('0x2e')]['describe']()[_0x0231('0x2a')](respondWithResult(_0x479f29,null))['catch'](handleError(_0x479f29,null));}; \ No newline at end of file +var _0x2931=['nolimit','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','options','find','create','body','update','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','destroy','then','error','stack','name','index','SmsTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x323648,_0x338c50){var _0x57d69b=function(_0x2c75e7){while(--_0x2c75e7){_0x323648['push'](_0x323648['shift']());}};_0x57d69b(++_0x338c50);}(_0x2931,0xa6));var _0x1293=function(_0x46207d,_0xf36a4c){_0x46207d=_0x46207d-0x0;var _0xf13991=_0x2931[_0x46207d];return _0xf13991;};'use strict';var emlformat=require(_0x1293('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1293('0x1'));var rp=require(_0x1293('0x2'));var moment=require(_0x1293('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1293('0x4'));var util=require(_0x1293('0x5'));var path=require(_0x1293('0x6'));var sox=require(_0x1293('0x7'));var csv=require(_0x1293('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1293('0x9'));var _=require(_0x1293('0xa'));var squel=require(_0x1293('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1293('0x8'));var querystring=require(_0x1293('0xc'));var Papa=require(_0x1293('0xd'));var Redis=require(_0x1293('0xe'));var authService=require(_0x1293('0xf'));var qs=require(_0x1293('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1293('0x11'));var logger=require(_0x1293('0x12'))(_0x1293('0x13'));var utils=require('../../config/utils');var config=require(_0x1293('0x14'));var licenseUtil=require(_0x1293('0x15'));var db=require(_0x1293('0x16'))['db'];function respondWithStatusCode(_0xfb60c3,_0x3920e9){_0x3920e9=_0x3920e9||0xcc;return function(_0x3bd927){if(_0x3bd927){return _0xfb60c3[_0x1293('0x17')](_0x3920e9);}return _0xfb60c3['status'](_0x3920e9)[_0x1293('0x18')]();};}function respondWithResult(_0x157abd,_0x5f047c){_0x5f047c=_0x5f047c||0xc8;return function(_0x3b31ab){if(_0x3b31ab){return _0x157abd['status'](_0x5f047c)[_0x1293('0x19')](_0x3b31ab);}};}function respondWithFilteredResult(_0xba72dc,_0x7ca5c7){return function(_0x28c2c0){if(_0x28c2c0){var _0x56b3e1=typeof _0x7ca5c7['offset']===_0x1293('0x1a')&&typeof _0x7ca5c7[_0x1293('0x1b')]===_0x1293('0x1a');var _0x48ae4d=_0x28c2c0[_0x1293('0x1c')];var _0x2e6415=_0x56b3e1?0x0:_0x7ca5c7[_0x1293('0x1d')];var _0x5a4d70=_0x56b3e1?_0x28c2c0[_0x1293('0x1c')]:_0x7ca5c7[_0x1293('0x1d')]+_0x7ca5c7[_0x1293('0x1b')];var _0x53a4ea;if(_0x5a4d70>=_0x48ae4d){_0x5a4d70=_0x48ae4d;_0x53a4ea=0xc8;}else{_0x53a4ea=0xce;}_0xba72dc[_0x1293('0x1e')](_0x53a4ea);return _0xba72dc[_0x1293('0x1f')](_0x1293('0x20'),_0x2e6415+'-'+_0x5a4d70+'/'+_0x48ae4d)[_0x1293('0x19')](_0x28c2c0);}return null;};}function patchUpdates(_0x2f1b82){return function(_0xaae3cb){try{jsonpatch[_0x1293('0x21')](_0xaae3cb,_0x2f1b82,!![]);}catch(_0x4d5882){return BPromise[_0x1293('0x22')](_0x4d5882);}return _0xaae3cb['save']();};}function saveUpdates(_0x1841d9,_0x318e8a){return function(_0x779f9e){if(_0x779f9e){return _0x779f9e['update'](_0x1841d9)['then'](function(_0x32038a){return _0x32038a;});}return null;};}function removeEntity(_0x3af686,_0x35ecd3){return function(_0x1a5c46){if(_0x1a5c46){return _0x1a5c46[_0x1293('0x23')]()[_0x1293('0x24')](function(){_0x3af686[_0x1293('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bdebe,_0xed59e3){return function(_0x313bc1){if(!_0x313bc1){_0x2bdebe['sendStatus'](0x194);}return _0x313bc1;};}function handleError(_0x531cf5,_0x551753){_0x551753=_0x551753||0x1f4;return function(_0x5aeba2){logger[_0x1293('0x25')](_0x5aeba2[_0x1293('0x26')]);if(_0x5aeba2[_0x1293('0x27')]){delete _0x5aeba2['name'];}_0x531cf5[_0x1293('0x1e')](_0x551753)['send'](_0x5aeba2);};}exports[_0x1293('0x28')]=function(_0xaa8b6d,_0x26e86c){var _0x2f2fcb={},_0x2aff92={},_0x1a4132={'count':0x0,'rows':[]};var _0x89f8e6=_['map'](db[_0x1293('0x29')][_0x1293('0x2a')],function(_0x30cc84){return{'name':_0x30cc84[_0x1293('0x2b')],'type':_0x30cc84[_0x1293('0x2c')][_0x1293('0x2d')]};});_0x2aff92[_0x1293('0x2e')]=_[_0x1293('0x2f')](_0x89f8e6,_0x1293('0x27'));_0x2aff92[_0x1293('0x30')]=_[_0x1293('0x31')](_0xaa8b6d[_0x1293('0x30')]);_0x2aff92[_0x1293('0x32')]=_[_0x1293('0x33')](_0x2aff92['model'],_0x2aff92[_0x1293('0x30')]);_0x2f2fcb[_0x1293('0x34')]=_[_0x1293('0x33')](_0x2aff92[_0x1293('0x2e')],qs[_0x1293('0x35')](_0xaa8b6d['query'][_0x1293('0x35')]));_0x2f2fcb[_0x1293('0x34')]=_0x2f2fcb[_0x1293('0x34')][_0x1293('0x36')]?_0x2f2fcb['attributes']:_0x2aff92[_0x1293('0x2e')];if(!_0xaa8b6d['query'][_0x1293('0x37')](_0x1293('0x38'))){_0x2f2fcb['limit']=qs[_0x1293('0x1b')](_0xaa8b6d['query'][_0x1293('0x1b')]);_0x2f2fcb[_0x1293('0x1d')]=qs[_0x1293('0x1d')](_0xaa8b6d[_0x1293('0x30')][_0x1293('0x1d')]);}_0x2f2fcb['order']=qs[_0x1293('0x39')](_0xaa8b6d[_0x1293('0x30')]['sort']);_0x2f2fcb[_0x1293('0x3a')]=qs[_0x1293('0x32')](_[_0x1293('0x3b')](_0xaa8b6d[_0x1293('0x30')],_0x2aff92[_0x1293('0x32')]),_0x89f8e6);if(_0xaa8b6d[_0x1293('0x30')][_0x1293('0x3c')]){_0x2f2fcb['where']=_[_0x1293('0x3d')](_0x2f2fcb[_0x1293('0x3a')],{'$or':_['map'](_0x89f8e6,function(_0x56ab52){if(_0x56ab52[_0x1293('0x2c')]!=='VIRTUAL'){var _0x4e655c={};_0x4e655c[_0x56ab52['name']]={'$like':'%'+_0xaa8b6d[_0x1293('0x30')][_0x1293('0x3c')]+'%'};return _0x4e655c;}})});}_0x2f2fcb=_[_0x1293('0x3d')]({},_0x2f2fcb,_0xaa8b6d['options']);var _0x2d8d0b={'where':_0x2f2fcb['where']};return db[_0x1293('0x29')][_0x1293('0x1c')](_0x2d8d0b)[_0x1293('0x24')](function(_0x10b202){_0x1a4132[_0x1293('0x1c')]=_0x10b202;if(_0xaa8b6d[_0x1293('0x30')][_0x1293('0x3e')]){_0x2f2fcb['include']=[{'all':!![]}];}return db[_0x1293('0x29')][_0x1293('0x3f')](_0x2f2fcb);})[_0x1293('0x24')](function(_0x54aca6){_0x1a4132[_0x1293('0x40')]=_0x54aca6;return _0x1a4132;})[_0x1293('0x24')](respondWithFilteredResult(_0x26e86c,_0x2f2fcb))[_0x1293('0x41')](handleError(_0x26e86c,null));};exports[_0x1293('0x42')]=function(_0x18b613,_0x3122b9){var _0x555424={'raw':!![],'where':{'id':_0x18b613[_0x1293('0x43')]['id']}},_0x3b7da6={};_0x3b7da6[_0x1293('0x2e')]=_[_0x1293('0x31')](db[_0x1293('0x29')][_0x1293('0x2a')]);_0x3b7da6['query']=_[_0x1293('0x31')](_0x18b613[_0x1293('0x30')]);_0x3b7da6[_0x1293('0x32')]=_[_0x1293('0x33')](_0x3b7da6[_0x1293('0x2e')],_0x3b7da6[_0x1293('0x30')]);_0x555424[_0x1293('0x34')]=_['intersection'](_0x3b7da6['model'],qs[_0x1293('0x35')](_0x18b613[_0x1293('0x30')]['fields']));_0x555424['attributes']=_0x555424['attributes']['length']?_0x555424['attributes']:_0x3b7da6[_0x1293('0x2e')];if(_0x18b613[_0x1293('0x30')]['includeAll']){_0x555424['include']=[{'all':!![]}];}_0x555424=_['merge']({},_0x555424,_0x18b613[_0x1293('0x44')]);return db['SmsTransferReport'][_0x1293('0x45')](_0x555424)[_0x1293('0x24')](handleEntityNotFound(_0x3122b9,null))['then'](respondWithResult(_0x3122b9,null))[_0x1293('0x41')](handleError(_0x3122b9,null));};exports[_0x1293('0x46')]=function(_0xcba704,_0x1e6ba5){return db[_0x1293('0x29')][_0x1293('0x46')](_0xcba704[_0x1293('0x47')],{})[_0x1293('0x24')](respondWithResult(_0x1e6ba5,0xc9))[_0x1293('0x41')](handleError(_0x1e6ba5,null));};exports[_0x1293('0x48')]=function(_0x361792,_0x5f0519){if(_0x361792['body']['id']){delete _0x361792[_0x1293('0x47')]['id'];}return db[_0x1293('0x29')]['find']({'where':{'id':_0x361792[_0x1293('0x43')]['id']}})['then'](handleEntityNotFound(_0x5f0519,null))['then'](saveUpdates(_0x361792[_0x1293('0x47')],null))[_0x1293('0x24')](respondWithResult(_0x5f0519,null))['catch'](handleError(_0x5f0519,null));};exports[_0x1293('0x23')]=function(_0x20d410,_0x283146){return db['SmsTransferReport']['find']({'where':{'id':_0x20d410[_0x1293('0x43')]['id']}})[_0x1293('0x24')](handleEntityNotFound(_0x283146,null))['then'](removeEntity(_0x283146,null))[_0x1293('0x41')](handleError(_0x283146,null));};exports['describe']=function(_0x274f99,_0x41cedc){return db[_0x1293('0x29')][_0x1293('0x49')]()[_0x1293('0x24')](respondWithResult(_0x41cedc,null))[_0x1293('0x41')](handleError(_0x41cedc,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 39a7fa2..d3f8c12 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 _0xb258=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','uniqueid','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb258,0x12b));var _0x8b25=function(_0x17b578,_0x203b58){_0x17b578=_0x17b578-0x0;var _0x33f78b=_0xb258[_0x17b578];return _0x33f78b;};'use strict';var _=require(_0x8b25('0x0'));var util=require('util');var logger=require(_0x8b25('0x1'))(_0x8b25('0x2'));var moment=require('moment');var BPromise=require(_0x8b25('0x3'));var rp=require(_0x8b25('0x4'));var fs=require('fs');var path=require(_0x8b25('0x5'));var rimraf=require(_0x8b25('0x6'));var config=require(_0x8b25('0x7'));var attributes=require(_0x8b25('0x8'));module['exports']=function(_0x40d293,_0x3e10a5){return _0x40d293[_0x8b25('0x9')](_0x8b25('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x8b25('0xb'),'fields':[_0x8b25('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x28a2=['moment','bluebird','request-promise','rimraf','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x228a('0x0'));var util=require(_0x228a('0x1'));var logger=require(_0x228a('0x2'))(_0x228a('0x3'));var moment=require(_0x228a('0x4'));var BPromise=require(_0x228a('0x5'));var rp=require(_0x228a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x228a('0x7'));var config=require('../../config/environment');var attributes=require(_0x228a('0x8'));module[_0x228a('0x9')]=function(_0x17727b,_0xf86d1d){return _0x17727b[_0x228a('0xa')]('SmsTransferReport',attributes,{'tableName':_0x228a('0xb'),'paranoid':![],'indexes':[{'name':_0x228a('0xc'),'fields':[_0x228a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index a6262c1..3303893 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 _0x078c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird'];(function(_0x5c90e0,_0x43f8ef){var _0x17fddb=function(_0x59cb1e){while(--_0x59cb1e){_0x5c90e0['push'](_0x5c90e0['shift']());}};_0x17fddb(++_0x43f8ef);}(_0x078c,0x19f));var _0xc078=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0x078c[_0x587fb5];return _0x551105;};'use strict';var _=require(_0xc078('0x0'));var util=require('util');var moment=require(_0xc078('0x1'));var BPromise=require(_0xc078('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc078('0x3'));var db=require(_0xc078('0x4'))['db'];var utils=require(_0xc078('0x5'));var logger=require(_0xc078('0x6'))('rpc');var config=require(_0xc078('0x7'));var jayson=require(_0xc078('0x8'));var client=jayson[_0xc078('0x9')][_0xc078('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40e428,_0x1705b0,_0x22661e){return new BPromise(function(_0x4030b1,_0x4d56df){return client['request'](_0x40e428,_0x22661e)['then'](function(_0x28dc54){logger[_0xc078('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x1705b0,_0xc078('0xc'));logger[_0xc078('0xd')](_0xc078('0xe'),_0x1705b0,_0xc078('0xc'),JSON[_0xc078('0xf')](_0x28dc54));if(_0x28dc54['error']){if(_0x28dc54['error'][_0xc078('0x10')]===0x1f4){logger[_0xc078('0x11')](_0xc078('0x12'),_0x1705b0,_0x28dc54[_0xc078('0x11')][_0xc078('0x13')]);return _0x4d56df(_0x28dc54[_0xc078('0x11')][_0xc078('0x13')]);}logger[_0xc078('0x11')](_0xc078('0x12'),_0x1705b0,_0x28dc54[_0xc078('0x11')][_0xc078('0x13')]);return _0x4030b1(_0x28dc54[_0xc078('0x11')][_0xc078('0x13')]);}else{logger[_0xc078('0xb')](_0xc078('0x12'),_0x1705b0,'request\x20sent');_0x4030b1(_0x28dc54[_0xc078('0x14')][_0xc078('0x13')]);}})[_0xc078('0x15')](function(_0x595b14){logger[_0xc078('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x1705b0,_0x595b14);_0x4d56df(_0x595b14);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2f16a7,_0x1e5f6d){var _0x4ad8bd=function(_0x57964d){while(--_0x57964d){_0x2f16a7['push'](_0x2f16a7['shift']());}};_0x4ad8bd(++_0x1e5f6d);}(_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 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']('SmsTransferReport,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index d7e618c..f050d83 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 _0x4f16=['put','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','post','single','file'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f16,0x155));var _0x64f1=function(_0x5637f5,_0x1082c5){_0x5637f5=_0x5637f5-0x0;var _0x2f1873=_0x4f16[_0x5637f5];return _0x2f1873;};'use strict';var multer=require('multer');var util=require(_0x64f1('0x0'));var path=require(_0x64f1('0x1'));var timeout=require(_0x64f1('0x2'));var express=require(_0x64f1('0x3'));var router=express['Router']();var fs_extra=require(_0x64f1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x64f1('0x5'));var config=require(_0x64f1('0x6'));var controller=require('./sound.controller');router['get']('/',auth[_0x64f1('0x7')](),controller[_0x64f1('0x8')]);router[_0x64f1('0x9')]('/:id',auth[_0x64f1('0x7')](),controller['show']);router[_0x64f1('0x9')](_0x64f1('0xa'),auth['isAuthenticated'](),controller[_0x64f1('0xb')]);var upload=multer({'storage':multer[_0x64f1('0xc')]({'destination':function(_0x3e0a82,_0x4c2652,_0x2dc310){_0x2dc310(null,path[_0x64f1('0xd')](config[_0x64f1('0xe')],_0x64f1('0xf')));},'filename':function(_0x534a49,_0x469a27,_0xe18955){_0x469a27[_0x64f1('0x10')]=_0x469a27['originalname'][_0x64f1('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xe18955(null,util[_0x64f1('0x12')]('%s-%s%s',path[_0x64f1('0x13')](_0x469a27[_0x64f1('0x10')],path['extname'](_0x469a27[_0x64f1('0x10')])),Date['now'](),path['extname'](_0x469a27[_0x64f1('0x10')])));}})});router[_0x64f1('0x14')]('/',upload[_0x64f1('0x15')](_0x64f1('0x16')),controller['create']);router[_0x64f1('0x17')]('/:id',auth[_0x64f1('0x7')](),controller['update']);router[_0x64f1('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x64f1('0x18')]);module[_0x64f1('0x19')]=router; \ No newline at end of file +var _0x6e88=['originalname','%s-%s%s','basename','extname','now','post','single','file','create','put','/:id','update','delete','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/'];(function(_0x5101d3,_0x1e8e80){var _0x5ec040=function(_0x2790af){while(--_0x2790af){_0x5101d3['push'](_0x5101d3['shift']());}};_0x5ec040(++_0x1e8e80);}(_0x6e88,0x1c0));var _0x86e8=function(_0x315f56,_0x3488d6){_0x315f56=_0x315f56-0x0;var _0x465d73=_0x6e88[_0x315f56];return _0x465d73;};'use strict';var multer=require(_0x86e8('0x0'));var util=require(_0x86e8('0x1'));var path=require('path');var timeout=require(_0x86e8('0x2'));var express=require('express');var router=express[_0x86e8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x86e8('0x4'));var config=require(_0x86e8('0x5'));var controller=require(_0x86e8('0x6'));router['get']('/',auth[_0x86e8('0x7')](),controller[_0x86e8('0x8')]);router[_0x86e8('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x86e8('0xa')]);router[_0x86e8('0x9')](_0x86e8('0xb'),auth['isAuthenticated'](),controller[_0x86e8('0xc')]);var upload=multer({'storage':multer[_0x86e8('0xd')]({'destination':function(_0x5ea56a,_0x3ad52d,_0x53a813){_0x53a813(null,path[_0x86e8('0xe')](config[_0x86e8('0xf')],_0x86e8('0x10')));},'filename':function(_0x587cdf,_0x66437,_0x3f3ee8){_0x66437[_0x86e8('0x11')]=_0x66437['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3f3ee8(null,util['format'](_0x86e8('0x12'),path[_0x86e8('0x13')](_0x66437[_0x86e8('0x11')],path[_0x86e8('0x14')](_0x66437['originalname'])),Date[_0x86e8('0x15')](),path[_0x86e8('0x14')](_0x66437[_0x86e8('0x11')])));}})});router[_0x86e8('0x16')]('/',upload[_0x86e8('0x17')](_0x86e8('0x18')),controller[_0x86e8('0x19')]);router[_0x86e8('0x1a')](_0x86e8('0x1b'),auth['isAuthenticated'](),controller[_0x86e8('0x1c')]);router[_0x86e8('0x1d')](_0x86e8('0x1b'),auth[_0x86e8('0x7')](),controller[_0x86e8('0x1d')]);module[_0x86e8('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 5ca8425..c84c072 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 _0x871d=['sequelize','exports','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x4ae956,_0xd1b280){var _0x846b58=function(_0x26207f){while(--_0x26207f){_0x4ae956['push'](_0x4ae956['shift']());}};_0x846b58(++_0xd1b280);}(_0x871d,0x10e));var _0xd871=function(_0x44f492,_0x5bbc7b){_0x44f492=_0x44f492-0x0;var _0x349a73=_0x871d[_0x44f492];return _0x349a73;};'use strict';var Sequelize=require(_0xd871('0x0'));module[_0xd871('0x1')]={'name':{'type':Sequelize[_0xd871('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xd871('0x2')]},'display_name':{'type':Sequelize[_0xd871('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xd871('0x2')]},'original_format':{'type':Sequelize[_0xd871('0x2')]},'original_duration':{'type':Sequelize[_0xd871('0x3')]},'original_sampleCount':{'type':Sequelize[_0xd871('0x4')]},'original_channelCount':{'type':Sequelize[_0xd871('0x5')]},'original_bitRate':{'type':Sequelize[_0xd871('0x4')]},'original_sampleRate':{'type':Sequelize[_0xd871('0x5')]},'converted_format':{'type':Sequelize[_0xd871('0x2')]},'converted_duration':{'type':Sequelize[_0xd871('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xd871('0x5')]}}; \ No newline at end of file +var _0xa611=['STRING','FLOAT','INTEGER','BIGINT','exports','name'];(function(_0x4f08dd,_0x3784ec){var _0x3017ee=function(_0x7d95be){while(--_0x7d95be){_0x4f08dd['push'](_0x4f08dd['shift']());}};_0x3017ee(++_0x3784ec);}(_0xa611,0x1f0));var _0x1a61=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa611[_0x5b78e8];return _0xf2c321;};'use strict';var Sequelize=require('sequelize');module[_0x1a61('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x1a61('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x1a61('0x2')]},'display_name':{'type':Sequelize[_0x1a61('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x1a61('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x1a61('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x1a61('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x1a61('0x2')]},'converted_duration':{'type':Sequelize[_0x1a61('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x1a61('0x5')]},'converted_channelCount':{'type':Sequelize[_0x1a61('0x4')]},'converted_bitRate':{'type':Sequelize[_0x1a61('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x1a61('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 2ca092d..9951138 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 _0x2b5e=['autoAssociation','description','original_format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','Sound','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','keys','rawAttributes','find','params','save_name','converted_format','existsSync','join','root','Sequelize','Sound\x20not\x20found','download','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','server/files/sounds/converted','info','Sound\x20upload\x20destination:\x20%s','chmodSync','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x369297,_0x3968e4){var _0x15000b=function(_0x55aaff){while(--_0x55aaff){_0x369297['push'](_0x369297['shift']());}};_0x15000b(++_0x3968e4);}(_0x2b5e,0x7c));var _0xe2b5=function(_0x3c5ca4,_0x1f6dd4){_0x3c5ca4=_0x3c5ca4-0x0;var _0x151a6b=_0x2b5e[_0x3c5ca4];return _0x151a6b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe2b5('0x0'));var zipdir=require(_0xe2b5('0x1'));var jsonpatch=require(_0xe2b5('0x2'));var rp=require(_0xe2b5('0x3'));var moment=require(_0xe2b5('0x4'));var BPromise=require(_0xe2b5('0x5'));var Mustache=require('mustache');var util=require(_0xe2b5('0x6'));var path=require(_0xe2b5('0x7'));var sox=require(_0xe2b5('0x8'));var csv=require(_0xe2b5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe2b5('0xa'));var _=require(_0xe2b5('0xb'));var squel=require('squel');var crypto=require(_0xe2b5('0xc'));var jsforce=require(_0xe2b5('0xd'));var deskjs=require(_0xe2b5('0xe'));var toCsv=require(_0xe2b5('0x9'));var querystring=require(_0xe2b5('0xf'));var Papa=require(_0xe2b5('0x10'));var Redis=require('ioredis');var authService=require(_0xe2b5('0x11'));var qs=require(_0xe2b5('0x12'));var as=require(_0xe2b5('0x13'));var hardwareService=require(_0xe2b5('0x14'));var logger=require(_0xe2b5('0x15'))(_0xe2b5('0x16'));var utils=require(_0xe2b5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe2b5('0x18'));var db=require(_0xe2b5('0x19'))['db'];function respondWithStatusCode(_0x386cf6,_0xfedbcb){_0xfedbcb=_0xfedbcb||0xcc;return function(_0x4da5b0){if(_0x4da5b0){return _0x386cf6[_0xe2b5('0x1a')](_0xfedbcb);}return _0x386cf6[_0xe2b5('0x1b')](_0xfedbcb)['end']();};}function respondWithResult(_0x8bf881,_0x10da58){_0x10da58=_0x10da58||0xc8;return function(_0x55a310){if(_0x55a310){return _0x8bf881[_0xe2b5('0x1b')](_0x10da58)[_0xe2b5('0x1c')](_0x55a310);}};}function respondWithFilteredResult(_0x53f1ef,_0x144d7d){return function(_0x888e92){if(_0x888e92){var _0x52b4f5=typeof _0x144d7d[_0xe2b5('0x1d')]===_0xe2b5('0x1e')&&typeof _0x144d7d['limit']==='undefined';var _0x312850=_0x888e92[_0xe2b5('0x1f')];var _0x1e6521=_0x52b4f5?0x0:_0x144d7d[_0xe2b5('0x1d')];var _0x3eebcb=_0x52b4f5?_0x888e92[_0xe2b5('0x1f')]:_0x144d7d['offset']+_0x144d7d[_0xe2b5('0x20')];var _0x445a16;if(_0x3eebcb>=_0x312850){_0x3eebcb=_0x312850;_0x445a16=0xc8;}else{_0x445a16=0xce;}_0x53f1ef[_0xe2b5('0x1b')](_0x445a16);return _0x53f1ef[_0xe2b5('0x21')]('Content-Range',_0x1e6521+'-'+_0x3eebcb+'/'+_0x312850)[_0xe2b5('0x1c')](_0x888e92);}return null;};}function patchUpdates(_0x4cb88a){return function(_0x1ad105){try{jsonpatch['apply'](_0x1ad105,_0x4cb88a,!![]);}catch(_0x498e8d){return BPromise['reject'](_0x498e8d);}return _0x1ad105['save']();};}function saveUpdates(_0x3a76c6,_0x35b6cc){return function(_0xd4e9ef){if(_0xd4e9ef){return _0xd4e9ef[_0xe2b5('0x22')](_0x3a76c6)[_0xe2b5('0x23')](function(_0x173e77){return _0x173e77;});}return null;};}function removeEntity(_0x14de08,_0xce7646){return function(_0x1a9ddc){if(_0x1a9ddc){return _0x1a9ddc['destroy']()[_0xe2b5('0x23')](function(){var _0x543890=_0x1a9ddc[_0xe2b5('0x24')]({'plain':!![]});var _0x3c9930='Sounds';return db[_0xe2b5('0x25')][_0xe2b5('0x26')]({'where':{'type':_0x3c9930,'resourceId':_0x543890['id']}})[_0xe2b5('0x23')](function(){return _0x1a9ddc;});})[_0xe2b5('0x23')](function(){_0x14de08[_0xe2b5('0x1b')](0xcc)[_0xe2b5('0x27')]();});}};}function handleEntityNotFound(_0x2059f5,_0x174187){return function(_0x2f0df5){if(!_0x2f0df5){_0x2059f5[_0xe2b5('0x1a')](0x194);}return _0x2f0df5;};}function handleError(_0xe3130b,_0x5e6600){_0x5e6600=_0x5e6600||0x1f4;return function(_0x492aa1){logger[_0xe2b5('0x28')](_0x492aa1[_0xe2b5('0x29')]);if(_0x492aa1[_0xe2b5('0x2a')]){delete _0x492aa1[_0xe2b5('0x2a')];}_0xe3130b['status'](_0x5e6600)[_0xe2b5('0x2b')](_0x492aa1);};}exports[_0xe2b5('0x2c')]=function(_0x5aa0a0,_0x4dc835){var _0x23e904={},_0x4ca74f={},_0x45ee62={'count':0x0,'rows':[]};var _0xe4f564=_['map'](db[_0xe2b5('0x2d')]['rawAttributes'],function(_0x47b2c3){return{'name':_0x47b2c3[_0xe2b5('0x2e')],'type':_0x47b2c3[_0xe2b5('0x2f')][_0xe2b5('0x30')]};});_0x4ca74f[_0xe2b5('0x31')]=_[_0xe2b5('0x32')](_0xe4f564,'name');_0x4ca74f[_0xe2b5('0x33')]=_['keys'](_0x5aa0a0[_0xe2b5('0x33')]);_0x4ca74f[_0xe2b5('0x34')]=_['intersection'](_0x4ca74f[_0xe2b5('0x31')],_0x4ca74f['query']);_0x23e904[_0xe2b5('0x35')]=_[_0xe2b5('0x36')](_0x4ca74f[_0xe2b5('0x31')],qs[_0xe2b5('0x37')](_0x5aa0a0[_0xe2b5('0x33')][_0xe2b5('0x37')]));_0x23e904[_0xe2b5('0x35')]=_0x23e904['attributes'][_0xe2b5('0x38')]?_0x23e904[_0xe2b5('0x35')]:_0x4ca74f['model'];if(!_0x5aa0a0[_0xe2b5('0x33')]['hasOwnProperty'](_0xe2b5('0x39'))){_0x23e904[_0xe2b5('0x20')]=qs[_0xe2b5('0x20')](_0x5aa0a0[_0xe2b5('0x33')][_0xe2b5('0x20')]);_0x23e904[_0xe2b5('0x1d')]=qs['offset'](_0x5aa0a0[_0xe2b5('0x33')]['offset']);}_0x23e904[_0xe2b5('0x3a')]=qs[_0xe2b5('0x3b')](_0x5aa0a0[_0xe2b5('0x33')][_0xe2b5('0x3b')]);_0x23e904[_0xe2b5('0x3c')]=qs[_0xe2b5('0x34')](_[_0xe2b5('0x3d')](_0x5aa0a0[_0xe2b5('0x33')],_0x4ca74f[_0xe2b5('0x34')]),_0xe4f564);if(_0x5aa0a0['query'][_0xe2b5('0x3e')]){_0x23e904[_0xe2b5('0x3c')]=_[_0xe2b5('0x3f')](_0x23e904[_0xe2b5('0x3c')],{'$or':_['map'](_0xe4f564,function(_0x2ed911){if(_0x2ed911['type']!=='VIRTUAL'){var _0x2a8cfb={};_0x2a8cfb[_0x2ed911[_0xe2b5('0x2a')]]={'$like':'%'+_0x5aa0a0[_0xe2b5('0x33')][_0xe2b5('0x3e')]+'%'};return _0x2a8cfb;}})});}_0x23e904=_[_0xe2b5('0x3f')]({},_0x23e904,_0x5aa0a0[_0xe2b5('0x40')]);var _0x4ff649={'where':_0x23e904[_0xe2b5('0x3c')]};return db[_0xe2b5('0x2d')]['count'](_0x4ff649)[_0xe2b5('0x23')](function(_0xc04604){_0x45ee62[_0xe2b5('0x1f')]=_0xc04604;if(_0x5aa0a0[_0xe2b5('0x33')][_0xe2b5('0x41')]){_0x23e904[_0xe2b5('0x42')]=[{'all':!![]}];}return db[_0xe2b5('0x2d')][_0xe2b5('0x43')](_0x23e904);})[_0xe2b5('0x23')](function(_0x582c50){_0x45ee62['rows']=_0x582c50;return _0x45ee62;})[_0xe2b5('0x23')](respondWithFilteredResult(_0x4dc835,_0x23e904))[_0xe2b5('0x44')](handleError(_0x4dc835,null));};exports[_0xe2b5('0x45')]=function(_0x23e923,_0x2e5f70){var _0xd75b98={'raw':!![],'where':{'id':_0x23e923['params']['id']}},_0x1218c6={};_0x1218c6[_0xe2b5('0x31')]=_[_0xe2b5('0x46')](db[_0xe2b5('0x2d')][_0xe2b5('0x47')]);_0x1218c6['query']=_[_0xe2b5('0x46')](_0x23e923[_0xe2b5('0x33')]);_0x1218c6['filters']=_['intersection'](_0x1218c6[_0xe2b5('0x31')],_0x1218c6[_0xe2b5('0x33')]);_0xd75b98[_0xe2b5('0x35')]=_[_0xe2b5('0x36')](_0x1218c6[_0xe2b5('0x31')],qs['fields'](_0x23e923[_0xe2b5('0x33')][_0xe2b5('0x37')]));_0xd75b98[_0xe2b5('0x35')]=_0xd75b98[_0xe2b5('0x35')]['length']?_0xd75b98['attributes']:_0x1218c6['model'];if(_0x23e923['query'][_0xe2b5('0x41')]){_0xd75b98['include']=[{'all':!![]}];}_0xd75b98=_['merge']({},_0xd75b98,_0x23e923[_0xe2b5('0x40')]);return db['Sound'][_0xe2b5('0x48')](_0xd75b98)[_0xe2b5('0x23')](handleEntityNotFound(_0x2e5f70,null))[_0xe2b5('0x23')](respondWithResult(_0x2e5f70,null))[_0xe2b5('0x44')](handleError(_0x2e5f70,null));};exports['download']=function(_0x444bcb,_0x5e42d4,_0x7b46e6){return db['Sound'][_0xe2b5('0x48')]({'where':{'id':_0x444bcb[_0xe2b5('0x49')]['id']},'attributes':['name',_0xe2b5('0x4a'),_0xe2b5('0x4b')],'raw':!![]})[_0xe2b5('0x23')](handleEntityNotFound(_0x5e42d4,null))['then'](function(_0x146d88){if(_0x146d88){if(!fs[_0xe2b5('0x4c')](path[_0xe2b5('0x4d')](config[_0xe2b5('0x4e')],'server/files/sounds/converted',_0x146d88[_0xe2b5('0x4a')]+'.'+_0x146d88['converted_format']))){throw new db[(_0xe2b5('0x4f'))]['ValidationError'](_0xe2b5('0x50'));}return _0x5e42d4[_0xe2b5('0x51')](path[_0xe2b5('0x4d')](config[_0xe2b5('0x4e')],'server/files/sounds/converted',util[_0xe2b5('0x52')](_0xe2b5('0x53'),_0x146d88[_0xe2b5('0x4a')],_0x146d88['converted_format'])),util['format'](_0xe2b5('0x53'),_0x146d88['name'],_0x146d88[_0xe2b5('0x4b')]));}return null;})[_0xe2b5('0x44')](handleError(_0x5e42d4,null));};exports[_0xe2b5('0x54')]=function(_0x280548,_0x1dddcd,_0x5ec2ba){var _0xfb017={'name':path[_0xe2b5('0x55')](_0x280548[_0xe2b5('0x56')][_0xe2b5('0x57')],path[_0xe2b5('0x58')](_0x280548[_0xe2b5('0x56')][_0xe2b5('0x57')])),'save_name':path['basename'](_0x280548['file'][_0xe2b5('0x59')],path[_0xe2b5('0x58')](_0x280548[_0xe2b5('0x56')][_0xe2b5('0x59')])),'original_format':path[_0xe2b5('0x58')](_0x280548[_0xe2b5('0x56')]['originalname'])[_0xe2b5('0x5a')](0x1),'converted_format':_0xe2b5('0x5b')};var _0x5568b9=path['join'](config['root'],_0xe2b5('0x5c'),_0x280548['file'][_0xe2b5('0x59')]);var _0x345c6f=path['join'](config[_0xe2b5('0x4e')],_0xe2b5('0x5d'),util[_0xe2b5('0x52')](_0xe2b5('0x53'),path[_0xe2b5('0x55')](_0x280548[_0xe2b5('0x56')][_0xe2b5('0x59')],path[_0xe2b5('0x58')](_0x280548['file'][_0xe2b5('0x59')])),_0xfb017[_0xe2b5('0x4b')]));logger[_0xe2b5('0x5e')]('Sound\x20upload\x20filepath:\x20%s',_0x5568b9);logger['info'](_0xe2b5('0x5f'),_0x345c6f);try{fs[_0xe2b5('0x60')](_0x5568b9,parseInt('0777',0x8));var _0x109a82=sox['transcode'](_0x5568b9,_0x345c6f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x109a82['on'](_0xe2b5('0x28'),function(_0x5701eb){fs[_0xe2b5('0x61')](_0x5568b9);_0x1dddcd[_0xe2b5('0x1b')](0x1f4)[_0xe2b5('0x2b')](_0x5701eb);});_0x109a82['on'](_0xe2b5('0x62'),function(_0x24141d){_0xfb017[_0xe2b5('0x63')]=isNaN(_0x24141d[_0xe2b5('0x64')])?null:_0x24141d[_0xe2b5('0x64')]*0x3e8;_0xfb017[_0xe2b5('0x65')]=isNaN(_0x24141d['sampleCount'])?null:_0x24141d[_0xe2b5('0x66')];_0xfb017['original_channelCount']=isNaN(_0x24141d['channelCount'])?null:_0x24141d[_0xe2b5('0x67')];_0xfb017[_0xe2b5('0x68')]=isNaN(_0x24141d[_0xe2b5('0x69')])?null:_0x24141d[_0xe2b5('0x69')];_0xfb017[_0xe2b5('0x6a')]=isNaN(_0x24141d[_0xe2b5('0x6b')])?null:_0x24141d[_0xe2b5('0x6b')];});_0x109a82['on'](_0xe2b5('0x6c'),function(_0x3061c1){_0xfb017[_0xe2b5('0x6d')]=isNaN(_0x3061c1[_0xe2b5('0x64')])?null:_0x3061c1[_0xe2b5('0x64')]*0x3e8;_0xfb017[_0xe2b5('0x6e')]=isNaN(_0x3061c1['sampleCount'])?null:_0x3061c1[_0xe2b5('0x66')];_0xfb017[_0xe2b5('0x6f')]=isNaN(_0x3061c1['channelCount'])?null:_0x3061c1[_0xe2b5('0x67')];_0xfb017[_0xe2b5('0x70')]=isNaN(_0x3061c1['bitRate'])?null:_0x3061c1[_0xe2b5('0x69')];_0xfb017[_0xe2b5('0x71')]=isNaN(_0x3061c1[_0xe2b5('0x6b')])?null:_0x3061c1[_0xe2b5('0x6b')];});_0x109a82['on'](_0xe2b5('0x27'),function(){fs['chmodSync'](_0x345c6f,parseInt('0777',0x8));return db[_0xe2b5('0x2d')]['create'](_0xfb017)[_0xe2b5('0x23')](function(_0x32f7d8){var _0x2c2dd0={'role':_0x280548['body'][_0xe2b5('0x72')],'userProfileId':_0x280548[_0xe2b5('0x73')]['userProfileId']};if(!_0x2c2dd0)throw new Error(_0xe2b5('0x74'));if(_0x2c2dd0[_0xe2b5('0x72')]==='user'){var _0x36be83=_0x32f7d8[_0xe2b5('0x24')]({'plain':!![]});return db[_0xe2b5('0x75')][_0xe2b5('0x48')]({'where':{'name':'Sounds','userProfileId':_0x2c2dd0['userProfileId']},'raw':!![]})['then'](function(_0x58bac0){if(_0x58bac0&&_0x58bac0[_0xe2b5('0x76')]===0x0){return db[_0xe2b5('0x25')][_0xe2b5('0x54')]({'name':_0x36be83[_0xe2b5('0x2a')],'resourceId':_0x36be83['id'],'type':_0x58bac0['name'],'sectionId':_0x58bac0['id']},{})[_0xe2b5('0x23')](function(){return _0x32f7d8;});}else{return _0x32f7d8;}})['catch'](function(_0x2909b8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2909b8);throw _0x2909b8;});}return _0x32f7d8;})[_0xe2b5('0x23')](respondWithResult(_0x1dddcd,null))[_0xe2b5('0x44')](handleError(_0x1dddcd,null));});_0x109a82['start']();}catch(_0x28ad08){_0x1dddcd[_0xe2b5('0x1b')](0x1f4)[_0xe2b5('0x2b')](_0x28ad08);}};exports[_0xe2b5('0x22')]=function(_0x45171c,_0xbde13,_0x2526ef){return db[_0xe2b5('0x2d')][_0xe2b5('0x48')]({'where':{'id':_0x45171c[_0xe2b5('0x49')]['id']}})[_0xe2b5('0x23')](handleEntityNotFound(_0xbde13,null))[_0xe2b5('0x23')](saveUpdates(_[_0xe2b5('0x3d')](_0x45171c[_0xe2b5('0x73')],['name',_0xe2b5('0x77')]),null))['then'](respondWithResult(_0xbde13,null))[_0xe2b5('0x44')](handleError(_0xbde13,null));};exports['delete']=function(_0x4d9456,_0x3823d0,_0x3a5bd1){return db[_0xe2b5('0x2d')][_0xe2b5('0x48')]({'where':{'id':_0x4d9456[_0xe2b5('0x49')]['id']}})['then'](function(_0x3a8062){if(_0x3a8062){return _0x3a8062[_0xe2b5('0x26')]();}})[_0xe2b5('0x23')](function(_0x38c9fb){var _0x57c7f7=path[_0xe2b5('0x4d')](config[_0xe2b5('0x4e')],_0xe2b5('0x5c'),util['format'](_0xe2b5('0x53'),_0x38c9fb[_0xe2b5('0x4a')],_0x38c9fb[_0xe2b5('0x78')]));var _0x364200=path[_0xe2b5('0x4d')](config['root'],_0xe2b5('0x5d'),util[_0xe2b5('0x52')](_0xe2b5('0x53'),_0x38c9fb[_0xe2b5('0x4a')],_0x38c9fb[_0xe2b5('0x4b')]));fs[_0xe2b5('0x61')](_0x57c7f7);fs[_0xe2b5('0x61')](_0x364200);return _0x38c9fb;})['then'](function(_0x339862){if(_0x339862){return _0x3823d0[_0xe2b5('0x1b')](0xcc)[_0xe2b5('0x27')]();}})['then'](handleEntityNotFound(_0x3823d0,null))[_0xe2b5('0x44')](handleError(_0x3823d0,null));}; \ No newline at end of file +var _0x4b0b=['ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','fieldName','key','keys','filters','intersection','model','query','fields','attributes','length','order','sort','pick','filter','where','merge','VIRTUAL','include','rows','catch','rawAttributes','options','find','download','params','converted_format','server/files/sounds/converted','save_name','ValidationError','Sound\x20not\x20found','join','root','%s.%s','format','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_sampleCount','converted_channelCount','create','body','userProfileId','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','original_format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv'];(function(_0x565dfa,_0x5ca74b){var _0x3d8102=function(_0x34276a){while(--_0x34276a){_0x565dfa['push'](_0x565dfa['shift']());}};_0x3d8102(++_0x5ca74b);}(_0x4b0b,0x72));var _0xb4b0=function(_0x5a90a8,_0xf4f181){_0x5a90a8=_0x5a90a8-0x0;var _0x5b1060=_0x4b0b[_0x5a90a8];return _0x5b1060;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb4b0('0x0'));var zipdir=require(_0xb4b0('0x1'));var jsonpatch=require(_0xb4b0('0x2'));var rp=require(_0xb4b0('0x3'));var moment=require(_0xb4b0('0x4'));var BPromise=require(_0xb4b0('0x5'));var Mustache=require('mustache');var util=require(_0xb4b0('0x6'));var path=require('path');var sox=require(_0xb4b0('0x7'));var csv=require(_0xb4b0('0x8'));var ejs=require(_0xb4b0('0x9'));var fs=require('fs');var fs_extra=require(_0xb4b0('0xa'));var _=require(_0xb4b0('0xb'));var squel=require(_0xb4b0('0xc'));var crypto=require(_0xb4b0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb4b0('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb4b0('0xf'));var Papa=require(_0xb4b0('0x10'));var Redis=require('ioredis');var authService=require(_0xb4b0('0x11'));var qs=require(_0xb4b0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb4b0('0x13'));var logger=require(_0xb4b0('0x14'))('api');var utils=require(_0xb4b0('0x15'));var config=require(_0xb4b0('0x16'));var licenseUtil=require(_0xb4b0('0x17'));var db=require(_0xb4b0('0x18'))['db'];function respondWithStatusCode(_0x5dfe9e,_0x1b95f1){_0x1b95f1=_0x1b95f1||0xcc;return function(_0x5e86a5){if(_0x5e86a5){return _0x5dfe9e[_0xb4b0('0x19')](_0x1b95f1);}return _0x5dfe9e[_0xb4b0('0x1a')](_0x1b95f1)[_0xb4b0('0x1b')]();};}function respondWithResult(_0x4e2d5b,_0x3dcd14){_0x3dcd14=_0x3dcd14||0xc8;return function(_0x4e8d55){if(_0x4e8d55){return _0x4e2d5b[_0xb4b0('0x1a')](_0x3dcd14)[_0xb4b0('0x1c')](_0x4e8d55);}};}function respondWithFilteredResult(_0x4e0254,_0x1d16a3){return function(_0xbeb7fb){if(_0xbeb7fb){var _0x33c467=typeof _0x1d16a3['offset']===_0xb4b0('0x1d')&&typeof _0x1d16a3[_0xb4b0('0x1e')]==='undefined';var _0x4e08b1=_0xbeb7fb[_0xb4b0('0x1f')];var _0x1fd2b1=_0x33c467?0x0:_0x1d16a3[_0xb4b0('0x20')];var _0x311f0c=_0x33c467?_0xbeb7fb['count']:_0x1d16a3[_0xb4b0('0x20')]+_0x1d16a3[_0xb4b0('0x1e')];var _0x3116f7;if(_0x311f0c>=_0x4e08b1){_0x311f0c=_0x4e08b1;_0x3116f7=0xc8;}else{_0x3116f7=0xce;}_0x4e0254[_0xb4b0('0x1a')](_0x3116f7);return _0x4e0254[_0xb4b0('0x21')](_0xb4b0('0x22'),_0x1fd2b1+'-'+_0x311f0c+'/'+_0x4e08b1)[_0xb4b0('0x1c')](_0xbeb7fb);}return null;};}function patchUpdates(_0x15f091){return function(_0xeb9dc8){try{jsonpatch[_0xb4b0('0x23')](_0xeb9dc8,_0x15f091,!![]);}catch(_0xc13b09){return BPromise[_0xb4b0('0x24')](_0xc13b09);}return _0xeb9dc8[_0xb4b0('0x25')]();};}function saveUpdates(_0x45590f,_0x46c4f8){return function(_0x533d3b){if(_0x533d3b){return _0x533d3b[_0xb4b0('0x26')](_0x45590f)[_0xb4b0('0x27')](function(_0x5f31b9){return _0x5f31b9;});}return null;};}function removeEntity(_0x568108,_0x1306e6){return function(_0x4b6a74){if(_0x4b6a74){return _0x4b6a74[_0xb4b0('0x28')]()['then'](function(){var _0x4f6c15=_0x4b6a74[_0xb4b0('0x29')]({'plain':!![]});var _0x36a2db=_0xb4b0('0x2a');return db[_0xb4b0('0x2b')][_0xb4b0('0x28')]({'where':{'type':_0x36a2db,'resourceId':_0x4f6c15['id']}})[_0xb4b0('0x27')](function(){return _0x4b6a74;});})[_0xb4b0('0x27')](function(){_0x568108[_0xb4b0('0x1a')](0xcc)[_0xb4b0('0x1b')]();});}};}function handleEntityNotFound(_0x599ddc,_0x4bc65e){return function(_0x419f4c){if(!_0x419f4c){_0x599ddc[_0xb4b0('0x19')](0x194);}return _0x419f4c;};}function handleError(_0x45b666,_0x14fa64){_0x14fa64=_0x14fa64||0x1f4;return function(_0x5b542e){logger[_0xb4b0('0x2c')](_0x5b542e[_0xb4b0('0x2d')]);if(_0x5b542e[_0xb4b0('0x2e')]){delete _0x5b542e[_0xb4b0('0x2e')];}_0x45b666[_0xb4b0('0x1a')](_0x14fa64)[_0xb4b0('0x2f')](_0x5b542e);};}exports[_0xb4b0('0x30')]=function(_0xd36872,_0x25500d){var _0x39fc97={},_0xd36e26={},_0xac5dac={'count':0x0,'rows':[]};var _0x3cbad2=_[_0xb4b0('0x31')](db[_0xb4b0('0x32')]['rawAttributes'],function(_0x5c6264){return{'name':_0x5c6264[_0xb4b0('0x33')],'type':_0x5c6264['type'][_0xb4b0('0x34')]};});_0xd36e26['model']=_[_0xb4b0('0x31')](_0x3cbad2,_0xb4b0('0x2e'));_0xd36e26['query']=_[_0xb4b0('0x35')](_0xd36872['query']);_0xd36e26[_0xb4b0('0x36')]=_[_0xb4b0('0x37')](_0xd36e26[_0xb4b0('0x38')],_0xd36e26[_0xb4b0('0x39')]);_0x39fc97['attributes']=_[_0xb4b0('0x37')](_0xd36e26[_0xb4b0('0x38')],qs[_0xb4b0('0x3a')](_0xd36872[_0xb4b0('0x39')][_0xb4b0('0x3a')]));_0x39fc97['attributes']=_0x39fc97[_0xb4b0('0x3b')][_0xb4b0('0x3c')]?_0x39fc97['attributes']:_0xd36e26[_0xb4b0('0x38')];if(!_0xd36872[_0xb4b0('0x39')]['hasOwnProperty']('nolimit')){_0x39fc97['limit']=qs[_0xb4b0('0x1e')](_0xd36872['query']['limit']);_0x39fc97[_0xb4b0('0x20')]=qs[_0xb4b0('0x20')](_0xd36872[_0xb4b0('0x39')][_0xb4b0('0x20')]);}_0x39fc97[_0xb4b0('0x3d')]=qs[_0xb4b0('0x3e')](_0xd36872[_0xb4b0('0x39')][_0xb4b0('0x3e')]);_0x39fc97['where']=qs[_0xb4b0('0x36')](_[_0xb4b0('0x3f')](_0xd36872[_0xb4b0('0x39')],_0xd36e26[_0xb4b0('0x36')]),_0x3cbad2);if(_0xd36872[_0xb4b0('0x39')][_0xb4b0('0x40')]){_0x39fc97[_0xb4b0('0x41')]=_[_0xb4b0('0x42')](_0x39fc97[_0xb4b0('0x41')],{'$or':_['map'](_0x3cbad2,function(_0x14e822){if(_0x14e822['type']!==_0xb4b0('0x43')){var _0x4cdb23={};_0x4cdb23[_0x14e822[_0xb4b0('0x2e')]]={'$like':'%'+_0xd36872[_0xb4b0('0x39')][_0xb4b0('0x40')]+'%'};return _0x4cdb23;}})});}_0x39fc97=_['merge']({},_0x39fc97,_0xd36872['options']);var _0x37a5b0={'where':_0x39fc97['where']};return db['Sound'][_0xb4b0('0x1f')](_0x37a5b0)[_0xb4b0('0x27')](function(_0x26f308){_0xac5dac['count']=_0x26f308;if(_0xd36872[_0xb4b0('0x39')]['includeAll']){_0x39fc97[_0xb4b0('0x44')]=[{'all':!![]}];}return db[_0xb4b0('0x32')]['findAll'](_0x39fc97);})[_0xb4b0('0x27')](function(_0x1e8311){_0xac5dac[_0xb4b0('0x45')]=_0x1e8311;return _0xac5dac;})['then'](respondWithFilteredResult(_0x25500d,_0x39fc97))[_0xb4b0('0x46')](handleError(_0x25500d,null));};exports['show']=function(_0x3459af,_0x31a04c){var _0x382e07={'raw':!![],'where':{'id':_0x3459af['params']['id']}},_0x578ba0={};_0x578ba0[_0xb4b0('0x38')]=_[_0xb4b0('0x35')](db[_0xb4b0('0x32')][_0xb4b0('0x47')]);_0x578ba0[_0xb4b0('0x39')]=_[_0xb4b0('0x35')](_0x3459af[_0xb4b0('0x39')]);_0x578ba0[_0xb4b0('0x36')]=_[_0xb4b0('0x37')](_0x578ba0['model'],_0x578ba0[_0xb4b0('0x39')]);_0x382e07[_0xb4b0('0x3b')]=_[_0xb4b0('0x37')](_0x578ba0[_0xb4b0('0x38')],qs['fields'](_0x3459af[_0xb4b0('0x39')][_0xb4b0('0x3a')]));_0x382e07['attributes']=_0x382e07[_0xb4b0('0x3b')][_0xb4b0('0x3c')]?_0x382e07['attributes']:_0x578ba0['model'];if(_0x3459af[_0xb4b0('0x39')]['includeAll']){_0x382e07[_0xb4b0('0x44')]=[{'all':!![]}];}_0x382e07=_['merge']({},_0x382e07,_0x3459af[_0xb4b0('0x48')]);return db[_0xb4b0('0x32')][_0xb4b0('0x49')](_0x382e07)[_0xb4b0('0x27')](handleEntityNotFound(_0x31a04c,null))[_0xb4b0('0x27')](respondWithResult(_0x31a04c,null))[_0xb4b0('0x46')](handleError(_0x31a04c,null));};exports[_0xb4b0('0x4a')]=function(_0x597b63,_0x4fd0ca,_0x525df4){return db[_0xb4b0('0x32')][_0xb4b0('0x49')]({'where':{'id':_0x597b63[_0xb4b0('0x4b')]['id']},'attributes':[_0xb4b0('0x2e'),'save_name',_0xb4b0('0x4c')],'raw':!![]})[_0xb4b0('0x27')](handleEntityNotFound(_0x4fd0ca,null))['then'](function(_0x5b1814){if(_0x5b1814){if(!fs['existsSync'](path['join'](config['root'],_0xb4b0('0x4d'),_0x5b1814[_0xb4b0('0x4e')]+'.'+_0x5b1814['converted_format']))){throw new db['Sequelize'][(_0xb4b0('0x4f'))](_0xb4b0('0x50'));}return _0x4fd0ca['download'](path[_0xb4b0('0x51')](config[_0xb4b0('0x52')],_0xb4b0('0x4d'),util['format'](_0xb4b0('0x53'),_0x5b1814['save_name'],_0x5b1814[_0xb4b0('0x4c')])),util[_0xb4b0('0x54')](_0xb4b0('0x53'),_0x5b1814[_0xb4b0('0x2e')],_0x5b1814[_0xb4b0('0x4c')]));}return null;})[_0xb4b0('0x46')](handleError(_0x4fd0ca,null));};exports['create']=function(_0x8807df,_0x51e6ff,_0x109925){var _0x2b7654={'name':path[_0xb4b0('0x55')](_0x8807df[_0xb4b0('0x56')][_0xb4b0('0x57')],path[_0xb4b0('0x58')](_0x8807df[_0xb4b0('0x56')][_0xb4b0('0x57')])),'save_name':path['basename'](_0x8807df[_0xb4b0('0x56')][_0xb4b0('0x59')],path[_0xb4b0('0x58')](_0x8807df[_0xb4b0('0x56')][_0xb4b0('0x59')])),'original_format':path[_0xb4b0('0x58')](_0x8807df[_0xb4b0('0x56')][_0xb4b0('0x57')])[_0xb4b0('0x5a')](0x1),'converted_format':_0xb4b0('0x5b')};var _0x2544b1=path[_0xb4b0('0x51')](config['root'],_0xb4b0('0x5c'),_0x8807df['file'][_0xb4b0('0x59')]);var _0x1f9471=path[_0xb4b0('0x51')](config['root'],_0xb4b0('0x4d'),util[_0xb4b0('0x54')](_0xb4b0('0x53'),path[_0xb4b0('0x55')](_0x8807df['file']['filename'],path[_0xb4b0('0x58')](_0x8807df[_0xb4b0('0x56')]['filename'])),_0x2b7654[_0xb4b0('0x4c')]));logger[_0xb4b0('0x5d')](_0xb4b0('0x5e'),_0x2544b1);logger[_0xb4b0('0x5d')](_0xb4b0('0x5f'),_0x1f9471);try{fs[_0xb4b0('0x60')](_0x2544b1,parseInt(_0xb4b0('0x61'),0x8));var _0x1c61c1=sox[_0xb4b0('0x62')](_0x2544b1,_0x1f9471,{'sampleRate':0x1f40,'format':_0xb4b0('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1c61c1['on'](_0xb4b0('0x2c'),function(_0x40c1bd){fs[_0xb4b0('0x63')](_0x2544b1);_0x51e6ff['status'](0x1f4)['send'](_0x40c1bd);});_0x1c61c1['on'](_0xb4b0('0x64'),function(_0x4b4646){_0x2b7654[_0xb4b0('0x65')]=isNaN(_0x4b4646['duration'])?null:_0x4b4646[_0xb4b0('0x66')]*0x3e8;_0x2b7654[_0xb4b0('0x67')]=isNaN(_0x4b4646['sampleCount'])?null:_0x4b4646[_0xb4b0('0x68')];_0x2b7654[_0xb4b0('0x69')]=isNaN(_0x4b4646[_0xb4b0('0x6a')])?null:_0x4b4646[_0xb4b0('0x6a')];_0x2b7654[_0xb4b0('0x6b')]=isNaN(_0x4b4646[_0xb4b0('0x6c')])?null:_0x4b4646['bitRate'];_0x2b7654[_0xb4b0('0x6d')]=isNaN(_0x4b4646[_0xb4b0('0x6e')])?null:_0x4b4646[_0xb4b0('0x6e')];});_0x1c61c1['on']('dest',function(_0x538d54){_0x2b7654['converted_duration']=isNaN(_0x538d54['duration'])?null:_0x538d54['duration']*0x3e8;_0x2b7654[_0xb4b0('0x6f')]=isNaN(_0x538d54[_0xb4b0('0x68')])?null:_0x538d54[_0xb4b0('0x68')];_0x2b7654[_0xb4b0('0x70')]=isNaN(_0x538d54[_0xb4b0('0x6a')])?null:_0x538d54['channelCount'];_0x2b7654['converted_bitRate']=isNaN(_0x538d54[_0xb4b0('0x6c')])?null:_0x538d54[_0xb4b0('0x6c')];_0x2b7654['converted_sampleRate']=isNaN(_0x538d54[_0xb4b0('0x6e')])?null:_0x538d54[_0xb4b0('0x6e')];});_0x1c61c1['on'](_0xb4b0('0x1b'),function(){fs[_0xb4b0('0x60')](_0x1f9471,parseInt(_0xb4b0('0x61'),0x8));return db[_0xb4b0('0x32')][_0xb4b0('0x71')](_0x2b7654)[_0xb4b0('0x27')](function(_0x4f02ae){var _0x4fd5e2={'role':_0x8807df[_0xb4b0('0x72')]['role'],'userProfileId':_0x8807df[_0xb4b0('0x72')][_0xb4b0('0x73')]};if(!_0x4fd5e2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fd5e2[_0xb4b0('0x74')]==='user'){var _0x19e910=_0x4f02ae[_0xb4b0('0x29')]({'plain':!![]});return db[_0xb4b0('0x75')][_0xb4b0('0x49')]({'where':{'name':'Sounds','userProfileId':_0x4fd5e2[_0xb4b0('0x73')]},'raw':!![]})[_0xb4b0('0x27')](function(_0x289ec7){if(_0x289ec7&&_0x289ec7[_0xb4b0('0x76')]===0x0){return db['UserProfileResource'][_0xb4b0('0x71')]({'name':_0x19e910[_0xb4b0('0x2e')],'resourceId':_0x19e910['id'],'type':_0x289ec7['name'],'sectionId':_0x289ec7['id']},{})['then'](function(){return _0x4f02ae;});}else{return _0x4f02ae;}})['catch'](function(_0x544e20){logger[_0xb4b0('0x2c')](_0xb4b0('0x77'),_0x544e20);throw _0x544e20;});}return _0x4f02ae;})[_0xb4b0('0x27')](respondWithResult(_0x51e6ff,null))[_0xb4b0('0x46')](handleError(_0x51e6ff,null));});_0x1c61c1[_0xb4b0('0x78')]();}catch(_0x41bc5b){_0x51e6ff['status'](0x1f4)[_0xb4b0('0x2f')](_0x41bc5b);}};exports[_0xb4b0('0x26')]=function(_0x5c7a21,_0x1702eb,_0x29c518){return db[_0xb4b0('0x32')]['find']({'where':{'id':_0x5c7a21['params']['id']}})[_0xb4b0('0x27')](handleEntityNotFound(_0x1702eb,null))[_0xb4b0('0x27')](saveUpdates(_[_0xb4b0('0x3f')](_0x5c7a21[_0xb4b0('0x72')],[_0xb4b0('0x2e'),_0xb4b0('0x79')]),null))[_0xb4b0('0x27')](respondWithResult(_0x1702eb,null))['catch'](handleError(_0x1702eb,null));};exports['delete']=function(_0x1e1ea4,_0x1c6527,_0x4e4709){return db['Sound']['find']({'where':{'id':_0x1e1ea4[_0xb4b0('0x4b')]['id']}})[_0xb4b0('0x27')](function(_0x2683cc){if(_0x2683cc){return _0x2683cc['destroy']();}})[_0xb4b0('0x27')](function(_0x34c312){var _0x39c661=path['join'](config[_0xb4b0('0x52')],_0xb4b0('0x5c'),util[_0xb4b0('0x54')](_0xb4b0('0x53'),_0x34c312[_0xb4b0('0x4e')],_0x34c312[_0xb4b0('0x7a')]));var _0xe34ab6=path[_0xb4b0('0x51')](config[_0xb4b0('0x52')],_0xb4b0('0x4d'),util['format']('%s.%s',_0x34c312[_0xb4b0('0x4e')],_0x34c312[_0xb4b0('0x4c')]));fs[_0xb4b0('0x63')](_0x39c661);fs['unlinkSync'](_0xe34ab6);return _0x34c312;})[_0xb4b0('0x27')](function(_0x33b7f4){if(_0x33b7f4){return _0x1c6527[_0xb4b0('0x1a')](0xcc)[_0xb4b0('0x1b')]();}})[_0xb4b0('0x27')](handleEntityNotFound(_0x1c6527,null))['catch'](handleError(_0x1c6527,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a17b979..93fcf50 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 _0xdd3b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Sound','tools_sounds'];(function(_0x26fa9f,_0x54a45c){var _0x4a9af8=function(_0x47558f){while(--_0x47558f){_0x26fa9f['push'](_0x26fa9f['shift']());}};_0x4a9af8(++_0x54a45c);}(_0xdd3b,0x118));var _0xbdd3=function(_0x225e03,_0x450dd6){_0x225e03=_0x225e03-0x0;var _0x1379b2=_0xdd3b[_0x225e03];return _0x1379b2;};'use strict';var _=require(_0xbdd3('0x0'));var util=require(_0xbdd3('0x1'));var logger=require(_0xbdd3('0x2'))(_0xbdd3('0x3'));var moment=require(_0xbdd3('0x4'));var BPromise=require(_0xbdd3('0x5'));var rp=require(_0xbdd3('0x6'));var fs=require('fs');var path=require(_0xbdd3('0x7'));var rimraf=require(_0xbdd3('0x8'));var config=require(_0xbdd3('0x9'));var attributes=require('./sound.attributes');module[_0xbdd3('0xa')]=function(_0xa12c6c,_0x31b785){return _0xa12c6c[_0xbdd3('0xb')](_0xbdd3('0xc'),attributes,{'tableName':_0xbdd3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5fb=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','Sound'];(function(_0x59cb82,_0x3c7b33){var _0x353c75=function(_0xcff816){while(--_0xcff816){_0x59cb82['push'](_0x59cb82['shift']());}};_0x353c75(++_0x3c7b33);}(_0xb5fb,0x16b));var _0xbb5f=function(_0x4491d9,_0x5856ec){_0x4491d9=_0x4491d9-0x0;var _0x3e9dba=_0xb5fb[_0x4491d9];return _0x3e9dba;};'use strict';var _=require(_0xbb5f('0x0'));var util=require(_0xbb5f('0x1'));var logger=require(_0xbb5f('0x2'))('api');var moment=require(_0xbb5f('0x3'));var BPromise=require(_0xbb5f('0x4'));var rp=require(_0xbb5f('0x5'));var fs=require('fs');var path=require(_0xbb5f('0x6'));var rimraf=require(_0xbb5f('0x7'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0xbb5f('0x8')]=function(_0x59f2f0,_0x12fb28){return _0x59f2f0[_0xbb5f('0x9')](_0xbb5f('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 2b1beed..214c8c4 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 _0xfe15=['bluebird','randomstring','../../mysqldb','../../config/utils','client','request','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Sound','find','options','raw','map','include','model','attributes','then','ShowSound','debug','lodash','util','moment'];(function(_0x172959,_0x2d6750){var _0x2c2f3d=function(_0x262902){while(--_0x262902){_0x172959['push'](_0x172959['shift']());}};_0x2c2f3d(++_0x2d6750);}(_0xfe15,0xab));var _0x5fe1=function(_0x2ed2f1,_0x7770fe){_0x2ed2f1=_0x2ed2f1-0x0;var _0x357717=_0xfe15[_0x2ed2f1];return _0x357717;};'use strict';var _=require(_0x5fe1('0x0'));var util=require(_0x5fe1('0x1'));var moment=require(_0x5fe1('0x2'));var BPromise=require(_0x5fe1('0x3'));var rs=require(_0x5fe1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5fe1('0x5'))['db'];var utils=require(_0x5fe1('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5fe1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cbbf0,_0x43688f,_0x31b735){return new BPromise(function(_0x278a1a,_0x3d2988){return client[_0x5fe1('0x8')](_0x4cbbf0,_0x31b735)['then'](function(_0x59e6ed){logger[_0x5fe1('0x9')](_0x5fe1('0xa'),_0x43688f,_0x5fe1('0xb'));logger['debug'](_0x5fe1('0xc'),_0x43688f,_0x5fe1('0xb'),JSON[_0x5fe1('0xd')](_0x59e6ed));if(_0x59e6ed[_0x5fe1('0xe')]){if(_0x59e6ed[_0x5fe1('0xe')][_0x5fe1('0xf')]===0x1f4){logger[_0x5fe1('0xe')](_0x5fe1('0xa'),_0x43688f,_0x59e6ed[_0x5fe1('0xe')]['message']);return _0x3d2988(_0x59e6ed[_0x5fe1('0xe')]['message']);}logger[_0x5fe1('0xe')](_0x5fe1('0xa'),_0x43688f,_0x59e6ed['error'][_0x5fe1('0x10')]);return _0x278a1a(_0x59e6ed[_0x5fe1('0xe')][_0x5fe1('0x10')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x43688f,_0x5fe1('0xb'));_0x278a1a(_0x59e6ed['result']['message']);}})[_0x5fe1('0x11')](function(_0x2aa89a){logger[_0x5fe1('0xe')](_0x5fe1('0xa'),_0x43688f,_0x2aa89a);_0x3d2988(_0x2aa89a);});});}exports['ShowSound']=function(_0x52e7aa){var _0x5821bb=this;return new Promise(function(_0x5d87a5,_0x56f29e){return db[_0x5fe1('0x12')][_0x5fe1('0x13')]({'raw':_0x52e7aa[_0x5fe1('0x14')]?_0x52e7aa[_0x5fe1('0x14')][_0x5fe1('0x15')]===undefined?!![]:![]:!![],'where':_0x52e7aa[_0x5fe1('0x14')]?_0x52e7aa['options']['where']||null:null,'attributes':_0x52e7aa[_0x5fe1('0x14')]?_0x52e7aa[_0x5fe1('0x14')]['attributes']||null:null,'include':_0x52e7aa[_0x5fe1('0x14')]?_0x52e7aa['options']['include']?_[_0x5fe1('0x16')](_0x52e7aa[_0x5fe1('0x14')][_0x5fe1('0x17')],function(_0x11c04a){return{'model':db[_0x11c04a[_0x5fe1('0x18')]],'as':_0x11c04a['as'],'attributes':_0x11c04a['attributes'],'include':_0x11c04a[_0x5fe1('0x17')]?_[_0x5fe1('0x16')](_0x11c04a[_0x5fe1('0x17')],function(_0x139e2b){return{'model':db[_0x139e2b[_0x5fe1('0x18')]],'as':_0x139e2b['as'],'attributes':_0x139e2b[_0x5fe1('0x19')],'include':_0x139e2b[_0x5fe1('0x17')]?_[_0x5fe1('0x16')](_0x139e2b[_0x5fe1('0x17')],function(_0xcbc1dc){return{'model':db[_0xcbc1dc[_0x5fe1('0x18')]],'as':_0xcbc1dc['as'],'attributes':_0xcbc1dc['attributes']};}):[]};}):[]};}):[]:[]})[_0x5fe1('0x1a')](function(_0x43b044){logger['info'](_0x5fe1('0x1b'),_0x52e7aa);logger[_0x5fe1('0x1c')]('ShowSound',_0x52e7aa,JSON[_0x5fe1('0xd')](_0x43b044));_0x5d87a5(_0x43b044);})[_0x5fe1('0x11')](function(_0x25ea67){logger['error']('ShowSound',_0x25ea67[_0x5fe1('0x10')],_0x52e7aa);_0x56f29e(_0x5821bb[_0x5fe1('0xe')](0x1f4,_0x25ea67['message']));});});}; \ No newline at end of file +var _0xa06b=['model','map','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','ShowSound','Sound','find','options','where','attributes','include'];(function(_0x3b2324,_0x5021ce){var _0x4b81f1=function(_0x4dfaf8){while(--_0x4dfaf8){_0x3b2324['push'](_0x3b2324['shift']());}};_0x4b81f1(++_0x5021ce);}(_0xa06b,0x1f2));var _0xba06=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa06b[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xba06('0x0'));var util=require(_0xba06('0x1'));var moment=require(_0xba06('0x2'));var BPromise=require(_0xba06('0x3'));var rs=require(_0xba06('0x4'));var fs=require('fs');var Redis=require(_0xba06('0x5'));var db=require(_0xba06('0x6'))['db'];var utils=require(_0xba06('0x7'));var logger=require(_0xba06('0x8'))('rpc');var config=require(_0xba06('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xba06('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f4d4b,_0x975c3a,_0x48e075){return new BPromise(function(_0x4b2a30,_0x5bae83){return client[_0xba06('0xb')](_0x4f4d4b,_0x48e075)[_0xba06('0xc')](function(_0x5c2b43){logger['info'](_0xba06('0xd'),_0x975c3a,_0xba06('0xe'));logger[_0xba06('0xf')](_0xba06('0x10'),_0x975c3a,'request\x20sent',JSON[_0xba06('0x11')](_0x5c2b43));if(_0x5c2b43['error']){if(_0x5c2b43['error'][_0xba06('0x12')]===0x1f4){logger[_0xba06('0x13')](_0xba06('0xd'),_0x975c3a,_0x5c2b43[_0xba06('0x13')]['message']);return _0x5bae83(_0x5c2b43[_0xba06('0x13')][_0xba06('0x14')]);}logger[_0xba06('0x13')]('Sound,\x20%s,\x20%s',_0x975c3a,_0x5c2b43[_0xba06('0x13')][_0xba06('0x14')]);return _0x4b2a30(_0x5c2b43[_0xba06('0x13')][_0xba06('0x14')]);}else{logger[_0xba06('0x15')]('Sound,\x20%s,\x20%s',_0x975c3a,_0xba06('0xe'));_0x4b2a30(_0x5c2b43[_0xba06('0x16')][_0xba06('0x14')]);}})['catch'](function(_0x1cd23c){logger['error'](_0xba06('0xd'),_0x975c3a,_0x1cd23c);_0x5bae83(_0x1cd23c);});});}exports[_0xba06('0x17')]=function(_0x51f441){var _0x14e625=this;return new Promise(function(_0x3789c2,_0x5b06f5){return db[_0xba06('0x18')][_0xba06('0x19')]({'raw':_0x51f441[_0xba06('0x1a')]?_0x51f441[_0xba06('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x51f441[_0xba06('0x1a')]?_0x51f441[_0xba06('0x1a')][_0xba06('0x1b')]||null:null,'attributes':_0x51f441[_0xba06('0x1a')]?_0x51f441[_0xba06('0x1a')][_0xba06('0x1c')]||null:null,'include':_0x51f441['options']?_0x51f441[_0xba06('0x1a')][_0xba06('0x1d')]?_['map'](_0x51f441['options'][_0xba06('0x1d')],function(_0xc8601b){return{'model':db[_0xc8601b[_0xba06('0x1e')]],'as':_0xc8601b['as'],'attributes':_0xc8601b['attributes'],'include':_0xc8601b[_0xba06('0x1d')]?_[_0xba06('0x1f')](_0xc8601b[_0xba06('0x1d')],function(_0x3116ab){return{'model':db[_0x3116ab[_0xba06('0x1e')]],'as':_0x3116ab['as'],'attributes':_0x3116ab['attributes'],'include':_0x3116ab[_0xba06('0x1d')]?_['map'](_0x3116ab[_0xba06('0x1d')],function(_0x5d78a1){return{'model':db[_0x5d78a1[_0xba06('0x1e')]],'as':_0x5d78a1['as'],'attributes':_0x5d78a1[_0xba06('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xba06('0xc')](function(_0x146a0a){logger[_0xba06('0x15')](_0xba06('0x17'),_0x51f441);logger[_0xba06('0xf')](_0xba06('0x17'),_0x51f441,JSON[_0xba06('0x11')](_0x146a0a));_0x3789c2(_0x146a0a);})[_0xba06('0x20')](function(_0x15b047){logger[_0xba06('0x13')](_0xba06('0x17'),_0x15b047[_0xba06('0x14')],_0x51f441);_0x5b06f5(_0x14e625[_0xba06('0x13')](0x1f4,_0x15b047['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 0389509..8e03be3 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 _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x35b460,_0x2aea78){_0x35b460=_0x35b460-0x0;var _0x1dbcca=_0x9ffd[_0x35b460];return _0x1dbcca;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file +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(_0x41a623,_0x5e1659){var _0x566c17=function(_0x5a2085){while(--_0x5a2085){_0x41a623['push'](_0x41a623['shift']());}};_0x566c17(++_0x5e1659);}(_0xb7e7,0x121));var _0x7b7e=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xb7e7[_0x68ee8b];return _0x5148f7;};'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 diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 0476fb4..e4dc543 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 _0x4246=['ENUM','out','STRING','exports','TEXT','medium'];(function(_0x12a02e,_0x78f64){var _0x2f161d=function(_0x40de01){while(--_0x40de01){_0x12a02e['push'](_0x12a02e['shift']());}};_0x2f161d(++_0x78f64);}(_0x4246,0x177));var _0x6424=function(_0x34df63,_0x40bd2f){_0x34df63=_0x34df63-0x0;var _0x391101=_0x4246[_0x34df63];return _0x391101;};'use strict';var Sequelize=require('sequelize');module[_0x6424('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x6424('0x1')](_0x6424('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x6424('0x3')]('in',_0x6424('0x4')),'defaultValue':_0x6424('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x6424('0x5')]},'providerResponse':{'type':Sequelize[_0x6424('0x1')]}}; \ No newline at end of file +var _0x6ae2=['exports','STRING','medium','ENUM','out'];(function(_0x54a02d,_0x26839f){var _0x4365cf=function(_0x5c6f7b){while(--_0x5c6f7b){_0x54a02d['push'](_0x54a02d['shift']());}};_0x4365cf(++_0x26839f);}(_0x6ae2,0x12c));var _0x26ae=function(_0x54e7a9,_0x1a79d7){_0x54e7a9=_0x54e7a9-0x0;var _0x4507a7=_0x6ae2[_0x54e7a9];return _0x4507a7;};'use strict';var Sequelize=require('sequelize');module[_0x26ae('0x0')]={'uniqueid':{'type':Sequelize[_0x26ae('0x1')]},'body':{'type':Sequelize['TEXT'](_0x26ae('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x26ae('0x3')]('in','out'),'defaultValue':_0x26ae('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'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 afe96da..dab933a 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 _0xe452=['sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','name','send','map','SquareMessage','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','options','include','rows','catch','show','params','keys','includeAll','create','update','body','find','eml-format','request-promise','bluebird','util','path'];(function(_0x24535c,_0x4e8b3e){var _0x541cf2=function(_0x134ade){while(--_0x134ade){_0x24535c['push'](_0x24535c['shift']());}};_0x541cf2(++_0x4e8b3e);}(_0xe452,0x159));var _0x2e45=function(_0x1b734e,_0x456cd8){_0x1b734e=_0x1b734e-0x0;var _0x841eed=_0xe452[_0x1b734e];return _0x841eed;};'use strict';var emlformat=require(_0x2e45('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2e45('0x1'));var moment=require('moment');var BPromise=require(_0x2e45('0x2'));var Mustache=require('mustache');var util=require(_0x2e45('0x3'));var path=require(_0x2e45('0x4'));var sox=require(_0x2e45('0x5'));var csv=require('to-csv');var ejs=require(_0x2e45('0x6'));var fs=require('fs');var fs_extra=require(_0x2e45('0x7'));var _=require('lodash');var squel=require(_0x2e45('0x8'));var crypto=require(_0x2e45('0x9'));var jsforce=require(_0x2e45('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2e45('0xb'));var querystring=require(_0x2e45('0xc'));var Papa=require(_0x2e45('0xd'));var Redis=require(_0x2e45('0xe'));var authService=require(_0x2e45('0xf'));var qs=require(_0x2e45('0x10'));var as=require(_0x2e45('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e45('0x12'))(_0x2e45('0x13'));var utils=require(_0x2e45('0x14'));var config=require(_0x2e45('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f0984,_0xe36fc9){_0xe36fc9=_0xe36fc9||0xcc;return function(_0x18ca48){if(_0x18ca48){return _0x5f0984['sendStatus'](_0xe36fc9);}return _0x5f0984[_0x2e45('0x16')](_0xe36fc9)[_0x2e45('0x17')]();};}function respondWithResult(_0x2e4be4,_0x364c7d){_0x364c7d=_0x364c7d||0xc8;return function(_0x4643ae){if(_0x4643ae){return _0x2e4be4[_0x2e45('0x16')](_0x364c7d)['json'](_0x4643ae);}};}function respondWithFilteredResult(_0x13492e,_0x5cf2e1){return function(_0x128b64){if(_0x128b64){var _0x2b0b1d=typeof _0x5cf2e1[_0x2e45('0x18')]===_0x2e45('0x19')&&typeof _0x5cf2e1['limit']===_0x2e45('0x19');var _0xd5bd79=_0x128b64[_0x2e45('0x1a')];var _0x15033f=_0x2b0b1d?0x0:_0x5cf2e1['offset'];var _0x1c65aa=_0x2b0b1d?_0x128b64[_0x2e45('0x1a')]:_0x5cf2e1['offset']+_0x5cf2e1[_0x2e45('0x1b')];var _0x12b2ef;if(_0x1c65aa>=_0xd5bd79){_0x1c65aa=_0xd5bd79;_0x12b2ef=0xc8;}else{_0x12b2ef=0xce;}_0x13492e[_0x2e45('0x16')](_0x12b2ef);return _0x13492e['set'](_0x2e45('0x1c'),_0x15033f+'-'+_0x1c65aa+'/'+_0xd5bd79)[_0x2e45('0x1d')](_0x128b64);}return null;};}function patchUpdates(_0x4736e4){return function(_0x275c2f){try{jsonpatch[_0x2e45('0x1e')](_0x275c2f,_0x4736e4,!![]);}catch(_0x3f6681){return BPromise[_0x2e45('0x1f')](_0x3f6681);}return _0x275c2f[_0x2e45('0x20')]();};}function saveUpdates(_0x2a8ee6,_0x172bdf){return function(_0x45c737){if(_0x45c737){return _0x45c737['update'](_0x2a8ee6)[_0x2e45('0x21')](function(_0x3f66b7){return _0x3f66b7;});}return null;};}function removeEntity(_0x2b6a5d,_0x3df923){return function(_0x2cf71a){if(_0x2cf71a){return _0x2cf71a[_0x2e45('0x22')]()[_0x2e45('0x21')](function(){_0x2b6a5d[_0x2e45('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a4452,_0x55de84){return function(_0x2906f6){if(!_0x2906f6){_0x1a4452[_0x2e45('0x23')](0x194);}return _0x2906f6;};}function handleError(_0x1facb8,_0x1a3c7b){_0x1a3c7b=_0x1a3c7b||0x1f4;return function(_0x1ba471){logger['error'](_0x1ba471[_0x2e45('0x24')]);if(_0x1ba471[_0x2e45('0x25')]){delete _0x1ba471[_0x2e45('0x25')];}_0x1facb8['status'](_0x1a3c7b)[_0x2e45('0x26')](_0x1ba471);};}exports['index']=function(_0x507e28,_0x1fd287){var _0x3ee7df={},_0x21b33d={},_0x4ef44f={'count':0x0,'rows':[]};var _0x2759ad=_[_0x2e45('0x27')](db[_0x2e45('0x28')][_0x2e45('0x29')],function(_0x1fec1a){return{'name':_0x1fec1a[_0x2e45('0x2a')],'type':_0x1fec1a['type']['key']};});_0x21b33d[_0x2e45('0x2b')]=_[_0x2e45('0x27')](_0x2759ad,'name');_0x21b33d[_0x2e45('0x2c')]=_['keys'](_0x507e28['query']);_0x21b33d[_0x2e45('0x2d')]=_['intersection'](_0x21b33d['model'],_0x21b33d['query']);_0x3ee7df[_0x2e45('0x2e')]=_[_0x2e45('0x2f')](_0x21b33d['model'],qs[_0x2e45('0x30')](_0x507e28[_0x2e45('0x2c')]['fields']));_0x3ee7df[_0x2e45('0x2e')]=_0x3ee7df[_0x2e45('0x2e')][_0x2e45('0x31')]?_0x3ee7df[_0x2e45('0x2e')]:_0x21b33d[_0x2e45('0x2b')];if(!_0x507e28[_0x2e45('0x2c')][_0x2e45('0x32')]('nolimit')){_0x3ee7df[_0x2e45('0x1b')]=qs[_0x2e45('0x1b')](_0x507e28[_0x2e45('0x2c')][_0x2e45('0x1b')]);_0x3ee7df[_0x2e45('0x18')]=qs[_0x2e45('0x18')](_0x507e28[_0x2e45('0x2c')]['offset']);}_0x3ee7df[_0x2e45('0x33')]=qs[_0x2e45('0x34')](_0x507e28['query']['sort']);_0x3ee7df[_0x2e45('0x35')]=qs[_0x2e45('0x2d')](_[_0x2e45('0x36')](_0x507e28[_0x2e45('0x2c')],_0x21b33d[_0x2e45('0x2d')]),_0x2759ad);if(_0x507e28['query']['filter']){_0x3ee7df[_0x2e45('0x35')]=_['merge'](_0x3ee7df['where'],{'$or':_[_0x2e45('0x27')](_0x2759ad,function(_0x4521f5){if(_0x4521f5[_0x2e45('0x37')]!==_0x2e45('0x38')){var _0x115f66={};_0x115f66[_0x4521f5[_0x2e45('0x25')]]={'$like':'%'+_0x507e28[_0x2e45('0x2c')][_0x2e45('0x39')]+'%'};return _0x115f66;}})});}_0x3ee7df=_['merge']({},_0x3ee7df,_0x507e28[_0x2e45('0x3a')]);var _0x4fc7bd={'where':_0x3ee7df['where']};return db[_0x2e45('0x28')]['count'](_0x4fc7bd)[_0x2e45('0x21')](function(_0x6cb9e){_0x4ef44f[_0x2e45('0x1a')]=_0x6cb9e;if(_0x507e28[_0x2e45('0x2c')]['includeAll']){_0x3ee7df[_0x2e45('0x3b')]=[{'all':!![]}];}return db[_0x2e45('0x28')]['findAll'](_0x3ee7df);})[_0x2e45('0x21')](function(_0x5cbbc9){_0x4ef44f[_0x2e45('0x3c')]=_0x5cbbc9;return _0x4ef44f;})['then'](respondWithFilteredResult(_0x1fd287,_0x3ee7df))[_0x2e45('0x3d')](handleError(_0x1fd287,null));};exports[_0x2e45('0x3e')]=function(_0x236193,_0x45785c){var _0x2c0298={'raw':!![],'where':{'id':_0x236193[_0x2e45('0x3f')]['id']}},_0x239cfa={};_0x239cfa[_0x2e45('0x2b')]=_[_0x2e45('0x40')](db[_0x2e45('0x28')][_0x2e45('0x29')]);_0x239cfa[_0x2e45('0x2c')]=_['keys'](_0x236193[_0x2e45('0x2c')]);_0x239cfa[_0x2e45('0x2d')]=_[_0x2e45('0x2f')](_0x239cfa[_0x2e45('0x2b')],_0x239cfa[_0x2e45('0x2c')]);_0x2c0298[_0x2e45('0x2e')]=_[_0x2e45('0x2f')](_0x239cfa[_0x2e45('0x2b')],qs['fields'](_0x236193[_0x2e45('0x2c')][_0x2e45('0x30')]));_0x2c0298['attributes']=_0x2c0298[_0x2e45('0x2e')]['length']?_0x2c0298[_0x2e45('0x2e')]:_0x239cfa['model'];if(_0x236193[_0x2e45('0x2c')][_0x2e45('0x41')]){_0x2c0298[_0x2e45('0x3b')]=[{'all':!![]}];}_0x2c0298=_['merge']({},_0x2c0298,_0x236193[_0x2e45('0x3a')]);return db[_0x2e45('0x28')]['find'](_0x2c0298)['then'](handleEntityNotFound(_0x45785c,null))[_0x2e45('0x21')](respondWithResult(_0x45785c,null))[_0x2e45('0x3d')](handleError(_0x45785c,null));};exports[_0x2e45('0x42')]=function(_0x79fd6b,_0x1aa893){return db[_0x2e45('0x28')][_0x2e45('0x42')](_0x79fd6b['body'],{})[_0x2e45('0x21')](respondWithResult(_0x1aa893,0xc9))[_0x2e45('0x3d')](handleError(_0x1aa893,null));};exports[_0x2e45('0x43')]=function(_0x267d7c,_0xbaaa00){if(_0x267d7c['body']['id']){delete _0x267d7c[_0x2e45('0x44')]['id'];}return db[_0x2e45('0x28')]['find']({'where':{'id':_0x267d7c[_0x2e45('0x3f')]['id']}})['then'](handleEntityNotFound(_0xbaaa00,null))[_0x2e45('0x21')](saveUpdates(_0x267d7c[_0x2e45('0x44')],null))[_0x2e45('0x21')](respondWithResult(_0xbaaa00,null))[_0x2e45('0x3d')](handleError(_0xbaaa00,null));};exports[_0x2e45('0x22')]=function(_0x25db5b,_0x1ff836){return db[_0x2e45('0x28')][_0x2e45('0x45')]({'where':{'id':_0x25db5b[_0x2e45('0x3f')]['id']}})[_0x2e45('0x21')](handleEntityNotFound(_0x1ff836,null))[_0x2e45('0x21')](removeEntity(_0x1ff836,null))[_0x2e45('0x3d')](handleError(_0x1ff836,null));}; \ No newline at end of file +var _0xde1e=['fields','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','SquareMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xde1e,0x9d));var _0xede1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xde1e[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xede1('0x0'));var rimraf=require(_0xede1('0x1'));var zipdir=require(_0xede1('0x2'));var jsonpatch=require(_0xede1('0x3'));var rp=require(_0xede1('0x4'));var moment=require(_0xede1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xede1('0x6'));var util=require(_0xede1('0x7'));var path=require(_0xede1('0x8'));var sox=require(_0xede1('0x9'));var csv=require(_0xede1('0xa'));var ejs=require(_0xede1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xede1('0xc'));var squel=require(_0xede1('0xd'));var crypto=require(_0xede1('0xe'));var jsforce=require(_0xede1('0xf'));var deskjs=require(_0xede1('0x10'));var toCsv=require(_0xede1('0xa'));var querystring=require('querystring');var Papa=require(_0xede1('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xede1('0x12'));var as=require(_0xede1('0x13'));var hardwareService=require(_0xede1('0x14'));var logger=require(_0xede1('0x15'))(_0xede1('0x16'));var utils=require(_0xede1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xede1('0x18'));var db=require(_0xede1('0x19'))['db'];function respondWithStatusCode(_0x21fe95,_0x4c6e25){_0x4c6e25=_0x4c6e25||0xcc;return function(_0x56bcfa){if(_0x56bcfa){return _0x21fe95[_0xede1('0x1a')](_0x4c6e25);}return _0x21fe95[_0xede1('0x1b')](_0x4c6e25)[_0xede1('0x1c')]();};}function respondWithResult(_0x3dea69,_0x1f0d5d){_0x1f0d5d=_0x1f0d5d||0xc8;return function(_0x4e3575){if(_0x4e3575){return _0x3dea69[_0xede1('0x1b')](_0x1f0d5d)[_0xede1('0x1d')](_0x4e3575);}};}function respondWithFilteredResult(_0x176828,_0xc3dd7d){return function(_0x3be8dd){if(_0x3be8dd){var _0x1600ec=typeof _0xc3dd7d[_0xede1('0x1e')]===_0xede1('0x1f')&&typeof _0xc3dd7d['limit']===_0xede1('0x1f');var _0x2aff53=_0x3be8dd[_0xede1('0x20')];var _0x24f860=_0x1600ec?0x0:_0xc3dd7d[_0xede1('0x1e')];var _0x213150=_0x1600ec?_0x3be8dd[_0xede1('0x20')]:_0xc3dd7d[_0xede1('0x1e')]+_0xc3dd7d[_0xede1('0x21')];var _0x7f7895;if(_0x213150>=_0x2aff53){_0x213150=_0x2aff53;_0x7f7895=0xc8;}else{_0x7f7895=0xce;}_0x176828[_0xede1('0x1b')](_0x7f7895);return _0x176828['set'](_0xede1('0x22'),_0x24f860+'-'+_0x213150+'/'+_0x2aff53)['json'](_0x3be8dd);}return null;};}function patchUpdates(_0x55523b){return function(_0x3dbcdf){try{jsonpatch[_0xede1('0x23')](_0x3dbcdf,_0x55523b,!![]);}catch(_0x1253f2){return BPromise[_0xede1('0x24')](_0x1253f2);}return _0x3dbcdf[_0xede1('0x25')]();};}function saveUpdates(_0x11ead4,_0x153943){return function(_0x38f970){if(_0x38f970){return _0x38f970['update'](_0x11ead4)[_0xede1('0x26')](function(_0x3c13d9){return _0x3c13d9;});}return null;};}function removeEntity(_0x588cd4,_0x530ab8){return function(_0xfff77d){if(_0xfff77d){return _0xfff77d[_0xede1('0x27')]()['then'](function(){_0x588cd4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12149f,_0x1b5275){return function(_0x3576d2){if(!_0x3576d2){_0x12149f[_0xede1('0x1a')](0x194);}return _0x3576d2;};}function handleError(_0x36ddc8,_0x1cc7eb){_0x1cc7eb=_0x1cc7eb||0x1f4;return function(_0x2a8ebb){logger[_0xede1('0x28')](_0x2a8ebb[_0xede1('0x29')]);if(_0x2a8ebb[_0xede1('0x2a')]){delete _0x2a8ebb[_0xede1('0x2a')];}_0x36ddc8[_0xede1('0x1b')](_0x1cc7eb)['send'](_0x2a8ebb);};}exports[_0xede1('0x2b')]=function(_0x44d7d4,_0x4ef352){var _0x368946={},_0x20e647={},_0xbf0a98={'count':0x0,'rows':[]};var _0x357173=_[_0xede1('0x2c')](db[_0xede1('0x2d')][_0xede1('0x2e')],function(_0x3d179e){return{'name':_0x3d179e[_0xede1('0x2f')],'type':_0x3d179e['type']['key']};});_0x20e647[_0xede1('0x30')]=_['map'](_0x357173,_0xede1('0x2a'));_0x20e647[_0xede1('0x31')]=_[_0xede1('0x32')](_0x44d7d4[_0xede1('0x31')]);_0x20e647[_0xede1('0x33')]=_[_0xede1('0x34')](_0x20e647[_0xede1('0x30')],_0x20e647[_0xede1('0x31')]);_0x368946[_0xede1('0x35')]=_['intersection'](_0x20e647[_0xede1('0x30')],qs['fields'](_0x44d7d4[_0xede1('0x31')]['fields']));_0x368946[_0xede1('0x35')]=_0x368946[_0xede1('0x35')][_0xede1('0x36')]?_0x368946[_0xede1('0x35')]:_0x20e647[_0xede1('0x30')];if(!_0x44d7d4['query'][_0xede1('0x37')]('nolimit')){_0x368946[_0xede1('0x21')]=qs[_0xede1('0x21')](_0x44d7d4[_0xede1('0x31')][_0xede1('0x21')]);_0x368946[_0xede1('0x1e')]=qs['offset'](_0x44d7d4[_0xede1('0x31')][_0xede1('0x1e')]);}_0x368946[_0xede1('0x38')]=qs[_0xede1('0x39')](_0x44d7d4[_0xede1('0x31')][_0xede1('0x39')]);_0x368946['where']=qs[_0xede1('0x33')](_[_0xede1('0x3a')](_0x44d7d4[_0xede1('0x31')],_0x20e647['filters']),_0x357173);if(_0x44d7d4[_0xede1('0x31')][_0xede1('0x3b')]){_0x368946['where']=_[_0xede1('0x3c')](_0x368946[_0xede1('0x3d')],{'$or':_['map'](_0x357173,function(_0x4cb806){if(_0x4cb806[_0xede1('0x3e')]!==_0xede1('0x3f')){var _0x3f4be4={};_0x3f4be4[_0x4cb806[_0xede1('0x2a')]]={'$like':'%'+_0x44d7d4[_0xede1('0x31')][_0xede1('0x3b')]+'%'};return _0x3f4be4;}})});}_0x368946=_[_0xede1('0x3c')]({},_0x368946,_0x44d7d4[_0xede1('0x40')]);var _0x3cfd96={'where':_0x368946[_0xede1('0x3d')]};return db['SquareMessage'][_0xede1('0x20')](_0x3cfd96)[_0xede1('0x26')](function(_0x28fb0d){_0xbf0a98[_0xede1('0x20')]=_0x28fb0d;if(_0x44d7d4[_0xede1('0x31')][_0xede1('0x41')]){_0x368946['include']=[{'all':!![]}];}return db[_0xede1('0x2d')][_0xede1('0x42')](_0x368946);})[_0xede1('0x26')](function(_0x477ea7){_0xbf0a98[_0xede1('0x43')]=_0x477ea7;return _0xbf0a98;})[_0xede1('0x26')](respondWithFilteredResult(_0x4ef352,_0x368946))[_0xede1('0x44')](handleError(_0x4ef352,null));};exports[_0xede1('0x45')]=function(_0xf409e6,_0x1f73f8){var _0x32b6ba={'raw':!![],'where':{'id':_0xf409e6[_0xede1('0x46')]['id']}},_0x59680b={};_0x59680b[_0xede1('0x30')]=_['keys'](db[_0xede1('0x2d')][_0xede1('0x2e')]);_0x59680b[_0xede1('0x31')]=_[_0xede1('0x32')](_0xf409e6[_0xede1('0x31')]);_0x59680b[_0xede1('0x33')]=_[_0xede1('0x34')](_0x59680b[_0xede1('0x30')],_0x59680b['query']);_0x32b6ba['attributes']=_[_0xede1('0x34')](_0x59680b[_0xede1('0x30')],qs[_0xede1('0x47')](_0xf409e6['query'][_0xede1('0x47')]));_0x32b6ba[_0xede1('0x35')]=_0x32b6ba['attributes'][_0xede1('0x36')]?_0x32b6ba[_0xede1('0x35')]:_0x59680b[_0xede1('0x30')];if(_0xf409e6[_0xede1('0x31')]['includeAll']){_0x32b6ba['include']=[{'all':!![]}];}_0x32b6ba=_[_0xede1('0x3c')]({},_0x32b6ba,_0xf409e6[_0xede1('0x40')]);return db[_0xede1('0x2d')]['find'](_0x32b6ba)[_0xede1('0x26')](handleEntityNotFound(_0x1f73f8,null))['then'](respondWithResult(_0x1f73f8,null))[_0xede1('0x44')](handleError(_0x1f73f8,null));};exports[_0xede1('0x48')]=function(_0x361d70,_0x298e22){return db[_0xede1('0x2d')][_0xede1('0x48')](_0x361d70[_0xede1('0x49')],{})['then'](respondWithResult(_0x298e22,0xc9))[_0xede1('0x44')](handleError(_0x298e22,null));};exports[_0xede1('0x4a')]=function(_0x4e0ad7,_0x2f18f9){if(_0x4e0ad7[_0xede1('0x49')]['id']){delete _0x4e0ad7[_0xede1('0x49')]['id'];}return db[_0xede1('0x2d')][_0xede1('0x4b')]({'where':{'id':_0x4e0ad7[_0xede1('0x46')]['id']}})[_0xede1('0x26')](handleEntityNotFound(_0x2f18f9,null))[_0xede1('0x26')](saveUpdates(_0x4e0ad7[_0xede1('0x49')],null))[_0xede1('0x26')](respondWithResult(_0x2f18f9,null))[_0xede1('0x44')](handleError(_0x2f18f9,null));};exports[_0xede1('0x27')]=function(_0x318736,_0x3f9d13){return db['SquareMessage'][_0xede1('0x4b')]({'where':{'id':_0x318736[_0xede1('0x46')]['id']}})[_0xede1('0x26')](handleEntityNotFound(_0x3f9d13,null))['then'](removeEntity(_0x3f9d13,null))[_0xede1('0x44')](handleError(_0x3f9d13,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 07ce2da..bde7640 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 _0x0ca5=['bluebird','path','rimraf','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment'];(function(_0x2b7e0a,_0x35d7be){var _0x3b13ed=function(_0x3cc57f){while(--_0x3cc57f){_0x2b7e0a['push'](_0x2b7e0a['shift']());}};_0x3b13ed(++_0x35d7be);}(_0x0ca5,0x1dc));var _0x50ca=function(_0xc008bb,_0x424548){_0xc008bb=_0xc008bb-0x0;var _0x38b535=_0x0ca5[_0xc008bb];return _0x38b535;};'use strict';var _=require(_0x50ca('0x0'));var util=require(_0x50ca('0x1'));var logger=require(_0x50ca('0x2'))(_0x50ca('0x3'));var moment=require(_0x50ca('0x4'));var BPromise=require(_0x50ca('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x50ca('0x6'));var rimraf=require(_0x50ca('0x7'));var config=require('../../config/environment');var attributes=require(_0x50ca('0x8'));module[_0x50ca('0x9')]=function(_0x5a5f67,_0x5437f4){return _0x5a5f67[_0x50ca('0xa')](_0x50ca('0xb'),attributes,{'tableName':_0x50ca('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60f4=['request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','square_messages','util','../../config/logger','api','moment','bluebird'];(function(_0x3f7b8b,_0x3b62b1){var _0x368374=function(_0x129400){while(--_0x129400){_0x3f7b8b['push'](_0x3f7b8b['shift']());}};_0x368374(++_0x3b62b1);}(_0x60f4,0x7d));var _0x460f=function(_0x3e0188,_0x42919b){_0x3e0188=_0x3e0188-0x0;var _0x1d87f1=_0x60f4[_0x3e0188];return _0x1d87f1;};'use strict';var _=require('lodash');var util=require(_0x460f('0x0'));var logger=require(_0x460f('0x1'))(_0x460f('0x2'));var moment=require(_0x460f('0x3'));var BPromise=require(_0x460f('0x4'));var rp=require(_0x460f('0x5'));var fs=require('fs');var path=require(_0x460f('0x6'));var rimraf=require(_0x460f('0x7'));var config=require(_0x460f('0x8'));var attributes=require(_0x460f('0x9'));module[_0x460f('0xa')]=function(_0x2d0f51,_0x4d40ef){return _0x2d0f51[_0x460f('0xb')]('SquareMessage',attributes,{'tableName':_0x460f('0xc'),'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 dce7be5..7178aa7 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 _0x8ec5=['http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xf67f45,_0x36e087){var _0xd9ab5=function(_0x594070){while(--_0x594070){_0xf67f45['push'](_0xf67f45['shift']());}};_0xd9ab5(++_0x36e087);}(_0x8ec5,0x1e2));var _0x58ec=function(_0x50ff34,_0x134b03){_0x50ff34=_0x50ff34-0x0;var _0x2c597b=_0x8ec5[_0x50ff34];return _0x2c597b;};'use strict';var _=require('lodash');var util=require(_0x58ec('0x0'));var moment=require(_0x58ec('0x1'));var BPromise=require(_0x58ec('0x2'));var rs=require(_0x58ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58ec('0x4'))['db'];var utils=require(_0x58ec('0x5'));var logger=require(_0x58ec('0x6'))(_0x58ec('0x7'));var config=require(_0x58ec('0x8'));var jayson=require(_0x58ec('0x9'));var client=jayson[_0x58ec('0xa')][_0x58ec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x877fca,_0xa72ad4,_0x3e97b4){return new BPromise(function(_0x495d82,_0x5c791c){return client['request'](_0x877fca,_0x3e97b4)[_0x58ec('0xc')](function(_0xa3aa7b){logger[_0x58ec('0xd')](_0x58ec('0xe'),_0xa72ad4,_0x58ec('0xf'));logger['debug'](_0x58ec('0x10'),_0xa72ad4,_0x58ec('0xf'),JSON[_0x58ec('0x11')](_0xa3aa7b));if(_0xa3aa7b[_0x58ec('0x12')]){if(_0xa3aa7b['error'][_0x58ec('0x13')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0xa72ad4,_0xa3aa7b['error'][_0x58ec('0x14')]);return _0x5c791c(_0xa3aa7b[_0x58ec('0x12')][_0x58ec('0x14')]);}logger[_0x58ec('0x12')](_0x58ec('0xe'),_0xa72ad4,_0xa3aa7b['error'][_0x58ec('0x14')]);return _0x495d82(_0xa3aa7b[_0x58ec('0x12')][_0x58ec('0x14')]);}else{logger[_0x58ec('0xd')](_0x58ec('0xe'),_0xa72ad4,_0x58ec('0xf'));_0x495d82(_0xa3aa7b[_0x58ec('0x15')][_0x58ec('0x14')]);}})[_0x58ec('0x16')](function(_0x2df56e){logger[_0x58ec('0x12')](_0x58ec('0xe'),_0xa72ad4,_0x2df56e);_0x5c791c(_0x2df56e);});});}exports[_0x58ec('0x17')]=function(_0x342c4b){var _0x263908=this;return new Promise(function(_0x2dc24a,_0x17b2cc){return db[_0x58ec('0x18')][_0x58ec('0x19')](_0x342c4b[_0x58ec('0x1a')],{'raw':_0x342c4b['options']?_0x342c4b[_0x58ec('0x1b')][_0x58ec('0x1c')]===undefined?!![]:![]:!![]})[_0x58ec('0xc')](function(_0x3078e2){logger[_0x58ec('0xd')]('CreateSquareMessage',_0x342c4b);logger['debug'](_0x58ec('0x17'),_0x342c4b,JSON[_0x58ec('0x11')](_0x3078e2));_0x2dc24a(_0x3078e2);})['catch'](function(_0x2f80d1){logger[_0x58ec('0x12')](_0x58ec('0x17'),_0x2f80d1[_0x58ec('0x14')],_0x342c4b);_0x17b2cc(_0x263908['error'](0x1f4,_0x2f80d1[_0x58ec('0x14')]));});});}; \ No newline at end of file +var _0x45b6=['error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xcf3f85,_0x21f5a8){var _0x1d6820=function(_0x44a593){while(--_0x44a593){_0xcf3f85['push'](_0xcf3f85['shift']());}};_0x1d6820(++_0x21f5a8);}(_0x45b6,0x134));var _0x645b=function(_0x5813fa,_0x56533a){_0x5813fa=_0x5813fa-0x0;var _0x53136c=_0x45b6[_0x5813fa];return _0x53136c;};'use strict';var _=require('lodash');var util=require(_0x645b('0x0'));var moment=require(_0x645b('0x1'));var BPromise=require(_0x645b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x645b('0x3'));var db=require(_0x645b('0x4'))['db'];var utils=require(_0x645b('0x5'));var logger=require(_0x645b('0x6'))(_0x645b('0x7'));var config=require('../../config/environment');var jayson=require(_0x645b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x493876,_0x507b06,_0x1a2827){return new BPromise(function(_0xc4bf4a,_0x5974ea){return client['request'](_0x493876,_0x1a2827)[_0x645b('0x9')](function(_0x15a119){logger[_0x645b('0xa')](_0x645b('0xb'),_0x507b06,_0x645b('0xc'));logger[_0x645b('0xd')](_0x645b('0xe'),_0x507b06,_0x645b('0xc'),JSON[_0x645b('0xf')](_0x15a119));if(_0x15a119[_0x645b('0x10')]){if(_0x15a119[_0x645b('0x10')][_0x645b('0x11')]===0x1f4){logger[_0x645b('0x10')](_0x645b('0xb'),_0x507b06,_0x15a119[_0x645b('0x10')][_0x645b('0x12')]);return _0x5974ea(_0x15a119['error'][_0x645b('0x12')]);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x507b06,_0x15a119['error'][_0x645b('0x12')]);return _0xc4bf4a(_0x15a119[_0x645b('0x10')][_0x645b('0x12')]);}else{logger[_0x645b('0xa')](_0x645b('0xb'),_0x507b06,_0x645b('0xc'));_0xc4bf4a(_0x15a119[_0x645b('0x13')][_0x645b('0x12')]);}})[_0x645b('0x14')](function(_0x5762a8){logger[_0x645b('0x10')](_0x645b('0xb'),_0x507b06,_0x5762a8);_0x5974ea(_0x5762a8);});});}exports[_0x645b('0x15')]=function(_0x15984d){var _0x169acb=this;return new Promise(function(_0x69bf24,_0xb4a588){return db[_0x645b('0x16')][_0x645b('0x17')](_0x15984d[_0x645b('0x18')],{'raw':_0x15984d[_0x645b('0x19')]?_0x15984d['options'][_0x645b('0x1a')]===undefined?!![]:![]:!![]})[_0x645b('0x9')](function(_0x24c2f8){logger['info'](_0x645b('0x15'),_0x15984d);logger[_0x645b('0xd')]('CreateSquareMessage',_0x15984d,JSON[_0x645b('0xf')](_0x24c2f8));_0x69bf24(_0x24c2f8);})['catch'](function(_0x2661ac){logger[_0x645b('0x10')](_0x645b('0x15'),_0x2661ac['message'],_0x15984d);_0xb4a588(_0x169acb[_0x645b('0x10')](0x1f4,_0x2661ac[_0x645b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 3b203d2..4704475 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 _0x3429=['create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','15s','test','post'];(function(_0x318522,_0x5dd509){var _0x523fa1=function(_0x2aa389){while(--_0x2aa389){_0x318522['push'](_0x318522['shift']());}};_0x523fa1(++_0x5dd509);}(_0x3429,0x17e));var _0x9342=function(_0x4459d8,_0x5e3b68){_0x4459d8=_0x4459d8-0x0;var _0x260149=_0x3429[_0x4459d8];return _0x260149;};'use strict';var multer=require(_0x9342('0x0'));var util=require(_0x9342('0x1'));var path=require(_0x9342('0x2'));var timeout=require(_0x9342('0x3'));var express=require(_0x9342('0x4'));var router=express[_0x9342('0x5')]();var fs_extra=require(_0x9342('0x6'));var auth=require(_0x9342('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9342('0x8'));router[_0x9342('0x9')]('/',auth[_0x9342('0xa')](),controller['index']);router['get'](_0x9342('0xb'),auth[_0x9342('0xa')](),controller[_0x9342('0xc')]);router[_0x9342('0x9')](_0x9342('0xd'),auth[_0x9342('0xa')](),timeout(_0x9342('0xe')),controller[_0x9342('0xf')]);router[_0x9342('0x10')]('/',auth['isAuthenticated'](),controller[_0x9342('0x11')]);router['put'](_0x9342('0xb'),auth[_0x9342('0xa')](),controller['update']);router[_0x9342('0x12')]('/:id',auth[_0x9342('0xa')](),controller[_0x9342('0x13')]);module[_0x9342('0x14')]=router; \ No newline at end of file +var _0x1eb3=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/test','15s','post','create','put','update','destroy','util','express','fs-extra'];(function(_0x34eb31,_0x8f0f70){var _0x254994=function(_0xbec9a3){while(--_0xbec9a3){_0x34eb31['push'](_0x34eb31['shift']());}};_0x254994(++_0x8f0f70);}(_0x1eb3,0x153));var _0x31eb=function(_0x1d920e,_0x260f2b){_0x1d920e=_0x1d920e-0x0;var _0x49ac61=_0x1eb3[_0x1d920e];return _0x49ac61;};'use strict';var multer=require('multer');var util=require(_0x31eb('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x31eb('0x1'));var router=express['Router']();var fs_extra=require(_0x31eb('0x2'));var auth=require(_0x31eb('0x3'));var interaction=require(_0x31eb('0x4'));var config=require(_0x31eb('0x5'));var controller=require('./squareOdbc.controller');router[_0x31eb('0x6')]('/',auth[_0x31eb('0x7')](),controller[_0x31eb('0x8')]);router[_0x31eb('0x6')](_0x31eb('0x9'),auth[_0x31eb('0x7')](),controller[_0x31eb('0xa')]);router[_0x31eb('0x6')](_0x31eb('0xb'),auth[_0x31eb('0x7')](),timeout(_0x31eb('0xc')),controller['test']);router[_0x31eb('0xd')]('/',auth[_0x31eb('0x7')](),controller[_0x31eb('0xe')]);router[_0x31eb('0xf')](_0x31eb('0x9'),auth[_0x31eb('0x7')](),controller[_0x31eb('0x10')]);router['delete'](_0x31eb('0x9'),auth[_0x31eb('0x7')](),controller[_0x31eb('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 238a6eb..c580f96 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 _0x46b5=['STRING','exports'];(function(_0x34aad1,_0x39d14b){var _0x29b3f6=function(_0x1a1d6e){while(--_0x1a1d6e){_0x34aad1['push'](_0x34aad1['shift']());}};_0x29b3f6(++_0x39d14b);}(_0x46b5,0x185));var _0x546b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x46b5[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x546b('0x0')]={'name':{'type':Sequelize[_0x546b('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x546b('0x1')]},'description':{'type':Sequelize[_0x546b('0x1')]}}; \ No newline at end of file +var _0xd06e=['exports','STRING','name','sequelize'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xd06e,0x1af));var _0xed06=function(_0xfcb44,_0x5bc67d){_0xfcb44=_0xfcb44-0x0;var _0x3c9910=_0xd06e[_0xfcb44];return _0x3c9910;};'use strict';var Sequelize=require(_0xed06('0x0'));module[_0xed06('0x1')]={'name':{'type':Sequelize[_0xed06('0x2')],'unique':_0xed06('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xed06('0x2')]},'description':{'type':Sequelize[_0xed06('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 0fef91d..80edcf7 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 _0xf124=['undefined','limit','count','apply','reject','save','then','destroy','ODBC','UserProfileResource','stack','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','keys','filters','length','includeAll','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0xf124,0x92));var _0x4f12=function(_0x57f345,_0x316929){_0x57f345=_0x57f345-0x0;var _0x255e43=_0xf124[_0x57f345];return _0x255e43;};'use strict';var emlformat=require(_0x4f12('0x0'));var rimraf=require(_0x4f12('0x1'));var zipdir=require(_0x4f12('0x2'));var jsonpatch=require(_0x4f12('0x3'));var rp=require(_0x4f12('0x4'));var moment=require(_0x4f12('0x5'));var BPromise=require(_0x4f12('0x6'));var Mustache=require(_0x4f12('0x7'));var util=require(_0x4f12('0x8'));var path=require(_0x4f12('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4f12('0xa'));var fs=require('fs');var fs_extra=require(_0x4f12('0xb'));var _=require(_0x4f12('0xc'));var squel=require(_0x4f12('0xd'));var crypto=require(_0x4f12('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4f12('0xf'));var toCsv=require(_0x4f12('0x10'));var querystring=require(_0x4f12('0x11'));var Papa=require(_0x4f12('0x12'));var Redis=require(_0x4f12('0x13'));var authService=require(_0x4f12('0x14'));var qs=require(_0x4f12('0x15'));var as=require(_0x4f12('0x16'));var hardwareService=require(_0x4f12('0x17'));var logger=require(_0x4f12('0x18'))(_0x4f12('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4f12('0x1a'));var db=require(_0x4f12('0x1b'))['db'];function respondWithStatusCode(_0x2e6d31,_0x13ec8e){_0x13ec8e=_0x13ec8e||0xcc;return function(_0x20f9fe){if(_0x20f9fe){return _0x2e6d31[_0x4f12('0x1c')](_0x13ec8e);}return _0x2e6d31[_0x4f12('0x1d')](_0x13ec8e)[_0x4f12('0x1e')]();};}function respondWithResult(_0x397dd4,_0x1d6bf3){_0x1d6bf3=_0x1d6bf3||0xc8;return function(_0xe5ac46){if(_0xe5ac46){return _0x397dd4['status'](_0x1d6bf3)['json'](_0xe5ac46);}};}function respondWithFilteredResult(_0x5d318b,_0x1eeaa4){return function(_0x2c3a1e){if(_0x2c3a1e){var _0xfdea2=typeof _0x1eeaa4[_0x4f12('0x1f')]===_0x4f12('0x20')&&typeof _0x1eeaa4[_0x4f12('0x21')]===_0x4f12('0x20');var _0x471c3f=_0x2c3a1e[_0x4f12('0x22')];var _0x136272=_0xfdea2?0x0:_0x1eeaa4[_0x4f12('0x1f')];var _0x4adeeb=_0xfdea2?_0x2c3a1e[_0x4f12('0x22')]:_0x1eeaa4[_0x4f12('0x1f')]+_0x1eeaa4['limit'];var _0x199067;if(_0x4adeeb>=_0x471c3f){_0x4adeeb=_0x471c3f;_0x199067=0xc8;}else{_0x199067=0xce;}_0x5d318b[_0x4f12('0x1d')](_0x199067);return _0x5d318b['set']('Content-Range',_0x136272+'-'+_0x4adeeb+'/'+_0x471c3f)['json'](_0x2c3a1e);}return null;};}function patchUpdates(_0x34c492){return function(_0x71121e){try{jsonpatch[_0x4f12('0x23')](_0x71121e,_0x34c492,!![]);}catch(_0x3bf46c){return BPromise[_0x4f12('0x24')](_0x3bf46c);}return _0x71121e[_0x4f12('0x25')]();};}function saveUpdates(_0x5f2d69,_0x3c9c46){return function(_0x541deb){if(_0x541deb){return _0x541deb['update'](_0x5f2d69)[_0x4f12('0x26')](function(_0x435043){return _0x435043;});}return null;};}function removeEntity(_0x398475,_0x3a1cc0){return function(_0x1d3367){if(_0x1d3367){return _0x1d3367[_0x4f12('0x27')]()[_0x4f12('0x26')](function(){var _0x8334aa=_0x1d3367['get']({'plain':!![]});var _0x263dce=_0x4f12('0x28');return db[_0x4f12('0x29')][_0x4f12('0x27')]({'where':{'type':_0x263dce,'resourceId':_0x8334aa['id']}})['then'](function(){return _0x1d3367;});})[_0x4f12('0x26')](function(){_0x398475[_0x4f12('0x1d')](0xcc)[_0x4f12('0x1e')]();});}};}function handleEntityNotFound(_0x22ac10,_0x6d26b5){return function(_0x271374){if(!_0x271374){_0x22ac10[_0x4f12('0x1c')](0x194);}return _0x271374;};}function handleError(_0x177b0a,_0x16fa0a){_0x16fa0a=_0x16fa0a||0x1f4;return function(_0xb46974){logger['error'](_0xb46974[_0x4f12('0x2a')]);if(_0xb46974[_0x4f12('0x2b')]){delete _0xb46974['name'];}_0x177b0a[_0x4f12('0x1d')](_0x16fa0a)[_0x4f12('0x2c')](_0xb46974);};}exports[_0x4f12('0x2d')]=function(_0x4bf001,_0x55c23e){var _0x4c80a3={},_0x1139c8={},_0x2a26c7={'count':0x0,'rows':[]};var _0x21a148=_[_0x4f12('0x2e')](db[_0x4f12('0x2f')]['rawAttributes'],function(_0x97da8a){return{'name':_0x97da8a[_0x4f12('0x30')],'type':_0x97da8a[_0x4f12('0x31')][_0x4f12('0x32')]};});_0x1139c8[_0x4f12('0x33')]=_[_0x4f12('0x2e')](_0x21a148,_0x4f12('0x2b'));_0x1139c8[_0x4f12('0x34')]=_['keys'](_0x4bf001['query']);_0x1139c8['filters']=_[_0x4f12('0x35')](_0x1139c8['model'],_0x1139c8[_0x4f12('0x34')]);_0x4c80a3[_0x4f12('0x36')]=_[_0x4f12('0x35')](_0x1139c8[_0x4f12('0x33')],qs[_0x4f12('0x37')](_0x4bf001[_0x4f12('0x34')][_0x4f12('0x37')]));_0x4c80a3['attributes']=_0x4c80a3['attributes']['length']?_0x4c80a3[_0x4f12('0x36')]:_0x1139c8[_0x4f12('0x33')];if(!_0x4bf001[_0x4f12('0x34')][_0x4f12('0x38')](_0x4f12('0x39'))){_0x4c80a3[_0x4f12('0x21')]=qs[_0x4f12('0x21')](_0x4bf001[_0x4f12('0x34')][_0x4f12('0x21')]);_0x4c80a3[_0x4f12('0x1f')]=qs['offset'](_0x4bf001[_0x4f12('0x34')][_0x4f12('0x1f')]);}_0x4c80a3['order']=qs[_0x4f12('0x3a')](_0x4bf001['query'][_0x4f12('0x3a')]);_0x4c80a3[_0x4f12('0x3b')]=qs['filters'](_[_0x4f12('0x3c')](_0x4bf001[_0x4f12('0x34')],_0x1139c8['filters']),_0x21a148);if(_0x4bf001[_0x4f12('0x34')][_0x4f12('0x3d')]){_0x4c80a3[_0x4f12('0x3b')]=_[_0x4f12('0x3e')](_0x4c80a3[_0x4f12('0x3b')],{'$or':_['map'](_0x21a148,function(_0x9b1902){if(_0x9b1902[_0x4f12('0x31')]!==_0x4f12('0x3f')){var _0x52caed={};_0x52caed[_0x9b1902[_0x4f12('0x2b')]]={'$like':'%'+_0x4bf001[_0x4f12('0x34')][_0x4f12('0x3d')]+'%'};return _0x52caed;}})});}_0x4c80a3=_[_0x4f12('0x3e')]({},_0x4c80a3,_0x4bf001[_0x4f12('0x40')]);var _0x36c857={'where':_0x4c80a3[_0x4f12('0x3b')]};return db['SquareOdbc']['count'](_0x36c857)['then'](function(_0x2dfc9e){_0x2a26c7[_0x4f12('0x22')]=_0x2dfc9e;if(_0x4bf001['query']['includeAll']){_0x4c80a3[_0x4f12('0x41')]=[{'all':!![]}];}return db[_0x4f12('0x2f')][_0x4f12('0x42')](_0x4c80a3);})[_0x4f12('0x26')](function(_0x41efe6){_0x2a26c7[_0x4f12('0x43')]=_0x41efe6;return _0x2a26c7;})[_0x4f12('0x26')](respondWithFilteredResult(_0x55c23e,_0x4c80a3))[_0x4f12('0x44')](handleError(_0x55c23e,null));};exports[_0x4f12('0x45')]=function(_0xb59c90,_0x19262d){var _0x34abb5={'raw':!![],'where':{'id':_0xb59c90[_0x4f12('0x46')]['id']}},_0x5a5a60={};_0x5a5a60[_0x4f12('0x33')]=_['keys'](db['SquareOdbc'][_0x4f12('0x47')]);_0x5a5a60[_0x4f12('0x34')]=_[_0x4f12('0x48')](_0xb59c90['query']);_0x5a5a60[_0x4f12('0x49')]=_[_0x4f12('0x35')](_0x5a5a60[_0x4f12('0x33')],_0x5a5a60[_0x4f12('0x34')]);_0x34abb5[_0x4f12('0x36')]=_[_0x4f12('0x35')](_0x5a5a60[_0x4f12('0x33')],qs['fields'](_0xb59c90[_0x4f12('0x34')][_0x4f12('0x37')]));_0x34abb5['attributes']=_0x34abb5['attributes'][_0x4f12('0x4a')]?_0x34abb5['attributes']:_0x5a5a60['model'];if(_0xb59c90[_0x4f12('0x34')][_0x4f12('0x4b')]){_0x34abb5[_0x4f12('0x41')]=[{'all':!![]}];}_0x34abb5=_[_0x4f12('0x3e')]({},_0x34abb5,_0xb59c90[_0x4f12('0x40')]);return db[_0x4f12('0x2f')][_0x4f12('0x4c')](_0x34abb5)['then'](handleEntityNotFound(_0x19262d,null))['then'](respondWithResult(_0x19262d,null))['catch'](handleError(_0x19262d,null));};exports[_0x4f12('0x4d')]=function(_0x305410,_0x376823){return db[_0x4f12('0x2f')][_0x4f12('0x4d')](_0x305410[_0x4f12('0x4e')],{})[_0x4f12('0x26')](function(_0x476c45){var _0x322885=_0x305410['user']['get']({'plain':!![]});if(!_0x322885)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x322885['role']===_0x4f12('0x4f')){var _0x241475=_0x476c45[_0x4f12('0x50')]({'plain':!![]});var _0x1b3952=_0x4f12('0x28');return db[_0x4f12('0x51')]['find']({'where':{'name':_0x1b3952,'userProfileId':_0x322885[_0x4f12('0x52')]},'raw':!![]})['then'](function(_0x447860){if(_0x447860&&_0x447860[_0x4f12('0x53')]===0x0){return db[_0x4f12('0x29')][_0x4f12('0x4d')]({'name':_0x241475['name'],'resourceId':_0x241475['id'],'type':_0x447860[_0x4f12('0x2b')],'sectionId':_0x447860['id']},{})[_0x4f12('0x26')](function(){return _0x476c45;});}else{return _0x476c45;}})[_0x4f12('0x44')](function(_0x1c1d3d){logger[_0x4f12('0x54')](_0x4f12('0x55'),_0x1c1d3d);throw _0x1c1d3d;});}return _0x476c45;})[_0x4f12('0x26')](respondWithResult(_0x376823,0xc9))[_0x4f12('0x44')](handleError(_0x376823,null));};exports['update']=function(_0x425062,_0x45b5b3){if(_0x425062['body']['id']){delete _0x425062['body']['id'];}return db['SquareOdbc'][_0x4f12('0x4c')]({'where':{'id':_0x425062[_0x4f12('0x46')]['id']}})[_0x4f12('0x26')](handleEntityNotFound(_0x45b5b3,null))[_0x4f12('0x26')](saveUpdates(_0x425062[_0x4f12('0x4e')],null))[_0x4f12('0x26')](respondWithResult(_0x45b5b3,null))[_0x4f12('0x44')](handleError(_0x45b5b3,null));};exports[_0x4f12('0x27')]=function(_0x380a8b,_0x1ad1df){return db[_0x4f12('0x2f')][_0x4f12('0x4c')]({'where':{'id':_0x380a8b[_0x4f12('0x46')]['id']}})[_0x4f12('0x26')](handleEntityNotFound(_0x1ad1df,null))[_0x4f12('0x26')](removeEntity(_0x1ad1df,null))[_0x4f12('0x44')](handleError(_0x1ad1df,null));};exports['test']=function(_0x4c6df6,_0x53cd56,_0x595399){var _0x346f22;return db[_0x4f12('0x2f')]['find']({'where':{'id':_0x4c6df6['params']['id']},'attributes':['id',_0x4f12('0x56')]})['then'](handleEntityNotFound(_0x53cd56,null))[_0x4f12('0x26')](function(_0x18ce84){if(_0x18ce84){var _0x544ef6=require('odbc')();_0x544ef6[_0x4f12('0x57')](_0x18ce84[_0x4f12('0x56')]);_0x544ef6[_0x4f12('0x58')]();return _0x18ce84;}})['then'](respondWithResult(_0x53cd56,null))[_0x4f12('0x44')](handleError(_0x53cd56,null));}; \ No newline at end of file +var _0x7d01=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/license/util','end','status','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','ODBC','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','SquareOdbc','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','closeSync'];(function(_0x23ac30,_0x2a1d00){var _0x208fec=function(_0x23213a){while(--_0x23213a){_0x23ac30['push'](_0x23ac30['shift']());}};_0x208fec(++_0x2a1d00);}(_0x7d01,0x154));var _0x17d0=function(_0x1da94a,_0x23dd40){_0x1da94a=_0x1da94a-0x0;var _0x38e2e9=_0x7d01[_0x1da94a];return _0x38e2e9;};'use strict';var emlformat=require(_0x17d0('0x0'));var rimraf=require(_0x17d0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x17d0('0x2'));var rp=require(_0x17d0('0x3'));var moment=require(_0x17d0('0x4'));var BPromise=require(_0x17d0('0x5'));var Mustache=require('mustache');var util=require(_0x17d0('0x6'));var path=require(_0x17d0('0x7'));var sox=require('sox');var csv=require(_0x17d0('0x8'));var ejs=require(_0x17d0('0x9'));var fs=require('fs');var fs_extra=require(_0x17d0('0xa'));var _=require(_0x17d0('0xb'));var squel=require(_0x17d0('0xc'));var crypto=require(_0x17d0('0xd'));var jsforce=require(_0x17d0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x17d0('0x8'));var querystring=require(_0x17d0('0xf'));var Papa=require('papaparse');var Redis=require(_0x17d0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x17d0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x17d0('0x12'));var utils=require(_0x17d0('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x17d0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3027f9,_0x5eae86){_0x5eae86=_0x5eae86||0xcc;return function(_0x310262){if(_0x310262){return _0x3027f9['sendStatus'](_0x5eae86);}return _0x3027f9['status'](_0x5eae86)[_0x17d0('0x15')]();};}function respondWithResult(_0x1dc6d3,_0xd87588){_0xd87588=_0xd87588||0xc8;return function(_0x5cee1c){if(_0x5cee1c){return _0x1dc6d3[_0x17d0('0x16')](_0xd87588)[_0x17d0('0x17')](_0x5cee1c);}};}function respondWithFilteredResult(_0x13a772,_0x5d78c2){return function(_0x4571cc){if(_0x4571cc){var _0x257b22=typeof _0x5d78c2[_0x17d0('0x18')]===_0x17d0('0x19')&&typeof _0x5d78c2['limit']===_0x17d0('0x19');var _0x3f229a=_0x4571cc[_0x17d0('0x1a')];var _0x2ec1b8=_0x257b22?0x0:_0x5d78c2[_0x17d0('0x18')];var _0x17f247=_0x257b22?_0x4571cc[_0x17d0('0x1a')]:_0x5d78c2[_0x17d0('0x18')]+_0x5d78c2[_0x17d0('0x1b')];var _0x36222d;if(_0x17f247>=_0x3f229a){_0x17f247=_0x3f229a;_0x36222d=0xc8;}else{_0x36222d=0xce;}_0x13a772[_0x17d0('0x16')](_0x36222d);return _0x13a772['set']('Content-Range',_0x2ec1b8+'-'+_0x17f247+'/'+_0x3f229a)[_0x17d0('0x17')](_0x4571cc);}return null;};}function patchUpdates(_0x342d2a){return function(_0x4bdb90){try{jsonpatch[_0x17d0('0x1c')](_0x4bdb90,_0x342d2a,!![]);}catch(_0x2c081e){return BPromise[_0x17d0('0x1d')](_0x2c081e);}return _0x4bdb90[_0x17d0('0x1e')]();};}function saveUpdates(_0x5b6636,_0x5c9986){return function(_0x4361cc){if(_0x4361cc){return _0x4361cc[_0x17d0('0x1f')](_0x5b6636)[_0x17d0('0x20')](function(_0x414066){return _0x414066;});}return null;};}function removeEntity(_0x32b2f3,_0x3abe95){return function(_0x5d1c95){if(_0x5d1c95){return _0x5d1c95[_0x17d0('0x21')]()['then'](function(){var _0x43a7d4=_0x5d1c95['get']({'plain':!![]});var _0x1ed9e9=_0x17d0('0x22');return db[_0x17d0('0x23')][_0x17d0('0x21')]({'where':{'type':_0x1ed9e9,'resourceId':_0x43a7d4['id']}})['then'](function(){return _0x5d1c95;});})[_0x17d0('0x20')](function(){_0x32b2f3[_0x17d0('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x576c70,_0x3b37f4){return function(_0x5a34f3){if(!_0x5a34f3){_0x576c70[_0x17d0('0x24')](0x194);}return _0x5a34f3;};}function handleError(_0xa3e58b,_0x53cb9b){_0x53cb9b=_0x53cb9b||0x1f4;return function(_0x161491){logger[_0x17d0('0x25')](_0x161491[_0x17d0('0x26')]);if(_0x161491[_0x17d0('0x27')]){delete _0x161491[_0x17d0('0x27')];}_0xa3e58b['status'](_0x53cb9b)[_0x17d0('0x28')](_0x161491);};}exports[_0x17d0('0x29')]=function(_0x3cf6a6,_0x2ce5ef){var _0x3bf60e={},_0x175302={},_0x452a6f={'count':0x0,'rows':[]};var _0x1d91dc=_[_0x17d0('0x2a')](db['SquareOdbc']['rawAttributes'],function(_0x2ace49){return{'name':_0x2ace49[_0x17d0('0x2b')],'type':_0x2ace49[_0x17d0('0x2c')]['key']};});_0x175302['model']=_[_0x17d0('0x2a')](_0x1d91dc,_0x17d0('0x27'));_0x175302[_0x17d0('0x2d')]=_[_0x17d0('0x2e')](_0x3cf6a6[_0x17d0('0x2d')]);_0x175302['filters']=_[_0x17d0('0x2f')](_0x175302['model'],_0x175302[_0x17d0('0x2d')]);_0x3bf60e[_0x17d0('0x30')]=_[_0x17d0('0x2f')](_0x175302[_0x17d0('0x31')],qs['fields'](_0x3cf6a6[_0x17d0('0x2d')][_0x17d0('0x32')]));_0x3bf60e[_0x17d0('0x30')]=_0x3bf60e[_0x17d0('0x30')][_0x17d0('0x33')]?_0x3bf60e[_0x17d0('0x30')]:_0x175302['model'];if(!_0x3cf6a6['query'][_0x17d0('0x34')](_0x17d0('0x35'))){_0x3bf60e[_0x17d0('0x1b')]=qs['limit'](_0x3cf6a6[_0x17d0('0x2d')][_0x17d0('0x1b')]);_0x3bf60e[_0x17d0('0x18')]=qs[_0x17d0('0x18')](_0x3cf6a6['query'][_0x17d0('0x18')]);}_0x3bf60e[_0x17d0('0x36')]=qs[_0x17d0('0x37')](_0x3cf6a6[_0x17d0('0x2d')]['sort']);_0x3bf60e[_0x17d0('0x38')]=qs[_0x17d0('0x39')](_[_0x17d0('0x3a')](_0x3cf6a6[_0x17d0('0x2d')],_0x175302[_0x17d0('0x39')]),_0x1d91dc);if(_0x3cf6a6[_0x17d0('0x2d')][_0x17d0('0x3b')]){_0x3bf60e['where']=_['merge'](_0x3bf60e['where'],{'$or':_['map'](_0x1d91dc,function(_0x1ee445){if(_0x1ee445['type']!=='VIRTUAL'){var _0x35753c={};_0x35753c[_0x1ee445[_0x17d0('0x27')]]={'$like':'%'+_0x3cf6a6[_0x17d0('0x2d')][_0x17d0('0x3b')]+'%'};return _0x35753c;}})});}_0x3bf60e=_['merge']({},_0x3bf60e,_0x3cf6a6['options']);var _0x26250e={'where':_0x3bf60e['where']};return db[_0x17d0('0x3c')]['count'](_0x26250e)[_0x17d0('0x20')](function(_0x409da1){_0x452a6f['count']=_0x409da1;if(_0x3cf6a6[_0x17d0('0x2d')][_0x17d0('0x3d')]){_0x3bf60e[_0x17d0('0x3e')]=[{'all':!![]}];}return db[_0x17d0('0x3c')][_0x17d0('0x3f')](_0x3bf60e);})[_0x17d0('0x20')](function(_0xfe4fba){_0x452a6f[_0x17d0('0x40')]=_0xfe4fba;return _0x452a6f;})['then'](respondWithFilteredResult(_0x2ce5ef,_0x3bf60e))[_0x17d0('0x41')](handleError(_0x2ce5ef,null));};exports[_0x17d0('0x42')]=function(_0x36ed3d,_0x2c5265){var _0x220f70={'raw':!![],'where':{'id':_0x36ed3d[_0x17d0('0x43')]['id']}},_0x43409e={};_0x43409e['model']=_[_0x17d0('0x2e')](db[_0x17d0('0x3c')][_0x17d0('0x44')]);_0x43409e[_0x17d0('0x2d')]=_[_0x17d0('0x2e')](_0x36ed3d[_0x17d0('0x2d')]);_0x43409e['filters']=_[_0x17d0('0x2f')](_0x43409e['model'],_0x43409e[_0x17d0('0x2d')]);_0x220f70[_0x17d0('0x30')]=_[_0x17d0('0x2f')](_0x43409e[_0x17d0('0x31')],qs[_0x17d0('0x32')](_0x36ed3d[_0x17d0('0x2d')]['fields']));_0x220f70[_0x17d0('0x30')]=_0x220f70[_0x17d0('0x30')][_0x17d0('0x33')]?_0x220f70['attributes']:_0x43409e['model'];if(_0x36ed3d['query'][_0x17d0('0x3d')]){_0x220f70[_0x17d0('0x3e')]=[{'all':!![]}];}_0x220f70=_[_0x17d0('0x45')]({},_0x220f70,_0x36ed3d[_0x17d0('0x46')]);return db['SquareOdbc']['find'](_0x220f70)[_0x17d0('0x20')](handleEntityNotFound(_0x2c5265,null))[_0x17d0('0x20')](respondWithResult(_0x2c5265,null))['catch'](handleError(_0x2c5265,null));};exports[_0x17d0('0x47')]=function(_0x16d9be,_0x44d645){return db[_0x17d0('0x3c')][_0x17d0('0x47')](_0x16d9be[_0x17d0('0x48')],{})[_0x17d0('0x20')](function(_0x4f5e6a){var _0x547afc=_0x16d9be['user'][_0x17d0('0x49')]({'plain':!![]});if(!_0x547afc)throw new Error(_0x17d0('0x4a'));if(_0x547afc[_0x17d0('0x4b')]===_0x17d0('0x4c')){var _0x449b46=_0x4f5e6a[_0x17d0('0x49')]({'plain':!![]});var _0x4e8ca8=_0x17d0('0x22');return db['UserProfileSection'][_0x17d0('0x4d')]({'where':{'name':_0x4e8ca8,'userProfileId':_0x547afc[_0x17d0('0x4e')]},'raw':!![]})[_0x17d0('0x20')](function(_0x52653e){if(_0x52653e&&_0x52653e[_0x17d0('0x4f')]===0x0){return db[_0x17d0('0x23')]['create']({'name':_0x449b46[_0x17d0('0x27')],'resourceId':_0x449b46['id'],'type':_0x52653e[_0x17d0('0x27')],'sectionId':_0x52653e['id']},{})['then'](function(){return _0x4f5e6a;});}else{return _0x4f5e6a;}})[_0x17d0('0x41')](function(_0x2bc2fa){logger[_0x17d0('0x25')](_0x17d0('0x50'),_0x2bc2fa);throw _0x2bc2fa;});}return _0x4f5e6a;})[_0x17d0('0x20')](respondWithResult(_0x44d645,0xc9))[_0x17d0('0x41')](handleError(_0x44d645,null));};exports[_0x17d0('0x1f')]=function(_0x59e3d8,_0x2e5fbe){if(_0x59e3d8[_0x17d0('0x48')]['id']){delete _0x59e3d8[_0x17d0('0x48')]['id'];}return db[_0x17d0('0x3c')]['find']({'where':{'id':_0x59e3d8['params']['id']}})['then'](handleEntityNotFound(_0x2e5fbe,null))['then'](saveUpdates(_0x59e3d8[_0x17d0('0x48')],null))['then'](respondWithResult(_0x2e5fbe,null))[_0x17d0('0x41')](handleError(_0x2e5fbe,null));};exports[_0x17d0('0x21')]=function(_0x452ece,_0x46ba26){return db['SquareOdbc'][_0x17d0('0x4d')]({'where':{'id':_0x452ece[_0x17d0('0x43')]['id']}})[_0x17d0('0x20')](handleEntityNotFound(_0x46ba26,null))[_0x17d0('0x20')](removeEntity(_0x46ba26,null))[_0x17d0('0x41')](handleError(_0x46ba26,null));};exports[_0x17d0('0x51')]=function(_0x169667,_0x541e1c,_0x923f87){var _0x8973f7;return db[_0x17d0('0x3c')][_0x17d0('0x4d')]({'where':{'id':_0x169667[_0x17d0('0x43')]['id']},'attributes':['id',_0x17d0('0x52')]})[_0x17d0('0x20')](handleEntityNotFound(_0x541e1c,null))[_0x17d0('0x20')](function(_0x12227e){if(_0x12227e){var _0x3edc1c=require(_0x17d0('0x53'))();_0x3edc1c['openSync'](_0x12227e[_0x17d0('0x52')]);_0x3edc1c[_0x17d0('0x54')]();return _0x12227e;}})['then'](respondWithResult(_0x541e1c,null))[_0x17d0('0x41')](handleError(_0x541e1c,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index c630ff7..01fb8e9 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 _0x8b92=['moment','bluebird','path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger'];(function(_0x2d994d,_0x168a27){var _0xd54be4=function(_0x1db925){while(--_0x1db925){_0x2d994d['push'](_0x2d994d['shift']());}};_0xd54be4(++_0x168a27);}(_0x8b92,0x1a1));var _0x28b9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8b92[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x28b9('0x0'));var util=require(_0x28b9('0x1'));var logger=require(_0x28b9('0x2'))('api');var moment=require(_0x28b9('0x3'));var BPromise=require(_0x28b9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x28b9('0x5'));var rimraf=require('rimraf');var config=require(_0x28b9('0x6'));var attributes=require(_0x28b9('0x7'));module[_0x28b9('0x8')]=function(_0x36b63d,_0x5ee30a){return _0x36b63d[_0x28b9('0x9')](_0x28b9('0xa'),attributes,{'tableName':_0x28b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b83=['SquareOdbc','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x4749e2,_0x55e06f){var _0x1466f9=function(_0x40dec6){while(--_0x40dec6){_0x4749e2['push'](_0x4749e2['shift']());}};_0x1466f9(++_0x55e06f);}(_0x4b83,0xde));var _0x34b8=function(_0x28534b,_0x5c38bc){_0x28534b=_0x28534b-0x0;var _0x4f55ef=_0x4b83[_0x28534b];return _0x4f55ef;};'use strict';var _=require(_0x34b8('0x0'));var util=require(_0x34b8('0x1'));var logger=require(_0x34b8('0x2'))(_0x34b8('0x3'));var moment=require(_0x34b8('0x4'));var BPromise=require(_0x34b8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34b8('0x6'));var rimraf=require(_0x34b8('0x7'));var config=require(_0x34b8('0x8'));var attributes=require(_0x34b8('0x9'));module[_0x34b8('0xa')]=function(_0x2b9616,_0x538450){return _0x2b9616[_0x34b8('0xb')](_0x34b8('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 4a59ec3..4b532eb 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 _0xde14=['code','message','info','result','catch','SquareOdbc','find','options','raw','where','attributes','map','model','include','ShowSquareOdbc','lodash','util','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4c34f2,_0x1a37c2){var _0xf12d11=function(_0x9e8344){while(--_0x9e8344){_0x4c34f2['push'](_0x4c34f2['shift']());}};_0xf12d11(++_0x1a37c2);}(_0xde14,0x126));var _0x4de1=function(_0x270396,_0x174209){_0x270396=_0x270396-0x0;var _0x177bd3=_0xde14[_0x270396];return _0x177bd3;};'use strict';var _=require(_0x4de1('0x0'));var util=require(_0x4de1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4de1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4de1('0x3'))(_0x4de1('0x4'));var config=require(_0x4de1('0x5'));var jayson=require(_0x4de1('0x6'));var client=jayson[_0x4de1('0x7')][_0x4de1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36dbc0,_0x24fe34,_0x46f9f5){return new BPromise(function(_0x346290,_0x259758){return client[_0x4de1('0x9')](_0x36dbc0,_0x46f9f5)[_0x4de1('0xa')](function(_0x2b089b){logger['info'](_0x4de1('0xb'),_0x24fe34,_0x4de1('0xc'));logger['debug'](_0x4de1('0xd'),_0x24fe34,_0x4de1('0xc'),JSON[_0x4de1('0xe')](_0x2b089b));if(_0x2b089b['error']){if(_0x2b089b[_0x4de1('0xf')][_0x4de1('0x10')]===0x1f4){logger[_0x4de1('0xf')](_0x4de1('0xb'),_0x24fe34,_0x2b089b[_0x4de1('0xf')]['message']);return _0x259758(_0x2b089b[_0x4de1('0xf')][_0x4de1('0x11')]);}logger[_0x4de1('0xf')](_0x4de1('0xb'),_0x24fe34,_0x2b089b['error']['message']);return _0x346290(_0x2b089b[_0x4de1('0xf')][_0x4de1('0x11')]);}else{logger[_0x4de1('0x12')](_0x4de1('0xb'),_0x24fe34,'request\x20sent');_0x346290(_0x2b089b[_0x4de1('0x13')][_0x4de1('0x11')]);}})[_0x4de1('0x14')](function(_0x4504b6){logger[_0x4de1('0xf')](_0x4de1('0xb'),_0x24fe34,_0x4504b6);_0x259758(_0x4504b6);});});}exports['ShowSquareOdbc']=function(_0x208a94){var _0x40e25f=this;return new Promise(function(_0x262579,_0x1c7817){return db[_0x4de1('0x15')][_0x4de1('0x16')]({'raw':_0x208a94[_0x4de1('0x17')]?_0x208a94[_0x4de1('0x17')][_0x4de1('0x18')]===undefined?!![]:![]:!![],'where':_0x208a94[_0x4de1('0x17')]?_0x208a94['options'][_0x4de1('0x19')]||null:null,'attributes':_0x208a94[_0x4de1('0x17')]?_0x208a94[_0x4de1('0x17')][_0x4de1('0x1a')]||null:null,'include':_0x208a94['options']?_0x208a94['options']['include']?_[_0x4de1('0x1b')](_0x208a94[_0x4de1('0x17')]['include'],function(_0x4edf2b){return{'model':db[_0x4edf2b[_0x4de1('0x1c')]],'as':_0x4edf2b['as'],'attributes':_0x4edf2b[_0x4de1('0x1a')],'include':_0x4edf2b[_0x4de1('0x1d')]?_[_0x4de1('0x1b')](_0x4edf2b[_0x4de1('0x1d')],function(_0x19befc){return{'model':db[_0x19befc[_0x4de1('0x1c')]],'as':_0x19befc['as'],'attributes':_0x19befc[_0x4de1('0x1a')],'include':_0x19befc[_0x4de1('0x1d')]?_[_0x4de1('0x1b')](_0x19befc[_0x4de1('0x1d')],function(_0x4baa55){return{'model':db[_0x4baa55[_0x4de1('0x1c')]],'as':_0x4baa55['as'],'attributes':_0x4baa55[_0x4de1('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x210336){logger[_0x4de1('0x12')](_0x4de1('0x1e'),_0x208a94);logger['debug']('ShowSquareOdbc',_0x208a94,JSON['stringify'](_0x210336));_0x262579(_0x210336);})[_0x4de1('0x14')](function(_0x192f03){logger[_0x4de1('0xf')](_0x4de1('0x1e'),_0x192f03[_0x4de1('0x11')],_0x208a94);_0x1c7817(_0x40e25f[_0x4de1('0xf')](0x1f4,_0x192f03['message']));});});}; \ No newline at end of file +var _0x5619=['stringify','error','code','message','info','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','map','include','model','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x9612b6,_0x57cda4){var _0x5b3919=function(_0x7b0f5a){while(--_0x7b0f5a){_0x9612b6['push'](_0x9612b6['shift']());}};_0x5b3919(++_0x57cda4);}(_0x5619,0x69));var _0x9561=function(_0xd4d2c1,_0x4e0b73){_0xd4d2c1=_0xd4d2c1-0x0;var _0x371e96=_0x5619[_0xd4d2c1];return _0x371e96;};'use strict';var _=require(_0x9561('0x0'));var util=require('util');var moment=require(_0x9561('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9561('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9561('0x3'));var logger=require(_0x9561('0x4'))(_0x9561('0x5'));var config=require(_0x9561('0x6'));var jayson=require(_0x9561('0x7'));var client=jayson[_0x9561('0x8')][_0x9561('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f1c38,_0x1756ca,_0x1067fe){return new BPromise(function(_0x281396,_0x37dd16){return client[_0x9561('0xa')](_0x4f1c38,_0x1067fe)[_0x9561('0xb')](function(_0x43fe92){logger['info'](_0x9561('0xc'),_0x1756ca,'request\x20sent');logger[_0x9561('0xd')](_0x9561('0xe'),_0x1756ca,'request\x20sent',JSON[_0x9561('0xf')](_0x43fe92));if(_0x43fe92['error']){if(_0x43fe92[_0x9561('0x10')][_0x9561('0x11')]===0x1f4){logger[_0x9561('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x1756ca,_0x43fe92[_0x9561('0x10')][_0x9561('0x12')]);return _0x37dd16(_0x43fe92['error'][_0x9561('0x12')]);}logger[_0x9561('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x1756ca,_0x43fe92[_0x9561('0x10')][_0x9561('0x12')]);return _0x281396(_0x43fe92['error'][_0x9561('0x12')]);}else{logger[_0x9561('0x13')](_0x9561('0xc'),_0x1756ca,'request\x20sent');_0x281396(_0x43fe92['result'][_0x9561('0x12')]);}})[_0x9561('0x14')](function(_0x28d7dc){logger[_0x9561('0x10')](_0x9561('0xc'),_0x1756ca,_0x28d7dc);_0x37dd16(_0x28d7dc);});});}exports[_0x9561('0x15')]=function(_0xf6382c){var _0x1e1925=this;return new Promise(function(_0x19335b,_0x423ae1){return db[_0x9561('0x16')]['find']({'raw':_0xf6382c[_0x9561('0x17')]?_0xf6382c[_0x9561('0x17')][_0x9561('0x18')]===undefined?!![]:![]:!![],'where':_0xf6382c[_0x9561('0x17')]?_0xf6382c[_0x9561('0x17')][_0x9561('0x19')]||null:null,'attributes':_0xf6382c['options']?_0xf6382c[_0x9561('0x17')][_0x9561('0x1a')]||null:null,'include':_0xf6382c[_0x9561('0x17')]?_0xf6382c[_0x9561('0x17')]['include']?_[_0x9561('0x1b')](_0xf6382c['options'][_0x9561('0x1c')],function(_0x16f06f){return{'model':db[_0x16f06f[_0x9561('0x1d')]],'as':_0x16f06f['as'],'attributes':_0x16f06f[_0x9561('0x1a')],'include':_0x16f06f['include']?_[_0x9561('0x1b')](_0x16f06f[_0x9561('0x1c')],function(_0x3f7467){return{'model':db[_0x3f7467[_0x9561('0x1d')]],'as':_0x3f7467['as'],'attributes':_0x3f7467[_0x9561('0x1a')],'include':_0x3f7467[_0x9561('0x1c')]?_[_0x9561('0x1b')](_0x3f7467[_0x9561('0x1c')],function(_0x3ac435){return{'model':db[_0x3ac435[_0x9561('0x1d')]],'as':_0x3ac435['as'],'attributes':_0x3ac435['attributes']};}):[]};}):[]};}):[]:[]})[_0x9561('0xb')](function(_0x20c91d){logger[_0x9561('0x13')](_0x9561('0x15'),_0xf6382c);logger[_0x9561('0xd')](_0x9561('0x15'),_0xf6382c,JSON['stringify'](_0x20c91d));_0x19335b(_0x20c91d);})[_0x9561('0x14')](function(_0x9b0759){logger['error'](_0x9561('0x15'),_0x9b0759[_0x9561('0x12')],_0xf6382c);_0x423ae1(_0x1e1925[_0x9561('0x10')](0x1f4,_0x9b0759[_0x9561('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 9accdae..8988bb0 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 _0x0bcc=['isAuthenticated','/:id','show','post','create','update','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get'];(function(_0x43dfa4,_0x1d9d14){var _0x148c28=function(_0x498795){while(--_0x498795){_0x43dfa4['push'](_0x43dfa4['shift']());}};_0x148c28(++_0x1d9d14);}(_0x0bcc,0xc7));var _0xc0bc=function(_0x279c40,_0xaf072e){_0x279c40=_0x279c40-0x0;var _0x361522=_0x0bcc[_0x279c40];return _0x361522;};'use strict';var multer=require(_0xc0bc('0x0'));var util=require(_0xc0bc('0x1'));var path=require('path');var timeout=require(_0xc0bc('0x2'));var express=require('express');var router=express[_0xc0bc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc0bc('0x4'));var interaction=require(_0xc0bc('0x5'));var config=require(_0xc0bc('0x6'));var controller=require(_0xc0bc('0x7'));router[_0xc0bc('0x8')]('/',auth[_0xc0bc('0x9')](),controller['index']);router[_0xc0bc('0x8')](_0xc0bc('0xa'),auth[_0xc0bc('0x9')](),controller[_0xc0bc('0xb')]);router[_0xc0bc('0xc')]('/',auth[_0xc0bc('0x9')](),controller[_0xc0bc('0xd')]);router['put']('/:id',auth[_0xc0bc('0x9')](),controller[_0xc0bc('0xe')]);router['delete'](_0xc0bc('0xa'),auth[_0xc0bc('0x9')](),controller[_0xc0bc('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9ce2=['../../config/environment','./squareProject.controller','isAuthenticated','get','/:id','post','create','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4063a8,_0x5494a4){var _0x44a7c3=function(_0x59d0d9){while(--_0x59d0d9){_0x4063a8['push'](_0x4063a8['shift']());}};_0x44a7c3(++_0x5494a4);}(_0x9ce2,0x1d4));var _0x29ce=function(_0x151e0b,_0x3bec86){_0x151e0b=_0x151e0b-0x0;var _0x5d4a5c=_0x9ce2[_0x151e0b];return _0x5d4a5c;};'use strict';var multer=require(_0x29ce('0x0'));var util=require('util');var path=require(_0x29ce('0x1'));var timeout=require(_0x29ce('0x2'));var express=require(_0x29ce('0x3'));var router=express[_0x29ce('0x4')]();var fs_extra=require(_0x29ce('0x5'));var auth=require(_0x29ce('0x6'));var interaction=require(_0x29ce('0x7'));var config=require(_0x29ce('0x8'));var controller=require(_0x29ce('0x9'));router['get']('/',auth[_0x29ce('0xa')](),controller['index']);router[_0x29ce('0xb')](_0x29ce('0xc'),auth[_0x29ce('0xa')](),controller['show']);router[_0x29ce('0xd')]('/',auth[_0x29ce('0xa')](),controller[_0x29ce('0xe')]);router['put'](_0x29ce('0xc'),auth[_0x29ce('0xa')](),controller['update']);router[_0x29ce('0xf')]('/:id',auth[_0x29ce('0xa')](),controller[_0x29ce('0x10')]);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 cc4a791..acab367 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 _0x596b=['DATE','sequelize','exports','STRING','name','TEXT','long','getDataValue','preproduction','utf8','BLOB','production','toString'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x596b,0xde));var _0xb596=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0x596b[_0x236c89];return _0x3b2a15;};'use strict';var Sequelize=require(_0xb596('0x0'));module[_0xb596('0x1')]={'name':{'type':Sequelize[_0xb596('0x2')],'unique':_0xb596('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xb596('0x2')]},'notes':{'type':Sequelize[_0xb596('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0xb596('0x5')),'get':function(){if(this[_0xb596('0x6')](_0xb596('0x7'))){return this[_0xb596('0x6')]('preproduction')['toString'](_0xb596('0x8'));}}},'production':{'type':Sequelize[_0xb596('0x9')](_0xb596('0x5')),'get':function(){if(this[_0xb596('0x6')](_0xb596('0xa'))){return this[_0xb596('0x6')]('production')[_0xb596('0xb')](_0xb596('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xb596('0xc')]}}; \ No newline at end of file +var _0xcd37=['production','DATE','sequelize','exports','STRING','TEXT','BLOB','long','getDataValue','toString','utf8'];(function(_0x251fde,_0x384469){var _0x350af6=function(_0x15a6a3){while(--_0x15a6a3){_0x251fde['push'](_0x251fde['shift']());}};_0x350af6(++_0x384469);}(_0xcd37,0x10a));var _0x7cd3=function(_0x82d779,_0x58bcaa){_0x82d779=_0x82d779-0x0;var _0x39d1c2=_0xcd37[_0x82d779];return _0x39d1c2;};'use strict';var Sequelize=require(_0x7cd3('0x0'));module[_0x7cd3('0x1')]={'name':{'type':Sequelize[_0x7cd3('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x7cd3('0x3')]},'preproduction':{'type':Sequelize[_0x7cd3('0x4')](_0x7cd3('0x5')),'get':function(){if(this[_0x7cd3('0x6')]('preproduction')){return this[_0x7cd3('0x6')]('preproduction')[_0x7cd3('0x7')](_0x7cd3('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0x7cd3('0x5')),'get':function(){if(this[_0x7cd3('0x6')]('production')){return this[_0x7cd3('0x6')](_0x7cd3('0x9'))[_0x7cd3('0x7')](_0x7cd3('0x8'));}}},'savedAt':{'type':Sequelize[_0x7cd3('0xa')]},'publishedAt':{'type':Sequelize[_0x7cd3('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 37bbdc5..0fc157e 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 _0x05d6=['map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','register','status','json','offset','limit','undefined','count','set','update','then','get','SquareProjects','UserProfileResource','destroy','agi','stringify','end','sendStatus','stack','name','send'];(function(_0x78b541,_0x222e1a){var _0x1243bb=function(_0x404373){while(--_0x404373){_0x78b541['push'](_0x78b541['shift']());}};_0x1243bb(++_0x222e1a);}(_0x05d6,0xad));var _0x605d=function(_0x58fd32,_0x1f776a){_0x58fd32=_0x58fd32-0x0;var _0x248675=_0x05d6[_0x58fd32];return _0x248675;};'use strict';var _=require(_0x605d('0x0'));var Redis=require('ioredis');var qs=require(_0x605d('0x1'));var logger=require('../../config/logger')(_0x605d('0x2'));var config=require(_0x605d('0x3'));var db=require(_0x605d('0x4'))['db'];config[_0x605d('0x5')]=_['defaults'](config[_0x605d('0x5')],{'host':_0x605d('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x605d('0x5')]));require('./squareProject.socket')[_0x605d('0x7')](socket);function respondWithResult(_0x1d7f08,_0x1f381f){_0x1f381f=_0x1f381f||0xc8;return function(_0x3d9985){if(_0x3d9985){return _0x1d7f08[_0x605d('0x8')](_0x1f381f)[_0x605d('0x9')](_0x3d9985);}};}function respondWithFilteredResult(_0x7b2c88,_0x32babf){return function(_0x365e8d){if(_0x365e8d){var _0x13fba8=typeof _0x32babf[_0x605d('0xa')]==='undefined'&&typeof _0x32babf[_0x605d('0xb')]===_0x605d('0xc');var _0x51a125=_0x365e8d[_0x605d('0xd')];var _0x105b99=_0x13fba8?0x0:_0x32babf[_0x605d('0xa')];var _0x4b1c4e=_0x13fba8?_0x365e8d[_0x605d('0xd')]:_0x32babf[_0x605d('0xa')]+_0x32babf[_0x605d('0xb')];var _0x3a13f2;if(_0x4b1c4e>=_0x51a125){_0x4b1c4e=_0x51a125;_0x3a13f2=0xc8;}else{_0x3a13f2=0xce;}_0x7b2c88[_0x605d('0x8')](_0x3a13f2);return _0x7b2c88[_0x605d('0xe')]('Content-Range',_0x105b99+'-'+_0x4b1c4e+'/'+_0x51a125)[_0x605d('0x9')](_0x365e8d);}return null;};}function saveUpdates(_0x5dcecf){return function(_0x2fc66b){if(_0x2fc66b){return _0x2fc66b[_0x605d('0xf')](_0x5dcecf)['then'](function(_0x340e01){return _0x340e01;});}return null;};}function removeEntity(_0x3616f2){return function(_0x5dc359){if(_0x5dc359){return _0x5dc359['destroy']()[_0x605d('0x10')](function(){var _0x1ca1c2=_0x5dc359[_0x605d('0x11')]({'plain':!![]});var _0x320fce=_0x605d('0x12');return db[_0x605d('0x13')][_0x605d('0x14')]({'where':{'type':_0x320fce,'resourceId':_0x1ca1c2['id']}})[_0x605d('0x10')](function(){return _0x5dc359;});})[_0x605d('0x10')](function(){var _0x17d2eb=new Redis(config[_0x605d('0x5')]);_0x17d2eb['publish'](_0x605d('0x15'),JSON[_0x605d('0x16')]({'id':_0x5dc359['id'],'deleted':!![]}));})[_0x605d('0x10')](function(){_0x3616f2[_0x605d('0x8')](0xcc)[_0x605d('0x17')]();});}};}function handleEntityNotFound(_0x3e2ba2){return function(_0x54e183){if(!_0x54e183){_0x3e2ba2[_0x605d('0x18')](0x194);}return _0x54e183;};}function handleError(_0x2f4f37,_0xe5eb8f){_0xe5eb8f=_0xe5eb8f||0x1f4;return function(_0x25579b){logger['error'](_0x25579b[_0x605d('0x19')]);if(_0x25579b[_0x605d('0x1a')]){delete _0x25579b[_0x605d('0x1a')];}_0x2f4f37[_0x605d('0x8')](_0xe5eb8f)[_0x605d('0x1b')](_0x25579b);};}exports['index']=function(_0x3c8040,_0x294026){var _0x44bb3d={},_0x20a645={},_0x2c0752={'count':0x0,'rows':[]};var _0x3fd952=_[_0x605d('0x1c')](db[_0x605d('0x1d')][_0x605d('0x1e')],function(_0xc84ec4){return{'name':_0xc84ec4[_0x605d('0x1f')],'type':_0xc84ec4[_0x605d('0x20')][_0x605d('0x21')]};});_0x20a645[_0x605d('0x22')]=_[_0x605d('0x1c')](_0x3fd952,_0x605d('0x1a'));_0x20a645[_0x605d('0x23')]=_[_0x605d('0x24')](_0x3c8040[_0x605d('0x23')]);_0x20a645[_0x605d('0x25')]=_[_0x605d('0x26')](_0x20a645['model'],_0x20a645[_0x605d('0x23')]);_0x44bb3d[_0x605d('0x27')]=_[_0x605d('0x26')](_0x20a645['model'],qs[_0x605d('0x28')](_0x3c8040[_0x605d('0x23')][_0x605d('0x28')]));_0x44bb3d[_0x605d('0x27')]=_0x44bb3d['attributes']['length']?_0x44bb3d['attributes']:_0x20a645[_0x605d('0x22')];if(!_0x3c8040[_0x605d('0x23')]['hasOwnProperty'](_0x605d('0x29'))){_0x44bb3d[_0x605d('0xb')]=qs['limit'](_0x3c8040['query']['limit']);_0x44bb3d['offset']=qs[_0x605d('0xa')](_0x3c8040[_0x605d('0x23')][_0x605d('0xa')]);}_0x44bb3d[_0x605d('0x2a')]=qs[_0x605d('0x2b')](_0x3c8040[_0x605d('0x23')][_0x605d('0x2b')]);_0x44bb3d[_0x605d('0x2c')]=qs['filters'](_[_0x605d('0x2d')](_0x3c8040[_0x605d('0x23')],_0x20a645[_0x605d('0x25')]),_0x3fd952);if(_0x3c8040[_0x605d('0x23')][_0x605d('0x2e')]){_0x44bb3d[_0x605d('0x2c')]=_['merge'](_0x44bb3d[_0x605d('0x2c')],{'$or':_['map'](_0x3fd952,function(_0x48f0fd){if(_0x48f0fd[_0x605d('0x20')]!==_0x605d('0x2f')){var _0x4bd003={};_0x4bd003[_0x48f0fd[_0x605d('0x1a')]]={'$like':'%'+_0x3c8040[_0x605d('0x23')]['filter']+'%'};return _0x4bd003;}})});}_0x44bb3d=_['merge']({},_0x44bb3d,_0x3c8040[_0x605d('0x30')]);var _0x191b8c={'where':_0x44bb3d[_0x605d('0x2c')]};return db[_0x605d('0x1d')][_0x605d('0xd')](_0x191b8c)[_0x605d('0x10')](function(_0x1465a8){_0x2c0752['count']=_0x1465a8;if(_0x3c8040['query'][_0x605d('0x31')]){_0x44bb3d[_0x605d('0x32')]=[{'all':!![]}];}return db[_0x605d('0x1d')][_0x605d('0x33')](_0x44bb3d);})[_0x605d('0x10')](function(_0x1cb3d4){_0x2c0752[_0x605d('0x34')]=_0x1cb3d4;return _0x2c0752;})[_0x605d('0x10')](respondWithFilteredResult(_0x294026,_0x44bb3d))[_0x605d('0x35')](handleError(_0x294026,null));};exports['show']=function(_0x4cefb5,_0x323fbe){var _0x3e53bd={'raw':![],'where':{'id':_0x4cefb5[_0x605d('0x36')]['id']}},_0x51299e={};_0x51299e[_0x605d('0x22')]=_[_0x605d('0x24')](db[_0x605d('0x1d')][_0x605d('0x1e')]);_0x51299e[_0x605d('0x23')]=_[_0x605d('0x24')](_0x4cefb5[_0x605d('0x23')]);_0x51299e[_0x605d('0x25')]=_[_0x605d('0x26')](_0x51299e['model'],_0x51299e[_0x605d('0x23')]);_0x3e53bd[_0x605d('0x27')]=_[_0x605d('0x26')](_0x51299e[_0x605d('0x22')],qs['fields'](_0x4cefb5['query'][_0x605d('0x28')]));_0x3e53bd['attributes']=_0x3e53bd['attributes'][_0x605d('0x37')]?_0x3e53bd['attributes']:_0x51299e[_0x605d('0x22')];if(_0x4cefb5[_0x605d('0x23')][_0x605d('0x31')]){_0x3e53bd['include']=[{'all':!![]}];}_0x3e53bd=_[_0x605d('0x38')]({},_0x3e53bd,_0x4cefb5[_0x605d('0x30')]);return db[_0x605d('0x1d')][_0x605d('0x39')](_0x3e53bd)[_0x605d('0x10')](handleEntityNotFound(_0x323fbe,null))[_0x605d('0x10')](respondWithResult(_0x323fbe,null))[_0x605d('0x35')](handleError(_0x323fbe,null));};exports[_0x605d('0x3a')]=function(_0x1bdaae,_0x6c9c45){return db[_0x605d('0x1d')][_0x605d('0x3a')](_0x1bdaae[_0x605d('0x3b')],{})['then'](function(_0x3cb139){var _0x238d73=_0x1bdaae['user'][_0x605d('0x11')]({'plain':!![]});if(!_0x238d73)throw new Error(_0x605d('0x3c'));if(_0x238d73[_0x605d('0x3d')]===_0x605d('0x3e')){var _0x2f36b1=_0x3cb139['get']({'plain':!![]});var _0x556967=_0x605d('0x12');return db[_0x605d('0x3f')][_0x605d('0x39')]({'where':{'name':_0x556967,'userProfileId':_0x238d73['userProfileId']},'raw':!![]})['then'](function(_0x184a33){if(_0x184a33&&_0x184a33[_0x605d('0x40')]===0x0){return db[_0x605d('0x13')][_0x605d('0x3a')]({'name':_0x2f36b1[_0x605d('0x1a')],'resourceId':_0x2f36b1['id'],'type':_0x184a33[_0x605d('0x1a')],'sectionId':_0x184a33['id']},{})[_0x605d('0x10')](function(){return _0x3cb139;});}else{return _0x3cb139;}})['catch'](function(_0x4da13f){logger['error'](_0x605d('0x41'),_0x4da13f);throw _0x4da13f;});}return _0x3cb139;})['then'](respondWithResult(_0x6c9c45,0xc9))[_0x605d('0x35')](handleError(_0x6c9c45,null));};exports[_0x605d('0xf')]=function(_0x56980c,_0x39a2b2){if(_0x56980c['body']['id']){delete _0x56980c[_0x605d('0x3b')]['id'];}return db['SquareProject'][_0x605d('0x39')]({'where':{'id':_0x56980c[_0x605d('0x36')]['id']}})[_0x605d('0x10')](handleEntityNotFound(_0x39a2b2,null))[_0x605d('0x10')](saveUpdates(_0x56980c[_0x605d('0x3b')],null))[_0x605d('0x10')](function(_0x5d0ec6){if(!_0x5d0ec6)return;var _0x4ddd50=_0x5d0ec6[_0x605d('0x11')]({'plain':!![]});return _0x4ddd50;})[_0x605d('0x10')](function(_0x3551e5){var _0x2c7f42=new Redis(config[_0x605d('0x5')]);_0x2c7f42[_0x605d('0x42')](_0x605d('0x15'),JSON[_0x605d('0x16')](_[_0x605d('0x2d')](_0x3551e5,['id','name','production'])));return _0x3551e5;})[_0x605d('0x10')](respondWithResult(_0x39a2b2,null))[_0x605d('0x35')](handleError(_0x39a2b2,null));};exports[_0x605d('0x14')]=function(_0x1a50a1,_0x70dd1d){return db[_0x605d('0x1d')][_0x605d('0x39')]({'where':{'id':_0x1a50a1['params']['id']}})[_0x605d('0x10')](handleEntityNotFound(_0x70dd1d,null))[_0x605d('0x10')](removeEntity(_0x70dd1d,null))[_0x605d('0x35')](handleError(_0x70dd1d,null));}; \ No newline at end of file +var _0xe1f7=['../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','offset','undefined','limit','count','status','set','Content-Range','json','update','destroy','then','get','UserProfileResource','agi','end','sendStatus','error','stack','name','send','map','SquareProject','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','length','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','stringify','pick','lodash','ioredis','../../components/parsers/qs','api','../../config/environment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe1f7,0x85));var _0x7e1f=function(_0x101dce,_0x3b887c){_0x101dce=_0x101dce-0x0;var _0x5a92bb=_0xe1f7[_0x101dce];return _0x5a92bb;};'use strict';var _=require(_0x7e1f('0x0'));var Redis=require(_0x7e1f('0x1'));var qs=require(_0x7e1f('0x2'));var logger=require('../../config/logger')(_0x7e1f('0x3'));var config=require(_0x7e1f('0x4'));var db=require(_0x7e1f('0x5'))['db'];config['redis']=_[_0x7e1f('0x6')](config[_0x7e1f('0x7')],{'host':_0x7e1f('0x8'),'port':0x18eb});var socket=require(_0x7e1f('0x9'))(new Redis(config['redis']));require('./squareProject.socket')[_0x7e1f('0xa')](socket);function respondWithResult(_0x2180e0,_0x298652){_0x298652=_0x298652||0xc8;return function(_0x45c317){if(_0x45c317){return _0x2180e0['status'](_0x298652)['json'](_0x45c317);}};}function respondWithFilteredResult(_0x1371a3,_0x299f1d){return function(_0x5f25bd){if(_0x5f25bd){var _0x3788b6=typeof _0x299f1d[_0x7e1f('0xb')]===_0x7e1f('0xc')&&typeof _0x299f1d[_0x7e1f('0xd')]===_0x7e1f('0xc');var _0x53cc5=_0x5f25bd[_0x7e1f('0xe')];var _0x56311a=_0x3788b6?0x0:_0x299f1d['offset'];var _0x1f4ada=_0x3788b6?_0x5f25bd['count']:_0x299f1d[_0x7e1f('0xb')]+_0x299f1d[_0x7e1f('0xd')];var _0x4c350b;if(_0x1f4ada>=_0x53cc5){_0x1f4ada=_0x53cc5;_0x4c350b=0xc8;}else{_0x4c350b=0xce;}_0x1371a3[_0x7e1f('0xf')](_0x4c350b);return _0x1371a3[_0x7e1f('0x10')](_0x7e1f('0x11'),_0x56311a+'-'+_0x1f4ada+'/'+_0x53cc5)[_0x7e1f('0x12')](_0x5f25bd);}return null;};}function saveUpdates(_0x2a06b9){return function(_0x123502){if(_0x123502){return _0x123502[_0x7e1f('0x13')](_0x2a06b9)['then'](function(_0x473b18){return _0x473b18;});}return null;};}function removeEntity(_0x53669b){return function(_0x319214){if(_0x319214){return _0x319214[_0x7e1f('0x14')]()[_0x7e1f('0x15')](function(){var _0x583186=_0x319214[_0x7e1f('0x16')]({'plain':!![]});var _0x1c69d2='SquareProjects';return db[_0x7e1f('0x17')][_0x7e1f('0x14')]({'where':{'type':_0x1c69d2,'resourceId':_0x583186['id']}})[_0x7e1f('0x15')](function(){return _0x319214;});})[_0x7e1f('0x15')](function(){var _0x4099d9=new Redis(config[_0x7e1f('0x7')]);_0x4099d9['publish'](_0x7e1f('0x18'),JSON['stringify']({'id':_0x319214['id'],'deleted':!![]}));})[_0x7e1f('0x15')](function(){_0x53669b[_0x7e1f('0xf')](0xcc)[_0x7e1f('0x19')]();});}};}function handleEntityNotFound(_0x79a891){return function(_0x265ae4){if(!_0x265ae4){_0x79a891[_0x7e1f('0x1a')](0x194);}return _0x265ae4;};}function handleError(_0x2c85da,_0xee2729){_0xee2729=_0xee2729||0x1f4;return function(_0x588cf2){logger[_0x7e1f('0x1b')](_0x588cf2[_0x7e1f('0x1c')]);if(_0x588cf2[_0x7e1f('0x1d')]){delete _0x588cf2['name'];}_0x2c85da['status'](_0xee2729)[_0x7e1f('0x1e')](_0x588cf2);};}exports['index']=function(_0x556033,_0x3665e9){var _0xeda597={},_0x24f2d8={},_0x346ec2={'count':0x0,'rows':[]};var _0x4aa5f8=_[_0x7e1f('0x1f')](db[_0x7e1f('0x20')][_0x7e1f('0x21')],function(_0xa4fef7){return{'name':_0xa4fef7[_0x7e1f('0x22')],'type':_0xa4fef7[_0x7e1f('0x23')]['key']};});_0x24f2d8[_0x7e1f('0x24')]=_[_0x7e1f('0x1f')](_0x4aa5f8,'name');_0x24f2d8['query']=_['keys'](_0x556033[_0x7e1f('0x25')]);_0x24f2d8[_0x7e1f('0x26')]=_['intersection'](_0x24f2d8[_0x7e1f('0x24')],_0x24f2d8['query']);_0xeda597[_0x7e1f('0x27')]=_[_0x7e1f('0x28')](_0x24f2d8[_0x7e1f('0x24')],qs[_0x7e1f('0x29')](_0x556033['query'][_0x7e1f('0x29')]));_0xeda597[_0x7e1f('0x27')]=_0xeda597[_0x7e1f('0x27')]['length']?_0xeda597[_0x7e1f('0x27')]:_0x24f2d8[_0x7e1f('0x24')];if(!_0x556033[_0x7e1f('0x25')][_0x7e1f('0x2a')]('nolimit')){_0xeda597[_0x7e1f('0xd')]=qs[_0x7e1f('0xd')](_0x556033[_0x7e1f('0x25')][_0x7e1f('0xd')]);_0xeda597[_0x7e1f('0xb')]=qs[_0x7e1f('0xb')](_0x556033['query']['offset']);}_0xeda597[_0x7e1f('0x2b')]=qs['sort'](_0x556033[_0x7e1f('0x25')][_0x7e1f('0x2c')]);_0xeda597[_0x7e1f('0x2d')]=qs[_0x7e1f('0x26')](_['pick'](_0x556033[_0x7e1f('0x25')],_0x24f2d8[_0x7e1f('0x26')]),_0x4aa5f8);if(_0x556033[_0x7e1f('0x25')][_0x7e1f('0x2e')]){_0xeda597[_0x7e1f('0x2d')]=_[_0x7e1f('0x2f')](_0xeda597[_0x7e1f('0x2d')],{'$or':_[_0x7e1f('0x1f')](_0x4aa5f8,function(_0x37f42a){if(_0x37f42a[_0x7e1f('0x23')]!==_0x7e1f('0x30')){var _0x3db5de={};_0x3db5de[_0x37f42a[_0x7e1f('0x1d')]]={'$like':'%'+_0x556033[_0x7e1f('0x25')]['filter']+'%'};return _0x3db5de;}})});}_0xeda597=_['merge']({},_0xeda597,_0x556033[_0x7e1f('0x31')]);var _0x1052ab={'where':_0xeda597['where']};return db[_0x7e1f('0x20')][_0x7e1f('0xe')](_0x1052ab)[_0x7e1f('0x15')](function(_0x72cd8a){_0x346ec2[_0x7e1f('0xe')]=_0x72cd8a;if(_0x556033[_0x7e1f('0x25')][_0x7e1f('0x32')]){_0xeda597[_0x7e1f('0x33')]=[{'all':!![]}];}return db['SquareProject'][_0x7e1f('0x34')](_0xeda597);})['then'](function(_0x109341){_0x346ec2['rows']=_0x109341;return _0x346ec2;})[_0x7e1f('0x15')](respondWithFilteredResult(_0x3665e9,_0xeda597))['catch'](handleError(_0x3665e9,null));};exports[_0x7e1f('0x35')]=function(_0x59c7ab,_0x49d35a){var _0x5ace27={'raw':![],'where':{'id':_0x59c7ab[_0x7e1f('0x36')]['id']}},_0xb7330c={};_0xb7330c[_0x7e1f('0x24')]=_[_0x7e1f('0x37')](db['SquareProject'][_0x7e1f('0x21')]);_0xb7330c[_0x7e1f('0x25')]=_['keys'](_0x59c7ab[_0x7e1f('0x25')]);_0xb7330c['filters']=_['intersection'](_0xb7330c[_0x7e1f('0x24')],_0xb7330c[_0x7e1f('0x25')]);_0x5ace27[_0x7e1f('0x27')]=_[_0x7e1f('0x28')](_0xb7330c[_0x7e1f('0x24')],qs['fields'](_0x59c7ab[_0x7e1f('0x25')][_0x7e1f('0x29')]));_0x5ace27['attributes']=_0x5ace27['attributes'][_0x7e1f('0x38')]?_0x5ace27['attributes']:_0xb7330c[_0x7e1f('0x24')];if(_0x59c7ab[_0x7e1f('0x25')]['includeAll']){_0x5ace27['include']=[{'all':!![]}];}_0x5ace27=_[_0x7e1f('0x2f')]({},_0x5ace27,_0x59c7ab[_0x7e1f('0x31')]);return db['SquareProject']['find'](_0x5ace27)[_0x7e1f('0x15')](handleEntityNotFound(_0x49d35a,null))['then'](respondWithResult(_0x49d35a,null))[_0x7e1f('0x39')](handleError(_0x49d35a,null));};exports[_0x7e1f('0x3a')]=function(_0x3c00d5,_0x819f3){return db[_0x7e1f('0x20')][_0x7e1f('0x3a')](_0x3c00d5[_0x7e1f('0x3b')],{})[_0x7e1f('0x15')](function(_0x285c55){var _0x25415a=_0x3c00d5[_0x7e1f('0x3c')]['get']({'plain':!![]});if(!_0x25415a)throw new Error(_0x7e1f('0x3d'));if(_0x25415a[_0x7e1f('0x3e')]===_0x7e1f('0x3c')){var _0x2efd0d=_0x285c55['get']({'plain':!![]});var _0x32cfd9=_0x7e1f('0x3f');return db[_0x7e1f('0x40')][_0x7e1f('0x41')]({'where':{'name':_0x32cfd9,'userProfileId':_0x25415a['userProfileId']},'raw':!![]})[_0x7e1f('0x15')](function(_0x4926ae){if(_0x4926ae&&_0x4926ae['autoAssociation']===0x0){return db[_0x7e1f('0x17')][_0x7e1f('0x3a')]({'name':_0x2efd0d['name'],'resourceId':_0x2efd0d['id'],'type':_0x4926ae[_0x7e1f('0x1d')],'sectionId':_0x4926ae['id']},{})[_0x7e1f('0x15')](function(){return _0x285c55;});}else{return _0x285c55;}})[_0x7e1f('0x39')](function(_0xc6dbb7){logger['error'](_0x7e1f('0x42'),_0xc6dbb7);throw _0xc6dbb7;});}return _0x285c55;})[_0x7e1f('0x15')](respondWithResult(_0x819f3,0xc9))[_0x7e1f('0x39')](handleError(_0x819f3,null));};exports[_0x7e1f('0x13')]=function(_0x489b2c,_0x32124d){if(_0x489b2c[_0x7e1f('0x3b')]['id']){delete _0x489b2c[_0x7e1f('0x3b')]['id'];}return db['SquareProject'][_0x7e1f('0x41')]({'where':{'id':_0x489b2c[_0x7e1f('0x36')]['id']}})[_0x7e1f('0x15')](handleEntityNotFound(_0x32124d,null))[_0x7e1f('0x15')](saveUpdates(_0x489b2c[_0x7e1f('0x3b')],null))['then'](function(_0x240671){if(!_0x240671)return;var _0x5ee097=_0x240671[_0x7e1f('0x16')]({'plain':!![]});return _0x5ee097;})[_0x7e1f('0x15')](function(_0x45b8c3){var _0x29e941=new Redis(config[_0x7e1f('0x7')]);_0x29e941['publish'](_0x7e1f('0x18'),JSON[_0x7e1f('0x43')](_[_0x7e1f('0x44')](_0x45b8c3,['id',_0x7e1f('0x1d'),'production'])));return _0x45b8c3;})[_0x7e1f('0x15')](respondWithResult(_0x32124d,null))[_0x7e1f('0x39')](handleError(_0x32124d,null));};exports[_0x7e1f('0x14')]=function(_0x411402,_0x403cef){return db[_0x7e1f('0x20')]['find']({'where':{'id':_0x411402[_0x7e1f('0x36')]['id']}})['then'](handleEntityNotFound(_0x403cef,null))[_0x7e1f('0x15')](removeEntity(_0x403cef,null))[_0x7e1f('0x39')](handleError(_0x403cef,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 5168dc1..f2adb81 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 _0xc359=['SquareProject','setMaxListeners','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x5e0e51,_0x1a0859){var _0xe5d6bd=function(_0x2c26e9){while(--_0x2c26e9){_0x5e0e51['push'](_0x5e0e51['shift']());}};_0xe5d6bd(++_0x1a0859);}(_0xc359,0xde));var _0x9c35=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0xc359[_0x338f73];return _0x163fdf;};'use strict';var EventEmitter=require(_0x9c35('0x0'));var SquareProject=require(_0x9c35('0x1'))['db'][_0x9c35('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9c35('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9c35('0x4')};function emitEvent(_0x3bbebb){return function(_0x57b823,_0x38adce,_0x313631){SquareProjectEvents[_0x9c35('0x5')](_0x3bbebb+':'+_0x57b823['id'],_0x57b823);SquareProjectEvents['emit'](_0x3bbebb,_0x57b823);_0x313631(null);};}for(var e in events){if(events[_0x9c35('0x6')](e)){var event=events[e];SquareProject[_0x9c35('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x97d1=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1f652f,_0x20030d){var _0x314e5f=function(_0x2f3e51){while(--_0x2f3e51){_0x1f652f['push'](_0x1f652f['shift']());}};_0x314e5f(++_0x20030d);}(_0x97d1,0x1b9));var _0x197d=function(_0x22aa61,_0x45e107){_0x22aa61=_0x22aa61-0x0;var _0x51500a=_0x97d1[_0x22aa61];return _0x51500a;};'use strict';var EventEmitter=require(_0x197d('0x0'));var SquareProject=require(_0x197d('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x197d('0x2')](0x0);var events={'afterCreate':_0x197d('0x3'),'afterUpdate':_0x197d('0x4'),'afterDestroy':_0x197d('0x5')};function emitEvent(_0x3a45f9){return function(_0x80ddc0,_0x23075f,_0x246994){SquareProjectEvents[_0x197d('0x6')](_0x3a45f9+':'+_0x80ddc0['id'],_0x80ddc0);SquareProjectEvents[_0x197d('0x6')](_0x3a45f9,_0x80ddc0);_0x246994(null);};}for(var e in events){if(events[_0x197d('0x7')](e)){var event=events[e];SquareProject[_0x197d('0x8')](e,emitEvent(event));}}module[_0x197d('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 7fbe5fe..6fc840d 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 _0xd5e4=['moment','bluebird','request-promise','path','rimraf','./squareProject.attributes','define','SquareProject','changed','preproduction','savedAt','format','production','YYYY-MM-DD\x20HH:mm:ss','util','api'];(function(_0x1f3ee6,_0x42da21){var _0x19ee5=function(_0x26e694){while(--_0x26e694){_0x1f3ee6['push'](_0x1f3ee6['shift']());}};_0x19ee5(++_0x42da21);}(_0xd5e4,0x1be));var _0x4d5e=function(_0x5163e0,_0x309a0e){_0x5163e0=_0x5163e0-0x0;var _0x5c550d=_0xd5e4[_0x5163e0];return _0x5c550d;};'use strict';var _=require('lodash');var util=require(_0x4d5e('0x0'));var logger=require('../../config/logger')(_0x4d5e('0x1'));var moment=require(_0x4d5e('0x2'));var BPromise=require(_0x4d5e('0x3'));var rp=require(_0x4d5e('0x4'));var fs=require('fs');var path=require(_0x4d5e('0x5'));var rimraf=require(_0x4d5e('0x6'));var config=require('../../config/environment');var attributes=require(_0x4d5e('0x7'));module['exports']=function(_0x1d013f,_0x3ee60e){return _0x1d013f[_0x4d5e('0x8')](_0x4d5e('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13ac29,_0x57105d,_0x326d21){if(_0x13ac29[_0x4d5e('0xa')](_0x4d5e('0xb'))){_0x13ac29[_0x4d5e('0xc')]=moment()[_0x4d5e('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x13ac29['changed'](_0x4d5e('0xe'))){_0x13ac29['publishedAt']=moment()[_0x4d5e('0xd')](_0x4d5e('0xf'));}_0x326d21(null,_0x13ac29);}}});}; \ No newline at end of file +var _0x385c=['square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','util','../../config/logger','api','path','../../config/environment','./squareProject.attributes','exports','define'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x385c,0x70));var _0xc385=function(_0x5621f8,_0x479a1c){_0x5621f8=_0x5621f8-0x0;var _0xfdbd1b=_0x385c[_0x5621f8];return _0xfdbd1b;};'use strict';var _=require('lodash');var util=require(_0xc385('0x0'));var logger=require(_0xc385('0x1'))(_0xc385('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc385('0x3'));var rimraf=require('rimraf');var config=require(_0xc385('0x4'));var attributes=require(_0xc385('0x5'));module[_0xc385('0x6')]=function(_0x14697d,_0x2356b8){return _0x14697d[_0xc385('0x7')]('SquareProject',attributes,{'tableName':_0xc385('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7bbb2c,_0x41422b,_0x39635d){if(_0x7bbb2c['changed'](_0xc385('0x9'))){_0x7bbb2c[_0xc385('0xa')]=moment()[_0xc385('0xb')](_0xc385('0xc'));}if(_0x7bbb2c[_0xc385('0xd')](_0xc385('0xe'))){_0x7bbb2c['publishedAt']=moment()['format'](_0xc385('0xc'));}_0x39635d(null,_0x7bbb2c);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 21b84c4..e289844 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 _0xa697=['stringify','catch','error','message','find','raw','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','rpc','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','GetSquareProjects','SquareProject','findAll','options','where','attributes','limit','include','model','map','then','info','debug'];(function(_0x345431,_0x194614){var _0x2b1a06=function(_0x31c06a){while(--_0x31c06a){_0x345431['push'](_0x345431['shift']());}};_0x2b1a06(++_0x194614);}(_0xa697,0x18d));var _0x7a69=function(_0x47a367,_0x30ee9d){_0x47a367=_0x47a367-0x0;var _0x971bb5=_0xa697[_0x47a367];return _0x971bb5;};'use strict';var _=require(_0x7a69('0x0'));var Redis=require(_0x7a69('0x1'));var db=require(_0x7a69('0x2'))['db'];var logger=require(_0x7a69('0x3'))(_0x7a69('0x4'));var config=require('../../config/environment');config['redis']=_[_0x7a69('0x5')](config[_0x7a69('0x6')],{'host':_0x7a69('0x7'),'port':0x18eb});var socket=require(_0x7a69('0x8'))(new Redis(config[_0x7a69('0x6')]));require(_0x7a69('0x9'))['register'](socket);exports[_0x7a69('0xa')]=function(_0x4962fd){var _0x16231f=this;return new Promise(function(_0x524f1b,_0x1b6322){return db[_0x7a69('0xb')][_0x7a69('0xc')]({'raw':_0x4962fd[_0x7a69('0xd')]?_0x4962fd['options']['raw']===undefined?!![]:![]:!![],'where':_0x4962fd['options']?_0x4962fd[_0x7a69('0xd')][_0x7a69('0xe')]||null:null,'attributes':_0x4962fd[_0x7a69('0xd')]?_0x4962fd['options'][_0x7a69('0xf')]||null:null,'limit':_0x4962fd[_0x7a69('0xd')]?_0x4962fd['options'][_0x7a69('0x10')]||null:null,'include':_0x4962fd[_0x7a69('0xd')]?_0x4962fd[_0x7a69('0xd')][_0x7a69('0x11')]?_['map'](_0x4962fd[_0x7a69('0xd')][_0x7a69('0x11')],function(_0x42e4ea){return{'model':db[_0x42e4ea['model']],'as':_0x42e4ea['as'],'attributes':_0x42e4ea[_0x7a69('0xf')],'include':_0x42e4ea[_0x7a69('0x11')]?_['map'](_0x42e4ea['include'],function(_0x2197d6){return{'model':db[_0x2197d6[_0x7a69('0x12')]],'as':_0x2197d6['as'],'attributes':_0x2197d6[_0x7a69('0xf')],'include':_0x2197d6[_0x7a69('0x11')]?_[_0x7a69('0x13')](_0x2197d6['include'],function(_0x3d7066){return{'model':db[_0x3d7066[_0x7a69('0x12')]],'as':_0x3d7066['as'],'attributes':_0x3d7066['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a69('0x14')](function(_0x29b78e){logger[_0x7a69('0x15')](_0x7a69('0xa'),_0x4962fd);logger[_0x7a69('0x16')](_0x7a69('0xa'),_0x4962fd,JSON[_0x7a69('0x17')](_0x29b78e));_0x524f1b(_0x29b78e);})[_0x7a69('0x18')](function(_0x216d9c){logger[_0x7a69('0x19')](_0x7a69('0xa'),_0x216d9c[_0x7a69('0x1a')],_0x4962fd);_0x1b6322(_0x16231f[_0x7a69('0x19')](0x1f4,_0x216d9c[_0x7a69('0x1a')]));});});};exports['ShowSquareProject']=function(_0x1fc342){var _0x5ba4f4=this;return new Promise(function(_0x314c3d,_0x28a538){return db[_0x7a69('0xb')][_0x7a69('0x1b')]({'raw':_0x1fc342['options']?_0x1fc342['options'][_0x7a69('0x1c')]===undefined?!![]:![]:!![],'where':_0x1fc342['options']?_0x1fc342[_0x7a69('0xd')][_0x7a69('0xe')]||null:null,'attributes':_0x1fc342[_0x7a69('0xd')]?_0x1fc342[_0x7a69('0xd')][_0x7a69('0xf')]||null:null,'include':_0x1fc342['options']?_0x1fc342[_0x7a69('0xd')][_0x7a69('0x11')]?_[_0x7a69('0x13')](_0x1fc342[_0x7a69('0xd')][_0x7a69('0x11')],function(_0x1450ab){return{'model':db[_0x1450ab['model']],'as':_0x1450ab['as'],'attributes':_0x1450ab[_0x7a69('0xf')],'include':_0x1450ab[_0x7a69('0x11')]?_[_0x7a69('0x13')](_0x1450ab['include'],function(_0x5b2d60){return{'model':db[_0x5b2d60['model']],'as':_0x5b2d60['as'],'attributes':_0x5b2d60['attributes'],'include':_0x5b2d60[_0x7a69('0x11')]?_[_0x7a69('0x13')](_0x5b2d60[_0x7a69('0x11')],function(_0x161043){return{'model':db[_0x161043[_0x7a69('0x12')]],'as':_0x161043['as'],'attributes':_0x161043[_0x7a69('0xf')]};}):[]};}):[]};}):[]:[]})[_0x7a69('0x14')](function(_0x38f3b9){logger[_0x7a69('0x15')]('ShowSquareProject',_0x1fc342);logger[_0x7a69('0x16')](_0x7a69('0x1d'),_0x1fc342,JSON['stringify'](_0x38f3b9));_0x314c3d(_0x38f3b9);})[_0x7a69('0x18')](function(_0xf7098f){logger[_0x7a69('0x19')](_0x7a69('0x1d'),_0xf7098f[_0x7a69('0x1a')],_0x1fc342);_0x28a538(_0x5ba4f4[_0x7a69('0x19')](0x1f4,_0xf7098f[_0x7a69('0x1a')]));});});}; \ No newline at end of file +var _0x3dc6=['register','GetSquareProjects','SquareProject','findAll','options','attributes','limit','include','map','model','then','debug','stringify','catch','error','message','ShowSquareProject','find','raw','where','info','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x3dc6,0xab));var _0x63dc=function(_0x3e01f1,_0x257eac){_0x3e01f1=_0x3e01f1-0x0;var _0x50f4ba=_0x3dc6[_0x3e01f1];return _0x50f4ba;};'use strict';var _=require(_0x63dc('0x0'));var Redis=require(_0x63dc('0x1'));var db=require(_0x63dc('0x2'))['db'];var logger=require(_0x63dc('0x3'))('rpc');var config=require(_0x63dc('0x4'));config[_0x63dc('0x5')]=_['defaults'](config[_0x63dc('0x5')],{'host':_0x63dc('0x6'),'port':0x18eb});var socket=require(_0x63dc('0x7'))(new Redis(config[_0x63dc('0x5')]));require(_0x63dc('0x8'))[_0x63dc('0x9')](socket);exports[_0x63dc('0xa')]=function(_0x41c3f9){var _0x2b26a1=this;return new Promise(function(_0x3c7183,_0x3da235){return db[_0x63dc('0xb')][_0x63dc('0xc')]({'raw':_0x41c3f9[_0x63dc('0xd')]?_0x41c3f9[_0x63dc('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x41c3f9['options']?_0x41c3f9[_0x63dc('0xd')]['where']||null:null,'attributes':_0x41c3f9['options']?_0x41c3f9['options'][_0x63dc('0xe')]||null:null,'limit':_0x41c3f9['options']?_0x41c3f9[_0x63dc('0xd')][_0x63dc('0xf')]||null:null,'include':_0x41c3f9[_0x63dc('0xd')]?_0x41c3f9['options'][_0x63dc('0x10')]?_[_0x63dc('0x11')](_0x41c3f9[_0x63dc('0xd')][_0x63dc('0x10')],function(_0x5a1d2b){return{'model':db[_0x5a1d2b[_0x63dc('0x12')]],'as':_0x5a1d2b['as'],'attributes':_0x5a1d2b[_0x63dc('0xe')],'include':_0x5a1d2b[_0x63dc('0x10')]?_['map'](_0x5a1d2b['include'],function(_0x428f0b){return{'model':db[_0x428f0b[_0x63dc('0x12')]],'as':_0x428f0b['as'],'attributes':_0x428f0b[_0x63dc('0xe')],'include':_0x428f0b['include']?_['map'](_0x428f0b[_0x63dc('0x10')],function(_0x2c5c0a){return{'model':db[_0x2c5c0a[_0x63dc('0x12')]],'as':_0x2c5c0a['as'],'attributes':_0x2c5c0a[_0x63dc('0xe')]};}):[]};}):[]};}):[]:[]})[_0x63dc('0x13')](function(_0x248f48){logger['info'](_0x63dc('0xa'),_0x41c3f9);logger[_0x63dc('0x14')](_0x63dc('0xa'),_0x41c3f9,JSON[_0x63dc('0x15')](_0x248f48));_0x3c7183(_0x248f48);})[_0x63dc('0x16')](function(_0x5a95cf){logger[_0x63dc('0x17')](_0x63dc('0xa'),_0x5a95cf['message'],_0x41c3f9);_0x3da235(_0x2b26a1[_0x63dc('0x17')](0x1f4,_0x5a95cf[_0x63dc('0x18')]));});});};exports[_0x63dc('0x19')]=function(_0x182c2f){var _0x40b844=this;return new Promise(function(_0x473f39,_0x19f3a7){return db['SquareProject'][_0x63dc('0x1a')]({'raw':_0x182c2f['options']?_0x182c2f[_0x63dc('0xd')][_0x63dc('0x1b')]===undefined?!![]:![]:!![],'where':_0x182c2f[_0x63dc('0xd')]?_0x182c2f[_0x63dc('0xd')][_0x63dc('0x1c')]||null:null,'attributes':_0x182c2f[_0x63dc('0xd')]?_0x182c2f[_0x63dc('0xd')][_0x63dc('0xe')]||null:null,'include':_0x182c2f[_0x63dc('0xd')]?_0x182c2f[_0x63dc('0xd')][_0x63dc('0x10')]?_[_0x63dc('0x11')](_0x182c2f[_0x63dc('0xd')][_0x63dc('0x10')],function(_0x45184b){return{'model':db[_0x45184b[_0x63dc('0x12')]],'as':_0x45184b['as'],'attributes':_0x45184b[_0x63dc('0xe')],'include':_0x45184b['include']?_[_0x63dc('0x11')](_0x45184b[_0x63dc('0x10')],function(_0x449d72){return{'model':db[_0x449d72['model']],'as':_0x449d72['as'],'attributes':_0x449d72[_0x63dc('0xe')],'include':_0x449d72[_0x63dc('0x10')]?_[_0x63dc('0x11')](_0x449d72['include'],function(_0x22d263){return{'model':db[_0x22d263[_0x63dc('0x12')]],'as':_0x22d263['as'],'attributes':_0x22d263['attributes']};}):[]};}):[]};}):[]:[]})[_0x63dc('0x13')](function(_0x4ba31c){logger[_0x63dc('0x1d')](_0x63dc('0x19'),_0x182c2f);logger[_0x63dc('0x14')](_0x63dc('0x19'),_0x182c2f,JSON[_0x63dc('0x15')](_0x4ba31c));_0x473f39(_0x4ba31c);})[_0x63dc('0x16')](function(_0x20a14e){logger['error']('ShowSquareProject',_0x20a14e[_0x63dc('0x18')],_0x182c2f);_0x19f3a7(_0x40b844[_0x63dc('0x17')](0x1f4,_0x20a14e[_0x63dc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 2d41e62..38ce6e4 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 _0xb477=['update','emit','removeListener','register','length','./squareProject.events','remove'];(function(_0x380d88,_0x11f409){var _0x106d81=function(_0x5c30f2){while(--_0x5c30f2){_0x380d88['push'](_0x380d88['shift']());}};_0x106d81(++_0x11f409);}(_0xb477,0xf3));var _0x7b47=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xb477[_0x53ccf2];return _0x5a2964;};'use strict';var SquareProjectEvents=require(_0x7b47('0x0'));var events=['save',_0x7b47('0x1'),_0x7b47('0x2')];function createListener(_0x34bed0,_0x2fee0b){return function(_0xeadad6){_0x2fee0b[_0x7b47('0x3')](_0x34bed0,_0xeadad6);};}function removeListener(_0x4d44d1,_0x3b6f22){return function(){SquareProjectEvents[_0x7b47('0x4')](_0x4d44d1,_0x3b6f22);};}exports[_0x7b47('0x5')]=function(_0x2a1dbb){for(var _0x22a295=0x0,_0x9d49c5=events[_0x7b47('0x6')];_0x22a295<_0x9d49c5;_0x22a295++){var _0xae3cf2=events[_0x22a295];var _0x3c2e5e=createListener('squareProject:'+_0xae3cf2,_0x2a1dbb);SquareProjectEvents['on'](_0xae3cf2,_0x3c2e5e);}}; \ No newline at end of file +var _0xd3a0=['register','length','squareProject:','./squareProject.events','save','remove','update','emit'];(function(_0x464225,_0x5133ff){var _0x302494=function(_0x52a9ee){while(--_0x52a9ee){_0x464225['push'](_0x464225['shift']());}};_0x302494(++_0x5133ff);}(_0xd3a0,0x15b));var _0x0d3a=function(_0x3017e4,_0x5bd8e3){_0x3017e4=_0x3017e4-0x0;var _0x146adb=_0xd3a0[_0x3017e4];return _0x146adb;};'use strict';var SquareProjectEvents=require(_0x0d3a('0x0'));var events=[_0x0d3a('0x1'),_0x0d3a('0x2'),_0x0d3a('0x3')];function createListener(_0x1b1e7d,_0xff74d6){return function(_0x2240ee){_0xff74d6[_0x0d3a('0x4')](_0x1b1e7d,_0x2240ee);};}function removeListener(_0x37b40e,_0x352253){return function(){SquareProjectEvents['removeListener'](_0x37b40e,_0x352253);};}exports[_0x0d3a('0x5')]=function(_0x519c01){for(var _0x319f41=0x0,_0x4780d4=events[_0x0d3a('0x6')];_0x319f41<_0x4780d4;_0x319f41++){var _0x200b9d=events[_0x319f41];var _0x47e593=createListener(_0x0d3a('0x7')+_0x200b9d,_0x519c01);SquareProjectEvents['on'](_0x200b9d,_0x47e593);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 38b1e5b..b9acf4c 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 _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x40f990,_0x2efe16){var _0x3ae8ca=function(_0x387ff6){while(--_0x387ff6){_0x40f990['push'](_0x40f990['shift']());}};_0x3ae8ca(++_0x2efe16);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc4aa[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x285100,_0x40ee32){var _0x232176=function(_0x1d259b){while(--_0x1d259b){_0x285100['push'](_0x285100['shift']());}};_0x232176(++_0x40ee32);}(_0x5fab,0x177));var _0xb5fa=function(_0x276fae,_0x1424c1){_0x276fae=_0x276fae-0x0;var _0x132c7e=_0x5fab[_0x276fae];return _0x132c7e;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 06fba66..20bb6b2 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 _0x032e=['VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x306324,_0x2acd6d){var _0x24785f=function(_0x452b7e){while(--_0x452b7e){_0x306324['push'](_0x306324['shift']());}};_0x24785f(++_0x2acd6d);}(_0x032e,0x124));var _0xe032=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x032e[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0xe032('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe032('0x1')]},'callerid':{'type':Sequelize[_0xe032('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xe032('0x1')]},'priority':{'type':Sequelize[_0xe032('0x1')]},'accountcode':{'type':Sequelize[_0xe032('0x1')]},'dnid':{'type':Sequelize[_0xe032('0x1')]},'projectName':{'type':Sequelize[_0xe032('0x1')]},'saveName':{'type':Sequelize[_0xe032('0x1')]},'filename':{'type':Sequelize[_0xe032('0x1')]},'savePath':{'type':Sequelize[_0xe032('0x1')]},'format':{'type':Sequelize[_0xe032('0x2')],'get':function(){var _0x1576c8='';var _0x3289b0=this[_0xe032('0x3')](_0xe032('0x4'));if(_0x3289b0){_0x1576c8=_0x3289b0[_0xe032('0x5')](_0x3289b0[_0xe032('0x6')]('.'));}return _0x1576c8;}}}; \ No newline at end of file +var _0x81bd=['STRING','VIRTUAL','getDataValue','substring','lastIndexOf','sequelize','exports'];(function(_0x37bba7,_0x3ba1c8){var _0x15d33c=function(_0x3a31c1){while(--_0x3a31c1){_0x37bba7['push'](_0x37bba7['shift']());}};_0x15d33c(++_0x3ba1c8);}(_0x81bd,0x7c));var _0xd81b=function(_0x1bb6aa,_0x40fe82){_0x1bb6aa=_0x1bb6aa-0x0;var _0x2ef28e=_0x81bd[_0x1bb6aa];return _0x2ef28e;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'uniqueid':{'type':Sequelize[_0xd81b('0x2')]},'callerid':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize[_0xd81b('0x2')]},'context':{'type':Sequelize[_0xd81b('0x2')]},'extension':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd81b('0x2')]},'dnid':{'type':Sequelize[_0xd81b('0x2')]},'projectName':{'type':Sequelize[_0xd81b('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xd81b('0x2')]},'savePath':{'type':Sequelize[_0xd81b('0x2')]},'format':{'type':Sequelize[_0xd81b('0x3')],'get':function(){var _0x562084='';var _0x5e14e8=this[_0xd81b('0x4')]('savePath');if(_0x5e14e8){_0x562084=_0x5e14e8[_0xd81b('0x5')](_0x5e14e8[_0xd81b('0x6')]('.'));}return _0x562084;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 4924da8..0bdfb9c 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 _0x5b06=['Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','find','create','body','download','uniqueid','filename','savePath','decryptFile','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x4aa0a9,_0x3ab3bf){var _0x231ab1=function(_0x199ba9){while(--_0x199ba9){_0x4aa0a9['push'](_0x4aa0a9['shift']());}};_0x231ab1(++_0x3ab3bf);}(_0x5b06,0x1bf));var _0x65b0=function(_0x538a39,_0x5b1747){_0x538a39=_0x538a39-0x0;var _0xd19cb2=_0x5b06[_0x538a39];return _0xd19cb2;};'use strict';var emlformat=require(_0x65b0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x65b0('0x1'));var rp=require(_0x65b0('0x2'));var moment=require(_0x65b0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x65b0('0x4'));var util=require(_0x65b0('0x5'));var path=require(_0x65b0('0x6'));var sox=require(_0x65b0('0x7'));var csv=require('to-csv');var ejs=require(_0x65b0('0x8'));var fs=require('fs');var fs_extra=require(_0x65b0('0x9'));var _=require('lodash');var squel=require(_0x65b0('0xa'));var crypto=require(_0x65b0('0xb'));var jsforce=require(_0x65b0('0xc'));var deskjs=require(_0x65b0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x65b0('0xe'));var Papa=require(_0x65b0('0xf'));var Redis=require(_0x65b0('0x10'));var authService=require(_0x65b0('0x11'));var qs=require(_0x65b0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x65b0('0x13'));var logger=require(_0x65b0('0x14'))(_0x65b0('0x15'));var utils=require(_0x65b0('0x16'));var config=require(_0x65b0('0x17'));var licenseUtil=require(_0x65b0('0x18'));var db=require(_0x65b0('0x19'))['db'];function respondWithStatusCode(_0x511711,_0x10fd7b){_0x10fd7b=_0x10fd7b||0xcc;return function(_0x15c8df){if(_0x15c8df){return _0x511711['sendStatus'](_0x10fd7b);}return _0x511711[_0x65b0('0x1a')](_0x10fd7b)[_0x65b0('0x1b')]();};}function respondWithResult(_0x16517d,_0x49ab96){_0x49ab96=_0x49ab96||0xc8;return function(_0x259e66){if(_0x259e66){return _0x16517d['status'](_0x49ab96)[_0x65b0('0x1c')](_0x259e66);}};}function respondWithFilteredResult(_0x2a94ec,_0x2213e2){return function(_0xf199e3){if(_0xf199e3){var _0x30d431=typeof _0x2213e2[_0x65b0('0x1d')]===_0x65b0('0x1e')&&typeof _0x2213e2[_0x65b0('0x1f')]==='undefined';var _0x46dd79=_0xf199e3[_0x65b0('0x20')];var _0x3aa845=_0x30d431?0x0:_0x2213e2['offset'];var _0x39ba83=_0x30d431?_0xf199e3['count']:_0x2213e2[_0x65b0('0x1d')]+_0x2213e2[_0x65b0('0x1f')];var _0x3df050;if(_0x39ba83>=_0x46dd79){_0x39ba83=_0x46dd79;_0x3df050=0xc8;}else{_0x3df050=0xce;}_0x2a94ec[_0x65b0('0x1a')](_0x3df050);return _0x2a94ec['set'](_0x65b0('0x21'),_0x3aa845+'-'+_0x39ba83+'/'+_0x46dd79)[_0x65b0('0x1c')](_0xf199e3);}return null;};}function patchUpdates(_0x59bb89){return function(_0x2a2145){try{jsonpatch[_0x65b0('0x22')](_0x2a2145,_0x59bb89,!![]);}catch(_0x2d2243){return BPromise[_0x65b0('0x23')](_0x2d2243);}return _0x2a2145['save']();};}function saveUpdates(_0x11195b,_0xa8e6ae){return function(_0x1645e0){if(_0x1645e0){return _0x1645e0[_0x65b0('0x24')](_0x11195b)[_0x65b0('0x25')](function(_0x13e7c7){return _0x13e7c7;});}return null;};}function removeEntity(_0x437a67,_0x74185b){return function(_0x57468b){if(_0x57468b){return _0x57468b['destroy']()[_0x65b0('0x25')](function(){_0x437a67[_0x65b0('0x1a')](0xcc)[_0x65b0('0x1b')]();});}};}function handleEntityNotFound(_0x1514ea,_0x21f88a){return function(_0x1a032b){if(!_0x1a032b){_0x1514ea[_0x65b0('0x26')](0x194);}return _0x1a032b;};}function handleError(_0x5dacf9,_0x32c4ff){_0x32c4ff=_0x32c4ff||0x1f4;return function(_0x57925f){logger[_0x65b0('0x27')](_0x57925f[_0x65b0('0x28')]);if(_0x57925f[_0x65b0('0x29')]){delete _0x57925f['name'];}_0x5dacf9['status'](_0x32c4ff)[_0x65b0('0x2a')](_0x57925f);};}exports[_0x65b0('0x2b')]=function(_0x3e0f9d,_0x4cea3e){var _0x47a1b7={},_0x4b135e={},_0x13ef79={'count':0x0,'rows':[]};var _0x4c21f5=_[_0x65b0('0x2c')](db[_0x65b0('0x2d')][_0x65b0('0x2e')],function(_0x7cedd9){return{'name':_0x7cedd9[_0x65b0('0x2f')],'type':_0x7cedd9[_0x65b0('0x30')]['key']};});_0x4b135e[_0x65b0('0x31')]=_['map'](_0x4c21f5,_0x65b0('0x29'));_0x4b135e[_0x65b0('0x32')]=_[_0x65b0('0x33')](_0x3e0f9d['query']);_0x4b135e['filters']=_[_0x65b0('0x34')](_0x4b135e[_0x65b0('0x31')],_0x4b135e['query']);_0x47a1b7[_0x65b0('0x35')]=_[_0x65b0('0x34')](_0x4b135e[_0x65b0('0x31')],qs[_0x65b0('0x36')](_0x3e0f9d[_0x65b0('0x32')][_0x65b0('0x36')]));_0x47a1b7['attributes']=_0x47a1b7[_0x65b0('0x35')][_0x65b0('0x37')]?_0x47a1b7[_0x65b0('0x35')]:_0x4b135e['model'];if(!_0x3e0f9d['query'][_0x65b0('0x38')](_0x65b0('0x39'))){_0x47a1b7[_0x65b0('0x1f')]=qs[_0x65b0('0x1f')](_0x3e0f9d[_0x65b0('0x32')][_0x65b0('0x1f')]);_0x47a1b7['offset']=qs[_0x65b0('0x1d')](_0x3e0f9d[_0x65b0('0x32')][_0x65b0('0x1d')]);}_0x47a1b7[_0x65b0('0x3a')]=qs[_0x65b0('0x3b')](_0x3e0f9d['query'][_0x65b0('0x3b')]);_0x47a1b7[_0x65b0('0x3c')]=qs[_0x65b0('0x3d')](_[_0x65b0('0x3e')](_0x3e0f9d['query'],_0x4b135e[_0x65b0('0x3d')]),_0x4c21f5);if(_0x3e0f9d[_0x65b0('0x32')][_0x65b0('0x3f')]){_0x47a1b7['where']=_[_0x65b0('0x40')](_0x47a1b7['where'],{'$or':_[_0x65b0('0x2c')](_0x4c21f5,function(_0x562adf){if(_0x562adf[_0x65b0('0x30')]!==_0x65b0('0x41')){var _0x25ba8c={};_0x25ba8c[_0x562adf['name']]={'$like':'%'+_0x3e0f9d['query'][_0x65b0('0x3f')]+'%'};return _0x25ba8c;}})});}_0x47a1b7=_[_0x65b0('0x40')]({},_0x47a1b7,_0x3e0f9d['options']);var _0x24a7e4={'where':_0x47a1b7[_0x65b0('0x3c')]};return db[_0x65b0('0x2d')][_0x65b0('0x20')](_0x24a7e4)[_0x65b0('0x25')](function(_0x26ddea){_0x13ef79[_0x65b0('0x20')]=_0x26ddea;if(_0x3e0f9d['query'][_0x65b0('0x42')]){_0x47a1b7[_0x65b0('0x43')]=[{'all':!![]}];}return db[_0x65b0('0x2d')][_0x65b0('0x44')](_0x47a1b7);})[_0x65b0('0x25')](function(_0x5ca239){_0x13ef79[_0x65b0('0x45')]=_0x5ca239;return _0x13ef79;})[_0x65b0('0x25')](respondWithFilteredResult(_0x4cea3e,_0x47a1b7))[_0x65b0('0x46')](handleError(_0x4cea3e,null));};exports['show']=function(_0x40f526,_0x507a57){var _0xd039e1={'raw':!![],'where':{'id':_0x40f526[_0x65b0('0x47')]['id']}},_0x368a87={};_0x368a87[_0x65b0('0x31')]=_['keys'](db[_0x65b0('0x2d')][_0x65b0('0x2e')]);_0x368a87[_0x65b0('0x32')]=_[_0x65b0('0x33')](_0x40f526[_0x65b0('0x32')]);_0x368a87[_0x65b0('0x3d')]=_[_0x65b0('0x34')](_0x368a87['model'],_0x368a87['query']);_0xd039e1[_0x65b0('0x35')]=_[_0x65b0('0x34')](_0x368a87['model'],qs[_0x65b0('0x36')](_0x40f526['query'][_0x65b0('0x36')]));_0xd039e1[_0x65b0('0x35')]=_0xd039e1[_0x65b0('0x35')]['length']?_0xd039e1[_0x65b0('0x35')]:_0x368a87[_0x65b0('0x31')];if(_0x40f526[_0x65b0('0x32')][_0x65b0('0x42')]){_0xd039e1[_0x65b0('0x43')]=[{'all':!![]}];}_0xd039e1=_[_0x65b0('0x40')]({},_0xd039e1,_0x40f526['options']);return db['SquareRecording'][_0x65b0('0x48')](_0xd039e1)[_0x65b0('0x25')](handleEntityNotFound(_0x507a57,null))[_0x65b0('0x25')](respondWithResult(_0x507a57,null))[_0x65b0('0x46')](handleError(_0x507a57,null));};exports['create']=function(_0x4296bd,_0x11fc69){return db[_0x65b0('0x2d')][_0x65b0('0x49')](_0x4296bd[_0x65b0('0x4a')],{})[_0x65b0('0x25')](respondWithResult(_0x11fc69,0xc9))[_0x65b0('0x46')](handleError(_0x11fc69,null));};exports[_0x65b0('0x24')]=function(_0x4b2f03,_0x1ab864){if(_0x4b2f03['body']['id']){delete _0x4b2f03[_0x65b0('0x4a')]['id'];}return db[_0x65b0('0x2d')][_0x65b0('0x48')]({'where':{'id':_0x4b2f03[_0x65b0('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ab864,null))['then'](saveUpdates(_0x4b2f03[_0x65b0('0x4a')],null))['then'](respondWithResult(_0x1ab864,null))[_0x65b0('0x46')](handleError(_0x1ab864,null));};exports[_0x65b0('0x4b')]=function(_0x9f14cb,_0x4ded29,_0x40e345){var _0x39d28a=require('../../components/encryptor');var _0x2996ed=![];var _0xbfb64={};if(_0x9f14cb[_0x65b0('0x32')][_0x65b0('0x30')]&&_0x9f14cb[_0x65b0('0x32')]['type']===_0x65b0('0x4c')){_0xbfb64[_0x65b0('0x4c')]=_0x9f14cb[_0x65b0('0x47')]['id'];}else{_0xbfb64['id']=_0x9f14cb['params']['id'];}return db[_0x65b0('0x2d')][_0x65b0('0x48')]({'where':_0xbfb64,'attributes':['id','savePath',_0x65b0('0x4d')],'raw':!![]})[_0x65b0('0x25')](handleEntityNotFound(_0x4ded29,null))[_0x65b0('0x25')](function(_0xdcba78){if(_0xdcba78){var _0x1796a1=_0xdcba78[_0x65b0('0x4e')];var _0x226ffe=util['format']('%s.cypher',_0x1796a1);if(fs['existsSync'](_0x226ffe)){_0x2996ed=!![];return _0x39d28a[_0x65b0('0x4f')](_0x226ffe,_0x1796a1,config['secrets']['recording'])['then'](function(){return _0xdcba78;});}return _0xdcba78;}})['then'](function(_0x5f318e){if(_0x5f318e){var _0x6a8f9f=_0x5f318e['savePath'];if(!fs[_0x65b0('0x50')](_0x6a8f9f)){throw new db[(_0x65b0('0x51'))][(_0x65b0('0x52'))](_0x65b0('0x53'));}if(_0x5f318e[_0x65b0('0x4d')]){return _0x4ded29[_0x65b0('0x4b')](_0x6a8f9f,_0x5f318e[_0x65b0('0x4d')]+path[_0x65b0('0x54')](_0x6a8f9f),function(){if(_0x2996ed){fs[_0x65b0('0x55')](_0x6a8f9f);}});}else{return _0x4ded29['download'](_0x6a8f9f,function(_0x1bd0df){if(_0x2996ed){fs[_0x65b0('0x55')](_0x6a8f9f);}});}}})['catch'](function(_0x39edc5){if(_0x39edc5[_0x65b0('0x56')]===_0x65b0('0x53')){_0x4ded29[_0x65b0('0x1a')](0x194)[_0x65b0('0x2a')]('Not\x20found');}else{return handleError(_0x4ded29,null);}});};exports[_0x65b0('0x57')]=function(_0xea0eef,_0x493fd4){return db['SquareRecording']['find']({'where':{'id':_0xea0eef['params']['id']}})[_0x65b0('0x25')](function(_0x2f4e5c){if(_[_0x65b0('0x58')](_0x2f4e5c)){throw new ReferenceError(_0x65b0('0x59'));}return _0x2f4e5c;})[_0x65b0('0x25')](function(_0x4893bd){var _0x24cee8=_0x4893bd[_0x65b0('0x4e')];logger['info'](_0x65b0('0x5a'),_0x24cee8);if(!_[_0x65b0('0x58')](_0x4893bd[_0x65b0('0x4e')])&&fs[_0x65b0('0x50')](_0x24cee8)){logger[_0x65b0('0x5b')](_0x65b0('0x5c')+_0x24cee8+_0x65b0('0x5d'));fs[_0x65b0('0x5e')](_0x24cee8);}_0x24cee8=_0x24cee8+_0x65b0('0x5f');if(!_['isNil'](_0x4893bd['savePath'])&&fs[_0x65b0('0x50')](_0x24cee8)){logger[_0x65b0('0x5b')](_0x65b0('0x5c')+_0x24cee8+_0x65b0('0x5d'));fs[_0x65b0('0x5e')](_0x24cee8);}return _0x4893bd;})['then'](function(_0x4acad9){if(!_0x4acad9)throw new InternalError();return _0x4acad9[_0x65b0('0x57')]();})[_0x65b0('0x25')](function(){_0x493fd4[_0x65b0('0x1a')](0xcc)[_0x65b0('0x1b')]();})[_0x65b0('0x46')](handleError(_0x493fd4,null));}; \ No newline at end of file +var _0xc99a=['find','catch','create','body','download','../../components/encryptor','uniqueid','filename','savePath','existsSync','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll'];(function(_0x273b8a,_0x54e3bd){var _0x22577e=function(_0x2e016a){while(--_0x2e016a){_0x273b8a['push'](_0x273b8a['shift']());}};_0x22577e(++_0x54e3bd);}(_0xc99a,0x128));var _0xac99=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc99a[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xac99('0x0'));var rimraf=require(_0xac99('0x1'));var zipdir=require(_0xac99('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac99('0x3'));var moment=require(_0xac99('0x4'));var BPromise=require(_0xac99('0x5'));var Mustache=require(_0xac99('0x6'));var util=require('util');var path=require(_0xac99('0x7'));var sox=require(_0xac99('0x8'));var csv=require(_0xac99('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac99('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xac99('0xb'));var toCsv=require(_0xac99('0x9'));var querystring=require(_0xac99('0xc'));var Papa=require('papaparse');var Redis=require(_0xac99('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xac99('0xe'));var hardwareService=require(_0xac99('0xf'));var logger=require(_0xac99('0x10'))(_0xac99('0x11'));var utils=require('../../config/utils');var config=require(_0xac99('0x12'));var licenseUtil=require(_0xac99('0x13'));var db=require(_0xac99('0x14'))['db'];function respondWithStatusCode(_0x1d61c6,_0x11f48c){_0x11f48c=_0x11f48c||0xcc;return function(_0x551f0c){if(_0x551f0c){return _0x1d61c6[_0xac99('0x15')](_0x11f48c);}return _0x1d61c6[_0xac99('0x16')](_0x11f48c)['end']();};}function respondWithResult(_0x52cd14,_0x2f518a){_0x2f518a=_0x2f518a||0xc8;return function(_0x5dc1f9){if(_0x5dc1f9){return _0x52cd14[_0xac99('0x16')](_0x2f518a)[_0xac99('0x17')](_0x5dc1f9);}};}function respondWithFilteredResult(_0x3befa5,_0x591a64){return function(_0x5cb602){if(_0x5cb602){var _0x4cc2ce=typeof _0x591a64['offset']==='undefined'&&typeof _0x591a64['limit']===_0xac99('0x18');var _0x44d873=_0x5cb602[_0xac99('0x19')];var _0x267845=_0x4cc2ce?0x0:_0x591a64['offset'];var _0x5abccd=_0x4cc2ce?_0x5cb602[_0xac99('0x19')]:_0x591a64[_0xac99('0x1a')]+_0x591a64[_0xac99('0x1b')];var _0xa941c6;if(_0x5abccd>=_0x44d873){_0x5abccd=_0x44d873;_0xa941c6=0xc8;}else{_0xa941c6=0xce;}_0x3befa5['status'](_0xa941c6);return _0x3befa5[_0xac99('0x1c')](_0xac99('0x1d'),_0x267845+'-'+_0x5abccd+'/'+_0x44d873)['json'](_0x5cb602);}return null;};}function patchUpdates(_0x32e317){return function(_0x1e8ee8){try{jsonpatch['apply'](_0x1e8ee8,_0x32e317,!![]);}catch(_0x4bce8c){return BPromise[_0xac99('0x1e')](_0x4bce8c);}return _0x1e8ee8[_0xac99('0x1f')]();};}function saveUpdates(_0xf16651,_0x2eeb31){return function(_0x412678){if(_0x412678){return _0x412678[_0xac99('0x20')](_0xf16651)[_0xac99('0x21')](function(_0x1781e7){return _0x1781e7;});}return null;};}function removeEntity(_0x40fb58,_0x5c96b3){return function(_0x442cd2){if(_0x442cd2){return _0x442cd2['destroy']()['then'](function(){_0x40fb58[_0xac99('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x281e97,_0x1965bd){return function(_0x2bb119){if(!_0x2bb119){_0x281e97[_0xac99('0x15')](0x194);}return _0x2bb119;};}function handleError(_0xc28c5,_0x38948b){_0x38948b=_0x38948b||0x1f4;return function(_0xbd2f36){logger['error'](_0xbd2f36['stack']);if(_0xbd2f36['name']){delete _0xbd2f36[_0xac99('0x22')];}_0xc28c5[_0xac99('0x16')](_0x38948b)[_0xac99('0x23')](_0xbd2f36);};}exports[_0xac99('0x24')]=function(_0x1d3cbc,_0x316297){var _0x36b5ea={},_0x538ae9={},_0x597320={'count':0x0,'rows':[]};var _0xca5a94=_[_0xac99('0x25')](db[_0xac99('0x26')][_0xac99('0x27')],function(_0x4417dd){return{'name':_0x4417dd[_0xac99('0x28')],'type':_0x4417dd['type'][_0xac99('0x29')]};});_0x538ae9[_0xac99('0x2a')]=_['map'](_0xca5a94,_0xac99('0x22'));_0x538ae9['query']=_[_0xac99('0x2b')](_0x1d3cbc[_0xac99('0x2c')]);_0x538ae9[_0xac99('0x2d')]=_[_0xac99('0x2e')](_0x538ae9['model'],_0x538ae9[_0xac99('0x2c')]);_0x36b5ea['attributes']=_[_0xac99('0x2e')](_0x538ae9['model'],qs[_0xac99('0x2f')](_0x1d3cbc[_0xac99('0x2c')][_0xac99('0x2f')]));_0x36b5ea[_0xac99('0x30')]=_0x36b5ea['attributes'][_0xac99('0x31')]?_0x36b5ea[_0xac99('0x30')]:_0x538ae9[_0xac99('0x2a')];if(!_0x1d3cbc[_0xac99('0x2c')][_0xac99('0x32')](_0xac99('0x33'))){_0x36b5ea[_0xac99('0x1b')]=qs[_0xac99('0x1b')](_0x1d3cbc[_0xac99('0x2c')][_0xac99('0x1b')]);_0x36b5ea[_0xac99('0x1a')]=qs['offset'](_0x1d3cbc[_0xac99('0x2c')][_0xac99('0x1a')]);}_0x36b5ea['order']=qs['sort'](_0x1d3cbc[_0xac99('0x2c')][_0xac99('0x34')]);_0x36b5ea[_0xac99('0x35')]=qs[_0xac99('0x2d')](_['pick'](_0x1d3cbc[_0xac99('0x2c')],_0x538ae9[_0xac99('0x2d')]),_0xca5a94);if(_0x1d3cbc[_0xac99('0x2c')][_0xac99('0x36')]){_0x36b5ea[_0xac99('0x35')]=_['merge'](_0x36b5ea['where'],{'$or':_[_0xac99('0x25')](_0xca5a94,function(_0x51fd50){if(_0x51fd50['type']!==_0xac99('0x37')){var _0x2927ed={};_0x2927ed[_0x51fd50[_0xac99('0x22')]]={'$like':'%'+_0x1d3cbc[_0xac99('0x2c')]['filter']+'%'};return _0x2927ed;}})});}_0x36b5ea=_[_0xac99('0x38')]({},_0x36b5ea,_0x1d3cbc[_0xac99('0x39')]);var _0x40155e={'where':_0x36b5ea[_0xac99('0x35')]};return db[_0xac99('0x26')][_0xac99('0x19')](_0x40155e)[_0xac99('0x21')](function(_0x18fb2f){_0x597320[_0xac99('0x19')]=_0x18fb2f;if(_0x1d3cbc[_0xac99('0x2c')]['includeAll']){_0x36b5ea[_0xac99('0x3a')]=[{'all':!![]}];}return db[_0xac99('0x26')][_0xac99('0x3b')](_0x36b5ea);})[_0xac99('0x21')](function(_0x22282e){_0x597320[_0xac99('0x3c')]=_0x22282e;return _0x597320;})[_0xac99('0x21')](respondWithFilteredResult(_0x316297,_0x36b5ea))['catch'](handleError(_0x316297,null));};exports[_0xac99('0x3d')]=function(_0x3d7ae9,_0x4580e9){var _0x55ae4c={'raw':!![],'where':{'id':_0x3d7ae9[_0xac99('0x3e')]['id']}},_0x2d994a={};_0x2d994a[_0xac99('0x2a')]=_[_0xac99('0x2b')](db[_0xac99('0x26')][_0xac99('0x27')]);_0x2d994a[_0xac99('0x2c')]=_[_0xac99('0x2b')](_0x3d7ae9['query']);_0x2d994a[_0xac99('0x2d')]=_['intersection'](_0x2d994a['model'],_0x2d994a[_0xac99('0x2c')]);_0x55ae4c['attributes']=_[_0xac99('0x2e')](_0x2d994a[_0xac99('0x2a')],qs['fields'](_0x3d7ae9[_0xac99('0x2c')][_0xac99('0x2f')]));_0x55ae4c[_0xac99('0x30')]=_0x55ae4c[_0xac99('0x30')][_0xac99('0x31')]?_0x55ae4c[_0xac99('0x30')]:_0x2d994a[_0xac99('0x2a')];if(_0x3d7ae9[_0xac99('0x2c')][_0xac99('0x3f')]){_0x55ae4c[_0xac99('0x3a')]=[{'all':!![]}];}_0x55ae4c=_[_0xac99('0x38')]({},_0x55ae4c,_0x3d7ae9[_0xac99('0x39')]);return db[_0xac99('0x26')][_0xac99('0x40')](_0x55ae4c)[_0xac99('0x21')](handleEntityNotFound(_0x4580e9,null))[_0xac99('0x21')](respondWithResult(_0x4580e9,null))[_0xac99('0x41')](handleError(_0x4580e9,null));};exports[_0xac99('0x42')]=function(_0x342b54,_0x46bc59){return db['SquareRecording'][_0xac99('0x42')](_0x342b54['body'],{})['then'](respondWithResult(_0x46bc59,0xc9))[_0xac99('0x41')](handleError(_0x46bc59,null));};exports[_0xac99('0x20')]=function(_0x527aee,_0x7bd9e3){if(_0x527aee[_0xac99('0x43')]['id']){delete _0x527aee[_0xac99('0x43')]['id'];}return db[_0xac99('0x26')][_0xac99('0x40')]({'where':{'id':_0x527aee['params']['id']}})[_0xac99('0x21')](handleEntityNotFound(_0x7bd9e3,null))[_0xac99('0x21')](saveUpdates(_0x527aee[_0xac99('0x43')],null))[_0xac99('0x21')](respondWithResult(_0x7bd9e3,null))[_0xac99('0x41')](handleError(_0x7bd9e3,null));};exports[_0xac99('0x44')]=function(_0x17b4c9,_0x1cbc3e,_0xe562cb){var _0x4caba2=require(_0xac99('0x45'));var _0x28a037=![];var _0x58a48d={};if(_0x17b4c9[_0xac99('0x2c')]['type']&&_0x17b4c9['query']['type']===_0xac99('0x46')){_0x58a48d[_0xac99('0x46')]=_0x17b4c9[_0xac99('0x3e')]['id'];}else{_0x58a48d['id']=_0x17b4c9['params']['id'];}return db[_0xac99('0x26')][_0xac99('0x40')]({'where':_0x58a48d,'attributes':['id','savePath',_0xac99('0x47')],'raw':!![]})['then'](handleEntityNotFound(_0x1cbc3e,null))[_0xac99('0x21')](function(_0x444a4c){if(_0x444a4c){var _0x28d576=_0x444a4c[_0xac99('0x48')];var _0x513d0e=util['format']('%s.cypher',_0x28d576);if(fs[_0xac99('0x49')](_0x513d0e)){_0x28a037=!![];return _0x4caba2['decryptFile'](_0x513d0e,_0x28d576,config[_0xac99('0x4a')][_0xac99('0x4b')])[_0xac99('0x21')](function(){return _0x444a4c;});}return _0x444a4c;}})[_0xac99('0x21')](function(_0x22bead){if(_0x22bead){var _0x2b5f85=_0x22bead['savePath'];if(!fs[_0xac99('0x49')](_0x2b5f85)){throw new db[(_0xac99('0x4c'))][(_0xac99('0x4d'))](_0xac99('0x4e'));}if(_0x22bead[_0xac99('0x47')]){return _0x1cbc3e[_0xac99('0x44')](_0x2b5f85,_0x22bead[_0xac99('0x47')]+path[_0xac99('0x4f')](_0x2b5f85),function(){if(_0x28a037){fs[_0xac99('0x50')](_0x2b5f85);}});}else{return _0x1cbc3e[_0xac99('0x44')](_0x2b5f85,function(_0x1334ef){if(_0x28a037){fs[_0xac99('0x50')](_0x2b5f85);}});}}})[_0xac99('0x41')](function(_0x5b1629){if(_0x5b1629['message']===_0xac99('0x4e')){_0x1cbc3e[_0xac99('0x16')](0x194)[_0xac99('0x23')](_0xac99('0x51'));}else{return handleError(_0x1cbc3e,null);}});};exports[_0xac99('0x52')]=function(_0x706645,_0x429979){return db['SquareRecording'][_0xac99('0x40')]({'where':{'id':_0x706645[_0xac99('0x3e')]['id']}})['then'](function(_0x121678){if(_[_0xac99('0x53')](_0x121678)){throw new ReferenceError(_0xac99('0x54'));}return _0x121678;})['then'](function(_0x11645a){var _0x38089a=_0x11645a[_0xac99('0x48')];logger[_0xac99('0x55')](_0xac99('0x56'),_0x38089a);if(!_['isNil'](_0x11645a[_0xac99('0x48')])&&fs[_0xac99('0x49')](_0x38089a)){logger[_0xac99('0x55')](_0xac99('0x57')+_0x38089a+_0xac99('0x58'));fs['unlinkSync'](_0x38089a);}_0x38089a=_0x38089a+_0xac99('0x59');if(!_[_0xac99('0x53')](_0x11645a[_0xac99('0x48')])&&fs[_0xac99('0x49')](_0x38089a)){logger[_0xac99('0x55')]('File:\x20\x22'+_0x38089a+_0xac99('0x58'));fs['unlinkSync'](_0x38089a);}return _0x11645a;})[_0xac99('0x21')](function(_0x30979c){if(!_0x30979c)throw new InternalError();return _0x30979c[_0xac99('0x52')]();})['then'](function(){_0x429979['status'](0xcc)['end']();})[_0xac99('0x41')](handleError(_0x429979,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 1a07d2e..d5f14b7 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 _0xcd0e=['path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4fddd2,_0xfd454f){var _0x233faa=function(_0x355ad4){while(--_0x355ad4){_0x4fddd2['push'](_0x4fddd2['shift']());}};_0x233faa(++_0xfd454f);}(_0xcd0e,0xe9));var _0xecd0=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0xcd0e[_0x37a79c];return _0x561d89;};'use strict';var _=require(_0xecd0('0x0'));var util=require(_0xecd0('0x1'));var logger=require(_0xecd0('0x2'))(_0xecd0('0x3'));var moment=require(_0xecd0('0x4'));var BPromise=require(_0xecd0('0x5'));var rp=require(_0xecd0('0x6'));var fs=require('fs');var path=require(_0xecd0('0x7'));var rimraf=require(_0xecd0('0x8'));var config=require(_0xecd0('0x9'));var attributes=require(_0xecd0('0xa'));module[_0xecd0('0xb')]=function(_0x3390ea,_0x2def27){return _0x3390ea[_0xecd0('0xc')](_0xecd0('0xd'),attributes,{'tableName':_0xecd0('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc61d=['exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./squareRecording.attributes'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc61d,0xfb));var _0xdc61=function(_0x1a7edf,_0x5c4e04){_0x1a7edf=_0x1a7edf-0x0;var _0x56c1d9=_0xc61d[_0x1a7edf];return _0x56c1d9;};'use strict';var _=require(_0xdc61('0x0'));var util=require(_0xdc61('0x1'));var logger=require(_0xdc61('0x2'))(_0xdc61('0x3'));var moment=require(_0xdc61('0x4'));var BPromise=require(_0xdc61('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc61('0x6'));var rimraf=require(_0xdc61('0x7'));var config=require('../../config/environment');var attributes=require(_0xdc61('0x8'));module[_0xdc61('0x9')]=function(_0xf7834c,_0x20eef5){return _0xf7834c[_0xdc61('0xa')](_0xdc61('0xb'),attributes,{'tableName':_0xdc61('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 9201b4b..9d13c10 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 _0x1167=['error','code','message','info','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x26dff5,_0x3ee0a3){var _0x1aa558=function(_0x5d9c72){while(--_0x5d9c72){_0x26dff5['push'](_0x26dff5['shift']());}};_0x1aa558(++_0x3ee0a3);}(_0x1167,0x15e));var _0x7116=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x1167[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x7116('0x0'));var util=require(_0x7116('0x1'));var moment=require(_0x7116('0x2'));var BPromise=require(_0x7116('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7116('0x4'));var db=require(_0x7116('0x5'))['db'];var utils=require(_0x7116('0x6'));var logger=require('../../config/logger')(_0x7116('0x7'));var config=require('../../config/environment');var jayson=require(_0x7116('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3fcd53,_0x1b8e73,_0x18f5a5){return new BPromise(function(_0x2de7fe,_0x5d722){return client['request'](_0x3fcd53,_0x18f5a5)[_0x7116('0x9')](function(_0x3611dd){logger['info'](_0x7116('0xa'),_0x1b8e73,_0x7116('0xb'));logger[_0x7116('0xc')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x1b8e73,_0x7116('0xb'),JSON[_0x7116('0xd')](_0x3611dd));if(_0x3611dd[_0x7116('0xe')]){if(_0x3611dd[_0x7116('0xe')][_0x7116('0xf')]===0x1f4){logger[_0x7116('0xe')](_0x7116('0xa'),_0x1b8e73,_0x3611dd[_0x7116('0xe')][_0x7116('0x10')]);return _0x5d722(_0x3611dd['error'][_0x7116('0x10')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x1b8e73,_0x3611dd['error']['message']);return _0x2de7fe(_0x3611dd['error'][_0x7116('0x10')]);}else{logger[_0x7116('0x11')](_0x7116('0xa'),_0x1b8e73,_0x7116('0xb'));_0x2de7fe(_0x3611dd[_0x7116('0x12')]['message']);}})[_0x7116('0x13')](function(_0x1c6aec){logger[_0x7116('0xe')](_0x7116('0xa'),_0x1b8e73,_0x1c6aec);_0x5d722(_0x1c6aec);});});}exports['CreateSquareRecording']=function(_0x10f953){var _0x88aa81=this;return new Promise(function(_0x5532e2,_0x18f77a){return db[_0x7116('0x14')][_0x7116('0x15')](_0x10f953[_0x7116('0x16')],{'raw':_0x10f953[_0x7116('0x17')]?_0x10f953[_0x7116('0x17')][_0x7116('0x18')]===undefined?!![]:![]:!![]})[_0x7116('0x9')](function(_0x1e4605){logger[_0x7116('0x11')](_0x7116('0x19'),_0x10f953);logger[_0x7116('0xc')](_0x7116('0x19'),_0x10f953,JSON[_0x7116('0xd')](_0x1e4605));_0x5532e2(_0x1e4605);})['catch'](function(_0x49e77f){logger[_0x7116('0xe')]('CreateSquareRecording',_0x49e77f[_0x7116('0x10')],_0x10f953);_0x18f77a(_0x88aa81['error'](0x1f4,_0x49e77f[_0x7116('0x10')]));});});}; \ No newline at end of file +var _0x93f9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','options','raw','CreateSquareRecording'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x93f9,0x188));var _0x993f=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x93f9[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x993f('0x0'));var util=require(_0x993f('0x1'));var moment=require(_0x993f('0x2'));var BPromise=require(_0x993f('0x3'));var rs=require(_0x993f('0x4'));var fs=require('fs');var Redis=require(_0x993f('0x5'));var db=require(_0x993f('0x6'))['db'];var utils=require(_0x993f('0x7'));var logger=require(_0x993f('0x8'))(_0x993f('0x9'));var config=require(_0x993f('0xa'));var jayson=require(_0x993f('0xb'));var client=jayson[_0x993f('0xc')][_0x993f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1b5047,_0xcd073e,_0x5927dd){return new BPromise(function(_0x4f6f78,_0x1a29de){return client['request'](_0x1b5047,_0x5927dd)[_0x993f('0xe')](function(_0x1be722){logger[_0x993f('0xf')](_0x993f('0x10'),_0xcd073e,_0x993f('0x11'));logger[_0x993f('0x12')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0xcd073e,_0x993f('0x11'),JSON[_0x993f('0x13')](_0x1be722));if(_0x1be722['error']){if(_0x1be722[_0x993f('0x14')][_0x993f('0x15')]===0x1f4){logger['error'](_0x993f('0x10'),_0xcd073e,_0x1be722['error'][_0x993f('0x16')]);return _0x1a29de(_0x1be722[_0x993f('0x14')][_0x993f('0x16')]);}logger['error'](_0x993f('0x10'),_0xcd073e,_0x1be722[_0x993f('0x14')][_0x993f('0x16')]);return _0x4f6f78(_0x1be722['error'][_0x993f('0x16')]);}else{logger[_0x993f('0xf')](_0x993f('0x10'),_0xcd073e,_0x993f('0x11'));_0x4f6f78(_0x1be722[_0x993f('0x17')]['message']);}})[_0x993f('0x18')](function(_0x3a2afd){logger['error'](_0x993f('0x10'),_0xcd073e,_0x3a2afd);_0x1a29de(_0x3a2afd);});});}exports['CreateSquareRecording']=function(_0x42010b){var _0x1eb7a1=this;return new Promise(function(_0x5e3cce,_0x560a39){return db['SquareRecording']['create'](_0x42010b['body'],{'raw':_0x42010b['options']?_0x42010b[_0x993f('0x19')][_0x993f('0x1a')]===undefined?!![]:![]:!![]})[_0x993f('0xe')](function(_0x4846d4){logger['info']('CreateSquareRecording',_0x42010b);logger[_0x993f('0x12')](_0x993f('0x1b'),_0x42010b,JSON[_0x993f('0x13')](_0x4846d4));_0x5e3cce(_0x4846d4);})['catch'](function(_0x3cbd77){logger[_0x993f('0x14')](_0x993f('0x1b'),_0x3cbd77['message'],_0x42010b);_0x560a39(_0x1eb7a1[_0x993f('0x14')](0x1f4,_0x3cbd77['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 1846fa3..0ee51e9 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(_0x3a7368,_0x185789){var _0x1aa883=function(_0x41b7b6){while(--_0x41b7b6){_0x3a7368['push'](_0x3a7368['shift']());}};_0x1aa883(++_0x185789);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./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 _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(_0x7feb90,_0x28e700){var _0x3c5b33=function(_0x113cfa){while(--_0x113cfa){_0x7feb90['push'](_0x7feb90['shift']());}};_0x3c5b33(++_0x28e700);}(_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 diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 3e9325c..a5f00a7 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 _0xfaba=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x5c356f,_0x4f9ff1){var _0x1a2b2b=function(_0x545c02){while(--_0x545c02){_0x5c356f['push'](_0x5c356f['shift']());}};_0x1a2b2b(++_0x4f9ff1);}(_0xfaba,0x168));var _0xafab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaba[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xafab('0x0'));module[_0xafab('0x1')]={'network':{'type':Sequelize[_0xafab('0x2')]},'network_script':{'type':Sequelize[_0xafab('0x2')]},'request':{'type':Sequelize[_0xafab('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xafab('0x2')]},'type':{'type':Sequelize[_0xafab('0x2')]},'uniqueid':{'type':Sequelize[_0xafab('0x2')]},'version':{'type':Sequelize[_0xafab('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xafab('0x2')]},'callingpres':{'type':Sequelize[_0xafab('0x2')]},'callingani2':{'type':Sequelize[_0xafab('0x2')]},'callington':{'type':Sequelize[_0xafab('0x2')]},'callingtns':{'type':Sequelize[_0xafab('0x2')]},'dnid':{'type':Sequelize[_0xafab('0x2')]},'rdnis':{'type':Sequelize[_0xafab('0x2')]},'context':{'type':Sequelize[_0xafab('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xafab('0x2')]},'enhanced':{'type':Sequelize[_0xafab('0x2')]},'accountcode':{'type':Sequelize[_0xafab('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xafab('0x2')]},'joinAt':{'type':Sequelize[_0xafab('0x3')]},'leaveAt':{'type':Sequelize[_0xafab('0x3')]},'bot':{'type':Sequelize[_0xafab('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x31c5=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x31c5,0x1c7));var _0x531c=function(_0x5c625f,_0x23c69e){_0x5c625f=_0x5c625f-0x0;var _0x52c171=_0x31c5[_0x5c625f];return _0x52c171;};'use strict';var Sequelize=require(_0x531c('0x0'));module['exports']={'network':{'type':Sequelize[_0x531c('0x1')]},'network_script':{'type':Sequelize[_0x531c('0x1')]},'request':{'type':Sequelize[_0x531c('0x1')]},'channel':{'type':Sequelize[_0x531c('0x1')]},'language':{'type':Sequelize[_0x531c('0x1')]},'type':{'type':Sequelize[_0x531c('0x1')]},'uniqueid':{'type':Sequelize[_0x531c('0x1')]},'version':{'type':Sequelize[_0x531c('0x1')]},'callerid':{'type':Sequelize[_0x531c('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x531c('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x531c('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x531c('0x1')]},'enhanced':{'type':Sequelize[_0x531c('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x531c('0x1')]},'project_name':{'type':Sequelize[_0x531c('0x1')]},'joinAt':{'type':Sequelize[_0x531c('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x531c('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 9df1e9d..913d06f 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 _0x04cf=['mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','end','json','limit','undefined','offset','count','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1b5223,_0x4751b9){var _0x525c25=function(_0x57fc3b){while(--_0x57fc3b){_0x1b5223['push'](_0x1b5223['shift']());}};_0x525c25(++_0x4751b9);}(_0x04cf,0xf2));var _0xf04c=function(_0x5ada87,_0x2877b9){_0x5ada87=_0x5ada87-0x0;var _0x12d083=_0x04cf[_0x5ada87];return _0x12d083;};'use strict';var emlformat=require(_0xf04c('0x0'));var rimraf=require(_0xf04c('0x1'));var zipdir=require(_0xf04c('0x2'));var jsonpatch=require(_0xf04c('0x3'));var rp=require(_0xf04c('0x4'));var moment=require(_0xf04c('0x5'));var BPromise=require(_0xf04c('0x6'));var Mustache=require(_0xf04c('0x7'));var util=require(_0xf04c('0x8'));var path=require(_0xf04c('0x9'));var sox=require(_0xf04c('0xa'));var csv=require('to-csv');var ejs=require(_0xf04c('0xb'));var fs=require('fs');var fs_extra=require(_0xf04c('0xc'));var _=require(_0xf04c('0xd'));var squel=require('squel');var crypto=require(_0xf04c('0xe'));var jsforce=require(_0xf04c('0xf'));var deskjs=require(_0xf04c('0x10'));var toCsv=require(_0xf04c('0x11'));var querystring=require('querystring');var Papa=require(_0xf04c('0x12'));var Redis=require(_0xf04c('0x13'));var authService=require(_0xf04c('0x14'));var qs=require(_0xf04c('0x15'));var as=require(_0xf04c('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf04c('0x17'));var utils=require(_0xf04c('0x18'));var config=require(_0xf04c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xf04c('0x1a'))['db'];function respondWithStatusCode(_0x1152c6,_0x24f049){_0x24f049=_0x24f049||0xcc;return function(_0x2883d9){if(_0x2883d9){return _0x1152c6['sendStatus'](_0x24f049);}return _0x1152c6['status'](_0x24f049)[_0xf04c('0x1b')]();};}function respondWithResult(_0x30dc8f,_0x45e33d){_0x45e33d=_0x45e33d||0xc8;return function(_0x44cd8f){if(_0x44cd8f){return _0x30dc8f['status'](_0x45e33d)[_0xf04c('0x1c')](_0x44cd8f);}};}function respondWithFilteredResult(_0x8b9d18,_0x29f827){return function(_0x4d7326){if(_0x4d7326){var _0xf9b535=typeof _0x29f827['offset']==='undefined'&&typeof _0x29f827[_0xf04c('0x1d')]===_0xf04c('0x1e');var _0x41b44a=_0x4d7326['count'];var _0x346499=_0xf9b535?0x0:_0x29f827[_0xf04c('0x1f')];var _0x11f19a=_0xf9b535?_0x4d7326[_0xf04c('0x20')]:_0x29f827['offset']+_0x29f827[_0xf04c('0x1d')];var _0x3a2738;if(_0x11f19a>=_0x41b44a){_0x11f19a=_0x41b44a;_0x3a2738=0xc8;}else{_0x3a2738=0xce;}_0x8b9d18[_0xf04c('0x21')](_0x3a2738);return _0x8b9d18[_0xf04c('0x22')](_0xf04c('0x23'),_0x346499+'-'+_0x11f19a+'/'+_0x41b44a)['json'](_0x4d7326);}return null;};}function patchUpdates(_0x1e28d4){return function(_0x5e5006){try{jsonpatch[_0xf04c('0x24')](_0x5e5006,_0x1e28d4,!![]);}catch(_0x320320){return BPromise[_0xf04c('0x25')](_0x320320);}return _0x5e5006[_0xf04c('0x26')]();};}function saveUpdates(_0x21f343,_0x12fba4){return function(_0x4b8192){if(_0x4b8192){return _0x4b8192[_0xf04c('0x27')](_0x21f343)[_0xf04c('0x28')](function(_0x4fedaf){return _0x4fedaf;});}return null;};}function removeEntity(_0x55ce74,_0x10b7e4){return function(_0x278706){if(_0x278706){return _0x278706[_0xf04c('0x29')]()[_0xf04c('0x28')](function(){_0x55ce74[_0xf04c('0x21')](0xcc)[_0xf04c('0x1b')]();});}};}function handleEntityNotFound(_0x48405c,_0x483fc8){return function(_0x1f5ab4){if(!_0x1f5ab4){_0x48405c[_0xf04c('0x2a')](0x194);}return _0x1f5ab4;};}function handleError(_0x3ab545,_0x273b62){_0x273b62=_0x273b62||0x1f4;return function(_0x672da2){logger[_0xf04c('0x2b')](_0x672da2[_0xf04c('0x2c')]);if(_0x672da2[_0xf04c('0x2d')]){delete _0x672da2['name'];}_0x3ab545[_0xf04c('0x21')](_0x273b62)[_0xf04c('0x2e')](_0x672da2);};}exports[_0xf04c('0x2f')]=function(_0x34adcb,_0xfcf3c6){var _0x3de853={},_0x7dccf={},_0x417d2d={'count':0x0,'rows':[]};var _0x1c511e=_[_0xf04c('0x30')](db[_0xf04c('0x31')][_0xf04c('0x32')],function(_0x334633){return{'name':_0x334633[_0xf04c('0x33')],'type':_0x334633[_0xf04c('0x34')][_0xf04c('0x35')]};});_0x7dccf['model']=_['map'](_0x1c511e,_0xf04c('0x2d'));_0x7dccf['query']=_[_0xf04c('0x36')](_0x34adcb[_0xf04c('0x37')]);_0x7dccf[_0xf04c('0x38')]=_[_0xf04c('0x39')](_0x7dccf[_0xf04c('0x3a')],_0x7dccf[_0xf04c('0x37')]);_0x3de853[_0xf04c('0x3b')]=_['intersection'](_0x7dccf[_0xf04c('0x3a')],qs[_0xf04c('0x3c')](_0x34adcb['query'][_0xf04c('0x3c')]));_0x3de853[_0xf04c('0x3b')]=_0x3de853[_0xf04c('0x3b')][_0xf04c('0x3d')]?_0x3de853[_0xf04c('0x3b')]:_0x7dccf[_0xf04c('0x3a')];if(!_0x34adcb[_0xf04c('0x37')][_0xf04c('0x3e')](_0xf04c('0x3f'))){_0x3de853[_0xf04c('0x1d')]=qs['limit'](_0x34adcb['query'][_0xf04c('0x1d')]);_0x3de853[_0xf04c('0x1f')]=qs[_0xf04c('0x1f')](_0x34adcb[_0xf04c('0x37')][_0xf04c('0x1f')]);}_0x3de853[_0xf04c('0x40')]=qs[_0xf04c('0x41')](_0x34adcb['query'][_0xf04c('0x41')]);_0x3de853['where']=qs[_0xf04c('0x38')](_[_0xf04c('0x42')](_0x34adcb['query'],_0x7dccf[_0xf04c('0x38')]),_0x1c511e);if(_0x34adcb['query'][_0xf04c('0x43')]){_0x3de853[_0xf04c('0x44')]=_[_0xf04c('0x45')](_0x3de853['where'],{'$or':_[_0xf04c('0x30')](_0x1c511e,function(_0x28d878){if(_0x28d878['type']!==_0xf04c('0x46')){var _0x3c7ec2={};_0x3c7ec2[_0x28d878[_0xf04c('0x2d')]]={'$like':'%'+_0x34adcb['query'][_0xf04c('0x43')]+'%'};return _0x3c7ec2;}})});}_0x3de853=_[_0xf04c('0x45')]({},_0x3de853,_0x34adcb[_0xf04c('0x47')]);var _0x24e0bb={'where':_0x3de853['where']};return db[_0xf04c('0x31')][_0xf04c('0x20')](_0x24e0bb)[_0xf04c('0x28')](function(_0x256cdb){_0x417d2d['count']=_0x256cdb;if(_0x34adcb[_0xf04c('0x37')][_0xf04c('0x48')]){_0x3de853[_0xf04c('0x49')]=[{'all':!![]}];}return db['SquareReport'][_0xf04c('0x4a')](_0x3de853);})[_0xf04c('0x28')](function(_0x2b4d69){_0x417d2d[_0xf04c('0x4b')]=_0x2b4d69;return _0x417d2d;})[_0xf04c('0x28')](respondWithFilteredResult(_0xfcf3c6,_0x3de853))[_0xf04c('0x4c')](handleError(_0xfcf3c6,null));};exports[_0xf04c('0x4d')]=function(_0x3c00d7,_0x2158c4){var _0x358def={'raw':!![],'where':{'id':_0x3c00d7[_0xf04c('0x4e')]['id']}},_0x4a1926={};_0x4a1926[_0xf04c('0x3a')]=_[_0xf04c('0x36')](db['SquareReport'][_0xf04c('0x32')]);_0x4a1926[_0xf04c('0x37')]=_[_0xf04c('0x36')](_0x3c00d7[_0xf04c('0x37')]);_0x4a1926[_0xf04c('0x38')]=_[_0xf04c('0x39')](_0x4a1926[_0xf04c('0x3a')],_0x4a1926[_0xf04c('0x37')]);_0x358def[_0xf04c('0x3b')]=_[_0xf04c('0x39')](_0x4a1926[_0xf04c('0x3a')],qs[_0xf04c('0x3c')](_0x3c00d7['query'][_0xf04c('0x3c')]));_0x358def[_0xf04c('0x3b')]=_0x358def['attributes'][_0xf04c('0x3d')]?_0x358def[_0xf04c('0x3b')]:_0x4a1926['model'];if(_0x3c00d7[_0xf04c('0x37')]['includeAll']){_0x358def['include']=[{'all':!![]}];}_0x358def=_['merge']({},_0x358def,_0x3c00d7[_0xf04c('0x47')]);return db[_0xf04c('0x31')][_0xf04c('0x4f')](_0x358def)[_0xf04c('0x28')](handleEntityNotFound(_0x2158c4,null))[_0xf04c('0x28')](respondWithResult(_0x2158c4,null))[_0xf04c('0x4c')](handleError(_0x2158c4,null));};exports[_0xf04c('0x50')]=function(_0x1dbc83,_0x11b30d){return db[_0xf04c('0x31')][_0xf04c('0x50')](_0x1dbc83[_0xf04c('0x51')],{})[_0xf04c('0x28')](respondWithResult(_0x11b30d,0xc9))[_0xf04c('0x4c')](handleError(_0x11b30d,null));};exports[_0xf04c('0x27')]=function(_0xb49aa8,_0x2a7904){if(_0xb49aa8[_0xf04c('0x51')]['id']){delete _0xb49aa8[_0xf04c('0x51')]['id'];}return db[_0xf04c('0x31')][_0xf04c('0x4f')]({'where':{'id':_0xb49aa8[_0xf04c('0x4e')]['id']}})[_0xf04c('0x28')](handleEntityNotFound(_0x2a7904,null))[_0xf04c('0x28')](saveUpdates(_0xb49aa8['body'],null))[_0xf04c('0x28')](respondWithResult(_0x2a7904,null))['catch'](handleError(_0x2a7904,null));};exports[_0xf04c('0x29')]=function(_0x198ae4,_0x1a17ab){return db[_0xf04c('0x31')]['find']({'where':{'id':_0x198ae4[_0xf04c('0x4e')]['id']}})[_0xf04c('0x28')](handleEntityNotFound(_0x1a17ab,null))[_0xf04c('0x28')](removeEntity(_0x1a17ab,null))[_0xf04c('0x4c')](handleError(_0x1a17ab,null));};exports[_0xf04c('0x52')]=function(_0x33266a,_0x137dfe){return db[_0xf04c('0x31')]['describe']()[_0xf04c('0x28')](respondWithResult(_0x137dfe,null))[_0xf04c('0x4c')](handleError(_0x137dfe,null));}; \ No newline at end of file +var _0xd1e5=['api','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x51aa5b,_0x512fc0){var _0x5066d8=function(_0x2bdda9){while(--_0x2bdda9){_0x51aa5b['push'](_0x51aa5b['shift']());}};_0x5066d8(++_0x512fc0);}(_0xd1e5,0xd9));var _0x5d1e=function(_0x386959,_0x318d69){_0x386959=_0x386959-0x0;var _0x4f7a17=_0xd1e5[_0x386959];return _0x4f7a17;};'use strict';var emlformat=require(_0x5d1e('0x0'));var rimraf=require(_0x5d1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d1e('0x2'));var rp=require('request-promise');var moment=require(_0x5d1e('0x3'));var BPromise=require(_0x5d1e('0x4'));var Mustache=require(_0x5d1e('0x5'));var util=require(_0x5d1e('0x6'));var path=require(_0x5d1e('0x7'));var sox=require(_0x5d1e('0x8'));var csv=require('to-csv');var ejs=require(_0x5d1e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5d1e('0xa'));var squel=require(_0x5d1e('0xb'));var crypto=require('crypto');var jsforce=require(_0x5d1e('0xc'));var deskjs=require(_0x5d1e('0xd'));var toCsv=require(_0x5d1e('0xe'));var querystring=require(_0x5d1e('0xf'));var Papa=require(_0x5d1e('0x10'));var Redis=require(_0x5d1e('0x11'));var authService=require(_0x5d1e('0x12'));var qs=require(_0x5d1e('0x13'));var as=require(_0x5d1e('0x14'));var hardwareService=require(_0x5d1e('0x15'));var logger=require(_0x5d1e('0x16'))(_0x5d1e('0x17'));var utils=require('../../config/utils');var config=require(_0x5d1e('0x18'));var licenseUtil=require(_0x5d1e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1841cf,_0x528eb1){_0x528eb1=_0x528eb1||0xcc;return function(_0x23aaae){if(_0x23aaae){return _0x1841cf[_0x5d1e('0x1a')](_0x528eb1);}return _0x1841cf[_0x5d1e('0x1b')](_0x528eb1)['end']();};}function respondWithResult(_0x21f964,_0x4b3fe9){_0x4b3fe9=_0x4b3fe9||0xc8;return function(_0x356277){if(_0x356277){return _0x21f964[_0x5d1e('0x1b')](_0x4b3fe9)['json'](_0x356277);}};}function respondWithFilteredResult(_0x5b50c2,_0x241803){return function(_0x25f435){if(_0x25f435){var _0x140584=typeof _0x241803[_0x5d1e('0x1c')]==='undefined'&&typeof _0x241803[_0x5d1e('0x1d')]===_0x5d1e('0x1e');var _0x12cee8=_0x25f435[_0x5d1e('0x1f')];var _0x41ab6a=_0x140584?0x0:_0x241803['offset'];var _0x493bcf=_0x140584?_0x25f435[_0x5d1e('0x1f')]:_0x241803[_0x5d1e('0x1c')]+_0x241803[_0x5d1e('0x1d')];var _0x36e4a6;if(_0x493bcf>=_0x12cee8){_0x493bcf=_0x12cee8;_0x36e4a6=0xc8;}else{_0x36e4a6=0xce;}_0x5b50c2['status'](_0x36e4a6);return _0x5b50c2[_0x5d1e('0x20')](_0x5d1e('0x21'),_0x41ab6a+'-'+_0x493bcf+'/'+_0x12cee8)[_0x5d1e('0x22')](_0x25f435);}return null;};}function patchUpdates(_0x52bd51){return function(_0x45ff06){try{jsonpatch[_0x5d1e('0x23')](_0x45ff06,_0x52bd51,!![]);}catch(_0x18126d){return BPromise[_0x5d1e('0x24')](_0x18126d);}return _0x45ff06[_0x5d1e('0x25')]();};}function saveUpdates(_0x3fcffb,_0x4ad6ab){return function(_0x6f19d8){if(_0x6f19d8){return _0x6f19d8[_0x5d1e('0x26')](_0x3fcffb)[_0x5d1e('0x27')](function(_0x132977){return _0x132977;});}return null;};}function removeEntity(_0x1597ba,_0x36cbfc){return function(_0x2df0f1){if(_0x2df0f1){return _0x2df0f1[_0x5d1e('0x28')]()[_0x5d1e('0x27')](function(){_0x1597ba[_0x5d1e('0x1b')](0xcc)[_0x5d1e('0x29')]();});}};}function handleEntityNotFound(_0x351fe3,_0x4bdccd){return function(_0x1f17f6){if(!_0x1f17f6){_0x351fe3[_0x5d1e('0x1a')](0x194);}return _0x1f17f6;};}function handleError(_0x409705,_0x43c434){_0x43c434=_0x43c434||0x1f4;return function(_0x4260ac){logger[_0x5d1e('0x2a')](_0x4260ac[_0x5d1e('0x2b')]);if(_0x4260ac[_0x5d1e('0x2c')]){delete _0x4260ac[_0x5d1e('0x2c')];}_0x409705['status'](_0x43c434)[_0x5d1e('0x2d')](_0x4260ac);};}exports['index']=function(_0x449c4c,_0x1ecec5){var _0x254a3c={},_0x4f56fa={},_0x508fc3={'count':0x0,'rows':[]};var _0x2d013c=_[_0x5d1e('0x2e')](db[_0x5d1e('0x2f')][_0x5d1e('0x30')],function(_0x2e3108){return{'name':_0x2e3108[_0x5d1e('0x31')],'type':_0x2e3108[_0x5d1e('0x32')][_0x5d1e('0x33')]};});_0x4f56fa[_0x5d1e('0x34')]=_[_0x5d1e('0x2e')](_0x2d013c,_0x5d1e('0x2c'));_0x4f56fa[_0x5d1e('0x35')]=_[_0x5d1e('0x36')](_0x449c4c[_0x5d1e('0x35')]);_0x4f56fa[_0x5d1e('0x37')]=_[_0x5d1e('0x38')](_0x4f56fa[_0x5d1e('0x34')],_0x4f56fa[_0x5d1e('0x35')]);_0x254a3c[_0x5d1e('0x39')]=_['intersection'](_0x4f56fa[_0x5d1e('0x34')],qs[_0x5d1e('0x3a')](_0x449c4c[_0x5d1e('0x35')][_0x5d1e('0x3a')]));_0x254a3c[_0x5d1e('0x39')]=_0x254a3c[_0x5d1e('0x39')]['length']?_0x254a3c['attributes']:_0x4f56fa[_0x5d1e('0x34')];if(!_0x449c4c[_0x5d1e('0x35')][_0x5d1e('0x3b')](_0x5d1e('0x3c'))){_0x254a3c['limit']=qs[_0x5d1e('0x1d')](_0x449c4c[_0x5d1e('0x35')][_0x5d1e('0x1d')]);_0x254a3c[_0x5d1e('0x1c')]=qs[_0x5d1e('0x1c')](_0x449c4c[_0x5d1e('0x35')][_0x5d1e('0x1c')]);}_0x254a3c[_0x5d1e('0x3d')]=qs[_0x5d1e('0x3e')](_0x449c4c[_0x5d1e('0x35')][_0x5d1e('0x3e')]);_0x254a3c[_0x5d1e('0x3f')]=qs[_0x5d1e('0x37')](_[_0x5d1e('0x40')](_0x449c4c['query'],_0x4f56fa[_0x5d1e('0x37')]),_0x2d013c);if(_0x449c4c[_0x5d1e('0x35')]['filter']){_0x254a3c['where']=_[_0x5d1e('0x41')](_0x254a3c[_0x5d1e('0x3f')],{'$or':_['map'](_0x2d013c,function(_0x289a8c){if(_0x289a8c[_0x5d1e('0x32')]!==_0x5d1e('0x42')){var _0x2c60ba={};_0x2c60ba[_0x289a8c[_0x5d1e('0x2c')]]={'$like':'%'+_0x449c4c['query'][_0x5d1e('0x43')]+'%'};return _0x2c60ba;}})});}_0x254a3c=_[_0x5d1e('0x41')]({},_0x254a3c,_0x449c4c['options']);var _0x2891a2={'where':_0x254a3c[_0x5d1e('0x3f')]};return db[_0x5d1e('0x2f')]['count'](_0x2891a2)[_0x5d1e('0x27')](function(_0x5c6da5){_0x508fc3[_0x5d1e('0x1f')]=_0x5c6da5;if(_0x449c4c[_0x5d1e('0x35')][_0x5d1e('0x44')]){_0x254a3c['include']=[{'all':!![]}];}return db[_0x5d1e('0x2f')][_0x5d1e('0x45')](_0x254a3c);})['then'](function(_0x2e0d56){_0x508fc3[_0x5d1e('0x46')]=_0x2e0d56;return _0x508fc3;})[_0x5d1e('0x27')](respondWithFilteredResult(_0x1ecec5,_0x254a3c))[_0x5d1e('0x47')](handleError(_0x1ecec5,null));};exports[_0x5d1e('0x48')]=function(_0x52cfce,_0x200a82){var _0x2fb9d6={'raw':!![],'where':{'id':_0x52cfce[_0x5d1e('0x49')]['id']}},_0x4bd3c6={};_0x4bd3c6[_0x5d1e('0x34')]=_[_0x5d1e('0x36')](db[_0x5d1e('0x2f')][_0x5d1e('0x30')]);_0x4bd3c6['query']=_[_0x5d1e('0x36')](_0x52cfce[_0x5d1e('0x35')]);_0x4bd3c6[_0x5d1e('0x37')]=_[_0x5d1e('0x38')](_0x4bd3c6[_0x5d1e('0x34')],_0x4bd3c6[_0x5d1e('0x35')]);_0x2fb9d6['attributes']=_[_0x5d1e('0x38')](_0x4bd3c6[_0x5d1e('0x34')],qs[_0x5d1e('0x3a')](_0x52cfce[_0x5d1e('0x35')][_0x5d1e('0x3a')]));_0x2fb9d6['attributes']=_0x2fb9d6[_0x5d1e('0x39')][_0x5d1e('0x4a')]?_0x2fb9d6['attributes']:_0x4bd3c6[_0x5d1e('0x34')];if(_0x52cfce['query'][_0x5d1e('0x44')]){_0x2fb9d6[_0x5d1e('0x4b')]=[{'all':!![]}];}_0x2fb9d6=_[_0x5d1e('0x41')]({},_0x2fb9d6,_0x52cfce['options']);return db['SquareReport']['find'](_0x2fb9d6)['then'](handleEntityNotFound(_0x200a82,null))[_0x5d1e('0x27')](respondWithResult(_0x200a82,null))['catch'](handleError(_0x200a82,null));};exports[_0x5d1e('0x4c')]=function(_0x4083c8,_0x24cc1c){return db['SquareReport']['create'](_0x4083c8['body'],{})[_0x5d1e('0x27')](respondWithResult(_0x24cc1c,0xc9))[_0x5d1e('0x47')](handleError(_0x24cc1c,null));};exports[_0x5d1e('0x26')]=function(_0x58bc2a,_0x491c2b){if(_0x58bc2a[_0x5d1e('0x4d')]['id']){delete _0x58bc2a[_0x5d1e('0x4d')]['id'];}return db[_0x5d1e('0x2f')][_0x5d1e('0x4e')]({'where':{'id':_0x58bc2a['params']['id']}})[_0x5d1e('0x27')](handleEntityNotFound(_0x491c2b,null))[_0x5d1e('0x27')](saveUpdates(_0x58bc2a[_0x5d1e('0x4d')],null))[_0x5d1e('0x27')](respondWithResult(_0x491c2b,null))[_0x5d1e('0x47')](handleError(_0x491c2b,null));};exports['destroy']=function(_0x344864,_0xf4f614){return db['SquareReport'][_0x5d1e('0x4e')]({'where':{'id':_0x344864[_0x5d1e('0x49')]['id']}})[_0x5d1e('0x27')](handleEntityNotFound(_0xf4f614,null))[_0x5d1e('0x27')](removeEntity(_0xf4f614,null))[_0x5d1e('0x47')](handleError(_0xf4f614,null));};exports[_0x5d1e('0x4f')]=function(_0x2031b2,_0x441701){return db[_0x5d1e('0x2f')][_0x5d1e('0x4f')]()[_0x5d1e('0x27')](respondWithResult(_0x441701,null))['catch'](handleError(_0x441701,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 56e3bbd..a7f0b2d 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 _0x7e21=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash'];(function(_0x3a838f,_0x3b2193){var _0x4355cb=function(_0x439a2f){while(--_0x439a2f){_0x3a838f['push'](_0x3a838f['shift']());}};_0x4355cb(++_0x3b2193);}(_0x7e21,0x16f));var _0x17e2=function(_0xac74c6,_0x358374){_0xac74c6=_0xac74c6-0x0;var _0x630f72=_0x7e21[_0xac74c6];return _0x630f72;};'use strict';var _=require(_0x17e2('0x0'));var util=require(_0x17e2('0x1'));var logger=require('../../config/logger')(_0x17e2('0x2'));var moment=require('moment');var BPromise=require(_0x17e2('0x3'));var rp=require(_0x17e2('0x4'));var fs=require('fs');var path=require(_0x17e2('0x5'));var rimraf=require(_0x17e2('0x6'));var config=require(_0x17e2('0x7'));var attributes=require(_0x17e2('0x8'));module[_0x17e2('0x9')]=function(_0x21dc16,_0x4f3ebb){return _0x21dc16[_0x17e2('0xa')](_0x17e2('0xb'),attributes,{'tableName':_0x17e2('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x17e2('0xd'),_0x17e2('0xe')]},{'name':_0x17e2('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2974=['uniqueid','project_name','leaveAt','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square'];(function(_0x1a0b3d,_0x2ae5a6){var _0x3830a8=function(_0x36f15a){while(--_0x36f15a){_0x1a0b3d['push'](_0x1a0b3d['shift']());}};_0x3830a8(++_0x2ae5a6);}(_0x2974,0x103));var _0x4297=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0x2974[_0x424501];return _0xb719af;};'use strict';var _=require(_0x4297('0x0'));var util=require('util');var logger=require(_0x4297('0x1'))(_0x4297('0x2'));var moment=require(_0x4297('0x3'));var BPromise=require(_0x4297('0x4'));var rp=require(_0x4297('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4297('0x6'));var config=require(_0x4297('0x7'));var attributes=require(_0x4297('0x8'));module[_0x4297('0x9')]=function(_0x20f75d,_0x632dc6){return _0x20f75d[_0x4297('0xa')](_0x4297('0xb'),attributes,{'tableName':_0x4297('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x4297('0xd'),_0x4297('0xe')]},{'name':_0x4297('0xf'),'fields':[_0x4297('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 955eaea..cf9f4fd 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 _0x81f9=['raw','then','debug','catch','UpdateSquareReport','update','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareReport,\x20%s,\x20%s','message','info','result','CreateSquareReport','SquareReport','body','options'];(function(_0xc08ebb,_0x52d914){var _0x195c61=function(_0x30652b){while(--_0x30652b){_0xc08ebb['push'](_0xc08ebb['shift']());}};_0x195c61(++_0x52d914);}(_0x81f9,0xe9));var _0x981f=function(_0x20fb90,_0x4c9e4e){_0x20fb90=_0x20fb90-0x0;var _0x25cba1=_0x81f9[_0x20fb90];return _0x25cba1;};'use strict';var _=require(_0x981f('0x0'));var util=require('util');var moment=require(_0x981f('0x1'));var BPromise=require('bluebird');var rs=require(_0x981f('0x2'));var fs=require('fs');var Redis=require(_0x981f('0x3'));var db=require(_0x981f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x981f('0x5'))(_0x981f('0x6'));var config=require('../../config/environment');var jayson=require(_0x981f('0x7'));var client=jayson[_0x981f('0x8')][_0x981f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x489f75,_0x356141,_0x1ef423){return new BPromise(function(_0x1710ab,_0x51f581){return client['request'](_0x489f75,_0x1ef423)['then'](function(_0x12dc49){logger['info']('SquareReport,\x20%s,\x20%s',_0x356141,'request\x20sent');logger['debug'](_0x981f('0xa'),_0x356141,_0x981f('0xb'),JSON[_0x981f('0xc')](_0x12dc49));if(_0x12dc49[_0x981f('0xd')]){if(_0x12dc49[_0x981f('0xd')][_0x981f('0xe')]===0x1f4){logger[_0x981f('0xd')](_0x981f('0xf'),_0x356141,_0x12dc49[_0x981f('0xd')][_0x981f('0x10')]);return _0x51f581(_0x12dc49[_0x981f('0xd')]['message']);}logger[_0x981f('0xd')](_0x981f('0xf'),_0x356141,_0x12dc49['error'][_0x981f('0x10')]);return _0x1710ab(_0x12dc49['error'][_0x981f('0x10')]);}else{logger[_0x981f('0x11')](_0x981f('0xf'),_0x356141,_0x981f('0xb'));_0x1710ab(_0x12dc49[_0x981f('0x12')][_0x981f('0x10')]);}})['catch'](function(_0x1fb9bf){logger['error'](_0x981f('0xf'),_0x356141,_0x1fb9bf);_0x51f581(_0x1fb9bf);});});}exports[_0x981f('0x13')]=function(_0x588c44){var _0x21fb06=this;return new Promise(function(_0x27e6d4,_0xb1303d){return db[_0x981f('0x14')]['create'](_0x588c44[_0x981f('0x15')],{'raw':_0x588c44['options']?_0x588c44[_0x981f('0x16')][_0x981f('0x17')]===undefined?!![]:![]:!![]})[_0x981f('0x18')](function(_0x11278a){logger[_0x981f('0x11')](_0x981f('0x13'),_0x588c44);logger[_0x981f('0x19')](_0x981f('0x13'),_0x588c44,JSON[_0x981f('0xc')](_0x11278a));_0x27e6d4(_0x11278a);})[_0x981f('0x1a')](function(_0x40a6ea){logger[_0x981f('0xd')](_0x981f('0x13'),_0x40a6ea[_0x981f('0x10')],_0x588c44);_0xb1303d(_0x21fb06['error'](0x1f4,_0x40a6ea[_0x981f('0x10')]));});});};exports[_0x981f('0x1b')]=function(_0x3238cf){var _0x54d3e0=this;return new Promise(function(_0x5d7ae7,_0x478556){return db[_0x981f('0x14')][_0x981f('0x1c')](_0x3238cf['body'],{'raw':_0x3238cf[_0x981f('0x16')]?_0x3238cf['options'][_0x981f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3238cf[_0x981f('0x16')]?_0x3238cf['options'][_0x981f('0x1d')]||null:null,'attributes':_0x3238cf[_0x981f('0x16')]?_0x3238cf[_0x981f('0x16')][_0x981f('0x1e')]||null:null,'limit':_0x3238cf['options']?_0x3238cf[_0x981f('0x16')][_0x981f('0x1f')]||null:null})[_0x981f('0x18')](function(_0x1b4cf0){logger[_0x981f('0x11')](_0x981f('0x1b'),_0x3238cf);logger['debug'](_0x981f('0x1b'),_0x3238cf,JSON[_0x981f('0xc')](_0x1b4cf0));_0x5d7ae7(_0x1b4cf0);})[_0x981f('0x1a')](function(_0x37184a){logger['error']('UpdateSquareReport',_0x37184a[_0x981f('0x10')],_0x3238cf);_0x478556(_0x54d3e0['error'](0x1f4,_0x37184a[_0x981f('0x10')]));});});}; \ No newline at end of file +var _0x274f=['stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','options','UpdateSquareReport','update','body','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0x34917a,_0x9730cb){var _0x3c44cf=function(_0xfcf8c1){while(--_0xfcf8c1){_0x34917a['push'](_0x34917a['shift']());}};_0x3c44cf(++_0x9730cb);}(_0x274f,0x1ca));var _0xf274=function(_0xf2f5de,_0x10038b){_0xf2f5de=_0xf2f5de-0x0;var _0x1be255=_0x274f[_0xf2f5de];return _0x1be255;};'use strict';var _=require(_0xf274('0x0'));var util=require(_0xf274('0x1'));var moment=require(_0xf274('0x2'));var BPromise=require(_0xf274('0x3'));var rs=require(_0xf274('0x4'));var fs=require('fs');var Redis=require(_0xf274('0x5'));var db=require(_0xf274('0x6'))['db'];var utils=require(_0xf274('0x7'));var logger=require(_0xf274('0x8'))('rpc');var config=require(_0xf274('0x9'));var jayson=require(_0xf274('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46997c,_0x438bc1,_0x5ded92){return new BPromise(function(_0xd278c1,_0x532405){return client[_0xf274('0xb')](_0x46997c,_0x5ded92)[_0xf274('0xc')](function(_0x2a9e77){logger[_0xf274('0xd')](_0xf274('0xe'),_0x438bc1,_0xf274('0xf'));logger[_0xf274('0x10')](_0xf274('0x11'),_0x438bc1,_0xf274('0xf'),JSON[_0xf274('0x12')](_0x2a9e77));if(_0x2a9e77[_0xf274('0x13')]){if(_0x2a9e77['error'][_0xf274('0x14')]===0x1f4){logger[_0xf274('0x13')](_0xf274('0xe'),_0x438bc1,_0x2a9e77[_0xf274('0x13')][_0xf274('0x15')]);return _0x532405(_0x2a9e77['error']['message']);}logger['error'](_0xf274('0xe'),_0x438bc1,_0x2a9e77[_0xf274('0x13')][_0xf274('0x15')]);return _0xd278c1(_0x2a9e77['error']['message']);}else{logger[_0xf274('0xd')](_0xf274('0xe'),_0x438bc1,_0xf274('0xf'));_0xd278c1(_0x2a9e77[_0xf274('0x16')][_0xf274('0x15')]);}})[_0xf274('0x17')](function(_0x2389ef){logger[_0xf274('0x13')](_0xf274('0xe'),_0x438bc1,_0x2389ef);_0x532405(_0x2389ef);});});}exports[_0xf274('0x18')]=function(_0x3326cc){var _0x1fa02f=this;return new Promise(function(_0x4af5ba,_0x1a3dbe){return db[_0xf274('0x19')][_0xf274('0x1a')](_0x3326cc['body'],{'raw':_0x3326cc[_0xf274('0x1b')]?_0x3326cc['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x125de){logger[_0xf274('0xd')](_0xf274('0x18'),_0x3326cc);logger[_0xf274('0x10')]('CreateSquareReport',_0x3326cc,JSON['stringify'](_0x125de));_0x4af5ba(_0x125de);})[_0xf274('0x17')](function(_0x18259a){logger[_0xf274('0x13')](_0xf274('0x18'),_0x18259a['message'],_0x3326cc);_0x1a3dbe(_0x1fa02f[_0xf274('0x13')](0x1f4,_0x18259a[_0xf274('0x15')]));});});};exports[_0xf274('0x1c')]=function(_0x51404d){var _0x31fa4d=this;return new Promise(function(_0x42e302,_0x1216c7){return db['SquareReport'][_0xf274('0x1d')](_0x51404d[_0xf274('0x1e')],{'raw':_0x51404d[_0xf274('0x1b')]?_0x51404d[_0xf274('0x1b')][_0xf274('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51404d[_0xf274('0x1b')]?_0x51404d['options'][_0xf274('0x20')]||null:null,'attributes':_0x51404d[_0xf274('0x1b')]?_0x51404d[_0xf274('0x1b')][_0xf274('0x21')]||null:null,'limit':_0x51404d['options']?_0x51404d[_0xf274('0x1b')]['limit']||null:null})[_0xf274('0xc')](function(_0x35def3){logger[_0xf274('0xd')]('UpdateSquareReport',_0x51404d);logger['debug'](_0xf274('0x1c'),_0x51404d,JSON[_0xf274('0x12')](_0x35def3));_0x42e302(_0x35def3);})[_0xf274('0x17')](function(_0x131108){logger[_0xf274('0x13')](_0xf274('0x1c'),_0x131108['message'],_0x51404d);_0x1216c7(_0x31fa4d[_0xf274('0x13')](0x1f4,_0x131108[_0xf274('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index bc32a29..6c915dd 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 _0x5a17=['./squareReportDetail.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x5a17,0x15c));var _0x75a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a17[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x75a1('0x0'));var util=require(_0x75a1('0x1'));var path=require(_0x75a1('0x2'));var timeout=require(_0x75a1('0x3'));var express=require(_0x75a1('0x4'));var router=express[_0x75a1('0x5')]();var fs_extra=require(_0x75a1('0x6'));var auth=require(_0x75a1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x75a1('0x8'));var controller=require(_0x75a1('0x9'));router[_0x75a1('0xa')]('/',auth[_0x75a1('0xb')](),controller[_0x75a1('0xc')]);router['get']('/describe',auth[_0x75a1('0xb')](),controller['describe']);router['get'](_0x75a1('0xd'),auth[_0x75a1('0xb')](),controller[_0x75a1('0xe')]);router[_0x75a1('0xf')]('/',auth[_0x75a1('0xb')](),controller[_0x75a1('0x10')]);router[_0x75a1('0x11')](_0x75a1('0xd'),auth[_0x75a1('0xb')](),controller[_0x75a1('0x12')]);router[_0x75a1('0x13')](_0x75a1('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x75a1('0x14')]=router; \ No newline at end of file +var _0x294c=['delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','/describe','get','/:id','show','post','update'];(function(_0x3a6b78,_0x2d62be){var _0x4943d4=function(_0x33ab64){while(--_0x33ab64){_0x3a6b78['push'](_0x3a6b78['shift']());}};_0x4943d4(++_0x2d62be);}(_0x294c,0x145));var _0xc294=function(_0x5c2cd5,_0x1c2fbb){_0x5c2cd5=_0x5c2cd5-0x0;var _0x5180e9=_0x294c[_0x5c2cd5];return _0x5180e9;};'use strict';var multer=require('multer');var util=require(_0xc294('0x0'));var path=require(_0xc294('0x1'));var timeout=require(_0xc294('0x2'));var express=require(_0xc294('0x3'));var router=express['Router']();var fs_extra=require(_0xc294('0x4'));var auth=require(_0xc294('0x5'));var interaction=require(_0xc294('0x6'));var config=require(_0xc294('0x7'));var controller=require(_0xc294('0x8'));router['get']('/',auth[_0xc294('0x9')](),controller[_0xc294('0xa')]);router['get'](_0xc294('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xc294('0xc')](_0xc294('0xd'),auth['isAuthenticated'](),controller[_0xc294('0xe')]);router[_0xc294('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc294('0xd'),auth[_0xc294('0x9')](),controller[_0xc294('0x10')]);router[_0xc294('0x11')](_0xc294('0xd'),auth[_0xc294('0x9')](),controller[_0xc294('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 21098a8..a78105f 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 _0x62d8=['TEXT','exports','STRING'];(function(_0x547914,_0x468fa5){var _0x5ad622=function(_0x5d56b4){while(--_0x5d56b4){_0x547914['push'](_0x547914['shift']());}};_0x5ad622(++_0x468fa5);}(_0x62d8,0x8e));var _0x862d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x62d8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x862d('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x862d('0x1')]},'application':{'type':Sequelize[_0x862d('0x1')]},'data':{'type':Sequelize[_0x862d('0x2')]},'project_name':{'type':Sequelize[_0x862d('0x1')]},'callerid':{'type':Sequelize[_0x862d('0x1')]}}; \ No newline at end of file +var _0xa28e=['STRING','TEXT','exports'];(function(_0x336393,_0x58d8d4){var _0x473e22=function(_0x56b25e){while(--_0x56b25e){_0x336393['push'](_0x336393['shift']());}};_0x473e22(++_0x58d8d4);}(_0xa28e,0x113));var _0xea28=function(_0x1b1948,_0x49f451){_0x1b1948=_0x1b1948-0x0;var _0x3cbd38=_0xa28e[_0x1b1948];return _0x3cbd38;};'use strict';var Sequelize=require('sequelize');module[_0xea28('0x0')]={'uniqueid':{'type':Sequelize[_0xea28('0x1')]},'node':{'type':Sequelize[_0xea28('0x1')]},'application':{'type':Sequelize[_0xea28('0x1')]},'data':{'type':Sequelize[_0xea28('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xea28('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 2bab8de..e917512 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 _0x80cc=['sendStatus','error','stack','name','map','SquareDetailsReport','rawAttributes','type','key','query','keys','filters','model','attributes','fields','length','nolimit','limit','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','catch','intersection','includeAll','options','create','body','update','find','params','describe','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','set','Content-Range','apply','save','then'];(function(_0x51b244,_0x485eb0){var _0x2c214a=function(_0x39edcf){while(--_0x39edcf){_0x51b244['push'](_0x51b244['shift']());}};_0x2c214a(++_0x485eb0);}(_0x80cc,0xfa));var _0xc80c=function(_0x90b70d,_0x2662fe){_0x90b70d=_0x90b70d-0x0;var _0xcc40f3=_0x80cc[_0x90b70d];return _0xcc40f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc80c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc80c('0x1'));var rp=require(_0xc80c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc80c('0x3'));var util=require(_0xc80c('0x4'));var path=require(_0xc80c('0x5'));var sox=require(_0xc80c('0x6'));var csv=require(_0xc80c('0x7'));var ejs=require(_0xc80c('0x8'));var fs=require('fs');var fs_extra=require(_0xc80c('0x9'));var _=require(_0xc80c('0xa'));var squel=require('squel');var crypto=require(_0xc80c('0xb'));var jsforce=require(_0xc80c('0xc'));var deskjs=require(_0xc80c('0xd'));var toCsv=require(_0xc80c('0x7'));var querystring=require('querystring');var Papa=require(_0xc80c('0xe'));var Redis=require(_0xc80c('0xf'));var authService=require(_0xc80c('0x10'));var qs=require(_0xc80c('0x11'));var as=require(_0xc80c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc80c('0x13'))(_0xc80c('0x14'));var utils=require(_0xc80c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc80c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4da3bf,_0x44beee){_0x44beee=_0x44beee||0xcc;return function(_0x4fd08a){if(_0x4fd08a){return _0x4da3bf['sendStatus'](_0x44beee);}return _0x4da3bf[_0xc80c('0x17')](_0x44beee)[_0xc80c('0x18')]();};}function respondWithResult(_0x3c73dd,_0x358ee2){_0x358ee2=_0x358ee2||0xc8;return function(_0x257e25){if(_0x257e25){return _0x3c73dd[_0xc80c('0x17')](_0x358ee2)[_0xc80c('0x19')](_0x257e25);}};}function respondWithFilteredResult(_0x45f147,_0x5aeb7c){return function(_0x464d27){if(_0x464d27){var _0x2b9a68=typeof _0x5aeb7c[_0xc80c('0x1a')]===_0xc80c('0x1b')&&typeof _0x5aeb7c['limit']===_0xc80c('0x1b');var _0x483ed6=_0x464d27['count'];var _0x58745b=_0x2b9a68?0x0:_0x5aeb7c[_0xc80c('0x1a')];var _0x76ef25=_0x2b9a68?_0x464d27[_0xc80c('0x1c')]:_0x5aeb7c[_0xc80c('0x1a')]+_0x5aeb7c['limit'];var _0x3dcb99;if(_0x76ef25>=_0x483ed6){_0x76ef25=_0x483ed6;_0x3dcb99=0xc8;}else{_0x3dcb99=0xce;}_0x45f147[_0xc80c('0x17')](_0x3dcb99);return _0x45f147[_0xc80c('0x1d')](_0xc80c('0x1e'),_0x58745b+'-'+_0x76ef25+'/'+_0x483ed6)[_0xc80c('0x19')](_0x464d27);}return null;};}function patchUpdates(_0x150f28){return function(_0x427ec3){try{jsonpatch[_0xc80c('0x1f')](_0x427ec3,_0x150f28,!![]);}catch(_0x191332){return BPromise['reject'](_0x191332);}return _0x427ec3[_0xc80c('0x20')]();};}function saveUpdates(_0x446f39,_0x468f6f){return function(_0x32e1f2){if(_0x32e1f2){return _0x32e1f2['update'](_0x446f39)[_0xc80c('0x21')](function(_0x167e41){return _0x167e41;});}return null;};}function removeEntity(_0x32e209,_0x49f664){return function(_0x250174){if(_0x250174){return _0x250174['destroy']()[_0xc80c('0x21')](function(){_0x32e209[_0xc80c('0x17')](0xcc)[_0xc80c('0x18')]();});}};}function handleEntityNotFound(_0x50ee75,_0x419fdb){return function(_0x2f13ef){if(!_0x2f13ef){_0x50ee75[_0xc80c('0x22')](0x194);}return _0x2f13ef;};}function handleError(_0x1726e7,_0x38b203){_0x38b203=_0x38b203||0x1f4;return function(_0x1c8405){logger[_0xc80c('0x23')](_0x1c8405[_0xc80c('0x24')]);if(_0x1c8405[_0xc80c('0x25')]){delete _0x1c8405[_0xc80c('0x25')];}_0x1726e7['status'](_0x38b203)['send'](_0x1c8405);};}exports['index']=function(_0x186dba,_0x1d1711){var _0x413763={},_0x4b0bb8={},_0x5c251f={'count':0x0,'rows':[]};var _0x18d127=_[_0xc80c('0x26')](db[_0xc80c('0x27')][_0xc80c('0x28')],function(_0x39496c){return{'name':_0x39496c['fieldName'],'type':_0x39496c[_0xc80c('0x29')][_0xc80c('0x2a')]};});_0x4b0bb8['model']=_[_0xc80c('0x26')](_0x18d127,_0xc80c('0x25'));_0x4b0bb8[_0xc80c('0x2b')]=_[_0xc80c('0x2c')](_0x186dba[_0xc80c('0x2b')]);_0x4b0bb8[_0xc80c('0x2d')]=_['intersection'](_0x4b0bb8[_0xc80c('0x2e')],_0x4b0bb8[_0xc80c('0x2b')]);_0x413763[_0xc80c('0x2f')]=_['intersection'](_0x4b0bb8['model'],qs[_0xc80c('0x30')](_0x186dba['query'][_0xc80c('0x30')]));_0x413763['attributes']=_0x413763[_0xc80c('0x2f')][_0xc80c('0x31')]?_0x413763[_0xc80c('0x2f')]:_0x4b0bb8[_0xc80c('0x2e')];if(!_0x186dba[_0xc80c('0x2b')]['hasOwnProperty'](_0xc80c('0x32'))){_0x413763['limit']=qs[_0xc80c('0x33')](_0x186dba[_0xc80c('0x2b')][_0xc80c('0x33')]);_0x413763[_0xc80c('0x1a')]=qs[_0xc80c('0x1a')](_0x186dba['query'][_0xc80c('0x1a')]);}_0x413763['order']=qs[_0xc80c('0x34')](_0x186dba[_0xc80c('0x2b')]['sort']);_0x413763['where']=qs['filters'](_[_0xc80c('0x35')](_0x186dba[_0xc80c('0x2b')],_0x4b0bb8[_0xc80c('0x2d')]),_0x18d127);if(_0x186dba[_0xc80c('0x2b')][_0xc80c('0x36')]){_0x413763[_0xc80c('0x37')]=_['merge'](_0x413763['where'],{'$or':_[_0xc80c('0x26')](_0x18d127,function(_0x30dfc0){if(_0x30dfc0[_0xc80c('0x29')]!==_0xc80c('0x38')){var _0xd74f1={};_0xd74f1[_0x30dfc0[_0xc80c('0x25')]]={'$like':'%'+_0x186dba[_0xc80c('0x2b')][_0xc80c('0x36')]+'%'};return _0xd74f1;}})});}_0x413763=_[_0xc80c('0x39')]({},_0x413763,_0x186dba['options']);var _0x230f4d={'where':_0x413763[_0xc80c('0x37')]};return db['SquareDetailsReport'][_0xc80c('0x1c')](_0x230f4d)[_0xc80c('0x21')](function(_0x1db7a3){_0x5c251f[_0xc80c('0x1c')]=_0x1db7a3;if(_0x186dba[_0xc80c('0x2b')]['includeAll']){_0x413763[_0xc80c('0x3a')]=[{'all':!![]}];}return db[_0xc80c('0x27')][_0xc80c('0x3b')](_0x413763);})[_0xc80c('0x21')](function(_0x2bfca4){_0x5c251f[_0xc80c('0x3c')]=_0x2bfca4;return _0x5c251f;})['then'](respondWithFilteredResult(_0x1d1711,_0x413763))[_0xc80c('0x3d')](handleError(_0x1d1711,null));};exports['show']=function(_0x1f72c5,_0x336a1e){var _0x2b58fb={'raw':!![],'where':{'id':_0x1f72c5['params']['id']}},_0x377235={};_0x377235[_0xc80c('0x2e')]=_['keys'](db[_0xc80c('0x27')]['rawAttributes']);_0x377235[_0xc80c('0x2b')]=_[_0xc80c('0x2c')](_0x1f72c5[_0xc80c('0x2b')]);_0x377235[_0xc80c('0x2d')]=_[_0xc80c('0x3e')](_0x377235[_0xc80c('0x2e')],_0x377235[_0xc80c('0x2b')]);_0x2b58fb[_0xc80c('0x2f')]=_[_0xc80c('0x3e')](_0x377235[_0xc80c('0x2e')],qs[_0xc80c('0x30')](_0x1f72c5[_0xc80c('0x2b')]['fields']));_0x2b58fb[_0xc80c('0x2f')]=_0x2b58fb['attributes'][_0xc80c('0x31')]?_0x2b58fb[_0xc80c('0x2f')]:_0x377235[_0xc80c('0x2e')];if(_0x1f72c5[_0xc80c('0x2b')][_0xc80c('0x3f')]){_0x2b58fb[_0xc80c('0x3a')]=[{'all':!![]}];}_0x2b58fb=_[_0xc80c('0x39')]({},_0x2b58fb,_0x1f72c5[_0xc80c('0x40')]);return db['SquareDetailsReport']['find'](_0x2b58fb)['then'](handleEntityNotFound(_0x336a1e,null))['then'](respondWithResult(_0x336a1e,null))['catch'](handleError(_0x336a1e,null));};exports[_0xc80c('0x41')]=function(_0x2003bc,_0x687a00){return db[_0xc80c('0x27')][_0xc80c('0x41')](_0x2003bc[_0xc80c('0x42')],{})[_0xc80c('0x21')](respondWithResult(_0x687a00,0xc9))[_0xc80c('0x3d')](handleError(_0x687a00,null));};exports[_0xc80c('0x43')]=function(_0x8bab1f,_0x405525){if(_0x8bab1f[_0xc80c('0x42')]['id']){delete _0x8bab1f[_0xc80c('0x42')]['id'];}return db[_0xc80c('0x27')][_0xc80c('0x44')]({'where':{'id':_0x8bab1f['params']['id']}})[_0xc80c('0x21')](handleEntityNotFound(_0x405525,null))['then'](saveUpdates(_0x8bab1f[_0xc80c('0x42')],null))[_0xc80c('0x21')](respondWithResult(_0x405525,null))[_0xc80c('0x3d')](handleError(_0x405525,null));};exports['destroy']=function(_0x30de98,_0x3cd2f8){return db[_0xc80c('0x27')][_0xc80c('0x44')]({'where':{'id':_0x30de98[_0xc80c('0x45')]['id']}})[_0xc80c('0x21')](handleEntityNotFound(_0x3cd2f8,null))[_0xc80c('0x21')](removeEntity(_0x3cd2f8,null))[_0xc80c('0x3d')](handleError(_0x3cd2f8,null));};exports[_0xc80c('0x46')]=function(_0x143bf3,_0x1a3250){return db['SquareDetailsReport'][_0xc80c('0x46')]()['then'](respondWithResult(_0x1a3250,null))['catch'](handleError(_0x1a3250,null));}; \ No newline at end of file +var _0xdecc=['params','length','include','catch','create','body','find','describe','eml-format','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','SquareDetailsReport','type','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','findAll','rows','show'];(function(_0x6b7a2d,_0x116179){var _0xd83f78=function(_0x2ee2c9){while(--_0x2ee2c9){_0x6b7a2d['push'](_0x6b7a2d['shift']());}};_0xd83f78(++_0x116179);}(_0xdecc,0x161));var _0xcdec=function(_0xae1a83,_0x1980d4){_0xae1a83=_0xae1a83-0x0;var _0xdb9da8=_0xdecc[_0xae1a83];return _0xdb9da8;};'use strict';var emlformat=require(_0xcdec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcdec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcdec('0x2'));var moment=require(_0xcdec('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcdec('0x4'));var path=require(_0xcdec('0x5'));var sox=require('sox');var csv=require(_0xcdec('0x6'));var ejs=require(_0xcdec('0x7'));var fs=require('fs');var fs_extra=require(_0xcdec('0x8'));var _=require(_0xcdec('0x9'));var squel=require(_0xcdec('0xa'));var crypto=require(_0xcdec('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcdec('0x6'));var querystring=require(_0xcdec('0xc'));var Papa=require(_0xcdec('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcdec('0xe'));var hardwareService=require(_0xcdec('0xf'));var logger=require(_0xcdec('0x10'))(_0xcdec('0x11'));var utils=require(_0xcdec('0x12'));var config=require(_0xcdec('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xcdec('0x14'))['db'];function respondWithStatusCode(_0x38bc3e,_0x568590){_0x568590=_0x568590||0xcc;return function(_0x4804a3){if(_0x4804a3){return _0x38bc3e[_0xcdec('0x15')](_0x568590);}return _0x38bc3e['status'](_0x568590)[_0xcdec('0x16')]();};}function respondWithResult(_0x1f0a10,_0x4eedf9){_0x4eedf9=_0x4eedf9||0xc8;return function(_0x2d105c){if(_0x2d105c){return _0x1f0a10[_0xcdec('0x17')](_0x4eedf9)['json'](_0x2d105c);}};}function respondWithFilteredResult(_0x53cca4,_0x27b276){return function(_0x248685){if(_0x248685){var _0x444bfe=typeof _0x27b276[_0xcdec('0x18')]===_0xcdec('0x19')&&typeof _0x27b276[_0xcdec('0x1a')]===_0xcdec('0x19');var _0x4a19ad=_0x248685['count'];var _0x41cf45=_0x444bfe?0x0:_0x27b276[_0xcdec('0x18')];var _0xb5fe4=_0x444bfe?_0x248685[_0xcdec('0x1b')]:_0x27b276[_0xcdec('0x18')]+_0x27b276[_0xcdec('0x1a')];var _0x26c7f5;if(_0xb5fe4>=_0x4a19ad){_0xb5fe4=_0x4a19ad;_0x26c7f5=0xc8;}else{_0x26c7f5=0xce;}_0x53cca4[_0xcdec('0x17')](_0x26c7f5);return _0x53cca4['set'](_0xcdec('0x1c'),_0x41cf45+'-'+_0xb5fe4+'/'+_0x4a19ad)[_0xcdec('0x1d')](_0x248685);}return null;};}function patchUpdates(_0x4f6519){return function(_0x254e8e){try{jsonpatch[_0xcdec('0x1e')](_0x254e8e,_0x4f6519,!![]);}catch(_0x134bea){return BPromise[_0xcdec('0x1f')](_0x134bea);}return _0x254e8e[_0xcdec('0x20')]();};}function saveUpdates(_0x42bb61,_0x788dba){return function(_0x4c1582){if(_0x4c1582){return _0x4c1582[_0xcdec('0x21')](_0x42bb61)[_0xcdec('0x22')](function(_0x18d17c){return _0x18d17c;});}return null;};}function removeEntity(_0x3eefba,_0x5daa2a){return function(_0x19ab45){if(_0x19ab45){return _0x19ab45[_0xcdec('0x23')]()[_0xcdec('0x22')](function(){_0x3eefba[_0xcdec('0x17')](0xcc)[_0xcdec('0x16')]();});}};}function handleEntityNotFound(_0x479b39,_0xa81dfd){return function(_0x4c21f6){if(!_0x4c21f6){_0x479b39[_0xcdec('0x15')](0x194);}return _0x4c21f6;};}function handleError(_0x2a7ae9,_0x234070){_0x234070=_0x234070||0x1f4;return function(_0x5a59d1){logger[_0xcdec('0x24')](_0x5a59d1[_0xcdec('0x25')]);if(_0x5a59d1[_0xcdec('0x26')]){delete _0x5a59d1[_0xcdec('0x26')];}_0x2a7ae9['status'](_0x234070)[_0xcdec('0x27')](_0x5a59d1);};}exports['index']=function(_0x4e241c,_0x1162fb){var _0x2cb06f={},_0xd8552f={},_0x10a155={'count':0x0,'rows':[]};var _0x147300=_['map'](db[_0xcdec('0x28')]['rawAttributes'],function(_0x4a381c){return{'name':_0x4a381c['fieldName'],'type':_0x4a381c[_0xcdec('0x29')]['key']};});_0xd8552f['model']=_[_0xcdec('0x2a')](_0x147300,_0xcdec('0x26'));_0xd8552f[_0xcdec('0x2b')]=_[_0xcdec('0x2c')](_0x4e241c[_0xcdec('0x2b')]);_0xd8552f[_0xcdec('0x2d')]=_['intersection'](_0xd8552f[_0xcdec('0x2e')],_0xd8552f[_0xcdec('0x2b')]);_0x2cb06f[_0xcdec('0x2f')]=_[_0xcdec('0x30')](_0xd8552f[_0xcdec('0x2e')],qs[_0xcdec('0x31')](_0x4e241c[_0xcdec('0x2b')]['fields']));_0x2cb06f['attributes']=_0x2cb06f[_0xcdec('0x2f')]['length']?_0x2cb06f[_0xcdec('0x2f')]:_0xd8552f['model'];if(!_0x4e241c['query'][_0xcdec('0x32')]('nolimit')){_0x2cb06f['limit']=qs[_0xcdec('0x1a')](_0x4e241c[_0xcdec('0x2b')][_0xcdec('0x1a')]);_0x2cb06f['offset']=qs[_0xcdec('0x18')](_0x4e241c['query']['offset']);}_0x2cb06f[_0xcdec('0x33')]=qs[_0xcdec('0x34')](_0x4e241c['query']['sort']);_0x2cb06f['where']=qs[_0xcdec('0x2d')](_[_0xcdec('0x35')](_0x4e241c['query'],_0xd8552f[_0xcdec('0x2d')]),_0x147300);if(_0x4e241c[_0xcdec('0x2b')][_0xcdec('0x36')]){_0x2cb06f[_0xcdec('0x37')]=_[_0xcdec('0x38')](_0x2cb06f[_0xcdec('0x37')],{'$or':_[_0xcdec('0x2a')](_0x147300,function(_0x2f822c){if(_0x2f822c[_0xcdec('0x29')]!==_0xcdec('0x39')){var _0x2a62a8={};_0x2a62a8[_0x2f822c[_0xcdec('0x26')]]={'$like':'%'+_0x4e241c[_0xcdec('0x2b')][_0xcdec('0x36')]+'%'};return _0x2a62a8;}})});}_0x2cb06f=_['merge']({},_0x2cb06f,_0x4e241c['options']);var _0x350a72={'where':_0x2cb06f[_0xcdec('0x37')]};return db[_0xcdec('0x28')][_0xcdec('0x1b')](_0x350a72)['then'](function(_0x152324){_0x10a155[_0xcdec('0x1b')]=_0x152324;if(_0x4e241c[_0xcdec('0x2b')]['includeAll']){_0x2cb06f['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0xcdec('0x3a')](_0x2cb06f);})[_0xcdec('0x22')](function(_0x509597){_0x10a155[_0xcdec('0x3b')]=_0x509597;return _0x10a155;})['then'](respondWithFilteredResult(_0x1162fb,_0x2cb06f))['catch'](handleError(_0x1162fb,null));};exports[_0xcdec('0x3c')]=function(_0x15c9e3,_0x464fc1){var _0x4a369e={'raw':!![],'where':{'id':_0x15c9e3[_0xcdec('0x3d')]['id']}},_0x17eb61={};_0x17eb61['model']=_[_0xcdec('0x2c')](db[_0xcdec('0x28')]['rawAttributes']);_0x17eb61[_0xcdec('0x2b')]=_[_0xcdec('0x2c')](_0x15c9e3[_0xcdec('0x2b')]);_0x17eb61[_0xcdec('0x2d')]=_[_0xcdec('0x30')](_0x17eb61[_0xcdec('0x2e')],_0x17eb61['query']);_0x4a369e[_0xcdec('0x2f')]=_['intersection'](_0x17eb61[_0xcdec('0x2e')],qs[_0xcdec('0x31')](_0x15c9e3[_0xcdec('0x2b')][_0xcdec('0x31')]));_0x4a369e['attributes']=_0x4a369e[_0xcdec('0x2f')][_0xcdec('0x3e')]?_0x4a369e[_0xcdec('0x2f')]:_0x17eb61[_0xcdec('0x2e')];if(_0x15c9e3[_0xcdec('0x2b')]['includeAll']){_0x4a369e[_0xcdec('0x3f')]=[{'all':!![]}];}_0x4a369e=_['merge']({},_0x4a369e,_0x15c9e3['options']);return db[_0xcdec('0x28')]['find'](_0x4a369e)[_0xcdec('0x22')](handleEntityNotFound(_0x464fc1,null))['then'](respondWithResult(_0x464fc1,null))[_0xcdec('0x40')](handleError(_0x464fc1,null));};exports[_0xcdec('0x41')]=function(_0x1902bd,_0x1d44ae){return db[_0xcdec('0x28')][_0xcdec('0x41')](_0x1902bd['body'],{})[_0xcdec('0x22')](respondWithResult(_0x1d44ae,0xc9))[_0xcdec('0x40')](handleError(_0x1d44ae,null));};exports[_0xcdec('0x21')]=function(_0x12b7e4,_0x334515){if(_0x12b7e4[_0xcdec('0x42')]['id']){delete _0x12b7e4[_0xcdec('0x42')]['id'];}return db['SquareDetailsReport'][_0xcdec('0x43')]({'where':{'id':_0x12b7e4[_0xcdec('0x3d')]['id']}})['then'](handleEntityNotFound(_0x334515,null))[_0xcdec('0x22')](saveUpdates(_0x12b7e4[_0xcdec('0x42')],null))[_0xcdec('0x22')](respondWithResult(_0x334515,null))[_0xcdec('0x40')](handleError(_0x334515,null));};exports[_0xcdec('0x23')]=function(_0x1aea9c,_0x45fb2f){return db['SquareDetailsReport'][_0xcdec('0x43')]({'where':{'id':_0x1aea9c[_0xcdec('0x3d')]['id']}})[_0xcdec('0x22')](handleEntityNotFound(_0x45fb2f,null))[_0xcdec('0x22')](removeEntity(_0x45fb2f,null))['catch'](handleError(_0x45fb2f,null));};exports[_0xcdec('0x44')]=function(_0x3052dc,_0x3633aa){return db['SquareDetailsReport'][_0xcdec('0x44')]()[_0xcdec('0x22')](respondWithResult(_0x3633aa,null))['catch'](handleError(_0x3633aa,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 9f6e785..471c7d5 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 _0xe6d6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareReportDetail.attributes','exports','define','report_square_details'];(function(_0x4c7b6e,_0x39fa58){var _0xab359a=function(_0x18330f){while(--_0x18330f){_0x4c7b6e['push'](_0x4c7b6e['shift']());}};_0xab359a(++_0x39fa58);}(_0xe6d6,0x84));var _0x6e6d=function(_0x485c12,_0x63ee16){_0x485c12=_0x485c12-0x0;var _0x5c87ad=_0xe6d6[_0x485c12];return _0x5c87ad;};'use strict';var _=require(_0x6e6d('0x0'));var util=require(_0x6e6d('0x1'));var logger=require(_0x6e6d('0x2'))(_0x6e6d('0x3'));var moment=require(_0x6e6d('0x4'));var BPromise=require(_0x6e6d('0x5'));var rp=require(_0x6e6d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e6d('0x7'));var config=require('../../config/environment');var attributes=require(_0x6e6d('0x8'));module[_0x6e6d('0x9')]=function(_0x3e9f13,_0x5c80c5){return _0x3e9f13[_0x6e6d('0xa')]('SquareDetailsReport',attributes,{'tableName':_0x6e6d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x722c=['path','rimraf','./squareReportDetail.attributes','exports','define','report_square_details','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3a1b35,_0x43f746){var _0x27fd53=function(_0x398150){while(--_0x398150){_0x3a1b35['push'](_0x3a1b35['shift']());}};_0x27fd53(++_0x43f746);}(_0x722c,0x1e6));var _0xc722=function(_0x4ca567,_0x918604){_0x4ca567=_0x4ca567-0x0;var _0x567e29=_0x722c[_0x4ca567];return _0x567e29;};'use strict';var _=require(_0xc722('0x0'));var util=require(_0xc722('0x1'));var logger=require(_0xc722('0x2'))(_0xc722('0x3'));var moment=require(_0xc722('0x4'));var BPromise=require('bluebird');var rp=require(_0xc722('0x5'));var fs=require('fs');var path=require(_0xc722('0x6'));var rimraf=require(_0xc722('0x7'));var config=require('../../config/environment');var attributes=require(_0xc722('0x8'));module[_0xc722('0x9')]=function(_0xc6587b,_0x5e15f9){return _0xc6587b[_0xc722('0xa')]('SquareDetailsReport',attributes,{'tableName':_0xc722('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index dd7390b..be2355b 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 _0x42f4=['randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','then','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','info','result','catch','SquareDetailsReport','create','body','options','CreateSquareDetailsReport','lodash','moment','bluebird'];(function(_0x438bba,_0x1d229f){var _0x1428fd=function(_0x5177a0){while(--_0x5177a0){_0x438bba['push'](_0x438bba['shift']());}};_0x1428fd(++_0x1d229f);}(_0x42f4,0x19d));var _0x442f=function(_0x5a7618,_0x3f44c2){_0x5a7618=_0x5a7618-0x0;var _0x12dc65=_0x42f4[_0x5a7618];return _0x12dc65;};'use strict';var _=require(_0x442f('0x0'));var util=require('util');var moment=require(_0x442f('0x1'));var BPromise=require(_0x442f('0x2'));var rs=require(_0x442f('0x3'));var fs=require('fs');var Redis=require(_0x442f('0x4'));var db=require(_0x442f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x442f('0x6'));var jayson=require(_0x442f('0x7'));var client=jayson['client'][_0x442f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11b450,_0x23c5ba,_0x37dfe7){return new BPromise(function(_0x6c0b4b,_0x476480){return client['request'](_0x11b450,_0x37dfe7)[_0x442f('0x9')](function(_0x4e32af){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x23c5ba,_0x442f('0xa'));logger[_0x442f('0xb')](_0x442f('0xc'),_0x23c5ba,_0x442f('0xa'),JSON[_0x442f('0xd')](_0x4e32af));if(_0x4e32af[_0x442f('0xe')]){if(_0x4e32af[_0x442f('0xe')][_0x442f('0xf')]===0x1f4){logger[_0x442f('0xe')](_0x442f('0x10'),_0x23c5ba,_0x4e32af['error'][_0x442f('0x11')]);return _0x476480(_0x4e32af[_0x442f('0xe')][_0x442f('0x11')]);}logger[_0x442f('0xe')](_0x442f('0x10'),_0x23c5ba,_0x4e32af[_0x442f('0xe')][_0x442f('0x11')]);return _0x6c0b4b(_0x4e32af[_0x442f('0xe')][_0x442f('0x11')]);}else{logger[_0x442f('0x12')](_0x442f('0x10'),_0x23c5ba,_0x442f('0xa'));_0x6c0b4b(_0x4e32af[_0x442f('0x13')][_0x442f('0x11')]);}})[_0x442f('0x14')](function(_0x3ff2b1){logger['error'](_0x442f('0x10'),_0x23c5ba,_0x3ff2b1);_0x476480(_0x3ff2b1);});});}exports['CreateSquareDetailsReport']=function(_0x54c48a){var _0x5668e0=this;return new Promise(function(_0x5e3dda,_0x1b18fd){return db[_0x442f('0x15')][_0x442f('0x16')](_0x54c48a[_0x442f('0x17')],{'raw':_0x54c48a[_0x442f('0x18')]?_0x54c48a[_0x442f('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x442f('0x9')](function(_0x552f81){logger[_0x442f('0x12')](_0x442f('0x19'),_0x54c48a);logger[_0x442f('0xb')]('CreateSquareDetailsReport',_0x54c48a,JSON[_0x442f('0xd')](_0x552f81));_0x5e3dda(_0x552f81);})[_0x442f('0x14')](function(_0x5dd019){logger['error'](_0x442f('0x19'),_0x5dd019[_0x442f('0x11')],_0x54c48a);_0x1b18fd(_0x5668e0[_0x442f('0xe')](0x1f4,_0x5dd019[_0x442f('0x11')]));});});}; \ No newline at end of file +var _0x8603=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','debug','stringify'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8603,0x190));var _0x3860=function(_0x443417,_0x4450aa){_0x443417=_0x443417-0x0;var _0x28d629=_0x8603[_0x443417];return _0x28d629;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});}exports[_0x3860('0x12')]=function(_0x45b799){var _0x4b6b15=this;return new Promise(function(_0x4863bd,_0x373b06){return db[_0x3860('0x13')][_0x3860('0x14')](_0x45b799['body'],{'raw':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![]})[_0x3860('0x9')](function(_0x20a5b0){logger[_0x3860('0xf')](_0x3860('0x12'),_0x45b799);logger[_0x3860('0x17')](_0x3860('0x12'),_0x45b799,JSON[_0x3860('0x18')](_0x20a5b0));_0x4863bd(_0x20a5b0);})[_0x3860('0x11')](function(_0x2e0b6e){logger[_0x3860('0xd')](_0x3860('0x12'),_0x2e0b6e[_0x3860('0xe')],_0x45b799);_0x373b06(_0x4b6b15['error'](0x1f4,_0x2e0b6e[_0x3860('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index db1110d..3a6a748 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 _0x67dd=['../../components/auth/service','./system.controller','get','isAuthenticated','killProcess','exports','express','Router'];(function(_0x586fa8,_0x21ae01){var _0x3b2a0f=function(_0xcee18){while(--_0xcee18){_0x586fa8['push'](_0x586fa8['shift']());}};_0x3b2a0f(++_0x21ae01);}(_0x67dd,0xce));var _0xd67d=function(_0x364beb,_0x5377c8){_0x364beb=_0x364beb-0x0;var _0x314dfb=_0x67dd[_0x364beb];return _0x314dfb;};'use strict';var express=require(_0xd67d('0x0'));var router=express[_0xd67d('0x1')]();var auth=require(_0xd67d('0x2'));var controller=require(_0xd67d('0x3'));router[_0xd67d('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd67d('0x4')]('/process/:pid/kill',auth[_0xd67d('0x5')](),controller[_0xd67d('0x6')]);module[_0xd67d('0x7')]=router; \ No newline at end of file +var _0xb974=['./system.controller','get','isAuthenticated','index','killProcess','exports','express','Router'];(function(_0x17141f,_0x4d7c4b){var _0x3ee900=function(_0x5ec0f4){while(--_0x5ec0f4){_0x17141f['push'](_0x17141f['shift']());}};_0x3ee900(++_0x4d7c4b);}(_0xb974,0x1c6));var _0x4b97=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb974[_0x397e5f];return _0x5302b8;};'use strict';var express=require(_0x4b97('0x0'));var router=express[_0x4b97('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x4b97('0x2'));router[_0x4b97('0x3')]('/',auth[_0x4b97('0x4')](),controller[_0x4b97('0x5')]);router[_0x4b97('0x3')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x4b97('0x6')]);module[_0x4b97('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 3e777b5..a1a3254 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 _0x4801=['then','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','format','pid','kill','SIGINT','json','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData'];(function(_0x587abd,_0x55af50){var _0x88784b=function(_0x47e932){while(--_0x47e932){_0x587abd['push'](_0x587abd['shift']());}};_0x88784b(++_0x55af50);}(_0x4801,0x1ef));var _0x1480=function(_0x13573c,_0x585238){_0x13573c=_0x13573c-0x0;var _0x37bc6e=_0x4801[_0x13573c];return _0x37bc6e;};'use strict';var info=require(_0x1480('0x0'));var exec=require('child_process')[_0x1480('0x1')];var logger=require(_0x1480('0x2'))(_0x1480('0x3'));var util=require(_0x1480('0x4'));var BPromise=require(_0x1480('0x5'));var _=require(_0x1480('0x6'));function handleError(_0xb11535,_0x411e0b,_0x1307cb){_0x411e0b=_0x411e0b||0x1f4;return function(_0x5caa4a){logger[_0x1480('0x7')](_0x1480('0x8'),_0x1307cb,_0x411e0b,util[_0x1480('0x9')](_0x5caa4a,{'showHidden':![],'depth':null}));delete _0x5caa4a[_0x1480('0xa')];_0xb11535[_0x1480('0xb')](_0x411e0b)[_0x1480('0xc')](_0x5caa4a);};}exports[_0x1480('0xd')]=function(_0x9e4284,_0x283b88){return info[_0x1480('0xe')]()[_0x1480('0xf')](function(_0x5414d1){return _0x283b88[_0x1480('0xb')](0xc8)['json'](_0x5414d1);})['catch'](function(_0x41134c){return _0x283b88[_0x1480('0xb')](0x1f4)['json'](_0x41134c);});};exports[_0x1480('0x10')]=function(_0x2828f2,_0x1a4783){var _0x15e878=[_0x1480('0x11')];return new BPromise(function(_0x10303d,_0x1453ce){return exec(util['format'](_0x1480('0x12'),_0x2828f2[_0x1480('0x13')]['pid']),function(_0x5ecf6e,_0x311cae,_0xf30c03){if(_0x5ecf6e){return _0x1453ce(_0x5ecf6e);}return _0x10303d(_0x311cae);});})['then'](function(_0x56fa80){var _0x22bd7c=![];var _0x370e2c=_0x56fa80[_0x1480('0x14')](/\n/);for(var _0x4099f6=0x0,_0x4b55a2=_0x15e878[_0x1480('0x15')];_0x4099f6<_0x4b55a2,_0x22bd7c===![];_0x4099f6+=0x1){if(_0x56fa80[_0x1480('0x16')](_0x15e878[_0x4099f6])>=0x0){_0x22bd7c=!![];}}if(!_0x22bd7c){throw new Error(util[_0x1480('0x17')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x2828f2[_0x1480('0x13')][_0x1480('0x18')]));}process[_0x1480('0x19')](_0x2828f2[_0x1480('0x13')]['pid'],_0x1480('0x1a'));return _0x1a4783[_0x1480('0xb')](0xc8)[_0x1480('0x1b')]({'message':util['format'](_0x1480('0x1c'),_0x2828f2[_0x1480('0x13')][_0x1480('0x18')])});})[_0x1480('0x1d')](handleError(_0x1a4783,null,_0x1480('0x10')));}; \ No newline at end of file +var _0xfb76=['inspect','name','status','getAllData','json','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','then','split','length','format','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','killProcess','systeminformation','child_process','exec','../../config/logger','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x2de0e7,_0x1b0135){var _0x3315d4=function(_0x5260c0){while(--_0x5260c0){_0x2de0e7['push'](_0x2de0e7['shift']());}};_0x3315d4(++_0x1b0135);}(_0xfb76,0x1f1));var _0x6fb7=function(_0x5f44ab,_0x5d42b7){_0x5f44ab=_0x5f44ab-0x0;var _0x2e225d=_0xfb76[_0x5f44ab];return _0x2e225d;};'use strict';var info=require(_0x6fb7('0x0'));var exec=require(_0x6fb7('0x1'))[_0x6fb7('0x2')];var logger=require(_0x6fb7('0x3'))('api');var util=require('util');var BPromise=require('bluebird');var _=require(_0x6fb7('0x4'));function handleError(_0x243b27,_0x245c82,_0x49ad04){_0x245c82=_0x245c82||0x1f4;return function(_0x47fac3){logger[_0x6fb7('0x5')](_0x6fb7('0x6'),_0x49ad04,_0x245c82,util[_0x6fb7('0x7')](_0x47fac3,{'showHidden':![],'depth':null}));delete _0x47fac3[_0x6fb7('0x8')];_0x243b27[_0x6fb7('0x9')](_0x245c82)['send'](_0x47fac3);};}exports['index']=function(_0x5a3afa,_0x55786f){return info[_0x6fb7('0xa')]()['then'](function(_0x4cb204){return _0x55786f['status'](0xc8)[_0x6fb7('0xb')](_0x4cb204);})['catch'](function(_0x2b9229){return _0x55786f[_0x6fb7('0x9')](0x1f4)[_0x6fb7('0xb')](_0x2b9229);});};exports['killProcess']=function(_0x2be586,_0x1baf3f){var _0x1ec0a3=['components/import/cm'];return new BPromise(function(_0x2abc9f,_0x524247){return exec(util['format'](_0x6fb7('0xc'),_0x2be586['params'][_0x6fb7('0xd')]),function(_0x4b6496,_0x5dcb57,_0x395d37){if(_0x4b6496){return _0x524247(_0x4b6496);}return _0x2abc9f(_0x5dcb57);});})[_0x6fb7('0xe')](function(_0x3a2be1){var _0x58de15=![];var _0x574eb1=_0x3a2be1[_0x6fb7('0xf')](/\n/);for(var _0x29e416=0x0,_0x17323e=_0x1ec0a3[_0x6fb7('0x10')];_0x29e416<_0x17323e,_0x58de15===![];_0x29e416+=0x1){if(_0x3a2be1['indexOf'](_0x1ec0a3[_0x29e416])>=0x0){_0x58de15=!![];}}if(!_0x58de15){throw new Error(util[_0x6fb7('0x11')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x2be586[_0x6fb7('0x12')][_0x6fb7('0xd')]));}process[_0x6fb7('0x13')](_0x2be586[_0x6fb7('0x12')][_0x6fb7('0xd')],_0x6fb7('0x14'));return _0x1baf3f[_0x6fb7('0x9')](0xc8)['json']({'message':util['format'](_0x6fb7('0x15'),_0x2be586[_0x6fb7('0x12')]['pid'])});})[_0x6fb7('0x16')](handleError(_0x1baf3f,null,_0x6fb7('0x17')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 624c80e..2059790 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 _0x781b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','/:id','show','post','update','isAuthenticated','exports','multer','util'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x781b,0x1c9));var _0xb781=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x781b[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0xb781('0x0'));var util=require(_0xb781('0x1'));var path=require(_0xb781('0x2'));var timeout=require(_0xb781('0x3'));var express=require(_0xb781('0x4'));var router=express[_0xb781('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb781('0x6'));var interaction=require(_0xb781('0x7'));var config=require(_0xb781('0x8'));var controller=require(_0xb781('0x9'));router[_0xb781('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb781('0xa')](_0xb781('0xb'),auth['isAuthenticated'](),controller[_0xb781('0xc')]);router[_0xb781('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb781('0xb'),auth['isAuthenticated'](),controller[_0xb781('0xe')]);router['delete'](_0xb781('0xb'),auth[_0xb781('0xf')](),controller['destroy']);module[_0xb781('0x10')]=router; \ No newline at end of file +var _0xe82e=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','show','put'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe82e,0x101));var _0xee82=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xe82e[_0x4b2863];return _0x567d67;};'use strict';var multer=require(_0xee82('0x0'));var util=require(_0xee82('0x1'));var path=require(_0xee82('0x2'));var timeout=require(_0xee82('0x3'));var express=require(_0xee82('0x4'));var router=express[_0xee82('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xee82('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xee82('0x7'));var controller=require(_0xee82('0x8'));router[_0xee82('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xee82('0x9')]('/:id',auth[_0xee82('0xa')](),controller[_0xee82('0xb')]);router['post']('/',auth[_0xee82('0xa')](),controller['create']);router[_0xee82('0xc')](_0xee82('0xd'),auth[_0xee82('0xa')](),controller[_0xee82('0xe')]);router[_0xee82('0xf')](_0xee82('0xd'),auth[_0xee82('0xa')](),controller[_0xee82('0x10')]);module[_0xee82('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 809cf2a..5bf188e 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 _0x0457=['STRING','#0091EA','exports'];(function(_0x2389bc,_0x167cd2){var _0x170548=function(_0x2da7f2){while(--_0x2da7f2){_0x2389bc['push'](_0x2389bc['shift']());}};_0x170548(++_0x167cd2);}(_0x0457,0x11f));var _0x7045=function(_0x367e3b,_0x5d92ad){_0x367e3b=_0x367e3b-0x0;var _0x35568d=_0x0457[_0x367e3b];return _0x35568d;};'use strict';var Sequelize=require('sequelize');module[_0x7045('0x0')]={'name':{'type':Sequelize[_0x7045('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7045('0x1')],'defaultValue':_0x7045('0x2')},'description':{'type':Sequelize[_0x7045('0x1')]}}; \ No newline at end of file +var _0x7427=['STRING','name','#0091EA','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7427,0x111));var _0x7742=function(_0x242a98,_0x13988e){_0x242a98=_0x242a98-0x0;var _0x580999=_0x7427[_0x242a98];return _0x580999;};'use strict';var Sequelize=require(_0x7742('0x0'));module[_0x7742('0x1')]={'name':{'type':Sequelize[_0x7742('0x2')],'unique':_0x7742('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x7742('0x4')},'description':{'type':Sequelize[_0x7742('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 0bf4879..e220c17 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 _0x4b1f=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','apply','reject','save','update','then','destroy','Tags','UserProfileResource','error','stack','name','send','Tag','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','findAll','catch','show','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x4b1f,0x195));var _0xf4b1=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x4b1f[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require(_0xf4b1('0x0'));var rimraf=require(_0xf4b1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf4b1('0x2'));var rp=require(_0xf4b1('0x3'));var moment=require(_0xf4b1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf4b1('0x5'));var util=require(_0xf4b1('0x6'));var path=require(_0xf4b1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf4b1('0x8'));var fs=require('fs');var fs_extra=require(_0xf4b1('0x9'));var _=require(_0xf4b1('0xa'));var squel=require(_0xf4b1('0xb'));var crypto=require(_0xf4b1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf4b1('0xd'));var Papa=require('papaparse');var Redis=require(_0xf4b1('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf4b1('0xf'));var hardwareService=require(_0xf4b1('0x10'));var logger=require(_0xf4b1('0x11'))(_0xf4b1('0x12'));var utils=require(_0xf4b1('0x13'));var config=require(_0xf4b1('0x14'));var licenseUtil=require(_0xf4b1('0x15'));var db=require(_0xf4b1('0x16'))['db'];function respondWithStatusCode(_0x38afbb,_0xf66b4c){_0xf66b4c=_0xf66b4c||0xcc;return function(_0x2c4eb9){if(_0x2c4eb9){return _0x38afbb[_0xf4b1('0x17')](_0xf66b4c);}return _0x38afbb[_0xf4b1('0x18')](_0xf66b4c)['end']();};}function respondWithResult(_0x591476,_0x3ea6f3){_0x3ea6f3=_0x3ea6f3||0xc8;return function(_0x5cbc25){if(_0x5cbc25){return _0x591476['status'](_0x3ea6f3)[_0xf4b1('0x19')](_0x5cbc25);}};}function respondWithFilteredResult(_0x51c39f,_0x5764b1){return function(_0x293f59){if(_0x293f59){var _0x4968f4=typeof _0x5764b1['offset']==='undefined'&&typeof _0x5764b1['limit']===_0xf4b1('0x1a');var _0x3ee70a=_0x293f59['count'];var _0x3b378e=_0x4968f4?0x0:_0x5764b1[_0xf4b1('0x1b')];var _0x322b38=_0x4968f4?_0x293f59[_0xf4b1('0x1c')]:_0x5764b1[_0xf4b1('0x1b')]+_0x5764b1[_0xf4b1('0x1d')];var _0x5b0214;if(_0x322b38>=_0x3ee70a){_0x322b38=_0x3ee70a;_0x5b0214=0xc8;}else{_0x5b0214=0xce;}_0x51c39f[_0xf4b1('0x18')](_0x5b0214);return _0x51c39f[_0xf4b1('0x1e')]('Content-Range',_0x3b378e+'-'+_0x322b38+'/'+_0x3ee70a)[_0xf4b1('0x19')](_0x293f59);}return null;};}function patchUpdates(_0x30c239){return function(_0x56ef48){try{jsonpatch[_0xf4b1('0x1f')](_0x56ef48,_0x30c239,!![]);}catch(_0x559a64){return BPromise[_0xf4b1('0x20')](_0x559a64);}return _0x56ef48[_0xf4b1('0x21')]();};}function saveUpdates(_0x5c50e8,_0x20013c){return function(_0x29b8c1){if(_0x29b8c1){return _0x29b8c1[_0xf4b1('0x22')](_0x5c50e8)[_0xf4b1('0x23')](function(_0x58376d){return _0x58376d;});}return null;};}function removeEntity(_0x92b390,_0x474212){return function(_0x4b6c08){if(_0x4b6c08){return _0x4b6c08[_0xf4b1('0x24')]()['then'](function(){var _0x15cfc4=_0x4b6c08['get']({'plain':!![]});var _0x238fbe=_0xf4b1('0x25');return db[_0xf4b1('0x26')]['destroy']({'where':{'type':_0x238fbe,'resourceId':_0x15cfc4['id']}})[_0xf4b1('0x23')](function(){return _0x4b6c08;});})['then'](function(){_0x92b390[_0xf4b1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29493b,_0x447ae7){return function(_0x5d28af){if(!_0x5d28af){_0x29493b[_0xf4b1('0x17')](0x194);}return _0x5d28af;};}function handleError(_0x23693b,_0x5bd8ee){_0x5bd8ee=_0x5bd8ee||0x1f4;return function(_0x125bf4){logger[_0xf4b1('0x27')](_0x125bf4[_0xf4b1('0x28')]);if(_0x125bf4[_0xf4b1('0x29')]){delete _0x125bf4[_0xf4b1('0x29')];}_0x23693b[_0xf4b1('0x18')](_0x5bd8ee)[_0xf4b1('0x2a')](_0x125bf4);};}exports['index']=function(_0x56ee5e,_0x31c13c){var _0xff9a65={},_0x1cbcff={},_0x29b9f9={'count':0x0,'rows':[]};var _0x35d81b=_['map'](db[_0xf4b1('0x2b')][_0xf4b1('0x2c')],function(_0xa6bdd7){return{'name':_0xa6bdd7[_0xf4b1('0x2d')],'type':_0xa6bdd7[_0xf4b1('0x2e')][_0xf4b1('0x2f')]};});_0x1cbcff[_0xf4b1('0x30')]=_[_0xf4b1('0x31')](_0x35d81b,'name');_0x1cbcff[_0xf4b1('0x32')]=_['keys'](_0x56ee5e['query']);_0x1cbcff['filters']=_[_0xf4b1('0x33')](_0x1cbcff[_0xf4b1('0x30')],_0x1cbcff[_0xf4b1('0x32')]);_0xff9a65[_0xf4b1('0x34')]=_[_0xf4b1('0x33')](_0x1cbcff[_0xf4b1('0x30')],qs[_0xf4b1('0x35')](_0x56ee5e[_0xf4b1('0x32')]['fields']));_0xff9a65[_0xf4b1('0x34')]=_0xff9a65['attributes'][_0xf4b1('0x36')]?_0xff9a65[_0xf4b1('0x34')]:_0x1cbcff['model'];if(!_0x56ee5e[_0xf4b1('0x32')][_0xf4b1('0x37')](_0xf4b1('0x38'))){_0xff9a65[_0xf4b1('0x1d')]=qs[_0xf4b1('0x1d')](_0x56ee5e['query'][_0xf4b1('0x1d')]);_0xff9a65['offset']=qs[_0xf4b1('0x1b')](_0x56ee5e['query'][_0xf4b1('0x1b')]);}_0xff9a65[_0xf4b1('0x39')]=qs[_0xf4b1('0x3a')](_0x56ee5e['query'][_0xf4b1('0x3a')]);_0xff9a65[_0xf4b1('0x3b')]=qs[_0xf4b1('0x3c')](_[_0xf4b1('0x3d')](_0x56ee5e[_0xf4b1('0x32')],_0x1cbcff[_0xf4b1('0x3c')]),_0x35d81b);if(_0x56ee5e[_0xf4b1('0x32')]['filter']){_0xff9a65[_0xf4b1('0x3b')]=_[_0xf4b1('0x3e')](_0xff9a65[_0xf4b1('0x3b')],{'$or':_[_0xf4b1('0x31')](_0x35d81b,function(_0x39de7f){if(_0x39de7f[_0xf4b1('0x2e')]!=='VIRTUAL'){var _0x33879b={};_0x33879b[_0x39de7f[_0xf4b1('0x29')]]={'$like':'%'+_0x56ee5e['query']['filter']+'%'};return _0x33879b;}})});}_0xff9a65=_[_0xf4b1('0x3e')]({},_0xff9a65,_0x56ee5e[_0xf4b1('0x3f')]);var _0x439c9d={'where':_0xff9a65[_0xf4b1('0x3b')]};return db[_0xf4b1('0x2b')][_0xf4b1('0x1c')](_0x439c9d)[_0xf4b1('0x23')](function(_0x1600b6){_0x29b9f9['count']=_0x1600b6;if(_0x56ee5e[_0xf4b1('0x32')]['includeAll']){_0xff9a65['include']=[{'all':!![]}];}return db['Tag'][_0xf4b1('0x40')](_0xff9a65);})[_0xf4b1('0x23')](function(_0x28b9f2){_0x29b9f9['rows']=_0x28b9f2;return _0x29b9f9;})[_0xf4b1('0x23')](respondWithFilteredResult(_0x31c13c,_0xff9a65))[_0xf4b1('0x41')](handleError(_0x31c13c,null));};exports[_0xf4b1('0x42')]=function(_0x5597d5,_0x13c130){var _0x15845a={'raw':!![],'where':{'id':_0x5597d5['params']['id']}},_0x1f856c={};_0x1f856c[_0xf4b1('0x30')]=_['keys'](db[_0xf4b1('0x2b')][_0xf4b1('0x2c')]);_0x1f856c[_0xf4b1('0x32')]=_['keys'](_0x5597d5[_0xf4b1('0x32')]);_0x1f856c[_0xf4b1('0x3c')]=_['intersection'](_0x1f856c[_0xf4b1('0x30')],_0x1f856c[_0xf4b1('0x32')]);_0x15845a[_0xf4b1('0x34')]=_[_0xf4b1('0x33')](_0x1f856c['model'],qs['fields'](_0x5597d5[_0xf4b1('0x32')][_0xf4b1('0x35')]));_0x15845a['attributes']=_0x15845a[_0xf4b1('0x34')]['length']?_0x15845a[_0xf4b1('0x34')]:_0x1f856c['model'];if(_0x5597d5[_0xf4b1('0x32')][_0xf4b1('0x43')]){_0x15845a['include']=[{'all':!![]}];}_0x15845a=_[_0xf4b1('0x3e')]({},_0x15845a,_0x5597d5[_0xf4b1('0x3f')]);return db[_0xf4b1('0x2b')][_0xf4b1('0x44')](_0x15845a)[_0xf4b1('0x23')](handleEntityNotFound(_0x13c130,null))[_0xf4b1('0x23')](respondWithResult(_0x13c130,null))[_0xf4b1('0x41')](handleError(_0x13c130,null));};exports[_0xf4b1('0x45')]=function(_0x4e6e04,_0x4a9761){return db[_0xf4b1('0x2b')][_0xf4b1('0x45')](_0x4e6e04['body'],{})[_0xf4b1('0x23')](function(_0x3476b3){var _0x21dc3b=_0x4e6e04[_0xf4b1('0x46')][_0xf4b1('0x47')]({'plain':!![]});if(!_0x21dc3b)throw new Error(_0xf4b1('0x48'));if(_0x21dc3b[_0xf4b1('0x49')]===_0xf4b1('0x46')){var _0x29c3c1=_0x3476b3[_0xf4b1('0x47')]({'plain':!![]});var _0x407ecf=_0xf4b1('0x25');return db[_0xf4b1('0x4a')][_0xf4b1('0x44')]({'where':{'name':_0x407ecf,'userProfileId':_0x21dc3b[_0xf4b1('0x4b')]},'raw':!![]})[_0xf4b1('0x23')](function(_0xacaa0e){if(_0xacaa0e&&_0xacaa0e[_0xf4b1('0x4c')]===0x0){return db[_0xf4b1('0x26')][_0xf4b1('0x45')]({'name':_0x29c3c1[_0xf4b1('0x29')],'resourceId':_0x29c3c1['id'],'type':_0xacaa0e[_0xf4b1('0x29')],'sectionId':_0xacaa0e['id']},{})[_0xf4b1('0x23')](function(){return _0x3476b3;});}else{return _0x3476b3;}})[_0xf4b1('0x41')](function(_0x389ad7){logger[_0xf4b1('0x27')](_0xf4b1('0x4d'),_0x389ad7);throw _0x389ad7;});}return _0x3476b3;})[_0xf4b1('0x23')](respondWithResult(_0x4a9761,0xc9))['catch'](handleError(_0x4a9761,null));};exports[_0xf4b1('0x22')]=function(_0x479e71,_0x5bdd65){if(_0x479e71[_0xf4b1('0x4e')]['id']){delete _0x479e71[_0xf4b1('0x4e')]['id'];}return db['Tag'][_0xf4b1('0x44')]({'where':{'id':_0x479e71[_0xf4b1('0x4f')]['id']}})[_0xf4b1('0x23')](handleEntityNotFound(_0x5bdd65,null))['then'](saveUpdates(_0x479e71['body'],null))[_0xf4b1('0x23')](respondWithResult(_0x5bdd65,null))[_0xf4b1('0x41')](handleError(_0x5bdd65,null));};exports[_0xf4b1('0x24')]=function(_0x38938f,_0x402e6c){return db[_0xf4b1('0x2b')][_0xf4b1('0x44')]({'where':{'id':_0x38938f[_0xf4b1('0x4f')]['id']}})[_0xf4b1('0x23')](handleEntityNotFound(_0x402e6c,null))[_0xf4b1('0x23')](removeEntity(_0x402e6c,null))[_0xf4b1('0x41')](handleError(_0x402e6c,null));}; \ No newline at end of file +var _0x80df=['fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Tags','end','sendStatus','error','stack','name','index','Tag','rawAttributes','type','key','map','query','filters','intersection','model'];(function(_0x19494f,_0x2e0607){var _0x2d8500=function(_0x537ba7){while(--_0x537ba7){_0x19494f['push'](_0x19494f['shift']());}};_0x2d8500(++_0x2e0607);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xf80d('0x0'));var rimraf=require(_0xf80d('0x1'));var zipdir=require(_0xf80d('0x2'));var jsonpatch=require(_0xf80d('0x3'));var rp=require('request-promise');var moment=require(_0xf80d('0x4'));var BPromise=require(_0xf80d('0x5'));var Mustache=require(_0xf80d('0x6'));var util=require(_0xf80d('0x7'));var path=require(_0xf80d('0x8'));var sox=require(_0xf80d('0x9'));var csv=require(_0xf80d('0xa'));var ejs=require(_0xf80d('0xb'));var fs=require('fs');var fs_extra=require(_0xf80d('0xc'));var _=require(_0xf80d('0xd'));var squel=require('squel');var crypto=require(_0xf80d('0xe'));var jsforce=require(_0xf80d('0xf'));var deskjs=require(_0xf80d('0x10'));var toCsv=require(_0xf80d('0xa'));var querystring=require(_0xf80d('0x11'));var Papa=require(_0xf80d('0x12'));var Redis=require(_0xf80d('0x13'));var authService=require(_0xf80d('0x14'));var qs=require(_0xf80d('0x15'));var as=require(_0xf80d('0x16'));var hardwareService=require(_0xf80d('0x17'));var logger=require(_0xf80d('0x18'))(_0xf80d('0x19'));var utils=require(_0xf80d('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf80d('0x1b'))['db'];function respondWithStatusCode(_0x74ce36,_0x489bdf){_0x489bdf=_0x489bdf||0xcc;return function(_0x34e130){if(_0x34e130){return _0x74ce36['sendStatus'](_0x489bdf);}return _0x74ce36[_0xf80d('0x1c')](_0x489bdf)['end']();};}function respondWithResult(_0x4285de,_0x50c968){_0x50c968=_0x50c968||0xc8;return function(_0x3be9a9){if(_0x3be9a9){return _0x4285de[_0xf80d('0x1c')](_0x50c968)[_0xf80d('0x1d')](_0x3be9a9);}};}function respondWithFilteredResult(_0x1e1b08,_0x2098d6){return function(_0x45751c){if(_0x45751c){var _0x482043=typeof _0x2098d6[_0xf80d('0x1e')]===_0xf80d('0x1f')&&typeof _0x2098d6[_0xf80d('0x20')]===_0xf80d('0x1f');var _0x27b2ea=_0x45751c[_0xf80d('0x21')];var _0x1d104a=_0x482043?0x0:_0x2098d6[_0xf80d('0x1e')];var _0x2ea2c1=_0x482043?_0x45751c[_0xf80d('0x21')]:_0x2098d6[_0xf80d('0x1e')]+_0x2098d6[_0xf80d('0x20')];var _0x5392c5;if(_0x2ea2c1>=_0x27b2ea){_0x2ea2c1=_0x27b2ea;_0x5392c5=0xc8;}else{_0x5392c5=0xce;}_0x1e1b08[_0xf80d('0x1c')](_0x5392c5);return _0x1e1b08[_0xf80d('0x22')]('Content-Range',_0x1d104a+'-'+_0x2ea2c1+'/'+_0x27b2ea)[_0xf80d('0x1d')](_0x45751c);}return null;};}function patchUpdates(_0x539c80){return function(_0x3f3a2a){try{jsonpatch[_0xf80d('0x23')](_0x3f3a2a,_0x539c80,!![]);}catch(_0x2d5e46){return BPromise[_0xf80d('0x24')](_0x2d5e46);}return _0x3f3a2a[_0xf80d('0x25')]();};}function saveUpdates(_0x25d031,_0x446153){return function(_0x269859){if(_0x269859){return _0x269859[_0xf80d('0x26')](_0x25d031)[_0xf80d('0x27')](function(_0x33d58c){return _0x33d58c;});}return null;};}function removeEntity(_0x739968,_0x570c99){return function(_0x32ad42){if(_0x32ad42){return _0x32ad42[_0xf80d('0x28')]()['then'](function(){var _0x3353a3=_0x32ad42[_0xf80d('0x29')]({'plain':!![]});var _0x323540=_0xf80d('0x2a');return db['UserProfileResource'][_0xf80d('0x28')]({'where':{'type':_0x323540,'resourceId':_0x3353a3['id']}})[_0xf80d('0x27')](function(){return _0x32ad42;});})[_0xf80d('0x27')](function(){_0x739968[_0xf80d('0x1c')](0xcc)[_0xf80d('0x2b')]();});}};}function handleEntityNotFound(_0xde054a,_0x2fc429){return function(_0x68f2c6){if(!_0x68f2c6){_0xde054a[_0xf80d('0x2c')](0x194);}return _0x68f2c6;};}function handleError(_0x4d2579,_0xe940d6){_0xe940d6=_0xe940d6||0x1f4;return function(_0x1603a4){logger[_0xf80d('0x2d')](_0x1603a4[_0xf80d('0x2e')]);if(_0x1603a4[_0xf80d('0x2f')]){delete _0x1603a4[_0xf80d('0x2f')];}_0x4d2579[_0xf80d('0x1c')](_0xe940d6)['send'](_0x1603a4);};}exports[_0xf80d('0x30')]=function(_0x27887e,_0x214bff){var _0x435e23={},_0x5c3a1d={},_0x487d2c={'count':0x0,'rows':[]};var _0x2359f1=_['map'](db[_0xf80d('0x31')][_0xf80d('0x32')],function(_0x45f76a){return{'name':_0x45f76a['fieldName'],'type':_0x45f76a[_0xf80d('0x33')][_0xf80d('0x34')]};});_0x5c3a1d['model']=_[_0xf80d('0x35')](_0x2359f1,_0xf80d('0x2f'));_0x5c3a1d[_0xf80d('0x36')]=_['keys'](_0x27887e[_0xf80d('0x36')]);_0x5c3a1d[_0xf80d('0x37')]=_[_0xf80d('0x38')](_0x5c3a1d[_0xf80d('0x39')],_0x5c3a1d[_0xf80d('0x36')]);_0x435e23['attributes']=_[_0xf80d('0x38')](_0x5c3a1d['model'],qs[_0xf80d('0x3a')](_0x27887e[_0xf80d('0x36')][_0xf80d('0x3a')]));_0x435e23[_0xf80d('0x3b')]=_0x435e23['attributes'][_0xf80d('0x3c')]?_0x435e23[_0xf80d('0x3b')]:_0x5c3a1d[_0xf80d('0x39')];if(!_0x27887e[_0xf80d('0x36')]['hasOwnProperty'](_0xf80d('0x3d'))){_0x435e23[_0xf80d('0x20')]=qs[_0xf80d('0x20')](_0x27887e[_0xf80d('0x36')][_0xf80d('0x20')]);_0x435e23[_0xf80d('0x1e')]=qs[_0xf80d('0x1e')](_0x27887e[_0xf80d('0x36')]['offset']);}_0x435e23[_0xf80d('0x3e')]=qs[_0xf80d('0x3f')](_0x27887e[_0xf80d('0x36')]['sort']);_0x435e23[_0xf80d('0x40')]=qs['filters'](_[_0xf80d('0x41')](_0x27887e[_0xf80d('0x36')],_0x5c3a1d[_0xf80d('0x37')]),_0x2359f1);if(_0x27887e[_0xf80d('0x36')]['filter']){_0x435e23['where']=_['merge'](_0x435e23[_0xf80d('0x40')],{'$or':_[_0xf80d('0x35')](_0x2359f1,function(_0x2d0ee5){if(_0x2d0ee5[_0xf80d('0x33')]!==_0xf80d('0x42')){var _0x100dc7={};_0x100dc7[_0x2d0ee5['name']]={'$like':'%'+_0x27887e[_0xf80d('0x36')][_0xf80d('0x43')]+'%'};return _0x100dc7;}})});}_0x435e23=_[_0xf80d('0x44')]({},_0x435e23,_0x27887e['options']);var _0x14314a={'where':_0x435e23['where']};return db[_0xf80d('0x31')][_0xf80d('0x21')](_0x14314a)[_0xf80d('0x27')](function(_0x2cd371){_0x487d2c[_0xf80d('0x21')]=_0x2cd371;if(_0x27887e[_0xf80d('0x36')][_0xf80d('0x45')]){_0x435e23[_0xf80d('0x46')]=[{'all':!![]}];}return db[_0xf80d('0x31')][_0xf80d('0x47')](_0x435e23);})[_0xf80d('0x27')](function(_0x437e44){_0x487d2c[_0xf80d('0x48')]=_0x437e44;return _0x487d2c;})[_0xf80d('0x27')](respondWithFilteredResult(_0x214bff,_0x435e23))[_0xf80d('0x49')](handleError(_0x214bff,null));};exports[_0xf80d('0x4a')]=function(_0x43474d,_0x9da271){var _0x19b7eb={'raw':!![],'where':{'id':_0x43474d[_0xf80d('0x4b')]['id']}},_0x24c1e4={};_0x24c1e4[_0xf80d('0x39')]=_[_0xf80d('0x4c')](db[_0xf80d('0x31')][_0xf80d('0x32')]);_0x24c1e4['query']=_[_0xf80d('0x4c')](_0x43474d[_0xf80d('0x36')]);_0x24c1e4[_0xf80d('0x37')]=_[_0xf80d('0x38')](_0x24c1e4[_0xf80d('0x39')],_0x24c1e4['query']);_0x19b7eb[_0xf80d('0x3b')]=_[_0xf80d('0x38')](_0x24c1e4[_0xf80d('0x39')],qs[_0xf80d('0x3a')](_0x43474d[_0xf80d('0x36')][_0xf80d('0x3a')]));_0x19b7eb[_0xf80d('0x3b')]=_0x19b7eb[_0xf80d('0x3b')][_0xf80d('0x3c')]?_0x19b7eb[_0xf80d('0x3b')]:_0x24c1e4[_0xf80d('0x39')];if(_0x43474d[_0xf80d('0x36')][_0xf80d('0x45')]){_0x19b7eb[_0xf80d('0x46')]=[{'all':!![]}];}_0x19b7eb=_[_0xf80d('0x44')]({},_0x19b7eb,_0x43474d[_0xf80d('0x4d')]);return db[_0xf80d('0x31')]['find'](_0x19b7eb)[_0xf80d('0x27')](handleEntityNotFound(_0x9da271,null))[_0xf80d('0x27')](respondWithResult(_0x9da271,null))[_0xf80d('0x49')](handleError(_0x9da271,null));};exports['create']=function(_0x3e5cf6,_0x1088ca){return db['Tag']['create'](_0x3e5cf6[_0xf80d('0x4e')],{})['then'](function(_0xcb5fe7){var _0x24c70e=_0x3e5cf6[_0xf80d('0x4f')][_0xf80d('0x29')]({'plain':!![]});if(!_0x24c70e)throw new Error(_0xf80d('0x50'));if(_0x24c70e[_0xf80d('0x51')]===_0xf80d('0x4f')){var _0x114132=_0xcb5fe7[_0xf80d('0x29')]({'plain':!![]});var _0x1f20a2=_0xf80d('0x2a');return db[_0xf80d('0x52')]['find']({'where':{'name':_0x1f20a2,'userProfileId':_0x24c70e[_0xf80d('0x53')]},'raw':!![]})[_0xf80d('0x27')](function(_0x3c25d7){if(_0x3c25d7&&_0x3c25d7['autoAssociation']===0x0){return db[_0xf80d('0x54')][_0xf80d('0x55')]({'name':_0x114132['name'],'resourceId':_0x114132['id'],'type':_0x3c25d7[_0xf80d('0x2f')],'sectionId':_0x3c25d7['id']},{})[_0xf80d('0x27')](function(){return _0xcb5fe7;});}else{return _0xcb5fe7;}})['catch'](function(_0xee12ae){logger[_0xf80d('0x2d')](_0xf80d('0x56'),_0xee12ae);throw _0xee12ae;});}return _0xcb5fe7;})[_0xf80d('0x27')](respondWithResult(_0x1088ca,0xc9))['catch'](handleError(_0x1088ca,null));};exports[_0xf80d('0x26')]=function(_0x374985,_0x1a4c08){if(_0x374985['body']['id']){delete _0x374985[_0xf80d('0x4e')]['id'];}return db[_0xf80d('0x31')][_0xf80d('0x57')]({'where':{'id':_0x374985[_0xf80d('0x4b')]['id']}})[_0xf80d('0x27')](handleEntityNotFound(_0x1a4c08,null))[_0xf80d('0x27')](saveUpdates(_0x374985[_0xf80d('0x4e')],null))[_0xf80d('0x27')](respondWithResult(_0x1a4c08,null))[_0xf80d('0x49')](handleError(_0x1a4c08,null));};exports[_0xf80d('0x28')]=function(_0x543dba,_0x112342){return db[_0xf80d('0x31')][_0xf80d('0x57')]({'where':{'id':_0x543dba[_0xf80d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x112342,null))['then'](removeEntity(_0x112342,null))[_0xf80d('0x49')](handleError(_0x112342,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 56b3557..bbaf7c7 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 _0xa4ba=['../../config/logger','api','moment','request-promise','../../config/environment','./tag.attributes','exports','define','tools_tags','util'];(function(_0x5f3935,_0x20709f){var _0x123718=function(_0x5c3a40){while(--_0x5c3a40){_0x5f3935['push'](_0x5f3935['shift']());}};_0x123718(++_0x20709f);}(_0xa4ba,0x1b7));var _0xaa4b=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xa4ba[_0x35885a];return _0xe86249;};'use strict';var _=require('lodash');var util=require(_0xaa4b('0x0'));var logger=require(_0xaa4b('0x1'))(_0xaa4b('0x2'));var moment=require(_0xaa4b('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa4b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa4b('0x5'));var attributes=require(_0xaa4b('0x6'));module[_0xaa4b('0x7')]=function(_0x146035,_0x4809a9){return _0x146035[_0xaa4b('0x8')]('Tag',attributes,{'tableName':_0xaa4b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c73=['rimraf','../../config/environment','Tag','tools_tags','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x1c73,0xc2));var _0x31c7=function(_0x4f2d17,_0x13156c){_0x4f2d17=_0x4f2d17-0x0;var _0x277b0d=_0x1c73[_0x4f2d17];return _0x277b0d;};'use strict';var _=require(_0x31c7('0x0'));var util=require('util');var logger=require(_0x31c7('0x1'))(_0x31c7('0x2'));var moment=require(_0x31c7('0x3'));var BPromise=require(_0x31c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31c7('0x5'));var rimraf=require(_0x31c7('0x6'));var config=require(_0x31c7('0x7'));var attributes=require('./tag.attributes');module['exports']=function(_0x3da553,_0x597fbf){return _0x3da553['define'](_0x31c7('0x8'),attributes,{'tableName':_0x31c7('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 9ad47a8..b2c1d02 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 _0x0faf=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x504fb0,_0x4670ac){var _0x12b43f=function(_0x428477){while(--_0x428477){_0x504fb0['push'](_0x504fb0['shift']());}};_0x12b43f(++_0x4670ac);}(_0x0faf,0x132));var _0xf0fa=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0x0faf[_0x44a3b0];return _0x39e6f6;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var moment=require(_0xf0fa('0x1'));var BPromise=require(_0xf0fa('0x2'));var rs=require(_0xf0fa('0x3'));var fs=require('fs');var Redis=require(_0xf0fa('0x4'));var db=require(_0xf0fa('0x5'))['db'];var utils=require(_0xf0fa('0x6'));var logger=require(_0xf0fa('0x7'))(_0xf0fa('0x8'));var config=require(_0xf0fa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0fa('0xa')][_0xf0fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25b5c4,_0x3a703b,_0x2db1d9){return new BPromise(function(_0x587865,_0x42f7fd){return client[_0xf0fa('0xc')](_0x25b5c4,_0x2db1d9)['then'](function(_0x4df4d1){logger[_0xf0fa('0xd')](_0xf0fa('0xe'),_0x3a703b,_0xf0fa('0xf'));logger[_0xf0fa('0x10')](_0xf0fa('0x11'),_0x3a703b,_0xf0fa('0xf'),JSON[_0xf0fa('0x12')](_0x4df4d1));if(_0x4df4d1[_0xf0fa('0x13')]){if(_0x4df4d1['error'][_0xf0fa('0x14')]===0x1f4){logger['error'](_0xf0fa('0xe'),_0x3a703b,_0x4df4d1['error'][_0xf0fa('0x15')]);return _0x42f7fd(_0x4df4d1[_0xf0fa('0x13')][_0xf0fa('0x15')]);}logger['error']('Tag,\x20%s,\x20%s',_0x3a703b,_0x4df4d1[_0xf0fa('0x13')]['message']);return _0x587865(_0x4df4d1[_0xf0fa('0x13')][_0xf0fa('0x15')]);}else{logger[_0xf0fa('0xd')](_0xf0fa('0xe'),_0x3a703b,_0xf0fa('0xf'));_0x587865(_0x4df4d1[_0xf0fa('0x16')][_0xf0fa('0x15')]);}})[_0xf0fa('0x17')](function(_0x497542){logger[_0xf0fa('0x13')](_0xf0fa('0xe'),_0x3a703b,_0x497542);_0x42f7fd(_0x497542);});});} \ No newline at end of file +var _0xaa7c=['debug','stringify','error','code','message','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x2a74f8,_0x3217cc){var _0xad203a=function(_0x1fb1af){while(--_0x1fb1af){_0x2a74f8['push'](_0x2a74f8['shift']());}};_0xad203a(++_0x3217cc);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x32fa5f,_0x44198d){_0x32fa5f=_0x32fa5f-0x0;var _0x411f12=_0xaa7c[_0x32fa5f];return _0x411f12;};'use strict';var _=require(_0xcaa7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcaa7('0x1'));var db=require(_0xcaa7('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xcaa7('0x3'))(_0xcaa7('0x4'));var config=require(_0xcaa7('0x5'));var jayson=require(_0xcaa7('0x6'));var client=jayson[_0xcaa7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b9df0,_0x5bd940,_0x55f6a4){return new BPromise(function(_0x4e4fc1,_0x126043){return client[_0xcaa7('0x8')](_0x4b9df0,_0x55f6a4)['then'](function(_0x20cd40){logger[_0xcaa7('0x9')](_0xcaa7('0xa'),_0x5bd940,_0xcaa7('0xb'));logger[_0xcaa7('0xc')]('Tag,\x20%s,\x20%s,\x20%s',_0x5bd940,_0xcaa7('0xb'),JSON[_0xcaa7('0xd')](_0x20cd40));if(_0x20cd40[_0xcaa7('0xe')]){if(_0x20cd40[_0xcaa7('0xe')][_0xcaa7('0xf')]===0x1f4){logger[_0xcaa7('0xe')]('Tag,\x20%s,\x20%s',_0x5bd940,_0x20cd40[_0xcaa7('0xe')][_0xcaa7('0x10')]);return _0x126043(_0x20cd40[_0xcaa7('0xe')][_0xcaa7('0x10')]);}logger[_0xcaa7('0xe')](_0xcaa7('0xa'),_0x5bd940,_0x20cd40[_0xcaa7('0xe')]['message']);return _0x4e4fc1(_0x20cd40['error'][_0xcaa7('0x10')]);}else{logger[_0xcaa7('0x9')](_0xcaa7('0xa'),_0x5bd940,_0xcaa7('0xb'));_0x4e4fc1(_0x20cd40['result'][_0xcaa7('0x10')]);}})[_0xcaa7('0x11')](function(_0x23c8f3){logger[_0xcaa7('0xe')](_0xcaa7('0xa'),_0x5bd940,_0x23c8f3);_0x126043(_0x23c8f3);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 10e703e..5e81aa0 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 c51c662..7bfa568 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x14e69a,_0x2eac7c){var _0x26adb8=function(_0x21d3b7){while(--_0x21d3b7){_0x14e69a['push'](_0x14e69a['shift']());}};_0x26adb8(++_0x2eac7c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'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 881ba0e..92bd31e 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 _0xa87b=['socket.io-emitter','./team.socket','register','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','stack','name','status','send','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','Team','includeAll','include','findAll','then','rows','catch','show','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','destroy','sequelize','transaction','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','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Queue','addQueues','Unknown\x20channel','add','Queues','ids','removeQueues','addAgents','isArray','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','interface','UserVoiceQueueRt','upsert','voicePause','all','VoicePrefixId','removeAgents','Chat','Queue:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults'];(function(_0x56fbb6,_0x570f05){var _0x4e9a77=function(_0x320be4){while(--_0x320be4){_0x56fbb6['push'](_0x56fbb6['shift']());}};_0x4e9a77(++_0x570f05);}(_0xa87b,0x7c));var _0xba87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa87b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba87('0x0'));var zipdir=require(_0xba87('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba87('0x2'));var moment=require(_0xba87('0x3'));var BPromise=require(_0xba87('0x4'));var Mustache=require(_0xba87('0x5'));var util=require(_0xba87('0x6'));var path=require(_0xba87('0x7'));var sox=require(_0xba87('0x8'));var csv=require(_0xba87('0x9'));var ejs=require(_0xba87('0xa'));var fs=require('fs');var fs_extra=require(_0xba87('0xb'));var _=require(_0xba87('0xc'));var squel=require('squel');var crypto=require(_0xba87('0xd'));var jsforce=require(_0xba87('0xe'));var deskjs=require(_0xba87('0xf'));var toCsv=require(_0xba87('0x9'));var querystring=require(_0xba87('0x10'));var Papa=require(_0xba87('0x11'));var Redis=require('ioredis');var authService=require(_0xba87('0x12'));var qs=require(_0xba87('0x13'));var as=require(_0xba87('0x14'));var hardwareService=require(_0xba87('0x15'));var logger=require(_0xba87('0x16'))(_0xba87('0x17'));var utils=require(_0xba87('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xba87('0x19'))['db'];config[_0xba87('0x1a')]=_[_0xba87('0x1b')](config[_0xba87('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xba87('0x1c'))(new Redis(config['redis']));require(_0xba87('0x1d'))[_0xba87('0x1e')](socket);function respondWithStatusCode(_0x2bdd1b,_0x1d1c93){_0x1d1c93=_0x1d1c93||0xcc;return function(_0x140b74){if(_0x140b74){return _0x2bdd1b[_0xba87('0x1f')](_0x1d1c93);}return _0x2bdd1b['status'](_0x1d1c93)[_0xba87('0x20')]();};}function respondWithResult(_0x4a55ec,_0x30b1cb){_0x30b1cb=_0x30b1cb||0xc8;return function(_0x2b6b40){if(_0x2b6b40){return _0x4a55ec['status'](_0x30b1cb)[_0xba87('0x21')](_0x2b6b40);}};}function respondWithFilteredResult(_0xc358fb,_0x1932f1){return function(_0x3fb4ff){if(_0x3fb4ff){var _0x13eefb=typeof _0x1932f1[_0xba87('0x22')]===_0xba87('0x23')&&typeof _0x1932f1[_0xba87('0x24')]===_0xba87('0x23');var _0x154ef8=_0x3fb4ff[_0xba87('0x25')];var _0x1fc262=_0x13eefb?0x0:_0x1932f1['offset'];var _0x667f41=_0x13eefb?_0x3fb4ff['count']:_0x1932f1[_0xba87('0x22')]+_0x1932f1[_0xba87('0x24')];var _0x1a7ac7;if(_0x667f41>=_0x154ef8){_0x667f41=_0x154ef8;_0x1a7ac7=0xc8;}else{_0x1a7ac7=0xce;}_0xc358fb['status'](_0x1a7ac7);return _0xc358fb[_0xba87('0x26')](_0xba87('0x27'),_0x1fc262+'-'+_0x667f41+'/'+_0x154ef8)[_0xba87('0x21')](_0x3fb4ff);}return null;};}function patchUpdates(_0xe9972e){return function(_0x20a0b0){try{jsonpatch['apply'](_0x20a0b0,_0xe9972e,!![]);}catch(_0x12d668){return BPromise['reject'](_0x12d668);}return _0x20a0b0['save']();};}function saveUpdates(_0x1a5e50,_0x7c2bc1){return function(_0x3fb963){if(_0x3fb963){return _0x3fb963['update'](_0x1a5e50)['then'](function(_0x140d87){return _0x140d87;});}return null;};}function handleEntityNotFound(_0xcd874c,_0x1c8878){return function(_0x4ea6a8){if(!_0x4ea6a8){_0xcd874c['sendStatus'](0x194);}return _0x4ea6a8;};}function handleError(_0x423384,_0x39f778){_0x39f778=_0x39f778||0x1f4;return function(_0x41fc65){logger['error'](_0x41fc65[_0xba87('0x28')]);if(_0x41fc65[_0xba87('0x29')]){delete _0x41fc65[_0xba87('0x29')];}_0x423384[_0xba87('0x2a')](_0x39f778)[_0xba87('0x2b')](_0x41fc65);};}exports[_0xba87('0x2c')]=function(_0x4af327,_0x127a18){var _0x540682={},_0x23fd2b={},_0x2c2977={'count':0x0,'rows':[]};var _0x4a25b3=_[_0xba87('0x2d')](db['Team'][_0xba87('0x2e')],function(_0x15fe60){return{'name':_0x15fe60[_0xba87('0x2f')],'type':_0x15fe60['type'][_0xba87('0x30')]};});_0x23fd2b['model']=_[_0xba87('0x2d')](_0x4a25b3,_0xba87('0x29'));_0x23fd2b[_0xba87('0x31')]=_[_0xba87('0x32')](_0x4af327[_0xba87('0x31')]);_0x23fd2b[_0xba87('0x33')]=_['intersection'](_0x23fd2b[_0xba87('0x34')],_0x23fd2b[_0xba87('0x31')]);_0x540682[_0xba87('0x35')]=_[_0xba87('0x36')](_0x23fd2b[_0xba87('0x34')],qs[_0xba87('0x37')](_0x4af327[_0xba87('0x31')][_0xba87('0x37')]));_0x540682[_0xba87('0x35')]=_0x540682[_0xba87('0x35')][_0xba87('0x38')]?_0x540682[_0xba87('0x35')]:_0x23fd2b[_0xba87('0x34')];if(!_0x4af327[_0xba87('0x31')][_0xba87('0x39')](_0xba87('0x3a'))){_0x540682[_0xba87('0x24')]=qs[_0xba87('0x24')](_0x4af327['query'][_0xba87('0x24')]);_0x540682[_0xba87('0x22')]=qs[_0xba87('0x22')](_0x4af327[_0xba87('0x31')][_0xba87('0x22')]);}_0x540682[_0xba87('0x3b')]=qs['sort'](_0x4af327[_0xba87('0x31')][_0xba87('0x3c')]);_0x540682[_0xba87('0x3d')]=qs[_0xba87('0x33')](_[_0xba87('0x3e')](_0x4af327['query'],_0x23fd2b[_0xba87('0x33')]),_0x4a25b3);if(_0x4af327['query']['filter']){_0x540682[_0xba87('0x3d')]=_[_0xba87('0x3f')](_0x540682[_0xba87('0x3d')],{'$or':_[_0xba87('0x2d')](_0x4a25b3,function(_0x144518){if(_0x144518[_0xba87('0x40')]!==_0xba87('0x41')){var _0x1841b1={};_0x1841b1[_0x144518[_0xba87('0x29')]]={'$like':'%'+_0x4af327[_0xba87('0x31')]['filter']+'%'};return _0x1841b1;}})});}_0x540682=_[_0xba87('0x3f')]({},_0x540682,_0x4af327[_0xba87('0x42')]);var _0x499bbb={'where':_0x540682[_0xba87('0x3d')]};return db[_0xba87('0x43')][_0xba87('0x25')](_0x499bbb)['then'](function(_0xb0e5e3){_0x2c2977[_0xba87('0x25')]=_0xb0e5e3;if(_0x4af327[_0xba87('0x31')][_0xba87('0x44')]){_0x540682[_0xba87('0x45')]=[{'all':!![]}];}return db['Team'][_0xba87('0x46')](_0x540682);})[_0xba87('0x47')](function(_0x4166aa){_0x2c2977[_0xba87('0x48')]=_0x4166aa;return _0x2c2977;})['then'](respondWithFilteredResult(_0x127a18,_0x540682))[_0xba87('0x49')](handleError(_0x127a18,null));};exports[_0xba87('0x4a')]=function(_0x33b287,_0x2603b8){var _0x3a241c={'raw':![],'where':{'id':_0x33b287['params']['id']}},_0xb903c3={};_0xb903c3[_0xba87('0x34')]=_[_0xba87('0x32')](db[_0xba87('0x43')]['rawAttributes']);_0xb903c3[_0xba87('0x31')]=_[_0xba87('0x32')](_0x33b287[_0xba87('0x31')]);_0xb903c3[_0xba87('0x33')]=_[_0xba87('0x36')](_0xb903c3[_0xba87('0x34')],_0xb903c3[_0xba87('0x31')]);_0x3a241c['attributes']=_[_0xba87('0x36')](_0xb903c3['model'],qs[_0xba87('0x37')](_0x33b287['query'][_0xba87('0x37')]));_0x3a241c[_0xba87('0x35')]=_0x3a241c[_0xba87('0x35')][_0xba87('0x38')]?_0x3a241c[_0xba87('0x35')]:_0xb903c3[_0xba87('0x34')];if(_0x33b287[_0xba87('0x31')][_0xba87('0x44')]){_0x3a241c[_0xba87('0x45')]=[{'all':!![]}];}_0x3a241c=_[_0xba87('0x3f')]({},_0x3a241c,_0x33b287[_0xba87('0x42')]);return db['Team'][_0xba87('0x4b')](_0x3a241c)['then'](handleEntityNotFound(_0x2603b8,null))['then'](respondWithResult(_0x2603b8,null))[_0xba87('0x49')](handleError(_0x2603b8,null));};exports[_0xba87('0x4c')]=function(_0x46786e,_0x25acc7){return db[_0xba87('0x43')][_0xba87('0x4c')](_0x46786e['body'],{})[_0xba87('0x47')](function(_0x4b94b1){var _0x4af2e7=_0x46786e[_0xba87('0x4d')][_0xba87('0x4e')]({'plain':!![]});if(!_0x4af2e7)throw new Error(_0xba87('0x4f'));if(_0x4af2e7[_0xba87('0x50')]==='user'){var _0x3132af=_0x4b94b1['get']({'plain':!![]});var _0x307dc9='Teams';return db[_0xba87('0x51')][_0xba87('0x4b')]({'where':{'name':_0x307dc9,'userProfileId':_0x4af2e7[_0xba87('0x52')]},'raw':!![]})[_0xba87('0x47')](function(_0x350328){if(_0x350328&&_0x350328['autoAssociation']===0x0){return db[_0xba87('0x53')][_0xba87('0x4c')]({'name':_0x3132af[_0xba87('0x29')],'resourceId':_0x3132af['id'],'type':_0x350328[_0xba87('0x29')],'sectionId':_0x350328['id']},{})[_0xba87('0x47')](function(){return _0x4b94b1;});}else{return _0x4b94b1;}})[_0xba87('0x49')](function(_0x5a8490){logger[_0xba87('0x54')](_0xba87('0x55'),_0x5a8490);throw _0x5a8490;});}return _0x4b94b1;})[_0xba87('0x47')](respondWithResult(_0x25acc7,0xc9))['catch'](handleError(_0x25acc7,null));};exports[_0xba87('0x56')]=function(_0x4c45de,_0x3bdcb5){if(_0x4c45de[_0xba87('0x57')]['id']){delete _0x4c45de[_0xba87('0x57')]['id'];}return db[_0xba87('0x43')][_0xba87('0x4b')]({'where':{'id':_0x4c45de[_0xba87('0x58')]['id']}})[_0xba87('0x47')](handleEntityNotFound(_0x3bdcb5,null))['then'](saveUpdates(_0x4c45de['body'],null))[_0xba87('0x47')](respondWithResult(_0x3bdcb5,null))[_0xba87('0x49')](handleError(_0x3bdcb5,null));};exports[_0xba87('0x59')]=function(_0x2d1886,_0x5aae68){var _0x2d775c=_0x2d1886[_0xba87('0x58')]['id'];var _0x3a2582=[];return db[_0xba87('0x5a')][_0xba87('0x5b')](function(_0xc6930e){var _0x4b1b69=_0xba87('0x5c')+_0x2d775c;return db[_0xba87('0x5a')][_0xba87('0x31')](_0x4b1b69,{'type':db[_0xba87('0x5d')][_0xba87('0x5e')][_0xba87('0x5f')],'raw':!![],'transaction':_0xc6930e})[_0xba87('0x47')](function(_0xfcb79a){_0x3a2582=_['map'](_0xfcb79a,function(_0x56b09f){return Number(_0x56b09f[_0xba87('0x60')]);});})[_0xba87('0x47')](function(){var _0x50ee14=_0xba87('0x61')+_0x2d775c;return db[_0xba87('0x5a')][_0xba87('0x31')](_0x50ee14,{'type':db[_0xba87('0x5d')][_0xba87('0x5e')][_0xba87('0x5f')],'raw':!![],'transaction':_0xc6930e});})[_0xba87('0x47')](function(_0x615ea5){var _0x264aac=_[_0xba87('0x2d')](_0x615ea5,function(_0x1f7476){return Number(_0x1f7476['VoiceQueueId']);});return db[_0xba87('0x62')][_0xba87('0x59')]({'where':{'UserId':{'$in':_0x3a2582},'VoiceQueueId':{'$in':_0x264aac}},'transaction':_0xc6930e});})[_0xba87('0x47')](function(){var _0x1d6c1d=_0xba87('0x63')+_0x2d775c;return db[_0xba87('0x5a')][_0xba87('0x31')](_0x1d6c1d,{'type':db[_0xba87('0x5d')][_0xba87('0x5e')]['SELECT'],'raw':!![],'transaction':_0xc6930e});})[_0xba87('0x47')](function(_0x21b4cf){var _0x121c45=_[_0xba87('0x2d')](_0x21b4cf,function(_0x43078a){return Number(_0x43078a[_0xba87('0x64')]);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x3a2582},'MailQueueId':{'$in':_0x121c45}},'transaction':_0xc6930e});})[_0xba87('0x47')](function(){var _0x1c889c='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2d775c;return db[_0xba87('0x5a')][_0xba87('0x31')](_0x1c889c,{'type':db[_0xba87('0x5d')][_0xba87('0x5e')][_0xba87('0x5f')],'raw':!![],'transaction':_0xc6930e});})[_0xba87('0x47')](function(_0x1c5f0d){var _0x5da8f6=_[_0xba87('0x2d')](_0x1c5f0d,function(_0x3f6a2f){return Number(_0x3f6a2f['SmsQueueId']);});return db['UserSmsQueue'][_0xba87('0x59')]({'where':{'UserId':{'$in':_0x3a2582},'SmsQueueId':{'$in':_0x5da8f6}},'transaction':_0xc6930e});})[_0xba87('0x47')](function(){var _0x1eb2c2=_0xba87('0x65')+_0x2d775c;return db['sequelize']['query'](_0x1eb2c2,{'type':db[_0xba87('0x5d')][_0xba87('0x5e')][_0xba87('0x5f')],'raw':!![],'transaction':_0xc6930e});})[_0xba87('0x47')](function(_0x2a2dd6){var _0x9576c0=_['map'](_0x2a2dd6,function(_0x9d75c8){return Number(_0x9d75c8['ChatQueueId']);});return db[_0xba87('0x66')][_0xba87('0x59')]({'where':{'UserId':{'$in':_0x3a2582},'ChatQueueId':{'$in':_0x9576c0}},'transaction':_0xc6930e});})['then'](function(){var _0x3b8a41=_0xba87('0x67')+_0x2d775c;return db[_0xba87('0x5a')]['query'](_0x3b8a41,{'type':db[_0xba87('0x5d')][_0xba87('0x5e')][_0xba87('0x5f')],'raw':!![],'transaction':_0xc6930e});})[_0xba87('0x47')](function(_0x55bab8){var _0x1d68fe=_[_0xba87('0x2d')](_0x55bab8,function(_0x57a9c7){return Number(_0x57a9c7[_0xba87('0x68')]);});return db[_0xba87('0x69')][_0xba87('0x59')]({'where':{'UserId':{'$in':_0x3a2582},'FaxQueueId':{'$in':_0x1d68fe}},'transaction':_0xc6930e});})[_0xba87('0x47')](function(){var _0x118ecb=_0xba87('0x6a')+_0x2d775c;return db[_0xba87('0x5a')]['query'](_0x118ecb,{'type':db[_0xba87('0x5d')][_0xba87('0x5e')][_0xba87('0x5f')],'raw':!![],'transaction':_0xc6930e});})['then'](function(_0x103021){var _0x337faf=_[_0xba87('0x2d')](_0x103021,function(_0x3654c3){return Number(_0x3654c3[_0xba87('0x6b')]);});return db[_0xba87('0x6c')][_0xba87('0x59')]({'where':{'UserId':{'$in':_0x3a2582},'OpenchannelQueueId':{'$in':_0x337faf}},'transaction':_0xc6930e});})[_0xba87('0x47')](function(){var _0x3329d2='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2d775c;return db['sequelize'][_0xba87('0x31')](_0x3329d2,{'type':db[_0xba87('0x5d')][_0xba87('0x5e')][_0xba87('0x5f')],'raw':!![],'transaction':_0xc6930e});})[_0xba87('0x47')](function(_0x5c69cc){var _0x3cce4a=_['map'](_0x5c69cc,function(_0x264320){return Number(_0x264320[_0xba87('0x6d')]);});return db[_0xba87('0x6e')][_0xba87('0x59')]({'where':{'UserId':{'$in':_0x3a2582},'WhatsappQueueId':{'$in':_0x3cce4a}},'transaction':_0xc6930e});})[_0xba87('0x47')](function(){return db[_0xba87('0x6f')][_0xba87('0x4b')]({'where':{'TeamId':_0x2d775c}});})[_0xba87('0x47')](function(_0x1eecd2){if(_0x1eecd2===null){return;}return db[_0xba87('0x70')]['destroy']({'where':{'UserId':{'$in':_0x3a2582},'VoicePrefixId':_0x1eecd2['VoicePrefixId']},'transaction':_0xc6930e});})['then'](function(){return db['Team'][_0xba87('0x59')]({'where':{'id':_0x2d775c},'cascade':!![],'transaction':_0xc6930e});})['then'](function(_0xc9797d){if(_0xc9797d===0x0){_0x5aae68['sendStatus'](0x194);}else{return db[_0xba87('0x53')]['destroy']({'where':{'type':'Teams','resourceId':_0x2d775c},'cascade':!![],'transaction':_0xc6930e})[_0xba87('0x47')](function(){_0x5aae68['status'](0xcc)[_0xba87('0x20')]();});}})[_0xba87('0x49')](function(_0x4bc4c0){_0x5aae68[_0xba87('0x2a')](0x1f4)[_0xba87('0x2b')](_0x4bc4c0);});});};exports['getQueues']=function(_0x731bb2,_0x25899d,_0x32282d){return db[_0xba87('0x43')][_0xba87('0x71')]({'where':{'id':_0x731bb2['params']['id']}})['then'](handleEntityNotFound(_0x25899d,null))[_0xba87('0x47')](function(_0x48aee9){if(!_0x731bb2['query'][_0xba87('0x72')]||!utils[_0xba87('0x73')](_0x731bb2[_0xba87('0x31')][_0xba87('0x72')])){throw new db['Sequelize'][(_0xba87('0x74'))]('Unknown\x20channel');}var _0xbb84ce={};var _0x28131a={};_0x28131a['model']=_['keys'](db[_[_0xba87('0x75')](_0x731bb2[_0xba87('0x31')][_0xba87('0x72')][_0xba87('0x76')]())+_0xba87('0x77')]['rawAttributes']);_0x28131a[_0xba87('0x31')]=_[_0xba87('0x32')](_0x731bb2[_0xba87('0x31')]);_0x28131a[_0xba87('0x33')]=_['intersection'](_0x28131a[_0xba87('0x34')],_0x28131a[_0xba87('0x31')]);_0xbb84ce[_0xba87('0x35')]=_[_0xba87('0x36')](_0x28131a[_0xba87('0x34')],qs[_0xba87('0x37')](_0x731bb2[_0xba87('0x31')][_0xba87('0x37')]));_0xbb84ce[_0xba87('0x35')]=_0xbb84ce[_0xba87('0x35')]['length']?_0xbb84ce['attributes']:_0x28131a[_0xba87('0x34')];_0xbb84ce[_0xba87('0x24')]=qs['limit'](_0x731bb2[_0xba87('0x31')][_0xba87('0x24')]);_0xbb84ce[_0xba87('0x22')]=qs[_0xba87('0x22')](_0x731bb2[_0xba87('0x31')][_0xba87('0x22')]);_0xbb84ce[_0xba87('0x3b')]=qs['sort'](_0x731bb2[_0xba87('0x31')]['sort']);_0xbb84ce[_0xba87('0x3d')]=qs[_0xba87('0x33')](_[_0xba87('0x3e')](_0x731bb2[_0xba87('0x31')],_0x28131a[_0xba87('0x33')]));_0xbb84ce=_[_0xba87('0x3f')]({},_0xbb84ce,_0x731bb2['options']);return _0x48aee9['get'+_[_0xba87('0x75')](_0x731bb2[_0xba87('0x31')][_0xba87('0x72')][_0xba87('0x76')]())+'Queues'](_0xbb84ce);})[_0xba87('0x47')](respondWithResult(_0x25899d,null))[_0xba87('0x49')](handleError(_0x25899d,null));};exports[_0xba87('0x78')]=function(_0x550d7c,_0x54dd26,_0x4f24dc){return db[_0xba87('0x43')]['findOne']({'where':{'id':_0x550d7c[_0xba87('0x58')]['id']}})[_0xba87('0x47')](function(_0x16e352){if(_0x16e352){if(!_0x550d7c['body'][_0xba87('0x72')]||!utils[_0xba87('0x73')](_0x550d7c['body'][_0xba87('0x72')])){throw new db[(_0xba87('0x5d'))]['ValidationError'](_0xba87('0x79'));}return _0x16e352[_0xba87('0x7a')+_[_0xba87('0x75')](_0x550d7c[_0xba87('0x57')][_0xba87('0x72')][_0xba87('0x76')]())+_0xba87('0x7b')](_0x550d7c[_0xba87('0x57')][_0xba87('0x7c')]);}return null;})[_0xba87('0x47')](handleEntityNotFound(_0x54dd26,null))['then'](respondWithStatusCode(_0x54dd26,null))[_0xba87('0x49')](handleError(_0x54dd26,null));};exports[_0xba87('0x7d')]=function(_0xb1cc18,_0x90a068,_0x1d7f56){return db[_0xba87('0x43')][_0xba87('0x71')]({'where':{'id':_0xb1cc18[_0xba87('0x58')]['id']}})['then'](function(_0x1ae91b){if(_0x1ae91b){if(!_0xb1cc18[_0xba87('0x31')]['channel']||!utils[_0xba87('0x73')](_0xb1cc18['query'][_0xba87('0x72')])){throw new db[(_0xba87('0x5d'))]['ValidationError'](_0xba87('0x79'));}return _0x1ae91b['remove'+_[_0xba87('0x75')](_0xb1cc18['query'][_0xba87('0x72')][_0xba87('0x76')]())+'Queues'](_0xb1cc18['query'][_0xba87('0x7c')]);}return null;})[_0xba87('0x47')](handleEntityNotFound(_0x90a068,null))[_0xba87('0x47')](respondWithStatusCode(_0x90a068,null))[_0xba87('0x49')](handleError(_0x90a068,null));};exports[_0xba87('0x7e')]=function(_0x1ddcbb,_0x22144d){var _0x2079bd=_[_0xba87('0x7f')](_0x1ddcbb[_0xba87('0x57')]['ids'])?_0x1ddcbb['body'][_0xba87('0x7c')]:[_0x1ddcbb[_0xba87('0x57')][_0xba87('0x7c')]];var _0x2d72d5=_0x1ddcbb[_0xba87('0x58')]['id'];return db[_0xba87('0x43')]['find']({'where':{'id':_0x2d72d5}})[_0xba87('0x47')](handleEntityNotFound(_0x22144d,null))[_0xba87('0x47')](function(_0x2c72a8){if(_0x2c72a8){var _0x4641ae=[_0xba87('0x80'),'Chat',_0xba87('0x81'),_0xba87('0x82'),_0xba87('0x83'),_0xba87('0x84'),_0xba87('0x85')];return db[_0xba87('0x5a')][_0xba87('0x5b')](function(_0x40f34d){var _0xf70366=_[_0xba87('0x2d')](_0x4641ae,function(_0x25b303){var _0x5ea717={'attributes':['id',_0xba87('0x29')]};if(_0x25b303===_0xba87('0x80')){_0x5ea717['through']={'attributes':[_0xba87('0x86')]};}return _0x2c72a8[_0xba87('0x4e')+_0x25b303+_0xba87('0x7b')](_0x5ea717)[_0xba87('0x47')](function(_0x5a0234){var _0x1e5ac5=_['map'](_0x5a0234,function(_0x43dbcf){var _0x34a485=_['map'](_0x2079bd,function(_0x336566){var _0x10655e={'where':{'UserId':_0x336566,[_0x25b303+_0xba87('0x87')]:_0x43dbcf['id']},'transaction':_0x40f34d};if(_0x25b303===_0xba87('0x80')){_0x10655e['defaults']={'penalty':_0x43dbcf[_0xba87('0x88')][_0xba87('0x86')]};}return db[_0xba87('0x89')+_0x25b303+_0xba87('0x77')][_0xba87('0x8a')](_0x10655e)[_0xba87('0x47')](function(){socket[_0xba87('0x8b')]('user'+_0x25b303+_0xba87('0x8c'),{'UserId':_0x336566,[_0x25b303+_0xba87('0x87')]:_0x43dbcf['id']});if(_0x25b303!=='Voice'){return;}return db[_0xba87('0x89')]['findAll']({'where':{'id':_0x2079bd,'online':0x1},'attributes':['id','name',_0xba87('0x8d'),'voicePause',_0xba87('0x8e')],'raw':!![]})[_0xba87('0x47')](function(_0x5ed595){var _0x732d17=_['map'](_0x5ed595,function(_0x5644dc){return db[_0xba87('0x8f')][_0xba87('0x90')]({'membername':_0x5644dc['name'],'UserId':_0x5644dc['id'],'queue_name':_0x43dbcf['name'],'VoiceQueueId':_0x43dbcf['id'],'interface':_['isNil'](_0x5644dc[_0xba87('0x8e')])?util['format']('SIP/%s',_0x5644dc[_0xba87('0x29')]):_0x5644dc[_0xba87('0x8e')],'paused':_0x5644dc[_0xba87('0x91')]||![],'penalty':_0x43dbcf[_0xba87('0x88')][_0xba87('0x86')]},{'transaction':_0x40f34d});});return Promise['all'](_0x732d17);});});});return Promise[_0xba87('0x92')](_0x34a485);});return Promise[_0xba87('0x92')](_0x1e5ac5);})[_0xba87('0x47')](function(){return db['TeamVoicePrefix'][_0xba87('0x71')]({'where':{'teamId':_0x2d72d5}})['then'](function(_0x33737e){if(_0x33737e){var _0x1b6d16=_[_0xba87('0x2d')](_0x2079bd,function(_0xc6d9e){db['UserVoicePrefix']['upsert']({'UserId':_0xc6d9e,'VoicePrefixId':_0x33737e[_0xba87('0x93')]});});return Promise[_0xba87('0x92')](_0x1b6d16);}});});});return Promise[_0xba87('0x92')](_0xf70366)[_0xba87('0x47')](function(){return _0x2c72a8[_0xba87('0x7e')](_0x2079bd,{'transaction':_0x40f34d})['spread'](function(_0xb3238f){return _0xb3238f;});});});}})['then'](respondWithResult(_0x22144d,null))[_0xba87('0x49')](handleError(_0x22144d,null));};exports[_0xba87('0x94')]=function(_0x5e376e,_0x5e9141){var _0x1259d4=_[_0xba87('0x7f')](_0x5e376e['query'][_0xba87('0x7c')])?_0x5e376e[_0xba87('0x31')][_0xba87('0x7c')]:[_0x5e376e[_0xba87('0x31')][_0xba87('0x7c')]];var _0x1a6792=_0x5e376e['params']['id'];return db[_0xba87('0x43')][_0xba87('0x4b')]({'where':{'id':_0x1a6792}})[_0xba87('0x47')](handleEntityNotFound(_0x5e9141,null))[_0xba87('0x47')](function(_0x3456ed){if(_0x3456ed){var _0x484137=['Voice',_0xba87('0x95'),_0xba87('0x81'),_0xba87('0x82'),'Fax',_0xba87('0x84'),_0xba87('0x85')];return db[_0xba87('0x5a')][_0xba87('0x5b')](function(_0x439a67){var _0xe97ba0=_[_0xba87('0x2d')](_0x484137,function(_0x2b4a94){var _0x3ef362={'attributes':['id','name']};return _0x3456ed[_0xba87('0x4e')+_0x2b4a94+_0xba87('0x7b')](_0x3ef362)[_0xba87('0x47')](function(_0x1ba61b){var _0x3db324=_['map'](_0x1ba61b,function(_0x417632){return _0x417632[_0xba87('0x94')](_0x1259d4,{'transaction':_0x439a67})[_0xba87('0x47')](function(){var _0x596fdf=_[_0xba87('0x2d')](_0x1259d4,function(_0x333064){socket['emit'](_0xba87('0x4d')+_0x2b4a94+_0xba87('0x96'),{'UserId':Number(_0x333064),[_0x2b4a94+_0xba87('0x87')]:_0x417632['id']});if(_0x2b4a94!==_0xba87('0x80')){return;}return db[_0xba87('0x8f')][_0xba87('0x59')]({'where':{'VoiceQueueId':_0x417632['id'],'UserId':_0x333064},'transaction':_0x439a67});});return Promise[_0xba87('0x92')](_0x596fdf);});});return Promise[_0xba87('0x92')](_0x3db324);});});return Promise['all'](_0xe97ba0)['then'](function(){return _0x3456ed['removeAgents'](_0x1259d4,{'transaction':_0x439a67});})[_0xba87('0x47')](function(){return db[_0xba87('0x6f')][_0xba87('0x71')]({'where':{'teamId':_0x1a6792}})[_0xba87('0x47')](function(_0x2165f7){if(_0x2165f7){var _0xace92f=_['map'](_0x1259d4,function(_0x1fcaae){db[_0xba87('0x70')]['destroy']({'where':{'UserId':_0x1fcaae,'VoicePrefixId':_0x2165f7[_0xba87('0x93')]}});});return Promise[_0xba87('0x92')](_0xace92f);}});});});}})['then'](respondWithStatusCode(_0x5e9141,null))[_0xba87('0x49')](handleError(_0x5e9141,null));};exports[_0xba87('0x97')]=function(_0x59cab2,_0x1cc436,_0x29e830){var _0x46a310={};var _0x52b79e={};var _0x1b846b;var _0x40138a;return db[_0xba87('0x43')][_0xba87('0x71')]({'where':{'id':_0x59cab2[_0xba87('0x58')]['id']}})['then'](handleEntityNotFound(_0x1cc436,null))[_0xba87('0x47')](function(_0x17ead0){if(_0x17ead0){_0x1b846b=_0x17ead0;_0x52b79e[_0xba87('0x34')]=_['keys'](db[_0xba87('0x89')][_0xba87('0x2e')]);_0x52b79e[_0xba87('0x31')]=_[_0xba87('0x32')](_0x59cab2[_0xba87('0x31')]);_0x52b79e['filters']=_[_0xba87('0x36')](_0x52b79e[_0xba87('0x34')],_0x52b79e[_0xba87('0x31')]);_0x46a310[_0xba87('0x35')]=_[_0xba87('0x36')](_0x52b79e[_0xba87('0x34')],qs['fields'](_0x59cab2[_0xba87('0x31')][_0xba87('0x37')]));_0x46a310['attributes']=_0x46a310[_0xba87('0x35')][_0xba87('0x38')]?_0x46a310['attributes']:_0x52b79e[_0xba87('0x34')];_0x46a310[_0xba87('0x3b')]=qs[_0xba87('0x3c')](_0x59cab2['query']['sort']);_0x46a310['where']=qs[_0xba87('0x33')](_[_0xba87('0x3e')](_0x59cab2[_0xba87('0x31')],_0x52b79e['filters']));if(_0x59cab2[_0xba87('0x31')]['filter']){_0x46a310[_0xba87('0x3d')]=_['merge'](_0x46a310[_0xba87('0x3d')],{'$or':_['map'](_0x46a310[_0xba87('0x35')],function(_0x4cbe84){var _0x3a7f30={};_0x3a7f30[_0x4cbe84]={'$like':'%'+_0x59cab2['query']['filter']+'%'};return _0x3a7f30;})});}_0x46a310=_[_0xba87('0x3f')]({},_0x46a310,_0x59cab2[_0xba87('0x42')]);return _0x1b846b[_0xba87('0x97')](_0x46a310);}})[_0xba87('0x47')](function(_0x41b26c){if(_0x41b26c){_0x40138a=_0x41b26c[_0xba87('0x38')];if(!_0x59cab2[_0xba87('0x31')][_0xba87('0x39')](_0xba87('0x3a'))){_0x46a310['limit']=qs[_0xba87('0x24')](_0x59cab2[_0xba87('0x31')][_0xba87('0x24')]);_0x46a310[_0xba87('0x22')]=qs[_0xba87('0x22')](_0x59cab2[_0xba87('0x31')][_0xba87('0x22')]);}return _0x1b846b[_0xba87('0x97')](_0x46a310);}})[_0xba87('0x47')](function(_0x3ae93c){if(_0x3ae93c){return _0x3ae93c?{'count':_0x40138a,'rows':_0x3ae93c}:null;}})[_0xba87('0x47')](respondWithResult(_0x1cc436,null))['catch'](handleError(_0x1cc436,null));}; \ No newline at end of file +var _0x49e1=['key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','includeAll','catch','params','keys','rawAttributes','length','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','Sequelize','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','end','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','removeQueues','remove','ids','isArray','Chat','Mail','Fax','Openchannel','Whatsapp','transaction','Voice','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','findAll','voicePause','interface','UserVoiceQueueRt','upsert','isNil','all','addAgents','removeAgents','Sms','Queue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','Team','fieldName','type'];(function(_0x462c25,_0x516c22){var _0x18d0bc=function(_0x4caca5){while(--_0x4caca5){_0x462c25['push'](_0x462c25['shift']());}};_0x18d0bc(++_0x516c22);}(_0x49e1,0x194));var _0x149e=function(_0x97895c,_0x40e835){_0x97895c=_0x97895c-0x0;var _0x55d908=_0x49e1[_0x97895c];return _0x55d908;};'use strict';var emlformat=require(_0x149e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x149e('0x1'));var jsonpatch=require(_0x149e('0x2'));var rp=require(_0x149e('0x3'));var moment=require(_0x149e('0x4'));var BPromise=require(_0x149e('0x5'));var Mustache=require(_0x149e('0x6'));var util=require(_0x149e('0x7'));var path=require(_0x149e('0x8'));var sox=require('sox');var csv=require(_0x149e('0x9'));var ejs=require(_0x149e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x149e('0xb'));var crypto=require(_0x149e('0xc'));var jsforce=require(_0x149e('0xd'));var deskjs=require(_0x149e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x149e('0xf'));var Papa=require(_0x149e('0x10'));var Redis=require(_0x149e('0x11'));var authService=require(_0x149e('0x12'));var qs=require(_0x149e('0x13'));var as=require(_0x149e('0x14'));var hardwareService=require(_0x149e('0x15'));var logger=require(_0x149e('0x16'))(_0x149e('0x17'));var utils=require(_0x149e('0x18'));var config=require(_0x149e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x149e('0x1a'))['db'];config[_0x149e('0x1b')]=_[_0x149e('0x1c')](config['redis'],{'host':_0x149e('0x1d'),'port':0x18eb});var socket=require(_0x149e('0x1e'))(new Redis(config[_0x149e('0x1b')]));require(_0x149e('0x1f'))[_0x149e('0x20')](socket);function respondWithStatusCode(_0x32ed3e,_0x5ffb82){_0x5ffb82=_0x5ffb82||0xcc;return function(_0x4cd337){if(_0x4cd337){return _0x32ed3e[_0x149e('0x21')](_0x5ffb82);}return _0x32ed3e[_0x149e('0x22')](_0x5ffb82)['end']();};}function respondWithResult(_0x243754,_0x53abe9){_0x53abe9=_0x53abe9||0xc8;return function(_0xb8042d){if(_0xb8042d){return _0x243754[_0x149e('0x22')](_0x53abe9)['json'](_0xb8042d);}};}function respondWithFilteredResult(_0x35894f,_0x4e80f1){return function(_0x5f38ee){if(_0x5f38ee){var _0x439ee5=typeof _0x4e80f1['offset']==='undefined'&&typeof _0x4e80f1[_0x149e('0x23')]==='undefined';var _0x493386=_0x5f38ee['count'];var _0x51cccb=_0x439ee5?0x0:_0x4e80f1['offset'];var _0x388113=_0x439ee5?_0x5f38ee[_0x149e('0x24')]:_0x4e80f1[_0x149e('0x25')]+_0x4e80f1[_0x149e('0x23')];var _0x23ceb8;if(_0x388113>=_0x493386){_0x388113=_0x493386;_0x23ceb8=0xc8;}else{_0x23ceb8=0xce;}_0x35894f['status'](_0x23ceb8);return _0x35894f[_0x149e('0x26')](_0x149e('0x27'),_0x51cccb+'-'+_0x388113+'/'+_0x493386)['json'](_0x5f38ee);}return null;};}function patchUpdates(_0x9c5eb9){return function(_0x17d303){try{jsonpatch[_0x149e('0x28')](_0x17d303,_0x9c5eb9,!![]);}catch(_0x4dd3f4){return BPromise[_0x149e('0x29')](_0x4dd3f4);}return _0x17d303[_0x149e('0x2a')]();};}function saveUpdates(_0x3bf2c7,_0x12d99f){return function(_0x528e7b){if(_0x528e7b){return _0x528e7b[_0x149e('0x2b')](_0x3bf2c7)[_0x149e('0x2c')](function(_0x5b9e24){return _0x5b9e24;});}return null;};}function handleEntityNotFound(_0x50904e,_0x24323a){return function(_0x24024b){if(!_0x24024b){_0x50904e[_0x149e('0x21')](0x194);}return _0x24024b;};}function handleError(_0x2bc3b6,_0x5c7ead){_0x5c7ead=_0x5c7ead||0x1f4;return function(_0x4c6858){logger['error'](_0x4c6858[_0x149e('0x2d')]);if(_0x4c6858[_0x149e('0x2e')]){delete _0x4c6858[_0x149e('0x2e')];}_0x2bc3b6['status'](_0x5c7ead)[_0x149e('0x2f')](_0x4c6858);};}exports[_0x149e('0x30')]=function(_0x4e2756,_0x18a4b1){var _0x8ab9ae={},_0x439211={},_0xff8ee2={'count':0x0,'rows':[]};var _0x36d49c=_['map'](db[_0x149e('0x31')]['rawAttributes'],function(_0x159531){return{'name':_0x159531[_0x149e('0x32')],'type':_0x159531[_0x149e('0x33')][_0x149e('0x34')]};});_0x439211[_0x149e('0x35')]=_['map'](_0x36d49c,_0x149e('0x2e'));_0x439211['query']=_['keys'](_0x4e2756[_0x149e('0x36')]);_0x439211[_0x149e('0x37')]=_['intersection'](_0x439211['model'],_0x439211[_0x149e('0x36')]);_0x8ab9ae[_0x149e('0x38')]=_[_0x149e('0x39')](_0x439211[_0x149e('0x35')],qs[_0x149e('0x3a')](_0x4e2756[_0x149e('0x36')][_0x149e('0x3a')]));_0x8ab9ae['attributes']=_0x8ab9ae[_0x149e('0x38')]['length']?_0x8ab9ae[_0x149e('0x38')]:_0x439211[_0x149e('0x35')];if(!_0x4e2756[_0x149e('0x36')][_0x149e('0x3b')](_0x149e('0x3c'))){_0x8ab9ae[_0x149e('0x23')]=qs['limit'](_0x4e2756[_0x149e('0x36')][_0x149e('0x23')]);_0x8ab9ae[_0x149e('0x25')]=qs[_0x149e('0x25')](_0x4e2756[_0x149e('0x36')][_0x149e('0x25')]);}_0x8ab9ae[_0x149e('0x3d')]=qs['sort'](_0x4e2756[_0x149e('0x36')][_0x149e('0x3e')]);_0x8ab9ae[_0x149e('0x3f')]=qs[_0x149e('0x37')](_[_0x149e('0x40')](_0x4e2756[_0x149e('0x36')],_0x439211[_0x149e('0x37')]),_0x36d49c);if(_0x4e2756['query']['filter']){_0x8ab9ae[_0x149e('0x3f')]=_['merge'](_0x8ab9ae[_0x149e('0x3f')],{'$or':_[_0x149e('0x41')](_0x36d49c,function(_0xb4cfaf){if(_0xb4cfaf['type']!==_0x149e('0x42')){var _0x252738={};_0x252738[_0xb4cfaf[_0x149e('0x2e')]]={'$like':'%'+_0x4e2756[_0x149e('0x36')][_0x149e('0x43')]+'%'};return _0x252738;}})});}_0x8ab9ae=_[_0x149e('0x44')]({},_0x8ab9ae,_0x4e2756['options']);var _0x1595bd={'where':_0x8ab9ae['where']};return db[_0x149e('0x31')]['count'](_0x1595bd)[_0x149e('0x2c')](function(_0x1435e7){_0xff8ee2[_0x149e('0x24')]=_0x1435e7;if(_0x4e2756[_0x149e('0x36')][_0x149e('0x45')]){_0x8ab9ae['include']=[{'all':!![]}];}return db[_0x149e('0x31')]['findAll'](_0x8ab9ae);})[_0x149e('0x2c')](function(_0x46bcd4){_0xff8ee2['rows']=_0x46bcd4;return _0xff8ee2;})[_0x149e('0x2c')](respondWithFilteredResult(_0x18a4b1,_0x8ab9ae))[_0x149e('0x46')](handleError(_0x18a4b1,null));};exports['show']=function(_0x5ce1b1,_0x48d37d){var _0xcfa399={'raw':![],'where':{'id':_0x5ce1b1[_0x149e('0x47')]['id']}},_0x4935c9={};_0x4935c9[_0x149e('0x35')]=_[_0x149e('0x48')](db[_0x149e('0x31')][_0x149e('0x49')]);_0x4935c9[_0x149e('0x36')]=_['keys'](_0x5ce1b1[_0x149e('0x36')]);_0x4935c9[_0x149e('0x37')]=_[_0x149e('0x39')](_0x4935c9[_0x149e('0x35')],_0x4935c9[_0x149e('0x36')]);_0xcfa399['attributes']=_['intersection'](_0x4935c9['model'],qs[_0x149e('0x3a')](_0x5ce1b1[_0x149e('0x36')][_0x149e('0x3a')]));_0xcfa399['attributes']=_0xcfa399[_0x149e('0x38')][_0x149e('0x4a')]?_0xcfa399['attributes']:_0x4935c9[_0x149e('0x35')];if(_0x5ce1b1['query'][_0x149e('0x45')]){_0xcfa399[_0x149e('0x4b')]=[{'all':!![]}];}_0xcfa399=_['merge']({},_0xcfa399,_0x5ce1b1[_0x149e('0x4c')]);return db['Team'][_0x149e('0x4d')](_0xcfa399)[_0x149e('0x2c')](handleEntityNotFound(_0x48d37d,null))[_0x149e('0x2c')](respondWithResult(_0x48d37d,null))[_0x149e('0x46')](handleError(_0x48d37d,null));};exports[_0x149e('0x4e')]=function(_0x4de8e7,_0x3704b3){return db[_0x149e('0x31')][_0x149e('0x4e')](_0x4de8e7[_0x149e('0x4f')],{})['then'](function(_0x3c36fd){var _0x66c43d=_0x4de8e7[_0x149e('0x50')][_0x149e('0x51')]({'plain':!![]});if(!_0x66c43d)throw new Error(_0x149e('0x52'));if(_0x66c43d[_0x149e('0x53')]===_0x149e('0x50')){var _0x3f6382=_0x3c36fd[_0x149e('0x51')]({'plain':!![]});var _0x41e37e=_0x149e('0x54');return db[_0x149e('0x55')][_0x149e('0x4d')]({'where':{'name':_0x41e37e,'userProfileId':_0x66c43d[_0x149e('0x56')]},'raw':!![]})[_0x149e('0x2c')](function(_0x35492a){if(_0x35492a&&_0x35492a['autoAssociation']===0x0){return db['UserProfileResource'][_0x149e('0x4e')]({'name':_0x3f6382[_0x149e('0x2e')],'resourceId':_0x3f6382['id'],'type':_0x35492a[_0x149e('0x2e')],'sectionId':_0x35492a['id']},{})[_0x149e('0x2c')](function(){return _0x3c36fd;});}else{return _0x3c36fd;}})[_0x149e('0x46')](function(_0x809224){logger[_0x149e('0x57')](_0x149e('0x58'),_0x809224);throw _0x809224;});}return _0x3c36fd;})[_0x149e('0x2c')](respondWithResult(_0x3704b3,0xc9))[_0x149e('0x46')](handleError(_0x3704b3,null));};exports[_0x149e('0x2b')]=function(_0x17f672,_0x212040){if(_0x17f672[_0x149e('0x4f')]['id']){delete _0x17f672[_0x149e('0x4f')]['id'];}return db[_0x149e('0x31')][_0x149e('0x4d')]({'where':{'id':_0x17f672[_0x149e('0x47')]['id']}})[_0x149e('0x2c')](handleEntityNotFound(_0x212040,null))[_0x149e('0x2c')](saveUpdates(_0x17f672[_0x149e('0x4f')],null))[_0x149e('0x2c')](respondWithResult(_0x212040,null))['catch'](handleError(_0x212040,null));};exports[_0x149e('0x59')]=function(_0x2d59fb,_0x4bf0eb){var _0x132cab=_0x2d59fb[_0x149e('0x47')]['id'];var _0x215e10=[];return db[_0x149e('0x5a')]['transaction'](function(_0x2cc6f4){var _0x33c8df='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x132cab;return db[_0x149e('0x5a')][_0x149e('0x36')](_0x33c8df,{'type':db[_0x149e('0x5b')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x2cc6f4})[_0x149e('0x2c')](function(_0x20e4a1){_0x215e10=_[_0x149e('0x41')](_0x20e4a1,function(_0x2c24a8){return Number(_0x2c24a8[_0x149e('0x5c')]);});})[_0x149e('0x2c')](function(){var _0x55af7b=_0x149e('0x5d')+_0x132cab;return db[_0x149e('0x5a')]['query'](_0x55af7b,{'type':db[_0x149e('0x5b')][_0x149e('0x5e')][_0x149e('0x5f')],'raw':!![],'transaction':_0x2cc6f4});})[_0x149e('0x2c')](function(_0x1ecf70){var _0x50618e=_[_0x149e('0x41')](_0x1ecf70,function(_0x71a6db){return Number(_0x71a6db['VoiceQueueId']);});return db['UserVoiceQueue'][_0x149e('0x59')]({'where':{'UserId':{'$in':_0x215e10},'VoiceQueueId':{'$in':_0x50618e}},'transaction':_0x2cc6f4});})['then'](function(){var _0x394abb='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x132cab;return db['sequelize'][_0x149e('0x36')](_0x394abb,{'type':db[_0x149e('0x5b')]['QueryTypes'][_0x149e('0x5f')],'raw':!![],'transaction':_0x2cc6f4});})['then'](function(_0x20490a){var _0x26c7b3=_['map'](_0x20490a,function(_0x4cecd4){return Number(_0x4cecd4['MailQueueId']);});return db[_0x149e('0x60')][_0x149e('0x59')]({'where':{'UserId':{'$in':_0x215e10},'MailQueueId':{'$in':_0x26c7b3}},'transaction':_0x2cc6f4});})[_0x149e('0x2c')](function(){var _0x23062a=_0x149e('0x61')+_0x132cab;return db[_0x149e('0x5a')][_0x149e('0x36')](_0x23062a,{'type':db[_0x149e('0x5b')][_0x149e('0x5e')][_0x149e('0x5f')],'raw':!![],'transaction':_0x2cc6f4});})['then'](function(_0x1870c1){var _0x5ded85=_[_0x149e('0x41')](_0x1870c1,function(_0x475744){return Number(_0x475744[_0x149e('0x62')]);});return db[_0x149e('0x63')][_0x149e('0x59')]({'where':{'UserId':{'$in':_0x215e10},'SmsQueueId':{'$in':_0x5ded85}},'transaction':_0x2cc6f4});})['then'](function(){var _0x5882af='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x132cab;return db[_0x149e('0x5a')][_0x149e('0x36')](_0x5882af,{'type':db[_0x149e('0x5b')][_0x149e('0x5e')][_0x149e('0x5f')],'raw':!![],'transaction':_0x2cc6f4});})['then'](function(_0x3aae09){var _0x1997c7=_['map'](_0x3aae09,function(_0x45656e){return Number(_0x45656e[_0x149e('0x64')]);});return db['UserChatQueue'][_0x149e('0x59')]({'where':{'UserId':{'$in':_0x215e10},'ChatQueueId':{'$in':_0x1997c7}},'transaction':_0x2cc6f4});})['then'](function(){var _0x329abc='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x132cab;return db[_0x149e('0x5a')][_0x149e('0x36')](_0x329abc,{'type':db['Sequelize'][_0x149e('0x5e')][_0x149e('0x5f')],'raw':!![],'transaction':_0x2cc6f4});})[_0x149e('0x2c')](function(_0x5ee594){var _0x42ea3b=_['map'](_0x5ee594,function(_0x470650){return Number(_0x470650[_0x149e('0x65')]);});return db[_0x149e('0x66')][_0x149e('0x59')]({'where':{'UserId':{'$in':_0x215e10},'FaxQueueId':{'$in':_0x42ea3b}},'transaction':_0x2cc6f4});})[_0x149e('0x2c')](function(){var _0x21ceaa=_0x149e('0x67')+_0x132cab;return db[_0x149e('0x5a')][_0x149e('0x36')](_0x21ceaa,{'type':db[_0x149e('0x5b')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x2cc6f4});})[_0x149e('0x2c')](function(_0x39faf4){var _0x3a74e9=_[_0x149e('0x41')](_0x39faf4,function(_0x329211){return Number(_0x329211[_0x149e('0x68')]);});return db[_0x149e('0x69')][_0x149e('0x59')]({'where':{'UserId':{'$in':_0x215e10},'OpenchannelQueueId':{'$in':_0x3a74e9}},'transaction':_0x2cc6f4});})[_0x149e('0x2c')](function(){var _0x4eb060='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x132cab;return db[_0x149e('0x5a')][_0x149e('0x36')](_0x4eb060,{'type':db[_0x149e('0x5b')][_0x149e('0x5e')][_0x149e('0x5f')],'raw':!![],'transaction':_0x2cc6f4});})[_0x149e('0x2c')](function(_0x5f0794){var _0x11d1c5=_[_0x149e('0x41')](_0x5f0794,function(_0x38a9fb){return Number(_0x38a9fb[_0x149e('0x6a')]);});return db['UserWhatsappQueue'][_0x149e('0x59')]({'where':{'UserId':{'$in':_0x215e10},'WhatsappQueueId':{'$in':_0x11d1c5}},'transaction':_0x2cc6f4});})[_0x149e('0x2c')](function(){return db[_0x149e('0x6b')]['find']({'where':{'TeamId':_0x132cab}});})[_0x149e('0x2c')](function(_0x1b6f96){if(_0x1b6f96===null){return;}return db[_0x149e('0x6c')][_0x149e('0x59')]({'where':{'UserId':{'$in':_0x215e10},'VoicePrefixId':_0x1b6f96[_0x149e('0x6d')]},'transaction':_0x2cc6f4});})[_0x149e('0x2c')](function(){return db['Team'][_0x149e('0x59')]({'where':{'id':_0x132cab},'cascade':!![],'transaction':_0x2cc6f4});})[_0x149e('0x2c')](function(_0x1354b6){if(_0x1354b6===0x0){_0x4bf0eb['sendStatus'](0x194);}else{return db[_0x149e('0x6e')][_0x149e('0x59')]({'where':{'type':_0x149e('0x54'),'resourceId':_0x132cab},'cascade':!![],'transaction':_0x2cc6f4})['then'](function(){_0x4bf0eb[_0x149e('0x22')](0xcc)[_0x149e('0x6f')]();});}})['catch'](function(_0x54681a){_0x4bf0eb[_0x149e('0x22')](0x1f4)['send'](_0x54681a);});});};exports['getQueues']=function(_0x1274db,_0xb461a,_0xb9c2cf){return db['Team'][_0x149e('0x70')]({'where':{'id':_0x1274db[_0x149e('0x47')]['id']}})[_0x149e('0x2c')](handleEntityNotFound(_0xb461a,null))['then'](function(_0x2ea41d){if(!_0x1274db[_0x149e('0x36')][_0x149e('0x71')]||!utils[_0x149e('0x72')](_0x1274db[_0x149e('0x36')]['channel'])){throw new db[(_0x149e('0x5b'))][(_0x149e('0x73'))](_0x149e('0x74'));}var _0x25b8cd={};var _0x1454ea={};_0x1454ea[_0x149e('0x35')]=_['keys'](db[_[_0x149e('0x75')](_0x1274db[_0x149e('0x36')]['channel'][_0x149e('0x76')]())+_0x149e('0x77')]['rawAttributes']);_0x1454ea[_0x149e('0x36')]=_[_0x149e('0x48')](_0x1274db['query']);_0x1454ea[_0x149e('0x37')]=_[_0x149e('0x39')](_0x1454ea[_0x149e('0x35')],_0x1454ea['query']);_0x25b8cd['attributes']=_['intersection'](_0x1454ea[_0x149e('0x35')],qs['fields'](_0x1274db[_0x149e('0x36')]['fields']));_0x25b8cd[_0x149e('0x38')]=_0x25b8cd[_0x149e('0x38')][_0x149e('0x4a')]?_0x25b8cd[_0x149e('0x38')]:_0x1454ea['model'];_0x25b8cd[_0x149e('0x23')]=qs[_0x149e('0x23')](_0x1274db[_0x149e('0x36')][_0x149e('0x23')]);_0x25b8cd[_0x149e('0x25')]=qs['offset'](_0x1274db['query'][_0x149e('0x25')]);_0x25b8cd['order']=qs[_0x149e('0x3e')](_0x1274db[_0x149e('0x36')][_0x149e('0x3e')]);_0x25b8cd[_0x149e('0x3f')]=qs['filters'](_['pick'](_0x1274db['query'],_0x1454ea[_0x149e('0x37')]));_0x25b8cd=_[_0x149e('0x44')]({},_0x25b8cd,_0x1274db[_0x149e('0x4c')]);return _0x2ea41d['get'+_[_0x149e('0x75')](_0x1274db['query'][_0x149e('0x71')][_0x149e('0x76')]())+_0x149e('0x78')](_0x25b8cd);})[_0x149e('0x2c')](respondWithResult(_0xb461a,null))['catch'](handleError(_0xb461a,null));};exports['addQueues']=function(_0x115d32,_0x1778f0,_0x57b073){return db[_0x149e('0x31')][_0x149e('0x70')]({'where':{'id':_0x115d32[_0x149e('0x47')]['id']}})[_0x149e('0x2c')](function(_0x262dbe){if(_0x262dbe){if(!_0x115d32[_0x149e('0x4f')][_0x149e('0x71')]||!utils['isValidChannel'](_0x115d32[_0x149e('0x4f')]['channel'])){throw new db[(_0x149e('0x5b'))][(_0x149e('0x73'))](_0x149e('0x74'));}return _0x262dbe['add'+_['capitalize'](_0x115d32[_0x149e('0x4f')][_0x149e('0x71')][_0x149e('0x76')]())+_0x149e('0x78')](_0x115d32[_0x149e('0x4f')]['ids']);}return null;})['then'](handleEntityNotFound(_0x1778f0,null))[_0x149e('0x2c')](respondWithStatusCode(_0x1778f0,null))['catch'](handleError(_0x1778f0,null));};exports[_0x149e('0x79')]=function(_0x120ae4,_0x4b3864,_0x2c46a7){return db[_0x149e('0x31')]['findOne']({'where':{'id':_0x120ae4['params']['id']}})[_0x149e('0x2c')](function(_0x3dd683){if(_0x3dd683){if(!_0x120ae4[_0x149e('0x36')][_0x149e('0x71')]||!utils[_0x149e('0x72')](_0x120ae4[_0x149e('0x36')][_0x149e('0x71')])){throw new db['Sequelize'][(_0x149e('0x73'))](_0x149e('0x74'));}return _0x3dd683[_0x149e('0x7a')+_[_0x149e('0x75')](_0x120ae4['query']['channel'][_0x149e('0x76')]())+_0x149e('0x78')](_0x120ae4[_0x149e('0x36')][_0x149e('0x7b')]);}return null;})[_0x149e('0x2c')](handleEntityNotFound(_0x4b3864,null))[_0x149e('0x2c')](respondWithStatusCode(_0x4b3864,null))[_0x149e('0x46')](handleError(_0x4b3864,null));};exports['addAgents']=function(_0x21efdf,_0x139add){var _0x152d44=_[_0x149e('0x7c')](_0x21efdf[_0x149e('0x4f')][_0x149e('0x7b')])?_0x21efdf[_0x149e('0x4f')][_0x149e('0x7b')]:[_0x21efdf[_0x149e('0x4f')]['ids']];var _0x5a2ce9=_0x21efdf['params']['id'];return db['Team'][_0x149e('0x4d')]({'where':{'id':_0x5a2ce9}})[_0x149e('0x2c')](handleEntityNotFound(_0x139add,null))[_0x149e('0x2c')](function(_0x3c6c81){if(_0x3c6c81){var _0x58397d=['Voice',_0x149e('0x7d'),_0x149e('0x7e'),'Sms',_0x149e('0x7f'),_0x149e('0x80'),_0x149e('0x81')];return db['sequelize'][_0x149e('0x82')](function(_0x392ee7){var _0x2948c7=_[_0x149e('0x41')](_0x58397d,function(_0x5c76b6){var _0x5ef678={'attributes':['id',_0x149e('0x2e')]};if(_0x5c76b6===_0x149e('0x83')){_0x5ef678[_0x149e('0x84')]={'attributes':[_0x149e('0x85')]};}return _0x3c6c81[_0x149e('0x51')+_0x5c76b6+'Queues'](_0x5ef678)[_0x149e('0x2c')](function(_0x2cbbdc){var _0x3ce451=_[_0x149e('0x41')](_0x2cbbdc,function(_0x4dd73b){var _0x5e87a8=_[_0x149e('0x41')](_0x152d44,function(_0x5d6037){var _0x172c5d={'where':{'UserId':_0x5d6037,[_0x5c76b6+_0x149e('0x86')]:_0x4dd73b['id']},'transaction':_0x392ee7};if(_0x5c76b6===_0x149e('0x83')){_0x172c5d['defaults']={'penalty':_0x4dd73b[_0x149e('0x87')]['penalty']};}return db[_0x149e('0x88')+_0x5c76b6+_0x149e('0x77')][_0x149e('0x89')](_0x172c5d)[_0x149e('0x2c')](function(){socket[_0x149e('0x8a')](_0x149e('0x50')+_0x5c76b6+_0x149e('0x8b'),{'UserId':_0x5d6037,[_0x5c76b6+_0x149e('0x86')]:_0x4dd73b['id']});if(_0x5c76b6!==_0x149e('0x83')){return;}return db[_0x149e('0x88')][_0x149e('0x8c')]({'where':{'id':_0x152d44,'online':0x1},'attributes':['id',_0x149e('0x2e'),'online',_0x149e('0x8d'),_0x149e('0x8e')],'raw':!![]})['then'](function(_0x2fd0ec){var _0x3837e5=_[_0x149e('0x41')](_0x2fd0ec,function(_0x3edfd2){return db[_0x149e('0x8f')][_0x149e('0x90')]({'membername':_0x3edfd2[_0x149e('0x2e')],'UserId':_0x3edfd2['id'],'queue_name':_0x4dd73b['name'],'VoiceQueueId':_0x4dd73b['id'],'interface':_[_0x149e('0x91')](_0x3edfd2[_0x149e('0x8e')])?util['format']('SIP/%s',_0x3edfd2[_0x149e('0x2e')]):_0x3edfd2[_0x149e('0x8e')],'paused':_0x3edfd2['voicePause']||![],'penalty':_0x4dd73b[_0x149e('0x87')][_0x149e('0x85')]},{'transaction':_0x392ee7});});return Promise[_0x149e('0x92')](_0x3837e5);});});});return Promise[_0x149e('0x92')](_0x5e87a8);});return Promise[_0x149e('0x92')](_0x3ce451);})[_0x149e('0x2c')](function(){return db[_0x149e('0x6b')][_0x149e('0x70')]({'where':{'teamId':_0x5a2ce9}})[_0x149e('0x2c')](function(_0x7af32a){if(_0x7af32a){var _0x33f8ac=_['map'](_0x152d44,function(_0x3f6b01){db['UserVoicePrefix'][_0x149e('0x90')]({'UserId':_0x3f6b01,'VoicePrefixId':_0x7af32a[_0x149e('0x6d')]});});return Promise[_0x149e('0x92')](_0x33f8ac);}});});});return Promise[_0x149e('0x92')](_0x2948c7)[_0x149e('0x2c')](function(){return _0x3c6c81[_0x149e('0x93')](_0x152d44,{'transaction':_0x392ee7})['spread'](function(_0x51ff1b){return _0x51ff1b;});});});}})['then'](respondWithResult(_0x139add,null))[_0x149e('0x46')](handleError(_0x139add,null));};exports[_0x149e('0x94')]=function(_0x339658,_0x1e8d9f){var _0x4c12ec=_[_0x149e('0x7c')](_0x339658[_0x149e('0x36')][_0x149e('0x7b')])?_0x339658[_0x149e('0x36')]['ids']:[_0x339658[_0x149e('0x36')][_0x149e('0x7b')]];var _0x35dd25=_0x339658[_0x149e('0x47')]['id'];return db[_0x149e('0x31')][_0x149e('0x4d')]({'where':{'id':_0x35dd25}})[_0x149e('0x2c')](handleEntityNotFound(_0x1e8d9f,null))['then'](function(_0x26219c){if(_0x26219c){var _0x23f7be=[_0x149e('0x83'),_0x149e('0x7d'),_0x149e('0x7e'),_0x149e('0x95'),_0x149e('0x7f'),_0x149e('0x80'),_0x149e('0x81')];return db[_0x149e('0x5a')][_0x149e('0x82')](function(_0x30103c){var _0x1061d0=_[_0x149e('0x41')](_0x23f7be,function(_0x6e25f7){var _0x3f8042={'attributes':['id',_0x149e('0x2e')]};return _0x26219c[_0x149e('0x51')+_0x6e25f7+_0x149e('0x78')](_0x3f8042)[_0x149e('0x2c')](function(_0xd7f80b){var _0x5ec508=_[_0x149e('0x41')](_0xd7f80b,function(_0x1f91ad){return _0x1f91ad[_0x149e('0x94')](_0x4c12ec,{'transaction':_0x30103c})['then'](function(){var _0x1c5917=_[_0x149e('0x41')](_0x4c12ec,function(_0x1c7ae0){socket[_0x149e('0x8a')](_0x149e('0x50')+_0x6e25f7+_0x149e('0x96'),{'UserId':Number(_0x1c7ae0),[_0x6e25f7+_0x149e('0x86')]:_0x1f91ad['id']});if(_0x6e25f7!==_0x149e('0x83')){return;}return db[_0x149e('0x8f')][_0x149e('0x59')]({'where':{'VoiceQueueId':_0x1f91ad['id'],'UserId':_0x1c7ae0},'transaction':_0x30103c});});return Promise[_0x149e('0x92')](_0x1c5917);});});return Promise[_0x149e('0x92')](_0x5ec508);});});return Promise[_0x149e('0x92')](_0x1061d0)['then'](function(){return _0x26219c[_0x149e('0x94')](_0x4c12ec,{'transaction':_0x30103c});})[_0x149e('0x2c')](function(){return db[_0x149e('0x6b')][_0x149e('0x70')]({'where':{'teamId':_0x35dd25}})[_0x149e('0x2c')](function(_0x3b8570){if(_0x3b8570){var _0xcef3f9=_['map'](_0x4c12ec,function(_0x2555e1){db[_0x149e('0x6c')][_0x149e('0x59')]({'where':{'UserId':_0x2555e1,'VoicePrefixId':_0x3b8570[_0x149e('0x6d')]}});});return Promise['all'](_0xcef3f9);}});});});}})[_0x149e('0x2c')](respondWithStatusCode(_0x1e8d9f,null))[_0x149e('0x46')](handleError(_0x1e8d9f,null));};exports[_0x149e('0x97')]=function(_0xcc8474,_0x584810,_0x21a5ee){var _0x38944d={};var _0x307f31={};var _0x1925ae;var _0xf08ef7;return db[_0x149e('0x31')][_0x149e('0x70')]({'where':{'id':_0xcc8474['params']['id']}})[_0x149e('0x2c')](handleEntityNotFound(_0x584810,null))['then'](function(_0x3d5463){if(_0x3d5463){_0x1925ae=_0x3d5463;_0x307f31[_0x149e('0x35')]=_[_0x149e('0x48')](db['User'][_0x149e('0x49')]);_0x307f31['query']=_[_0x149e('0x48')](_0xcc8474[_0x149e('0x36')]);_0x307f31['filters']=_[_0x149e('0x39')](_0x307f31[_0x149e('0x35')],_0x307f31[_0x149e('0x36')]);_0x38944d['attributes']=_[_0x149e('0x39')](_0x307f31[_0x149e('0x35')],qs['fields'](_0xcc8474['query']['fields']));_0x38944d[_0x149e('0x38')]=_0x38944d[_0x149e('0x38')]['length']?_0x38944d[_0x149e('0x38')]:_0x307f31[_0x149e('0x35')];_0x38944d[_0x149e('0x3d')]=qs[_0x149e('0x3e')](_0xcc8474[_0x149e('0x36')][_0x149e('0x3e')]);_0x38944d['where']=qs[_0x149e('0x37')](_['pick'](_0xcc8474[_0x149e('0x36')],_0x307f31['filters']));if(_0xcc8474[_0x149e('0x36')][_0x149e('0x43')]){_0x38944d[_0x149e('0x3f')]=_[_0x149e('0x44')](_0x38944d['where'],{'$or':_[_0x149e('0x41')](_0x38944d[_0x149e('0x38')],function(_0x1d7bfd){var _0x5ef7a2={};_0x5ef7a2[_0x1d7bfd]={'$like':'%'+_0xcc8474[_0x149e('0x36')][_0x149e('0x43')]+'%'};return _0x5ef7a2;})});}_0x38944d=_[_0x149e('0x44')]({},_0x38944d,_0xcc8474['options']);return _0x1925ae[_0x149e('0x97')](_0x38944d);}})[_0x149e('0x2c')](function(_0x4e3310){if(_0x4e3310){_0xf08ef7=_0x4e3310[_0x149e('0x4a')];if(!_0xcc8474['query']['hasOwnProperty'](_0x149e('0x3c'))){_0x38944d[_0x149e('0x23')]=qs[_0x149e('0x23')](_0xcc8474[_0x149e('0x36')]['limit']);_0x38944d[_0x149e('0x25')]=qs[_0x149e('0x25')](_0xcc8474[_0x149e('0x36')][_0x149e('0x25')]);}return _0x1925ae['getAgents'](_0x38944d);}})[_0x149e('0x2c')](function(_0xb22037){if(_0xb22037){return _0xb22037?{'count':_0xf08ef7,'rows':_0xb22037}:null;}})['then'](respondWithResult(_0x584810,null))[_0x149e('0x46')](handleError(_0x584810,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 2390ea4..db4000c 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 _0x3f10=['exports','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2d0d9f,_0x22c0d8){var _0x30243d=function(_0x29a92b){while(--_0x29a92b){_0x2d0d9f['push'](_0x2d0d9f['shift']());}};_0x30243d(++_0x22c0d8);}(_0x3f10,0x1eb));var _0x03f1=function(_0x2cab97,_0x1b4a95){_0x2cab97=_0x2cab97-0x0;var _0x416850=_0x3f10[_0x2cab97];return _0x416850;};'use strict';var EventEmitter=require('events');var Team=require(_0x03f1('0x0'))['db'][_0x03f1('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x03f1('0x2')](0x0);var events={'afterCreate':_0x03f1('0x3'),'afterUpdate':_0x03f1('0x4'),'afterDestroy':_0x03f1('0x5')};function emitEvent(_0x217fa8){return function(_0x537df1,_0x477853,_0x29e262){TeamEvents[_0x03f1('0x6')](_0x217fa8+':'+_0x537df1['id'],_0x537df1);TeamEvents['emit'](_0x217fa8,_0x537df1);_0x29e262(null);};}for(var e in events){if(events[_0x03f1('0x7')](e)){var event=events[e];Team[_0x03f1('0x8')](e,emitEvent(event));}}module[_0x03f1('0x9')]=TeamEvents; \ No newline at end of file +var _0x68a4=['hasOwnProperty','exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit'];(function(_0x14538d,_0x527062){var _0x32d601=function(_0x400b31){while(--_0x400b31){_0x14538d['push'](_0x14538d['shift']());}};_0x32d601(++_0x527062);}(_0x68a4,0x66));var _0x468a=function(_0x526046,_0x154040){_0x526046=_0x526046-0x0;var _0x5b92a2=_0x68a4[_0x526046];return _0x5b92a2;};'use strict';var EventEmitter=require(_0x468a('0x0'));var Team=require(_0x468a('0x1'))['db'][_0x468a('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x468a('0x3')](0x0);var events={'afterCreate':_0x468a('0x4'),'afterUpdate':_0x468a('0x5'),'afterDestroy':_0x468a('0x6')};function emitEvent(_0x3df670){return function(_0x310ca3,_0x3fee53,_0x253f6d){TeamEvents[_0x468a('0x7')](_0x3df670+':'+_0x310ca3['id'],_0x310ca3);TeamEvents[_0x468a('0x7')](_0x3df670,_0x310ca3);_0x253f6d(null);};}for(var e in events){if(events[_0x468a('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x468a('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index bc6755e..2bdd117 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 _0x71be=['Fax','Mail','Openchannel','Voice','resolve','then','all','lodash','./team.attributes','get','Queues','map','setDataValue','channel','catch','exports','Team','teams','Chat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71be,0xc5));var _0xe71b=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0x71be[_0x541ea6];return _0x3c3e84;};'use strict';var _=require(_0xe71b('0x0'));var attributes=require(_0xe71b('0x1'));function getQueuesByChannel(_0x1a9bb2,_0x287055){var _0x51cca1=_0xe71b('0x2')+_0x287055+_0xe71b('0x3');return _0x1a9bb2[_0x51cca1]()['then'](function(_0x212c27){return _[_0xe71b('0x4')](_0x212c27,function(_0x3f6e94){_0x3f6e94[_0xe71b('0x5')](_0xe71b('0x6'),_0x287055);return _0x3f6e94;});})[_0xe71b('0x7')](function(_0x2f693b){throw _0x2f693b;});}module[_0xe71b('0x8')]=function(_0x6c46f2){return _0x6c46f2['define'](_0xe71b('0x9'),attributes,{'tableName':_0xe71b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x35b157=this;var _0x84d057=[_0xe71b('0xb'),_0xe71b('0xc'),_0xe71b('0xd'),_0xe71b('0xe'),'Sms',_0xe71b('0xf'),'Whatsapp'];return Promise[_0xe71b('0x10')]()[_0xe71b('0x11')](function(){var _0x3883b5=_[_0xe71b('0x4')](_0x84d057,function(_0x32ad47){return getQueuesByChannel(_0x35b157,_0x32ad47);});return Promise[_0xe71b('0x12')](_0x3883b5);})[_0xe71b('0x7')](function(_0xbc809f){throw _0xbc809f;});}}});}; \ No newline at end of file +var _0x7e5a=['then','map','channel','define','Team','teams','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','catch','lodash','Queues'];(function(_0x2e3a17,_0x4e8344){var _0x414973=function(_0x57ee9e){while(--_0x57ee9e){_0x2e3a17['push'](_0x2e3a17['shift']());}};_0x414973(++_0x4e8344);}(_0x7e5a,0xde));var _0xa7e5=function(_0x135806,_0xfd7ba5){_0x135806=_0x135806-0x0;var _0x2ad686=_0x7e5a[_0x135806];return _0x2ad686;};'use strict';var _=require(_0xa7e5('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x4edf4a,_0x1e65a8){var _0x52c5e2='get'+_0x1e65a8+_0xa7e5('0x1');return _0x4edf4a[_0x52c5e2]()[_0xa7e5('0x2')](function(_0x58e52b){return _[_0xa7e5('0x3')](_0x58e52b,function(_0x30eb93){_0x30eb93['setDataValue'](_0xa7e5('0x4'),_0x1e65a8);return _0x30eb93;});})['catch'](function(_0x27eeac){throw _0x27eeac;});}module['exports']=function(_0x383174){return _0x383174[_0xa7e5('0x5')](_0xa7e5('0x6'),attributes,{'tableName':_0xa7e5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x359d8b=this;var _0x4f0cea=['Chat',_0xa7e5('0x8'),_0xa7e5('0x9'),_0xa7e5('0xa'),_0xa7e5('0xb'),_0xa7e5('0xc'),_0xa7e5('0xd')];return Promise[_0xa7e5('0xe')]()[_0xa7e5('0x2')](function(){var _0x49ce67=_[_0xa7e5('0x3')](_0x4f0cea,function(_0x433f20){return getQueuesByChannel(_0x359d8b,_0x433f20);});return Promise['all'](_0x49ce67);})[_0xa7e5('0xf')](function(_0x4e143f){throw _0x4e143f;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 6c0a43f..c75848c 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 _0x651d=['debug','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x34a7da,_0x339327){var _0x269ada=function(_0x29ff6b){while(--_0x29ff6b){_0x34a7da['push'](_0x34a7da['shift']());}};_0x269ada(++_0x339327);}(_0x651d,0x196));var _0xd651=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x651d[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0xd651('0x0'));var moment=require('moment');var BPromise=require(_0xd651('0x1'));var rs=require(_0xd651('0x2'));var fs=require('fs');var Redis=require(_0xd651('0x3'));var db=require(_0xd651('0x4'))['db'];var utils=require(_0xd651('0x5'));var logger=require(_0xd651('0x6'))('rpc');var config=require(_0xd651('0x7'));var jayson=require(_0xd651('0x8'));var client=jayson['client'][_0xd651('0x9')]({'port':0x232a});config[_0xd651('0xa')]=_[_0xd651('0xb')](config[_0xd651('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd651('0xc'))(new Redis(config[_0xd651('0xa')]));require(_0xd651('0xd'))[_0xd651('0xe')](socket);function respondWithRpcPromise(_0x59c242,_0x5a6db8,_0x576b9b){return new BPromise(function(_0x353082,_0x439c60){return client['request'](_0x59c242,_0x576b9b)[_0xd651('0xf')](function(_0x2600c9){logger[_0xd651('0x10')](_0xd651('0x11'),_0x5a6db8,_0xd651('0x12'));logger[_0xd651('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x5a6db8,'request\x20sent',JSON['stringify'](_0x2600c9));if(_0x2600c9['error']){if(_0x2600c9[_0xd651('0x14')][_0xd651('0x15')]===0x1f4){logger[_0xd651('0x14')](_0xd651('0x11'),_0x5a6db8,_0x2600c9[_0xd651('0x14')][_0xd651('0x16')]);return _0x439c60(_0x2600c9[_0xd651('0x14')][_0xd651('0x16')]);}logger['error']('Team,\x20%s,\x20%s',_0x5a6db8,_0x2600c9[_0xd651('0x14')][_0xd651('0x16')]);return _0x353082(_0x2600c9[_0xd651('0x14')]['message']);}else{logger[_0xd651('0x10')](_0xd651('0x11'),_0x5a6db8,_0xd651('0x12'));_0x353082(_0x2600c9[_0xd651('0x17')][_0xd651('0x16')]);}})[_0xd651('0x18')](function(_0x5244ea){logger['error'](_0xd651('0x11'),_0x5a6db8,_0x5244ea);_0x439c60(_0x5244ea);});});} \ No newline at end of file +var _0x5308=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x5308,0x130));var _0x8530=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0x5308[_0x1347f8];return _0x218368;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8530('0x0'));var BPromise=require(_0x8530('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8530('0x2'));var db=require(_0x8530('0x3'))['db'];var utils=require(_0x8530('0x4'));var logger=require(_0x8530('0x5'))(_0x8530('0x6'));var config=require(_0x8530('0x7'));var jayson=require(_0x8530('0x8'));var client=jayson[_0x8530('0x9')]['http']({'port':0x232a});config[_0x8530('0xa')]=_[_0x8530('0xb')](config[_0x8530('0xa')],{'host':_0x8530('0xc'),'port':0x18eb});var socket=require(_0x8530('0xd'))(new Redis(config[_0x8530('0xa')]));require(_0x8530('0xe'))['register'](socket);function respondWithRpcPromise(_0x44c657,_0x49a068,_0x318c18){return new BPromise(function(_0x3a9e1a,_0x70974){return client['request'](_0x44c657,_0x318c18)['then'](function(_0x5b5abe){logger[_0x8530('0xf')](_0x8530('0x10'),_0x49a068,_0x8530('0x11'));logger['debug'](_0x8530('0x12'),_0x49a068,_0x8530('0x11'),JSON[_0x8530('0x13')](_0x5b5abe));if(_0x5b5abe['error']){if(_0x5b5abe[_0x8530('0x14')][_0x8530('0x15')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x49a068,_0x5b5abe[_0x8530('0x14')]['message']);return _0x70974(_0x5b5abe[_0x8530('0x14')][_0x8530('0x16')]);}logger[_0x8530('0x14')]('Team,\x20%s,\x20%s',_0x49a068,_0x5b5abe['error'][_0x8530('0x16')]);return _0x3a9e1a(_0x5b5abe['error'][_0x8530('0x16')]);}else{logger[_0x8530('0xf')]('Team,\x20%s,\x20%s',_0x49a068,'request\x20sent');_0x3a9e1a(_0x5b5abe[_0x8530('0x17')][_0x8530('0x16')]);}})['catch'](function(_0x3c48e6){logger[_0x8530('0x14')](_0x8530('0x10'),_0x49a068,_0x3c48e6);_0x70974(_0x3c48e6);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 3206c8d..6733d0c 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 _0x3e40=['length','./team.events','remove','update','emit','removeListener','register'];(function(_0x383158,_0x415e43){var _0x507985=function(_0x1e498e){while(--_0x1e498e){_0x383158['push'](_0x383158['shift']());}};_0x507985(++_0x415e43);}(_0x3e40,0xef));var _0x03e4=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3e40[_0x5b644e];return _0x49c6bf;};'use strict';var TeamEvents=require(_0x03e4('0x0'));var events=['save',_0x03e4('0x1'),_0x03e4('0x2')];function createListener(_0x30fffc,_0x1ede96){return function(_0x48057f){_0x1ede96[_0x03e4('0x3')](_0x30fffc,_0x48057f);};}function removeListener(_0x2a04cd,_0x501ef1){return function(){TeamEvents[_0x03e4('0x4')](_0x2a04cd,_0x501ef1);};}exports[_0x03e4('0x5')]=function(_0xc3aef1){for(var _0x55a049=0x0,_0x453eca=events[_0x03e4('0x6')];_0x55a049<_0x453eca;_0x55a049++){var _0x2fc58c=events[_0x55a049];var _0xecde64=createListener('team:'+_0x2fc58c,_0xc3aef1);TeamEvents['on'](_0x2fc58c,_0xecde64);}}; \ No newline at end of file +var _0xb9a7=['removeListener','register','length','team:','save','emit'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xb9a7,0x112));var _0x7b9a=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xb9a7[_0x5c2e3e];return _0x53f64a;};'use strict';var TeamEvents=require('./team.events');var events=[_0x7b9a('0x0'),'remove','update'];function createListener(_0x5f1a52,_0x4278a1){return function(_0x559be2){_0x4278a1[_0x7b9a('0x1')](_0x5f1a52,_0x559be2);};}function removeListener(_0x40ef7d,_0x37b25b){return function(){TeamEvents[_0x7b9a('0x2')](_0x40ef7d,_0x37b25b);};}exports[_0x7b9a('0x3')]=function(_0xf6dae2){for(var _0x22764f=0x0,_0x7019fd=events[_0x7b9a('0x4')];_0x22764f<_0x7019fd;_0x22764f++){var _0x3e51f0=events[_0x22764f];var _0x4d3f20=createListener(_0x7b9a('0x5')+_0x3e51f0,_0xf6dae2);TeamEvents['on'](_0x3e51f0,_0x4d3f20);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index e4019d7..5941575 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 _0x7b10=['exports','INTEGER','sequelize'];(function(_0x31908a,_0x782665){var _0x49722f=function(_0x146734){while(--_0x146734){_0x31908a['push'](_0x31908a['shift']());}};_0x49722f(++_0x782665);}(_0x7b10,0x1ac));var _0x07b1=function(_0x5c5381,_0x428f55){_0x5c5381=_0x5c5381-0x0;var _0x45f881=_0x7b10[_0x5c5381];return _0x45f881;};'use strict';var Sequelize=require(_0x07b1('0x0'));module[_0x07b1('0x1')]={'TeamId':{'type':Sequelize[_0x07b1('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x07b1('0x2')]}}; \ No newline at end of file +var _0xba78=['INTEGER','sequelize'];(function(_0x16a0e7,_0x31a103){var _0x354b59=function(_0x334b0c){while(--_0x334b0c){_0x16a0e7['push'](_0x16a0e7['shift']());}};_0x354b59(++_0x31a103);}(_0xba78,0x159));var _0x8ba7=function(_0x2a2bfc,_0x2f8089){_0x2a2bfc=_0x2a2bfc-0x0;var _0x5d78ef=_0xba78[_0x2a2bfc];return _0x5d78ef;};'use strict';var Sequelize=require(_0x8ba7('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x8ba7('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x8ba7('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 7e12b7d..87d9372 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 _0x689b=['bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','../../config/logger'];(function(_0x577788,_0x42e5c9){var _0x30296d=function(_0x5b5b25){while(--_0x5b5b25){_0x577788['push'](_0x577788['shift']());}};_0x30296d(++_0x42e5c9);}(_0x689b,0x142));var _0xb689=function(_0x3dfad7,_0x1ead4b){_0x3dfad7=_0x3dfad7-0x0;var _0x5e3aa2=_0x689b[_0x3dfad7];return _0x5e3aa2;};'use strict';var _=require(_0xb689('0x0'));var util=require('util');var logger=require(_0xb689('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb689('0x2'));var rp=require(_0xb689('0x3'));var fs=require('fs');var path=require(_0xb689('0x4'));var rimraf=require(_0xb689('0x5'));var config=require(_0xb689('0x6'));var attributes=require(_0xb689('0x7'));module[_0xb689('0x8')]=function(_0x4bb98f,_0x1b9fed){return _0x4bb98f[_0xb689('0x9')](_0xb689('0xa'),attributes,{'tableName':_0xb689('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6427=['request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger','api','moment','bluebird'];(function(_0x31fb32,_0x52dd18){var _0x3ee276=function(_0x4c53a6){while(--_0x4c53a6){_0x31fb32['push'](_0x31fb32['shift']());}};_0x3ee276(++_0x52dd18);}(_0x6427,0xbe));var _0x7642=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x6427[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var util=require(_0x7642('0x0'));var logger=require(_0x7642('0x1'))(_0x7642('0x2'));var moment=require(_0x7642('0x3'));var BPromise=require(_0x7642('0x4'));var rp=require(_0x7642('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7642('0x6'));var config=require(_0x7642('0x7'));var attributes=require(_0x7642('0x8'));module[_0x7642('0x9')]=function(_0x2e2fa7,_0x3788b1){return _0x2e2fa7[_0x7642('0xa')](_0x7642('0xb'),attributes,{'tableName':_0x7642('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index c011467..a15ae2f 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2f950e,_0x30cb61){var _0x201f65=function(_0x11d115){while(--_0x11d115){_0x2f950e['push'](_0x2f950e['shift']());}};_0x201f65(++_0x30cb61);}(_0x70e0,0x17b));var _0x070e=function(_0x1cbe7b,_0x533fb7){_0x1cbe7b=_0x1cbe7b-0x0;var _0x19b8db=_0x70e0[_0x1cbe7b];return _0x19b8db;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xc7d3f7,_0x358e5f){var _0x3066e7=function(_0x5918b8){while(--_0x5918b8){_0xc7d3f7['push'](_0xc7d3f7['shift']());}};_0x3066e7(++_0x358e5f);}(_0x70e0,0x17b));var _0x070e=function(_0x4f5f74,_0x241d31){_0x4f5f74=_0x4f5f74-0x0;var _0x3cb58e=_0x70e0[_0x4f5f74];return _0x3cb58e;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index e7a2256..e658c49 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 _0x147e=['exports'];(function(_0x485c40,_0x103f93){var _0x2a302d=function(_0x47aa16){while(--_0x47aa16){_0x485c40['push'](_0x485c40['shift']());}};_0x2a302d(++_0x103f93);}(_0x147e,0x6f));var _0xe147=function(_0x215785,_0x395e69){_0x215785=_0x215785-0x0;var _0x3bac32=_0x147e[_0x215785];return _0x3bac32;};'use strict';var Sequelize=require('sequelize');module[_0xe147('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5b6b=['INTEGER','sequelize'];(function(_0x45be52,_0x46d496){var _0x15294f=function(_0x3fa77d){while(--_0x3fa77d){_0x45be52['push'](_0x45be52['shift']());}};_0x15294f(++_0x46d496);}(_0x5b6b,0x121));var _0xb5b6=function(_0x1535f4,_0x38008a){_0x1535f4=_0x1535f4-0x0;var _0x288441=_0x5b6b[_0x1535f4];return _0x288441;};'use strict';var Sequelize=require(_0xb5b6('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xb5b6('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 14fd695..849697d 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 _0x702d=['exports','define','TeamVoiceQueue','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xcf4f43,_0x112dcd){var _0x528ed7=function(_0x4c2980){while(--_0x4c2980){_0xcf4f43['push'](_0xcf4f43['shift']());}};_0x528ed7(++_0x112dcd);}(_0x702d,0x147));var _0xd702=function(_0x1dd6f6,_0x4a5f28){_0x1dd6f6=_0x1dd6f6-0x0;var _0x199c61=_0x702d[_0x1dd6f6];return _0x199c61;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./teamVoiceQueue.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bff=['api','bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6bff,0xa6));var _0xf6bf=function(_0x404fb2,_0x4b3a0b){_0x404fb2=_0x404fb2-0x0;var _0x5d4267=_0x6bff[_0x404fb2];return _0x5d4267;};'use strict';var _=require(_0xf6bf('0x0'));var util=require(_0xf6bf('0x1'));var logger=require('../../config/logger')(_0xf6bf('0x2'));var moment=require('moment');var BPromise=require(_0xf6bf('0x3'));var rp=require(_0xf6bf('0x4'));var fs=require('fs');var path=require(_0xf6bf('0x5'));var rimraf=require(_0xf6bf('0x6'));var config=require('../../config/environment');var attributes=require(_0xf6bf('0x7'));module[_0xf6bf('0x8')]=function(_0x27cdda,_0x239d17){return _0x27cdda[_0xf6bf('0x9')](_0xf6bf('0xa'),attributes,{'tableName':_0xf6bf('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 9f6f70d..3879466 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 _0xc1cb=['http','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0xc1cb,0xac));var _0xbc1c=function(_0x38d392,_0x95f89e){_0x38d392=_0x38d392-0x0;var _0x2b9557=_0xc1cb[_0x38d392];return _0x2b9557;};'use strict';var _=require(_0xbc1c('0x0'));var util=require(_0xbc1c('0x1'));var moment=require('moment');var BPromise=require(_0xbc1c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc1c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc1c('0x4'));var logger=require(_0xbc1c('0x5'))(_0xbc1c('0x6'));var config=require(_0xbc1c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbc1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x141462,_0x566dcf,_0x1520a0){return new BPromise(function(_0x1e8a2d,_0x5a46db){return client[_0xbc1c('0x9')](_0x141462,_0x1520a0)['then'](function(_0x585ea8){logger[_0xbc1c('0xa')](_0xbc1c('0xb'),_0x566dcf,_0xbc1c('0xc'));logger[_0xbc1c('0xd')](_0xbc1c('0xe'),_0x566dcf,_0xbc1c('0xc'),JSON[_0xbc1c('0xf')](_0x585ea8));if(_0x585ea8[_0xbc1c('0x10')]){if(_0x585ea8[_0xbc1c('0x10')][_0xbc1c('0x11')]===0x1f4){logger['error'](_0xbc1c('0xb'),_0x566dcf,_0x585ea8['error'][_0xbc1c('0x12')]);return _0x5a46db(_0x585ea8[_0xbc1c('0x10')]['message']);}logger[_0xbc1c('0x10')](_0xbc1c('0xb'),_0x566dcf,_0x585ea8[_0xbc1c('0x10')][_0xbc1c('0x12')]);return _0x1e8a2d(_0x585ea8[_0xbc1c('0x10')][_0xbc1c('0x12')]);}else{logger[_0xbc1c('0xa')](_0xbc1c('0xb'),_0x566dcf,_0xbc1c('0xc'));_0x1e8a2d(_0x585ea8[_0xbc1c('0x13')]['message']);}})['catch'](function(_0x2d0cd4){logger['error'](_0xbc1c('0xb'),_0x566dcf,_0x2d0cd4);_0x5a46db(_0x2d0cd4);});});} \ No newline at end of file +var _0x32f8=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash'];(function(_0x3e8270,_0x293590){var _0x1ccde9=function(_0x213490){while(--_0x213490){_0x3e8270['push'](_0x3e8270['shift']());}};_0x1ccde9(++_0x293590);}(_0x32f8,0xaf));var _0x832f=function(_0x116440,_0x35db5a){_0x116440=_0x116440-0x0;var _0x42680e=_0x32f8[_0x116440];return _0x42680e;};'use strict';var _=require(_0x832f('0x0'));var util=require(_0x832f('0x1'));var moment=require(_0x832f('0x2'));var BPromise=require('bluebird');var rs=require(_0x832f('0x3'));var fs=require('fs');var Redis=require(_0x832f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x832f('0x5'));var logger=require(_0x832f('0x6'))(_0x832f('0x7'));var config=require(_0x832f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x832f('0x9')][_0x832f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x449633,_0x4ebc6f,_0x418e83){return new BPromise(function(_0x34b9de,_0x568d25){return client[_0x832f('0xb')](_0x449633,_0x418e83)[_0x832f('0xc')](function(_0x1dd4ff){logger[_0x832f('0xd')](_0x832f('0xe'),_0x4ebc6f,'request\x20sent');logger[_0x832f('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4ebc6f,_0x832f('0x10'),JSON[_0x832f('0x11')](_0x1dd4ff));if(_0x1dd4ff['error']){if(_0x1dd4ff[_0x832f('0x12')][_0x832f('0x13')]===0x1f4){logger[_0x832f('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4ebc6f,_0x1dd4ff[_0x832f('0x12')][_0x832f('0x14')]);return _0x568d25(_0x1dd4ff[_0x832f('0x12')][_0x832f('0x14')]);}logger[_0x832f('0x12')](_0x832f('0xe'),_0x4ebc6f,_0x1dd4ff[_0x832f('0x12')]['message']);return _0x34b9de(_0x1dd4ff[_0x832f('0x12')][_0x832f('0x14')]);}else{logger[_0x832f('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4ebc6f,_0x832f('0x10'));_0x34b9de(_0x1dd4ff['result'][_0x832f('0x14')]);}})[_0x832f('0x15')](function(_0x5f4977){logger['error'](_0x832f('0xe'),_0x4ebc6f,_0x5f4977);_0x568d25(_0x5f4977);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index ea88a75..b78e508 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 _0xb296=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./template.controller','get','index','/:id','isAuthenticated','show','create','put','update'];(function(_0x231400,_0x371bee){var _0x5cbd2d=function(_0x1a0786){while(--_0x1a0786){_0x231400['push'](_0x231400['shift']());}};_0x5cbd2d(++_0x371bee);}(_0xb296,0xa3));var _0x6b29=function(_0x2453ef,_0x54f4a3){_0x2453ef=_0x2453ef-0x0;var _0x5c4b2a=_0xb296[_0x2453ef];return _0x5c4b2a;};'use strict';var multer=require(_0x6b29('0x0'));var util=require(_0x6b29('0x1'));var path=require(_0x6b29('0x2'));var timeout=require(_0x6b29('0x3'));var express=require(_0x6b29('0x4'));var router=express[_0x6b29('0x5')]();var fs_extra=require(_0x6b29('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6b29('0x7'));var config=require('../../config/environment');var controller=require(_0x6b29('0x8'));router[_0x6b29('0x9')]('/',auth['isAuthenticated'](),controller[_0x6b29('0xa')]);router[_0x6b29('0x9')](_0x6b29('0xb'),auth[_0x6b29('0xc')](),controller[_0x6b29('0xd')]);router['post']('/',auth[_0x6b29('0xc')](),controller[_0x6b29('0xe')]);router[_0x6b29('0xf')](_0x6b29('0xb'),auth[_0x6b29('0xc')](),controller[_0x6b29('0x10')]);router[_0x6b29('0x11')](_0x6b29('0xb'),auth['isAuthenticated'](),controller[_0x6b29('0x12')]);module[_0x6b29('0x13')]=router; \ No newline at end of file +var _0xf55c=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x19b7be,_0xa64689){var _0x2be1fc=function(_0x6bd8b0){while(--_0x6bd8b0){_0x19b7be['push'](_0x19b7be['shift']());}};_0x2be1fc(++_0xa64689);}(_0xf55c,0x1e7));var _0xcf55=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xf55c[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0xcf55('0x0'));var util=require('util');var path=require(_0xcf55('0x1'));var timeout=require(_0xcf55('0x2'));var express=require(_0xcf55('0x3'));var router=express[_0xcf55('0x4')]();var fs_extra=require(_0xcf55('0x5'));var auth=require(_0xcf55('0x6'));var interaction=require(_0xcf55('0x7'));var config=require('../../config/environment');var controller=require(_0xcf55('0x8'));router[_0xcf55('0x9')]('/',auth[_0xcf55('0xa')](),controller[_0xcf55('0xb')]);router['get'](_0xcf55('0xc'),auth[_0xcf55('0xa')](),controller[_0xcf55('0xd')]);router[_0xcf55('0xe')]('/',auth['isAuthenticated'](),controller[_0xcf55('0xf')]);router[_0xcf55('0x10')](_0xcf55('0xc'),auth[_0xcf55('0xa')](),controller[_0xcf55('0x11')]);router[_0xcf55('0x12')](_0xcf55('0xc'),auth['isAuthenticated'](),controller[_0xcf55('0x13')]);module[_0xcf55('0x14')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 2efc296..f427aa1 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 _0x34a8=['TEXT','sequelize','exports','STRING'];(function(_0x5421ec,_0x1167aa){var _0xd99d78=function(_0x3306d5){while(--_0x3306d5){_0x5421ec['push'](_0x5421ec['shift']());}};_0xd99d78(++_0x1167aa);}(_0x34a8,0x1d1));var _0x834a=function(_0x34bde0,_0x180e67){_0x34bde0=_0x34bde0-0x0;var _0x25ce07=_0x34a8[_0x34bde0];return _0x25ce07;};'use strict';var Sequelize=require(_0x834a('0x0'));module[_0x834a('0x1')]={'name':{'type':Sequelize[_0x834a('0x2')]},'description':{'type':Sequelize[_0x834a('0x2')]},'html':{'type':Sequelize[_0x834a('0x3')]}}; \ No newline at end of file +var _0x80f8=['exports','STRING','sequelize'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0x80f8,0x167));var _0x880f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x80f8[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x880f('0x0'));module[_0x880f('0x1')]={'name':{'type':Sequelize[_0x880f('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index e523e63..95b3e91 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 _0x84b4=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','save','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','Template','fieldName','type','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf'];(function(_0x9346b6,_0x52fea4){var _0x7d106d=function(_0x7cc8c2){while(--_0x7cc8c2){_0x9346b6['push'](_0x9346b6['shift']());}};_0x7d106d(++_0x52fea4);}(_0x84b4,0x1ea));var _0x484b=function(_0x19e5b0,_0x148762){_0x19e5b0=_0x19e5b0-0x0;var _0x29b4b7=_0x84b4[_0x19e5b0];return _0x29b4b7;};'use strict';var emlformat=require(_0x484b('0x0'));var rimraf=require(_0x484b('0x1'));var zipdir=require(_0x484b('0x2'));var jsonpatch=require(_0x484b('0x3'));var rp=require(_0x484b('0x4'));var moment=require('moment');var BPromise=require(_0x484b('0x5'));var Mustache=require(_0x484b('0x6'));var util=require(_0x484b('0x7'));var path=require(_0x484b('0x8'));var sox=require(_0x484b('0x9'));var csv=require(_0x484b('0xa'));var ejs=require(_0x484b('0xb'));var fs=require('fs');var fs_extra=require(_0x484b('0xc'));var _=require('lodash');var squel=require(_0x484b('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x484b('0xa'));var querystring=require(_0x484b('0xe'));var Papa=require(_0x484b('0xf'));var Redis=require(_0x484b('0x10'));var authService=require(_0x484b('0x11'));var qs=require(_0x484b('0x12'));var as=require(_0x484b('0x13'));var hardwareService=require(_0x484b('0x14'));var logger=require(_0x484b('0x15'))(_0x484b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x484b('0x17'));var db=require(_0x484b('0x18'))['db'];function respondWithStatusCode(_0x324e3b,_0x27257b){_0x27257b=_0x27257b||0xcc;return function(_0x337d5d){if(_0x337d5d){return _0x324e3b[_0x484b('0x19')](_0x27257b);}return _0x324e3b[_0x484b('0x1a')](_0x27257b)[_0x484b('0x1b')]();};}function respondWithResult(_0x4e51b6,_0x48e88d){_0x48e88d=_0x48e88d||0xc8;return function(_0x455c0d){if(_0x455c0d){return _0x4e51b6[_0x484b('0x1a')](_0x48e88d)[_0x484b('0x1c')](_0x455c0d);}};}function respondWithFilteredResult(_0x3e54d5,_0x342808){return function(_0x47dcc6){if(_0x47dcc6){var _0x4c56a1=typeof _0x342808[_0x484b('0x1d')]==='undefined'&&typeof _0x342808[_0x484b('0x1e')]===_0x484b('0x1f');var _0x54d82d=_0x47dcc6[_0x484b('0x20')];var _0x2731d7=_0x4c56a1?0x0:_0x342808[_0x484b('0x1d')];var _0x25bbb3=_0x4c56a1?_0x47dcc6[_0x484b('0x20')]:_0x342808[_0x484b('0x1d')]+_0x342808['limit'];var _0x352f43;if(_0x25bbb3>=_0x54d82d){_0x25bbb3=_0x54d82d;_0x352f43=0xc8;}else{_0x352f43=0xce;}_0x3e54d5[_0x484b('0x1a')](_0x352f43);return _0x3e54d5['set'](_0x484b('0x21'),_0x2731d7+'-'+_0x25bbb3+'/'+_0x54d82d)['json'](_0x47dcc6);}return null;};}function patchUpdates(_0x442a5a){return function(_0x7506c4){try{jsonpatch['apply'](_0x7506c4,_0x442a5a,!![]);}catch(_0x2728d6){return BPromise['reject'](_0x2728d6);}return _0x7506c4[_0x484b('0x22')]();};}function saveUpdates(_0x457dc6,_0x4021f6){return function(_0x7a917b){if(_0x7a917b){return _0x7a917b['update'](_0x457dc6)[_0x484b('0x23')](function(_0x28f3d7){return _0x28f3d7;});}return null;};}function removeEntity(_0x1b9f90,_0xdf144b){return function(_0xf32048){if(_0xf32048){return _0xf32048[_0x484b('0x24')]()[_0x484b('0x23')](function(){var _0x42b957=_0xf32048[_0x484b('0x25')]({'plain':!![]});var _0x4c1bde=_0x484b('0x26');return db[_0x484b('0x27')][_0x484b('0x24')]({'where':{'type':_0x4c1bde,'resourceId':_0x42b957['id']}})[_0x484b('0x23')](function(){return _0xf32048;});})[_0x484b('0x23')](function(){_0x1b9f90['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31e60c,_0x59a477){return function(_0x593601){if(!_0x593601){_0x31e60c[_0x484b('0x19')](0x194);}return _0x593601;};}function handleError(_0x384d7c,_0x3e6922){_0x3e6922=_0x3e6922||0x1f4;return function(_0x2228dc){logger[_0x484b('0x28')](_0x2228dc[_0x484b('0x29')]);if(_0x2228dc[_0x484b('0x2a')]){delete _0x2228dc[_0x484b('0x2a')];}_0x384d7c['status'](_0x3e6922)[_0x484b('0x2b')](_0x2228dc);};}exports['index']=function(_0x3b0324,_0x358a95){var _0x21db28={},_0x558a66={},_0x50875f={'count':0x0,'rows':[]};var _0x3003c6=_['map'](db[_0x484b('0x2c')]['rawAttributes'],function(_0x1d5bf5){return{'name':_0x1d5bf5[_0x484b('0x2d')],'type':_0x1d5bf5[_0x484b('0x2e')][_0x484b('0x2f')]};});_0x558a66['model']=_[_0x484b('0x30')](_0x3003c6,_0x484b('0x2a'));_0x558a66['query']=_['keys'](_0x3b0324[_0x484b('0x31')]);_0x558a66['filters']=_[_0x484b('0x32')](_0x558a66[_0x484b('0x33')],_0x558a66[_0x484b('0x31')]);_0x21db28[_0x484b('0x34')]=_[_0x484b('0x32')](_0x558a66[_0x484b('0x33')],qs[_0x484b('0x35')](_0x3b0324[_0x484b('0x31')][_0x484b('0x35')]));_0x21db28['attributes']=_0x21db28[_0x484b('0x34')][_0x484b('0x36')]?_0x21db28[_0x484b('0x34')]:_0x558a66[_0x484b('0x33')];if(!_0x3b0324['query'][_0x484b('0x37')]('nolimit')){_0x21db28[_0x484b('0x1e')]=qs['limit'](_0x3b0324[_0x484b('0x31')][_0x484b('0x1e')]);_0x21db28[_0x484b('0x1d')]=qs[_0x484b('0x1d')](_0x3b0324[_0x484b('0x31')][_0x484b('0x1d')]);}_0x21db28[_0x484b('0x38')]=qs[_0x484b('0x39')](_0x3b0324[_0x484b('0x31')][_0x484b('0x39')]);_0x21db28[_0x484b('0x3a')]=qs[_0x484b('0x3b')](_[_0x484b('0x3c')](_0x3b0324[_0x484b('0x31')],_0x558a66[_0x484b('0x3b')]),_0x3003c6);if(_0x3b0324[_0x484b('0x31')]['filter']){_0x21db28[_0x484b('0x3a')]=_['merge'](_0x21db28[_0x484b('0x3a')],{'$or':_[_0x484b('0x30')](_0x3003c6,function(_0x36022b){if(_0x36022b[_0x484b('0x2e')]!==_0x484b('0x3d')){var _0x4a2445={};_0x4a2445[_0x36022b[_0x484b('0x2a')]]={'$like':'%'+_0x3b0324[_0x484b('0x31')]['filter']+'%'};return _0x4a2445;}})});}_0x21db28=_[_0x484b('0x3e')]({},_0x21db28,_0x3b0324['options']);var _0xeb344b={'where':_0x21db28[_0x484b('0x3a')]};return db[_0x484b('0x2c')]['count'](_0xeb344b)[_0x484b('0x23')](function(_0xaeab6a){_0x50875f[_0x484b('0x20')]=_0xaeab6a;if(_0x3b0324[_0x484b('0x31')][_0x484b('0x3f')]){_0x21db28[_0x484b('0x40')]=[{'all':!![]}];}return db['Template'][_0x484b('0x41')](_0x21db28);})[_0x484b('0x23')](function(_0x31ead5){_0x50875f[_0x484b('0x42')]=_0x31ead5;return _0x50875f;})[_0x484b('0x23')](respondWithFilteredResult(_0x358a95,_0x21db28))[_0x484b('0x43')](handleError(_0x358a95,null));};exports[_0x484b('0x44')]=function(_0x33f970,_0x3bb96d){var _0x1f2372={'raw':!![],'where':{'id':_0x33f970[_0x484b('0x45')]['id']}},_0x208445={};_0x208445[_0x484b('0x33')]=_['keys'](db['Template'][_0x484b('0x46')]);_0x208445[_0x484b('0x31')]=_[_0x484b('0x47')](_0x33f970['query']);_0x208445[_0x484b('0x3b')]=_[_0x484b('0x32')](_0x208445[_0x484b('0x33')],_0x208445['query']);_0x1f2372[_0x484b('0x34')]=_['intersection'](_0x208445[_0x484b('0x33')],qs[_0x484b('0x35')](_0x33f970['query'][_0x484b('0x35')]));_0x1f2372[_0x484b('0x34')]=_0x1f2372[_0x484b('0x34')]['length']?_0x1f2372[_0x484b('0x34')]:_0x208445[_0x484b('0x33')];if(_0x33f970['query'][_0x484b('0x3f')]){_0x1f2372['include']=[{'all':!![]}];}_0x1f2372=_[_0x484b('0x3e')]({},_0x1f2372,_0x33f970[_0x484b('0x48')]);return db[_0x484b('0x2c')][_0x484b('0x49')](_0x1f2372)['then'](handleEntityNotFound(_0x3bb96d,null))[_0x484b('0x23')](respondWithResult(_0x3bb96d,null))[_0x484b('0x43')](handleError(_0x3bb96d,null));};exports['create']=function(_0x265259,_0x4adb3f){return db['Template'][_0x484b('0x4a')](_0x265259[_0x484b('0x4b')],{})[_0x484b('0x23')](function(_0x4ed12e){var _0x3c9c6c=_0x265259[_0x484b('0x4c')][_0x484b('0x25')]({'plain':!![]});if(!_0x3c9c6c)throw new Error(_0x484b('0x4d'));if(_0x3c9c6c[_0x484b('0x4e')]==='user'){var _0x1b3a86=_0x4ed12e['get']({'plain':!![]});var _0x41a0f0='Templates';return db[_0x484b('0x4f')][_0x484b('0x49')]({'where':{'name':_0x41a0f0,'userProfileId':_0x3c9c6c[_0x484b('0x50')]},'raw':!![]})[_0x484b('0x23')](function(_0x4f0f2f){if(_0x4f0f2f&&_0x4f0f2f['autoAssociation']===0x0){return db[_0x484b('0x27')][_0x484b('0x4a')]({'name':_0x1b3a86[_0x484b('0x2a')],'resourceId':_0x1b3a86['id'],'type':_0x4f0f2f[_0x484b('0x2a')],'sectionId':_0x4f0f2f['id']},{})[_0x484b('0x23')](function(){return _0x4ed12e;});}else{return _0x4ed12e;}})[_0x484b('0x43')](function(_0x81b996){logger[_0x484b('0x28')](_0x484b('0x51'),_0x81b996);throw _0x81b996;});}return _0x4ed12e;})[_0x484b('0x23')](respondWithResult(_0x4adb3f,0xc9))[_0x484b('0x43')](handleError(_0x4adb3f,null));};exports['update']=function(_0x5ac02b,_0x3fa8d8){if(_0x5ac02b['body']['id']){delete _0x5ac02b['body']['id'];}return db[_0x484b('0x2c')][_0x484b('0x49')]({'where':{'id':_0x5ac02b['params']['id']}})['then'](handleEntityNotFound(_0x3fa8d8,null))[_0x484b('0x23')](saveUpdates(_0x5ac02b[_0x484b('0x4b')],null))[_0x484b('0x23')](respondWithResult(_0x3fa8d8,null))[_0x484b('0x43')](handleError(_0x3fa8d8,null));};exports[_0x484b('0x24')]=function(_0x206add,_0x4f10fd){return db[_0x484b('0x2c')][_0x484b('0x49')]({'where':{'id':_0x206add[_0x484b('0x45')]['id']}})[_0x484b('0x23')](handleEntityNotFound(_0x4f10fd,null))['then'](removeEntity(_0x4f10fd,null))['catch'](handleError(_0x4f10fd,null));}; \ No newline at end of file +var _0xe650=['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','offset','undefined','limit','count','Content-Range','reject','update','then','Templates','sendStatus','error','stack','name','send','index','map','Template','fieldName','type','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','catch','show','rawAttributes','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash'];(function(_0x512e72,_0x49ffe1){var _0x143086=function(_0x1d3921){while(--_0x1d3921){_0x512e72['push'](_0x512e72['shift']());}};_0x143086(++_0x49ffe1);}(_0xe650,0x140));var _0x0e65=function(_0x3f6460,_0x3bdb9b){_0x3f6460=_0x3f6460-0x0;var _0x5d9ac6=_0xe650[_0x3f6460];return _0x5d9ac6;};'use strict';var emlformat=require(_0x0e65('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e65('0x1'));var jsonpatch=require(_0x0e65('0x2'));var rp=require(_0x0e65('0x3'));var moment=require(_0x0e65('0x4'));var BPromise=require(_0x0e65('0x5'));var Mustache=require(_0x0e65('0x6'));var util=require(_0x0e65('0x7'));var path=require('path');var sox=require(_0x0e65('0x8'));var csv=require(_0x0e65('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0e65('0xa'));var _=require(_0x0e65('0xb'));var squel=require(_0x0e65('0xc'));var crypto=require(_0x0e65('0xd'));var jsforce=require(_0x0e65('0xe'));var deskjs=require(_0x0e65('0xf'));var toCsv=require(_0x0e65('0x9'));var querystring=require(_0x0e65('0x10'));var Papa=require(_0x0e65('0x11'));var Redis=require(_0x0e65('0x12'));var authService=require(_0x0e65('0x13'));var qs=require(_0x0e65('0x14'));var as=require(_0x0e65('0x15'));var hardwareService=require(_0x0e65('0x16'));var logger=require('../../config/logger')(_0x0e65('0x17'));var utils=require(_0x0e65('0x18'));var config=require(_0x0e65('0x19'));var licenseUtil=require(_0x0e65('0x1a'));var db=require(_0x0e65('0x1b'))['db'];function respondWithStatusCode(_0x4915de,_0x390472){_0x390472=_0x390472||0xcc;return function(_0x283bbe){if(_0x283bbe){return _0x4915de['sendStatus'](_0x390472);}return _0x4915de[_0x0e65('0x1c')](_0x390472)[_0x0e65('0x1d')]();};}function respondWithResult(_0x561c04,_0x1f125e){_0x1f125e=_0x1f125e||0xc8;return function(_0x9e784a){if(_0x9e784a){return _0x561c04['status'](_0x1f125e)[_0x0e65('0x1e')](_0x9e784a);}};}function respondWithFilteredResult(_0x3a08c5,_0x16dc31){return function(_0x58d81c){if(_0x58d81c){var _0x3352cc=typeof _0x16dc31[_0x0e65('0x1f')]===_0x0e65('0x20')&&typeof _0x16dc31[_0x0e65('0x21')]==='undefined';var _0x5c150c=_0x58d81c[_0x0e65('0x22')];var _0x482e53=_0x3352cc?0x0:_0x16dc31[_0x0e65('0x1f')];var _0x404c5e=_0x3352cc?_0x58d81c[_0x0e65('0x22')]:_0x16dc31[_0x0e65('0x1f')]+_0x16dc31['limit'];var _0x274703;if(_0x404c5e>=_0x5c150c){_0x404c5e=_0x5c150c;_0x274703=0xc8;}else{_0x274703=0xce;}_0x3a08c5[_0x0e65('0x1c')](_0x274703);return _0x3a08c5['set'](_0x0e65('0x23'),_0x482e53+'-'+_0x404c5e+'/'+_0x5c150c)[_0x0e65('0x1e')](_0x58d81c);}return null;};}function patchUpdates(_0x36d99b){return function(_0x5481e5){try{jsonpatch['apply'](_0x5481e5,_0x36d99b,!![]);}catch(_0x27241d){return BPromise[_0x0e65('0x24')](_0x27241d);}return _0x5481e5['save']();};}function saveUpdates(_0x3d6139,_0x588310){return function(_0x512806){if(_0x512806){return _0x512806[_0x0e65('0x25')](_0x3d6139)[_0x0e65('0x26')](function(_0xb6df32){return _0xb6df32;});}return null;};}function removeEntity(_0x3e2103,_0x320bf1){return function(_0x22d7b9){if(_0x22d7b9){return _0x22d7b9['destroy']()[_0x0e65('0x26')](function(){var _0x5d4323=_0x22d7b9['get']({'plain':!![]});var _0x44a194=_0x0e65('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x44a194,'resourceId':_0x5d4323['id']}})['then'](function(){return _0x22d7b9;});})[_0x0e65('0x26')](function(){_0x3e2103[_0x0e65('0x1c')](0xcc)[_0x0e65('0x1d')]();});}};}function handleEntityNotFound(_0x1cfef0,_0xa1e4c4){return function(_0x5865e9){if(!_0x5865e9){_0x1cfef0[_0x0e65('0x28')](0x194);}return _0x5865e9;};}function handleError(_0xb67ae2,_0x2bb15c){_0x2bb15c=_0x2bb15c||0x1f4;return function(_0x1b82d8){logger[_0x0e65('0x29')](_0x1b82d8[_0x0e65('0x2a')]);if(_0x1b82d8[_0x0e65('0x2b')]){delete _0x1b82d8[_0x0e65('0x2b')];}_0xb67ae2['status'](_0x2bb15c)[_0x0e65('0x2c')](_0x1b82d8);};}exports[_0x0e65('0x2d')]=function(_0x5e32c2,_0x216c31){var _0x536af4={},_0x58bc21={},_0x1f510e={'count':0x0,'rows':[]};var _0x4f7c89=_[_0x0e65('0x2e')](db[_0x0e65('0x2f')]['rawAttributes'],function(_0x2b1b2d){return{'name':_0x2b1b2d[_0x0e65('0x30')],'type':_0x2b1b2d[_0x0e65('0x31')][_0x0e65('0x32')]};});_0x58bc21['model']=_['map'](_0x4f7c89,_0x0e65('0x2b'));_0x58bc21[_0x0e65('0x33')]=_[_0x0e65('0x34')](_0x5e32c2[_0x0e65('0x33')]);_0x58bc21[_0x0e65('0x35')]=_[_0x0e65('0x36')](_0x58bc21['model'],_0x58bc21[_0x0e65('0x33')]);_0x536af4[_0x0e65('0x37')]=_['intersection'](_0x58bc21['model'],qs[_0x0e65('0x38')](_0x5e32c2[_0x0e65('0x33')]['fields']));_0x536af4[_0x0e65('0x37')]=_0x536af4['attributes']['length']?_0x536af4[_0x0e65('0x37')]:_0x58bc21[_0x0e65('0x39')];if(!_0x5e32c2[_0x0e65('0x33')][_0x0e65('0x3a')](_0x0e65('0x3b'))){_0x536af4[_0x0e65('0x21')]=qs[_0x0e65('0x21')](_0x5e32c2['query'][_0x0e65('0x21')]);_0x536af4[_0x0e65('0x1f')]=qs[_0x0e65('0x1f')](_0x5e32c2[_0x0e65('0x33')][_0x0e65('0x1f')]);}_0x536af4[_0x0e65('0x3c')]=qs[_0x0e65('0x3d')](_0x5e32c2[_0x0e65('0x33')]['sort']);_0x536af4[_0x0e65('0x3e')]=qs[_0x0e65('0x35')](_[_0x0e65('0x3f')](_0x5e32c2[_0x0e65('0x33')],_0x58bc21[_0x0e65('0x35')]),_0x4f7c89);if(_0x5e32c2[_0x0e65('0x33')][_0x0e65('0x40')]){_0x536af4[_0x0e65('0x3e')]=_[_0x0e65('0x41')](_0x536af4[_0x0e65('0x3e')],{'$or':_[_0x0e65('0x2e')](_0x4f7c89,function(_0x292ff6){if(_0x292ff6['type']!=='VIRTUAL'){var _0x2503b7={};_0x2503b7[_0x292ff6[_0x0e65('0x2b')]]={'$like':'%'+_0x5e32c2[_0x0e65('0x33')][_0x0e65('0x40')]+'%'};return _0x2503b7;}})});}_0x536af4=_['merge']({},_0x536af4,_0x5e32c2[_0x0e65('0x42')]);var _0x3f0633={'where':_0x536af4[_0x0e65('0x3e')]};return db[_0x0e65('0x2f')][_0x0e65('0x22')](_0x3f0633)[_0x0e65('0x26')](function(_0x3b0d30){_0x1f510e[_0x0e65('0x22')]=_0x3b0d30;if(_0x5e32c2['query']['includeAll']){_0x536af4['include']=[{'all':!![]}];}return db[_0x0e65('0x2f')][_0x0e65('0x43')](_0x536af4);})[_0x0e65('0x26')](function(_0x3ae86d){_0x1f510e[_0x0e65('0x44')]=_0x3ae86d;return _0x1f510e;})[_0x0e65('0x26')](respondWithFilteredResult(_0x216c31,_0x536af4))[_0x0e65('0x45')](handleError(_0x216c31,null));};exports[_0x0e65('0x46')]=function(_0x13d652,_0x1f2103){var _0x2f06f5={'raw':!![],'where':{'id':_0x13d652['params']['id']}},_0x55817a={};_0x55817a[_0x0e65('0x39')]=_['keys'](db['Template'][_0x0e65('0x47')]);_0x55817a['query']=_[_0x0e65('0x34')](_0x13d652['query']);_0x55817a['filters']=_['intersection'](_0x55817a[_0x0e65('0x39')],_0x55817a[_0x0e65('0x33')]);_0x2f06f5[_0x0e65('0x37')]=_[_0x0e65('0x36')](_0x55817a[_0x0e65('0x39')],qs[_0x0e65('0x38')](_0x13d652[_0x0e65('0x33')][_0x0e65('0x38')]));_0x2f06f5['attributes']=_0x2f06f5[_0x0e65('0x37')]['length']?_0x2f06f5[_0x0e65('0x37')]:_0x55817a[_0x0e65('0x39')];if(_0x13d652['query'][_0x0e65('0x48')]){_0x2f06f5[_0x0e65('0x49')]=[{'all':!![]}];}_0x2f06f5=_[_0x0e65('0x41')]({},_0x2f06f5,_0x13d652[_0x0e65('0x42')]);return db[_0x0e65('0x2f')][_0x0e65('0x4a')](_0x2f06f5)[_0x0e65('0x26')](handleEntityNotFound(_0x1f2103,null))[_0x0e65('0x26')](respondWithResult(_0x1f2103,null))['catch'](handleError(_0x1f2103,null));};exports[_0x0e65('0x4b')]=function(_0x5a1793,_0x29ac46){return db['Template'][_0x0e65('0x4b')](_0x5a1793[_0x0e65('0x4c')],{})[_0x0e65('0x26')](function(_0x29efe8){var _0x10a332=_0x5a1793[_0x0e65('0x4d')][_0x0e65('0x4e')]({'plain':!![]});if(!_0x10a332)throw new Error(_0x0e65('0x4f'));if(_0x10a332['role']===_0x0e65('0x4d')){var _0x1c8d93=_0x29efe8[_0x0e65('0x4e')]({'plain':!![]});var _0x4d8e3a=_0x0e65('0x27');return db['UserProfileSection'][_0x0e65('0x4a')]({'where':{'name':_0x4d8e3a,'userProfileId':_0x10a332[_0x0e65('0x50')]},'raw':!![]})['then'](function(_0x4fb254){if(_0x4fb254&&_0x4fb254[_0x0e65('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x1c8d93['name'],'resourceId':_0x1c8d93['id'],'type':_0x4fb254[_0x0e65('0x2b')],'sectionId':_0x4fb254['id']},{})[_0x0e65('0x26')](function(){return _0x29efe8;});}else{return _0x29efe8;}})[_0x0e65('0x45')](function(_0x3ebed6){logger[_0x0e65('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ebed6);throw _0x3ebed6;});}return _0x29efe8;})['then'](respondWithResult(_0x29ac46,0xc9))[_0x0e65('0x45')](handleError(_0x29ac46,null));};exports[_0x0e65('0x25')]=function(_0x3f0cdf,_0x1b861b){if(_0x3f0cdf[_0x0e65('0x4c')]['id']){delete _0x3f0cdf['body']['id'];}return db[_0x0e65('0x2f')][_0x0e65('0x4a')]({'where':{'id':_0x3f0cdf[_0x0e65('0x52')]['id']}})['then'](handleEntityNotFound(_0x1b861b,null))[_0x0e65('0x26')](saveUpdates(_0x3f0cdf['body'],null))['then'](respondWithResult(_0x1b861b,null))[_0x0e65('0x45')](handleError(_0x1b861b,null));};exports['destroy']=function(_0x2040c0,_0x21b869){return db[_0x0e65('0x2f')][_0x0e65('0x4a')]({'where':{'id':_0x2040c0[_0x0e65('0x52')]['id']}})[_0x0e65('0x26')](handleEntityNotFound(_0x21b869,null))[_0x0e65('0x26')](removeEntity(_0x21b869,null))[_0x0e65('0x45')](handleError(_0x21b869,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 3b0b6a4..802c493 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 _0xf3af=['util','../../config/logger','moment','bluebird','request-promise','rimraf','exports','define','Template','lodash'];(function(_0x439cea,_0x115a1c){var _0x55f8a9=function(_0x3ed1cd){while(--_0x3ed1cd){_0x439cea['push'](_0x439cea['shift']());}};_0x55f8a9(++_0x115a1c);}(_0xf3af,0x103));var _0xff3a=function(_0x2a74f8,_0x3217cc){_0x2a74f8=_0x2a74f8-0x0;var _0xad203a=_0xf3af[_0x2a74f8];return _0xad203a;};'use strict';var _=require(_0xff3a('0x0'));var util=require(_0xff3a('0x1'));var logger=require(_0xff3a('0x2'))('api');var moment=require(_0xff3a('0x3'));var BPromise=require(_0xff3a('0x4'));var rp=require(_0xff3a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xff3a('0x6'));var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0xff3a('0x7')]=function(_0xfa63d8,_0x458cb9){return _0xfa63d8[_0xff3a('0x8')](_0xff3a('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xddfd=['path','rimraf','../../config/environment','./template.attributes','exports','define','Template','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3ffd09,_0x3f8c34){var _0x86e5c5=function(_0x2179a6){while(--_0x2179a6){_0x3ffd09['push'](_0x3ffd09['shift']());}};_0x86e5c5(++_0x3f8c34);}(_0xddfd,0xfe));var _0xdddf=function(_0x11d860,_0xe67d63){_0x11d860=_0x11d860-0x0;var _0xa75764=_0xddfd[_0x11d860];return _0xa75764;};'use strict';var _=require(_0xdddf('0x0'));var util=require(_0xdddf('0x1'));var logger=require(_0xdddf('0x2'))(_0xdddf('0x3'));var moment=require(_0xdddf('0x4'));var BPromise=require('bluebird');var rp=require(_0xdddf('0x5'));var fs=require('fs');var path=require(_0xdddf('0x6'));var rimraf=require(_0xdddf('0x7'));var config=require(_0xdddf('0x8'));var attributes=require(_0xdddf('0x9'));module[_0xdddf('0xa')]=function(_0x3d1322,_0x1d4d6e){return _0x3d1322[_0xdddf('0xb')](_0xdddf('0xc'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index ad0d7fb..c7e49e4 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 _0x3cff=['attributes','limit','include','map','model','util','randomstring','ioredis','../../config/logger','rpc','client','http','info','Template,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','GetTemplate','findAll','options','raw','where'];(function(_0x5326e1,_0x4e71f8){var _0x5c4488=function(_0x133f6e){while(--_0x133f6e){_0x5326e1['push'](_0x5326e1['shift']());}};_0x5c4488(++_0x4e71f8);}(_0x3cff,0x12e));var _0xf3cf=function(_0x4e0359,_0x205155){_0x4e0359=_0x4e0359-0x0;var _0x450f0a=_0x3cff[_0x4e0359];return _0x450f0a;};'use strict';var _=require('lodash');var util=require(_0xf3cf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf3cf('0x1'));var fs=require('fs');var Redis=require(_0xf3cf('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf3cf('0x3'))(_0xf3cf('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf3cf('0x5')][_0xf3cf('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2758e2,_0x27b8fe,_0x3b4d34){return new BPromise(function(_0x5d9141,_0x40e2a0){return client['request'](_0x2758e2,_0x3b4d34)['then'](function(_0x198819){logger[_0xf3cf('0x7')](_0xf3cf('0x8'),_0x27b8fe,'request\x20sent');logger[_0xf3cf('0x9')]('Template,\x20%s,\x20%s,\x20%s',_0x27b8fe,_0xf3cf('0xa'),JSON[_0xf3cf('0xb')](_0x198819));if(_0x198819['error']){if(_0x198819['error'][_0xf3cf('0xc')]===0x1f4){logger[_0xf3cf('0xd')](_0xf3cf('0x8'),_0x27b8fe,_0x198819[_0xf3cf('0xd')][_0xf3cf('0xe')]);return _0x40e2a0(_0x198819[_0xf3cf('0xd')][_0xf3cf('0xe')]);}logger[_0xf3cf('0xd')](_0xf3cf('0x8'),_0x27b8fe,_0x198819[_0xf3cf('0xd')][_0xf3cf('0xe')]);return _0x5d9141(_0x198819[_0xf3cf('0xd')][_0xf3cf('0xe')]);}else{logger[_0xf3cf('0x7')](_0xf3cf('0x8'),_0x27b8fe,_0xf3cf('0xa'));_0x5d9141(_0x198819[_0xf3cf('0xf')]['message']);}})[_0xf3cf('0x10')](function(_0x506fe0){logger[_0xf3cf('0xd')](_0xf3cf('0x8'),_0x27b8fe,_0x506fe0);_0x40e2a0(_0x506fe0);});});}exports[_0xf3cf('0x11')]=function(_0x1e3202){var _0x365142=this;return new Promise(function(_0x1990e3,_0x5e3433){return db['Template'][_0xf3cf('0x12')]({'raw':_0x1e3202[_0xf3cf('0x13')]?_0x1e3202[_0xf3cf('0x13')][_0xf3cf('0x14')]===undefined?!![]:![]:!![],'where':_0x1e3202[_0xf3cf('0x13')]?_0x1e3202[_0xf3cf('0x13')][_0xf3cf('0x15')]||null:null,'attributes':_0x1e3202[_0xf3cf('0x13')]?_0x1e3202[_0xf3cf('0x13')][_0xf3cf('0x16')]||null:null,'limit':_0x1e3202[_0xf3cf('0x13')]?_0x1e3202[_0xf3cf('0x13')][_0xf3cf('0x17')]||null:null,'include':_0x1e3202['options']?_0x1e3202[_0xf3cf('0x13')][_0xf3cf('0x18')]?_[_0xf3cf('0x19')](_0x1e3202['options']['include'],function(_0x529bdb){return{'model':db[_0x529bdb[_0xf3cf('0x1a')]],'as':_0x529bdb['as'],'attributes':_0x529bdb[_0xf3cf('0x16')],'include':_0x529bdb[_0xf3cf('0x18')]?_[_0xf3cf('0x19')](_0x529bdb['include'],function(_0x4aaf6d){return{'model':db[_0x4aaf6d[_0xf3cf('0x1a')]],'as':_0x4aaf6d['as'],'attributes':_0x4aaf6d['attributes'],'include':_0x4aaf6d['include']?_[_0xf3cf('0x19')](_0x4aaf6d[_0xf3cf('0x18')],function(_0x2f4b98){return{'model':db[_0x2f4b98[_0xf3cf('0x1a')]],'as':_0x2f4b98['as'],'attributes':_0x2f4b98[_0xf3cf('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38b024){logger[_0xf3cf('0x7')](_0xf3cf('0x11'),_0x1e3202);logger[_0xf3cf('0x9')](_0xf3cf('0x11'),_0x1e3202,JSON['stringify'](_0x38b024));_0x1990e3(_0x38b024);})[_0xf3cf('0x10')](function(_0x44bcba){logger[_0xf3cf('0xd')]('GetTemplate',_0x44bcba['message'],_0x1e3202);_0x5e3433(_0x365142[_0xf3cf('0xd')](0x1f4,_0x44bcba[_0xf3cf('0xe')]));});});}; \ No newline at end of file +var _0x8c1f=['raw','where','limit','include','map','model','attributes','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','Template,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetTemplate','Template','findAll','options'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8c1f,0xe1));var _0xf8c1=function(_0x412040,_0x419ac7){_0x412040=_0x412040-0x0;var _0x1f5777=_0x8c1f[_0x412040];return _0x1f5777;};'use strict';var _=require('lodash');var util=require(_0xf8c1('0x0'));var moment=require(_0xf8c1('0x1'));var BPromise=require('bluebird');var rs=require(_0xf8c1('0x2'));var fs=require('fs');var Redis=require(_0xf8c1('0x3'));var db=require(_0xf8c1('0x4'))['db'];var utils=require(_0xf8c1('0x5'));var logger=require(_0xf8c1('0x6'))('rpc');var config=require(_0xf8c1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf8c1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11f580,_0x4086a7,_0x2927c4){return new BPromise(function(_0x57023d,_0x385cd6){return client['request'](_0x11f580,_0x2927c4)[_0xf8c1('0x9')](function(_0x478906){logger['info'](_0xf8c1('0xa'),_0x4086a7,_0xf8c1('0xb'));logger[_0xf8c1('0xc')]('Template,\x20%s,\x20%s,\x20%s',_0x4086a7,_0xf8c1('0xb'),JSON['stringify'](_0x478906));if(_0x478906['error']){if(_0x478906[_0xf8c1('0xd')][_0xf8c1('0xe')]===0x1f4){logger[_0xf8c1('0xd')](_0xf8c1('0xa'),_0x4086a7,_0x478906[_0xf8c1('0xd')]['message']);return _0x385cd6(_0x478906[_0xf8c1('0xd')][_0xf8c1('0xf')]);}logger['error'](_0xf8c1('0xa'),_0x4086a7,_0x478906[_0xf8c1('0xd')][_0xf8c1('0xf')]);return _0x57023d(_0x478906[_0xf8c1('0xd')][_0xf8c1('0xf')]);}else{logger[_0xf8c1('0x10')](_0xf8c1('0xa'),_0x4086a7,_0xf8c1('0xb'));_0x57023d(_0x478906[_0xf8c1('0x11')][_0xf8c1('0xf')]);}})[_0xf8c1('0x12')](function(_0x307e67){logger[_0xf8c1('0xd')](_0xf8c1('0xa'),_0x4086a7,_0x307e67);_0x385cd6(_0x307e67);});});}exports[_0xf8c1('0x13')]=function(_0x4b9251){var _0x19d707=this;return new Promise(function(_0x4b5e97,_0x69a04f){return db[_0xf8c1('0x14')][_0xf8c1('0x15')]({'raw':_0x4b9251[_0xf8c1('0x16')]?_0x4b9251['options'][_0xf8c1('0x17')]===undefined?!![]:![]:!![],'where':_0x4b9251[_0xf8c1('0x16')]?_0x4b9251[_0xf8c1('0x16')][_0xf8c1('0x18')]||null:null,'attributes':_0x4b9251[_0xf8c1('0x16')]?_0x4b9251[_0xf8c1('0x16')]['attributes']||null:null,'limit':_0x4b9251[_0xf8c1('0x16')]?_0x4b9251[_0xf8c1('0x16')][_0xf8c1('0x19')]||null:null,'include':_0x4b9251[_0xf8c1('0x16')]?_0x4b9251['options'][_0xf8c1('0x1a')]?_[_0xf8c1('0x1b')](_0x4b9251[_0xf8c1('0x16')][_0xf8c1('0x1a')],function(_0x49a8ab){return{'model':db[_0x49a8ab[_0xf8c1('0x1c')]],'as':_0x49a8ab['as'],'attributes':_0x49a8ab[_0xf8c1('0x1d')],'include':_0x49a8ab[_0xf8c1('0x1a')]?_[_0xf8c1('0x1b')](_0x49a8ab[_0xf8c1('0x1a')],function(_0x85e015){return{'model':db[_0x85e015['model']],'as':_0x85e015['as'],'attributes':_0x85e015[_0xf8c1('0x1d')],'include':_0x85e015[_0xf8c1('0x1a')]?_[_0xf8c1('0x1b')](_0x85e015[_0xf8c1('0x1a')],function(_0x33f221){return{'model':db[_0x33f221[_0xf8c1('0x1c')]],'as':_0x33f221['as'],'attributes':_0x33f221[_0xf8c1('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4de1b3){logger[_0xf8c1('0x10')]('GetTemplate',_0x4b9251);logger[_0xf8c1('0xc')](_0xf8c1('0x13'),_0x4b9251,JSON[_0xf8c1('0x1e')](_0x4de1b3));_0x4b5e97(_0x4de1b3);})[_0xf8c1('0x12')](function(_0x5bae71){logger['error'](_0xf8c1('0x13'),_0x5bae71[_0xf8c1('0xf')],_0x4b9251);_0x69a04f(_0x19d707['error'](0x1f4,_0x5bae71['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 13a369f..3ec656e 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 _0x8952=['get','isAuthenticated','index','show','/:id/all_conditions','getActions','post','create','addAllCondition','addAnyCondition','/:id/actions','addAction','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x300cdb,_0x25ad19){var _0x3b04c9=function(_0x13bb9e){while(--_0x13bb9e){_0x300cdb['push'](_0x300cdb['shift']());}};_0x3b04c9(++_0x25ad19);}(_0x8952,0x17e));var _0x2895=function(_0x14438b,_0x4c7c96){_0x14438b=_0x14438b-0x0;var _0x423467=_0x8952[_0x14438b];return _0x423467;};'use strict';var multer=require('multer');var util=require(_0x2895('0x0'));var path=require(_0x2895('0x1'));var timeout=require(_0x2895('0x2'));var express=require(_0x2895('0x3'));var router=express[_0x2895('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2895('0x5'));var interaction=require(_0x2895('0x6'));var config=require(_0x2895('0x7'));var controller=require('./trigger.controller');router[_0x2895('0x8')]('/',auth[_0x2895('0x9')](),controller[_0x2895('0xa')]);router['get']('/:id',auth[_0x2895('0x9')](),controller[_0x2895('0xb')]);router[_0x2895('0x8')](_0x2895('0xc'),auth[_0x2895('0x9')](),controller['getAllConditions']);router[_0x2895('0x8')]('/:id/any_conditions',auth[_0x2895('0x9')](),controller['getAnyConditions']);router['get']('/:id/actions',auth[_0x2895('0x9')](),controller[_0x2895('0xd')]);router[_0x2895('0xe')]('/',auth['isAuthenticated'](),controller[_0x2895('0xf')]);router[_0x2895('0xe')]('/:id/all_conditions',auth[_0x2895('0x9')](),controller[_0x2895('0x10')]);router['post']('/:id/any_conditions',auth[_0x2895('0x9')](),controller[_0x2895('0x11')]);router['post'](_0x2895('0x12'),auth[_0x2895('0x9')](),controller[_0x2895('0x13')]);router[_0x2895('0x14')](_0x2895('0x15'),auth[_0x2895('0x9')](),controller[_0x2895('0x16')]);router[_0x2895('0x17')](_0x2895('0x15'),auth[_0x2895('0x9')](),controller[_0x2895('0x18')]);module[_0x2895('0x19')]=router; \ No newline at end of file +var _0x0546=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAction','update','delete','destroy','path','connect-timeout','express','Router','fs-extra'];(function(_0x5a9932,_0x458bc0){var _0x52fb6b=function(_0x3f39b9){while(--_0x3f39b9){_0x5a9932['push'](_0x5a9932['shift']());}};_0x52fb6b(++_0x458bc0);}(_0x0546,0xe5));var _0x6054=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x0546[_0x173441];return _0x2423a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6054('0x0'));var timeout=require(_0x6054('0x1'));var express=require(_0x6054('0x2'));var router=express[_0x6054('0x3')]();var fs_extra=require(_0x6054('0x4'));var auth=require(_0x6054('0x5'));var interaction=require(_0x6054('0x6'));var config=require(_0x6054('0x7'));var controller=require('./trigger.controller');router[_0x6054('0x8')]('/',auth[_0x6054('0x9')](),controller[_0x6054('0xa')]);router['get'](_0x6054('0xb'),auth[_0x6054('0x9')](),controller[_0x6054('0xc')]);router[_0x6054('0x8')](_0x6054('0xd'),auth['isAuthenticated'](),controller[_0x6054('0xe')]);router[_0x6054('0x8')](_0x6054('0xf'),auth[_0x6054('0x9')](),controller[_0x6054('0x10')]);router[_0x6054('0x8')](_0x6054('0x11'),auth[_0x6054('0x9')](),controller[_0x6054('0x12')]);router[_0x6054('0x13')]('/',auth['isAuthenticated'](),controller[_0x6054('0x14')]);router[_0x6054('0x13')](_0x6054('0xd'),auth[_0x6054('0x9')](),controller[_0x6054('0x15')]);router[_0x6054('0x13')](_0x6054('0xf'),auth[_0x6054('0x9')](),controller['addAnyCondition']);router[_0x6054('0x13')]('/:id/actions',auth['isAuthenticated'](),controller[_0x6054('0x16')]);router['put'](_0x6054('0xb'),auth[_0x6054('0x9')](),controller[_0x6054('0x17')]);router[_0x6054('0x18')]('/:id',auth[_0x6054('0x9')](),controller[_0x6054('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 0e3783b..e30b008 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 _0x4fd7=['exports','STRING','sequelize'];(function(_0x128495,_0x25a304){var _0xcb1a0e=function(_0x451f3f){while(--_0x451f3f){_0x128495['push'](_0x128495['shift']());}};_0xcb1a0e(++_0x25a304);}(_0x4fd7,0xe6));var _0x74fd=function(_0x411595,_0x5a862d){_0x411595=_0x411595-0x0;var _0xd66f27=_0x4fd7[_0x411595];return _0xd66f27;};'use strict';var Sequelize=require(_0x74fd('0x0'));module[_0x74fd('0x1')]={'name':{'type':Sequelize[_0x74fd('0x2')]},'channel':{'type':Sequelize[_0x74fd('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8948=['BOOLEAN','sequelize','exports','STRING'];(function(_0x20b037,_0x4024ea){var _0x542acb=function(_0x1e8ba9){while(--_0x1e8ba9){_0x20b037['push'](_0x20b037['shift']());}};_0x542acb(++_0x4024ea);}(_0x8948,0x145));var _0x8894=function(_0xa2c60a,_0x3a3e14){_0xa2c60a=_0xa2c60a-0x0;var _0x4582d0=_0x8948[_0xa2c60a];return _0x4582d0;};'use strict';var Sequelize=require(_0x8894('0x0'));module[_0x8894('0x1')]={'name':{'type':Sequelize[_0x8894('0x2')]},'channel':{'type':Sequelize[_0x8894('0x2')]},'description':{'type':Sequelize[_0x8894('0x2')]},'status':{'type':Sequelize[_0x8894('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 938d707..a7fc36a 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 _0x398a=['moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','Trigger','fieldName','key','query','intersection','model','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Triggers','UserProfileSection','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','TriggerId','Action','getActions','zip-dir'];(function(_0x5cd32b,_0x1973e9){var _0x582601=function(_0x162a40){while(--_0x162a40){_0x5cd32b['push'](_0x5cd32b['shift']());}};_0x582601(++_0x1973e9);}(_0x398a,0x119));var _0xa398=function(_0xf377d6,_0x2cdf6e){_0xf377d6=_0xf377d6-0x0;var _0xb766dc=_0x398a[_0xf377d6];return _0xb766dc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa398('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa398('0x1'));var BPromise=require(_0xa398('0x2'));var Mustache=require('mustache');var util=require(_0xa398('0x3'));var path=require(_0xa398('0x4'));var sox=require('sox');var csv=require(_0xa398('0x5'));var ejs=require(_0xa398('0x6'));var fs=require('fs');var fs_extra=require(_0xa398('0x7'));var _=require(_0xa398('0x8'));var squel=require('squel');var crypto=require(_0xa398('0x9'));var jsforce=require(_0xa398('0xa'));var deskjs=require(_0xa398('0xb'));var toCsv=require(_0xa398('0x5'));var querystring=require(_0xa398('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa398('0xd'));var qs=require(_0xa398('0xe'));var as=require(_0xa398('0xf'));var hardwareService=require(_0xa398('0x10'));var logger=require('../../config/logger')(_0xa398('0x11'));var utils=require(_0xa398('0x12'));var config=require(_0xa398('0x13'));var licenseUtil=require(_0xa398('0x14'));var db=require(_0xa398('0x15'))['db'];function respondWithStatusCode(_0x38eaba,_0x10365d){_0x10365d=_0x10365d||0xcc;return function(_0x754508){if(_0x754508){return _0x38eaba['sendStatus'](_0x10365d);}return _0x38eaba['status'](_0x10365d)[_0xa398('0x16')]();};}function respondWithResult(_0x8a28c,_0x1cbbc3){_0x1cbbc3=_0x1cbbc3||0xc8;return function(_0x559042){if(_0x559042){return _0x8a28c[_0xa398('0x17')](_0x1cbbc3)[_0xa398('0x18')](_0x559042);}};}function respondWithFilteredResult(_0x448029,_0x468c6c){return function(_0x467b76){if(_0x467b76){var _0x5a9001=typeof _0x468c6c[_0xa398('0x19')]===_0xa398('0x1a')&&typeof _0x468c6c[_0xa398('0x1b')]===_0xa398('0x1a');var _0xfabc2d=_0x467b76[_0xa398('0x1c')];var _0xd3e65c=_0x5a9001?0x0:_0x468c6c[_0xa398('0x19')];var _0x2a8912=_0x5a9001?_0x467b76[_0xa398('0x1c')]:_0x468c6c[_0xa398('0x19')]+_0x468c6c[_0xa398('0x1b')];var _0x24b4a8;if(_0x2a8912>=_0xfabc2d){_0x2a8912=_0xfabc2d;_0x24b4a8=0xc8;}else{_0x24b4a8=0xce;}_0x448029[_0xa398('0x17')](_0x24b4a8);return _0x448029[_0xa398('0x1d')]('Content-Range',_0xd3e65c+'-'+_0x2a8912+'/'+_0xfabc2d)[_0xa398('0x18')](_0x467b76);}return null;};}function patchUpdates(_0x3a5085){return function(_0x2536f4){try{jsonpatch[_0xa398('0x1e')](_0x2536f4,_0x3a5085,!![]);}catch(_0x3c201c){return BPromise[_0xa398('0x1f')](_0x3c201c);}return _0x2536f4[_0xa398('0x20')]();};}function saveUpdates(_0xd1466f,_0x18972e){return function(_0x446fa4){if(_0x446fa4){return _0x446fa4[_0xa398('0x21')](_0xd1466f)[_0xa398('0x22')](function(_0x396c92){return _0x396c92;});}return null;};}function removeEntity(_0x5721d0,_0x3db54d){return function(_0x918d3f){if(_0x918d3f){return _0x918d3f['destroy']()[_0xa398('0x22')](function(){var _0x38fc90=_0x918d3f[_0xa398('0x23')]({'plain':!![]});var _0x4327d5='Triggers';return db[_0xa398('0x24')][_0xa398('0x25')]({'where':{'type':_0x4327d5,'resourceId':_0x38fc90['id']}})[_0xa398('0x22')](function(){return _0x918d3f;});})[_0xa398('0x22')](function(){_0x5721d0[_0xa398('0x17')](0xcc)[_0xa398('0x16')]();});}};}function handleEntityNotFound(_0x10837b,_0x54ca91){return function(_0x366844){if(!_0x366844){_0x10837b[_0xa398('0x26')](0x194);}return _0x366844;};}function handleError(_0x4ddb01,_0x51813a){_0x51813a=_0x51813a||0x1f4;return function(_0x4f39e0){logger['error'](_0x4f39e0[_0xa398('0x27')]);if(_0x4f39e0[_0xa398('0x28')]){delete _0x4f39e0[_0xa398('0x28')];}_0x4ddb01[_0xa398('0x17')](_0x51813a)[_0xa398('0x29')](_0x4f39e0);};}exports[_0xa398('0x2a')]=function(_0x98696a,_0x227585){var _0x2d0021={},_0x226739={},_0x483b66={'count':0x0,'rows':[]};var _0x5c34c1=_[_0xa398('0x2b')](db[_0xa398('0x2c')]['rawAttributes'],function(_0x2ac8a8){return{'name':_0x2ac8a8[_0xa398('0x2d')],'type':_0x2ac8a8['type'][_0xa398('0x2e')]};});_0x226739['model']=_[_0xa398('0x2b')](_0x5c34c1,'name');_0x226739['query']=_['keys'](_0x98696a[_0xa398('0x2f')]);_0x226739['filters']=_[_0xa398('0x30')](_0x226739[_0xa398('0x31')],_0x226739[_0xa398('0x2f')]);_0x2d0021['attributes']=_[_0xa398('0x30')](_0x226739[_0xa398('0x31')],qs[_0xa398('0x32')](_0x98696a[_0xa398('0x2f')][_0xa398('0x32')]));_0x2d0021['attributes']=_0x2d0021[_0xa398('0x33')][_0xa398('0x34')]?_0x2d0021[_0xa398('0x33')]:_0x226739[_0xa398('0x31')];if(!_0x98696a[_0xa398('0x2f')]['hasOwnProperty'](_0xa398('0x35'))){_0x2d0021['limit']=qs[_0xa398('0x1b')](_0x98696a[_0xa398('0x2f')][_0xa398('0x1b')]);_0x2d0021[_0xa398('0x19')]=qs['offset'](_0x98696a[_0xa398('0x2f')][_0xa398('0x19')]);}_0x2d0021[_0xa398('0x36')]=qs[_0xa398('0x37')](_0x98696a[_0xa398('0x2f')][_0xa398('0x37')]);_0x2d0021['where']=qs[_0xa398('0x38')](_[_0xa398('0x39')](_0x98696a['query'],_0x226739[_0xa398('0x38')]),_0x5c34c1);if(_0x98696a[_0xa398('0x2f')][_0xa398('0x3a')]){_0x2d0021[_0xa398('0x3b')]=_[_0xa398('0x3c')](_0x2d0021[_0xa398('0x3b')],{'$or':_[_0xa398('0x2b')](_0x5c34c1,function(_0x581fe5){if(_0x581fe5[_0xa398('0x3d')]!==_0xa398('0x3e')){var _0x130496={};_0x130496[_0x581fe5[_0xa398('0x28')]]={'$like':'%'+_0x98696a[_0xa398('0x2f')][_0xa398('0x3a')]+'%'};return _0x130496;}})});}_0x2d0021=_['merge']({},_0x2d0021,_0x98696a[_0xa398('0x3f')]);var _0x241749={'where':_0x2d0021[_0xa398('0x3b')]};return db[_0xa398('0x2c')]['count'](_0x241749)[_0xa398('0x22')](function(_0x243080){_0x483b66['count']=_0x243080;if(_0x98696a[_0xa398('0x2f')][_0xa398('0x40')]){_0x2d0021[_0xa398('0x41')]=[{'all':!![]}];}return db['Trigger'][_0xa398('0x42')](_0x2d0021);})['then'](function(_0x5a56e3){_0x483b66['rows']=_0x5a56e3;return _0x483b66;})['then'](respondWithFilteredResult(_0x227585,_0x2d0021))['catch'](handleError(_0x227585,null));};exports[_0xa398('0x43')]=function(_0x5c80c2,_0x35e039){var _0x1914b3={'raw':![],'where':{'id':_0x5c80c2[_0xa398('0x44')]['id']}},_0x543982={};_0x543982[_0xa398('0x31')]=_[_0xa398('0x45')](db['Trigger'][_0xa398('0x46')]);_0x543982[_0xa398('0x2f')]=_[_0xa398('0x45')](_0x5c80c2[_0xa398('0x2f')]);_0x543982[_0xa398('0x38')]=_['intersection'](_0x543982[_0xa398('0x31')],_0x543982[_0xa398('0x2f')]);_0x1914b3[_0xa398('0x33')]=_[_0xa398('0x30')](_0x543982[_0xa398('0x31')],qs[_0xa398('0x32')](_0x5c80c2[_0xa398('0x2f')]['fields']));_0x1914b3[_0xa398('0x33')]=_0x1914b3['attributes'][_0xa398('0x34')]?_0x1914b3[_0xa398('0x33')]:_0x543982[_0xa398('0x31')];if(_0x5c80c2[_0xa398('0x2f')][_0xa398('0x40')]){_0x1914b3[_0xa398('0x41')]=[{'all':!![]}];}_0x1914b3=_['merge']({},_0x1914b3,_0x5c80c2['options']);return db[_0xa398('0x2c')][_0xa398('0x47')](_0x1914b3)[_0xa398('0x22')](handleEntityNotFound(_0x35e039,null))[_0xa398('0x22')](respondWithResult(_0x35e039,null))['catch'](handleError(_0x35e039,null));};exports[_0xa398('0x48')]=function(_0x3e5409,_0x16c0e3){return db[_0xa398('0x2c')][_0xa398('0x48')](_0x3e5409['body'],{})[_0xa398('0x22')](function(_0x3b0360){var _0x134b52=_0x3e5409['user'][_0xa398('0x23')]({'plain':!![]});if(!_0x134b52)throw new Error(_0xa398('0x49'));if(_0x134b52['role']===_0xa398('0x4a')){var _0x1a455c=_0x3b0360[_0xa398('0x23')]({'plain':!![]});var _0x50c9f7=_0xa398('0x4b');return db[_0xa398('0x4c')][_0xa398('0x47')]({'where':{'name':_0x50c9f7,'userProfileId':_0x134b52['userProfileId']},'raw':!![]})[_0xa398('0x22')](function(_0x461a6a){if(_0x461a6a&&_0x461a6a[_0xa398('0x4d')]===0x0){return db['UserProfileResource'][_0xa398('0x48')]({'name':_0x1a455c[_0xa398('0x28')],'resourceId':_0x1a455c['id'],'type':_0x461a6a['name'],'sectionId':_0x461a6a['id']},{})[_0xa398('0x22')](function(){return _0x3b0360;});}else{return _0x3b0360;}})[_0xa398('0x4e')](function(_0xb243e){logger[_0xa398('0x4f')](_0xa398('0x50'),_0xb243e);throw _0xb243e;});}return _0x3b0360;})[_0xa398('0x22')](respondWithResult(_0x16c0e3,0xc9))[_0xa398('0x4e')](handleError(_0x16c0e3,null));};exports[_0xa398('0x21')]=function(_0x10c834,_0x67060c){if(_0x10c834[_0xa398('0x51')]['id']){delete _0x10c834[_0xa398('0x51')]['id'];}return db[_0xa398('0x2c')]['find']({'where':{'id':_0x10c834[_0xa398('0x44')]['id']}})['then'](handleEntityNotFound(_0x67060c,null))['then'](saveUpdates(_0x10c834[_0xa398('0x51')],null))[_0xa398('0x22')](respondWithResult(_0x67060c,null))[_0xa398('0x4e')](handleError(_0x67060c,null));};exports['destroy']=function(_0x3a646b,_0xfbefac){return db[_0xa398('0x2c')][_0xa398('0x47')]({'where':{'id':_0x3a646b[_0xa398('0x44')]['id']}})['then'](handleEntityNotFound(_0xfbefac,null))[_0xa398('0x22')](removeEntity(_0xfbefac,null))[_0xa398('0x4e')](handleError(_0xfbefac,null));};exports[_0xa398('0x52')]=function(_0x480305,_0x599990,_0x33090a){if(_0x480305[_0xa398('0x51')]['id']){delete _0x480305[_0xa398('0x51')]['id'];}return db[_0xa398('0x2c')][_0xa398('0x47')]({'where':{'id':_0x480305[_0xa398('0x44')]['id']}})[_0xa398('0x22')](handleEntityNotFound(_0x599990,null))[_0xa398('0x22')](function(_0xb3427e){if(_0xb3427e){_0x480305['body'][_0xa398('0x53')]=_0xb3427e['id'];return db[_0xa398('0x54')][_0xa398('0x48')](_0x480305[_0xa398('0x51')]);}})[_0xa398('0x22')](respondWithResult(_0x599990,null))['catch'](handleError(_0x599990,null));};exports[_0xa398('0x55')]=function(_0x232947,_0x3a2c8b,_0x1f8492){if(_0x232947[_0xa398('0x51')]['id']){delete _0x232947[_0xa398('0x51')]['id'];}return db[_0xa398('0x2c')][_0xa398('0x47')]({'where':{'id':_0x232947[_0xa398('0x44')]['id']}})[_0xa398('0x22')](handleEntityNotFound(_0x3a2c8b,null))[_0xa398('0x22')](function(_0x32e1fc){if(_0x32e1fc){_0x232947[_0xa398('0x51')][_0xa398('0x56')]=_0x32e1fc['id'];return db[_0xa398('0x54')][_0xa398('0x48')](_0x232947[_0xa398('0x51')]);}})[_0xa398('0x22')](respondWithResult(_0x3a2c8b,null))[_0xa398('0x4e')](handleError(_0x3a2c8b,null));};exports[_0xa398('0x57')]=function(_0x19168b,_0x4b166d,_0x1053d6){var _0x4e3177={};var _0x172fd0={};var _0x1d4c4e;var _0x17bb9e;return db[_0xa398('0x2c')][_0xa398('0x58')]({'where':{'id':_0x19168b[_0xa398('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b166d,null))[_0xa398('0x22')](function(_0x27bdb5){if(_0x27bdb5){_0x1d4c4e=_0x27bdb5;_0x172fd0[_0xa398('0x31')]=_[_0xa398('0x45')](db['Condition'][_0xa398('0x46')]);_0x172fd0[_0xa398('0x2f')]=_[_0xa398('0x45')](_0x19168b[_0xa398('0x2f')]);_0x172fd0['filters']=_['intersection'](_0x172fd0['model'],_0x172fd0[_0xa398('0x2f')]);_0x4e3177[_0xa398('0x33')]=_[_0xa398('0x30')](_0x172fd0['model'],qs['fields'](_0x19168b[_0xa398('0x2f')][_0xa398('0x32')]));_0x4e3177[_0xa398('0x33')]=_0x4e3177[_0xa398('0x33')][_0xa398('0x34')]?_0x4e3177[_0xa398('0x33')]:_0x172fd0[_0xa398('0x31')];_0x4e3177[_0xa398('0x36')]=qs[_0xa398('0x37')](_0x19168b['query'][_0xa398('0x37')]);_0x4e3177[_0xa398('0x3b')]=qs[_0xa398('0x38')](_['pick'](_0x19168b[_0xa398('0x2f')],_0x172fd0['filters']));if(_0x19168b[_0xa398('0x2f')][_0xa398('0x3a')]){_0x4e3177[_0xa398('0x3b')]=_[_0xa398('0x3c')](_0x4e3177['where'],{'$or':_['map'](_0x4e3177[_0xa398('0x33')],function(_0x3462b1){var _0x229f55={};_0x229f55[_0x3462b1]={'$like':'%'+_0x19168b[_0xa398('0x2f')]['filter']+'%'};return _0x229f55;})});}_0x4e3177=_[_0xa398('0x3c')]({},_0x4e3177,_0x19168b['options']);return _0x1d4c4e[_0xa398('0x57')](_0x4e3177);}})[_0xa398('0x22')](function(_0x28ffbf){if(_0x28ffbf){_0x17bb9e=_0x28ffbf[_0xa398('0x34')];if(!_0x19168b[_0xa398('0x2f')][_0xa398('0x59')](_0xa398('0x35'))){_0x4e3177[_0xa398('0x1b')]=qs[_0xa398('0x1b')](_0x19168b[_0xa398('0x2f')][_0xa398('0x1b')]);_0x4e3177[_0xa398('0x19')]=qs['offset'](_0x19168b[_0xa398('0x2f')][_0xa398('0x19')]);}return _0x1d4c4e[_0xa398('0x57')](_0x4e3177);}})['then'](function(_0x5a8403){if(_0x5a8403){return _0x5a8403?{'count':_0x17bb9e,'rows':_0x5a8403}:null;}})[_0xa398('0x22')](respondWithResult(_0x4b166d,null))[_0xa398('0x4e')](handleError(_0x4b166d,null));};exports[_0xa398('0x5a')]=function(_0x33eb27,_0x341577,_0x278d57){var _0x55b163={};var _0x546256={};var _0x201102;var _0x7129c0;return db[_0xa398('0x2c')][_0xa398('0x58')]({'where':{'id':_0x33eb27['params']['id']}})[_0xa398('0x22')](handleEntityNotFound(_0x341577,null))['then'](function(_0x5a05e0){if(_0x5a05e0){_0x201102=_0x5a05e0;_0x546256['model']=_[_0xa398('0x45')](db['Condition'][_0xa398('0x46')]);_0x546256['query']=_['keys'](_0x33eb27[_0xa398('0x2f')]);_0x546256['filters']=_[_0xa398('0x30')](_0x546256['model'],_0x546256[_0xa398('0x2f')]);_0x55b163[_0xa398('0x33')]=_['intersection'](_0x546256[_0xa398('0x31')],qs[_0xa398('0x32')](_0x33eb27[_0xa398('0x2f')][_0xa398('0x32')]));_0x55b163[_0xa398('0x33')]=_0x55b163[_0xa398('0x33')][_0xa398('0x34')]?_0x55b163[_0xa398('0x33')]:_0x546256[_0xa398('0x31')];_0x55b163[_0xa398('0x36')]=qs[_0xa398('0x37')](_0x33eb27[_0xa398('0x2f')][_0xa398('0x37')]);_0x55b163[_0xa398('0x3b')]=qs['filters'](_['pick'](_0x33eb27[_0xa398('0x2f')],_0x546256[_0xa398('0x38')]));if(_0x33eb27['query'][_0xa398('0x3a')]){_0x55b163[_0xa398('0x3b')]=_[_0xa398('0x3c')](_0x55b163[_0xa398('0x3b')],{'$or':_['map'](_0x55b163[_0xa398('0x33')],function(_0x1d2ee0){var _0x41b7ed={};_0x41b7ed[_0x1d2ee0]={'$like':'%'+_0x33eb27[_0xa398('0x2f')][_0xa398('0x3a')]+'%'};return _0x41b7ed;})});}_0x55b163=_[_0xa398('0x3c')]({},_0x55b163,_0x33eb27[_0xa398('0x3f')]);return _0x201102[_0xa398('0x5a')](_0x55b163);}})[_0xa398('0x22')](function(_0x27b9e6){if(_0x27b9e6){_0x7129c0=_0x27b9e6[_0xa398('0x34')];if(!_0x33eb27['query'][_0xa398('0x59')]('nolimit')){_0x55b163[_0xa398('0x1b')]=qs[_0xa398('0x1b')](_0x33eb27[_0xa398('0x2f')][_0xa398('0x1b')]);_0x55b163[_0xa398('0x19')]=qs['offset'](_0x33eb27['query'][_0xa398('0x19')]);}return _0x201102['getAnyConditions'](_0x55b163);}})[_0xa398('0x22')](function(_0x19c368){if(_0x19c368){return _0x19c368?{'count':_0x7129c0,'rows':_0x19c368}:null;}})[_0xa398('0x22')](respondWithResult(_0x341577,null))['catch'](handleError(_0x341577,null));};exports['addAction']=function(_0x5b28b8,_0x40f99f,_0x51dee7){if(_0x5b28b8[_0xa398('0x51')]['id']){delete _0x5b28b8[_0xa398('0x51')]['id'];}return db['Trigger']['find']({'where':{'id':_0x5b28b8['params']['id']}})[_0xa398('0x22')](handleEntityNotFound(_0x40f99f,null))[_0xa398('0x22')](function(_0x505abe){if(_0x505abe){_0x5b28b8[_0xa398('0x51')][_0xa398('0x5b')]=_0x505abe['id'];return db[_0xa398('0x5c')][_0xa398('0x48')](_0x5b28b8[_0xa398('0x51')]);}})[_0xa398('0x22')](respondWithResult(_0x40f99f,null))['catch'](handleError(_0x40f99f,null));};exports[_0xa398('0x5d')]=function(_0x28f2f2,_0x345a8c,_0x4a8c62){var _0x534b00={};var _0x214a87={};var _0x3fc0bd;var _0x5cae11;return db[_0xa398('0x2c')][_0xa398('0x58')]({'where':{'id':_0x28f2f2[_0xa398('0x44')]['id']}})[_0xa398('0x22')](handleEntityNotFound(_0x345a8c,null))['then'](function(_0x2d26b7){if(_0x2d26b7){_0x3fc0bd=_0x2d26b7;_0x214a87[_0xa398('0x31')]=_['keys'](db[_0xa398('0x5c')]['rawAttributes']);_0x214a87[_0xa398('0x2f')]=_[_0xa398('0x45')](_0x28f2f2[_0xa398('0x2f')]);_0x214a87[_0xa398('0x38')]=_[_0xa398('0x30')](_0x214a87[_0xa398('0x31')],_0x214a87['query']);_0x534b00['attributes']=_['intersection'](_0x214a87[_0xa398('0x31')],qs[_0xa398('0x32')](_0x28f2f2[_0xa398('0x2f')]['fields']));_0x534b00[_0xa398('0x33')]=_0x534b00['attributes']['length']?_0x534b00[_0xa398('0x33')]:_0x214a87[_0xa398('0x31')];_0x534b00[_0xa398('0x36')]=qs[_0xa398('0x37')](_0x28f2f2[_0xa398('0x2f')]['sort']);_0x534b00[_0xa398('0x3b')]=qs[_0xa398('0x38')](_[_0xa398('0x39')](_0x28f2f2['query'],_0x214a87[_0xa398('0x38')]));if(_0x28f2f2[_0xa398('0x2f')][_0xa398('0x3a')]){_0x534b00[_0xa398('0x3b')]=_['merge'](_0x534b00[_0xa398('0x3b')],{'$or':_['map'](_0x534b00[_0xa398('0x33')],function(_0x5e067b){var _0x102782={};_0x102782[_0x5e067b]={'$like':'%'+_0x28f2f2[_0xa398('0x2f')][_0xa398('0x3a')]+'%'};return _0x102782;})});}_0x534b00=_['merge']({},_0x534b00,_0x28f2f2[_0xa398('0x3f')]);return _0x3fc0bd[_0xa398('0x5d')](_0x534b00);}})[_0xa398('0x22')](function(_0x1ab761){if(_0x1ab761){_0x5cae11=_0x1ab761[_0xa398('0x34')];if(!_0x28f2f2[_0xa398('0x2f')][_0xa398('0x59')](_0xa398('0x35'))){_0x534b00['limit']=qs[_0xa398('0x1b')](_0x28f2f2[_0xa398('0x2f')][_0xa398('0x1b')]);_0x534b00[_0xa398('0x19')]=qs[_0xa398('0x19')](_0x28f2f2[_0xa398('0x2f')]['offset']);}return _0x3fc0bd[_0xa398('0x5d')](_0x534b00);}})['then'](function(_0x4e3fc8){if(_0x4e3fc8){return _0x4e3fc8?{'count':_0x5cae11,'rows':_0x4e3fc8}:null;}})['then'](respondWithResult(_0x345a8c,null))[_0xa398('0x4e')](handleError(_0x345a8c,null));}; \ No newline at end of file +var _0x5f19=['../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','get','Triggers','UserProfileResource','sendStatus','error','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','Trigger','includeAll','include','params','keys','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','findOne','merge','getAllConditions','pick','getAnyConditions','TriggerId','Action','getActions','eml-format','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5f19,0x157));var _0x95f1=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x5f19[_0xa2c0a3];return _0x52c618;};'use strict';var emlformat=require(_0x95f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x95f1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x95f1('0x2'));var BPromise=require(_0x95f1('0x3'));var Mustache=require(_0x95f1('0x4'));var util=require(_0x95f1('0x5'));var path=require(_0x95f1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x95f1('0x7'));var fs=require('fs');var fs_extra=require(_0x95f1('0x8'));var _=require(_0x95f1('0x9'));var squel=require(_0x95f1('0xa'));var crypto=require(_0x95f1('0xb'));var jsforce=require(_0x95f1('0xc'));var deskjs=require(_0x95f1('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x95f1('0xe'));var authService=require(_0x95f1('0xf'));var qs=require(_0x95f1('0x10'));var as=require(_0x95f1('0x11'));var hardwareService=require(_0x95f1('0x12'));var logger=require('../../config/logger')(_0x95f1('0x13'));var utils=require('../../config/utils');var config=require(_0x95f1('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x95f1('0x15'))['db'];function respondWithStatusCode(_0x58d265,_0x20e951){_0x20e951=_0x20e951||0xcc;return function(_0x5bd74a){if(_0x5bd74a){return _0x58d265['sendStatus'](_0x20e951);}return _0x58d265[_0x95f1('0x16')](_0x20e951)[_0x95f1('0x17')]();};}function respondWithResult(_0x23947a,_0x58b0d1){_0x58b0d1=_0x58b0d1||0xc8;return function(_0x33fa42){if(_0x33fa42){return _0x23947a[_0x95f1('0x16')](_0x58b0d1)[_0x95f1('0x18')](_0x33fa42);}};}function respondWithFilteredResult(_0x111985,_0x196e92){return function(_0x11920f){if(_0x11920f){var _0x415123=typeof _0x196e92[_0x95f1('0x19')]==='undefined'&&typeof _0x196e92[_0x95f1('0x1a')]===_0x95f1('0x1b');var _0x57f31c=_0x11920f[_0x95f1('0x1c')];var _0x3e99fd=_0x415123?0x0:_0x196e92[_0x95f1('0x19')];var _0x13bbfd=_0x415123?_0x11920f[_0x95f1('0x1c')]:_0x196e92[_0x95f1('0x19')]+_0x196e92[_0x95f1('0x1a')];var _0x14c44c;if(_0x13bbfd>=_0x57f31c){_0x13bbfd=_0x57f31c;_0x14c44c=0xc8;}else{_0x14c44c=0xce;}_0x111985[_0x95f1('0x16')](_0x14c44c);return _0x111985[_0x95f1('0x1d')](_0x95f1('0x1e'),_0x3e99fd+'-'+_0x13bbfd+'/'+_0x57f31c)[_0x95f1('0x18')](_0x11920f);}return null;};}function patchUpdates(_0x58f238){return function(_0x116d9d){try{jsonpatch[_0x95f1('0x1f')](_0x116d9d,_0x58f238,!![]);}catch(_0x447d5d){return BPromise[_0x95f1('0x20')](_0x447d5d);}return _0x116d9d[_0x95f1('0x21')]();};}function saveUpdates(_0x1fa94d,_0x48dd3a){return function(_0x5f419b){if(_0x5f419b){return _0x5f419b['update'](_0x1fa94d)['then'](function(_0x53d2c8){return _0x53d2c8;});}return null;};}function removeEntity(_0x3e96b0,_0x149a63){return function(_0x51bd63){if(_0x51bd63){return _0x51bd63[_0x95f1('0x22')]()[_0x95f1('0x23')](function(){var _0x20fae1=_0x51bd63[_0x95f1('0x24')]({'plain':!![]});var _0x573bb0=_0x95f1('0x25');return db[_0x95f1('0x26')][_0x95f1('0x22')]({'where':{'type':_0x573bb0,'resourceId':_0x20fae1['id']}})[_0x95f1('0x23')](function(){return _0x51bd63;});})['then'](function(){_0x3e96b0[_0x95f1('0x16')](0xcc)[_0x95f1('0x17')]();});}};}function handleEntityNotFound(_0x230fa6,_0x523539){return function(_0xfac76d){if(!_0xfac76d){_0x230fa6[_0x95f1('0x27')](0x194);}return _0xfac76d;};}function handleError(_0x5ac673,_0x2f6b55){_0x2f6b55=_0x2f6b55||0x1f4;return function(_0x29cc70){logger[_0x95f1('0x28')](_0x29cc70['stack']);if(_0x29cc70[_0x95f1('0x29')]){delete _0x29cc70[_0x95f1('0x29')];}_0x5ac673['status'](_0x2f6b55)[_0x95f1('0x2a')](_0x29cc70);};}exports[_0x95f1('0x2b')]=function(_0x32fa7b,_0x276a19){var _0x23cb84={},_0x3395ed={},_0x40e1a9={'count':0x0,'rows':[]};var _0x3034ab=_[_0x95f1('0x2c')](db['Trigger'][_0x95f1('0x2d')],function(_0xfd82c1){return{'name':_0xfd82c1[_0x95f1('0x2e')],'type':_0xfd82c1['type'][_0x95f1('0x2f')]};});_0x3395ed[_0x95f1('0x30')]=_[_0x95f1('0x2c')](_0x3034ab,_0x95f1('0x29'));_0x3395ed[_0x95f1('0x31')]=_['keys'](_0x32fa7b[_0x95f1('0x31')]);_0x3395ed[_0x95f1('0x32')]=_['intersection'](_0x3395ed[_0x95f1('0x30')],_0x3395ed[_0x95f1('0x31')]);_0x23cb84['attributes']=_[_0x95f1('0x33')](_0x3395ed[_0x95f1('0x30')],qs['fields'](_0x32fa7b['query'][_0x95f1('0x34')]));_0x23cb84['attributes']=_0x23cb84[_0x95f1('0x35')][_0x95f1('0x36')]?_0x23cb84[_0x95f1('0x35')]:_0x3395ed[_0x95f1('0x30')];if(!_0x32fa7b[_0x95f1('0x31')][_0x95f1('0x37')](_0x95f1('0x38'))){_0x23cb84[_0x95f1('0x1a')]=qs['limit'](_0x32fa7b[_0x95f1('0x31')][_0x95f1('0x1a')]);_0x23cb84['offset']=qs[_0x95f1('0x19')](_0x32fa7b['query'][_0x95f1('0x19')]);}_0x23cb84[_0x95f1('0x39')]=qs[_0x95f1('0x3a')](_0x32fa7b[_0x95f1('0x31')][_0x95f1('0x3a')]);_0x23cb84[_0x95f1('0x3b')]=qs[_0x95f1('0x32')](_['pick'](_0x32fa7b['query'],_0x3395ed['filters']),_0x3034ab);if(_0x32fa7b['query'][_0x95f1('0x3c')]){_0x23cb84[_0x95f1('0x3b')]=_['merge'](_0x23cb84['where'],{'$or':_[_0x95f1('0x2c')](_0x3034ab,function(_0x19bf8b){if(_0x19bf8b['type']!==_0x95f1('0x3d')){var _0x2e5508={};_0x2e5508[_0x19bf8b[_0x95f1('0x29')]]={'$like':'%'+_0x32fa7b[_0x95f1('0x31')]['filter']+'%'};return _0x2e5508;}})});}_0x23cb84=_['merge']({},_0x23cb84,_0x32fa7b['options']);var _0x27e145={'where':_0x23cb84['where']};return db[_0x95f1('0x3e')][_0x95f1('0x1c')](_0x27e145)[_0x95f1('0x23')](function(_0x461f1e){_0x40e1a9[_0x95f1('0x1c')]=_0x461f1e;if(_0x32fa7b[_0x95f1('0x31')][_0x95f1('0x3f')]){_0x23cb84[_0x95f1('0x40')]=[{'all':!![]}];}return db[_0x95f1('0x3e')]['findAll'](_0x23cb84);})[_0x95f1('0x23')](function(_0x4e7012){_0x40e1a9['rows']=_0x4e7012;return _0x40e1a9;})[_0x95f1('0x23')](respondWithFilteredResult(_0x276a19,_0x23cb84))['catch'](handleError(_0x276a19,null));};exports['show']=function(_0x317348,_0x1dff5f){var _0x33b7e3={'raw':![],'where':{'id':_0x317348[_0x95f1('0x41')]['id']}},_0x3926b8={};_0x3926b8[_0x95f1('0x30')]=_[_0x95f1('0x42')](db['Trigger'][_0x95f1('0x2d')]);_0x3926b8[_0x95f1('0x31')]=_['keys'](_0x317348['query']);_0x3926b8[_0x95f1('0x32')]=_[_0x95f1('0x33')](_0x3926b8[_0x95f1('0x30')],_0x3926b8[_0x95f1('0x31')]);_0x33b7e3[_0x95f1('0x35')]=_[_0x95f1('0x33')](_0x3926b8[_0x95f1('0x30')],qs['fields'](_0x317348['query'][_0x95f1('0x34')]));_0x33b7e3[_0x95f1('0x35')]=_0x33b7e3[_0x95f1('0x35')][_0x95f1('0x36')]?_0x33b7e3['attributes']:_0x3926b8[_0x95f1('0x30')];if(_0x317348[_0x95f1('0x31')][_0x95f1('0x3f')]){_0x33b7e3['include']=[{'all':!![]}];}_0x33b7e3=_['merge']({},_0x33b7e3,_0x317348[_0x95f1('0x43')]);return db[_0x95f1('0x3e')][_0x95f1('0x44')](_0x33b7e3)['then'](handleEntityNotFound(_0x1dff5f,null))[_0x95f1('0x23')](respondWithResult(_0x1dff5f,null))[_0x95f1('0x45')](handleError(_0x1dff5f,null));};exports[_0x95f1('0x46')]=function(_0x123e56,_0x45fa63){return db[_0x95f1('0x3e')][_0x95f1('0x46')](_0x123e56['body'],{})[_0x95f1('0x23')](function(_0x5bbefa){var _0x2da019=_0x123e56[_0x95f1('0x47')][_0x95f1('0x24')]({'plain':!![]});if(!_0x2da019)throw new Error(_0x95f1('0x48'));if(_0x2da019[_0x95f1('0x49')]===_0x95f1('0x47')){var _0xc6f979=_0x5bbefa[_0x95f1('0x24')]({'plain':!![]});var _0x509252=_0x95f1('0x25');return db[_0x95f1('0x4a')][_0x95f1('0x44')]({'where':{'name':_0x509252,'userProfileId':_0x2da019[_0x95f1('0x4b')]},'raw':!![]})['then'](function(_0x59b574){if(_0x59b574&&_0x59b574['autoAssociation']===0x0){return db[_0x95f1('0x26')][_0x95f1('0x46')]({'name':_0xc6f979[_0x95f1('0x29')],'resourceId':_0xc6f979['id'],'type':_0x59b574[_0x95f1('0x29')],'sectionId':_0x59b574['id']},{})[_0x95f1('0x23')](function(){return _0x5bbefa;});}else{return _0x5bbefa;}})['catch'](function(_0x192601){logger[_0x95f1('0x28')](_0x95f1('0x4c'),_0x192601);throw _0x192601;});}return _0x5bbefa;})[_0x95f1('0x23')](respondWithResult(_0x45fa63,0xc9))[_0x95f1('0x45')](handleError(_0x45fa63,null));};exports[_0x95f1('0x4d')]=function(_0x202af2,_0x1fe695){if(_0x202af2['body']['id']){delete _0x202af2[_0x95f1('0x4e')]['id'];}return db[_0x95f1('0x3e')][_0x95f1('0x44')]({'where':{'id':_0x202af2['params']['id']}})['then'](handleEntityNotFound(_0x1fe695,null))[_0x95f1('0x23')](saveUpdates(_0x202af2[_0x95f1('0x4e')],null))[_0x95f1('0x23')](respondWithResult(_0x1fe695,null))['catch'](handleError(_0x1fe695,null));};exports['destroy']=function(_0x55f942,_0x2b5aa2){return db[_0x95f1('0x3e')]['find']({'where':{'id':_0x55f942[_0x95f1('0x41')]['id']}})[_0x95f1('0x23')](handleEntityNotFound(_0x2b5aa2,null))[_0x95f1('0x23')](removeEntity(_0x2b5aa2,null))['catch'](handleError(_0x2b5aa2,null));};exports[_0x95f1('0x4f')]=function(_0x5c211a,_0x164def,_0x2ce177){if(_0x5c211a[_0x95f1('0x4e')]['id']){delete _0x5c211a[_0x95f1('0x4e')]['id'];}return db['Trigger'][_0x95f1('0x44')]({'where':{'id':_0x5c211a[_0x95f1('0x41')]['id']}})[_0x95f1('0x23')](handleEntityNotFound(_0x164def,null))[_0x95f1('0x23')](function(_0x4d2e0c){if(_0x4d2e0c){_0x5c211a['body'][_0x95f1('0x50')]=_0x4d2e0c['id'];return db[_0x95f1('0x51')][_0x95f1('0x46')](_0x5c211a['body']);}})['then'](respondWithResult(_0x164def,null))[_0x95f1('0x45')](handleError(_0x164def,null));};exports[_0x95f1('0x52')]=function(_0x13eb57,_0x82f48d,_0x11f878){if(_0x13eb57[_0x95f1('0x4e')]['id']){delete _0x13eb57[_0x95f1('0x4e')]['id'];}return db['Trigger'][_0x95f1('0x44')]({'where':{'id':_0x13eb57[_0x95f1('0x41')]['id']}})[_0x95f1('0x23')](handleEntityNotFound(_0x82f48d,null))[_0x95f1('0x23')](function(_0x3015d2){if(_0x3015d2){_0x13eb57[_0x95f1('0x4e')]['TriggerAnyId']=_0x3015d2['id'];return db[_0x95f1('0x51')][_0x95f1('0x46')](_0x13eb57[_0x95f1('0x4e')]);}})[_0x95f1('0x23')](respondWithResult(_0x82f48d,null))[_0x95f1('0x45')](handleError(_0x82f48d,null));};exports['getAllConditions']=function(_0x5b1a6b,_0xb4232a,_0x57eb31){var _0x185f97={};var _0x5382c4={};var _0x52efa2;var _0xf7e02f;return db['Trigger'][_0x95f1('0x53')]({'where':{'id':_0x5b1a6b[_0x95f1('0x41')]['id']}})[_0x95f1('0x23')](handleEntityNotFound(_0xb4232a,null))[_0x95f1('0x23')](function(_0x2f3ecd){if(_0x2f3ecd){_0x52efa2=_0x2f3ecd;_0x5382c4[_0x95f1('0x30')]=_[_0x95f1('0x42')](db[_0x95f1('0x51')][_0x95f1('0x2d')]);_0x5382c4[_0x95f1('0x31')]=_[_0x95f1('0x42')](_0x5b1a6b['query']);_0x5382c4['filters']=_[_0x95f1('0x33')](_0x5382c4[_0x95f1('0x30')],_0x5382c4['query']);_0x185f97[_0x95f1('0x35')]=_[_0x95f1('0x33')](_0x5382c4['model'],qs[_0x95f1('0x34')](_0x5b1a6b[_0x95f1('0x31')][_0x95f1('0x34')]));_0x185f97[_0x95f1('0x35')]=_0x185f97[_0x95f1('0x35')][_0x95f1('0x36')]?_0x185f97[_0x95f1('0x35')]:_0x5382c4[_0x95f1('0x30')];_0x185f97[_0x95f1('0x39')]=qs[_0x95f1('0x3a')](_0x5b1a6b['query'][_0x95f1('0x3a')]);_0x185f97[_0x95f1('0x3b')]=qs[_0x95f1('0x32')](_['pick'](_0x5b1a6b[_0x95f1('0x31')],_0x5382c4[_0x95f1('0x32')]));if(_0x5b1a6b[_0x95f1('0x31')][_0x95f1('0x3c')]){_0x185f97[_0x95f1('0x3b')]=_[_0x95f1('0x54')](_0x185f97[_0x95f1('0x3b')],{'$or':_['map'](_0x185f97[_0x95f1('0x35')],function(_0x4468c9){var _0x153b79={};_0x153b79[_0x4468c9]={'$like':'%'+_0x5b1a6b[_0x95f1('0x31')][_0x95f1('0x3c')]+'%'};return _0x153b79;})});}_0x185f97=_[_0x95f1('0x54')]({},_0x185f97,_0x5b1a6b[_0x95f1('0x43')]);return _0x52efa2[_0x95f1('0x55')](_0x185f97);}})[_0x95f1('0x23')](function(_0x42f575){if(_0x42f575){_0xf7e02f=_0x42f575[_0x95f1('0x36')];if(!_0x5b1a6b[_0x95f1('0x31')][_0x95f1('0x37')](_0x95f1('0x38'))){_0x185f97[_0x95f1('0x1a')]=qs[_0x95f1('0x1a')](_0x5b1a6b[_0x95f1('0x31')][_0x95f1('0x1a')]);_0x185f97[_0x95f1('0x19')]=qs[_0x95f1('0x19')](_0x5b1a6b['query'][_0x95f1('0x19')]);}return _0x52efa2[_0x95f1('0x55')](_0x185f97);}})[_0x95f1('0x23')](function(_0x446bfe){if(_0x446bfe){return _0x446bfe?{'count':_0xf7e02f,'rows':_0x446bfe}:null;}})[_0x95f1('0x23')](respondWithResult(_0xb4232a,null))['catch'](handleError(_0xb4232a,null));};exports['getAnyConditions']=function(_0x5e8ad7,_0xa0c9fe,_0x5f11a1){var _0x524d32={};var _0x4b8f99={};var _0x104e29;var _0x203310;return db[_0x95f1('0x3e')]['findOne']({'where':{'id':_0x5e8ad7[_0x95f1('0x41')]['id']}})['then'](handleEntityNotFound(_0xa0c9fe,null))['then'](function(_0x207b7f){if(_0x207b7f){_0x104e29=_0x207b7f;_0x4b8f99[_0x95f1('0x30')]=_[_0x95f1('0x42')](db[_0x95f1('0x51')][_0x95f1('0x2d')]);_0x4b8f99[_0x95f1('0x31')]=_[_0x95f1('0x42')](_0x5e8ad7['query']);_0x4b8f99[_0x95f1('0x32')]=_[_0x95f1('0x33')](_0x4b8f99['model'],_0x4b8f99[_0x95f1('0x31')]);_0x524d32[_0x95f1('0x35')]=_[_0x95f1('0x33')](_0x4b8f99[_0x95f1('0x30')],qs[_0x95f1('0x34')](_0x5e8ad7[_0x95f1('0x31')][_0x95f1('0x34')]));_0x524d32['attributes']=_0x524d32[_0x95f1('0x35')][_0x95f1('0x36')]?_0x524d32[_0x95f1('0x35')]:_0x4b8f99[_0x95f1('0x30')];_0x524d32[_0x95f1('0x39')]=qs['sort'](_0x5e8ad7[_0x95f1('0x31')][_0x95f1('0x3a')]);_0x524d32[_0x95f1('0x3b')]=qs[_0x95f1('0x32')](_[_0x95f1('0x56')](_0x5e8ad7['query'],_0x4b8f99[_0x95f1('0x32')]));if(_0x5e8ad7[_0x95f1('0x31')][_0x95f1('0x3c')]){_0x524d32[_0x95f1('0x3b')]=_[_0x95f1('0x54')](_0x524d32[_0x95f1('0x3b')],{'$or':_[_0x95f1('0x2c')](_0x524d32['attributes'],function(_0x342222){var _0x512aef={};_0x512aef[_0x342222]={'$like':'%'+_0x5e8ad7[_0x95f1('0x31')]['filter']+'%'};return _0x512aef;})});}_0x524d32=_['merge']({},_0x524d32,_0x5e8ad7[_0x95f1('0x43')]);return _0x104e29[_0x95f1('0x57')](_0x524d32);}})[_0x95f1('0x23')](function(_0x4c0c0e){if(_0x4c0c0e){_0x203310=_0x4c0c0e['length'];if(!_0x5e8ad7['query']['hasOwnProperty'](_0x95f1('0x38'))){_0x524d32[_0x95f1('0x1a')]=qs['limit'](_0x5e8ad7[_0x95f1('0x31')]['limit']);_0x524d32['offset']=qs['offset'](_0x5e8ad7['query'][_0x95f1('0x19')]);}return _0x104e29['getAnyConditions'](_0x524d32);}})[_0x95f1('0x23')](function(_0xb1be05){if(_0xb1be05){return _0xb1be05?{'count':_0x203310,'rows':_0xb1be05}:null;}})[_0x95f1('0x23')](respondWithResult(_0xa0c9fe,null))['catch'](handleError(_0xa0c9fe,null));};exports['addAction']=function(_0x426620,_0x4ee8d7,_0x51a601){if(_0x426620[_0x95f1('0x4e')]['id']){delete _0x426620[_0x95f1('0x4e')]['id'];}return db[_0x95f1('0x3e')][_0x95f1('0x44')]({'where':{'id':_0x426620[_0x95f1('0x41')]['id']}})[_0x95f1('0x23')](handleEntityNotFound(_0x4ee8d7,null))[_0x95f1('0x23')](function(_0x42978c){if(_0x42978c){_0x426620[_0x95f1('0x4e')][_0x95f1('0x58')]=_0x42978c['id'];return db[_0x95f1('0x59')][_0x95f1('0x46')](_0x426620[_0x95f1('0x4e')]);}})[_0x95f1('0x23')](respondWithResult(_0x4ee8d7,null))[_0x95f1('0x45')](handleError(_0x4ee8d7,null));};exports[_0x95f1('0x5a')]=function(_0x1592a8,_0x5bc46c,_0x3cc19b){var _0x3cbd7b={};var _0x5639f7={};var _0xbfdf92;var _0x550d1f;return db['Trigger'][_0x95f1('0x53')]({'where':{'id':_0x1592a8[_0x95f1('0x41')]['id']}})['then'](handleEntityNotFound(_0x5bc46c,null))[_0x95f1('0x23')](function(_0x8336c6){if(_0x8336c6){_0xbfdf92=_0x8336c6;_0x5639f7[_0x95f1('0x30')]=_['keys'](db[_0x95f1('0x59')][_0x95f1('0x2d')]);_0x5639f7[_0x95f1('0x31')]=_['keys'](_0x1592a8[_0x95f1('0x31')]);_0x5639f7[_0x95f1('0x32')]=_['intersection'](_0x5639f7['model'],_0x5639f7[_0x95f1('0x31')]);_0x3cbd7b[_0x95f1('0x35')]=_[_0x95f1('0x33')](_0x5639f7[_0x95f1('0x30')],qs[_0x95f1('0x34')](_0x1592a8['query'][_0x95f1('0x34')]));_0x3cbd7b['attributes']=_0x3cbd7b[_0x95f1('0x35')][_0x95f1('0x36')]?_0x3cbd7b[_0x95f1('0x35')]:_0x5639f7[_0x95f1('0x30')];_0x3cbd7b[_0x95f1('0x39')]=qs['sort'](_0x1592a8[_0x95f1('0x31')][_0x95f1('0x3a')]);_0x3cbd7b['where']=qs[_0x95f1('0x32')](_['pick'](_0x1592a8[_0x95f1('0x31')],_0x5639f7[_0x95f1('0x32')]));if(_0x1592a8[_0x95f1('0x31')]['filter']){_0x3cbd7b[_0x95f1('0x3b')]=_[_0x95f1('0x54')](_0x3cbd7b[_0x95f1('0x3b')],{'$or':_[_0x95f1('0x2c')](_0x3cbd7b[_0x95f1('0x35')],function(_0x1c2290){var _0x4c5a0f={};_0x4c5a0f[_0x1c2290]={'$like':'%'+_0x1592a8[_0x95f1('0x31')][_0x95f1('0x3c')]+'%'};return _0x4c5a0f;})});}_0x3cbd7b=_[_0x95f1('0x54')]({},_0x3cbd7b,_0x1592a8['options']);return _0xbfdf92[_0x95f1('0x5a')](_0x3cbd7b);}})[_0x95f1('0x23')](function(_0x1b6f4f){if(_0x1b6f4f){_0x550d1f=_0x1b6f4f[_0x95f1('0x36')];if(!_0x1592a8['query'][_0x95f1('0x37')](_0x95f1('0x38'))){_0x3cbd7b['limit']=qs[_0x95f1('0x1a')](_0x1592a8[_0x95f1('0x31')]['limit']);_0x3cbd7b['offset']=qs[_0x95f1('0x19')](_0x1592a8[_0x95f1('0x31')][_0x95f1('0x19')]);}return _0xbfdf92[_0x95f1('0x5a')](_0x3cbd7b);}})[_0x95f1('0x23')](function(_0x57ad6e){if(_0x57ad6e){return _0x57ad6e?{'count':_0x550d1f,'rows':_0x57ad6e}:null;}})[_0x95f1('0x23')](respondWithResult(_0x5bc46c,null))[_0x95f1('0x45')](handleError(_0x5bc46c,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 0d82200..45002bd 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 _0xb647=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','Trigger','tools_triggers','lodash','util'];(function(_0x4038e4,_0x294424){var _0x3ef3bb=function(_0x3c7518){while(--_0x3c7518){_0x4038e4['push'](_0x4038e4['shift']());}};_0x3ef3bb(++_0x294424);}(_0xb647,0xdb));var _0x7b64=function(_0x2196ae,_0x29dcd0){_0x2196ae=_0x2196ae-0x0;var _0x4309ab=_0xb647[_0x2196ae];return _0x4309ab;};'use strict';var _=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var logger=require(_0x7b64('0x2'))(_0x7b64('0x3'));var moment=require(_0x7b64('0x4'));var BPromise=require(_0x7b64('0x5'));var rp=require(_0x7b64('0x6'));var fs=require('fs');var path=require(_0x7b64('0x7'));var rimraf=require('rimraf');var config=require(_0x7b64('0x8'));var attributes=require('./trigger.attributes');module[_0x7b64('0x9')]=function(_0x38ebf7,_0x31915b){return _0x38ebf7[_0x7b64('0xa')](_0x7b64('0xb'),attributes,{'tableName':_0x7b64('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe107=['define','Trigger','tools_triggers','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./trigger.attributes','exports'];(function(_0x16aaef,_0x410651){var _0x1c82ef=function(_0x3d802b){while(--_0x3d802b){_0x16aaef['push'](_0x16aaef['shift']());}};_0x1c82ef(++_0x410651);}(_0xe107,0xb3));var _0x7e10=function(_0xf2a10c,_0x16ede3){_0xf2a10c=_0xf2a10c-0x0;var _0x384107=_0xe107[_0xf2a10c];return _0x384107;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var logger=require(_0x7e10('0x1'))(_0x7e10('0x2'));var moment=require(_0x7e10('0x3'));var BPromise=require('bluebird');var rp=require(_0x7e10('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7e10('0x5'));var attributes=require(_0x7e10('0x6'));module[_0x7e10('0x7')]=function(_0x5be19f,_0x5f1edf){return _0x5be19f[_0x7e10('0x8')](_0x7e10('0x9'),attributes,{'tableName':_0x7e10('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 08711d7..b157edd 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 _0xaafb=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','Trigger','options','raw','where','limit','map','model','attributes','include','debug','find','ShowTrigger','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaafb,0x1ba));var _0xbaaf=function(_0x5383a4,_0x589826){_0x5383a4=_0x5383a4-0x0;var _0x48563c=_0xaafb[_0x5383a4];return _0x48563c;};'use strict';var _=require(_0xbaaf('0x0'));var util=require(_0xbaaf('0x1'));var moment=require(_0xbaaf('0x2'));var BPromise=require('bluebird');var rs=require(_0xbaaf('0x3'));var fs=require('fs');var Redis=require(_0xbaaf('0x4'));var db=require(_0xbaaf('0x5'))['db'];var utils=require(_0xbaaf('0x6'));var logger=require(_0xbaaf('0x7'))('rpc');var config=require(_0xbaaf('0x8'));var jayson=require(_0xbaaf('0x9'));var client=jayson[_0xbaaf('0xa')][_0xbaaf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd4a2ae,_0x19a294,_0x577f75){return new BPromise(function(_0x5eddd3,_0x2e8462){return client[_0xbaaf('0xc')](_0xd4a2ae,_0x577f75)[_0xbaaf('0xd')](function(_0x4833d7){logger[_0xbaaf('0xe')](_0xbaaf('0xf'),_0x19a294,_0xbaaf('0x10'));logger['debug'](_0xbaaf('0x11'),_0x19a294,_0xbaaf('0x10'),JSON[_0xbaaf('0x12')](_0x4833d7));if(_0x4833d7['error']){if(_0x4833d7[_0xbaaf('0x13')][_0xbaaf('0x14')]===0x1f4){logger[_0xbaaf('0x13')](_0xbaaf('0xf'),_0x19a294,_0x4833d7[_0xbaaf('0x13')]['message']);return _0x2e8462(_0x4833d7[_0xbaaf('0x13')][_0xbaaf('0x15')]);}logger[_0xbaaf('0x13')](_0xbaaf('0xf'),_0x19a294,_0x4833d7[_0xbaaf('0x13')][_0xbaaf('0x15')]);return _0x5eddd3(_0x4833d7[_0xbaaf('0x13')][_0xbaaf('0x15')]);}else{logger[_0xbaaf('0xe')](_0xbaaf('0xf'),_0x19a294,_0xbaaf('0x10'));_0x5eddd3(_0x4833d7[_0xbaaf('0x16')][_0xbaaf('0x15')]);}})[_0xbaaf('0x17')](function(_0x27279e){logger['error'](_0xbaaf('0xf'),_0x19a294,_0x27279e);_0x2e8462(_0x27279e);});});}exports[_0xbaaf('0x18')]=function(_0x1d1b5f){var _0x4ee9c4=this;return new Promise(function(_0x4d5575,_0x94e48e){return db[_0xbaaf('0x19')]['findAll']({'raw':_0x1d1b5f[_0xbaaf('0x1a')]?_0x1d1b5f[_0xbaaf('0x1a')][_0xbaaf('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d1b5f[_0xbaaf('0x1a')]?_0x1d1b5f['options'][_0xbaaf('0x1c')]||null:null,'attributes':_0x1d1b5f['options']?_0x1d1b5f[_0xbaaf('0x1a')]['attributes']||null:null,'limit':_0x1d1b5f[_0xbaaf('0x1a')]?_0x1d1b5f[_0xbaaf('0x1a')][_0xbaaf('0x1d')]||null:null,'include':_0x1d1b5f['options']?_0x1d1b5f[_0xbaaf('0x1a')]['include']?_[_0xbaaf('0x1e')](_0x1d1b5f[_0xbaaf('0x1a')]['include'],function(_0x590dfd){return{'model':db[_0x590dfd[_0xbaaf('0x1f')]],'as':_0x590dfd['as'],'attributes':_0x590dfd[_0xbaaf('0x20')],'include':_0x590dfd[_0xbaaf('0x21')]?_['map'](_0x590dfd[_0xbaaf('0x21')],function(_0x5ca783){return{'model':db[_0x5ca783[_0xbaaf('0x1f')]],'as':_0x5ca783['as'],'attributes':_0x5ca783['attributes'],'include':_0x5ca783[_0xbaaf('0x21')]?_[_0xbaaf('0x1e')](_0x5ca783['include'],function(_0x2c6746){return{'model':db[_0x2c6746[_0xbaaf('0x1f')]],'as':_0x2c6746['as'],'attributes':_0x2c6746[_0xbaaf('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbaaf('0xd')](function(_0x382b3f){logger[_0xbaaf('0xe')](_0xbaaf('0x18'),_0x1d1b5f);logger[_0xbaaf('0x22')]('GetTrigger',_0x1d1b5f,JSON[_0xbaaf('0x12')](_0x382b3f));_0x4d5575(_0x382b3f);})[_0xbaaf('0x17')](function(_0x3e6640){logger[_0xbaaf('0x13')]('GetTrigger',_0x3e6640[_0xbaaf('0x15')],_0x1d1b5f);_0x94e48e(_0x4ee9c4[_0xbaaf('0x13')](0x1f4,_0x3e6640[_0xbaaf('0x15')]));});});};exports['ShowTrigger']=function(_0x4cb172){var _0x6084ad=this;return new Promise(function(_0x502cec,_0x24c1c5){return db[_0xbaaf('0x19')][_0xbaaf('0x23')]({'raw':_0x4cb172[_0xbaaf('0x1a')]?_0x4cb172[_0xbaaf('0x1a')][_0xbaaf('0x1b')]===undefined?!![]:![]:!![],'where':_0x4cb172[_0xbaaf('0x1a')]?_0x4cb172[_0xbaaf('0x1a')]['where']||null:null,'attributes':_0x4cb172[_0xbaaf('0x1a')]?_0x4cb172[_0xbaaf('0x1a')][_0xbaaf('0x20')]||null:null,'include':_0x4cb172[_0xbaaf('0x1a')]?_0x4cb172[_0xbaaf('0x1a')]['include']?_[_0xbaaf('0x1e')](_0x4cb172[_0xbaaf('0x1a')]['include'],function(_0x4fe8d3){return{'model':db[_0x4fe8d3[_0xbaaf('0x1f')]],'as':_0x4fe8d3['as'],'attributes':_0x4fe8d3['attributes'],'include':_0x4fe8d3[_0xbaaf('0x21')]?_[_0xbaaf('0x1e')](_0x4fe8d3[_0xbaaf('0x21')],function(_0x3c072f){return{'model':db[_0x3c072f['model']],'as':_0x3c072f['as'],'attributes':_0x3c072f[_0xbaaf('0x20')],'include':_0x3c072f[_0xbaaf('0x21')]?_[_0xbaaf('0x1e')](_0x3c072f[_0xbaaf('0x21')],function(_0x30fe58){return{'model':db[_0x30fe58[_0xbaaf('0x1f')]],'as':_0x30fe58['as'],'attributes':_0x30fe58[_0xbaaf('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbaaf('0xd')](function(_0x469772){logger[_0xbaaf('0xe')](_0xbaaf('0x24'),_0x4cb172);logger[_0xbaaf('0x22')](_0xbaaf('0x24'),_0x4cb172,JSON[_0xbaaf('0x12')](_0x469772));_0x502cec(_0x469772);})[_0xbaaf('0x17')](function(_0x56eb09){logger[_0xbaaf('0x13')]('ShowTrigger',_0x56eb09[_0xbaaf('0x15')],_0x4cb172);_0x24c1c5(_0x6084ad[_0xbaaf('0x13')](0x1f4,_0x56eb09[_0xbaaf('0x15')]));});});}; \ No newline at end of file +var _0x458a=['model','then','GetTrigger','ShowTrigger','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trigger','options','raw','where','attributes','limit','include','map'];(function(_0x2eb3c7,_0x4d3ec2){var _0x17dc2f=function(_0x39ae61){while(--_0x39ae61){_0x2eb3c7['push'](_0x2eb3c7['shift']());}};_0x17dc2f(++_0x4d3ec2);}(_0x458a,0x88));var _0xa458=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x458a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa458('0x0'));var util=require(_0xa458('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa458('0x2'));var fs=require('fs');var Redis=require(_0xa458('0x3'));var db=require(_0xa458('0x4'))['db'];var utils=require(_0xa458('0x5'));var logger=require(_0xa458('0x6'))(_0xa458('0x7'));var config=require('../../config/environment');var jayson=require(_0xa458('0x8'));var client=jayson[_0xa458('0x9')][_0xa458('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5aa12f,_0x45631e,_0x35830a){return new BPromise(function(_0x14c576,_0x455563){return client['request'](_0x5aa12f,_0x35830a)['then'](function(_0x4a602c){logger[_0xa458('0xb')](_0xa458('0xc'),_0x45631e,_0xa458('0xd'));logger[_0xa458('0xe')](_0xa458('0xf'),_0x45631e,'request\x20sent',JSON[_0xa458('0x10')](_0x4a602c));if(_0x4a602c['error']){if(_0x4a602c[_0xa458('0x11')]['code']===0x1f4){logger['error'](_0xa458('0xc'),_0x45631e,_0x4a602c[_0xa458('0x11')][_0xa458('0x12')]);return _0x455563(_0x4a602c[_0xa458('0x11')]['message']);}logger['error'](_0xa458('0xc'),_0x45631e,_0x4a602c[_0xa458('0x11')]['message']);return _0x14c576(_0x4a602c[_0xa458('0x11')][_0xa458('0x12')]);}else{logger[_0xa458('0xb')](_0xa458('0xc'),_0x45631e,_0xa458('0xd'));_0x14c576(_0x4a602c[_0xa458('0x13')][_0xa458('0x12')]);}})[_0xa458('0x14')](function(_0x8cca01){logger[_0xa458('0x11')](_0xa458('0xc'),_0x45631e,_0x8cca01);_0x455563(_0x8cca01);});});}exports['GetTrigger']=function(_0x1e1193){var _0x113b94=this;return new Promise(function(_0x287a2f,_0x5aca5f){return db[_0xa458('0x15')]['findAll']({'raw':_0x1e1193['options']?_0x1e1193[_0xa458('0x16')][_0xa458('0x17')]===undefined?!![]:![]:!![],'where':_0x1e1193[_0xa458('0x16')]?_0x1e1193[_0xa458('0x16')][_0xa458('0x18')]||null:null,'attributes':_0x1e1193['options']?_0x1e1193[_0xa458('0x16')][_0xa458('0x19')]||null:null,'limit':_0x1e1193[_0xa458('0x16')]?_0x1e1193[_0xa458('0x16')][_0xa458('0x1a')]||null:null,'include':_0x1e1193[_0xa458('0x16')]?_0x1e1193[_0xa458('0x16')][_0xa458('0x1b')]?_[_0xa458('0x1c')](_0x1e1193[_0xa458('0x16')]['include'],function(_0x425253){return{'model':db[_0x425253[_0xa458('0x1d')]],'as':_0x425253['as'],'attributes':_0x425253['attributes'],'include':_0x425253[_0xa458('0x1b')]?_['map'](_0x425253[_0xa458('0x1b')],function(_0x29bf0c){return{'model':db[_0x29bf0c[_0xa458('0x1d')]],'as':_0x29bf0c['as'],'attributes':_0x29bf0c[_0xa458('0x19')],'include':_0x29bf0c[_0xa458('0x1b')]?_[_0xa458('0x1c')](_0x29bf0c[_0xa458('0x1b')],function(_0x5c7a48){return{'model':db[_0x5c7a48['model']],'as':_0x5c7a48['as'],'attributes':_0x5c7a48['attributes']};}):[]};}):[]};}):[]:[]})[_0xa458('0x1e')](function(_0x2a8325){logger[_0xa458('0xb')](_0xa458('0x1f'),_0x1e1193);logger[_0xa458('0xe')](_0xa458('0x1f'),_0x1e1193,JSON[_0xa458('0x10')](_0x2a8325));_0x287a2f(_0x2a8325);})[_0xa458('0x14')](function(_0x1edf3d){logger[_0xa458('0x11')](_0xa458('0x1f'),_0x1edf3d[_0xa458('0x12')],_0x1e1193);_0x5aca5f(_0x113b94[_0xa458('0x11')](0x1f4,_0x1edf3d[_0xa458('0x12')]));});});};exports[_0xa458('0x20')]=function(_0x28f900){var _0x59a31a=this;return new Promise(function(_0x17c8b6,_0x2882fa){return db[_0xa458('0x15')]['find']({'raw':_0x28f900[_0xa458('0x16')]?_0x28f900[_0xa458('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x28f900['options']?_0x28f900[_0xa458('0x16')][_0xa458('0x18')]||null:null,'attributes':_0x28f900['options']?_0x28f900['options'][_0xa458('0x19')]||null:null,'include':_0x28f900[_0xa458('0x16')]?_0x28f900[_0xa458('0x16')][_0xa458('0x1b')]?_[_0xa458('0x1c')](_0x28f900[_0xa458('0x16')]['include'],function(_0x4c6714){return{'model':db[_0x4c6714[_0xa458('0x1d')]],'as':_0x4c6714['as'],'attributes':_0x4c6714[_0xa458('0x19')],'include':_0x4c6714[_0xa458('0x1b')]?_[_0xa458('0x1c')](_0x4c6714[_0xa458('0x1b')],function(_0x44e2e1){return{'model':db[_0x44e2e1[_0xa458('0x1d')]],'as':_0x44e2e1['as'],'attributes':_0x44e2e1[_0xa458('0x19')],'include':_0x44e2e1[_0xa458('0x1b')]?_[_0xa458('0x1c')](_0x44e2e1[_0xa458('0x1b')],function(_0x9cd71a){return{'model':db[_0x9cd71a[_0xa458('0x1d')]],'as':_0x9cd71a['as'],'attributes':_0x9cd71a[_0xa458('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa458('0x1e')](function(_0x50920e){logger['info'](_0xa458('0x20'),_0x28f900);logger['debug'](_0xa458('0x20'),_0x28f900,JSON['stringify'](_0x50920e));_0x17c8b6(_0x50920e);})['catch'](function(_0x4d32fe){logger[_0xa458('0x11')](_0xa458('0x20'),_0x4d32fe[_0xa458('0x12')],_0x28f900);_0x2882fa(_0x59a31a[_0xa458('0x11')](0x1f4,_0x4d32fe['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 212f895..20c6532 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 _0x81d0=['../../config/environment','./trunk.controller','get','index','isAuthenticated','show','/:id/clone','clone','post','create','put','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xeca720,_0xd1833c){var _0x5259f6=function(_0x3b9a70){while(--_0x3b9a70){_0xeca720['push'](_0xeca720['shift']());}};_0x5259f6(++_0xd1833c);}(_0x81d0,0x70));var _0x081d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x81d0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x081d('0x0'));var util=require(_0x081d('0x1'));var path=require(_0x081d('0x2'));var timeout=require(_0x081d('0x3'));var express=require('express');var router=express[_0x081d('0x4')]();var fs_extra=require(_0x081d('0x5'));var auth=require(_0x081d('0x6'));var interaction=require(_0x081d('0x7'));var config=require(_0x081d('0x8'));var controller=require(_0x081d('0x9'));router[_0x081d('0xa')]('/',auth['isAuthenticated'](),controller[_0x081d('0xb')]);router[_0x081d('0xa')]('/:id',auth[_0x081d('0xc')](),controller[_0x081d('0xd')]);router['post'](_0x081d('0xe'),auth[_0x081d('0xc')](),controller[_0x081d('0xf')]);router[_0x081d('0x10')]('/',auth[_0x081d('0xc')](),controller[_0x081d('0x11')]);router[_0x081d('0x12')]('/:id',auth[_0x081d('0xc')](),controller['update']);router['delete']('/:id',auth[_0x081d('0xc')](),controller[_0x081d('0x13')]);module['exports']=router; \ No newline at end of file +var _0xeede=['/:id','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','isAuthenticated','get','show','post','/:id/clone','clone','create'];(function(_0x3c600d,_0x4b5c85){var _0xd195e3=function(_0x2a2f5f){while(--_0x2a2f5f){_0x3c600d['push'](_0x3c600d['shift']());}};_0xd195e3(++_0x4b5c85);}(_0xeede,0x17d));var _0xeeed=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0xeede[_0x4c4037];return _0x357862;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeeed('0x0'));var timeout=require(_0xeeed('0x1'));var express=require(_0xeeed('0x2'));var router=express[_0xeeed('0x3')]();var fs_extra=require(_0xeeed('0x4'));var auth=require(_0xeeed('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeeed('0x6'));var controller=require(_0xeeed('0x7'));router['get']('/',auth[_0xeeed('0x8')](),controller['index']);router[_0xeeed('0x9')]('/:id',auth[_0xeeed('0x8')](),controller[_0xeeed('0xa')]);router[_0xeeed('0xb')](_0xeeed('0xc'),auth[_0xeeed('0x8')](),controller[_0xeeed('0xd')]);router[_0xeeed('0xb')]('/',auth['isAuthenticated'](),controller[_0xeeed('0xe')]);router['put'](_0xeeed('0xf'),auth[_0xeeed('0x8')](),controller[_0xeeed('0x10')]);router['delete'](_0xeeed('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xeeed('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 2fad836..012f5b8 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 _0x2eb7=['setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','accept','refuse','originate','uac','pai','fingerprint','certificate','passive','actpass','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x2eb7,0xde));var _0x72eb=function(_0x34bd53,_0x28f936){_0x34bd53=_0x34bd53-0x0;var _0x2ef1de=_0x2eb7[_0x34bd53];return _0x2ef1de;};'use strict';var Sequelize=require(_0x72eb('0x0'));module['exports']={'name':{'type':Sequelize[_0x72eb('0x1')],'allowNull':![],'unique':_0x72eb('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x72eb('0x3')]('friend',_0x72eb('0x4'),_0x72eb('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x72eb('0x1')],'allowNull':![],'defaultValue':_0x72eb('0x6')},'callingpres':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x7'),'ALLOWED_PASSED_SCREEN',_0x72eb('0x8'),_0x72eb('0x9'),_0x72eb('0xa'),'PROHIB_PASSED_SCREEN',_0x72eb('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0x72eb('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x72eb('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x72eb('0x1')],'defaultValue':_0x72eb('0xc'),'set':function(_0x221e84){this[_0x72eb('0xd')](_0x72eb('0xe'),_0x221e84?_0x221e84[_0x72eb('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x72eb('0xe'))?this[_0x72eb('0x10')](_0x72eb('0xe'))[_0x72eb('0x11')](','):null;},'comment':_0x72eb('0x12')},'dtmfmode':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x13'),_0x72eb('0x14'),_0x72eb('0x15'),'inband',_0x72eb('0x16')),'defaultValue':_0x72eb('0x13')},'directmedia':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no',_0x72eb('0x18'),_0x72eb('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x72eb('0x1')]},'directmediadeny':{'type':Sequelize[_0x72eb('0x1')]},'nat':{'type':Sequelize[_0x72eb('0x1')],'defaultValue':_0x72eb('0x1a'),'set':function(_0x53f803){this[_0x72eb('0xd')](_0x72eb('0x1b'),_0x53f803?_0x53f803[_0x72eb('0xf')](','):null);},'get':function(){return this[_0x72eb('0x10')](_0x72eb('0x1b'))?this['getDataValue'](_0x72eb('0x1b'))[_0x72eb('0x11')](','):null;},'comment':_0x72eb('0x1c')},'callgroup':{'type':Sequelize[_0x72eb('0x1')]},'namedcallgroup':{'type':Sequelize[_0x72eb('0x1')]},'pickupgroup':{'type':Sequelize[_0x72eb('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x72eb('0x1')]},'language':{'type':Sequelize[_0x72eb('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x72eb('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x72eb('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x72eb('0x1')],'allowNull':![],'defaultValue':_0x72eb('0x1d'),'set':function(_0x165f68){this[_0x72eb('0xd')](_0x72eb('0x1e'),_0x165f68?_0x165f68[_0x72eb('0xf')](';'):_0x72eb('0x1d'));},'get':function(){return this[_0x72eb('0x10')](_0x72eb('0x1e'))?this[_0x72eb('0x10')](_0x72eb('0x1e'))[_0x72eb('0x11')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x72eb('0x1f'),'set':function(_0x27c9d6){this[_0x72eb('0xd')](_0x72eb('0x20'),_0x27c9d6?_0x27c9d6[_0x72eb('0xf')](','):null);},'get':function(){return this[_0x72eb('0x10')](_0x72eb('0x20'))?this[_0x72eb('0x10')](_0x72eb('0x20'))[_0x72eb('0x11')](','):null;},'comment':_0x72eb('0x21')},'trustrpid':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no','never')},'promiscredir':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no')},'accountcode':{'type':Sequelize[_0x72eb('0x22')](0xb)},'setvar':{'type':Sequelize[_0x72eb('0x1')]},'callerid':{'type':Sequelize[_0x72eb('0x1')],'defaultValue':_0x72eb('0x23')},'amaflags':{'type':Sequelize[_0x72eb('0x1')]},'callcounter':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no'),'defaultValue':_0x72eb('0x17')},'busylevel':{'type':Sequelize[_0x72eb('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x72eb('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0x72eb('0x17'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x72eb('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x72eb('0x17'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0x72eb('0x24'),_0x72eb('0x25'),_0x72eb('0x26'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x72eb('0x22')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x72eb('0x27'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x72eb('0x1')]},'regexten':{'type':Sequelize[_0x72eb('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x72eb('0x1')]},'port':{'type':Sequelize[_0x72eb('0x22')](0x5)},'qualify':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no'),'defaultValue':_0x72eb('0x17')},'keepalive':{'type':Sequelize[_0x72eb('0x22')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x72eb('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x72eb('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no',_0x72eb('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x72eb('0x1')]},'callbackextension':{'type':Sequelize[_0x72eb('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x72eb('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0x72eb('0x1')]},'contactdeny':{'type':Sequelize[_0x72eb('0x1')]},'contactacl':{'type':Sequelize[_0x72eb('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x72eb('0x1')]},'use_q850_reason':{'type':Sequelize[_0x72eb('0x1')]},'maxforwards':{'type':Sequelize[_0x72eb('0x22')](0xb)},'encryption':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x72eb('0x3')]('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0x72eb('0x17'),'no')},'icesupport':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no',_0x72eb('0x29'),_0x72eb('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x72eb('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0x72eb('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x72eb('0x1')]},'dtlscipher':{'type':Sequelize[_0x72eb('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x72eb('0x3')]('active',_0x72eb('0x2b'),_0x72eb('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x72eb('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x72eb('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x72eb('0x17'),'no')},'vmexten':{'type':Sequelize[_0x72eb('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x72eb('0x1')]},'parkinglot':{'type':Sequelize[_0x72eb('0x1')]},'description':{'type':Sequelize[_0x72eb('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x72eb('0x3')](_0x72eb('0x17'),'no',_0x72eb('0x18'),'update',_0x72eb('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x72eb('0x1')]},'otherFields':{'type':Sequelize[_0x72eb('0x1')]},'active':{'type':Sequelize[_0x72eb('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x72eb('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x9e5d=['nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','nonat','update','yes','force_rport,comedia'];(function(_0x1ef5ca,_0x4a5efe){var _0x1bdbe9=function(_0x595681){while(--_0x595681){_0x1ef5ca['push'](_0x1ef5ca['shift']());}};_0x1bdbe9(++_0x4a5efe);}(_0x9e5d,0x1a6));var _0xd9e5=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x9e5d[_0x45bf86];return _0x1f02b7;};'use strict';var Sequelize=require(_0xd9e5('0x0'));module['exports']={'name':{'type':Sequelize[_0xd9e5('0x1')],'allowNull':![],'unique':_0xd9e5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd9e5('0x3')](_0xd9e5('0x4'),_0xd9e5('0x5'),_0xd9e5('0x6')),'allowNull':![],'defaultValue':_0xd9e5('0x4')},'context':{'type':Sequelize[_0xd9e5('0x1')],'allowNull':![],'defaultValue':_0xd9e5('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0xd9e5('0x8'),_0xd9e5('0x9'),_0xd9e5('0xa'),_0xd9e5('0xb'),_0xd9e5('0xc'),_0xd9e5('0xd'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0xd9e5('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xd9e5('0x1')]},'remotesecret':{'type':Sequelize[_0xd9e5('0x1')]},'transport':{'type':Sequelize[_0xd9e5('0x1')],'defaultValue':'udp','set':function(_0x31ba8b){this[_0xd9e5('0xe')](_0xd9e5('0xf'),_0x31ba8b?_0x31ba8b[_0xd9e5('0x10')](','):null);},'get':function(){return this[_0xd9e5('0x11')](_0xd9e5('0xf'))?this[_0xd9e5('0x11')](_0xd9e5('0xf'))[_0xd9e5('0x12')](','):null;},'comment':_0xd9e5('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0xd9e5('0x14'),_0xd9e5('0x15'),'shortinfo',_0xd9e5('0x16'),_0xd9e5('0x17')),'defaultValue':_0xd9e5('0x14')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0xd9e5('0x18'),_0xd9e5('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd9e5('0x3')](_0xd9e5('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd9e5('0x1')]},'directmediadeny':{'type':Sequelize[_0xd9e5('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xd9e5('0x1b'),'set':function(_0x4ac791){this['setDataValue'](_0xd9e5('0x1c'),_0x4ac791?_0x4ac791[_0xd9e5('0x10')](','):null);},'get':function(){return this[_0xd9e5('0x11')]('nat')?this[_0xd9e5('0x11')](_0xd9e5('0x1c'))['split'](','):null;},'comment':_0xd9e5('0x1d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xd9e5('0x1')]},'pickupgroup':{'type':Sequelize[_0xd9e5('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd9e5('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0xd9e5('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4c09a9){this[_0xd9e5('0xe')](_0xd9e5('0x1e'),_0x4c09a9?_0x4c09a9[_0xd9e5('0x10')](';'):_0xd9e5('0x1f'));},'get':function(){return this['getDataValue'](_0xd9e5('0x1e'))?this['getDataValue'](_0xd9e5('0x1e'))[_0xd9e5('0x12')](';'):null;},'comment':_0xd9e5('0x20')},'autoframing':{'type':Sequelize[_0xd9e5('0x3')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x5a4ea7){this['setDataValue']('insecure',_0x5a4ea7?_0x5a4ea7['join'](','):null);},'get':function(){return this[_0xd9e5('0x11')](_0xd9e5('0x21'))?this[_0xd9e5('0x11')]('insecure')['split'](','):null;},'comment':_0xd9e5('0x22')},'trustrpid':{'type':Sequelize[_0xd9e5('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xd9e5('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd9e5('0x3')](_0xd9e5('0x1a'),'no','never')},'promiscredir':{'type':Sequelize[_0xd9e5('0x3')](_0xd9e5('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0xd9e5('0x3')](_0xd9e5('0x1a'),'no')},'accountcode':{'type':Sequelize[_0xd9e5('0x23')](0xb)},'setvar':{'type':Sequelize[_0xd9e5('0x1')]},'callerid':{'type':Sequelize[_0xd9e5('0x1')],'defaultValue':_0xd9e5('0x24')},'amaflags':{'type':Sequelize[_0xd9e5('0x1')]},'callcounter':{'type':Sequelize[_0xd9e5('0x3')](_0xd9e5('0x1a'),'no'),'defaultValue':_0xd9e5('0x1a')},'busylevel':{'type':Sequelize[_0xd9e5('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0xd9e5('0x3')](_0xd9e5('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0xd9e5('0x3')](_0xd9e5('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0xd9e5('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xd9e5('0x3')](_0xd9e5('0x1a'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xd9e5('0x3')](_0xd9e5('0x1a'),'no',_0xd9e5('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd9e5('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xd9e5('0x3')](_0xd9e5('0x1a'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xd9e5('0x3')]('accept',_0xd9e5('0x26'),_0xd9e5('0x27'))},'session_expires':{'type':Sequelize[_0xd9e5('0x23')](0xb)},'session_minse':{'type':Sequelize[_0xd9e5('0x23')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xd9e5('0x28'),'uas'),'defaultValue':_0xd9e5('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xd9e5('0x1')]},'regexten':{'type':Sequelize[_0xd9e5('0x1')]},'fromdomain':{'type':Sequelize[_0xd9e5('0x1')]},'fromuser':{'type':Sequelize[_0xd9e5('0x1')]},'port':{'type':Sequelize[_0xd9e5('0x23')](0x5)},'qualify':{'type':Sequelize[_0xd9e5('0x3')]('yes','no'),'defaultValue':_0xd9e5('0x1a')},'keepalive':{'type':Sequelize[_0xd9e5('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xd9e5('0x1')]},'defaultuser':{'type':Sequelize[_0xd9e5('0x1')]},'rtptimeout':{'type':Sequelize[_0xd9e5('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xd9e5('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xd9e5('0x3')]('yes','no',_0xd9e5('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd9e5('0x1')]},'callbackextension':{'type':Sequelize[_0xd9e5('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xd9e5('0x23')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xd9e5('0x1')]},'contactacl':{'type':Sequelize[_0xd9e5('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xd9e5('0x1')]},'use_q850_reason':{'type':Sequelize[_0xd9e5('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd9e5('0x3')](_0xd9e5('0x1a'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xd9e5('0x1a'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xd9e5('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0xd9e5('0x3')](_0xd9e5('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0xd9e5('0x3')]('yes','no',_0xd9e5('0x2b'),_0xd9e5('0x2c'))},'dtlsrekey':{'type':Sequelize[_0xd9e5('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd9e5('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xd9e5('0x1')]},'dtlscafile':{'type':Sequelize[_0xd9e5('0x1')]},'dtlscapath':{'type':Sequelize[_0xd9e5('0x1')]},'dtlssetup':{'type':Sequelize[_0xd9e5('0x3')]('active',_0xd9e5('0x2d'),_0xd9e5('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd9e5('0x1')]},'usereqphone':{'type':Sequelize[_0xd9e5('0x3')](_0xd9e5('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd9e5('0x1')]},'recordofffeature':{'type':Sequelize[_0xd9e5('0x1')]},'call_limit':{'type':Sequelize[_0xd9e5('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd9e5('0x3')](_0xd9e5('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0xd9e5('0x3')](_0xd9e5('0x1a'),'no')},'vmexten':{'type':Sequelize[_0xd9e5('0x1')]},'mohinterpret':{'type':Sequelize[_0xd9e5('0x1')]},'mohsuggest':{'type':Sequelize[_0xd9e5('0x1')]},'parkinglot':{'type':Sequelize[_0xd9e5('0x1')]},'description':{'type':Sequelize[_0xd9e5('0x1')]},'host':{'type':Sequelize[_0xd9e5('0x1')],'defaultValue':_0xd9e5('0x2f')},'canreinvite':{'type':Sequelize[_0xd9e5('0x3')]('yes','no',_0xd9e5('0x18'),'update',_0xd9e5('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xd9e5('0x1')]},'active':{'type':Sequelize[_0xd9e5('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd9e5('0x1')],'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 d245a3f..f93329f 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 _0x9bde=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','VIRTUAL','merge','Trunk','includeAll','findAll','rows','show','params','fields','include','options','clone','find','omit','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','root','server/files/templates/trunk.ejs','writeFileSync','rimraf'];(function(_0x1058d1,_0x122d13){var _0x3078cf=function(_0x3361a5){while(--_0x3361a5){_0x1058d1['push'](_0x1058d1['shift']());}};_0x3078cf(++_0x122d13);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3ee5c3,_0x2cb49b){_0x3ee5c3=_0x3ee5c3-0x0;var _0x4c5472=_0x9bde[_0x3ee5c3];return _0x4c5472;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe9bd('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220d07,_0x429e88,_0x3435b4,_0x51109f){return new BPromise(function(_0x47ba5e,_0x46a95e){var _0x248818=_0x51109f||client;return _0x248818[_0xe9bd('0x1a')](_0x220d07,_0x3435b4)[_0xe9bd('0x1b')](function(_0x3360bd){logger[_0xe9bd('0x1c')](_0xe9bd('0x1d'),_0x429e88,'request\x20sent');logger[_0xe9bd('0x1e')](_0xe9bd('0x1f'),_0x429e88,_0xe9bd('0x20'),JSON['stringify'](_0x3360bd));if(_0x3360bd[_0xe9bd('0x21')]){if(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x22')]===0x1f4){logger[_0xe9bd('0x21')]('Trunk,\x20%s,\x20%s',_0x429e88,_0x3360bd[_0xe9bd('0x21')]['message']);return _0x46a95e(_0x3360bd[_0xe9bd('0x21')]['message']);}logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);return _0x47ba5e(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);}else{logger[_0xe9bd('0x1c')]('Trunk,\x20%s,\x20%s',_0x429e88,_0xe9bd('0x20'));_0x47ba5e(_0x3360bd[_0xe9bd('0x24')]['message']);}})[_0xe9bd('0x25')](function(_0x505c23){logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x505c23);_0x46a95e(_0x505c23);});});}function respondWithStatusCode(_0x36f8c0,_0xf02209){_0xf02209=_0xf02209||0xcc;return function(_0x5bc4bf){if(_0x5bc4bf){return _0x36f8c0[_0xe9bd('0x26')](_0xf02209);}return _0x36f8c0[_0xe9bd('0x27')](_0xf02209)[_0xe9bd('0x28')]();};}function respondWithResult(_0x39b206,_0x2641be){_0x2641be=_0x2641be||0xc8;return function(_0xb52d45){if(_0xb52d45){return _0x39b206[_0xe9bd('0x27')](_0x2641be)[_0xe9bd('0x29')](_0xb52d45);}};}function respondWithFilteredResult(_0x1ae889,_0x5987af){return function(_0x3c211a){if(_0x3c211a){var _0x38fdfa=typeof _0x5987af['offset']===_0xe9bd('0x2a')&&typeof _0x5987af[_0xe9bd('0x2b')]===_0xe9bd('0x2a');var _0x429055=_0x3c211a[_0xe9bd('0x2c')];var _0x183601=_0x38fdfa?0x0:_0x5987af['offset'];var _0x5b7f1d=_0x38fdfa?_0x3c211a[_0xe9bd('0x2c')]:_0x5987af['offset']+_0x5987af[_0xe9bd('0x2b')];var _0x1f2c0e;if(_0x5b7f1d>=_0x429055){_0x5b7f1d=_0x429055;_0x1f2c0e=0xc8;}else{_0x1f2c0e=0xce;}_0x1ae889[_0xe9bd('0x27')](_0x1f2c0e);return _0x1ae889[_0xe9bd('0x2d')](_0xe9bd('0x2e'),_0x183601+'-'+_0x5b7f1d+'/'+_0x429055)['json'](_0x3c211a);}return null;};}function patchUpdates(_0x4b7bc2){return function(_0x7f2c5){try{jsonpatch[_0xe9bd('0x2f')](_0x7f2c5,_0x4b7bc2,!![]);}catch(_0x3f96a0){return BPromise[_0xe9bd('0x30')](_0x3f96a0);}return _0x7f2c5[_0xe9bd('0x31')]();};}function saveUpdates(_0x1f0f9e,_0x3c31ee){return function(_0x66213a){if(_0x66213a){return _0x66213a[_0xe9bd('0x32')](_0x1f0f9e)['then'](function(_0x426004){return _0x426004;});}return null;};}function removeEntity(_0x81a31f,_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x1b')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x33')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x34');return db[_0xe9bd('0x35')][_0xe9bd('0x36')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x1b')](function(){return _0x5117bc;});})[_0xe9bd('0x1b')](function(){_0x81a31f[_0xe9bd('0x27')](0xcc)[_0xe9bd('0x28')]();});}};}function handleEntityNotFound(_0x549dd1,_0x2ad46e){return function(_0x199477){if(!_0x199477){_0x549dd1[_0xe9bd('0x26')](0x194);}return _0x199477;};}function handleError(_0x8ff624,_0x264ba0){_0x264ba0=_0x264ba0||0x1f4;return function(_0x147da5){logger['error'](_0x147da5[_0xe9bd('0x37')]);if(_0x147da5[_0xe9bd('0x38')]){delete _0x147da5['name'];}_0x8ff624[_0xe9bd('0x27')](_0x264ba0)[_0xe9bd('0x39')](_0x147da5);};}exports['index']=function(_0x4b1da0,_0x2785e6){var _0xdf43b9={},_0x4d2f3d={},_0x2d1289={'count':0x0,'rows':[]};var _0x3ea705=_[_0xe9bd('0x3a')](db['Trunk'][_0xe9bd('0x3b')],function(_0x4d1945){return{'name':_0x4d1945[_0xe9bd('0x3c')],'type':_0x4d1945[_0xe9bd('0x3d')][_0xe9bd('0x3e')]};});_0x4d2f3d[_0xe9bd('0x3f')]=_['map'](_0x3ea705,_0xe9bd('0x38'));_0x4d2f3d[_0xe9bd('0x40')]=_[_0xe9bd('0x41')](_0x4b1da0[_0xe9bd('0x40')]);_0x4d2f3d[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4d2f3d[_0xe9bd('0x3f')],_0x4d2f3d[_0xe9bd('0x40')]);_0xdf43b9[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x4d2f3d['model'],qs['fields'](_0x4b1da0[_0xe9bd('0x40')]['fields']));_0xdf43b9[_0xe9bd('0x44')]=_0xdf43b9[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xdf43b9['attributes']:_0x4d2f3d[_0xe9bd('0x3f')];if(!_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x46')]('nolimit')){_0xdf43b9[_0xe9bd('0x2b')]=qs[_0xe9bd('0x2b')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x2b')]);_0xdf43b9[_0xe9bd('0x47')]=qs[_0xe9bd('0x47')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x47')]);}_0xdf43b9[_0xe9bd('0x48')]=qs[_0xe9bd('0x49')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x49')]);_0xdf43b9[_0xe9bd('0x4a')]=qs[_0xe9bd('0x42')](_[_0xe9bd('0x4b')](_0x4b1da0['query'],_0x4d2f3d['filters']),_0x3ea705);if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x4c')]){_0xdf43b9[_0xe9bd('0x4a')]=_['merge'](_0xdf43b9['where'],{'$or':_[_0xe9bd('0x3a')](_0x3ea705,function(_0x3f6f22){if(_0x3f6f22[_0xe9bd('0x3d')]!==_0xe9bd('0x4d')){var _0x39fb61={};_0x39fb61[_0x3f6f22[_0xe9bd('0x38')]]={'$like':'%'+_0x4b1da0[_0xe9bd('0x40')]['filter']+'%'};return _0x39fb61;}})});}_0xdf43b9=_[_0xe9bd('0x4e')]({},_0xdf43b9,_0x4b1da0['options']);var _0x36726e={'where':_0xdf43b9[_0xe9bd('0x4a')]};return db[_0xe9bd('0x4f')][_0xe9bd('0x2c')](_0x36726e)[_0xe9bd('0x1b')](function(_0x4b7b67){_0x2d1289[_0xe9bd('0x2c')]=_0x4b7b67;if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xdf43b9['include']=[{'all':!![]}];}return db[_0xe9bd('0x4f')][_0xe9bd('0x51')](_0xdf43b9);})[_0xe9bd('0x1b')](function(_0x5a466b){_0x2d1289[_0xe9bd('0x52')]=_0x5a466b;return _0x2d1289;})[_0xe9bd('0x1b')](respondWithFilteredResult(_0x2785e6,_0xdf43b9))[_0xe9bd('0x25')](handleError(_0x2785e6,null));};exports[_0xe9bd('0x53')]=function(_0x1ee09c,_0x579d26){var _0x3f4833={'raw':![],'where':{'id':_0x1ee09c[_0xe9bd('0x54')]['id']}},_0x4b8ff9={};_0x4b8ff9[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0x4b8ff9['query']=_[_0xe9bd('0x41')](_0x1ee09c['query']);_0x4b8ff9[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4b8ff9['model'],_0x4b8ff9['query']);_0x3f4833[_0xe9bd('0x44')]=_['intersection'](_0x4b8ff9[_0xe9bd('0x3f')],qs['fields'](_0x1ee09c[_0xe9bd('0x40')][_0xe9bd('0x55')]));_0x3f4833['attributes']=_0x3f4833[_0xe9bd('0x44')]['length']?_0x3f4833[_0xe9bd('0x44')]:_0x4b8ff9[_0xe9bd('0x3f')];if(_0x1ee09c[_0xe9bd('0x40')]['includeAll']){_0x3f4833[_0xe9bd('0x56')]=[{'all':!![]}];}_0x3f4833=_[_0xe9bd('0x4e')]({},_0x3f4833,_0x1ee09c[_0xe9bd('0x57')]);return db[_0xe9bd('0x4f')]['find'](_0x3f4833)['then'](handleEntityNotFound(_0x579d26,null))[_0xe9bd('0x1b')](respondWithResult(_0x579d26,null))['catch'](handleError(_0x579d26,null));};exports[_0xe9bd('0x58')]=function(_0x3c33b8,_0xc7dd2f){var _0xc818b4={'where':{'id':_0x3c33b8[_0xe9bd('0x54')]['id']}},_0x159f68={};_0x159f68[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0xc818b4[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x159f68['model'],qs['fields'](_0x3c33b8['query'][_0xe9bd('0x55')]));_0xc818b4['attributes']=_0xc818b4[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xc818b4[_0xe9bd('0x44')]:_0x159f68[_0xe9bd('0x3f')];if(_0x3c33b8[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xc818b4[_0xe9bd('0x56')]=[{'all':!![]}];}_0xc818b4=_[_0xe9bd('0x4e')]({},_0xc818b4,_0x3c33b8[_0xe9bd('0x57')]);return db['Trunk'][_0xe9bd('0x59')](_0xc818b4)[_0xe9bd('0x1b')](handleEntityNotFound(_0xc7dd2f,null))[_0xe9bd('0x1b')](function(_0x3f848d){if(_0x3f848d){var _0x4d58c1=_0x3f848d[_0xe9bd('0x33')]({'plain':!![]});_0x4d58c1=qs[_0xe9bd('0x5a')](_0x4d58c1,['id',_0xe9bd('0x5b'),'updatedAt']);_0x3c33b8[_0xe9bd('0x5c')]=_[_0xe9bd('0x5a')](_0x3c33b8[_0xe9bd('0x5c')],['id',_0xe9bd('0x5b'),'updatedAt']);return db['Trunk'][_0xe9bd('0x5d')](_[_0xe9bd('0x4e')](_0x4d58c1,_0x3c33b8[_0xe9bd('0x5c')]),{'include':_0x3c33b8[_0xe9bd('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x305efa){var _0x20855b=_0x3c33b8[_0xe9bd('0x5e')][_0xe9bd('0x33')]({'plain':!![]});if(!_0x20855b)throw new Error(_0xe9bd('0x5f'));if(_0x20855b[_0xe9bd('0x60')]==='user'){var _0x179c8d=_0x305efa['get']({'plain':!![]});var _0x27e07c=_0xe9bd('0x34');return db[_0xe9bd('0x61')][_0xe9bd('0x59')]({'where':{'name':_0x27e07c,'userProfileId':_0x20855b['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x263ad9){if(_0x263ad9&&_0x263ad9[_0xe9bd('0x62')]===0x0){return db['UserProfileResource'][_0xe9bd('0x5d')]({'name':_0x179c8d[_0xe9bd('0x38')],'resourceId':_0x179c8d['id'],'type':_0x263ad9[_0xe9bd('0x38')],'sectionId':_0x263ad9['id']},{})[_0xe9bd('0x1b')](function(){return _0x305efa;});}else{return _0x305efa;}})[_0xe9bd('0x25')](function(_0x16b66c){logger[_0xe9bd('0x21')](_0xe9bd('0x63'),_0x16b66c);throw _0x16b66c;});}return _0x305efa;});}})[_0xe9bd('0x1b')](respondWithResult(_0xc7dd2f,0xc9))[_0xe9bd('0x25')](handleError(_0xc7dd2f,null));};exports[_0xe9bd('0x5d')]=function(_0x37d07a,_0x5d1e4b,_0x3a12e9){var _0x9d0603;return db['Trunk'][_0xe9bd('0x5d')](_0x37d07a[_0xe9bd('0x5c')],{'raw':!![]})['then'](function(_0x561165){_0x9d0603=_0x561165;return db[_0xe9bd('0x4f')][_0xe9bd('0x51')]({'raw':!![]});})['then'](function(_0x4ec8be){var _0x4a6422=fs[_0xe9bd('0x64')](path['join'](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x1fc88d=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x337284=ejs[_0xe9bd('0x68')](_0x4a6422,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x69'),_0x337284);if(_0x9d0603[_0xe9bd('0x6a')]){var _0x11ebcb=ejs['render'](_0x1fc88d,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x6b'),_0x11ebcb);}})[_0xe9bd('0x1b')](function(){return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x5d'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x1b')](function(){var _0x3fda4c=_0x37d07a[_0xe9bd('0x5e')]['get']({'plain':!![]});if(!_0x3fda4c)throw new Error(_0xe9bd('0x5f'));if(_0x3fda4c[_0xe9bd('0x60')]===_0xe9bd('0x5e')){var _0x3db47a=_0x9d0603[_0xe9bd('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xe9bd('0x59')]({'where':{'name':'Trunks','userProfileId':_0x3fda4c['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x4496e3){if(_0x4496e3&&_0x4496e3['autoAssociation']===0x0){return db[_0xe9bd('0x35')][_0xe9bd('0x5d')]({'name':_0x3db47a[_0xe9bd('0x38')],'resourceId':_0x3db47a['id'],'type':_0x4496e3[_0xe9bd('0x38')],'sectionId':_0x4496e3['id']},{})['then'](function(){return _0x9d0603;});}else{return _0x9d0603;}})[_0xe9bd('0x25')](function(_0x41fb41){logger['error'](_0xe9bd('0x63'),_0x41fb41);throw _0x41fb41;});}return _0x9d0603;})[_0xe9bd('0x1b')](respondWithResult(_0x5d1e4b,0xc9))[_0xe9bd('0x25')](handleError(_0x5d1e4b,null));};exports[_0xe9bd('0x32')]=function(_0x2e63c7,_0x1a36aa,_0x466a89){var _0x5e127b;return db[_0xe9bd('0x4f')][_0xe9bd('0x59')]({'where':{'id':_0x2e63c7[_0xe9bd('0x54')]['id']}})[_0xe9bd('0x1b')](handleEntityNotFound(_0x1a36aa,null))[_0xe9bd('0x1b')](saveUpdates(_0x2e63c7[_0xe9bd('0x5c')],null))[_0xe9bd('0x1b')](function(_0x2adc49){if(_0x2adc49){_0x5e127b=_0x2adc49;return db[_0xe9bd('0x4f')]['findAll']({'raw':!![]});}})[_0xe9bd('0x1b')](function(_0x466952){if(_0x466952){var _0x256890=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),'utf8');var _0x18519d=fs[_0xe9bd('0x64')](path['join'](config[_0xe9bd('0x6e')],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x2083c4=ejs[_0xe9bd('0x68')](_0x256890,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x69'),_0x2083c4);var _0x4f3dc6=ejs['render'](_0x18519d,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x4f3dc6);return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x32'),{'module':_0xe9bd('0x6d')});}return null;})[_0xe9bd('0x1b')](function(_0x1b46f4){if(_0x1b46f4){return _0x5e127b;}})['then'](respondWithResult(_0x1a36aa,null))[_0xe9bd('0x25')](handleError(_0x1a36aa,null));};exports[_0xe9bd('0x36')]=function(_0x29833b,_0x256862,_0x14cdd5){var _0x74063;return db[_0xe9bd('0x4f')]['find']({'where':{'id':_0x29833b['params']['id']}})['then'](handleEntityNotFound(_0x256862,null))[_0xe9bd('0x1b')](removeEntity(_0x256862,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0xe9bd('0x1b')](function(_0x402ab2){var _0xf170d4=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),_0xe9bd('0x67'));var _0x14ec42=fs['readFileSync'](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x22c67f=ejs[_0xe9bd('0x68')](_0xf170d4,{'trunks':_0x402ab2});var _0x416938=ejs['render'](_0x14ec42,{'trunks':_0x402ab2});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x22c67f);fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x416938);return respondWithRpcPromise('Reload',_0xe9bd('0x36'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x25')](handleError(_0x256862,null));}; \ No newline at end of file +var _0x9957=['clone','includeAll','merge','get','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','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','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','Trunk','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','options','include','rows','show','params','find'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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'];var jayson=require(_0x7995('0x1b'));var client=jayson[_0x7995('0x1c')][_0x7995('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x23999f,_0x2bbe7a,_0x4cc004,_0x58f5ad){return new BPromise(function(_0x2b4e94,_0x2233dd){var _0x24b5bb=_0x58f5ad||client;return _0x24b5bb[_0x7995('0x1e')](_0x23999f,_0x4cc004)[_0x7995('0x1f')](function(_0x1a5310){logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,'request\x20sent');logger[_0x7995('0x22')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2bbe7a,_0x7995('0x23'),JSON[_0x7995('0x24')](_0x1a5310));if(_0x1a5310[_0x7995('0x25')]){if(_0x1a5310[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x25')]('Trunk,\x20%s,\x20%s',_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2233dd(_0x1a5310['error']['message']);}logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2b4e94(_0x1a5310['error']['message']);}else{logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,_0x7995('0x23'));_0x2b4e94(_0x1a5310[_0x7995('0x28')][_0x7995('0x27')]);}})[_0x7995('0x29')](function(_0x5d40ae){logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x5d40ae);_0x2233dd(_0x5d40ae);});});}function respondWithStatusCode(_0x204507,_0x285437){_0x285437=_0x285437||0xcc;return function(_0x563799){if(_0x563799){return _0x204507[_0x7995('0x2a')](_0x285437);}return _0x204507[_0x7995('0x2b')](_0x285437)[_0x7995('0x2c')]();};}function respondWithResult(_0x59405a,_0x39df42){_0x39df42=_0x39df42||0xc8;return function(_0x34e70c){if(_0x34e70c){return _0x59405a[_0x7995('0x2b')](_0x39df42)[_0x7995('0x2d')](_0x34e70c);}};}function respondWithFilteredResult(_0x3a3fcf,_0x2a307e){return function(_0x56691a){if(_0x56691a){var _0x47625f=typeof _0x2a307e['offset']===_0x7995('0x2e')&&typeof _0x2a307e[_0x7995('0x2f')]===_0x7995('0x2e');var _0x132a42=_0x56691a[_0x7995('0x30')];var _0x4b6f99=_0x47625f?0x0:_0x2a307e[_0x7995('0x31')];var _0x514445=_0x47625f?_0x56691a[_0x7995('0x30')]:_0x2a307e[_0x7995('0x31')]+_0x2a307e[_0x7995('0x2f')];var _0x574574;if(_0x514445>=_0x132a42){_0x514445=_0x132a42;_0x574574=0xc8;}else{_0x574574=0xce;}_0x3a3fcf['status'](_0x574574);return _0x3a3fcf['set'](_0x7995('0x32'),_0x4b6f99+'-'+_0x514445+'/'+_0x132a42)[_0x7995('0x2d')](_0x56691a);}return null;};}function patchUpdates(_0x327a81){return function(_0x2b874d){try{jsonpatch[_0x7995('0x33')](_0x2b874d,_0x327a81,!![]);}catch(_0x1ca460){return BPromise['reject'](_0x1ca460);}return _0x2b874d['save']();};}function saveUpdates(_0xfa8f15,_0x5524af){return function(_0x553671){if(_0x553671){return _0x553671[_0x7995('0x34')](_0xfa8f15)[_0x7995('0x1f')](function(_0x1e9fa4){return _0x1e9fa4;});}return null;};}function removeEntity(_0x1f7d27,_0x510841){return function(_0x44309d){if(_0x44309d){return _0x44309d[_0x7995('0x35')]()['then'](function(){var _0x48db25=_0x44309d['get']({'plain':!![]});var _0x45bc5e=_0x7995('0x36');return db['UserProfileResource'][_0x7995('0x35')]({'where':{'type':_0x45bc5e,'resourceId':_0x48db25['id']}})['then'](function(){return _0x44309d;});})[_0x7995('0x1f')](function(){_0x1f7d27[_0x7995('0x2b')](0xcc)[_0x7995('0x2c')]();});}};}function handleEntityNotFound(_0x5014d2,_0x52d76d){return function(_0x36d057){if(!_0x36d057){_0x5014d2['sendStatus'](0x194);}return _0x36d057;};}function handleError(_0x5d2428,_0x3e99cd){_0x3e99cd=_0x3e99cd||0x1f4;return function(_0xe328b1){logger['error'](_0xe328b1[_0x7995('0x37')]);if(_0xe328b1[_0x7995('0x38')]){delete _0xe328b1[_0x7995('0x38')];}_0x5d2428[_0x7995('0x2b')](_0x3e99cd)[_0x7995('0x39')](_0xe328b1);};}exports['index']=function(_0x2d4285,_0x242713){var _0xf612e6={},_0x1d60b8={},_0x4b1541={'count':0x0,'rows':[]};var _0x2be2c0=_[_0x7995('0x3a')](db[_0x7995('0x3b')][_0x7995('0x3c')],function(_0x1f5bee){return{'name':_0x1f5bee[_0x7995('0x3d')],'type':_0x1f5bee['type'][_0x7995('0x3e')]};});_0x1d60b8[_0x7995('0x3f')]=_[_0x7995('0x3a')](_0x2be2c0,_0x7995('0x38'));_0x1d60b8[_0x7995('0x40')]=_[_0x7995('0x41')](_0x2d4285[_0x7995('0x40')]);_0x1d60b8[_0x7995('0x42')]=_[_0x7995('0x43')](_0x1d60b8[_0x7995('0x3f')],_0x1d60b8[_0x7995('0x40')]);_0xf612e6[_0x7995('0x44')]=_[_0x7995('0x43')](_0x1d60b8['model'],qs['fields'](_0x2d4285[_0x7995('0x40')][_0x7995('0x45')]));_0xf612e6['attributes']=_0xf612e6['attributes'][_0x7995('0x46')]?_0xf612e6['attributes']:_0x1d60b8['model'];if(!_0x2d4285[_0x7995('0x40')][_0x7995('0x47')](_0x7995('0x48'))){_0xf612e6['limit']=qs[_0x7995('0x2f')](_0x2d4285['query'][_0x7995('0x2f')]);_0xf612e6['offset']=qs['offset'](_0x2d4285[_0x7995('0x40')][_0x7995('0x31')]);}_0xf612e6[_0x7995('0x49')]=qs[_0x7995('0x4a')](_0x2d4285['query'][_0x7995('0x4a')]);_0xf612e6[_0x7995('0x4b')]=qs[_0x7995('0x42')](_[_0x7995('0x4c')](_0x2d4285['query'],_0x1d60b8['filters']),_0x2be2c0);if(_0x2d4285[_0x7995('0x40')]['filter']){_0xf612e6[_0x7995('0x4b')]=_['merge'](_0xf612e6[_0x7995('0x4b')],{'$or':_['map'](_0x2be2c0,function(_0x1e795e){if(_0x1e795e[_0x7995('0x4d')]!=='VIRTUAL'){var _0x3e9e62={};_0x3e9e62[_0x1e795e[_0x7995('0x38')]]={'$like':'%'+_0x2d4285[_0x7995('0x40')][_0x7995('0x4e')]+'%'};return _0x3e9e62;}})});}_0xf612e6=_['merge']({},_0xf612e6,_0x2d4285[_0x7995('0x4f')]);var _0x3e787d={'where':_0xf612e6[_0x7995('0x4b')]};return db['Trunk'][_0x7995('0x30')](_0x3e787d)[_0x7995('0x1f')](function(_0x511567){_0x4b1541[_0x7995('0x30')]=_0x511567;if(_0x2d4285[_0x7995('0x40')]['includeAll']){_0xf612e6[_0x7995('0x50')]=[{'all':!![]}];}return db[_0x7995('0x3b')]['findAll'](_0xf612e6);})[_0x7995('0x1f')](function(_0x5843ba){_0x4b1541[_0x7995('0x51')]=_0x5843ba;return _0x4b1541;})[_0x7995('0x1f')](respondWithFilteredResult(_0x242713,_0xf612e6))[_0x7995('0x29')](handleError(_0x242713,null));};exports[_0x7995('0x52')]=function(_0xddf537,_0x14b537){var _0x1579b9={'raw':![],'where':{'id':_0xddf537[_0x7995('0x53')]['id']}},_0x4d46bc={};_0x4d46bc[_0x7995('0x3f')]=_[_0x7995('0x41')](db['Trunk'][_0x7995('0x3c')]);_0x4d46bc[_0x7995('0x40')]=_[_0x7995('0x41')](_0xddf537['query']);_0x4d46bc['filters']=_['intersection'](_0x4d46bc[_0x7995('0x3f')],_0x4d46bc[_0x7995('0x40')]);_0x1579b9['attributes']=_[_0x7995('0x43')](_0x4d46bc[_0x7995('0x3f')],qs[_0x7995('0x45')](_0xddf537[_0x7995('0x40')][_0x7995('0x45')]));_0x1579b9['attributes']=_0x1579b9[_0x7995('0x44')]['length']?_0x1579b9[_0x7995('0x44')]:_0x4d46bc[_0x7995('0x3f')];if(_0xddf537[_0x7995('0x40')]['includeAll']){_0x1579b9['include']=[{'all':!![]}];}_0x1579b9=_['merge']({},_0x1579b9,_0xddf537['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x1579b9)[_0x7995('0x1f')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x1f')](respondWithResult(_0x14b537,null))[_0x7995('0x29')](handleError(_0x14b537,null));};exports[_0x7995('0x55')]=function(_0x1f4270,_0xda6ce8){var _0x328671={'where':{'id':_0x1f4270[_0x7995('0x53')]['id']}},_0x17ecd3={};_0x17ecd3[_0x7995('0x3f')]=_[_0x7995('0x41')](db[_0x7995('0x3b')][_0x7995('0x3c')]);_0x328671[_0x7995('0x44')]=_[_0x7995('0x43')](_0x17ecd3[_0x7995('0x3f')],qs[_0x7995('0x45')](_0x1f4270['query'][_0x7995('0x45')]));_0x328671[_0x7995('0x44')]=_0x328671[_0x7995('0x44')][_0x7995('0x46')]?_0x328671['attributes']:_0x17ecd3['model'];if(_0x1f4270[_0x7995('0x40')][_0x7995('0x56')]){_0x328671[_0x7995('0x50')]=[{'all':!![]}];}_0x328671=_[_0x7995('0x57')]({},_0x328671,_0x1f4270['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x328671)[_0x7995('0x1f')](handleEntityNotFound(_0xda6ce8,null))[_0x7995('0x1f')](function(_0x502d43){if(_0x502d43){var _0x5e2d97=_0x502d43[_0x7995('0x58')]({'plain':!![]});_0x5e2d97=qs[_0x7995('0x59')](_0x5e2d97,['id',_0x7995('0x5a'),_0x7995('0x5b')]);_0x1f4270[_0x7995('0x5c')]=_[_0x7995('0x59')](_0x1f4270[_0x7995('0x5c')],['id',_0x7995('0x5a'),_0x7995('0x5b')]);return db['Trunk'][_0x7995('0x5d')](_[_0x7995('0x57')](_0x5e2d97,_0x1f4270[_0x7995('0x5c')]),{'include':_0x1f4270[_0x7995('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3053fd){var _0xebb5c8=_0x1f4270['user'][_0x7995('0x58')]({'plain':!![]});if(!_0xebb5c8)throw new Error(_0x7995('0x5e'));if(_0xebb5c8[_0x7995('0x5f')]===_0x7995('0x60')){var _0x32cb04=_0x3053fd['get']({'plain':!![]});var _0x457d09='Trunks';return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':_0x457d09,'userProfileId':_0xebb5c8[_0x7995('0x62')]},'raw':!![]})[_0x7995('0x1f')](function(_0x4388c1){if(_0x4388c1&&_0x4388c1[_0x7995('0x63')]===0x0){return db[_0x7995('0x64')][_0x7995('0x5d')]({'name':_0x32cb04[_0x7995('0x38')],'resourceId':_0x32cb04['id'],'type':_0x4388c1[_0x7995('0x38')],'sectionId':_0x4388c1['id']},{})[_0x7995('0x1f')](function(){return _0x3053fd;});}else{return _0x3053fd;}})[_0x7995('0x29')](function(_0x56eb85){logger[_0x7995('0x25')](_0x7995('0x65'),_0x56eb85);throw _0x56eb85;});}return _0x3053fd;});}})[_0x7995('0x1f')](respondWithResult(_0xda6ce8,0xc9))[_0x7995('0x29')](handleError(_0xda6ce8,null));};exports[_0x7995('0x5d')]=function(_0x54a2e0,_0x4b54f2,_0x268fde){var _0x87e38d;return db[_0x7995('0x3b')][_0x7995('0x5d')](_0x54a2e0['body'],{'raw':!![]})[_0x7995('0x1f')](function(_0x50a12e){_0x87e38d=_0x50a12e;return db['Trunk'][_0x7995('0x66')]({'raw':!![]});})[_0x7995('0x1f')](function(_0x3f0a71){var _0x44bf2b=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x2466df=fs['readFileSync'](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6c')),'utf8');var _0x1fe1cb=ejs[_0x7995('0x6d')](_0x44bf2b,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x1fe1cb);if(_0x87e38d[_0x7995('0x70')]){var _0x51ab1e=ejs[_0x7995('0x6d')](_0x2466df,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x51ab1e);}})[_0x7995('0x1f')](function(){return respondWithRpcPromise(_0x7995('0x72'),'create',{'module':'chan_sip.so'});})[_0x7995('0x1f')](function(){var _0xfe1105=_0x54a2e0[_0x7995('0x60')][_0x7995('0x58')]({'plain':!![]});if(!_0xfe1105)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfe1105[_0x7995('0x5f')]===_0x7995('0x60')){var _0x54b955=_0x87e38d['get']({'plain':!![]});return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':'Trunks','userProfileId':_0xfe1105[_0x7995('0x62')]},'raw':!![]})['then'](function(_0x3758f9){if(_0x3758f9&&_0x3758f9[_0x7995('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x54b955[_0x7995('0x38')],'resourceId':_0x54b955['id'],'type':_0x3758f9['name'],'sectionId':_0x3758f9['id']},{})[_0x7995('0x1f')](function(){return _0x87e38d;});}else{return _0x87e38d;}})[_0x7995('0x29')](function(_0x3dd197){logger[_0x7995('0x25')](_0x7995('0x65'),_0x3dd197);throw _0x3dd197;});}return _0x87e38d;})[_0x7995('0x1f')](respondWithResult(_0x4b54f2,0xc9))[_0x7995('0x29')](handleError(_0x4b54f2,null));};exports[_0x7995('0x34')]=function(_0x29e0ee,_0x117317,_0x1ab590){var _0x16108c;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x29e0ee[_0x7995('0x53')]['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0x117317,null))[_0x7995('0x1f')](saveUpdates(_0x29e0ee[_0x7995('0x5c')],null))[_0x7995('0x1f')](function(_0xa2fc8e){if(_0xa2fc8e){_0x16108c=_0xa2fc8e;return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});}})[_0x7995('0x1f')](function(_0x280fbb){if(_0x280fbb){var _0x260ef1=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/trunk.ejs'),_0x7995('0x6b'));var _0x10f4ca=fs['readFileSync'](path['join'](config[_0x7995('0x69')],_0x7995('0x6c')),_0x7995('0x6b'));var _0x38acda=ejs[_0x7995('0x6d')](_0x260ef1,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x38acda);var _0x2f8a2d=ejs[_0x7995('0x6d')](_0x10f4ca,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x2f8a2d);return respondWithRpcPromise(_0x7995('0x72'),_0x7995('0x34'),{'module':_0x7995('0x73')});}return null;})[_0x7995('0x1f')](function(_0x560095){if(_0x560095){return _0x16108c;}})[_0x7995('0x1f')](respondWithResult(_0x117317,null))[_0x7995('0x29')](handleError(_0x117317,null));};exports['destroy']=function(_0x479271,_0xd24c64,_0xf8c2ed){var _0x18e1a2;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x479271['params']['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0xd24c64,null))[_0x7995('0x1f')](removeEntity(_0xd24c64,null))['then'](function(){return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});})['then'](function(_0x1535a3){var _0x4a5bc5=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x5d16da=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/registry.ejs'),_0x7995('0x6b'));var _0x3f3434=ejs[_0x7995('0x6d')](_0x4a5bc5,{'trunks':_0x1535a3});var _0x308a26=ejs['render'](_0x5d16da,{'trunks':_0x1535a3});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x3f3434);fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_registers.conf',_0x308a26);return respondWithRpcPromise('Reload',_0x7995('0x35'),{'module':_0x7995('0x73')});})['catch'](handleError(_0xd24c64,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 4ae4f75..0978a33 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 _0x373f=['tools_trunks','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk'];(function(_0x5e101c,_0x22b01f){var _0x456d97=function(_0x1ab578){while(--_0x1ab578){_0x5e101c['push'](_0x5e101c['shift']());}};_0x456d97(++_0x22b01f);}(_0x373f,0x7f));var _0xf373=function(_0x637217,_0x583774){_0x637217=_0x637217-0x0;var _0x10047f=_0x373f[_0x637217];return _0x10047f;};'use strict';var _=require('lodash');var util=require(_0xf373('0x0'));var logger=require(_0xf373('0x1'))(_0xf373('0x2'));var moment=require(_0xf373('0x3'));var BPromise=require(_0xf373('0x4'));var rp=require(_0xf373('0x5'));var fs=require('fs');var path=require(_0xf373('0x6'));var rimraf=require(_0xf373('0x7'));var config=require(_0xf373('0x8'));var attributes=require(_0xf373('0x9'));module[_0xf373('0xa')]=function(_0x526709,_0x132ced){return _0x526709[_0xf373('0xb')](_0xf373('0xc'),attributes,{'tableName':_0xf373('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4aa=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./trunk.attributes','exports','define','Trunk','lodash'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0xd4aa,0x1bb));var _0xad4a=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xd4aa[_0x2dea24];return _0x309d58;};'use strict';var _=require(_0xad4a('0x0'));var util=require(_0xad4a('0x1'));var logger=require(_0xad4a('0x2'))(_0xad4a('0x3'));var moment=require('moment');var BPromise=require(_0xad4a('0x4'));var rp=require(_0xad4a('0x5'));var fs=require('fs');var path=require(_0xad4a('0x6'));var rimraf=require('rimraf');var config=require(_0xad4a('0x7'));var attributes=require(_0xad4a('0x8'));module[_0xad4a('0x9')]=function(_0x144380,_0x4aacff){return _0x144380[_0xad4a('0xa')](_0xad4a('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 57e35c9..51ad829 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 _0xdd7e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','Trunk,\x20%s,\x20%s','result','catch','GetTrunk','Trunk','findAll','options','raw','include','attributes','map','model','find','ShowTrunk','lodash','util'];(function(_0x29df9a,_0x42aff3){var _0x3a8e96=function(_0x70fbe7){while(--_0x70fbe7){_0x29df9a['push'](_0x29df9a['shift']());}};_0x3a8e96(++_0x42aff3);}(_0xdd7e,0x1d2));var _0xedd7=function(_0x487e8e,_0x452414){_0x487e8e=_0x487e8e-0x0;var _0x4678db=_0xdd7e[_0x487e8e];return _0x4678db;};'use strict';var _=require(_0xedd7('0x0'));var util=require(_0xedd7('0x1'));var moment=require('moment');var BPromise=require(_0xedd7('0x2'));var rs=require(_0xedd7('0x3'));var fs=require('fs');var Redis=require(_0xedd7('0x4'));var db=require(_0xedd7('0x5'))['db'];var utils=require(_0xedd7('0x6'));var logger=require(_0xedd7('0x7'))(_0xedd7('0x8'));var config=require(_0xedd7('0x9'));var jayson=require(_0xedd7('0xa'));var client=jayson[_0xedd7('0xb')][_0xedd7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x158499,_0x473930,_0x4cd618){return new BPromise(function(_0x20ee33,_0x2eab53){return client[_0xedd7('0xd')](_0x158499,_0x4cd618)[_0xedd7('0xe')](function(_0x59f84f){logger[_0xedd7('0xf')]('Trunk,\x20%s,\x20%s',_0x473930,_0xedd7('0x10'));logger[_0xedd7('0x11')]('Trunk,\x20%s,\x20%s,\x20%s',_0x473930,_0xedd7('0x10'),JSON[_0xedd7('0x12')](_0x59f84f));if(_0x59f84f[_0xedd7('0x13')]){if(_0x59f84f[_0xedd7('0x13')][_0xedd7('0x14')]===0x1f4){logger[_0xedd7('0x13')]('Trunk,\x20%s,\x20%s',_0x473930,_0x59f84f['error'][_0xedd7('0x15')]);return _0x2eab53(_0x59f84f['error']['message']);}logger[_0xedd7('0x13')](_0xedd7('0x16'),_0x473930,_0x59f84f[_0xedd7('0x13')][_0xedd7('0x15')]);return _0x20ee33(_0x59f84f[_0xedd7('0x13')][_0xedd7('0x15')]);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x473930,_0xedd7('0x10'));_0x20ee33(_0x59f84f[_0xedd7('0x17')][_0xedd7('0x15')]);}})[_0xedd7('0x18')](function(_0x1504be){logger[_0xedd7('0x13')](_0xedd7('0x16'),_0x473930,_0x1504be);_0x2eab53(_0x1504be);});});}exports[_0xedd7('0x19')]=function(_0xcc9979){var _0x32c48c=this;return new Promise(function(_0x12570d,_0x3d7f33){return db[_0xedd7('0x1a')][_0xedd7('0x1b')]({'raw':_0xcc9979[_0xedd7('0x1c')]?_0xcc9979[_0xedd7('0x1c')][_0xedd7('0x1d')]===undefined?!![]:![]:!![],'where':_0xcc9979[_0xedd7('0x1c')]?_0xcc9979[_0xedd7('0x1c')]['where']||null:null,'attributes':_0xcc9979[_0xedd7('0x1c')]?_0xcc9979[_0xedd7('0x1c')]['attributes']||null:null,'limit':_0xcc9979['options']?_0xcc9979['options']['limit']||null:null,'include':_0xcc9979['options']?_0xcc9979[_0xedd7('0x1c')][_0xedd7('0x1e')]?_['map'](_0xcc9979['options'][_0xedd7('0x1e')],function(_0x2f97d5){return{'model':db[_0x2f97d5['model']],'as':_0x2f97d5['as'],'attributes':_0x2f97d5[_0xedd7('0x1f')],'include':_0x2f97d5['include']?_[_0xedd7('0x20')](_0x2f97d5['include'],function(_0x18c6d4){return{'model':db[_0x18c6d4[_0xedd7('0x21')]],'as':_0x18c6d4['as'],'attributes':_0x18c6d4[_0xedd7('0x1f')],'include':_0x18c6d4[_0xedd7('0x1e')]?_[_0xedd7('0x20')](_0x18c6d4[_0xedd7('0x1e')],function(_0x4e9700){return{'model':db[_0x4e9700[_0xedd7('0x21')]],'as':_0x4e9700['as'],'attributes':_0x4e9700[_0xedd7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xedd7('0xe')](function(_0x4a65c0){logger['info'](_0xedd7('0x19'),_0xcc9979);logger[_0xedd7('0x11')](_0xedd7('0x19'),_0xcc9979,JSON[_0xedd7('0x12')](_0x4a65c0));_0x12570d(_0x4a65c0);})[_0xedd7('0x18')](function(_0x55bf21){logger[_0xedd7('0x13')](_0xedd7('0x19'),_0x55bf21[_0xedd7('0x15')],_0xcc9979);_0x3d7f33(_0x32c48c[_0xedd7('0x13')](0x1f4,_0x55bf21['message']));});});};exports['ShowTrunk']=function(_0x791287){var _0x2d9174=this;return new Promise(function(_0x84305f,_0xe3bfc2){return db[_0xedd7('0x1a')][_0xedd7('0x22')]({'raw':_0x791287[_0xedd7('0x1c')]?_0x791287[_0xedd7('0x1c')][_0xedd7('0x1d')]===undefined?!![]:![]:!![],'where':_0x791287['options']?_0x791287[_0xedd7('0x1c')]['where']||null:null,'attributes':_0x791287[_0xedd7('0x1c')]?_0x791287['options']['attributes']||null:null,'include':_0x791287[_0xedd7('0x1c')]?_0x791287[_0xedd7('0x1c')][_0xedd7('0x1e')]?_[_0xedd7('0x20')](_0x791287['options']['include'],function(_0x148295){return{'model':db[_0x148295['model']],'as':_0x148295['as'],'attributes':_0x148295[_0xedd7('0x1f')],'include':_0x148295[_0xedd7('0x1e')]?_[_0xedd7('0x20')](_0x148295['include'],function(_0x4fc16f){return{'model':db[_0x4fc16f[_0xedd7('0x21')]],'as':_0x4fc16f['as'],'attributes':_0x4fc16f[_0xedd7('0x1f')],'include':_0x4fc16f[_0xedd7('0x1e')]?_['map'](_0x4fc16f[_0xedd7('0x1e')],function(_0x40488a){return{'model':db[_0x40488a['model']],'as':_0x40488a['as'],'attributes':_0x40488a[_0xedd7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xedd7('0xe')](function(_0x53b9cf){logger[_0xedd7('0xf')](_0xedd7('0x23'),_0x791287);logger[_0xedd7('0x11')](_0xedd7('0x23'),_0x791287,JSON['stringify'](_0x53b9cf));_0x84305f(_0x53b9cf);})[_0xedd7('0x18')](function(_0x451811){logger['error'](_0xedd7('0x23'),_0x451811[_0xedd7('0x15')],_0x791287);_0xe3bfc2(_0x2d9174[_0xedd7('0x13')](0x1f4,_0x451811[_0xedd7('0x15')]));});});}; \ No newline at end of file +var _0x7758=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetTrunk','Trunk','options','where','limit','include','model','attributes','map','debug','stringify','ShowTrunk','find','raw','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3a61c9,_0x17377f){var _0x41ba40=function(_0x2333d4){while(--_0x2333d4){_0x3a61c9['push'](_0x3a61c9['shift']());}};_0x41ba40(++_0x17377f);}(_0x7758,0x186));var _0x8775=function(_0x44e377,_0x2d6a04){_0x44e377=_0x44e377-0x0;var _0x34c14d=_0x7758[_0x44e377];return _0x34c14d;};'use strict';var _=require(_0x8775('0x0'));var util=require(_0x8775('0x1'));var moment=require(_0x8775('0x2'));var BPromise=require(_0x8775('0x3'));var rs=require(_0x8775('0x4'));var fs=require('fs');var Redis=require(_0x8775('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8775('0x6'));var logger=require(_0x8775('0x7'))(_0x8775('0x8'));var config=require(_0x8775('0x9'));var jayson=require(_0x8775('0xa'));var client=jayson[_0x8775('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31244c,_0x1873c6,_0x592306){return new BPromise(function(_0x53e5c5,_0x2f90df){return client[_0x8775('0xc')](_0x31244c,_0x592306)[_0x8775('0xd')](function(_0x29bbc2){logger[_0x8775('0xe')](_0x8775('0xf'),_0x1873c6,_0x8775('0x10'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x1873c6,_0x8775('0x10'),JSON['stringify'](_0x29bbc2));if(_0x29bbc2['error']){if(_0x29bbc2[_0x8775('0x11')][_0x8775('0x12')]===0x1f4){logger[_0x8775('0x11')](_0x8775('0xf'),_0x1873c6,_0x29bbc2[_0x8775('0x11')][_0x8775('0x13')]);return _0x2f90df(_0x29bbc2[_0x8775('0x11')]['message']);}logger[_0x8775('0x11')](_0x8775('0xf'),_0x1873c6,_0x29bbc2[_0x8775('0x11')]['message']);return _0x53e5c5(_0x29bbc2[_0x8775('0x11')]['message']);}else{logger[_0x8775('0xe')](_0x8775('0xf'),_0x1873c6,_0x8775('0x10'));_0x53e5c5(_0x29bbc2[_0x8775('0x14')][_0x8775('0x13')]);}})[_0x8775('0x15')](function(_0x5f418b){logger[_0x8775('0x11')]('Trunk,\x20%s,\x20%s',_0x1873c6,_0x5f418b);_0x2f90df(_0x5f418b);});});}exports[_0x8775('0x16')]=function(_0x3daa9b){var _0x271cce=this;return new Promise(function(_0x1a2b54,_0xd39bc){return db[_0x8775('0x17')]['findAll']({'raw':_0x3daa9b['options']?_0x3daa9b[_0x8775('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3daa9b[_0x8775('0x18')]?_0x3daa9b[_0x8775('0x18')][_0x8775('0x19')]||null:null,'attributes':_0x3daa9b[_0x8775('0x18')]?_0x3daa9b[_0x8775('0x18')]['attributes']||null:null,'limit':_0x3daa9b[_0x8775('0x18')]?_0x3daa9b[_0x8775('0x18')][_0x8775('0x1a')]||null:null,'include':_0x3daa9b['options']?_0x3daa9b[_0x8775('0x18')][_0x8775('0x1b')]?_['map'](_0x3daa9b[_0x8775('0x18')]['include'],function(_0x4bf51e){return{'model':db[_0x4bf51e[_0x8775('0x1c')]],'as':_0x4bf51e['as'],'attributes':_0x4bf51e[_0x8775('0x1d')],'include':_0x4bf51e[_0x8775('0x1b')]?_[_0x8775('0x1e')](_0x4bf51e['include'],function(_0x526e6b){return{'model':db[_0x526e6b[_0x8775('0x1c')]],'as':_0x526e6b['as'],'attributes':_0x526e6b[_0x8775('0x1d')],'include':_0x526e6b[_0x8775('0x1b')]?_[_0x8775('0x1e')](_0x526e6b[_0x8775('0x1b')],function(_0xed8b5f){return{'model':db[_0xed8b5f[_0x8775('0x1c')]],'as':_0xed8b5f['as'],'attributes':_0xed8b5f[_0x8775('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8775('0xd')](function(_0x3ba197){logger[_0x8775('0xe')](_0x8775('0x16'),_0x3daa9b);logger[_0x8775('0x1f')](_0x8775('0x16'),_0x3daa9b,JSON[_0x8775('0x20')](_0x3ba197));_0x1a2b54(_0x3ba197);})[_0x8775('0x15')](function(_0x51a12c){logger[_0x8775('0x11')](_0x8775('0x16'),_0x51a12c[_0x8775('0x13')],_0x3daa9b);_0xd39bc(_0x271cce['error'](0x1f4,_0x51a12c[_0x8775('0x13')]));});});};exports[_0x8775('0x21')]=function(_0x534cff){var _0x23fb22=this;return new Promise(function(_0x56a60f,_0x221cec){return db[_0x8775('0x17')][_0x8775('0x22')]({'raw':_0x534cff['options']?_0x534cff[_0x8775('0x18')][_0x8775('0x23')]===undefined?!![]:![]:!![],'where':_0x534cff[_0x8775('0x18')]?_0x534cff['options'][_0x8775('0x19')]||null:null,'attributes':_0x534cff[_0x8775('0x18')]?_0x534cff[_0x8775('0x18')]['attributes']||null:null,'include':_0x534cff[_0x8775('0x18')]?_0x534cff['options'][_0x8775('0x1b')]?_[_0x8775('0x1e')](_0x534cff[_0x8775('0x18')][_0x8775('0x1b')],function(_0x42fc11){return{'model':db[_0x42fc11[_0x8775('0x1c')]],'as':_0x42fc11['as'],'attributes':_0x42fc11[_0x8775('0x1d')],'include':_0x42fc11[_0x8775('0x1b')]?_[_0x8775('0x1e')](_0x42fc11['include'],function(_0x40feec){return{'model':db[_0x40feec[_0x8775('0x1c')]],'as':_0x40feec['as'],'attributes':_0x40feec[_0x8775('0x1d')],'include':_0x40feec[_0x8775('0x1b')]?_[_0x8775('0x1e')](_0x40feec['include'],function(_0x10058b){return{'model':db[_0x10058b['model']],'as':_0x10058b['as'],'attributes':_0x10058b[_0x8775('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8775('0xd')](function(_0x255da4){logger['info'](_0x8775('0x21'),_0x534cff);logger[_0x8775('0x1f')](_0x8775('0x21'),_0x534cff,JSON['stringify'](_0x255da4));_0x56a60f(_0x255da4);})[_0x8775('0x15')](function(_0x4cd983){logger[_0x8775('0x11')](_0x8775('0x21'),_0x4cd983['message'],_0x534cff);_0x221cec(_0x23fb22[_0x8775('0x11')](0x1f4,_0x4cd983['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 3db8eda..a74614c 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 _0xca97=['../../components/auth/service','put','/:id','update','exports','express'];(function(_0x1bc482,_0x3eb480){var _0x5c0870=function(_0x480fec){while(--_0x480fec){_0x1bc482['push'](_0x1bc482['shift']());}};_0x5c0870(++_0x3eb480);}(_0xca97,0xc5));var _0x7ca9=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xca97[_0x30ae5e];return _0x1f2e93;};'use strict';var express=require(_0x7ca9('0x0'));var router=express['Router']();var auth=require(_0x7ca9('0x1'));var controller=require('./user-setting.controller');router[_0x7ca9('0x2')](_0x7ca9('0x3'),auth['isAuthenticated'](),controller[_0x7ca9('0x4')]);module[_0x7ca9('0x5')]=router; \ No newline at end of file +var _0xe829=['Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update','exports'];(function(_0x4331c8,_0x3b04a0){var _0x25c2df=function(_0x49f77d){while(--_0x49f77d){_0x4331c8['push'](_0x4331c8['shift']());}};_0x25c2df(++_0x3b04a0);}(_0xe829,0x88));var _0x9e82=function(_0x20cf8a,_0x44cd6b){_0x20cf8a=_0x20cf8a-0x0;var _0x54e165=_0xe829[_0x20cf8a];return _0x54e165;};'use strict';var express=require('express');var router=express[_0x9e82('0x0')]();var auth=require(_0x9e82('0x1'));var controller=require(_0x9e82('0x2'));router[_0x9e82('0x3')](_0x9e82('0x4'),auth[_0x9e82('0x5')](),controller[_0x9e82('0x6')]);module[_0x9e82('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 02023c4..9151525 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 _0xa6e7=['ENUM','BOOLEAN','TEXT','UserId','error','warning','debug'];(function(_0x266e35,_0x5ed5fe){var _0x3fcc22=function(_0x2c4b11){while(--_0x2c4b11){_0x266e35['push'](_0x266e35['shift']());}};_0x3fcc22(++_0x5ed5fe);}(_0xa6e7,0x89));var _0x7a6e=function(_0x20aec2,_0x3bde52){_0x20aec2=_0x20aec2-0x0;var _0x3cf3ee=_0xa6e7[_0x20aec2];return _0x3cf3ee;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x7a6e('0x0'),_0x7a6e('0x1'),'info',_0x7a6e('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x7a6e('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x7a6e('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x7a6e('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x7a6e('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x7a6e('0x6')}}; \ No newline at end of file +var _0x854a=['DATE','sequelize','error','warning','info','debug','BOOLEAN'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x854a,0xbe));var _0xa854=function(_0x57ae31,_0x4f69f8){_0x57ae31=_0x57ae31-0x0;var _0x3eeca4=_0x854a[_0x57ae31];return _0x3eeca4;};'use strict';var Sequelize=require(_0xa854('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xa854('0x1'),_0xa854('0x2'),_0xa854('0x3'),_0xa854('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xa854('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xa854('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xa854('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'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 cb9ddff..3377d34 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 _0x9ff4=['../../mysqldb','socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','json','then','sendStatus','name','status','update','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','api','../../config/environment'];(function(_0x25fcd7,_0xb2cf68){var _0x529ac6=function(_0x3d6947){while(--_0x3d6947){_0x25fcd7['push'](_0x25fcd7['shift']());}};_0x529ac6(++_0xb2cf68);}(_0x9ff4,0x196));var _0x49ff=function(_0x42d7c3,_0x2173fa){_0x42d7c3=_0x42d7c3-0x0;var _0x3eab78=_0x9ff4[_0x42d7c3];return _0x3eab78;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require('../../config/logger')(_0x49ff('0x0'));var config=require(_0x49ff('0x1'));var db=require(_0x49ff('0x2'))['db'];var socket=require(_0x49ff('0x3'))(new Redis(config['redis']));require(_0x49ff('0x4'))[_0x49ff('0x5')](socket);config[_0x49ff('0x6')]=_[_0x49ff('0x7')](config[_0x49ff('0x6')],{'host':_0x49ff('0x8'),'port':0x18eb});function respondWithResult(_0xe967d3,_0xd87903){_0xd87903=_0xd87903||0xc8;return function(_0x50f784){if(_0x50f784){return _0xe967d3['status'](_0xd87903)[_0x49ff('0x9')](_0x50f784);}};}function saveUpdates(_0x3a9da1){return function(_0x562cd1){if(_0x562cd1){return _0x562cd1['update'](_0x3a9da1)[_0x49ff('0xa')](function(_0xad4257){return _0xad4257;});}return null;};}function handleEntityNotFound(_0x471b2c){return function(_0x178f62){if(!_0x178f62){_0x471b2c[_0x49ff('0xb')](0x194);}return _0x178f62;};}function handleError(_0x419982,_0xedd4ed){_0xedd4ed=_0xedd4ed||0x1f4;return function(_0x32c80d){logger['error'](_0x32c80d['stack']);if(_0x32c80d['name']){delete _0x32c80d[_0x49ff('0xc')];}_0x419982[_0x49ff('0xd')](_0xedd4ed)['send'](_0x32c80d);};}exports[_0x49ff('0xe')]=function(_0x5714c7,_0x5055fe){if(_0x5714c7[_0x49ff('0xf')]['role']!==_0x49ff('0x10'))throw new Error(_0x49ff('0x11'));if(isNaN(Number(_0x5714c7[_0x49ff('0x12')]['id'])))throw new Error(_0x49ff('0x13'));return db[_0x49ff('0x14')][_0x49ff('0x15')]({'where':{'id':_0x5714c7[_0x49ff('0x12')]['id']}})[_0x49ff('0xa')](handleEntityNotFound(_0x5055fe,null))['then'](saveUpdates(_0x5714c7[_0x49ff('0x16')],null))['then'](respondWithResult(_0x5055fe,null))[_0x49ff('0x17')](handleError(_0x5055fe,null));}; \ No newline at end of file +var _0xb2ef=['Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','body','then','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','status','update','name','send','user','admin'];(function(_0x515f67,_0x41daea){var _0x524c4e=function(_0x4238f5){while(--_0x4238f5){_0x515f67['push'](_0x515f67['shift']());}};_0x524c4e(++_0x41daea);}(_0xb2ef,0xa7));var _0xfb2e=function(_0x4ded68,_0x231820){_0x4ded68=_0x4ded68-0x0;var _0x432576=_0xb2ef[_0x4ded68];return _0x432576;};'use strict';var _=require(_0xfb2e('0x0'));var Redis=require(_0xfb2e('0x1'));var logger=require(_0xfb2e('0x2'))('api');var config=require(_0xfb2e('0x3'));var db=require(_0xfb2e('0x4'))['db'];var socket=require(_0xfb2e('0x5'))(new Redis(config['redis']));require(_0xfb2e('0x6'))[_0xfb2e('0x7')](socket);config[_0xfb2e('0x8')]=_[_0xfb2e('0x9')](config[_0xfb2e('0x8')],{'host':_0xfb2e('0xa'),'port':0x18eb});function respondWithResult(_0x1fb22e,_0x72054c){_0x72054c=_0x72054c||0xc8;return function(_0x1d0a05){if(_0x1d0a05){return _0x1fb22e[_0xfb2e('0xb')](_0x72054c)['json'](_0x1d0a05);}};}function saveUpdates(_0x41cea9){return function(_0x46d60c){if(_0x46d60c){return _0x46d60c[_0xfb2e('0xc')](_0x41cea9)['then'](function(_0x58cc41){return _0x58cc41;});}return null;};}function handleEntityNotFound(_0x3636d9){return function(_0x2dd730){if(!_0x2dd730){_0x3636d9['sendStatus'](0x194);}return _0x2dd730;};}function handleError(_0x411dbd,_0x103f95){_0x103f95=_0x103f95||0x1f4;return function(_0x56a773){logger['error'](_0x56a773['stack']);if(_0x56a773[_0xfb2e('0xd')]){delete _0x56a773['name'];}_0x411dbd[_0xfb2e('0xb')](_0x103f95)[_0xfb2e('0xe')](_0x56a773);};}exports[_0xfb2e('0xc')]=function(_0x3ddf89,_0x3ffa17){if(_0x3ddf89[_0xfb2e('0xf')]['role']!==_0xfb2e('0x10'))throw new Error(_0xfb2e('0x11'));if(isNaN(Number(_0x3ddf89[_0xfb2e('0x12')]['id'])))throw new Error(_0xfb2e('0x13'));return db[_0xfb2e('0x14')]['find']({'where':{'id':_0x3ddf89['params']['id']}})['then'](handleEntityNotFound(_0x3ffa17,null))['then'](saveUpdates(_0x3ddf89[_0xfb2e('0x15')],null))[_0xfb2e('0x16')](respondWithResult(_0x3ffa17,null))['catch'](handleError(_0x3ffa17,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 06282e8..f23764e 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 _0x56f9=['emit','hasOwnProperty','hook','events','../../mysqldb','UserSetting','setMaxListeners','save','update','remove'];(function(_0x58f245,_0x3e4f31){var _0x1f0cfb=function(_0x515942){while(--_0x515942){_0x58f245['push'](_0x58f245['shift']());}};_0x1f0cfb(++_0x3e4f31);}(_0x56f9,0x125));var _0x956f=function(_0xcabc86,_0x16d071){_0xcabc86=_0xcabc86-0x0;var _0x3f2250=_0x56f9[_0xcabc86];return _0x3f2250;};'use strict';var EventEmitter=require(_0x956f('0x0'));var UserSetting=require(_0x956f('0x1'))['db'][_0x956f('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x956f('0x3')](0x0);var events={'afterCreate':_0x956f('0x4'),'afterUpdate':_0x956f('0x5'),'afterDestroy':_0x956f('0x6')};function emitEvent(_0x13e98d){return function(_0x1d0512,_0x22e567,_0xecf517){UserSettingEvents[_0x956f('0x7')](_0x13e98d+':'+_0x1d0512['id'],_0x1d0512);UserSettingEvents[_0x956f('0x7')](_0x13e98d,_0x1d0512);_0xecf517(null);};}for(var e in events){if(events[_0x956f('0x8')](e)){var event=events[e];UserSetting[_0x956f('0x9')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xa7de=['events','../../mysqldb','UserSetting','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x1ccbb6,_0x31503a){var _0x25f91b=function(_0x18fe3d){while(--_0x18fe3d){_0x1ccbb6['push'](_0x1ccbb6['shift']());}};_0x25f91b(++_0x31503a);}(_0xa7de,0x1c2));var _0xea7d=function(_0x2b498b,_0x5e8269){_0x2b498b=_0x2b498b-0x0;var _0x23d92e=_0xa7de[_0x2b498b];return _0x23d92e;};'use strict';var EventEmitter=require(_0xea7d('0x0'));var UserSetting=require(_0xea7d('0x1'))['db'][_0xea7d('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xea7d('0x3'),'afterUpdate':_0xea7d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x394ef8){return function(_0x20d3e7,_0x2a9a77,_0xe06951){UserSettingEvents[_0xea7d('0x5')](_0x394ef8+':'+_0x20d3e7['id'],_0x20d3e7);UserSettingEvents[_0xea7d('0x5')](_0x394ef8,_0x20d3e7);_0xe06951(null);};}for(var e in events){if(events[_0xea7d('0x6')](e)){var event=events[e];UserSetting[_0xea7d('0x7')](e,emitEvent(event));}}module[_0xea7d('0x8')]=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 0e7ba3d..216ae64 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 _0x25c2=['clientSideLoggingEnabledSince','./user-setting.attributes','define','user_settings'];(function(_0x444389,_0x3a0cb5){var _0x4d9865=function(_0x4bd7e6){while(--_0x4bd7e6){_0x444389['push'](_0x444389['shift']());}};_0x4d9865(++_0x3a0cb5);}(_0x25c2,0xdd));var _0x225c=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0x25c2[_0x3afe18];return _0x19ed1f;};'use strict';var attributes=require(_0x225c('0x0'));module['exports']=function(_0xbe7f12){return _0xbe7f12[_0x225c('0x1')]('UserSetting',attributes,{'tableName':_0x225c('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x20e09f){if(!_0x20e09f['clientSideLoggingEnabled'])_0x20e09f[_0x225c('0x3')]=null;else if(_0x20e09f[_0x225c('0x3')]===null)_0x20e09f['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x7fce=['./user-setting.attributes','exports','UserSetting','clientSideLoggingEnabledSince'];(function(_0x56023f,_0x184eb7){var _0xe67842=function(_0x489e05){while(--_0x489e05){_0x56023f['push'](_0x56023f['shift']());}};_0xe67842(++_0x184eb7);}(_0x7fce,0xdc));var _0xe7fc=function(_0x3fa85a,_0xc5b810){_0x3fa85a=_0x3fa85a-0x0;var _0x445091=_0x7fce[_0x3fa85a];return _0x445091;};'use strict';var attributes=require(_0xe7fc('0x0'));module[_0xe7fc('0x1')]=function(_0x3e4a6e){return _0x3e4a6e['define'](_0xe7fc('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a16f3){if(!_0x2a16f3['clientSideLoggingEnabled'])_0x2a16f3[_0xe7fc('0x3')]=null;else if(_0x2a16f3[_0xe7fc('0x3')]===null)_0x2a16f3['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 a9e2cf6..9e62e2a 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 _0xc71f=['remove','update','emit','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save'];(function(_0xaf8875,_0x39b330){var _0x396353=function(_0x3a4329){while(--_0x3a4329){_0xaf8875['push'](_0xaf8875['shift']());}};_0x396353(++_0x39b330);}(_0xc71f,0xb2));var _0xfc71=function(_0x57e212,_0xb2da96){_0x57e212=_0x57e212-0x0;var _0x1e9cf7=_0xc71f[_0x57e212];return _0x1e9cf7;};'use strict';var UserSettingEvents=require(_0xfc71('0x0'));var events=[_0xfc71('0x1'),_0xfc71('0x2'),_0xfc71('0x3')];function createListener(_0xd72dda,_0x279abf){return function(_0x151adb){_0x279abf[_0xfc71('0x4')](_0xd72dda,_0x151adb);if(_0xd72dda==='user-setting:update'){_0x279abf[_0xfc71('0x4')](_0xfc71('0x5')+_0x151adb[_0xfc71('0x6')],_0x151adb);}};}exports[_0xfc71('0x7')]=function(_0x5e138d){for(var _0x15f902=0x0,_0x121abb=events[_0xfc71('0x8')];_0x15f902<_0x121abb;_0x15f902++){var _0x139c16=events[_0x15f902];var _0xbcb2db=createListener(_0xfc71('0x9')+_0x139c16,_0x5e138d);UserSettingEvents['on'](_0x139c16,_0xbcb2db);}}; \ No newline at end of file +var _0x6d8b=['user-setting:update:user-','UserId','register','length','./user-setting.events','save','remove','update','emit'];(function(_0x526770,_0x3da843){var _0x120f0e=function(_0x2737c8){while(--_0x2737c8){_0x526770['push'](_0x526770['shift']());}};_0x120f0e(++_0x3da843);}(_0x6d8b,0xd3));var _0xb6d8=function(_0x1629eb,_0x305130){_0x1629eb=_0x1629eb-0x0;var _0x230f76=_0x6d8b[_0x1629eb];return _0x230f76;};'use strict';var UserSettingEvents=require(_0xb6d8('0x0'));var events=[_0xb6d8('0x1'),_0xb6d8('0x2'),_0xb6d8('0x3')];function createListener(_0x316bf0,_0x3adb31){return function(_0xd6443d){_0x3adb31['emit'](_0x316bf0,_0xd6443d);if(_0x316bf0==='user-setting:update'){_0x3adb31[_0xb6d8('0x4')](_0xb6d8('0x5')+_0xd6443d[_0xb6d8('0x6')],_0xd6443d);}};}exports[_0xb6d8('0x7')]=function(_0x25acda){for(var _0x291107=0x0,_0x2d7bf1=events[_0xb6d8('0x8')];_0x291107<_0x2d7bf1;_0x291107++){var _0x1b28f2=events[_0x291107];var _0x126565=createListener('user-setting:'+_0x1b28f2,_0x25acda);UserSettingEvents['on'](_0x1b28f2,_0x126565);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index bfd9c05..124e928 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 _0x1c63=['delete','/:id/teams','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeWhatsappInteractions','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','/whoami','/presence','getPresence','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','getWhatsappInteractions','getTeams','/:id/lists','/:id/prefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','single','file','addAvatar','/:id/login','login','logout','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','/:id/chat_websites','createApiKey','put','/:id','update','/:id/password','changePassword'];(function(_0x4e7dde,_0x3c33a8){var _0x651ef7=function(_0x15637d){while(--_0x15637d){_0x4e7dde['push'](_0x4e7dde['shift']());}};_0x651ef7(++_0x3c33a8);}(_0x1c63,0xdc));var _0x31c6=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0x1c63[_0x56740a];return _0x257144;};'use strict';var multer=require(_0x31c6('0x0'));var util=require(_0x31c6('0x1'));var path=require(_0x31c6('0x2'));var timeout=require(_0x31c6('0x3'));var express=require('express');var router=express[_0x31c6('0x4')]();var fs_extra=require(_0x31c6('0x5'));var auth=require(_0x31c6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x31c6('0x7'));var controller=require(_0x31c6('0x8'));router[_0x31c6('0x9')]('/',auth[_0x31c6('0xa')](),controller[_0x31c6('0xb')]);router['get']('/describe',auth[_0x31c6('0xa')](),controller[_0x31c6('0xc')]);router[_0x31c6('0x9')](_0x31c6('0xd'),auth[_0x31c6('0xa')](),controller['whoami']);router[_0x31c6('0x9')](_0x31c6('0xe'),auth[_0x31c6('0xa')](),controller[_0x31c6('0xf')]);router[_0x31c6('0x9')]('/:id',auth[_0x31c6('0xa')](),controller['show']);router[_0x31c6('0x9')](_0x31c6('0x10'),controller['getAvatar']);router[_0x31c6('0x9')](_0x31c6('0x11'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x12')]);router[_0x31c6('0x9')](_0x31c6('0x13'),auth['isAuthenticated'](),controller[_0x31c6('0x14')]);router[_0x31c6('0x9')](_0x31c6('0x15'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x16')]);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x31c6('0x9')]('/:id/groups',auth[_0x31c6('0xa')](),controller[_0x31c6('0x17')]);router[_0x31c6('0x9')](_0x31c6('0x18'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x19')]);router[_0x31c6('0x9')](_0x31c6('0x1a'),auth['isAuthenticated'](),controller['getScreenRecordings']);router['get'](_0x31c6('0x1b'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x1c')]);router[_0x31c6('0x9')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x31c6('0x1d')]);router[_0x31c6('0x9')]('/:id/mail/interactions',auth[_0x31c6('0xa')](),controller[_0x31c6('0x1e')]);router[_0x31c6('0x9')](_0x31c6('0x1f'),auth[_0x31c6('0xa')](),controller['getSmsInteractions']);router[_0x31c6('0x9')]('/:id/fax/interactions',auth[_0x31c6('0xa')](),controller[_0x31c6('0x20')]);router['get']('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0x31c6('0x21')]);router[_0x31c6('0x9')]('/:id/teams',auth[_0x31c6('0xa')](),controller[_0x31c6('0x22')]);router[_0x31c6('0x9')](_0x31c6('0x23'),auth['isAuthenticated'](),controller['getLists']);router['get']('/:id/agents',auth[_0x31c6('0xa')](),controller['getAgents']);router['get'](_0x31c6('0x24'),auth[_0x31c6('0xa')](),controller['getVoicePrefixes']);router[_0x31c6('0x9')]('/:id/fax_accounts',auth[_0x31c6('0xa')](),controller[_0x31c6('0x25')]);router['get'](_0x31c6('0x26'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x27')]);router[_0x31c6('0x9')](_0x31c6('0x28'),auth[_0x31c6('0xa')](),controller['getOpenchannelAccounts']);router[_0x31c6('0x9')](_0x31c6('0x29'),auth['isAuthenticated'](),controller[_0x31c6('0x2a')]);router[_0x31c6('0x9')]('/:id/chat_websites',auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x31c6('0x9')](_0x31c6('0x2b'),auth['isAuthenticated'](),controller[_0x31c6('0x2c')]);router[_0x31c6('0x9')](_0x31c6('0x2d'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x2e')]);router['get'](_0x31c6('0x2f'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x30')]);router[_0x31c6('0x31')](_0x31c6('0x13'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x32')]);router[_0x31c6('0x31')]('/',auth[_0x31c6('0xa')](),controller['create']);router[_0x31c6('0x31')](_0x31c6('0x33'),auth['isAuthenticated'](),controller[_0x31c6('0x34')]);router[_0x31c6('0x31')]('/:id/queues',auth[_0x31c6('0xa')](),controller[_0x31c6('0x35')]);var upload=multer({'storage':multer[_0x31c6('0x36')]({'destination':function(_0x577288,_0x426649,_0x56b2d2){_0x56b2d2(null,path[_0x31c6('0x37')](config[_0x31c6('0x38')],_0x31c6('0x39')));},'filename':function(_0x532399,_0x23c9ba,_0x14be10){_0x14be10(null,util[_0x31c6('0x3a')](_0x31c6('0x3b'),Date['now'](),_0x23c9ba['originalname']));}})});router[_0x31c6('0x31')](_0x31c6('0x10'),upload[_0x31c6('0x3c')](_0x31c6('0x3d')),controller[_0x31c6('0x3e')]);router[_0x31c6('0x31')](_0x31c6('0x3f'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x40')]);router[_0x31c6('0x31')]('/:id/logout',auth[_0x31c6('0xa')](),controller[_0x31c6('0x41')]);router['post']('/:id/pause',auth[_0x31c6('0xa')](),controller[_0x31c6('0x42')]);router[_0x31c6('0x31')](_0x31c6('0x43'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x44')]);router['post']('/:id/teams',auth[_0x31c6('0xa')](),controller['addTeams']);router[_0x31c6('0x31')](_0x31c6('0x45'),auth['isAuthenticated'](),controller[_0x31c6('0x46')]);router[_0x31c6('0x31')](_0x31c6('0x47'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x48')]);router[_0x31c6('0x31')]('/:id/fax_interactions',auth[_0x31c6('0xa')](),controller[_0x31c6('0x49')]);router[_0x31c6('0x31')](_0x31c6('0x4a'),auth[_0x31c6('0xa')](),controller['addSmsInteractions']);router[_0x31c6('0x31')](_0x31c6('0x4b'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x4c')]);router['post'](_0x31c6('0x4d'),auth['isAuthenticated'](),controller[_0x31c6('0x4e')]);router[_0x31c6('0x31')](_0x31c6('0x4f'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x50')]);router['post'](_0x31c6('0x26'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x51')]);router[_0x31c6('0x31')](_0x31c6('0x28'),auth[_0x31c6('0xa')](),controller['addOpenchannelAccounts']);router[_0x31c6('0x31')]('/:id/sms_accounts',auth[_0x31c6('0xa')](),controller['addSmsAccounts']);router['post'](_0x31c6('0x52'),auth[_0x31c6('0xa')](),controller['addChatWebsites']);router[_0x31c6('0x31')](_0x31c6('0x2b'),auth[_0x31c6('0xa')](),controller['addWhatsappAccounts']);router['post'](_0x31c6('0x2f'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x53')]);router[_0x31c6('0x54')](_0x31c6('0x55'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x56')]);router[_0x31c6('0x54')](_0x31c6('0x57'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x58')]);router[_0x31c6('0x59')]('/:id/queues',auth['isAuthenticated'](),controller['removeQueues']);router[_0x31c6('0x59')](_0x31c6('0x5a'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x5b')]);router[_0x31c6('0x59')](_0x31c6('0x55'),auth[_0x31c6('0xa')](),controller['destroy']);router['delete'](_0x31c6('0x45'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x5c')]);router[_0x31c6('0x59')]('/:id/mail_interactions',auth[_0x31c6('0xa')](),controller[_0x31c6('0x5d')]);router['delete']('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x31c6('0x5e')]);router[_0x31c6('0x59')](_0x31c6('0x4a'),auth[_0x31c6('0xa')](),controller['removeSmsInteractions']);router['delete'](_0x31c6('0x4b'),auth[_0x31c6('0xa')](),controller['removeOpenchannelInteractions']);router['delete'](_0x31c6('0x4d'),auth['isAuthenticated'](),controller[_0x31c6('0x5f')]);router[_0x31c6('0x59')](_0x31c6('0x4f'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router['delete']('/:id/mail_accounts',auth[_0x31c6('0xa')](),controller['removeMailAccounts']);router[_0x31c6('0x59')](_0x31c6('0x28'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x60')]);router['delete'](_0x31c6('0x29'),auth['isAuthenticated'](),controller[_0x31c6('0x61')]);router['delete'](_0x31c6('0x52'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x62')]);router['delete'](_0x31c6('0x2b'),auth[_0x31c6('0xa')](),controller[_0x31c6('0x63')]);router[_0x31c6('0x59')](_0x31c6('0x2f'),auth['isAuthenticated'](),controller[_0x31c6('0x64')]);router[_0x31c6('0x31')]('/:id/messengerSoundNotification',auth['isAuthenticated'](),controller[_0x31c6('0x65')]);module[_0x31c6('0x66')]=router; \ No newline at end of file +var _0x233c=['./user.controller','get','index','/describe','describe','isAuthenticated','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many','diskStorage','join','root','server/files/images/','format','now','single','file','/:id/logout','logout','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addMailAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','put','/:id','update','/:id/password','changePassword','delete','removeQueues','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeOpenchannelAccounts','removeChatWebsites','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x233c,0x1b8));var _0xc233=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0x233c[_0x4843f9];return _0x193c6a;};'use strict';var multer=require(_0xc233('0x0'));var util=require('util');var path=require(_0xc233('0x1'));var timeout=require(_0xc233('0x2'));var express=require(_0xc233('0x3'));var router=express[_0xc233('0x4')]();var fs_extra=require(_0xc233('0x5'));var auth=require(_0xc233('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc233('0x7'));var controller=require(_0xc233('0x8'));router[_0xc233('0x9')]('/',auth['isAuthenticated'](),controller[_0xc233('0xa')]);router[_0xc233('0x9')](_0xc233('0xb'),auth['isAuthenticated'](),controller[_0xc233('0xc')]);router[_0xc233('0x9')]('/whoami',auth[_0xc233('0xd')](),controller[_0xc233('0xe')]);router[_0xc233('0x9')](_0xc233('0xf'),auth[_0xc233('0xd')](),controller[_0xc233('0x10')]);router[_0xc233('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc233('0x11')]);router[_0xc233('0x9')](_0xc233('0x12'),controller[_0xc233('0x13')]);router['get']('/:id/open_tabs',auth[_0xc233('0xd')](),controller[_0xc233('0x14')]);router['get'](_0xc233('0x15'),auth[_0xc233('0xd')](),controller[_0xc233('0x16')]);router[_0xc233('0x9')]('/:id/queues',auth[_0xc233('0xd')](),controller[_0xc233('0x17')]);router['get'](_0xc233('0x18'),auth[_0xc233('0xd')](),controller[_0xc233('0x19')]);router[_0xc233('0x9')]('/:id/groups',auth[_0xc233('0xd')](),controller[_0xc233('0x1a')]);router['get'](_0xc233('0x1b'),auth[_0xc233('0xd')](),controller['getRecordings']);router['get'](_0xc233('0x1c'),auth[_0xc233('0xd')](),controller[_0xc233('0x1d')]);router[_0xc233('0x9')](_0xc233('0x1e'),auth[_0xc233('0xd')](),controller[_0xc233('0x1f')]);router[_0xc233('0x9')](_0xc233('0x20'),auth[_0xc233('0xd')](),controller[_0xc233('0x21')]);router[_0xc233('0x9')](_0xc233('0x22'),auth[_0xc233('0xd')](),controller[_0xc233('0x23')]);router['get']('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0xc233('0x24')]);router[_0xc233('0x9')]('/:id/fax/interactions',auth[_0xc233('0xd')](),controller[_0xc233('0x25')]);router['get'](_0xc233('0x26'),auth['isAuthenticated'](),controller[_0xc233('0x27')]);router[_0xc233('0x9')](_0xc233('0x28'),auth[_0xc233('0xd')](),controller[_0xc233('0x29')]);router['get']('/:id/lists',auth[_0xc233('0xd')](),controller['getLists']);router[_0xc233('0x9')](_0xc233('0x2a'),auth[_0xc233('0xd')](),controller[_0xc233('0x2b')]);router['get'](_0xc233('0x2c'),auth[_0xc233('0xd')](),controller[_0xc233('0x2d')]);router['get'](_0xc233('0x2e'),auth[_0xc233('0xd')](),controller[_0xc233('0x2f')]);router[_0xc233('0x9')](_0xc233('0x30'),auth['isAuthenticated'](),controller[_0xc233('0x31')]);router['get'](_0xc233('0x32'),auth[_0xc233('0xd')](),controller['getOpenchannelAccounts']);router[_0xc233('0x9')](_0xc233('0x33'),auth[_0xc233('0xd')](),controller[_0xc233('0x34')]);router[_0xc233('0x9')](_0xc233('0x35'),auth[_0xc233('0xd')](),controller[_0xc233('0x36')]);router[_0xc233('0x9')](_0xc233('0x37'),auth['isAuthenticated'](),controller[_0xc233('0x38')]);router[_0xc233('0x9')](_0xc233('0x39'),auth[_0xc233('0xd')](),controller[_0xc233('0x3a')]);router[_0xc233('0x9')](_0xc233('0x3b'),auth[_0xc233('0xd')](),controller[_0xc233('0x3c')]);router[_0xc233('0x3d')](_0xc233('0x15'),auth['isAuthenticated'](),controller['addContacts']);router[_0xc233('0x3d')]('/',auth[_0xc233('0xd')](),controller['create']);router['post'](_0xc233('0x3e'),auth[_0xc233('0xd')](),controller['bulkCreate']);router['post']('/:id/queues',auth[_0xc233('0xd')](),controller['addQueues']);var upload=multer({'storage':multer[_0xc233('0x3f')]({'destination':function(_0x15bbcd,_0x3e1326,_0x357642){_0x357642(null,path[_0xc233('0x40')](config[_0xc233('0x41')],_0xc233('0x42')));},'filename':function(_0x123ce2,_0x3d2091,_0x695875){_0x695875(null,util[_0xc233('0x43')]('%s-%s',Date[_0xc233('0x44')](),_0x3d2091['originalname']));}})});router['post'](_0xc233('0x12'),upload[_0xc233('0x45')](_0xc233('0x46')),controller['addAvatar']);router[_0xc233('0x3d')]('/:id/login',auth[_0xc233('0xd')](),controller['login']);router[_0xc233('0x3d')](_0xc233('0x47'),auth['isAuthenticated'](),controller[_0xc233('0x48')]);router[_0xc233('0x3d')]('/:id/pause',auth[_0xc233('0xd')](),controller[_0xc233('0x49')]);router[_0xc233('0x3d')](_0xc233('0x4a'),auth[_0xc233('0xd')](),controller[_0xc233('0x4b')]);router[_0xc233('0x3d')](_0xc233('0x28'),auth[_0xc233('0xd')](),controller[_0xc233('0x4c')]);router[_0xc233('0x3d')](_0xc233('0x4d'),auth[_0xc233('0xd')](),controller[_0xc233('0x4e')]);router[_0xc233('0x3d')](_0xc233('0x4f'),auth[_0xc233('0xd')](),controller[_0xc233('0x50')]);router[_0xc233('0x3d')](_0xc233('0x51'),auth[_0xc233('0xd')](),controller[_0xc233('0x52')]);router[_0xc233('0x3d')](_0xc233('0x53'),auth[_0xc233('0xd')](),controller[_0xc233('0x54')]);router[_0xc233('0x3d')](_0xc233('0x55'),auth[_0xc233('0xd')](),controller[_0xc233('0x56')]);router[_0xc233('0x3d')]('/:id/whatsapp_interactions',auth[_0xc233('0xd')](),controller[_0xc233('0x57')]);router['post'](_0xc233('0x2e'),auth[_0xc233('0xd')](),controller['addFaxAccounts']);router[_0xc233('0x3d')](_0xc233('0x30'),auth[_0xc233('0xd')](),controller[_0xc233('0x58')]);router['post'](_0xc233('0x32'),auth[_0xc233('0xd')](),controller['addOpenchannelAccounts']);router[_0xc233('0x3d')](_0xc233('0x33'),auth[_0xc233('0xd')](),controller[_0xc233('0x59')]);router['post'](_0xc233('0x35'),auth[_0xc233('0xd')](),controller[_0xc233('0x5a')]);router[_0xc233('0x3d')](_0xc233('0x37'),auth[_0xc233('0xd')](),controller[_0xc233('0x5b')]);router['post'](_0xc233('0x3b'),auth[_0xc233('0xd')](),controller['createApiKey']);router[_0xc233('0x5c')](_0xc233('0x5d'),auth[_0xc233('0xd')](),controller[_0xc233('0x5e')]);router[_0xc233('0x5c')](_0xc233('0x5f'),auth[_0xc233('0xd')](),controller[_0xc233('0x60')]);router[_0xc233('0x61')]('/:id/queues',auth['isAuthenticated'](),controller[_0xc233('0x62')]);router[_0xc233('0x61')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0xc233('0x61')](_0xc233('0x5d'),auth[_0xc233('0xd')](),controller[_0xc233('0x63')]);router[_0xc233('0x61')](_0xc233('0x4d'),auth[_0xc233('0xd')](),controller[_0xc233('0x64')]);router[_0xc233('0x61')](_0xc233('0x4f'),auth[_0xc233('0xd')](),controller[_0xc233('0x65')]);router[_0xc233('0x61')]('/:id/fax_interactions',auth[_0xc233('0xd')](),controller[_0xc233('0x66')]);router['delete'](_0xc233('0x53'),auth[_0xc233('0xd')](),controller[_0xc233('0x67')]);router[_0xc233('0x61')](_0xc233('0x55'),auth[_0xc233('0xd')](),controller[_0xc233('0x68')]);router[_0xc233('0x61')](_0xc233('0x69'),auth[_0xc233('0xd')](),controller['removeWhatsappInteractions']);router['delete'](_0xc233('0x2e'),auth['isAuthenticated'](),controller[_0xc233('0x6a')]);router['delete'](_0xc233('0x30'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0xc233('0x61')](_0xc233('0x32'),auth[_0xc233('0xd')](),controller[_0xc233('0x6b')]);router[_0xc233('0x61')](_0xc233('0x33'),auth['isAuthenticated'](),controller['removeSmsAccounts']);router['delete'](_0xc233('0x35'),auth[_0xc233('0xd')](),controller[_0xc233('0x6c')]);router[_0xc233('0x61')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0xc233('0x61')](_0xc233('0x3b'),auth['isAuthenticated'](),controller[_0xc233('0x6d')]);router['post'](_0xc233('0x6e'),auth[_0xc233('0xd')](),controller[_0xc233('0x6f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index dd0701a..023f380 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 _0x4bf2=['allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','active','actpass','TEXT','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','avpf','dtlsenable','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','agent','INTEGER','accountcode','format','getDataValue','BOOLEAN','DATE','dynamic','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','nonat','update','outgoing','yes','force_rport,comedia','nat','join','split','all','ulaw;alaw;gsm'];(function(_0x11755f,_0x491483){var _0x354667=function(_0x168ee6){while(--_0x168ee6){_0x11755f['push'](_0x11755f['shift']());}};_0x354667(++_0x491483);}(_0x4bf2,0x1d9));var _0x24bf=function(_0x3c1bc0,_0x2597ac){_0x3c1bc0=_0x3c1bc0-0x0;var _0x5c41be=_0x4bf2[_0x3c1bc0];return _0x5c41be;};'use strict';var Sequelize=require(_0x24bf('0x0'));var moment=require('moment');var util=require(_0x24bf('0x1'));var _=require(_0x24bf('0x2'));module[_0x24bf('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x24bf('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x40f6e0){this[_0x24bf('0x5')](_0x24bf('0x4'),_0x40f6e0);this[_0x24bf('0x5')](_0x24bf('0x6'),_0x40f6e0);},'comment':_0x24bf('0x7')},'fullname':{'type':Sequelize[_0x24bf('0x8')],'allowNull':![],'set':function(_0x21b8f6){this[_0x24bf('0x5')](_0x24bf('0x9'),_0x21b8f6);this[_0x24bf('0x5')](_0x24bf('0xa'),util['format'](_0x24bf('0xb'),_0x21b8f6,this['getDataValue'](_0x24bf('0xc'))));}},'alias':{'type':Sequelize[_0x24bf('0x8')]},'email':{'type':Sequelize[_0x24bf('0x8')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x4d4fe7){if(_0x4d4fe7){this[_0x24bf('0x5')](_0x24bf('0xd'),_0x4d4fe7[_0x24bf('0xe')]());}}},'role':{'type':Sequelize[_0x24bf('0xf')]('admin','user',_0x24bf('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x24bf('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x24bf('0x11')](0xb),'allowNull':![],'unique':_0x24bf('0xc'),'set':function(_0x40780c){this['setDataValue']('internal',_0x40780c);this[_0x24bf('0x5')](_0x24bf('0x12'),_0x40780c);this[_0x24bf('0x5')](_0x24bf('0xa'),util[_0x24bf('0x13')](_0x24bf('0xb'),this[_0x24bf('0x14')](_0x24bf('0x9')),_0x40780c));}},'salt':{'type':Sequelize[_0x24bf('0x8')]},'phone':{'type':Sequelize[_0x24bf('0x8')]},'mobile':{'type':Sequelize[_0x24bf('0x8')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x24bf('0x8')]},'userpic':{'type':Sequelize[_0x24bf('0x8')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x24bf('0x8')]},'online':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x24bf('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x24bf('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x24bf('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x24bf('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x24bf('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x24bf('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x24bf('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x24bf('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x24bf('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'host':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![],'defaultValue':_0x24bf('0x17')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x24bf('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x24bf('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x24bf('0x18'),_0x24bf('0x19'),_0x24bf('0x1a')),'allowNull':!![],'defaultValue':_0x24bf('0x18')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x1b'),'ALLOWED_PASSED_SCREEN',_0x24bf('0x1c'),_0x24bf('0x1d'),_0x24bf('0x1e'),'PROHIB_PASSED_SCREEN',_0x24bf('0x1f'),_0x24bf('0x20')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'secret':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x24bf('0x21'),'set':function(_0x49de3c){this['setDataValue'](_0x24bf('0x22'),_0x49de3c?_0x49de3c['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x24bf('0x14')](_0x24bf('0x22'))['split'](','):null;},'comment':_0x24bf('0x23')},'dtmfmode':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x24'),_0x24bf('0x25'),'shortinfo',_0x24bf('0x26'),'auto'),'allowNull':!![],'defaultValue':_0x24bf('0x24')},'directmedia':{'type':Sequelize[_0x24bf('0xf')]('yes','no',_0x24bf('0x27'),_0x24bf('0x28'),_0x24bf('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x24bf('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'nat':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![],'defaultValue':_0x24bf('0x2b'),'set':function(_0x117945){this[_0x24bf('0x5')](_0x24bf('0x2c'),_0x117945?_0x117945[_0x24bf('0x2d')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x24bf('0x14')](_0x24bf('0x2c'))[_0x24bf('0x2e')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x24bf('0x8')]},'namedcallgroup':{'type':Sequelize[_0x24bf('0x8')]},'pickupgroup':{'type':Sequelize[_0x24bf('0x8')]},'namedpickupgroup':{'type':Sequelize[_0x24bf('0x8')]},'language':{'type':Sequelize[_0x24bf('0x8')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x24bf('0x8')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x24bf('0x2f')},'allow':{'type':Sequelize[_0x24bf('0x8')],'allowNull':![],'defaultValue':_0x24bf('0x30'),'set':function(_0x36d942){this['setDataValue']('allow',_0x36d942?_0x36d942[_0x24bf('0x2d')](';'):_0x24bf('0x30'));},'get':function(){return this[_0x24bf('0x14')](_0x24bf('0x31'))?this[_0x24bf('0x14')](_0x24bf('0x31'))['split'](';'):null;},'comment':_0x24bf('0x32')},'autoframing':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![],'set':function(_0x7a32b1){this[_0x24bf('0x5')](_0x24bf('0x33'),_0x7a32b1?_0x7a32b1[_0x24bf('0x2d')](','):null);},'get':function(){return this[_0x24bf('0x14')](_0x24bf('0x33'))?this['getDataValue']('insecure')[_0x24bf('0x2e')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x2a'),'no',_0x24bf('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x24bf('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x24bf('0x35')},'amaflags':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x2a'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x24bf('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'template':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x24bf('0x2a'),'no',_0x24bf('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x24bf('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x24bf('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x24bf('0x37'),_0x24bf('0x38'),_0x24bf('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x24bf('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x24bf('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac','uas'),'allowNull':!![],'defaultValue':_0x24bf('0x3a')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x24bf('0x2a')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x24bf('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x24bf('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x24bf('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x24bf('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x24bf('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x24bf('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x24bf('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x24bf('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x24bf('0xf')]('yes','no',_0x24bf('0x3b'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x24bf('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x3c'),'passive',_0x24bf('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x24bf('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x24bf('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x24bf('0xf')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x24bf('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x2a'),'no',_0x24bf('0x27'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x24bf('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x24bf('0x3e')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x5269be){this['setDataValue'](_0x24bf('0x3f'),_0x5269be);var _0x3fc0ac=this[_0x24bf('0x40')]({'plain':!![]});switch(_0x5269be){case 0x0:case 0x1:var _0x46a382=_0x3fc0ac[_0x24bf('0x22')]?_[_0x24bf('0x41')](_0x3fc0ac[_0x24bf('0x22')])?_0x3fc0ac['transport']['join']():_0x3fc0ac['transport']:'udp';if(_0x46a382===_0x24bf('0x42')){_0x46a382=_0x24bf('0x21');}this[_0x24bf('0x5')](_0x24bf('0x22'),_0x46a382);this['setDataValue'](_0x24bf('0x43'),'no');this[_0x24bf('0x5')]('avpf',null);this['setDataValue'](_0x24bf('0x44'),null);this[_0x24bf('0x5')](_0x24bf('0x45'),null);this[_0x24bf('0x5')]('dtlsenable',null);this[_0x24bf('0x5')](_0x24bf('0x46'),null);this['setDataValue'](_0x24bf('0x47'),null);this[_0x24bf('0x5')](_0x24bf('0x48'),null);this[_0x24bf('0x5')]('dtlsprivatekey',null);this[_0x24bf('0x5')]('rtcp_mux','no');break;case 0x2:this[_0x24bf('0x5')](_0x24bf('0x22'),'wss');this[_0x24bf('0x5')](_0x24bf('0x43'),_0x24bf('0x2a'));this[_0x24bf('0x5')](_0x24bf('0x49'),_0x24bf('0x2a'));this[_0x24bf('0x5')]('force_avp','yes');this[_0x24bf('0x5')](_0x24bf('0x45'),_0x24bf('0x2a'));this[_0x24bf('0x5')](_0x24bf('0x4a'),_0x24bf('0x2a'));this['setDataValue'](_0x24bf('0x46'),'no');this[_0x24bf('0x5')](_0x24bf('0x47'),_0x24bf('0x3d'));this[_0x24bf('0x5')](_0x24bf('0x48'),_0x3fc0ac['dtlscertfile']||_0x24bf('0x4b'));this[_0x24bf('0x5')](_0x24bf('0x4c'),_0x3fc0ac[_0x24bf('0x4c')]||_0x24bf('0x4d'));this[_0x24bf('0x5')](_0x24bf('0x4e'),_0x24bf('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0x24bf('0x3e')],'set':function(_0x1b550f){this[_0x24bf('0x5')](_0x24bf('0x4f'),_0x1b550f?_0x1b550f[_0x24bf('0x2d')](','):[]);},'get':function(){return this[_0x24bf('0x14')]('permissions')?_[_0x24bf('0x50')](this[_0x24bf('0x14')](_0x24bf('0x4f'))['split'](','),function(_0x3e403e){return parseInt(_0x3e403e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x24bf('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x24bf('0x8')]},'phoneBarBusyNumber':{'type':Sequelize[_0x24bf('0x8')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x24bf('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x24bf('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x24bf('0xf')](_0x24bf('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x24bf('0x8')]},'phoneBarEnableJaws':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x24bf('0x14')](_0x24bf('0x51'))?this['getDataValue'](_0x24bf('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![],'set':function(_0x18ee94){if(typeof _0x18ee94===_0x24bf('0x52')){var _0x41ba2e=_0x18ee94==='1'?!![]:_0x18ee94==='0'?![]:_0x18ee94===_0x24bf('0x53')?!![]:_0x18ee94===_0x24bf('0x54')?![]:![];this[_0x24bf('0x5')](_0x24bf('0x55'),_0x41ba2e);}else{this[_0x24bf('0x5')](_0x24bf('0x55'),_0x18ee94);}}},'blocked':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![],'set':function(_0xdb04eb){this[_0x24bf('0x5')]('blocked',_0xdb04eb);if(_0xdb04eb===!![]){this[_0x24bf('0x5')]('blockedAt',moment());this[_0x24bf('0x5')]('loginAttempts',0x0);}else{this[_0x24bf('0x5')](_0x24bf('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0x24bf('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x24bf('0x11')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x24bf('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x24bf('0x11')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x24bf('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x24bf('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x24bf('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x24bf('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9a70=['local','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','yes','nonat','update','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','active','actpass','TEXT','isArray','wss','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','encryption','icesupport','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','moment','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','getDataValue','internal','email','toLowerCase','ENUM','user','agent','telephone'];(function(_0x18a36b,_0x2d3e5f){var _0x58d4c3=function(_0x49d80f){while(--_0x49d80f){_0x18a36b['push'](_0x18a36b['shift']());}};_0x58d4c3(++_0x2d3e5f);}(_0x9a70,0x19c));var _0x09a7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9a70[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x09a7('0x0'));var util=require('util');var _=require('lodash');module[_0x09a7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x09a7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x22a851){this[_0x09a7('0x3')](_0x09a7('0x2'),_0x22a851);this[_0x09a7('0x3')](_0x09a7('0x4'),_0x22a851);},'comment':_0x09a7('0x5')},'fullname':{'type':Sequelize[_0x09a7('0x6')],'allowNull':![],'set':function(_0x5e0801){this['setDataValue'](_0x09a7('0x7'),_0x5e0801);this[_0x09a7('0x3')](_0x09a7('0x8'),util[_0x09a7('0x9')]('\x22%s\x22\x20<%s>',_0x5e0801,this[_0x09a7('0xa')](_0x09a7('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x09a7('0xc'),'validate':{'isEmail':!![]},'set':function(_0x56a194){if(_0x56a194){this[_0x09a7('0x3')](_0x09a7('0xc'),_0x56a194[_0x09a7('0xd')]());}}},'role':{'type':Sequelize[_0x09a7('0xe')]('admin',_0x09a7('0xf'),_0x09a7('0x10'),_0x09a7('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x09a7('0x6')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':_0x09a7('0x12')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x09a7('0xb'),'set':function(_0x1570da){this['setDataValue'](_0x09a7('0xb'),_0x1570da);this['setDataValue'](_0x09a7('0x13'),_0x1570da);this[_0x09a7('0x3')](_0x09a7('0x8'),util['format'](_0x09a7('0x14'),this[_0x09a7('0xa')](_0x09a7('0x7')),_0x1570da));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x09a7('0x6')]},'mobile':{'type':Sequelize[_0x09a7('0x6')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x09a7('0x6')]},'city':{'type':Sequelize[_0x09a7('0x6')]},'country':{'type':Sequelize[_0x09a7('0x6')]},'online':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x09a7('0x16')]},'voicePause':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':_0x09a7('0x17')},'lastPauseAt':{'type':Sequelize[_0x09a7('0x16')]},'chatCapacity':{'type':Sequelize[_0x09a7('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x09a7('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x09a7('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x09a7('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x09a7('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x09a7('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x09a7('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x09a7('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'host':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x09a7('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x09a7('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x09a7('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x09a7('0xe')](_0x09a7('0x19'),'user',_0x09a7('0x1a')),'allowNull':!![],'defaultValue':_0x09a7('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x09a7('0x1b')},'callingpres':{'type':Sequelize[_0x09a7('0xe')](_0x09a7('0x1c'),_0x09a7('0x1d'),_0x09a7('0x1e'),'ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x09a7('0x1f'),_0x09a7('0x20')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'secret':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x09a7('0x21'),'set':function(_0x61e5e6){this[_0x09a7('0x3')](_0x09a7('0x22'),_0x61e5e6?_0x61e5e6[_0x09a7('0x23')](','):null);},'get':function(){return this[_0x09a7('0xa')](_0x09a7('0x22'))?this[_0x09a7('0xa')](_0x09a7('0x22'))[_0x09a7('0x24')](','):null;},'comment':_0x09a7('0x25')},'dtmfmode':{'type':Sequelize[_0x09a7('0xe')](_0x09a7('0x26'),'info','shortinfo',_0x09a7('0x27'),_0x09a7('0x28')),'allowNull':!![],'defaultValue':_0x09a7('0x26')},'directmedia':{'type':Sequelize[_0x09a7('0xe')](_0x09a7('0x29'),'no',_0x09a7('0x2a'),_0x09a7('0x2b'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x09a7('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'nat':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x5affaa){this['setDataValue'](_0x09a7('0x2c'),_0x5affaa?_0x5affaa['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x09a7('0xa')](_0x09a7('0x2c'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x09a7('0x6')]},'pickupgroup':{'type':Sequelize[_0x09a7('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x09a7('0x6')]},'language':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x09a7('0x6')]},'disallow':{'type':Sequelize[_0x09a7('0x6')],'allowNull':![],'defaultValue':_0x09a7('0x2d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x09a7('0x2e'),'set':function(_0x424b84){this['setDataValue'](_0x09a7('0x2f'),_0x424b84?_0x424b84[_0x09a7('0x23')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x09a7('0xa')](_0x09a7('0x2f'))?this[_0x09a7('0xa')](_0x09a7('0x2f'))[_0x09a7('0x24')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x09a7('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![],'set':function(_0xefe622){this[_0x09a7('0x3')]('insecure',_0xefe622?_0xefe622[_0x09a7('0x23')](','):null);},'get':function(){return this[_0x09a7('0xa')]('insecure')?this['getDataValue']('insecure')[_0x09a7('0x24')](','):null;},'comment':_0x09a7('0x30')},'trustrpid':{'type':Sequelize['ENUM'](_0x09a7('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x09a7('0xe')](_0x09a7('0x29'),'no',_0x09a7('0x31')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x09a7('0xe')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x09a7('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x09a7('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![],'defaultValue':_0x09a7('0x32')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x09a7('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x09a7('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x09a7('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x09a7('0xe')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x09a7('0xe')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x09a7('0xe')](_0x09a7('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'template':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x09a7('0xe')](_0x09a7('0x29'),'no',_0x09a7('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x09a7('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x09a7('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x09a7('0xe')](_0x09a7('0x34'),_0x09a7('0x35'),_0x09a7('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x09a7('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x09a7('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x09a7('0xe')]('uac','uas'),'allowNull':!![],'defaultValue':_0x09a7('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x09a7('0xe')](_0x09a7('0x29'),'no'),'allowNull':!![],'defaultValue':_0x09a7('0x29')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x09a7('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x09a7('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x09a7('0xe')](_0x09a7('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x09a7('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x09a7('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x09a7('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x09a7('0xe')](_0x09a7('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x09a7('0xe')](_0x09a7('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x09a7('0xe')](_0x09a7('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x09a7('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x09a7('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x09a7('0x29'),'no',_0x09a7('0x38'),_0x09a7('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x09a7('0xe')](_0x09a7('0x3a'),'passive',_0x09a7('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x09a7('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x09a7('0xe')](_0x09a7('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x09a7('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x09a7('0x29'),'no',_0x09a7('0x2a'),_0x09a7('0x2b'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x09a7('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x09a7('0x3c')]},'showWebBar':{'type':Sequelize[_0x09a7('0x18')],'defaultValue':0x0,'set':function(_0x5c4524){this['setDataValue']('showWebBar',_0x5c4524);var _0x4f7c7a=this['get']({'plain':!![]});switch(_0x5c4524){case 0x0:case 0x1:var _0xbdfc2e=_0x4f7c7a[_0x09a7('0x22')]?_[_0x09a7('0x3d')](_0x4f7c7a[_0x09a7('0x22')])?_0x4f7c7a[_0x09a7('0x22')]['join']():_0x4f7c7a[_0x09a7('0x22')]:_0x09a7('0x21');if(_0xbdfc2e===_0x09a7('0x3e')){_0xbdfc2e=_0x09a7('0x21');}this[_0x09a7('0x3')](_0x09a7('0x22'),_0xbdfc2e);this[_0x09a7('0x3')]('encryption','no');this['setDataValue'](_0x09a7('0x3f'),null);this[_0x09a7('0x3')](_0x09a7('0x40'),null);this[_0x09a7('0x3')]('icesupport',null);this[_0x09a7('0x3')](_0x09a7('0x41'),null);this['setDataValue'](_0x09a7('0x42'),null);this[_0x09a7('0x3')](_0x09a7('0x43'),null);this[_0x09a7('0x3')](_0x09a7('0x44'),null);this[_0x09a7('0x3')]('dtlsprivatekey',null);this['setDataValue'](_0x09a7('0x45'),'no');break;case 0x2:this['setDataValue'](_0x09a7('0x22'),'wss');this[_0x09a7('0x3')](_0x09a7('0x46'),_0x09a7('0x29'));this['setDataValue'](_0x09a7('0x3f'),'yes');this[_0x09a7('0x3')](_0x09a7('0x40'),'yes');this['setDataValue'](_0x09a7('0x47'),_0x09a7('0x29'));this[_0x09a7('0x3')](_0x09a7('0x41'),_0x09a7('0x29'));this[_0x09a7('0x3')](_0x09a7('0x42'),'no');this[_0x09a7('0x3')](_0x09a7('0x43'),_0x09a7('0x3b'));this['setDataValue'](_0x09a7('0x44'),_0x4f7c7a[_0x09a7('0x44')]||_0x09a7('0x48'));this[_0x09a7('0x3')](_0x09a7('0x49'),_0x4f7c7a[_0x09a7('0x49')]||'/etc/pki/tls/private/motion.key');this[_0x09a7('0x3')](_0x09a7('0x45'),_0x09a7('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0x09a7('0x3c')],'set':function(_0x4f73e7){this['setDataValue'](_0x09a7('0x4a'),_0x4f73e7?_0x4f73e7[_0x09a7('0x23')](','):[]);},'get':function(){return this[_0x09a7('0xa')]('permissions')?_[_0x09a7('0x4b')](this[_0x09a7('0xa')]('permissions')['split'](','),function(_0x43d833){return parseInt(_0x43d833,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x09a7('0x6')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x09a7('0x6')]},'phoneBarBusyNumber':{'type':Sequelize[_0x09a7('0x6')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x09a7('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x09a7('0x4c')],'get':function(){return this['getDataValue'](_0x09a7('0x4d'))?this[_0x09a7('0xa')](_0x09a7('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x47ca0c){if(typeof _0x47ca0c===_0x09a7('0x4e')){var _0x40f93b=_0x47ca0c==='1'?!![]:_0x47ca0c==='0'?![]:_0x47ca0c===_0x09a7('0x4f')?!![]:_0x47ca0c===_0x09a7('0x50')?![]:![];this['setDataValue'](_0x09a7('0x51'),_0x40f93b);}else{this['setDataValue'](_0x09a7('0x51'),_0x47ca0c);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x208d14){this[_0x09a7('0x3')](_0x09a7('0x52'),_0x208d14);if(_0x208d14===!![]){this['setDataValue']('blockedAt',moment());this['setDataValue'](_0x09a7('0x53'),0x0);}else{this['setDataValue'](_0x09a7('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x09a7('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x09a7('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x09a7('0x55')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x09a7('0x18')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x09a7('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x09a7('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x09a7('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x09a7('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index a9a7e71..dda60d4 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 _0x6e2a=['$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','firstName','lastName','CmContact','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','unknown','ringing','teams','inbound','flatten','toString','desc','asc','substring','uniqBy','orderBy','getRealtimeAgents','offline','pause','unavailable','voiceStatus','busy','slice','toUpperCase','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','messengerSoundNotification','enabled','moment','path','lodash','squel','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','APIBadRequestError','../../errors/api','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','./user.socket','register','redis','defaults','localhost','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','update','role','agent','emit','destroy','then','get','admin','Users','user','Agents','Telephones','telephone','ignore','map','value','includes','find','name','error','stack','send','User','rawAttributes','fieldName','type','password','salt','resetPasswordToken','resetPasswordExpires','index','getOptions','query','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','length','dataValues','sms','fax','mail','whatsapp','catch','params','includeAll','include','merge','options','chat','body','describe','addContacts','ids','internal','findById','securePassword','max','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','isNil','from','mailbox','VoiceMail','fullname','email','permissions','101','102','103','110','105','106','108','109','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','all','userProfileId','isEmpty','UserProfileResource','changePassword','oldPassword','newPassword','ValidationError','authenticate','Sequelize','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','voicePause','interface','Unknown\x20channel','add','toLowerCase','penalty','spread','capitalize','voice','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','Queues','isArray','Queue:remove','QueueId','file','filename','join','root','userpic','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','keys','intersection','model','fields','order','sort','where','filters','pick','filter','Queue','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','login','phone','loginInPause','LOCAL/%s@from-sip/n','intrf','user:%s','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','LOGIN','device','LOGININPAUSE','YYYY-MM-DD\x20HH:mm:ss','isMiddleware','resolve','logout','online','PAUSE','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','pauseType','lastPauseAt','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','addAgent','getDataValue','TeamVoicePrefix','VoicePrefixId','Queue:save','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','removeAgent','Voice','UserVoicePrefix','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','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','user_has_sms_interactions:save','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','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper'];(function(_0x38e5e9,_0x1912e0){var _0x56adc0=function(_0x15aa7a){while(--_0x15aa7a){_0x38e5e9['push'](_0x38e5e9['shift']());}};_0x56adc0(++_0x1912e0);}(_0x6e2a,0x1d9));var _0xa6e2=function(_0x965eaf,_0x4918c1){_0x965eaf=_0x965eaf-0x0;var _0x942772=_0x6e2a[_0x965eaf];return _0x942772;};'use strict';var moment=require(_0xa6e2('0x0'));var util=require('util');var path=require(_0xa6e2('0x1'));var fs=require('fs');var _=require(_0xa6e2('0x2'));var squel=require(_0xa6e2('0x3'));var Redis=require('ioredis');var authService=require(_0xa6e2('0x4'));var contacts=require(_0xa6e2('0x5'));var qs=require(_0xa6e2('0x6'));var rta=require(_0xa6e2('0x7'));var logger=require(_0xa6e2('0x8'))(_0xa6e2('0x9'));var utils=require(_0xa6e2('0xa'));var config=require(_0xa6e2('0xb'));var licenseUtil=require(_0xa6e2('0xc'));var APIBadRequestError=require('../../errors/api')[_0xa6e2('0xd')];var APINotFoundError=require(_0xa6e2('0xe'))[_0xa6e2('0xf')];var APIHandleError=require('../../errors/api')[_0xa6e2('0x10')];var db=require(_0xa6e2('0x11'))['db'];var socket=require(_0xa6e2('0x12'))(new Redis(config['redis']));require(_0xa6e2('0x13'))[_0xa6e2('0x14')](socket);config[_0xa6e2('0x15')]=_[_0xa6e2('0x16')](config[_0xa6e2('0x15')],{'host':_0xa6e2('0x17'),'port':0x18eb});var values;function respondWithStatusCode(_0x35e6cb,_0x5d2903){_0x5d2903=_0x5d2903||0xcc;return function(_0x4e535a){if(_0x4e535a){return _0x35e6cb[_0xa6e2('0x18')](_0x5d2903);}return _0x35e6cb['status'](_0x5d2903)[_0xa6e2('0x19')]();};}function respondWithResult(_0x1e0aea,_0x12f956){_0x12f956=_0x12f956||0xc8;return function(_0x588b14){if(_0x588b14){return _0x1e0aea[_0xa6e2('0x1a')](_0x12f956)[_0xa6e2('0x1b')](_0x588b14);}};}function respondWithFilteredResult(_0x1ec19c,_0x369129){return function(_0x2194ad){if(_0x2194ad){var _0x4f7164=typeof _0x369129['offset']===_0xa6e2('0x1c')&&typeof _0x369129['limit']===_0xa6e2('0x1c');var _0x24bdd9=_0x2194ad['count'];var _0x3620fe=_0x4f7164?0x0:_0x369129['offset'];var _0x1e0df0=_0x4f7164?_0x2194ad[_0xa6e2('0x1d')]:_0x369129[_0xa6e2('0x1e')]+_0x369129[_0xa6e2('0x1f')];var _0x24d977;if(_0x1e0df0>=_0x24bdd9){_0x1e0df0=_0x24bdd9;_0x24d977=0xc8;}else{_0x24d977=0xce;}_0x1ec19c[_0xa6e2('0x1a')](_0x24d977);return _0x1ec19c[_0xa6e2('0x20')](_0xa6e2('0x21'),_0x3620fe+'-'+_0x1e0df0+'/'+_0x24bdd9)[_0xa6e2('0x1b')](_0x2194ad);}return null;};}function saveUpdates(_0x2f6de3){return function(_0x276d90){if(_0x276d90){return _0x276d90[_0xa6e2('0x22')](_0x2f6de3)['then'](function(_0x1e390c){if(_0x1e390c[_0xa6e2('0x23')]===_0xa6e2('0x24')){socket[_0xa6e2('0x25')]('userNotification:recalc:'+_0x1e390c['id'],_0x1e390c);}return _0x1e390c;});}return null;};}function removeEntity(_0x567f5e){return function(_0x18fc64){if(_0x18fc64){return _0x18fc64[_0xa6e2('0x26')]()[_0xa6e2('0x27')](function(){var _0x16e5a1=_0x18fc64[_0xa6e2('0x28')]({'plain':!![]});if(_0x16e5a1['role']===_0xa6e2('0x29'))return;var _0x5678f8=[{'name':_0xa6e2('0x2a'),'value':_0xa6e2('0x2b'),'ignore':!![]},{'name':_0xa6e2('0x2c'),'value':_0xa6e2('0x24'),'ignore':![]},{'name':_0xa6e2('0x2d'),'value':_0xa6e2('0x2e'),'ignore':![]}];var _0x314d5a=_(_0x5678f8)['filter'](_0xa6e2('0x2f'))[_0xa6e2('0x30')](_0xa6e2('0x31'))[_0xa6e2('0x31')]();if(_[_0xa6e2('0x32')](_0x314d5a,_0x16e5a1['role'])){return;}var _0x2af78d=_[_0xa6e2('0x33')](_0x5678f8,[_0xa6e2('0x31'),_0x16e5a1[_0xa6e2('0x23')]])[_0xa6e2('0x34')];return db['UserProfileResource'][_0xa6e2('0x26')]({'where':{'type':_0x2af78d,'resourceId':_0x16e5a1['id']}})[_0xa6e2('0x27')](function(){return _0x18fc64;});})[_0xa6e2('0x27')](function(){_0x567f5e['status'](0xcc)[_0xa6e2('0x19')]();});}};}function handleEntityNotFound(_0xe7136){return function(_0x36989c){if(!_0x36989c){_0xe7136[_0xa6e2('0x18')](0x194);}return _0x36989c;};}function handleError(_0x26a857,_0x4a0c79){_0x4a0c79=_0x4a0c79||0x1f4;return function(_0x490676){logger[_0xa6e2('0x35')](_0x490676[_0xa6e2('0x36')]);if(_0x490676[_0xa6e2('0x34')]){delete _0x490676[_0xa6e2('0x34')];}_0x26a857[_0xa6e2('0x1a')](_0x4a0c79)[_0xa6e2('0x37')](_0x490676);};}function getUserAttributes(){return _(db[_0xa6e2('0x38')][_0xa6e2('0x39')])[_0xa6e2('0x30')](function(_0x5f0bbd){return{'name':_0x5f0bbd[_0xa6e2('0x3a')],'type':_0x5f0bbd[_0xa6e2('0x3b')]['key']};})['filter'](function(_0x35d76c){return![_0xa6e2('0x3c'),_0xa6e2('0x3d'),'previousPasswords',_0xa6e2('0x3e'),_0xa6e2('0x3f'),'md5secret']['includes'](_0x35d76c[_0xa6e2('0x34')]);})[_0xa6e2('0x31')]();}exports[_0xa6e2('0x40')]=function(_0x417f4a,_0x5b6a97){var _0x4dd44e={},_0x5af4de={'count':0x0,'rows':[]};var _0x3c6a9c=getUserAttributes();_0x4dd44e=qs[_0xa6e2('0x41')](_0x3c6a9c,_0x417f4a);var _0x53651a={'where':_0x4dd44e['where']};return db['User'][_0xa6e2('0x1d')](_0x53651a)['then'](function(_0x1ef790){_0x5af4de[_0xa6e2('0x1d')]=_0x1ef790;if(_0x417f4a[_0xa6e2('0x42')]['includeAll']){_0x4dd44e['include']=[{'all':!![]}];}if(_0x417f4a[_0xa6e2('0x42')][_0xa6e2('0x43')]===_0xa6e2('0x44')){_0x4dd44e['include']=[{'model':db[_0xa6e2('0x45')],'as':_0xa6e2('0x43')}];}if(!_[_0xa6e2('0x32')](_0x4dd44e[_0xa6e2('0x46')],'id')){_0x4dd44e[_0xa6e2('0x46')][_0xa6e2('0x47')]('id');}return db[_0xa6e2('0x38')][_0xa6e2('0x48')](_0x4dd44e);})[_0xa6e2('0x27')](function(_0x353b2f){_0x5af4de[_0xa6e2('0x49')]=_0x353b2f;if(_0x417f4a[_0xa6e2('0x42')][_0xa6e2('0x4a')]===_0xa6e2('0x44')){var _0x62e187=[];for(var _0x147e26=0x0;_0x147e26<_0x5af4de[_0xa6e2('0x49')][_0xa6e2('0x4b')];_0x147e26++){_0x62e187[_0xa6e2('0x47')](get_open_tabs('chat',_0x5af4de[_0xa6e2('0x49')][_0x147e26][_0xa6e2('0x4c')]));_0x62e187['push'](get_open_tabs(_0xa6e2('0x4d'),_0x5af4de['rows'][_0x147e26][_0xa6e2('0x4c')]));_0x62e187['push'](get_open_tabs(_0xa6e2('0x4e'),_0x5af4de['rows'][_0x147e26][_0xa6e2('0x4c')]));_0x62e187[_0xa6e2('0x47')](get_open_tabs(_0xa6e2('0x4f'),_0x5af4de[_0xa6e2('0x49')][_0x147e26][_0xa6e2('0x4c')]));_0x62e187[_0xa6e2('0x47')](get_open_tabs('openchannel',_0x5af4de[_0xa6e2('0x49')][_0x147e26]['dataValues']));_0x62e187['push'](get_open_tabs(_0xa6e2('0x50'),_0x5af4de[_0xa6e2('0x49')][_0x147e26][_0xa6e2('0x4c')]));}return Promise['all'](_0x62e187)[_0xa6e2('0x27')](function(){return _0x5af4de;});}else{return _0x5af4de;}})[_0xa6e2('0x27')](respondWithFilteredResult(_0x5b6a97,_0x4dd44e))[_0xa6e2('0x51')](handleError(_0x5b6a97,null));};exports['show']=function(_0x34cc49,_0x524b5b){var _0x52f3e3=getUserAttributes();_0x34cc49[_0xa6e2('0x42')]['id']=_0x34cc49[_0xa6e2('0x52')]['id'];var _0x86c2b6=qs['getOptions'](_0x52f3e3,_0x34cc49);if(_0x34cc49[_0xa6e2('0x42')][_0xa6e2('0x53')]){_0x86c2b6['include']=[{'all':!![]}];}if(_0x34cc49['query'][_0xa6e2('0x43')]==='true'){_0x86c2b6[_0xa6e2('0x54')]=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x86c2b6=_[_0xa6e2('0x55')]({},_0x86c2b6,_0x34cc49[_0xa6e2('0x56')]);if(!_[_0xa6e2('0x32')](_0x86c2b6['attributes'],'id')){_0x86c2b6[_0xa6e2('0x46')]['push']('id');}return db[_0xa6e2('0x38')][_0xa6e2('0x33')](_0x86c2b6)['then'](handleEntityNotFound(_0x524b5b,null))[_0xa6e2('0x27')](function(_0xf09a6){var _0x45b9bf=[];values=_0xf09a6;if(_0x34cc49['query'][_0xa6e2('0x4a')]===_0xa6e2('0x44')){_0x45b9bf[_0xa6e2('0x47')](get_open_tabs(_0xa6e2('0x57'),_0xf09a6[_0xa6e2('0x4c')]));_0x45b9bf[_0xa6e2('0x47')](get_open_tabs('sms',_0xf09a6[_0xa6e2('0x4c')]));_0x45b9bf[_0xa6e2('0x47')](get_open_tabs('openchannel',_0xf09a6[_0xa6e2('0x4c')]));_0x45b9bf[_0xa6e2('0x47')](get_open_tabs('whatsapp',_0xf09a6[_0xa6e2('0x4c')]));_0x45b9bf[_0xa6e2('0x47')](get_open_tabs(_0xa6e2('0x4e'),_0xf09a6[_0xa6e2('0x4c')]));_0x45b9bf['push'](get_open_tabs(_0xa6e2('0x4f'),_0xf09a6['dataValues']));return Promise['all'](_0x45b9bf);}else{return values;}})['then'](function(){return values;})['then'](respondWithResult(_0x524b5b,null))['catch'](handleError(_0x524b5b,null));};exports[_0xa6e2('0x22')]=function(_0x4a48e8,_0x241a48){if(_0x4a48e8['body']['id']){delete _0x4a48e8[_0xa6e2('0x58')]['id'];}delete _0x4a48e8[_0xa6e2('0x58')][_0xa6e2('0x23')];return db['User']['find']({'where':{'id':_0x4a48e8[_0xa6e2('0x52')]['id']}})['then'](handleEntityNotFound(_0x241a48,null))[_0xa6e2('0x27')](saveUpdates(_0x4a48e8['body'],null))['then'](respondWithResult(_0x241a48,null))[_0xa6e2('0x51')](handleError(_0x241a48,null));};exports['describe']=function(_0x4426e8,_0x3dc27d){return db[_0xa6e2('0x38')][_0xa6e2('0x59')]()[_0xa6e2('0x27')](respondWithResult(_0x3dc27d,null))[_0xa6e2('0x51')](handleError(_0x3dc27d,null));};exports[_0xa6e2('0x5a')]=function(_0x54beb4,_0x24ba88){return db[_0xa6e2('0x38')]['find']({'where':{'id':_0x54beb4[_0xa6e2('0x52')]['id']}})['then'](handleEntityNotFound(_0x24ba88,null))[_0xa6e2('0x27')](function(_0x1428e6){if(_0x1428e6){return _0x1428e6[_0xa6e2('0x5a')](_0x54beb4[_0xa6e2('0x58')][_0xa6e2('0x5b')],_['omit'](_0x54beb4[_0xa6e2('0x58')],[_0xa6e2('0x5b'),'id'])||{});}})[_0xa6e2('0x27')](respondWithResult(_0x24ba88,null))[_0xa6e2('0x51')](handleError(_0x24ba88,null));};function validateUser(_0x528740){return new Promise(function(_0x25007b,_0x17db21){if(_0x528740[_0xa6e2('0x5c')])return _0x25007b(_0x528740);return db['Setting'][_0xa6e2('0x5d')](0x1)[_0xa6e2('0x27')](function(_0xf3551){if(_0xf3551[_0xa6e2('0x5e')])authService['validatePasswordPattern'](_0x528740[_0xa6e2('0x3c')]);db[_0xa6e2('0x38')][_0xa6e2('0x5f')](_0xa6e2('0x5c'))[_0xa6e2('0x27')](function(_0x55005e){if(_['isNil'](_0x55005e)){_0x528740[_0xa6e2('0x5c')]=_0xf3551['min_internal']||0x1;return;}if(_['isNil'](_0xf3551[_0xa6e2('0x60')])||_0xf3551[_0xa6e2('0x60')]===_0x55005e){_0x528740[_0xa6e2('0x5c')]=_0x55005e+0x1;return;}if(_0xf3551[_0xa6e2('0x60')]>_0x55005e){_0x528740['internal']=_0xf3551[_0xa6e2('0x60')];return;}return db[_0xa6e2('0x61')][_0xa6e2('0x42')](_0xa6e2('0x62'),{'type':db['sequelize'][_0xa6e2('0x63')][_0xa6e2('0x64')]})[_0xa6e2('0x27')](function(_0x1b781e){if(_0x1b781e&&_0x1b781e['length']){for(var _0x3cea9a=0x0,_0x3f77f4=_0x1b781e[_0xa6e2('0x4b')];_0x3cea9a<_0x3f77f4&&_[_0xa6e2('0x65')](_0x528740[_0xa6e2('0x5c')]);_0x3cea9a++){if(_0xf3551[_0xa6e2('0x60')]<=_0x1b781e[_0x3cea9a][_0xa6e2('0x66')]){_0x528740[_0xa6e2('0x5c')]=_0x1b781e[_0x3cea9a][_0xa6e2('0x66')];}else if(_0xf3551[_0xa6e2('0x60')]>_0x1b781e[_0x3cea9a]['from']&&_0xf3551['min_internal']<=_0x1b781e[_0x3cea9a]['to']){_0x528740['internal']=_0xf3551['min_internal'];}}}if(_[_0xa6e2('0x65')](_0x528740['internal'])){_0x528740[_0xa6e2('0x5c')]=_0x55005e+0x1;}return _0x25007b(_0x528740);});});})[_0xa6e2('0x51')](function(_0x1ba445){_0x17db21(_0x1ba445);});});}function updateUser(_0x1e513f){return new Promise(function(_0x577273,_0x46e101){try{if(_0x1e513f['voicemail']){_0x1e513f[_0xa6e2('0x67')]=_0x1e513f[_0xa6e2('0x5c')];_0x1e513f[_0xa6e2('0x68')]={'mailbox':_0x1e513f[_0xa6e2('0x5c')],'password':_0x1e513f['password'],'fullname':_0x1e513f[_0xa6e2('0x69')],'email':_0x1e513f[_0xa6e2('0x6a')]};}if(_0x1e513f[_0xa6e2('0x23')]==='agent'){if(!_0x1e513f[_0xa6e2('0x6b')])_0x1e513f[_0xa6e2('0x6b')]=[_0xa6e2('0x6c'),_0xa6e2('0x6d'),_0xa6e2('0x6e'),'113',_0xa6e2('0x6f'),'104',_0xa6e2('0x70'),_0xa6e2('0x71'),'107',_0xa6e2('0x72'),_0xa6e2('0x73'),_0xa6e2('0x74'),_0xa6e2('0x75'),_0xa6e2('0x76'),_0xa6e2('0x77')];}_0x577273(_0x1e513f);}catch(_0x2c7592){_0x46e101(_0x2c7592);}});}exports[_0xa6e2('0x78')]=function(_0x268c45,_0x3f0f2e){if(_0x268c45[_0xa6e2('0x2b')][_0xa6e2('0x23')]===_0xa6e2('0x24'))throw new Error(_0xa6e2('0x79'));if(_0x268c45[_0xa6e2('0x58')][_0xa6e2('0x23')]===_0xa6e2('0x2b')&&_0x268c45['user'][_0xa6e2('0x23')]!==_0xa6e2('0x29')){throw new Error(_0xa6e2('0x7a'));}if(_0x268c45['body'][_0xa6e2('0x23')]===_0xa6e2('0x29')&&_0x268c45[_0xa6e2('0x2b')][_0xa6e2('0x23')]!=='admin'){throw new Error(_0xa6e2('0x7b'));}return licenseUtil[_0xa6e2('0x7c')]([_0x268c45[_0xa6e2('0x58')]])[_0xa6e2('0x27')](function(){return validateUser(_0x268c45[_0xa6e2('0x58')]);})[_0xa6e2('0x27')](function(_0x3505da){return updateUser(_0x3505da)[_0xa6e2('0x27')](function(_0x1975ab){if(_0x1975ab['role']===_0xa6e2('0x29')){_0x1975ab['settingsEnabled']=_0x268c45['user'][_0xa6e2('0x7d')];delete _0x1975ab['userProfileId'];}return _0x1975ab;});})[_0xa6e2('0x27')](function(_0x2d4c07){return db[_0xa6e2('0x38')][_0xa6e2('0x78')](_0x2d4c07,{'include':[{'model':db['VoiceMail'],'as':_0xa6e2('0x68')}]});})[_0xa6e2('0x27')](function(_0x13887f){if(_0x268c45[_0xa6e2('0x58')][_0xa6e2('0x23')]===_0xa6e2('0x2b'))return _0x13887f;if(_0x268c45[_0xa6e2('0x2b')][_0xa6e2('0x23')]!=='user')return _0x13887f;return db[_0xa6e2('0x7e')][_0xa6e2('0x33')]({'where':{'name':_0x13887f[_0xa6e2('0x23')]==='agent'?'Agents':_0xa6e2('0x2d'),'userProfileId':_0x268c45['user']['userProfileId']},'raw':!![]})['then'](function(_0x750596){if(!_0x750596||_0x750596[_0xa6e2('0x7f')]!=0x0)return _0x13887f;return db['UserProfileResource'][_0xa6e2('0x78')]({'name':_0x13887f['name'],'resourceId':_0x13887f['id'],'type':_0x750596[_0xa6e2('0x34')],'sectionId':_0x750596['id']},{})['then'](function(){return _0x13887f;});})[_0xa6e2('0x51')](function(_0x3f357e){logger[_0xa6e2('0x35')](_0xa6e2('0x80'),_0x3f357e);throw _0x3f357e;});})[_0xa6e2('0x27')](respondWithResult(_0x3f0f2e,0xc9))[_0xa6e2('0x51')](handleError(_0x3f0f2e,null));};exports[_0xa6e2('0x81')]=function(_0x4c33f4,_0x29c3f7){var _0x14865d=_0x4c33f4[_0xa6e2('0x58')];var _0x330db5=[];if(_0x4c33f4['user'][_0xa6e2('0x23')]===_0xa6e2('0x24'))throw new Error(_0xa6e2('0x79'));if(_[_0xa6e2('0x82')](_0x14865d,[_0xa6e2('0x23'),_0xa6e2('0x2b')])&&_0x4c33f4[_0xa6e2('0x2b')]['role']!==_0xa6e2('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xa6e2('0x82')](_0x14865d,[_0xa6e2('0x23'),_0xa6e2('0x29')])&&_0x4c33f4['user'][_0xa6e2('0x23')]!=='admin'){throw new Error(_0xa6e2('0x83'));}return licenseUtil[_0xa6e2('0x7c')](_0x14865d)[_0xa6e2('0x27')](function(){return validateUser(_0x14865d[0x0]);})[_0xa6e2('0x27')](function(){for(var _0x55a370=0x1;_0x55a370<_0x14865d[_0xa6e2('0x4b')];_0x55a370++){var _0x177f65=_0x14865d[_0x55a370-0x1][_0xa6e2('0x5c')];if(!_0x14865d[_0x55a370]['internal'])_0x14865d[_0x55a370][_0xa6e2('0x5c')]=_0x177f65+0x1;_0x330db5[_0xa6e2('0x47')](validateUser(_0x14865d[_0x55a370]));}return Promise[_0xa6e2('0x84')](_0x330db5);})[_0xa6e2('0x27')](function(){_0x330db5=[];for(var _0x33f17c=0x0;_0x33f17c<_0x14865d[_0xa6e2('0x4b')];_0x33f17c++){_0x330db5[_0xa6e2('0x47')](updateUser(_0x14865d[_0x33f17c]));}return Promise[_0xa6e2('0x84')](_0x330db5);})['then'](function(){_0x330db5=_0x14865d['map'](function(_0x4d26ac){return db[_0xa6e2('0x38')][_0xa6e2('0x78')](_0x4d26ac,{'include':[{'model':db[_0xa6e2('0x68')],'as':_0xa6e2('0x68')}]})['then'](function(_0x547707){_0x4d26ac['id']=_0x547707['id'];return _0x4d26ac;});});return Promise[_0xa6e2('0x84')](_0x330db5);})[_0xa6e2('0x27')](function(_0x3e54b5){if(_0x4c33f4[_0xa6e2('0x58')][_0xa6e2('0x23')]===_0xa6e2('0x2b'))return _0x3e54b5;if(_0x4c33f4[_0xa6e2('0x2b')]['role']!=='user')return _0x3e54b5;var _0x5331df=_[_0xa6e2('0x82')](_0x3e54b5,function(_0x5a25ff){return _0x5a25ff[_0xa6e2('0x23')]==='agent'||_0x5a25ff[_0xa6e2('0x23')]===_0xa6e2('0x2e');});if(!_0x5331df)return _0x3e54b5;return db[_0xa6e2('0x7e')]['findAll']({'where':{'name':{'$or':[_0xa6e2('0x2c'),_0xa6e2('0x2d')]},'userProfileId':_0x4c33f4['user'][_0xa6e2('0x85')]},'raw':!![]})[_0xa6e2('0x27')](function(_0x4d6f93){if(_[_0xa6e2('0x86')](_0x4d6f93)||!_[_0xa6e2('0x82')](_0x4d6f93,[_0xa6e2('0x7f'),0x0]))return _0x3e54b5;_0x330db5=[];var _0x485cad=_(_0x4d6f93)[_0xa6e2('0x30')](function(_0x42c2b9){if(_0x42c2b9[_0xa6e2('0x7f')]===0x1)return;return _0x42c2b9[_0xa6e2('0x34')]===_0xa6e2('0x2c')?_0xa6e2('0x24'):_0xa6e2('0x2e');})['compact']()[_0xa6e2('0x31')]();for(var _0x267092=0x0;_0x267092<_0x3e54b5['length'];_0x267092++){if(!_[_0xa6e2('0x32')](_0x485cad,_0x3e54b5[_0x267092]['role']))return;var _0x2fd387=_0x3e54b5[_0x267092][_0xa6e2('0x23')]===_0xa6e2('0x24')?_0xa6e2('0x2c'):'Telephones';_0x330db5[_0xa6e2('0x47')](db[_0xa6e2('0x87')][_0xa6e2('0x78')]({'name':_0x3e54b5[_0x267092][_0xa6e2('0x34')],'resourceId':_0x3e54b5[_0x267092]['id'],'type':_0x2fd387,'sectionId':_['find'](_0x4d6f93,[_0xa6e2('0x34'),_0x2fd387])['id']},{}));}return Promise[_0xa6e2('0x84')](_0x330db5);});})[_0xa6e2('0x27')](respondWithResult(_0x29c3f7,0xc9))['catch'](handleError(_0x29c3f7,null));};exports[_0xa6e2('0x88')]=function(_0x9e9ab3,_0x2a0d36){if(_0x9e9ab3[_0xa6e2('0x58')]['id']){delete _0x9e9ab3[_0xa6e2('0x58')]['id'];}return db[_0xa6e2('0x38')]['find']({'where':{'id':_0x9e9ab3['params']['id']}})[_0xa6e2('0x27')](function(_0x10af33){if(!_0x10af33)return null;if(_0x10af33['id']===_0x9e9ab3[_0xa6e2('0x2b')]['id']){if(!_0x9e9ab3[_0xa6e2('0x58')][_0xa6e2('0x89')]||!_0x9e9ab3['body'][_0xa6e2('0x8a')]){throw new db['Sequelize'][(_0xa6e2('0x8b'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x10af33[_0xa6e2('0x8c')](_0x9e9ab3[_0xa6e2('0x58')][_0xa6e2('0x89')])){throw new db[(_0xa6e2('0x8d'))]['ValidationError']('Wrong\x20credentials');}if(_0x9e9ab3[_0xa6e2('0x58')]['oldPassword']===_0x9e9ab3[_0xa6e2('0x58')][_0xa6e2('0x8a')]){throw new db[(_0xa6e2('0x8d'))]['ValidationError'](_0xa6e2('0x8e'));}}else if(_0x9e9ab3[_0xa6e2('0x2b')]['role']===_0xa6e2('0x29')){if(!_0x9e9ab3['body']['newPassword']){throw new db['Sequelize'][(_0xa6e2('0x8b'))](_0xa6e2('0x8f'));}}else if(_0x9e9ab3[_0xa6e2('0x2b')][_0xa6e2('0x23')]===_0xa6e2('0x2b')){if(!_0x9e9ab3[_0xa6e2('0x58')][_0xa6e2('0x8a')]){throw new db[(_0xa6e2('0x8d'))][(_0xa6e2('0x8b'))](_0xa6e2('0x8f'));}if(_0x10af33[_0xa6e2('0x23')]!=='agent'){throw new db[(_0xa6e2('0x8d'))][(_0xa6e2('0x8b'))](_0xa6e2('0x79'));}}else{throw new db[(_0xa6e2('0x8d'))][(_0xa6e2('0x8b'))](_0xa6e2('0x79'));}return _0x10af33;})[_0xa6e2('0x27')](handleEntityNotFound(_0x2a0d36,null))[_0xa6e2('0x27')](function(_0x503f7d){return db[_0xa6e2('0x90')][_0xa6e2('0x91')]({'attributes':['id',_0xa6e2('0x5e'),_0xa6e2('0x92'),_0xa6e2('0x93')]})['then'](function(_0x21eb0f){if(_0x21eb0f[_0xa6e2('0x5e')])authService['validatePasswordPattern'](_0x9e9ab3[_0xa6e2('0x58')][_0xa6e2('0x8a')]);if(!_0x21eb0f[_0xa6e2('0x92')]||!_0x503f7d[_0xa6e2('0x94')])return _0x503f7d;authService[_0xa6e2('0x95')](_0x9e9ab3[_0xa6e2('0x58')][_0xa6e2('0x8a')],_0x503f7d['previousPasswords'],_0x21eb0f[_0xa6e2('0x93')]);return _0x503f7d;})[_0xa6e2('0x27')](saveUpdates({'password':_0x9e9ab3['body'][_0xa6e2('0x8a')],'passwordResetAt':_0x9e9ab3[_0xa6e2('0x2b')]['id']==_0x9e9ab3[_0xa6e2('0x52')]['id']?moment():null,'previousPasswords':authService[_0xa6e2('0x96')](_0x9e9ab3['body'][_0xa6e2('0x8a')],_0x503f7d[_0xa6e2('0x94')])},null));})['then'](respondWithResult(_0x2a0d36,null))[_0xa6e2('0x51')](handleError(_0x2a0d36,null));};exports[_0xa6e2('0x97')]=function(_0xf728da,_0x582024){var _0x38de24=_0xf728da[_0xa6e2('0x58')][_0xa6e2('0x98')];return db[_0xa6e2('0x38')][_0xa6e2('0x33')]({'where':{'id':_0xf728da[_0xa6e2('0x52')]['id']},'attributes':['id',_0xa6e2('0x34'),_0xa6e2('0x23'),'online','loginInPause',_0xa6e2('0x99'),_0xa6e2('0x9a')]})[_0xa6e2('0x27')](handleEntityNotFound(_0x582024,null))['then'](function(_0x453eb4){if(_0x453eb4){if(!utils['isValidChannel'](_0x38de24)){throw new db[(_0xa6e2('0x8d'))][(_0xa6e2('0x8b'))](_0xa6e2('0x9b'));}return _0x453eb4[_0xa6e2('0x9c')+_['capitalize'](_0x38de24[_0xa6e2('0x9d')]())+'Queues'](_0xf728da[_0xa6e2('0x58')][_0xa6e2('0x5b')],{'penalty':_0xf728da[_0xa6e2('0x58')][_0xa6e2('0x9e')]||0x0})[_0xa6e2('0x9f')](function(_0x45595c){for(var _0x41a139=0x0;_0x41a139<_0xf728da[_0xa6e2('0x58')][_0xa6e2('0x5b')][_0xa6e2('0x4b')];_0x41a139+=0x1){var _0x2f0a7c={'UserId':Number(_0xf728da[_0xa6e2('0x52')]['id'])};_0x2f0a7c[_[_0xa6e2('0xa0')](_0x38de24[_0xa6e2('0x9d')]())+'QueueId']=Number(_0xf728da[_0xa6e2('0x58')][_0xa6e2('0x5b')][_0x41a139]);socket['emit'](_0xa6e2('0x2b')+_[_0xa6e2('0xa0')](_0x38de24[_0xa6e2('0x9d')]())+'Queue:save',_0x2f0a7c);}return _0x45595c;})[_0xa6e2('0x27')](function(){if(_0x38de24===_0xa6e2('0xa1')){return db['VoiceQueue'][_0xa6e2('0x48')]({'where':{'id':_0xf728da[_0xa6e2('0x58')][_0xa6e2('0x5b')]||[]},'raw':!![],'attributes':['id',_0xa6e2('0x34')]});}})[_0xa6e2('0x27')](function(_0x236169){var _0x37fb0d=_0x453eb4[_0xa6e2('0x28')]({'plain':!![]});var _0x1c624a=[];if(_0x38de24===_0xa6e2('0xa1')&&_0x37fb0d[_0xa6e2('0x23')]===_0xa6e2('0x24')&&_0x37fb0d['online']){for(let _0x373641=0x0;_0x373641<_0x236169[_0xa6e2('0x4b')];_0x373641+=0x1){_0x1c624a['push']({'membername':_0x37fb0d[_0xa6e2('0x34')],'UserId':_0x37fb0d['id'],'queue_name':_0x236169[_0x373641][_0xa6e2('0x34')],'VoiceQueueId':_0x236169[_0x373641]['id'],'interface':_[_0xa6e2('0x65')](_0x37fb0d[_0xa6e2('0x9a')])?util[_0xa6e2('0xa2')](_0xa6e2('0xa3'),_0x37fb0d[_0xa6e2('0x34')]):_0x37fb0d[_0xa6e2('0x9a')],'paused':_0x37fb0d[_0xa6e2('0x99')]||![],'penalty':_0xf728da[_0xa6e2('0x58')][_0xa6e2('0x9e')]||0x0});}return Promise[_0xa6e2('0x84')](_0x1c624a[_0xa6e2('0x30')](function(_0x2a397d){return db[_0xa6e2('0xa4')][_0xa6e2('0xa5')](_0x2a397d);}));}return _0x453eb4;});}})['then'](respondWithStatusCode(_0x582024,null))[_0xa6e2('0x51')](handleError(_0x582024,null));};exports[_0xa6e2('0xa6')]=function(_0x441bf2,_0x54b367){var _0x8fba99,_0x1abd02;return db[_0xa6e2('0x38')][_0xa6e2('0x33')]({'where':{'id':_0x441bf2[_0xa6e2('0x52')]['id']},'attributes':['id',_0xa6e2('0x34'),_0xa6e2('0x23')]})[_0xa6e2('0x27')](handleEntityNotFound(_0x54b367,null))[_0xa6e2('0x27')](function(_0x59f73b){if(_0x59f73b){_0x8fba99=_0x59f73b;if(!_0x441bf2[_0xa6e2('0x42')][_0xa6e2('0x98')]||!utils[_0xa6e2('0xa7')](_0x441bf2[_0xa6e2('0x42')][_0xa6e2('0x98')])){throw new db[(_0xa6e2('0x8d'))][(_0xa6e2('0x8b'))]('Unknown\x20channel');}return _0x59f73b['remove'+_['capitalize'](_0x441bf2[_0xa6e2('0x42')]['channel']['toLowerCase']())+_0xa6e2('0xa8')](_0x441bf2['query'][_0xa6e2('0x5b')]);}})[_0xa6e2('0x27')](function(_0x4faa6b){if(_[_0xa6e2('0xa9')](_0x441bf2[_0xa6e2('0x42')]['ids'])){for(var _0x3d0857=0x0;_0x3d0857<_0x441bf2[_0xa6e2('0x42')][_0xa6e2('0x5b')][_0xa6e2('0x4b')];_0x3d0857+=0x1){_0x1abd02={'UserId':Number(_0x441bf2['params']['id'])};_0x1abd02[_[_0xa6e2('0xa0')](_0x441bf2[_0xa6e2('0x42')]['channel'][_0xa6e2('0x9d')]())+'QueueId']=Number(_0x441bf2[_0xa6e2('0x42')][_0xa6e2('0x5b')][_0x3d0857]);socket[_0xa6e2('0x25')]('user'+_[_0xa6e2('0xa0')](_0x441bf2[_0xa6e2('0x42')][_0xa6e2('0x98')][_0xa6e2('0x9d')]())+_0xa6e2('0xaa'),_0x1abd02);}}else{_0x1abd02={'UserId':Number(_0x441bf2[_0xa6e2('0x52')]['id'])};_0x1abd02[_[_0xa6e2('0xa0')](_0x441bf2[_0xa6e2('0x42')][_0xa6e2('0x98')]['toLowerCase']())+_0xa6e2('0xab')]=Number(_0x441bf2[_0xa6e2('0x42')][_0xa6e2('0x5b')]);socket['emit'](_0xa6e2('0x2b')+_['capitalize'](_0x441bf2[_0xa6e2('0x42')][_0xa6e2('0x98')][_0xa6e2('0x9d')]())+'Queue:remove',_0x1abd02);}return _0x4faa6b;})[_0xa6e2('0x27')](function(){if(_0x441bf2[_0xa6e2('0x42')][_0xa6e2('0x98')]===_0xa6e2('0xa1')){return db[_0xa6e2('0xa4')][_0xa6e2('0x26')]({'where':{'UserId':_0x441bf2[_0xa6e2('0x52')]['id'],'VoiceQueueId':_0x441bf2['query'][_0xa6e2('0x5b')]},'individualHooks':!![]})['then'](function(){return _0x8fba99;});}return _0x8fba99;})[_0xa6e2('0x27')](respondWithStatusCode(_0x54b367,null))[_0xa6e2('0x51')](handleError(_0x54b367,null));};exports['addAvatar']=function(_0x5a666d,_0x1f08b3){_0x5a666d['body']['userpic']=_0x5a666d[_0xa6e2('0xac')][_0xa6e2('0xad')];return db[_0xa6e2('0x38')][_0xa6e2('0x33')]({'where':{'id':_0x5a666d[_0xa6e2('0x52')]['id']}})[_0xa6e2('0x27')](handleEntityNotFound(_0x1f08b3,null))[_0xa6e2('0x27')](saveUpdates(_0x5a666d['body'],null))[_0xa6e2('0x27')](respondWithResult(_0x1f08b3,null))[_0xa6e2('0x51')](handleError(_0x1f08b3,null));};exports['getAvatar']=function(_0x4b8f44,_0x1430b5){var _0x3c86e6=path[_0xa6e2('0xae')](config[_0xa6e2('0xaf')],'server/files/images/logos/default_profile.png');return db[_0xa6e2('0x38')][_0xa6e2('0x33')]({'where':{'id':_0x4b8f44[_0xa6e2('0x52')]['id']},'attributes':['id',_0xa6e2('0xb0')],'raw':!![]})['then'](handleEntityNotFound(_0x1430b5,null))[_0xa6e2('0x27')](function(_0x9d976){if(_0x9d976){if(_[_0xa6e2('0x65')](_0x9d976[_0xa6e2('0xb0')])){return _0x1430b5[_0xa6e2('0xb1')](_0x3c86e6);}else{if(!fs[_0xa6e2('0xb2')](path['join'](config[_0xa6e2('0xaf')],_0xa6e2('0xb3'),_0x9d976[_0xa6e2('0xb0')]))){return _0x1430b5['download'](_0x3c86e6);}return _0x1430b5[_0xa6e2('0xb1')](path[_0xa6e2('0xae')](config[_0xa6e2('0xaf')],_0xa6e2('0xb3'),_0x9d976['userpic']));}}})['catch'](handleError(_0x1430b5,null));};exports[_0xa6e2('0xb4')]=function(_0x1cde33,_0x46a936){return db[_0xa6e2('0x38')][_0xa6e2('0x33')]({'where':{'id':_0x1cde33[_0xa6e2('0x52')]['id']},'attributes':['id']})[_0xa6e2('0x27')](handleEntityNotFound(_0x46a936,null))[_0xa6e2('0x27')](function(_0x9b443c){var _0x392fca=[];values=_0x9b443c[_0xa6e2('0x4c')];_0x392fca[_0xa6e2('0x47')](get_open_tabs(_0xa6e2('0x57'),_0x9b443c[_0xa6e2('0x4c')]));_0x392fca[_0xa6e2('0x47')](get_open_tabs(_0xa6e2('0x4d'),_0x9b443c[_0xa6e2('0x4c')]));_0x392fca['push'](get_open_tabs('openchannel',_0x9b443c[_0xa6e2('0x4c')]));_0x392fca[_0xa6e2('0x47')](get_open_tabs(_0xa6e2('0x50'),_0x9b443c[_0xa6e2('0x4c')]));_0x392fca[_0xa6e2('0x47')](get_open_tabs('fax',_0x9b443c[_0xa6e2('0x4c')]));_0x392fca[_0xa6e2('0x47')](get_open_tabs(_0xa6e2('0x4f'),_0x9b443c[_0xa6e2('0x4c')]));return Promise[_0xa6e2('0x84')](_0x392fca);})[_0xa6e2('0x27')](function(_0x3e884){if(_0x3e884){var _0x1bf93a=_['map'](values[_0xa6e2('0xb5')],function(_0x38c492){return{'channel':_0xa6e2('0xb6'),'id':_0x38c492['id'],'createdAt':_0x38c492[_0xa6e2('0xb7')]};});var _0x33609c=_[_0xa6e2('0x30')](values[_0xa6e2('0xb8')],function(_0x2757fe){return{'channel':_0xa6e2('0xb9'),'id':_0x2757fe['id'],'createdAt':_0x2757fe[_0xa6e2('0xb7')]};});var _0x347ec2=_['map'](values[_0xa6e2('0xba')],function(_0x4de7bd){return{'channel':_0xa6e2('0xbb'),'id':_0x4de7bd['id'],'createdAt':_0x4de7bd[_0xa6e2('0xb7')]};});var _0x450ff1=_[_0xa6e2('0x30')](values[_0xa6e2('0xbc')],function(_0x565077){return{'channel':'MAIL','id':_0x565077['id'],'createdAt':_0x565077[_0xa6e2('0xb7')]};});var _0x87ee3a=_[_0xa6e2('0x30')](values[_0xa6e2('0xbd')],function(_0x1895f1){return{'channel':_0xa6e2('0xbe'),'id':_0x1895f1['id'],'createdAt':_0x1895f1[_0xa6e2('0xb7')]};});var _0x1dd888=_['map'](values[_0xa6e2('0xbf')],function(_0x376a44){return{'channel':_0xa6e2('0xc0'),'id':_0x376a44['id'],'createdAt':_0x376a44[_0xa6e2('0xb7')]};});var _0x5c94cb=_[_0xa6e2('0xc1')](_0x1bf93a,_0x33609c,_0x347ec2,_0x450ff1,_0x87ee3a,_0x1dd888);var _0x55ee1b={'count':_0x5c94cb[_0xa6e2('0x4b')],'rows':_0x5c94cb};return _0x55ee1b;}else return null;})['then'](respondWithResult(_0x46a936,null))[_0xa6e2('0x51')](handleError(_0x46a936,null));};exports[_0xa6e2('0xc2')]=function(_0x4c923d,_0x4f875e){var _0x23f0b0={};return db[_0xa6e2('0x38')][_0xa6e2('0x91')]({'where':{'id':_0x4c923d[_0xa6e2('0x52')]['id']}})[_0xa6e2('0x27')](function(_0x3e38af){if(!_0x3e38af){throw new APINotFoundError(util[_0xa6e2('0xa2')](_0xa6e2('0xc3'),_0x4c923d[_0xa6e2('0x52')]['id']));}return contacts[_0xa6e2('0x59')]();})[_0xa6e2('0x27')](function(_0x181609){_0x4c923d[_0xa6e2('0x42')][_0xa6e2('0x38')]=_0x4c923d[_0xa6e2('0x52')]['id'];_0x23f0b0=qs['getOptions'](_0x181609,_0x4c923d);if(_0x4c923d[_0xa6e2('0x42')][_0xa6e2('0xc4')](_0xa6e2('0x53'))){_0x23f0b0[_0xa6e2('0x54')]=[{'model':db[_0xa6e2('0xc5')],'as':_0xa6e2('0xc6'),'required':![]},{'model':db[_0xa6e2('0xc7')],'as':_0xa6e2('0xc8'),'attributes':['id',_0xa6e2('0x34'),_0xa6e2('0xc9')],'where':_0x4c923d[_0xa6e2('0x42')][_0xa6e2('0xca')]?{'id':_0x4c923d[_0xa6e2('0x42')]['tag']}:undefined,'required':_0x4c923d[_0xa6e2('0x42')][_0xa6e2('0xca')]?!![]:![]}];}return contacts[_0xa6e2('0x48')](_0x4c923d[_0xa6e2('0x42')],_0x4c923d[_0xa6e2('0x2b')],_0x23f0b0,_0x181609);})['then'](respondWithFilteredResult(_0x4f875e,_0x23f0b0))['catch'](APIHandleError(_0x4f875e));};exports[_0xa6e2('0xcb')]=function(_0xd43f3d,_0x9b1565){var _0x3e5270;var _0x1ae1bc={};var _0x5f70e3;return db['User'][_0xa6e2('0x91')]({'where':{'id':_0xd43f3d[_0xa6e2('0x52')]['id']},'attributes':['id',_0xa6e2('0x34'),_0xa6e2('0x23')]})[_0xa6e2('0x27')](handleEntityNotFound(_0x9b1565,null))['then'](function(_0x85e5aa){if(!utils[_0xa6e2('0xa7')](_0xd43f3d[_0xa6e2('0x42')]['channel'])){throw new db[(_0xa6e2('0x8d'))][(_0xa6e2('0x8b'))](_0xa6e2('0x9b'));}_0x3e5270=_0x85e5aa;var _0x1fa6b9={};_0x1fa6b9['model']=_['keys'](db[_[_0xa6e2('0xa0')](_0xd43f3d['query']['channel'])+'Queue'][_0xa6e2('0x39')]);_0x1fa6b9[_0xa6e2('0x42')]=_[_0xa6e2('0xcc')](_0xd43f3d[_0xa6e2('0x42')]);_0x1fa6b9['filters']=_[_0xa6e2('0xcd')](_0x1fa6b9['model'],_0x1fa6b9[_0xa6e2('0x42')]);_0x1ae1bc[_0xa6e2('0x46')]=_['intersection'](_0x1fa6b9[_0xa6e2('0xce')],qs['fields'](_0xd43f3d[_0xa6e2('0x42')][_0xa6e2('0xcf')]));_0x1ae1bc[_0xa6e2('0x46')]=_0x1ae1bc[_0xa6e2('0x46')]['length']?_0x1ae1bc[_0xa6e2('0x46')]:_0x1fa6b9[_0xa6e2('0xce')];_0x1ae1bc[_0xa6e2('0xd0')]=qs[_0xa6e2('0xd1')](_0xd43f3d[_0xa6e2('0x42')][_0xa6e2('0xd1')]);_0x1ae1bc[_0xa6e2('0xd2')]=qs[_0xa6e2('0xd3')](_[_0xa6e2('0xd4')](_0xd43f3d[_0xa6e2('0x42')],_0x1fa6b9[_0xa6e2('0xd3')]));if(_0xd43f3d['query'][_0xa6e2('0xd5')]){_0x1ae1bc[_0xa6e2('0xd2')]=_[_0xa6e2('0x55')](_0x1ae1bc[_0xa6e2('0xd2')],{'$or':_['map'](_0x1ae1bc[_0xa6e2('0x46')],function(_0x313420){var _0x51fb77={};_0x51fb77[_0x313420]={'$like':'%'+_0xd43f3d[_0xa6e2('0x42')][_0xa6e2('0xd5')]+'%'};return _0x51fb77;})});}_0x1ae1bc=_['merge']({},_0x1ae1bc,_0xd43f3d[_0xa6e2('0x56')]);switch(_0x3e5270[_0xa6e2('0x23')]){case _0xa6e2('0x29'):return db[_['capitalize'](_0xd43f3d[_0xa6e2('0x42')][_0xa6e2('0x98')])+_0xa6e2('0xd6')][_0xa6e2('0x48')](_0x1ae1bc);case _0xa6e2('0x2b'):case _0xa6e2('0x24'):return _0x3e5270[_0xa6e2('0x28')+_['capitalize'](_0xd43f3d['query'][_0xa6e2('0x98')])+'Queues'](_0x1ae1bc);default:throw new db[(_0xa6e2('0x8d'))]['ValidationError'](_0xa6e2('0xd7'));}})[_0xa6e2('0x27')](function(_0x4ae5d2){_0x5f70e3=_0x4ae5d2[_0xa6e2('0x4b')];if(!_0xd43f3d[_0xa6e2('0x42')]['hasOwnProperty'](_0xa6e2('0xd8'))){_0x1ae1bc[_0xa6e2('0x1f')]=qs[_0xa6e2('0x1f')](_0xd43f3d[_0xa6e2('0x42')]['limit']);_0x1ae1bc['offset']=qs[_0xa6e2('0x1e')](_0xd43f3d[_0xa6e2('0x42')][_0xa6e2('0x1e')]);}switch(_0x3e5270[_0xa6e2('0x23')]){case _0xa6e2('0x29'):return db[_[_0xa6e2('0xa0')](_0xd43f3d[_0xa6e2('0x42')][_0xa6e2('0x98')])+_0xa6e2('0xd6')][_0xa6e2('0x48')](_0x1ae1bc);case _0xa6e2('0x2b'):case'agent':return _0x3e5270[_0xa6e2('0x28')+_[_0xa6e2('0xa0')](_0xd43f3d['query'][_0xa6e2('0x98')])+'Queues'](_0x1ae1bc);}})[_0xa6e2('0x27')](function(_0x443571){return{'count':_0x5f70e3,'rows':_0x443571};})[_0xa6e2('0x27')](respondWithResult(_0x9b1565,null))['catch'](handleError(_0x9b1565,null));};exports['getVoiceQueuesRt']=function(_0x30a562,_0x2406fd){var _0x5b16f0={};var _0x29119e={};var _0x326c2b;var _0x58595c;return db[_0xa6e2('0x38')][_0xa6e2('0x91')]({'where':{'id':_0x30a562['params']['id']}})[_0xa6e2('0x27')](handleEntityNotFound(_0x2406fd,null))[_0xa6e2('0x27')](function(_0x17f78f){if(_0x17f78f){_0x326c2b=_0x17f78f;_0x29119e[_0xa6e2('0xce')]=_[_0xa6e2('0xcc')](db['UserVoiceQueueRt'][_0xa6e2('0x39')]);_0x29119e[_0xa6e2('0x42')]=_['keys'](_0x30a562['query']);_0x29119e[_0xa6e2('0xd3')]=_['intersection'](_0x29119e[_0xa6e2('0xce')],_0x29119e[_0xa6e2('0x42')]);_0x5b16f0[_0xa6e2('0x46')]=_[_0xa6e2('0xcd')](_0x29119e['model'],qs[_0xa6e2('0xcf')](_0x30a562['query'][_0xa6e2('0xcf')]));_0x5b16f0['attributes']=_0x5b16f0[_0xa6e2('0x46')]['length']?_0x5b16f0[_0xa6e2('0x46')]:_0x29119e[_0xa6e2('0xce')];_0x5b16f0['order']=qs['sort'](_0x30a562[_0xa6e2('0x42')][_0xa6e2('0xd1')]);_0x5b16f0[_0xa6e2('0xd2')]=qs[_0xa6e2('0xd3')](_[_0xa6e2('0xd4')](_0x30a562['query'],_0x29119e[_0xa6e2('0xd3')]));if(_0x30a562[_0xa6e2('0x42')]['filter']){_0x5b16f0['where']=_[_0xa6e2('0x55')](_0x5b16f0[_0xa6e2('0xd2')],{'$or':_['map'](_0x5b16f0['attributes'],function(_0x1fc3d1){var _0x8c37de={};_0x8c37de[_0x1fc3d1]={'$like':'%'+_0x30a562['query']['filter']+'%'};return _0x8c37de;})});}_0x5b16f0=_[_0xa6e2('0x55')]({},_0x5b16f0,_0x30a562['options']);return _0x326c2b[_0xa6e2('0xd9')](_0x5b16f0);}})[_0xa6e2('0x27')](function(_0x1001d1){if(_0x1001d1){_0x58595c=_0x1001d1['length'];if(!_0x30a562[_0xa6e2('0x42')][_0xa6e2('0xc4')](_0xa6e2('0xd8'))){_0x5b16f0[_0xa6e2('0x1f')]=qs[_0xa6e2('0x1f')](_0x30a562['query'][_0xa6e2('0x1f')]);_0x5b16f0['offset']=qs['offset'](_0x30a562[_0xa6e2('0x42')][_0xa6e2('0x1e')]);}return _0x326c2b[_0xa6e2('0xd9')](_0x5b16f0);}})[_0xa6e2('0x27')](function(_0x4bce2d){if(_0x4bce2d){return _0x4bce2d?{'count':_0x58595c,'rows':_0x4bce2d}:null;}})[_0xa6e2('0x27')](respondWithResult(_0x2406fd,null))['catch'](handleError(_0x2406fd,null));};exports[_0xa6e2('0xda')]=function(_0x5ba983,_0x3a294a){var _0x1f16c2={};var _0x1ef8fe={};var _0x121a72;var _0x32dec3;return db['User'][_0xa6e2('0x91')]({'where':{'id':_0x5ba983[_0xa6e2('0x52')]['id']}})[_0xa6e2('0x27')](handleEntityNotFound(_0x3a294a,null))[_0xa6e2('0x27')](function(_0x32c4f0){if(_0x32c4f0){_0x121a72=_0x32c4f0;_0x1ef8fe[_0xa6e2('0xce')]=_[_0xa6e2('0xcc')](db['ChatGroup'][_0xa6e2('0x39')]);_0x1ef8fe[_0xa6e2('0x42')]=_[_0xa6e2('0xcc')](_0x5ba983[_0xa6e2('0x42')]);_0x1ef8fe[_0xa6e2('0xd3')]=_['intersection'](_0x1ef8fe[_0xa6e2('0xce')],_0x1ef8fe[_0xa6e2('0x42')]);_0x1f16c2[_0xa6e2('0x46')]=_[_0xa6e2('0xcd')](_0x1ef8fe[_0xa6e2('0xce')],qs[_0xa6e2('0xcf')](_0x5ba983[_0xa6e2('0x42')][_0xa6e2('0xcf')]));_0x1f16c2[_0xa6e2('0x46')]=_0x1f16c2['attributes'][_0xa6e2('0x4b')]?_0x1f16c2['attributes']:_0x1ef8fe['model'];_0x1f16c2['order']=qs[_0xa6e2('0xd1')](_0x5ba983[_0xa6e2('0x42')]['sort']);_0x1f16c2[_0xa6e2('0xd2')]=qs[_0xa6e2('0xd3')](_[_0xa6e2('0xd4')](_0x5ba983['query'],_0x1ef8fe[_0xa6e2('0xd3')]));if(_0x5ba983[_0xa6e2('0x42')]['filter']){_0x1f16c2[_0xa6e2('0xd2')]=_[_0xa6e2('0x55')](_0x1f16c2[_0xa6e2('0xd2')],{'$or':_[_0xa6e2('0x30')](_0x1f16c2['attributes'],function(_0x20c1d9){var _0x49a6eb={};_0x49a6eb[_0x20c1d9]={'$like':'%'+_0x5ba983[_0xa6e2('0x42')][_0xa6e2('0xd5')]+'%'};return _0x49a6eb;})});}_0x1f16c2=_[_0xa6e2('0x55')]({},_0x1f16c2,_0x5ba983['options']);return _0x121a72[_0xa6e2('0xda')](_0x1f16c2);}})[_0xa6e2('0x27')](function(_0x3e19d5){if(_0x3e19d5){_0x32dec3=_0x3e19d5['length'];if(!_0x5ba983[_0xa6e2('0x42')][_0xa6e2('0xc4')](_0xa6e2('0xd8'))){_0x1f16c2[_0xa6e2('0x1f')]=qs[_0xa6e2('0x1f')](_0x5ba983[_0xa6e2('0x42')][_0xa6e2('0x1f')]);_0x1f16c2[_0xa6e2('0x1e')]=qs[_0xa6e2('0x1e')](_0x5ba983['query'][_0xa6e2('0x1e')]);}return _0x121a72[_0xa6e2('0xda')](_0x1f16c2);}})['then'](function(_0x45e31d){if(_0x45e31d){return _0x45e31d?{'count':_0x32dec3,'rows':_0x45e31d}:null;}})[_0xa6e2('0x27')](respondWithResult(_0x3a294a,null))['catch'](handleError(_0x3a294a,null));};exports[_0xa6e2('0xdb')]=function(_0x5d00cf,_0x40b0b8){var _0x34d2e9={'raw':!![],'where':{}};var _0x5418fe={};var _0x48bdfc={'count':0x0,'rows':[]};return db[_0xa6e2('0x38')][_0xa6e2('0x91')]({'where':{'id':_0x5d00cf['params']['id']}})['then'](handleEntityNotFound(_0x40b0b8,null))['then'](function(_0x1f30e7){if(_0x1f30e7){_0x5418fe[_0xa6e2('0xce')]=_[_0xa6e2('0xcc')](db[_0xa6e2('0xdc')]['rawAttributes']);_0x5418fe[_0xa6e2('0x42')]=_['keys'](_0x5d00cf['query']);_0x5418fe[_0xa6e2('0xd3')]=_['intersection'](_0x5418fe['model'],_0x5418fe[_0xa6e2('0x42')]);_0x34d2e9['attributes']=_[_0xa6e2('0xcd')](_0x5418fe[_0xa6e2('0xce')],qs[_0xa6e2('0xcf')](_0x5d00cf[_0xa6e2('0x42')]['fields']));_0x34d2e9[_0xa6e2('0x46')]=_0x34d2e9[_0xa6e2('0x46')][_0xa6e2('0x4b')]?_0x34d2e9[_0xa6e2('0x46')]:_0x5418fe[_0xa6e2('0xce')];if(!_0x5d00cf[_0xa6e2('0x42')]['hasOwnProperty']('nolimit')){_0x34d2e9[_0xa6e2('0x1f')]=qs[_0xa6e2('0x1f')](_0x5d00cf[_0xa6e2('0x42')]['limit']);_0x34d2e9['offset']=qs[_0xa6e2('0x1e')](_0x5d00cf[_0xa6e2('0x42')][_0xa6e2('0x1e')]);}_0x34d2e9[_0xa6e2('0xd0')]=qs[_0xa6e2('0xd1')](_0x5d00cf['query']['sort']);_0x34d2e9['where']=qs['filters'](_[_0xa6e2('0xd4')](_0x5d00cf['query'],_0x5418fe[_0xa6e2('0xd3')]));_0x34d2e9[_0xa6e2('0xd2')][_0xa6e2('0xdd')]=_0x1f30e7['id'];if(_0x5d00cf[_0xa6e2('0x42')][_0xa6e2('0xd5')]){_0x34d2e9['where']=_['merge'](_0x34d2e9[_0xa6e2('0xd2')],{'$or':_[_0xa6e2('0x30')](_0x34d2e9['attributes'],function(_0x3ca3af){var _0x10ada9={};_0x10ada9[_0x3ca3af]={'$like':'%'+_0x5d00cf['query'][_0xa6e2('0xd5')]+'%'};return _0x10ada9;})});}_0x34d2e9=_[_0xa6e2('0x55')]({},_0x34d2e9,_0x5d00cf[_0xa6e2('0x56')]);return db[_0xa6e2('0xdc')][_0xa6e2('0x1d')]({'where':_0x34d2e9[_0xa6e2('0xd2')]})['then'](function(_0x3c901a){_0x48bdfc[_0xa6e2('0x1d')]=_0x3c901a;if(_0x5d00cf['query'][_0xa6e2('0x53')]){_0x34d2e9[_0xa6e2('0x54')]=[{'all':!![]}];}return db[_0xa6e2('0xdc')][_0xa6e2('0x48')](_0x34d2e9);})[_0xa6e2('0x27')](function(_0x5ac792){_0x48bdfc['rows']=_0x5ac792;return _0x48bdfc;});}})['then'](respondWithFilteredResult(_0x40b0b8,_0x34d2e9))[_0xa6e2('0x51')](handleError(_0x40b0b8,null));};exports[_0xa6e2('0xde')]=function(_0x17e602,_0x1494f5){var _0xba461c={'raw':!![],'where':{}};var _0x43f245={};var _0x442c6b={'count':0x0,'rows':[]};return db[_0xa6e2('0x38')][_0xa6e2('0x91')]({'where':{'id':_0x17e602[_0xa6e2('0x52')]['id']}})[_0xa6e2('0x27')](handleEntityNotFound(_0x1494f5,null))['then'](function(_0x52ee97){if(_0x52ee97){_0x43f245[_0xa6e2('0xce')]=_['keys'](db[_0xa6e2('0xdf')][_0xa6e2('0x39')]);_0x43f245['query']=_[_0xa6e2('0xcc')](_0x17e602[_0xa6e2('0x42')]);_0x43f245['filters']=_[_0xa6e2('0xcd')](_0x43f245[_0xa6e2('0xce')],_0x43f245[_0xa6e2('0x42')]);_0xba461c['attributes']=_[_0xa6e2('0xcd')](_0x43f245['model'],qs['fields'](_0x17e602[_0xa6e2('0x42')][_0xa6e2('0xcf')]));_0xba461c[_0xa6e2('0x46')]=_0xba461c[_0xa6e2('0x46')]['length']?_0xba461c[_0xa6e2('0x46')]:_0x43f245[_0xa6e2('0xce')];if(!_0x17e602[_0xa6e2('0x42')][_0xa6e2('0xc4')](_0xa6e2('0xd8'))){_0xba461c[_0xa6e2('0x1f')]=qs['limit'](_0x17e602[_0xa6e2('0x42')][_0xa6e2('0x1f')]);_0xba461c[_0xa6e2('0x1e')]=qs['offset'](_0x17e602[_0xa6e2('0x42')][_0xa6e2('0x1e')]);}_0xba461c[_0xa6e2('0xd0')]=qs[_0xa6e2('0xd1')](_0x17e602['query'][_0xa6e2('0xd1')]);_0xba461c[_0xa6e2('0xd2')]=qs[_0xa6e2('0xd3')](_[_0xa6e2('0xd4')](_0x17e602[_0xa6e2('0x42')],_0x43f245[_0xa6e2('0xd3')]));_0xba461c[_0xa6e2('0xd2')]['UserId']=_0x52ee97['id'];if(_0x17e602[_0xa6e2('0x42')][_0xa6e2('0xd5')]){_0xba461c[_0xa6e2('0xd2')]=_[_0xa6e2('0x55')](_0xba461c[_0xa6e2('0xd2')],{'$or':_[_0xa6e2('0x30')](_0xba461c[_0xa6e2('0x46')],function(_0x48ee70){var _0x369465={};_0x369465[_0x48ee70]={'$like':'%'+_0x17e602[_0xa6e2('0x42')][_0xa6e2('0xd5')]+'%'};return _0x369465;})});}_0xba461c=_[_0xa6e2('0x55')]({},_0xba461c,_0x17e602['options']);return db[_0xa6e2('0xdf')]['count']({'where':_0xba461c[_0xa6e2('0xd2')]})[_0xa6e2('0x27')](function(_0x41cb83){_0x442c6b['count']=_0x41cb83;if(_0x17e602[_0xa6e2('0x42')][_0xa6e2('0x53')]){_0xba461c['include']=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0xba461c);})[_0xa6e2('0x27')](function(_0x593fbb){_0x442c6b['rows']=_0x593fbb;return _0x442c6b;});}})[_0xa6e2('0x27')](respondWithFilteredResult(_0x1494f5,_0xba461c))[_0xa6e2('0x51')](handleError(_0x1494f5,null));};exports['getChatInteractions']=function(_0x11f3a2,_0xf02627){var _0x11a446={};var _0x53595e={};var _0x20cc40;var _0x5b2268;return db['User'][_0xa6e2('0x91')]({'where':{'id':_0x11f3a2['params']['id']}})[_0xa6e2('0x27')](handleEntityNotFound(_0xf02627,null))['then'](function(_0x52077d){if(_0x52077d){_0x20cc40=_0x52077d;_0x53595e['model']=_[_0xa6e2('0xcc')](db[_0xa6e2('0xe0')]['rawAttributes']);_0x53595e['query']=_[_0xa6e2('0xcc')](_0x11f3a2['query']);_0x53595e[_0xa6e2('0xd3')]=_['intersection'](_0x53595e[_0xa6e2('0xce')],_0x53595e['query']);_0x11a446[_0xa6e2('0x46')]=_[_0xa6e2('0xcd')](_0x53595e[_0xa6e2('0xce')],qs[_0xa6e2('0xcf')](_0x11f3a2['query']['fields']));_0x11a446[_0xa6e2('0x46')]=_0x11a446[_0xa6e2('0x46')]['length']?_0x11a446[_0xa6e2('0x46')]:_0x53595e[_0xa6e2('0xce')];_0x11a446[_0xa6e2('0xd0')]=qs[_0xa6e2('0xd1')](_0x11f3a2[_0xa6e2('0x42')][_0xa6e2('0xd1')]);_0x11a446[_0xa6e2('0xd2')]=qs['filters'](_[_0xa6e2('0xd4')](_0x11f3a2[_0xa6e2('0x42')],_0x53595e[_0xa6e2('0xd3')]));if(_0x11f3a2[_0xa6e2('0x42')][_0xa6e2('0xd5')]){_0x11a446[_0xa6e2('0xd2')]=_['merge'](_0x11a446[_0xa6e2('0xd2')],{'$or':_[_0xa6e2('0x30')](_0x11a446['attributes'],function(_0x13a6eb){var _0x425bdc={};_0x425bdc[_0x13a6eb]={'$like':'%'+_0x11f3a2['query']['filter']+'%'};return _0x425bdc;})});}_0x11a446=_[_0xa6e2('0x55')]({},_0x11a446,_0x11f3a2[_0xa6e2('0x56')]);return _0x20cc40['getChatInteractions'](_0x11a446);}})[_0xa6e2('0x27')](function(_0x21dc2a){if(_0x21dc2a){_0x5b2268=_0x21dc2a['length'];if(!_0x11f3a2[_0xa6e2('0x42')]['hasOwnProperty'](_0xa6e2('0xd8'))){_0x11a446[_0xa6e2('0x1f')]=qs[_0xa6e2('0x1f')](_0x11f3a2[_0xa6e2('0x42')][_0xa6e2('0x1f')]);_0x11a446['offset']=qs[_0xa6e2('0x1e')](_0x11f3a2['query']['offset']);}return _0x20cc40[_0xa6e2('0xe1')](_0x11a446);}})[_0xa6e2('0x27')](function(_0x3bcee7){if(_0x3bcee7){return _0x3bcee7?{'count':_0x5b2268,'rows':_0x3bcee7}:null;}})[_0xa6e2('0x27')](respondWithResult(_0xf02627,null))['catch'](handleError(_0xf02627,null));};exports[_0xa6e2('0xe2')]=function(_0x31c589,_0x5cdad0){var _0x4a2d4e={};var _0x2e6851={};var _0x572db8;var _0x5644bd;return db[_0xa6e2('0x38')]['findOne']({'where':{'id':_0x31c589[_0xa6e2('0x52')]['id']}})['then'](handleEntityNotFound(_0x5cdad0,null))[_0xa6e2('0x27')](function(_0x15f8ba){if(_0x15f8ba){_0x572db8=_0x15f8ba;_0x2e6851['model']=_[_0xa6e2('0xcc')](db['OpenchannelInteraction']['rawAttributes']);_0x2e6851[_0xa6e2('0x42')]=_[_0xa6e2('0xcc')](_0x31c589['query']);_0x2e6851[_0xa6e2('0xd3')]=_[_0xa6e2('0xcd')](_0x2e6851[_0xa6e2('0xce')],_0x2e6851[_0xa6e2('0x42')]);_0x4a2d4e[_0xa6e2('0x46')]=_[_0xa6e2('0xcd')](_0x2e6851['model'],qs[_0xa6e2('0xcf')](_0x31c589[_0xa6e2('0x42')][_0xa6e2('0xcf')]));_0x4a2d4e[_0xa6e2('0x46')]=_0x4a2d4e['attributes']['length']?_0x4a2d4e[_0xa6e2('0x46')]:_0x2e6851[_0xa6e2('0xce')];_0x4a2d4e[_0xa6e2('0xd0')]=qs[_0xa6e2('0xd1')](_0x31c589[_0xa6e2('0x42')][_0xa6e2('0xd1')]);_0x4a2d4e[_0xa6e2('0xd2')]=qs[_0xa6e2('0xd3')](_[_0xa6e2('0xd4')](_0x31c589['query'],_0x2e6851[_0xa6e2('0xd3')]));if(_0x31c589[_0xa6e2('0x42')][_0xa6e2('0xd5')]){_0x4a2d4e['where']=_[_0xa6e2('0x55')](_0x4a2d4e[_0xa6e2('0xd2')],{'$or':_[_0xa6e2('0x30')](_0x4a2d4e[_0xa6e2('0x46')],function(_0x108944){var _0x4e88e5={};_0x4e88e5[_0x108944]={'$like':'%'+_0x31c589[_0xa6e2('0x42')][_0xa6e2('0xd5')]+'%'};return _0x4e88e5;})});}_0x4a2d4e=_[_0xa6e2('0x55')]({},_0x4a2d4e,_0x31c589[_0xa6e2('0x56')]);return _0x572db8['getOpenchannelInteractions'](_0x4a2d4e);}})['then'](function(_0x44794e){if(_0x44794e){_0x5644bd=_0x44794e[_0xa6e2('0x4b')];if(!_0x31c589[_0xa6e2('0x42')]['hasOwnProperty']('nolimit')){_0x4a2d4e[_0xa6e2('0x1f')]=qs[_0xa6e2('0x1f')](_0x31c589['query'][_0xa6e2('0x1f')]);_0x4a2d4e[_0xa6e2('0x1e')]=qs[_0xa6e2('0x1e')](_0x31c589[_0xa6e2('0x42')][_0xa6e2('0x1e')]);}return _0x572db8['getOpenchannelInteractions'](_0x4a2d4e);}})[_0xa6e2('0x27')](function(_0x406b1f){if(_0x406b1f){return _0x406b1f?{'count':_0x5644bd,'rows':_0x406b1f}:null;}})['then'](respondWithResult(_0x5cdad0,null))[_0xa6e2('0x51')](handleError(_0x5cdad0,null));};exports[_0xa6e2('0xe3')]=function(_0xda8d07,_0x192105){var _0x3a5f9b={'raw':!![],'where':{}};var _0x5d76df={};var _0xefa494={'count':0x0,'rows':[]};return db[_0xa6e2('0x38')][_0xa6e2('0x91')]({'where':{'id':_0xda8d07[_0xa6e2('0x52')]['id']}})[_0xa6e2('0x27')](handleEntityNotFound(_0x192105,null))[_0xa6e2('0x27')](function(_0x2720ad){if(_0x2720ad){_0x5d76df[_0xa6e2('0xce')]=_[_0xa6e2('0xcc')](db[_0xa6e2('0xe4')][_0xa6e2('0x39')]);_0x5d76df['query']=_[_0xa6e2('0xcc')](_0xda8d07[_0xa6e2('0x42')]);_0x5d76df[_0xa6e2('0xd3')]=_[_0xa6e2('0xcd')](_0x5d76df[_0xa6e2('0xce')],_0x5d76df[_0xa6e2('0x42')]);_0x3a5f9b[_0xa6e2('0x46')]=_[_0xa6e2('0xcd')](_0x5d76df['model'],qs[_0xa6e2('0xcf')](_0xda8d07['query'][_0xa6e2('0xcf')]));_0x3a5f9b['attributes']=_0x3a5f9b[_0xa6e2('0x46')][_0xa6e2('0x4b')]?_0x3a5f9b[_0xa6e2('0x46')]:_0x5d76df[_0xa6e2('0xce')];if(!_0xda8d07[_0xa6e2('0x42')][_0xa6e2('0xc4')]('nolimit')){_0x3a5f9b['limit']=qs['limit'](_0xda8d07['query'][_0xa6e2('0x1f')]);_0x3a5f9b[_0xa6e2('0x1e')]=qs[_0xa6e2('0x1e')](_0xda8d07[_0xa6e2('0x42')][_0xa6e2('0x1e')]);}_0x3a5f9b[_0xa6e2('0xd0')]=qs[_0xa6e2('0xd1')](_0xda8d07[_0xa6e2('0x42')][_0xa6e2('0xd1')]);_0x3a5f9b[_0xa6e2('0xd2')]=qs[_0xa6e2('0xd3')](_[_0xa6e2('0xd4')](_0xda8d07[_0xa6e2('0x42')],_0x5d76df[_0xa6e2('0xd3')]));_0x3a5f9b['where'][_0xa6e2('0xdd')]=_0x2720ad['id'];if(_0xda8d07[_0xa6e2('0x42')]['filter']){_0x3a5f9b[_0xa6e2('0xd2')]=_['merge'](_0x3a5f9b['where'],{'$or':_[_0xa6e2('0x30')](_0x3a5f9b[_0xa6e2('0x46')],function(_0x446d4e){var _0x1481ac={};_0x1481ac[_0x446d4e]={'$like':'%'+_0xda8d07['query'][_0xa6e2('0xd5')]+'%'};return _0x1481ac;})});}_0x3a5f9b=_[_0xa6e2('0x55')]({},_0x3a5f9b,_0xda8d07[_0xa6e2('0x56')]);return db['MailInteraction'][_0xa6e2('0x1d')]({'where':_0x3a5f9b[_0xa6e2('0xd2')]})[_0xa6e2('0x27')](function(_0x3dc89f){_0xefa494[_0xa6e2('0x1d')]=_0x3dc89f;if(_0xda8d07[_0xa6e2('0x42')][_0xa6e2('0x53')]){_0x3a5f9b['include']=[{'all':!![]}];}return db[_0xa6e2('0xe4')]['findAll'](_0x3a5f9b);})[_0xa6e2('0x27')](function(_0x3e201c){_0xefa494['rows']=_0x3e201c;return _0xefa494;});}})[_0xa6e2('0x27')](respondWithFilteredResult(_0x192105,_0x3a5f9b))[_0xa6e2('0x51')](handleError(_0x192105,null));};exports[_0xa6e2('0xe5')]=function(_0x496fab,_0x19c880){var _0x1b793b={};var _0x4ce6da={};var _0x4ad2ab;var _0x5875ab;return db['User'][_0xa6e2('0x91')]({'where':{'id':_0x496fab[_0xa6e2('0x52')]['id']}})[_0xa6e2('0x27')](handleEntityNotFound(_0x19c880,null))['then'](function(_0x2d390a){if(_0x2d390a){_0x4ad2ab=_0x2d390a;_0x4ce6da[_0xa6e2('0xce')]=_[_0xa6e2('0xcc')](db[_0xa6e2('0xe6')][_0xa6e2('0x39')]);_0x4ce6da['query']=_[_0xa6e2('0xcc')](_0x496fab[_0xa6e2('0x42')]);_0x4ce6da[_0xa6e2('0xd3')]=_['intersection'](_0x4ce6da[_0xa6e2('0xce')],_0x4ce6da[_0xa6e2('0x42')]);_0x1b793b[_0xa6e2('0x46')]=_[_0xa6e2('0xcd')](_0x4ce6da[_0xa6e2('0xce')],qs['fields'](_0x496fab[_0xa6e2('0x42')][_0xa6e2('0xcf')]));_0x1b793b[_0xa6e2('0x46')]=_0x1b793b['attributes']['length']?_0x1b793b[_0xa6e2('0x46')]:_0x4ce6da[_0xa6e2('0xce')];_0x1b793b['order']=qs[_0xa6e2('0xd1')](_0x496fab[_0xa6e2('0x42')][_0xa6e2('0xd1')]);_0x1b793b[_0xa6e2('0xd2')]=qs[_0xa6e2('0xd3')](_[_0xa6e2('0xd4')](_0x496fab[_0xa6e2('0x42')],_0x4ce6da[_0xa6e2('0xd3')]));if(_0x496fab[_0xa6e2('0x42')][_0xa6e2('0xd5')]){_0x1b793b[_0xa6e2('0xd2')]=_[_0xa6e2('0x55')](_0x1b793b[_0xa6e2('0xd2')],{'$or':_[_0xa6e2('0x30')](_0x1b793b[_0xa6e2('0x46')],function(_0xd8754a){var _0xd507cc={};_0xd507cc[_0xd8754a]={'$like':'%'+_0x496fab[_0xa6e2('0x42')][_0xa6e2('0xd5')]+'%'};return _0xd507cc;})});}_0x1b793b=_[_0xa6e2('0x55')]({},_0x1b793b,_0x496fab[_0xa6e2('0x56')]);return _0x4ad2ab[_0xa6e2('0xe5')](_0x1b793b);}})[_0xa6e2('0x27')](function(_0x36842a){if(_0x36842a){_0x5875ab=_0x36842a['length'];if(!_0x496fab['query'][_0xa6e2('0xc4')](_0xa6e2('0xd8'))){_0x1b793b[_0xa6e2('0x1f')]=qs[_0xa6e2('0x1f')](_0x496fab[_0xa6e2('0x42')][_0xa6e2('0x1f')]);_0x1b793b['offset']=qs[_0xa6e2('0x1e')](_0x496fab['query']['offset']);}return _0x4ad2ab[_0xa6e2('0xe5')](_0x1b793b);}})[_0xa6e2('0x27')](function(_0x1fed79){if(_0x1fed79){return _0x1fed79?{'count':_0x5875ab,'rows':_0x1fed79}:null;}})[_0xa6e2('0x27')](respondWithResult(_0x19c880,null))[_0xa6e2('0x51')](handleError(_0x19c880,null));};exports['getFaxInteractions']=function(_0x3aa096,_0x7b2e0f){var _0x352374={};var _0x718345={};var _0x451ef9;var _0x51aaf4;return db[_0xa6e2('0x38')]['findOne']({'where':{'id':_0x3aa096[_0xa6e2('0x52')]['id']}})[_0xa6e2('0x27')](handleEntityNotFound(_0x7b2e0f,null))[_0xa6e2('0x27')](function(_0x15bc08){if(_0x15bc08){_0x451ef9=_0x15bc08;_0x718345[_0xa6e2('0xce')]=_['keys'](db[_0xa6e2('0xe7')][_0xa6e2('0x39')]);_0x718345[_0xa6e2('0x42')]=_['keys'](_0x3aa096['query']);_0x718345[_0xa6e2('0xd3')]=_[_0xa6e2('0xcd')](_0x718345['model'],_0x718345['query']);_0x352374[_0xa6e2('0x46')]=_['intersection'](_0x718345[_0xa6e2('0xce')],qs['fields'](_0x3aa096[_0xa6e2('0x42')][_0xa6e2('0xcf')]));_0x352374['attributes']=_0x352374[_0xa6e2('0x46')][_0xa6e2('0x4b')]?_0x352374[_0xa6e2('0x46')]:_0x718345[_0xa6e2('0xce')];_0x352374[_0xa6e2('0xd0')]=qs[_0xa6e2('0xd1')](_0x3aa096[_0xa6e2('0x42')][_0xa6e2('0xd1')]);_0x352374[_0xa6e2('0xd2')]=qs[_0xa6e2('0xd3')](_[_0xa6e2('0xd4')](_0x3aa096[_0xa6e2('0x42')],_0x718345[_0xa6e2('0xd3')]));if(_0x3aa096['query'][_0xa6e2('0xd5')]){_0x352374['where']=_[_0xa6e2('0x55')](_0x352374[_0xa6e2('0xd2')],{'$or':_[_0xa6e2('0x30')](_0x352374[_0xa6e2('0x46')],function(_0x388ea3){var _0xffa90e={};_0xffa90e[_0x388ea3]={'$like':'%'+_0x3aa096[_0xa6e2('0x42')]['filter']+'%'};return _0xffa90e;})});}_0x352374=_[_0xa6e2('0x55')]({},_0x352374,_0x3aa096[_0xa6e2('0x56')]);return _0x451ef9[_0xa6e2('0xe8')](_0x352374);}})['then'](function(_0x5ad6f1){if(_0x5ad6f1){_0x51aaf4=_0x5ad6f1['length'];if(!_0x3aa096['query'][_0xa6e2('0xc4')]('nolimit')){_0x352374['limit']=qs[_0xa6e2('0x1f')](_0x3aa096[_0xa6e2('0x42')][_0xa6e2('0x1f')]);_0x352374[_0xa6e2('0x1e')]=qs['offset'](_0x3aa096[_0xa6e2('0x42')][_0xa6e2('0x1e')]);}return _0x451ef9['getFaxInteractions'](_0x352374);}})[_0xa6e2('0x27')](function(_0x14dd86){if(_0x14dd86){return _0x14dd86?{'count':_0x51aaf4,'rows':_0x14dd86}:null;}})[_0xa6e2('0x27')](respondWithResult(_0x7b2e0f,null))[_0xa6e2('0x51')](handleError(_0x7b2e0f,null));};exports[_0xa6e2('0xe9')]=function(_0x37c258,_0x1eedc2){var _0x4c1cf4={};var _0x5dc24d={};var _0x349f5f;var _0xa250b0;return db[_0xa6e2('0x38')][_0xa6e2('0x91')]({'where':{'id':_0x37c258[_0xa6e2('0x52')]['id']}})['then'](handleEntityNotFound(_0x1eedc2,null))['then'](function(_0x369bdd){if(_0x369bdd){_0x349f5f=_0x369bdd;_0x5dc24d[_0xa6e2('0xce')]=_[_0xa6e2('0xcc')](db['WhatsappInteraction'][_0xa6e2('0x39')]);_0x5dc24d['query']=_['keys'](_0x37c258[_0xa6e2('0x42')]);_0x5dc24d[_0xa6e2('0xd3')]=_[_0xa6e2('0xcd')](_0x5dc24d[_0xa6e2('0xce')],_0x5dc24d[_0xa6e2('0x42')]);_0x4c1cf4[_0xa6e2('0x46')]=_[_0xa6e2('0xcd')](_0x5dc24d[_0xa6e2('0xce')],qs[_0xa6e2('0xcf')](_0x37c258['query']['fields']));_0x4c1cf4[_0xa6e2('0x46')]=_0x4c1cf4['attributes'][_0xa6e2('0x4b')]?_0x4c1cf4[_0xa6e2('0x46')]:_0x5dc24d[_0xa6e2('0xce')];_0x4c1cf4['order']=qs[_0xa6e2('0xd1')](_0x37c258[_0xa6e2('0x42')][_0xa6e2('0xd1')]);_0x4c1cf4[_0xa6e2('0xd2')]=qs[_0xa6e2('0xd3')](_['pick'](_0x37c258[_0xa6e2('0x42')],_0x5dc24d[_0xa6e2('0xd3')]));if(_0x37c258[_0xa6e2('0x42')][_0xa6e2('0xd5')]){_0x4c1cf4[_0xa6e2('0xd2')]=_[_0xa6e2('0x55')](_0x4c1cf4['where'],{'$or':_[_0xa6e2('0x30')](_0x4c1cf4[_0xa6e2('0x46')],function(_0xecdfc4){var _0x16bf7b={};_0x16bf7b[_0xecdfc4]={'$like':'%'+_0x37c258[_0xa6e2('0x42')][_0xa6e2('0xd5')]+'%'};return _0x16bf7b;})});}_0x4c1cf4=_[_0xa6e2('0x55')]({},_0x4c1cf4,_0x37c258[_0xa6e2('0x56')]);return _0x349f5f['getWhatsappInteractions'](_0x4c1cf4);}})[_0xa6e2('0x27')](function(_0x2c8890){if(_0x2c8890){_0xa250b0=_0x2c8890[_0xa6e2('0x4b')];if(!_0x37c258[_0xa6e2('0x42')][_0xa6e2('0xc4')](_0xa6e2('0xd8'))){_0x4c1cf4[_0xa6e2('0x1f')]=qs[_0xa6e2('0x1f')](_0x37c258[_0xa6e2('0x42')][_0xa6e2('0x1f')]);_0x4c1cf4[_0xa6e2('0x1e')]=qs[_0xa6e2('0x1e')](_0x37c258[_0xa6e2('0x42')][_0xa6e2('0x1e')]);}return _0x349f5f[_0xa6e2('0xe9')](_0x4c1cf4);}})['then'](function(_0x47c112){if(_0x47c112){return _0x47c112?{'count':_0xa250b0,'rows':_0x47c112}:null;}})[_0xa6e2('0x27')](respondWithResult(_0x1eedc2,null))[_0xa6e2('0x51')](handleError(_0x1eedc2,null));};exports[_0xa6e2('0xea')]=function(_0x3b1edc,_0x47b4d4,_0x57a52c){var _0x3be658;var _0x1b0f34;var _0x241a10;var _0x4e2f63=!_[_0xa6e2('0x65')](_0x3b1edc[_0xa6e2('0x52')]['id'])?_0x3b1edc[_0xa6e2('0x52')]['id']:!_[_0xa6e2('0x65')](_0x3b1edc[_0xa6e2('0x2b')]['id'])?_0x3b1edc[_0xa6e2('0x2b')]['id']:null;return db[_0xa6e2('0x38')][_0xa6e2('0x33')]({'where':{'id':_0x4e2f63,'role':{'$or':['admin',_0xa6e2('0x2b'),_0xa6e2('0x24')]}},'attributes':['id',_0xa6e2('0x34'),_0xa6e2('0xeb'),'mobile',_0xa6e2('0x23'),_0xa6e2('0x5c'),_0xa6e2('0xec')]})[_0xa6e2('0x27')](function(_0x147bf6){if(_0x147bf6){if(_0x147bf6['role']===_0xa6e2('0x24')){_0x3be658=_0x147bf6;if(_0x3b1edc[_0xa6e2('0x58')][_0xa6e2('0x9a')]){_0x241a10=util[_0xa6e2('0xa2')](_0xa6e2('0xed'),_0x3be658[_0x3b1edc[_0xa6e2('0x58')]['interface']]);}else if(_0x3b1edc[_0xa6e2('0x58')]['intrf']){_0x241a10=util[_0xa6e2('0xa2')](_0xa6e2('0xa3'),_0x3b1edc[_0xa6e2('0x58')][_0xa6e2('0xee')]);}else{_0x241a10=util[_0xa6e2('0xa2')](_0xa6e2('0xa3'),_0x3be658['name']);}socket['to'](util[_0xa6e2('0xa2')](_0xa6e2('0xef'),_0x3be658[_0xa6e2('0x34')]))[_0xa6e2('0x25')]('user:forcelogout',{'user':{'id':_0x3be658['id'],'name':_0x3be658[_0xa6e2('0x34')]},'ip':_0x3b1edc[_0xa6e2('0xf0')][_0xa6e2('0xf1')]||_0x3b1edc[_0xa6e2('0xf2')][_0xa6e2('0xf3')]||_0x3b1edc['socket']['remoteAddress']||_0x3b1edc[_0xa6e2('0xf2')][_0xa6e2('0xf4')][_0xa6e2('0xf3')]});return db[_0xa6e2('0xa4')][_0xa6e2('0x26')]({'where':{'membername':_0x3be658[_0xa6e2('0x34')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xa6e2('0x8b'))](_0xa6e2('0xf5'));}})[_0xa6e2('0x27')](function(){if(_0x3be658){return _0x3be658[_0xa6e2('0xf6')]({'raw':!![]});}})[_0xa6e2('0x27')](function(_0x59eda6){if(_0x3be658){if(_0x59eda6){_0x1b0f34=_0x59eda6;if(_0x1b0f34[_0xa6e2('0x4b')]){var _0x39b618=_0x1b0f34[_0xa6e2('0x30')](function(_0x20ccbe){var _0x569871={'membername':_0x3be658[_0xa6e2('0x34')],'UserId':_0x3be658['id'],'queue_name':_0x20ccbe[_0xa6e2('0x34')],'VoiceQueueId':_0x20ccbe['id'],'interface':_0x241a10,'paused':_0x3be658[_0xa6e2('0xec')]||![],'penalty':_0x20ccbe[_0xa6e2('0xf7')]||0x0};return db[_0xa6e2('0xa4')][_0xa6e2('0xa5')](_0x569871);});return Promise[_0xa6e2('0x84')](_0x39b618);}}}})['then'](function(){if(_0x3be658){return db[_0xa6e2('0xf8')][_0xa6e2('0x48')]({'where':{'membername':_0x3be658[_0xa6e2('0x34')],'exitAt':null}});}})[_0xa6e2('0x27')](function(_0x9bbb88){if(_0x3be658){var _0x1d5c28=[];_0x9bbb88[_0xa6e2('0xf9')](function(_0x2cd38a){_0x1d5c28[_0xa6e2('0x47')](_0x2cd38a['update']({'exitAt':moment()[_0xa6e2('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xa6e2('0x84')](_0x1d5c28);}})[_0xa6e2('0x27')](function(){if(_0x3be658){var _0x34aaef=[];var _0x4cfbb9=[];var _0x16d3a8=utils[_0xa6e2('0xfa')]();var _0x4129b3={'membername':_0x3be658[_0xa6e2('0x34')],'interface':_0x241a10,'enterAt':moment()[_0xa6e2('0xa2')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3be658[_0xa6e2('0x23')],'internal':_0x3be658[_0xa6e2('0x5c')]};_0x16d3a8[_0xa6e2('0xf9')](function(_0x4a937b){_0x34aaef['push'](_[_0xa6e2('0x55')]({'channel':_0x4a937b,'type':_0xa6e2('0xfb'),'data1':_0x3b1edc[_0xa6e2('0x58')][_0xa6e2('0xfc')],'data2':_0x241a10},_0x4129b3));if(_0x3be658[_0xa6e2('0xec')]){_0x4cfbb9[_0xa6e2('0x47')](_[_0xa6e2('0x55')]({'channel':_0x4a937b,'type':'PAUSE','data1':_0xa6e2('0xfd')},_0x4129b3));}});return db[_0xa6e2('0xf8')][_0xa6e2('0x81')](_0x34aaef[_0xa6e2('0xc1')](_0x4cfbb9),{'individualHooks':!![]});}})[_0xa6e2('0x27')](function(){if(_0x3be658){return _0x3be658[_0xa6e2('0x22')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3be658[_0xa6e2('0xec')]||![],'mailPause':_0x3be658[_0xa6e2('0xec')]||![],'chatPause':_0x3be658['loginInPause']||![],'faxPause':_0x3be658[_0xa6e2('0xec')]||![],'smsPause':_0x3be658[_0xa6e2('0xec')]||![],'openchannelPause':_0x3be658[_0xa6e2('0xec')]||![],'whatsappPause':_0x3be658[_0xa6e2('0xec')]||![],'pauseType':_0x3be658[_0xa6e2('0xec')]?_0xa6e2('0xfd'):null,'interface':_0x241a10,'lastPauseAt':moment()[_0xa6e2('0xa2')](_0xa6e2('0xfe'))});}})[_0xa6e2('0x27')](function(_0x50058f){if(_0x3b1edc[_0xa6e2('0xff')]){return _0x57a52c();}else{return Promise[_0xa6e2('0x100')](_0x50058f)['then'](respondWithResult(_0x47b4d4,null));}})['catch'](handleError(_0x47b4d4,null));};exports[_0xa6e2('0x101')]=function(_0x2613d1,_0x5891e1){var _0x1e353f;return db[_0xa6e2('0x38')][_0xa6e2('0x33')]({'where':{'id':_0x2613d1[_0xa6e2('0x52')]['id'],'role':_0xa6e2('0x24')},'attributes':['id','name',_0xa6e2('0x23')]})['then'](handleEntityNotFound(_0x5891e1,null))[_0xa6e2('0x27')](function(_0x65bd4a){if(_0x65bd4a){_0x1e353f=_0x65bd4a;return db[_0xa6e2('0xa4')][_0xa6e2('0x26')]({'where':{'membername':_0x1e353f[_0xa6e2('0x34')]},'individualHooks':!![]});}})[_0xa6e2('0x27')](function(){return db[_0xa6e2('0xf8')][_0xa6e2('0x48')]({'where':{'membername':_0x1e353f[_0xa6e2('0x34')],'exitAt':null}});})['then'](function(_0x3e425d){var _0x922ecf=[];_0x3e425d['forEach'](function(_0x52d652){_0x922ecf[_0xa6e2('0x47')](_0x52d652['update']({'exitAt':moment()[_0xa6e2('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x922ecf);})['then'](function(){return _0x1e353f[_0xa6e2('0x22')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xa6e2('0x27')](respondWithResult(_0x5891e1,null))[_0xa6e2('0x51')](handleError(_0x5891e1,null));};exports['pause']=function(_0xe0e13,_0x1e0a64){var _0x5d55c9;return db[_0xa6e2('0xa4')][_0xa6e2('0x22')]({'paused':0x1},{'where':{'UserId':_0xe0e13[_0xa6e2('0x52')]['id']},'individualHooks':!![]})['then'](function(){return db['User']['find']({'where':{'id':_0xe0e13[_0xa6e2('0x52')]['id'],'role':_0xa6e2('0x24')},'attributes':['id',_0xa6e2('0x34'),_0xa6e2('0x23'),'internal',_0xa6e2('0x9a'),_0xa6e2('0x102')]});})['then'](handleEntityNotFound(_0x1e0a64,null))[_0xa6e2('0x27')](function(_0xdf1dde){if(_0xdf1dde){_0x5d55c9=_0xdf1dde;return db['MemberReport'][_0xa6e2('0x48')]({'where':{'membername':_0x5d55c9[_0xa6e2('0x34')],'type':_0xa6e2('0x103'),'exitAt':null}});}})[_0xa6e2('0x27')](function(_0x4ada61){if(_0x4ada61[_0xa6e2('0x4b')]){var _0x5c160b=moment()['format'](_0xa6e2('0xfe'));for(var _0x42a85e=0x0,_0x2e98d5=_0x4ada61['length'];_0x42a85e<_0x2e98d5;_0x42a85e++){_0x4ada61[_0x42a85e][_0xa6e2('0x104')]({'exitAt':_0x5c160b});}}})[_0xa6e2('0x27')](function(){var _0x35ef7a=[];var _0x9536c8=utils[_0xa6e2('0xfa')]();_0x9536c8['forEach'](function(_0x419a1f){_0x35ef7a[_0xa6e2('0x47')]({'channel':_0x419a1f,'membername':_0x5d55c9[_0xa6e2('0x34')],'interface':_[_0xa6e2('0x65')](_0x5d55c9[_0xa6e2('0x9a')])?util[_0xa6e2('0xa2')]('SIP/%s',_0x5d55c9[_0xa6e2('0x34')]):_0x5d55c9[_0xa6e2('0x9a')],'type':'PAUSE','enterAt':moment()[_0xa6e2('0xa2')](_0xa6e2('0xfe')),'data1':_0xe0e13[_0xa6e2('0x58')]['type']||_0xa6e2('0x105'),'role':_0x5d55c9[_0xa6e2('0x23')],'internal':_0x5d55c9[_0xa6e2('0x5c')]});});return db[_0xa6e2('0xf8')][_0xa6e2('0x81')](_0x35ef7a,{'individualHooks':!![]});})[_0xa6e2('0x27')](function(){return _0x5d55c9[_0xa6e2('0x22')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xe0e13['body'][_0xa6e2('0x3b')]||_0xa6e2('0x105'),'lastPauseAt':moment()[_0xa6e2('0xa2')](_0xa6e2('0xfe'))});})['then'](respondWithResult(_0x1e0a64,null))['catch'](handleError(_0x1e0a64,null));};exports[_0xa6e2('0x106')]=function(_0x175231,_0x4fe63d){if(_0x175231[_0xa6e2('0x58')][_0xa6e2('0x98')]&&!utils[_0xa6e2('0xa7')](_0x175231['body'][_0xa6e2('0x98')])){throw new APIBadRequestError(util[_0xa6e2('0xa2')](_0xa6e2('0x107'),_0x175231[_0xa6e2('0x58')]['channel']));}return db['User']['find']({'where':{'id':_0x175231[_0xa6e2('0x52')]['id']},'attributes':['id',_0xa6e2('0x34'),_0xa6e2('0x23'),'internal',_0xa6e2('0x9a'),'online',_0xa6e2('0x99'),_0xa6e2('0x108'),_0xa6e2('0x109'),_0xa6e2('0x10a'),_0xa6e2('0x10b'),'smsPause','whatsappPause',_0xa6e2('0x10c'),_0xa6e2('0x10d')]})['then'](function(_0x301f64){if(!_0x301f64){throw new APINotFoundError(util[_0xa6e2('0xa2')](_0xa6e2('0xc3'),_0x175231[_0xa6e2('0x52')]['id']));}return _0x301f64[_0xa6e2('0x106')](_0x175231[_0xa6e2('0x58')][_0xa6e2('0x98')]);})['then'](respondWithResult(_0x4fe63d,null))[_0xa6e2('0x51')](APIHandleError(_0x4fe63d));};exports[_0xa6e2('0x10e')]=function(_0x2ad5be,_0x546555){var _0x63f051={};var _0x4eba8e={};var _0x50ec4f;var _0x536f79;return db['User'][_0xa6e2('0x91')]({'where':{'id':_0x2ad5be['params']['id']}})[_0xa6e2('0x27')](handleEntityNotFound(_0x546555,null))[_0xa6e2('0x27')](function(_0x3bda80){if(_0x3bda80){_0x50ec4f=_0x3bda80;_0x4eba8e[_0xa6e2('0xce')]=_[_0xa6e2('0xcc')](db[_0xa6e2('0x10f')][_0xa6e2('0x39')]);_0x4eba8e[_0xa6e2('0x42')]=_['keys'](_0x2ad5be[_0xa6e2('0x42')]);_0x4eba8e[_0xa6e2('0xd3')]=_['intersection'](_0x4eba8e[_0xa6e2('0xce')],_0x4eba8e[_0xa6e2('0x42')]);_0x63f051[_0xa6e2('0x46')]=_[_0xa6e2('0xcd')](_0x4eba8e[_0xa6e2('0xce')],qs[_0xa6e2('0xcf')](_0x2ad5be[_0xa6e2('0x42')][_0xa6e2('0xcf')]));_0x63f051['attributes']=_0x63f051[_0xa6e2('0x46')][_0xa6e2('0x4b')]?_0x63f051['attributes']:_0x4eba8e['model'];_0x63f051['order']=qs[_0xa6e2('0xd1')](_0x2ad5be['query'][_0xa6e2('0xd1')]);_0x63f051[_0xa6e2('0xd2')]=qs[_0xa6e2('0xd3')](_['pick'](_0x2ad5be[_0xa6e2('0x42')],_0x4eba8e[_0xa6e2('0xd3')]));if(_0x2ad5be[_0xa6e2('0x42')][_0xa6e2('0xd5')]){_0x63f051[_0xa6e2('0xd2')]=_[_0xa6e2('0x55')](_0x63f051['where'],{'$or':_[_0xa6e2('0x30')](_0x63f051[_0xa6e2('0x46')],function(_0x144a62){var _0x13a8ef={};_0x13a8ef[_0x144a62]={'$like':'%'+_0x2ad5be['query'][_0xa6e2('0xd5')]+'%'};return _0x13a8ef;})});}_0x63f051=_['merge']({},_0x63f051,_0x2ad5be[_0xa6e2('0x56')]);return _0x50ec4f['getTeams'](_0x63f051);}})[_0xa6e2('0x27')](function(_0x6f32cd){if(_0x6f32cd){_0x536f79=_0x6f32cd[_0xa6e2('0x4b')];if(!_0x2ad5be[_0xa6e2('0x42')][_0xa6e2('0xc4')](_0xa6e2('0xd8'))){_0x63f051[_0xa6e2('0x1f')]=qs[_0xa6e2('0x1f')](_0x2ad5be[_0xa6e2('0x42')][_0xa6e2('0x1f')]);_0x63f051[_0xa6e2('0x1e')]=qs[_0xa6e2('0x1e')](_0x2ad5be[_0xa6e2('0x42')][_0xa6e2('0x1e')]);}return _0x50ec4f[_0xa6e2('0x10e')](_0x63f051);}})[_0xa6e2('0x27')](function(_0xe6d8d6){if(_0xe6d8d6){return _0xe6d8d6?{'count':_0x536f79,'rows':_0xe6d8d6}:null;}})['then'](respondWithResult(_0x546555,null))[_0xa6e2('0x51')](handleError(_0x546555,null));};exports[_0xa6e2('0x110')]=function(_0x274999,_0x47a7d0){var _0x5eb347=_0x274999[_0xa6e2('0x52')]['id'];var _0x193328=_0x274999['body']?_0x274999[_0xa6e2('0x58')][_0xa6e2('0x5b')]:null;var _0x4a73f2=[];return Promise[_0xa6e2('0x100')]()['then'](function(){if(!_0x193328)throw new APIBadRequestError(_0xa6e2('0x111'));})['then'](function(){return db['User'][_0xa6e2('0x91')]({'where':{'id':_0x5eb347}});})[_0xa6e2('0x27')](function(_0x5bb3b9){if(!_0x5bb3b9)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x274999[_0xa6e2('0x52')]['id']));return db[_0xa6e2('0x61')]['transaction'](function(_0x8492b2){return _0x5bb3b9['addTeams'](_0x193328,{'transaction':_0x8492b2})['then'](function(){return db['Team'][_0xa6e2('0x48')]({'where':{'id':{'$in':_0x193328}}});})[_0xa6e2('0x27')](function(_0x55a53d){var _0x359078=_[_0xa6e2('0x30')](_0x55a53d,function(_0x382dc0){return _0x382dc0['getAssociatedQueues']();});return Promise['all'](_0x359078);})['then'](function(_0x25f00c){_0x4a73f2=_[_0xa6e2('0x112')](_0x25f00c);var _0x4249f3=_[_0xa6e2('0x30')](_0x4a73f2,function(_0x5ddf1f){return _0x5ddf1f[_0xa6e2('0x113')](_0x5bb3b9['id'],{'transaction':_0x8492b2});});return Promise['all'](_0x4249f3);})[_0xa6e2('0x27')](function(){if(!_0x5bb3b9['online'])return;var _0x5ac565=_[_0xa6e2('0xd5')](_0x4a73f2,function(_0xae8c64){return _0xae8c64[_0xa6e2('0x114')](_0xa6e2('0x98'))==='Voice';});var _0x5770e8=_[_0xa6e2('0x30')](_0x5ac565,function(_0x2b4f2c){return db[_0xa6e2('0xa4')][_0xa6e2('0xa5')]({'membername':_0x5bb3b9[_0xa6e2('0x34')],'UserId':_0x5bb3b9['id'],'queue_name':_0x2b4f2c[_0xa6e2('0x34')],'VoiceQueueId':_0x2b4f2c['id'],'interface':_[_0xa6e2('0x65')](_0x5bb3b9[_0xa6e2('0x9a')])?util[_0xa6e2('0xa2')]('SIP/%s',_0x5bb3b9[_0xa6e2('0x34')]):_0x5bb3b9['interface'],'paused':_0x5bb3b9[_0xa6e2('0x99')]||![],'penalty':_0x5bb3b9[_0xa6e2('0x9e')]},{'transaction':_0x8492b2});});return Promise[_0xa6e2('0x84')](_0x5770e8);})[_0xa6e2('0x27')](function(){return db[_0xa6e2('0x115')][_0xa6e2('0x48')]({'where':{'teamId':{'$in':_0x193328}}});})[_0xa6e2('0x27')](function(_0x31256a){var _0x40d53d=_[_0xa6e2('0x30')](_0x31256a,function(_0x44d865){return db['UserVoicePrefix']['create']({'UserId':_0x5bb3b9['id'],'VoicePrefixId':_0x44d865[_0xa6e2('0x116')]},{'transaction':_0x8492b2});});return Promise[_0xa6e2('0x84')](_0x40d53d);});});})[_0xa6e2('0x27')](function(){for(var _0x582821=0x0;_0x582821<_0x4a73f2[_0xa6e2('0x4b')];_0x582821++){var _0x1e4ef2=_0x4a73f2[_0x582821][_0xa6e2('0x114')](_0xa6e2('0x98'));var _0x2f8a05=_0x1e4ef2+_0xa6e2('0xab');socket['emit']('user'+_0x1e4ef2+_0xa6e2('0x117'),{'UserId':_0x5eb347,['queueField']:_0x4a73f2[_0x582821]['id']});}})['then'](respondWithStatusCode(_0x47a7d0,null))[_0xa6e2('0x51')](APIHandleError(_0x47a7d0));};exports[_0xa6e2('0x118')]=function(_0x1cd6a8,_0x59ced4){var _0x50c2ac=_0x1cd6a8['params']['id'];var _0x8ae1f5=null;if(_0x1cd6a8[_0xa6e2('0x42')][_0xa6e2('0x5b')]){_0x8ae1f5=_[_0xa6e2('0xa9')](_0x1cd6a8[_0xa6e2('0x42')][_0xa6e2('0x5b')])?_0x1cd6a8[_0xa6e2('0x42')]['ids']:[_0x1cd6a8[_0xa6e2('0x42')][_0xa6e2('0x5b')]];}var _0x49fae8=[];return Promise['resolve']()[_0xa6e2('0x27')](function(){if(!_0x8ae1f5)throw new APIBadRequestError(_0xa6e2('0x119'));})[_0xa6e2('0x27')](function(){return db[_0xa6e2('0x38')][_0xa6e2('0x91')]({'where':{'id':_0x50c2ac}});})[_0xa6e2('0x27')](function(_0x42aa43){if(!_0x42aa43)throw new APINotFoundError(util[_0xa6e2('0xa2')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1cd6a8[_0xa6e2('0x52')]['id']));return db[_0xa6e2('0x61')][_0xa6e2('0x11a')](function(_0x127154){return _0x42aa43[_0xa6e2('0x118')](_0x8ae1f5,{'transaction':_0x127154})['then'](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x8ae1f5}}});})[_0xa6e2('0x27')](function(_0xa5fb11){var _0x5c6009=_[_0xa6e2('0x30')](_0xa5fb11,function(_0x1583a9){return _0x1583a9['getAssociatedQueues']();});return Promise['all'](_0x5c6009);})[_0xa6e2('0x27')](function(_0x1a8ccf){_0x49fae8=_[_0xa6e2('0x112')](_0x1a8ccf);var _0x490ed8=_[_0xa6e2('0x30')](_0x49fae8,function(_0x45b9bc){return _0x45b9bc[_0xa6e2('0x11b')](_0x42aa43['id'],{'transaction':_0x127154});});return Promise[_0xa6e2('0x84')](_0x490ed8);})['then'](function(){if(!_0x42aa43[_0xa6e2('0x102')])return;var _0x317b51=_[_0xa6e2('0xd5')](_0x49fae8,function(_0xcd209d){return _0xcd209d['getDataValue'](_0xa6e2('0x98'))===_0xa6e2('0x11c');});var _0x3a1cdf=_[_0xa6e2('0x30')](_0x317b51,function(_0xe73d19){return db[_0xa6e2('0xa4')][_0xa6e2('0x26')]({'where':{'VoiceQueueId':_0xe73d19['id'],'UserId':_0x42aa43['id']},'transaction':_0x127154});});return Promise['all'](_0x3a1cdf);})[_0xa6e2('0x27')](function(){return db[_0xa6e2('0x115')][_0xa6e2('0x48')]({'where':{'teamId':{'$in':_0x8ae1f5}}});})[_0xa6e2('0x27')](function(_0x3483e3){var _0x599c00=_[_0xa6e2('0x30')](_0x3483e3,function(_0x35f1f5){return db[_0xa6e2('0x11d')][_0xa6e2('0x26')]({'where':{'UserId':_0x42aa43['id'],'VoicePrefixId':_0x35f1f5['VoicePrefixId']}},{'transaction':_0x127154});});return Promise[_0xa6e2('0x84')](_0x599c00);});});})[_0xa6e2('0x27')](function(){for(var _0x56bdcb=0x0;_0x56bdcb<_0x49fae8[_0xa6e2('0x4b')];_0x56bdcb++){var _0x3f5f22=_0x49fae8[_0x56bdcb][_0xa6e2('0x114')]('channel');var _0x76c43d=_0x3f5f22+_0xa6e2('0xab');socket['emit']('user'+_0x3f5f22+'Queue:remove',{'UserId':_0x50c2ac,['queueField']:_0x49fae8[_0x56bdcb]['id']});}})[_0xa6e2('0x27')](respondWithStatusCode(_0x59ced4,null))[_0xa6e2('0x51')](APIHandleError(_0x59ced4));};exports[_0xa6e2('0x11e')]=function(_0x41d573,_0x59eb31){var _0x5c8928={};var _0x2a807d={};var _0x290ae3;var _0x27ee29;return db[_0xa6e2('0x38')]['findOne']({'where':{'id':_0x41d573[_0xa6e2('0x52')]['id']}})['then'](handleEntityNotFound(_0x59eb31,null))[_0xa6e2('0x27')](function(_0x4db46d){if(_0x4db46d){_0x290ae3=_0x4db46d;_0x2a807d[_0xa6e2('0xce')]=_[_0xa6e2('0xcc')](db['CmList']['rawAttributes']);_0x2a807d[_0xa6e2('0x42')]=_[_0xa6e2('0xcc')](_0x41d573['query']);_0x2a807d[_0xa6e2('0xd3')]=_[_0xa6e2('0xcd')](_0x2a807d[_0xa6e2('0xce')],_0x2a807d[_0xa6e2('0x42')]);_0x5c8928[_0xa6e2('0x46')]=_[_0xa6e2('0xcd')](_0x2a807d[_0xa6e2('0xce')],qs[_0xa6e2('0xcf')](_0x41d573[_0xa6e2('0x42')]['fields']));_0x5c8928[_0xa6e2('0x46')]=_0x5c8928[_0xa6e2('0x46')][_0xa6e2('0x4b')]?_0x5c8928[_0xa6e2('0x46')]:_0x2a807d[_0xa6e2('0xce')];_0x5c8928['order']=qs[_0xa6e2('0xd1')](_0x41d573['query'][_0xa6e2('0xd1')]);_0x5c8928[_0xa6e2('0xd2')]=qs[_0xa6e2('0xd3')](_[_0xa6e2('0xd4')](_0x41d573[_0xa6e2('0x42')],_0x2a807d['filters']));if(_0x41d573['query'][_0xa6e2('0xd5')]){_0x5c8928['where']=_[_0xa6e2('0x55')](_0x5c8928[_0xa6e2('0xd2')],{'$or':_[_0xa6e2('0x30')](_0x5c8928['attributes'],function(_0x36efde){var _0x239736={};_0x239736[_0x36efde]={'$like':'%'+_0x41d573[_0xa6e2('0x42')][_0xa6e2('0xd5')]+'%'};return _0x239736;})});}_0x5c8928=_[_0xa6e2('0x55')]({},_0x5c8928,_0x41d573[_0xa6e2('0x56')]);return _0x290ae3['getLists'](_0x5c8928);}})[_0xa6e2('0x27')](function(_0x439a8f){if(_0x439a8f){_0x27ee29=_0x439a8f[_0xa6e2('0x4b')];if(!_0x41d573[_0xa6e2('0x42')][_0xa6e2('0xc4')](_0xa6e2('0xd8'))){_0x5c8928['limit']=qs[_0xa6e2('0x1f')](_0x41d573[_0xa6e2('0x42')][_0xa6e2('0x1f')]);_0x5c8928[_0xa6e2('0x1e')]=qs[_0xa6e2('0x1e')](_0x41d573[_0xa6e2('0x42')][_0xa6e2('0x1e')]);}return _0x290ae3['getLists'](_0x5c8928);}})['then'](function(_0x56df2e){if(_0x56df2e){return _0x56df2e?{'count':_0x27ee29,'rows':_0x56df2e}:null;}})[_0xa6e2('0x27')](respondWithResult(_0x59eb31,null))[_0xa6e2('0x51')](handleError(_0x59eb31,null));};exports[_0xa6e2('0x11f')]=function(_0x452b18,_0x58eb74){var _0x1aded9={};var _0x42df90={};var _0x4634c1;return db['User']['findOne']({'where':{'id':_0x452b18[_0xa6e2('0x52')]['id']}})[_0xa6e2('0x27')](handleEntityNotFound(_0x58eb74,null))[_0xa6e2('0x27')](function(_0x41e749){if(_0x41e749){_0x4634c1=_0x41e749;_0x42df90[_0xa6e2('0xce')]=_[_0xa6e2('0xcc')](db[_0xa6e2('0x38')]['rawAttributes']);_0x42df90[_0xa6e2('0x42')]=_['keys'](_0x452b18[_0xa6e2('0x42')]);_0x42df90[_0xa6e2('0xd3')]=_[_0xa6e2('0xcd')](_0x42df90[_0xa6e2('0xce')],_0x42df90[_0xa6e2('0x42')]);_0x1aded9[_0xa6e2('0x46')]=_[_0xa6e2('0xcd')](_0x42df90['model'],qs[_0xa6e2('0xcf')](_0x452b18[_0xa6e2('0x42')][_0xa6e2('0xcf')]));_0x1aded9[_0xa6e2('0x46')]=_0x1aded9['attributes'][_0xa6e2('0x4b')]?_0x1aded9['attributes']:_0x42df90['model'];_0x1aded9[_0xa6e2('0xd0')]=qs[_0xa6e2('0xd1')](_0x452b18[_0xa6e2('0x42')]['sort']);_0x1aded9['where']=qs[_0xa6e2('0xd3')](_[_0xa6e2('0xd4')](_0x452b18['query'],_0x42df90['filters']));if(_0x452b18[_0xa6e2('0x42')][_0xa6e2('0xd5')]){_0x1aded9[_0xa6e2('0xd2')]=_[_0xa6e2('0x55')](_0x1aded9[_0xa6e2('0xd2')],{'$or':_[_0xa6e2('0x30')](_0x1aded9[_0xa6e2('0x46')],function(_0x51ae9d){var _0x18a609={};_0x18a609[_0x51ae9d]={'$like':'%'+_0x452b18[_0xa6e2('0x42')]['filter']+'%'};return _0x18a609;})});}_0x1aded9[_0xa6e2('0xce')]=db[_0xa6e2('0x38')];_0x1aded9['as']=_0xa6e2('0x2c');_0x1aded9=_[_0xa6e2('0x55')]({},_0x1aded9,_0x452b18[_0xa6e2('0x56')]);return _0x4634c1['getVoiceQueues']({'include':[_0x1aded9]});}})[_0xa6e2('0x27')](function(_0x1210ea){if(_0x1210ea){var _0x45044b={},_0xf381d6=[];for(var _0x12975f=0x0;_0x12975f<_0x1210ea['length'];_0x12975f+=0x1){for(var _0x2691ac=0x0,_0x45dffd;_0x2691ac<_0x1210ea[_0x12975f][_0xa6e2('0x2c')]['length'];_0x2691ac+=0x1){_0x45dffd=_0x1210ea[_0x12975f][_0xa6e2('0x2c')][_0x2691ac][_0xa6e2('0x28')]({'plain':!![]});_0x45044b[_0x45dffd['id']]=_0x45dffd;}}_0x45044b=_[_0xa6e2('0x120')](_0x45044b);for(var _0xfbd779=qs['offset'](_0x452b18['query'][_0xa6e2('0x1e')]);_0xfbd779<_0x45044b[_0xa6e2('0x4b')]&&_0xf381d6[_0xa6e2('0x4b')]=_0x1bbeb0){_0x403c27=_0x1bbeb0;_0x464523=0xc8;}else{_0x464523=0xce;}_0x375986[_0xb1be('0x13')](_0x464523);return _0x375986[_0xb1be('0x18')](_0xb1be('0x19'),_0xc1cd51+'-'+_0x403c27+'/'+_0x1bbeb0)['json'](_0x520775);}return null;};}function saveUpdates(_0x3edd7d){return function(_0x191853){if(_0x191853){return _0x191853[_0xb1be('0x1a')](_0x3edd7d)[_0xb1be('0x1b')](function(_0x368c2a){if(_0x368c2a['role']===_0xb1be('0x1c')){socket[_0xb1be('0x1d')](_0xb1be('0x1e')+_0x368c2a['id'],_0x368c2a);}return _0x368c2a;});}return null;};}function removeEntity(_0x1c6a2d){return function(_0x188d6a){if(_0x188d6a){return _0x188d6a[_0xb1be('0x1f')]()[_0xb1be('0x1b')](function(){var _0x456c59=_0x188d6a[_0xb1be('0x20')]({'plain':!![]});if(_0x456c59[_0xb1be('0x21')]==='admin')return;var _0x19d292=[{'name':_0xb1be('0x22'),'value':_0xb1be('0x23'),'ignore':!![]},{'name':_0xb1be('0x24'),'value':_0xb1be('0x1c'),'ignore':![]},{'name':_0xb1be('0x25'),'value':_0xb1be('0x26'),'ignore':![]}];var _0x310884=_(_0x19d292)[_0xb1be('0x27')](_0xb1be('0x28'))[_0xb1be('0x29')](_0xb1be('0x2a'))[_0xb1be('0x2a')]();if(_[_0xb1be('0x2b')](_0x310884,_0x456c59['role'])){return;}var _0x330ff1=_[_0xb1be('0x2c')](_0x19d292,['value',_0x456c59[_0xb1be('0x21')]])[_0xb1be('0x2d')];return db[_0xb1be('0x2e')][_0xb1be('0x1f')]({'where':{'type':_0x330ff1,'resourceId':_0x456c59['id']}})[_0xb1be('0x1b')](function(){return _0x188d6a;});})[_0xb1be('0x1b')](function(){_0x1c6a2d['status'](0xcc)[_0xb1be('0x14')]();});}};}function handleEntityNotFound(_0x56b209){return function(_0x524cd4){if(!_0x524cd4){_0x56b209[_0xb1be('0x12')](0x194);}return _0x524cd4;};}function handleError(_0x3c377f,_0x2614e1){_0x2614e1=_0x2614e1||0x1f4;return function(_0x31eed1){logger[_0xb1be('0x2f')](_0x31eed1[_0xb1be('0x30')]);if(_0x31eed1[_0xb1be('0x2d')]){delete _0x31eed1[_0xb1be('0x2d')];}_0x3c377f[_0xb1be('0x13')](_0x2614e1)['send'](_0x31eed1);};}function getUserAttributes(){return _(db[_0xb1be('0x31')][_0xb1be('0x32')])[_0xb1be('0x29')](function(_0x131257){return{'name':_0x131257['fieldName'],'type':_0x131257[_0xb1be('0x33')][_0xb1be('0x34')]};})[_0xb1be('0x27')](function(_0x243a3d){return![_0xb1be('0x35'),'salt','previousPasswords',_0xb1be('0x36'),'resetPasswordExpires',_0xb1be('0x37')][_0xb1be('0x2b')](_0x243a3d[_0xb1be('0x2d')]);})['value']();}exports['index']=function(_0x9f9de6,_0x1e5ad3){var _0xcb7f29={},_0x4a2bcb={'count':0x0,'rows':[]};var _0x4f7191=getUserAttributes();_0xcb7f29=qs[_0xb1be('0x38')](_0x4f7191,_0x9f9de6);var _0x5ab2ef={'where':_0xcb7f29[_0xb1be('0x39')]};return db['User'][_0xb1be('0x16')](_0x5ab2ef)[_0xb1be('0x1b')](function(_0xe2b35b){_0x4a2bcb[_0xb1be('0x16')]=_0xe2b35b;if(_0x9f9de6[_0xb1be('0x3a')][_0xb1be('0x3b')]){_0xcb7f29[_0xb1be('0x3c')]=[{'all':!![]}];}if(_0x9f9de6['query']['userSetting']===_0xb1be('0x3d')){_0xcb7f29[_0xb1be('0x3c')]=[{'model':db[_0xb1be('0x3e')],'as':_0xb1be('0x3f')}];}if(!_[_0xb1be('0x2b')](_0xcb7f29[_0xb1be('0x40')],'id')){_0xcb7f29[_0xb1be('0x40')][_0xb1be('0x41')]('id');}return db[_0xb1be('0x31')][_0xb1be('0x42')](_0xcb7f29);})[_0xb1be('0x1b')](function(_0x28d6a0){_0x4a2bcb[_0xb1be('0x43')]=_0x28d6a0;if(_0x9f9de6['query'][_0xb1be('0x44')]==='true'){var _0x190a61=[];for(var _0x95d470=0x0;_0x95d470<_0x4a2bcb['rows']['length'];_0x95d470++){_0x190a61[_0xb1be('0x41')](get_open_tabs(_0xb1be('0x45'),_0x4a2bcb[_0xb1be('0x43')][_0x95d470][_0xb1be('0x46')]));_0x190a61[_0xb1be('0x41')](get_open_tabs('sms',_0x4a2bcb[_0xb1be('0x43')][_0x95d470][_0xb1be('0x46')]));_0x190a61['push'](get_open_tabs('fax',_0x4a2bcb[_0xb1be('0x43')][_0x95d470]['dataValues']));_0x190a61[_0xb1be('0x41')](get_open_tabs(_0xb1be('0x47'),_0x4a2bcb[_0xb1be('0x43')][_0x95d470][_0xb1be('0x46')]));_0x190a61[_0xb1be('0x41')](get_open_tabs('openchannel',_0x4a2bcb[_0xb1be('0x43')][_0x95d470][_0xb1be('0x46')]));_0x190a61[_0xb1be('0x41')](get_open_tabs(_0xb1be('0x48'),_0x4a2bcb['rows'][_0x95d470][_0xb1be('0x46')]));}return Promise['all'](_0x190a61)['then'](function(){return _0x4a2bcb;});}else{return _0x4a2bcb;}})[_0xb1be('0x1b')](respondWithFilteredResult(_0x1e5ad3,_0xcb7f29))[_0xb1be('0x49')](handleError(_0x1e5ad3,null));};exports[_0xb1be('0x4a')]=function(_0x111c84,_0x1a963f){var _0x1bb4ef=getUserAttributes();_0x111c84[_0xb1be('0x3a')]['id']=_0x111c84[_0xb1be('0x4b')]['id'];var _0x1f276e=qs[_0xb1be('0x38')](_0x1bb4ef,_0x111c84);if(_0x111c84[_0xb1be('0x3a')]['includeAll']){_0x1f276e['include']=[{'all':!![]}];}if(_0x111c84[_0xb1be('0x3a')]['userSetting']===_0xb1be('0x3d')){_0x1f276e[_0xb1be('0x3c')]=[{'model':db[_0xb1be('0x3e')],'as':_0xb1be('0x3f')}];}_0x1f276e=_[_0xb1be('0x4c')]({},_0x1f276e,_0x111c84['options']);if(!_[_0xb1be('0x2b')](_0x1f276e[_0xb1be('0x40')],'id')){_0x1f276e[_0xb1be('0x40')][_0xb1be('0x41')]('id');}return db[_0xb1be('0x31')][_0xb1be('0x2c')](_0x1f276e)[_0xb1be('0x1b')](handleEntityNotFound(_0x1a963f,null))[_0xb1be('0x1b')](function(_0xdf86d4){var _0x15577b=[];values=_0xdf86d4;if(_0x111c84[_0xb1be('0x3a')][_0xb1be('0x44')]===_0xb1be('0x3d')){_0x15577b[_0xb1be('0x41')](get_open_tabs(_0xb1be('0x45'),_0xdf86d4[_0xb1be('0x46')]));_0x15577b[_0xb1be('0x41')](get_open_tabs(_0xb1be('0x4d'),_0xdf86d4[_0xb1be('0x46')]));_0x15577b[_0xb1be('0x41')](get_open_tabs(_0xb1be('0x4e'),_0xdf86d4[_0xb1be('0x46')]));_0x15577b[_0xb1be('0x41')](get_open_tabs(_0xb1be('0x48'),_0xdf86d4['dataValues']));_0x15577b[_0xb1be('0x41')](get_open_tabs(_0xb1be('0x4f'),_0xdf86d4[_0xb1be('0x46')]));_0x15577b[_0xb1be('0x41')](get_open_tabs(_0xb1be('0x47'),_0xdf86d4[_0xb1be('0x46')]));return Promise[_0xb1be('0x50')](_0x15577b);}else{return values;}})['then'](function(){return values;})['then'](respondWithResult(_0x1a963f,null))[_0xb1be('0x49')](handleError(_0x1a963f,null));};exports[_0xb1be('0x1a')]=function(_0x99e9db,_0x66636){if(_0x99e9db[_0xb1be('0x51')]['id']){delete _0x99e9db[_0xb1be('0x51')]['id'];}delete _0x99e9db[_0xb1be('0x51')][_0xb1be('0x21')];return db['User'][_0xb1be('0x2c')]({'where':{'id':_0x99e9db['params']['id']}})[_0xb1be('0x1b')](handleEntityNotFound(_0x66636,null))[_0xb1be('0x1b')](saveUpdates(_0x99e9db['body'],null))[_0xb1be('0x1b')](respondWithResult(_0x66636,null))['catch'](handleError(_0x66636,null));};exports['describe']=function(_0x234ecc,_0x4d5289){return db[_0xb1be('0x31')][_0xb1be('0x52')]()['then'](respondWithResult(_0x4d5289,null))[_0xb1be('0x49')](handleError(_0x4d5289,null));};exports[_0xb1be('0x53')]=function(_0x1ef90b,_0x2751ee){return db[_0xb1be('0x31')][_0xb1be('0x2c')]({'where':{'id':_0x1ef90b[_0xb1be('0x4b')]['id']}})[_0xb1be('0x1b')](handleEntityNotFound(_0x2751ee,null))[_0xb1be('0x1b')](function(_0x536015){if(_0x536015){return _0x536015['addContacts'](_0x1ef90b[_0xb1be('0x51')][_0xb1be('0x54')],_['omit'](_0x1ef90b[_0xb1be('0x51')],[_0xb1be('0x54'),'id'])||{});}})['then'](respondWithResult(_0x2751ee,null))[_0xb1be('0x49')](handleError(_0x2751ee,null));};function validateUser(_0x2dbffc){return new Promise(function(_0x95db6e,_0x153931){if(_0x2dbffc['internal'])return _0x95db6e(_0x2dbffc);return db[_0xb1be('0x55')]['findById'](0x1)[_0xb1be('0x1b')](function(_0x38d304){if(_0x38d304[_0xb1be('0x56')])authService[_0xb1be('0x57')](_0x2dbffc['password']);db['User'][_0xb1be('0x58')]('internal')[_0xb1be('0x1b')](function(_0x2dd83c){if(_[_0xb1be('0x59')](_0x2dd83c)){_0x2dbffc['internal']=_0x38d304[_0xb1be('0x5a')]||0x1;return;}if(_[_0xb1be('0x59')](_0x38d304[_0xb1be('0x5a')])||_0x38d304['min_internal']===_0x2dd83c){_0x2dbffc[_0xb1be('0x5b')]=_0x2dd83c+0x1;return;}if(_0x38d304[_0xb1be('0x5a')]>_0x2dd83c){_0x2dbffc['internal']=_0x38d304[_0xb1be('0x5a')];return;}return db['sequelize'][_0xb1be('0x3a')](_0xb1be('0x5c'),{'type':db['sequelize']['QueryTypes'][_0xb1be('0x5d')]})[_0xb1be('0x1b')](function(_0x2f3d49){if(_0x2f3d49&&_0x2f3d49[_0xb1be('0x5e')]){for(var _0x12cf25=0x0,_0x5bec1b=_0x2f3d49['length'];_0x12cf25<_0x5bec1b&&_['isNil'](_0x2dbffc[_0xb1be('0x5b')]);_0x12cf25++){if(_0x38d304[_0xb1be('0x5a')]<=_0x2f3d49[_0x12cf25][_0xb1be('0x5f')]){_0x2dbffc['internal']=_0x2f3d49[_0x12cf25][_0xb1be('0x5f')];}else if(_0x38d304['min_internal']>_0x2f3d49[_0x12cf25][_0xb1be('0x5f')]&&_0x38d304['min_internal']<=_0x2f3d49[_0x12cf25]['to']){_0x2dbffc[_0xb1be('0x5b')]=_0x38d304['min_internal'];}}}if(_['isNil'](_0x2dbffc[_0xb1be('0x5b')])){_0x2dbffc[_0xb1be('0x5b')]=_0x2dd83c+0x1;}return _0x95db6e(_0x2dbffc);});});})[_0xb1be('0x49')](function(_0x9e553d){_0x153931(_0x9e553d);});});}function updateUser(_0x2fd519){return new Promise(function(_0x4a331b,_0x1e047e){try{if(_0x2fd519[_0xb1be('0x60')]){_0x2fd519[_0xb1be('0x61')]=_0x2fd519[_0xb1be('0x5b')];_0x2fd519[_0xb1be('0x62')]={'mailbox':_0x2fd519[_0xb1be('0x5b')],'password':_0x2fd519[_0xb1be('0x35')],'fullname':_0x2fd519[_0xb1be('0x63')],'email':_0x2fd519[_0xb1be('0x64')]};}if(_0x2fd519[_0xb1be('0x21')]===_0xb1be('0x1c')){if(!_0x2fd519[_0xb1be('0x65')])_0x2fd519[_0xb1be('0x65')]=['101',_0xb1be('0x66'),_0xb1be('0x67'),_0xb1be('0x68'),_0xb1be('0x69'),_0xb1be('0x6a'),_0xb1be('0x6b'),_0xb1be('0x6c'),'107',_0xb1be('0x6d'),_0xb1be('0x6e'),'100',_0xb1be('0x6f'),_0xb1be('0x70'),_0xb1be('0x71')];}_0x4a331b(_0x2fd519);}catch(_0x3f2954){_0x1e047e(_0x3f2954);}});}exports[_0xb1be('0x72')]=function(_0x537716,_0x6558b4){if(_0x537716['user'][_0xb1be('0x21')]===_0xb1be('0x1c'))throw new Error(_0xb1be('0x73'));if(_0x537716[_0xb1be('0x51')][_0xb1be('0x21')]===_0xb1be('0x23')&&_0x537716[_0xb1be('0x23')][_0xb1be('0x21')]!==_0xb1be('0x74')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x537716[_0xb1be('0x51')]['role']===_0xb1be('0x74')&&_0x537716[_0xb1be('0x23')][_0xb1be('0x21')]!=='admin'){throw new Error(_0xb1be('0x75'));}return licenseUtil['checkUserLimits']([_0x537716[_0xb1be('0x51')]])['then'](function(){return validateUser(_0x537716[_0xb1be('0x51')]);})['then'](function(_0x5956c7){return updateUser(_0x5956c7)[_0xb1be('0x1b')](function(_0x59a5e4){if(_0x59a5e4[_0xb1be('0x21')]===_0xb1be('0x74')){_0x59a5e4[_0xb1be('0x76')]=_0x537716[_0xb1be('0x23')][_0xb1be('0x76')];delete _0x59a5e4['userProfileId'];}return _0x59a5e4;});})[_0xb1be('0x1b')](function(_0x13ae14){return db[_0xb1be('0x31')]['create'](_0x13ae14,{'include':[{'model':db[_0xb1be('0x62')],'as':_0xb1be('0x62')}]});})[_0xb1be('0x1b')](function(_0xb04479){if(_0x537716[_0xb1be('0x51')][_0xb1be('0x21')]===_0xb1be('0x23'))return _0xb04479;if(_0x537716[_0xb1be('0x23')][_0xb1be('0x21')]!==_0xb1be('0x23'))return _0xb04479;return db['UserProfileSection'][_0xb1be('0x2c')]({'where':{'name':_0xb04479[_0xb1be('0x21')]===_0xb1be('0x1c')?_0xb1be('0x24'):_0xb1be('0x25'),'userProfileId':_0x537716['user'][_0xb1be('0x77')]},'raw':!![]})['then'](function(_0xdeaf00){if(!_0xdeaf00||_0xdeaf00[_0xb1be('0x78')]!=0x0)return _0xb04479;return db[_0xb1be('0x2e')]['create']({'name':_0xb04479[_0xb1be('0x2d')],'resourceId':_0xb04479['id'],'type':_0xdeaf00['name'],'sectionId':_0xdeaf00['id']},{})[_0xb1be('0x1b')](function(){return _0xb04479;});})[_0xb1be('0x49')](function(_0x431f8c){logger[_0xb1be('0x2f')](_0xb1be('0x79'),_0x431f8c);throw _0x431f8c;});})['then'](respondWithResult(_0x6558b4,0xc9))['catch'](handleError(_0x6558b4,null));};exports[_0xb1be('0x7a')]=function(_0x36d9c2,_0x40abdc){var _0x450af2=_0x36d9c2[_0xb1be('0x51')];var _0x37c2d8=[];if(_0x36d9c2[_0xb1be('0x23')][_0xb1be('0x21')]===_0xb1be('0x1c'))throw new Error(_0xb1be('0x73'));if(_['some'](_0x450af2,[_0xb1be('0x21'),_0xb1be('0x23')])&&_0x36d9c2['user']['role']!==_0xb1be('0x74')){throw new Error(_0xb1be('0x7b'));}if(_[_0xb1be('0x7c')](_0x450af2,[_0xb1be('0x21'),_0xb1be('0x74')])&&_0x36d9c2['user'][_0xb1be('0x21')]!==_0xb1be('0x74')){throw new Error(_0xb1be('0x7d'));}return licenseUtil[_0xb1be('0x7e')](_0x450af2)[_0xb1be('0x1b')](function(){return validateUser(_0x450af2[0x0]);})[_0xb1be('0x1b')](function(){for(var _0x433453=0x1;_0x433453<_0x450af2[_0xb1be('0x5e')];_0x433453++){var _0x5b85bd=_0x450af2[_0x433453-0x1]['internal'];if(!_0x450af2[_0x433453]['internal'])_0x450af2[_0x433453][_0xb1be('0x5b')]=_0x5b85bd+0x1;_0x37c2d8[_0xb1be('0x41')](validateUser(_0x450af2[_0x433453]));}return Promise[_0xb1be('0x50')](_0x37c2d8);})['then'](function(){_0x37c2d8=[];for(var _0x32f08a=0x0;_0x32f08a<_0x450af2[_0xb1be('0x5e')];_0x32f08a++){_0x37c2d8[_0xb1be('0x41')](updateUser(_0x450af2[_0x32f08a]));}return Promise[_0xb1be('0x50')](_0x37c2d8);})[_0xb1be('0x1b')](function(){_0x37c2d8=_0x450af2[_0xb1be('0x29')](function(_0x15af75){return db['User'][_0xb1be('0x72')](_0x15af75,{'include':[{'model':db[_0xb1be('0x62')],'as':_0xb1be('0x62')}]})['then'](function(_0x2548d9){_0x15af75['id']=_0x2548d9['id'];return _0x15af75;});});return Promise[_0xb1be('0x50')](_0x37c2d8);})[_0xb1be('0x1b')](function(_0x4b18aa){if(_0x36d9c2[_0xb1be('0x51')][_0xb1be('0x21')]===_0xb1be('0x23'))return _0x4b18aa;if(_0x36d9c2['user'][_0xb1be('0x21')]!=='user')return _0x4b18aa;var _0x2236d2=_['some'](_0x4b18aa,function(_0x4921d2){return _0x4921d2['role']===_0xb1be('0x1c')||_0x4921d2[_0xb1be('0x21')]==='telephone';});if(!_0x2236d2)return _0x4b18aa;return db['UserProfileSection'][_0xb1be('0x42')]({'where':{'name':{'$or':[_0xb1be('0x24'),_0xb1be('0x25')]},'userProfileId':_0x36d9c2[_0xb1be('0x23')][_0xb1be('0x77')]},'raw':!![]})[_0xb1be('0x1b')](function(_0x16e131){if(_[_0xb1be('0x7f')](_0x16e131)||!_[_0xb1be('0x7c')](_0x16e131,['autoAssociation',0x0]))return _0x4b18aa;_0x37c2d8=[];var _0x354f2b=_(_0x16e131)[_0xb1be('0x29')](function(_0x519358){if(_0x519358[_0xb1be('0x78')]===0x1)return;return _0x519358['name']===_0xb1be('0x24')?_0xb1be('0x1c'):_0xb1be('0x26');})['compact']()[_0xb1be('0x2a')]();for(var _0x49fc63=0x0;_0x49fc63<_0x4b18aa[_0xb1be('0x5e')];_0x49fc63++){if(!_[_0xb1be('0x2b')](_0x354f2b,_0x4b18aa[_0x49fc63]['role']))return;var _0xa53fc9=_0x4b18aa[_0x49fc63]['role']===_0xb1be('0x1c')?_0xb1be('0x24'):_0xb1be('0x25');_0x37c2d8[_0xb1be('0x41')](db[_0xb1be('0x2e')][_0xb1be('0x72')]({'name':_0x4b18aa[_0x49fc63][_0xb1be('0x2d')],'resourceId':_0x4b18aa[_0x49fc63]['id'],'type':_0xa53fc9,'sectionId':_[_0xb1be('0x2c')](_0x16e131,['name',_0xa53fc9])['id']},{}));}return Promise['all'](_0x37c2d8);});})['then'](respondWithResult(_0x40abdc,0xc9))['catch'](handleError(_0x40abdc,null));};exports[_0xb1be('0x80')]=function(_0x4da85b,_0xed5549){if(_0x4da85b[_0xb1be('0x51')]['id']){delete _0x4da85b[_0xb1be('0x51')]['id'];}return db[_0xb1be('0x31')][_0xb1be('0x2c')]({'where':{'id':_0x4da85b[_0xb1be('0x4b')]['id']}})[_0xb1be('0x1b')](function(_0x158c44){if(!_0x158c44)return null;if(_0x158c44['id']===_0x4da85b[_0xb1be('0x23')]['id']){if(!_0x4da85b[_0xb1be('0x51')][_0xb1be('0x81')]||!_0x4da85b[_0xb1be('0x51')]['newPassword']){throw new db[(_0xb1be('0x82'))][(_0xb1be('0x83'))](_0xb1be('0x84'));}if(!_0x158c44[_0xb1be('0x85')](_0x4da85b[_0xb1be('0x51')]['oldPassword'])){throw new db['Sequelize'][(_0xb1be('0x83'))](_0xb1be('0x86'));}if(_0x4da85b[_0xb1be('0x51')][_0xb1be('0x81')]===_0x4da85b[_0xb1be('0x51')][_0xb1be('0x87')]){throw new db[(_0xb1be('0x82'))][(_0xb1be('0x83'))](_0xb1be('0x88'));}}else if(_0x4da85b[_0xb1be('0x23')][_0xb1be('0x21')]===_0xb1be('0x74')){if(!_0x4da85b[_0xb1be('0x51')][_0xb1be('0x87')]){throw new db['Sequelize'][(_0xb1be('0x83'))](_0xb1be('0x89'));}}else if(_0x4da85b['user'][_0xb1be('0x21')]===_0xb1be('0x23')){if(!_0x4da85b['body'][_0xb1be('0x87')]){throw new db[(_0xb1be('0x82'))][(_0xb1be('0x83'))](_0xb1be('0x89'));}if(_0x158c44[_0xb1be('0x21')]!==_0xb1be('0x1c')){throw new db['Sequelize'][(_0xb1be('0x83'))](_0xb1be('0x73'));}}else{throw new db['Sequelize'][(_0xb1be('0x83'))](_0xb1be('0x73'));}return _0x158c44;})['then'](handleEntityNotFound(_0xed5549,null))['then'](function(_0x5e3668){return db[_0xb1be('0x55')]['findOne']({'attributes':['id',_0xb1be('0x56'),_0xb1be('0x8a'),_0xb1be('0x8b')]})[_0xb1be('0x1b')](function(_0x5dce0c){if(_0x5dce0c[_0xb1be('0x56')])authService[_0xb1be('0x57')](_0x4da85b[_0xb1be('0x51')][_0xb1be('0x87')]);if(!_0x5dce0c['enforcePasswordHistory']||!_0x5e3668[_0xb1be('0x8c')])return _0x5e3668;authService[_0xb1be('0x8d')](_0x4da85b[_0xb1be('0x51')][_0xb1be('0x87')],_0x5e3668[_0xb1be('0x8c')],_0x5dce0c['passwordHistoryLimit']);return _0x5e3668;})[_0xb1be('0x1b')](saveUpdates({'password':_0x4da85b['body'][_0xb1be('0x87')],'passwordResetAt':_0x4da85b[_0xb1be('0x23')]['id']==_0x4da85b['params']['id']?moment():null,'previousPasswords':authService[_0xb1be('0x8e')](_0x4da85b[_0xb1be('0x51')][_0xb1be('0x87')],_0x5e3668[_0xb1be('0x8c')])},null));})['then'](respondWithResult(_0xed5549,null))[_0xb1be('0x49')](handleError(_0xed5549,null));};exports['addQueues']=function(_0xf4e4a6,_0x574d2d){var _0x5d708e=_0xf4e4a6[_0xb1be('0x51')][_0xb1be('0x8f')];return db[_0xb1be('0x31')][_0xb1be('0x2c')]({'where':{'id':_0xf4e4a6[_0xb1be('0x4b')]['id']},'attributes':['id',_0xb1be('0x2d'),_0xb1be('0x21'),'online',_0xb1be('0x90'),_0xb1be('0x91'),'interface']})[_0xb1be('0x1b')](handleEntityNotFound(_0x574d2d,null))[_0xb1be('0x1b')](function(_0x8c4b85){if(_0x8c4b85){if(!utils[_0xb1be('0x92')](_0x5d708e)){throw new db[(_0xb1be('0x82'))][(_0xb1be('0x83'))](_0xb1be('0x93'));}return _0x8c4b85[_0xb1be('0x94')+_['capitalize'](_0x5d708e[_0xb1be('0x95')]())+_0xb1be('0x96')](_0xf4e4a6[_0xb1be('0x51')]['ids'],{'penalty':_0xf4e4a6[_0xb1be('0x51')]['penalty']||0x0})['spread'](function(_0x48a13b){for(var _0x42c465=0x0;_0x42c465<_0xf4e4a6['body']['ids'][_0xb1be('0x5e')];_0x42c465+=0x1){var _0x3f86e4={'UserId':Number(_0xf4e4a6['params']['id'])};_0x3f86e4[_['capitalize'](_0x5d708e[_0xb1be('0x95')]())+_0xb1be('0x97')]=Number(_0xf4e4a6[_0xb1be('0x51')][_0xb1be('0x54')][_0x42c465]);socket[_0xb1be('0x1d')](_0xb1be('0x23')+_['capitalize'](_0x5d708e['toLowerCase']())+_0xb1be('0x98'),_0x3f86e4);}return _0x48a13b;})['then'](function(){if(_0x5d708e==='voice'){return db[_0xb1be('0x99')][_0xb1be('0x42')]({'where':{'id':_0xf4e4a6[_0xb1be('0x51')][_0xb1be('0x54')]||[]},'raw':!![],'attributes':['id',_0xb1be('0x2d')]});}})[_0xb1be('0x1b')](function(_0x207fb4){var _0x3c501e=_0x8c4b85[_0xb1be('0x20')]({'plain':!![]});var _0x314151=[];if(_0x5d708e===_0xb1be('0x9a')&&_0x3c501e[_0xb1be('0x21')]==='agent'&&_0x3c501e['online']){for(let _0x26abdb=0x0;_0x26abdb<_0x207fb4['length'];_0x26abdb+=0x1){_0x314151[_0xb1be('0x41')]({'membername':_0x3c501e[_0xb1be('0x2d')],'UserId':_0x3c501e['id'],'queue_name':_0x207fb4[_0x26abdb][_0xb1be('0x2d')],'VoiceQueueId':_0x207fb4[_0x26abdb]['id'],'interface':_[_0xb1be('0x59')](_0x3c501e[_0xb1be('0x9b')])?util[_0xb1be('0x9c')](_0xb1be('0x9d'),_0x3c501e[_0xb1be('0x2d')]):_0x3c501e[_0xb1be('0x9b')],'paused':_0x3c501e[_0xb1be('0x91')]||![],'penalty':_0xf4e4a6[_0xb1be('0x51')][_0xb1be('0x9e')]||0x0});}return Promise['all'](_0x314151['map'](function(_0x1e69ad){return db[_0xb1be('0x9f')]['upsert'](_0x1e69ad);}));}return _0x8c4b85;});}})[_0xb1be('0x1b')](respondWithStatusCode(_0x574d2d,null))[_0xb1be('0x49')](handleError(_0x574d2d,null));};exports[_0xb1be('0xa0')]=function(_0x10638b,_0x55d681){var _0xed191f,_0x5e95ae;return db[_0xb1be('0x31')][_0xb1be('0x2c')]({'where':{'id':_0x10638b[_0xb1be('0x4b')]['id']},'attributes':['id',_0xb1be('0x2d'),_0xb1be('0x21')]})[_0xb1be('0x1b')](handleEntityNotFound(_0x55d681,null))['then'](function(_0x4f781a){if(_0x4f781a){_0xed191f=_0x4f781a;if(!_0x10638b[_0xb1be('0x3a')][_0xb1be('0x8f')]||!utils[_0xb1be('0x92')](_0x10638b[_0xb1be('0x3a')][_0xb1be('0x8f')])){throw new db[(_0xb1be('0x82'))][(_0xb1be('0x83'))](_0xb1be('0x93'));}return _0x4f781a[_0xb1be('0xa1')+_[_0xb1be('0xa2')](_0x10638b[_0xb1be('0x3a')][_0xb1be('0x8f')][_0xb1be('0x95')]())+_0xb1be('0x96')](_0x10638b['query'][_0xb1be('0x54')]);}})[_0xb1be('0x1b')](function(_0x391c90){if(_[_0xb1be('0xa3')](_0x10638b[_0xb1be('0x3a')]['ids'])){for(var _0x3c2f37=0x0;_0x3c2f37<_0x10638b[_0xb1be('0x3a')][_0xb1be('0x54')][_0xb1be('0x5e')];_0x3c2f37+=0x1){_0x5e95ae={'UserId':Number(_0x10638b['params']['id'])};_0x5e95ae[_[_0xb1be('0xa2')](_0x10638b[_0xb1be('0x3a')][_0xb1be('0x8f')][_0xb1be('0x95')]())+_0xb1be('0x97')]=Number(_0x10638b[_0xb1be('0x3a')][_0xb1be('0x54')][_0x3c2f37]);socket[_0xb1be('0x1d')](_0xb1be('0x23')+_[_0xb1be('0xa2')](_0x10638b[_0xb1be('0x3a')][_0xb1be('0x8f')]['toLowerCase']())+_0xb1be('0xa4'),_0x5e95ae);}}else{_0x5e95ae={'UserId':Number(_0x10638b['params']['id'])};_0x5e95ae[_[_0xb1be('0xa2')](_0x10638b['query'][_0xb1be('0x8f')]['toLowerCase']())+'QueueId']=Number(_0x10638b[_0xb1be('0x3a')][_0xb1be('0x54')]);socket[_0xb1be('0x1d')](_0xb1be('0x23')+_[_0xb1be('0xa2')](_0x10638b[_0xb1be('0x3a')][_0xb1be('0x8f')][_0xb1be('0x95')]())+_0xb1be('0xa4'),_0x5e95ae);}return _0x391c90;})[_0xb1be('0x1b')](function(){if(_0x10638b[_0xb1be('0x3a')]['channel']===_0xb1be('0x9a')){return db['UserVoiceQueueRt'][_0xb1be('0x1f')]({'where':{'UserId':_0x10638b['params']['id'],'VoiceQueueId':_0x10638b[_0xb1be('0x3a')][_0xb1be('0x54')]},'individualHooks':!![]})['then'](function(){return _0xed191f;});}return _0xed191f;})[_0xb1be('0x1b')](respondWithStatusCode(_0x55d681,null))[_0xb1be('0x49')](handleError(_0x55d681,null));};exports[_0xb1be('0xa5')]=function(_0x2cb676,_0x1176a7){_0x2cb676[_0xb1be('0x51')][_0xb1be('0xa6')]=_0x2cb676[_0xb1be('0xa7')]['filename'];return db[_0xb1be('0x31')][_0xb1be('0x2c')]({'where':{'id':_0x2cb676[_0xb1be('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1176a7,null))['then'](saveUpdates(_0x2cb676[_0xb1be('0x51')],null))[_0xb1be('0x1b')](respondWithResult(_0x1176a7,null))['catch'](handleError(_0x1176a7,null));};exports[_0xb1be('0xa8')]=function(_0x267a4d,_0x59ef90){var _0x2754f1=path[_0xb1be('0xa9')](config[_0xb1be('0xaa')],_0xb1be('0xab'));return db['User']['find']({'where':{'id':_0x267a4d[_0xb1be('0x4b')]['id']},'attributes':['id',_0xb1be('0xa6')],'raw':!![]})[_0xb1be('0x1b')](handleEntityNotFound(_0x59ef90,null))[_0xb1be('0x1b')](function(_0x21fd69){if(_0x21fd69){if(_[_0xb1be('0x59')](_0x21fd69[_0xb1be('0xa6')])){return _0x59ef90[_0xb1be('0xac')](_0x2754f1);}else{if(!fs[_0xb1be('0xad')](path['join'](config[_0xb1be('0xaa')],_0xb1be('0xae'),_0x21fd69[_0xb1be('0xa6')]))){return _0x59ef90[_0xb1be('0xac')](_0x2754f1);}return _0x59ef90[_0xb1be('0xac')](path['join'](config[_0xb1be('0xaa')],'server/files/images/',_0x21fd69[_0xb1be('0xa6')]));}}})[_0xb1be('0x49')](handleError(_0x59ef90,null));};exports['getOpenTabs']=function(_0x3c60c1,_0x1aa92d){return db[_0xb1be('0x31')][_0xb1be('0x2c')]({'where':{'id':_0x3c60c1[_0xb1be('0x4b')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x1aa92d,null))[_0xb1be('0x1b')](function(_0x32eb67){var _0x4b9b3e=[];values=_0x32eb67[_0xb1be('0x46')];_0x4b9b3e[_0xb1be('0x41')](get_open_tabs(_0xb1be('0x45'),_0x32eb67[_0xb1be('0x46')]));_0x4b9b3e[_0xb1be('0x41')](get_open_tabs(_0xb1be('0x4d'),_0x32eb67[_0xb1be('0x46')]));_0x4b9b3e[_0xb1be('0x41')](get_open_tabs(_0xb1be('0x4e'),_0x32eb67[_0xb1be('0x46')]));_0x4b9b3e[_0xb1be('0x41')](get_open_tabs(_0xb1be('0x48'),_0x32eb67[_0xb1be('0x46')]));_0x4b9b3e[_0xb1be('0x41')](get_open_tabs(_0xb1be('0x4f'),_0x32eb67[_0xb1be('0x46')]));_0x4b9b3e['push'](get_open_tabs(_0xb1be('0x47'),_0x32eb67[_0xb1be('0x46')]));return Promise['all'](_0x4b9b3e);})['then'](function(_0x489bd7){if(_0x489bd7){var _0xe2db1e=_['map'](values[_0xb1be('0xaf')],function(_0x59f3e8){return{'channel':'CHAT','id':_0x59f3e8['id'],'createdAt':_0x59f3e8[_0xb1be('0xb0')]};});var _0x3f294f=_[_0xb1be('0x29')](values[_0xb1be('0xb1')],function(_0x871a37){return{'channel':_0xb1be('0xb2'),'id':_0x871a37['id'],'createdAt':_0x871a37[_0xb1be('0xb0')]};});var _0x3fb85f=_[_0xb1be('0x29')](values[_0xb1be('0xb3')],function(_0x1eddce){return{'channel':_0xb1be('0xb4'),'id':_0x1eddce['id'],'createdAt':_0x1eddce[_0xb1be('0xb0')]};});var _0x5b862e=_['map'](values[_0xb1be('0xb5')],function(_0x11d714){return{'channel':_0xb1be('0xb6'),'id':_0x11d714['id'],'createdAt':_0x11d714[_0xb1be('0xb0')]};});var _0x2f0965=_['map'](values[_0xb1be('0xb7')],function(_0x576deb){return{'channel':_0xb1be('0xb8'),'id':_0x576deb['id'],'createdAt':_0x576deb[_0xb1be('0xb0')]};});var _0x4aa4b1=_[_0xb1be('0x29')](values[_0xb1be('0xb9')],function(_0x3bcfd3){return{'channel':_0xb1be('0xba'),'id':_0x3bcfd3['id'],'createdAt':_0x3bcfd3[_0xb1be('0xb0')]};});var _0x32fdf1=_[_0xb1be('0xbb')](_0xe2db1e,_0x3f294f,_0x3fb85f,_0x5b862e,_0x2f0965,_0x4aa4b1);var _0x7e3e72={'count':_0x32fdf1['length'],'rows':_0x32fdf1};return _0x7e3e72;}else return null;})[_0xb1be('0x1b')](respondWithResult(_0x1aa92d,null))[_0xb1be('0x49')](handleError(_0x1aa92d,null));};exports[_0xb1be('0xbc')]=function(_0x50464b,_0x1c21b2){var _0x20738b={};return db[_0xb1be('0x31')][_0xb1be('0xbd')]({'where':{'id':_0x50464b[_0xb1be('0x4b')]['id']}})[_0xb1be('0x1b')](function(_0x4307e9){if(!_0x4307e9){throw new APINotFoundError(util[_0xb1be('0x9c')](_0xb1be('0xbe'),_0x50464b[_0xb1be('0x4b')]['id']));}return contacts[_0xb1be('0x52')]();})[_0xb1be('0x1b')](function(_0x15d699){_0x50464b['query']['User']=_0x50464b[_0xb1be('0x4b')]['id'];_0x20738b=qs[_0xb1be('0x38')](_0x15d699,_0x50464b);if(_0x50464b[_0xb1be('0x3a')][_0xb1be('0xbf')](_0xb1be('0x3b'))){_0x20738b['include']=[{'model':db[_0xb1be('0xc0')],'as':'List','required':![]},{'model':db['Tag'],'as':_0xb1be('0xc1'),'attributes':['id',_0xb1be('0x2d'),_0xb1be('0xc2')],'where':_0x50464b['query']['tag']?{'id':_0x50464b[_0xb1be('0x3a')]['tag']}:undefined,'required':_0x50464b['query'][_0xb1be('0xc3')]?!![]:![]}];}return contacts['findAll'](_0x50464b[_0xb1be('0x3a')],_0x50464b[_0xb1be('0x23')],_0x20738b,_0x15d699);})[_0xb1be('0x1b')](respondWithFilteredResult(_0x1c21b2,_0x20738b))[_0xb1be('0x49')](APIHandleError(_0x1c21b2));};exports['getQueues']=function(_0x103b19,_0x2a88b1){var _0x473079;var _0x59b500={};var _0x4ca844;return db['User'][_0xb1be('0xbd')]({'where':{'id':_0x103b19[_0xb1be('0x4b')]['id']},'attributes':['id',_0xb1be('0x2d'),'role']})[_0xb1be('0x1b')](handleEntityNotFound(_0x2a88b1,null))[_0xb1be('0x1b')](function(_0x532ab2){if(!utils[_0xb1be('0x92')](_0x103b19[_0xb1be('0x3a')]['channel'])){throw new db[(_0xb1be('0x82'))][(_0xb1be('0x83'))]('Unknown\x20channel');}_0x473079=_0x532ab2;var _0x2f6d46={};_0x2f6d46['model']=_[_0xb1be('0xc4')](db[_[_0xb1be('0xa2')](_0x103b19[_0xb1be('0x3a')][_0xb1be('0x8f')])+'Queue'][_0xb1be('0x32')]);_0x2f6d46[_0xb1be('0x3a')]=_[_0xb1be('0xc4')](_0x103b19[_0xb1be('0x3a')]);_0x2f6d46[_0xb1be('0xc5')]=_[_0xb1be('0xc6')](_0x2f6d46[_0xb1be('0xc7')],_0x2f6d46[_0xb1be('0x3a')]);_0x59b500[_0xb1be('0x40')]=_[_0xb1be('0xc6')](_0x2f6d46[_0xb1be('0xc7')],qs['fields'](_0x103b19['query'][_0xb1be('0xc8')]));_0x59b500[_0xb1be('0x40')]=_0x59b500[_0xb1be('0x40')][_0xb1be('0x5e')]?_0x59b500['attributes']:_0x2f6d46[_0xb1be('0xc7')];_0x59b500[_0xb1be('0xc9')]=qs[_0xb1be('0xca')](_0x103b19[_0xb1be('0x3a')][_0xb1be('0xca')]);_0x59b500[_0xb1be('0x39')]=qs['filters'](_[_0xb1be('0xcb')](_0x103b19[_0xb1be('0x3a')],_0x2f6d46[_0xb1be('0xc5')]));if(_0x103b19['query']['filter']){_0x59b500['where']=_[_0xb1be('0x4c')](_0x59b500[_0xb1be('0x39')],{'$or':_[_0xb1be('0x29')](_0x59b500['attributes'],function(_0xc01ecf){var _0xb98fbf={};_0xb98fbf[_0xc01ecf]={'$like':'%'+_0x103b19[_0xb1be('0x3a')][_0xb1be('0x27')]+'%'};return _0xb98fbf;})});}_0x59b500=_['merge']({},_0x59b500,_0x103b19['options']);switch(_0x473079[_0xb1be('0x21')]){case _0xb1be('0x74'):return db[_['capitalize'](_0x103b19[_0xb1be('0x3a')][_0xb1be('0x8f')])+'Queue'][_0xb1be('0x42')](_0x59b500);case'user':case _0xb1be('0x1c'):return _0x473079['get'+_[_0xb1be('0xa2')](_0x103b19[_0xb1be('0x3a')][_0xb1be('0x8f')])+_0xb1be('0x96')](_0x59b500);default:throw new db[(_0xb1be('0x82'))][(_0xb1be('0x83'))](_0xb1be('0xcc'));}})[_0xb1be('0x1b')](function(_0x34fabd){_0x4ca844=_0x34fabd['length'];if(!_0x103b19[_0xb1be('0x3a')][_0xb1be('0xbf')](_0xb1be('0xcd'))){_0x59b500[_0xb1be('0x17')]=qs['limit'](_0x103b19[_0xb1be('0x3a')]['limit']);_0x59b500['offset']=qs['offset'](_0x103b19[_0xb1be('0x3a')]['offset']);}switch(_0x473079['role']){case _0xb1be('0x74'):return db[_[_0xb1be('0xa2')](_0x103b19[_0xb1be('0x3a')][_0xb1be('0x8f')])+'Queue']['findAll'](_0x59b500);case'user':case _0xb1be('0x1c'):return _0x473079['get'+_[_0xb1be('0xa2')](_0x103b19[_0xb1be('0x3a')][_0xb1be('0x8f')])+_0xb1be('0x96')](_0x59b500);}})[_0xb1be('0x1b')](function(_0x5bcdbe){return{'count':_0x4ca844,'rows':_0x5bcdbe};})[_0xb1be('0x1b')](respondWithResult(_0x2a88b1,null))[_0xb1be('0x49')](handleError(_0x2a88b1,null));};exports[_0xb1be('0xce')]=function(_0x68acc2,_0x438907){var _0xfd37ea={};var _0x36b195={};var _0x32345f;var _0x2df54f;return db[_0xb1be('0x31')]['findOne']({'where':{'id':_0x68acc2['params']['id']}})[_0xb1be('0x1b')](handleEntityNotFound(_0x438907,null))['then'](function(_0xdc58f8){if(_0xdc58f8){_0x32345f=_0xdc58f8;_0x36b195['model']=_[_0xb1be('0xc4')](db[_0xb1be('0x9f')][_0xb1be('0x32')]);_0x36b195[_0xb1be('0x3a')]=_[_0xb1be('0xc4')](_0x68acc2[_0xb1be('0x3a')]);_0x36b195[_0xb1be('0xc5')]=_[_0xb1be('0xc6')](_0x36b195[_0xb1be('0xc7')],_0x36b195['query']);_0xfd37ea['attributes']=_[_0xb1be('0xc6')](_0x36b195[_0xb1be('0xc7')],qs[_0xb1be('0xc8')](_0x68acc2[_0xb1be('0x3a')]['fields']));_0xfd37ea['attributes']=_0xfd37ea[_0xb1be('0x40')][_0xb1be('0x5e')]?_0xfd37ea[_0xb1be('0x40')]:_0x36b195[_0xb1be('0xc7')];_0xfd37ea[_0xb1be('0xc9')]=qs[_0xb1be('0xca')](_0x68acc2['query']['sort']);_0xfd37ea[_0xb1be('0x39')]=qs[_0xb1be('0xc5')](_[_0xb1be('0xcb')](_0x68acc2['query'],_0x36b195['filters']));if(_0x68acc2[_0xb1be('0x3a')][_0xb1be('0x27')]){_0xfd37ea[_0xb1be('0x39')]=_[_0xb1be('0x4c')](_0xfd37ea['where'],{'$or':_[_0xb1be('0x29')](_0xfd37ea[_0xb1be('0x40')],function(_0x5ac8d4){var _0x1990fa={};_0x1990fa[_0x5ac8d4]={'$like':'%'+_0x68acc2['query'][_0xb1be('0x27')]+'%'};return _0x1990fa;})});}_0xfd37ea=_[_0xb1be('0x4c')]({},_0xfd37ea,_0x68acc2[_0xb1be('0xcf')]);return _0x32345f[_0xb1be('0xce')](_0xfd37ea);}})[_0xb1be('0x1b')](function(_0x413dc0){if(_0x413dc0){_0x2df54f=_0x413dc0['length'];if(!_0x68acc2[_0xb1be('0x3a')][_0xb1be('0xbf')](_0xb1be('0xcd'))){_0xfd37ea['limit']=qs[_0xb1be('0x17')](_0x68acc2[_0xb1be('0x3a')][_0xb1be('0x17')]);_0xfd37ea[_0xb1be('0x15')]=qs['offset'](_0x68acc2[_0xb1be('0x3a')]['offset']);}return _0x32345f[_0xb1be('0xce')](_0xfd37ea);}})[_0xb1be('0x1b')](function(_0x360cb1){if(_0x360cb1){return _0x360cb1?{'count':_0x2df54f,'rows':_0x360cb1}:null;}})[_0xb1be('0x1b')](respondWithResult(_0x438907,null))[_0xb1be('0x49')](handleError(_0x438907,null));};exports[_0xb1be('0xd0')]=function(_0x3750fb,_0x1b693f){var _0x19eea2={};var _0x26f1f3={};var _0x4b45dd;var _0x2df883;return db[_0xb1be('0x31')][_0xb1be('0xbd')]({'where':{'id':_0x3750fb[_0xb1be('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1b693f,null))[_0xb1be('0x1b')](function(_0x58fc1d){if(_0x58fc1d){_0x4b45dd=_0x58fc1d;_0x26f1f3[_0xb1be('0xc7')]=_[_0xb1be('0xc4')](db[_0xb1be('0xd1')]['rawAttributes']);_0x26f1f3['query']=_['keys'](_0x3750fb[_0xb1be('0x3a')]);_0x26f1f3['filters']=_['intersection'](_0x26f1f3['model'],_0x26f1f3[_0xb1be('0x3a')]);_0x19eea2[_0xb1be('0x40')]=_[_0xb1be('0xc6')](_0x26f1f3[_0xb1be('0xc7')],qs['fields'](_0x3750fb['query']['fields']));_0x19eea2['attributes']=_0x19eea2['attributes']['length']?_0x19eea2[_0xb1be('0x40')]:_0x26f1f3[_0xb1be('0xc7')];_0x19eea2[_0xb1be('0xc9')]=qs[_0xb1be('0xca')](_0x3750fb[_0xb1be('0x3a')][_0xb1be('0xca')]);_0x19eea2[_0xb1be('0x39')]=qs[_0xb1be('0xc5')](_[_0xb1be('0xcb')](_0x3750fb[_0xb1be('0x3a')],_0x26f1f3['filters']));if(_0x3750fb[_0xb1be('0x3a')][_0xb1be('0x27')]){_0x19eea2['where']=_[_0xb1be('0x4c')](_0x19eea2['where'],{'$or':_['map'](_0x19eea2[_0xb1be('0x40')],function(_0x457e3f){var _0x1a834b={};_0x1a834b[_0x457e3f]={'$like':'%'+_0x3750fb[_0xb1be('0x3a')][_0xb1be('0x27')]+'%'};return _0x1a834b;})});}_0x19eea2=_[_0xb1be('0x4c')]({},_0x19eea2,_0x3750fb[_0xb1be('0xcf')]);return _0x4b45dd[_0xb1be('0xd0')](_0x19eea2);}})['then'](function(_0x55a121){if(_0x55a121){_0x2df883=_0x55a121['length'];if(!_0x3750fb[_0xb1be('0x3a')][_0xb1be('0xbf')](_0xb1be('0xcd'))){_0x19eea2[_0xb1be('0x17')]=qs['limit'](_0x3750fb['query'][_0xb1be('0x17')]);_0x19eea2[_0xb1be('0x15')]=qs['offset'](_0x3750fb[_0xb1be('0x3a')][_0xb1be('0x15')]);}return _0x4b45dd[_0xb1be('0xd0')](_0x19eea2);}})[_0xb1be('0x1b')](function(_0x239697){if(_0x239697){return _0x239697?{'count':_0x2df883,'rows':_0x239697}:null;}})['then'](respondWithResult(_0x1b693f,null))[_0xb1be('0x49')](handleError(_0x1b693f,null));};exports[_0xb1be('0xd2')]=function(_0x322044,_0x2c5cfe){var _0x4231c7={'raw':!![],'where':{}};var _0x256732={};var _0x1b6400={'count':0x0,'rows':[]};return db['User'][_0xb1be('0xbd')]({'where':{'id':_0x322044[_0xb1be('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2c5cfe,null))['then'](function(_0x3d2bff){if(_0x3d2bff){_0x256732[_0xb1be('0xc7')]=_[_0xb1be('0xc4')](db[_0xb1be('0xd3')][_0xb1be('0x32')]);_0x256732['query']=_['keys'](_0x322044[_0xb1be('0x3a')]);_0x256732['filters']=_[_0xb1be('0xc6')](_0x256732[_0xb1be('0xc7')],_0x256732[_0xb1be('0x3a')]);_0x4231c7[_0xb1be('0x40')]=_[_0xb1be('0xc6')](_0x256732[_0xb1be('0xc7')],qs[_0xb1be('0xc8')](_0x322044[_0xb1be('0x3a')][_0xb1be('0xc8')]));_0x4231c7['attributes']=_0x4231c7['attributes'][_0xb1be('0x5e')]?_0x4231c7[_0xb1be('0x40')]:_0x256732[_0xb1be('0xc7')];if(!_0x322044[_0xb1be('0x3a')][_0xb1be('0xbf')]('nolimit')){_0x4231c7[_0xb1be('0x17')]=qs[_0xb1be('0x17')](_0x322044[_0xb1be('0x3a')]['limit']);_0x4231c7[_0xb1be('0x15')]=qs['offset'](_0x322044[_0xb1be('0x3a')][_0xb1be('0x15')]);}_0x4231c7[_0xb1be('0xc9')]=qs[_0xb1be('0xca')](_0x322044[_0xb1be('0x3a')][_0xb1be('0xca')]);_0x4231c7[_0xb1be('0x39')]=qs['filters'](_[_0xb1be('0xcb')](_0x322044[_0xb1be('0x3a')],_0x256732[_0xb1be('0xc5')]));_0x4231c7[_0xb1be('0x39')][_0xb1be('0xd4')]=_0x3d2bff['id'];if(_0x322044['query'][_0xb1be('0x27')]){_0x4231c7[_0xb1be('0x39')]=_[_0xb1be('0x4c')](_0x4231c7[_0xb1be('0x39')],{'$or':_[_0xb1be('0x29')](_0x4231c7[_0xb1be('0x40')],function(_0x37cdff){var _0x219345={};_0x219345[_0x37cdff]={'$like':'%'+_0x322044[_0xb1be('0x3a')][_0xb1be('0x27')]+'%'};return _0x219345;})});}_0x4231c7=_[_0xb1be('0x4c')]({},_0x4231c7,_0x322044[_0xb1be('0xcf')]);return db[_0xb1be('0xd3')][_0xb1be('0x16')]({'where':_0x4231c7['where']})['then'](function(_0x8085a1){_0x1b6400[_0xb1be('0x16')]=_0x8085a1;if(_0x322044[_0xb1be('0x3a')][_0xb1be('0x3b')]){_0x4231c7[_0xb1be('0x3c')]=[{'all':!![]}];}return db[_0xb1be('0xd3')][_0xb1be('0x42')](_0x4231c7);})[_0xb1be('0x1b')](function(_0x495bab){_0x1b6400['rows']=_0x495bab;return _0x1b6400;});}})[_0xb1be('0x1b')](respondWithFilteredResult(_0x2c5cfe,_0x4231c7))[_0xb1be('0x49')](handleError(_0x2c5cfe,null));};exports[_0xb1be('0xd5')]=function(_0x46c11f,_0xabef85){var _0x75878a={'raw':!![],'where':{}};var _0x5496cc={};var _0xda1c1c={'count':0x0,'rows':[]};return db[_0xb1be('0x31')]['findOne']({'where':{'id':_0x46c11f['params']['id']}})[_0xb1be('0x1b')](handleEntityNotFound(_0xabef85,null))[_0xb1be('0x1b')](function(_0x47e30a){if(_0x47e30a){_0x5496cc[_0xb1be('0xc7')]=_[_0xb1be('0xc4')](db[_0xb1be('0xd6')][_0xb1be('0x32')]);_0x5496cc['query']=_[_0xb1be('0xc4')](_0x46c11f[_0xb1be('0x3a')]);_0x5496cc[_0xb1be('0xc5')]=_[_0xb1be('0xc6')](_0x5496cc[_0xb1be('0xc7')],_0x5496cc[_0xb1be('0x3a')]);_0x75878a[_0xb1be('0x40')]=_[_0xb1be('0xc6')](_0x5496cc[_0xb1be('0xc7')],qs[_0xb1be('0xc8')](_0x46c11f['query']['fields']));_0x75878a[_0xb1be('0x40')]=_0x75878a[_0xb1be('0x40')]['length']?_0x75878a[_0xb1be('0x40')]:_0x5496cc[_0xb1be('0xc7')];if(!_0x46c11f[_0xb1be('0x3a')][_0xb1be('0xbf')]('nolimit')){_0x75878a[_0xb1be('0x17')]=qs['limit'](_0x46c11f[_0xb1be('0x3a')][_0xb1be('0x17')]);_0x75878a[_0xb1be('0x15')]=qs[_0xb1be('0x15')](_0x46c11f[_0xb1be('0x3a')]['offset']);}_0x75878a[_0xb1be('0xc9')]=qs['sort'](_0x46c11f['query']['sort']);_0x75878a[_0xb1be('0x39')]=qs[_0xb1be('0xc5')](_[_0xb1be('0xcb')](_0x46c11f['query'],_0x5496cc[_0xb1be('0xc5')]));_0x75878a[_0xb1be('0x39')]['UserId']=_0x47e30a['id'];if(_0x46c11f['query'][_0xb1be('0x27')]){_0x75878a['where']=_[_0xb1be('0x4c')](_0x75878a[_0xb1be('0x39')],{'$or':_[_0xb1be('0x29')](_0x75878a['attributes'],function(_0x3a857e){var _0x552c3f={};_0x552c3f[_0x3a857e]={'$like':'%'+_0x46c11f[_0xb1be('0x3a')][_0xb1be('0x27')]+'%'};return _0x552c3f;})});}_0x75878a=_[_0xb1be('0x4c')]({},_0x75878a,_0x46c11f[_0xb1be('0xcf')]);return db[_0xb1be('0xd6')]['count']({'where':_0x75878a['where']})['then'](function(_0x1db6b0){_0xda1c1c['count']=_0x1db6b0;if(_0x46c11f[_0xb1be('0x3a')][_0xb1be('0x3b')]){_0x75878a[_0xb1be('0x3c')]=[{'all':!![]}];}return db[_0xb1be('0xd6')][_0xb1be('0x42')](_0x75878a);})[_0xb1be('0x1b')](function(_0x43345b){_0xda1c1c[_0xb1be('0x43')]=_0x43345b;return _0xda1c1c;});}})[_0xb1be('0x1b')](respondWithFilteredResult(_0xabef85,_0x75878a))[_0xb1be('0x49')](handleError(_0xabef85,null));};exports[_0xb1be('0xd7')]=function(_0x559a14,_0x394fdc){var _0x217094={};var _0x51b151={};var _0x4bc788;var _0x5a4ab9;return db[_0xb1be('0x31')]['findOne']({'where':{'id':_0x559a14[_0xb1be('0x4b')]['id']}})[_0xb1be('0x1b')](handleEntityNotFound(_0x394fdc,null))['then'](function(_0x2b1d69){if(_0x2b1d69){_0x4bc788=_0x2b1d69;_0x51b151[_0xb1be('0xc7')]=_['keys'](db['ChatInteraction']['rawAttributes']);_0x51b151['query']=_[_0xb1be('0xc4')](_0x559a14[_0xb1be('0x3a')]);_0x51b151[_0xb1be('0xc5')]=_['intersection'](_0x51b151[_0xb1be('0xc7')],_0x51b151[_0xb1be('0x3a')]);_0x217094[_0xb1be('0x40')]=_[_0xb1be('0xc6')](_0x51b151[_0xb1be('0xc7')],qs['fields'](_0x559a14[_0xb1be('0x3a')][_0xb1be('0xc8')]));_0x217094['attributes']=_0x217094['attributes']['length']?_0x217094['attributes']:_0x51b151[_0xb1be('0xc7')];_0x217094[_0xb1be('0xc9')]=qs[_0xb1be('0xca')](_0x559a14[_0xb1be('0x3a')][_0xb1be('0xca')]);_0x217094['where']=qs[_0xb1be('0xc5')](_['pick'](_0x559a14[_0xb1be('0x3a')],_0x51b151['filters']));if(_0x559a14['query']['filter']){_0x217094[_0xb1be('0x39')]=_[_0xb1be('0x4c')](_0x217094[_0xb1be('0x39')],{'$or':_[_0xb1be('0x29')](_0x217094[_0xb1be('0x40')],function(_0x32160c){var _0x331877={};_0x331877[_0x32160c]={'$like':'%'+_0x559a14[_0xb1be('0x3a')]['filter']+'%'};return _0x331877;})});}_0x217094=_[_0xb1be('0x4c')]({},_0x217094,_0x559a14['options']);return _0x4bc788['getChatInteractions'](_0x217094);}})[_0xb1be('0x1b')](function(_0x28de29){if(_0x28de29){_0x5a4ab9=_0x28de29[_0xb1be('0x5e')];if(!_0x559a14[_0xb1be('0x3a')][_0xb1be('0xbf')](_0xb1be('0xcd'))){_0x217094[_0xb1be('0x17')]=qs[_0xb1be('0x17')](_0x559a14[_0xb1be('0x3a')][_0xb1be('0x17')]);_0x217094[_0xb1be('0x15')]=qs[_0xb1be('0x15')](_0x559a14['query'][_0xb1be('0x15')]);}return _0x4bc788['getChatInteractions'](_0x217094);}})['then'](function(_0x4fad99){if(_0x4fad99){return _0x4fad99?{'count':_0x5a4ab9,'rows':_0x4fad99}:null;}})[_0xb1be('0x1b')](respondWithResult(_0x394fdc,null))[_0xb1be('0x49')](handleError(_0x394fdc,null));};exports['getOpenchannelInteractions']=function(_0x77feed,_0x4ec5bf){var _0x1ebe03={};var _0x851be={};var _0x5f2d91;var _0x358cab;return db[_0xb1be('0x31')][_0xb1be('0xbd')]({'where':{'id':_0x77feed[_0xb1be('0x4b')]['id']}})[_0xb1be('0x1b')](handleEntityNotFound(_0x4ec5bf,null))[_0xb1be('0x1b')](function(_0x33ccc5){if(_0x33ccc5){_0x5f2d91=_0x33ccc5;_0x851be['model']=_[_0xb1be('0xc4')](db[_0xb1be('0xd8')][_0xb1be('0x32')]);_0x851be['query']=_['keys'](_0x77feed['query']);_0x851be[_0xb1be('0xc5')]=_[_0xb1be('0xc6')](_0x851be[_0xb1be('0xc7')],_0x851be[_0xb1be('0x3a')]);_0x1ebe03[_0xb1be('0x40')]=_['intersection'](_0x851be[_0xb1be('0xc7')],qs[_0xb1be('0xc8')](_0x77feed[_0xb1be('0x3a')]['fields']));_0x1ebe03[_0xb1be('0x40')]=_0x1ebe03['attributes']['length']?_0x1ebe03[_0xb1be('0x40')]:_0x851be['model'];_0x1ebe03[_0xb1be('0xc9')]=qs[_0xb1be('0xca')](_0x77feed['query'][_0xb1be('0xca')]);_0x1ebe03[_0xb1be('0x39')]=qs[_0xb1be('0xc5')](_['pick'](_0x77feed[_0xb1be('0x3a')],_0x851be['filters']));if(_0x77feed['query'][_0xb1be('0x27')]){_0x1ebe03[_0xb1be('0x39')]=_[_0xb1be('0x4c')](_0x1ebe03[_0xb1be('0x39')],{'$or':_[_0xb1be('0x29')](_0x1ebe03[_0xb1be('0x40')],function(_0x13d5da){var _0x5961bc={};_0x5961bc[_0x13d5da]={'$like':'%'+_0x77feed[_0xb1be('0x3a')][_0xb1be('0x27')]+'%'};return _0x5961bc;})});}_0x1ebe03=_[_0xb1be('0x4c')]({},_0x1ebe03,_0x77feed[_0xb1be('0xcf')]);return _0x5f2d91[_0xb1be('0xd9')](_0x1ebe03);}})[_0xb1be('0x1b')](function(_0x451778){if(_0x451778){_0x358cab=_0x451778[_0xb1be('0x5e')];if(!_0x77feed[_0xb1be('0x3a')]['hasOwnProperty']('nolimit')){_0x1ebe03['limit']=qs[_0xb1be('0x17')](_0x77feed[_0xb1be('0x3a')][_0xb1be('0x17')]);_0x1ebe03[_0xb1be('0x15')]=qs[_0xb1be('0x15')](_0x77feed[_0xb1be('0x3a')][_0xb1be('0x15')]);}return _0x5f2d91[_0xb1be('0xd9')](_0x1ebe03);}})[_0xb1be('0x1b')](function(_0x1ffd93){if(_0x1ffd93){return _0x1ffd93?{'count':_0x358cab,'rows':_0x1ffd93}:null;}})[_0xb1be('0x1b')](respondWithResult(_0x4ec5bf,null))[_0xb1be('0x49')](handleError(_0x4ec5bf,null));};exports[_0xb1be('0xda')]=function(_0x4b556b,_0x1f98a2){var _0x5c2ce3={'raw':!![],'where':{}};var _0x561196={};var _0x56922a={'count':0x0,'rows':[]};return db[_0xb1be('0x31')][_0xb1be('0xbd')]({'where':{'id':_0x4b556b[_0xb1be('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1f98a2,null))['then'](function(_0x585f1d){if(_0x585f1d){_0x561196[_0xb1be('0xc7')]=_[_0xb1be('0xc4')](db['MailInteraction'][_0xb1be('0x32')]);_0x561196['query']=_['keys'](_0x4b556b['query']);_0x561196[_0xb1be('0xc5')]=_[_0xb1be('0xc6')](_0x561196[_0xb1be('0xc7')],_0x561196[_0xb1be('0x3a')]);_0x5c2ce3[_0xb1be('0x40')]=_['intersection'](_0x561196[_0xb1be('0xc7')],qs[_0xb1be('0xc8')](_0x4b556b['query'][_0xb1be('0xc8')]));_0x5c2ce3[_0xb1be('0x40')]=_0x5c2ce3[_0xb1be('0x40')][_0xb1be('0x5e')]?_0x5c2ce3[_0xb1be('0x40')]:_0x561196[_0xb1be('0xc7')];if(!_0x4b556b[_0xb1be('0x3a')][_0xb1be('0xbf')](_0xb1be('0xcd'))){_0x5c2ce3[_0xb1be('0x17')]=qs[_0xb1be('0x17')](_0x4b556b['query']['limit']);_0x5c2ce3[_0xb1be('0x15')]=qs['offset'](_0x4b556b[_0xb1be('0x3a')][_0xb1be('0x15')]);}_0x5c2ce3['order']=qs['sort'](_0x4b556b[_0xb1be('0x3a')]['sort']);_0x5c2ce3[_0xb1be('0x39')]=qs[_0xb1be('0xc5')](_[_0xb1be('0xcb')](_0x4b556b[_0xb1be('0x3a')],_0x561196['filters']));_0x5c2ce3[_0xb1be('0x39')][_0xb1be('0xd4')]=_0x585f1d['id'];if(_0x4b556b['query']['filter']){_0x5c2ce3[_0xb1be('0x39')]=_[_0xb1be('0x4c')](_0x5c2ce3[_0xb1be('0x39')],{'$or':_[_0xb1be('0x29')](_0x5c2ce3[_0xb1be('0x40')],function(_0x2c9a6a){var _0x466121={};_0x466121[_0x2c9a6a]={'$like':'%'+_0x4b556b[_0xb1be('0x3a')][_0xb1be('0x27')]+'%'};return _0x466121;})});}_0x5c2ce3=_[_0xb1be('0x4c')]({},_0x5c2ce3,_0x4b556b[_0xb1be('0xcf')]);return db[_0xb1be('0xdb')][_0xb1be('0x16')]({'where':_0x5c2ce3[_0xb1be('0x39')]})[_0xb1be('0x1b')](function(_0x42eaf0){_0x56922a[_0xb1be('0x16')]=_0x42eaf0;if(_0x4b556b[_0xb1be('0x3a')][_0xb1be('0x3b')]){_0x5c2ce3['include']=[{'all':!![]}];}return db[_0xb1be('0xdb')][_0xb1be('0x42')](_0x5c2ce3);})[_0xb1be('0x1b')](function(_0x150080){_0x56922a[_0xb1be('0x43')]=_0x150080;return _0x56922a;});}})[_0xb1be('0x1b')](respondWithFilteredResult(_0x1f98a2,_0x5c2ce3))[_0xb1be('0x49')](handleError(_0x1f98a2,null));};exports[_0xb1be('0xdc')]=function(_0x203a53,_0x29e5c6){var _0x1b0cab={};var _0x59ca8d={};var _0x52e131;var _0x22d486;return db[_0xb1be('0x31')][_0xb1be('0xbd')]({'where':{'id':_0x203a53['params']['id']}})['then'](handleEntityNotFound(_0x29e5c6,null))[_0xb1be('0x1b')](function(_0x2720d7){if(_0x2720d7){_0x52e131=_0x2720d7;_0x59ca8d[_0xb1be('0xc7')]=_[_0xb1be('0xc4')](db[_0xb1be('0xdd')][_0xb1be('0x32')]);_0x59ca8d[_0xb1be('0x3a')]=_[_0xb1be('0xc4')](_0x203a53[_0xb1be('0x3a')]);_0x59ca8d['filters']=_['intersection'](_0x59ca8d[_0xb1be('0xc7')],_0x59ca8d['query']);_0x1b0cab[_0xb1be('0x40')]=_[_0xb1be('0xc6')](_0x59ca8d[_0xb1be('0xc7')],qs[_0xb1be('0xc8')](_0x203a53[_0xb1be('0x3a')][_0xb1be('0xc8')]));_0x1b0cab[_0xb1be('0x40')]=_0x1b0cab['attributes']['length']?_0x1b0cab[_0xb1be('0x40')]:_0x59ca8d[_0xb1be('0xc7')];_0x1b0cab['order']=qs['sort'](_0x203a53['query'][_0xb1be('0xca')]);_0x1b0cab['where']=qs['filters'](_[_0xb1be('0xcb')](_0x203a53[_0xb1be('0x3a')],_0x59ca8d['filters']));if(_0x203a53[_0xb1be('0x3a')][_0xb1be('0x27')]){_0x1b0cab[_0xb1be('0x39')]=_[_0xb1be('0x4c')](_0x1b0cab[_0xb1be('0x39')],{'$or':_[_0xb1be('0x29')](_0x1b0cab[_0xb1be('0x40')],function(_0x2cf253){var _0x5f5a01={};_0x5f5a01[_0x2cf253]={'$like':'%'+_0x203a53[_0xb1be('0x3a')][_0xb1be('0x27')]+'%'};return _0x5f5a01;})});}_0x1b0cab=_[_0xb1be('0x4c')]({},_0x1b0cab,_0x203a53['options']);return _0x52e131[_0xb1be('0xdc')](_0x1b0cab);}})[_0xb1be('0x1b')](function(_0x56cb3a){if(_0x56cb3a){_0x22d486=_0x56cb3a[_0xb1be('0x5e')];if(!_0x203a53[_0xb1be('0x3a')][_0xb1be('0xbf')](_0xb1be('0xcd'))){_0x1b0cab['limit']=qs[_0xb1be('0x17')](_0x203a53[_0xb1be('0x3a')][_0xb1be('0x17')]);_0x1b0cab[_0xb1be('0x15')]=qs[_0xb1be('0x15')](_0x203a53[_0xb1be('0x3a')][_0xb1be('0x15')]);}return _0x52e131['getSmsInteractions'](_0x1b0cab);}})[_0xb1be('0x1b')](function(_0x3a7799){if(_0x3a7799){return _0x3a7799?{'count':_0x22d486,'rows':_0x3a7799}:null;}})[_0xb1be('0x1b')](respondWithResult(_0x29e5c6,null))['catch'](handleError(_0x29e5c6,null));};exports[_0xb1be('0xde')]=function(_0x3a5808,_0x1d7fa8){var _0x2fcc9f={};var _0x44df4a={};var _0x25087c;var _0x3c0a03;return db[_0xb1be('0x31')][_0xb1be('0xbd')]({'where':{'id':_0x3a5808[_0xb1be('0x4b')]['id']}})[_0xb1be('0x1b')](handleEntityNotFound(_0x1d7fa8,null))[_0xb1be('0x1b')](function(_0x36a329){if(_0x36a329){_0x25087c=_0x36a329;_0x44df4a[_0xb1be('0xc7')]=_[_0xb1be('0xc4')](db['FaxInteraction'][_0xb1be('0x32')]);_0x44df4a[_0xb1be('0x3a')]=_[_0xb1be('0xc4')](_0x3a5808[_0xb1be('0x3a')]);_0x44df4a[_0xb1be('0xc5')]=_[_0xb1be('0xc6')](_0x44df4a[_0xb1be('0xc7')],_0x44df4a['query']);_0x2fcc9f[_0xb1be('0x40')]=_[_0xb1be('0xc6')](_0x44df4a[_0xb1be('0xc7')],qs[_0xb1be('0xc8')](_0x3a5808[_0xb1be('0x3a')][_0xb1be('0xc8')]));_0x2fcc9f[_0xb1be('0x40')]=_0x2fcc9f['attributes'][_0xb1be('0x5e')]?_0x2fcc9f[_0xb1be('0x40')]:_0x44df4a[_0xb1be('0xc7')];_0x2fcc9f[_0xb1be('0xc9')]=qs['sort'](_0x3a5808[_0xb1be('0x3a')][_0xb1be('0xca')]);_0x2fcc9f[_0xb1be('0x39')]=qs['filters'](_[_0xb1be('0xcb')](_0x3a5808['query'],_0x44df4a[_0xb1be('0xc5')]));if(_0x3a5808['query'][_0xb1be('0x27')]){_0x2fcc9f[_0xb1be('0x39')]=_[_0xb1be('0x4c')](_0x2fcc9f[_0xb1be('0x39')],{'$or':_[_0xb1be('0x29')](_0x2fcc9f[_0xb1be('0x40')],function(_0x5cedb4){var _0x47abaf={};_0x47abaf[_0x5cedb4]={'$like':'%'+_0x3a5808[_0xb1be('0x3a')][_0xb1be('0x27')]+'%'};return _0x47abaf;})});}_0x2fcc9f=_[_0xb1be('0x4c')]({},_0x2fcc9f,_0x3a5808[_0xb1be('0xcf')]);return _0x25087c[_0xb1be('0xde')](_0x2fcc9f);}})[_0xb1be('0x1b')](function(_0x5677d9){if(_0x5677d9){_0x3c0a03=_0x5677d9[_0xb1be('0x5e')];if(!_0x3a5808[_0xb1be('0x3a')][_0xb1be('0xbf')](_0xb1be('0xcd'))){_0x2fcc9f[_0xb1be('0x17')]=qs[_0xb1be('0x17')](_0x3a5808[_0xb1be('0x3a')][_0xb1be('0x17')]);_0x2fcc9f[_0xb1be('0x15')]=qs['offset'](_0x3a5808[_0xb1be('0x3a')][_0xb1be('0x15')]);}return _0x25087c['getFaxInteractions'](_0x2fcc9f);}})['then'](function(_0x1c8b58){if(_0x1c8b58){return _0x1c8b58?{'count':_0x3c0a03,'rows':_0x1c8b58}:null;}})[_0xb1be('0x1b')](respondWithResult(_0x1d7fa8,null))['catch'](handleError(_0x1d7fa8,null));};exports['getWhatsappInteractions']=function(_0x3481b9,_0xf14d4b){var _0x18f3e0={};var _0x2bbd07={};var _0x4b92c7;var _0x2d7dfa;return db[_0xb1be('0x31')]['findOne']({'where':{'id':_0x3481b9[_0xb1be('0x4b')]['id']}})[_0xb1be('0x1b')](handleEntityNotFound(_0xf14d4b,null))[_0xb1be('0x1b')](function(_0x2ee7fb){if(_0x2ee7fb){_0x4b92c7=_0x2ee7fb;_0x2bbd07[_0xb1be('0xc7')]=_['keys'](db['WhatsappInteraction']['rawAttributes']);_0x2bbd07[_0xb1be('0x3a')]=_[_0xb1be('0xc4')](_0x3481b9['query']);_0x2bbd07[_0xb1be('0xc5')]=_['intersection'](_0x2bbd07[_0xb1be('0xc7')],_0x2bbd07[_0xb1be('0x3a')]);_0x18f3e0[_0xb1be('0x40')]=_[_0xb1be('0xc6')](_0x2bbd07[_0xb1be('0xc7')],qs[_0xb1be('0xc8')](_0x3481b9[_0xb1be('0x3a')][_0xb1be('0xc8')]));_0x18f3e0[_0xb1be('0x40')]=_0x18f3e0[_0xb1be('0x40')][_0xb1be('0x5e')]?_0x18f3e0['attributes']:_0x2bbd07[_0xb1be('0xc7')];_0x18f3e0[_0xb1be('0xc9')]=qs[_0xb1be('0xca')](_0x3481b9[_0xb1be('0x3a')][_0xb1be('0xca')]);_0x18f3e0[_0xb1be('0x39')]=qs[_0xb1be('0xc5')](_['pick'](_0x3481b9[_0xb1be('0x3a')],_0x2bbd07[_0xb1be('0xc5')]));if(_0x3481b9[_0xb1be('0x3a')]['filter']){_0x18f3e0['where']=_['merge'](_0x18f3e0[_0xb1be('0x39')],{'$or':_['map'](_0x18f3e0[_0xb1be('0x40')],function(_0x27eeef){var _0x12722e={};_0x12722e[_0x27eeef]={'$like':'%'+_0x3481b9[_0xb1be('0x3a')][_0xb1be('0x27')]+'%'};return _0x12722e;})});}_0x18f3e0=_['merge']({},_0x18f3e0,_0x3481b9[_0xb1be('0xcf')]);return _0x4b92c7['getWhatsappInteractions'](_0x18f3e0);}})['then'](function(_0x15f3e9){if(_0x15f3e9){_0x2d7dfa=_0x15f3e9[_0xb1be('0x5e')];if(!_0x3481b9[_0xb1be('0x3a')]['hasOwnProperty'](_0xb1be('0xcd'))){_0x18f3e0[_0xb1be('0x17')]=qs[_0xb1be('0x17')](_0x3481b9['query']['limit']);_0x18f3e0[_0xb1be('0x15')]=qs[_0xb1be('0x15')](_0x3481b9['query'][_0xb1be('0x15')]);}return _0x4b92c7[_0xb1be('0xdf')](_0x18f3e0);}})[_0xb1be('0x1b')](function(_0xa50a32){if(_0xa50a32){return _0xa50a32?{'count':_0x2d7dfa,'rows':_0xa50a32}:null;}})[_0xb1be('0x1b')](respondWithResult(_0xf14d4b,null))[_0xb1be('0x49')](handleError(_0xf14d4b,null));};exports[_0xb1be('0xe0')]=function(_0x50559d,_0x280af1,_0x2b0aa0){var _0x578903;var _0x102757;var _0x244fe0;var _0x67e4f7=!_[_0xb1be('0x59')](_0x50559d[_0xb1be('0x4b')]['id'])?_0x50559d[_0xb1be('0x4b')]['id']:!_[_0xb1be('0x59')](_0x50559d[_0xb1be('0x23')]['id'])?_0x50559d[_0xb1be('0x23')]['id']:null;return db[_0xb1be('0x31')][_0xb1be('0x2c')]({'where':{'id':_0x67e4f7,'role':{'$or':[_0xb1be('0x74'),_0xb1be('0x23'),_0xb1be('0x1c')]}},'attributes':['id',_0xb1be('0x2d'),'phone',_0xb1be('0xe1'),'role',_0xb1be('0x5b'),'loginInPause']})[_0xb1be('0x1b')](function(_0x278dfa){if(_0x278dfa){if(_0x278dfa[_0xb1be('0x21')]===_0xb1be('0x1c')){_0x578903=_0x278dfa;if(_0x50559d[_0xb1be('0x51')][_0xb1be('0x9b')]){_0x244fe0=util[_0xb1be('0x9c')](_0xb1be('0xe2'),_0x578903[_0x50559d[_0xb1be('0x51')]['interface']]);}else if(_0x50559d[_0xb1be('0x51')][_0xb1be('0xe3')]){_0x244fe0=util[_0xb1be('0x9c')](_0xb1be('0x9d'),_0x50559d['body'][_0xb1be('0xe3')]);}else{_0x244fe0=util[_0xb1be('0x9c')]('SIP/%s',_0x578903[_0xb1be('0x2d')]);}socket['to'](util[_0xb1be('0x9c')](_0xb1be('0xe4'),_0x578903['name']))[_0xb1be('0x1d')](_0xb1be('0xe5'),{'user':{'id':_0x578903['id'],'name':_0x578903[_0xb1be('0x2d')]},'ip':_0x50559d[_0xb1be('0xe6')]['x-forwarded-for']||_0x50559d[_0xb1be('0xe7')]['remoteAddress']||_0x50559d[_0xb1be('0xe8')][_0xb1be('0xe9')]||_0x50559d[_0xb1be('0xe7')][_0xb1be('0xe8')][_0xb1be('0xe9')]});return db[_0xb1be('0x9f')][_0xb1be('0x1f')]({'where':{'membername':_0x578903[_0xb1be('0x2d')]},'individualHooks':!![]});}}else{throw new db[(_0xb1be('0x82'))][(_0xb1be('0x83'))](_0xb1be('0xea'));}})['then'](function(){if(_0x578903){return _0x578903['getVoiceQueues']({'raw':!![]});}})[_0xb1be('0x1b')](function(_0x1f0fa3){if(_0x578903){if(_0x1f0fa3){_0x102757=_0x1f0fa3;if(_0x102757[_0xb1be('0x5e')]){var _0x392963=_0x102757[_0xb1be('0x29')](function(_0x3e7858){var _0x27436d={'membername':_0x578903[_0xb1be('0x2d')],'UserId':_0x578903['id'],'queue_name':_0x3e7858[_0xb1be('0x2d')],'VoiceQueueId':_0x3e7858['id'],'interface':_0x244fe0,'paused':_0x578903[_0xb1be('0x90')]||![],'penalty':_0x3e7858[_0xb1be('0xeb')]||0x0};return db[_0xb1be('0x9f')][_0xb1be('0xec')](_0x27436d);});return Promise[_0xb1be('0x50')](_0x392963);}}}})[_0xb1be('0x1b')](function(){if(_0x578903){return db['MemberReport'][_0xb1be('0x42')]({'where':{'membername':_0x578903[_0xb1be('0x2d')],'exitAt':null}});}})['then'](function(_0x35b1c8){if(_0x578903){var _0x143019=[];_0x35b1c8[_0xb1be('0xed')](function(_0x449619){_0x143019[_0xb1be('0x41')](_0x449619['update']({'exitAt':moment()[_0xb1be('0x9c')](_0xb1be('0xee'))}));});return Promise[_0xb1be('0x50')](_0x143019);}})['then'](function(){if(_0x578903){var _0x4f43ea=[];var _0x1912cb=[];var _0x2fc02d=utils[_0xb1be('0xef')]();var _0x46fd1f={'membername':_0x578903[_0xb1be('0x2d')],'interface':_0x244fe0,'enterAt':moment()[_0xb1be('0x9c')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x578903[_0xb1be('0x21')],'internal':_0x578903['internal']};_0x2fc02d[_0xb1be('0xed')](function(_0x56be90){_0x4f43ea[_0xb1be('0x41')](_[_0xb1be('0x4c')]({'channel':_0x56be90,'type':_0xb1be('0xf0'),'data1':_0x50559d[_0xb1be('0x51')][_0xb1be('0xf1')],'data2':_0x244fe0},_0x46fd1f));if(_0x578903[_0xb1be('0x90')]){_0x1912cb['push'](_[_0xb1be('0x4c')]({'channel':_0x56be90,'type':_0xb1be('0xf2'),'data1':_0xb1be('0xf3')},_0x46fd1f));}});return db['MemberReport'][_0xb1be('0x7a')](_0x4f43ea[_0xb1be('0xbb')](_0x1912cb),{'individualHooks':!![]});}})[_0xb1be('0x1b')](function(){if(_0x578903){return _0x578903['update']({'online':!![],'lastLoginAt':moment()[_0xb1be('0x9c')](_0xb1be('0xee')),'voicePause':_0x578903[_0xb1be('0x90')]||![],'mailPause':_0x578903['loginInPause']||![],'chatPause':_0x578903['loginInPause']||![],'faxPause':_0x578903[_0xb1be('0x90')]||![],'smsPause':_0x578903[_0xb1be('0x90')]||![],'openchannelPause':_0x578903[_0xb1be('0x90')]||![],'whatsappPause':_0x578903['loginInPause']||![],'pauseType':_0x578903['loginInPause']?_0xb1be('0xf3'):null,'interface':_0x244fe0,'lastPauseAt':moment()[_0xb1be('0x9c')](_0xb1be('0xee'))});}})[_0xb1be('0x1b')](function(_0x215703){if(_0x50559d['isMiddleware']){return _0x2b0aa0();}else{return Promise['resolve'](_0x215703)['then'](respondWithResult(_0x280af1,null));}})['catch'](handleError(_0x280af1,null));};exports['logout']=function(_0x5d01ca,_0x140bf1){var _0xf87366;return db[_0xb1be('0x31')][_0xb1be('0x2c')]({'where':{'id':_0x5d01ca[_0xb1be('0x4b')]['id'],'role':_0xb1be('0x1c')},'attributes':['id','name',_0xb1be('0x21')]})[_0xb1be('0x1b')](handleEntityNotFound(_0x140bf1,null))[_0xb1be('0x1b')](function(_0x1ff745){if(_0x1ff745){_0xf87366=_0x1ff745;return db[_0xb1be('0x9f')]['destroy']({'where':{'membername':_0xf87366[_0xb1be('0x2d')]},'individualHooks':!![]});}})[_0xb1be('0x1b')](function(){return db['MemberReport'][_0xb1be('0x42')]({'where':{'membername':_0xf87366[_0xb1be('0x2d')],'exitAt':null}});})[_0xb1be('0x1b')](function(_0x26e6cd){var _0x43c9d7=[];_0x26e6cd[_0xb1be('0xed')](function(_0x1206f5){_0x43c9d7[_0xb1be('0x41')](_0x1206f5[_0xb1be('0x1a')]({'exitAt':moment()['format'](_0xb1be('0xee'))}));});return Promise[_0xb1be('0x50')](_0x43c9d7);})[_0xb1be('0x1b')](function(){return _0xf87366[_0xb1be('0x1a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xb1be('0x1b')](respondWithResult(_0x140bf1,null))['catch'](handleError(_0x140bf1,null));};exports[_0xb1be('0xf4')]=function(_0x5a08b1,_0xde93d5){var _0x179d77;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x5a08b1[_0xb1be('0x4b')]['id']},'individualHooks':!![]})[_0xb1be('0x1b')](function(){return db[_0xb1be('0x31')][_0xb1be('0x2c')]({'where':{'id':_0x5a08b1[_0xb1be('0x4b')]['id'],'role':_0xb1be('0x1c')},'attributes':['id',_0xb1be('0x2d'),'role',_0xb1be('0x5b'),'interface',_0xb1be('0xf5')]});})[_0xb1be('0x1b')](handleEntityNotFound(_0xde93d5,null))['then'](function(_0x23fa6b){if(_0x23fa6b){_0x179d77=_0x23fa6b;return db[_0xb1be('0xf6')][_0xb1be('0x42')]({'where':{'membername':_0x179d77[_0xb1be('0x2d')],'type':_0xb1be('0xf2'),'exitAt':null}});}})[_0xb1be('0x1b')](function(_0x10ea32){if(_0x10ea32[_0xb1be('0x5e')]){var _0x44c4ff=moment()[_0xb1be('0x9c')](_0xb1be('0xee'));for(var _0x3677e9=0x0,_0x40716b=_0x10ea32[_0xb1be('0x5e')];_0x3677e9<_0x40716b;_0x3677e9++){_0x10ea32[_0x3677e9][_0xb1be('0xf7')]({'exitAt':_0x44c4ff});}}})[_0xb1be('0x1b')](function(){var _0x4eda1c=[];var _0x55638b=utils[_0xb1be('0xef')]();_0x55638b[_0xb1be('0xed')](function(_0x44cce2){_0x4eda1c[_0xb1be('0x41')]({'channel':_0x44cce2,'membername':_0x179d77[_0xb1be('0x2d')],'interface':_[_0xb1be('0x59')](_0x179d77['interface'])?util[_0xb1be('0x9c')](_0xb1be('0x9d'),_0x179d77[_0xb1be('0x2d')]):_0x179d77[_0xb1be('0x9b')],'type':_0xb1be('0xf2'),'enterAt':moment()[_0xb1be('0x9c')](_0xb1be('0xee')),'data1':_0x5a08b1[_0xb1be('0x51')]['type']||_0xb1be('0xf8'),'role':_0x179d77[_0xb1be('0x21')],'internal':_0x179d77[_0xb1be('0x5b')]});});return db[_0xb1be('0xf6')][_0xb1be('0x7a')](_0x4eda1c,{'individualHooks':!![]});})[_0xb1be('0x1b')](function(){return _0x179d77[_0xb1be('0x1a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5a08b1[_0xb1be('0x51')][_0xb1be('0x33')]||_0xb1be('0xf8'),'lastPauseAt':moment()[_0xb1be('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xb1be('0x1b')](respondWithResult(_0xde93d5,null))['catch'](handleError(_0xde93d5,null));};exports['unpause']=function(_0x5e8dc2,_0x15143a){if(_0x5e8dc2[_0xb1be('0x51')][_0xb1be('0x8f')]&&!utils[_0xb1be('0x92')](_0x5e8dc2[_0xb1be('0x51')]['channel'])){throw new APIBadRequestError(util[_0xb1be('0x9c')](_0xb1be('0xf9'),_0x5e8dc2[_0xb1be('0x51')][_0xb1be('0x8f')]));}return db['User'][_0xb1be('0x2c')]({'where':{'id':_0x5e8dc2[_0xb1be('0x4b')]['id']},'attributes':['id',_0xb1be('0x2d'),'role',_0xb1be('0x5b'),'interface','online','voicePause','mailPause','chatPause',_0xb1be('0xfa'),_0xb1be('0xfb'),_0xb1be('0xfc'),_0xb1be('0xfd'),_0xb1be('0xfe'),'lastPauseAt']})['then'](function(_0x24b993){if(!_0x24b993){throw new APINotFoundError(util[_0xb1be('0x9c')](_0xb1be('0xbe'),_0x5e8dc2[_0xb1be('0x4b')]['id']));}return _0x24b993[_0xb1be('0xff')](_0x5e8dc2[_0xb1be('0x51')]['channel']);})[_0xb1be('0x1b')](respondWithResult(_0x15143a,null))[_0xb1be('0x49')](APIHandleError(_0x15143a));};exports[_0xb1be('0x100')]=function(_0x49e7a7,_0x2eea71){var _0x3fe37c={};var _0xf1a9fb={};var _0x310d03;var _0x369d7c;return db[_0xb1be('0x31')][_0xb1be('0xbd')]({'where':{'id':_0x49e7a7[_0xb1be('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2eea71,null))['then'](function(_0x3d0d51){if(_0x3d0d51){_0x310d03=_0x3d0d51;_0xf1a9fb['model']=_['keys'](db[_0xb1be('0x101')][_0xb1be('0x32')]);_0xf1a9fb[_0xb1be('0x3a')]=_[_0xb1be('0xc4')](_0x49e7a7[_0xb1be('0x3a')]);_0xf1a9fb[_0xb1be('0xc5')]=_[_0xb1be('0xc6')](_0xf1a9fb[_0xb1be('0xc7')],_0xf1a9fb[_0xb1be('0x3a')]);_0x3fe37c[_0xb1be('0x40')]=_[_0xb1be('0xc6')](_0xf1a9fb[_0xb1be('0xc7')],qs[_0xb1be('0xc8')](_0x49e7a7[_0xb1be('0x3a')][_0xb1be('0xc8')]));_0x3fe37c[_0xb1be('0x40')]=_0x3fe37c[_0xb1be('0x40')]['length']?_0x3fe37c['attributes']:_0xf1a9fb['model'];_0x3fe37c[_0xb1be('0xc9')]=qs[_0xb1be('0xca')](_0x49e7a7[_0xb1be('0x3a')]['sort']);_0x3fe37c[_0xb1be('0x39')]=qs['filters'](_[_0xb1be('0xcb')](_0x49e7a7[_0xb1be('0x3a')],_0xf1a9fb[_0xb1be('0xc5')]));if(_0x49e7a7[_0xb1be('0x3a')][_0xb1be('0x27')]){_0x3fe37c[_0xb1be('0x39')]=_[_0xb1be('0x4c')](_0x3fe37c[_0xb1be('0x39')],{'$or':_[_0xb1be('0x29')](_0x3fe37c[_0xb1be('0x40')],function(_0x472691){var _0x252c64={};_0x252c64[_0x472691]={'$like':'%'+_0x49e7a7[_0xb1be('0x3a')]['filter']+'%'};return _0x252c64;})});}_0x3fe37c=_[_0xb1be('0x4c')]({},_0x3fe37c,_0x49e7a7[_0xb1be('0xcf')]);return _0x310d03[_0xb1be('0x100')](_0x3fe37c);}})['then'](function(_0x5ce84f){if(_0x5ce84f){_0x369d7c=_0x5ce84f[_0xb1be('0x5e')];if(!_0x49e7a7[_0xb1be('0x3a')][_0xb1be('0xbf')](_0xb1be('0xcd'))){_0x3fe37c[_0xb1be('0x17')]=qs[_0xb1be('0x17')](_0x49e7a7[_0xb1be('0x3a')]['limit']);_0x3fe37c[_0xb1be('0x15')]=qs[_0xb1be('0x15')](_0x49e7a7[_0xb1be('0x3a')][_0xb1be('0x15')]);}return _0x310d03[_0xb1be('0x100')](_0x3fe37c);}})['then'](function(_0x1b4a13){if(_0x1b4a13){return _0x1b4a13?{'count':_0x369d7c,'rows':_0x1b4a13}:null;}})[_0xb1be('0x1b')](respondWithResult(_0x2eea71,null))[_0xb1be('0x49')](handleError(_0x2eea71,null));};exports[_0xb1be('0x102')]=function(_0xbc449b,_0x124c65){var _0x39ed8b=_0xbc449b[_0xb1be('0x4b')]['id'];var _0x174624=_0xbc449b[_0xb1be('0x51')]?_0xbc449b[_0xb1be('0x51')][_0xb1be('0x54')]:null;var _0x123e2e=[];return Promise[_0xb1be('0x103')]()[_0xb1be('0x1b')](function(){if(!_0x174624)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xb1be('0x1b')](function(){return db[_0xb1be('0x31')][_0xb1be('0xbd')]({'where':{'id':_0x39ed8b}});})[_0xb1be('0x1b')](function(_0x69559b){if(!_0x69559b)throw new APINotFoundError(util[_0xb1be('0x9c')](_0xb1be('0xbe'),_0xbc449b[_0xb1be('0x4b')]['id']));return db[_0xb1be('0x104')]['transaction'](function(_0x6abf51){return _0x69559b['addTeams'](_0x174624,{'transaction':_0x6abf51})[_0xb1be('0x1b')](function(){return db[_0xb1be('0x101')][_0xb1be('0x42')]({'where':{'id':{'$in':_0x174624}}});})['then'](function(_0x386910){var _0x2e7db2=_[_0xb1be('0x29')](_0x386910,function(_0x33dfec){return _0x33dfec['getAssociatedQueues']();});return Promise[_0xb1be('0x50')](_0x2e7db2);})[_0xb1be('0x1b')](function(_0x563fec){_0x123e2e=_[_0xb1be('0x105')](_0x563fec);var _0x35997e=_[_0xb1be('0x29')](_0x123e2e,function(_0x3925be){return _0x3925be['addAgent'](_0x69559b['id'],{'transaction':_0x6abf51});});return Promise[_0xb1be('0x50')](_0x35997e);})[_0xb1be('0x1b')](function(){if(!_0x69559b[_0xb1be('0xf5')])return;var _0x552360=_[_0xb1be('0x27')](_0x123e2e,function(_0xf6ff3d){return _0xf6ff3d['getDataValue'](_0xb1be('0x8f'))===_0xb1be('0x106');});var _0x56b51f=_[_0xb1be('0x29')](_0x552360,function(_0x4a9a3a){return db[_0xb1be('0x9f')][_0xb1be('0xec')]({'membername':_0x69559b[_0xb1be('0x2d')],'UserId':_0x69559b['id'],'queue_name':_0x4a9a3a['name'],'VoiceQueueId':_0x4a9a3a['id'],'interface':_[_0xb1be('0x59')](_0x69559b[_0xb1be('0x9b')])?util[_0xb1be('0x9c')](_0xb1be('0x9d'),_0x69559b['name']):_0x69559b[_0xb1be('0x9b')],'paused':_0x69559b['voicePause']||![],'penalty':_0x69559b[_0xb1be('0x9e')]},{'transaction':_0x6abf51});});return Promise[_0xb1be('0x50')](_0x56b51f);})[_0xb1be('0x1b')](function(){return db[_0xb1be('0x107')][_0xb1be('0x42')]({'where':{'teamId':{'$in':_0x174624}}});})[_0xb1be('0x1b')](function(_0x3165c3){var _0x7d8a2c=_[_0xb1be('0x29')](_0x3165c3,function(_0x383523){return db[_0xb1be('0x108')][_0xb1be('0x72')]({'UserId':_0x69559b['id'],'VoicePrefixId':_0x383523[_0xb1be('0x109')]},{'transaction':_0x6abf51});});return Promise[_0xb1be('0x50')](_0x7d8a2c);});});})[_0xb1be('0x1b')](function(){for(var _0x501b79=0x0;_0x501b79<_0x123e2e['length'];_0x501b79++){var _0x5848a6=_0x123e2e[_0x501b79][_0xb1be('0x10a')](_0xb1be('0x8f'));var _0x115174=_0x5848a6+_0xb1be('0x97');socket[_0xb1be('0x1d')](_0xb1be('0x23')+_0x5848a6+'Queue:save',{'UserId':_0x39ed8b,['queueField']:_0x123e2e[_0x501b79]['id']});}})[_0xb1be('0x1b')](respondWithStatusCode(_0x124c65,null))['catch'](APIHandleError(_0x124c65));};exports[_0xb1be('0x10b')]=function(_0x5cb593,_0x495fa8){var _0x5c61c1=_0x5cb593['params']['id'];var _0x3a852c=null;if(_0x5cb593[_0xb1be('0x3a')]['ids']){_0x3a852c=_[_0xb1be('0xa3')](_0x5cb593[_0xb1be('0x3a')][_0xb1be('0x54')])?_0x5cb593['query']['ids']:[_0x5cb593[_0xb1be('0x3a')]['ids']];}var _0xab0215=[];return Promise['resolve']()[_0xb1be('0x1b')](function(){if(!_0x3a852c)throw new APIBadRequestError(_0xb1be('0x10c'));})['then'](function(){return db['User'][_0xb1be('0xbd')]({'where':{'id':_0x5c61c1}});})[_0xb1be('0x1b')](function(_0xa0272){if(!_0xa0272)throw new APINotFoundError(util[_0xb1be('0x9c')](_0xb1be('0xbe'),_0x5cb593['params']['id']));return db[_0xb1be('0x104')][_0xb1be('0x10d')](function(_0x38185d){return _0xa0272[_0xb1be('0x10b')](_0x3a852c,{'transaction':_0x38185d})[_0xb1be('0x1b')](function(){return db['Team'][_0xb1be('0x42')]({'where':{'id':{'$in':_0x3a852c}}});})[_0xb1be('0x1b')](function(_0x445e31){var _0x2edd90=_['map'](_0x445e31,function(_0x509b56){return _0x509b56['getAssociatedQueues']();});return Promise[_0xb1be('0x50')](_0x2edd90);})[_0xb1be('0x1b')](function(_0x87390a){_0xab0215=_['flattenDeep'](_0x87390a);var _0x3b3e9d=_['map'](_0xab0215,function(_0x260f01){return _0x260f01[_0xb1be('0x10e')](_0xa0272['id'],{'transaction':_0x38185d});});return Promise[_0xb1be('0x50')](_0x3b3e9d);})[_0xb1be('0x1b')](function(){if(!_0xa0272['online'])return;var _0x3cb9b9=_[_0xb1be('0x27')](_0xab0215,function(_0x3e652d){return _0x3e652d[_0xb1be('0x10a')](_0xb1be('0x8f'))==='Voice';});var _0x398f54=_[_0xb1be('0x29')](_0x3cb9b9,function(_0x268cd0){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x268cd0['id'],'UserId':_0xa0272['id']},'transaction':_0x38185d});});return Promise[_0xb1be('0x50')](_0x398f54);})[_0xb1be('0x1b')](function(){return db[_0xb1be('0x107')]['findAll']({'where':{'teamId':{'$in':_0x3a852c}}});})[_0xb1be('0x1b')](function(_0x1b5d25){var _0x421997=_[_0xb1be('0x29')](_0x1b5d25,function(_0x5837d3){return db[_0xb1be('0x108')][_0xb1be('0x1f')]({'where':{'UserId':_0xa0272['id'],'VoicePrefixId':_0x5837d3[_0xb1be('0x109')]}},{'transaction':_0x38185d});});return Promise[_0xb1be('0x50')](_0x421997);});});})[_0xb1be('0x1b')](function(){for(var _0x1deecb=0x0;_0x1deecb<_0xab0215['length'];_0x1deecb++){var _0x4e0e98=_0xab0215[_0x1deecb]['getDataValue'](_0xb1be('0x8f'));var _0x55df85=_0x4e0e98+_0xb1be('0x97');socket[_0xb1be('0x1d')](_0xb1be('0x23')+_0x4e0e98+'Queue:remove',{'UserId':_0x5c61c1,['queueField']:_0xab0215[_0x1deecb]['id']});}})[_0xb1be('0x1b')](respondWithStatusCode(_0x495fa8,null))[_0xb1be('0x49')](APIHandleError(_0x495fa8));};exports[_0xb1be('0x10f')]=function(_0x526400,_0x275f91){var _0x245ef4={};var _0x1fbc32={};var _0x3377a5;var _0x5369db;return db[_0xb1be('0x31')][_0xb1be('0xbd')]({'where':{'id':_0x526400[_0xb1be('0x4b')]['id']}})['then'](handleEntityNotFound(_0x275f91,null))['then'](function(_0x1588b9){if(_0x1588b9){_0x3377a5=_0x1588b9;_0x1fbc32['model']=_['keys'](db['CmList']['rawAttributes']);_0x1fbc32[_0xb1be('0x3a')]=_[_0xb1be('0xc4')](_0x526400['query']);_0x1fbc32[_0xb1be('0xc5')]=_[_0xb1be('0xc6')](_0x1fbc32['model'],_0x1fbc32[_0xb1be('0x3a')]);_0x245ef4['attributes']=_[_0xb1be('0xc6')](_0x1fbc32[_0xb1be('0xc7')],qs[_0xb1be('0xc8')](_0x526400[_0xb1be('0x3a')][_0xb1be('0xc8')]));_0x245ef4[_0xb1be('0x40')]=_0x245ef4[_0xb1be('0x40')][_0xb1be('0x5e')]?_0x245ef4[_0xb1be('0x40')]:_0x1fbc32['model'];_0x245ef4[_0xb1be('0xc9')]=qs[_0xb1be('0xca')](_0x526400['query'][_0xb1be('0xca')]);_0x245ef4[_0xb1be('0x39')]=qs[_0xb1be('0xc5')](_[_0xb1be('0xcb')](_0x526400[_0xb1be('0x3a')],_0x1fbc32['filters']));if(_0x526400[_0xb1be('0x3a')][_0xb1be('0x27')]){_0x245ef4[_0xb1be('0x39')]=_[_0xb1be('0x4c')](_0x245ef4[_0xb1be('0x39')],{'$or':_[_0xb1be('0x29')](_0x245ef4[_0xb1be('0x40')],function(_0x5ac073){var _0x1337cb={};_0x1337cb[_0x5ac073]={'$like':'%'+_0x526400[_0xb1be('0x3a')][_0xb1be('0x27')]+'%'};return _0x1337cb;})});}_0x245ef4=_[_0xb1be('0x4c')]({},_0x245ef4,_0x526400[_0xb1be('0xcf')]);return _0x3377a5['getLists'](_0x245ef4);}})['then'](function(_0x556258){if(_0x556258){_0x5369db=_0x556258[_0xb1be('0x5e')];if(!_0x526400[_0xb1be('0x3a')][_0xb1be('0xbf')]('nolimit')){_0x245ef4[_0xb1be('0x17')]=qs[_0xb1be('0x17')](_0x526400[_0xb1be('0x3a')][_0xb1be('0x17')]);_0x245ef4[_0xb1be('0x15')]=qs[_0xb1be('0x15')](_0x526400[_0xb1be('0x3a')][_0xb1be('0x15')]);}return _0x3377a5[_0xb1be('0x10f')](_0x245ef4);}})[_0xb1be('0x1b')](function(_0x16b7a3){if(_0x16b7a3){return _0x16b7a3?{'count':_0x5369db,'rows':_0x16b7a3}:null;}})['then'](respondWithResult(_0x275f91,null))[_0xb1be('0x49')](handleError(_0x275f91,null));};exports[_0xb1be('0x110')]=function(_0x410f07,_0x4fa3bc){var _0x41f062={};var _0x2833c7={};var _0x3350f4;return db[_0xb1be('0x31')]['findOne']({'where':{'id':_0x410f07[_0xb1be('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4fa3bc,null))[_0xb1be('0x1b')](function(_0x27540){if(_0x27540){_0x3350f4=_0x27540;_0x2833c7[_0xb1be('0xc7')]=_[_0xb1be('0xc4')](db['User'][_0xb1be('0x32')]);_0x2833c7[_0xb1be('0x3a')]=_[_0xb1be('0xc4')](_0x410f07[_0xb1be('0x3a')]);_0x2833c7['filters']=_[_0xb1be('0xc6')](_0x2833c7['model'],_0x2833c7['query']);_0x41f062[_0xb1be('0x40')]=_[_0xb1be('0xc6')](_0x2833c7['model'],qs[_0xb1be('0xc8')](_0x410f07[_0xb1be('0x3a')][_0xb1be('0xc8')]));_0x41f062['attributes']=_0x41f062[_0xb1be('0x40')][_0xb1be('0x5e')]?_0x41f062[_0xb1be('0x40')]:_0x2833c7[_0xb1be('0xc7')];_0x41f062[_0xb1be('0xc9')]=qs[_0xb1be('0xca')](_0x410f07[_0xb1be('0x3a')][_0xb1be('0xca')]);_0x41f062[_0xb1be('0x39')]=qs[_0xb1be('0xc5')](_['pick'](_0x410f07[_0xb1be('0x3a')],_0x2833c7[_0xb1be('0xc5')]));if(_0x410f07[_0xb1be('0x3a')][_0xb1be('0x27')]){_0x41f062[_0xb1be('0x39')]=_[_0xb1be('0x4c')](_0x41f062[_0xb1be('0x39')],{'$or':_[_0xb1be('0x29')](_0x41f062[_0xb1be('0x40')],function(_0x552722){var _0x570fc6={};_0x570fc6[_0x552722]={'$like':'%'+_0x410f07['query']['filter']+'%'};return _0x570fc6;})});}_0x41f062[_0xb1be('0xc7')]=db[_0xb1be('0x31')];_0x41f062['as']='Agents';_0x41f062=_[_0xb1be('0x4c')]({},_0x41f062,_0x410f07[_0xb1be('0xcf')]);return _0x3350f4[_0xb1be('0x111')]({'include':[_0x41f062]});}})[_0xb1be('0x1b')](function(_0x9dd2a1){if(_0x9dd2a1){var _0x24b533={},_0xa1501c=[];for(var _0x1f83c9=0x0;_0x1f83c9<_0x9dd2a1['length'];_0x1f83c9+=0x1){for(var _0x4a19aa=0x0,_0x2c0675;_0x4a19aa<_0x9dd2a1[_0x1f83c9][_0xb1be('0x24')][_0xb1be('0x5e')];_0x4a19aa+=0x1){_0x2c0675=_0x9dd2a1[_0x1f83c9][_0xb1be('0x24')][_0x4a19aa]['get']({'plain':!![]});_0x24b533[_0x2c0675['id']]=_0x2c0675;}}_0x24b533=_[_0xb1be('0x112')](_0x24b533);for(var _0x52c761=qs['offset'](_0x410f07[_0xb1be('0x3a')][_0xb1be('0x15')]);_0x52c761<_0x24b533[_0xb1be('0x5e')]&&_0xa1501c[_0xb1be('0x5e')]=_0x2a88bd['agents']){throw new Error(_0xe805('0x50'));}})[_0xe805('0x17')](function(){if(_0xd88a0c){return db[_0xe805('0x28')]['destroy']({'where':{'membername':_0xd88a0c['name']},'individualHooks':!![]});}})['then'](function(){if(_0xd88a0c){return _0xd88a0c[_0xe805('0x51')]({'raw':!![]});}})[_0xe805('0x17')](function(_0x1f7ef9){if(_0xd88a0c){if(_0x1f7ef9){var _0x47da6e=[];_0x2285e2=_0x1f7ef9;if(_0x2285e2['length']){for(var _0x406207=0x0;_0x406207<_0x2285e2['length'];_0x406207++){_0x47da6e[_0xe805('0x2e')](db['UserVoiceQueueRt'][_0xe805('0x52')]({'membername':_0xd88a0c[_0xe805('0x21')],'UserId':_0xd88a0c['id'],'queue_name':_0x2285e2[_0x406207][_0xe805('0x21')],'VoiceQueueId':_0x2285e2[_0x406207]['id'],'interface':_0x52400f,'paused':_0xd88a0c[_0xe805('0x4a')]||![],'penalty':_0x2285e2[_0x406207]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xe805('0x46')](_0x47da6e);}}}})['then'](function(){if(_0xd88a0c){return db['MemberReport']['findAll']({'where':{'membername':_0xd88a0c[_0xe805('0x21')],'exitAt':null}});}})[_0xe805('0x17')](function(_0x4e7391){if(_0xd88a0c){if(_0x4e7391&&_0x4e7391[_0xe805('0x2b')]){var _0x4277c5=[];_0x4e7391[_0xe805('0x2d')](function(_0x5d9f02){_0x4277c5['push'](_0x5d9f02[_0xe805('0x35')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xe805('0x46')](_0x4277c5);}}})[_0xe805('0x17')](function(){if(_0xd88a0c){var _0xf85727=[];var _0x439475=[];var _0x2994a1=utils['getChannels']();var _0x1d7610={'membername':_0xd88a0c[_0xe805('0x21')],'interface':_0x52400f,'enterAt':moment()[_0xe805('0x25')](_0xe805('0x2a')),'role':_0xd88a0c['role'],'internal':_0xd88a0c[_0xe805('0x23')]};_0x2994a1[_0xe805('0x2d')](function(_0x48db27){_0xf85727[_0xe805('0x2e')](_['merge']({'channel':_0x48db27,'type':_0xe805('0x53'),'data1':'callysquare','data2':_0x52400f},_0x1d7610));if(_0xd88a0c[_0xe805('0x4a')]){_0x439475[_0xe805('0x2e')](_['merge']({'channel':_0x48db27,'type':_0xe805('0x29'),'data1':_0xe805('0x54')},_0x1d7610));}});return db[_0xe805('0x33')]['bulkCreate'](_0xf85727['concat'](_0x439475),{'individualHooks':!![]});}})[_0xe805('0x17')](function(){if(_0xd88a0c){return _0xd88a0c['update']({'online':!![],'lastLoginAt':moment()[_0xe805('0x25')](_0xe805('0x2a')),'voicePause':_0xd88a0c[_0xe805('0x4a')]||![],'mailPause':_0xd88a0c[_0xe805('0x4a')]||![],'chatPause':_0xd88a0c['loginInPause']||![],'faxPause':_0xd88a0c['loginInPause']||![],'smsPause':_0xd88a0c[_0xe805('0x4a')]||![],'openchannelPause':_0xd88a0c[_0xe805('0x4a')]||![],'pauseType':_0xd88a0c['loginInPause']?_0xe805('0x54'):null,'lastPauseAt':moment()[_0xe805('0x25')](_0xe805('0x2a')),'interface':_0x52400f});}})['then'](function(_0x791f24){_0x42e9bc(_0x791f24);})[_0xe805('0x1b')](function(_0x1fdadf){_0x53f7ea(_0x19207f[_0xe805('0x1c')](0x1f4,_0x1fdadf['message']));});});}; \ No newline at end of file +var _0x84de=['LOGININPAUSE','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','register','GetUser','findAll','options','where','attributes','limit','include','map','model','info','debug','catch','error','message','ShowUser','User','find','then','stringify','PauseUser','name','internal','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','interface','body','DEFAULT\x20PAUSE','role','uniqueid','bulkCreate','type','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','system','all','LoginUser','mobile','phone','loginInPause','count','agent','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','merge','LOGIN','callysquare','concat'];(function(_0x57e642,_0x202af7){var _0x364104=function(_0x449290){while(--_0x449290){_0x57e642['push'](_0x57e642['shift']());}};_0x364104(++_0x202af7);}(_0x84de,0x16d));var _0xe84d=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0x84de[_0x276468];return _0x36dc3a;};'use strict';var _=require('lodash');var util=require(_0xe84d('0x0'));var moment=require(_0xe84d('0x1'));var BPromise=require(_0xe84d('0x2'));var Redis=require(_0xe84d('0x3'));var db=require(_0xe84d('0x4'))['db'];var utils=require(_0xe84d('0x5'));var logger=require(_0xe84d('0x6'))(_0xe84d('0x7'));var config=require(_0xe84d('0x8'));config['redis']=_['defaults'](config[_0xe84d('0x9')],{'host':_0xe84d('0xa'),'port':0x18eb});var socket=require(_0xe84d('0xb'))(new Redis(config['redis']));require('./user.socket')[_0xe84d('0xc')](socket);exports[_0xe84d('0xd')]=function(_0x4cc93d){var _0x5ce739=this;return new Promise(function(_0x4b41b,_0x47eb2d){return db['User'][_0xe84d('0xe')]({'raw':_0x4cc93d[_0xe84d('0xf')]?_0x4cc93d[_0xe84d('0xf')]['raw']===undefined?!![]:![]:!![],'where':_0x4cc93d[_0xe84d('0xf')]?_0x4cc93d[_0xe84d('0xf')][_0xe84d('0x10')]||null:null,'attributes':_0x4cc93d[_0xe84d('0xf')]?_0x4cc93d[_0xe84d('0xf')][_0xe84d('0x11')]||null:null,'limit':_0x4cc93d['options']?_0x4cc93d[_0xe84d('0xf')][_0xe84d('0x12')]||null:null,'include':_0x4cc93d[_0xe84d('0xf')]?_0x4cc93d[_0xe84d('0xf')][_0xe84d('0x13')]?_[_0xe84d('0x14')](_0x4cc93d[_0xe84d('0xf')][_0xe84d('0x13')],function(_0x46016e){return{'model':db[_0x46016e['model']],'as':_0x46016e['as'],'attributes':_0x46016e[_0xe84d('0x11')],'include':_0x46016e[_0xe84d('0x13')]?_[_0xe84d('0x14')](_0x46016e['include'],function(_0x563b8a){return{'model':db[_0x563b8a['model']],'as':_0x563b8a['as'],'attributes':_0x563b8a[_0xe84d('0x11')],'include':_0x563b8a['include']?_['map'](_0x563b8a['include'],function(_0x13a40b){return{'model':db[_0x13a40b[_0xe84d('0x15')]],'as':_0x13a40b['as'],'attributes':_0x13a40b[_0xe84d('0x11')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x175c48){logger[_0xe84d('0x16')](_0xe84d('0xd'),_0x4cc93d);logger[_0xe84d('0x17')](_0xe84d('0xd'),_0x4cc93d,JSON['stringify'](_0x175c48));_0x4b41b(_0x175c48);})[_0xe84d('0x18')](function(_0x3e7323){logger[_0xe84d('0x19')](_0xe84d('0xd'),_0x3e7323['message'],_0x4cc93d);_0x47eb2d(_0x5ce739[_0xe84d('0x19')](0x1f4,_0x3e7323[_0xe84d('0x1a')]));});});};exports[_0xe84d('0x1b')]=function(_0x364e39){var _0x5e7501=this;return new Promise(function(_0x37d114,_0x1ada5f){return db[_0xe84d('0x1c')][_0xe84d('0x1d')]({'raw':_0x364e39['options']?_0x364e39['options']['raw']===undefined?!![]:![]:!![],'where':_0x364e39['options']?_0x364e39[_0xe84d('0xf')][_0xe84d('0x10')]||null:null,'attributes':_0x364e39[_0xe84d('0xf')]?_0x364e39[_0xe84d('0xf')][_0xe84d('0x11')]||null:null,'include':_0x364e39[_0xe84d('0xf')]?_0x364e39[_0xe84d('0xf')]['include']?_['map'](_0x364e39[_0xe84d('0xf')]['include'],function(_0x14ac2b){return{'model':db[_0x14ac2b[_0xe84d('0x15')]],'as':_0x14ac2b['as'],'attributes':_0x14ac2b['attributes'],'include':_0x14ac2b['include']?_['map'](_0x14ac2b[_0xe84d('0x13')],function(_0x3fa5a9){return{'model':db[_0x3fa5a9[_0xe84d('0x15')]],'as':_0x3fa5a9['as'],'attributes':_0x3fa5a9[_0xe84d('0x11')],'include':_0x3fa5a9[_0xe84d('0x13')]?_[_0xe84d('0x14')](_0x3fa5a9[_0xe84d('0x13')],function(_0x5672f9){return{'model':db[_0x5672f9[_0xe84d('0x15')]],'as':_0x5672f9['as'],'attributes':_0x5672f9[_0xe84d('0x11')]};}):[]};}):[]};}):[]:[]})[_0xe84d('0x1e')](function(_0x24fb75){logger['info'](_0xe84d('0x1b'),_0x364e39);logger['debug'](_0xe84d('0x1b'),_0x364e39,JSON[_0xe84d('0x1f')](_0x24fb75));_0x37d114(_0x24fb75);})[_0xe84d('0x18')](function(_0x3d05f9){logger[_0xe84d('0x19')]('ShowUser',_0x3d05f9[_0xe84d('0x1a')],_0x364e39);_0x1ada5f(_0x5e7501[_0xe84d('0x19')](0x1f4,_0x3d05f9[_0xe84d('0x1a')]));});});};exports[_0xe84d('0x20')]=function(_0x5b4351){var _0xf8924c;return db[_0xe84d('0x1c')][_0xe84d('0x1d')]({'where':_0x5b4351[_0xe84d('0xf')][_0xe84d('0x10')]||{},'attributes':['id',_0xe84d('0x21'),'role',_0xe84d('0x22'),'interface']})[_0xe84d('0x1e')](function(_0x13b65a){if(!_0x13b65a){throw new Error(util[_0xe84d('0x23')](_0xe84d('0x24'),_0x5b4351[_0xe84d('0x25')]['id']));}_0xf8924c=_0x13b65a;return db[_0xe84d('0x26')][_0xe84d('0x27')]({'paused':0x1},{'where':{'UserId':_0xf8924c['id']},'individualHooks':!![]});})[_0xe84d('0x1e')](function(){return db[_0xe84d('0x28')]['findAll']({'where':{'membername':_0xf8924c['name'],'type':_0xe84d('0x29'),'exitAt':null}});})[_0xe84d('0x1e')](function(_0x49cb1e){if(_0x49cb1e&&_0x49cb1e[_0xe84d('0x2a')]){var _0x1b78ae=moment()[_0xe84d('0x23')](_0xe84d('0x2b'));for(var _0x5102d1=0x0,_0xd2e3a5=_0x49cb1e[_0xe84d('0x2a')];_0x5102d1<_0xd2e3a5;_0x5102d1++){_0x49cb1e[_0x5102d1][_0xe84d('0x2c')]({'exitAt':_0x1b78ae});}}})[_0xe84d('0x1e')](function(){var _0x54b63f=[];var _0x954cb4=utils[_0xe84d('0x2d')]();_0x954cb4[_0xe84d('0x2e')](function(_0x3d1287){_0x54b63f[_0xe84d('0x2f')]({'channel':_0x3d1287,'membername':_0xf8924c['name'],'interface':_[_0xe84d('0x30')](_0xf8924c['interface'])?util[_0xe84d('0x23')](_0xe84d('0x31'),_0xf8924c[_0xe84d('0x21')]):_0xf8924c[_0xe84d('0x32')],'type':_0xe84d('0x29'),'enterAt':moment()[_0xe84d('0x23')](_0xe84d('0x2b')),'data1':_0x5b4351[_0xe84d('0x33')]['type']||_0xe84d('0x34'),'role':_0xf8924c[_0xe84d('0x35')],'internal':_0xf8924c[_0xe84d('0x22')],'uniqueid':_0x5b4351[_0xe84d('0x33')][_0xe84d('0x36')]||null});});return db[_0xe84d('0x28')][_0xe84d('0x37')](_0x54b63f,{'individualHooks':!![]});})[_0xe84d('0x1e')](function(){return _0xf8924c['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5b4351[_0xe84d('0x33')][_0xe84d('0x38')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xe84d('0x23')](_0xe84d('0x2b'))});})[_0xe84d('0x18')](function(_0x2f8dd5){throw _0x2f8dd5;});};exports[_0xe84d('0x39')]=function(_0x312610){return Promise[_0xe84d('0x3a')]()['then'](function(){if(_0x312610[_0xe84d('0x33')][_0xe84d('0x3b')]&&!utils[_0xe84d('0x3c')](_0x312610['body'][_0xe84d('0x3b')])){throw new Error(util[_0xe84d('0x23')](_0xe84d('0x3d'),_0x312610[_0xe84d('0x33')][_0xe84d('0x3b')]));}return db[_0xe84d('0x1c')][_0xe84d('0x3e')]({'where':_0x312610[_0xe84d('0xf')][_0xe84d('0x10')]||{},'attributes':['id',_0xe84d('0x21'),'role',_0xe84d('0x22'),'interface',_0xe84d('0x3f'),'voicePause',_0xe84d('0x40'),_0xe84d('0x41'),_0xe84d('0x42'),_0xe84d('0x43'),_0xe84d('0x44'),_0xe84d('0x45'),_0xe84d('0x46'),_0xe84d('0x47')]});})[_0xe84d('0x1e')](function(_0x1cf844){if(!_0x1cf844){throw new Error(util[_0xe84d('0x23')](_0xe84d('0x24'),_0x312610[_0xe84d('0x25')]['id']));}return _0x1cf844[_0xe84d('0x48')](_0x312610['body'][_0xe84d('0x3b')],_0xe84d('0x49'));})[_0xe84d('0x18')](function(_0x32c4f0){throw _0x32c4f0;});};exports['LogoutUser']=function(_0x56f9ca){var _0x542d92=this;return new Promise(function(_0x438b86,_0x48422f){var _0x27a6d2;return db[_0xe84d('0x1c')][_0xe84d('0x3e')]({'where':_0x56f9ca['options']['where']||{},'attributes':['id',_0xe84d('0x21')]})['then'](function(_0x297176){if(_0x297176){_0x27a6d2=_0x297176;return db[_0xe84d('0x26')]['destroy']({'where':{'membername':_0x27a6d2[_0xe84d('0x21')]},'individualHooks':!![]});}})[_0xe84d('0x1e')](function(){if(_0x27a6d2){return db[_0xe84d('0x28')]['findAll']({'where':{'membername':_0x27a6d2[_0xe84d('0x21')],'exitAt':null}});}})['then'](function(_0x2f7b39){if(_0x27a6d2){if(_0x2f7b39&&_0x2f7b39[_0xe84d('0x2a')]){var _0x2f0896=[];_0x2f7b39[_0xe84d('0x2e')](function(_0xd69844){_0x2f0896[_0xe84d('0x2f')](_0xd69844['update']({'exitAt':moment()['format'](_0xe84d('0x2b'))}));});return BPromise[_0xe84d('0x4a')](_0x2f0896);}}})[_0xe84d('0x1e')](function(){if(_0x27a6d2){return _0x27a6d2[_0xe84d('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xe84d('0x1e')](function(_0x4a0f1e){_0x438b86(_0x4a0f1e);})['catch'](function(_0x592e53){_0x48422f(_0x542d92['error'](0x1f4,_0x592e53['message']));});});};exports[_0xe84d('0x4b')]=function(_0x1dc0c7){var _0x33b424=this;return new Promise(function(_0x2f3928,_0x4e1a13){var _0x441630;var _0x564e50;var _0x97495;var _0x5009ab;return db[_0xe84d('0x1c')][_0xe84d('0x3e')]({'where':_0x1dc0c7[_0xe84d('0xf')][_0xe84d('0x10')]||{},'attributes':['id',_0xe84d('0x21'),_0xe84d('0x35'),_0xe84d('0x4c'),_0xe84d('0x4d'),_0xe84d('0x22'),_0xe84d('0x4e'),'interface']})[_0xe84d('0x1e')](function(_0x5eb5af){if(_0x5eb5af){_0x441630=_0x5eb5af;_0x5009ab=_0x1dc0c7[_0xe84d('0x33')]['interface']?_0x1dc0c7['body'][_0xe84d('0x32')]:util[_0xe84d('0x23')](_0xe84d('0x31'),_0x441630[_0xe84d('0x21')]);return db[_0xe84d('0x1c')][_0xe84d('0x4f')]({'where':{'role':_0xe84d('0x50'),'online':!![],'id':{'$ne':_0x441630['id']}}});}})[_0xe84d('0x1e')](function(_0xcddbe3){if(_0xcddbe3){_0x97495=_0xcddbe3;return require('../../config/license/util')['getLicense']();}})[_0xe84d('0x1e')](function(_0x55bb71){if(_0x55bb71&&_0x55bb71[_0xe84d('0x51')]&&_0x97495>=_0x55bb71[_0xe84d('0x51')]){throw new Error(_0xe84d('0x52'));}})[_0xe84d('0x1e')](function(){if(_0x441630){return db[_0xe84d('0x26')][_0xe84d('0x53')]({'where':{'membername':_0x441630['name']},'individualHooks':!![]});}})[_0xe84d('0x1e')](function(){if(_0x441630){return _0x441630[_0xe84d('0x54')]({'raw':!![]});}})[_0xe84d('0x1e')](function(_0x5a8897){if(_0x441630){if(_0x5a8897){var _0x50813c=[];_0x564e50=_0x5a8897;if(_0x564e50['length']){for(var _0x24df7b=0x0;_0x24df7b<_0x564e50['length'];_0x24df7b++){_0x50813c[_0xe84d('0x2f')](db[_0xe84d('0x26')][_0xe84d('0x55')]({'membername':_0x441630[_0xe84d('0x21')],'UserId':_0x441630['id'],'queue_name':_0x564e50[_0x24df7b][_0xe84d('0x21')],'VoiceQueueId':_0x564e50[_0x24df7b]['id'],'interface':_0x5009ab,'paused':_0x441630['loginInPause']||![],'penalty':_0x564e50[_0x24df7b]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xe84d('0x4a')](_0x50813c);}}}})[_0xe84d('0x1e')](function(){if(_0x441630){return db['MemberReport'][_0xe84d('0xe')]({'where':{'membername':_0x441630[_0xe84d('0x21')],'exitAt':null}});}})[_0xe84d('0x1e')](function(_0x3a1223){if(_0x441630){if(_0x3a1223&&_0x3a1223[_0xe84d('0x2a')]){var _0x1dcdc1=[];_0x3a1223[_0xe84d('0x2e')](function(_0x3d6c6e){_0x1dcdc1['push'](_0x3d6c6e[_0xe84d('0x27')]({'exitAt':moment()[_0xe84d('0x23')](_0xe84d('0x2b'))}));});return BPromise[_0xe84d('0x4a')](_0x1dcdc1);}}})['then'](function(){if(_0x441630){var _0x58a00a=[];var _0x4881c4=[];var _0x4bd875=utils['getChannels']();var _0x2b1cf0={'membername':_0x441630[_0xe84d('0x21')],'interface':_0x5009ab,'enterAt':moment()[_0xe84d('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x441630['role'],'internal':_0x441630[_0xe84d('0x22')]};_0x4bd875[_0xe84d('0x2e')](function(_0x3a1546){_0x58a00a[_0xe84d('0x2f')](_[_0xe84d('0x56')]({'channel':_0x3a1546,'type':_0xe84d('0x57'),'data1':_0xe84d('0x58'),'data2':_0x5009ab},_0x2b1cf0));if(_0x441630['loginInPause']){_0x4881c4[_0xe84d('0x2f')](_[_0xe84d('0x56')]({'channel':_0x3a1546,'type':_0xe84d('0x29'),'data1':'LOGININPAUSE'},_0x2b1cf0));}});return db[_0xe84d('0x28')]['bulkCreate'](_0x58a00a[_0xe84d('0x59')](_0x4881c4),{'individualHooks':!![]});}})[_0xe84d('0x1e')](function(){if(_0x441630){return _0x441630[_0xe84d('0x27')]({'online':!![],'lastLoginAt':moment()[_0xe84d('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x441630[_0xe84d('0x4e')]||![],'mailPause':_0x441630[_0xe84d('0x4e')]||![],'chatPause':_0x441630['loginInPause']||![],'faxPause':_0x441630[_0xe84d('0x4e')]||![],'smsPause':_0x441630['loginInPause']||![],'openchannelPause':_0x441630[_0xe84d('0x4e')]||![],'pauseType':_0x441630[_0xe84d('0x4e')]?_0xe84d('0x5a'):null,'lastPauseAt':moment()[_0xe84d('0x23')](_0xe84d('0x2b')),'interface':_0x5009ab});}})[_0xe84d('0x1e')](function(_0x1246e7){_0x2f3928(_0x1246e7);})['catch'](function(_0x543a24){_0x4e1a13(_0x33b424[_0xe84d('0x19')](0x1f4,_0x543a24[_0xe84d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index fce62bf..7dec7d3 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 _0x56d2=['update','emit','removeListener','register','./user.events','save','remove'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x56d2,0xf2));var _0x256d=function(_0x336643,_0x458fb8){_0x336643=_0x336643-0x0;var _0x2a888d=_0x56d2[_0x336643];return _0x2a888d;};'use strict';var UserEvents=require(_0x256d('0x0'));var events=[_0x256d('0x1'),_0x256d('0x2'),_0x256d('0x3')];function createListener(_0x5b8c07,_0x12b930){return function(_0x1ef529){_0x12b930[_0x256d('0x4')](_0x5b8c07,_0x1ef529);};}function removeListener(_0x18d2a3,_0x3716c8){return function(){UserEvents[_0x256d('0x5')](_0x18d2a3,_0x3716c8);};}exports[_0x256d('0x6')]=function(_0x42ab11){for(var _0x33e8f7=0x0,_0x5daf1b=events['length'];_0x33e8f7<_0x5daf1b;_0x33e8f7++){var _0x441ea9=events[_0x33e8f7];var _0x3f5a78=createListener('user:'+_0x441ea9,_0x42ab11);UserEvents['on'](_0x441ea9,_0x3f5a78);}}; \ No newline at end of file +var _0x6d53=['removeListener','register','user:','./user.events','emit'];(function(_0x1d7448,_0x481e34){var _0x4208ee=function(_0x43eec7){while(--_0x43eec7){_0x1d7448['push'](_0x1d7448['shift']());}};_0x4208ee(++_0x481e34);}(_0x6d53,0x170));var _0x36d5=function(_0x265ce8,_0x296643){_0x265ce8=_0x265ce8-0x0;var _0x38b7e2=_0x6d53[_0x265ce8];return _0x38b7e2;};'use strict';var UserEvents=require(_0x36d5('0x0'));var events=['save','remove','update'];function createListener(_0x190e29,_0x4e4619){return function(_0xa2ea80){_0x4e4619[_0x36d5('0x1')](_0x190e29,_0xa2ea80);};}function removeListener(_0x27de86,_0x3fc593){return function(){UserEvents[_0x36d5('0x2')](_0x27de86,_0x3fc593);};}exports[_0x36d5('0x3')]=function(_0x3827e4){for(var _0x2c1bff=0x0,_0xf33609=events['length'];_0x2c1bff<_0xf33609;_0x2c1bff++){var _0x2ebf0e=events[_0x2c1bff];var _0x353f14=createListener(_0x36d5('0x4')+_0x2ebf0e,_0x3827e4);UserEvents['on'](_0x2ebf0e,_0x353f14);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 7955ffb..54a4d0f 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(_0x402351,_0x4649ee){var _0x8af991=function(_0x39ca5f){while(--_0x39ca5f){_0x402351['push'](_0x402351['shift']());}};_0x8af991(++_0x4649ee);}(_0xe706,0xa3));var _0x6e70=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0xe706[_0x376db5];return _0x304c17;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5e7cac,_0x7a78d7){var _0x104566=function(_0x5b3cb5){while(--_0x5b3cb5){_0x5e7cac['push'](_0x5e7cac['shift']());}};_0x104566(++_0x7a78d7);}(_0xe706,0xa3));var _0x6e70=function(_0x1cec84,_0x101ec2){_0x1cec84=_0x1cec84-0x0;var _0x12b7d3=_0xe706[_0x1cec84];return _0x12b7d3;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index ad1bd99..9006424 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 _0x2d7a=['INTEGER','sequelize','exports'];(function(_0x320909,_0x17e27a){var _0x3b19b5=function(_0x5268c7){while(--_0x5268c7){_0x320909['push'](_0x320909['shift']());}};_0x3b19b5(++_0x17e27a);}(_0x2d7a,0x103));var _0xa2d7=function(_0x3f4f08,_0x24e12d){_0x3f4f08=_0x3f4f08-0x0;var _0x34550a=_0x2d7a[_0x3f4f08];return _0x34550a;};'use strict';var Sequelize=require(_0xa2d7('0x0'));module[_0xa2d7('0x1')]={'penalty':{'type':Sequelize[_0xa2d7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 1f119c2..1e7a927 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 _0x0e12=['path','../../config/environment','exports','user_has_chat_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x18f6a7,_0x589942){var _0x5ad696=function(_0x276cf8){while(--_0x276cf8){_0x18f6a7['push'](_0x18f6a7['shift']());}};_0x5ad696(++_0x589942);}(_0x0e12,0x1ab));var _0x20e1=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0x0e12[_0x5d4f12];return _0x4eb577;};'use strict';var _=require(_0x20e1('0x0'));var util=require(_0x20e1('0x1'));var logger=require(_0x20e1('0x2'))('api');var moment=require(_0x20e1('0x3'));var BPromise=require(_0x20e1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20e1('0x5'));var rimraf=require('rimraf');var config=require(_0x20e1('0x6'));var attributes=require('./userChatQueue.attributes');module[_0x20e1('0x7')]=function(_0x4a5e03,_0x297c8f){return _0x4a5e03['define']('UserChatQueue',attributes,{'tableName':_0x20e1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf04=['./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4cec0a,_0x3032b2){var _0x4f8dac=function(_0x1bf552){while(--_0x1bf552){_0x4cec0a['push'](_0x4cec0a['shift']());}};_0x4f8dac(++_0x3032b2);}(_0xaf04,0xd6));var _0x4af0=function(_0x58e094,_0x1cd022){_0x58e094=_0x58e094-0x0;var _0x5e8757=_0xaf04[_0x58e094];return _0x5e8757;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4af0('0x0'))('api');var moment=require(_0x4af0('0x1'));var BPromise=require(_0x4af0('0x2'));var rp=require(_0x4af0('0x3'));var fs=require('fs');var path=require(_0x4af0('0x4'));var rimraf=require('rimraf');var config=require(_0x4af0('0x5'));var attributes=require(_0x4af0('0x6'));module[_0x4af0('0x7')]=function(_0x26c9a8,_0x18075e){return _0x26c9a8[_0x4af0('0x8')](_0x4af0('0x9'),attributes,{'tableName':_0x4af0('0xa'),'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 3ed1320..2d04e60 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 _0x7958=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1e1c31,_0x8df031){var _0x21319c=function(_0xad1f50){while(--_0xad1f50){_0x1e1c31['push'](_0x1e1c31['shift']());}};_0x21319c(++_0x8df031);}(_0x7958,0x1ae));var _0x8795=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7958[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8795('0x0'));var util=require(_0x8795('0x1'));var moment=require(_0x8795('0x2'));var BPromise=require(_0x8795('0x3'));var rs=require(_0x8795('0x4'));var fs=require('fs');var Redis=require(_0x8795('0x5'));var db=require(_0x8795('0x6'))['db'];var utils=require(_0x8795('0x7'));var logger=require('../../config/logger')(_0x8795('0x8'));var config=require(_0x8795('0x9'));var jayson=require(_0x8795('0xa'));var client=jayson['client'][_0x8795('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x92d95d,_0x2e51cd,_0x1414e7){return new BPromise(function(_0x464e95,_0x44a001){return client[_0x8795('0xc')](_0x92d95d,_0x1414e7)[_0x8795('0xd')](function(_0x48939e){logger[_0x8795('0xe')](_0x8795('0xf'),_0x2e51cd,_0x8795('0x10'));logger[_0x8795('0x11')](_0x8795('0x12'),_0x2e51cd,_0x8795('0x10'),JSON[_0x8795('0x13')](_0x48939e));if(_0x48939e[_0x8795('0x14')]){if(_0x48939e[_0x8795('0x14')]['code']===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x2e51cd,_0x48939e[_0x8795('0x14')][_0x8795('0x15')]);return _0x44a001(_0x48939e[_0x8795('0x14')][_0x8795('0x15')]);}logger['error'](_0x8795('0xf'),_0x2e51cd,_0x48939e[_0x8795('0x14')]['message']);return _0x464e95(_0x48939e[_0x8795('0x14')]['message']);}else{logger[_0x8795('0xe')](_0x8795('0xf'),_0x2e51cd,_0x8795('0x10'));_0x464e95(_0x48939e[_0x8795('0x16')][_0x8795('0x15')]);}})['catch'](function(_0x33d0f9){logger[_0x8795('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x2e51cd,_0x33d0f9);_0x44a001(_0x33d0f9);});});} \ No newline at end of file +var _0xf7ef=['client','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x39e687,_0x4854c2){var _0x35c649=function(_0x2d5ff9){while(--_0x2d5ff9){_0x39e687['push'](_0x39e687['shift']());}};_0x35c649(++_0x4854c2);}(_0xf7ef,0x81));var _0xff7e=function(_0x1b7627,_0x12117b){_0x1b7627=_0x1b7627-0x0;var _0x4ced21=_0xf7ef[_0x1b7627];return _0x4ced21;};'use strict';var _=require(_0xff7e('0x0'));var util=require(_0xff7e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xff7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff7e('0x3'))['db'];var utils=require(_0xff7e('0x4'));var logger=require(_0xff7e('0x5'))(_0xff7e('0x6'));var config=require(_0xff7e('0x7'));var jayson=require(_0xff7e('0x8'));var client=jayson[_0xff7e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b36b5,_0x345008,_0x1d50a3){return new BPromise(function(_0x45024e,_0xcfbfc0){return client[_0xff7e('0xa')](_0x1b36b5,_0x1d50a3)[_0xff7e('0xb')](function(_0x12a92d){logger[_0xff7e('0xc')](_0xff7e('0xd'),_0x345008,'request\x20sent');logger[_0xff7e('0xe')](_0xff7e('0xf'),_0x345008,_0xff7e('0x10'),JSON[_0xff7e('0x11')](_0x12a92d));if(_0x12a92d[_0xff7e('0x12')]){if(_0x12a92d[_0xff7e('0x12')][_0xff7e('0x13')]===0x1f4){logger[_0xff7e('0x12')](_0xff7e('0xd'),_0x345008,_0x12a92d[_0xff7e('0x12')][_0xff7e('0x14')]);return _0xcfbfc0(_0x12a92d[_0xff7e('0x12')][_0xff7e('0x14')]);}logger[_0xff7e('0x12')](_0xff7e('0xd'),_0x345008,_0x12a92d[_0xff7e('0x12')][_0xff7e('0x14')]);return _0x45024e(_0x12a92d[_0xff7e('0x12')][_0xff7e('0x14')]);}else{logger[_0xff7e('0xc')](_0xff7e('0xd'),_0x345008,'request\x20sent');_0x45024e(_0x12a92d[_0xff7e('0x15')][_0xff7e('0x14')]);}})[_0xff7e('0x16')](function(_0x55a20b){logger['error'](_0xff7e('0xd'),_0x345008,_0x55a20b);_0xcfbfc0(_0x55a20b);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 65b0e64..68248f8 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3d3b65,_0x5a1850){var _0x3824a6=function(_0x64af12){while(--_0x64af12){_0x3d3b65['push'](_0x3d3b65['shift']());}};_0x3824a6(++_0x5a1850);}(_0xe706,0xa3));var _0x6e70=function(_0x15de7b,_0x1f9e4e){_0x15de7b=_0x15de7b-0x0;var _0x1456c4=_0xe706[_0x15de7b];return _0x1456c4;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2df1df,_0x3c2e75){var _0x20bdbf=function(_0x142905){while(--_0x142905){_0x2df1df['push'](_0x2df1df['shift']());}};_0x20bdbf(++_0x3c2e75);}(_0x70e0,0x17b));var _0x070e=function(_0xc3f311,_0x5850cc){_0xc3f311=_0xc3f311-0x0;var _0x48d144=_0x70e0[_0xc3f311];return _0x48d144;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 255e731..d2a5c54 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 _0xd567=['INTEGER','STRING'];(function(_0x54b396,_0x3612ee){var _0x532e6d=function(_0xc8286e){while(--_0xc8286e){_0x54b396['push'](_0x54b396['shift']());}};_0x532e6d(++_0x3612ee);}(_0xd567,0x140));var _0x7d56=function(_0x4d7562,_0x5a5f7b){_0x4d7562=_0x4d7562-0x0;var _0x39916c=_0xd567[_0x4d7562];return _0x39916c;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x7d56('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7d56('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x7d56('0x1')]}}; \ No newline at end of file +var _0x626d=['INTEGER','STRING','sequelize','exports'];(function(_0x322978,_0x2ff571){var _0x5e3906=function(_0x5dc75d){while(--_0x5dc75d){_0x322978['push'](_0x322978['shift']());}};_0x5e3906(++_0x2ff571);}(_0x626d,0x19a));var _0xd626=function(_0x51fa7d,_0x59aef6){_0x51fa7d=_0x51fa7d-0x0;var _0x342fd9=_0x626d[_0x51fa7d];return _0x342fd9;};'use strict';var Sequelize=require(_0xd626('0x0'));module[_0xd626('0x1')]={'penalty':{'type':Sequelize[_0xd626('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd626('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xd626('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index a97c198..78a6fb7 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 _0x9fcc=['api','request-promise','path','../../config/environment','./userFaxQueue.attributes','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger'];(function(_0x3b601a,_0x1fcc08){var _0x3b4d2b=function(_0x5e5d8b){while(--_0x5e5d8b){_0x3b601a['push'](_0x3b601a['shift']());}};_0x3b4d2b(++_0x1fcc08);}(_0x9fcc,0x1d3));var _0xc9fc=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9fcc[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xc9fc('0x0'));var util=require(_0xc9fc('0x1'));var logger=require(_0xc9fc('0x2'))(_0xc9fc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc9fc('0x4'));var fs=require('fs');var path=require(_0xc9fc('0x5'));var rimraf=require('rimraf');var config=require(_0xc9fc('0x6'));var attributes=require(_0xc9fc('0x7'));module['exports']=function(_0x4694e7,_0x568051){return _0x4694e7['define'](_0xc9fc('0x8'),attributes,{'tableName':_0xc9fc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a11=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues'];(function(_0x2b59db,_0x2fd753){var _0x1b8a3b=function(_0x41c9ab){while(--_0x41c9ab){_0x2b59db['push'](_0x2b59db['shift']());}};_0x1b8a3b(++_0x2fd753);}(_0x5a11,0x14a));var _0x15a1=function(_0x5720d7,_0x12d1db){_0x5720d7=_0x5720d7-0x0;var _0x3ff2a6=_0x5a11[_0x5720d7];return _0x3ff2a6;};'use strict';var _=require('lodash');var util=require(_0x15a1('0x0'));var logger=require(_0x15a1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x15a1('0x2'));var rp=require(_0x15a1('0x3'));var fs=require('fs');var path=require(_0x15a1('0x4'));var rimraf=require('rimraf');var config=require(_0x15a1('0x5'));var attributes=require(_0x15a1('0x6'));module[_0x15a1('0x7')]=function(_0xc0e696,_0x57ea73){return _0xc0e696['define'](_0x15a1('0x8'),attributes,{'tableName':_0x15a1('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 19ba1dd..f92028a 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 _0xfa1f=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xfa1f,0x7c));var _0xffa1=function(_0x22c684,_0x753309){_0x22c684=_0x22c684-0x0;var _0x39fcbb=_0xfa1f[_0x22c684];return _0x39fcbb;};'use strict';var _=require(_0xffa1('0x0'));var util=require(_0xffa1('0x1'));var moment=require(_0xffa1('0x2'));var BPromise=require(_0xffa1('0x3'));var rs=require(_0xffa1('0x4'));var fs=require('fs');var Redis=require(_0xffa1('0x5'));var db=require(_0xffa1('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xffa1('0x7'));var config=require(_0xffa1('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xffa1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1257aa,_0x4ae7bc,_0x4adad6){return new BPromise(function(_0x2cc302,_0xe12435){return client[_0xffa1('0xa')](_0x1257aa,_0x4adad6)[_0xffa1('0xb')](function(_0x19ce27){logger['info'](_0xffa1('0xc'),_0x4ae7bc,_0xffa1('0xd'));logger[_0xffa1('0xe')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x4ae7bc,_0xffa1('0xd'),JSON['stringify'](_0x19ce27));if(_0x19ce27[_0xffa1('0xf')]){if(_0x19ce27[_0xffa1('0xf')][_0xffa1('0x10')]===0x1f4){logger[_0xffa1('0xf')](_0xffa1('0xc'),_0x4ae7bc,_0x19ce27[_0xffa1('0xf')][_0xffa1('0x11')]);return _0xe12435(_0x19ce27[_0xffa1('0xf')][_0xffa1('0x11')]);}logger[_0xffa1('0xf')](_0xffa1('0xc'),_0x4ae7bc,_0x19ce27[_0xffa1('0xf')]['message']);return _0x2cc302(_0x19ce27[_0xffa1('0xf')][_0xffa1('0x11')]);}else{logger[_0xffa1('0x12')](_0xffa1('0xc'),_0x4ae7bc,_0xffa1('0xd'));_0x2cc302(_0x19ce27[_0xffa1('0x13')]['message']);}})[_0xffa1('0x14')](function(_0x392561){logger[_0xffa1('0xf')](_0xffa1('0xc'),_0x4ae7bc,_0x392561);_0xe12435(_0x392561);});});} \ No newline at end of file +var _0xc14c=['debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','code','message','error','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc14c,0x1a5));var _0xcc14=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc14c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xcc14('0x0'));var util=require(_0xcc14('0x1'));var moment=require(_0xcc14('0x2'));var BPromise=require(_0xcc14('0x3'));var rs=require(_0xcc14('0x4'));var fs=require('fs');var Redis=require(_0xcc14('0x5'));var db=require(_0xcc14('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcc14('0x7'));var config=require(_0xcc14('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcc14('0x9')][_0xcc14('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x462fc3,_0x5c4dc7,_0x31e6da){return new BPromise(function(_0xd5f64a,_0x4b4d8e){return client[_0xcc14('0xb')](_0x462fc3,_0x31e6da)[_0xcc14('0xc')](function(_0x502aa8){logger[_0xcc14('0xd')](_0xcc14('0xe'),_0x5c4dc7,_0xcc14('0xf'));logger[_0xcc14('0x10')](_0xcc14('0x11'),_0x5c4dc7,_0xcc14('0xf'),JSON[_0xcc14('0x12')](_0x502aa8));if(_0x502aa8['error']){if(_0x502aa8['error'][_0xcc14('0x13')]===0x1f4){logger['error'](_0xcc14('0xe'),_0x5c4dc7,_0x502aa8['error'][_0xcc14('0x14')]);return _0x4b4d8e(_0x502aa8[_0xcc14('0x15')][_0xcc14('0x14')]);}logger[_0xcc14('0x15')]('UserFaxQueue,\x20%s,\x20%s',_0x5c4dc7,_0x502aa8[_0xcc14('0x15')][_0xcc14('0x14')]);return _0xd5f64a(_0x502aa8[_0xcc14('0x15')][_0xcc14('0x14')]);}else{logger['info'](_0xcc14('0xe'),_0x5c4dc7,'request\x20sent');_0xd5f64a(_0x502aa8['result'][_0xcc14('0x14')]);}})[_0xcc14('0x16')](function(_0x4600e1){logger[_0xcc14('0x15')](_0xcc14('0xe'),_0x5c4dc7,_0x4600e1);_0x4b4d8e(_0x4600e1);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index c11cbf3..c353155 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5712cc,_0x5db7dd){var _0x15561a=function(_0x4bf65d){while(--_0x4bf65d){_0x5712cc['push'](_0x5712cc['shift']());}};_0x15561a(++_0x5db7dd);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4afb78,_0x1f386f){var _0x2fcd71=function(_0x1f6652){while(--_0x1f6652){_0x4afb78['push'](_0x4afb78['shift']());}};_0x2fcd71(++_0x1f386f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 245f5a9..85910fe 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 _0xd2bd=['INTEGER','sequelize','exports'];(function(_0x442aaf,_0x1a366c){var _0x2ddd51=function(_0x28d90c){while(--_0x28d90c){_0x442aaf['push'](_0x442aaf['shift']());}};_0x2ddd51(++_0x1a366c);}(_0xd2bd,0x154));var _0xdd2b=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xd2bd[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require(_0xdd2b('0x0'));module[_0xdd2b('0x1')]={'penalty':{'type':Sequelize[_0xdd2b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2f2e=['exports','INTEGER'];(function(_0x53b0d4,_0x4083d9){var _0x669e12=function(_0x1562dd){while(--_0x1562dd){_0x53b0d4['push'](_0x53b0d4['shift']());}};_0x669e12(++_0x4083d9);}(_0x2f2e,0x146));var _0xe2f2=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0x2f2e[_0x4e6eb2];return _0x4e0c1c;};'use strict';var Sequelize=require('sequelize');module[_0xe2f2('0x0')]={'penalty':{'type':Sequelize[_0xe2f2('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 3b23dde..227aab4 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 _0x8697=['exports','UserMailQueue','user_has_mail_queues','../../config/logger','moment','path','rimraf','../../config/environment','./userMailQueue.attributes'];(function(_0x3081f5,_0xd6fe7f){var _0x3afb13=function(_0x5e606d){while(--_0x5e606d){_0x3081f5['push'](_0x3081f5['shift']());}};_0x3afb13(++_0xd6fe7f);}(_0x8697,0x159));var _0x7869=function(_0x2fdd12,_0x231b71){_0x2fdd12=_0x2fdd12-0x0;var _0x35831b=_0x8697[_0x2fdd12];return _0x35831b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7869('0x0'))('api');var moment=require(_0x7869('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7869('0x2'));var rimraf=require(_0x7869('0x3'));var config=require(_0x7869('0x4'));var attributes=require(_0x7869('0x5'));module[_0x7869('0x6')]=function(_0x23fc8c,_0xc31781){return _0x23fc8c['define'](_0x7869('0x7'),attributes,{'tableName':_0x7869('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bd3=['user_has_mail_queues','lodash','../../config/logger','api','moment','bluebird','rimraf','./userMailQueue.attributes','exports','UserMailQueue'];(function(_0x22b735,_0x5c2676){var _0x1b08fd=function(_0x57a509){while(--_0x57a509){_0x22b735['push'](_0x22b735['shift']());}};_0x1b08fd(++_0x5c2676);}(_0x1bd3,0xc9));var _0x31bd=function(_0x163c4b,_0x259b04){_0x163c4b=_0x163c4b-0x0;var _0x504bd9=_0x1bd3[_0x163c4b];return _0x504bd9;};'use strict';var _=require(_0x31bd('0x0'));var util=require('util');var logger=require(_0x31bd('0x1'))(_0x31bd('0x2'));var moment=require(_0x31bd('0x3'));var BPromise=require(_0x31bd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x31bd('0x5'));var config=require('../../config/environment');var attributes=require(_0x31bd('0x6'));module[_0x31bd('0x7')]=function(_0x487b72,_0x30a556){return _0x487b72['define'](_0x31bd('0x8'),attributes,{'tableName':_0x31bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index aedd844..d63e4da 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(_0x217e55,_0x611819){var _0x3e2b8a=function(_0x1caccc){while(--_0x1caccc){_0x217e55['push'](_0x217e55['shift']());}};_0x3e2b8a(++_0x611819);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x12b93f,_0x599896){_0x12b93f=_0x12b93f-0x0;var _0x175640=_0x7fbe[_0x12b93f];return _0x175640;};'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 _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x2e4759,_0x444bce){var _0x475399=function(_0x31c0fa){while(--_0x31c0fa){_0x2e4759['push'](_0x2e4759['shift']());}};_0x475399(++_0x444bce);}(_0x3e74,0x175));var _0x43e7=function(_0x4b30a4,_0x2ce180){_0x4b30a4=_0x4b30a4-0x0;var _0x561c98=_0x3e74[_0x4b30a4];return _0x561c98;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index cad4960..3dfa3d0 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 _0x4f52=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','sendUserNotification'];(function(_0x277c0a,_0x50e263){var _0x5b0739=function(_0x2068c9){while(--_0x2068c9){_0x277c0a['push'](_0x277c0a['shift']());}};_0x5b0739(++_0x50e263);}(_0x4f52,0x145));var _0x24f5=function(_0x75d13a,_0x376fc4){_0x75d13a=_0x75d13a-0x0;var _0x3c44c7=_0x4f52[_0x75d13a];return _0x3c44c7;};'use strict';var multer=require(_0x24f5('0x0'));var util=require(_0x24f5('0x1'));var path=require(_0x24f5('0x2'));var timeout=require(_0x24f5('0x3'));var express=require(_0x24f5('0x4'));var router=express[_0x24f5('0x5')]();var fs_extra=require(_0x24f5('0x6'));var auth=require(_0x24f5('0x7'));var interaction=require(_0x24f5('0x8'));var config=require('../../config/environment');var controller=require('./userNotification.controller');router['post']('/',auth[_0x24f5('0x9')](),controller[_0x24f5('0xa')]);module[_0x24f5('0xb')]=router; \ No newline at end of file +var _0x09cc=['../../config/environment','isAuthenticated','sendUserNotification','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3e85a4,_0x18c3a9){var _0x21e7d1=function(_0x48457d){while(--_0x48457d){_0x3e85a4['push'](_0x3e85a4['shift']());}};_0x21e7d1(++_0x18c3a9);}(_0x09cc,0x15a));var _0xc09c=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x09cc[_0x58e469];return _0x4c01c5;};'use strict';var multer=require(_0xc09c('0x0'));var util=require(_0xc09c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc09c('0x2'));var auth=require(_0xc09c('0x3'));var interaction=require(_0xc09c('0x4'));var config=require(_0xc09c('0x5'));var controller=require('./userNotification.controller');router['post']('/',auth[_0xc09c('0x6')](),controller[_0xc09c('0x7')]);module[_0xc09c('0x8')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index c42a30b..2758709 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 _0xff28=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x10fc93,_0x7c1840){var _0x1cbf39=function(_0xb7085e){while(--_0xb7085e){_0x10fc93['push'](_0x10fc93['shift']());}};_0x1cbf39(++_0x7c1840);}(_0xff28,0x93));var _0x8ff2=function(_0x445c98,_0x132bf7){_0x445c98=_0x445c98-0x0;var _0x2fe913=_0xff28[_0x445c98];return _0x2fe913;};'use strict';var Sequelize=require(_0x8ff2('0x0'));module[_0x8ff2('0x1')]={'body':{'type':Sequelize[_0x8ff2('0x2')]},'senderName':{'type':Sequelize[_0x8ff2('0x3')]},'recipientsId':{'type':Sequelize[_0x8ff2('0x2')]},'recipientsDescription':{'type':Sequelize[_0x8ff2('0x3')]},'beep':{'type':Sequelize[_0x8ff2('0x4')]}}; \ No newline at end of file +var _0x3bb2=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x3bb2,0x102));var _0x23bb=function(_0x27c102,_0x5a9bc3){_0x27c102=_0x27c102-0x0;var _0x4bd657=_0x3bb2[_0x27c102];return _0x4bd657;};'use strict';var Sequelize=require(_0x23bb('0x0'));module[_0x23bb('0x1')]={'body':{'type':Sequelize[_0x23bb('0x2')]},'senderName':{'type':Sequelize[_0x23bb('0x3')]},'recipientsId':{'type':Sequelize[_0x23bb('0x2')]},'recipientsDescription':{'type':Sequelize[_0x23bb('0x3')]},'beep':{'type':Sequelize[_0x23bb('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 64ad0db..468a1be 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 _0x49f9=['undefined','count','limit','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','sendUserNotification','body','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','SenderId','sequelize','UserNotification','beep','forEach','Template','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','User','ids','queue','replace','Queue','push','all','union','findOne','map','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','end','json','offset'];(function(_0x490828,_0x1d1253){var _0x29d7ae=function(_0x1c5d57){while(--_0x1c5d57){_0x490828['push'](_0x490828['shift']());}};_0x29d7ae(++_0x1d1253);}(_0x49f9,0x154));var _0x949f=function(_0x11ad65,_0x352d3c){_0x11ad65=_0x11ad65-0x0;var _0x35590c=_0x49f9[_0x11ad65];return _0x35590c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x949f('0x0'));var zipdir=require(_0x949f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x949f('0x2'));var BPromise=require(_0x949f('0x3'));var Mustache=require('mustache');var util=require(_0x949f('0x4'));var path=require(_0x949f('0x5'));var sox=require(_0x949f('0x6'));var csv=require(_0x949f('0x7'));var ejs=require(_0x949f('0x8'));var fs=require('fs');var fs_extra=require(_0x949f('0x9'));var _=require('lodash');var squel=require(_0x949f('0xa'));var crypto=require(_0x949f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x949f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x949f('0xd'));var Papa=require(_0x949f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x949f('0xf'));var as=require(_0x949f('0x10'));var hardwareService=require(_0x949f('0x11'));var logger=require(_0x949f('0x12'))(_0x949f('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x949f('0x14'));var db=require(_0x949f('0x15'))['db'];config[_0x949f('0x16')]=_[_0x949f('0x17')](config[_0x949f('0x16')],{'host':_0x949f('0x18'),'port':0x18eb});var socket=require(_0x949f('0x19'))(new Redis(config['redis']));require(_0x949f('0x1a'))[_0x949f('0x1b')](socket);function respondWithStatusCode(_0x37fce1,_0x1db390){_0x1db390=_0x1db390||0xcc;return function(_0x21bd28){if(_0x21bd28){return _0x37fce1['sendStatus'](_0x1db390);}return _0x37fce1[_0x949f('0x1c')](_0x1db390)[_0x949f('0x1d')]();};}function respondWithResult(_0x404963,_0x245daa){_0x245daa=_0x245daa||0xc8;return function(_0x3067b3){if(_0x3067b3){return _0x404963[_0x949f('0x1c')](_0x245daa)[_0x949f('0x1e')](_0x3067b3);}};}function respondWithFilteredResult(_0x236f07,_0x109660){return function(_0x531d37){if(_0x531d37){var _0x45d416=typeof _0x109660[_0x949f('0x1f')]===_0x949f('0x20')&&typeof _0x109660['limit']===_0x949f('0x20');var _0x236e5d=_0x531d37[_0x949f('0x21')];var _0x25f1fb=_0x45d416?0x0:_0x109660[_0x949f('0x1f')];var _0x2d5632=_0x45d416?_0x531d37[_0x949f('0x21')]:_0x109660[_0x949f('0x1f')]+_0x109660[_0x949f('0x22')];var _0x16c605;if(_0x2d5632>=_0x236e5d){_0x2d5632=_0x236e5d;_0x16c605=0xc8;}else{_0x16c605=0xce;}_0x236f07[_0x949f('0x1c')](_0x16c605);return _0x236f07['set'](_0x949f('0x23'),_0x25f1fb+'-'+_0x2d5632+'/'+_0x236e5d)[_0x949f('0x1e')](_0x531d37);}return null;};}function patchUpdates(_0x4b405e){return function(_0x5623b1){try{jsonpatch[_0x949f('0x24')](_0x5623b1,_0x4b405e,!![]);}catch(_0x5e7e03){return BPromise[_0x949f('0x25')](_0x5e7e03);}return _0x5623b1[_0x949f('0x26')]();};}function saveUpdates(_0x4a6c32,_0x5bb4c9){return function(_0x593413){if(_0x593413){return _0x593413[_0x949f('0x27')](_0x4a6c32)[_0x949f('0x28')](function(_0x41b634){return _0x41b634;});}return null;};}function removeEntity(_0x18f5ee,_0x51a893){return function(_0x2c416e){if(_0x2c416e){return _0x2c416e['destroy']()[_0x949f('0x28')](function(){_0x18f5ee[_0x949f('0x1c')](0xcc)[_0x949f('0x1d')]();});}};}function handleEntityNotFound(_0x43f1a3,_0x53084c){return function(_0x5c93b7){if(!_0x5c93b7){_0x43f1a3[_0x949f('0x29')](0x194);}return _0x5c93b7;};}function handleError(_0x12bb09,_0x363dfa){_0x363dfa=_0x363dfa||0x1f4;return function(_0x482f25){logger['error'](_0x482f25[_0x949f('0x2a')]);if(_0x482f25['name']){delete _0x482f25[_0x949f('0x2b')];}_0x12bb09['status'](_0x363dfa)[_0x949f('0x2c')](_0x482f25);};}exports[_0x949f('0x2d')]=function(_0xbc0f78,_0x19d679,_0x31e22c){if(!_0xbc0f78[_0x949f('0x2e')]['hasOwnProperty'](_0x949f('0x2f'))&&!_0xbc0f78[_0x949f('0x2e')]['hasOwnProperty'](_0x949f('0x30'))){throw new db[(_0x949f('0x31'))][(_0x949f('0x32'))](_0x949f('0x33'));}else{if(_0xbc0f78['body'][_0x949f('0x34')]('TemplateId')&&!_0xbc0f78[_0x949f('0x2e')]['hasOwnProperty'](_0x949f('0x35'))){throw new db['Sequelize'][(_0x949f('0x32'))](_0x949f('0x36'));}if(!_0xbc0f78[_0x949f('0x2e')]['hasOwnProperty'](_0x949f('0x37'))){throw new db[(_0x949f('0x31'))][(_0x949f('0x32'))](_0x949f('0x38'));}else{try{var _0x21a65d=JSON[_0x949f('0x39')](_0xbc0f78[_0x949f('0x2e')][_0x949f('0x37')]);}catch(_0x31e468){logger[_0x949f('0x3a')](_0x31e468);throw new db[(_0x949f('0x31'))]['ValidationError'](_0x949f('0x3b'));}var _0x177473=[_0x949f('0x3c'),'faxqueue',_0x949f('0x3d'),_0x949f('0x3e'),'smsqueue','voicequeue',_0x949f('0x3f'),_0x949f('0x40'),_0x949f('0x41')];if(_[_0x949f('0x42')](_0x21a65d,function(_0x1096e2){return!_[_0x949f('0x43')](_0x177473,_0x1096e2[_0x949f('0x44')][_0x949f('0x45')]());})){throw new db[(_0x949f('0x31'))][(_0x949f('0x32'))](_0x949f('0x46'));}}}var _0x25a168={};_0x25a168[_0x949f('0x47')]=_0xbc0f78[_0x949f('0x2e')][_0x949f('0x34')](_0x949f('0x47'))?_0xbc0f78['body'][_0x949f('0x47')]:_0xbc0f78[_0x949f('0x41')][_0x949f('0x48')];_0x25a168['recipientsDescription']=_['isEmpty'](_0xbc0f78[_0x949f('0x2e')]['recipientsDescription'])?null:_0xbc0f78[_0x949f('0x2e')][_0x949f('0x49')];_0x25a168['beep']=_0xbc0f78[_0x949f('0x2e')]['beep']||![];_0x25a168[_0x949f('0x4a')]=_0xbc0f78['user']['id'];return getContent(_0xbc0f78[_0x949f('0x2e')])['then'](function(_0x292e91){_0x25a168['body']=_0x292e91;return getRecipients(_0x21a65d);})[_0x949f('0x28')](function(_0x485e28){_0x25a168['recipientsId']=_['sortBy'](_0x485e28)['join'](',');return db[_0x949f('0x4b')]['transaction'](function(_0x3949c5){return db[_0x949f('0x4c')]['create'](_0x25a168,{'raw':!![],'transaction':_0x3949c5})[_0x949f('0x28')](function(_0x16afe1){var _0x4ba5aa={'sender':_0x25a168[_0x949f('0x47')],'description':_0x25a168['recipientsDescription'],'content':_0x25a168[_0x949f('0x2e')],'beep':_0x25a168[_0x949f('0x4d')]};_0x485e28[_0x949f('0x4e')](function(_0x5964ea){_0x4ba5aa['recipient']=_0x5964ea;socket['emit']('userNotification:send',_0x4ba5aa);});return _0x16afe1;});});})[_0x949f('0x28')](respondWithResult(_0x19d679,0xc9))['catch'](handleError(_0x19d679,null));};function getContent(_0xcd34ca){return new BPromise(function(_0x4c6977,_0x128652){if(_0xcd34ca['text']){_0x4c6977(_0xcd34ca['text']);return;}return db[_0x949f('0x4f')]['findOne']({'attributes':['html'],'where':{'id':_0xcd34ca[_0x949f('0x30')]},'raw':!![]})[_0x949f('0x28')](function(_0x5088c4){if(!_0x5088c4)throw new db[(_0x949f('0x31'))][(_0x949f('0x32'))](_0x949f('0x50'));var _0x218307=Mustache[_0x949f('0x51')](_0x5088c4['html'],_0xcd34ca[_0x949f('0x35')]);_0x4c6977(_0x218307);})[_0x949f('0x52')](function(_0x190cec){_0x128652(_0x190cec);});});}function getRecipients(_0x1b878d){return new BPromise(function(_0x2156d0,_0x3c5530){var _0x3f8ea6=[];var _0x276f38=[];_0x1b878d[_0x949f('0x4e')](function(_0x4981ce){var _0x2b7dfb=_['startCase'](_0x4981ce[_0x949f('0x44')][_0x949f('0x45')]());if(_0x2b7dfb===_0x949f('0x53')){_0x3f8ea6=_['union'](_0x3f8ea6,_0x4981ce[_0x949f('0x54')]);}else{if(_['includes'](_0x2b7dfb,_0x949f('0x55')))_0x2b7dfb=_0x2b7dfb[_0x949f('0x56')](_0x949f('0x55'),_0x949f('0x57'));_0x4981ce[_0x949f('0x54')][_0x949f('0x4e')](function(_0x53ba15){_0x276f38[_0x949f('0x58')](getAgents(_0x2b7dfb,_0x53ba15));});}});return BPromise[_0x949f('0x59')](_0x276f38)[_0x949f('0x28')](function(_0x343cab){_0x3f8ea6=_[_0x949f('0x5a')](_0x3f8ea6,_['flatten'](_0x343cab));_0x2156d0(_0x3f8ea6);})[_0x949f('0x52')](function(_0x91718c){_0x3c5530(_0x91718c);});});}function getAgents(_0x4256a6,_0x2dbf31){return new BPromise(function(_0x31e7be,_0x5b21a0){return db[_0x4256a6][_0x949f('0x5b')]({'where':{'id':_0x2dbf31}})[_0x949f('0x28')](function(_0x280618){return _0x280618['getAgents']({'attributes':['id'],'raw':!![]})[_0x949f('0x28')](function(_0x7c362d){var _0x31def9=_[_0x949f('0x5c')](_0x7c362d,'id');_0x31e7be(_0x31def9);});})[_0x949f('0x52')](function(_0xf6746a){_0x5b21a0(_0xf6746a);});});} \ No newline at end of file +var _0x169e=['fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','socket.io-emitter','./userNotification.socket','status','end','json','offset','undefined','limit','count','set','update','then','error','name','send','sendUserNotification','body','hasOwnProperty','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','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','UserNotification','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','queue','replace','Queue','ids','push','all','flatten','getAgents','map','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x4735f7,_0x434ecf){var _0x1fc1fb=function(_0x112c95){while(--_0x112c95){_0x4735f7['push'](_0x4735f7['shift']());}};_0x1fc1fb(++_0x434ecf);}(_0x169e,0x1da));var _0xe169=function(_0x7f4f4f,_0x1c670d){_0x7f4f4f=_0x7f4f4f-0x0;var _0x531f03=_0x169e[_0x7f4f4f];return _0x531f03;};'use strict';var emlformat=require(_0xe169('0x0'));var rimraf=require(_0xe169('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe169('0x2'));var rp=require('request-promise');var moment=require(_0xe169('0x3'));var BPromise=require(_0xe169('0x4'));var Mustache=require(_0xe169('0x5'));var util=require(_0xe169('0x6'));var path=require(_0xe169('0x7'));var sox=require(_0xe169('0x8'));var csv=require(_0xe169('0x9'));var ejs=require(_0xe169('0xa'));var fs=require('fs');var fs_extra=require(_0xe169('0xb'));var _=require(_0xe169('0xc'));var squel=require(_0xe169('0xd'));var crypto=require(_0xe169('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe169('0xf'));var toCsv=require(_0xe169('0x9'));var querystring=require(_0xe169('0x10'));var Papa=require(_0xe169('0x11'));var Redis=require(_0xe169('0x12'));var authService=require(_0xe169('0x13'));var qs=require(_0xe169('0x14'));var as=require(_0xe169('0x15'));var hardwareService=require(_0xe169('0x16'));var logger=require(_0xe169('0x17'))(_0xe169('0x18'));var utils=require(_0xe169('0x19'));var config=require(_0xe169('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe169('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe169('0x1c'))(new Redis(config[_0xe169('0x1b')]));require(_0xe169('0x1d'))['register'](socket);function respondWithStatusCode(_0x28d446,_0xa74801){_0xa74801=_0xa74801||0xcc;return function(_0x409576){if(_0x409576){return _0x28d446['sendStatus'](_0xa74801);}return _0x28d446[_0xe169('0x1e')](_0xa74801)[_0xe169('0x1f')]();};}function respondWithResult(_0x182a6b,_0x1660c4){_0x1660c4=_0x1660c4||0xc8;return function(_0x28dfdb){if(_0x28dfdb){return _0x182a6b[_0xe169('0x1e')](_0x1660c4)[_0xe169('0x20')](_0x28dfdb);}};}function respondWithFilteredResult(_0x544c7d,_0x5f21e2){return function(_0x52dfa6){if(_0x52dfa6){var _0x4dd1df=typeof _0x5f21e2[_0xe169('0x21')]===_0xe169('0x22')&&typeof _0x5f21e2[_0xe169('0x23')]===_0xe169('0x22');var _0x1bc6d7=_0x52dfa6[_0xe169('0x24')];var _0x490c41=_0x4dd1df?0x0:_0x5f21e2[_0xe169('0x21')];var _0x4247e7=_0x4dd1df?_0x52dfa6[_0xe169('0x24')]:_0x5f21e2['offset']+_0x5f21e2['limit'];var _0x2094c4;if(_0x4247e7>=_0x1bc6d7){_0x4247e7=_0x1bc6d7;_0x2094c4=0xc8;}else{_0x2094c4=0xce;}_0x544c7d[_0xe169('0x1e')](_0x2094c4);return _0x544c7d[_0xe169('0x25')]('Content-Range',_0x490c41+'-'+_0x4247e7+'/'+_0x1bc6d7)['json'](_0x52dfa6);}return null;};}function patchUpdates(_0x2de27e){return function(_0x235976){try{jsonpatch['apply'](_0x235976,_0x2de27e,!![]);}catch(_0x2cad41){return BPromise['reject'](_0x2cad41);}return _0x235976['save']();};}function saveUpdates(_0x1084a6,_0x16852e){return function(_0x5ae04a){if(_0x5ae04a){return _0x5ae04a[_0xe169('0x26')](_0x1084a6)[_0xe169('0x27')](function(_0x5a7450){return _0x5a7450;});}return null;};}function removeEntity(_0x2dd681,_0x4f057a){return function(_0x5bbb90){if(_0x5bbb90){return _0x5bbb90['destroy']()[_0xe169('0x27')](function(){_0x2dd681[_0xe169('0x1e')](0xcc)[_0xe169('0x1f')]();});}};}function handleEntityNotFound(_0x514f19,_0x38f524){return function(_0x3d2e6e){if(!_0x3d2e6e){_0x514f19['sendStatus'](0x194);}return _0x3d2e6e;};}function handleError(_0x2f0d42,_0x16cbe0){_0x16cbe0=_0x16cbe0||0x1f4;return function(_0x40b569){logger[_0xe169('0x28')](_0x40b569['stack']);if(_0x40b569[_0xe169('0x29')]){delete _0x40b569[_0xe169('0x29')];}_0x2f0d42['status'](_0x16cbe0)[_0xe169('0x2a')](_0x40b569);};}exports[_0xe169('0x2b')]=function(_0x1ed7bf,_0x45a6f8,_0x36d169){if(!_0x1ed7bf[_0xe169('0x2c')][_0xe169('0x2d')]('text')&&!_0x1ed7bf[_0xe169('0x2c')][_0xe169('0x2d')](_0xe169('0x2e'))){throw new db['Sequelize'][(_0xe169('0x2f'))](_0xe169('0x30'));}else{if(_0x1ed7bf[_0xe169('0x2c')]['hasOwnProperty'](_0xe169('0x2e'))&&!_0x1ed7bf[_0xe169('0x2c')][_0xe169('0x2d')](_0xe169('0x31'))){throw new db[(_0xe169('0x32'))]['ValidationError'](_0xe169('0x33'));}if(!_0x1ed7bf[_0xe169('0x2c')]['hasOwnProperty'](_0xe169('0x34'))){throw new db[(_0xe169('0x32'))][(_0xe169('0x2f'))](_0xe169('0x35'));}else{try{var _0x298e41=JSON[_0xe169('0x36')](_0x1ed7bf[_0xe169('0x2c')]['recipients']);}catch(_0x549c5d){logger['error'](_0x549c5d);throw new db[(_0xe169('0x32'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x34955c=['chatqueue',_0xe169('0x37'),_0xe169('0x38'),_0xe169('0x39'),_0xe169('0x3a'),'voicequeue',_0xe169('0x3b'),_0xe169('0x3c'),_0xe169('0x3d')];if(_['some'](_0x298e41,function(_0x3fd99c){return!_[_0xe169('0x3e')](_0x34955c,_0x3fd99c[_0xe169('0x3f')]['toLowerCase']());})){throw new db['Sequelize'][(_0xe169('0x2f'))](_0xe169('0x40'));}}}var _0x370ac2={};_0x370ac2[_0xe169('0x41')]=_0x1ed7bf[_0xe169('0x2c')][_0xe169('0x2d')](_0xe169('0x41'))?_0x1ed7bf['body'][_0xe169('0x41')]:_0x1ed7bf[_0xe169('0x3d')]['fullname'];_0x370ac2[_0xe169('0x42')]=_[_0xe169('0x43')](_0x1ed7bf['body']['recipientsDescription'])?null:_0x1ed7bf['body'][_0xe169('0x42')];_0x370ac2[_0xe169('0x44')]=_0x1ed7bf[_0xe169('0x2c')][_0xe169('0x44')]||![];_0x370ac2[_0xe169('0x45')]=_0x1ed7bf[_0xe169('0x3d')]['id'];return getContent(_0x1ed7bf[_0xe169('0x2c')])[_0xe169('0x27')](function(_0x6a9969){_0x370ac2[_0xe169('0x2c')]=_0x6a9969;return getRecipients(_0x298e41);})[_0xe169('0x27')](function(_0x11acd8){_0x370ac2['recipientsId']=_[_0xe169('0x46')](_0x11acd8)[_0xe169('0x47')](',');return db[_0xe169('0x48')]['transaction'](function(_0x379029){return db[_0xe169('0x49')]['create'](_0x370ac2,{'raw':!![],'transaction':_0x379029})[_0xe169('0x27')](function(_0x1e6c27){var _0x4846d2={'sender':_0x370ac2['senderName'],'description':_0x370ac2['recipientsDescription'],'content':_0x370ac2[_0xe169('0x2c')],'beep':_0x370ac2[_0xe169('0x44')]};_0x11acd8[_0xe169('0x4a')](function(_0xe14eda){_0x4846d2[_0xe169('0x4b')]=_0xe14eda;socket[_0xe169('0x4c')](_0xe169('0x4d'),_0x4846d2);});return _0x1e6c27;});});})[_0xe169('0x27')](respondWithResult(_0x45a6f8,0xc9))[_0xe169('0x4e')](handleError(_0x45a6f8,null));};function getContent(_0xe11a10){return new BPromise(function(_0x3e290f,_0x306176){if(_0xe11a10[_0xe169('0x4f')]){_0x3e290f(_0xe11a10[_0xe169('0x4f')]);return;}return db[_0xe169('0x50')][_0xe169('0x51')]({'attributes':[_0xe169('0x52')],'where':{'id':_0xe11a10[_0xe169('0x2e')]},'raw':!![]})['then'](function(_0x45214a){if(!_0x45214a)throw new db[(_0xe169('0x32'))][(_0xe169('0x2f'))](_0xe169('0x53'));var _0x2f644f=Mustache[_0xe169('0x54')](_0x45214a[_0xe169('0x52')],_0xe11a10['view']);_0x3e290f(_0x2f644f);})[_0xe169('0x4e')](function(_0x304831){_0x306176(_0x304831);});});}function getRecipients(_0x4e8e0c){return new BPromise(function(_0x4a673a,_0x582c51){var _0x5ee93e=[];var _0x18bc4e=[];_0x4e8e0c['forEach'](function(_0x3ae5b3){var _0x22d332=_[_0xe169('0x55')](_0x3ae5b3[_0xe169('0x3f')]['toLowerCase']());if(_0x22d332===_0xe169('0x56')){_0x5ee93e=_[_0xe169('0x57')](_0x5ee93e,_0x3ae5b3['ids']);}else{if(_[_0xe169('0x3e')](_0x22d332,_0xe169('0x58')))_0x22d332=_0x22d332[_0xe169('0x59')](_0xe169('0x58'),_0xe169('0x5a'));_0x3ae5b3[_0xe169('0x5b')]['forEach'](function(_0x5d68cb){_0x18bc4e[_0xe169('0x5c')](getAgents(_0x22d332,_0x5d68cb));});}});return BPromise[_0xe169('0x5d')](_0x18bc4e)[_0xe169('0x27')](function(_0x5db860){_0x5ee93e=_['union'](_0x5ee93e,_[_0xe169('0x5e')](_0x5db860));_0x4a673a(_0x5ee93e);})[_0xe169('0x4e')](function(_0x5e933f){_0x582c51(_0x5e933f);});});}function getAgents(_0x43e5d8,_0x2ae7a2){return new BPromise(function(_0x322336,_0x4cfaf4){return db[_0x43e5d8][_0xe169('0x51')]({'where':{'id':_0x2ae7a2}})[_0xe169('0x27')](function(_0x17eb72){return _0x17eb72[_0xe169('0x5f')]({'attributes':['id'],'raw':!![]})[_0xe169('0x27')](function(_0x3447e3){var _0x565290=_[_0xe169('0x60')](_0x3447e3,'id');_0x322336(_0x565290);});})[_0xe169('0x4e')](function(_0x16de08){_0x4cfaf4(_0x16de08);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 8afc869..9ecce51 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 _0x9941=['remove','emit','hasOwnProperty','hook','events','save','update'];(function(_0x5e3b4d,_0x292f10){var _0x3a5e56=function(_0x3bec7e){while(--_0x3bec7e){_0x5e3b4d['push'](_0x5e3b4d['shift']());}};_0x3a5e56(++_0x292f10);}(_0x9941,0x18c));var _0x1994=function(_0x36a786,_0x1f112a){_0x36a786=_0x36a786-0x0;var _0x371498=_0x9941[_0x36a786];return _0x371498;};'use strict';var EventEmitter=require(_0x1994('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1994('0x1'),'afterUpdate':_0x1994('0x2'),'afterDestroy':_0x1994('0x3')};function emitEvent(_0x590f29){return function(_0x1bf43b,_0x33f7e5,_0x154de3){UserNotificationEvents['emit'](_0x590f29+':'+_0x1bf43b['id'],_0x1bf43b);UserNotificationEvents[_0x1994('0x4')](_0x590f29,_0x1bf43b);_0x154de3(null);};}for(var e in events){if(events[_0x1994('0x5')](e)){var event=events[e];UserNotification[_0x1994('0x6')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xf5a8=['hasOwnProperty','hook','exports','../../mysqldb','UserNotification','save','update','remove','emit'];(function(_0x21dceb,_0x20996f){var _0x45a52a=function(_0x3b1fbf){while(--_0x3b1fbf){_0x21dceb['push'](_0x21dceb['shift']());}};_0x45a52a(++_0x20996f);}(_0xf5a8,0x198));var _0x8f5a=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0xf5a8[_0x28394f];return _0x2618d2;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x8f5a('0x0'))['db'][_0x8f5a('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8f5a('0x2'),'afterUpdate':_0x8f5a('0x3'),'afterDestroy':_0x8f5a('0x4')};function emitEvent(_0xfe94ad){return function(_0x534ce3,_0x547bba,_0x2497ca){UserNotificationEvents[_0x8f5a('0x5')](_0xfe94ad+':'+_0x534ce3['id'],_0x534ce3);UserNotificationEvents[_0x8f5a('0x5')](_0xfe94ad,_0x534ce3);_0x2497ca(null);};}for(var e in events){if(events[_0x8f5a('0x6')](e)){var event=events[e];UserNotification[_0x8f5a('0x7')](e,emitEvent(event));}}module[_0x8f5a('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 2c44a99..ea64139 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 _0x134f=['../../config/environment','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x3f77a6,_0x302113){var _0x31842a=function(_0x211656){while(--_0x211656){_0x3f77a6['push'](_0x3f77a6['shift']());}};_0x31842a(++_0x302113);}(_0x134f,0x1a7));var _0xf134=function(_0x4f3556,_0x39c043){_0x4f3556=_0x4f3556-0x0;var _0x5aa9f9=_0x134f[_0x4f3556];return _0x5aa9f9;};'use strict';var _=require(_0xf134('0x0'));var util=require('util');var logger=require(_0xf134('0x1'))('api');var moment=require(_0xf134('0x2'));var BPromise=require(_0xf134('0x3'));var rp=require(_0xf134('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf134('0x5'));var config=require(_0xf134('0x6'));var attributes=require('./userNotification.attributes');module[_0xf134('0x7')]=function(_0x58b96b,_0x166631){return _0x58b96b[_0xf134('0x8')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf134('0x9'),'collate':_0xf134('0xa')});}; \ No newline at end of file +var _0x9edb=['moment','bluebird','rimraf','../../config/environment','./userNotification.attributes','exports','define','userNotifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x9edb,0xb2));var _0xb9ed=function(_0x4bb7d1,_0x5f4459){_0x4bb7d1=_0x4bb7d1-0x0;var _0x2daca4=_0x9edb[_0x4bb7d1];return _0x2daca4;};'use strict';var _=require(_0xb9ed('0x0'));var util=require(_0xb9ed('0x1'));var logger=require(_0xb9ed('0x2'))(_0xb9ed('0x3'));var moment=require(_0xb9ed('0x4'));var BPromise=require(_0xb9ed('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb9ed('0x6'));var config=require(_0xb9ed('0x7'));var attributes=require(_0xb9ed('0x8'));module[_0xb9ed('0x9')]=function(_0x1d88e0,_0x59a7d3){return _0x1d88e0[_0xb9ed('0xa')]('UserNotification',attributes,{'tableName':_0xb9ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb9ed('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index d74468f..34941f8 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 _0x8185=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','defaults','localhost','socket.io-emitter','redis','./userNotification.socket','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x45eb9c,_0x134392){var _0x56a96a=function(_0x385c9c){while(--_0x385c9c){_0x45eb9c['push'](_0x45eb9c['shift']());}};_0x56a96a(++_0x134392);}(_0x8185,0x1a6));var _0x5818=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x8185[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x5818('0x0'));var util=require(_0x5818('0x1'));var moment=require('moment');var BPromise=require(_0x5818('0x2'));var rs=require(_0x5818('0x3'));var fs=require('fs');var Redis=require(_0x5818('0x4'));var db=require(_0x5818('0x5'))['db'];var utils=require(_0x5818('0x6'));var logger=require('../../config/logger')(_0x5818('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x5818('0x8')](config['redis'],{'host':_0x5818('0x9'),'port':0x18eb});var socket=require(_0x5818('0xa'))(new Redis(config[_0x5818('0xb')]));require(_0x5818('0xc'))['register'](socket);function respondWithRpcPromise(_0x5de773,_0x54a210,_0x276797){return new BPromise(function(_0x416cb1,_0x52b2d0){return client['request'](_0x5de773,_0x276797)[_0x5818('0xd')](function(_0x2d0708){logger[_0x5818('0xe')](_0x5818('0xf'),_0x54a210,_0x5818('0x10'));logger[_0x5818('0x11')](_0x5818('0x12'),_0x54a210,_0x5818('0x10'),JSON[_0x5818('0x13')](_0x2d0708));if(_0x2d0708[_0x5818('0x14')]){if(_0x2d0708[_0x5818('0x14')][_0x5818('0x15')]===0x1f4){logger[_0x5818('0x14')](_0x5818('0xf'),_0x54a210,_0x2d0708[_0x5818('0x14')][_0x5818('0x16')]);return _0x52b2d0(_0x2d0708['error'][_0x5818('0x16')]);}logger[_0x5818('0x14')](_0x5818('0xf'),_0x54a210,_0x2d0708['error'][_0x5818('0x16')]);return _0x416cb1(_0x2d0708[_0x5818('0x14')][_0x5818('0x16')]);}else{logger[_0x5818('0xe')]('UserNotification,\x20%s,\x20%s',_0x54a210,_0x5818('0x10'));_0x416cb1(_0x2d0708[_0x5818('0x17')][_0x5818('0x16')]);}})[_0x5818('0x18')](function(_0x37efa9){logger[_0x5818('0x14')](_0x5818('0xf'),_0x54a210,_0x37efa9);_0x52b2d0(_0x37efa9);});});} \ No newline at end of file +var _0xd155=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./userNotification.socket','request','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd155,0x113));var _0x5d15=function(_0x417b1a,_0x3cfce5){_0x417b1a=_0x417b1a-0x0;var _0x1e41af=_0xd155[_0x417b1a];return _0x1e41af;};'use strict';var _=require(_0x5d15('0x0'));var util=require(_0x5d15('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5d15('0x2'));var fs=require('fs');var Redis=require(_0x5d15('0x3'));var db=require(_0x5d15('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d15('0x5'))(_0x5d15('0x6'));var config=require(_0x5d15('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5d15('0x8')]['http']({'port':0x232a});config[_0x5d15('0x9')]=_[_0x5d15('0xa')](config[_0x5d15('0x9')],{'host':_0x5d15('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5d15('0xc'))['register'](socket);function respondWithRpcPromise(_0x335f9e,_0x18c5d5,_0x11e85a){return new BPromise(function(_0x570f77,_0x2f9be1){return client[_0x5d15('0xd')](_0x335f9e,_0x11e85a)['then'](function(_0x3ce670){logger[_0x5d15('0xe')](_0x5d15('0xf'),_0x18c5d5,'request\x20sent');logger[_0x5d15('0x10')](_0x5d15('0x11'),_0x18c5d5,_0x5d15('0x12'),JSON[_0x5d15('0x13')](_0x3ce670));if(_0x3ce670['error']){if(_0x3ce670[_0x5d15('0x14')][_0x5d15('0x15')]===0x1f4){logger[_0x5d15('0x14')](_0x5d15('0xf'),_0x18c5d5,_0x3ce670[_0x5d15('0x14')]['message']);return _0x2f9be1(_0x3ce670[_0x5d15('0x14')][_0x5d15('0x16')]);}logger[_0x5d15('0x14')]('UserNotification,\x20%s,\x20%s',_0x18c5d5,_0x3ce670['error']['message']);return _0x570f77(_0x3ce670['error'][_0x5d15('0x16')]);}else{logger[_0x5d15('0xe')](_0x5d15('0xf'),_0x18c5d5,'request\x20sent');_0x570f77(_0x3ce670[_0x5d15('0x17')][_0x5d15('0x16')]);}})[_0x5d15('0x18')](function(_0x35b82b){logger[_0x5d15('0x14')](_0x5d15('0xf'),_0x18c5d5,_0x35b82b);_0x2f9be1(_0x35b82b);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 52dea38..5563830 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 _0x84d3=['userNotification:','./userNotification.events','remove','update','emit','length'];(function(_0xbbaf52,_0x3e0486){var _0x2bf6f3=function(_0x14d563){while(--_0x14d563){_0xbbaf52['push'](_0xbbaf52['shift']());}};_0x2bf6f3(++_0x3e0486);}(_0x84d3,0x1d5));var _0x384d=function(_0x16e40e,_0x30d56f){_0x16e40e=_0x16e40e-0x0;var _0x7f336=_0x84d3[_0x16e40e];return _0x7f336;};'use strict';var UserNotificationEvents=require(_0x384d('0x0'));var events=['save',_0x384d('0x1'),_0x384d('0x2')];function createListener(_0x315c41,_0x212392){return function(_0x37a4b2){_0x212392[_0x384d('0x3')](_0x315c41,_0x37a4b2);};}function removeListener(_0x2dc516,_0x3581e9){return function(){UserNotificationEvents['removeListener'](_0x2dc516,_0x3581e9);};}exports['register']=function(_0x434f86){for(var _0x2dd553=0x0,_0xbab56a=events[_0x384d('0x4')];_0x2dd553<_0xbab56a;_0x2dd553++){var _0x345f6b=events[_0x2dd553];var _0x389c28=createListener(_0x384d('0x5')+_0x345f6b,_0x434f86);UserNotificationEvents['on'](_0x345f6b,_0x389c28);}}; \ No newline at end of file +var _0x717a=['length','userNotification:','save','remove','update','emit','removeListener','register'];(function(_0x5b6cf1,_0x32fdcd){var _0x46278c=function(_0x53fd9b){while(--_0x53fd9b){_0x5b6cf1['push'](_0x5b6cf1['shift']());}};_0x46278c(++_0x32fdcd);}(_0x717a,0x11a));var _0xa717=function(_0x264d4d,_0x118fb5){_0x264d4d=_0x264d4d-0x0;var _0xc917e2=_0x717a[_0x264d4d];return _0xc917e2;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xa717('0x0'),_0xa717('0x1'),_0xa717('0x2')];function createListener(_0x43490e,_0x4b84f5){return function(_0x332e97){_0x4b84f5[_0xa717('0x3')](_0x43490e,_0x332e97);};}function removeListener(_0x26973a,_0x125174){return function(){UserNotificationEvents[_0xa717('0x4')](_0x26973a,_0x125174);};}exports[_0xa717('0x5')]=function(_0x1fab7c){for(var _0x3967e4=0x0,_0x39ff00=events[_0xa717('0x6')];_0x3967e4<_0x39ff00;_0x3967e4++){var _0x3e4232=events[_0x3967e4];var _0x1b4236=createListener(_0xa717('0x7')+_0x3e4232,_0x1fab7c);UserNotificationEvents['on'](_0x3e4232,_0x1b4236);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 8f79c84..6f68b0a 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xab9053,_0xa22c99){var _0x58f619=function(_0x57c504){while(--_0x57c504){_0xab9053['push'](_0xab9053['shift']());}};_0x58f619(++_0xa22c99);}(_0xedd9,0xfc));var _0x9edd=function(_0x4fb810,_0x441071){_0x4fb810=_0x4fb810-0x0;var _0x5c646c=_0xedd9[_0x4fb810];return _0x5c646c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x321ddc,_0x58f72a){var _0x277f53=function(_0x3ebc0e){while(--_0x3ebc0e){_0x321ddc['push'](_0x321ddc['shift']());}};_0x277f53(++_0x58f72a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index e52d3d9..b58e9b0 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 _0x3ef3=['exports','INTEGER','sequelize'];(function(_0x4ccc53,_0x4b12b2){var _0xd06a39=function(_0x1d3d9e){while(--_0x1d3d9e){_0x4ccc53['push'](_0x4ccc53['shift']());}};_0xd06a39(++_0x4b12b2);}(_0x3ef3,0x74));var _0x33ef=function(_0x29cd14,_0x245c40){_0x29cd14=_0x29cd14-0x0;var _0x4229d1=_0x3ef3[_0x29cd14];return _0x4229d1;};'use strict';var Sequelize=require(_0x33ef('0x0'));module[_0x33ef('0x1')]={'penalty':{'type':Sequelize[_0x33ef('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4800=['exports','INTEGER','sequelize'];(function(_0x2a2a82,_0x1cea6a){var _0x3cd1bb=function(_0x30b534){while(--_0x30b534){_0x2a2a82['push'](_0x2a2a82['shift']());}};_0x3cd1bb(++_0x1cea6a);}(_0x4800,0x80));var _0x0480=function(_0x10f17c,_0x25a5f8){_0x10f17c=_0x10f17c-0x0;var _0x53702b=_0x4800[_0x10f17c];return _0x53702b;};'use strict';var Sequelize=require(_0x0480('0x0'));module[_0x0480('0x1')]={'penalty':{'type':Sequelize[_0x0480('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 a9ac2b2..7dd7a4d 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 _0x1934=['path','rimraf','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','util','moment','bluebird','request-promise'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x1934,0x1ac));var _0x4193=function(_0xdcb582,_0x2fb7ed){_0xdcb582=_0xdcb582-0x0;var _0x82ffba=_0x1934[_0xdcb582];return _0x82ffba;};'use strict';var _=require('lodash');var util=require(_0x4193('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4193('0x1'));var BPromise=require(_0x4193('0x2'));var rp=require(_0x4193('0x3'));var fs=require('fs');var path=require(_0x4193('0x4'));var rimraf=require(_0x4193('0x5'));var config=require('../../config/environment');var attributes=require(_0x4193('0x6'));module['exports']=function(_0x302246,_0x99b572){return _0x302246[_0x4193('0x7')](_0x4193('0x8'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0170=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','UserOpenchannelQueue','lodash','../../config/logger','api'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0x0170,0xed));var _0x0017=function(_0x1c8ff3,_0x55ca11){_0x1c8ff3=_0x1c8ff3-0x0;var _0x5f8915=_0x0170[_0x1c8ff3];return _0x5f8915;};'use strict';var _=require(_0x0017('0x0'));var util=require('util');var logger=require(_0x0017('0x1'))(_0x0017('0x2'));var moment=require(_0x0017('0x3'));var BPromise=require(_0x0017('0x4'));var rp=require(_0x0017('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0017('0x6'));var config=require(_0x0017('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x0017('0x8')]=function(_0x4498d8,_0x285f99){return _0x4498d8['define'](_0x0017('0x9'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 7673a4c..7063fe3 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 _0x5699=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','UserOpenchannelQueue,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x42dbb3,_0xfc48ae){var _0x306d3a=function(_0x323010){while(--_0x323010){_0x42dbb3['push'](_0x42dbb3['shift']());}};_0x306d3a(++_0xfc48ae);}(_0x5699,0x197));var _0x9569=function(_0x3e5a67,_0x497f9b){_0x3e5a67=_0x3e5a67-0x0;var _0x57d658=_0x5699[_0x3e5a67];return _0x57d658;};'use strict';var _=require(_0x9569('0x0'));var util=require(_0x9569('0x1'));var moment=require('moment');var BPromise=require(_0x9569('0x2'));var rs=require(_0x9569('0x3'));var fs=require('fs');var Redis=require(_0x9569('0x4'));var db=require(_0x9569('0x5'))['db'];var utils=require(_0x9569('0x6'));var logger=require(_0x9569('0x7'))(_0x9569('0x8'));var config=require(_0x9569('0x9'));var jayson=require(_0x9569('0xa'));var client=jayson[_0x9569('0xb')][_0x9569('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d8583,_0x2af870,_0x3b4464){return new BPromise(function(_0x509184,_0x2e8d91){return client[_0x9569('0xd')](_0x3d8583,_0x3b4464)['then'](function(_0x212587){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x2af870,'request\x20sent');logger['debug'](_0x9569('0xe'),_0x2af870,_0x9569('0xf'),JSON[_0x9569('0x10')](_0x212587));if(_0x212587[_0x9569('0x11')]){if(_0x212587['error']['code']===0x1f4){logger[_0x9569('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2af870,_0x212587[_0x9569('0x11')][_0x9569('0x12')]);return _0x2e8d91(_0x212587['error'][_0x9569('0x12')]);}logger[_0x9569('0x11')](_0x9569('0x13'),_0x2af870,_0x212587[_0x9569('0x11')][_0x9569('0x12')]);return _0x509184(_0x212587[_0x9569('0x11')][_0x9569('0x12')]);}else{logger[_0x9569('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2af870,_0x9569('0xf'));_0x509184(_0x212587[_0x9569('0x15')]['message']);}})[_0x9569('0x16')](function(_0x2f111b){logger[_0x9569('0x11')](_0x9569('0x13'),_0x2af870,_0x2f111b);_0x2e8d91(_0x2f111b);});});} \ No newline at end of file +var _0x0786=['request\x20sent','debug','error','UserOpenchannelQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','then'];(function(_0x8046c,_0x21c961){var _0x457edc=function(_0x5d9082){while(--_0x5d9082){_0x8046c['push'](_0x8046c['shift']());}};_0x457edc(++_0x21c961);}(_0x0786,0x134));var _0x6078=function(_0x101152,_0x397ab0){_0x101152=_0x101152-0x0;var _0xe1c465=_0x0786[_0x101152];return _0xe1c465;};'use strict';var _=require(_0x6078('0x0'));var util=require(_0x6078('0x1'));var moment=require(_0x6078('0x2'));var BPromise=require(_0x6078('0x3'));var rs=require(_0x6078('0x4'));var fs=require('fs');var Redis=require(_0x6078('0x5'));var db=require(_0x6078('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6078('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6078('0x8'));var client=jayson[_0x6078('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x580638,_0x578980,_0x18412f){return new BPromise(function(_0x2b6ab7,_0x235649){return client[_0x6078('0xa')](_0x580638,_0x18412f)[_0x6078('0xb')](function(_0x45762d){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x578980,_0x6078('0xc'));logger[_0x6078('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x578980,_0x6078('0xc'),JSON['stringify'](_0x45762d));if(_0x45762d[_0x6078('0xe')]){if(_0x45762d['error']['code']===0x1f4){logger[_0x6078('0xe')](_0x6078('0xf'),_0x578980,_0x45762d[_0x6078('0xe')][_0x6078('0x10')]);return _0x235649(_0x45762d['error'][_0x6078('0x10')]);}logger[_0x6078('0xe')](_0x6078('0xf'),_0x578980,_0x45762d[_0x6078('0xe')][_0x6078('0x10')]);return _0x2b6ab7(_0x45762d[_0x6078('0xe')][_0x6078('0x10')]);}else{logger[_0x6078('0x11')](_0x6078('0xf'),_0x578980,_0x6078('0xc'));_0x2b6ab7(_0x45762d[_0x6078('0x12')]['message']);}})[_0x6078('0x13')](function(_0x111ed5){logger[_0x6078('0xe')](_0x6078('0xf'),_0x578980,_0x111ed5);_0x235649(_0x111ed5);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 4d52f89..061ff40 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 _0xbffa=['/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections','removeResources','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbffa,0x189));var _0xabff=function(_0x300b2f,_0x537721){_0x300b2f=_0x300b2f-0x0;var _0x155f75=_0xbffa[_0x300b2f];return _0x155f75;};'use strict';var multer=require('multer');var util=require(_0xabff('0x0'));var path=require('path');var timeout=require(_0xabff('0x1'));var express=require('express');var router=express[_0xabff('0x2')]();var fs_extra=require(_0xabff('0x3'));var auth=require(_0xabff('0x4'));var interaction=require(_0xabff('0x5'));var config=require(_0xabff('0x6'));var controller=require('./userProfile.controller');router[_0xabff('0x7')]('/',auth[_0xabff('0x8')](),controller[_0xabff('0x9')]);router[_0xabff('0x7')](_0xabff('0xa'),auth[_0xabff('0x8')](),controller[_0xabff('0xb')]);router[_0xabff('0x7')](_0xabff('0xc'),auth[_0xabff('0x8')](),controller[_0xabff('0xd')]);router[_0xabff('0x7')](_0xabff('0xe'),auth['isAuthenticated'](),controller[_0xabff('0xf')]);router[_0xabff('0x7')](_0xabff('0x10'),auth[_0xabff('0x8')](),controller[_0xabff('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xabff('0x12')]);router[_0xabff('0x13')](_0xabff('0x14'),auth[_0xabff('0x8')](),controller[_0xabff('0x15')]);router['post'](_0xabff('0xe'),auth['isAuthenticated'](),controller[_0xabff('0x16')]);router[_0xabff('0x13')](_0xabff('0x10'),auth[_0xabff('0x8')](),controller[_0xabff('0x17')]);router[_0xabff('0x18')](_0xabff('0xc'),auth[_0xabff('0x8')](),controller[_0xabff('0x19')]);router[_0xabff('0x1a')](_0xabff('0xc'),auth['isAuthenticated'](),controller[_0xabff('0x1b')]);router[_0xabff('0x1a')](_0xabff('0xe'),auth['isAuthenticated'](),controller[_0xabff('0x1c')]);router[_0xabff('0x1a')](_0xabff('0x10'),auth['isAuthenticated'](),controller[_0xabff('0x1d')]);module[_0xabff('0x1e')]=router; \ No newline at end of file +var _0xa757=['../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','describe','show','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','/:id/sections','addSections','addResources','put','/:id','update','destroy','delete','removeResources','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xc2d920,_0x475ca9){var _0x22d335=function(_0x2581d2){while(--_0x2581d2){_0xc2d920['push'](_0xc2d920['shift']());}};_0x22d335(++_0x475ca9);}(_0xa757,0x179));var _0x7a75=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa757[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x7a75('0x0'));var util=require(_0x7a75('0x1'));var path=require('path');var timeout=require(_0x7a75('0x2'));var express=require(_0x7a75('0x3'));var router=express[_0x7a75('0x4')]();var fs_extra=require(_0x7a75('0x5'));var auth=require(_0x7a75('0x6'));var interaction=require(_0x7a75('0x7'));var config=require(_0x7a75('0x8'));var controller=require(_0x7a75('0x9'));router['get']('/',auth[_0x7a75('0xa')](),controller[_0x7a75('0xb')]);router[_0x7a75('0xc')]('/describe',auth['isAuthenticated'](),controller[_0x7a75('0xd')]);router[_0x7a75('0xc')]('/:id',auth[_0x7a75('0xa')](),controller[_0x7a75('0xe')]);router[_0x7a75('0xc')]('/:id/sections',auth[_0x7a75('0xa')](),controller[_0x7a75('0xf')]);router[_0x7a75('0xc')](_0x7a75('0x10'),auth[_0x7a75('0xa')](),controller[_0x7a75('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7a75('0x12')]);router[_0x7a75('0x13')](_0x7a75('0x14'),auth['isAuthenticated'](),controller[_0x7a75('0x15')]);router[_0x7a75('0x13')](_0x7a75('0x16'),auth['isAuthenticated'](),controller[_0x7a75('0x17')]);router[_0x7a75('0x13')](_0x7a75('0x10'),auth[_0x7a75('0xa')](),controller[_0x7a75('0x18')]);router[_0x7a75('0x19')](_0x7a75('0x1a'),auth['isAuthenticated'](),controller[_0x7a75('0x1b')]);router['delete'](_0x7a75('0x1a'),auth[_0x7a75('0xa')](),controller[_0x7a75('0x1c')]);router[_0x7a75('0x1d')](_0x7a75('0x16'),auth['isAuthenticated'](),controller['removeSections']);router[_0x7a75('0x1d')]('/:id/resources',auth[_0x7a75('0xa')](),controller[_0x7a75('0x1e')]);module[_0x7a75('0x1f')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 0d406a0..9c20631 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 _0xf50e=['name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','STRING'];(function(_0x1ac6ec,_0x1f81fc){var _0x48a489=function(_0xf38b04){while(--_0xf38b04){_0x1ac6ec['push'](_0x1ac6ec['shift']());}};_0x48a489(++_0x1f81fc);}(_0xf50e,0x87));var _0xef50=function(_0x17823f,_0xffd807){_0x17823f=_0x17823f-0x0;var _0x51fc21=_0xf50e[_0x17823f];return _0x51fc21;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xef50('0x0')],'allowNull':![],'unique':_0xef50('0x1')},'crudPermissions':{'type':Sequelize[_0xef50('0x0')],'set':function(_0x5aba28){this[_0xef50('0x2')](_0xef50('0x3'),_0x5aba28?_0x5aba28[_0xef50('0x4')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0xef50('0x5')](_0xef50('0x3'))[_0xef50('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xef50('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xef50('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xef50('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xef50('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xef50('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xef50('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xef50('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x89f1=['crudPermissions','getDataValue','BOOLEAN','sequelize','exports','STRING','setDataValue'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x89f1,0x1f4));var _0x189f=function(_0x257a28,_0x2cd00d){_0x257a28=_0x257a28-0x0;var _0x13bccc=_0x89f1[_0x257a28];return _0x13bccc;};'use strict';var Sequelize=require(_0x189f('0x0'));module[_0x189f('0x1')]={'name':{'type':Sequelize[_0x189f('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x43520e){this[_0x189f('0x3')](_0x189f('0x4'),_0x43520e?_0x43520e['join'](''):[]);},'get':function(){return this[_0x189f('0x5')]('crudPermissions')?this[_0x189f('0x5')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x189f('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x189f('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x189f('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x189f('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x189f('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x189f('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index d51cc19..f2135b8 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 _0xa039=['Dashboard','resourceId','forEach','addResources','bulkCreate','get','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','type','VIRTUAL','merge','options','UserProfile','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','clone','createdAt','updatedAt','crudPermissions','omit','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','UserProfileSection','removeSections','ids','filter','enabled','includes','isEmpty','subsections','concat','push','findOne'];(function(_0x3eff7f,_0x1441e5){var _0x584603=function(_0x2b3082){while(--_0x2b3082){_0x3eff7f['push'](_0x3eff7f['shift']());}};_0x584603(++_0x1441e5);}(_0xa039,0x1d2));var _0x9a03=function(_0x6b0dc7,_0x111a2e){_0x6b0dc7=_0x6b0dc7-0x0;var _0x297af5=_0xa039[_0x6b0dc7];return _0x297af5;};'use strict';var emlformat=require(_0x9a03('0x0'));var rimraf=require(_0x9a03('0x1'));var zipdir=require(_0x9a03('0x2'));var jsonpatch=require(_0x9a03('0x3'));var rp=require(_0x9a03('0x4'));var moment=require(_0x9a03('0x5'));var BPromise=require(_0x9a03('0x6'));var Mustache=require(_0x9a03('0x7'));var util=require(_0x9a03('0x8'));var path=require(_0x9a03('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a03('0xa'));var _=require(_0x9a03('0xb'));var squel=require(_0x9a03('0xc'));var crypto=require(_0x9a03('0xd'));var jsforce=require(_0x9a03('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9a03('0xf'));var querystring=require('querystring');var Papa=require(_0x9a03('0x10'));var Redis=require(_0x9a03('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9a03('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a03('0x13'))(_0x9a03('0x14'));var utils=require('../../config/utils');var config=require(_0x9a03('0x15'));var licenseUtil=require(_0x9a03('0x16'));var db=require('../../mysqldb')['db'];config[_0x9a03('0x17')]=_[_0x9a03('0x18')](config[_0x9a03('0x17')],{'host':_0x9a03('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a03('0x17')]));require(_0x9a03('0x1a'))[_0x9a03('0x1b')](socket);function respondWithStatusCode(_0x4b9c3b,_0x3943f2){_0x3943f2=_0x3943f2||0xcc;return function(_0x3cd547){if(_0x3cd547){return _0x4b9c3b[_0x9a03('0x1c')](_0x3943f2);}return _0x4b9c3b['status'](_0x3943f2)['end']();};}function respondWithResult(_0x41a0a0,_0x47261e){_0x47261e=_0x47261e||0xc8;return function(_0x245fed){if(_0x245fed){return _0x41a0a0[_0x9a03('0x1d')](_0x47261e)['json'](_0x245fed);}};}function respondWithFilteredResult(_0x460bc1,_0x47e18c){return function(_0x44e561){if(_0x44e561){var _0x5d4663=typeof _0x47e18c[_0x9a03('0x1e')]===_0x9a03('0x1f')&&typeof _0x47e18c[_0x9a03('0x20')]===_0x9a03('0x1f');var _0x932dbf=_0x44e561[_0x9a03('0x21')];var _0x1169c6=_0x5d4663?0x0:_0x47e18c[_0x9a03('0x1e')];var _0x2b1fb5=_0x5d4663?_0x44e561[_0x9a03('0x21')]:_0x47e18c[_0x9a03('0x1e')]+_0x47e18c['limit'];var _0x59d88b;if(_0x2b1fb5>=_0x932dbf){_0x2b1fb5=_0x932dbf;_0x59d88b=0xc8;}else{_0x59d88b=0xce;}_0x460bc1[_0x9a03('0x1d')](_0x59d88b);return _0x460bc1[_0x9a03('0x22')]('Content-Range',_0x1169c6+'-'+_0x2b1fb5+'/'+_0x932dbf)[_0x9a03('0x23')](_0x44e561);}return null;};}function patchUpdates(_0x273b66){return function(_0x5c158b){try{jsonpatch[_0x9a03('0x24')](_0x5c158b,_0x273b66,!![]);}catch(_0x1f90f0){return BPromise[_0x9a03('0x25')](_0x1f90f0);}return _0x5c158b[_0x9a03('0x26')]();};}function saveUpdates(_0x3e757e,_0x1371ed){return function(_0x3e789d){if(_0x3e789d){return _0x3e789d[_0x9a03('0x27')](_0x3e757e)[_0x9a03('0x28')](function(_0x2692cd){return _0x2692cd;});}return null;};}function removeEntity(_0x49e16d,_0xba1665){return function(_0x1c8675){if(_0x1c8675){return _0x1c8675[_0x9a03('0x29')]()['then'](function(){_0x49e16d[_0x9a03('0x1d')](0xcc)[_0x9a03('0x2a')]();});}};}function handleEntityNotFound(_0x2bb90c,_0x5a6564){return function(_0x80e1db){if(!_0x80e1db){_0x2bb90c[_0x9a03('0x1c')](0x194);}return _0x80e1db;};}function handleError(_0x185678,_0x34ba28){_0x34ba28=_0x34ba28||0x1f4;return function(_0x41d76e){logger[_0x9a03('0x2b')](_0x41d76e['stack']);if(_0x41d76e['name']){delete _0x41d76e[_0x9a03('0x2c')];}_0x185678[_0x9a03('0x1d')](_0x34ba28)['send'](_0x41d76e);};}exports[_0x9a03('0x2d')]=function(_0x4a5a7b,_0x236991){var _0x419024={},_0x405173={},_0x52e53f={'count':0x0,'rows':[]};var _0x53912f=_[_0x9a03('0x2e')](db['UserProfile'][_0x9a03('0x2f')],function(_0x35ad97){return{'name':_0x35ad97[_0x9a03('0x30')],'type':_0x35ad97['type'][_0x9a03('0x31')]};});_0x405173[_0x9a03('0x32')]=_[_0x9a03('0x2e')](_0x53912f,'name');_0x405173[_0x9a03('0x33')]=_['keys'](_0x4a5a7b[_0x9a03('0x33')]);_0x405173[_0x9a03('0x34')]=_[_0x9a03('0x35')](_0x405173[_0x9a03('0x32')],_0x405173[_0x9a03('0x33')]);_0x419024['attributes']=_[_0x9a03('0x35')](_0x405173[_0x9a03('0x32')],qs['fields'](_0x4a5a7b[_0x9a03('0x33')][_0x9a03('0x36')]));_0x419024[_0x9a03('0x37')]=_0x419024[_0x9a03('0x37')][_0x9a03('0x38')]?_0x419024[_0x9a03('0x37')]:_0x405173[_0x9a03('0x32')];if(!_0x4a5a7b[_0x9a03('0x33')][_0x9a03('0x39')](_0x9a03('0x3a'))){_0x419024[_0x9a03('0x20')]=qs[_0x9a03('0x20')](_0x4a5a7b[_0x9a03('0x33')][_0x9a03('0x20')]);_0x419024['offset']=qs[_0x9a03('0x1e')](_0x4a5a7b[_0x9a03('0x33')]['offset']);}_0x419024['order']=qs[_0x9a03('0x3b')](_0x4a5a7b[_0x9a03('0x33')]['sort']);_0x419024['where']=qs[_0x9a03('0x34')](_[_0x9a03('0x3c')](_0x4a5a7b[_0x9a03('0x33')],_0x405173[_0x9a03('0x34')]),_0x53912f);if(_0x4a5a7b[_0x9a03('0x33')]['filter']){_0x419024[_0x9a03('0x3d')]=_['merge'](_0x419024['where'],{'$or':_[_0x9a03('0x2e')](_0x53912f,function(_0x41ba6c){if(_0x41ba6c[_0x9a03('0x3e')]!==_0x9a03('0x3f')){var _0x484289={};_0x484289[_0x41ba6c['name']]={'$like':'%'+_0x4a5a7b[_0x9a03('0x33')]['filter']+'%'};return _0x484289;}})});}_0x419024=_[_0x9a03('0x40')]({},_0x419024,_0x4a5a7b[_0x9a03('0x41')]);var _0xbbd503={'where':_0x419024['where']};return db[_0x9a03('0x42')][_0x9a03('0x21')](_0xbbd503)['then'](function(_0x3f0576){_0x52e53f['count']=_0x3f0576;if(_0x4a5a7b[_0x9a03('0x33')][_0x9a03('0x43')]){_0x419024[_0x9a03('0x44')]=[{'all':!![]}];}return db[_0x9a03('0x42')][_0x9a03('0x45')](_0x419024);})[_0x9a03('0x28')](function(_0x556e33){_0x52e53f[_0x9a03('0x46')]=_0x556e33;return _0x52e53f;})[_0x9a03('0x28')](respondWithFilteredResult(_0x236991,_0x419024))[_0x9a03('0x47')](handleError(_0x236991,null));};exports[_0x9a03('0x48')]=function(_0x30bd34,_0x3778a4){var _0x4d39d8={'raw':![],'where':{'id':_0x30bd34[_0x9a03('0x49')]['id']}},_0x57dfd1={};_0x57dfd1[_0x9a03('0x32')]=_[_0x9a03('0x4a')](db['UserProfile'][_0x9a03('0x2f')]);_0x57dfd1['query']=_[_0x9a03('0x4a')](_0x30bd34[_0x9a03('0x33')]);_0x57dfd1[_0x9a03('0x34')]=_[_0x9a03('0x35')](_0x57dfd1[_0x9a03('0x32')],_0x57dfd1[_0x9a03('0x33')]);_0x4d39d8[_0x9a03('0x37')]=_[_0x9a03('0x35')](_0x57dfd1[_0x9a03('0x32')],qs['fields'](_0x30bd34[_0x9a03('0x33')][_0x9a03('0x36')]));_0x4d39d8['attributes']=_0x4d39d8[_0x9a03('0x37')]['length']?_0x4d39d8[_0x9a03('0x37')]:_0x57dfd1[_0x9a03('0x32')];if(_0x30bd34[_0x9a03('0x33')]['includeAll']){_0x4d39d8[_0x9a03('0x44')]=[{'all':!![]}];}_0x4d39d8=_['merge']({},_0x4d39d8,_0x30bd34[_0x9a03('0x41')]);return db[_0x9a03('0x42')][_0x9a03('0x4b')](_0x4d39d8)[_0x9a03('0x28')](handleEntityNotFound(_0x3778a4,null))[_0x9a03('0x28')](respondWithResult(_0x3778a4,null))[_0x9a03('0x47')](handleError(_0x3778a4,null));};exports[_0x9a03('0x4c')]=function(_0x23f00e,_0x3ebff8){return db[_0x9a03('0x42')][_0x9a03('0x4c')](_0x23f00e[_0x9a03('0x4d')],{})['then'](respondWithResult(_0x3ebff8,0xc9))[_0x9a03('0x47')](handleError(_0x3ebff8,null));};exports[_0x9a03('0x4e')]=function(_0x5b73b8,_0x3c336f){var _0x33e55d={'where':{'id':_0x5b73b8[_0x9a03('0x49')]['id']}},_0x26b426={};_0x26b426[_0x9a03('0x32')]=_[_0x9a03('0x4a')](db[_0x9a03('0x42')][_0x9a03('0x2f')]);_0x33e55d['attributes']=_[_0x9a03('0x35')](_0x26b426[_0x9a03('0x32')],qs[_0x9a03('0x36')](_0x5b73b8[_0x9a03('0x33')][_0x9a03('0x36')]));_0x33e55d[_0x9a03('0x37')]=_0x33e55d[_0x9a03('0x37')][_0x9a03('0x38')]?_0x33e55d[_0x9a03('0x37')]:_0x26b426['model'];if(_0x5b73b8[_0x9a03('0x33')][_0x9a03('0x43')]){_0x33e55d[_0x9a03('0x44')]=[{'all':!![]}];}_0x33e55d=_['merge']({},_0x33e55d,_0x5b73b8['options']);return db[_0x9a03('0x42')][_0x9a03('0x4b')](_0x33e55d)[_0x9a03('0x28')](handleEntityNotFound(_0x3c336f,null))[_0x9a03('0x28')](function(_0x4201d0){if(_0x4201d0){var _0xcaa95c=_0x4201d0['get']({'plain':!![]});_0xcaa95c=qs['omit'](_0xcaa95c,['id',_0x9a03('0x4f'),_0x9a03('0x50'),_0x9a03('0x51')]);_0x5b73b8['body']=_[_0x9a03('0x52')](_0x5b73b8[_0x9a03('0x4d')],['id','createdAt',_0x9a03('0x50')]);return db[_0x9a03('0x53')][_0x9a03('0x54')](function(_0xb8eff7){return db[_0x9a03('0x42')][_0x9a03('0x4c')](_['merge'](_0xcaa95c,_0x5b73b8[_0x9a03('0x4d')]),{'include':_0x5b73b8['query'][_0x9a03('0x43')]?[{'all':!![]}]:undefined,'transaction':_0xb8eff7})[_0x9a03('0x28')](function(_0x23af2a){var _0x214897=_0x23af2a['get']({'plain':!![]});return db['UserProfileSection'][_0x9a03('0x45')]({'where':{'userProfileId':_0x5b73b8[_0x9a03('0x49')]['id']},'raw':!![]})[_0x9a03('0x28')](function(_0x133800){if(_0x133800){return BPromise[_0x9a03('0x55')](_0x133800,function(_0x528fc9){return new BPromise(function(_0x4bcbb4,_0x2be3c1){if(_0x528fc9[_0x9a03('0x56')]===null||_0x528fc9[_0x9a03('0x56')]===0x1)_0x4bcbb4(null);return db[_0x9a03('0x57')][_0x9a03('0x45')]({'where':{'sectionId':_0x528fc9['id']},'raw':!![]})[_0x9a03('0x28')](function(_0x9b89f4){var _0x162ed2=_['map'](_0x9b89f4,function(_0x33f029){return qs[_0x9a03('0x52')](_0x33f029,['id','createdAt',_0x9a03('0x50'),_0x9a03('0x58')]);});_0x4bcbb4(_0x162ed2);})[_0x9a03('0x47')](function(_0x17a7be){_0x2be3c1(_0x17a7be);});})[_0x9a03('0x28')](function(_0x165cee){var _0x5a2815=qs[_0x9a03('0x52')](_0x528fc9,['id',_0x9a03('0x4f'),_0x9a03('0x50')]);_0x5a2815[_0x9a03('0x59')]=_0x214897['id'];if(_0x165cee)_0x5a2815[_0x9a03('0x5a')]=_0x165cee;return _0x5a2815;})[_0x9a03('0x28')](function(_0xb9e510){return db['UserProfileSection'][_0x9a03('0x4c')](_0xb9e510,{'include':[{'model':db[_0x9a03('0x57')],'as':_0x9a03('0x5a')}],'raw':!![],'transaction':_0xb8eff7});});})[_0x9a03('0x28')](function(){return _0x214897;});}});});});}})['then'](respondWithResult(_0x3c336f,0xc9))[_0x9a03('0x47')](handleError(_0x3c336f,null));};exports[_0x9a03('0x27')]=function(_0x4cf6df,_0x7c43d8){if(_0x4cf6df['body']['id']){delete _0x4cf6df[_0x9a03('0x4d')]['id'];}return db[_0x9a03('0x42')][_0x9a03('0x4b')]({'where':{'id':_0x4cf6df['params']['id']}})[_0x9a03('0x28')](handleEntityNotFound(_0x7c43d8,null))[_0x9a03('0x28')](saveUpdates(_0x4cf6df[_0x9a03('0x4d')],null))[_0x9a03('0x28')](respondWithResult(_0x7c43d8,null))[_0x9a03('0x47')](handleError(_0x7c43d8,null));};exports[_0x9a03('0x29')]=function(_0x56ce6,_0x435b8f){return db[_0x9a03('0x42')][_0x9a03('0x4b')]({'where':{'id':_0x56ce6[_0x9a03('0x49')]['id']}})[_0x9a03('0x28')](handleEntityNotFound(_0x435b8f,null))[_0x9a03('0x28')](removeEntity(_0x435b8f,null))[_0x9a03('0x47')](handleError(_0x435b8f,null));};exports[_0x9a03('0x5b')]=function(_0x4b200f,_0x573293){return db[_0x9a03('0x42')][_0x9a03('0x5b')]()[_0x9a03('0x28')](respondWithResult(_0x573293,null))[_0x9a03('0x47')](handleError(_0x573293,null));};exports[_0x9a03('0x5c')]=function(_0x575341,_0x1c3381){var _0x9e2524=_0x575341[_0x9a03('0x4d')];return db[_0x9a03('0x42')][_0x9a03('0x4b')]({'where':{'id':_0x575341[_0x9a03('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c3381,null))[_0x9a03('0x28')](function(_0x333b6b){if(_0x333b6b){return db['sequelize']['transaction'](function(_0x189988){return db[_0x9a03('0x5d')]['destroy']({'where':{'userProfileId':_0x575341[_0x9a03('0x49')]['id'],'sectionId':_[_0x9a03('0x2e')](_0x9e2524,function(_0x2e37a4){return _0x2e37a4[_0x9a03('0x58')];})},'transaction':_0x189988})[_0x9a03('0x28')](function(){var _0x513d78=_[_0x9a03('0x2e')](_0x9e2524,function(_0x14f43e){_0x14f43e[_0x9a03('0x59')]=_0x575341['params']['id'];return _0x14f43e;});var _0x69f3f9=[];return BPromise[_0x9a03('0x55')](_0x513d78,function(_0x16aaa8){return db[_0x9a03('0x5d')]['create'](_0x16aaa8,{'include':[{'model':db[_0x9a03('0x57')],'as':_0x9a03('0x5a')}],'raw':!![],'transaction':_0x189988})[_0x9a03('0x28')](function(_0x1753fd){_0x69f3f9['push'](_0x1753fd['get']({'plain':!![]}));});})['then'](function(){return _0x69f3f9;});});});}})[_0x9a03('0x28')](function(_0x499bc1){return _0x499bc1;})[_0x9a03('0x28')](respondWithResult(_0x1c3381,null))[_0x9a03('0x47')](handleError(_0x1c3381,null));};exports[_0x9a03('0x5e')]=function(_0x1da6ac,_0x4992a5){var _0x420ba9;return db['UserProfile'][_0x9a03('0x4b')]({'where':{'id':_0x1da6ac[_0x9a03('0x49')]['id']},'attributes':['id',_0x9a03('0x2c')]})[_0x9a03('0x28')](handleEntityNotFound(_0x4992a5,null))['then'](function(_0x5a6989){if(_0x5a6989){_0x420ba9=_0x5a6989;return db['UserProfileSection'][_0x9a03('0x29')]({'where':{'userProfileId':_0x1da6ac[_0x9a03('0x49')]['id'],'sectionId':_0x1da6ac[_0x9a03('0x33')][_0x9a03('0x5f')]}});}})['then'](function(){return _0x420ba9;})['then'](respondWithStatusCode(_0x4992a5,null))[_0x9a03('0x47')](handleError(_0x4992a5,null));};exports['getSections']=function(_0x2aae87,_0x46cb82){var _0xfe60a4=[];var _0x8fe5be=[];return db[_0x9a03('0x5d')][_0x9a03('0x45')]({'where':{'userProfileId':_0x2aae87[_0x9a03('0x49')]['id']},'raw':!![]})['then'](function(_0x113a13){_0xfe60a4=_[_0x9a03('0x60')](_0x113a13,function(_0x4b448f){return _0x4b448f[_0x9a03('0x61')]===0x1||_[_0x9a03('0x62')]([0x3eb,0x709],_0x4b448f[_0x9a03('0x58')]);});if(!_[_0x9a03('0x63')](_0xfe60a4)){return _['map'](_0xfe60a4,function(_0x50aee5){return _0x50aee5[_0x9a03('0x58')];});}else{return;}})[_0x9a03('0x28')](function(_0x44504f){if(_0x44504f)_0x8fe5be=_0x44504f;if(_[_0x9a03('0x62')](_0x8fe5be,0x64)){var _0x2c1e78=_['find'](_0xfe60a4,{'sectionId':0x64});return hasDefaultDashboard(_0x2c1e78)['then'](function(_0x21e2d8){return _[_0x9a03('0x2e')](_0xfe60a4,function(_0x274831){if(_0x274831[_0x9a03('0x58')]===0x64){_0x274831[_0x9a03('0x64')]=_0x21e2d8;}return _0x274831;});});}else{return;}})[_0x9a03('0x28')](function(_0x4eb0e6){if(_0x4eb0e6)_0xfe60a4=_0x4eb0e6;if(_['includes'](_0x8fe5be,0x3eb)){var _0x45c802=_[_0x9a03('0x4b')](_0xfe60a4,{'sectionId':0x3eb});return getCustomDashboards(_0x45c802)[_0x9a03('0x28')](function(_0x475583){return _[_0x9a03('0x2e')](_0xfe60a4,function(_0x552aa4){if(_0x45c802[_0x9a03('0x61')]){if(_0x552aa4[_0x9a03('0x58')]===0x3eb){_0x552aa4[_0x9a03('0x64')]=_0x475583;}}else{if(_0x552aa4['sectionId']===0x64){if(!_0x552aa4[_0x9a03('0x64')]){_0x552aa4['subsections']=[];}_0x552aa4['subsections']=_0x552aa4[_0x9a03('0x64')][_0x9a03('0x65')](_0x475583);}}return _0x552aa4;});});}else{return;}})[_0x9a03('0x28')](function(_0x5971ad){if(_0x5971ad)_0xfe60a4=_0x5971ad;if(_[_0x9a03('0x62')](_0x8fe5be,0x709)){var _0x2d5ae5=_[_0x9a03('0x4b')](_0xfe60a4,{'sectionId':0x709});return getPlugins(_0x2d5ae5)[_0x9a03('0x28')](function(_0x52bc6a){if(_0x2d5ae5['enabled']){return _[_0x9a03('0x2e')](_0xfe60a4,function(_0x120f8f){if(_0x120f8f[_0x9a03('0x58')]===0x709){_0x120f8f[_0x9a03('0x64')]=_0x52bc6a;}return _0x120f8f;});}else{var _0x42fa3f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x52bc6a};var _0x5a09c3=_[_0x9a03('0x2e')](_0xfe60a4);_0x5a09c3[_0x9a03('0x66')](_0x42fa3f);return _0x5a09c3;}});}else{return;}})[_0x9a03('0x28')](function(_0x1236a3){if(_0x1236a3)_0xfe60a4=_0x1236a3;return _['filter'](_0xfe60a4,[_0x9a03('0x61'),0x1]);})[_0x9a03('0x28')](respondWithResult(_0x46cb82,null))[_0x9a03('0x47')](handleError(_0x46cb82,null));};function hasDefaultDashboard(_0x3745da){var _0x14340c=[0x65];return new BPromise(function(_0x3c5460,_0x158d6a){try{if(_0x3745da['autoAssociation']){_0x3c5460(_0x14340c);}else{return db[_0x9a03('0x57')][_0x9a03('0x67')]({'where':{'sectionId':_0x3745da['id']},'raw':!![]})['then'](function(_0x2cdecc){_0x2cdecc?_0x3c5460(_0x14340c):_0x3c5460();});}}catch(_0x1158d6){_0x158d6a(_0x1158d6);}});}function getCustomDashboards(_0x301fdd){var _0x1fc60f=[];return new BPromise(function(_0x35cfcb,_0x4c9054){try{if(_0x301fdd[_0x9a03('0x56')]){return db[_0x9a03('0x68')][_0x9a03('0x45')]({'raw':!![]})[_0x9a03('0x28')](function(_0x368699){_0x368699['forEach'](function(_0x13221b){_0x1fc60f[_0x9a03('0x66')](_0x13221b['id']+0x1869f);});_0x35cfcb(_0x1fc60f);});}else{return db[_0x9a03('0x57')][_0x9a03('0x45')]({'where':{'sectionId':_0x301fdd['id']},'raw':!![]})[_0x9a03('0x28')](function(_0x543758){_0x543758['forEach'](function(_0x362a4c){_0x1fc60f[_0x9a03('0x66')](_0x362a4c[_0x9a03('0x69')]+0x1869f);});_0x35cfcb(_0x1fc60f);});}}catch(_0x5f4392){_0x4c9054(_0x5f4392);}});}function getPlugins(_0x20fe3f){var _0x36bf62=[];return new BPromise(function(_0x3b7e13,_0x322771){try{if(_0x20fe3f['autoAssociation']){return db['Plugin'][_0x9a03('0x45')]({'raw':!![]})['then'](function(_0x464d60){_0x464d60[_0x9a03('0x6a')](function(_0xb5d6d5){_0x36bf62[_0x9a03('0x66')](_0xb5d6d5['id']+0x15b38);});_0x3b7e13(_0x36bf62);});}else{return db[_0x9a03('0x57')][_0x9a03('0x45')]({'where':{'sectionId':_0x20fe3f['id']},'raw':!![]})[_0x9a03('0x28')](function(_0xb5bca){_0xb5bca[_0x9a03('0x6a')](function(_0x242629){_0x36bf62['push'](_0x242629[_0x9a03('0x69')]+0x15b38);});_0x3b7e13(_0x36bf62);});}}catch(_0xb90888){_0x322771(_0xb90888);}});}exports[_0x9a03('0x6b')]=function(_0xeb7aee,_0x2c1192){return db[_0x9a03('0x42')][_0x9a03('0x4b')]({'where':{'id':_0xeb7aee[_0x9a03('0x49')]['id']}})[_0x9a03('0x28')](handleEntityNotFound(_0x2c1192,null))[_0x9a03('0x28')](function(_0x203391){if(_0x203391){return db['sequelize']['transaction'](function(_0x52920f){return db[_0x9a03('0x5d')]['findAll']({'where':{'userProfileId':_0xeb7aee[_0x9a03('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x9a03('0x28')](function(_0x583bdb){if(_0x583bdb){return db['UserProfileSection'][_0x9a03('0x29')]({'where':{'userProfileId':_0xeb7aee[_0x9a03('0x49')]['id'],'id':_[_0x9a03('0x2e')](_0x583bdb,function(_0x183c42){return _0x183c42['id'];})},'transaction':_0x52920f});}})['then'](function(_0x479a09){var _0xddc6cc=_[_0x9a03('0x2e')](_0xeb7aee['body'],function(_0x229cd8){_0x229cd8['userProfileId']=_0xeb7aee[_0x9a03('0x49')]['id'];return _0x229cd8;});return db[_0x9a03('0x5d')][_0x9a03('0x6c')](_0xddc6cc,{'raw':!![],'transaction':_0x52920f});})[_0x9a03('0x28')](function(_0x1d0869){var _0x28d3fa=_['filter'](_[_0x9a03('0x2e')](_0x1d0869,function(_0x16e269){return _0x16e269[_0x9a03('0x6d')]({'plain':!![]});}),{'includeAll':![]});if(_0x28d3fa){return db[_0x9a03('0x5d')][_0x9a03('0x45')]({'where':{'userProfileId':_0xeb7aee['params']['id'],'sectionId':_['map'](_0x28d3fa,function(_0x402b77){return _0x402b77[_0x9a03('0x58')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x9a03('0x28')](function(_0x56f21e){var _0x241f67=_[_0x9a03('0x2e')](_0xeb7aee[_0x9a03('0x4d')],function(_0x2956fc){_0x2956fc[_0x9a03('0x59')]=_0xeb7aee[_0x9a03('0x49')]['id'];return _0x2956fc;});return db[_0x9a03('0x57')]['bulkCreate'](_0x241f67,{'raw':!![],'transaction':_0x52920f});});}})[_0x9a03('0x47')](handleError(_0x2c1192,null));});}})['then'](function(_0x2d01df){var _0x37d3a9=_[_0x9a03('0x2e')](_0x2d01df,function(_0x59faf6){return _0x59faf6[_0x9a03('0x6d')]({'plain':!![]});});})[_0x9a03('0x28')](respondWithResult(_0x2c1192,null))[_0x9a03('0x47')](handleError(_0x2c1192,null));};exports['removeResources']=function(_0x3bb4f6,_0x429e3b,_0x33f148){return db[_0x9a03('0x42')][_0x9a03('0x4b')]({'where':{'id':_0x3bb4f6['params']['id']}})[_0x9a03('0x28')](handleEntityNotFound(_0x429e3b,null))[_0x9a03('0x28')](function(_0x401174){if(_0x401174){return _0x401174[_0x9a03('0x6e')](_0x3bb4f6[_0x9a03('0x33')][_0x9a03('0x5f')]);}})[_0x9a03('0x28')](respondWithStatusCode(_0x429e3b,null))['catch'](handleError(_0x429e3b,null));};exports[_0x9a03('0x6f')]=function(_0x4ca0a8,_0x297073){var _0x5c1eeb={};if(!_0x4ca0a8[_0x9a03('0x33')][_0x9a03('0x70')])throw new Error(_0x9a03('0x71'));if(!_0x4ca0a8[_0x9a03('0x33')][_0x9a03('0x39')](_0x9a03('0x3a'))){_0x5c1eeb[_0x9a03('0x20')]=qs['limit'](_0x4ca0a8[_0x9a03('0x33')][_0x9a03('0x20')]);_0x5c1eeb[_0x9a03('0x1e')]=qs[_0x9a03('0x1e')](_0x4ca0a8['query'][_0x9a03('0x1e')]);}return db['UserProfile'][_0x9a03('0x4b')]({'where':{'id':_0x4ca0a8[_0x9a03('0x49')]['id']}})[_0x9a03('0x28')](function(_0x22e69c){if(!_0x22e69c)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x4ca0a8['params']['id']);return db[_0x9a03('0x42')][_0x9a03('0x6f')](_0x4ca0a8);})['then'](respondWithFilteredResult(_0x297073,_0x5c1eeb))[_0x9a03('0x47')](handleError(_0x297073,null));}; \ No newline at end of file +var _0x1aea=['update','describe','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','options','includeAll','include','UserProfile','findAll','rows','catch','show','params','keys','create','body','clone','find','get','createdAt','updatedAt','crudPermissions','omit','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection'];(function(_0x275cce,_0x3c23fe){var _0x500901=function(_0x47099a){while(--_0x47099a){_0x275cce['push'](_0x275cce['shift']());}};_0x500901(++_0x3c23fe);}(_0x1aea,0x163));var _0xa1ae=function(_0x38782c,_0x5c9fef){_0x38782c=_0x38782c-0x0;var _0x3708bf=_0x1aea[_0x38782c];return _0x3708bf;};'use strict';var emlformat=require(_0xa1ae('0x0'));var rimraf=require(_0xa1ae('0x1'));var zipdir=require(_0xa1ae('0x2'));var jsonpatch=require(_0xa1ae('0x3'));var rp=require(_0xa1ae('0x4'));var moment=require('moment');var BPromise=require(_0xa1ae('0x5'));var Mustache=require(_0xa1ae('0x6'));var util=require('util');var path=require(_0xa1ae('0x7'));var sox=require(_0xa1ae('0x8'));var csv=require(_0xa1ae('0x9'));var ejs=require(_0xa1ae('0xa'));var fs=require('fs');var fs_extra=require(_0xa1ae('0xb'));var _=require(_0xa1ae('0xc'));var squel=require(_0xa1ae('0xd'));var crypto=require(_0xa1ae('0xe'));var jsforce=require(_0xa1ae('0xf'));var deskjs=require(_0xa1ae('0x10'));var toCsv=require(_0xa1ae('0x9'));var querystring=require(_0xa1ae('0x11'));var Papa=require(_0xa1ae('0x12'));var Redis=require(_0xa1ae('0x13'));var authService=require(_0xa1ae('0x14'));var qs=require(_0xa1ae('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1ae('0x16'))(_0xa1ae('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa1ae('0x18')]=_[_0xa1ae('0x19')](config[_0xa1ae('0x18')],{'host':_0xa1ae('0x1a'),'port':0x18eb});var socket=require(_0xa1ae('0x1b'))(new Redis(config[_0xa1ae('0x18')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x11577a,_0x78105d){_0x78105d=_0x78105d||0xcc;return function(_0xeeb568){if(_0xeeb568){return _0x11577a[_0xa1ae('0x1c')](_0x78105d);}return _0x11577a[_0xa1ae('0x1d')](_0x78105d)[_0xa1ae('0x1e')]();};}function respondWithResult(_0x40ad38,_0x19d10d){_0x19d10d=_0x19d10d||0xc8;return function(_0x172f3c){if(_0x172f3c){return _0x40ad38[_0xa1ae('0x1d')](_0x19d10d)['json'](_0x172f3c);}};}function respondWithFilteredResult(_0x599b3a,_0x2cbd12){return function(_0x261126){if(_0x261126){var _0x49d174=typeof _0x2cbd12['offset']===_0xa1ae('0x1f')&&typeof _0x2cbd12[_0xa1ae('0x20')]===_0xa1ae('0x1f');var _0x53b3e3=_0x261126[_0xa1ae('0x21')];var _0x45b051=_0x49d174?0x0:_0x2cbd12['offset'];var _0x446a98=_0x49d174?_0x261126['count']:_0x2cbd12[_0xa1ae('0x22')]+_0x2cbd12[_0xa1ae('0x20')];var _0x73342f;if(_0x446a98>=_0x53b3e3){_0x446a98=_0x53b3e3;_0x73342f=0xc8;}else{_0x73342f=0xce;}_0x599b3a[_0xa1ae('0x1d')](_0x73342f);return _0x599b3a['set'](_0xa1ae('0x23'),_0x45b051+'-'+_0x446a98+'/'+_0x53b3e3)['json'](_0x261126);}return null;};}function patchUpdates(_0x15a244){return function(_0x25c5ce){try{jsonpatch[_0xa1ae('0x24')](_0x25c5ce,_0x15a244,!![]);}catch(_0x22e724){return BPromise[_0xa1ae('0x25')](_0x22e724);}return _0x25c5ce[_0xa1ae('0x26')]();};}function saveUpdates(_0xa25fad,_0x5c8a24){return function(_0x5cfe0b){if(_0x5cfe0b){return _0x5cfe0b['update'](_0xa25fad)[_0xa1ae('0x27')](function(_0x213d0c){return _0x213d0c;});}return null;};}function removeEntity(_0x1dd9d5,_0x24f6ba){return function(_0x3c4d85){if(_0x3c4d85){return _0x3c4d85[_0xa1ae('0x28')]()['then'](function(){_0x1dd9d5[_0xa1ae('0x1d')](0xcc)[_0xa1ae('0x1e')]();});}};}function handleEntityNotFound(_0x13b96d,_0xabf979){return function(_0x12c217){if(!_0x12c217){_0x13b96d['sendStatus'](0x194);}return _0x12c217;};}function handleError(_0x1f890a,_0x1a6fd2){_0x1a6fd2=_0x1a6fd2||0x1f4;return function(_0xc180cc){logger[_0xa1ae('0x29')](_0xc180cc['stack']);if(_0xc180cc[_0xa1ae('0x2a')]){delete _0xc180cc['name'];}_0x1f890a[_0xa1ae('0x1d')](_0x1a6fd2)[_0xa1ae('0x2b')](_0xc180cc);};}exports[_0xa1ae('0x2c')]=function(_0x2becc4,_0x49bc2d){var _0x431e14={},_0x25c321={},_0x2dd300={'count':0x0,'rows':[]};var _0x52e19e=_[_0xa1ae('0x2d')](db['UserProfile'][_0xa1ae('0x2e')],function(_0x34f36b){return{'name':_0x34f36b['fieldName'],'type':_0x34f36b[_0xa1ae('0x2f')]['key']};});_0x25c321[_0xa1ae('0x30')]=_[_0xa1ae('0x2d')](_0x52e19e,'name');_0x25c321[_0xa1ae('0x31')]=_['keys'](_0x2becc4[_0xa1ae('0x31')]);_0x25c321[_0xa1ae('0x32')]=_[_0xa1ae('0x33')](_0x25c321[_0xa1ae('0x30')],_0x25c321[_0xa1ae('0x31')]);_0x431e14[_0xa1ae('0x34')]=_[_0xa1ae('0x33')](_0x25c321[_0xa1ae('0x30')],qs[_0xa1ae('0x35')](_0x2becc4['query'][_0xa1ae('0x35')]));_0x431e14['attributes']=_0x431e14[_0xa1ae('0x34')][_0xa1ae('0x36')]?_0x431e14[_0xa1ae('0x34')]:_0x25c321[_0xa1ae('0x30')];if(!_0x2becc4[_0xa1ae('0x31')][_0xa1ae('0x37')]('nolimit')){_0x431e14[_0xa1ae('0x20')]=qs[_0xa1ae('0x20')](_0x2becc4['query']['limit']);_0x431e14[_0xa1ae('0x22')]=qs[_0xa1ae('0x22')](_0x2becc4[_0xa1ae('0x31')][_0xa1ae('0x22')]);}_0x431e14[_0xa1ae('0x38')]=qs['sort'](_0x2becc4[_0xa1ae('0x31')]['sort']);_0x431e14[_0xa1ae('0x39')]=qs[_0xa1ae('0x32')](_[_0xa1ae('0x3a')](_0x2becc4[_0xa1ae('0x31')],_0x25c321['filters']),_0x52e19e);if(_0x2becc4[_0xa1ae('0x31')][_0xa1ae('0x3b')]){_0x431e14[_0xa1ae('0x39')]=_[_0xa1ae('0x3c')](_0x431e14[_0xa1ae('0x39')],{'$or':_[_0xa1ae('0x2d')](_0x52e19e,function(_0x1eae2b){if(_0x1eae2b[_0xa1ae('0x2f')]!=='VIRTUAL'){var _0x5a067e={};_0x5a067e[_0x1eae2b[_0xa1ae('0x2a')]]={'$like':'%'+_0x2becc4[_0xa1ae('0x31')]['filter']+'%'};return _0x5a067e;}})});}_0x431e14=_['merge']({},_0x431e14,_0x2becc4[_0xa1ae('0x3d')]);var _0x2e9d43={'where':_0x431e14[_0xa1ae('0x39')]};return db['UserProfile'][_0xa1ae('0x21')](_0x2e9d43)[_0xa1ae('0x27')](function(_0x5f0656){_0x2dd300[_0xa1ae('0x21')]=_0x5f0656;if(_0x2becc4[_0xa1ae('0x31')][_0xa1ae('0x3e')]){_0x431e14[_0xa1ae('0x3f')]=[{'all':!![]}];}return db[_0xa1ae('0x40')][_0xa1ae('0x41')](_0x431e14);})[_0xa1ae('0x27')](function(_0x4d263b){_0x2dd300[_0xa1ae('0x42')]=_0x4d263b;return _0x2dd300;})[_0xa1ae('0x27')](respondWithFilteredResult(_0x49bc2d,_0x431e14))[_0xa1ae('0x43')](handleError(_0x49bc2d,null));};exports[_0xa1ae('0x44')]=function(_0x51e37f,_0x5e2545){var _0x48cbad={'raw':![],'where':{'id':_0x51e37f[_0xa1ae('0x45')]['id']}},_0xeb5024={};_0xeb5024[_0xa1ae('0x30')]=_[_0xa1ae('0x46')](db[_0xa1ae('0x40')][_0xa1ae('0x2e')]);_0xeb5024[_0xa1ae('0x31')]=_[_0xa1ae('0x46')](_0x51e37f['query']);_0xeb5024[_0xa1ae('0x32')]=_[_0xa1ae('0x33')](_0xeb5024[_0xa1ae('0x30')],_0xeb5024[_0xa1ae('0x31')]);_0x48cbad[_0xa1ae('0x34')]=_['intersection'](_0xeb5024[_0xa1ae('0x30')],qs['fields'](_0x51e37f[_0xa1ae('0x31')][_0xa1ae('0x35')]));_0x48cbad[_0xa1ae('0x34')]=_0x48cbad[_0xa1ae('0x34')][_0xa1ae('0x36')]?_0x48cbad[_0xa1ae('0x34')]:_0xeb5024['model'];if(_0x51e37f['query']['includeAll']){_0x48cbad[_0xa1ae('0x3f')]=[{'all':!![]}];}_0x48cbad=_[_0xa1ae('0x3c')]({},_0x48cbad,_0x51e37f[_0xa1ae('0x3d')]);return db['UserProfile']['find'](_0x48cbad)[_0xa1ae('0x27')](handleEntityNotFound(_0x5e2545,null))[_0xa1ae('0x27')](respondWithResult(_0x5e2545,null))[_0xa1ae('0x43')](handleError(_0x5e2545,null));};exports[_0xa1ae('0x47')]=function(_0x2d40e7,_0x27ab08){return db[_0xa1ae('0x40')][_0xa1ae('0x47')](_0x2d40e7[_0xa1ae('0x48')],{})['then'](respondWithResult(_0x27ab08,0xc9))[_0xa1ae('0x43')](handleError(_0x27ab08,null));};exports[_0xa1ae('0x49')]=function(_0x10ced1,_0x2890f2){var _0x5b7c24={'where':{'id':_0x10ced1[_0xa1ae('0x45')]['id']}},_0x582763={};_0x582763[_0xa1ae('0x30')]=_['keys'](db['UserProfile']['rawAttributes']);_0x5b7c24[_0xa1ae('0x34')]=_[_0xa1ae('0x33')](_0x582763[_0xa1ae('0x30')],qs['fields'](_0x10ced1[_0xa1ae('0x31')][_0xa1ae('0x35')]));_0x5b7c24['attributes']=_0x5b7c24[_0xa1ae('0x34')][_0xa1ae('0x36')]?_0x5b7c24[_0xa1ae('0x34')]:_0x582763[_0xa1ae('0x30')];if(_0x10ced1[_0xa1ae('0x31')][_0xa1ae('0x3e')]){_0x5b7c24[_0xa1ae('0x3f')]=[{'all':!![]}];}_0x5b7c24=_['merge']({},_0x5b7c24,_0x10ced1[_0xa1ae('0x3d')]);return db[_0xa1ae('0x40')][_0xa1ae('0x4a')](_0x5b7c24)[_0xa1ae('0x27')](handleEntityNotFound(_0x2890f2,null))[_0xa1ae('0x27')](function(_0x25d6f7){if(_0x25d6f7){var _0x4d036b=_0x25d6f7[_0xa1ae('0x4b')]({'plain':!![]});_0x4d036b=qs['omit'](_0x4d036b,['id',_0xa1ae('0x4c'),_0xa1ae('0x4d'),_0xa1ae('0x4e')]);_0x10ced1[_0xa1ae('0x48')]=_[_0xa1ae('0x4f')](_0x10ced1['body'],['id','createdAt',_0xa1ae('0x4d')]);return db[_0xa1ae('0x50')][_0xa1ae('0x51')](function(_0x3c89d2){return db[_0xa1ae('0x40')][_0xa1ae('0x47')](_[_0xa1ae('0x3c')](_0x4d036b,_0x10ced1[_0xa1ae('0x48')]),{'include':_0x10ced1['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x3c89d2})[_0xa1ae('0x27')](function(_0x431a6d){var _0x26c0d8=_0x431a6d[_0xa1ae('0x4b')]({'plain':!![]});return db['UserProfileSection'][_0xa1ae('0x41')]({'where':{'userProfileId':_0x10ced1[_0xa1ae('0x45')]['id']},'raw':!![]})['then'](function(_0x13adb9){if(_0x13adb9){return BPromise[_0xa1ae('0x52')](_0x13adb9,function(_0x4f402f){return new BPromise(function(_0x26fc36,_0x36a87b){if(_0x4f402f['autoAssociation']===null||_0x4f402f[_0xa1ae('0x53')]===0x1)_0x26fc36(null);return db[_0xa1ae('0x54')][_0xa1ae('0x41')]({'where':{'sectionId':_0x4f402f['id']},'raw':!![]})[_0xa1ae('0x27')](function(_0x496eeb){var _0x5d9933=_[_0xa1ae('0x2d')](_0x496eeb,function(_0x258a29){return qs['omit'](_0x258a29,['id',_0xa1ae('0x4c'),_0xa1ae('0x4d'),_0xa1ae('0x55')]);});_0x26fc36(_0x5d9933);})[_0xa1ae('0x43')](function(_0x35a540){_0x36a87b(_0x35a540);});})[_0xa1ae('0x27')](function(_0x3a05c7){var _0x5c569d=qs['omit'](_0x4f402f,['id','createdAt','updatedAt']);_0x5c569d[_0xa1ae('0x56')]=_0x26c0d8['id'];if(_0x3a05c7)_0x5c569d[_0xa1ae('0x57')]=_0x3a05c7;return _0x5c569d;})[_0xa1ae('0x27')](function(_0x1441fd){return db[_0xa1ae('0x58')]['create'](_0x1441fd,{'include':[{'model':db[_0xa1ae('0x54')],'as':'Resources'}],'raw':!![],'transaction':_0x3c89d2});});})[_0xa1ae('0x27')](function(){return _0x26c0d8;});}});});});}})[_0xa1ae('0x27')](respondWithResult(_0x2890f2,0xc9))['catch'](handleError(_0x2890f2,null));};exports[_0xa1ae('0x59')]=function(_0x518078,_0x474767){if(_0x518078[_0xa1ae('0x48')]['id']){delete _0x518078[_0xa1ae('0x48')]['id'];}return db['UserProfile'][_0xa1ae('0x4a')]({'where':{'id':_0x518078[_0xa1ae('0x45')]['id']}})['then'](handleEntityNotFound(_0x474767,null))[_0xa1ae('0x27')](saveUpdates(_0x518078[_0xa1ae('0x48')],null))[_0xa1ae('0x27')](respondWithResult(_0x474767,null))[_0xa1ae('0x43')](handleError(_0x474767,null));};exports[_0xa1ae('0x28')]=function(_0x43fb50,_0x405cfb){return db['UserProfile'][_0xa1ae('0x4a')]({'where':{'id':_0x43fb50[_0xa1ae('0x45')]['id']}})['then'](handleEntityNotFound(_0x405cfb,null))['then'](removeEntity(_0x405cfb,null))['catch'](handleError(_0x405cfb,null));};exports[_0xa1ae('0x5a')]=function(_0x17697f,_0x4559e5){return db[_0xa1ae('0x40')][_0xa1ae('0x5a')]()['then'](respondWithResult(_0x4559e5,null))['catch'](handleError(_0x4559e5,null));};exports['addSections']=function(_0x44225f,_0x269444){var _0x51e89f=_0x44225f[_0xa1ae('0x48')];return db[_0xa1ae('0x40')]['find']({'where':{'id':_0x44225f[_0xa1ae('0x45')]['id']}})['then'](handleEntityNotFound(_0x269444,null))[_0xa1ae('0x27')](function(_0x39e4c9){if(_0x39e4c9){return db[_0xa1ae('0x50')][_0xa1ae('0x51')](function(_0x209651){return db['UserProfileSection'][_0xa1ae('0x28')]({'where':{'userProfileId':_0x44225f['params']['id'],'sectionId':_['map'](_0x51e89f,function(_0x42566b){return _0x42566b[_0xa1ae('0x55')];})},'transaction':_0x209651})[_0xa1ae('0x27')](function(){var _0x241454=_[_0xa1ae('0x2d')](_0x51e89f,function(_0x4750f6){_0x4750f6[_0xa1ae('0x56')]=_0x44225f[_0xa1ae('0x45')]['id'];return _0x4750f6;});var _0x1d6fce=[];return BPromise[_0xa1ae('0x52')](_0x241454,function(_0x343243){return db[_0xa1ae('0x58')]['create'](_0x343243,{'include':[{'model':db[_0xa1ae('0x54')],'as':_0xa1ae('0x57')}],'raw':!![],'transaction':_0x209651})[_0xa1ae('0x27')](function(_0x20b703){_0x1d6fce[_0xa1ae('0x5b')](_0x20b703[_0xa1ae('0x4b')]({'plain':!![]}));});})[_0xa1ae('0x27')](function(){return _0x1d6fce;});});});}})['then'](function(_0x2a603d){return _0x2a603d;})[_0xa1ae('0x27')](respondWithResult(_0x269444,null))['catch'](handleError(_0x269444,null));};exports[_0xa1ae('0x5c')]=function(_0x3b8037,_0x58ced1){var _0x111fd3;return db[_0xa1ae('0x40')][_0xa1ae('0x4a')]({'where':{'id':_0x3b8037[_0xa1ae('0x45')]['id']},'attributes':['id',_0xa1ae('0x2a')]})[_0xa1ae('0x27')](handleEntityNotFound(_0x58ced1,null))[_0xa1ae('0x27')](function(_0x12df35){if(_0x12df35){_0x111fd3=_0x12df35;return db[_0xa1ae('0x58')][_0xa1ae('0x28')]({'where':{'userProfileId':_0x3b8037[_0xa1ae('0x45')]['id'],'sectionId':_0x3b8037[_0xa1ae('0x31')][_0xa1ae('0x5d')]}});}})[_0xa1ae('0x27')](function(){return _0x111fd3;})['then'](respondWithStatusCode(_0x58ced1,null))[_0xa1ae('0x43')](handleError(_0x58ced1,null));};exports[_0xa1ae('0x5e')]=function(_0x1f78fc,_0x4c798f){var _0x41793d=[];var _0x3d4df8=[];return db[_0xa1ae('0x58')][_0xa1ae('0x41')]({'where':{'userProfileId':_0x1f78fc[_0xa1ae('0x45')]['id']},'raw':!![]})[_0xa1ae('0x27')](function(_0x1eda4e){_0x41793d=_['filter'](_0x1eda4e,function(_0x5421ea){return _0x5421ea[_0xa1ae('0x5f')]===0x1||_[_0xa1ae('0x60')]([0x3eb,0x709],_0x5421ea[_0xa1ae('0x55')]);});if(!_[_0xa1ae('0x61')](_0x41793d)){return _[_0xa1ae('0x2d')](_0x41793d,function(_0x45e43e){return _0x45e43e[_0xa1ae('0x55')];});}else{return;}})[_0xa1ae('0x27')](function(_0x295dd1){if(_0x295dd1)_0x3d4df8=_0x295dd1;if(_[_0xa1ae('0x60')](_0x3d4df8,0x64)){var _0x2687e6=_['find'](_0x41793d,{'sectionId':0x64});return hasDefaultDashboard(_0x2687e6)[_0xa1ae('0x27')](function(_0x513a98){return _[_0xa1ae('0x2d')](_0x41793d,function(_0x2a6080){if(_0x2a6080[_0xa1ae('0x55')]===0x64){_0x2a6080[_0xa1ae('0x62')]=_0x513a98;}return _0x2a6080;});});}else{return;}})['then'](function(_0x4fea62){if(_0x4fea62)_0x41793d=_0x4fea62;if(_[_0xa1ae('0x60')](_0x3d4df8,0x3eb)){var _0x6ade88=_[_0xa1ae('0x4a')](_0x41793d,{'sectionId':0x3eb});return getCustomDashboards(_0x6ade88)[_0xa1ae('0x27')](function(_0x180fa4){return _['map'](_0x41793d,function(_0x3d57be){if(_0x6ade88['enabled']){if(_0x3d57be[_0xa1ae('0x55')]===0x3eb){_0x3d57be[_0xa1ae('0x62')]=_0x180fa4;}}else{if(_0x3d57be[_0xa1ae('0x55')]===0x64){if(!_0x3d57be[_0xa1ae('0x62')]){_0x3d57be[_0xa1ae('0x62')]=[];}_0x3d57be['subsections']=_0x3d57be[_0xa1ae('0x62')][_0xa1ae('0x63')](_0x180fa4);}}return _0x3d57be;});});}else{return;}})[_0xa1ae('0x27')](function(_0x384cf3){if(_0x384cf3)_0x41793d=_0x384cf3;if(_['includes'](_0x3d4df8,0x709)){var _0x1c3362=_['find'](_0x41793d,{'sectionId':0x709});return getPlugins(_0x1c3362)[_0xa1ae('0x27')](function(_0x48ede8){if(_0x1c3362[_0xa1ae('0x5f')]){return _['map'](_0x41793d,function(_0x539cd6){if(_0x539cd6[_0xa1ae('0x55')]===0x709){_0x539cd6[_0xa1ae('0x62')]=_0x48ede8;}return _0x539cd6;});}else{var _0x5aa964={'sectionId':0x76c,'enabled':0x1,'subsections':_0x48ede8};var _0x2a3b79=_[_0xa1ae('0x2d')](_0x41793d);_0x2a3b79[_0xa1ae('0x5b')](_0x5aa964);return _0x2a3b79;}});}else{return;}})['then'](function(_0x4f1004){if(_0x4f1004)_0x41793d=_0x4f1004;return _[_0xa1ae('0x3b')](_0x41793d,['enabled',0x1]);})[_0xa1ae('0x27')](respondWithResult(_0x4c798f,null))['catch'](handleError(_0x4c798f,null));};function hasDefaultDashboard(_0x49de0d){var _0x447d9f=[0x65];return new BPromise(function(_0x53aed4,_0x52b9f5){try{if(_0x49de0d['autoAssociation']){_0x53aed4(_0x447d9f);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x49de0d['id']},'raw':!![]})[_0xa1ae('0x27')](function(_0x515e60){_0x515e60?_0x53aed4(_0x447d9f):_0x53aed4();});}}catch(_0x2c0e2c){_0x52b9f5(_0x2c0e2c);}});}function getCustomDashboards(_0x37b2ec){var _0x365213=[];return new BPromise(function(_0x55f204,_0x1044ff){try{if(_0x37b2ec['autoAssociation']){return db[_0xa1ae('0x64')][_0xa1ae('0x41')]({'raw':!![]})[_0xa1ae('0x27')](function(_0x4467db){_0x4467db['forEach'](function(_0x10f6e1){_0x365213['push'](_0x10f6e1['id']+0x1869f);});_0x55f204(_0x365213);});}else{return db[_0xa1ae('0x54')]['findAll']({'where':{'sectionId':_0x37b2ec['id']},'raw':!![]})[_0xa1ae('0x27')](function(_0x26f6b8){_0x26f6b8[_0xa1ae('0x65')](function(_0x2b8ebe){_0x365213[_0xa1ae('0x5b')](_0x2b8ebe['resourceId']+0x1869f);});_0x55f204(_0x365213);});}}catch(_0x362472){_0x1044ff(_0x362472);}});}function getPlugins(_0x35490e){var _0x5cd227=[];return new BPromise(function(_0x251d3a,_0x12047b){try{if(_0x35490e[_0xa1ae('0x53')]){return db[_0xa1ae('0x66')][_0xa1ae('0x41')]({'raw':!![]})[_0xa1ae('0x27')](function(_0x1e6f53){_0x1e6f53[_0xa1ae('0x65')](function(_0x13e86a){_0x5cd227[_0xa1ae('0x5b')](_0x13e86a['id']+0x15b38);});_0x251d3a(_0x5cd227);});}else{return db[_0xa1ae('0x54')][_0xa1ae('0x41')]({'where':{'sectionId':_0x35490e['id']},'raw':!![]})[_0xa1ae('0x27')](function(_0x46cb96){_0x46cb96[_0xa1ae('0x65')](function(_0x16b5fe){_0x5cd227[_0xa1ae('0x5b')](_0x16b5fe[_0xa1ae('0x67')]+0x15b38);});_0x251d3a(_0x5cd227);});}}catch(_0x2a7b36){_0x12047b(_0x2a7b36);}});}exports[_0xa1ae('0x68')]=function(_0x1f842c,_0x4f2565){return db['UserProfile'][_0xa1ae('0x4a')]({'where':{'id':_0x1f842c[_0xa1ae('0x45')]['id']}})[_0xa1ae('0x27')](handleEntityNotFound(_0x4f2565,null))[_0xa1ae('0x27')](function(_0x2b38ed){if(_0x2b38ed){return db[_0xa1ae('0x50')][_0xa1ae('0x51')](function(_0x205fa3){return db[_0xa1ae('0x58')][_0xa1ae('0x41')]({'where':{'userProfileId':_0x1f842c[_0xa1ae('0x45')]['id']},'attributes':['id'],'raw':!![]})[_0xa1ae('0x27')](function(_0x8d2b5e){if(_0x8d2b5e){return db['UserProfileSection'][_0xa1ae('0x28')]({'where':{'userProfileId':_0x1f842c['params']['id'],'id':_['map'](_0x8d2b5e,function(_0x1835b2){return _0x1835b2['id'];})},'transaction':_0x205fa3});}})['then'](function(_0x10eac7){var _0xcb14b2=_['map'](_0x1f842c['body'],function(_0x2e0208){_0x2e0208[_0xa1ae('0x56')]=_0x1f842c[_0xa1ae('0x45')]['id'];return _0x2e0208;});return db['UserProfileSection'][_0xa1ae('0x69')](_0xcb14b2,{'raw':!![],'transaction':_0x205fa3});})['then'](function(_0x4db599){var _0x5975c1=_[_0xa1ae('0x3b')](_[_0xa1ae('0x2d')](_0x4db599,function(_0xd63881){return _0xd63881['get']({'plain':!![]});}),{'includeAll':![]});if(_0x5975c1){return db[_0xa1ae('0x58')][_0xa1ae('0x41')]({'where':{'userProfileId':_0x1f842c[_0xa1ae('0x45')]['id'],'sectionId':_[_0xa1ae('0x2d')](_0x5975c1,function(_0x4f9279){return _0x4f9279['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xa1ae('0x27')](function(_0x56b5fd){var _0x24ff37=_[_0xa1ae('0x2d')](_0x1f842c[_0xa1ae('0x48')],function(_0x508e8f){_0x508e8f[_0xa1ae('0x56')]=_0x1f842c[_0xa1ae('0x45')]['id'];return _0x508e8f;});return db[_0xa1ae('0x54')][_0xa1ae('0x69')](_0x24ff37,{'raw':!![],'transaction':_0x205fa3});});}})['catch'](handleError(_0x4f2565,null));});}})[_0xa1ae('0x27')](function(_0x6096dc){var _0x1f3e48=_['map'](_0x6096dc,function(_0x4bb3d1){return _0x4bb3d1[_0xa1ae('0x4b')]({'plain':!![]});});})['then'](respondWithResult(_0x4f2565,null))[_0xa1ae('0x43')](handleError(_0x4f2565,null));};exports[_0xa1ae('0x6a')]=function(_0x47da8f,_0x386719,_0xd5ab86){return db[_0xa1ae('0x40')][_0xa1ae('0x4a')]({'where':{'id':_0x47da8f[_0xa1ae('0x45')]['id']}})[_0xa1ae('0x27')](handleEntityNotFound(_0x386719,null))[_0xa1ae('0x27')](function(_0x501375){if(_0x501375){return _0x501375[_0xa1ae('0x6a')](_0x47da8f[_0xa1ae('0x31')][_0xa1ae('0x5d')]);}})[_0xa1ae('0x27')](respondWithStatusCode(_0x386719,null))[_0xa1ae('0x43')](handleError(_0x386719,null));};exports[_0xa1ae('0x6b')]=function(_0x368e1c,_0x2f042b){var _0x2f7913={};if(!_0x368e1c[_0xa1ae('0x31')][_0xa1ae('0x6c')])throw new Error(_0xa1ae('0x6d'));if(!_0x368e1c[_0xa1ae('0x31')][_0xa1ae('0x37')](_0xa1ae('0x6e'))){_0x2f7913['limit']=qs[_0xa1ae('0x20')](_0x368e1c[_0xa1ae('0x31')][_0xa1ae('0x20')]);_0x2f7913[_0xa1ae('0x22')]=qs['offset'](_0x368e1c[_0xa1ae('0x31')][_0xa1ae('0x22')]);}return db['UserProfile'][_0xa1ae('0x4a')]({'where':{'id':_0x368e1c[_0xa1ae('0x45')]['id']}})[_0xa1ae('0x27')](function(_0x30431b){if(!_0x30431b)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x368e1c['params']['id']);return db[_0xa1ae('0x40')]['getResources'](_0x368e1c);})[_0xa1ae('0x27')](respondWithFilteredResult(_0x2f042b,_0x2f7913))[_0xa1ae('0x43')](handleError(_0x2f042b,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 681f40e..89400f0 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 _0x68fd=['exports','events','UserProfile','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0x68fd,0x1e9));var _0xd68f=function(_0x275171,_0x18dc5f){_0x275171=_0x275171-0x0;var _0x548402=_0x68fd[_0x275171];return _0x548402;};'use strict';var EventEmitter=require(_0xd68f('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xd68f('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd68f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd68f('0x3'),'afterDestroy':_0xd68f('0x4')};function emitEvent(_0x96d959){return function(_0x3e5e78,_0x37c481,_0x9814cb){UserProfileEvents[_0xd68f('0x5')](_0x96d959+':'+_0x3e5e78['id'],_0x3e5e78);UserProfileEvents[_0xd68f('0x5')](_0x96d959,_0x3e5e78);_0x9814cb(null);};}for(var e in events){if(events[_0xd68f('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xd68f('0x7')]=UserProfileEvents; \ No newline at end of file +var _0xd9eb=['hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit'];(function(_0x19d182,_0x545160){var _0x1d2ac3=function(_0x1bf068){while(--_0x1bf068){_0x19d182['push'](_0x19d182['shift']());}};_0x1d2ac3(++_0x545160);}(_0xd9eb,0xca));var _0xbd9e=function(_0x30b710,_0x4477d1){_0x30b710=_0x30b710-0x0;var _0x205edf=_0xd9eb[_0x30b710];return _0x205edf;};'use strict';var EventEmitter=require(_0xbd9e('0x0'));var UserProfile=require(_0xbd9e('0x1'))['db'][_0xbd9e('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xbd9e('0x3')](0x0);var events={'afterCreate':_0xbd9e('0x4'),'afterUpdate':_0xbd9e('0x5'),'afterDestroy':_0xbd9e('0x6')};function emitEvent(_0x8d4b08){return function(_0x2b6174,_0x1df81b,_0x365865){UserProfileEvents[_0xbd9e('0x7')](_0x8d4b08+':'+_0x2b6174['id'],_0x2b6174);UserProfileEvents[_0xbd9e('0x7')](_0x8d4b08,_0x2b6174);_0x365865(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xbd9e('0x8')](e,emitEvent(event));}}module[_0xbd9e('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 45eb361..611b6c9 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 _0x7564=['triggers','Trigger','Trunk','variables','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','ui.','InteractionId','ui.createdAt','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','all','isEmpty','union','find','ignore','rawAttributes','keys','attributes','intersection','fields','hasOwnProperty','limit','offset','order','filters','pick','merge','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','include','openTabs','chat','sms','dataValues','fax','mail','openchannel','lodash','squel','exports','filter','field','value','then','catch','model','findAll','associatedResources','map','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','odbc','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','parentSections','ListId','CmList','CmCompany','CmCustomField','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','Agents','membername','User','agent','role','telephone','VoiceQueues','queue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','ZendeskAccount','SalesforceAccount','freshdeskaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Dashboard','Interval','Pause','scheduler','Schedule','Sound','tags','Tag','Template'];(function(_0x467b9a,_0x579afe){var _0xdc354d=function(_0x3da49b){while(--_0x3da49b){_0x467b9a['push'](_0x467b9a['shift']());}};_0xdc354d(++_0x579afe);}(_0x7564,0x1b0));var _0x4756=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x7564[_0x3826ad];return _0x17b900;};'use strict';var _=require(_0x4756('0x0'));var attributes=require('./userProfile.attributes');var squel=require(_0x4756('0x1'));module[_0x4756('0x2')]=function(_0x4b78ad){var _0x36a917=_0x4b78ad['models'];function _0x666241(_0x1cdf97,_0x43b990){return new Promise(function(_0x3b410f,_0x4ea198){if(!_0x43b990)return _0x3b410f(null);var _0x3d1896=_0x43b990['filter']?{[_0x43b990[_0x4756('0x3')][_0x4756('0x4')]]:_0x43b990['filter'][_0x4756('0x5')]}:undefined;return _0x36a917[_0x1cdf97]['findAll']({'where':_0x3d1896,'raw':!![]})[_0x4756('0x6')](function(_0x47ac3b){_0x43b990['associatedResources']=_['map'](_0x47ac3b,'id');_0x3b410f(_0x43b990);})[_0x4756('0x7')](function(_0x2c8010){_0x4ea198(_0x2c8010);});});}function _0x3eb98d(_0xd76855,_0x18f6ad){return new Promise(function(_0x17141c,_0x183a6b){var _0x4215e4=_0xd76855['filter']?{[_0xd76855[_0x4756('0x3')]['field']]:_0xd76855[_0x4756('0x3')]['value']}:undefined;return _0x36a917[_0xd76855[_0x4756('0x8')]][_0x4756('0x9')]({'where':_0x4215e4,'raw':!![]})[_0x4756('0x6')](function(_0x59a772){_0x18f6ad[_0x4756('0xa')]=_[_0x4756('0xb')](_0x59a772,function(_0x7cba35){return _0x7cba35[_0x4756('0xc')];});_0x17141c(_0x18f6ad);})[_0x4756('0x7')](function(_0x1207b7){_0x183a6b(_0x1207b7);});});}function _0x50a42f(_0x3ecb9f,_0x44d976,_0x521965){if(!_0x44d976)return Promise[_0x4756('0xd')](null);return new Promise(function(_0x1d51f0,_0x240f9d){return _0x36a917[_0x4756('0xe')]['findAll']({'where':{'sectionId':_0x44d976['id']},'raw':!![]})[_0x4756('0x6')](function(_0x4471bd){if(_0x3ecb9f[_0x4756('0x4')]&&_0x3ecb9f['field']!=='id'){_0x44d976[_0x4756('0xa')]=_[_0x4756('0xb')](_0x4471bd,function(_0x247fc6){return _0x247fc6[_0x3ecb9f['field']];});}else{if(_0x521965===_0x4756('0xf')){_0x44d976[_0x4756('0xa')]=_[_0x4756('0xb')](_0x4471bd,function(_0x44dd20){return{'id':_0x44dd20[_0x4756('0x10')],'type':_0x44dd20[_0x4756('0x11')]};});}else{_0x44d976[_0x4756('0xa')]=_[_0x4756('0xb')](_0x4471bd,function(_0x4d30de){return _0x4d30de[_0x4756('0x10')];});}}_0x1d51f0(_0x44d976);})[_0x4756('0x7')](function(_0x48e586){_0x240f9d(_0x48e586);});});}function _0x18dcf6(_0x193ac3,_0x3679c3){var _0x3abee5={'parentSections':[]};switch(_0x193ac3[_0x4756('0x12')]()){case _0x4756('0x13'):_0x3abee5[_0x4756('0x14')]='SquareProject';break;case _0x4756('0x15'):_0x3abee5[_0x4756('0x14')]='SquareOdbc';break;case'squarerecordings':_0x3abee5[_0x4756('0x14')]=_0x4756('0x16');_0x3abee5['parentSections']=[{'name':_0x4756('0x17'),'field':_0x4756('0xc'),'foreignKey':_0x4756('0x18')}];break;case _0x4756('0x19'):_0x3abee5[_0x4756('0x14')]=_0x4756('0x1a');break;case _0x4756('0x1b'):_0x3abee5[_0x4756('0x14')]=_0x4756('0x1c');_0x3abee5[_0x4756('0x1d')]=[{'name':'Lists','field':'id','foreignKey':_0x4756('0x1e')}];break;case'lists':_0x3abee5['childModel']=_0x4756('0x1f');break;case'companies':_0x3abee5[_0x4756('0x14')]=_0x4756('0x20');break;case'globalcustomfields':_0x3abee5[_0x4756('0x14')]=_0x4756('0x21');break;case'chatqueues':_0x3abee5['childModel']='ChatQueue';break;case'chatwebsites':_0x3abee5[_0x4756('0x14')]=_0x4756('0x22');break;case _0x4756('0x23'):_0x3abee5['childModel']=_0x4756('0x24');break;case _0x4756('0x25'):_0x3abee5[_0x4756('0x14')]=_0x4756('0x26');break;case _0x4756('0x27'):case _0x4756('0x28'):case'outboundroutes':_0x3abee5[_0x4756('0x14')]=_0x4756('0x29');break;case _0x4756('0x2a'):_0x3abee5[_0x4756('0x14')]=_0x4756('0x2b');break;case'voicemails':_0x3abee5[_0x4756('0x14')]=_0x4756('0x2c');break;case'voicerecordings':_0x3abee5[_0x4756('0x14')]='VoiceRecording';_0x3abee5['parentSections']=[{'name':_0x4756('0x2d'),'field':_0x4756('0xc'),'foreignKey':_0x4756('0x2e'),'model':_0x4756('0x2f'),'filter':{'field':'role','value':[_0x4756('0x30')]}},{'name':'Telephones','field':_0x4756('0xc'),'foreignKey':'membername','model':_0x4756('0x2f'),'filter':{'field':_0x4756('0x31'),'value':[_0x4756('0x32')]}},{'name':_0x4756('0x33'),'field':_0x4756('0xc'),'foreignKey':_0x4756('0x34'),'model':'VoiceQueue','filter':{'field':_0x4756('0x11'),'value':[_0x4756('0x35')]}},{'name':_0x4756('0x36'),'field':'name','foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x4756('0x11'),'value':[_0x4756('0x37')]}}];break;case _0x4756('0x38'):_0x3abee5[_0x4756('0x14')]=_0x4756('0x39');break;case _0x4756('0x3a'):_0x3abee5[_0x4756('0x14')]=_0x4756('0x3b');break;case _0x4756('0x3c'):_0x3abee5[_0x4756('0x14')]=_0x4756('0x3d');break;case'ivrcampaigns':_0x3abee5[_0x4756('0x14')]='Campaign';break;case'mailqueues':_0x3abee5[_0x4756('0x14')]='MailQueue';break;case _0x4756('0x3e'):_0x3abee5['childModel']='MailAccount';break;case _0x4756('0x3f'):_0x3abee5[_0x4756('0x14')]=_0x4756('0x40');break;case _0x4756('0x41'):_0x3abee5[_0x4756('0x14')]=_0x4756('0x42');break;case _0x4756('0x43'):_0x3abee5[_0x4756('0x14')]=_0x4756('0x44');break;case'smsqueues':_0x3abee5['childModel']=_0x4756('0x45');break;case _0x4756('0x46'):_0x3abee5[_0x4756('0x14')]='SmsAccount';break;case _0x4756('0x47'):_0x3abee5['childModel']=_0x4756('0x48');break;case _0x4756('0x49'):_0x3abee5[_0x4756('0x14')]=_0x4756('0x4a');break;case _0x4756('0x4b'):_0x3abee5['childModel']='Team';break;case _0x4756('0x4c'):case _0x4756('0x4d'):_0x3abee5['childModel']='VoiceQueue';if(_0x3679c3){_0x3abee5['parentSections']=[{'name':_0x4756('0x33')},{'name':_0x4756('0x36')}];}break;case _0x4756('0x4e'):case _0x4756('0x4f'):case _0x4756('0x50'):_0x3abee5[_0x4756('0x14')]=_0x4756('0x2f');if(_0x3679c3){_0x3abee5[_0x4756('0x1d')]=[{'name':_0x4756('0x51'),'filter':{'field':_0x4756('0x31'),'value':[_0x4756('0x52'),_0x4756('0x53')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x3abee5[_0x4756('0x14')]=_0x4756('0x54');break;case'salesforceaccounts':_0x3abee5[_0x4756('0x14')]=_0x4756('0x55');break;case _0x4756('0x56'):_0x3abee5[_0x4756('0x14')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x3abee5['childModel']=_0x4756('0x57');break;case _0x4756('0x58'):_0x3abee5[_0x4756('0x14')]=_0x4756('0x59');break;case _0x4756('0x5a'):_0x3abee5['childModel']=_0x4756('0x5b');break;case _0x4756('0x5c'):_0x3abee5['childModel']='User';break;case _0x4756('0x5d'):_0x3abee5['childModel']=_0x4756('0x5e');break;case _0x4756('0x5f'):_0x3abee5[_0x4756('0x14')]='Disposition';break;case'customdashboards':_0x3abee5[_0x4756('0x14')]=_0x4756('0x60');break;case'intervals':_0x3abee5[_0x4756('0x14')]=_0x4756('0x61');break;case'pauses':_0x3abee5[_0x4756('0x14')]=_0x4756('0x62');break;case _0x4756('0x63'):_0x3abee5['childModel']=_0x4756('0x64');break;case'sounds':_0x3abee5[_0x4756('0x14')]=_0x4756('0x65');break;case _0x4756('0x66'):_0x3abee5[_0x4756('0x14')]=_0x4756('0x67');break;case'templates':_0x3abee5[_0x4756('0x14')]=_0x4756('0x68');break;case _0x4756('0x69'):_0x3abee5[_0x4756('0x14')]=_0x4756('0x6a');break;case'trunks':_0x3abee5[_0x4756('0x14')]=_0x4756('0x6b');break;case _0x4756('0x6c'):_0x3abee5[_0x4756('0x14')]='Variable';break;case _0x4756('0x6d'):_0x3abee5[_0x4756('0x14')]=_0x4756('0x6e');break;case _0x4756('0x6f'):_0x3abee5[_0x4756('0x14')]=_0x4756('0xf');_0x3abee5[_0x4756('0x1d')]=[{'name':_0x4756('0x70'),'field':'id','foreignKey':_0x4756('0x71')}];break;case'metrics':_0x3abee5[_0x4756('0x14')]=_0x4756('0x72');break;}return _0x3abee5;}function _0x152a50(_0xecbd20,_0x4cfdad){var _0x59d012=_0xecbd20['charAt'](0x0)[_0x4756('0x73')]()+_0xecbd20[_0x4756('0x74')](0x1);var _0x1c1a60={'type':_0x36a917[_0x4756('0x75')][_0x4756('0x76')]['SELECT'],'raw':!![]};return new Promise(function(_0x3b39f7,_0x4fbbd4){var _0x2053db=squel['select']()[_0x4756('0x4')](_0x4756('0x77')+_0x59d012+_0x4756('0x78'),'id')[_0x4756('0x4')](_0x4756('0x79'))['from']('user_has_'+_0xecbd20+'_interactions','ui')[_0x4756('0x7a')](_0x4756('0x7b'),_0x4cfdad['id']);return _0x36a917[_0x4756('0x7c')][_0x4756('0x7d')](_0x2053db[_0x4756('0x7e')](),_0x1c1a60)[_0x4756('0x6')](function(_0x38d1ee){_0x4cfdad[_0x59d012+_0x4756('0x7f')]=_0x38d1ee;_0x3b39f7(_0x38d1ee);})[_0x4756('0x7')](function(_0x2ffb77){_0x4fbbd4(_0x2ffb77);});});}return _0x4b78ad[_0x4756('0x80')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x48c97f){var _0x380533=require(_0x4756('0x81'));var _0x162a6d={'raw':_0x48c97f['query'][_0x4756('0x82')],'where':{}};var _0x1e5fdc={};var _0xa2fd46={'count':0x0,'rows':[]};var _0x17d5a1=_0x48c97f[_0x4756('0x7d')][_0x4756('0x83')];var _0x12ebd7=_0x48c97f[_0x4756('0x7d')][_0x4756('0x84')]||![];var _0x19d3db=_0x18dcf6(_0x17d5a1,_0x12ebd7);if(!_0x19d3db[_0x4756('0x14')])throw new Error(_0x4756('0x85')+_0x17d5a1+'\x27');var _0x44563d=[{'name':_0x17d5a1}];if(!_['isEmpty'](_0x19d3db[_0x4756('0x1d')]))_0x44563d=_0x19d3db[_0x4756('0x1d')];var _0x4aa1ba=[];for(var _0x433437=0x0;_0x433437<_0x44563d[_0x4756('0x86')];_0x433437++){_0x4aa1ba[_0x4756('0x87')](_0x36a917['UserProfileSection']['find']({'where':{'userProfileId':_0x48c97f['params']['id'],'name':_0x44563d[_0x433437][_0x4756('0xc')]},'raw':!![]}));}return Promise[_0x4756('0x88')](_0x4aa1ba)[_0x4756('0x6')](function(_0x24920b){var _0x423a46=_['filter'](_0x24920b,function(_0x1a19f7){return _0x1a19f7?_0x1a19f7:undefined;});var _0x4af14f=_[_0x4756('0x3')](_0x44563d,['ignore',!![]]);var _0x4bb439=_['isEmpty'](_0x423a46)&&_[_0x4756('0x89')](_0x4af14f)?null:_[_0x4756('0x8a')](_0x4af14f,_0x423a46);if(!_0x4bb439)return null;var _0x39562c=[];for(var _0x605791=0x0;_0x605791<_0x4bb439['length'];_0x605791++){var _0x2bda45=_[_0x4756('0x8b')](_0x44563d,function(_0x42ddbd){return _0x4bb439[_0x605791]?_0x42ddbd[_0x4756('0xc')]===_0x4bb439[_0x605791][_0x4756('0xc')]:null;});if(_0x2bda45){if(_0x4bb439[_0x605791][_0x4756('0x8c')]){_0x39562c[_0x4756('0x87')](_0x666241(_0x19d3db['childModel'],_0x4bb439[_0x605791]));}else{if(!_0x4bb439[_0x605791]['autoAssociation']){_0x39562c['push'](_0x50a42f(_0x2bda45,_0x4bb439[_0x605791],_0x19d3db[_0x4756('0x14')]));}else{if(_0x2bda45[_0x4756('0x8')]){_0x39562c[_0x4756('0x87')](_0x3eb98d(_0x2bda45,_0x4bb439[_0x605791]));}}}}}return Promise[_0x4756('0x88')](_0x39562c);})['then'](function(_0x50248b){var _0x333ac0=_0x50248b;var _0x467cde=null;if(_0x333ac0){_0x467cde=_0x333ac0[_0x4756('0x86')]===0x1?_0x333ac0[0x0]:null;}if(!_0x467cde&&!_0x333ac0)return _0xa2fd46;var _0x66164d=_0x36a917[_0x19d3db[_0x4756('0x14')]][_0x4756('0x8d')];_0x1e5fdc[_0x4756('0x8')]=_[_0x4756('0x8e')](_0x66164d);_0x1e5fdc[_0x4756('0x7d')]=_['keys'](_0x48c97f[_0x4756('0x7d')]);_0x1e5fdc['filters']=_['intersection'](_0x1e5fdc[_0x4756('0x8')],_0x1e5fdc[_0x4756('0x7d')]);_0x162a6d[_0x4756('0x8f')]=_[_0x4756('0x90')](_0x1e5fdc[_0x4756('0x8')],_0x380533[_0x4756('0x91')](_0x48c97f[_0x4756('0x7d')]['fields']));_0x162a6d[_0x4756('0x8f')]=_0x162a6d[_0x4756('0x8f')]['length']?_0x162a6d[_0x4756('0x8f')]:_0x1e5fdc[_0x4756('0x8')];if(!_0x48c97f[_0x4756('0x7d')][_0x4756('0x92')]('nolimit')){_0x162a6d[_0x4756('0x93')]=_0x380533[_0x4756('0x93')](_0x48c97f[_0x4756('0x7d')][_0x4756('0x93')]);_0x162a6d[_0x4756('0x94')]=_0x380533[_0x4756('0x94')](_0x48c97f['query']['offset']);}_0x162a6d[_0x4756('0x95')]=_0x380533['sort'](_0x48c97f['query']['sort']);_0x162a6d[_0x4756('0x7a')]=_0x380533[_0x4756('0x96')](_[_0x4756('0x97')](_0x48c97f['query'],_0x1e5fdc['filters']));if(_0x48c97f[_0x4756('0x7d')][_0x4756('0x3')]){_0x162a6d['where']=_[_0x4756('0x98')](_0x162a6d[_0x4756('0x7a')],{'$or':_[_0x4756('0xb')](_0x66164d,function(_0x48f5d0){if(_0x48f5d0[_0x4756('0x11')]['key']!==_0x4756('0x99')){var _0x3f545b={};_0x3f545b[_0x48f5d0[_0x4756('0x4')]]={'$like':'%'+_0x48c97f[_0x4756('0x7d')][_0x4756('0x3')]+'%'};return _0x3f545b;}})});}var _0x42268a=[];var _0x1df3bd=null;var _0x2ebbe6={};if(_0x467cde){_0x1df3bd=_[_0x4756('0x8b')](_0x44563d,[_0x4756('0xc'),_0x467cde[_0x4756('0xc')]]);if(_0x1df3bd['field']){_0x2ebbe6={};if(_0x19d3db[_0x4756('0x14')]===_0x4756('0xf')){_0x2ebbe6[_0x1df3bd[_0x4756('0x9a')]]=_[_0x4756('0xb')](_0x467cde[_0x4756('0xa')],'id');}else{_0x2ebbe6[_0x1df3bd['foreignKey']]=_0x467cde['associatedResources'];}_0x42268a['push'](_0x2ebbe6);}else{_0x162a6d[_0x4756('0x7a')]['id']=_0x467cde[_0x4756('0xa')];}}else{for(var _0x8ca32f=0x0;_0x8ca32f<_0x333ac0['length'];_0x8ca32f++){_0x1df3bd=_['find'](_0x44563d,[_0x4756('0xc'),_0x333ac0[_0x8ca32f][_0x4756('0xc')]]);if(_0x1df3bd['field']){_0x2ebbe6={};_0x2ebbe6[_0x1df3bd['foreignKey']]=_0x333ac0[_0x8ca32f][_0x4756('0xa')];_0x42268a['push'](_0x2ebbe6);}else{if(!_0x162a6d[_0x4756('0x7a')]['id'])_0x162a6d[_0x4756('0x7a')]['id']=[];_0x333ac0[_0x8ca32f][_0x4756('0xa')][_0x4756('0x9b')](function(_0x597cb0){_0x162a6d[_0x4756('0x7a')]['id'][_0x4756('0x87')](_0x597cb0);});}}}if(!_[_0x4756('0x89')](_0x42268a)){_0x162a6d['where']=_[_0x4756('0x98')](_0x162a6d[_0x4756('0x7a')],{'$and':{'$or':_0x42268a}});}_0x162a6d=_[_0x4756('0x98')]({},_0x162a6d,_0x48c97f[_0x4756('0x9c')]);if(_0x467cde&&!_0x467cde[_0x4756('0x9d')]&&_0x19d3db['childModel']==='AnalyticExtractedReport'){if(_0x48c97f['query'][_0x4756('0x9e')]){_0x162a6d['include']=[{'all':!![]}];}return _0x36a917[_0x19d3db[_0x4756('0x14')]][_0x4756('0x9')](_0x162a6d)[_0x4756('0x6')](function(_0x13813c){var _0x141515=[];_0x13813c[_0x4756('0x9b')](function(_0xd0ddee){var _0x192428;switch(_0xd0ddee['reportType']){case _0x4756('0x9f'):_0x192428=_[_0x4756('0x8b')](_0x467cde['associatedResources'],function(_0x18d171){return _0x18d171['id']===_0xd0ddee[_0x4756('0x71')]&&_0x18d171[_0x4756('0x11')]===_0x4756('0xa0');});break;case _0x4756('0xa1'):_0x192428=_[_0x4756('0x8b')](_0x467cde[_0x4756('0xa')],function(_0x46b360){return _0x46b360['id']===_0xd0ddee['reportId']&&_0x46b360[_0x4756('0x11')]===_0x4756('0xa2');});break;}if(_0x192428)_0x141515['push'](_0xd0ddee);});_0xa2fd46[_0x4756('0xa3')]=_0x141515[_0x4756('0x86')];_0xa2fd46[_0x4756('0xa4')]=_0x141515;return _0xa2fd46;});}else{if(!_[_0x4756('0x89')](_0x48c97f[_0x4756('0x7d')]['ids'])){_0x162a6d[_0x4756('0x7a')]['id']=_0x162a6d['where']['id']?_[_0x4756('0x90')](_0x162a6d[_0x4756('0x7a')]['id'],_0x48c97f['query'][_0x4756('0xa5')]):_0x48c97f['query']['ids'];if(_0x48c97f[_0x4756('0x7d')][_0x4756('0xa6')]){_0x162a6d[_0x4756('0x95')]=_0x48c97f['query'][_0x4756('0xa6')];}}if(_0x48c97f['query'][_0x4756('0xa7')]){_0x162a6d[_0x4756('0x7a')]=_[_0x4756('0x98')](_0x162a6d[_0x4756('0x7a')],{'$and':_0x48c97f['query'][_0x4756('0xa7')]});}return _0x36a917[_0x19d3db[_0x4756('0x14')]][_0x4756('0xa3')]({'where':_0x162a6d[_0x4756('0x7a')]})['then'](function(_0x909dcb){_0xa2fd46[_0x4756('0xa3')]=_0x909dcb;if(_0x48c97f[_0x4756('0x7d')][_0x4756('0x9e')]){if(_0x19d3db[_0x4756('0x14')]===_0x4756('0x1c')){_0x162a6d['include']=[{'model':_0x36a917['Tag'],'as':_0x4756('0xa8'),'attributes':['id','name','color'],'required':_0x48c97f[_0x4756('0x7d')]['tag']?!![]:![]},{'model':_0x36a917[_0x4756('0x67')],'as':'ThroughTags','attributes':['id',_0x4756('0xc'),_0x4756('0xa9')],'through':_0x48c97f['query']['tag']?{'attributes':[],'where':{'TagId':_0x48c97f[_0x4756('0x7d')]['tag']||undefined}}:{},'required':_0x48c97f['query'][_0x4756('0xaa')]?!![]:![]}];}else{_0x162a6d[_0x4756('0xab')]=[{'all':!![]}];}}return _0x36a917[_0x19d3db[_0x4756('0x14')]][_0x4756('0x9')](_0x162a6d);})[_0x4756('0x6')](function(_0x37aafb){_0xa2fd46[_0x4756('0xa4')]=_0x37aafb;if(_0x17d5a1===_0x4756('0x2d')&&_0x48c97f['query'][_0x4756('0xac')]==='true'){var _0x296fe4=[];for(var _0x348bc9=0x0;_0x348bc9<_0xa2fd46[_0x4756('0xa4')]['length'];_0x348bc9++){_0x296fe4[_0x4756('0x87')](_0x152a50(_0x4756('0xad'),_0xa2fd46[_0x4756('0xa4')][_0x348bc9]['dataValues']));_0x296fe4[_0x4756('0x87')](_0x152a50(_0x4756('0xae'),_0xa2fd46['rows'][_0x348bc9][_0x4756('0xaf')]));_0x296fe4[_0x4756('0x87')](_0x152a50(_0x4756('0xb0'),_0xa2fd46[_0x4756('0xa4')][_0x348bc9][_0x4756('0xaf')]));_0x296fe4[_0x4756('0x87')](_0x152a50(_0x4756('0xb1'),_0xa2fd46['rows'][_0x348bc9][_0x4756('0xaf')]));_0x296fe4[_0x4756('0x87')](_0x152a50(_0x4756('0xb2'),_0xa2fd46[_0x4756('0xa4')][_0x348bc9][_0x4756('0xaf')]));_0x296fe4['push'](_0x152a50('whatsapp',_0xa2fd46[_0x4756('0xa4')][_0x348bc9][_0x4756('0xaf')]));}return Promise[_0x4756('0x88')](_0x296fe4)[_0x4756('0x6')](function(){return _0xa2fd46;});}return _0xa2fd46;});}});}}});}; \ No newline at end of file +var _0x9c7b=['SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','VoiceQueues','users','agents','Users','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Tag','templates','Template','triggers','Trigger','Trunk','variables','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','SELECT','InteractionId','ui.createdAt','from','where','ui.UserId\x20=\x20?','query','toString','define','UserProfile','user_profiles','../../components/parsers/qs','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','params','all','ignore','union','find','rawAttributes','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','forEach','autoAssociation','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','true','chat','sms','dataValues','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','findAll','then','associatedResources','map','value','model','name','catch','AnalyticExtractedReport','type','toLowerCase','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','projectName','projects','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','ChatWebsite','faxqueues','faxaccounts','FaxAccount','internalroutes','VoiceExtension','VoiceContext','VoiceMail','VoiceRecording','Agents','membername','User','Telephones','role','telephone','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9c7b,0x125));var _0xb9c7=function(_0x4ca283,_0x3c93e3){_0x4ca283=_0x4ca283-0x0;var _0x2eb188=_0x9c7b[_0x4ca283];return _0x2eb188;};'use strict';var _=require(_0xb9c7('0x0'));var attributes=require(_0xb9c7('0x1'));var squel=require(_0xb9c7('0x2'));module[_0xb9c7('0x3')]=function(_0x2a013f){var _0x263858=_0x2a013f[_0xb9c7('0x4')];function _0x599ee1(_0x3d3ab2,_0x427ebc){return new Promise(function(_0x35a1e8,_0x675b48){if(!_0x427ebc)return _0x35a1e8(null);var _0x4ca78a=_0x427ebc[_0xb9c7('0x5')]?{[_0x427ebc[_0xb9c7('0x5')][_0xb9c7('0x6')]]:_0x427ebc[_0xb9c7('0x5')]['value']}:undefined;return _0x263858[_0x3d3ab2][_0xb9c7('0x7')]({'where':_0x4ca78a,'raw':!![]})[_0xb9c7('0x8')](function(_0x5537d3){_0x427ebc[_0xb9c7('0x9')]=_[_0xb9c7('0xa')](_0x5537d3,'id');_0x35a1e8(_0x427ebc);})['catch'](function(_0x48500a){_0x675b48(_0x48500a);});});}function _0x5694e8(_0x48dea5,_0x5347ae){return new Promise(function(_0xdd90a4,_0x43a704){var _0x3d35e3=_0x48dea5[_0xb9c7('0x5')]?{[_0x48dea5[_0xb9c7('0x5')][_0xb9c7('0x6')]]:_0x48dea5['filter'][_0xb9c7('0xb')]}:undefined;return _0x263858[_0x48dea5[_0xb9c7('0xc')]]['findAll']({'where':_0x3d35e3,'raw':!![]})[_0xb9c7('0x8')](function(_0x2786ef){_0x5347ae[_0xb9c7('0x9')]=_['map'](_0x2786ef,function(_0x5dd307){return _0x5dd307[_0xb9c7('0xd')];});_0xdd90a4(_0x5347ae);})[_0xb9c7('0xe')](function(_0x2f02b5){_0x43a704(_0x2f02b5);});});}function _0x59fbe3(_0x62d86e,_0x3c7f45,_0x2f03d3){if(!_0x3c7f45)return Promise['resolve'](null);return new Promise(function(_0x23fcda,_0x5290f6){return _0x263858['UserProfileResource']['findAll']({'where':{'sectionId':_0x3c7f45['id']},'raw':!![]})[_0xb9c7('0x8')](function(_0x34c993){if(_0x62d86e[_0xb9c7('0x6')]&&_0x62d86e['field']!=='id'){_0x3c7f45['associatedResources']=_[_0xb9c7('0xa')](_0x34c993,function(_0x1de6c0){return _0x1de6c0[_0x62d86e['field']];});}else{if(_0x2f03d3===_0xb9c7('0xf')){_0x3c7f45['associatedResources']=_[_0xb9c7('0xa')](_0x34c993,function(_0x16425e){return{'id':_0x16425e['resourceId'],'type':_0x16425e[_0xb9c7('0x10')]};});}else{_0x3c7f45[_0xb9c7('0x9')]=_[_0xb9c7('0xa')](_0x34c993,function(_0x5cb494){return _0x5cb494['resourceId'];});}}_0x23fcda(_0x3c7f45);})[_0xb9c7('0xe')](function(_0x31edda){_0x5290f6(_0x31edda);});});}function _0x3b8ba9(_0x151b49,_0x57f717){var _0x2cf65f={'parentSections':[]};switch(_0x151b49[_0xb9c7('0x11')]()){case'squareprojects':_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x13');break;case _0xb9c7('0x14'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x15');break;case'squarerecordings':_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x16');_0x2cf65f[_0xb9c7('0x17')]=[{'name':'SquareProjects','field':_0xb9c7('0xd'),'foreignKey':_0xb9c7('0x18')}];break;case _0xb9c7('0x19'):_0x2cf65f['childModel']='JscriptyProject';break;case _0xb9c7('0x1a'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x1b');_0x2cf65f[_0xb9c7('0x17')]=[{'name':_0xb9c7('0x1c'),'field':'id','foreignKey':_0xb9c7('0x1d')}];break;case _0xb9c7('0x1e'):_0x2cf65f['childModel']=_0xb9c7('0x1f');break;case _0xb9c7('0x20'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x21');break;case _0xb9c7('0x22'):_0x2cf65f[_0xb9c7('0x12')]='CmCustomField';break;case _0xb9c7('0x23'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x24');break;case'chatwebsites':_0x2cf65f['childModel']=_0xb9c7('0x25');break;case _0xb9c7('0x26'):_0x2cf65f[_0xb9c7('0x12')]='FaxQueue';break;case _0xb9c7('0x27'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x28');break;case'inboundroutes':case _0xb9c7('0x29'):case'outboundroutes':_0x2cf65f['childModel']=_0xb9c7('0x2a');break;case'contexts':_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x2b');break;case'voicemails':_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x2c');break;case'voicerecordings':_0x2cf65f['childModel']=_0xb9c7('0x2d');_0x2cf65f[_0xb9c7('0x17')]=[{'name':_0xb9c7('0x2e'),'field':_0xb9c7('0xd'),'foreignKey':_0xb9c7('0x2f'),'model':_0xb9c7('0x30'),'filter':{'field':'role','value':['agent']}},{'name':_0xb9c7('0x31'),'field':'name','foreignKey':_0xb9c7('0x2f'),'model':'User','filter':{'field':_0xb9c7('0x32'),'value':[_0xb9c7('0x33')]}},{'name':'VoiceQueues','field':_0xb9c7('0xd'),'foreignKey':_0xb9c7('0x34'),'model':_0xb9c7('0x35'),'filter':{'field':'type','value':[_0xb9c7('0x36')]}},{'name':'QueueCampaigns','field':_0xb9c7('0xd'),'foreignKey':_0xb9c7('0x34'),'model':_0xb9c7('0x35'),'filter':{'field':'type','value':[_0xb9c7('0x37')]}}];break;case _0xb9c7('0x38'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x39');break;case _0xb9c7('0x3a'):_0x2cf65f[_0xb9c7('0x12')]='VoiceChanSpy';break;case'voiceprefixes':_0x2cf65f[_0xb9c7('0x12')]='VoicePrefix';break;case _0xb9c7('0x3b'):_0x2cf65f['childModel']=_0xb9c7('0x3c');break;case _0xb9c7('0x3d'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x3e');break;case _0xb9c7('0x3f'):_0x2cf65f[_0xb9c7('0x12')]='MailAccount';break;case _0xb9c7('0x40'):_0x2cf65f[_0xb9c7('0x12')]='MailSubstatus';break;case _0xb9c7('0x41'):_0x2cf65f['childModel']=_0xb9c7('0x42');break;case _0xb9c7('0x43'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x44');break;case'smsqueues':_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x45');break;case _0xb9c7('0x46'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x47');break;case _0xb9c7('0x48'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x49');break;case _0xb9c7('0x4a'):_0x2cf65f['childModel']=_0xb9c7('0x4b');break;case _0xb9c7('0x4c'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x4d');break;case _0xb9c7('0x4e'):case _0xb9c7('0x4f'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x35');if(_0x57f717){_0x2cf65f[_0xb9c7('0x17')]=[{'name':_0xb9c7('0x50')},{'name':'QueueCampaigns'}];}break;case _0xb9c7('0x51'):case _0xb9c7('0x52'):case'telephones':_0x2cf65f['childModel']=_0xb9c7('0x30');if(_0x57f717){_0x2cf65f[_0xb9c7('0x17')]=[{'name':_0xb9c7('0x53'),'filter':{'field':_0xb9c7('0x32'),'value':['admin','user']},'ignore':!![]},{'name':_0xb9c7('0x2e')},{'name':_0xb9c7('0x31')}];}break;case _0xb9c7('0x54'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x55');break;case _0xb9c7('0x56'):_0x2cf65f[_0xb9c7('0x12')]='SalesforceAccount';break;case _0xb9c7('0x57'):_0x2cf65f['childModel']=_0xb9c7('0x58');break;case _0xb9c7('0x59'):_0x2cf65f[_0xb9c7('0x12')]='SugarcrmAccount';break;case'deskaccounts':_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x5a');break;case _0xb9c7('0x5b'):_0x2cf65f['childModel']='ZohoAccount';break;case'vtigeraccounts':_0x2cf65f[_0xb9c7('0x12')]='User';break;case'cannedanswers':_0x2cf65f['childModel']=_0xb9c7('0x5c');break;case _0xb9c7('0x5d'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x5e');break;case _0xb9c7('0x5f'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x60');break;case _0xb9c7('0x61'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x62');break;case _0xb9c7('0x63'):_0x2cf65f[_0xb9c7('0x12')]='Pause';break;case _0xb9c7('0x64'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x65');break;case _0xb9c7('0x66'):_0x2cf65f[_0xb9c7('0x12')]='Sound';break;case'tags':_0x2cf65f['childModel']=_0xb9c7('0x67');break;case _0xb9c7('0x68'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x69');break;case _0xb9c7('0x6a'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x6b');break;case'trunks':_0x2cf65f['childModel']=_0xb9c7('0x6c');break;case _0xb9c7('0x6d'):_0x2cf65f['childModel']='Variable';break;case'plugins':_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x6e');break;case _0xb9c7('0x6f'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0xf');_0x2cf65f[_0xb9c7('0x17')]=[{'name':_0xb9c7('0x70'),'field':'id','foreignKey':_0xb9c7('0x71')}];break;case _0xb9c7('0x72'):_0x2cf65f[_0xb9c7('0x12')]=_0xb9c7('0x73');break;}return _0x2cf65f;}function _0x270020(_0x5a14f8,_0x377c0c){var _0x1c9016=_0x5a14f8['charAt'](0x0)[_0xb9c7('0x74')]()+_0x5a14f8[_0xb9c7('0x75')](0x1);var _0x4940db={'type':_0x263858[_0xb9c7('0x76')][_0xb9c7('0x77')][_0xb9c7('0x78')],'raw':!![]};return new Promise(function(_0x216d81,_0x409523){var _0x4699da=squel['select']()[_0xb9c7('0x6')]('ui.'+_0x1c9016+_0xb9c7('0x79'),'id')[_0xb9c7('0x6')](_0xb9c7('0x7a'))[_0xb9c7('0x7b')]('user_has_'+_0x5a14f8+'_interactions','ui')[_0xb9c7('0x7c')](_0xb9c7('0x7d'),_0x377c0c['id']);return _0x263858['sequelize'][_0xb9c7('0x7e')](_0x4699da[_0xb9c7('0x7f')](),_0x4940db)['then'](function(_0x169c2e){_0x377c0c[_0x1c9016+'OpenTabs']=_0x169c2e;_0x216d81(_0x169c2e);})[_0xb9c7('0xe')](function(_0x1aa4ba){_0x409523(_0x1aa4ba);});});}return _0x2a013f[_0xb9c7('0x80')](_0xb9c7('0x81'),attributes,{'tableName':_0xb9c7('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x52b697){var _0x5d198c=require(_0xb9c7('0x83'));var _0xfea28b={'raw':_0x52b697[_0xb9c7('0x7e')][_0xb9c7('0x84')],'where':{}};var _0x13880a={};var _0x45b7f8={'count':0x0,'rows':[]};var _0x3bac1b=_0x52b697[_0xb9c7('0x7e')]['section'];var _0x595f44=_0x52b697['query'][_0xb9c7('0x85')]||![];var _0x1fd389=_0x3b8ba9(_0x3bac1b,_0x595f44);if(!_0x1fd389[_0xb9c7('0x12')])throw new Error(_0xb9c7('0x86')+_0x3bac1b+'\x27');var _0x115a77=[{'name':_0x3bac1b}];if(!_[_0xb9c7('0x87')](_0x1fd389['parentSections']))_0x115a77=_0x1fd389[_0xb9c7('0x17')];var _0x1f9f54=[];for(var _0x3c0012=0x0;_0x3c0012<_0x115a77[_0xb9c7('0x88')];_0x3c0012++){_0x1f9f54[_0xb9c7('0x89')](_0x263858['UserProfileSection']['find']({'where':{'userProfileId':_0x52b697[_0xb9c7('0x8a')]['id'],'name':_0x115a77[_0x3c0012]['name']},'raw':!![]}));}return Promise[_0xb9c7('0x8b')](_0x1f9f54)[_0xb9c7('0x8')](function(_0x2b973f){var _0x500537=_[_0xb9c7('0x5')](_0x2b973f,function(_0x2dcabe){return _0x2dcabe?_0x2dcabe:undefined;});var _0xc1d0b7=_[_0xb9c7('0x5')](_0x115a77,[_0xb9c7('0x8c'),!![]]);var _0x2c0fc4=_[_0xb9c7('0x87')](_0x500537)&&_[_0xb9c7('0x87')](_0xc1d0b7)?null:_[_0xb9c7('0x8d')](_0xc1d0b7,_0x500537);if(!_0x2c0fc4)return null;var _0x2a8d68=[];for(var _0x3cd4fc=0x0;_0x3cd4fc<_0x2c0fc4[_0xb9c7('0x88')];_0x3cd4fc++){var _0x5d0756=_[_0xb9c7('0x8e')](_0x115a77,function(_0x24d00b){return _0x2c0fc4[_0x3cd4fc]?_0x24d00b['name']===_0x2c0fc4[_0x3cd4fc][_0xb9c7('0xd')]:null;});if(_0x5d0756){if(_0x2c0fc4[_0x3cd4fc][_0xb9c7('0x8c')]){_0x2a8d68['push'](_0x599ee1(_0x1fd389['childModel'],_0x2c0fc4[_0x3cd4fc]));}else{if(!_0x2c0fc4[_0x3cd4fc]['autoAssociation']){_0x2a8d68[_0xb9c7('0x89')](_0x59fbe3(_0x5d0756,_0x2c0fc4[_0x3cd4fc],_0x1fd389[_0xb9c7('0x12')]));}else{if(_0x5d0756['model']){_0x2a8d68['push'](_0x5694e8(_0x5d0756,_0x2c0fc4[_0x3cd4fc]));}}}}}return Promise[_0xb9c7('0x8b')](_0x2a8d68);})[_0xb9c7('0x8')](function(_0x3829b4){var _0x41729b=_0x3829b4;var _0x35f6bf=null;if(_0x41729b){_0x35f6bf=_0x41729b['length']===0x1?_0x41729b[0x0]:null;}if(!_0x35f6bf&&!_0x41729b)return _0x45b7f8;var _0x446cf5=_0x263858[_0x1fd389[_0xb9c7('0x12')]][_0xb9c7('0x8f')];_0x13880a[_0xb9c7('0xc')]=_['keys'](_0x446cf5);_0x13880a['query']=_[_0xb9c7('0x90')](_0x52b697['query']);_0x13880a[_0xb9c7('0x91')]=_['intersection'](_0x13880a[_0xb9c7('0xc')],_0x13880a[_0xb9c7('0x7e')]);_0xfea28b[_0xb9c7('0x92')]=_[_0xb9c7('0x93')](_0x13880a[_0xb9c7('0xc')],_0x5d198c['fields'](_0x52b697['query'][_0xb9c7('0x94')]));_0xfea28b[_0xb9c7('0x92')]=_0xfea28b[_0xb9c7('0x92')][_0xb9c7('0x88')]?_0xfea28b[_0xb9c7('0x92')]:_0x13880a[_0xb9c7('0xc')];if(!_0x52b697[_0xb9c7('0x7e')][_0xb9c7('0x95')]('nolimit')){_0xfea28b[_0xb9c7('0x96')]=_0x5d198c['limit'](_0x52b697[_0xb9c7('0x7e')][_0xb9c7('0x96')]);_0xfea28b[_0xb9c7('0x97')]=_0x5d198c[_0xb9c7('0x97')](_0x52b697[_0xb9c7('0x7e')][_0xb9c7('0x97')]);}_0xfea28b[_0xb9c7('0x98')]=_0x5d198c[_0xb9c7('0x99')](_0x52b697[_0xb9c7('0x7e')][_0xb9c7('0x99')]);_0xfea28b['where']=_0x5d198c[_0xb9c7('0x91')](_[_0xb9c7('0x9a')](_0x52b697['query'],_0x13880a[_0xb9c7('0x91')]));if(_0x52b697[_0xb9c7('0x7e')][_0xb9c7('0x5')]){_0xfea28b[_0xb9c7('0x7c')]=_[_0xb9c7('0x9b')](_0xfea28b[_0xb9c7('0x7c')],{'$or':_[_0xb9c7('0xa')](_0x446cf5,function(_0x23005d){if(_0x23005d['type']['key']!==_0xb9c7('0x9c')){var _0x557910={};_0x557910[_0x23005d[_0xb9c7('0x6')]]={'$like':'%'+_0x52b697[_0xb9c7('0x7e')]['filter']+'%'};return _0x557910;}})});}var _0x2cdfc3=[];var _0x55a3bb=null;var _0x23d4da={};if(_0x35f6bf){_0x55a3bb=_['find'](_0x115a77,[_0xb9c7('0xd'),_0x35f6bf[_0xb9c7('0xd')]]);if(_0x55a3bb[_0xb9c7('0x6')]){_0x23d4da={};if(_0x1fd389[_0xb9c7('0x12')]===_0xb9c7('0xf')){_0x23d4da[_0x55a3bb['foreignKey']]=_['map'](_0x35f6bf['associatedResources'],'id');}else{_0x23d4da[_0x55a3bb[_0xb9c7('0x9d')]]=_0x35f6bf[_0xb9c7('0x9')];}_0x2cdfc3['push'](_0x23d4da);}else{_0xfea28b[_0xb9c7('0x7c')]['id']=_0x35f6bf[_0xb9c7('0x9')];}}else{for(var _0x318dd8=0x0;_0x318dd8<_0x41729b[_0xb9c7('0x88')];_0x318dd8++){_0x55a3bb=_[_0xb9c7('0x8e')](_0x115a77,['name',_0x41729b[_0x318dd8][_0xb9c7('0xd')]]);if(_0x55a3bb[_0xb9c7('0x6')]){_0x23d4da={};_0x23d4da[_0x55a3bb[_0xb9c7('0x9d')]]=_0x41729b[_0x318dd8][_0xb9c7('0x9')];_0x2cdfc3[_0xb9c7('0x89')](_0x23d4da);}else{if(!_0xfea28b[_0xb9c7('0x7c')]['id'])_0xfea28b[_0xb9c7('0x7c')]['id']=[];_0x41729b[_0x318dd8]['associatedResources'][_0xb9c7('0x9e')](function(_0x3afa88){_0xfea28b[_0xb9c7('0x7c')]['id'][_0xb9c7('0x89')](_0x3afa88);});}}}if(!_[_0xb9c7('0x87')](_0x2cdfc3)){_0xfea28b['where']=_['merge'](_0xfea28b[_0xb9c7('0x7c')],{'$and':{'$or':_0x2cdfc3}});}_0xfea28b=_[_0xb9c7('0x9b')]({},_0xfea28b,_0x52b697['options']);if(_0x35f6bf&&!_0x35f6bf[_0xb9c7('0x9f')]&&_0x1fd389['childModel']==='AnalyticExtractedReport'){if(_0x52b697[_0xb9c7('0x7e')][_0xb9c7('0xa0')]){_0xfea28b[_0xb9c7('0xa1')]=[{'all':!![]}];}return _0x263858[_0x1fd389[_0xb9c7('0x12')]]['findAll'](_0xfea28b)[_0xb9c7('0x8')](function(_0x147c77){var _0x59f641=[];_0x147c77[_0xb9c7('0x9e')](function(_0x1f4666){var _0x16b667;switch(_0x1f4666[_0xb9c7('0xa2')]){case _0xb9c7('0xa3'):_0x16b667=_[_0xb9c7('0x8e')](_0x35f6bf['associatedResources'],function(_0x34c557){return _0x34c557['id']===_0x1f4666[_0xb9c7('0x71')]&&_0x34c557['type']===_0xb9c7('0xa4');});break;case _0xb9c7('0xa5'):_0x16b667=_[_0xb9c7('0x8e')](_0x35f6bf[_0xb9c7('0x9')],function(_0x346ee2){return _0x346ee2['id']===_0x1f4666[_0xb9c7('0x71')]&&_0x346ee2[_0xb9c7('0x10')]===_0xb9c7('0xa6');});break;}if(_0x16b667)_0x59f641[_0xb9c7('0x89')](_0x1f4666);});_0x45b7f8[_0xb9c7('0xa7')]=_0x59f641[_0xb9c7('0x88')];_0x45b7f8[_0xb9c7('0xa8')]=_0x59f641;return _0x45b7f8;});}else{if(!_[_0xb9c7('0x87')](_0x52b697[_0xb9c7('0x7e')][_0xb9c7('0xa9')])){_0xfea28b['where']['id']=_0xfea28b['where']['id']?_[_0xb9c7('0x93')](_0xfea28b[_0xb9c7('0x7c')]['id'],_0x52b697[_0xb9c7('0x7e')]['ids']):_0x52b697[_0xb9c7('0x7e')]['ids'];if(_0x52b697[_0xb9c7('0x7e')][_0xb9c7('0xaa')]){_0xfea28b[_0xb9c7('0x98')]=_0x52b697['query'][_0xb9c7('0xaa')];}}if(_0x52b697[_0xb9c7('0x7e')][_0xb9c7('0xab')]){_0xfea28b[_0xb9c7('0x7c')]=_[_0xb9c7('0x9b')](_0xfea28b['where'],{'$and':_0x52b697[_0xb9c7('0x7e')][_0xb9c7('0xab')]});}return _0x263858[_0x1fd389['childModel']]['count']({'where':_0xfea28b[_0xb9c7('0x7c')]})[_0xb9c7('0x8')](function(_0x95a888){_0x45b7f8[_0xb9c7('0xa7')]=_0x95a888;if(_0x52b697[_0xb9c7('0x7e')][_0xb9c7('0xa0')]){if(_0x1fd389[_0xb9c7('0x12')]==='CmContact'){_0xfea28b[_0xb9c7('0xa1')]=[{'model':_0x263858[_0xb9c7('0x67')],'as':_0xb9c7('0xac'),'attributes':['id',_0xb9c7('0xd'),_0xb9c7('0xad')],'required':_0x52b697['query'][_0xb9c7('0xae')]?!![]:![]},{'model':_0x263858[_0xb9c7('0x67')],'as':_0xb9c7('0xaf'),'attributes':['id','name',_0xb9c7('0xad')],'through':_0x52b697[_0xb9c7('0x7e')][_0xb9c7('0xae')]?{'attributes':[],'where':{'TagId':_0x52b697[_0xb9c7('0x7e')][_0xb9c7('0xae')]||undefined}}:{},'required':_0x52b697[_0xb9c7('0x7e')]['tag']?!![]:![]}];}else{_0xfea28b[_0xb9c7('0xa1')]=[{'all':!![]}];}}return _0x263858[_0x1fd389['childModel']][_0xb9c7('0x7')](_0xfea28b);})['then'](function(_0x59405d){_0x45b7f8[_0xb9c7('0xa8')]=_0x59405d;if(_0x3bac1b===_0xb9c7('0x2e')&&_0x52b697[_0xb9c7('0x7e')][_0xb9c7('0xb0')]===_0xb9c7('0xb1')){var _0x414e32=[];for(var _0x23b8c2=0x0;_0x23b8c2<_0x45b7f8[_0xb9c7('0xa8')]['length'];_0x23b8c2++){_0x414e32[_0xb9c7('0x89')](_0x270020(_0xb9c7('0xb2'),_0x45b7f8[_0xb9c7('0xa8')][_0x23b8c2]['dataValues']));_0x414e32[_0xb9c7('0x89')](_0x270020(_0xb9c7('0xb3'),_0x45b7f8[_0xb9c7('0xa8')][_0x23b8c2][_0xb9c7('0xb4')]));_0x414e32[_0xb9c7('0x89')](_0x270020('fax',_0x45b7f8['rows'][_0x23b8c2][_0xb9c7('0xb4')]));_0x414e32[_0xb9c7('0x89')](_0x270020('mail',_0x45b7f8['rows'][_0x23b8c2]['dataValues']));_0x414e32[_0xb9c7('0x89')](_0x270020('openchannel',_0x45b7f8[_0xb9c7('0xa8')][_0x23b8c2]['dataValues']));_0x414e32[_0xb9c7('0x89')](_0x270020(_0xb9c7('0xb5'),_0x45b7f8['rows'][_0x23b8c2]['dataValues']));}return Promise[_0xb9c7('0x8b')](_0x414e32)[_0xb9c7('0x8')](function(){return _0x45b7f8;});}return _0x45b7f8;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 57bbd9b..d08713d 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 _0x7bd0=['register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userProfile.socket'];(function(_0x4d2ac9,_0x5e9cfa){var _0x415111=function(_0x1dfc91){while(--_0x1dfc91){_0x4d2ac9['push'](_0x4d2ac9['shift']());}};_0x415111(++_0x5e9cfa);}(_0x7bd0,0x111));var _0x07bd=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x7bd0[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});config[_0x07bd('0xd')]=_[_0x07bd('0xe')](config['redis'],{'host':_0x07bd('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x07bd('0xd')]));require(_0x07bd('0x10'))[_0x07bd('0x11')](socket);function respondWithRpcPromise(_0x5984fa,_0x2bace8,_0x141e8b){return new BPromise(function(_0x324a46,_0x169b07){return client['request'](_0x5984fa,_0x141e8b)[_0x07bd('0x12')](function(_0x313ca5){logger[_0x07bd('0x13')](_0x07bd('0x14'),_0x2bace8,_0x07bd('0x15'));logger[_0x07bd('0x16')](_0x07bd('0x17'),_0x2bace8,_0x07bd('0x15'),JSON['stringify'](_0x313ca5));if(_0x313ca5['error']){if(_0x313ca5[_0x07bd('0x18')][_0x07bd('0x19')]===0x1f4){logger[_0x07bd('0x18')](_0x07bd('0x14'),_0x2bace8,_0x313ca5[_0x07bd('0x18')][_0x07bd('0x1a')]);return _0x169b07(_0x313ca5[_0x07bd('0x18')]['message']);}logger[_0x07bd('0x18')]('UserProfile,\x20%s,\x20%s',_0x2bace8,_0x313ca5[_0x07bd('0x18')][_0x07bd('0x1a')]);return _0x324a46(_0x313ca5[_0x07bd('0x18')][_0x07bd('0x1a')]);}else{logger[_0x07bd('0x13')]('UserProfile,\x20%s,\x20%s',_0x2bace8,_0x07bd('0x15'));_0x324a46(_0x313ca5[_0x07bd('0x1b')]['message']);}})[_0x07bd('0x1c')](function(_0x72f775){logger[_0x07bd('0x18')](_0x07bd('0x14'),_0x2bace8,_0x72f775);_0x169b07(_0x72f775);});});} \ No newline at end of file +var _0xdbb9=['redis','localhost','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults'];(function(_0x1ac9f4,_0x5edaf3){var _0x1e48f6=function(_0x3d6fcc){while(--_0x3d6fcc){_0x1ac9f4['push'](_0x1ac9f4['shift']());}};_0x1e48f6(++_0x5edaf3);}(_0xdbb9,0xf9));var _0x9dbb=function(_0x17bd98,_0x55a596){_0x17bd98=_0x17bd98-0x0;var _0x4663e5=_0xdbb9[_0x17bd98];return _0x4663e5;};'use strict';var _=require('lodash');var util=require(_0x9dbb('0x0'));var moment=require(_0x9dbb('0x1'));var BPromise=require(_0x9dbb('0x2'));var rs=require(_0x9dbb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9dbb('0x4'))['db'];var utils=require(_0x9dbb('0x5'));var logger=require(_0x9dbb('0x6'))(_0x9dbb('0x7'));var config=require(_0x9dbb('0x8'));var jayson=require(_0x9dbb('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x9dbb('0xa')](config[_0x9dbb('0xb')],{'host':_0x9dbb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9dbb('0xd'))[_0x9dbb('0xe')](socket);function respondWithRpcPromise(_0x37f00d,_0x502a4c,_0x40bc14){return new BPromise(function(_0x22f3b0,_0x5b9290){return client[_0x9dbb('0xf')](_0x37f00d,_0x40bc14)['then'](function(_0x435a9c){logger[_0x9dbb('0x10')](_0x9dbb('0x11'),_0x502a4c,_0x9dbb('0x12'));logger[_0x9dbb('0x13')](_0x9dbb('0x14'),_0x502a4c,_0x9dbb('0x12'),JSON[_0x9dbb('0x15')](_0x435a9c));if(_0x435a9c[_0x9dbb('0x16')]){if(_0x435a9c[_0x9dbb('0x16')][_0x9dbb('0x17')]===0x1f4){logger[_0x9dbb('0x16')](_0x9dbb('0x11'),_0x502a4c,_0x435a9c[_0x9dbb('0x16')][_0x9dbb('0x18')]);return _0x5b9290(_0x435a9c[_0x9dbb('0x16')]['message']);}logger[_0x9dbb('0x16')](_0x9dbb('0x11'),_0x502a4c,_0x435a9c[_0x9dbb('0x16')][_0x9dbb('0x18')]);return _0x22f3b0(_0x435a9c[_0x9dbb('0x16')]['message']);}else{logger[_0x9dbb('0x10')](_0x9dbb('0x11'),_0x502a4c,_0x9dbb('0x12'));_0x22f3b0(_0x435a9c[_0x9dbb('0x19')][_0x9dbb('0x18')]);}})['catch'](function(_0x3dfd6c){logger['error'](_0x9dbb('0x11'),_0x502a4c,_0x3dfd6c);_0x5b9290(_0x3dfd6c);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 234376e..dd4096d 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 _0x3e5b=['removeListener','register','./userProfile.events','update'];(function(_0x49064c,_0x48d278){var _0x2069a0=function(_0x5ca06c){while(--_0x5ca06c){_0x49064c['push'](_0x49064c['shift']());}};_0x2069a0(++_0x48d278);}(_0x3e5b,0x18a));var _0xb3e5=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3e5b[_0x3947c9];return _0x2e7871;};'use strict';var UserProfileEvents=require(_0xb3e5('0x0'));var events=['save','remove',_0xb3e5('0x1')];function createListener(_0x22567a,_0x4207de){return function(_0x362638){_0x4207de['emit'](_0x22567a,_0x362638);};}function removeListener(_0x4eb97b,_0x34511b){return function(){UserProfileEvents[_0xb3e5('0x2')](_0x4eb97b,_0x34511b);};}exports[_0xb3e5('0x3')]=function(_0x364312){for(var _0x18609c=0x0,_0x5bc9ee=events['length'];_0x18609c<_0x5bc9ee;_0x18609c++){var _0x4ec11c=events[_0x18609c];var _0x144df3=createListener('userProfile:'+_0x4ec11c,_0x364312);UserProfileEvents['on'](_0x4ec11c,_0x144df3);}}; \ No newline at end of file +var _0x08f5=['emit','removeListener','register','length','./userProfile.events','save','remove','update'];(function(_0x25a1b6,_0x30b66f){var _0x56eee8=function(_0x40fc5b){while(--_0x40fc5b){_0x25a1b6['push'](_0x25a1b6['shift']());}};_0x56eee8(++_0x30b66f);}(_0x08f5,0x9c));var _0x508f=function(_0x2dc7c9,_0x3a15f8){_0x2dc7c9=_0x2dc7c9-0x0;var _0x3e6536=_0x08f5[_0x2dc7c9];return _0x3e6536;};'use strict';var UserProfileEvents=require(_0x508f('0x0'));var events=[_0x508f('0x1'),_0x508f('0x2'),_0x508f('0x3')];function createListener(_0x31e6e9,_0x273e20){return function(_0x3f2c86){_0x273e20[_0x508f('0x4')](_0x31e6e9,_0x3f2c86);};}function removeListener(_0x513260,_0x3ef96c){return function(){UserProfileEvents[_0x508f('0x5')](_0x513260,_0x3ef96c);};}exports[_0x508f('0x6')]=function(_0x1c773e){for(var _0x54e8e7=0x0,_0x489556=events[_0x508f('0x7')];_0x54e8e7<_0x489556;_0x54e8e7++){var _0x165721=events[_0x54e8e7];var _0x4c7783=createListener('userProfile:'+_0x165721,_0x1c773e);UserProfileEvents['on'](_0x165721,_0x4c7783);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 6cf57e5..e0c0b01 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 _0xbc1d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x6a6064,_0x399bc1){var _0x3f632c=function(_0x5a9bb0){while(--_0x5a9bb0){_0x6a6064['push'](_0x6a6064['shift']());}};_0x3f632c(++_0x399bc1);}(_0xbc1d,0x185));var _0xdbc1=function(_0x1c7137,_0x4c7c26){_0x1c7137=_0x1c7137-0x0;var _0xeb4432=_0xbc1d[_0x1c7137];return _0xeb4432;};'use strict';var multer=require(_0xdbc1('0x0'));var util=require(_0xdbc1('0x1'));var path=require(_0xdbc1('0x2'));var timeout=require(_0xdbc1('0x3'));var express=require(_0xdbc1('0x4'));var router=express[_0xdbc1('0x5')]();var fs_extra=require(_0xdbc1('0x6'));var auth=require(_0xdbc1('0x7'));var interaction=require(_0xdbc1('0x8'));var config=require(_0xdbc1('0x9'));var controller=require(_0xdbc1('0xa'));router[_0xdbc1('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdbc1('0xb')](_0xdbc1('0xc'),auth[_0xdbc1('0xd')](),controller[_0xdbc1('0xe')]);router[_0xdbc1('0xb')](_0xdbc1('0xf'),auth[_0xdbc1('0xd')](),controller[_0xdbc1('0x10')]);router[_0xdbc1('0x11')]('/',auth['isAuthenticated'](),controller[_0xdbc1('0x12')]);router['put'](_0xdbc1('0xf'),auth[_0xdbc1('0xd')](),controller['update']);router[_0xdbc1('0x13')](_0xdbc1('0xf'),auth[_0xdbc1('0xd')](),controller[_0xdbc1('0x14')]);module[_0xdbc1('0x15')]=router; \ No newline at end of file +var _0xe1d0=['./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id','show','put','delete','destroy','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3f7b42,_0x5a6ceb){var _0x26ba01=function(_0x549207){while(--_0x549207){_0x3f7b42['push'](_0x3f7b42['shift']());}};_0x26ba01(++_0x5a6ceb);}(_0xe1d0,0x16a));var _0x0e1d=function(_0x2a14fc,_0x54aa7b){_0x2a14fc=_0x2a14fc-0x0;var _0x1f4073=_0xe1d0[_0x2a14fc];return _0x1f4073;};'use strict';var multer=require('multer');var util=require(_0x0e1d('0x0'));var path=require(_0x0e1d('0x1'));var timeout=require('connect-timeout');var express=require(_0x0e1d('0x2'));var router=express['Router']();var fs_extra=require(_0x0e1d('0x3'));var auth=require(_0x0e1d('0x4'));var interaction=require(_0x0e1d('0x5'));var config=require('../../config/environment');var controller=require(_0x0e1d('0x6'));router[_0x0e1d('0x7')]('/',auth[_0x0e1d('0x8')](),controller[_0x0e1d('0x9')]);router[_0x0e1d('0x7')](_0x0e1d('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0e1d('0x7')](_0x0e1d('0xb'),auth[_0x0e1d('0x8')](),controller[_0x0e1d('0xc')]);router['post']('/',auth[_0x0e1d('0x8')](),controller['create']);router[_0x0e1d('0xd')](_0x0e1d('0xb'),auth[_0x0e1d('0x8')](),controller['update']);router[_0x0e1d('0xe')](_0x0e1d('0xb'),auth[_0x0e1d('0x8')](),controller[_0x0e1d('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 3f9019b..8ffec04 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 _0x3a02=['STRING','sequelize'];(function(_0x474f47,_0x2303b7){var _0x21bfe6=function(_0x1121d1){while(--_0x1121d1){_0x474f47['push'](_0x474f47['shift']());}};_0x21bfe6(++_0x2303b7);}(_0x3a02,0x109));var _0x23a0=function(_0xb1235a,_0x43ed2d){_0xb1235a=_0xb1235a-0x0;var _0x454a0a=_0x3a02[_0xb1235a];return _0x454a0a;};'use strict';var Sequelize=require(_0x23a0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x23a0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x3c7f=['sequelize','exports','STRING','INTEGER'];(function(_0x4b25a9,_0x519a59){var _0x141e20=function(_0x353c02){while(--_0x353c02){_0x4b25a9['push'](_0x4b25a9['shift']());}};_0x141e20(++_0x519a59);}(_0x3c7f,0x1e4));var _0xf3c7=function(_0x1a0103,_0x490f01){_0x1a0103=_0x1a0103-0x0;var _0xc94434=_0x3c7f[_0x1a0103];return _0xc94434;};'use strict';var Sequelize=require(_0xf3c7('0x0'));module[_0xf3c7('0x1')]={'name':{'type':Sequelize[_0xf3c7('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xf3c7('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xf3c7('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 0dd4768..ecaed7f 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 _0x5f66=['bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body','update','catch','describe','rimraf','fast-json-patch','request-promise','moment'];(function(_0x306ddc,_0x9c4d60){var _0x11767f=function(_0x35183e){while(--_0x35183e){_0x306ddc['push'](_0x306ddc['shift']());}};_0x11767f(++_0x9c4d60);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x3c')](_0x4ac04b);})[_0x65f6('0x21')](function(_0xed4c96){_0x266cfe[_0x65f6('0x3d')]=_0xed4c96;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))['catch'](handleError(_0x559330,null));};exports[_0x65f6('0x3e')]=function(_0x400ed2,_0x377ae5){var _0x181798={'raw':![],'where':{'id':_0x400ed2[_0x65f6('0x3f')]['id']}},_0x83e2d9={};_0x83e2d9[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x83e2d9[_0x65f6('0x2c')]=_[_0x65f6('0x2b')](_0x400ed2[_0x65f6('0x2c')]);_0x83e2d9[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],_0x83e2d9['query']);_0x181798[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x400ed2['query'][_0x65f6('0x2f')]));_0x181798[_0x65f6('0x30')]=_0x181798[_0x65f6('0x30')]['length']?_0x181798[_0x65f6('0x30')]:_0x83e2d9[_0x65f6('0x2a')];if(_0x400ed2[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x181798['include']=[{'all':!![]}];}_0x181798=_[_0x65f6('0x37')]({},_0x181798,_0x400ed2['options']);return db[_0x65f6('0x27')][_0x65f6('0x40')](_0x181798)['then'](handleEntityNotFound(_0x377ae5,null))[_0x65f6('0x21')](respondWithResult(_0x377ae5,null))['catch'](handleError(_0x377ae5,null));};exports[_0x65f6('0x41')]=function(_0x4d9b76,_0x2d1706){return db[_0x65f6('0x27')][_0x65f6('0x41')](_0x4d9b76[_0x65f6('0x42')],{})['then'](respondWithResult(_0x2d1706,0xc9))['catch'](handleError(_0x2d1706,null));};exports[_0x65f6('0x43')]=function(_0x15d3ba,_0x3b647a){if(_0x15d3ba[_0x65f6('0x42')]['id']){delete _0x15d3ba[_0x65f6('0x42')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x15d3ba[_0x65f6('0x3f')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b647a,null))['then'](saveUpdates(_0x15d3ba[_0x65f6('0x42')],null))[_0x65f6('0x21')](respondWithResult(_0x3b647a,null))[_0x65f6('0x44')](handleError(_0x3b647a,null));};exports['destroy']=function(_0x47e749,_0x42d453){return db['UserProfileResource'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));};exports[_0x65f6('0x45')]=function(_0x3b241f,_0x1ca67e){return db['UserProfileResource'][_0x65f6('0x45')]()[_0x65f6('0x21')](respondWithResult(_0x1ca67e,null))['catch'](handleError(_0x1ca67e,null));}; \ No newline at end of file +var _0x896e=['hasOwnProperty','nolimit','order','sort','where','merge','filter','UserProfileResource','includeAll','include','findAll','rows','catch','keys','length','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x896e,0x1e9));var _0xe896=function(_0x3ce490,_0x5e86e4){_0x3ce490=_0x3ce490-0x0;var _0x3e33b7=_0x896e[_0x3ce490];return _0x3e33b7;};'use strict';var emlformat=require(_0xe896('0x0'));var rimraf=require(_0xe896('0x1'));var zipdir=require(_0xe896('0x2'));var jsonpatch=require(_0xe896('0x3'));var rp=require(_0xe896('0x4'));var moment=require(_0xe896('0x5'));var BPromise=require(_0xe896('0x6'));var Mustache=require(_0xe896('0x7'));var util=require(_0xe896('0x8'));var path=require(_0xe896('0x9'));var sox=require(_0xe896('0xa'));var csv=require(_0xe896('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe896('0xc'));var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0xb'));var querystring=require(_0xe896('0x11'));var Papa=require(_0xe896('0x12'));var Redis=require('ioredis');var authService=require(_0xe896('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe896('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe896('0x15'))(_0xe896('0x16'));var utils=require(_0xe896('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe896('0x18'));var db=require(_0xe896('0x19'))['db'];function respondWithStatusCode(_0x3e8ac9,_0x580aac){_0x580aac=_0x580aac||0xcc;return function(_0x2aa522){if(_0x2aa522){return _0x3e8ac9[_0xe896('0x1a')](_0x580aac);}return _0x3e8ac9[_0xe896('0x1b')](_0x580aac)['end']();};}function respondWithResult(_0x2d0e46,_0x7dcf8a){_0x7dcf8a=_0x7dcf8a||0xc8;return function(_0x1e7ef8){if(_0x1e7ef8){return _0x2d0e46['status'](_0x7dcf8a)['json'](_0x1e7ef8);}};}function respondWithFilteredResult(_0x446ce2,_0x25606b){return function(_0x51e7b7){if(_0x51e7b7){var _0x5e78d6=typeof _0x25606b[_0xe896('0x1c')]===_0xe896('0x1d')&&typeof _0x25606b['limit']===_0xe896('0x1d');var _0x4e062a=_0x51e7b7[_0xe896('0x1e')];var _0x32f86d=_0x5e78d6?0x0:_0x25606b[_0xe896('0x1c')];var _0x5dc89d=_0x5e78d6?_0x51e7b7[_0xe896('0x1e')]:_0x25606b[_0xe896('0x1c')]+_0x25606b[_0xe896('0x1f')];var _0xbebbe1;if(_0x5dc89d>=_0x4e062a){_0x5dc89d=_0x4e062a;_0xbebbe1=0xc8;}else{_0xbebbe1=0xce;}_0x446ce2[_0xe896('0x1b')](_0xbebbe1);return _0x446ce2[_0xe896('0x20')](_0xe896('0x21'),_0x32f86d+'-'+_0x5dc89d+'/'+_0x4e062a)[_0xe896('0x22')](_0x51e7b7);}return null;};}function patchUpdates(_0x49547b){return function(_0x180d46){try{jsonpatch['apply'](_0x180d46,_0x49547b,!![]);}catch(_0x5d2c8d){return BPromise[_0xe896('0x23')](_0x5d2c8d);}return _0x180d46[_0xe896('0x24')]();};}function saveUpdates(_0x40502b,_0xeeec7c){return function(_0x498469){if(_0x498469){return _0x498469[_0xe896('0x25')](_0x40502b)['then'](function(_0x5001f7){return _0x5001f7;});}return null;};}function removeEntity(_0x45dd49,_0x41e689){return function(_0x1e952a){if(_0x1e952a){return _0x1e952a[_0xe896('0x26')]()[_0xe896('0x27')](function(){_0x45dd49[_0xe896('0x1b')](0xcc)[_0xe896('0x28')]();});}};}function handleEntityNotFound(_0x4b71cc,_0x390128){return function(_0x163a75){if(!_0x163a75){_0x4b71cc[_0xe896('0x1a')](0x194);}return _0x163a75;};}function handleError(_0x569d5f,_0x26635e){_0x26635e=_0x26635e||0x1f4;return function(_0xd50fe2){logger[_0xe896('0x29')](_0xd50fe2[_0xe896('0x2a')]);if(_0xd50fe2[_0xe896('0x2b')]){delete _0xd50fe2[_0xe896('0x2b')];}_0x569d5f['status'](_0x26635e)[_0xe896('0x2c')](_0xd50fe2);};}exports[_0xe896('0x2d')]=function(_0x201653,_0xbfb15b){var _0xace03f={},_0x5e0d9b={},_0x47c268={'count':0x0,'rows':[]};var _0x5c7dae=_['map'](db['UserProfileResource'][_0xe896('0x2e')],function(_0x29a18e){return{'name':_0x29a18e[_0xe896('0x2f')],'type':_0x29a18e[_0xe896('0x30')][_0xe896('0x31')]};});_0x5e0d9b[_0xe896('0x32')]=_[_0xe896('0x33')](_0x5c7dae,_0xe896('0x2b'));_0x5e0d9b['query']=_['keys'](_0x201653[_0xe896('0x34')]);_0x5e0d9b[_0xe896('0x35')]=_[_0xe896('0x36')](_0x5e0d9b[_0xe896('0x32')],_0x5e0d9b['query']);_0xace03f[_0xe896('0x37')]=_['intersection'](_0x5e0d9b['model'],qs[_0xe896('0x38')](_0x201653[_0xe896('0x34')][_0xe896('0x38')]));_0xace03f['attributes']=_0xace03f['attributes']['length']?_0xace03f[_0xe896('0x37')]:_0x5e0d9b[_0xe896('0x32')];if(!_0x201653[_0xe896('0x34')][_0xe896('0x39')](_0xe896('0x3a'))){_0xace03f['limit']=qs[_0xe896('0x1f')](_0x201653[_0xe896('0x34')][_0xe896('0x1f')]);_0xace03f[_0xe896('0x1c')]=qs[_0xe896('0x1c')](_0x201653[_0xe896('0x34')][_0xe896('0x1c')]);}_0xace03f[_0xe896('0x3b')]=qs['sort'](_0x201653[_0xe896('0x34')][_0xe896('0x3c')]);_0xace03f['where']=qs[_0xe896('0x35')](_['pick'](_0x201653[_0xe896('0x34')],_0x5e0d9b['filters']),_0x5c7dae);if(_0x201653[_0xe896('0x34')]['filter']){_0xace03f[_0xe896('0x3d')]=_[_0xe896('0x3e')](_0xace03f[_0xe896('0x3d')],{'$or':_[_0xe896('0x33')](_0x5c7dae,function(_0xeb9bbf){if(_0xeb9bbf['type']!=='VIRTUAL'){var _0x203aea={};_0x203aea[_0xeb9bbf[_0xe896('0x2b')]]={'$like':'%'+_0x201653[_0xe896('0x34')][_0xe896('0x3f')]+'%'};return _0x203aea;}})});}_0xace03f=_[_0xe896('0x3e')]({},_0xace03f,_0x201653['options']);var _0x5b8131={'where':_0xace03f[_0xe896('0x3d')]};return db[_0xe896('0x40')]['count'](_0x5b8131)['then'](function(_0x19d2fd){_0x47c268[_0xe896('0x1e')]=_0x19d2fd;if(_0x201653[_0xe896('0x34')][_0xe896('0x41')]){_0xace03f[_0xe896('0x42')]=[{'all':!![]}];}return db[_0xe896('0x40')][_0xe896('0x43')](_0xace03f);})[_0xe896('0x27')](function(_0x372c71){_0x47c268[_0xe896('0x44')]=_0x372c71;return _0x47c268;})[_0xe896('0x27')](respondWithFilteredResult(_0xbfb15b,_0xace03f))[_0xe896('0x45')](handleError(_0xbfb15b,null));};exports['show']=function(_0x1e5434,_0x143ad4){var _0x59b97f={'raw':![],'where':{'id':_0x1e5434['params']['id']}},_0x57366b={};_0x57366b[_0xe896('0x32')]=_[_0xe896('0x46')](db[_0xe896('0x40')]['rawAttributes']);_0x57366b[_0xe896('0x34')]=_[_0xe896('0x46')](_0x1e5434['query']);_0x57366b['filters']=_['intersection'](_0x57366b[_0xe896('0x32')],_0x57366b[_0xe896('0x34')]);_0x59b97f[_0xe896('0x37')]=_[_0xe896('0x36')](_0x57366b[_0xe896('0x32')],qs[_0xe896('0x38')](_0x1e5434['query'][_0xe896('0x38')]));_0x59b97f[_0xe896('0x37')]=_0x59b97f['attributes'][_0xe896('0x47')]?_0x59b97f[_0xe896('0x37')]:_0x57366b[_0xe896('0x32')];if(_0x1e5434[_0xe896('0x34')]['includeAll']){_0x59b97f[_0xe896('0x42')]=[{'all':!![]}];}_0x59b97f=_[_0xe896('0x3e')]({},_0x59b97f,_0x1e5434[_0xe896('0x48')]);return db[_0xe896('0x40')][_0xe896('0x49')](_0x59b97f)[_0xe896('0x27')](handleEntityNotFound(_0x143ad4,null))['then'](respondWithResult(_0x143ad4,null))[_0xe896('0x45')](handleError(_0x143ad4,null));};exports['create']=function(_0x234a22,_0x1c6ae1){return db[_0xe896('0x40')][_0xe896('0x4a')](_0x234a22[_0xe896('0x4b')],{})[_0xe896('0x27')](respondWithResult(_0x1c6ae1,0xc9))['catch'](handleError(_0x1c6ae1,null));};exports[_0xe896('0x25')]=function(_0x206ad3,_0x4818cd){if(_0x206ad3[_0xe896('0x4b')]['id']){delete _0x206ad3[_0xe896('0x4b')]['id'];}return db['UserProfileResource'][_0xe896('0x49')]({'where':{'id':_0x206ad3['params']['id']}})[_0xe896('0x27')](handleEntityNotFound(_0x4818cd,null))[_0xe896('0x27')](saveUpdates(_0x206ad3[_0xe896('0x4b')],null))[_0xe896('0x27')](respondWithResult(_0x4818cd,null))[_0xe896('0x45')](handleError(_0x4818cd,null));};exports['destroy']=function(_0x1fa3fd,_0x819c8a){return db[_0xe896('0x40')]['find']({'where':{'id':_0x1fa3fd[_0xe896('0x4c')]['id']}})['then'](handleEntityNotFound(_0x819c8a,null))['then'](removeEntity(_0x819c8a,null))[_0xe896('0x45')](handleError(_0x819c8a,null));};exports[_0xe896('0x4d')]=function(_0x57aed3,_0x343adb){return db[_0xe896('0x40')]['describe']()['then'](respondWithResult(_0x343adb,null))[_0xe896('0x45')](handleError(_0x343adb,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 5fa7947..276edb4 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 _0xeab0=['sectionId','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','compositeIndex','resourceId'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0xeab0,0x10b));var _0x0eab=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xeab0[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x0eab('0x0'));var util=require(_0x0eab('0x1'));var logger=require(_0x0eab('0x2'))('api');var moment=require(_0x0eab('0x3'));var BPromise=require(_0x0eab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0eab('0x5'));var config=require(_0x0eab('0x6'));var attributes=require(_0x0eab('0x7'));module[_0x0eab('0x8')]=function(_0x293479,_0x6fc4ae){return _0x293479[_0x0eab('0x9')](_0x0eab('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x0eab('0xb'),'fields':[_0x0eab('0xc'),_0x0eab('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5af7=['request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','api','moment','bluebird'];(function(_0x17c241,_0x1bf660){var _0x472397=function(_0x5cf779){while(--_0x5cf779){_0x17c241['push'](_0x17c241['shift']());}};_0x472397(++_0x1bf660);}(_0x5af7,0x181));var _0x75af=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x5af7[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x75af('0x0'));var util=require(_0x75af('0x1'));var logger=require('../../config/logger')(_0x75af('0x2'));var moment=require(_0x75af('0x3'));var BPromise=require(_0x75af('0x4'));var rp=require(_0x75af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75af('0x6'));var config=require(_0x75af('0x7'));var attributes=require(_0x75af('0x8'));module[_0x75af('0x9')]=function(_0x1da0e9,_0x57d30b){return _0x1da0e9[_0x75af('0xa')]('UserProfileResource',attributes,{'tableName':_0x75af('0xb'),'paranoid':![],'indexes':[{'name':_0x75af('0xc'),'fields':[_0x75af('0xd'),_0x75af('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 86ee3e6..ff3694a 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 _0x98aa=['lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x28effe,_0x5599e7){var _0x477a1a=function(_0x5cf78b){while(--_0x5cf78b){_0x28effe['push'](_0x28effe['shift']());}};_0x477a1a(++_0x5599e7);}(_0x98aa,0x18c));var _0xa98a=function(_0x28da10,_0x29470c){_0x28da10=_0x28da10-0x0;var _0x298372=_0x98aa[_0x28da10];return _0x298372;};'use strict';var _=require(_0xa98a('0x0'));var util=require('util');var moment=require(_0xa98a('0x1'));var BPromise=require(_0xa98a('0x2'));var rs=require(_0xa98a('0x3'));var fs=require('fs');var Redis=require(_0xa98a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa98a('0x5'))(_0xa98a('0x6'));var config=require('../../config/environment');var jayson=require(_0xa98a('0x7'));var client=jayson['client'][_0xa98a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5358fd,_0x1f2454,_0xab2b48){return new BPromise(function(_0xc6ef79,_0x1d09cc){return client[_0xa98a('0x9')](_0x5358fd,_0xab2b48)[_0xa98a('0xa')](function(_0x5b0205){logger[_0xa98a('0xb')](_0xa98a('0xc'),_0x1f2454,_0xa98a('0xd'));logger['debug'](_0xa98a('0xe'),_0x1f2454,_0xa98a('0xd'),JSON['stringify'](_0x5b0205));if(_0x5b0205[_0xa98a('0xf')]){if(_0x5b0205[_0xa98a('0xf')]['code']===0x1f4){logger['error'](_0xa98a('0xc'),_0x1f2454,_0x5b0205[_0xa98a('0xf')][_0xa98a('0x10')]);return _0x1d09cc(_0x5b0205[_0xa98a('0xf')][_0xa98a('0x10')]);}logger[_0xa98a('0xf')](_0xa98a('0xc'),_0x1f2454,_0x5b0205['error'][_0xa98a('0x10')]);return _0xc6ef79(_0x5b0205[_0xa98a('0xf')]['message']);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x1f2454,_0xa98a('0xd'));_0xc6ef79(_0x5b0205[_0xa98a('0x11')][_0xa98a('0x10')]);}})['catch'](function(_0x24d966){logger[_0xa98a('0xf')](_0xa98a('0xc'),_0x1f2454,_0x24d966);_0x1d09cc(_0x24d966);});});} \ No newline at end of file +var _0xb7af=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','moment'];(function(_0x45863a,_0x586bbd){var _0x905636=function(_0x20543d){while(--_0x20543d){_0x45863a['push'](_0x45863a['shift']());}};_0x905636(++_0x586bbd);}(_0xb7af,0xc4));var _0xfb7a=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xb7af[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0xfb7a('0x0'));var util=require('util');var moment=require(_0xfb7a('0x1'));var BPromise=require(_0xfb7a('0x2'));var rs=require(_0xfb7a('0x3'));var fs=require('fs');var Redis=require(_0xfb7a('0x4'));var db=require(_0xfb7a('0x5'))['db'];var utils=require(_0xfb7a('0x6'));var logger=require(_0xfb7a('0x7'))(_0xfb7a('0x8'));var config=require(_0xfb7a('0x9'));var jayson=require(_0xfb7a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x33b197,_0x1bd742,_0x3461ad){return new BPromise(function(_0x537b55,_0x521272){return client[_0xfb7a('0xb')](_0x33b197,_0x3461ad)[_0xfb7a('0xc')](function(_0x254a12){logger[_0xfb7a('0xd')](_0xfb7a('0xe'),_0x1bd742,'request\x20sent');logger[_0xfb7a('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x1bd742,_0xfb7a('0x10'),JSON[_0xfb7a('0x11')](_0x254a12));if(_0x254a12[_0xfb7a('0x12')]){if(_0x254a12[_0xfb7a('0x12')][_0xfb7a('0x13')]===0x1f4){logger[_0xfb7a('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x1bd742,_0x254a12[_0xfb7a('0x12')][_0xfb7a('0x14')]);return _0x521272(_0x254a12[_0xfb7a('0x12')][_0xfb7a('0x14')]);}logger[_0xfb7a('0x12')](_0xfb7a('0xe'),_0x1bd742,_0x254a12[_0xfb7a('0x12')][_0xfb7a('0x14')]);return _0x537b55(_0x254a12['error']['message']);}else{logger['info'](_0xfb7a('0xe'),_0x1bd742,_0xfb7a('0x10'));_0x537b55(_0x254a12[_0xfb7a('0x15')][_0xfb7a('0x14')]);}})['catch'](function(_0x5a7453){logger[_0xfb7a('0x12')](_0xfb7a('0xe'),_0x1bd742,_0x5a7453);_0x521272(_0x5a7453);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index c67eb18..d83c32f 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 _0x97bf=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','describe','/:id','show','create','put'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x97bf,0x1e2));var _0xf97b=function(_0x3acd05,_0x3e4bfc){_0x3acd05=_0x3acd05-0x0;var _0x546725=_0x97bf[_0x3acd05];return _0x546725;};'use strict';var multer=require(_0xf97b('0x0'));var util=require('util');var path=require(_0xf97b('0x1'));var timeout=require(_0xf97b('0x2'));var express=require(_0xf97b('0x3'));var router=express[_0xf97b('0x4')]();var fs_extra=require(_0xf97b('0x5'));var auth=require(_0xf97b('0x6'));var interaction=require(_0xf97b('0x7'));var config=require(_0xf97b('0x8'));var controller=require(_0xf97b('0x9'));router['get']('/',auth[_0xf97b('0xa')](),controller[_0xf97b('0xb')]);router[_0xf97b('0xc')]('/describe',auth[_0xf97b('0xa')](),controller[_0xf97b('0xd')]);router[_0xf97b('0xc')](_0xf97b('0xe'),auth[_0xf97b('0xa')](),controller[_0xf97b('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf97b('0x10')]);router[_0xf97b('0x11')](_0xf97b('0xe'),auth[_0xf97b('0xa')](),controller['update']);router[_0xf97b('0x12')](_0xf97b('0xe'),auth[_0xf97b('0xa')](),controller['destroy']);module[_0xf97b('0x13')]=router; \ No newline at end of file +var _0x13c2=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','show','post','put','update','delete','/:id','multer','util'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x13c2,0x141));var _0x213c=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x13c2[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x213c('0x0'));var util=require(_0x213c('0x1'));var path=require(_0x213c('0x2'));var timeout=require(_0x213c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x213c('0x4'));var auth=require(_0x213c('0x5'));var interaction=require(_0x213c('0x6'));var config=require(_0x213c('0x7'));var controller=require(_0x213c('0x8'));router[_0x213c('0x9')]('/',auth[_0x213c('0xa')](),controller[_0x213c('0xb')]);router['get'](_0x213c('0xc'),auth[_0x213c('0xa')](),controller['describe']);router[_0x213c('0x9')]('/:id',auth[_0x213c('0xa')](),controller[_0x213c('0xd')]);router[_0x213c('0xe')]('/',auth[_0x213c('0xa')](),controller['create']);router[_0x213c('0xf')]('/:id',auth[_0x213c('0xa')](),controller[_0x213c('0x10')]);router[_0x213c('0x11')](_0x213c('0x12'),auth[_0x213c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 492cc0c..2d24677 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 _0xbaf0=['split','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x15732d,_0x2dc086){var _0x59939a=function(_0x35085d){while(--_0x35085d){_0x15732d['push'](_0x15732d['shift']());}};_0x59939a(++_0x2dc086);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x0baf('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x232cc7){this[_0x0baf('0x4')](_0x0baf('0x5'),_0x232cc7?_0x232cc7[_0x0baf('0x6')](''):[]);},'get':function(){return this[_0x0baf('0x7')](_0x0baf('0x5'))?this[_0x0baf('0x7')](_0x0baf('0x5'))[_0x0baf('0x8')](''):[];}}}; \ No newline at end of file +var _0x087b=['getDataValue','split','sequelize','exports','INTEGER','BOOLEAN','STRING','setDataValue','crudPermissions','join'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x087b,0x11a));var _0xb087=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x087b[_0x87b0ff];return _0x3bc0b2;};'use strict';var Sequelize=require(_0xb087('0x0'));module[_0xb087('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xb087('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xb087('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xb087('0x4')],'set':function(_0x1d3299){this[_0xb087('0x5')](_0xb087('0x6'),_0x1d3299?_0x1d3299[_0xb087('0x7')](''):[]);},'get':function(){return this[_0xb087('0x8')](_0xb087('0x6'))?this[_0xb087('0x8')](_0xb087('0x6'))[_0xb087('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 1d29c2f..0017e48 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 _0x8471=['map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','describe','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','save','then','destroy','sendStatus','name','UserProfileSection','fieldName','type','key','model','filters','intersection','attributes','query','length','nolimit','order','sort','where','pick','filter','merge'];(function(_0x2efe86,_0x4b6c3f){var _0x48e01c=function(_0x5b1412){while(--_0x5b1412){_0x2efe86['push'](_0x2efe86['shift']());}};_0x48e01c(++_0x4b6c3f);}(_0x8471,0x9a));var _0x1847=function(_0x1f041f,_0x4134cc){_0x1f041f=_0x1f041f-0x0;var _0x3998a0=_0x8471[_0x1f041f];return _0x3998a0;};'use strict';var emlformat=require(_0x1847('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1847('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1847('0x2'));var moment=require('moment');var BPromise=require(_0x1847('0x3'));var Mustache=require('mustache');var util=require(_0x1847('0x4'));var path=require(_0x1847('0x5'));var sox=require(_0x1847('0x6'));var csv=require(_0x1847('0x7'));var ejs=require(_0x1847('0x8'));var fs=require('fs');var fs_extra=require(_0x1847('0x9'));var _=require(_0x1847('0xa'));var squel=require(_0x1847('0xb'));var crypto=require(_0x1847('0xc'));var jsforce=require(_0x1847('0xd'));var deskjs=require(_0x1847('0xe'));var toCsv=require(_0x1847('0x7'));var querystring=require(_0x1847('0xf'));var Papa=require(_0x1847('0x10'));var Redis=require(_0x1847('0x11'));var authService=require(_0x1847('0x12'));var qs=require(_0x1847('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1847('0x14'));var logger=require(_0x1847('0x15'))('api');var utils=require(_0x1847('0x16'));var config=require(_0x1847('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1847('0x18'))['db'];function respondWithStatusCode(_0x8fd498,_0x13d928){_0x13d928=_0x13d928||0xcc;return function(_0x38fc48){if(_0x38fc48){return _0x8fd498['sendStatus'](_0x13d928);}return _0x8fd498[_0x1847('0x19')](_0x13d928)[_0x1847('0x1a')]();};}function respondWithResult(_0x564f20,_0x37bc31){_0x37bc31=_0x37bc31||0xc8;return function(_0x26e6d3){if(_0x26e6d3){return _0x564f20[_0x1847('0x19')](_0x37bc31)[_0x1847('0x1b')](_0x26e6d3);}};}function respondWithFilteredResult(_0x5a36f0,_0x388d95){return function(_0x183d77){if(_0x183d77){var _0x648e38=typeof _0x388d95['offset']===_0x1847('0x1c')&&typeof _0x388d95[_0x1847('0x1d')]===_0x1847('0x1c');var _0x8744f5=_0x183d77['count'];var _0x5f42f=_0x648e38?0x0:_0x388d95[_0x1847('0x1e')];var _0x11feb7=_0x648e38?_0x183d77[_0x1847('0x1f')]:_0x388d95[_0x1847('0x1e')]+_0x388d95[_0x1847('0x1d')];var _0x28de4f;if(_0x11feb7>=_0x8744f5){_0x11feb7=_0x8744f5;_0x28de4f=0xc8;}else{_0x28de4f=0xce;}_0x5a36f0[_0x1847('0x19')](_0x28de4f);return _0x5a36f0[_0x1847('0x20')](_0x1847('0x21'),_0x5f42f+'-'+_0x11feb7+'/'+_0x8744f5)['json'](_0x183d77);}return null;};}function patchUpdates(_0x4fde0b){return function(_0x1f2107){try{jsonpatch['apply'](_0x1f2107,_0x4fde0b,!![]);}catch(_0x2ce2f3){return BPromise['reject'](_0x2ce2f3);}return _0x1f2107[_0x1847('0x22')]();};}function saveUpdates(_0x1514f9,_0x2ca3df){return function(_0x254405){if(_0x254405){return _0x254405['update'](_0x1514f9)[_0x1847('0x23')](function(_0x2664e2){return _0x2664e2;});}return null;};}function removeEntity(_0x4ad482,_0x1aee1c){return function(_0x1ec64b){if(_0x1ec64b){return _0x1ec64b[_0x1847('0x24')]()[_0x1847('0x23')](function(){_0x4ad482['status'](0xcc)[_0x1847('0x1a')]();});}};}function handleEntityNotFound(_0x1dfa5a,_0x49084a){return function(_0x279cb0){if(!_0x279cb0){_0x1dfa5a[_0x1847('0x25')](0x194);}return _0x279cb0;};}function handleError(_0x471481,_0x1f63c2){_0x1f63c2=_0x1f63c2||0x1f4;return function(_0x4b9818){logger['error'](_0x4b9818['stack']);if(_0x4b9818[_0x1847('0x26')]){delete _0x4b9818[_0x1847('0x26')];}_0x471481['status'](_0x1f63c2)['send'](_0x4b9818);};}exports['index']=function(_0x1275f1,_0x20b687){var _0x1214f9={},_0x504f7e={},_0x34bd90={'count':0x0,'rows':[]};var _0x562639=_['map'](db[_0x1847('0x27')]['rawAttributes'],function(_0x5d4ef7){return{'name':_0x5d4ef7[_0x1847('0x28')],'type':_0x5d4ef7[_0x1847('0x29')][_0x1847('0x2a')]};});_0x504f7e[_0x1847('0x2b')]=_['map'](_0x562639,_0x1847('0x26'));_0x504f7e['query']=_['keys'](_0x1275f1['query']);_0x504f7e[_0x1847('0x2c')]=_[_0x1847('0x2d')](_0x504f7e['model'],_0x504f7e['query']);_0x1214f9[_0x1847('0x2e')]=_['intersection'](_0x504f7e[_0x1847('0x2b')],qs['fields'](_0x1275f1[_0x1847('0x2f')]['fields']));_0x1214f9[_0x1847('0x2e')]=_0x1214f9[_0x1847('0x2e')][_0x1847('0x30')]?_0x1214f9[_0x1847('0x2e')]:_0x504f7e[_0x1847('0x2b')];if(!_0x1275f1[_0x1847('0x2f')]['hasOwnProperty'](_0x1847('0x31'))){_0x1214f9[_0x1847('0x1d')]=qs[_0x1847('0x1d')](_0x1275f1[_0x1847('0x2f')][_0x1847('0x1d')]);_0x1214f9[_0x1847('0x1e')]=qs[_0x1847('0x1e')](_0x1275f1[_0x1847('0x2f')][_0x1847('0x1e')]);}_0x1214f9[_0x1847('0x32')]=qs[_0x1847('0x33')](_0x1275f1[_0x1847('0x2f')][_0x1847('0x33')]);_0x1214f9[_0x1847('0x34')]=qs[_0x1847('0x2c')](_[_0x1847('0x35')](_0x1275f1['query'],_0x504f7e[_0x1847('0x2c')]),_0x562639);if(_0x1275f1['query'][_0x1847('0x36')]){_0x1214f9[_0x1847('0x34')]=_[_0x1847('0x37')](_0x1214f9[_0x1847('0x34')],{'$or':_[_0x1847('0x38')](_0x562639,function(_0x227c6c){if(_0x227c6c[_0x1847('0x29')]!==_0x1847('0x39')){var _0x1678b2={};_0x1678b2[_0x227c6c[_0x1847('0x26')]]={'$like':'%'+_0x1275f1[_0x1847('0x2f')][_0x1847('0x36')]+'%'};return _0x1678b2;}})});}_0x1214f9=_['merge']({},_0x1214f9,_0x1275f1[_0x1847('0x3a')]);var _0x3424d8={'where':_0x1214f9[_0x1847('0x34')]};return db[_0x1847('0x27')]['count'](_0x3424d8)[_0x1847('0x23')](function(_0x13c0b8){_0x34bd90[_0x1847('0x1f')]=_0x13c0b8;if(_0x1275f1[_0x1847('0x2f')][_0x1847('0x3b')]){_0x1214f9[_0x1847('0x3c')]=[{'all':!![]}];}return db[_0x1847('0x27')][_0x1847('0x3d')](_0x1214f9);})[_0x1847('0x23')](function(_0x3d3005){_0x34bd90['rows']=_0x3d3005;return _0x34bd90;})[_0x1847('0x23')](respondWithFilteredResult(_0x20b687,_0x1214f9))[_0x1847('0x3e')](handleError(_0x20b687,null));};exports[_0x1847('0x3f')]=function(_0x53e931,_0x541a17){var _0x512259={'raw':![],'where':{'id':_0x53e931[_0x1847('0x40')]['id']}},_0x4d4eeb={};_0x4d4eeb[_0x1847('0x2b')]=_['keys'](db[_0x1847('0x27')]['rawAttributes']);_0x4d4eeb[_0x1847('0x2f')]=_['keys'](_0x53e931[_0x1847('0x2f')]);_0x4d4eeb[_0x1847('0x2c')]=_[_0x1847('0x2d')](_0x4d4eeb[_0x1847('0x2b')],_0x4d4eeb['query']);_0x512259[_0x1847('0x2e')]=_[_0x1847('0x2d')](_0x4d4eeb[_0x1847('0x2b')],qs[_0x1847('0x41')](_0x53e931[_0x1847('0x2f')][_0x1847('0x41')]));_0x512259[_0x1847('0x2e')]=_0x512259[_0x1847('0x2e')][_0x1847('0x30')]?_0x512259['attributes']:_0x4d4eeb[_0x1847('0x2b')];if(_0x53e931[_0x1847('0x2f')][_0x1847('0x3b')]){_0x512259[_0x1847('0x3c')]=[{'all':!![]}];}_0x512259=_[_0x1847('0x37')]({},_0x512259,_0x53e931[_0x1847('0x3a')]);return db['UserProfileSection'][_0x1847('0x42')](_0x512259)[_0x1847('0x23')](handleEntityNotFound(_0x541a17,null))[_0x1847('0x23')](respondWithResult(_0x541a17,null))['catch'](handleError(_0x541a17,null));};exports['create']=function(_0x1bb31c,_0x475fd2){return db['UserProfileSection'][_0x1847('0x43')](_0x1bb31c[_0x1847('0x44')],{})[_0x1847('0x23')](respondWithResult(_0x475fd2,0xc9))[_0x1847('0x3e')](handleError(_0x475fd2,null));};exports['update']=function(_0x127b7e,_0x5bc7da){if(_0x127b7e[_0x1847('0x44')]['id']){delete _0x127b7e['body']['id'];}return db[_0x1847('0x27')][_0x1847('0x42')]({'where':{'id':_0x127b7e[_0x1847('0x40')]['id']}})[_0x1847('0x23')](handleEntityNotFound(_0x5bc7da,null))[_0x1847('0x23')](saveUpdates(_0x127b7e[_0x1847('0x44')],null))[_0x1847('0x23')](respondWithResult(_0x5bc7da,null))['catch'](handleError(_0x5bc7da,null));};exports[_0x1847('0x24')]=function(_0x23c9ae,_0x1f55ee){return db[_0x1847('0x27')]['find']({'where':{'id':_0x23c9ae['params']['id']}})[_0x1847('0x23')](handleEntityNotFound(_0x1f55ee,null))[_0x1847('0x23')](removeEntity(_0x1f55ee,null))[_0x1847('0x3e')](handleError(_0x1f55ee,null));};exports['describe']=function(_0x227ea2,_0x5cd39f){return db[_0x1847('0x27')][_0x1847('0x45')]()[_0x1847('0x23')](respondWithResult(_0x5cd39f,null))[_0x1847('0x3e')](handleError(_0x5cd39f,null));}; \ No newline at end of file +var _0xf9d8=['order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','error','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','type','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit'];(function(_0x2aa77f,_0x5d3d6b){var _0x472ecf=function(_0xfa2b4f){while(--_0xfa2b4f){_0x2aa77f['push'](_0x2aa77f['shift']());}};_0x472ecf(++_0x5d3d6b);}(_0xf9d8,0xf7));var _0x8f9d=function(_0x367ac3,_0x3055f4){_0x367ac3=_0x367ac3-0x0;var _0x4cc269=_0xf9d8[_0x367ac3];return _0x4cc269;};'use strict';var emlformat=require(_0x8f9d('0x0'));var rimraf=require(_0x8f9d('0x1'));var zipdir=require(_0x8f9d('0x2'));var jsonpatch=require(_0x8f9d('0x3'));var rp=require(_0x8f9d('0x4'));var moment=require(_0x8f9d('0x5'));var BPromise=require(_0x8f9d('0x6'));var Mustache=require(_0x8f9d('0x7'));var util=require(_0x8f9d('0x8'));var path=require(_0x8f9d('0x9'));var sox=require(_0x8f9d('0xa'));var csv=require('to-csv');var ejs=require(_0x8f9d('0xb'));var fs=require('fs');var fs_extra=require(_0x8f9d('0xc'));var _=require(_0x8f9d('0xd'));var squel=require(_0x8f9d('0xe'));var crypto=require('crypto');var jsforce=require(_0x8f9d('0xf'));var deskjs=require(_0x8f9d('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8f9d('0x11'));var authService=require(_0x8f9d('0x12'));var qs=require(_0x8f9d('0x13'));var as=require(_0x8f9d('0x14'));var hardwareService=require(_0x8f9d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x8f9d('0x16'));var config=require(_0x8f9d('0x17'));var licenseUtil=require(_0x8f9d('0x18'));var db=require(_0x8f9d('0x19'))['db'];function respondWithStatusCode(_0x4143ca,_0x1206ad){_0x1206ad=_0x1206ad||0xcc;return function(_0x19e422){if(_0x19e422){return _0x4143ca[_0x8f9d('0x1a')](_0x1206ad);}return _0x4143ca['status'](_0x1206ad)[_0x8f9d('0x1b')]();};}function respondWithResult(_0x5d99d2,_0x3947b1){_0x3947b1=_0x3947b1||0xc8;return function(_0x13a28d){if(_0x13a28d){return _0x5d99d2[_0x8f9d('0x1c')](_0x3947b1)[_0x8f9d('0x1d')](_0x13a28d);}};}function respondWithFilteredResult(_0x5da29b,_0x15d196){return function(_0x4aa00d){if(_0x4aa00d){var _0x194690=typeof _0x15d196[_0x8f9d('0x1e')]===_0x8f9d('0x1f')&&typeof _0x15d196[_0x8f9d('0x20')]===_0x8f9d('0x1f');var _0x21e4c4=_0x4aa00d[_0x8f9d('0x21')];var _0x379919=_0x194690?0x0:_0x15d196['offset'];var _0x1b9c0d=_0x194690?_0x4aa00d[_0x8f9d('0x21')]:_0x15d196['offset']+_0x15d196[_0x8f9d('0x20')];var _0x2586d5;if(_0x1b9c0d>=_0x21e4c4){_0x1b9c0d=_0x21e4c4;_0x2586d5=0xc8;}else{_0x2586d5=0xce;}_0x5da29b['status'](_0x2586d5);return _0x5da29b['set'](_0x8f9d('0x22'),_0x379919+'-'+_0x1b9c0d+'/'+_0x21e4c4)['json'](_0x4aa00d);}return null;};}function patchUpdates(_0x3f628d){return function(_0x5d2d08){try{jsonpatch['apply'](_0x5d2d08,_0x3f628d,!![]);}catch(_0x341d55){return BPromise[_0x8f9d('0x23')](_0x341d55);}return _0x5d2d08[_0x8f9d('0x24')]();};}function saveUpdates(_0x5f59f4,_0x4833a5){return function(_0x5b2c8c){if(_0x5b2c8c){return _0x5b2c8c[_0x8f9d('0x25')](_0x5f59f4)[_0x8f9d('0x26')](function(_0x365e3e){return _0x365e3e;});}return null;};}function removeEntity(_0x20506b,_0x29350f){return function(_0x532e29){if(_0x532e29){return _0x532e29['destroy']()[_0x8f9d('0x26')](function(){_0x20506b['status'](0xcc)[_0x8f9d('0x1b')]();});}};}function handleEntityNotFound(_0x261437,_0x2e499a){return function(_0x5a2d4b){if(!_0x5a2d4b){_0x261437[_0x8f9d('0x1a')](0x194);}return _0x5a2d4b;};}function handleError(_0x442150,_0x58663d){_0x58663d=_0x58663d||0x1f4;return function(_0x2e380a){logger[_0x8f9d('0x27')](_0x2e380a[_0x8f9d('0x28')]);if(_0x2e380a[_0x8f9d('0x29')]){delete _0x2e380a['name'];}_0x442150[_0x8f9d('0x1c')](_0x58663d)[_0x8f9d('0x2a')](_0x2e380a);};}exports['index']=function(_0xa53ca8,_0x1df351){var _0x2e9471={},_0x4a6208={},_0x5ce5e3={'count':0x0,'rows':[]};var _0x3b73c1=_[_0x8f9d('0x2b')](db[_0x8f9d('0x2c')][_0x8f9d('0x2d')],function(_0x3b8f06){return{'name':_0x3b8f06[_0x8f9d('0x2e')],'type':_0x3b8f06[_0x8f9d('0x2f')]['key']};});_0x4a6208[_0x8f9d('0x30')]=_[_0x8f9d('0x2b')](_0x3b73c1,_0x8f9d('0x29'));_0x4a6208['query']=_['keys'](_0xa53ca8[_0x8f9d('0x31')]);_0x4a6208[_0x8f9d('0x32')]=_[_0x8f9d('0x33')](_0x4a6208['model'],_0x4a6208[_0x8f9d('0x31')]);_0x2e9471['attributes']=_[_0x8f9d('0x33')](_0x4a6208['model'],qs[_0x8f9d('0x34')](_0xa53ca8[_0x8f9d('0x31')][_0x8f9d('0x34')]));_0x2e9471['attributes']=_0x2e9471['attributes'][_0x8f9d('0x35')]?_0x2e9471[_0x8f9d('0x36')]:_0x4a6208[_0x8f9d('0x30')];if(!_0xa53ca8[_0x8f9d('0x31')][_0x8f9d('0x37')](_0x8f9d('0x38'))){_0x2e9471['limit']=qs['limit'](_0xa53ca8[_0x8f9d('0x31')]['limit']);_0x2e9471[_0x8f9d('0x1e')]=qs['offset'](_0xa53ca8[_0x8f9d('0x31')][_0x8f9d('0x1e')]);}_0x2e9471[_0x8f9d('0x39')]=qs[_0x8f9d('0x3a')](_0xa53ca8['query'][_0x8f9d('0x3a')]);_0x2e9471[_0x8f9d('0x3b')]=qs[_0x8f9d('0x32')](_[_0x8f9d('0x3c')](_0xa53ca8['query'],_0x4a6208[_0x8f9d('0x32')]),_0x3b73c1);if(_0xa53ca8['query'][_0x8f9d('0x3d')]){_0x2e9471[_0x8f9d('0x3b')]=_[_0x8f9d('0x3e')](_0x2e9471[_0x8f9d('0x3b')],{'$or':_[_0x8f9d('0x2b')](_0x3b73c1,function(_0x5b0e72){if(_0x5b0e72[_0x8f9d('0x2f')]!==_0x8f9d('0x3f')){var _0x5b24ea={};_0x5b24ea[_0x5b0e72['name']]={'$like':'%'+_0xa53ca8[_0x8f9d('0x31')][_0x8f9d('0x3d')]+'%'};return _0x5b24ea;}})});}_0x2e9471=_[_0x8f9d('0x3e')]({},_0x2e9471,_0xa53ca8[_0x8f9d('0x40')]);var _0x35bfea={'where':_0x2e9471[_0x8f9d('0x3b')]};return db[_0x8f9d('0x2c')][_0x8f9d('0x21')](_0x35bfea)[_0x8f9d('0x26')](function(_0x5423ed){_0x5ce5e3['count']=_0x5423ed;if(_0xa53ca8['query']['includeAll']){_0x2e9471[_0x8f9d('0x41')]=[{'all':!![]}];}return db[_0x8f9d('0x2c')][_0x8f9d('0x42')](_0x2e9471);})[_0x8f9d('0x26')](function(_0x4f49f){_0x5ce5e3[_0x8f9d('0x43')]=_0x4f49f;return _0x5ce5e3;})[_0x8f9d('0x26')](respondWithFilteredResult(_0x1df351,_0x2e9471))[_0x8f9d('0x44')](handleError(_0x1df351,null));};exports['show']=function(_0x3316fb,_0x1e77e8){var _0x4d581e={'raw':![],'where':{'id':_0x3316fb[_0x8f9d('0x45')]['id']}},_0x1b6712={};_0x1b6712[_0x8f9d('0x30')]=_['keys'](db['UserProfileSection'][_0x8f9d('0x2d')]);_0x1b6712[_0x8f9d('0x31')]=_[_0x8f9d('0x46')](_0x3316fb[_0x8f9d('0x31')]);_0x1b6712[_0x8f9d('0x32')]=_['intersection'](_0x1b6712['model'],_0x1b6712[_0x8f9d('0x31')]);_0x4d581e[_0x8f9d('0x36')]=_[_0x8f9d('0x33')](_0x1b6712['model'],qs[_0x8f9d('0x34')](_0x3316fb[_0x8f9d('0x31')][_0x8f9d('0x34')]));_0x4d581e[_0x8f9d('0x36')]=_0x4d581e['attributes'][_0x8f9d('0x35')]?_0x4d581e[_0x8f9d('0x36')]:_0x1b6712['model'];if(_0x3316fb['query']['includeAll']){_0x4d581e[_0x8f9d('0x41')]=[{'all':!![]}];}_0x4d581e=_[_0x8f9d('0x3e')]({},_0x4d581e,_0x3316fb['options']);return db[_0x8f9d('0x2c')][_0x8f9d('0x47')](_0x4d581e)[_0x8f9d('0x26')](handleEntityNotFound(_0x1e77e8,null))[_0x8f9d('0x26')](respondWithResult(_0x1e77e8,null))['catch'](handleError(_0x1e77e8,null));};exports[_0x8f9d('0x48')]=function(_0xd00398,_0x51f36e){return db['UserProfileSection'][_0x8f9d('0x48')](_0xd00398[_0x8f9d('0x49')],{})['then'](respondWithResult(_0x51f36e,0xc9))[_0x8f9d('0x44')](handleError(_0x51f36e,null));};exports[_0x8f9d('0x25')]=function(_0x2e450e,_0x43a6e5){if(_0x2e450e[_0x8f9d('0x49')]['id']){delete _0x2e450e[_0x8f9d('0x49')]['id'];}return db[_0x8f9d('0x2c')]['find']({'where':{'id':_0x2e450e['params']['id']}})[_0x8f9d('0x26')](handleEntityNotFound(_0x43a6e5,null))[_0x8f9d('0x26')](saveUpdates(_0x2e450e[_0x8f9d('0x49')],null))[_0x8f9d('0x26')](respondWithResult(_0x43a6e5,null))[_0x8f9d('0x44')](handleError(_0x43a6e5,null));};exports[_0x8f9d('0x4a')]=function(_0x6cc38,_0x3eaa68){return db[_0x8f9d('0x2c')][_0x8f9d('0x47')]({'where':{'id':_0x6cc38[_0x8f9d('0x45')]['id']}})[_0x8f9d('0x26')](handleEntityNotFound(_0x3eaa68,null))[_0x8f9d('0x26')](removeEntity(_0x3eaa68,null))[_0x8f9d('0x44')](handleError(_0x3eaa68,null));};exports['describe']=function(_0x3fa34f,_0xc869b0){return db[_0x8f9d('0x2c')][_0x8f9d('0x4b')]()[_0x8f9d('0x26')](respondWithResult(_0xc869b0,null))['catch'](handleError(_0xc869b0,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index bc71398..ef54692 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 _0x8a3b=['lodash','util','moment','bluebird','request-promise','path','../../config/environment','./userProfileSection.attributes','exports','define','compositeIndex','userProfileId'];(function(_0x3db4df,_0x1e53fe){var _0x4c6ec4=function(_0x4225de){while(--_0x4225de){_0x3db4df['push'](_0x3db4df['shift']());}};_0x4c6ec4(++_0x1e53fe);}(_0x8a3b,0x9c));var _0xb8a3=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x8a3b[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0xb8a3('0x0'));var util=require(_0xb8a3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb8a3('0x2'));var BPromise=require(_0xb8a3('0x3'));var rp=require(_0xb8a3('0x4'));var fs=require('fs');var path=require(_0xb8a3('0x5'));var rimraf=require('rimraf');var config=require(_0xb8a3('0x6'));var attributes=require(_0xb8a3('0x7'));module[_0xb8a3('0x8')]=function(_0x5d5461,_0x550b4d){return _0x5d5461[_0xb8a3('0x9')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xb8a3('0xa'),'fields':['sectionId',_0xb8a3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd9b4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xd9b4,0x1c0));var _0x4d9b=function(_0x319e1b,_0x2127d2){_0x319e1b=_0x319e1b-0x0;var _0x30850b=_0xd9b4[_0x319e1b];return _0x30850b;};'use strict';var _=require(_0x4d9b('0x0'));var util=require(_0x4d9b('0x1'));var logger=require(_0x4d9b('0x2'))(_0x4d9b('0x3'));var moment=require(_0x4d9b('0x4'));var BPromise=require(_0x4d9b('0x5'));var rp=require(_0x4d9b('0x6'));var fs=require('fs');var path=require(_0x4d9b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4d9b('0x8'));module['exports']=function(_0x1eb81c,_0x1583b0){return _0x1eb81c[_0x4d9b('0x9')](_0x4d9b('0xa'),attributes,{'tableName':_0x4d9b('0xb'),'paranoid':![],'indexes':[{'name':_0x4d9b('0xc'),'fields':['sectionId',_0x4d9b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index ba1f5e3..a0bb7c5 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 _0xa63f=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','UserProfileSection,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0xcd1a4a,_0x467550){var _0x134ea1=function(_0x22173f){while(--_0x22173f){_0xcd1a4a['push'](_0xcd1a4a['shift']());}};_0x134ea1(++_0x467550);}(_0xa63f,0x1b6));var _0xfa63=function(_0x327e47,_0x1f69a3){_0x327e47=_0x327e47-0x0;var _0xd2b5cd=_0xa63f[_0x327e47];return _0xd2b5cd;};'use strict';var _=require(_0xfa63('0x0'));var util=require(_0xfa63('0x1'));var moment=require(_0xfa63('0x2'));var BPromise=require(_0xfa63('0x3'));var rs=require(_0xfa63('0x4'));var fs=require('fs');var Redis=require(_0xfa63('0x5'));var db=require(_0xfa63('0x6'))['db'];var utils=require(_0xfa63('0x7'));var logger=require(_0xfa63('0x8'))(_0xfa63('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfa63('0xa')][_0xfa63('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb35bc5,_0x2dcf48,_0x486050){return new BPromise(function(_0x505e1a,_0x575b64){return client[_0xfa63('0xc')](_0xb35bc5,_0x486050)[_0xfa63('0xd')](function(_0x1bf230){logger['info'](_0xfa63('0xe'),_0x2dcf48,'request\x20sent');logger[_0xfa63('0xf')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2dcf48,_0xfa63('0x10'),JSON[_0xfa63('0x11')](_0x1bf230));if(_0x1bf230[_0xfa63('0x12')]){if(_0x1bf230[_0xfa63('0x12')][_0xfa63('0x13')]===0x1f4){logger[_0xfa63('0x12')](_0xfa63('0xe'),_0x2dcf48,_0x1bf230[_0xfa63('0x12')]['message']);return _0x575b64(_0x1bf230['error'][_0xfa63('0x14')]);}logger[_0xfa63('0x12')](_0xfa63('0xe'),_0x2dcf48,_0x1bf230['error'][_0xfa63('0x14')]);return _0x505e1a(_0x1bf230['error'][_0xfa63('0x14')]);}else{logger[_0xfa63('0x15')]('UserProfileSection,\x20%s,\x20%s',_0x2dcf48,_0xfa63('0x10'));_0x505e1a(_0x1bf230[_0xfa63('0x16')][_0xfa63('0x14')]);}})[_0xfa63('0x17')](function(_0x7d2ef5){logger[_0xfa63('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x2dcf48,_0x7d2ef5);_0x575b64(_0x7d2ef5);});});} \ No newline at end of file +var _0x51e2=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x7e4e90,_0x4b2115){var _0xcecb5b=function(_0x883e92){while(--_0x883e92){_0x7e4e90['push'](_0x7e4e90['shift']());}};_0xcecb5b(++_0x4b2115);}(_0x51e2,0x1cd));var _0x251e=function(_0x3c9e74,_0x23d34c){_0x3c9e74=_0x3c9e74-0x0;var _0x18ac85=_0x51e2[_0x3c9e74];return _0x18ac85;};'use strict';var _=require(_0x251e('0x0'));var util=require(_0x251e('0x1'));var moment=require(_0x251e('0x2'));var BPromise=require(_0x251e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x251e('0x4'));var db=require(_0x251e('0x5'))['db'];var utils=require(_0x251e('0x6'));var logger=require(_0x251e('0x7'))(_0x251e('0x8'));var config=require(_0x251e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x251e('0xa')][_0x251e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ff5fc,_0x543a11,_0x4c1321){return new BPromise(function(_0x3bc3f3,_0x181015){return client['request'](_0x1ff5fc,_0x4c1321)[_0x251e('0xc')](function(_0x3e90fa){logger['info'](_0x251e('0xd'),_0x543a11,_0x251e('0xe'));logger[_0x251e('0xf')](_0x251e('0x10'),_0x543a11,'request\x20sent',JSON['stringify'](_0x3e90fa));if(_0x3e90fa[_0x251e('0x11')]){if(_0x3e90fa['error'][_0x251e('0x12')]===0x1f4){logger[_0x251e('0x11')](_0x251e('0xd'),_0x543a11,_0x3e90fa['error']['message']);return _0x181015(_0x3e90fa['error'][_0x251e('0x13')]);}logger[_0x251e('0x11')](_0x251e('0xd'),_0x543a11,_0x3e90fa[_0x251e('0x11')]['message']);return _0x3bc3f3(_0x3e90fa['error'][_0x251e('0x13')]);}else{logger['info'](_0x251e('0xd'),_0x543a11,'request\x20sent');_0x3bc3f3(_0x3e90fa[_0x251e('0x14')][_0x251e('0x13')]);}})[_0x251e('0x15')](function(_0x2e955f){logger[_0x251e('0x11')](_0x251e('0xd'),_0x543a11,_0x2e955f);_0x181015(_0x2e955f);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 66bca24..652fc98 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x27ac04,_0x6d02cd){var _0x5440e6=function(_0x520480){while(--_0x520480){_0x27ac04['push'](_0x27ac04['shift']());}};_0x5440e6(++_0x6d02cd);}(_0xe706,0xa3));var _0x6e70=function(_0x347541,_0x137cf){_0x347541=_0x347541-0x0;var _0x5c0e38=_0xe706[_0x347541];return _0x5c0e38;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x41e7af,_0x5c841e){var _0x4de7e7=function(_0x239f30){while(--_0x239f30){_0x41e7af['push'](_0x41e7af['shift']());}};_0x4de7e7(++_0x5c841e);}(_0x70e0,0x17b));var _0x070e=function(_0x381452,_0x248adf){_0x381452=_0x381452-0x0;var _0x2ff6ee=_0x70e0[_0x381452];return _0x2ff6ee;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 4113ef7..36ce9d5 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 _0x2c8c=['exports','INTEGER','sequelize'];(function(_0x40bc4a,_0x2f4fa6){var _0x497b7a=function(_0x5b5202){while(--_0x5b5202){_0x40bc4a['push'](_0x40bc4a['shift']());}};_0x497b7a(++_0x2f4fa6);}(_0x2c8c,0x10d));var _0xc2c8=function(_0x4615a5,_0x4726d2){_0x4615a5=_0x4615a5-0x0;var _0x2bd585=_0x2c8c[_0x4615a5];return _0x2bd585;};'use strict';var Sequelize=require(_0xc2c8('0x0'));module[_0xc2c8('0x1')]={'penalty':{'type':Sequelize[_0xc2c8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7490=['INTEGER'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x7490,0x164));var _0x0749=function(_0x582ec5,_0x17ed4b){_0x582ec5=_0x582ec5-0x0;var _0x2c56b9=_0x7490[_0x582ec5];return _0x2c56b9;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x0749('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index f838580..f79d7c8 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 _0x430c=['user_has_sms_queues','lodash','api','moment','bluebird','./userSmsQueue.attributes','exports','UserSmsQueue'];(function(_0x39630c,_0x354072){var _0x4e3e5f=function(_0x3afbad){while(--_0x3afbad){_0x39630c['push'](_0x39630c['shift']());}};_0x4e3e5f(++_0x354072);}(_0x430c,0x1a1));var _0xc430=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0x430c[_0x1fc18b];return _0x16a351;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('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(_0xc430('0x4'));module[_0xc430('0x5')]=function(_0x50b256,_0x42aa9c){return _0x50b256['define'](_0xc430('0x6'),attributes,{'tableName':_0xc430('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1189=['./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x58fe2c,_0x5043bc){var _0x9218aa=function(_0x4517fb){while(--_0x4517fb){_0x58fe2c['push'](_0x58fe2c['shift']());}};_0x9218aa(++_0x5043bc);}(_0x1189,0x17f));var _0x9118=function(_0x2c39c3,_0x3d9848){_0x2c39c3=_0x2c39c3-0x0;var _0x74f703=_0x1189[_0x2c39c3];return _0x74f703;};'use strict';var _=require(_0x9118('0x0'));var util=require(_0x9118('0x1'));var logger=require(_0x9118('0x2'))(_0x9118('0x3'));var moment=require('moment');var BPromise=require(_0x9118('0x4'));var rp=require(_0x9118('0x5'));var fs=require('fs');var path=require(_0x9118('0x6'));var rimraf=require(_0x9118('0x7'));var config=require(_0x9118('0x8'));var attributes=require(_0x9118('0x9'));module[_0x9118('0xa')]=function(_0x499ee5,_0x124b4a){return _0x499ee5[_0x9118('0xb')](_0x9118('0xc'),attributes,{'tableName':_0x9118('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 2893a15..a6ee612 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 _0xdf7d=['client','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xdf7d,0x1ef));var _0xddf7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdf7d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xddf7('0x0'));var util=require(_0xddf7('0x1'));var moment=require(_0xddf7('0x2'));var BPromise=require(_0xddf7('0x3'));var rs=require(_0xddf7('0x4'));var fs=require('fs');var Redis=require(_0xddf7('0x5'));var db=require(_0xddf7('0x6'))['db'];var utils=require(_0xddf7('0x7'));var logger=require(_0xddf7('0x8'))('rpc');var config=require(_0xddf7('0x9'));var jayson=require(_0xddf7('0xa'));var client=jayson[_0xddf7('0xb')][_0xddf7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x533663,_0x41c314,_0x5adcbe){return new BPromise(function(_0x276877,_0x16b9e6){return client[_0xddf7('0xd')](_0x533663,_0x5adcbe)['then'](function(_0x1f9db9){logger[_0xddf7('0xe')](_0xddf7('0xf'),_0x41c314,_0xddf7('0x10'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x41c314,'request\x20sent',JSON[_0xddf7('0x11')](_0x1f9db9));if(_0x1f9db9['error']){if(_0x1f9db9['error'][_0xddf7('0x12')]===0x1f4){logger['error'](_0xddf7('0xf'),_0x41c314,_0x1f9db9[_0xddf7('0x13')]['message']);return _0x16b9e6(_0x1f9db9[_0xddf7('0x13')]['message']);}logger[_0xddf7('0x13')](_0xddf7('0xf'),_0x41c314,_0x1f9db9[_0xddf7('0x13')][_0xddf7('0x14')]);return _0x276877(_0x1f9db9[_0xddf7('0x13')]['message']);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x41c314,_0xddf7('0x10'));_0x276877(_0x1f9db9['result'][_0xddf7('0x14')]);}})[_0xddf7('0x15')](function(_0x55569d){logger['error'](_0xddf7('0xf'),_0x41c314,_0x55569d);_0x16b9e6(_0x55569d);});});} \ No newline at end of file +var _0xc027=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x57abed,_0x52ddc5){var _0x31098d=function(_0x3b77cf){while(--_0x3b77cf){_0x57abed['push'](_0x57abed['shift']());}};_0x31098d(++_0x52ddc5);}(_0xc027,0x1cc));var _0x7c02=function(_0x1f618f,_0x13e460){_0x1f618f=_0x1f618f-0x0;var _0x520d48=_0xc027[_0x1f618f];return _0x520d48;};'use strict';var _=require(_0x7c02('0x0'));var util=require(_0x7c02('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c02('0x2'));var db=require(_0x7c02('0x3'))['db'];var utils=require(_0x7c02('0x4'));var logger=require(_0x7c02('0x5'))(_0x7c02('0x6'));var config=require(_0x7c02('0x7'));var jayson=require(_0x7c02('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7d8636,_0x576bea,_0x44f9ec){return new BPromise(function(_0x634206,_0x46b44a){return client[_0x7c02('0x9')](_0x7d8636,_0x44f9ec)[_0x7c02('0xa')](function(_0x17a2b5){logger[_0x7c02('0xb')](_0x7c02('0xc'),_0x576bea,_0x7c02('0xd'));logger[_0x7c02('0xe')](_0x7c02('0xf'),_0x576bea,_0x7c02('0xd'),JSON[_0x7c02('0x10')](_0x17a2b5));if(_0x17a2b5[_0x7c02('0x11')]){if(_0x17a2b5[_0x7c02('0x11')][_0x7c02('0x12')]===0x1f4){logger[_0x7c02('0x11')](_0x7c02('0xc'),_0x576bea,_0x17a2b5[_0x7c02('0x11')][_0x7c02('0x13')]);return _0x46b44a(_0x17a2b5[_0x7c02('0x11')]['message']);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x576bea,_0x17a2b5[_0x7c02('0x11')][_0x7c02('0x13')]);return _0x634206(_0x17a2b5[_0x7c02('0x11')]['message']);}else{logger[_0x7c02('0xb')](_0x7c02('0xc'),_0x576bea,_0x7c02('0xd'));_0x634206(_0x17a2b5[_0x7c02('0x14')][_0x7c02('0x13')]);}})[_0x7c02('0x15')](function(_0x3f1c33){logger[_0x7c02('0x11')](_0x7c02('0xc'),_0x576bea,_0x3f1c33);_0x46b44a(_0x3f1c33);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 878367b..d261cd3 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 _0x4232=['INTEGER','exports'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x4232,0xa7));var _0x2423=function(_0x48686e,_0xb7f89c){_0x48686e=_0x48686e-0x0;var _0x110f7c=_0x4232[_0x48686e];return _0x110f7c;};'use strict';var Sequelize=require('sequelize');module[_0x2423('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x2423('0x1')]}}; \ No newline at end of file +var _0x0b7b=['INTEGER'];(function(_0x16016e,_0x3081a2){var _0x49afd5=function(_0x44d7bd){while(--_0x44d7bd){_0x16016e['push'](_0x16016e['shift']());}};_0x49afd5(++_0x3081a2);}(_0x0b7b,0x114));var _0xb0b7=function(_0x5b584b,_0x472849){_0x5b584b=_0x5b584b-0x0;var _0x34665c=_0x0b7b[_0x5b584b];return _0x34665c;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xb0b7('0x0')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 1e220cb..be4a708 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(_0xee5739,_0x3145cd){var _0xfab79=function(_0x3243b5){while(--_0x3243b5){_0xee5739['push'](_0xee5739['shift']());}};_0xfab79(++_0x3145cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x5c2f63,_0x2e5e94){var _0x9c1fb1=function(_0x3f0f34){while(--_0x3f0f34){_0x5c2f63['push'](_0x5c2f63['shift']());}};_0x9c1fb1(++_0x2e5e94);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 ca8e86e..053073f 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3afad3,_0x5266f8){var _0x4e55c6=function(_0x1100d7){while(--_0x1100d7){_0x3afad3['push'](_0x3afad3['shift']());}};_0x4e55c6(++_0x5266f8);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x32c3ce,_0x3ba144){var _0x30ec2a=function(_0x4a9b58){while(--_0x4a9b58){_0x32c3ce['push'](_0x32c3ce['shift']());}};_0x30ec2a(++_0x3ba144);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 964025e..c369d44 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 _0x980f=['exports','INTEGER','sequelize'];(function(_0x2fa007,_0x4e9b61){var _0x2d7a07=function(_0x1de027){while(--_0x1de027){_0x2fa007['push'](_0x2fa007['shift']());}};_0x2d7a07(++_0x4e9b61);}(_0x980f,0x194));var _0xf980=function(_0x48b819,_0x5159df){_0x48b819=_0x48b819-0x0;var _0x16b470=_0x980f[_0x48b819];return _0x16b470;};'use strict';var Sequelize=require(_0xf980('0x0'));module[_0xf980('0x1')]={'penalty':{'type':Sequelize[_0xf980('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb425=['INTEGER'];(function(_0x156af8,_0x55639c){var _0x54c3d8=function(_0x4a545c){while(--_0x4a545c){_0x156af8['push'](_0x156af8['shift']());}};_0x54c3d8(++_0x55639c);}(_0xb425,0xdb));var _0x5b42=function(_0x530439,_0x1cf440){_0x530439=_0x530439-0x0;var _0x22f539=_0xb425[_0x530439];return _0x22f539;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x5b42('0x0')],'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 44117f9..0661303 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 _0xe7ac=['util','../../config/logger','api','moment','request-promise','exports','define','UserVoiceQueue','user_has_voice_queues','lodash'];(function(_0xaf201e,_0x50cc49){var _0x3ef4c6=function(_0x16290a){while(--_0x16290a){_0xaf201e['push'](_0xaf201e['shift']());}};_0x3ef4c6(++_0x50cc49);}(_0xe7ac,0xc7));var _0xce7a=function(_0x40edb0,_0x12cca2){_0x40edb0=_0x40edb0-0x0;var _0x4d2471=_0xe7ac[_0x40edb0];return _0x4d2471;};'use strict';var _=require(_0xce7a('0x0'));var util=require(_0xce7a('0x1'));var logger=require(_0xce7a('0x2'))(_0xce7a('0x3'));var moment=require(_0xce7a('0x4'));var BPromise=require('bluebird');var rp=require(_0xce7a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0xce7a('0x6')]=function(_0x31ec1f,_0x1f3934){return _0x31ec1f[_0xce7a('0x7')](_0xce7a('0x8'),attributes,{'tableName':_0xce7a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5be=['UserVoiceQueue','user_has_voice_queues','util','../../config/logger','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x251e15,_0x49568a){var _0x2acd03=function(_0x4212ad){while(--_0x4212ad){_0x251e15['push'](_0x251e15['shift']());}};_0x2acd03(++_0x49568a);}(_0xd5be,0x11a));var _0xed5b=function(_0x784035,_0x318960){_0x784035=_0x784035-0x0;var _0x18eb99=_0xd5be[_0x784035];return _0x18eb99;};'use strict';var _=require('lodash');var util=require(_0xed5b('0x0'));var logger=require(_0xed5b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xed5b('0x2'));var rp=require(_0xed5b('0x3'));var fs=require('fs');var path=require(_0xed5b('0x4'));var rimraf=require(_0xed5b('0x5'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0xed5b('0x6')]=function(_0x574c83,_0x423b20){return _0x574c83[_0xed5b('0x7')](_0xed5b('0x8'),attributes,{'tableName':_0xed5b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 34fc1d1..c74d44d 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 _0x9ce4=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueue,\x20%s,\x20%s'];(function(_0x48b76e,_0x462a62){var _0x14c94e=function(_0xc44ae5){while(--_0xc44ae5){_0x48b76e['push'](_0x48b76e['shift']());}};_0x14c94e(++_0x462a62);}(_0x9ce4,0x1ca));var _0x49ce=function(_0x212dad,_0xb862ef){_0x212dad=_0x212dad-0x0;var _0x4fea3f=_0x9ce4[_0x212dad];return _0x4fea3f;};'use strict';var _=require(_0x49ce('0x0'));var util=require(_0x49ce('0x1'));var moment=require(_0x49ce('0x2'));var BPromise=require(_0x49ce('0x3'));var rs=require(_0x49ce('0x4'));var fs=require('fs');var Redis=require(_0x49ce('0x5'));var db=require(_0x49ce('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x49ce('0x7'))(_0x49ce('0x8'));var config=require(_0x49ce('0x9'));var jayson=require(_0x49ce('0xa'));var client=jayson[_0x49ce('0xb')][_0x49ce('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cfc2b,_0x3a8c30,_0x562af1){return new BPromise(function(_0x5b903b,_0x5f30e7){return client[_0x49ce('0xd')](_0x2cfc2b,_0x562af1)[_0x49ce('0xe')](function(_0x23d5ec){logger[_0x49ce('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x3a8c30,_0x49ce('0x10'));logger[_0x49ce('0x11')](_0x49ce('0x12'),_0x3a8c30,'request\x20sent',JSON[_0x49ce('0x13')](_0x23d5ec));if(_0x23d5ec[_0x49ce('0x14')]){if(_0x23d5ec[_0x49ce('0x14')]['code']===0x1f4){logger[_0x49ce('0x14')](_0x49ce('0x15'),_0x3a8c30,_0x23d5ec['error'][_0x49ce('0x16')]);return _0x5f30e7(_0x23d5ec[_0x49ce('0x14')][_0x49ce('0x16')]);}logger[_0x49ce('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x3a8c30,_0x23d5ec[_0x49ce('0x14')][_0x49ce('0x16')]);return _0x5b903b(_0x23d5ec[_0x49ce('0x14')]['message']);}else{logger[_0x49ce('0xf')](_0x49ce('0x15'),_0x3a8c30,_0x49ce('0x10'));_0x5b903b(_0x23d5ec['result']['message']);}})[_0x49ce('0x17')](function(_0x4acf05){logger['error'](_0x49ce('0x15'),_0x3a8c30,_0x4acf05);_0x5f30e7(_0x4acf05);});});} \ No newline at end of file +var _0xf312=['request','then','info','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x439ebe,_0x4c22d7){var _0x95e104=function(_0x3e1f4d){while(--_0x3e1f4d){_0x439ebe['push'](_0x439ebe['shift']());}};_0x95e104(++_0x4c22d7);}(_0xf312,0x1f0));var _0x2f31=function(_0x48426e,_0x134855){_0x48426e=_0x48426e-0x0;var _0x3a7162=_0xf312[_0x48426e];return _0x3a7162;};'use strict';var _=require('lodash');var util=require(_0x2f31('0x0'));var moment=require(_0x2f31('0x1'));var BPromise=require(_0x2f31('0x2'));var rs=require(_0x2f31('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f31('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2f31('0x5'));var config=require(_0x2f31('0x6'));var jayson=require(_0x2f31('0x7'));var client=jayson[_0x2f31('0x8')][_0x2f31('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f9373,_0x50e187,_0x596612){return new BPromise(function(_0x525eb9,_0xf82b04){return client[_0x2f31('0xa')](_0x4f9373,_0x596612)[_0x2f31('0xb')](function(_0x352510){logger[_0x2f31('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x50e187,'request\x20sent');logger[_0x2f31('0xd')](_0x2f31('0xe'),_0x50e187,_0x2f31('0xf'),JSON[_0x2f31('0x10')](_0x352510));if(_0x352510['error']){if(_0x352510[_0x2f31('0x11')]['code']===0x1f4){logger[_0x2f31('0x11')](_0x2f31('0x12'),_0x50e187,_0x352510[_0x2f31('0x11')][_0x2f31('0x13')]);return _0xf82b04(_0x352510['error'][_0x2f31('0x13')]);}logger[_0x2f31('0x11')](_0x2f31('0x12'),_0x50e187,_0x352510[_0x2f31('0x11')]['message']);return _0x525eb9(_0x352510[_0x2f31('0x11')]['message']);}else{logger[_0x2f31('0xc')](_0x2f31('0x12'),_0x50e187,'request\x20sent');_0x525eb9(_0x352510[_0x2f31('0x14')]['message']);}})[_0x2f31('0x15')](function(_0x2fbcb7){logger[_0x2f31('0x11')](_0x2f31('0x12'),_0x50e187,_0x2fbcb7);_0xf82b04(_0x2fbcb7);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 0e96f0b..c6124f9 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x29a6da,_0x220c30){var _0x41caa8=function(_0x1ca7aa){while(--_0x1ca7aa){_0x29a6da['push'](_0x29a6da['shift']());}};_0x41caa8(++_0x220c30);}(_0xedd9,0xfc));var _0x9edd=function(_0xd9ace,_0x48d9e0){_0xd9ace=_0xd9ace-0x0;var _0x3a8260=_0xedd9[_0xd9ace];return _0x3a8260;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x22664d,_0x2f94a1){var _0x3680a4=function(_0x1e8485){while(--_0x1e8485){_0x22664d['push'](_0x22664d['shift']());}};_0x3680a4(++_0x2f94a1);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 325afb0..5299e9b 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 _0xd680=['sequelize','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x3b5430,_0x3fbe53){var _0x314d0f=function(_0x4c0379){while(--_0x4c0379){_0x3b5430['push'](_0x3b5430['shift']());}};_0x314d0f(++_0x3fbe53);}(_0xd680,0xaf));var _0x0d68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd680[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0d68('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0d68('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0d68('0x2')},'membername':{'type':Sequelize[_0x0d68('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x0d68('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x0d68('0x2')},'VoiceQueueId':{'type':Sequelize[_0x0d68('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x0d68('0x3')],'allowNull':![],'unique':_0x0d68('0x4'),'comment':_0x0d68('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x0d68('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xf333=['exports','Required\x20by\x20Asterisk','INTEGER','STRING','queue_interface'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0xf333,0x163));var _0x3f33=function(_0x41a2e5,_0x458217){_0x41a2e5=_0x41a2e5-0x0;var _0x464d21=_0xf333[_0x41a2e5];return _0x464d21;};'use strict';var Sequelize=require('sequelize');module[_0x3f33('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3f33('0x1')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x3f33('0x1')},'UserId':{'type':Sequelize[_0x3f33('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3f33('0x3')],'allowNull':![],'unique':_0x3f33('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x3f33('0x3')],'allowNull':![],'unique':_0x3f33('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x3f33('0x2')](0xb),'defaultValue':0x0,'comment':_0x3f33('0x1')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x3f33('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 563ec64..32bc834 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 _0x1680=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x434743,_0x4c1dcb){var _0x1b9adf=function(_0x445a4e){while(--_0x445a4e){_0x434743['push'](_0x434743['shift']());}};_0x1b9adf(++_0x4c1dcb);}(_0x1680,0x163));var _0x0168=function(_0x4a7e98,_0x250137){_0x4a7e98=_0x4a7e98-0x0;var _0x27d10d=_0x1680[_0x4a7e98];return _0x27d10d;};'use strict';var EventEmitter=require(_0x0168('0x0'));var UserVoiceQueueRt=require(_0x0168('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0168('0x2'),'afterUpdate':_0x0168('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5c76e7){return function(_0x23798,_0x9785a9,_0x3c4e6a){UserVoiceQueueRtEvents['emit'](_0x5c76e7+':'+_0x23798['id'],_0x23798);UserVoiceQueueRtEvents[_0x0168('0x4')](_0x5c76e7,_0x23798);_0x3c4e6a(null);};}for(var e in events){if(events[_0x0168('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x0168('0x6')](e,emitEvent(event));}}module[_0x0168('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x067c=['hook','exports','events','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x450fbc,_0x34e3be){var _0x5d4691=function(_0x4565f8){while(--_0x4565f8){_0x450fbc['push'](_0x450fbc['shift']());}};_0x5d4691(++_0x34e3be);}(_0x067c,0x1da));var _0xc067=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x067c[_0x50bf5a];return _0x4ddc1d;};'use strict';var EventEmitter=require(_0xc067('0x0'));var UserVoiceQueueRt=require(_0xc067('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc067('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc067('0x3')};function emitEvent(_0x47d6af){return function(_0x9f25f8,_0x27f0f6,_0x55c2db){UserVoiceQueueRtEvents['emit'](_0x47d6af+':'+_0x9f25f8['id'],_0x9f25f8);UserVoiceQueueRtEvents[_0xc067('0x4')](_0x47d6af,_0x9f25f8);_0x55c2db(null);};}for(var e in events){if(events[_0xc067('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xc067('0x6')](e,emitEvent(event));}}module[_0xc067('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 365341a..d6284f0 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 _0x077c=['bluebird','request-promise','path','rimraf','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','api','moment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x077c,0x19f));var _0xc077=function(_0x51f371,_0x876a24){_0x51f371=_0x51f371-0x0;var _0x11188e=_0x077c[_0x51f371];return _0x11188e;};'use strict';var _=require('lodash');var util=require(_0xc077('0x0'));var logger=require('../../config/logger')(_0xc077('0x1'));var moment=require(_0xc077('0x2'));var BPromise=require(_0xc077('0x3'));var rp=require(_0xc077('0x4'));var fs=require('fs');var path=require(_0xc077('0x5'));var rimraf=require(_0xc077('0x6'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0xc077('0x7')]=function(_0xe16dc2,_0x532125){return _0xe16dc2[_0xc077('0x8')](_0xc077('0x9'),attributes,{'tableName':_0xc077('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca8a=['user_has_voice_queues_rt','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt'];(function(_0x45513e,_0x433f83){var _0x59331f=function(_0x3d2c8c){while(--_0x3d2c8c){_0x45513e['push'](_0x45513e['shift']());}};_0x59331f(++_0x433f83);}(_0xca8a,0x153));var _0xaca8=function(_0x469730,_0x4f6adf){_0x469730=_0x469730-0x0;var _0x3123f0=_0xca8a[_0x469730];return _0x3123f0;};'use strict';var _=require('lodash');var util=require(_0xaca8('0x0'));var logger=require(_0xaca8('0x1'))('api');var moment=require(_0xaca8('0x2'));var BPromise=require(_0xaca8('0x3'));var rp=require(_0xaca8('0x4'));var fs=require('fs');var path=require(_0xaca8('0x5'));var rimraf=require(_0xaca8('0x6'));var config=require(_0xaca8('0x7'));var attributes=require(_0xaca8('0x8'));module[_0xaca8('0x9')]=function(_0x43a779,_0x318210){return _0x43a779[_0xaca8('0xa')](_0xaca8('0xb'),attributes,{'tableName':_0xaca8('0xc'),'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 bf122ed..5902c93 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 _0x076a=['outboundQueuePauses','then','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','redis','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','`paused`\x20=\x201,\x201,\x20null'];(function(_0x3c858f,_0x235201){var _0x198090=function(_0xc4c406){while(--_0xc4c406){_0x3c858f['push'](_0x3c858f['shift']());}};_0x198090(++_0x235201);}(_0x076a,0x7e));var _0xa076=function(_0x276232,_0x20b6b8){_0x276232=_0x276232-0x0;var _0x427024=_0x076a[_0x276232];return _0x427024;};'use strict';var _=require(_0xa076('0x0'));var util=require(_0xa076('0x1'));var moment=require(_0xa076('0x2'));var BPromise=require(_0xa076('0x3'));var rs=require(_0xa076('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa076('0x5'))(_0xa076('0x6'));var config=require('../../config/environment');var jayson=require(_0xa076('0x7'));var client=jayson[_0xa076('0x8')][_0xa076('0x9')]({'port':0x232a});config[_0xa076('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa076('0xa')]));require('./userVoiceQueueRt.socket')[_0xa076('0xb')](socket);function respondWithRpcPromise(_0x38bcf5,_0x5c4206,_0x32d63c){return new BPromise(function(_0x5e1354,_0x218038){return client[_0xa076('0xc')](_0x38bcf5,_0x32d63c)['then'](function(_0x378c2b){logger[_0xa076('0xd')](_0xa076('0xe'),_0x5c4206,_0xa076('0xf'));logger[_0xa076('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x5c4206,_0xa076('0xf'),JSON['stringify'](_0x378c2b));if(_0x378c2b[_0xa076('0x11')]){if(_0x378c2b[_0xa076('0x11')][_0xa076('0x12')]===0x1f4){logger['error'](_0xa076('0xe'),_0x5c4206,_0x378c2b[_0xa076('0x11')][_0xa076('0x13')]);return _0x218038(_0x378c2b[_0xa076('0x11')]['message']);}logger[_0xa076('0x11')](_0xa076('0xe'),_0x5c4206,_0x378c2b[_0xa076('0x11')][_0xa076('0x13')]);return _0x5e1354(_0x378c2b['error'][_0xa076('0x13')]);}else{logger[_0xa076('0xd')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5c4206,_0xa076('0xf'));_0x5e1354(_0x378c2b[_0xa076('0x14')]['message']);}})[_0xa076('0x15')](function(_0x2920c9){logger[_0xa076('0x11')](_0xa076('0xe'),_0x5c4206,_0x2920c9);_0x218038(_0x2920c9);});});}exports[_0xa076('0x16')]=function(_0xc32342){var _0x207ce3=this;return new Promise(function(_0x5da46e,_0x401996){return db['UserVoiceQueueRt'][_0xa076('0x17')]({'raw':_0xc32342[_0xa076('0x18')]?_0xc32342[_0xa076('0x18')][_0xa076('0x19')]===undefined?!![]:![]:!![],'where':_0xc32342[_0xa076('0x18')]?_0xc32342[_0xa076('0x18')][_0xa076('0x1a')]||null:null,'attributes':[[db[_0xa076('0x1b')]['fn']('COUNT',db[_0xa076('0x1b')]['fn']('IF',db[_0xa076('0x1b')]['literal'](_0xa076('0x1c')))),_0xa076('0x1d')]]})[_0xa076('0x1e')](function(_0x526b8e){logger[_0xa076('0xd')](_0xa076('0x16'),_0xc32342);logger[_0xa076('0x10')]('GetVoiceQueueRtPauses',_0xc32342,JSON['stringify'](_0x526b8e));_0x5da46e(_0x526b8e);})[_0xa076('0x15')](function(_0x168b3e){logger[_0xa076('0x11')]('GetVoiceQueueRtPauses',_0x168b3e['message'],_0xc32342);_0x401996(_0x207ce3['error'](0x1f4,_0x168b3e[_0xa076('0x13')]));});});}; \ No newline at end of file +var _0x25e8=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch'];(function(_0x45f1af,_0x38afb7){var _0x5cb0dc=function(_0x44b7f9){while(--_0x44b7f9){_0x45f1af['push'](_0x45f1af['shift']());}};_0x5cb0dc(++_0x38afb7);}(_0x25e8,0x138));var _0x825e=function(_0x581a29,_0x1291c5){_0x581a29=_0x581a29-0x0;var _0x3f6823=_0x25e8[_0x581a29];return _0x3f6823;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x825e('0x0'));var BPromise=require(_0x825e('0x1'));var rs=require(_0x825e('0x2'));var fs=require('fs');var Redis=require(_0x825e('0x3'));var db=require(_0x825e('0x4'))['db'];var utils=require(_0x825e('0x5'));var logger=require(_0x825e('0x6'))(_0x825e('0x7'));var config=require(_0x825e('0x8'));var jayson=require(_0x825e('0x9'));var client=jayson[_0x825e('0xa')][_0x825e('0xb')]({'port':0x232a});config['redis']=_[_0x825e('0xc')](config['redis'],{'host':_0x825e('0xd'),'port':0x18eb});var socket=require(_0x825e('0xe'))(new Redis(config[_0x825e('0xf')]));require(_0x825e('0x10'))[_0x825e('0x11')](socket);function respondWithRpcPromise(_0x451cc0,_0x38914f,_0x110830){return new BPromise(function(_0x198d21,_0x532a22){return client[_0x825e('0x12')](_0x451cc0,_0x110830)['then'](function(_0x9a2357){logger[_0x825e('0x13')](_0x825e('0x14'),_0x38914f,_0x825e('0x15'));logger[_0x825e('0x16')](_0x825e('0x17'),_0x38914f,_0x825e('0x15'),JSON[_0x825e('0x18')](_0x9a2357));if(_0x9a2357[_0x825e('0x19')]){if(_0x9a2357[_0x825e('0x19')]['code']===0x1f4){logger[_0x825e('0x19')](_0x825e('0x14'),_0x38914f,_0x9a2357['error'][_0x825e('0x1a')]);return _0x532a22(_0x9a2357['error']['message']);}logger[_0x825e('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x38914f,_0x9a2357['error'][_0x825e('0x1a')]);return _0x198d21(_0x9a2357[_0x825e('0x19')][_0x825e('0x1a')]);}else{logger[_0x825e('0x13')](_0x825e('0x14'),_0x38914f,_0x825e('0x15'));_0x198d21(_0x9a2357[_0x825e('0x1b')][_0x825e('0x1a')]);}})['catch'](function(_0x87d08d){logger[_0x825e('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x38914f,_0x87d08d);_0x532a22(_0x87d08d);});});}exports[_0x825e('0x1c')]=function(_0xbf2fc1){var _0x418783=this;return new Promise(function(_0x11ecd3,_0x2572be){return db['UserVoiceQueueRt'][_0x825e('0x1d')]({'raw':_0xbf2fc1[_0x825e('0x1e')]?_0xbf2fc1[_0x825e('0x1e')][_0x825e('0x1f')]===undefined?!![]:![]:!![],'where':_0xbf2fc1['options']?_0xbf2fc1[_0x825e('0x1e')][_0x825e('0x20')]||null:null,'attributes':[[db[_0x825e('0x21')]['fn'](_0x825e('0x22'),db[_0x825e('0x21')]['fn']('IF',db[_0x825e('0x21')][_0x825e('0x23')](_0x825e('0x24')))),_0x825e('0x25')]]})['then'](function(_0x2f53bf){logger[_0x825e('0x13')](_0x825e('0x1c'),_0xbf2fc1);logger[_0x825e('0x16')](_0x825e('0x1c'),_0xbf2fc1,JSON['stringify'](_0x2f53bf));_0x11ecd3(_0x2f53bf);})[_0x825e('0x26')](function(_0xdbe52){logger['error']('GetVoiceQueueRtPauses',_0xdbe52['message'],_0xbf2fc1);_0x2572be(_0x418783[_0x825e('0x19')](0x1f4,_0xdbe52[_0x825e('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 5ca6c10..d996fed 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 _0x79bf=['register','length','userVoiceQueueRt:','save','update','emit','removeListener'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0x79bf,0x1df));var _0xf79b=function(_0x5cb6f3,_0x4085bc){_0x5cb6f3=_0x5cb6f3-0x0;var _0x225ffe=_0x79bf[_0x5cb6f3];return _0x225ffe;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xf79b('0x0'),'remove',_0xf79b('0x1')];function createListener(_0x4fc21b,_0x41c72b){return function(_0x142a13){_0x41c72b[_0xf79b('0x2')](_0x4fc21b,_0x142a13);};}function removeListener(_0x193fad,_0x44bff1){return function(){UserVoiceQueueRtEvents[_0xf79b('0x3')](_0x193fad,_0x44bff1);};}exports[_0xf79b('0x4')]=function(_0x5de87a){for(var _0x377b85=0x0,_0x44e02b=events[_0xf79b('0x5')];_0x377b85<_0x44e02b;_0x377b85++){var _0x5cf15e=events[_0x377b85];var _0x290738=createListener(_0xf79b('0x6')+_0x5cf15e,_0x5de87a);UserVoiceQueueRtEvents['on'](_0x5cf15e,_0x290738);}}; \ No newline at end of file +var _0xb234=['save','update','removeListener','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x48e6f1,_0x1bd3e8){var _0x154ae1=function(_0x253b58){while(--_0x253b58){_0x48e6f1['push'](_0x48e6f1['shift']());}};_0x154ae1(++_0x1bd3e8);}(_0xb234,0x13f));var _0x4b23=function(_0x4afb88,_0x4db931){_0x4afb88=_0x4afb88-0x0;var _0x5f55ba=_0xb234[_0x4afb88];return _0x5f55ba;};'use strict';var UserVoiceQueueRtEvents=require(_0x4b23('0x0'));var events=[_0x4b23('0x1'),'remove',_0x4b23('0x2')];function createListener(_0xdc6d0a,_0x28cbfe){return function(_0x5570ad){_0x28cbfe['emit'](_0xdc6d0a,_0x5570ad);};}function removeListener(_0x5557dc,_0x36c95e){return function(){UserVoiceQueueRtEvents[_0x4b23('0x3')](_0x5557dc,_0x36c95e);};}exports['register']=function(_0x3767b1){for(var _0x538204=0x0,_0x34a49f=events['length'];_0x538204<_0x34a49f;_0x538204++){var _0x48fc53=events[_0x538204];var _0xc81b6a=createListener(_0x4b23('0x4')+_0x48fc53,_0x3767b1);UserVoiceQueueRtEvents['on'](_0x48fc53,_0xc81b6a);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index efcefe8..ec3ff67 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2ab859,_0x285aaa){var _0xded5c4=function(_0x595ab9){while(--_0x595ab9){_0x2ab859['push'](_0x2ab859['shift']());}};_0xded5c4(++_0x285aaa);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x508d15,_0x4d4c05){var _0x18bcfb=function(_0x29aff5){while(--_0x29aff5){_0x508d15['push'](_0x508d15['shift']());}};_0x18bcfb(++_0x4d4c05);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index d25b463..10ce61d 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 _0x045c=['sequelize','exports','INTEGER'];(function(_0x13b443,_0xb5e589){var _0x536aba=function(_0x2f0d08){while(--_0x2f0d08){_0x13b443['push'](_0x13b443['shift']());}};_0x536aba(++_0xb5e589);}(_0x045c,0x75));var _0xc045=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x045c[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require(_0xc045('0x0'));module[_0xc045('0x1')]={'penalty':{'type':Sequelize[_0xc045('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x090b=['sequelize','INTEGER'];(function(_0x492700,_0xa751ce){var _0x63e3d8=function(_0x454799){while(--_0x454799){_0x492700['push'](_0x492700['shift']());}};_0x63e3d8(++_0xa751ce);}(_0x090b,0x13e));var _0xb090=function(_0x4c7792,_0x1dc3db){_0x4c7792=_0x4c7792-0x0;var _0x15c976=_0x090b[_0x4c7792];return _0x15c976;};'use strict';var Sequelize=require(_0xb090('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xb090('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index e19d4c8..8ab86fe 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 _0x8909=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x11dc0f,_0xadaf4d){var _0x32956e=function(_0x33d6ee){while(--_0x33d6ee){_0x11dc0f['push'](_0x11dc0f['shift']());}};_0x32956e(++_0xadaf4d);}(_0x8909,0x104));var _0x9890=function(_0x4e697a,_0x56a14b){_0x4e697a=_0x4e697a-0x0;var _0x88850c=_0x8909[_0x4e697a];return _0x88850c;};'use strict';var _=require(_0x9890('0x0'));var util=require(_0x9890('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9890('0x2'));var BPromise=require(_0x9890('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9890('0x4'));var rimraf=require(_0x9890('0x5'));var config=require(_0x9890('0x6'));var attributes=require(_0x9890('0x7'));module['exports']=function(_0x26a06e,_0x1c1206){return _0x26a06e['define'](_0x9890('0x8'),attributes,{'tableName':_0x9890('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc3f=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util'];(function(_0xafdc66,_0x3e02f9){var _0x44f3d7=function(_0x282eaf){while(--_0x282eaf){_0xafdc66['push'](_0xafdc66['shift']());}};_0x44f3d7(++_0x3e02f9);}(_0xdc3f,0xa3));var _0xfdc3=function(_0x2db757,_0x1c5c7f){_0x2db757=_0x2db757-0x0;var _0x283373=_0xdc3f[_0x2db757];return _0x283373;};'use strict';var _=require(_0xfdc3('0x0'));var util=require(_0xfdc3('0x1'));var logger=require(_0xfdc3('0x2'))(_0xfdc3('0x3'));var moment=require('moment');var BPromise=require(_0xfdc3('0x4'));var rp=require(_0xfdc3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfdc3('0x6'));var config=require(_0xfdc3('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0xfdc3('0x8')]=function(_0x4639f9,_0x585940){return _0x4639f9['define'](_0xfdc3('0x9'),attributes,{'tableName':_0xfdc3('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 4cd13b2..b2c3b4b 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 _0x24a9=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x2bfc61,_0x395804){var _0x203c2a=function(_0x3e7d15){while(--_0x3e7d15){_0x2bfc61['push'](_0x2bfc61['shift']());}};_0x203c2a(++_0x395804);}(_0x24a9,0x139));var _0x924a=function(_0x3f2da1,_0x5be9f7){_0x3f2da1=_0x3f2da1-0x0;var _0x1f4e72=_0x24a9[_0x3f2da1];return _0x1f4e72;};'use strict';var _=require(_0x924a('0x0'));var util=require(_0x924a('0x1'));var moment=require(_0x924a('0x2'));var BPromise=require(_0x924a('0x3'));var rs=require(_0x924a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x924a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x924a('0x6'))(_0x924a('0x7'));var config=require(_0x924a('0x8'));var jayson=require(_0x924a('0x9'));var client=jayson[_0x924a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25d515,_0x4cc5fe,_0x24045d){return new BPromise(function(_0x1f1314,_0x1412a0){return client[_0x924a('0xb')](_0x25d515,_0x24045d)[_0x924a('0xc')](function(_0x4b07c4){logger['info'](_0x924a('0xd'),_0x4cc5fe,_0x924a('0xe'));logger[_0x924a('0xf')](_0x924a('0x10'),_0x4cc5fe,_0x924a('0xe'),JSON[_0x924a('0x11')](_0x4b07c4));if(_0x4b07c4[_0x924a('0x12')]){if(_0x4b07c4[_0x924a('0x12')][_0x924a('0x13')]===0x1f4){logger[_0x924a('0x12')](_0x924a('0xd'),_0x4cc5fe,_0x4b07c4['error'][_0x924a('0x14')]);return _0x1412a0(_0x4b07c4['error']['message']);}logger[_0x924a('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4cc5fe,_0x4b07c4[_0x924a('0x12')]['message']);return _0x1f1314(_0x4b07c4[_0x924a('0x12')][_0x924a('0x14')]);}else{logger[_0x924a('0x15')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4cc5fe,_0x924a('0xe'));_0x1f1314(_0x4b07c4[_0x924a('0x16')][_0x924a('0x14')]);}})[_0x924a('0x17')](function(_0x3d96c7){logger[_0x924a('0x12')](_0x924a('0xd'),_0x4cc5fe,_0x3d96c7);_0x1412a0(_0x3d96c7);});});} \ No newline at end of file +var _0x2a57=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x719e78,_0x1b97fb){var _0x44867a=function(_0x2a5553){while(--_0x2a5553){_0x719e78['push'](_0x719e78['shift']());}};_0x44867a(++_0x1b97fb);}(_0x2a57,0x7d));var _0x72a5=function(_0x23c6f2,_0x4e033c){_0x23c6f2=_0x23c6f2-0x0;var _0x4c270b=_0x2a57[_0x23c6f2];return _0x4c270b;};'use strict';var _=require(_0x72a5('0x0'));var util=require(_0x72a5('0x1'));var moment=require(_0x72a5('0x2'));var BPromise=require(_0x72a5('0x3'));var rs=require(_0x72a5('0x4'));var fs=require('fs');var Redis=require(_0x72a5('0x5'));var db=require(_0x72a5('0x6'))['db'];var utils=require(_0x72a5('0x7'));var logger=require('../../config/logger')(_0x72a5('0x8'));var config=require(_0x72a5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x72a5('0xa')][_0x72a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2aef4b,_0x3fc17d,_0x30a545){return new BPromise(function(_0x319d1b,_0x50497f){return client[_0x72a5('0xc')](_0x2aef4b,_0x30a545)[_0x72a5('0xd')](function(_0x54a26a){logger[_0x72a5('0xe')](_0x72a5('0xf'),_0x3fc17d,_0x72a5('0x10'));logger[_0x72a5('0x11')](_0x72a5('0x12'),_0x3fc17d,'request\x20sent',JSON[_0x72a5('0x13')](_0x54a26a));if(_0x54a26a[_0x72a5('0x14')]){if(_0x54a26a[_0x72a5('0x14')][_0x72a5('0x15')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x3fc17d,_0x54a26a[_0x72a5('0x14')][_0x72a5('0x16')]);return _0x50497f(_0x54a26a[_0x72a5('0x14')]['message']);}logger[_0x72a5('0x14')](_0x72a5('0xf'),_0x3fc17d,_0x54a26a[_0x72a5('0x14')]['message']);return _0x319d1b(_0x54a26a[_0x72a5('0x14')][_0x72a5('0x16')]);}else{logger[_0x72a5('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3fc17d,_0x72a5('0x10'));_0x319d1b(_0x54a26a[_0x72a5('0x17')]['message']);}})[_0x72a5('0x18')](function(_0x160d25){logger[_0x72a5('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3fc17d,_0x160d25);_0x50497f(_0x160d25);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index e7e3b1f..bb9f225 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 _0xe5b3=['update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','isAuthenticated','show','post','/:id'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3649cd,_0x5de63f){_0x3649cd=_0x3649cd-0x0;var _0x1edc58=_0xe5b3[_0x3649cd];return _0x1edc58;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var fs_extra=require(_0x3e5b('0x5'));var auth=require(_0x3e5b('0x6'));var interaction=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var controller=require(_0x3e5b('0x9'));router[_0x3e5b('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0xa')]('/:id',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0xd')]);router[_0x3e5b('0xe')]('/',auth[_0x3e5b('0xc')](),controller['create']);router['put'](_0x3e5b('0xf'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x10')]);router[_0x3e5b('0x11')](_0x3e5b('0xf'),auth['isAuthenticated'](),controller[_0x3e5b('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd5b2=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports'];(function(_0x504cef,_0x4f0be7){var _0x4b013b=function(_0x3373cd){while(--_0x3373cd){_0x504cef['push'](_0x504cef['shift']());}};_0x4b013b(++_0x4f0be7);}(_0xd5b2,0x10e));var _0x2d5b=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xd5b2[_0x42245d];return _0x4b211a;};'use strict';var multer=require('multer');var util=require(_0x2d5b('0x0'));var path=require(_0x2d5b('0x1'));var timeout=require('connect-timeout');var express=require(_0x2d5b('0x2'));var router=express[_0x2d5b('0x3')]();var fs_extra=require(_0x2d5b('0x4'));var auth=require(_0x2d5b('0x5'));var interaction=require(_0x2d5b('0x6'));var config=require(_0x2d5b('0x7'));var controller=require('./variable.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2d5b('0x8')]);router['get'](_0x2d5b('0x9'),auth['isAuthenticated'](),controller[_0x2d5b('0xa')]);router['post']('/',auth[_0x2d5b('0xb')](),controller[_0x2d5b('0xc')]);router[_0x2d5b('0xd')](_0x2d5b('0x9'),auth[_0x2d5b('0xb')](),controller[_0x2d5b('0xe')]);router[_0x2d5b('0xf')](_0x2d5b('0x9'),auth[_0x2d5b('0xb')](),controller[_0x2d5b('0x10')]);module[_0x2d5b('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 186787a..2d47b00 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 _0x9362=['STRING','sequelize'];(function(_0x3f6b19,_0xfe00c8){var _0x464762=function(_0x4fcda6){while(--_0x4fcda6){_0x3f6b19['push'](_0x3f6b19['shift']());}};_0x464762(++_0xfe00c8);}(_0x9362,0x169));var _0x2936=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9362[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x2936('0x0'));module['exports']={'name':{'type':Sequelize[_0x2936('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2936('0x1')]}}; \ No newline at end of file +var _0x3e38=['sequelize','exports','name','STRING'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x3e38,0x68));var _0x83e3=function(_0x3a631d,_0x38667f){_0x3a631d=_0x3a631d-0x0;var _0x5a89fc=_0x3e38[_0x3a631d];return _0x5a89fc;};'use strict';var Sequelize=require(_0x83e3('0x0'));module[_0x83e3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x83e3('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x83e3('0x3')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 3812cce..b7bfe30 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 _0xa188=['includeAll','findAll','rows','catch','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','index','map','Variable','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','merge','where','filter','options'];(function(_0x389e67,_0x2ec6d2){var _0x57e9de=function(_0x5b157f){while(--_0x5b157f){_0x389e67['push'](_0x389e67['shift']());}};_0x57e9de(++_0x2ec6d2);}(_0xa188,0x157));var _0x8a18=function(_0x4940e2,_0x1df025){_0x4940e2=_0x4940e2-0x0;var _0x520f40=_0xa188[_0x4940e2];return _0x520f40;};'use strict';var emlformat=require(_0x8a18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a18('0x1'));var jsonpatch=require(_0x8a18('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8a18('0x3'));var util=require(_0x8a18('0x4'));var path=require(_0x8a18('0x5'));var sox=require('sox');var csv=require(_0x8a18('0x6'));var ejs=require(_0x8a18('0x7'));var fs=require('fs');var fs_extra=require(_0x8a18('0x8'));var _=require(_0x8a18('0x9'));var squel=require(_0x8a18('0xa'));var crypto=require(_0x8a18('0xb'));var jsforce=require(_0x8a18('0xc'));var deskjs=require(_0x8a18('0xd'));var toCsv=require(_0x8a18('0x6'));var querystring=require(_0x8a18('0xe'));var Papa=require(_0x8a18('0xf'));var Redis=require('ioredis');var authService=require(_0x8a18('0x10'));var qs=require(_0x8a18('0x11'));var as=require(_0x8a18('0x12'));var hardwareService=require(_0x8a18('0x13'));var logger=require(_0x8a18('0x14'))(_0x8a18('0x15'));var utils=require(_0x8a18('0x16'));var config=require(_0x8a18('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8a18('0x18'))['db'];function respondWithStatusCode(_0x5c4df3,_0x337345){_0x337345=_0x337345||0xcc;return function(_0x567d1a){if(_0x567d1a){return _0x5c4df3[_0x8a18('0x19')](_0x337345);}return _0x5c4df3[_0x8a18('0x1a')](_0x337345)['end']();};}function respondWithResult(_0x265457,_0x351f88){_0x351f88=_0x351f88||0xc8;return function(_0x183abd){if(_0x183abd){return _0x265457[_0x8a18('0x1a')](_0x351f88)[_0x8a18('0x1b')](_0x183abd);}};}function respondWithFilteredResult(_0xe93d78,_0x56c0d7){return function(_0x59b5f6){if(_0x59b5f6){var _0x3ed2a9=typeof _0x56c0d7[_0x8a18('0x1c')]==='undefined'&&typeof _0x56c0d7[_0x8a18('0x1d')]===_0x8a18('0x1e');var _0x3065a1=_0x59b5f6[_0x8a18('0x1f')];var _0x274fb3=_0x3ed2a9?0x0:_0x56c0d7[_0x8a18('0x1c')];var _0x181441=_0x3ed2a9?_0x59b5f6[_0x8a18('0x1f')]:_0x56c0d7[_0x8a18('0x1c')]+_0x56c0d7['limit'];var _0x197f52;if(_0x181441>=_0x3065a1){_0x181441=_0x3065a1;_0x197f52=0xc8;}else{_0x197f52=0xce;}_0xe93d78[_0x8a18('0x1a')](_0x197f52);return _0xe93d78[_0x8a18('0x20')](_0x8a18('0x21'),_0x274fb3+'-'+_0x181441+'/'+_0x3065a1)['json'](_0x59b5f6);}return null;};}function patchUpdates(_0x352c9c){return function(_0x109da1){try{jsonpatch[_0x8a18('0x22')](_0x109da1,_0x352c9c,!![]);}catch(_0x159c78){return BPromise[_0x8a18('0x23')](_0x159c78);}return _0x109da1[_0x8a18('0x24')]();};}function saveUpdates(_0x1ca3ed,_0x571355){return function(_0x3703dc){if(_0x3703dc){return _0x3703dc[_0x8a18('0x25')](_0x1ca3ed)[_0x8a18('0x26')](function(_0x26d87e){return _0x26d87e;});}return null;};}function removeEntity(_0x35bc7b,_0x4c3af9){return function(_0x4f4331){if(_0x4f4331){return _0x4f4331[_0x8a18('0x27')]()[_0x8a18('0x26')](function(){var _0x52a3e4=_0x4f4331[_0x8a18('0x28')]({'plain':!![]});var _0x68af9c=_0x8a18('0x29');return db[_0x8a18('0x2a')]['destroy']({'where':{'type':_0x68af9c,'resourceId':_0x52a3e4['id']}})['then'](function(){return _0x4f4331;});})[_0x8a18('0x26')](function(){_0x35bc7b[_0x8a18('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8739a6,_0x2ebd82){return function(_0x4d6493){if(!_0x4d6493){_0x8739a6['sendStatus'](0x194);}return _0x4d6493;};}function handleError(_0x132bf1,_0x4c3251){_0x4c3251=_0x4c3251||0x1f4;return function(_0x5187cc){logger[_0x8a18('0x2b')](_0x5187cc[_0x8a18('0x2c')]);if(_0x5187cc[_0x8a18('0x2d')]){delete _0x5187cc[_0x8a18('0x2d')];}_0x132bf1[_0x8a18('0x1a')](_0x4c3251)['send'](_0x5187cc);};}exports[_0x8a18('0x2e')]=function(_0x457922,_0x305a1c){var _0xcab47c={},_0x2c9f91={},_0x556500={'count':0x0,'rows':[]};var _0x439651=_[_0x8a18('0x2f')](db[_0x8a18('0x30')][_0x8a18('0x31')],function(_0x9f31b3){return{'name':_0x9f31b3[_0x8a18('0x32')],'type':_0x9f31b3[_0x8a18('0x33')][_0x8a18('0x34')]};});_0x2c9f91[_0x8a18('0x35')]=_['map'](_0x439651,_0x8a18('0x2d'));_0x2c9f91['query']=_['keys'](_0x457922[_0x8a18('0x36')]);_0x2c9f91[_0x8a18('0x37')]=_['intersection'](_0x2c9f91['model'],_0x2c9f91['query']);_0xcab47c[_0x8a18('0x38')]=_[_0x8a18('0x39')](_0x2c9f91[_0x8a18('0x35')],qs[_0x8a18('0x3a')](_0x457922[_0x8a18('0x36')][_0x8a18('0x3a')]));_0xcab47c[_0x8a18('0x38')]=_0xcab47c[_0x8a18('0x38')][_0x8a18('0x3b')]?_0xcab47c[_0x8a18('0x38')]:_0x2c9f91['model'];if(!_0x457922[_0x8a18('0x36')]['hasOwnProperty'](_0x8a18('0x3c'))){_0xcab47c[_0x8a18('0x1d')]=qs[_0x8a18('0x1d')](_0x457922[_0x8a18('0x36')]['limit']);_0xcab47c[_0x8a18('0x1c')]=qs[_0x8a18('0x1c')](_0x457922[_0x8a18('0x36')]['offset']);}_0xcab47c[_0x8a18('0x3d')]=qs['sort'](_0x457922[_0x8a18('0x36')][_0x8a18('0x3e')]);_0xcab47c['where']=qs['filters'](_['pick'](_0x457922[_0x8a18('0x36')],_0x2c9f91[_0x8a18('0x37')]),_0x439651);if(_0x457922['query']['filter']){_0xcab47c['where']=_[_0x8a18('0x3f')](_0xcab47c[_0x8a18('0x40')],{'$or':_[_0x8a18('0x2f')](_0x439651,function(_0x2045e4){if(_0x2045e4[_0x8a18('0x33')]!=='VIRTUAL'){var _0x40eaa7={};_0x40eaa7[_0x2045e4['name']]={'$like':'%'+_0x457922['query'][_0x8a18('0x41')]+'%'};return _0x40eaa7;}})});}_0xcab47c=_[_0x8a18('0x3f')]({},_0xcab47c,_0x457922[_0x8a18('0x42')]);var _0x44e49a={'where':_0xcab47c[_0x8a18('0x40')]};return db['Variable'][_0x8a18('0x1f')](_0x44e49a)[_0x8a18('0x26')](function(_0x31da68){_0x556500[_0x8a18('0x1f')]=_0x31da68;if(_0x457922[_0x8a18('0x36')][_0x8a18('0x43')]){_0xcab47c['include']=[{'all':!![]}];}return db[_0x8a18('0x30')][_0x8a18('0x44')](_0xcab47c);})['then'](function(_0x1ee71c){_0x556500[_0x8a18('0x45')]=_0x1ee71c;return _0x556500;})[_0x8a18('0x26')](respondWithFilteredResult(_0x305a1c,_0xcab47c))[_0x8a18('0x46')](handleError(_0x305a1c,null));};exports['show']=function(_0x6b02c0,_0x580c64){var _0x36c6b6={'raw':!![],'where':{'id':_0x6b02c0['params']['id']}},_0x238cb0={};_0x238cb0['model']=_['keys'](db['Variable']['rawAttributes']);_0x238cb0[_0x8a18('0x36')]=_['keys'](_0x6b02c0[_0x8a18('0x36')]);_0x238cb0[_0x8a18('0x37')]=_[_0x8a18('0x39')](_0x238cb0[_0x8a18('0x35')],_0x238cb0['query']);_0x36c6b6[_0x8a18('0x38')]=_['intersection'](_0x238cb0[_0x8a18('0x35')],qs[_0x8a18('0x3a')](_0x6b02c0[_0x8a18('0x36')][_0x8a18('0x3a')]));_0x36c6b6[_0x8a18('0x38')]=_0x36c6b6['attributes'][_0x8a18('0x3b')]?_0x36c6b6['attributes']:_0x238cb0['model'];if(_0x6b02c0['query'][_0x8a18('0x43')]){_0x36c6b6[_0x8a18('0x47')]=[{'all':!![]}];}_0x36c6b6=_[_0x8a18('0x3f')]({},_0x36c6b6,_0x6b02c0[_0x8a18('0x42')]);return db[_0x8a18('0x30')][_0x8a18('0x48')](_0x36c6b6)[_0x8a18('0x26')](handleEntityNotFound(_0x580c64,null))['then'](respondWithResult(_0x580c64,null))['catch'](handleError(_0x580c64,null));};exports[_0x8a18('0x49')]=function(_0x3f80f7,_0x5129a1){return db[_0x8a18('0x30')][_0x8a18('0x49')](_0x3f80f7[_0x8a18('0x4a')],{})[_0x8a18('0x26')](function(_0x59cdc3){var _0x3db3bb=_0x3f80f7[_0x8a18('0x4b')][_0x8a18('0x28')]({'plain':!![]});if(!_0x3db3bb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3db3bb[_0x8a18('0x4c')]===_0x8a18('0x4b')){var _0x1680f1=_0x59cdc3[_0x8a18('0x28')]({'plain':!![]});var _0x37d782='Variables';return db[_0x8a18('0x4d')]['find']({'where':{'name':_0x37d782,'userProfileId':_0x3db3bb[_0x8a18('0x4e')]},'raw':!![]})[_0x8a18('0x26')](function(_0x450175){if(_0x450175&&_0x450175[_0x8a18('0x4f')]===0x0){return db[_0x8a18('0x2a')][_0x8a18('0x49')]({'name':_0x1680f1['name'],'resourceId':_0x1680f1['id'],'type':_0x450175[_0x8a18('0x2d')],'sectionId':_0x450175['id']},{})[_0x8a18('0x26')](function(){return _0x59cdc3;});}else{return _0x59cdc3;}})[_0x8a18('0x46')](function(_0x2eb578){logger[_0x8a18('0x2b')](_0x8a18('0x50'),_0x2eb578);throw _0x2eb578;});}return _0x59cdc3;})[_0x8a18('0x26')](respondWithResult(_0x5129a1,0xc9))[_0x8a18('0x46')](handleError(_0x5129a1,null));};exports[_0x8a18('0x25')]=function(_0x4af9df,_0x395704){if(_0x4af9df[_0x8a18('0x4a')]['id']){delete _0x4af9df[_0x8a18('0x4a')]['id'];}return db[_0x8a18('0x30')][_0x8a18('0x48')]({'where':{'id':_0x4af9df[_0x8a18('0x51')]['id']}})[_0x8a18('0x26')](handleEntityNotFound(_0x395704,null))[_0x8a18('0x26')](saveUpdates(_0x4af9df[_0x8a18('0x4a')],null))['then'](respondWithResult(_0x395704,null))['catch'](handleError(_0x395704,null));};exports['destroy']=function(_0x56e901,_0x51350a){return db[_0x8a18('0x30')][_0x8a18('0x48')]({'where':{'id':_0x56e901[_0x8a18('0x51')]['id']}})['then'](handleEntityNotFound(_0x51350a,null))[_0x8a18('0x26')](removeEntity(_0x51350a,null))[_0x8a18('0x46')](handleError(_0x51350a,null));}; \ No newline at end of file +var _0x5d05=['json','limit','undefined','count','offset','set','Content-Range','save','update','then','get','Variables','UserProfileResource','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Variable','includeAll','include','findAll','rows','params','intersection','length','find','catch','create','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status'];(function(_0x2e7d7f,_0x504c82){var _0x46e384=function(_0xb7d912){while(--_0xb7d912){_0x2e7d7f['push'](_0x2e7d7f['shift']());}};_0x46e384(++_0x504c82);}(_0x5d05,0x173));var _0x55d0=function(_0x13e04d,_0x40a506){_0x13e04d=_0x13e04d-0x0;var _0x2b0a95=_0x5d05[_0x13e04d];return _0x2b0a95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x55d0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x55d0('0x1'));var rp=require(_0x55d0('0x2'));var moment=require('moment');var BPromise=require(_0x55d0('0x3'));var Mustache=require(_0x55d0('0x4'));var util=require(_0x55d0('0x5'));var path=require(_0x55d0('0x6'));var sox=require(_0x55d0('0x7'));var csv=require(_0x55d0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x55d0('0x9'));var squel=require('squel');var crypto=require(_0x55d0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x55d0('0xb'));var toCsv=require('to-csv');var querystring=require(_0x55d0('0xc'));var Papa=require(_0x55d0('0xd'));var Redis=require('ioredis');var authService=require(_0x55d0('0xe'));var qs=require(_0x55d0('0xf'));var as=require(_0x55d0('0x10'));var hardwareService=require(_0x55d0('0x11'));var logger=require(_0x55d0('0x12'))(_0x55d0('0x13'));var utils=require(_0x55d0('0x14'));var config=require(_0x55d0('0x15'));var licenseUtil=require(_0x55d0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46ab25,_0x3878f1){_0x3878f1=_0x3878f1||0xcc;return function(_0x26e26a){if(_0x26e26a){return _0x46ab25['sendStatus'](_0x3878f1);}return _0x46ab25[_0x55d0('0x17')](_0x3878f1)['end']();};}function respondWithResult(_0x14b811,_0x266e91){_0x266e91=_0x266e91||0xc8;return function(_0x302088){if(_0x302088){return _0x14b811['status'](_0x266e91)[_0x55d0('0x18')](_0x302088);}};}function respondWithFilteredResult(_0xace50c,_0x5c40d1){return function(_0x3a926b){if(_0x3a926b){var _0x5c6b20=typeof _0x5c40d1['offset']==='undefined'&&typeof _0x5c40d1[_0x55d0('0x19')]===_0x55d0('0x1a');var _0x41c2ea=_0x3a926b[_0x55d0('0x1b')];var _0xad8710=_0x5c6b20?0x0:_0x5c40d1[_0x55d0('0x1c')];var _0x224b25=_0x5c6b20?_0x3a926b[_0x55d0('0x1b')]:_0x5c40d1['offset']+_0x5c40d1[_0x55d0('0x19')];var _0x364062;if(_0x224b25>=_0x41c2ea){_0x224b25=_0x41c2ea;_0x364062=0xc8;}else{_0x364062=0xce;}_0xace50c[_0x55d0('0x17')](_0x364062);return _0xace50c[_0x55d0('0x1d')](_0x55d0('0x1e'),_0xad8710+'-'+_0x224b25+'/'+_0x41c2ea)[_0x55d0('0x18')](_0x3a926b);}return null;};}function patchUpdates(_0x3917a4){return function(_0x3605db){try{jsonpatch['apply'](_0x3605db,_0x3917a4,!![]);}catch(_0x1499e1){return BPromise['reject'](_0x1499e1);}return _0x3605db[_0x55d0('0x1f')]();};}function saveUpdates(_0x4c9608,_0x2fb9c4){return function(_0x1c2d3a){if(_0x1c2d3a){return _0x1c2d3a[_0x55d0('0x20')](_0x4c9608)[_0x55d0('0x21')](function(_0x23ac69){return _0x23ac69;});}return null;};}function removeEntity(_0x1ce404,_0x4493d8){return function(_0x5e0a1c){if(_0x5e0a1c){return _0x5e0a1c['destroy']()[_0x55d0('0x21')](function(){var _0x219351=_0x5e0a1c[_0x55d0('0x22')]({'plain':!![]});var _0x2c71ff=_0x55d0('0x23');return db[_0x55d0('0x24')][_0x55d0('0x25')]({'where':{'type':_0x2c71ff,'resourceId':_0x219351['id']}})[_0x55d0('0x21')](function(){return _0x5e0a1c;});})[_0x55d0('0x21')](function(){_0x1ce404[_0x55d0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x806007,_0x55ac52){return function(_0x13178a){if(!_0x13178a){_0x806007['sendStatus'](0x194);}return _0x13178a;};}function handleError(_0xb1399,_0x48bebb){_0x48bebb=_0x48bebb||0x1f4;return function(_0x336e5f){logger[_0x55d0('0x26')](_0x336e5f[_0x55d0('0x27')]);if(_0x336e5f[_0x55d0('0x28')]){delete _0x336e5f['name'];}_0xb1399[_0x55d0('0x17')](_0x48bebb)[_0x55d0('0x29')](_0x336e5f);};}exports[_0x55d0('0x2a')]=function(_0x4a2224,_0x7f2bc0){var _0x33cc79={},_0x13face={},_0x11280a={'count':0x0,'rows':[]};var _0x505a7=_[_0x55d0('0x2b')](db['Variable']['rawAttributes'],function(_0x4f6d4e){return{'name':_0x4f6d4e[_0x55d0('0x2c')],'type':_0x4f6d4e[_0x55d0('0x2d')][_0x55d0('0x2e')]};});_0x13face[_0x55d0('0x2f')]=_[_0x55d0('0x2b')](_0x505a7,'name');_0x13face[_0x55d0('0x30')]=_[_0x55d0('0x31')](_0x4a2224[_0x55d0('0x30')]);_0x13face[_0x55d0('0x32')]=_['intersection'](_0x13face[_0x55d0('0x2f')],_0x13face[_0x55d0('0x30')]);_0x33cc79[_0x55d0('0x33')]=_['intersection'](_0x13face[_0x55d0('0x2f')],qs[_0x55d0('0x34')](_0x4a2224[_0x55d0('0x30')]['fields']));_0x33cc79[_0x55d0('0x33')]=_0x33cc79[_0x55d0('0x33')]['length']?_0x33cc79[_0x55d0('0x33')]:_0x13face[_0x55d0('0x2f')];if(!_0x4a2224['query'][_0x55d0('0x35')](_0x55d0('0x36'))){_0x33cc79[_0x55d0('0x19')]=qs[_0x55d0('0x19')](_0x4a2224[_0x55d0('0x30')][_0x55d0('0x19')]);_0x33cc79[_0x55d0('0x1c')]=qs[_0x55d0('0x1c')](_0x4a2224[_0x55d0('0x30')][_0x55d0('0x1c')]);}_0x33cc79[_0x55d0('0x37')]=qs[_0x55d0('0x38')](_0x4a2224[_0x55d0('0x30')][_0x55d0('0x38')]);_0x33cc79[_0x55d0('0x39')]=qs[_0x55d0('0x32')](_['pick'](_0x4a2224['query'],_0x13face[_0x55d0('0x32')]),_0x505a7);if(_0x4a2224['query'][_0x55d0('0x3a')]){_0x33cc79[_0x55d0('0x39')]=_[_0x55d0('0x3b')](_0x33cc79[_0x55d0('0x39')],{'$or':_[_0x55d0('0x2b')](_0x505a7,function(_0x2c7c48){if(_0x2c7c48[_0x55d0('0x2d')]!==_0x55d0('0x3c')){var _0x29b1b5={};_0x29b1b5[_0x2c7c48[_0x55d0('0x28')]]={'$like':'%'+_0x4a2224[_0x55d0('0x30')][_0x55d0('0x3a')]+'%'};return _0x29b1b5;}})});}_0x33cc79=_['merge']({},_0x33cc79,_0x4a2224[_0x55d0('0x3d')]);var _0xc678bc={'where':_0x33cc79['where']};return db[_0x55d0('0x3e')]['count'](_0xc678bc)[_0x55d0('0x21')](function(_0x5a4258){_0x11280a['count']=_0x5a4258;if(_0x4a2224[_0x55d0('0x30')][_0x55d0('0x3f')]){_0x33cc79[_0x55d0('0x40')]=[{'all':!![]}];}return db[_0x55d0('0x3e')][_0x55d0('0x41')](_0x33cc79);})[_0x55d0('0x21')](function(_0xedf2d0){_0x11280a[_0x55d0('0x42')]=_0xedf2d0;return _0x11280a;})['then'](respondWithFilteredResult(_0x7f2bc0,_0x33cc79))['catch'](handleError(_0x7f2bc0,null));};exports['show']=function(_0x5c73f7,_0x2628a7){var _0x4cd616={'raw':!![],'where':{'id':_0x5c73f7[_0x55d0('0x43')]['id']}},_0x51690a={};_0x51690a[_0x55d0('0x2f')]=_[_0x55d0('0x31')](db[_0x55d0('0x3e')]['rawAttributes']);_0x51690a[_0x55d0('0x30')]=_[_0x55d0('0x31')](_0x5c73f7[_0x55d0('0x30')]);_0x51690a[_0x55d0('0x32')]=_[_0x55d0('0x44')](_0x51690a['model'],_0x51690a[_0x55d0('0x30')]);_0x4cd616['attributes']=_[_0x55d0('0x44')](_0x51690a[_0x55d0('0x2f')],qs['fields'](_0x5c73f7[_0x55d0('0x30')]['fields']));_0x4cd616[_0x55d0('0x33')]=_0x4cd616[_0x55d0('0x33')][_0x55d0('0x45')]?_0x4cd616[_0x55d0('0x33')]:_0x51690a[_0x55d0('0x2f')];if(_0x5c73f7[_0x55d0('0x30')][_0x55d0('0x3f')]){_0x4cd616[_0x55d0('0x40')]=[{'all':!![]}];}_0x4cd616=_['merge']({},_0x4cd616,_0x5c73f7[_0x55d0('0x3d')]);return db[_0x55d0('0x3e')][_0x55d0('0x46')](_0x4cd616)['then'](handleEntityNotFound(_0x2628a7,null))[_0x55d0('0x21')](respondWithResult(_0x2628a7,null))[_0x55d0('0x47')](handleError(_0x2628a7,null));};exports[_0x55d0('0x48')]=function(_0x391009,_0xebb014){return db['Variable'][_0x55d0('0x48')](_0x391009['body'],{})[_0x55d0('0x21')](function(_0x381c51){var _0x2bb070=_0x391009['user'][_0x55d0('0x22')]({'plain':!![]});if(!_0x2bb070)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2bb070[_0x55d0('0x49')]===_0x55d0('0x4a')){var _0x25f9e0=_0x381c51[_0x55d0('0x22')]({'plain':!![]});var _0x3e83c0='Variables';return db['UserProfileSection'][_0x55d0('0x46')]({'where':{'name':_0x3e83c0,'userProfileId':_0x2bb070[_0x55d0('0x4b')]},'raw':!![]})[_0x55d0('0x21')](function(_0x1eeccc){if(_0x1eeccc&&_0x1eeccc[_0x55d0('0x4c')]===0x0){return db['UserProfileResource'][_0x55d0('0x48')]({'name':_0x25f9e0[_0x55d0('0x28')],'resourceId':_0x25f9e0['id'],'type':_0x1eeccc['name'],'sectionId':_0x1eeccc['id']},{})[_0x55d0('0x21')](function(){return _0x381c51;});}else{return _0x381c51;}})[_0x55d0('0x47')](function(_0x3c3cb0){logger[_0x55d0('0x26')](_0x55d0('0x4d'),_0x3c3cb0);throw _0x3c3cb0;});}return _0x381c51;})[_0x55d0('0x21')](respondWithResult(_0xebb014,0xc9))[_0x55d0('0x47')](handleError(_0xebb014,null));};exports[_0x55d0('0x20')]=function(_0x4b17cd,_0x334d6f){if(_0x4b17cd[_0x55d0('0x4e')]['id']){delete _0x4b17cd['body']['id'];}return db[_0x55d0('0x3e')][_0x55d0('0x46')]({'where':{'id':_0x4b17cd['params']['id']}})[_0x55d0('0x21')](handleEntityNotFound(_0x334d6f,null))[_0x55d0('0x21')](saveUpdates(_0x4b17cd['body'],null))[_0x55d0('0x21')](respondWithResult(_0x334d6f,null))[_0x55d0('0x47')](handleError(_0x334d6f,null));};exports['destroy']=function(_0x25029a,_0x25e969){return db[_0x55d0('0x3e')]['find']({'where':{'id':_0x25029a['params']['id']}})[_0x55d0('0x21')](handleEntityNotFound(_0x25e969,null))[_0x55d0('0x21')](removeEntity(_0x25e969,null))['catch'](handleError(_0x25e969,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 9828264..becbfed 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 _0x8a25=['../../config/environment','./variable.attributes','define','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x210a40,_0x29bf92){var _0x5a327e=function(_0x4e4f51){while(--_0x4e4f51){_0x210a40['push'](_0x210a40['shift']());}};_0x5a327e(++_0x29bf92);}(_0x8a25,0xcb));var _0x58a2=function(_0x545617,_0x478a51){_0x545617=_0x545617-0x0;var _0x320909=_0x8a25[_0x545617];return _0x320909;};'use strict';var _=require(_0x58a2('0x0'));var util=require(_0x58a2('0x1'));var logger=require('../../config/logger')(_0x58a2('0x2'));var moment=require(_0x58a2('0x3'));var BPromise=require(_0x58a2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x58a2('0x5'));var rimraf=require(_0x58a2('0x6'));var config=require(_0x58a2('0x7'));var attributes=require(_0x58a2('0x8'));module['exports']=function(_0x21f3ff,_0x154122){return _0x21f3ff[_0x58a2('0x9')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4ec=['request-promise','rimraf','../../config/environment','exports','define','Variable','tools_variables','lodash','util','api','moment','bluebird'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xa4ec,0x16f));var _0xca4e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa4ec[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0xca4e('0x0'));var util=require(_0xca4e('0x1'));var logger=require('../../config/logger')(_0xca4e('0x2'));var moment=require(_0xca4e('0x3'));var BPromise=require(_0xca4e('0x4'));var rp=require(_0xca4e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca4e('0x6'));var config=require(_0xca4e('0x7'));var attributes=require('./variable.attributes');module[_0xca4e('0x8')]=function(_0x5defdd,_0xa8803){return _0x5defdd[_0xca4e('0x9')](_0xca4e('0xa'),attributes,{'tableName':_0xca4e('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 f6e3a18..2542042 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 _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x326f,0xd1));var _0xf326=function(_0x5e94c4,_0x21704c){_0x5e94c4=_0x5e94c4-0x0;var _0x38cf34=_0x326f[_0x5e94c4];return _0x38cf34;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Variable,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x1ff9c6,_0xe0ba0b){var _0x59b933=function(_0x4bc010){while(--_0x4bc010){_0x1ff9c6['push'](_0x1ff9c6['shift']());}};_0x59b933(++_0xe0ba0b);}(_0x7217,0x19e));var _0x7721=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x7217[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Variable,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 507b786..dd962cb 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 _0xdd86=['fetch','reset','/pull','isAuthenticated','restart','/migrations','migrations','express','Router','../../components/auth/service','./version.controller','get','canUpdate'];(function(_0x546328,_0x56dd97){var _0x1aeddf=function(_0x755e2e){while(--_0x755e2e){_0x546328['push'](_0x546328['shift']());}};_0x1aeddf(++_0x56dd97);}(_0xdd86,0x180));var _0x6dd8=function(_0x35a3c6,_0x551d51){_0x35a3c6=_0x35a3c6-0x0;var _0x2874d3=_0xdd86[_0x35a3c6];return _0x2874d3;};'use strict';var express=require(_0x6dd8('0x0'));var router=express[_0x6dd8('0x1')]();var auth=require(_0x6dd8('0x2'));var controller=require(_0x6dd8('0x3'));router[_0x6dd8('0x4')]('/',controller['index']);router['get']('/fetch',auth['isAuthenticated'](),auth[_0x6dd8('0x5')](),controller[_0x6dd8('0x6')]);router[_0x6dd8('0x4')]('/reset',auth['isAuthenticated'](),auth[_0x6dd8('0x5')](),controller[_0x6dd8('0x7')]);router[_0x6dd8('0x4')](_0x6dd8('0x8'),auth[_0x6dd8('0x9')](),auth['canUpdate'](),controller['pull']);router['get']('/restart',auth['isAuthenticated'](),controller[_0x6dd8('0xa')]);router[_0x6dd8('0x4')](_0x6dd8('0xb'),controller[_0x6dd8('0xc')]);module['exports']=router; \ No newline at end of file +var _0x709f=['Router','../../components/auth/service','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','/pull','pull','restart','/migrations','migrations','exports','express'];(function(_0x201e87,_0xa8f701){var _0x2446b0=function(_0xce9901){while(--_0xce9901){_0x201e87['push'](_0x201e87['shift']());}};_0x2446b0(++_0xa8f701);}(_0x709f,0x65));var _0xf709=function(_0x514bd1,_0x25ea3e){_0x514bd1=_0x514bd1-0x0;var _0x58a281=_0x709f[_0x514bd1];return _0x58a281;};'use strict';var express=require(_0xf709('0x0'));var router=express[_0xf709('0x1')]();var auth=require(_0xf709('0x2'));var controller=require('./version.controller');router[_0xf709('0x3')]('/',controller[_0xf709('0x4')]);router[_0xf709('0x3')](_0xf709('0x5'),auth[_0xf709('0x6')](),auth['canUpdate'](),controller[_0xf709('0x7')]);router[_0xf709('0x3')](_0xf709('0x8'),auth[_0xf709('0x6')](),auth[_0xf709('0x9')](),controller[_0xf709('0xa')]);router[_0xf709('0x3')](_0xf709('0xb'),auth[_0xf709('0x6')](),auth[_0xf709('0x9')](),controller[_0xf709('0xc')]);router['get']('/restart',auth[_0xf709('0x6')](),controller[_0xf709('0xd')]);router['get'](_0xf709('0xe'),controller[_0xf709('0xf')]);module[_0xf709('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 85a2c64..2541853 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 _0x5e5f=['sort','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','join','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/logger','simple-git','index','exports','query','latest','fetch','2.0.0','json','status','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','root','server','length','replace','.js','push'];(function(_0x1ab3bd,_0x157f49){var _0x4a7367=function(_0x1867f7){while(--_0x1867f7){_0x1ab3bd['push'](_0x1ab3bd['shift']());}};_0x4a7367(++_0x157f49);}(_0x5e5f,0x70));var _0xf5e5=function(_0x18b506,_0x39fe99){_0x18b506=_0x18b506-0x0;var _0x32f715=_0x5e5f[_0x18b506];return _0x32f715;};'use strict';var Umzug=require(_0xf5e5('0x0'));var path=require(_0xf5e5('0x1'));var fs=require('fs');var _=require(_0xf5e5('0x2'));var pkginfo=require(_0xf5e5('0x3'))(module,_0xf5e5('0x4'));var compareVersions=require(_0xf5e5('0x5'));var exec=require(_0xf5e5('0x6'))[_0xf5e5('0x7')];var db=require(_0xf5e5('0x8'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0xf5e5('0x9'))('update');var git=require(_0xf5e5('0xa'))(config['root']);exports[_0xf5e5('0xb')]=function(_0x5cbe31,_0x3cf236){var _0x58c8c5={'current':module[_0xf5e5('0xc')][_0xf5e5('0x4')],'phonebar':0x2};if(_0x5cbe31[_0xf5e5('0xd')]&&_0x5cbe31[_0xf5e5('0xd')][_0xf5e5('0xe')]){return git[_0xf5e5('0xf')]()['tags'](function(_0x3dc4be,_0xb8fef){_0x58c8c5['latest']=(_0x3dc4be?module['exports'][_0xf5e5('0x4')]:_0xb8fef['latest'])||_0xf5e5('0x10');return _0x3cf236['status'](0xc8)[_0xf5e5('0x11')](_0x58c8c5);});}else{return _0x3cf236[_0xf5e5('0x12')](0xc8)[_0xf5e5('0x11')](_0x58c8c5);}};exports[_0xf5e5('0xf')]=function(_0x585031,_0x445923){return git[_0xf5e5('0xf')](['origin',_0xf5e5('0x13')],function(_0xe4cf31){if(_0xe4cf31){logger[_0xf5e5('0x14')](_0xe4cf31);return _0x445923[_0xf5e5('0x12')](0x1f4)[_0xf5e5('0x11')](_0xe4cf31);}logger[_0xf5e5('0x15')](_0xf5e5('0x16'));return _0x445923[_0xf5e5('0x12')](0xc8)['json']({'output':_0xf5e5('0x17')});});};exports['reset']=function(_0x35112b,_0x3e4896){return git[_0xf5e5('0x18')](['--hard','FETCH_HEAD'],function(_0x3aea6c){if(_0x3aea6c){logger[_0xf5e5('0x14')](_0x3aea6c);return _0x3e4896[_0xf5e5('0x12')](0x1f4)['json'](_0x3aea6c);}logger[_0xf5e5('0x15')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3e4896[_0xf5e5('0x12')](0xc8)['json']({'output':_0xf5e5('0x19')});});};exports[_0xf5e5('0x1a')]=function(_0x42be76,_0x2674b6){exec(_0xf5e5('0x1b'),function(_0x2aca93,_0x577470,_0x5738e1){logger[_0xf5e5('0x15')](_0x577470);logger[_0xf5e5('0x15')](_0x5738e1);if(_0x2aca93){logger[_0xf5e5('0x14')](_0x2aca93);return _0x2674b6[_0xf5e5('0x12')](0x1f4)[_0xf5e5('0x11')](_0x2aca93);}return _0x2674b6[_0xf5e5('0x12')](0xc8)[_0xf5e5('0x11')]({'output':_0x577470});});};exports[_0xf5e5('0x1c')]=function(_0x2998c6,_0x51ec0f){return pm2[_0xf5e5('0x1c')](_0xf5e5('0x1d'))[_0xf5e5('0x1e')](function(_0x4d02a6){logger[_0xf5e5('0x15')]('pm2\x20restart\x20motion\x20%s',_0x4d02a6);return _0x51ec0f[_0xf5e5('0x12')](0xc8)['json']({'output':_0xf5e5('0x1f')});})[_0xf5e5('0x20')](function(_0xfbad19){logger['error'](_0xfbad19);return _0x51ec0f[_0xf5e5('0x12')](0x1f4)[_0xf5e5('0x11')](_0xfbad19);});};exports[_0xf5e5('0x21')]=function(_0x20ad07,_0x2178d1){var _0x3334d7=fs[_0xf5e5('0x22')](path['join'](config[_0xf5e5('0x23')],_0xf5e5('0x24'),_0xf5e5('0x21')));var _0x2f6b2a=[];for(var _0x599a19=0x0;_0x599a19<_0x3334d7[_0xf5e5('0x25')];_0x599a19++){var _0x55038c=_0x3334d7[_0x599a19][_0xf5e5('0x26')](_0xf5e5('0x27'),'');if(compareVersions(module[_0xf5e5('0xc')]['version'],_0x55038c)===-0x1){_0x2f6b2a[_0xf5e5('0x28')](_0x55038c);}}if(_0x2f6b2a[_0xf5e5('0x25')]){var _0x55cf48=_0x2f6b2a[_0xf5e5('0x29')](compareVersions);var _0x46dc4b=new Umzug({'storage':_0xf5e5('0x2a'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0xf5e5('0x2a')][_0xf5e5('0x2b')](),db[_0xf5e5('0x2a')][_0xf5e5('0x2c')],function(){throw new Error(_0xf5e5('0x2d'));}],'path':path['join'](config['root'],_0xf5e5('0x24'),_0xf5e5('0x21')),'pattern':/\.js$/}});_0x46dc4b['up']({'migrations':_[_0xf5e5('0x2e')](_0x55cf48,function(_0x24e792){return _0x24e792+_0xf5e5('0x27');})})[_0xf5e5('0x1e')](function(){return _0x2178d1[_0xf5e5('0x12')](0xc8)[_0xf5e5('0x11')]({'output':_0xf5e5('0x2f')+module[_0xf5e5('0xc')]['version']+_0xf5e5('0x30')+_['last'](_0x55cf48),'migrations':_[_0xf5e5('0x31')](_0x55cf48)});})[_0xf5e5('0x20')](function(_0x3407a1){if(_0x3407a1 instanceof db[_0xf5e5('0x2a')]['UniqueConstraintError']){return _0x2178d1[_0xf5e5('0x12')](0xc8)[_0xf5e5('0x11')]({'output':_0xf5e5('0x32')});}else{return _0x2178d1[_0xf5e5('0x12')](0x1f4)[_0xf5e5('0x11')](_0x3407a1);}});}else{return _0x2178d1[_0xf5e5('0x12')](0xc8)[_0xf5e5('0x11')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x75a0=['child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','index','exports','query','latest','fetch','tags','status','json','master','error','info','git\x20fetch','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','server','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','version','compare-versions'];(function(_0x2bc14b,_0x34637b){var _0x14b2f9=function(_0xcf5de8){while(--_0xcf5de8){_0x2bc14b['push'](_0x2bc14b['shift']());}};_0x14b2f9(++_0x34637b);}(_0x75a0,0x129));var _0x075a=function(_0xa9b067,_0x2047eb){_0xa9b067=_0xa9b067-0x0;var _0x492156=_0x75a0[_0xa9b067];return _0x492156;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x075a('0x0'));var pkginfo=require('pkginfo')(module,_0x075a('0x1'));var compareVersions=require(_0x075a('0x2'));var exec=require(_0x075a('0x3'))[_0x075a('0x4')];var db=require(_0x075a('0x5'))['db'];var config=require(_0x075a('0x6'));var pm2=require(_0x075a('0x7'));var logger=require(_0x075a('0x8'))(_0x075a('0x9'));var git=require('simple-git')(config[_0x075a('0xa')]);exports[_0x075a('0xb')]=function(_0x1e24ee,_0x3d7ab7){var _0x27dfd2={'current':module[_0x075a('0xc')][_0x075a('0x1')],'phonebar':0x2};if(_0x1e24ee['query']&&_0x1e24ee[_0x075a('0xd')][_0x075a('0xe')]){return git[_0x075a('0xf')]()[_0x075a('0x10')](function(_0x27b5ce,_0x3f87d5){_0x27dfd2[_0x075a('0xe')]=(_0x27b5ce?module[_0x075a('0xc')][_0x075a('0x1')]:_0x3f87d5['latest'])||'2.0.0';return _0x3d7ab7[_0x075a('0x11')](0xc8)[_0x075a('0x12')](_0x27dfd2);});}else{return _0x3d7ab7[_0x075a('0x11')](0xc8)['json'](_0x27dfd2);}};exports[_0x075a('0xf')]=function(_0x51669d,_0x2705a6){return git[_0x075a('0xf')](['origin',_0x075a('0x13')],function(_0x3acf5e){if(_0x3acf5e){logger[_0x075a('0x14')](_0x3acf5e);return _0x2705a6[_0x075a('0x11')](0x1f4)[_0x075a('0x12')](_0x3acf5e);}logger[_0x075a('0x15')](_0x075a('0x16'));return _0x2705a6[_0x075a('0x11')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x075a('0x17')]=function(_0x2ce988,_0x4d5a5a){return git[_0x075a('0x17')](['--hard',_0x075a('0x18')],function(_0x3ceb40){if(_0x3ceb40){logger[_0x075a('0x14')](_0x3ceb40);return _0x4d5a5a['status'](0x1f4)[_0x075a('0x12')](_0x3ceb40);}logger[_0x075a('0x15')](_0x075a('0x19'));return _0x4d5a5a['status'](0xc8)[_0x075a('0x12')]({'output':_0x075a('0x1a')});});};exports['pull']=function(_0x42f7d6,_0x2ba175){exec('npm\x20install\x20--production',function(_0x2c9e5b,_0x5e6fa4,_0x1ef31b){logger[_0x075a('0x15')](_0x5e6fa4);logger[_0x075a('0x15')](_0x1ef31b);if(_0x2c9e5b){logger[_0x075a('0x14')](_0x2c9e5b);return _0x2ba175[_0x075a('0x11')](0x1f4)[_0x075a('0x12')](_0x2c9e5b);}return _0x2ba175[_0x075a('0x11')](0xc8)[_0x075a('0x12')]({'output':_0x5e6fa4});});};exports[_0x075a('0x1b')]=function(_0xc469d3,_0x551bfe){return pm2[_0x075a('0x1b')](_0x075a('0x1c'))[_0x075a('0x1d')](function(_0xf4d1c7){logger[_0x075a('0x15')](_0x075a('0x1e'),_0xf4d1c7);return _0x551bfe[_0x075a('0x11')](0xc8)['json']({'output':_0x075a('0x1f')});})[_0x075a('0x20')](function(_0xfc0769){logger['error'](_0xfc0769);return _0x551bfe[_0x075a('0x11')](0x1f4)[_0x075a('0x12')](_0xfc0769);});};exports[_0x075a('0x21')]=function(_0x23ff69,_0x19f1a9){var _0x2a45de=fs['readdirSync'](path[_0x075a('0x22')](config[_0x075a('0xa')],_0x075a('0x23'),_0x075a('0x21')));var _0x2346bc=[];for(var _0x141528=0x0;_0x141528<_0x2a45de[_0x075a('0x24')];_0x141528++){var _0x475c1c=_0x2a45de[_0x141528][_0x075a('0x25')](_0x075a('0x26'),'');if(compareVersions(module[_0x075a('0xc')][_0x075a('0x1')],_0x475c1c)===-0x1){_0x2346bc[_0x075a('0x27')](_0x475c1c);}}if(_0x2346bc[_0x075a('0x24')]){var _0x114f44=_0x2346bc[_0x075a('0x28')](compareVersions);var _0x5160fb=new Umzug({'storage':_0x075a('0x29'),'storageOptions':{'model':db[_0x075a('0x2a')],'modelName':_0x075a('0x2a'),'columnName':'version'},'migrations':{'params':[db[_0x075a('0x29')][_0x075a('0x2b')](),db['sequelize'][_0x075a('0x2c')],function(){throw new Error(_0x075a('0x2d'));}],'path':path['join'](config['root'],_0x075a('0x23'),_0x075a('0x21')),'pattern':/\.js$/}});_0x5160fb['up']({'migrations':_['map'](_0x114f44,function(_0x1bad6a){return _0x1bad6a+'.js';})})['then'](function(){return _0x19f1a9[_0x075a('0x11')](0xc8)[_0x075a('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x075a('0xc')]['version']+_0x075a('0x2e')+_[_0x075a('0x2f')](_0x114f44),'migrations':_['join'](_0x114f44)});})['catch'](function(_0x5a0998){if(_0x5a0998 instanceof db[_0x075a('0x29')][_0x075a('0x30')]){return _0x19f1a9[_0x075a('0x11')](0xc8)['json']({'output':_0x075a('0x31')});}else{return _0x19f1a9[_0x075a('0x11')](0x1f4)['json'](_0x5a0998);}});}else{return _0x19f1a9['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 9de7986..a5e25db 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 _0x5739=['express','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','delete','exports','multer','path'];(function(_0x2a481e,_0xbbab10){var _0x5b532c=function(_0x3825ef){while(--_0x3825ef){_0x2a481e['push'](_0x2a481e['shift']());}};_0x5b532c(++_0xbbab10);}(_0x5739,0x13e));var _0x9573=function(_0x23a347,_0x428d95){_0x23a347=_0x23a347-0x0;var _0x10549b=_0x5739[_0x23a347];return _0x10549b;};'use strict';var multer=require(_0x9573('0x0'));var util=require('util');var path=require(_0x9573('0x1'));var timeout=require('connect-timeout');var express=require(_0x9573('0x2'));var router=express[_0x9573('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9573('0x4'));var interaction=require(_0x9573('0x5'));var config=require('../../config/environment');var controller=require(_0x9573('0x6'));router[_0x9573('0x7')]('/',auth[_0x9573('0x8')](),controller[_0x9573('0x9')]);router[_0x9573('0x7')](_0x9573('0xa'),auth[_0x9573('0x8')](),controller[_0x9573('0xb')]);router[_0x9573('0x7')](_0x9573('0xc'),auth[_0x9573('0x8')](),controller[_0x9573('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9573('0xc'),auth[_0x9573('0x8')](),controller['update']);router[_0x9573('0xe')](_0x9573('0xc'),auth[_0x9573('0x8')](),controller['destroy']);module[_0x9573('0xf')]=router; \ No newline at end of file +var _0xa933=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x5d6df5,_0x1a2b8b){var _0xb813de=function(_0x58fd8a){while(--_0x58fd8a){_0x5d6df5['push'](_0x5d6df5['shift']());}};_0xb813de(++_0x1a2b8b);}(_0xa933,0x1ea));var _0x3a93=function(_0x178a9f,_0x1fd554){_0x178a9f=_0x178a9f-0x0;var _0x10f5eb=_0xa933[_0x178a9f];return _0x10f5eb;};'use strict';var multer=require(_0x3a93('0x0'));var util=require(_0x3a93('0x1'));var path=require(_0x3a93('0x2'));var timeout=require(_0x3a93('0x3'));var express=require(_0x3a93('0x4'));var router=express[_0x3a93('0x5')]();var fs_extra=require(_0x3a93('0x6'));var auth=require(_0x3a93('0x7'));var interaction=require(_0x3a93('0x8'));var config=require(_0x3a93('0x9'));var controller=require('./voiceAgentReport.controller');router[_0x3a93('0xa')]('/',auth[_0x3a93('0xb')](),controller['index']);router[_0x3a93('0xa')](_0x3a93('0xc'),auth[_0x3a93('0xb')](),controller[_0x3a93('0xd')]);router[_0x3a93('0xa')](_0x3a93('0xe'),auth['isAuthenticated'](),controller[_0x3a93('0xf')]);router[_0x3a93('0x10')]('/',auth[_0x3a93('0xb')](),controller[_0x3a93('0x11')]);router[_0x3a93('0x12')](_0x3a93('0xe'),auth[_0x3a93('0xb')](),controller[_0x3a93('0x13')]);router['delete'](_0x3a93('0xe'),auth[_0x3a93('0xb')](),controller[_0x3a93('0x14')]);module[_0x3a93('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 402f84a..6e537ba 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 _0x2bab=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x2de641,_0x410db2){var _0x29405d=function(_0x306828){while(--_0x306828){_0x2de641['push'](_0x2de641['shift']());}};_0x29405d(++_0x410db2);}(_0x2bab,0x1ba));var _0xb2ba=function(_0x5e6a9d,_0x140f6e){_0x5e6a9d=_0x5e6a9d-0x0;var _0x144aa1=_0x2bab[_0x5e6a9d];return _0x144aa1;};'use strict';var Sequelize=require(_0xb2ba('0x0'));module[_0xb2ba('0x1')]={'type':{'type':Sequelize[_0xb2ba('0x2')]},'uniqueid':{'type':Sequelize[_0xb2ba('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb2ba('0x2')]},'queue':{'type':Sequelize[_0xb2ba('0x2')]},'interface':{'type':Sequelize[_0xb2ba('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xb2ba('0x3')]},'agentconnectAt':{'type':Sequelize[_0xb2ba('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xb2ba('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xb2ba('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xb2ba('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb2ba('0x4')]},'reason':{'type':Sequelize[_0xb2ba('0x2')]},'lastevent':{'type':Sequelize[_0xb2ba('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb2ba('0x4')]},'channelstatedesc':{'type':Sequelize[_0xb2ba('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xb2ba('0x2')]},'accountcode':{'type':Sequelize[_0xb2ba('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb2ba('0x2')]},'priority':{'type':Sequelize[_0xb2ba('0x2')]},'destchannel':{'type':Sequelize[_0xb2ba('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xb2ba('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb2ba('0x2')]},'destcalleridname':{'type':Sequelize[_0xb2ba('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xb2ba('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb2ba('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xb2ba('0x2')]},'destpriority':{'type':Sequelize[_0xb2ba('0x2')]},'destuniqueid':{'type':Sequelize[_0xb2ba('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xb2ba('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb2ba('0x2')],'comment':_0xb2ba('0x6')},'transferexten':{'type':Sequelize[_0xb2ba('0x2')]},'transferuniqueid':{'type':Sequelize[_0xb2ba('0x2')]},'agententerreason':{'type':Sequelize[_0xb2ba('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x79d7=['BOOLEAN','sequelize','STRING','DATE','INTEGER'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x79d7,0x9c));var _0x779d=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x79d7[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0x779d('0x0'));module['exports']={'type':{'type':Sequelize[_0x779d('0x1')]},'uniqueid':{'type':Sequelize[_0x779d('0x1')]},'calleridnum':{'type':Sequelize[_0x779d('0x1')]},'calleridname':{'type':Sequelize[_0x779d('0x1')]},'queue':{'type':Sequelize[_0x779d('0x1')]},'interface':{'type':Sequelize[_0x779d('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x779d('0x2')]},'agentconnectAt':{'type':Sequelize[_0x779d('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x779d('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x779d('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x779d('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x779d('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x779d('0x1')]},'channel':{'type':Sequelize[_0x779d('0x1')]},'channelstate':{'type':Sequelize[_0x779d('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x779d('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x779d('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x779d('0x1')]},'exten':{'type':Sequelize[_0x779d('0x1')]},'priority':{'type':Sequelize[_0x779d('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x779d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x779d('0x1')]},'destcalleridnum':{'type':Sequelize[_0x779d('0x1')]},'destcalleridname':{'type':Sequelize[_0x779d('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x779d('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x779d('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x779d('0x1')]},'destcontext':{'type':Sequelize[_0x779d('0x1')]},'destexten':{'type':Sequelize[_0x779d('0x1')]},'destpriority':{'type':Sequelize[_0x779d('0x1')]},'destuniqueid':{'type':Sequelize[_0x779d('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x779d('0x1')]},'transfer':{'type':Sequelize[_0x779d('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x779d('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x779d('0x1')]},'transferuniqueid':{'type':Sequelize[_0x779d('0x1')]},'agententerreason':{'type':Sequelize[_0x779d('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index fcc21cc..e401501 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(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 c6a600e..e4ceae8 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 _0x44ae=['VoiceAgentReport','report_agent','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define'];(function(_0x4e0fb5,_0x356809){var _0x5d3ca3=function(_0x1da748){while(--_0x1da748){_0x4e0fb5['push'](_0x4e0fb5['shift']());}};_0x5d3ca3(++_0x356809);}(_0x44ae,0x17d));var _0xe44a=function(_0x2123aa,_0x2e8a74){_0x2123aa=_0x2123aa-0x0;var _0x413cde=_0x44ae[_0x2123aa];return _0x413cde;};'use strict';var _=require(_0xe44a('0x0'));var util=require(_0xe44a('0x1'));var logger=require(_0xe44a('0x2'))(_0xe44a('0x3'));var moment=require('moment');var BPromise=require(_0xe44a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe44a('0x5'));var rimraf=require(_0xe44a('0x6'));var config=require(_0xe44a('0x7'));var attributes=require(_0xe44a('0x8'));module[_0xe44a('0x9')]=function(_0x3f9763,_0x5c1c49){return _0x3f9763[_0xe44a('0xa')](_0xe44a('0xb'),attributes,{'tableName':_0xe44a('0xc'),'paranoid':![],'indexes':[{'fields':[_0xe44a('0xd'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3eea=['exports','VoiceAgentReport','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x5b4303,_0x225e71){var _0x1aacba=function(_0x1ac0d0){while(--_0x1ac0d0){_0x5b4303['push'](_0x5b4303['shift']());}};_0x1aacba(++_0x225e71);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x44e9f0,_0x41316d){_0x44e9f0=_0x44e9f0-0x0;var _0x36a8bb=_0x3eea[_0x44e9f0];return _0x36a8bb;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var logger=require(_0xa3ee('0x1'))(_0xa3ee('0x2'));var moment=require(_0xa3ee('0x3'));var BPromise=require(_0xa3ee('0x4'));var rp=require(_0xa3ee('0x5'));var fs=require('fs');var path=require(_0xa3ee('0x6'));var rimraf=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var attributes=require(_0xa3ee('0x9'));module[_0xa3ee('0xa')]=function(_0xb93cdb,_0x5776bb){return _0xb93cdb['define'](_0xa3ee('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xa3ee('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 5f600e2..ef8ecac 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 _0xbc28=['message','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','catch','UpdateVoiceAgentReport','where','attributes','bluebird','../../mysqldb','../../config/utils','../../config/logger','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3eac74,_0x300383){var _0x365ec9=function(_0xd70261){while(--_0xd70261){_0x3eac74['push'](_0x3eac74['shift']());}};_0x365ec9(++_0x300383);}(_0xbc28,0x182));var _0x8bc2=function(_0x304001,_0x54b6d5){_0x304001=_0x304001-0x0;var _0x27ece8=_0xbc28[_0x304001];return _0x27ece8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8bc2('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bc2('0x1'))['db'];var utils=require(_0x8bc2('0x2'));var logger=require(_0x8bc2('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8bc2('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x269c59,_0x157eaf,_0x445e0f){return new BPromise(function(_0x192f51,_0x21955e){return client[_0x8bc2('0x5')](_0x269c59,_0x445e0f)[_0x8bc2('0x6')](function(_0x509635){logger[_0x8bc2('0x7')](_0x8bc2('0x8'),_0x157eaf,_0x8bc2('0x9'));logger[_0x8bc2('0xa')](_0x8bc2('0xb'),_0x157eaf,'request\x20sent',JSON[_0x8bc2('0xc')](_0x509635));if(_0x509635[_0x8bc2('0xd')]){if(_0x509635[_0x8bc2('0xd')]['code']===0x1f4){logger[_0x8bc2('0xd')](_0x8bc2('0x8'),_0x157eaf,_0x509635['error'][_0x8bc2('0xe')]);return _0x21955e(_0x509635[_0x8bc2('0xd')]['message']);}logger[_0x8bc2('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x157eaf,_0x509635['error'][_0x8bc2('0xe')]);return _0x192f51(_0x509635[_0x8bc2('0xd')][_0x8bc2('0xe')]);}else{logger[_0x8bc2('0x7')](_0x8bc2('0x8'),_0x157eaf,_0x8bc2('0x9'));_0x192f51(_0x509635['result'][_0x8bc2('0xe')]);}})['catch'](function(_0x279036){logger['error'](_0x8bc2('0x8'),_0x157eaf,_0x279036);_0x21955e(_0x279036);});});}exports[_0x8bc2('0xf')]=function(_0x34a779){var _0x5801b1=this;return new Promise(function(_0x400945,_0x2bf3bd){return db[_0x8bc2('0x10')][_0x8bc2('0x11')](_0x34a779[_0x8bc2('0x12')],{'raw':_0x34a779['options']?_0x34a779[_0x8bc2('0x13')][_0x8bc2('0x14')]===undefined?!![]:![]:!![]})[_0x8bc2('0x6')](function(_0x820665){logger[_0x8bc2('0x7')]('CreateVoiceAgentReport',_0x34a779);logger[_0x8bc2('0xa')]('CreateVoiceAgentReport',_0x34a779,JSON[_0x8bc2('0xc')](_0x820665));_0x400945(_0x820665);})[_0x8bc2('0x15')](function(_0x12a4a8){logger[_0x8bc2('0xd')]('CreateVoiceAgentReport',_0x12a4a8[_0x8bc2('0xe')],_0x34a779);_0x2bf3bd(_0x5801b1[_0x8bc2('0xd')](0x1f4,_0x12a4a8['message']));});});};exports[_0x8bc2('0x16')]=function(_0x2cbb51){var _0x430d57=this;return new Promise(function(_0x260283,_0x49442f){return db[_0x8bc2('0x10')]['update'](_0x2cbb51['body'],{'raw':_0x2cbb51['options']?_0x2cbb51[_0x8bc2('0x13')][_0x8bc2('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cbb51[_0x8bc2('0x13')]?_0x2cbb51[_0x8bc2('0x13')][_0x8bc2('0x17')]||null:null,'attributes':_0x2cbb51[_0x8bc2('0x13')]?_0x2cbb51[_0x8bc2('0x13')][_0x8bc2('0x18')]||null:null,'limit':_0x2cbb51[_0x8bc2('0x13')]?_0x2cbb51[_0x8bc2('0x13')]['limit']||null:null})[_0x8bc2('0x6')](function(_0x14cdcd){logger[_0x8bc2('0x7')](_0x8bc2('0x16'),_0x2cbb51);logger[_0x8bc2('0xa')]('UpdateVoiceAgentReport',_0x2cbb51,JSON['stringify'](_0x14cdcd));_0x260283(_0x14cdcd);})[_0x8bc2('0x15')](function(_0xc44b0d){logger[_0x8bc2('0xd')](_0x8bc2('0x16'),_0xc44b0d['message'],_0x2cbb51);_0x49442f(_0x430d57[_0x8bc2('0xd')](0x1f4,_0xc44b0d[_0x8bc2('0xe')]));});});}; \ No newline at end of file +var _0x8912=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','create','body','options','raw','then','UpdateVoiceAgentReport','update','attributes','limit','lodash'];(function(_0x5f0887,_0x7a0ea4){var _0xdd991d=function(_0x51daa7){while(--_0x51daa7){_0x5f0887['push'](_0x5f0887['shift']());}};_0xdd991d(++_0x7a0ea4);}(_0x8912,0x7f));var _0x2891=function(_0x5db9bd,_0x13a18b){_0x5db9bd=_0x5db9bd-0x0;var _0x16ef2f=_0x8912[_0x5db9bd];return _0x16ef2f;};'use strict';var _=require(_0x2891('0x0'));var util=require(_0x2891('0x1'));var moment=require(_0x2891('0x2'));var BPromise=require('bluebird');var rs=require(_0x2891('0x3'));var fs=require('fs');var Redis=require(_0x2891('0x4'));var db=require(_0x2891('0x5'))['db'];var utils=require(_0x2891('0x6'));var logger=require('../../config/logger')(_0x2891('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2891('0x8')][_0x2891('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2780ac,_0x595298,_0x3860da){return new BPromise(function(_0xf66e86,_0x343991){return client[_0x2891('0xa')](_0x2780ac,_0x3860da)['then'](function(_0x12bee2){logger[_0x2891('0xb')](_0x2891('0xc'),_0x595298,_0x2891('0xd'));logger[_0x2891('0xe')](_0x2891('0xf'),_0x595298,'request\x20sent',JSON[_0x2891('0x10')](_0x12bee2));if(_0x12bee2[_0x2891('0x11')]){if(_0x12bee2['error'][_0x2891('0x12')]===0x1f4){logger[_0x2891('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x595298,_0x12bee2[_0x2891('0x11')][_0x2891('0x13')]);return _0x343991(_0x12bee2[_0x2891('0x11')][_0x2891('0x13')]);}logger[_0x2891('0x11')](_0x2891('0xc'),_0x595298,_0x12bee2[_0x2891('0x11')][_0x2891('0x13')]);return _0xf66e86(_0x12bee2[_0x2891('0x11')][_0x2891('0x13')]);}else{logger['info'](_0x2891('0xc'),_0x595298,_0x2891('0xd'));_0xf66e86(_0x12bee2[_0x2891('0x14')]['message']);}})[_0x2891('0x15')](function(_0x3906c8){logger[_0x2891('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x595298,_0x3906c8);_0x343991(_0x3906c8);});});}exports[_0x2891('0x16')]=function(_0x5e6a1a){var _0x24122d=this;return new Promise(function(_0x4c2fa4,_0x429793){return db['VoiceAgentReport'][_0x2891('0x17')](_0x5e6a1a[_0x2891('0x18')],{'raw':_0x5e6a1a[_0x2891('0x19')]?_0x5e6a1a[_0x2891('0x19')][_0x2891('0x1a')]===undefined?!![]:![]:!![]})[_0x2891('0x1b')](function(_0x705562){logger[_0x2891('0xb')](_0x2891('0x16'),_0x5e6a1a);logger[_0x2891('0xe')](_0x2891('0x16'),_0x5e6a1a,JSON['stringify'](_0x705562));_0x4c2fa4(_0x705562);})[_0x2891('0x15')](function(_0x4cd018){logger[_0x2891('0x11')](_0x2891('0x16'),_0x4cd018['message'],_0x5e6a1a);_0x429793(_0x24122d['error'](0x1f4,_0x4cd018['message']));});});};exports[_0x2891('0x1c')]=function(_0x53e718){var _0x5dbdd6=this;return new Promise(function(_0x45de40,_0x1db002){return db['VoiceAgentReport'][_0x2891('0x1d')](_0x53e718[_0x2891('0x18')],{'raw':_0x53e718[_0x2891('0x19')]?_0x53e718[_0x2891('0x19')][_0x2891('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53e718[_0x2891('0x19')]?_0x53e718['options']['where']||null:null,'attributes':_0x53e718[_0x2891('0x19')]?_0x53e718['options'][_0x2891('0x1e')]||null:null,'limit':_0x53e718['options']?_0x53e718['options'][_0x2891('0x1f')]||null:null})[_0x2891('0x1b')](function(_0x31823d){logger[_0x2891('0xb')](_0x2891('0x1c'),_0x53e718);logger['debug']('UpdateVoiceAgentReport',_0x53e718,JSON['stringify'](_0x31823d));_0x45de40(_0x31823d);})[_0x2891('0x15')](function(_0x49695){logger['error'](_0x2891('0x1c'),_0x49695[_0x2891('0x13')],_0x53e718);_0x1db002(_0x5dbdd6[_0x2891('0x11')](0x1f4,_0x49695['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 809ed4a..c3cc253 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 _0x6737=['isAuthenticated','index','get','show','create','put','update','/:id','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller'];(function(_0xc7dbb,_0x1e617c){var _0x4d17ad=function(_0x335ad9){while(--_0x335ad9){_0xc7dbb['push'](_0xc7dbb['shift']());}};_0x4d17ad(++_0x1e617c);}(_0x6737,0xe2));var _0x7673=function(_0x52b7a0,_0x577ecb){_0x52b7a0=_0x52b7a0-0x0;var _0x37ae92=_0x6737[_0x52b7a0];return _0x37ae92;};'use strict';var multer=require('multer');var util=require(_0x7673('0x0'));var path=require(_0x7673('0x1'));var timeout=require('connect-timeout');var express=require(_0x7673('0x2'));var router=express[_0x7673('0x3')]();var fs_extra=require(_0x7673('0x4'));var auth=require(_0x7673('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7673('0x6'));var controller=require(_0x7673('0x7'));router['get']('/',auth[_0x7673('0x8')](),controller[_0x7673('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x7673('0xa')]('/:id',auth[_0x7673('0x8')](),controller[_0x7673('0xb')]);router['post']('/',auth[_0x7673('0x8')](),controller[_0x7673('0xc')]);router[_0x7673('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x7673('0xe')]);router['delete'](_0x7673('0xf'),auth[_0x7673('0x8')](),controller[_0x7673('0x10')]);module[_0x7673('0x11')]=router; \ No newline at end of file +var _0x3937=['get','isAuthenticated','index','/describe','describe','show','post','create','delete','/:id','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceCallReport.controller'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3937,0xbf));var _0x7393=function(_0x134685,_0x246fbc){_0x134685=_0x134685-0x0;var _0x182b2f=_0x3937[_0x134685];return _0x182b2f;};'use strict';var multer=require(_0x7393('0x0'));var util=require('util');var path=require(_0x7393('0x1'));var timeout=require(_0x7393('0x2'));var express=require('express');var router=express[_0x7393('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7393('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7393('0x5'));var controller=require(_0x7393('0x6'));router[_0x7393('0x7')]('/',auth[_0x7393('0x8')](),controller[_0x7393('0x9')]);router[_0x7393('0x7')](_0x7393('0xa'),auth[_0x7393('0x8')](),controller[_0x7393('0xb')]);router['get']('/:id',auth[_0x7393('0x8')](),controller[_0x7393('0xc')]);router[_0x7393('0xd')]('/',auth['isAuthenticated'](),controller[_0x7393('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7393('0xf')](_0x7393('0x10'),auth[_0x7393('0x8')](),controller['destroy']);module[_0x7393('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 9b8db18..499ae88 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 _0xa1c5=['sequelize','exports','STRING','internal','outbound','inbound-fax','dialer','TEXT','DATE','INTEGER'];(function(_0x25beea,_0x4a2b9a){var _0x387b89=function(_0x39a379){while(--_0x39a379){_0x25beea['push'](_0x25beea['shift']());}};_0x387b89(++_0x4a2b9a);}(_0xa1c5,0x96));var _0x5a1c=function(_0x343255,_0xe71b6c){_0x343255=_0x343255-0x0;var _0x3fc676=_0xa1c5[_0x343255];return _0x3fc676;};'use strict';var Sequelize=require(_0x5a1c('0x0'));module[_0x5a1c('0x1')]={'uniqueid':{'type':Sequelize[_0x5a1c('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x5a1c('0x3'),_0x5a1c('0x4'),_0x5a1c('0x5'),'outbound-fax',_0x5a1c('0x6'))},'tag':{'type':Sequelize[_0x5a1c('0x2')]},'accountcode':{'type':Sequelize[_0x5a1c('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x5a1c('0x2')]},'destinationcontext':{'type':Sequelize[_0x5a1c('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5a1c('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x5a1c('0x2')]},'lastdata':{'type':Sequelize[_0x5a1c('0x7')]},'starttime':{'type':Sequelize[_0x5a1c('0x8')]},'systemanswertime':{'type':Sequelize[_0x5a1c('0x8')]},'answertime':{'type':Sequelize[_0x5a1c('0x8')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x5a1c('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x5a1c('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5a1c('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x5a1c('0x2')]},'userDisposition':{'type':Sequelize[_0x5a1c('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x5a1c('0x2')]},'note':{'type':Sequelize[_0x5a1c('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x5a1c('0x9')]},'sipcallid':{'type':Sequelize[_0x5a1c('0x2')]}}; \ No newline at end of file +var _0x77e6=['DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','dialer','TEXT'];(function(_0x170310,_0x31acf9){var _0x1b6006=function(_0x294e50){while(--_0x294e50){_0x170310['push'](_0x170310['shift']());}};_0x1b6006(++_0x31acf9);}(_0x77e6,0x1a6));var _0x677e=function(_0x185420,_0x176bfa){_0x185420=_0x185420-0x0;var _0x456ab2=_0x77e6[_0x185420];return _0x456ab2;};'use strict';var Sequelize=require(_0x677e('0x0'));module[_0x677e('0x1')]={'uniqueid':{'type':Sequelize[_0x677e('0x2')]},'type':{'type':Sequelize[_0x677e('0x3')](_0x677e('0x4'),_0x677e('0x5'),_0x677e('0x6'),_0x677e('0x7'),'outbound-fax',_0x677e('0x8'))},'tag':{'type':Sequelize[_0x677e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x677e('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x677e('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x677e('0x2')]},'lastapplication':{'type':Sequelize[_0x677e('0x2')]},'lastdata':{'type':Sequelize[_0x677e('0x9')]},'starttime':{'type':Sequelize[_0x677e('0xa')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x677e('0xa')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x677e('0xb')]},'billableseconds':{'type':Sequelize[_0x677e('0xb')]},'mohtime':{'type':Sequelize[_0x677e('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x677e('0x2')]},'amaflags':{'type':Sequelize[_0x677e('0x2')]},'userfield':{'type':Sequelize[_0x677e('0x2')]},'userDisposition':{'type':Sequelize[_0x677e('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x677e('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x677e('0x2')]},'note':{'type':Sequelize[_0x677e('0x2')]},'prefix':{'type':Sequelize[_0x677e('0x2')]},'routeid':{'type':Sequelize[_0x677e('0xb')]},'sipcallid':{'type':Sequelize[_0x677e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index d08850b..089e1a1 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x20ce47,_0x18f197){_0x20ce47=_0x20ce47-0x0;var _0x4be162=_0x2032[_0x20ce47];return _0x4be162;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x380e2f,_0x4b2563){var _0x339fce=function(_0x476f30){while(--_0x476f30){_0x380e2f['push'](_0x380e2f['shift']());}};_0x339fce(++_0x4b2563);}(_0xdb28,0x106));var _0x8db2=function(_0x3d3b3a,_0x5aa17e){_0x3d3b3a=_0x3d3b3a-0x0;var _0x5a304e=_0xdb28[_0x3d3b3a];return _0x5a304e;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 149f12f..035daf8 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 _0x7541=['moment','path','rimraf','../../config/environment','define','VoiceCallReport','uniqueid','lodash'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0x7541,0x1a7));var _0x1754=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x7541[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x1754('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1754('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1754('0x2'));var rimraf=require(_0x1754('0x3'));var config=require(_0x1754('0x4'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x33059e,_0x13b0aa){return _0x33059e[_0x1754('0x5')](_0x1754('0x6'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x1754('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc196=['VoiceCallReport','report_call','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define'];(function(_0xaf25ae,_0x2001c1){var _0x49732d=function(_0x5b764d){while(--_0x5b764d){_0xaf25ae['push'](_0xaf25ae['shift']());}};_0x49732d(++_0x2001c1);}(_0xc196,0x1bc));var _0x6c19=function(_0x451529,_0x41aa88){_0x451529=_0x451529-0x0;var _0x172ba7=_0xc196[_0x451529];return _0x172ba7;};'use strict';var _=require(_0x6c19('0x0'));var util=require(_0x6c19('0x1'));var logger=require(_0x6c19('0x2'))(_0x6c19('0x3'));var moment=require(_0x6c19('0x4'));var BPromise=require(_0x6c19('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6c19('0x6'));var config=require(_0x6c19('0x7'));var attributes=require(_0x6c19('0x8'));module[_0x6c19('0x9')]=function(_0x448488,_0x589fd3){return _0x448488[_0x6c19('0xa')](_0x6c19('0xb'),attributes,{'tableName':_0x6c19('0xc'),'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 08ace46..3b0e145 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 _0x59c1=['result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','include','map','model','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceCallReport,\x20%s,\x20%s'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x59c1,0x1c2));var _0x159c=function(_0x19ce9e,_0x311263){_0x19ce9e=_0x19ce9e-0x0;var _0x371933=_0x59c1[_0x19ce9e];return _0x371933;};'use strict';var _=require(_0x159c('0x0'));var util=require(_0x159c('0x1'));var moment=require('moment');var BPromise=require(_0x159c('0x2'));var rs=require(_0x159c('0x3'));var fs=require('fs');var Redis=require(_0x159c('0x4'));var db=require(_0x159c('0x5'))['db'];var utils=require(_0x159c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x159c('0x7'));var jayson=require(_0x159c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4088bc,_0x585549,_0x125590){return new BPromise(function(_0x380839,_0x4ec6b8){return client['request'](_0x4088bc,_0x125590)[_0x159c('0x9')](function(_0x4d78f6){logger[_0x159c('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x585549,_0x159c('0xb'));logger[_0x159c('0xc')](_0x159c('0xd'),_0x585549,_0x159c('0xb'),JSON[_0x159c('0xe')](_0x4d78f6));if(_0x4d78f6[_0x159c('0xf')]){if(_0x4d78f6['error']['code']===0x1f4){logger[_0x159c('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x585549,_0x4d78f6[_0x159c('0xf')][_0x159c('0x10')]);return _0x4ec6b8(_0x4d78f6[_0x159c('0xf')][_0x159c('0x10')]);}logger[_0x159c('0xf')](_0x159c('0x11'),_0x585549,_0x4d78f6[_0x159c('0xf')][_0x159c('0x10')]);return _0x380839(_0x4d78f6['error'][_0x159c('0x10')]);}else{logger[_0x159c('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x585549,'request\x20sent');_0x380839(_0x4d78f6[_0x159c('0x12')][_0x159c('0x10')]);}})[_0x159c('0x13')](function(_0x26b392){logger['error'](_0x159c('0x11'),_0x585549,_0x26b392);_0x4ec6b8(_0x26b392);});});}exports[_0x159c('0x14')]=function(_0xb75fe2){var _0x2c82f8=this;return new Promise(function(_0x238e1f,_0x23e679){return db[_0x159c('0x15')][_0x159c('0x16')]({'raw':_0xb75fe2[_0x159c('0x17')]?_0xb75fe2[_0x159c('0x17')][_0x159c('0x18')]===undefined?!![]:![]:!![],'where':_0xb75fe2[_0x159c('0x17')]?_0xb75fe2[_0x159c('0x17')][_0x159c('0x19')]||null:null,'attributes':_0xb75fe2[_0x159c('0x17')]?_0xb75fe2['options'][_0x159c('0x1a')]||null:null,'limit':_0xb75fe2[_0x159c('0x17')]?_0xb75fe2['options']['limit']||null:null,'include':_0xb75fe2[_0x159c('0x17')]?_0xb75fe2['options'][_0x159c('0x1b')]?_[_0x159c('0x1c')](_0xb75fe2[_0x159c('0x17')][_0x159c('0x1b')],function(_0x417525){return{'model':db[_0x417525['model']],'as':_0x417525['as'],'attributes':_0x417525['attributes'],'include':_0x417525[_0x159c('0x1b')]?_[_0x159c('0x1c')](_0x417525[_0x159c('0x1b')],function(_0x665720){return{'model':db[_0x665720[_0x159c('0x1d')]],'as':_0x665720['as'],'attributes':_0x665720[_0x159c('0x1a')],'include':_0x665720['include']?_[_0x159c('0x1c')](_0x665720['include'],function(_0x534085){return{'model':db[_0x534085[_0x159c('0x1d')]],'as':_0x534085['as'],'attributes':_0x534085[_0x159c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x159c('0x9')](function(_0x119f87){logger[_0x159c('0xa')]('GetVoiceCallReport',_0xb75fe2);logger[_0x159c('0xc')](_0x159c('0x14'),_0xb75fe2,JSON[_0x159c('0xe')](_0x119f87));_0x238e1f(_0x119f87);})['catch'](function(_0x7b0130){logger[_0x159c('0xf')]('GetVoiceCallReport',_0x7b0130[_0x159c('0x10')],_0xb75fe2);_0x23e679(_0x2c82f8[_0x159c('0xf')](0x1f4,_0x7b0130['message']));});});};exports['CreateVoiceCallReport']=function(_0x4da619){var _0x1ec028=this;return new Promise(function(_0x29284e,_0x14164a){return db['VoiceCallReport'][_0x159c('0x1e')](_0x4da619[_0x159c('0x1f')],{'raw':_0x4da619[_0x159c('0x17')]?_0x4da619[_0x159c('0x17')][_0x159c('0x18')]===undefined?!![]:![]:!![]})[_0x159c('0x9')](function(_0x41ad46){logger[_0x159c('0xa')](_0x159c('0x20'),_0x4da619);logger[_0x159c('0xc')](_0x159c('0x20'),_0x4da619,JSON[_0x159c('0xe')](_0x41ad46));_0x29284e(_0x41ad46);})[_0x159c('0x13')](function(_0x3005f7){logger[_0x159c('0xf')](_0x159c('0x20'),_0x3005f7['message'],_0x4da619);_0x14164a(_0x1ec028[_0x159c('0xf')](0x1f4,_0x3005f7[_0x159c('0x10')]));});});};exports[_0x159c('0x21')]=function(_0x80b55f){var _0x5a87fd=this;return new Promise(function(_0x5427dc,_0x1bd589){return db[_0x159c('0x15')][_0x159c('0x22')](_0x80b55f['body'],{'raw':_0x80b55f[_0x159c('0x17')]?_0x80b55f[_0x159c('0x17')][_0x159c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x80b55f['options']?_0x80b55f[_0x159c('0x17')][_0x159c('0x19')]||null:null,'attributes':_0x80b55f[_0x159c('0x17')]?_0x80b55f[_0x159c('0x17')][_0x159c('0x1a')]||null:null,'limit':_0x80b55f['options']?_0x80b55f[_0x159c('0x17')][_0x159c('0x23')]||null:null})[_0x159c('0x9')](function(_0x54a587){logger[_0x159c('0xa')](_0x159c('0x21'),_0x80b55f);logger[_0x159c('0xc')](_0x159c('0x21'),_0x80b55f,JSON[_0x159c('0xe')](_0x54a587));_0x5427dc(_0x54a587);})['catch'](function(_0x50d277){logger[_0x159c('0xf')](_0x159c('0x21'),_0x50d277[_0x159c('0x10')],_0x80b55f);_0x1bd589(_0x5a87fd['error'](0x1f4,_0x50d277[_0x159c('0x10')]));});});}; \ No newline at end of file +var _0x5ad4=['http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','map','include','model','CreateVoiceCallReport','create','debug','update','body','UpdateVoiceCallReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5ad4,0x107));var _0x45ad=function(_0x2e5af1,_0x2fb1a1){_0x2e5af1=_0x2e5af1-0x0;var _0x1aa367=_0x5ad4[_0x2e5af1];return _0x1aa367;};'use strict';var _=require('lodash');var util=require(_0x45ad('0x0'));var moment=require(_0x45ad('0x1'));var BPromise=require(_0x45ad('0x2'));var rs=require(_0x45ad('0x3'));var fs=require('fs');var Redis=require(_0x45ad('0x4'));var db=require(_0x45ad('0x5'))['db'];var utils=require(_0x45ad('0x6'));var logger=require('../../config/logger')(_0x45ad('0x7'));var config=require('../../config/environment');var jayson=require(_0x45ad('0x8'));var client=jayson[_0x45ad('0x9')][_0x45ad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x435e04,_0x2fa088,_0x5a1787){return new BPromise(function(_0x165c84,_0x116657){return client[_0x45ad('0xb')](_0x435e04,_0x5a1787)[_0x45ad('0xc')](function(_0x326804){logger['info'](_0x45ad('0xd'),_0x2fa088,_0x45ad('0xe'));logger['debug'](_0x45ad('0xf'),_0x2fa088,_0x45ad('0xe'),JSON[_0x45ad('0x10')](_0x326804));if(_0x326804['error']){if(_0x326804[_0x45ad('0x11')]['code']===0x1f4){logger[_0x45ad('0x11')](_0x45ad('0xd'),_0x2fa088,_0x326804[_0x45ad('0x11')]['message']);return _0x116657(_0x326804['error'][_0x45ad('0x12')]);}logger[_0x45ad('0x11')](_0x45ad('0xd'),_0x2fa088,_0x326804[_0x45ad('0x11')][_0x45ad('0x12')]);return _0x165c84(_0x326804[_0x45ad('0x11')]['message']);}else{logger[_0x45ad('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x2fa088,_0x45ad('0xe'));_0x165c84(_0x326804[_0x45ad('0x14')]['message']);}})[_0x45ad('0x15')](function(_0x5f47d8){logger[_0x45ad('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x2fa088,_0x5f47d8);_0x116657(_0x5f47d8);});});}exports[_0x45ad('0x16')]=function(_0x2017b5){var _0x821131=this;return new Promise(function(_0x530f0b,_0x121c9f){return db[_0x45ad('0x17')][_0x45ad('0x18')]({'raw':_0x2017b5[_0x45ad('0x19')]?_0x2017b5[_0x45ad('0x19')][_0x45ad('0x1a')]===undefined?!![]:![]:!![],'where':_0x2017b5[_0x45ad('0x19')]?_0x2017b5['options'][_0x45ad('0x1b')]||null:null,'attributes':_0x2017b5[_0x45ad('0x19')]?_0x2017b5[_0x45ad('0x19')][_0x45ad('0x1c')]||null:null,'limit':_0x2017b5[_0x45ad('0x19')]?_0x2017b5[_0x45ad('0x19')][_0x45ad('0x1d')]||null:null,'include':_0x2017b5['options']?_0x2017b5[_0x45ad('0x19')]['include']?_[_0x45ad('0x1e')](_0x2017b5[_0x45ad('0x19')][_0x45ad('0x1f')],function(_0x2767b3){return{'model':db[_0x2767b3['model']],'as':_0x2767b3['as'],'attributes':_0x2767b3['attributes'],'include':_0x2767b3[_0x45ad('0x1f')]?_['map'](_0x2767b3['include'],function(_0x33c7f5){return{'model':db[_0x33c7f5[_0x45ad('0x20')]],'as':_0x33c7f5['as'],'attributes':_0x33c7f5[_0x45ad('0x1c')],'include':_0x33c7f5['include']?_[_0x45ad('0x1e')](_0x33c7f5[_0x45ad('0x1f')],function(_0x342a5c){return{'model':db[_0x342a5c[_0x45ad('0x20')]],'as':_0x342a5c['as'],'attributes':_0x342a5c[_0x45ad('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x45ad('0xc')](function(_0x48044c){logger[_0x45ad('0x13')](_0x45ad('0x16'),_0x2017b5);logger['debug'](_0x45ad('0x16'),_0x2017b5,JSON['stringify'](_0x48044c));_0x530f0b(_0x48044c);})[_0x45ad('0x15')](function(_0x2873c5){logger[_0x45ad('0x11')](_0x45ad('0x16'),_0x2873c5[_0x45ad('0x12')],_0x2017b5);_0x121c9f(_0x821131['error'](0x1f4,_0x2873c5['message']));});});};exports[_0x45ad('0x21')]=function(_0x32a352){var _0x43fd86=this;return new Promise(function(_0x1f019a,_0x1006e1){return db[_0x45ad('0x17')][_0x45ad('0x22')](_0x32a352['body'],{'raw':_0x32a352[_0x45ad('0x19')]?_0x32a352['options'][_0x45ad('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x80b403){logger[_0x45ad('0x13')](_0x45ad('0x21'),_0x32a352);logger[_0x45ad('0x23')](_0x45ad('0x21'),_0x32a352,JSON[_0x45ad('0x10')](_0x80b403));_0x1f019a(_0x80b403);})['catch'](function(_0x5139e2){logger['error'](_0x45ad('0x21'),_0x5139e2[_0x45ad('0x12')],_0x32a352);_0x1006e1(_0x43fd86[_0x45ad('0x11')](0x1f4,_0x5139e2[_0x45ad('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x384a01){var _0x170383=this;return new Promise(function(_0x21b43a,_0x143e1d){return db['VoiceCallReport'][_0x45ad('0x24')](_0x384a01[_0x45ad('0x25')],{'raw':_0x384a01[_0x45ad('0x19')]?_0x384a01[_0x45ad('0x19')][_0x45ad('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x384a01['options']?_0x384a01['options']['where']||null:null,'attributes':_0x384a01[_0x45ad('0x19')]?_0x384a01['options'][_0x45ad('0x1c')]||null:null,'limit':_0x384a01['options']?_0x384a01[_0x45ad('0x19')]['limit']||null:null})[_0x45ad('0xc')](function(_0x591fc0){logger['info']('UpdateVoiceCallReport',_0x384a01);logger[_0x45ad('0x23')](_0x45ad('0x26'),_0x384a01,JSON[_0x45ad('0x10')](_0x591fc0));_0x21b43a(_0x591fc0);})[_0x45ad('0x15')](function(_0x4ef74d){logger[_0x45ad('0x11')](_0x45ad('0x26'),_0x4ef74d[_0x45ad('0x12')],_0x384a01);_0x143e1d(_0x170383[_0x45ad('0x11')](0x1f4,_0x4ef74d[_0x45ad('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 5945690..60499b3 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 _0xb4da=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x85f2ab,_0x4c143e){var _0x32e4c4=function(_0x22ba7c){while(--_0x22ba7c){_0x85f2ab['push'](_0x85f2ab['shift']());}};_0x32e4c4(++_0x4c143e);}(_0xb4da,0xb2));var _0xab4d=function(_0x381e59,_0x215455){_0x381e59=_0x381e59-0x0;var _0x55edc0=_0xb4da[_0x381e59];return _0x55edc0;};'use strict';var multer=require(_0xab4d('0x0'));var util=require(_0xab4d('0x1'));var path=require(_0xab4d('0x2'));var timeout=require(_0xab4d('0x3'));var express=require(_0xab4d('0x4'));var router=express[_0xab4d('0x5')]();var fs_extra=require(_0xab4d('0x6'));var auth=require(_0xab4d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xab4d('0x8'));var controller=require(_0xab4d('0x9'));router[_0xab4d('0xa')]('/',auth[_0xab4d('0xb')](),controller['index']);router['get'](_0xab4d('0xc'),auth[_0xab4d('0xb')](),controller[_0xab4d('0xd')]);router[_0xab4d('0xe')]('/',auth[_0xab4d('0xb')](),controller[_0xab4d('0xf')]);router[_0xab4d('0x10')](_0xab4d('0xc'),auth[_0xab4d('0xb')](),controller[_0xab4d('0x11')]);router[_0xab4d('0x12')](_0xab4d('0xc'),auth[_0xab4d('0xb')](),controller[_0xab4d('0x13')]);module['exports']=router; \ No newline at end of file +var _0x14e6=['util','connect-timeout','Router','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','post','create','put','update','delete','exports','multer'];(function(_0x76b7af,_0x57ff6f){var _0x1f2522=function(_0x479548){while(--_0x479548){_0x76b7af['push'](_0x76b7af['shift']());}};_0x1f2522(++_0x57ff6f);}(_0x14e6,0x14f));var _0x614e=function(_0x43a84a,_0x6c500e){_0x43a84a=_0x43a84a-0x0;var _0x2ed43a=_0x14e6[_0x43a84a];return _0x2ed43a;};'use strict';var multer=require(_0x614e('0x0'));var util=require(_0x614e('0x1'));var path=require('path');var timeout=require(_0x614e('0x2'));var express=require('express');var router=express[_0x614e('0x3')]();var fs_extra=require(_0x614e('0x4'));var auth=require(_0x614e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x614e('0x6')]('/',auth['isAuthenticated'](),controller[_0x614e('0x7')]);router[_0x614e('0x6')](_0x614e('0x8'),auth[_0x614e('0x9')](),controller['show']);router[_0x614e('0xa')]('/',auth[_0x614e('0x9')](),controller[_0x614e('0xb')]);router[_0x614e('0xc')](_0x614e('0x8'),auth['isAuthenticated'](),controller[_0x614e('0xd')]);router[_0x614e('0xe')](_0x614e('0x8'),auth[_0x614e('0x9')](),controller['destroy']);module[_0x614e('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 147bc6a..e0cd7c2 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 _0x9018=['join','getDataValue','split','BOOLEAN','exports','STRING','setDataValue','options'];(function(_0x4b4cec,_0x7c723a){var _0x3ea615=function(_0x3c6eb7){while(--_0x3c6eb7){_0x4b4cec['push'](_0x4b4cec['shift']());}};_0x3ea615(++_0x7c723a);}(_0x9018,0x124));var _0x8901=function(_0x46c9cc,_0xd27dca){_0x46c9cc=_0x46c9cc-0x0;var _0x21b46e=_0x9018[_0x46c9cc];return _0x21b46e;};'use strict';var Sequelize=require('sequelize');module[_0x8901('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x8901('0x1')],'set':function(_0x5d968c){this[_0x8901('0x2')](_0x8901('0x3'),_0x5d968c?_0x5d968c[_0x8901('0x4')](''):[]);},'get':function(){return this[_0x8901('0x5')](_0x8901('0x3'))?this[_0x8901('0x5')]('options')[_0x8901('0x6')](''):[];}},'auth':{'type':Sequelize[_0x8901('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x8901('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x8901('0x1')]},'description':{'type':Sequelize[_0x8901('0x1')]}}; \ No newline at end of file +var _0x9db4=['name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','STRING'];(function(_0x21b912,_0x45be54){var _0x5ceac5=function(_0x551aec){while(--_0x551aec){_0x21b912['push'](_0x21b912['shift']());}};_0x5ceac5(++_0x45be54);}(_0x9db4,0x130));var _0x49db=function(_0x3b0a5e,_0x1f1d7c){_0x3b0a5e=_0x3b0a5e-0x0;var _0x4e610c=_0x9db4[_0x3b0a5e];return _0x4e610c;};'use strict';var Sequelize=require(_0x49db('0x0'));module['exports']={'name':{'type':Sequelize[_0x49db('0x1')]},'prefix':{'type':Sequelize[_0x49db('0x1')],'unique':_0x49db('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x49db('0x1')],'set':function(_0x5ba794){this[_0x49db('0x3')](_0x49db('0x4'),_0x5ba794?_0x5ba794[_0x49db('0x5')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0x49db('0x6')](_0x49db('0x4'))[_0x49db('0x7')](''):[];}},'auth':{'type':Sequelize[_0x49db('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x49db('0x1')]},'record':{'type':Sequelize[_0x49db('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x49db('0x1')]},'description':{'type':Sequelize[_0x49db('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 5c78dc8..9b5464f 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 _0xdace=['ChanSpies','UserProfileResource','name','send','map','VoiceChanSpy','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','get'];(function(_0x12d779,_0x1eaae4){var _0x56b9b2=function(_0x1b199e){while(--_0x1b199e){_0x12d779['push'](_0x12d779['shift']());}};_0x56b9b2(++_0x1eaae4);}(_0xdace,0xc5));var _0xedac=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0xdace[_0x13ff53];return _0x290228;};'use strict';var emlformat=require(_0xedac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xedac('0x1'));var jsonpatch=require(_0xedac('0x2'));var rp=require(_0xedac('0x3'));var moment=require('moment');var BPromise=require(_0xedac('0x4'));var Mustache=require(_0xedac('0x5'));var util=require(_0xedac('0x6'));var path=require(_0xedac('0x7'));var sox=require('sox');var csv=require(_0xedac('0x8'));var ejs=require(_0xedac('0x9'));var fs=require('fs');var fs_extra=require(_0xedac('0xa'));var _=require('lodash');var squel=require(_0xedac('0xb'));var crypto=require(_0xedac('0xc'));var jsforce=require(_0xedac('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xedac('0x8'));var querystring=require(_0xedac('0xe'));var Papa=require(_0xedac('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xedac('0x10'));var as=require(_0xedac('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xedac('0x12'));var utils=require(_0xedac('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xedac('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21c6ae,_0x1b0503){_0x1b0503=_0x1b0503||0xcc;return function(_0x306af5){if(_0x306af5){return _0x21c6ae[_0xedac('0x15')](_0x1b0503);}return _0x21c6ae[_0xedac('0x16')](_0x1b0503)[_0xedac('0x17')]();};}function respondWithResult(_0x28444a,_0x11f0b0){_0x11f0b0=_0x11f0b0||0xc8;return function(_0x593030){if(_0x593030){return _0x28444a[_0xedac('0x16')](_0x11f0b0)[_0xedac('0x18')](_0x593030);}};}function respondWithFilteredResult(_0x2f0c7c,_0x2676c3){return function(_0x15068){if(_0x15068){var _0x590e9b=typeof _0x2676c3[_0xedac('0x19')]==='undefined'&&typeof _0x2676c3[_0xedac('0x1a')]===_0xedac('0x1b');var _0xdad128=_0x15068[_0xedac('0x1c')];var _0x4fb540=_0x590e9b?0x0:_0x2676c3['offset'];var _0x2d02d7=_0x590e9b?_0x15068[_0xedac('0x1c')]:_0x2676c3[_0xedac('0x19')]+_0x2676c3[_0xedac('0x1a')];var _0x5a5438;if(_0x2d02d7>=_0xdad128){_0x2d02d7=_0xdad128;_0x5a5438=0xc8;}else{_0x5a5438=0xce;}_0x2f0c7c['status'](_0x5a5438);return _0x2f0c7c[_0xedac('0x1d')](_0xedac('0x1e'),_0x4fb540+'-'+_0x2d02d7+'/'+_0xdad128)[_0xedac('0x18')](_0x15068);}return null;};}function patchUpdates(_0xcc1605){return function(_0x2f5eee){try{jsonpatch[_0xedac('0x1f')](_0x2f5eee,_0xcc1605,!![]);}catch(_0x160be7){return BPromise[_0xedac('0x20')](_0x160be7);}return _0x2f5eee['save']();};}function saveUpdates(_0x4593e8,_0x510005){return function(_0x29cd40){if(_0x29cd40){return _0x29cd40[_0xedac('0x21')](_0x4593e8)['then'](function(_0x46e09d){return _0x46e09d;});}return null;};}function removeEntity(_0x404b8d,_0x1c87bf){return function(_0x1e5e47){if(_0x1e5e47){return _0x1e5e47[_0xedac('0x22')]()[_0xedac('0x23')](function(){var _0x5d7c31=_0x1e5e47[_0xedac('0x24')]({'plain':!![]});var _0x87d343=_0xedac('0x25');return db[_0xedac('0x26')][_0xedac('0x22')]({'where':{'type':_0x87d343,'resourceId':_0x5d7c31['id']}})[_0xedac('0x23')](function(){return _0x1e5e47;});})[_0xedac('0x23')](function(){_0x404b8d[_0xedac('0x16')](0xcc)[_0xedac('0x17')]();});}};}function handleEntityNotFound(_0x4663c0,_0x4c5566){return function(_0x25d7f5){if(!_0x25d7f5){_0x4663c0[_0xedac('0x15')](0x194);}return _0x25d7f5;};}function handleError(_0x19aed3,_0x5dff75){_0x5dff75=_0x5dff75||0x1f4;return function(_0x313e06){logger['error'](_0x313e06['stack']);if(_0x313e06[_0xedac('0x27')]){delete _0x313e06[_0xedac('0x27')];}_0x19aed3[_0xedac('0x16')](_0x5dff75)[_0xedac('0x28')](_0x313e06);};}exports['index']=function(_0x4e25da,_0xe813e6){var _0x32d945={},_0x24b182={},_0x2ee8d7={'count':0x0,'rows':[]};var _0x1b2a93=_[_0xedac('0x29')](db[_0xedac('0x2a')]['rawAttributes'],function(_0x3bc910){return{'name':_0x3bc910[_0xedac('0x2b')],'type':_0x3bc910[_0xedac('0x2c')]['key']};});_0x24b182[_0xedac('0x2d')]=_[_0xedac('0x29')](_0x1b2a93,'name');_0x24b182[_0xedac('0x2e')]=_[_0xedac('0x2f')](_0x4e25da['query']);_0x24b182[_0xedac('0x30')]=_[_0xedac('0x31')](_0x24b182[_0xedac('0x2d')],_0x24b182[_0xedac('0x2e')]);_0x32d945[_0xedac('0x32')]=_[_0xedac('0x31')](_0x24b182[_0xedac('0x2d')],qs[_0xedac('0x33')](_0x4e25da[_0xedac('0x2e')][_0xedac('0x33')]));_0x32d945['attributes']=_0x32d945[_0xedac('0x32')][_0xedac('0x34')]?_0x32d945[_0xedac('0x32')]:_0x24b182[_0xedac('0x2d')];if(!_0x4e25da[_0xedac('0x2e')][_0xedac('0x35')](_0xedac('0x36'))){_0x32d945[_0xedac('0x1a')]=qs[_0xedac('0x1a')](_0x4e25da[_0xedac('0x2e')][_0xedac('0x1a')]);_0x32d945[_0xedac('0x19')]=qs[_0xedac('0x19')](_0x4e25da[_0xedac('0x2e')][_0xedac('0x19')]);}_0x32d945['order']=qs[_0xedac('0x37')](_0x4e25da[_0xedac('0x2e')][_0xedac('0x37')]);_0x32d945[_0xedac('0x38')]=qs['filters'](_[_0xedac('0x39')](_0x4e25da[_0xedac('0x2e')],_0x24b182[_0xedac('0x30')]),_0x1b2a93);if(_0x4e25da['query'][_0xedac('0x3a')]){_0x32d945[_0xedac('0x38')]=_[_0xedac('0x3b')](_0x32d945['where'],{'$or':_[_0xedac('0x29')](_0x1b2a93,function(_0x17b7c3){if(_0x17b7c3['type']!==_0xedac('0x3c')){var _0x2fa832={};_0x2fa832[_0x17b7c3['name']]={'$like':'%'+_0x4e25da[_0xedac('0x2e')]['filter']+'%'};return _0x2fa832;}})});}_0x32d945=_[_0xedac('0x3b')]({},_0x32d945,_0x4e25da[_0xedac('0x3d')]);var _0x2e3fcd={'where':_0x32d945[_0xedac('0x38')]};return db[_0xedac('0x2a')][_0xedac('0x1c')](_0x2e3fcd)['then'](function(_0x2370aa){_0x2ee8d7[_0xedac('0x1c')]=_0x2370aa;if(_0x4e25da[_0xedac('0x2e')][_0xedac('0x3e')]){_0x32d945[_0xedac('0x3f')]=[{'all':!![]}];}return db[_0xedac('0x2a')][_0xedac('0x40')](_0x32d945);})[_0xedac('0x23')](function(_0x2dcff4){_0x2ee8d7[_0xedac('0x41')]=_0x2dcff4;return _0x2ee8d7;})[_0xedac('0x23')](respondWithFilteredResult(_0xe813e6,_0x32d945))[_0xedac('0x42')](handleError(_0xe813e6,null));};exports[_0xedac('0x43')]=function(_0x1418ff,_0x8742ea){var _0x46f025={'raw':![],'where':{'id':_0x1418ff[_0xedac('0x44')]['id']}},_0x4cbae0={};_0x4cbae0[_0xedac('0x2d')]=_[_0xedac('0x2f')](db['VoiceChanSpy']['rawAttributes']);_0x4cbae0['query']=_[_0xedac('0x2f')](_0x1418ff[_0xedac('0x2e')]);_0x4cbae0['filters']=_[_0xedac('0x31')](_0x4cbae0['model'],_0x4cbae0[_0xedac('0x2e')]);_0x46f025['attributes']=_[_0xedac('0x31')](_0x4cbae0[_0xedac('0x2d')],qs[_0xedac('0x33')](_0x1418ff[_0xedac('0x2e')][_0xedac('0x33')]));_0x46f025['attributes']=_0x46f025['attributes'][_0xedac('0x34')]?_0x46f025['attributes']:_0x4cbae0[_0xedac('0x2d')];if(_0x1418ff[_0xedac('0x2e')][_0xedac('0x3e')]){_0x46f025['include']=[{'all':!![]}];}_0x46f025=_[_0xedac('0x3b')]({},_0x46f025,_0x1418ff[_0xedac('0x3d')]);return db[_0xedac('0x2a')]['find'](_0x46f025)[_0xedac('0x23')](handleEntityNotFound(_0x8742ea,null))[_0xedac('0x23')](respondWithResult(_0x8742ea,null))[_0xedac('0x42')](handleError(_0x8742ea,null));};exports['create']=function(_0x5e6079,_0x2cb3ca){return db[_0xedac('0x2a')]['create'](_0x5e6079['body'],{})[_0xedac('0x23')](function(_0x38425e){var _0x4e81bc=_0x5e6079[_0xedac('0x45')]['get']({'plain':!![]});if(!_0x4e81bc)throw new Error(_0xedac('0x46'));if(_0x4e81bc[_0xedac('0x47')]===_0xedac('0x45')){var _0x104842=_0x38425e[_0xedac('0x24')]({'plain':!![]});var _0x10ad82='ChanSpies';return db[_0xedac('0x48')][_0xedac('0x49')]({'where':{'name':_0x10ad82,'userProfileId':_0x4e81bc['userProfileId']},'raw':!![]})[_0xedac('0x23')](function(_0x2d0846){if(_0x2d0846&&_0x2d0846[_0xedac('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x104842[_0xedac('0x27')],'resourceId':_0x104842['id'],'type':_0x2d0846[_0xedac('0x27')],'sectionId':_0x2d0846['id']},{})['then'](function(){return _0x38425e;});}else{return _0x38425e;}})[_0xedac('0x42')](function(_0x1bb739){logger[_0xedac('0x4b')](_0xedac('0x4c'),_0x1bb739);throw _0x1bb739;});}return _0x38425e;})[_0xedac('0x23')](respondWithResult(_0x2cb3ca,0xc9))[_0xedac('0x42')](handleError(_0x2cb3ca,null));};exports[_0xedac('0x21')]=function(_0x15d582,_0x5a6e3c){if(_0x15d582['body']['id']){delete _0x15d582[_0xedac('0x4d')]['id'];}return db[_0xedac('0x2a')][_0xedac('0x49')]({'where':{'id':_0x15d582['params']['id']}})[_0xedac('0x23')](handleEntityNotFound(_0x5a6e3c,null))[_0xedac('0x23')](saveUpdates(_0x15d582['body'],null))[_0xedac('0x23')](respondWithResult(_0x5a6e3c,null))[_0xedac('0x42')](handleError(_0x5a6e3c,null));};exports['destroy']=function(_0x575620,_0x5ad779){return db[_0xedac('0x2a')]['find']({'where':{'id':_0x575620[_0xedac('0x44')]['id']}})['then'](handleEntityNotFound(_0x5ad779,null))['then'](removeEntity(_0x5ad779,null))[_0xedac('0x42')](handleError(_0x5ad779,null));}; \ No newline at end of file +var _0x35a9=['attributes','fields','query','length','nolimit','order','sort','pick','merge','where','map','type','VIRTUAL','filter','includeAll','include','VoiceChanSpy','findAll','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','rawAttributes','key','model','keys','filters','intersection'];(function(_0x5ef08d,_0x2ff781){var _0x5658eb=function(_0x2afdde){while(--_0x2afdde){_0x5ef08d['push'](_0x5ef08d['shift']());}};_0x5658eb(++_0x2ff781);}(_0x35a9,0x73));var _0x935a=function(_0x9280f5,_0x55d8b7){_0x9280f5=_0x9280f5-0x0;var _0x59531a=_0x35a9[_0x9280f5];return _0x59531a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x935a('0x0'));var zipdir=require(_0x935a('0x1'));var jsonpatch=require(_0x935a('0x2'));var rp=require(_0x935a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x935a('0x4'));var util=require('util');var path=require(_0x935a('0x5'));var sox=require(_0x935a('0x6'));var csv=require(_0x935a('0x7'));var ejs=require(_0x935a('0x8'));var fs=require('fs');var fs_extra=require(_0x935a('0x9'));var _=require(_0x935a('0xa'));var squel=require(_0x935a('0xb'));var crypto=require(_0x935a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x935a('0xd'));var toCsv=require(_0x935a('0x7'));var querystring=require(_0x935a('0xe'));var Papa=require(_0x935a('0xf'));var Redis=require(_0x935a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x935a('0x11'));var as=require(_0x935a('0x12'));var hardwareService=require(_0x935a('0x13'));var logger=require('../../config/logger')(_0x935a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x935a('0x15'));var db=require(_0x935a('0x16'))['db'];function respondWithStatusCode(_0x1e5152,_0x441f98){_0x441f98=_0x441f98||0xcc;return function(_0x3ed7e0){if(_0x3ed7e0){return _0x1e5152[_0x935a('0x17')](_0x441f98);}return _0x1e5152[_0x935a('0x18')](_0x441f98)[_0x935a('0x19')]();};}function respondWithResult(_0x5e1131,_0x109a98){_0x109a98=_0x109a98||0xc8;return function(_0x304c38){if(_0x304c38){return _0x5e1131[_0x935a('0x18')](_0x109a98)[_0x935a('0x1a')](_0x304c38);}};}function respondWithFilteredResult(_0xeebc0c,_0x22ab95){return function(_0xf881d6){if(_0xf881d6){var _0x463db1=typeof _0x22ab95[_0x935a('0x1b')]===_0x935a('0x1c')&&typeof _0x22ab95['limit']===_0x935a('0x1c');var _0x2aab94=_0xf881d6[_0x935a('0x1d')];var _0x446232=_0x463db1?0x0:_0x22ab95[_0x935a('0x1b')];var _0x3bac3e=_0x463db1?_0xf881d6[_0x935a('0x1d')]:_0x22ab95['offset']+_0x22ab95[_0x935a('0x1e')];var _0x90ef4;if(_0x3bac3e>=_0x2aab94){_0x3bac3e=_0x2aab94;_0x90ef4=0xc8;}else{_0x90ef4=0xce;}_0xeebc0c[_0x935a('0x18')](_0x90ef4);return _0xeebc0c[_0x935a('0x1f')]('Content-Range',_0x446232+'-'+_0x3bac3e+'/'+_0x2aab94)[_0x935a('0x1a')](_0xf881d6);}return null;};}function patchUpdates(_0x2c6873){return function(_0x53267b){try{jsonpatch[_0x935a('0x20')](_0x53267b,_0x2c6873,!![]);}catch(_0x257eb9){return BPromise[_0x935a('0x21')](_0x257eb9);}return _0x53267b[_0x935a('0x22')]();};}function saveUpdates(_0xe04139,_0x490627){return function(_0x267c48){if(_0x267c48){return _0x267c48[_0x935a('0x23')](_0xe04139)[_0x935a('0x24')](function(_0x4dd7aa){return _0x4dd7aa;});}return null;};}function removeEntity(_0x13e62a,_0x413787){return function(_0x326246){if(_0x326246){return _0x326246[_0x935a('0x25')]()['then'](function(){var _0x540f4e=_0x326246[_0x935a('0x26')]({'plain':!![]});var _0x46b6b8='ChanSpies';return db[_0x935a('0x27')][_0x935a('0x25')]({'where':{'type':_0x46b6b8,'resourceId':_0x540f4e['id']}})[_0x935a('0x24')](function(){return _0x326246;});})[_0x935a('0x24')](function(){_0x13e62a[_0x935a('0x18')](0xcc)[_0x935a('0x19')]();});}};}function handleEntityNotFound(_0x194a2a,_0x752f15){return function(_0x385ca2){if(!_0x385ca2){_0x194a2a[_0x935a('0x17')](0x194);}return _0x385ca2;};}function handleError(_0x31562c,_0x422d1c){_0x422d1c=_0x422d1c||0x1f4;return function(_0x595b1c){logger[_0x935a('0x28')](_0x595b1c[_0x935a('0x29')]);if(_0x595b1c[_0x935a('0x2a')]){delete _0x595b1c['name'];}_0x31562c[_0x935a('0x18')](_0x422d1c)[_0x935a('0x2b')](_0x595b1c);};}exports[_0x935a('0x2c')]=function(_0x1bb4e4,_0x48c9b5){var _0x1ab791={},_0x9c7f8d={},_0x16f0d8={'count':0x0,'rows':[]};var _0x2850fc=_['map'](db['VoiceChanSpy'][_0x935a('0x2d')],function(_0x226bb4){return{'name':_0x226bb4['fieldName'],'type':_0x226bb4['type'][_0x935a('0x2e')]};});_0x9c7f8d[_0x935a('0x2f')]=_['map'](_0x2850fc,_0x935a('0x2a'));_0x9c7f8d['query']=_[_0x935a('0x30')](_0x1bb4e4['query']);_0x9c7f8d[_0x935a('0x31')]=_[_0x935a('0x32')](_0x9c7f8d['model'],_0x9c7f8d['query']);_0x1ab791[_0x935a('0x33')]=_[_0x935a('0x32')](_0x9c7f8d[_0x935a('0x2f')],qs[_0x935a('0x34')](_0x1bb4e4[_0x935a('0x35')][_0x935a('0x34')]));_0x1ab791[_0x935a('0x33')]=_0x1ab791[_0x935a('0x33')][_0x935a('0x36')]?_0x1ab791[_0x935a('0x33')]:_0x9c7f8d['model'];if(!_0x1bb4e4['query']['hasOwnProperty'](_0x935a('0x37'))){_0x1ab791[_0x935a('0x1e')]=qs[_0x935a('0x1e')](_0x1bb4e4[_0x935a('0x35')][_0x935a('0x1e')]);_0x1ab791[_0x935a('0x1b')]=qs['offset'](_0x1bb4e4[_0x935a('0x35')]['offset']);}_0x1ab791[_0x935a('0x38')]=qs[_0x935a('0x39')](_0x1bb4e4[_0x935a('0x35')][_0x935a('0x39')]);_0x1ab791['where']=qs[_0x935a('0x31')](_[_0x935a('0x3a')](_0x1bb4e4[_0x935a('0x35')],_0x9c7f8d[_0x935a('0x31')]),_0x2850fc);if(_0x1bb4e4[_0x935a('0x35')]['filter']){_0x1ab791['where']=_[_0x935a('0x3b')](_0x1ab791[_0x935a('0x3c')],{'$or':_[_0x935a('0x3d')](_0x2850fc,function(_0x43a566){if(_0x43a566[_0x935a('0x3e')]!==_0x935a('0x3f')){var _0x1a245e={};_0x1a245e[_0x43a566[_0x935a('0x2a')]]={'$like':'%'+_0x1bb4e4[_0x935a('0x35')][_0x935a('0x40')]+'%'};return _0x1a245e;}})});}_0x1ab791=_[_0x935a('0x3b')]({},_0x1ab791,_0x1bb4e4['options']);var _0x2a48ef={'where':_0x1ab791['where']};return db['VoiceChanSpy'][_0x935a('0x1d')](_0x2a48ef)['then'](function(_0x3f5653){_0x16f0d8[_0x935a('0x1d')]=_0x3f5653;if(_0x1bb4e4[_0x935a('0x35')][_0x935a('0x41')]){_0x1ab791[_0x935a('0x42')]=[{'all':!![]}];}return db[_0x935a('0x43')][_0x935a('0x44')](_0x1ab791);})['then'](function(_0x2d734d){_0x16f0d8['rows']=_0x2d734d;return _0x16f0d8;})[_0x935a('0x24')](respondWithFilteredResult(_0x48c9b5,_0x1ab791))[_0x935a('0x45')](handleError(_0x48c9b5,null));};exports[_0x935a('0x46')]=function(_0x1bee32,_0x196c4f){var _0x8ba2a9={'raw':![],'where':{'id':_0x1bee32[_0x935a('0x47')]['id']}},_0x4c3a61={};_0x4c3a61['model']=_[_0x935a('0x30')](db['VoiceChanSpy'][_0x935a('0x2d')]);_0x4c3a61[_0x935a('0x35')]=_['keys'](_0x1bee32[_0x935a('0x35')]);_0x4c3a61[_0x935a('0x31')]=_[_0x935a('0x32')](_0x4c3a61[_0x935a('0x2f')],_0x4c3a61[_0x935a('0x35')]);_0x8ba2a9[_0x935a('0x33')]=_['intersection'](_0x4c3a61['model'],qs[_0x935a('0x34')](_0x1bee32['query'][_0x935a('0x34')]));_0x8ba2a9[_0x935a('0x33')]=_0x8ba2a9[_0x935a('0x33')][_0x935a('0x36')]?_0x8ba2a9[_0x935a('0x33')]:_0x4c3a61[_0x935a('0x2f')];if(_0x1bee32[_0x935a('0x35')][_0x935a('0x41')]){_0x8ba2a9['include']=[{'all':!![]}];}_0x8ba2a9=_[_0x935a('0x3b')]({},_0x8ba2a9,_0x1bee32[_0x935a('0x48')]);return db[_0x935a('0x43')][_0x935a('0x49')](_0x8ba2a9)[_0x935a('0x24')](handleEntityNotFound(_0x196c4f,null))[_0x935a('0x24')](respondWithResult(_0x196c4f,null))[_0x935a('0x45')](handleError(_0x196c4f,null));};exports[_0x935a('0x4a')]=function(_0x479124,_0x23e85f){return db['VoiceChanSpy']['create'](_0x479124['body'],{})[_0x935a('0x24')](function(_0x384de0){var _0x1be4e2=_0x479124[_0x935a('0x4b')]['get']({'plain':!![]});if(!_0x1be4e2)throw new Error(_0x935a('0x4c'));if(_0x1be4e2['role']==='user'){var _0x41c5dc=_0x384de0[_0x935a('0x26')]({'plain':!![]});var _0x2d309e=_0x935a('0x4d');return db[_0x935a('0x4e')][_0x935a('0x49')]({'where':{'name':_0x2d309e,'userProfileId':_0x1be4e2[_0x935a('0x4f')]},'raw':!![]})['then'](function(_0x2d48e3){if(_0x2d48e3&&_0x2d48e3[_0x935a('0x50')]===0x0){return db['UserProfileResource'][_0x935a('0x4a')]({'name':_0x41c5dc['name'],'resourceId':_0x41c5dc['id'],'type':_0x2d48e3['name'],'sectionId':_0x2d48e3['id']},{})['then'](function(){return _0x384de0;});}else{return _0x384de0;}})[_0x935a('0x45')](function(_0x2ce8fe){logger['error'](_0x935a('0x51'),_0x2ce8fe);throw _0x2ce8fe;});}return _0x384de0;})[_0x935a('0x24')](respondWithResult(_0x23e85f,0xc9))[_0x935a('0x45')](handleError(_0x23e85f,null));};exports[_0x935a('0x23')]=function(_0xde20f9,_0x22552a){if(_0xde20f9[_0x935a('0x52')]['id']){delete _0xde20f9[_0x935a('0x52')]['id'];}return db[_0x935a('0x43')][_0x935a('0x49')]({'where':{'id':_0xde20f9[_0x935a('0x47')]['id']}})['then'](handleEntityNotFound(_0x22552a,null))[_0x935a('0x24')](saveUpdates(_0xde20f9[_0x935a('0x52')],null))[_0x935a('0x24')](respondWithResult(_0x22552a,null))[_0x935a('0x45')](handleError(_0x22552a,null));};exports[_0x935a('0x25')]=function(_0x5874b6,_0x5601d1){return db[_0x935a('0x43')]['find']({'where':{'id':_0x5874b6[_0x935a('0x47')]['id']}})[_0x935a('0x24')](handleEntityNotFound(_0x5601d1,null))['then'](removeEntity(_0x5601d1,null))[_0x935a('0x45')](handleError(_0x5601d1,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 5006880..2b047c4 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 _0x13ec=['destroy','lodash','bluebird','./voiceChanSpy.attributes','context','format','%s%s','push','merge','CDR(type)=%s','chanspy','record','MixMonitor','recordingFormat','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate'];(function(_0x362c9d,_0x3b8c08){var _0x2b3545=function(_0x431b79){while(--_0x431b79){_0x362c9d['push'](_0x362c9d['shift']());}};_0x2b3545(++_0x3b8c08);}(_0x13ec,0x155));var _0xc13e=function(_0x2509b1,_0xe52947){_0x2509b1=_0x2509b1-0x0;var _0x3bbdd3=_0x13ec[_0x2509b1];return _0x3bbdd3;};'use strict';var _=require(_0xc13e('0x0'));var util=require('util');var BPromise=require(_0xc13e('0x1'));var attributes=require(_0xc13e('0x2'));var getUserApplications=function(_0xe768da,_0x27dd4b,_0x2fcb7d){var _0x50d0df=0x1;var _0x2b1594=[];var _0x56d2af={'context':_0x27dd4b[_0xc13e('0x3')]||'from-sip','exten':util[_0xc13e('0x4')](_0xc13e('0x5'),_0xe768da['prefix'],_0x2fcb7d),'type':'system','isApp':![],'ChanSpyId':_0xe768da['id'],'UserId':_0x27dd4b['id']};_0x2b1594[_0xc13e('0x6')](_[_0xc13e('0x7')]({'app':'Set','appdata':util[_0xc13e('0x4')](_0xc13e('0x8'),_0xc13e('0x9')),'priority':_0x50d0df++},_0x56d2af));if(_0xe768da[_0xc13e('0xa')]){_0x2b1594[_0xc13e('0x6')](_[_0xc13e('0x7')]({'app':_0xc13e('0xb'),'appdata':util[_0xc13e('0x4')]('${UNIQUEID}.%s,a',_0xe768da[_0xc13e('0xc')]),'priority':_0x50d0df++},_0x56d2af));}if(_0xe768da['auth']){_0x2b1594[_0xc13e('0x6')](_[_0xc13e('0x7')]({'app':'Authenticate','appdata':_0xe768da['password'],'priority':_0x50d0df++},_0x56d2af));}_0x2b1594['push'](_[_0xc13e('0x7')]({'app':_0xc13e('0xd'),'appdata':util[_0xc13e('0x4')](_0xc13e('0xe'),_0x27dd4b['name'],_0xe768da[_0xc13e('0xf')]?_0xe768da[_0xc13e('0xf')][_0xc13e('0x10')](''):''),'priority':_0x50d0df++},_0x56d2af));if(_0xe768da[_0xc13e('0xa')]){_0x2b1594[_0xc13e('0x6')](_[_0xc13e('0x7')]({'app':_0xc13e('0x11'),'priority':_0x50d0df++},_0x56d2af));}return _0x2b1594;};var getChanSpyApplications=function(_0x34d07f,_0x4348bb){var _0x4a3c91=[];for(var _0x15cb34=0x0,_0x3dc59e=0x1;_0x15cb34<_0x4348bb[_0xc13e('0x12')];_0x15cb34++,_0x3dc59e=0x1){_0x4a3c91=_0x4a3c91[_0xc13e('0x13')](getUserApplications(_0x34d07f,_0x4348bb[_0x15cb34],_0x4348bb[_0x15cb34][_0xc13e('0x14')]));if(_0x4348bb[_0x15cb34]['internal']!=_0x4348bb[_0x15cb34][_0xc13e('0x15')]){_0x4a3c91=_0x4a3c91[_0xc13e('0x13')](getUserApplications(_0x34d07f,_0x4348bb[_0x15cb34],_0x4348bb[_0x15cb34][_0xc13e('0x15')]));}}return _0x4a3c91;};var getChanSpyPromise=function(_0x1962b7,_0x5ad389){return new BPromise(function(_0x81530f,_0x2aabfb){return _0x1962b7[_0xc13e('0x16')]['findAll']({'attributes':['id',_0xc13e('0x15'),'internal'],'where':{'role':_0xc13e('0x17'),'chanspy':!![]},'raw':!![]})[_0xc13e('0x18')](function(_0x4f638e){if(_0x4f638e){return _0x81530f(getChanSpyApplications(_0x5ad389,_0x4f638e));}return _0x81530f([]);})[_0xc13e('0x19')](function(_0x4e57d6){_0x2aabfb(_0x4e57d6);});});};module[_0xc13e('0x1a')]=function(_0x5df20c,_0x32aaf3){var _0x5ea22c=_0x5df20c[_0xc13e('0x1b')];return _0x5df20c[_0xc13e('0x1c')](_0xc13e('0x1d'),attributes,{'tableName':_0xc13e('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3165e9,_0x154c7e,_0x5c9d49){return getChanSpyPromise(_0x5ea22c,_0x3165e9)[_0xc13e('0x18')](function(_0x47b511){if(_0x47b511&&_0x47b511[_0xc13e('0x12')]){return _0x5ea22c[_0xc13e('0x1f')][_0xc13e('0x20')](_0x47b511);}})[_0xc13e('0x18')](function(){_0x5c9d49();})[_0xc13e('0x19')](function(_0x10ee30){_0x5c9d49(_0x10ee30);});},'afterUpdate':function(_0x4b27ed,_0x50f3b2,_0x5641a0){return _0x5ea22c[_0xc13e('0x1f')][_0xc13e('0x21')]({'where':{'ChanSpyId':_0x4b27ed['id']}})[_0xc13e('0x18')](function(){return getChanSpyPromise(_0x5ea22c,_0x4b27ed);})['then'](function(_0x45cfe4){if(_0x45cfe4&&_0x45cfe4[_0xc13e('0x12')]){return _0x5ea22c[_0xc13e('0x1f')][_0xc13e('0x20')](_0x45cfe4);}})[_0xc13e('0x18')](function(){_0x5641a0();})[_0xc13e('0x19')](function(_0xcfc40a){_0x5641a0(_0xcfc40a);});},'afterDestroy':function(_0x588216,_0x5b3503,_0x25acb3){return _0x5ea22c[_0xc13e('0x1f')][_0xc13e('0x21')]({'where':{'ChanSpyId':_0x588216['id']}})[_0xc13e('0x18')](function(){_0x25acb3();})[_0xc13e('0x19')](function(_0x3352ca){_0x25acb3(_0x3352ca);});}}});}; \ No newline at end of file +var _0x5c0c=['VoiceExtension','bulkCreate','catch','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','Set','CDR(type)=%s','chanspy','record','merge','${UNIQUEID}.%s,a','recordingFormat','auth','password','push','options','length','internal','name','concat','User','findAll','then','exports','voice_chanspy'];(function(_0x4712a2,_0x27374b){var _0x37f872=function(_0x402648){while(--_0x402648){_0x4712a2['push'](_0x4712a2['shift']());}};_0x37f872(++_0x27374b);}(_0x5c0c,0x1c4));var _0xc5c0=function(_0x48770d,_0x2234a3){_0x48770d=_0x48770d-0x0;var _0xc6b269=_0x5c0c[_0x48770d];return _0xc6b269;};'use strict';var _=require(_0xc5c0('0x0'));var util=require('util');var BPromise=require(_0xc5c0('0x1'));var attributes=require(_0xc5c0('0x2'));var getUserApplications=function(_0x468a49,_0x374c3c,_0x3aa2ca){var _0x4d03d5=0x1;var _0x3a8609=[];var _0x4d24a8={'context':_0x374c3c[_0xc5c0('0x3')]||'from-sip','exten':util[_0xc5c0('0x4')](_0xc5c0('0x5'),_0x468a49[_0xc5c0('0x6')],_0x3aa2ca),'type':_0xc5c0('0x7'),'isApp':![],'ChanSpyId':_0x468a49['id'],'UserId':_0x374c3c['id']};_0x3a8609['push'](_['merge']({'app':_0xc5c0('0x8'),'appdata':util[_0xc5c0('0x4')](_0xc5c0('0x9'),_0xc5c0('0xa')),'priority':_0x4d03d5++},_0x4d24a8));if(_0x468a49[_0xc5c0('0xb')]){_0x3a8609['push'](_[_0xc5c0('0xc')]({'app':'MixMonitor','appdata':util[_0xc5c0('0x4')](_0xc5c0('0xd'),_0x468a49[_0xc5c0('0xe')]),'priority':_0x4d03d5++},_0x4d24a8));}if(_0x468a49[_0xc5c0('0xf')]){_0x3a8609['push'](_[_0xc5c0('0xc')]({'app':'Authenticate','appdata':_0x468a49[_0xc5c0('0x10')],'priority':_0x4d03d5++},_0x4d24a8));}_0x3a8609[_0xc5c0('0x11')](_['merge']({'app':'ChanSpy','appdata':util[_0xc5c0('0x4')]('SIP/%s,%s',_0x374c3c['name'],_0x468a49[_0xc5c0('0x12')]?_0x468a49[_0xc5c0('0x12')]['join'](''):''),'priority':_0x4d03d5++},_0x4d24a8));if(_0x468a49[_0xc5c0('0xb')]){_0x3a8609[_0xc5c0('0x11')](_['merge']({'app':'StopMixMonitor','priority':_0x4d03d5++},_0x4d24a8));}return _0x3a8609;};var getChanSpyApplications=function(_0x1498a3,_0x25874c){var _0x34c996=[];for(var _0x7d2133=0x0,_0x3930ad=0x1;_0x7d2133<_0x25874c[_0xc5c0('0x13')];_0x7d2133++,_0x3930ad=0x1){_0x34c996=_0x34c996['concat'](getUserApplications(_0x1498a3,_0x25874c[_0x7d2133],_0x25874c[_0x7d2133][_0xc5c0('0x14')]));if(_0x25874c[_0x7d2133][_0xc5c0('0x14')]!=_0x25874c[_0x7d2133][_0xc5c0('0x15')]){_0x34c996=_0x34c996[_0xc5c0('0x16')](getUserApplications(_0x1498a3,_0x25874c[_0x7d2133],_0x25874c[_0x7d2133]['name']));}}return _0x34c996;};var getChanSpyPromise=function(_0x2239af,_0x5d70b1){return new BPromise(function(_0x53adcd,_0x134480){return _0x2239af[_0xc5c0('0x17')][_0xc5c0('0x18')]({'attributes':['id','name',_0xc5c0('0x14')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xc5c0('0x19')](function(_0xb549ed){if(_0xb549ed){return _0x53adcd(getChanSpyApplications(_0x5d70b1,_0xb549ed));}return _0x53adcd([]);})['catch'](function(_0x4d3c05){_0x134480(_0x4d3c05);});});};module[_0xc5c0('0x1a')]=function(_0x34f845,_0x3bd464){var _0x5369f5=_0x34f845['models'];return _0x34f845['define']('VoiceChanSpy',attributes,{'tableName':_0xc5c0('0x1b'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2114cd,_0x2d4eee,_0x52b15b){return getChanSpyPromise(_0x5369f5,_0x2114cd)[_0xc5c0('0x19')](function(_0x10168c){if(_0x10168c&&_0x10168c[_0xc5c0('0x13')]){return _0x5369f5[_0xc5c0('0x1c')][_0xc5c0('0x1d')](_0x10168c);}})['then'](function(){_0x52b15b();})['catch'](function(_0x66c920){_0x52b15b(_0x66c920);});},'afterUpdate':function(_0x391762,_0x15712f,_0x376568){return _0x5369f5[_0xc5c0('0x1c')]['destroy']({'where':{'ChanSpyId':_0x391762['id']}})['then'](function(){return getChanSpyPromise(_0x5369f5,_0x391762);})['then'](function(_0x1a7bb1){if(_0x1a7bb1&&_0x1a7bb1[_0xc5c0('0x13')]){return _0x5369f5[_0xc5c0('0x1c')][_0xc5c0('0x1d')](_0x1a7bb1);}})['then'](function(){_0x376568();})[_0xc5c0('0x1e')](function(_0x2f5a9e){_0x376568(_0x2f5a9e);});},'afterDestroy':function(_0x4ec45d,_0x3766e,_0x51fdaa){return _0x5369f5['VoiceExtension'][_0xc5c0('0x1f')]({'where':{'ChanSpyId':_0x4ec45d['id']}})[_0xc5c0('0x19')](function(){_0x51fdaa();})[_0xc5c0('0x1e')](function(_0x252a21){_0x51fdaa(_0x252a21);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 6a53463..0099bc1 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 _0x0bb5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3167aa,_0x53ca11){var _0x4d937c=function(_0x7428d2){while(--_0x7428d2){_0x3167aa['push'](_0x3167aa['shift']());}};_0x4d937c(++_0x53ca11);}(_0x0bb5,0x148));var _0x50bb=function(_0x488d9f,_0x3f85d2){_0x488d9f=_0x488d9f-0x0;var _0x8ba133=_0x0bb5[_0x488d9f];return _0x8ba133;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd7aeb,_0x35de5d,_0x2e5463){return new BPromise(function(_0x33ff54,_0x4f9172){return client['request'](_0xfd7aeb,_0x2e5463)[_0x50bb('0xa')](function(_0x1c2174){logger[_0x50bb('0xb')](_0x50bb('0xc'),_0x35de5d,'request\x20sent');logger[_0x50bb('0xd')](_0x50bb('0xe'),_0x35de5d,_0x50bb('0xf'),JSON[_0x50bb('0x10')](_0x1c2174));if(_0x1c2174[_0x50bb('0x11')]){if(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x12')]===0x1f4){logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174['error'][_0x50bb('0x13')]);return _0x4f9172(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);}logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);return _0x33ff54(_0x1c2174['error'][_0x50bb('0x13')]);}else{logger['info'](_0x50bb('0xc'),_0x35de5d,_0x50bb('0xf'));_0x33ff54(_0x1c2174[_0x50bb('0x14')][_0x50bb('0x13')]);}})[_0x50bb('0x15')](function(_0x4f2897){logger[_0x50bb('0x11')](_0x50bb('0xc'),_0x35de5d,_0x4f2897);_0x4f9172(_0x4f2897);});});} \ No newline at end of file +var _0x4746=['request\x20sent','debug','error','code','message','VoiceChanSpy,\x20%s,\x20%s','info','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x5130c3,_0x28c7ba){var _0x971188=function(_0x5b8750){while(--_0x5b8750){_0x5130c3['push'](_0x5130c3['shift']());}};_0x971188(++_0x28c7ba);}(_0x4746,0xc6));var _0x6474=function(_0x2ff00d,_0x378ddf){_0x2ff00d=_0x2ff00d-0x0;var _0x408b87=_0x4746[_0x2ff00d];return _0x408b87;};'use strict';var _=require(_0x6474('0x0'));var util=require(_0x6474('0x1'));var moment=require('moment');var BPromise=require(_0x6474('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6474('0x3'));var db=require(_0x6474('0x4'))['db'];var utils=require(_0x6474('0x5'));var logger=require(_0x6474('0x6'))(_0x6474('0x7'));var config=require('../../config/environment');var jayson=require(_0x6474('0x8'));var client=jayson[_0x6474('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x433af9,_0x427f79,_0xcd065e){return new BPromise(function(_0xec3cda,_0x15d4c2){return client[_0x6474('0xa')](_0x433af9,_0xcd065e)['then'](function(_0x1bc38b){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x427f79,_0x6474('0xb'));logger[_0x6474('0xc')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x427f79,_0x6474('0xb'),JSON['stringify'](_0x1bc38b));if(_0x1bc38b[_0x6474('0xd')]){if(_0x1bc38b['error'][_0x6474('0xe')]===0x1f4){logger[_0x6474('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x427f79,_0x1bc38b['error']['message']);return _0x15d4c2(_0x1bc38b[_0x6474('0xd')][_0x6474('0xf')]);}logger[_0x6474('0xd')](_0x6474('0x10'),_0x427f79,_0x1bc38b[_0x6474('0xd')][_0x6474('0xf')]);return _0xec3cda(_0x1bc38b[_0x6474('0xd')][_0x6474('0xf')]);}else{logger[_0x6474('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x427f79,'request\x20sent');_0xec3cda(_0x1bc38b['result'][_0x6474('0xf')]);}})[_0x6474('0x12')](function(_0x29c19b){logger[_0x6474('0xd')](_0x6474('0x10'),_0x427f79,_0x29c19b);_0x15d4c2(_0x29c19b);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 8c3c654..de04e92 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 _0x7e6e=['get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0x7e6e,0x11c));var _0xe7e6=function(_0x172889,_0x3b885e){_0x172889=_0x172889-0x0;var _0x1126da=_0x7e6e[_0x172889];return _0x1126da;};'use strict';var multer=require(_0xe7e6('0x0'));var util=require(_0xe7e6('0x1'));var path=require(_0xe7e6('0x2'));var timeout=require(_0xe7e6('0x3'));var express=require(_0xe7e6('0x4'));var router=express[_0xe7e6('0x5')]();var fs_extra=require(_0xe7e6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe7e6('0x7'));var config=require(_0xe7e6('0x8'));var controller=require(_0xe7e6('0x9'));router[_0xe7e6('0xa')]('/',auth[_0xe7e6('0xb')](),controller['index']);router[_0xe7e6('0xa')](_0xe7e6('0xc'),auth[_0xe7e6('0xb')](),controller[_0xe7e6('0xd')]);router[_0xe7e6('0xe')]('/',auth[_0xe7e6('0xb')](),controller[_0xe7e6('0xf')]);router[_0xe7e6('0x10')](_0xe7e6('0xc'),auth[_0xe7e6('0xb')](),controller[_0xe7e6('0x11')]);router[_0xe7e6('0x12')](_0xe7e6('0xc'),auth[_0xe7e6('0xb')](),controller[_0xe7e6('0x13')]);module[_0xe7e6('0x14')]=router; \ No newline at end of file +var _0x2297=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x5c7618,_0x2482d1){var _0x357f5f=function(_0x133041){while(--_0x133041){_0x5c7618['push'](_0x5c7618['shift']());}};_0x357f5f(++_0x2482d1);}(_0x2297,0xa5));var _0x7229=function(_0x1b5a3d,_0x5db017){_0x1b5a3d=_0x1b5a3d-0x0;var _0x17bff8=_0x2297[_0x1b5a3d];return _0x17bff8;};'use strict';var multer=require('multer');var util=require(_0x7229('0x0'));var path=require(_0x7229('0x1'));var timeout=require(_0x7229('0x2'));var express=require(_0x7229('0x3'));var router=express[_0x7229('0x4')]();var fs_extra=require(_0x7229('0x5'));var auth=require(_0x7229('0x6'));var interaction=require(_0x7229('0x7'));var config=require(_0x7229('0x8'));var controller=require(_0x7229('0x9'));router[_0x7229('0xa')]('/',auth[_0x7229('0xb')](),controller[_0x7229('0xc')]);router[_0x7229('0xa')](_0x7229('0xd'),auth[_0x7229('0xb')](),controller[_0x7229('0xe')]);router['post']('/',auth[_0x7229('0xb')](),controller[_0x7229('0xf')]);router[_0x7229('0x10')](_0x7229('0xd'),auth[_0x7229('0xb')](),controller[_0x7229('0x11')]);router[_0x7229('0x12')](_0x7229('0xd'),auth[_0x7229('0xb')](),controller[_0x7229('0x13')]);module[_0x7229('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index e46cfd0..d1702d2 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 _0x0e9f=['exports','STRING'];(function(_0x3eb02c,_0x1827ad){var _0x3b76d1=function(_0x57ea10){while(--_0x57ea10){_0x3eb02c['push'](_0x3eb02c['shift']());}};_0x3b76d1(++_0x1827ad);}(_0x0e9f,0x7a));var _0xf0e9=function(_0x574c8f,_0x3c0b94){_0x574c8f=_0x574c8f-0x0;var _0x537f9e=_0x0e9f[_0x574c8f];return _0x537f9e;};'use strict';var Sequelize=require('sequelize');module[_0xf0e9('0x0')]={'name':{'type':Sequelize[_0xf0e9('0x1')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf22b=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x523498,_0x2aa7cb){var _0x330a08=function(_0x59db44){while(--_0x59db44){_0x523498['push'](_0x523498['shift']());}};_0x330a08(++_0x2aa7cb);}(_0xf22b,0x1d0));var _0xbf22=function(_0x5d1c9d,_0x8bb82d){_0x5d1c9d=_0x5d1c9d-0x0;var _0x8edfe4=_0xf22b[_0x5d1c9d];return _0x8edfe4;};'use strict';var Sequelize=require(_0xbf22('0x0'));module[_0xbf22('0x1')]={'name':{'type':Sequelize[_0xbf22('0x2')],'unique':_0xbf22('0x3')},'description':{'type':Sequelize[_0xbf22('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbf22('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 5d1fbd4..2720c42 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 _0x16f2=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','count','set','reject','save','update','destroy','get','Contexts','UserProfileResource','name','send','index','map','VoiceContext','fieldName','type','key','filters','model','attributes','intersection','fields','query','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','includeAll','findAll','rows','catch','params','keys','rawAttributes','include','merge','options','find','create','body','readFileSync','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','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','Reload','eml-format','zip-dir','moment','mustache','util','sox','to-csv'];(function(_0xb1eac0,_0x5daea2){var _0xae01ca=function(_0x2bfb3a){while(--_0x2bfb3a){_0xb1eac0['push'](_0xb1eac0['shift']());}};_0xae01ca(++_0x5daea2);}(_0x16f2,0x125));var _0x216f=function(_0x522c6d,_0x4d250d){_0x522c6d=_0x522c6d-0x0;var _0x26300d=_0x16f2[_0x522c6d];return _0x26300d;};'use strict';var emlformat=require(_0x216f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x216f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x216f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x216f('0x3'));var util=require(_0x216f('0x4'));var path=require('path');var sox=require(_0x216f('0x5'));var csv=require(_0x216f('0x6'));var ejs=require(_0x216f('0x7'));var fs=require('fs');var fs_extra=require(_0x216f('0x8'));var _=require('lodash');var squel=require(_0x216f('0x9'));var crypto=require(_0x216f('0xa'));var jsforce=require(_0x216f('0xb'));var deskjs=require(_0x216f('0xc'));var toCsv=require(_0x216f('0x6'));var querystring=require(_0x216f('0xd'));var Papa=require('papaparse');var Redis=require(_0x216f('0xe'));var authService=require(_0x216f('0xf'));var qs=require(_0x216f('0x10'));var as=require(_0x216f('0x11'));var hardwareService=require(_0x216f('0x12'));var logger=require(_0x216f('0x13'))('api');var utils=require(_0x216f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x216f('0x15')][_0x216f('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x5a782f,_0x548b2f,_0x44dc10,_0x24a213){return new BPromise(function(_0x83519f,_0x5963c0){var _0x20da6f=_0x24a213||client;return _0x20da6f['request'](_0x5a782f,_0x44dc10)[_0x216f('0x17')](function(_0x26d118){logger[_0x216f('0x18')](_0x216f('0x19'),_0x548b2f,_0x216f('0x1a'));logger[_0x216f('0x1b')](_0x216f('0x1c'),_0x548b2f,_0x216f('0x1a'),JSON[_0x216f('0x1d')](_0x26d118));if(_0x26d118[_0x216f('0x1e')]){if(_0x26d118[_0x216f('0x1e')][_0x216f('0x1f')]===0x1f4){logger[_0x216f('0x1e')](_0x216f('0x19'),_0x548b2f,_0x26d118['error'][_0x216f('0x20')]);return _0x5963c0(_0x26d118['error'][_0x216f('0x20')]);}logger['error'](_0x216f('0x19'),_0x548b2f,_0x26d118['error'][_0x216f('0x20')]);return _0x83519f(_0x26d118[_0x216f('0x1e')]['message']);}else{logger[_0x216f('0x18')](_0x216f('0x19'),_0x548b2f,_0x216f('0x1a'));_0x83519f(_0x26d118['result'][_0x216f('0x20')]);}})['catch'](function(_0x33b6ee){logger[_0x216f('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x548b2f,_0x33b6ee);_0x5963c0(_0x33b6ee);});});}function respondWithStatusCode(_0x12411d,_0x3fc11b){_0x3fc11b=_0x3fc11b||0xcc;return function(_0x3ccad0){if(_0x3ccad0){return _0x12411d[_0x216f('0x21')](_0x3fc11b);}return _0x12411d[_0x216f('0x22')](_0x3fc11b)[_0x216f('0x23')]();};}function respondWithResult(_0x4c6f50,_0x126dbf){_0x126dbf=_0x126dbf||0xc8;return function(_0x302b89){if(_0x302b89){return _0x4c6f50[_0x216f('0x22')](_0x126dbf)[_0x216f('0x24')](_0x302b89);}};}function respondWithFilteredResult(_0x90e55d,_0x1e6524){return function(_0x44ce77){if(_0x44ce77){var _0x28bc91=typeof _0x1e6524[_0x216f('0x25')]==='undefined'&&typeof _0x1e6524['limit']===_0x216f('0x26');var _0x266675=_0x44ce77[_0x216f('0x27')];var _0x4b19d3=_0x28bc91?0x0:_0x1e6524[_0x216f('0x25')];var _0x2d4a85=_0x28bc91?_0x44ce77[_0x216f('0x27')]:_0x1e6524[_0x216f('0x25')]+_0x1e6524['limit'];var _0x5844d2;if(_0x2d4a85>=_0x266675){_0x2d4a85=_0x266675;_0x5844d2=0xc8;}else{_0x5844d2=0xce;}_0x90e55d[_0x216f('0x22')](_0x5844d2);return _0x90e55d[_0x216f('0x28')]('Content-Range',_0x4b19d3+'-'+_0x2d4a85+'/'+_0x266675)['json'](_0x44ce77);}return null;};}function patchUpdates(_0x561f74){return function(_0xaaef81){try{jsonpatch['apply'](_0xaaef81,_0x561f74,!![]);}catch(_0x44205c){return BPromise[_0x216f('0x29')](_0x44205c);}return _0xaaef81[_0x216f('0x2a')]();};}function saveUpdates(_0x46272c,_0x2a641b){return function(_0x27cfef){if(_0x27cfef){return _0x27cfef[_0x216f('0x2b')](_0x46272c)['then'](function(_0x28a2c3){return _0x28a2c3;});}return null;};}function removeEntity(_0x53c199,_0x178cd7){return function(_0x5d5197){if(_0x5d5197){return _0x5d5197[_0x216f('0x2c')]()[_0x216f('0x17')](function(){var _0x1e4d59=_0x5d5197[_0x216f('0x2d')]({'plain':!![]});var _0x55adfc=_0x216f('0x2e');return db[_0x216f('0x2f')][_0x216f('0x2c')]({'where':{'type':_0x55adfc,'resourceId':_0x1e4d59['id']}})[_0x216f('0x17')](function(){return _0x5d5197;});})['then'](function(){_0x53c199[_0x216f('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31b64a,_0x1ca32c){return function(_0xabe5bc){if(!_0xabe5bc){_0x31b64a[_0x216f('0x21')](0x194);}return _0xabe5bc;};}function handleError(_0x400d2d,_0x1b6400){_0x1b6400=_0x1b6400||0x1f4;return function(_0x1c14e6){logger['error'](_0x1c14e6['stack']);if(_0x1c14e6[_0x216f('0x30')]){delete _0x1c14e6[_0x216f('0x30')];}_0x400d2d[_0x216f('0x22')](_0x1b6400)[_0x216f('0x31')](_0x1c14e6);};}exports[_0x216f('0x32')]=function(_0x43c352,_0x11787b){var _0x5f15f6={},_0x378d74={},_0xac6d4d={'count':0x0,'rows':[]};var _0x2f6876=_[_0x216f('0x33')](db[_0x216f('0x34')]['rawAttributes'],function(_0x1626c0){return{'name':_0x1626c0[_0x216f('0x35')],'type':_0x1626c0[_0x216f('0x36')][_0x216f('0x37')]};});_0x378d74['model']=_[_0x216f('0x33')](_0x2f6876,_0x216f('0x30'));_0x378d74['query']=_['keys'](_0x43c352['query']);_0x378d74[_0x216f('0x38')]=_['intersection'](_0x378d74[_0x216f('0x39')],_0x378d74['query']);_0x5f15f6[_0x216f('0x3a')]=_[_0x216f('0x3b')](_0x378d74[_0x216f('0x39')],qs[_0x216f('0x3c')](_0x43c352[_0x216f('0x3d')][_0x216f('0x3c')]));_0x5f15f6['attributes']=_0x5f15f6[_0x216f('0x3a')]['length']?_0x5f15f6['attributes']:_0x378d74[_0x216f('0x39')];if(!_0x43c352[_0x216f('0x3d')][_0x216f('0x3e')](_0x216f('0x3f'))){_0x5f15f6[_0x216f('0x40')]=qs[_0x216f('0x40')](_0x43c352['query'][_0x216f('0x40')]);_0x5f15f6[_0x216f('0x25')]=qs[_0x216f('0x25')](_0x43c352[_0x216f('0x3d')][_0x216f('0x25')]);}_0x5f15f6[_0x216f('0x41')]=qs[_0x216f('0x42')](_0x43c352[_0x216f('0x3d')]['sort']);_0x5f15f6[_0x216f('0x43')]=qs['filters'](_[_0x216f('0x44')](_0x43c352[_0x216f('0x3d')],_0x378d74[_0x216f('0x38')]),_0x2f6876);if(_0x43c352['query'][_0x216f('0x45')]){_0x5f15f6['where']=_['merge'](_0x5f15f6['where'],{'$or':_[_0x216f('0x33')](_0x2f6876,function(_0x3c1fca){if(_0x3c1fca[_0x216f('0x36')]!=='VIRTUAL'){var _0x2ba47d={};_0x2ba47d[_0x3c1fca[_0x216f('0x30')]]={'$like':'%'+_0x43c352[_0x216f('0x3d')][_0x216f('0x45')]+'%'};return _0x2ba47d;}})});}_0x5f15f6=_['merge']({},_0x5f15f6,_0x43c352['options']);var _0x49fde6={'where':_0x5f15f6[_0x216f('0x43')]};return db[_0x216f('0x34')][_0x216f('0x27')](_0x49fde6)[_0x216f('0x17')](function(_0x9eb3c2){_0xac6d4d[_0x216f('0x27')]=_0x9eb3c2;if(_0x43c352[_0x216f('0x3d')][_0x216f('0x46')]){_0x5f15f6['include']=[{'all':!![]}];}return db[_0x216f('0x34')][_0x216f('0x47')](_0x5f15f6);})[_0x216f('0x17')](function(_0x17e751){_0xac6d4d[_0x216f('0x48')]=_0x17e751;return _0xac6d4d;})[_0x216f('0x17')](respondWithFilteredResult(_0x11787b,_0x5f15f6))[_0x216f('0x49')](handleError(_0x11787b,null));};exports['show']=function(_0x165266,_0x5b46d4){var _0x26d71f={'raw':![],'where':{'id':_0x165266[_0x216f('0x4a')]['id']}},_0x4cda0d={};_0x4cda0d['model']=_[_0x216f('0x4b')](db['VoiceContext'][_0x216f('0x4c')]);_0x4cda0d[_0x216f('0x3d')]=_[_0x216f('0x4b')](_0x165266[_0x216f('0x3d')]);_0x4cda0d['filters']=_[_0x216f('0x3b')](_0x4cda0d[_0x216f('0x39')],_0x4cda0d[_0x216f('0x3d')]);_0x26d71f[_0x216f('0x3a')]=_['intersection'](_0x4cda0d[_0x216f('0x39')],qs['fields'](_0x165266[_0x216f('0x3d')][_0x216f('0x3c')]));_0x26d71f[_0x216f('0x3a')]=_0x26d71f[_0x216f('0x3a')]['length']?_0x26d71f[_0x216f('0x3a')]:_0x4cda0d[_0x216f('0x39')];if(_0x165266[_0x216f('0x3d')][_0x216f('0x46')]){_0x26d71f[_0x216f('0x4d')]=[{'all':!![]}];}_0x26d71f=_[_0x216f('0x4e')]({},_0x26d71f,_0x165266[_0x216f('0x4f')]);return db[_0x216f('0x34')][_0x216f('0x50')](_0x26d71f)[_0x216f('0x17')](handleEntityNotFound(_0x5b46d4,null))[_0x216f('0x17')](respondWithResult(_0x5b46d4,null))[_0x216f('0x49')](handleError(_0x5b46d4,null));};exports[_0x216f('0x51')]=function(_0x47498e,_0x1626f7,_0x1b3f54){var _0x5d8d59;return db[_0x216f('0x34')][_0x216f('0x51')](_0x47498e[_0x216f('0x52')],{'raw':!![]})['then'](function(_0x4fbc32){_0x5d8d59=_0x4fbc32;return db[_0x216f('0x34')][_0x216f('0x47')]({'raw':!![]});})[_0x216f('0x17')](function(_0x13eea3){var _0x4267ed=fs[_0x216f('0x53')](path['join'](config[_0x216f('0x54')],_0x216f('0x55')),_0x216f('0x56'));var _0x2e24d6=ejs[_0x216f('0x57')](_0x4267ed,{'contexts':_0x13eea3||[]});fs[_0x216f('0x58')](_0x216f('0x59'),_0x2e24d6);})[_0x216f('0x17')](function(){return respondWithRpcPromise('Reload','create',{'module':_0x216f('0x5a')});})['then'](function(){var _0x4734b5=_0x47498e['user'][_0x216f('0x2d')]({'plain':!![]});if(!_0x4734b5)throw new Error(_0x216f('0x5b'));if(_0x4734b5[_0x216f('0x5c')]===_0x216f('0x5d')){var _0x4507db=_0x5d8d59[_0x216f('0x2d')]({'plain':!![]});return db[_0x216f('0x5e')][_0x216f('0x50')]({'where':{'name':'Contexts','userProfileId':_0x4734b5[_0x216f('0x5f')]},'raw':!![]})[_0x216f('0x17')](function(_0x2218b5){if(_0x2218b5&&_0x2218b5[_0x216f('0x60')]===0x0){return db[_0x216f('0x2f')][_0x216f('0x51')]({'name':_0x4507db[_0x216f('0x30')],'resourceId':_0x4507db['id'],'type':_0x2218b5[_0x216f('0x30')],'sectionId':_0x2218b5['id']},{})[_0x216f('0x17')](function(){return _0x5d8d59;});}else{return _0x5d8d59;}})[_0x216f('0x49')](function(_0x4ed26f){logger[_0x216f('0x1e')](_0x216f('0x61'),_0x4ed26f);throw _0x4ed26f;});}return _0x5d8d59;})['then'](respondWithResult(_0x1626f7,0xc9))[_0x216f('0x49')](handleError(_0x1626f7,null));};exports[_0x216f('0x2b')]=function(_0x3a389b,_0x3f26a8,_0x2066da){var _0x1884f5;return db[_0x216f('0x34')][_0x216f('0x50')]({'where':{'id':_0x3a389b[_0x216f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3f26a8,null))[_0x216f('0x17')](saveUpdates(_0x3a389b['body'],null))[_0x216f('0x17')](function(_0x399f95){if(_0x399f95){_0x1884f5=_0x399f95;return db[_0x216f('0x34')][_0x216f('0x47')]({'raw':!![]});}})[_0x216f('0x17')](function(_0x2612a0){var _0x1552bd=fs[_0x216f('0x53')](path[_0x216f('0x62')](config[_0x216f('0x54')],_0x216f('0x55')),_0x216f('0x56'));var _0x42f4f0=ejs['render'](_0x1552bd,{'contexts':_0x2612a0||[]});fs[_0x216f('0x58')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x42f4f0);})[_0x216f('0x17')](function(){return respondWithRpcPromise(_0x216f('0x63'),'update',{'module':_0x216f('0x5a')});})['then'](function(){return _0x1884f5;})[_0x216f('0x17')](respondWithResult(_0x3f26a8,null))[_0x216f('0x49')](handleError(_0x3f26a8,null));};exports[_0x216f('0x2c')]=function(_0x3cfc93,_0x1a4ebc,_0x2e62ac){var _0x53ddd8;return db[_0x216f('0x34')][_0x216f('0x50')]({'where':{'id':_0x3cfc93[_0x216f('0x4a')]['id']}})[_0x216f('0x17')](handleEntityNotFound(_0x1a4ebc,null))[_0x216f('0x17')](removeEntity(_0x1a4ebc,null))[_0x216f('0x17')](function(){return db[_0x216f('0x34')][_0x216f('0x47')]({'raw':!![]});})[_0x216f('0x17')](function(_0x4b6f7f){var _0x155e79=fs['readFileSync'](path[_0x216f('0x62')](config[_0x216f('0x54')],_0x216f('0x55')),_0x216f('0x56'));var _0x39cb4e=ejs[_0x216f('0x57')](_0x155e79,{'contexts':_0x4b6f7f});fs[_0x216f('0x58')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x39cb4e);return respondWithRpcPromise('Reload',_0x216f('0x2c'),{'module':_0x216f('0x5a')});})[_0x216f('0x49')](handleError(_0x1a4ebc,null));}; \ No newline at end of file +var _0xc329=['VIRTUAL','options','VoiceContext','include','rows','show','params','rawAttributes','intersection','includeAll','find','create','body','findAll','root','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','destroy','readFileSync','writeFileSync','chan_sip.so','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','get','Contexts','UserProfileResource','stack','name','send','index','map','fieldName','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type'];(function(_0x3334d3,_0x231fa5){var _0x3991e9=function(_0x4f465b){while(--_0x4f465b){_0x3334d3['push'](_0x3334d3['shift']());}};_0x3991e9(++_0x231fa5);}(_0xc329,0x1bf));var _0x9c32=function(_0x36cff7,_0x5cb048){_0x36cff7=_0x36cff7-0x0;var _0x21c697=_0xc329[_0x36cff7];return _0x21c697;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c32('0x0'));var zipdir=require(_0x9c32('0x1'));var jsonpatch=require(_0x9c32('0x2'));var rp=require('request-promise');var moment=require(_0x9c32('0x3'));var BPromise=require(_0x9c32('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9c32('0x5'));var sox=require(_0x9c32('0x6'));var csv=require(_0x9c32('0x7'));var ejs=require(_0x9c32('0x8'));var fs=require('fs');var fs_extra=require(_0x9c32('0x9'));var _=require(_0x9c32('0xa'));var squel=require(_0x9c32('0xb'));var crypto=require(_0x9c32('0xc'));var jsforce=require(_0x9c32('0xd'));var deskjs=require(_0x9c32('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9c32('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9c32('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9c32('0x11'));var utils=require(_0x9c32('0x12'));var config=require(_0x9c32('0x13'));var licenseUtil=require(_0x9c32('0x14'));var db=require(_0x9c32('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9c32('0x16')][_0x9c32('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x486d65,_0x6c3f57,_0x3e145b,_0x3f21cb){return new BPromise(function(_0x58b0d8,_0xa76a29){var _0x1b1bea=_0x3f21cb||client;return _0x1b1bea['request'](_0x486d65,_0x3e145b)['then'](function(_0x31f90e){logger['info'](_0x9c32('0x18'),_0x6c3f57,_0x9c32('0x19'));logger[_0x9c32('0x1a')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x6c3f57,'request\x20sent',JSON[_0x9c32('0x1b')](_0x31f90e));if(_0x31f90e['error']){if(_0x31f90e[_0x9c32('0x1c')][_0x9c32('0x1d')]===0x1f4){logger[_0x9c32('0x1c')](_0x9c32('0x18'),_0x6c3f57,_0x31f90e['error']['message']);return _0xa76a29(_0x31f90e[_0x9c32('0x1c')][_0x9c32('0x1e')]);}logger[_0x9c32('0x1c')](_0x9c32('0x18'),_0x6c3f57,_0x31f90e[_0x9c32('0x1c')]['message']);return _0x58b0d8(_0x31f90e['error'][_0x9c32('0x1e')]);}else{logger['info'](_0x9c32('0x18'),_0x6c3f57,'request\x20sent');_0x58b0d8(_0x31f90e[_0x9c32('0x1f')][_0x9c32('0x1e')]);}})[_0x9c32('0x20')](function(_0x1b5400){logger['error'](_0x9c32('0x18'),_0x6c3f57,_0x1b5400);_0xa76a29(_0x1b5400);});});}function respondWithStatusCode(_0x3af9e7,_0x988000){_0x988000=_0x988000||0xcc;return function(_0x1a13cb){if(_0x1a13cb){return _0x3af9e7[_0x9c32('0x21')](_0x988000);}return _0x3af9e7['status'](_0x988000)[_0x9c32('0x22')]();};}function respondWithResult(_0x56e4d9,_0x92adb9){_0x92adb9=_0x92adb9||0xc8;return function(_0x1fd527){if(_0x1fd527){return _0x56e4d9[_0x9c32('0x23')](_0x92adb9)['json'](_0x1fd527);}};}function respondWithFilteredResult(_0x3113c1,_0x49c1dd){return function(_0x55da65){if(_0x55da65){var _0x407206=typeof _0x49c1dd[_0x9c32('0x24')]===_0x9c32('0x25')&&typeof _0x49c1dd[_0x9c32('0x26')]==='undefined';var _0x4d30a7=_0x55da65['count'];var _0x5c215d=_0x407206?0x0:_0x49c1dd[_0x9c32('0x24')];var _0x52b155=_0x407206?_0x55da65[_0x9c32('0x27')]:_0x49c1dd[_0x9c32('0x24')]+_0x49c1dd[_0x9c32('0x26')];var _0x2866e0;if(_0x52b155>=_0x4d30a7){_0x52b155=_0x4d30a7;_0x2866e0=0xc8;}else{_0x2866e0=0xce;}_0x3113c1[_0x9c32('0x23')](_0x2866e0);return _0x3113c1[_0x9c32('0x28')](_0x9c32('0x29'),_0x5c215d+'-'+_0x52b155+'/'+_0x4d30a7)[_0x9c32('0x2a')](_0x55da65);}return null;};}function patchUpdates(_0xde8b3d){return function(_0x396c98){try{jsonpatch[_0x9c32('0x2b')](_0x396c98,_0xde8b3d,!![]);}catch(_0x1fe743){return BPromise[_0x9c32('0x2c')](_0x1fe743);}return _0x396c98['save']();};}function saveUpdates(_0xdcfd48,_0x5d36eb){return function(_0x2767ce){if(_0x2767ce){return _0x2767ce[_0x9c32('0x2d')](_0xdcfd48)[_0x9c32('0x2e')](function(_0x4a8f0a){return _0x4a8f0a;});}return null;};}function removeEntity(_0xff55b9,_0x522841){return function(_0x8baaf5){if(_0x8baaf5){return _0x8baaf5['destroy']()[_0x9c32('0x2e')](function(){var _0x329c89=_0x8baaf5[_0x9c32('0x2f')]({'plain':!![]});var _0x4dc524=_0x9c32('0x30');return db[_0x9c32('0x31')]['destroy']({'where':{'type':_0x4dc524,'resourceId':_0x329c89['id']}})[_0x9c32('0x2e')](function(){return _0x8baaf5;});})[_0x9c32('0x2e')](function(){_0xff55b9[_0x9c32('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35e671,_0x51d89a){return function(_0xf66198){if(!_0xf66198){_0x35e671['sendStatus'](0x194);}return _0xf66198;};}function handleError(_0x4a2eff,_0xf16186){_0xf16186=_0xf16186||0x1f4;return function(_0xb19ffe){logger['error'](_0xb19ffe[_0x9c32('0x32')]);if(_0xb19ffe['name']){delete _0xb19ffe[_0x9c32('0x33')];}_0x4a2eff[_0x9c32('0x23')](_0xf16186)[_0x9c32('0x34')](_0xb19ffe);};}exports[_0x9c32('0x35')]=function(_0x116046,_0x48bfbd){var _0x3d9e2a={},_0x2543bb={},_0x1d37b1={'count':0x0,'rows':[]};var _0x48480f=_[_0x9c32('0x36')](db['VoiceContext']['rawAttributes'],function(_0xe5f71){return{'name':_0xe5f71[_0x9c32('0x37')],'type':_0xe5f71['type'][_0x9c32('0x38')]};});_0x2543bb[_0x9c32('0x39')]=_[_0x9c32('0x36')](_0x48480f,_0x9c32('0x33'));_0x2543bb[_0x9c32('0x3a')]=_[_0x9c32('0x3b')](_0x116046[_0x9c32('0x3a')]);_0x2543bb[_0x9c32('0x3c')]=_['intersection'](_0x2543bb[_0x9c32('0x39')],_0x2543bb[_0x9c32('0x3a')]);_0x3d9e2a['attributes']=_['intersection'](_0x2543bb['model'],qs['fields'](_0x116046['query'][_0x9c32('0x3d')]));_0x3d9e2a[_0x9c32('0x3e')]=_0x3d9e2a[_0x9c32('0x3e')][_0x9c32('0x3f')]?_0x3d9e2a[_0x9c32('0x3e')]:_0x2543bb[_0x9c32('0x39')];if(!_0x116046[_0x9c32('0x3a')][_0x9c32('0x40')](_0x9c32('0x41'))){_0x3d9e2a['limit']=qs[_0x9c32('0x26')](_0x116046[_0x9c32('0x3a')][_0x9c32('0x26')]);_0x3d9e2a[_0x9c32('0x24')]=qs[_0x9c32('0x24')](_0x116046[_0x9c32('0x3a')]['offset']);}_0x3d9e2a[_0x9c32('0x42')]=qs[_0x9c32('0x43')](_0x116046[_0x9c32('0x3a')]['sort']);_0x3d9e2a[_0x9c32('0x44')]=qs['filters'](_[_0x9c32('0x45')](_0x116046[_0x9c32('0x3a')],_0x2543bb['filters']),_0x48480f);if(_0x116046[_0x9c32('0x3a')][_0x9c32('0x46')]){_0x3d9e2a[_0x9c32('0x44')]=_[_0x9c32('0x47')](_0x3d9e2a['where'],{'$or':_[_0x9c32('0x36')](_0x48480f,function(_0x30d0f2){if(_0x30d0f2[_0x9c32('0x48')]!==_0x9c32('0x49')){var _0x356a70={};_0x356a70[_0x30d0f2[_0x9c32('0x33')]]={'$like':'%'+_0x116046[_0x9c32('0x3a')][_0x9c32('0x46')]+'%'};return _0x356a70;}})});}_0x3d9e2a=_['merge']({},_0x3d9e2a,_0x116046[_0x9c32('0x4a')]);var _0x1ccc5b={'where':_0x3d9e2a['where']};return db[_0x9c32('0x4b')][_0x9c32('0x27')](_0x1ccc5b)[_0x9c32('0x2e')](function(_0x6cbbfa){_0x1d37b1[_0x9c32('0x27')]=_0x6cbbfa;if(_0x116046[_0x9c32('0x3a')]['includeAll']){_0x3d9e2a[_0x9c32('0x4c')]=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x3d9e2a);})['then'](function(_0x1bc03d){_0x1d37b1[_0x9c32('0x4d')]=_0x1bc03d;return _0x1d37b1;})['then'](respondWithFilteredResult(_0x48bfbd,_0x3d9e2a))[_0x9c32('0x20')](handleError(_0x48bfbd,null));};exports[_0x9c32('0x4e')]=function(_0x407f2a,_0x15ca0f){var _0x2a9e55={'raw':![],'where':{'id':_0x407f2a[_0x9c32('0x4f')]['id']}},_0x43dae6={};_0x43dae6['model']=_[_0x9c32('0x3b')](db[_0x9c32('0x4b')][_0x9c32('0x50')]);_0x43dae6[_0x9c32('0x3a')]=_['keys'](_0x407f2a['query']);_0x43dae6['filters']=_[_0x9c32('0x51')](_0x43dae6[_0x9c32('0x39')],_0x43dae6[_0x9c32('0x3a')]);_0x2a9e55[_0x9c32('0x3e')]=_[_0x9c32('0x51')](_0x43dae6[_0x9c32('0x39')],qs[_0x9c32('0x3d')](_0x407f2a[_0x9c32('0x3a')]['fields']));_0x2a9e55[_0x9c32('0x3e')]=_0x2a9e55[_0x9c32('0x3e')]['length']?_0x2a9e55[_0x9c32('0x3e')]:_0x43dae6[_0x9c32('0x39')];if(_0x407f2a[_0x9c32('0x3a')][_0x9c32('0x52')]){_0x2a9e55[_0x9c32('0x4c')]=[{'all':!![]}];}_0x2a9e55=_['merge']({},_0x2a9e55,_0x407f2a[_0x9c32('0x4a')]);return db['VoiceContext'][_0x9c32('0x53')](_0x2a9e55)[_0x9c32('0x2e')](handleEntityNotFound(_0x15ca0f,null))['then'](respondWithResult(_0x15ca0f,null))[_0x9c32('0x20')](handleError(_0x15ca0f,null));};exports['create']=function(_0x407507,_0x4d3b34,_0x5b3bad){var _0x47eebc;return db[_0x9c32('0x4b')][_0x9c32('0x54')](_0x407507[_0x9c32('0x55')],{'raw':!![]})[_0x9c32('0x2e')](function(_0x3d24f0){_0x47eebc=_0x3d24f0;return db['VoiceContext'][_0x9c32('0x56')]({'raw':!![]});})[_0x9c32('0x2e')](function(_0x1b4fb1){var _0x2ccc13=fs['readFileSync'](path['join'](config[_0x9c32('0x57')],'server/files/templates/context.ejs'),_0x9c32('0x58'));var _0xa05d60=ejs[_0x9c32('0x59')](_0x2ccc13,{'contexts':_0x1b4fb1||[]});fs['writeFileSync'](_0x9c32('0x5a'),_0xa05d60);})['then'](function(){return respondWithRpcPromise(_0x9c32('0x5b'),_0x9c32('0x54'),{'module':'chan_sip.so'});})['then'](function(){var _0x15c95b=_0x407507[_0x9c32('0x5c')][_0x9c32('0x2f')]({'plain':!![]});if(!_0x15c95b)throw new Error(_0x9c32('0x5d'));if(_0x15c95b[_0x9c32('0x5e')]===_0x9c32('0x5c')){var _0x4de3b4=_0x47eebc[_0x9c32('0x2f')]({'plain':!![]});return db[_0x9c32('0x5f')][_0x9c32('0x53')]({'where':{'name':_0x9c32('0x30'),'userProfileId':_0x15c95b[_0x9c32('0x60')]},'raw':!![]})[_0x9c32('0x2e')](function(_0x51a891){if(_0x51a891&&_0x51a891[_0x9c32('0x61')]===0x0){return db[_0x9c32('0x31')][_0x9c32('0x54')]({'name':_0x4de3b4[_0x9c32('0x33')],'resourceId':_0x4de3b4['id'],'type':_0x51a891['name'],'sectionId':_0x51a891['id']},{})[_0x9c32('0x2e')](function(){return _0x47eebc;});}else{return _0x47eebc;}})[_0x9c32('0x20')](function(_0x3a4fd0){logger['error'](_0x9c32('0x62'),_0x3a4fd0);throw _0x3a4fd0;});}return _0x47eebc;})['then'](respondWithResult(_0x4d3b34,0xc9))[_0x9c32('0x20')](handleError(_0x4d3b34,null));};exports[_0x9c32('0x2d')]=function(_0x1ce241,_0x157483,_0x31bffc){var _0x11568f;return db[_0x9c32('0x4b')]['find']({'where':{'id':_0x1ce241[_0x9c32('0x4f')]['id']}})[_0x9c32('0x2e')](handleEntityNotFound(_0x157483,null))[_0x9c32('0x2e')](saveUpdates(_0x1ce241['body'],null))['then'](function(_0x1bc7f4){if(_0x1bc7f4){_0x11568f=_0x1bc7f4;return db[_0x9c32('0x4b')][_0x9c32('0x56')]({'raw':!![]});}})[_0x9c32('0x2e')](function(_0x11536a){var _0x38d373=fs['readFileSync'](path[_0x9c32('0x63')](config[_0x9c32('0x57')],'server/files/templates/context.ejs'),_0x9c32('0x58'));var _0x85d958=ejs[_0x9c32('0x59')](_0x38d373,{'contexts':_0x11536a||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x85d958);})[_0x9c32('0x2e')](function(){return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});})[_0x9c32('0x2e')](function(){return _0x11568f;})[_0x9c32('0x2e')](respondWithResult(_0x157483,null))[_0x9c32('0x20')](handleError(_0x157483,null));};exports[_0x9c32('0x64')]=function(_0x3f51e4,_0x55aabe,_0xacbc77){var _0x4a6be5;return db['VoiceContext'][_0x9c32('0x53')]({'where':{'id':_0x3f51e4[_0x9c32('0x4f')]['id']}})[_0x9c32('0x2e')](handleEntityNotFound(_0x55aabe,null))[_0x9c32('0x2e')](removeEntity(_0x55aabe,null))['then'](function(){return db[_0x9c32('0x4b')][_0x9c32('0x56')]({'raw':!![]});})[_0x9c32('0x2e')](function(_0x2dd6bf){var _0x118e31=fs[_0x9c32('0x65')](path['join'](config[_0x9c32('0x57')],'server/files/templates/context.ejs'),_0x9c32('0x58'));var _0x1ff217=ejs[_0x9c32('0x59')](_0x118e31,{'contexts':_0x2dd6bf});fs[_0x9c32('0x66')](_0x9c32('0x5a'),_0x1ff217);return respondWithRpcPromise(_0x9c32('0x5b'),_0x9c32('0x64'),{'module':_0x9c32('0x67')});})[_0x9c32('0x20')](handleError(_0x55aabe,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index aa3d0e4..083e406 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 _0x929b=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x929b,0x1f2));var _0xb929=function(_0x5c5bf5,_0x2b3e1b){_0x5c5bf5=_0x5c5bf5-0x0;var _0x188b4b=_0x929b[_0x5c5bf5];return _0x188b4b;};'use strict';var _=require('lodash');var util=require(_0xb929('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb929('0x1'));var BPromise=require(_0xb929('0x2'));var rp=require(_0xb929('0x3'));var fs=require('fs');var path=require(_0xb929('0x4'));var rimraf=require(_0xb929('0x5'));var config=require(_0xb929('0x6'));var attributes=require(_0xb929('0x7'));module[_0xb929('0x8')]=function(_0x28d21f,_0x1b2c99){return _0x28d21f[_0xb929('0x9')](_0xb929('0xa'),attributes,{'tableName':_0xb929('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ba1=['api','bluebird','request-promise','path','rimraf','./voiceContext.attributes','exports','define','voice_contexts','lodash','util','../../config/logger'];(function(_0xa9b418,_0xbb9f9d){var _0x20eef7=function(_0x42b612){while(--_0x42b612){_0xa9b418['push'](_0xa9b418['shift']());}};_0x20eef7(++_0xbb9f9d);}(_0x1ba1,0xc9));var _0x11ba=function(_0x35a458,_0x54a6a2){_0x35a458=_0x35a458-0x0;var _0x329c55=_0x1ba1[_0x35a458];return _0x329c55;};'use strict';var _=require(_0x11ba('0x0'));var util=require(_0x11ba('0x1'));var logger=require(_0x11ba('0x2'))(_0x11ba('0x3'));var moment=require('moment');var BPromise=require(_0x11ba('0x4'));var rp=require(_0x11ba('0x5'));var fs=require('fs');var path=require(_0x11ba('0x6'));var rimraf=require(_0x11ba('0x7'));var config=require('../../config/environment');var attributes=require(_0x11ba('0x8'));module[_0x11ba('0x9')]=function(_0x8d1434,_0x175a1a){return _0x8d1434[_0x11ba('0xa')]('VoiceContext',attributes,{'tableName':_0x11ba('0xb'),'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 07536c0..9044d44 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 _0x0e21=['client','http','then','request\x20sent','debug','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x501fc6,_0x11e561){var _0x5303ac=function(_0x50025e){while(--_0x50025e){_0x501fc6['push'](_0x501fc6['shift']());}};_0x5303ac(++_0x11e561);}(_0x0e21,0xe8));var _0x10e2=function(_0x15f07d,_0x27e2d5){_0x15f07d=_0x15f07d-0x0;var _0x24f024=_0x0e21[_0x15f07d];return _0x24f024;};'use strict';var _=require('lodash');var util=require(_0x10e2('0x0'));var moment=require(_0x10e2('0x1'));var BPromise=require(_0x10e2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x10e2('0x3'));var db=require(_0x10e2('0x4'))['db'];var utils=require(_0x10e2('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x10e2('0x6'));var jayson=require(_0x10e2('0x7'));var client=jayson[_0x10e2('0x8')][_0x10e2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e1687,_0x219fc6,_0x121894){return new BPromise(function(_0x48ab5b,_0x375bbc){return client['request'](_0x4e1687,_0x121894)[_0x10e2('0xa')](function(_0x52ef03){logger['info']('VoiceContext,\x20%s,\x20%s',_0x219fc6,_0x10e2('0xb'));logger[_0x10e2('0xc')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x219fc6,_0x10e2('0xb'),JSON['stringify'](_0x52ef03));if(_0x52ef03[_0x10e2('0xd')]){if(_0x52ef03[_0x10e2('0xd')][_0x10e2('0xe')]===0x1f4){logger['error'](_0x10e2('0xf'),_0x219fc6,_0x52ef03[_0x10e2('0xd')][_0x10e2('0x10')]);return _0x375bbc(_0x52ef03['error']['message']);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x219fc6,_0x52ef03[_0x10e2('0xd')][_0x10e2('0x10')]);return _0x48ab5b(_0x52ef03[_0x10e2('0xd')]['message']);}else{logger[_0x10e2('0x11')](_0x10e2('0xf'),_0x219fc6,_0x10e2('0xb'));_0x48ab5b(_0x52ef03[_0x10e2('0x12')][_0x10e2('0x10')]);}})[_0x10e2('0x13')](function(_0x5b8bcd){logger[_0x10e2('0xd')](_0x10e2('0xf'),_0x219fc6,_0x5b8bcd);_0x375bbc(_0x5b8bcd);});});} \ No newline at end of file +var _0x37e4=['jayson/promise','client','http','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3c76bd,_0x1534a1){var _0x20fd01=function(_0x5c68d2){while(--_0x5c68d2){_0x3c76bd['push'](_0x3c76bd['shift']());}};_0x20fd01(++_0x1534a1);}(_0x37e4,0x18e));var _0x437e=function(_0x534074,_0x466e2d){_0x534074=_0x534074-0x0;var _0x38e22d=_0x37e4[_0x534074];return _0x38e22d;};'use strict';var _=require(_0x437e('0x0'));var util=require(_0x437e('0x1'));var moment=require('moment');var BPromise=require(_0x437e('0x2'));var rs=require(_0x437e('0x3'));var fs=require('fs');var Redis=require(_0x437e('0x4'));var db=require(_0x437e('0x5'))['db'];var utils=require(_0x437e('0x6'));var logger=require(_0x437e('0x7'))(_0x437e('0x8'));var config=require(_0x437e('0x9'));var jayson=require(_0x437e('0xa'));var client=jayson[_0x437e('0xb')][_0x437e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c5bfb,_0x3dbc6c,_0x139a58){return new BPromise(function(_0x2cf447,_0x5371a0){return client[_0x437e('0xd')](_0x3c5bfb,_0x139a58)['then'](function(_0x114621){logger[_0x437e('0xe')]('VoiceContext,\x20%s,\x20%s',_0x3dbc6c,_0x437e('0xf'));logger[_0x437e('0x10')](_0x437e('0x11'),_0x3dbc6c,_0x437e('0xf'),JSON[_0x437e('0x12')](_0x114621));if(_0x114621[_0x437e('0x13')]){if(_0x114621['error']['code']===0x1f4){logger['error'](_0x437e('0x14'),_0x3dbc6c,_0x114621[_0x437e('0x13')][_0x437e('0x15')]);return _0x5371a0(_0x114621[_0x437e('0x13')][_0x437e('0x15')]);}logger[_0x437e('0x13')](_0x437e('0x14'),_0x3dbc6c,_0x114621[_0x437e('0x13')][_0x437e('0x15')]);return _0x2cf447(_0x114621[_0x437e('0x13')][_0x437e('0x15')]);}else{logger[_0x437e('0xe')](_0x437e('0x14'),_0x3dbc6c,'request\x20sent');_0x2cf447(_0x114621[_0x437e('0x16')][_0x437e('0x15')]);}})[_0x437e('0x17')](function(_0x349aed){logger[_0x437e('0x13')]('VoiceContext,\x20%s,\x20%s',_0x3dbc6c,_0x349aed);_0x5371a0(_0x349aed);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 96be11a..9982e4d 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 _0xc5b8=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','show','post','/:id','update','delete','destroy','multer','util','path'];(function(_0x3defc0,_0x4033b6){var _0x1f041b=function(_0x2031d2){while(--_0x2031d2){_0x3defc0['push'](_0x3defc0['shift']());}};_0x1f041b(++_0x4033b6);}(_0xc5b8,0xbb));var _0x8c5b=function(_0x52121d,_0x1d1704){_0x52121d=_0x52121d-0x0;var _0x448627=_0xc5b8[_0x52121d];return _0x448627;};'use strict';var multer=require(_0x8c5b('0x0'));var util=require(_0x8c5b('0x1'));var path=require(_0x8c5b('0x2'));var timeout=require(_0x8c5b('0x3'));var express=require('express');var router=express[_0x8c5b('0x4')]();var fs_extra=require(_0x8c5b('0x5'));var auth=require(_0x8c5b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8c5b('0x7'));var controller=require(_0x8c5b('0x8'));router[_0x8c5b('0x9')]('/',auth['isAuthenticated'](),controller[_0x8c5b('0xa')]);router[_0x8c5b('0x9')](_0x8c5b('0xb'),auth[_0x8c5b('0xc')](),controller['describe']);router[_0x8c5b('0x9')]('/:id',auth[_0x8c5b('0xc')](),controller[_0x8c5b('0xd')]);router[_0x8c5b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8c5b('0xf'),auth[_0x8c5b('0xc')](),controller[_0x8c5b('0x10')]);router[_0x8c5b('0x11')](_0x8c5b('0xf'),auth[_0x8c5b('0xc')](),controller[_0x8c5b('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8ea7=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x22b7e6,_0x3d5132){var _0x3b2c27=function(_0xc9dbf7){while(--_0xc9dbf7){_0x22b7e6['push'](_0x22b7e6['shift']());}};_0x3b2c27(++_0x3d5132);}(_0x8ea7,0xdb));var _0x78ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x78ea('0x0'));var util=require(_0x78ea('0x1'));var path=require(_0x78ea('0x2'));var timeout=require('connect-timeout');var express=require(_0x78ea('0x3'));var router=express['Router']();var fs_extra=require(_0x78ea('0x4'));var auth=require(_0x78ea('0x5'));var interaction=require(_0x78ea('0x6'));var config=require(_0x78ea('0x7'));var controller=require(_0x78ea('0x8'));router[_0x78ea('0x9')]('/',auth[_0x78ea('0xa')](),controller[_0x78ea('0xb')]);router[_0x78ea('0x9')](_0x78ea('0xc'),auth[_0x78ea('0xa')](),controller[_0x78ea('0xd')]);router[_0x78ea('0x9')](_0x78ea('0xe'),auth[_0x78ea('0xa')](),controller[_0x78ea('0xf')]);router[_0x78ea('0x10')]('/',auth[_0x78ea('0xa')](),controller[_0x78ea('0x11')]);router[_0x78ea('0x12')](_0x78ea('0xe'),auth[_0x78ea('0xa')](),controller[_0x78ea('0x13')]);router[_0x78ea('0x14')](_0x78ea('0xe'),auth[_0x78ea('0xa')](),controller['destroy']);module[_0x78ea('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 5322022..e29b2b6 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 _0x98a8=['sequelize','exports','STRING','INTEGER','DATE'];(function(_0x317320,_0x3a36cc){var _0x17ea55=function(_0x563448){while(--_0x563448){_0x317320['push'](_0x317320['shift']());}};_0x17ea55(++_0x3a36cc);}(_0x98a8,0x12c));var _0x898a=function(_0x33c961,_0x4cce4a){_0x33c961=_0x33c961-0x0;var _0x44eaaf=_0x98a8[_0x33c961];return _0x44eaaf;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'privilege':{'type':Sequelize[_0x898a('0x2')]},'channel':{'type':Sequelize[_0x898a('0x2')]},'channelstate':{'type':Sequelize[_0x898a('0x3')]},'channelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'calleridnum':{'type':Sequelize[_0x898a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'connectedlinename':{'type':Sequelize[_0x898a('0x2')]},'language':{'type':Sequelize[_0x898a('0x2')]},'accountcode':{'type':Sequelize[_0x898a('0x2')]},'context':{'type':Sequelize[_0x898a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x898a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x898a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x898a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x898a('0x2')]},'destcalleridname':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x898a('0x2')]},'destlanguage':{'type':Sequelize[_0x898a('0x2')]},'destaccountcode':{'type':Sequelize[_0x898a('0x2')]},'destcontext':{'type':Sequelize[_0x898a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x898a('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x898a('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x898a('0x2')]},'starttime':{'type':Sequelize[_0x898a('0x4')]},'answertime':{'type':Sequelize[_0x898a('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x898a('0x3')]},'duration':{'type':Sequelize[_0x898a('0x3')]},'holdtime':{'type':Sequelize[_0x898a('0x3')]},'billableseconds':{'type':Sequelize[_0x898a('0x3')]}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x1a00b8,_0x177ba3){var _0x167b41=function(_0x67798c){while(--_0x67798c){_0x1a00b8['push'](_0x1a00b8['shift']());}};_0x167b41(++_0x177ba3);}(_0x34e8,0x12c));var _0x834e=function(_0x47f630,_0x54a089){_0x47f630=_0x47f630-0x0;var _0x45d691=_0x34e8[_0x47f630];return _0x45d691;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'privilege':{'type':Sequelize[_0x834e('0x2')]},'channel':{'type':Sequelize[_0x834e('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'calleridnum':{'type':Sequelize[_0x834e('0x2')]},'calleridname':{'type':Sequelize[_0x834e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'connectedlinename':{'type':Sequelize[_0x834e('0x2')]},'language':{'type':Sequelize[_0x834e('0x2')]},'accountcode':{'type':Sequelize[_0x834e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x834e('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x834e('0x2')]},'linkedid':{'type':Sequelize[_0x834e('0x2')]},'destchannel':{'type':Sequelize[_0x834e('0x2')]},'destchannelstate':{'type':Sequelize[_0x834e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x834e('0x2')]},'destcalleridname':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x834e('0x2')]},'destlanguage':{'type':Sequelize[_0x834e('0x2')]},'destaccountcode':{'type':Sequelize[_0x834e('0x2')]},'destcontext':{'type':Sequelize[_0x834e('0x2')]},'destexten':{'type':Sequelize[_0x834e('0x2')]},'destpriority':{'type':Sequelize[_0x834e('0x3')]},'destuniqueid':{'type':Sequelize[_0x834e('0x2')]},'destlinkedid':{'type':Sequelize[_0x834e('0x2')]},'dialstring':{'type':Sequelize[_0x834e('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x834e('0x4')]},'answertime':{'type':Sequelize[_0x834e('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x834e('0x2')],'comment':_0x834e('0x5')},'routeId':{'type':Sequelize[_0x834e('0x3')]},'duration':{'type':Sequelize[_0x834e('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x834e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 896199a..00e7f39 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 _0x4aee=['save','then','error','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','VIRTUAL','options','count','includeAll','findAll','rows','show','params','include','merge','find','create','body','catch','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject'];(function(_0x137154,_0xa22631){var _0x36bfbb=function(_0x5dddd5){while(--_0x5dddd5){_0x137154['push'](_0x137154['shift']());}};_0x36bfbb(++_0xa22631);}(_0x4aee,0x75));var _0xe4ae=function(_0x33f21b,_0x440c27){_0x33f21b=_0x33f21b-0x0;var _0x126c64=_0x4aee[_0x33f21b];return _0x126c64;};'use strict';var emlformat=require(_0xe4ae('0x0'));var rimraf=require(_0xe4ae('0x1'));var zipdir=require(_0xe4ae('0x2'));var jsonpatch=require(_0xe4ae('0x3'));var rp=require(_0xe4ae('0x4'));var moment=require(_0xe4ae('0x5'));var BPromise=require(_0xe4ae('0x6'));var Mustache=require(_0xe4ae('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4ae('0x8'));var squel=require(_0xe4ae('0x9'));var crypto=require(_0xe4ae('0xa'));var jsforce=require(_0xe4ae('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe4ae('0xc'));var querystring=require(_0xe4ae('0xd'));var Papa=require(_0xe4ae('0xe'));var Redis=require(_0xe4ae('0xf'));var authService=require(_0xe4ae('0x10'));var qs=require(_0xe4ae('0x11'));var as=require(_0xe4ae('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe4ae('0x13'));var config=require(_0xe4ae('0x14'));var licenseUtil=require(_0xe4ae('0x15'));var db=require(_0xe4ae('0x16'))['db'];function respondWithStatusCode(_0x9a75ce,_0x560313){_0x560313=_0x560313||0xcc;return function(_0x178e7a){if(_0x178e7a){return _0x9a75ce[_0xe4ae('0x17')](_0x560313);}return _0x9a75ce[_0xe4ae('0x18')](_0x560313)[_0xe4ae('0x19')]();};}function respondWithResult(_0x3e4272,_0x49575f){_0x49575f=_0x49575f||0xc8;return function(_0xd3057e){if(_0xd3057e){return _0x3e4272[_0xe4ae('0x18')](_0x49575f)[_0xe4ae('0x1a')](_0xd3057e);}};}function respondWithFilteredResult(_0x1ff060,_0x4b1e00){return function(_0x539a43){if(_0x539a43){var _0x3fd4af=typeof _0x4b1e00[_0xe4ae('0x1b')]===_0xe4ae('0x1c')&&typeof _0x4b1e00[_0xe4ae('0x1d')]==='undefined';var _0x4de0d6=_0x539a43['count'];var _0x39fac0=_0x3fd4af?0x0:_0x4b1e00[_0xe4ae('0x1b')];var _0x1fc4ff=_0x3fd4af?_0x539a43['count']:_0x4b1e00[_0xe4ae('0x1b')]+_0x4b1e00['limit'];var _0x3ebca0;if(_0x1fc4ff>=_0x4de0d6){_0x1fc4ff=_0x4de0d6;_0x3ebca0=0xc8;}else{_0x3ebca0=0xce;}_0x1ff060[_0xe4ae('0x18')](_0x3ebca0);return _0x1ff060[_0xe4ae('0x1e')]('Content-Range',_0x39fac0+'-'+_0x1fc4ff+'/'+_0x4de0d6)[_0xe4ae('0x1a')](_0x539a43);}return null;};}function patchUpdates(_0x13a7fa){return function(_0x503c19){try{jsonpatch[_0xe4ae('0x1f')](_0x503c19,_0x13a7fa,!![]);}catch(_0x78d402){return BPromise[_0xe4ae('0x20')](_0x78d402);}return _0x503c19[_0xe4ae('0x21')]();};}function saveUpdates(_0x3e709b,_0x47d970){return function(_0x4e535c){if(_0x4e535c){return _0x4e535c['update'](_0x3e709b)[_0xe4ae('0x22')](function(_0x14baea){return _0x14baea;});}return null;};}function removeEntity(_0x1fd7c0,_0x842dbb){return function(_0xcb0e1d){if(_0xcb0e1d){return _0xcb0e1d['destroy']()['then'](function(){_0x1fd7c0[_0xe4ae('0x18')](0xcc)[_0xe4ae('0x19')]();});}};}function handleEntityNotFound(_0x38242d,_0x1da480){return function(_0x4ffea6){if(!_0x4ffea6){_0x38242d['sendStatus'](0x194);}return _0x4ffea6;};}function handleError(_0x507190,_0x452f2a){_0x452f2a=_0x452f2a||0x1f4;return function(_0x571e79){logger[_0xe4ae('0x23')](_0x571e79['stack']);if(_0x571e79[_0xe4ae('0x24')]){delete _0x571e79[_0xe4ae('0x24')];}_0x507190[_0xe4ae('0x18')](_0x452f2a)[_0xe4ae('0x25')](_0x571e79);};}exports[_0xe4ae('0x26')]=function(_0x223c45,_0xb4eb87){var _0x368ede={},_0x3c25bb={},_0x2fdc63={'count':0x0,'rows':[]};var _0x4bfc0c=_['map'](db[_0xe4ae('0x27')][_0xe4ae('0x28')],function(_0x235137){return{'name':_0x235137[_0xe4ae('0x29')],'type':_0x235137[_0xe4ae('0x2a')][_0xe4ae('0x2b')]};});_0x3c25bb['model']=_['map'](_0x4bfc0c,_0xe4ae('0x24'));_0x3c25bb[_0xe4ae('0x2c')]=_[_0xe4ae('0x2d')](_0x223c45[_0xe4ae('0x2c')]);_0x3c25bb['filters']=_[_0xe4ae('0x2e')](_0x3c25bb[_0xe4ae('0x2f')],_0x3c25bb[_0xe4ae('0x2c')]);_0x368ede['attributes']=_[_0xe4ae('0x2e')](_0x3c25bb['model'],qs['fields'](_0x223c45['query'][_0xe4ae('0x30')]));_0x368ede['attributes']=_0x368ede[_0xe4ae('0x31')][_0xe4ae('0x32')]?_0x368ede['attributes']:_0x3c25bb[_0xe4ae('0x2f')];if(!_0x223c45[_0xe4ae('0x2c')][_0xe4ae('0x33')](_0xe4ae('0x34'))){_0x368ede[_0xe4ae('0x1d')]=qs[_0xe4ae('0x1d')](_0x223c45[_0xe4ae('0x2c')][_0xe4ae('0x1d')]);_0x368ede[_0xe4ae('0x1b')]=qs[_0xe4ae('0x1b')](_0x223c45[_0xe4ae('0x2c')][_0xe4ae('0x1b')]);}_0x368ede[_0xe4ae('0x35')]=qs['sort'](_0x223c45[_0xe4ae('0x2c')]['sort']);_0x368ede[_0xe4ae('0x36')]=qs[_0xe4ae('0x37')](_[_0xe4ae('0x38')](_0x223c45['query'],_0x3c25bb[_0xe4ae('0x37')]),_0x4bfc0c);if(_0x223c45[_0xe4ae('0x2c')][_0xe4ae('0x39')]){_0x368ede[_0xe4ae('0x36')]=_['merge'](_0x368ede[_0xe4ae('0x36')],{'$or':_['map'](_0x4bfc0c,function(_0x4dae50){if(_0x4dae50['type']!==_0xe4ae('0x3a')){var _0x2dd032={};_0x2dd032[_0x4dae50[_0xe4ae('0x24')]]={'$like':'%'+_0x223c45[_0xe4ae('0x2c')]['filter']+'%'};return _0x2dd032;}})});}_0x368ede=_['merge']({},_0x368ede,_0x223c45[_0xe4ae('0x3b')]);var _0x3a8907={'where':_0x368ede[_0xe4ae('0x36')]};return db['VoiceDialReport'][_0xe4ae('0x3c')](_0x3a8907)[_0xe4ae('0x22')](function(_0x491202){_0x2fdc63['count']=_0x491202;if(_0x223c45[_0xe4ae('0x2c')][_0xe4ae('0x3d')]){_0x368ede['include']=[{'all':!![]}];}return db[_0xe4ae('0x27')][_0xe4ae('0x3e')](_0x368ede);})[_0xe4ae('0x22')](function(_0xddfaa7){_0x2fdc63[_0xe4ae('0x3f')]=_0xddfaa7;return _0x2fdc63;})['then'](respondWithFilteredResult(_0xb4eb87,_0x368ede))['catch'](handleError(_0xb4eb87,null));};exports[_0xe4ae('0x40')]=function(_0x576c80,_0x1c3013){var _0x2c2996={'raw':!![],'where':{'id':_0x576c80[_0xe4ae('0x41')]['id']}},_0x241459={};_0x241459['model']=_[_0xe4ae('0x2d')](db[_0xe4ae('0x27')][_0xe4ae('0x28')]);_0x241459[_0xe4ae('0x2c')]=_['keys'](_0x576c80[_0xe4ae('0x2c')]);_0x241459[_0xe4ae('0x37')]=_[_0xe4ae('0x2e')](_0x241459['model'],_0x241459['query']);_0x2c2996[_0xe4ae('0x31')]=_[_0xe4ae('0x2e')](_0x241459['model'],qs['fields'](_0x576c80[_0xe4ae('0x2c')][_0xe4ae('0x30')]));_0x2c2996[_0xe4ae('0x31')]=_0x2c2996[_0xe4ae('0x31')][_0xe4ae('0x32')]?_0x2c2996[_0xe4ae('0x31')]:_0x241459[_0xe4ae('0x2f')];if(_0x576c80['query'][_0xe4ae('0x3d')]){_0x2c2996[_0xe4ae('0x42')]=[{'all':!![]}];}_0x2c2996=_[_0xe4ae('0x43')]({},_0x2c2996,_0x576c80[_0xe4ae('0x3b')]);return db[_0xe4ae('0x27')][_0xe4ae('0x44')](_0x2c2996)['then'](handleEntityNotFound(_0x1c3013,null))[_0xe4ae('0x22')](respondWithResult(_0x1c3013,null))['catch'](handleError(_0x1c3013,null));};exports[_0xe4ae('0x45')]=function(_0x4f4c02,_0x59e5f2){return db[_0xe4ae('0x27')][_0xe4ae('0x45')](_0x4f4c02[_0xe4ae('0x46')],{})[_0xe4ae('0x22')](respondWithResult(_0x59e5f2,0xc9))[_0xe4ae('0x47')](handleError(_0x59e5f2,null));};exports[_0xe4ae('0x48')]=function(_0x4fedcb,_0xb98c44){if(_0x4fedcb[_0xe4ae('0x46')]['id']){delete _0x4fedcb['body']['id'];}return db[_0xe4ae('0x27')][_0xe4ae('0x44')]({'where':{'id':_0x4fedcb[_0xe4ae('0x41')]['id']}})['then'](handleEntityNotFound(_0xb98c44,null))[_0xe4ae('0x22')](saveUpdates(_0x4fedcb[_0xe4ae('0x46')],null))['then'](respondWithResult(_0xb98c44,null))[_0xe4ae('0x47')](handleError(_0xb98c44,null));};exports[_0xe4ae('0x49')]=function(_0x549c6a,_0x371779){return db[_0xe4ae('0x27')][_0xe4ae('0x44')]({'where':{'id':_0x549c6a['params']['id']}})[_0xe4ae('0x22')](handleEntityNotFound(_0x371779,null))[_0xe4ae('0x22')](removeEntity(_0x371779,null))['catch'](handleError(_0x371779,null));};exports[_0xe4ae('0x4a')]=function(_0x118f52,_0x2646f2){return db[_0xe4ae('0x27')][_0xe4ae('0x4a')]()[_0xe4ae('0x22')](respondWithResult(_0x2646f2,null))['catch'](handleError(_0x2646f2,null));}; \ No newline at end of file +var _0x1f9f=['error','stack','name','index','VoiceDialReport','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','include','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x1f9f,0x6e));var _0xf1f9=function(_0x2d99d4,_0x32db5a){_0x2d99d4=_0x2d99d4-0x0;var _0x137524=_0x1f9f[_0x2d99d4];return _0x137524;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf1f9('0x0'));var zipdir=require(_0xf1f9('0x1'));var jsonpatch=require(_0xf1f9('0x2'));var rp=require(_0xf1f9('0x3'));var moment=require(_0xf1f9('0x4'));var BPromise=require(_0xf1f9('0x5'));var Mustache=require(_0xf1f9('0x6'));var util=require(_0xf1f9('0x7'));var path=require(_0xf1f9('0x8'));var sox=require(_0xf1f9('0x9'));var csv=require(_0xf1f9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf1f9('0xb'));var _=require(_0xf1f9('0xc'));var squel=require('squel');var crypto=require(_0xf1f9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf1f9('0xa'));var querystring=require(_0xf1f9('0xe'));var Papa=require(_0xf1f9('0xf'));var Redis=require(_0xf1f9('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf1f9('0x11'));var hardwareService=require(_0xf1f9('0x12'));var logger=require(_0xf1f9('0x13'))(_0xf1f9('0x14'));var utils=require(_0xf1f9('0x15'));var config=require(_0xf1f9('0x16'));var licenseUtil=require(_0xf1f9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x460b88,_0x17de30){_0x17de30=_0x17de30||0xcc;return function(_0x1982cc){if(_0x1982cc){return _0x460b88[_0xf1f9('0x18')](_0x17de30);}return _0x460b88[_0xf1f9('0x19')](_0x17de30)[_0xf1f9('0x1a')]();};}function respondWithResult(_0x338d3f,_0x7fdade){_0x7fdade=_0x7fdade||0xc8;return function(_0x293266){if(_0x293266){return _0x338d3f[_0xf1f9('0x19')](_0x7fdade)[_0xf1f9('0x1b')](_0x293266);}};}function respondWithFilteredResult(_0x497ff2,_0x53abcb){return function(_0x4da97f){if(_0x4da97f){var _0x929684=typeof _0x53abcb[_0xf1f9('0x1c')]==='undefined'&&typeof _0x53abcb[_0xf1f9('0x1d')]===_0xf1f9('0x1e');var _0x543466=_0x4da97f[_0xf1f9('0x1f')];var _0x3ae3e9=_0x929684?0x0:_0x53abcb[_0xf1f9('0x1c')];var _0x55256f=_0x929684?_0x4da97f[_0xf1f9('0x1f')]:_0x53abcb[_0xf1f9('0x1c')]+_0x53abcb[_0xf1f9('0x1d')];var _0x516ea0;if(_0x55256f>=_0x543466){_0x55256f=_0x543466;_0x516ea0=0xc8;}else{_0x516ea0=0xce;}_0x497ff2[_0xf1f9('0x19')](_0x516ea0);return _0x497ff2['set'](_0xf1f9('0x20'),_0x3ae3e9+'-'+_0x55256f+'/'+_0x543466)[_0xf1f9('0x1b')](_0x4da97f);}return null;};}function patchUpdates(_0x52ca4c){return function(_0x116c81){try{jsonpatch['apply'](_0x116c81,_0x52ca4c,!![]);}catch(_0x2dde7f){return BPromise['reject'](_0x2dde7f);}return _0x116c81['save']();};}function saveUpdates(_0x217376,_0x65d25a){return function(_0xfb2403){if(_0xfb2403){return _0xfb2403[_0xf1f9('0x21')](_0x217376)[_0xf1f9('0x22')](function(_0x30a538){return _0x30a538;});}return null;};}function removeEntity(_0x39af50,_0x9b40c3){return function(_0x81a360){if(_0x81a360){return _0x81a360[_0xf1f9('0x23')]()[_0xf1f9('0x22')](function(){_0x39af50[_0xf1f9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x195360,_0x5a1189){return function(_0x151601){if(!_0x151601){_0x195360[_0xf1f9('0x18')](0x194);}return _0x151601;};}function handleError(_0x4caa76,_0x3904a9){_0x3904a9=_0x3904a9||0x1f4;return function(_0xff3454){logger[_0xf1f9('0x24')](_0xff3454[_0xf1f9('0x25')]);if(_0xff3454[_0xf1f9('0x26')]){delete _0xff3454[_0xf1f9('0x26')];}_0x4caa76[_0xf1f9('0x19')](_0x3904a9)['send'](_0xff3454);};}exports[_0xf1f9('0x27')]=function(_0x4bf358,_0x3af8b8){var _0xff65c1={},_0x8f1cb9={},_0x2c6c6b={'count':0x0,'rows':[]};var _0x186f45=_['map'](db[_0xf1f9('0x28')][_0xf1f9('0x29')],function(_0x5c63c0){return{'name':_0x5c63c0['fieldName'],'type':_0x5c63c0[_0xf1f9('0x2a')][_0xf1f9('0x2b')]};});_0x8f1cb9[_0xf1f9('0x2c')]=_[_0xf1f9('0x2d')](_0x186f45,_0xf1f9('0x26'));_0x8f1cb9[_0xf1f9('0x2e')]=_[_0xf1f9('0x2f')](_0x4bf358[_0xf1f9('0x2e')]);_0x8f1cb9['filters']=_[_0xf1f9('0x30')](_0x8f1cb9['model'],_0x8f1cb9[_0xf1f9('0x2e')]);_0xff65c1[_0xf1f9('0x31')]=_[_0xf1f9('0x30')](_0x8f1cb9[_0xf1f9('0x2c')],qs[_0xf1f9('0x32')](_0x4bf358[_0xf1f9('0x2e')][_0xf1f9('0x32')]));_0xff65c1[_0xf1f9('0x31')]=_0xff65c1['attributes'][_0xf1f9('0x33')]?_0xff65c1['attributes']:_0x8f1cb9[_0xf1f9('0x2c')];if(!_0x4bf358['query'][_0xf1f9('0x34')](_0xf1f9('0x35'))){_0xff65c1[_0xf1f9('0x1d')]=qs[_0xf1f9('0x1d')](_0x4bf358[_0xf1f9('0x2e')]['limit']);_0xff65c1[_0xf1f9('0x1c')]=qs[_0xf1f9('0x1c')](_0x4bf358[_0xf1f9('0x2e')][_0xf1f9('0x1c')]);}_0xff65c1[_0xf1f9('0x36')]=qs[_0xf1f9('0x37')](_0x4bf358['query'][_0xf1f9('0x37')]);_0xff65c1[_0xf1f9('0x38')]=qs[_0xf1f9('0x39')](_[_0xf1f9('0x3a')](_0x4bf358[_0xf1f9('0x2e')],_0x8f1cb9[_0xf1f9('0x39')]),_0x186f45);if(_0x4bf358[_0xf1f9('0x2e')][_0xf1f9('0x3b')]){_0xff65c1[_0xf1f9('0x38')]=_[_0xf1f9('0x3c')](_0xff65c1[_0xf1f9('0x38')],{'$or':_[_0xf1f9('0x2d')](_0x186f45,function(_0x54549a){if(_0x54549a[_0xf1f9('0x2a')]!==_0xf1f9('0x3d')){var _0x49f4e0={};_0x49f4e0[_0x54549a['name']]={'$like':'%'+_0x4bf358[_0xf1f9('0x2e')][_0xf1f9('0x3b')]+'%'};return _0x49f4e0;}})});}_0xff65c1=_['merge']({},_0xff65c1,_0x4bf358['options']);var _0x54f611={'where':_0xff65c1[_0xf1f9('0x38')]};return db[_0xf1f9('0x28')]['count'](_0x54f611)[_0xf1f9('0x22')](function(_0x39a328){_0x2c6c6b[_0xf1f9('0x1f')]=_0x39a328;if(_0x4bf358[_0xf1f9('0x2e')][_0xf1f9('0x3e')]){_0xff65c1['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0xf1f9('0x3f')](_0xff65c1);})[_0xf1f9('0x22')](function(_0x8a6a50){_0x2c6c6b[_0xf1f9('0x40')]=_0x8a6a50;return _0x2c6c6b;})[_0xf1f9('0x22')](respondWithFilteredResult(_0x3af8b8,_0xff65c1))[_0xf1f9('0x41')](handleError(_0x3af8b8,null));};exports[_0xf1f9('0x42')]=function(_0x44a052,_0x35864e){var _0xa9d039={'raw':!![],'where':{'id':_0x44a052['params']['id']}},_0x41e989={};_0x41e989['model']=_[_0xf1f9('0x2f')](db[_0xf1f9('0x28')][_0xf1f9('0x29')]);_0x41e989[_0xf1f9('0x2e')]=_[_0xf1f9('0x2f')](_0x44a052['query']);_0x41e989[_0xf1f9('0x39')]=_[_0xf1f9('0x30')](_0x41e989[_0xf1f9('0x2c')],_0x41e989[_0xf1f9('0x2e')]);_0xa9d039['attributes']=_[_0xf1f9('0x30')](_0x41e989[_0xf1f9('0x2c')],qs[_0xf1f9('0x32')](_0x44a052[_0xf1f9('0x2e')][_0xf1f9('0x32')]));_0xa9d039[_0xf1f9('0x31')]=_0xa9d039[_0xf1f9('0x31')][_0xf1f9('0x33')]?_0xa9d039[_0xf1f9('0x31')]:_0x41e989[_0xf1f9('0x2c')];if(_0x44a052[_0xf1f9('0x2e')][_0xf1f9('0x3e')]){_0xa9d039[_0xf1f9('0x43')]=[{'all':!![]}];}_0xa9d039=_[_0xf1f9('0x3c')]({},_0xa9d039,_0x44a052[_0xf1f9('0x44')]);return db[_0xf1f9('0x28')][_0xf1f9('0x45')](_0xa9d039)['then'](handleEntityNotFound(_0x35864e,null))[_0xf1f9('0x22')](respondWithResult(_0x35864e,null))[_0xf1f9('0x41')](handleError(_0x35864e,null));};exports[_0xf1f9('0x46')]=function(_0x2d8f6b,_0x2fc262){return db['VoiceDialReport'][_0xf1f9('0x46')](_0x2d8f6b[_0xf1f9('0x47')],{})['then'](respondWithResult(_0x2fc262,0xc9))[_0xf1f9('0x41')](handleError(_0x2fc262,null));};exports[_0xf1f9('0x21')]=function(_0x462b87,_0x4af1d6){if(_0x462b87['body']['id']){delete _0x462b87['body']['id'];}return db[_0xf1f9('0x28')]['find']({'where':{'id':_0x462b87['params']['id']}})[_0xf1f9('0x22')](handleEntityNotFound(_0x4af1d6,null))[_0xf1f9('0x22')](saveUpdates(_0x462b87[_0xf1f9('0x47')],null))['then'](respondWithResult(_0x4af1d6,null))[_0xf1f9('0x41')](handleError(_0x4af1d6,null));};exports[_0xf1f9('0x23')]=function(_0x2be567,_0x3bd6d8){return db[_0xf1f9('0x28')][_0xf1f9('0x45')]({'where':{'id':_0x2be567['params']['id']}})[_0xf1f9('0x22')](handleEntityNotFound(_0x3bd6d8,null))[_0xf1f9('0x22')](removeEntity(_0x3bd6d8,null))[_0xf1f9('0x41')](handleError(_0x3bd6d8,null));};exports['describe']=function(_0x1838bd,_0x2a6141){return db[_0xf1f9('0x28')][_0xf1f9('0x48')]()[_0xf1f9('0x22')](respondWithResult(_0x2a6141,null))[_0xf1f9('0x41')](handleError(_0x2a6141,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 1c3b404..8461f85 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 _0x4355=['uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial'];(function(_0x5cdf3c,_0x233f63){var _0x515b20=function(_0x10ef8c){while(--_0x10ef8c){_0x5cdf3c['push'](_0x5cdf3c['shift']());}};_0x515b20(++_0x233f63);}(_0x4355,0x196));var _0x5435=function(_0x4e1d23,_0x50d336){_0x4e1d23=_0x4e1d23-0x0;var _0x1905c0=_0x4355[_0x4e1d23];return _0x1905c0;};'use strict';var _=require(_0x5435('0x0'));var util=require(_0x5435('0x1'));var logger=require('../../config/logger')(_0x5435('0x2'));var moment=require(_0x5435('0x3'));var BPromise=require(_0x5435('0x4'));var rp=require(_0x5435('0x5'));var fs=require('fs');var path=require(_0x5435('0x6'));var rimraf=require(_0x5435('0x7'));var config=require(_0x5435('0x8'));var attributes=require(_0x5435('0x9'));module[_0x5435('0xa')]=function(_0x493810,_0x2a2cd7){return _0x493810[_0x5435('0xb')](_0x5435('0xc'),attributes,{'tableName':_0x5435('0xd'),'paranoid':![],'indexes':[{'fields':[_0x5435('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed92=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xed92,0x166));var _0x2ed9=function(_0x14d666,_0x5d4a55){_0x14d666=_0x14d666-0x0;var _0x30f6b7=_0xed92[_0x14d666];return _0x30f6b7;};'use strict';var _=require('lodash');var util=require(_0x2ed9('0x0'));var logger=require(_0x2ed9('0x1'))(_0x2ed9('0x2'));var moment=require(_0x2ed9('0x3'));var BPromise=require(_0x2ed9('0x4'));var rp=require(_0x2ed9('0x5'));var fs=require('fs');var path=require(_0x2ed9('0x6'));var rimraf=require(_0x2ed9('0x7'));var config=require(_0x2ed9('0x8'));var attributes=require(_0x2ed9('0x9'));module[_0x2ed9('0xa')]=function(_0x183eea,_0x52dcec){return _0x183eea[_0x2ed9('0xb')](_0x2ed9('0xc'),attributes,{'tableName':_0x2ed9('0xd'),'paranoid':![],'indexes':[{'fields':[_0x2ed9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 01f242c..5af0554 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 _0xdaa7=['VoiceDialReport','create','body','options','raw','then','catch','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceDialReport,\x20%s,\x20%s','result','CreateVoiceDialReport'];(function(_0x36826f,_0x3c408b){var _0x4bb547=function(_0xaa7f66){while(--_0xaa7f66){_0x36826f['push'](_0x36826f['shift']());}};_0x4bb547(++_0x3c408b);}(_0xdaa7,0x1d3));var _0x7daa=function(_0x58db4e,_0x439d8d){_0x58db4e=_0x58db4e-0x0;var _0x40139a=_0xdaa7[_0x58db4e];return _0x40139a;};'use strict';var _=require(_0x7daa('0x0'));var util=require(_0x7daa('0x1'));var moment=require(_0x7daa('0x2'));var BPromise=require('bluebird');var rs=require(_0x7daa('0x3'));var fs=require('fs');var Redis=require(_0x7daa('0x4'));var db=require(_0x7daa('0x5'))['db'];var utils=require(_0x7daa('0x6'));var logger=require(_0x7daa('0x7'))('rpc');var config=require(_0x7daa('0x8'));var jayson=require(_0x7daa('0x9'));var client=jayson[_0x7daa('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x133bd5,_0xdeb4e7,_0x2be7ee){return new BPromise(function(_0x496b20,_0x8526de){return client[_0x7daa('0xb')](_0x133bd5,_0x2be7ee)['then'](function(_0x18f9a2){logger[_0x7daa('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0xdeb4e7,_0x7daa('0xd'));logger[_0x7daa('0xe')](_0x7daa('0xf'),_0xdeb4e7,_0x7daa('0xd'),JSON[_0x7daa('0x10')](_0x18f9a2));if(_0x18f9a2['error']){if(_0x18f9a2[_0x7daa('0x11')][_0x7daa('0x12')]===0x1f4){logger[_0x7daa('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0xdeb4e7,_0x18f9a2['error'][_0x7daa('0x13')]);return _0x8526de(_0x18f9a2[_0x7daa('0x11')][_0x7daa('0x13')]);}logger[_0x7daa('0x11')](_0x7daa('0x14'),_0xdeb4e7,_0x18f9a2[_0x7daa('0x11')]['message']);return _0x496b20(_0x18f9a2['error'][_0x7daa('0x13')]);}else{logger[_0x7daa('0xc')](_0x7daa('0x14'),_0xdeb4e7,_0x7daa('0xd'));_0x496b20(_0x18f9a2[_0x7daa('0x15')][_0x7daa('0x13')]);}})['catch'](function(_0x4a07e2){logger['error'](_0x7daa('0x14'),_0xdeb4e7,_0x4a07e2);_0x8526de(_0x4a07e2);});});}exports[_0x7daa('0x16')]=function(_0x3daa97){var _0x1b0bd5=this;return new Promise(function(_0x186da1,_0x24de85){return db[_0x7daa('0x17')][_0x7daa('0x18')](_0x3daa97[_0x7daa('0x19')],{'raw':_0x3daa97[_0x7daa('0x1a')]?_0x3daa97[_0x7daa('0x1a')][_0x7daa('0x1b')]===undefined?!![]:![]:!![]})[_0x7daa('0x1c')](function(_0x22a554){logger[_0x7daa('0xc')]('CreateVoiceDialReport',_0x3daa97);logger[_0x7daa('0xe')](_0x7daa('0x16'),_0x3daa97,JSON[_0x7daa('0x10')](_0x22a554));_0x186da1(_0x22a554);})[_0x7daa('0x1d')](function(_0x55c3ff){logger[_0x7daa('0x11')](_0x7daa('0x16'),_0x55c3ff['message'],_0x3daa97);_0x24de85(_0x1b0bd5[_0x7daa('0x11')](0x1f4,_0x55c3ff['message']));});});};exports[_0x7daa('0x1e')]=function(_0x227401){var _0xc90cb0=this;return new Promise(function(_0x5cb572,_0x56b829){return db[_0x7daa('0x17')][_0x7daa('0x1f')](_0x227401['body'],{'raw':_0x227401[_0x7daa('0x1a')]?_0x227401[_0x7daa('0x1a')][_0x7daa('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x227401[_0x7daa('0x1a')]?_0x227401[_0x7daa('0x1a')][_0x7daa('0x20')]||null:null,'attributes':_0x227401[_0x7daa('0x1a')]?_0x227401['options'][_0x7daa('0x21')]||null:null,'limit':_0x227401[_0x7daa('0x1a')]?_0x227401[_0x7daa('0x1a')][_0x7daa('0x22')]||null:null})[_0x7daa('0x1c')](function(_0x392542){logger[_0x7daa('0xc')](_0x7daa('0x1e'),_0x227401);logger[_0x7daa('0xe')]('UpdateVoiceDialReport',_0x227401,JSON[_0x7daa('0x10')](_0x392542));_0x5cb572(_0x392542);})[_0x7daa('0x1d')](function(_0x56c78d){logger[_0x7daa('0x11')](_0x7daa('0x1e'),_0x56c78d['message'],_0x227401);_0x56b829(_0xc90cb0[_0x7daa('0x11')](0x1f4,_0x56c78d['message']));});});}; \ No newline at end of file +var _0xaa80=['body','options','raw','then','UpdateVoiceDialReport','update','where','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreateVoiceDialReport','VoiceDialReport','create'];(function(_0x2cc807,_0x566fa0){var _0x4d6f81=function(_0x19b313){while(--_0x19b313){_0x2cc807['push'](_0x2cc807['shift']());}};_0x4d6f81(++_0x566fa0);}(_0xaa80,0x1e3));var _0x0aa8=function(_0x307904,_0x2b2649){_0x307904=_0x307904-0x0;var _0x4921de=_0xaa80[_0x307904];return _0x4921de;};'use strict';var _=require('lodash');var util=require(_0x0aa8('0x0'));var moment=require(_0x0aa8('0x1'));var BPromise=require(_0x0aa8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0aa8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0aa8('0x4'))(_0x0aa8('0x5'));var config=require(_0x0aa8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0aa8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcb0d41,_0x2df8d0,_0x540820){return new BPromise(function(_0x5951f2,_0x12712d){return client['request'](_0xcb0d41,_0x540820)['then'](function(_0x398dc0){logger['info'](_0x0aa8('0x8'),_0x2df8d0,'request\x20sent');logger[_0x0aa8('0x9')](_0x0aa8('0xa'),_0x2df8d0,_0x0aa8('0xb'),JSON[_0x0aa8('0xc')](_0x398dc0));if(_0x398dc0[_0x0aa8('0xd')]){if(_0x398dc0[_0x0aa8('0xd')][_0x0aa8('0xe')]===0x1f4){logger[_0x0aa8('0xd')](_0x0aa8('0x8'),_0x2df8d0,_0x398dc0[_0x0aa8('0xd')]['message']);return _0x12712d(_0x398dc0['error']['message']);}logger[_0x0aa8('0xd')](_0x0aa8('0x8'),_0x2df8d0,_0x398dc0[_0x0aa8('0xd')][_0x0aa8('0xf')]);return _0x5951f2(_0x398dc0['error'][_0x0aa8('0xf')]);}else{logger[_0x0aa8('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x2df8d0,'request\x20sent');_0x5951f2(_0x398dc0['result'][_0x0aa8('0xf')]);}})[_0x0aa8('0x11')](function(_0x36686b){logger[_0x0aa8('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x2df8d0,_0x36686b);_0x12712d(_0x36686b);});});}exports[_0x0aa8('0x12')]=function(_0x5ef4ff){var _0x45525d=this;return new Promise(function(_0x32818c,_0x125f5a){return db[_0x0aa8('0x13')][_0x0aa8('0x14')](_0x5ef4ff[_0x0aa8('0x15')],{'raw':_0x5ef4ff[_0x0aa8('0x16')]?_0x5ef4ff['options'][_0x0aa8('0x17')]===undefined?!![]:![]:!![]})[_0x0aa8('0x18')](function(_0x493a6a){logger[_0x0aa8('0x10')](_0x0aa8('0x12'),_0x5ef4ff);logger[_0x0aa8('0x9')]('CreateVoiceDialReport',_0x5ef4ff,JSON[_0x0aa8('0xc')](_0x493a6a));_0x32818c(_0x493a6a);})[_0x0aa8('0x11')](function(_0x491843){logger['error'](_0x0aa8('0x12'),_0x491843[_0x0aa8('0xf')],_0x5ef4ff);_0x125f5a(_0x45525d[_0x0aa8('0xd')](0x1f4,_0x491843[_0x0aa8('0xf')]));});});};exports[_0x0aa8('0x19')]=function(_0x407fbc){var _0x2ee2cb=this;return new Promise(function(_0x4c332e,_0x411ef4){return db['VoiceDialReport'][_0x0aa8('0x1a')](_0x407fbc[_0x0aa8('0x15')],{'raw':_0x407fbc[_0x0aa8('0x16')]?_0x407fbc['options'][_0x0aa8('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x407fbc[_0x0aa8('0x16')]?_0x407fbc[_0x0aa8('0x16')][_0x0aa8('0x1b')]||null:null,'attributes':_0x407fbc[_0x0aa8('0x16')]?_0x407fbc['options']['attributes']||null:null,'limit':_0x407fbc[_0x0aa8('0x16')]?_0x407fbc[_0x0aa8('0x16')]['limit']||null:null})[_0x0aa8('0x18')](function(_0x51d0c6){logger[_0x0aa8('0x10')]('UpdateVoiceDialReport',_0x407fbc);logger[_0x0aa8('0x9')](_0x0aa8('0x19'),_0x407fbc,JSON[_0x0aa8('0xc')](_0x51d0c6));_0x4c332e(_0x51d0c6);})[_0x0aa8('0x11')](function(_0x212c61){logger[_0x0aa8('0xd')](_0x0aa8('0x19'),_0x212c61[_0x0aa8('0xf')],_0x407fbc);_0x411ef4(_0x2ee2cb['error'](0x1f4,_0x212c61[_0x0aa8('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 3a44257..d1d5291 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 _0x6c92=['create','post','/:id/applications','addApplications','put','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id'];(function(_0x28b73f,_0x228316){var _0x5498b6=function(_0x3270c9){while(--_0x3270c9){_0x28b73f['push'](_0x28b73f['shift']());}};_0x5498b6(++_0x228316);}(_0x6c92,0x10c));var _0x26c9=function(_0x1da428,_0x213e7b){_0x1da428=_0x1da428-0x0;var _0xb9c288=_0x6c92[_0x1da428];return _0xb9c288;};'use strict';var multer=require('multer');var util=require(_0x26c9('0x0'));var path=require(_0x26c9('0x1'));var timeout=require(_0x26c9('0x2'));var express=require('express');var router=express[_0x26c9('0x3')]();var fs_extra=require(_0x26c9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x26c9('0x5'));var config=require(_0x26c9('0x6'));var controller=require(_0x26c9('0x7'));router[_0x26c9('0x8')]('/',auth[_0x26c9('0x9')](),controller[_0x26c9('0xa')]);router[_0x26c9('0x8')](_0x26c9('0xb'),auth[_0x26c9('0x9')](),controller['show']);router['post']('/',auth[_0x26c9('0x9')](),controller[_0x26c9('0xc')]);router[_0x26c9('0xd')](_0x26c9('0xe'),auth['isAuthenticated'](),controller[_0x26c9('0xf')]);router[_0x26c9('0x10')](_0x26c9('0xb'),auth[_0x26c9('0x9')](),controller[_0x26c9('0x11')]);router[_0x26c9('0x12')](_0x26c9('0xb'),auth[_0x26c9('0x9')](),controller['destroy']);module[_0x26c9('0x13')]=router; \ No newline at end of file +var _0x7b6a=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','create','post','addApplications','put','update','destroy','exports','multer','util'];(function(_0xea2d53,_0x68af5e){var _0x1c33d4=function(_0x4f6816){while(--_0x4f6816){_0xea2d53['push'](_0xea2d53['shift']());}};_0x1c33d4(++_0x68af5e);}(_0x7b6a,0x1cc));var _0xa7b6=function(_0x5e38a9,_0x4a4729){_0x5e38a9=_0x5e38a9-0x0;var _0x292cfe=_0x7b6a[_0x5e38a9];return _0x292cfe;};'use strict';var multer=require(_0xa7b6('0x0'));var util=require(_0xa7b6('0x1'));var path=require(_0xa7b6('0x2'));var timeout=require(_0xa7b6('0x3'));var express=require(_0xa7b6('0x4'));var router=express[_0xa7b6('0x5')]();var fs_extra=require(_0xa7b6('0x6'));var auth=require(_0xa7b6('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa7b6('0x8'));router[_0xa7b6('0x9')]('/',auth[_0xa7b6('0xa')](),controller[_0xa7b6('0xb')]);router[_0xa7b6('0x9')](_0xa7b6('0xc'),auth['isAuthenticated'](),controller[_0xa7b6('0xd')]);router['post']('/',auth[_0xa7b6('0xa')](),controller[_0xa7b6('0xe')]);router[_0xa7b6('0xf')]('/:id/applications',auth['isAuthenticated'](),controller[_0xa7b6('0x10')]);router[_0xa7b6('0x11')]('/:id',auth[_0xa7b6('0xa')](),controller[_0xa7b6('0x12')]);router['delete'](_0xa7b6('0xc'),auth['isAuthenticated'](),controller[_0xa7b6('0x13')]);module[_0xa7b6('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 719fbce..e6e1262 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 _0x270c=['BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','exten','compositeIndex','STRING','NoOp','ENUM','inbound','outbound','inbound-fax','system','any','*,*,*,*'];(function(_0x5ad3ee,_0x29ede2){var _0x16ec4b=function(_0x579963){while(--_0x579963){_0x5ad3ee['push'](_0x5ad3ee['shift']());}};_0x16ec4b(++_0x29ede2);}(_0x270c,0x146));var _0xc270=function(_0x1c6654,_0x3e1e00){_0x1c6654=_0x1c6654-0x0;var _0x305750=_0x270c[_0x1c6654];return _0x305750;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc270('0x0'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xc270('0x1')],'allowNull':![],'unique':_0xc270('0x0')},'priority':{'type':Sequelize[_0xc270('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xc270('0x0')},'tag':{'type':Sequelize[_0xc270('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc270('0x2')},'appdata':{'type':Sequelize[_0xc270('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xc270('0x3')](_0xc270('0x4'),_0xc270('0x5'),'internal',_0xc270('0x6'),'outbound-fax',_0xc270('0x7'),_0xc270('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0xc270('0x1')]},'interval':{'type':Sequelize[_0xc270('0x1')],'allowNull':![],'defaultValue':_0xc270('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xc270('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xc270('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xc270('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xc270('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xc270('0xc')},'answer':{'type':Sequelize[_0xc270('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0xc270('0xd')],'get':function(_0x17bc28){return this[_0xc270('0xe')](_0xc270('0xf'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x2eac=['system','any','*,*,*,*','BOOLEAN','INTEGER','VIRTUAL','getDataValue','exten','STRING','compositeIndex','NoOp','ENUM','outbound','internal','inbound-fax','outbound-fax'];(function(_0x15204b,_0x12d6af){var _0x410d73=function(_0x48e1df){while(--_0x48e1df){_0x15204b['push'](_0x15204b['shift']());}};_0x410d73(++_0x12d6af);}(_0x2eac,0x98));var _0xc2ea=function(_0x46a0ae,_0x35ed2c){_0x46a0ae=_0x46a0ae-0x0;var _0x4d8e58=_0x2eac[_0x46a0ae];return _0x4d8e58;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0xc2ea('0x0')],'allowNull':![],'unique':_0xc2ea('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xc2ea('0x0')],'allowNull':![],'unique':_0xc2ea('0x1')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xc2ea('0x1')},'tag':{'type':Sequelize[_0xc2ea('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xc2ea('0x0')],'allowNull':![],'defaultValue':_0xc2ea('0x2')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xc2ea('0x3')]('inbound',_0xc2ea('0x4'),_0xc2ea('0x5'),_0xc2ea('0x6'),_0xc2ea('0x7'),_0xc2ea('0x8'),_0xc2ea('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xc2ea('0x0')]},'interval':{'type':Sequelize[_0xc2ea('0x0')],'allowNull':![],'defaultValue':_0xc2ea('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xc2ea('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xc2ea('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0xc2ea('0x0')],'allowNull':!![]},'record':{'type':Sequelize[_0xc2ea('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xc2ea('0xc')]},'recordingFormat':{'type':Sequelize[_0xc2ea('0x0')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xc2ea('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xc2ea('0xd')],'get':function(_0x30765c){return this[_0xc2ea('0xe')](_0xc2ea('0xf'));}},'alias':{'type':Sequelize[_0xc2ea('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 591169e..cfae2d4 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 _0x9bac=['VoiceExtension','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','merge','catch','create','body','exten','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','isApp','createRouting','bulkCreate','finally','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','includes','type','find','UserProfileResource','then','error','stack','name','send','index'];(function(_0x5c4a36,_0x5c54f7){var _0x211638=function(_0x4d124c){while(--_0x4d124c){_0x5c4a36['push'](_0x5c4a36['shift']());}};_0x211638(++_0x5c54f7);}(_0x9bac,0x13b));var _0xc9ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9bac[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc9ba('0x0'));var Redis=require(_0xc9ba('0x1'));var qs=require(_0xc9ba('0x2'));var logger=require('../../config/logger')('api');var config=require(_0xc9ba('0x3'));var db=require(_0xc9ba('0x4'))['db'];config[_0xc9ba('0x5')]=_[_0xc9ba('0x6')](config[_0xc9ba('0x5')],{'host':_0xc9ba('0x7'),'port':0x18eb});var socket=require(_0xc9ba('0x8'))(new Redis(config[_0xc9ba('0x5')]));require(_0xc9ba('0x9'))[_0xc9ba('0xa')](socket);function respondWithStatusCode(_0x15e2bb,_0x242386){_0x242386=_0x242386||0xcc;return function(_0x15a9fd){if(_0x15a9fd){return _0x15e2bb[_0xc9ba('0xb')](_0x242386);}return _0x15e2bb[_0xc9ba('0xc')](_0x242386)[_0xc9ba('0xd')]();};}function respondWithResult(_0x5b6b56,_0x421afa){_0x421afa=_0x421afa||0xc8;return function(_0x58fea5){if(_0x58fea5){return _0x5b6b56['status'](_0x421afa)[_0xc9ba('0xe')](_0x58fea5);}};}function respondWithFilteredResult(_0x4e8c20,_0x5377b6){return function(_0x55602c){if(_0x55602c){var _0x5cbbc0=typeof _0x5377b6[_0xc9ba('0xf')]===_0xc9ba('0x10')&&typeof _0x5377b6[_0xc9ba('0x11')]===_0xc9ba('0x10');var _0x29cbad=_0x55602c[_0xc9ba('0x12')];var _0x379b81=_0x5cbbc0?0x0:_0x5377b6[_0xc9ba('0xf')];var _0x2eb0c1=_0x5cbbc0?_0x55602c[_0xc9ba('0x12')]:_0x5377b6[_0xc9ba('0xf')]+_0x5377b6['limit'];var _0x7d1e87;if(_0x2eb0c1>=_0x29cbad){_0x2eb0c1=_0x29cbad;_0x7d1e87=0xc8;}else{_0x7d1e87=0xce;}_0x4e8c20[_0xc9ba('0xc')](_0x7d1e87);return _0x4e8c20['set'](_0xc9ba('0x13'),_0x379b81+'-'+_0x2eb0c1+'/'+_0x29cbad)[_0xc9ba('0xe')](_0x55602c);}return null;};}function removeEntity(_0x11b540){return function(_0x2f0cee){if(_0x2f0cee){return _0x2f0cee[_0xc9ba('0x14')]()['then'](function(){var _0x19ec07=_0x2f0cee[_0xc9ba('0x15')]({'plain':!![]});var _0x3d592b=[{'name':_0xc9ba('0x16'),'value':_0xc9ba('0x17'),'ignore':![]},{'name':_0xc9ba('0x18'),'value':_0xc9ba('0x19'),'ignore':![]},{'name':_0xc9ba('0x1a'),'value':_0xc9ba('0x1b'),'ignore':![]}];var _0x193d3a=_(_0x3d592b)[_0xc9ba('0x1c')]('ignore')[_0xc9ba('0x1d')](_0xc9ba('0x1e'))[_0xc9ba('0x1e')]();if(_[_0xc9ba('0x1f')](_0x193d3a,_0x19ec07[_0xc9ba('0x20')])){return;}var _0x575c22=_[_0xc9ba('0x21')](_0x3d592b,[_0xc9ba('0x1e'),_0x19ec07[_0xc9ba('0x20')]])['name'];return db[_0xc9ba('0x22')]['destroy']({'where':{'type':_0x575c22,'resourceId':_0x19ec07['id']}})[_0xc9ba('0x23')](function(){return _0x2f0cee;});})[_0xc9ba('0x23')](function(){_0x11b540[_0xc9ba('0xc')](0xcc)[_0xc9ba('0xd')]();});}};}function handleEntityNotFound(_0x5b4dde){return function(_0x58a455){if(!_0x58a455){_0x5b4dde[_0xc9ba('0xb')](0x194);}return _0x58a455;};}function handleError(_0x196fa1,_0xd1a2b1){_0xd1a2b1=_0xd1a2b1||0x1f4;return function(_0x2928a2){logger[_0xc9ba('0x24')](_0x2928a2[_0xc9ba('0x25')]);if(_0x2928a2[_0xc9ba('0x26')]){delete _0x2928a2['name'];}_0x196fa1[_0xc9ba('0xc')](_0xd1a2b1)[_0xc9ba('0x27')](_0x2928a2);};}exports[_0xc9ba('0x28')]=function(_0x2c9e00,_0x8f8efc){var _0x1d2fa0={},_0x3a935c={},_0x463fd8={'count':0x0,'rows':[]};var _0x490da8=_[_0xc9ba('0x1d')](db[_0xc9ba('0x29')][_0xc9ba('0x2a')],function(_0x478b52){return{'name':_0x478b52[_0xc9ba('0x2b')],'type':_0x478b52[_0xc9ba('0x20')][_0xc9ba('0x2c')]};});_0x3a935c[_0xc9ba('0x2d')]=_[_0xc9ba('0x1d')](_0x490da8,_0xc9ba('0x26'));_0x3a935c[_0xc9ba('0x2e')]=_['keys'](_0x2c9e00[_0xc9ba('0x2e')]);_0x3a935c['filters']=_['intersection'](_0x3a935c[_0xc9ba('0x2d')],_0x3a935c['query']);_0x1d2fa0[_0xc9ba('0x2f')]=_[_0xc9ba('0x30')](_0x3a935c[_0xc9ba('0x2d')],qs[_0xc9ba('0x31')](_0x2c9e00[_0xc9ba('0x2e')][_0xc9ba('0x31')]));_0x1d2fa0[_0xc9ba('0x2f')]=_0x1d2fa0[_0xc9ba('0x2f')][_0xc9ba('0x32')]?_0x1d2fa0['attributes']:_0x3a935c[_0xc9ba('0x2d')];if(!_0x2c9e00[_0xc9ba('0x2e')][_0xc9ba('0x33')](_0xc9ba('0x34'))){_0x1d2fa0['limit']=qs[_0xc9ba('0x11')](_0x2c9e00[_0xc9ba('0x2e')][_0xc9ba('0x11')]);_0x1d2fa0[_0xc9ba('0xf')]=qs[_0xc9ba('0xf')](_0x2c9e00[_0xc9ba('0x2e')][_0xc9ba('0xf')]);}_0x1d2fa0[_0xc9ba('0x35')]=qs[_0xc9ba('0x36')](_0x2c9e00['query'][_0xc9ba('0x36')]);_0x1d2fa0['where']=qs[_0xc9ba('0x37')](_[_0xc9ba('0x38')](_0x2c9e00['query'],_0x3a935c[_0xc9ba('0x37')]),_0x490da8);if(_0x2c9e00[_0xc9ba('0x2e')][_0xc9ba('0x1c')]){_0x1d2fa0['where']=_['merge'](_0x1d2fa0[_0xc9ba('0x39')],{'$or':_[_0xc9ba('0x1d')](_0x490da8,function(_0x364332){if(_0x364332[_0xc9ba('0x20')]!==_0xc9ba('0x3a')){var _0x477253={};_0x477253[_0x364332['name']]={'$like':'%'+_0x2c9e00[_0xc9ba('0x2e')][_0xc9ba('0x1c')]+'%'};return _0x477253;}})});}_0x1d2fa0=_['merge']({},_0x1d2fa0,_0x2c9e00[_0xc9ba('0x3b')]);var _0x10bd25={'where':_0x1d2fa0[_0xc9ba('0x39')]};return db[_0xc9ba('0x29')][_0xc9ba('0x12')](_0x10bd25)[_0xc9ba('0x23')](function(_0x49f63d){_0x463fd8['count']=_0x49f63d;if(_0x2c9e00['query'][_0xc9ba('0x3c')]){_0x1d2fa0[_0xc9ba('0x3d')]=[{'all':!![]}];}return db['VoiceExtension'][_0xc9ba('0x3e')](_0x1d2fa0);})[_0xc9ba('0x23')](function(_0x54f42e){_0x463fd8[_0xc9ba('0x3f')]=_0x54f42e;return _0x463fd8;})[_0xc9ba('0x23')](respondWithFilteredResult(_0x8f8efc,_0x1d2fa0))['catch'](handleError(_0x8f8efc,null));};exports[_0xc9ba('0x40')]=function(_0x245807,_0x536618){var _0x3b9867={'raw':![],'where':{'id':_0x245807[_0xc9ba('0x41')]['id']}},_0x3ad83d={};_0x3ad83d[_0xc9ba('0x2d')]=_[_0xc9ba('0x42')](db[_0xc9ba('0x29')][_0xc9ba('0x2a')]);_0x3ad83d['query']=_[_0xc9ba('0x42')](_0x245807[_0xc9ba('0x2e')]);_0x3ad83d[_0xc9ba('0x37')]=_[_0xc9ba('0x30')](_0x3ad83d[_0xc9ba('0x2d')],_0x3ad83d[_0xc9ba('0x2e')]);_0x3b9867[_0xc9ba('0x2f')]=_[_0xc9ba('0x30')](_0x3ad83d['model'],qs[_0xc9ba('0x31')](_0x245807[_0xc9ba('0x2e')][_0xc9ba('0x31')]));_0x3b9867[_0xc9ba('0x2f')]=_0x3b9867[_0xc9ba('0x2f')][_0xc9ba('0x32')]?_0x3b9867['attributes']:_0x3ad83d[_0xc9ba('0x2d')];if(_0x245807['query'][_0xc9ba('0x3c')]){_0x3b9867['include']=[{'all':!![]}];}_0x3b9867=_[_0xc9ba('0x43')]({},_0x3b9867,_0x245807['options']);return db[_0xc9ba('0x29')][_0xc9ba('0x21')](_0x3b9867)['then'](handleEntityNotFound(_0x536618,null))[_0xc9ba('0x23')](respondWithResult(_0x536618,null))[_0xc9ba('0x44')](handleError(_0x536618,null));};exports[_0xc9ba('0x14')]=function(_0x5e589d,_0x558a01){return db[_0xc9ba('0x29')][_0xc9ba('0x21')]({'where':{'id':_0x5e589d[_0xc9ba('0x41')]['id']}})['then'](handleEntityNotFound(_0x558a01,null))['then'](removeEntity(_0x558a01,null))['catch'](handleError(_0x558a01,null));};exports[_0xc9ba('0x45')]=function(_0x20fe4e,_0x12c5fd){if(_0x20fe4e[_0xc9ba('0x46')][_0xc9ba('0x20')]===_0xc9ba('0x19')&&!_['startsWith'](_0x20fe4e[_0xc9ba('0x46')]['exten'],'_')){_0x20fe4e[_0xc9ba('0x46')][_0xc9ba('0x47')]='_'['concat'](_0x20fe4e[_0xc9ba('0x46')][_0xc9ba('0x47')]);}return db[_0xc9ba('0x29')][_0xc9ba('0x45')](_0x20fe4e['body'],{'raw':![]})[_0xc9ba('0x23')](function(_0x3c6ef1){var _0x58ce2d=_0x20fe4e[_0xc9ba('0x48')][_0xc9ba('0x15')]({'plain':!![]});if(!_0x58ce2d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58ce2d['role']===_0xc9ba('0x48')){var _0xad2798=_0x3c6ef1[_0xc9ba('0x15')]({'plain':!![]});var _0x30698b=[{'name':_0xc9ba('0x16'),'value':_0xc9ba('0x17')},{'name':'OutboundRoutes','value':_0xc9ba('0x19')},{'name':_0xc9ba('0x1a'),'value':_0xc9ba('0x1b')}];var _0x607eec=_[_0xc9ba('0x21')](_0x30698b,[_0xc9ba('0x1e'),_0xad2798[_0xc9ba('0x20')]])[_0xc9ba('0x26')];return db['UserProfileSection'][_0xc9ba('0x21')]({'where':{'name':_0x607eec,'userProfileId':_0x58ce2d[_0xc9ba('0x49')]},'raw':!![]})[_0xc9ba('0x23')](function(_0x4bd1e2){if(_0x4bd1e2&&_0x4bd1e2[_0xc9ba('0x4a')]===0x0){return db['UserProfileResource'][_0xc9ba('0x45')]({'name':_0xad2798[_0xc9ba('0x26')],'resourceId':_0xad2798['id'],'type':_0x4bd1e2[_0xc9ba('0x26')],'sectionId':_0x4bd1e2['id']},{})[_0xc9ba('0x23')](function(){return _0x3c6ef1;});}else{return _0x3c6ef1;}})[_0xc9ba('0x44')](function(_0x1b836b){logger['error'](_0xc9ba('0x4b'),_0x1b836b);throw _0x1b836b;});}return _0x3c6ef1;})['then'](respondWithResult(_0x12c5fd,0xc9))['catch'](handleError(_0x12c5fd,null));};exports[_0xc9ba('0x4c')]=function(_0x8e7c08,_0x566c96){if(_0x8e7c08[_0xc9ba('0x46')]['id']){delete _0x8e7c08[_0xc9ba('0x46')]['id'];}return db['VoiceExtension'][_0xc9ba('0x21')]({'where':{'id':_0x8e7c08[_0xc9ba('0x41')]['id']}})[_0xc9ba('0x23')](handleEntityNotFound(_0x566c96,null))['then'](function(_0x372551){if(_0x372551){return db[_0xc9ba('0x29')][_0xc9ba('0x4c')](_['pick'](_0x8e7c08[_0xc9ba('0x46')],[_0xc9ba('0x47'),_0xc9ba('0x4d'),_0xc9ba('0x4e'),'recordingFormat',_0xc9ba('0x4f'),'mandatoryDisposition','alias']),{'where':{'context':_0x372551[_0xc9ba('0x4d')],'exten':_0x372551[_0xc9ba('0x47')]},'individualHooks':!![]})[_0xc9ba('0x23')](function(_0x43128e){return _0x43128e;});}return null;})[_0xc9ba('0x23')](respondWithStatusCode(_0x566c96,null))[_0xc9ba('0x44')](handleError(_0x566c96,null));};exports[_0xc9ba('0x50')]=function(_0x1cc48b,_0x5f5d31){var _0x2d029a=_0x1cc48b[_0xc9ba('0x41')]['id'];var _0x569ebc=_0x1cc48b['body'];var _0x3d3a80=0xc8;var _0x41c0a2=null;return db[_0xc9ba('0x51')][_0xc9ba('0x52')]({'isolationLevel':db['sequelize']['Transaction'][_0xc9ba('0x53')][_0xc9ba('0x54')]},function(_0x44d083){return db[_0xc9ba('0x29')]['findOne']({'where':{'id':_0x2d029a},'transaction':_0x44d083})[_0xc9ba('0x23')](function(_0x57925a){if(_0x57925a){return db[_0xc9ba('0x29')][_0xc9ba('0x14')]({'where':{'VoiceExtensionId':_0x2d029a},'transaction':_0x44d083})['then'](function(){var _0x3a06c9=_[_0xc9ba('0x1d')](_0x569ebc,function(_0x5b136a){_0x5b136a['VoiceExtensionId']=_0x2d029a;_0x5b136a[_0xc9ba('0x55')]=!![];return _0x5b136a;});return _0x57925a[_0xc9ba('0x56')](_0x3a06c9);})['then'](function(_0x419c19){return db[_0xc9ba('0x29')][_0xc9ba('0x57')](_0x419c19,{'transaction':_0x44d083});});}else{_0x3d3a80=0x194;_0x41c0a2=[];}});})[_0xc9ba('0x23')](function(){if(_0x3d3a80!==0x194){return db[_0xc9ba('0x29')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x2d029a},'order':'cast(priority\x20as\x20unsigned)'})[_0xc9ba('0x23')](function(_0x362b5f){_0x41c0a2=_0x362b5f;});}})['catch'](function(_0x31e3c8){_0x3d3a80=0x1f4;logger['error'](_0x31e3c8['stack']);if(_0x31e3c8[_0xc9ba('0x26')]){delete _0x31e3c8[_0xc9ba('0x26')];}_0x41c0a2=_0x31e3c8;})[_0xc9ba('0x58')](function(){if(_0x41c0a2===null){_0x5f5d31[_0xc9ba('0xb')](_0x3d3a80);}else{if(_0x3d3a80===0x1f4){_0x5f5d31[_0xc9ba('0xc')](_0x3d3a80)[_0xc9ba('0x27')](_0x41c0a2);}else{_0x5f5d31[_0xc9ba('0xc')](_0x3d3a80)['json'](_0x41c0a2);}}});}; \ No newline at end of file +var _0x7240=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','InternalRoutes','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate','finally','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','InboundRoutes','OutboundRoutes','outbound','internal','map','value','includes','type','find','name','UserProfileResource','then','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters'];(function(_0x1204d8,_0x50dbad){var _0x19f441=function(_0x386481){while(--_0x386481){_0x1204d8['push'](_0x1204d8['shift']());}};_0x19f441(++_0x50dbad);}(_0x7240,0xe3));var _0x0724=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x7240[_0x486f4a];return _0x135d99;};'use strict';var _=require('lodash');var Redis=require(_0x0724('0x0'));var qs=require(_0x0724('0x1'));var logger=require(_0x0724('0x2'))('api');var config=require(_0x0724('0x3'));var db=require(_0x0724('0x4'))['db'];config['redis']=_[_0x0724('0x5')](config[_0x0724('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0724('0x6')]));require(_0x0724('0x7'))[_0x0724('0x8')](socket);function respondWithStatusCode(_0x3f8745,_0x7c173e){_0x7c173e=_0x7c173e||0xcc;return function(_0x1ddc7f){if(_0x1ddc7f){return _0x3f8745[_0x0724('0x9')](_0x7c173e);}return _0x3f8745[_0x0724('0xa')](_0x7c173e)[_0x0724('0xb')]();};}function respondWithResult(_0x16e3ed,_0x22b18f){_0x22b18f=_0x22b18f||0xc8;return function(_0x612ce6){if(_0x612ce6){return _0x16e3ed[_0x0724('0xa')](_0x22b18f)[_0x0724('0xc')](_0x612ce6);}};}function respondWithFilteredResult(_0x178e1c,_0x5837fa){return function(_0x16d37b){if(_0x16d37b){var _0x5c7875=typeof _0x5837fa[_0x0724('0xd')]===_0x0724('0xe')&&typeof _0x5837fa[_0x0724('0xf')]===_0x0724('0xe');var _0x4dee3b=_0x16d37b[_0x0724('0x10')];var _0x29253c=_0x5c7875?0x0:_0x5837fa['offset'];var _0x4a95c8=_0x5c7875?_0x16d37b[_0x0724('0x10')]:_0x5837fa[_0x0724('0xd')]+_0x5837fa[_0x0724('0xf')];var _0x59012d;if(_0x4a95c8>=_0x4dee3b){_0x4a95c8=_0x4dee3b;_0x59012d=0xc8;}else{_0x59012d=0xce;}_0x178e1c['status'](_0x59012d);return _0x178e1c[_0x0724('0x11')](_0x0724('0x12'),_0x29253c+'-'+_0x4a95c8+'/'+_0x4dee3b)[_0x0724('0xc')](_0x16d37b);}return null;};}function removeEntity(_0x4c706a){return function(_0x2c57d3){if(_0x2c57d3){return _0x2c57d3[_0x0724('0x13')]()['then'](function(){var _0x5043a4=_0x2c57d3[_0x0724('0x14')]({'plain':!![]});var _0x1915e0=[{'name':_0x0724('0x15'),'value':'inbound','ignore':![]},{'name':_0x0724('0x16'),'value':_0x0724('0x17'),'ignore':![]},{'name':'InternalRoutes','value':_0x0724('0x18'),'ignore':![]}];var _0x69d152=_(_0x1915e0)['filter']('ignore')[_0x0724('0x19')](_0x0724('0x1a'))[_0x0724('0x1a')]();if(_[_0x0724('0x1b')](_0x69d152,_0x5043a4[_0x0724('0x1c')])){return;}var _0x12e1ff=_[_0x0724('0x1d')](_0x1915e0,[_0x0724('0x1a'),_0x5043a4[_0x0724('0x1c')]])[_0x0724('0x1e')];return db[_0x0724('0x1f')][_0x0724('0x13')]({'where':{'type':_0x12e1ff,'resourceId':_0x5043a4['id']}})['then'](function(){return _0x2c57d3;});})[_0x0724('0x20')](function(){_0x4c706a['status'](0xcc)[_0x0724('0xb')]();});}};}function handleEntityNotFound(_0x3b4aac){return function(_0xa60205){if(!_0xa60205){_0x3b4aac[_0x0724('0x9')](0x194);}return _0xa60205;};}function handleError(_0x5bd9aa,_0x423912){_0x423912=_0x423912||0x1f4;return function(_0x541315){logger[_0x0724('0x21')](_0x541315[_0x0724('0x22')]);if(_0x541315[_0x0724('0x1e')]){delete _0x541315['name'];}_0x5bd9aa['status'](_0x423912)[_0x0724('0x23')](_0x541315);};}exports[_0x0724('0x24')]=function(_0x97ae00,_0x5c6212){var _0x1b6041={},_0x33a728={},_0x42e5a7={'count':0x0,'rows':[]};var _0x4255f6=_[_0x0724('0x19')](db[_0x0724('0x25')][_0x0724('0x26')],function(_0x556790){return{'name':_0x556790[_0x0724('0x27')],'type':_0x556790['type']['key']};});_0x33a728[_0x0724('0x28')]=_[_0x0724('0x19')](_0x4255f6,'name');_0x33a728[_0x0724('0x29')]=_[_0x0724('0x2a')](_0x97ae00['query']);_0x33a728['filters']=_[_0x0724('0x2b')](_0x33a728[_0x0724('0x28')],_0x33a728[_0x0724('0x29')]);_0x1b6041[_0x0724('0x2c')]=_[_0x0724('0x2b')](_0x33a728[_0x0724('0x28')],qs[_0x0724('0x2d')](_0x97ae00[_0x0724('0x29')][_0x0724('0x2d')]));_0x1b6041['attributes']=_0x1b6041['attributes'][_0x0724('0x2e')]?_0x1b6041[_0x0724('0x2c')]:_0x33a728[_0x0724('0x28')];if(!_0x97ae00[_0x0724('0x29')]['hasOwnProperty'](_0x0724('0x2f'))){_0x1b6041[_0x0724('0xf')]=qs[_0x0724('0xf')](_0x97ae00[_0x0724('0x29')][_0x0724('0xf')]);_0x1b6041[_0x0724('0xd')]=qs[_0x0724('0xd')](_0x97ae00['query'][_0x0724('0xd')]);}_0x1b6041[_0x0724('0x30')]=qs[_0x0724('0x31')](_0x97ae00['query'][_0x0724('0x31')]);_0x1b6041[_0x0724('0x32')]=qs[_0x0724('0x33')](_[_0x0724('0x34')](_0x97ae00[_0x0724('0x29')],_0x33a728['filters']),_0x4255f6);if(_0x97ae00[_0x0724('0x29')][_0x0724('0x35')]){_0x1b6041[_0x0724('0x32')]=_[_0x0724('0x36')](_0x1b6041['where'],{'$or':_[_0x0724('0x19')](_0x4255f6,function(_0x41e159){if(_0x41e159['type']!==_0x0724('0x37')){var _0x4cb251={};_0x4cb251[_0x41e159[_0x0724('0x1e')]]={'$like':'%'+_0x97ae00[_0x0724('0x29')][_0x0724('0x35')]+'%'};return _0x4cb251;}})});}_0x1b6041=_[_0x0724('0x36')]({},_0x1b6041,_0x97ae00[_0x0724('0x38')]);var _0x204c1d={'where':_0x1b6041[_0x0724('0x32')]};return db['VoiceExtension']['count'](_0x204c1d)['then'](function(_0x5c2c72){_0x42e5a7[_0x0724('0x10')]=_0x5c2c72;if(_0x97ae00[_0x0724('0x29')][_0x0724('0x39')]){_0x1b6041[_0x0724('0x3a')]=[{'all':!![]}];}return db[_0x0724('0x25')][_0x0724('0x3b')](_0x1b6041);})[_0x0724('0x20')](function(_0x574903){_0x42e5a7[_0x0724('0x3c')]=_0x574903;return _0x42e5a7;})['then'](respondWithFilteredResult(_0x5c6212,_0x1b6041))[_0x0724('0x3d')](handleError(_0x5c6212,null));};exports[_0x0724('0x3e')]=function(_0x1c617b,_0x450352){var _0x1afd77={'raw':![],'where':{'id':_0x1c617b[_0x0724('0x3f')]['id']}},_0x5d903a={};_0x5d903a['model']=_['keys'](db[_0x0724('0x25')][_0x0724('0x26')]);_0x5d903a['query']=_['keys'](_0x1c617b[_0x0724('0x29')]);_0x5d903a[_0x0724('0x33')]=_['intersection'](_0x5d903a[_0x0724('0x28')],_0x5d903a[_0x0724('0x29')]);_0x1afd77[_0x0724('0x2c')]=_[_0x0724('0x2b')](_0x5d903a['model'],qs[_0x0724('0x2d')](_0x1c617b[_0x0724('0x29')]['fields']));_0x1afd77[_0x0724('0x2c')]=_0x1afd77[_0x0724('0x2c')][_0x0724('0x2e')]?_0x1afd77[_0x0724('0x2c')]:_0x5d903a[_0x0724('0x28')];if(_0x1c617b[_0x0724('0x29')][_0x0724('0x39')]){_0x1afd77[_0x0724('0x3a')]=[{'all':!![]}];}_0x1afd77=_['merge']({},_0x1afd77,_0x1c617b['options']);return db[_0x0724('0x25')][_0x0724('0x1d')](_0x1afd77)[_0x0724('0x20')](handleEntityNotFound(_0x450352,null))[_0x0724('0x20')](respondWithResult(_0x450352,null))[_0x0724('0x3d')](handleError(_0x450352,null));};exports[_0x0724('0x13')]=function(_0x311749,_0x524515){return db['VoiceExtension'][_0x0724('0x1d')]({'where':{'id':_0x311749['params']['id']}})[_0x0724('0x20')](handleEntityNotFound(_0x524515,null))[_0x0724('0x20')](removeEntity(_0x524515,null))[_0x0724('0x3d')](handleError(_0x524515,null));};exports[_0x0724('0x40')]=function(_0x48c508,_0x2066e1){if(_0x48c508[_0x0724('0x41')][_0x0724('0x1c')]===_0x0724('0x17')&&!_['startsWith'](_0x48c508['body'][_0x0724('0x42')],'_')){_0x48c508[_0x0724('0x41')]['exten']='_'[_0x0724('0x43')](_0x48c508[_0x0724('0x41')][_0x0724('0x42')]);}return db[_0x0724('0x25')][_0x0724('0x40')](_0x48c508[_0x0724('0x41')],{'raw':![]})[_0x0724('0x20')](function(_0x2577a4){var _0x3b2469=_0x48c508[_0x0724('0x44')][_0x0724('0x14')]({'plain':!![]});if(!_0x3b2469)throw new Error(_0x0724('0x45'));if(_0x3b2469['role']==='user'){var _0x45d20b=_0x2577a4[_0x0724('0x14')]({'plain':!![]});var _0x5c36a6=[{'name':'InboundRoutes','value':_0x0724('0x46')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x0724('0x47'),'value':'internal'}];var _0x50325d=_['find'](_0x5c36a6,['value',_0x45d20b['type']])[_0x0724('0x1e')];return db[_0x0724('0x48')][_0x0724('0x1d')]({'where':{'name':_0x50325d,'userProfileId':_0x3b2469['userProfileId']},'raw':!![]})['then'](function(_0x36b789){if(_0x36b789&&_0x36b789[_0x0724('0x49')]===0x0){return db[_0x0724('0x1f')][_0x0724('0x40')]({'name':_0x45d20b[_0x0724('0x1e')],'resourceId':_0x45d20b['id'],'type':_0x36b789['name'],'sectionId':_0x36b789['id']},{})[_0x0724('0x20')](function(){return _0x2577a4;});}else{return _0x2577a4;}})[_0x0724('0x3d')](function(_0x3a2566){logger[_0x0724('0x21')](_0x0724('0x4a'),_0x3a2566);throw _0x3a2566;});}return _0x2577a4;})[_0x0724('0x20')](respondWithResult(_0x2066e1,0xc9))[_0x0724('0x3d')](handleError(_0x2066e1,null));};exports[_0x0724('0x4b')]=function(_0x2b4a42,_0x2025ab){if(_0x2b4a42['body']['id']){delete _0x2b4a42[_0x0724('0x41')]['id'];}return db[_0x0724('0x25')][_0x0724('0x1d')]({'where':{'id':_0x2b4a42['params']['id']}})[_0x0724('0x20')](handleEntityNotFound(_0x2025ab,null))[_0x0724('0x20')](function(_0x433cc1){if(_0x433cc1){return db['VoiceExtension'][_0x0724('0x4b')](_['pick'](_0x2b4a42[_0x0724('0x41')],[_0x0724('0x42'),'context',_0x0724('0x4c'),_0x0724('0x4d'),_0x0724('0x4e'),_0x0724('0x4f'),_0x0724('0x50')]),{'where':{'context':_0x433cc1[_0x0724('0x51')],'exten':_0x433cc1[_0x0724('0x42')]},'individualHooks':!![]})['then'](function(_0x3800c8){return _0x3800c8;});}return null;})[_0x0724('0x20')](respondWithStatusCode(_0x2025ab,null))['catch'](handleError(_0x2025ab,null));};exports[_0x0724('0x52')]=function(_0x1b81fb,_0x54fe0d){var _0x81c31=_0x1b81fb[_0x0724('0x3f')]['id'];var _0xf6d36d=_0x1b81fb[_0x0724('0x41')];var _0x3ac482=0xc8;var _0x5cb31b=null;return db[_0x0724('0x53')][_0x0724('0x54')]({'isolationLevel':db['sequelize'][_0x0724('0x55')][_0x0724('0x56')][_0x0724('0x57')]},function(_0x1fc98b){return db[_0x0724('0x25')][_0x0724('0x58')]({'where':{'id':_0x81c31},'transaction':_0x1fc98b})['then'](function(_0x52c2be){if(_0x52c2be){return db[_0x0724('0x25')][_0x0724('0x13')]({'where':{'VoiceExtensionId':_0x81c31},'transaction':_0x1fc98b})[_0x0724('0x20')](function(){var _0x168e3a=_[_0x0724('0x19')](_0xf6d36d,function(_0x194e48){_0x194e48[_0x0724('0x59')]=_0x81c31;_0x194e48[_0x0724('0x5a')]=!![];return _0x194e48;});return _0x52c2be['createRouting'](_0x168e3a);})[_0x0724('0x20')](function(_0x319add){return db[_0x0724('0x25')][_0x0724('0x5b')](_0x319add,{'transaction':_0x1fc98b});});}else{_0x3ac482=0x194;_0x5cb31b=[];}});})[_0x0724('0x20')](function(){if(_0x3ac482!==0x194){return db[_0x0724('0x25')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x81c31},'order':'cast(priority\x20as\x20unsigned)'})[_0x0724('0x20')](function(_0x4507e6){_0x5cb31b=_0x4507e6;});}})[_0x0724('0x3d')](function(_0x1ccaf9){_0x3ac482=0x1f4;logger[_0x0724('0x21')](_0x1ccaf9['stack']);if(_0x1ccaf9[_0x0724('0x1e')]){delete _0x1ccaf9[_0x0724('0x1e')];}_0x5cb31b=_0x1ccaf9;})[_0x0724('0x5c')](function(){if(_0x5cb31b===null){_0x54fe0d['sendStatus'](_0x3ac482);}else{if(_0x3ac482===0x1f4){_0x54fe0d[_0x0724('0xa')](_0x3ac482)[_0x0724('0x23')](_0x5cb31b);}else{_0x54fe0d[_0x0724('0xa')](_0x3ac482)['json'](_0x5cb31b);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 9494af8..ff7769c 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 _0x28fb=['VoiceExtension','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x47f9ca,_0x220026){var _0x22783f=function(_0x472775){while(--_0x472775){_0x47f9ca['push'](_0x47f9ca['shift']());}};_0x22783f(++_0x220026);}(_0x28fb,0xe6));var _0xb28f=function(_0x8a217e,_0x450bfc){_0x8a217e=_0x8a217e-0x0;var _0x3fc350=_0x28fb[_0x8a217e];return _0x3fc350;};'use strict';var EventEmitter=require(_0xb28f('0x0'));var VoiceExtension=require(_0xb28f('0x1'))['db'][_0xb28f('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb28f('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x58d6a5){return function(_0x23d59b,_0x41002a,_0x16d2ca){VoiceExtensionEvents[_0xb28f('0x4')](_0x58d6a5+':'+_0x23d59b['id'],_0x23d59b);VoiceExtensionEvents[_0xb28f('0x4')](_0x58d6a5,_0x23d59b);_0x16d2ca(null);};}for(var e in events){if(events[_0xb28f('0x5')](e)){var event=events[e];VoiceExtension[_0xb28f('0x6')](e,emitEvent(event));}}module[_0xb28f('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0xd734=['exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hook'];(function(_0x18eb3f,_0x23d593){var _0xb5f8a9=function(_0x2bae17){while(--_0x2bae17){_0x18eb3f['push'](_0x18eb3f['shift']());}};_0xb5f8a9(++_0x23d593);}(_0xd734,0xa1));var _0x4d73=function(_0x16fb4f,_0x5a4f0b){_0x16fb4f=_0x16fb4f-0x0;var _0x30a698=_0xd734[_0x16fb4f];return _0x30a698;};'use strict';var EventEmitter=require(_0x4d73('0x0'));var VoiceExtension=require(_0x4d73('0x1'))['db'][_0x4d73('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x4d73('0x3')](0x0);var events={'afterCreate':_0x4d73('0x4'),'afterUpdate':_0x4d73('0x5'),'afterDestroy':_0x4d73('0x6')};function emitEvent(_0x43ec65){return function(_0x50f262,_0x37aa88,_0x50c4c6){VoiceExtensionEvents['emit'](_0x43ec65+':'+_0x50f262['id'],_0x50f262);VoiceExtensionEvents[_0x4d73('0x7')](_0x43ec65,_0x50f262);_0x50c4c6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x4d73('0x8')](e,emitEvent(event));}}module[_0x4d73('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 5e4b832..e1d2f7d 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 _0x86bc=['XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','XCALLY-MOTION-ANSWER=0','hasOwnProperty','recordingFormat','push','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','name','param','phone','prefix','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','define','Hangup','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','NoOp','alias','No\x20alias\x20set','inbound','exten'];(function(_0x3d1646,_0x5c47e5){var _0x5a8cb6=function(_0x262116){while(--_0x262116){_0x3d1646['push'](_0x3d1646['shift']());}};_0x5a8cb6(++_0x5c47e5);}(_0x86bc,0xea));var _0xc86b=function(_0x576f1f,_0x523639){_0x576f1f=_0x576f1f-0x0;var _0x2935c3=_0x86bc[_0x576f1f];return _0x2935c3;};'use strict';var _=require(_0xc86b('0x0'));var attributes=require(_0xc86b('0x1'));module[_0xc86b('0x2')]=function(_0x4c489a){var _0x50f2ab=_0x4c489a['models'];function _0x18479d(_0x245cee){var _0x84157b=0x2;var _0xeeb906=[{'type':_0x245cee[_0xc86b('0x3')],'app':_0xc86b('0x4'),'appdata':_0xc86b('0x5')+_0x245cee[_0xc86b('0x3')],'context':_0x245cee[_0xc86b('0x6')],'exten':_0x245cee['exten'],'priority':_0x84157b++,'VoiceExtensionId':_0x245cee['id']},{'type':_0x245cee[_0xc86b('0x3')],'app':_0x245cee['alias']?_0xc86b('0x4'):_0xc86b('0x7'),'appdata':_0x245cee[_0xc86b('0x8')]?'CDR(routeAlias)='+_0x245cee[_0xc86b('0x8')]:_0xc86b('0x9'),'context':_0x245cee[_0xc86b('0x6')],'exten':_0x245cee['exten'],'priority':_0x84157b++,'VoiceExtensionId':_0x245cee['id']}];if(_0x245cee[_0xc86b('0x3')]===_0xc86b('0xa')){_0xeeb906['push']({'type':_0xc86b('0xa'),'app':_0xc86b('0x4'),'appdata':'CDR(routeid)='+_0x245cee['id'],'context':_0x245cee[_0xc86b('0x6')],'exten':_0x245cee[_0xc86b('0xb')],'priority':_0x84157b++,'VoiceExtensionId':_0x245cee['id']});}_0xeeb906['push']({'type':_0x245cee[_0xc86b('0x3')],'app':_0xc86b('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x245cee[_0xc86b('0x6')],'exten':_0x245cee[_0xc86b('0xb')],'priority':_0x84157b++,'VoiceExtensionId':_0x245cee['id']},{'type':_0x245cee['type'],'app':'Set','appdata':_0xc86b('0xc'),'context':_0x245cee[_0xc86b('0x6')],'exten':_0x245cee[_0xc86b('0xb')],'priority':_0x84157b++,'VoiceExtensionId':_0x245cee['id']},{'type':_0x245cee['type'],'app':'Set','appdata':_0xc86b('0xd'),'context':_0x245cee[_0xc86b('0x6')],'exten':_0x245cee[_0xc86b('0xb')],'priority':_0x84157b++,'VoiceExtensionId':_0x245cee['id']});return _0xeeb906;}function _0x5bf48f(_0x2983d3){var _0x3e22e3=0x2;var _0x28fdf9=[{'type':'outbound','app':'Set','appdata':_0xc86b('0xe'),'context':_0x2983d3[_0xc86b('0x6')],'exten':_0x2983d3[_0xc86b('0xb')],'priority':_0x3e22e3++,'VoiceExtensionId':_0x2983d3['id']},{'type':_0xc86b('0xf'),'app':_0x2983d3[_0xc86b('0x8')]?'Set':_0xc86b('0x7'),'appdata':_0x2983d3[_0xc86b('0x8')]?'CDR(routeAlias)='+_0x2983d3['alias']:'No\x20alias\x20set','context':_0x2983d3[_0xc86b('0x6')],'exten':_0x2983d3['exten'],'priority':_0x3e22e3++,'VoiceExtensionId':_0x2983d3['id']},{'type':'outbound','app':_0xc86b('0x4'),'appdata':_0xc86b('0x10')+(_0x2983d3[_0xc86b('0x11')]?_0xc86b('0x12')+_0x2983d3[_0xc86b('0x11')]+'}':_0xc86b('0x13')),'context':_0x2983d3[_0xc86b('0x6')],'exten':_0x2983d3['exten'],'priority':_0x3e22e3++,'VoiceExtensionId':_0x2983d3['id']},{'type':_0xc86b('0xf'),'app':_0xc86b('0x4'),'appdata':_0xc86b('0x14')+_0x2983d3['id'],'context':_0x2983d3[_0xc86b('0x6')],'exten':_0x2983d3[_0xc86b('0xb')],'priority':_0x3e22e3++,'VoiceExtensionId':_0x2983d3['id']},{'type':'outbound','app':_0xc86b('0x15'),'appdata':_0xc86b('0x16')+(_0x3e22e3+0x2)+_0xc86b('0x17')+(_0x3e22e3+0x1)+')','context':_0x2983d3[_0xc86b('0x6')],'exten':_0x2983d3[_0xc86b('0xb')],'priority':_0x3e22e3++,'VoiceExtensionId':_0x2983d3['id']},{'type':_0xc86b('0xf'),'app':_0xc86b('0x4'),'appdata':_0x2983d3[_0xc86b('0x11')]?'CDR(prefix)=${EXTEN:0:'+_0x2983d3[_0xc86b('0x11')]+'}':'CDR(prefix)=noprefix','context':_0x2983d3[_0xc86b('0x6')],'exten':_0x2983d3[_0xc86b('0xb')],'priority':_0x3e22e3++,'VoiceExtensionId':_0x2983d3['id']},{'type':_0xc86b('0xf'),'app':_0xc86b('0x4'),'appdata':_0xc86b('0x18'),'context':_0x2983d3['context'],'exten':_0x2983d3['exten'],'priority':_0x3e22e3++,'VoiceExtensionId':_0x2983d3['id']},{'type':'outbound','app':_0xc86b('0x4'),'appdata':_0xc86b('0xc'),'context':_0x2983d3[_0xc86b('0x6')],'exten':_0x2983d3['exten'],'priority':_0x3e22e3++,'VoiceExtensionId':_0x2983d3['id']},{'type':'outbound','app':_0xc86b('0x4'),'appdata':_0xc86b('0xd'),'context':_0x2983d3[_0xc86b('0x6')],'exten':_0x2983d3[_0xc86b('0xb')],'priority':_0x3e22e3++,'VoiceExtensionId':_0x2983d3['id']},{'type':_0xc86b('0xf'),'app':_0xc86b('0x4'),'appdata':'outboundrouteid='+_0x2983d3['id'],'context':_0x2983d3[_0xc86b('0x6')],'exten':_0x2983d3[_0xc86b('0xb')],'priority':_0x3e22e3++,'VoiceExtensionId':_0x2983d3['id']}];if(_0x2983d3[_0xc86b('0x19')]('recordingFormat')&&_0x2983d3[_0xc86b('0x1a')]!=='none'){_0x28fdf9[_0xc86b('0x1b')]({'type':_0xc86b('0xf'),'app':_0xc86b('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2983d3[_0xc86b('0x6')],'exten':_0x2983d3['exten'],'priority':_0x3e22e3++,'VoiceExtensionId':_0x2983d3['id']},{'type':_0xc86b('0xf'),'app':'Set','appdata':_0xc86b('0x1c')+_0x2983d3[_0xc86b('0x1a')]||_0xc86b('0x1d'),'context':_0x2983d3[_0xc86b('0x6')],'exten':_0x2983d3[_0xc86b('0xb')],'priority':_0x3e22e3++,'VoiceExtensionId':_0x2983d3['id']});}return _0x28fdf9;}function _0x1b46e8(_0x114ed2,_0x4ab343){var _0x512dc0=[{'name':_0xc86b('0x1e'),'param':0x0},{'name':_0xc86b('0x1f'),'param':0x1},{'name':_0xc86b('0x20'),'param':0x2},{'name':'url','param':0x3}];var _0x270fe2={};var _0x15cfe1=_0x4ab343[_0xc86b('0x21')](',');var _0x9a177f=[];for(var _0x21e190=0x0;_0x21e190<_0x512dc0['length'];_0x21e190++){switch(_0x512dc0[_0x21e190][_0xc86b('0x22')]){case _0xc86b('0x1e'):_0x270fe2[_0xc86b('0x1e')]=_0x15cfe1[_0x512dc0[_0x21e190][_0xc86b('0x23')]][_0xc86b('0x21')]('/')[0x1];_0x270fe2[_0xc86b('0x24')]=_0x15cfe1[_0x512dc0[_0x21e190][_0xc86b('0x23')]][_0xc86b('0x21')]('/')[0x2];_0x270fe2[_0xc86b('0x25')]=_0x270fe2[_0xc86b('0x24')]?_0x270fe2['phone']['split']('$')[0x0]:undefined;_0x270fe2['phone']=_0x114ed2['cutdigits']?(_0x270fe2[_0xc86b('0x25')]||'')+_0xc86b('0x12')+_0x114ed2['cutdigits']+'}':(_0x270fe2['prefix']||'')+_0xc86b('0x13');_0x9a177f[_0x512dc0[_0x21e190]['param']]=[_0xc86b('0x26'),_0x270fe2[_0xc86b('0x1e')],_0x270fe2[_0xc86b('0x24')]][_0xc86b('0x27')]('/');break;case'options':_0x270fe2[_0xc86b('0x20')]=_0x15cfe1[_0x512dc0[_0x21e190][_0xc86b('0x23')]];if(_0x114ed2[_0xc86b('0x1a')]!==_0xc86b('0x28')){if(_0x270fe2[_0xc86b('0x20')][_0xc86b('0x29')](_0xc86b('0x2a'))<0x0){_0x270fe2['options']+=_0xc86b('0x2a');}}else{_0x270fe2[_0xc86b('0x20')]=_0x270fe2[_0xc86b('0x20')][_0xc86b('0x2b')](_0xc86b('0x2a'),'');}_0x9a177f[_0x512dc0[_0x21e190][_0xc86b('0x23')]]=_0x270fe2[_0xc86b('0x20')];break;default:_0x9a177f[_0x512dc0[_0x21e190]['param']]=_0x15cfe1[_0x512dc0[_0x21e190][_0xc86b('0x23')]];}}return _0x9a177f[_0xc86b('0x27')](',');}function _0x15ec9f(_0x2c5ca1,_0xee9ccd,_0x3c49be){return new Promise(function(_0xf4b006,_0xd4e050){var _0x4ea5b7=[];if(_[_0xc86b('0x2c')](_0xee9ccd))return _0xf4b006(_0x4ea5b7);_0x50f2ab[_0xc86b('0x2d')][_0xc86b('0x2e')]({'attributes':['id',_0xc86b('0x2f'),_0xc86b('0x30')],'raw':!![]})[_0xc86b('0x31')](function(_0x1b29f2){for(var _0x5f0e3a=0x0,_0x1b6243=0x0;_0x5f0e3a<_0xee9ccd[_0xc86b('0x32')];_0x5f0e3a++,_0x1b6243=0x0){var _0x416995=_0xee9ccd[_0x5f0e3a];var _0x2a3bb1=[];var _0x267cf2=[];delete _0x416995['id'];if(_0x416995[_0xc86b('0x2f')]!==_0xc86b('0x33')){_0x416995[_0xc86b('0x34')]=[_0x416995['interval']];}else{_0x416995['intervals']=_0x416995['IntervalId']?_['map'](_[_0xc86b('0x35')](_0x1b29f2,{'IntervalId':_0x416995[_0xc86b('0x30')]}),'interval'):[];}_0x416995['context']=_0x2c5ca1['context'];_0x416995[_0xc86b('0xb')]=_0x2c5ca1[_0xc86b('0xb')];if(_0x416995[_0xc86b('0x3')])_0x416995[_0xc86b('0x3')]=_0x416995[_0xc86b('0x3')][_0xc86b('0x36')]();if(_0x2c5ca1[_0xc86b('0x3')]===_0xc86b('0xf')){if(_0x416995[_0xc86b('0x19')](_0xc86b('0x37'))&&_0x416995[_0xc86b('0x37')]&&_0x416995[_0xc86b('0x37')]!=='--'){_0x2a3bb1[_0xc86b('0x1b')]({'type':_0x416995['type'][_0xc86b('0x36')](),'app':_0xc86b('0x4'),'appdata':_0xc86b('0x38')+_0x416995[_0xc86b('0x37')],'context':_0x2c5ca1[_0xc86b('0x6')],'exten':_0x2c5ca1[_0xc86b('0xb')],'priority':_0x416995['intervals']['length']+_0x3c49be+_0x1b6243++,'VoiceExtensionId':_0x2c5ca1['id']});}_0x2a3bb1[_0xc86b('0x1b')]({'type':_0x416995[_0xc86b('0x3')][_0xc86b('0x36')](),'app':_0xc86b('0x15'),'appdata':_0xc86b('0x39')+(_0x416995[_0xc86b('0x3a')]?'Set(CALLERID(all)='+_0x416995['callerID']+')':_0xc86b('0x3b')),'context':_0x2c5ca1['context'],'exten':_0x2c5ca1['exten'],'priority':_0x416995[_0xc86b('0x34')]['length']+_0x3c49be+_0x1b6243++,'VoiceExtensionId':_0x2c5ca1['id']});}else{if(_0x416995[_0xc86b('0x19')](_0xc86b('0x3c'))){if([_0xc86b('0x3d'),_0xc86b('0x3e')][_0xc86b('0x3f')](_0x416995[_0xc86b('0x40')][_0xc86b('0x36')]())&&_0x416995[_0xc86b('0x41')]!==_0xc86b('0x42')){if(_0x416995[_0xc86b('0x3c')]){_0x2a3bb1[_0xc86b('0x1b')]({'type':_0x416995[_0xc86b('0x3')]['toLowerCase'](),'app':'ExecIf','appdata':_0xc86b('0x43'),'context':_0x2c5ca1[_0xc86b('0x6')],'exten':_0x2c5ca1[_0xc86b('0xb')],'priority':_0x416995[_0xc86b('0x34')][_0xc86b('0x32')]+_0x3c49be+_0x1b6243++,'VoiceExtensionId':_0x2c5ca1['id']});_0x2a3bb1[_0xc86b('0x1b')]({'type':_0x416995[_0xc86b('0x3')]['toLowerCase'](),'app':_0xc86b('0x4'),'appdata':_0xc86b('0x44'),'context':_0x2c5ca1['context'],'exten':_0x2c5ca1[_0xc86b('0xb')],'priority':_0x416995[_0xc86b('0x34')][_0xc86b('0x32')]+_0x3c49be+_0x1b6243++,'VoiceExtensionId':_0x2c5ca1['id']});}else{_0x2a3bb1[_0xc86b('0x1b')]({'type':_0x416995[_0xc86b('0x3')][_0xc86b('0x36')](),'app':_0xc86b('0x15'),'appdata':_0xc86b('0x45'),'context':_0x2c5ca1[_0xc86b('0x6')],'exten':_0x2c5ca1[_0xc86b('0xb')],'priority':_0x416995['intervals'][_0xc86b('0x32')]+_0x3c49be+_0x1b6243++,'VoiceExtensionId':_0x2c5ca1['id']});_0x2a3bb1['push']({'type':_0x416995[_0xc86b('0x3')][_0xc86b('0x36')](),'app':_0xc86b('0x4'),'appdata':_0xc86b('0x46'),'context':_0x2c5ca1[_0xc86b('0x6')],'exten':_0x2c5ca1['exten'],'priority':_0x416995['intervals'][_0xc86b('0x32')]+_0x3c49be+_0x1b6243++,'VoiceExtensionId':_0x2c5ca1['id']});}}}}for(var _0x4a20d0=0x0;_0x4a20d0<_0x416995['intervals'][_0xc86b('0x32')];_0x4a20d0++){var _0x4dcd53=_0x3c49be+_0x416995[_0xc86b('0x34')][_0xc86b('0x32')];var _0x3ac687=_0x4a20d0===_0x416995[_0xc86b('0x34')][_0xc86b('0x32')]-0x1?_0x3c49be+_0x2a3bb1[_0xc86b('0x32')]+_0x267cf2[_0xc86b('0x32')]+0x2:_0x3c49be+_0x4a20d0+0x1;_0x2a3bb1[_0xc86b('0x47')](_0x4a20d0,0x0,{'type':_0x2c5ca1['type'],'app':'GotoIfTime','appdata':_0x416995[_0xc86b('0x34')][_0x4a20d0]+'?'+_0x2c5ca1[_0xc86b('0x6')]+_0xc86b('0x48')+_0x4dcd53+':'+_0x2c5ca1[_0xc86b('0x6')]+',${EXTEN},'+_0x3ac687,'exten':_0x2c5ca1[_0xc86b('0xb')],'context':_0x2c5ca1[_0xc86b('0x6')],'priority':_0x3c49be+_0x4a20d0,'VoiceExtensionId':_0x2c5ca1['id']});}if(_0x416995[_0xc86b('0x41')]===_0xc86b('0x49')){_0x416995[_0xc86b('0x4a')]=_0x1b46e8(_0x2c5ca1,_0x416995[_0xc86b('0x4a')]);}if(_0x416995[_0xc86b('0x41')]===_0xc86b('0x4b')){_0x2a3bb1[_0xc86b('0x1b')]({'type':_0x416995[_0xc86b('0x3')][_0xc86b('0x36')](),'app':_0xc86b('0x4'),'appdata':_0xc86b('0x4c'),'context':_0x2c5ca1[_0xc86b('0x6')],'exten':_0x2c5ca1[_0xc86b('0xb')],'priority':_0x416995['intervals'][_0xc86b('0x32')]+_0x3c49be+_0x1b6243++,'VoiceExtensionId':_0x2c5ca1['id']});}_0x416995[_0xc86b('0x4d')]=_0x2a3bb1[_0xc86b('0x32')]?_[_0xc86b('0x4e')](_0x2a3bb1)['priority']+0x1:_0x3c49be;_0x4ea5b7=_[_0xc86b('0x4f')](_0x4ea5b7,_0x2a3bb1,[_0x416995],_0x267cf2);_0x3c49be=_[_0xc86b('0x4e')](_0x4ea5b7)[_0xc86b('0x4d')]+0x1;}return _0xf4b006(_0x4ea5b7);})['catch'](function(_0x59d230){_0xd4e050(_0x59d230);});});}return _0x4c489a[_0xc86b('0x50')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5aa515){var _0x424686=this['get']({'plain':!![]});var _0x3e3a62=_0x424686['type']===_0xc86b('0xf')?_0x5bf48f(_0x424686):_0x18479d(_0x424686);return _0x15ec9f(_0x424686,_0x5aa515,_['last'](_0x3e3a62)['priority']+0x1)[_0xc86b('0x31')](function(_0x3b863e){var _0x48c8ea=_['concat'](_0x3e3a62,_0x3b863e);_0x48c8ea['push']({'type':_0x424686[_0xc86b('0x3')],'app':_0xc86b('0x51'),'exten':_0x424686['exten'],'context':_0x424686[_0xc86b('0x6')],'priority':_[_0xc86b('0x4e')](_0x48c8ea)['priority']+0x1,'VoiceExtensionId':_0x424686['id']});return _0x48c8ea;});}}});}; \ No newline at end of file +var _0xbf3d=['map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','hasOwnProperty','answer','queue','playback','includes','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','define','VoiceExtension','voice_extensions','get','then','lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','context','alias','NoOp','No\x20alias\x20set','exten','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','MONITOR_OPTIONS=ab','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','length','name','param','split','phone','prefix','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','intervals'];(function(_0x24e7c7,_0x31c20b){var _0x4cb840=function(_0x5904f0){while(--_0x5904f0){_0x24e7c7['push'](_0x24e7c7['shift']());}};_0x4cb840(++_0x31c20b);}(_0xbf3d,0xc5));var _0xdbf3=function(_0x156c60,_0x3f5d9f){_0x156c60=_0x156c60-0x0;var _0xb8cc6=_0xbf3d[_0x156c60];return _0xb8cc6;};'use strict';var _=require(_0xdbf3('0x0'));var attributes=require(_0xdbf3('0x1'));module[_0xdbf3('0x2')]=function(_0x1d1acd){var _0x5e0f5e=_0x1d1acd[_0xdbf3('0x3')];function _0x4d2d86(_0x22ff18){var _0x1ae319=0x2;var _0x1bd6fc=[{'type':_0x22ff18['type'],'app':_0xdbf3('0x4'),'appdata':_0xdbf3('0x5')+_0x22ff18[_0xdbf3('0x6')],'context':_0x22ff18[_0xdbf3('0x7')],'exten':_0x22ff18['exten'],'priority':_0x1ae319++,'VoiceExtensionId':_0x22ff18['id']},{'type':_0x22ff18[_0xdbf3('0x6')],'app':_0x22ff18[_0xdbf3('0x8')]?_0xdbf3('0x4'):_0xdbf3('0x9'),'appdata':_0x22ff18[_0xdbf3('0x8')]?'CDR(routeAlias)='+_0x22ff18[_0xdbf3('0x8')]:_0xdbf3('0xa'),'context':_0x22ff18[_0xdbf3('0x7')],'exten':_0x22ff18[_0xdbf3('0xb')],'priority':_0x1ae319++,'VoiceExtensionId':_0x22ff18['id']}];if(_0x22ff18['type']===_0xdbf3('0xc')){_0x1bd6fc['push']({'type':'inbound','app':'Set','appdata':_0xdbf3('0xd')+_0x22ff18['id'],'context':_0x22ff18['context'],'exten':_0x22ff18[_0xdbf3('0xb')],'priority':_0x1ae319++,'VoiceExtensionId':_0x22ff18['id']});}_0x1bd6fc[_0xdbf3('0xe')]({'type':_0x22ff18[_0xdbf3('0x6')],'app':_0xdbf3('0x4'),'appdata':_0xdbf3('0xf'),'context':_0x22ff18[_0xdbf3('0x7')],'exten':_0x22ff18[_0xdbf3('0xb')],'priority':_0x1ae319++,'VoiceExtensionId':_0x22ff18['id']},{'type':_0x22ff18[_0xdbf3('0x6')],'app':_0xdbf3('0x4'),'appdata':_0xdbf3('0x10'),'context':_0x22ff18[_0xdbf3('0x7')],'exten':_0x22ff18['exten'],'priority':_0x1ae319++,'VoiceExtensionId':_0x22ff18['id']},{'type':_0x22ff18[_0xdbf3('0x6')],'app':_0xdbf3('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x22ff18[_0xdbf3('0x7')],'exten':_0x22ff18['exten'],'priority':_0x1ae319++,'VoiceExtensionId':_0x22ff18['id']});return _0x1bd6fc;}function _0x3ffc64(_0x4513fd){var _0x509b63=0x2;var _0x48d39b=[{'type':_0xdbf3('0x11'),'app':'Set','appdata':'CDR(type)=outbound','context':_0x4513fd[_0xdbf3('0x7')],'exten':_0x4513fd[_0xdbf3('0xb')],'priority':_0x509b63++,'VoiceExtensionId':_0x4513fd['id']},{'type':_0xdbf3('0x11'),'app':_0x4513fd[_0xdbf3('0x8')]?_0xdbf3('0x4'):'NoOp','appdata':_0x4513fd[_0xdbf3('0x8')]?_0xdbf3('0x12')+_0x4513fd[_0xdbf3('0x8')]:_0xdbf3('0xa'),'context':_0x4513fd[_0xdbf3('0x7')],'exten':_0x4513fd[_0xdbf3('0xb')],'priority':_0x509b63++,'VoiceExtensionId':_0x4513fd['id']},{'type':'outbound','app':'Set','appdata':_0xdbf3('0x13')+(_0x4513fd[_0xdbf3('0x14')]?_0xdbf3('0x15')+_0x4513fd[_0xdbf3('0x14')]+'}':_0xdbf3('0x16')),'context':_0x4513fd[_0xdbf3('0x7')],'exten':_0x4513fd['exten'],'priority':_0x509b63++,'VoiceExtensionId':_0x4513fd['id']},{'type':_0xdbf3('0x11'),'app':_0xdbf3('0x4'),'appdata':'CDR(routeid)='+_0x4513fd['id'],'context':_0x4513fd[_0xdbf3('0x7')],'exten':_0x4513fd[_0xdbf3('0xb')],'priority':_0x509b63++,'VoiceExtensionId':_0x4513fd['id']},{'type':'outbound','app':_0xdbf3('0x17'),'appdata':_0xdbf3('0x18')+(_0x509b63+0x2)+'):Goto('+(_0x509b63+0x1)+')','context':_0x4513fd[_0xdbf3('0x7')],'exten':_0x4513fd[_0xdbf3('0xb')],'priority':_0x509b63++,'VoiceExtensionId':_0x4513fd['id']},{'type':_0xdbf3('0x11'),'app':_0xdbf3('0x4'),'appdata':_0x4513fd[_0xdbf3('0x14')]?_0xdbf3('0x19')+_0x4513fd['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x4513fd[_0xdbf3('0x7')],'exten':_0x4513fd[_0xdbf3('0xb')],'priority':_0x509b63++,'VoiceExtensionId':_0x4513fd['id']},{'type':'outbound','app':_0xdbf3('0x4'),'appdata':_0xdbf3('0xf'),'context':_0x4513fd['context'],'exten':_0x4513fd[_0xdbf3('0xb')],'priority':_0x509b63++,'VoiceExtensionId':_0x4513fd['id']},{'type':_0xdbf3('0x11'),'app':_0xdbf3('0x4'),'appdata':_0xdbf3('0x10'),'context':_0x4513fd[_0xdbf3('0x7')],'exten':_0x4513fd[_0xdbf3('0xb')],'priority':_0x509b63++,'VoiceExtensionId':_0x4513fd['id']},{'type':_0xdbf3('0x11'),'app':_0xdbf3('0x4'),'appdata':_0xdbf3('0x1a'),'context':_0x4513fd[_0xdbf3('0x7')],'exten':_0x4513fd['exten'],'priority':_0x509b63++,'VoiceExtensionId':_0x4513fd['id']},{'type':_0xdbf3('0x11'),'app':_0xdbf3('0x4'),'appdata':_0xdbf3('0x1b')+_0x4513fd['id'],'context':_0x4513fd[_0xdbf3('0x7')],'exten':_0x4513fd[_0xdbf3('0xb')],'priority':_0x509b63++,'VoiceExtensionId':_0x4513fd['id']}];if(_0x4513fd['hasOwnProperty'](_0xdbf3('0x1c'))&&_0x4513fd[_0xdbf3('0x1c')]!==_0xdbf3('0x1d')){_0x48d39b[_0xdbf3('0xe')]({'type':_0xdbf3('0x11'),'app':_0xdbf3('0x4'),'appdata':_0xdbf3('0x1e'),'context':_0x4513fd[_0xdbf3('0x7')],'exten':_0x4513fd['exten'],'priority':_0x509b63++,'VoiceExtensionId':_0x4513fd['id']},{'type':_0xdbf3('0x11'),'app':_0xdbf3('0x4'),'appdata':_0xdbf3('0x1f')+_0x4513fd[_0xdbf3('0x1c')]||_0xdbf3('0x20'),'context':_0x4513fd[_0xdbf3('0x7')],'exten':_0x4513fd['exten'],'priority':_0x509b63++,'VoiceExtensionId':_0x4513fd['id']});}return _0x48d39b;}function _0x4e986e(_0x28a545,_0x5debb2){var _0x4d476e=[{'name':_0xdbf3('0x21'),'param':0x0},{'name':_0xdbf3('0x22'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x472e14={};var _0x3676ac=_0x5debb2['split'](',');var _0x19de34=[];for(var _0x5409a0=0x0;_0x5409a0<_0x4d476e[_0xdbf3('0x23')];_0x5409a0++){switch(_0x4d476e[_0x5409a0][_0xdbf3('0x24')]){case _0xdbf3('0x21'):_0x472e14[_0xdbf3('0x21')]=_0x3676ac[_0x4d476e[_0x5409a0][_0xdbf3('0x25')]][_0xdbf3('0x26')]('/')[0x1];_0x472e14[_0xdbf3('0x27')]=_0x3676ac[_0x4d476e[_0x5409a0]['param']]['split']('/')[0x2];_0x472e14[_0xdbf3('0x28')]=_0x472e14[_0xdbf3('0x27')]?_0x472e14[_0xdbf3('0x27')][_0xdbf3('0x26')]('$')[0x0]:undefined;_0x472e14[_0xdbf3('0x27')]=_0x28a545[_0xdbf3('0x14')]?(_0x472e14[_0xdbf3('0x28')]||'')+'${EXTEN:'+_0x28a545['cutdigits']+'}':(_0x472e14['prefix']||'')+_0xdbf3('0x16');_0x19de34[_0x4d476e[_0x5409a0][_0xdbf3('0x25')]]=[_0xdbf3('0x29'),_0x472e14['trunk'],_0x472e14[_0xdbf3('0x27')]][_0xdbf3('0x2a')]('/');break;case'options':_0x472e14[_0xdbf3('0x2b')]=_0x3676ac[_0x4d476e[_0x5409a0]['param']];if(_0x28a545[_0xdbf3('0x1c')]!==_0xdbf3('0x1d')){if(_0x472e14[_0xdbf3('0x2b')][_0xdbf3('0x2c')](_0xdbf3('0x2d'))<0x0){_0x472e14[_0xdbf3('0x2b')]+=_0xdbf3('0x2d');}}else{_0x472e14[_0xdbf3('0x2b')]=_0x472e14[_0xdbf3('0x2b')][_0xdbf3('0x2e')](_0xdbf3('0x2d'),'');}_0x19de34[_0x4d476e[_0x5409a0][_0xdbf3('0x25')]]=_0x472e14[_0xdbf3('0x2b')];break;default:_0x19de34[_0x4d476e[_0x5409a0][_0xdbf3('0x25')]]=_0x3676ac[_0x4d476e[_0x5409a0][_0xdbf3('0x25')]];}}return _0x19de34[_0xdbf3('0x2a')](',');}function _0x5a2a07(_0xae8f40,_0x12c705,_0x5ef7c6){return new Promise(function(_0x58c492,_0x56c440){var _0xafb13c=[];if(_[_0xdbf3('0x2f')](_0x12c705))return _0x58c492(_0xafb13c);_0x5e0f5e['Interval'][_0xdbf3('0x30')]({'attributes':['id',_0xdbf3('0x31'),_0xdbf3('0x32')],'raw':!![]})['then'](function(_0x44f98a){for(var _0x5cb2b7=0x0,_0x371c20=0x0;_0x5cb2b7<_0x12c705[_0xdbf3('0x23')];_0x5cb2b7++,_0x371c20=0x0){var _0x3f4a89=_0x12c705[_0x5cb2b7];var _0x444093=[];var _0x249102=[];delete _0x3f4a89['id'];if(_0x3f4a89[_0xdbf3('0x31')]!=='*,*,*,*'){_0x3f4a89[_0xdbf3('0x33')]=[_0x3f4a89[_0xdbf3('0x31')]];}else{_0x3f4a89[_0xdbf3('0x33')]=_0x3f4a89[_0xdbf3('0x32')]?_[_0xdbf3('0x34')](_[_0xdbf3('0x35')](_0x44f98a,{'IntervalId':_0x3f4a89[_0xdbf3('0x32')]}),_0xdbf3('0x31')):[];}_0x3f4a89[_0xdbf3('0x7')]=_0xae8f40['context'];_0x3f4a89[_0xdbf3('0xb')]=_0xae8f40[_0xdbf3('0xb')];if(_0x3f4a89[_0xdbf3('0x6')])_0x3f4a89[_0xdbf3('0x6')]=_0x3f4a89[_0xdbf3('0x6')][_0xdbf3('0x36')]();if(_0xae8f40[_0xdbf3('0x6')]===_0xdbf3('0x11')){if(_0x3f4a89['hasOwnProperty'](_0xdbf3('0x37'))&&_0x3f4a89['tag']&&_0x3f4a89[_0xdbf3('0x37')]!=='--'){_0x444093[_0xdbf3('0xe')]({'type':_0x3f4a89[_0xdbf3('0x6')][_0xdbf3('0x36')](),'app':_0xdbf3('0x4'),'appdata':_0xdbf3('0x38')+_0x3f4a89[_0xdbf3('0x37')],'context':_0xae8f40[_0xdbf3('0x7')],'exten':_0xae8f40[_0xdbf3('0xb')],'priority':_0x3f4a89[_0xdbf3('0x33')][_0xdbf3('0x23')]+_0x5ef7c6+_0x371c20++,'VoiceExtensionId':_0xae8f40['id']});}_0x444093['push']({'type':_0x3f4a89[_0xdbf3('0x6')][_0xdbf3('0x36')](),'app':_0xdbf3('0x17'),'appdata':_0xdbf3('0x39')+(_0x3f4a89[_0xdbf3('0x3a')]?_0xdbf3('0x3b')+_0x3f4a89[_0xdbf3('0x3a')]+')':_0xdbf3('0x3c')),'context':_0xae8f40['context'],'exten':_0xae8f40[_0xdbf3('0xb')],'priority':_0x3f4a89['intervals'][_0xdbf3('0x23')]+_0x5ef7c6+_0x371c20++,'VoiceExtensionId':_0xae8f40['id']});}else{if(_0x3f4a89[_0xdbf3('0x3d')](_0xdbf3('0x3e'))){if([_0xdbf3('0x3f'),_0xdbf3('0x40')][_0xdbf3('0x41')](_0x3f4a89['app']['toLowerCase']())&&_0x3f4a89['appType']!=='custom'){if(_0x3f4a89['answer']){_0x444093[_0xdbf3('0xe')]({'type':_0x3f4a89[_0xdbf3('0x6')]['toLowerCase'](),'app':_0xdbf3('0x17'),'appdata':_0xdbf3('0x42'),'context':_0xae8f40['context'],'exten':_0xae8f40[_0xdbf3('0xb')],'priority':_0x3f4a89[_0xdbf3('0x33')][_0xdbf3('0x23')]+_0x5ef7c6+_0x371c20++,'VoiceExtensionId':_0xae8f40['id']});_0x444093['push']({'type':_0x3f4a89[_0xdbf3('0x6')]['toLowerCase'](),'app':_0xdbf3('0x4'),'appdata':_0xdbf3('0x43'),'context':_0xae8f40[_0xdbf3('0x7')],'exten':_0xae8f40['exten'],'priority':_0x3f4a89[_0xdbf3('0x33')][_0xdbf3('0x23')]+_0x5ef7c6+_0x371c20++,'VoiceExtensionId':_0xae8f40['id']});}else{_0x444093['push']({'type':_0x3f4a89['type'][_0xdbf3('0x36')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0xae8f40[_0xdbf3('0x7')],'exten':_0xae8f40['exten'],'priority':_0x3f4a89['intervals'][_0xdbf3('0x23')]+_0x5ef7c6+_0x371c20++,'VoiceExtensionId':_0xae8f40['id']});_0x444093[_0xdbf3('0xe')]({'type':_0x3f4a89[_0xdbf3('0x6')][_0xdbf3('0x36')](),'app':_0xdbf3('0x4'),'appdata':_0xdbf3('0x44'),'context':_0xae8f40['context'],'exten':_0xae8f40['exten'],'priority':_0x3f4a89[_0xdbf3('0x33')]['length']+_0x5ef7c6+_0x371c20++,'VoiceExtensionId':_0xae8f40['id']});}}}}for(var _0x1a098f=0x0;_0x1a098f<_0x3f4a89['intervals'][_0xdbf3('0x23')];_0x1a098f++){var _0x338312=_0x5ef7c6+_0x3f4a89[_0xdbf3('0x33')]['length'];var _0x5861ec=_0x1a098f===_0x3f4a89[_0xdbf3('0x33')][_0xdbf3('0x23')]-0x1?_0x5ef7c6+_0x444093['length']+_0x249102[_0xdbf3('0x23')]+0x2:_0x5ef7c6+_0x1a098f+0x1;_0x444093['splice'](_0x1a098f,0x0,{'type':_0xae8f40[_0xdbf3('0x6')],'app':_0xdbf3('0x45'),'appdata':_0x3f4a89[_0xdbf3('0x33')][_0x1a098f]+'?'+_0xae8f40[_0xdbf3('0x7')]+_0xdbf3('0x46')+_0x338312+':'+_0xae8f40[_0xdbf3('0x7')]+_0xdbf3('0x46')+_0x5861ec,'exten':_0xae8f40[_0xdbf3('0xb')],'context':_0xae8f40['context'],'priority':_0x5ef7c6+_0x1a098f,'VoiceExtensionId':_0xae8f40['id']});}if(_0x3f4a89[_0xdbf3('0x47')]==='outboundDial'){_0x3f4a89[_0xdbf3('0x48')]=_0x4e986e(_0xae8f40,_0x3f4a89[_0xdbf3('0x48')]);}if(_0x3f4a89[_0xdbf3('0x47')]===_0xdbf3('0x49')){_0x444093['push']({'type':_0x3f4a89[_0xdbf3('0x6')][_0xdbf3('0x36')](),'app':_0xdbf3('0x4'),'appdata':_0xdbf3('0x4a'),'context':_0xae8f40[_0xdbf3('0x7')],'exten':_0xae8f40[_0xdbf3('0xb')],'priority':_0x3f4a89[_0xdbf3('0x33')]['length']+_0x5ef7c6+_0x371c20++,'VoiceExtensionId':_0xae8f40['id']});}_0x3f4a89[_0xdbf3('0x4b')]=_0x444093[_0xdbf3('0x23')]?_[_0xdbf3('0x4c')](_0x444093)[_0xdbf3('0x4b')]+0x1:_0x5ef7c6;_0xafb13c=_[_0xdbf3('0x4d')](_0xafb13c,_0x444093,[_0x3f4a89],_0x249102);_0x5ef7c6=_[_0xdbf3('0x4c')](_0xafb13c)['priority']+0x1;}return _0x58c492(_0xafb13c);})['catch'](function(_0x40eddf){_0x56c440(_0x40eddf);});});}return _0x1d1acd[_0xdbf3('0x4e')](_0xdbf3('0x4f'),attributes,{'tableName':_0xdbf3('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x44bada){var _0x204fe9=this[_0xdbf3('0x51')]({'plain':!![]});var _0x23f459=_0x204fe9[_0xdbf3('0x6')]===_0xdbf3('0x11')?_0x3ffc64(_0x204fe9):_0x4d2d86(_0x204fe9);return _0x5a2a07(_0x204fe9,_0x44bada,_[_0xdbf3('0x4c')](_0x23f459)[_0xdbf3('0x4b')]+0x1)[_0xdbf3('0x52')](function(_0x2a74b7){var _0x1be831=_[_0xdbf3('0x4d')](_0x23f459,_0x2a74b7);_0x1be831[_0xdbf3('0xe')]({'type':_0x204fe9[_0xdbf3('0x6')],'app':'Hangup','exten':_0x204fe9[_0xdbf3('0xb')],'context':_0x204fe9[_0xdbf3('0x7')],'priority':_[_0xdbf3('0x4c')](_0x1be831)['priority']+0x1,'VoiceExtensionId':_0x204fe9['id']});return _0x1be831;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index a514063..a375ca3 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 _0x01db=['bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','lodash'];(function(_0x24cdbe,_0x40e64c){var _0x1acb3b=function(_0x40d061){while(--_0x40d061){_0x24cdbe['push'](_0x24cdbe['shift']());}};_0x1acb3b(++_0x40e64c);}(_0x01db,0x171));var _0xb01d=function(_0x31884c,_0x262b99){_0x31884c=_0x31884c-0x0;var _0x599a77=_0x01db[_0x31884c];return _0x599a77;};'use strict';var _=require(_0xb01d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb01d('0x1'));var rs=require(_0xb01d('0x2'));var fs=require('fs');var Redis=require(_0xb01d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb01d('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb01d('0x5'));var jayson=require(_0xb01d('0x6'));var client=jayson[_0xb01d('0x7')][_0xb01d('0x8')]({'port':0x232a});config[_0xb01d('0x9')]=_[_0xb01d('0xa')](config[_0xb01d('0x9')],{'host':_0xb01d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb01d('0xc'))[_0xb01d('0xd')](socket);function respondWithRpcPromise(_0x28e0fc,_0x3b2de4,_0x147b7b){return new BPromise(function(_0x9112c1,_0x4eb866){return client['request'](_0x28e0fc,_0x147b7b)[_0xb01d('0xe')](function(_0x1b59b9){logger[_0xb01d('0xf')](_0xb01d('0x10'),_0x3b2de4,_0xb01d('0x11'));logger[_0xb01d('0x12')](_0xb01d('0x13'),_0x3b2de4,'request\x20sent',JSON['stringify'](_0x1b59b9));if(_0x1b59b9[_0xb01d('0x14')]){if(_0x1b59b9['error'][_0xb01d('0x15')]===0x1f4){logger[_0xb01d('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x3b2de4,_0x1b59b9[_0xb01d('0x14')][_0xb01d('0x16')]);return _0x4eb866(_0x1b59b9[_0xb01d('0x14')][_0xb01d('0x16')]);}logger['error'](_0xb01d('0x10'),_0x3b2de4,_0x1b59b9['error'][_0xb01d('0x16')]);return _0x9112c1(_0x1b59b9[_0xb01d('0x14')][_0xb01d('0x16')]);}else{logger[_0xb01d('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x3b2de4,_0xb01d('0x11'));_0x9112c1(_0x1b59b9[_0xb01d('0x17')][_0xb01d('0x16')]);}})['catch'](function(_0x210023){logger['error'](_0xb01d('0x10'),_0x3b2de4,_0x210023);_0x4eb866(_0x210023);});});}exports[_0xb01d('0x18')]=function(_0x3e96ef){var _0x28a6a7=this;return new Promise(function(_0x3d5c9d,_0x4d517e){return db[_0xb01d('0x19')][_0xb01d('0x1a')]({'raw':_0x3e96ef[_0xb01d('0x1b')]?_0x3e96ef[_0xb01d('0x1b')][_0xb01d('0x1c')]===undefined?!![]:![]:!![],'where':_0x3e96ef[_0xb01d('0x1b')]?_0x3e96ef[_0xb01d('0x1b')][_0xb01d('0x1d')]||null:null,'attributes':_0x3e96ef[_0xb01d('0x1b')]?_0x3e96ef[_0xb01d('0x1b')][_0xb01d('0x1e')]||null:null,'limit':_0x3e96ef[_0xb01d('0x1b')]?_0x3e96ef['options'][_0xb01d('0x1f')]||null:null,'include':_0x3e96ef['options']?_0x3e96ef[_0xb01d('0x1b')][_0xb01d('0x20')]?_[_0xb01d('0x21')](_0x3e96ef[_0xb01d('0x1b')][_0xb01d('0x20')],function(_0x1d8f04){return{'model':db[_0x1d8f04[_0xb01d('0x22')]],'as':_0x1d8f04['as'],'attributes':_0x1d8f04[_0xb01d('0x1e')],'include':_0x1d8f04[_0xb01d('0x20')]?_[_0xb01d('0x21')](_0x1d8f04[_0xb01d('0x20')],function(_0x531d37){return{'model':db[_0x531d37[_0xb01d('0x22')]],'as':_0x531d37['as'],'attributes':_0x531d37[_0xb01d('0x1e')],'include':_0x531d37[_0xb01d('0x20')]?_['map'](_0x531d37[_0xb01d('0x20')],function(_0x1bd8d2){return{'model':db[_0x1bd8d2[_0xb01d('0x22')]],'as':_0x1bd8d2['as'],'attributes':_0x1bd8d2['attributes']};}):[]};}):[]};}):[]:[]})[_0xb01d('0xe')](function(_0x5007d1){logger[_0xb01d('0xf')](_0xb01d('0x18'),_0x3e96ef);logger[_0xb01d('0x12')]('GetVoiceExtension',_0x3e96ef,JSON[_0xb01d('0x23')](_0x5007d1));_0x3d5c9d(_0x5007d1);})[_0xb01d('0x24')](function(_0x1666a1){logger[_0xb01d('0x14')](_0xb01d('0x18'),_0x1666a1[_0xb01d('0x16')],_0x3e96ef);_0x4d517e(_0x28a6a7['error'](0x1f4,_0x1666a1[_0xb01d('0x16')]));});});}; \ No newline at end of file +var _0xf494=['localhost','socket.io-emitter','./voiceExtension.socket','register','request','request\x20sent','debug','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','info','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit','include','map','model','then','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3a0f09,_0x4f981b){var _0x46c463=function(_0x478914){while(--_0x478914){_0x3a0f09['push'](_0x3a0f09['shift']());}};_0x46c463(++_0x4f981b);}(_0xf494,0x1c6));var _0x4f49=function(_0x3a9ab0,_0x3912fe){_0x3a9ab0=_0x3a9ab0-0x0;var _0x33c9ed=_0xf494[_0x3a9ab0];return _0x33c9ed;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});config[_0x4f49('0xd')]=_['defaults'](config['redis'],{'host':_0x4f49('0xe'),'port':0x18eb});var socket=require(_0x4f49('0xf'))(new Redis(config[_0x4f49('0xd')]));require(_0x4f49('0x10'))[_0x4f49('0x11')](socket);function respondWithRpcPromise(_0x174d0d,_0x151d8c,_0x410884){return new BPromise(function(_0x53ee74,_0x3e464f){return client[_0x4f49('0x12')](_0x174d0d,_0x410884)['then'](function(_0x15e7a1){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x151d8c,_0x4f49('0x13'));logger[_0x4f49('0x14')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x151d8c,_0x4f49('0x13'),JSON[_0x4f49('0x15')](_0x15e7a1));if(_0x15e7a1[_0x4f49('0x16')]){if(_0x15e7a1[_0x4f49('0x16')][_0x4f49('0x17')]===0x1f4){logger[_0x4f49('0x16')](_0x4f49('0x18'),_0x151d8c,_0x15e7a1['error'][_0x4f49('0x19')]);return _0x3e464f(_0x15e7a1[_0x4f49('0x16')][_0x4f49('0x19')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x151d8c,_0x15e7a1[_0x4f49('0x16')][_0x4f49('0x19')]);return _0x53ee74(_0x15e7a1[_0x4f49('0x16')]['message']);}else{logger[_0x4f49('0x1a')](_0x4f49('0x18'),_0x151d8c,_0x4f49('0x13'));_0x53ee74(_0x15e7a1['result']['message']);}})['catch'](function(_0x47f1e8){logger[_0x4f49('0x16')](_0x4f49('0x18'),_0x151d8c,_0x47f1e8);_0x3e464f(_0x47f1e8);});});}exports[_0x4f49('0x1b')]=function(_0x407042){var _0x5793ac=this;return new Promise(function(_0x416893,_0x2aed27){return db[_0x4f49('0x1c')][_0x4f49('0x1d')]({'raw':_0x407042[_0x4f49('0x1e')]?_0x407042['options'][_0x4f49('0x1f')]===undefined?!![]:![]:!![],'where':_0x407042[_0x4f49('0x1e')]?_0x407042[_0x4f49('0x1e')]['where']||null:null,'attributes':_0x407042[_0x4f49('0x1e')]?_0x407042[_0x4f49('0x1e')][_0x4f49('0x20')]||null:null,'limit':_0x407042[_0x4f49('0x1e')]?_0x407042[_0x4f49('0x1e')][_0x4f49('0x21')]||null:null,'include':_0x407042['options']?_0x407042['options'][_0x4f49('0x22')]?_[_0x4f49('0x23')](_0x407042['options'][_0x4f49('0x22')],function(_0x2c1519){return{'model':db[_0x2c1519[_0x4f49('0x24')]],'as':_0x2c1519['as'],'attributes':_0x2c1519['attributes'],'include':_0x2c1519[_0x4f49('0x22')]?_[_0x4f49('0x23')](_0x2c1519[_0x4f49('0x22')],function(_0x148153){return{'model':db[_0x148153[_0x4f49('0x24')]],'as':_0x148153['as'],'attributes':_0x148153[_0x4f49('0x20')],'include':_0x148153['include']?_['map'](_0x148153[_0x4f49('0x22')],function(_0x2c00ee){return{'model':db[_0x2c00ee[_0x4f49('0x24')]],'as':_0x2c00ee['as'],'attributes':_0x2c00ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f49('0x25')](function(_0x206203){logger[_0x4f49('0x1a')]('GetVoiceExtension',_0x407042);logger['debug'](_0x4f49('0x1b'),_0x407042,JSON[_0x4f49('0x15')](_0x206203));_0x416893(_0x206203);})[_0x4f49('0x26')](function(_0x5e7076){logger[_0x4f49('0x16')](_0x4f49('0x1b'),_0x5e7076[_0x4f49('0x19')],_0x407042);_0x2aed27(_0x5793ac[_0x4f49('0x16')](0x1f4,_0x5e7076[_0x4f49('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 3c058cf..b02e667 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 _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x34b900,_0x4aa26e){var _0x5bb0eb=function(_0x42e72b){while(--_0x42e72b){_0x34b900['push'](_0x34b900['shift']());}};_0x5bb0eb(++_0x4aa26e);}(_0xf494,0x1c6));var _0x4f49=function(_0x3e8621,_0x55a594){_0x3e8621=_0x3e8621-0x0;var _0x268322=_0xf494[_0x3e8621];return _0x268322;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x5a47cb,_0x407588){var _0x4ad480=function(_0x58d685){while(--_0x58d685){_0x5a47cb['push'](_0x5a47cb['shift']());}};_0x4ad480(++_0x407588);}(_0x326f,0xd1));var _0xf326=function(_0x20ec4d,_0x18e3f0){_0x20ec4d=_0x20ec4d-0x0;var _0x33ad65=_0x326f[_0x20ec4d];return _0x33ad65;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index c3014e3..4cf5b19 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 _0x7278=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x9eaf5f,_0x382b4a){var _0x1650a8=function(_0x5b71d1){while(--_0x5b71d1){_0x9eaf5f['push'](_0x9eaf5f['shift']());}};_0x1650a8(++_0x382b4a);}(_0x7278,0x161));var _0x8727=function(_0x3bfa5e,_0x50fa7f){_0x3bfa5e=_0x3bfa5e-0x0;var _0x1e16e8=_0x7278[_0x3bfa5e];return _0x1e16e8;};'use strict';var multer=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var path=require(_0x8727('0x2'));var timeout=require(_0x8727('0x3'));var express=require(_0x8727('0x4'));var router=express['Router']();var fs_extra=require(_0x8727('0x5'));var auth=require(_0x8727('0x6'));var interaction=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var controller=require(_0x8727('0x9'));router[_0x8727('0xa')]('/',auth[_0x8727('0xb')](),controller['index']);router[_0x8727('0xa')](_0x8727('0xc'),auth[_0x8727('0xb')](),controller[_0x8727('0xd')]);router[_0x8727('0xa')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x8727('0xe')]('/',auth[_0x8727('0xb')](),controller[_0x8727('0xf')]);router[_0x8727('0x10')](_0x8727('0xc'),auth[_0x8727('0xb')](),controller[_0x8727('0x11')]);router[_0x8727('0x12')]('/:id',auth[_0x8727('0xb')](),controller[_0x8727('0x13')]);module[_0x8727('0x14')]=router; \ No newline at end of file +var _0x81c6=['isAuthenticated','/:id','/:id/messages','put','update','destroy','exports','util','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x81c6,0x1d5));var _0x681c=function(_0x4581cb,_0x166469){_0x4581cb=_0x4581cb-0x0;var _0x11593f=_0x81c6[_0x4581cb];return _0x11593f;};'use strict';var multer=require('multer');var util=require(_0x681c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x681c('0x1')]();var fs_extra=require(_0x681c('0x2'));var auth=require(_0x681c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x681c('0x4'));var controller=require(_0x681c('0x5'));router[_0x681c('0x6')]('/',auth[_0x681c('0x7')](),controller['index']);router[_0x681c('0x6')](_0x681c('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x681c('0x6')](_0x681c('0x9'),auth[_0x681c('0x7')](),controller['getMessages']);router['post']('/',auth[_0x681c('0x7')](),controller['create']);router[_0x681c('0xa')](_0x681c('0x8'),auth[_0x681c('0x7')](),controller[_0x681c('0xb')]);router['delete']('/:id',auth[_0x681c('0x7')](),controller[_0x681c('0xc')]);module[_0x681c('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 92c5867..ca0bb9f 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 _0x92ef=['sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','INTEGER','VIRTUAL','fullname','\x20-\x20','mailbox'];(function(_0x4f2c5b,_0xc53733){var _0xb8fa1f=function(_0x3d60f1){while(--_0x3d60f1){_0x4f2c5b['push'](_0x4f2c5b['shift']());}};_0xb8fa1f(++_0xc53733);}(_0x92ef,0x120));var _0xf92e=function(_0x39d610,_0x49e817){_0x39d610=_0x39d610-0x0;var _0x3e6afb=_0x92ef[_0x39d610];return _0x3e6afb;};'use strict';var Sequelize=require(_0xf92e('0x0'));module[_0xf92e('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf92e('0x2')],'defaultValue':_0xf92e('0x3'),'unique':_0xf92e('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xf92e('0x2')]},'fullname':{'type':Sequelize[_0xf92e('0x2')]},'email':{'type':Sequelize[_0xf92e('0x2')],'validate':{'isEmail':!![]},'set':function(_0x5c6fff){this[_0xf92e('0x5')](_0xf92e('0x6'),typeof _0x5c6fff==='string'&&_0x5c6fff[_0xf92e('0x7')]()?_0x5c6fff['trim']():null);}},'pager':{'type':Sequelize[_0xf92e('0x2')]},'tz':{'type':Sequelize[_0xf92e('0x2')],'defaultValue':_0xf92e('0x8')},'attach':{'type':Sequelize[_0xf92e('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xf92e('0x9')](_0xf92e('0xa'),'no'),'defaultValue':_0xf92e('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xf92e('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xf92e('0x9')](_0xf92e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xf92e('0x9')](_0xf92e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf92e('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf92e('0x9')](_0xf92e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf92e('0x9')](_0xf92e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xf92e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf92e('0x9')](_0xf92e('0xa'),'no'),'defaultValue':_0xf92e('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xf92e('0x9')](_0xf92e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf92e('0x9')](_0xf92e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf92e('0x9')](_0xf92e('0xa'),'no'),'defaultValue':_0xf92e('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xf92e('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf92e('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf92e('0xc')],'get':function(){return this['getDataValue'](_0xf92e('0xd'))+_0xf92e('0xe')+this['getDataValue'](_0xf92e('0xf'));}}}; \ No newline at end of file +var _0xd909=['TIMESTAMP','VIRTUAL','\x20-\x20','getDataValue','mailbox','exports','STRING','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)'];(function(_0x28d0de,_0x57e1b5){var _0x53908e=function(_0x1a2b49){while(--_0x1a2b49){_0x28d0de['push'](_0x28d0de['shift']());}};_0x53908e(++_0x57e1b5);}(_0xd909,0xe5));var _0x9d90=function(_0x2e4520,_0x2b1836){_0x2e4520=_0x2e4520-0x0;var _0x3d8d75=_0xd909[_0x2e4520];return _0x3d8d75;};'use strict';var Sequelize=require('sequelize');module[_0x9d90('0x0')]={'customer_id':{'type':Sequelize[_0x9d90('0x1')]},'context':{'type':Sequelize[_0x9d90('0x1')],'defaultValue':'from-voicemail','unique':_0x9d90('0x2')},'mailbox':{'type':Sequelize[_0x9d90('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x9d90('0x1')]},'email':{'type':Sequelize[_0x9d90('0x1')],'validate':{'isEmail':!![]},'set':function(_0x4456da){this[_0x9d90('0x3')](_0x9d90('0x4'),typeof _0x4456da===_0x9d90('0x5')&&_0x4456da[_0x9d90('0x6')]()?_0x4456da[_0x9d90('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x9d90('0x1')],'defaultValue':_0x9d90('0x7')},'attach':{'type':Sequelize[_0x9d90('0x8')](_0x9d90('0x9'),'no'),'defaultValue':_0x9d90('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x9d90('0x8')]('yes','no'),'defaultValue':_0x9d90('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x9d90('0x1')]},'callback':{'type':Sequelize[_0x9d90('0x1')]},'review':{'type':Sequelize[_0x9d90('0x8')](_0x9d90('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x9d90('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x9d90('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9d90('0x8')](_0x9d90('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x9d90('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9d90('0x8')](_0x9d90('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9d90('0x8')](_0x9d90('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9d90('0x8')]('yes','no'),'defaultValue':_0x9d90('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x9d90('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x9d90('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x9d90('0x9'),'no'),'defaultValue':_0x9d90('0x9'),'allowNull':![]},'stamp':{'type':_0x9d90('0xb')},'emailsubject':{'type':Sequelize[_0x9d90('0x1')]},'emailbody':{'type':Sequelize[_0x9d90('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9d90('0xc')],'get':function(){return this['getDataValue']('fullname')+_0x9d90('0xd')+this[_0x9d90('0xe')](_0x9d90('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index cffe3fc..66ebd41 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 _0x0abf=['Content-Range','apply','reject','save','update','then','get','Voicemails','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','model','keys','query','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','map','type','VIRTUAL','merge','options','VoiceMail','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','destroy','getMessages','findOne','VoiceMailMessage','hasOwnProperty','order','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x43b153,_0x328623){var _0xe8c123=function(_0x91921d){while(--_0x91921d){_0x43b153['push'](_0x43b153['shift']());}};_0xe8c123(++_0x328623);}(_0x0abf,0xe8));var _0xf0ab=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0abf[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var licenseUtil=require(_0xf0ab('0x15'));var db=require(_0xf0ab('0x16'))['db'];function respondWithStatusCode(_0x38ca67,_0x34ccdc){_0x34ccdc=_0x34ccdc||0xcc;return function(_0x4fdd5f){if(_0x4fdd5f){return _0x38ca67[_0xf0ab('0x17')](_0x34ccdc);}return _0x38ca67[_0xf0ab('0x18')](_0x34ccdc)[_0xf0ab('0x19')]();};}function respondWithResult(_0x35c75f,_0x1824ef){_0x1824ef=_0x1824ef||0xc8;return function(_0x36cabe){if(_0x36cabe){return _0x35c75f[_0xf0ab('0x18')](_0x1824ef)[_0xf0ab('0x1a')](_0x36cabe);}};}function respondWithFilteredResult(_0x180d0b,_0x3c5bfd){return function(_0x20f453){if(_0x20f453){var _0x221bac=typeof _0x3c5bfd[_0xf0ab('0x1b')]===_0xf0ab('0x1c')&&typeof _0x3c5bfd[_0xf0ab('0x1d')]==='undefined';var _0x457465=_0x20f453[_0xf0ab('0x1e')];var _0x1803f0=_0x221bac?0x0:_0x3c5bfd[_0xf0ab('0x1b')];var _0x776619=_0x221bac?_0x20f453[_0xf0ab('0x1e')]:_0x3c5bfd[_0xf0ab('0x1b')]+_0x3c5bfd[_0xf0ab('0x1d')];var _0x1713d6;if(_0x776619>=_0x457465){_0x776619=_0x457465;_0x1713d6=0xc8;}else{_0x1713d6=0xce;}_0x180d0b[_0xf0ab('0x18')](_0x1713d6);return _0x180d0b[_0xf0ab('0x1f')](_0xf0ab('0x20'),_0x1803f0+'-'+_0x776619+'/'+_0x457465)[_0xf0ab('0x1a')](_0x20f453);}return null;};}function patchUpdates(_0x22a205){return function(_0x2cd961){try{jsonpatch[_0xf0ab('0x21')](_0x2cd961,_0x22a205,!![]);}catch(_0x537673){return BPromise[_0xf0ab('0x22')](_0x537673);}return _0x2cd961[_0xf0ab('0x23')]();};}function saveUpdates(_0x1e1483,_0x11ab3a){return function(_0x3bf6a1){if(_0x3bf6a1){return _0x3bf6a1[_0xf0ab('0x24')](_0x1e1483)[_0xf0ab('0x25')](function(_0x20140b){return _0x20140b;});}return null;};}function removeEntity(_0x36ad01,_0x18bb37){return function(_0x43119f){if(_0x43119f){return _0x43119f['destroy']()['then'](function(){var _0x4eee21=_0x43119f[_0xf0ab('0x26')]({'plain':!![]});var _0x4f0caf=_0xf0ab('0x27');return db[_0xf0ab('0x28')]['destroy']({'where':{'type':_0x4f0caf,'resourceId':_0x4eee21['id']}})[_0xf0ab('0x25')](function(){return _0x43119f;});})[_0xf0ab('0x25')](function(){_0x36ad01[_0xf0ab('0x18')](0xcc)[_0xf0ab('0x19')]();});}};}function handleEntityNotFound(_0x7d4ff9,_0x502921){return function(_0x2d0da7){if(!_0x2d0da7){_0x7d4ff9['sendStatus'](0x194);}return _0x2d0da7;};}function handleError(_0x55d799,_0x1dcd2e){_0x1dcd2e=_0x1dcd2e||0x1f4;return function(_0x4306c6){logger[_0xf0ab('0x29')](_0x4306c6[_0xf0ab('0x2a')]);if(_0x4306c6[_0xf0ab('0x2b')]){delete _0x4306c6[_0xf0ab('0x2b')];}_0x55d799[_0xf0ab('0x18')](_0x1dcd2e)[_0xf0ab('0x2c')](_0x4306c6);};}exports[_0xf0ab('0x2d')]=function(_0x2f0fcd,_0x21e8ac){var _0x199753={},_0x58cbe1={},_0x1e1ffb={'count':0x0,'rows':[]};var _0x35973a=_['map'](db['VoiceMail'][_0xf0ab('0x2e')],function(_0x1dc84e){return{'name':_0x1dc84e[_0xf0ab('0x2f')],'type':_0x1dc84e['type']['key']};});_0x58cbe1[_0xf0ab('0x30')]=_['map'](_0x35973a,_0xf0ab('0x2b'));_0x58cbe1['query']=_[_0xf0ab('0x31')](_0x2f0fcd[_0xf0ab('0x32')]);_0x58cbe1['filters']=_['intersection'](_0x58cbe1[_0xf0ab('0x30')],_0x58cbe1[_0xf0ab('0x32')]);_0x199753[_0xf0ab('0x33')]=_[_0xf0ab('0x34')](_0x58cbe1[_0xf0ab('0x30')],qs[_0xf0ab('0x35')](_0x2f0fcd[_0xf0ab('0x32')][_0xf0ab('0x35')]));_0x199753[_0xf0ab('0x33')]=_0x199753[_0xf0ab('0x33')][_0xf0ab('0x36')]?_0x199753[_0xf0ab('0x33')]:_0x58cbe1[_0xf0ab('0x30')];if(!_0x2f0fcd[_0xf0ab('0x32')]['hasOwnProperty'](_0xf0ab('0x37'))){_0x199753[_0xf0ab('0x1d')]=qs[_0xf0ab('0x1d')](_0x2f0fcd['query'][_0xf0ab('0x1d')]);_0x199753[_0xf0ab('0x1b')]=qs[_0xf0ab('0x1b')](_0x2f0fcd['query'][_0xf0ab('0x1b')]);}_0x199753['order']=qs[_0xf0ab('0x38')](_0x2f0fcd['query'][_0xf0ab('0x38')]);_0x199753[_0xf0ab('0x39')]=qs[_0xf0ab('0x3a')](_[_0xf0ab('0x3b')](_0x2f0fcd[_0xf0ab('0x32')],_0x58cbe1[_0xf0ab('0x3a')]),_0x35973a);if(_0x2f0fcd['query'][_0xf0ab('0x3c')]){_0x199753[_0xf0ab('0x39')]=_['merge'](_0x199753[_0xf0ab('0x39')],{'$or':_[_0xf0ab('0x3d')](_0x35973a,function(_0x1d4eec){if(_0x1d4eec[_0xf0ab('0x3e')]!==_0xf0ab('0x3f')){var _0x11e3b7={};_0x11e3b7[_0x1d4eec[_0xf0ab('0x2b')]]={'$like':'%'+_0x2f0fcd['query'][_0xf0ab('0x3c')]+'%'};return _0x11e3b7;}})});}_0x199753=_[_0xf0ab('0x40')]({},_0x199753,_0x2f0fcd[_0xf0ab('0x41')]);var _0x4bd6d1={'where':_0x199753[_0xf0ab('0x39')]};return db[_0xf0ab('0x42')][_0xf0ab('0x1e')](_0x4bd6d1)[_0xf0ab('0x25')](function(_0x2b7ed5){_0x1e1ffb['count']=_0x2b7ed5;if(_0x2f0fcd[_0xf0ab('0x32')][_0xf0ab('0x43')]){_0x199753[_0xf0ab('0x44')]=[{'all':!![]}];}return db[_0xf0ab('0x42')][_0xf0ab('0x45')](_0x199753);})[_0xf0ab('0x25')](function(_0x45849c){_0x1e1ffb[_0xf0ab('0x46')]=_0x45849c;return _0x1e1ffb;})[_0xf0ab('0x25')](respondWithFilteredResult(_0x21e8ac,_0x199753))[_0xf0ab('0x47')](handleError(_0x21e8ac,null));};exports[_0xf0ab('0x48')]=function(_0x32ec93,_0x22a265){var _0x5e6b6b={'raw':!![],'where':{'id':_0x32ec93[_0xf0ab('0x49')]['id']}},_0x4c4ab9={};_0x4c4ab9['model']=_[_0xf0ab('0x31')](db[_0xf0ab('0x42')]['rawAttributes']);_0x4c4ab9[_0xf0ab('0x32')]=_[_0xf0ab('0x31')](_0x32ec93['query']);_0x4c4ab9[_0xf0ab('0x3a')]=_[_0xf0ab('0x34')](_0x4c4ab9[_0xf0ab('0x30')],_0x4c4ab9[_0xf0ab('0x32')]);_0x5e6b6b[_0xf0ab('0x33')]=_[_0xf0ab('0x34')](_0x4c4ab9[_0xf0ab('0x30')],qs[_0xf0ab('0x35')](_0x32ec93[_0xf0ab('0x32')][_0xf0ab('0x35')]));_0x5e6b6b[_0xf0ab('0x33')]=_0x5e6b6b[_0xf0ab('0x33')][_0xf0ab('0x36')]?_0x5e6b6b[_0xf0ab('0x33')]:_0x4c4ab9['model'];if(_0x32ec93['query'][_0xf0ab('0x43')]){_0x5e6b6b['include']=[{'all':!![]}];}_0x5e6b6b=_['merge']({},_0x5e6b6b,_0x32ec93['options']);return db[_0xf0ab('0x42')][_0xf0ab('0x4a')](_0x5e6b6b)[_0xf0ab('0x25')](handleEntityNotFound(_0x22a265,null))[_0xf0ab('0x25')](respondWithResult(_0x22a265,null))[_0xf0ab('0x47')](handleError(_0x22a265,null));};exports[_0xf0ab('0x4b')]=function(_0x472c1b,_0x1a0f21){return db[_0xf0ab('0x42')][_0xf0ab('0x4b')](_0x472c1b[_0xf0ab('0x4c')],{})[_0xf0ab('0x25')](function(_0x4e6c9b){var _0x393c9a=_0x472c1b[_0xf0ab('0x4d')][_0xf0ab('0x26')]({'plain':!![]});if(!_0x393c9a)throw new Error(_0xf0ab('0x4e'));if(_0x393c9a[_0xf0ab('0x4f')]===_0xf0ab('0x4d')){var _0x430921=_0x4e6c9b[_0xf0ab('0x26')]({'plain':!![]});var _0x47f564='Voicemails';return db['UserProfileSection'][_0xf0ab('0x4a')]({'where':{'name':_0x47f564,'userProfileId':_0x393c9a[_0xf0ab('0x50')]},'raw':!![]})['then'](function(_0xa1a416){if(_0xa1a416&&_0xa1a416[_0xf0ab('0x51')]===0x0){return db['UserProfileResource'][_0xf0ab('0x4b')]({'name':_0x430921[_0xf0ab('0x2b')],'resourceId':_0x430921['id'],'type':_0xa1a416[_0xf0ab('0x2b')],'sectionId':_0xa1a416['id']},{})[_0xf0ab('0x25')](function(){return _0x4e6c9b;});}else{return _0x4e6c9b;}})[_0xf0ab('0x47')](function(_0x33112b){logger[_0xf0ab('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33112b);throw _0x33112b;});}return _0x4e6c9b;})[_0xf0ab('0x25')](respondWithResult(_0x1a0f21,0xc9))['catch'](handleError(_0x1a0f21,null));};exports[_0xf0ab('0x24')]=function(_0x4c9d2b,_0x1a402b){if(_0x4c9d2b['body']['id']){delete _0x4c9d2b['body']['id'];}return db[_0xf0ab('0x42')]['find']({'where':{'id':_0x4c9d2b[_0xf0ab('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a402b,null))[_0xf0ab('0x25')](saveUpdates(_0x4c9d2b['body'],null))[_0xf0ab('0x25')](respondWithResult(_0x1a402b,null))[_0xf0ab('0x47')](handleError(_0x1a402b,null));};exports[_0xf0ab('0x52')]=function(_0x57f9dd,_0x47f270){return db['VoiceMail'][_0xf0ab('0x4a')]({'where':{'id':_0x57f9dd[_0xf0ab('0x49')]['id']}})['then'](handleEntityNotFound(_0x47f270,null))['then'](removeEntity(_0x47f270,null))[_0xf0ab('0x47')](handleError(_0x47f270,null));};exports[_0xf0ab('0x53')]=function(_0x8df75a,_0x4ead7d,_0x227597){return db[_0xf0ab('0x42')][_0xf0ab('0x54')]({'where':{'id':_0x8df75a[_0xf0ab('0x49')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0x4ead7d,null))[_0xf0ab('0x25')](function(_0x1e6a4e){var _0x4d80a6;var _0x41ed17={},_0x5b24e3={};_0x5b24e3[_0xf0ab('0x30')]=_[_0xf0ab('0x31')](db[_0xf0ab('0x55')][_0xf0ab('0x2e')]);_0x5b24e3[_0xf0ab('0x32')]=_[_0xf0ab('0x31')](_0x8df75a[_0xf0ab('0x32')]);_0x5b24e3[_0xf0ab('0x3a')]=_[_0xf0ab('0x34')](_0x5b24e3[_0xf0ab('0x30')],_0x5b24e3['query']);_0x41ed17[_0xf0ab('0x33')]=_[_0xf0ab('0x34')](_0x5b24e3[_0xf0ab('0x30')],qs[_0xf0ab('0x35')](_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x35')]));_0x41ed17[_0xf0ab('0x33')]=_0x41ed17[_0xf0ab('0x33')][_0xf0ab('0x36')]?_0x41ed17['attributes']:_0x5b24e3['model'];if(!_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x56')](_0xf0ab('0x37'))){_0x41ed17['limit']=qs[_0xf0ab('0x1d')](_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x1d')]);_0x41ed17['offset']=qs[_0xf0ab('0x1b')](_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x1b')]);}_0x41ed17[_0xf0ab('0x57')]=qs[_0xf0ab('0x38')](_0x8df75a['query'][_0xf0ab('0x38')]);_0x41ed17[_0xf0ab('0x39')]=qs[_0xf0ab('0x3a')](_[_0xf0ab('0x3b')](_0x8df75a[_0xf0ab('0x32')],_0x5b24e3[_0xf0ab('0x3a')]));if(_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x3c')]){_0x41ed17[_0xf0ab('0x39')]=_[_0xf0ab('0x40')](_0x41ed17[_0xf0ab('0x39')],{'$or':_[_0xf0ab('0x3d')](_0x41ed17[_0xf0ab('0x33')],function(_0x513ed3){var _0x5c9c0e={};_0x5c9c0e[_0x513ed3]={'$like':'%'+_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x3c')]+'%'};return _0x5c9c0e;})});}_0x41ed17[_0xf0ab('0x39')]=_['merge'](_0x41ed17[_0xf0ab('0x39')],{'mailboxuser':_0x1e6a4e['mailbox']});_0x41ed17=_[_0xf0ab('0x40')]({},_0x41ed17,_0x8df75a[_0xf0ab('0x41')]);return db[_0xf0ab('0x55')]['findAndCountAll'](_0x41ed17)[_0xf0ab('0x25')](respondWithFilteredResult(_0x4ead7d,_0x41ed17));})['catch'](handleError(_0x4ead7d,null));}; \ No newline at end of file +var _0x3c81=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','filter','options','VoiceMail','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4a95b2,_0x47d036){var _0x5206eb=function(_0x26dc94){while(--_0x26dc94){_0x4a95b2['push'](_0x4a95b2['shift']());}};_0x5206eb(++_0x47d036);}(_0x3c81,0x102));var _0x13c8=function(_0x340aca,_0x3598db){_0x340aca=_0x340aca-0x0;var _0xa2f024=_0x3c81[_0x340aca];return _0xa2f024;};'use strict';var emlformat=require(_0x13c8('0x0'));var rimraf=require(_0x13c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13c8('0x2'));var rp=require(_0x13c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x13c8('0x4'));var sox=require(_0x13c8('0x5'));var csv=require(_0x13c8('0x6'));var ejs=require(_0x13c8('0x7'));var fs=require('fs');var fs_extra=require(_0x13c8('0x8'));var _=require(_0x13c8('0x9'));var squel=require(_0x13c8('0xa'));var crypto=require('crypto');var jsforce=require(_0x13c8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x13c8('0x6'));var querystring=require(_0x13c8('0xc'));var Papa=require(_0x13c8('0xd'));var Redis=require(_0x13c8('0xe'));var authService=require(_0x13c8('0xf'));var qs=require(_0x13c8('0x10'));var as=require(_0x13c8('0x11'));var hardwareService=require(_0x13c8('0x12'));var logger=require(_0x13c8('0x13'))(_0x13c8('0x14'));var utils=require(_0x13c8('0x15'));var config=require(_0x13c8('0x16'));var licenseUtil=require(_0x13c8('0x17'));var db=require(_0x13c8('0x18'))['db'];function respondWithStatusCode(_0x5ab91d,_0x21442d){_0x21442d=_0x21442d||0xcc;return function(_0x7b6da8){if(_0x7b6da8){return _0x5ab91d[_0x13c8('0x19')](_0x21442d);}return _0x5ab91d[_0x13c8('0x1a')](_0x21442d)['end']();};}function respondWithResult(_0x42955d,_0x515681){_0x515681=_0x515681||0xc8;return function(_0x4d7a88){if(_0x4d7a88){return _0x42955d['status'](_0x515681)[_0x13c8('0x1b')](_0x4d7a88);}};}function respondWithFilteredResult(_0x5e0e06,_0x337397){return function(_0x17a3c1){if(_0x17a3c1){var _0x23f64e=typeof _0x337397[_0x13c8('0x1c')]==='undefined'&&typeof _0x337397[_0x13c8('0x1d')]===_0x13c8('0x1e');var _0x31ae02=_0x17a3c1[_0x13c8('0x1f')];var _0xce1ad2=_0x23f64e?0x0:_0x337397[_0x13c8('0x1c')];var _0x346417=_0x23f64e?_0x17a3c1[_0x13c8('0x1f')]:_0x337397[_0x13c8('0x1c')]+_0x337397[_0x13c8('0x1d')];var _0xe9386a;if(_0x346417>=_0x31ae02){_0x346417=_0x31ae02;_0xe9386a=0xc8;}else{_0xe9386a=0xce;}_0x5e0e06['status'](_0xe9386a);return _0x5e0e06[_0x13c8('0x20')](_0x13c8('0x21'),_0xce1ad2+'-'+_0x346417+'/'+_0x31ae02)[_0x13c8('0x1b')](_0x17a3c1);}return null;};}function patchUpdates(_0x313ea3){return function(_0x513085){try{jsonpatch[_0x13c8('0x22')](_0x513085,_0x313ea3,!![]);}catch(_0x3c4603){return BPromise[_0x13c8('0x23')](_0x3c4603);}return _0x513085[_0x13c8('0x24')]();};}function saveUpdates(_0x436d5d,_0x2fc123){return function(_0x5ab47f){if(_0x5ab47f){return _0x5ab47f[_0x13c8('0x25')](_0x436d5d)[_0x13c8('0x26')](function(_0x315d6c){return _0x315d6c;});}return null;};}function removeEntity(_0xcf41d2,_0x577df6){return function(_0x1770e5){if(_0x1770e5){return _0x1770e5[_0x13c8('0x27')]()['then'](function(){var _0x49b552=_0x1770e5[_0x13c8('0x28')]({'plain':!![]});var _0x4aff35='Voicemails';return db['UserProfileResource'][_0x13c8('0x27')]({'where':{'type':_0x4aff35,'resourceId':_0x49b552['id']}})[_0x13c8('0x26')](function(){return _0x1770e5;});})['then'](function(){_0xcf41d2['status'](0xcc)[_0x13c8('0x29')]();});}};}function handleEntityNotFound(_0x596166,_0x545b47){return function(_0x1c7dc4){if(!_0x1c7dc4){_0x596166[_0x13c8('0x19')](0x194);}return _0x1c7dc4;};}function handleError(_0x34fdbe,_0x560ede){_0x560ede=_0x560ede||0x1f4;return function(_0x5ef2f7){logger[_0x13c8('0x2a')](_0x5ef2f7[_0x13c8('0x2b')]);if(_0x5ef2f7[_0x13c8('0x2c')]){delete _0x5ef2f7[_0x13c8('0x2c')];}_0x34fdbe[_0x13c8('0x1a')](_0x560ede)[_0x13c8('0x2d')](_0x5ef2f7);};}exports[_0x13c8('0x2e')]=function(_0x4a1b9c,_0x109cb8){var _0xcbc9b7={},_0x5a5911={},_0x5c85e4={'count':0x0,'rows':[]};var _0x23a725=_[_0x13c8('0x2f')](db['VoiceMail'][_0x13c8('0x30')],function(_0x355ddc){return{'name':_0x355ddc['fieldName'],'type':_0x355ddc[_0x13c8('0x31')][_0x13c8('0x32')]};});_0x5a5911[_0x13c8('0x33')]=_[_0x13c8('0x2f')](_0x23a725,_0x13c8('0x2c'));_0x5a5911[_0x13c8('0x34')]=_[_0x13c8('0x35')](_0x4a1b9c[_0x13c8('0x34')]);_0x5a5911['filters']=_['intersection'](_0x5a5911[_0x13c8('0x33')],_0x5a5911[_0x13c8('0x34')]);_0xcbc9b7['attributes']=_[_0x13c8('0x36')](_0x5a5911['model'],qs[_0x13c8('0x37')](_0x4a1b9c['query'][_0x13c8('0x37')]));_0xcbc9b7[_0x13c8('0x38')]=_0xcbc9b7[_0x13c8('0x38')][_0x13c8('0x39')]?_0xcbc9b7[_0x13c8('0x38')]:_0x5a5911[_0x13c8('0x33')];if(!_0x4a1b9c[_0x13c8('0x34')]['hasOwnProperty'](_0x13c8('0x3a'))){_0xcbc9b7[_0x13c8('0x1d')]=qs['limit'](_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x1d')]);_0xcbc9b7[_0x13c8('0x1c')]=qs['offset'](_0x4a1b9c['query']['offset']);}_0xcbc9b7[_0x13c8('0x3b')]=qs[_0x13c8('0x3c')](_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x3c')]);_0xcbc9b7[_0x13c8('0x3d')]=qs[_0x13c8('0x3e')](_[_0x13c8('0x3f')](_0x4a1b9c[_0x13c8('0x34')],_0x5a5911[_0x13c8('0x3e')]),_0x23a725);if(_0x4a1b9c['query']['filter']){_0xcbc9b7[_0x13c8('0x3d')]=_[_0x13c8('0x40')](_0xcbc9b7[_0x13c8('0x3d')],{'$or':_[_0x13c8('0x2f')](_0x23a725,function(_0x4f1bed){if(_0x4f1bed[_0x13c8('0x31')]!=='VIRTUAL'){var _0x343dba={};_0x343dba[_0x4f1bed[_0x13c8('0x2c')]]={'$like':'%'+_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x41')]+'%'};return _0x343dba;}})});}_0xcbc9b7=_[_0x13c8('0x40')]({},_0xcbc9b7,_0x4a1b9c[_0x13c8('0x42')]);var _0xb272c0={'where':_0xcbc9b7[_0x13c8('0x3d')]};return db[_0x13c8('0x43')][_0x13c8('0x1f')](_0xb272c0)[_0x13c8('0x26')](function(_0x416169){_0x5c85e4[_0x13c8('0x1f')]=_0x416169;if(_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x44')]){_0xcbc9b7[_0x13c8('0x45')]=[{'all':!![]}];}return db[_0x13c8('0x43')][_0x13c8('0x46')](_0xcbc9b7);})[_0x13c8('0x26')](function(_0x1cff99){_0x5c85e4[_0x13c8('0x47')]=_0x1cff99;return _0x5c85e4;})[_0x13c8('0x26')](respondWithFilteredResult(_0x109cb8,_0xcbc9b7))[_0x13c8('0x48')](handleError(_0x109cb8,null));};exports[_0x13c8('0x49')]=function(_0x44ee66,_0x57e65f){var _0x3ef04e={'raw':!![],'where':{'id':_0x44ee66[_0x13c8('0x4a')]['id']}},_0x3fcb7f={};_0x3fcb7f[_0x13c8('0x33')]=_[_0x13c8('0x35')](db['VoiceMail']['rawAttributes']);_0x3fcb7f[_0x13c8('0x34')]=_[_0x13c8('0x35')](_0x44ee66[_0x13c8('0x34')]);_0x3fcb7f['filters']=_['intersection'](_0x3fcb7f['model'],_0x3fcb7f[_0x13c8('0x34')]);_0x3ef04e['attributes']=_[_0x13c8('0x36')](_0x3fcb7f['model'],qs[_0x13c8('0x37')](_0x44ee66[_0x13c8('0x34')][_0x13c8('0x37')]));_0x3ef04e[_0x13c8('0x38')]=_0x3ef04e[_0x13c8('0x38')][_0x13c8('0x39')]?_0x3ef04e['attributes']:_0x3fcb7f[_0x13c8('0x33')];if(_0x44ee66[_0x13c8('0x34')]['includeAll']){_0x3ef04e[_0x13c8('0x45')]=[{'all':!![]}];}_0x3ef04e=_[_0x13c8('0x40')]({},_0x3ef04e,_0x44ee66[_0x13c8('0x42')]);return db[_0x13c8('0x43')][_0x13c8('0x4b')](_0x3ef04e)['then'](handleEntityNotFound(_0x57e65f,null))[_0x13c8('0x26')](respondWithResult(_0x57e65f,null))[_0x13c8('0x48')](handleError(_0x57e65f,null));};exports[_0x13c8('0x4c')]=function(_0x38418b,_0x185d18){return db['VoiceMail'][_0x13c8('0x4c')](_0x38418b[_0x13c8('0x4d')],{})[_0x13c8('0x26')](function(_0x6b042b){var _0x2d4f87=_0x38418b[_0x13c8('0x4e')][_0x13c8('0x28')]({'plain':!![]});if(!_0x2d4f87)throw new Error(_0x13c8('0x4f'));if(_0x2d4f87[_0x13c8('0x50')]===_0x13c8('0x4e')){var _0x266f4e=_0x6b042b['get']({'plain':!![]});var _0x10ba7c=_0x13c8('0x51');return db[_0x13c8('0x52')][_0x13c8('0x4b')]({'where':{'name':_0x10ba7c,'userProfileId':_0x2d4f87[_0x13c8('0x53')]},'raw':!![]})[_0x13c8('0x26')](function(_0x48b7f6){if(_0x48b7f6&&_0x48b7f6[_0x13c8('0x54')]===0x0){return db[_0x13c8('0x55')][_0x13c8('0x4c')]({'name':_0x266f4e['name'],'resourceId':_0x266f4e['id'],'type':_0x48b7f6['name'],'sectionId':_0x48b7f6['id']},{})[_0x13c8('0x26')](function(){return _0x6b042b;});}else{return _0x6b042b;}})[_0x13c8('0x48')](function(_0x55d353){logger[_0x13c8('0x2a')](_0x13c8('0x56'),_0x55d353);throw _0x55d353;});}return _0x6b042b;})['then'](respondWithResult(_0x185d18,0xc9))[_0x13c8('0x48')](handleError(_0x185d18,null));};exports['update']=function(_0x242791,_0x1f67bd){if(_0x242791[_0x13c8('0x4d')]['id']){delete _0x242791['body']['id'];}return db[_0x13c8('0x43')][_0x13c8('0x4b')]({'where':{'id':_0x242791['params']['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x1f67bd,null))['then'](saveUpdates(_0x242791[_0x13c8('0x4d')],null))[_0x13c8('0x26')](respondWithResult(_0x1f67bd,null))[_0x13c8('0x48')](handleError(_0x1f67bd,null));};exports[_0x13c8('0x27')]=function(_0x3760e4,_0x5f4884){return db[_0x13c8('0x43')]['find']({'where':{'id':_0x3760e4['params']['id']}})['then'](handleEntityNotFound(_0x5f4884,null))['then'](removeEntity(_0x5f4884,null))['catch'](handleError(_0x5f4884,null));};exports[_0x13c8('0x57')]=function(_0x46074c,_0x1515a5,_0x1f383f){return db[_0x13c8('0x43')][_0x13c8('0x58')]({'where':{'id':_0x46074c[_0x13c8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1515a5,null))['then'](function(_0x41f9d7){var _0x30e3e4;var _0x27760b={},_0x11b3ba={};_0x11b3ba[_0x13c8('0x33')]=_[_0x13c8('0x35')](db[_0x13c8('0x59')][_0x13c8('0x30')]);_0x11b3ba['query']=_[_0x13c8('0x35')](_0x46074c[_0x13c8('0x34')]);_0x11b3ba['filters']=_[_0x13c8('0x36')](_0x11b3ba[_0x13c8('0x33')],_0x11b3ba[_0x13c8('0x34')]);_0x27760b[_0x13c8('0x38')]=_[_0x13c8('0x36')](_0x11b3ba[_0x13c8('0x33')],qs[_0x13c8('0x37')](_0x46074c[_0x13c8('0x34')][_0x13c8('0x37')]));_0x27760b[_0x13c8('0x38')]=_0x27760b[_0x13c8('0x38')][_0x13c8('0x39')]?_0x27760b[_0x13c8('0x38')]:_0x11b3ba[_0x13c8('0x33')];if(!_0x46074c[_0x13c8('0x34')][_0x13c8('0x5a')]('nolimit')){_0x27760b[_0x13c8('0x1d')]=qs['limit'](_0x46074c[_0x13c8('0x34')][_0x13c8('0x1d')]);_0x27760b['offset']=qs[_0x13c8('0x1c')](_0x46074c[_0x13c8('0x34')]['offset']);}_0x27760b[_0x13c8('0x3b')]=qs[_0x13c8('0x3c')](_0x46074c[_0x13c8('0x34')][_0x13c8('0x3c')]);_0x27760b[_0x13c8('0x3d')]=qs[_0x13c8('0x3e')](_[_0x13c8('0x3f')](_0x46074c[_0x13c8('0x34')],_0x11b3ba[_0x13c8('0x3e')]));if(_0x46074c[_0x13c8('0x34')][_0x13c8('0x41')]){_0x27760b['where']=_[_0x13c8('0x40')](_0x27760b[_0x13c8('0x3d')],{'$or':_[_0x13c8('0x2f')](_0x27760b[_0x13c8('0x38')],function(_0x372ae4){var _0x23c67e={};_0x23c67e[_0x372ae4]={'$like':'%'+_0x46074c['query'][_0x13c8('0x41')]+'%'};return _0x23c67e;})});}_0x27760b[_0x13c8('0x3d')]=_[_0x13c8('0x40')](_0x27760b['where'],{'mailboxuser':_0x41f9d7[_0x13c8('0x5b')]});_0x27760b=_[_0x13c8('0x40')]({},_0x27760b,_0x46074c[_0x13c8('0x42')]);return db[_0x13c8('0x59')][_0x13c8('0x5c')](_0x27760b)[_0x13c8('0x26')](respondWithFilteredResult(_0x1515a5,_0x27760b));})['catch'](handleError(_0x1515a5,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 6c728a9..e5511fb 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 _0x3226=['request-promise','path','rimraf','../../config/environment','define','VoiceMail','mailbox_context','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xf44d98,_0x12a472){var _0x5ebb04=function(_0x930c33){while(--_0x930c33){_0xf44d98['push'](_0xf44d98['shift']());}};_0x5ebb04(++_0x12a472);}(_0x3226,0x173));var _0x6322=function(_0x4c0f4f,_0x1ab7f1){_0x4c0f4f=_0x4c0f4f-0x0;var _0x56602e=_0x3226[_0x4c0f4f];return _0x56602e;};'use strict';var _=require(_0x6322('0x0'));var util=require(_0x6322('0x1'));var logger=require(_0x6322('0x2'))(_0x6322('0x3'));var moment=require(_0x6322('0x4'));var BPromise=require(_0x6322('0x5'));var rp=require(_0x6322('0x6'));var fs=require('fs');var path=require(_0x6322('0x7'));var rimraf=require(_0x6322('0x8'));var config=require(_0x6322('0x9'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x503b17,_0x4f25e2){return _0x503b17[_0x6322('0xa')](_0x6322('0xb'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x6322('0xc'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3cb3=['moment','request-promise','path','exports','define','mailbox','context','util'];(function(_0x2672f3,_0x35a36f){var _0x3c0919=function(_0x5cc381){while(--_0x5cc381){_0x2672f3['push'](_0x2672f3['shift']());}};_0x3c0919(++_0x35a36f);}(_0x3cb3,0x177));var _0x33cb=function(_0x47a479,_0x36cd0f){_0x47a479=_0x47a479-0x0;var _0x133531=_0x3cb3[_0x47a479];return _0x133531;};'use strict';var _=require('lodash');var util=require(_0x33cb('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x33cb('0x1'));var BPromise=require('bluebird');var rp=require(_0x33cb('0x2'));var fs=require('fs');var path=require(_0x33cb('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0x33cb('0x4')]=function(_0x388ba2,_0x3365fb){return _0x388ba2[_0x33cb('0x5')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x33cb('0x6'),_0x33cb('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index af5a62a..71fb2e2 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 _0xe8fe=['http','then','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x56911b,_0x132535){var _0x460373=function(_0x47e323){while(--_0x47e323){_0x56911b['push'](_0x56911b['shift']());}};_0x460373(++_0x132535);}(_0xe8fe,0xf2));var _0xee8f=function(_0x4c260a,_0x148241){_0x4c260a=_0x4c260a-0x0;var _0x17bbdd=_0xe8fe[_0x4c260a];return _0x17bbdd;};'use strict';var _=require(_0xee8f('0x0'));var util=require(_0xee8f('0x1'));var moment=require(_0xee8f('0x2'));var BPromise=require('bluebird');var rs=require(_0xee8f('0x3'));var fs=require('fs');var Redis=require(_0xee8f('0x4'));var db=require(_0xee8f('0x5'))['db'];var utils=require(_0xee8f('0x6'));var logger=require(_0xee8f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xee8f('0x8'));var client=jayson[_0xee8f('0x9')][_0xee8f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x214b2a,_0x3e89a1,_0x1b05e8){return new BPromise(function(_0x44e5df,_0x3892e1){return client['request'](_0x214b2a,_0x1b05e8)[_0xee8f('0xb')](function(_0x16e83d){logger['info']('VoiceMail,\x20%s,\x20%s',_0x3e89a1,'request\x20sent');logger[_0xee8f('0xc')](_0xee8f('0xd'),_0x3e89a1,_0xee8f('0xe'),JSON[_0xee8f('0xf')](_0x16e83d));if(_0x16e83d[_0xee8f('0x10')]){if(_0x16e83d[_0xee8f('0x10')][_0xee8f('0x11')]===0x1f4){logger[_0xee8f('0x10')](_0xee8f('0x12'),_0x3e89a1,_0x16e83d[_0xee8f('0x10')][_0xee8f('0x13')]);return _0x3892e1(_0x16e83d[_0xee8f('0x10')][_0xee8f('0x13')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x3e89a1,_0x16e83d[_0xee8f('0x10')][_0xee8f('0x13')]);return _0x44e5df(_0x16e83d[_0xee8f('0x10')][_0xee8f('0x13')]);}else{logger[_0xee8f('0x14')]('VoiceMail,\x20%s,\x20%s',_0x3e89a1,'request\x20sent');_0x44e5df(_0x16e83d['result'][_0xee8f('0x13')]);}})['catch'](function(_0x3cdb6a){logger[_0xee8f('0x10')]('VoiceMail,\x20%s,\x20%s',_0x3e89a1,_0x3cdb6a);_0x3892e1(_0x3cdb6a);});});} \ No newline at end of file +var _0xae6e=['VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info'];(function(_0xa14cc3,_0x2c9a86){var _0x1ea5bd=function(_0x3982e5){while(--_0x3982e5){_0xa14cc3['push'](_0xa14cc3['shift']());}};_0x1ea5bd(++_0x2c9a86);}(_0xae6e,0x9b));var _0xeae6=function(_0x44a578,_0x466cfc){_0x44a578=_0x44a578-0x0;var _0x3d6593=_0xae6e[_0x44a578];return _0x3d6593;};'use strict';var _=require(_0xeae6('0x0'));var util=require(_0xeae6('0x1'));var moment=require(_0xeae6('0x2'));var BPromise=require('bluebird');var rs=require(_0xeae6('0x3'));var fs=require('fs');var Redis=require(_0xeae6('0x4'));var db=require(_0xeae6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeae6('0x6'))(_0xeae6('0x7'));var config=require('../../config/environment');var jayson=require(_0xeae6('0x8'));var client=jayson[_0xeae6('0x9')][_0xeae6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43b31a,_0x2f95ed,_0x1003e3){return new BPromise(function(_0x4cc33f,_0x1a1ffc){return client[_0xeae6('0xb')](_0x43b31a,_0x1003e3)['then'](function(_0x5f4613){logger[_0xeae6('0xc')](_0xeae6('0xd'),_0x2f95ed,_0xeae6('0xe'));logger['debug'](_0xeae6('0xf'),_0x2f95ed,_0xeae6('0xe'),JSON['stringify'](_0x5f4613));if(_0x5f4613[_0xeae6('0x10')]){if(_0x5f4613[_0xeae6('0x10')][_0xeae6('0x11')]===0x1f4){logger[_0xeae6('0x10')](_0xeae6('0xd'),_0x2f95ed,_0x5f4613[_0xeae6('0x10')][_0xeae6('0x12')]);return _0x1a1ffc(_0x5f4613[_0xeae6('0x10')][_0xeae6('0x12')]);}logger[_0xeae6('0x10')](_0xeae6('0xd'),_0x2f95ed,_0x5f4613[_0xeae6('0x10')][_0xeae6('0x12')]);return _0x4cc33f(_0x5f4613['error'][_0xeae6('0x12')]);}else{logger[_0xeae6('0xc')]('VoiceMail,\x20%s,\x20%s',_0x2f95ed,_0xeae6('0xe'));_0x4cc33f(_0x5f4613[_0xeae6('0x13')][_0xeae6('0x12')]);}})[_0xeae6('0x14')](function(_0x583068){logger[_0xeae6('0x10')]('VoiceMail,\x20%s,\x20%s',_0x2f95ed,_0x583068);_0x1a1ffc(_0x583068);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index d6df420..df428ea 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 _0x245a=['create','put','/:id','delete','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','download','post'];(function(_0x355494,_0x592917){var _0x59d215=function(_0x1c59f7){while(--_0x1c59f7){_0x355494['push'](_0x355494['shift']());}};_0x59d215(++_0x592917);}(_0x245a,0x1d4));var _0xa245=function(_0x31e6ee,_0x1bdb9e){_0x31e6ee=_0x31e6ee-0x0;var _0x570ac9=_0x245a[_0x31e6ee];return _0x570ac9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa245('0x0'));var timeout=require(_0xa245('0x1'));var express=require(_0xa245('0x2'));var router=express[_0xa245('0x3')]();var fs_extra=require(_0xa245('0x4'));var auth=require(_0xa245('0x5'));var interaction=require(_0xa245('0x6'));var config=require(_0xa245('0x7'));var controller=require('./voiceMailMessage.controller');router[_0xa245('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa245('0x8')]('/:id',auth[_0xa245('0x9')](),controller['show']);router['get']('/:id/download',auth[_0xa245('0x9')](),controller[_0xa245('0xa')]);router[_0xa245('0xb')]('/',auth['isAuthenticated'](),controller[_0xa245('0xc')]);router[_0xa245('0xd')](_0xa245('0xe'),auth[_0xa245('0x9')](),controller['update']);router[_0xa245('0xf')](_0xa245('0xe'),auth[_0xa245('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x31e5=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','put','/:id','update'];(function(_0xe04866,_0x197f28){var _0x47986e=function(_0x56cd9f){while(--_0x56cd9f){_0xe04866['push'](_0xe04866['shift']());}};_0x47986e(++_0x197f28);}(_0x31e5,0x136));var _0x531e=function(_0x55c31e,_0x1aa766){_0x55c31e=_0x55c31e-0x0;var _0x2392e6=_0x31e5[_0x55c31e];return _0x2392e6;};'use strict';var multer=require(_0x531e('0x0'));var util=require('util');var path=require(_0x531e('0x1'));var timeout=require(_0x531e('0x2'));var express=require(_0x531e('0x3'));var router=express[_0x531e('0x4')]();var fs_extra=require(_0x531e('0x5'));var auth=require(_0x531e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x531e('0x7'));var controller=require(_0x531e('0x8'));router[_0x531e('0x9')]('/',auth[_0x531e('0xa')](),controller[_0x531e('0xb')]);router[_0x531e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x531e('0xc')]);router[_0x531e('0x9')](_0x531e('0xd'),auth[_0x531e('0xa')](),controller[_0x531e('0xe')]);router[_0x531e('0xf')]('/',auth[_0x531e('0xa')](),controller[_0x531e('0x10')]);router[_0x531e('0x11')](_0x531e('0x12'),auth['isAuthenticated'](),controller[_0x531e('0x13')]);router['delete'](_0x531e('0x12'),auth[_0x531e('0xa')](),controller[_0x531e('0x14')]);module[_0x531e('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index a48c17d..9939728 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 _0x1666=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','long','TIMESTAMP'];(function(_0x5af4bf,_0x19338a){var _0x26cf87=function(_0x675391){while(--_0x675391){_0x5af4bf['push'](_0x5af4bf['shift']());}};_0x26cf87(++_0x19338a);}(_0x1666,0xbf));var _0x6166=function(_0x2c25a0,_0x15ae0e){_0x2c25a0=_0x2c25a0-0x0;var _0x1fe8b7=_0x1666[_0x2c25a0];return _0x1fe8b7;};'use strict';var Sequelize=require(_0x6166('0x0'));module['exports']={'name':{'type':Sequelize[_0x6166('0x1')],'get':function(_0x452631){return this[_0x6166('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x6166('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6166('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x6166('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x6166('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6166('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x6166('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6166('0x4')],'defaultValue':''},'stamp':{'type':_0x6166('0x6'),'defaultValue':Sequelize[_0x6166('0x7')](_0x6166('0x8'))}}; \ No newline at end of file +var _0xee9e=['VIRTUAL','getDataValue','INTEGER','STRING','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports'];(function(_0x13c3b8,_0x3fdb45){var _0x18e42f=function(_0x4d661d){while(--_0x4d661d){_0x13c3b8['push'](_0x13c3b8['shift']());}};_0x18e42f(++_0x3fdb45);}(_0xee9e,0xe7));var _0xeee9=function(_0x462000,_0x4e47c8){_0x462000=_0x462000-0x0;var _0x33f58c=_0xee9e[_0x462000];return _0x33f58c;};'use strict';var Sequelize=require('sequelize');module[_0xeee9('0x0')]={'name':{'type':Sequelize[_0xeee9('0x1')],'get':function(_0x27bff2){return this[_0xeee9('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xeee9('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xeee9('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xeee9('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xeee9('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xeee9('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xeee9('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xeee9('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xeee9('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xeee9('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xeee9('0x4')],'defaultValue':''},'stamp':{'type':_0xeee9('0x6'),'defaultValue':Sequelize['literal'](_0xeee9('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 3464442..9208981 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 _0x5a92=['rawAttributes','type','model','differenceBy','map','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','error','name','send','index','VoiceMailMessage'];(function(_0x597351,_0x5aed9f){var _0x410cd7=function(_0x511d62){while(--_0x511d62){_0x597351['push'](_0x597351['shift']());}};_0x410cd7(++_0x5aed9f);}(_0x5a92,0x1b7));var _0x25a9=function(_0x3d32bf,_0x13d1a4){_0x3d32bf=_0x3d32bf-0x0;var _0x5431e0=_0x5a92[_0x3d32bf];return _0x5431e0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x25a9('0x0'));var jsonpatch=require(_0x25a9('0x1'));var rp=require('request-promise');var moment=require(_0x25a9('0x2'));var BPromise=require(_0x25a9('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x25a9('0x4'));var csv=require(_0x25a9('0x5'));var ejs=require(_0x25a9('0x6'));var fs=require('fs');var fs_extra=require(_0x25a9('0x7'));var _=require(_0x25a9('0x8'));var squel=require(_0x25a9('0x9'));var crypto=require(_0x25a9('0xa'));var jsforce=require(_0x25a9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x25a9('0x5'));var querystring=require(_0x25a9('0xc'));var Papa=require(_0x25a9('0xd'));var Redis=require(_0x25a9('0xe'));var authService=require(_0x25a9('0xf'));var qs=require(_0x25a9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x25a9('0x11'))(_0x25a9('0x12'));var utils=require(_0x25a9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x25a9('0x14'));var db=require(_0x25a9('0x15'))['db'];function respondWithStatusCode(_0xd0d015,_0x4e62bc){_0x4e62bc=_0x4e62bc||0xcc;return function(_0x52b1c6){if(_0x52b1c6){return _0xd0d015[_0x25a9('0x16')](_0x4e62bc);}return _0xd0d015[_0x25a9('0x17')](_0x4e62bc)[_0x25a9('0x18')]();};}function respondWithResult(_0x3afe3c,_0x1c979e){_0x1c979e=_0x1c979e||0xc8;return function(_0x16251d){if(_0x16251d){return _0x3afe3c['status'](_0x1c979e)[_0x25a9('0x19')](_0x16251d);}};}function respondWithFilteredResult(_0x41456e,_0x479c14){return function(_0x2e1937){if(_0x2e1937){var _0x22a5f8=typeof _0x479c14[_0x25a9('0x1a')]==='undefined'&&typeof _0x479c14[_0x25a9('0x1b')]===_0x25a9('0x1c');var _0x167c84=_0x2e1937[_0x25a9('0x1d')];var _0xd2e6c9=_0x22a5f8?0x0:_0x479c14[_0x25a9('0x1a')];var _0x21725c=_0x22a5f8?_0x2e1937[_0x25a9('0x1d')]:_0x479c14[_0x25a9('0x1a')]+_0x479c14[_0x25a9('0x1b')];var _0x5b620a;if(_0x21725c>=_0x167c84){_0x21725c=_0x167c84;_0x5b620a=0xc8;}else{_0x5b620a=0xce;}_0x41456e[_0x25a9('0x17')](_0x5b620a);return _0x41456e[_0x25a9('0x1e')](_0x25a9('0x1f'),_0xd2e6c9+'-'+_0x21725c+'/'+_0x167c84)[_0x25a9('0x19')](_0x2e1937);}return null;};}function patchUpdates(_0x22353a){return function(_0x819eeb){try{jsonpatch[_0x25a9('0x20')](_0x819eeb,_0x22353a,!![]);}catch(_0x30e6f7){return BPromise['reject'](_0x30e6f7);}return _0x819eeb['save']();};}function saveUpdates(_0x5c479d,_0x14712e){return function(_0x32156c){if(_0x32156c){return _0x32156c[_0x25a9('0x21')](_0x5c479d)[_0x25a9('0x22')](function(_0x213616){return _0x213616;});}return null;};}function removeEntity(_0xd1f599,_0x312027){return function(_0x5dfcbc){if(_0x5dfcbc){return _0x5dfcbc[_0x25a9('0x23')]()[_0x25a9('0x22')](function(){_0xd1f599['status'](0xcc)[_0x25a9('0x18')]();});}};}function handleEntityNotFound(_0x172b21,_0x2d9bfe){return function(_0x12618d){if(!_0x12618d){_0x172b21[_0x25a9('0x16')](0x194);}return _0x12618d;};}function handleError(_0x4321f4,_0x24d43c){_0x24d43c=_0x24d43c||0x1f4;return function(_0x6cfef6){logger[_0x25a9('0x24')](_0x6cfef6['stack']);if(_0x6cfef6[_0x25a9('0x25')]){delete _0x6cfef6[_0x25a9('0x25')];}_0x4321f4[_0x25a9('0x17')](_0x24d43c)[_0x25a9('0x26')](_0x6cfef6);};}exports[_0x25a9('0x27')]=function(_0x541641,_0x30519c){var _0x5c8a86={},_0x465d64={},_0x2e7a1f={'count':0x0,'rows':[]};var _0x4f91b7=_['map'](db[_0x25a9('0x28')][_0x25a9('0x29')],function(_0x42c9fd){return{'name':_0x42c9fd['fieldName'],'type':_0x42c9fd[_0x25a9('0x2a')]['key']};});_0x465d64[_0x25a9('0x2b')]=_[_0x25a9('0x2c')](_[_0x25a9('0x2d')](_0x4f91b7,_0x25a9('0x25')),[_0x25a9('0x25')]);_0x465d64['query']=_[_0x25a9('0x2e')](_0x541641[_0x25a9('0x2f')]);_0x465d64[_0x25a9('0x30')]=_['intersection'](_0x465d64[_0x25a9('0x2b')],_0x465d64[_0x25a9('0x2f')]);_0x5c8a86['attributes']=_[_0x25a9('0x31')](_0x465d64['model'],qs[_0x25a9('0x32')](_0x541641[_0x25a9('0x2f')][_0x25a9('0x32')]));_0x5c8a86[_0x25a9('0x33')]=_0x5c8a86[_0x25a9('0x33')][_0x25a9('0x34')]?_0x5c8a86['attributes']:_0x465d64[_0x25a9('0x2b')];if(!_0x541641[_0x25a9('0x2f')]['hasOwnProperty'](_0x25a9('0x35'))){_0x5c8a86['limit']=qs[_0x25a9('0x1b')](_0x541641[_0x25a9('0x2f')][_0x25a9('0x1b')]);_0x5c8a86[_0x25a9('0x1a')]=qs[_0x25a9('0x1a')](_0x541641['query'][_0x25a9('0x1a')]);}_0x5c8a86[_0x25a9('0x36')]=qs[_0x25a9('0x37')](_0x541641[_0x25a9('0x2f')]['sort']);_0x5c8a86['where']=qs[_0x25a9('0x30')](_['pick'](_0x541641[_0x25a9('0x2f')],_0x465d64[_0x25a9('0x30')]),_0x4f91b7);if(_0x541641['query'][_0x25a9('0x38')]){_0x5c8a86[_0x25a9('0x39')]=_[_0x25a9('0x3a')](_0x5c8a86[_0x25a9('0x39')],{'$or':_[_0x25a9('0x2d')](_0x4f91b7,function(_0x1b487a){if(_0x1b487a['type']!==_0x25a9('0x3b')){var _0x2041ce={};_0x2041ce[_0x1b487a[_0x25a9('0x25')]]={'$like':'%'+_0x541641['query'][_0x25a9('0x38')]+'%'};return _0x2041ce;}})});}_0x5c8a86=_[_0x25a9('0x3a')]({},_0x5c8a86,_0x541641['options']);var _0x2808d3={'where':_0x5c8a86[_0x25a9('0x39')]};return db['VoiceMailMessage'][_0x25a9('0x1d')](_0x2808d3)['then'](function(_0x26f289){_0x2e7a1f[_0x25a9('0x1d')]=_0x26f289;if(_0x541641['query'][_0x25a9('0x3c')]){_0x5c8a86[_0x25a9('0x3d')]=[{'all':!![]}];}return db[_0x25a9('0x28')]['findAll'](_0x5c8a86);})[_0x25a9('0x22')](function(_0x21ee9b){_0x2e7a1f[_0x25a9('0x3e')]=_0x21ee9b;return _0x2e7a1f;})[_0x25a9('0x22')](respondWithFilteredResult(_0x30519c,_0x5c8a86))[_0x25a9('0x3f')](handleError(_0x30519c,null));};exports[_0x25a9('0x40')]=function(_0x2b2699,_0x343e1a){var _0x1dc44f={'raw':!![],'where':{'id':_0x2b2699[_0x25a9('0x41')]['id']}},_0x2bd0e9={};_0x2bd0e9[_0x25a9('0x2b')]=_[_0x25a9('0x2e')](db[_0x25a9('0x28')]['rawAttributes']);_0x2bd0e9[_0x25a9('0x2f')]=_[_0x25a9('0x2e')](_0x2b2699['query']);_0x2bd0e9[_0x25a9('0x30')]=_[_0x25a9('0x31')](_0x2bd0e9[_0x25a9('0x2b')],_0x2bd0e9[_0x25a9('0x2f')]);_0x1dc44f['attributes']=_[_0x25a9('0x31')](_0x2bd0e9[_0x25a9('0x2b')],qs['fields'](_0x2b2699[_0x25a9('0x2f')]['fields']));_0x1dc44f[_0x25a9('0x33')]=_0x1dc44f[_0x25a9('0x33')][_0x25a9('0x34')]?_0x1dc44f[_0x25a9('0x33')]:_0x2bd0e9[_0x25a9('0x2b')];if(_0x2b2699[_0x25a9('0x2f')][_0x25a9('0x3c')]){_0x1dc44f[_0x25a9('0x3d')]=[{'all':!![]}];}_0x1dc44f=_[_0x25a9('0x3a')]({},_0x1dc44f,_0x2b2699[_0x25a9('0x42')]);return db[_0x25a9('0x28')][_0x25a9('0x43')](_0x1dc44f)[_0x25a9('0x22')](handleEntityNotFound(_0x343e1a,null))[_0x25a9('0x22')](respondWithResult(_0x343e1a,null))[_0x25a9('0x3f')](handleError(_0x343e1a,null));};exports['create']=function(_0x38fa5e,_0xacc202){return db['VoiceMailMessage'][_0x25a9('0x44')](_0x38fa5e[_0x25a9('0x45')],{})[_0x25a9('0x22')](respondWithResult(_0xacc202,0xc9))[_0x25a9('0x3f')](handleError(_0xacc202,null));};exports[_0x25a9('0x21')]=function(_0x587962,_0x463593){if(_0x587962[_0x25a9('0x45')]['id']){delete _0x587962['body']['id'];}return db[_0x25a9('0x28')][_0x25a9('0x43')]({'where':{'id':_0x587962[_0x25a9('0x41')]['id']}})[_0x25a9('0x22')](handleEntityNotFound(_0x463593,null))[_0x25a9('0x22')](saveUpdates(_0x587962[_0x25a9('0x45')],null))['then'](respondWithResult(_0x463593,null))[_0x25a9('0x3f')](handleError(_0x463593,null));};exports[_0x25a9('0x23')]=function(_0x46250b,_0x35cbe2){return db[_0x25a9('0x28')][_0x25a9('0x43')]({'where':{'id':_0x46250b[_0x25a9('0x41')]['id']}})['then'](handleEntityNotFound(_0x35cbe2,null))[_0x25a9('0x22')](removeEntity(_0x35cbe2,null))[_0x25a9('0x3f')](handleError(_0x35cbe2,null));};exports[_0x25a9('0x46')]=function(_0x38574d,_0x4f7d4a,_0x2166d6){return db[_0x25a9('0x28')][_0x25a9('0x43')]({'where':{'id':_0x38574d['params']['id']},'attributes':['id',_0x25a9('0x47'),_0x25a9('0x48')]})[_0x25a9('0x22')](handleEntityNotFound(_0x4f7d4a,null))[_0x25a9('0x22')](function(_0x27059c){if(_0x27059c){if(!_0x27059c[_0x25a9('0x47')]){throw new db[(_0x25a9('0x49'))][(_0x25a9('0x4a'))](_0x25a9('0x4b'));}var _0x314569={'Content-Type':_0x25a9('0x4c'),'Content-Disposition':'attachment'};if(_0x27059c[_0x25a9('0x48')]){_0x314569[_0x25a9('0x4d')]=_0x25a9('0x4e')+_0x27059c[_0x25a9('0x48')]+_0x25a9('0x4f');}_0x4f7d4a['set'](_0x314569);return _0x4f7d4a[_0x25a9('0x26')](new Buffer(_0x27059c[_0x25a9('0x47')]));}})['catch'](handleError(_0x4f7d4a,null));}; \ No newline at end of file +var _0x278a=['../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceMailMessage','type','key','model','differenceBy','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','options','find','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','msg_id','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x522c6d,_0x4d250d){var _0x26300d=function(_0x3ab228){while(--_0x3ab228){_0x522c6d['push'](_0x522c6d['shift']());}};_0x26300d(++_0x4d250d);}(_0x278a,0x1ed));var _0xa278=function(_0x3f7fb1,_0x25df7a){_0x3f7fb1=_0x3f7fb1-0x0;var _0x29bcd4=_0x278a[_0x3f7fb1];return _0x29bcd4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa278('0x0'));var zipdir=require(_0xa278('0x1'));var jsonpatch=require(_0xa278('0x2'));var rp=require(_0xa278('0x3'));var moment=require(_0xa278('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa278('0x5'));var util=require(_0xa278('0x6'));var path=require(_0xa278('0x7'));var sox=require(_0xa278('0x8'));var csv=require(_0xa278('0x9'));var ejs=require(_0xa278('0xa'));var fs=require('fs');var fs_extra=require(_0xa278('0xb'));var _=require(_0xa278('0xc'));var squel=require(_0xa278('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa278('0xe'));var toCsv=require(_0xa278('0x9'));var querystring=require(_0xa278('0xf'));var Papa=require(_0xa278('0x10'));var Redis=require(_0xa278('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa278('0x12'));var as=require(_0xa278('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa278('0x14'))(_0xa278('0x15'));var utils=require(_0xa278('0x16'));var config=require(_0xa278('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa278('0x18'))['db'];function respondWithStatusCode(_0x11269e,_0x2adfcb){_0x2adfcb=_0x2adfcb||0xcc;return function(_0x5f36fc){if(_0x5f36fc){return _0x11269e[_0xa278('0x19')](_0x2adfcb);}return _0x11269e['status'](_0x2adfcb)[_0xa278('0x1a')]();};}function respondWithResult(_0x3c87d3,_0x234e0b){_0x234e0b=_0x234e0b||0xc8;return function(_0x4ac134){if(_0x4ac134){return _0x3c87d3[_0xa278('0x1b')](_0x234e0b)[_0xa278('0x1c')](_0x4ac134);}};}function respondWithFilteredResult(_0x569617,_0x2cc2b4){return function(_0x49d0ab){if(_0x49d0ab){var _0x32a6dc=typeof _0x2cc2b4[_0xa278('0x1d')]===_0xa278('0x1e')&&typeof _0x2cc2b4[_0xa278('0x1f')]===_0xa278('0x1e');var _0x1f0e43=_0x49d0ab[_0xa278('0x20')];var _0xd1887=_0x32a6dc?0x0:_0x2cc2b4['offset'];var _0x3b3305=_0x32a6dc?_0x49d0ab[_0xa278('0x20')]:_0x2cc2b4['offset']+_0x2cc2b4[_0xa278('0x1f')];var _0x3ff92f;if(_0x3b3305>=_0x1f0e43){_0x3b3305=_0x1f0e43;_0x3ff92f=0xc8;}else{_0x3ff92f=0xce;}_0x569617[_0xa278('0x1b')](_0x3ff92f);return _0x569617[_0xa278('0x21')]('Content-Range',_0xd1887+'-'+_0x3b3305+'/'+_0x1f0e43)[_0xa278('0x1c')](_0x49d0ab);}return null;};}function patchUpdates(_0x3cf3b7){return function(_0xf8eedd){try{jsonpatch[_0xa278('0x22')](_0xf8eedd,_0x3cf3b7,!![]);}catch(_0x2b686c){return BPromise[_0xa278('0x23')](_0x2b686c);}return _0xf8eedd[_0xa278('0x24')]();};}function saveUpdates(_0x42ac63,_0x45fad6){return function(_0x4d8b6e){if(_0x4d8b6e){return _0x4d8b6e[_0xa278('0x25')](_0x42ac63)[_0xa278('0x26')](function(_0x264030){return _0x264030;});}return null;};}function removeEntity(_0x4ba840,_0xfca122){return function(_0x2a9b98){if(_0x2a9b98){return _0x2a9b98[_0xa278('0x27')]()[_0xa278('0x26')](function(){_0x4ba840[_0xa278('0x1b')](0xcc)[_0xa278('0x1a')]();});}};}function handleEntityNotFound(_0x33709a,_0xa27b89){return function(_0x29c1ba){if(!_0x29c1ba){_0x33709a[_0xa278('0x19')](0x194);}return _0x29c1ba;};}function handleError(_0x10e997,_0x4be2fa){_0x4be2fa=_0x4be2fa||0x1f4;return function(_0x32cf1e){logger[_0xa278('0x28')](_0x32cf1e[_0xa278('0x29')]);if(_0x32cf1e[_0xa278('0x2a')]){delete _0x32cf1e[_0xa278('0x2a')];}_0x10e997[_0xa278('0x1b')](_0x4be2fa)[_0xa278('0x2b')](_0x32cf1e);};}exports['index']=function(_0x3bb2bc,_0x50bb9c){var _0x485356={},_0x18b951={},_0x24c47f={'count':0x0,'rows':[]};var _0x6f85eb=_[_0xa278('0x2c')](db[_0xa278('0x2d')]['rawAttributes'],function(_0x54db7d){return{'name':_0x54db7d['fieldName'],'type':_0x54db7d[_0xa278('0x2e')][_0xa278('0x2f')]};});_0x18b951[_0xa278('0x30')]=_[_0xa278('0x31')](_[_0xa278('0x2c')](_0x6f85eb,_0xa278('0x2a')),[_0xa278('0x2a')]);_0x18b951[_0xa278('0x32')]=_['keys'](_0x3bb2bc[_0xa278('0x32')]);_0x18b951[_0xa278('0x33')]=_['intersection'](_0x18b951[_0xa278('0x30')],_0x18b951['query']);_0x485356[_0xa278('0x34')]=_[_0xa278('0x35')](_0x18b951[_0xa278('0x30')],qs['fields'](_0x3bb2bc['query'][_0xa278('0x36')]));_0x485356[_0xa278('0x34')]=_0x485356[_0xa278('0x34')]['length']?_0x485356['attributes']:_0x18b951['model'];if(!_0x3bb2bc['query'][_0xa278('0x37')](_0xa278('0x38'))){_0x485356[_0xa278('0x1f')]=qs[_0xa278('0x1f')](_0x3bb2bc[_0xa278('0x32')][_0xa278('0x1f')]);_0x485356[_0xa278('0x1d')]=qs[_0xa278('0x1d')](_0x3bb2bc[_0xa278('0x32')][_0xa278('0x1d')]);}_0x485356[_0xa278('0x39')]=qs[_0xa278('0x3a')](_0x3bb2bc[_0xa278('0x32')][_0xa278('0x3a')]);_0x485356[_0xa278('0x3b')]=qs['filters'](_['pick'](_0x3bb2bc[_0xa278('0x32')],_0x18b951['filters']),_0x6f85eb);if(_0x3bb2bc[_0xa278('0x32')][_0xa278('0x3c')]){_0x485356[_0xa278('0x3b')]=_[_0xa278('0x3d')](_0x485356[_0xa278('0x3b')],{'$or':_[_0xa278('0x2c')](_0x6f85eb,function(_0xfabce9){if(_0xfabce9[_0xa278('0x2e')]!==_0xa278('0x3e')){var _0x3a172e={};_0x3a172e[_0xfabce9[_0xa278('0x2a')]]={'$like':'%'+_0x3bb2bc[_0xa278('0x32')][_0xa278('0x3c')]+'%'};return _0x3a172e;}})});}_0x485356=_['merge']({},_0x485356,_0x3bb2bc['options']);var _0x3fdb4e={'where':_0x485356[_0xa278('0x3b')]};return db[_0xa278('0x2d')][_0xa278('0x20')](_0x3fdb4e)[_0xa278('0x26')](function(_0x1af5e7){_0x24c47f['count']=_0x1af5e7;if(_0x3bb2bc[_0xa278('0x32')][_0xa278('0x3f')]){_0x485356[_0xa278('0x40')]=[{'all':!![]}];}return db[_0xa278('0x2d')][_0xa278('0x41')](_0x485356);})[_0xa278('0x26')](function(_0x45ef4a){_0x24c47f[_0xa278('0x42')]=_0x45ef4a;return _0x24c47f;})[_0xa278('0x26')](respondWithFilteredResult(_0x50bb9c,_0x485356))[_0xa278('0x43')](handleError(_0x50bb9c,null));};exports['show']=function(_0x924a32,_0x4395d6){var _0x1308b9={'raw':!![],'where':{'id':_0x924a32[_0xa278('0x44')]['id']}},_0x8e5e86={};_0x8e5e86[_0xa278('0x30')]=_[_0xa278('0x45')](db[_0xa278('0x2d')][_0xa278('0x46')]);_0x8e5e86[_0xa278('0x32')]=_['keys'](_0x924a32[_0xa278('0x32')]);_0x8e5e86['filters']=_[_0xa278('0x35')](_0x8e5e86[_0xa278('0x30')],_0x8e5e86[_0xa278('0x32')]);_0x1308b9[_0xa278('0x34')]=_[_0xa278('0x35')](_0x8e5e86['model'],qs[_0xa278('0x36')](_0x924a32[_0xa278('0x32')][_0xa278('0x36')]));_0x1308b9[_0xa278('0x34')]=_0x1308b9['attributes']['length']?_0x1308b9[_0xa278('0x34')]:_0x8e5e86['model'];if(_0x924a32[_0xa278('0x32')]['includeAll']){_0x1308b9['include']=[{'all':!![]}];}_0x1308b9=_[_0xa278('0x3d')]({},_0x1308b9,_0x924a32[_0xa278('0x47')]);return db[_0xa278('0x2d')][_0xa278('0x48')](_0x1308b9)[_0xa278('0x26')](handleEntityNotFound(_0x4395d6,null))[_0xa278('0x26')](respondWithResult(_0x4395d6,null))['catch'](handleError(_0x4395d6,null));};exports[_0xa278('0x49')]=function(_0x3fc585,_0x226263){return db['VoiceMailMessage'][_0xa278('0x49')](_0x3fc585[_0xa278('0x4a')],{})['then'](respondWithResult(_0x226263,0xc9))['catch'](handleError(_0x226263,null));};exports[_0xa278('0x25')]=function(_0x31aa34,_0x4a7f6e){if(_0x31aa34['body']['id']){delete _0x31aa34[_0xa278('0x4a')]['id'];}return db[_0xa278('0x2d')][_0xa278('0x48')]({'where':{'id':_0x31aa34['params']['id']}})['then'](handleEntityNotFound(_0x4a7f6e,null))[_0xa278('0x26')](saveUpdates(_0x31aa34['body'],null))[_0xa278('0x26')](respondWithResult(_0x4a7f6e,null))[_0xa278('0x43')](handleError(_0x4a7f6e,null));};exports[_0xa278('0x27')]=function(_0x5db80c,_0x16b85f){return db[_0xa278('0x2d')][_0xa278('0x48')]({'where':{'id':_0x5db80c[_0xa278('0x44')]['id']}})[_0xa278('0x26')](handleEntityNotFound(_0x16b85f,null))['then'](removeEntity(_0x16b85f,null))['catch'](handleError(_0x16b85f,null));};exports[_0xa278('0x4b')]=function(_0x5047b8,_0x149dca,_0x37b001){return db[_0xa278('0x2d')][_0xa278('0x48')]({'where':{'id':_0x5047b8['params']['id']},'attributes':['id',_0xa278('0x4c'),'msg_id']})[_0xa278('0x26')](handleEntityNotFound(_0x149dca,null))[_0xa278('0x26')](function(_0x3aaa64){if(_0x3aaa64){if(!_0x3aaa64['recording']){throw new db[(_0xa278('0x4d'))][(_0xa278('0x4e'))](_0xa278('0x4f'));}var _0x2898ed={'Content-Type':_0xa278('0x50'),'Content-Disposition':_0xa278('0x51')};if(_0x3aaa64['msg_id']){_0x2898ed[_0xa278('0x52')]=_0xa278('0x53')+_0x3aaa64[_0xa278('0x54')]+_0xa278('0x55');}_0x149dca['set'](_0x2898ed);return _0x149dca[_0xa278('0x2b')](new Buffer(_0x3aaa64[_0xa278('0x4c')]));}})['catch'](handleError(_0x149dca,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 0e1e0d7..40e57e1 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 _0x21fa=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x2a5007,_0x3f0a87){var _0x51b6ce=function(_0x4fbf8a){while(--_0x4fbf8a){_0x2a5007['push'](_0x2a5007['shift']());}};_0x51b6ce(++_0x3f0a87);}(_0x21fa,0x1a3));var _0xa21f=function(_0x557e34,_0x29d4d3){_0x557e34=_0x557e34-0x0;var _0x7f8c60=_0x21fa[_0x557e34];return _0x7f8c60;};'use strict';var _=require(_0xa21f('0x0'));var util=require(_0xa21f('0x1'));var logger=require(_0xa21f('0x2'))(_0xa21f('0x3'));var moment=require(_0xa21f('0x4'));var BPromise=require('bluebird');var rp=require(_0xa21f('0x5'));var fs=require('fs');var path=require(_0xa21f('0x6'));var rimraf=require('rimraf');var config=require(_0xa21f('0x7'));var attributes=require(_0xa21f('0x8'));module[_0xa21f('0x9')]=function(_0x3ea9cc,_0x3ab5f7){return _0x3ea9cc[_0xa21f('0xa')](_0xa21f('0xb'),attributes,{'tableName':_0xa21f('0xc'),'paranoid':![],'indexes':[{'name':_0xa21f('0xd'),'fields':[_0xa21f('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x09a7=['dir','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x1feb89,_0x44d8f1){var _0x50662a=function(_0xb4a333){while(--_0xb4a333){_0x1feb89['push'](_0x1feb89['shift']());}};_0x50662a(++_0x44d8f1);}(_0x09a7,0x135));var _0x709a=function(_0x436fea,_0x478789){_0x436fea=_0x436fea-0x0;var _0xf5f925=_0x09a7[_0x436fea];return _0xf5f925;};'use strict';var _=require(_0x709a('0x0'));var util=require(_0x709a('0x1'));var logger=require(_0x709a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x709a('0x3'));var rp=require(_0x709a('0x4'));var fs=require('fs');var path=require(_0x709a('0x5'));var rimraf=require(_0x709a('0x6'));var config=require(_0x709a('0x7'));var attributes=require(_0x709a('0x8'));module[_0x709a('0x9')]=function(_0x2f3f11,_0x920068){return _0x2f3f11[_0x709a('0xa')](_0x709a('0xb'),attributes,{'tableName':_0x709a('0xc'),'paranoid':![],'indexes':[{'name':_0x709a('0xd'),'fields':[_0x709a('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 090d32e..4d251e3 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 _0xe903=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash'];(function(_0x42fe6e,_0x3308e5){var _0x1c9df2=function(_0x2d55aa){while(--_0x2d55aa){_0x42fe6e['push'](_0x42fe6e['shift']());}};_0x1c9df2(++_0x3308e5);}(_0xe903,0x1df));var _0x3e90=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xe903[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x3e90('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3e90('0x1'));var fs=require('fs');var Redis=require(_0x3e90('0x2'));var db=require(_0x3e90('0x3'))['db'];var utils=require(_0x3e90('0x4'));var logger=require(_0x3e90('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3e90('0x6'));var client=jayson[_0x3e90('0x7')][_0x3e90('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c5302,_0x5003fe,_0xb7abc5){return new BPromise(function(_0xae4341,_0x57ebd1){return client[_0x3e90('0x9')](_0x4c5302,_0xb7abc5)[_0x3e90('0xa')](function(_0x342e0e){logger[_0x3e90('0xb')](_0x3e90('0xc'),_0x5003fe,_0x3e90('0xd'));logger[_0x3e90('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x5003fe,_0x3e90('0xd'),JSON['stringify'](_0x342e0e));if(_0x342e0e['error']){if(_0x342e0e[_0x3e90('0xf')][_0x3e90('0x10')]===0x1f4){logger[_0x3e90('0xf')](_0x3e90('0xc'),_0x5003fe,_0x342e0e[_0x3e90('0xf')][_0x3e90('0x11')]);return _0x57ebd1(_0x342e0e['error'][_0x3e90('0x11')]);}logger[_0x3e90('0xf')](_0x3e90('0xc'),_0x5003fe,_0x342e0e[_0x3e90('0xf')]['message']);return _0xae4341(_0x342e0e[_0x3e90('0xf')]['message']);}else{logger[_0x3e90('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x5003fe,_0x3e90('0xd'));_0xae4341(_0x342e0e[_0x3e90('0x12')][_0x3e90('0x11')]);}})[_0x3e90('0x13')](function(_0xe84477){logger[_0x3e90('0xf')](_0x3e90('0xc'),_0x5003fe,_0xe84477);_0x57ebd1(_0xe84477);});});} \ No newline at end of file +var _0xb5d4=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4d50e0,_0x1d452f){var _0x28be61=function(_0x57c064){while(--_0x57c064){_0x4d50e0['push'](_0x4d50e0['shift']());}};_0x28be61(++_0x1d452f);}(_0xb5d4,0x1bf));var _0x4b5d=function(_0x967762,_0x220c17){_0x967762=_0x967762-0x0;var _0x548930=_0xb5d4[_0x967762];return _0x548930;};'use strict';var _=require(_0x4b5d('0x0'));var util=require(_0x4b5d('0x1'));var moment=require(_0x4b5d('0x2'));var BPromise=require(_0x4b5d('0x3'));var rs=require(_0x4b5d('0x4'));var fs=require('fs');var Redis=require(_0x4b5d('0x5'));var db=require(_0x4b5d('0x6'))['db'];var utils=require(_0x4b5d('0x7'));var logger=require(_0x4b5d('0x8'))('rpc');var config=require(_0x4b5d('0x9'));var jayson=require(_0x4b5d('0xa'));var client=jayson[_0x4b5d('0xb')][_0x4b5d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x353c7c,_0x2cb1b7,_0xce4069){return new BPromise(function(_0x5be45e,_0x654d87){return client[_0x4b5d('0xd')](_0x353c7c,_0xce4069)[_0x4b5d('0xe')](function(_0x5adb1f){logger[_0x4b5d('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x2cb1b7,_0x4b5d('0x10'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x2cb1b7,_0x4b5d('0x10'),JSON[_0x4b5d('0x11')](_0x5adb1f));if(_0x5adb1f[_0x4b5d('0x12')]){if(_0x5adb1f[_0x4b5d('0x12')][_0x4b5d('0x13')]===0x1f4){logger['error'](_0x4b5d('0x14'),_0x2cb1b7,_0x5adb1f[_0x4b5d('0x12')][_0x4b5d('0x15')]);return _0x654d87(_0x5adb1f['error'][_0x4b5d('0x15')]);}logger[_0x4b5d('0x12')](_0x4b5d('0x14'),_0x2cb1b7,_0x5adb1f[_0x4b5d('0x12')]['message']);return _0x5be45e(_0x5adb1f[_0x4b5d('0x12')]['message']);}else{logger[_0x4b5d('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x2cb1b7,_0x4b5d('0x10'));_0x5be45e(_0x5adb1f[_0x4b5d('0x16')][_0x4b5d('0x15')]);}})[_0x4b5d('0x17')](function(_0x389dd7){logger[_0x4b5d('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x2cb1b7,_0x389dd7);_0x654d87(_0x389dd7);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 9c8eac6..2e4d3d2 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 _0x8c3b=['post','addSound','put','update','destroy','delete','removeSound','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id/sounds'];(function(_0x4fae14,_0x4ef118){var _0x305e46=function(_0x3f4c4a){while(--_0x3f4c4a){_0x4fae14['push'](_0x4fae14['shift']());}};_0x305e46(++_0x4ef118);}(_0x8c3b,0x94));var _0xb8c3=function(_0x5c62fb,_0x4f913b){_0x5c62fb=_0x5c62fb-0x0;var _0x4a8f34=_0x8c3b[_0x5c62fb];return _0x4a8f34;};'use strict';var multer=require(_0xb8c3('0x0'));var util=require('util');var path=require(_0xb8c3('0x1'));var timeout=require(_0xb8c3('0x2'));var express=require(_0xb8c3('0x3'));var router=express['Router']();var fs_extra=require(_0xb8c3('0x4'));var auth=require(_0xb8c3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb8c3('0x6'));var controller=require(_0xb8c3('0x7'));router[_0xb8c3('0x8')]('/',auth[_0xb8c3('0x9')](),controller[_0xb8c3('0xa')]);router['get']('/:id',auth[_0xb8c3('0x9')](),controller['show']);router[_0xb8c3('0x8')](_0xb8c3('0xb'),auth['isAuthenticated'](),controller['getSounds']);router[_0xb8c3('0xc')]('/',auth[_0xb8c3('0x9')](),controller['create']);router['post'](_0xb8c3('0xb'),auth[_0xb8c3('0x9')](),controller[_0xb8c3('0xd')]);router[_0xb8c3('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb8c3('0xf')]);router['delete']('/:id',auth[_0xb8c3('0x9')](),controller[_0xb8c3('0x10')]);router[_0xb8c3('0x11')]('/:id/sounds/:id2',auth[_0xb8c3('0x9')](),controller[_0xb8c3('0x12')]);module[_0xb8c3('0x13')]=router; \ No newline at end of file +var _0x5203=['get','isAuthenticated','index','show','/:id/sounds','getSounds','post','create','addSound','put','/:id','update','delete','destroy','removeSound','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller'];(function(_0x208bc9,_0x4f36f6){var _0x2675a8=function(_0x452e72){while(--_0x452e72){_0x208bc9['push'](_0x208bc9['shift']());}};_0x2675a8(++_0x4f36f6);}(_0x5203,0xa6));var _0x3520=function(_0x2ce56b,_0x3c282a){_0x2ce56b=_0x2ce56b-0x0;var _0x34f137=_0x5203[_0x2ce56b];return _0x34f137;};'use strict';var multer=require(_0x3520('0x0'));var util=require(_0x3520('0x1'));var path=require(_0x3520('0x2'));var timeout=require(_0x3520('0x3'));var express=require('express');var router=express[_0x3520('0x4')]();var fs_extra=require(_0x3520('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3520('0x6'));var config=require(_0x3520('0x7'));var controller=require(_0x3520('0x8'));router[_0x3520('0x9')]('/',auth[_0x3520('0xa')](),controller[_0x3520('0xb')]);router[_0x3520('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3520('0xc')]);router[_0x3520('0x9')](_0x3520('0xd'),auth[_0x3520('0xa')](),controller[_0x3520('0xe')]);router[_0x3520('0xf')]('/',auth[_0x3520('0xa')](),controller[_0x3520('0x10')]);router[_0x3520('0xf')]('/:id/sounds',auth[_0x3520('0xa')](),controller[_0x3520('0x11')]);router[_0x3520('0x12')](_0x3520('0x13'),auth['isAuthenticated'](),controller[_0x3520('0x14')]);router[_0x3520('0x15')](_0x3520('0x13'),auth[_0x3520('0xa')](),controller[_0x3520('0x16')]);router[_0x3520('0x15')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0x3520('0x17')]);module[_0x3520('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 9e9ca62..334f0e3 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 _0xbfd5=['exports','STRING','name','ENUM','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','sequelize'];(function(_0x22ac4d,_0x3a791c){var _0x3301cb=function(_0x3b0116){while(--_0x3b0116){_0x22ac4d['push'](_0x22ac4d['shift']());}};_0x3301cb(++_0x3a791c);}(_0xbfd5,0x78));var _0x5bfd=function(_0x1da85f,_0x922b5d){_0x1da85f=_0x1da85f-0x0;var _0x5b539c=_0xbfd5[_0x1da85f];return _0x5b539c;};'use strict';var Sequelize=require(_0x5bfd('0x0'));module[_0x5bfd('0x1')]={'name':{'type':Sequelize[_0x5bfd('0x2')],'allowNull':![],'unique':_0x5bfd('0x3')},'mode':{'type':Sequelize[_0x5bfd('0x4')]('custom',_0x5bfd('0x5'),_0x5bfd('0x6'),_0x5bfd('0x7'),_0x5bfd('0x8'),_0x5bfd('0x9')),'allowNull':!![],'defaultValue':_0x5bfd('0x5')},'directory':{'type':Sequelize[_0x5bfd('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x5bfd('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x5bfd('0x2')],'allowNull':!![],'defaultValue':_0x5bfd('0xa')},'format':{'type':Sequelize[_0x5bfd('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x866e=['sequelize','exports','name','custom','mp3nb','quietmp3nb','quietmp3','STRING','alpha','TIMESTAMP','BOOLEAN'];(function(_0x367a28,_0x474e97){var _0x1fa2fa=function(_0x42edf8){while(--_0x42edf8){_0x367a28['push'](_0x367a28['shift']());}};_0x1fa2fa(++_0x474e97);}(_0x866e,0x1ce));var _0xe866=function(_0x283a77,_0x5b0acb){_0x283a77=_0x283a77-0x0;var _0x4471e3=_0x866e[_0x283a77];return _0x4471e3;};'use strict';var Sequelize=require(_0xe866('0x0'));module[_0xe866('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe866('0x2')},'mode':{'type':Sequelize['ENUM'](_0xe866('0x3'),'files',_0xe866('0x4'),_0xe866('0x5'),_0xe866('0x6'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xe866('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0xe866('0x7')],'allowNull':!![]},'digit':{'type':Sequelize[_0xe866('0x7')],'allowNull':!![]},'sort':{'type':Sequelize[_0xe866('0x7')],'allowNull':!![],'defaultValue':_0xe866('0x8')},'format':{'type':Sequelize[_0xe866('0x7')],'allowNull':!![]},'stamp':{'type':_0xe866('0x9')},'defaultEntry':{'type':Sequelize[_0xe866('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 e8de3d3..db42565 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 _0xde9d=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','then','get','MusicOnHolds','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VoiceMusicOnHold','include','findAll','rows','catch','show','params','length','includeAll','find','body','sequelize','transaction','mode','directory','join','root','server/files/moh','mkdirSync','0777','user','role','userProfileId','autoAssociation','create','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','Sound','pick','getSounds','hasOwnProperty','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x19bc19,_0x359f1f){var _0x1c510b=function(_0x32c037){while(--_0x32c037){_0x19bc19['push'](_0x19bc19['shift']());}};_0x1c510b(++_0x359f1f);}(_0xde9d,0xcd));var _0xdde9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde9d[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xdde9('0x0'));var rimraf=require(_0xdde9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdde9('0x2'));var BPromise=require(_0xdde9('0x3'));var Mustache=require(_0xdde9('0x4'));var util=require(_0xdde9('0x5'));var path=require(_0xdde9('0x6'));var sox=require(_0xdde9('0x7'));var csv=require(_0xdde9('0x8'));var ejs=require(_0xdde9('0x9'));var fs=require('fs');var fs_extra=require(_0xdde9('0xa'));var _=require(_0xdde9('0xb'));var squel=require(_0xdde9('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdde9('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdde9('0xe'));var Papa=require(_0xdde9('0xf'));var Redis=require('ioredis');var authService=require(_0xdde9('0x10'));var qs=require(_0xdde9('0x11'));var as=require(_0xdde9('0x12'));var hardwareService=require(_0xdde9('0x13'));var logger=require(_0xdde9('0x14'))(_0xdde9('0x15'));var utils=require('../../config/utils');var config=require(_0xdde9('0x16'));var licenseUtil=require(_0xdde9('0x17'));var db=require(_0xdde9('0x18'))['db'];function respondWithStatusCode(_0x3e6218,_0x522777){_0x522777=_0x522777||0xcc;return function(_0x2196f2){if(_0x2196f2){return _0x3e6218[_0xdde9('0x19')](_0x522777);}return _0x3e6218[_0xdde9('0x1a')](_0x522777)[_0xdde9('0x1b')]();};}function respondWithResult(_0x9a0635,_0x1191f0){_0x1191f0=_0x1191f0||0xc8;return function(_0x1669be){if(_0x1669be){return _0x9a0635[_0xdde9('0x1a')](_0x1191f0)[_0xdde9('0x1c')](_0x1669be);}};}function respondWithFilteredResult(_0x261639,_0x25b146){return function(_0x59fd60){if(_0x59fd60){var _0x44371b=typeof _0x25b146[_0xdde9('0x1d')]===_0xdde9('0x1e')&&typeof _0x25b146['limit']===_0xdde9('0x1e');var _0x16e2f4=_0x59fd60[_0xdde9('0x1f')];var _0x43b166=_0x44371b?0x0:_0x25b146['offset'];var _0x87fa55=_0x44371b?_0x59fd60['count']:_0x25b146[_0xdde9('0x1d')]+_0x25b146[_0xdde9('0x20')];var _0x584e96;if(_0x87fa55>=_0x16e2f4){_0x87fa55=_0x16e2f4;_0x584e96=0xc8;}else{_0x584e96=0xce;}_0x261639[_0xdde9('0x1a')](_0x584e96);return _0x261639[_0xdde9('0x21')](_0xdde9('0x22'),_0x43b166+'-'+_0x87fa55+'/'+_0x16e2f4)[_0xdde9('0x1c')](_0x59fd60);}return null;};}function patchUpdates(_0x282725){return function(_0x36debc){try{jsonpatch['apply'](_0x36debc,_0x282725,!![]);}catch(_0x4989ee){return BPromise[_0xdde9('0x23')](_0x4989ee);}return _0x36debc['save']();};}function saveUpdates(_0x30dae1,_0xe0489e){return function(_0x312953){if(_0x312953){return _0x312953[_0xdde9('0x24')](_0x30dae1)['then'](function(_0x55cd82){return _0x55cd82;});}return null;};}function removeEntity(_0x2633ae,_0x3683be){return function(_0x1b6557){if(_0x1b6557){return _0x1b6557[_0xdde9('0x25')]()[_0xdde9('0x26')](function(){var _0x1ac860=_0x1b6557[_0xdde9('0x27')]({'plain':!![]});var _0x3cbe42=_0xdde9('0x28');return db[_0xdde9('0x29')][_0xdde9('0x25')]({'where':{'type':_0x3cbe42,'resourceId':_0x1ac860['id']}})[_0xdde9('0x26')](function(){return _0x1b6557;});})['then'](function(){_0x2633ae[_0xdde9('0x1a')](0xcc)[_0xdde9('0x1b')]();});}};}function handleEntityNotFound(_0x3c1b6a,_0x56c183){return function(_0xfa147d){if(!_0xfa147d){_0x3c1b6a[_0xdde9('0x19')](0x194);}return _0xfa147d;};}function handleError(_0x2cf983,_0x7b0d58){_0x7b0d58=_0x7b0d58||0x1f4;return function(_0xb1ba43){logger[_0xdde9('0x2a')](_0xb1ba43['stack']);if(_0xb1ba43['name']){delete _0xb1ba43[_0xdde9('0x2b')];}_0x2cf983[_0xdde9('0x1a')](_0x7b0d58)[_0xdde9('0x2c')](_0xb1ba43);};}exports[_0xdde9('0x2d')]=function(_0xf0d17b,_0x177e56){var _0x4e2517={},_0x521acf={},_0x3a66a7={'count':0x0,'rows':[]};var _0x40d33c=_[_0xdde9('0x2e')](db['VoiceMusicOnHold'][_0xdde9('0x2f')],function(_0x5cfafe){return{'name':_0x5cfafe[_0xdde9('0x30')],'type':_0x5cfafe[_0xdde9('0x31')][_0xdde9('0x32')]};});_0x521acf[_0xdde9('0x33')]=_[_0xdde9('0x2e')](_0x40d33c,_0xdde9('0x2b'));_0x521acf[_0xdde9('0x34')]=_[_0xdde9('0x35')](_0xf0d17b[_0xdde9('0x34')]);_0x521acf[_0xdde9('0x36')]=_[_0xdde9('0x37')](_0x521acf[_0xdde9('0x33')],_0x521acf[_0xdde9('0x34')]);_0x4e2517[_0xdde9('0x38')]=_[_0xdde9('0x37')](_0x521acf[_0xdde9('0x33')],qs[_0xdde9('0x39')](_0xf0d17b[_0xdde9('0x34')][_0xdde9('0x39')]));_0x4e2517[_0xdde9('0x38')]=_0x4e2517[_0xdde9('0x38')]['length']?_0x4e2517[_0xdde9('0x38')]:_0x521acf[_0xdde9('0x33')];if(!_0xf0d17b['query']['hasOwnProperty'](_0xdde9('0x3a'))){_0x4e2517[_0xdde9('0x20')]=qs['limit'](_0xf0d17b[_0xdde9('0x34')][_0xdde9('0x20')]);_0x4e2517['offset']=qs[_0xdde9('0x1d')](_0xf0d17b['query'][_0xdde9('0x1d')]);}_0x4e2517[_0xdde9('0x3b')]=qs[_0xdde9('0x3c')](_0xf0d17b[_0xdde9('0x34')][_0xdde9('0x3c')]);delete _0xf0d17b[_0xdde9('0x34')][_0xdde9('0x3c')];_0x4e2517[_0xdde9('0x3d')]=qs['filters'](_['pick'](_0xf0d17b[_0xdde9('0x34')],_0x521acf[_0xdde9('0x36')]),_0x40d33c);if(_0xf0d17b[_0xdde9('0x34')][_0xdde9('0x3e')]){_0x4e2517[_0xdde9('0x3d')]=_[_0xdde9('0x3f')](_0x4e2517['where'],{'$or':_[_0xdde9('0x2e')](_0x40d33c,function(_0x54e693){if(_0x54e693[_0xdde9('0x31')]!==_0xdde9('0x40')){var _0x5988a9={};_0x5988a9[_0x54e693['name']]={'$like':'%'+_0xf0d17b[_0xdde9('0x34')][_0xdde9('0x3e')]+'%'};return _0x5988a9;}})});}_0x4e2517=_[_0xdde9('0x3f')]({},_0x4e2517,_0xf0d17b[_0xdde9('0x41')]);var _0x19d5d9={'where':_0x4e2517['where']};return db[_0xdde9('0x42')]['count'](_0x19d5d9)['then'](function(_0x5cea06){_0x3a66a7[_0xdde9('0x1f')]=_0x5cea06;if(_0xf0d17b['query']['includeAll']){_0x4e2517[_0xdde9('0x43')]=[{'all':!![]}];}return db[_0xdde9('0x42')][_0xdde9('0x44')](_0x4e2517);})[_0xdde9('0x26')](function(_0xc4febe){_0x3a66a7[_0xdde9('0x45')]=_0xc4febe;return _0x3a66a7;})[_0xdde9('0x26')](respondWithFilteredResult(_0x177e56,_0x4e2517))[_0xdde9('0x46')](handleError(_0x177e56,null));};exports[_0xdde9('0x47')]=function(_0x2d5266,_0x2995a6){var _0x1974b5={'raw':![],'where':{'id':_0x2d5266[_0xdde9('0x48')]['id']}},_0x42c3f6={};_0x42c3f6[_0xdde9('0x33')]=_[_0xdde9('0x35')](db[_0xdde9('0x42')][_0xdde9('0x2f')]);_0x42c3f6[_0xdde9('0x34')]=_['keys'](_0x2d5266[_0xdde9('0x34')]);_0x42c3f6[_0xdde9('0x36')]=_[_0xdde9('0x37')](_0x42c3f6[_0xdde9('0x33')],_0x42c3f6[_0xdde9('0x34')]);_0x1974b5[_0xdde9('0x38')]=_[_0xdde9('0x37')](_0x42c3f6[_0xdde9('0x33')],qs[_0xdde9('0x39')](_0x2d5266[_0xdde9('0x34')]['fields']));_0x1974b5[_0xdde9('0x38')]=_0x1974b5['attributes'][_0xdde9('0x49')]?_0x1974b5['attributes']:_0x42c3f6['model'];if(_0x2d5266[_0xdde9('0x34')][_0xdde9('0x4a')]){_0x1974b5[_0xdde9('0x43')]=[{'all':!![]}];}_0x1974b5=_[_0xdde9('0x3f')]({},_0x1974b5,_0x2d5266[_0xdde9('0x41')]);return db['VoiceMusicOnHold'][_0xdde9('0x4b')](_0x1974b5)[_0xdde9('0x26')](handleEntityNotFound(_0x2995a6,null))[_0xdde9('0x26')](respondWithResult(_0x2995a6,null))[_0xdde9('0x46')](handleError(_0x2995a6,null));};exports['update']=function(_0x4b6104,_0x294e92){if(_0x4b6104['body']['id']){delete _0x4b6104[_0xdde9('0x4c')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x4b6104[_0xdde9('0x48')]['id']}})[_0xdde9('0x26')](handleEntityNotFound(_0x294e92,null))[_0xdde9('0x26')](saveUpdates(_0x4b6104[_0xdde9('0x4c')],null))['then'](respondWithResult(_0x294e92,null))[_0xdde9('0x46')](handleError(_0x294e92,null));};exports['create']=function(_0x17fb15,_0x18a9e8,_0x38d8f5){return db[_0xdde9('0x4d')][_0xdde9('0x4e')](function(_0x5409ea){if(_0x17fb15[_0xdde9('0x4c')][_0xdde9('0x4f')]==='files'){_0x17fb15[_0xdde9('0x4c')][_0xdde9('0x50')]=path[_0xdde9('0x51')](config[_0xdde9('0x52')],_0xdde9('0x53'),_0x17fb15[_0xdde9('0x4c')]['name']);}return db['VoiceMusicOnHold']['create'](_0x17fb15[_0xdde9('0x4c')],{'transaction':_0x5409ea})['then'](function(_0x4e00e5){if(_0x17fb15[_0xdde9('0x4c')][_0xdde9('0x4f')]==='files'){fs[_0xdde9('0x54')](_0x4e00e5[_0xdde9('0x50')],parseInt(_0xdde9('0x55'),0x8));}var _0x203501=_0x17fb15[_0xdde9('0x56')][_0xdde9('0x27')]({'plain':!![]});if(!_0x203501)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x203501[_0xdde9('0x57')]===_0xdde9('0x56')){var _0x1e1a25=_0x4e00e5['get']({'plain':!![]});return db['UserProfileSection'][_0xdde9('0x4b')]({'where':{'name':_0xdde9('0x28'),'userProfileId':_0x203501[_0xdde9('0x58')]},'raw':!![]})[_0xdde9('0x26')](function(_0x185e4a){if(_0x185e4a&&_0x185e4a[_0xdde9('0x59')]===0x0){return db[_0xdde9('0x29')][_0xdde9('0x5a')]({'name':_0x1e1a25['name'],'resourceId':_0x1e1a25['id'],'type':_0x185e4a['name'],'sectionId':_0x185e4a['id']},{})['then'](function(){return _0x4e00e5;});}else{return _0x4e00e5;}})['catch'](function(_0x6199c8){logger[_0xdde9('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6199c8);});}return _0x4e00e5;});})['then'](respondWithResult(_0x18a9e8,0xc9))[_0xdde9('0x46')](handleError(_0x18a9e8,null));};exports[_0xdde9('0x25')]=function(_0x103db6,_0x3db2e0,_0x31d9c9){var _0x540c8b;return db[_0xdde9('0x42')][_0xdde9('0x4b')]({'where':{'id':_0x103db6[_0xdde9('0x48')]['id']}})[_0xdde9('0x26')](function(_0x2a45df){if(_0x2a45df){return db[_0xdde9('0x4d')][_0xdde9('0x4e')](function(_0x3374ea){return _0x2a45df['destroy']({'transaction':_0x3374ea,'raw':!![]})[_0xdde9('0x26')](function(_0x232b51){if(_0x232b51[_0xdde9('0x50')]){fs['readdirSync'](_0x232b51['directory'])['forEach'](function(_0x465341){fs[_0xdde9('0x5b')](path[_0xdde9('0x51')](_0x232b51[_0xdde9('0x50')],_0x465341));});fs[_0xdde9('0x5c')](_0x232b51[_0xdde9('0x50')]);}return _0x232b51;});})['catch'](function(_0x13672c){throw new db[(_0xdde9('0x5d'))][(_0xdde9('0x5e'))](_0x13672c[_0xdde9('0x5f')]);});}})[_0xdde9('0x26')](handleEntityNotFound(_0x3db2e0,null))[_0xdde9('0x26')](removeEntity(_0x3db2e0,null))[_0xdde9('0x46')](handleError(_0x3db2e0,null));};exports['addSound']=function(_0x9577d4,_0x3e7d1b,_0x2393da){return db[_0xdde9('0x4d')]['transaction'](function(_0x5b8290){var _0x4b6cf7;return db[_0xdde9('0x42')][_0xdde9('0x4b')]({'where':{'id':_0x9577d4[_0xdde9('0x48')]['id']}})['then'](function(_0xaa89a3){if(_0xaa89a3){_0x4b6cf7=_0xaa89a3;return _0xaa89a3[_0xdde9('0x60')](_0x9577d4[_0xdde9('0x4c')]['id'],{'transaction':_0x5b8290});}})[_0xdde9('0x26')](function(_0x235a4a){if(_0x235a4a){return db['Sound'][_0xdde9('0x61')]({'where':{'id':_0x9577d4[_0xdde9('0x4c')]['id']},'attributes':['id','name',_0xdde9('0x62'),_0xdde9('0x63'),_0xdde9('0x64')],'raw':!![]});}})['then'](function(_0x20cf40){if(_0x20cf40){var _0xfae90=path[_0xdde9('0x51')](config['root'],_0xdde9('0x65'),util[_0xdde9('0x66')](_0xdde9('0x67'),path[_0xdde9('0x68')](_0x20cf40[_0xdde9('0x62')],path[_0xdde9('0x69')](_0x20cf40[_0xdde9('0x62')])),_0x20cf40[_0xdde9('0x63')]));var _0x3114f6=path['join'](config[_0xdde9('0x52')],_0xdde9('0x53'),_0x4b6cf7[_0xdde9('0x2b')],util[_0xdde9('0x66')](_0xdde9('0x67'),_0x20cf40[_0xdde9('0x2b')],_0x20cf40[_0xdde9('0x63')]));fs[_0xdde9('0x6a')](_0xfae90,_0x3114f6);return _0x20cf40;}})[_0xdde9('0x46')](function(_0x133d1e){throw new db[(_0xdde9('0x5d'))][(_0xdde9('0x5e'))](_0x133d1e[_0xdde9('0x5f')]);});})['then'](handleEntityNotFound(_0x3e7d1b,null))[_0xdde9('0x26')](respondWithResult(_0x3e7d1b,0xc9))[_0xdde9('0x46')](handleError(_0x3e7d1b,null));};exports[_0xdde9('0x6b')]=function(_0x42ace6,_0x1ec842,_0x4f6202){return db[_0xdde9('0x4d')][_0xdde9('0x4e')](function(_0xd8c7d){var _0x14a96a;return db[_0xdde9('0x42')]['findOne']({'where':{'id':_0x42ace6['params']['id']}})[_0xdde9('0x26')](handleEntityNotFound(_0x1ec842,null))['then'](function(_0x49b504){if(_0x49b504){_0x14a96a=_0x49b504;return _0x49b504[_0xdde9('0x6b')](_0x42ace6[_0xdde9('0x48')][_0xdde9('0x6c')]);}})[_0xdde9('0x26')](function(_0x182dcb){if(_0x182dcb){return db[_0xdde9('0x6d')]['findOne']({'where':{'id':_0x42ace6[_0xdde9('0x48')][_0xdde9('0x6c')]},'attributes':['id',_0xdde9('0x2b'),_0xdde9('0x62'),_0xdde9('0x63'),'createdAt'],'raw':!![]});}})[_0xdde9('0x26')](function(_0x163a18){if(_0x163a18){fs[_0xdde9('0x5b')](path['join'](_0x14a96a[_0xdde9('0x50')],util[_0xdde9('0x66')](_0xdde9('0x67'),_0x163a18[_0xdde9('0x2b')],_0x163a18[_0xdde9('0x63')])));return _0x163a18;}})[_0xdde9('0x46')](function(_0x2ad3a4){throw new db[(_0xdde9('0x5d'))]['ValidationError'](_0x2ad3a4[_0xdde9('0x5f')]);});})[_0xdde9('0x26')](handleEntityNotFound(_0x1ec842,null))[_0xdde9('0x26')](respondWithStatusCode(_0x1ec842,0xcc))[_0xdde9('0x46')](handleError(_0x1ec842,null));};exports['getSounds']=function(_0xb5ed5d,_0x32e84a,_0x54e46d){var _0x16def0={};var _0x33677b={};var _0x39c0c7;var _0x21e924;return db[_0xdde9('0x42')][_0xdde9('0x61')]({'where':{'id':_0xb5ed5d[_0xdde9('0x48')]['id']}})[_0xdde9('0x26')](handleEntityNotFound(_0x32e84a,null))[_0xdde9('0x26')](function(_0x201ec8){if(_0x201ec8){_0x39c0c7=_0x201ec8;_0x33677b['model']=_[_0xdde9('0x35')](db[_0xdde9('0x6d')]['rawAttributes']);_0x33677b[_0xdde9('0x34')]=_[_0xdde9('0x35')](_0xb5ed5d[_0xdde9('0x34')]);_0x33677b['filters']=_[_0xdde9('0x37')](_0x33677b[_0xdde9('0x33')],_0x33677b['query']);_0x16def0[_0xdde9('0x38')]=_[_0xdde9('0x37')](_0x33677b[_0xdde9('0x33')],qs[_0xdde9('0x39')](_0xb5ed5d[_0xdde9('0x34')][_0xdde9('0x39')]));_0x16def0[_0xdde9('0x38')]=_0x16def0[_0xdde9('0x38')][_0xdde9('0x49')]?_0x16def0[_0xdde9('0x38')]:_0x33677b[_0xdde9('0x33')];_0x16def0[_0xdde9('0x3b')]=qs[_0xdde9('0x3c')](_0xb5ed5d[_0xdde9('0x34')][_0xdde9('0x3c')]);_0x16def0[_0xdde9('0x3d')]=qs[_0xdde9('0x36')](_[_0xdde9('0x6e')](_0xb5ed5d[_0xdde9('0x34')],_0x33677b[_0xdde9('0x36')]));if(_0xb5ed5d[_0xdde9('0x34')][_0xdde9('0x3e')]){_0x16def0[_0xdde9('0x3d')]=_[_0xdde9('0x3f')](_0x16def0[_0xdde9('0x3d')],{'$or':_[_0xdde9('0x2e')](_0x16def0[_0xdde9('0x38')],function(_0x31217a){var _0x4091ce={};_0x4091ce[_0x31217a]={'$like':'%'+_0xb5ed5d[_0xdde9('0x34')]['filter']+'%'};return _0x4091ce;})});}_0x16def0=_[_0xdde9('0x3f')]({},_0x16def0,_0xb5ed5d[_0xdde9('0x41')]);return _0x39c0c7[_0xdde9('0x6f')](_0x16def0);}})[_0xdde9('0x26')](function(_0x38cb01){if(_0x38cb01){_0x21e924=_0x38cb01[_0xdde9('0x49')];if(!_0xb5ed5d['query'][_0xdde9('0x70')](_0xdde9('0x3a'))){_0x16def0[_0xdde9('0x20')]=qs[_0xdde9('0x20')](_0xb5ed5d[_0xdde9('0x34')]['limit']);_0x16def0[_0xdde9('0x1d')]=qs[_0xdde9('0x1d')](_0xb5ed5d[_0xdde9('0x34')][_0xdde9('0x1d')]);}return _0x39c0c7[_0xdde9('0x6f')](_0x16def0);}})[_0xdde9('0x26')](function(_0x10e286){if(_0x10e286){return _0x10e286?{'count':_0x21e924,'rows':_0x10e286}:null;}})[_0xdde9('0x26')](respondWithResult(_0x32e84a,null))['catch'](handleError(_0x32e84a,null));}; \ No newline at end of file +var _0xafb8=['params','length','includeAll','options','find','body','create','sequelize','transaction','mode','directory','join','root','files','mkdirSync','0777','user','UserProfileSection','MusicOnHolds','autoAssociation','error','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','%s.%s','basename','extname','server/files/moh','format','symlinkSync','ValidationError','message','removeSound','id2','getSounds','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','nolimit','order','sort','pick','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show'];(function(_0x2e727f,_0x44765f){var _0x2a9f1e=function(_0x3f9a3a){while(--_0x3f9a3a){_0x2e727f['push'](_0x2e727f['shift']());}};_0x2a9f1e(++_0x44765f);}(_0xafb8,0x115));var _0x8afb=function(_0x4d042e,_0xa28322){_0x4d042e=_0x4d042e-0x0;var _0x406b7c=_0xafb8[_0x4d042e];return _0x406b7c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8afb('0x0'));var zipdir=require(_0x8afb('0x1'));var jsonpatch=require(_0x8afb('0x2'));var rp=require(_0x8afb('0x3'));var moment=require(_0x8afb('0x4'));var BPromise=require(_0x8afb('0x5'));var Mustache=require(_0x8afb('0x6'));var util=require(_0x8afb('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8afb('0x8'));var ejs=require(_0x8afb('0x9'));var fs=require('fs');var fs_extra=require(_0x8afb('0xa'));var _=require(_0x8afb('0xb'));var squel=require(_0x8afb('0xc'));var crypto=require(_0x8afb('0xd'));var jsforce=require(_0x8afb('0xe'));var deskjs=require(_0x8afb('0xf'));var toCsv=require(_0x8afb('0x8'));var querystring=require(_0x8afb('0x10'));var Papa=require(_0x8afb('0x11'));var Redis=require(_0x8afb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8afb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8afb('0x14'))(_0x8afb('0x15'));var utils=require('../../config/utils');var config=require(_0x8afb('0x16'));var licenseUtil=require(_0x8afb('0x17'));var db=require(_0x8afb('0x18'))['db'];function respondWithStatusCode(_0x57228b,_0x3a3f2b){_0x3a3f2b=_0x3a3f2b||0xcc;return function(_0x4cd3ff){if(_0x4cd3ff){return _0x57228b[_0x8afb('0x19')](_0x3a3f2b);}return _0x57228b[_0x8afb('0x1a')](_0x3a3f2b)[_0x8afb('0x1b')]();};}function respondWithResult(_0xf4e941,_0x2bb90c){_0x2bb90c=_0x2bb90c||0xc8;return function(_0xe39ea3){if(_0xe39ea3){return _0xf4e941['status'](_0x2bb90c)['json'](_0xe39ea3);}};}function respondWithFilteredResult(_0x1cef67,_0xb18dad){return function(_0x4fff11){if(_0x4fff11){var _0x6524f3=typeof _0xb18dad[_0x8afb('0x1c')]==='undefined'&&typeof _0xb18dad[_0x8afb('0x1d')]===_0x8afb('0x1e');var _0x465fcf=_0x4fff11[_0x8afb('0x1f')];var _0x4d49b6=_0x6524f3?0x0:_0xb18dad[_0x8afb('0x1c')];var _0xd5336f=_0x6524f3?_0x4fff11[_0x8afb('0x1f')]:_0xb18dad[_0x8afb('0x1c')]+_0xb18dad['limit'];var _0xddc1ef;if(_0xd5336f>=_0x465fcf){_0xd5336f=_0x465fcf;_0xddc1ef=0xc8;}else{_0xddc1ef=0xce;}_0x1cef67[_0x8afb('0x1a')](_0xddc1ef);return _0x1cef67['set'](_0x8afb('0x20'),_0x4d49b6+'-'+_0xd5336f+'/'+_0x465fcf)[_0x8afb('0x21')](_0x4fff11);}return null;};}function patchUpdates(_0x4d35d1){return function(_0x1144eb){try{jsonpatch[_0x8afb('0x22')](_0x1144eb,_0x4d35d1,!![]);}catch(_0x277459){return BPromise[_0x8afb('0x23')](_0x277459);}return _0x1144eb[_0x8afb('0x24')]();};}function saveUpdates(_0x19edc1,_0x18e396){return function(_0x1b29a7){if(_0x1b29a7){return _0x1b29a7[_0x8afb('0x25')](_0x19edc1)[_0x8afb('0x26')](function(_0xf2763a){return _0xf2763a;});}return null;};}function removeEntity(_0x437e4e,_0x1ea1d8){return function(_0x471b66){if(_0x471b66){return _0x471b66[_0x8afb('0x27')]()[_0x8afb('0x26')](function(){var _0x29d37c=_0x471b66[_0x8afb('0x28')]({'plain':!![]});var _0x111fe4='MusicOnHolds';return db[_0x8afb('0x29')][_0x8afb('0x27')]({'where':{'type':_0x111fe4,'resourceId':_0x29d37c['id']}})['then'](function(){return _0x471b66;});})['then'](function(){_0x437e4e[_0x8afb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9e1b69,_0x9baad){return function(_0x5a71f8){if(!_0x5a71f8){_0x9e1b69[_0x8afb('0x19')](0x194);}return _0x5a71f8;};}function handleError(_0x14824f,_0x1d0e6d){_0x1d0e6d=_0x1d0e6d||0x1f4;return function(_0x47307a){logger['error'](_0x47307a[_0x8afb('0x2a')]);if(_0x47307a[_0x8afb('0x2b')]){delete _0x47307a[_0x8afb('0x2b')];}_0x14824f[_0x8afb('0x1a')](_0x1d0e6d)['send'](_0x47307a);};}exports[_0x8afb('0x2c')]=function(_0x4b458b,_0x5f0df0){var _0x4beab8={},_0x36a0cd={},_0x50ab79={'count':0x0,'rows':[]};var _0xc34c5c=_[_0x8afb('0x2d')](db[_0x8afb('0x2e')][_0x8afb('0x2f')],function(_0x53cd79){return{'name':_0x53cd79[_0x8afb('0x30')],'type':_0x53cd79[_0x8afb('0x31')][_0x8afb('0x32')]};});_0x36a0cd['model']=_['map'](_0xc34c5c,'name');_0x36a0cd[_0x8afb('0x33')]=_[_0x8afb('0x34')](_0x4b458b[_0x8afb('0x33')]);_0x36a0cd['filters']=_[_0x8afb('0x35')](_0x36a0cd[_0x8afb('0x36')],_0x36a0cd[_0x8afb('0x33')]);_0x4beab8['attributes']=_[_0x8afb('0x35')](_0x36a0cd[_0x8afb('0x36')],qs[_0x8afb('0x37')](_0x4b458b[_0x8afb('0x33')]['fields']));_0x4beab8[_0x8afb('0x38')]=_0x4beab8[_0x8afb('0x38')]['length']?_0x4beab8['attributes']:_0x36a0cd[_0x8afb('0x36')];if(!_0x4b458b[_0x8afb('0x33')]['hasOwnProperty'](_0x8afb('0x39'))){_0x4beab8[_0x8afb('0x1d')]=qs['limit'](_0x4b458b[_0x8afb('0x33')][_0x8afb('0x1d')]);_0x4beab8[_0x8afb('0x1c')]=qs[_0x8afb('0x1c')](_0x4b458b['query'][_0x8afb('0x1c')]);}_0x4beab8[_0x8afb('0x3a')]=qs[_0x8afb('0x3b')](_0x4b458b[_0x8afb('0x33')][_0x8afb('0x3b')]);delete _0x4b458b[_0x8afb('0x33')]['sort'];_0x4beab8['where']=qs['filters'](_[_0x8afb('0x3c')](_0x4b458b['query'],_0x36a0cd[_0x8afb('0x3d')]),_0xc34c5c);if(_0x4b458b[_0x8afb('0x33')][_0x8afb('0x3e')]){_0x4beab8['where']=_[_0x8afb('0x3f')](_0x4beab8[_0x8afb('0x40')],{'$or':_['map'](_0xc34c5c,function(_0x2c46e7){if(_0x2c46e7[_0x8afb('0x31')]!==_0x8afb('0x41')){var _0x571141={};_0x571141[_0x2c46e7[_0x8afb('0x2b')]]={'$like':'%'+_0x4b458b[_0x8afb('0x33')][_0x8afb('0x3e')]+'%'};return _0x571141;}})});}_0x4beab8=_['merge']({},_0x4beab8,_0x4b458b['options']);var _0x484910={'where':_0x4beab8[_0x8afb('0x40')]};return db[_0x8afb('0x2e')][_0x8afb('0x1f')](_0x484910)[_0x8afb('0x26')](function(_0x47b6bf){_0x50ab79[_0x8afb('0x1f')]=_0x47b6bf;if(_0x4b458b[_0x8afb('0x33')]['includeAll']){_0x4beab8[_0x8afb('0x42')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x8afb('0x43')](_0x4beab8);})[_0x8afb('0x26')](function(_0x14786e){_0x50ab79[_0x8afb('0x44')]=_0x14786e;return _0x50ab79;})[_0x8afb('0x26')](respondWithFilteredResult(_0x5f0df0,_0x4beab8))[_0x8afb('0x45')](handleError(_0x5f0df0,null));};exports[_0x8afb('0x46')]=function(_0x5203a0,_0x23c7a7){var _0x3cbd5c={'raw':![],'where':{'id':_0x5203a0[_0x8afb('0x47')]['id']}},_0x49aa4e={};_0x49aa4e['model']=_[_0x8afb('0x34')](db[_0x8afb('0x2e')][_0x8afb('0x2f')]);_0x49aa4e[_0x8afb('0x33')]=_[_0x8afb('0x34')](_0x5203a0[_0x8afb('0x33')]);_0x49aa4e[_0x8afb('0x3d')]=_[_0x8afb('0x35')](_0x49aa4e['model'],_0x49aa4e[_0x8afb('0x33')]);_0x3cbd5c['attributes']=_[_0x8afb('0x35')](_0x49aa4e[_0x8afb('0x36')],qs[_0x8afb('0x37')](_0x5203a0[_0x8afb('0x33')][_0x8afb('0x37')]));_0x3cbd5c['attributes']=_0x3cbd5c[_0x8afb('0x38')][_0x8afb('0x48')]?_0x3cbd5c['attributes']:_0x49aa4e[_0x8afb('0x36')];if(_0x5203a0[_0x8afb('0x33')][_0x8afb('0x49')]){_0x3cbd5c[_0x8afb('0x42')]=[{'all':!![]}];}_0x3cbd5c=_[_0x8afb('0x3f')]({},_0x3cbd5c,_0x5203a0[_0x8afb('0x4a')]);return db[_0x8afb('0x2e')][_0x8afb('0x4b')](_0x3cbd5c)[_0x8afb('0x26')](handleEntityNotFound(_0x23c7a7,null))[_0x8afb('0x26')](respondWithResult(_0x23c7a7,null))['catch'](handleError(_0x23c7a7,null));};exports[_0x8afb('0x25')]=function(_0x67fa3a,_0x211ddb){if(_0x67fa3a['body']['id']){delete _0x67fa3a[_0x8afb('0x4c')]['id'];}return db[_0x8afb('0x2e')][_0x8afb('0x4b')]({'where':{'id':_0x67fa3a[_0x8afb('0x47')]['id']}})['then'](handleEntityNotFound(_0x211ddb,null))[_0x8afb('0x26')](saveUpdates(_0x67fa3a[_0x8afb('0x4c')],null))[_0x8afb('0x26')](respondWithResult(_0x211ddb,null))[_0x8afb('0x45')](handleError(_0x211ddb,null));};exports[_0x8afb('0x4d')]=function(_0x19acca,_0x38266a,_0x598659){return db[_0x8afb('0x4e')][_0x8afb('0x4f')](function(_0x4fe4c0){if(_0x19acca[_0x8afb('0x4c')][_0x8afb('0x50')]==='files'){_0x19acca['body'][_0x8afb('0x51')]=path[_0x8afb('0x52')](config[_0x8afb('0x53')],'server/files/moh',_0x19acca['body'][_0x8afb('0x2b')]);}return db['VoiceMusicOnHold'][_0x8afb('0x4d')](_0x19acca[_0x8afb('0x4c')],{'transaction':_0x4fe4c0})['then'](function(_0x25371c){if(_0x19acca[_0x8afb('0x4c')][_0x8afb('0x50')]===_0x8afb('0x54')){fs[_0x8afb('0x55')](_0x25371c[_0x8afb('0x51')],parseInt(_0x8afb('0x56'),0x8));}var _0x5f2b65=_0x19acca['user']['get']({'plain':!![]});if(!_0x5f2b65)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f2b65['role']===_0x8afb('0x57')){var _0x14b36f=_0x25371c[_0x8afb('0x28')]({'plain':!![]});return db[_0x8afb('0x58')][_0x8afb('0x4b')]({'where':{'name':_0x8afb('0x59'),'userProfileId':_0x5f2b65['userProfileId']},'raw':!![]})[_0x8afb('0x26')](function(_0x185d78){if(_0x185d78&&_0x185d78[_0x8afb('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x14b36f[_0x8afb('0x2b')],'resourceId':_0x14b36f['id'],'type':_0x185d78[_0x8afb('0x2b')],'sectionId':_0x185d78['id']},{})['then'](function(){return _0x25371c;});}else{return _0x25371c;}})['catch'](function(_0x24713a){logger[_0x8afb('0x5b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24713a);});}return _0x25371c;});})[_0x8afb('0x26')](respondWithResult(_0x38266a,0xc9))['catch'](handleError(_0x38266a,null));};exports[_0x8afb('0x27')]=function(_0x8954d1,_0x5b5d45,_0x5f0b3f){var _0x195fa5;return db[_0x8afb('0x2e')][_0x8afb('0x4b')]({'where':{'id':_0x8954d1[_0x8afb('0x47')]['id']}})[_0x8afb('0x26')](function(_0x514ad5){if(_0x514ad5){return db[_0x8afb('0x4e')][_0x8afb('0x4f')](function(_0x1b0708){return _0x514ad5['destroy']({'transaction':_0x1b0708,'raw':!![]})[_0x8afb('0x26')](function(_0x14add3){if(_0x14add3['directory']){fs[_0x8afb('0x5c')](_0x14add3['directory'])[_0x8afb('0x5d')](function(_0x23c1d4){fs[_0x8afb('0x5e')](path[_0x8afb('0x52')](_0x14add3['directory'],_0x23c1d4));});fs[_0x8afb('0x5f')](_0x14add3[_0x8afb('0x51')]);}return _0x14add3;});})['catch'](function(_0x6f4cf9){throw new db[(_0x8afb('0x60'))]['ValidationError'](_0x6f4cf9['message']);});}})[_0x8afb('0x26')](handleEntityNotFound(_0x5b5d45,null))[_0x8afb('0x26')](removeEntity(_0x5b5d45,null))[_0x8afb('0x45')](handleError(_0x5b5d45,null));};exports[_0x8afb('0x61')]=function(_0x5f2a4b,_0x18ca0e,_0x5874d4){return db[_0x8afb('0x4e')][_0x8afb('0x4f')](function(_0x112587){var _0x57179a;return db[_0x8afb('0x2e')][_0x8afb('0x4b')]({'where':{'id':_0x5f2a4b['params']['id']}})[_0x8afb('0x26')](function(_0x4667f5){if(_0x4667f5){_0x57179a=_0x4667f5;return _0x4667f5[_0x8afb('0x61')](_0x5f2a4b[_0x8afb('0x4c')]['id'],{'transaction':_0x112587});}})[_0x8afb('0x26')](function(_0x15283c){if(_0x15283c){return db[_0x8afb('0x62')][_0x8afb('0x63')]({'where':{'id':_0x5f2a4b[_0x8afb('0x4c')]['id']},'attributes':['id',_0x8afb('0x2b'),_0x8afb('0x64'),_0x8afb('0x65'),_0x8afb('0x66')],'raw':!![]});}})['then'](function(_0x1e19df){if(_0x1e19df){var _0x389091=path['join'](config['root'],_0x8afb('0x67'),util['format'](_0x8afb('0x68'),path[_0x8afb('0x69')](_0x1e19df['save_name'],path[_0x8afb('0x6a')](_0x1e19df[_0x8afb('0x64')])),_0x1e19df[_0x8afb('0x65')]));var _0x3e9666=path[_0x8afb('0x52')](config['root'],_0x8afb('0x6b'),_0x57179a[_0x8afb('0x2b')],util[_0x8afb('0x6c')]('%s.%s',_0x1e19df[_0x8afb('0x2b')],_0x1e19df[_0x8afb('0x65')]));fs[_0x8afb('0x6d')](_0x389091,_0x3e9666);return _0x1e19df;}})['catch'](function(_0x1c7274){throw new db['Sequelize'][(_0x8afb('0x6e'))](_0x1c7274[_0x8afb('0x6f')]);});})[_0x8afb('0x26')](handleEntityNotFound(_0x18ca0e,null))['then'](respondWithResult(_0x18ca0e,0xc9))[_0x8afb('0x45')](handleError(_0x18ca0e,null));};exports['removeSound']=function(_0x597b09,_0x52316a,_0x37d15d){return db[_0x8afb('0x4e')][_0x8afb('0x4f')](function(_0x3866c7){var _0x40e4e8;return db[_0x8afb('0x2e')][_0x8afb('0x63')]({'where':{'id':_0x597b09[_0x8afb('0x47')]['id']}})[_0x8afb('0x26')](handleEntityNotFound(_0x52316a,null))[_0x8afb('0x26')](function(_0x4c59bd){if(_0x4c59bd){_0x40e4e8=_0x4c59bd;return _0x4c59bd[_0x8afb('0x70')](_0x597b09['params'][_0x8afb('0x71')]);}})['then'](function(_0x34b4ee){if(_0x34b4ee){return db[_0x8afb('0x62')][_0x8afb('0x63')]({'where':{'id':_0x597b09['params']['id2']},'attributes':['id',_0x8afb('0x2b'),_0x8afb('0x64'),'converted_format',_0x8afb('0x66')],'raw':!![]});}})[_0x8afb('0x26')](function(_0x48bc1f){if(_0x48bc1f){fs[_0x8afb('0x5e')](path[_0x8afb('0x52')](_0x40e4e8[_0x8afb('0x51')],util[_0x8afb('0x6c')]('%s.%s',_0x48bc1f[_0x8afb('0x2b')],_0x48bc1f['converted_format'])));return _0x48bc1f;}})[_0x8afb('0x45')](function(_0x7bd098){throw new db[(_0x8afb('0x60'))][(_0x8afb('0x6e'))](_0x7bd098['message']);});})['then'](handleEntityNotFound(_0x52316a,null))[_0x8afb('0x26')](respondWithStatusCode(_0x52316a,0xcc))[_0x8afb('0x45')](handleError(_0x52316a,null));};exports[_0x8afb('0x72')]=function(_0x230740,_0x14f8f4,_0x55a464){var _0x587072={};var _0x3ddce2={};var _0x2bb0a9;var _0x2c8937;return db['VoiceMusicOnHold'][_0x8afb('0x63')]({'where':{'id':_0x230740[_0x8afb('0x47')]['id']}})[_0x8afb('0x26')](handleEntityNotFound(_0x14f8f4,null))[_0x8afb('0x26')](function(_0x40a25d){if(_0x40a25d){_0x2bb0a9=_0x40a25d;_0x3ddce2['model']=_['keys'](db[_0x8afb('0x62')][_0x8afb('0x2f')]);_0x3ddce2[_0x8afb('0x33')]=_['keys'](_0x230740[_0x8afb('0x33')]);_0x3ddce2['filters']=_[_0x8afb('0x35')](_0x3ddce2[_0x8afb('0x36')],_0x3ddce2[_0x8afb('0x33')]);_0x587072[_0x8afb('0x38')]=_['intersection'](_0x3ddce2[_0x8afb('0x36')],qs[_0x8afb('0x37')](_0x230740[_0x8afb('0x33')][_0x8afb('0x37')]));_0x587072[_0x8afb('0x38')]=_0x587072[_0x8afb('0x38')]['length']?_0x587072[_0x8afb('0x38')]:_0x3ddce2[_0x8afb('0x36')];_0x587072[_0x8afb('0x3a')]=qs[_0x8afb('0x3b')](_0x230740[_0x8afb('0x33')][_0x8afb('0x3b')]);_0x587072[_0x8afb('0x40')]=qs[_0x8afb('0x3d')](_[_0x8afb('0x3c')](_0x230740[_0x8afb('0x33')],_0x3ddce2[_0x8afb('0x3d')]));if(_0x230740[_0x8afb('0x33')][_0x8afb('0x3e')]){_0x587072[_0x8afb('0x40')]=_['merge'](_0x587072[_0x8afb('0x40')],{'$or':_[_0x8afb('0x2d')](_0x587072[_0x8afb('0x38')],function(_0x4a9d70){var _0x238520={};_0x238520[_0x4a9d70]={'$like':'%'+_0x230740[_0x8afb('0x33')][_0x8afb('0x3e')]+'%'};return _0x238520;})});}_0x587072=_[_0x8afb('0x3f')]({},_0x587072,_0x230740['options']);return _0x2bb0a9['getSounds'](_0x587072);}})[_0x8afb('0x26')](function(_0x162828){if(_0x162828){_0x2c8937=_0x162828[_0x8afb('0x48')];if(!_0x230740[_0x8afb('0x33')][_0x8afb('0x73')](_0x8afb('0x39'))){_0x587072[_0x8afb('0x1d')]=qs[_0x8afb('0x1d')](_0x230740[_0x8afb('0x33')][_0x8afb('0x1d')]);_0x587072['offset']=qs[_0x8afb('0x1c')](_0x230740[_0x8afb('0x33')][_0x8afb('0x1c')]);}return _0x2bb0a9[_0x8afb('0x72')](_0x587072);}})[_0x8afb('0x26')](function(_0x19e203){if(_0x19e203){return _0x19e203?{'count':_0x2c8937,'rows':_0x19e203}:null;}})[_0x8afb('0x26')](respondWithResult(_0x14f8f4,null))[_0x8afb('0x45')](handleError(_0x14f8f4,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 9d79d7d..8e01ee4 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 _0x8502=['../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','api','request-promise','path'];(function(_0x5e3594,_0x11902c){var _0x1a2b5d=function(_0x4e7d35){while(--_0x4e7d35){_0x5e3594['push'](_0x5e3594['shift']());}};_0x1a2b5d(++_0x11902c);}(_0x8502,0x10a));var _0x2850=function(_0x53ddab,_0x4ada9d){_0x53ddab=_0x53ddab-0x0;var _0x5819ac=_0x8502[_0x53ddab];return _0x5819ac;};'use strict';var _=require(_0x2850('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2850('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2850('0x2'));var fs=require('fs');var path=require(_0x2850('0x3'));var rimraf=require('rimraf');var config=require(_0x2850('0x4'));var attributes=require(_0x2850('0x5'));module[_0x2850('0x6')]=function(_0x52477a,_0x3719a5){return _0x52477a[_0x2850('0x7')](_0x2850('0x8'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cd4=['request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','../../config/logger','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2cd4,0x194));var _0x42cd=function(_0x176d14,_0x3984ea){_0x176d14=_0x176d14-0x0;var _0x89522c=_0x2cd4[_0x176d14];return _0x89522c;};'use strict';var _=require(_0x42cd('0x0'));var util=require('util');var logger=require(_0x42cd('0x1'))(_0x42cd('0x2'));var moment=require(_0x42cd('0x3'));var BPromise=require('bluebird');var rp=require(_0x42cd('0x4'));var fs=require('fs');var path=require(_0x42cd('0x5'));var rimraf=require(_0x42cd('0x6'));var config=require(_0x42cd('0x7'));var attributes=require(_0x42cd('0x8'));module[_0x42cd('0x9')]=function(_0x392466,_0x3c7b30){return _0x392466[_0x42cd('0xa')](_0x42cd('0xb'),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 cf6769b..2fe9618 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xbd57e9,_0xea654c){var _0x69e7bc=function(_0x331c5f){while(--_0x331c5f){_0xbd57e9['push'](_0xbd57e9['shift']());}};_0x69e7bc(++_0xea654c);}(_0x70e0,0x17b));var _0x070e=function(_0x23c3cc,_0x5a3a80){_0x23c3cc=_0x23c3cc-0x0;var _0x524ab6=_0x70e0[_0x23c3cc];return _0x524ab6;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x450b59,_0x39fbb7){var _0x5415ad=function(_0x4c8e33){while(--_0x4c8e33){_0x450b59['push'](_0x450b59['shift']());}};_0x5415ad(++_0x39fbb7);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'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']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 53ff04b..3c41f2c 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 _0x5643=['/describe','show','getTeams','post','create','/:id/users','addAgents','addTeams','put','/:id','update','destroy','delete','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5643,0x1a3));var _0x3564=function(_0x1d9927,_0x445916){_0x1d9927=_0x1d9927-0x0;var _0x1fe5b6=_0x5643[_0x1d9927];return _0x1fe5b6;};'use strict';var multer=require(_0x3564('0x0'));var util=require(_0x3564('0x1'));var path=require(_0x3564('0x2'));var timeout=require('connect-timeout');var express=require(_0x3564('0x3'));var router=express[_0x3564('0x4')]();var fs_extra=require(_0x3564('0x5'));var auth=require(_0x3564('0x6'));var interaction=require(_0x3564('0x7'));var config=require(_0x3564('0x8'));var controller=require(_0x3564('0x9'));router['get']('/',auth[_0x3564('0xa')](),controller[_0x3564('0xb')]);router[_0x3564('0xc')](_0x3564('0xd'),auth[_0x3564('0xa')](),controller['describe']);router[_0x3564('0xc')]('/:id',auth[_0x3564('0xa')](),controller[_0x3564('0xe')]);router[_0x3564('0xc')]('/:id/users',auth[_0x3564('0xa')](),controller['getAgents']);router[_0x3564('0xc')]('/:id/teams',auth[_0x3564('0xa')](),controller[_0x3564('0xf')]);router[_0x3564('0x10')]('/',auth['isAuthenticated'](),controller[_0x3564('0x11')]);router[_0x3564('0x10')](_0x3564('0x12'),auth[_0x3564('0xa')](),controller[_0x3564('0x13')]);router['post']('/:id/teams',auth[_0x3564('0xa')](),controller[_0x3564('0x14')]);router[_0x3564('0x15')](_0x3564('0x16'),auth['isAuthenticated'](),controller[_0x3564('0x17')]);router['delete']('/:id',auth[_0x3564('0xa')](),controller[_0x3564('0x18')]);router[_0x3564('0x19')](_0x3564('0x12'),auth['isAuthenticated'](),controller[_0x3564('0x1a')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);module['exports']=router; \ No newline at end of file +var _0x04f1=['/:id','show','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','destroy','/:id/users','removeAgents','removeTeams','multer','util','path','Router','fs-extra','../../components/auth/service','index','get','/describe','isAuthenticated'];(function(_0x4b49ef,_0x5929c7){var _0x4f5dcb=function(_0x4540e3){while(--_0x4540e3){_0x4b49ef['push'](_0x4b49ef['shift']());}};_0x4f5dcb(++_0x5929c7);}(_0x04f1,0x92));var _0x104f=function(_0x5d9ebe,_0x276a05){_0x5d9ebe=_0x5d9ebe-0x0;var _0x3a7ee9=_0x04f1[_0x5d9ebe];return _0x3a7ee9;};'use strict';var multer=require(_0x104f('0x0'));var util=require(_0x104f('0x1'));var path=require(_0x104f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x104f('0x3')]();var fs_extra=require(_0x104f('0x4'));var auth=require(_0x104f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x104f('0x6')]);router[_0x104f('0x7')](_0x104f('0x8'),auth[_0x104f('0x9')](),controller['describe']);router[_0x104f('0x7')](_0x104f('0xa'),auth[_0x104f('0x9')](),controller[_0x104f('0xb')]);router['get']('/:id/users',auth[_0x104f('0x9')](),controller[_0x104f('0xc')]);router[_0x104f('0x7')](_0x104f('0xd'),auth[_0x104f('0x9')](),controller[_0x104f('0xe')]);router[_0x104f('0xf')]('/',auth[_0x104f('0x9')](),controller[_0x104f('0x10')]);router[_0x104f('0xf')]('/:id/users',auth[_0x104f('0x9')](),controller[_0x104f('0x11')]);router[_0x104f('0xf')](_0x104f('0xd'),auth[_0x104f('0x9')](),controller[_0x104f('0x12')]);router[_0x104f('0x13')](_0x104f('0xa'),auth[_0x104f('0x9')](),controller[_0x104f('0x14')]);router[_0x104f('0x15')](_0x104f('0xa'),auth[_0x104f('0x9')](),controller[_0x104f('0x16')]);router['delete'](_0x104f('0x17'),auth[_0x104f('0x9')](),controller[_0x104f('0x18')]);router[_0x104f('0x15')]('/:id/teams',auth[_0x104f('0x9')](),controller[_0x104f('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 5a13abd..784ebd6 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 _0xbf33=['exports','STRING','name','VIRTUAL','system-','INTEGER','sequelize'];(function(_0x542ca6,_0x1730f4){var _0x3ec982=function(_0x5deade){while(--_0x5deade){_0x542ca6['push'](_0x542ca6['shift']());}};_0x3ec982(++_0x1730f4);}(_0xbf33,0x1b8));var _0x3bf3=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xbf33[_0x4b7b62];return _0x2280df;};'use strict';var Sequelize=require(_0x3bf3('0x0'));module[_0x3bf3('0x1')]={'name':{'type':Sequelize[_0x3bf3('0x2')],'allowNull':![],'unique':_0x3bf3('0x3')},'prefix':{'type':Sequelize[_0x3bf3('0x4')],'get':function(_0x5ab298){return _0x3bf3('0x5')+this['getDataValue'](_0x3bf3('0x3'))+'-';}},'description':{'type':Sequelize[_0x3bf3('0x2')]},'callerIdAll':{'type':Sequelize[_0x3bf3('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x3bf3('0x6')]}}; \ No newline at end of file +var _0x9965=['exports','STRING','VIRTUAL','system-','name','INTEGER','sequelize'];(function(_0x49a110,_0x385df1){var _0xf68fe=function(_0xb083d7){while(--_0xb083d7){_0x49a110['push'](_0x49a110['shift']());}};_0xf68fe(++_0x385df1);}(_0x9965,0x6f));var _0x5996=function(_0x16ab1d,_0x3c50a1){_0x16ab1d=_0x16ab1d-0x0;var _0x18f9e4=_0x9965[_0x16ab1d];return _0x18f9e4;};'use strict';var Sequelize=require(_0x5996('0x0'));module[_0x5996('0x1')]={'name':{'type':Sequelize[_0x5996('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x5996('0x3')],'get':function(_0x239027){return _0x5996('0x4')+this['getDataValue'](_0x5996('0x5'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x5996('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x5996('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index b25d035..8ad0b48 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 _0xfcbb=['apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','query','order','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','params','length','find','create','transaction','VoiceExtension','role','user','UserProfileSection','VoicePrefixes','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','system-','sequelize','findById','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','sort','getTeams','Team','addTeams','User','Agents','online','upsert','removeTeams','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x3cd7b2,_0x11bb33){var _0x4b6a02=function(_0x1e1fd4){while(--_0x1e1fd4){_0x3cd7b2['push'](_0x3cd7b2['shift']());}};_0x4b6a02(++_0x11bb33);}(_0xfcbb,0x10d));var _0xbfcb=function(_0xab6c7a,_0x1e06c9){_0xab6c7a=_0xab6c7a-0x0;var _0x4df9a9=_0xfcbb[_0xab6c7a];return _0x4df9a9;};'use strict';var emlformat=require(_0xbfcb('0x0'));var rimraf=require(_0xbfcb('0x1'));var zipdir=require(_0xbfcb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbfcb('0x3'));var BPromise=require(_0xbfcb('0x4'));var Mustache=require(_0xbfcb('0x5'));var util=require(_0xbfcb('0x6'));var path=require(_0xbfcb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbfcb('0x8'));var fs=require('fs');var fs_extra=require(_0xbfcb('0x9'));var _=require(_0xbfcb('0xa'));var squel=require(_0xbfcb('0xb'));var crypto=require(_0xbfcb('0xc'));var jsforce=require(_0xbfcb('0xd'));var deskjs=require(_0xbfcb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfcb('0xf'));var Papa=require(_0xbfcb('0x10'));var Redis=require(_0xbfcb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfcb('0x12'));var as=require(_0xbfcb('0x13'));var hardwareService=require(_0xbfcb('0x14'));var logger=require(_0xbfcb('0x15'))(_0xbfcb('0x16'));var utils=require(_0xbfcb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbfcb('0x18'));var db=require(_0xbfcb('0x19'))['db'];config[_0xbfcb('0x1a')]=_[_0xbfcb('0x1b')](config['redis'],{'host':_0xbfcb('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbfcb('0x1a')]));require(_0xbfcb('0x1d'))[_0xbfcb('0x1e')](socket);function respondWithStatusCode(_0x1047c4,_0x2074d4){_0x2074d4=_0x2074d4||0xcc;return function(_0xe47707){if(_0xe47707){return _0x1047c4[_0xbfcb('0x1f')](_0x2074d4);}return _0x1047c4[_0xbfcb('0x20')](_0x2074d4)[_0xbfcb('0x21')]();};}function respondWithResult(_0x339347,_0x2c4a85){_0x2c4a85=_0x2c4a85||0xc8;return function(_0x3f847f){if(_0x3f847f){return _0x339347[_0xbfcb('0x20')](_0x2c4a85)[_0xbfcb('0x22')](_0x3f847f);}};}function respondWithFilteredResult(_0x318d07,_0x1a4d75){return function(_0xba1d6){if(_0xba1d6){var _0x38689e=typeof _0x1a4d75[_0xbfcb('0x23')]===_0xbfcb('0x24')&&typeof _0x1a4d75[_0xbfcb('0x25')]===_0xbfcb('0x24');var _0x53c9e0=_0xba1d6[_0xbfcb('0x26')];var _0x37263b=_0x38689e?0x0:_0x1a4d75['offset'];var _0xa3c089=_0x38689e?_0xba1d6[_0xbfcb('0x26')]:_0x1a4d75['offset']+_0x1a4d75['limit'];var _0x4199c5;if(_0xa3c089>=_0x53c9e0){_0xa3c089=_0x53c9e0;_0x4199c5=0xc8;}else{_0x4199c5=0xce;}_0x318d07[_0xbfcb('0x20')](_0x4199c5);return _0x318d07[_0xbfcb('0x27')](_0xbfcb('0x28'),_0x37263b+'-'+_0xa3c089+'/'+_0x53c9e0)[_0xbfcb('0x22')](_0xba1d6);}return null;};}function patchUpdates(_0x56c158){return function(_0x365d6c){try{jsonpatch[_0xbfcb('0x29')](_0x365d6c,_0x56c158,!![]);}catch(_0x2d9288){return BPromise[_0xbfcb('0x2a')](_0x2d9288);}return _0x365d6c[_0xbfcb('0x2b')]();};}function saveUpdates(_0x19616c,_0x69c8e9){return function(_0x14e43c){if(_0x14e43c){return _0x14e43c[_0xbfcb('0x2c')](_0x19616c)[_0xbfcb('0x2d')](function(_0x1ca8c3){return _0x1ca8c3;});}return null;};}function removeEntity(_0xf6dbb7,_0x3ef71c){return function(_0x121a90){if(_0x121a90){return _0x121a90[_0xbfcb('0x2e')]()[_0xbfcb('0x2d')](function(){var _0x5cd703=_0x121a90[_0xbfcb('0x2f')]({'plain':!![]});var _0x2881f8='VoicePrefixes';return db[_0xbfcb('0x30')][_0xbfcb('0x2e')]({'where':{'type':_0x2881f8,'resourceId':_0x5cd703['id']}})[_0xbfcb('0x2d')](function(){return _0x121a90;});})[_0xbfcb('0x2d')](function(){_0xf6dbb7[_0xbfcb('0x20')](0xcc)[_0xbfcb('0x21')]();});}};}function handleEntityNotFound(_0x4069a7,_0x1a5db2){return function(_0x434764){if(!_0x434764){_0x4069a7[_0xbfcb('0x1f')](0x194);}return _0x434764;};}function handleError(_0x59719b,_0x17cd0e){_0x17cd0e=_0x17cd0e||0x1f4;return function(_0x3aa3cd){logger[_0xbfcb('0x31')](_0x3aa3cd[_0xbfcb('0x32')]);if(_0x3aa3cd[_0xbfcb('0x33')]){delete _0x3aa3cd[_0xbfcb('0x33')];}_0x59719b[_0xbfcb('0x20')](_0x17cd0e)[_0xbfcb('0x34')](_0x3aa3cd);};}exports[_0xbfcb('0x35')]=function(_0x5be764,_0x297f72){var _0xaa6ae6={},_0x625c4b={},_0x1cc3ad={'count':0x0,'rows':[]};var _0x5d02f7=_['map'](db[_0xbfcb('0x36')][_0xbfcb('0x37')],function(_0x1d523d){return{'name':_0x1d523d[_0xbfcb('0x38')],'type':_0x1d523d[_0xbfcb('0x39')][_0xbfcb('0x3a')]};});_0x625c4b[_0xbfcb('0x3b')]=_['map'](_0x5d02f7,'name');_0x625c4b['query']=_[_0xbfcb('0x3c')](_0x5be764['query']);_0x625c4b[_0xbfcb('0x3d')]=_[_0xbfcb('0x3e')](_0x625c4b['model'],_0x625c4b['query']);_0xaa6ae6[_0xbfcb('0x3f')]=_[_0xbfcb('0x3e')](_0x625c4b[_0xbfcb('0x3b')],qs[_0xbfcb('0x40')](_0x5be764['query'][_0xbfcb('0x40')]));_0xaa6ae6[_0xbfcb('0x3f')]=_0xaa6ae6['attributes']['length']?_0xaa6ae6[_0xbfcb('0x3f')]:_0x625c4b['model'];if(!_0x5be764['query'][_0xbfcb('0x41')](_0xbfcb('0x42'))){_0xaa6ae6[_0xbfcb('0x25')]=qs[_0xbfcb('0x25')](_0x5be764['query'][_0xbfcb('0x25')]);_0xaa6ae6[_0xbfcb('0x23')]=qs[_0xbfcb('0x23')](_0x5be764[_0xbfcb('0x43')][_0xbfcb('0x23')]);}_0xaa6ae6[_0xbfcb('0x44')]=qs['sort'](_0x5be764[_0xbfcb('0x43')]['sort']);_0xaa6ae6[_0xbfcb('0x45')]=qs['filters'](_[_0xbfcb('0x46')](_0x5be764[_0xbfcb('0x43')],_0x625c4b[_0xbfcb('0x3d')]),_0x5d02f7);if(_0x5be764[_0xbfcb('0x43')][_0xbfcb('0x47')]){_0xaa6ae6[_0xbfcb('0x45')]=_[_0xbfcb('0x48')](_0xaa6ae6[_0xbfcb('0x45')],{'$or':_[_0xbfcb('0x49')](_0x5d02f7,function(_0x91e12b){if(_0x91e12b['type']!==_0xbfcb('0x4a')){var _0x1d6ddd={};_0x1d6ddd[_0x91e12b['name']]={'$like':'%'+_0x5be764[_0xbfcb('0x43')][_0xbfcb('0x47')]+'%'};return _0x1d6ddd;}})});}_0xaa6ae6=_[_0xbfcb('0x48')]({},_0xaa6ae6,_0x5be764[_0xbfcb('0x4b')]);var _0x1f04b5={'where':_0xaa6ae6[_0xbfcb('0x45')]};return db['VoicePrefix'][_0xbfcb('0x26')](_0x1f04b5)[_0xbfcb('0x2d')](function(_0x10ea4f){_0x1cc3ad['count']=_0x10ea4f;if(_0x5be764[_0xbfcb('0x43')][_0xbfcb('0x4c')]){_0xaa6ae6[_0xbfcb('0x4d')]=[{'all':!![]}];}return db['VoicePrefix'][_0xbfcb('0x4e')](_0xaa6ae6);})[_0xbfcb('0x2d')](function(_0x58337d){_0x1cc3ad['rows']=_0x58337d;return _0x1cc3ad;})[_0xbfcb('0x2d')](respondWithFilteredResult(_0x297f72,_0xaa6ae6))[_0xbfcb('0x4f')](handleError(_0x297f72,null));};exports['show']=function(_0x3e9186,_0x31fd3f){var _0x58cfa2={'raw':![],'where':{'id':_0x3e9186[_0xbfcb('0x50')]['id']}},_0x3a9dfe={};_0x3a9dfe[_0xbfcb('0x3b')]=_[_0xbfcb('0x3c')](db[_0xbfcb('0x36')][_0xbfcb('0x37')]);_0x3a9dfe[_0xbfcb('0x43')]=_[_0xbfcb('0x3c')](_0x3e9186[_0xbfcb('0x43')]);_0x3a9dfe[_0xbfcb('0x3d')]=_[_0xbfcb('0x3e')](_0x3a9dfe[_0xbfcb('0x3b')],_0x3a9dfe['query']);_0x58cfa2[_0xbfcb('0x3f')]=_[_0xbfcb('0x3e')](_0x3a9dfe[_0xbfcb('0x3b')],qs['fields'](_0x3e9186[_0xbfcb('0x43')]['fields']));_0x58cfa2['attributes']=_0x58cfa2[_0xbfcb('0x3f')][_0xbfcb('0x51')]?_0x58cfa2[_0xbfcb('0x3f')]:_0x3a9dfe['model'];if(_0x3e9186[_0xbfcb('0x43')]['includeAll']){_0x58cfa2['include']=[{'all':!![]}];}_0x58cfa2=_[_0xbfcb('0x48')]({},_0x58cfa2,_0x3e9186['options']);return db[_0xbfcb('0x36')][_0xbfcb('0x52')](_0x58cfa2)['then'](handleEntityNotFound(_0x31fd3f,null))[_0xbfcb('0x2d')](respondWithResult(_0x31fd3f,null))['catch'](handleError(_0x31fd3f,null));};exports[_0xbfcb('0x2e')]=function(_0x4f348b,_0x61b146){return db['VoicePrefix'][_0xbfcb('0x52')]({'where':{'id':_0x4f348b[_0xbfcb('0x50')]['id']}})['then'](handleEntityNotFound(_0x61b146,null))[_0xbfcb('0x2d')](removeEntity(_0x61b146,null))['catch'](handleError(_0x61b146,null));};exports['describe']=function(_0x3b8683,_0x43e3e3){return db[_0xbfcb('0x36')]['describe']()['then'](respondWithResult(_0x43e3e3,null))[_0xbfcb('0x4f')](handleError(_0x43e3e3,null));};exports[_0xbfcb('0x53')]=function(_0x294e9e,_0x3d502e){var _0x3fb5ad;return db['sequelize'][_0xbfcb('0x54')](function(_0x37a7e8){return db[_0xbfcb('0x36')][_0xbfcb('0x53')](_0x294e9e['body'],{'transaction':_0x37a7e8})['then'](function(_0xbcb336){_0x3fb5ad=_0xbcb336['get']({'plain':!![]});return db[_0xbfcb('0x55')]['find']({'where':{'id':_0x3fb5ad['VoiceExtensionId']},'raw':!![]})[_0xbfcb('0x2d')](function(_0x4de1af){return createVoicePrefixExtensions(_0x3fb5ad,_0x4de1af,_0x37a7e8);});});})['then'](function(){var _0x27058a=_0x294e9e['user'][_0xbfcb('0x2f')]({'plain':!![]});if(!_0x27058a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27058a[_0xbfcb('0x56')]===_0xbfcb('0x57')){var _0x593f4e=_0x3fb5ad;return db[_0xbfcb('0x58')][_0xbfcb('0x52')]({'where':{'name':_0xbfcb('0x59'),'userProfileId':_0x27058a['userProfileId']},'raw':!![]})[_0xbfcb('0x2d')](function(_0xc44640){if(_0xc44640&&_0xc44640[_0xbfcb('0x5a')]===0x0){return db[_0xbfcb('0x30')][_0xbfcb('0x53')]({'name':_0x593f4e[_0xbfcb('0x33')],'resourceId':_0x593f4e['id'],'type':_0xc44640[_0xbfcb('0x33')],'sectionId':_0xc44640['id']},{})['then'](function(){return _0x3fb5ad;});}else{return _0x3fb5ad;}})[_0xbfcb('0x4f')](function(_0x5743ad){logger[_0xbfcb('0x31')](_0xbfcb('0x5b'),_0x5743ad);throw _0x5743ad;});}return _0x3fb5ad;})[_0xbfcb('0x2d')](respondWithResult(_0x3d502e,null))[_0xbfcb('0x4f')](handleError(_0x3d502e,null));};function Extension(_0x5eaf39,_0x558da0,_0x3a0945,_0x48c7b4){this[_0xbfcb('0x5c')]=_0xbfcb('0x5d');this[_0xbfcb('0x5e')]=_0x5eaf39;this[_0xbfcb('0x5f')]=_0x3a0945;this[_0xbfcb('0x39')]=_0xbfcb('0x60');this['description']=_0xbfcb('0x61');this[_0xbfcb('0x62')]=_0x558da0;this[_0xbfcb('0x63')]=_0x48c7b4;}function createVoicePrefixExtensions(_0x36d13c,_0x1b0618,_0x1b5ec2){return new BPromise(function(_0x417030,_0x5d847c){var _0x538200=new Extension(formatPrefixName(_0x36d13c['prefix']),0x1,_0xbfcb('0x64'),_0xbfcb('0x65'));_0x538200[_0xbfcb('0x66')]=_0x36d13c['id'];return db['VoiceExtension'][_0xbfcb('0x53')](_0x538200,{'transaction':_0x1b5ec2})[_0xbfcb('0x2d')](function(_0x4e549){var _0x51ddd4=_0x4e549['get']({'plain':!![]});var _0x48c75e=_[_0xbfcb('0x49')](addVoicePrefixExtensions(_0x36d13c,_0x1b0618),function(_0x156f61){_0x156f61[_0xbfcb('0x67')]=_0x51ddd4['id'];_0x156f61[_0xbfcb('0x66')]=_0x36d13c['id'];return _0x156f61;});return db['VoiceExtension'][_0xbfcb('0x68')](_0x48c75e,{'transaction':_0x1b5ec2})[_0xbfcb('0x2d')](function(_0x39a3cf){if(!_0x39a3cf){return _0x5d847c('Extensions\x20creation\x20failed');}else{return _0x417030(_0x39a3cf);}})['catch'](function(_0x107b1b){return _0x5d847c(_0x107b1b);});});;});};function addVoicePrefixExtensions(_0x2f6065,_0x5e011a){var _0x4842d5=[];var _0x4866ef=formatPrefixName(_0x2f6065['prefix']);_0x4842d5[_0xbfcb('0x69')](new Extension(_0x4866ef,0x2,_0xbfcb('0x6a'),_0xbfcb('0x6b')+_0x2f6065[_0xbfcb('0x33')]));if(_0x2f6065[_0xbfcb('0x6c')]){_0x4842d5[_0xbfcb('0x69')](new Extension(_0x4866ef,0x3,_0xbfcb('0x6a'),_0xbfcb('0x6d')+_0x2f6065['callerIdAll']));}else{_0x4842d5[_0xbfcb('0x69')](new Extension(_0x4866ef,0x3,_0xbfcb('0x64'),_0xbfcb('0x6e')));}_0x4842d5[_0xbfcb('0x69')](new Extension(_0x4866ef,0x4,_0xbfcb('0x6f'),_0x5e011a[_0xbfcb('0x5c')]+','+_0xbfcb('0x70')+(0x8+_0x2f6065[_0xbfcb('0x33')]['length'])+'}'+','+0x1));return _0x4842d5;}function formatPrefixName(_0xe35368){var _0x49a08f='_';for(var _0x14a28d=0x0;_0x14a28d<_0xe35368[_0xbfcb('0x51')];_0x14a28d++){if(_0xe35368[_0xbfcb('0x71')](_0x14a28d)=='-'){_0x49a08f+=_0xe35368[_0xbfcb('0x71')](_0x14a28d);}else{_0x49a08f+='['+_0xe35368[_0xbfcb('0x71')](_0x14a28d)+']';}}_0x49a08f+='.';return _0x49a08f;}exports['update']=function(_0x6ea9ac,_0xdfd1cd,_0xe7fc76){var _0x1bca83=_0x6ea9ac[_0xbfcb('0x72')];_0x1bca83['prefix']=_0xbfcb('0x73')+_0x1bca83[_0xbfcb('0x33')]+'-';return db[_0xbfcb('0x74')][_0xbfcb('0x54')](function(_0x51d6a5){return db['VoicePrefix'][_0xbfcb('0x2c')](_0x1bca83,{'where':{'id':_0x1bca83['id']},'transaction':_0x51d6a5})[_0xbfcb('0x2d')](function(){return db[_0xbfcb('0x55')][_0xbfcb('0x2e')]({'where':{'VoicePrefixId':_0x1bca83['id']},'transaction':_0x51d6a5})[_0xbfcb('0x2d')](function(){return db[_0xbfcb('0x55')][_0xbfcb('0x52')]({'where':{'id':_0x1bca83[_0xbfcb('0x67')]},'raw':!![]})[_0xbfcb('0x2d')](function(_0x3f7811){return createVoicePrefixExtensions(_0x1bca83,_0x3f7811,_0x51d6a5);});});});})[_0xbfcb('0x2d')](function(){return db[_0xbfcb('0x36')][_0xbfcb('0x75')](_0x1bca83['id']);})[_0xbfcb('0x2d')](respondWithResult(_0xdfd1cd,null))['catch'](handleError(_0xdfd1cd,null));};exports[_0xbfcb('0x76')]=function(_0x4d62ff,_0x378f22,_0x17ce1b){return db['VoicePrefix'][_0xbfcb('0x52')]({'where':{'id':_0x4d62ff[_0xbfcb('0x50')]['id']}})[_0xbfcb('0x2d')](handleEntityNotFound(_0x378f22,null))[_0xbfcb('0x2d')](function(_0x58a9a4){if(_0x58a9a4){return _0x58a9a4[_0xbfcb('0x76')](_0x4d62ff['body'][_0xbfcb('0x77')],_[_0xbfcb('0x78')](_0x4d62ff['body'],['ids','id'])||{})[_0xbfcb('0x79')](function(_0x31355a){for(var _0x233da5=0x0;_0x233da5<_0x4d62ff[_0xbfcb('0x72')][_0xbfcb('0x77')]['length'];_0x233da5+=0x1){socket['emit'](_0xbfcb('0x7a'),{'UserId':Number(_0x4d62ff['body']['ids'][_0x233da5]),'VoicePrefixId':Number(_0x4d62ff[_0xbfcb('0x50')]['id'])});}return _0x31355a;});}})[_0xbfcb('0x2d')](respondWithResult(_0x378f22,null))['catch'](handleError(_0x378f22,null));};exports[_0xbfcb('0x7b')]=function(_0x195293,_0x568fa8,_0xbacdd4){return db[_0xbfcb('0x36')][_0xbfcb('0x52')]({'where':{'id':_0x195293[_0xbfcb('0x50')]['id']}})['then'](handleEntityNotFound(_0x568fa8,null))[_0xbfcb('0x2d')](function(_0x2546b1){if(_0x2546b1){return _0x2546b1[_0xbfcb('0x7b')](_0x195293[_0xbfcb('0x43')][_0xbfcb('0x77')])[_0xbfcb('0x2d')](function(){if(_['isArray'](_0x195293[_0xbfcb('0x43')][_0xbfcb('0x77')])){for(var _0x3d677a=0x0;_0x3d677a<_0x195293[_0xbfcb('0x43')][_0xbfcb('0x77')][_0xbfcb('0x51')];_0x3d677a+=0x1){socket[_0xbfcb('0x7c')](_0xbfcb('0x7d'),{'UserId':Number(_0x195293[_0xbfcb('0x43')][_0xbfcb('0x77')][_0x3d677a]),'VoicePrefixId':Number(_0x195293[_0xbfcb('0x50')]['id'])});}}else{socket[_0xbfcb('0x7c')]('userVoicePrefix:remove',{'UserId':Number(_0x195293['query'][_0xbfcb('0x77')]),'VoicePrefixId':Number(_0x195293[_0xbfcb('0x50')]['id'])});}});}})[_0xbfcb('0x2d')](respondWithStatusCode(_0x568fa8,null))[_0xbfcb('0x4f')](handleError(_0x568fa8,null));};exports[_0xbfcb('0x7e')]=function(_0x280260,_0x2ff3a5,_0x10da13){var _0x52b816={};var _0x258969={};var _0x20e222;var _0x2b2773;return db[_0xbfcb('0x36')][_0xbfcb('0x7f')]({'where':{'id':_0x280260['params']['id']}})[_0xbfcb('0x2d')](handleEntityNotFound(_0x2ff3a5,null))['then'](function(_0x1799c){if(_0x1799c){_0x20e222=_0x1799c;_0x258969[_0xbfcb('0x3b')]=_['keys'](db['User'][_0xbfcb('0x37')]);_0x258969[_0xbfcb('0x43')]=_[_0xbfcb('0x3c')](_0x280260[_0xbfcb('0x43')]);_0x258969[_0xbfcb('0x3d')]=_[_0xbfcb('0x3e')](_0x258969['model'],_0x258969[_0xbfcb('0x43')]);_0x52b816[_0xbfcb('0x3f')]=_[_0xbfcb('0x3e')](_0x258969[_0xbfcb('0x3b')],qs[_0xbfcb('0x40')](_0x280260[_0xbfcb('0x43')][_0xbfcb('0x40')]));_0x52b816[_0xbfcb('0x3f')]=_0x52b816['attributes'][_0xbfcb('0x51')]?_0x52b816[_0xbfcb('0x3f')]:_0x258969['model'];_0x52b816['order']=qs[_0xbfcb('0x80')](_0x280260['query']['sort']);_0x52b816[_0xbfcb('0x45')]=qs['filters'](_[_0xbfcb('0x46')](_0x280260[_0xbfcb('0x43')],_0x258969[_0xbfcb('0x3d')]));if(_0x280260['query'][_0xbfcb('0x47')]){_0x52b816[_0xbfcb('0x45')]=_[_0xbfcb('0x48')](_0x52b816['where'],{'$or':_['map'](_0x52b816[_0xbfcb('0x3f')],function(_0x306ea6){var _0x28987c={};_0x28987c[_0x306ea6]={'$like':'%'+_0x280260['query'][_0xbfcb('0x47')]+'%'};return _0x28987c;})});}_0x52b816=_['merge']({},_0x52b816,_0x280260[_0xbfcb('0x4b')]);return _0x20e222[_0xbfcb('0x7e')](_0x52b816);}})['then'](function(_0x1f0e28){if(_0x1f0e28){_0x2b2773=_0x1f0e28[_0xbfcb('0x51')];if(!_0x280260[_0xbfcb('0x43')]['hasOwnProperty'](_0xbfcb('0x42'))){_0x52b816['limit']=qs[_0xbfcb('0x25')](_0x280260[_0xbfcb('0x43')][_0xbfcb('0x25')]);_0x52b816[_0xbfcb('0x23')]=qs[_0xbfcb('0x23')](_0x280260['query'][_0xbfcb('0x23')]);}return _0x20e222[_0xbfcb('0x7e')](_0x52b816);}})['then'](function(_0x2cb2af){if(_0x2cb2af){return _0x2cb2af?{'count':_0x2b2773,'rows':_0x2cb2af}:null;}})['then'](respondWithResult(_0x2ff3a5,null))['catch'](handleError(_0x2ff3a5,null));};exports[_0xbfcb('0x81')]=function(_0x139aa8,_0x5bba0b,_0x2ac498){var _0xdd9f4b={};var _0x32f648={};var _0x70319a;var _0x2c2a15;return db['VoicePrefix'][_0xbfcb('0x7f')]({'where':{'id':_0x139aa8[_0xbfcb('0x50')]['id']}})[_0xbfcb('0x2d')](handleEntityNotFound(_0x5bba0b,null))[_0xbfcb('0x2d')](function(_0xdf378a){if(_0xdf378a){_0x70319a=_0xdf378a;_0x32f648[_0xbfcb('0x3b')]=_[_0xbfcb('0x3c')](db[_0xbfcb('0x82')][_0xbfcb('0x37')]);_0x32f648[_0xbfcb('0x43')]=_[_0xbfcb('0x3c')](_0x139aa8[_0xbfcb('0x43')]);_0x32f648[_0xbfcb('0x3d')]=_['intersection'](_0x32f648[_0xbfcb('0x3b')],_0x32f648[_0xbfcb('0x43')]);_0xdd9f4b[_0xbfcb('0x3f')]=_[_0xbfcb('0x3e')](_0x32f648[_0xbfcb('0x3b')],qs[_0xbfcb('0x40')](_0x139aa8[_0xbfcb('0x43')][_0xbfcb('0x40')]));_0xdd9f4b[_0xbfcb('0x3f')]=_0xdd9f4b['attributes']['length']?_0xdd9f4b[_0xbfcb('0x3f')]:_0x32f648['model'];_0xdd9f4b[_0xbfcb('0x44')]=qs['sort'](_0x139aa8['query'][_0xbfcb('0x80')]);_0xdd9f4b['where']=qs[_0xbfcb('0x3d')](_['pick'](_0x139aa8[_0xbfcb('0x43')],_0x32f648[_0xbfcb('0x3d')]));if(_0x139aa8['query'][_0xbfcb('0x47')]){_0xdd9f4b[_0xbfcb('0x45')]=_[_0xbfcb('0x48')](_0xdd9f4b[_0xbfcb('0x45')],{'$or':_[_0xbfcb('0x49')](_0xdd9f4b[_0xbfcb('0x3f')],function(_0x29f3bd){var _0x2684ce={};_0x2684ce[_0x29f3bd]={'$like':'%'+_0x139aa8[_0xbfcb('0x43')][_0xbfcb('0x47')]+'%'};return _0x2684ce;})});}_0xdd9f4b=_[_0xbfcb('0x48')]({},_0xdd9f4b,_0x139aa8[_0xbfcb('0x4b')]);return _0x70319a[_0xbfcb('0x81')](_0xdd9f4b);}})[_0xbfcb('0x2d')](function(_0x3e8955){if(_0x3e8955){_0x2c2a15=_0x3e8955[_0xbfcb('0x51')];if(!_0x139aa8[_0xbfcb('0x43')][_0xbfcb('0x41')]('nolimit')){_0xdd9f4b[_0xbfcb('0x25')]=qs['limit'](_0x139aa8[_0xbfcb('0x43')][_0xbfcb('0x25')]);_0xdd9f4b['offset']=qs[_0xbfcb('0x23')](_0x139aa8[_0xbfcb('0x43')][_0xbfcb('0x23')]);}return _0x70319a[_0xbfcb('0x81')](_0xdd9f4b);}})['then'](function(_0x3c47a3){if(_0x3c47a3){return _0x3c47a3?{'count':_0x2c2a15,'rows':_0x3c47a3}:null;}})[_0xbfcb('0x2d')](respondWithResult(_0x5bba0b,null))['catch'](handleError(_0x5bba0b,null));};exports[_0xbfcb('0x83')]=function(_0x46a30d,_0x3e13bb,_0x478047){var _0x57da52=_0x46a30d[_0xbfcb('0x72')]['ids'];var _0x9e7a65;return db[_0xbfcb('0x82')]['findAll']({'where':{'id':_0x57da52},'attributes':['id'],'include':[{'model':db[_0xbfcb('0x84')],'as':_0xbfcb('0x85'),'attributes':['id','name',_0xbfcb('0x86'),'voicePause','interface'],'raw':!![]}]})[_0xbfcb('0x2d')](function(_0x1624a6){if(_0x1624a6){_0x9e7a65=_0x1624a6;var _0x2033bd=_['flatMap'](_0x1624a6,function(_0x33b758){var _0x27f186=_0x33b758[_0xbfcb('0x2f')]({'plain':!![]});return _0x27f186[_0xbfcb('0x85')];});return db['VoicePrefix']['find']({'where':{'id':_0x46a30d[_0xbfcb('0x50')]['id']}})['then'](function(_0x3d52e6){return db[_0xbfcb('0x74')][_0xbfcb('0x54')](function(_0x216f7c){return _0x3d52e6['addTeams'](_0x57da52,{'transaction':_0x216f7c})[_0xbfcb('0x2d')](function(){return BPromise['each'](_0x9e7a65,function(_0x3222ab){return db['TeamVoicePrefix'][_0xbfcb('0x87')]({'TeamId':_0x3222ab['id'],'VoicePrefixId':_0x46a30d['params']['id']},{'transaction':_0x216f7c});});})[_0xbfcb('0x2d')](function(){return BPromise['each'](_0x2033bd,function(_0x509038){return db['UserVoicePrefix']['findOrCreate']({'where':{'UserId':_0x509038['id'],'VoicePrefixId':_0x46a30d[_0xbfcb('0x50')]['id']},'transaction':_0x216f7c});});})[_0xbfcb('0x2d')](function(){_0x2033bd['forEach'](function(_0x29db83){socket[_0xbfcb('0x7c')](_0xbfcb('0x7a'),{'UserId':_0x29db83['id'],'VoicePrefixId':_0x3d52e6['id']});});});});});}})[_0xbfcb('0x2d')](respondWithStatusCode(_0x3e13bb,null))[_0xbfcb('0x4f')](handleError(_0x3e13bb,null));};exports[_0xbfcb('0x88')]=function(_0x27fde4,_0x454abf,_0x3541c4){return db[_0xbfcb('0x82')][_0xbfcb('0x4e')]({'where':{'id':_0x27fde4[_0xbfcb('0x43')]['ids']},'attributes':['id'],'include':[{'model':db[_0xbfcb('0x84')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbfcb('0x2d')](handleEntityNotFound(_0x454abf,null))[_0xbfcb('0x2d')](function(_0x3be2c6){var _0x5a28c2=_[_0xbfcb('0x49')](_0x3be2c6,'id');var _0x39a479=[];var _0x5b2222=[];var _0x4db416=squel['select']();_0x4db416['field'](_0xbfcb('0x89'))['from'](_0xbfcb('0x8a'),'tq')[_0xbfcb('0x8b')](_0xbfcb('0x8c'),'ut',_0xbfcb('0x8d'))[_0xbfcb('0x45')](_0xbfcb('0x8e'),_0x27fde4[_0xbfcb('0x50')]['id']);for(var _0x295f8d=0x0;_0x295f8d<_0x3be2c6[_0xbfcb('0x51')];_0x295f8d+=0x1){let _0x372520=_0x3be2c6[_0x295f8d];for(var _0x5739ee=0x0;_0x5739ee<_0x372520[_0xbfcb('0x85')][_0xbfcb('0x51')];_0x5739ee+=0x1){let _0x515253=_0x372520[_0xbfcb('0x85')][_0x5739ee];var _0x36c0f3=_0x4db416[_0xbfcb('0x8f')]();_0x36c0f3[_0xbfcb('0x45')](_0xbfcb('0x90'),_0x515253['id']);_0x5b2222['push'](db[_0xbfcb('0x74')][_0xbfcb('0x43')](_0x36c0f3[_0xbfcb('0x91')](),{'type':db[_0xbfcb('0x74')]['QueryTypes'][_0xbfcb('0x92')]})[_0xbfcb('0x2d')](function(_0x48aaf8){if(_0x48aaf8[_0xbfcb('0x51')]===0x1){return _0x515253['id'];}else{var _0xa0c250=_[_0xbfcb('0x93')](_['map'](_0x48aaf8,_0xbfcb('0x94')),function(_0x12ce37){return _[_0xbfcb('0x95')](_0x5a28c2,_0x12ce37);});if(_0xa0c250){return _0x515253['id'];}}}));}}return BPromise[_0xbfcb('0x96')](_0x5b2222)[_0xbfcb('0x2d')](function(_0x44cb6d){_0x39a479=_(_0x39a479)[_0xbfcb('0x97')](_0x44cb6d)[_0xbfcb('0x98')]()[_0xbfcb('0x99')]();return db[_0xbfcb('0x36')][_0xbfcb('0x52')]({'where':{'id':_0x27fde4[_0xbfcb('0x50')]['id']}})[_0xbfcb('0x2d')](function(_0xe9ee44){return db[_0xbfcb('0x74')]['transaction'](function(_0x233e0a){return _0xe9ee44[_0xbfcb('0x88')](_0x27fde4[_0xbfcb('0x43')][_0xbfcb('0x77')],{'transaction':_0x233e0a})['then'](function(){if(!_[_0xbfcb('0x9a')](_0x39a479)){return _0xe9ee44[_0xbfcb('0x7b')](_0x39a479,{'transaction':_0x233e0a});}})[_0xbfcb('0x2d')](function(){_0x39a479['forEach'](function(_0x3df797){socket['emit'](_0xbfcb('0x7d'),{'UserId':_0x3df797,'VoicePrefixId':_0xe9ee44['id']});});});});});});})[_0xbfcb('0x2d')](respondWithStatusCode(_0x454abf,null))[_0xbfcb('0x4f')](handleError(_0x454abf,null));}; \ No newline at end of file +var _0x0972=['filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','keys','include','find','create','sequelize','transaction','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','system','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','get','Extensions\x20creation\x20failed','prefix','push','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','length','charAt','system-','VoiceExtensionId','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','addTeams','Team','findAll','Agents','online','voicePause','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','rimraf','fast-json-patch','moment','bluebird','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','end','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','query'];(function(_0x17c9c4,_0x251938){var _0x6a6b2d=function(_0x34818d){while(--_0x34818d){_0x17c9c4['push'](_0x17c9c4['shift']());}};_0x6a6b2d(++_0x251938);}(_0x0972,0x64));var _0x2097=function(_0x36954e,_0x560d93){_0x36954e=_0x36954e-0x0;var _0x13017a=_0x0972[_0x36954e];return _0x13017a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2097('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2097('0x1'));var rp=require('request-promise');var moment=require(_0x2097('0x2'));var BPromise=require(_0x2097('0x3'));var Mustache=require('mustache');var util=require(_0x2097('0x4'));var path=require(_0x2097('0x5'));var sox=require(_0x2097('0x6'));var csv=require(_0x2097('0x7'));var ejs=require(_0x2097('0x8'));var fs=require('fs');var fs_extra=require(_0x2097('0x9'));var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x7'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var licenseUtil=require(_0x2097('0x18'));var db=require(_0x2097('0x19'))['db'];config[_0x2097('0x1a')]=_[_0x2097('0x1b')](config[_0x2097('0x1a')],{'host':_0x2097('0x1c'),'port':0x18eb});var socket=require(_0x2097('0x1d'))(new Redis(config[_0x2097('0x1a')]));require(_0x2097('0x1e'))[_0x2097('0x1f')](socket);function respondWithStatusCode(_0x354387,_0x5d0a43){_0x5d0a43=_0x5d0a43||0xcc;return function(_0x639c14){if(_0x639c14){return _0x354387[_0x2097('0x20')](_0x5d0a43);}return _0x354387['status'](_0x5d0a43)['end']();};}function respondWithResult(_0x4fc8c5,_0x409deb){_0x409deb=_0x409deb||0xc8;return function(_0x588396){if(_0x588396){return _0x4fc8c5[_0x2097('0x21')](_0x409deb)[_0x2097('0x22')](_0x588396);}};}function respondWithFilteredResult(_0x43fec9,_0x1347e4){return function(_0x44c584){if(_0x44c584){var _0x53e2b4=typeof _0x1347e4[_0x2097('0x23')]===_0x2097('0x24')&&typeof _0x1347e4[_0x2097('0x25')]===_0x2097('0x24');var _0x1d3804=_0x44c584[_0x2097('0x26')];var _0x253f5d=_0x53e2b4?0x0:_0x1347e4[_0x2097('0x23')];var _0x5d8b9e=_0x53e2b4?_0x44c584['count']:_0x1347e4[_0x2097('0x23')]+_0x1347e4['limit'];var _0x227c00;if(_0x5d8b9e>=_0x1d3804){_0x5d8b9e=_0x1d3804;_0x227c00=0xc8;}else{_0x227c00=0xce;}_0x43fec9[_0x2097('0x21')](_0x227c00);return _0x43fec9['set'](_0x2097('0x27'),_0x253f5d+'-'+_0x5d8b9e+'/'+_0x1d3804)['json'](_0x44c584);}return null;};}function patchUpdates(_0x2e17c8){return function(_0xf32d3f){try{jsonpatch[_0x2097('0x28')](_0xf32d3f,_0x2e17c8,!![]);}catch(_0x20b93a){return BPromise[_0x2097('0x29')](_0x20b93a);}return _0xf32d3f[_0x2097('0x2a')]();};}function saveUpdates(_0x56390a,_0xae5f9){return function(_0x500234){if(_0x500234){return _0x500234[_0x2097('0x2b')](_0x56390a)[_0x2097('0x2c')](function(_0x345875){return _0x345875;});}return null;};}function removeEntity(_0x9f59bc,_0x499988){return function(_0x2d683a){if(_0x2d683a){return _0x2d683a[_0x2097('0x2d')]()['then'](function(){var _0x1229fc=_0x2d683a['get']({'plain':!![]});var _0x29b879='VoicePrefixes';return db[_0x2097('0x2e')][_0x2097('0x2d')]({'where':{'type':_0x29b879,'resourceId':_0x1229fc['id']}})[_0x2097('0x2c')](function(){return _0x2d683a;});})[_0x2097('0x2c')](function(){_0x9f59bc[_0x2097('0x21')](0xcc)[_0x2097('0x2f')]();});}};}function handleEntityNotFound(_0x450e0b,_0x4b443d){return function(_0x11242f){if(!_0x11242f){_0x450e0b[_0x2097('0x20')](0x194);}return _0x11242f;};}function handleError(_0x5cce55,_0x1398d0){_0x1398d0=_0x1398d0||0x1f4;return function(_0x41487d){logger['error'](_0x41487d['stack']);if(_0x41487d[_0x2097('0x30')]){delete _0x41487d[_0x2097('0x30')];}_0x5cce55[_0x2097('0x21')](_0x1398d0)[_0x2097('0x31')](_0x41487d);};}exports[_0x2097('0x32')]=function(_0x180654,_0x56c538){var _0xe1a381={},_0x56bb42={},_0x193160={'count':0x0,'rows':[]};var _0x3c36d3=_[_0x2097('0x33')](db[_0x2097('0x34')][_0x2097('0x35')],function(_0x395d9f){return{'name':_0x395d9f[_0x2097('0x36')],'type':_0x395d9f[_0x2097('0x37')][_0x2097('0x38')]};});_0x56bb42['model']=_[_0x2097('0x33')](_0x3c36d3,_0x2097('0x30'));_0x56bb42[_0x2097('0x39')]=_['keys'](_0x180654[_0x2097('0x39')]);_0x56bb42[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x56bb42[_0x2097('0x3c')],_0x56bb42['query']);_0xe1a381['attributes']=_['intersection'](_0x56bb42[_0x2097('0x3c')],qs[_0x2097('0x3d')](_0x180654[_0x2097('0x39')][_0x2097('0x3d')]));_0xe1a381[_0x2097('0x3e')]=_0xe1a381[_0x2097('0x3e')]['length']?_0xe1a381[_0x2097('0x3e')]:_0x56bb42[_0x2097('0x3c')];if(!_0x180654[_0x2097('0x39')][_0x2097('0x3f')](_0x2097('0x40'))){_0xe1a381[_0x2097('0x25')]=qs['limit'](_0x180654[_0x2097('0x39')][_0x2097('0x25')]);_0xe1a381[_0x2097('0x23')]=qs['offset'](_0x180654['query'][_0x2097('0x23')]);}_0xe1a381[_0x2097('0x41')]=qs[_0x2097('0x42')](_0x180654[_0x2097('0x39')][_0x2097('0x42')]);_0xe1a381[_0x2097('0x43')]=qs[_0x2097('0x3a')](_[_0x2097('0x44')](_0x180654[_0x2097('0x39')],_0x56bb42[_0x2097('0x3a')]),_0x3c36d3);if(_0x180654[_0x2097('0x39')][_0x2097('0x45')]){_0xe1a381['where']=_[_0x2097('0x46')](_0xe1a381[_0x2097('0x43')],{'$or':_[_0x2097('0x33')](_0x3c36d3,function(_0x483900){if(_0x483900[_0x2097('0x37')]!==_0x2097('0x47')){var _0x26d448={};_0x26d448[_0x483900[_0x2097('0x30')]]={'$like':'%'+_0x180654[_0x2097('0x39')][_0x2097('0x45')]+'%'};return _0x26d448;}})});}_0xe1a381=_[_0x2097('0x46')]({},_0xe1a381,_0x180654[_0x2097('0x48')]);var _0x5ab893={'where':_0xe1a381[_0x2097('0x43')]};return db[_0x2097('0x34')][_0x2097('0x26')](_0x5ab893)[_0x2097('0x2c')](function(_0x12e0e2){_0x193160[_0x2097('0x26')]=_0x12e0e2;if(_0x180654[_0x2097('0x39')][_0x2097('0x49')]){_0xe1a381['include']=[{'all':!![]}];}return db[_0x2097('0x34')]['findAll'](_0xe1a381);})[_0x2097('0x2c')](function(_0x298e49){_0x193160[_0x2097('0x4a')]=_0x298e49;return _0x193160;})[_0x2097('0x2c')](respondWithFilteredResult(_0x56c538,_0xe1a381))[_0x2097('0x4b')](handleError(_0x56c538,null));};exports['show']=function(_0x2cf34e,_0x46ccbb){var _0x113c3b={'raw':![],'where':{'id':_0x2cf34e[_0x2097('0x4c')]['id']}},_0x39e0a4={};_0x39e0a4['model']=_[_0x2097('0x4d')](db[_0x2097('0x34')][_0x2097('0x35')]);_0x39e0a4[_0x2097('0x39')]=_[_0x2097('0x4d')](_0x2cf34e[_0x2097('0x39')]);_0x39e0a4[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x39e0a4['model'],_0x39e0a4[_0x2097('0x39')]);_0x113c3b[_0x2097('0x3e')]=_[_0x2097('0x3b')](_0x39e0a4[_0x2097('0x3c')],qs['fields'](_0x2cf34e['query']['fields']));_0x113c3b[_0x2097('0x3e')]=_0x113c3b[_0x2097('0x3e')]['length']?_0x113c3b[_0x2097('0x3e')]:_0x39e0a4[_0x2097('0x3c')];if(_0x2cf34e['query']['includeAll']){_0x113c3b[_0x2097('0x4e')]=[{'all':!![]}];}_0x113c3b=_[_0x2097('0x46')]({},_0x113c3b,_0x2cf34e[_0x2097('0x48')]);return db['VoicePrefix'][_0x2097('0x4f')](_0x113c3b)[_0x2097('0x2c')](handleEntityNotFound(_0x46ccbb,null))['then'](respondWithResult(_0x46ccbb,null))[_0x2097('0x4b')](handleError(_0x46ccbb,null));};exports[_0x2097('0x2d')]=function(_0xdfea21,_0xba6ef0){return db[_0x2097('0x34')]['find']({'where':{'id':_0xdfea21['params']['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0xba6ef0,null))[_0x2097('0x2c')](removeEntity(_0xba6ef0,null))[_0x2097('0x4b')](handleError(_0xba6ef0,null));};exports['describe']=function(_0x5c1739,_0x144719){return db[_0x2097('0x34')]['describe']()[_0x2097('0x2c')](respondWithResult(_0x144719,null))[_0x2097('0x4b')](handleError(_0x144719,null));};exports[_0x2097('0x50')]=function(_0x33490e,_0x390a52){var _0x4a709a;return db[_0x2097('0x51')][_0x2097('0x52')](function(_0x190859){return db['VoicePrefix'][_0x2097('0x50')](_0x33490e[_0x2097('0x53')],{'transaction':_0x190859})['then'](function(_0x12ba76){_0x4a709a=_0x12ba76['get']({'plain':!![]});return db[_0x2097('0x54')]['find']({'where':{'id':_0x4a709a['VoiceExtensionId']},'raw':!![]})['then'](function(_0x40cbe1){return createVoicePrefixExtensions(_0x4a709a,_0x40cbe1,_0x190859);});});})['then'](function(){var _0x54bea1=_0x33490e[_0x2097('0x55')]['get']({'plain':!![]});if(!_0x54bea1)throw new Error(_0x2097('0x56'));if(_0x54bea1[_0x2097('0x57')]==='user'){var _0x3e799f=_0x4a709a;return db[_0x2097('0x58')][_0x2097('0x4f')]({'where':{'name':_0x2097('0x59'),'userProfileId':_0x54bea1[_0x2097('0x5a')]},'raw':!![]})['then'](function(_0x2117e3){if(_0x2117e3&&_0x2117e3['autoAssociation']===0x0){return db[_0x2097('0x2e')][_0x2097('0x50')]({'name':_0x3e799f[_0x2097('0x30')],'resourceId':_0x3e799f['id'],'type':_0x2117e3['name'],'sectionId':_0x2117e3['id']},{})[_0x2097('0x2c')](function(){return _0x4a709a;});}else{return _0x4a709a;}})[_0x2097('0x4b')](function(_0x2f5016){logger[_0x2097('0x5b')](_0x2097('0x5c'),_0x2f5016);throw _0x2f5016;});}return _0x4a709a;})['then'](respondWithResult(_0x390a52,null))['catch'](handleError(_0x390a52,null));};function Extension(_0x265eac,_0x275578,_0x4cc782,_0x4ddb4b){this['context']='from-sip';this[_0x2097('0x5d')]=_0x265eac;this['app']=_0x4cc782;this[_0x2097('0x37')]=_0x2097('0x5e');this['description']=_0x2097('0x5f');this[_0x2097('0x60')]=_0x275578;this[_0x2097('0x61')]=_0x4ddb4b;}function createVoicePrefixExtensions(_0x103756,_0x2a2673,_0x60332a){return new BPromise(function(_0x15aa91,_0x8f7aaa){var _0x2ec365=new Extension(formatPrefixName(_0x103756['prefix']),0x1,_0x2097('0x62'),_0x2097('0x63'));_0x2ec365[_0x2097('0x64')]=_0x103756['id'];return db[_0x2097('0x54')][_0x2097('0x50')](_0x2ec365,{'transaction':_0x60332a})[_0x2097('0x2c')](function(_0x4befa9){var _0x43071d=_0x4befa9[_0x2097('0x65')]({'plain':!![]});var _0xcabda7=_[_0x2097('0x33')](addVoicePrefixExtensions(_0x103756,_0x2a2673),function(_0x1c4156){_0x1c4156['VoiceExtensionId']=_0x43071d['id'];_0x1c4156[_0x2097('0x64')]=_0x103756['id'];return _0x1c4156;});return db[_0x2097('0x54')]['bulkCreate'](_0xcabda7,{'transaction':_0x60332a})['then'](function(_0x580c1e){if(!_0x580c1e){return _0x8f7aaa(_0x2097('0x66'));}else{return _0x15aa91(_0x580c1e);}})[_0x2097('0x4b')](function(_0x319d3b){return _0x8f7aaa(_0x319d3b);});});;});};function addVoicePrefixExtensions(_0x3edb3e,_0x168703){var _0x18d90a=[];var _0x2e287b=formatPrefixName(_0x3edb3e[_0x2097('0x67')]);_0x18d90a[_0x2097('0x68')](new Extension(_0x2e287b,0x2,'Set','CDR(prefix)='+_0x3edb3e[_0x2097('0x30')]));if(_0x3edb3e[_0x2097('0x69')]){_0x18d90a[_0x2097('0x68')](new Extension(_0x2e287b,0x3,_0x2097('0x6a'),_0x2097('0x6b')+_0x3edb3e[_0x2097('0x69')]));}else{_0x18d90a['push'](new Extension(_0x2e287b,0x3,_0x2097('0x62'),_0x2097('0x6c')));}_0x18d90a[_0x2097('0x68')](new Extension(_0x2e287b,0x4,_0x2097('0x6d'),_0x168703['context']+','+'${EXTEN:'+(0x8+_0x3edb3e[_0x2097('0x30')][_0x2097('0x6e')])+'}'+','+0x1));return _0x18d90a;}function formatPrefixName(_0x487f1f){var _0x3707da='_';for(var _0x426290=0x0;_0x426290<_0x487f1f[_0x2097('0x6e')];_0x426290++){if(_0x487f1f[_0x2097('0x6f')](_0x426290)=='-'){_0x3707da+=_0x487f1f[_0x2097('0x6f')](_0x426290);}else{_0x3707da+='['+_0x487f1f[_0x2097('0x6f')](_0x426290)+']';}}_0x3707da+='.';return _0x3707da;}exports[_0x2097('0x2b')]=function(_0x2c6f24,_0x54159e,_0x4533fd){var _0x283e2b=_0x2c6f24['body'];_0x283e2b[_0x2097('0x67')]=_0x2097('0x70')+_0x283e2b[_0x2097('0x30')]+'-';return db[_0x2097('0x51')][_0x2097('0x52')](function(_0x46d6b5){return db[_0x2097('0x34')][_0x2097('0x2b')](_0x283e2b,{'where':{'id':_0x283e2b['id']},'transaction':_0x46d6b5})[_0x2097('0x2c')](function(){return db[_0x2097('0x54')][_0x2097('0x2d')]({'where':{'VoicePrefixId':_0x283e2b['id']},'transaction':_0x46d6b5})['then'](function(){return db[_0x2097('0x54')][_0x2097('0x4f')]({'where':{'id':_0x283e2b[_0x2097('0x71')]},'raw':!![]})[_0x2097('0x2c')](function(_0x3c9e03){return createVoicePrefixExtensions(_0x283e2b,_0x3c9e03,_0x46d6b5);});});});})['then'](function(){return db[_0x2097('0x34')][_0x2097('0x72')](_0x283e2b['id']);})[_0x2097('0x2c')](respondWithResult(_0x54159e,null))['catch'](handleError(_0x54159e,null));};exports[_0x2097('0x73')]=function(_0x545cd9,_0x364d3a,_0x4dcd9c){return db[_0x2097('0x34')]['find']({'where':{'id':_0x545cd9[_0x2097('0x4c')]['id']}})['then'](handleEntityNotFound(_0x364d3a,null))[_0x2097('0x2c')](function(_0x3dba80){if(_0x3dba80){return _0x3dba80[_0x2097('0x73')](_0x545cd9[_0x2097('0x53')][_0x2097('0x74')],_['omit'](_0x545cd9[_0x2097('0x53')],[_0x2097('0x74'),'id'])||{})[_0x2097('0x75')](function(_0x1f733c){for(var _0xa8416a=0x0;_0xa8416a<_0x545cd9[_0x2097('0x53')][_0x2097('0x74')][_0x2097('0x6e')];_0xa8416a+=0x1){socket[_0x2097('0x76')](_0x2097('0x77'),{'UserId':Number(_0x545cd9[_0x2097('0x53')][_0x2097('0x74')][_0xa8416a]),'VoicePrefixId':Number(_0x545cd9[_0x2097('0x4c')]['id'])});}return _0x1f733c;});}})[_0x2097('0x2c')](respondWithResult(_0x364d3a,null))[_0x2097('0x4b')](handleError(_0x364d3a,null));};exports[_0x2097('0x78')]=function(_0x57a31e,_0x1a81de,_0x4bd44d){return db['VoicePrefix'][_0x2097('0x4f')]({'where':{'id':_0x57a31e[_0x2097('0x4c')]['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0x1a81de,null))['then'](function(_0x34b687){if(_0x34b687){return _0x34b687[_0x2097('0x78')](_0x57a31e[_0x2097('0x39')][_0x2097('0x74')])['then'](function(){if(_[_0x2097('0x79')](_0x57a31e['query'][_0x2097('0x74')])){for(var _0x385551=0x0;_0x385551<_0x57a31e[_0x2097('0x39')][_0x2097('0x74')]['length'];_0x385551+=0x1){socket[_0x2097('0x76')](_0x2097('0x7a'),{'UserId':Number(_0x57a31e[_0x2097('0x39')]['ids'][_0x385551]),'VoicePrefixId':Number(_0x57a31e[_0x2097('0x4c')]['id'])});}}else{socket[_0x2097('0x76')](_0x2097('0x7a'),{'UserId':Number(_0x57a31e['query'][_0x2097('0x74')]),'VoicePrefixId':Number(_0x57a31e[_0x2097('0x4c')]['id'])});}});}})[_0x2097('0x2c')](respondWithStatusCode(_0x1a81de,null))[_0x2097('0x4b')](handleError(_0x1a81de,null));};exports[_0x2097('0x7b')]=function(_0x5efe1e,_0x5d181f,_0x56d4c0){var _0xc7481d={};var _0x3f510d={};var _0x4213d0;var _0x16451c;return db[_0x2097('0x34')][_0x2097('0x7c')]({'where':{'id':_0x5efe1e['params']['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0x5d181f,null))[_0x2097('0x2c')](function(_0x164ad3){if(_0x164ad3){_0x4213d0=_0x164ad3;_0x3f510d[_0x2097('0x3c')]=_[_0x2097('0x4d')](db[_0x2097('0x7d')][_0x2097('0x35')]);_0x3f510d['query']=_[_0x2097('0x4d')](_0x5efe1e[_0x2097('0x39')]);_0x3f510d[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x3f510d[_0x2097('0x3c')],_0x3f510d[_0x2097('0x39')]);_0xc7481d['attributes']=_['intersection'](_0x3f510d[_0x2097('0x3c')],qs['fields'](_0x5efe1e['query'][_0x2097('0x3d')]));_0xc7481d[_0x2097('0x3e')]=_0xc7481d[_0x2097('0x3e')][_0x2097('0x6e')]?_0xc7481d[_0x2097('0x3e')]:_0x3f510d[_0x2097('0x3c')];_0xc7481d[_0x2097('0x41')]=qs[_0x2097('0x42')](_0x5efe1e['query'][_0x2097('0x42')]);_0xc7481d[_0x2097('0x43')]=qs[_0x2097('0x3a')](_[_0x2097('0x44')](_0x5efe1e[_0x2097('0x39')],_0x3f510d['filters']));if(_0x5efe1e[_0x2097('0x39')][_0x2097('0x45')]){_0xc7481d[_0x2097('0x43')]=_[_0x2097('0x46')](_0xc7481d[_0x2097('0x43')],{'$or':_[_0x2097('0x33')](_0xc7481d['attributes'],function(_0x33b0c0){var _0x79f858={};_0x79f858[_0x33b0c0]={'$like':'%'+_0x5efe1e['query']['filter']+'%'};return _0x79f858;})});}_0xc7481d=_['merge']({},_0xc7481d,_0x5efe1e['options']);return _0x4213d0[_0x2097('0x7b')](_0xc7481d);}})[_0x2097('0x2c')](function(_0x3fe29e){if(_0x3fe29e){_0x16451c=_0x3fe29e[_0x2097('0x6e')];if(!_0x5efe1e[_0x2097('0x39')]['hasOwnProperty'](_0x2097('0x40'))){_0xc7481d[_0x2097('0x25')]=qs[_0x2097('0x25')](_0x5efe1e[_0x2097('0x39')][_0x2097('0x25')]);_0xc7481d[_0x2097('0x23')]=qs['offset'](_0x5efe1e[_0x2097('0x39')][_0x2097('0x23')]);}return _0x4213d0['getAgents'](_0xc7481d);}})[_0x2097('0x2c')](function(_0x358bc3){if(_0x358bc3){return _0x358bc3?{'count':_0x16451c,'rows':_0x358bc3}:null;}})[_0x2097('0x2c')](respondWithResult(_0x5d181f,null))[_0x2097('0x4b')](handleError(_0x5d181f,null));};exports[_0x2097('0x7e')]=function(_0x498a91,_0x3a7959,_0x35570d){var _0x86f89={};var _0x26a3e5={};var _0x25bb03;var _0x429c9e;return db[_0x2097('0x34')][_0x2097('0x7c')]({'where':{'id':_0x498a91[_0x2097('0x4c')]['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0x3a7959,null))[_0x2097('0x2c')](function(_0x299a3e){if(_0x299a3e){_0x25bb03=_0x299a3e;_0x26a3e5[_0x2097('0x3c')]=_['keys'](db['Team'][_0x2097('0x35')]);_0x26a3e5['query']=_['keys'](_0x498a91[_0x2097('0x39')]);_0x26a3e5[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x26a3e5[_0x2097('0x3c')],_0x26a3e5[_0x2097('0x39')]);_0x86f89['attributes']=_['intersection'](_0x26a3e5[_0x2097('0x3c')],qs['fields'](_0x498a91[_0x2097('0x39')]['fields']));_0x86f89['attributes']=_0x86f89['attributes']['length']?_0x86f89['attributes']:_0x26a3e5[_0x2097('0x3c')];_0x86f89[_0x2097('0x41')]=qs[_0x2097('0x42')](_0x498a91[_0x2097('0x39')][_0x2097('0x42')]);_0x86f89[_0x2097('0x43')]=qs[_0x2097('0x3a')](_[_0x2097('0x44')](_0x498a91[_0x2097('0x39')],_0x26a3e5[_0x2097('0x3a')]));if(_0x498a91[_0x2097('0x39')][_0x2097('0x45')]){_0x86f89[_0x2097('0x43')]=_[_0x2097('0x46')](_0x86f89[_0x2097('0x43')],{'$or':_[_0x2097('0x33')](_0x86f89[_0x2097('0x3e')],function(_0x5e49bc){var _0x1e30c5={};_0x1e30c5[_0x5e49bc]={'$like':'%'+_0x498a91[_0x2097('0x39')][_0x2097('0x45')]+'%'};return _0x1e30c5;})});}_0x86f89=_[_0x2097('0x46')]({},_0x86f89,_0x498a91[_0x2097('0x48')]);return _0x25bb03[_0x2097('0x7e')](_0x86f89);}})[_0x2097('0x2c')](function(_0x1c5ec7){if(_0x1c5ec7){_0x429c9e=_0x1c5ec7[_0x2097('0x6e')];if(!_0x498a91[_0x2097('0x39')][_0x2097('0x3f')]('nolimit')){_0x86f89[_0x2097('0x25')]=qs[_0x2097('0x25')](_0x498a91[_0x2097('0x39')][_0x2097('0x25')]);_0x86f89[_0x2097('0x23')]=qs[_0x2097('0x23')](_0x498a91['query']['offset']);}return _0x25bb03[_0x2097('0x7e')](_0x86f89);}})[_0x2097('0x2c')](function(_0x2beb7a){if(_0x2beb7a){return _0x2beb7a?{'count':_0x429c9e,'rows':_0x2beb7a}:null;}})['then'](respondWithResult(_0x3a7959,null))[_0x2097('0x4b')](handleError(_0x3a7959,null));};exports[_0x2097('0x7f')]=function(_0x4eeac1,_0x459585,_0x436533){var _0x16405f=_0x4eeac1[_0x2097('0x53')][_0x2097('0x74')];var _0x41f718;return db[_0x2097('0x80')][_0x2097('0x81')]({'where':{'id':_0x16405f},'attributes':['id'],'include':[{'model':db[_0x2097('0x7d')],'as':_0x2097('0x82'),'attributes':['id',_0x2097('0x30'),_0x2097('0x83'),_0x2097('0x84'),_0x2097('0x85')],'raw':!![]}]})[_0x2097('0x2c')](function(_0x44661a){if(_0x44661a){_0x41f718=_0x44661a;var _0x39e21f=_['flatMap'](_0x44661a,function(_0x2d211b){var _0x1ab39a=_0x2d211b[_0x2097('0x65')]({'plain':!![]});return _0x1ab39a[_0x2097('0x82')];});return db[_0x2097('0x34')][_0x2097('0x4f')]({'where':{'id':_0x4eeac1[_0x2097('0x4c')]['id']}})[_0x2097('0x2c')](function(_0xecd4fc){return db[_0x2097('0x51')]['transaction'](function(_0x2fb539){return _0xecd4fc[_0x2097('0x7f')](_0x16405f,{'transaction':_0x2fb539})[_0x2097('0x2c')](function(){return BPromise[_0x2097('0x86')](_0x41f718,function(_0x17c494){return db[_0x2097('0x87')][_0x2097('0x88')]({'TeamId':_0x17c494['id'],'VoicePrefixId':_0x4eeac1[_0x2097('0x4c')]['id']},{'transaction':_0x2fb539});});})['then'](function(){return BPromise[_0x2097('0x86')](_0x39e21f,function(_0x239570){return db[_0x2097('0x89')][_0x2097('0x8a')]({'where':{'UserId':_0x239570['id'],'VoicePrefixId':_0x4eeac1[_0x2097('0x4c')]['id']},'transaction':_0x2fb539});});})[_0x2097('0x2c')](function(){_0x39e21f[_0x2097('0x8b')](function(_0x51bb2f){socket[_0x2097('0x76')](_0x2097('0x77'),{'UserId':_0x51bb2f['id'],'VoicePrefixId':_0xecd4fc['id']});});});});});}})['then'](respondWithStatusCode(_0x459585,null))[_0x2097('0x4b')](handleError(_0x459585,null));};exports[_0x2097('0x8c')]=function(_0x568de5,_0x473a54,_0x53a5ed){return db[_0x2097('0x80')][_0x2097('0x81')]({'where':{'id':_0x568de5['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x2097('0x7d')],'as':_0x2097('0x82'),'attributes':['id'],'raw':!![]}]})[_0x2097('0x2c')](handleEntityNotFound(_0x473a54,null))[_0x2097('0x2c')](function(_0x1909d8){var _0x2de4=_[_0x2097('0x33')](_0x1909d8,'id');var _0x43a1f8=[];var _0xb53629=[];var _0x516ed6=squel[_0x2097('0x8d')]();_0x516ed6[_0x2097('0x8e')]('tq.TeamId')['from'](_0x2097('0x8f'),'tq')[_0x2097('0x90')](_0x2097('0x91'),'ut',_0x2097('0x92'))[_0x2097('0x43')](_0x2097('0x93'),_0x568de5[_0x2097('0x4c')]['id']);for(var _0x5626f0=0x0;_0x5626f0<_0x1909d8[_0x2097('0x6e')];_0x5626f0+=0x1){let _0x45bbca=_0x1909d8[_0x5626f0];for(var _0x46fc92=0x0;_0x46fc92<_0x45bbca[_0x2097('0x82')][_0x2097('0x6e')];_0x46fc92+=0x1){let _0x357a5b=_0x45bbca[_0x2097('0x82')][_0x46fc92];var _0x3fcedc=_0x516ed6[_0x2097('0x94')]();_0x3fcedc[_0x2097('0x43')](_0x2097('0x95'),_0x357a5b['id']);_0xb53629['push'](db[_0x2097('0x51')][_0x2097('0x39')](_0x3fcedc['toString'](),{'type':db[_0x2097('0x51')][_0x2097('0x96')]['SELECT']})[_0x2097('0x2c')](function(_0xbe052f){if(_0xbe052f['length']===0x1){return _0x357a5b['id'];}else{var _0x32c5f1=_[_0x2097('0x97')](_[_0x2097('0x33')](_0xbe052f,_0x2097('0x98')),function(_0x456633){return _[_0x2097('0x99')](_0x2de4,_0x456633);});if(_0x32c5f1){return _0x357a5b['id'];}}}));}}return BPromise[_0x2097('0x9a')](_0xb53629)[_0x2097('0x2c')](function(_0x124d8f){_0x43a1f8=_(_0x43a1f8)[_0x2097('0x9b')](_0x124d8f)['compact']()[_0x2097('0x9c')]();return db[_0x2097('0x34')][_0x2097('0x4f')]({'where':{'id':_0x568de5[_0x2097('0x4c')]['id']}})['then'](function(_0x1b555e){return db['sequelize'][_0x2097('0x52')](function(_0x1ab515){return _0x1b555e[_0x2097('0x8c')](_0x568de5[_0x2097('0x39')][_0x2097('0x74')],{'transaction':_0x1ab515})[_0x2097('0x2c')](function(){if(!_[_0x2097('0x9d')](_0x43a1f8)){return _0x1b555e[_0x2097('0x78')](_0x43a1f8,{'transaction':_0x1ab515});}})[_0x2097('0x2c')](function(){_0x43a1f8['forEach'](function(_0x22fa5d){socket['emit']('userVoicePrefix:remove',{'UserId':_0x22fa5d,'VoicePrefixId':_0x1b555e['id']});});});});});});})['then'](respondWithStatusCode(_0x473a54,null))['catch'](handleError(_0x473a54,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 444df8d..012358a 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 _0x11ce=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5051f7,_0x1af9ad){var _0x3cbda8=function(_0x2f5d1d){while(--_0x2f5d1d){_0x5051f7['push'](_0x5051f7['shift']());}};_0x3cbda8(++_0x1af9ad);}(_0x11ce,0xd7));var _0xe11c=function(_0x33fdfa,_0x41be60){_0x33fdfa=_0x33fdfa-0x0;var _0x5b390a=_0x11ce[_0x33fdfa];return _0x5b390a;};'use strict';var EventEmitter=require(_0xe11c('0x0'));var VoicePrefix=require(_0xe11c('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe11c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe11c('0x3'),'afterDestroy':_0xe11c('0x4')};function emitEvent(_0xe90349){return function(_0x3492b2,_0x4a3d0a,_0x177614){VoicePrefixEvents[_0xe11c('0x5')](_0xe90349+':'+_0x3492b2['id'],_0x3492b2);VoicePrefixEvents['emit'](_0xe90349,_0x3492b2);_0x177614(null);};}for(var e in events){if(events[_0xe11c('0x6')](e)){var event=events[e];VoicePrefix[_0xe11c('0x7')](e,emitEvent(event));}}module[_0xe11c('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x9f8c=['../../mysqldb','VoicePrefix','save','remove','emit','hook','exports','events'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9f8c,0x147));var _0xc9f8=function(_0x2e2897,_0x2e0810){_0x2e2897=_0x2e2897-0x0;var _0x4b38ba=_0x9f8c[_0x2e2897];return _0x4b38ba;};'use strict';var EventEmitter=require(_0xc9f8('0x0'));var VoicePrefix=require(_0xc9f8('0x1'))['db'][_0xc9f8('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc9f8('0x3'),'afterUpdate':'update','afterDestroy':_0xc9f8('0x4')};function emitEvent(_0x22be5a){return function(_0x2a568b,_0x12eb64,_0x406957){VoicePrefixEvents['emit'](_0x22be5a+':'+_0x2a568b['id'],_0x2a568b);VoicePrefixEvents[_0xc9f8('0x5')](_0x22be5a,_0x2a568b);_0x406957(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xc9f8('0x6')](e,emitEvent(event));}}module[_0xc9f8('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 96a417c..6403f65 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 _0x649b=['rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','util','../../config/logger','api','moment','request-promise','path'];(function(_0x1f754a,_0x38709f){var _0x4b1c93=function(_0x4e90e0){while(--_0x4e90e0){_0x1f754a['push'](_0x1f754a['shift']());}};_0x4b1c93(++_0x38709f);}(_0x649b,0x1e8));var _0xb649=function(_0x1f7992,_0x39a3cc){_0x1f7992=_0x1f7992-0x0;var _0x3aae1a=_0x649b[_0x1f7992];return _0x3aae1a;};'use strict';var _=require('lodash');var util=require(_0xb649('0x0'));var logger=require(_0xb649('0x1'))(_0xb649('0x2'));var moment=require(_0xb649('0x3'));var BPromise=require('bluebird');var rp=require(_0xb649('0x4'));var fs=require('fs');var path=require(_0xb649('0x5'));var rimraf=require(_0xb649('0x6'));var config=require(_0xb649('0x7'));var attributes=require(_0xb649('0x8'));module[_0xb649('0x9')]=function(_0x24dca5,_0x275040){return _0x24dca5[_0xb649('0xa')](_0xb649('0xb'),attributes,{'tableName':_0xb649('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9a4=['util','../../config/logger','api','moment','request-promise','../../config/environment','./voicePrefix.attributes','voice_prefixes','lodash'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe9a4,0x1c1));var _0x4e9a=function(_0x548e1d,_0x3534d3){_0x548e1d=_0x548e1d-0x0;var _0x398584=_0xe9a4[_0x548e1d];return _0x398584;};'use strict';var _=require(_0x4e9a('0x0'));var util=require(_0x4e9a('0x1'));var logger=require(_0x4e9a('0x2'))(_0x4e9a('0x3'));var moment=require(_0x4e9a('0x4'));var BPromise=require('bluebird');var rp=require(_0x4e9a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4e9a('0x6'));var attributes=require(_0x4e9a('0x7'));module['exports']=function(_0x2ac64e,_0x518452){return _0x2ac64e['define']('VoicePrefix',attributes,{'tableName':_0x4e9a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 26121b2..21d31a7 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 _0x22b4=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash'];(function(_0x2e5ec9,_0x598e67){var _0x1b88fa=function(_0x438cf8){while(--_0x438cf8){_0x2e5ec9['push'](_0x2e5ec9['shift']());}};_0x1b88fa(++_0x598e67);}(_0x22b4,0x8b));var _0x422b=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x22b4[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x422b('0x0'));var util=require(_0x422b('0x1'));var moment=require(_0x422b('0x2'));var BPromise=require(_0x422b('0x3'));var rs=require(_0x422b('0x4'));var fs=require('fs');var Redis=require(_0x422b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x422b('0x6'));var logger=require(_0x422b('0x7'))('rpc');var config=require(_0x422b('0x8'));var jayson=require(_0x422b('0x9'));var client=jayson[_0x422b('0xa')][_0x422b('0xb')]({'port':0x232a});config[_0x422b('0xc')]=_[_0x422b('0xd')](config['redis'],{'host':_0x422b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x422b('0xc')]));require(_0x422b('0xf'))[_0x422b('0x10')](socket);function respondWithRpcPromise(_0x13e837,_0x2223a5,_0x42bcfa){return new BPromise(function(_0x552298,_0x3bfc9a){return client[_0x422b('0x11')](_0x13e837,_0x42bcfa)[_0x422b('0x12')](function(_0x419b65){logger[_0x422b('0x13')](_0x422b('0x14'),_0x2223a5,_0x422b('0x15'));logger[_0x422b('0x16')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2223a5,'request\x20sent',JSON[_0x422b('0x17')](_0x419b65));if(_0x419b65[_0x422b('0x18')]){if(_0x419b65[_0x422b('0x18')][_0x422b('0x19')]===0x1f4){logger[_0x422b('0x18')](_0x422b('0x14'),_0x2223a5,_0x419b65[_0x422b('0x18')][_0x422b('0x1a')]);return _0x3bfc9a(_0x419b65['error'][_0x422b('0x1a')]);}logger['error'](_0x422b('0x14'),_0x2223a5,_0x419b65[_0x422b('0x18')][_0x422b('0x1a')]);return _0x552298(_0x419b65[_0x422b('0x18')][_0x422b('0x1a')]);}else{logger[_0x422b('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x2223a5,_0x422b('0x15'));_0x552298(_0x419b65[_0x422b('0x1b')][_0x422b('0x1a')]);}})['catch'](function(_0x131330){logger[_0x422b('0x18')](_0x422b('0x14'),_0x2223a5,_0x131330);_0x3bfc9a(_0x131330);});});} \ No newline at end of file +var _0xb7de=['info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','request'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xb7de,0xc7));var _0xeb7d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb7de[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xeb7d('0x0'));var util=require(_0xeb7d('0x1'));var moment=require(_0xeb7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xeb7d('0x3'));var fs=require('fs');var Redis=require(_0xeb7d('0x4'));var db=require(_0xeb7d('0x5'))['db'];var utils=require(_0xeb7d('0x6'));var logger=require(_0xeb7d('0x7'))('rpc');var config=require(_0xeb7d('0x8'));var jayson=require(_0xeb7d('0x9'));var client=jayson[_0xeb7d('0xa')][_0xeb7d('0xb')]({'port':0x232a});config[_0xeb7d('0xc')]=_['defaults'](config['redis'],{'host':_0xeb7d('0xd'),'port':0x18eb});var socket=require(_0xeb7d('0xe'))(new Redis(config[_0xeb7d('0xc')]));require(_0xeb7d('0xf'))['register'](socket);function respondWithRpcPromise(_0x38cf68,_0x185f3b,_0x65e85a){return new BPromise(function(_0x568d8c,_0x492804){return client[_0xeb7d('0x10')](_0x38cf68,_0x65e85a)['then'](function(_0x1aa13a){logger[_0xeb7d('0x11')](_0xeb7d('0x12'),_0x185f3b,_0xeb7d('0x13'));logger[_0xeb7d('0x14')](_0xeb7d('0x15'),_0x185f3b,'request\x20sent',JSON[_0xeb7d('0x16')](_0x1aa13a));if(_0x1aa13a[_0xeb7d('0x17')]){if(_0x1aa13a[_0xeb7d('0x17')][_0xeb7d('0x18')]===0x1f4){logger[_0xeb7d('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x185f3b,_0x1aa13a[_0xeb7d('0x17')]['message']);return _0x492804(_0x1aa13a[_0xeb7d('0x17')][_0xeb7d('0x19')]);}logger[_0xeb7d('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x185f3b,_0x1aa13a['error'][_0xeb7d('0x19')]);return _0x568d8c(_0x1aa13a[_0xeb7d('0x17')]['message']);}else{logger['info'](_0xeb7d('0x12'),_0x185f3b,_0xeb7d('0x13'));_0x568d8c(_0x1aa13a['result'][_0xeb7d('0x19')]);}})[_0xeb7d('0x1a')](function(_0x32fb0b){logger[_0xeb7d('0x17')](_0xeb7d('0x12'),_0x185f3b,_0x32fb0b);_0x492804(_0x32fb0b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index d237af0..d05e80e 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 _0xb264=['./voicePrefix.events','save','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x3d5249,_0x5d96f4){var _0x712ed=function(_0xf4b7ac){while(--_0xf4b7ac){_0x3d5249['push'](_0x3d5249['shift']());}};_0x712ed(++_0x5d96f4);}(_0xb264,0x108));var _0x4b26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb264[_0x3dd15e];return _0x231fd0;};'use strict';var VoicePrefixEvents=require(_0x4b26('0x0'));var events=[_0x4b26('0x1'),'remove',_0x4b26('0x2')];function createListener(_0x5148a6,_0x4f2b32){return function(_0xa2bcef){_0x4f2b32[_0x4b26('0x3')](_0x5148a6,_0xa2bcef);};}function removeListener(_0x2c7976,_0x2acd7f){return function(){VoicePrefixEvents[_0x4b26('0x4')](_0x2c7976,_0x2acd7f);};}exports[_0x4b26('0x5')]=function(_0x1e3af6){for(var _0x4e039d=0x0,_0x165096=events[_0x4b26('0x6')];_0x4e039d<_0x165096;_0x4e039d++){var _0x5a8c67=events[_0x4e039d];var _0x1edb7c=createListener(_0x4b26('0x7')+_0x5a8c67,_0x1e3af6);VoicePrefixEvents['on'](_0x5a8c67,_0x1edb7c);}}; \ No newline at end of file +var _0xd1d4=['save','update','emit','removeListener','register','length','./voicePrefix.events'];(function(_0x52d2ff,_0x47d07d){var _0x197e57=function(_0x2279e5){while(--_0x2279e5){_0x52d2ff['push'](_0x52d2ff['shift']());}};_0x197e57(++_0x47d07d);}(_0xd1d4,0xfb));var _0x4d1d=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xd1d4[_0xe66cf2];return _0x2d84e7;};'use strict';var VoicePrefixEvents=require(_0x4d1d('0x0'));var events=[_0x4d1d('0x1'),'remove',_0x4d1d('0x2')];function createListener(_0x54f44c,_0x5ed209){return function(_0x2fdf2e){_0x5ed209[_0x4d1d('0x3')](_0x54f44c,_0x2fdf2e);};}function removeListener(_0x260e6a,_0x3bcfda){return function(){VoicePrefixEvents[_0x4d1d('0x4')](_0x260e6a,_0x3bcfda);};}exports[_0x4d1d('0x5')]=function(_0x30466a){for(var _0xb8a403=0x0,_0x1547d5=events[_0x4d1d('0x6')];_0xb8a403<_0x1547d5;_0xb8a403++){var _0x23f6c4=events[_0xb8a403];var _0x54da0f=createListener('voicePrefix:'+_0x23f6c4,_0x30466a);VoicePrefixEvents['on'](_0x23f6c4,_0x54da0f);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 92b930e..0865a23 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(_0x580a02,_0x184f3a){var _0x48c2c4=function(_0x14cad4){while(--_0x14cad4){_0x580a02['push'](_0x580a02['shift']());}};_0x48c2c4(++_0x184f3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 _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(_0x123d23,_0x2b6282){var _0x183491=function(_0xbff35b){while(--_0xbff35b){_0x123d23['push'](_0x123d23['shift']());}};_0x183491(++_0x2b6282);}(_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'));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 diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 9ea9b48..72c2421 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 _0xd941=['mandatoryDisposition','sequelize','exports','STRING','name','inbound','outbound','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','getDataValue','type','dialMethod','strategy','preview','booked','roundrobin','includes','INTEGER','ENUM','yes','all','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','progressive','power','predictive','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xd941,0x13d));var _0x1d94=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0xd941[_0x1bfe2b];return _0x1477d4;};'use strict';var Sequelize=require(_0x1d94('0x0'));module[_0x1d94('0x1')]={'name':{'type':Sequelize[_0x1d94('0x2')],'allowNull':![],'unique':_0x1d94('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x1d94('0x4'),_0x1d94('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x1d94('0x6'),_0x1d94('0x7'),_0x1d94('0x8'),_0x1d94('0x9'),_0x1d94('0xa'),_0x1d94('0xb'),_0x1d94('0xc')),'allowNull':![],'defaultValue':'ringall','set':function(_0x2cf336){this[_0x1d94('0xd')]('strategy',_0x2cf336?_0x2cf336:_0x1d94('0x9'));},'get':function(){var _0x35ffa3=this[_0x1d94('0xe')](_0x1d94('0xf'));var _0x234796=this[_0x1d94('0xe')](_0x1d94('0x10'));var _0x5f1380=this[_0x1d94('0xe')](_0x1d94('0x11'));if(_0x35ffa3===_0x1d94('0x5')){if(_0x234796===_0x1d94('0x12')){return null;}if(_0x234796===_0x1d94('0x13')&&!['rrmemory',_0x1d94('0x14')][_0x1d94('0x15')](_0x5f1380)){this[_0x1d94('0xd')](_0x1d94('0x11'),_0x1d94('0x9'));}}return _0x5f1380;}},'servicelevel':{'type':Sequelize[_0x1d94('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x1d94('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1d94('0x16')](0xb)},'timeout':{'type':Sequelize[_0x1d94('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1d94('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1d94('0x2')]},'weight':{'type':Sequelize[_0x1d94('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1d94('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1d94('0x17')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0x1d94('0x18'),'no',_0x1d94('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1d94('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x1d94('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1d94('0x17')](_0x1d94('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1d94('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x1d94('0x17')](_0x1d94('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x1d94('0x17')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1d94('0x17')](_0x1d94('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x1d94('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1d94('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x1d94('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x1d94('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x1d94('0x17')](_0x1d94('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1d94('0x17')]('yes','no'),'defaultValue':_0x1d94('0x18')},'announce_holdtime':{'type':Sequelize[_0x1d94('0x17')](_0x1d94('0x18'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x1d94('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1d94('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x1d94('0x2')]},'queue_youarenext':{'type':Sequelize[_0x1d94('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x1d94('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x1d94('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1d94('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1d94('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1d94('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x1d94('0x2')]},'queue_quantity1':{'type':Sequelize[_0x1d94('0x2')]},'queue_quantity2':{'type':Sequelize[_0x1d94('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x1d94('0x2')]},'queue_less_than':{'type':Sequelize[_0x1d94('0x2')]},'periodic_announce':{'type':Sequelize[_0x1d94('0x1a')],'set':function(_0x534f0b){this['setDataValue']('periodic_announce',_0x534f0b?_0x534f0b[_0x1d94('0x1b')](','):[]);},'get':function(){return this[_0x1d94('0xe')](_0x1d94('0x1c'))?this[_0x1d94('0xe')]('periodic_announce')[_0x1d94('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x1d94('0x2')],'defaultValue':_0x1d94('0x18'),'set':function(_0x447419){this[_0x1d94('0xd')](_0x1d94('0x1e'),_0x447419?_0x447419[_0x1d94('0x1b')](','):undefined);},'get':function(){return this[_0x1d94('0xe')](_0x1d94('0x1e'))?this[_0x1d94('0xe')](_0x1d94('0x1e'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x1d94('0x2')],'defaultValue':'no','set':function(_0x2fed15){this[_0x1d94('0xd')](_0x1d94('0x1f'),_0x2fed15?_0x2fed15['join'](','):undefined);},'get':function(){return this[_0x1d94('0xe')]('leavewhenempty')?this[_0x1d94('0xe')](_0x1d94('0x1f'))[_0x1d94('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x1d94('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1d94('0x17')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1d94('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x1d94('0x17')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1d94('0x2')]},'acw':{'type':Sequelize[_0x1d94('0x20')],'defaultValue':0x0,'set':function(_0x232a0e){this['setDataValue'](_0x1d94('0x21'),_0x232a0e);if(_0x232a0e){if(this[_0x1d94('0xe')](_0x1d94('0x22'))<0x2){this[_0x1d94('0xd')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1d94('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0x1d94('0x12'),_0x1d94('0x23'),_0x1d94('0x24'),_0x1d94('0x25'),'booked'),'defaultValue':'progressive','comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x1d94('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1d94('0x26')},'dialLimitQueue':{'type':Sequelize[_0x1d94('0x16')](0x4)[_0x1d94('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1d94('0x28')},'dialPowerLevel':{'type':Sequelize[_0x1d94('0x29')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1d94('0x2a')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x1d94('0x2b'),'dropRate'),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x1d94('0x29')](0x2)[_0x1d94('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x1d94('0x2c')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x1d94('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x1d94('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1d94('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1d94('0x16')](0x3)[_0x1d94('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d94('0x2d')},'dialQueueOptions':{'type':Sequelize[_0x1d94('0x2')],'defaultValue':'tTxX','comment':_0x1d94('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x1d94('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x1d94('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1d94('0x16')](0x3)[_0x1d94('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d94('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d94('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x1d94('0x16')](0x3)[_0x1d94('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d94('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1d94('0x16')](0x5)[_0x1d94('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d94('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1d94('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x1d94('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1d94('0x16')](0x5)[_0x1d94('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d94('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1d94('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1d94('0x2')],'defaultValue':_0x1d94('0x36')},'dialPrefix':{'type':Sequelize[_0x1d94('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x1d94('0x17')](_0x1d94('0x37'),_0x1d94('0x38'),_0x1d94('0x39')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1d94('0x16')](0x9)[_0x1d94('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x1d94('0x16')](0x9)[_0x1d94('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1d94('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1d94('0x16')](0x9)[_0x1d94('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1d94('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1d94('0x16')](0x9)[_0x1d94('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1d94('0x3c')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x1d94('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1d94('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1d94('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1d94('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x1d94('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1d94('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1d94('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x1d94('0x16')](0x5)[_0x1d94('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x1d94('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x1d94('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x1d94('0x17')](_0x1d94('0x42'),_0x1d94('0x43')),'defaultValue':_0x1d94('0x42')},'dialQueueProject2':{'type':Sequelize[_0x1d94('0x2')],'comment':_0x1d94('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x1d94('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1d94('0x16')](0x3)[_0x1d94('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1d94('0x44')},'dialCutDigit':{'type':Sequelize[_0x1d94('0x16')](0x3)[_0x1d94('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1d94('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1d94('0x16')](0x3)[_0x1d94('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d94('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1d94('0x16')](0x5)[_0x1d94('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x1d94('0x16')](0x3)[_0x1d94('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d94('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0x1d94('0x16')](0x5)[_0x1d94('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d94('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1d94('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d94('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1d94('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d94('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0x1d94('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x1d94('0x16')](0x5)[_0x1d94('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1d94('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1d94('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d94('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1d94('0x16')],'allowNull':!![],'comment':_0x1d94('0x4c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x148d10){if(!_0x148d10)this[_0x1d94('0xd')](_0x1d94('0x4d'),null);this[_0x1d94('0xd')](_0x1d94('0x4e'),_0x148d10);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x1d94('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1d94('0x16')](0x3)[_0x1d94('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1d94('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x1d94('0x16')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xdf15=['once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','dropRate','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','exports','STRING','ENUM','inbound','outbound','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','setDataValue','strategy','dialMethod','getDataValue','preview','booked','roundrobin','includes','INTEGER','yes'];(function(_0xc2c1af,_0x126c35){var _0x4892d7=function(_0x3e728e){while(--_0x3e728e){_0xc2c1af['push'](_0xc2c1af['shift']());}};_0x4892d7(++_0x126c35);}(_0xdf15,0x1db));var _0x5df1=function(_0x9967f1,_0x5aa679){_0x9967f1=_0x9967f1-0x0;var _0x1fa42c=_0xdf15[_0x9967f1];return _0x1fa42c;};'use strict';var Sequelize=require('sequelize');module[_0x5df1('0x0')]={'name':{'type':Sequelize[_0x5df1('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5df1('0x2')](_0x5df1('0x3'),_0x5df1('0x4')),'allowNull':![],'defaultValue':_0x5df1('0x3')},'musiconhold':{'type':Sequelize[_0x5df1('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x5df1('0x2')]('rr',_0x5df1('0x5'),_0x5df1('0x6'),_0x5df1('0x7'),_0x5df1('0x8'),_0x5df1('0x9'),_0x5df1('0xa'),_0x5df1('0xb'),'rrordered'),'allowNull':![],'defaultValue':_0x5df1('0x5'),'set':function(_0x270427){this[_0x5df1('0xc')](_0x5df1('0xd'),_0x270427?_0x270427:_0x5df1('0x9'));},'get':function(){var _0x4ea784=this['getDataValue']('type');var _0x12c888=this['getDataValue'](_0x5df1('0xe'));var _0xfafcde=this[_0x5df1('0xf')](_0x5df1('0xd'));if(_0x4ea784==='outbound'){if(_0x12c888===_0x5df1('0x10')){return null;}if(_0x12c888===_0x5df1('0x11')&&![_0x5df1('0x9'),_0x5df1('0x12')][_0x5df1('0x13')](_0xfafcde)){this[_0x5df1('0xc')](_0x5df1('0xd'),_0x5df1('0x9'));}}return _0xfafcde;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x5df1('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x5df1('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x5df1('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x5df1('0x1')]},'weight':{'type':Sequelize[_0x5df1('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x5df1('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x5df1('0x2')](_0x5df1('0x15'),'no'),'defaultValue':_0x5df1('0x15')},'autopause':{'type':Sequelize[_0x5df1('0x2')](_0x5df1('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x5df1('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x5df1('0x2')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x5df1('0x2')](_0x5df1('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x5df1('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x5df1('0x2')](_0x5df1('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x5df1('0x2')](_0x5df1('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x5df1('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x5df1('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x5df1('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x5df1('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x5df1('0x2')](_0x5df1('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x5df1('0x2')]('yes','no'),'defaultValue':_0x5df1('0x15')},'announce_holdtime':{'type':Sequelize[_0x5df1('0x2')](_0x5df1('0x15'),'no',_0x5df1('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x5df1('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x5df1('0x2')](_0x5df1('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x5df1('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x5df1('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x5df1('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x5df1('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x5df1('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x5df1('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x5df1('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x5df1('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x5df1('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x5df1('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x5df1('0x1')]},'queue_quantity2':{'type':Sequelize[_0x5df1('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x5df1('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0xbeeef8){this['setDataValue'](_0x5df1('0x17'),_0xbeeef8?_0xbeeef8[_0x5df1('0x18')](','):[]);},'get':function(){return this[_0x5df1('0xf')](_0x5df1('0x17'))?this[_0x5df1('0xf')](_0x5df1('0x17'))[_0x5df1('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x5df1('0x1')],'defaultValue':_0x5df1('0x15'),'set':function(_0x5c6ade){this[_0x5df1('0xc')]('joinempty',_0x5c6ade?_0x5c6ade[_0x5df1('0x18')](','):undefined);},'get':function(){return this[_0x5df1('0xf')](_0x5df1('0x1a'))?this[_0x5df1('0xf')](_0x5df1('0x1a'))[_0x5df1('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x5df1('0x1')],'defaultValue':'no','set':function(_0x101d3f){this['setDataValue'](_0x5df1('0x1b'),_0x101d3f?_0x101d3f[_0x5df1('0x18')](','):undefined);},'get':function(){return this[_0x5df1('0xf')]('leavewhenempty')?this[_0x5df1('0xf')](_0x5df1('0x1b'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x5df1('0x2')](_0x5df1('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x5df1('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x5df1('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x5df1('0x2')](_0x5df1('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x5df1('0x1')]},'description':{'type':Sequelize[_0x5df1('0x1')]},'acw':{'type':Sequelize[_0x5df1('0x1c')],'defaultValue':0x0,'set':function(_0xe9d6e4){this['setDataValue']('acw',_0xe9d6e4);if(_0xe9d6e4){if(this[_0x5df1('0xf')]('wrapuptime')<0x2){this[_0x5df1('0xc')](_0x5df1('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x5df1('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x5df1('0x1c')],'defaultValue':0x0,'comment':_0x5df1('0x1e')},'dialMethod':{'type':Sequelize[_0x5df1('0x2')](_0x5df1('0x10'),'progressive',_0x5df1('0x1f'),'predictive','booked'),'defaultValue':'progressive','comment':_0x5df1('0x20')},'dialLimitChannel':{'type':Sequelize[_0x5df1('0x14')](0x4)[_0x5df1('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5df1('0x22')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x5df1('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5df1('0x23')},'dialPowerLevel':{'type':Sequelize[_0x5df1('0x24')](0x2)[_0x5df1('0x21')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0x5df1('0x25')),'defaultValue':_0x5df1('0x25'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x5df1('0x24')](0x2)[_0x5df1('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x5df1('0x26')},'dialPredictiveInterval':{'type':Sequelize[_0x5df1('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x5df1('0x27')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5df1('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x5df1('0x14')](0x3)[_0x5df1('0x21')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5df1('0x28')},'dialQueueOptions':{'type':Sequelize[_0x5df1('0x1')],'defaultValue':_0x5df1('0x29'),'comment':_0x5df1('0x2a')},'dialQueueTimeout':{'type':Sequelize[_0x5df1('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5df1('0x2b')},'dialQueueProject':{'type':Sequelize[_0x5df1('0x1')],'comment':_0x5df1('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5df1('0x14')](0x3)[_0x5df1('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5df1('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5df1('0x2d')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5df1('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5df1('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x5df1('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5df1('0x14')](0x5)[_0x5df1('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5df1('0x30')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5df1('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5df1('0x31')},'dialTimezone':{'type':Sequelize[_0x5df1('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5df1('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x5df1('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x5df1('0x2')](_0x5df1('0x32'),_0x5df1('0x33'),_0x5df1('0x34')),'defaultValue':_0x5df1('0x32')},'dialAMDActive':{'type':Sequelize[_0x5df1('0x1c')],'defaultValue':0x0,'comment':_0x5df1('0x35')},'dialAMDInitialSilence':{'type':Sequelize[_0x5df1('0x14')](0x9)[_0x5df1('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5df1('0x36')},'dialAMDGreeting':{'type':Sequelize[_0x5df1('0x14')](0x9)[_0x5df1('0x21')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5df1('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5df1('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5df1('0x14')](0x9)[_0x5df1('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5df1('0x38')},'dialAMDMinWordLength':{'type':Sequelize[_0x5df1('0x14')](0x9)[_0x5df1('0x21')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5df1('0x21')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5df1('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5df1('0x14')](0x9)[_0x5df1('0x21')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5df1('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5df1('0x14')](0x5)[_0x5df1('0x21')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5df1('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x5df1('0x21')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x5df1('0x3b')},'dialRecallInQueue':{'type':Sequelize[_0x5df1('0x1c')],'defaultValue':0x0,'comment':_0x5df1('0x3c')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x5df1('0x3d'),_0x5df1('0x3e')),'defaultValue':_0x5df1('0x3d')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x5df1('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x5df1('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5df1('0x14')](0x3)[_0x5df1('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5df1('0x3f')},'dialCutDigit':{'type':Sequelize[_0x5df1('0x14')](0x3)[_0x5df1('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5df1('0x40')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5df1('0x14')](0x3)[_0x5df1('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5df1('0x41')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5df1('0x14')](0x5)[_0x5df1('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x5df1('0x14')](0x3)[_0x5df1('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5df1('0x42')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5df1('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5df1('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5df1('0x14')](0x5)[_0x5df1('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x5df1('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5df1('0x44')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5df1('0x14')](0x5)[_0x5df1('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5df1('0x14')](0x3)[_0x5df1('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5df1('0x14')](0x5)[_0x5df1('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x5df1('0x45')},'mandatoryDisposition':{'type':Sequelize[_0x5df1('0x1c')],'defaultValue':![],'comment':_0x5df1('0x46'),'set':function(_0x4509d1){if(!_0x4509d1)this[_0x5df1('0xc')]('mandatoryDispositionPauseId',null);this[_0x5df1('0xc')]('mandatoryDisposition',_0x4509d1);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x5df1('0x14')](0x3)[_0x5df1('0x21')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x5df1('0x14')](0x3)[_0x5df1('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x5df1('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x5df1('0x14')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x5df1('0x1c')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 4704fda..1499072 100644 --- a/server/api/voiceQueue/voiceQueue.controller.js +++ b/server/api/voiceQueue/voiceQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['QueueCampaigns','outbound','filter','map','value','type','find','name','end','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','UserProfileResource','clone','merge','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','online','interface','flatMap','penalty','sequelize','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','voicePause','forEach','emit','userVoiceQueue:save','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','squel','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','inbound'];(function(_0x5bcd38,_0x487761){var _0x8d0e1e=function(_0x702141){while(--_0x702141){_0x5bcd38['push'](_0x5bcd38['shift']());}};_0x8d0e1e(++_0x487761);}(_0xe14b,0x93));var _0xbe14=function(_0x17f1aa,_0x2d4f92){_0x17f1aa=_0x17f1aa-0x0;var _0x5b6948=_0xe14b[_0x17f1aa];return _0x5b6948;};'use strict';var moment=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0xbe14('0x2'));var Redis=require(_0xbe14('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x4'))('api');var config=require('../../config/environment');var db=require(_0xbe14('0x5'))['db'];config[_0xbe14('0x6')]=_[_0xbe14('0x7')](config[_0xbe14('0x6')],{'host':_0xbe14('0x8'),'port':0x18eb});var socket=require(_0xbe14('0x9'))(new Redis(config[_0xbe14('0x6')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x496063,_0x30c355){_0x30c355=_0x30c355||0xcc;return function(_0x6fceff){if(_0x6fceff){return _0x496063[_0xbe14('0xa')](_0x30c355);}return _0x496063[_0xbe14('0xb')](_0x30c355)['end']();};}function respondWithResult(_0x5b9fc6,_0x113243){_0x113243=_0x113243||0xc8;return function(_0x3f70cb){if(_0x3f70cb){return _0x5b9fc6['status'](_0x113243)[_0xbe14('0xc')](_0x3f70cb);}};}function respondWithFilteredResult(_0x35aa19,_0x886a5e){return function(_0x3d38c2){if(_0x3d38c2){var _0x27792f=typeof _0x886a5e[_0xbe14('0xd')]===_0xbe14('0xe')&&typeof _0x886a5e[_0xbe14('0xf')]===_0xbe14('0xe');var _0xa2cf72=_0x3d38c2[_0xbe14('0x10')];var _0x33fd54=_0x27792f?0x0:_0x886a5e[_0xbe14('0xd')];var _0x530538=_0x27792f?_0x3d38c2['count']:_0x886a5e[_0xbe14('0xd')]+_0x886a5e[_0xbe14('0xf')];var _0xf4ac9;if(_0x530538>=_0xa2cf72){_0x530538=_0xa2cf72;_0xf4ac9=0xc8;}else{_0xf4ac9=0xce;}_0x35aa19[_0xbe14('0xb')](_0xf4ac9);return _0x35aa19['set'](_0xbe14('0x11'),_0x33fd54+'-'+_0x530538+'/'+_0xa2cf72)[_0xbe14('0xc')](_0x3d38c2);}return null;};}function saveUpdates(_0xfd7b8f){return function(_0x123ede){if(_0x123ede){return _0x123ede[_0xbe14('0x12')](_0xfd7b8f)[_0xbe14('0x13')](function(_0x17ae86){return _0x17ae86;});}return null;};}function removeEntity(_0x5ea1f8){return function(_0x137ee5){if(_0x137ee5){return _0x137ee5[_0xbe14('0x14')]()[_0xbe14('0x13')](function(){var _0x433459=_0x137ee5[_0xbe14('0x15')]({'plain':!![]});var _0x37e4c1=[{'name':'VoiceQueues','value':_0xbe14('0x16'),'ignore':![]},{'name':_0xbe14('0x17'),'value':_0xbe14('0x18'),'ignore':![]}];var _0xc12977=_(_0x37e4c1)[_0xbe14('0x19')]('ignore')[_0xbe14('0x1a')]('value')[_0xbe14('0x1b')]();if(_['includes'](_0xc12977,_0x433459[_0xbe14('0x1c')])){return;}var _0x4a25fa=_[_0xbe14('0x1d')](_0x37e4c1,[_0xbe14('0x1b'),_0x433459['type']])[_0xbe14('0x1e')];return db['UserProfileResource'][_0xbe14('0x14')]({'where':{'type':_0x4a25fa,'resourceId':_0x433459['id']}})['then'](function(){return _0x137ee5;});})[_0xbe14('0x13')](function(){_0x5ea1f8[_0xbe14('0xb')](0xcc)[_0xbe14('0x1f')]();});}};}function handleEntityNotFound(_0x39cc81){return function(_0x15ef02){if(!_0x15ef02){_0x39cc81[_0xbe14('0xa')](0x194);}return _0x15ef02;};}function handleError(_0x55d001,_0x1822e0){_0x1822e0=_0x1822e0||0x1f4;return function(_0x1ba46a){logger[_0xbe14('0x20')](_0x1ba46a[_0xbe14('0x21')]);if(_0x1ba46a['name']){delete _0x1ba46a[_0xbe14('0x1e')];}_0x55d001[_0xbe14('0xb')](_0x1822e0)['send'](_0x1ba46a);};}exports[_0xbe14('0x22')]=function(_0x3b3e84,_0x1c7cc7){var _0x19252f={};var _0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x1a')](db[_0xbe14('0x23')][_0xbe14('0x24')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x25')],'type':_0x16a159[_0xbe14('0x1c')][_0xbe14('0x26')]};});_0x19252f=qs[_0xbe14('0x27')](_0x36d4b2,_0x3b3e84);var _0x223f7a={'where':_0x19252f[_0xbe14('0x28')]};return db[_0xbe14('0x23')][_0xbe14('0x10')](_0x223f7a)[_0xbe14('0x13')](function(_0x14e7c4){_0x34d648['count']=_0x14e7c4;_0x19252f[_0xbe14('0x29')]=qs['include'](_0x3b3e84['query']);return db[_0xbe14('0x23')]['findAll'](_0x19252f);})[_0xbe14('0x13')](function(_0x345b0){_0x34d648['rows']=_0x345b0;return _0x34d648;})['then'](respondWithFilteredResult(_0x1c7cc7,_0x19252f))['catch'](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x2a')]=function(_0xa3d24,_0x5f27b6){var _0x46c570={'raw':![],'where':{'id':_0xa3d24[_0xbe14('0x2b')]['id']}},_0x1faf3e={};_0x1faf3e[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['VoiceQueue']['rawAttributes']);_0x1faf3e[_0xbe14('0x2e')]=_['keys'](_0xa3d24['query']);_0x1faf3e['filters']=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],_0x1faf3e[_0xbe14('0x2e')]);_0x46c570[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x46c570[_0xbe14('0x30')]=_0x46c570[_0xbe14('0x30')][_0xbe14('0x32')]?_0x46c570['attributes']:_0x1faf3e['model'];if(_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x46c570[_0xbe14('0x29')]=[{'all':!![]}];}_0x46c570=_['merge']({},_0x46c570,_0xa3d24[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x46c570)[_0xbe14('0x13')](handleEntityNotFound(_0x5f27b6,null))[_0xbe14('0x13')](respondWithResult(_0x5f27b6,null))[_0xbe14('0x35')](handleError(_0x5f27b6,null));};exports[_0xbe14('0x36')]=function(_0x128843,_0x1b2608){return db['VoiceQueue'][_0xbe14('0x36')](_0x128843[_0xbe14('0x37')],{})[_0xbe14('0x13')](function(_0x1b3118){var _0x3287b9=_0x128843[_0xbe14('0x38')]['get']({'plain':!![]});if(!_0x3287b9)throw new Error(_0xbe14('0x39'));if(_0x3287b9[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x36263c=_0x1b3118['get']({'plain':!![]});var _0x4bfa96=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x5d5318=_[_0xbe14('0x1d')](_0x4bfa96,['value',_0x36263c['type']])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x5d5318,'userProfileId':_0x3287b9['userProfileId']},'raw':!![]})['then'](function(_0x5aaa4f){if(_0x5aaa4f&&_0x5aaa4f[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x36263c['name'],'resourceId':_0x36263c['id'],'type':_0x5aaa4f[_0xbe14('0x1e')],'sectionId':_0x5aaa4f['id']},{})[_0xbe14('0x13')](function(){return _0x1b3118;});}else{return _0x1b3118;}})[_0xbe14('0x35')](function(_0x3ab0f6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ab0f6);throw _0x3ab0f6;});}return _0x1b3118;})[_0xbe14('0x13')](respondWithResult(_0x1b2608,0xc9))[_0xbe14('0x35')](handleError(_0x1b2608,null));};exports[_0xbe14('0x3f')]=function(_0xb2b285,_0x2550dc){var _0x4f2d95={'where':{'id':_0xb2b285[_0xbe14('0x2b')]['id']}},_0x51023a={};_0x51023a[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x23')]['rawAttributes']);_0x4f2d95[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x51023a['model'],qs[_0xbe14('0x31')](_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x4f2d95[_0xbe14('0x30')]=_0x4f2d95['attributes']['length']?_0x4f2d95[_0xbe14('0x30')]:_0x51023a[_0xbe14('0x2c')];if(_0xb2b285['query']['includeAll']){_0x4f2d95[_0xbe14('0x29')]=[{'all':!![]}];}_0x4f2d95=_[_0xbe14('0x40')]({},_0x4f2d95,_0xb2b285[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x4f2d95)[_0xbe14('0x13')](handleEntityNotFound(_0x2550dc,null))[_0xbe14('0x13')](function(_0x5a4068){if(_0x5a4068){var _0xf32e93=_0x5a4068[_0xbe14('0x15')]({'plain':!![]});_0xf32e93=qs[_0xbe14('0x41')](_0xf32e93,['id',_0xbe14('0x42'),_0xbe14('0x43')]);_0xb2b285['body']=_[_0xbe14('0x41')](_0xb2b285[_0xbe14('0x37')],['id',_0xbe14('0x42'),_0xbe14('0x43')]);return db[_0xbe14('0x23')][_0xbe14('0x36')](_['merge'](_0xf32e93,_0xb2b285['body']),{'include':_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x33')]?[{'all':!![]}]:undefined})[_0xbe14('0x13')](function(_0x48554a){var _0x497b00=_0xb2b285[_0xbe14('0x38')][_0xbe14('0x15')]({'plain':!![]});if(!_0x497b00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497b00[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x50c2a0=_0x48554a[_0xbe14('0x15')]({'plain':!![]});var _0x4a40d2=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x435c8d=_[_0xbe14('0x1d')](_0x4a40d2,['value',_0x50c2a0[_0xbe14('0x1c')]])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x435c8d,'userProfileId':_0x497b00[_0xbe14('0x44')]},'raw':!![]})['then'](function(_0x42a346){if(_0x42a346&&_0x42a346[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x50c2a0[_0xbe14('0x1e')],'resourceId':_0x50c2a0['id'],'type':_0x42a346[_0xbe14('0x1e')],'sectionId':_0x42a346['id']},{})[_0xbe14('0x13')](function(){return _0x48554a;});}else{return _0x48554a;}})['catch'](function(_0x72c875){logger[_0xbe14('0x20')](_0xbe14('0x45'),_0x72c875);throw _0x72c875;});}return _0x48554a;});}})[_0xbe14('0x13')](respondWithResult(_0x2550dc,0xc9))[_0xbe14('0x35')](handleError(_0x2550dc,null));};exports[_0xbe14('0x12')]=function(_0xd8f78f,_0x32df3c){if(_0xd8f78f[_0xbe14('0x37')]['id']){delete _0xd8f78f[_0xbe14('0x37')]['id'];}return db[_0xbe14('0x23')]['find']({'where':{'id':_0xd8f78f['params']['id']}})['then'](handleEntityNotFound(_0x32df3c,null))[_0xbe14('0x13')](saveUpdates(_0xd8f78f[_0xbe14('0x37')],null))[_0xbe14('0x13')](respondWithResult(_0x32df3c,null))[_0xbe14('0x35')](handleError(_0x32df3c,null));};exports[_0xbe14('0x14')]=function(_0x66ddf,_0x16ee48){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x66ddf[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x16ee48,null))[_0xbe14('0x13')](removeEntity(_0x16ee48,null))[_0xbe14('0x35')](handleError(_0x16ee48,null));};exports[_0xbe14('0x46')]=function(_0x1c831a,_0xcef8e3){var _0x179077={'raw':![],'where':{}};var _0x2225d9={};var _0x29761b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x1c831a[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xcef8e3,null))[_0xbe14('0x13')](function(_0x46b49c){if(_0x46b49c){_0x2225d9[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x47')][_0xbe14('0x24')]);_0x2225d9[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x1c831a['query']);_0x2225d9[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x2225d9[_0xbe14('0x2c')],_0x2225d9[_0xbe14('0x2e')]);_0x179077[_0xbe14('0x30')]=_['intersection'](_0x2225d9[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x179077[_0xbe14('0x30')]=_0x179077['attributes'][_0xbe14('0x32')]?_0x179077[_0xbe14('0x30')]:_0x2225d9[_0xbe14('0x2c')];if(!_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x179077[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x1c831a['query'][_0xbe14('0xf')]);_0x179077[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x179077[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x1c831a['query']['sort']);_0x179077[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x1c831a[_0xbe14('0x2e')],_0x2225d9[_0xbe14('0x48')]));_0x179077[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x46b49c['id'];if(_0x1c831a[_0xbe14('0x2e')]['filter']){_0x179077['where']=_[_0xbe14('0x40')](_0x179077[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x179077['attributes'],function(_0x76e91e){var _0x16bca1={};_0x16bca1[_0x76e91e]={'$like':'%'+_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x16bca1;})});}_0x179077=_[_0xbe14('0x40')]({},_0x179077,_0x1c831a[_0xbe14('0x34')]);return db[_0xbe14('0x47')]['count']({'where':_0x179077[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x3baa26){_0x29761b[_0xbe14('0x10')]=_0x3baa26;if(_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x179077[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopper'][_0xbe14('0x4f')](_0x179077);})[_0xbe14('0x13')](function(_0x3cd17e){_0x29761b[_0xbe14('0x50')]=_0x3cd17e;return _0x29761b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0xcef8e3,_0x179077))[_0xbe14('0x35')](handleError(_0xcef8e3,null));};exports[_0xbe14('0x51')]=function(_0xd756b2,_0x5d064e){var _0x1e5ce1={'raw':!![],'where':{}};var _0x401968={};var _0x362999={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0xd756b2[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d064e,null))[_0xbe14('0x13')](function(_0x175213){if(_0x175213){_0x401968[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperHistory'][_0xbe14('0x24')]);_0x401968[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0xd756b2[_0xbe14('0x2e')]);_0x401968[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x401968[_0xbe14('0x2c')],_0x401968['query']);_0x1e5ce1[_0xbe14('0x30')]=_['intersection'](_0x401968[_0xbe14('0x2c')],qs['fields'](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e5ce1[_0xbe14('0x30')]=_0x1e5ce1['attributes'][_0xbe14('0x32')]?_0x1e5ce1[_0xbe14('0x30')]:_0x401968[_0xbe14('0x2c')];if(!_0xd756b2['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e5ce1[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0xd756b2['query'][_0xbe14('0xf')]);_0x1e5ce1[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x1e5ce1[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0xd756b2['query'][_0xbe14('0x4c')]);_0x1e5ce1[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0xd756b2[_0xbe14('0x2e')],_0x401968[_0xbe14('0x48')]));_0x1e5ce1[_0xbe14('0x28')]['VoiceQueueId']=_0x175213['id'];if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e5ce1['where']=_[_0xbe14('0x40')](_0x1e5ce1['where'],{'$or':_[_0xbe14('0x1a')](_0x1e5ce1[_0xbe14('0x30')],function(_0x4dfa19){var _0x55d729={};_0x55d729[_0x4dfa19]={'$like':'%'+_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x55d729;})});}_0x1e5ce1=_[_0xbe14('0x40')]({},_0x1e5ce1,_0xd756b2['options']);return db[_0xbe14('0x53')][_0xbe14('0x10')]({'where':_0x1e5ce1[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x5ee624){_0x362999['count']=_0x5ee624;if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x1e5ce1[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x53')][_0xbe14('0x4f')](_0x1e5ce1);})[_0xbe14('0x13')](function(_0x139aab){_0x362999['rows']=_0x139aab;return _0x362999;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x5d064e,_0x1e5ce1))['catch'](handleError(_0x5d064e,null));};exports[_0xbe14('0x54')]=function(_0x3a01bb,_0x8d47f2){var _0x2382c4={'raw':!![],'where':{}};var _0x55a3ae={};var _0x1e160b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3a01bb['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x8d47f2,null))[_0xbe14('0x13')](function(_0x4090bc){if(_0x4090bc){_0x55a3ae[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x55')][_0xbe14('0x24')]);_0x55a3ae[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x3a01bb[_0xbe14('0x2e')]);_0x55a3ae[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],_0x55a3ae[_0xbe14('0x2e')]);_0x2382c4[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x2382c4['attributes']=_0x2382c4[_0xbe14('0x30')]['length']?_0x2382c4[_0xbe14('0x30')]:_0x55a3ae[_0xbe14('0x2c')];if(!_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x2382c4['limit']=qs['limit'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x2382c4[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x3a01bb['query'][_0xbe14('0xd')]);}_0x2382c4[_0xbe14('0x4b')]=qs['sort'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x2382c4[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x3a01bb[_0xbe14('0x2e')],_0x55a3ae['filters']));_0x2382c4['where'][_0xbe14('0x4e')]=_0x4090bc['id'];if(_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x2382c4[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x2382c4['where'],{'$or':_[_0xbe14('0x1a')](_0x2382c4[_0xbe14('0x30')],function(_0x5dc793){var _0x4e35ed={};_0x4e35ed[_0x5dc793]={'$like':'%'+_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x4e35ed;})});}_0x2382c4=_['merge']({},_0x2382c4,_0x3a01bb[_0xbe14('0x34')]);return db['CmHopperFinal'][_0xbe14('0x10')]({'where':_0x2382c4['where']})[_0xbe14('0x13')](function(_0x5d4431){_0x1e160b[_0xbe14('0x10')]=_0x5d4431;if(_0x3a01bb['query'][_0xbe14('0x33')]){_0x2382c4[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2382c4);})[_0xbe14('0x13')](function(_0x4db7e8){_0x1e160b['rows']=_0x4db7e8;return _0x1e160b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x8d47f2,_0x2382c4))[_0xbe14('0x35')](handleError(_0x8d47f2,null));};exports[_0xbe14('0x56')]=function(_0x11c341,_0x1a780a){var _0x313a87={'raw':!![],'where':{}};var _0x30d2b0={};var _0x57ad22={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x11c341[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1a780a,null))['then'](function(_0x26372a){if(_0x26372a){_0x30d2b0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperBlack'][_0xbe14('0x24')]);_0x30d2b0[_0xbe14('0x2e')]=_['keys'](_0x11c341[_0xbe14('0x2e')]);_0x30d2b0['filters']=_[_0xbe14('0x2f')](_0x30d2b0[_0xbe14('0x2c')],_0x30d2b0[_0xbe14('0x2e')]);_0x313a87['attributes']=_[_0xbe14('0x2f')](_0x30d2b0['model'],qs[_0xbe14('0x31')](_0x11c341['query']['fields']));_0x313a87[_0xbe14('0x30')]=_0x313a87['attributes'][_0xbe14('0x32')]?_0x313a87['attributes']:_0x30d2b0[_0xbe14('0x2c')];if(!_0x11c341[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x313a87[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x313a87[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x313a87[_0xbe14('0x4b')]=qs['sort'](_0x11c341[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x313a87[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x11c341['query'],_0x30d2b0['filters']));_0x313a87[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x26372a['id'];if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x313a87[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x313a87[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x313a87[_0xbe14('0x30')],function(_0x26e7a7){var _0x761b3d={};_0x761b3d[_0x26e7a7]={'$like':'%'+_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x761b3d;})});}_0x313a87=_[_0xbe14('0x40')]({},_0x313a87,_0x11c341[_0xbe14('0x34')]);return db[_0xbe14('0x57')][_0xbe14('0x10')]({'where':_0x313a87[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x28a1e9){_0x57ad22[_0xbe14('0x10')]=_0x28a1e9;if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x313a87[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x57')]['findAll'](_0x313a87);})[_0xbe14('0x13')](function(_0x3303a4){_0x57ad22[_0xbe14('0x50')]=_0x3303a4;return _0x57ad22;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x1a780a,_0x313a87))[_0xbe14('0x35')](handleError(_0x1a780a,null));};exports[_0xbe14('0x58')]=function(_0x52b75d,_0x5b161c){var _0x165b7a={};var _0x4a44e0={};var _0x3730d1;var _0x4babba;return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x52b75d[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x5b161c,null))[_0xbe14('0x13')](function(_0x12498f){if(_0x12498f){_0x3730d1=_0x12498f;_0x4a44e0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x59')][_0xbe14('0x24')]);_0x4a44e0[_0xbe14('0x2e')]=_['keys'](_0x52b75d[_0xbe14('0x2e')]);_0x4a44e0[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x4a44e0[_0xbe14('0x2c')],_0x4a44e0['query']);_0x165b7a[_0xbe14('0x30')]=_['intersection'](_0x4a44e0[_0xbe14('0x2c')],qs['fields'](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x165b7a[_0xbe14('0x30')]=_0x165b7a['attributes'][_0xbe14('0x32')]?_0x165b7a['attributes']:_0x4a44e0[_0xbe14('0x2c')];_0x165b7a[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x165b7a[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x52b75d[_0xbe14('0x2e')],_0x4a44e0['filters']));if(_0x52b75d[_0xbe14('0x2e')]['filter']){_0x165b7a[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x165b7a[_0xbe14('0x28')],{'$or':_['map'](_0x165b7a[_0xbe14('0x30')],function(_0x1c5fbc){var _0x219403={};_0x219403[_0x1c5fbc]={'$like':'%'+_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x219403;})});}_0x165b7a=_['merge']({},_0x165b7a,_0x52b75d['options']);return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})['then'](function(_0x16b1c8){if(_0x16b1c8){_0x4babba=_0x16b1c8[_0xbe14('0x32')];if(!_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x165b7a[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x52b75d['query'][_0xbe14('0xf')]);_0x165b7a[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x52b75d[_0xbe14('0x2e')]['offset']);}return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})[_0xbe14('0x13')](function(_0x37aff6){if(_0x37aff6){return _0x37aff6?{'count':_0x4babba,'rows':_0x37aff6}:null;}})[_0xbe14('0x13')](respondWithResult(_0x5b161c,null))[_0xbe14('0x35')](handleError(_0x5b161c,null));};exports[_0xbe14('0x5a')]=function(_0x208fae,_0x310d42){var _0x9c229f=_0x208fae[_0xbe14('0x37')]['teams'];var _0xdb5515=_[_0xbe14('0x1a')](_0x9c229f,'id');return db[_0xbe14('0x59')][_0xbe14('0x4f')]({'where':{'id':_0xdb5515},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbe14('0x5b'),'attributes':['id',_0xbe14('0x1e'),_0xbe14('0x5c'),'voicePause',_0xbe14('0x5d')],'raw':!![]}]})[_0xbe14('0x13')](function(_0x1ec868){if(_0x1ec868){var _0x1a7321=_[_0xbe14('0x5e')](_0x1ec868,function(_0x2306f6){var _0x426189=_0x2306f6['get']({'plain':!![]});_0x426189[_0xbe14('0x5b')]['forEach'](function(_0x24d528){_0x24d528[_0xbe14('0x5f')]=_[_0xbe14('0x1d')](_0x9c229f,{'id':_0x426189['id']})[_0xbe14('0x5f')];});return _0x426189[_0xbe14('0x5b')];});return db['VoiceQueue']['find']({'where':{'id':_0x208fae[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(_0x29a892){return db[_0xbe14('0x60')]['transaction'](function(_0x46a251){return _0x29a892[_0xbe14('0x5a')](_0xdb5515,{'transaction':_0x46a251})[_0xbe14('0x13')](function(){return BPromise['each'](_0x9c229f,function(_0xe69b0e){return db['TeamVoiceQueue']['upsert']({'TeamId':_0xe69b0e['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id'],'penalty':_0xe69b0e[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_0x1a7321,function(_0x3ea9c2){return db[_0xbe14('0x61')]['findOrCreate']({'where':{'UserId':_0x3ea9c2['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id']},'defaults':{'penalty':_0x3ea9c2[_0xbe14('0x5f')]},'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_[_0xbe14('0x19')](_0x1a7321,{'online':!![]}),function(_0x1e2559){return db[_0xbe14('0x62')][_0xbe14('0x63')]({'membername':_0x1e2559[_0xbe14('0x1e')],'UserId':_0x1e2559['id'],'queue_name':_0x29a892['name'],'VoiceQueueId':_0x29a892['id'],'interface':_[_0xbe14('0x64')](_0x1e2559[_0xbe14('0x5d')])?util[_0xbe14('0x65')]('SIP/%s',_0x1e2559[_0xbe14('0x1e')]):_0x1e2559[_0xbe14('0x5d')],'paused':_0x1e2559[_0xbe14('0x66')]||![],'penalty':_0x1e2559[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){_0x1a7321[_0xbe14('0x67')](function(_0x1b22a0){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':_0x1b22a0['id'],'VoiceQueueId':_0x29a892['id']});});});});});}})[_0xbe14('0x13')](respondWithStatusCode(_0x310d42,null))[_0xbe14('0x35')](handleError(_0x310d42,null));};exports['removeTeams']=function(_0xf549ec,_0x2c3647){return db[_0xbe14('0x59')]['findAll']({'where':{'id':_0xf549ec[_0xbe14('0x2e')][_0xbe14('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xbe14('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe14('0x13')](handleEntityNotFound(_0x2c3647,null))['then'](function(_0x2d4b18){var _0xcd8cf6=_['map'](_0x2d4b18,'id');var _0x269e5a=[];var _0x4c7e2b=[];var _0x587f58=squel[_0xbe14('0x6c')]();_0x587f58[_0xbe14('0x6d')](_0xbe14('0x6e'))[_0xbe14('0x6f')](_0xbe14('0x70'),'tq')[_0xbe14('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbe14('0x28')](_0xbe14('0x72'),_0xf549ec[_0xbe14('0x2b')]['id']);for(var _0x3c23fc=0x0;_0x3c23fc<_0x2d4b18['length'];_0x3c23fc+=0x1){let _0x1d5333=_0x2d4b18[_0x3c23fc];for(var _0x4cb29c=0x0;_0x4cb29c<_0x1d5333[_0xbe14('0x5b')][_0xbe14('0x32')];_0x4cb29c+=0x1){let _0x5270b2=_0x1d5333[_0xbe14('0x5b')][_0x4cb29c];var _0x273df5=_0x587f58[_0xbe14('0x3f')]();_0x273df5[_0xbe14('0x28')](_0xbe14('0x73'),_0x5270b2['id']);_0x4c7e2b[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x273df5[_0xbe14('0x75')](),{'type':db[_0xbe14('0x60')][_0xbe14('0x76')][_0xbe14('0x77')]})['then'](function(_0x20f196){if(_0x20f196[_0xbe14('0x32')]===0x1){return _0x5270b2['id'];}else{var _0x1eb33b=_[_0xbe14('0x78')](_['map'](_0x20f196,_0xbe14('0x79')),function(_0xede1c1){return _['includes'](_0xcd8cf6,_0xede1c1);});if(_0x1eb33b){return _0x5270b2['id'];}}}));}}return BPromise[_0xbe14('0x7a')](_0x4c7e2b)[_0xbe14('0x13')](function(_0x11085c){_0x269e5a=_(_0x269e5a)['union'](_0x11085c)[_0xbe14('0x7b')]()[_0xbe14('0x1b')]();return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0xf549ec[_0xbe14('0x2b')]['id']}})['then'](function(_0x23208d){return db[_0xbe14('0x60')][_0xbe14('0x7c')](function(_0x3f7732){return _0x23208d[_0xbe14('0x7d')](_0xf549ec['query'][_0xbe14('0x6a')],{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){if(!_[_0xbe14('0x7e')](_0x269e5a)){return _0x23208d[_0xbe14('0x7f')](_0x269e5a,{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0xf549ec[_0xbe14('0x2b')]['id'],'UserId':_0x269e5a},'transaction':_0x3f7732});});}})['then'](function(){_0x269e5a['forEach'](function(_0x129ef6){socket[_0xbe14('0x68')](_0xbe14('0x80'),{'UserId':_0x129ef6,'VoiceQueueId':_0x23208d['id']});});});});});});})[_0xbe14('0x13')](respondWithStatusCode(_0x2c3647,null))[_0xbe14('0x35')](handleError(_0x2c3647,null));};exports['addAgents']=function(_0x15c93c,_0xf6ff8){var _0x3eaabe,_0x1ea11a;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x15c93c[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xf6ff8,null))['then'](function(_0xf6da38){if(_0xf6da38){_0x1ea11a=_0xf6da38;return _0xf6da38[_0xbe14('0x81')](_0x15c93c['body']['ids'],_[_0xbe14('0x41')](_0x15c93c['body'],[_0xbe14('0x6a'),'id'])||{})[_0xbe14('0x82')](function(_0x776e93){for(var _0x3f5ca3=0x0;_0x3f5ca3<_0x15c93c[_0xbe14('0x37')]['ids'][_0xbe14('0x32')];_0x3f5ca3+=0x1){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':Number(_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')][_0x3f5ca3]),'VoiceQueueId':Number(_0x15c93c[_0xbe14('0x2b')]['id'])});}return _0x776e93;});}})['then'](function(_0x4eea48){_0x3eaabe=_0x4eea48||[];if(_0x1ea11a){return db[_0xbe14('0x6b')]['findAll']({'where':{'id':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')]},'attributes':['id',_0xbe14('0x1e'),'online',_0xbe14('0x66'),_0xbe14('0x5d')],'raw':!![]});}})[_0xbe14('0x13')](function(_0x1ad15d){if(!_[_0xbe14('0x7e')](_0x1ad15d)){var _0x2e5106=[];for(var _0x156fb3=0x0;_0x156fb3<_0x1ad15d['length'];_0x156fb3++){if(_0x1ad15d[_0x156fb3][_0xbe14('0x5c')]){_0x2e5106['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x1ad15d[_0x156fb3]['name'],'UserId':_0x1ad15d[_0x156fb3]['id'],'queue_name':_0x1ea11a[_0xbe14('0x1e')],'VoiceQueueId':_0x1ea11a['id'],'interface':_[_0xbe14('0x64')](_0x1ad15d[_0x156fb3]['interface'])?util[_0xbe14('0x65')]('SIP/%s',_0x1ad15d[_0x156fb3][_0xbe14('0x1e')]):_0x1ad15d[_0x156fb3]['interface'],'paused':_0x1ad15d[_0x156fb3][_0xbe14('0x66')]||![],'penalty':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x5f')]||0x0}));}}return BPromise[_0xbe14('0x7a')](_0x2e5106);}})[_0xbe14('0x13')](function(){return _0x3eaabe;})['then'](respondWithResult(_0xf6ff8,null))[_0xbe14('0x35')](handleError(_0xf6ff8,null));};exports[_0xbe14('0x7f')]=function(_0x3aaa54,_0x413893){return db['VoiceQueue']['find']({'where':{'id':_0x3aaa54['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x413893,null))[_0xbe14('0x13')](function(_0x3826cf){if(_0x3826cf){return _0x3826cf[_0xbe14('0x7f')](_0x3aaa54[_0xbe14('0x2e')]['ids'])['then'](function(){if(_[_0xbe14('0x83')](_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')])){for(var _0x26092b=0x0;_0x26092b<_0x3aaa54[_0xbe14('0x2e')]['ids'][_0xbe14('0x32')];_0x26092b+=0x1){socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')][_0x26092b]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}}else{socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}});}})['then'](function(_0x44c341){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0x3aaa54['params']['id'],'UserId':_0x3aaa54['query'][_0xbe14('0x6a')]}})[_0xbe14('0x13')](function(){return _0x44c341;});})[_0xbe14('0x13')](respondWithStatusCode(_0x413893,null))['catch'](handleError(_0x413893,null));};exports[_0xbe14('0x84')]=function(_0x2f0d14,_0x180e61){var _0x952322={};var _0x3ae00b={};var _0x41962a;var _0x4ebf01;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x2f0d14[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x180e61,null))[_0xbe14('0x13')](function(_0x5f28dd){if(_0x5f28dd){_0x41962a=_0x5f28dd;_0x3ae00b['model']=_[_0xbe14('0x2d')](db['User'][_0xbe14('0x24')]);_0x3ae00b['query']=_[_0xbe14('0x2d')](_0x2f0d14[_0xbe14('0x2e')]);_0x3ae00b[_0xbe14('0x48')]=_['intersection'](_0x3ae00b[_0xbe14('0x2c')],_0x3ae00b[_0xbe14('0x2e')]);_0x952322[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x3ae00b[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x952322[_0xbe14('0x30')]=_0x952322[_0xbe14('0x30')]['length']?_0x952322[_0xbe14('0x30')]:_0x3ae00b[_0xbe14('0x2c')];_0x952322[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x952322[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x2f0d14[_0xbe14('0x2e')],_0x3ae00b[_0xbe14('0x48')]));if(_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x952322[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x952322['where'],{'$or':_['map'](_0x952322['attributes'],function(_0x598ccc){var _0x446b3f={};_0x446b3f[_0x598ccc]={'$like':'%'+_0x2f0d14[_0xbe14('0x2e')]['filter']+'%'};return _0x446b3f;})});}_0x952322=_[_0xbe14('0x40')]({},_0x952322,_0x2f0d14['options']);return _0x41962a[_0xbe14('0x84')](_0x952322);}})[_0xbe14('0x13')](function(_0x111ff0){if(_0x111ff0){_0x4ebf01=_0x111ff0[_0xbe14('0x32')];if(!_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x952322[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x952322[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x41962a[_0xbe14('0x84')](_0x952322);}})['then'](function(_0x2eb5e6){if(_0x2eb5e6){return _0x2eb5e6?{'count':_0x4ebf01,'rows':_0x2eb5e6}:null;}})['then'](respondWithResult(_0x180e61,null))[_0xbe14('0x35')](handleError(_0x180e61,null));};exports['getMembers']=function(_0x49cddc,_0x3bdbf7){var _0x19a1ae={};var _0x167dee={};var _0x4f6252;var _0x4536b9;return db['VoiceQueue'][_0xbe14('0x52')]({'where':{'id':_0x49cddc['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3bdbf7,null))[_0xbe14('0x13')](function(_0x21f14e){if(_0x21f14e){_0x4f6252=_0x21f14e;_0x167dee[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x62')]['rawAttributes']);_0x167dee[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x49cddc['query']);_0x167dee['filters']=_['intersection'](_0x167dee[_0xbe14('0x2c')],_0x167dee[_0xbe14('0x2e')]);_0x19a1ae[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x167dee[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x49cddc[_0xbe14('0x2e')]['fields']));_0x19a1ae[_0xbe14('0x30')]=_0x19a1ae[_0xbe14('0x30')][_0xbe14('0x32')]?_0x19a1ae['attributes']:_0x167dee[_0xbe14('0x2c')];_0x19a1ae[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x49cddc['query']['sort']);_0x19a1ae[_0xbe14('0x28')]=qs['filters'](_[_0xbe14('0x4d')](_0x49cddc[_0xbe14('0x2e')],_0x167dee[_0xbe14('0x48')]));if(_0x49cddc[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x19a1ae[_0xbe14('0x28')]=_['merge'](_0x19a1ae[_0xbe14('0x28')],{'$or':_['map'](_0x19a1ae[_0xbe14('0x30')],function(_0x2d0568){var _0x26bb56={};_0x26bb56[_0x2d0568]={'$like':'%'+_0x49cddc['query'][_0xbe14('0x19')]+'%'};return _0x26bb56;})});}_0x19a1ae=_[_0xbe14('0x40')]({},_0x19a1ae,_0x49cddc['options']);return _0x4f6252['getMembers'](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x3d9061){if(_0x3d9061){_0x4536b9=_0x3d9061[_0xbe14('0x32')];if(!_0x49cddc['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x19a1ae['limit']=qs['limit'](_0x49cddc['query']['limit']);_0x19a1ae[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x49cddc['query']['offset']);}return _0x4f6252[_0xbe14('0x85')](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x1046a0){return _0x1046a0?{'count':_0x4536b9,'rows':_0x1046a0}:null;})['then'](respondWithResult(_0x3bdbf7,null))[_0xbe14('0x35')](handleError(_0x3bdbf7,null));};exports[_0xbe14('0x86')]=function(_0x3933c7,_0x416c65){var _0x56f870={};var _0x28b3c4={};var _0x6fe862;var _0x5f4675;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3933c7[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x416c65,null))[_0xbe14('0x13')](function(_0x4c4ab9){if(_0x4c4ab9){_0x6fe862=_0x4c4ab9;_0x28b3c4['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x87')][_0xbe14('0x24')]);_0x28b3c4[_0xbe14('0x2e')]=_['keys'](_0x3933c7[_0xbe14('0x2e')]);_0x28b3c4[_0xbe14('0x48')]=_['intersection'](_0x28b3c4[_0xbe14('0x2c')],_0x28b3c4['query']);_0x56f870[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x28b3c4['model'],qs[_0xbe14('0x31')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x56f870[_0xbe14('0x30')]=_0x56f870[_0xbe14('0x30')][_0xbe14('0x32')]?_0x56f870[_0xbe14('0x30')]:_0x28b3c4[_0xbe14('0x2c')];_0x56f870['order']=qs[_0xbe14('0x4c')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x56f870['where']=qs['filters'](_['pick'](_0x3933c7[_0xbe14('0x2e')],_0x28b3c4[_0xbe14('0x48')]));if(_0x3933c7[_0xbe14('0x2e')]['filter']){_0x56f870['where']=_[_0xbe14('0x40')](_0x56f870[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x56f870[_0xbe14('0x30')],function(_0x2ac6c0){var _0x3d381e={};_0x3d381e[_0x2ac6c0]={'$like':'%'+_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x3d381e;})});}_0x56f870=_[_0xbe14('0x40')]({},_0x56f870,_0x3933c7['options']);return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2ca4de){if(_0x2ca4de){_0x5f4675=_0x2ca4de[_0xbe14('0x32')];if(!_0x3933c7[_0xbe14('0x2e')]['hasOwnProperty'](_0xbe14('0x4a'))){_0x56f870['limit']=qs['limit'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x56f870['offset']=qs['offset'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2e7c31){if(_0x2e7c31){return _0x2e7c31?{'count':_0x5f4675,'rows':_0x2e7c31}:null;}})['then'](respondWithResult(_0x416c65,null))['catch'](handleError(_0x416c65,null));};exports[_0xbe14('0x88')]=function(_0x4b07fc,_0x76e84){var _0x3f687f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4f4b69,_0x43d760;return db['VoiceQueue'][_0xbe14('0x1d')]({'where':{'id':_0x4b07fc[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x76e84,null))[_0xbe14('0x13')](function(_0x30657c){if(_0x30657c){_0x43d760=_0x30657c;return _0x30657c[_0xbe14('0x88')](_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x6a')],_['omit'](_0x4b07fc[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0xd97d02){var _0x15082b;_0x4f4b69=_0xd97d02||[];var _0x5d15c7=[];if(_0xd97d02){for(var _0x66b6a7=0x0;_0x66b6a7<_0xd97d02[_0xbe14('0x32')];_0x66b6a7+=0x1){var _0x4dfe2c=_0xd97d02[_0x66b6a7][_0xbe14('0x15')]({'plain':!![]});_0x43d760['dialCheckDuplicateType']=_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]?_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]:_0x43d760[_0xbe14('0x89')];switch(_0x43d760[_0xbe14('0x89')]){case'always':_0x15082b=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x96'))[_0xbe14('0x6f')](_0xbe14('0x97'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id']['toString']()))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x98'))[_0xbe14('0x6f')]('cm_hopper')[_0xbe14('0x28')](_0xbe14('0x72'),_0x4b07fc[_0xbe14('0x2b')]['id']['toString']())))[_0xbe14('0x75')]();break;case _0xbe14('0x99'):_0x15082b=squel['insert']()[_0xbe14('0x8b')]('cm_hopper')[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),'ListId','VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x4b07fc[_0xbe14('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))['where'](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x98'))[_0xbe14('0x6f')](_0xbe14('0x8c'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id'][_0xbe14('0x75')]())))['toString']();break;default:_0x15082b=squel['insert']()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')](['phone',_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))['field']('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c['CmListId'][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),'VoiceQueueId')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')[_0xbe14('0x28')](_0xbe14('0x9b'))['where'](_0xbe14('0x93'),_0x4dfe2c[_0xbe14('0x92')]['toString']())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();}_0x5d15c7['push'](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x15082b));}return BPromise[_0xbe14('0x7a')](_0x5d15c7);}})[_0xbe14('0x13')](function(){var _0x4bc564=[];var _0x19e7ce=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x9c'))[_0xbe14('0x8d')]([_0xbe14('0x9d'),_0xbe14('0x8e'),_0xbe14('0x9e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()['field']('h.id')[_0xbe14('0x6d')](_0xbe14('0x9f'))['field'](_0xbe14('0xa0'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27','createdAt')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0xa1'),'ci')[_0xbe14('0x71')](_0xbe14('0x8c'),'h','h.ContactId=ci.CmContactId')['where'](_0xbe14('0xa2'),_0x3f687f)['where'](_0xbe14('0xa3'),_0xbe14('0xa4')))['toString']();_0x4bc564[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x19e7ce));return BPromise[_0xbe14('0x7a')](_0x4bc564);})[_0xbe14('0x13')](function(){return _0x4f4b69;})[_0xbe14('0x13')](respondWithResult(_0x76e84,null))[_0xbe14('0x35')](handleError(_0x76e84,null));};exports['removeLists']=function(_0x4ceca6,_0x23f4a3){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x23f4a3,null))[_0xbe14('0x13')](function(_0x2fe8b0){if(_0x2fe8b0){return _0x2fe8b0[_0xbe14('0xa5')](_0x4ceca6['query'][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x186284){if(_0x186284){return db['CmHopper'][_0xbe14('0x14')]({'where':{'ListId':_0x4ceca6[_0xbe14('0x2e')][_0xbe14('0x6a')],'VoiceQueueId':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(){return _0x186284;});}})['then'](respondWithStatusCode(_0x23f4a3,null))[_0xbe14('0x35')](handleError(_0x23f4a3,null));};exports[_0xbe14('0xa6')]=function(_0x4c9319,_0x1173f0){var _0x1e0c81={};var _0x5349a7={};var _0x5e3819;var _0x28c5fe;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x4c9319['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1173f0,null))[_0xbe14('0x13')](function(_0x59434a){if(_0x59434a){_0x5e3819=_0x59434a;_0x5349a7[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x87')]['rawAttributes']);_0x5349a7[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x4c9319[_0xbe14('0x2e')]);_0x5349a7[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x5349a7[_0xbe14('0x2c')],_0x5349a7[_0xbe14('0x2e')]);_0x1e0c81[_0xbe14('0x30')]=_['intersection'](_0x5349a7[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e0c81[_0xbe14('0x30')]=_0x1e0c81['attributes'][_0xbe14('0x32')]?_0x1e0c81[_0xbe14('0x30')]:_0x5349a7[_0xbe14('0x2c')];_0x1e0c81[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x4c9319[_0xbe14('0x2e')]['sort']);_0x1e0c81['where']=qs['filters'](_[_0xbe14('0x4d')](_0x4c9319[_0xbe14('0x2e')],_0x5349a7['filters']));if(_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e0c81[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x1e0c81['where'],{'$or':_[_0xbe14('0x1a')](_0x1e0c81[_0xbe14('0x30')],function(_0x52bbc1){var _0x2797ef={};_0x2797ef[_0x52bbc1]={'$like':'%'+_0x4c9319['query']['filter']+'%'};return _0x2797ef;})});}_0x1e0c81=_[_0xbe14('0x40')]({},_0x1e0c81,_0x4c9319[_0xbe14('0x34')]);return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})[_0xbe14('0x13')](function(_0x47bba1){if(_0x47bba1){_0x28c5fe=_0x47bba1[_0xbe14('0x32')];if(!_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e0c81['limit']=qs[_0xbe14('0xf')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x1e0c81[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})['then'](function(_0x2592ab){if(_0x2592ab){return _0x2592ab?{'count':_0x28c5fe,'rows':_0x2592ab}:null;}})[_0xbe14('0x13')](respondWithResult(_0x1173f0,null))['catch'](handleError(_0x1173f0,null));};exports['addBlackLists']=function(_0x6a0f29,_0x3d04b9){var _0x21f793;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x6a0f29[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3d04b9,null))[_0xbe14('0x13')](function(_0x37e5e8){if(_0x37e5e8){return _0x37e5e8['addBlackLists'](_0x6a0f29[_0xbe14('0x37')][_0xbe14('0x6a')],_[_0xbe14('0x41')](_0x6a0f29[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0x14cec7){var _0x524603;_0x21f793=_0x14cec7||[];var _0x38d720=[];if(_0x14cec7){for(var _0x379446=0x0;_0x379446<_0x14cec7[_0xbe14('0x32')];_0x379446+=0x1){var _0x1489c9=_0x14cec7[_0x379446][_0xbe14('0x15')]({'plain':!![]});_0x524603=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0xa7'))['fromQuery']([_0xbe14('0x8e'),_0xbe14('0x90'),_0xbe14('0x91'),'VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x6a0f29['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')](_0xbe14('0xa8'),_0xbe14('0x42'))[_0xbe14('0x6d')](_0xbe14('0xa8'),'updatedAt')[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();_0x38d720[_0xbe14('0x74')](db['sequelize'][_0xbe14('0x2e')](_0x524603));}return BPromise[_0xbe14('0x7a')](_0x38d720);}})['then'](function(){return _0x21f793;})['then'](respondWithResult(_0x3d04b9,null))[_0xbe14('0x35')](handleError(_0x3d04b9,null));};exports[_0xbe14('0xa9')]=function(_0x7533c3,_0x3ec670){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x7533c3[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3ec670,null))['then'](function(_0x3ee9e2){if(_0x3ee9e2){return _0x3ee9e2['removeBlackLists'](_0x7533c3[_0xbe14('0x2e')][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x1d343a){if(_0x1d343a){return db[_0xbe14('0x57')][_0xbe14('0x14')]({'where':{'ListId':_0x7533c3['query']['ids'],'VoiceQueueId':_0x7533c3['params']['id']}})['then'](function(){return _0x1d343a;});}})['then'](respondWithStatusCode(_0x3ec670,null))[_0xbe14('0x35')](handleError(_0x3ec670,null));}; \ No newline at end of file +var _0x9957=['includes','find','type','name','UserProfileResource','destroy','stack','send','fieldName','key','getOptions','include','query','findAll','catch','show','params','model','rawAttributes','filters','attributes','intersection','fields','includeAll','merge','VoiceQueue','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','UserProfileSection','userProfileId','autoAssociation','error','clone','length','options','omit','updatedAt','user','role','outbound','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','keys','order','sort','where','pick','CmHopper','rows','getHopperHistories','CmHopperHistory','hasOwnProperty','VoiceQueueId','getHopperFinals','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','Agents','voicePause','interface','penalty','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','forEach','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','all','union','compact','removeTeams','isEmpty','userVoiceQueue:remove','addAgents','online','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','createdAt','select','ContactId','CmListId','ListId','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','VoiceQueues','QueueCampaigns','filter','ignore','map','value'];(function(_0x5ff517,_0x3e4ee0){var _0x19a245=function(_0x4c00ac){while(--_0x4c00ac){_0x5ff517['push'](_0x5ff517['shift']());}};_0x19a245(++_0x3e4ee0);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var moment=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var _=require(_0x7995('0x3'));var squel=require('squel');var Redis=require(_0x7995('0x4'));var qs=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var config=require('../../config/environment');var db=require(_0x7995('0x8'))['db'];config[_0x7995('0x9')]=_[_0x7995('0xa')](config[_0x7995('0x9')],{'host':_0x7995('0xb'),'port':0x18eb});var socket=require(_0x7995('0xc'))(new Redis(config['redis']));require(_0x7995('0xd'))[_0x7995('0xe')](socket);function respondWithStatusCode(_0x4a64f7,_0xa2e5f0){_0xa2e5f0=_0xa2e5f0||0xcc;return function(_0x3116fb){if(_0x3116fb){return _0x4a64f7[_0x7995('0xf')](_0xa2e5f0);}return _0x4a64f7[_0x7995('0x10')](_0xa2e5f0)[_0x7995('0x11')]();};}function respondWithResult(_0x1e400a,_0x341672){_0x341672=_0x341672||0xc8;return function(_0x524f7b){if(_0x524f7b){return _0x1e400a[_0x7995('0x10')](_0x341672)[_0x7995('0x12')](_0x524f7b);}};}function respondWithFilteredResult(_0x581f22,_0xb0c872){return function(_0x2cb37a){if(_0x2cb37a){var _0x19a27e=typeof _0xb0c872[_0x7995('0x13')]===_0x7995('0x14')&&typeof _0xb0c872[_0x7995('0x15')]===_0x7995('0x14');var _0x4cc004=_0x2cb37a['count'];var _0x2b4e94=_0x19a27e?0x0:_0xb0c872[_0x7995('0x13')];var _0x24b5bb=_0x19a27e?_0x2cb37a[_0x7995('0x16')]:_0xb0c872[_0x7995('0x13')]+_0xb0c872[_0x7995('0x15')];var _0x2202ce;if(_0x24b5bb>=_0x4cc004){_0x24b5bb=_0x4cc004;_0x2202ce=0xc8;}else{_0x2202ce=0xce;}_0x581f22[_0x7995('0x10')](_0x2202ce);return _0x581f22['set'](_0x7995('0x17'),_0x2b4e94+'-'+_0x24b5bb+'/'+_0x4cc004)['json'](_0x2cb37a);}return null;};}function saveUpdates(_0x2f832e){return function(_0x37f297){if(_0x37f297){return _0x37f297[_0x7995('0x18')](_0x2f832e)[_0x7995('0x19')](function(_0x1e1415){return _0x1e1415;});}return null;};}function removeEntity(_0x37a7d4){return function(_0x4faa60){if(_0x4faa60){return _0x4faa60['destroy']()[_0x7995('0x19')](function(){var _0x5e6f90=_0x4faa60['get']({'plain':!![]});var _0x3ec178=[{'name':_0x7995('0x1a'),'value':'inbound','ignore':![]},{'name':_0x7995('0x1b'),'value':'outbound','ignore':![]}];var _0x4b1a8e=_(_0x3ec178)[_0x7995('0x1c')](_0x7995('0x1d'))[_0x7995('0x1e')](_0x7995('0x1f'))[_0x7995('0x1f')]();if(_[_0x7995('0x20')](_0x4b1a8e,_0x5e6f90['type'])){return;}var _0x32a09a=_[_0x7995('0x21')](_0x3ec178,[_0x7995('0x1f'),_0x5e6f90[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x24')][_0x7995('0x25')]({'where':{'type':_0x32a09a,'resourceId':_0x5e6f90['id']}})[_0x7995('0x19')](function(){return _0x4faa60;});})['then'](function(){_0x37a7d4[_0x7995('0x10')](0xcc)[_0x7995('0x11')]();});}};}function handleEntityNotFound(_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x401dc3[_0x7995('0xf')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x26')]);if(_0x47625f[_0x7995('0x23')]){delete _0x47625f[_0x7995('0x23')];}_0x2a307e[_0x7995('0x10')](_0x56691a)[_0x7995('0x27')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={};var _0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['VoiceQueue']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x28')],'type':_0x3573be[_0x7995('0x22')][_0x7995('0x29')]};});_0x456a28=qs[_0x7995('0x2a')](_0x4253e5,_0x9b2a15);var _0x1ca460={'where':_0x456a28['where']};return db['VoiceQueue'][_0x7995('0x16')](_0x1ca460)['then'](function(_0x553671){_0x3250e0[_0x7995('0x16')]=_0x553671;_0x456a28[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x9b2a15[_0x7995('0x2c')]);return db['VoiceQueue'][_0x7995('0x2d')](_0x456a28);})[_0x7995('0x19')](function(_0x5dd802){_0x3250e0['rows']=_0x5dd802;return _0x3250e0;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x2e')](handleError(_0x514445,null));};exports[_0x7995('0x2f')]=function(_0x4a176f,_0x3e7020){var _0x51b95d={'raw':![],'where':{'id':_0x4a176f[_0x7995('0x30')]['id']}},_0x37917b={};_0x37917b[_0x7995('0x31')]=_['keys'](db['VoiceQueue'][_0x7995('0x32')]);_0x37917b['query']=_['keys'](_0x4a176f[_0x7995('0x2c')]);_0x37917b[_0x7995('0x33')]=_['intersection'](_0x37917b[_0x7995('0x31')],_0x37917b[_0x7995('0x2c')]);_0x51b95d[_0x7995('0x34')]=_[_0x7995('0x35')](_0x37917b[_0x7995('0x31')],qs['fields'](_0x4a176f[_0x7995('0x2c')][_0x7995('0x36')]));_0x51b95d[_0x7995('0x34')]=_0x51b95d[_0x7995('0x34')]['length']?_0x51b95d[_0x7995('0x34')]:_0x37917b[_0x7995('0x31')];if(_0x4a176f[_0x7995('0x2c')][_0x7995('0x37')]){_0x51b95d[_0x7995('0x2b')]=[{'all':!![]}];}_0x51b95d=_[_0x7995('0x38')]({},_0x51b95d,_0x4a176f['options']);return db[_0x7995('0x39')][_0x7995('0x21')](_0x51b95d)[_0x7995('0x19')](handleEntityNotFound(_0x3e7020,null))[_0x7995('0x19')](respondWithResult(_0x3e7020,null))[_0x7995('0x2e')](handleError(_0x3e7020,null));};exports[_0x7995('0x3a')]=function(_0x14d638,_0x270c0e){return db[_0x7995('0x39')][_0x7995('0x3a')](_0x14d638[_0x7995('0x3b')],{})[_0x7995('0x19')](function(_0x7b4e67){var _0x53cda2=_0x14d638['user'][_0x7995('0x3c')]({'plain':!![]});if(!_0x53cda2)throw new Error(_0x7995('0x3d'));if(_0x53cda2['role']==='user'){var _0x3f8522=_0x7b4e67['get']({'plain':!![]});var _0x504a33=[{'name':_0x7995('0x1a'),'value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':'outbound'}];var _0x46ac4f=_['find'](_0x504a33,[_0x7995('0x1f'),_0x3f8522['type']])['name'];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x46ac4f,'userProfileId':_0x53cda2[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x599ecb){if(_0x599ecb&&_0x599ecb[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x3f8522[_0x7995('0x23')],'resourceId':_0x3f8522['id'],'type':_0x599ecb['name'],'sectionId':_0x599ecb['id']},{})['then'](function(){return _0x7b4e67;});}else{return _0x7b4e67;}})[_0x7995('0x2e')](function(_0x55791b){logger[_0x7995('0x42')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55791b);throw _0x55791b;});}return _0x7b4e67;})[_0x7995('0x19')](respondWithResult(_0x270c0e,0xc9))['catch'](handleError(_0x270c0e,null));};exports[_0x7995('0x43')]=function(_0x1b0373,_0x4d9245){var _0x3e9e62={'where':{'id':_0x1b0373[_0x7995('0x30')]['id']}},_0x336ff2={};_0x336ff2[_0x7995('0x31')]=_['keys'](db[_0x7995('0x39')][_0x7995('0x32')]);_0x3e9e62[_0x7995('0x34')]=_['intersection'](_0x336ff2[_0x7995('0x31')],qs[_0x7995('0x36')](_0x1b0373[_0x7995('0x2c')][_0x7995('0x36')]));_0x3e9e62[_0x7995('0x34')]=_0x3e9e62['attributes'][_0x7995('0x44')]?_0x3e9e62[_0x7995('0x34')]:_0x336ff2['model'];if(_0x1b0373[_0x7995('0x2c')]['includeAll']){_0x3e9e62[_0x7995('0x2b')]=[{'all':!![]}];}_0x3e9e62=_[_0x7995('0x38')]({},_0x3e9e62,_0x1b0373[_0x7995('0x45')]);return db[_0x7995('0x39')][_0x7995('0x21')](_0x3e9e62)[_0x7995('0x19')](handleEntityNotFound(_0x4d9245,null))[_0x7995('0x19')](function(_0x4d46bc){if(_0x4d46bc){var _0x427dcf=_0x4d46bc[_0x7995('0x3c')]({'plain':!![]});_0x427dcf=qs[_0x7995('0x46')](_0x427dcf,['id','createdAt',_0x7995('0x47')]);_0x1b0373[_0x7995('0x3b')]=_[_0x7995('0x46')](_0x1b0373['body'],['id','createdAt','updatedAt']);return db[_0x7995('0x39')][_0x7995('0x3a')](_['merge'](_0x427dcf,_0x1b0373[_0x7995('0x3b')]),{'include':_0x1b0373[_0x7995('0x2c')][_0x7995('0x37')]?[{'all':!![]}]:undefined})[_0x7995('0x19')](function(_0xc04004){var _0x528c8e=_0x1b0373[_0x7995('0x48')]['get']({'plain':!![]});if(!_0x528c8e)throw new Error(_0x7995('0x3d'));if(_0x528c8e[_0x7995('0x49')]===_0x7995('0x48')){var _0x50c7b5=_0xc04004['get']({'plain':!![]});var _0x54e2b1=[{'name':'VoiceQueues','value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':_0x7995('0x4a')}];var _0x150261=_[_0x7995('0x21')](_0x54e2b1,[_0x7995('0x1f'),_0x50c7b5[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x150261,'userProfileId':_0x528c8e[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x3da72b){if(_0x3da72b&&_0x3da72b[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x50c7b5[_0x7995('0x23')],'resourceId':_0x50c7b5['id'],'type':_0x3da72b[_0x7995('0x23')],'sectionId':_0x3da72b['id']},{})[_0x7995('0x19')](function(){return _0xc04004;});}else{return _0xc04004;}})['catch'](function(_0x56a374){logger[_0x7995('0x42')](_0x7995('0x4b'),_0x56a374);throw _0x56a374;});}return _0xc04004;});}})[_0x7995('0x19')](respondWithResult(_0x4d9245,0xc9))['catch'](handleError(_0x4d9245,null));};exports['update']=function(_0x402fa0,_0x197b52){if(_0x402fa0[_0x7995('0x3b')]['id']){delete _0x402fa0[_0x7995('0x3b')]['id'];}return db['VoiceQueue'][_0x7995('0x21')]({'where':{'id':_0x402fa0[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x197b52,null))[_0x7995('0x19')](saveUpdates(_0x402fa0['body'],null))['then'](respondWithResult(_0x197b52,null))[_0x7995('0x2e')](handleError(_0x197b52,null));};exports[_0x7995('0x25')]=function(_0x6c0221,_0x1d69ce){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x6c0221[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1d69ce,null))[_0x7995('0x19')](removeEntity(_0x1d69ce,null))['catch'](handleError(_0x1d69ce,null));};exports[_0x7995('0x4c')]=function(_0x3ec5a8,_0xdf9e38){var _0x1ecfdb={'raw':![],'where':{}};var _0x59c5aa={};var _0x51bf6a={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3ec5a8['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0xdf9e38,null))[_0x7995('0x19')](function(_0x2e3421){if(_0x2e3421){_0x59c5aa[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopper'][_0x7995('0x32')]);_0x59c5aa['query']=_[_0x7995('0x4e')](_0x3ec5a8[_0x7995('0x2c')]);_0x59c5aa[_0x7995('0x33')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],_0x59c5aa[_0x7995('0x2c')]);_0x1ecfdb[_0x7995('0x34')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x36')]));_0x1ecfdb['attributes']=_0x1ecfdb[_0x7995('0x34')][_0x7995('0x44')]?_0x1ecfdb[_0x7995('0x34')]:_0x59c5aa[_0x7995('0x31')];if(!_0x3ec5a8[_0x7995('0x2c')]['hasOwnProperty']('nolimit')){_0x1ecfdb[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x15')]);_0x1ecfdb['offset']=qs[_0x7995('0x13')](_0x3ec5a8['query']['offset']);}_0x1ecfdb[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x50')]);_0x1ecfdb[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x3ec5a8[_0x7995('0x2c')],_0x59c5aa[_0x7995('0x33')]));_0x1ecfdb[_0x7995('0x51')]['VoiceQueueId']=_0x2e3421['id'];if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]){_0x1ecfdb[_0x7995('0x51')]=_['merge'](_0x1ecfdb[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x1ecfdb[_0x7995('0x34')],function(_0x3a7d9d){var _0x3b0d30={};_0x3b0d30[_0x3a7d9d]={'$like':'%'+_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x3b0d30;})});}_0x1ecfdb=_[_0x7995('0x38')]({},_0x1ecfdb,_0x3ec5a8[_0x7995('0x45')]);return db[_0x7995('0x53')][_0x7995('0x16')]({'where':_0x1ecfdb['where']})['then'](function(_0xd07c1c){_0x51bf6a[_0x7995('0x16')]=_0xd07c1c;if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x37')]){_0x1ecfdb['include']=[{'all':!![]}];}return db[_0x7995('0x53')][_0x7995('0x2d')](_0x1ecfdb);})['then'](function(_0x480fdb){_0x51bf6a[_0x7995('0x54')]=_0x480fdb;return _0x51bf6a;});}})[_0x7995('0x19')](respondWithFilteredResult(_0xdf9e38,_0x1ecfdb))['catch'](handleError(_0xdf9e38,null));};exports[_0x7995('0x55')]=function(_0x5b1cba,_0x3758f9){var _0xea9aba={'raw':!![],'where':{}};var _0x4ff9ff={};var _0x5d9d33={'count':0x0,'rows':[]};return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x5b1cba[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3758f9,null))[_0x7995('0x19')](function(_0x45bd8a){if(_0x45bd8a){_0x4ff9ff[_0x7995('0x31')]=_[_0x7995('0x4e')](db[_0x7995('0x56')][_0x7995('0x32')]);_0x4ff9ff[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x5b1cba[_0x7995('0x2c')]);_0x4ff9ff[_0x7995('0x33')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],_0x4ff9ff[_0x7995('0x2c')]);_0xea9aba[_0x7995('0x34')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],qs[_0x7995('0x36')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x36')]));_0xea9aba[_0x7995('0x34')]=_0xea9aba[_0x7995('0x34')][_0x7995('0x44')]?_0xea9aba[_0x7995('0x34')]:_0x4ff9ff[_0x7995('0x31')];if(!_0x5b1cba[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0xea9aba[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x5b1cba['query']['limit']);_0xea9aba[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x13')]);}_0xea9aba[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x5b1cba['query'][_0x7995('0x50')]);_0xea9aba[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5b1cba[_0x7995('0x2c')],_0x4ff9ff[_0x7995('0x33')]));_0xea9aba[_0x7995('0x51')][_0x7995('0x58')]=_0x45bd8a['id'];if(_0x5b1cba['query'][_0x7995('0x1c')]){_0xea9aba[_0x7995('0x51')]=_['merge'](_0xea9aba['where'],{'$or':_[_0x7995('0x1e')](_0xea9aba[_0x7995('0x34')],function(_0x18e1a2){var _0x3db7a9={};_0x3db7a9[_0x18e1a2]={'$like':'%'+_0x5b1cba[_0x7995('0x2c')]['filter']+'%'};return _0x3db7a9;})});}_0xea9aba=_[_0x7995('0x38')]({},_0xea9aba,_0x5b1cba[_0x7995('0x45')]);return db['CmHopperHistory'][_0x7995('0x16')]({'where':_0xea9aba[_0x7995('0x51')]})['then'](function(_0x1535a3){_0x5d9d33['count']=_0x1535a3;if(_0x5b1cba[_0x7995('0x2c')][_0x7995('0x37')]){_0xea9aba[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x56')][_0x7995('0x2d')](_0xea9aba);})['then'](function(_0x1f0506){_0x5d9d33[_0x7995('0x54')]=_0x1f0506;return _0x5d9d33;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x3758f9,_0xea9aba))['catch'](handleError(_0x3758f9,null));};exports[_0x7995('0x59')]=function(_0x3f3434,_0x350ed3){var _0x308a26={'raw':!![],'where':{}};var _0x5d7018={};var _0x3356fd={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3f3434['params']['id']}})['then'](handleEntityNotFound(_0x350ed3,null))[_0x7995('0x19')](function(_0x333379){if(_0x333379){_0x5d7018['model']=_['keys'](db[_0x7995('0x5a')][_0x7995('0x32')]);_0x5d7018[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x3f3434[_0x7995('0x2c')]);_0x5d7018['filters']=_['intersection'](_0x5d7018[_0x7995('0x31')],_0x5d7018['query']);_0x308a26['attributes']=_[_0x7995('0x35')](_0x5d7018[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3f3434['query'][_0x7995('0x36')]));_0x308a26[_0x7995('0x34')]=_0x308a26[_0x7995('0x34')][_0x7995('0x44')]?_0x308a26[_0x7995('0x34')]:_0x5d7018['model'];if(!_0x3f3434[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x308a26[_0x7995('0x15')]=qs['limit'](_0x3f3434[_0x7995('0x2c')][_0x7995('0x15')]);_0x308a26['offset']=qs[_0x7995('0x13')](_0x3f3434[_0x7995('0x2c')]['offset']);}_0x308a26[_0x7995('0x4f')]=qs['sort'](_0x3f3434[_0x7995('0x2c')]['sort']);_0x308a26[_0x7995('0x51')]=qs['filters'](_[_0x7995('0x52')](_0x3f3434[_0x7995('0x2c')],_0x5d7018['filters']));_0x308a26[_0x7995('0x51')]['VoiceQueueId']=_0x333379['id'];if(_0x3f3434['query'][_0x7995('0x1c')]){_0x308a26[_0x7995('0x51')]=_[_0x7995('0x38')](_0x308a26[_0x7995('0x51')],{'$or':_['map'](_0x308a26[_0x7995('0x34')],function(_0x35044a){var _0x4bd29f={};_0x4bd29f[_0x35044a]={'$like':'%'+_0x3f3434['query'][_0x7995('0x1c')]+'%'};return _0x4bd29f;})});}_0x308a26=_['merge']({},_0x308a26,_0x3f3434[_0x7995('0x45')]);return db[_0x7995('0x5a')][_0x7995('0x16')]({'where':_0x308a26['where']})['then'](function(_0x2b7852){_0x3356fd['count']=_0x2b7852;if(_0x3f3434[_0x7995('0x2c')][_0x7995('0x37')]){_0x308a26[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x5a')]['findAll'](_0x308a26);})['then'](function(_0x50f880){_0x3356fd[_0x7995('0x54')]=_0x50f880;return _0x3356fd;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x350ed3,_0x308a26))[_0x7995('0x2e')](handleError(_0x350ed3,null));};exports[_0x7995('0x5c')]=function(_0x265f07,_0x168e7f){var _0x59a793={'raw':!![],'where':{}};var _0x53cbec={};var _0x1a2902={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x265f07[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x168e7f,null))['then'](function(_0x35c3f3){if(_0x35c3f3){_0x53cbec[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopperBlack'][_0x7995('0x32')]);_0x53cbec[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x265f07[_0x7995('0x2c')]);_0x53cbec[_0x7995('0x33')]=_[_0x7995('0x35')](_0x53cbec[_0x7995('0x31')],_0x53cbec[_0x7995('0x2c')]);_0x59a793[_0x7995('0x34')]=_['intersection'](_0x53cbec[_0x7995('0x31')],qs[_0x7995('0x36')](_0x265f07[_0x7995('0x2c')][_0x7995('0x36')]));_0x59a793[_0x7995('0x34')]=_0x59a793['attributes'][_0x7995('0x44')]?_0x59a793[_0x7995('0x34')]:_0x53cbec[_0x7995('0x31')];if(!_0x265f07['query']['hasOwnProperty']('nolimit')){_0x59a793[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x265f07[_0x7995('0x2c')][_0x7995('0x15')]);_0x59a793[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x265f07['query'][_0x7995('0x13')]);}_0x59a793['order']=qs[_0x7995('0x50')](_0x265f07[_0x7995('0x2c')][_0x7995('0x50')]);_0x59a793[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x265f07[_0x7995('0x2c')],_0x53cbec[_0x7995('0x33')]));_0x59a793[_0x7995('0x51')][_0x7995('0x58')]=_0x35c3f3['id'];if(_0x265f07[_0x7995('0x2c')]['filter']){_0x59a793[_0x7995('0x51')]=_['merge'](_0x59a793[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x59a793['attributes'],function(_0x493e74){var _0x2a25eb={};_0x2a25eb[_0x493e74]={'$like':'%'+_0x265f07[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x2a25eb;})});}_0x59a793=_[_0x7995('0x38')]({},_0x59a793,_0x265f07[_0x7995('0x45')]);return db[_0x7995('0x5d')][_0x7995('0x16')]({'where':_0x59a793[_0x7995('0x51')]})[_0x7995('0x19')](function(_0x3c9b3c){_0x1a2902[_0x7995('0x16')]=_0x3c9b3c;if(_0x265f07[_0x7995('0x2c')]['includeAll']){_0x59a793['include']=[{'all':!![]}];}return db[_0x7995('0x5d')][_0x7995('0x2d')](_0x59a793);})[_0x7995('0x19')](function(_0x1531a9){_0x1a2902[_0x7995('0x54')]=_0x1531a9;return _0x1a2902;});}})['then'](respondWithFilteredResult(_0x168e7f,_0x59a793))[_0x7995('0x2e')](handleError(_0x168e7f,null));};exports[_0x7995('0x5e')]=function(_0x5ebf5e,_0x46fc1c){var _0x53d693={};var _0x37416c={};var _0x30cda5;var _0x234a40;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x5ebf5e[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x46fc1c,null))[_0x7995('0x19')](function(_0x11f9fb){if(_0x11f9fb){_0x30cda5=_0x11f9fb;_0x37416c[_0x7995('0x31')]=_[_0x7995('0x4e')](db['Team']['rawAttributes']);_0x37416c['query']=_[_0x7995('0x4e')](_0x5ebf5e[_0x7995('0x2c')]);_0x37416c['filters']=_['intersection'](_0x37416c[_0x7995('0x31')],_0x37416c[_0x7995('0x2c')]);_0x53d693['attributes']=_['intersection'](_0x37416c['model'],qs['fields'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x36')]));_0x53d693[_0x7995('0x34')]=_0x53d693[_0x7995('0x34')]['length']?_0x53d693[_0x7995('0x34')]:_0x37416c[_0x7995('0x31')];_0x53d693['order']=qs[_0x7995('0x50')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x50')]);_0x53d693['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5ebf5e['query'],_0x37416c[_0x7995('0x33')]));if(_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]){_0x53d693[_0x7995('0x51')]=_[_0x7995('0x38')](_0x53d693[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x53d693[_0x7995('0x34')],function(_0x4254de){var _0x278004={};_0x278004[_0x4254de]={'$like':'%'+_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x278004;})});}_0x53d693=_[_0x7995('0x38')]({},_0x53d693,_0x5ebf5e['options']);return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})[_0x7995('0x19')](function(_0x3603e8){if(_0x3603e8){_0x234a40=_0x3603e8[_0x7995('0x44')];if(!_0x5ebf5e['query'][_0x7995('0x57')](_0x7995('0x5b'))){_0x53d693[_0x7995('0x15')]=qs['limit'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x15')]);_0x53d693[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})['then'](function(_0x35dbd7){if(_0x35dbd7){return _0x35dbd7?{'count':_0x234a40,'rows':_0x35dbd7}:null;}})['then'](respondWithResult(_0x46fc1c,null))[_0x7995('0x2e')](handleError(_0x46fc1c,null));};exports[_0x7995('0x5f')]=function(_0x2190d1,_0x4cae1c){var _0xd012b9=_0x2190d1['body']['teams'];var _0x4ee5ee=_['map'](_0xd012b9,'id');return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x4ee5ee},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7995('0x61'),'attributes':['id',_0x7995('0x23'),'online',_0x7995('0x62'),_0x7995('0x63')],'raw':!![]}]})[_0x7995('0x19')](function(_0x45a479){if(_0x45a479){var _0x443863=_['flatMap'](_0x45a479,function(_0x38ea3e){var _0x1df81d=_0x38ea3e[_0x7995('0x3c')]({'plain':!![]});_0x1df81d[_0x7995('0x61')]['forEach'](function(_0x428d5a){_0x428d5a[_0x7995('0x64')]=_[_0x7995('0x21')](_0xd012b9,{'id':_0x1df81d['id']})[_0x7995('0x64')];});return _0x1df81d[_0x7995('0x61')];});return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2190d1[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x1fda95){return db['sequelize'][_0x7995('0x65')](function(_0x521712){return _0x1fda95[_0x7995('0x5f')](_0x4ee5ee,{'transaction':_0x521712})[_0x7995('0x19')](function(){return BPromise[_0x7995('0x66')](_0xd012b9,function(_0x50eb5e){return db['TeamVoiceQueue'][_0x7995('0x67')]({'TeamId':_0x50eb5e['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id'],'penalty':_0x50eb5e['penalty']},{'transaction':_0x521712});});})[_0x7995('0x19')](function(){return BPromise['each'](_0x443863,function(_0x43de18){return db[_0x7995('0x68')][_0x7995('0x69')]({'where':{'UserId':_0x43de18['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id']},'defaults':{'penalty':_0x43de18['penalty']},'transaction':_0x521712});});})['then'](function(){return BPromise[_0x7995('0x66')](_[_0x7995('0x1c')](_0x443863,{'online':!![]}),function(_0x365318){return db[_0x7995('0x6a')]['upsert']({'membername':_0x365318[_0x7995('0x23')],'UserId':_0x365318['id'],'queue_name':_0x1fda95[_0x7995('0x23')],'VoiceQueueId':_0x1fda95['id'],'interface':_[_0x7995('0x6b')](_0x365318[_0x7995('0x63')])?util[_0x7995('0x6c')]('SIP/%s',_0x365318['name']):_0x365318['interface'],'paused':_0x365318[_0x7995('0x62')]||![],'penalty':_0x365318[_0x7995('0x64')]},{'transaction':_0x521712});});})['then'](function(){_0x443863[_0x7995('0x6d')](function(_0x5635d6){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':_0x5635d6['id'],'VoiceQueueId':_0x1fda95['id']});});});});});}})[_0x7995('0x19')](respondWithStatusCode(_0x4cae1c,null))[_0x7995('0x2e')](handleError(_0x4cae1c,null));};exports['removeTeams']=function(_0x3fbafb,_0x2caacd){return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')]},'attributes':['id'],'include':[{'model':db[_0x7995('0x71')],'as':_0x7995('0x61'),'attributes':['id'],'raw':!![]}]})[_0x7995('0x19')](handleEntityNotFound(_0x2caacd,null))[_0x7995('0x19')](function(_0x30893a){var _0x2b8d90=_[_0x7995('0x1e')](_0x30893a,'id');var _0x2122af=[];var _0x4ff0b6=[];var _0x764245=squel['select']();_0x764245[_0x7995('0x72')](_0x7995('0x73'))['from'](_0x7995('0x74'),'tq')['join'](_0x7995('0x75'),'ut',_0x7995('0x76'))['where']('VoiceQueueId\x20=\x20?',_0x3fbafb['params']['id']);for(var _0x8f5ecd=0x0;_0x8f5ecd<_0x30893a[_0x7995('0x44')];_0x8f5ecd+=0x1){let _0x139f76=_0x30893a[_0x8f5ecd];for(var _0x2b7bc2=0x0;_0x2b7bc2<_0x139f76['Agents'][_0x7995('0x44')];_0x2b7bc2+=0x1){let _0x2b2814=_0x139f76[_0x7995('0x61')][_0x2b7bc2];var _0x2de960=_0x764245[_0x7995('0x43')]();_0x2de960[_0x7995('0x51')](_0x7995('0x77'),_0x2b2814['id']);_0x4ff0b6[_0x7995('0x78')](db['sequelize'][_0x7995('0x2c')](_0x2de960[_0x7995('0x79')](),{'type':db[_0x7995('0x7a')][_0x7995('0x7b')]['SELECT']})[_0x7995('0x19')](function(_0x3a2958){if(_0x3a2958[_0x7995('0x44')]===0x1){return _0x2b2814['id'];}else{var _0x339e6b=_[_0x7995('0x7c')](_[_0x7995('0x1e')](_0x3a2958,'TeamId'),function(_0x1bc617){return _[_0x7995('0x20')](_0x2b8d90,_0x1bc617);});if(_0x339e6b){return _0x2b2814['id'];}}}));}}return BPromise[_0x7995('0x7d')](_0x4ff0b6)[_0x7995('0x19')](function(_0x3fcc49){_0x2122af=_(_0x2122af)[_0x7995('0x7e')](_0x3fcc49)[_0x7995('0x7f')]()[_0x7995('0x1f')]();return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3fbafb[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x64a62d){return db[_0x7995('0x7a')][_0x7995('0x65')](function(_0x370984){return _0x64a62d[_0x7995('0x80')](_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')],{'transaction':_0x370984})[_0x7995('0x19')](function(){if(!_[_0x7995('0x81')](_0x2122af)){return _0x64a62d['removeAgents'](_0x2122af,{'transaction':_0x370984})['then'](function(){return db[_0x7995('0x6a')][_0x7995('0x25')]({'where':{'VoiceQueueId':_0x3fbafb['params']['id'],'UserId':_0x2122af},'transaction':_0x370984});});}})[_0x7995('0x19')](function(){_0x2122af['forEach'](function(_0x2ce103){socket['emit'](_0x7995('0x82'),{'UserId':_0x2ce103,'VoiceQueueId':_0x64a62d['id']});});});});});});})[_0x7995('0x19')](respondWithStatusCode(_0x2caacd,null))[_0x7995('0x2e')](handleError(_0x2caacd,null));};exports[_0x7995('0x83')]=function(_0x3aa676,_0x1df2a2){var _0xd82313,_0x1fa59d;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3aa676['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1df2a2,null))[_0x7995('0x19')](function(_0x1d0481){if(_0x1d0481){_0x1fa59d=_0x1d0481;return _0x1d0481[_0x7995('0x83')](_0x3aa676['body'][_0x7995('0x70')],_[_0x7995('0x46')](_0x3aa676[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{})['spread'](function(_0x32c550){for(var _0x37e647=0x0;_0x37e647<_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x7995('0x44')];_0x37e647+=0x1){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':Number(_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x37e647]),'VoiceQueueId':Number(_0x3aa676['params']['id'])});}return _0x32c550;});}})[_0x7995('0x19')](function(_0x5f5496){_0xd82313=_0x5f5496||[];if(_0x1fa59d){return db[_0x7995('0x71')][_0x7995('0x2d')]({'where':{'id':_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')]},'attributes':['id','name',_0x7995('0x84'),_0x7995('0x62'),_0x7995('0x63')],'raw':!![]});}})[_0x7995('0x19')](function(_0x2c715){if(!_[_0x7995('0x81')](_0x2c715)){var _0x3661ab=[];for(var _0x408692=0x0;_0x408692<_0x2c715[_0x7995('0x44')];_0x408692++){if(_0x2c715[_0x408692][_0x7995('0x84')]){_0x3661ab[_0x7995('0x78')](db[_0x7995('0x6a')][_0x7995('0x67')]({'membername':_0x2c715[_0x408692][_0x7995('0x23')],'UserId':_0x2c715[_0x408692]['id'],'queue_name':_0x1fa59d['name'],'VoiceQueueId':_0x1fa59d['id'],'interface':_['isNil'](_0x2c715[_0x408692][_0x7995('0x63')])?util[_0x7995('0x6c')](_0x7995('0x85'),_0x2c715[_0x408692]['name']):_0x2c715[_0x408692][_0x7995('0x63')],'paused':_0x2c715[_0x408692][_0x7995('0x62')]||![],'penalty':_0x3aa676[_0x7995('0x3b')]['penalty']||0x0}));}}return BPromise[_0x7995('0x7d')](_0x3661ab);}})[_0x7995('0x19')](function(){return _0xd82313;})[_0x7995('0x19')](respondWithResult(_0x1df2a2,null))[_0x7995('0x2e')](handleError(_0x1df2a2,null));};exports[_0x7995('0x86')]=function(_0x3d42a3,_0x29fb77){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3d42a3[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x29fb77,null))['then'](function(_0x580571){if(_0x580571){return _0x580571[_0x7995('0x86')](_0x3d42a3['query'][_0x7995('0x70')])[_0x7995('0x19')](function(){if(_[_0x7995('0x87')](_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')])){for(var _0x4eebf4=0x0;_0x4eebf4<_0x3d42a3['query'][_0x7995('0x70')][_0x7995('0x44')];_0x4eebf4+=0x1){socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')][_0x4eebf4]),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}}else{socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')]['ids']),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}});}})[_0x7995('0x19')](function(_0x38e67a){return db[_0x7995('0x6a')]['destroy']({'where':{'VoiceQueueId':_0x3d42a3['params']['id'],'UserId':_0x3d42a3['query']['ids']}})['then'](function(){return _0x38e67a;});})[_0x7995('0x19')](respondWithStatusCode(_0x29fb77,null))['catch'](handleError(_0x29fb77,null));};exports['getAgents']=function(_0x32f19d,_0x44dbb8){var _0x181ed6={};var _0x48b807={};var _0xba00af;var _0x4f008a;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x32f19d[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x44dbb8,null))[_0x7995('0x19')](function(_0x14be06){if(_0x14be06){_0xba00af=_0x14be06;_0x48b807[_0x7995('0x31')]=_['keys'](db[_0x7995('0x71')][_0x7995('0x32')]);_0x48b807[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x32f19d[_0x7995('0x2c')]);_0x48b807['filters']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],_0x48b807[_0x7995('0x2c')]);_0x181ed6['attributes']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],qs[_0x7995('0x36')](_0x32f19d[_0x7995('0x2c')][_0x7995('0x36')]));_0x181ed6['attributes']=_0x181ed6[_0x7995('0x34')][_0x7995('0x44')]?_0x181ed6[_0x7995('0x34')]:_0x48b807[_0x7995('0x31')];_0x181ed6[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x32f19d[_0x7995('0x2c')]['sort']);_0x181ed6['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x32f19d['query'],_0x48b807['filters']));if(_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]){_0x181ed6[_0x7995('0x51')]=_[_0x7995('0x38')](_0x181ed6[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x181ed6[_0x7995('0x34')],function(_0x4dca11){var _0xf90cd8={};_0xf90cd8[_0x4dca11]={'$like':'%'+_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0xf90cd8;})});}_0x181ed6=_[_0x7995('0x38')]({},_0x181ed6,_0x32f19d[_0x7995('0x45')]);return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x1d7c33){if(_0x1d7c33){_0x4f008a=_0x1d7c33[_0x7995('0x44')];if(!_0x32f19d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x181ed6[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x32f19d['query'][_0x7995('0x15')]);_0x181ed6[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x32f19d[_0x7995('0x2c')]['offset']);}return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x21ba9b){if(_0x21ba9b){return _0x21ba9b?{'count':_0x4f008a,'rows':_0x21ba9b}:null;}})[_0x7995('0x19')](respondWithResult(_0x44dbb8,null))['catch'](handleError(_0x44dbb8,null));};exports['getMembers']=function(_0x478c12,_0x3b22ec){var _0xf503d5={};var _0x7d2ccf={};var _0x18a3dc;var _0x503b32;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x478c12[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3b22ec,null))[_0x7995('0x19')](function(_0x1fa484){if(_0x1fa484){_0x18a3dc=_0x1fa484;_0x7d2ccf[_0x7995('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x7995('0x32')]);_0x7d2ccf['query']=_['keys'](_0x478c12[_0x7995('0x2c')]);_0x7d2ccf[_0x7995('0x33')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],_0x7d2ccf[_0x7995('0x2c')]);_0xf503d5[_0x7995('0x34')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],qs[_0x7995('0x36')](_0x478c12[_0x7995('0x2c')][_0x7995('0x36')]));_0xf503d5[_0x7995('0x34')]=_0xf503d5['attributes'][_0x7995('0x44')]?_0xf503d5[_0x7995('0x34')]:_0x7d2ccf[_0x7995('0x31')];_0xf503d5[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x478c12[_0x7995('0x2c')][_0x7995('0x50')]);_0xf503d5['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x478c12[_0x7995('0x2c')],_0x7d2ccf[_0x7995('0x33')]));if(_0x478c12[_0x7995('0x2c')]['filter']){_0xf503d5[_0x7995('0x51')]=_['merge'](_0xf503d5[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0xf503d5[_0x7995('0x34')],function(_0x5150aa){var _0x260e84={};_0x260e84[_0x5150aa]={'$like':'%'+_0x478c12[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x260e84;})});}_0xf503d5=_[_0x7995('0x38')]({},_0xf503d5,_0x478c12[_0x7995('0x45')]);return _0x18a3dc[_0x7995('0x89')](_0xf503d5);}})[_0x7995('0x19')](function(_0x4fb899){if(_0x4fb899){_0x503b32=_0x4fb899['length'];if(!_0x478c12[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0xf503d5[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x478c12[_0x7995('0x2c')]['limit']);_0xf503d5[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x478c12[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x18a3dc['getMembers'](_0xf503d5);}})['then'](function(_0x5b93e6){return _0x5b93e6?{'count':_0x503b32,'rows':_0x5b93e6}:null;})[_0x7995('0x19')](respondWithResult(_0x3b22ec,null))['catch'](handleError(_0x3b22ec,null));};exports[_0x7995('0x8a')]=function(_0x1b6411,_0x54e348){var _0x390bd3={};var _0x3f0a01={};var _0x45d8a2;var _0x26ab59;return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x1b6411['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x54e348,null))[_0x7995('0x19')](function(_0x2cfa1d){if(_0x2cfa1d){_0x45d8a2=_0x2cfa1d;_0x3f0a01[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmList'][_0x7995('0x32')]);_0x3f0a01[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x1b6411[_0x7995('0x2c')]);_0x3f0a01[_0x7995('0x33')]=_['intersection'](_0x3f0a01['model'],_0x3f0a01['query']);_0x390bd3['attributes']=_[_0x7995('0x35')](_0x3f0a01[_0x7995('0x31')],qs['fields'](_0x1b6411[_0x7995('0x2c')][_0x7995('0x36')]));_0x390bd3['attributes']=_0x390bd3['attributes'][_0x7995('0x44')]?_0x390bd3[_0x7995('0x34')]:_0x3f0a01[_0x7995('0x31')];_0x390bd3[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x50')]);_0x390bd3['where']=qs['filters'](_[_0x7995('0x52')](_0x1b6411[_0x7995('0x2c')],_0x3f0a01[_0x7995('0x33')]));if(_0x1b6411['query'][_0x7995('0x1c')]){_0x390bd3[_0x7995('0x51')]=_[_0x7995('0x38')](_0x390bd3[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x390bd3[_0x7995('0x34')],function(_0x28ac7c){var _0x1b4cab={};_0x1b4cab[_0x28ac7c]={'$like':'%'+_0x1b6411[_0x7995('0x2c')]['filter']+'%'};return _0x1b4cab;})});}_0x390bd3=_['merge']({},_0x390bd3,_0x1b6411[_0x7995('0x45')]);return _0x45d8a2['getLists'](_0x390bd3);}})[_0x7995('0x19')](function(_0x5953d1){if(_0x5953d1){_0x26ab59=_0x5953d1[_0x7995('0x44')];if(!_0x1b6411[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0x390bd3['limit']=qs[_0x7995('0x15')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x15')]);_0x390bd3[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x45d8a2[_0x7995('0x8a')](_0x390bd3);}})[_0x7995('0x19')](function(_0x35403c){if(_0x35403c){return _0x35403c?{'count':_0x26ab59,'rows':_0x35403c}:null;}})[_0x7995('0x19')](respondWithResult(_0x54e348,null))['catch'](handleError(_0x54e348,null));};exports[_0x7995('0x8b')]=function(_0xe43c99,_0x1b7e44){var _0x442c6d=moment()[_0x7995('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3b5edf,_0x44068f;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xe43c99[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1b7e44,null))[_0x7995('0x19')](function(_0x2b812f){if(_0x2b812f){_0x44068f=_0x2b812f;return _0x2b812f[_0x7995('0x8b')](_0xe43c99['body']['ids'],_[_0x7995('0x46')](_0xe43c99[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})[_0x7995('0x8c')](function(_0x17fd98){var _0x498d7c;_0x3b5edf=_0x17fd98||[];var _0x341024=[];if(_0x17fd98){for(var _0x2bcbc6=0x0;_0x2bcbc6<_0x17fd98[_0x7995('0x44')];_0x2bcbc6+=0x1){var _0x2dd6c7=_0x17fd98[_0x2bcbc6][_0x7995('0x3c')]({'plain':!![]});_0x44068f[_0x7995('0x8d')]=_0xe43c99[_0x7995('0x3b')][_0x7995('0x8d')]?_0xe43c99[_0x7995('0x3b')]['dialCheckDuplicateType']:_0x44068f['dialCheckDuplicateType'];switch(_0x44068f[_0x7995('0x8d')]){case _0x7995('0x8e'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),_0x7995('0x94'),'ContactId','ListId',_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),'VoiceQueueId')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')]('cm_contacts')[_0x7995('0x51')]('deletedAt\x20IS\x20NULL')[_0x7995('0x51')](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x9e'))['from']('cm_hopper_final')[_0x7995('0x51')](_0x7995('0x9f'),_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]()))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')]('COALESCE(phone,\x27\x27)')[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))[_0x7995('0x79')]();break;case _0x7995('0xa0'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt',_0x7995('0x97'),_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),'updatedAt'],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))['field'](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))['from'](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where']('ListId\x20=\x20?',_0x2dd6c7['CmListId'][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))[_0x7995('0x51')](_0x7995('0x9d'),squel[_0x7995('0x96')]()['field'](_0x7995('0xa3'))[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))['toString']();break;default:_0x498d7c=squel[_0x7995('0x8f')]()['into'](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt','ContactId',_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id','ContactId')['field'](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99['params']['id']['toString'](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where'](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')]['toString']())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();}_0x341024['push'](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x498d7c));}return BPromise[_0x7995('0x7d')](_0x341024);}})[_0x7995('0x19')](function(){var _0x113e03=[];var _0x5348b1=squel['insert']()[_0x7995('0x90')]('cm_hopper_additional_phones')[_0x7995('0x92')](['CmHopperId',_0x7995('0x93'),_0x7995('0xa4'),_0x7995('0x95'),'updatedAt'],squel['select']()['field'](_0x7995('0xa5'))[_0x7995('0x72')](_0x7995('0xa6'))['field'](_0x7995('0xa7'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa8'),'ci')[_0x7995('0xa9')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x7995('0x51')](_0x7995('0xaa'),_0x442c6d)[_0x7995('0x51')](_0x7995('0xab'),_0x7995('0xac')))[_0x7995('0x79')]();_0x113e03[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x5348b1));return BPromise[_0x7995('0x7d')](_0x113e03);})['then'](function(){return _0x3b5edf;})[_0x7995('0x19')](respondWithResult(_0x1b7e44,null))[_0x7995('0x2e')](handleError(_0x1b7e44,null));};exports[_0x7995('0xad')]=function(_0xff759b,_0x39ee00){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xff759b['params']['id']}})['then'](handleEntityNotFound(_0x39ee00,null))[_0x7995('0x19')](function(_0x2aec8d){if(_0x2aec8d){return _0x2aec8d[_0x7995('0xad')](_0xff759b[_0x7995('0x2c')]['ids']);}})['then'](function(_0x4b477a){if(_0x4b477a){return db[_0x7995('0x53')][_0x7995('0x25')]({'where':{'ListId':_0xff759b['query'][_0x7995('0x70')],'VoiceQueueId':_0xff759b[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x4b477a;});}})[_0x7995('0x19')](respondWithStatusCode(_0x39ee00,null))[_0x7995('0x2e')](handleError(_0x39ee00,null));};exports[_0x7995('0xae')]=function(_0x35229d,_0x22d392){var _0x57438e={};var _0x463c25={};var _0x13d525;var _0x37b7e7;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x35229d['params']['id']}})['then'](handleEntityNotFound(_0x22d392,null))['then'](function(_0x507bf3){if(_0x507bf3){_0x13d525=_0x507bf3;_0x463c25[_0x7995('0x31')]=_['keys'](db[_0x7995('0xaf')][_0x7995('0x32')]);_0x463c25['query']=_[_0x7995('0x4e')](_0x35229d[_0x7995('0x2c')]);_0x463c25[_0x7995('0x33')]=_[_0x7995('0x35')](_0x463c25['model'],_0x463c25[_0x7995('0x2c')]);_0x57438e['attributes']=_[_0x7995('0x35')](_0x463c25[_0x7995('0x31')],qs[_0x7995('0x36')](_0x35229d[_0x7995('0x2c')][_0x7995('0x36')]));_0x57438e[_0x7995('0x34')]=_0x57438e[_0x7995('0x34')][_0x7995('0x44')]?_0x57438e[_0x7995('0x34')]:_0x463c25[_0x7995('0x31')];_0x57438e['order']=qs[_0x7995('0x50')](_0x35229d[_0x7995('0x2c')]['sort']);_0x57438e[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x35229d[_0x7995('0x2c')],_0x463c25[_0x7995('0x33')]));if(_0x35229d[_0x7995('0x2c')]['filter']){_0x57438e[_0x7995('0x51')]=_['merge'](_0x57438e[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x57438e[_0x7995('0x34')],function(_0xb79b0b){var _0x259bf2={};_0x259bf2[_0xb79b0b]={'$like':'%'+_0x35229d[_0x7995('0x2c')]['filter']+'%'};return _0x259bf2;})});}_0x57438e=_[_0x7995('0x38')]({},_0x57438e,_0x35229d[_0x7995('0x45')]);return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x1176cd){if(_0x1176cd){_0x37b7e7=_0x1176cd[_0x7995('0x44')];if(!_0x35229d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x57438e[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x35229d[_0x7995('0x2c')][_0x7995('0x15')]);_0x57438e[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x35229d['query'][_0x7995('0x13')]);}return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x3098ef){if(_0x3098ef){return _0x3098ef?{'count':_0x37b7e7,'rows':_0x3098ef}:null;}})[_0x7995('0x19')](respondWithResult(_0x22d392,null))[_0x7995('0x2e')](handleError(_0x22d392,null));};exports[_0x7995('0xb0')]=function(_0x258f87,_0x5a5cc4){var _0x37af6b;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x258f87[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x5a5cc4,null))[_0x7995('0x19')](function(_0x120bef){if(_0x120bef){return _0x120bef[_0x7995('0xb0')](_0x258f87[_0x7995('0x3b')][_0x7995('0x70')],_[_0x7995('0x46')](_0x258f87[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})['spread'](function(_0x247b71){var _0x1ecb6f;_0x37af6b=_0x247b71||[];var _0x225a37=[];if(_0x247b71){for(var _0x1a9f59=0x0;_0x1a9f59<_0x247b71['length'];_0x1a9f59+=0x1){var _0x92a561=_0x247b71[_0x1a9f59][_0x7995('0x3c')]({'plain':!![]});_0x1ecb6f=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0xb1'))[_0x7995('0x92')]([_0x7995('0x93'),'ContactId',_0x7995('0x99'),'VoiceQueueId',_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('id',_0x7995('0x97'))['field'](_0x92a561[_0x7995('0x98')]['toString'](),_0x7995('0x99'))[_0x7995('0x72')](_0x258f87[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('NOW()',_0x7995('0x95'))[_0x7995('0x72')]('NOW()',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))[_0x7995('0x51')](_0x7995('0x9b'),_0x92a561[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();_0x225a37[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x1ecb6f));}return BPromise[_0x7995('0x7d')](_0x225a37);}})[_0x7995('0x19')](function(){return _0x37af6b;})['then'](respondWithResult(_0x5a5cc4,null))['catch'](handleError(_0x5a5cc4,null));};exports[_0x7995('0xb2')]=function(_0x2f3c17,_0x4fe5eb){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2f3c17['params']['id']}})['then'](handleEntityNotFound(_0x4fe5eb,null))[_0x7995('0x19')](function(_0x31a3d6){if(_0x31a3d6){return _0x31a3d6[_0x7995('0xb2')](_0x2f3c17[_0x7995('0x2c')][_0x7995('0x70')]);}})[_0x7995('0x19')](function(_0x1b3920){if(_0x1b3920){return db[_0x7995('0x5d')][_0x7995('0x25')]({'where':{'ListId':_0x2f3c17[_0x7995('0x2c')]['ids'],'VoiceQueueId':_0x2f3c17[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x1b3920;});}})[_0x7995('0x19')](respondWithStatusCode(_0x4fe5eb,null))[_0x7995('0x2e')](handleError(_0x4fe5eb,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index ee7fb04..735101f 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 _0x300d=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x575b72,_0x1a7eb1){var _0x561c57=function(_0x10e401){while(--_0x10e401){_0x575b72['push'](_0x575b72['shift']());}};_0x561c57(++_0x1a7eb1);}(_0x300d,0xb2));var _0xd300=function(_0x1b11a8,_0x27185f){_0x1b11a8=_0x1b11a8-0x0;var _0x47a609=_0x300d[_0x1b11a8];return _0x47a609;};'use strict';var EventEmitter=require(_0xd300('0x0'));var VoiceQueue=require(_0xd300('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xd300('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd300('0x3'),'afterDestroy':_0xd300('0x4')};function emitEvent(_0x5b3019){return function(_0x5166c4,_0x7be4ac,_0x20c503){VoiceQueueEvents[_0xd300('0x5')](_0x5b3019+':'+_0x5166c4['id'],_0x5166c4);VoiceQueueEvents['emit'](_0x5b3019,_0x5166c4);_0x20c503(null);};}for(var e in events){if(events[_0xd300('0x6')](e)){var event=events[e];VoiceQueue[_0xd300('0x7')](e,emitEvent(event));}}module[_0xd300('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x3bfe=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','update','emit'];(function(_0x505f05,_0x58c50d){var _0x1188b5=function(_0x2cc77c){while(--_0x2cc77c){_0x505f05['push'](_0x505f05['shift']());}};_0x1188b5(++_0x58c50d);}(_0x3bfe,0x95));var _0xe3bf=function(_0x407328,_0x4ea262){_0x407328=_0x407328-0x0;var _0x14e0b2=_0x3bfe[_0x407328];return _0x14e0b2;};'use strict';var EventEmitter=require(_0xe3bf('0x0'));var VoiceQueue=require(_0xe3bf('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe3bf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe3bf('0x3'),'afterDestroy':'remove'};function emitEvent(_0x54f2af){return function(_0xe318b1,_0x48012b,_0x58f3af){VoiceQueueEvents[_0xe3bf('0x4')](_0x54f2af+':'+_0xe318b1['id'],_0xe318b1);VoiceQueueEvents['emit'](_0x54f2af,_0xe318b1);_0x58f3af(null);};}for(var e in events){if(events[_0xe3bf('0x5')](e)){var event=events[e];VoiceQueue[_0xe3bf('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index a9df4f3..12336f5 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 _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x5e0e90,_0x1c8363){var _0x33cfe3=function(_0x44f842){while(--_0x44f842){_0x5e0e90['push'](_0x5e0e90['shift']());}};_0x33cfe3(++_0x1c8363);}(_0x008c,0x188));var _0xc008=function(_0x451735,_0x391a76){_0x451735=_0x451735-0x0;var _0x41d1e2=_0x008c[_0x451735];return _0x41d1e2;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'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(_0x469870,_0x5b9868){var _0x266ffe=function(_0x2efcc6){while(--_0x2efcc6){_0x469870['push'](_0x469870['shift']());}};_0x266ffe(++_0x5b9868);}(_0x34e8,0x12c));var _0x834e=function(_0x80b91b,_0x330b7d){_0x80b91b=_0x80b91b-0x0;var _0x2d9ffb=_0x34e8[_0x80b91b];return _0x2d9ffb;};'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 5c58330..50041ff 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 _0x11ec=['defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceQueue','findAll','options','raw','where','attributes','include','map','model','debug','VoiceQueue','find','ShowVoiceQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis'];(function(_0x5544f0,_0x56d45d){var _0x592a8d=function(_0x579862){while(--_0x579862){_0x5544f0['push'](_0x5544f0['shift']());}};_0x592a8d(++_0x56d45d);}(_0x11ec,0x172));var _0xc11e=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x11ec[_0x62c958];return _0x57ec61;};'use strict';var _=require('lodash');var util=require(_0xc11e('0x0'));var moment=require(_0xc11e('0x1'));var BPromise=require(_0xc11e('0x2'));var rs=require(_0xc11e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc11e('0x4'))['db'];var utils=require(_0xc11e('0x5'));var logger=require('../../config/logger')(_0xc11e('0x6'));var config=require('../../config/environment');var jayson=require(_0xc11e('0x7'));var client=jayson[_0xc11e('0x8')]['http']({'port':0x232a});config[_0xc11e('0x9')]=_[_0xc11e('0xa')](config[_0xc11e('0x9')],{'host':_0xc11e('0xb'),'port':0x18eb});var socket=require(_0xc11e('0xc'))(new Redis(config['redis']));require(_0xc11e('0xd'))[_0xc11e('0xe')](socket);function respondWithRpcPromise(_0x3cdb44,_0xbfb64,_0x2d9e1b){return new BPromise(function(_0x127cc1,_0x133d88){return client[_0xc11e('0xf')](_0x3cdb44,_0x2d9e1b)[_0xc11e('0x10')](function(_0x50d479){logger[_0xc11e('0x11')](_0xc11e('0x12'),_0xbfb64,_0xc11e('0x13'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0xbfb64,_0xc11e('0x13'),JSON[_0xc11e('0x14')](_0x50d479));if(_0x50d479[_0xc11e('0x15')]){if(_0x50d479['error'][_0xc11e('0x16')]===0x1f4){logger['error'](_0xc11e('0x12'),_0xbfb64,_0x50d479[_0xc11e('0x15')]['message']);return _0x133d88(_0x50d479[_0xc11e('0x15')][_0xc11e('0x17')]);}logger[_0xc11e('0x15')](_0xc11e('0x12'),_0xbfb64,_0x50d479[_0xc11e('0x15')]['message']);return _0x127cc1(_0x50d479[_0xc11e('0x15')][_0xc11e('0x17')]);}else{logger[_0xc11e('0x11')](_0xc11e('0x12'),_0xbfb64,_0xc11e('0x13'));_0x127cc1(_0x50d479['result'][_0xc11e('0x17')]);}})[_0xc11e('0x18')](function(_0x175701){logger[_0xc11e('0x15')]('VoiceQueue,\x20%s,\x20%s',_0xbfb64,_0x175701);_0x133d88(_0x175701);});});}exports[_0xc11e('0x19')]=function(_0x3c5f8a){var _0x1a0da0=this;return new Promise(function(_0x36bb8a,_0x2e4ca4){return db['VoiceQueue'][_0xc11e('0x1a')]({'raw':_0x3c5f8a[_0xc11e('0x1b')]?_0x3c5f8a[_0xc11e('0x1b')][_0xc11e('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c5f8a[_0xc11e('0x1b')]?_0x3c5f8a[_0xc11e('0x1b')][_0xc11e('0x1d')]||null:null,'attributes':_0x3c5f8a['options']?_0x3c5f8a[_0xc11e('0x1b')][_0xc11e('0x1e')]||null:null,'limit':_0x3c5f8a['options']?_0x3c5f8a[_0xc11e('0x1b')]['limit']||null:null,'include':_0x3c5f8a[_0xc11e('0x1b')]?_0x3c5f8a[_0xc11e('0x1b')][_0xc11e('0x1f')]?_[_0xc11e('0x20')](_0x3c5f8a[_0xc11e('0x1b')][_0xc11e('0x1f')],function(_0x5a13b0){return{'model':db[_0x5a13b0['model']],'as':_0x5a13b0['as'],'attributes':_0x5a13b0['attributes'],'include':_0x5a13b0['include']?_[_0xc11e('0x20')](_0x5a13b0['include'],function(_0x19f999){return{'model':db[_0x19f999[_0xc11e('0x21')]],'as':_0x19f999['as'],'attributes':_0x19f999[_0xc11e('0x1e')],'include':_0x19f999[_0xc11e('0x1f')]?_[_0xc11e('0x20')](_0x19f999[_0xc11e('0x1f')],function(_0x3020e4){return{'model':db[_0x3020e4['model']],'as':_0x3020e4['as'],'attributes':_0x3020e4['attributes']};}):[]};}):[]};}):[]:[]})[_0xc11e('0x10')](function(_0x281983){logger[_0xc11e('0x11')](_0xc11e('0x19'),_0x3c5f8a);logger[_0xc11e('0x22')](_0xc11e('0x19'),_0x3c5f8a,JSON[_0xc11e('0x14')](_0x281983));_0x36bb8a(_0x281983);})[_0xc11e('0x18')](function(_0x1b1362){logger['error']('GetVoiceQueue',_0x1b1362[_0xc11e('0x17')],_0x3c5f8a);_0x2e4ca4(_0x1a0da0[_0xc11e('0x15')](0x1f4,_0x1b1362[_0xc11e('0x17')]));});});};exports['ShowVoiceQueue']=function(_0x375012){var _0x194d8d=this;return new Promise(function(_0x23db91,_0x64fe72){return db[_0xc11e('0x23')][_0xc11e('0x24')]({'raw':_0x375012[_0xc11e('0x1b')]?_0x375012[_0xc11e('0x1b')][_0xc11e('0x1c')]===undefined?!![]:![]:!![],'where':_0x375012[_0xc11e('0x1b')]?_0x375012[_0xc11e('0x1b')][_0xc11e('0x1d')]||null:null,'attributes':_0x375012[_0xc11e('0x1b')]?_0x375012['options'][_0xc11e('0x1e')]||null:null,'include':_0x375012[_0xc11e('0x1b')]?_0x375012['options'][_0xc11e('0x1f')]?_[_0xc11e('0x20')](_0x375012[_0xc11e('0x1b')]['include'],function(_0x4e93ef){return{'model':db[_0x4e93ef[_0xc11e('0x21')]],'as':_0x4e93ef['as'],'attributes':_0x4e93ef[_0xc11e('0x1e')],'include':_0x4e93ef[_0xc11e('0x1f')]?_[_0xc11e('0x20')](_0x4e93ef[_0xc11e('0x1f')],function(_0x36a941){return{'model':db[_0x36a941[_0xc11e('0x21')]],'as':_0x36a941['as'],'attributes':_0x36a941[_0xc11e('0x1e')],'include':_0x36a941[_0xc11e('0x1f')]?_[_0xc11e('0x20')](_0x36a941[_0xc11e('0x1f')],function(_0x249afa){return{'model':db[_0x249afa[_0xc11e('0x21')]],'as':_0x249afa['as'],'attributes':_0x249afa[_0xc11e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc11e('0x10')](function(_0x5ebfee){logger['info'](_0xc11e('0x25'),_0x375012);logger['debug']('ShowVoiceQueue',_0x375012,JSON['stringify'](_0x5ebfee));_0x23db91(_0x5ebfee);})[_0xc11e('0x18')](function(_0x6590d6){logger[_0xc11e('0x15')](_0xc11e('0x25'),_0x6590d6['message'],_0x375012);_0x64fe72(_0x194d8d[_0xc11e('0x15')](0x1f4,_0x6590d6[_0xc11e('0x17')]));});});}; \ No newline at end of file +var _0xc163=['VoiceQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','findAll','options','raw','where','limit','include','map','model','attributes','GetVoiceQueue','catch','ShowVoiceQueue'];(function(_0x186906,_0x4f7453){var _0x4e46e5=function(_0x55a087){while(--_0x55a087){_0x186906['push'](_0x186906['shift']());}};_0x4e46e5(++_0x4f7453);}(_0xc163,0x16a));var _0x3c16=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc163[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3c16('0x0'));var util=require(_0x3c16('0x1'));var moment=require(_0x3c16('0x2'));var BPromise=require(_0x3c16('0x3'));var rs=require(_0x3c16('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c16('0x5'))['db'];var utils=require(_0x3c16('0x6'));var logger=require(_0x3c16('0x7'))(_0x3c16('0x8'));var config=require(_0x3c16('0x9'));var jayson=require(_0x3c16('0xa'));var client=jayson['client'][_0x3c16('0xb')]({'port':0x232a});config[_0x3c16('0xc')]=_['defaults'](config[_0x3c16('0xc')],{'host':_0x3c16('0xd'),'port':0x18eb});var socket=require(_0x3c16('0xe'))(new Redis(config[_0x3c16('0xc')]));require(_0x3c16('0xf'))['register'](socket);function respondWithRpcPromise(_0x3f178f,_0x444a9e,_0x525f5c){return new BPromise(function(_0x4acefe,_0x367346){return client['request'](_0x3f178f,_0x525f5c)[_0x3c16('0x10')](function(_0x6cca76){logger[_0x3c16('0x11')](_0x3c16('0x12'),_0x444a9e,'request\x20sent');logger[_0x3c16('0x13')](_0x3c16('0x14'),_0x444a9e,_0x3c16('0x15'),JSON[_0x3c16('0x16')](_0x6cca76));if(_0x6cca76['error']){if(_0x6cca76['error']['code']===0x1f4){logger['error'](_0x3c16('0x12'),_0x444a9e,_0x6cca76[_0x3c16('0x17')]['message']);return _0x367346(_0x6cca76['error'][_0x3c16('0x18')]);}logger[_0x3c16('0x17')](_0x3c16('0x12'),_0x444a9e,_0x6cca76['error'][_0x3c16('0x18')]);return _0x4acefe(_0x6cca76[_0x3c16('0x17')][_0x3c16('0x18')]);}else{logger['info'](_0x3c16('0x12'),_0x444a9e,_0x3c16('0x15'));_0x4acefe(_0x6cca76[_0x3c16('0x19')][_0x3c16('0x18')]);}})['catch'](function(_0x2c523e){logger[_0x3c16('0x17')](_0x3c16('0x12'),_0x444a9e,_0x2c523e);_0x367346(_0x2c523e);});});}exports['GetVoiceQueue']=function(_0x31f79f){var _0x30e23a=this;return new Promise(function(_0x475967,_0x3c633b){return db['VoiceQueue'][_0x3c16('0x1a')]({'raw':_0x31f79f[_0x3c16('0x1b')]?_0x31f79f[_0x3c16('0x1b')][_0x3c16('0x1c')]===undefined?!![]:![]:!![],'where':_0x31f79f[_0x3c16('0x1b')]?_0x31f79f[_0x3c16('0x1b')][_0x3c16('0x1d')]||null:null,'attributes':_0x31f79f['options']?_0x31f79f['options']['attributes']||null:null,'limit':_0x31f79f[_0x3c16('0x1b')]?_0x31f79f[_0x3c16('0x1b')][_0x3c16('0x1e')]||null:null,'include':_0x31f79f[_0x3c16('0x1b')]?_0x31f79f['options'][_0x3c16('0x1f')]?_[_0x3c16('0x20')](_0x31f79f[_0x3c16('0x1b')][_0x3c16('0x1f')],function(_0x55b657){return{'model':db[_0x55b657[_0x3c16('0x21')]],'as':_0x55b657['as'],'attributes':_0x55b657[_0x3c16('0x22')],'include':_0x55b657[_0x3c16('0x1f')]?_['map'](_0x55b657['include'],function(_0x1c3c43){return{'model':db[_0x1c3c43[_0x3c16('0x21')]],'as':_0x1c3c43['as'],'attributes':_0x1c3c43[_0x3c16('0x22')],'include':_0x1c3c43[_0x3c16('0x1f')]?_[_0x3c16('0x20')](_0x1c3c43[_0x3c16('0x1f')],function(_0x1d78a8){return{'model':db[_0x1d78a8['model']],'as':_0x1d78a8['as'],'attributes':_0x1d78a8[_0x3c16('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3c16('0x10')](function(_0x2f9386){logger[_0x3c16('0x11')](_0x3c16('0x23'),_0x31f79f);logger[_0x3c16('0x13')](_0x3c16('0x23'),_0x31f79f,JSON[_0x3c16('0x16')](_0x2f9386));_0x475967(_0x2f9386);})[_0x3c16('0x24')](function(_0x2076f7){logger['error'](_0x3c16('0x23'),_0x2076f7[_0x3c16('0x18')],_0x31f79f);_0x3c633b(_0x30e23a['error'](0x1f4,_0x2076f7[_0x3c16('0x18')]));});});};exports[_0x3c16('0x25')]=function(_0x502663){var _0x3ae814=this;return new Promise(function(_0x404910,_0x7282ee){return db[_0x3c16('0x26')][_0x3c16('0x27')]({'raw':_0x502663[_0x3c16('0x1b')]?_0x502663['options'][_0x3c16('0x1c')]===undefined?!![]:![]:!![],'where':_0x502663[_0x3c16('0x1b')]?_0x502663[_0x3c16('0x1b')][_0x3c16('0x1d')]||null:null,'attributes':_0x502663['options']?_0x502663['options'][_0x3c16('0x22')]||null:null,'include':_0x502663[_0x3c16('0x1b')]?_0x502663[_0x3c16('0x1b')]['include']?_[_0x3c16('0x20')](_0x502663[_0x3c16('0x1b')]['include'],function(_0xe2e856){return{'model':db[_0xe2e856[_0x3c16('0x21')]],'as':_0xe2e856['as'],'attributes':_0xe2e856[_0x3c16('0x22')],'include':_0xe2e856[_0x3c16('0x1f')]?_[_0x3c16('0x20')](_0xe2e856['include'],function(_0x28eb07){return{'model':db[_0x28eb07[_0x3c16('0x21')]],'as':_0x28eb07['as'],'attributes':_0x28eb07[_0x3c16('0x22')],'include':_0x28eb07['include']?_[_0x3c16('0x20')](_0x28eb07['include'],function(_0x2e7c20){return{'model':db[_0x2e7c20[_0x3c16('0x21')]],'as':_0x2e7c20['as'],'attributes':_0x2e7c20[_0x3c16('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1eeb7e){logger[_0x3c16('0x11')]('ShowVoiceQueue',_0x502663);logger[_0x3c16('0x13')]('ShowVoiceQueue',_0x502663,JSON['stringify'](_0x1eeb7e));_0x404910(_0x1eeb7e);})['catch'](function(_0x2c1ff8){logger[_0x3c16('0x17')]('ShowVoiceQueue',_0x2c1ff8[_0x3c16('0x18')],_0x502663);_0x7282ee(_0x3ae814[_0x3c16('0x17')](0x1f4,_0x2c1ff8[_0x3c16('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 7ce9cf1..8dc6bdb 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 _0x9da9=['register','length','voiceQueue:','./voiceQueue.events','update','emit','removeListener'];(function(_0x42cbd1,_0x1b9c58){var _0x504572=function(_0x111c23){while(--_0x111c23){_0x42cbd1['push'](_0x42cbd1['shift']());}};_0x504572(++_0x1b9c58);}(_0x9da9,0x1b5));var _0x99da=function(_0x494f4d,_0x2807fa){_0x494f4d=_0x494f4d-0x0;var _0x3e7dfc=_0x9da9[_0x494f4d];return _0x3e7dfc;};'use strict';var VoiceQueueEvents=require(_0x99da('0x0'));var events=['save','remove',_0x99da('0x1')];function createListener(_0x4e6e3e,_0x448ae1){return function(_0x109353){_0x448ae1[_0x99da('0x2')](_0x4e6e3e,_0x109353);};}function removeListener(_0x53179c,_0x1c21cc){return function(){VoiceQueueEvents[_0x99da('0x3')](_0x53179c,_0x1c21cc);};}exports[_0x99da('0x4')]=function(_0x20082a){for(var _0x3a82c5=0x0,_0x1e291e=events[_0x99da('0x5')];_0x3a82c5<_0x1e291e;_0x3a82c5++){var _0x20104b=events[_0x3a82c5];var _0x326798=createListener(_0x99da('0x6')+_0x20104b,_0x20082a);VoiceQueueEvents['on'](_0x20104b,_0x326798);}}; \ No newline at end of file +var _0x4b60=['length','voiceQueue:','remove','update','emit','removeListener','register'];(function(_0x198282,_0x148da3){var _0x4b4274=function(_0x11460c){while(--_0x11460c){_0x198282['push'](_0x198282['shift']());}};_0x4b4274(++_0x148da3);}(_0x4b60,0x105));var _0x04b6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4b60[_0x3947c9];return _0x2e7871;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0x04b6('0x0'),_0x04b6('0x1')];function createListener(_0x368dc0,_0x41011a){return function(_0x2ec412){_0x41011a[_0x04b6('0x2')](_0x368dc0,_0x2ec412);};}function removeListener(_0x3e2f02,_0x10c2d0){return function(){VoiceQueueEvents[_0x04b6('0x3')](_0x3e2f02,_0x10c2d0);};}exports[_0x04b6('0x4')]=function(_0x55e012){for(var _0x42865c=0x0,_0x59f908=events[_0x04b6('0x5')];_0x42865c<_0x59f908;_0x42865c++){var _0x12c80f=events[_0x42865c];var _0x3b7232=createListener(_0x04b6('0x6')+_0x12c80f,_0x55e012);VoiceQueueEvents['on'](_0x12c80f,_0x3b7232);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 8f27106..c802073 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 _0xfb2b=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceQueueReport.controller','get','index','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','destroy'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xfb2b,0x177));var _0xbfb2=function(_0x2b6e8d,_0x31d0fa){_0x2b6e8d=_0x2b6e8d-0x0;var _0x210c69=_0xfb2b[_0x2b6e8d];return _0x210c69;};'use strict';var multer=require(_0xbfb2('0x0'));var util=require(_0xbfb2('0x1'));var path=require('path');var timeout=require(_0xbfb2('0x2'));var express=require(_0xbfb2('0x3'));var router=express[_0xbfb2('0x4')]();var fs_extra=require(_0xbfb2('0x5'));var auth=require(_0xbfb2('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbfb2('0x7'));router[_0xbfb2('0x8')]('/',auth['isAuthenticated'](),controller[_0xbfb2('0x9')]);router[_0xbfb2('0x8')](_0xbfb2('0xa'),auth[_0xbfb2('0xb')](),controller[_0xbfb2('0xc')]);router[_0xbfb2('0x8')](_0xbfb2('0xd'),auth[_0xbfb2('0xb')](),controller[_0xbfb2('0xe')]);router[_0xbfb2('0x8')](_0xbfb2('0xf'),auth[_0xbfb2('0xb')](),controller[_0xbfb2('0x10')]);router[_0xbfb2('0x11')]('/',auth['isAuthenticated'](),controller[_0xbfb2('0x12')]);router[_0xbfb2('0x13')]('/:id',auth[_0xbfb2('0xb')](),controller['update']);router['delete'](_0xbfb2('0xf'),auth['isAuthenticated'](),controller[_0xbfb2('0x14')]);module[_0xbfb2('0x15')]=router; \ No newline at end of file +var _0xf96a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/index','getVoiceQueuesReport','show','post','create','/:id','update','delete','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf96a,0x7c));var _0xaf96=function(_0x26a31a,_0x3608d3){_0x26a31a=_0x26a31a-0x0;var _0x4ce39c=_0xf96a[_0x26a31a];return _0x4ce39c;};'use strict';var multer=require(_0xaf96('0x0'));var util=require(_0xaf96('0x1'));var path=require('path');var timeout=require(_0xaf96('0x2'));var express=require(_0xaf96('0x3'));var router=express[_0xaf96('0x4')]();var fs_extra=require(_0xaf96('0x5'));var auth=require(_0xaf96('0x6'));var interaction=require(_0xaf96('0x7'));var config=require(_0xaf96('0x8'));var controller=require('./voiceQueueReport.controller');router[_0xaf96('0x9')]('/',auth['isAuthenticated'](),controller[_0xaf96('0xa')]);router['get'](_0xaf96('0xb'),auth[_0xaf96('0xc')](),controller['describe']);router['get'](_0xaf96('0xd'),auth['isAuthenticated'](),controller[_0xaf96('0xe')]);router[_0xaf96('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xaf96('0xf')]);router[_0xaf96('0x10')]('/',auth['isAuthenticated'](),controller[_0xaf96('0x11')]);router['put'](_0xaf96('0x12'),auth[_0xaf96('0xc')](),controller[_0xaf96('0x13')]);router[_0xaf96('0x14')](_0xaf96('0x12'),auth[_0xaf96('0xc')](),controller['destroy']);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 2842f8a..e785637 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 _0xc094=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xc094,0x19e));var _0x4c09=function(_0x15d522,_0x346103){_0x15d522=_0x15d522-0x0;var _0x4fc44a=_0xc094[_0x15d522];return _0x4fc44a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4c09('0x0'));module[_0x4c09('0x1')]={'type':{'type':Sequelize[_0x4c09('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4c09('0x2')]},'calleridname':{'type':Sequelize[_0x4c09('0x2')]},'queue':{'type':Sequelize[_0x4c09('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x4c09('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x4c09('0x3')],'set':function(_0x5e6bd1){var _0x3d86e5=moment(_0x5e6bd1);var _0x11ace0=moment(this[_0x4c09('0x4')](_0x4c09('0x5')))['format'](_0x4c09('0x6'));var _0x566a75=_0x3d86e5[_0x4c09('0x7')](_0x11ace0,_0x4c09('0x8'));this[_0x4c09('0x9')](_0x4c09('0xa'),_0x5e6bd1);this[_0x4c09('0x9')]('holdtime',_0x566a75||null);}},'position':{'type':Sequelize[_0x4c09('0xb')]},'count':{'type':Sequelize[_0x4c09('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x4c09('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x4c09('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x4c09('0x3')]},'queuecallerexit':{'type':Sequelize[_0x4c09('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x4c09('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x4c09('0xd')},'originalposition':{'type':Sequelize[_0x4c09('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4c09('0x2')]},'connectedlinename':{'type':Sequelize[_0x4c09('0x2')]},'accountcode':{'type':Sequelize[_0x4c09('0x2')]},'context':{'type':Sequelize[_0x4c09('0x2')]},'exten':{'type':Sequelize[_0x4c09('0x2')]},'priority':{'type':Sequelize[_0x4c09('0x2')]},'holdtime':{'type':Sequelize[_0x4c09('0xb')]},'mohtime':{'type':Sequelize[_0x4c09('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4c09('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4c09('0x2')],'comment':_0x4c09('0xe')},'transferexten':{'type':Sequelize[_0x4c09('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4c09('0x2')]},'disposition':{'type':Sequelize[_0x4c09('0x2')]},'secondDisposition':{'type':Sequelize[_0x4c09('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4c09('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x4c09('0xb')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x63a0=['queuecallerjoinAt','diff','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','moment','exports','STRING','DATE','getDataValue'];(function(_0x53fd4c,_0x43074e){var _0x4b4757=function(_0x33b2b1){while(--_0x33b2b1){_0x53fd4c['push'](_0x53fd4c['shift']());}};_0x4b4757(++_0x43074e);}(_0x63a0,0xbf));var _0x063a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x63a0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x063a('0x0'));module[_0x063a('0x1')]={'type':{'type':Sequelize[_0x063a('0x2')]},'uniqueid':{'type':Sequelize[_0x063a('0x2')]},'calleridnum':{'type':Sequelize[_0x063a('0x2')]},'calleridname':{'type':Sequelize[_0x063a('0x2')]},'queue':{'type':Sequelize[_0x063a('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x063a('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x063a('0x3')],'set':function(_0x3ef2b5){var _0x59c93c=moment(_0x3ef2b5);var _0x42e098=moment(this[_0x063a('0x4')](_0x063a('0x5')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x473b62=_0x59c93c[_0x063a('0x6')](_0x42e098,_0x063a('0x7'));this['setDataValue'](_0x063a('0x8'),_0x3ef2b5);this[_0x063a('0x9')](_0x063a('0xa'),_0x473b62||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x063a('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x063a('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x063a('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x063a('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x063a('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x063a('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x063a('0x2')],'comment':_0x063a('0xd')},'originalposition':{'type':Sequelize[_0x063a('0xb')]},'channel':{'type':Sequelize[_0x063a('0x2')]},'connectedlinenum':{'type':Sequelize[_0x063a('0x2')]},'connectedlinename':{'type':Sequelize[_0x063a('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x063a('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x063a('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x063a('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x063a('0x2')]},'transfer':{'type':Sequelize[_0x063a('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x063a('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x063a('0x2')]},'disposition':{'type':Sequelize[_0x063a('0x2')]},'secondDisposition':{'type':Sequelize[_0x063a('0x2')]},'thirdDisposition':{'type':Sequelize[_0x063a('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x063a('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x063a('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index ccae582..1708f16 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 _0x8ec2=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','destroy','then','end','stack','name','send','index','map','VoiceQueueReport','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','order','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x2fb866,_0x59bc0c){var _0x5d310f=function(_0x13bf75){while(--_0x13bf75){_0x2fb866['push'](_0x2fb866['shift']());}};_0x5d310f(++_0x59bc0c);}(_0x8ec2,0x96));var _0x28ec=function(_0x1d24e7,_0xc466ad){_0x1d24e7=_0x1d24e7-0x0;var _0x181317=_0x8ec2[_0x1d24e7];return _0x181317;};'use strict';var emlformat=require(_0x28ec('0x0'));var rimraf=require(_0x28ec('0x1'));var zipdir=require(_0x28ec('0x2'));var jsonpatch=require(_0x28ec('0x3'));var rp=require('request-promise');var moment=require(_0x28ec('0x4'));var BPromise=require(_0x28ec('0x5'));var Mustache=require('mustache');var util=require(_0x28ec('0x6'));var path=require(_0x28ec('0x7'));var sox=require(_0x28ec('0x8'));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(_0x28ec('0x9'));var crypto=require(_0x28ec('0xa'));var jsforce=require(_0x28ec('0xb'));var deskjs=require(_0x28ec('0xc'));var toCsv=require('to-csv');var querystring=require(_0x28ec('0xd'));var Papa=require(_0x28ec('0xe'));var Redis=require('ioredis');var authService=require(_0x28ec('0xf'));var qs=require(_0x28ec('0x10'));var as=require(_0x28ec('0x11'));var hardwareService=require(_0x28ec('0x12'));var logger=require(_0x28ec('0x13'))(_0x28ec('0x14'));var utils=require('../../config/utils');var config=require(_0x28ec('0x15'));var licenseUtil=require(_0x28ec('0x16'));var db=require(_0x28ec('0x17'))['db'];config[_0x28ec('0x18')]=_[_0x28ec('0x19')](config['redis'],{'host':_0x28ec('0x1a'),'port':0x18eb});var socket=require(_0x28ec('0x1b'))(new Redis(config[_0x28ec('0x18')]));require(_0x28ec('0x1c'))[_0x28ec('0x1d')](socket);function respondWithStatusCode(_0x4d7ad9,_0x405b60){_0x405b60=_0x405b60||0xcc;return function(_0x2345d0){if(_0x2345d0){return _0x4d7ad9[_0x28ec('0x1e')](_0x405b60);}return _0x4d7ad9[_0x28ec('0x1f')](_0x405b60)['end']();};}function respondWithResult(_0x347467,_0x1e1654){_0x1e1654=_0x1e1654||0xc8;return function(_0x337882){if(_0x337882){return _0x347467[_0x28ec('0x1f')](_0x1e1654)['json'](_0x337882);}};}function respondWithFilteredResult(_0x186aa3,_0x4da9c2){return function(_0x2a3e36){if(_0x2a3e36){var _0x54fd83=typeof _0x4da9c2[_0x28ec('0x20')]===_0x28ec('0x21')&&typeof _0x4da9c2[_0x28ec('0x22')]===_0x28ec('0x21');var _0x511ac0=_0x2a3e36['count'];var _0x201523=_0x54fd83?0x0:_0x4da9c2[_0x28ec('0x20')];var _0x4c8ce3=_0x54fd83?_0x2a3e36[_0x28ec('0x23')]:_0x4da9c2[_0x28ec('0x20')]+_0x4da9c2['limit'];var _0x584240;if(_0x4c8ce3>=_0x511ac0){_0x4c8ce3=_0x511ac0;_0x584240=0xc8;}else{_0x584240=0xce;}_0x186aa3[_0x28ec('0x1f')](_0x584240);return _0x186aa3['set'](_0x28ec('0x24'),_0x201523+'-'+_0x4c8ce3+'/'+_0x511ac0)[_0x28ec('0x25')](_0x2a3e36);}return null;};}function patchUpdates(_0xd6badd){return function(_0x1ac3f6){try{jsonpatch['apply'](_0x1ac3f6,_0xd6badd,!![]);}catch(_0x4e7b66){return BPromise[_0x28ec('0x26')](_0x4e7b66);}return _0x1ac3f6[_0x28ec('0x27')]();};}function saveUpdates(_0x51e858,_0x541b30){return function(_0x25a5eb){if(_0x25a5eb){return _0x25a5eb[_0x28ec('0x28')](_0x51e858)['then'](function(_0x4817f0){return _0x4817f0;});}return null;};}function removeEntity(_0x462765,_0x1e73a5){return function(_0xe3cd17){if(_0xe3cd17){return _0xe3cd17[_0x28ec('0x29')]()[_0x28ec('0x2a')](function(){_0x462765['status'](0xcc)[_0x28ec('0x2b')]();});}};}function handleEntityNotFound(_0x54fb37,_0x592775){return function(_0x2e7ffb){if(!_0x2e7ffb){_0x54fb37['sendStatus'](0x194);}return _0x2e7ffb;};}function handleError(_0x5bd9be,_0x5e8d3d){_0x5e8d3d=_0x5e8d3d||0x1f4;return function(_0x212d5c){logger['error'](_0x212d5c[_0x28ec('0x2c')]);if(_0x212d5c['name']){delete _0x212d5c[_0x28ec('0x2d')];}_0x5bd9be[_0x28ec('0x1f')](_0x5e8d3d)[_0x28ec('0x2e')](_0x212d5c);};}exports[_0x28ec('0x2f')]=function(_0x34539c,_0x54dbc9){var _0x17ae4c={},_0x2e7c31={},_0x5e83e8={'count':0x0,'rows':[]};var _0x1a9f65=_[_0x28ec('0x30')](db[_0x28ec('0x31')]['rawAttributes'],function(_0x39d910){return{'name':_0x39d910['fieldName'],'type':_0x39d910[_0x28ec('0x32')][_0x28ec('0x33')]};});_0x2e7c31[_0x28ec('0x34')]=_[_0x28ec('0x30')](_0x1a9f65,_0x28ec('0x2d'));_0x2e7c31['query']=_[_0x28ec('0x35')](_0x34539c[_0x28ec('0x36')]);_0x2e7c31[_0x28ec('0x37')]=_[_0x28ec('0x38')](_0x2e7c31['model'],_0x2e7c31[_0x28ec('0x36')]);_0x17ae4c[_0x28ec('0x39')]=_[_0x28ec('0x38')](_0x2e7c31[_0x28ec('0x34')],qs[_0x28ec('0x3a')](_0x34539c[_0x28ec('0x36')]['fields']));_0x17ae4c[_0x28ec('0x39')]=_0x17ae4c[_0x28ec('0x39')][_0x28ec('0x3b')]?_0x17ae4c['attributes']:_0x2e7c31[_0x28ec('0x34')];if(!_0x34539c[_0x28ec('0x36')][_0x28ec('0x3c')](_0x28ec('0x3d'))){_0x17ae4c[_0x28ec('0x22')]=qs[_0x28ec('0x22')](_0x34539c[_0x28ec('0x36')]['limit']);_0x17ae4c['offset']=qs[_0x28ec('0x20')](_0x34539c[_0x28ec('0x36')][_0x28ec('0x20')]);}_0x17ae4c['order']=qs[_0x28ec('0x3e')](_0x34539c[_0x28ec('0x36')][_0x28ec('0x3e')]);_0x17ae4c[_0x28ec('0x3f')]=qs['filters'](_[_0x28ec('0x40')](_0x34539c[_0x28ec('0x36')],_0x2e7c31[_0x28ec('0x37')]),_0x1a9f65);if(_0x34539c[_0x28ec('0x36')][_0x28ec('0x41')]){_0x17ae4c[_0x28ec('0x3f')]=_[_0x28ec('0x42')](_0x17ae4c[_0x28ec('0x3f')],{'$or':_['map'](_0x1a9f65,function(_0x5d320d){if(_0x5d320d[_0x28ec('0x32')]!==_0x28ec('0x43')){var _0x23d9a4={};_0x23d9a4[_0x5d320d['name']]={'$like':'%'+_0x34539c[_0x28ec('0x36')][_0x28ec('0x41')]+'%'};return _0x23d9a4;}})});}_0x17ae4c=_['merge']({},_0x17ae4c,_0x34539c[_0x28ec('0x44')]);var _0x21133b={'where':_0x17ae4c['where']};return db['VoiceQueueReport']['count'](_0x21133b)[_0x28ec('0x2a')](function(_0xc708f2){_0x5e83e8[_0x28ec('0x23')]=_0xc708f2;if(_0x34539c[_0x28ec('0x36')][_0x28ec('0x45')]){_0x17ae4c[_0x28ec('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x28ec('0x47')](_0x17ae4c);})[_0x28ec('0x2a')](function(_0x122288){_0x5e83e8[_0x28ec('0x48')]=_0x122288;return _0x5e83e8;})[_0x28ec('0x2a')](respondWithFilteredResult(_0x54dbc9,_0x17ae4c))[_0x28ec('0x49')](handleError(_0x54dbc9,null));};exports[_0x28ec('0x4a')]=function(_0x2d89df,_0x3c60e3){var _0x37ff3e={'raw':![],'where':{'id':_0x2d89df[_0x28ec('0x4b')]['id']}},_0x330b16={};_0x330b16[_0x28ec('0x34')]=_[_0x28ec('0x35')](db[_0x28ec('0x31')][_0x28ec('0x4c')]);_0x330b16[_0x28ec('0x36')]=_[_0x28ec('0x35')](_0x2d89df[_0x28ec('0x36')]);_0x330b16[_0x28ec('0x37')]=_[_0x28ec('0x38')](_0x330b16[_0x28ec('0x34')],_0x330b16[_0x28ec('0x36')]);_0x37ff3e['attributes']=_[_0x28ec('0x38')](_0x330b16['model'],qs[_0x28ec('0x3a')](_0x2d89df[_0x28ec('0x36')][_0x28ec('0x3a')]));_0x37ff3e[_0x28ec('0x39')]=_0x37ff3e['attributes']['length']?_0x37ff3e[_0x28ec('0x39')]:_0x330b16[_0x28ec('0x34')];if(_0x2d89df[_0x28ec('0x36')][_0x28ec('0x45')]){_0x37ff3e[_0x28ec('0x46')]=[{'all':!![]}];}_0x37ff3e=_[_0x28ec('0x42')]({},_0x37ff3e,_0x2d89df[_0x28ec('0x44')]);return db['VoiceQueueReport'][_0x28ec('0x4d')](_0x37ff3e)[_0x28ec('0x2a')](handleEntityNotFound(_0x3c60e3,null))['then'](respondWithResult(_0x3c60e3,null))['catch'](handleError(_0x3c60e3,null));};exports[_0x28ec('0x4e')]=function(_0x16b307,_0x32351a){return db['VoiceQueueReport'][_0x28ec('0x4e')](_0x16b307[_0x28ec('0x4f')],{})[_0x28ec('0x2a')](respondWithResult(_0x32351a,0xc9))[_0x28ec('0x49')](handleError(_0x32351a,null));};exports[_0x28ec('0x28')]=function(_0x768956,_0x3ac162){if(_0x768956[_0x28ec('0x4f')]['id']){delete _0x768956[_0x28ec('0x4f')]['id'];}return db[_0x28ec('0x31')]['find']({'where':{'id':_0x768956['params']['id']}})[_0x28ec('0x2a')](handleEntityNotFound(_0x3ac162,null))[_0x28ec('0x2a')](saveUpdates(_0x768956['body'],null))[_0x28ec('0x2a')](respondWithResult(_0x3ac162,null))[_0x28ec('0x49')](handleError(_0x3ac162,null));};exports['destroy']=function(_0x5ba493,_0x9cf18a){return db[_0x28ec('0x31')][_0x28ec('0x4d')]({'where':{'id':_0x5ba493[_0x28ec('0x4b')]['id']}})['then'](handleEntityNotFound(_0x9cf18a,null))['then'](removeEntity(_0x9cf18a,null))[_0x28ec('0x49')](handleError(_0x9cf18a,null));};exports[_0x28ec('0x50')]=function(_0x15e4a3,_0x8e7f99){return db[_0x28ec('0x31')]['describe']()[_0x28ec('0x2a')](respondWithResult(_0x8e7f99,null))[_0x28ec('0x49')](handleError(_0x8e7f99,null));};exports['getVoiceQueuesReport']=function(_0x447646,_0x4c8dbc){var _0x204814={},_0x31a290={},_0x5b7137={'count':0x0,'rows':[]};_0x31a290[_0x28ec('0x34')]=_[_0x28ec('0x35')](db[_0x28ec('0x31')][_0x28ec('0x4c')]);_0x31a290['query']=_[_0x28ec('0x35')](_0x447646[_0x28ec('0x36')]);_0x31a290[_0x28ec('0x37')]=_['intersection'](_0x31a290[_0x28ec('0x34')],_0x31a290['query']);_0x204814[_0x28ec('0x39')]=_[_0x28ec('0x38')](_0x31a290[_0x28ec('0x34')],qs[_0x28ec('0x3a')](_0x447646[_0x28ec('0x36')]['fields']));_0x204814[_0x28ec('0x39')]=_0x204814[_0x28ec('0x39')][_0x28ec('0x3b')]?_0x204814[_0x28ec('0x39')]:_0x31a290['model'];if(!_0x447646[_0x28ec('0x36')][_0x28ec('0x3c')](_0x28ec('0x3d'))){_0x204814['limit']=qs[_0x28ec('0x22')](_0x447646['query']['limit']);_0x204814[_0x28ec('0x20')]=qs[_0x28ec('0x20')](_0x447646['query']['offset']);}_0x204814[_0x28ec('0x51')]=qs['sort'](_0x447646[_0x28ec('0x36')][_0x28ec('0x3e')]);_0x204814['where']=qs[_0x28ec('0x37')](_[_0x28ec('0x40')](_0x447646['query'],_0x31a290[_0x28ec('0x37')]));if(_0x447646[_0x28ec('0x36')][_0x28ec('0x41')]){_0x204814[_0x28ec('0x3f')]=_[_0x28ec('0x42')](_0x204814['where'],{'$or':_['map'](_0x204814['attributes'],function(_0x2615da){var _0x112163={};_0x112163[_0x2615da]={'$like':'%'+_0x447646['query']['filter']+'%'};return _0x112163;})});}_0x204814=_[_0x28ec('0x42')]({},_0x204814,_0x447646[_0x28ec('0x44')]);var _0x5b2b80={'where':_0x204814[_0x28ec('0x3f')]};return db[_0x28ec('0x31')][_0x28ec('0x23')](_0x5b2b80)[_0x28ec('0x2a')](function(_0x45a996){_0x5b7137[_0x28ec('0x23')]=_0x45a996;if(_0x447646['query'][_0x28ec('0x45')]){_0x204814[_0x28ec('0x46')]=[{'all':!![]}];}return db[_0x28ec('0x31')][_0x28ec('0x47')](_0x204814);})[_0x28ec('0x2a')](function(_0x7cfe24){_0x5b7137[_0x28ec('0x48')]=_0x7cfe24;return _0x5b7137;})[_0x28ec('0x2a')](respondWithFilteredResult(_0x4c8dbc,_0x204814,_0x28ec('0x52')))['catch'](handleError(_0x4c8dbc,null,_0x28ec('0x52')));}; \ No newline at end of file +var _0x59dd=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','create','body','describe','include','getVoiceQueuesReport','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','VoiceQueueReport','rawAttributes','type','key','model','query'];(function(_0x44add6,_0x4a1390){var _0x5c8236=function(_0x25b6b3){while(--_0x25b6b3){_0x44add6['push'](_0x44add6['shift']());}};_0x5c8236(++_0x4a1390);}(_0x59dd,0x15c));var _0xd59d=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x59dd[_0x119d5a];return _0x15bff4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd59d('0x0'));var zipdir=require(_0xd59d('0x1'));var jsonpatch=require(_0xd59d('0x2'));var rp=require('request-promise');var moment=require(_0xd59d('0x3'));var BPromise=require(_0xd59d('0x4'));var Mustache=require('mustache');var util=require(_0xd59d('0x5'));var path=require(_0xd59d('0x6'));var sox=require(_0xd59d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd59d('0x8'));var _=require('lodash');var squel=require(_0xd59d('0x9'));var crypto=require('crypto');var jsforce=require(_0xd59d('0xa'));var deskjs=require(_0xd59d('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd59d('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd59d('0xd'));var qs=require(_0xd59d('0xe'));var as=require(_0xd59d('0xf'));var hardwareService=require(_0xd59d('0x10'));var logger=require(_0xd59d('0x11'))(_0xd59d('0x12'));var utils=require(_0xd59d('0x13'));var config=require(_0xd59d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd59d('0x15'))['db'];config[_0xd59d('0x16')]=_[_0xd59d('0x17')](config['redis'],{'host':_0xd59d('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd59d('0x16')]));require(_0xd59d('0x19'))[_0xd59d('0x1a')](socket);function respondWithStatusCode(_0xc88657,_0x270858){_0x270858=_0x270858||0xcc;return function(_0x4c1161){if(_0x4c1161){return _0xc88657[_0xd59d('0x1b')](_0x270858);}return _0xc88657[_0xd59d('0x1c')](_0x270858)[_0xd59d('0x1d')]();};}function respondWithResult(_0x3f21bd,_0x5e5d52){_0x5e5d52=_0x5e5d52||0xc8;return function(_0x13bf41){if(_0x13bf41){return _0x3f21bd[_0xd59d('0x1c')](_0x5e5d52)[_0xd59d('0x1e')](_0x13bf41);}};}function respondWithFilteredResult(_0x1c24b4,_0x514868){return function(_0xa3c431){if(_0xa3c431){var _0x38899d=typeof _0x514868[_0xd59d('0x1f')]===_0xd59d('0x20')&&typeof _0x514868[_0xd59d('0x21')]==='undefined';var _0xac7f8a=_0xa3c431[_0xd59d('0x22')];var _0x41bc05=_0x38899d?0x0:_0x514868[_0xd59d('0x1f')];var _0x353ba3=_0x38899d?_0xa3c431[_0xd59d('0x22')]:_0x514868[_0xd59d('0x1f')]+_0x514868[_0xd59d('0x21')];var _0x3cd253;if(_0x353ba3>=_0xac7f8a){_0x353ba3=_0xac7f8a;_0x3cd253=0xc8;}else{_0x3cd253=0xce;}_0x1c24b4[_0xd59d('0x1c')](_0x3cd253);return _0x1c24b4[_0xd59d('0x23')](_0xd59d('0x24'),_0x41bc05+'-'+_0x353ba3+'/'+_0xac7f8a)[_0xd59d('0x1e')](_0xa3c431);}return null;};}function patchUpdates(_0x553e84){return function(_0x503de7){try{jsonpatch[_0xd59d('0x25')](_0x503de7,_0x553e84,!![]);}catch(_0x5b9757){return BPromise[_0xd59d('0x26')](_0x5b9757);}return _0x503de7['save']();};}function saveUpdates(_0x4eb7bd,_0x4c1fc7){return function(_0x47ddce){if(_0x47ddce){return _0x47ddce[_0xd59d('0x27')](_0x4eb7bd)[_0xd59d('0x28')](function(_0x21039a){return _0x21039a;});}return null;};}function removeEntity(_0x516bec,_0x1f9e30){return function(_0x455fd3){if(_0x455fd3){return _0x455fd3[_0xd59d('0x29')]()['then'](function(){_0x516bec[_0xd59d('0x1c')](0xcc)[_0xd59d('0x1d')]();});}};}function handleEntityNotFound(_0x3e2876,_0x5c64fd){return function(_0x556ea8){if(!_0x556ea8){_0x3e2876[_0xd59d('0x1b')](0x194);}return _0x556ea8;};}function handleError(_0x54378f,_0x489ba4){_0x489ba4=_0x489ba4||0x1f4;return function(_0x40e95e){logger['error'](_0x40e95e[_0xd59d('0x2a')]);if(_0x40e95e[_0xd59d('0x2b')]){delete _0x40e95e['name'];}_0x54378f[_0xd59d('0x1c')](_0x489ba4)[_0xd59d('0x2c')](_0x40e95e);};}exports[_0xd59d('0x2d')]=function(_0x13bc5f,_0xd9f8f1){var _0x31002a={},_0xd4600d={},_0x473b3f={'count':0x0,'rows':[]};var _0x422f14=_['map'](db[_0xd59d('0x2e')][_0xd59d('0x2f')],function(_0x2dcd1e){return{'name':_0x2dcd1e['fieldName'],'type':_0x2dcd1e[_0xd59d('0x30')][_0xd59d('0x31')]};});_0xd4600d[_0xd59d('0x32')]=_['map'](_0x422f14,_0xd59d('0x2b'));_0xd4600d[_0xd59d('0x33')]=_[_0xd59d('0x34')](_0x13bc5f[_0xd59d('0x33')]);_0xd4600d[_0xd59d('0x35')]=_[_0xd59d('0x36')](_0xd4600d['model'],_0xd4600d['query']);_0x31002a[_0xd59d('0x37')]=_[_0xd59d('0x36')](_0xd4600d['model'],qs[_0xd59d('0x38')](_0x13bc5f[_0xd59d('0x33')][_0xd59d('0x38')]));_0x31002a[_0xd59d('0x37')]=_0x31002a['attributes'][_0xd59d('0x39')]?_0x31002a[_0xd59d('0x37')]:_0xd4600d[_0xd59d('0x32')];if(!_0x13bc5f[_0xd59d('0x33')][_0xd59d('0x3a')](_0xd59d('0x3b'))){_0x31002a[_0xd59d('0x21')]=qs['limit'](_0x13bc5f['query'][_0xd59d('0x21')]);_0x31002a[_0xd59d('0x1f')]=qs[_0xd59d('0x1f')](_0x13bc5f[_0xd59d('0x33')][_0xd59d('0x1f')]);}_0x31002a[_0xd59d('0x3c')]=qs[_0xd59d('0x3d')](_0x13bc5f[_0xd59d('0x33')]['sort']);_0x31002a['where']=qs[_0xd59d('0x35')](_[_0xd59d('0x3e')](_0x13bc5f['query'],_0xd4600d[_0xd59d('0x35')]),_0x422f14);if(_0x13bc5f[_0xd59d('0x33')][_0xd59d('0x3f')]){_0x31002a[_0xd59d('0x40')]=_[_0xd59d('0x41')](_0x31002a['where'],{'$or':_['map'](_0x422f14,function(_0x3a5833){if(_0x3a5833[_0xd59d('0x30')]!==_0xd59d('0x42')){var _0x3c0e00={};_0x3c0e00[_0x3a5833['name']]={'$like':'%'+_0x13bc5f[_0xd59d('0x33')][_0xd59d('0x3f')]+'%'};return _0x3c0e00;}})});}_0x31002a=_[_0xd59d('0x41')]({},_0x31002a,_0x13bc5f[_0xd59d('0x43')]);var _0x347273={'where':_0x31002a[_0xd59d('0x40')]};return db[_0xd59d('0x2e')]['count'](_0x347273)[_0xd59d('0x28')](function(_0x26e0c4){_0x473b3f[_0xd59d('0x22')]=_0x26e0c4;if(_0x13bc5f['query'][_0xd59d('0x44')]){_0x31002a['include']=[{'all':!![]}];}return db[_0xd59d('0x2e')][_0xd59d('0x45')](_0x31002a);})['then'](function(_0x33f8bd){_0x473b3f[_0xd59d('0x46')]=_0x33f8bd;return _0x473b3f;})[_0xd59d('0x28')](respondWithFilteredResult(_0xd9f8f1,_0x31002a))['catch'](handleError(_0xd9f8f1,null));};exports[_0xd59d('0x47')]=function(_0x4a364b,_0x3b71fb){var _0x382be2={'raw':![],'where':{'id':_0x4a364b[_0xd59d('0x48')]['id']}},_0x2cf27={};_0x2cf27[_0xd59d('0x32')]=_[_0xd59d('0x34')](db[_0xd59d('0x2e')][_0xd59d('0x2f')]);_0x2cf27['query']=_[_0xd59d('0x34')](_0x4a364b[_0xd59d('0x33')]);_0x2cf27[_0xd59d('0x35')]=_[_0xd59d('0x36')](_0x2cf27[_0xd59d('0x32')],_0x2cf27['query']);_0x382be2[_0xd59d('0x37')]=_[_0xd59d('0x36')](_0x2cf27[_0xd59d('0x32')],qs[_0xd59d('0x38')](_0x4a364b[_0xd59d('0x33')][_0xd59d('0x38')]));_0x382be2[_0xd59d('0x37')]=_0x382be2[_0xd59d('0x37')][_0xd59d('0x39')]?_0x382be2[_0xd59d('0x37')]:_0x2cf27[_0xd59d('0x32')];if(_0x4a364b['query'][_0xd59d('0x44')]){_0x382be2['include']=[{'all':!![]}];}_0x382be2=_[_0xd59d('0x41')]({},_0x382be2,_0x4a364b[_0xd59d('0x43')]);return db['VoiceQueueReport'][_0xd59d('0x49')](_0x382be2)['then'](handleEntityNotFound(_0x3b71fb,null))['then'](respondWithResult(_0x3b71fb,null))[_0xd59d('0x4a')](handleError(_0x3b71fb,null));};exports['create']=function(_0x15bc55,_0x34417a){return db[_0xd59d('0x2e')][_0xd59d('0x4b')](_0x15bc55[_0xd59d('0x4c')],{})['then'](respondWithResult(_0x34417a,0xc9))[_0xd59d('0x4a')](handleError(_0x34417a,null));};exports[_0xd59d('0x27')]=function(_0x1b6620,_0x1ed444){if(_0x1b6620[_0xd59d('0x4c')]['id']){delete _0x1b6620[_0xd59d('0x4c')]['id'];}return db[_0xd59d('0x2e')]['find']({'where':{'id':_0x1b6620[_0xd59d('0x48')]['id']}})[_0xd59d('0x28')](handleEntityNotFound(_0x1ed444,null))['then'](saveUpdates(_0x1b6620[_0xd59d('0x4c')],null))[_0xd59d('0x28')](respondWithResult(_0x1ed444,null))[_0xd59d('0x4a')](handleError(_0x1ed444,null));};exports[_0xd59d('0x29')]=function(_0x5aeb1a,_0x151600){return db[_0xd59d('0x2e')][_0xd59d('0x49')]({'where':{'id':_0x5aeb1a[_0xd59d('0x48')]['id']}})['then'](handleEntityNotFound(_0x151600,null))[_0xd59d('0x28')](removeEntity(_0x151600,null))[_0xd59d('0x4a')](handleError(_0x151600,null));};exports[_0xd59d('0x4d')]=function(_0x394e19,_0xaf39ce){return db[_0xd59d('0x2e')][_0xd59d('0x4d')]()['then'](respondWithResult(_0xaf39ce,null))[_0xd59d('0x4a')](handleError(_0xaf39ce,null));};exports['getVoiceQueuesReport']=function(_0x5b701f,_0x49ab69){var _0x2dad80={},_0x46e56d={},_0x3e9a7c={'count':0x0,'rows':[]};_0x46e56d[_0xd59d('0x32')]=_['keys'](db['VoiceQueueReport'][_0xd59d('0x2f')]);_0x46e56d['query']=_[_0xd59d('0x34')](_0x5b701f[_0xd59d('0x33')]);_0x46e56d['filters']=_[_0xd59d('0x36')](_0x46e56d['model'],_0x46e56d[_0xd59d('0x33')]);_0x2dad80['attributes']=_[_0xd59d('0x36')](_0x46e56d[_0xd59d('0x32')],qs[_0xd59d('0x38')](_0x5b701f[_0xd59d('0x33')][_0xd59d('0x38')]));_0x2dad80[_0xd59d('0x37')]=_0x2dad80['attributes']['length']?_0x2dad80['attributes']:_0x46e56d[_0xd59d('0x32')];if(!_0x5b701f[_0xd59d('0x33')][_0xd59d('0x3a')](_0xd59d('0x3b'))){_0x2dad80[_0xd59d('0x21')]=qs['limit'](_0x5b701f['query']['limit']);_0x2dad80['offset']=qs[_0xd59d('0x1f')](_0x5b701f[_0xd59d('0x33')]['offset']);}_0x2dad80['order']=qs[_0xd59d('0x3d')](_0x5b701f['query'][_0xd59d('0x3d')]);_0x2dad80[_0xd59d('0x40')]=qs['filters'](_[_0xd59d('0x3e')](_0x5b701f[_0xd59d('0x33')],_0x46e56d[_0xd59d('0x35')]));if(_0x5b701f['query']['filter']){_0x2dad80[_0xd59d('0x40')]=_[_0xd59d('0x41')](_0x2dad80[_0xd59d('0x40')],{'$or':_['map'](_0x2dad80[_0xd59d('0x37')],function(_0x719c95){var _0x594518={};_0x594518[_0x719c95]={'$like':'%'+_0x5b701f[_0xd59d('0x33')][_0xd59d('0x3f')]+'%'};return _0x594518;})});}_0x2dad80=_['merge']({},_0x2dad80,_0x5b701f[_0xd59d('0x43')]);var _0x225203={'where':_0x2dad80['where']};return db['VoiceQueueReport'][_0xd59d('0x22')](_0x225203)[_0xd59d('0x28')](function(_0x274abb){_0x3e9a7c[_0xd59d('0x22')]=_0x274abb;if(_0x5b701f[_0xd59d('0x33')][_0xd59d('0x44')]){_0x2dad80[_0xd59d('0x4e')]=[{'all':!![]}];}return db[_0xd59d('0x2e')][_0xd59d('0x45')](_0x2dad80);})[_0xd59d('0x28')](function(_0x5f5828){_0x3e9a7c[_0xd59d('0x46')]=_0x5f5828;return _0x3e9a7c;})[_0xd59d('0x28')](respondWithFilteredResult(_0x49ab69,_0x2dad80,_0xd59d('0x4f')))[_0xd59d('0x4a')](handleError(_0x49ab69,null,_0xd59d('0x4f')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 4b259a9..31e5813 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 _0x3fc1=['setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x27af08,_0x192c31){var _0x49eb8e=function(_0x249b6b){while(--_0x249b6b){_0x27af08['push'](_0x27af08['shift']());}};_0x49eb8e(++_0x192c31);}(_0x3fc1,0x1a4));var _0x13fc=function(_0x42f590,_0x4b007b){_0x42f590=_0x42f590-0x0;var _0x2bae60=_0x3fc1[_0x42f590];return _0x2bae60;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x13fc('0x0')](0x0);var events={'afterCreate':_0x13fc('0x1'),'afterUpdate':'update','afterDestroy':_0x13fc('0x2')};function emitEvent(_0x309018){return function(_0x32112e,_0x1210a2,_0x2593f1){VoiceQueueReportEvents[_0x13fc('0x3')](_0x309018+':'+_0x32112e['id'],_0x32112e);VoiceQueueReportEvents[_0x13fc('0x3')](_0x309018,_0x32112e);_0x2593f1(null);};}for(var e in events){if(events[_0x13fc('0x4')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x13fc('0x5')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xe1bc=['hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xe1bc,0x1c4));var _0xce1b=function(_0x482ad8,_0x4ba333){_0x482ad8=_0x482ad8-0x0;var _0x37ba0a=_0xe1bc[_0x482ad8];return _0x37ba0a;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xce1b('0x0'))['db'][_0xce1b('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xce1b('0x2')](0x0);var events={'afterCreate':_0xce1b('0x3'),'afterUpdate':_0xce1b('0x4'),'afterDestroy':_0xce1b('0x5')};function emitEvent(_0x68d58e){return function(_0x1c1af5,_0x103a05,_0x53a03a){VoiceQueueReportEvents[_0xce1b('0x6')](_0x68d58e+':'+_0x1c1af5['id'],_0x1c1af5);VoiceQueueReportEvents['emit'](_0x68d58e,_0x1c1af5);_0x53a03a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xce1b('0x7')](e,emitEvent(event));}}module[_0xce1b('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 72c31e2..77aab04 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 _0xf84e=['report_queue','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','exports','define'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf84e,0xa7));var _0xef84=function(_0x52020e,_0x940e91){_0x52020e=_0x52020e-0x0;var _0x34e724=_0xf84e[_0x52020e];return _0x34e724;};'use strict';var _=require(_0xef84('0x0'));var util=require(_0xef84('0x1'));var logger=require(_0xef84('0x2'))(_0xef84('0x3'));var moment=require(_0xef84('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xef84('0x5'));var rimraf=require(_0xef84('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0xef84('0x7')]=function(_0x552246,_0x37ea11){return _0x552246[_0xef84('0x8')]('VoiceQueueReport',attributes,{'tableName':_0xef84('0x9'),'paranoid':![],'indexes':[{'fields':[_0xef84('0xa')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7299=['calleridnum','util','api','moment','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid'];(function(_0xe182dc,_0x334fb5){var _0x2da80b=function(_0x41579e){while(--_0x41579e){_0xe182dc['push'](_0xe182dc['shift']());}};_0x2da80b(++_0x334fb5);}(_0x7299,0x115));var _0x9729=function(_0x6d3149,_0x2ab43d){_0x6d3149=_0x6d3149-0x0;var _0x3b0b6d=_0x7299[_0x6d3149];return _0x3b0b6d;};'use strict';var _=require('lodash');var util=require(_0x9729('0x0'));var logger=require('../../config/logger')(_0x9729('0x1'));var moment=require(_0x9729('0x2'));var BPromise=require('bluebird');var rp=require(_0x9729('0x3'));var fs=require('fs');var path=require(_0x9729('0x4'));var rimraf=require('rimraf');var config=require(_0x9729('0x5'));var attributes=require(_0x9729('0x6'));module[_0x9729('0x7')]=function(_0x3539ff,_0x4a772d){return _0x3539ff[_0x9729('0x8')](_0x9729('0x9'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x9729('0xa')]},{'fields':[_0x9729('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index b7b93be..7254d75 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 _0x9a77=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','VoiceQueueReport','findAll','raw','options','where','attributes','limit','include','model','then','GetVoiceQueueReport','catch','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x172581,_0x1c2351){var _0x4b10a9=function(_0x457380){while(--_0x457380){_0x172581['push'](_0x172581['shift']());}};_0x4b10a9(++_0x1c2351);}(_0x9a77,0x194));var _0x79a7=function(_0x28e9b9,_0x525950){_0x28e9b9=_0x28e9b9-0x0;var _0x145f6c=_0x9a77[_0x28e9b9];return _0x145f6c;};'use strict';var _=require(_0x79a7('0x0'));var util=require(_0x79a7('0x1'));var moment=require(_0x79a7('0x2'));var BPromise=require(_0x79a7('0x3'));var rs=require(_0x79a7('0x4'));var fs=require('fs');var Redis=require(_0x79a7('0x5'));var db=require(_0x79a7('0x6'))['db'];var utils=require(_0x79a7('0x7'));var logger=require('../../config/logger')(_0x79a7('0x8'));var config=require(_0x79a7('0x9'));var jayson=require(_0x79a7('0xa'));var client=jayson[_0x79a7('0xb')][_0x79a7('0xc')]({'port':0x232a});config[_0x79a7('0xd')]=_[_0x79a7('0xe')](config[_0x79a7('0xd')],{'host':_0x79a7('0xf'),'port':0x18eb});var socket=require(_0x79a7('0x10'))(new Redis(config['redis']));require(_0x79a7('0x11'))[_0x79a7('0x12')](socket);function respondWithRpcPromise(_0x516ad0,_0x2a9694,_0x16ae52){return new BPromise(function(_0x4a37c9,_0x4cc8ce){return client[_0x79a7('0x13')](_0x516ad0,_0x16ae52)['then'](function(_0x40dc17){logger['info'](_0x79a7('0x14'),_0x2a9694,_0x79a7('0x15'));logger[_0x79a7('0x16')](_0x79a7('0x17'),_0x2a9694,'request\x20sent',JSON[_0x79a7('0x18')](_0x40dc17));if(_0x40dc17[_0x79a7('0x19')]){if(_0x40dc17[_0x79a7('0x19')][_0x79a7('0x1a')]===0x1f4){logger[_0x79a7('0x19')]('VoiceQueueReport,\x20%s,\x20%s',_0x2a9694,_0x40dc17['error'][_0x79a7('0x1b')]);return _0x4cc8ce(_0x40dc17[_0x79a7('0x19')][_0x79a7('0x1b')]);}logger[_0x79a7('0x19')](_0x79a7('0x14'),_0x2a9694,_0x40dc17[_0x79a7('0x19')][_0x79a7('0x1b')]);return _0x4a37c9(_0x40dc17['error'][_0x79a7('0x1b')]);}else{logger[_0x79a7('0x1c')](_0x79a7('0x14'),_0x2a9694,_0x79a7('0x15'));_0x4a37c9(_0x40dc17[_0x79a7('0x1d')][_0x79a7('0x1b')]);}})['catch'](function(_0x230a62){logger['error'](_0x79a7('0x14'),_0x2a9694,_0x230a62);_0x4cc8ce(_0x230a62);});});}exports['GetVoiceQueueReport']=function(_0x583380){var _0x5b84fc=this;return new Promise(function(_0x4946cd,_0x2f45c4){return db[_0x79a7('0x1e')][_0x79a7('0x1f')]({'raw':_0x583380['options']?_0x583380['options'][_0x79a7('0x20')]===undefined?!![]:![]:!![],'where':_0x583380[_0x79a7('0x21')]?_0x583380[_0x79a7('0x21')][_0x79a7('0x22')]||null:null,'attributes':_0x583380[_0x79a7('0x21')]?_0x583380[_0x79a7('0x21')][_0x79a7('0x23')]||null:null,'limit':_0x583380[_0x79a7('0x21')]?_0x583380[_0x79a7('0x21')][_0x79a7('0x24')]||null:null,'include':_0x583380[_0x79a7('0x21')]?_0x583380[_0x79a7('0x21')][_0x79a7('0x25')]?_['map'](_0x583380[_0x79a7('0x21')]['include'],function(_0xde6e76){return{'model':db[_0xde6e76[_0x79a7('0x26')]],'as':_0xde6e76['as'],'attributes':_0xde6e76[_0x79a7('0x23')],'include':_0xde6e76[_0x79a7('0x25')]?_['map'](_0xde6e76[_0x79a7('0x25')],function(_0x6044d1){return{'model':db[_0x6044d1['model']],'as':_0x6044d1['as'],'attributes':_0x6044d1[_0x79a7('0x23')],'include':_0x6044d1['include']?_['map'](_0x6044d1[_0x79a7('0x25')],function(_0x5c0785){return{'model':db[_0x5c0785[_0x79a7('0x26')]],'as':_0x5c0785['as'],'attributes':_0x5c0785[_0x79a7('0x23')]};}):[]};}):[]};}):[]:[]})[_0x79a7('0x27')](function(_0x55e90a){logger[_0x79a7('0x1c')](_0x79a7('0x28'),_0x583380);logger[_0x79a7('0x16')]('GetVoiceQueueReport',_0x583380,JSON[_0x79a7('0x18')](_0x55e90a));_0x4946cd(_0x55e90a);})[_0x79a7('0x29')](function(_0x1dc76c){logger[_0x79a7('0x19')]('GetVoiceQueueReport',_0x1dc76c[_0x79a7('0x1b')],_0x583380);_0x2f45c4(_0x5b84fc[_0x79a7('0x19')](0x1f4,_0x1dc76c['message']));});});};exports[_0x79a7('0x2a')]=function(_0x115425){var _0x50b70e=this;return new Promise(function(_0xe69d94,_0xb5cf3e){return db[_0x79a7('0x1e')]['create'](_0x115425[_0x79a7('0x2b')],{'raw':_0x115425[_0x79a7('0x21')]?_0x115425[_0x79a7('0x21')][_0x79a7('0x20')]===undefined?!![]:![]:!![]})[_0x79a7('0x27')](function(_0x31cca7){logger[_0x79a7('0x1c')]('CreateVoiceQueueReport',_0x115425);logger[_0x79a7('0x16')](_0x79a7('0x2a'),_0x115425,JSON['stringify'](_0x31cca7));_0xe69d94(_0x31cca7);})[_0x79a7('0x29')](function(_0xe9763d){logger[_0x79a7('0x19')](_0x79a7('0x2a'),_0xe9763d[_0x79a7('0x1b')],_0x115425);_0xb5cf3e(_0x50b70e[_0x79a7('0x19')](0x1f4,_0xe9763d[_0x79a7('0x1b')]));});});};exports[_0x79a7('0x2c')]=function(_0x25e3fe){var _0x1e5c1f=this;return new Promise(function(_0x44b4a7,_0x590226){return db['VoiceQueueReport'][_0x79a7('0x2d')](_0x25e3fe[_0x79a7('0x2b')],{'raw':_0x25e3fe[_0x79a7('0x21')]?_0x25e3fe[_0x79a7('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25e3fe[_0x79a7('0x21')]?_0x25e3fe[_0x79a7('0x21')]['where']||null:null,'attributes':_0x25e3fe[_0x79a7('0x21')]?_0x25e3fe[_0x79a7('0x21')]['attributes']||null:null,'limit':_0x25e3fe[_0x79a7('0x21')]?_0x25e3fe['options'][_0x79a7('0x24')]||null:null})['then'](function(_0x1b90bb){logger[_0x79a7('0x1c')]('UpdateVoiceQueueReport',_0x25e3fe);logger[_0x79a7('0x16')]('UpdateVoiceQueueReport',_0x25e3fe,JSON[_0x79a7('0x18')](_0x1b90bb));_0x44b4a7(_0x1b90bb);})[_0x79a7('0x29')](function(_0x36b70e){logger[_0x79a7('0x19')](_0x79a7('0x2c'),_0x36b70e[_0x79a7('0x1b')],_0x25e3fe);_0x590226(_0x1e5c1f[_0x79a7('0x19')](0x1f4,_0x36b70e['message']));});});}; \ No newline at end of file +var _0x05fa=['request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model','map','info','catch','CreateVoiceQueueReport','VoiceQueueReport','body','update','UpdateVoiceQueueReport','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./voiceQueueReport.socket'];(function(_0x16f713,_0x244997){var _0x53ba69=function(_0x361daf){while(--_0x361daf){_0x16f713['push'](_0x16f713['shift']());}};_0x53ba69(++_0x244997);}(_0x05fa,0xe3));var _0xa05f=function(_0xa30bad,_0x40e784){_0xa30bad=_0xa30bad-0x0;var _0x118bd3=_0x05fa[_0xa30bad];return _0x118bd3;};'use strict';var _=require('lodash');var util=require(_0xa05f('0x0'));var moment=require(_0xa05f('0x1'));var BPromise=require(_0xa05f('0x2'));var rs=require(_0xa05f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa05f('0x4'));var logger=require(_0xa05f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa05f('0x6'));var client=jayson[_0xa05f('0x7')][_0xa05f('0x8')]({'port':0x232a});config[_0xa05f('0x9')]=_[_0xa05f('0xa')](config[_0xa05f('0x9')],{'host':_0xa05f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa05f('0x9')]));require(_0xa05f('0xc'))['register'](socket);function respondWithRpcPromise(_0x502ddb,_0x5b9d5a,_0x2f68dc){return new BPromise(function(_0x3cb47d,_0xb3c35e){return client[_0xa05f('0xd')](_0x502ddb,_0x2f68dc)[_0xa05f('0xe')](function(_0x145b4a){logger['info'](_0xa05f('0xf'),_0x5b9d5a,_0xa05f('0x10'));logger[_0xa05f('0x11')](_0xa05f('0x12'),_0x5b9d5a,'request\x20sent',JSON[_0xa05f('0x13')](_0x145b4a));if(_0x145b4a[_0xa05f('0x14')]){if(_0x145b4a[_0xa05f('0x14')]['code']===0x1f4){logger[_0xa05f('0x14')](_0xa05f('0xf'),_0x5b9d5a,_0x145b4a[_0xa05f('0x14')]['message']);return _0xb3c35e(_0x145b4a[_0xa05f('0x14')][_0xa05f('0x15')]);}logger['error'](_0xa05f('0xf'),_0x5b9d5a,_0x145b4a[_0xa05f('0x14')]['message']);return _0x3cb47d(_0x145b4a['error']['message']);}else{logger['info'](_0xa05f('0xf'),_0x5b9d5a,'request\x20sent');_0x3cb47d(_0x145b4a[_0xa05f('0x16')][_0xa05f('0x15')]);}})['catch'](function(_0x4c182f){logger[_0xa05f('0x14')](_0xa05f('0xf'),_0x5b9d5a,_0x4c182f);_0xb3c35e(_0x4c182f);});});}exports[_0xa05f('0x17')]=function(_0x46244e){var _0x2b5ae7=this;return new Promise(function(_0xb854ea,_0x39ae8a){return db['VoiceQueueReport'][_0xa05f('0x18')]({'raw':_0x46244e[_0xa05f('0x19')]?_0x46244e['options'][_0xa05f('0x1a')]===undefined?!![]:![]:!![],'where':_0x46244e[_0xa05f('0x19')]?_0x46244e['options'][_0xa05f('0x1b')]||null:null,'attributes':_0x46244e[_0xa05f('0x19')]?_0x46244e[_0xa05f('0x19')][_0xa05f('0x1c')]||null:null,'limit':_0x46244e[_0xa05f('0x19')]?_0x46244e[_0xa05f('0x19')][_0xa05f('0x1d')]||null:null,'include':_0x46244e[_0xa05f('0x19')]?_0x46244e[_0xa05f('0x19')]['include']?_['map'](_0x46244e[_0xa05f('0x19')][_0xa05f('0x1e')],function(_0xd7c731){return{'model':db[_0xd7c731[_0xa05f('0x1f')]],'as':_0xd7c731['as'],'attributes':_0xd7c731[_0xa05f('0x1c')],'include':_0xd7c731[_0xa05f('0x1e')]?_[_0xa05f('0x20')](_0xd7c731[_0xa05f('0x1e')],function(_0x19e03d){return{'model':db[_0x19e03d[_0xa05f('0x1f')]],'as':_0x19e03d['as'],'attributes':_0x19e03d[_0xa05f('0x1c')],'include':_0x19e03d[_0xa05f('0x1e')]?_['map'](_0x19e03d[_0xa05f('0x1e')],function(_0x5ef620){return{'model':db[_0x5ef620[_0xa05f('0x1f')]],'as':_0x5ef620['as'],'attributes':_0x5ef620[_0xa05f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa05f('0xe')](function(_0x426a16){logger[_0xa05f('0x21')](_0xa05f('0x17'),_0x46244e);logger['debug']('GetVoiceQueueReport',_0x46244e,JSON[_0xa05f('0x13')](_0x426a16));_0xb854ea(_0x426a16);})[_0xa05f('0x22')](function(_0x930498){logger[_0xa05f('0x14')](_0xa05f('0x17'),_0x930498[_0xa05f('0x15')],_0x46244e);_0x39ae8a(_0x2b5ae7[_0xa05f('0x14')](0x1f4,_0x930498[_0xa05f('0x15')]));});});};exports[_0xa05f('0x23')]=function(_0x5893e0){var _0x205d55=this;return new Promise(function(_0x2c3a87,_0x1bcc33){return db[_0xa05f('0x24')]['create'](_0x5893e0[_0xa05f('0x25')],{'raw':_0x5893e0[_0xa05f('0x19')]?_0x5893e0['options'][_0xa05f('0x1a')]===undefined?!![]:![]:!![]})[_0xa05f('0xe')](function(_0x4f1c9e){logger[_0xa05f('0x21')]('CreateVoiceQueueReport',_0x5893e0);logger[_0xa05f('0x11')]('CreateVoiceQueueReport',_0x5893e0,JSON[_0xa05f('0x13')](_0x4f1c9e));_0x2c3a87(_0x4f1c9e);})[_0xa05f('0x22')](function(_0xb9101d){logger[_0xa05f('0x14')](_0xa05f('0x23'),_0xb9101d[_0xa05f('0x15')],_0x5893e0);_0x1bcc33(_0x205d55[_0xa05f('0x14')](0x1f4,_0xb9101d[_0xa05f('0x15')]));});});};exports['UpdateVoiceQueueReport']=function(_0x5db142){var _0x4568ae=this;return new Promise(function(_0x3b73af,_0x967db1){return db[_0xa05f('0x24')][_0xa05f('0x26')](_0x5db142['body'],{'raw':_0x5db142[_0xa05f('0x19')]?_0x5db142[_0xa05f('0x19')][_0xa05f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5db142['options']?_0x5db142[_0xa05f('0x19')][_0xa05f('0x1b')]||null:null,'attributes':_0x5db142['options']?_0x5db142[_0xa05f('0x19')][_0xa05f('0x1c')]||null:null,'limit':_0x5db142['options']?_0x5db142[_0xa05f('0x19')]['limit']||null:null})[_0xa05f('0xe')](function(_0x1377e6){logger[_0xa05f('0x21')](_0xa05f('0x27'),_0x5db142);logger['debug'](_0xa05f('0x27'),_0x5db142,JSON[_0xa05f('0x13')](_0x1377e6));_0x3b73af(_0x1377e6);})[_0xa05f('0x22')](function(_0x152665){logger[_0xa05f('0x14')](_0xa05f('0x27'),_0x152665[_0xa05f('0x15')],_0x5db142);_0x967db1(_0x4568ae[_0xa05f('0x14')](0x1f4,_0x152665['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 0156d45..9394882 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 _0xf50a=['save','update','emit','removeListener','length'];(function(_0x1c115f,_0x1f443e){var _0x3c22f8=function(_0x22a953){while(--_0x22a953){_0x1c115f['push'](_0x1c115f['shift']());}};_0x3c22f8(++_0x1f443e);}(_0xf50a,0x1b8));var _0xaf50=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0xf50a[_0x5f0501];return _0x3c2c45;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xaf50('0x0'),'remove',_0xaf50('0x1')];function createListener(_0x50d2b3,_0x25c2a0){return function(_0x44ebdd){_0x25c2a0[_0xaf50('0x2')](_0x50d2b3,_0x44ebdd);};}function removeListener(_0x570778,_0x3db96b){return function(){VoiceQueueReportEvents[_0xaf50('0x3')](_0x570778,_0x3db96b);};}exports['register']=function(_0x6b142f){for(var _0x55abcd=0x0,_0x2b8805=events[_0xaf50('0x4')];_0x55abcd<_0x2b8805;_0x55abcd++){var _0x1d9247=events[_0x55abcd];var _0x28375f=createListener('voiceQueueReport:'+_0x1d9247,_0x6b142f);VoiceQueueReportEvents['on'](_0x1d9247,_0x28375f);}}; \ No newline at end of file +var _0xfb82=['save','remove','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x1e8b1e,_0x407bbd){var _0x4a0fde=function(_0x4fd2be){while(--_0x4fd2be){_0x1e8b1e['push'](_0x1e8b1e['shift']());}};_0x4a0fde(++_0x407bbd);}(_0xfb82,0x17f));var _0x2fb8=function(_0x35b983,_0x1ddbea){_0x35b983=_0x35b983-0x0;var _0x5d2b1a=_0xfb82[_0x35b983];return _0x5d2b1a;};'use strict';var VoiceQueueReportEvents=require(_0x2fb8('0x0'));var events=[_0x2fb8('0x1'),_0x2fb8('0x2'),'update'];function createListener(_0x316a4d,_0x1b6abc){return function(_0x50aa53){_0x1b6abc[_0x2fb8('0x3')](_0x316a4d,_0x50aa53);};}function removeListener(_0x8d8257,_0x34535f){return function(){VoiceQueueReportEvents[_0x2fb8('0x4')](_0x8d8257,_0x34535f);};}exports[_0x2fb8('0x5')]=function(_0xe9a5b5){for(var _0x3e6900=0x0,_0x8ede42=events[_0x2fb8('0x6')];_0x3e6900<_0x8ede42;_0x3e6900++){var _0x1f7575=events[_0x3e6900];var _0x5d58fa=createListener(_0x2fb8('0x7')+_0x1f7575,_0xe9a5b5);VoiceQueueReportEvents['on'](_0x1f7575,_0x5d58fa);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index e2833a8..91d99f9 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 _0x674a=['index','show','post','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x674a,0x1a0));var _0xa674=function(_0x3fd6fb,_0x57bed0){_0x3fd6fb=_0x3fd6fb-0x0;var _0x203b3f=_0x674a[_0x3fd6fb];return _0x203b3f;};'use strict';var multer=require(_0xa674('0x0'));var util=require('util');var path=require(_0xa674('0x1'));var timeout=require(_0xa674('0x2'));var express=require(_0xa674('0x3'));var router=express['Router']();var fs_extra=require(_0xa674('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa674('0x5'));var config=require(_0xa674('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0xa674('0x7')]('/',auth[_0xa674('0x8')](),controller[_0xa674('0x9')]);router[_0xa674('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xa674('0xa')]);router[_0xa674('0xb')]('/',auth[_0xa674('0x8')](),controller['create']);router[_0xa674('0xc')](_0xa674('0xd'),auth[_0xa674('0x8')](),controller[_0xa674('0xe')]);router[_0xa674('0xf')](_0xa674('0xd'),auth[_0xa674('0x8')](),controller[_0xa674('0x10')]);module['exports']=router; \ No newline at end of file +var _0x168b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x315b6c,_0x2ac37f){var _0x94dc8=function(_0x24bb2e){while(--_0x24bb2e){_0x315b6c['push'](_0x315b6c['shift']());}};_0x94dc8(++_0x2ac37f);}(_0x168b,0x9b));var _0xb168=function(_0x2a747c,_0x23e7a0){_0x2a747c=_0x2a747c-0x0;var _0x298e92=_0x168b[_0x2a747c];return _0x298e92;};'use strict';var multer=require(_0xb168('0x0'));var util=require(_0xb168('0x1'));var path=require(_0xb168('0x2'));var timeout=require('connect-timeout');var express=require(_0xb168('0x3'));var router=express[_0xb168('0x4')]();var fs_extra=require(_0xb168('0x5'));var auth=require(_0xb168('0x6'));var interaction=require(_0xb168('0x7'));var config=require(_0xb168('0x8'));var controller=require('./voiceQueuesLog.controller');router[_0xb168('0x9')]('/',auth[_0xb168('0xa')](),controller[_0xb168('0xb')]);router['get'](_0xb168('0xc'),auth[_0xb168('0xa')](),controller[_0xb168('0xd')]);router[_0xb168('0xe')]('/',auth[_0xb168('0xa')](),controller[_0xb168('0xf')]);router[_0xb168('0x10')](_0xb168('0xc'),auth[_0xb168('0xa')](),controller[_0xb168('0x11')]);router[_0xb168('0x12')](_0xb168('0xc'),auth[_0xb168('0xa')](),controller['destroy']);module[_0xb168('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 0225f46..6561db1 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 _0x1857=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING','DATE'];(function(_0x4d5aba,_0x1516cd){var _0x4c6eb3=function(_0x2e4d5b){while(--_0x2e4d5b){_0x4d5aba['push'](_0x4d5aba['shift']());}};_0x4c6eb3(++_0x1516cd);}(_0x1857,0x8e));var _0x7185=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1857[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x7185('0x0'));var moment=require(_0x7185('0x1'));module[_0x7185('0x2')]={'time':{'type':Sequelize[_0x7185('0x3')]},'callid':{'type':Sequelize[_0x7185('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x7185('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x7185('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x7185('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7185('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x7185('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x7185('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x7185('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x7185('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x7185('0x5')](_0x7185('0x6'))}}; \ No newline at end of file +var _0x0a5d=['STRING','literal','sequelize','exports'];(function(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0x0a5d,0x14a));var _0xd0a5=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x0a5d[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0xd0a5('0x0'));var moment=require('moment');module[_0xd0a5('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xd0a5('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xd0a5('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xd0a5('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xd0a5('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xd0a5('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xd0a5('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd0a5('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xd0a5('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xd0a5('0x3')]('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 61bfa2e..5757faf 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 _0x7028=['attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','stack','name','send','VoiceQueuesLog','fieldName','type','key','map','query','keys','filters','intersection','model','fields'];(function(_0x380168,_0x40546c){var _0x12e86d=function(_0x559ef7){while(--_0x559ef7){_0x380168['push'](_0x380168['shift']());}};_0x12e86d(++_0x40546c);}(_0x7028,0xfb));var _0x8702=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x7028[_0x47a7d0];return _0xb9bd08;};'use strict';var emlformat=require(_0x8702('0x0'));var rimraf=require(_0x8702('0x1'));var zipdir=require(_0x8702('0x2'));var jsonpatch=require(_0x8702('0x3'));var rp=require('request-promise');var moment=require(_0x8702('0x4'));var BPromise=require(_0x8702('0x5'));var Mustache=require(_0x8702('0x6'));var util=require(_0x8702('0x7'));var path=require(_0x8702('0x8'));var sox=require('sox');var csv=require(_0x8702('0x9'));var ejs=require(_0x8702('0xa'));var fs=require('fs');var fs_extra=require(_0x8702('0xb'));var _=require(_0x8702('0xc'));var squel=require(_0x8702('0xd'));var crypto=require(_0x8702('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8702('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8702('0x10'));var Papa=require(_0x8702('0x11'));var Redis=require(_0x8702('0x12'));var authService=require(_0x8702('0x13'));var qs=require(_0x8702('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8702('0x15'));var logger=require(_0x8702('0x16'))(_0x8702('0x17'));var utils=require(_0x8702('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8702('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4257e3,_0x7069f5){_0x7069f5=_0x7069f5||0xcc;return function(_0x3991c0){if(_0x3991c0){return _0x4257e3[_0x8702('0x1a')](_0x7069f5);}return _0x4257e3[_0x8702('0x1b')](_0x7069f5)[_0x8702('0x1c')]();};}function respondWithResult(_0x2d29bb,_0x559e37){_0x559e37=_0x559e37||0xc8;return function(_0x3cbebd){if(_0x3cbebd){return _0x2d29bb['status'](_0x559e37)[_0x8702('0x1d')](_0x3cbebd);}};}function respondWithFilteredResult(_0x178e5b,_0x3db0f3){return function(_0x4555da){if(_0x4555da){var _0x1775b7=typeof _0x3db0f3[_0x8702('0x1e')]===_0x8702('0x1f')&&typeof _0x3db0f3[_0x8702('0x20')]===_0x8702('0x1f');var _0x17fcea=_0x4555da['count'];var _0x1b7eda=_0x1775b7?0x0:_0x3db0f3[_0x8702('0x1e')];var _0x42f190=_0x1775b7?_0x4555da[_0x8702('0x21')]:_0x3db0f3[_0x8702('0x1e')]+_0x3db0f3[_0x8702('0x20')];var _0x20d88f;if(_0x42f190>=_0x17fcea){_0x42f190=_0x17fcea;_0x20d88f=0xc8;}else{_0x20d88f=0xce;}_0x178e5b[_0x8702('0x1b')](_0x20d88f);return _0x178e5b[_0x8702('0x22')](_0x8702('0x23'),_0x1b7eda+'-'+_0x42f190+'/'+_0x17fcea)[_0x8702('0x1d')](_0x4555da);}return null;};}function patchUpdates(_0x122de1){return function(_0x58aa76){try{jsonpatch[_0x8702('0x24')](_0x58aa76,_0x122de1,!![]);}catch(_0x103d5c){return BPromise[_0x8702('0x25')](_0x103d5c);}return _0x58aa76['save']();};}function saveUpdates(_0x1cefe8,_0x4e7ad3){return function(_0x421d5d){if(_0x421d5d){return _0x421d5d['update'](_0x1cefe8)[_0x8702('0x26')](function(_0x11320a){return _0x11320a;});}return null;};}function removeEntity(_0x33c59b,_0x36b061){return function(_0x4822e3){if(_0x4822e3){return _0x4822e3['destroy']()[_0x8702('0x26')](function(){_0x33c59b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x358e93,_0x38e7e6){return function(_0x1daad1){if(!_0x1daad1){_0x358e93[_0x8702('0x1a')](0x194);}return _0x1daad1;};}function handleError(_0x286472,_0x5981b0){_0x5981b0=_0x5981b0||0x1f4;return function(_0x14ae5b){logger['error'](_0x14ae5b[_0x8702('0x27')]);if(_0x14ae5b[_0x8702('0x28')]){delete _0x14ae5b['name'];}_0x286472[_0x8702('0x1b')](_0x5981b0)[_0x8702('0x29')](_0x14ae5b);};}exports['index']=function(_0x4c02ac,_0xa5999f){var _0x21f1d9={},_0x230e09={},_0x19fa86={'count':0x0,'rows':[]};var _0x5316e6=_['map'](db[_0x8702('0x2a')]['rawAttributes'],function(_0x35b6bb){return{'name':_0x35b6bb[_0x8702('0x2b')],'type':_0x35b6bb[_0x8702('0x2c')][_0x8702('0x2d')]};});_0x230e09['model']=_[_0x8702('0x2e')](_0x5316e6,_0x8702('0x28'));_0x230e09[_0x8702('0x2f')]=_[_0x8702('0x30')](_0x4c02ac[_0x8702('0x2f')]);_0x230e09[_0x8702('0x31')]=_[_0x8702('0x32')](_0x230e09['model'],_0x230e09['query']);_0x21f1d9['attributes']=_[_0x8702('0x32')](_0x230e09[_0x8702('0x33')],qs[_0x8702('0x34')](_0x4c02ac[_0x8702('0x2f')][_0x8702('0x34')]));_0x21f1d9[_0x8702('0x35')]=_0x21f1d9['attributes'][_0x8702('0x36')]?_0x21f1d9[_0x8702('0x35')]:_0x230e09[_0x8702('0x33')];if(!_0x4c02ac['query'][_0x8702('0x37')]('nolimit')){_0x21f1d9[_0x8702('0x20')]=qs[_0x8702('0x20')](_0x4c02ac['query']['limit']);_0x21f1d9[_0x8702('0x1e')]=qs[_0x8702('0x1e')](_0x4c02ac[_0x8702('0x2f')][_0x8702('0x1e')]);}_0x21f1d9[_0x8702('0x38')]=qs['sort'](_0x4c02ac['query'][_0x8702('0x39')]);_0x21f1d9[_0x8702('0x3a')]=qs[_0x8702('0x31')](_[_0x8702('0x3b')](_0x4c02ac[_0x8702('0x2f')],_0x230e09[_0x8702('0x31')]),_0x5316e6);if(_0x4c02ac[_0x8702('0x2f')]['filter']){_0x21f1d9[_0x8702('0x3a')]=_[_0x8702('0x3c')](_0x21f1d9[_0x8702('0x3a')],{'$or':_['map'](_0x5316e6,function(_0x310df6){if(_0x310df6[_0x8702('0x2c')]!==_0x8702('0x3d')){var _0x4b6b6e={};_0x4b6b6e[_0x310df6[_0x8702('0x28')]]={'$like':'%'+_0x4c02ac[_0x8702('0x2f')][_0x8702('0x3e')]+'%'};return _0x4b6b6e;}})});}_0x21f1d9=_[_0x8702('0x3c')]({},_0x21f1d9,_0x4c02ac[_0x8702('0x3f')]);var _0x38e952={'where':_0x21f1d9[_0x8702('0x3a')]};return db[_0x8702('0x2a')][_0x8702('0x21')](_0x38e952)['then'](function(_0x39f27f){_0x19fa86[_0x8702('0x21')]=_0x39f27f;if(_0x4c02ac[_0x8702('0x2f')][_0x8702('0x40')]){_0x21f1d9[_0x8702('0x41')]=[{'all':!![]}];}return db[_0x8702('0x2a')]['findAll'](_0x21f1d9);})[_0x8702('0x26')](function(_0x15099c){_0x19fa86[_0x8702('0x42')]=_0x15099c;return _0x19fa86;})['then'](respondWithFilteredResult(_0xa5999f,_0x21f1d9))[_0x8702('0x43')](handleError(_0xa5999f,null));};exports[_0x8702('0x44')]=function(_0x1ede31,_0x4f3b19){var _0x290646={'raw':!![],'where':{'id':_0x1ede31[_0x8702('0x45')]['id']}},_0x44cd28={};_0x44cd28[_0x8702('0x33')]=_[_0x8702('0x30')](db['VoiceQueuesLog'][_0x8702('0x46')]);_0x44cd28[_0x8702('0x2f')]=_['keys'](_0x1ede31[_0x8702('0x2f')]);_0x44cd28[_0x8702('0x31')]=_[_0x8702('0x32')](_0x44cd28[_0x8702('0x33')],_0x44cd28[_0x8702('0x2f')]);_0x290646[_0x8702('0x35')]=_[_0x8702('0x32')](_0x44cd28[_0x8702('0x33')],qs[_0x8702('0x34')](_0x1ede31['query'][_0x8702('0x34')]));_0x290646[_0x8702('0x35')]=_0x290646[_0x8702('0x35')][_0x8702('0x36')]?_0x290646[_0x8702('0x35')]:_0x44cd28['model'];if(_0x1ede31[_0x8702('0x2f')]['includeAll']){_0x290646[_0x8702('0x41')]=[{'all':!![]}];}_0x290646=_['merge']({},_0x290646,_0x1ede31[_0x8702('0x3f')]);return db[_0x8702('0x2a')][_0x8702('0x47')](_0x290646)[_0x8702('0x26')](handleEntityNotFound(_0x4f3b19,null))['then'](respondWithResult(_0x4f3b19,null))[_0x8702('0x43')](handleError(_0x4f3b19,null));};exports[_0x8702('0x48')]=function(_0x10aa4c,_0x3afc3b){return db['VoiceQueuesLog'][_0x8702('0x48')](_0x10aa4c[_0x8702('0x49')],{})[_0x8702('0x26')](respondWithResult(_0x3afc3b,0xc9))[_0x8702('0x43')](handleError(_0x3afc3b,null));};exports[_0x8702('0x4a')]=function(_0x4fedf9,_0x108cad){if(_0x4fedf9[_0x8702('0x49')]['id']){delete _0x4fedf9[_0x8702('0x49')]['id'];}return db[_0x8702('0x2a')]['find']({'where':{'id':_0x4fedf9[_0x8702('0x45')]['id']}})['then'](handleEntityNotFound(_0x108cad,null))[_0x8702('0x26')](saveUpdates(_0x4fedf9[_0x8702('0x49')],null))[_0x8702('0x26')](respondWithResult(_0x108cad,null))[_0x8702('0x43')](handleError(_0x108cad,null));};exports[_0x8702('0x4b')]=function(_0x3dfd00,_0x46ab5f){return db[_0x8702('0x2a')][_0x8702('0x47')]({'where':{'id':_0x3dfd00[_0x8702('0x45')]['id']}})[_0x8702('0x26')](handleEntityNotFound(_0x46ab5f,null))[_0x8702('0x26')](removeEntity(_0x46ab5f,null))[_0x8702('0x43')](handleError(_0x46ab5f,null));}; \ No newline at end of file +var _0x7a03=['keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','model','map'];(function(_0x4d3dda,_0x5c2781){var _0x4ba3c6=function(_0x38b4dd){while(--_0x38b4dd){_0x4d3dda['push'](_0x4d3dda['shift']());}};_0x4ba3c6(++_0x5c2781);}(_0x7a03,0x1c4));var _0x37a0=function(_0x1352ee,_0x3c5421){_0x1352ee=_0x1352ee-0x0;var _0x1d79f5=_0x7a03[_0x1352ee];return _0x1d79f5;};'use strict';var emlformat=require(_0x37a0('0x0'));var rimraf=require(_0x37a0('0x1'));var zipdir=require(_0x37a0('0x2'));var jsonpatch=require(_0x37a0('0x3'));var rp=require('request-promise');var moment=require(_0x37a0('0x4'));var BPromise=require(_0x37a0('0x5'));var Mustache=require(_0x37a0('0x6'));var util=require(_0x37a0('0x7'));var path=require('path');var sox=require(_0x37a0('0x8'));var csv=require(_0x37a0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x37a0('0xa'));var _=require(_0x37a0('0xb'));var squel=require('squel');var crypto=require(_0x37a0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x37a0('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x37a0('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x37a0('0xe'));var as=require(_0x37a0('0xf'));var hardwareService=require(_0x37a0('0x10'));var logger=require('../../config/logger')(_0x37a0('0x11'));var utils=require(_0x37a0('0x12'));var config=require(_0x37a0('0x13'));var licenseUtil=require(_0x37a0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58574c,_0x47301a){_0x47301a=_0x47301a||0xcc;return function(_0x31ad7a){if(_0x31ad7a){return _0x58574c[_0x37a0('0x15')](_0x47301a);}return _0x58574c['status'](_0x47301a)[_0x37a0('0x16')]();};}function respondWithResult(_0x365889,_0x1a010a){_0x1a010a=_0x1a010a||0xc8;return function(_0x5e9cc4){if(_0x5e9cc4){return _0x365889[_0x37a0('0x17')](_0x1a010a)[_0x37a0('0x18')](_0x5e9cc4);}};}function respondWithFilteredResult(_0x346fee,_0x423b0c){return function(_0x36f504){if(_0x36f504){var _0x5200ff=typeof _0x423b0c[_0x37a0('0x19')]===_0x37a0('0x1a')&&typeof _0x423b0c[_0x37a0('0x1b')]===_0x37a0('0x1a');var _0x44facf=_0x36f504['count'];var _0x5a94b3=_0x5200ff?0x0:_0x423b0c[_0x37a0('0x19')];var _0xdb0260=_0x5200ff?_0x36f504[_0x37a0('0x1c')]:_0x423b0c[_0x37a0('0x19')]+_0x423b0c['limit'];var _0x1e1e68;if(_0xdb0260>=_0x44facf){_0xdb0260=_0x44facf;_0x1e1e68=0xc8;}else{_0x1e1e68=0xce;}_0x346fee[_0x37a0('0x17')](_0x1e1e68);return _0x346fee['set'](_0x37a0('0x1d'),_0x5a94b3+'-'+_0xdb0260+'/'+_0x44facf)[_0x37a0('0x18')](_0x36f504);}return null;};}function patchUpdates(_0x31a640){return function(_0x40f036){try{jsonpatch[_0x37a0('0x1e')](_0x40f036,_0x31a640,!![]);}catch(_0x113e84){return BPromise[_0x37a0('0x1f')](_0x113e84);}return _0x40f036[_0x37a0('0x20')]();};}function saveUpdates(_0x406597,_0x2a0c03){return function(_0x512b0a){if(_0x512b0a){return _0x512b0a[_0x37a0('0x21')](_0x406597)[_0x37a0('0x22')](function(_0xc13b49){return _0xc13b49;});}return null;};}function removeEntity(_0x42c3fd,_0x15e5b7){return function(_0x5c2d9c){if(_0x5c2d9c){return _0x5c2d9c[_0x37a0('0x23')]()[_0x37a0('0x22')](function(){_0x42c3fd[_0x37a0('0x17')](0xcc)[_0x37a0('0x16')]();});}};}function handleEntityNotFound(_0x1f335f,_0x36b6c0){return function(_0x2278f8){if(!_0x2278f8){_0x1f335f[_0x37a0('0x15')](0x194);}return _0x2278f8;};}function handleError(_0x2f0409,_0x1a76fe){_0x1a76fe=_0x1a76fe||0x1f4;return function(_0xe52040){logger[_0x37a0('0x24')](_0xe52040[_0x37a0('0x25')]);if(_0xe52040['name']){delete _0xe52040[_0x37a0('0x26')];}_0x2f0409['status'](_0x1a76fe)[_0x37a0('0x27')](_0xe52040);};}exports[_0x37a0('0x28')]=function(_0x4d927f,_0x33e81a){var _0x4b4181={},_0x5ecbef={},_0xe5bf01={'count':0x0,'rows':[]};var _0x496258=_['map'](db[_0x37a0('0x29')][_0x37a0('0x2a')],function(_0x119100){return{'name':_0x119100['fieldName'],'type':_0x119100['type']['key']};});_0x5ecbef[_0x37a0('0x2b')]=_[_0x37a0('0x2c')](_0x496258,_0x37a0('0x26'));_0x5ecbef['query']=_[_0x37a0('0x2d')](_0x4d927f['query']);_0x5ecbef[_0x37a0('0x2e')]=_[_0x37a0('0x2f')](_0x5ecbef[_0x37a0('0x2b')],_0x5ecbef['query']);_0x4b4181[_0x37a0('0x30')]=_[_0x37a0('0x2f')](_0x5ecbef[_0x37a0('0x2b')],qs[_0x37a0('0x31')](_0x4d927f['query']['fields']));_0x4b4181['attributes']=_0x4b4181[_0x37a0('0x30')][_0x37a0('0x32')]?_0x4b4181[_0x37a0('0x30')]:_0x5ecbef['model'];if(!_0x4d927f[_0x37a0('0x33')][_0x37a0('0x34')](_0x37a0('0x35'))){_0x4b4181[_0x37a0('0x1b')]=qs[_0x37a0('0x1b')](_0x4d927f[_0x37a0('0x33')]['limit']);_0x4b4181[_0x37a0('0x19')]=qs[_0x37a0('0x19')](_0x4d927f['query'][_0x37a0('0x19')]);}_0x4b4181[_0x37a0('0x36')]=qs[_0x37a0('0x37')](_0x4d927f['query'][_0x37a0('0x37')]);_0x4b4181[_0x37a0('0x38')]=qs['filters'](_[_0x37a0('0x39')](_0x4d927f[_0x37a0('0x33')],_0x5ecbef[_0x37a0('0x2e')]),_0x496258);if(_0x4d927f[_0x37a0('0x33')]['filter']){_0x4b4181[_0x37a0('0x38')]=_['merge'](_0x4b4181[_0x37a0('0x38')],{'$or':_[_0x37a0('0x2c')](_0x496258,function(_0x3a9919){if(_0x3a9919[_0x37a0('0x3a')]!==_0x37a0('0x3b')){var _0x1c6b3f={};_0x1c6b3f[_0x3a9919[_0x37a0('0x26')]]={'$like':'%'+_0x4d927f[_0x37a0('0x33')]['filter']+'%'};return _0x1c6b3f;}})});}_0x4b4181=_[_0x37a0('0x3c')]({},_0x4b4181,_0x4d927f[_0x37a0('0x3d')]);var _0x493085={'where':_0x4b4181[_0x37a0('0x38')]};return db['VoiceQueuesLog'][_0x37a0('0x1c')](_0x493085)[_0x37a0('0x22')](function(_0xd6e9c8){_0xe5bf01[_0x37a0('0x1c')]=_0xd6e9c8;if(_0x4d927f[_0x37a0('0x33')][_0x37a0('0x3e')]){_0x4b4181[_0x37a0('0x3f')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x37a0('0x40')](_0x4b4181);})['then'](function(_0x23722a){_0xe5bf01['rows']=_0x23722a;return _0xe5bf01;})[_0x37a0('0x22')](respondWithFilteredResult(_0x33e81a,_0x4b4181))['catch'](handleError(_0x33e81a,null));};exports[_0x37a0('0x41')]=function(_0x4e126c,_0x370da6){var _0x5f15f8={'raw':!![],'where':{'id':_0x4e126c[_0x37a0('0x42')]['id']}},_0x43962b={};_0x43962b[_0x37a0('0x2b')]=_[_0x37a0('0x2d')](db['VoiceQueuesLog'][_0x37a0('0x2a')]);_0x43962b['query']=_[_0x37a0('0x2d')](_0x4e126c['query']);_0x43962b[_0x37a0('0x2e')]=_[_0x37a0('0x2f')](_0x43962b[_0x37a0('0x2b')],_0x43962b[_0x37a0('0x33')]);_0x5f15f8['attributes']=_[_0x37a0('0x2f')](_0x43962b['model'],qs[_0x37a0('0x31')](_0x4e126c[_0x37a0('0x33')][_0x37a0('0x31')]));_0x5f15f8[_0x37a0('0x30')]=_0x5f15f8['attributes']['length']?_0x5f15f8[_0x37a0('0x30')]:_0x43962b['model'];if(_0x4e126c[_0x37a0('0x33')][_0x37a0('0x3e')]){_0x5f15f8[_0x37a0('0x3f')]=[{'all':!![]}];}_0x5f15f8=_['merge']({},_0x5f15f8,_0x4e126c[_0x37a0('0x3d')]);return db[_0x37a0('0x29')][_0x37a0('0x43')](_0x5f15f8)[_0x37a0('0x22')](handleEntityNotFound(_0x370da6,null))[_0x37a0('0x22')](respondWithResult(_0x370da6,null))[_0x37a0('0x44')](handleError(_0x370da6,null));};exports[_0x37a0('0x45')]=function(_0x1bc047,_0x1c79fe){return db[_0x37a0('0x29')][_0x37a0('0x45')](_0x1bc047['body'],{})[_0x37a0('0x22')](respondWithResult(_0x1c79fe,0xc9))[_0x37a0('0x44')](handleError(_0x1c79fe,null));};exports[_0x37a0('0x21')]=function(_0x274602,_0x519f84){if(_0x274602[_0x37a0('0x46')]['id']){delete _0x274602[_0x37a0('0x46')]['id'];}return db['VoiceQueuesLog'][_0x37a0('0x43')]({'where':{'id':_0x274602['params']['id']}})[_0x37a0('0x22')](handleEntityNotFound(_0x519f84,null))[_0x37a0('0x22')](saveUpdates(_0x274602['body'],null))[_0x37a0('0x22')](respondWithResult(_0x519f84,null))[_0x37a0('0x44')](handleError(_0x519f84,null));};exports[_0x37a0('0x23')]=function(_0x3ba2f9,_0xacb8b8){return db[_0x37a0('0x29')][_0x37a0('0x43')]({'where':{'id':_0x3ba2f9[_0x37a0('0x42')]['id']}})[_0x37a0('0x22')](handleEntityNotFound(_0xacb8b8,null))[_0x37a0('0x22')](removeEntity(_0xacb8b8,null))['catch'](handleError(_0xacb8b8,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 3156794..5fd9e81 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 _0x7cfe=['bluebird','path','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util','../../config/logger','moment'];(function(_0x3b1177,_0x165b84){var _0x392a15=function(_0x5f72fa){while(--_0x5f72fa){_0x3b1177['push'](_0x3b1177['shift']());}};_0x392a15(++_0x165b84);}(_0x7cfe,0xd9));var _0xe7cf=function(_0x2abd3c,_0xa3f4f5){_0x2abd3c=_0x2abd3c-0x0;var _0xd4f288=_0x7cfe[_0x2abd3c];return _0xd4f288;};'use strict';var _=require(_0xe7cf('0x0'));var util=require(_0xe7cf('0x1'));var logger=require(_0xe7cf('0x2'))('api');var moment=require(_0xe7cf('0x3'));var BPromise=require(_0xe7cf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7cf('0x5'));var rimraf=require('rimraf');var config=require(_0xe7cf('0x6'));var attributes=require('./voiceQueuesLog.attributes');module[_0xe7cf('0x7')]=function(_0x2755fe,_0x330fe6){return _0x2755fe[_0xe7cf('0x8')](_0xe7cf('0x9'),attributes,{'tableName':_0xe7cf('0xa'),'paranoid':![],'indexes':[{'name':_0xe7cf('0xb'),'fields':[_0xe7cf('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x1e72=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','voice_queues_log','event_dtm','event','dtm','lodash'];(function(_0x461015,_0x51cdb6){var _0x14905b=function(_0xeb9dd1){while(--_0xeb9dd1){_0x461015['push'](_0x461015['shift']());}};_0x14905b(++_0x51cdb6);}(_0x1e72,0xe9));var _0x21e7=function(_0x5b7c2c,_0x4c6501){_0x5b7c2c=_0x5b7c2c-0x0;var _0xb12a02=_0x1e72[_0x5b7c2c];return _0xb12a02;};'use strict';var _=require(_0x21e7('0x0'));var util=require(_0x21e7('0x1'));var logger=require(_0x21e7('0x2'))(_0x21e7('0x3'));var moment=require('moment');var BPromise=require(_0x21e7('0x4'));var rp=require(_0x21e7('0x5'));var fs=require('fs');var path=require(_0x21e7('0x6'));var rimraf=require('rimraf');var config=require(_0x21e7('0x7'));var attributes=require(_0x21e7('0x8'));module['exports']=function(_0xfc6936,_0x21f3d9){return _0xfc6936['define']('VoiceQueuesLog',attributes,{'tableName':_0x21e7('0x9'),'paranoid':![],'indexes':[{'name':_0x21e7('0xa'),'fields':[_0x21e7('0xb'),_0x21e7('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 5a994ff..7ed1c13 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 _0xd31c=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x436903,_0x43bf0b){var _0x9e04f3=function(_0x1f5e18){while(--_0x1f5e18){_0x436903['push'](_0x436903['shift']());}};_0x9e04f3(++_0x43bf0b);}(_0xd31c,0xe8));var _0xcd31=function(_0x47a41f,_0x48d92b){_0x47a41f=_0x47a41f-0x0;var _0x2411f5=_0xd31c[_0x47a41f];return _0x2411f5;};'use strict';var _=require(_0xcd31('0x0'));var util=require(_0xcd31('0x1'));var moment=require(_0xcd31('0x2'));var BPromise=require(_0xcd31('0x3'));var rs=require(_0xcd31('0x4'));var fs=require('fs');var Redis=require(_0xcd31('0x5'));var db=require(_0xcd31('0x6'))['db'];var utils=require(_0xcd31('0x7'));var logger=require(_0xcd31('0x8'))(_0xcd31('0x9'));var config=require(_0xcd31('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xcd31('0xb')][_0xcd31('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49ebdb,_0x166e91,_0x1481ee){return new BPromise(function(_0x2d29e4,_0x56ed66){return client[_0xcd31('0xd')](_0x49ebdb,_0x1481ee)[_0xcd31('0xe')](function(_0x5827f6){logger[_0xcd31('0xf')](_0xcd31('0x10'),_0x166e91,_0xcd31('0x11'));logger[_0xcd31('0x12')](_0xcd31('0x13'),_0x166e91,_0xcd31('0x11'),JSON[_0xcd31('0x14')](_0x5827f6));if(_0x5827f6[_0xcd31('0x15')]){if(_0x5827f6['error']['code']===0x1f4){logger[_0xcd31('0x15')](_0xcd31('0x10'),_0x166e91,_0x5827f6[_0xcd31('0x15')][_0xcd31('0x16')]);return _0x56ed66(_0x5827f6[_0xcd31('0x15')][_0xcd31('0x16')]);}logger['error'](_0xcd31('0x10'),_0x166e91,_0x5827f6[_0xcd31('0x15')][_0xcd31('0x16')]);return _0x2d29e4(_0x5827f6[_0xcd31('0x15')]['message']);}else{logger['info'](_0xcd31('0x10'),_0x166e91,'request\x20sent');_0x2d29e4(_0x5827f6[_0xcd31('0x17')]['message']);}})['catch'](function(_0x5b87fd){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x166e91,_0x5b87fd);_0x56ed66(_0x5b87fd);});});} \ No newline at end of file +var _0x1d5c=['../../config/logger','../../config/environment','jayson/promise','http','then','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1d5c,0xeb));var _0xc1d5=function(_0x113cf9,_0x358825){_0x113cf9=_0x113cf9-0x0;var _0x5842ad=_0x1d5c[_0x113cf9];return _0x5842ad;};'use strict';var _=require(_0xc1d5('0x0'));var util=require(_0xc1d5('0x1'));var moment=require(_0xc1d5('0x2'));var BPromise=require(_0xc1d5('0x3'));var rs=require(_0xc1d5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc1d5('0x5'))('rpc');var config=require(_0xc1d5('0x6'));var jayson=require(_0xc1d5('0x7'));var client=jayson['client'][_0xc1d5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40d36b,_0x37892d,_0x190478){return new BPromise(function(_0x254eb2,_0x4f83a9){return client['request'](_0x40d36b,_0x190478)[_0xc1d5('0x9')](function(_0x19f764){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x37892d,_0xc1d5('0xa'));logger[_0xc1d5('0xb')](_0xc1d5('0xc'),_0x37892d,_0xc1d5('0xa'),JSON[_0xc1d5('0xd')](_0x19f764));if(_0x19f764[_0xc1d5('0xe')]){if(_0x19f764[_0xc1d5('0xe')][_0xc1d5('0xf')]===0x1f4){logger[_0xc1d5('0xe')](_0xc1d5('0x10'),_0x37892d,_0x19f764['error'][_0xc1d5('0x11')]);return _0x4f83a9(_0x19f764[_0xc1d5('0xe')]['message']);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x37892d,_0x19f764[_0xc1d5('0xe')][_0xc1d5('0x11')]);return _0x254eb2(_0x19f764['error']['message']);}else{logger['info'](_0xc1d5('0x10'),_0x37892d,_0xc1d5('0xa'));_0x254eb2(_0x19f764[_0xc1d5('0x12')][_0xc1d5('0x11')]);}})[_0xc1d5('0x13')](function(_0x50e2c4){logger['error'](_0xc1d5('0x10'),_0x37892d,_0x50e2c4);_0x4f83a9(_0x50e2c4);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 38ddc44..c4bef57 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 _0xc03a=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/describe','describe','get','/:id','show','download','/:id/downloads','downloads','/:id/transcribe','post','create','put'];(function(_0x25920d,_0x4fbbcc){var _0x2e54ed=function(_0x9222db){while(--_0x9222db){_0x25920d['push'](_0x25920d['shift']());}};_0x2e54ed(++_0x4fbbcc);}(_0xc03a,0x13c));var _0xac03=function(_0x337bd8,_0x274d18){_0x337bd8=_0x337bd8-0x0;var _0x5a44ea=_0xc03a[_0x337bd8];return _0x5a44ea;};'use strict';var multer=require(_0xac03('0x0'));var util=require(_0xac03('0x1'));var path=require('path');var timeout=require(_0xac03('0x2'));var express=require(_0xac03('0x3'));var router=express[_0xac03('0x4')]();var fs_extra=require(_0xac03('0x5'));var auth=require(_0xac03('0x6'));var interaction=require(_0xac03('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router['get']('/',auth[_0xac03('0x8')](),controller[_0xac03('0x9')]);router['get'](_0xac03('0xa'),auth['isAuthenticated'](),controller[_0xac03('0xb')]);router[_0xac03('0xc')](_0xac03('0xd'),auth['isAuthenticated'](),controller[_0xac03('0xe')]);router['get']('/:id/download',auth[_0xac03('0x8')](),controller[_0xac03('0xf')]);router[_0xac03('0xc')](_0xac03('0x10'),controller[_0xac03('0x11')]);router['get'](_0xac03('0x12'),auth[_0xac03('0x8')](),controller['downloadTranscribe']);router[_0xac03('0x13')]('/',auth['isAuthenticated'](),controller[_0xac03('0x14')]);router['post'](_0xac03('0x12'),auth[_0xac03('0x8')](),controller['runTranscribe']);router[_0xac03('0x15')](_0xac03('0xd'),auth[_0xac03('0x8')](),controller[_0xac03('0x16')]);router[_0xac03('0x17')](_0xac03('0xd'),auth[_0xac03('0x8')](),controller[_0xac03('0x18')]);module[_0xac03('0x19')]=router; \ No newline at end of file +var _0xc9cf=['downloadTranscribe','create','post','runTranscribe','put','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe'];(function(_0x46d1ff,_0x4684b8){var _0xd4903f=function(_0x44d722){while(--_0x44d722){_0x46d1ff['push'](_0x46d1ff['shift']());}};_0xd4903f(++_0x4684b8);}(_0xc9cf,0xf6));var _0xfc9c=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0xc9cf[_0xcfeda9];return _0x4826c7;};'use strict';var multer=require(_0xfc9c('0x0'));var util=require(_0xfc9c('0x1'));var path=require(_0xfc9c('0x2'));var timeout=require(_0xfc9c('0x3'));var express=require(_0xfc9c('0x4'));var router=express['Router']();var fs_extra=require(_0xfc9c('0x5'));var auth=require(_0xfc9c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfc9c('0x7'));router[_0xfc9c('0x8')]('/',auth[_0xfc9c('0x9')](),controller['index']);router['get'](_0xfc9c('0xa'),auth[_0xfc9c('0x9')](),controller[_0xfc9c('0xb')]);router[_0xfc9c('0x8')](_0xfc9c('0xc'),auth[_0xfc9c('0x9')](),controller['show']);router['get'](_0xfc9c('0xd'),auth[_0xfc9c('0x9')](),controller[_0xfc9c('0xe')]);router[_0xfc9c('0x8')](_0xfc9c('0xf'),controller[_0xfc9c('0x10')]);router['get'](_0xfc9c('0x11'),auth[_0xfc9c('0x9')](),controller[_0xfc9c('0x12')]);router['post']('/',auth[_0xfc9c('0x9')](),controller[_0xfc9c('0x13')]);router[_0xfc9c('0x14')](_0xfc9c('0x11'),auth[_0xfc9c('0x9')](),controller[_0xfc9c('0x15')]);router[_0xfc9c('0x16')](_0xfc9c('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xfc9c('0x17')](_0xfc9c('0xc'),auth[_0xfc9c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index abf6965..1e003ca 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(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 36412e2..383dd0c 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 _0xeaef=['stack','name','send','index','map','VoiceRecording','rawAttributes','type','model','differenceBy','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','existsSync','filename','extname','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','col','push','$and','secrets','recording','Sequelize','unlink','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','ValidationError','Voice\x20Recording\x20not\x20found','transcribeAccountId','transcribeRegion','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','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0xdbbb14,_0x140263){var _0x3c3585=function(_0x5a4b33){while(--_0x5a4b33){_0xdbbb14['push'](_0xdbbb14['shift']());}};_0x3c3585(++_0x140263);}(_0xeaef,0x10c));var _0xfeae=function(_0x3b3e9a,_0x27d6bf){_0x3b3e9a=_0x3b3e9a-0x0;var _0x4840fc=_0xeaef[_0x3b3e9a];return _0x4840fc;};'use strict';var emlformat=require(_0xfeae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfeae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfeae('0x2'));var moment=require(_0xfeae('0x3'));var BPromise=require(_0xfeae('0x4'));var Mustache=require(_0xfeae('0x5'));var util=require(_0xfeae('0x6'));var path=require('path');var sox=require(_0xfeae('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfeae('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfeae('0x9'));var jsforce=require(_0xfeae('0xa'));var deskjs=require(_0xfeae('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfeae('0xc'));var Papa=require(_0xfeae('0xd'));var AWS=require('aws-sdk');var uuidv4=require(_0xfeae('0xe'));var Redis=require(_0xfeae('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfeae('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfeae('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xfeae('0x12'));var licenseUtil=require(_0xfeae('0x13'));var db=require(_0xfeae('0x14'))['db'];function respondWithStatusCode(_0x36cb6b,_0x2dc32b){_0x2dc32b=_0x2dc32b||0xcc;return function(_0x4f623e){if(_0x4f623e){return _0x36cb6b[_0xfeae('0x15')](_0x2dc32b);}return _0x36cb6b[_0xfeae('0x16')](_0x2dc32b)[_0xfeae('0x17')]();};}function respondWithResult(_0x31a283,_0x1c57f9){_0x1c57f9=_0x1c57f9||0xc8;return function(_0x5dfa8a){if(_0x5dfa8a){return _0x31a283[_0xfeae('0x16')](_0x1c57f9)[_0xfeae('0x18')](_0x5dfa8a);}};}function respondWithFilteredResult(_0x1c7c24,_0x1a63b6){return function(_0x117edf){if(_0x117edf){var _0x2aa957=typeof _0x1a63b6['offset']===_0xfeae('0x19')&&typeof _0x1a63b6['limit']==='undefined';var _0xe213c=_0x117edf[_0xfeae('0x1a')];var _0xde7759=_0x2aa957?0x0:_0x1a63b6[_0xfeae('0x1b')];var _0x3bbaad=_0x2aa957?_0x117edf[_0xfeae('0x1a')]:_0x1a63b6[_0xfeae('0x1b')]+_0x1a63b6[_0xfeae('0x1c')];var _0x5d6593;if(_0x3bbaad>=_0xe213c){_0x3bbaad=_0xe213c;_0x5d6593=0xc8;}else{_0x5d6593=0xce;}_0x1c7c24[_0xfeae('0x16')](_0x5d6593);return _0x1c7c24[_0xfeae('0x1d')](_0xfeae('0x1e'),_0xde7759+'-'+_0x3bbaad+'/'+_0xe213c)[_0xfeae('0x18')](_0x117edf);}return null;};}function patchUpdates(_0x549cb5){return function(_0x8382b5){try{jsonpatch[_0xfeae('0x1f')](_0x8382b5,_0x549cb5,!![]);}catch(_0x527ded){return BPromise[_0xfeae('0x20')](_0x527ded);}return _0x8382b5[_0xfeae('0x21')]();};}function saveUpdates(_0x516673,_0x5e6f3d){return function(_0x3ae842){if(_0x3ae842){return _0x3ae842[_0xfeae('0x22')](_0x516673)[_0xfeae('0x23')](function(_0x5b8953){return _0x5b8953;});}return null;};}function removeEntity(_0x4dbe74,_0x4ac369){return function(_0x305f79){if(_0x305f79){return _0x305f79[_0xfeae('0x24')]()[_0xfeae('0x23')](function(){_0x4dbe74[_0xfeae('0x16')](0xcc)[_0xfeae('0x17')]();});}};}function handleEntityNotFound(_0x536615,_0x22b21a){return function(_0x1a54a2){if(!_0x1a54a2){_0x536615[_0xfeae('0x15')](0x194);}return _0x1a54a2;};}function handleError(_0x4321bb,_0x5a68a7){_0x5a68a7=_0x5a68a7||0x1f4;return function(_0xcdc24){logger[_0xfeae('0x25')](_0xcdc24[_0xfeae('0x26')]);if(_0xcdc24['name']){delete _0xcdc24[_0xfeae('0x27')];}_0x4321bb['status'](_0x5a68a7)[_0xfeae('0x28')](_0xcdc24);};}exports[_0xfeae('0x29')]=function(_0xe93d34,_0xa4b99f){var _0x328be2={},_0x15fd64={},_0x181ca1={'count':0x0,'rows':[]};var _0x24c602=_[_0xfeae('0x2a')](db[_0xfeae('0x2b')][_0xfeae('0x2c')],function(_0x231704){return{'name':_0x231704['fieldName'],'type':_0x231704[_0xfeae('0x2d')]['key']};});_0x15fd64[_0xfeae('0x2e')]=_[_0xfeae('0x2f')](_['map'](_0x24c602,_0xfeae('0x27')),[_0xfeae('0x30')]);_0x15fd64[_0xfeae('0x31')]=_[_0xfeae('0x32')](_0xe93d34[_0xfeae('0x31')]);_0x15fd64['filters']=_[_0xfeae('0x33')](_0x15fd64[_0xfeae('0x2e')],_0x15fd64[_0xfeae('0x31')]);_0x328be2[_0xfeae('0x34')]=_[_0xfeae('0x33')](_0x15fd64[_0xfeae('0x2e')],qs[_0xfeae('0x35')](_0xe93d34[_0xfeae('0x31')]['fields']));_0x328be2[_0xfeae('0x34')]=_0x328be2[_0xfeae('0x34')][_0xfeae('0x36')]?_0x328be2['attributes']:_0x15fd64[_0xfeae('0x2e')];if(!_0xe93d34['query'][_0xfeae('0x37')](_0xfeae('0x38'))){_0x328be2[_0xfeae('0x1c')]=qs[_0xfeae('0x1c')](_0xe93d34[_0xfeae('0x31')][_0xfeae('0x1c')]);_0x328be2[_0xfeae('0x1b')]=qs[_0xfeae('0x1b')](_0xe93d34['query'][_0xfeae('0x1b')]);}_0x328be2['order']=qs[_0xfeae('0x39')](_0xe93d34[_0xfeae('0x31')][_0xfeae('0x39')]);_0x328be2[_0xfeae('0x3a')]=qs[_0xfeae('0x3b')](_[_0xfeae('0x3c')](_0xe93d34['query'],_0x15fd64[_0xfeae('0x3b')]),_0x24c602);if(_0xe93d34[_0xfeae('0x31')][_0xfeae('0x3d')]){_0x328be2[_0xfeae('0x3a')]=_[_0xfeae('0x3e')](_0x328be2[_0xfeae('0x3a')],{'$or':_[_0xfeae('0x2a')](_0x24c602,function(_0x45b3ef){if(_0x45b3ef[_0xfeae('0x2d')]!==_0xfeae('0x3f')){var _0x35173e={};_0x35173e[_0x45b3ef[_0xfeae('0x27')]]={'$like':'%'+_0xe93d34['query'][_0xfeae('0x3d')]+'%'};return _0x35173e;}})});}_0x328be2=_[_0xfeae('0x3e')]({},_0x328be2,_0xe93d34[_0xfeae('0x40')]);var _0xeeff27={'where':_0x328be2[_0xfeae('0x3a')]};return db['VoiceRecording']['count'](_0xeeff27)[_0xfeae('0x23')](function(_0x5ebd5c){_0x181ca1[_0xfeae('0x1a')]=_0x5ebd5c;if(_0xe93d34[_0xfeae('0x31')][_0xfeae('0x41')]){_0x328be2[_0xfeae('0x42')]=[{'all':!![]}];}return db['VoiceRecording'][_0xfeae('0x43')](_0x328be2);})[_0xfeae('0x23')](function(_0x3a0ea6){_0x181ca1[_0xfeae('0x44')]=_0x3a0ea6;return _0x181ca1;})[_0xfeae('0x23')](respondWithFilteredResult(_0xa4b99f,_0x328be2))[_0xfeae('0x45')](handleError(_0xa4b99f,null));};exports[_0xfeae('0x46')]=function(_0x10588f,_0x42ffd5){var _0x293841={'raw':![],'where':{'id':_0x10588f[_0xfeae('0x47')]['id']}},_0x12fb92={};_0x12fb92['model']=_[_0xfeae('0x32')](db[_0xfeae('0x2b')][_0xfeae('0x2c')]);_0x12fb92[_0xfeae('0x31')]=_['keys'](_0x10588f[_0xfeae('0x31')]);_0x12fb92[_0xfeae('0x3b')]=_['intersection'](_0x12fb92['model'],_0x12fb92[_0xfeae('0x31')]);_0x293841['attributes']=_['intersection'](_0x12fb92[_0xfeae('0x2e')],qs[_0xfeae('0x35')](_0x10588f[_0xfeae('0x31')][_0xfeae('0x35')]));_0x293841[_0xfeae('0x34')]=_0x293841[_0xfeae('0x34')]['length']?_0x293841['attributes']:_0x12fb92[_0xfeae('0x2e')];if(_0x10588f[_0xfeae('0x31')]['includeAll']){_0x293841['include']=[{'all':!![]}];}_0x293841=_[_0xfeae('0x3e')]({},_0x293841,_0x10588f['options']);return db[_0xfeae('0x2b')]['find'](_0x293841)[_0xfeae('0x23')](handleEntityNotFound(_0x42ffd5,null))['then'](respondWithResult(_0x42ffd5,null))[_0xfeae('0x45')](handleError(_0x42ffd5,null));};exports[_0xfeae('0x48')]=function(_0x59c52f,_0x505349){return db[_0xfeae('0x2b')][_0xfeae('0x48')](_0x59c52f['body'],{})['then'](respondWithResult(_0x505349,0xc9))['catch'](handleError(_0x505349,null));};exports[_0xfeae('0x22')]=function(_0xef233b,_0x14bb69){if(_0xef233b[_0xfeae('0x49')]['id']){delete _0xef233b['body']['id'];}return db[_0xfeae('0x2b')][_0xfeae('0x4a')]({'where':{'id':_0xef233b[_0xfeae('0x47')]['id']}})[_0xfeae('0x23')](handleEntityNotFound(_0x14bb69,null))['then'](saveUpdates(_0xef233b[_0xfeae('0x49')],null))[_0xfeae('0x23')](respondWithResult(_0x14bb69,null))[_0xfeae('0x45')](handleError(_0x14bb69,null));};exports[_0xfeae('0x4b')]=function(_0x38f9a9,_0x40bab2){return db[_0xfeae('0x2b')]['describe']()['then'](respondWithResult(_0x40bab2,null))[_0xfeae('0x45')](handleError(_0x40bab2,null));};exports[_0xfeae('0x4c')]=function(_0x30ee44,_0x1bd3e8,_0x4c5f20){var _0x439ea6=require(_0xfeae('0x4d'));var _0x1d777c=![];var _0x57ae9f={};if(_0x30ee44[_0xfeae('0x31')][_0xfeae('0x2d')]&&_0x30ee44[_0xfeae('0x31')][_0xfeae('0x2d')]===_0xfeae('0x4e')){_0x57ae9f['uniqueid']=_0x30ee44[_0xfeae('0x47')]['id'];}else{_0x57ae9f['id']=_0x30ee44[_0xfeae('0x47')]['id'];}return db['VoiceRecording']['find']({'where':_0x57ae9f,'attributes':['id',_0xfeae('0x4f')],'raw':!![]})[_0xfeae('0x23')](handleEntityNotFound(_0x1bd3e8,null))[_0xfeae('0x23')](function(_0x210178){if(_0x210178){var _0xe7ba18=_0x210178[_0xfeae('0x4f')];var _0x46937d=util['format'](_0xfeae('0x50'),_0xe7ba18);if(fs['existsSync'](_0x46937d)){_0x1d777c=!![];return _0x439ea6[_0xfeae('0x51')](_0x46937d,_0xe7ba18,config['secrets']['recording'])['then'](function(){return _0x210178;});}return _0x210178;}})[_0xfeae('0x23')](function(_0x14214c){if(_0x14214c){var _0x4d4072=_0x14214c[_0xfeae('0x4f')];if(!fs[_0xfeae('0x52')](_0x4d4072)){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x14214c['filename']){return _0x1bd3e8['download'](_0x4d4072,_0x14214c[_0xfeae('0x53')]+path[_0xfeae('0x54')](_0x4d4072),function(){if(_0x1d777c){fs['unlink'](_0x4d4072);}});}else{return _0x1bd3e8[_0xfeae('0x4c')](_0x4d4072,function(_0x3c51c1){if(_0x1d777c){fs['unlink'](_0x4d4072);}});}}})[_0xfeae('0x45')](function(_0xb0b0d5){if(_0xb0b0d5[_0xfeae('0x55')]===_0xfeae('0x56')){_0x1bd3e8[_0xfeae('0x16')](0x194)[_0xfeae('0x28')](_0xfeae('0x57'));}else{return handleError(_0x1bd3e8,null);}});};exports[_0xfeae('0x58')]=function(_0x57733,_0x952421,_0x59be7f){var _0x487b8f=require(_0xfeae('0x4d'));var _0x3bea79=![];var _0x15f328={'$and':[db[_0xfeae('0x59')]['where'](db['sequelize']['fn'](_0xfeae('0x5a'),db['sequelize'][_0xfeae('0x5b')](_0xfeae('0x4e'))),_0x57733[_0xfeae('0x31')]['token'])]};if(_0x57733[_0xfeae('0x31')][_0xfeae('0x2d')]&&_0x57733[_0xfeae('0x31')][_0xfeae('0x2d')]==='uniqueid'){_0x15f328['$and'][_0xfeae('0x5c')]({'uniqueid':_0x57733['params']['id']});}else{_0x15f328[_0xfeae('0x5d')][_0xfeae('0x5c')]({'id':_0x57733[_0xfeae('0x47')]['id']});}return db[_0xfeae('0x2b')][_0xfeae('0x4a')]({'where':_0x15f328,'attributes':['id',_0xfeae('0x4f')],'raw':!![]})[_0xfeae('0x23')](handleEntityNotFound(_0x952421,null))[_0xfeae('0x23')](function(_0x477064){if(_0x477064){var _0x42e879=util[_0xfeae('0x30')](_0xfeae('0x50'),_0x477064[_0xfeae('0x4f')]);if(fs['existsSync'](_0x42e879)){_0x3bea79=!![];return _0x487b8f[_0xfeae('0x51')](_0x42e879,_0x477064[_0xfeae('0x4f')],config[_0xfeae('0x5e')][_0xfeae('0x5f')])[_0xfeae('0x23')](function(){return _0x477064;});}return _0x477064;}})[_0xfeae('0x23')](function(_0x44dcf6){if(_0x44dcf6){if(!fs[_0xfeae('0x52')](_0x44dcf6['value'])){throw new db[(_0xfeae('0x60'))]['ValidationError'](_0xfeae('0x56'));}if(_0x44dcf6[_0xfeae('0x53')]){return _0x952421[_0xfeae('0x4c')](_0x44dcf6[_0xfeae('0x4f')],_0x44dcf6['filename']+path[_0xfeae('0x54')](_0x44dcf6['value']),function(){if(_0x3bea79){fs['unlink'](_0x44dcf6[_0xfeae('0x4f')]);}});}else{return _0x952421['download'](_0x44dcf6[_0xfeae('0x4f')],function(_0x18a08a){if(_0x3bea79){fs[_0xfeae('0x61')](_0x44dcf6[_0xfeae('0x4f')]);}});}}})['catch'](handleError(_0x952421,null));};exports['destroy']=function(_0x47b3ba,_0x58010f){return db[_0xfeae('0x2b')][_0xfeae('0x4a')]({'where':{'id':_0x47b3ba[_0xfeae('0x47')]['id']}})[_0xfeae('0x23')](function(_0xd0e7f7){if(_['isNil'](_0xd0e7f7)){throw new ReferenceError(_0xfeae('0x62'));}return _0xd0e7f7;})[_0xfeae('0x23')](function(_0x14dcd2){var _0x34efd3=_0x14dcd2['value'];logger['info'](_0xfeae('0x63'),_0x34efd3);if(!_[_0xfeae('0x64')](_0x14dcd2['value'])&&fs[_0xfeae('0x52')](_0x34efd3)){logger[_0xfeae('0x65')](_0xfeae('0x66')+_0x34efd3+_0xfeae('0x67'));fs[_0xfeae('0x68')](_0x34efd3);}_0x34efd3=_0x34efd3+_0xfeae('0x69');if(!_[_0xfeae('0x64')](_0x14dcd2[_0xfeae('0x4f')])&&fs[_0xfeae('0x52')](_0x34efd3)){logger[_0xfeae('0x65')](_0xfeae('0x66')+_0x34efd3+_0xfeae('0x67'));fs[_0xfeae('0x68')](_0x34efd3);}return _0x14dcd2;})[_0xfeae('0x23')](function(_0x495905){if(!_0x495905)throw new InternalError();return _0x495905[_0xfeae('0x24')]();})[_0xfeae('0x23')](function(){_0x58010f[_0xfeae('0x16')](0xcc)[_0xfeae('0x17')]();})['catch'](handleError(_0x58010f,null));};function getBucketslist(_0x3b2f14,_0x34d754,_0x15cf0b){return new Promise(function(_0x145858,_0x485f23){var _0x5dea2a=new AWS['S3']({'accessKeyId':_0x34d754,'secretAccessKey':_0x3b2f14,'region':_0x15cf0b});_0x5dea2a['listBuckets']({},function(_0x2d913d,_0x1c7e07){if(_0x2d913d){return _0x485f23(_0x2d913d);}else{return _0x145858(_0x1c7e07);}});});}function createBucket(_0x277bae,_0x22a315,_0x43a714,_0x5c16a1){return new Promise(function(_0x3685b8,_0x23929f){var _0x1860c3=new AWS['S3']({'accessKeyId':_0x22a315,'secretAccessKey':_0x277bae,'region':_0x43a714});_0x1860c3[_0xfeae('0x6a')]({'Bucket':_0x5c16a1},function(_0x5ace82,_0x4b1e7c){if(_0x5ace82){return _0x23929f(_0x5ace82);}else{return _0x3685b8(_0x4b1e7c);}});});}function uploadFile(_0x442a7d,_0x55e44e,_0x5f5170,_0x418e3d,_0x4c5a16,_0x3d8db5){return new Promise(function(_0x130296,_0x2f9ea8){var _0x576b03=new AWS['S3']({'accessKeyId':_0x55e44e,'secretAccessKey':_0x442a7d,'region':_0x5f5170});_0x576b03[_0xfeae('0x6b')]({'Bucket':_0x418e3d,'Key':_0x4c5a16,'Body':_0x3d8db5},function(_0x2cd0f8,_0x1a9a91){if(_0x2cd0f8){return _0x2f9ea8(_0x2cd0f8);}else{return _0x130296(_0x1a9a91);}});});}function startTranscribe(_0x3cb0ec,_0x3f74d2,_0x3821a4,_0x5da750,_0x182a45,_0x5e88e9){return new Promise(function(_0x12878d,_0x549596){var _0x2ee170=new AWS[(_0xfeae('0x6c'))]({'accessKeyId':_0x3f74d2,'secretAccessKey':_0x3cb0ec,'region':_0x3821a4});_0x2ee170[_0xfeae('0x6d')]({'TranscriptionJobName':_0x5da750,'LanguageCode':_0x182a45,'Media':{'MediaFileUri':_0x5e88e9}},function(_0x5d1234,_0x4e2f99){if(_0x5d1234){return _0x549596(_0x5d1234);}else{return _0x12878d(_0x4e2f99);}});});}function transcribe(_0x417634,_0x4f015e,_0x31fdc6,_0x1c8f36,_0x59adf7,_0x3e17ce,_0x278e46){return new Promise(function(_0x55938e,_0x347732){var _0x1f066b={};logger[_0xfeae('0x65')](util[_0xfeae('0x30')](_0xfeae('0x6e'),_0x417634,_0x59adf7));return uploadFile(_0x4f015e,_0x31fdc6,_0x1c8f36,_0x59adf7,path['basename'](_0x3e17ce),fs[_0xfeae('0x6f')](_0x3e17ce))[_0xfeae('0x23')](function(_0x257f4b){logger[_0xfeae('0x65')](util[_0xfeae('0x30')](_0xfeae('0x70'),_0x417634,_0x59adf7,_0x257f4b[_0xfeae('0x71')]));_0x1f066b[_0xfeae('0x72')]=_0x257f4b[_0xfeae('0x73')];_0x1f066b[_0xfeae('0x74')]=_0x257f4b[_0xfeae('0x71')];logger['info'](util[_0xfeae('0x30')](_0xfeae('0x75'),_0x417634));return startTranscribe(_0x4f015e,_0x31fdc6,_0x1c8f36,uuidv4(),_0x278e46,_0x257f4b[_0xfeae('0x71')]);})[_0xfeae('0x23')](function(_0x24ccb9){logger[_0xfeae('0x65')](util['format'](_0xfeae('0x76'),_0x417634,_0x24ccb9[_0xfeae('0x77')][_0xfeae('0x78')]));_0x1f066b[_0xfeae('0x79')]=_0x24ccb9[_0xfeae('0x77')][_0xfeae('0x78')];_0x1f066b['transcribeStatus']=_0x24ccb9['TranscriptionJob'][_0xfeae('0x7a')];return _0x55938e(_0x1f066b);})[_0xfeae('0x45')](function(_0x4af738){return _0x347732(_0x4af738);});});}exports[_0xfeae('0x7b')]=function(_0x20ee7b,_0x20cdcc,_0x1f689c){var _0x10fdab;var _0x17782f;var _0x29bf08;var _0x143b9a=require(_0xfeae('0x4d'));return db[_0xfeae('0x2b')][_0xfeae('0x7c')]({'where':{'id':_0x20ee7b['params']['id']}})['then'](function(_0x293e18){if(_0x293e18){var _0x28f3b4=util['format'](_0xfeae('0x50'),_0x293e18[_0xfeae('0x4f')]);if(fs['existsSync'](_0x28f3b4)){cypher=!![];return _0x143b9a[_0xfeae('0x51')](_0x28f3b4,_0x293e18[_0xfeae('0x4f')],config['secrets'][_0xfeae('0x5f')])[_0xfeae('0x23')](function(){return _0x293e18;});}return _0x293e18;}})[_0xfeae('0x23')](function(_0x1a55cb){if(!_0x1a55cb){throw new db[(_0xfeae('0x60'))][(_0xfeae('0x7d'))](_0xfeae('0x7e'));}_0x17782f=_0x1a55cb;return db['Setting'][_0xfeae('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x20cdcc,null))[_0xfeae('0x23')](function(_0x10e957){if(_0x10e957){_0x10fdab=_0x10e957;if(!_0x10fdab['transcribe']||!_0x10fdab[_0xfeae('0x7f')]||!_0x10fdab[_0xfeae('0x80')]||!_0x10fdab['language']||!_0x10fdab['bucket']){throw new db[(_0xfeae('0x60'))][(_0xfeae('0x7d'))](_0xfeae('0x81'));}if(_0x20ee7b[_0xfeae('0x49')][_0xfeae('0x82')]&&(!_0x10fdab[_0xfeae('0x83')]||!_0x10fdab[_0xfeae('0x84')]||!_0x10fdab['sentimentRegion']||!_0x10fdab[_0xfeae('0x85')]||!_0x10fdab[_0xfeae('0x72')])){throw new db[(_0xfeae('0x60'))]['ValidationError'](_0xfeae('0x86'));}return db['CloudProvider']['findOne']({'where':{'id':_0x10fdab[_0xfeae('0x7f')]}});}})['then'](function(_0xebbc9b){if(!_0xebbc9b){throw new db[(_0xfeae('0x60'))][(_0xfeae('0x7d'))](_0xfeae('0x87'));}if(!_0xebbc9b[_0xfeae('0x88')]||!_0xebbc9b[_0xfeae('0x89')]){throw new db[(_0xfeae('0x60'))][(_0xfeae('0x7d'))](_0xfeae('0x8a'));}_0x29bf08=_0xebbc9b;return getBucketslist(_0x29bf08[_0xfeae('0x88')],_0x29bf08['data2'],_0x10fdab[_0xfeae('0x80')]);})[_0xfeae('0x23')](function(_0x3763fc){if(_0x3763fc&&_0x3763fc[_0xfeae('0x8b')]){var _0x29b793=_['find'](_0x3763fc['Buckets'],function(_0x3d9e17){return _0x3d9e17['Name']===_0x10fdab[_0xfeae('0x72')];});if(!_0x29b793){logger[_0xfeae('0x65')](util[_0xfeae('0x30')](_0xfeae('0x8c'),_0x20ee7b[_0xfeae('0x47')]['id'],_0x10fdab[_0xfeae('0x72')]));return createBucket(_0x29bf08['data1'],_0x29bf08['data2'],_0x10fdab[_0xfeae('0x80')],_0x10fdab['bucket']);}logger[_0xfeae('0x65')](util['format'](_0xfeae('0x8d'),_0x20ee7b[_0xfeae('0x47')]['id'],_0x10fdab[_0xfeae('0x72')]));return;}})[_0xfeae('0x23')](function(_0x2f8001){if(_0x17782f['transcribeStatus']===_0xfeae('0x8e')){return transcribe(_0x20ee7b[_0xfeae('0x47')]['id'],_0x29bf08['data1'],_0x29bf08[_0xfeae('0x89')],_0x10fdab[_0xfeae('0x80')],_0x10fdab['bucket'],_0x17782f['value'],_0x10fdab[_0xfeae('0x85')]);}else{logger[_0xfeae('0x65')](util[_0xfeae('0x30')](_0xfeae('0x8f'),_0x20ee7b['params']['id']));return{'transcribeStatus':_0xfeae('0x90')};}})[_0xfeae('0x23')](function(_0x6efa38){if(_0x6efa38){_0x6efa38[_0xfeae('0x91')]=_0x20ee7b[_0xfeae('0x49')]['runSentiment'];return _0x17782f[_0xfeae('0x92')](_0x6efa38);}})[_0xfeae('0x23')](respondWithResult(_0x20cdcc,null))['catch'](handleError(_0x20cdcc,null));};function writeFile(_0x1c53d5,_0x1edfd2){return new Promise(function(_0x3c92c9,_0x12ea0a){fs[_0xfeae('0x93')](_0x1edfd2,_0x1c53d5,function(_0xc88082,_0x55abfe){if(_0xc88082){return _0x12ea0a(_0xc88082);}else{return _0x3c92c9(_0x55abfe);}});});}exports[_0xfeae('0x94')]=function(_0x2d63b3,_0x32a3f7,_0x24b1e1){return db[_0xfeae('0x2b')][_0xfeae('0x7c')]({'where':{'id':_0x2d63b3[_0xfeae('0x47')]['id']}})[_0xfeae('0x23')](handleEntityNotFound(_0x32a3f7))[_0xfeae('0x23')](function(_0x38bba5){if(_0x38bba5&&_0x38bba5['fileText']){var _0x49e17d=_0x38bba5[_0xfeae('0x95')];var _0x11dd0a=config['root']+_0xfeae('0x96')+_0x38bba5['id']+_0xfeae('0x97');if(fs[_0xfeae('0x52')](_0x11dd0a)){return _0x11dd0a;}return writeFile(_0x49e17d,_0x11dd0a)[_0xfeae('0x23')](function(){return _0x11dd0a;});}else{throw new db[(_0xfeae('0x60'))]['ValidationError'](_0xfeae('0x98'));}})['then'](function(_0x12d6f2){return _0x32a3f7[_0xfeae('0x4c')](_0x12d6f2);})['catch'](handleError(_0x32a3f7));}; \ No newline at end of file +var _0x3641=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','type','differenceBy','format','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','MD5','$and','push','Sequelize','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','TranscribeService','startTranscriptionJob','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','runSentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0xeb946,_0x5be6e8){var _0x39b4c8=function(_0x1cba83){while(--_0x1cba83){_0xeb946['push'](_0xeb946['shift']());}};_0x39b4c8(++_0x5be6e8);}(_0x3641,0x115));var _0x1364=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3641[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x1364('0x0'));var rimraf=require(_0x1364('0x1'));var zipdir=require(_0x1364('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1364('0x3'));var moment=require(_0x1364('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1364('0x5'));var util=require(_0x1364('0x6'));var path=require(_0x1364('0x7'));var sox=require(_0x1364('0x8'));var csv=require('to-csv');var ejs=require(_0x1364('0x9'));var fs=require('fs');var fs_extra=require(_0x1364('0xa'));var _=require(_0x1364('0xb'));var squel=require(_0x1364('0xc'));var crypto=require(_0x1364('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1364('0xe'));var toCsv=require(_0x1364('0xf'));var querystring=require(_0x1364('0x10'));var Papa=require(_0x1364('0x11'));var AWS=require(_0x1364('0x12'));var uuidv4=require('uuid/v4');var Redis=require(_0x1364('0x13'));var authService=require(_0x1364('0x14'));var qs=require(_0x1364('0x15'));var as=require(_0x1364('0x16'));var hardwareService=require(_0x1364('0x17'));var logger=require(_0x1364('0x18'))('api');var utils=require(_0x1364('0x19'));var config=require(_0x1364('0x1a'));var licenseUtil=require(_0x1364('0x1b'));var db=require(_0x1364('0x1c'))['db'];function respondWithStatusCode(_0xa8fb7,_0x566e58){_0x566e58=_0x566e58||0xcc;return function(_0x255734){if(_0x255734){return _0xa8fb7[_0x1364('0x1d')](_0x566e58);}return _0xa8fb7[_0x1364('0x1e')](_0x566e58)[_0x1364('0x1f')]();};}function respondWithResult(_0x5f343b,_0x355363){_0x355363=_0x355363||0xc8;return function(_0x490d1a){if(_0x490d1a){return _0x5f343b[_0x1364('0x1e')](_0x355363)[_0x1364('0x20')](_0x490d1a);}};}function respondWithFilteredResult(_0x25db60,_0x366611){return function(_0x1828bb){if(_0x1828bb){var _0x1947d6=typeof _0x366611['offset']===_0x1364('0x21')&&typeof _0x366611[_0x1364('0x22')]===_0x1364('0x21');var _0x31df67=_0x1828bb[_0x1364('0x23')];var _0x45fb2b=_0x1947d6?0x0:_0x366611[_0x1364('0x24')];var _0x4c1762=_0x1947d6?_0x1828bb[_0x1364('0x23')]:_0x366611['offset']+_0x366611[_0x1364('0x22')];var _0x2d3f39;if(_0x4c1762>=_0x31df67){_0x4c1762=_0x31df67;_0x2d3f39=0xc8;}else{_0x2d3f39=0xce;}_0x25db60[_0x1364('0x1e')](_0x2d3f39);return _0x25db60['set'](_0x1364('0x25'),_0x45fb2b+'-'+_0x4c1762+'/'+_0x31df67)[_0x1364('0x20')](_0x1828bb);}return null;};}function patchUpdates(_0x1c9071){return function(_0x2b1281){try{jsonpatch[_0x1364('0x26')](_0x2b1281,_0x1c9071,!![]);}catch(_0xfa0c3e){return BPromise['reject'](_0xfa0c3e);}return _0x2b1281[_0x1364('0x27')]();};}function saveUpdates(_0x1b2779,_0x278001){return function(_0x43d2a5){if(_0x43d2a5){return _0x43d2a5[_0x1364('0x28')](_0x1b2779)[_0x1364('0x29')](function(_0x2300a2){return _0x2300a2;});}return null;};}function removeEntity(_0x5c8bfd,_0x30b791){return function(_0x787be1){if(_0x787be1){return _0x787be1[_0x1364('0x2a')]()[_0x1364('0x29')](function(){_0x5c8bfd['status'](0xcc)[_0x1364('0x1f')]();});}};}function handleEntityNotFound(_0xc4f7bd,_0x42df9d){return function(_0x453aa0){if(!_0x453aa0){_0xc4f7bd[_0x1364('0x1d')](0x194);}return _0x453aa0;};}function handleError(_0x5176be,_0x2e4ac4){_0x2e4ac4=_0x2e4ac4||0x1f4;return function(_0x384df2){logger['error'](_0x384df2[_0x1364('0x2b')]);if(_0x384df2['name']){delete _0x384df2[_0x1364('0x2c')];}_0x5176be['status'](_0x2e4ac4)[_0x1364('0x2d')](_0x384df2);};}exports[_0x1364('0x2e')]=function(_0xcf6cc7,_0x122c94){var _0x53f7b3={},_0x1bc3b2={},_0x2a5b36={'count':0x0,'rows':[]};var _0x644bf9=_['map'](db[_0x1364('0x2f')][_0x1364('0x30')],function(_0xdd14a7){return{'name':_0xdd14a7[_0x1364('0x31')],'type':_0xdd14a7[_0x1364('0x32')]['key']};});_0x1bc3b2['model']=_[_0x1364('0x33')](_['map'](_0x644bf9,_0x1364('0x2c')),[_0x1364('0x34')]);_0x1bc3b2[_0x1364('0x35')]=_[_0x1364('0x36')](_0xcf6cc7['query']);_0x1bc3b2[_0x1364('0x37')]=_[_0x1364('0x38')](_0x1bc3b2[_0x1364('0x39')],_0x1bc3b2[_0x1364('0x35')]);_0x53f7b3['attributes']=_['intersection'](_0x1bc3b2[_0x1364('0x39')],qs['fields'](_0xcf6cc7[_0x1364('0x35')][_0x1364('0x3a')]));_0x53f7b3[_0x1364('0x3b')]=_0x53f7b3[_0x1364('0x3b')][_0x1364('0x3c')]?_0x53f7b3['attributes']:_0x1bc3b2[_0x1364('0x39')];if(!_0xcf6cc7['query'][_0x1364('0x3d')](_0x1364('0x3e'))){_0x53f7b3[_0x1364('0x22')]=qs[_0x1364('0x22')](_0xcf6cc7['query']['limit']);_0x53f7b3[_0x1364('0x24')]=qs['offset'](_0xcf6cc7[_0x1364('0x35')][_0x1364('0x24')]);}_0x53f7b3[_0x1364('0x3f')]=qs[_0x1364('0x40')](_0xcf6cc7['query'][_0x1364('0x40')]);_0x53f7b3[_0x1364('0x41')]=qs['filters'](_[_0x1364('0x42')](_0xcf6cc7[_0x1364('0x35')],_0x1bc3b2[_0x1364('0x37')]),_0x644bf9);if(_0xcf6cc7[_0x1364('0x35')][_0x1364('0x43')]){_0x53f7b3[_0x1364('0x41')]=_['merge'](_0x53f7b3[_0x1364('0x41')],{'$or':_[_0x1364('0x44')](_0x644bf9,function(_0x275f5a){if(_0x275f5a[_0x1364('0x32')]!==_0x1364('0x45')){var _0x5ed489={};_0x5ed489[_0x275f5a[_0x1364('0x2c')]]={'$like':'%'+_0xcf6cc7[_0x1364('0x35')][_0x1364('0x43')]+'%'};return _0x5ed489;}})});}_0x53f7b3=_[_0x1364('0x46')]({},_0x53f7b3,_0xcf6cc7[_0x1364('0x47')]);var _0x452616={'where':_0x53f7b3[_0x1364('0x41')]};return db[_0x1364('0x2f')][_0x1364('0x23')](_0x452616)[_0x1364('0x29')](function(_0x5a76f6){_0x2a5b36['count']=_0x5a76f6;if(_0xcf6cc7[_0x1364('0x35')]['includeAll']){_0x53f7b3[_0x1364('0x48')]=[{'all':!![]}];}return db[_0x1364('0x2f')][_0x1364('0x49')](_0x53f7b3);})[_0x1364('0x29')](function(_0x1d30c4){_0x2a5b36['rows']=_0x1d30c4;return _0x2a5b36;})[_0x1364('0x29')](respondWithFilteredResult(_0x122c94,_0x53f7b3))[_0x1364('0x4a')](handleError(_0x122c94,null));};exports[_0x1364('0x4b')]=function(_0x3729ab,_0x53377d){var _0x53f049={'raw':![],'where':{'id':_0x3729ab[_0x1364('0x4c')]['id']}},_0x37ec34={};_0x37ec34[_0x1364('0x39')]=_[_0x1364('0x36')](db[_0x1364('0x2f')][_0x1364('0x30')]);_0x37ec34[_0x1364('0x35')]=_['keys'](_0x3729ab['query']);_0x37ec34[_0x1364('0x37')]=_['intersection'](_0x37ec34[_0x1364('0x39')],_0x37ec34[_0x1364('0x35')]);_0x53f049[_0x1364('0x3b')]=_[_0x1364('0x38')](_0x37ec34[_0x1364('0x39')],qs[_0x1364('0x3a')](_0x3729ab['query'][_0x1364('0x3a')]));_0x53f049[_0x1364('0x3b')]=_0x53f049['attributes'][_0x1364('0x3c')]?_0x53f049[_0x1364('0x3b')]:_0x37ec34[_0x1364('0x39')];if(_0x3729ab[_0x1364('0x35')][_0x1364('0x4d')]){_0x53f049['include']=[{'all':!![]}];}_0x53f049=_['merge']({},_0x53f049,_0x3729ab[_0x1364('0x47')]);return db['VoiceRecording'][_0x1364('0x4e')](_0x53f049)[_0x1364('0x29')](handleEntityNotFound(_0x53377d,null))[_0x1364('0x29')](respondWithResult(_0x53377d,null))['catch'](handleError(_0x53377d,null));};exports[_0x1364('0x4f')]=function(_0x231315,_0x3cadd9){return db[_0x1364('0x2f')][_0x1364('0x4f')](_0x231315[_0x1364('0x50')],{})[_0x1364('0x29')](respondWithResult(_0x3cadd9,0xc9))[_0x1364('0x4a')](handleError(_0x3cadd9,null));};exports['update']=function(_0x5f1383,_0x1a0950){if(_0x5f1383['body']['id']){delete _0x5f1383[_0x1364('0x50')]['id'];}return db[_0x1364('0x2f')][_0x1364('0x4e')]({'where':{'id':_0x5f1383['params']['id']}})[_0x1364('0x29')](handleEntityNotFound(_0x1a0950,null))[_0x1364('0x29')](saveUpdates(_0x5f1383['body'],null))[_0x1364('0x29')](respondWithResult(_0x1a0950,null))[_0x1364('0x4a')](handleError(_0x1a0950,null));};exports[_0x1364('0x51')]=function(_0x400bda,_0x176a10){return db[_0x1364('0x2f')][_0x1364('0x51')]()[_0x1364('0x29')](respondWithResult(_0x176a10,null))[_0x1364('0x4a')](handleError(_0x176a10,null));};exports[_0x1364('0x52')]=function(_0x40eb49,_0x1a1a23,_0x540cd1){var _0x5e826f=require(_0x1364('0x53'));var _0x1988d6=![];var _0x53e485={};if(_0x40eb49[_0x1364('0x35')][_0x1364('0x32')]&&_0x40eb49[_0x1364('0x35')][_0x1364('0x32')]===_0x1364('0x54')){_0x53e485[_0x1364('0x54')]=_0x40eb49['params']['id'];}else{_0x53e485['id']=_0x40eb49[_0x1364('0x4c')]['id'];}return db[_0x1364('0x2f')][_0x1364('0x4e')]({'where':_0x53e485,'attributes':['id',_0x1364('0x55')],'raw':!![]})[_0x1364('0x29')](handleEntityNotFound(_0x1a1a23,null))['then'](function(_0xb338c1){if(_0xb338c1){var _0x50e1f8=_0xb338c1[_0x1364('0x55')];var _0x2d8f6d=util[_0x1364('0x34')](_0x1364('0x56'),_0x50e1f8);if(fs[_0x1364('0x57')](_0x2d8f6d)){_0x1988d6=!![];return _0x5e826f[_0x1364('0x58')](_0x2d8f6d,_0x50e1f8,config[_0x1364('0x59')][_0x1364('0x5a')])[_0x1364('0x29')](function(){return _0xb338c1;});}return _0xb338c1;}})[_0x1364('0x29')](function(_0x2cd8d0){if(_0x2cd8d0){var _0x42ca2e=_0x2cd8d0[_0x1364('0x55')];if(!fs[_0x1364('0x57')](_0x42ca2e)){throw new db['Sequelize'][(_0x1364('0x5b'))](_0x1364('0x5c'));}if(_0x2cd8d0[_0x1364('0x5d')]){return _0x1a1a23[_0x1364('0x52')](_0x42ca2e,_0x2cd8d0[_0x1364('0x5d')]+path[_0x1364('0x5e')](_0x42ca2e),function(){if(_0x1988d6){fs[_0x1364('0x5f')](_0x42ca2e);}});}else{return _0x1a1a23[_0x1364('0x52')](_0x42ca2e,function(_0x4c28da){if(_0x1988d6){fs[_0x1364('0x5f')](_0x42ca2e);}});}}})['catch'](function(_0x404a09){if(_0x404a09[_0x1364('0x60')]===_0x1364('0x5c')){_0x1a1a23[_0x1364('0x1e')](0x194)['send'](_0x1364('0x61'));}else{return handleError(_0x1a1a23,null);}});};exports['downloads']=function(_0x234846,_0x188992,_0xabee09){var _0x18edd9=require(_0x1364('0x53'));var _0x2bb58f=![];var _0x572115={'$and':[db[_0x1364('0x62')]['where'](db['sequelize']['fn'](_0x1364('0x63'),db[_0x1364('0x62')]['col']('uniqueid')),_0x234846[_0x1364('0x35')]['token'])]};if(_0x234846[_0x1364('0x35')][_0x1364('0x32')]&&_0x234846[_0x1364('0x35')][_0x1364('0x32')]==='uniqueid'){_0x572115[_0x1364('0x64')][_0x1364('0x65')]({'uniqueid':_0x234846['params']['id']});}else{_0x572115[_0x1364('0x64')][_0x1364('0x65')]({'id':_0x234846[_0x1364('0x4c')]['id']});}return db[_0x1364('0x2f')]['find']({'where':_0x572115,'attributes':['id',_0x1364('0x55')],'raw':!![]})[_0x1364('0x29')](handleEntityNotFound(_0x188992,null))['then'](function(_0x552614){if(_0x552614){var _0x6a0250=util[_0x1364('0x34')](_0x1364('0x56'),_0x552614[_0x1364('0x55')]);if(fs['existsSync'](_0x6a0250)){_0x2bb58f=!![];return _0x18edd9[_0x1364('0x58')](_0x6a0250,_0x552614[_0x1364('0x55')],config[_0x1364('0x59')][_0x1364('0x5a')])[_0x1364('0x29')](function(){return _0x552614;});}return _0x552614;}})['then'](function(_0x504f70){if(_0x504f70){if(!fs[_0x1364('0x57')](_0x504f70[_0x1364('0x55')])){throw new db[(_0x1364('0x66'))][(_0x1364('0x5b'))](_0x1364('0x5c'));}if(_0x504f70[_0x1364('0x5d')]){return _0x188992[_0x1364('0x52')](_0x504f70[_0x1364('0x55')],_0x504f70[_0x1364('0x5d')]+path[_0x1364('0x5e')](_0x504f70[_0x1364('0x55')]),function(){if(_0x2bb58f){fs['unlink'](_0x504f70[_0x1364('0x55')]);}});}else{return _0x188992['download'](_0x504f70['value'],function(_0x304783){if(_0x2bb58f){fs[_0x1364('0x5f')](_0x504f70[_0x1364('0x55')]);}});}}})[_0x1364('0x4a')](handleError(_0x188992,null));};exports[_0x1364('0x2a')]=function(_0x23b80b,_0x1e3c7c){return db['VoiceRecording'][_0x1364('0x4e')]({'where':{'id':_0x23b80b[_0x1364('0x4c')]['id']}})[_0x1364('0x29')](function(_0x470a9c){if(_['isNil'](_0x470a9c)){throw new ReferenceError(_0x1364('0x67'));}return _0x470a9c;})[_0x1364('0x29')](function(_0x54c15d){var _0x5705b6=_0x54c15d['value'];logger[_0x1364('0x68')](_0x1364('0x69'),_0x5705b6);if(!_[_0x1364('0x6a')](_0x54c15d[_0x1364('0x55')])&&fs['existsSync'](_0x5705b6)){logger[_0x1364('0x68')]('File:\x20\x22'+_0x5705b6+_0x1364('0x6b'));fs[_0x1364('0x6c')](_0x5705b6);}_0x5705b6=_0x5705b6+_0x1364('0x6d');if(!_[_0x1364('0x6a')](_0x54c15d['value'])&&fs[_0x1364('0x57')](_0x5705b6)){logger[_0x1364('0x68')](_0x1364('0x6e')+_0x5705b6+_0x1364('0x6b'));fs['unlinkSync'](_0x5705b6);}return _0x54c15d;})[_0x1364('0x29')](function(_0x3814a3){if(!_0x3814a3)throw new InternalError();return _0x3814a3[_0x1364('0x2a')]();})[_0x1364('0x29')](function(){_0x1e3c7c[_0x1364('0x1e')](0xcc)[_0x1364('0x1f')]();})[_0x1364('0x4a')](handleError(_0x1e3c7c,null));};function getBucketslist(_0x271392,_0x391464,_0x2ff033){return new Promise(function(_0x467e84,_0x445454){var _0x2f9e34=new AWS['S3']({'accessKeyId':_0x391464,'secretAccessKey':_0x271392,'region':_0x2ff033});_0x2f9e34['listBuckets']({},function(_0xd344d0,_0x382927){if(_0xd344d0){return _0x445454(_0xd344d0);}else{return _0x467e84(_0x382927);}});});}function createBucket(_0x2b5cea,_0x3849f5,_0x61bb26,_0x1ec6c4){return new Promise(function(_0x4eb0a5,_0x195812){var _0x2a8184=new AWS['S3']({'accessKeyId':_0x3849f5,'secretAccessKey':_0x2b5cea,'region':_0x61bb26});_0x2a8184['createBucket']({'Bucket':_0x1ec6c4},function(_0x1c0b7e,_0x2649ea){if(_0x1c0b7e){return _0x195812(_0x1c0b7e);}else{return _0x4eb0a5(_0x2649ea);}});});}function uploadFile(_0x3f05d1,_0x28188e,_0x4794f4,_0x3f7dd6,_0x370f64,_0x74d338){return new Promise(function(_0x1c8b48,_0xaddc17){var _0x39ae20=new AWS['S3']({'accessKeyId':_0x28188e,'secretAccessKey':_0x3f05d1,'region':_0x4794f4});_0x39ae20['upload']({'Bucket':_0x3f7dd6,'Key':_0x370f64,'Body':_0x74d338},function(_0x312bfb,_0x11edc2){if(_0x312bfb){return _0xaddc17(_0x312bfb);}else{return _0x1c8b48(_0x11edc2);}});});}function startTranscribe(_0xc1345c,_0x470353,_0x271ff6,_0x96ccd4,_0xc2e87f,_0x7cf2da){return new Promise(function(_0x4a0fcf,_0x36faac){var _0x4ae583=new AWS[(_0x1364('0x6f'))]({'accessKeyId':_0x470353,'secretAccessKey':_0xc1345c,'region':_0x271ff6});_0x4ae583[_0x1364('0x70')]({'TranscriptionJobName':_0x96ccd4,'LanguageCode':_0xc2e87f,'Media':{'MediaFileUri':_0x7cf2da}},function(_0x37a74c,_0x1fd491){if(_0x37a74c){return _0x36faac(_0x37a74c);}else{return _0x4a0fcf(_0x1fd491);}});});}function transcribe(_0x2e9ccf,_0x2cb67f,_0x4f9ee8,_0x2bf2a7,_0x4df096,_0x308617,_0x264705){return new Promise(function(_0x20ef7e,_0x15e1d3){var _0x5b6288={};logger[_0x1364('0x68')](util[_0x1364('0x34')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x2e9ccf,_0x4df096));return uploadFile(_0x2cb67f,_0x4f9ee8,_0x2bf2a7,_0x4df096,path[_0x1364('0x71')](_0x308617),fs['readFileSync'](_0x308617))[_0x1364('0x29')](function(_0x43e52e){logger[_0x1364('0x68')](util[_0x1364('0x34')](_0x1364('0x72'),_0x2e9ccf,_0x4df096,_0x43e52e[_0x1364('0x73')]));_0x5b6288[_0x1364('0x74')]=_0x43e52e[_0x1364('0x75')];_0x5b6288[_0x1364('0x76')]=_0x43e52e[_0x1364('0x73')];logger['info'](util[_0x1364('0x34')](_0x1364('0x77'),_0x2e9ccf));return startTranscribe(_0x2cb67f,_0x4f9ee8,_0x2bf2a7,uuidv4(),_0x264705,_0x43e52e[_0x1364('0x73')]);})[_0x1364('0x29')](function(_0x2b0b76){logger[_0x1364('0x68')](util['format'](_0x1364('0x78'),_0x2e9ccf,_0x2b0b76[_0x1364('0x79')][_0x1364('0x7a')]));_0x5b6288['transcribeName']=_0x2b0b76[_0x1364('0x79')][_0x1364('0x7a')];_0x5b6288[_0x1364('0x7b')]=_0x2b0b76[_0x1364('0x79')][_0x1364('0x7c')];return _0x20ef7e(_0x5b6288);})[_0x1364('0x4a')](function(_0x2180fa){return _0x15e1d3(_0x2180fa);});});}exports[_0x1364('0x7d')]=function(_0x71adf7,_0x3e2678,_0x42482a){var _0x473037;var _0x762f53;var _0xbb8487;var _0x25019e=require(_0x1364('0x53'));return db[_0x1364('0x2f')][_0x1364('0x7e')]({'where':{'id':_0x71adf7[_0x1364('0x4c')]['id']}})[_0x1364('0x29')](function(_0x284408){if(_0x284408){var _0x109b14=util[_0x1364('0x34')](_0x1364('0x56'),_0x284408[_0x1364('0x55')]);if(fs['existsSync'](_0x109b14)){cypher=!![];return _0x25019e[_0x1364('0x58')](_0x109b14,_0x284408[_0x1364('0x55')],config[_0x1364('0x59')][_0x1364('0x5a')])['then'](function(){return _0x284408;});}return _0x284408;}})[_0x1364('0x29')](function(_0x2e91a9){if(!_0x2e91a9){throw new db['Sequelize'][(_0x1364('0x5b'))](_0x1364('0x7f'));}_0x762f53=_0x2e91a9;return db['Setting'][_0x1364('0x7e')]({'where':{'id':0x1}});})[_0x1364('0x29')](handleEntityNotFound(_0x3e2678,null))[_0x1364('0x29')](function(_0x35ebf8){if(_0x35ebf8){_0x473037=_0x35ebf8;if(!_0x473037[_0x1364('0x80')]||!_0x473037[_0x1364('0x81')]||!_0x473037['transcribeRegion']||!_0x473037['language']||!_0x473037['bucket']){throw new db[(_0x1364('0x66'))][(_0x1364('0x5b'))](_0x1364('0x82'));}if(_0x71adf7[_0x1364('0x50')][_0x1364('0x83')]&&(!_0x473037['sentiment']||!_0x473037['sentimentAccountId']||!_0x473037[_0x1364('0x84')]||!_0x473037[_0x1364('0x85')]||!_0x473037['bucket'])){throw new db[(_0x1364('0x66'))][(_0x1364('0x5b'))](_0x1364('0x86'));}return db['CloudProvider'][_0x1364('0x7e')]({'where':{'id':_0x473037[_0x1364('0x81')]}});}})[_0x1364('0x29')](function(_0x43eaed){if(!_0x43eaed){throw new db[(_0x1364('0x66'))][(_0x1364('0x5b'))](_0x1364('0x87'));}if(!_0x43eaed[_0x1364('0x88')]||!_0x43eaed['data2']){throw new db[(_0x1364('0x66'))][(_0x1364('0x5b'))](_0x1364('0x89'));}_0xbb8487=_0x43eaed;return getBucketslist(_0xbb8487[_0x1364('0x88')],_0xbb8487[_0x1364('0x8a')],_0x473037[_0x1364('0x8b')]);})['then'](function(_0x3aafc4){if(_0x3aafc4&&_0x3aafc4[_0x1364('0x8c')]){var _0x2c1637=_[_0x1364('0x4e')](_0x3aafc4[_0x1364('0x8c')],function(_0x214c43){return _0x214c43[_0x1364('0x8d')]===_0x473037[_0x1364('0x74')];});if(!_0x2c1637){logger[_0x1364('0x68')](util[_0x1364('0x34')](_0x1364('0x8e'),_0x71adf7[_0x1364('0x4c')]['id'],_0x473037['bucket']));return createBucket(_0xbb8487[_0x1364('0x88')],_0xbb8487[_0x1364('0x8a')],_0x473037[_0x1364('0x8b')],_0x473037[_0x1364('0x74')]);}logger[_0x1364('0x68')](util['format'](_0x1364('0x8f'),_0x71adf7['params']['id'],_0x473037[_0x1364('0x74')]));return;}})['then'](function(_0x4b2428){if(_0x762f53['transcribeStatus']===_0x1364('0x90')){return transcribe(_0x71adf7[_0x1364('0x4c')]['id'],_0xbb8487[_0x1364('0x88')],_0xbb8487[_0x1364('0x8a')],_0x473037['transcribeRegion'],_0x473037[_0x1364('0x74')],_0x762f53[_0x1364('0x55')],_0x473037[_0x1364('0x85')]);}else{logger[_0x1364('0x68')](util['format'](_0x1364('0x91'),_0x71adf7[_0x1364('0x4c')]['id']));return{'transcribeStatus':_0x1364('0x92')};}})[_0x1364('0x29')](function(_0x332f7f){if(_0x332f7f){_0x332f7f['tempSentiment']=_0x71adf7[_0x1364('0x50')][_0x1364('0x83')];return _0x762f53[_0x1364('0x93')](_0x332f7f);}})[_0x1364('0x29')](respondWithResult(_0x3e2678,null))[_0x1364('0x4a')](handleError(_0x3e2678,null));};function writeFile(_0x5afa41,_0x3349c5){return new Promise(function(_0x115895,_0x379a96){fs['writeFile'](_0x3349c5,_0x5afa41,function(_0x3d4ca1,_0x259203){if(_0x3d4ca1){return _0x379a96(_0x3d4ca1);}else{return _0x115895(_0x259203);}});});}exports[_0x1364('0x94')]=function(_0xfd1764,_0x20a7fa,_0xd936c8){return db['VoiceRecording'][_0x1364('0x7e')]({'where':{'id':_0xfd1764[_0x1364('0x4c')]['id']}})[_0x1364('0x29')](handleEntityNotFound(_0x20a7fa))[_0x1364('0x29')](function(_0x1737c4){if(_0x1737c4&&_0x1737c4[_0x1364('0x95')]){var _0xdd2dea=_0x1737c4[_0x1364('0x95')];var _0x16e3ee=config['root']+_0x1364('0x96')+_0x1737c4['id']+'.txt';if(fs['existsSync'](_0x16e3ee)){return _0x16e3ee;}return writeFile(_0xdd2dea,_0x16e3ee)[_0x1364('0x29')](function(){return _0x16e3ee;});}else{throw new db['Sequelize'][(_0x1364('0x5b'))](_0x1364('0x97'));}})['then'](function(_0x55ad32){return _0x20a7fa[_0x1364('0x52')](_0x55ad32);})[_0x1364('0x4a')](handleError(_0x20a7fa));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 64f62af..7ede7fe 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 _0xe79f=['uniqueid','transcribeStatus','./voiceRecording.attributes','define'];(function(_0x156702,_0x5c673a){var _0x2e5609=function(_0x5851ee){while(--_0x5851ee){_0x156702['push'](_0x156702['shift']());}};_0x2e5609(++_0x5c673a);}(_0xe79f,0x13a));var _0xfe79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe79f[_0x321bb2];return _0x9c12ed;};'use strict';var attributes=require(_0xfe79('0x0'));module['exports']=function(_0x259811,_0x5b22f7){return _0x259811[_0xfe79('0x1')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xfe79('0x2')]},{'name':_0xfe79('0x3'),'fields':[_0xfe79('0x3')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b37=['define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x1466b3,_0x4e341c){var _0x51baf8=function(_0x24172a){while(--_0x24172a){_0x1466b3['push'](_0x1466b3['shift']());}};_0x51baf8(++_0x4e341c);}(_0x2b37,0x12b));var _0x72b3=function(_0x257191,_0x56895d){_0x257191=_0x257191-0x0;var _0x19e7de=_0x2b37[_0x257191];return _0x19e7de;};'use strict';var attributes=require(_0x72b3('0x0'));module[_0x72b3('0x1')]=function(_0x3fbc04,_0x22f924){return _0x3fbc04[_0x72b3('0x2')](_0x72b3('0x3'),attributes,{'tableName':_0x72b3('0x4'),'paranoid':![],'indexes':[{'name':_0x72b3('0x5'),'fields':[_0x72b3('0x5')]},{'name':_0x72b3('0x6'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index f018d27..80765b8 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 _0x2da6=['stringify','error','code','message','result','catch','VoiceRecording','body','options','raw','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','Setting','findOne','create','callRecordingEncryption','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xd49e15,_0x5e34ac){var _0x306b6a=function(_0x38ce9c){while(--_0x38ce9c){_0xd49e15['push'](_0xd49e15['shift']());}};_0x306b6a(++_0x5e34ac);}(_0x2da6,0x1dd));var _0x62da=function(_0x4c1499,_0x5b1a34){_0x4c1499=_0x4c1499-0x0;var _0x14ba2d=_0x2da6[_0x4c1499];return _0x14ba2d;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100e73,_0x9d9139,_0x310c15){return new BPromise(function(_0x16f919,_0xbfd2b0){return client['request'](_0x100e73,_0x310c15)[_0x62da('0xc')](function(_0x2a3937){logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,'request\x20sent');logger[_0x62da('0xf')](_0x62da('0x10'),_0x9d9139,_0x62da('0x11'),JSON[_0x62da('0x12')](_0x2a3937));if(_0x2a3937[_0x62da('0x13')]){if(_0x2a3937['error'][_0x62da('0x14')]===0x1f4){logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0xbfd2b0(_0x2a3937['error']['message']);}logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0x16f919(_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);}else{logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,_0x62da('0x11'));_0x16f919(_0x2a3937[_0x62da('0x16')][_0x62da('0x15')]);}})[_0x62da('0x17')](function(_0x1f6bc8){logger[_0x62da('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x9d9139,_0x1f6bc8);_0xbfd2b0(_0x1f6bc8);});});}exports['UpdateVoiceRecording']=function(_0xa7050b){var _0x4ae4fb=this;return new Promise(function(_0x4d6482,_0x264366){return db[_0x62da('0x18')]['update'](_0xa7050b[_0x62da('0x19')],{'raw':_0xa7050b['options']?_0xa7050b[_0x62da('0x1a')][_0x62da('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa7050b[_0x62da('0x1a')]?_0xa7050b[_0x62da('0x1a')][_0x62da('0x1c')]||null:null,'attributes':_0xa7050b[_0x62da('0x1a')]?_0xa7050b[_0x62da('0x1a')][_0x62da('0x1d')]||null:null,'limit':_0xa7050b[_0x62da('0x1a')]?_0xa7050b['options'][_0x62da('0x1e')]||null:null})[_0x62da('0xc')](function(_0x2fd925){logger[_0x62da('0xd')](_0x62da('0x1f'),_0xa7050b);logger[_0x62da('0xf')](_0x62da('0x1f'),_0xa7050b,JSON['stringify'](_0x2fd925));_0x4d6482(_0x2fd925);})['catch'](function(_0x509fd9){logger[_0x62da('0x13')](_0x62da('0x1f'),_0x509fd9[_0x62da('0x15')],_0xa7050b);_0x264366(_0x4ae4fb[_0x62da('0x13')](0x1f4,_0x509fd9['message']));});});};exports[_0x62da('0x20')]=function(_0x3b9c06){var _0x5f0a9c=this;return new Promise(function(_0x3ccf96,_0x195dc4){var _0x1775ea=require('../../components/encryptor');var _0x41de3a;return db[_0x62da('0x21')][_0x62da('0x22')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x3c6274){_0x41de3a=_0x3c6274;return db[_0x62da('0x18')][_0x62da('0x23')](_0x3b9c06['body']);})[_0x62da('0xc')](function(_0x2a4681){if(_0x41de3a[_0x62da('0x24')]&&fs[_0x62da('0x25')](_0x2a4681[_0x62da('0x26')])){var _0x1cf765=util['format'](_0x62da('0x27'),_0x2a4681['value']);return _0x1775ea[_0x62da('0x28')](_0x2a4681[_0x62da('0x26')],_0x1cf765,config[_0x62da('0x29')][_0x62da('0x2a')])[_0x62da('0xc')](function(){fs[_0x62da('0x2b')](_0x2a4681['value']);logger[_0x62da('0xd')](_0x62da('0x2c'));return _0x2a4681;});}return _0x2a4681;})[_0x62da('0xc')](function(_0x5107b1){logger[_0x62da('0xd')](_0x62da('0x20'),_0x3b9c06);logger[_0x62da('0xf')]('CreateVoiceRecording',_0x3b9c06,JSON[_0x62da('0x12')](_0x5107b1));_0x3ccf96(_0x5107b1);})[_0x62da('0x17')](function(_0x55eda7){logger[_0x62da('0x13')](_0x62da('0x20'),_0x55eda7['message'],_0x3b9c06);_0x195dc4(_0x5f0a9c[_0x62da('0x13')](0x1f4,_0x55eda7[_0x62da('0x15')]));});});}; \ No newline at end of file +var _0x583c=['options','raw','where','attributes','limit','debug','stringify','catch','Setting','callRecordingEncryption','create','value','format','%s.cypher','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','message','result','UpdateVoiceRecording','VoiceRecording','body'];(function(_0x47f38d,_0x4ccf85){var _0xf5b371=function(_0x1d3608){while(--_0x1d3608){_0x47f38d['push'](_0x47f38d['shift']());}};_0xf5b371(++_0x4ccf85);}(_0x583c,0x12b));var _0xc583=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x583c[_0x1e6db3];return _0x1de886;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var moment=require(_0xc583('0x2'));var BPromise=require(_0xc583('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc583('0x4'));var db=require(_0xc583('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc583('0x6'));var config=require(_0xc583('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc583('0x8')][_0xc583('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2719df,_0x1dd37c,_0x48a8d4){return new BPromise(function(_0x21ed88,_0x26cec0){return client['request'](_0x2719df,_0x48a8d4)[_0xc583('0xa')](function(_0x24ab4f){logger[_0xc583('0xb')](_0xc583('0xc'),_0x1dd37c,_0xc583('0xd'));logger['debug'](_0xc583('0xe'),_0x1dd37c,_0xc583('0xd'),JSON['stringify'](_0x24ab4f));if(_0x24ab4f[_0xc583('0xf')]){if(_0x24ab4f[_0xc583('0xf')]['code']===0x1f4){logger[_0xc583('0xf')](_0xc583('0xc'),_0x1dd37c,_0x24ab4f[_0xc583('0xf')][_0xc583('0x10')]);return _0x26cec0(_0x24ab4f[_0xc583('0xf')][_0xc583('0x10')]);}logger[_0xc583('0xf')](_0xc583('0xc'),_0x1dd37c,_0x24ab4f[_0xc583('0xf')]['message']);return _0x21ed88(_0x24ab4f[_0xc583('0xf')]['message']);}else{logger[_0xc583('0xb')](_0xc583('0xc'),_0x1dd37c,'request\x20sent');_0x21ed88(_0x24ab4f[_0xc583('0x11')][_0xc583('0x10')]);}})['catch'](function(_0x7d1690){logger[_0xc583('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x1dd37c,_0x7d1690);_0x26cec0(_0x7d1690);});});}exports[_0xc583('0x12')]=function(_0x8a2d84){var _0x12aac2=this;return new Promise(function(_0x36e0fd,_0x5433ec){return db[_0xc583('0x13')]['update'](_0x8a2d84[_0xc583('0x14')],{'raw':_0x8a2d84[_0xc583('0x15')]?_0x8a2d84[_0xc583('0x15')][_0xc583('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8a2d84[_0xc583('0x15')]?_0x8a2d84[_0xc583('0x15')][_0xc583('0x17')]||null:null,'attributes':_0x8a2d84[_0xc583('0x15')]?_0x8a2d84[_0xc583('0x15')][_0xc583('0x18')]||null:null,'limit':_0x8a2d84[_0xc583('0x15')]?_0x8a2d84[_0xc583('0x15')][_0xc583('0x19')]||null:null})['then'](function(_0x542256){logger[_0xc583('0xb')](_0xc583('0x12'),_0x8a2d84);logger[_0xc583('0x1a')]('UpdateVoiceRecording',_0x8a2d84,JSON[_0xc583('0x1b')](_0x542256));_0x36e0fd(_0x542256);})[_0xc583('0x1c')](function(_0x37f156){logger[_0xc583('0xf')](_0xc583('0x12'),_0x37f156['message'],_0x8a2d84);_0x5433ec(_0x12aac2['error'](0x1f4,_0x37f156[_0xc583('0x10')]));});});};exports['CreateVoiceRecording']=function(_0x45ef74){var _0xcbe9b2=this;return new Promise(function(_0xbabf24,_0x1e7809){var _0x24aab5=require('../../components/encryptor');var _0x2dafb4;return db[_0xc583('0x1d')]['findOne']({'attributes':['id',_0xc583('0x1e')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x2c9088){_0x2dafb4=_0x2c9088;return db[_0xc583('0x13')][_0xc583('0x1f')](_0x45ef74[_0xc583('0x14')]);})[_0xc583('0xa')](function(_0x19079b){if(_0x2dafb4[_0xc583('0x1e')]&&fs['existsSync'](_0x19079b[_0xc583('0x20')])){var _0x390bc3=util[_0xc583('0x21')](_0xc583('0x22'),_0x19079b[_0xc583('0x20')]);return _0x24aab5[_0xc583('0x23')](_0x19079b['value'],_0x390bc3,config[_0xc583('0x24')]['recording'])['then'](function(){fs[_0xc583('0x25')](_0x19079b[_0xc583('0x20')]);logger[_0xc583('0xb')](_0xc583('0x26'));return _0x19079b;});}return _0x19079b;})[_0xc583('0xa')](function(_0x4a9679){logger[_0xc583('0xb')](_0xc583('0x27'),_0x45ef74);logger[_0xc583('0x1a')]('CreateVoiceRecording',_0x45ef74,JSON[_0xc583('0x1b')](_0x4a9679));_0xbabf24(_0x4a9679);})['catch'](function(_0x1aa62a){logger[_0xc583('0xf')](_0xc583('0x27'),_0x1aa62a[_0xc583('0x10')],_0x45ef74);_0x1e7809(_0xcbe9b2[_0xc583('0xf')](0x1f4,_0x1aa62a['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 613cf7e..e0eda83 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 _0x0c14=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0xf7058b,_0x22c9b7){var _0x24cbf0=function(_0x2997ac){while(--_0x2997ac){_0xf7058b['push'](_0xf7058b['shift']());}};_0x24cbf0(++_0x22c9b7);}(_0x0c14,0xc7));var _0x40c1=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x0c14[_0x166d93];return _0xba708;};'use strict';var multer=require(_0x40c1('0x0'));var util=require(_0x40c1('0x1'));var path=require(_0x40c1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x40c1('0x3')]();var fs_extra=require(_0x40c1('0x4'));var auth=require(_0x40c1('0x5'));var interaction=require(_0x40c1('0x6'));var config=require(_0x40c1('0x7'));var controller=require(_0x40c1('0x8'));router[_0x40c1('0x9')]('/',auth[_0x40c1('0xa')](),controller[_0x40c1('0xb')]);router[_0x40c1('0x9')](_0x40c1('0xc'),auth[_0x40c1('0xa')](),controller[_0x40c1('0xd')]);router[_0x40c1('0x9')](_0x40c1('0xe'),auth[_0x40c1('0xa')](),controller[_0x40c1('0xf')]);router[_0x40c1('0x10')]('/',auth['isAuthenticated'](),controller[_0x40c1('0x11')]);router[_0x40c1('0x12')](_0x40c1('0xe'),auth['isAuthenticated'](),controller[_0x40c1('0x13')]);router[_0x40c1('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x40c1('0x15')]=router; \ No newline at end of file +var _0xab43=['../../components/auth/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','/describe','post','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0xab43,0x162));var _0x3ab4=function(_0x112112,_0x5dd2e8){_0x112112=_0x112112-0x0;var _0x3fb2a0=_0xab43[_0x112112];return _0x3fb2a0;};'use strict';var multer=require(_0x3ab4('0x0'));var util=require(_0x3ab4('0x1'));var path=require(_0x3ab4('0x2'));var timeout=require(_0x3ab4('0x3'));var express=require(_0x3ab4('0x4'));var router=express['Router']();var fs_extra=require(_0x3ab4('0x5'));var auth=require(_0x3ab4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3ab4('0x7'));var controller=require(_0x3ab4('0x8'));router['get']('/',auth[_0x3ab4('0x9')](),controller[_0x3ab4('0xa')]);router[_0x3ab4('0xb')](_0x3ab4('0xc'),auth[_0x3ab4('0x9')](),controller['describe']);router[_0x3ab4('0xb')]('/:id',auth[_0x3ab4('0x9')](),controller['show']);router[_0x3ab4('0xd')]('/',auth[_0x3ab4('0x9')](),controller[_0x3ab4('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3ab4('0xf')]);router[_0x3ab4('0x10')](_0x3ab4('0x11'),auth[_0x3ab4('0x9')](),controller[_0x3ab4('0x12')]);module[_0x3ab4('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index c65f61c..c6cf094 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 _0x1971=['blind','attended','STRING','moment','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1971,0x10c));var _0x1197=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x1971[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1197('0x0'));module['exports']={'type':{'type':Sequelize[_0x1197('0x1')](_0x1197('0x2'),_0x1197('0x3'))},'result':{'type':Sequelize[_0x1197('0x4')]},'transfererchannel':{'type':Sequelize[_0x1197('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x1197('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x1197('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x1197('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x1197('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x1197('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x1197('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x1197('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x1197('0x4')]},'transfereecontext':{'type':Sequelize[_0x1197('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x1197('0x4')]},'isexternal':{'type':Sequelize[_0x1197('0x1')]('Yes','No')},'context':{'type':Sequelize[_0x1197('0x4')]},'extension':{'type':Sequelize[_0x1197('0x4')]}}; \ No newline at end of file +var _0x3245=['ENUM','STRING','Yes','sequelize'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0x3245,0x10b));var _0x5324=function(_0x25d5e9,_0x340fda){_0x25d5e9=_0x25d5e9-0x0;var _0xa351e2=_0x3245[_0x25d5e9];return _0xa351e2;};'use strict';var Sequelize=require(_0x5324('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x5324('0x1')]('blind','attended')},'result':{'type':Sequelize[_0x5324('0x2')]},'transfererchannel':{'type':Sequelize[_0x5324('0x2')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x5324('0x2')]},'transfererconnectedlinenum':{'type':Sequelize[_0x5324('0x2')]},'transfererconnectedlinename':{'type':Sequelize[_0x5324('0x2')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x5324('0x2')]},'transfererlinkedid':{'type':Sequelize[_0x5324('0x2')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x5324('0x2')]},'transfereecalleridname':{'type':Sequelize[_0x5324('0x2')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x5324('0x2')]},'transfereeconnectedlinename':{'type':Sequelize[_0x5324('0x2')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x5324('0x2')]},'transfereeexten':{'type':Sequelize[_0x5324('0x2')]},'transfereelinkedid':{'type':Sequelize[_0x5324('0x2')]},'isexternal':{'type':Sequelize[_0x5324('0x1')](_0x5324('0x3'),'No')},'context':{'type':Sequelize[_0x5324('0x2')]},'extension':{'type':Sequelize[_0x5324('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 0f6bae4..2e0aa44 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 _0x198a=['VoiceTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map'];(function(_0x5567f7,_0x356dd7){var _0xd40c22=function(_0x42a2c3){while(--_0x42a2c3){_0x5567f7['push'](_0x5567f7['shift']());}};_0xd40c22(++_0x356dd7);}(_0x198a,0xb9));var _0xa198=function(_0x27f46b,_0x5ca62d){_0x27f46b=_0x27f46b-0x0;var _0x4a08e9=_0x198a[_0x27f46b];return _0x4a08e9;};'use strict';var emlformat=require(_0xa198('0x0'));var rimraf=require(_0xa198('0x1'));var zipdir=require(_0xa198('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa198('0x3'));var moment=require(_0xa198('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa198('0x5'));var util=require(_0xa198('0x6'));var path=require(_0xa198('0x7'));var sox=require(_0xa198('0x8'));var csv=require(_0xa198('0x9'));var ejs=require(_0xa198('0xa'));var fs=require('fs');var fs_extra=require(_0xa198('0xb'));var _=require('lodash');var squel=require(_0xa198('0xc'));var crypto=require(_0xa198('0xd'));var jsforce=require(_0xa198('0xe'));var deskjs=require(_0xa198('0xf'));var toCsv=require(_0xa198('0x9'));var querystring=require(_0xa198('0x10'));var Papa=require(_0xa198('0x11'));var Redis=require(_0xa198('0x12'));var authService=require(_0xa198('0x13'));var qs=require(_0xa198('0x14'));var as=require(_0xa198('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa198('0x16'));var utils=require(_0xa198('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa198('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x526031,_0x43e9e1){_0x43e9e1=_0x43e9e1||0xcc;return function(_0x59aed1){if(_0x59aed1){return _0x526031['sendStatus'](_0x43e9e1);}return _0x526031[_0xa198('0x19')](_0x43e9e1)[_0xa198('0x1a')]();};}function respondWithResult(_0x1b2392,_0x151fc8){_0x151fc8=_0x151fc8||0xc8;return function(_0x5c6483){if(_0x5c6483){return _0x1b2392[_0xa198('0x19')](_0x151fc8)[_0xa198('0x1b')](_0x5c6483);}};}function respondWithFilteredResult(_0x2a6547,_0x52d506){return function(_0x428cee){if(_0x428cee){var _0x39cd35=typeof _0x52d506[_0xa198('0x1c')]===_0xa198('0x1d')&&typeof _0x52d506[_0xa198('0x1e')]===_0xa198('0x1d');var _0x15bd91=_0x428cee[_0xa198('0x1f')];var _0x3c6af1=_0x39cd35?0x0:_0x52d506[_0xa198('0x1c')];var _0x267b13=_0x39cd35?_0x428cee['count']:_0x52d506[_0xa198('0x1c')]+_0x52d506[_0xa198('0x1e')];var _0x158b41;if(_0x267b13>=_0x15bd91){_0x267b13=_0x15bd91;_0x158b41=0xc8;}else{_0x158b41=0xce;}_0x2a6547[_0xa198('0x19')](_0x158b41);return _0x2a6547[_0xa198('0x20')](_0xa198('0x21'),_0x3c6af1+'-'+_0x267b13+'/'+_0x15bd91)['json'](_0x428cee);}return null;};}function patchUpdates(_0x252421){return function(_0x6ed901){try{jsonpatch[_0xa198('0x22')](_0x6ed901,_0x252421,!![]);}catch(_0x52eac){return BPromise[_0xa198('0x23')](_0x52eac);}return _0x6ed901[_0xa198('0x24')]();};}function saveUpdates(_0x32f12b,_0xaa26){return function(_0x1cc2f8){if(_0x1cc2f8){return _0x1cc2f8[_0xa198('0x25')](_0x32f12b)['then'](function(_0x2c8c05){return _0x2c8c05;});}return null;};}function removeEntity(_0x36e018,_0x506d90){return function(_0x371362){if(_0x371362){return _0x371362[_0xa198('0x26')]()[_0xa198('0x27')](function(){_0x36e018[_0xa198('0x19')](0xcc)[_0xa198('0x1a')]();});}};}function handleEntityNotFound(_0x9ef417,_0x29cede){return function(_0x116caa){if(!_0x116caa){_0x9ef417[_0xa198('0x28')](0x194);}return _0x116caa;};}function handleError(_0x5d095c,_0x202850){_0x202850=_0x202850||0x1f4;return function(_0x5cac55){logger['error'](_0x5cac55[_0xa198('0x29')]);if(_0x5cac55[_0xa198('0x2a')]){delete _0x5cac55['name'];}_0x5d095c['status'](_0x202850)[_0xa198('0x2b')](_0x5cac55);};}exports[_0xa198('0x2c')]=function(_0x4d1a49,_0x15d09d){var _0x1f956d={},_0xcc6f56={},_0x371e21={'count':0x0,'rows':[]};var _0x5cb914=_[_0xa198('0x2d')](db[_0xa198('0x2e')][_0xa198('0x2f')],function(_0x54fa27){return{'name':_0x54fa27[_0xa198('0x30')],'type':_0x54fa27[_0xa198('0x31')][_0xa198('0x32')]};});_0xcc6f56['model']=_['map'](_0x5cb914,_0xa198('0x2a'));_0xcc6f56['query']=_['keys'](_0x4d1a49[_0xa198('0x33')]);_0xcc6f56[_0xa198('0x34')]=_[_0xa198('0x35')](_0xcc6f56[_0xa198('0x36')],_0xcc6f56[_0xa198('0x33')]);_0x1f956d['attributes']=_[_0xa198('0x35')](_0xcc6f56[_0xa198('0x36')],qs['fields'](_0x4d1a49[_0xa198('0x33')][_0xa198('0x37')]));_0x1f956d[_0xa198('0x38')]=_0x1f956d['attributes'][_0xa198('0x39')]?_0x1f956d[_0xa198('0x38')]:_0xcc6f56[_0xa198('0x36')];if(!_0x4d1a49[_0xa198('0x33')][_0xa198('0x3a')](_0xa198('0x3b'))){_0x1f956d['limit']=qs['limit'](_0x4d1a49[_0xa198('0x33')][_0xa198('0x1e')]);_0x1f956d[_0xa198('0x1c')]=qs['offset'](_0x4d1a49[_0xa198('0x33')][_0xa198('0x1c')]);}_0x1f956d['order']=qs['sort'](_0x4d1a49['query']['sort']);_0x1f956d[_0xa198('0x3c')]=qs[_0xa198('0x34')](_[_0xa198('0x3d')](_0x4d1a49[_0xa198('0x33')],_0xcc6f56[_0xa198('0x34')]),_0x5cb914);if(_0x4d1a49[_0xa198('0x33')][_0xa198('0x3e')]){_0x1f956d[_0xa198('0x3c')]=_[_0xa198('0x3f')](_0x1f956d['where'],{'$or':_[_0xa198('0x2d')](_0x5cb914,function(_0x443e73){if(_0x443e73[_0xa198('0x31')]!=='VIRTUAL'){var _0x5c0be4={};_0x5c0be4[_0x443e73[_0xa198('0x2a')]]={'$like':'%'+_0x4d1a49['query'][_0xa198('0x3e')]+'%'};return _0x5c0be4;}})});}_0x1f956d=_[_0xa198('0x3f')]({},_0x1f956d,_0x4d1a49[_0xa198('0x40')]);var _0x3ec68f={'where':_0x1f956d[_0xa198('0x3c')]};return db[_0xa198('0x2e')][_0xa198('0x1f')](_0x3ec68f)[_0xa198('0x27')](function(_0x30b54c){_0x371e21[_0xa198('0x1f')]=_0x30b54c;if(_0x4d1a49[_0xa198('0x33')][_0xa198('0x41')]){_0x1f956d['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0xa198('0x42')](_0x1f956d);})[_0xa198('0x27')](function(_0x5ab1dc){_0x371e21[_0xa198('0x43')]=_0x5ab1dc;return _0x371e21;})[_0xa198('0x27')](respondWithFilteredResult(_0x15d09d,_0x1f956d))[_0xa198('0x44')](handleError(_0x15d09d,null));};exports[_0xa198('0x45')]=function(_0x1023f8,_0x498d63){var _0x217fce={'raw':!![],'where':{'id':_0x1023f8[_0xa198('0x46')]['id']}},_0x1d3aa0={};_0x1d3aa0[_0xa198('0x36')]=_[_0xa198('0x47')](db[_0xa198('0x2e')]['rawAttributes']);_0x1d3aa0[_0xa198('0x33')]=_[_0xa198('0x47')](_0x1023f8[_0xa198('0x33')]);_0x1d3aa0[_0xa198('0x34')]=_[_0xa198('0x35')](_0x1d3aa0[_0xa198('0x36')],_0x1d3aa0[_0xa198('0x33')]);_0x217fce[_0xa198('0x38')]=_[_0xa198('0x35')](_0x1d3aa0['model'],qs[_0xa198('0x37')](_0x1023f8['query'][_0xa198('0x37')]));_0x217fce[_0xa198('0x38')]=_0x217fce[_0xa198('0x38')][_0xa198('0x39')]?_0x217fce['attributes']:_0x1d3aa0[_0xa198('0x36')];if(_0x1023f8[_0xa198('0x33')]['includeAll']){_0x217fce[_0xa198('0x48')]=[{'all':!![]}];}_0x217fce=_[_0xa198('0x3f')]({},_0x217fce,_0x1023f8['options']);return db[_0xa198('0x2e')][_0xa198('0x49')](_0x217fce)[_0xa198('0x27')](handleEntityNotFound(_0x498d63,null))['then'](respondWithResult(_0x498d63,null))[_0xa198('0x44')](handleError(_0x498d63,null));};exports[_0xa198('0x4a')]=function(_0x1b6af4,_0x8a0335){return db['VoiceTransferReport'][_0xa198('0x4a')](_0x1b6af4[_0xa198('0x4b')],{})[_0xa198('0x27')](respondWithResult(_0x8a0335,0xc9))['catch'](handleError(_0x8a0335,null));};exports[_0xa198('0x25')]=function(_0x4c95c8,_0x2ec549){if(_0x4c95c8['body']['id']){delete _0x4c95c8[_0xa198('0x4b')]['id'];}return db[_0xa198('0x2e')]['find']({'where':{'id':_0x4c95c8[_0xa198('0x46')]['id']}})[_0xa198('0x27')](handleEntityNotFound(_0x2ec549,null))[_0xa198('0x27')](saveUpdates(_0x4c95c8['body'],null))[_0xa198('0x27')](respondWithResult(_0x2ec549,null))[_0xa198('0x44')](handleError(_0x2ec549,null));};exports[_0xa198('0x26')]=function(_0x3b8854,_0x2d2606){return db[_0xa198('0x2e')][_0xa198('0x49')]({'where':{'id':_0x3b8854['params']['id']}})[_0xa198('0x27')](handleEntityNotFound(_0x2d2606,null))[_0xa198('0x27')](removeEntity(_0x2d2606,null))[_0xa198('0x44')](handleError(_0x2d2606,null));};exports[_0xa198('0x4c')]=function(_0x2cbd2d,_0x2b836d){return db[_0xa198('0x2e')][_0xa198('0x4c')]()[_0xa198('0x27')](respondWithResult(_0x2b836d,null))['catch'](handleError(_0x2b836d,null));}; \ No newline at end of file +var _0xc193=['end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','type','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','VoiceTransferReport','includeAll','findAll','rows','catch','rawAttributes','intersection','length','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','status'];(function(_0x27b728,_0x23b21c){var _0x451fde=function(_0x6b760d){while(--_0x6b760d){_0x27b728['push'](_0x27b728['shift']());}};_0x451fde(++_0x23b21c);}(_0xc193,0x1a9));var _0x3c19=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc193[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x3c19('0x0'));var rimraf=require(_0x3c19('0x1'));var zipdir=require(_0x3c19('0x2'));var jsonpatch=require(_0x3c19('0x3'));var rp=require(_0x3c19('0x4'));var moment=require(_0x3c19('0x5'));var BPromise=require(_0x3c19('0x6'));var Mustache=require(_0x3c19('0x7'));var util=require(_0x3c19('0x8'));var path=require(_0x3c19('0x9'));var sox=require(_0x3c19('0xa'));var csv=require(_0x3c19('0xb'));var ejs=require(_0x3c19('0xc'));var fs=require('fs');var fs_extra=require(_0x3c19('0xd'));var _=require(_0x3c19('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3c19('0xf'));var deskjs=require(_0x3c19('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3c19('0x11'));var Papa=require(_0x3c19('0x12'));var Redis=require(_0x3c19('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3c19('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c19('0x15'))(_0x3c19('0x16'));var utils=require('../../config/utils');var config=require(_0x3c19('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x356462,_0xd2265a){_0xd2265a=_0xd2265a||0xcc;return function(_0x4e4276){if(_0x4e4276){return _0x356462['sendStatus'](_0xd2265a);}return _0x356462[_0x3c19('0x18')](_0xd2265a)[_0x3c19('0x19')]();};}function respondWithResult(_0x524b8e,_0x407b9e){_0x407b9e=_0x407b9e||0xc8;return function(_0x1c5700){if(_0x1c5700){return _0x524b8e[_0x3c19('0x18')](_0x407b9e)[_0x3c19('0x1a')](_0x1c5700);}};}function respondWithFilteredResult(_0x4fddf0,_0xfa7e85){return function(_0x16052e){if(_0x16052e){var _0x174763=typeof _0xfa7e85['offset']==='undefined'&&typeof _0xfa7e85[_0x3c19('0x1b')]===_0x3c19('0x1c');var _0x2ea124=_0x16052e[_0x3c19('0x1d')];var _0x53a0f5=_0x174763?0x0:_0xfa7e85[_0x3c19('0x1e')];var _0xb68948=_0x174763?_0x16052e[_0x3c19('0x1d')]:_0xfa7e85[_0x3c19('0x1e')]+_0xfa7e85[_0x3c19('0x1b')];var _0x5ea38b;if(_0xb68948>=_0x2ea124){_0xb68948=_0x2ea124;_0x5ea38b=0xc8;}else{_0x5ea38b=0xce;}_0x4fddf0[_0x3c19('0x18')](_0x5ea38b);return _0x4fddf0[_0x3c19('0x1f')](_0x3c19('0x20'),_0x53a0f5+'-'+_0xb68948+'/'+_0x2ea124)[_0x3c19('0x1a')](_0x16052e);}return null;};}function patchUpdates(_0x26b50a){return function(_0xa93e8d){try{jsonpatch[_0x3c19('0x21')](_0xa93e8d,_0x26b50a,!![]);}catch(_0x573219){return BPromise[_0x3c19('0x22')](_0x573219);}return _0xa93e8d[_0x3c19('0x23')]();};}function saveUpdates(_0xb6e451,_0x2153b9){return function(_0x20847e){if(_0x20847e){return _0x20847e[_0x3c19('0x24')](_0xb6e451)[_0x3c19('0x25')](function(_0x2fe733){return _0x2fe733;});}return null;};}function removeEntity(_0x4fd1fd,_0x51a341){return function(_0x44a627){if(_0x44a627){return _0x44a627[_0x3c19('0x26')]()['then'](function(){_0x4fd1fd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x85bec8,_0x588211){return function(_0x5ccb76){if(!_0x5ccb76){_0x85bec8[_0x3c19('0x27')](0x194);}return _0x5ccb76;};}function handleError(_0x10aeba,_0x222ad8){_0x222ad8=_0x222ad8||0x1f4;return function(_0x4da10e){logger[_0x3c19('0x28')](_0x4da10e[_0x3c19('0x29')]);if(_0x4da10e[_0x3c19('0x2a')]){delete _0x4da10e[_0x3c19('0x2a')];}_0x10aeba[_0x3c19('0x18')](_0x222ad8)[_0x3c19('0x2b')](_0x4da10e);};}exports[_0x3c19('0x2c')]=function(_0x1a1da3,_0x54ee16){var _0x34a8e3={},_0xbe6090={},_0x2cc254={'count':0x0,'rows':[]};var _0x31cdeb=_[_0x3c19('0x2d')](db['VoiceTransferReport']['rawAttributes'],function(_0x62f5ed){return{'name':_0x62f5ed['fieldName'],'type':_0x62f5ed[_0x3c19('0x2e')]['key']};});_0xbe6090[_0x3c19('0x2f')]=_[_0x3c19('0x2d')](_0x31cdeb,_0x3c19('0x2a'));_0xbe6090[_0x3c19('0x30')]=_[_0x3c19('0x31')](_0x1a1da3[_0x3c19('0x30')]);_0xbe6090[_0x3c19('0x32')]=_['intersection'](_0xbe6090[_0x3c19('0x2f')],_0xbe6090[_0x3c19('0x30')]);_0x34a8e3[_0x3c19('0x33')]=_['intersection'](_0xbe6090[_0x3c19('0x2f')],qs[_0x3c19('0x34')](_0x1a1da3[_0x3c19('0x30')]['fields']));_0x34a8e3['attributes']=_0x34a8e3['attributes']['length']?_0x34a8e3['attributes']:_0xbe6090[_0x3c19('0x2f')];if(!_0x1a1da3['query'][_0x3c19('0x35')]('nolimit')){_0x34a8e3['limit']=qs[_0x3c19('0x1b')](_0x1a1da3[_0x3c19('0x30')][_0x3c19('0x1b')]);_0x34a8e3['offset']=qs[_0x3c19('0x1e')](_0x1a1da3[_0x3c19('0x30')][_0x3c19('0x1e')]);}_0x34a8e3['order']=qs[_0x3c19('0x36')](_0x1a1da3[_0x3c19('0x30')][_0x3c19('0x36')]);_0x34a8e3[_0x3c19('0x37')]=qs[_0x3c19('0x32')](_[_0x3c19('0x38')](_0x1a1da3['query'],_0xbe6090['filters']),_0x31cdeb);if(_0x1a1da3[_0x3c19('0x30')]['filter']){_0x34a8e3[_0x3c19('0x37')]=_['merge'](_0x34a8e3[_0x3c19('0x37')],{'$or':_[_0x3c19('0x2d')](_0x31cdeb,function(_0x3096fa){if(_0x3096fa[_0x3c19('0x2e')]!==_0x3c19('0x39')){var _0x2ae170={};_0x2ae170[_0x3096fa[_0x3c19('0x2a')]]={'$like':'%'+_0x1a1da3[_0x3c19('0x30')][_0x3c19('0x3a')]+'%'};return _0x2ae170;}})});}_0x34a8e3=_[_0x3c19('0x3b')]({},_0x34a8e3,_0x1a1da3[_0x3c19('0x3c')]);var _0x4f0ce7={'where':_0x34a8e3[_0x3c19('0x37')]};return db[_0x3c19('0x3d')][_0x3c19('0x1d')](_0x4f0ce7)[_0x3c19('0x25')](function(_0x1313cd){_0x2cc254['count']=_0x1313cd;if(_0x1a1da3[_0x3c19('0x30')][_0x3c19('0x3e')]){_0x34a8e3['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0x3c19('0x3f')](_0x34a8e3);})[_0x3c19('0x25')](function(_0x4a34fd){_0x2cc254[_0x3c19('0x40')]=_0x4a34fd;return _0x2cc254;})[_0x3c19('0x25')](respondWithFilteredResult(_0x54ee16,_0x34a8e3))[_0x3c19('0x41')](handleError(_0x54ee16,null));};exports['show']=function(_0x509b90,_0xfd720e){var _0x382052={'raw':!![],'where':{'id':_0x509b90['params']['id']}},_0x14b7f6={};_0x14b7f6[_0x3c19('0x2f')]=_[_0x3c19('0x31')](db[_0x3c19('0x3d')][_0x3c19('0x42')]);_0x14b7f6[_0x3c19('0x30')]=_['keys'](_0x509b90[_0x3c19('0x30')]);_0x14b7f6[_0x3c19('0x32')]=_[_0x3c19('0x43')](_0x14b7f6[_0x3c19('0x2f')],_0x14b7f6[_0x3c19('0x30')]);_0x382052[_0x3c19('0x33')]=_[_0x3c19('0x43')](_0x14b7f6['model'],qs[_0x3c19('0x34')](_0x509b90[_0x3c19('0x30')][_0x3c19('0x34')]));_0x382052[_0x3c19('0x33')]=_0x382052[_0x3c19('0x33')][_0x3c19('0x44')]?_0x382052[_0x3c19('0x33')]:_0x14b7f6[_0x3c19('0x2f')];if(_0x509b90[_0x3c19('0x30')]['includeAll']){_0x382052[_0x3c19('0x45')]=[{'all':!![]}];}_0x382052=_[_0x3c19('0x3b')]({},_0x382052,_0x509b90['options']);return db[_0x3c19('0x3d')][_0x3c19('0x46')](_0x382052)[_0x3c19('0x25')](handleEntityNotFound(_0xfd720e,null))[_0x3c19('0x25')](respondWithResult(_0xfd720e,null))[_0x3c19('0x41')](handleError(_0xfd720e,null));};exports[_0x3c19('0x47')]=function(_0x10570d,_0x4a4eef){return db['VoiceTransferReport']['create'](_0x10570d[_0x3c19('0x48')],{})[_0x3c19('0x25')](respondWithResult(_0x4a4eef,0xc9))[_0x3c19('0x41')](handleError(_0x4a4eef,null));};exports[_0x3c19('0x24')]=function(_0x4cbc75,_0x2ea694){if(_0x4cbc75[_0x3c19('0x48')]['id']){delete _0x4cbc75['body']['id'];}return db[_0x3c19('0x3d')][_0x3c19('0x46')]({'where':{'id':_0x4cbc75[_0x3c19('0x49')]['id']}})[_0x3c19('0x25')](handleEntityNotFound(_0x2ea694,null))[_0x3c19('0x25')](saveUpdates(_0x4cbc75[_0x3c19('0x48')],null))[_0x3c19('0x25')](respondWithResult(_0x2ea694,null))[_0x3c19('0x41')](handleError(_0x2ea694,null));};exports['destroy']=function(_0x4e558e,_0x1eebab){return db[_0x3c19('0x3d')]['find']({'where':{'id':_0x4e558e['params']['id']}})[_0x3c19('0x25')](handleEntityNotFound(_0x1eebab,null))[_0x3c19('0x25')](removeEntity(_0x1eebab,null))['catch'](handleError(_0x1eebab,null));};exports[_0x3c19('0x4a')]=function(_0x285ccb,_0x3ec5da){return db[_0x3c19('0x3d')][_0x3c19('0x4a')]()[_0x3c19('0x25')](respondWithResult(_0x3ec5da,null))[_0x3c19('0x41')](handleError(_0x3ec5da,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 4a99e45..c9a4a2a 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 _0x5f4f=['exports','define','VoiceTransferReport','report_call_transfer','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x57a3e4,_0xfbcea4){var _0x2f705b=function(_0x3d0214){while(--_0x3d0214){_0x57a3e4['push'](_0x57a3e4['shift']());}};_0x2f705b(++_0xfbcea4);}(_0x5f4f,0x86));var _0xf5f4=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f4f[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf5f4('0x0'))(_0xf5f4('0x1'));var moment=require(_0xf5f4('0x2'));var BPromise=require('bluebird');var rp=require(_0xf5f4('0x3'));var fs=require('fs');var path=require(_0xf5f4('0x4'));var rimraf=require('rimraf');var config=require(_0xf5f4('0x5'));var attributes=require('./voiceTransferReport.attributes');module[_0xf5f4('0x6')]=function(_0x562823,_0x49530d){return _0x562823[_0xf5f4('0x7')](_0xf5f4('0x8'),attributes,{'tableName':_0xf5f4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea2f=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','util','../../config/logger','api','moment','bluebird'];(function(_0x508a65,_0x35ba11){var _0x1c4f2f=function(_0x281449){while(--_0x281449){_0x508a65['push'](_0x508a65['shift']());}};_0x1c4f2f(++_0x35ba11);}(_0xea2f,0x187));var _0xfea2=function(_0x47e856,_0x43b64d){_0x47e856=_0x47e856-0x0;var _0x400d1c=_0xea2f[_0x47e856];return _0x400d1c;};'use strict';var _=require('lodash');var util=require(_0xfea2('0x0'));var logger=require(_0xfea2('0x1'))(_0xfea2('0x2'));var moment=require(_0xfea2('0x3'));var BPromise=require(_0xfea2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfea2('0x5'));var config=require(_0xfea2('0x6'));var attributes=require(_0xfea2('0x7'));module[_0xfea2('0x8')]=function(_0x5cae94,_0x24b1f7){return _0x5cae94[_0xfea2('0x9')](_0xfea2('0xa'),attributes,{'tableName':_0xfea2('0xb'),'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 0e2d6d9..3ba58fb 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 _0x65c7=['code','message','request\x20sent','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0x65c7,0x98));var _0x765c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x65c7[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x765c('0x0'));var util=require(_0x765c('0x1'));var moment=require(_0x765c('0x2'));var BPromise=require('bluebird');var rs=require(_0x765c('0x3'));var fs=require('fs');var Redis=require(_0x765c('0x4'));var db=require(_0x765c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x765c('0x6'))('rpc');var config=require(_0x765c('0x7'));var jayson=require(_0x765c('0x8'));var client=jayson[_0x765c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cc191,_0x5964d0,_0x3fd822){return new BPromise(function(_0x33e4eb,_0x481801){return client[_0x765c('0xa')](_0x1cc191,_0x3fd822)['then'](function(_0x381918){logger[_0x765c('0xb')](_0x765c('0xc'),_0x5964d0,'request\x20sent');logger[_0x765c('0xd')](_0x765c('0xe'),_0x5964d0,'request\x20sent',JSON['stringify'](_0x381918));if(_0x381918[_0x765c('0xf')]){if(_0x381918['error'][_0x765c('0x10')]===0x1f4){logger['error'](_0x765c('0xc'),_0x5964d0,_0x381918[_0x765c('0xf')][_0x765c('0x11')]);return _0x481801(_0x381918['error']['message']);}logger[_0x765c('0xf')](_0x765c('0xc'),_0x5964d0,_0x381918['error'][_0x765c('0x11')]);return _0x33e4eb(_0x381918[_0x765c('0xf')]['message']);}else{logger[_0x765c('0xb')](_0x765c('0xc'),_0x5964d0,_0x765c('0x12'));_0x33e4eb(_0x381918[_0x765c('0x13')]['message']);}})[_0x765c('0x14')](function(_0x9437eb){logger[_0x765c('0xf')](_0x765c('0xc'),_0x5964d0,_0x9437eb);_0x481801(_0x9437eb);});});}exports[_0x765c('0x15')]=function(_0x58fd1b){var _0x354501=this;return new Promise(function(_0x56b076,_0x3f87fb){return db[_0x765c('0x16')][_0x765c('0x17')](_0x58fd1b[_0x765c('0x18')],{'raw':_0x58fd1b[_0x765c('0x19')]?_0x58fd1b[_0x765c('0x19')][_0x765c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x551809){logger[_0x765c('0xb')](_0x765c('0x15'),_0x58fd1b);logger[_0x765c('0xd')](_0x765c('0x15'),_0x58fd1b,JSON[_0x765c('0x1b')](_0x551809));_0x56b076(_0x551809);})[_0x765c('0x14')](function(_0x2b33ca){logger[_0x765c('0xf')](_0x765c('0x15'),_0x2b33ca[_0x765c('0x11')],_0x58fd1b);_0x3f87fb(_0x354501[_0x765c('0xf')](0x1f4,_0x2b33ca['message']));});});}; \ No newline at end of file +var _0xf2eb=['VoiceTransferReport','create','options','CreateVoiceTransferReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','info','result','catch'];(function(_0x3ba359,_0x460586){var _0xd4d0b3=function(_0x176956){while(--_0x176956){_0x3ba359['push'](_0x3ba359['shift']());}};_0xd4d0b3(++_0x460586);}(_0xf2eb,0x1a4));var _0xbf2e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xf2eb[_0x373dee];return _0x46798f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbf2e('0x0'));var BPromise=require(_0xbf2e('0x1'));var rs=require(_0xbf2e('0x2'));var fs=require('fs');var Redis=require(_0xbf2e('0x3'));var db=require(_0xbf2e('0x4'))['db'];var utils=require(_0xbf2e('0x5'));var logger=require('../../config/logger')(_0xbf2e('0x6'));var config=require('../../config/environment');var jayson=require(_0xbf2e('0x7'));var client=jayson[_0xbf2e('0x8')][_0xbf2e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1aab79,_0x12298d,_0x5c21d4){return new BPromise(function(_0x1ed62f,_0x3be1ba){return client[_0xbf2e('0xa')](_0x1aab79,_0x5c21d4)[_0xbf2e('0xb')](function(_0x498ae2){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x12298d,_0xbf2e('0xc'));logger[_0xbf2e('0xd')](_0xbf2e('0xe'),_0x12298d,'request\x20sent',JSON[_0xbf2e('0xf')](_0x498ae2));if(_0x498ae2[_0xbf2e('0x10')]){if(_0x498ae2['error']['code']===0x1f4){logger[_0xbf2e('0x10')](_0xbf2e('0x11'),_0x12298d,_0x498ae2[_0xbf2e('0x10')]['message']);return _0x3be1ba(_0x498ae2[_0xbf2e('0x10')][_0xbf2e('0x12')]);}logger[_0xbf2e('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x12298d,_0x498ae2[_0xbf2e('0x10')][_0xbf2e('0x12')]);return _0x1ed62f(_0x498ae2[_0xbf2e('0x10')][_0xbf2e('0x12')]);}else{logger[_0xbf2e('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x12298d,_0xbf2e('0xc'));_0x1ed62f(_0x498ae2[_0xbf2e('0x14')][_0xbf2e('0x12')]);}})[_0xbf2e('0x15')](function(_0x701fc3){logger[_0xbf2e('0x10')](_0xbf2e('0x11'),_0x12298d,_0x701fc3);_0x3be1ba(_0x701fc3);});});}exports['CreateVoiceTransferReport']=function(_0x418c9b){var _0x5a3c25=this;return new Promise(function(_0x25f731,_0x3489a0){return db[_0xbf2e('0x16')][_0xbf2e('0x17')](_0x418c9b['body'],{'raw':_0x418c9b['options']?_0x418c9b[_0xbf2e('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xbf2e('0xb')](function(_0xeae641){logger[_0xbf2e('0x13')]('CreateVoiceTransferReport',_0x418c9b);logger['debug'](_0xbf2e('0x19'),_0x418c9b,JSON['stringify'](_0xeae641));_0x25f731(_0xeae641);})['catch'](function(_0x3c1939){logger[_0xbf2e('0x10')](_0xbf2e('0x19'),_0x3c1939['message'],_0x418c9b);_0x3489a0(_0x5a3c25[_0xbf2e('0x10')](0x1f4,_0x3c1939[_0xbf2e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 40cf3ab..f0af18c 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 _0xf4eb=['/hangup','isAuthenticated','isWebrtcLicence','hangup','/hold','hold','/unhold','unhold','/calls','calls','transfer','exports','express','/originate','originate','post'];(function(_0x5abc7c,_0xb14c7a){var _0x5eda45=function(_0x38c069){while(--_0x38c069){_0x5abc7c['push'](_0x5abc7c['shift']());}};_0x5eda45(++_0xb14c7a);}(_0xf4eb,0xec));var _0xbf4e=function(_0x292b24,_0x148730){_0x292b24=_0x292b24-0x0;var _0x262887=_0xf4eb[_0x292b24];return _0x262887;};'use strict';var express=require(_0xbf4e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0xbf4e('0x1'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0x2')]);router[_0xbf4e('0x3')](_0xbf4e('0x4'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x3')]('/answer',auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xbf4e('0x3')](_0xbf4e('0x8'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x3')](_0xbf4e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xb')]);router['post'](_0xbf4e('0xc'),auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xd')]);router['post']('/transfer',auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xe')]);module[_0xbf4e('0xf')]=router; \ No newline at end of file +var _0xb821=['/unhold','unhold','/calls','calls','/transfer','Router','../../components/auth/service','/originate','originate','post','/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','answer','/hold','hold'];(function(_0x5e9ae0,_0x16b4bb){var _0x204d50=function(_0x2eb142){while(--_0x2eb142){_0x5e9ae0['push'](_0x5e9ae0['shift']());}};_0x204d50(++_0x16b4bb);}(_0xb821,0xa7));var _0x1b82=function(_0x2983c9,_0x129ade){_0x2983c9=_0x2983c9-0x0;var _0x4b46c2=_0xb821[_0x2983c9];return _0x4b46c2;};'use strict';var express=require('express');var router=express[_0x1b82('0x0')]();var auth=require(_0x1b82('0x1'));var controller=require('./webbar.controller');router['post'](_0x1b82('0x2'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x1b82('0x3')]);router[_0x1b82('0x4')](_0x1b82('0x5'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x4')](_0x1b82('0x8'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x4')](_0x1b82('0xb'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0xc')]);router[_0x1b82('0x4')](_0x1b82('0xd'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xe')]);router[_0x1b82('0x4')](_0x1b82('0xf'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller[_0x1b82('0x10')]);router[_0x1b82('0x4')](_0x1b82('0x11'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller['transfer']);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 2d9e1be..de2f34e 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 _0x684c=['NotFound','error','code','result','catch','User','agent','then','VoiceChannels','all','filter','rows','UserId','\x20not\x20found!','originate','info','body','json','userId','callNumber','format','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','sessionId','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','length','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','emit','log','handleError:','stack','name','status','send'];(function(_0x49a8b2,_0x21304e){var _0xa0a34b=function(_0x229500){while(--_0x229500){_0x49a8b2['push'](_0x49a8b2['shift']());}};_0xa0a34b(++_0x21304e);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0xc684('0x0'));var fs=require('fs');var _=require(_0xc684('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xc684('0x2'));var util=require(_0xc684('0x3'));var BPromise=require(_0xc684('0x4'));var jayson=require(_0xc684('0x5'));var amiClient=jayson[_0xc684('0x6')]['http']({'port':0x232a});var logger=require(_0xc684('0x7'))(_0xc684('0x8'));var Redis=require(_0xc684('0x9'));config[_0xc684('0xa')]=_[_0xc684('0xb')](config[_0xc684('0xa')],{'host':_0xc684('0xc'),'port':0x18eb});var io=require(_0xc684('0xd'))(new Redis(config[_0xc684('0xa')]));var Schema=require(_0xc684('0xe'));var originateValidation=new Schema({'userId':{'type':_0xc684('0xf'),'required':[!![],_0xc684('0x10')]},'callNumber':{'type':_0xc684('0x11'),'required':[!![],_0xc684('0x12')]},'callerId':{'type':_0xc684('0x11')},'callbackUrl':{'type':_0xc684('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0xc684('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xc684('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xc684('0xf'),'required':[!![],_0xc684('0x10')]},'sessionId':{'type':_0xc684('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xc684('0xf'),'required':[!![],_0xc684('0x10')]},'sessionId':{'type':'string','required':[!![],_0xc684('0x13')]},'transferNumber':{'type':_0xc684('0x11'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc684('0x10')]},'sessionId':{'type':_0xc684('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xc684('0xf'),'required':[!![],_0xc684('0x10')]},'sessionId':{'type':_0xc684('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xc684('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc684('0x10')]}});function emit(_0x599c93,_0x4f0ef9,_0x51f0a8){logger['info'](_0x599c93,_0x4f0ef9,JSON['stringify'](_0x51f0a8));io['to'](_0x599c93)[_0xc684('0x14')](_0x4f0ef9,_0x51f0a8);}function handleError(_0x33943d){return function(_0x3b6f5e){console[_0xc684('0x15')](_0xc684('0x16'),_0x3b6f5e,_0x3b6f5e instanceof RangeError);logger['error'](_0x3b6f5e[_0xc684('0x17')]);if(_0x3b6f5e instanceof RangeError){if(_0x3b6f5e[_0xc684('0x18')]){delete _0x3b6f5e['name'];}_0x33943d[_0xc684('0x19')](0x194)[_0xc684('0x1a')](_0x3b6f5e);}else{if(_0x3b6f5e[_0xc684('0x18')]){delete _0x3b6f5e['name'];}_0x33943d[_0xc684('0x19')](0x1f4)[_0xc684('0x1a')](_0x3b6f5e);}};}function checkError(){return function(_0x1eddc7){if(!_0x1eddc7){throw new RangeError(_0xc684('0x1b'));}return _0x1eddc7;};}function respondWithRpcPromise(_0x2d1241,_0x4b7769){return new BPromise(function(_0x13d43f,_0x39f39a){var _0x1fb8b0=amiClient;return _0x1fb8b0['request'](_0x2d1241,_0x4b7769)['then'](function(_0x5a7b2e){if(_0x5a7b2e[_0xc684('0x1c')]){if(_0x5a7b2e[_0xc684('0x1c')][_0xc684('0x1d')]===0x1f4){return _0x39f39a(_0x5a7b2e['error']['message']);}return _0x13d43f(_0x5a7b2e['error']['message']);}else{_0x13d43f(_0x5a7b2e[_0xc684('0x1e')]);}})[_0xc684('0x1f')](function(_0x236f02){_0x39f39a(_0x236f02);});});}function getAgent(_0x4edb38){return db[_0xc684('0x20')]['findOne']({'where':{'id':_0x4edb38,'role':_0xc684('0x21')}})[_0xc684('0x22')](checkError());}function getAgentCheckSession(_0x13e09d,_0x49dad1){return new BPromise(function(_0x1f8e85,_0x4d9094){var _0x279998=respondWithRpcPromise(_0xc684('0x23'));var _0x210dcd=getAgent(_0x13e09d);Promise[_0xc684('0x24')]([_0x279998,_0x210dcd])['then'](function(_0xc0f77b){var _0x2710c1=_0xc0f77b[0x0];var _0x28a48a=_0xc0f77b[0x1];var _0x3c8a4d=_[_0xc684('0x25')](_0x2710c1[_0xc684('0x26')],function(_0x10db0d){return _0x10db0d[_0xc684('0x27')]==_0x28a48a['id']&&_0x10db0d['sessionId']==_0x49dad1;});if(_0x3c8a4d['length']==0x1){_0x1f8e85(_0x28a48a);}else{_0x4d9094(new RangeError('sessionId\x20'+_0x49dad1+_0xc684('0x28')));}});});}exports[_0xc684('0x29')]=function(_0x5cd228,_0x4e46c2){logger[_0xc684('0x2a')]('originate\x20fired:',_0x5cd228[_0xc684('0x2b')]);var _0x164da7=originateValidation[_0xc684('0xe')](_0x5cd228['body']);if(_0x164da7['length']>0x0){return _0x4e46c2[_0xc684('0x19')](0x190)[_0xc684('0x2c')](_0x164da7);}var _0x577ebe=_0x5cd228['body'][_0xc684('0x2d')];var _0x413128=_0x5cd228[_0xc684('0x2b')][_0xc684('0x2e')];var _0x35a790=_0x5cd228[_0xc684('0x2b')]['callerId'];var _0x1a0b08=_0x5cd228['body']['callbackUrl'];return getAgent(_0x577ebe)[_0xc684('0x22')](function(_0x46e014){logger['info']('entityFound:',_0x46e014[_0xc684('0x18')]);emit(util[_0xc684('0x2f')](_0xc684('0x30'),_0x46e014[_0xc684('0x18')]),_0xc684('0x31'),{'callNumber':_0x413128,'callerId':_0x35a790,'callbackUrl':_0x1a0b08});return _0x4e46c2['status'](0xc8)[_0xc684('0x2c')]({'error':![],'message':_0xc684('0x32')});})['catch'](handleError(_0x4e46c2));};exports['hangup']=function(_0x1923d7,_0x139972){logger[_0xc684('0x2a')](_0xc684('0x33'),_0x1923d7[_0xc684('0x2b')]);var _0x2ae788=hangupValidation[_0xc684('0xe')](_0x1923d7['body']);if(_0x2ae788['length']>0x0){return _0x139972[_0xc684('0x19')](0x190)[_0xc684('0x2c')](_0x2ae788);}var _0x56404b=_0x1923d7['body']['userId'];var _0x2c4e7c=_0x1923d7[_0xc684('0x2b')][_0xc684('0x34')];return getAgent(_0x56404b)[_0xc684('0x22')](function(_0x2649ee){logger['info'](_0xc684('0x35'),_0x2649ee['name']);emit(util[_0xc684('0x2f')](_0xc684('0x30'),_0x2649ee[_0xc684('0x18')]),_0xc684('0x36'),{'sessionId':_0x2c4e7c});return _0x139972['status'](0xc8)[_0xc684('0x2c')]({'error':![],'message':_0xc684('0x37')});})[_0xc684('0x1f')](handleError(_0x139972));};exports[_0xc684('0x38')]=function(_0x1497c2,_0x2f16b3){logger['info'](_0xc684('0x39'),_0x1497c2['body']);var _0x566c61=answerValidation[_0xc684('0xe')](_0x1497c2[_0xc684('0x2b')]);if(_0x566c61[_0xc684('0x3a')]>0x0){return _0x2f16b3['status'](0x190)['json'](_0x566c61);}var _0x4f288b=_0x1497c2['body']['userId'];var _0x189b26=_0x1497c2[_0xc684('0x2b')][_0xc684('0x34')];return getAgent(_0x4f288b)['then'](function(_0x2cd123){logger['info'](_0xc684('0x35'),_0x2cd123['name']);emit(util[_0xc684('0x2f')](_0xc684('0x30'),_0x2cd123[_0xc684('0x18')]),_0xc684('0x3b'),{'sessionId':_0x189b26});return _0x2f16b3[_0xc684('0x19')](0xc8)['json']({'error':![],'message':_0xc684('0x3c')});})[_0xc684('0x1f')](handleError(_0x2f16b3));};exports[_0xc684('0x3d')]=function(_0x3fd5e9,_0x1fb6ac){logger[_0xc684('0x2a')](_0xc684('0x3e'),_0x3fd5e9[_0xc684('0x2b')]);var _0x1bafa8=holdValidation['validate'](_0x3fd5e9[_0xc684('0x2b')]);if(_0x1bafa8[_0xc684('0x3a')]>0x0){return _0x1fb6ac['status'](0x190)[_0xc684('0x2c')](_0x1bafa8);}var _0x4fb1d5=_0x3fd5e9[_0xc684('0x2b')]['userId'];var _0x182534=_0x3fd5e9[_0xc684('0x2b')][_0xc684('0x34')];return getAgent(_0x4fb1d5)[_0xc684('0x22')](function(_0x1bfd8d){logger[_0xc684('0x2a')](_0xc684('0x35'),_0x1bfd8d[_0xc684('0x18')]);emit(util[_0xc684('0x2f')](_0xc684('0x30'),_0x1bfd8d['name']),_0xc684('0x3f'),{'sessionId':_0x182534});return _0x1fb6ac[_0xc684('0x19')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x1fb6ac));};exports[_0xc684('0x40')]=function(_0x1304a2,_0x5439ae){logger[_0xc684('0x2a')](_0xc684('0x41'),_0x1304a2[_0xc684('0x2b')]);var _0x5c72c8=unholdValidation[_0xc684('0xe')](_0x1304a2[_0xc684('0x2b')]);if(_0x5c72c8[_0xc684('0x3a')]>0x0){return _0x5439ae[_0xc684('0x19')](0x190)[_0xc684('0x2c')](_0x5c72c8);}var _0x5818b8=_0x1304a2[_0xc684('0x2b')][_0xc684('0x2d')];var _0x4ab2d6=_0x1304a2[_0xc684('0x2b')][_0xc684('0x34')];return getAgent(_0x5818b8)[_0xc684('0x22')](function(_0x28c0fa){logger[_0xc684('0x2a')]('entityFound:',_0x28c0fa[_0xc684('0x18')]);emit(util['format'](_0xc684('0x30'),_0x28c0fa[_0xc684('0x18')]),_0xc684('0x42'),{'sessionId':_0x4ab2d6});return _0x5439ae[_0xc684('0x19')](0xc8)[_0xc684('0x2c')]({'error':![],'message':_0xc684('0x43')});})[_0xc684('0x1f')](handleError(_0x5439ae));};exports[_0xc684('0x44')]=function(_0xcfb03e,_0x554301){logger['info'](_0xc684('0x45'),_0x554301['body']);var _0x2b2d54=callsValidation['validate'](_0xcfb03e['body']);if(_0x2b2d54[_0xc684('0x3a')]>0x0){return _0x554301[_0xc684('0x19')](0x190)[_0xc684('0x2c')](_0x2b2d54);}var _0x147483=_0xcfb03e[_0xc684('0x2b')][_0xc684('0x2d')];var _0x507eff=respondWithRpcPromise(_0xc684('0x23'));var _0x3f1887=getAgent(_0x147483);return Promise[_0xc684('0x24')]([_0x507eff,_0x3f1887])['then'](function(_0xb1ab5b){var _0x50ba27=_0xb1ab5b[0x0];var _0x1e2a08=_0xb1ab5b[0x1];var _0x3eb497=_[_0xc684('0x25')](_0x50ba27['rows'],function(_0x4eddbb){return _0x4eddbb[_0xc684('0x27')]==_0x1e2a08['id'];});return _0x554301['status'](0xc8)[_0xc684('0x2c')]({'count':_0x3eb497['length'],'rows':_0x3eb497});})[_0xc684('0x1f')](handleError(_0x554301));};exports[_0xc684('0x46')]=function(_0x5e0367,_0x1ba002){logger['info'](_0xc684('0x47'),_0x5e0367['body']);var _0x1b5b54=conferenceValidation[_0xc684('0xe')](_0x5e0367[_0xc684('0x2b')]);if(_0x1b5b54[_0xc684('0x3a')]>0x0){return _0x1ba002[_0xc684('0x19')](0x190)['json'](_0x1b5b54);}var _0x2da62d=_0x5e0367[_0xc684('0x2b')][_0xc684('0x2d')];return getAgent(_0x2da62d)[_0xc684('0x22')](function(_0x258693){logger[_0xc684('0x2a')](_0xc684('0x35'),_0x258693[_0xc684('0x18')]);emit(util[_0xc684('0x2f')](_0xc684('0x30'),_0x258693[_0xc684('0x18')]),_0xc684('0x48'));return _0x1ba002[_0xc684('0x19')](0xc8)[_0xc684('0x2c')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x1ba002));};exports['transfer']=function(_0x2a2c30,_0x519006){logger[_0xc684('0x2a')](_0xc684('0x49'),_0x2a2c30[_0xc684('0x2b')]);var _0x342bbf=transferValidation[_0xc684('0xe')](_0x2a2c30['body']);if(_0x342bbf[_0xc684('0x3a')]>0x0){return _0x519006[_0xc684('0x19')](0x190)[_0xc684('0x2c')](_0x342bbf);}var _0x5f4f6b=_0x2a2c30[_0xc684('0x2b')][_0xc684('0x2d')];var _0x2678cb=_0x2a2c30[_0xc684('0x2b')]['sessionId'];var _0x538b3f=_0x2a2c30[_0xc684('0x2b')][_0xc684('0x4a')];return getAgent(_0x5f4f6b)[_0xc684('0x22')](function(_0x1c967d){logger[_0xc684('0x2a')](_0xc684('0x35'),_0x1c967d[_0xc684('0x18')]);emit(util[_0xc684('0x2f')](_0xc684('0x30'),_0x1c967d[_0xc684('0x18')]),_0xc684('0x4b'),{'sessionId':_0x2678cb,'transferNumber':_0x538b3f});return _0x519006[_0xc684('0x19')](0xc8)['json']({'error':![],'message':_0xc684('0x4c')});})['catch'](handleError(_0x519006));}; \ No newline at end of file +var _0xa75b=['handleError:','error','stack','name','status','send','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callerId','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','hangup','user:%s','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','UserId','conference','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','validate','string','number','userId\x20is\x20required','sessionId\x20is\x20required','info','stringify','emit','log'];(function(_0x2964ea,_0x5921b4){var _0x5ad6fa=function(_0x3ed963){while(--_0x3ed963){_0x2964ea['push'](_0x2964ea['shift']());}};_0x5ad6fa(++_0x5921b4);}(_0xa75b,0x170));var _0xba75=function(_0x208bb6,_0x5328d8){_0x208bb6=_0x208bb6-0x0;var _0x1d12c5=_0xa75b[_0x208bb6];return _0x1d12c5;};'use strict';var path=require(_0xba75('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0xba75('0x1'));var util=require(_0xba75('0x2'));var BPromise=require(_0xba75('0x3'));var jayson=require(_0xba75('0x4'));var amiClient=jayson[_0xba75('0x5')][_0xba75('0x6')]({'port':0x232a});var logger=require(_0xba75('0x7'))(_0xba75('0x8'));var Redis=require(_0xba75('0x9'));config[_0xba75('0xa')]=_[_0xba75('0xb')](config[_0xba75('0xa')],{'host':_0xba75('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0xba75('0xd'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xba75('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xba75('0xe')},'callbackUrl':{'type':_0xba75('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0xba75('0xf'),'required':[!![],_0xba75('0x10')]},'sessionId':{'type':_0xba75('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xba75('0xf'),'required':[!![],_0xba75('0x10')]},'sessionId':{'type':_0xba75('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xba75('0xf'),'required':[!![],_0xba75('0x10')]},'sessionId':{'type':_0xba75('0xe'),'required':[!![],_0xba75('0x11')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xba75('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xba75('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xba75('0xf'),'required':[!![],_0xba75('0x10')]},'sessionId':{'type':_0xba75('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xba75('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0xba75('0xf'),'required':[!![],_0xba75('0x10')]}});function emit(_0x4028f9,_0x41c9e5,_0x51112b){logger[_0xba75('0x12')](_0x4028f9,_0x41c9e5,JSON[_0xba75('0x13')](_0x51112b));io['to'](_0x4028f9)[_0xba75('0x14')](_0x41c9e5,_0x51112b);}function handleError(_0x47be93){return function(_0x2822af){console[_0xba75('0x15')](_0xba75('0x16'),_0x2822af,_0x2822af instanceof RangeError);logger[_0xba75('0x17')](_0x2822af[_0xba75('0x18')]);if(_0x2822af instanceof RangeError){if(_0x2822af[_0xba75('0x19')]){delete _0x2822af['name'];}_0x47be93[_0xba75('0x1a')](0x194)[_0xba75('0x1b')](_0x2822af);}else{if(_0x2822af['name']){delete _0x2822af['name'];}_0x47be93[_0xba75('0x1a')](0x1f4)[_0xba75('0x1b')](_0x2822af);}};}function checkError(){return function(_0x496cfc){if(!_0x496cfc){throw new RangeError('NotFound');}return _0x496cfc;};}function respondWithRpcPromise(_0x30f482,_0x4e79a9){return new BPromise(function(_0x1b8a36,_0x2ece41){var _0x19b2d7=amiClient;return _0x19b2d7['request'](_0x30f482,_0x4e79a9)[_0xba75('0x1c')](function(_0x221d5e){if(_0x221d5e[_0xba75('0x17')]){if(_0x221d5e[_0xba75('0x17')][_0xba75('0x1d')]===0x1f4){return _0x2ece41(_0x221d5e[_0xba75('0x17')]['message']);}return _0x1b8a36(_0x221d5e[_0xba75('0x17')][_0xba75('0x1e')]);}else{_0x1b8a36(_0x221d5e[_0xba75('0x1f')]);}})[_0xba75('0x20')](function(_0x1caa6){_0x2ece41(_0x1caa6);});});}function getAgent(_0x44b1d4){return db[_0xba75('0x21')][_0xba75('0x22')]({'where':{'id':_0x44b1d4,'role':_0xba75('0x23')}})[_0xba75('0x1c')](checkError());}function getAgentCheckSession(_0x47ddff,_0x4c8d02){return new BPromise(function(_0x4e1987,_0x240522){var _0x4856be=respondWithRpcPromise(_0xba75('0x24'));var _0x58ea2d=getAgent(_0x47ddff);Promise[_0xba75('0x25')]([_0x4856be,_0x58ea2d])[_0xba75('0x1c')](function(_0x20ac78){var _0x4edc2e=_0x20ac78[0x0];var _0x3a1fd3=_0x20ac78[0x1];var _0x62cf49=_[_0xba75('0x26')](_0x4edc2e[_0xba75('0x27')],function(_0x5d9f78){return _0x5d9f78['UserId']==_0x3a1fd3['id']&&_0x5d9f78[_0xba75('0x28')]==_0x4c8d02;});if(_0x62cf49['length']==0x1){_0x4e1987(_0x3a1fd3);}else{_0x240522(new RangeError(_0xba75('0x29')+_0x4c8d02+_0xba75('0x2a')));}});});}exports[_0xba75('0x2b')]=function(_0x32166a,_0x4b4d69){logger[_0xba75('0x12')](_0xba75('0x2c'),_0x32166a['body']);var _0x33a732=originateValidation[_0xba75('0xd')](_0x32166a[_0xba75('0x2d')]);if(_0x33a732[_0xba75('0x2e')]>0x0){return _0x4b4d69['status'](0x190)[_0xba75('0x2f')](_0x33a732);}var _0x3a1610=_0x32166a['body'][_0xba75('0x30')];var _0x6ea4fc=_0x32166a[_0xba75('0x2d')]['callNumber'];var _0x29334a=_0x32166a[_0xba75('0x2d')][_0xba75('0x31')];var _0x381cb=_0x32166a[_0xba75('0x2d')][_0xba75('0x32')];return getAgent(_0x3a1610)[_0xba75('0x1c')](function(_0x4c9fb2){logger['info'](_0xba75('0x33'),_0x4c9fb2[_0xba75('0x19')]);emit(util[_0xba75('0x34')]('user:%s',_0x4c9fb2[_0xba75('0x19')]),_0xba75('0x35'),{'callNumber':_0x6ea4fc,'callerId':_0x29334a,'callbackUrl':_0x381cb});return _0x4b4d69['status'](0xc8)['json']({'error':![],'message':_0xba75('0x36')});})[_0xba75('0x20')](handleError(_0x4b4d69));};exports[_0xba75('0x37')]=function(_0x1243e8,_0x92882d){logger['info']('hangup\x20fired:',_0x1243e8[_0xba75('0x2d')]);var _0x22b335=hangupValidation[_0xba75('0xd')](_0x1243e8[_0xba75('0x2d')]);if(_0x22b335[_0xba75('0x2e')]>0x0){return _0x92882d[_0xba75('0x1a')](0x190)[_0xba75('0x2f')](_0x22b335);}var _0x5dad31=_0x1243e8[_0xba75('0x2d')][_0xba75('0x30')];var _0x5bec5f=_0x1243e8[_0xba75('0x2d')][_0xba75('0x28')];return getAgent(_0x5dad31)[_0xba75('0x1c')](function(_0x45d8cd){logger[_0xba75('0x12')](_0xba75('0x33'),_0x45d8cd[_0xba75('0x19')]);emit(util['format'](_0xba75('0x38'),_0x45d8cd['name']),_0xba75('0x39'),{'sessionId':_0x5bec5f});return _0x92882d['status'](0xc8)[_0xba75('0x2f')]({'error':![],'message':_0xba75('0x3a')});})[_0xba75('0x20')](handleError(_0x92882d));};exports[_0xba75('0x3b')]=function(_0x24d80b,_0x30338c){logger[_0xba75('0x12')](_0xba75('0x3c'),_0x24d80b[_0xba75('0x2d')]);var _0x5c7c7f=answerValidation[_0xba75('0xd')](_0x24d80b[_0xba75('0x2d')]);if(_0x5c7c7f['length']>0x0){return _0x30338c[_0xba75('0x1a')](0x190)[_0xba75('0x2f')](_0x5c7c7f);}var _0x1130ac=_0x24d80b['body']['userId'];var _0x5c6491=_0x24d80b['body'][_0xba75('0x28')];return getAgent(_0x1130ac)['then'](function(_0x46e9b9){logger[_0xba75('0x12')](_0xba75('0x33'),_0x46e9b9[_0xba75('0x19')]);emit(util[_0xba75('0x34')]('user:%s',_0x46e9b9['name']),_0xba75('0x3d'),{'sessionId':_0x5c6491});return _0x30338c['status'](0xc8)[_0xba75('0x2f')]({'error':![],'message':'answer\x20executed!'});})[_0xba75('0x20')](handleError(_0x30338c));};exports[_0xba75('0x3e')]=function(_0x22e5b4,_0x3983dc){logger['info'](_0xba75('0x3f'),_0x22e5b4[_0xba75('0x2d')]);var _0x254dc7=holdValidation[_0xba75('0xd')](_0x22e5b4[_0xba75('0x2d')]);if(_0x254dc7[_0xba75('0x2e')]>0x0){return _0x3983dc[_0xba75('0x1a')](0x190)[_0xba75('0x2f')](_0x254dc7);}var _0x51cd22=_0x22e5b4[_0xba75('0x2d')][_0xba75('0x30')];var _0x7c297b=_0x22e5b4[_0xba75('0x2d')][_0xba75('0x28')];return getAgent(_0x51cd22)['then'](function(_0x2a1f84){logger[_0xba75('0x12')](_0xba75('0x33'),_0x2a1f84[_0xba75('0x19')]);emit(util[_0xba75('0x34')](_0xba75('0x38'),_0x2a1f84[_0xba75('0x19')]),'webbar:hold',{'sessionId':_0x7c297b});return _0x3983dc[_0xba75('0x1a')](0xc8)[_0xba75('0x2f')]({'error':![],'message':_0xba75('0x40')});})['catch'](handleError(_0x3983dc));};exports[_0xba75('0x41')]=function(_0x29b4fc,_0x559f6f){logger['info'](_0xba75('0x42'),_0x29b4fc['body']);var _0x49a4df=unholdValidation[_0xba75('0xd')](_0x29b4fc['body']);if(_0x49a4df[_0xba75('0x2e')]>0x0){return _0x559f6f[_0xba75('0x1a')](0x190)[_0xba75('0x2f')](_0x49a4df);}var _0x70474=_0x29b4fc[_0xba75('0x2d')]['userId'];var _0xfa79e6=_0x29b4fc[_0xba75('0x2d')]['sessionId'];return getAgent(_0x70474)[_0xba75('0x1c')](function(_0x19a08f){logger[_0xba75('0x12')](_0xba75('0x33'),_0x19a08f[_0xba75('0x19')]);emit(util['format'](_0xba75('0x38'),_0x19a08f[_0xba75('0x19')]),'webbar:unhold',{'sessionId':_0xfa79e6});return _0x559f6f[_0xba75('0x1a')](0xc8)[_0xba75('0x2f')]({'error':![],'message':_0xba75('0x43')});})[_0xba75('0x20')](handleError(_0x559f6f));};exports[_0xba75('0x44')]=function(_0x3b6490,_0x49fb61){logger[_0xba75('0x12')](_0xba75('0x45'),_0x49fb61[_0xba75('0x2d')]);var _0x429e26=callsValidation[_0xba75('0xd')](_0x3b6490[_0xba75('0x2d')]);if(_0x429e26['length']>0x0){return _0x49fb61['status'](0x190)['json'](_0x429e26);}var _0x4cda26=_0x3b6490[_0xba75('0x2d')][_0xba75('0x30')];var _0x2991e5=respondWithRpcPromise(_0xba75('0x24'));var _0x3716c6=getAgent(_0x4cda26);return Promise[_0xba75('0x25')]([_0x2991e5,_0x3716c6])[_0xba75('0x1c')](function(_0x5cfedd){var _0x1c4707=_0x5cfedd[0x0];var _0x1e7500=_0x5cfedd[0x1];var _0x287f30=_[_0xba75('0x26')](_0x1c4707['rows'],function(_0xb7b3a4){return _0xb7b3a4[_0xba75('0x46')]==_0x1e7500['id'];});return _0x49fb61['status'](0xc8)[_0xba75('0x2f')]({'count':_0x287f30['length'],'rows':_0x287f30});})[_0xba75('0x20')](handleError(_0x49fb61));};exports[_0xba75('0x47')]=function(_0x57eceb,_0x276757){logger[_0xba75('0x12')]('conference\x20fired:',_0x57eceb['body']);var _0x3d9420=conferenceValidation['validate'](_0x57eceb[_0xba75('0x2d')]);if(_0x3d9420['length']>0x0){return _0x276757[_0xba75('0x1a')](0x190)[_0xba75('0x2f')](_0x3d9420);}var _0x46c43c=_0x57eceb[_0xba75('0x2d')][_0xba75('0x30')];return getAgent(_0x46c43c)['then'](function(_0xf02890){logger[_0xba75('0x12')]('entityFound:',_0xf02890[_0xba75('0x19')]);emit(util[_0xba75('0x34')](_0xba75('0x38'),_0xf02890[_0xba75('0x19')]),_0xba75('0x48'));return _0x276757[_0xba75('0x1a')](0xc8)[_0xba75('0x2f')]({'error':![],'message':_0xba75('0x49')});})[_0xba75('0x20')](handleError(_0x276757));};exports[_0xba75('0x4a')]=function(_0xa0a92,_0x9da35c){logger['info']('transfer\x20fired:',_0xa0a92[_0xba75('0x2d')]);var _0x31e3b6=transferValidation[_0xba75('0xd')](_0xa0a92[_0xba75('0x2d')]);if(_0x31e3b6[_0xba75('0x2e')]>0x0){return _0x9da35c[_0xba75('0x1a')](0x190)[_0xba75('0x2f')](_0x31e3b6);}var _0x115798=_0xa0a92[_0xba75('0x2d')][_0xba75('0x30')];var _0x2b686e=_0xa0a92['body'][_0xba75('0x28')];var _0x5c1e1d=_0xa0a92[_0xba75('0x2d')][_0xba75('0x4b')];return getAgent(_0x115798)[_0xba75('0x1c')](function(_0x43b73b){logger[_0xba75('0x12')](_0xba75('0x33'),_0x43b73b['name']);emit(util[_0xba75('0x34')]('user:%s',_0x43b73b[_0xba75('0x19')]),_0xba75('0x4c'),{'sessionId':_0x2b686e,'transferNumber':_0x5c1e1d});return _0x9da35c['status'](0xc8)['json']({'error':![],'message':_0xba75('0x4d')});})[_0xba75('0x20')](handleError(_0x9da35c));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 2e63be4..e7e9e0a 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 _0xe69b=['isAuthenticated','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','create','post','addDisposition','addAnswer','addApplications','/:id/notify','notify','send','put','/:id','update','destroy','delete','removeAnswers','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get'];(function(_0x4350da,_0x5cdf8e){var _0x6873e3=function(_0x15e6f4){while(--_0x15e6f4){_0x4350da['push'](_0x4350da['shift']());}};_0x6873e3(++_0x5cdf8e);}(_0xe69b,0x182));var _0xbe69=function(_0x15afa6,_0x2ead64){_0x15afa6=_0x15afa6-0x0;var _0x1c8ffb=_0xe69b[_0x15afa6];return _0x1c8ffb;};'use strict';var multer=require(_0xbe69('0x0'));var util=require(_0xbe69('0x1'));var path=require(_0xbe69('0x2'));var timeout=require('connect-timeout');var express=require(_0xbe69('0x3'));var router=express[_0xbe69('0x4')]();var fs_extra=require(_0xbe69('0x5'));var auth=require(_0xbe69('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbe69('0x7'));var controller=require(_0xbe69('0x8'));router[_0xbe69('0x9')]('/',auth[_0xbe69('0xa')](),controller['index']);router[_0xbe69('0x9')](_0xbe69('0xb'),auth[_0xbe69('0xa')](),controller['describe']);router['get']('/:id',auth[_0xbe69('0xa')](),controller[_0xbe69('0xc')]);router[_0xbe69('0x9')](_0xbe69('0xd'),auth[_0xbe69('0xa')](),controller[_0xbe69('0xe')]);router['get'](_0xbe69('0xf'),auth[_0xbe69('0xa')](),controller[_0xbe69('0x10')]);router['get'](_0xbe69('0x11'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0xbe69('0x12'),auth[_0xbe69('0xa')](),controller[_0xbe69('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbe69('0x14')]);router[_0xbe69('0x15')](_0xbe69('0xd'),auth[_0xbe69('0xa')](),controller[_0xbe69('0x16')]);router['post'](_0xbe69('0xf'),auth[_0xbe69('0xa')](),controller[_0xbe69('0x17')]);router[_0xbe69('0x15')](_0xbe69('0x11'),auth[_0xbe69('0xa')](),controller['addAgents']);router[_0xbe69('0x15')](_0xbe69('0x12'),auth[_0xbe69('0xa')](),controller[_0xbe69('0x18')]);router[_0xbe69('0x15')](_0xbe69('0x19'),controller[_0xbe69('0x1a')]);router[_0xbe69('0x15')]('/:id/send',auth[_0xbe69('0xa')](),controller[_0xbe69('0x1b')]);router[_0xbe69('0x1c')](_0xbe69('0x1d'),auth['isAuthenticated'](),controller[_0xbe69('0x1e')]);router['delete'](_0xbe69('0x1d'),auth[_0xbe69('0xa')](),controller[_0xbe69('0x1f')]);router['delete'](_0xbe69('0xd'),auth[_0xbe69('0xa')](),controller['removeDispositions']);router[_0xbe69('0x20')]('/:id/canned_answers',auth[_0xbe69('0xa')](),controller[_0xbe69('0x21')]);router[_0xbe69('0x20')]('/:id/users',auth[_0xbe69('0xa')](),controller[_0xbe69('0x22')]);module[_0xbe69('0x23')]=router; \ No newline at end of file +var _0xc40c=['/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','getAgents','getApplications','post','create','addDisposition','/:id/canned_answers','/:id/users','/:id/applications','addApplications'];(function(_0x1aa269,_0x1e9450){var _0x2bab83=function(_0x31933){while(--_0x31933){_0x1aa269['push'](_0x1aa269['shift']());}};_0x2bab83(++_0x1e9450);}(_0xc40c,0x169));var _0xcc40=function(_0x8010b2,_0x38e108){_0x8010b2=_0x8010b2-0x0;var _0xd4bcd6=_0xc40c[_0x8010b2];return _0xd4bcd6;};'use strict';var multer=require('multer');var util=require(_0xcc40('0x0'));var path=require(_0xcc40('0x1'));var timeout=require(_0xcc40('0x2'));var express=require(_0xcc40('0x3'));var router=express[_0xcc40('0x4')]();var fs_extra=require(_0xcc40('0x5'));var auth=require(_0xcc40('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0xcc40('0x7')]('/',auth[_0xcc40('0x8')](),controller[_0xcc40('0x9')]);router[_0xcc40('0x7')]('/describe',auth[_0xcc40('0x8')](),controller[_0xcc40('0xa')]);router[_0xcc40('0x7')](_0xcc40('0xb'),auth['isAuthenticated'](),controller[_0xcc40('0xc')]);router[_0xcc40('0x7')](_0xcc40('0xd'),auth[_0xcc40('0x8')](),controller[_0xcc40('0xe')]);router[_0xcc40('0x7')]('/:id/canned_answers',auth[_0xcc40('0x8')](),controller['getAnswers']);router[_0xcc40('0x7')]('/:id/users',auth[_0xcc40('0x8')](),controller[_0xcc40('0xf')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0xcc40('0x10')]);router[_0xcc40('0x11')]('/',auth[_0xcc40('0x8')](),controller[_0xcc40('0x12')]);router[_0xcc40('0x11')](_0xcc40('0xd'),auth['isAuthenticated'](),controller[_0xcc40('0x13')]);router[_0xcc40('0x11')](_0xcc40('0x14'),auth[_0xcc40('0x8')](),controller['addAnswer']);router[_0xcc40('0x11')](_0xcc40('0x15'),auth['isAuthenticated'](),controller['addAgents']);router[_0xcc40('0x11')](_0xcc40('0x16'),auth['isAuthenticated'](),controller[_0xcc40('0x17')]);router[_0xcc40('0x11')](_0xcc40('0x18'),controller[_0xcc40('0x19')]);router['post'](_0xcc40('0x1a'),auth[_0xcc40('0x8')](),controller[_0xcc40('0x1b')]);router[_0xcc40('0x1c')](_0xcc40('0xb'),auth[_0xcc40('0x8')](),controller[_0xcc40('0x1d')]);router[_0xcc40('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0xcc40('0x1f')]);router['delete'](_0xcc40('0xd'),auth[_0xcc40('0x8')](),controller[_0xcc40('0x20')]);router['delete'](_0xcc40('0x14'),auth[_0xcc40('0x8')](),controller[_0xcc40('0x21')]);router[_0xcc40('0x1e')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xcc40('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index b16624c..c979fcc 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 _0x20c0=['STRING','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','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','name'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x20c0,0x13d));var _0x020c=function(_0x383164,_0xb8a413){_0x383164=_0x383164-0x0;var _0x4ef34b=_0x20c0[_0x383164];return _0x4ef34b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x020c('0x0'));module[_0x020c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x020c('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x020c('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x020c('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x020c('0x3')]},'type':{'type':Sequelize[_0x020c('0x4')](_0x020c('0x5'),_0x020c('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x020c('0x3')]},'notificationTemplate':{'type':Sequelize[_0x020c('0x7')],'defaultValue':function(){return _0x020c('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x020c('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x020c('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x020c('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x020c('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x020c('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x020c('0xa')],'comment':_0x020c('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x020c('0xc'),'set':function(_0x3d5a37){if(!_0x3d5a37){this['setDataValue'](_0x020c('0xd'),null);}this[_0x020c('0xe')](_0x020c('0xf'),_0x3d5a37);}},'description':{'type':Sequelize[_0x020c('0x3')]}}; \ No newline at end of file +var _0x3aa1=['STRING','generate','twilio','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','randomstring','exports'];(function(_0x58991b,_0x5023a2){var _0x182142=function(_0x24cd45){while(--_0x24cd45){_0x58991b['push'](_0x58991b['shift']());}};_0x182142(++_0x5023a2);}(_0x3aa1,0xdb));var _0x13aa=function(_0x123f8,_0x56f1fa){_0x123f8=_0x123f8-0x0;var _0x8874e2=_0x3aa1[_0x123f8];return _0x8874e2;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x13aa('0x0'));module[_0x13aa('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x13aa('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x13aa('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x13aa('0x2')],'defaultValue':function(){return rs[_0x13aa('0x3')]();}},'phone':{'type':Sequelize[_0x13aa('0x2')]},'type':{'type':Sequelize['ENUM'](_0x13aa('0x4'),'sinch')},'accountSid':{'type':Sequelize[_0x13aa('0x2')]},'baseUrl':{'type':Sequelize[_0x13aa('0x2')]},'authToken':{'type':Sequelize[_0x13aa('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x13aa('0x5');}},'notificationSound':{'type':Sequelize[_0x13aa('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x13aa('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x13aa('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x13aa('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x13aa('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x13aa('0x7')],'comment':_0x13aa('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x13aa('0x9'),'set':function(_0x4bd144){if(!_0x4bd144){this[_0x13aa('0xa')](_0x13aa('0xb'),null);}this['setDataValue'](_0x13aa('0xc'),_0x4bd144);}},'description':{'type':Sequelize[_0x13aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 9d48e9f..05f244c 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 _0x7bb9=['isArray','userWhatsappAccount:remove','getAgents','User','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','Body','MessageSid','from','notifications','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','list','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','AttachmentId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','text/xml','DESC','List','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','WhatsappAccountId','Disposition','findOne','pick','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x7bb9,0x1eb));var _0x97bb=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x7bb9[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require(_0x97bb('0x0'));var rimraf=require(_0x97bb('0x1'));var zipdir=require(_0x97bb('0x2'));var jsonpatch=require(_0x97bb('0x3'));var rp=require(_0x97bb('0x4'));var moment=require('moment');var BPromise=require(_0x97bb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x97bb('0x6'));var csv=require(_0x97bb('0x7'));var ejs=require(_0x97bb('0x8'));var fs=require('fs');var fs_extra=require(_0x97bb('0x9'));var _=require(_0x97bb('0xa'));var squel=require(_0x97bb('0xb'));var crypto=require(_0x97bb('0xc'));var jsforce=require(_0x97bb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x97bb('0x7'));var querystring=require(_0x97bb('0xe'));var Papa=require(_0x97bb('0xf'));var Redis=require(_0x97bb('0x10'));var authService=require(_0x97bb('0x11'));var qs=require(_0x97bb('0x12'));var as=require(_0x97bb('0x13'));var hardwareService=require(_0x97bb('0x14'));var logger=require(_0x97bb('0x15'))(_0x97bb('0x16'));var utils=require(_0x97bb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x97bb('0x18'));var db=require('../../mysqldb')['db'];config[_0x97bb('0x19')]=_[_0x97bb('0x1a')](config[_0x97bb('0x19')],{'host':_0x97bb('0x1b'),'port':0x18eb});var socket=require(_0x97bb('0x1c'))(new Redis(config[_0x97bb('0x19')]));require(_0x97bb('0x1d'))[_0x97bb('0x1e')](socket);var jayson=require(_0x97bb('0x1f'));var client=jayson[_0x97bb('0x20')][_0x97bb('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x1daffb,_0x3d63f2,_0x5dbbd9,_0x149bfe){return new BPromise(function(_0x308a77,_0x4f8506){var _0x101741=_0x149bfe||client;return _0x101741[_0x97bb('0x22')](_0x1daffb,_0x5dbbd9)[_0x97bb('0x23')](function(_0x33bcfb){logger[_0x97bb('0x24')](_0x97bb('0x25'),_0x3d63f2,_0x97bb('0x26'));logger[_0x97bb('0x27')](_0x97bb('0x28'),_0x3d63f2,_0x97bb('0x26'),JSON[_0x97bb('0x29')](_0x33bcfb));if(_0x33bcfb[_0x97bb('0x2a')]){if(_0x33bcfb[_0x97bb('0x2a')]['code']===0x1f4){logger[_0x97bb('0x2a')](_0x97bb('0x25'),_0x3d63f2,_0x33bcfb[_0x97bb('0x2a')][_0x97bb('0x2b')]);return _0x4f8506(_0x33bcfb[_0x97bb('0x2a')][_0x97bb('0x2b')]);}logger[_0x97bb('0x2a')](_0x97bb('0x25'),_0x3d63f2,_0x33bcfb[_0x97bb('0x2a')]['message']);return _0x308a77(_0x33bcfb[_0x97bb('0x2a')][_0x97bb('0x2b')]);}else{logger[_0x97bb('0x24')](_0x97bb('0x25'),_0x3d63f2,_0x97bb('0x26'));_0x308a77(_0x33bcfb[_0x97bb('0x2c')]['message']);}})[_0x97bb('0x2d')](function(_0x3a55b4){logger[_0x97bb('0x2a')]('WhatsappAccount,\x20%s,\x20%s',_0x3d63f2,_0x3a55b4);_0x4f8506(_0x3a55b4);});});}function respondWithStatusCode(_0x4d7ecd,_0x4e4701){_0x4e4701=_0x4e4701||0xcc;return function(_0x38e7a4){if(_0x38e7a4){return _0x4d7ecd[_0x97bb('0x2e')](_0x4e4701);}return _0x4d7ecd['status'](_0x4e4701)[_0x97bb('0x2f')]();};}function respondWithResult(_0x4d5c06,_0x5768d3){_0x5768d3=_0x5768d3||0xc8;return function(_0x46f90e){if(_0x46f90e){return _0x4d5c06[_0x97bb('0x30')](_0x5768d3)[_0x97bb('0x31')](_0x46f90e);}};}function respondWithFilteredResult(_0x2ed467,_0x49b4aa){return function(_0x2c1d70){if(_0x2c1d70){var _0xe3aa4e=typeof _0x49b4aa['offset']==='undefined'&&typeof _0x49b4aa[_0x97bb('0x32')]===_0x97bb('0x33');var _0x11e872=_0x2c1d70[_0x97bb('0x34')];var _0x1fc0d0=_0xe3aa4e?0x0:_0x49b4aa[_0x97bb('0x35')];var _0x294504=_0xe3aa4e?_0x2c1d70[_0x97bb('0x34')]:_0x49b4aa['offset']+_0x49b4aa[_0x97bb('0x32')];var _0x5cd733;if(_0x294504>=_0x11e872){_0x294504=_0x11e872;_0x5cd733=0xc8;}else{_0x5cd733=0xce;}_0x2ed467['status'](_0x5cd733);return _0x2ed467['set'](_0x97bb('0x36'),_0x1fc0d0+'-'+_0x294504+'/'+_0x11e872)[_0x97bb('0x31')](_0x2c1d70);}return null;};}function patchUpdates(_0x53cc9f){return function(_0x47fea0){try{jsonpatch[_0x97bb('0x37')](_0x47fea0,_0x53cc9f,!![]);}catch(_0x51b34e){return BPromise['reject'](_0x51b34e);}return _0x47fea0[_0x97bb('0x38')]();};}function saveUpdates(_0x5211ac,_0x1f135e){return function(_0x506af1){if(_0x506af1){return _0x506af1[_0x97bb('0x39')](_0x5211ac)[_0x97bb('0x23')](function(_0x44ca59){return _0x44ca59;});}return null;};}function removeEntity(_0xa524f2,_0x1c64c9){return function(_0x1baf65){if(_0x1baf65){return _0x1baf65[_0x97bb('0x3a')]()[_0x97bb('0x23')](function(){var _0x4d626c=_0x1baf65[_0x97bb('0x3b')]({'plain':!![]});var _0x28c0e4=_0x97bb('0x3c');return db[_0x97bb('0x3d')][_0x97bb('0x3a')]({'where':{'type':_0x28c0e4,'resourceId':_0x4d626c['id']}})[_0x97bb('0x23')](function(){return _0x1baf65;});})['then'](function(){_0xa524f2['status'](0xcc)[_0x97bb('0x2f')]();});}};}function handleEntityNotFound(_0x4f60d6,_0x49d45c){return function(_0x2686e1){if(!_0x2686e1){_0x4f60d6[_0x97bb('0x2e')](0x194);}return _0x2686e1;};}function handleError(_0xf96aa8,_0x27830c){_0x27830c=_0x27830c||0x1f4;return function(_0x243977){logger[_0x97bb('0x2a')](_0x243977[_0x97bb('0x3e')]);if(_0x243977[_0x97bb('0x3f')]){delete _0x243977[_0x97bb('0x3f')];}_0xf96aa8[_0x97bb('0x30')](_0x27830c)[_0x97bb('0x40')](_0x243977);};}exports[_0x97bb('0x41')]=function(_0x2888a5,_0x22d591){var _0x4e332e={'include':[{'model':db[_0x97bb('0x42')],'as':_0x97bb('0x43')}]},_0x554311={},_0x11b202={'count':0x0,'rows':[]};var _0x277987=_[_0x97bb('0x44')](db[_0x97bb('0x45')][_0x97bb('0x46')],function(_0x31fa26){return{'name':_0x31fa26['fieldName'],'type':_0x31fa26[_0x97bb('0x47')]['key']};});_0x554311[_0x97bb('0x48')]=_[_0x97bb('0x44')](_0x277987,_0x97bb('0x3f'));_0x554311[_0x97bb('0x49')]=_[_0x97bb('0x4a')](_0x2888a5[_0x97bb('0x49')]);_0x554311[_0x97bb('0x4b')]=_[_0x97bb('0x4c')](_0x554311[_0x97bb('0x48')],_0x554311['query']);_0x4e332e[_0x97bb('0x4d')]=_['intersection'](_0x554311['model'],qs[_0x97bb('0x4e')](_0x2888a5['query']['fields']));_0x4e332e['attributes']=_0x4e332e[_0x97bb('0x4d')][_0x97bb('0x4f')]?_0x4e332e['attributes']:_0x554311[_0x97bb('0x48')];if(!_0x2888a5[_0x97bb('0x49')][_0x97bb('0x50')](_0x97bb('0x51'))){_0x4e332e[_0x97bb('0x32')]=qs[_0x97bb('0x32')](_0x2888a5[_0x97bb('0x49')][_0x97bb('0x32')]);_0x4e332e[_0x97bb('0x35')]=qs[_0x97bb('0x35')](_0x2888a5[_0x97bb('0x49')][_0x97bb('0x35')]);}_0x4e332e[_0x97bb('0x52')]=qs['sort'](_0x2888a5[_0x97bb('0x49')][_0x97bb('0x53')]);_0x4e332e[_0x97bb('0x54')]=qs[_0x97bb('0x4b')](_['pick'](_0x2888a5[_0x97bb('0x49')],_0x554311[_0x97bb('0x4b')]),_0x277987);if(_0x2888a5[_0x97bb('0x49')][_0x97bb('0x55')]){_0x4e332e[_0x97bb('0x54')]=_['merge'](_0x4e332e[_0x97bb('0x54')],{'$or':_[_0x97bb('0x44')](_0x277987,function(_0x3d10ef){if(_0x3d10ef['type']!==_0x97bb('0x56')){var _0x375ac0={};_0x375ac0[_0x3d10ef[_0x97bb('0x3f')]]={'$like':'%'+_0x2888a5['query']['filter']+'%'};return _0x375ac0;}})});}_0x4e332e=_[_0x97bb('0x57')]({},_0x4e332e,_0x2888a5[_0x97bb('0x58')]);var _0x4376b1={'where':_0x4e332e['where']};return db[_0x97bb('0x45')][_0x97bb('0x34')](_0x4376b1)['then'](function(_0x271053){_0x11b202['count']=_0x271053;if(_0x2888a5[_0x97bb('0x49')][_0x97bb('0x59')]){_0x4e332e['include']=[{'all':!![]}];}return db[_0x97bb('0x45')][_0x97bb('0x5a')](_0x4e332e);})[_0x97bb('0x23')](function(_0x36274f){_0x11b202[_0x97bb('0x5b')]=_0x36274f;return _0x11b202;})[_0x97bb('0x23')](respondWithFilteredResult(_0x22d591,_0x4e332e))[_0x97bb('0x2d')](handleError(_0x22d591,null));};exports['show']=function(_0x5b399b,_0x353866){var _0x4ce6b8={'raw':![],'where':{'id':_0x5b399b[_0x97bb('0x5c')]['id']},'include':[{'model':db[_0x97bb('0x42')],'as':'mandatoryDispositionPause'}]},_0x3031d0={};_0x3031d0[_0x97bb('0x48')]=_['keys'](db[_0x97bb('0x45')][_0x97bb('0x46')]);_0x3031d0[_0x97bb('0x49')]=_[_0x97bb('0x4a')](_0x5b399b[_0x97bb('0x49')]);_0x3031d0[_0x97bb('0x4b')]=_[_0x97bb('0x4c')](_0x3031d0['model'],_0x3031d0[_0x97bb('0x49')]);_0x4ce6b8[_0x97bb('0x4d')]=_[_0x97bb('0x4c')](_0x3031d0[_0x97bb('0x48')],qs[_0x97bb('0x4e')](_0x5b399b[_0x97bb('0x49')][_0x97bb('0x4e')]));_0x4ce6b8[_0x97bb('0x4d')]=_0x4ce6b8[_0x97bb('0x4d')][_0x97bb('0x4f')]?_0x4ce6b8[_0x97bb('0x4d')]:_0x3031d0[_0x97bb('0x48')];if(_0x5b399b[_0x97bb('0x49')]['includeAll']){_0x4ce6b8['include']=[{'all':!![]}];}_0x4ce6b8=_['merge']({},_0x4ce6b8,_0x5b399b[_0x97bb('0x58')]);return db[_0x97bb('0x45')][_0x97bb('0x5d')](_0x4ce6b8)[_0x97bb('0x23')](handleEntityNotFound(_0x353866,null))[_0x97bb('0x23')](respondWithResult(_0x353866,null))['catch'](handleError(_0x353866,null));};exports[_0x97bb('0x5e')]=function(_0x13f2c9,_0x301d23){return db[_0x97bb('0x45')][_0x97bb('0x5e')](_0x13f2c9[_0x97bb('0x5f')],{})['then'](function(_0x12c307){var _0x5da80a=_0x13f2c9[_0x97bb('0x60')][_0x97bb('0x3b')]({'plain':!![]});if(!_0x5da80a)throw new Error(_0x97bb('0x61'));if(_0x5da80a[_0x97bb('0x62')]===_0x97bb('0x60')){var _0x145a12=_0x12c307[_0x97bb('0x3b')]({'plain':!![]});var _0x10a637='WhatsappAccounts';return db[_0x97bb('0x63')]['find']({'where':{'name':_0x10a637,'userProfileId':_0x5da80a[_0x97bb('0x64')]},'raw':!![]})['then'](function(_0x381417){if(_0x381417&&_0x381417[_0x97bb('0x65')]===0x0){return db[_0x97bb('0x3d')][_0x97bb('0x5e')]({'name':_0x145a12[_0x97bb('0x3f')],'resourceId':_0x145a12['id'],'type':_0x381417[_0x97bb('0x3f')],'sectionId':_0x381417['id']},{})[_0x97bb('0x23')](function(){return _0x12c307;});}else{return _0x12c307;}})[_0x97bb('0x2d')](function(_0x4ffdc6){logger[_0x97bb('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ffdc6);throw _0x4ffdc6;});}return _0x12c307;})[_0x97bb('0x23')](respondWithResult(_0x301d23,0xc9))[_0x97bb('0x2d')](handleError(_0x301d23,null));};exports[_0x97bb('0x39')]=function(_0x251c5a,_0x44d1d4){if(_0x251c5a[_0x97bb('0x5f')]['id']){delete _0x251c5a[_0x97bb('0x5f')]['id'];}return db[_0x97bb('0x45')][_0x97bb('0x5d')]({'where':{'id':_0x251c5a[_0x97bb('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x97bb('0x43')}]})[_0x97bb('0x23')](handleEntityNotFound(_0x44d1d4,null))['then'](saveUpdates(_0x251c5a[_0x97bb('0x5f')],null))[_0x97bb('0x23')](respondWithResult(_0x44d1d4,null))[_0x97bb('0x2d')](handleError(_0x44d1d4,null));};exports[_0x97bb('0x3a')]=function(_0x461628,_0x26dac4){return db[_0x97bb('0x45')][_0x97bb('0x5d')]({'where':{'id':_0x461628[_0x97bb('0x5c')]['id']}})[_0x97bb('0x23')](handleEntityNotFound(_0x26dac4,null))[_0x97bb('0x23')](removeEntity(_0x26dac4,null))[_0x97bb('0x2d')](handleError(_0x26dac4,null));};exports[_0x97bb('0x66')]=function(_0x441c1f,_0x310d5a){return db[_0x97bb('0x45')]['describe']()['then'](respondWithResult(_0x310d5a,null))[_0x97bb('0x2d')](handleError(_0x310d5a,null));};exports[_0x97bb('0x67')]=function(_0x5c2489,_0x946eb2,_0x1ee1f6){if(_0x5c2489['body']['id']){delete _0x5c2489['body']['id'];}return db[_0x97bb('0x45')]['find']({'where':{'id':_0x5c2489[_0x97bb('0x5c')]['id']}})[_0x97bb('0x23')](handleEntityNotFound(_0x946eb2,null))[_0x97bb('0x23')](function(_0x244cb8){if(_0x244cb8){_0x5c2489[_0x97bb('0x5f')][_0x97bb('0x68')]=_0x244cb8['id'];return db[_0x97bb('0x69')][_0x97bb('0x5e')](_0x5c2489[_0x97bb('0x5f')]);}})[_0x97bb('0x23')](respondWithResult(_0x946eb2,null))[_0x97bb('0x2d')](handleError(_0x946eb2,null));};exports['getDispositions']=function(_0x54aea7,_0xf1478a,_0x395175){var _0x338b75={'raw':![],'where':{}};var _0x3fffdf={};var _0x8d9838={'count':0x0,'rows':[]};return db[_0x97bb('0x45')][_0x97bb('0x6a')]({'where':{'id':_0x54aea7['params']['id']}})['then'](handleEntityNotFound(_0xf1478a,null))[_0x97bb('0x23')](function(_0x809746){if(_0x809746){_0x3fffdf[_0x97bb('0x48')]=_['keys'](db[_0x97bb('0x69')][_0x97bb('0x46')]);_0x3fffdf['query']=_['keys'](_0x54aea7[_0x97bb('0x49')]);_0x3fffdf[_0x97bb('0x4b')]=_[_0x97bb('0x4c')](_0x3fffdf['model'],_0x3fffdf['query']);_0x338b75[_0x97bb('0x4d')]=_[_0x97bb('0x4c')](_0x3fffdf[_0x97bb('0x48')],qs['fields'](_0x54aea7[_0x97bb('0x49')][_0x97bb('0x4e')]));_0x338b75[_0x97bb('0x4d')]=_0x338b75['attributes'][_0x97bb('0x4f')]?_0x338b75[_0x97bb('0x4d')]:_0x3fffdf['model'];if(!_0x54aea7[_0x97bb('0x49')]['hasOwnProperty']('nolimit')){_0x338b75[_0x97bb('0x32')]=qs[_0x97bb('0x32')](_0x54aea7[_0x97bb('0x49')][_0x97bb('0x32')]);_0x338b75[_0x97bb('0x35')]=qs[_0x97bb('0x35')](_0x54aea7[_0x97bb('0x49')][_0x97bb('0x35')]);}_0x338b75['order']=qs['sort'](_0x54aea7[_0x97bb('0x49')]['sort']);_0x338b75['where']=qs[_0x97bb('0x4b')](_[_0x97bb('0x6b')](_0x54aea7[_0x97bb('0x49')],_0x3fffdf[_0x97bb('0x4b')]));_0x338b75['where'][_0x97bb('0x68')]=_0x809746['id'];if(_0x54aea7[_0x97bb('0x49')]['filter']){_0x338b75[_0x97bb('0x54')]=_[_0x97bb('0x57')](_0x338b75[_0x97bb('0x54')],{'$or':_['map'](_0x338b75[_0x97bb('0x4d')],function(_0x5f01a0){var _0x3227f5={};_0x3227f5[_0x5f01a0]={'$like':'%'+_0x54aea7['query'][_0x97bb('0x55')]+'%'};return _0x3227f5;})});}_0x338b75=_[_0x97bb('0x57')]({},_0x338b75,_0x54aea7[_0x97bb('0x58')]);return db[_0x97bb('0x69')][_0x97bb('0x34')]({'where':_0x338b75[_0x97bb('0x54')]})[_0x97bb('0x23')](function(_0x39d58e){_0x8d9838[_0x97bb('0x34')]=_0x39d58e;if(_0x54aea7[_0x97bb('0x49')][_0x97bb('0x59')]){_0x338b75[_0x97bb('0x6c')]=[{'all':!![]}];}return db['Disposition'][_0x97bb('0x5a')](_0x338b75);})[_0x97bb('0x23')](function(_0xf29d90){_0x8d9838[_0x97bb('0x5b')]=_0xf29d90;return _0x8d9838;});}})[_0x97bb('0x23')](respondWithFilteredResult(_0xf1478a,_0x338b75))[_0x97bb('0x2d')](handleError(_0xf1478a,null));};exports[_0x97bb('0x6d')]=function(_0x14b1cd,_0x181cf1,_0x5be8e0){return db[_0x97bb('0x45')][_0x97bb('0x5d')]({'where':{'id':_0x14b1cd[_0x97bb('0x5c')]['id']}})[_0x97bb('0x23')](handleEntityNotFound(_0x181cf1,null))[_0x97bb('0x23')](function(_0x5c18fc){if(_0x5c18fc){return _0x5c18fc[_0x97bb('0x6d')](_0x14b1cd[_0x97bb('0x49')][_0x97bb('0x6e')]);}})[_0x97bb('0x23')](respondWithStatusCode(_0x181cf1,null))[_0x97bb('0x2d')](handleError(_0x181cf1,null));};exports[_0x97bb('0x6f')]=function(_0x3e373a,_0x2fbb8d,_0x4cc100){if(_0x3e373a[_0x97bb('0x5f')]['id']){delete _0x3e373a['body']['id'];}return db[_0x97bb('0x45')][_0x97bb('0x5d')]({'where':{'id':_0x3e373a[_0x97bb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2fbb8d,null))[_0x97bb('0x23')](function(_0x24683f){if(_0x24683f){_0x3e373a['body'][_0x97bb('0x68')]=_0x24683f['id'];return db[_0x97bb('0x70')][_0x97bb('0x5e')](_0x3e373a[_0x97bb('0x5f')]);}})[_0x97bb('0x23')](respondWithResult(_0x2fbb8d,null))['catch'](handleError(_0x2fbb8d,null));};exports[_0x97bb('0x71')]=function(_0x288e12,_0x535a66,_0xc55d67){var _0x1e532a={'raw':![],'where':{}};var _0x2023ad={};var _0x451cb1={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x97bb('0x6a')]({'where':{'id':_0x288e12[_0x97bb('0x5c')]['id']}})[_0x97bb('0x23')](handleEntityNotFound(_0x535a66,null))[_0x97bb('0x23')](function(_0xe9d971){if(_0xe9d971){_0x2023ad['model']=_['keys'](db[_0x97bb('0x70')][_0x97bb('0x46')]);_0x2023ad[_0x97bb('0x49')]=_[_0x97bb('0x4a')](_0x288e12[_0x97bb('0x49')]);_0x2023ad['filters']=_[_0x97bb('0x4c')](_0x2023ad[_0x97bb('0x48')],_0x2023ad[_0x97bb('0x49')]);_0x1e532a['attributes']=_[_0x97bb('0x4c')](_0x2023ad[_0x97bb('0x48')],qs[_0x97bb('0x4e')](_0x288e12[_0x97bb('0x49')][_0x97bb('0x4e')]));_0x1e532a['attributes']=_0x1e532a[_0x97bb('0x4d')][_0x97bb('0x4f')]?_0x1e532a[_0x97bb('0x4d')]:_0x2023ad[_0x97bb('0x48')];if(!_0x288e12[_0x97bb('0x49')][_0x97bb('0x50')](_0x97bb('0x51'))){_0x1e532a[_0x97bb('0x32')]=qs['limit'](_0x288e12[_0x97bb('0x49')][_0x97bb('0x32')]);_0x1e532a[_0x97bb('0x35')]=qs[_0x97bb('0x35')](_0x288e12['query']['offset']);}_0x1e532a[_0x97bb('0x52')]=qs['sort'](_0x288e12['query']['sort']);_0x1e532a[_0x97bb('0x54')]=qs[_0x97bb('0x4b')](_[_0x97bb('0x6b')](_0x288e12[_0x97bb('0x49')],_0x2023ad[_0x97bb('0x4b')]));_0x1e532a[_0x97bb('0x54')]['WhatsappAccountId']=_0xe9d971['id'];if(_0x288e12['query'][_0x97bb('0x55')]){_0x1e532a[_0x97bb('0x54')]=_[_0x97bb('0x57')](_0x1e532a['where'],{'$or':_[_0x97bb('0x44')](_0x1e532a[_0x97bb('0x4d')],function(_0x534c60){var _0x44cfe8={};_0x44cfe8[_0x534c60]={'$like':'%'+_0x288e12[_0x97bb('0x49')][_0x97bb('0x55')]+'%'};return _0x44cfe8;})});}_0x1e532a=_[_0x97bb('0x57')]({},_0x1e532a,_0x288e12[_0x97bb('0x58')]);return db[_0x97bb('0x70')]['count']({'where':_0x1e532a[_0x97bb('0x54')]})[_0x97bb('0x23')](function(_0x2b040d){_0x451cb1[_0x97bb('0x34')]=_0x2b040d;if(_0x288e12[_0x97bb('0x49')][_0x97bb('0x59')]){_0x1e532a[_0x97bb('0x6c')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x1e532a);})['then'](function(_0x3d800b){_0x451cb1['rows']=_0x3d800b;return _0x451cb1;});}})[_0x97bb('0x23')](respondWithFilteredResult(_0x535a66,_0x1e532a))[_0x97bb('0x2d')](handleError(_0x535a66,null));};exports['removeAnswers']=function(_0x58bf0b,_0x3a2399,_0x303818){return db[_0x97bb('0x45')][_0x97bb('0x5d')]({'where':{'id':_0x58bf0b['params']['id']}})[_0x97bb('0x23')](handleEntityNotFound(_0x3a2399,null))[_0x97bb('0x23')](function(_0x571d18){if(_0x571d18){return _0x571d18[_0x97bb('0x72')](_0x58bf0b[_0x97bb('0x49')][_0x97bb('0x6e')]);}})[_0x97bb('0x23')](respondWithStatusCode(_0x3a2399,null))[_0x97bb('0x2d')](handleError(_0x3a2399,null));};exports[_0x97bb('0x73')]=function(_0x5a8b81,_0x503300,_0xd5aab4){return db[_0x97bb('0x45')][_0x97bb('0x5d')]({'where':{'id':_0x5a8b81[_0x97bb('0x5c')]['id']}})[_0x97bb('0x23')](handleEntityNotFound(_0x503300,null))[_0x97bb('0x23')](function(_0x1162df){if(_0x1162df){return _0x1162df[_0x97bb('0x73')](_0x5a8b81[_0x97bb('0x5f')]['ids'],_[_0x97bb('0x74')](_0x5a8b81[_0x97bb('0x5f')],['ids','id'])||{})[_0x97bb('0x75')](function(_0x5a3565){for(var _0x2af565=0x0;_0x2af565<_0x5a8b81[_0x97bb('0x5f')][_0x97bb('0x6e')][_0x97bb('0x4f')];_0x2af565+=0x1){socket[_0x97bb('0x76')](_0x97bb('0x77'),{'UserId':Number(_0x5a8b81[_0x97bb('0x5f')]['ids'][_0x2af565]),'WhatsappAccountId':Number(_0x5a8b81['params']['id'])});}return _0x5a3565;});}})['then'](respondWithResult(_0x503300,null))[_0x97bb('0x2d')](handleError(_0x503300,null));};exports[_0x97bb('0x78')]=function(_0x361cc9,_0x5e3ff5,_0x2b7cbf){return db['WhatsappAccount'][_0x97bb('0x5d')]({'where':{'id':_0x361cc9[_0x97bb('0x5c')]['id']}})[_0x97bb('0x23')](handleEntityNotFound(_0x5e3ff5,null))[_0x97bb('0x23')](function(_0x2c1f4d){if(_0x2c1f4d){return _0x2c1f4d['removeAgents'](_0x361cc9[_0x97bb('0x49')][_0x97bb('0x6e')])[_0x97bb('0x23')](function(){if(_[_0x97bb('0x79')](_0x361cc9[_0x97bb('0x49')][_0x97bb('0x6e')])){for(var _0x2a63da=0x0;_0x2a63da<_0x361cc9[_0x97bb('0x49')][_0x97bb('0x6e')][_0x97bb('0x4f')];_0x2a63da+=0x1){socket['emit'](_0x97bb('0x7a'),{'UserId':Number(_0x361cc9[_0x97bb('0x49')][_0x97bb('0x6e')][_0x2a63da]),'WhatsappAccountId':Number(_0x361cc9[_0x97bb('0x5c')]['id'])});}}else{socket[_0x97bb('0x76')](_0x97bb('0x7a'),{'UserId':Number(_0x361cc9['query'][_0x97bb('0x6e')]),'WhatsappAccountId':Number(_0x361cc9['params']['id'])});}});}})[_0x97bb('0x23')](respondWithStatusCode(_0x5e3ff5,null))[_0x97bb('0x2d')](handleError(_0x5e3ff5,null));};exports[_0x97bb('0x7b')]=function(_0x70e9d1,_0x42fc97,_0x87df23){var _0x586219={};var _0x2c3aff={};var _0x556256;var _0x45d8da;return db[_0x97bb('0x45')][_0x97bb('0x6a')]({'where':{'id':_0x70e9d1[_0x97bb('0x5c')]['id']}})[_0x97bb('0x23')](handleEntityNotFound(_0x42fc97,null))[_0x97bb('0x23')](function(_0x2696b5){if(_0x2696b5){_0x556256=_0x2696b5;_0x2c3aff[_0x97bb('0x48')]=_['keys'](db[_0x97bb('0x7c')][_0x97bb('0x46')]);_0x2c3aff[_0x97bb('0x49')]=_[_0x97bb('0x4a')](_0x70e9d1[_0x97bb('0x49')]);_0x2c3aff[_0x97bb('0x4b')]=_['intersection'](_0x2c3aff[_0x97bb('0x48')],_0x2c3aff[_0x97bb('0x49')]);_0x586219[_0x97bb('0x4d')]=_[_0x97bb('0x4c')](_0x2c3aff[_0x97bb('0x48')],qs[_0x97bb('0x4e')](_0x70e9d1[_0x97bb('0x49')]['fields']));_0x586219[_0x97bb('0x4d')]=_0x586219[_0x97bb('0x4d')]['length']?_0x586219[_0x97bb('0x4d')]:_0x2c3aff[_0x97bb('0x48')];_0x586219[_0x97bb('0x52')]=qs['sort'](_0x70e9d1[_0x97bb('0x49')][_0x97bb('0x53')]);_0x586219[_0x97bb('0x54')]=qs[_0x97bb('0x4b')](_[_0x97bb('0x6b')](_0x70e9d1[_0x97bb('0x49')],_0x2c3aff[_0x97bb('0x4b')]));if(_0x70e9d1[_0x97bb('0x49')]['filter']){_0x586219[_0x97bb('0x54')]=_[_0x97bb('0x57')](_0x586219[_0x97bb('0x54')],{'$or':_[_0x97bb('0x44')](_0x586219[_0x97bb('0x4d')],function(_0x334528){var _0x12c033={};_0x12c033[_0x334528]={'$like':'%'+_0x70e9d1[_0x97bb('0x49')][_0x97bb('0x55')]+'%'};return _0x12c033;})});}_0x586219=_[_0x97bb('0x57')]({},_0x586219,_0x70e9d1['options']);return _0x556256[_0x97bb('0x7b')](_0x586219);}})[_0x97bb('0x23')](function(_0x1d7be1){if(_0x1d7be1){_0x45d8da=_0x1d7be1[_0x97bb('0x4f')];if(!_0x70e9d1[_0x97bb('0x49')][_0x97bb('0x50')](_0x97bb('0x51'))){_0x586219[_0x97bb('0x32')]=qs[_0x97bb('0x32')](_0x70e9d1['query'][_0x97bb('0x32')]);_0x586219[_0x97bb('0x35')]=qs['offset'](_0x70e9d1['query'][_0x97bb('0x35')]);}return _0x556256[_0x97bb('0x7b')](_0x586219);}})[_0x97bb('0x23')](function(_0x585075){if(_0x585075){return _0x585075?{'count':_0x45d8da,'rows':_0x585075}:null;}})['then'](respondWithResult(_0x42fc97,null))[_0x97bb('0x2d')](handleError(_0x42fc97,null));};exports['addApplications']=function(_0x1b2ca9,_0x12f745){var _0x5c1056=_0x1b2ca9[_0x97bb('0x5c')]['id'];var _0x10567b=_0x1b2ca9[_0x97bb('0x5f')];var _0x22699f=0xc8;var _0x3a7621=null;return db['sequelize'][_0x97bb('0x7d')]({'isolationLevel':db[_0x97bb('0x7e')][_0x97bb('0x7f')][_0x97bb('0x80')][_0x97bb('0x81')]},function(_0x41d2a2){return db[_0x97bb('0x45')]['findOne']({'where':{'id':_0x5c1056},'transaction':_0x41d2a2})['then'](function(_0x14f187){if(_0x14f187){return db[_0x97bb('0x82')][_0x97bb('0x3a')]({'where':{'WhatsappAccountId':_0x5c1056},'transaction':_0x41d2a2})[_0x97bb('0x23')](function(){var _0x226515=_['map'](_0x10567b,function(_0x4d8c81){_0x4d8c81[_0x97bb('0x68')]=_0x5c1056;return _0x4d8c81;});return db['WhatsappApplication'][_0x97bb('0x83')](_0x226515,{'transaction':_0x41d2a2});});}else{_0x22699f=0x194;_0x3a7621=[];}});})[_0x97bb('0x23')](function(){if(_0x22699f!==0x194){return db[_0x97bb('0x82')][_0x97bb('0x84')]({'where':{'WhatsappAccountId':_0x5c1056},'order':_0x97bb('0x85')})[_0x97bb('0x23')](function(_0xb3bb2c){_0x3a7621=_0xb3bb2c;});}})[_0x97bb('0x2d')](function(_0x5c98a0){_0x22699f=0x1f4;logger[_0x97bb('0x2a')](_0x5c98a0[_0x97bb('0x3e')]);if(_0x5c98a0[_0x97bb('0x3f')]){delete _0x5c98a0[_0x97bb('0x3f')];}_0x3a7621=_0x5c98a0;})[_0x97bb('0x86')](function(){if(_0x3a7621===null){_0x12f745[_0x97bb('0x2e')](_0x22699f);}else{if(_0x22699f===0x1f4){_0x12f745[_0x97bb('0x30')](_0x22699f)[_0x97bb('0x40')](_0x3a7621);}else{_0x12f745['status'](_0x22699f)[_0x97bb('0x31')](_0x3a7621);}}});};exports[_0x97bb('0x87')]=function(_0x370156,_0xf5c471,_0x4effd6){var _0x3103d5={};var _0x4656e8={};var _0x4a3ea3;var _0x31e51e;return db[_0x97bb('0x45')][_0x97bb('0x6a')]({'where':{'id':_0x370156['params']['id']}})['then'](handleEntityNotFound(_0xf5c471,null))[_0x97bb('0x23')](function(_0x2eddea){if(_0x2eddea){_0x4a3ea3=_0x2eddea;_0x4656e8[_0x97bb('0x48')]=_['keys'](db[_0x97bb('0x82')][_0x97bb('0x46')]);_0x4656e8[_0x97bb('0x49')]=_[_0x97bb('0x4a')](_0x370156['query']);_0x4656e8[_0x97bb('0x4b')]=_['intersection'](_0x4656e8[_0x97bb('0x48')],_0x4656e8[_0x97bb('0x49')]);_0x3103d5[_0x97bb('0x4d')]=_[_0x97bb('0x4c')](_0x4656e8[_0x97bb('0x48')],qs[_0x97bb('0x4e')](_0x370156['query'][_0x97bb('0x4e')]));_0x3103d5[_0x97bb('0x4d')]=_0x3103d5[_0x97bb('0x4d')][_0x97bb('0x4f')]?_0x3103d5[_0x97bb('0x4d')]:_0x4656e8[_0x97bb('0x48')];_0x3103d5[_0x97bb('0x52')]=qs['sort'](_0x370156['query'][_0x97bb('0x53')]);_0x3103d5[_0x97bb('0x54')]=qs[_0x97bb('0x4b')](_[_0x97bb('0x6b')](_0x370156[_0x97bb('0x49')],_0x4656e8['filters']));if(_0x370156[_0x97bb('0x49')]['filter']){_0x3103d5['where']=_[_0x97bb('0x57')](_0x3103d5[_0x97bb('0x54')],{'$or':_[_0x97bb('0x44')](_0x3103d5[_0x97bb('0x4d')],function(_0x1d505e){var _0x34b4a5={};_0x34b4a5[_0x1d505e]={'$like':'%'+_0x370156[_0x97bb('0x49')][_0x97bb('0x55')]+'%'};return _0x34b4a5;})});}_0x3103d5=_['merge']({},_0x3103d5,_0x370156[_0x97bb('0x58')]);return _0x4a3ea3['getApplications'](_0x3103d5);}})[_0x97bb('0x23')](function(_0x5029a3){if(_0x5029a3){_0x31e51e=_0x5029a3[_0x97bb('0x4f')];if(!_0x370156['query'][_0x97bb('0x50')](_0x97bb('0x51'))){_0x3103d5[_0x97bb('0x32')]=qs[_0x97bb('0x32')](_0x370156[_0x97bb('0x49')][_0x97bb('0x32')]);_0x3103d5[_0x97bb('0x35')]=qs[_0x97bb('0x35')](_0x370156[_0x97bb('0x49')]['offset']);}return _0x4a3ea3[_0x97bb('0x87')](_0x3103d5);}})[_0x97bb('0x23')](function(_0x321e5c){if(_0x321e5c){return _0x321e5c?{'count':_0x31e51e,'rows':_0x321e5c}:null;}})[_0x97bb('0x23')](respondWithResult(_0xf5c471,null))[_0x97bb('0x2d')](handleError(_0xf5c471,null));};exports[_0x97bb('0x88')]=function(_0x83116e,_0x26fc25,_0x451e08){var _0x1d1f9d={'channel':_0x97bb('0x89')};var _0x116737=[];var _0x1ee20b=[];var _0x3328f9={};return db[_0x97bb('0x45')][_0x97bb('0x5d')]({'where':{'id':_0x83116e['params']['id']},'include':[{'model':db[_0x97bb('0x82')],'as':_0x97bb('0x8a')}]})[_0x97bb('0x23')](handleEntityNotFound(_0x26fc25,null))['then'](function(_0x321932){_0x1d1f9d[_0x97bb('0x8b')]=_0x321932;if(_0x1d1f9d[_0x97bb('0x8b')]&&_0x1d1f9d[_0x97bb('0x8b')][_0x97bb('0x47')]===_0x97bb('0x8c')&&_0x83116e['body'][_0x97bb('0x8d')]){if(_0x83116e[_0x97bb('0x5f')][_0x97bb('0x8d')]['length']===0x0)return;if(_0x83116e[_0x97bb('0x5f')][_0x97bb('0x8d')][0x0][_0x97bb('0x8e')]!==_0x97bb('0x8f'))return;return db[_0x97bb('0x90')][_0x97bb('0x39')]({'read':!![],'readAt':_0x83116e['body']['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x83116e[_0x97bb('0x5f')]['statuses'][0x0][_0x97bb('0x91')]},'individualHooks':!![]})[_0x97bb('0x23')](function(_0x56d74a){return _0x26fc25[_0x97bb('0x30')](0xc8)[_0x97bb('0x31')](_0x56d74a);});}_0x1d1f9d[_0x97bb('0x92')]=_[_0x97bb('0x93')](_0x321932[_0x97bb('0x8a')],['priority'],[_0x97bb('0x94')]);if(_0x1d1f9d[_0x97bb('0x8b')]['Applications']){delete _0x1d1f9d[_0x97bb('0x8b')][_0x97bb('0x8a')];}return db[_0x97bb('0x95')][_0x97bb('0x66')]()[_0x97bb('0x23')](function(_0x14fa37){if(!_0x14fa37){throw new db[(_0x97bb('0x96'))][(_0x97bb('0x97'))](_0x97bb('0x98'));}_0x116737=_[_0x97bb('0x99')](_[_0x97bb('0x4a')](_0x14fa37),[_0x97bb('0x9a'),_0x97bb('0x9b')]);_0x1ee20b=_['difference'](_[_0x97bb('0x4a')](_0x14fa37),['createdAt',_0x97bb('0x9b'),_0x97bb('0x9c'),_0x97bb('0x9d')]);_0x1d1f9d['body']={'mapKey':_0x97bb('0x9e')};if(_0x1d1f9d[_0x97bb('0x8b')]&&_0x1d1f9d[_0x97bb('0x8b')][_0x97bb('0x47')]===_0x97bb('0x9f')){_0x1d1f9d['body']['from']=_0x83116e['body'][_0x97bb('0xa0')][_0x97bb('0xa1')](_0x97bb('0xa2'),'');_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0x5f')]=_0x83116e['body'][_0x97bb('0xa3')];_0x1d1f9d[_0x97bb('0x5f')]['messageId']=_0x83116e[_0x97bb('0x5f')][_0x97bb('0xa4')];}if(_0x1d1f9d[_0x97bb('0x8b')]&&_0x1d1f9d[_0x97bb('0x8b')][_0x97bb('0x47')]==='sinch'){_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xa5')]=_0x83116e['body']['notifications'][0x0][_0x97bb('0xa5')];_0x1d1f9d['body'][_0x97bb('0x5f')]=_0x83116e[_0x97bb('0x5f')][_0x97bb('0xa6')][0x0][_0x97bb('0x2b')][_0x97bb('0x5f')];_0x1d1f9d[_0x97bb('0x5f')]['messageId']=_0x83116e[_0x97bb('0x5f')][_0x97bb('0xa6')][0x0][_0x97bb('0x91')];}if(_0x1d1f9d['body']['id']){delete _0x1d1f9d[_0x97bb('0x5f')]['id'];}if(_['isNil'](_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xa5')])){throw new db[(_0x97bb('0x96'))][(_0x97bb('0x97'))](_0x97bb('0xa7'));}if(_[_0x97bb('0xa8')](_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0x5f')])||_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0x5f')]===''){throw new db[(_0x97bb('0x96'))]['ValidationError'](_0x97bb('0xa9'));}if(_[_0x97bb('0xa8')](_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xaa')])){throw new db[(_0x97bb('0x96'))]['ValidationError'](_0x97bb('0xab')+_0x1ee20b);}if(!_[_0x97bb('0xac')](_0x1ee20b,_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xaa')])){throw new db[(_0x97bb('0x96'))][(_0x97bb('0x97'))](_0x97bb('0xad')+_0x1ee20b);}_0x3328f9[_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xaa')]]=_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xa5')];return db[_0x97bb('0xae')][_0x97bb('0x5d')]({'where':{'id':_0x1d1f9d[_0x97bb('0x8b')][_0x97bb('0x9d')]},'include':[{'model':db[_0x97bb('0x95')],'as':'Contacts','where':_0x3328f9,'limit':0x1,'order':[[_0x97bb('0x9b'),'DESC']]}]});})[_0x97bb('0x23')](handleEntityNotFound(_0x26fc25,null))['then'](function(_0x3d4079){if(_0x3d4079){_0x1d1f9d[_0x97bb('0xaf')]=_[_0x97bb('0x74')](_0x3d4079,[_0x97bb('0xb0')]);if(_0x3d4079['Contacts'][_0x97bb('0x4f')]){return _0x3d4079[_0x97bb('0xb0')][0x0];}var _0x19574c=_[_0x97bb('0x1a')](_0x1d1f9d[_0x97bb('0x5f')],{'firstName':_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xa5')],'ListId':_0x3d4079['id']});_0x19574c[_0x1d1f9d['body']['mapKey']]=_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xa5')];return db[_0x97bb('0x95')][_0x97bb('0x5e')](_0x19574c,{'fields':_0x116737,'raw':!![]});}})[_0x97bb('0x23')](handleEntityNotFound(_0x26fc25,null))[_0x97bb('0x23')](function(_0x52cb5d){if(_0x52cb5d){_0x1d1f9d[_0x97bb('0xb1')]=_0x52cb5d;var _0x58a54e={'ContactId':_0x52cb5d['id'],'phone':_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xa5')],'WhatsappAccountId':_0x83116e[_0x97bb('0x5c')]['id']};var _0x2cc95a={'ContactId':_0x52cb5d['id'],'WhatsappAccountId':_0x83116e[_0x97bb('0x5c')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x97bb('0x5d')]({'where':_0x2cc95a})[_0x97bb('0x23')](function(_0x490beb){if(_0x490beb){return[_0x490beb,![]];}return db[_0x97bb('0xb2')][_0x97bb('0x5e')](_0x58a54e)[_0x97bb('0x23')](function(_0x53174b){return[_0x53174b,!![]];});});}})['spread'](function(_0x27677e,_0xfa5a0f){_0x1d1f9d[_0x97bb('0xb3')]=_0x27677e['get']({'plain':!![]});_0x1d1f9d[_0x97bb('0xb3')][_0x97bb('0xb4')]=![];if(_0xfa5a0f){if(_0x1d1f9d['account'][_0x97bb('0xb5')]){_0x1d1f9d[_0x97bb('0x92')][_0x97bb('0xb6')]({'id':0x0,'priority':_0x1d1f9d['applications'][_0x97bb('0x4f')]+0x1,'app':'close','appdata':_0x97bb('0xb7'),'interval':'*,*,*,*'});}_0x1d1f9d[_0x97bb('0xb3')][_0x97bb('0xb4')]=!![];}return db[_0x97bb('0x90')]['create']({'phone':_0x1d1f9d['body'][_0x97bb('0xa5')],'messageId':_0x1d1f9d[_0x97bb('0x5f')]['messageId'],'body':_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0x5f')],'WhatsappAccountId':_0x83116e[_0x97bb('0x5c')]['id'],'WhatsappInteractionId':_0x27677e['id'],'direction':'in','ContactId':_0x27677e['ContactId'],'AttachmentId':_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xb8')]});})['then'](function(_0x4587ca){_0x1d1f9d[_0x97bb('0x2b')]=_0x4587ca;if(!_0x1d1f9d[_0x97bb('0xb3')]['UserId'])return;return db['User'][_0x97bb('0x5d')]({'attributes':['id',_0x97bb('0x3f')],'where':{'id':_0x1d1f9d['interaction']['UserId']}});})['then'](function(_0x1dbd3a){if(_0x1dbd3a){_0x1d1f9d[_0x97bb('0x92')][_0x97bb('0xb9')]({'id':0x0,'priority':0x0,'app':_0x97bb('0xba'),'appdata':_0x1dbd3a[_0x97bb('0x3f')]+','+(_0x1d1f9d[_0x97bb('0x8b')][_0x97bb('0xbb')]||0xa),'interval':_0x97bb('0xbc')});}if(!_0x1d1f9d['interaction'][_0x97bb('0xbd')])return;return db[_0x97bb('0xbe')][_0x97bb('0x5d')]({'attributes':['id',_0x97bb('0x3f')],'where':{'id':_0x1d1f9d['interaction'][_0x97bb('0xbd')]}});})['then'](function(_0xa85063){if(_0xa85063){_0x1d1f9d[_0x97bb('0x92')][_0x97bb('0xb9')]({'id':0x0,'priority':0x1,'app':_0x97bb('0xbf'),'appdata':_0xa85063['name']+','+(_0x1d1f9d[_0x97bb('0x8b')][_0x97bb('0xc0')]||0x12c),'interval':_0x97bb('0xbc')});}return respondWithRpcPromise(_0x97bb('0xc1'),_0x97bb('0xc2'),_0x1d1f9d);})[_0x97bb('0x23')](function(_0x5a10fb){if(_0x5a10fb){var _0x22aca1=0xc8;var _0xf8d658='receiveMessage';logger['info'](_0x97bb('0x28'),_0xf8d658,_0x22aca1,_0x97bb('0xc3'));logger[_0x97bb('0x27')](_0x97bb('0xc4'),_0xf8d658,_0x22aca1,_0x97bb('0xc3'),JSON[_0x97bb('0x29')](_0x5a10fb));if(_0x1d1f9d[_0x97bb('0x8b')]['type']===_0x97bb('0x9f')){return _0x26fc25[_0x97bb('0x30')](_0x22aca1)[_0x97bb('0xc5')]('Content-Type',_0x97bb('0xc6'))['send']('\x0a');}else{return _0x26fc25['status'](_0x22aca1)['json'](_0x5a10fb);}}});})[_0x97bb('0x2d')](handleError(_0x26fc25,null));};exports['send']=function(_0x8458d3,_0x3c6a7d,_0x18d6fb){var _0x1df677,_0x51c456,_0x9ae2be;if(_['isNil'](_0x8458d3[_0x97bb('0x5f')]['body'])||_0x8458d3[_0x97bb('0x5f')][_0x97bb('0x5f')]===''){throw new db[(_0x97bb('0x96'))][(_0x97bb('0x97'))](_0x97bb('0xa9'));}if(_[_0x97bb('0xa8')](_0x8458d3[_0x97bb('0x5f')]['to'])){throw new db[(_0x97bb('0x96'))]['ValidationError']('to\x20is\x20mandatory');}_0x1df677=_0x8458d3[_0x97bb('0x5f')]['to'];return db[_0x97bb('0x45')][_0x97bb('0x5d')]({'where':{'id':_0x8458d3[_0x97bb('0x5c')]['id']},'include':[{'model':db[_0x97bb('0xae')],'as':'List','include':[{'model':db[_0x97bb('0x95')],'as':_0x97bb('0xb0'),'where':{'mobile':_0x1df677},'limit':0x1,'order':[['updatedAt',_0x97bb('0xc7')]]}]}]})[_0x97bb('0x23')](handleEntityNotFound(_0x3c6a7d,null))['then'](function(_0x3c9fa2){if(_0x3c9fa2&&_0x3c9fa2[_0x97bb('0xc8')]){_0x51c456=_0x3c9fa2[_0x97bb('0x3b')]({'plain':!![]});if(_0x51c456[_0x97bb('0xc8')]&&_0x51c456[_0x97bb('0xc8')][_0x97bb('0xb0')][_0x97bb('0x4f')]){return _0x51c456['List'][_0x97bb('0xb0')][0x0];}return db[_0x97bb('0x95')][_0x97bb('0x5e')](_[_0x97bb('0x1a')](_0x8458d3[_0x97bb('0x5f')],{'firstName':_0x1df677,'mobile':_0x1df677,'phone':_0x1df677,'ListId':_0x51c456[_0x97bb('0x9d')]}));}})[_0x97bb('0x23')](handleEntityNotFound(_0x3c6a7d,null))[_0x97bb('0x23')](function(_0x4d251d){if(_0x4d251d){_0x9ae2be=_0x4d251d;return db['WhatsappInteraction'][_0x97bb('0x5d')]({'where':{'ContactId':_0x9ae2be['id'],'closed':![],'WhatsappAccountId':_0x51c456['id']}})[_0x97bb('0x23')](function(_0x16a188){if(_0x16a188){return[_0x16a188,![]];}return db[_0x97bb('0xb2')][_0x97bb('0x5e')]({'UserId':_0x8458d3['user']['id'],'ContactId':_0x9ae2be['id'],'WhatsappAccountId':_0x51c456['id'],'phone':_0x1df677,'firstMsgDirection':_0x97bb('0xc9'),'Messages':[_[_0x97bb('0x57')](_0x8458d3[_0x97bb('0x5f')],{'read':![],'body':_0x8458d3['body'][_0x97bb('0x5f')],'phone':_0x1df677,'WhatsappAccountId':_0x51c456['id'],'UserId':_0x8458d3[_0x97bb('0x60')]['id'],'ContactId':_0x9ae2be['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})['then'](function(_0x2ace41){return[_0x2ace41,!![]];});});}})[_0x97bb('0x75')](function(_0x3e114b,_0x4513b6){if(_0x4513b6){return _0x3e114b;}return db[_0x97bb('0x90')][_0x97bb('0x5e')](_['merge'](_0x8458d3[_0x97bb('0x5f')],{'read':![],'body':_0x8458d3[_0x97bb('0x5f')]['body'],'phone':_0x1df677,'WhatsappAccountId':_0x51c456['id'],'WhatsappInteractionId':_0x3e114b['id'],'UserId':_0x8458d3[_0x97bb('0x60')]['id'],'ContactId':_0x9ae2be['id']}))[_0x97bb('0x23')](function(_0x1e81e8){_0x3e114b[_0x97bb('0xca')][_0x97bb('0xcb')]=[];_0x3e114b[_0x97bb('0xca')][_0x97bb('0xcb')][_0x97bb('0xb6')](_0x1e81e8[_0x97bb('0xca')]);return _0x3e114b;});})[_0x97bb('0x23')](respondWithResult(_0x3c6a7d,null))[_0x97bb('0x2d')](handleError(_0x3c6a7d,null));}; \ No newline at end of file +var _0x123d=['moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','undefined','limit','offset','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','show','options','find','create','body','user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','WhatsappAccountId','Disposition','removeDispositions','addAnswer','findOne','CannedAnswer','removeAnswers','ids','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','Applications','account','statuses','WhatsappMessage','timestamp','message_id','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','contact','WhatsappInteraction','spread','interaction','created','autoclose','applications','push','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','to\x20is\x20mandatory','List','defaults','out','dataValues','Messages','eml-format','zip-dir','request-promise'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x123d,0x187));var _0xd123=function(_0x560575,_0x4d2629){_0x560575=_0x560575-0x0;var _0x3adb83=_0x123d[_0x560575];return _0x3adb83;};'use strict';var emlformat=require(_0xd123('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd123('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd123('0x2'));var moment=require(_0xd123('0x3'));var BPromise=require(_0xd123('0x4'));var Mustache=require(_0xd123('0x5'));var util=require(_0xd123('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd123('0x7'));var fs=require('fs');var fs_extra=require(_0xd123('0x8'));var _=require(_0xd123('0x9'));var squel=require(_0xd123('0xa'));var crypto=require(_0xd123('0xb'));var jsforce=require(_0xd123('0xc'));var deskjs=require(_0xd123('0xd'));var toCsv=require(_0xd123('0xe'));var querystring=require(_0xd123('0xf'));var Papa=require('papaparse');var Redis=require(_0xd123('0x10'));var authService=require(_0xd123('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd123('0x12'));var hardwareService=require(_0xd123('0x13'));var logger=require(_0xd123('0x14'))(_0xd123('0x15'));var utils=require(_0xd123('0x16'));var config=require(_0xd123('0x17'));var licenseUtil=require(_0xd123('0x18'));var db=require(_0xd123('0x19'))['db'];config[_0xd123('0x1a')]=_['defaults'](config[_0xd123('0x1a')],{'host':_0xd123('0x1b'),'port':0x18eb});var socket=require(_0xd123('0x1c'))(new Redis(config[_0xd123('0x1a')]));require(_0xd123('0x1d'))[_0xd123('0x1e')](socket);var jayson=require(_0xd123('0x1f'));var client=jayson['client'][_0xd123('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x643ca0,_0x47cba7,_0x4d3656,_0x513b57){return new BPromise(function(_0x13ac64,_0x59fd3f){var _0x556dc3=_0x513b57||client;return _0x556dc3[_0xd123('0x21')](_0x643ca0,_0x4d3656)[_0xd123('0x22')](function(_0x12a2c1){logger[_0xd123('0x23')](_0xd123('0x24'),_0x47cba7,_0xd123('0x25'));logger[_0xd123('0x26')](_0xd123('0x27'),_0x47cba7,_0xd123('0x25'),JSON[_0xd123('0x28')](_0x12a2c1));if(_0x12a2c1[_0xd123('0x29')]){if(_0x12a2c1[_0xd123('0x29')]['code']===0x1f4){logger[_0xd123('0x29')](_0xd123('0x24'),_0x47cba7,_0x12a2c1[_0xd123('0x29')][_0xd123('0x2a')]);return _0x59fd3f(_0x12a2c1[_0xd123('0x29')][_0xd123('0x2a')]);}logger[_0xd123('0x29')](_0xd123('0x24'),_0x47cba7,_0x12a2c1['error']['message']);return _0x13ac64(_0x12a2c1[_0xd123('0x29')]['message']);}else{logger[_0xd123('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x47cba7,'request\x20sent');_0x13ac64(_0x12a2c1[_0xd123('0x2b')][_0xd123('0x2a')]);}})[_0xd123('0x2c')](function(_0x109990){logger[_0xd123('0x29')](_0xd123('0x24'),_0x47cba7,_0x109990);_0x59fd3f(_0x109990);});});}function respondWithStatusCode(_0x3e24f3,_0x1397f7){_0x1397f7=_0x1397f7||0xcc;return function(_0x5d20cd){if(_0x5d20cd){return _0x3e24f3[_0xd123('0x2d')](_0x1397f7);}return _0x3e24f3['status'](_0x1397f7)[_0xd123('0x2e')]();};}function respondWithResult(_0x47cd98,_0x5be25a){_0x5be25a=_0x5be25a||0xc8;return function(_0x21ca85){if(_0x21ca85){return _0x47cd98[_0xd123('0x2f')](_0x5be25a)[_0xd123('0x30')](_0x21ca85);}};}function respondWithFilteredResult(_0x1258b8,_0x2a4de5){return function(_0x4008db){if(_0x4008db){var _0x317db4=typeof _0x2a4de5['offset']===_0xd123('0x31')&&typeof _0x2a4de5[_0xd123('0x32')]==='undefined';var _0x520d78=_0x4008db['count'];var _0x3f23e5=_0x317db4?0x0:_0x2a4de5[_0xd123('0x33')];var _0x942c36=_0x317db4?_0x4008db['count']:_0x2a4de5[_0xd123('0x33')]+_0x2a4de5['limit'];var _0x364778;if(_0x942c36>=_0x520d78){_0x942c36=_0x520d78;_0x364778=0xc8;}else{_0x364778=0xce;}_0x1258b8['status'](_0x364778);return _0x1258b8['set'](_0xd123('0x34'),_0x3f23e5+'-'+_0x942c36+'/'+_0x520d78)['json'](_0x4008db);}return null;};}function patchUpdates(_0x53096e){return function(_0x2401b4){try{jsonpatch[_0xd123('0x35')](_0x2401b4,_0x53096e,!![]);}catch(_0x250d5c){return BPromise[_0xd123('0x36')](_0x250d5c);}return _0x2401b4[_0xd123('0x37')]();};}function saveUpdates(_0x64782c,_0x2a88fb){return function(_0x4b25d0){if(_0x4b25d0){return _0x4b25d0[_0xd123('0x38')](_0x64782c)[_0xd123('0x22')](function(_0x57e819){return _0x57e819;});}return null;};}function removeEntity(_0x116cce,_0x56279c){return function(_0x28b244){if(_0x28b244){return _0x28b244[_0xd123('0x39')]()['then'](function(){var _0x47253d=_0x28b244[_0xd123('0x3a')]({'plain':!![]});var _0x367893=_0xd123('0x3b');return db['UserProfileResource'][_0xd123('0x39')]({'where':{'type':_0x367893,'resourceId':_0x47253d['id']}})[_0xd123('0x22')](function(){return _0x28b244;});})[_0xd123('0x22')](function(){_0x116cce['status'](0xcc)[_0xd123('0x2e')]();});}};}function handleEntityNotFound(_0x5b2e72,_0x453261){return function(_0x5cfd15){if(!_0x5cfd15){_0x5b2e72[_0xd123('0x2d')](0x194);}return _0x5cfd15;};}function handleError(_0x4e8b6d,_0x36c1f0){_0x36c1f0=_0x36c1f0||0x1f4;return function(_0x5197a8){logger[_0xd123('0x29')](_0x5197a8[_0xd123('0x3c')]);if(_0x5197a8['name']){delete _0x5197a8[_0xd123('0x3d')];}_0x4e8b6d[_0xd123('0x2f')](_0x36c1f0)[_0xd123('0x3e')](_0x5197a8);};}exports[_0xd123('0x3f')]=function(_0x189fd4,_0x38b298){var _0x3b8d64={'include':[{'model':db[_0xd123('0x40')],'as':_0xd123('0x41')}]},_0x51b051={},_0x806c98={'count':0x0,'rows':[]};var _0x5a8452=_[_0xd123('0x42')](db[_0xd123('0x43')][_0xd123('0x44')],function(_0x8b2619){return{'name':_0x8b2619[_0xd123('0x45')],'type':_0x8b2619[_0xd123('0x46')]['key']};});_0x51b051[_0xd123('0x47')]=_[_0xd123('0x42')](_0x5a8452,'name');_0x51b051[_0xd123('0x48')]=_[_0xd123('0x49')](_0x189fd4[_0xd123('0x48')]);_0x51b051[_0xd123('0x4a')]=_[_0xd123('0x4b')](_0x51b051[_0xd123('0x47')],_0x51b051['query']);_0x3b8d64['attributes']=_[_0xd123('0x4b')](_0x51b051[_0xd123('0x47')],qs['fields'](_0x189fd4[_0xd123('0x48')][_0xd123('0x4c')]));_0x3b8d64['attributes']=_0x3b8d64[_0xd123('0x4d')][_0xd123('0x4e')]?_0x3b8d64[_0xd123('0x4d')]:_0x51b051['model'];if(!_0x189fd4['query'][_0xd123('0x4f')](_0xd123('0x50'))){_0x3b8d64[_0xd123('0x32')]=qs['limit'](_0x189fd4[_0xd123('0x48')][_0xd123('0x32')]);_0x3b8d64[_0xd123('0x33')]=qs[_0xd123('0x33')](_0x189fd4[_0xd123('0x48')][_0xd123('0x33')]);}_0x3b8d64[_0xd123('0x51')]=qs[_0xd123('0x52')](_0x189fd4[_0xd123('0x48')][_0xd123('0x52')]);_0x3b8d64[_0xd123('0x53')]=qs['filters'](_[_0xd123('0x54')](_0x189fd4[_0xd123('0x48')],_0x51b051[_0xd123('0x4a')]),_0x5a8452);if(_0x189fd4[_0xd123('0x48')][_0xd123('0x55')]){_0x3b8d64[_0xd123('0x53')]=_[_0xd123('0x56')](_0x3b8d64[_0xd123('0x53')],{'$or':_['map'](_0x5a8452,function(_0xbebee6){if(_0xbebee6[_0xd123('0x46')]!=='VIRTUAL'){var _0x3a8c9a={};_0x3a8c9a[_0xbebee6[_0xd123('0x3d')]]={'$like':'%'+_0x189fd4[_0xd123('0x48')][_0xd123('0x55')]+'%'};return _0x3a8c9a;}})});}_0x3b8d64=_['merge']({},_0x3b8d64,_0x189fd4['options']);var _0x2585a5={'where':_0x3b8d64['where']};return db[_0xd123('0x43')][_0xd123('0x57')](_0x2585a5)['then'](function(_0x36e2a8){_0x806c98['count']=_0x36e2a8;if(_0x189fd4[_0xd123('0x48')][_0xd123('0x58')]){_0x3b8d64[_0xd123('0x59')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xd123('0x5a')](_0x3b8d64);})['then'](function(_0x20e387){_0x806c98[_0xd123('0x5b')]=_0x20e387;return _0x806c98;})[_0xd123('0x22')](respondWithFilteredResult(_0x38b298,_0x3b8d64))['catch'](handleError(_0x38b298,null));};exports[_0xd123('0x5c')]=function(_0x124cf3,_0x4dd1f2){var _0x67ea0={'raw':![],'where':{'id':_0x124cf3['params']['id']},'include':[{'model':db[_0xd123('0x40')],'as':_0xd123('0x41')}]},_0x5618df={};_0x5618df[_0xd123('0x47')]=_[_0xd123('0x49')](db[_0xd123('0x43')][_0xd123('0x44')]);_0x5618df[_0xd123('0x48')]=_['keys'](_0x124cf3[_0xd123('0x48')]);_0x5618df['filters']=_[_0xd123('0x4b')](_0x5618df[_0xd123('0x47')],_0x5618df[_0xd123('0x48')]);_0x67ea0[_0xd123('0x4d')]=_[_0xd123('0x4b')](_0x5618df['model'],qs[_0xd123('0x4c')](_0x124cf3[_0xd123('0x48')][_0xd123('0x4c')]));_0x67ea0[_0xd123('0x4d')]=_0x67ea0[_0xd123('0x4d')]['length']?_0x67ea0[_0xd123('0x4d')]:_0x5618df[_0xd123('0x47')];if(_0x124cf3[_0xd123('0x48')][_0xd123('0x58')]){_0x67ea0['include']=[{'all':!![]}];}_0x67ea0=_[_0xd123('0x56')]({},_0x67ea0,_0x124cf3[_0xd123('0x5d')]);return db[_0xd123('0x43')][_0xd123('0x5e')](_0x67ea0)[_0xd123('0x22')](handleEntityNotFound(_0x4dd1f2,null))['then'](respondWithResult(_0x4dd1f2,null))['catch'](handleError(_0x4dd1f2,null));};exports[_0xd123('0x5f')]=function(_0x2e3760,_0x4c1724){return db[_0xd123('0x43')][_0xd123('0x5f')](_0x2e3760[_0xd123('0x60')],{})[_0xd123('0x22')](function(_0xe7b81){var _0x497cc5=_0x2e3760[_0xd123('0x61')]['get']({'plain':!![]});if(!_0x497cc5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497cc5[_0xd123('0x62')]===_0xd123('0x61')){var _0x131387=_0xe7b81['get']({'plain':!![]});var _0x28cadf=_0xd123('0x3b');return db[_0xd123('0x63')][_0xd123('0x5e')]({'where':{'name':_0x28cadf,'userProfileId':_0x497cc5['userProfileId']},'raw':!![]})['then'](function(_0x4f69cc){if(_0x4f69cc&&_0x4f69cc[_0xd123('0x64')]===0x0){return db[_0xd123('0x65')]['create']({'name':_0x131387[_0xd123('0x3d')],'resourceId':_0x131387['id'],'type':_0x4f69cc[_0xd123('0x3d')],'sectionId':_0x4f69cc['id']},{})[_0xd123('0x22')](function(){return _0xe7b81;});}else{return _0xe7b81;}})[_0xd123('0x2c')](function(_0x117019){logger[_0xd123('0x29')](_0xd123('0x66'),_0x117019);throw _0x117019;});}return _0xe7b81;})[_0xd123('0x22')](respondWithResult(_0x4c1724,0xc9))[_0xd123('0x2c')](handleError(_0x4c1724,null));};exports['update']=function(_0x5d9537,_0x23f712){if(_0x5d9537[_0xd123('0x60')]['id']){delete _0x5d9537[_0xd123('0x60')]['id'];}return db[_0xd123('0x43')]['find']({'where':{'id':_0x5d9537[_0xd123('0x67')]['id']},'include':[{'model':db[_0xd123('0x40')],'as':_0xd123('0x41')}]})[_0xd123('0x22')](handleEntityNotFound(_0x23f712,null))[_0xd123('0x22')](saveUpdates(_0x5d9537[_0xd123('0x60')],null))[_0xd123('0x22')](respondWithResult(_0x23f712,null))['catch'](handleError(_0x23f712,null));};exports[_0xd123('0x39')]=function(_0x195a9b,_0x53f7a4){return db['WhatsappAccount']['find']({'where':{'id':_0x195a9b[_0xd123('0x67')]['id']}})[_0xd123('0x22')](handleEntityNotFound(_0x53f7a4,null))[_0xd123('0x22')](removeEntity(_0x53f7a4,null))['catch'](handleError(_0x53f7a4,null));};exports[_0xd123('0x68')]=function(_0x2fd380,_0x510559){return db['WhatsappAccount']['describe']()[_0xd123('0x22')](respondWithResult(_0x510559,null))[_0xd123('0x2c')](handleError(_0x510559,null));};exports['addDisposition']=function(_0x287242,_0x2c6e7b,_0x3173b6){if(_0x287242[_0xd123('0x60')]['id']){delete _0x287242[_0xd123('0x60')]['id'];}return db['WhatsappAccount'][_0xd123('0x5e')]({'where':{'id':_0x287242[_0xd123('0x67')]['id']}})[_0xd123('0x22')](handleEntityNotFound(_0x2c6e7b,null))['then'](function(_0x14ea3e){if(_0x14ea3e){_0x287242[_0xd123('0x60')][_0xd123('0x69')]=_0x14ea3e['id'];return db['Disposition'][_0xd123('0x5f')](_0x287242['body']);}})[_0xd123('0x22')](respondWithResult(_0x2c6e7b,null))[_0xd123('0x2c')](handleError(_0x2c6e7b,null));};exports['getDispositions']=function(_0xebb11f,_0x269820,_0x41055a){var _0x13b7da={'raw':![],'where':{}};var _0x1de951={};var _0x43c761={'count':0x0,'rows':[]};return db[_0xd123('0x43')]['findOne']({'where':{'id':_0xebb11f['params']['id']}})['then'](handleEntityNotFound(_0x269820,null))[_0xd123('0x22')](function(_0x1bfef3){if(_0x1bfef3){_0x1de951[_0xd123('0x47')]=_[_0xd123('0x49')](db[_0xd123('0x6a')][_0xd123('0x44')]);_0x1de951[_0xd123('0x48')]=_[_0xd123('0x49')](_0xebb11f[_0xd123('0x48')]);_0x1de951[_0xd123('0x4a')]=_[_0xd123('0x4b')](_0x1de951[_0xd123('0x47')],_0x1de951['query']);_0x13b7da[_0xd123('0x4d')]=_['intersection'](_0x1de951[_0xd123('0x47')],qs[_0xd123('0x4c')](_0xebb11f[_0xd123('0x48')][_0xd123('0x4c')]));_0x13b7da['attributes']=_0x13b7da['attributes']['length']?_0x13b7da['attributes']:_0x1de951[_0xd123('0x47')];if(!_0xebb11f[_0xd123('0x48')][_0xd123('0x4f')](_0xd123('0x50'))){_0x13b7da[_0xd123('0x32')]=qs[_0xd123('0x32')](_0xebb11f[_0xd123('0x48')]['limit']);_0x13b7da[_0xd123('0x33')]=qs[_0xd123('0x33')](_0xebb11f['query'][_0xd123('0x33')]);}_0x13b7da[_0xd123('0x51')]=qs[_0xd123('0x52')](_0xebb11f['query']['sort']);_0x13b7da['where']=qs['filters'](_['pick'](_0xebb11f['query'],_0x1de951[_0xd123('0x4a')]));_0x13b7da[_0xd123('0x53')][_0xd123('0x69')]=_0x1bfef3['id'];if(_0xebb11f[_0xd123('0x48')]['filter']){_0x13b7da[_0xd123('0x53')]=_[_0xd123('0x56')](_0x13b7da[_0xd123('0x53')],{'$or':_[_0xd123('0x42')](_0x13b7da[_0xd123('0x4d')],function(_0x4fb9aa){var _0x45d1e4={};_0x45d1e4[_0x4fb9aa]={'$like':'%'+_0xebb11f['query'][_0xd123('0x55')]+'%'};return _0x45d1e4;})});}_0x13b7da=_[_0xd123('0x56')]({},_0x13b7da,_0xebb11f[_0xd123('0x5d')]);return db[_0xd123('0x6a')]['count']({'where':_0x13b7da[_0xd123('0x53')]})[_0xd123('0x22')](function(_0x4ce453){_0x43c761[_0xd123('0x57')]=_0x4ce453;if(_0xebb11f[_0xd123('0x48')][_0xd123('0x58')]){_0x13b7da[_0xd123('0x59')]=[{'all':!![]}];}return db[_0xd123('0x6a')][_0xd123('0x5a')](_0x13b7da);})[_0xd123('0x22')](function(_0x4c7158){_0x43c761[_0xd123('0x5b')]=_0x4c7158;return _0x43c761;});}})[_0xd123('0x22')](respondWithFilteredResult(_0x269820,_0x13b7da))[_0xd123('0x2c')](handleError(_0x269820,null));};exports[_0xd123('0x6b')]=function(_0x162a03,_0x3cf510,_0x2ab18e){return db[_0xd123('0x43')][_0xd123('0x5e')]({'where':{'id':_0x162a03[_0xd123('0x67')]['id']}})[_0xd123('0x22')](handleEntityNotFound(_0x3cf510,null))['then'](function(_0x3ec766){if(_0x3ec766){return _0x3ec766['removeDispositions'](_0x162a03['query']['ids']);}})[_0xd123('0x22')](respondWithStatusCode(_0x3cf510,null))[_0xd123('0x2c')](handleError(_0x3cf510,null));};exports[_0xd123('0x6c')]=function(_0x514273,_0x186c4e,_0xfd9423){if(_0x514273[_0xd123('0x60')]['id']){delete _0x514273[_0xd123('0x60')]['id'];}return db[_0xd123('0x43')][_0xd123('0x5e')]({'where':{'id':_0x514273[_0xd123('0x67')]['id']}})['then'](handleEntityNotFound(_0x186c4e,null))[_0xd123('0x22')](function(_0x1e63e2){if(_0x1e63e2){_0x514273[_0xd123('0x60')][_0xd123('0x69')]=_0x1e63e2['id'];return db['CannedAnswer'][_0xd123('0x5f')](_0x514273[_0xd123('0x60')]);}})['then'](respondWithResult(_0x186c4e,null))[_0xd123('0x2c')](handleError(_0x186c4e,null));};exports['getAnswers']=function(_0x1e1935,_0x12daa7,_0x5a81c2){var _0x57af6a={'raw':![],'where':{}};var _0x4c9a65={};var _0x3da5b2={'count':0x0,'rows':[]};return db[_0xd123('0x43')][_0xd123('0x6d')]({'where':{'id':_0x1e1935[_0xd123('0x67')]['id']}})[_0xd123('0x22')](handleEntityNotFound(_0x12daa7,null))[_0xd123('0x22')](function(_0x4ccf9c){if(_0x4ccf9c){_0x4c9a65['model']=_['keys'](db[_0xd123('0x6e')]['rawAttributes']);_0x4c9a65['query']=_['keys'](_0x1e1935[_0xd123('0x48')]);_0x4c9a65[_0xd123('0x4a')]=_[_0xd123('0x4b')](_0x4c9a65[_0xd123('0x47')],_0x4c9a65[_0xd123('0x48')]);_0x57af6a['attributes']=_[_0xd123('0x4b')](_0x4c9a65['model'],qs[_0xd123('0x4c')](_0x1e1935['query']['fields']));_0x57af6a[_0xd123('0x4d')]=_0x57af6a['attributes'][_0xd123('0x4e')]?_0x57af6a[_0xd123('0x4d')]:_0x4c9a65[_0xd123('0x47')];if(!_0x1e1935[_0xd123('0x48')][_0xd123('0x4f')]('nolimit')){_0x57af6a['limit']=qs['limit'](_0x1e1935[_0xd123('0x48')][_0xd123('0x32')]);_0x57af6a[_0xd123('0x33')]=qs[_0xd123('0x33')](_0x1e1935[_0xd123('0x48')][_0xd123('0x33')]);}_0x57af6a[_0xd123('0x51')]=qs[_0xd123('0x52')](_0x1e1935[_0xd123('0x48')][_0xd123('0x52')]);_0x57af6a['where']=qs['filters'](_[_0xd123('0x54')](_0x1e1935[_0xd123('0x48')],_0x4c9a65['filters']));_0x57af6a[_0xd123('0x53')][_0xd123('0x69')]=_0x4ccf9c['id'];if(_0x1e1935[_0xd123('0x48')]['filter']){_0x57af6a[_0xd123('0x53')]=_[_0xd123('0x56')](_0x57af6a[_0xd123('0x53')],{'$or':_[_0xd123('0x42')](_0x57af6a[_0xd123('0x4d')],function(_0x37fc49){var _0x11b86a={};_0x11b86a[_0x37fc49]={'$like':'%'+_0x1e1935['query'][_0xd123('0x55')]+'%'};return _0x11b86a;})});}_0x57af6a=_[_0xd123('0x56')]({},_0x57af6a,_0x1e1935['options']);return db[_0xd123('0x6e')][_0xd123('0x57')]({'where':_0x57af6a[_0xd123('0x53')]})[_0xd123('0x22')](function(_0xe45048){_0x3da5b2[_0xd123('0x57')]=_0xe45048;if(_0x1e1935[_0xd123('0x48')][_0xd123('0x58')]){_0x57af6a[_0xd123('0x59')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x57af6a);})[_0xd123('0x22')](function(_0x54cac6){_0x3da5b2[_0xd123('0x5b')]=_0x54cac6;return _0x3da5b2;});}})[_0xd123('0x22')](respondWithFilteredResult(_0x12daa7,_0x57af6a))['catch'](handleError(_0x12daa7,null));};exports[_0xd123('0x6f')]=function(_0x713f9e,_0x343757,_0x47372a){return db[_0xd123('0x43')][_0xd123('0x5e')]({'where':{'id':_0x713f9e[_0xd123('0x67')]['id']}})['then'](handleEntityNotFound(_0x343757,null))[_0xd123('0x22')](function(_0x592095){if(_0x592095){return _0x592095[_0xd123('0x6f')](_0x713f9e[_0xd123('0x48')][_0xd123('0x70')]);}})[_0xd123('0x22')](respondWithStatusCode(_0x343757,null))['catch'](handleError(_0x343757,null));};exports[_0xd123('0x71')]=function(_0x332611,_0x1babff,_0x27ce97){return db[_0xd123('0x43')][_0xd123('0x5e')]({'where':{'id':_0x332611[_0xd123('0x67')]['id']}})[_0xd123('0x22')](handleEntityNotFound(_0x1babff,null))[_0xd123('0x22')](function(_0x1a4250){if(_0x1a4250){return _0x1a4250['addAgents'](_0x332611[_0xd123('0x60')]['ids'],_[_0xd123('0x72')](_0x332611[_0xd123('0x60')],[_0xd123('0x70'),'id'])||{})['spread'](function(_0x36fdfe){for(var _0x1ea6d8=0x0;_0x1ea6d8<_0x332611['body'][_0xd123('0x70')][_0xd123('0x4e')];_0x1ea6d8+=0x1){socket[_0xd123('0x73')](_0xd123('0x74'),{'UserId':Number(_0x332611['body'][_0xd123('0x70')][_0x1ea6d8]),'WhatsappAccountId':Number(_0x332611['params']['id'])});}return _0x36fdfe;});}})[_0xd123('0x22')](respondWithResult(_0x1babff,null))[_0xd123('0x2c')](handleError(_0x1babff,null));};exports['removeAgents']=function(_0x299745,_0x266ae3,_0x267e69){return db[_0xd123('0x43')][_0xd123('0x5e')]({'where':{'id':_0x299745[_0xd123('0x67')]['id']}})[_0xd123('0x22')](handleEntityNotFound(_0x266ae3,null))[_0xd123('0x22')](function(_0x82a743){if(_0x82a743){return _0x82a743[_0xd123('0x75')](_0x299745[_0xd123('0x48')][_0xd123('0x70')])[_0xd123('0x22')](function(){if(_['isArray'](_0x299745[_0xd123('0x48')][_0xd123('0x70')])){for(var _0x19ad3a=0x0;_0x19ad3a<_0x299745[_0xd123('0x48')][_0xd123('0x70')][_0xd123('0x4e')];_0x19ad3a+=0x1){socket[_0xd123('0x73')](_0xd123('0x76'),{'UserId':Number(_0x299745['query']['ids'][_0x19ad3a]),'WhatsappAccountId':Number(_0x299745['params']['id'])});}}else{socket[_0xd123('0x73')](_0xd123('0x76'),{'UserId':Number(_0x299745[_0xd123('0x48')][_0xd123('0x70')]),'WhatsappAccountId':Number(_0x299745[_0xd123('0x67')]['id'])});}});}})['then'](respondWithStatusCode(_0x266ae3,null))[_0xd123('0x2c')](handleError(_0x266ae3,null));};exports[_0xd123('0x77')]=function(_0x3cb9db,_0x54051c,_0x4be6af){var _0x1b500b={};var _0x20710e={};var _0x3c39d2;var _0x151fb9;return db[_0xd123('0x43')][_0xd123('0x6d')]({'where':{'id':_0x3cb9db[_0xd123('0x67')]['id']}})['then'](handleEntityNotFound(_0x54051c,null))['then'](function(_0x464468){if(_0x464468){_0x3c39d2=_0x464468;_0x20710e[_0xd123('0x47')]=_[_0xd123('0x49')](db[_0xd123('0x78')][_0xd123('0x44')]);_0x20710e[_0xd123('0x48')]=_[_0xd123('0x49')](_0x3cb9db['query']);_0x20710e[_0xd123('0x4a')]=_[_0xd123('0x4b')](_0x20710e[_0xd123('0x47')],_0x20710e[_0xd123('0x48')]);_0x1b500b[_0xd123('0x4d')]=_[_0xd123('0x4b')](_0x20710e[_0xd123('0x47')],qs[_0xd123('0x4c')](_0x3cb9db[_0xd123('0x48')][_0xd123('0x4c')]));_0x1b500b['attributes']=_0x1b500b[_0xd123('0x4d')][_0xd123('0x4e')]?_0x1b500b[_0xd123('0x4d')]:_0x20710e['model'];_0x1b500b[_0xd123('0x51')]=qs['sort'](_0x3cb9db[_0xd123('0x48')][_0xd123('0x52')]);_0x1b500b[_0xd123('0x53')]=qs[_0xd123('0x4a')](_[_0xd123('0x54')](_0x3cb9db[_0xd123('0x48')],_0x20710e[_0xd123('0x4a')]));if(_0x3cb9db[_0xd123('0x48')][_0xd123('0x55')]){_0x1b500b[_0xd123('0x53')]=_['merge'](_0x1b500b['where'],{'$or':_[_0xd123('0x42')](_0x1b500b[_0xd123('0x4d')],function(_0x539299){var _0x200c41={};_0x200c41[_0x539299]={'$like':'%'+_0x3cb9db[_0xd123('0x48')][_0xd123('0x55')]+'%'};return _0x200c41;})});}_0x1b500b=_['merge']({},_0x1b500b,_0x3cb9db[_0xd123('0x5d')]);return _0x3c39d2['getAgents'](_0x1b500b);}})[_0xd123('0x22')](function(_0xdddf29){if(_0xdddf29){_0x151fb9=_0xdddf29[_0xd123('0x4e')];if(!_0x3cb9db[_0xd123('0x48')][_0xd123('0x4f')](_0xd123('0x50'))){_0x1b500b[_0xd123('0x32')]=qs['limit'](_0x3cb9db['query'][_0xd123('0x32')]);_0x1b500b['offset']=qs['offset'](_0x3cb9db[_0xd123('0x48')][_0xd123('0x33')]);}return _0x3c39d2[_0xd123('0x77')](_0x1b500b);}})[_0xd123('0x22')](function(_0xb14d01){if(_0xb14d01){return _0xb14d01?{'count':_0x151fb9,'rows':_0xb14d01}:null;}})['then'](respondWithResult(_0x54051c,null))[_0xd123('0x2c')](handleError(_0x54051c,null));};exports[_0xd123('0x79')]=function(_0x5ae077,_0x439444){var _0x47c7b8=_0x5ae077[_0xd123('0x67')]['id'];var _0x2171da=_0x5ae077[_0xd123('0x60')];var _0xfb3fe9=0xc8;var _0x1de387=null;return db[_0xd123('0x7a')][_0xd123('0x7b')]({'isolationLevel':db[_0xd123('0x7a')]['Transaction']['ISOLATION_LEVELS'][_0xd123('0x7c')]},function(_0x48fbba){return db['WhatsappAccount'][_0xd123('0x6d')]({'where':{'id':_0x47c7b8},'transaction':_0x48fbba})[_0xd123('0x22')](function(_0x5e9a4c){if(_0x5e9a4c){return db[_0xd123('0x7d')][_0xd123('0x39')]({'where':{'WhatsappAccountId':_0x47c7b8},'transaction':_0x48fbba})[_0xd123('0x22')](function(){var _0x2a1bdd=_[_0xd123('0x42')](_0x2171da,function(_0x67db03){_0x67db03['WhatsappAccountId']=_0x47c7b8;return _0x67db03;});return db['WhatsappApplication']['bulkCreate'](_0x2a1bdd,{'transaction':_0x48fbba});});}else{_0xfb3fe9=0x194;_0x1de387=[];}});})['then'](function(){if(_0xfb3fe9!==0x194){return db[_0xd123('0x7d')][_0xd123('0x7e')]({'where':{'WhatsappAccountId':_0x47c7b8},'order':_0xd123('0x7f')})['then'](function(_0x900b95){_0x1de387=_0x900b95;});}})['catch'](function(_0x11efa7){_0xfb3fe9=0x1f4;logger[_0xd123('0x29')](_0x11efa7[_0xd123('0x3c')]);if(_0x11efa7[_0xd123('0x3d')]){delete _0x11efa7[_0xd123('0x3d')];}_0x1de387=_0x11efa7;})[_0xd123('0x80')](function(){if(_0x1de387===null){_0x439444[_0xd123('0x2d')](_0xfb3fe9);}else{if(_0xfb3fe9===0x1f4){_0x439444['status'](_0xfb3fe9)['send'](_0x1de387);}else{_0x439444[_0xd123('0x2f')](_0xfb3fe9)['json'](_0x1de387);}}});};exports[_0xd123('0x81')]=function(_0x1b20fb,_0x2560ac,_0x177b81){var _0x58a62a={};var _0x1f5279={};var _0x2b6279;var _0x172118;return db['WhatsappAccount'][_0xd123('0x6d')]({'where':{'id':_0x1b20fb['params']['id']}})[_0xd123('0x22')](handleEntityNotFound(_0x2560ac,null))[_0xd123('0x22')](function(_0x3dfd7a){if(_0x3dfd7a){_0x2b6279=_0x3dfd7a;_0x1f5279[_0xd123('0x47')]=_[_0xd123('0x49')](db[_0xd123('0x7d')]['rawAttributes']);_0x1f5279[_0xd123('0x48')]=_[_0xd123('0x49')](_0x1b20fb[_0xd123('0x48')]);_0x1f5279['filters']=_[_0xd123('0x4b')](_0x1f5279[_0xd123('0x47')],_0x1f5279[_0xd123('0x48')]);_0x58a62a[_0xd123('0x4d')]=_[_0xd123('0x4b')](_0x1f5279['model'],qs[_0xd123('0x4c')](_0x1b20fb[_0xd123('0x48')][_0xd123('0x4c')]));_0x58a62a['attributes']=_0x58a62a[_0xd123('0x4d')][_0xd123('0x4e')]?_0x58a62a[_0xd123('0x4d')]:_0x1f5279['model'];_0x58a62a[_0xd123('0x51')]=qs[_0xd123('0x52')](_0x1b20fb[_0xd123('0x48')][_0xd123('0x52')]);_0x58a62a['where']=qs[_0xd123('0x4a')](_[_0xd123('0x54')](_0x1b20fb[_0xd123('0x48')],_0x1f5279['filters']));if(_0x1b20fb[_0xd123('0x48')]['filter']){_0x58a62a['where']=_['merge'](_0x58a62a[_0xd123('0x53')],{'$or':_['map'](_0x58a62a['attributes'],function(_0x5dbb50){var _0x19e38e={};_0x19e38e[_0x5dbb50]={'$like':'%'+_0x1b20fb['query'][_0xd123('0x55')]+'%'};return _0x19e38e;})});}_0x58a62a=_[_0xd123('0x56')]({},_0x58a62a,_0x1b20fb[_0xd123('0x5d')]);return _0x2b6279[_0xd123('0x81')](_0x58a62a);}})[_0xd123('0x22')](function(_0x49247a){if(_0x49247a){_0x172118=_0x49247a['length'];if(!_0x1b20fb[_0xd123('0x48')][_0xd123('0x4f')]('nolimit')){_0x58a62a[_0xd123('0x32')]=qs[_0xd123('0x32')](_0x1b20fb['query'][_0xd123('0x32')]);_0x58a62a[_0xd123('0x33')]=qs[_0xd123('0x33')](_0x1b20fb['query'][_0xd123('0x33')]);}return _0x2b6279[_0xd123('0x81')](_0x58a62a);}})['then'](function(_0x2cb615){if(_0x2cb615){return _0x2cb615?{'count':_0x172118,'rows':_0x2cb615}:null;}})[_0xd123('0x22')](respondWithResult(_0x2560ac,null))[_0xd123('0x2c')](handleError(_0x2560ac,null));};exports[_0xd123('0x82')]=function(_0xdb9665,_0x12eaaf,_0x2196f1){var _0x25b0c3={'channel':'whatsapp'};var _0x1a4d35=[];var _0x47b8f5=[];var _0x479b25={};return db['WhatsappAccount'][_0xd123('0x5e')]({'where':{'id':_0xdb9665['params']['id']},'include':[{'model':db[_0xd123('0x7d')],'as':_0xd123('0x83')}]})[_0xd123('0x22')](handleEntityNotFound(_0x12eaaf,null))[_0xd123('0x22')](function(_0x3cb060){_0x25b0c3['account']=_0x3cb060;if(_0x25b0c3['account']&&_0x25b0c3[_0xd123('0x84')][_0xd123('0x46')]==='sinch'&&_0xdb9665['body'][_0xd123('0x85')]){if(_0xdb9665[_0xd123('0x60')][_0xd123('0x85')][_0xd123('0x4e')]===0x0)return;if(_0xdb9665[_0xd123('0x60')][_0xd123('0x85')][0x0]['state']!=='read')return;return db[_0xd123('0x86')][_0xd123('0x38')]({'read':!![],'readAt':_0xdb9665[_0xd123('0x60')][_0xd123('0x85')][0x0][_0xd123('0x87')]},{'where':{'messageId':_0xdb9665[_0xd123('0x60')][_0xd123('0x85')][0x0][_0xd123('0x88')]},'individualHooks':!![]})['then'](function(_0x258359){return _0x12eaaf[_0xd123('0x2f')](0xc8)[_0xd123('0x30')](_0x258359);});}_0x25b0c3['applications']=_[_0xd123('0x89')](_0x3cb060[_0xd123('0x83')],[_0xd123('0x7f')],[_0xd123('0x8a')]);if(_0x25b0c3[_0xd123('0x84')]['Applications']){delete _0x25b0c3[_0xd123('0x84')][_0xd123('0x83')];}return db[_0xd123('0x8b')][_0xd123('0x68')]()[_0xd123('0x22')](function(_0x18a626){if(!_0x18a626){throw new db[(_0xd123('0x8c'))][(_0xd123('0x8d'))](_0xd123('0x8e'));}_0x1a4d35=_[_0xd123('0x8f')](_[_0xd123('0x49')](_0x18a626),[_0xd123('0x90'),_0xd123('0x91')]);_0x47b8f5=_[_0xd123('0x8f')](_['keys'](_0x18a626),['createdAt','updatedAt',_0xd123('0x92'),_0xd123('0x93')]);_0x25b0c3[_0xd123('0x60')]={'mapKey':_0xd123('0x94')};if(_0x25b0c3[_0xd123('0x84')]&&_0x25b0c3['account']['type']===_0xd123('0x95')){_0x25b0c3['body'][_0xd123('0x96')]=_0xdb9665[_0xd123('0x60')][_0xd123('0x97')][_0xd123('0x98')](_0xd123('0x99'),'');_0x25b0c3['body']['body']=_0xdb9665['body'][_0xd123('0x9a')];_0x25b0c3[_0xd123('0x60')][_0xd123('0x9b')]=_0xdb9665['body']['MessageSid'];}if(_0x25b0c3[_0xd123('0x84')]&&_0x25b0c3[_0xd123('0x84')][_0xd123('0x46')]==='sinch'){_0x25b0c3['body'][_0xd123('0x96')]=_0xdb9665[_0xd123('0x60')]['notifications'][0x0][_0xd123('0x96')];_0x25b0c3[_0xd123('0x60')][_0xd123('0x60')]=_0xdb9665[_0xd123('0x60')][_0xd123('0x9c')][0x0]['message'][_0xd123('0x60')];_0x25b0c3['body'][_0xd123('0x9b')]=_0xdb9665[_0xd123('0x60')][_0xd123('0x9c')][0x0][_0xd123('0x88')];}if(_0x25b0c3[_0xd123('0x60')]['id']){delete _0x25b0c3[_0xd123('0x60')]['id'];}if(_[_0xd123('0x9d')](_0x25b0c3[_0xd123('0x60')]['from'])){throw new db[(_0xd123('0x8c'))][(_0xd123('0x8d'))]('from\x20is\x20mandatory');}if(_[_0xd123('0x9d')](_0x25b0c3[_0xd123('0x60')]['body'])||_0x25b0c3[_0xd123('0x60')][_0xd123('0x60')]===''){throw new db[(_0xd123('0x8c'))]['ValidationError'](_0xd123('0x9e'));}if(_[_0xd123('0x9d')](_0x25b0c3[_0xd123('0x60')][_0xd123('0x9f')])){throw new db[(_0xd123('0x8c'))][(_0xd123('0x8d'))](_0xd123('0xa0')+_0x47b8f5);}if(!_[_0xd123('0xa1')](_0x47b8f5,_0x25b0c3[_0xd123('0x60')][_0xd123('0x9f')])){throw new db[(_0xd123('0x8c'))][(_0xd123('0x8d'))](_0xd123('0xa2')+_0x47b8f5);}_0x479b25[_0x25b0c3['body'][_0xd123('0x9f')]]=_0x25b0c3[_0xd123('0x60')][_0xd123('0x96')];return db[_0xd123('0xa3')][_0xd123('0x5e')]({'where':{'id':_0x25b0c3[_0xd123('0x84')][_0xd123('0x93')]},'include':[{'model':db[_0xd123('0x8b')],'as':_0xd123('0xa4'),'where':_0x479b25,'limit':0x1,'order':[[_0xd123('0x91'),_0xd123('0xa5')]]}]});})['then'](handleEntityNotFound(_0x12eaaf,null))[_0xd123('0x22')](function(_0x39d011){if(_0x39d011){_0x25b0c3['list']=_[_0xd123('0x72')](_0x39d011,[_0xd123('0xa4')]);if(_0x39d011[_0xd123('0xa4')][_0xd123('0x4e')]){return _0x39d011[_0xd123('0xa4')][0x0];}var _0x21a681=_['defaults'](_0x25b0c3[_0xd123('0x60')],{'firstName':_0x25b0c3['body'][_0xd123('0x96')],'ListId':_0x39d011['id']});_0x21a681[_0x25b0c3[_0xd123('0x60')][_0xd123('0x9f')]]=_0x25b0c3[_0xd123('0x60')]['from'];return db['CmContact'][_0xd123('0x5f')](_0x21a681,{'fields':_0x1a4d35,'raw':!![]});}})[_0xd123('0x22')](handleEntityNotFound(_0x12eaaf,null))[_0xd123('0x22')](function(_0x11b3f2){if(_0x11b3f2){_0x25b0c3[_0xd123('0xa6')]=_0x11b3f2;var _0x21690d={'ContactId':_0x11b3f2['id'],'phone':_0x25b0c3[_0xd123('0x60')][_0xd123('0x96')],'WhatsappAccountId':_0xdb9665[_0xd123('0x67')]['id']};var _0x367185={'ContactId':_0x11b3f2['id'],'WhatsappAccountId':_0xdb9665['params']['id'],'closed':![]};return db[_0xd123('0xa7')][_0xd123('0x5e')]({'where':_0x367185})[_0xd123('0x22')](function(_0x300aaf){if(_0x300aaf){return[_0x300aaf,![]];}return db['WhatsappInteraction'][_0xd123('0x5f')](_0x21690d)['then'](function(_0x5e1403){return[_0x5e1403,!![]];});});}})[_0xd123('0xa8')](function(_0x423502,_0x4f0f49){_0x25b0c3[_0xd123('0xa9')]=_0x423502['get']({'plain':!![]});_0x25b0c3['interaction'][_0xd123('0xaa')]=![];if(_0x4f0f49){if(_0x25b0c3[_0xd123('0x84')][_0xd123('0xab')]){_0x25b0c3[_0xd123('0xac')][_0xd123('0xad')]({'id':0x0,'priority':_0x25b0c3['applications'][_0xd123('0x4e')]+0x1,'app':'close','appdata':_0xd123('0xae'),'interval':_0xd123('0xaf')});}_0x25b0c3[_0xd123('0xa9')][_0xd123('0xaa')]=!![];}return db['WhatsappMessage'][_0xd123('0x5f')]({'phone':_0x25b0c3[_0xd123('0x60')][_0xd123('0x96')],'messageId':_0x25b0c3[_0xd123('0x60')]['messageId'],'body':_0x25b0c3[_0xd123('0x60')][_0xd123('0x60')],'WhatsappAccountId':_0xdb9665[_0xd123('0x67')]['id'],'WhatsappInteractionId':_0x423502['id'],'direction':'in','ContactId':_0x423502['ContactId'],'AttachmentId':_0x25b0c3[_0xd123('0x60')][_0xd123('0xb0')]});})[_0xd123('0x22')](function(_0x256c00){_0x25b0c3['message']=_0x256c00;if(!_0x25b0c3[_0xd123('0xa9')][_0xd123('0xb1')])return;return db[_0xd123('0x78')][_0xd123('0x5e')]({'attributes':['id',_0xd123('0x3d')],'where':{'id':_0x25b0c3['interaction'][_0xd123('0xb1')]}});})[_0xd123('0x22')](function(_0x420e16){if(_0x420e16){_0x25b0c3['applications'][_0xd123('0xb2')]({'id':0x0,'priority':0x0,'app':_0xd123('0xb3'),'appdata':_0x420e16[_0xd123('0x3d')]+','+(_0x25b0c3[_0xd123('0x84')][_0xd123('0xb4')]||0xa),'interval':_0xd123('0xaf')});}if(!_0x25b0c3[_0xd123('0xa9')][_0xd123('0xb5')])return;return db[_0xd123('0xb6')][_0xd123('0x5e')]({'attributes':['id',_0xd123('0x3d')],'where':{'id':_0x25b0c3['interaction']['queueId']}});})['then'](function(_0x45c341){if(_0x45c341){_0x25b0c3[_0xd123('0xac')]['unshift']({'id':0x0,'priority':0x1,'app':_0xd123('0xb7'),'appdata':_0x45c341[_0xd123('0x3d')]+','+(_0x25b0c3[_0xd123('0x84')]['waitForTheAssignedQueue']||0x12c),'interval':_0xd123('0xaf')});}return respondWithRpcPromise('Start',_0xd123('0xb8'),_0x25b0c3);})[_0xd123('0x22')](function(_0x4931f1){if(_0x4931f1){var _0x156e57=0xc8;var _0x52e3e3=_0xd123('0xb9');logger[_0xd123('0x23')](_0xd123('0x27'),_0x52e3e3,_0x156e57,_0xd123('0xba'));logger[_0xd123('0x26')](_0xd123('0xbb'),_0x52e3e3,_0x156e57,_0xd123('0xba'),JSON[_0xd123('0x28')](_0x4931f1));if(_0x25b0c3[_0xd123('0x84')]['type']==='twilio'){return _0x12eaaf[_0xd123('0x2f')](_0x156e57)[_0xd123('0xbc')](_0xd123('0xbd'),_0xd123('0xbe'))['send']('\x0a');}else{return _0x12eaaf[_0xd123('0x2f')](_0x156e57)[_0xd123('0x30')](_0x4931f1);}}});})[_0xd123('0x2c')](handleError(_0x12eaaf,null));};exports[_0xd123('0x3e')]=function(_0x2e9ef1,_0x14eeb4,_0x1aacd4){var _0x3ed164,_0x3f8ac1,_0x1fc923;if(_[_0xd123('0x9d')](_0x2e9ef1[_0xd123('0x60')][_0xd123('0x60')])||_0x2e9ef1['body'][_0xd123('0x60')]===''){throw new db[(_0xd123('0x8c'))][(_0xd123('0x8d'))](_0xd123('0x9e'));}if(_['isNil'](_0x2e9ef1[_0xd123('0x60')]['to'])){throw new db[(_0xd123('0x8c'))][(_0xd123('0x8d'))](_0xd123('0xbf'));}_0x3ed164=_0x2e9ef1['body']['to'];return db[_0xd123('0x43')]['find']({'where':{'id':_0x2e9ef1[_0xd123('0x67')]['id']},'include':[{'model':db[_0xd123('0xa3')],'as':_0xd123('0xc0'),'include':[{'model':db[_0xd123('0x8b')],'as':_0xd123('0xa4'),'where':{'mobile':_0x3ed164},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x14eeb4,null))['then'](function(_0x5d826b){if(_0x5d826b&&_0x5d826b[_0xd123('0xc0')]){_0x3f8ac1=_0x5d826b['get']({'plain':!![]});if(_0x3f8ac1[_0xd123('0xc0')]&&_0x3f8ac1[_0xd123('0xc0')]['Contacts']['length']){return _0x3f8ac1[_0xd123('0xc0')]['Contacts'][0x0];}return db[_0xd123('0x8b')][_0xd123('0x5f')](_[_0xd123('0xc1')](_0x2e9ef1[_0xd123('0x60')],{'firstName':_0x3ed164,'mobile':_0x3ed164,'phone':_0x3ed164,'ListId':_0x3f8ac1[_0xd123('0x93')]}));}})[_0xd123('0x22')](handleEntityNotFound(_0x14eeb4,null))[_0xd123('0x22')](function(_0x5df59b){if(_0x5df59b){_0x1fc923=_0x5df59b;return db[_0xd123('0xa7')][_0xd123('0x5e')]({'where':{'ContactId':_0x1fc923['id'],'closed':![],'WhatsappAccountId':_0x3f8ac1['id']}})[_0xd123('0x22')](function(_0x555af5){if(_0x555af5){return[_0x555af5,![]];}return db[_0xd123('0xa7')][_0xd123('0x5f')]({'UserId':_0x2e9ef1[_0xd123('0x61')]['id'],'ContactId':_0x1fc923['id'],'WhatsappAccountId':_0x3f8ac1['id'],'phone':_0x3ed164,'firstMsgDirection':_0xd123('0xc2'),'Messages':[_['merge'](_0x2e9ef1['body'],{'read':![],'body':_0x2e9ef1[_0xd123('0x60')][_0xd123('0x60')],'phone':_0x3ed164,'WhatsappAccountId':_0x3f8ac1['id'],'UserId':_0x2e9ef1[_0xd123('0x61')]['id'],'ContactId':_0x1fc923['id']})]},{'include':[{'model':db[_0xd123('0x86')],'as':'Messages'}]})['then'](function(_0x1b8d91){return[_0x1b8d91,!![]];});});}})['spread'](function(_0x251518,_0x9aeed1){if(_0x9aeed1){return _0x251518;}return db[_0xd123('0x86')][_0xd123('0x5f')](_[_0xd123('0x56')](_0x2e9ef1['body'],{'read':![],'body':_0x2e9ef1['body'][_0xd123('0x60')],'phone':_0x3ed164,'WhatsappAccountId':_0x3f8ac1['id'],'WhatsappInteractionId':_0x251518['id'],'UserId':_0x2e9ef1[_0xd123('0x61')]['id'],'ContactId':_0x1fc923['id']}))[_0xd123('0x22')](function(_0xefa006){_0x251518[_0xd123('0xc3')][_0xd123('0xc4')]=[];_0x251518[_0xd123('0xc3')][_0xd123('0xc4')][_0xd123('0xad')](_0xefa006[_0xd123('0xc3')]);return _0x251518;});})[_0xd123('0x22')](respondWithResult(_0x14eeb4,null))[_0xd123('0x2c')](handleError(_0x14eeb4,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 24a773e..278eb7e 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 _0xb8b3=['update','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','save'];(function(_0x20919d,_0x20d487){var _0x1cd4d6=function(_0x3ef643){while(--_0x3ef643){_0x20919d['push'](_0x20919d['shift']());}};_0x1cd4d6(++_0x20d487);}(_0xb8b3,0x12c));var _0x3b8b=function(_0x375325,_0x57a850){_0x375325=_0x375325-0x0;var _0x228f57=_0xb8b3[_0x375325];return _0x228f57;};'use strict';var EventEmitter=require(_0x3b8b('0x0'));var WhatsappAccount=require(_0x3b8b('0x1'))['db'][_0x3b8b('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3b8b('0x3'),'afterUpdate':_0x3b8b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x30bc8d){return function(_0x3a41e4,_0x4e8b89,_0x1da443){WhatsappAccountEvents['emit'](_0x30bc8d+':'+_0x3a41e4['id'],_0x3a41e4);WhatsappAccountEvents['emit'](_0x30bc8d,_0x3a41e4);_0x1da443(null);};}for(var e in events){if(events[_0x3b8b('0x5')](e)){var event=events[e];WhatsappAccount[_0x3b8b('0x6')](e,emitEvent(event));}}module[_0x3b8b('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0xc827=['../../mysqldb','emit','hasOwnProperty','exports','events'];(function(_0x2d3c39,_0x4877d7){var _0x106178=function(_0x5a5a04){while(--_0x5a5a04){_0x2d3c39['push'](_0x2d3c39['shift']());}};_0x106178(++_0x4877d7);}(_0xc827,0x13a));var _0x7c82=function(_0x4857f9,_0x485b49){_0x4857f9=_0x4857f9-0x0;var _0x5d7214=_0xc827[_0x4857f9];return _0x5d7214;};'use strict';var EventEmitter=require(_0x7c82('0x0'));var WhatsappAccount=require(_0x7c82('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x278d11){return function(_0xb06212,_0x21bc79,_0x474beb){WhatsappAccountEvents[_0x7c82('0x2')](_0x278d11+':'+_0xb06212['id'],_0xb06212);WhatsappAccountEvents['emit'](_0x278d11,_0xb06212);_0x474beb(null);};}for(var e in events){if(events[_0x7c82('0x3')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x7c82('0x4')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 9dfc16d..02a44c8 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 _0x3a69=['exports','define','whatsapp_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a69,0x16f));var _0x93a6=function(_0x253d2b,_0x49a0fb){_0x253d2b=_0x253d2b-0x0;var _0x3ce8bd=_0x3a69[_0x253d2b];return _0x3ce8bd;};'use strict';var _=require('lodash');var util=require(_0x93a6('0x0'));var logger=require(_0x93a6('0x1'))(_0x93a6('0x2'));var moment=require(_0x93a6('0x3'));var BPromise=require(_0x93a6('0x4'));var rp=require(_0x93a6('0x5'));var fs=require('fs');var path=require(_0x93a6('0x6'));var rimraf=require(_0x93a6('0x7'));var config=require(_0x93a6('0x8'));var attributes=require(_0x93a6('0x9'));module[_0x93a6('0xa')]=function(_0x348a2b,_0x229386){return _0x348a2b[_0x93a6('0xb')]('WhatsappAccount',attributes,{'tableName':_0x93a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8af1=['../../config/environment','./whatsappAccount.attributes','exports','define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x438f76,_0x5490e0){var _0x31f3ca=function(_0x548c64){while(--_0x548c64){_0x438f76['push'](_0x438f76['shift']());}};_0x31f3ca(++_0x5490e0);}(_0x8af1,0x1f0));var _0x18af=function(_0x5093e9,_0x5154d0){_0x5093e9=_0x5093e9-0x0;var _0x4c9a22=_0x8af1[_0x5093e9];return _0x4c9a22;};'use strict';var _=require('lodash');var util=require(_0x18af('0x0'));var logger=require(_0x18af('0x1'))(_0x18af('0x2'));var moment=require(_0x18af('0x3'));var BPromise=require(_0x18af('0x4'));var rp=require(_0x18af('0x5'));var fs=require('fs');var path=require(_0x18af('0x6'));var rimraf=require(_0x18af('0x7'));var config=require(_0x18af('0x8'));var attributes=require(_0x18af('0x9'));module[_0x18af('0xa')]=function(_0x307b7d,_0x5c7ecc){return _0x307b7d[_0x18af('0xb')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 97e9b0d..9e82b48 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 _0x9666=['raw','where','attributes','include','map','model','ShowWhatsappAccount','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','WhatsappAccount','find','options'];(function(_0x4cf52a,_0x3bdcaf){var _0x29204b=function(_0x1a8e30){while(--_0x1a8e30){_0x4cf52a['push'](_0x4cf52a['shift']());}};_0x29204b(++_0x3bdcaf);}(_0x9666,0x17a));var _0x6966=function(_0x1b0cec,_0xffef8e){_0x1b0cec=_0x1b0cec-0x0;var _0x349a85=_0x9666[_0x1b0cec];return _0x349a85;};'use strict';var _=require(_0x6966('0x0'));var util=require(_0x6966('0x1'));var moment=require(_0x6966('0x2'));var BPromise=require(_0x6966('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6966('0x4'));var db=require(_0x6966('0x5'))['db'];var utils=require(_0x6966('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6966('0x7'));var jayson=require(_0x6966('0x8'));var client=jayson[_0x6966('0x9')][_0x6966('0xa')]({'port':0x232a});config[_0x6966('0xb')]=_[_0x6966('0xc')](config['redis'],{'host':_0x6966('0xd'),'port':0x18eb});var socket=require(_0x6966('0xe'))(new Redis(config[_0x6966('0xb')]));require('./whatsappAccount.socket')[_0x6966('0xf')](socket);function respondWithRpcPromise(_0x377666,_0x150ca1,_0x47578b){return new BPromise(function(_0x2961fd,_0x3bb5b1){return client[_0x6966('0x10')](_0x377666,_0x47578b)[_0x6966('0x11')](function(_0x276f89){logger[_0x6966('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x150ca1,'request\x20sent');logger['debug'](_0x6966('0x13'),_0x150ca1,_0x6966('0x14'),JSON[_0x6966('0x15')](_0x276f89));if(_0x276f89['error']){if(_0x276f89['error']['code']===0x1f4){logger[_0x6966('0x16')](_0x6966('0x17'),_0x150ca1,_0x276f89[_0x6966('0x16')][_0x6966('0x18')]);return _0x3bb5b1(_0x276f89[_0x6966('0x16')]['message']);}logger[_0x6966('0x16')](_0x6966('0x17'),_0x150ca1,_0x276f89['error'][_0x6966('0x18')]);return _0x2961fd(_0x276f89[_0x6966('0x16')][_0x6966('0x18')]);}else{logger['info'](_0x6966('0x17'),_0x150ca1,'request\x20sent');_0x2961fd(_0x276f89[_0x6966('0x19')]['message']);}})['catch'](function(_0x5de186){logger[_0x6966('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x150ca1,_0x5de186);_0x3bb5b1(_0x5de186);});});}exports['ShowWhatsappAccount']=function(_0x5e3128){var _0x4aae5d=this;return new Promise(function(_0x5e66b3,_0x197c2c){return db[_0x6966('0x1a')][_0x6966('0x1b')]({'raw':_0x5e3128['options']?_0x5e3128[_0x6966('0x1c')][_0x6966('0x1d')]===undefined?!![]:![]:!![],'where':_0x5e3128[_0x6966('0x1c')]?_0x5e3128[_0x6966('0x1c')][_0x6966('0x1e')]||null:null,'attributes':_0x5e3128[_0x6966('0x1c')]?_0x5e3128[_0x6966('0x1c')][_0x6966('0x1f')]||null:null,'include':_0x5e3128[_0x6966('0x1c')]?_0x5e3128['options'][_0x6966('0x20')]?_[_0x6966('0x21')](_0x5e3128[_0x6966('0x1c')][_0x6966('0x20')],function(_0x5da7dd){return{'model':db[_0x5da7dd[_0x6966('0x22')]],'as':_0x5da7dd['as'],'attributes':_0x5da7dd[_0x6966('0x1f')],'include':_0x5da7dd['include']?_[_0x6966('0x21')](_0x5da7dd['include'],function(_0x433601){return{'model':db[_0x433601['model']],'as':_0x433601['as'],'attributes':_0x433601[_0x6966('0x1f')],'include':_0x433601[_0x6966('0x20')]?_[_0x6966('0x21')](_0x433601[_0x6966('0x20')],function(_0x3c2b41){return{'model':db[_0x3c2b41[_0x6966('0x22')]],'as':_0x3c2b41['as'],'attributes':_0x3c2b41[_0x6966('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6966('0x11')](function(_0x2c9fbb){logger['info'](_0x6966('0x23'),_0x5e3128);logger[_0x6966('0x24')]('ShowWhatsappAccount',_0x5e3128,JSON[_0x6966('0x15')](_0x2c9fbb));_0x5e66b3(_0x2c9fbb);})['catch'](function(_0x44b6b0){logger[_0x6966('0x16')](_0x6966('0x23'),_0x44b6b0[_0x6966('0x18')],_0x5e3128);_0x197c2c(_0x4aae5d[_0x6966('0x16')](0x1f4,_0x44b6b0[_0x6966('0x18')]));});});}; \ No newline at end of file +var _0xb19a=['message','result','find','options','where','attributes','include','map','model','ShowWhatsappAccount','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./whatsappAccount.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s'];(function(_0x692ab2,_0x4c0a00){var _0x19be2c=function(_0xc65546){while(--_0xc65546){_0x692ab2['push'](_0x692ab2['shift']());}};_0x19be2c(++_0x4c0a00);}(_0xb19a,0xd0));var _0xab19=function(_0x320992,_0x20e856){_0x320992=_0x320992-0x0;var _0x1aa30d=_0xb19a[_0x320992];return _0x1aa30d;};'use strict';var _=require(_0xab19('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xab19('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab19('0x2'))['db'];var utils=require(_0xab19('0x3'));var logger=require(_0xab19('0x4'))(_0xab19('0x5'));var config=require(_0xab19('0x6'));var jayson=require(_0xab19('0x7'));var client=jayson[_0xab19('0x8')]['http']({'port':0x232a});config[_0xab19('0x9')]=_[_0xab19('0xa')](config['redis'],{'host':_0xab19('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab19('0x9')]));require(_0xab19('0xc'))[_0xab19('0xd')](socket);function respondWithRpcPromise(_0xbd14a4,_0xdae151,_0x1674ea){return new BPromise(function(_0x17d4df,_0x687f65){return client[_0xab19('0xe')](_0xbd14a4,_0x1674ea)[_0xab19('0xf')](function(_0x45c4fc){logger[_0xab19('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0xdae151,'request\x20sent');logger[_0xab19('0x11')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xdae151,_0xab19('0x12'),JSON[_0xab19('0x13')](_0x45c4fc));if(_0x45c4fc[_0xab19('0x14')]){if(_0x45c4fc[_0xab19('0x14')][_0xab19('0x15')]===0x1f4){logger[_0xab19('0x14')](_0xab19('0x16'),_0xdae151,_0x45c4fc['error'][_0xab19('0x17')]);return _0x687f65(_0x45c4fc[_0xab19('0x14')]['message']);}logger[_0xab19('0x14')](_0xab19('0x16'),_0xdae151,_0x45c4fc['error']['message']);return _0x17d4df(_0x45c4fc[_0xab19('0x14')][_0xab19('0x17')]);}else{logger[_0xab19('0x10')](_0xab19('0x16'),_0xdae151,'request\x20sent');_0x17d4df(_0x45c4fc[_0xab19('0x18')][_0xab19('0x17')]);}})['catch'](function(_0x14fa6f){logger[_0xab19('0x14')](_0xab19('0x16'),_0xdae151,_0x14fa6f);_0x687f65(_0x14fa6f);});});}exports['ShowWhatsappAccount']=function(_0x576381){var _0x481749=this;return new Promise(function(_0x17e17e,_0x4279e7){return db['WhatsappAccount'][_0xab19('0x19')]({'raw':_0x576381['options']?_0x576381[_0xab19('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x576381[_0xab19('0x1a')]?_0x576381[_0xab19('0x1a')][_0xab19('0x1b')]||null:null,'attributes':_0x576381[_0xab19('0x1a')]?_0x576381[_0xab19('0x1a')][_0xab19('0x1c')]||null:null,'include':_0x576381['options']?_0x576381[_0xab19('0x1a')][_0xab19('0x1d')]?_[_0xab19('0x1e')](_0x576381[_0xab19('0x1a')][_0xab19('0x1d')],function(_0xed742b){return{'model':db[_0xed742b[_0xab19('0x1f')]],'as':_0xed742b['as'],'attributes':_0xed742b[_0xab19('0x1c')],'include':_0xed742b['include']?_[_0xab19('0x1e')](_0xed742b[_0xab19('0x1d')],function(_0x3dda13){return{'model':db[_0x3dda13[_0xab19('0x1f')]],'as':_0x3dda13['as'],'attributes':_0x3dda13[_0xab19('0x1c')],'include':_0x3dda13[_0xab19('0x1d')]?_[_0xab19('0x1e')](_0x3dda13[_0xab19('0x1d')],function(_0x5946ee){return{'model':db[_0x5946ee[_0xab19('0x1f')]],'as':_0x5946ee['as'],'attributes':_0x5946ee[_0xab19('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1aacdd){logger['info'](_0xab19('0x20'),_0x576381);logger[_0xab19('0x11')]('ShowWhatsappAccount',_0x576381,JSON[_0xab19('0x13')](_0x1aacdd));_0x17e17e(_0x1aacdd);})['catch'](function(_0x3d67ce){logger['error'](_0xab19('0x20'),_0x3d67ce[_0xab19('0x17')],_0x576381);_0x4279e7(_0x481749['error'](0x1f4,_0x3d67ce[_0xab19('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 0878288..53203f6 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 _0x7c48=['emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x5335ea,_0x2a612d){var _0x40a7da=function(_0x28023c){while(--_0x28023c){_0x5335ea['push'](_0x5335ea['shift']());}};_0x40a7da(++_0x2a612d);}(_0x7c48,0x18d));var _0x87c4=function(_0xc7cc71,_0x530d6d){_0xc7cc71=_0xc7cc71-0x0;var _0x6b3827=_0x7c48[_0xc7cc71];return _0x6b3827;};'use strict';var WhatsappAccountEvents=require(_0x87c4('0x0'));var events=[_0x87c4('0x1'),_0x87c4('0x2'),'update'];function createListener(_0x12cae7,_0x4bb4f8){return function(_0x44fdee){_0x4bb4f8[_0x87c4('0x3')](_0x12cae7,_0x44fdee);};}function removeListener(_0x4508ee,_0x1184b0){return function(){WhatsappAccountEvents[_0x87c4('0x4')](_0x4508ee,_0x1184b0);};}exports[_0x87c4('0x5')]=function(_0x143197){for(var _0x1bb708=0x0,_0x250ede=events[_0x87c4('0x6')];_0x1bb708<_0x250ede;_0x1bb708++){var _0x12266c=events[_0x1bb708];var _0x4e3e17=createListener(_0x87c4('0x7')+_0x12266c,_0x143197);WhatsappAccountEvents['on'](_0x12266c,_0x4e3e17);}}; \ No newline at end of file +var _0xf5aa=['removeListener','register','length','whatsappAccount:','save','update','emit'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xf5aa,0x170));var _0xaf5a=function(_0x4d50af,_0x58425e){_0x4d50af=_0x4d50af-0x0;var _0x2211aa=_0xf5aa[_0x4d50af];return _0x2211aa;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xaf5a('0x0'),'remove',_0xaf5a('0x1')];function createListener(_0x1407e1,_0x25ac2a){return function(_0x5f5282){_0x25ac2a[_0xaf5a('0x2')](_0x1407e1,_0x5f5282);};}function removeListener(_0x4a8b4d,_0x19f30b){return function(){WhatsappAccountEvents[_0xaf5a('0x3')](_0x4a8b4d,_0x19f30b);};}exports[_0xaf5a('0x4')]=function(_0x4b2013){for(var _0x4cf2cd=0x0,_0xa5acb3=events[_0xaf5a('0x5')];_0x4cf2cd<_0xa5acb3;_0x4cf2cd++){var _0x589bae=events[_0x4cf2cd];var _0x4d787a=createListener(_0xaf5a('0x6')+_0x589bae,_0x4b2013);WhatsappAccountEvents['on'](_0x589bae,_0x4d787a);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 70b6dad..a3cec6d 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 _0x850b=['isAuthenticated','show','post','create','put','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','index','/:id'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x850b,0x193));var _0xb850=function(_0x468b82,_0x16b7f){_0x468b82=_0x468b82-0x0;var _0x145e50=_0x850b[_0x468b82];return _0x145e50;};'use strict';var multer=require('multer');var util=require(_0xb850('0x0'));var path=require(_0xb850('0x1'));var timeout=require(_0xb850('0x2'));var express=require('express');var router=express[_0xb850('0x3')]();var fs_extra=require(_0xb850('0x4'));var auth=require(_0xb850('0x5'));var interaction=require(_0xb850('0x6'));var config=require('../../config/environment');var controller=require(_0xb850('0x7'));router[_0xb850('0x8')]('/',auth['isAuthenticated'](),controller[_0xb850('0x9')]);router[_0xb850('0x8')](_0xb850('0xa'),auth[_0xb850('0xb')](),controller[_0xb850('0xc')]);router[_0xb850('0xd')]('/',auth[_0xb850('0xb')](),controller[_0xb850('0xe')]);router[_0xb850('0xf')](_0xb850('0xa'),auth[_0xb850('0xb')](),controller['update']);router[_0xb850('0x10')](_0xb850('0xa'),auth[_0xb850('0xb')](),controller['destroy']);module[_0xb850('0x11')]=router; \ No newline at end of file +var _0x5962=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','show','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x5962,0xe9));var _0x2596=function(_0x529296,_0x1a6a23){_0x529296=_0x529296-0x0;var _0x1796bf=_0x5962[_0x529296];return _0x1796bf;};'use strict';var multer=require(_0x2596('0x0'));var util=require('util');var path=require(_0x2596('0x1'));var timeout=require(_0x2596('0x2'));var express=require(_0x2596('0x3'));var router=express[_0x2596('0x4')]();var fs_extra=require(_0x2596('0x5'));var auth=require(_0x2596('0x6'));var interaction=require(_0x2596('0x7'));var config=require(_0x2596('0x8'));var controller=require(_0x2596('0x9'));router[_0x2596('0xa')]('/',auth['isAuthenticated'](),controller[_0x2596('0xb')]);router[_0x2596('0xa')](_0x2596('0xc'),auth[_0x2596('0xd')](),controller[_0x2596('0xe')]);router['post']('/',auth[_0x2596('0xd')](),controller[_0x2596('0xf')]);router[_0x2596('0x10')](_0x2596('0xc'),auth['isAuthenticated'](),controller[_0x2596('0x11')]);router['delete'](_0x2596('0xc'),auth[_0x2596('0xd')](),controller[_0x2596('0x12')]);module[_0x2596('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 2e7e729..aa62d4f 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 _0xdf56=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x17a8fc,_0x158d5f){var _0x389737=function(_0x211000){while(--_0x211000){_0x17a8fc['push'](_0x17a8fc['shift']());}};_0x389737(++_0x158d5f);}(_0xdf56,0x1b6));var _0x6df5=function(_0x54a376,_0x398322){_0x54a376=_0x54a376-0x0;var _0x5d0ae0=_0xdf56[_0x54a376];return _0x5d0ae0;};'use strict';var Sequelize=require(_0x6df5('0x0'));module[_0x6df5('0x1')]={'priority':{'type':Sequelize[_0x6df5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6df5('0x3')],'allowNull':![],'defaultValue':_0x6df5('0x4')},'appdata':{'type':Sequelize[_0x6df5('0x5')]()},'description':{'type':Sequelize[_0x6df5('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6df5('0x6')}}; \ No newline at end of file +var _0x76a0=['exports','STRING','TEXT','sequelize'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x76a0,0xeb));var _0x076a=function(_0x570496,_0x26a150){_0x570496=_0x570496-0x0;var _0x1d4204=_0x76a0[_0x570496];return _0x1d4204;};'use strict';var Sequelize=require(_0x076a('0x0'));module[_0x076a('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x076a('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x076a('0x3')]()},'description':{'type':Sequelize[_0x076a('0x2')]},'interval':{'type':Sequelize[_0x076a('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 9accff0..53a1b31 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 _0x38b8=['crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','catch','show','params','length','include','create','body','find','eml-format','zip-dir','fast-json-patch','moment','util','path','ejs','fs-extra','squel'];(function(_0x2adfb1,_0x406e6e){var _0xa52d45=function(_0x2de16c){while(--_0x2de16c){_0x2adfb1['push'](_0x2adfb1['shift']());}};_0xa52d45(++_0x406e6e);}(_0x38b8,0x7f));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x838b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x838b('0x1'));var jsonpatch=require(_0x838b('0x2'));var rp=require('request-promise');var moment=require(_0x838b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x838b('0x4'));var path=require(_0x838b('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x838b('0x6'));var fs=require('fs');var fs_extra=require(_0x838b('0x7'));var _=require('lodash');var squel=require(_0x838b('0x8'));var crypto=require(_0x838b('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x838b('0xa'));var querystring=require(_0x838b('0xb'));var Papa=require(_0x838b('0xc'));var Redis=require('ioredis');var authService=require(_0x838b('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x838b('0xe'));var hardwareService=require(_0x838b('0xf'));var logger=require(_0x838b('0x10'))(_0x838b('0x11'));var utils=require(_0x838b('0x12'));var config=require(_0x838b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x838b('0x14'))['db'];function respondWithStatusCode(_0x281764,_0x13fe8a){_0x13fe8a=_0x13fe8a||0xcc;return function(_0x144189){if(_0x144189){return _0x281764[_0x838b('0x15')](_0x13fe8a);}return _0x281764[_0x838b('0x16')](_0x13fe8a)[_0x838b('0x17')]();};}function respondWithResult(_0x3324de,_0x1ddf43){_0x1ddf43=_0x1ddf43||0xc8;return function(_0x525c60){if(_0x525c60){return _0x3324de[_0x838b('0x16')](_0x1ddf43)['json'](_0x525c60);}};}function respondWithFilteredResult(_0x4e1085,_0x584b04){return function(_0x450b9b){if(_0x450b9b){var _0x1da340=typeof _0x584b04[_0x838b('0x18')]===_0x838b('0x19')&&typeof _0x584b04[_0x838b('0x1a')]==='undefined';var _0x21aa1a=_0x450b9b[_0x838b('0x1b')];var _0x44a62c=_0x1da340?0x0:_0x584b04[_0x838b('0x18')];var _0x48c4ab=_0x1da340?_0x450b9b[_0x838b('0x1b')]:_0x584b04[_0x838b('0x18')]+_0x584b04['limit'];var _0x4c1251;if(_0x48c4ab>=_0x21aa1a){_0x48c4ab=_0x21aa1a;_0x4c1251=0xc8;}else{_0x4c1251=0xce;}_0x4e1085[_0x838b('0x16')](_0x4c1251);return _0x4e1085['set'](_0x838b('0x1c'),_0x44a62c+'-'+_0x48c4ab+'/'+_0x21aa1a)[_0x838b('0x1d')](_0x450b9b);}return null;};}function patchUpdates(_0x432a75){return function(_0x4deb91){try{jsonpatch[_0x838b('0x1e')](_0x4deb91,_0x432a75,!![]);}catch(_0x389a99){return BPromise[_0x838b('0x1f')](_0x389a99);}return _0x4deb91[_0x838b('0x20')]();};}function saveUpdates(_0x371082,_0x3f8848){return function(_0x11de0e){if(_0x11de0e){return _0x11de0e[_0x838b('0x21')](_0x371082)[_0x838b('0x22')](function(_0xd48f3b){return _0xd48f3b;});}return null;};}function removeEntity(_0x2eecf9,_0xba76){return function(_0x451089){if(_0x451089){return _0x451089[_0x838b('0x23')]()['then'](function(){_0x2eecf9[_0x838b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51adc6,_0x430400){return function(_0x2bc24c){if(!_0x2bc24c){_0x51adc6[_0x838b('0x15')](0x194);}return _0x2bc24c;};}function handleError(_0x5cec50,_0x302445){_0x302445=_0x302445||0x1f4;return function(_0x27f385){logger['error'](_0x27f385[_0x838b('0x24')]);if(_0x27f385[_0x838b('0x25')]){delete _0x27f385['name'];}_0x5cec50['status'](_0x302445)['send'](_0x27f385);};}exports['index']=function(_0x4f6179,_0x4b46bc){var _0x1e74a6={},_0x227876={},_0x5b66f6={'count':0x0,'rows':[]};var _0x5aeeca=_[_0x838b('0x26')](db[_0x838b('0x27')][_0x838b('0x28')],function(_0x29e161){return{'name':_0x29e161[_0x838b('0x29')],'type':_0x29e161[_0x838b('0x2a')][_0x838b('0x2b')]};});_0x227876[_0x838b('0x2c')]=_[_0x838b('0x26')](_0x5aeeca,'name');_0x227876[_0x838b('0x2d')]=_[_0x838b('0x2e')](_0x4f6179[_0x838b('0x2d')]);_0x227876[_0x838b('0x2f')]=_['intersection'](_0x227876[_0x838b('0x2c')],_0x227876[_0x838b('0x2d')]);_0x1e74a6[_0x838b('0x30')]=_[_0x838b('0x31')](_0x227876[_0x838b('0x2c')],qs['fields'](_0x4f6179[_0x838b('0x2d')][_0x838b('0x32')]));_0x1e74a6[_0x838b('0x30')]=_0x1e74a6[_0x838b('0x30')]['length']?_0x1e74a6[_0x838b('0x30')]:_0x227876[_0x838b('0x2c')];if(!_0x4f6179['query'][_0x838b('0x33')](_0x838b('0x34'))){_0x1e74a6[_0x838b('0x1a')]=qs[_0x838b('0x1a')](_0x4f6179[_0x838b('0x2d')]['limit']);_0x1e74a6[_0x838b('0x18')]=qs[_0x838b('0x18')](_0x4f6179['query'][_0x838b('0x18')]);}_0x1e74a6['order']=qs[_0x838b('0x35')](_0x4f6179['query'][_0x838b('0x35')]);_0x1e74a6['where']=qs[_0x838b('0x2f')](_[_0x838b('0x36')](_0x4f6179[_0x838b('0x2d')],_0x227876[_0x838b('0x2f')]),_0x5aeeca);if(_0x4f6179[_0x838b('0x2d')][_0x838b('0x37')]){_0x1e74a6[_0x838b('0x38')]=_[_0x838b('0x39')](_0x1e74a6[_0x838b('0x38')],{'$or':_[_0x838b('0x26')](_0x5aeeca,function(_0x4ee9c2){if(_0x4ee9c2[_0x838b('0x2a')]!=='VIRTUAL'){var _0x24958f={};_0x24958f[_0x4ee9c2[_0x838b('0x25')]]={'$like':'%'+_0x4f6179[_0x838b('0x2d')][_0x838b('0x37')]+'%'};return _0x24958f;}})});}_0x1e74a6=_[_0x838b('0x39')]({},_0x1e74a6,_0x4f6179[_0x838b('0x3a')]);var _0x26dfab={'where':_0x1e74a6[_0x838b('0x38')]};return db['WhatsappApplication'][_0x838b('0x1b')](_0x26dfab)[_0x838b('0x22')](function(_0x18db4f){_0x5b66f6[_0x838b('0x1b')]=_0x18db4f;if(_0x4f6179[_0x838b('0x2d')][_0x838b('0x3b')]){_0x1e74a6['include']=[{'all':!![]}];}return db[_0x838b('0x27')]['findAll'](_0x1e74a6);})[_0x838b('0x22')](function(_0x3e67de){_0x5b66f6['rows']=_0x3e67de;return _0x5b66f6;})[_0x838b('0x22')](respondWithFilteredResult(_0x4b46bc,_0x1e74a6))[_0x838b('0x3c')](handleError(_0x4b46bc,null));};exports[_0x838b('0x3d')]=function(_0x8e18a8,_0x4a66fb){var _0x51689a={'raw':!![],'where':{'id':_0x8e18a8[_0x838b('0x3e')]['id']}},_0x3e727d={};_0x3e727d['model']=_[_0x838b('0x2e')](db['WhatsappApplication'][_0x838b('0x28')]);_0x3e727d[_0x838b('0x2d')]=_[_0x838b('0x2e')](_0x8e18a8[_0x838b('0x2d')]);_0x3e727d[_0x838b('0x2f')]=_['intersection'](_0x3e727d[_0x838b('0x2c')],_0x3e727d['query']);_0x51689a[_0x838b('0x30')]=_['intersection'](_0x3e727d[_0x838b('0x2c')],qs[_0x838b('0x32')](_0x8e18a8['query'][_0x838b('0x32')]));_0x51689a[_0x838b('0x30')]=_0x51689a['attributes'][_0x838b('0x3f')]?_0x51689a['attributes']:_0x3e727d[_0x838b('0x2c')];if(_0x8e18a8[_0x838b('0x2d')]['includeAll']){_0x51689a[_0x838b('0x40')]=[{'all':!![]}];}_0x51689a=_['merge']({},_0x51689a,_0x8e18a8['options']);return db['WhatsappApplication']['find'](_0x51689a)[_0x838b('0x22')](handleEntityNotFound(_0x4a66fb,null))[_0x838b('0x22')](respondWithResult(_0x4a66fb,null))[_0x838b('0x3c')](handleError(_0x4a66fb,null));};exports[_0x838b('0x41')]=function(_0x829aef,_0x1aaeb2){return db['WhatsappApplication'][_0x838b('0x41')](_0x829aef['body'],{})[_0x838b('0x22')](respondWithResult(_0x1aaeb2,0xc9))['catch'](handleError(_0x1aaeb2,null));};exports[_0x838b('0x21')]=function(_0x2b8990,_0x2d7e50){if(_0x2b8990[_0x838b('0x42')]['id']){delete _0x2b8990[_0x838b('0x42')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x2b8990[_0x838b('0x3e')]['id']}})[_0x838b('0x22')](handleEntityNotFound(_0x2d7e50,null))['then'](saveUpdates(_0x2b8990['body'],null))[_0x838b('0x22')](respondWithResult(_0x2d7e50,null))[_0x838b('0x3c')](handleError(_0x2d7e50,null));};exports[_0x838b('0x23')]=function(_0xa54216,_0x438afa){return db[_0x838b('0x27')][_0x838b('0x43')]({'where':{'id':_0xa54216[_0x838b('0x3e')]['id']}})[_0x838b('0x22')](handleEntityNotFound(_0x438afa,null))[_0x838b('0x22')](removeEntity(_0x438afa,null))['catch'](handleError(_0x438afa,null));}; \ No newline at end of file +var _0x3c8b=['then','destroy','error','stack','name','send','index','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','update','params','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','reject'];(function(_0x4b0cfa,_0x3e6567){var _0x1a574f=function(_0x57bd9e){while(--_0x57bd9e){_0x4b0cfa['push'](_0x4b0cfa['shift']());}};_0x1a574f(++_0x3e6567);}(_0x3c8b,0x18b));var _0xb3c8=function(_0x2629b2,_0x17534b){_0x2629b2=_0x2629b2-0x0;var _0x205ec8=_0x3c8b[_0x2629b2];return _0x205ec8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3c8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb3c8('0x1'));var rp=require(_0xb3c8('0x2'));var moment=require(_0xb3c8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb3c8('0x4'));var util=require(_0xb3c8('0x5'));var path=require(_0xb3c8('0x6'));var sox=require(_0xb3c8('0x7'));var csv=require(_0xb3c8('0x8'));var ejs=require(_0xb3c8('0x9'));var fs=require('fs');var fs_extra=require(_0xb3c8('0xa'));var _=require(_0xb3c8('0xb'));var squel=require('squel');var crypto=require(_0xb3c8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb3c8('0xd'));var toCsv=require(_0xb3c8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb3c8('0xe'));var qs=require(_0xb3c8('0xf'));var as=require(_0xb3c8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3c8('0x11'))(_0xb3c8('0x12'));var utils=require(_0xb3c8('0x13'));var config=require(_0xb3c8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb3c8('0x15'))['db'];function respondWithStatusCode(_0x478c21,_0x4c2d04){_0x4c2d04=_0x4c2d04||0xcc;return function(_0x4928b9){if(_0x4928b9){return _0x478c21[_0xb3c8('0x16')](_0x4c2d04);}return _0x478c21[_0xb3c8('0x17')](_0x4c2d04)[_0xb3c8('0x18')]();};}function respondWithResult(_0x5eaa0f,_0x4ca645){_0x4ca645=_0x4ca645||0xc8;return function(_0xa2a80c){if(_0xa2a80c){return _0x5eaa0f[_0xb3c8('0x17')](_0x4ca645)[_0xb3c8('0x19')](_0xa2a80c);}};}function respondWithFilteredResult(_0x48a430,_0x5b079a){return function(_0x89f267){if(_0x89f267){var _0x1ae662=typeof _0x5b079a[_0xb3c8('0x1a')]==='undefined'&&typeof _0x5b079a[_0xb3c8('0x1b')]===_0xb3c8('0x1c');var _0x385f8b=_0x89f267[_0xb3c8('0x1d')];var _0x459f4f=_0x1ae662?0x0:_0x5b079a[_0xb3c8('0x1a')];var _0xd27d78=_0x1ae662?_0x89f267[_0xb3c8('0x1d')]:_0x5b079a[_0xb3c8('0x1a')]+_0x5b079a['limit'];var _0x58db91;if(_0xd27d78>=_0x385f8b){_0xd27d78=_0x385f8b;_0x58db91=0xc8;}else{_0x58db91=0xce;}_0x48a430[_0xb3c8('0x17')](_0x58db91);return _0x48a430['set']('Content-Range',_0x459f4f+'-'+_0xd27d78+'/'+_0x385f8b)[_0xb3c8('0x19')](_0x89f267);}return null;};}function patchUpdates(_0x4df53e){return function(_0x133372){try{jsonpatch['apply'](_0x133372,_0x4df53e,!![]);}catch(_0x4a9f37){return BPromise[_0xb3c8('0x1e')](_0x4a9f37);}return _0x133372['save']();};}function saveUpdates(_0x3f209a,_0xc9fc66){return function(_0x34b11c){if(_0x34b11c){return _0x34b11c['update'](_0x3f209a)[_0xb3c8('0x1f')](function(_0x541df4){return _0x541df4;});}return null;};}function removeEntity(_0xdd0720,_0x3fbe65){return function(_0x35cfad){if(_0x35cfad){return _0x35cfad[_0xb3c8('0x20')]()[_0xb3c8('0x1f')](function(){_0xdd0720[_0xb3c8('0x17')](0xcc)[_0xb3c8('0x18')]();});}};}function handleEntityNotFound(_0x1e4dc0,_0x725bbf){return function(_0x557be7){if(!_0x557be7){_0x1e4dc0[_0xb3c8('0x16')](0x194);}return _0x557be7;};}function handleError(_0x5d941e,_0x1765b9){_0x1765b9=_0x1765b9||0x1f4;return function(_0x1c5bca){logger[_0xb3c8('0x21')](_0x1c5bca[_0xb3c8('0x22')]);if(_0x1c5bca['name']){delete _0x1c5bca[_0xb3c8('0x23')];}_0x5d941e[_0xb3c8('0x17')](_0x1765b9)[_0xb3c8('0x24')](_0x1c5bca);};}exports[_0xb3c8('0x25')]=function(_0x275312,_0x24de08){var _0x27c0e9={},_0x58da10={},_0x35bd6d={'count':0x0,'rows':[]};var _0x424d73=_['map'](db[_0xb3c8('0x26')][_0xb3c8('0x27')],function(_0x2a5908){return{'name':_0x2a5908[_0xb3c8('0x28')],'type':_0x2a5908[_0xb3c8('0x29')][_0xb3c8('0x2a')]};});_0x58da10[_0xb3c8('0x2b')]=_['map'](_0x424d73,_0xb3c8('0x23'));_0x58da10[_0xb3c8('0x2c')]=_[_0xb3c8('0x2d')](_0x275312[_0xb3c8('0x2c')]);_0x58da10[_0xb3c8('0x2e')]=_['intersection'](_0x58da10[_0xb3c8('0x2b')],_0x58da10[_0xb3c8('0x2c')]);_0x27c0e9[_0xb3c8('0x2f')]=_[_0xb3c8('0x30')](_0x58da10[_0xb3c8('0x2b')],qs[_0xb3c8('0x31')](_0x275312[_0xb3c8('0x2c')][_0xb3c8('0x31')]));_0x27c0e9[_0xb3c8('0x2f')]=_0x27c0e9['attributes'][_0xb3c8('0x32')]?_0x27c0e9['attributes']:_0x58da10[_0xb3c8('0x2b')];if(!_0x275312[_0xb3c8('0x2c')][_0xb3c8('0x33')](_0xb3c8('0x34'))){_0x27c0e9[_0xb3c8('0x1b')]=qs[_0xb3c8('0x1b')](_0x275312['query'][_0xb3c8('0x1b')]);_0x27c0e9['offset']=qs[_0xb3c8('0x1a')](_0x275312[_0xb3c8('0x2c')][_0xb3c8('0x1a')]);}_0x27c0e9[_0xb3c8('0x35')]=qs['sort'](_0x275312[_0xb3c8('0x2c')][_0xb3c8('0x36')]);_0x27c0e9[_0xb3c8('0x37')]=qs[_0xb3c8('0x2e')](_[_0xb3c8('0x38')](_0x275312[_0xb3c8('0x2c')],_0x58da10['filters']),_0x424d73);if(_0x275312[_0xb3c8('0x2c')][_0xb3c8('0x39')]){_0x27c0e9[_0xb3c8('0x37')]=_[_0xb3c8('0x3a')](_0x27c0e9[_0xb3c8('0x37')],{'$or':_['map'](_0x424d73,function(_0x4bcac9){if(_0x4bcac9[_0xb3c8('0x29')]!==_0xb3c8('0x3b')){var _0xda87b1={};_0xda87b1[_0x4bcac9['name']]={'$like':'%'+_0x275312[_0xb3c8('0x2c')]['filter']+'%'};return _0xda87b1;}})});}_0x27c0e9=_[_0xb3c8('0x3a')]({},_0x27c0e9,_0x275312[_0xb3c8('0x3c')]);var _0x40c1ec={'where':_0x27c0e9['where']};return db[_0xb3c8('0x26')][_0xb3c8('0x1d')](_0x40c1ec)[_0xb3c8('0x1f')](function(_0x24cdf4){_0x35bd6d[_0xb3c8('0x1d')]=_0x24cdf4;if(_0x275312[_0xb3c8('0x2c')][_0xb3c8('0x3d')]){_0x27c0e9[_0xb3c8('0x3e')]=[{'all':!![]}];}return db[_0xb3c8('0x26')][_0xb3c8('0x3f')](_0x27c0e9);})['then'](function(_0x3dbfe1){_0x35bd6d[_0xb3c8('0x40')]=_0x3dbfe1;return _0x35bd6d;})[_0xb3c8('0x1f')](respondWithFilteredResult(_0x24de08,_0x27c0e9))[_0xb3c8('0x41')](handleError(_0x24de08,null));};exports['show']=function(_0x4f69c2,_0x43f039){var _0x371f4a={'raw':!![],'where':{'id':_0x4f69c2['params']['id']}},_0x149354={};_0x149354[_0xb3c8('0x2b')]=_[_0xb3c8('0x2d')](db[_0xb3c8('0x26')][_0xb3c8('0x27')]);_0x149354[_0xb3c8('0x2c')]=_['keys'](_0x4f69c2[_0xb3c8('0x2c')]);_0x149354[_0xb3c8('0x2e')]=_[_0xb3c8('0x30')](_0x149354['model'],_0x149354['query']);_0x371f4a[_0xb3c8('0x2f')]=_['intersection'](_0x149354[_0xb3c8('0x2b')],qs[_0xb3c8('0x31')](_0x4f69c2[_0xb3c8('0x2c')][_0xb3c8('0x31')]));_0x371f4a['attributes']=_0x371f4a['attributes'][_0xb3c8('0x32')]?_0x371f4a[_0xb3c8('0x2f')]:_0x149354[_0xb3c8('0x2b')];if(_0x4f69c2[_0xb3c8('0x2c')]['includeAll']){_0x371f4a['include']=[{'all':!![]}];}_0x371f4a=_['merge']({},_0x371f4a,_0x4f69c2[_0xb3c8('0x3c')]);return db[_0xb3c8('0x26')][_0xb3c8('0x42')](_0x371f4a)[_0xb3c8('0x1f')](handleEntityNotFound(_0x43f039,null))[_0xb3c8('0x1f')](respondWithResult(_0x43f039,null))['catch'](handleError(_0x43f039,null));};exports[_0xb3c8('0x43')]=function(_0xccfc6f,_0x214b75){return db[_0xb3c8('0x26')][_0xb3c8('0x43')](_0xccfc6f[_0xb3c8('0x44')],{})[_0xb3c8('0x1f')](respondWithResult(_0x214b75,0xc9))[_0xb3c8('0x41')](handleError(_0x214b75,null));};exports[_0xb3c8('0x45')]=function(_0x4cda15,_0x143841){if(_0x4cda15[_0xb3c8('0x44')]['id']){delete _0x4cda15[_0xb3c8('0x44')]['id'];}return db[_0xb3c8('0x26')][_0xb3c8('0x42')]({'where':{'id':_0x4cda15['params']['id']}})[_0xb3c8('0x1f')](handleEntityNotFound(_0x143841,null))['then'](saveUpdates(_0x4cda15[_0xb3c8('0x44')],null))[_0xb3c8('0x1f')](respondWithResult(_0x143841,null))[_0xb3c8('0x41')](handleError(_0x143841,null));};exports[_0xb3c8('0x20')]=function(_0x3a12a6,_0x19335d){return db[_0xb3c8('0x26')][_0xb3c8('0x42')]({'where':{'id':_0x3a12a6[_0xb3c8('0x46')]['id']}})[_0xb3c8('0x1f')](handleEntityNotFound(_0x19335d,null))[_0xb3c8('0x1f')](removeEntity(_0x19335d,null))[_0xb3c8('0x41')](handleError(_0x19335d,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index db9d157..c131d5d 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 _0x34f8=['moment','path','rimraf','./whatsappApplication.attributes','exports','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x2dea4c,_0x46b99a){var _0x563179=function(_0x562a3c){while(--_0x562a3c){_0x2dea4c['push'](_0x2dea4c['shift']());}};_0x563179(++_0x46b99a);}(_0x34f8,0x80));var _0x834f=function(_0x1cda1c,_0xb0423f){_0x1cda1c=_0x1cda1c-0x0;var _0x306dad=_0x34f8[_0x1cda1c];return _0x306dad;};'use strict';var _=require(_0x834f('0x0'));var util=require(_0x834f('0x1'));var logger=require(_0x834f('0x2'))(_0x834f('0x3'));var moment=require(_0x834f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x834f('0x5'));var rimraf=require(_0x834f('0x6'));var config=require('../../config/environment');var attributes=require(_0x834f('0x7'));module[_0x834f('0x8')]=function(_0x9e052f,_0x3498dd){return _0x9e052f['define']('WhatsappApplication',attributes,{'tableName':_0x834f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x834f('0xa'),'collate':_0x834f('0xb')});}; \ No newline at end of file +var _0x3ee5=['define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports'];(function(_0x3c5e71,_0xfc0c07){var _0x71b974=function(_0x40c7e7){while(--_0x40c7e7){_0x3c5e71['push'](_0x3c5e71['shift']());}};_0x71b974(++_0xfc0c07);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x44fe61,_0x4a5fbe){_0x44fe61=_0x44fe61-0x0;var _0x533922=_0x3ee5[_0x44fe61];return _0x533922;};'use strict';var _=require('lodash');var util=require(_0x53ee('0x0'));var logger=require(_0x53ee('0x1'))('api');var moment=require(_0x53ee('0x2'));var BPromise=require(_0x53ee('0x3'));var rp=require(_0x53ee('0x4'));var fs=require('fs');var path=require(_0x53ee('0x5'));var rimraf=require(_0x53ee('0x6'));var config=require(_0x53ee('0x7'));var attributes=require(_0x53ee('0x8'));module[_0x53ee('0x9')]=function(_0x343bbb,_0x16ad68){return _0x343bbb[_0x53ee('0xa')]('WhatsappApplication',attributes,{'tableName':_0x53ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x53ee('0xc'),'collate':_0x53ee('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 5c616f8..6453233 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 _0xac9d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x375cee,_0x1c3ba4){var _0x30a22b=function(_0x187e98){while(--_0x187e98){_0x375cee['push'](_0x375cee['shift']());}};_0x30a22b(++_0x1c3ba4);}(_0xac9d,0x14d));var _0xdac9=function(_0x1dc01f,_0x157a75){_0x1dc01f=_0x1dc01f-0x0;var _0x298041=_0xac9d[_0x1dc01f];return _0x298041;};'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});function respondWithRpcPromise(_0x776b6c,_0x1c78c5,_0x39f560){return new BPromise(function(_0x5531af,_0x2b1d6f){return client['request'](_0x776b6c,_0x39f560)[_0xdac9('0xc')](function(_0x3a013b){logger[_0xdac9('0xd')](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));logger[_0xdac9('0x10')](_0xdac9('0x11'),_0x1c78c5,_0xdac9('0xf'),JSON[_0xdac9('0x12')](_0x3a013b));if(_0x3a013b['error']){if(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x14')]===0x1f4){logger['error'](_0xdac9('0xe'),_0x1c78c5,_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);return _0x2b1d6f(_0x3a013b['error'][_0xdac9('0x15')]);}logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x3a013b['error']['message']);return _0x5531af(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);}else{logger['info'](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));_0x5531af(_0x3a013b[_0xdac9('0x16')][_0xdac9('0x15')]);}})[_0xdac9('0x17')](function(_0x393acc){logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x393acc);_0x2b1d6f(_0x393acc);});});} \ No newline at end of file +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x89412,_0x36b842){var _0x267077=function(_0x389782){while(--_0x389782){_0x89412['push'](_0x89412['shift']());}};_0x267077(++_0x36b842);}(_0xa41a,0x6b));var _0xaa41=function(_0x351f14,_0x6997c5){_0x351f14=_0x351f14-0x0;var _0x1f791a=_0xa41a[_0x351f14];return _0x1f791a;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 6659f04..91aef1b 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 _0xf69d=['put','whatsappinteraction:update','delete','tracked','destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','/:id/messages','addMessage','post','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags'];(function(_0x568b0e,_0x49eae6){var _0x2fcd1e=function(_0x385bae){while(--_0x385bae){_0x568b0e['push'](_0x568b0e['shift']());}};_0x2fcd1e(++_0x49eae6);}(_0xf69d,0xd3));var _0xdf69=function(_0x311d0c,_0x3d6d81){_0x311d0c=_0x311d0c-0x0;var _0x5c1fa1=_0xf69d[_0x311d0c];return _0x5c1fa1;};'use strict';var multer=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var path=require(_0xdf69('0x2'));var timeout=require(_0xdf69('0x3'));var express=require(_0xdf69('0x4'));var router=express['Router']();var fs_extra=require(_0xdf69('0x5'));var auth=require(_0xdf69('0x6'));var interaction=require(_0xdf69('0x7'));var config=require(_0xdf69('0x8'));var controller=require(_0xdf69('0x9'));router[_0xdf69('0xa')]('/',auth[_0xdf69('0xb')](),controller[_0xdf69('0xc')]);router[_0xdf69('0xa')](_0xdf69('0xd'),auth[_0xdf69('0xb')](),controller[_0xdf69('0xe')]);router[_0xdf69('0xa')](_0xdf69('0xf'),auth[_0xdf69('0xb')](),controller[_0xdf69('0x10')]);router[_0xdf69('0xa')]('/:id/messages',auth[_0xdf69('0xb')](),controller[_0xdf69('0x11')]);router[_0xdf69('0xa')](_0xdf69('0x12'),auth[_0xdf69('0xb')](),controller[_0xdf69('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xdf69('0x14'),auth[_0xdf69('0xb')](),controller[_0xdf69('0x15')]);router[_0xdf69('0x16')](_0xdf69('0x17'),auth[_0xdf69('0xb')](),interaction['tracked'](_0xdf69('0x18'),_0xdf69('0x19')),controller[_0xdf69('0x1a')]);router[_0xdf69('0x1b')]('/:id',auth[_0xdf69('0xb')](),interaction['tracked'](_0xdf69('0x18'),_0xdf69('0x1c')),controller['update']);router[_0xdf69('0x1d')](_0xdf69('0xf'),auth[_0xdf69('0xb')](),interaction[_0xdf69('0x1e')]('whatsapp','whatsappinteraction:destroy'),controller[_0xdf69('0x1f')]);router[_0xdf69('0x1d')]('/:id/tags',auth[_0xdf69('0xb')](),controller[_0xdf69('0x20')]);module[_0xdf69('0x21')]=router; \ No newline at end of file +var _0xa23f=['/:id/messages','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getMessages','/:id/download','download','post'];(function(_0x4bd95b,_0x217896){var _0x57dab0=function(_0x35677d){while(--_0x35677d){_0x4bd95b['push'](_0x4bd95b['shift']());}};_0x57dab0(++_0x217896);}(_0xa23f,0x7c));var _0xfa23=function(_0x256ecb,_0x24d55f){_0x256ecb=_0x256ecb-0x0;var _0x359226=_0xa23f[_0x256ecb];return _0x359226;};'use strict';var multer=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfa23('0x2'));var router=express[_0xfa23('0x3')]();var fs_extra=require(_0xfa23('0x4'));var auth=require(_0xfa23('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa23('0x6'));var controller=require('./whatsappInteraction.controller');router[_0xfa23('0x7')]('/',auth[_0xfa23('0x8')](),controller[_0xfa23('0x9')]);router[_0xfa23('0x7')]('/describe',auth[_0xfa23('0x8')](),controller['describe']);router[_0xfa23('0x7')](_0xfa23('0xa'),auth[_0xfa23('0x8')](),controller[_0xfa23('0xb')]);router[_0xfa23('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0xfa23('0xc')]);router['get'](_0xfa23('0xd'),auth['isAuthenticated'](),controller[_0xfa23('0xe')]);router[_0xfa23('0xf')]('/',auth[_0xfa23('0x8')](),controller['create']);router[_0xfa23('0xf')](_0xfa23('0x10'),auth[_0xfa23('0x8')](),controller['addMessage']);router['post'](_0xfa23('0x11'),auth[_0xfa23('0x8')](),interaction[_0xfa23('0x12')](_0xfa23('0x13'),'whatsappinteraction:addtags'),controller[_0xfa23('0x14')]);router[_0xfa23('0x15')](_0xfa23('0xa'),auth[_0xfa23('0x8')](),interaction['tracked'](_0xfa23('0x13'),_0xfa23('0x16')),controller[_0xfa23('0x17')]);router[_0xfa23('0x18')](_0xfa23('0xa'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0xfa23('0x19')),controller[_0xfa23('0x1a')]);router['delete'](_0xfa23('0x11'),auth[_0xfa23('0x8')](),controller[_0xfa23('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 36cde15..d131eb7 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 _0xdac7=['sequelize','moment','STRING','out','DATE','INTEGER'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xdac7,0x180));var _0x7dac=function(_0x477c0d,_0x58c304){_0x477c0d=_0x477c0d-0x0;var _0x4741ee=_0xdac7[_0x477c0d];return _0x4741ee;};'use strict';var Sequelize=require(_0x7dac('0x0'));var moment=require(_0x7dac('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7dac('0x2')]},'secondDisposition':{'type':Sequelize[_0x7dac('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7dac('0x2')]},'note':{'type':Sequelize[_0x7dac('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7dac('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7dac('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7dac('0x3')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7dac('0x5')]}}; \ No newline at end of file +var _0x7fea=['moment','DATE','STRING','ENUM','out','BOOLEAN','INTEGER'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x7fea,0x149));var _0xa7fe=function(_0x216e35,_0x41e1ee){_0x216e35=_0x216e35-0x0;var _0x53cd42=_0x7fea[_0x216e35];return _0x53cd42;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa7fe('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa7fe('0x1')]},'disposition':{'type':Sequelize[_0xa7fe('0x2')]},'secondDisposition':{'type':Sequelize[_0xa7fe('0x2')]},'thirdDisposition':{'type':Sequelize[_0xa7fe('0x2')]},'note':{'type':Sequelize[_0xa7fe('0x2')]},'phone':{'type':Sequelize[_0xa7fe('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa7fe('0x3')]('in',_0xa7fe('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa7fe('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xa7fe('0x3')]('in',_0xa7fe('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa7fe('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa7fe('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 7f43970..b77d44f 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 _0x3015=['where','$gte','split','format','includeAll','rows','addTags','setTags','Tag','color','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','files','server','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Attachment','Messages','createdAt','secret','read','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','existsSync','createReadStream','pipe','basename','direction','out','firstName','value','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','destroy','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','getOptions','findAll','whatsapp','query','catch','show','params','model','keys','filters','intersection','attributes','fields','include','merge','options','find','create','body','describe','WhatsappMessage','addMessage','ids','length','nolimit','order','sort','pick','WhatsappInteractionId','filter'];(function(_0x1a8411,_0x28dee1){var _0x2c9a42=function(_0xe1c69c){while(--_0xe1c69c){_0x1a8411['push'](_0x1a8411['shift']());}};_0x2c9a42(++_0x28dee1);}(_0x3015,0xb9));var _0x5301=function(_0x364689,_0x3ce43a){_0x364689=_0x364689-0x0;var _0x271144=_0x3015[_0x364689];return _0x271144;};'use strict';var rimraf=require(_0x5301('0x0'));var zipdir=require(_0x5301('0x1'));var moment=require(_0x5301('0x2'));var BPromise=require(_0x5301('0x3'));var util=require(_0x5301('0x4'));var path=require(_0x5301('0x5'));var ejs=require(_0x5301('0x6'));var fs=require('fs');var _=require(_0x5301('0x7'));var Redis=require(_0x5301('0x8'));var interaction=require(_0x5301('0x9'));var qs=require(_0x5301('0xa'));var pdf=require('../../components/export/pdf');var logger=require(_0x5301('0xb'))(_0x5301('0xc'));var config=require('../../config/environment');var db=require(_0x5301('0xd'))['db'];config[_0x5301('0xe')]=_[_0x5301('0xf')](config[_0x5301('0xe')],{'host':_0x5301('0x10'),'port':0x18eb});var socket=require(_0x5301('0x11'))(new Redis(config[_0x5301('0xe')]));require(_0x5301('0x12'))[_0x5301('0x13')](socket);function respondWithStatusCode(_0x2c4813,_0x184ea5){_0x184ea5=_0x184ea5||0xcc;return function(_0x5d3a9f){if(_0x5d3a9f){return _0x2c4813[_0x5301('0x14')](_0x184ea5);}return _0x2c4813[_0x5301('0x15')](_0x184ea5)[_0x5301('0x16')]();};}function respondWithResult(_0x1453e2,_0x12983b){_0x12983b=_0x12983b||0xc8;return function(_0x4ba881){if(_0x4ba881){return _0x1453e2[_0x5301('0x15')](_0x12983b)[_0x5301('0x17')](_0x4ba881);}};}function respondWithFilteredResult(_0x5b1793,_0x3c56c5){return function(_0x281e34){if(_0x281e34){var _0x3146e1=typeof _0x3c56c5['offset']===_0x5301('0x18')&&typeof _0x3c56c5[_0x5301('0x19')]===_0x5301('0x18');var _0xcb6dea=_0x281e34[_0x5301('0x1a')];var _0x2e6f39=_0x3146e1?0x0:_0x3c56c5[_0x5301('0x1b')];var _0x3a7fa1=_0x3146e1?_0x281e34[_0x5301('0x1a')]:_0x3c56c5[_0x5301('0x1b')]+_0x3c56c5[_0x5301('0x19')];var _0x3809e9;if(_0x3a7fa1>=_0xcb6dea){_0x3a7fa1=_0xcb6dea;_0x3809e9=0xc8;}else{_0x3809e9=0xce;}_0x5b1793['status'](_0x3809e9);return _0x5b1793['set'](_0x5301('0x1c'),_0x2e6f39+'-'+_0x3a7fa1+'/'+_0xcb6dea)[_0x5301('0x17')](_0x281e34);}return null;};}function saveUpdates(_0x19a77b){return function(_0x3d4842){if(_0x3d4842){return _0x3d4842[_0x5301('0x1d')](_0x19a77b)[_0x5301('0x1e')](function(_0x223d11){return _0x223d11;});}return null;};}function removeEntity(_0x5b1961){return function(_0x5924a0){if(_0x5924a0){return _0x5924a0[_0x5301('0x1f')]()['then'](function(){_0x5b1961[_0x5301('0x15')](0xcc)[_0x5301('0x16')]();});}};}function handleEntityNotFound(_0xf5fab4){return function(_0x32cdd7){if(!_0x32cdd7){_0xf5fab4[_0x5301('0x14')](0x194);}return _0x32cdd7;};}function handleError(_0x496d2f,_0x115878){_0x115878=_0x115878||0x1f4;return function(_0x4dcedb){logger[_0x5301('0x20')](_0x4dcedb[_0x5301('0x21')]);if(_0x4dcedb['name']){delete _0x4dcedb[_0x5301('0x22')];}_0x496d2f[_0x5301('0x15')](_0x115878)[_0x5301('0x23')](_0x4dcedb);};}exports[_0x5301('0x24')]=function(_0x56af1d,_0x1e332e){var _0x51c1d0={};var _0x35eb24=_[_0x5301('0x25')](db[_0x5301('0x26')][_0x5301('0x27')],function(_0x58e72c){return{'name':_0x58e72c[_0x5301('0x28')],'type':_0x58e72c['type']['key']};});_0x51c1d0=qs[_0x5301('0x29')](_0x35eb24,_0x56af1d);return interaction[_0x5301('0x2a')](_0x5301('0x2b'),_0x56af1d[_0x5301('0x2c')],_0x56af1d['user'],_0x51c1d0,_0x35eb24)[_0x5301('0x1e')](respondWithFilteredResult(_0x1e332e,_0x51c1d0))[_0x5301('0x2d')](handleError(_0x1e332e,null));};exports[_0x5301('0x2e')]=function(_0x17b5f0,_0x3d1cff){var _0x176dda={'raw':![],'where':{'id':_0x17b5f0[_0x5301('0x2f')]['id']}},_0x1c1c23={};_0x1c1c23[_0x5301('0x30')]=_[_0x5301('0x31')](db[_0x5301('0x26')]['rawAttributes']);_0x1c1c23[_0x5301('0x2c')]=_[_0x5301('0x31')](_0x17b5f0[_0x5301('0x2c')]);_0x1c1c23[_0x5301('0x32')]=_[_0x5301('0x33')](_0x1c1c23[_0x5301('0x30')],_0x1c1c23[_0x5301('0x2c')]);_0x176dda[_0x5301('0x34')]=_[_0x5301('0x33')](_0x1c1c23[_0x5301('0x30')],qs[_0x5301('0x35')](_0x17b5f0['query'][_0x5301('0x35')]));_0x176dda['attributes']=_0x176dda[_0x5301('0x34')]['length']?_0x176dda[_0x5301('0x34')]:_0x1c1c23[_0x5301('0x30')];if(_0x17b5f0[_0x5301('0x2c')]['includeAll']){_0x176dda[_0x5301('0x36')]=[{'all':!![]}];}_0x176dda=_[_0x5301('0x37')]({},_0x176dda,_0x17b5f0[_0x5301('0x38')]);return db[_0x5301('0x26')][_0x5301('0x39')](_0x176dda)[_0x5301('0x1e')](handleEntityNotFound(_0x3d1cff,null))[_0x5301('0x1e')](respondWithResult(_0x3d1cff,null))[_0x5301('0x2d')](handleError(_0x3d1cff,null));};exports[_0x5301('0x3a')]=function(_0x56e1d4,_0x2f0646){return db['WhatsappInteraction']['create'](_0x56e1d4[_0x5301('0x3b')],{})[_0x5301('0x1e')](respondWithResult(_0x2f0646,0xc9))[_0x5301('0x2d')](handleError(_0x2f0646,null));};exports[_0x5301('0x1d')]=function(_0x131385,_0x288b35){if(_0x131385[_0x5301('0x3b')]['id']){delete _0x131385['body']['id'];}return db[_0x5301('0x26')]['find']({'where':{'id':_0x131385['params']['id']}})[_0x5301('0x1e')](handleEntityNotFound(_0x288b35,null))[_0x5301('0x1e')](saveUpdates(_0x131385[_0x5301('0x3b')],null))[_0x5301('0x1e')](respondWithResult(_0x288b35,null))['catch'](handleError(_0x288b35,null));};exports['destroy']=function(_0x5ed65a,_0x37e188){return db[_0x5301('0x26')][_0x5301('0x39')]({'where':{'id':_0x5ed65a[_0x5301('0x2f')]['id']}})[_0x5301('0x1e')](handleEntityNotFound(_0x37e188,null))[_0x5301('0x1e')](removeEntity(_0x37e188,null))[_0x5301('0x2d')](handleError(_0x37e188,null));};exports[_0x5301('0x3c')]=function(_0x51e248,_0x583aa7){return db[_0x5301('0x26')][_0x5301('0x3c')]()[_0x5301('0x1e')](respondWithResult(_0x583aa7,null))[_0x5301('0x2d')](handleError(_0x583aa7,null));};exports['addMessage']=function(_0x35f885,_0x5ae91e){return db[_0x5301('0x3d')][_0x5301('0x39')]({'where':{'id':_0x35f885[_0x5301('0x2f')]['id']}})['then'](handleEntityNotFound(_0x5ae91e,null))[_0x5301('0x1e')](function(_0x577b66){if(_0x577b66){return _0x577b66[_0x5301('0x3e')](_0x35f885[_0x5301('0x3b')]['ids'],_['omit'](_0x35f885[_0x5301('0x3b')],[_0x5301('0x3f'),'id'])||{});}})[_0x5301('0x1e')](respondWithResult(_0x5ae91e,null))['catch'](handleError(_0x5ae91e,null));};exports['getMessages']=function(_0x2e391a,_0x36a1b4){var _0x28d9d8={'raw':![],'where':{}};var _0x1fe47b={};var _0x5a797a={'count':0x0,'rows':[]};return db[_0x5301('0x26')]['findOne']({'where':{'id':_0x2e391a[_0x5301('0x2f')]['id']}})['then'](handleEntityNotFound(_0x36a1b4,null))['then'](function(_0x3f854c){if(_0x3f854c){_0x1fe47b[_0x5301('0x30')]=_[_0x5301('0x31')](db[_0x5301('0x3d')][_0x5301('0x27')]);_0x1fe47b[_0x5301('0x2c')]=_['keys'](_0x2e391a[_0x5301('0x2c')]);_0x1fe47b[_0x5301('0x32')]=_['intersection'](_0x1fe47b['model'],_0x1fe47b['query']);_0x28d9d8[_0x5301('0x34')]=_[_0x5301('0x33')](_0x1fe47b[_0x5301('0x30')],qs['fields'](_0x2e391a[_0x5301('0x2c')][_0x5301('0x35')]));_0x28d9d8[_0x5301('0x34')]=_0x28d9d8[_0x5301('0x34')][_0x5301('0x40')]?_0x28d9d8[_0x5301('0x34')]:_0x1fe47b[_0x5301('0x30')];if(!_0x2e391a[_0x5301('0x2c')]['hasOwnProperty'](_0x5301('0x41'))){_0x28d9d8[_0x5301('0x19')]=qs[_0x5301('0x19')](_0x2e391a[_0x5301('0x2c')][_0x5301('0x19')]);_0x28d9d8[_0x5301('0x1b')]=qs[_0x5301('0x1b')](_0x2e391a[_0x5301('0x2c')]['offset']);}_0x28d9d8[_0x5301('0x42')]=qs['sort'](_0x2e391a['query'][_0x5301('0x43')]);_0x28d9d8['where']=qs['filters'](_[_0x5301('0x44')](_0x2e391a[_0x5301('0x2c')],_0x1fe47b['filters']));_0x28d9d8['where'][_0x5301('0x45')]=_0x3f854c['id'];if(_0x2e391a['query'][_0x5301('0x46')]){_0x28d9d8[_0x5301('0x47')]=_[_0x5301('0x37')](_0x28d9d8[_0x5301('0x47')],{'$or':_[_0x5301('0x25')](_0x28d9d8[_0x5301('0x34')],function(_0x9eded7){var _0x514972={};_0x514972[_0x9eded7]={'$like':'%'+_0x2e391a[_0x5301('0x2c')][_0x5301('0x46')]+'%'};return _0x514972;})});}if(_0x2e391a[_0x5301('0x2c')][_0x5301('0x48')]){var _0x2a90ed=_0x2e391a[_0x5301('0x2c')]['$gte'][_0x5301('0x49')](',');var _0x2aa0f1={};_0x2aa0f1[_0x2a90ed[0x0]]={'$gte':moment(_0x2a90ed[0x1])[_0x5301('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x28d9d8[_0x5301('0x47')]=_[_0x5301('0x37')](_0x28d9d8[_0x5301('0x47')],_0x2aa0f1);}_0x28d9d8=_['merge']({},_0x28d9d8,_0x2e391a[_0x5301('0x38')]);return db['WhatsappMessage']['count']({'where':_0x28d9d8[_0x5301('0x47')]})[_0x5301('0x1e')](function(_0x590a77){_0x5a797a['count']=_0x590a77;if(_0x2e391a[_0x5301('0x2c')][_0x5301('0x4b')]){_0x28d9d8[_0x5301('0x36')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x5301('0x2a')](_0x28d9d8);})[_0x5301('0x1e')](function(_0xd71a3c){_0x5a797a[_0x5301('0x4c')]=_0xd71a3c;return _0x5a797a;});}})[_0x5301('0x1e')](respondWithFilteredResult(_0x36a1b4,_0x28d9d8))[_0x5301('0x2d')](handleError(_0x36a1b4,null));};exports[_0x5301('0x4d')]=function(_0x34d229,_0x110fd5){return db[_0x5301('0x26')][_0x5301('0x39')]({'where':{'id':_0x34d229[_0x5301('0x2f')]['id']}})[_0x5301('0x1e')](handleEntityNotFound(_0x110fd5,null))[_0x5301('0x1e')](function(_0x276297){if(_0x276297){return _0x276297[_0x5301('0x4e')](_0x34d229[_0x5301('0x3b')][_0x5301('0x3f')],_['omit'](_0x34d229[_0x5301('0x3b')],['ids','id'])||{})['spread'](function(){return db[_0x5301('0x4f')][_0x5301('0x2a')]({'attributes':['id',_0x5301('0x22'),_0x5301('0x50')],'where':{'id':_0x34d229[_0x5301('0x3b')][_0x5301('0x3f')]}});})[_0x5301('0x1e')](function(_0x28b680){socket['emit'](_0x5301('0x51'),{'id':Number(_0x34d229[_0x5301('0x2f')]['id']),'tags':_0x28b680||[]});return{'id':Number(_0x34d229['params']['id']),'tags':_0x28b680||[]};});}})[_0x5301('0x1e')](respondWithResult(_0x110fd5,null))[_0x5301('0x2d')](handleError(_0x110fd5,null));};exports[_0x5301('0x52')]=function(_0x35c9fc,_0x328c6b){return db['WhatsappInteraction']['find']({'where':{'id':_0x35c9fc[_0x5301('0x2f')]['id']}})[_0x5301('0x1e')](handleEntityNotFound(_0x328c6b,null))['then'](function(_0x3e0691){if(_0x3e0691){return _0x3e0691[_0x5301('0x52')](_0x35c9fc['query']['ids']);}})[_0x5301('0x1e')](respondWithStatusCode(_0x328c6b,null))['catch'](handleError(_0x328c6b,null));};exports[_0x5301('0x53')]=function(_0x1311ae,_0x4de934){var _0xbaaf67=moment()[_0x5301('0x54')]()[_0x5301('0x55')]();var _0x3609fd=path[_0x5301('0x56')](config[_0x5301('0x57')],'server',_0x5301('0x58'),'tmp');var _0x1e42d0=path[_0x5301('0x56')](config['root'],_0x5301('0x59'),_0x5301('0x58'),_0x5301('0x5a'));var _0x5e61c0=path[_0x5301('0x56')](_0x3609fd,_0xbaaf67);var _0x4dad89=util[_0x5301('0x4a')](_0x5301('0x5b'),_0x1311ae[_0x5301('0x2f')]['id'],_0xbaaf67);var _0x589c08=path[_0x5301('0x56')](_0x3609fd,_0x4dad89);var _0x3798de=[];_0x3798de[_0x5301('0x5c')]({'model':db[_0x5301('0x5d')],'as':_0x5301('0x5d'),'attributes':['id',_0x5301('0x5e')],'raw':!![]});_0x3798de[_0x5301('0x5c')]({'model':db[_0x5301('0x5f')],'as':_0x5301('0x60'),'attributes':['id','firstName',_0x5301('0x61')],'raw':!![]});if(_0x1311ae[_0x5301('0x2c')]['attachments']){_0x3798de[_0x5301('0x5c')]({'model':db[_0x5301('0x62')],'as':_0x5301('0x62'),'raw':!![]});}var _0x5807b8=[{'model':db[_0x5301('0x3d')],'as':_0x5301('0x63'),'attributes':['id',_0x5301('0x3b'),_0x5301('0x64'),'direction',_0x5301('0x65'),_0x5301('0x66')],'include':_0x3798de}];_0x5807b8[_0x5301('0x5c')]({'model':db[_0x5301('0x67')],'as':_0x5301('0x68'),'attributes':['id',_0x5301('0x22')]});_0x5807b8[_0x5301('0x5c')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db['WhatsappInteraction']['find']({'where':{'id':_0x1311ae[_0x5301('0x2f')]['id']},'include':_0x5807b8})[_0x5301('0x1e')](handleEntityNotFound(_0x4de934,null))['then'](function(_0x2867b2){if(_0x2867b2){var _0x3cceb3=_0x2867b2[_0x5301('0x69')]({'plain':!![]});fs[_0x5301('0x6a')](_0x5e61c0);var _0x43aef4={'channel':_0x5301('0x6b'),'account':_0x3cceb3[_0x5301('0x68')][_0x5301('0x22')],'agent':_0x3cceb3[_0x5301('0x6c')]?_0x3cceb3['Owner'][_0x5301('0x5e')]:_0x5301('0x6d'),'createdAt':moment(_0x3cceb3[_0x5301('0x64')])['format'](_0x5301('0x6e'))[_0x5301('0x55')](),'closedAt':_0x3cceb3[_0x5301('0x6f')]?moment(_0x3cceb3[_0x5301('0x70')])[_0x5301('0x4a')](_0x5301('0x6e'))[_0x5301('0x55')]():'','disposition':_0x3cceb3[_0x5301('0x71')],'messages':_(_0x3cceb3['Messages'])[_0x5301('0x46')]({'secret':![]})[_0x5301('0x25')](function(_0x965cab){if(_0x965cab['Attachment']){var _0xee697e=path['join'](_0x1e42d0,_0x965cab[_0x5301('0x62')]['basename']);if(fs[_0x5301('0x72')](_0xee697e)){fs[_0x5301('0x73')](_0xee697e)[_0x5301('0x74')](fs['createWriteStream'](path[_0x5301('0x56')](_0x5e61c0,_0x965cab['Attachment'][_0x5301('0x75')])));}}return{'date':moment(_0x965cab['createdAt'])['format'](_0x5301('0x6e'))[_0x5301('0x55')](),'sender':_0x965cab[_0x5301('0x76')]===_0x5301('0x77')?_0x965cab[_0x5301('0x5d')]?_0x965cab['User'][_0x5301('0x5e')]:'System':_0x965cab[_0x5301('0x60')][_0x5301('0x78')]+(_0x965cab['Contact'][_0x5301('0x61')]?'\x20'+_0x965cab['Contact']['lastName']:''),'body':_0x965cab['Attachment']?_0x965cab['Attachment']['basename']:_0x965cab['body'],'direction':_0x965cab[_0x5301('0x76')]===_0x5301('0x77')?'A':'C','secret':_0x965cab['secret'],'read':_0x965cab[_0x5301('0x66')],'attachment':_0x965cab[_0x5301('0x62')]};})[_0x5301('0x79')]()};return ejs['renderFile'](path[_0x5301('0x56')](config[_0x5301('0x57')],'server','views',_0x5301('0x7a')),{'interaction':_0x43aef4})[_0x5301('0x1e')](function(_0x19c52f){var _0x36edbb=path[_0x5301('0x56')](_0x5e61c0,_0x5301('0x7b')+_0x3cceb3['id']+'-'+_0xbaaf67+_0x5301('0x7c'));var _0x2f12e1={'path':_0x36edbb,'channel':'Whatsapp','interactionId':_0x3cceb3['id']};return pdf[_0x5301('0x7d')](_0x19c52f,_0x2f12e1);})['then'](function(){return new BPromise(function(_0x342d85,_0x39e242){zipdir(_0x5e61c0,{'saveTo':_0x589c08},function(_0x536181,_0x5752f4){if(_0x536181)return _0x39e242(_0x536181);return _0x342d85(_0x5752f4);});})[_0x5301('0x1e')](function(){return new BPromise(function(_0x57c71d,_0x5a8c67){rimraf(_0x5e61c0,function(_0x40e176){if(_0x40e176)_0x5a8c67(_0x40e176);return _0x57c71d();});});})['then'](function(){return _0x4de934['download'](_0x589c08,_0x4dad89,function(_0x116959){if(_0x116959){console[_0x5301('0x7e')]('err',_0x116959);}else{fs[_0x5301('0x7f')](_0x589c08);}});});});}else{return _0x4de934[_0x5301('0x14')](0xc8);}})[_0x5301('0x2d')](handleError(_0x4de934,null));}; \ No newline at end of file +var _0xf948=['rows','addTags','setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','files','tmp','join','root','server','attachments','format','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','Attachment','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','fullname','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','toString','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','lastName','secret','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','update','then','destroy','name','send','WhatsappInteraction','rawAttributes','type','key','findAll','whatsapp','query','user','catch','show','params','model','filters','intersection','fields','attributes','length','includeAll','include','options','create','body','find','describe','addMessage','WhatsappMessage','ids','omit','findOne','keys','nolimit','order','sort','pick','WhatsappInteractionId','where','merge','map','filter','$gte','split'];(function(_0x10afdc,_0x5314a1){var _0x2c111e=function(_0x1f8962){while(--_0x1f8962){_0x10afdc['push'](_0x10afdc['shift']());}};_0x2c111e(++_0x5314a1);}(_0xf948,0xc0));var _0x8f94=function(_0x3057fe,_0xf62f30){_0x3057fe=_0x3057fe-0x0;var _0xfc9e=_0xf948[_0x3057fe];return _0xfc9e;};'use strict';var rimraf=require(_0x8f94('0x0'));var zipdir=require(_0x8f94('0x1'));var moment=require(_0x8f94('0x2'));var BPromise=require(_0x8f94('0x3'));var util=require(_0x8f94('0x4'));var path=require(_0x8f94('0x5'));var ejs=require(_0x8f94('0x6'));var fs=require('fs');var _=require(_0x8f94('0x7'));var Redis=require(_0x8f94('0x8'));var interaction=require(_0x8f94('0x9'));var qs=require('../../components/parsers/qs');var pdf=require(_0x8f94('0xa'));var logger=require('../../config/logger')(_0x8f94('0xb'));var config=require('../../config/environment');var db=require(_0x8f94('0xc'))['db'];config[_0x8f94('0xd')]=_[_0x8f94('0xe')](config[_0x8f94('0xd')],{'host':_0x8f94('0xf'),'port':0x18eb});var socket=require(_0x8f94('0x10'))(new Redis(config[_0x8f94('0xd')]));require('./whatsappInteraction.socket')[_0x8f94('0x11')](socket);function respondWithStatusCode(_0x4e885e,_0x4592db){_0x4592db=_0x4592db||0xcc;return function(_0x54624e){if(_0x54624e){return _0x4e885e[_0x8f94('0x12')](_0x4592db);}return _0x4e885e[_0x8f94('0x13')](_0x4592db)[_0x8f94('0x14')]();};}function respondWithResult(_0x4b7bd5,_0x207667){_0x207667=_0x207667||0xc8;return function(_0x20efa3){if(_0x20efa3){return _0x4b7bd5[_0x8f94('0x13')](_0x207667)[_0x8f94('0x15')](_0x20efa3);}};}function respondWithFilteredResult(_0x1c33af,_0x500f73){return function(_0x21d0d2){if(_0x21d0d2){var _0x69f84c=typeof _0x500f73['offset']===_0x8f94('0x16')&&typeof _0x500f73[_0x8f94('0x17')]===_0x8f94('0x16');var _0x80ab95=_0x21d0d2['count'];var _0x5c106f=_0x69f84c?0x0:_0x500f73[_0x8f94('0x18')];var _0x4b6b15=_0x69f84c?_0x21d0d2[_0x8f94('0x19')]:_0x500f73[_0x8f94('0x18')]+_0x500f73[_0x8f94('0x17')];var _0x466b0c;if(_0x4b6b15>=_0x80ab95){_0x4b6b15=_0x80ab95;_0x466b0c=0xc8;}else{_0x466b0c=0xce;}_0x1c33af['status'](_0x466b0c);return _0x1c33af[_0x8f94('0x1a')](_0x8f94('0x1b'),_0x5c106f+'-'+_0x4b6b15+'/'+_0x80ab95)['json'](_0x21d0d2);}return null;};}function saveUpdates(_0x56fc42){return function(_0x2de33a){if(_0x2de33a){return _0x2de33a[_0x8f94('0x1c')](_0x56fc42)[_0x8f94('0x1d')](function(_0x43a56f){return _0x43a56f;});}return null;};}function removeEntity(_0x44292b){return function(_0x420b77){if(_0x420b77){return _0x420b77[_0x8f94('0x1e')]()['then'](function(){_0x44292b[_0x8f94('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x561c6c){return function(_0x43050e){if(!_0x43050e){_0x561c6c[_0x8f94('0x12')](0x194);}return _0x43050e;};}function handleError(_0x40321b,_0xc90f10){_0xc90f10=_0xc90f10||0x1f4;return function(_0x53e4fb){logger['error'](_0x53e4fb['stack']);if(_0x53e4fb[_0x8f94('0x1f')]){delete _0x53e4fb[_0x8f94('0x1f')];}_0x40321b[_0x8f94('0x13')](_0xc90f10)[_0x8f94('0x20')](_0x53e4fb);};}exports['index']=function(_0x51da3a,_0x4160c0){var _0x31e184={};var _0x3c3478=_['map'](db[_0x8f94('0x21')][_0x8f94('0x22')],function(_0x1fe84e){return{'name':_0x1fe84e['fieldName'],'type':_0x1fe84e[_0x8f94('0x23')][_0x8f94('0x24')]};});_0x31e184=qs['getOptions'](_0x3c3478,_0x51da3a);return interaction[_0x8f94('0x25')](_0x8f94('0x26'),_0x51da3a[_0x8f94('0x27')],_0x51da3a[_0x8f94('0x28')],_0x31e184,_0x3c3478)[_0x8f94('0x1d')](respondWithFilteredResult(_0x4160c0,_0x31e184))[_0x8f94('0x29')](handleError(_0x4160c0,null));};exports[_0x8f94('0x2a')]=function(_0x586b34,_0xf8cf55){var _0x26a32b={'raw':![],'where':{'id':_0x586b34[_0x8f94('0x2b')]['id']}},_0x140682={};_0x140682[_0x8f94('0x2c')]=_['keys'](db[_0x8f94('0x21')][_0x8f94('0x22')]);_0x140682[_0x8f94('0x27')]=_['keys'](_0x586b34[_0x8f94('0x27')]);_0x140682[_0x8f94('0x2d')]=_['intersection'](_0x140682[_0x8f94('0x2c')],_0x140682[_0x8f94('0x27')]);_0x26a32b['attributes']=_[_0x8f94('0x2e')](_0x140682[_0x8f94('0x2c')],qs['fields'](_0x586b34[_0x8f94('0x27')][_0x8f94('0x2f')]));_0x26a32b[_0x8f94('0x30')]=_0x26a32b['attributes'][_0x8f94('0x31')]?_0x26a32b[_0x8f94('0x30')]:_0x140682[_0x8f94('0x2c')];if(_0x586b34[_0x8f94('0x27')][_0x8f94('0x32')]){_0x26a32b[_0x8f94('0x33')]=[{'all':!![]}];}_0x26a32b=_['merge']({},_0x26a32b,_0x586b34[_0x8f94('0x34')]);return db[_0x8f94('0x21')]['find'](_0x26a32b)[_0x8f94('0x1d')](handleEntityNotFound(_0xf8cf55,null))[_0x8f94('0x1d')](respondWithResult(_0xf8cf55,null))[_0x8f94('0x29')](handleError(_0xf8cf55,null));};exports['create']=function(_0x24b232,_0x13633d){return db[_0x8f94('0x21')][_0x8f94('0x35')](_0x24b232[_0x8f94('0x36')],{})[_0x8f94('0x1d')](respondWithResult(_0x13633d,0xc9))[_0x8f94('0x29')](handleError(_0x13633d,null));};exports[_0x8f94('0x1c')]=function(_0x5b80d1,_0x35a837){if(_0x5b80d1[_0x8f94('0x36')]['id']){delete _0x5b80d1[_0x8f94('0x36')]['id'];}return db[_0x8f94('0x21')][_0x8f94('0x37')]({'where':{'id':_0x5b80d1[_0x8f94('0x2b')]['id']}})[_0x8f94('0x1d')](handleEntityNotFound(_0x35a837,null))['then'](saveUpdates(_0x5b80d1[_0x8f94('0x36')],null))[_0x8f94('0x1d')](respondWithResult(_0x35a837,null))[_0x8f94('0x29')](handleError(_0x35a837,null));};exports[_0x8f94('0x1e')]=function(_0x1b7f81,_0x96ecc4){return db[_0x8f94('0x21')][_0x8f94('0x37')]({'where':{'id':_0x1b7f81[_0x8f94('0x2b')]['id']}})[_0x8f94('0x1d')](handleEntityNotFound(_0x96ecc4,null))[_0x8f94('0x1d')](removeEntity(_0x96ecc4,null))['catch'](handleError(_0x96ecc4,null));};exports[_0x8f94('0x38')]=function(_0x5dfe94,_0x55fcfe){return db['WhatsappInteraction'][_0x8f94('0x38')]()[_0x8f94('0x1d')](respondWithResult(_0x55fcfe,null))[_0x8f94('0x29')](handleError(_0x55fcfe,null));};exports[_0x8f94('0x39')]=function(_0x2f44b9,_0x447baf){return db[_0x8f94('0x3a')]['find']({'where':{'id':_0x2f44b9[_0x8f94('0x2b')]['id']}})[_0x8f94('0x1d')](handleEntityNotFound(_0x447baf,null))[_0x8f94('0x1d')](function(_0x37937a){if(_0x37937a){return _0x37937a['addMessage'](_0x2f44b9['body'][_0x8f94('0x3b')],_[_0x8f94('0x3c')](_0x2f44b9[_0x8f94('0x36')],[_0x8f94('0x3b'),'id'])||{});}})[_0x8f94('0x1d')](respondWithResult(_0x447baf,null))[_0x8f94('0x29')](handleError(_0x447baf,null));};exports['getMessages']=function(_0x31048a,_0x2c05c2){var _0xf908a={'raw':![],'where':{}};var _0x35bde3={};var _0x37cacc={'count':0x0,'rows':[]};return db[_0x8f94('0x21')][_0x8f94('0x3d')]({'where':{'id':_0x31048a['params']['id']}})[_0x8f94('0x1d')](handleEntityNotFound(_0x2c05c2,null))[_0x8f94('0x1d')](function(_0x449cd2){if(_0x449cd2){_0x35bde3['model']=_[_0x8f94('0x3e')](db['WhatsappMessage'][_0x8f94('0x22')]);_0x35bde3[_0x8f94('0x27')]=_[_0x8f94('0x3e')](_0x31048a[_0x8f94('0x27')]);_0x35bde3['filters']=_[_0x8f94('0x2e')](_0x35bde3['model'],_0x35bde3[_0x8f94('0x27')]);_0xf908a[_0x8f94('0x30')]=_['intersection'](_0x35bde3[_0x8f94('0x2c')],qs['fields'](_0x31048a[_0x8f94('0x27')][_0x8f94('0x2f')]));_0xf908a[_0x8f94('0x30')]=_0xf908a['attributes'][_0x8f94('0x31')]?_0xf908a[_0x8f94('0x30')]:_0x35bde3[_0x8f94('0x2c')];if(!_0x31048a[_0x8f94('0x27')]['hasOwnProperty'](_0x8f94('0x3f'))){_0xf908a['limit']=qs[_0x8f94('0x17')](_0x31048a['query'][_0x8f94('0x17')]);_0xf908a['offset']=qs[_0x8f94('0x18')](_0x31048a[_0x8f94('0x27')][_0x8f94('0x18')]);}_0xf908a[_0x8f94('0x40')]=qs[_0x8f94('0x41')](_0x31048a[_0x8f94('0x27')][_0x8f94('0x41')]);_0xf908a['where']=qs[_0x8f94('0x2d')](_[_0x8f94('0x42')](_0x31048a[_0x8f94('0x27')],_0x35bde3[_0x8f94('0x2d')]));_0xf908a['where'][_0x8f94('0x43')]=_0x449cd2['id'];if(_0x31048a[_0x8f94('0x27')]['filter']){_0xf908a[_0x8f94('0x44')]=_[_0x8f94('0x45')](_0xf908a[_0x8f94('0x44')],{'$or':_[_0x8f94('0x46')](_0xf908a['attributes'],function(_0x39ae08){var _0x24424c={};_0x24424c[_0x39ae08]={'$like':'%'+_0x31048a[_0x8f94('0x27')][_0x8f94('0x47')]+'%'};return _0x24424c;})});}if(_0x31048a[_0x8f94('0x27')]['$gte']){var _0x251c2f=_0x31048a[_0x8f94('0x27')][_0x8f94('0x48')][_0x8f94('0x49')](',');var _0x31ef29={};_0x31ef29[_0x251c2f[0x0]]={'$gte':moment(_0x251c2f[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0xf908a[_0x8f94('0x44')]=_['merge'](_0xf908a[_0x8f94('0x44')],_0x31ef29);}_0xf908a=_[_0x8f94('0x45')]({},_0xf908a,_0x31048a[_0x8f94('0x34')]);return db[_0x8f94('0x3a')][_0x8f94('0x19')]({'where':_0xf908a[_0x8f94('0x44')]})['then'](function(_0x2f85b0){_0x37cacc[_0x8f94('0x19')]=_0x2f85b0;if(_0x31048a[_0x8f94('0x27')][_0x8f94('0x32')]){_0xf908a['include']=[{'all':!![]}];}return db[_0x8f94('0x3a')][_0x8f94('0x25')](_0xf908a);})['then'](function(_0x214544){_0x37cacc[_0x8f94('0x4a')]=_0x214544;return _0x37cacc;});}})[_0x8f94('0x1d')](respondWithFilteredResult(_0x2c05c2,_0xf908a))[_0x8f94('0x29')](handleError(_0x2c05c2,null));};exports[_0x8f94('0x4b')]=function(_0x268a24,_0x3b5e40){return db[_0x8f94('0x21')][_0x8f94('0x37')]({'where':{'id':_0x268a24['params']['id']}})[_0x8f94('0x1d')](handleEntityNotFound(_0x3b5e40,null))['then'](function(_0x531298){if(_0x531298){return _0x531298[_0x8f94('0x4c')](_0x268a24[_0x8f94('0x36')]['ids'],_['omit'](_0x268a24['body'],[_0x8f94('0x3b'),'id'])||{})[_0x8f94('0x4d')](function(){return db[_0x8f94('0x4e')][_0x8f94('0x25')]({'attributes':['id',_0x8f94('0x1f'),'color'],'where':{'id':_0x268a24[_0x8f94('0x36')][_0x8f94('0x3b')]}});})[_0x8f94('0x1d')](function(_0x25280e){socket[_0x8f94('0x4f')](_0x8f94('0x50'),{'id':Number(_0x268a24[_0x8f94('0x2b')]['id']),'tags':_0x25280e||[]});return{'id':Number(_0x268a24[_0x8f94('0x2b')]['id']),'tags':_0x25280e||[]};});}})[_0x8f94('0x1d')](respondWithResult(_0x3b5e40,null))[_0x8f94('0x29')](handleError(_0x3b5e40,null));};exports[_0x8f94('0x51')]=function(_0x498223,_0x8a6d64){return db[_0x8f94('0x21')][_0x8f94('0x37')]({'where':{'id':_0x498223[_0x8f94('0x2b')]['id']}})[_0x8f94('0x1d')](handleEntityNotFound(_0x8a6d64,null))[_0x8f94('0x1d')](function(_0x58bf82){if(_0x58bf82){return _0x58bf82[_0x8f94('0x51')](_0x498223['query'][_0x8f94('0x3b')]);}})['then'](respondWithStatusCode(_0x8a6d64,null))[_0x8f94('0x29')](handleError(_0x8a6d64,null));};exports[_0x8f94('0x52')]=function(_0xbdce83,_0x33a3d7){var _0x4dbf89=moment()[_0x8f94('0x53')]()['toString']();var _0x1be3a9=path['join'](config['root'],'server',_0x8f94('0x54'),_0x8f94('0x55'));var _0x41086a=path[_0x8f94('0x56')](config[_0x8f94('0x57')],_0x8f94('0x58'),_0x8f94('0x54'),_0x8f94('0x59'));var _0xa958fc=path[_0x8f94('0x56')](_0x1be3a9,_0x4dbf89);var _0x2f9545=util[_0x8f94('0x5a')](_0x8f94('0x5b'),_0xbdce83[_0x8f94('0x2b')]['id'],_0x4dbf89);var _0x4d4e35=path[_0x8f94('0x56')](_0x1be3a9,_0x2f9545);var _0x446380=[];_0x446380[_0x8f94('0x5c')]({'model':db[_0x8f94('0x5d')],'as':_0x8f94('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0x446380['push']({'model':db[_0x8f94('0x5e')],'as':_0x8f94('0x5f'),'attributes':['id',_0x8f94('0x60'),'lastName'],'raw':!![]});if(_0xbdce83['query'][_0x8f94('0x59')]){_0x446380[_0x8f94('0x5c')]({'model':db[_0x8f94('0x61')],'as':_0x8f94('0x61'),'raw':!![]});}var _0x543e42=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x8f94('0x36'),'createdAt','direction','secret',_0x8f94('0x62')],'include':_0x446380}];_0x543e42[_0x8f94('0x5c')]({'model':db[_0x8f94('0x63')],'as':_0x8f94('0x64'),'attributes':['id',_0x8f94('0x1f')]});_0x543e42[_0x8f94('0x5c')]({'model':db[_0x8f94('0x5d')],'as':_0x8f94('0x65'),'attributes':['id','fullname']});return db[_0x8f94('0x21')]['find']({'where':{'id':_0xbdce83[_0x8f94('0x2b')]['id']},'include':_0x543e42})['then'](handleEntityNotFound(_0x33a3d7,null))['then'](function(_0x243df0){if(_0x243df0){var _0x491c0c=_0x243df0[_0x8f94('0x66')]({'plain':!![]});fs[_0x8f94('0x67')](_0xa958fc);var _0x1b910a={'channel':_0x8f94('0x68'),'account':_0x491c0c[_0x8f94('0x64')][_0x8f94('0x1f')],'agent':_0x491c0c['Owner']?_0x491c0c['Owner'][_0x8f94('0x69')]:_0x8f94('0x6a'),'createdAt':moment(_0x491c0c[_0x8f94('0x6b')])[_0x8f94('0x5a')](_0x8f94('0x6c'))['toString'](),'closedAt':_0x491c0c[_0x8f94('0x6d')]?moment(_0x491c0c[_0x8f94('0x6e')])[_0x8f94('0x5a')](_0x8f94('0x6c'))[_0x8f94('0x6f')]():'','disposition':_0x491c0c[_0x8f94('0x70')],'messages':_(_0x491c0c[_0x8f94('0x71')])[_0x8f94('0x47')]({'secret':![]})['map'](function(_0x1faf01){if(_0x1faf01[_0x8f94('0x61')]){var _0x900eff=path[_0x8f94('0x56')](_0x41086a,_0x1faf01[_0x8f94('0x61')][_0x8f94('0x72')]);if(fs[_0x8f94('0x73')](_0x900eff)){fs[_0x8f94('0x74')](_0x900eff)[_0x8f94('0x75')](fs[_0x8f94('0x76')](path[_0x8f94('0x56')](_0xa958fc,_0x1faf01[_0x8f94('0x61')]['basename'])));}}return{'date':moment(_0x1faf01[_0x8f94('0x6b')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x8f94('0x6f')](),'sender':_0x1faf01[_0x8f94('0x77')]===_0x8f94('0x78')?_0x1faf01[_0x8f94('0x5d')]?_0x1faf01['User'][_0x8f94('0x69')]:'System':_0x1faf01['Contact'][_0x8f94('0x60')]+(_0x1faf01['Contact']['lastName']?'\x20'+_0x1faf01['Contact'][_0x8f94('0x79')]:''),'body':_0x1faf01['Attachment']?_0x1faf01[_0x8f94('0x61')][_0x8f94('0x72')]:_0x1faf01[_0x8f94('0x36')],'direction':_0x1faf01['direction']===_0x8f94('0x78')?'A':'C','secret':_0x1faf01[_0x8f94('0x7a')],'read':_0x1faf01[_0x8f94('0x62')],'attachment':_0x1faf01['Attachment']};})[_0x8f94('0x7b')]()};return ejs[_0x8f94('0x7c')](path[_0x8f94('0x56')](config['root'],_0x8f94('0x58'),_0x8f94('0x7d'),_0x8f94('0x7e')),{'interaction':_0x1b910a})['then'](function(_0x366ecb){var _0x543dc3=path[_0x8f94('0x56')](_0xa958fc,_0x8f94('0x7f')+_0x491c0c['id']+'-'+_0x4dbf89+_0x8f94('0x80'));var _0x5173e9={'path':_0x543dc3,'channel':_0x8f94('0x68'),'interactionId':_0x491c0c['id']};return pdf[_0x8f94('0x81')](_0x366ecb,_0x5173e9);})['then'](function(){return new BPromise(function(_0x425b42,_0x512cb1){zipdir(_0xa958fc,{'saveTo':_0x4d4e35},function(_0x37bb7c,_0x21508a){if(_0x37bb7c)return _0x512cb1(_0x37bb7c);return _0x425b42(_0x21508a);});})[_0x8f94('0x1d')](function(){return new BPromise(function(_0x1551f5,_0x577f08){rimraf(_0xa958fc,function(_0x20ed37){if(_0x20ed37)_0x577f08(_0x20ed37);return _0x1551f5();});});})['then'](function(){return _0x33a3d7[_0x8f94('0x52')](_0x4d4e35,_0x2f9545,function(_0x159466){if(_0x159466){console[_0x8f94('0x82')](_0x8f94('0x83'),_0x159466);}else{fs[_0x8f94('0x84')](_0x4d4e35);}});});});}else{return _0x33a3d7[_0x8f94('0x12')](0xc8);}})[_0x8f94('0x29')](handleError(_0x33a3d7,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 2662364..56e6d6d 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 _0x2d58=['map','findAll','length','emit','catch','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','update','remove','then','setDataValue','Users'];(function(_0x412d74,_0x2dd2b7){var _0x561a3b=function(_0x2efff8){while(--_0x2efff8){_0x412d74['push'](_0x412d74['shift']());}};_0x561a3b(++_0x2dd2b7);}(_0x2d58,0x186));var _0x82d5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2d58[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x82d5('0x0'));var WhatsappInteraction=require(_0x82d5('0x1'))['db'][_0x82d5('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x82d5('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x82d5('0x4'),'afterUpdate':_0x82d5('0x5'),'afterDestroy':_0x82d5('0x6')};function emitEvent(_0x763bbb){return function(_0x37830c,_0x9bc77d,_0xbdd54){_0x37830c['getUsers']({'attributes':['id'],'raw':!![]})[_0x82d5('0x7')](function(_0x2f5257){_0x37830c[_0x82d5('0x8')](_0x82d5('0x9'),_0x2f5257[_0x82d5('0xa')](function(_0x1442e3){return{'id':_0x1442e3['id']};}));return WhatsappMessage[_0x82d5('0xb')]({'where':{'WhatsappInteractionId':_0x37830c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x82d5('0x7')](function(_0x5080e){_0x37830c[_0x82d5('0x8')]('unreadMessages',_0x5080e[_0x82d5('0xc')]);WhatsappInteractionEvents[_0x82d5('0xd')](_0x763bbb+':'+_0x37830c['id'],_0x37830c);WhatsappInteractionEvents[_0x82d5('0xd')](_0x763bbb,_0x37830c);_0xbdd54(null);})[_0x82d5('0xe')](_0xbdd54(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x82d5('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x4345=['events','../../mysqldb','WhatsappMessage','setMaxListeners','save','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports'];(function(_0x2f6f50,_0x1d21a7){var _0x2cf365=function(_0x1c40a7){while(--_0x1c40a7){_0x2f6f50['push'](_0x2f6f50['shift']());}};_0x2cf365(++_0x1d21a7);}(_0x4345,0x77));var _0x5434=function(_0x29265a,_0xad36c0){_0x29265a=_0x29265a-0x0;var _0x525c40=_0x4345[_0x29265a];return _0x525c40;};'use strict';var EventEmitter=require(_0x5434('0x0'));var WhatsappInteraction=require(_0x5434('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x5434('0x1'))['db'][_0x5434('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5434('0x3')](0x0);var events={'afterCreate':_0x5434('0x4'),'afterUpdate':'update','afterDestroy':_0x5434('0x5')};function emitEvent(_0x4e402c){return function(_0x40827b,_0xb8a725,_0x14d339){_0x40827b['getUsers']({'attributes':['id'],'raw':!![]})[_0x5434('0x6')](function(_0x524e9e){_0x40827b[_0x5434('0x7')](_0x5434('0x8'),_0x524e9e[_0x5434('0x9')](function(_0x279c49){return{'id':_0x279c49['id']};}));return WhatsappMessage[_0x5434('0xa')]({'where':{'WhatsappInteractionId':_0x40827b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5434('0x6')](function(_0x417e1e){_0x40827b[_0x5434('0x7')](_0x5434('0xb'),_0x417e1e[_0x5434('0xc')]);WhatsappInteractionEvents[_0x5434('0xd')](_0x4e402c+':'+_0x40827b['id'],_0x40827b);WhatsappInteractionEvents[_0x5434('0xd')](_0x4e402c,_0x40827b);_0x14d339(null);})[_0x5434('0xe')](_0x14d339(null));};}for(var e in events){if(events[_0x5434('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x5434('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 4a1377a..20c381e 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 _0x0a2e=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','WhatsappInteraction','whatsapp_interactions','changed'];(function(_0x43dd47,_0x486eee){var _0x44f31a=function(_0x78c02d){while(--_0x78c02d){_0x43dd47['push'](_0x43dd47['shift']());}};_0x44f31a(++_0x486eee);}(_0x0a2e,0xe1));var _0xe0a2=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0x0a2e[_0x559a80];return _0x42f555;};'use strict';var _=require(_0xe0a2('0x0'));var util=require(_0xe0a2('0x1'));var logger=require(_0xe0a2('0x2'))(_0xe0a2('0x3'));var moment=require('moment');var BPromise=require(_0xe0a2('0x4'));var rp=require(_0xe0a2('0x5'));var fs=require('fs');var path=require(_0xe0a2('0x6'));var rimraf=require(_0xe0a2('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0xe0a2('0x8')]=function(_0x3b41ed,_0x29bf09){return _0x3b41ed[_0xe0a2('0x9')](_0xe0a2('0xa'),attributes,{'tableName':_0xe0a2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x55662d,_0x2f459e,_0x1a9e69){if(_0x55662d[_0xe0a2('0xc')](_0xe0a2('0xd'))){_0x55662d[_0xe0a2('0xe')]=moment()[_0xe0a2('0xf')](_0xe0a2('0x10'));}_0x1a9e69(null,_0x55662d);}}});}; \ No newline at end of file +var _0xfd48=['define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x43296d,_0x48a589){var _0x42514b=function(_0x4d5e92){while(--_0x4d5e92){_0x43296d['push'](_0x43296d['shift']());}};_0x42514b(++_0x48a589);}(_0xfd48,0xe7));var _0x8fd4=function(_0x395a3c,_0x1d4a66){_0x395a3c=_0x395a3c-0x0;var _0xccc2de=_0xfd48[_0x395a3c];return _0xccc2de;};'use strict';var _=require(_0x8fd4('0x0'));var util=require(_0x8fd4('0x1'));var logger=require(_0x8fd4('0x2'))(_0x8fd4('0x3'));var moment=require(_0x8fd4('0x4'));var BPromise=require('bluebird');var rp=require(_0x8fd4('0x5'));var fs=require('fs');var path=require(_0x8fd4('0x6'));var rimraf=require('rimraf');var config=require(_0x8fd4('0x7'));var attributes=require('./whatsappInteraction.attributes');module[_0x8fd4('0x8')]=function(_0x2fa3ce,_0x330b44){return _0x2fa3ce[_0x8fd4('0x9')](_0x8fd4('0xa'),attributes,{'tableName':_0x8fd4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5deb89,_0x465bf6,_0x6e0209){if(_0x5deb89[_0x8fd4('0xc')]('closed')){_0x5deb89[_0x8fd4('0xd')]=moment()[_0x8fd4('0xe')](_0x8fd4('0xf'));}_0x6e0209(null,_0x5deb89);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index e729530..83d6e34 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 _0x0b7f=['attributes','AddTagsToWhatsappInteraction','find','ids','AddTags','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','code','error','WhatsappInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where'];(function(_0x50e0b4,_0x1057f7){var _0x2fa8b0=function(_0x3766bc){while(--_0x3766bc){_0x50e0b4['push'](_0x50e0b4['shift']());}};_0x2fa8b0(++_0x1057f7);}(_0x0b7f,0x1f2));var _0xf0b7=function(_0x1d13c8,_0x1554e6){_0x1d13c8=_0x1d13c8-0x0;var _0x3a3b03=_0x0b7f[_0x1d13c8];return _0x3a3b03;};'use strict';var _=require(_0xf0b7('0x0'));var util=require(_0xf0b7('0x1'));var moment=require('moment');var BPromise=require(_0xf0b7('0x2'));var rs=require(_0xf0b7('0x3'));var fs=require('fs');var Redis=require(_0xf0b7('0x4'));var db=require(_0xf0b7('0x5'))['db'];var utils=require(_0xf0b7('0x6'));var logger=require(_0xf0b7('0x7'))(_0xf0b7('0x8'));var config=require(_0xf0b7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0b7('0xa')]['http']({'port':0x232a});config[_0xf0b7('0xb')]=_['defaults'](config[_0xf0b7('0xb')],{'host':_0xf0b7('0xc'),'port':0x18eb});var socket=require(_0xf0b7('0xd'))(new Redis(config[_0xf0b7('0xb')]));require(_0xf0b7('0xe'))[_0xf0b7('0xf')](socket);function respondWithRpcPromise(_0x5667b3,_0x2ac73b,_0x401a45){return new BPromise(function(_0x1fe907,_0x5b3100){return client[_0xf0b7('0x10')](_0x5667b3,_0x401a45)[_0xf0b7('0x11')](function(_0x57ef03){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x2ac73b,_0xf0b7('0x12'));logger[_0xf0b7('0x13')](_0xf0b7('0x14'),_0x2ac73b,_0xf0b7('0x12'),JSON['stringify'](_0x57ef03));if(_0x57ef03['error']){if(_0x57ef03['error'][_0xf0b7('0x15')]===0x1f4){logger[_0xf0b7('0x16')](_0xf0b7('0x17'),_0x2ac73b,_0x57ef03[_0xf0b7('0x16')][_0xf0b7('0x18')]);return _0x5b3100(_0x57ef03[_0xf0b7('0x16')][_0xf0b7('0x18')]);}logger[_0xf0b7('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x2ac73b,_0x57ef03[_0xf0b7('0x16')][_0xf0b7('0x18')]);return _0x1fe907(_0x57ef03[_0xf0b7('0x16')][_0xf0b7('0x18')]);}else{logger[_0xf0b7('0x19')](_0xf0b7('0x17'),_0x2ac73b,_0xf0b7('0x12'));_0x1fe907(_0x57ef03[_0xf0b7('0x1a')][_0xf0b7('0x18')]);}})[_0xf0b7('0x1b')](function(_0x1ed735){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x2ac73b,_0x1ed735);_0x5b3100(_0x1ed735);});});}exports[_0xf0b7('0x1c')]=function(_0x1c8a1f){var _0x2f0a00=this;return new Promise(function(_0x314fec,_0x81ee36){return db[_0xf0b7('0x1d')][_0xf0b7('0x1e')](_0x1c8a1f[_0xf0b7('0x1f')],{'raw':_0x1c8a1f[_0xf0b7('0x20')]?_0x1c8a1f[_0xf0b7('0x20')][_0xf0b7('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c8a1f['options']?_0x1c8a1f[_0xf0b7('0x20')][_0xf0b7('0x22')]||null:null,'attributes':_0x1c8a1f[_0xf0b7('0x20')]?_0x1c8a1f[_0xf0b7('0x20')][_0xf0b7('0x23')]||null:null,'limit':_0x1c8a1f['options']?_0x1c8a1f[_0xf0b7('0x20')]['limit']||null:null})[_0xf0b7('0x11')](function(_0x1137b1){logger[_0xf0b7('0x19')]('UpdateWhatsappInteraction',_0x1c8a1f);logger[_0xf0b7('0x13')]('UpdateWhatsappInteraction',_0x1c8a1f,JSON['stringify'](_0x1137b1));_0x314fec(_0x1137b1);})[_0xf0b7('0x1b')](function(_0x8884e8){logger[_0xf0b7('0x16')]('UpdateWhatsappInteraction',_0x8884e8[_0xf0b7('0x18')],_0x1c8a1f);_0x81ee36(_0x2f0a00[_0xf0b7('0x16')](0x1f4,_0x8884e8['message']));});});};exports[_0xf0b7('0x24')]=function(_0x52cb6f){return new Promise(function(_0x70e8f0,_0x36b904){return db[_0xf0b7('0x1d')][_0xf0b7('0x25')]({'where':_0x52cb6f['options']?_0x52cb6f[_0xf0b7('0x20')][_0xf0b7('0x22')]||null:null})[_0xf0b7('0x11')](function(_0x3625ca){if(_0x3625ca){return _0x3625ca['addTags'](_0x52cb6f['body'][_0xf0b7('0x26')],_['omit'](_0x52cb6f[_0xf0b7('0x1f')],[_0xf0b7('0x26'),'id'])||{});}})['spread'](function(_0x4edcf7){logger['info']('AddTags',_0x52cb6f);logger['debug'](_0xf0b7('0x27'),_0x52cb6f,JSON[_0xf0b7('0x28')](_0x4edcf7));_0x70e8f0(_0x4edcf7);})[_0xf0b7('0x1b')](function(_0x2d4f01){logger[_0xf0b7('0x16')](_0xf0b7('0x27'),_0x2d4f01[_0xf0b7('0x18')],_0x52cb6f);_0x36b904(_this[_0xf0b7('0x16')](0x1f4,_0x2d4f01['message']));});});}; \ No newline at end of file +var _0x4626=['stringify','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit'];(function(_0xd97d95,_0x1db35c){var _0x1da91a=function(_0x183e7b){while(--_0x183e7b){_0xd97d95['push'](_0xd97d95['shift']());}};_0x1da91a(++_0x1db35c);}(_0x4626,0x166));var _0x6462=function(_0x54d96e,_0x5455d6){_0x54d96e=_0x54d96e-0x0;var _0x3b5a55=_0x4626[_0x54d96e];return _0x3b5a55;};'use strict';var _=require(_0x6462('0x0'));var util=require(_0x6462('0x1'));var moment=require(_0x6462('0x2'));var BPromise=require(_0x6462('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6462('0x4'))['db'];var utils=require(_0x6462('0x5'));var logger=require(_0x6462('0x6'))(_0x6462('0x7'));var config=require(_0x6462('0x8'));var jayson=require(_0x6462('0x9'));var client=jayson[_0x6462('0xa')][_0x6462('0xb')]({'port':0x232a});config[_0x6462('0xc')]=_[_0x6462('0xd')](config[_0x6462('0xc')],{'host':_0x6462('0xe'),'port':0x18eb});var socket=require(_0x6462('0xf'))(new Redis(config[_0x6462('0xc')]));require(_0x6462('0x10'))[_0x6462('0x11')](socket);function respondWithRpcPromise(_0x56da08,_0x3a80b2,_0x5e5048){return new BPromise(function(_0x22315b,_0x273f59){return client[_0x6462('0x12')](_0x56da08,_0x5e5048)[_0x6462('0x13')](function(_0x5300a5){logger[_0x6462('0x14')](_0x6462('0x15'),_0x3a80b2,_0x6462('0x16'));logger[_0x6462('0x17')](_0x6462('0x18'),_0x3a80b2,_0x6462('0x16'),JSON['stringify'](_0x5300a5));if(_0x5300a5['error']){if(_0x5300a5[_0x6462('0x19')]['code']===0x1f4){logger[_0x6462('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x3a80b2,_0x5300a5['error'][_0x6462('0x1a')]);return _0x273f59(_0x5300a5['error'][_0x6462('0x1a')]);}logger[_0x6462('0x19')](_0x6462('0x15'),_0x3a80b2,_0x5300a5[_0x6462('0x19')][_0x6462('0x1a')]);return _0x22315b(_0x5300a5[_0x6462('0x19')]['message']);}else{logger[_0x6462('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x3a80b2,_0x6462('0x16'));_0x22315b(_0x5300a5[_0x6462('0x1b')]['message']);}})[_0x6462('0x1c')](function(_0x2c223f){logger['error'](_0x6462('0x15'),_0x3a80b2,_0x2c223f);_0x273f59(_0x2c223f);});});}exports[_0x6462('0x1d')]=function(_0xfbfc4c){var _0x222185=this;return new Promise(function(_0xcfff51,_0x27b06e){return db[_0x6462('0x1e')][_0x6462('0x1f')](_0xfbfc4c[_0x6462('0x20')],{'raw':_0xfbfc4c[_0x6462('0x21')]?_0xfbfc4c['options'][_0x6462('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfbfc4c[_0x6462('0x21')]?_0xfbfc4c[_0x6462('0x21')][_0x6462('0x23')]||null:null,'attributes':_0xfbfc4c[_0x6462('0x21')]?_0xfbfc4c[_0x6462('0x21')][_0x6462('0x24')]||null:null,'limit':_0xfbfc4c[_0x6462('0x21')]?_0xfbfc4c[_0x6462('0x21')][_0x6462('0x25')]||null:null})[_0x6462('0x13')](function(_0x346d9b){logger[_0x6462('0x14')]('UpdateWhatsappInteraction',_0xfbfc4c);logger[_0x6462('0x17')]('UpdateWhatsappInteraction',_0xfbfc4c,JSON[_0x6462('0x26')](_0x346d9b));_0xcfff51(_0x346d9b);})['catch'](function(_0x3d10f5){logger['error']('UpdateWhatsappInteraction',_0x3d10f5[_0x6462('0x1a')],_0xfbfc4c);_0x27b06e(_0x222185[_0x6462('0x19')](0x1f4,_0x3d10f5['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3ebb90){return new Promise(function(_0xbc736d,_0x351b1e){return db[_0x6462('0x1e')][_0x6462('0x27')]({'where':_0x3ebb90['options']?_0x3ebb90[_0x6462('0x21')][_0x6462('0x23')]||null:null})[_0x6462('0x13')](function(_0x5b2639){if(_0x5b2639){return _0x5b2639[_0x6462('0x28')](_0x3ebb90[_0x6462('0x20')][_0x6462('0x29')],_['omit'](_0x3ebb90[_0x6462('0x20')],[_0x6462('0x29'),'id'])||{});}})[_0x6462('0x2a')](function(_0x523403){logger[_0x6462('0x14')](_0x6462('0x2b'),_0x3ebb90);logger[_0x6462('0x17')](_0x6462('0x2b'),_0x3ebb90,JSON[_0x6462('0x26')](_0x523403));_0xbc736d(_0x523403);})[_0x6462('0x1c')](function(_0x4a914e){logger[_0x6462('0x19')](_0x6462('0x2b'),_0x4a914e[_0x6462('0x1a')],_0x3ebb90);_0x351b1e(_this['error'](0x1f4,_0x4a914e[_0x6462('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 4d19dd4..6aa1f57 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 _0xd536=['emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd536,0x1bd));var _0x6d53=function(_0x412d2d,_0x5f2f4f){_0x412d2d=_0x412d2d-0x0;var _0x40dac2=_0xd536[_0x412d2d];return _0x40dac2;};'use strict';var WhatsappInteractionEvents=require(_0x6d53('0x0'));var events=['save',_0x6d53('0x1'),_0x6d53('0x2')];function createListener(_0x261002,_0x27f702){return function(_0x160bf7){_0x27f702[_0x6d53('0x3')](_0x261002,_0x160bf7);};}function removeListener(_0x553086,_0x51b202){return function(){WhatsappInteractionEvents[_0x6d53('0x4')](_0x553086,_0x51b202);};}exports[_0x6d53('0x5')]=function(_0x1b0ac7){for(var _0x243605=0x0,_0x438986=events[_0x6d53('0x6')];_0x243605<_0x438986;_0x243605++){var _0x20e51d=events[_0x243605];var _0x2ad507=createListener(_0x6d53('0x7')+_0x20e51d,_0x1b0ac7);WhatsappInteractionEvents['on'](_0x20e51d,_0x2ad507);}}; \ No newline at end of file +var _0xf80f=['./whatsappInteraction.events','save','remove','emit','removeListener','register','whatsappInteraction:'];(function(_0xde008c,_0x4825d8){var _0x21b2b9=function(_0x32d94c){while(--_0x32d94c){_0xde008c['push'](_0xde008c['shift']());}};_0x21b2b9(++_0x4825d8);}(_0xf80f,0x85));var _0xff80=function(_0x482647,_0x2c5a5f){_0x482647=_0x482647-0x0;var _0x111cd0=_0xf80f[_0x482647];return _0x111cd0;};'use strict';var WhatsappInteractionEvents=require(_0xff80('0x0'));var events=[_0xff80('0x1'),_0xff80('0x2'),'update'];function createListener(_0x5abccd,_0x430462){return function(_0x24b5db){_0x430462[_0xff80('0x3')](_0x5abccd,_0x24b5db);};}function removeListener(_0x1c3e9d,_0x14e7ed){return function(){WhatsappInteractionEvents[_0xff80('0x4')](_0x1c3e9d,_0x14e7ed);};}exports[_0xff80('0x5')]=function(_0x3d8025){for(var _0x2eb949=0x0,_0x3cfe11=events['length'];_0x2eb949<_0x3cfe11;_0x2eb949++){var _0x2c0424=events[_0x2eb949];var _0x13e102=createListener(_0xff80('0x6')+_0x2c0424,_0x3d8025);WhatsappInteractionEvents['on'](_0x2c0424,_0x13e102);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index c21a538..e069365 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 _0xd4a0=['/:id/status','status','update','put','/:id/accept','accept','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id','tracked','whatsappmessage:create'];(function(_0x150af0,_0x2f189a){var _0x2c7bd1=function(_0x500869){while(--_0x500869){_0x150af0['push'](_0x150af0['shift']());}};_0x2c7bd1(++_0x2f189a);}(_0xd4a0,0x1e4));var _0x0d4a=function(_0xd19deb,_0x3bbf97){_0xd19deb=_0xd19deb-0x0;var _0x6e6dd9=_0xd4a0[_0xd19deb];return _0x6e6dd9;};'use strict';var multer=require(_0x0d4a('0x0'));var util=require(_0x0d4a('0x1'));var path=require(_0x0d4a('0x2'));var timeout=require(_0x0d4a('0x3'));var express=require(_0x0d4a('0x4'));var router=express[_0x0d4a('0x5')]();var fs_extra=require(_0x0d4a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0d4a('0x7'));var config=require('../../config/environment');var controller=require(_0x0d4a('0x8'));router[_0x0d4a('0x9')]('/',auth[_0x0d4a('0xa')](),controller['index']);router['get'](_0x0d4a('0xb'),auth[_0x0d4a('0xa')](),controller[_0x0d4a('0xc')]);router[_0x0d4a('0x9')](_0x0d4a('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0x0d4a('0xe')]('whatsapp',_0x0d4a('0xf')),controller['create']);router['post'](_0x0d4a('0x10'),controller[_0x0d4a('0x11')]);router['put'](_0x0d4a('0xd'),auth['isAuthenticated'](),controller[_0x0d4a('0x12')]);router[_0x0d4a('0x13')](_0x0d4a('0x14'),auth['isAuthenticated'](),controller[_0x0d4a('0x15')]);router[_0x0d4a('0x13')]('/:id/reject',auth[_0x0d4a('0xa')](),controller[_0x0d4a('0x16')]);router[_0x0d4a('0x17')]('/:id',auth[_0x0d4a('0xa')](),controller[_0x0d4a('0x18')]);module['exports']=router; \ No newline at end of file +var _0xb86c=['whatsapp','whatsappmessage:create','/:id/status','status','put','/:id/reject','reject','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0xb86c,0x1b8));var _0xcb86=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xb86c[_0x42245d];return _0x4b211a;};'use strict';var multer=require(_0xcb86('0x0'));var util=require(_0xcb86('0x1'));var path=require(_0xcb86('0x2'));var timeout=require(_0xcb86('0x3'));var express=require(_0xcb86('0x4'));var router=express[_0xcb86('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcb86('0x6'));var interaction=require(_0xcb86('0x7'));var config=require(_0xcb86('0x8'));var controller=require(_0xcb86('0x9'));router[_0xcb86('0xa')]('/',auth['isAuthenticated'](),controller[_0xcb86('0xb')]);router[_0xcb86('0xa')](_0xcb86('0xc'),auth[_0xcb86('0xd')](),controller[_0xcb86('0xe')]);router[_0xcb86('0xa')](_0xcb86('0xf'),auth[_0xcb86('0xd')](),controller[_0xcb86('0x10')]);router[_0xcb86('0x11')]('/',auth[_0xcb86('0xd')](),interaction[_0xcb86('0x12')](_0xcb86('0x13'),_0xcb86('0x14')),controller['create']);router['post'](_0xcb86('0x15'),controller[_0xcb86('0x16')]);router[_0xcb86('0x17')](_0xcb86('0xf'),auth[_0xcb86('0xd')](),controller['update']);router['put']('/:id/accept',auth[_0xcb86('0xd')](),controller['accept']);router[_0xcb86('0x17')](_0xcb86('0x18'),auth[_0xcb86('0xd')](),controller[_0xcb86('0x19')]);router['delete'](_0xcb86('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xcb86('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index c395b6c..6866d39 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 _0x043a=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x5c115f,_0x19157d){var _0x8a8580=function(_0x51f627){while(--_0x51f627){_0x5c115f['push'](_0x5c115f['shift']());}};_0x8a8580(++_0x19157d);}(_0x043a,0x1e4));var _0xa043=function(_0x35f0e2,_0x57e0c4){_0x35f0e2=_0x35f0e2-0x0;var _0x412011=_0x043a[_0x35f0e2];return _0x412011;};'use strict';var Sequelize=require(_0xa043('0x0'));module[_0xa043('0x1')]={'body':{'type':Sequelize[_0xa043('0x2')](_0xa043('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa043('0x4')]('in',_0xa043('0x5')),'defaultValue':_0xa043('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa043('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xa043('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa043('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf8b2=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x4fda8e,_0x25d739){var _0xbbe12b=function(_0x4137f2){while(--_0x4137f2){_0x4fda8e['push'](_0x4fda8e['shift']());}};_0xbbe12b(++_0x25d739);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x45de10,_0x59f7f9){_0x45de10=_0x45de10-0x0;var _0x3c4712=_0xf8b2[_0x45de10];return _0x3c4712;};'use strict';var Sequelize=require(_0x2f8b('0x0'));module[_0x2f8b('0x1')]={'body':{'type':Sequelize[_0x2f8b('0x2')](_0x2f8b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2f8b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2f8b('0x5')]('in',_0x2f8b('0x6')),'defaultValue':_0x2f8b('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x2f8b('0x7')]},'secret':{'type':Sequelize[_0x2f8b('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2f8b('0x8')]},'providerResponse':{'type':Sequelize[_0x2f8b('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 1294207..5726366 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 _0xbd7a=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','map','WhatsappMessage','rawAttributes','type','keys','query','filters','attributes','intersection','model','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','options','find','create','body','params','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','SIP/%s','channel','EventManager','acceptmessage','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SELECT','interface','motionChannel','event','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','json'];(function(_0x3cb367,_0xbf1235){var _0x3c6502=function(_0x47385f){while(--_0x47385f){_0x3cb367['push'](_0x3cb367['shift']());}};_0x3c6502(++_0xbf1235);}(_0xbd7a,0x182));var _0xabd7=function(_0x5c2829,_0x2e1482){_0x5c2829=_0x5c2829-0x0;var _0x4d6544=_0xbd7a[_0x5c2829];return _0x4d6544;};'use strict';var emlformat=require(_0xabd7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xabd7('0x1'));var moment=require(_0xabd7('0x2'));var BPromise=require(_0xabd7('0x3'));var Mustache=require(_0xabd7('0x4'));var util=require(_0xabd7('0x5'));var path=require(_0xabd7('0x6'));var sox=require(_0xabd7('0x7'));var csv=require(_0xabd7('0x8'));var ejs=require(_0xabd7('0x9'));var fs=require('fs');var fs_extra=require(_0xabd7('0xa'));var _=require(_0xabd7('0xb'));var squel=require(_0xabd7('0xc'));var crypto=require(_0xabd7('0xd'));var jsforce=require(_0xabd7('0xe'));var deskjs=require(_0xabd7('0xf'));var toCsv=require(_0xabd7('0x8'));var querystring=require('querystring');var Papa=require(_0xabd7('0x10'));var Redis=require(_0xabd7('0x11'));var authService=require(_0xabd7('0x12'));var qs=require(_0xabd7('0x13'));var as=require(_0xabd7('0x14'));var hardwareService=require(_0xabd7('0x15'));var logger=require('../../config/logger')(_0xabd7('0x16'));var utils=require(_0xabd7('0x17'));var config=require(_0xabd7('0x18'));var licenseUtil=require(_0xabd7('0x19'));var db=require(_0xabd7('0x1a'))['db'];config['redis']=_[_0xabd7('0x1b')](config[_0xabd7('0x1c')],{'host':_0xabd7('0x1d'),'port':0x18eb});var socket=require(_0xabd7('0x1e'))(new Redis(config[_0xabd7('0x1c')]));require(_0xabd7('0x1f'))[_0xabd7('0x20')](socket);var jayson=require(_0xabd7('0x21'));var client=jayson['client'][_0xabd7('0x22')]({'port':0x232c});var client9002=jayson[_0xabd7('0x23')][_0xabd7('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2a36db,_0x279d31,_0x2275ca,_0x57e2a4){return new BPromise(function(_0x130bdc,_0x485397){var _0x51df60=_0x57e2a4||client;return _0x51df60[_0xabd7('0x24')](_0x2a36db,_0x2275ca)[_0xabd7('0x25')](function(_0x1b3e50){logger['info'](_0xabd7('0x26'),_0x279d31,_0xabd7('0x27'));logger[_0xabd7('0x28')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x279d31,_0xabd7('0x27'),JSON[_0xabd7('0x29')](_0x1b3e50));if(_0x1b3e50[_0xabd7('0x2a')]){if(_0x1b3e50[_0xabd7('0x2a')][_0xabd7('0x2b')]===0x1f4){logger['error'](_0xabd7('0x26'),_0x279d31,_0x1b3e50[_0xabd7('0x2a')][_0xabd7('0x2c')]);return _0x485397(_0x1b3e50[_0xabd7('0x2a')][_0xabd7('0x2c')]);}logger[_0xabd7('0x2a')](_0xabd7('0x26'),_0x279d31,_0x1b3e50[_0xabd7('0x2a')][_0xabd7('0x2c')]);return _0x130bdc(_0x1b3e50[_0xabd7('0x2a')][_0xabd7('0x2c')]);}else{logger[_0xabd7('0x2d')](_0xabd7('0x26'),_0x279d31,_0xabd7('0x27'));_0x130bdc(_0x1b3e50[_0xabd7('0x2e')][_0xabd7('0x2c')]);}})[_0xabd7('0x2f')](function(_0x2a5169){logger[_0xabd7('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x279d31,_0x2a5169);_0x485397(_0x2a5169);});});}function respondWithStatusCode(_0x2d6bcc,_0x234261){_0x234261=_0x234261||0xcc;return function(_0x59891c){if(_0x59891c){return _0x2d6bcc[_0xabd7('0x30')](_0x234261);}return _0x2d6bcc[_0xabd7('0x31')](_0x234261)[_0xabd7('0x32')]();};}function respondWithResult(_0x23b4b3,_0xce1941){_0xce1941=_0xce1941||0xc8;return function(_0x1e2e81){if(_0x1e2e81){return _0x23b4b3[_0xabd7('0x31')](_0xce1941)[_0xabd7('0x33')](_0x1e2e81);}};}function respondWithFilteredResult(_0x321928,_0x1e92d1){return function(_0x360596){if(_0x360596){var _0x534d98=typeof _0x1e92d1[_0xabd7('0x34')]===_0xabd7('0x35')&&typeof _0x1e92d1[_0xabd7('0x36')]===_0xabd7('0x35');var _0x245d2c=_0x360596['count'];var _0x5d67d3=_0x534d98?0x0:_0x1e92d1[_0xabd7('0x34')];var _0x201319=_0x534d98?_0x360596[_0xabd7('0x37')]:_0x1e92d1[_0xabd7('0x34')]+_0x1e92d1[_0xabd7('0x36')];var _0x2e9396;if(_0x201319>=_0x245d2c){_0x201319=_0x245d2c;_0x2e9396=0xc8;}else{_0x2e9396=0xce;}_0x321928[_0xabd7('0x31')](_0x2e9396);return _0x321928[_0xabd7('0x38')](_0xabd7('0x39'),_0x5d67d3+'-'+_0x201319+'/'+_0x245d2c)[_0xabd7('0x33')](_0x360596);}return null;};}function patchUpdates(_0x2d6310){return function(_0x3e9cca){try{jsonpatch[_0xabd7('0x3a')](_0x3e9cca,_0x2d6310,!![]);}catch(_0x4c1a67){return BPromise[_0xabd7('0x3b')](_0x4c1a67);}return _0x3e9cca[_0xabd7('0x3c')]();};}function saveUpdates(_0x5d538f,_0x188a73){return function(_0xe69454){if(_0xe69454){return _0xe69454[_0xabd7('0x3d')](_0x5d538f)[_0xabd7('0x25')](function(_0x183430){return _0x183430;});}return null;};}function removeEntity(_0x1e528b,_0x232214){return function(_0x377863){if(_0x377863){return _0x377863[_0xabd7('0x3e')]()[_0xabd7('0x25')](function(){_0x1e528b[_0xabd7('0x31')](0xcc)[_0xabd7('0x32')]();});}};}function handleEntityNotFound(_0x2ca450,_0x54d587){return function(_0x20161f){if(!_0x20161f){_0x2ca450[_0xabd7('0x30')](0x194);}return _0x20161f;};}function handleError(_0x21f23e,_0x42647d){_0x42647d=_0x42647d||0x1f4;return function(_0x15647e){logger[_0xabd7('0x2a')](_0x15647e[_0xabd7('0x3f')]);if(_0x15647e[_0xabd7('0x40')]){delete _0x15647e[_0xabd7('0x40')];}_0x21f23e[_0xabd7('0x31')](_0x42647d)['send'](_0x15647e);};}exports['index']=function(_0x5926d2,_0x451e61){var _0x1cd573={},_0x45c26a={},_0xe6e609={'count':0x0,'rows':[]};var _0x156bd6=_[_0xabd7('0x41')](db[_0xabd7('0x42')][_0xabd7('0x43')],function(_0x43181c){return{'name':_0x43181c['fieldName'],'type':_0x43181c[_0xabd7('0x44')]['key']};});_0x45c26a['model']=_['map'](_0x156bd6,'name');_0x45c26a['query']=_[_0xabd7('0x45')](_0x5926d2[_0xabd7('0x46')]);_0x45c26a[_0xabd7('0x47')]=_['intersection'](_0x45c26a['model'],_0x45c26a['query']);_0x1cd573[_0xabd7('0x48')]=_[_0xabd7('0x49')](_0x45c26a[_0xabd7('0x4a')],qs[_0xabd7('0x4b')](_0x5926d2[_0xabd7('0x46')][_0xabd7('0x4b')]));_0x1cd573['attributes']=_0x1cd573[_0xabd7('0x48')][_0xabd7('0x4c')]?_0x1cd573[_0xabd7('0x48')]:_0x45c26a[_0xabd7('0x4a')];if(!_0x5926d2[_0xabd7('0x46')]['hasOwnProperty'](_0xabd7('0x4d'))){_0x1cd573[_0xabd7('0x36')]=qs[_0xabd7('0x36')](_0x5926d2[_0xabd7('0x46')]['limit']);_0x1cd573[_0xabd7('0x34')]=qs['offset'](_0x5926d2[_0xabd7('0x46')][_0xabd7('0x34')]);}_0x1cd573[_0xabd7('0x4e')]=qs['sort'](_0x5926d2[_0xabd7('0x46')][_0xabd7('0x4f')]);_0x1cd573[_0xabd7('0x50')]=qs[_0xabd7('0x47')](_[_0xabd7('0x51')](_0x5926d2['query'],_0x45c26a[_0xabd7('0x47')]),_0x156bd6);if(_0x5926d2[_0xabd7('0x46')]['filter']){_0x1cd573[_0xabd7('0x50')]=_[_0xabd7('0x52')](_0x1cd573['where'],{'$or':_['map'](_0x156bd6,function(_0x164cca){if(_0x164cca[_0xabd7('0x44')]!==_0xabd7('0x53')){var _0x9397e1={};_0x9397e1[_0x164cca[_0xabd7('0x40')]]={'$like':'%'+_0x5926d2[_0xabd7('0x46')][_0xabd7('0x54')]+'%'};return _0x9397e1;}})});}_0x1cd573=_['merge']({},_0x1cd573,_0x5926d2['options']);var _0x3086e5={'where':_0x1cd573['where']};return db['WhatsappMessage']['count'](_0x3086e5)[_0xabd7('0x25')](function(_0x4bfcdb){_0xe6e609[_0xabd7('0x37')]=_0x4bfcdb;if(_0x5926d2[_0xabd7('0x46')][_0xabd7('0x55')]){_0x1cd573[_0xabd7('0x56')]=[{'all':!![]}];}return db[_0xabd7('0x42')][_0xabd7('0x57')](_0x1cd573);})['then'](function(_0x277fe7){_0xe6e609[_0xabd7('0x58')]=_0x277fe7;return _0xe6e609;})[_0xabd7('0x25')](respondWithFilteredResult(_0x451e61,_0x1cd573))[_0xabd7('0x2f')](handleError(_0x451e61,null));};exports[_0xabd7('0x59')]=function(_0x29ac6e,_0x204fc1){var _0x34a877={'raw':!![],'where':{'id':_0x29ac6e['params']['id']}},_0x5b6338={};_0x5b6338['model']=_[_0xabd7('0x45')](db[_0xabd7('0x42')][_0xabd7('0x43')]);_0x5b6338[_0xabd7('0x46')]=_[_0xabd7('0x45')](_0x29ac6e[_0xabd7('0x46')]);_0x5b6338[_0xabd7('0x47')]=_[_0xabd7('0x49')](_0x5b6338['model'],_0x5b6338['query']);_0x34a877['attributes']=_['intersection'](_0x5b6338[_0xabd7('0x4a')],qs['fields'](_0x29ac6e['query'][_0xabd7('0x4b')]));_0x34a877[_0xabd7('0x48')]=_0x34a877['attributes']['length']?_0x34a877[_0xabd7('0x48')]:_0x5b6338['model'];if(_0x29ac6e[_0xabd7('0x46')][_0xabd7('0x55')]){_0x34a877[_0xabd7('0x56')]=[{'all':!![]}];}_0x34a877=_['merge']({},_0x34a877,_0x29ac6e[_0xabd7('0x5a')]);return db[_0xabd7('0x42')][_0xabd7('0x5b')](_0x34a877)[_0xabd7('0x25')](handleEntityNotFound(_0x204fc1,null))[_0xabd7('0x25')](respondWithResult(_0x204fc1,null))['catch'](handleError(_0x204fc1,null));};exports[_0xabd7('0x5c')]=function(_0x5a4c1e,_0x437ad6){return db['WhatsappMessage'][_0xabd7('0x5c')](_0x5a4c1e['body'],{})['then'](respondWithResult(_0x437ad6,0xc9))['catch'](handleError(_0x437ad6,null));};exports[_0xabd7('0x3d')]=function(_0x4383d7,_0x4a4bb7){if(_0x4383d7[_0xabd7('0x5d')]['id']){delete _0x4383d7[_0xabd7('0x5d')]['id'];}return db[_0xabd7('0x42')][_0xabd7('0x5b')]({'where':{'id':_0x4383d7['params']['id']}})[_0xabd7('0x25')](handleEntityNotFound(_0x4a4bb7,null))[_0xabd7('0x25')](saveUpdates(_0x4383d7[_0xabd7('0x5d')],null))['then'](respondWithResult(_0x4a4bb7,null))[_0xabd7('0x2f')](handleError(_0x4a4bb7,null));};exports['destroy']=function(_0x343757,_0xeccb57){return db[_0xabd7('0x42')]['find']({'where':{'id':_0x343757[_0xabd7('0x5e')]['id']}})[_0xabd7('0x25')](handleEntityNotFound(_0xeccb57,null))['then'](removeEntity(_0xeccb57,null))[_0xabd7('0x2f')](handleError(_0xeccb57,null));};exports[_0xabd7('0x5f')]=function(_0x3a4347,_0x5f2ab7){return db[_0xabd7('0x42')]['describe']()[_0xabd7('0x25')](respondWithResult(_0x5f2ab7,null))['catch'](handleError(_0x5f2ab7,null));};var interaction_log=require(_0xabd7('0x60'))(_0xabd7('0x61'));exports[_0xabd7('0x62')]=function(_0x49eff7,_0x230c3b,_0x4bee45){var _0x15221c={'agent':{},'channel':_0xabd7('0x63')};if(_0x49eff7['body']['id']){delete _0x49eff7['body']['id'];}_0x49eff7['body'][_0xabd7('0x64')]=!![];_0x49eff7['body'][_0xabd7('0x65')]=moment()[_0xabd7('0x66')]('YYYY-MM-DD\x20HH:mm:ss');_0x49eff7[_0xabd7('0x5d')][_0xabd7('0x67')]=_0x49eff7['body']['UserId']||_0x49eff7[_0xabd7('0x68')]['id'];_0x15221c[_0xabd7('0x69')]['id']=_0x49eff7['body'][_0xabd7('0x67')];return db[_0xabd7('0x42')][_0xabd7('0x5b')]({'where':{'id':_0x49eff7[_0xabd7('0x5e')]['id'],'UserId':null}})[_0xabd7('0x25')](handleEntityNotFound(_0x230c3b,null))[_0xabd7('0x25')](saveUpdates(_0x49eff7['body'],null))['then'](function(_0x8d9874){if(_0x8d9874){_0x15221c['message']=_0x8d9874[_0xabd7('0x6a')]({'plain':!![]});return db[_0xabd7('0x6b')][_0xabd7('0x5b')]({'where':{'id':_0x8d9874['WhatsappInteractionId']}});}return null;})[_0xabd7('0x25')](handleEntityNotFound(_0x230c3b,null))[_0xabd7('0x25')](function(_0xabda71){if(_0xabda71){return _0xabda71[_0xabd7('0x3d')]({'UserId':_0x49eff7[_0xabd7('0x5d')][_0xabd7('0x67')],'read1stAt':_[_0xabd7('0x6c')](_0xabda71[_0xabd7('0x6d')])?moment()[_0xabd7('0x66')](_0xabd7('0x6e')):undefined});}return null;})[_0xabd7('0x25')](function(_0xe5a5c0){if(_0xe5a5c0){_0x15221c[_0xabd7('0x6f')]=_0xe5a5c0[_0xabd7('0x6a')]({'plain':!![]});interaction_log[_0xabd7('0x2d')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x49eff7[_0xabd7('0x68')]['id'],_0x49eff7[_0xabd7('0x68')][_0xabd7('0x40')],_0x49eff7['user']['role'],_0x15221c[_0xabd7('0x6f')]['id'],_0x49eff7[_0xabd7('0x5d')]?JSON[_0xabd7('0x29')](_0x49eff7['body']):_0xabd7('0x70'));return respondWithRpcPromise(_0xabd7('0x71'),_0xabd7('0x72'),_0x15221c);}return null;})[_0xabd7('0x25')](function(_0x3513d1){var _0x4b826d=_0xabd7('0x73')+_0x3513d1[_0xabd7('0x2c')][_0xabd7('0x74')];return db[_0xabd7('0x75')][_0xabd7('0x46')](_0x4b826d,{'type':db[_0xabd7('0x76')][_0xabd7('0x77')]['SELECT'],'raw':!![]})[_0xabd7('0x25')](function(_0x57e079){return _0x57e079;});})[_0xabd7('0x25')](function(_0x32c51c){if(_0x32c51c){_0x15221c['message'][_0xabd7('0x78')]=_0x32c51c[0x0];if(!_0x49eff7[_0xabd7('0x5d')]['UserId'])return;return db[_0xabd7('0x79')]['find']({'where':{'id':_0x49eff7['body'][_0xabd7('0x67')],'role':_0xabd7('0x69')},'attributes':['id',_0xabd7('0x40'),_0xabd7('0x7a'),_0xabd7('0x7b'),_0xabd7('0x7c')],'raw':!![]});}return null;})[_0xabd7('0x25')](function(_0x3041ea){if(!_0x3041ea)return null;_0x15221c['message'][_0xabd7('0x69')]=_0x3041ea;return _0x15221c;})[_0xabd7('0x25')](function(_0x212381){if(_0x212381){if(_0x49eff7[_0xabd7('0x5d')][_0xabd7('0x7d')]){_0x15221c['message']['interface']=util[_0xabd7('0x66')](_0xabd7('0x7e'),_0x49eff7[_0xabd7('0x68')]['name']);_0x15221c['message'][_0xabd7('0x7f')]=_0x15221c['channel'];_0x15221c[_0xabd7('0x2c')]['motionChannel']=_0x15221c['channel'];_0x15221c[_0xabd7('0x2c')]['event']='accept';return respondWithRpcPromise(_0xabd7('0x80'),_0xabd7('0x80'),{'event':_0xabd7('0x81'),'message':_0x15221c[_0xabd7('0x2c')]},client9002)[_0xabd7('0x25')](function(){return _0x15221c;});}return _0x15221c;}return null;})[_0xabd7('0x25')](respondWithResult(_0x230c3b,null))[_0xabd7('0x2f')](handleError(_0x230c3b,null));};var interaction_log=require(_0xabd7('0x60'))('whatsapp-interactions');exports[_0xabd7('0x3b')]=function(_0x11b8cf,_0x1910db,_0x2d8969){var _0x13e8ad={'agent':{},'channel':'whatsapp'};if(_0x11b8cf[_0xabd7('0x5d')]['id']){delete _0x11b8cf[_0xabd7('0x5d')]['id'];}_0x11b8cf[_0xabd7('0x5d')][_0xabd7('0x67')]=_0x11b8cf[_0xabd7('0x5d')][_0xabd7('0x67')]||_0x11b8cf['user']['id'];_0x13e8ad[_0xabd7('0x69')]['id']=_0x11b8cf[_0xabd7('0x5d')][_0xabd7('0x67')];return db[_0xabd7('0x42')]['find']({'where':{'id':_0x11b8cf[_0xabd7('0x5e')]['id'],'UserId':null}})[_0xabd7('0x25')](handleEntityNotFound(_0x1910db,null))[_0xabd7('0x25')](function(_0x979c14){if(_0x979c14){_0x13e8ad[_0xabd7('0x2c')]=_0x979c14[_0xabd7('0x6a')]({'plain':!![]});return db[_0xabd7('0x6b')][_0xabd7('0x5b')]({'where':{'id':_0x979c14[_0xabd7('0x82')]}});}return null;})[_0xabd7('0x25')](handleEntityNotFound(_0x1910db,null))[_0xabd7('0x25')](function(_0x34d7e9){if(_0x34d7e9){_0x13e8ad['interaction']=_0x34d7e9[_0xabd7('0x6a')]({'plain':!![]});interaction_log[_0xabd7('0x2d')](_0xabd7('0x83'),_0x11b8cf['user']['id'],_0x11b8cf[_0xabd7('0x68')][_0xabd7('0x40')],_0x11b8cf[_0xabd7('0x68')]['role'],_0x13e8ad[_0xabd7('0x6f')]['id'],_0x11b8cf[_0xabd7('0x5d')]?JSON['stringify'](_0x11b8cf[_0xabd7('0x5d')]):_0xabd7('0x70'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x13e8ad);}return null;})[_0xabd7('0x25')](function(_0x4803ab){var _0x28fa99=_0xabd7('0x73')+_0x4803ab['message']['ContactId'];return db[_0xabd7('0x75')][_0xabd7('0x46')](_0x28fa99,{'type':db[_0xabd7('0x76')][_0xabd7('0x77')][_0xabd7('0x84')],'raw':!![]})[_0xabd7('0x25')](function(_0x144c4f){return _0x144c4f;});})[_0xabd7('0x25')](function(_0x220724){if(_0x220724){_0x13e8ad[_0xabd7('0x2c')][_0xabd7('0x78')]=_0x220724[0x0];if(!_0x11b8cf[_0xabd7('0x5d')][_0xabd7('0x67')])return;return db[_0xabd7('0x79')][_0xabd7('0x5b')]({'where':{'id':_0x11b8cf[_0xabd7('0x5d')][_0xabd7('0x67')],'role':_0xabd7('0x69')},'attributes':['id',_0xabd7('0x40'),_0xabd7('0x7a'),_0xabd7('0x7b'),_0xabd7('0x7c')],'raw':!![]});}return null;})[_0xabd7('0x25')](function(_0x2193d7){if(!_0x2193d7)return null;_0x13e8ad['message'][_0xabd7('0x69')]=_0x2193d7;return _0x13e8ad;})[_0xabd7('0x25')](function(_0x124d12){if(_0x124d12){_0x124d12['message'][_0xabd7('0x85')]=util[_0xabd7('0x66')]('SIP/%s',_0x11b8cf[_0xabd7('0x68')][_0xabd7('0x40')]);_0x124d12['message'][_0xabd7('0x7f')]=_0x13e8ad['channel'];_0x124d12[_0xabd7('0x2c')][_0xabd7('0x86')]=_0x13e8ad[_0xabd7('0x7f')];_0x124d12['message'][_0xabd7('0x87')]=_0xabd7('0x3b');respondWithRpcPromise('EventManager',_0xabd7('0x80'),{'event':_0xabd7('0x88'),'message':_0x124d12[_0xabd7('0x2c')]},client9002);return _0x13e8ad;}return null;})[_0xabd7('0x25')](respondWithResult(_0x1910db,null))['catch'](handleError(_0x1910db,null));};exports[_0xabd7('0x31')]=function(_0x5e41fb,_0x3d963b,_0x5e92ae){if(_0x5e41fb['body']['id']){delete _0x5e41fb[_0xabd7('0x5d')]['id'];}var _0x38ab5b;return db[_0xabd7('0x42')][_0xabd7('0x5b')]({'where':{'id':_0x5e41fb['params']['id']}})[_0xabd7('0x25')](handleEntityNotFound(_0x3d963b,null))[_0xabd7('0x25')](function(_0x4a08f9){if(_0x4a08f9){_0x38ab5b=_0x4a08f9;return db[_0xabd7('0x89')]['find']({'where':{'id':_0x4a08f9['WhatsappAccountId']}});}})[_0xabd7('0x25')](handleEntityNotFound(_0x3d963b,null))[_0xabd7('0x25')](function(_0x51b0e4){if(_0x51b0e4){logger['debug'](_0xabd7('0x8a'),_0xabd7('0x31'),_0xabd7('0x8b'),_0x51b0e4[_0xabd7('0x44')],util[_0xabd7('0x8c')](_0x5e41fb[_0xabd7('0x5d')],{'showHidden':![],'depth':null}));switch(_0x51b0e4[_0xabd7('0x44')]){case'twilio':if(_0x5e41fb[_0xabd7('0x5d')][_0xabd7('0x8d')]&&_0x5e41fb['body'][_0xabd7('0x8d')]===_0x38ab5b[_0xabd7('0x8e')]&&_0x5e41fb[_0xabd7('0x5d')][_0xabd7('0x8f')]&&_0x5e41fb['body'][_0xabd7('0x8f')]===_0xabd7('0x64')){return _0x38ab5b[_0xabd7('0x3d')]({'read':!![]});}else{logger['error'](_0xabd7('0x90'),_0xabd7('0x31'),_0xabd7('0x91'),util[_0xabd7('0x8c')](_0x5e41fb[_0xabd7('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x38ab5b;}})[_0xabd7('0x25')](respondWithResult(_0x3d963b,null))['catch'](handleError(_0x3d963b,null));}; \ No newline at end of file +var _0x3e20=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','stack','name','send','index','map','WhatsappMessage','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','create','body','find','destroy','describe','readAt','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','event','accept','EventManager','acceptmessage','whatsapp-interactions','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','User','motionChannel','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format'];(function(_0x2b9e0b,_0x4bdee5){var _0x1d6fd8=function(_0x416b96){while(--_0x416b96){_0x2b9e0b['push'](_0x2b9e0b['shift']());}};_0x1d6fd8(++_0x4bdee5);}(_0x3e20,0x115));var _0x03e2=function(_0x1a1378,_0x423a79){_0x1a1378=_0x1a1378-0x0;var _0x407882=_0x3e20[_0x1a1378];return _0x407882;};'use strict';var emlformat=require(_0x03e2('0x0'));var rimraf=require(_0x03e2('0x1'));var zipdir=require(_0x03e2('0x2'));var jsonpatch=require(_0x03e2('0x3'));var rp=require(_0x03e2('0x4'));var moment=require('moment');var BPromise=require(_0x03e2('0x5'));var Mustache=require('mustache');var util=require(_0x03e2('0x6'));var path=require('path');var sox=require(_0x03e2('0x7'));var csv=require(_0x03e2('0x8'));var ejs=require(_0x03e2('0x9'));var fs=require('fs');var fs_extra=require(_0x03e2('0xa'));var _=require('lodash');var squel=require(_0x03e2('0xb'));var crypto=require(_0x03e2('0xc'));var jsforce=require(_0x03e2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x03e2('0x8'));var querystring=require(_0x03e2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x03e2('0xf'));var qs=require(_0x03e2('0x10'));var as=require(_0x03e2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x03e2('0x12'))(_0x03e2('0x13'));var utils=require(_0x03e2('0x14'));var config=require(_0x03e2('0x15'));var licenseUtil=require(_0x03e2('0x16'));var db=require(_0x03e2('0x17'))['db'];config[_0x03e2('0x18')]=_[_0x03e2('0x19')](config[_0x03e2('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x03e2('0x1a'))(new Redis(config['redis']));require(_0x03e2('0x1b'))['register'](socket);var jayson=require(_0x03e2('0x1c'));var client=jayson[_0x03e2('0x1d')][_0x03e2('0x1e')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x120eab,_0x890194,_0x1a5fc9,_0xbf8d6){return new BPromise(function(_0x1635bd,_0x42d478){var _0x278580=_0xbf8d6||client;return _0x278580[_0x03e2('0x1f')](_0x120eab,_0x1a5fc9)['then'](function(_0x365f8e){logger[_0x03e2('0x20')](_0x03e2('0x21'),_0x890194,'request\x20sent');logger[_0x03e2('0x22')](_0x03e2('0x23'),_0x890194,'request\x20sent',JSON[_0x03e2('0x24')](_0x365f8e));if(_0x365f8e[_0x03e2('0x25')]){if(_0x365f8e[_0x03e2('0x25')][_0x03e2('0x26')]===0x1f4){logger['error'](_0x03e2('0x21'),_0x890194,_0x365f8e['error'][_0x03e2('0x27')]);return _0x42d478(_0x365f8e[_0x03e2('0x25')][_0x03e2('0x27')]);}logger[_0x03e2('0x25')](_0x03e2('0x21'),_0x890194,_0x365f8e[_0x03e2('0x25')][_0x03e2('0x27')]);return _0x1635bd(_0x365f8e['error']['message']);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x890194,_0x03e2('0x28'));_0x1635bd(_0x365f8e[_0x03e2('0x29')][_0x03e2('0x27')]);}})[_0x03e2('0x2a')](function(_0x2bd95c){logger[_0x03e2('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x890194,_0x2bd95c);_0x42d478(_0x2bd95c);});});}function respondWithStatusCode(_0x22cb56,_0x1dd6f7){_0x1dd6f7=_0x1dd6f7||0xcc;return function(_0x425622){if(_0x425622){return _0x22cb56[_0x03e2('0x2b')](_0x1dd6f7);}return _0x22cb56[_0x03e2('0x2c')](_0x1dd6f7)[_0x03e2('0x2d')]();};}function respondWithResult(_0x582637,_0x4fc58b){_0x4fc58b=_0x4fc58b||0xc8;return function(_0x3f861f){if(_0x3f861f){return _0x582637['status'](_0x4fc58b)[_0x03e2('0x2e')](_0x3f861f);}};}function respondWithFilteredResult(_0x5c0d53,_0x3b16af){return function(_0x252717){if(_0x252717){var _0x690c67=typeof _0x3b16af[_0x03e2('0x2f')]===_0x03e2('0x30')&&typeof _0x3b16af[_0x03e2('0x31')]===_0x03e2('0x30');var _0x5a4b4c=_0x252717[_0x03e2('0x32')];var _0x2fd1a4=_0x690c67?0x0:_0x3b16af[_0x03e2('0x2f')];var _0xf24509=_0x690c67?_0x252717[_0x03e2('0x32')]:_0x3b16af[_0x03e2('0x2f')]+_0x3b16af[_0x03e2('0x31')];var _0x1799c2;if(_0xf24509>=_0x5a4b4c){_0xf24509=_0x5a4b4c;_0x1799c2=0xc8;}else{_0x1799c2=0xce;}_0x5c0d53[_0x03e2('0x2c')](_0x1799c2);return _0x5c0d53['set'](_0x03e2('0x33'),_0x2fd1a4+'-'+_0xf24509+'/'+_0x5a4b4c)[_0x03e2('0x2e')](_0x252717);}return null;};}function patchUpdates(_0x293f1d){return function(_0x260fce){try{jsonpatch[_0x03e2('0x34')](_0x260fce,_0x293f1d,!![]);}catch(_0x46a185){return BPromise['reject'](_0x46a185);}return _0x260fce[_0x03e2('0x35')]();};}function saveUpdates(_0x10ed99,_0x3dcefd){return function(_0x9d7281){if(_0x9d7281){return _0x9d7281[_0x03e2('0x36')](_0x10ed99)[_0x03e2('0x37')](function(_0x52366b){return _0x52366b;});}return null;};}function removeEntity(_0x5ed45e,_0x444273){return function(_0x2ac945){if(_0x2ac945){return _0x2ac945['destroy']()[_0x03e2('0x37')](function(){_0x5ed45e[_0x03e2('0x2c')](0xcc)[_0x03e2('0x2d')]();});}};}function handleEntityNotFound(_0x54fc85,_0x4e8e0a){return function(_0x3c6224){if(!_0x3c6224){_0x54fc85[_0x03e2('0x2b')](0x194);}return _0x3c6224;};}function handleError(_0x118a55,_0x30c9a1){_0x30c9a1=_0x30c9a1||0x1f4;return function(_0x312afd){logger[_0x03e2('0x25')](_0x312afd[_0x03e2('0x38')]);if(_0x312afd[_0x03e2('0x39')]){delete _0x312afd[_0x03e2('0x39')];}_0x118a55[_0x03e2('0x2c')](_0x30c9a1)[_0x03e2('0x3a')](_0x312afd);};}exports[_0x03e2('0x3b')]=function(_0x289b3b,_0x3e8535){var _0x4051fb={},_0x4e1d4d={},_0x2ed2c5={'count':0x0,'rows':[]};var _0x1efb42=_[_0x03e2('0x3c')](db[_0x03e2('0x3d')]['rawAttributes'],function(_0x38bcc1){return{'name':_0x38bcc1[_0x03e2('0x3e')],'type':_0x38bcc1['type'][_0x03e2('0x3f')]};});_0x4e1d4d[_0x03e2('0x40')]=_['map'](_0x1efb42,_0x03e2('0x39'));_0x4e1d4d[_0x03e2('0x41')]=_[_0x03e2('0x42')](_0x289b3b['query']);_0x4e1d4d[_0x03e2('0x43')]=_['intersection'](_0x4e1d4d['model'],_0x4e1d4d[_0x03e2('0x41')]);_0x4051fb[_0x03e2('0x44')]=_[_0x03e2('0x45')](_0x4e1d4d[_0x03e2('0x40')],qs[_0x03e2('0x46')](_0x289b3b[_0x03e2('0x41')][_0x03e2('0x46')]));_0x4051fb[_0x03e2('0x44')]=_0x4051fb[_0x03e2('0x44')][_0x03e2('0x47')]?_0x4051fb['attributes']:_0x4e1d4d[_0x03e2('0x40')];if(!_0x289b3b[_0x03e2('0x41')]['hasOwnProperty'](_0x03e2('0x48'))){_0x4051fb['limit']=qs[_0x03e2('0x31')](_0x289b3b[_0x03e2('0x41')][_0x03e2('0x31')]);_0x4051fb['offset']=qs[_0x03e2('0x2f')](_0x289b3b[_0x03e2('0x41')]['offset']);}_0x4051fb['order']=qs['sort'](_0x289b3b[_0x03e2('0x41')][_0x03e2('0x49')]);_0x4051fb[_0x03e2('0x4a')]=qs[_0x03e2('0x43')](_[_0x03e2('0x4b')](_0x289b3b[_0x03e2('0x41')],_0x4e1d4d[_0x03e2('0x43')]),_0x1efb42);if(_0x289b3b[_0x03e2('0x41')][_0x03e2('0x4c')]){_0x4051fb[_0x03e2('0x4a')]=_[_0x03e2('0x4d')](_0x4051fb[_0x03e2('0x4a')],{'$or':_[_0x03e2('0x3c')](_0x1efb42,function(_0x5da943){if(_0x5da943[_0x03e2('0x4e')]!==_0x03e2('0x4f')){var _0x59c67f={};_0x59c67f[_0x5da943[_0x03e2('0x39')]]={'$like':'%'+_0x289b3b[_0x03e2('0x41')]['filter']+'%'};return _0x59c67f;}})});}_0x4051fb=_[_0x03e2('0x4d')]({},_0x4051fb,_0x289b3b[_0x03e2('0x50')]);var _0xce012={'where':_0x4051fb[_0x03e2('0x4a')]};return db[_0x03e2('0x3d')][_0x03e2('0x32')](_0xce012)['then'](function(_0x307a7c){_0x2ed2c5[_0x03e2('0x32')]=_0x307a7c;if(_0x289b3b[_0x03e2('0x41')][_0x03e2('0x51')]){_0x4051fb[_0x03e2('0x52')]=[{'all':!![]}];}return db[_0x03e2('0x3d')][_0x03e2('0x53')](_0x4051fb);})[_0x03e2('0x37')](function(_0x1ac546){_0x2ed2c5['rows']=_0x1ac546;return _0x2ed2c5;})['then'](respondWithFilteredResult(_0x3e8535,_0x4051fb))[_0x03e2('0x2a')](handleError(_0x3e8535,null));};exports[_0x03e2('0x54')]=function(_0x43ae3d,_0x13172f){var _0x5924c5={'raw':!![],'where':{'id':_0x43ae3d[_0x03e2('0x55')]['id']}},_0x290d83={};_0x290d83['model']=_[_0x03e2('0x42')](db[_0x03e2('0x3d')][_0x03e2('0x56')]);_0x290d83[_0x03e2('0x41')]=_[_0x03e2('0x42')](_0x43ae3d[_0x03e2('0x41')]);_0x290d83[_0x03e2('0x43')]=_[_0x03e2('0x45')](_0x290d83[_0x03e2('0x40')],_0x290d83['query']);_0x5924c5[_0x03e2('0x44')]=_[_0x03e2('0x45')](_0x290d83[_0x03e2('0x40')],qs[_0x03e2('0x46')](_0x43ae3d[_0x03e2('0x41')][_0x03e2('0x46')]));_0x5924c5[_0x03e2('0x44')]=_0x5924c5[_0x03e2('0x44')]['length']?_0x5924c5[_0x03e2('0x44')]:_0x290d83['model'];if(_0x43ae3d['query']['includeAll']){_0x5924c5['include']=[{'all':!![]}];}_0x5924c5=_[_0x03e2('0x4d')]({},_0x5924c5,_0x43ae3d[_0x03e2('0x50')]);return db['WhatsappMessage']['find'](_0x5924c5)[_0x03e2('0x37')](handleEntityNotFound(_0x13172f,null))[_0x03e2('0x37')](respondWithResult(_0x13172f,null))[_0x03e2('0x2a')](handleError(_0x13172f,null));};exports['create']=function(_0x1c69f5,_0x4fdb7e){return db[_0x03e2('0x3d')][_0x03e2('0x57')](_0x1c69f5[_0x03e2('0x58')],{})[_0x03e2('0x37')](respondWithResult(_0x4fdb7e,0xc9))['catch'](handleError(_0x4fdb7e,null));};exports['update']=function(_0x11b6f2,_0x1e2946){if(_0x11b6f2[_0x03e2('0x58')]['id']){delete _0x11b6f2['body']['id'];}return db['WhatsappMessage'][_0x03e2('0x59')]({'where':{'id':_0x11b6f2[_0x03e2('0x55')]['id']}})[_0x03e2('0x37')](handleEntityNotFound(_0x1e2946,null))[_0x03e2('0x37')](saveUpdates(_0x11b6f2[_0x03e2('0x58')],null))[_0x03e2('0x37')](respondWithResult(_0x1e2946,null))[_0x03e2('0x2a')](handleError(_0x1e2946,null));};exports[_0x03e2('0x5a')]=function(_0xbea49a,_0x37e7f7){return db[_0x03e2('0x3d')][_0x03e2('0x59')]({'where':{'id':_0xbea49a[_0x03e2('0x55')]['id']}})['then'](handleEntityNotFound(_0x37e7f7,null))['then'](removeEntity(_0x37e7f7,null))[_0x03e2('0x2a')](handleError(_0x37e7f7,null));};exports[_0x03e2('0x5b')]=function(_0x110932,_0x149c19){return db[_0x03e2('0x3d')][_0x03e2('0x5b')]()[_0x03e2('0x37')](respondWithResult(_0x149c19,null))['catch'](handleError(_0x149c19,null));};var interaction_log=require(_0x03e2('0x12'))('whatsapp-interactions');exports['accept']=function(_0x442961,_0x3edb98,_0x5adccb){var _0xe0fc1e={'agent':{},'channel':'whatsapp'};if(_0x442961['body']['id']){delete _0x442961[_0x03e2('0x58')]['id'];}_0x442961[_0x03e2('0x58')]['read']=!![];_0x442961[_0x03e2('0x58')][_0x03e2('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x442961[_0x03e2('0x58')][_0x03e2('0x5d')]=_0x442961[_0x03e2('0x58')][_0x03e2('0x5d')]||_0x442961[_0x03e2('0x5e')]['id'];_0xe0fc1e[_0x03e2('0x5f')]['id']=_0x442961[_0x03e2('0x58')][_0x03e2('0x5d')];return db[_0x03e2('0x3d')][_0x03e2('0x59')]({'where':{'id':_0x442961[_0x03e2('0x55')]['id'],'UserId':null}})[_0x03e2('0x37')](handleEntityNotFound(_0x3edb98,null))[_0x03e2('0x37')](saveUpdates(_0x442961['body'],null))[_0x03e2('0x37')](function(_0x15d2dd){if(_0x15d2dd){_0xe0fc1e['message']=_0x15d2dd[_0x03e2('0x60')]({'plain':!![]});return db[_0x03e2('0x61')][_0x03e2('0x59')]({'where':{'id':_0x15d2dd[_0x03e2('0x62')]}});}return null;})[_0x03e2('0x37')](handleEntityNotFound(_0x3edb98,null))[_0x03e2('0x37')](function(_0x3b9039){if(_0x3b9039){return _0x3b9039[_0x03e2('0x36')]({'UserId':_0x442961[_0x03e2('0x58')][_0x03e2('0x5d')],'read1stAt':_[_0x03e2('0x63')](_0x3b9039[_0x03e2('0x64')])?moment()[_0x03e2('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x03e2('0x37')](function(_0x42fd2a){if(_0x42fd2a){_0xe0fc1e[_0x03e2('0x66')]=_0x42fd2a[_0x03e2('0x60')]({'plain':!![]});interaction_log[_0x03e2('0x20')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x442961[_0x03e2('0x5e')]['id'],_0x442961[_0x03e2('0x5e')][_0x03e2('0x39')],_0x442961[_0x03e2('0x5e')][_0x03e2('0x67')],_0xe0fc1e['interaction']['id'],_0x442961[_0x03e2('0x58')]?JSON[_0x03e2('0x24')](_0x442961['body']):_0x03e2('0x68'));return respondWithRpcPromise(_0x03e2('0x69'),'acceptMessage',_0xe0fc1e);}return null;})[_0x03e2('0x37')](function(_0x4d3bed){var _0x2a61d9=_0x03e2('0x6a')+_0x4d3bed[_0x03e2('0x27')][_0x03e2('0x6b')];return db[_0x03e2('0x6c')]['query'](_0x2a61d9,{'type':db[_0x03e2('0x6d')][_0x03e2('0x6e')][_0x03e2('0x6f')],'raw':!![]})[_0x03e2('0x37')](function(_0xbc233b){return _0xbc233b;});})['then'](function(_0x24a543){if(_0x24a543){_0xe0fc1e[_0x03e2('0x27')][_0x03e2('0x70')]=_0x24a543[0x0];if(!_0x442961[_0x03e2('0x58')]['UserId'])return;return db['User'][_0x03e2('0x59')]({'where':{'id':_0x442961[_0x03e2('0x58')]['UserId'],'role':_0x03e2('0x5f')},'attributes':['id',_0x03e2('0x39'),_0x03e2('0x71'),_0x03e2('0x72'),_0x03e2('0x73')],'raw':!![]});}return null;})[_0x03e2('0x37')](function(_0xfe452b){if(!_0xfe452b)return null;_0xe0fc1e[_0x03e2('0x27')][_0x03e2('0x5f')]=_0xfe452b;return _0xe0fc1e;})[_0x03e2('0x37')](function(_0x5f2366){if(_0x5f2366){if(_0x442961[_0x03e2('0x58')][_0x03e2('0x74')]){_0xe0fc1e[_0x03e2('0x27')]['interface']=util[_0x03e2('0x65')](_0x03e2('0x75'),_0x442961['user'][_0x03e2('0x39')]);_0xe0fc1e[_0x03e2('0x27')][_0x03e2('0x76')]=_0xe0fc1e[_0x03e2('0x76')];_0xe0fc1e['message']['motionChannel']=_0xe0fc1e['channel'];_0xe0fc1e['message'][_0x03e2('0x77')]=_0x03e2('0x78');return respondWithRpcPromise(_0x03e2('0x79'),_0x03e2('0x79'),{'event':_0x03e2('0x7a'),'message':_0xe0fc1e[_0x03e2('0x27')]},client9002)[_0x03e2('0x37')](function(){return _0xe0fc1e;});}return _0xe0fc1e;}return null;})['then'](respondWithResult(_0x3edb98,null))[_0x03e2('0x2a')](handleError(_0x3edb98,null));};var interaction_log=require('../../config/logger')(_0x03e2('0x7b'));exports[_0x03e2('0x7c')]=function(_0x480f4d,_0x4cf6bc,_0x3b2a6a){var _0x49772f={'agent':{},'channel':'whatsapp'};if(_0x480f4d[_0x03e2('0x58')]['id']){delete _0x480f4d[_0x03e2('0x58')]['id'];}_0x480f4d[_0x03e2('0x58')]['UserId']=_0x480f4d['body'][_0x03e2('0x5d')]||_0x480f4d[_0x03e2('0x5e')]['id'];_0x49772f[_0x03e2('0x5f')]['id']=_0x480f4d[_0x03e2('0x58')][_0x03e2('0x5d')];return db[_0x03e2('0x3d')]['find']({'where':{'id':_0x480f4d[_0x03e2('0x55')]['id'],'UserId':null}})[_0x03e2('0x37')](handleEntityNotFound(_0x4cf6bc,null))['then'](function(_0x3ae1d8){if(_0x3ae1d8){_0x49772f[_0x03e2('0x27')]=_0x3ae1d8['get']({'plain':!![]});return db[_0x03e2('0x61')]['find']({'where':{'id':_0x3ae1d8['WhatsappInteractionId']}});}return null;})[_0x03e2('0x37')](handleEntityNotFound(_0x4cf6bc,null))[_0x03e2('0x37')](function(_0x2b12ae){if(_0x2b12ae){_0x49772f[_0x03e2('0x66')]=_0x2b12ae[_0x03e2('0x60')]({'plain':!![]});interaction_log[_0x03e2('0x20')](_0x03e2('0x7d'),_0x480f4d[_0x03e2('0x5e')]['id'],_0x480f4d['user'][_0x03e2('0x39')],_0x480f4d[_0x03e2('0x5e')][_0x03e2('0x67')],_0x49772f[_0x03e2('0x66')]['id'],_0x480f4d[_0x03e2('0x58')]?JSON['stringify'](_0x480f4d[_0x03e2('0x58')]):_0x03e2('0x68'));return respondWithRpcPromise(_0x03e2('0x7e'),'rejectMessage',_0x49772f);}return null;})['then'](function(_0x982d20){var _0x3c4862=_0x03e2('0x6a')+_0x982d20[_0x03e2('0x27')]['ContactId'];return db['sequelize'][_0x03e2('0x41')](_0x3c4862,{'type':db[_0x03e2('0x6d')][_0x03e2('0x6e')][_0x03e2('0x6f')],'raw':!![]})[_0x03e2('0x37')](function(_0x4fc48b){return _0x4fc48b;});})[_0x03e2('0x37')](function(_0x4a87d9){if(_0x4a87d9){_0x49772f[_0x03e2('0x27')]['contact']=_0x4a87d9[0x0];if(!_0x480f4d[_0x03e2('0x58')][_0x03e2('0x5d')])return;return db[_0x03e2('0x7f')][_0x03e2('0x59')]({'where':{'id':_0x480f4d[_0x03e2('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0x03e2('0x39'),_0x03e2('0x71'),_0x03e2('0x72'),'internal'],'raw':!![]});}return null;})[_0x03e2('0x37')](function(_0x57a5cc){if(!_0x57a5cc)return null;_0x49772f[_0x03e2('0x27')][_0x03e2('0x5f')]=_0x57a5cc;return _0x49772f;})[_0x03e2('0x37')](function(_0x5bfa8c){if(_0x5bfa8c){_0x5bfa8c['message']['interface']=util[_0x03e2('0x65')](_0x03e2('0x75'),_0x480f4d[_0x03e2('0x5e')]['name']);_0x5bfa8c['message'][_0x03e2('0x76')]=_0x49772f['channel'];_0x5bfa8c[_0x03e2('0x27')][_0x03e2('0x80')]=_0x49772f['channel'];_0x5bfa8c[_0x03e2('0x27')][_0x03e2('0x77')]=_0x03e2('0x7c');respondWithRpcPromise(_0x03e2('0x79'),_0x03e2('0x79'),{'event':_0x03e2('0x81'),'message':_0x5bfa8c['message']},client9002);return _0x49772f;}return null;})[_0x03e2('0x37')](respondWithResult(_0x4cf6bc,null))[_0x03e2('0x2a')](handleError(_0x4cf6bc,null));};exports[_0x03e2('0x2c')]=function(_0x570cd7,_0x4f0ccf,_0x58e3b2){if(_0x570cd7[_0x03e2('0x58')]['id']){delete _0x570cd7['body']['id'];}var _0x4d5aaa;return db[_0x03e2('0x3d')][_0x03e2('0x59')]({'where':{'id':_0x570cd7[_0x03e2('0x55')]['id']}})['then'](handleEntityNotFound(_0x4f0ccf,null))['then'](function(_0x2acfde){if(_0x2acfde){_0x4d5aaa=_0x2acfde;return db[_0x03e2('0x82')][_0x03e2('0x59')]({'where':{'id':_0x2acfde[_0x03e2('0x83')]}});}})[_0x03e2('0x37')](handleEntityNotFound(_0x4f0ccf,null))[_0x03e2('0x37')](function(_0x4da9de){if(_0x4da9de){logger[_0x03e2('0x22')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x03e2('0x2c'),_0x03e2('0x84'),_0x4da9de[_0x03e2('0x4e')],util[_0x03e2('0x85')](_0x570cd7[_0x03e2('0x58')],{'showHidden':![],'depth':null}));switch(_0x4da9de[_0x03e2('0x4e')]){case _0x03e2('0x86'):if(_0x570cd7[_0x03e2('0x58')][_0x03e2('0x87')]&&_0x570cd7[_0x03e2('0x58')][_0x03e2('0x87')]===_0x4d5aaa[_0x03e2('0x88')]&&_0x570cd7[_0x03e2('0x58')]['MessageStatus']&&_0x570cd7[_0x03e2('0x58')][_0x03e2('0x89')]==='read'){return _0x4d5aaa['update']({'read':!![]});}else{logger['error'](_0x03e2('0x8a'),'status',_0x03e2('0x86'),util[_0x03e2('0x85')](_0x570cd7[_0x03e2('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x4d5aaa;}})[_0x03e2('0x37')](respondWithResult(_0x4f0ccf,null))[_0x03e2('0x2a')](handleError(_0x4f0ccf,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 003b09f..883290c 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 _0xae60=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','save','update'];(function(_0x3e9881,_0x8bab1b){var _0x1ef096=function(_0x41826d){while(--_0x41826d){_0x3e9881['push'](_0x3e9881['shift']());}};_0x1ef096(++_0x8bab1b);}(_0xae60,0x1c7));var _0x0ae6=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xae60[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require(_0x0ae6('0x0'));var WhatsappMessage=require(_0x0ae6('0x1'))['db'][_0x0ae6('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0ae6('0x3'),'afterUpdate':_0x0ae6('0x4'),'afterDestroy':_0x0ae6('0x5')};function emitEvent(_0x568a7f){return function(_0x4c014f,_0x470e83,_0x47c9e0){WhatsappMessageEvents[_0x0ae6('0x6')](_0x568a7f+':'+_0x4c014f['id'],_0x4c014f);WhatsappMessageEvents[_0x0ae6('0x6')](_0x568a7f,_0x4c014f);_0x47c9e0(null);};}for(var e in events){if(events[_0x0ae6('0x7')](e)){var event=events[e];WhatsappMessage[_0x0ae6('0x8')](e,emitEvent(event));}}module[_0x0ae6('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0x693f=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','update'];(function(_0x27c7e0,_0x5f5bf7){var _0x57c7b7=function(_0x5ba2f2){while(--_0x5ba2f2){_0x27c7e0['push'](_0x27c7e0['shift']());}};_0x57c7b7(++_0x5f5bf7);}(_0x693f,0x9d));var _0xf693=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x693f[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xf693('0x0'));var WhatsappMessage=require(_0xf693('0x1'))['db'][_0xf693('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf693('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf693('0x4'),'afterDestroy':_0xf693('0x5')};function emitEvent(_0xe37cf3){return function(_0x1d272f,_0x3d2e05,_0x6e749b){WhatsappMessageEvents[_0xf693('0x6')](_0xe37cf3+':'+_0x1d272f['id'],_0x1d272f);WhatsappMessageEvents['emit'](_0xe37cf3,_0x1d272f);_0x6e749b(null);};}for(var e in events){if(events[_0xf693('0x7')](e)){var event=events[e];WhatsappMessage[_0xf693('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 52b5f60..5e10179 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 _0x85ac=['WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','sid','catch','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','toLowerCase','direction','secret','isNil'];(function(_0x1064bc,_0x206f12){var _0x5edc45=function(_0x5087bd){while(--_0x5087bd){_0x1064bc['push'](_0x1064bc['shift']());}};_0x5edc45(++_0x206f12);}(_0x85ac,0x1c4));var _0xc85a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x85ac[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0xc85a('0x0'));var util=require(_0xc85a('0x1'));var logger=require(_0xc85a('0x2'))(_0xc85a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc85a('0x4'));var fetch=require(_0xc85a('0x5'));var fs=require('fs');var path=require(_0xc85a('0x6'));var rimraf=require(_0xc85a('0x7'));var config=require('../../config/environment');var attributes=require(_0xc85a('0x8'));module['exports']=function(_0x443ead,_0x476d41){return _0x443ead[_0xc85a('0x9')](_0xc85a('0xa'),attributes,{'tableName':_0xc85a('0xb'),'paranoid':![],'indexes':[{'name':_0xc85a('0xc'),'fields':[_0xc85a('0xc')]},{'name':_0xc85a('0xd'),'fields':[_0xc85a('0xe')],'type':_0xc85a('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x205790,_0x3619b8,_0x5391fb){var _0x5396d8=_0x443ead['models'];var _0x765425=_0x205790['get']({'plain':!![]});if(_0x765425['direction'][_0xc85a('0x10')]()==='in'||_0x765425[_0xc85a('0x11')]['toLowerCase']()==='out'&&!_0x765425[_0xc85a('0x12')]&&!_[_0xc85a('0x13')](_0x765425['UserId'])){_0x5396d8[_0xc85a('0x14')][_0xc85a('0x15')]({'where':{'id':_0x765425[_0xc85a('0x16')]}})[_0xc85a('0x17')](function(_0x22b2e6){if(_0x22b2e6){_0x22b2e6[_0xc85a('0x18')]({'lastMsgAt':_0x765425[_0xc85a('0x19')],'lastMsgDirection':_0x765425[_0xc85a('0x11')]['toLowerCase']()});}})['catch'](function(_0x39f41b){console[_0xc85a('0x1a')](_0x39f41b);});}if(_0x765425[_0xc85a('0x11')]==='out'&&!_0x765425['secret']){var _0x3847ed;_0x5396d8[_0xc85a('0x1b')]['find']({'where':{'id':_0x765425[_0xc85a('0x1c')]},'raw':!![]})[_0xc85a('0x17')](function(_0x9cc671){_0x3847ed=_0x9cc671;if(_0x3847ed&&_0x3847ed[_0xc85a('0x1d')]){switch(_0x3847ed[_0xc85a('0x1d')]){case _0xc85a('0x1e'):var _0xace4ed=require(_0xc85a('0x1e'));if(_0x3847ed[_0xc85a('0x1f')]&&_0x3847ed[_0xc85a('0x20')]&&_0x3847ed[_0xc85a('0x21')]){var _0x59a7f3=new _0xace4ed(_0x3847ed[_0xc85a('0x1f')],_0x3847ed['authToken']);_0x59a7f3[_0xc85a('0x22')][_0xc85a('0x23')]({'body':_0x765425['body'],'to':_0xc85a('0x24')+_0x765425[_0xc85a('0x21')],'from':_0xc85a('0x24')+_0x3847ed[_0xc85a('0x21')],'statusCallback':_0x3847ed['remote']+_0xc85a('0x25')+_0x765425['id']+_0xc85a('0x26')+_0x3847ed['token']})['then'](function(_0x5b36c7){if(_0x5b36c7[_0xc85a('0x27')]){return _0x205790[_0xc85a('0x18')]({'messageId':_0x5b36c7[_0xc85a('0x27')]});}})[_0xc85a('0x28')](function(_0x1af5ae){logger[_0xc85a('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xc85a('0x29'),_0xc85a('0x1e'),util[_0xc85a('0x2a')](_0x1af5ae,{'showHidden':![],'depth':null}));});}else{logger[_0xc85a('0x1a')](_0xc85a('0x2b'),'afterCreate',_0xc85a('0x1e'),_0xc85a('0x2c'));}break;case _0xc85a('0x2d'):var _0x58676d=_0x3847ed[_0xc85a('0x1f')];var _0xccb240=_0x3847ed[_0xc85a('0x20')];var _0x3878e2=_0x3847ed[_0xc85a('0x2e')]+_0xc85a('0x2f')+_0x58676d+_0xc85a('0x30');var _0x424695={'to':[_0x765425[_0xc85a('0x21')]],'message':{'type':_0xc85a('0x31'),'text':_0x765425[_0xc85a('0xe')]}};var _0xa43736={'method':_0xc85a('0x32'),'uri':_0x3878e2,'headers':{'Authorization':_0xc85a('0x33')+_0xccb240,'Content-Type':_0xc85a('0x34')},'body':_0x424695,'json':!![]};rp(_0xa43736)[_0xc85a('0x17')](function(_0x329f5a){if(_0x329f5a[_0xc85a('0x35')][0x0][_0xc85a('0x36')]){return _0x205790[_0xc85a('0x18')]({'messageId':_0x329f5a[_0xc85a('0x35')][0x0][_0xc85a('0x36')]});}})[_0xc85a('0x28')](function(_0x859b2f){logger[_0xc85a('0x37')]('WhatsappMessage,\x20%s',_0x859b2f);});break;}}})[_0xc85a('0x38')](function(){_0x5391fb();});}else{_0x5391fb();}}},'charset':_0xc85a('0x39'),'collate':_0xc85a('0x3a')});}; \ No newline at end of file +var _0xc3fc=['update','createdAt','catch','out','secret','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','WhatsappInteraction','findOne','then'];(function(_0x2baf6d,_0x297b4b){var _0x16d4de=function(_0x8b0a3){while(--_0x8b0a3){_0x2baf6d['push'](_0x2baf6d['shift']());}};_0x16d4de(++_0x297b4b);}(_0xc3fc,0x1cf));var _0xcc3f=function(_0x4ec919,_0x42191f){_0x4ec919=_0x4ec919-0x0;var _0x3f4c64=_0xc3fc[_0x4ec919];return _0x3f4c64;};'use strict';var _=require(_0xcc3f('0x0'));var util=require(_0xcc3f('0x1'));var logger=require(_0xcc3f('0x2'))(_0xcc3f('0x3'));var moment=require('moment');var BPromise=require(_0xcc3f('0x4'));var rp=require(_0xcc3f('0x5'));var fetch=require(_0xcc3f('0x6'));var fs=require('fs');var path=require(_0xcc3f('0x7'));var rimraf=require(_0xcc3f('0x8'));var config=require(_0xcc3f('0x9'));var attributes=require('./whatsappMessage.attributes');module[_0xcc3f('0xa')]=function(_0x44e4,_0x8d0d70){return _0x44e4[_0xcc3f('0xb')](_0xcc3f('0xc'),attributes,{'tableName':_0xcc3f('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xcc3f('0xe')]},{'name':_0xcc3f('0xf'),'fields':[_0xcc3f('0x10')],'type':_0xcc3f('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x221c13,_0x16a462,_0x22d6c4){var _0x471a2a=_0x44e4[_0xcc3f('0x12')];var _0x46d627=_0x221c13[_0xcc3f('0x13')]({'plain':!![]});if(_0x46d627[_0xcc3f('0x14')]['toLowerCase']()==='in'||_0x46d627[_0xcc3f('0x14')][_0xcc3f('0x15')]()==='out'&&!_0x46d627['secret']&&!_['isNil'](_0x46d627['UserId'])){_0x471a2a[_0xcc3f('0x16')][_0xcc3f('0x17')]({'where':{'id':_0x46d627['WhatsappInteractionId']}})[_0xcc3f('0x18')](function(_0x142f2d){if(_0x142f2d){_0x142f2d[_0xcc3f('0x19')]({'lastMsgAt':_0x46d627[_0xcc3f('0x1a')],'lastMsgDirection':_0x46d627[_0xcc3f('0x14')][_0xcc3f('0x15')]()});}})[_0xcc3f('0x1b')](function(_0x39642c){console['error'](_0x39642c);});}if(_0x46d627[_0xcc3f('0x14')]===_0xcc3f('0x1c')&&!_0x46d627[_0xcc3f('0x1d')]){var _0x2a46b7;_0x471a2a[_0xcc3f('0x1e')]['find']({'where':{'id':_0x46d627[_0xcc3f('0x1f')]},'raw':!![]})[_0xcc3f('0x18')](function(_0x446442){_0x2a46b7=_0x446442;if(_0x2a46b7&&_0x2a46b7[_0xcc3f('0x20')]){switch(_0x2a46b7[_0xcc3f('0x20')]){case _0xcc3f('0x21'):var _0x500aac=require('twilio');if(_0x2a46b7[_0xcc3f('0x22')]&&_0x2a46b7[_0xcc3f('0x23')]&&_0x2a46b7[_0xcc3f('0x24')]){var _0x53eea8=new _0x500aac(_0x2a46b7['accountSid'],_0x2a46b7['authToken']);_0x53eea8['messages'][_0xcc3f('0x25')]({'body':_0x46d627['body'],'to':_0xcc3f('0x26')+_0x46d627[_0xcc3f('0x24')],'from':_0xcc3f('0x26')+_0x2a46b7['phone'],'statusCallback':_0x2a46b7[_0xcc3f('0x27')]+_0xcc3f('0x28')+_0x46d627['id']+_0xcc3f('0x29')+_0x2a46b7[_0xcc3f('0x2a')]})[_0xcc3f('0x18')](function(_0x4949c8){if(_0x4949c8[_0xcc3f('0x2b')]){return _0x221c13[_0xcc3f('0x19')]({'messageId':_0x4949c8['sid']});}})[_0xcc3f('0x1b')](function(_0x45bc6a){logger['error'](_0xcc3f('0x2c'),_0xcc3f('0x2d'),'twilio',util[_0xcc3f('0x2e')](_0x45bc6a,{'showHidden':![],'depth':null}));});}else{logger[_0xcc3f('0x2f')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xcc3f('0x2d'),_0xcc3f('0x21'),_0xcc3f('0x30'));}break;case'sinch':var _0x4646da=_0x2a46b7[_0xcc3f('0x22')];var _0x37d19d=_0x2a46b7['authToken'];var _0x373afb=_0x2a46b7[_0xcc3f('0x31')]+'/whatsapp/v1/'+_0x4646da+_0xcc3f('0x32');var _0x241c0e={'to':[_0x46d627[_0xcc3f('0x24')]],'message':{'type':_0xcc3f('0x33'),'text':_0x46d627['body']}};var _0x2cd97c={'method':_0xcc3f('0x34'),'uri':_0x373afb,'headers':{'Authorization':_0xcc3f('0x35')+_0x37d19d,'Content-Type':_0xcc3f('0x36')},'body':_0x241c0e,'json':!![]};rp(_0x2cd97c)[_0xcc3f('0x18')](function(_0x32a4e2){if(_0x32a4e2[_0xcc3f('0x37')][0x0]['message_id']){return _0x221c13[_0xcc3f('0x19')]({'messageId':_0x32a4e2['statuses'][0x0][_0xcc3f('0x38')]});}})[_0xcc3f('0x1b')](function(_0xba6bcb){logger[_0xcc3f('0x39')](_0xcc3f('0x3a'),_0xba6bcb);});break;}}})['finally'](function(){_0x22d6c4();});}else{_0x22d6c4();}}},'charset':_0xcc3f('0x3b'),'collate':_0xcc3f('0x3c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 128bb66..d9f53df 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 _0x7e53=['socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e53,0x71));var _0x37e5=function(_0x334163,_0x2545a6){_0x334163=_0x334163-0x0;var _0x1141bb=_0x7e53[_0x334163];return _0x1141bb;};'use strict';var _=require('lodash');var util=require(_0x37e5('0x0'));var moment=require('moment');var BPromise=require(_0x37e5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37e5('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x37e5('0x3'));var logger=require(_0x37e5('0x4'))(_0x37e5('0x5'));var config=require('../../config/environment');var jayson=require(_0x37e5('0x6'));var client=jayson[_0x37e5('0x7')][_0x37e5('0x8')]({'port':0x232a});config[_0x37e5('0x9')]=_['defaults'](config[_0x37e5('0x9')],{'host':_0x37e5('0xa'),'port':0x18eb});var socket=require(_0x37e5('0xb'))(new Redis(config['redis']));require(_0x37e5('0xc'))[_0x37e5('0xd')](socket);function respondWithRpcPromise(_0x2e34ec,_0x48346d,_0x5d23b9){return new BPromise(function(_0x59cf5b,_0x3f68d9){return client[_0x37e5('0xe')](_0x2e34ec,_0x5d23b9)[_0x37e5('0xf')](function(_0x6cbb95){logger[_0x37e5('0x10')](_0x37e5('0x11'),_0x48346d,_0x37e5('0x12'));logger[_0x37e5('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x48346d,_0x37e5('0x12'),JSON[_0x37e5('0x14')](_0x6cbb95));if(_0x6cbb95['error']){if(_0x6cbb95[_0x37e5('0x15')][_0x37e5('0x16')]===0x1f4){logger[_0x37e5('0x15')](_0x37e5('0x11'),_0x48346d,_0x6cbb95[_0x37e5('0x15')][_0x37e5('0x17')]);return _0x3f68d9(_0x6cbb95[_0x37e5('0x15')][_0x37e5('0x17')]);}logger[_0x37e5('0x15')](_0x37e5('0x11'),_0x48346d,_0x6cbb95[_0x37e5('0x15')]['message']);return _0x59cf5b(_0x6cbb95[_0x37e5('0x15')][_0x37e5('0x17')]);}else{logger['info'](_0x37e5('0x11'),_0x48346d,'request\x20sent');_0x59cf5b(_0x6cbb95[_0x37e5('0x18')][_0x37e5('0x17')]);}})[_0x37e5('0x19')](function(_0x419ed5){logger[_0x37e5('0x15')](_0x37e5('0x11'),_0x48346d,_0x419ed5);_0x3f68d9(_0x419ed5);});});}exports[_0x37e5('0x1a')]=function(_0x4f908f){var _0x15d4f3=this;return new Promise(function(_0x5e6ffa,_0x1d9fa1){return db[_0x37e5('0x1b')][_0x37e5('0x1c')](_0x4f908f['body'],{'raw':_0x4f908f[_0x37e5('0x1d')]?_0x4f908f[_0x37e5('0x1d')][_0x37e5('0x1e')]===undefined?!![]:![]:!![]})[_0x37e5('0xf')](function(_0x14ec9b){logger['info'](_0x37e5('0x1a'),_0x4f908f);logger[_0x37e5('0x13')](_0x37e5('0x1a'),_0x4f908f,JSON['stringify'](_0x14ec9b));_0x5e6ffa(_0x14ec9b);})[_0x37e5('0x19')](function(_0x266741){logger[_0x37e5('0x15')]('CreateWhatsappMessage',_0x266741[_0x37e5('0x17')],_0x4f908f);_0x1d9fa1(_0x15d4f3[_0x37e5('0x15')](0x1f4,_0x266741['message']));});});}; \ No newline at end of file +var _0x9fae=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','create','options','raw','CreateWhatsappMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x9fae,0x1c6));var _0xe9fa=function(_0x2e01f2,_0x22a0c1){_0x2e01f2=_0x2e01f2-0x0;var _0x5c12f4=_0x9fae[_0x2e01f2];return _0x5c12f4;};'use strict';var _=require(_0xe9fa('0x0'));var util=require(_0xe9fa('0x1'));var moment=require(_0xe9fa('0x2'));var BPromise=require(_0xe9fa('0x3'));var rs=require(_0xe9fa('0x4'));var fs=require('fs');var Redis=require(_0xe9fa('0x5'));var db=require(_0xe9fa('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe9fa('0x7'))(_0xe9fa('0x8'));var config=require(_0xe9fa('0x9'));var jayson=require(_0xe9fa('0xa'));var client=jayson[_0xe9fa('0xb')][_0xe9fa('0xc')]({'port':0x232a});config[_0xe9fa('0xd')]=_[_0xe9fa('0xe')](config[_0xe9fa('0xd')],{'host':_0xe9fa('0xf'),'port':0x18eb});var socket=require(_0xe9fa('0x10'))(new Redis(config['redis']));require(_0xe9fa('0x11'))['register'](socket);function respondWithRpcPromise(_0x380565,_0x5cff20,_0x21c2f8){return new BPromise(function(_0x429942,_0x13df38){return client['request'](_0x380565,_0x21c2f8)[_0xe9fa('0x12')](function(_0x2c4ebb){logger[_0xe9fa('0x13')](_0xe9fa('0x14'),_0x5cff20,_0xe9fa('0x15'));logger[_0xe9fa('0x16')](_0xe9fa('0x17'),_0x5cff20,_0xe9fa('0x15'),JSON[_0xe9fa('0x18')](_0x2c4ebb));if(_0x2c4ebb['error']){if(_0x2c4ebb['error'][_0xe9fa('0x19')]===0x1f4){logger[_0xe9fa('0x1a')]('WhatsappMessage,\x20%s,\x20%s',_0x5cff20,_0x2c4ebb[_0xe9fa('0x1a')][_0xe9fa('0x1b')]);return _0x13df38(_0x2c4ebb[_0xe9fa('0x1a')][_0xe9fa('0x1b')]);}logger[_0xe9fa('0x1a')](_0xe9fa('0x14'),_0x5cff20,_0x2c4ebb[_0xe9fa('0x1a')][_0xe9fa('0x1b')]);return _0x429942(_0x2c4ebb['error'][_0xe9fa('0x1b')]);}else{logger['info'](_0xe9fa('0x14'),_0x5cff20,'request\x20sent');_0x429942(_0x2c4ebb[_0xe9fa('0x1c')][_0xe9fa('0x1b')]);}})['catch'](function(_0x418ff3){logger[_0xe9fa('0x1a')](_0xe9fa('0x14'),_0x5cff20,_0x418ff3);_0x13df38(_0x418ff3);});});}exports['CreateWhatsappMessage']=function(_0x5ce0f1){var _0x16f644=this;return new Promise(function(_0x3d1aeb,_0x3604fd){return db['WhatsappMessage'][_0xe9fa('0x1d')](_0x5ce0f1['body'],{'raw':_0x5ce0f1['options']?_0x5ce0f1[_0xe9fa('0x1e')][_0xe9fa('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0xefe48f){logger[_0xe9fa('0x13')](_0xe9fa('0x20'),_0x5ce0f1);logger[_0xe9fa('0x16')](_0xe9fa('0x20'),_0x5ce0f1,JSON[_0xe9fa('0x18')](_0xefe48f));_0x3d1aeb(_0xefe48f);})['catch'](function(_0x17334e){logger['error'](_0xe9fa('0x20'),_0x17334e[_0xe9fa('0x1b')],_0x5ce0f1);_0x3604fd(_0x16f644[_0xe9fa('0x1a')](0x1f4,_0x17334e[_0xe9fa('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 644af88..32f3761 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 _0xd5c9=['register','length','./whatsappMessage.events','save','remove','update','emit'];(function(_0x3aba68,_0x5baae3){var _0x3e716c=function(_0x15c626){while(--_0x15c626){_0x3aba68['push'](_0x3aba68['shift']());}};_0x3e716c(++_0x5baae3);}(_0xd5c9,0xa3));var _0x9d5c=function(_0x46d5ac,_0x4cc7df){_0x46d5ac=_0x46d5ac-0x0;var _0xb6f383=_0xd5c9[_0x46d5ac];return _0xb6f383;};'use strict';var WhatsappMessageEvents=require(_0x9d5c('0x0'));var events=[_0x9d5c('0x1'),_0x9d5c('0x2'),_0x9d5c('0x3')];function createListener(_0x12970e,_0x170888){return function(_0x564a08){_0x170888[_0x9d5c('0x4')](_0x12970e,_0x564a08);};}function removeListener(_0x35e1ec,_0x1bf78c){return function(){WhatsappMessageEvents['removeListener'](_0x35e1ec,_0x1bf78c);};}exports[_0x9d5c('0x5')]=function(_0x4bd173){for(var _0x4748ab=0x0,_0x5131ca=events[_0x9d5c('0x6')];_0x4748ab<_0x5131ca;_0x4748ab++){var _0x3d017b=events[_0x4748ab];var _0xff2580=createListener('whatsappMessage:'+_0x3d017b,_0x4bd173);WhatsappMessageEvents['on'](_0x3d017b,_0xff2580);}}; \ No newline at end of file +var _0xbf16=['emit','removeListener','length','./whatsappMessage.events','remove'];(function(_0x33ecbc,_0x256be0){var _0x1e0157=function(_0x1ac25a){while(--_0x1ac25a){_0x33ecbc['push'](_0x33ecbc['shift']());}};_0x1e0157(++_0x256be0);}(_0xbf16,0x19d));var _0x6bf1=function(_0x4c7b4a,_0x2ff38e){_0x4c7b4a=_0x4c7b4a-0x0;var _0x3c0782=_0xbf16[_0x4c7b4a];return _0x3c0782;};'use strict';var WhatsappMessageEvents=require(_0x6bf1('0x0'));var events=['save',_0x6bf1('0x1'),'update'];function createListener(_0x510665,_0x4420be){return function(_0x4c5717){_0x4420be[_0x6bf1('0x2')](_0x510665,_0x4c5717);};}function removeListener(_0xfde9c,_0x245115){return function(){WhatsappMessageEvents[_0x6bf1('0x3')](_0xfde9c,_0x245115);};}exports['register']=function(_0x2a7986){for(var _0x380a8e=0x0,_0x40ac30=events[_0x6bf1('0x4')];_0x380a8e<_0x40ac30;_0x380a8e++){var _0x3e38e8=events[_0x380a8e];var _0x2f61a6=createListener('whatsappMessage:'+_0x3e38e8,_0x2a7986);WhatsappMessageEvents['on'](_0x3e38e8,_0x2f61a6);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index a242f01..8f5c71e 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 _0x5e27=['put','/:id','update','delete','destroy','removeTeams','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addAgents'];(function(_0x567011,_0x273172){var _0x50ac02=function(_0x79f2ba){while(--_0x79f2ba){_0x567011['push'](_0x567011['shift']());}};_0x50ac02(++_0x273172);}(_0x5e27,0x18c));var _0x75e2=function(_0x107868,_0x7d769a){_0x107868=_0x107868-0x0;var _0x2ac5e9=_0x5e27[_0x107868];return _0x2ac5e9;};'use strict';var multer=require(_0x75e2('0x0'));var util=require('util');var path=require(_0x75e2('0x1'));var timeout=require(_0x75e2('0x2'));var express=require(_0x75e2('0x3'));var router=express[_0x75e2('0x4')]();var fs_extra=require(_0x75e2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x75e2('0x6'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0x75e2('0x7')]('/',auth[_0x75e2('0x8')](),controller[_0x75e2('0x9')]);router[_0x75e2('0x7')](_0x75e2('0xa'),auth[_0x75e2('0x8')](),controller[_0x75e2('0xb')]);router[_0x75e2('0x7')]('/:id',auth[_0x75e2('0x8')](),controller[_0x75e2('0xc')]);router[_0x75e2('0x7')](_0x75e2('0xd'),auth[_0x75e2('0x8')](),controller[_0x75e2('0xe')]);router[_0x75e2('0x7')](_0x75e2('0xf'),auth[_0x75e2('0x8')](),controller[_0x75e2('0x10')]);router[_0x75e2('0x7')](_0x75e2('0x11'),auth[_0x75e2('0x8')](),controller['getAgents']);router[_0x75e2('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x75e2('0x12')](_0x75e2('0xf'),auth[_0x75e2('0x8')](),controller['addTeams']);router[_0x75e2('0x12')]('/:id/users',auth[_0x75e2('0x8')](),controller[_0x75e2('0x13')]);router[_0x75e2('0x14')](_0x75e2('0x15'),auth[_0x75e2('0x8')](),controller[_0x75e2('0x16')]);router[_0x75e2('0x17')](_0x75e2('0x15'),auth['isAuthenticated'](),controller[_0x75e2('0x18')]);router['delete'](_0x75e2('0xf'),auth[_0x75e2('0x8')](),controller[_0x75e2('0x19')]);router[_0x75e2('0x17')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x175b=['create','/:id/teams','addTeams','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post'];(function(_0x5a456b,_0x1147a0){var _0x5729d9=function(_0x51fb4c){while(--_0x51fb4c){_0x5a456b['push'](_0x5a456b['shift']());}};_0x5729d9(++_0x1147a0);}(_0x175b,0x1ca));var _0xb175=function(_0x5090d4,_0x1950a7){_0x5090d4=_0x5090d4-0x0;var _0x56c310=_0x175b[_0x5090d4];return _0x56c310;};'use strict';var multer=require(_0xb175('0x0'));var util=require(_0xb175('0x1'));var path=require(_0xb175('0x2'));var timeout=require(_0xb175('0x3'));var express=require(_0xb175('0x4'));var router=express[_0xb175('0x5')]();var fs_extra=require(_0xb175('0x6'));var auth=require(_0xb175('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb175('0x8'));var controller=require(_0xb175('0x9'));router[_0xb175('0xa')]('/',auth[_0xb175('0xb')](),controller[_0xb175('0xc')]);router[_0xb175('0xa')](_0xb175('0xd'),auth[_0xb175('0xb')](),controller[_0xb175('0xe')]);router[_0xb175('0xa')](_0xb175('0xf'),auth[_0xb175('0xb')](),controller['show']);router[_0xb175('0xa')](_0xb175('0x10'),auth[_0xb175('0xb')](),controller[_0xb175('0x11')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0xb175('0x12')]);router[_0xb175('0xa')](_0xb175('0x13'),auth['isAuthenticated'](),controller[_0xb175('0x14')]);router[_0xb175('0x15')]('/',auth['isAuthenticated'](),controller[_0xb175('0x16')]);router[_0xb175('0x15')](_0xb175('0x17'),auth[_0xb175('0xb')](),controller[_0xb175('0x18')]);router[_0xb175('0x15')](_0xb175('0x13'),auth[_0xb175('0xb')](),controller['addAgents']);router['put'](_0xb175('0xf'),auth[_0xb175('0xb')](),controller[_0xb175('0x19')]);router[_0xb175('0x1a')](_0xb175('0xf'),auth[_0xb175('0xb')](),controller[_0xb175('0x1b')]);router['delete'](_0xb175('0x17'),auth[_0xb175('0xb')](),controller['removeTeams']);router[_0xb175('0x1a')](_0xb175('0x13'),auth[_0xb175('0xb')](),controller[_0xb175('0x1c')]);module[_0xb175('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 18ed13f..43b5449 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 _0xd87e=['exports','name','INTEGER','ENUM','beepall','STRING','sequelize'];(function(_0x3b22e9,_0x354406){var _0x230314=function(_0x29ae96){while(--_0x29ae96){_0x3b22e9['push'](_0x3b22e9['shift']());}};_0x230314(++_0x354406);}(_0xd87e,0x1bf));var _0xed87=function(_0x2c61a2,_0x40fe37){_0x2c61a2=_0x2c61a2-0x0;var _0x28bf7c=_0xd87e[_0x2c61a2];return _0x28bf7c;};'use strict';var Sequelize=require(_0xed87('0x0'));module[_0xed87('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xed87('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xed87('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xed87('0x4')]('rrmemory',_0xed87('0x5'),'roundrobin')},'description':{'type':Sequelize[_0xed87('0x6')]}}; \ No newline at end of file +var _0x6931=['ENUM','rrmemory','roundrobin','STRING','sequelize','exports','INTEGER'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x6931,0xa5));var _0x1693=function(_0x10783d,_0x1f5252){_0x10783d=_0x10783d-0x0;var _0x332462=_0x6931[_0x10783d];return _0x332462;};'use strict';var Sequelize=require(_0x1693('0x0'));module[_0x1693('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x1693('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1693('0x3')](_0x1693('0x4'),'beepall',_0x1693('0x5'))},'description':{'type':Sequelize[_0x1693('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index b443120..a152eaf 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 _0x76d3=['register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','UserProfileResource','end','error','name','rawAttributes','fieldName','type','getOptions','where','WhatsappQueue','include','findAll','rows','catch','show','params','model','query','keys','filters','intersection','attributes','fields','includeAll','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','length','hasOwnProperty','nolimit','sort','pick','WhatsappQueueId','filter','UserWhatsappQueue','findAndCountAll','map','UserId','whatsappPause','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','order','addTeams','Agents','online','voicePause','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','ids','User','select','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','getAgents','lodash','squel','ioredis','../../components/parsers/qs','../../mysqldb','redis','defaults','socket.io-emitter'];(function(_0x5b449c,_0x187099){var _0x375e91=function(_0x4ddc27){while(--_0x4ddc27){_0x5b449c['push'](_0x5b449c['shift']());}};_0x375e91(++_0x187099);}(_0x76d3,0x14b));var _0x376d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x76d3[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x376d('0x0'));var squel=require(_0x376d('0x1'));var Redis=require(_0x376d('0x2'));var qs=require(_0x376d('0x3'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x376d('0x4'))['db'];config[_0x376d('0x5')]=_[_0x376d('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x376d('0x7'))(new Redis(config[_0x376d('0x5')]));require('./whatsappQueue.socket')[_0x376d('0x8')](socket);function respondWithStatusCode(_0xec1498,_0x59a682){_0x59a682=_0x59a682||0xcc;return function(_0x221c5a){if(_0x221c5a){return _0xec1498[_0x376d('0x9')](_0x59a682);}return _0xec1498[_0x376d('0xa')](_0x59a682)['end']();};}function respondWithResult(_0x380ba1,_0x1bf042){_0x1bf042=_0x1bf042||0xc8;return function(_0x5ee3bd){if(_0x5ee3bd){return _0x380ba1['status'](_0x1bf042)[_0x376d('0xb')](_0x5ee3bd);}};}function respondWithFilteredResult(_0x1a1913,_0x30798a){return function(_0x2811f9){if(_0x2811f9){var _0x39881c=typeof _0x30798a[_0x376d('0xc')]===_0x376d('0xd')&&typeof _0x30798a[_0x376d('0xe')]===_0x376d('0xd');var _0x4f1834=_0x2811f9['count'];var _0x194383=_0x39881c?0x0:_0x30798a[_0x376d('0xc')];var _0x126a46=_0x39881c?_0x2811f9[_0x376d('0xf')]:_0x30798a[_0x376d('0xc')]+_0x30798a[_0x376d('0xe')];var _0x5ba183;if(_0x126a46>=_0x4f1834){_0x126a46=_0x4f1834;_0x5ba183=0xc8;}else{_0x5ba183=0xce;}_0x1a1913['status'](_0x5ba183);return _0x1a1913['set'](_0x376d('0x10'),_0x194383+'-'+_0x126a46+'/'+_0x4f1834)[_0x376d('0xb')](_0x2811f9);}return null;};}function saveUpdates(_0x24f9c4){return function(_0x2c343c){if(_0x2c343c){return _0x2c343c[_0x376d('0x11')](_0x24f9c4)[_0x376d('0x12')](function(_0xdfe7f3){return _0xdfe7f3;});}return null;};}function removeEntity(_0x26237d){return function(_0x1786c6){if(_0x1786c6){return _0x1786c6[_0x376d('0x13')]()['then'](function(){var _0x12f5fb=_0x1786c6['get']({'plain':!![]});var _0x3dac4e='WhatsappQueues';return db[_0x376d('0x14')]['destroy']({'where':{'type':_0x3dac4e,'resourceId':_0x12f5fb['id']}})[_0x376d('0x12')](function(){return _0x1786c6;});})['then'](function(){_0x26237d[_0x376d('0xa')](0xcc)[_0x376d('0x15')]();});}};}function handleEntityNotFound(_0x346acb){return function(_0x1ac750){if(!_0x1ac750){_0x346acb[_0x376d('0x9')](0x194);}return _0x1ac750;};}function handleError(_0x9025c3,_0xb71afe){_0xb71afe=_0xb71afe||0x1f4;return function(_0x12b29f){logger[_0x376d('0x16')](_0x12b29f['stack']);if(_0x12b29f[_0x376d('0x17')]){delete _0x12b29f[_0x376d('0x17')];}_0x9025c3[_0x376d('0xa')](_0xb71afe)['send'](_0x12b29f);};}exports['index']=function(_0x42f6c5,_0x5793f6){var _0x1da0e2={};var _0xef08bd={'count':0x0,'rows':[]};var _0x3b04f8=_['map'](db['WhatsappQueue'][_0x376d('0x18')],function(_0x157474){return{'name':_0x157474[_0x376d('0x19')],'type':_0x157474[_0x376d('0x1a')]['key']};});_0x1da0e2=qs[_0x376d('0x1b')](_0x3b04f8,_0x42f6c5);var _0x367830={'where':_0x1da0e2[_0x376d('0x1c')]};return db[_0x376d('0x1d')][_0x376d('0xf')](_0x367830)[_0x376d('0x12')](function(_0x461545){_0xef08bd[_0x376d('0xf')]=_0x461545;_0x1da0e2[_0x376d('0x1e')]=qs[_0x376d('0x1e')](_0x42f6c5['query']);return db[_0x376d('0x1d')][_0x376d('0x1f')](_0x1da0e2);})[_0x376d('0x12')](function(_0xb9861d){_0xef08bd[_0x376d('0x20')]=_0xb9861d;return _0xef08bd;})[_0x376d('0x12')](respondWithFilteredResult(_0x5793f6,_0x1da0e2))[_0x376d('0x21')](handleError(_0x5793f6,null));};exports[_0x376d('0x22')]=function(_0x4bec0c,_0x2028d5){var _0x48d759={'raw':!![],'where':{'id':_0x4bec0c[_0x376d('0x23')]['id']}},_0x3652f7={};_0x3652f7[_0x376d('0x24')]=_['keys'](db[_0x376d('0x1d')][_0x376d('0x18')]);_0x3652f7[_0x376d('0x25')]=_[_0x376d('0x26')](_0x4bec0c['query']);_0x3652f7[_0x376d('0x27')]=_[_0x376d('0x28')](_0x3652f7[_0x376d('0x24')],_0x3652f7[_0x376d('0x25')]);_0x48d759[_0x376d('0x29')]=_[_0x376d('0x28')](_0x3652f7[_0x376d('0x24')],qs[_0x376d('0x2a')](_0x4bec0c['query'][_0x376d('0x2a')]));_0x48d759[_0x376d('0x29')]=_0x48d759[_0x376d('0x29')]['length']?_0x48d759[_0x376d('0x29')]:_0x3652f7[_0x376d('0x24')];if(_0x4bec0c[_0x376d('0x25')][_0x376d('0x2b')]){_0x48d759['include']=[{'all':!![]}];}_0x48d759=_[_0x376d('0x2c')]({},_0x48d759,_0x4bec0c[_0x376d('0x2d')]);return db['WhatsappQueue'][_0x376d('0x2e')](_0x48d759)['then'](handleEntityNotFound(_0x2028d5,null))[_0x376d('0x12')](respondWithResult(_0x2028d5,null))[_0x376d('0x21')](handleError(_0x2028d5,null));};exports['create']=function(_0x3ecc59,_0x1e6f45){return db[_0x376d('0x1d')][_0x376d('0x2f')](_0x3ecc59[_0x376d('0x30')],{})['then'](function(_0xf4cbd2){var _0xeee45d=_0x3ecc59[_0x376d('0x31')][_0x376d('0x32')]({'plain':!![]});if(!_0xeee45d)throw new Error(_0x376d('0x33'));if(_0xeee45d[_0x376d('0x34')]===_0x376d('0x31')){var _0x5d0632=_0xf4cbd2[_0x376d('0x32')]({'plain':!![]});var _0x2e69a0=_0x376d('0x35');return db[_0x376d('0x36')][_0x376d('0x2e')]({'where':{'name':_0x2e69a0,'userProfileId':_0xeee45d['userProfileId']},'raw':!![]})['then'](function(_0x5a4ab2){if(_0x5a4ab2&&_0x5a4ab2[_0x376d('0x37')]===0x0){return db[_0x376d('0x14')][_0x376d('0x2f')]({'name':_0x5d0632[_0x376d('0x17')],'resourceId':_0x5d0632['id'],'type':_0x5a4ab2[_0x376d('0x17')],'sectionId':_0x5a4ab2['id']},{})[_0x376d('0x12')](function(){return _0xf4cbd2;});}else{return _0xf4cbd2;}})[_0x376d('0x21')](function(_0x181a06){logger[_0x376d('0x16')](_0x376d('0x38'),_0x181a06);throw _0x181a06;});}return _0xf4cbd2;})['then'](respondWithResult(_0x1e6f45,0xc9))[_0x376d('0x21')](handleError(_0x1e6f45,null));};exports[_0x376d('0x11')]=function(_0x253399,_0x1b4774){if(_0x253399[_0x376d('0x30')]['id']){delete _0x253399[_0x376d('0x30')]['id'];}return db['WhatsappQueue'][_0x376d('0x2e')]({'where':{'id':_0x253399['params']['id']}})[_0x376d('0x12')](handleEntityNotFound(_0x1b4774,null))[_0x376d('0x12')](saveUpdates(_0x253399['body'],null))[_0x376d('0x12')](respondWithResult(_0x1b4774,null))[_0x376d('0x21')](handleError(_0x1b4774,null));};exports[_0x376d('0x13')]=function(_0xd5101e,_0x28663b){return db[_0x376d('0x1d')][_0x376d('0x2e')]({'where':{'id':_0xd5101e['params']['id']}})[_0x376d('0x12')](handleEntityNotFound(_0x28663b,null))['then'](removeEntity(_0x28663b,null))[_0x376d('0x21')](handleError(_0x28663b,null));};exports['describe']=function(_0x3fcedf,_0x5a2160){return db[_0x376d('0x1d')][_0x376d('0x39')]()[_0x376d('0x12')](respondWithResult(_0x5a2160,null))[_0x376d('0x21')](handleError(_0x5a2160,null));};exports[_0x376d('0x3a')]=function(_0x3442ce,_0x157297){var _0x49b991={'raw':!![],'where':{}},_0x31e4a9={},_0x532588;return db['WhatsappQueue'][_0x376d('0x3b')]({'where':{'id':_0x3442ce[_0x376d('0x23')]['id']}})[_0x376d('0x12')](handleEntityNotFound(_0x157297,null))[_0x376d('0x12')](function(_0x2e6025){if(_0x2e6025){_0x532588=_0x2e6025[_0x376d('0x32')]({'plain':!![]});_0x31e4a9[_0x376d('0x24')]=_[_0x376d('0x26')](db['UserWhatsappQueue'][_0x376d('0x18')]);_0x31e4a9[_0x376d('0x25')]=_[_0x376d('0x26')](_0x3442ce[_0x376d('0x25')]);_0x31e4a9[_0x376d('0x27')]=_['intersection'](_0x31e4a9[_0x376d('0x24')],_0x31e4a9[_0x376d('0x25')]);_0x49b991[_0x376d('0x29')]=_['intersection'](_0x31e4a9[_0x376d('0x24')],qs[_0x376d('0x2a')](_0x3442ce[_0x376d('0x25')][_0x376d('0x2a')]));_0x49b991[_0x376d('0x29')]=_0x49b991[_0x376d('0x29')][_0x376d('0x3c')]?_0x49b991['attributes']:_0x31e4a9[_0x376d('0x24')];if(!_0x3442ce[_0x376d('0x25')][_0x376d('0x3d')](_0x376d('0x3e'))){_0x49b991['limit']=qs[_0x376d('0xe')](_0x3442ce['query'][_0x376d('0xe')]);_0x49b991[_0x376d('0xc')]=qs['offset'](_0x3442ce[_0x376d('0x25')][_0x376d('0xc')]);}_0x49b991['order']=qs[_0x376d('0x3f')](_0x3442ce[_0x376d('0x25')][_0x376d('0x3f')]);_0x49b991[_0x376d('0x1c')]=qs[_0x376d('0x27')](_[_0x376d('0x40')](_0x3442ce[_0x376d('0x25')],_0x31e4a9[_0x376d('0x27')]));_0x49b991[_0x376d('0x1c')][_0x376d('0x41')]=_0x2e6025['id'];if(_0x3442ce[_0x376d('0x25')][_0x376d('0x42')]){_0x49b991[_0x376d('0x1c')]=_['merge'](_0x49b991[_0x376d('0x1c')],{'$or':_['map'](_0x49b991[_0x376d('0x29')],function(_0x31456e){var _0x2cc9bd={};_0x2cc9bd[_0x31456e]={'$like':'%'+_0x3442ce[_0x376d('0x25')][_0x376d('0x42')]+'%'};return _0x2cc9bd;})});}_0x49b991=_[_0x376d('0x2c')]({},_0x49b991,_0x3442ce[_0x376d('0x2d')]);return db[_0x376d('0x43')][_0x376d('0x1f')](_0x49b991);}})[_0x376d('0x12')](function(_0x580a64){if(_0x580a64){return db['User'][_0x376d('0x44')]({'where':{'id':_[_0x376d('0x45')](_0x580a64,_0x376d('0x46')),'role':'agent'},'attributes':['id',_0x376d('0x17'),_0x376d('0x47'),'updatedAt','createdAt']});}})[_0x376d('0x12')](function(_0x496d40){if(_0x496d40){return{'count':_0x496d40[_0x376d('0xf')],'rows':_['map'](_0x496d40[_0x376d('0x20')],function(_0x22300a){return{'membername':_0x22300a[_0x376d('0x17')],'UserId':_0x22300a['id'],'queue_name':_0x532588[_0x376d('0x17')],'WhatsappQueueId':_0x532588['id'],'interface':util['format'](_0x376d('0x48'),_0x376d('0x49'),_0x22300a[_0x376d('0x17')]),'penalty':0x0,'paused':_0x22300a['whatsappPause'],'createdAt':_0x22300a[_0x376d('0x4a')],'updatedAt':_0x22300a[_0x376d('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x376d('0x12')](respondWithFilteredResult(_0x157297,_0x49b991))[_0x376d('0x21')](handleError(_0x157297,null));};exports[_0x376d('0x4c')]=function(_0x3c93b0,_0x5ce746){var _0x221de3={};var _0x38c2ea={};var _0x18c239;var _0x2b6dc7;return db[_0x376d('0x1d')][_0x376d('0x3b')]({'where':{'id':_0x3c93b0[_0x376d('0x23')]['id']}})[_0x376d('0x12')](handleEntityNotFound(_0x5ce746,null))[_0x376d('0x12')](function(_0x65067e){if(_0x65067e){_0x18c239=_0x65067e;_0x38c2ea['model']=_[_0x376d('0x26')](db[_0x376d('0x4d')][_0x376d('0x18')]);_0x38c2ea[_0x376d('0x25')]=_['keys'](_0x3c93b0[_0x376d('0x25')]);_0x38c2ea['filters']=_['intersection'](_0x38c2ea[_0x376d('0x24')],_0x38c2ea['query']);_0x221de3[_0x376d('0x29')]=_[_0x376d('0x28')](_0x38c2ea[_0x376d('0x24')],qs[_0x376d('0x2a')](_0x3c93b0['query']['fields']));_0x221de3[_0x376d('0x29')]=_0x221de3['attributes'][_0x376d('0x3c')]?_0x221de3[_0x376d('0x29')]:_0x38c2ea[_0x376d('0x24')];_0x221de3[_0x376d('0x4e')]=qs['sort'](_0x3c93b0[_0x376d('0x25')][_0x376d('0x3f')]);_0x221de3[_0x376d('0x1c')]=qs[_0x376d('0x27')](_[_0x376d('0x40')](_0x3c93b0['query'],_0x38c2ea['filters']));if(_0x3c93b0['query'][_0x376d('0x42')]){_0x221de3['where']=_[_0x376d('0x2c')](_0x221de3[_0x376d('0x1c')],{'$or':_['map'](_0x221de3[_0x376d('0x29')],function(_0x4e22a9){var _0x5cc100={};_0x5cc100[_0x4e22a9]={'$like':'%'+_0x3c93b0['query'][_0x376d('0x42')]+'%'};return _0x5cc100;})});}_0x221de3=_[_0x376d('0x2c')]({},_0x221de3,_0x3c93b0[_0x376d('0x2d')]);return _0x18c239[_0x376d('0x4c')](_0x221de3);}})[_0x376d('0x12')](function(_0x170df9){if(_0x170df9){_0x2b6dc7=_0x170df9[_0x376d('0x3c')];if(!_0x3c93b0[_0x376d('0x25')][_0x376d('0x3d')]('nolimit')){_0x221de3[_0x376d('0xe')]=qs[_0x376d('0xe')](_0x3c93b0[_0x376d('0x25')][_0x376d('0xe')]);_0x221de3['offset']=qs[_0x376d('0xc')](_0x3c93b0['query'][_0x376d('0xc')]);}return _0x18c239[_0x376d('0x4c')](_0x221de3);}})[_0x376d('0x12')](function(_0x39a39e){if(_0x39a39e){return _0x39a39e?{'count':_0x2b6dc7,'rows':_0x39a39e}:null;}})[_0x376d('0x12')](respondWithResult(_0x5ce746,null))[_0x376d('0x21')](handleError(_0x5ce746,null));};exports[_0x376d('0x4f')]=function(_0xb46c2c,_0x1181af){var _0x377499=_0xb46c2c['body']['ids'];return db[_0x376d('0x4d')][_0x376d('0x1f')]({'where':{'id':_0x377499},'attributes':['id'],'include':[{'model':db['User'],'as':_0x376d('0x50'),'attributes':['id',_0x376d('0x17'),_0x376d('0x51'),_0x376d('0x52'),'interface'],'raw':!![]}]})[_0x376d('0x12')](function(_0x4bdb8f){if(_0x4bdb8f){var _0x33a7c6=_['flatMap'](_0x4bdb8f,function(_0x4af17c){var _0x89a89c=_0x4af17c[_0x376d('0x32')]({'plain':!![]});return _0x89a89c[_0x376d('0x50')];});return db['WhatsappQueue'][_0x376d('0x2e')]({'where':{'id':_0xb46c2c[_0x376d('0x23')]['id']}})[_0x376d('0x12')](function(_0x723613){return db[_0x376d('0x53')]['transaction'](function(_0x6692ac){return _0x723613[_0x376d('0x4f')](_0x377499,{'transaction':_0x6692ac})[_0x376d('0x12')](function(){return BPromise[_0x376d('0x54')](_0x33a7c6,function(_0x5222d4){return db[_0x376d('0x43')][_0x376d('0x55')]({'where':{'UserId':_0x5222d4['id'],'WhatsappQueueId':_0xb46c2c[_0x376d('0x23')]['id']},'transaction':_0x6692ac});});})[_0x376d('0x12')](function(){_0x33a7c6[_0x376d('0x56')](function(_0x4978e5){socket[_0x376d('0x57')](_0x376d('0x58'),{'UserId':_0x4978e5['id'],'WhatsappQueueId':_0x723613['id']});});});});});}})[_0x376d('0x12')](respondWithStatusCode(_0x1181af,null))[_0x376d('0x21')](handleError(_0x1181af,null));};exports['removeTeams']=function(_0x3e7f84,_0x51eb2d){return db[_0x376d('0x4d')]['findAll']({'where':{'id':_0x3e7f84[_0x376d('0x25')][_0x376d('0x59')]},'attributes':['id'],'include':[{'model':db[_0x376d('0x5a')],'as':_0x376d('0x50'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x51eb2d,null))[_0x376d('0x12')](function(_0x5dc0f1){var _0x4c62c6=_['map'](_0x5dc0f1,'id');var _0x3951a4=[];var _0x78ed82=[];var _0x4f6eb8=squel[_0x376d('0x5b')]();_0x4f6eb8['field'](_0x376d('0x5c'))['from']('team_has_whatsapp_queues','tq')[_0x376d('0x5d')]('user_has_teams','ut',_0x376d('0x5e'))['where'](_0x376d('0x5f'),_0x3e7f84[_0x376d('0x23')]['id']);for(var _0x5edbfd=0x0;_0x5edbfd<_0x5dc0f1[_0x376d('0x3c')];_0x5edbfd+=0x1){let _0x149c0c=_0x5dc0f1[_0x5edbfd];for(var _0x35cffa=0x0;_0x35cffa<_0x149c0c[_0x376d('0x50')][_0x376d('0x3c')];_0x35cffa+=0x1){let _0x7f1f7d=_0x149c0c['Agents'][_0x35cffa];var _0x1218d7=_0x4f6eb8['clone']();_0x1218d7[_0x376d('0x1c')](_0x376d('0x60'),_0x7f1f7d['id']);_0x78ed82[_0x376d('0x61')](db[_0x376d('0x53')][_0x376d('0x25')](_0x1218d7[_0x376d('0x62')](),{'type':db['sequelize'][_0x376d('0x63')][_0x376d('0x64')]})[_0x376d('0x12')](function(_0x5205e3){if(_0x5205e3[_0x376d('0x3c')]===0x1){return _0x7f1f7d['id'];}else{var _0x52b53b=_['every'](_[_0x376d('0x45')](_0x5205e3,_0x376d('0x65')),function(_0x48d7f6){return _[_0x376d('0x66')](_0x4c62c6,_0x48d7f6);});if(_0x52b53b){return _0x7f1f7d['id'];}}}));}}return BPromise['all'](_0x78ed82)[_0x376d('0x12')](function(_0x1ba27e){_0x3951a4=_(_0x3951a4)[_0x376d('0x67')](_0x1ba27e)[_0x376d('0x68')]()[_0x376d('0x69')]();return db['WhatsappQueue'][_0x376d('0x2e')]({'where':{'id':_0x3e7f84[_0x376d('0x23')]['id']}})[_0x376d('0x12')](function(_0xc5cbf1){return db[_0x376d('0x53')]['transaction'](function(_0x2aabdf){return _0xc5cbf1[_0x376d('0x6a')](_0x3e7f84[_0x376d('0x25')][_0x376d('0x59')],{'transaction':_0x2aabdf})['then'](function(){if(!_[_0x376d('0x6b')](_0x3951a4)){return _0xc5cbf1[_0x376d('0x6c')](_0x3951a4,{'transaction':_0x2aabdf});}})['then'](function(){_0x3951a4[_0x376d('0x56')](function(_0x2af0c2){socket[_0x376d('0x57')](_0x376d('0x6d'),{'UserId':_0x2af0c2,'WhatsappQueueId':_0xc5cbf1['id']});});});});});});})[_0x376d('0x12')](respondWithStatusCode(_0x51eb2d,null))[_0x376d('0x21')](handleError(_0x51eb2d,null));};exports[_0x376d('0x6e')]=function(_0x297e42,_0x107386){return db['WhatsappQueue'][_0x376d('0x2e')]({'where':{'id':_0x297e42[_0x376d('0x23')]['id']}})[_0x376d('0x12')](handleEntityNotFound(_0x107386,null))[_0x376d('0x12')](function(_0x24d6dc){if(_0x24d6dc){return _0x24d6dc[_0x376d('0x6e')](_0x297e42['body']['ids'],_[_0x376d('0x6f')](_0x297e42['body'],[_0x376d('0x59'),'id'])||{})['spread'](function(_0x3f9110){for(var _0xf46362=0x0;_0xf46362<_0x297e42[_0x376d('0x30')]['ids'][_0x376d('0x3c')];_0xf46362+=0x1){socket[_0x376d('0x57')]('userWhatsappQueue:save',{'UserId':Number(_0x297e42[_0x376d('0x30')]['ids'][_0xf46362]),'WhatsappQueueId':Number(_0x297e42['params']['id'])});}return _0x3f9110;});}})[_0x376d('0x12')](respondWithResult(_0x107386,null))[_0x376d('0x21')](handleError(_0x107386,null));};exports[_0x376d('0x6c')]=function(_0x44e983,_0x35079f){return db[_0x376d('0x1d')][_0x376d('0x2e')]({'where':{'id':_0x44e983[_0x376d('0x23')]['id']}})['then'](handleEntityNotFound(_0x35079f,null))[_0x376d('0x12')](function(_0x4803dc){if(_0x4803dc){return _0x4803dc[_0x376d('0x6c')](_0x44e983[_0x376d('0x25')][_0x376d('0x59')])[_0x376d('0x12')](function(){if(_['isArray'](_0x44e983[_0x376d('0x25')][_0x376d('0x59')])){for(var _0x331d12=0x0;_0x331d12<_0x44e983['query'][_0x376d('0x59')]['length'];_0x331d12+=0x1){socket[_0x376d('0x57')](_0x376d('0x6d'),{'UserId':Number(_0x44e983[_0x376d('0x25')][_0x376d('0x59')][_0x331d12]),'WhatsappQueueId':Number(_0x44e983[_0x376d('0x23')]['id'])});}}else{socket[_0x376d('0x57')](_0x376d('0x6d'),{'UserId':Number(_0x44e983[_0x376d('0x25')][_0x376d('0x59')]),'WhatsappQueueId':Number(_0x44e983['params']['id'])});}});}})[_0x376d('0x12')](respondWithStatusCode(_0x35079f,null))[_0x376d('0x21')](handleError(_0x35079f,null));};exports[_0x376d('0x70')]=function(_0x5e5639,_0xb6ae11){var _0x500b72={};var _0x20a521={};var _0x3b4a3a;var _0x318d76;return db[_0x376d('0x1d')][_0x376d('0x3b')]({'where':{'id':_0x5e5639[_0x376d('0x23')]['id']}})[_0x376d('0x12')](handleEntityNotFound(_0xb6ae11,null))[_0x376d('0x12')](function(_0x5b4806){if(_0x5b4806){_0x3b4a3a=_0x5b4806;_0x20a521[_0x376d('0x24')]=_[_0x376d('0x26')](db[_0x376d('0x5a')][_0x376d('0x18')]);_0x20a521[_0x376d('0x25')]=_[_0x376d('0x26')](_0x5e5639[_0x376d('0x25')]);_0x20a521[_0x376d('0x27')]=_['intersection'](_0x20a521[_0x376d('0x24')],_0x20a521[_0x376d('0x25')]);_0x500b72[_0x376d('0x29')]=_[_0x376d('0x28')](_0x20a521[_0x376d('0x24')],qs['fields'](_0x5e5639[_0x376d('0x25')][_0x376d('0x2a')]));_0x500b72[_0x376d('0x29')]=_0x500b72['attributes'][_0x376d('0x3c')]?_0x500b72[_0x376d('0x29')]:_0x20a521['model'];_0x500b72[_0x376d('0x4e')]=qs[_0x376d('0x3f')](_0x5e5639['query']['sort']);_0x500b72[_0x376d('0x1c')]=qs['filters'](_[_0x376d('0x40')](_0x5e5639[_0x376d('0x25')],_0x20a521[_0x376d('0x27')]));if(_0x5e5639[_0x376d('0x25')][_0x376d('0x42')]){_0x500b72[_0x376d('0x1c')]=_[_0x376d('0x2c')](_0x500b72[_0x376d('0x1c')],{'$or':_[_0x376d('0x45')](_0x500b72[_0x376d('0x29')],function(_0x1ab0dd){var _0x32cdcf={};_0x32cdcf[_0x1ab0dd]={'$like':'%'+_0x5e5639['query'][_0x376d('0x42')]+'%'};return _0x32cdcf;})});}_0x500b72=_[_0x376d('0x2c')]({},_0x500b72,_0x5e5639[_0x376d('0x2d')]);return _0x3b4a3a[_0x376d('0x70')](_0x500b72);}})[_0x376d('0x12')](function(_0x4651e3){if(_0x4651e3){_0x318d76=_0x4651e3[_0x376d('0x3c')];if(!_0x5e5639[_0x376d('0x25')][_0x376d('0x3d')](_0x376d('0x3e'))){_0x500b72[_0x376d('0xe')]=qs['limit'](_0x5e5639[_0x376d('0x25')]['limit']);_0x500b72['offset']=qs['offset'](_0x5e5639['query']['offset']);}return _0x3b4a3a['getAgents'](_0x500b72);}})[_0x376d('0x12')](function(_0x44c980){if(_0x44c980){return _0x44c980?{'count':_0x318d76,'rows':_0x44c980}:null;}})['then'](respondWithResult(_0xb6ae11,null))[_0x376d('0x21')](handleError(_0xb6ae11,null));}; \ No newline at end of file +var _0x6000=['../../config/environment','../../mysqldb','defaults','redis','./whatsappQueue.socket','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','update','then','WhatsappQueues','UserProfileResource','destroy','stack','name','map','key','getOptions','where','WhatsappQueue','include','query','findAll','rows','catch','show','params','model','keys','rawAttributes','filters','intersection','fields','attributes','length','find','create','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserWhatsappQueue','hasOwnProperty','offset','sort','pick','WhatsappQueueId','filter','merge','User','findAndCountAll','agent','whatsappPause','updatedAt','format','SIP','getTeams','Team','order','options','nolimit','addTeams','ids','Agents','voicePause','interface','transaction','each','forEach','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','every','TeamId','includes','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','emit','userWhatsappQueue:save','getAgents','bluebird','squel','../../components/parsers/qs','../../config/logger','api'];(function(_0x4fd8a9,_0x22f548){var _0x46de98=function(_0x41217c){while(--_0x41217c){_0x4fd8a9['push'](_0x4fd8a9['shift']());}};_0x46de98(++_0x22f548);}(_0x6000,0x1b3));var _0x0600=function(_0x3d976b,_0x1d7144){_0x3d976b=_0x3d976b-0x0;var _0x185452=_0x6000[_0x3d976b];return _0x185452;};'use strict';var BPromise=require(_0x0600('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0x0600('0x1'));var Redis=require('ioredis');var qs=require(_0x0600('0x2'));var logger=require(_0x0600('0x3'))(_0x0600('0x4'));var config=require(_0x0600('0x5'));var db=require(_0x0600('0x6'))['db'];config['redis']=_[_0x0600('0x7')](config[_0x0600('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0600('0x8')]));require(_0x0600('0x9'))['register'](socket);function respondWithStatusCode(_0x5b451f,_0x1216aa){_0x1216aa=_0x1216aa||0xcc;return function(_0x5ddf0c){if(_0x5ddf0c){return _0x5b451f[_0x0600('0xa')](_0x1216aa);}return _0x5b451f[_0x0600('0xb')](_0x1216aa)[_0x0600('0xc')]();};}function respondWithResult(_0x30be2f,_0x3785ef){_0x3785ef=_0x3785ef||0xc8;return function(_0x84d483){if(_0x84d483){return _0x30be2f[_0x0600('0xb')](_0x3785ef)[_0x0600('0xd')](_0x84d483);}};}function respondWithFilteredResult(_0x963f4f,_0xedc2bd){return function(_0x46f88f){if(_0x46f88f){var _0x5d0683=typeof _0xedc2bd['offset']===_0x0600('0xe')&&typeof _0xedc2bd[_0x0600('0xf')]===_0x0600('0xe');var _0x2b001d=_0x46f88f[_0x0600('0x10')];var _0x55aae7=_0x5d0683?0x0:_0xedc2bd['offset'];var _0x5d635f=_0x5d0683?_0x46f88f['count']:_0xedc2bd['offset']+_0xedc2bd['limit'];var _0x5f0592;if(_0x5d635f>=_0x2b001d){_0x5d635f=_0x2b001d;_0x5f0592=0xc8;}else{_0x5f0592=0xce;}_0x963f4f['status'](_0x5f0592);return _0x963f4f[_0x0600('0x11')](_0x0600('0x12'),_0x55aae7+'-'+_0x5d635f+'/'+_0x2b001d)['json'](_0x46f88f);}return null;};}function saveUpdates(_0x47a46d){return function(_0x137e05){if(_0x137e05){return _0x137e05[_0x0600('0x13')](_0x47a46d)[_0x0600('0x14')](function(_0x3d4ee6){return _0x3d4ee6;});}return null;};}function removeEntity(_0x3fbbc8){return function(_0x38072f){if(_0x38072f){return _0x38072f['destroy']()[_0x0600('0x14')](function(){var _0x573087=_0x38072f['get']({'plain':!![]});var _0x91fed3=_0x0600('0x15');return db[_0x0600('0x16')][_0x0600('0x17')]({'where':{'type':_0x91fed3,'resourceId':_0x573087['id']}})[_0x0600('0x14')](function(){return _0x38072f;});})[_0x0600('0x14')](function(){_0x3fbbc8['status'](0xcc)[_0x0600('0xc')]();});}};}function handleEntityNotFound(_0x328314){return function(_0x16b80a){if(!_0x16b80a){_0x328314[_0x0600('0xa')](0x194);}return _0x16b80a;};}function handleError(_0x206e50,_0x531eb4){_0x531eb4=_0x531eb4||0x1f4;return function(_0x455104){logger['error'](_0x455104[_0x0600('0x18')]);if(_0x455104[_0x0600('0x19')]){delete _0x455104['name'];}_0x206e50[_0x0600('0xb')](_0x531eb4)['send'](_0x455104);};}exports['index']=function(_0x5d98f4,_0x1e9a7a){var _0x17b42d={};var _0x3fba48={'count':0x0,'rows':[]};var _0x1776f5=_[_0x0600('0x1a')](db['WhatsappQueue']['rawAttributes'],function(_0x119ad3){return{'name':_0x119ad3['fieldName'],'type':_0x119ad3['type'][_0x0600('0x1b')]};});_0x17b42d=qs[_0x0600('0x1c')](_0x1776f5,_0x5d98f4);var _0x13245c={'where':_0x17b42d[_0x0600('0x1d')]};return db[_0x0600('0x1e')][_0x0600('0x10')](_0x13245c)[_0x0600('0x14')](function(_0x474a23){_0x3fba48[_0x0600('0x10')]=_0x474a23;_0x17b42d[_0x0600('0x1f')]=qs[_0x0600('0x1f')](_0x5d98f4[_0x0600('0x20')]);return db[_0x0600('0x1e')][_0x0600('0x21')](_0x17b42d);})[_0x0600('0x14')](function(_0x4c88ef){_0x3fba48[_0x0600('0x22')]=_0x4c88ef;return _0x3fba48;})[_0x0600('0x14')](respondWithFilteredResult(_0x1e9a7a,_0x17b42d))[_0x0600('0x23')](handleError(_0x1e9a7a,null));};exports[_0x0600('0x24')]=function(_0x4b99a6,_0x378939){var _0x6a919e={'raw':!![],'where':{'id':_0x4b99a6[_0x0600('0x25')]['id']}},_0x59f419={};_0x59f419[_0x0600('0x26')]=_[_0x0600('0x27')](db[_0x0600('0x1e')][_0x0600('0x28')]);_0x59f419[_0x0600('0x20')]=_[_0x0600('0x27')](_0x4b99a6[_0x0600('0x20')]);_0x59f419[_0x0600('0x29')]=_[_0x0600('0x2a')](_0x59f419['model'],_0x59f419[_0x0600('0x20')]);_0x6a919e['attributes']=_[_0x0600('0x2a')](_0x59f419[_0x0600('0x26')],qs[_0x0600('0x2b')](_0x4b99a6['query'][_0x0600('0x2b')]));_0x6a919e[_0x0600('0x2c')]=_0x6a919e[_0x0600('0x2c')][_0x0600('0x2d')]?_0x6a919e['attributes']:_0x59f419[_0x0600('0x26')];if(_0x4b99a6[_0x0600('0x20')]['includeAll']){_0x6a919e[_0x0600('0x1f')]=[{'all':!![]}];}_0x6a919e=_['merge']({},_0x6a919e,_0x4b99a6['options']);return db['WhatsappQueue'][_0x0600('0x2e')](_0x6a919e)[_0x0600('0x14')](handleEntityNotFound(_0x378939,null))[_0x0600('0x14')](respondWithResult(_0x378939,null))[_0x0600('0x23')](handleError(_0x378939,null));};exports[_0x0600('0x2f')]=function(_0x5b32a2,_0x5cad47){return db['WhatsappQueue']['create'](_0x5b32a2['body'],{})['then'](function(_0x2541cb){var _0x16fc06=_0x5b32a2[_0x0600('0x30')][_0x0600('0x31')]({'plain':!![]});if(!_0x16fc06)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16fc06['role']===_0x0600('0x30')){var _0x240a20=_0x2541cb[_0x0600('0x31')]({'plain':!![]});var _0x2ff5a1=_0x0600('0x15');return db[_0x0600('0x32')][_0x0600('0x2e')]({'where':{'name':_0x2ff5a1,'userProfileId':_0x16fc06[_0x0600('0x33')]},'raw':!![]})[_0x0600('0x14')](function(_0x255c9c){if(_0x255c9c&&_0x255c9c[_0x0600('0x34')]===0x0){return db[_0x0600('0x16')]['create']({'name':_0x240a20['name'],'resourceId':_0x240a20['id'],'type':_0x255c9c[_0x0600('0x19')],'sectionId':_0x255c9c['id']},{})[_0x0600('0x14')](function(){return _0x2541cb;});}else{return _0x2541cb;}})['catch'](function(_0xb35bb8){logger['error'](_0x0600('0x35'),_0xb35bb8);throw _0xb35bb8;});}return _0x2541cb;})['then'](respondWithResult(_0x5cad47,0xc9))[_0x0600('0x23')](handleError(_0x5cad47,null));};exports['update']=function(_0x378e42,_0x46ce94){if(_0x378e42[_0x0600('0x36')]['id']){delete _0x378e42[_0x0600('0x36')]['id'];}return db[_0x0600('0x1e')][_0x0600('0x2e')]({'where':{'id':_0x378e42[_0x0600('0x25')]['id']}})[_0x0600('0x14')](handleEntityNotFound(_0x46ce94,null))['then'](saveUpdates(_0x378e42[_0x0600('0x36')],null))[_0x0600('0x14')](respondWithResult(_0x46ce94,null))[_0x0600('0x23')](handleError(_0x46ce94,null));};exports['destroy']=function(_0x5bf491,_0x219a74){return db['WhatsappQueue']['find']({'where':{'id':_0x5bf491[_0x0600('0x25')]['id']}})[_0x0600('0x14')](handleEntityNotFound(_0x219a74,null))[_0x0600('0x14')](removeEntity(_0x219a74,null))[_0x0600('0x23')](handleError(_0x219a74,null));};exports[_0x0600('0x37')]=function(_0x436b46,_0x567399){return db[_0x0600('0x1e')]['describe']()[_0x0600('0x14')](respondWithResult(_0x567399,null))[_0x0600('0x23')](handleError(_0x567399,null));};exports['getMembers']=function(_0x185d3a,_0x4fc55a){var _0x1665b4={'raw':!![],'where':{}},_0x48f845={},_0x1f9d2e;return db[_0x0600('0x1e')][_0x0600('0x38')]({'where':{'id':_0x185d3a[_0x0600('0x25')]['id']}})['then'](handleEntityNotFound(_0x4fc55a,null))['then'](function(_0x1c1e3){if(_0x1c1e3){_0x1f9d2e=_0x1c1e3[_0x0600('0x31')]({'plain':!![]});_0x48f845['model']=_[_0x0600('0x27')](db[_0x0600('0x39')][_0x0600('0x28')]);_0x48f845[_0x0600('0x20')]=_[_0x0600('0x27')](_0x185d3a[_0x0600('0x20')]);_0x48f845[_0x0600('0x29')]=_['intersection'](_0x48f845[_0x0600('0x26')],_0x48f845['query']);_0x1665b4['attributes']=_[_0x0600('0x2a')](_0x48f845['model'],qs[_0x0600('0x2b')](_0x185d3a['query'][_0x0600('0x2b')]));_0x1665b4[_0x0600('0x2c')]=_0x1665b4[_0x0600('0x2c')][_0x0600('0x2d')]?_0x1665b4['attributes']:_0x48f845[_0x0600('0x26')];if(!_0x185d3a['query'][_0x0600('0x3a')]('nolimit')){_0x1665b4[_0x0600('0xf')]=qs['limit'](_0x185d3a['query']['limit']);_0x1665b4[_0x0600('0x3b')]=qs['offset'](_0x185d3a[_0x0600('0x20')][_0x0600('0x3b')]);}_0x1665b4['order']=qs['sort'](_0x185d3a[_0x0600('0x20')][_0x0600('0x3c')]);_0x1665b4['where']=qs[_0x0600('0x29')](_[_0x0600('0x3d')](_0x185d3a['query'],_0x48f845['filters']));_0x1665b4[_0x0600('0x1d')][_0x0600('0x3e')]=_0x1c1e3['id'];if(_0x185d3a[_0x0600('0x20')][_0x0600('0x3f')]){_0x1665b4[_0x0600('0x1d')]=_[_0x0600('0x40')](_0x1665b4[_0x0600('0x1d')],{'$or':_[_0x0600('0x1a')](_0x1665b4[_0x0600('0x2c')],function(_0x44813b){var _0x57467c={};_0x57467c[_0x44813b]={'$like':'%'+_0x185d3a[_0x0600('0x20')][_0x0600('0x3f')]+'%'};return _0x57467c;})});}_0x1665b4=_[_0x0600('0x40')]({},_0x1665b4,_0x185d3a['options']);return db[_0x0600('0x39')][_0x0600('0x21')](_0x1665b4);}})[_0x0600('0x14')](function(_0x219f20){if(_0x219f20){return db[_0x0600('0x41')][_0x0600('0x42')]({'where':{'id':_[_0x0600('0x1a')](_0x219f20,'UserId'),'role':_0x0600('0x43')},'attributes':['id','name',_0x0600('0x44'),_0x0600('0x45'),'createdAt']});}})[_0x0600('0x14')](function(_0x2ed2b2){if(_0x2ed2b2){return{'count':_0x2ed2b2['count'],'rows':_[_0x0600('0x1a')](_0x2ed2b2[_0x0600('0x22')],function(_0x58a6e3){return{'membername':_0x58a6e3[_0x0600('0x19')],'UserId':_0x58a6e3['id'],'queue_name':_0x1f9d2e[_0x0600('0x19')],'WhatsappQueueId':_0x1f9d2e['id'],'interface':util[_0x0600('0x46')]('%s/%s',_0x0600('0x47'),_0x58a6e3[_0x0600('0x19')]),'penalty':0x0,'paused':_0x58a6e3[_0x0600('0x44')],'createdAt':_0x58a6e3['createdAt'],'updatedAt':_0x58a6e3['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4fc55a,_0x1665b4))['catch'](handleError(_0x4fc55a,null));};exports[_0x0600('0x48')]=function(_0x206a71,_0x300944){var _0x3a333f={};var _0x3fadbc={};var _0x9e3129;var _0xbdd594;return db[_0x0600('0x1e')]['findOne']({'where':{'id':_0x206a71[_0x0600('0x25')]['id']}})[_0x0600('0x14')](handleEntityNotFound(_0x300944,null))['then'](function(_0x3262ac){if(_0x3262ac){_0x9e3129=_0x3262ac;_0x3fadbc[_0x0600('0x26')]=_[_0x0600('0x27')](db[_0x0600('0x49')][_0x0600('0x28')]);_0x3fadbc[_0x0600('0x20')]=_['keys'](_0x206a71[_0x0600('0x20')]);_0x3fadbc[_0x0600('0x29')]=_[_0x0600('0x2a')](_0x3fadbc[_0x0600('0x26')],_0x3fadbc[_0x0600('0x20')]);_0x3a333f[_0x0600('0x2c')]=_[_0x0600('0x2a')](_0x3fadbc[_0x0600('0x26')],qs['fields'](_0x206a71['query'][_0x0600('0x2b')]));_0x3a333f[_0x0600('0x2c')]=_0x3a333f[_0x0600('0x2c')]['length']?_0x3a333f[_0x0600('0x2c')]:_0x3fadbc['model'];_0x3a333f[_0x0600('0x4a')]=qs[_0x0600('0x3c')](_0x206a71[_0x0600('0x20')][_0x0600('0x3c')]);_0x3a333f[_0x0600('0x1d')]=qs['filters'](_[_0x0600('0x3d')](_0x206a71[_0x0600('0x20')],_0x3fadbc[_0x0600('0x29')]));if(_0x206a71[_0x0600('0x20')][_0x0600('0x3f')]){_0x3a333f[_0x0600('0x1d')]=_['merge'](_0x3a333f[_0x0600('0x1d')],{'$or':_[_0x0600('0x1a')](_0x3a333f[_0x0600('0x2c')],function(_0x11b3f0){var _0x533152={};_0x533152[_0x11b3f0]={'$like':'%'+_0x206a71[_0x0600('0x20')][_0x0600('0x3f')]+'%'};return _0x533152;})});}_0x3a333f=_[_0x0600('0x40')]({},_0x3a333f,_0x206a71[_0x0600('0x4b')]);return _0x9e3129[_0x0600('0x48')](_0x3a333f);}})[_0x0600('0x14')](function(_0x4b2905){if(_0x4b2905){_0xbdd594=_0x4b2905[_0x0600('0x2d')];if(!_0x206a71['query'][_0x0600('0x3a')](_0x0600('0x4c'))){_0x3a333f[_0x0600('0xf')]=qs[_0x0600('0xf')](_0x206a71['query']['limit']);_0x3a333f[_0x0600('0x3b')]=qs[_0x0600('0x3b')](_0x206a71[_0x0600('0x20')][_0x0600('0x3b')]);}return _0x9e3129[_0x0600('0x48')](_0x3a333f);}})['then'](function(_0x2e96e8){if(_0x2e96e8){return _0x2e96e8?{'count':_0xbdd594,'rows':_0x2e96e8}:null;}})['then'](respondWithResult(_0x300944,null))[_0x0600('0x23')](handleError(_0x300944,null));};exports[_0x0600('0x4d')]=function(_0x5f2431,_0x5b8f19){var _0x12bccc=_0x5f2431['body'][_0x0600('0x4e')];return db[_0x0600('0x49')][_0x0600('0x21')]({'where':{'id':_0x12bccc},'attributes':['id'],'include':[{'model':db[_0x0600('0x41')],'as':_0x0600('0x4f'),'attributes':['id',_0x0600('0x19'),'online',_0x0600('0x50'),_0x0600('0x51')],'raw':!![]}]})[_0x0600('0x14')](function(_0x2ec56b){if(_0x2ec56b){var _0xcba956=_['flatMap'](_0x2ec56b,function(_0x193a5a){var _0x5501d5=_0x193a5a['get']({'plain':!![]});return _0x5501d5[_0x0600('0x4f')];});return db[_0x0600('0x1e')]['find']({'where':{'id':_0x5f2431[_0x0600('0x25')]['id']}})[_0x0600('0x14')](function(_0xadde39){return db['sequelize'][_0x0600('0x52')](function(_0x19067e){return _0xadde39[_0x0600('0x4d')](_0x12bccc,{'transaction':_0x19067e})[_0x0600('0x14')](function(){return BPromise[_0x0600('0x53')](_0xcba956,function(_0x5de8f0){return db[_0x0600('0x39')]['findOrCreate']({'where':{'UserId':_0x5de8f0['id'],'WhatsappQueueId':_0x5f2431[_0x0600('0x25')]['id']},'transaction':_0x19067e});});})[_0x0600('0x14')](function(){_0xcba956[_0x0600('0x54')](function(_0x5e73f5){socket['emit']('userWhatsappQueue:save',{'UserId':_0x5e73f5['id'],'WhatsappQueueId':_0xadde39['id']});});});});});}})['then'](respondWithStatusCode(_0x5b8f19,null))[_0x0600('0x23')](handleError(_0x5b8f19,null));};exports[_0x0600('0x55')]=function(_0x1c85e8,_0x1b3d33){return db[_0x0600('0x49')]['findAll']({'where':{'id':_0x1c85e8[_0x0600('0x20')][_0x0600('0x4e')]},'attributes':['id'],'include':[{'model':db[_0x0600('0x41')],'as':_0x0600('0x4f'),'attributes':['id'],'raw':!![]}]})[_0x0600('0x14')](handleEntityNotFound(_0x1b3d33,null))[_0x0600('0x14')](function(_0x563be0){var _0x34020b=_[_0x0600('0x1a')](_0x563be0,'id');var _0xa3ac4=[];var _0x168fd4=[];var _0x2cb30f=squel[_0x0600('0x56')]();_0x2cb30f[_0x0600('0x57')](_0x0600('0x58'))[_0x0600('0x59')](_0x0600('0x5a'),'tq')['join'](_0x0600('0x5b'),'ut',_0x0600('0x5c'))[_0x0600('0x1d')](_0x0600('0x5d'),_0x1c85e8[_0x0600('0x25')]['id']);for(var _0x1d65c9=0x0;_0x1d65c9<_0x563be0[_0x0600('0x2d')];_0x1d65c9+=0x1){let _0x4963d1=_0x563be0[_0x1d65c9];for(var _0xbe80b9=0x0;_0xbe80b9<_0x4963d1[_0x0600('0x4f')]['length'];_0xbe80b9+=0x1){let _0x25ce9f=_0x4963d1[_0x0600('0x4f')][_0xbe80b9];var _0x59d9da=_0x2cb30f[_0x0600('0x5e')]();_0x59d9da['where'](_0x0600('0x5f'),_0x25ce9f['id']);_0x168fd4[_0x0600('0x60')](db[_0x0600('0x61')][_0x0600('0x20')](_0x59d9da['toString'](),{'type':db[_0x0600('0x61')][_0x0600('0x62')]['SELECT']})['then'](function(_0x30e72a){if(_0x30e72a[_0x0600('0x2d')]===0x1){return _0x25ce9f['id'];}else{var _0x2f2482=_[_0x0600('0x63')](_[_0x0600('0x1a')](_0x30e72a,_0x0600('0x64')),function(_0x2318ba){return _[_0x0600('0x65')](_0x34020b,_0x2318ba);});if(_0x2f2482){return _0x25ce9f['id'];}}}));}}return BPromise['all'](_0x168fd4)[_0x0600('0x14')](function(_0x47c3a2){_0xa3ac4=_(_0xa3ac4)['union'](_0x47c3a2)['compact']()[_0x0600('0x66')]();return db[_0x0600('0x1e')][_0x0600('0x2e')]({'where':{'id':_0x1c85e8[_0x0600('0x25')]['id']}})['then'](function(_0x4e27fc){return db[_0x0600('0x61')][_0x0600('0x52')](function(_0x3bd4db){return _0x4e27fc['removeTeams'](_0x1c85e8['query'][_0x0600('0x4e')],{'transaction':_0x3bd4db})[_0x0600('0x14')](function(){if(!_[_0x0600('0x67')](_0xa3ac4)){return _0x4e27fc[_0x0600('0x68')](_0xa3ac4,{'transaction':_0x3bd4db});}})[_0x0600('0x14')](function(){_0xa3ac4[_0x0600('0x54')](function(_0x199402){socket['emit'](_0x0600('0x69'),{'UserId':_0x199402,'WhatsappQueueId':_0x4e27fc['id']});});});});});});})[_0x0600('0x14')](respondWithStatusCode(_0x1b3d33,null))['catch'](handleError(_0x1b3d33,null));};exports['addAgents']=function(_0xcc42a3,_0x2a88ea){return db[_0x0600('0x1e')][_0x0600('0x2e')]({'where':{'id':_0xcc42a3['params']['id']}})[_0x0600('0x14')](handleEntityNotFound(_0x2a88ea,null))[_0x0600('0x14')](function(_0x4118ba){if(_0x4118ba){return _0x4118ba[_0x0600('0x6a')](_0xcc42a3['body']['ids'],_['omit'](_0xcc42a3['body'],[_0x0600('0x4e'),'id'])||{})['spread'](function(_0x2d6d83){for(var _0x28e711=0x0;_0x28e711<_0xcc42a3['body'][_0x0600('0x4e')][_0x0600('0x2d')];_0x28e711+=0x1){socket[_0x0600('0x6b')](_0x0600('0x6c'),{'UserId':Number(_0xcc42a3[_0x0600('0x36')][_0x0600('0x4e')][_0x28e711]),'WhatsappQueueId':Number(_0xcc42a3[_0x0600('0x25')]['id'])});}return _0x2d6d83;});}})['then'](respondWithResult(_0x2a88ea,null))[_0x0600('0x23')](handleError(_0x2a88ea,null));};exports['removeAgents']=function(_0x54acd3,_0x5de07c){return db[_0x0600('0x1e')][_0x0600('0x2e')]({'where':{'id':_0x54acd3[_0x0600('0x25')]['id']}})[_0x0600('0x14')](handleEntityNotFound(_0x5de07c,null))[_0x0600('0x14')](function(_0x1cadd4){if(_0x1cadd4){return _0x1cadd4[_0x0600('0x68')](_0x54acd3['query'][_0x0600('0x4e')])['then'](function(){if(_['isArray'](_0x54acd3[_0x0600('0x20')][_0x0600('0x4e')])){for(var _0x1aa617=0x0;_0x1aa617<_0x54acd3[_0x0600('0x20')]['ids']['length'];_0x1aa617+=0x1){socket[_0x0600('0x6b')](_0x0600('0x69'),{'UserId':Number(_0x54acd3[_0x0600('0x20')]['ids'][_0x1aa617]),'WhatsappQueueId':Number(_0x54acd3[_0x0600('0x25')]['id'])});}}else{socket[_0x0600('0x6b')](_0x0600('0x69'),{'UserId':Number(_0x54acd3[_0x0600('0x20')][_0x0600('0x4e')]),'WhatsappQueueId':Number(_0x54acd3[_0x0600('0x25')]['id'])});}});}})[_0x0600('0x14')](respondWithStatusCode(_0x5de07c,null))[_0x0600('0x23')](handleError(_0x5de07c,null));};exports[_0x0600('0x6d')]=function(_0x4495cf,_0x36eab0){var _0x3ccdcf={};var _0x376c6a={};var _0x243d24;var _0x371dfc;return db[_0x0600('0x1e')][_0x0600('0x38')]({'where':{'id':_0x4495cf[_0x0600('0x25')]['id']}})[_0x0600('0x14')](handleEntityNotFound(_0x36eab0,null))['then'](function(_0x5a566a){if(_0x5a566a){_0x243d24=_0x5a566a;_0x376c6a[_0x0600('0x26')]=_[_0x0600('0x27')](db[_0x0600('0x41')][_0x0600('0x28')]);_0x376c6a[_0x0600('0x20')]=_[_0x0600('0x27')](_0x4495cf[_0x0600('0x20')]);_0x376c6a[_0x0600('0x29')]=_[_0x0600('0x2a')](_0x376c6a[_0x0600('0x26')],_0x376c6a[_0x0600('0x20')]);_0x3ccdcf[_0x0600('0x2c')]=_[_0x0600('0x2a')](_0x376c6a[_0x0600('0x26')],qs[_0x0600('0x2b')](_0x4495cf[_0x0600('0x20')][_0x0600('0x2b')]));_0x3ccdcf[_0x0600('0x2c')]=_0x3ccdcf['attributes'][_0x0600('0x2d')]?_0x3ccdcf[_0x0600('0x2c')]:_0x376c6a['model'];_0x3ccdcf[_0x0600('0x4a')]=qs[_0x0600('0x3c')](_0x4495cf[_0x0600('0x20')][_0x0600('0x3c')]);_0x3ccdcf[_0x0600('0x1d')]=qs[_0x0600('0x29')](_['pick'](_0x4495cf[_0x0600('0x20')],_0x376c6a[_0x0600('0x29')]));if(_0x4495cf[_0x0600('0x20')][_0x0600('0x3f')]){_0x3ccdcf[_0x0600('0x1d')]=_['merge'](_0x3ccdcf['where'],{'$or':_['map'](_0x3ccdcf[_0x0600('0x2c')],function(_0x2789aa){var _0x358c82={};_0x358c82[_0x2789aa]={'$like':'%'+_0x4495cf[_0x0600('0x20')][_0x0600('0x3f')]+'%'};return _0x358c82;})});}_0x3ccdcf=_[_0x0600('0x40')]({},_0x3ccdcf,_0x4495cf[_0x0600('0x4b')]);return _0x243d24['getAgents'](_0x3ccdcf);}})[_0x0600('0x14')](function(_0x2238f3){if(_0x2238f3){_0x371dfc=_0x2238f3['length'];if(!_0x4495cf[_0x0600('0x20')]['hasOwnProperty']('nolimit')){_0x3ccdcf[_0x0600('0xf')]=qs[_0x0600('0xf')](_0x4495cf['query'][_0x0600('0xf')]);_0x3ccdcf['offset']=qs[_0x0600('0x3b')](_0x4495cf[_0x0600('0x20')][_0x0600('0x3b')]);}return _0x243d24['getAgents'](_0x3ccdcf);}})[_0x0600('0x14')](function(_0x3bf97b){if(_0x3bf97b){return _0x3bf97b?{'count':_0x371dfc,'rows':_0x3bf97b}:null;}})['then'](respondWithResult(_0x36eab0,null))['catch'](handleError(_0x36eab0,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 77f97b9..684c7f5 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 _0xe12d=['exports','../../mysqldb','WhatsappQueue','setMaxListeners','update','remove','emit','hook'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xe12d,0x141));var _0xde12=function(_0x16364f,_0x5560f2){_0x16364f=_0x16364f-0x0;var _0x30f7a5=_0xe12d[_0x16364f];return _0x30f7a5;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xde12('0x0'))['db'][_0xde12('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xde12('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xde12('0x3'),'afterDestroy':_0xde12('0x4')};function emitEvent(_0x4a511d){return function(_0x50282b,_0x57e6a0,_0x3b5ecd){WhatsappQueueEvents[_0xde12('0x5')](_0x4a511d+':'+_0x50282b['id'],_0x50282b);WhatsappQueueEvents['emit'](_0x4a511d,_0x50282b);_0x3b5ecd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xde12('0x6')](e,emitEvent(event));}}module[_0xde12('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x54cc=['events','../../mysqldb','WhatsappQueue','setMaxListeners','update','hasOwnProperty','exports'];(function(_0x362a8d,_0x5af85b){var _0xa2cd8b=function(_0x33d193){while(--_0x33d193){_0x362a8d['push'](_0x362a8d['shift']());}};_0xa2cd8b(++_0x5af85b);}(_0x54cc,0x188));var _0xc54c=function(_0x286ccc,_0x4d454c){_0x286ccc=_0x286ccc-0x0;var _0xc47055=_0x54cc[_0x286ccc];return _0xc47055;};'use strict';var EventEmitter=require(_0xc54c('0x0'));var WhatsappQueue=require(_0xc54c('0x1'))['db'][_0xc54c('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xc54c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc54c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x570cab){return function(_0x30c23f,_0x160457,_0x4a3a6e){WhatsappQueueEvents['emit'](_0x570cab+':'+_0x30c23f['id'],_0x30c23f);WhatsappQueueEvents['emit'](_0x570cab,_0x30c23f);_0x4a3a6e(null);};}for(var e in events){if(events[_0xc54c('0x5')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xc54c('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 8a2fc35..1dab689 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 _0xcbfc=['lodash','../../config/logger','moment','bluebird','../../config/environment','./whatsappQueue.attributes','WhatsappQueue'];(function(_0x262fd8,_0x419cc3){var _0x401de5=function(_0x376629){while(--_0x376629){_0x262fd8['push'](_0x262fd8['shift']());}};_0x401de5(++_0x419cc3);}(_0xcbfc,0x7e));var _0xccbf=function(_0x7eb333,_0x32ad48){_0x7eb333=_0x7eb333-0x0;var _0x8c57d=_0xcbfc[_0x7eb333];return _0x8c57d;};'use strict';var _=require(_0xccbf('0x0'));var util=require('util');var logger=require(_0xccbf('0x1'))('api');var moment=require(_0xccbf('0x2'));var BPromise=require(_0xccbf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xccbf('0x4'));var attributes=require(_0xccbf('0x5'));module['exports']=function(_0x2f8d48,_0x2a0992){return _0x2f8d48['define'](_0xccbf('0x6'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2b1=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','WhatsappQueue','whatsapp_queues'];(function(_0x2e86d0,_0x1399a9){var _0xd19e06=function(_0x2ee50f){while(--_0x2ee50f){_0x2e86d0['push'](_0x2e86d0['shift']());}};_0xd19e06(++_0x1399a9);}(_0xa2b1,0x181));var _0x1a2b=function(_0x597782,_0x4aaca8){_0x597782=_0x597782-0x0;var _0x524552=_0xa2b1[_0x597782];return _0x524552;};'use strict';var _=require(_0x1a2b('0x0'));var util=require(_0x1a2b('0x1'));var logger=require(_0x1a2b('0x2'))(_0x1a2b('0x3'));var moment=require(_0x1a2b('0x4'));var BPromise=require('bluebird');var rp=require(_0x1a2b('0x5'));var fs=require('fs');var path=require(_0x1a2b('0x6'));var rimraf=require(_0x1a2b('0x7'));var config=require(_0x1a2b('0x8'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x44a6ff,_0xbccc81){return _0x44a6ff['define'](_0x1a2b('0x9'),attributes,{'tableName':_0x1a2b('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 21a26ae..ae9352d 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 _0xe1fd=['WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','WhatsappQueue','ShowWhatsappQueue','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug'];(function(_0x38c893,_0x534d7f){var _0x1f6ff0=function(_0x2c21a7){while(--_0x2c21a7){_0x38c893['push'](_0x38c893['shift']());}};_0x1f6ff0(++_0x534d7f);}(_0xe1fd,0xbc));var _0xde1f=function(_0x469a3c,_0x46ce3c){_0x469a3c=_0x469a3c-0x0;var _0x29a1fd=_0xe1fd[_0x469a3c];return _0x29a1fd;};'use strict';var _=require(_0xde1f('0x0'));var util=require(_0xde1f('0x1'));var moment=require(_0xde1f('0x2'));var BPromise=require(_0xde1f('0x3'));var rs=require(_0xde1f('0x4'));var fs=require('fs');var Redis=require(_0xde1f('0x5'));var db=require(_0xde1f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xde1f('0x7'));var config=require(_0xde1f('0x8'));var jayson=require(_0xde1f('0x9'));var client=jayson[_0xde1f('0xa')]['http']({'port':0x232a});config[_0xde1f('0xb')]=_[_0xde1f('0xc')](config[_0xde1f('0xb')],{'host':_0xde1f('0xd'),'port':0x18eb});var socket=require(_0xde1f('0xe'))(new Redis(config[_0xde1f('0xb')]));require(_0xde1f('0xf'))[_0xde1f('0x10')](socket);function respondWithRpcPromise(_0x2aecd8,_0x43c007,_0x47c6c8){return new BPromise(function(_0x55bbb4,_0x5b1345){return client[_0xde1f('0x11')](_0x2aecd8,_0x47c6c8)[_0xde1f('0x12')](function(_0x461c3f){logger[_0xde1f('0x13')](_0xde1f('0x14'),_0x43c007,'request\x20sent');logger[_0xde1f('0x15')](_0xde1f('0x16'),_0x43c007,_0xde1f('0x17'),JSON['stringify'](_0x461c3f));if(_0x461c3f[_0xde1f('0x18')]){if(_0x461c3f[_0xde1f('0x18')][_0xde1f('0x19')]===0x1f4){logger[_0xde1f('0x18')](_0xde1f('0x14'),_0x43c007,_0x461c3f[_0xde1f('0x18')][_0xde1f('0x1a')]);return _0x5b1345(_0x461c3f[_0xde1f('0x18')]['message']);}logger['error'](_0xde1f('0x14'),_0x43c007,_0x461c3f[_0xde1f('0x18')][_0xde1f('0x1a')]);return _0x55bbb4(_0x461c3f['error'][_0xde1f('0x1a')]);}else{logger[_0xde1f('0x13')](_0xde1f('0x14'),_0x43c007,'request\x20sent');_0x55bbb4(_0x461c3f[_0xde1f('0x1b')][_0xde1f('0x1a')]);}})[_0xde1f('0x1c')](function(_0x32dd45){logger[_0xde1f('0x18')](_0xde1f('0x14'),_0x43c007,_0x32dd45);_0x5b1345(_0x32dd45);});});}exports[_0xde1f('0x1d')]=function(_0x30056e){var _0x25cba6=this;return new Promise(function(_0x538cb0,_0x1ac88c){return db['WhatsappQueue'][_0xde1f('0x1e')]({'raw':_0x30056e[_0xde1f('0x1f')]?_0x30056e[_0xde1f('0x1f')][_0xde1f('0x20')]===undefined?!![]:![]:!![],'where':_0x30056e[_0xde1f('0x1f')]?_0x30056e[_0xde1f('0x1f')][_0xde1f('0x21')]||null:null,'attributes':_0x30056e[_0xde1f('0x1f')]?_0x30056e[_0xde1f('0x1f')][_0xde1f('0x22')]||null:null,'limit':_0x30056e[_0xde1f('0x1f')]?_0x30056e[_0xde1f('0x1f')][_0xde1f('0x23')]||null:null,'include':_0x30056e[_0xde1f('0x1f')]?_0x30056e[_0xde1f('0x1f')][_0xde1f('0x24')]?_['map'](_0x30056e['options']['include'],function(_0x14002e){return{'model':db[_0x14002e['model']],'as':_0x14002e['as'],'attributes':_0x14002e['attributes'],'include':_0x14002e[_0xde1f('0x24')]?_[_0xde1f('0x25')](_0x14002e[_0xde1f('0x24')],function(_0x450004){return{'model':db[_0x450004[_0xde1f('0x26')]],'as':_0x450004['as'],'attributes':_0x450004[_0xde1f('0x22')],'include':_0x450004[_0xde1f('0x24')]?_['map'](_0x450004[_0xde1f('0x24')],function(_0x112869){return{'model':db[_0x112869[_0xde1f('0x26')]],'as':_0x112869['as'],'attributes':_0x112869['attributes']};}):[]};}):[]};}):[]:[]})[_0xde1f('0x12')](function(_0x485b39){logger[_0xde1f('0x13')](_0xde1f('0x1d'),_0x30056e);logger[_0xde1f('0x15')]('GetWhatsappQueue',_0x30056e,JSON['stringify'](_0x485b39));_0x538cb0(_0x485b39);})[_0xde1f('0x1c')](function(_0x290f1c){logger[_0xde1f('0x18')](_0xde1f('0x1d'),_0x290f1c[_0xde1f('0x1a')],_0x30056e);_0x1ac88c(_0x25cba6[_0xde1f('0x18')](0x1f4,_0x290f1c[_0xde1f('0x1a')]));});});};exports['ShowWhatsappQueue']=function(_0x119959){var _0x248fff=this;return new Promise(function(_0x22c999,_0x2d6ab4){return db[_0xde1f('0x27')]['find']({'raw':_0x119959['options']?_0x119959[_0xde1f('0x1f')][_0xde1f('0x20')]===undefined?!![]:![]:!![],'where':_0x119959[_0xde1f('0x1f')]?_0x119959['options']['where']||null:null,'attributes':_0x119959[_0xde1f('0x1f')]?_0x119959[_0xde1f('0x1f')][_0xde1f('0x22')]||null:null,'include':_0x119959[_0xde1f('0x1f')]?_0x119959[_0xde1f('0x1f')]['include']?_['map'](_0x119959[_0xde1f('0x1f')]['include'],function(_0x404479){return{'model':db[_0x404479[_0xde1f('0x26')]],'as':_0x404479['as'],'attributes':_0x404479['attributes'],'include':_0x404479[_0xde1f('0x24')]?_[_0xde1f('0x25')](_0x404479[_0xde1f('0x24')],function(_0x5bf1b0){return{'model':db[_0x5bf1b0['model']],'as':_0x5bf1b0['as'],'attributes':_0x5bf1b0[_0xde1f('0x22')],'include':_0x5bf1b0[_0xde1f('0x24')]?_['map'](_0x5bf1b0[_0xde1f('0x24')],function(_0x5bb059){return{'model':db[_0x5bb059[_0xde1f('0x26')]],'as':_0x5bb059['as'],'attributes':_0x5bb059[_0xde1f('0x22')]};}):[]};}):[]};}):[]:[]})[_0xde1f('0x12')](function(_0x11ed61){logger['info']('ShowWhatsappQueue',_0x119959);logger['debug'](_0xde1f('0x28'),_0x119959,JSON[_0xde1f('0x29')](_0x11ed61));_0x22c999(_0x11ed61);})[_0xde1f('0x1c')](function(_0x11338a){logger[_0xde1f('0x18')](_0xde1f('0x28'),_0x11338a[_0xde1f('0x1a')],_0x119959);_0x2d6ab4(_0x248fff[_0xde1f('0x18')](0x1f4,_0x11338a[_0xde1f('0x1a')]));});});}; \ No newline at end of file +var _0x7de8=['attributes','model','debug','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetWhatsappQueue','raw','options','where','limit','include','map'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x7de8,0x19b));var _0x87de=function(_0x1aa666,_0x7b1e23){_0x1aa666=_0x1aa666-0x0;var _0x2e324f=_0x7de8[_0x1aa666];return _0x2e324f;};'use strict';var _=require(_0x87de('0x0'));var util=require(_0x87de('0x1'));var moment=require(_0x87de('0x2'));var BPromise=require(_0x87de('0x3'));var rs=require(_0x87de('0x4'));var fs=require('fs');var Redis=require(_0x87de('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x87de('0x6'));var logger=require(_0x87de('0x7'))('rpc');var config=require(_0x87de('0x8'));var jayson=require(_0x87de('0x9'));var client=jayson[_0x87de('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x87de('0xb')],{'host':_0x87de('0xc'),'port':0x18eb});var socket=require(_0x87de('0xd'))(new Redis(config[_0x87de('0xb')]));require(_0x87de('0xe'))[_0x87de('0xf')](socket);function respondWithRpcPromise(_0x27fdc9,_0x191213,_0x3547ae){return new BPromise(function(_0x18f9c7,_0x1239aa){return client[_0x87de('0x10')](_0x27fdc9,_0x3547ae)[_0x87de('0x11')](function(_0x30ab66){logger[_0x87de('0x12')](_0x87de('0x13'),_0x191213,_0x87de('0x14'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x191213,_0x87de('0x14'),JSON[_0x87de('0x15')](_0x30ab66));if(_0x30ab66['error']){if(_0x30ab66[_0x87de('0x16')]['code']===0x1f4){logger[_0x87de('0x16')](_0x87de('0x13'),_0x191213,_0x30ab66[_0x87de('0x16')][_0x87de('0x17')]);return _0x1239aa(_0x30ab66[_0x87de('0x16')][_0x87de('0x17')]);}logger[_0x87de('0x16')](_0x87de('0x13'),_0x191213,_0x30ab66['error'][_0x87de('0x17')]);return _0x18f9c7(_0x30ab66[_0x87de('0x16')][_0x87de('0x17')]);}else{logger[_0x87de('0x12')](_0x87de('0x13'),_0x191213,_0x87de('0x14'));_0x18f9c7(_0x30ab66[_0x87de('0x18')][_0x87de('0x17')]);}})[_0x87de('0x19')](function(_0xb3ff0e){logger[_0x87de('0x16')](_0x87de('0x13'),_0x191213,_0xb3ff0e);_0x1239aa(_0xb3ff0e);});});}exports[_0x87de('0x1a')]=function(_0x5f317a){var _0x233c9c=this;return new Promise(function(_0x40e7e9,_0x2cb585){return db['WhatsappQueue']['findAll']({'raw':_0x5f317a['options']?_0x5f317a['options'][_0x87de('0x1b')]===undefined?!![]:![]:!![],'where':_0x5f317a[_0x87de('0x1c')]?_0x5f317a[_0x87de('0x1c')][_0x87de('0x1d')]||null:null,'attributes':_0x5f317a['options']?_0x5f317a[_0x87de('0x1c')]['attributes']||null:null,'limit':_0x5f317a[_0x87de('0x1c')]?_0x5f317a[_0x87de('0x1c')][_0x87de('0x1e')]||null:null,'include':_0x5f317a[_0x87de('0x1c')]?_0x5f317a[_0x87de('0x1c')][_0x87de('0x1f')]?_[_0x87de('0x20')](_0x5f317a['options']['include'],function(_0x5ebde5){return{'model':db[_0x5ebde5['model']],'as':_0x5ebde5['as'],'attributes':_0x5ebde5['attributes'],'include':_0x5ebde5[_0x87de('0x1f')]?_[_0x87de('0x20')](_0x5ebde5[_0x87de('0x1f')],function(_0x27f741){return{'model':db[_0x27f741['model']],'as':_0x27f741['as'],'attributes':_0x27f741[_0x87de('0x21')],'include':_0x27f741['include']?_[_0x87de('0x20')](_0x27f741[_0x87de('0x1f')],function(_0x5b1bb5){return{'model':db[_0x5b1bb5[_0x87de('0x22')]],'as':_0x5b1bb5['as'],'attributes':_0x5b1bb5[_0x87de('0x21')]};}):[]};}):[]};}):[]:[]})[_0x87de('0x11')](function(_0x2d73e){logger['info'](_0x87de('0x1a'),_0x5f317a);logger[_0x87de('0x23')](_0x87de('0x1a'),_0x5f317a,JSON[_0x87de('0x15')](_0x2d73e));_0x40e7e9(_0x2d73e);})[_0x87de('0x19')](function(_0x441283){logger['error']('GetWhatsappQueue',_0x441283['message'],_0x5f317a);_0x2cb585(_0x233c9c[_0x87de('0x16')](0x1f4,_0x441283['message']));});});};exports[_0x87de('0x24')]=function(_0x43021c){var _0x14b89d=this;return new Promise(function(_0x299cb4,_0x12d380){return db['WhatsappQueue']['find']({'raw':_0x43021c[_0x87de('0x1c')]?_0x43021c[_0x87de('0x1c')][_0x87de('0x1b')]===undefined?!![]:![]:!![],'where':_0x43021c[_0x87de('0x1c')]?_0x43021c[_0x87de('0x1c')][_0x87de('0x1d')]||null:null,'attributes':_0x43021c[_0x87de('0x1c')]?_0x43021c[_0x87de('0x1c')][_0x87de('0x21')]||null:null,'include':_0x43021c['options']?_0x43021c[_0x87de('0x1c')]['include']?_[_0x87de('0x20')](_0x43021c[_0x87de('0x1c')][_0x87de('0x1f')],function(_0x5a8314){return{'model':db[_0x5a8314['model']],'as':_0x5a8314['as'],'attributes':_0x5a8314['attributes'],'include':_0x5a8314[_0x87de('0x1f')]?_['map'](_0x5a8314[_0x87de('0x1f')],function(_0x149aad){return{'model':db[_0x149aad[_0x87de('0x22')]],'as':_0x149aad['as'],'attributes':_0x149aad['attributes'],'include':_0x149aad[_0x87de('0x1f')]?_['map'](_0x149aad[_0x87de('0x1f')],function(_0xae46d){return{'model':db[_0xae46d[_0x87de('0x22')]],'as':_0xae46d['as'],'attributes':_0xae46d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bc476){logger[_0x87de('0x12')]('ShowWhatsappQueue',_0x43021c);logger[_0x87de('0x23')]('ShowWhatsappQueue',_0x43021c,JSON['stringify'](_0x3bc476));_0x299cb4(_0x3bc476);})['catch'](function(_0x56d868){logger[_0x87de('0x16')](_0x87de('0x24'),_0x56d868[_0x87de('0x17')],_0x43021c);_0x12d380(_0x14b89d[_0x87de('0x16')](0x1f4,_0x56d868['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 6f4306a..b0e58bd 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 _0x2b41=['emit','removeListener','register','whatsappQueue:','save','remove','update'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x2b41,0x1bd));var _0x12b4=function(_0x45ffc0,_0x4f090b){_0x45ffc0=_0x45ffc0-0x0;var _0x1f0074=_0x2b41[_0x45ffc0];return _0x1f0074;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x12b4('0x0'),_0x12b4('0x1'),_0x12b4('0x2')];function createListener(_0x47c42b,_0x17dfb6){return function(_0x228739){_0x17dfb6[_0x12b4('0x3')](_0x47c42b,_0x228739);};}function removeListener(_0x276bf5,_0x4547cc){return function(){WhatsappQueueEvents[_0x12b4('0x4')](_0x276bf5,_0x4547cc);};}exports[_0x12b4('0x5')]=function(_0x9d2f2b){for(var _0x2f2e5d=0x0,_0xc987a5=events['length'];_0x2f2e5d<_0xc987a5;_0x2f2e5d++){var _0x534b7b=events[_0x2f2e5d];var _0x50ccf6=createListener(_0x12b4('0x6')+_0x534b7b,_0x9d2f2b);WhatsappQueueEvents['on'](_0x534b7b,_0x50ccf6);}}; \ No newline at end of file +var _0x9fb1=['./whatsappQueue.events','remove','update','emit','removeListener','register','whatsappQueue:'];(function(_0x3d2563,_0x2dd934){var _0x39bb45=function(_0x16a60f){while(--_0x16a60f){_0x3d2563['push'](_0x3d2563['shift']());}};_0x39bb45(++_0x2dd934);}(_0x9fb1,0x11f));var _0x19fb=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x9fb1[_0x278e3c];return _0x3e2d9b;};'use strict';var WhatsappQueueEvents=require(_0x19fb('0x0'));var events=['save',_0x19fb('0x1'),_0x19fb('0x2')];function createListener(_0x16e3f1,_0x316938){return function(_0x5a0c42){_0x316938[_0x19fb('0x3')](_0x16e3f1,_0x5a0c42);};}function removeListener(_0x58e6b0,_0x473b0f){return function(){WhatsappQueueEvents[_0x19fb('0x4')](_0x58e6b0,_0x473b0f);};}exports[_0x19fb('0x5')]=function(_0x2564bf){for(var _0x228ea6=0x0,_0x273db1=events['length'];_0x228ea6<_0x273db1;_0x228ea6++){var _0xb1e66f=events[_0x228ea6];var _0x29c642=createListener(_0x19fb('0x6')+_0xb1e66f,_0x2564bf);WhatsappQueueEvents['on'](_0xb1e66f,_0x29c642);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index e171a81..c64bf4c 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 _0x6c18=['/describe','show','post','create','/:id','exports','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get'];(function(_0x1dbd91,_0xed2f59){var _0xd2f56e=function(_0x38f033){while(--_0x38f033){_0x1dbd91['push'](_0x1dbd91['shift']());}};_0xd2f56e(++_0xed2f59);}(_0x6c18,0x1a6));var _0x86c1=function(_0x35664e,_0x29e712){_0x35664e=_0x35664e-0x0;var _0x384248=_0x6c18[_0x35664e];return _0x384248;};'use strict';var multer=require('multer');var util=require(_0x86c1('0x0'));var path=require(_0x86c1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x86c1('0x2')]();var fs_extra=require(_0x86c1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86c1('0x4'));var config=require(_0x86c1('0x5'));var controller=require(_0x86c1('0x6'));router['get']('/',auth[_0x86c1('0x7')](),controller[_0x86c1('0x8')]);router[_0x86c1('0x9')](_0x86c1('0xa'),auth[_0x86c1('0x7')](),controller['describe']);router[_0x86c1('0x9')]('/:id',auth[_0x86c1('0x7')](),controller[_0x86c1('0xb')]);router[_0x86c1('0xc')]('/',auth[_0x86c1('0x7')](),controller[_0x86c1('0xd')]);router['put'](_0x86c1('0xe'),auth[_0x86c1('0x7')](),controller['update']);router['delete'](_0x86c1('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x86c1('0xf')]=router; \ No newline at end of file +var _0x746e=['Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x291375,_0x50e584){var _0x59d3a2=function(_0x24486f){while(--_0x24486f){_0x291375['push'](_0x291375['shift']());}};_0x59d3a2(++_0x50e584);}(_0x746e,0x140));var _0xe746=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0x746e[_0x56740a];return _0x257144;};'use strict';var multer=require(_0xe746('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe746('0x1'));var express=require(_0xe746('0x2'));var router=express[_0xe746('0x3')]();var fs_extra=require(_0xe746('0x4'));var auth=require(_0xe746('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe746('0x6'));var controller=require(_0xe746('0x7'));router['get']('/',auth[_0xe746('0x8')](),controller[_0xe746('0x9')]);router[_0xe746('0xa')](_0xe746('0xb'),auth['isAuthenticated'](),controller[_0xe746('0xc')]);router[_0xe746('0xa')](_0xe746('0xd'),auth['isAuthenticated'](),controller[_0xe746('0xe')]);router[_0xe746('0xf')]('/',auth[_0xe746('0x8')](),controller['create']);router['put'](_0xe746('0xd'),auth[_0xe746('0x8')](),controller['update']);router[_0xe746('0x10')](_0xe746('0xd'),auth[_0xe746('0x8')](),controller[_0xe746('0x11')]);module[_0xe746('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 67b13ff..249034a 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(_0x52e5e7,_0x173240){var _0x1299d9=function(_0x278e91){while(--_0x278e91){_0x52e5e7['push'](_0x52e5e7['shift']());}};_0x1299d9(++_0x173240);}(_0x7a54,0x106));var _0x47a5=function(_0x342992,_0x30b411){_0x342992=_0x342992-0x0;var _0x117b0e=_0x7a54[_0x342992];return _0x117b0e;};'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(_0x157978,_0x6797e7){var _0x18a376=function(_0xaf7f94){while(--_0xaf7f94){_0x157978['push'](_0x157978['shift']());}};_0x18a376(++_0x6797e7);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'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 93eba50..4b51940 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 _0x4b17=['save','update','then','destroy','end','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','describe','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply'];(function(_0x419767,_0x3d8a22){var _0x114297=function(_0x2555f7){while(--_0x2555f7){_0x419767['push'](_0x419767['shift']());}};_0x114297(++_0x3d8a22);}(_0x4b17,0x10f));var _0x74b1=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0x4b17[_0x2e04ef];return _0x5722b0;};'use strict';var emlformat=require(_0x74b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74b1('0x2'));var moment=require(_0x74b1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x74b1('0x4'));var util=require('util');var path=require('path');var sox=require(_0x74b1('0x5'));var csv=require(_0x74b1('0x6'));var ejs=require(_0x74b1('0x7'));var fs=require('fs');var fs_extra=require(_0x74b1('0x8'));var _=require(_0x74b1('0x9'));var squel=require(_0x74b1('0xa'));var crypto=require(_0x74b1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x74b1('0xc'));var toCsv=require(_0x74b1('0x6'));var querystring=require(_0x74b1('0xd'));var Papa=require(_0x74b1('0xe'));var Redis=require(_0x74b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x74b1('0x10'));var as=require(_0x74b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74b1('0x12'))(_0x74b1('0x13'));var utils=require(_0x74b1('0x14'));var config=require(_0x74b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x74b1('0x16'))['db'];function respondWithStatusCode(_0x5cfe85,_0x5f2865){_0x5f2865=_0x5f2865||0xcc;return function(_0x239d04){if(_0x239d04){return _0x5cfe85[_0x74b1('0x17')](_0x5f2865);}return _0x5cfe85['status'](_0x5f2865)['end']();};}function respondWithResult(_0x500ce2,_0x86390){_0x86390=_0x86390||0xc8;return function(_0x5c12eb){if(_0x5c12eb){return _0x500ce2['status'](_0x86390)[_0x74b1('0x18')](_0x5c12eb);}};}function respondWithFilteredResult(_0x12a2c0,_0x3779c5){return function(_0x420662){if(_0x420662){var _0x16b147=typeof _0x3779c5[_0x74b1('0x19')]==='undefined'&&typeof _0x3779c5[_0x74b1('0x1a')]===_0x74b1('0x1b');var _0x1a0851=_0x420662[_0x74b1('0x1c')];var _0xde2736=_0x16b147?0x0:_0x3779c5[_0x74b1('0x19')];var _0x1ab838=_0x16b147?_0x420662['count']:_0x3779c5[_0x74b1('0x19')]+_0x3779c5[_0x74b1('0x1a')];var _0x524ece;if(_0x1ab838>=_0x1a0851){_0x1ab838=_0x1a0851;_0x524ece=0xc8;}else{_0x524ece=0xce;}_0x12a2c0[_0x74b1('0x1d')](_0x524ece);return _0x12a2c0[_0x74b1('0x1e')](_0x74b1('0x1f'),_0xde2736+'-'+_0x1ab838+'/'+_0x1a0851)[_0x74b1('0x18')](_0x420662);}return null;};}function patchUpdates(_0x13bb44){return function(_0x33fee9){try{jsonpatch[_0x74b1('0x20')](_0x33fee9,_0x13bb44,!![]);}catch(_0xaac5f7){return BPromise['reject'](_0xaac5f7);}return _0x33fee9[_0x74b1('0x21')]();};}function saveUpdates(_0x4f1ec9,_0x5da0f7){return function(_0x481bf2){if(_0x481bf2){return _0x481bf2[_0x74b1('0x22')](_0x4f1ec9)[_0x74b1('0x23')](function(_0x405a22){return _0x405a22;});}return null;};}function removeEntity(_0x44bf7e,_0x563781){return function(_0x4ee88b){if(_0x4ee88b){return _0x4ee88b[_0x74b1('0x24')]()['then'](function(){_0x44bf7e[_0x74b1('0x1d')](0xcc)[_0x74b1('0x25')]();});}};}function handleEntityNotFound(_0xb5af0,_0x14a651){return function(_0x3239d8){if(!_0x3239d8){_0xb5af0[_0x74b1('0x17')](0x194);}return _0x3239d8;};}function handleError(_0x115918,_0x33fa8e){_0x33fa8e=_0x33fa8e||0x1f4;return function(_0x4c7f05){logger[_0x74b1('0x26')](_0x4c7f05[_0x74b1('0x27')]);if(_0x4c7f05[_0x74b1('0x28')]){delete _0x4c7f05['name'];}_0x115918[_0x74b1('0x1d')](_0x33fa8e)[_0x74b1('0x29')](_0x4c7f05);};}exports[_0x74b1('0x2a')]=function(_0x1b011a,_0x26d9f1){var _0x273ff1={},_0x436eda={},_0x3ce043={'count':0x0,'rows':[]};var _0x4fbe3d=_[_0x74b1('0x2b')](db[_0x74b1('0x2c')]['rawAttributes'],function(_0x543b5){return{'name':_0x543b5[_0x74b1('0x2d')],'type':_0x543b5[_0x74b1('0x2e')]['key']};});_0x436eda[_0x74b1('0x2f')]=_[_0x74b1('0x2b')](_0x4fbe3d,'name');_0x436eda[_0x74b1('0x30')]=_[_0x74b1('0x31')](_0x1b011a[_0x74b1('0x30')]);_0x436eda[_0x74b1('0x32')]=_[_0x74b1('0x33')](_0x436eda[_0x74b1('0x2f')],_0x436eda[_0x74b1('0x30')]);_0x273ff1[_0x74b1('0x34')]=_['intersection'](_0x436eda[_0x74b1('0x2f')],qs['fields'](_0x1b011a['query'][_0x74b1('0x35')]));_0x273ff1['attributes']=_0x273ff1['attributes'][_0x74b1('0x36')]?_0x273ff1[_0x74b1('0x34')]:_0x436eda[_0x74b1('0x2f')];if(!_0x1b011a[_0x74b1('0x30')][_0x74b1('0x37')](_0x74b1('0x38'))){_0x273ff1[_0x74b1('0x1a')]=qs[_0x74b1('0x1a')](_0x1b011a['query']['limit']);_0x273ff1['offset']=qs[_0x74b1('0x19')](_0x1b011a['query']['offset']);}_0x273ff1[_0x74b1('0x39')]=qs[_0x74b1('0x3a')](_0x1b011a[_0x74b1('0x30')]['sort']);_0x273ff1[_0x74b1('0x3b')]=qs['filters'](_[_0x74b1('0x3c')](_0x1b011a[_0x74b1('0x30')],_0x436eda['filters']),_0x4fbe3d);if(_0x1b011a['query'][_0x74b1('0x3d')]){_0x273ff1[_0x74b1('0x3b')]=_['merge'](_0x273ff1['where'],{'$or':_[_0x74b1('0x2b')](_0x4fbe3d,function(_0x5298f6){if(_0x5298f6[_0x74b1('0x2e')]!==_0x74b1('0x3e')){var _0x15e695={};_0x15e695[_0x5298f6[_0x74b1('0x28')]]={'$like':'%'+_0x1b011a[_0x74b1('0x30')]['filter']+'%'};return _0x15e695;}})});}_0x273ff1=_[_0x74b1('0x3f')]({},_0x273ff1,_0x1b011a['options']);var _0x41a78b={'where':_0x273ff1['where']};return db[_0x74b1('0x2c')]['count'](_0x41a78b)['then'](function(_0xcdb873){_0x3ce043[_0x74b1('0x1c')]=_0xcdb873;if(_0x1b011a[_0x74b1('0x30')]['includeAll']){_0x273ff1[_0x74b1('0x40')]=[{'all':!![]}];}return db[_0x74b1('0x2c')][_0x74b1('0x41')](_0x273ff1);})['then'](function(_0xfecdc){_0x3ce043[_0x74b1('0x42')]=_0xfecdc;return _0x3ce043;})['then'](respondWithFilteredResult(_0x26d9f1,_0x273ff1))['catch'](handleError(_0x26d9f1,null));};exports[_0x74b1('0x43')]=function(_0x2dcaf6,_0x416c8d){var _0x444870={'raw':!![],'where':{'id':_0x2dcaf6[_0x74b1('0x44')]['id']}},_0x1d9f5b={};_0x1d9f5b[_0x74b1('0x2f')]=_['keys'](db[_0x74b1('0x2c')][_0x74b1('0x45')]);_0x1d9f5b[_0x74b1('0x30')]=_[_0x74b1('0x31')](_0x2dcaf6[_0x74b1('0x30')]);_0x1d9f5b['filters']=_[_0x74b1('0x33')](_0x1d9f5b[_0x74b1('0x2f')],_0x1d9f5b['query']);_0x444870['attributes']=_[_0x74b1('0x33')](_0x1d9f5b[_0x74b1('0x2f')],qs['fields'](_0x2dcaf6[_0x74b1('0x30')][_0x74b1('0x35')]));_0x444870[_0x74b1('0x34')]=_0x444870[_0x74b1('0x34')][_0x74b1('0x36')]?_0x444870[_0x74b1('0x34')]:_0x1d9f5b[_0x74b1('0x2f')];if(_0x2dcaf6['query']['includeAll']){_0x444870['include']=[{'all':!![]}];}_0x444870=_[_0x74b1('0x3f')]({},_0x444870,_0x2dcaf6[_0x74b1('0x46')]);return db[_0x74b1('0x2c')][_0x74b1('0x47')](_0x444870)[_0x74b1('0x23')](handleEntityNotFound(_0x416c8d,null))['then'](respondWithResult(_0x416c8d,null))[_0x74b1('0x48')](handleError(_0x416c8d,null));};exports[_0x74b1('0x49')]=function(_0x18687c,_0x33c215){return db[_0x74b1('0x2c')][_0x74b1('0x49')](_0x18687c[_0x74b1('0x4a')],{})[_0x74b1('0x23')](respondWithResult(_0x33c215,0xc9))[_0x74b1('0x48')](handleError(_0x33c215,null));};exports[_0x74b1('0x22')]=function(_0x186516,_0x3038f9){if(_0x186516['body']['id']){delete _0x186516[_0x74b1('0x4a')]['id'];}return db[_0x74b1('0x2c')]['find']({'where':{'id':_0x186516[_0x74b1('0x44')]['id']}})['then'](handleEntityNotFound(_0x3038f9,null))[_0x74b1('0x23')](saveUpdates(_0x186516[_0x74b1('0x4a')],null))['then'](respondWithResult(_0x3038f9,null))[_0x74b1('0x48')](handleError(_0x3038f9,null));};exports[_0x74b1('0x24')]=function(_0x326b98,_0x549f03){return db[_0x74b1('0x2c')][_0x74b1('0x47')]({'where':{'id':_0x326b98[_0x74b1('0x44')]['id']}})[_0x74b1('0x23')](handleEntityNotFound(_0x549f03,null))[_0x74b1('0x23')](removeEntity(_0x549f03,null))['catch'](handleError(_0x549f03,null));};exports[_0x74b1('0x4b')]=function(_0x594411,_0x11bfca){return db[_0x74b1('0x2c')]['describe']()[_0x74b1('0x23')](respondWithResult(_0x11bfca,null))[_0x74b1('0x48')](handleError(_0x11bfca,null));}; \ No newline at end of file +var _0x5423=['params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','then','rows','catch','show','WhatsappQueueReport','find','create','body','update'];(function(_0x42cd2b,_0x4232c5){var _0x4de026=function(_0x1e0f0a){while(--_0x1e0f0a){_0x42cd2b['push'](_0x42cd2b['shift']());}};_0x4de026(++_0x4232c5);}(_0x5423,0xe3));var _0x3542=function(_0x40dd31,_0x4a887a){_0x40dd31=_0x40dd31-0x0;var _0x2da8de=_0x5423[_0x40dd31];return _0x2da8de;};'use strict';var emlformat=require(_0x3542('0x0'));var rimraf=require(_0x3542('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3542('0x2'));var rp=require(_0x3542('0x3'));var moment=require('moment');var BPromise=require(_0x3542('0x4'));var Mustache=require(_0x3542('0x5'));var util=require(_0x3542('0x6'));var path=require(_0x3542('0x7'));var sox=require('sox');var csv=require(_0x3542('0x8'));var ejs=require(_0x3542('0x9'));var fs=require('fs');var fs_extra=require(_0x3542('0xa'));var _=require(_0x3542('0xb'));var squel=require(_0x3542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3542('0xd'));var toCsv=require(_0x3542('0x8'));var querystring=require('querystring');var Papa=require(_0x3542('0xe'));var Redis=require(_0x3542('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3542('0x10'));var as=require(_0x3542('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3542('0x12'))(_0x3542('0x13'));var utils=require(_0x3542('0x14'));var config=require(_0x3542('0x15'));var licenseUtil=require(_0x3542('0x16'));var db=require(_0x3542('0x17'))['db'];function respondWithStatusCode(_0x1cf710,_0x43e977){_0x43e977=_0x43e977||0xcc;return function(_0x4ee86){if(_0x4ee86){return _0x1cf710[_0x3542('0x18')](_0x43e977);}return _0x1cf710[_0x3542('0x19')](_0x43e977)[_0x3542('0x1a')]();};}function respondWithResult(_0x15863d,_0x4bac5b){_0x4bac5b=_0x4bac5b||0xc8;return function(_0x14fe57){if(_0x14fe57){return _0x15863d['status'](_0x4bac5b)[_0x3542('0x1b')](_0x14fe57);}};}function respondWithFilteredResult(_0x13fe0b,_0xc33d42){return function(_0x546fbd){if(_0x546fbd){var _0x270312=typeof _0xc33d42[_0x3542('0x1c')]===_0x3542('0x1d')&&typeof _0xc33d42['limit']===_0x3542('0x1d');var _0x23b0de=_0x546fbd[_0x3542('0x1e')];var _0x3d5199=_0x270312?0x0:_0xc33d42['offset'];var _0x32df3f=_0x270312?_0x546fbd['count']:_0xc33d42[_0x3542('0x1c')]+_0xc33d42[_0x3542('0x1f')];var _0x4d93bc;if(_0x32df3f>=_0x23b0de){_0x32df3f=_0x23b0de;_0x4d93bc=0xc8;}else{_0x4d93bc=0xce;}_0x13fe0b[_0x3542('0x19')](_0x4d93bc);return _0x13fe0b[_0x3542('0x20')](_0x3542('0x21'),_0x3d5199+'-'+_0x32df3f+'/'+_0x23b0de)[_0x3542('0x1b')](_0x546fbd);}return null;};}function patchUpdates(_0x212950){return function(_0x4a7695){try{jsonpatch['apply'](_0x4a7695,_0x212950,!![]);}catch(_0x4c58f1){return BPromise[_0x3542('0x22')](_0x4c58f1);}return _0x4a7695['save']();};}function saveUpdates(_0x1d5488,_0x551645){return function(_0x1d5f1e){if(_0x1d5f1e){return _0x1d5f1e['update'](_0x1d5488)['then'](function(_0x3eacd0){return _0x3eacd0;});}return null;};}function removeEntity(_0xe3f983,_0x5ae097){return function(_0x5d05b2){if(_0x5d05b2){return _0x5d05b2[_0x3542('0x23')]()['then'](function(){_0xe3f983[_0x3542('0x19')](0xcc)[_0x3542('0x1a')]();});}};}function handleEntityNotFound(_0x1e0723,_0x2f2e63){return function(_0x298763){if(!_0x298763){_0x1e0723[_0x3542('0x18')](0x194);}return _0x298763;};}function handleError(_0x412184,_0x1e156e){_0x1e156e=_0x1e156e||0x1f4;return function(_0x18dc6c){logger[_0x3542('0x24')](_0x18dc6c[_0x3542('0x25')]);if(_0x18dc6c[_0x3542('0x26')]){delete _0x18dc6c[_0x3542('0x26')];}_0x412184[_0x3542('0x19')](_0x1e156e)[_0x3542('0x27')](_0x18dc6c);};}exports[_0x3542('0x28')]=function(_0x303412,_0x20eda1){var _0x3bd666={},_0x5590a2={},_0x31ad47={'count':0x0,'rows':[]};var _0x35bbc9=_[_0x3542('0x29')](db['WhatsappQueueReport'][_0x3542('0x2a')],function(_0xc6f23b){return{'name':_0xc6f23b[_0x3542('0x2b')],'type':_0xc6f23b[_0x3542('0x2c')]['key']};});_0x5590a2['model']=_[_0x3542('0x29')](_0x35bbc9,_0x3542('0x26'));_0x5590a2[_0x3542('0x2d')]=_[_0x3542('0x2e')](_0x303412[_0x3542('0x2d')]);_0x5590a2[_0x3542('0x2f')]=_[_0x3542('0x30')](_0x5590a2['model'],_0x5590a2['query']);_0x3bd666[_0x3542('0x31')]=_['intersection'](_0x5590a2['model'],qs[_0x3542('0x32')](_0x303412['query']['fields']));_0x3bd666[_0x3542('0x31')]=_0x3bd666[_0x3542('0x31')][_0x3542('0x33')]?_0x3bd666['attributes']:_0x5590a2[_0x3542('0x34')];if(!_0x303412['query'][_0x3542('0x35')](_0x3542('0x36'))){_0x3bd666['limit']=qs[_0x3542('0x1f')](_0x303412['query'][_0x3542('0x1f')]);_0x3bd666[_0x3542('0x1c')]=qs[_0x3542('0x1c')](_0x303412['query'][_0x3542('0x1c')]);}_0x3bd666['order']=qs[_0x3542('0x37')](_0x303412[_0x3542('0x2d')][_0x3542('0x37')]);_0x3bd666[_0x3542('0x38')]=qs[_0x3542('0x2f')](_[_0x3542('0x39')](_0x303412[_0x3542('0x2d')],_0x5590a2[_0x3542('0x2f')]),_0x35bbc9);if(_0x303412[_0x3542('0x2d')][_0x3542('0x3a')]){_0x3bd666[_0x3542('0x38')]=_[_0x3542('0x3b')](_0x3bd666[_0x3542('0x38')],{'$or':_['map'](_0x35bbc9,function(_0x62429){if(_0x62429['type']!=='VIRTUAL'){var _0x2782f2={};_0x2782f2[_0x62429[_0x3542('0x26')]]={'$like':'%'+_0x303412[_0x3542('0x2d')][_0x3542('0x3a')]+'%'};return _0x2782f2;}})});}_0x3bd666=_[_0x3542('0x3b')]({},_0x3bd666,_0x303412[_0x3542('0x3c')]);var _0xc7f13c={'where':_0x3bd666[_0x3542('0x38')]};return db['WhatsappQueueReport'][_0x3542('0x1e')](_0xc7f13c)['then'](function(_0x1c8855){_0x31ad47[_0x3542('0x1e')]=_0x1c8855;if(_0x303412['query'][_0x3542('0x3d')]){_0x3bd666[_0x3542('0x3e')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x3542('0x3f')](_0x3bd666);})[_0x3542('0x40')](function(_0x5e1b29){_0x31ad47[_0x3542('0x41')]=_0x5e1b29;return _0x31ad47;})[_0x3542('0x40')](respondWithFilteredResult(_0x20eda1,_0x3bd666))[_0x3542('0x42')](handleError(_0x20eda1,null));};exports[_0x3542('0x43')]=function(_0x290c7c,_0xb12441){var _0x2b54b9={'raw':!![],'where':{'id':_0x290c7c['params']['id']}},_0x4bf45a={};_0x4bf45a[_0x3542('0x34')]=_[_0x3542('0x2e')](db[_0x3542('0x44')][_0x3542('0x2a')]);_0x4bf45a[_0x3542('0x2d')]=_['keys'](_0x290c7c[_0x3542('0x2d')]);_0x4bf45a['filters']=_[_0x3542('0x30')](_0x4bf45a[_0x3542('0x34')],_0x4bf45a[_0x3542('0x2d')]);_0x2b54b9['attributes']=_[_0x3542('0x30')](_0x4bf45a[_0x3542('0x34')],qs['fields'](_0x290c7c[_0x3542('0x2d')][_0x3542('0x32')]));_0x2b54b9[_0x3542('0x31')]=_0x2b54b9[_0x3542('0x31')][_0x3542('0x33')]?_0x2b54b9[_0x3542('0x31')]:_0x4bf45a[_0x3542('0x34')];if(_0x290c7c[_0x3542('0x2d')]['includeAll']){_0x2b54b9['include']=[{'all':!![]}];}_0x2b54b9=_['merge']({},_0x2b54b9,_0x290c7c[_0x3542('0x3c')]);return db[_0x3542('0x44')][_0x3542('0x45')](_0x2b54b9)[_0x3542('0x40')](handleEntityNotFound(_0xb12441,null))[_0x3542('0x40')](respondWithResult(_0xb12441,null))[_0x3542('0x42')](handleError(_0xb12441,null));};exports[_0x3542('0x46')]=function(_0x5adf34,_0x157683){return db[_0x3542('0x44')][_0x3542('0x46')](_0x5adf34[_0x3542('0x47')],{})['then'](respondWithResult(_0x157683,0xc9))[_0x3542('0x42')](handleError(_0x157683,null));};exports[_0x3542('0x48')]=function(_0x55b43a,_0x528f8c){if(_0x55b43a[_0x3542('0x47')]['id']){delete _0x55b43a[_0x3542('0x47')]['id'];}return db[_0x3542('0x44')][_0x3542('0x45')]({'where':{'id':_0x55b43a[_0x3542('0x49')]['id']}})[_0x3542('0x40')](handleEntityNotFound(_0x528f8c,null))[_0x3542('0x40')](saveUpdates(_0x55b43a['body'],null))[_0x3542('0x40')](respondWithResult(_0x528f8c,null))[_0x3542('0x42')](handleError(_0x528f8c,null));};exports[_0x3542('0x23')]=function(_0x392c6e,_0x1ebc82){return db[_0x3542('0x44')][_0x3542('0x45')]({'where':{'id':_0x392c6e[_0x3542('0x49')]['id']}})[_0x3542('0x40')](handleEntityNotFound(_0x1ebc82,null))['then'](removeEntity(_0x1ebc82,null))['catch'](handleError(_0x1ebc82,null));};exports[_0x3542('0x4a')]=function(_0x4b406b,_0x5a798a){return db['WhatsappQueueReport'][_0x3542('0x4a')]()[_0x3542('0x40')](respondWithResult(_0x5a798a,null))[_0x3542('0x42')](handleError(_0x5a798a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 17cbe31..6e75be4 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 _0xe44a=['WhatsappQueueReport','uniqueid','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe44a,0x1e6));var _0xae44=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe44a[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0xae44('0x0'));var logger=require(_0xae44('0x1'))(_0xae44('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xae44('0x3'));var fs=require('fs');var path=require(_0xae44('0x4'));var rimraf=require(_0xae44('0x5'));var config=require(_0xae44('0x6'));var attributes=require(_0xae44('0x7'));module[_0xae44('0x8')]=function(_0x5bfe58,_0x2cc6fc){return _0x5bfe58['define'](_0xae44('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xae44('0xa'),'fields':[_0xae44('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa3bf=['../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x245459,_0x59a693){var _0x44111c=function(_0x4f7285){while(--_0x4f7285){_0x245459['push'](_0x245459['shift']());}};_0x44111c(++_0x59a693);}(_0xa3bf,0x14b));var _0xfa3b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa3bf[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xfa3b('0x0'));var util=require('util');var logger=require(_0xfa3b('0x1'))(_0xfa3b('0x2'));var moment=require(_0xfa3b('0x3'));var BPromise=require(_0xfa3b('0x4'));var rp=require(_0xfa3b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa3b('0x6'));var config=require(_0xfa3b('0x7'));var attributes=require(_0xfa3b('0x8'));module[_0xfa3b('0x9')]=function(_0x5a63fb,_0x2aeed3){return _0x5a63fb[_0xfa3b('0xa')](_0xfa3b('0xb'),attributes,{'tableName':_0xfa3b('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','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 224144b..c86e1b2 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 _0xf457=['message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','update','where','attributes','UpdateWhatsappQueueReport','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x239b5a,_0x56199a){var _0x5a701c=function(_0x3cdf2d){while(--_0x3cdf2d){_0x239b5a['push'](_0x239b5a['shift']());}};_0x5a701c(++_0x56199a);}(_0xf457,0x1c8));var _0x7f45=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf457[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7f45('0x0'));var util=require(_0x7f45('0x1'));var moment=require(_0x7f45('0x2'));var BPromise=require(_0x7f45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f45('0x4'));var db=require(_0x7f45('0x5'))['db'];var utils=require(_0x7f45('0x6'));var logger=require('../../config/logger')(_0x7f45('0x7'));var config=require(_0x7f45('0x8'));var jayson=require(_0x7f45('0x9'));var client=jayson[_0x7f45('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57b80c,_0x16882c,_0x365b52){return new BPromise(function(_0x505f0a,_0x5b6fe5){return client[_0x7f45('0xb')](_0x57b80c,_0x365b52)[_0x7f45('0xc')](function(_0x2a4be9){logger[_0x7f45('0xd')](_0x7f45('0xe'),_0x16882c,_0x7f45('0xf'));logger['debug'](_0x7f45('0x10'),_0x16882c,'request\x20sent',JSON[_0x7f45('0x11')](_0x2a4be9));if(_0x2a4be9[_0x7f45('0x12')]){if(_0x2a4be9['error'][_0x7f45('0x13')]===0x1f4){logger[_0x7f45('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x16882c,_0x2a4be9[_0x7f45('0x12')][_0x7f45('0x14')]);return _0x5b6fe5(_0x2a4be9['error'][_0x7f45('0x14')]);}logger[_0x7f45('0x12')](_0x7f45('0xe'),_0x16882c,_0x2a4be9['error'][_0x7f45('0x14')]);return _0x505f0a(_0x2a4be9[_0x7f45('0x12')][_0x7f45('0x14')]);}else{logger[_0x7f45('0xd')](_0x7f45('0xe'),_0x16882c,_0x7f45('0xf'));_0x505f0a(_0x2a4be9[_0x7f45('0x15')]['message']);}})[_0x7f45('0x16')](function(_0x5ad296){logger['error'](_0x7f45('0xe'),_0x16882c,_0x5ad296);_0x5b6fe5(_0x5ad296);});});}exports[_0x7f45('0x17')]=function(_0x133cee){var _0x4029df=this;return new Promise(function(_0x4852cc,_0x1f9b87){return db[_0x7f45('0x18')][_0x7f45('0x19')](_0x133cee[_0x7f45('0x1a')],{'raw':_0x133cee['options']?_0x133cee[_0x7f45('0x1b')][_0x7f45('0x1c')]===undefined?!![]:![]:!![]})[_0x7f45('0xc')](function(_0x5d67dd){logger[_0x7f45('0xd')](_0x7f45('0x17'),_0x133cee);logger['debug'](_0x7f45('0x17'),_0x133cee,JSON[_0x7f45('0x11')](_0x5d67dd));_0x4852cc(_0x5d67dd);})['catch'](function(_0x28388b){logger[_0x7f45('0x12')](_0x7f45('0x17'),_0x28388b[_0x7f45('0x14')],_0x133cee);_0x1f9b87(_0x4029df[_0x7f45('0x12')](0x1f4,_0x28388b[_0x7f45('0x14')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x5d8561){var _0xe0c5df=this;return new Promise(function(_0x49c8f8,_0x272c46){return db[_0x7f45('0x18')][_0x7f45('0x1d')](_0x5d8561['body'],{'raw':_0x5d8561[_0x7f45('0x1b')]?_0x5d8561[_0x7f45('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d8561['options']?_0x5d8561[_0x7f45('0x1b')][_0x7f45('0x1e')]||null:null,'attributes':_0x5d8561[_0x7f45('0x1b')]?_0x5d8561[_0x7f45('0x1b')][_0x7f45('0x1f')]||null:null,'limit':_0x5d8561[_0x7f45('0x1b')]?_0x5d8561['options']['limit']||null:null})['then'](function(_0x2b413b){logger[_0x7f45('0xd')](_0x7f45('0x20'),_0x5d8561);logger[_0x7f45('0x21')](_0x7f45('0x20'),_0x5d8561,JSON[_0x7f45('0x11')](_0x2b413b));_0x49c8f8(_0x2b413b);})[_0x7f45('0x16')](function(_0x15a0b4){logger[_0x7f45('0x12')](_0x7f45('0x20'),_0x15a0b4[_0x7f45('0x14')],_0x5d8561);_0x272c46(_0xe0c5df[_0x7f45('0x12')](0x1f4,_0x15a0b4[_0x7f45('0x14')]));});});}; \ No newline at end of file +var _0x1f8c=['raw','catch','UpdateWhatsappQueueReport','update','body','where','attributes','limit','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','CreateWhatsappQueueReport','WhatsappQueueReport','create','options'];(function(_0x53d0d6,_0x8e5f58){var _0x15efb7=function(_0x5c06f8){while(--_0x5c06f8){_0x53d0d6['push'](_0x53d0d6['shift']());}};_0x15efb7(++_0x8e5f58);}(_0x1f8c,0x17f));var _0xc1f8=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0x1f8c[_0x38ce4c];return _0x5d4544;};'use strict';var _=require(_0xc1f8('0x0'));var util=require('util');var moment=require(_0xc1f8('0x1'));var BPromise=require(_0xc1f8('0x2'));var rs=require(_0xc1f8('0x3'));var fs=require('fs');var Redis=require(_0xc1f8('0x4'));var db=require(_0xc1f8('0x5'))['db'];var utils=require(_0xc1f8('0x6'));var logger=require(_0xc1f8('0x7'))(_0xc1f8('0x8'));var config=require(_0xc1f8('0x9'));var jayson=require(_0xc1f8('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16bcd2,_0x249f64,_0x433fc9){return new BPromise(function(_0x2ef154,_0xf0f5b5){return client[_0xc1f8('0xb')](_0x16bcd2,_0x433fc9)[_0xc1f8('0xc')](function(_0x4eb45d){logger[_0xc1f8('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x249f64,'request\x20sent');logger[_0xc1f8('0xe')](_0xc1f8('0xf'),_0x249f64,_0xc1f8('0x10'),JSON['stringify'](_0x4eb45d));if(_0x4eb45d[_0xc1f8('0x11')]){if(_0x4eb45d[_0xc1f8('0x11')][_0xc1f8('0x12')]===0x1f4){logger[_0xc1f8('0x11')](_0xc1f8('0x13'),_0x249f64,_0x4eb45d[_0xc1f8('0x11')]['message']);return _0xf0f5b5(_0x4eb45d['error']['message']);}logger[_0xc1f8('0x11')](_0xc1f8('0x13'),_0x249f64,_0x4eb45d[_0xc1f8('0x11')]['message']);return _0x2ef154(_0x4eb45d[_0xc1f8('0x11')]['message']);}else{logger[_0xc1f8('0xd')](_0xc1f8('0x13'),_0x249f64,_0xc1f8('0x10'));_0x2ef154(_0x4eb45d['result'][_0xc1f8('0x14')]);}})['catch'](function(_0x129222){logger[_0xc1f8('0x11')](_0xc1f8('0x13'),_0x249f64,_0x129222);_0xf0f5b5(_0x129222);});});}exports[_0xc1f8('0x15')]=function(_0x40790e){var _0x19b17f=this;return new Promise(function(_0x4384a7,_0x3f5ede){return db[_0xc1f8('0x16')][_0xc1f8('0x17')](_0x40790e['body'],{'raw':_0x40790e[_0xc1f8('0x18')]?_0x40790e[_0xc1f8('0x18')][_0xc1f8('0x19')]===undefined?!![]:![]:!![]})[_0xc1f8('0xc')](function(_0x24766e){logger['info'](_0xc1f8('0x15'),_0x40790e);logger['debug'](_0xc1f8('0x15'),_0x40790e,JSON['stringify'](_0x24766e));_0x4384a7(_0x24766e);})[_0xc1f8('0x1a')](function(_0x1f2774){logger[_0xc1f8('0x11')]('CreateWhatsappQueueReport',_0x1f2774[_0xc1f8('0x14')],_0x40790e);_0x3f5ede(_0x19b17f[_0xc1f8('0x11')](0x1f4,_0x1f2774['message']));});});};exports[_0xc1f8('0x1b')]=function(_0x51935b){var _0x315e06=this;return new Promise(function(_0x20af18,_0x2640e5){return db[_0xc1f8('0x16')][_0xc1f8('0x1c')](_0x51935b[_0xc1f8('0x1d')],{'raw':_0x51935b[_0xc1f8('0x18')]?_0x51935b[_0xc1f8('0x18')][_0xc1f8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51935b[_0xc1f8('0x18')]?_0x51935b[_0xc1f8('0x18')][_0xc1f8('0x1e')]||null:null,'attributes':_0x51935b['options']?_0x51935b['options'][_0xc1f8('0x1f')]||null:null,'limit':_0x51935b['options']?_0x51935b['options'][_0xc1f8('0x20')]||null:null})[_0xc1f8('0xc')](function(_0x47ccbb){logger[_0xc1f8('0xd')](_0xc1f8('0x1b'),_0x51935b);logger[_0xc1f8('0xe')]('UpdateWhatsappQueueReport',_0x51935b,JSON[_0xc1f8('0x21')](_0x47ccbb));_0x20af18(_0x47ccbb);})['catch'](function(_0x5577aa){logger[_0xc1f8('0x11')]('UpdateWhatsappQueueReport',_0x5577aa['message'],_0x51935b);_0x2640e5(_0x315e06['error'](0x1f4,_0x5577aa[_0xc1f8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 21e70ae..80bd8e9 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 _0xba3c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','post','put','update','delete','destroy','exports','util','path'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xba3c,0x178));var _0xcba3=function(_0x351c9e,_0x222c83){_0x351c9e=_0x351c9e-0x0;var _0x352084=_0xba3c[_0x351c9e];return _0x352084;};'use strict';var multer=require('multer');var util=require(_0xcba3('0x0'));var path=require(_0xcba3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcba3('0x2')]();var fs_extra=require(_0xcba3('0x3'));var auth=require(_0xcba3('0x4'));var interaction=require(_0xcba3('0x5'));var config=require(_0xcba3('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0xcba3('0x7')]('/',auth[_0xcba3('0x8')](),controller['index']);router[_0xcba3('0x7')](_0xcba3('0x9'),auth[_0xcba3('0x8')](),controller[_0xcba3('0xa')]);router['get'](_0xcba3('0xb'),auth[_0xcba3('0x8')](),controller['show']);router[_0xcba3('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcba3('0xd')]('/:id',auth[_0xcba3('0x8')](),controller[_0xcba3('0xe')]);router[_0xcba3('0xf')](_0xcba3('0xb'),auth[_0xcba3('0x8')](),controller[_0xcba3('0x10')]);module[_0xcba3('0x11')]=router; \ No newline at end of file +var _0x8b7a=['connect-timeout','fs-extra','../../components/interaction/service','./whatsappTransferReport.controller','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x8b7a,0xf4));var _0xa8b7=function(_0x5bb946,_0x3601a4){_0x5bb946=_0x5bb946-0x0;var _0x31ba6e=_0x8b7a[_0x5bb946];return _0x31ba6e;};'use strict';var multer=require(_0xa8b7('0x0'));var util=require(_0xa8b7('0x1'));var path=require(_0xa8b7('0x2'));var timeout=require(_0xa8b7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa8b7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa8b7('0x5'));var config=require('../../config/environment');var controller=require(_0xa8b7('0x6'));router['get']('/',auth[_0xa8b7('0x7')](),controller[_0xa8b7('0x8')]);router['get'](_0xa8b7('0x9'),auth[_0xa8b7('0x7')](),controller[_0xa8b7('0xa')]);router['get'](_0xa8b7('0xb'),auth[_0xa8b7('0x7')](),controller[_0xa8b7('0xc')]);router[_0xa8b7('0xd')]('/',auth[_0xa8b7('0x7')](),controller[_0xa8b7('0xe')]);router['put'](_0xa8b7('0xb'),auth[_0xa8b7('0x7')](),controller[_0xa8b7('0xf')]);router[_0xa8b7('0x10')](_0xa8b7('0xb'),auth[_0xa8b7('0x7')](),controller[_0xa8b7('0x11')]);module[_0xa8b7('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index dfdbf01..cb4ab84 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 _0xbee0=['ENUM','account','agent','queue','DATE','exports','STRING'];(function(_0x32e6dc,_0x420a25){var _0x2fd273=function(_0x159a75){while(--_0x159a75){_0x32e6dc['push'](_0x32e6dc['shift']());}};_0x2fd273(++_0x420a25);}(_0xbee0,0x147));var _0x0bee=function(_0x411b1e,_0x30a660){_0x411b1e=_0x411b1e-0x0;var _0x5b6434=_0xbee0[_0x411b1e];return _0x5b6434;};'use strict';var Sequelize=require('sequelize');module[_0x0bee('0x0')]={'uniqueid':{'type':Sequelize[_0x0bee('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0bee('0x2')](_0x0bee('0x3'),_0x0bee('0x4'),_0x0bee('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0bee('0x6')]}}; \ No newline at end of file +var _0x6cb4=['exports','STRING','ENUM','account','agent','queue','DATE','sequelize'];(function(_0x10bf89,_0x8b2d6e){var _0x5bd609=function(_0xf73c1f){while(--_0xf73c1f){_0x10bf89['push'](_0x10bf89['shift']());}};_0x5bd609(++_0x8b2d6e);}(_0x6cb4,0xff));var _0x46cb=function(_0x1676b7,_0x388003){_0x1676b7=_0x1676b7-0x0;var _0x416e1a=_0x6cb4[_0x1676b7];return _0x416e1a;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'uniqueid':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x46cb('0x3')](_0x46cb('0x4'),_0x46cb('0x5'),_0x46cb('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x46cb('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index f8c5b68..90d2084 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 _0x6e83=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','sendStatus','error','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','rows','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x34c5fd,_0x36698e){var _0x16c347=function(_0xe74612){while(--_0xe74612){_0x34c5fd['push'](_0x34c5fd['shift']());}};_0x16c347(++_0x36698e);}(_0x6e83,0x16d));var _0x36e8=function(_0x30dfa4,_0x1a6275){_0x30dfa4=_0x30dfa4-0x0;var _0x185b37=_0x6e83[_0x30dfa4];return _0x185b37;};'use strict';var emlformat=require(_0x36e8('0x0'));var rimraf=require(_0x36e8('0x1'));var zipdir=require(_0x36e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x36e8('0x3'));var moment=require(_0x36e8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x36e8('0x5'));var path=require(_0x36e8('0x6'));var sox=require(_0x36e8('0x7'));var csv=require(_0x36e8('0x8'));var ejs=require(_0x36e8('0x9'));var fs=require('fs');var fs_extra=require(_0x36e8('0xa'));var _=require('lodash');var squel=require(_0x36e8('0xb'));var crypto=require(_0x36e8('0xc'));var jsforce=require(_0x36e8('0xd'));var deskjs=require(_0x36e8('0xe'));var toCsv=require(_0x36e8('0x8'));var querystring=require(_0x36e8('0xf'));var Papa=require(_0x36e8('0x10'));var Redis=require(_0x36e8('0x11'));var authService=require(_0x36e8('0x12'));var qs=require(_0x36e8('0x13'));var as=require(_0x36e8('0x14'));var hardwareService=require(_0x36e8('0x15'));var logger=require(_0x36e8('0x16'))(_0x36e8('0x17'));var utils=require(_0x36e8('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cba8d,_0x91da08){_0x91da08=_0x91da08||0xcc;return function(_0x590894){if(_0x590894){return _0x4cba8d['sendStatus'](_0x91da08);}return _0x4cba8d['status'](_0x91da08)[_0x36e8('0x19')]();};}function respondWithResult(_0x51af55,_0x67486){_0x67486=_0x67486||0xc8;return function(_0x24ddf4){if(_0x24ddf4){return _0x51af55[_0x36e8('0x1a')](_0x67486)[_0x36e8('0x1b')](_0x24ddf4);}};}function respondWithFilteredResult(_0x589dfb,_0x357109){return function(_0x348973){if(_0x348973){var _0x58b526=typeof _0x357109[_0x36e8('0x1c')]===_0x36e8('0x1d')&&typeof _0x357109[_0x36e8('0x1e')]===_0x36e8('0x1d');var _0x4dab1d=_0x348973[_0x36e8('0x1f')];var _0x5e208f=_0x58b526?0x0:_0x357109[_0x36e8('0x1c')];var _0x4e812d=_0x58b526?_0x348973[_0x36e8('0x1f')]:_0x357109[_0x36e8('0x1c')]+_0x357109[_0x36e8('0x1e')];var _0x242876;if(_0x4e812d>=_0x4dab1d){_0x4e812d=_0x4dab1d;_0x242876=0xc8;}else{_0x242876=0xce;}_0x589dfb[_0x36e8('0x1a')](_0x242876);return _0x589dfb[_0x36e8('0x20')](_0x36e8('0x21'),_0x5e208f+'-'+_0x4e812d+'/'+_0x4dab1d)[_0x36e8('0x1b')](_0x348973);}return null;};}function patchUpdates(_0x25a94a){return function(_0x1a3203){try{jsonpatch[_0x36e8('0x22')](_0x1a3203,_0x25a94a,!![]);}catch(_0x25c9e9){return BPromise[_0x36e8('0x23')](_0x25c9e9);}return _0x1a3203[_0x36e8('0x24')]();};}function saveUpdates(_0x17a218,_0x96153){return function(_0x14e39b){if(_0x14e39b){return _0x14e39b['update'](_0x17a218)['then'](function(_0x89e45e){return _0x89e45e;});}return null;};}function removeEntity(_0x474dc2,_0x37f09e){return function(_0x5c47ea){if(_0x5c47ea){return _0x5c47ea[_0x36e8('0x25')]()['then'](function(){_0x474dc2[_0x36e8('0x1a')](0xcc)[_0x36e8('0x19')]();});}};}function handleEntityNotFound(_0x88ba6d,_0x28c71e){return function(_0xf6b8ce){if(!_0xf6b8ce){_0x88ba6d[_0x36e8('0x26')](0x194);}return _0xf6b8ce;};}function handleError(_0x28039d,_0x191a87){_0x191a87=_0x191a87||0x1f4;return function(_0x264c85){logger[_0x36e8('0x27')](_0x264c85[_0x36e8('0x28')]);if(_0x264c85[_0x36e8('0x29')]){delete _0x264c85['name'];}_0x28039d[_0x36e8('0x1a')](_0x191a87)[_0x36e8('0x2a')](_0x264c85);};}exports[_0x36e8('0x2b')]=function(_0x2a41b8,_0x434083){var _0x58cc87={},_0x8fce1b={},_0x53dd09={'count':0x0,'rows':[]};var _0x4e812a=_[_0x36e8('0x2c')](db[_0x36e8('0x2d')]['rawAttributes'],function(_0x27527e){return{'name':_0x27527e[_0x36e8('0x2e')],'type':_0x27527e[_0x36e8('0x2f')]['key']};});_0x8fce1b[_0x36e8('0x30')]=_[_0x36e8('0x2c')](_0x4e812a,_0x36e8('0x29'));_0x8fce1b['query']=_[_0x36e8('0x31')](_0x2a41b8[_0x36e8('0x32')]);_0x8fce1b[_0x36e8('0x33')]=_[_0x36e8('0x34')](_0x8fce1b[_0x36e8('0x30')],_0x8fce1b[_0x36e8('0x32')]);_0x58cc87['attributes']=_[_0x36e8('0x34')](_0x8fce1b['model'],qs[_0x36e8('0x35')](_0x2a41b8['query'][_0x36e8('0x35')]));_0x58cc87[_0x36e8('0x36')]=_0x58cc87[_0x36e8('0x36')][_0x36e8('0x37')]?_0x58cc87['attributes']:_0x8fce1b[_0x36e8('0x30')];if(!_0x2a41b8[_0x36e8('0x32')][_0x36e8('0x38')](_0x36e8('0x39'))){_0x58cc87[_0x36e8('0x1e')]=qs[_0x36e8('0x1e')](_0x2a41b8['query']['limit']);_0x58cc87[_0x36e8('0x1c')]=qs['offset'](_0x2a41b8['query'][_0x36e8('0x1c')]);}_0x58cc87['order']=qs[_0x36e8('0x3a')](_0x2a41b8['query']['sort']);_0x58cc87[_0x36e8('0x3b')]=qs[_0x36e8('0x33')](_[_0x36e8('0x3c')](_0x2a41b8['query'],_0x8fce1b[_0x36e8('0x33')]),_0x4e812a);if(_0x2a41b8[_0x36e8('0x32')][_0x36e8('0x3d')]){_0x58cc87['where']=_[_0x36e8('0x3e')](_0x58cc87['where'],{'$or':_[_0x36e8('0x2c')](_0x4e812a,function(_0x280cdd){if(_0x280cdd[_0x36e8('0x2f')]!==_0x36e8('0x3f')){var _0x270d63={};_0x270d63[_0x280cdd[_0x36e8('0x29')]]={'$like':'%'+_0x2a41b8[_0x36e8('0x32')]['filter']+'%'};return _0x270d63;}})});}_0x58cc87=_[_0x36e8('0x3e')]({},_0x58cc87,_0x2a41b8['options']);var _0x127ce7={'where':_0x58cc87[_0x36e8('0x3b')]};return db[_0x36e8('0x2d')][_0x36e8('0x1f')](_0x127ce7)[_0x36e8('0x40')](function(_0x2941d6){_0x53dd09['count']=_0x2941d6;if(_0x2a41b8[_0x36e8('0x32')][_0x36e8('0x41')]){_0x58cc87[_0x36e8('0x42')]=[{'all':!![]}];}return db[_0x36e8('0x2d')]['findAll'](_0x58cc87);})[_0x36e8('0x40')](function(_0x4ae0d8){_0x53dd09[_0x36e8('0x43')]=_0x4ae0d8;return _0x53dd09;})['then'](respondWithFilteredResult(_0x434083,_0x58cc87))[_0x36e8('0x44')](handleError(_0x434083,null));};exports[_0x36e8('0x45')]=function(_0x45db4b,_0x59c5a4){var _0x2b862a={'raw':!![],'where':{'id':_0x45db4b['params']['id']}},_0x16faaa={};_0x16faaa['model']=_[_0x36e8('0x31')](db[_0x36e8('0x2d')]['rawAttributes']);_0x16faaa[_0x36e8('0x32')]=_[_0x36e8('0x31')](_0x45db4b[_0x36e8('0x32')]);_0x16faaa[_0x36e8('0x33')]=_[_0x36e8('0x34')](_0x16faaa['model'],_0x16faaa[_0x36e8('0x32')]);_0x2b862a[_0x36e8('0x36')]=_['intersection'](_0x16faaa[_0x36e8('0x30')],qs['fields'](_0x45db4b[_0x36e8('0x32')]['fields']));_0x2b862a[_0x36e8('0x36')]=_0x2b862a[_0x36e8('0x36')][_0x36e8('0x37')]?_0x2b862a[_0x36e8('0x36')]:_0x16faaa[_0x36e8('0x30')];if(_0x45db4b[_0x36e8('0x32')]['includeAll']){_0x2b862a['include']=[{'all':!![]}];}_0x2b862a=_[_0x36e8('0x3e')]({},_0x2b862a,_0x45db4b[_0x36e8('0x46')]);return db[_0x36e8('0x2d')][_0x36e8('0x47')](_0x2b862a)[_0x36e8('0x40')](handleEntityNotFound(_0x59c5a4,null))[_0x36e8('0x40')](respondWithResult(_0x59c5a4,null))[_0x36e8('0x44')](handleError(_0x59c5a4,null));};exports[_0x36e8('0x48')]=function(_0x2fc213,_0xe55710){return db[_0x36e8('0x2d')][_0x36e8('0x48')](_0x2fc213[_0x36e8('0x49')],{})[_0x36e8('0x40')](respondWithResult(_0xe55710,0xc9))[_0x36e8('0x44')](handleError(_0xe55710,null));};exports['update']=function(_0x24e5ba,_0x42c2d3){if(_0x24e5ba[_0x36e8('0x49')]['id']){delete _0x24e5ba[_0x36e8('0x49')]['id'];}return db[_0x36e8('0x2d')][_0x36e8('0x47')]({'where':{'id':_0x24e5ba[_0x36e8('0x4a')]['id']}})[_0x36e8('0x40')](handleEntityNotFound(_0x42c2d3,null))[_0x36e8('0x40')](saveUpdates(_0x24e5ba[_0x36e8('0x49')],null))[_0x36e8('0x40')](respondWithResult(_0x42c2d3,null))[_0x36e8('0x44')](handleError(_0x42c2d3,null));};exports[_0x36e8('0x25')]=function(_0x48f046,_0x1920f2){return db[_0x36e8('0x2d')][_0x36e8('0x47')]({'where':{'id':_0x48f046[_0x36e8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1920f2,null))[_0x36e8('0x40')](removeEntity(_0x1920f2,null))['catch'](handleError(_0x1920f2,null));};exports['describe']=function(_0x12159c,_0x15da61){return db['WhatsappTransferReport'][_0x36e8('0x4b')]()[_0x36e8('0x40')](respondWithResult(_0x15da61,null))[_0x36e8('0x44')](handleError(_0x15da61,null));}; \ No newline at end of file +var _0xb377=['key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','WhatsappTransferReport','includeAll','include','findAll','rows','catch','show','params','body','find','describe','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','index','map','rawAttributes','type'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xb377,0xf7));var _0x7b37=function(_0x16ad7a,_0x1fede6){_0x16ad7a=_0x16ad7a-0x0;var _0x480e04=_0xb377[_0x16ad7a];return _0x480e04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b37('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b37('0x1'));var rp=require('request-promise');var moment=require(_0x7b37('0x2'));var BPromise=require(_0x7b37('0x3'));var Mustache=require('mustache');var util=require(_0x7b37('0x4'));var path=require('path');var sox=require(_0x7b37('0x5'));var csv=require(_0x7b37('0x6'));var ejs=require(_0x7b37('0x7'));var fs=require('fs');var fs_extra=require(_0x7b37('0x8'));var _=require('lodash');var squel=require(_0x7b37('0x9'));var crypto=require(_0x7b37('0xa'));var jsforce=require(_0x7b37('0xb'));var deskjs=require(_0x7b37('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7b37('0xd'));var Papa=require(_0x7b37('0xe'));var Redis=require(_0x7b37('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7b37('0x10'));var hardwareService=require(_0x7b37('0x11'));var logger=require(_0x7b37('0x12'))(_0x7b37('0x13'));var utils=require(_0x7b37('0x14'));var config=require(_0x7b37('0x15'));var licenseUtil=require(_0x7b37('0x16'));var db=require(_0x7b37('0x17'))['db'];function respondWithStatusCode(_0x55da0d,_0x3e1e9d){_0x3e1e9d=_0x3e1e9d||0xcc;return function(_0x22eefb){if(_0x22eefb){return _0x55da0d['sendStatus'](_0x3e1e9d);}return _0x55da0d[_0x7b37('0x18')](_0x3e1e9d)[_0x7b37('0x19')]();};}function respondWithResult(_0x3e48f7,_0x5eef7f){_0x5eef7f=_0x5eef7f||0xc8;return function(_0x51ea3a){if(_0x51ea3a){return _0x3e48f7[_0x7b37('0x18')](_0x5eef7f)[_0x7b37('0x1a')](_0x51ea3a);}};}function respondWithFilteredResult(_0x4c7e17,_0x21bfdd){return function(_0x22e046){if(_0x22e046){var _0x5e8935=typeof _0x21bfdd['offset']===_0x7b37('0x1b')&&typeof _0x21bfdd[_0x7b37('0x1c')]===_0x7b37('0x1b');var _0x276476=_0x22e046[_0x7b37('0x1d')];var _0x29d382=_0x5e8935?0x0:_0x21bfdd[_0x7b37('0x1e')];var _0x36c51a=_0x5e8935?_0x22e046[_0x7b37('0x1d')]:_0x21bfdd[_0x7b37('0x1e')]+_0x21bfdd[_0x7b37('0x1c')];var _0x16d653;if(_0x36c51a>=_0x276476){_0x36c51a=_0x276476;_0x16d653=0xc8;}else{_0x16d653=0xce;}_0x4c7e17[_0x7b37('0x18')](_0x16d653);return _0x4c7e17[_0x7b37('0x1f')](_0x7b37('0x20'),_0x29d382+'-'+_0x36c51a+'/'+_0x276476)[_0x7b37('0x1a')](_0x22e046);}return null;};}function patchUpdates(_0x4acef0){return function(_0x2776b7){try{jsonpatch['apply'](_0x2776b7,_0x4acef0,!![]);}catch(_0x1934fc){return BPromise[_0x7b37('0x21')](_0x1934fc);}return _0x2776b7[_0x7b37('0x22')]();};}function saveUpdates(_0x564982,_0x38f352){return function(_0x3ff498){if(_0x3ff498){return _0x3ff498[_0x7b37('0x23')](_0x564982)[_0x7b37('0x24')](function(_0x51c900){return _0x51c900;});}return null;};}function removeEntity(_0x4c881a,_0x5e71a5){return function(_0x5ed0e5){if(_0x5ed0e5){return _0x5ed0e5[_0x7b37('0x25')]()['then'](function(){_0x4c881a[_0x7b37('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4818ec,_0x424e1d){return function(_0x2955a8){if(!_0x2955a8){_0x4818ec[_0x7b37('0x26')](0x194);}return _0x2955a8;};}function handleError(_0x5c14d7,_0x413430){_0x413430=_0x413430||0x1f4;return function(_0x21d9c9){logger['error'](_0x21d9c9[_0x7b37('0x27')]);if(_0x21d9c9[_0x7b37('0x28')]){delete _0x21d9c9[_0x7b37('0x28')];}_0x5c14d7[_0x7b37('0x18')](_0x413430)['send'](_0x21d9c9);};}exports[_0x7b37('0x29')]=function(_0x46c12a,_0x74d516){var _0x3127d3={},_0x428d54={},_0x255c70={'count':0x0,'rows':[]};var _0x4d871c=_[_0x7b37('0x2a')](db['WhatsappTransferReport'][_0x7b37('0x2b')],function(_0x4c7d15){return{'name':_0x4c7d15['fieldName'],'type':_0x4c7d15[_0x7b37('0x2c')][_0x7b37('0x2d')]};});_0x428d54[_0x7b37('0x2e')]=_[_0x7b37('0x2a')](_0x4d871c,_0x7b37('0x28'));_0x428d54[_0x7b37('0x2f')]=_[_0x7b37('0x30')](_0x46c12a[_0x7b37('0x2f')]);_0x428d54['filters']=_[_0x7b37('0x31')](_0x428d54[_0x7b37('0x2e')],_0x428d54['query']);_0x3127d3[_0x7b37('0x32')]=_['intersection'](_0x428d54[_0x7b37('0x2e')],qs[_0x7b37('0x33')](_0x46c12a[_0x7b37('0x2f')]['fields']));_0x3127d3[_0x7b37('0x32')]=_0x3127d3[_0x7b37('0x32')][_0x7b37('0x34')]?_0x3127d3[_0x7b37('0x32')]:_0x428d54['model'];if(!_0x46c12a[_0x7b37('0x2f')][_0x7b37('0x35')](_0x7b37('0x36'))){_0x3127d3[_0x7b37('0x1c')]=qs[_0x7b37('0x1c')](_0x46c12a[_0x7b37('0x2f')][_0x7b37('0x1c')]);_0x3127d3[_0x7b37('0x1e')]=qs[_0x7b37('0x1e')](_0x46c12a['query'][_0x7b37('0x1e')]);}_0x3127d3[_0x7b37('0x37')]=qs[_0x7b37('0x38')](_0x46c12a['query']['sort']);_0x3127d3[_0x7b37('0x39')]=qs[_0x7b37('0x3a')](_['pick'](_0x46c12a['query'],_0x428d54[_0x7b37('0x3a')]),_0x4d871c);if(_0x46c12a[_0x7b37('0x2f')]['filter']){_0x3127d3[_0x7b37('0x39')]=_[_0x7b37('0x3b')](_0x3127d3[_0x7b37('0x39')],{'$or':_[_0x7b37('0x2a')](_0x4d871c,function(_0x223b59){if(_0x223b59[_0x7b37('0x2c')]!=='VIRTUAL'){var _0x4aa7a5={};_0x4aa7a5[_0x223b59['name']]={'$like':'%'+_0x46c12a[_0x7b37('0x2f')][_0x7b37('0x3c')]+'%'};return _0x4aa7a5;}})});}_0x3127d3=_['merge']({},_0x3127d3,_0x46c12a[_0x7b37('0x3d')]);var _0x3a7c09={'where':_0x3127d3[_0x7b37('0x39')]};return db[_0x7b37('0x3e')]['count'](_0x3a7c09)['then'](function(_0x54a5cc){_0x255c70[_0x7b37('0x1d')]=_0x54a5cc;if(_0x46c12a[_0x7b37('0x2f')][_0x7b37('0x3f')]){_0x3127d3[_0x7b37('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x7b37('0x41')](_0x3127d3);})[_0x7b37('0x24')](function(_0x1a3c39){_0x255c70[_0x7b37('0x42')]=_0x1a3c39;return _0x255c70;})['then'](respondWithFilteredResult(_0x74d516,_0x3127d3))[_0x7b37('0x43')](handleError(_0x74d516,null));};exports[_0x7b37('0x44')]=function(_0xdb5e67,_0x105a89){var _0x51c351={'raw':!![],'where':{'id':_0xdb5e67[_0x7b37('0x45')]['id']}},_0x45144b={};_0x45144b[_0x7b37('0x2e')]=_['keys'](db[_0x7b37('0x3e')]['rawAttributes']);_0x45144b[_0x7b37('0x2f')]=_[_0x7b37('0x30')](_0xdb5e67[_0x7b37('0x2f')]);_0x45144b[_0x7b37('0x3a')]=_[_0x7b37('0x31')](_0x45144b['model'],_0x45144b[_0x7b37('0x2f')]);_0x51c351[_0x7b37('0x32')]=_[_0x7b37('0x31')](_0x45144b['model'],qs[_0x7b37('0x33')](_0xdb5e67[_0x7b37('0x2f')]['fields']));_0x51c351[_0x7b37('0x32')]=_0x51c351[_0x7b37('0x32')]['length']?_0x51c351[_0x7b37('0x32')]:_0x45144b[_0x7b37('0x2e')];if(_0xdb5e67[_0x7b37('0x2f')][_0x7b37('0x3f')]){_0x51c351[_0x7b37('0x40')]=[{'all':!![]}];}_0x51c351=_['merge']({},_0x51c351,_0xdb5e67[_0x7b37('0x3d')]);return db[_0x7b37('0x3e')]['find'](_0x51c351)[_0x7b37('0x24')](handleEntityNotFound(_0x105a89,null))[_0x7b37('0x24')](respondWithResult(_0x105a89,null))['catch'](handleError(_0x105a89,null));};exports['create']=function(_0x2398b1,_0x52d4e8){return db[_0x7b37('0x3e')]['create'](_0x2398b1[_0x7b37('0x46')],{})['then'](respondWithResult(_0x52d4e8,0xc9))['catch'](handleError(_0x52d4e8,null));};exports[_0x7b37('0x23')]=function(_0x5f2135,_0x45cabc){if(_0x5f2135[_0x7b37('0x46')]['id']){delete _0x5f2135['body']['id'];}return db[_0x7b37('0x3e')][_0x7b37('0x47')]({'where':{'id':_0x5f2135['params']['id']}})[_0x7b37('0x24')](handleEntityNotFound(_0x45cabc,null))[_0x7b37('0x24')](saveUpdates(_0x5f2135[_0x7b37('0x46')],null))['then'](respondWithResult(_0x45cabc,null))[_0x7b37('0x43')](handleError(_0x45cabc,null));};exports[_0x7b37('0x25')]=function(_0x554ae8,_0x10e9aa){return db[_0x7b37('0x3e')][_0x7b37('0x47')]({'where':{'id':_0x554ae8[_0x7b37('0x45')]['id']}})['then'](handleEntityNotFound(_0x10e9aa,null))[_0x7b37('0x24')](removeEntity(_0x10e9aa,null))['catch'](handleError(_0x10e9aa,null));};exports[_0x7b37('0x48')]=function(_0x3b9467,_0x2c901f){return db[_0x7b37('0x3e')][_0x7b37('0x48')]()[_0x7b37('0x24')](respondWithResult(_0x2c901f,null))[_0x7b37('0x43')](handleError(_0x2c901f,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 2febef1..058dfe5 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 _0x2753=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x45a8a2,_0x4fc41d){var _0x53ff24=function(_0x114677){while(--_0x114677){_0x45a8a2['push'](_0x45a8a2['shift']());}};_0x53ff24(++_0x4fc41d);}(_0x2753,0x163));var _0x3275=function(_0x58ef64,_0x47c44e){_0x58ef64=_0x58ef64-0x0;var _0x51584b=_0x2753[_0x58ef64];return _0x51584b;};'use strict';var _=require(_0x3275('0x0'));var util=require(_0x3275('0x1'));var logger=require(_0x3275('0x2'))(_0x3275('0x3'));var moment=require(_0x3275('0x4'));var BPromise=require(_0x3275('0x5'));var rp=require(_0x3275('0x6'));var fs=require('fs');var path=require(_0x3275('0x7'));var rimraf=require('rimraf');var config=require(_0x3275('0x8'));var attributes=require(_0x3275('0x9'));module[_0x3275('0xa')]=function(_0x2c59a5,_0x5a76af){return _0x2c59a5[_0x3275('0xb')](_0x3275('0xc'),attributes,{'tableName':_0x3275('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x763f=['../../config/logger','api','bluebird','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0xb66df,_0x4fb5ce){var _0x42a702=function(_0x252d1d){while(--_0x252d1d){_0xb66df['push'](_0xb66df['shift']());}};_0x42a702(++_0x4fb5ce);}(_0x763f,0x15d));var _0xf763=function(_0x54b543,_0x5580ff){_0x54b543=_0x54b543-0x0;var _0x344a29=_0x763f[_0x54b543];return _0x344a29;};'use strict';var _=require(_0xf763('0x0'));var util=require(_0xf763('0x1'));var logger=require(_0xf763('0x2'))(_0xf763('0x3'));var moment=require('moment');var BPromise=require(_0xf763('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf763('0x5'));var config=require(_0xf763('0x6'));var attributes=require(_0xf763('0x7'));module[_0xf763('0x8')]=function(_0x5e4d96,_0x2f390e){return _0x5e4d96[_0xf763('0x9')](_0xf763('0xa'),attributes,{'tableName':_0xf763('0xb'),'paranoid':![],'indexes':[{'name':_0xf763('0xc'),'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 a8d4583..58690c8 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 _0x4425=['message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','client','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1a10af,_0x1e25dd){var _0x246f2b=function(_0x446c09){while(--_0x446c09){_0x1a10af['push'](_0x1a10af['shift']());}};_0x246f2b(++_0x1e25dd);}(_0x4425,0xc0));var _0x5442=function(_0x566513,_0x42cdde){_0x566513=_0x566513-0x0;var _0x241b44=_0x4425[_0x566513];return _0x241b44;};'use strict';var _=require(_0x5442('0x0'));var util=require(_0x5442('0x1'));var moment=require(_0x5442('0x2'));var BPromise=require('bluebird');var rs=require(_0x5442('0x3'));var fs=require('fs');var Redis=require(_0x5442('0x4'));var db=require(_0x5442('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5442('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5442('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c34aa,_0x3cce63,_0x700321){return new BPromise(function(_0x230ed6,_0x13af69){return client[_0x5442('0x8')](_0x3c34aa,_0x700321)[_0x5442('0x9')](function(_0x41692f){logger[_0x5442('0xa')](_0x5442('0xb'),_0x3cce63,'request\x20sent');logger['debug'](_0x5442('0xc'),_0x3cce63,_0x5442('0xd'),JSON[_0x5442('0xe')](_0x41692f));if(_0x41692f[_0x5442('0xf')]){if(_0x41692f[_0x5442('0xf')][_0x5442('0x10')]===0x1f4){logger[_0x5442('0xf')](_0x5442('0xb'),_0x3cce63,_0x41692f[_0x5442('0xf')][_0x5442('0x11')]);return _0x13af69(_0x41692f[_0x5442('0xf')][_0x5442('0x11')]);}logger['error'](_0x5442('0xb'),_0x3cce63,_0x41692f[_0x5442('0xf')][_0x5442('0x11')]);return _0x230ed6(_0x41692f[_0x5442('0xf')][_0x5442('0x11')]);}else{logger['info'](_0x5442('0xb'),_0x3cce63,_0x5442('0xd'));_0x230ed6(_0x41692f['result']['message']);}})[_0x5442('0x12')](function(_0x4c800c){logger[_0x5442('0xf')](_0x5442('0xb'),_0x3cce63,_0x4c800c);_0x13af69(_0x4c800c);});});} \ No newline at end of file +var _0x092f=['error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x37804c,_0x351907){var _0x5e1a28=function(_0x62ff4f){while(--_0x62ff4f){_0x37804c['push'](_0x37804c['shift']());}};_0x5e1a28(++_0x351907);}(_0x092f,0xa0));var _0xf092=function(_0x224f65,_0x4750bf){_0x224f65=_0x224f65-0x0;var _0x3f921c=_0x092f[_0x224f65];return _0x3f921c;};'use strict';var _=require(_0xf092('0x0'));var util=require(_0xf092('0x1'));var moment=require(_0xf092('0x2'));var BPromise=require(_0xf092('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf092('0x4'));var db=require(_0xf092('0x5'))['db'];var utils=require(_0xf092('0x6'));var logger=require(_0xf092('0x7'))(_0xf092('0x8'));var config=require(_0xf092('0x9'));var jayson=require(_0xf092('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a41fe,_0x1fc78d,_0x162ced){return new BPromise(function(_0x304c0b,_0xf4c72f){return client[_0xf092('0xb')](_0x1a41fe,_0x162ced)['then'](function(_0xe4b85f){logger[_0xf092('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1fc78d,'request\x20sent');logger[_0xf092('0xd')](_0xf092('0xe'),_0x1fc78d,'request\x20sent',JSON[_0xf092('0xf')](_0xe4b85f));if(_0xe4b85f[_0xf092('0x10')]){if(_0xe4b85f['error'][_0xf092('0x11')]===0x1f4){logger['error'](_0xf092('0x12'),_0x1fc78d,_0xe4b85f[_0xf092('0x10')][_0xf092('0x13')]);return _0xf4c72f(_0xe4b85f['error'][_0xf092('0x13')]);}logger[_0xf092('0x10')](_0xf092('0x12'),_0x1fc78d,_0xe4b85f[_0xf092('0x10')][_0xf092('0x13')]);return _0x304c0b(_0xe4b85f[_0xf092('0x10')][_0xf092('0x13')]);}else{logger['info'](_0xf092('0x12'),_0x1fc78d,'request\x20sent');_0x304c0b(_0xe4b85f[_0xf092('0x14')][_0xf092('0x13')]);}})[_0xf092('0x15')](function(_0x344f63){logger[_0xf092('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1fc78d,_0x344f63);_0xf4c72f(_0x344f63);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 33b329f..cb7ff4e 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f72=['./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','default','then','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','online','name','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./config/seedDB','./config/license','./config/environment','./config/logger','./config/pm2'];(function(_0x418ca7,_0x2f4468){var _0x235d6a=function(_0x86cbb2){while(--_0x86cbb2){_0x418ca7['push'](_0x418ca7['shift']());}};_0x235d6a(++_0x2f4468);}(_0x6f72,0xae));var _0x26f7=function(_0x4b0ca8,_0x1a1af3){_0x4b0ca8=_0x4b0ca8-0x0;var _0x8e13e2=_0x6f72[_0x4b0ca8];return _0x8e13e2;};'use strict';var _=require('lodash');var db=require(_0x26f7('0x0'))['db'];var seedDb=require(_0x26f7('0x1'));var checkLicense=require(_0x26f7('0x2'));var rpc=require('./rpc');var config=require(_0x26f7('0x3'));var logger=require(_0x26f7('0x4'))('app');var pm2=require(_0x26f7('0x5'));var pm2Config=require(_0x26f7('0x6'));var schedule=require('./config/schedule');var chat=require(_0x26f7('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x26f7('0x8'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x26f7('0x9')][_0x26f7('0xa')]()['then'](function(){if(config['seedDB']){return seedDb[_0x26f7('0xb')]();}})[_0x26f7('0xc')](function(){return checkLicense[_0x26f7('0xb')]();})[_0x26f7('0xc')](function(){return rpc[_0x26f7('0xd')]();})[_0x26f7('0xc')](function(_0x1ade91){logger[_0x26f7('0xe')](_0x1ade91);return chat['start']();})[_0x26f7('0xc')](function(){return whatsapp['start']();})[_0x26f7('0xc')](function(){return schedule[_0x26f7('0xf')]();})[_0x26f7('0xc')](function(){return transcribe[_0x26f7('0xf')]();})[_0x26f7('0xc')](function(){return provider[_0x26f7('0xf')]();})[_0x26f7('0xc')](function(_0x64b65a){logger[_0x26f7('0xe')](_0x64b65a);return pm2[_0x26f7('0xf')](pm2Config);})[_0x26f7('0xc')](function(_0x1c074d){var _0x4c58ca=_0x1c074d[_0x26f7('0x10')](function(_0xe6ba20){return typeof _0xe6ba20[_0x26f7('0x11')]===_0x26f7('0x12')&&_0xe6ba20['exitCode']>=0x0;});if(_0x4c58ca[_0x26f7('0x13')]>0x0){throw new Error(_0x4c58ca['length']+_0x26f7('0x14')+_[_0x26f7('0x15')](_0x4c58ca,function(_0x27d28f){return'\x22'+_0x27d28f[_0x26f7('0x16')]['name']+'\x22';}));}logger['info'](_0x26f7('0x17'),_['map'](_[_0x26f7('0x10')](_0x1c074d,{'status':_0x26f7('0x18')}),_0x26f7('0x19'))[_0x26f7('0x1a')]());logger[_0x26f7('0xe')](_0x26f7('0x1b'),_[_0x26f7('0x15')](_[_0x26f7('0x10')](_0x1c074d,function(_0x3297df){return _0x3297df[_0x26f7('0x1c')]!=='online';}),_0x26f7('0x19'))[_0x26f7('0x1a')]()||_0x26f7('0x1d'));console[_0x26f7('0x1e')](_0x26f7('0x1f'));})[_0x26f7('0x20')](function(_0x2f04bb){console[_0x26f7('0x1e')](_0x26f7('0x21'),_0x2f04bb);logger[_0x26f7('0x22')](_0x26f7('0x23'),_0x2f04bb);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x8d0e=['./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','info','Online\x20apps:','online','join','status','name','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule'];(function(_0x18e3e7,_0x39886c){var _0x211dee=function(_0x1dc34b){while(--_0x1dc34b){_0x18e3e7['push'](_0x18e3e7['shift']());}};_0x211dee(++_0x39886c);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x481329,_0x54505b){_0x481329=_0x481329-0x0;var _0x2bdf98=_0x8d0e[_0x481329];return _0x2bdf98;};'use strict';var _=require(_0xe8d0('0x0'));var db=require(_0xe8d0('0x1'))['db'];var seedDb=require(_0xe8d0('0x2'));var checkLicense=require(_0xe8d0('0x3'));var rpc=require(_0xe8d0('0x4'));var config=require(_0xe8d0('0x5'));var logger=require(_0xe8d0('0x6'))(_0xe8d0('0x7'));var pm2=require(_0xe8d0('0x8'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xe8d0('0x9'));var chat=require('./config/schedule/chat');var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xe8d0('0xa'));var provider=require(_0xe8d0('0xb'));function main(){return db[_0xe8d0('0xc')][_0xe8d0('0xd')]()[_0xe8d0('0xe')](function(){if(config[_0xe8d0('0xf')]){return seedDb[_0xe8d0('0x10')]();}})[_0xe8d0('0xe')](function(){return checkLicense['default']();})[_0xe8d0('0xe')](function(){return rpc[_0xe8d0('0x11')]();})[_0xe8d0('0xe')](function(_0x599bc3){logger['info'](_0x599bc3);return chat[_0xe8d0('0x12')]();})[_0xe8d0('0xe')](function(){return whatsapp[_0xe8d0('0x12')]();})[_0xe8d0('0xe')](function(){return schedule[_0xe8d0('0x12')]();})[_0xe8d0('0xe')](function(){return transcribe['start']();})[_0xe8d0('0xe')](function(){return provider[_0xe8d0('0x12')]();})['then'](function(_0x2b640d){logger['info'](_0x2b640d);return pm2['start'](pm2Config);})[_0xe8d0('0xe')](function(_0x2aa906){var _0x1aa725=_0x2aa906[_0xe8d0('0x13')](function(_0x15d3a1){return typeof _0x15d3a1[_0xe8d0('0x14')]==='number'&&_0x15d3a1[_0xe8d0('0x14')]>=0x0;});if(_0x1aa725['length']>0x0){throw new Error(_0x1aa725[_0xe8d0('0x15')]+_0xe8d0('0x16')+_[_0xe8d0('0x17')](_0x1aa725,function(_0x4d1db4){return'\x22'+_0x4d1db4['pm2_env']['name']+'\x22';}));}logger[_0xe8d0('0x18')](_0xe8d0('0x19'),_[_0xe8d0('0x17')](_[_0xe8d0('0x13')](_0x2aa906,{'status':_0xe8d0('0x1a')}),'name')[_0xe8d0('0x1b')]());logger[_0xe8d0('0x18')]('Offline\x20apps:',_['map'](_['filter'](_0x2aa906,function(_0x384a60){return _0x384a60[_0xe8d0('0x1c')]!==_0xe8d0('0x1a');}),_0xe8d0('0x1d'))[_0xe8d0('0x1b')]()||_0xe8d0('0x1e'));console[_0xe8d0('0x1f')](_0xe8d0('0x20'));})[_0xe8d0('0x21')](function(_0x5ab4e7){console[_0xe8d0('0x1f')](_0xe8d0('0x22'),_0x5ab4e7);logger['error'](_0xe8d0('0x23'),_0x5ab4e7);process[_0xe8d0('0x24')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index dcefe74..91419a7 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 _0x1eba=['headers','Basic','User','find','authenticate','pass','Wrong\x20credentials.','Bearer','query','apikey','getUuid','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','splice','unshift','promisify','secret','payload','options','verify','randomBytes','hex','HS512','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','name','email','permissions','voicePause','mailPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','json','Unmanaged.','catch','authorization','startsWith'];(function(_0x11780d,_0x43b8a0){var _0xea8398=function(_0x554feb){while(--_0x554feb){_0x11780d['push'](_0x11780d['shift']());}};_0xea8398(++_0x43b8a0);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x197185,_0x251145){_0x197185=_0x197185-0x0;var _0x2c8af1=_0x1eba[_0x197185];return _0x2c8af1;};'use strict';var db=require(_0xa1eb('0x0'))['db'];var config=require(_0xa1eb('0x1'));var hardwareConf=require(_0xa1eb('0x2'));var licenseUtil=require(_0xa1eb('0x3'));var encryptor=require(_0xa1eb('0x4'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0xa1eb('0x5'));var compose=require(_0xa1eb('0x6'));var basicAuth=require(_0xa1eb('0x7'));var crypto=require(_0xa1eb('0x8'));var BPromise=require(_0xa1eb('0x9'));var util=require(_0xa1eb('0xa'));var moment=require(_0xa1eb('0xb'));var validateJwt=expressJwt({'secret':config[_0xa1eb('0xc')][_0xa1eb('0xd')]});var userAttributes=['id',_0xa1eb('0xe'),_0xa1eb('0xf'),_0xa1eb('0x10'),'internal',_0xa1eb('0x11'),'userpic',_0xa1eb('0x12'),'md5secret',_0xa1eb('0x13'),'chatPause',_0xa1eb('0x14'),'faxPause',_0xa1eb('0x15'),_0xa1eb('0x16'),_0xa1eb('0x17'),'showWebBar',_0xa1eb('0x18'),_0xa1eb('0x19'),'crudPermissions',_0xa1eb('0x1a'),'passwordResetAt','alias',_0xa1eb('0x1b'),'phoneBarAutoAnswerDelay',_0xa1eb('0x1c'),_0xa1eb('0x1d'),_0xa1eb('0x1e'),_0xa1eb('0x1f'),_0xa1eb('0x20'),_0xa1eb('0x21'),_0xa1eb('0x22'),_0xa1eb('0x23'),_0xa1eb('0x24'),'interface',_0xa1eb('0x25'),'privacyEnabled',_0xa1eb('0x26'),_0xa1eb('0x27'),_0xa1eb('0x28'),_0xa1eb('0x29'),'downloadAttachments',_0xa1eb('0x2a'),_0xa1eb('0x2b'),_0xa1eb('0x2c'),_0xa1eb('0x2d'),_0xa1eb('0x2e'),_0xa1eb('0x2f'),_0xa1eb('0x30'),_0xa1eb('0x31'),'openchannelAutoanswer',_0xa1eb('0x32'),'faxAutoanswer',_0xa1eb('0x33'),_0xa1eb('0x34'),_0xa1eb('0x35'),_0xa1eb('0x36')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0xa1eb('0x37')](function(_0xc64cb9,_0x5b0903,_0x437b2a){if(_0xc64cb9[_0xa1eb('0x38')]){_0x437b2a();}else{return db[_0xa1eb('0x39')][_0xa1eb('0x3a')]({'where':{'id':_0xc64cb9[_0xa1eb('0x3b')]['id']},'attributes':['id',_0xa1eb('0x3c'),_0xa1eb('0x3d')],'raw':!![]})[_0xa1eb('0x3e')](function(_0xd7bb88){if(_0xd7bb88&&_0xd7bb88[_0xa1eb('0x3c')]){return _0x5b0903[_0xa1eb('0x3f')](_0xd7bb88[_0xa1eb('0x3d')]==='unmanaged'?0x195:0x193)[_0xa1eb('0x40')]({'message':_0xd7bb88[_0xa1eb('0x3d')]==='unmanaged'?_0xa1eb('0x41'):'Forbidden.'});}else{_0x437b2a();}})[_0xa1eb('0x42')](function(_0x2d31d1){_0x437b2a(_0x2d31d1);});}});};exports['isAuthenticated']=function isAuthenticated(_0x45ff0d){return compose()[_0xa1eb('0x37')](function(_0x136835,_0x4f64bb,_0x12cf56){var _0x41b3ad;if(_0x136835['headers'][_0xa1eb('0x43')]){if(_[_0xa1eb('0x44')](_0x136835[_0xa1eb('0x45')][_0xa1eb('0x43')],_0xa1eb('0x46'))){var _0x52f9c7=basicAuth(_0x136835);db[_0xa1eb('0x47')][_0xa1eb('0x48')]({'where':{'name':_0x52f9c7[_0xa1eb('0x10')]}})[_0xa1eb('0x3e')](function(_0x383e26){if(!_0x383e26||!_0x383e26[_0xa1eb('0x49')](_0x52f9c7[_0xa1eb('0x4a')])){return _0x4f64bb[_0xa1eb('0x3f')](0x191)[_0xa1eb('0x40')]({'message':_0xa1eb('0x4b')});}_0x136835[_0xa1eb('0x38')]={'id':_0x383e26['id']};_0x12cf56();})['catch'](function(_0x563b11){_0x12cf56(_0x563b11);});}else if(_[_0xa1eb('0x44')](_0x136835[_0xa1eb('0x45')][_0xa1eb('0x43')],_0xa1eb('0x4c'))){validateJwt(_0x136835,_0x4f64bb,_0x12cf56);}else{if(_0x45ff0d){_0x12cf56();}else{return _0x4f64bb[_0xa1eb('0x3f')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x136835[_0xa1eb('0x4d')][_0xa1eb('0x4e')]){try{var _0x516c14={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xa1eb('0x4f')]()};verifyJwt(_0x136835['query'][_0xa1eb('0x4e')],_0x516c14)['then'](function(_0x47737d){return db[_0xa1eb('0x47')][_0xa1eb('0x48')]({'where':{'id':_0x47737d['sub']}})[_0xa1eb('0x3e')](function(_0x3d59b9){_0x41b3ad=_0x3d59b9;return db[_0xa1eb('0x50')]['findOne']({'where':{'id':0x1},'attributes':[_0xa1eb('0x51'),_0xa1eb('0x52')],'raw':!![]});})[_0xa1eb('0x3e')](function(_0x156b91){if(!_0x41b3ad||!_[_0xa1eb('0x53')](_0x41b3ad['apiKeyNonce'],_0x47737d[_0xa1eb('0x54')])){return _0x4f64bb[_0xa1eb('0x3f')](0x191)[_0xa1eb('0x40')]({'message':_0xa1eb('0x55')});}if(_0x41b3ad[_0xa1eb('0x56')]){return _0x4f64bb[_0xa1eb('0x3f')](0x191)[_0xa1eb('0x40')]({'message':_0xa1eb('0x57')});}if(_0x41b3ad['blocked']){if(_0x156b91[_0xa1eb('0x52')]>0x0){if(moment(_0x41b3ad[_0xa1eb('0x58')])[_0xa1eb('0x59')](_0x156b91[_0xa1eb('0x52')],_0xa1eb('0x5a'))>moment()){return _0x4f64bb['status'](0x191)[_0xa1eb('0x40')]({'message':_0xa1eb('0x57')});}}else{return _0x4f64bb[_0xa1eb('0x3f')](0x191)['json']({'message':_0xa1eb('0x57')});}}_0x136835[_0xa1eb('0x38')]={'id':_0x41b3ad['id']};_0x12cf56();});})[_0xa1eb('0x42')](function(){return _0x4f64bb[_0xa1eb('0x3f')](0x191)[_0xa1eb('0x40')]({'message':_0xa1eb('0x57')});});}catch(_0x541d4){_0x12cf56(_0x541d4);}}else if(_0x45ff0d){_0x12cf56();}else{return _0x4f64bb['status'](0x193)[_0xa1eb('0x40')]({'message':_0xa1eb('0x5b')});}})['use'](function(_0xf6c04b,_0x5d1506,_0x1744e4){if(_0xf6c04b[_0xa1eb('0x38')]){db[_0xa1eb('0x47')][_0xa1eb('0x48')]({'where':{'id':_0xf6c04b[_0xa1eb('0x38')]['id']},'attributes':userAttributes})[_0xa1eb('0x3e')](function(_0x3e8482){if(!_0x3e8482){return _0x5d1506[_0xa1eb('0x3f')](0x194)[_0xa1eb('0x40')]({'message':_0xa1eb('0x5c')});}_0xf6c04b[_0xa1eb('0x38')]=_0x3e8482;_0x1744e4();})[_0xa1eb('0x42')](function(_0x459a02){_0x1744e4(_0x459a02);});}else if(_0x45ff0d){_0x1744e4();}else{return _0x5d1506[_0xa1eb('0x3f')](0x194)[_0xa1eb('0x40')]({'message':_0xa1eb('0x5d')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xa1eb('0x37')](function(_0x4fd053,_0x3edc6b,_0x112799){return licenseUtil['getLicense']()['then'](function(_0xf9153f){if(_0xf9153f[_0xa1eb('0x5e')]){_0x112799();}else{return _0x3edc6b[_0xa1eb('0x3f')](0x193)['json']({'message':_0xa1eb('0x5f')});}})[_0xa1eb('0x42')](function(_0x26862a){_0x112799(_0x26862a);});});};exports[_0xa1eb('0x60')]=function isWebrtcLicence(){return compose()[_0xa1eb('0x37')](function(_0x6f47c5,_0x21ce06,_0x3f66a9){return licenseUtil[_0xa1eb('0x61')]()[_0xa1eb('0x3e')](function(_0x27e4f6){if(_0x27e4f6[_0xa1eb('0x62')]){_0x3f66a9();}else{return _0x21ce06[_0xa1eb('0x3f')](0x193)[_0xa1eb('0x40')]({'message':'Forbidden'});}})[_0xa1eb('0x42')](function(_0x3c15c4){_0x3f66a9(_0x3c15c4);});});};exports[_0xa1eb('0x63')]=function(_0x977d00,_0x2b0cbf,_0x12dfd4){_0x977d00[_0xa1eb('0x63')]=!![];return _0x12dfd4();};exports['signToken']=function signToken(_0x2e0292){return signJwt(_0x2e0292);};exports[_0xa1eb('0x64')]=function(_0x27021a,_0x10a6da){if(!_0x27021a[_0xa1eb('0x38')]){return _0x10a6da[_0xa1eb('0x3f')](0x194)[_0xa1eb('0x40')]({'message':_0xa1eb('0x65')});}var _0x15ade7={'payload':{'id':_0x27021a['user']['id'],'role':_0x27021a[_0xa1eb('0x38')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x15ade7)[_0xa1eb('0x3e')](function(_0x495c01){_0x10a6da[_0xa1eb('0x66')](_0xa1eb('0x67'),_0x495c01);_0x10a6da[_0xa1eb('0x68')]('/dashboards/general');})[_0xa1eb('0x42')](function(_0xbd9a42){return _0x10a6da['status'](0x1f4)[_0xa1eb('0x69')](_0xbd9a42);});};exports[_0xa1eb('0x6a')]=function(_0x3f1833){if(_[_0xa1eb('0x6b')](_0x3f1833[_0xa1eb('0x6c')])||_[_0xa1eb('0x6b')](_0x3f1833[_0xa1eb('0x6d')])){return null;}else{return createJwt(_0x3f1833);}};exports[_0xa1eb('0x6e')]=function(_0x1ed140){_0x1ed140[_0xa1eb('0x6c')]=generateNonce();_0x1ed140[_0xa1eb('0x6d')]=generateIssuedAt();return createJwt(_0x1ed140);};exports[_0xa1eb('0x6f')]=function(_0x159a19,_0x260c4a){var _0x40f119=_0x159a19[_0xa1eb('0x4d')][_0xa1eb('0x4e')];if(_0x40f119){var _0x589186={'nonce':_0x260c4a[_0xa1eb('0x6c')],'iat':_0x260c4a[_0xa1eb('0x6d')],'audience':hardwareConf[_0xa1eb('0x4f')](),'issuer':hardwareConf[_0xa1eb('0x4f')]()};return verifyJwt(_0x40f119,_0x589186)[_0xa1eb('0x3e')](function(){return generateApiKey(_0x260c4a);});}else{throw{'message':_0xa1eb('0x70')};}};exports['validatePasswordPattern']=function(_0x97972c){var _0x3c7712=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3c7712[_0xa1eb('0x71')](_0x97972c))throw new db[(_0xa1eb('0x72'))][(_0xa1eb('0x73'))](_0xa1eb('0x74'));return;};exports[_0xa1eb('0x75')]=function(_0x51222b,_0x257236,_0xdebe47){var _0x378726=encryptor[_0xa1eb('0x76')](_0x257236)['split'](',');for(var _0x5af1e6=0x0;_0x5af1e6<_0xdebe47;_0x5af1e6++){if(!_0x378726[_0x5af1e6])break;if(_0x51222b['toLowerCase']()===_0x378726[_0x5af1e6]['toLowerCase']()){var _0x1b3c33=util[_0xa1eb('0x77')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xdebe47);if(_0xdebe47===0x1){_0x1b3c33=_0xa1eb('0x78');}throw new db[(_0xa1eb('0x72'))][(_0xa1eb('0x73'))](_0x1b3c33);}}return;};exports[_0xa1eb('0x79')]=function(_0x4edf8e,_0x481d19){var _0x201e6a=_0x481d19?encryptor[_0xa1eb('0x76')](_0x481d19)[_0xa1eb('0x7a')](','):[];if(_0x201e6a[_0xa1eb('0x7b')]===0x5){_0x201e6a[_0xa1eb('0x7c')](-0x1,0x1);}_0x201e6a[_0xa1eb('0x7d')](_0x4edf8e);return encryptor['encryptString'](_0x201e6a['join'](','));};function signJwt(_0x43f223){var _0x5afc3e=BPromise[_0xa1eb('0x7e')](jwt['sign'],{'context':jwt});var _0x389efc=_0x43f223[_0xa1eb('0x7f')]||config['secrets'][_0xa1eb('0xd')];return new BPromise(function(_0xf48372,_0x501596){_0x5afc3e(_0x43f223[_0xa1eb('0x80')],_0x389efc,_0x43f223[_0xa1eb('0x81')])[_0xa1eb('0x3e')](function(_0x574461){_0xf48372(_0x574461);})[_0xa1eb('0x42')](function(_0x11e85f){_0x501596(_0x11e85f);});});}function verifyJwt(_0x4af59a,_0x62f9cb,_0x151adf){var _0x139a37=BPromise['promisify'](jwt[_0xa1eb('0x82')],{'context':jwt});var _0x5aa916=_0x151adf||config[_0xa1eb('0xc')][_0xa1eb('0xd')];return new BPromise(function(_0x40eae0,_0x331a80){_0x139a37(_0x4af59a,_0x5aa916,_0x62f9cb)[_0xa1eb('0x3e')](function(_0x48f49d){_0x40eae0(_0x48f49d);})[_0xa1eb('0x42')](function(_0x401800){_0x331a80(_0x401800);});});}function generateNonce(){return crypto[_0xa1eb('0x83')](0x10)['toString'](_0xa1eb('0x84'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)['toString']();}function createJwt(_0x555ded){var _0x3b60a7={'payload':{'iat':_0x555ded[_0xa1eb('0x6d')],'nonce':_0x555ded[_0xa1eb('0x6c')]},'options':{'algorithm':_0xa1eb('0x85'),'subject':_0x555ded['id'][_0xa1eb('0x86')](),'issuer':hardwareConf[_0xa1eb('0x4f')](),'audience':hardwareConf[_0xa1eb('0x4f')]()}};return signJwt(_0x3b60a7)[_0xa1eb('0x3e')](function(_0x267610){return{'iat':_0x555ded[_0xa1eb('0x6d')],'nonce':_0x555ded['apiKeyNonce'],'token':_0x267610};});} \ No newline at end of file +var _0xef0f=['settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','use','user','ChatInteraction','findOne','params','then','closed','status','disposition','unmanaged','json','Forbidden.','catch','isAuthenticated','headers','authorization','User','pass','Bearer','query','apikey','getUuid','find','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','isWebrtcLicence','Forbidden','isMiddleware','signToken','setTokenCookie','role','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','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~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','decryptString','length','unshift','encryptString','promisify','sign','secret','payload','options','verify','toString','hex','now','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','util','moment','secrets','session','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled'];(function(_0x114fc9,_0x3482e4){var _0x1ef510=function(_0x1f6ce2){while(--_0x1f6ce2){_0x114fc9['push'](_0x114fc9['shift']());}};_0x1ef510(++_0x3482e4);}(_0xef0f,0x168));var _0xfef0=function(_0x305ba2,_0x4e9ffe){_0x305ba2=_0x305ba2-0x0;var _0xb79482=_0xef0f[_0x305ba2];return _0xb79482;};'use strict';var db=require(_0xfef0('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xfef0('0x1'));var licenseUtil=require(_0xfef0('0x2'));var encryptor=require(_0xfef0('0x3'));var _=require('lodash');var jwt=require(_0xfef0('0x4'));var expressJwt=require(_0xfef0('0x5'));var compose=require(_0xfef0('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0xfef0('0x7'));var BPromise=require(_0xfef0('0x8'));var util=require(_0xfef0('0x9'));var moment=require(_0xfef0('0xa'));var validateJwt=expressJwt({'secret':config[_0xfef0('0xb')][_0xfef0('0xc')]});var userAttributes=['id','role',_0xfef0('0xd'),'name',_0xfef0('0xe'),_0xfef0('0xf'),_0xfef0('0x10'),_0xfef0('0x11'),_0xfef0('0x12'),_0xfef0('0x13'),_0xfef0('0x14'),_0xfef0('0x15'),_0xfef0('0x16'),_0xfef0('0x17'),_0xfef0('0x18'),_0xfef0('0x19'),_0xfef0('0x1a'),_0xfef0('0x1b'),'lastPauseAt',_0xfef0('0x1c'),_0xfef0('0x1d'),_0xfef0('0x1e'),_0xfef0('0x1f'),_0xfef0('0x20'),_0xfef0('0x21'),_0xfef0('0x22'),'phoneBarEnableRecording',_0xfef0('0x23'),'phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired',_0xfef0('0x24'),_0xfef0('0x25'),_0xfef0('0x26'),_0xfef0('0x27'),_0xfef0('0x28'),_0xfef0('0x29'),_0xfef0('0x2a'),_0xfef0('0x2b'),'downloadVoiceRecordings',_0xfef0('0x2c'),_0xfef0('0x2d'),_0xfef0('0x2e'),_0xfef0('0x2f'),_0xfef0('0x30'),'chatAutoanswerDelay',_0xfef0('0x31'),'emailAutoanswerDelay',_0xfef0('0x32'),_0xfef0('0x33'),_0xfef0('0x34'),'openchannelAutoanswerDelay',_0xfef0('0x35'),'faxAutoanswerDelay',_0xfef0('0x36'),_0xfef0('0x37'),'messengerSoundNotification'];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0xfef0('0x38')](function(_0x4faea8,_0x1f9970,_0x46b34a){if(_0x4faea8[_0xfef0('0x39')]){_0x46b34a();}else{return db[_0xfef0('0x3a')][_0xfef0('0x3b')]({'where':{'id':_0x4faea8[_0xfef0('0x3c')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0xfef0('0x3d')](function(_0x1ffaa4){if(_0x1ffaa4&&_0x1ffaa4[_0xfef0('0x3e')]){return _0x1f9970[_0xfef0('0x3f')](_0x1ffaa4[_0xfef0('0x40')]===_0xfef0('0x41')?0x195:0x193)[_0xfef0('0x42')]({'message':_0x1ffaa4[_0xfef0('0x40')]===_0xfef0('0x41')?'Unmanaged.':_0xfef0('0x43')});}else{_0x46b34a();}})[_0xfef0('0x44')](function(_0xca0cce){_0x46b34a(_0xca0cce);});}});};exports[_0xfef0('0x45')]=function isAuthenticated(_0x37921f){return compose()[_0xfef0('0x38')](function(_0x3e3c4c,_0x3e026a,_0x26cb9a){var _0x213a91;if(_0x3e3c4c[_0xfef0('0x46')][_0xfef0('0x47')]){if(_['startsWith'](_0x3e3c4c[_0xfef0('0x46')]['authorization'],'Basic')){var _0x7d1692=basicAuth(_0x3e3c4c);db[_0xfef0('0x48')]['find']({'where':{'name':_0x7d1692['name']}})['then'](function(_0x4f65cd){if(!_0x4f65cd||!_0x4f65cd['authenticate'](_0x7d1692[_0xfef0('0x49')])){return _0x3e026a[_0xfef0('0x3f')](0x191)[_0xfef0('0x42')]({'message':'Wrong\x20credentials.'});}_0x3e3c4c['user']={'id':_0x4f65cd['id']};_0x26cb9a();})['catch'](function(_0x1f8110){_0x26cb9a(_0x1f8110);});}else if(_['startsWith'](_0x3e3c4c[_0xfef0('0x46')][_0xfef0('0x47')],_0xfef0('0x4a'))){validateJwt(_0x3e3c4c,_0x3e026a,_0x26cb9a);}else{if(_0x37921f){_0x26cb9a();}else{return _0x3e026a['status'](0x193)[_0xfef0('0x42')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x3e3c4c[_0xfef0('0x4b')][_0xfef0('0x4c')]){try{var _0x234d49={'audience':hardwareConf[_0xfef0('0x4d')](),'issuer':hardwareConf[_0xfef0('0x4d')]()};verifyJwt(_0x3e3c4c[_0xfef0('0x4b')][_0xfef0('0x4c')],_0x234d49)[_0xfef0('0x3d')](function(_0x590e37){return db[_0xfef0('0x48')][_0xfef0('0x4e')]({'where':{'id':_0x590e37[_0xfef0('0x4f')]}})[_0xfef0('0x3d')](function(_0xae697){_0x213a91=_0xae697;return db[_0xfef0('0x50')][_0xfef0('0x3b')]({'where':{'id':0x1},'attributes':[_0xfef0('0x51'),_0xfef0('0x52')],'raw':!![]});})[_0xfef0('0x3d')](function(_0x3b668b){if(!_0x213a91||!_[_0xfef0('0x53')](_0x213a91[_0xfef0('0x54')],_0x590e37['nonce'])){return _0x3e026a[_0xfef0('0x3f')](0x191)['json']({'message':_0xfef0('0x55')});}if(_0x213a91[_0xfef0('0x56')]){return _0x3e026a[_0xfef0('0x3f')](0x191)['json']({'message':_0xfef0('0x57')});}if(_0x213a91[_0xfef0('0x58')]){if(_0x3b668b[_0xfef0('0x52')]>0x0){if(moment(_0x213a91['blockedAt'])[_0xfef0('0x59')](_0x3b668b[_0xfef0('0x52')],_0xfef0('0x5a'))>moment()){return _0x3e026a['status'](0x191)[_0xfef0('0x42')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x3e026a['status'](0x191)[_0xfef0('0x42')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x3e3c4c['user']={'id':_0x213a91['id']};_0x26cb9a();});})[_0xfef0('0x44')](function(){return _0x3e026a[_0xfef0('0x3f')](0x191)[_0xfef0('0x42')]({'message':_0xfef0('0x57')});});}catch(_0x3a3844){_0x26cb9a(_0x3a3844);}}else if(_0x37921f){_0x26cb9a();}else{return _0x3e026a[_0xfef0('0x3f')](0x193)['json']({'message':_0xfef0('0x5b')});}})[_0xfef0('0x38')](function(_0x5a9ed3,_0x54d5cb,_0x1d554e){if(_0x5a9ed3['user']){db[_0xfef0('0x48')][_0xfef0('0x4e')]({'where':{'id':_0x5a9ed3[_0xfef0('0x39')]['id']},'attributes':userAttributes})[_0xfef0('0x3d')](function(_0x199c57){if(!_0x199c57){return _0x54d5cb[_0xfef0('0x3f')](0x194)[_0xfef0('0x42')]({'message':_0xfef0('0x5c')});}_0x5a9ed3['user']=_0x199c57;_0x1d554e();})[_0xfef0('0x44')](function(_0x50e372){_0x1d554e(_0x50e372);});}else if(_0x37921f){_0x1d554e();}else{return _0x54d5cb['status'](0x194)[_0xfef0('0x42')]({'message':_0xfef0('0x5d')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xfef0('0x38')](function(_0x5587a9,_0x39df7c,_0x30ef5d){return licenseUtil[_0xfef0('0x5e')]()[_0xfef0('0x3d')](function(_0x544876){if(_0x544876[_0xfef0('0x5f')]){_0x30ef5d();}else{return _0x39df7c[_0xfef0('0x3f')](0x193)['json']({'message':'Forbidden'});}})[_0xfef0('0x44')](function(_0x4f3231){_0x30ef5d(_0x4f3231);});});};exports[_0xfef0('0x60')]=function isWebrtcLicence(){return compose()[_0xfef0('0x38')](function(_0x390247,_0x19acde,_0x1c3e04){return licenseUtil[_0xfef0('0x5e')]()['then'](function(_0xda901e){if(_0xda901e['webrtc']){_0x1c3e04();}else{return _0x19acde['status'](0x193)[_0xfef0('0x42')]({'message':_0xfef0('0x61')});}})[_0xfef0('0x44')](function(_0x5a9750){_0x1c3e04(_0x5a9750);});});};exports[_0xfef0('0x62')]=function(_0x4e1271,_0x5dd26b,_0x51f207){_0x4e1271[_0xfef0('0x62')]=!![];return _0x51f207();};exports[_0xfef0('0x63')]=function signToken(_0x249934){return signJwt(_0x249934);};exports[_0xfef0('0x64')]=function(_0x2712e9,_0xa23cc8){if(!_0x2712e9[_0xfef0('0x39')]){return _0xa23cc8[_0xfef0('0x3f')](0x194)[_0xfef0('0x42')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x512f7a={'payload':{'id':_0x2712e9[_0xfef0('0x39')]['id'],'role':_0x2712e9[_0xfef0('0x39')][_0xfef0('0x65')]},'options':{'expiresIn':0x15180}};return signJwt(_0x512f7a)[_0xfef0('0x3d')](function(_0x393fee){_0xa23cc8[_0xfef0('0x66')](_0xfef0('0x67'),_0x393fee);_0xa23cc8[_0xfef0('0x68')]('/dashboards/general');})[_0xfef0('0x44')](function(_0x19e449){return _0xa23cc8[_0xfef0('0x3f')](0x1f4)[_0xfef0('0x69')](_0x19e449);});};exports[_0xfef0('0x6a')]=function(_0x5a00db){if(_['isNil'](_0x5a00db['apiKeyNonce'])||_[_0xfef0('0x6b')](_0x5a00db[_0xfef0('0x6c')])){return null;}else{return createJwt(_0x5a00db);}};exports[_0xfef0('0x6d')]=function(_0x22adf3){_0x22adf3['apiKeyNonce']=generateNonce();_0x22adf3[_0xfef0('0x6c')]=generateIssuedAt();return createJwt(_0x22adf3);};exports[_0xfef0('0x6e')]=function(_0x302908,_0x28b90c){var _0x19dcd3=_0x302908[_0xfef0('0x4b')][_0xfef0('0x4c')];if(_0x19dcd3){var _0x4cd0fd={'nonce':_0x28b90c[_0xfef0('0x54')],'iat':_0x28b90c[_0xfef0('0x6c')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xfef0('0x4d')]()};return verifyJwt(_0x19dcd3,_0x4cd0fd)['then'](function(){return generateApiKey(_0x28b90c);});}else{throw{'message':_0xfef0('0x6f')};}};exports[_0xfef0('0x70')]=function(_0x5cf1fa){var _0x1e1c02=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1e1c02['test'](_0x5cf1fa))throw new db['Sequelize']['ValidationError'](_0xfef0('0x71'));return;};exports[_0xfef0('0x72')]=function(_0x455923,_0x34fda3,_0x16a498){var _0x2d63e8=encryptor['decryptString'](_0x34fda3)[_0xfef0('0x73')](',');for(var _0x4156d5=0x0;_0x4156d5<_0x16a498;_0x4156d5++){if(!_0x2d63e8[_0x4156d5])break;if(_0x455923[_0xfef0('0x74')]()===_0x2d63e8[_0x4156d5][_0xfef0('0x74')]()){var _0x21fd2b=util['format'](_0xfef0('0x75'),_0x16a498);if(_0x16a498===0x1){_0x21fd2b='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xfef0('0x76'))]['ValidationError'](_0x21fd2b);}}return;};exports[_0xfef0('0x77')]=function(_0x851e97,_0xdd1121){var _0x281259=_0xdd1121?encryptor[_0xfef0('0x78')](_0xdd1121)['split'](','):[];if(_0x281259[_0xfef0('0x79')]===0x5){_0x281259['splice'](-0x1,0x1);}_0x281259[_0xfef0('0x7a')](_0x851e97);return encryptor[_0xfef0('0x7b')](_0x281259['join'](','));};function signJwt(_0x3a12c5){var _0x3c5640=BPromise[_0xfef0('0x7c')](jwt[_0xfef0('0x7d')],{'context':jwt});var _0x423ec0=_0x3a12c5[_0xfef0('0x7e')]||config[_0xfef0('0xb')][_0xfef0('0xc')];return new BPromise(function(_0x17a595,_0x7eed0){_0x3c5640(_0x3a12c5[_0xfef0('0x7f')],_0x423ec0,_0x3a12c5[_0xfef0('0x80')])['then'](function(_0xeb5f8d){_0x17a595(_0xeb5f8d);})[_0xfef0('0x44')](function(_0x28cab7){_0x7eed0(_0x28cab7);});});}function verifyJwt(_0x312dcf,_0x16f0a2,_0x49ed54){var _0x12e383=BPromise[_0xfef0('0x7c')](jwt[_0xfef0('0x81')],{'context':jwt});var _0x3c6bb8=_0x49ed54||config[_0xfef0('0xb')][_0xfef0('0xc')];return new BPromise(function(_0xb9693b,_0x103ca3){_0x12e383(_0x312dcf,_0x3c6bb8,_0x16f0a2)[_0xfef0('0x3d')](function(_0x3f26d9){_0xb9693b(_0x3f26d9);})['catch'](function(_0x100c6a){_0x103ca3(_0x100c6a);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xfef0('0x82')](_0xfef0('0x83'));}function generateIssuedAt(){return Math['floor'](Date[_0xfef0('0x84')]()/0x3e8)[_0xfef0('0x82')]();}function createJwt(_0x3de7b1){var _0x6a4d10={'payload':{'iat':_0x3de7b1[_0xfef0('0x6c')],'nonce':_0x3de7b1['apiKeyNonce']},'options':{'algorithm':_0xfef0('0x85'),'subject':_0x3de7b1['id'][_0xfef0('0x82')](),'issuer':hardwareConf[_0xfef0('0x4d')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x6a4d10)[_0xfef0('0x3d')](function(_0x2ab666){return{'iat':_0x3de7b1[_0xfef0('0x6c')],'nonce':_0x3de7b1[_0xfef0('0x54')],'token':_0x2ab666};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 8c16ec2..7857e91 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 _0x145a=['keys','cf_','map','CmCustomField','findOne','slice','length','fieldType','type','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','where','filter','user','clause','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','User','buildContactsQuery','fields','rows','catch','describe','CmContact'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x145a,0x167));var _0xa145=function(_0xbae718,_0x574730){_0xbae718=_0xbae718-0x0;var _0x2c7a23=_0x145a[_0xbae718];return _0x2c7a23;};'use strict';var _=require(_0xa145('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xa145('0x1'))['db'];exports[_0xa145('0x2')]=function(_0x52e103,_0x47cb0f,_0x4a8f88,_0x1622de){var _0x51357c={'count':0x0,'rows':[]};var _0x2d9073=sqlUtils[_0xa145('0x3')](_0x47cb0f,_0x52e103);if(_0x2d9073){return Promise[_0xa145('0x4')](_0x51357c);}var _0x5620da=sqlUtils[_0xa145('0x5')]();var _0x476722={};var _0x3c58b8=![];var _0xafcda7=![];return Promise[_0xa145('0x4')]()[_0xa145('0x6')](function(){if(_0x52e103[_0xa145('0x7')]){return sqlUtils['parseAdvancedSearchFilter'](_0x52e103['search'],_0x1622de);}else{return sqlUtils['parseQueryParameters'](_0x52e103,_0x1622de);}})[_0xa145('0x6')](function(_0x3a4635){_0x5620da[_0xa145('0x8')](_0x3a4635['default']);_0x5620da['where'](_0x3a4635['fields']);_0x5620da['where'](_0x3a4635[_0xa145('0x9')]);_0x5620da[_0xa145('0x8')](_0x3a4635[_0xa145('0xa')][_0xa145('0xb')]);_0x476722=_0x3a4635[_0xa145('0xc')];_0xafcda7=_0x3a4635[_0xa145('0xa')][_0xa145('0xd')];return sqlUtils[_0xa145('0xe')](_0x47cb0f,_0x52e103,_0xafcda7);})[_0xa145('0x6')](function(_0x39ee22){_0x5620da[_0xa145('0x8')](_0x39ee22);var _0x35426f=_0x52e103[_0xa145('0x7')]?_0x476722[_0xa145('0xf')]:_0x52e103[_0xa145('0x10')];_0x3c58b8=_0x35426f?!![]:![];return sqlUtils[_0xa145('0x11')](_0x5620da,_0x35426f);})['then'](function(_0x128e1){_0x51357c[_0xa145('0x12')]=_0x128e1;if(_0x51357c[_0xa145('0x12')]===0x0){return;}if(_0x52e103[_0xa145('0x13')]){_0xafcda7=!![];}return sqlUtils[_0xa145('0x14')](_0x5620da,_0x52e103[_0xa145('0x15')],_0x4a8f88,_0x3c58b8,_0x476722[_0xa145('0xb')],_0xafcda7);})['then'](function(_0x402c23){if(!_0x402c23){return[];}return sqlUtils['getFilteredContacts'](_0x402c23,_0x52e103,_0x4a8f88);})[_0xa145('0x6')](function(_0x31ca48){_0x51357c[_0xa145('0x16')]=_0x31ca48;return _0x51357c;})[_0xa145('0x17')](function(_0x1d8e4f){throw _0x1d8e4f;});};exports[_0xa145('0x18')]=function(){var _0x2216e8={};var _0x21fd02=[];return db[_0xa145('0x19')]['describe']()[_0xa145('0x6')](function(_0x220b3e){_0x2216e8=_0x220b3e;var _0x4a9750=Object[_0xa145('0x1a')](_0x2216e8)[_0xa145('0x9')](function(_0x5bda2a){return _['startsWith'](_0x5bda2a,_0xa145('0x1b'))?_0x5bda2a:undefined;});var _0x3f89e4=_0x4a9750[_0xa145('0x1c')](function(_0x33f609){return db[_0xa145('0x1d')][_0xa145('0x1e')]({'where':{'id':_0x33f609[_0xa145('0x1f')](0x3)},'raw':!![]});});return Promise['all'](_0x3f89e4);})[_0xa145('0x6')](function(_0x3fe66c){for(var _0x4a2f9a=0x0;_0x4a2f9a<_0x3fe66c[_0xa145('0x20')];_0x4a2f9a++){if(_0x3fe66c[_0x4a2f9a]){var _0x29b50d='cf_'+_0x3fe66c[_0x4a2f9a]['id'];_0x2216e8[_0x29b50d][_0xa145('0x21')]=_0x3fe66c[_0x4a2f9a][_0xa145('0x22')];}}_0x21fd02=_[_0xa145('0x1c')](Object[_0xa145('0x1a')](_0x2216e8),function(_0x9d593b){return{'name':_0x9d593b,'type':_0x2216e8[_0x9d593b][_0xa145('0x22')]};});return _0x21fd02;})[_0xa145('0x17')](function(_0x30dc9a){throw _0x30dc9a;});}; \ No newline at end of file +var _0x8cd1=['type','map','../../mysqldb','skipContactsQuery','getContactsSubquery','then','parseAdvancedSearchFilter','search','parseQueryParameters','default','where','fields','filter','clause','tags','user','skip','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','findOne','slice','all','length'];(function(_0x1fac6a,_0x4970b7){var _0x1d0397=function(_0x470c5c){while(--_0x470c5c){_0x1fac6a['push'](_0x1fac6a['shift']());}};_0x1d0397(++_0x4970b7);}(_0x8cd1,0xe2));var _0x18cd=function(_0x1eb2b7,_0x37c80f){_0x1eb2b7=_0x1eb2b7-0x0;var _0x3284ad=_0x8cd1[_0x1eb2b7];return _0x3284ad;};'use strict';var _=require('lodash');var sqlUtils=require('./sql-utils');var db=require(_0x18cd('0x0'))['db'];exports['findAll']=function(_0x81010a,_0x4dc969,_0x199710,_0x155acb){var _0x2f26cf={'count':0x0,'rows':[]};var _0x5b8eac=sqlUtils[_0x18cd('0x1')](_0x4dc969,_0x81010a);if(_0x5b8eac){return Promise['resolve'](_0x2f26cf);}var _0x2ebfd5=sqlUtils[_0x18cd('0x2')]();var _0x272531={};var _0x562d81=![];var _0x37df78=![];return Promise['resolve']()[_0x18cd('0x3')](function(){if(_0x81010a['search']){return sqlUtils[_0x18cd('0x4')](_0x81010a[_0x18cd('0x5')],_0x155acb);}else{return sqlUtils[_0x18cd('0x6')](_0x81010a,_0x155acb);}})[_0x18cd('0x3')](function(_0x4a87f4){_0x2ebfd5['where'](_0x4a87f4[_0x18cd('0x7')]);_0x2ebfd5[_0x18cd('0x8')](_0x4a87f4[_0x18cd('0x9')]);_0x2ebfd5['where'](_0x4a87f4[_0x18cd('0xa')]);_0x2ebfd5[_0x18cd('0x8')](_0x4a87f4['user'][_0x18cd('0xb')]);_0x272531=_0x4a87f4[_0x18cd('0xc')];_0x37df78=_0x4a87f4[_0x18cd('0xd')][_0x18cd('0xe')];return sqlUtils['checkListsRestrictions'](_0x4dc969,_0x81010a,_0x37df78);})[_0x18cd('0x3')](function(_0x20a911){_0x2ebfd5[_0x18cd('0x8')](_0x20a911);var _0x55a77f=_0x81010a[_0x18cd('0x5')]?_0x272531['ids']:_0x81010a['tag'];_0x562d81=_0x55a77f?!![]:![];return sqlUtils[_0x18cd('0xf')](_0x2ebfd5,_0x55a77f);})[_0x18cd('0x3')](function(_0x2ace3a){_0x2f26cf[_0x18cd('0x10')]=_0x2ace3a;if(_0x2f26cf[_0x18cd('0x10')]===0x0){return;}if(_0x81010a['User']){_0x37df78=!![];}return sqlUtils[_0x18cd('0x11')](_0x2ebfd5,_0x81010a[_0x18cd('0x9')],_0x199710,_0x562d81,_0x272531[_0x18cd('0xb')],_0x37df78);})[_0x18cd('0x3')](function(_0x4cc3cb){if(!_0x4cc3cb){return[];}return sqlUtils[_0x18cd('0x12')](_0x4cc3cb,_0x81010a,_0x199710);})[_0x18cd('0x3')](function(_0x2cb01a){_0x2f26cf[_0x18cd('0x13')]=_0x2cb01a;return _0x2f26cf;})[_0x18cd('0x14')](function(_0x216b38){throw _0x216b38;});};exports[_0x18cd('0x15')]=function(){var _0x5c4ef2={};var _0x7a83bd=[];return db[_0x18cd('0x16')]['describe']()[_0x18cd('0x3')](function(_0x4d1fa6){_0x5c4ef2=_0x4d1fa6;var _0x1b6c9d=Object[_0x18cd('0x17')](_0x5c4ef2)['filter'](function(_0x206acb){return _[_0x18cd('0x18')](_0x206acb,_0x18cd('0x19'))?_0x206acb:undefined;});var _0x548397=_0x1b6c9d['map'](function(_0x4b9b43){return db['CmCustomField'][_0x18cd('0x1a')]({'where':{'id':_0x4b9b43[_0x18cd('0x1b')](0x3)},'raw':!![]});});return Promise[_0x18cd('0x1c')](_0x548397);})[_0x18cd('0x3')](function(_0x46fc9d){for(var _0x499fbe=0x0;_0x499fbe<_0x46fc9d[_0x18cd('0x1d')];_0x499fbe++){if(_0x46fc9d[_0x499fbe]){var _0x495877=_0x18cd('0x19')+_0x46fc9d[_0x499fbe]['id'];_0x5c4ef2[_0x495877]['fieldType']=_0x46fc9d[_0x499fbe][_0x18cd('0x1e')];}}_0x7a83bd=_[_0x18cd('0x1f')](Object[_0x18cd('0x17')](_0x5c4ef2),function(_0x4cb11a){return{'name':_0x4cb11a,'type':_0x5c4ef2[_0x4cb11a]['type']};});return _0x7a83bd;})[_0x18cd('0x14')](function(_0x3be476){throw _0x3be476;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 104ca0e..0b97b76 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 _0x3751=['Sequelize','QueryTypes','SELECT','CmContact','query','toString','Tags','clone','isEmpty','t.id\x20IN\x20?','sequelize','COUNT(*)','exports','lodash','squel','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','ListId','true','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','subqry','firstName','lastName','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','expr','getSelectedTags','replace','split','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','type','text','value','start','end','Tag','tags','ids','user','clause','uc.UserId\x20=\x20?','skip','keys','map','some','compact','Contact','User','c.ListId\x20IN\x20?','and','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','c.ListId\x20IS\x20NULL','attributes','select','c.id','limit','offset','group','subqry.id','having','order','DESC','subqry.','color'];(function(_0x1f7c06,_0xe01236){var _0x47845a=function(_0x1ebd0e){while(--_0x1ebd0e){_0x1f7c06['push'](_0x1f7c06['shift']());}};_0x47845a(++_0xe01236);}(_0x3751,0x154));var _0x1375=function(_0x27fa65,_0x4e02ee){_0x27fa65=_0x27fa65-0x0;var _0x456594=_0x3751[_0x27fa65];return _0x456594;};'use strict';var _=require(_0x1375('0x0'));var squel=require(_0x1375('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x1375('0x2'));var utils=require(_0x1375('0x3'));var db=require(_0x1375('0x4'))['db'];function skipContactsQuery(_0xc3c587,_0x57d098){var _0x1bb098=![];if(_0xc3c587[_0x1375('0x5')]===_0x1375('0x6')&&!_0x57d098['search']&&!_0x57d098[_0x1375('0x7')]&&_0x57d098['autocomplete']!==_0x1375('0x8')){_0x1bb098=!![];}return _0x1bb098;}function getContactsSubquery(){return squel['select']()[_0x1375('0x9')](_0x1375('0xa'),'c')[_0x1375('0xb')](_0x1375('0xc'));}function applyJoinClauses(_0x24f2c9,_0x2e7928){var _0x7b6aa8=_0x2e7928?'c':'subqry';_0x24f2c9[_0x1375('0xd')](_0x1375('0xe'),'uc',_0x1375('0xf')+_0x7b6aa8+_0x1375('0x10'))['left_join'](_0x1375('0x11'),'ct',_0x1375('0x12')+_0x7b6aa8+'.id')['left_join'](_0x1375('0x13'),'t',_0x1375('0x14'));return _0x24f2c9;}function addFieldsToQuery(_0x52711f,_0x5127ed,_0x167f0b,_0x1dac0b,_0x5493b9){var _0xfdb45e=_0x5493b9?'c':_0x1375('0x15');if(!_0x5127ed){_0x5127ed=['id',_0x1375('0x16'),_0x1375('0x17'),'phone',_0x1375('0x18'),_0x1375('0x19'),_0x1375('0x1a'),_0x1375('0x7'),_0x1375('0x1b'),_0x1375('0x1c'),_0x1375('0x1d'),_0x1375('0x1e'),_0x1375('0x1f')];}else if(!_0x5127ed[_0x1375('0x20')]('id')){_0x5127ed[_0x1375('0x21')]('id');}var _0x5abb38=_0x167f0b&&_0x5493b9||!_0x167f0b&&!_0x5493b9;if(_0x1dac0b){_0x5abb38=_0x1dac0b&&_0x5493b9||!_0x1dac0b&&!_0x5493b9;}_0x5127ed[_0x1375('0x22')](function(_0x46eafd){if(_0x46eafd===_0x1375('0x1f')){if(_0x5abb38){_0x52711f[_0x1375('0x23')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x46eafd);}else if(_0x167f0b||_0x1dac0b){_0x52711f[_0x1375('0x23')](_0xfdb45e+'.'+_0x46eafd);}}else{_0x52711f[_0x1375('0x23')](_0xfdb45e+'.'+_0x46eafd);}});return _0x52711f;}function getSqlClauses(){var _0x897803={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x1375('0x24')](),'tags':{'clause':squel[_0x1375('0x24')](),'ids':null},'user':{'clause':squel[_0x1375('0x24')](),'skip':![]}};return _0x897803;}function parseTagParameter(_0x3f09a9){var _0x101dc2=squel[_0x1375('0x24')]();if(_0x3f09a9){var _0x34814a=utils[_0x1375('0x25')](_0x3f09a9);_0x34814a[_0x1375('0x22')](function(_0x16a8b5){_0x101dc2['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x16a8b5+',%');});}return _0x101dc2;}function parseSearchFilter(_0x1e6391){var _0x1d80a2=squel[_0x1375('0x24')]();if(_0x1e6391){var _0x2d8604=_0x1e6391[_0x1375('0x26')]('\x5c','\x5c\x5c')[_0x1375('0x26')](/'/g,'\x27\x27');if(_0x2d8604[_0x1375('0x27')]('\x20')[_0x1375('0x28')]>0x1){_0x1d80a2['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1375('0x29')](_0x2d8604,!![]),null);}else{if(qs[_0x1375('0x2a')](_0x2d8604)){_0x1d80a2['or'](_0x1375('0x2b'),_0x2d8604+'%');_0x1d80a2['or'](_0x1375('0x2c'),_0x2d8604+'%');_0x1d80a2['or'](_0x1375('0x2d'),_0x2d8604+'%');_0x1d80a2['or'](_0x1375('0x2e'),_0x2d8604+'%');}else if(qs[_0x1375('0x2f')](_0x2d8604)){_0x1d80a2['or'](_0x1375('0x30'),_0x2d8604+'%');}else{_0x1d80a2['or']('c.firstName\x20LIKE\x20?','%'+_0x2d8604+'%');_0x1d80a2['or']('c.lastName\x20LIKE\x20?','%'+_0x2d8604+'%');_0x1d80a2['or']('c.email\x20LIKE\x20?','%'+_0x2d8604+'%');}}}return _0x1d80a2;}function parseAdvancedSearchFilter(_0x917ccf,_0x53f5d6){var _0x23e0c3=getSqlClauses();var _0x297ed0=as['parseSearch'](_0x917ccf);var _0x1ba6d2=_0x297ed0['sqlOperator'];for(var _0x12d8d6=0x0;_0x12d8d6<_0x297ed0[_0x1375('0x31')][_0x1375('0x28')];_0x12d8d6++){var _0x46b0ab=_0x297ed0[_0x1375('0x31')][_0x12d8d6];var _0xfa517a='c';var _0x412514=_[_0x1375('0x32')](_0x53f5d6,[_0x1375('0x33'),_0x46b0ab['field']]);if(_0x412514){if(_0x46b0ab[_0x1375('0x23')]===_0x1375('0x34')||_0x412514[_0x1375('0x35')]===_0x1375('0x36')){_0x46b0ab[_0x1375('0x37')]=_0x1375('0x38');}var _0x34ffad=as['buildExpression'](_0xfa517a,_0x412514[_0x1375('0x39')],_0x46b0ab);_0x23e0c3['default'][_0x1ba6d2](_0x34ffad[_0x1375('0x3a')],_0x34ffad[_0x1375('0x3b')][_0x1375('0x3c')],_0x34ffad[_0x1375('0x3b')][_0x1375('0x3d')]);}else{if(_0x46b0ab[_0x1375('0x23')]===_0x1375('0x3e')){var _0x15d8cc=_0x46b0ab['value'][_0x1375('0x27')](',')['map'](function(_0x3b4cf2){return Number(_0x3b4cf2);});var _0x127331=parseTagParameter(_0x15d8cc);_0x23e0c3['tags']['clause']['and'](_0x127331);_0x23e0c3[_0x1375('0x3f')][_0x1375('0x40')]=_0x15d8cc;}else if(_0x46b0ab[_0x1375('0x23')]==='User'){_0x23e0c3[_0x1375('0x41')][_0x1375('0x42')]['and'](_0x1375('0x43'),_0x46b0ab[_0x1375('0x3b')]);_0x23e0c3['user'][_0x1375('0x44')]=!![];}}}return _0x23e0c3;}function parseModelFields(_0x262f63,_0xcd50c9){var _0xcf6f12=squel[_0x1375('0x24')]();var _0x461ec3=_(_0x262f63)[_0x1375('0x45')]()[_0x1375('0x46')](function(_0x2b6b8f){return _[_0x1375('0x47')](_0xcd50c9,[_0x1375('0x33'),_0x2b6b8f])?_0x2b6b8f:undefined;})[_0x1375('0x48')]()['value']();if(_0x262f63[_0x1375('0x49')]){_0x461ec3[_0x1375('0x21')](_0x1375('0x49'));}if(_0x262f63['User']){_0x461ec3[_0x1375('0x21')](_0x1375('0x4a'));}if(_0x461ec3[_0x1375('0x28')]>0x0){_0x461ec3[_0x1375('0x22')](function(_0x44608e){if(_0x44608e===_0x1375('0x7')){_0xcf6f12['and'](_0x1375('0x4b'),[]['concat'](_0x262f63[_0x44608e]));}else if(_0x44608e===_0x1375('0x49')){var _0x2534d3='%'+_0x262f63[_0x44608e]+'%';_0xcf6f12[_0x1375('0x4c')](_0x1375('0x4d'),_0x2534d3);}else if(_0x44608e===_0x1375('0x4a')){_0xcf6f12['and']('uc.UserId\x20=\x20?',_0x262f63[_0x44608e]);}else{_0xcf6f12['and']('c.'+_0x44608e+_0x1375('0x4e'),_0x262f63[_0x44608e]);}});}return _0xcf6f12;}function parseQueryParameters(_0x5cab16,_0x18fa92){var _0x54053d=getSqlClauses();return Promise[_0x1375('0x4f')]()[_0x1375('0x50')](function(){return parseModelFields(_0x5cab16,_0x18fa92);})['then'](function(_0x15cfb5){_0x54053d[_0x1375('0x51')][_0x1375('0x4c')](_0x15cfb5);return parseTagParameter(_0x5cab16[_0x1375('0x52')]);})['then'](function(_0x414a17){_0x54053d['tags'][_0x1375('0x42')]['and'](_0x414a17);return parseSearchFilter(_0x5cab16['filter']);})[_0x1375('0x50')](function(_0x334db4){_0x54053d['filter']=_0x334db4;return _0x54053d;});}function checkListsRestrictions(_0x5aa4b3,_0x2e80d0,_0x4968d1){var _0x4a5ad1=squel['expr']();return Promise[_0x1375('0x4f')]()['then'](function(){if(_0x2e80d0['search']&&_0x5aa4b3[_0x1375('0x5')]===_0x1375('0x6')&&!_0x4968d1){return _0x5aa4b3['getLists']({'attributes':['id'],'raw':!![]});}})['then'](function(_0x2d028b){if(_0x2d028b){if(_0x2d028b[_0x1375('0x28')]===0x0){_0x4a5ad1[_0x1375('0x4c')](_0x1375('0x53'));}else{_0x4a5ad1['and'](_0x1375('0x4b'),_[_0x1375('0x46')](_0x2d028b,'id'));}}})[_0x1375('0x50')](function(){return _0x4a5ad1;});}function buildContactsQuery(_0x1c99c8,_0x5ebd8d,_0x440294,_0x1096ee,_0x38a508,_0x596cb7){if(_0x5ebd8d){_0x5ebd8d=_0x440294[_0x1375('0x54')];}_0x1c99c8=addFieldsToQuery(_0x1c99c8,_0x5ebd8d,_0x1096ee,_0x596cb7,!![]);var _0x673841=squel[_0x1375('0x55')]();_0x673841=addFieldsToQuery(_0x673841,_0x5ebd8d,_0x1096ee,_0x596cb7,![]);if(_0x1096ee||_0x596cb7){_0x1c99c8=applyJoinClauses(_0x1c99c8,!![]);_0x1c99c8['group'](_0x1375('0x56'));if(_0x440294['limit']){_0x673841[_0x1375('0x57')](_0x440294[_0x1375('0x57')]);}if(_0x440294['offset']){_0x673841[_0x1375('0x58')](_0x440294[_0x1375('0x58')]);}}else{_0x673841=applyJoinClauses(_0x673841,![]);_0x673841[_0x1375('0x59')](_0x1375('0x5a'));if(_0x440294[_0x1375('0x57')]){_0x1c99c8['limit'](_0x440294['limit']);}if(_0x440294[_0x1375('0x58')]){_0x1c99c8[_0x1375('0x58')](_0x440294['offset']);}}_0x673841[_0x1375('0x5b')](_0x38a508);if(_0x440294[_0x1375('0x5c')]){_0x440294[_0x1375('0x5c')][_0x1375('0x22')](function(_0xd1fe05){_0x1c99c8[_0x1375('0x5c')]('c.'+_0xd1fe05[0x0],_0xd1fe05[0x1]===_0x1375('0x5d')?![]:!![]);_0x673841[_0x1375('0x5c')](_0x1375('0x5e')+_0xd1fe05[0x0],_0xd1fe05[0x1]===_0x1375('0x5d')?![]:!![]);});}_0x673841['from'](_0x1c99c8,'subqry');return _0x673841;}function getFilteredContacts(_0x3e0d4b){var _0xcf3635=[];return db['Tag']['findAll']({'attributes':['id',_0x1375('0x33'),_0x1375('0x5f')],'raw':!![]})['then'](function(_0xc3c731){_0xcf3635=_['keyBy'](_0xc3c731,'id');var _0x585587={'type':db[_0x1375('0x60')][_0x1375('0x61')][_0x1375('0x62')],'model':db[_0x1375('0x63')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x1375('0x64')](_0x3e0d4b[_0x1375('0x65')](),_0x585587);})[_0x1375('0x50')](function(_0xf29328){_0xf29328['forEach'](function(_0x467e2c){if(_0x467e2c[_0x1375('0x1f')]){_0x467e2c[_0x1375('0x66')]=[];_0x467e2c[_0x1375('0x1f')][_0x1375('0x27')](',')[_0x1375('0x22')](function(_0x16a45d){_0x467e2c[_0x1375('0x66')][_0x1375('0x21')](_0xcf3635[_0x16a45d]);});}delete _0x467e2c[_0x1375('0x1f')];});return _0xf29328;});}function countFilteredContacts(_0x39eb14,_0x33462b){var _0x1173c2=_0x39eb14[_0x1375('0x67')]();_0x1173c2['field']('COUNT(*)');_0x1173c2=applyJoinClauses(_0x1173c2,!![]);_0x39eb14[_0x1375('0x59')]('c.id');var _0x5ca157=utils[_0x1375('0x25')](_0x33462b);if(!_[_0x1375('0x68')](_0x5ca157)){_0x1173c2[_0x1375('0xb')](_0x1375('0x69'),_0x5ca157);}var _0x2eef8d={'type':db['Sequelize'][_0x1375('0x61')][_0x1375('0x62')],'raw':!![]};return db[_0x1375('0x6a')][_0x1375('0x64')](_0x1173c2['toString'](),_0x2eef8d)[_0x1375('0x50')](function(_0x4c4497){return _0x4c4497[0x0][_0x1375('0x6b')];});}module[_0x1375('0x6c')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xd003=['length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','buildExpression','default','text','start','Tag','value','map','tags','clause','and','User','user','uc.UserId\x20=\x20?','skip','some','compact','Contact','c.ListId\x20IN\x20?','\x20=\x20?','resolve','then','filter','search','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','findAll','keyBy','SELECT','CmContact','query','Tags','clone','isEmpty','t.id\x20IN\x20?','QueryTypes','sequelize','toString','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','ListId','autocomplete','select','from','cm_contacts','where','left_join','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','subqry','firstName','lastName','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0xd003,0x17c));var _0x3d00=function(_0x588787,_0x4f103b){_0x588787=_0x588787-0x0;var _0x3bf7c6=_0xd003[_0x588787];return _0x3bf7c6;};'use strict';var _=require(_0x3d00('0x0'));var squel=require(_0x3d00('0x1'));var as=require(_0x3d00('0x2'));var qs=require(_0x3d00('0x3'));var utils=require(_0x3d00('0x4'));var db=require(_0x3d00('0x5'))['db'];function skipContactsQuery(_0x153f5f,_0x1f003){var _0x46e796=![];if(_0x153f5f[_0x3d00('0x6')]==='agent'&&!_0x1f003['search']&&!_0x1f003[_0x3d00('0x7')]&&_0x1f003[_0x3d00('0x8')]!=='true'){_0x46e796=!![];}return _0x46e796;}function getContactsSubquery(){return squel[_0x3d00('0x9')]()[_0x3d00('0xa')](_0x3d00('0xb'),'c')[_0x3d00('0xc')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x3ca9b3,_0x10fd09){var _0x364e30=_0x10fd09?'c':'subqry';_0x3ca9b3[_0x3d00('0xd')]('cm_user_has_contacts','uc','uc.CmContactId\x20=\x20'+_0x364e30+_0x3d00('0xe'))[_0x3d00('0xd')](_0x3d00('0xf'),'ct',_0x3d00('0x10')+_0x364e30+'.id')[_0x3d00('0xd')](_0x3d00('0x11'),'t',_0x3d00('0x12'));return _0x3ca9b3;}function addFieldsToQuery(_0x3a1e08,_0x28ba32,_0x507507,_0x36b8d9,_0x3db57e){var _0x2b892e=_0x3db57e?'c':_0x3d00('0x13');if(!_0x28ba32){_0x28ba32=['id',_0x3d00('0x14'),_0x3d00('0x15'),_0x3d00('0x16'),_0x3d00('0x17'),_0x3d00('0x18'),_0x3d00('0x19'),_0x3d00('0x7'),_0x3d00('0x1a'),_0x3d00('0x1b'),_0x3d00('0x1c'),_0x3d00('0x1d'),_0x3d00('0x1e')];}else if(!_0x28ba32[_0x3d00('0x1f')]('id')){_0x28ba32[_0x3d00('0x20')]('id');}var _0x23f7fe=_0x507507&&_0x3db57e||!_0x507507&&!_0x3db57e;if(_0x36b8d9){_0x23f7fe=_0x36b8d9&&_0x3db57e||!_0x36b8d9&&!_0x3db57e;}_0x28ba32[_0x3d00('0x21')](function(_0x5da7e8){if(_0x5da7e8===_0x3d00('0x1e')){if(_0x23f7fe){_0x3a1e08[_0x3d00('0x22')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5da7e8);}else if(_0x507507||_0x36b8d9){_0x3a1e08['field'](_0x2b892e+'.'+_0x5da7e8);}}else{_0x3a1e08[_0x3d00('0x22')](_0x2b892e+'.'+_0x5da7e8);}});return _0x3a1e08;}function getSqlClauses(){var _0xa9839f={'default':squel[_0x3d00('0x23')](),'fields':squel[_0x3d00('0x23')](),'filter':squel[_0x3d00('0x23')](),'tags':{'clause':squel[_0x3d00('0x23')](),'ids':null},'user':{'clause':squel[_0x3d00('0x23')](),'skip':![]}};return _0xa9839f;}function parseTagParameter(_0x457fe9){var _0x45d3d8=squel[_0x3d00('0x23')]();if(_0x457fe9){var _0x197dba=utils[_0x3d00('0x24')](_0x457fe9);_0x197dba['forEach'](function(_0x160b82){_0x45d3d8['or'](_0x3d00('0x25'),'%,'+_0x160b82+',%');});}return _0x45d3d8;}function parseSearchFilter(_0xa84420){var _0x1a2142=squel[_0x3d00('0x23')]();if(_0xa84420){var _0x2b378a=_0xa84420[_0x3d00('0x26')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x2b378a[_0x3d00('0x27')]('\x20')[_0x3d00('0x28')]>0x1){_0x1a2142['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3d00('0x29')](_0x2b378a,!![]),null);}else{if(qs[_0x3d00('0x2a')](_0x2b378a)){_0x1a2142['or'](_0x3d00('0x2b'),_0x2b378a+'%');_0x1a2142['or'](_0x3d00('0x2c'),_0x2b378a+'%');_0x1a2142['or']('c.mobile\x20LIKE\x20?',_0x2b378a+'%');_0x1a2142['or'](_0x3d00('0x2d'),_0x2b378a+'%');}else if(qs[_0x3d00('0x2e')](_0x2b378a)){_0x1a2142['or'](_0x3d00('0x2f'),_0x2b378a+'%');}else{_0x1a2142['or'](_0x3d00('0x30'),'%'+_0x2b378a+'%');_0x1a2142['or'](_0x3d00('0x31'),'%'+_0x2b378a+'%');_0x1a2142['or']('c.email\x20LIKE\x20?','%'+_0x2b378a+'%');}}}return _0x1a2142;}function parseAdvancedSearchFilter(_0x20da3b,_0x48c71b){var _0x499c38=getSqlClauses();var _0x2d5875=as[_0x3d00('0x32')](_0x20da3b);var _0x31be42=_0x2d5875['sqlOperator'];for(var _0x4fe9fc=0x0;_0x4fe9fc<_0x2d5875[_0x3d00('0x33')][_0x3d00('0x28')];_0x4fe9fc++){var _0x8dbac7=_0x2d5875[_0x3d00('0x33')][_0x4fe9fc];var _0x34f87a='c';var _0x1c0a21=_[_0x3d00('0x34')](_0x48c71b,[_0x3d00('0x35'),_0x8dbac7['field']]);if(_0x1c0a21){if(_0x8dbac7[_0x3d00('0x22')]===_0x3d00('0x36')||_0x1c0a21[_0x3d00('0x37')]===_0x3d00('0x38')){_0x8dbac7[_0x3d00('0x39')]='DATE';}var _0x2e3d7c=as[_0x3d00('0x3a')](_0x34f87a,_0x1c0a21['type'],_0x8dbac7);_0x499c38[_0x3d00('0x3b')][_0x31be42](_0x2e3d7c[_0x3d00('0x3c')],_0x2e3d7c['value'][_0x3d00('0x3d')],_0x2e3d7c['value']['end']);}else{if(_0x8dbac7['field']===_0x3d00('0x3e')){var _0x4c199b=_0x8dbac7[_0x3d00('0x3f')][_0x3d00('0x27')](',')[_0x3d00('0x40')](function(_0x2ccbdf){return Number(_0x2ccbdf);});var _0x35edfc=parseTagParameter(_0x4c199b);_0x499c38[_0x3d00('0x41')][_0x3d00('0x42')][_0x3d00('0x43')](_0x35edfc);_0x499c38[_0x3d00('0x41')]['ids']=_0x4c199b;}else if(_0x8dbac7[_0x3d00('0x22')]===_0x3d00('0x44')){_0x499c38[_0x3d00('0x45')][_0x3d00('0x42')][_0x3d00('0x43')](_0x3d00('0x46'),_0x8dbac7[_0x3d00('0x3f')]);_0x499c38[_0x3d00('0x45')][_0x3d00('0x47')]=!![];}}}return _0x499c38;}function parseModelFields(_0x4ca181,_0x529224){var _0x4f81b6=squel[_0x3d00('0x23')]();var _0x4c5958=_(_0x4ca181)['keys']()[_0x3d00('0x40')](function(_0x4b6dae){return _[_0x3d00('0x48')](_0x529224,[_0x3d00('0x35'),_0x4b6dae])?_0x4b6dae:undefined;})[_0x3d00('0x49')]()[_0x3d00('0x3f')]();if(_0x4ca181[_0x3d00('0x4a')]){_0x4c5958[_0x3d00('0x20')](_0x3d00('0x4a'));}if(_0x4ca181['User']){_0x4c5958[_0x3d00('0x20')](_0x3d00('0x44'));}if(_0x4c5958[_0x3d00('0x28')]>0x0){_0x4c5958[_0x3d00('0x21')](function(_0x590d08){if(_0x590d08===_0x3d00('0x7')){_0x4f81b6[_0x3d00('0x43')](_0x3d00('0x4b'),[]['concat'](_0x4ca181[_0x590d08]));}else if(_0x590d08===_0x3d00('0x4a')){var _0x4622ef='%'+_0x4ca181[_0x590d08]+'%';_0x4f81b6[_0x3d00('0x43')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x4622ef);}else if(_0x590d08===_0x3d00('0x44')){_0x4f81b6[_0x3d00('0x43')](_0x3d00('0x46'),_0x4ca181[_0x590d08]);}else{_0x4f81b6['and']('c.'+_0x590d08+_0x3d00('0x4c'),_0x4ca181[_0x590d08]);}});}return _0x4f81b6;}function parseQueryParameters(_0x463d9e,_0x5a1848){var _0x54ecdb=getSqlClauses();return Promise[_0x3d00('0x4d')]()['then'](function(){return parseModelFields(_0x463d9e,_0x5a1848);})[_0x3d00('0x4e')](function(_0x580318){_0x54ecdb['fields'][_0x3d00('0x43')](_0x580318);return parseTagParameter(_0x463d9e['tag']);})[_0x3d00('0x4e')](function(_0x2418b1){_0x54ecdb[_0x3d00('0x41')][_0x3d00('0x42')][_0x3d00('0x43')](_0x2418b1);return parseSearchFilter(_0x463d9e['filter']);})['then'](function(_0x70d144){_0x54ecdb[_0x3d00('0x4f')]=_0x70d144;return _0x54ecdb;});}function checkListsRestrictions(_0x2b7d1f,_0x5642be,_0x150ce5){var _0x3e8c6a=squel[_0x3d00('0x23')]();return Promise[_0x3d00('0x4d')]()[_0x3d00('0x4e')](function(){if(_0x5642be[_0x3d00('0x50')]&&_0x2b7d1f[_0x3d00('0x6')]==='agent'&&!_0x150ce5){return _0x2b7d1f[_0x3d00('0x51')]({'attributes':['id'],'raw':!![]});}})[_0x3d00('0x4e')](function(_0x9c53c5){if(_0x9c53c5){if(_0x9c53c5[_0x3d00('0x28')]===0x0){_0x3e8c6a[_0x3d00('0x43')](_0x3d00('0x52'));}else{_0x3e8c6a[_0x3d00('0x43')]('c.ListId\x20IN\x20?',_[_0x3d00('0x40')](_0x9c53c5,'id'));}}})[_0x3d00('0x4e')](function(){return _0x3e8c6a;});}function buildContactsQuery(_0x72f638,_0x4a6742,_0x25ba92,_0x53385b,_0x12442c,_0x46e9c5){if(_0x4a6742){_0x4a6742=_0x25ba92[_0x3d00('0x53')];}_0x72f638=addFieldsToQuery(_0x72f638,_0x4a6742,_0x53385b,_0x46e9c5,!![]);var _0x1c4016=squel[_0x3d00('0x9')]();_0x1c4016=addFieldsToQuery(_0x1c4016,_0x4a6742,_0x53385b,_0x46e9c5,![]);if(_0x53385b||_0x46e9c5){_0x72f638=applyJoinClauses(_0x72f638,!![]);_0x72f638[_0x3d00('0x54')](_0x3d00('0x55'));if(_0x25ba92['limit']){_0x1c4016[_0x3d00('0x56')](_0x25ba92[_0x3d00('0x56')]);}if(_0x25ba92[_0x3d00('0x57')]){_0x1c4016[_0x3d00('0x57')](_0x25ba92[_0x3d00('0x57')]);}}else{_0x1c4016=applyJoinClauses(_0x1c4016,![]);_0x1c4016['group'](_0x3d00('0x58'));if(_0x25ba92[_0x3d00('0x56')]){_0x72f638[_0x3d00('0x56')](_0x25ba92['limit']);}if(_0x25ba92[_0x3d00('0x57')]){_0x72f638['offset'](_0x25ba92[_0x3d00('0x57')]);}}_0x1c4016[_0x3d00('0x59')](_0x12442c);if(_0x25ba92[_0x3d00('0x5a')]){_0x25ba92[_0x3d00('0x5a')][_0x3d00('0x21')](function(_0x583ba7){_0x72f638[_0x3d00('0x5a')]('c.'+_0x583ba7[0x0],_0x583ba7[0x1]===_0x3d00('0x5b')?![]:!![]);_0x1c4016['order']('subqry.'+_0x583ba7[0x0],_0x583ba7[0x1]==='DESC'?![]:!![]);});}_0x1c4016[_0x3d00('0xa')](_0x72f638,_0x3d00('0x13'));return _0x1c4016;}function getFilteredContacts(_0x4e4f9d){var _0x1f572f=[];return db['Tag'][_0x3d00('0x5c')]({'attributes':['id',_0x3d00('0x35'),'color'],'raw':!![]})[_0x3d00('0x4e')](function(_0xe49441){_0x1f572f=_[_0x3d00('0x5d')](_0xe49441,'id');var _0x446cc6={'type':db['Sequelize']['QueryTypes'][_0x3d00('0x5e')],'model':db[_0x3d00('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x3d00('0x60')](_0x4e4f9d['toString'](),_0x446cc6);})[_0x3d00('0x4e')](function(_0x5d5a12){_0x5d5a12[_0x3d00('0x21')](function(_0x1f3559){if(_0x1f3559[_0x3d00('0x1e')]){_0x1f3559[_0x3d00('0x61')]=[];_0x1f3559[_0x3d00('0x1e')][_0x3d00('0x27')](',')[_0x3d00('0x21')](function(_0x4d50b4){_0x1f3559[_0x3d00('0x61')][_0x3d00('0x20')](_0x1f572f[_0x4d50b4]);});}delete _0x1f3559[_0x3d00('0x1e')];});return _0x5d5a12;});}function countFilteredContacts(_0x40b1a9,_0x297b76){var _0x740966=_0x40b1a9[_0x3d00('0x62')]();_0x740966[_0x3d00('0x22')]('COUNT(*)');_0x740966=applyJoinClauses(_0x740966,!![]);_0x40b1a9[_0x3d00('0x54')](_0x3d00('0x55'));var _0x37b2f5=utils[_0x3d00('0x24')](_0x297b76);if(!_[_0x3d00('0x63')](_0x37b2f5)){_0x740966[_0x3d00('0xc')](_0x3d00('0x64'),_0x37b2f5);}var _0x50f83f={'type':db['Sequelize'][_0x3d00('0x65')]['SELECT'],'raw':!![]};return db[_0x3d00('0x66')][_0x3d00('0x60')](_0x740966[_0x3d00('0x67')](),_0x50f83f)[_0x3d00('0x4e')](function(_0x38322e){return _0x38322e[0x0]['COUNT(*)'];});}module[_0x3d00('0x68')]={'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 83ab7c2..d0f4d50 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 _0x8040=['app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','binary','write','end','unlink','decryptFile','createReadStream','final','encryptString','utf8','base64','bluebird','../../config/logger'];(function(_0x32fa2f,_0x517452){var _0x40256e=function(_0x269922){while(--_0x269922){_0x32fa2f['push'](_0x32fa2f['shift']());}};_0x40256e(++_0x517452);}(_0x8040,0xee));var _0x0804=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x8040[_0x49ca18];return _0x145d54;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x0804('0x0'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x0804('0x1'))(_0x0804('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0804('0x3')][_0x0804('0x4')],'algorithm':_0x0804('0x5')};const fileOptions={'algorithm':_0x0804('0x6')};if(config[_0x0804('0x7')]&&config[_0x0804('0x7')][_0x0804('0x8')]){var isSupported=isAlgorithmSupported(config[_0x0804('0x7')][_0x0804('0x8')]);if(isSupported){fileOptions[_0x0804('0x8')]=config[_0x0804('0x7')][_0x0804('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x0804('0x9')](config[_0x0804('0x7')][_0x0804('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x5b8867){return AES_SUPPORTED_RX[_0x0804('0xa')](_0x5b8867);}function getSupportedCiphers(){return crypto[_0x0804('0xb')]()[_0x0804('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0xa0dc81){return getSupportedCiphers()[_0x0804('0xd')](_0xa0dc81)>-0x1;}function combineOptions(_0x250a30){var _0x375e3f={};for(var _0xeab00f in fileOptions){if(fileOptions[_0x0804('0xe')](_0xeab00f)){_0x375e3f[_0xeab00f]=fileOptions[_0xeab00f];}}if(_0x250a30){for(var _0x5733d in _0x250a30){if(_0x250a30['hasOwnProperty'](_0x5733d)){_0x375e3f[_0x5733d]=_0x250a30[_0x5733d];}}}return _0x375e3f;}exports[_0x0804('0xf')]=function(_0x13f270,_0x106b17,_0x445753,_0x5de67f){return new BPromise(function(_0xfad3c4,_0x2ac3fe){_0x5de67f=combineOptions(_0x5de67f);var _0x49bb0d=new Buffer(_0x445753);var _0x53ad6c=fs['createReadStream'](_0x13f270);var _0x300dec=fs[_0x0804('0x10')](_0x106b17);var _0x5e3019=crypto[_0x0804('0x11')](_0x5de67f[_0x0804('0x8')],_0x49bb0d);_0x53ad6c['on'](_0x0804('0x12'),function(_0x338e42){var _0x306c17=new Buffer(_0x5e3019[_0x0804('0x13')](_0x338e42),_0x0804('0x14'));_0x300dec[_0x0804('0x15')](_0x306c17);});_0x53ad6c['on'](_0x0804('0x16'),function(){try{var _0xb8dd1b=new Buffer(_0x5e3019['final'](_0x0804('0x14')),_0x0804('0x14'));_0x300dec[_0x0804('0x15')](_0xb8dd1b);_0x300dec['end']();_0x300dec['on']('close',function(){return _0xfad3c4(_0x106b17);});}catch(_0x2e7d66){fs[_0x0804('0x17')](_0x106b17);return _0x2ac3fe(_0x2e7d66);}});});};exports[_0x0804('0x18')]=function(_0x4e866a,_0x2a0e7a,_0x404f5d,_0x4ccc03){return new BPromise(function(_0x4f821c,_0x1ef77d){_0x4ccc03=combineOptions(_0x4ccc03);var _0x5a85a1=new Buffer(_0x404f5d);var _0x7cc5cb=fs[_0x0804('0x19')](_0x4e866a);var _0x38fc3c=fs[_0x0804('0x10')](_0x2a0e7a);var _0x529340=crypto['createDecipher'](_0x4ccc03[_0x0804('0x8')],_0x5a85a1);_0x7cc5cb['on'](_0x0804('0x12'),function(_0x53555d){var _0xbfedab=new Buffer(_0x529340['update'](_0x53555d),_0x0804('0x14'));_0x38fc3c[_0x0804('0x15')](_0xbfedab);});_0x7cc5cb['on'](_0x0804('0x16'),function(){try{var _0x21db7c=new Buffer(_0x529340[_0x0804('0x1a')](_0x0804('0x14')),_0x0804('0x14'));_0x38fc3c[_0x0804('0x15')](_0x21db7c);_0x38fc3c['end']();_0x38fc3c['on']('close',function(){return _0x4f821c(_0x2a0e7a);});}catch(_0x4c8ed1){fs['unlink'](_0x2a0e7a);return _0x1ef77d(_0x4c8ed1);}});});};exports[_0x0804('0x1b')]=function(_0x14dcae,_0x26a533,_0x49a97f){var _0xaa5723=_0x49a97f||stringOptions[_0x0804('0x8')];var _0x44170b=_0x26a533||stringOptions['secret'];var _0x493592=crypto[_0x0804('0x11')](_0xaa5723,_0x44170b);var _0x2a166a=_0x493592[_0x0804('0x13')](_0x14dcae,_0x0804('0x1c'),_0x0804('0x1d'));_0x2a166a+=_0x493592[_0x0804('0x1a')](_0x0804('0x1d'));return _0x2a166a;};exports['decryptString']=function(_0x52da8f,_0x1ba0ef,_0x3693f6){var _0x3f6ac3=_0x3693f6||stringOptions[_0x0804('0x8')];var _0x1fd122=_0x1ba0ef||stringOptions['secret'];var _0x4134a7=crypto['createDecipher'](_0x3f6ac3,_0x1fd122);var _0x12c4b3=_0x4134a7[_0x0804('0x13')](_0x52da8f,'base64','utf8');_0x12c4b3+=_0x4134a7['final'](_0x0804('0x1c'));return _0x12c4b3;}; \ No newline at end of file +var _0x69bb=['update','close','encryptString','secret','utf8','base64','final','decryptString','bluebird','lodash','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','binary','write','end','unlink','decryptFile','createReadStream','createDecipher','data'];(function(_0x4500af,_0x1f6997){var _0x335517=function(_0x27b76b){while(--_0x27b76b){_0x4500af['push'](_0x4500af['shift']());}};_0x335517(++_0x1f6997);}(_0x69bb,0x1b8));var _0xb69b=function(_0x9be2bc,_0x496614){_0x9be2bc=_0x9be2bc-0x0;var _0x271f87=_0x69bb[_0x9be2bc];return _0x271f87;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xb69b('0x0'));var _=require(_0xb69b('0x1'));var config=require('../../config/environment');var logger=require(_0xb69b('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xb69b('0x3')][_0xb69b('0x4')],'algorithm':_0xb69b('0x5')};const fileOptions={'algorithm':_0xb69b('0x6')};if(config[_0xb69b('0x7')]&&config[_0xb69b('0x7')]['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0xb69b('0x8')]=config['encrypt'][_0xb69b('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xb69b('0x9')](',\x20');logger[_0xb69b('0xa')](config[_0xb69b('0x7')]['algorithm'],_0xb69b('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x2bd8bc){return AES_SUPPORTED_RX[_0xb69b('0xc')](_0x2bd8bc);}function getSupportedCiphers(){return crypto[_0xb69b('0xd')]()[_0xb69b('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x51001b){return getSupportedCiphers()[_0xb69b('0xf')](_0x51001b)>-0x1;}function combineOptions(_0x140a4f){var _0x3fc81d={};for(var _0x2785e4 in fileOptions){if(fileOptions[_0xb69b('0x10')](_0x2785e4)){_0x3fc81d[_0x2785e4]=fileOptions[_0x2785e4];}}if(_0x140a4f){for(var _0x24b093 in _0x140a4f){if(_0x140a4f[_0xb69b('0x10')](_0x24b093)){_0x3fc81d[_0x24b093]=_0x140a4f[_0x24b093];}}}return _0x3fc81d;}exports[_0xb69b('0x11')]=function(_0x31871b,_0x528d61,_0x1d2dd9,_0x2c1f8e){return new BPromise(function(_0x2ffa16,_0x5655cb){_0x2c1f8e=combineOptions(_0x2c1f8e);var _0x2f32c5=new Buffer(_0x1d2dd9);var _0x39aa44=fs['createReadStream'](_0x31871b);var _0x250763=fs[_0xb69b('0x12')](_0x528d61);var _0x4b6b5f=crypto[_0xb69b('0x13')](_0x2c1f8e['algorithm'],_0x2f32c5);_0x39aa44['on']('data',function(_0x54a967){var _0x5e43a1=new Buffer(_0x4b6b5f['update'](_0x54a967),_0xb69b('0x14'));_0x250763[_0xb69b('0x15')](_0x5e43a1);});_0x39aa44['on'](_0xb69b('0x16'),function(){try{var _0x4dbdaf=new Buffer(_0x4b6b5f['final'](_0xb69b('0x14')),_0xb69b('0x14'));_0x250763['write'](_0x4dbdaf);_0x250763[_0xb69b('0x16')]();_0x250763['on']('close',function(){return _0x2ffa16(_0x528d61);});}catch(_0x5949a){fs[_0xb69b('0x17')](_0x528d61);return _0x5655cb(_0x5949a);}});});};exports[_0xb69b('0x18')]=function(_0x4b6416,_0x329325,_0xef015b,_0x57ad36){return new BPromise(function(_0x189b2d,_0x1cd809){_0x57ad36=combineOptions(_0x57ad36);var _0x17f799=new Buffer(_0xef015b);var _0x3e5bb9=fs[_0xb69b('0x19')](_0x4b6416);var _0x23d432=fs[_0xb69b('0x12')](_0x329325);var _0x5b39fd=crypto[_0xb69b('0x1a')](_0x57ad36[_0xb69b('0x8')],_0x17f799);_0x3e5bb9['on'](_0xb69b('0x1b'),function(_0x43d8ef){var _0xcd6784=new Buffer(_0x5b39fd[_0xb69b('0x1c')](_0x43d8ef),_0xb69b('0x14'));_0x23d432[_0xb69b('0x15')](_0xcd6784);});_0x3e5bb9['on'](_0xb69b('0x16'),function(){try{var _0x7a5ff3=new Buffer(_0x5b39fd['final'](_0xb69b('0x14')),_0xb69b('0x14'));_0x23d432[_0xb69b('0x15')](_0x7a5ff3);_0x23d432['end']();_0x23d432['on'](_0xb69b('0x1d'),function(){return _0x189b2d(_0x329325);});}catch(_0x7e120f){fs['unlink'](_0x329325);return _0x1cd809(_0x7e120f);}});});};exports[_0xb69b('0x1e')]=function(_0xba7f4f,_0x1a1c25,_0x43721f){var _0x16f3e2=_0x43721f||stringOptions[_0xb69b('0x8')];var _0x200411=_0x1a1c25||stringOptions[_0xb69b('0x1f')];var _0x3e5533=crypto[_0xb69b('0x13')](_0x16f3e2,_0x200411);var _0x51ef3b=_0x3e5533['update'](_0xba7f4f,_0xb69b('0x20'),_0xb69b('0x21'));_0x51ef3b+=_0x3e5533[_0xb69b('0x22')](_0xb69b('0x21'));return _0x51ef3b;};exports[_0xb69b('0x23')]=function(_0x597f7c,_0x3a4888,_0x221355){var _0x27f00a=_0x221355||stringOptions[_0xb69b('0x8')];var _0x3b1583=_0x3a4888||stringOptions[_0xb69b('0x1f')];var _0x362e86=crypto[_0xb69b('0x1a')](_0x27f00a,_0x3b1583);var _0x84c622=_0x362e86['update'](_0x597f7c,_0xb69b('0x21'),_0xb69b('0x20'));_0x84c622+=_0x362e86[_0xb69b('0x22')](_0xb69b('0x20'));return _0x84c622;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index eb1284e..02081fa 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 _0xe041=['CSV','find','split','splitSizeCsv','sequelize','query','QueryTypes','SELECT','then','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','join','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0xf98b5,_0x5a438c){var _0x5d380a=function(_0x23ae73){while(--_0x23ae73){_0xf98b5['push'](_0xf98b5['shift']());}};_0x5d380a(++_0x5a438c);}(_0xe041,0x10b));var _0x1e04=function(_0x1b3be6,_0x5275f1){_0x1b3be6=_0x1b3be6-0x0;var _0x5acf0b=_0xe041[_0x1b3be6];return _0x5acf0b;};'use strict';var util=require('util');var path=require(_0x1e04('0x0'));var _=require(_0x1e04('0x1'));var csv=require(_0x1e04('0x2'));var fs=require('fs');var BPromise=require(_0x1e04('0x3'));var zipdir=require(_0x1e04('0x4'));var rimraf=require(_0x1e04('0x5'));var db=require(_0x1e04('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0x1e04('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x1e04('0x8')][0x2]);var QUERY=process[_0x1e04('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1b6569,_0x502f86){var _0x582158={'status':_0x1b6569};var _0x2ab72d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x502f86){_0x582158[_0x1e04('0x9')]=_0x502f86;}return db[_0x1e04('0xa')][_0x1e04('0xb')](_0x582158,_0x2ab72d);}function main(){var _0x52d2dd=0x1388;var _0x2bdcf1;logger[_0x1e04('0xc')](util[_0x1e04('0xd')](_0x1e04('0xe'),EXTRACTED_REPORT_ID,_0x1e04('0xf')));return db['Setting'][_0x1e04('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1e04('0x11'),_0x1e04('0x12')]})['then'](function(_0x5b1575){if(_0x5b1575){_0x2bdcf1=_0x5b1575;_0x52d2dd=_0x2bdcf1[_0x1e04('0x12')]||0x1388;}})['then'](function(){return dbH[_0x1e04('0x13')][_0x1e04('0x14')](util[_0x1e04('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x1e04('0x13')][_0x1e04('0x15')][_0x1e04('0x16')]});})[_0x1e04('0x17')](function(_0x40950b){if(!_0x40950b[0x0][_0x1e04('0x18')]){return analyticExtractedReport(_0x1e04('0x19'));}var _0x5dda9c=[];var _0x1ba04e=0x0;if(_0x2bdcf1['split']){if(_0x40950b&&_0x40950b[_0x1e04('0x1a')]){var _0x5bec5e=_[_0x1e04('0x1b')](_0x40950b[0x0][_0x1e04('0x18')]/_0x52d2dd);var _0x77e825=Number['isInteger'](_0x40950b[0x0]['num']/_0x52d2dd)?_0x40950b[0x0][_0x1e04('0x18')]%_0x52d2dd:0x0;_0x5bec5e[_0x1e04('0x1c')](function(_0x253d91){if(_0x253d91>0x0){_0x1ba04e+=_0x52d2dd;}_0x5dda9c['push'](dbH[_0x1e04('0x13')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x52d2dd,_0x1ba04e),{'type':dbH[_0x1e04('0x13')]['QueryTypes']['SELECT']}));});if(_0x77e825>0x0){_0x1ba04e+=_0x52d2dd;_0x5dda9c[_0x1e04('0x1d')](dbH[_0x1e04('0x13')][_0x1e04('0x14')](util[_0x1e04('0xd')](_0x1e04('0x1e'),QUERY,_0x77e825,_0x1ba04e),{'type':dbH['sequelize']['QueryTypes'][_0x1e04('0x16')]}));}}}else{_0x5dda9c[_0x1e04('0x1d')](dbH['sequelize'][_0x1e04('0x14')](QUERY,{'type':dbH[_0x1e04('0x13')][_0x1e04('0x15')]['SELECT']}));}var _0x599275=path[_0x1e04('0x1f')](PATH);var _0x5b8c05=path[_0x1e04('0x20')](PATH,'.csv');var _0x2190be=_0x2bdcf1[_0x1e04('0x11')]&&_0x5dda9c['length']>0x1;var _0x4bdad7=[];if(!fs['existsSync'](path[_0x1e04('0x21')](_0x599275,_0x5b8c05))&&_0x2190be){fs['mkdirSync'](path['join'](_0x599275,_0x5b8c05));}return BPromise['each'](_0x5dda9c,function(_0x2119be){_0x4bdad7[_0x1e04('0x1d')](_0x2119be);})[_0x1e04('0x17')](function(){for(var _0x241fc0=0x0;_0x241fc0<_0x4bdad7[_0x1e04('0x1a')];_0x241fc0+=0x1){var _0x4d68f3;var _0x4dd51e=_0x4bdad7[_0x241fc0];if(_0x2190be){_0x4d68f3=path['join'](_0x599275,_0x5b8c05,util[_0x1e04('0xd')]('%s%d.%s',_0x5b8c05,_0x241fc0,_0x1e04('0x22')));}else{_0x4d68f3=path[_0x1e04('0x21')](_0x599275,util[_0x1e04('0xd')](_0x1e04('0x23'),_0x5b8c05,'csv'));}fs[_0x1e04('0x24')](_0x4d68f3,csv(_0x4dd51e));}})[_0x1e04('0x17')](function(){if(_0x2190be){return new Promise(function(_0x212e65){zipdir(path[_0x1e04('0x21')](_0x599275,_0x5b8c05),{'saveTo':path[_0x1e04('0x21')](_0x599275,util['format']('%s.%s',_0x5b8c05,_0x1e04('0x25')))},function(_0x2398a9,_0x3e6e38){rimraf(path[_0x1e04('0x21')](_0x599275,_0x5b8c05),function(){});_0x212e65(_0x1e04('0x26'));});});}})[_0x1e04('0x17')](function(){logger[_0x1e04('0xc')](util[_0x1e04('0xd')](_0x1e04('0x27'),EXTRACTED_REPORT_ID,_0x1e04('0xf')));return analyticExtractedReport(_0x1e04('0x28'),_0x2190be?util['format'](_0x1e04('0x23'),_0x5b8c05,_0x2190be?_0x1e04('0x25'):_0x1e04('0x22')):null);});})[_0x1e04('0x29')](function(_0x2881db){logger[_0x1e04('0xc')](util['format'](_0x1e04('0x2a'),EXTRACTED_REPORT_ID,'CSV'),util[_0x1e04('0x2b')](_0x2881db,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1e04('0x2c'));})[_0x1e04('0x2d')](function(){process[_0x1e04('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf758=['basename','.csv','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT','num','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname'];(function(_0x1bfe2b,_0x34856e){var _0x1477d4=function(_0x1d558c){while(--_0x1d558c){_0x1bfe2b['push'](_0x1bfe2b['shift']());}};_0x1477d4(++_0x34856e);}(_0xf758,0x10d));var _0x8f75=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0xf758[_0x40dd56];return _0x4f850f;};'use strict';var util=require(_0x8f75('0x0'));var path=require(_0x8f75('0x1'));var _=require('lodash');var csv=require(_0x8f75('0x2'));var fs=require('fs');var BPromise=require(_0x8f75('0x3'));var zipdir=require(_0x8f75('0x4'));var rimraf=require(_0x8f75('0x5'));var db=require(_0x8f75('0x6'))['db'];var dbH=require(_0x8f75('0x6'))[_0x8f75('0x7')];var logger=require(_0x8f75('0x8'))(_0x8f75('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x8f75('0xa')][0x2]);var QUERY=process[_0x8f75('0xa')][0x3];var PATH=process[_0x8f75('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xd6f827,_0x14d522){var _0x17143d={'status':_0xd6f827};var _0x360c3b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x14d522){_0x17143d[_0x8f75('0xb')]=_0x14d522;}return db['AnalyticExtractedReport'][_0x8f75('0xc')](_0x17143d,_0x360c3b);}function main(){var _0x5c5f42=0x1388;var _0x4d1852;logger['info'](util[_0x8f75('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8f75('0xe')));return db[_0x8f75('0xf')][_0x8f75('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8f75('0x11'),'splitSizeCsv']})['then'](function(_0x2c21ad){if(_0x2c21ad){_0x4d1852=_0x2c21ad;_0x5c5f42=_0x4d1852[_0x8f75('0x12')]||0x1388;}})[_0x8f75('0x13')](function(){return dbH[_0x8f75('0x14')][_0x8f75('0x15')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x8f75('0x14')]['QueryTypes'][_0x8f75('0x16')]});})[_0x8f75('0x13')](function(_0x459b8f){if(!_0x459b8f[0x0][_0x8f75('0x17')]){return analyticExtractedReport('Empty');}var _0x18fc9d=[];var _0x2657e7=0x0;if(_0x4d1852[_0x8f75('0x11')]){if(_0x459b8f&&_0x459b8f[_0x8f75('0x18')]){var _0x3e8c92=_['range'](_0x459b8f[0x0]['num']/_0x5c5f42);var _0x57f22a=Number[_0x8f75('0x19')](_0x459b8f[0x0][_0x8f75('0x17')]/_0x5c5f42)?_0x459b8f[0x0][_0x8f75('0x17')]%_0x5c5f42:0x0;_0x3e8c92[_0x8f75('0x1a')](function(_0x493371){if(_0x493371>0x0){_0x2657e7+=_0x5c5f42;}_0x18fc9d[_0x8f75('0x1b')](dbH[_0x8f75('0x14')]['query'](util['format'](_0x8f75('0x1c'),QUERY,_0x5c5f42,_0x2657e7),{'type':dbH[_0x8f75('0x14')][_0x8f75('0x1d')]['SELECT']}));});if(_0x57f22a>0x0){_0x2657e7+=_0x5c5f42;_0x18fc9d[_0x8f75('0x1b')](dbH[_0x8f75('0x14')][_0x8f75('0x15')](util[_0x8f75('0xd')](_0x8f75('0x1c'),QUERY,_0x57f22a,_0x2657e7),{'type':dbH[_0x8f75('0x14')][_0x8f75('0x1d')][_0x8f75('0x16')]}));}}}else{_0x18fc9d[_0x8f75('0x1b')](dbH[_0x8f75('0x14')]['query'](QUERY,{'type':dbH['sequelize'][_0x8f75('0x1d')][_0x8f75('0x16')]}));}var _0x22e4fc=path[_0x8f75('0x1e')](PATH);var _0x5a1953=path[_0x8f75('0x1f')](PATH,_0x8f75('0x20'));var _0x3450b6=_0x4d1852['split']&&_0x18fc9d[_0x8f75('0x18')]>0x1;var _0x439845=[];if(!fs['existsSync'](path[_0x8f75('0x21')](_0x22e4fc,_0x5a1953))&&_0x3450b6){fs[_0x8f75('0x22')](path[_0x8f75('0x21')](_0x22e4fc,_0x5a1953));}return BPromise[_0x8f75('0x23')](_0x18fc9d,function(_0xf43748){_0x439845['push'](_0xf43748);})['then'](function(){for(var _0x19e41d=0x0;_0x19e41d<_0x439845[_0x8f75('0x18')];_0x19e41d+=0x1){var _0x2f9c6a;var _0x1e3bac=_0x439845[_0x19e41d];if(_0x3450b6){_0x2f9c6a=path[_0x8f75('0x21')](_0x22e4fc,_0x5a1953,util[_0x8f75('0xd')](_0x8f75('0x24'),_0x5a1953,_0x19e41d,_0x8f75('0x25')));}else{_0x2f9c6a=path[_0x8f75('0x21')](_0x22e4fc,util[_0x8f75('0xd')](_0x8f75('0x26'),_0x5a1953,_0x8f75('0x25')));}fs[_0x8f75('0x27')](_0x2f9c6a,csv(_0x1e3bac));}})[_0x8f75('0x13')](function(){if(_0x3450b6){return new Promise(function(_0x79fd0e){zipdir(path[_0x8f75('0x21')](_0x22e4fc,_0x5a1953),{'saveTo':path[_0x8f75('0x21')](_0x22e4fc,util[_0x8f75('0xd')](_0x8f75('0x26'),_0x5a1953,'zip'))},function(_0xb9fb78,_0x2c6eeb){rimraf(path[_0x8f75('0x21')](_0x22e4fc,_0x5a1953),function(){});_0x79fd0e(_0x8f75('0x28'));});});}})['then'](function(){logger[_0x8f75('0x29')](util[_0x8f75('0xd')](_0x8f75('0x2a'),EXTRACTED_REPORT_ID,_0x8f75('0xe')));return analyticExtractedReport(_0x8f75('0x2b'),_0x3450b6?util[_0x8f75('0xd')](_0x8f75('0x26'),_0x5a1953,_0x3450b6?_0x8f75('0x2c'):_0x8f75('0x25')):null);});})['catch'](function(_0x1534a3){logger[_0x8f75('0x29')](util['format'](_0x8f75('0x2d'),EXTRACTED_REPORT_ID,'CSV'),util[_0x8f75('0x2e')](_0x1534a3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8f75('0x2f'));})[_0x8f75('0x30')](function(){process[_0x8f75('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 b4bbc17..a7bb6c9 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 _0x7a10=['exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','catch','lodash','util','path','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','header','pageBreak','before','margin','landscape','\x20/\x20','Arial','black','right','Empty','Setting','find','split','splitSizePdf','then','num','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','query','QueryTypes','basename','join','each','flatten','createPdfKitDocument','%s.%s','pdf','all','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally'];(function(_0x263b35,_0x421508){var _0x48168e=function(_0x3bb3a6){while(--_0x3bb3a6){_0x263b35['push'](_0x263b35['shift']());}};_0x48168e(++_0x421508);}(_0x7a10,0xd2));var _0x07a1=function(_0x347c24,_0x5aae7a){_0x347c24=_0x347c24-0x0;var _0xa9aa58=_0x7a10[_0x347c24];return _0xa9aa58;};'use strict';var _=require(_0x07a1('0x0'));var fs=require('fs');var util=require(_0x07a1('0x1'));var path=require(_0x07a1('0x2'));var moment=require(_0x07a1('0x3'));var htmlToPdfmake=require(_0x07a1('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x07a1('0x5'));var rimraf=require(_0x07a1('0x6'));var JSDOM=require(_0x07a1('0x7'))[_0x07a1('0x8')];var window=new JSDOM('')[_0x07a1('0x9')];var BPromise=require(_0x07a1('0xa'));var db=require(_0x07a1('0xb'))['db'];var dbH=require(_0x07a1('0xb'))[_0x07a1('0xc')];var logger=require(_0x07a1('0xd'))(_0x07a1('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0x07a1('0xf')][0x2]);var QUERY=process[_0x07a1('0xf')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x07a1('0xf')][0x5];var FORMAT=_0x07a1('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x152fdd,_0x5600fa){var _0xf82441={'status':_0x152fdd};var _0x6500da={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5600fa){_0xf82441[_0x07a1('0x11')]=_0x5600fa;}return db[_0x07a1('0x12')][_0x07a1('0x13')](_0xf82441,_0x6500da);}function getHeaders(_0x4546df){return _[_0x07a1('0x14')](_0x4546df,function(_0x3fb70f){return{'text':_0x3fb70f,'style':_0x07a1('0x15')};});}function getRows(_0x5a71f5,_0x2c92ee){return _['map'](_0x2c92ee,function(_0x41295e){return _(_0x41295e)[_0x07a1('0x16')](_0x5a71f5)[_0x07a1('0x14')](function(_0x4ea14e){return _0x4ea14e?_[_0x07a1('0x17')](_0x4ea14e):'';})[_0x07a1('0x18')]();});}function createTable(_0x41e6b9,_0x28be39){var _0x38b715={'widths':_[_0x07a1('0x19')](Array(_0x41e6b9[_0x07a1('0x1a')]),0x91),'heights':function(_0x167e5b){return _0x167e5b===0x0?_0x07a1('0x1b'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3d3e09=getHeaders(_0x41e6b9);_0x38b715[_0x07a1('0x1c')][_0x07a1('0x1d')](_0x3d3e09);var _0x4855bf=getRows(_0x41e6b9,_0x28be39);_0x38b715['body']=_0x38b715['body'][_0x07a1('0x1e')](_0x4855bf);return _0x38b715;}function createTables(_0x1915c5){var _0x5c76d0=[];var _0x53b938=_[_0x07a1('0x1f')](Object['keys'](_0x1915c5[0x0]),0x5);_0x53b938[_0x07a1('0x20')](function(_0x18aec1){_0x5c76d0[_0x07a1('0x1d')](createTable(_0x18aec1,_0x1915c5));});return _0x5c76d0;}function getPDFDocDefinition(_0x4da97d){var _0xd0a161=util['format'](_0x07a1('0x21'),NAME,EXTRACTED_REPORT[_0x07a1('0x22')],moment(EXTRACTED_REPORT[_0x07a1('0x23')])[_0x07a1('0x24')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x07a1('0x24')](FORMAT));var _0x1a2b14=[];for(var _0x18ee2a=0x0;_0x18ee2a<_0x4da97d[_0x07a1('0x1a')];_0x18ee2a++){var _0x37cc4e=[];if(_0x18ee2a===0x0){_0x37cc4e['push']({'text':_0xd0a161,'style':_0x07a1('0x25')});}var _0x29b4bc={'table':_0x4da97d[_0x18ee2a]};if(_0x18ee2a>0x0){_0x29b4bc[_0x07a1('0x26')]=_0x07a1('0x27');_0x29b4bc[_0x07a1('0x28')]=[0x0,0x46,0x0,0x0];}_0x37cc4e[_0x07a1('0x1d')](_0x29b4bc);_0x1a2b14[_0x07a1('0x1d')](_0x37cc4e);}return{'pageSize':'A4','pageOrientation':_0x07a1('0x29'),'content':_0x1a2b14,'footer':function(_0x43fe1e,_0x5a941e){return{'text':_0x43fe1e['toString']()+_0x07a1('0x2a')+_0x5a941e,'style':'footer'};},'defaultStyle':{'font':_0x07a1('0x2b')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x07a1('0x2c')},'footer':{'alignment':_0x07a1('0x2d'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x323591){var _0x51ffb8=0x1388;var _0x2a764e;if(!_0x323591[0x0]['num']){return analyticExtractedReport(_0x07a1('0x2e'));}return db[_0x07a1('0x2f')][_0x07a1('0x30')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x07a1('0x31'),_0x07a1('0x32')]})[_0x07a1('0x33')](function(_0x2c10bf){if(_0x2c10bf){_0x2a764e=_0x2c10bf;_0x51ffb8=_0x2a764e[_0x07a1('0x32')]||0x3e8;}})[_0x07a1('0x33')](function(){var _0x27dace=[];var _0x23c318=0x0;if(_0x2a764e[_0x07a1('0x31')]){if(_0x323591&&_0x323591['length']){var _0x6db603=_['range'](_0x323591[0x0][_0x07a1('0x34')]/_0x51ffb8);var _0x86df4a=Number[_0x07a1('0x35')](_0x323591[0x0][_0x07a1('0x34')]/_0x51ffb8)?_0x323591[0x0][_0x07a1('0x34')]%_0x51ffb8:0x0;_0x6db603['forEach'](function(_0x116cc8){if(_0x116cc8>0x0){_0x23c318+=_0x51ffb8;}_0x27dace[_0x07a1('0x1d')](dbH[_0x07a1('0x36')]['query'](util[_0x07a1('0x24')](_0x07a1('0x37'),QUERY,_0x51ffb8,_0x23c318),{'type':dbH[_0x07a1('0x36')]['QueryTypes'][_0x07a1('0x38')]}));});if(_0x86df4a>0x0){_0x23c318+=_0x51ffb8;_0x27dace[_0x07a1('0x1d')](dbH['sequelize'][_0x07a1('0x39')](util['format'](_0x07a1('0x37'),QUERY,_0x86df4a,_0x23c318),{'type':dbH[_0x07a1('0x36')][_0x07a1('0x3a')][_0x07a1('0x38')]}));}}}else{_0x27dace[_0x07a1('0x1d')](dbH['sequelize'][_0x07a1('0x39')](QUERY,{'type':dbH[_0x07a1('0x36')][_0x07a1('0x3a')][_0x07a1('0x38')]}));}var _0x25d39f=path['dirname'](PATH);var _0x1b22c8=path[_0x07a1('0x3b')](PATH,'.pdf');var _0x1722c3=_0x2a764e[_0x07a1('0x31')]&&_0x27dace[_0x07a1('0x1a')]>0x1;var _0x3f10b6=[];if(!fs['existsSync'](path[_0x07a1('0x3c')](_0x25d39f,_0x1b22c8))&&_0x1722c3){fs['mkdirSync'](path[_0x07a1('0x3c')](_0x25d39f,_0x1b22c8));}return BPromise[_0x07a1('0x3d')](_0x27dace,function(_0x23e7df){_0x3f10b6[_0x07a1('0x1d')](_0x23e7df);})['then'](function(){var _0x4209e5=[];for(var _0x1abffc=0x0;_0x1abffc<_0x3f10b6[_0x07a1('0x1a')];_0x1abffc+=0x1){var _0x3ca4b7=_0x3f10b6[_0x1abffc];var _0x461cfb=createTables(_[_0x07a1('0x3e')](_0x3ca4b7));var _0xfe52cd;var _0x3e2502=getPDFDocDefinition(_0x461cfb);var _0x87f98=getPDFPrinter();var _0xdcf8f=_0x87f98[_0x07a1('0x3f')](_0x3e2502);if(_0x1722c3){_0xfe52cd=path[_0x07a1('0x3c')](_0x25d39f,_0x1b22c8,util[_0x07a1('0x24')]('%s%d.%s',_0x1b22c8,_0x1abffc,'pdf'));}else{_0xfe52cd=path[_0x07a1('0x3c')](_0x25d39f,util[_0x07a1('0x24')](_0x07a1('0x40'),_0x1b22c8,_0x07a1('0x41')));}_0x4209e5[_0x07a1('0x1d')](writePDFDocument(_0xdcf8f,_0xfe52cd));}return Promise[_0x07a1('0x42')](_0x4209e5);})[_0x07a1('0x33')](function(){if(_0x1722c3){return new Promise(function(_0x26dd35){zipdir(path[_0x07a1('0x3c')](_0x25d39f,_0x1b22c8),{'saveTo':path[_0x07a1('0x3c')](_0x25d39f,util[_0x07a1('0x24')](_0x07a1('0x40'),_0x1b22c8,'zip'))},function(){rimraf(path[_0x07a1('0x3c')](_0x25d39f,_0x1b22c8),function(){});_0x26dd35(_0x07a1('0x43'));});});}})['then'](function(){if(!_0x1722c3)return;rimraf(path[_0x07a1('0x3c')](_0x25d39f,_0x1b22c8),function(){});})[_0x07a1('0x33')](function(){logger['info'](util[_0x07a1('0x24')](_0x07a1('0x44'),EXTRACTED_REPORT_ID,_0x07a1('0x45')));return analyticExtractedReport(_0x07a1('0x46'),_0x1722c3?util[_0x07a1('0x24')](_0x07a1('0x40'),_0x1b22c8,_0x1722c3?_0x07a1('0x47'):_0x07a1('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x07a1('0x48')](util[_0x07a1('0x24')](_0x07a1('0x49'),EXTRACTED_REPORT_ID,_0x07a1('0x45')));return db[_0x07a1('0x12')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x07a1('0x33')](function(_0x4add36){EXTRACTED_REPORT=_0x4add36;return dbH[_0x07a1('0x36')][_0x07a1('0x39')](util[_0x07a1('0x24')](_0x07a1('0x4a'),QUERY),{'type':dbH[_0x07a1('0x36')][_0x07a1('0x3a')][_0x07a1('0x38')]});})[_0x07a1('0x33')](extractReport)['catch'](function(_0x196146){logger['info'](util['format'](_0x07a1('0x4b'),EXTRACTED_REPORT_ID,_0x07a1('0x45')),util[_0x07a1('0x4c')](_0x196146,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x07a1('0x4d')](function(){process[_0x07a1('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5ded30=new PdfPrinter({'Arial':{'normal':__dirname+_0x07a1('0x4f'),'bold':__dirname+_0x07a1('0x50'),'italics':__dirname+_0x07a1('0x51'),'bolditalics':__dirname+_0x07a1('0x52')}});return _0x5ded30;}function getPDFDocDefinitionFromHTML(_0x3dea31,_0x283f7f){var _0x681357=util[_0x07a1('0x24')]('%s\x20#%d',_0x283f7f[_0x07a1('0x53')],_0x283f7f['interactionId']);var _0x24ce56=moment()[_0x07a1('0x24')](_0x07a1('0x54'))[_0x07a1('0x17')]();var _0x1b15be=htmlToPdfmake(_0x3dea31,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1b15be],'defaultStyle':{'font':_0x07a1('0x2b')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x07a1('0x55'),'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':_0x07a1('0x55')}},'header':function(){return[{'text':_0x07a1('0x56'),'style':_0x07a1('0x25')}];},'footer':function(_0x19319d,_0x5c75b5){return[{'text':util['format'](_0x07a1('0x57'),_0x681357,_0x19319d,_0x5c75b5,_0x24ce56),'style':_0x07a1('0x58')}];}};}function writePDFDocument(_0x4fc42d,_0x4c6d22){return new Promise(function(_0x3cab29,_0x6a3f8){var _0x3d42fb=_0x4fc42d[_0x07a1('0x59')](fs[_0x07a1('0x5a')](_0x4c6d22));_0x3d42fb['on'](_0x07a1('0x5b'),function(){_0x3cab29(_0x07a1('0x5b'));});_0x3d42fb['on'](_0x07a1('0x5c'),function(_0x4f7b04){_0x6a3f8(_0x4f7b04);});_0x4fc42d[_0x07a1('0x5d')]();});}exports[_0x07a1('0x5e')]=function(_0x4bf57d,_0x1329e6){var _0x2d6a8e=getPDFPrinter();var _0x413dd4=getPDFDocDefinitionFromHTML(_0x4bf57d,_0x1329e6);var _0x15f0f4=_0x2d6a8e[_0x07a1('0x3f')](_0x413dd4);return writePDFDocument(_0x15f0f4,_0x1329e6[_0x07a1('0x2')])[_0x07a1('0x5f')](function(_0x1332c2){throw _0x1332c2;});}; \ No newline at end of file +var _0x6df1=['landscape','footer','Arial','right','num','Empty','Setting','split','then','splitSizePdf','range','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','query','dirname','.pdf','existsSync','join','mkdirSync','flatten','%s%d.%s','pdf','%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','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','toString','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','zip-dir','jsdom','JSDOM','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','value','fill','length','auto','body','push','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','pageBreak','before','margin'];(function(_0x149f32,_0x4273f7){var _0x11f475=function(_0x18eeef){while(--_0x18eeef){_0x149f32['push'](_0x149f32['shift']());}};_0x11f475(++_0x4273f7);}(_0x6df1,0xf3));var _0x16df=function(_0x4cc17e,_0xbff357){_0x4cc17e=_0x4cc17e-0x0;var _0x4ee2e9=_0x6df1[_0x4cc17e];return _0x4ee2e9;};'use strict';var _=require(_0x16df('0x0'));var fs=require('fs');var util=require(_0x16df('0x1'));var path=require(_0x16df('0x2'));var moment=require(_0x16df('0x3'));var htmlToPdfmake=require(_0x16df('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x16df('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0x16df('0x6'))[_0x16df('0x7')];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require(_0x16df('0x8'))['db'];var dbH=require(_0x16df('0x8'))[_0x16df('0x9')];var logger=require(_0x16df('0xa'))(_0x16df('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x16df('0xc')][0x2]);var QUERY=process[_0x16df('0xc')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x16df('0xc')][0x5];var FORMAT=_0x16df('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x41c1db,_0x58f63e){var _0x40bb27={'status':_0x41c1db};var _0x18e1e3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x58f63e){_0x40bb27[_0x16df('0xe')]=_0x58f63e;}return db[_0x16df('0xf')][_0x16df('0x10')](_0x40bb27,_0x18e1e3);}function getHeaders(_0x49c9d1){return _[_0x16df('0x11')](_0x49c9d1,function(_0xb176c8){return{'text':_0xb176c8,'style':_0x16df('0x12')};});}function getRows(_0x3dfbf6,_0x22facb){return _[_0x16df('0x11')](_0x22facb,function(_0x54d6ac){return _(_0x54d6ac)[_0x16df('0x13')](_0x3dfbf6)[_0x16df('0x11')](function(_0x5bb8af){return _0x5bb8af?_['toString'](_0x5bb8af):'';})[_0x16df('0x14')]();});}function createTable(_0x1de287,_0x3fd0fd){var _0x57b4e3={'widths':_[_0x16df('0x15')](Array(_0x1de287[_0x16df('0x16')]),0x91),'heights':function(_0x2154f6){return _0x2154f6===0x0?_0x16df('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x10f083=getHeaders(_0x1de287);_0x57b4e3[_0x16df('0x18')][_0x16df('0x19')](_0x10f083);var _0xcc65e8=getRows(_0x1de287,_0x3fd0fd);_0x57b4e3[_0x16df('0x18')]=_0x57b4e3[_0x16df('0x18')]['concat'](_0xcc65e8);return _0x57b4e3;}function createTables(_0x3c3fbd){var _0x2d3e98=[];var _0x5c3d94=_[_0x16df('0x1a')](Object[_0x16df('0x1b')](_0x3c3fbd[0x0]),0x5);_0x5c3d94[_0x16df('0x1c')](function(_0x3a0041){_0x2d3e98[_0x16df('0x19')](createTable(_0x3a0041,_0x3c3fbd));});return _0x2d3e98;}function getPDFDocDefinition(_0x175f92){var _0x36bf5d=util[_0x16df('0x1d')](_0x16df('0x1e'),NAME,EXTRACTED_REPORT[_0x16df('0x1f')],moment(EXTRACTED_REPORT[_0x16df('0x20')])[_0x16df('0x1d')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x16df('0x1d')](FORMAT));var _0x2ed9e8=[];for(var _0x56ee3e=0x0;_0x56ee3e<_0x175f92['length'];_0x56ee3e++){var _0x34e828=[];if(_0x56ee3e===0x0){_0x34e828[_0x16df('0x19')]({'text':_0x36bf5d,'style':'header'});}var _0xb16f27={'table':_0x175f92[_0x56ee3e]};if(_0x56ee3e>0x0){_0xb16f27[_0x16df('0x21')]=_0x16df('0x22');_0xb16f27[_0x16df('0x23')]=[0x0,0x46,0x0,0x0];}_0x34e828[_0x16df('0x19')](_0xb16f27);_0x2ed9e8[_0x16df('0x19')](_0x34e828);}return{'pageSize':'A4','pageOrientation':_0x16df('0x24'),'content':_0x2ed9e8,'footer':function(_0x49bfac,_0x305412){return{'text':_0x49bfac['toString']()+'\x20/\x20'+_0x305412,'style':_0x16df('0x25')};},'defaultStyle':{'font':_0x16df('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x16df('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x58913f){var _0x7cd087=0x1388;var _0x531e8f;if(!_0x58913f[0x0][_0x16df('0x28')]){return analyticExtractedReport(_0x16df('0x29'));}return db[_0x16df('0x2a')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x16df('0x2b'),'splitSizePdf']})[_0x16df('0x2c')](function(_0xb089d4){if(_0xb089d4){_0x531e8f=_0xb089d4;_0x7cd087=_0x531e8f[_0x16df('0x2d')]||0x3e8;}})['then'](function(){var _0x4541c2=[];var _0x228c82=0x0;if(_0x531e8f['split']){if(_0x58913f&&_0x58913f[_0x16df('0x16')]){var _0x5e954c=_[_0x16df('0x2e')](_0x58913f[0x0][_0x16df('0x28')]/_0x7cd087);var _0x3ad61c=Number[_0x16df('0x2f')](_0x58913f[0x0][_0x16df('0x28')]/_0x7cd087)?_0x58913f[0x0]['num']%_0x7cd087:0x0;_0x5e954c[_0x16df('0x1c')](function(_0x31a0c7){if(_0x31a0c7>0x0){_0x228c82+=_0x7cd087;}_0x4541c2[_0x16df('0x19')](dbH['sequelize']['query'](util[_0x16df('0x1d')](_0x16df('0x30'),QUERY,_0x7cd087,_0x228c82),{'type':dbH[_0x16df('0x31')][_0x16df('0x32')][_0x16df('0x33')]}));});if(_0x3ad61c>0x0){_0x228c82+=_0x7cd087;_0x4541c2[_0x16df('0x19')](dbH[_0x16df('0x31')][_0x16df('0x34')](util['format'](_0x16df('0x30'),QUERY,_0x3ad61c,_0x228c82),{'type':dbH[_0x16df('0x31')]['QueryTypes'][_0x16df('0x33')]}));}}}else{_0x4541c2[_0x16df('0x19')](dbH['sequelize'][_0x16df('0x34')](QUERY,{'type':dbH[_0x16df('0x31')][_0x16df('0x32')][_0x16df('0x33')]}));}var _0x254abe=path[_0x16df('0x35')](PATH);var _0x4fd0c1=path['basename'](PATH,_0x16df('0x36'));var _0x40b688=_0x531e8f[_0x16df('0x2b')]&&_0x4541c2[_0x16df('0x16')]>0x1;var _0x2bca7d=[];if(!fs[_0x16df('0x37')](path[_0x16df('0x38')](_0x254abe,_0x4fd0c1))&&_0x40b688){fs[_0x16df('0x39')](path[_0x16df('0x38')](_0x254abe,_0x4fd0c1));}return BPromise['each'](_0x4541c2,function(_0xb3899c){_0x2bca7d[_0x16df('0x19')](_0xb3899c);})[_0x16df('0x2c')](function(){var _0x2ed684=[];for(var _0x1e9d8c=0x0;_0x1e9d8c<_0x2bca7d[_0x16df('0x16')];_0x1e9d8c+=0x1){var _0x5032de=_0x2bca7d[_0x1e9d8c];var _0x171e07=createTables(_[_0x16df('0x3a')](_0x5032de));var _0x5bf9df;var _0x1de41d=getPDFDocDefinition(_0x171e07);var _0x1c4fa6=getPDFPrinter();var _0x1ef651=_0x1c4fa6['createPdfKitDocument'](_0x1de41d);if(_0x40b688){_0x5bf9df=path['join'](_0x254abe,_0x4fd0c1,util['format'](_0x16df('0x3b'),_0x4fd0c1,_0x1e9d8c,_0x16df('0x3c')));}else{_0x5bf9df=path[_0x16df('0x38')](_0x254abe,util[_0x16df('0x1d')](_0x16df('0x3d'),_0x4fd0c1,_0x16df('0x3c')));}_0x2ed684[_0x16df('0x19')](writePDFDocument(_0x1ef651,_0x5bf9df));}return Promise['all'](_0x2ed684);})[_0x16df('0x2c')](function(){if(_0x40b688){return new Promise(function(_0x279f92){zipdir(path['join'](_0x254abe,_0x4fd0c1),{'saveTo':path[_0x16df('0x38')](_0x254abe,util['format']('%s.%s',_0x4fd0c1,_0x16df('0x3e')))},function(){rimraf(path[_0x16df('0x38')](_0x254abe,_0x4fd0c1),function(){});_0x279f92(_0x16df('0x3f'));});});}})[_0x16df('0x2c')](function(){if(!_0x40b688)return;rimraf(path[_0x16df('0x38')](_0x254abe,_0x4fd0c1),function(){});})[_0x16df('0x2c')](function(){logger[_0x16df('0x40')](util[_0x16df('0x1d')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x16df('0x41')));return analyticExtractedReport(_0x16df('0x42'),_0x40b688?util[_0x16df('0x1d')](_0x16df('0x3d'),_0x4fd0c1,_0x40b688?_0x16df('0x3e'):_0x16df('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x16df('0x40')](util[_0x16df('0x1d')](_0x16df('0x43'),EXTRACTED_REPORT_ID,_0x16df('0x41')));return db[_0x16df('0xf')][_0x16df('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x16df('0x2c')](function(_0x3c8a6f){EXTRACTED_REPORT=_0x3c8a6f;return dbH['sequelize'][_0x16df('0x34')](util[_0x16df('0x1d')](_0x16df('0x45'),QUERY),{'type':dbH[_0x16df('0x31')]['QueryTypes'][_0x16df('0x33')]});})['then'](extractReport)[_0x16df('0x46')](function(_0x23d12c){logger['info'](util[_0x16df('0x1d')](_0x16df('0x47'),EXTRACTED_REPORT_ID,_0x16df('0x41')),util[_0x16df('0x48')](_0x23d12c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x16df('0x49')](function(){process[_0x16df('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x540d37=new PdfPrinter({'Arial':{'normal':__dirname+_0x16df('0x4b'),'bold':__dirname+_0x16df('0x4c'),'italics':__dirname+_0x16df('0x4d'),'bolditalics':__dirname+_0x16df('0x4e')}});return _0x540d37;}function getPDFDocDefinitionFromHTML(_0x382be2,_0x2805f2){var _0x394ebc=util[_0x16df('0x1d')](_0x16df('0x4f'),_0x2805f2['channel'],_0x2805f2[_0x16df('0x50')]);var _0x210974=moment()[_0x16df('0x1d')](_0x16df('0x51'))[_0x16df('0x52')]();var _0xdbacd7=htmlToPdfmake(_0x382be2,{'window':window,'tableAutoSize':!![]});return{'content':[_0xdbacd7],'defaultStyle':{'font':_0x16df('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x16df('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x16df('0x54'),'style':_0x16df('0x55')}];},'footer':function(_0x5aa737,_0x406982){return[{'text':util[_0x16df('0x1d')](_0x16df('0x56'),_0x394ebc,_0x5aa737,_0x406982,_0x210974),'style':_0x16df('0x25')}];}};}function writePDFDocument(_0xfc3a,_0x3273d2){return new Promise(function(_0x49cce3,_0x5d2f18){var _0x2b949a=_0xfc3a[_0x16df('0x57')](fs[_0x16df('0x58')](_0x3273d2));_0x2b949a['on'](_0x16df('0x59'),function(){_0x49cce3(_0x16df('0x59'));});_0x2b949a['on']('error',function(_0x2d9dae){_0x5d2f18(_0x2d9dae);});_0xfc3a[_0x16df('0x5a')]();});}exports[_0x16df('0x5b')]=function(_0x44907f,_0x1fa89e){var _0x2eec41=getPDFPrinter();var _0x5046ea=getPDFDocDefinitionFromHTML(_0x44907f,_0x1fa89e);var _0x266d96=_0x2eec41[_0x16df('0x5c')](_0x5046ea);return writePDFDocument(_0x266d96,_0x1fa89e[_0x16df('0x2')])[_0x16df('0x46')](function(_0x286c7e){throw _0x286c7e;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 750e500..2824624 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 _0xd679=['path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','range','isInteger','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','length','existsSync','mkdirSync','join','each','%s.%s','xlsx','writeFileSync','binary','zip','Completed','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit'];(function(_0x4c1765,_0x218161){var _0x1f157f=function(_0x454be9){while(--_0x454be9){_0x4c1765['push'](_0x4c1765['shift']());}};_0x1f157f(++_0x218161);}(_0xd679,0xcc));var _0x9d67=function(_0x469b8e,_0x2b8733){_0x469b8e=_0x469b8e-0x0;var _0x4044c3=_0xd679[_0x469b8e];return _0x4044c3;};'use strict';var util=require('util');var path=require(_0x9d67('0x0'));var _=require(_0x9d67('0x1'));var fs=require('fs');var json2xls=require(_0x9d67('0x2'));var BPromise=require(_0x9d67('0x3'));var zipdir=require(_0x9d67('0x4'));var rimraf=require(_0x9d67('0x5'));var db=require(_0x9d67('0x6'))['db'];var dbH=require(_0x9d67('0x6'))[_0x9d67('0x7')];var logger=require(_0x9d67('0x8'))(_0x9d67('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x9d67('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2d6f4b,_0x23d0ed){var _0x2b20e8={'status':_0x2d6f4b};var _0x59c445={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x23d0ed){_0x2b20e8[_0x9d67('0xb')]=_0x23d0ed;}return db[_0x9d67('0xc')][_0x9d67('0xd')](_0x2b20e8,_0x59c445);}function main(){var _0x25609f=0x1388;var _0x4d79f8;logger['info'](util['format'](_0x9d67('0xe'),EXTRACTED_REPORT_ID,_0x9d67('0xf')));return db[_0x9d67('0x10')][_0x9d67('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9d67('0x12'),_0x9d67('0x13')]})[_0x9d67('0x14')](function(_0x1230ed){if(_0x1230ed){_0x4d79f8=_0x1230ed;_0x25609f=_0x4d79f8[_0x9d67('0x13')]||0x1388;}})[_0x9d67('0x14')](function(){return dbH[_0x9d67('0x15')][_0x9d67('0x16')](util['format'](_0x9d67('0x17'),QUERY),{'type':dbH[_0x9d67('0x15')]['QueryTypes'][_0x9d67('0x18')]});})[_0x9d67('0x14')](function(_0x31226e){if(!_0x31226e[0x0][_0x9d67('0x19')]){return analyticExtractedReport('Empty');}var _0x4d383a=[];var _0x12601b=0x0;if(_0x4d79f8['split']){if(_0x31226e&&_0x31226e['length']){var _0x432b23=_[_0x9d67('0x1a')](_0x31226e[0x0]['num']/_0x25609f);var _0x4fb837=Number[_0x9d67('0x1b')](_0x31226e[0x0][_0x9d67('0x19')]/_0x25609f)?_0x31226e[0x0][_0x9d67('0x19')]%_0x25609f:0x0;_0x432b23['forEach'](function(_0x5b67d0){if(_0x5b67d0>0x0){_0x12601b+=_0x25609f;}_0x4d383a[_0x9d67('0x1c')](dbH[_0x9d67('0x15')][_0x9d67('0x16')](util[_0x9d67('0x1d')](_0x9d67('0x1e'),QUERY,_0x25609f,_0x12601b),{'type':dbH['sequelize'][_0x9d67('0x1f')]['SELECT']}));});if(_0x4fb837>0x0){_0x12601b+=_0x25609f;_0x4d383a['push'](dbH['sequelize'][_0x9d67('0x16')](util[_0x9d67('0x1d')](_0x9d67('0x1e'),QUERY,_0x4fb837,_0x12601b),{'type':dbH['sequelize'][_0x9d67('0x1f')][_0x9d67('0x18')]}));}}}else{_0x4d383a[_0x9d67('0x1c')](dbH[_0x9d67('0x15')][_0x9d67('0x16')](QUERY,{'type':dbH[_0x9d67('0x15')]['QueryTypes'][_0x9d67('0x18')]}));}var _0x4ffd80=path[_0x9d67('0x20')](PATH);var _0x1f53db=path[_0x9d67('0x21')](PATH,'.xlsx');var _0x30cf74=_0x4d79f8[_0x9d67('0x12')]&&_0x4d383a[_0x9d67('0x22')]>0x1;var _0x34f8fc=[];if(!fs[_0x9d67('0x23')](path['join'](_0x4ffd80,_0x1f53db))&&_0x30cf74){fs[_0x9d67('0x24')](path[_0x9d67('0x25')](_0x4ffd80,_0x1f53db));}return BPromise[_0x9d67('0x26')](_0x4d383a,function(_0x5f3f0c){_0x34f8fc[_0x9d67('0x1c')](_0x5f3f0c);})['then'](function(){for(var _0x9dd29e=0x0;_0x9dd29e<_0x34f8fc['length'];_0x9dd29e+=0x1){var _0x2781df;var _0x27e18c=_0x34f8fc[_0x9dd29e];if(_0x30cf74){_0x2781df=path[_0x9d67('0x25')](_0x4ffd80,_0x1f53db,util[_0x9d67('0x1d')]('%s%d.%s',_0x1f53db,_0x9dd29e,'xlsx'));}else{_0x2781df=path[_0x9d67('0x25')](_0x4ffd80,util[_0x9d67('0x1d')](_0x9d67('0x27'),_0x1f53db,_0x9d67('0x28')));}fs[_0x9d67('0x29')](_0x2781df,json2xls(_0x27e18c),_0x9d67('0x2a'));}})['then'](function(){if(_0x30cf74){return new Promise(function(_0x16a240){zipdir(path['join'](_0x4ffd80,_0x1f53db),{'saveTo':path['join'](_0x4ffd80,util[_0x9d67('0x1d')](_0x9d67('0x27'),_0x1f53db,_0x9d67('0x2b')))},function(_0x42c40c,_0x77484e){rimraf(path[_0x9d67('0x25')](_0x4ffd80,_0x1f53db),function(){});_0x16a240('zip\x20finished');});});}})[_0x9d67('0x14')](function(){logger['info'](util[_0x9d67('0x1d')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x9d67('0x2c'),_0x30cf74?util[_0x9d67('0x1d')](_0x9d67('0x27'),_0x1f53db,_0x30cf74?_0x9d67('0x2b'):_0x9d67('0x28')):null);});})[_0x9d67('0x2d')](function(_0x5c6afa){logger[_0x9d67('0x2e')](util[_0x9d67('0x1d')](_0x9d67('0x2f'),EXTRACTED_REPORT_ID,_0x9d67('0xf')),util['inspect'](_0x5c6afa,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9d67('0x30'));})[_0x9d67('0x31')](function(){process[_0x9d67('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6c4d=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','query','sequelize','SELECT','num','Empty','range','isInteger','forEach','push','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','split','length','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','inspect','finally','util','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','info','format'];(function(_0x5f5db3,_0x5eeb96){var _0x1eb08e=function(_0x1f2ec0){while(--_0x1f2ec0){_0x5f5db3['push'](_0x5f5db3['shift']());}};_0x1eb08e(++_0x5eeb96);}(_0x6c4d,0x1dd));var _0xd6c4=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x6c4d[_0x40ac5e];return _0x2839d6;};'use strict';var util=require(_0xd6c4('0x0'));var path=require('path');var _=require(_0xd6c4('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xd6c4('0x2'));var zipdir=require(_0xd6c4('0x3'));var rimraf=require(_0xd6c4('0x4'));var db=require(_0xd6c4('0x5'))['db'];var dbH=require(_0xd6c4('0x5'))[_0xd6c4('0x6')];var logger=require('../../config/logger')(_0xd6c4('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xd6c4('0x8')][0x2]);var QUERY=process[_0xd6c4('0x8')][0x3];var PATH=process[_0xd6c4('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x518e70,_0x14b89c){var _0x5812a9={'status':_0x518e70};var _0x59d9cc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x14b89c){_0x5812a9['savename']=_0x14b89c;}return db[_0xd6c4('0x9')][_0xd6c4('0xa')](_0x5812a9,_0x59d9cc);}function main(){var _0xd128a5=0x1388;var _0x510212;logger[_0xd6c4('0xb')](util[_0xd6c4('0xc')](_0xd6c4('0xd'),EXTRACTED_REPORT_ID,_0xd6c4('0xe')));return db[_0xd6c4('0xf')][_0xd6c4('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xd6c4('0x11')]})[_0xd6c4('0x12')](function(_0x550135){if(_0x550135){_0x510212=_0x550135;_0xd128a5=_0x510212[_0xd6c4('0x11')]||0x1388;}})[_0xd6c4('0x12')](function(){return dbH['sequelize'][_0xd6c4('0x13')](util[_0xd6c4('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xd6c4('0x14')]['QueryTypes'][_0xd6c4('0x15')]});})['then'](function(_0x10f358){if(!_0x10f358[0x0][_0xd6c4('0x16')]){return analyticExtractedReport(_0xd6c4('0x17'));}var _0x4267ca=[];var _0x23e20d=0x0;if(_0x510212['split']){if(_0x10f358&&_0x10f358['length']){var _0xe2bbea=_[_0xd6c4('0x18')](_0x10f358[0x0][_0xd6c4('0x16')]/_0xd128a5);var _0x205cdd=Number[_0xd6c4('0x19')](_0x10f358[0x0][_0xd6c4('0x16')]/_0xd128a5)?_0x10f358[0x0][_0xd6c4('0x16')]%_0xd128a5:0x0;_0xe2bbea[_0xd6c4('0x1a')](function(_0x1fde1e){if(_0x1fde1e>0x0){_0x23e20d+=_0xd128a5;}_0x4267ca[_0xd6c4('0x1b')](dbH[_0xd6c4('0x14')]['query'](util[_0xd6c4('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xd128a5,_0x23e20d),{'type':dbH[_0xd6c4('0x14')][_0xd6c4('0x1c')][_0xd6c4('0x15')]}));});if(_0x205cdd>0x0){_0x23e20d+=_0xd128a5;_0x4267ca[_0xd6c4('0x1b')](dbH[_0xd6c4('0x14')][_0xd6c4('0x13')](util[_0xd6c4('0xc')](_0xd6c4('0x1d'),QUERY,_0x205cdd,_0x23e20d),{'type':dbH['sequelize'][_0xd6c4('0x1c')]['SELECT']}));}}}else{_0x4267ca['push'](dbH[_0xd6c4('0x14')][_0xd6c4('0x13')](QUERY,{'type':dbH[_0xd6c4('0x14')][_0xd6c4('0x1c')][_0xd6c4('0x15')]}));}var _0x1c4660=path[_0xd6c4('0x1e')](PATH);var _0x2745b9=path[_0xd6c4('0x1f')](PATH,_0xd6c4('0x20'));var _0x20cf25=_0x510212[_0xd6c4('0x21')]&&_0x4267ca[_0xd6c4('0x22')]>0x1;var _0x3881ce=[];if(!fs[_0xd6c4('0x23')](path[_0xd6c4('0x24')](_0x1c4660,_0x2745b9))&&_0x20cf25){fs[_0xd6c4('0x25')](path[_0xd6c4('0x24')](_0x1c4660,_0x2745b9));}return BPromise[_0xd6c4('0x26')](_0x4267ca,function(_0x17535f){_0x3881ce['push'](_0x17535f);})[_0xd6c4('0x12')](function(){for(var _0x487151=0x0;_0x487151<_0x3881ce['length'];_0x487151+=0x1){var _0x6a4822;var _0x17cb29=_0x3881ce[_0x487151];if(_0x20cf25){_0x6a4822=path[_0xd6c4('0x24')](_0x1c4660,_0x2745b9,util['format'](_0xd6c4('0x27'),_0x2745b9,_0x487151,_0xd6c4('0x28')));}else{_0x6a4822=path['join'](_0x1c4660,util['format']('%s.%s',_0x2745b9,_0xd6c4('0x28')));}fs[_0xd6c4('0x29')](_0x6a4822,json2xls(_0x17cb29),_0xd6c4('0x2a'));}})[_0xd6c4('0x12')](function(){if(_0x20cf25){return new Promise(function(_0x435fb7){zipdir(path[_0xd6c4('0x24')](_0x1c4660,_0x2745b9),{'saveTo':path[_0xd6c4('0x24')](_0x1c4660,util[_0xd6c4('0xc')](_0xd6c4('0x2b'),_0x2745b9,_0xd6c4('0x2c')))},function(_0x1884a7,_0x551cdd){rimraf(path[_0xd6c4('0x24')](_0x1c4660,_0x2745b9),function(){});_0x435fb7('zip\x20finished');});});}})['then'](function(){logger[_0xd6c4('0xb')](util['format'](_0xd6c4('0x2d'),EXTRACTED_REPORT_ID,_0xd6c4('0xe')));return analyticExtractedReport('Completed',_0x20cf25?util[_0xd6c4('0xc')](_0xd6c4('0x2b'),_0x2745b9,_0x20cf25?_0xd6c4('0x2c'):'xlsx'):null);});})[_0xd6c4('0x2e')](function(_0x44be0f){logger['info'](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xd6c4('0xe')),util[_0xd6c4('0x2f')](_0x44be0f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xd6c4('0x30')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index fb9bb9b..2598cdd 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 _0x0db4=['intervals','VoiceExtension','findAll','IntervalId','uniq','map','exten','groupBy','queue','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','CDR(routeid)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','*,*,*,*','tag','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','concat','Hangup','destroy','bulkCreate','error','rewrite','util','models','then'];(function(_0x7be85d,_0x11b195){var _0x2d4db1=function(_0x53758d){while(--_0x53758d){_0x7be85d['push'](_0x7be85d['shift']());}};_0x2d4db1(++_0x11b195);}(_0x0db4,0xba));var _0x40db=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x0db4[_0x2283dc];return _0x16db90;};'use strict';var _=require('lodash');var util=require(_0x40db('0x0'));function rewrite(_0x1a5f5f,_0x489a0b){var _0x3d7f27=this;return _0x1a5f5f[_0x40db('0x1')]['Interval']['findAll']({'raw':!![]})[_0x40db('0x2')](function(_0x3a42cf){_0x3d7f27[_0x40db('0x3')]=_0x3a42cf;return _0x1a5f5f[_0x40db('0x1')][_0x40db('0x4')][_0x40db('0x5')]({'where':{'IntervalId':_0x489a0b[_0x40db('0x6')]},'raw':!![]});})[_0x40db('0x2')](function(_0x30c3da){return _0x1a5f5f[_0x40db('0x1')][_0x40db('0x4')][_0x40db('0x5')]({'where':{'exten':{'$in':_[_0x40db('0x7')](_[_0x40db('0x8')](_0x30c3da,_0x40db('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x40db('0x2')](function(_0x5e80f2){var _0x4b9133=_['filter'](_0x5e80f2,{'priority':'1'});var _0x5a5884=_['filter'](_0x5e80f2,{'isApp':0x1});var _0x986543=_[_0x40db('0xa')](_0x5a5884,'exten');var _0x2a00cf=[_0x40db('0xb'),'playback'];var _0x4ba9cc=[];var _0x26fee9=[];for(var _0x53a59b in _0x986543){if(_0x986543[_0x40db('0xc')](_0x53a59b)){_0x3d7f27[_0x40db('0xd')]=0x2;_0x3d7f27[_0x40db('0xe')]=[];_0x3d7f27[_0x40db('0xf')]=_[_0x40db('0x10')](_0x4b9133,{'exten':_0x986543[_0x53a59b][0x0][_0x40db('0x9')]});_0x3d7f27[_0x40db('0xe')][_0x40db('0x11')]({'type':_0x986543[_0x53a59b][0x0][_0x40db('0x12')],'app':_0x40db('0x13'),'appdata':util[_0x40db('0x14')](_0x40db('0x15'),_0x986543[_0x53a59b][0x0][_0x40db('0x12')]),'context':_0x986543[_0x53a59b][0x0][_0x40db('0x16')],'exten':_0x986543[_0x53a59b][0x0][_0x40db('0x9')],'priority':_0x3d7f27[_0x40db('0xd')]++,'VoiceExtensionId':_0x986543[_0x53a59b][0x0][_0x40db('0x17')]});if(_0x986543[_0x53a59b][0x0][_0x40db('0x12')]==='inbound'){_0x3d7f27[_0x40db('0xe')]['push']({'type':_0x986543[_0x53a59b][0x0][_0x40db('0x12')],'app':'Set','appdata':_0x40db('0x18')+_0x986543[_0x53a59b][0x0][_0x40db('0x17')],'context':_0x986543[_0x53a59b][0x0][_0x40db('0x16')],'exten':_0x986543[_0x53a59b][0x0][_0x40db('0x9')],'priority':_0x3d7f27[_0x40db('0xd')]++,'VoiceExtensionId':_0x986543[_0x53a59b][0x0][_0x40db('0x17')]});}else if(_0x986543[_0x53a59b][0x0]['type']==='outbound'){if(_0x3d7f27[_0x40db('0xf')]){_0x3d7f27[_0x40db('0xe')]['push']({'type':_0x986543[_0x53a59b][0x0][_0x40db('0x12')],'app':_0x40db('0x13'),'appdata':'CDR(destination)='+(_0x3d7f27['extension'][_0x40db('0x19')]?_0x40db('0x1a')+_0x3d7f27[_0x40db('0xf')][_0x40db('0x19')]+'}':_0x40db('0x1b')),'context':_0x986543[_0x53a59b][0x0]['context'],'exten':_0x986543[_0x53a59b][0x0]['exten'],'priority':_0x3d7f27[_0x40db('0xd')]++,'VoiceExtensionId':_0x986543[_0x53a59b][0x0][_0x40db('0x17')]});}_0x3d7f27['extensions'][_0x40db('0x11')]({'type':_0x986543[_0x53a59b][0x0][_0x40db('0x12')],'app':_0x40db('0x13'),'appdata':_0x40db('0x18')+_0x986543[_0x53a59b][0x0][_0x40db('0x17')],'context':_0x986543[_0x53a59b][0x0]['context'],'exten':_0x986543[_0x53a59b][0x0]['exten'],'priority':_0x3d7f27[_0x40db('0xd')]++,'VoiceExtensionId':_0x986543[_0x53a59b][0x0][_0x40db('0x17')]});var _0x1e78c4=_0x3d7f27[_0x40db('0xd')]++;_0x3d7f27['extensions'][_0x40db('0x11')]({'type':_0x986543[_0x53a59b][0x0]['type'],'app':_0x40db('0x1c'),'appdata':_0x40db('0x1d')+(_0x1e78c4+0x2)+_0x40db('0x1e')+(_0x1e78c4+0x1)+')','context':_0x986543[_0x53a59b][0x0][_0x40db('0x16')],'exten':_0x986543[_0x53a59b][0x0][_0x40db('0x9')],'priority':_0x1e78c4,'VoiceExtensionId':_0x986543[_0x53a59b][0x0][_0x40db('0x17')]});if(_0x3d7f27[_0x40db('0xf')]){_0x3d7f27[_0x40db('0xe')]['push']({'type':_0x986543[_0x53a59b][0x0][_0x40db('0x12')],'app':'Set','appdata':_0x3d7f27[_0x40db('0xf')][_0x40db('0x19')]?_0x40db('0x1f')+_0x3d7f27[_0x40db('0xf')]['cutdigits']+'}':_0x40db('0x20'),'context':_0x986543[_0x53a59b][0x0]['context'],'exten':_0x986543[_0x53a59b][0x0][_0x40db('0x9')],'priority':_0x3d7f27[_0x40db('0xd')]++,'VoiceExtensionId':_0x986543[_0x53a59b][0x0][_0x40db('0x17')]});}_0x3d7f27[_0x40db('0xe')][_0x40db('0x11')]({'type':_0x986543[_0x53a59b][0x0]['type'],'app':'Set','appdata':'outboundrouteid='+_0x986543[_0x53a59b][0x0][_0x40db('0x17')],'context':_0x986543[_0x53a59b][0x0]['context'],'exten':_0x986543[_0x53a59b][0x0]['exten'],'priority':_0x3d7f27[_0x40db('0xd')]++,'VoiceExtensionId':_0x986543[_0x53a59b][0x0]['VoiceExtensionId']});if(_0x3d7f27[_0x40db('0xf')]&&_0x3d7f27['extension'][_0x40db('0xc')](_0x40db('0x21'))&&_0x3d7f27[_0x40db('0xf')][_0x40db('0x21')]!==_0x40db('0x22')){_0x3d7f27[_0x40db('0xe')]['push']({'type':_0x986543[_0x53a59b][0x0][_0x40db('0x12')],'app':_0x40db('0x13'),'appdata':_0x40db('0x23'),'context':_0x986543[_0x53a59b][0x0][_0x40db('0x16')],'exten':_0x986543[_0x53a59b][0x0][_0x40db('0x9')],'priority':_0x3d7f27[_0x40db('0xd')]++,'VoiceExtensionId':_0x986543[_0x53a59b][0x0][_0x40db('0x17')]});_0x3d7f27['extensions'][_0x40db('0x11')]({'type':_0x986543[_0x53a59b][0x0][_0x40db('0x12')],'app':_0x40db('0x13'),'appdata':_0x40db('0x24')+_0x3d7f27[_0x40db('0xf')][_0x40db('0x21')]||'wav','context':_0x986543[_0x53a59b][0x0][_0x40db('0x16')],'exten':_0x986543[_0x53a59b][0x0][_0x40db('0x9')],'priority':_0x3d7f27[_0x40db('0xd')]++,'VoiceExtensionId':_0x986543[_0x53a59b][0x0][_0x40db('0x17')]});}}_0x3d7f27[_0x40db('0xe')][_0x40db('0x11')]({'type':_0x986543[_0x53a59b][0x0][_0x40db('0x12')],'app':_0x40db('0x13'),'appdata':_0x40db('0x25'),'context':_0x986543[_0x53a59b][0x0]['context'],'exten':_0x986543[_0x53a59b][0x0][_0x40db('0x9')],'priority':_0x3d7f27[_0x40db('0xd')]++,'VoiceExtensionId':_0x986543[_0x53a59b][0x0]['VoiceExtensionId']});_0x3d7f27[_0x40db('0xe')][_0x40db('0x11')]({'type':_0x986543[_0x53a59b][0x0][_0x40db('0x12')],'app':'Set','appdata':_0x40db('0x26'),'context':_0x986543[_0x53a59b][0x0][_0x40db('0x16')],'exten':_0x986543[_0x53a59b][0x0][_0x40db('0x9')],'priority':_0x3d7f27[_0x40db('0xd')]++,'VoiceExtensionId':_0x986543[_0x53a59b][0x0][_0x40db('0x17')]});_0x3d7f27[_0x40db('0xe')][_0x40db('0x11')]({'type':_0x986543[_0x53a59b][0x0]['type'],'app':_0x40db('0x13'),'appdata':_0x40db('0x27'),'context':_0x986543[_0x53a59b][0x0]['context'],'exten':_0x986543[_0x53a59b][0x0][_0x40db('0x9')],'priority':_0x3d7f27[_0x40db('0xd')]++,'VoiceExtensionId':_0x986543[_0x53a59b][0x0][_0x40db('0x17')]});for(var _0x375276=0x0,_0x40c25b=0x0;_0x375276<_0x986543[_0x53a59b][_0x40db('0x28')];_0x375276+=0x1,_0x40c25b=0x0){var _0x3ac3fc=_0x986543[_0x53a59b][_0x375276];if(_0x3ac3fc[_0x40db('0x12')]){_0x3ac3fc[_0x40db('0x12')]=_0x3ac3fc[_0x40db('0x12')][_0x40db('0x29')]();}var _0xd52d38=[];var _0x1c1cb5=[];delete _0x3ac3fc['id'];delete _0x3ac3fc['createdAt'];delete _0x3ac3fc[_0x40db('0x2a')];var _0x346f4e=_0x3ac3fc[_0x40db('0x2b')]!==_0x40db('0x2c')?[_0x3ac3fc[_0x40db('0x2b')]]:_0x3ac3fc['IntervalId']?_[_0x40db('0x8')](_['filter'](_0x3d7f27[_0x40db('0x3')],{'IntervalId':_0x3ac3fc['IntervalId']}),'interval'):[];if(_0x3ac3fc[_0x40db('0xc')](_0x40db('0x2d'))){if(_0x3ac3fc[_0x40db('0x2d')]&&_0x3ac3fc[_0x40db('0x2d')]!=='--'){_0xd52d38[_0x40db('0x11')]({'type':_0x3ac3fc[_0x40db('0x12')],'app':_0x40db('0x13'),'appdata':'CDR(tag)='+_0x3ac3fc['tag'],'context':_0x3ac3fc[_0x40db('0x16')],'exten':_0x3ac3fc[_0x40db('0x9')],'priority':_0x346f4e[_0x40db('0x28')]+_0x3d7f27[_0x40db('0xd')]+_0x40c25b++,'VoiceExtensionId':_0x3ac3fc[_0x40db('0x17')]});}}if(_0x3ac3fc[_0x40db('0x12')]===_0x40db('0x2e')&&_0x3ac3fc[_0x40db('0xc')](_0x40db('0x2f'))){if(_0x3ac3fc[_0x40db('0x2f')]){_0xd52d38['push']({'type':_0x3ac3fc[_0x40db('0x12')],'app':_0x40db('0x1c'),'appdata':_0x40db('0x30')+_0x3ac3fc[_0x40db('0x2f')]+')','context':_0x3ac3fc[_0x40db('0x16')],'exten':_0x3ac3fc[_0x40db('0x9')],'priority':_0x346f4e['length']+_0x3d7f27['priority']+_0x40c25b++,'VoiceExtensionId':_0x3ac3fc['VoiceExtensionId']});}else{_0xd52d38[_0x40db('0x11')]({'type':_0x3ac3fc[_0x40db('0x12')],'app':_0x40db('0x1c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x3ac3fc[_0x40db('0x16')],'exten':_0x3ac3fc[_0x40db('0x9')],'priority':_0x346f4e[_0x40db('0x28')]+_0x3d7f27[_0x40db('0xd')]+_0x40c25b++,'VoiceExtensionId':_0x3ac3fc[_0x40db('0x17')]});}}if(_0x3ac3fc[_0x40db('0xc')](_0x40db('0x31'))){if(_0x2a00cf[_0x40db('0x32')](_0x3ac3fc[_0x40db('0x33')][_0x40db('0x29')]())>=0x0&&_0x3ac3fc['appType']!=='custom'){if(_0x3ac3fc[_0x40db('0x31')]){_0xd52d38[_0x40db('0x11')]({'type':_0x3ac3fc[_0x40db('0x12')],'app':_0x40db('0x1c'),'appdata':_0x40db('0x34'),'context':_0x3ac3fc[_0x40db('0x16')],'exten':_0x3ac3fc[_0x40db('0x9')],'priority':_0x346f4e[_0x40db('0x28')]+_0x3d7f27[_0x40db('0xd')]+_0x40c25b++,'VoiceExtensionId':_0x3ac3fc[_0x40db('0x17')]});_0xd52d38['push']({'type':_0x3ac3fc[_0x40db('0x12')],'app':_0x40db('0x13'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3ac3fc[_0x40db('0x16')],'exten':_0x3ac3fc[_0x40db('0x9')],'priority':_0x346f4e[_0x40db('0x28')]+_0x3d7f27[_0x40db('0xd')]+_0x40c25b++,'VoiceExtensionId':_0x3ac3fc['VoiceExtensionId']});}else{_0xd52d38['push']({'type':_0x3ac3fc[_0x40db('0x12')],'app':_0x40db('0x1c'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3ac3fc[_0x40db('0x16')],'exten':_0x3ac3fc[_0x40db('0x9')],'priority':_0x346f4e[_0x40db('0x28')]+_0x3d7f27['priority']+_0x40c25b++,'VoiceExtensionId':_0x3ac3fc[_0x40db('0x17')]});_0xd52d38[_0x40db('0x11')]({'type':_0x3ac3fc[_0x40db('0x12')],'app':'Set','appdata':_0x40db('0x35'),'context':_0x3ac3fc[_0x40db('0x16')],'exten':_0x3ac3fc[_0x40db('0x9')],'priority':_0x346f4e[_0x40db('0x28')]+_0x3d7f27['priority']+_0x40c25b++,'VoiceExtensionId':_0x3ac3fc[_0x40db('0x17')]});}}}for(var _0x30ceb3=0x0;_0x30ceb3<_0x346f4e[_0x40db('0x28')];_0x30ceb3+=0x1){var _0x63d3da=_0x3d7f27[_0x40db('0xd')]+_0x346f4e['length'];var _0x113f97=_0x30ceb3===_0x346f4e[_0x40db('0x28')]-0x1?_0x3d7f27[_0x40db('0xd')]+_0xd52d38[_0x40db('0x28')]+_0x1c1cb5[_0x40db('0x28')]+0x2:_0x3d7f27[_0x40db('0xd')]+_0x30ceb3+0x1;_0xd52d38[_0x40db('0x36')](_0x30ceb3,0x0,{'type':_0x3ac3fc[_0x40db('0x12')],'app':_0x40db('0x37'),'appdata':_0x346f4e[_0x30ceb3]+'?'+_0x3ac3fc[_0x40db('0x16')]+_0x40db('0x38')+_0x63d3da+':'+_0x3ac3fc[_0x40db('0x16')]+_0x40db('0x38')+_0x113f97,'exten':_0x3ac3fc[_0x40db('0x9')],'context':_0x3ac3fc[_0x40db('0x16')],'priority':_0x3d7f27['priority']+_0x30ceb3,'VoiceExtensionId':_0x986543[_0x53a59b][0x0]['VoiceExtensionId']});}_0x3ac3fc[_0x40db('0xd')]=_0xd52d38[_0x40db('0x28')]?_['last'](_0xd52d38)[_0x40db('0xd')]+0x1:_0x3d7f27[_0x40db('0xd')];_0x3d7f27[_0x40db('0xd')]=(_0x1c1cb5['length']?_['last'](_0x1c1cb5)[_0x40db('0xd')]:_0x3ac3fc[_0x40db('0xd')])+0x1;_0x3d7f27[_0x40db('0xe')]=_[_0x40db('0x39')](_0x3d7f27[_0x40db('0xe')],_0xd52d38,[_0x3ac3fc],_0x1c1cb5);}_0x3d7f27['extensions'][_0x40db('0x11')]({'type':_0x986543[_0x53a59b][0x0][_0x40db('0x12')],'app':_0x40db('0x3a'),'exten':_0x986543[_0x53a59b][0x0][_0x40db('0x9')],'context':_0x986543[_0x53a59b][0x0][_0x40db('0x16')],'priority':_0x3d7f27[_0x40db('0xd')],'VoiceExtensionId':_0x986543[_0x53a59b][0x0][_0x40db('0x17')]});_0x4ba9cc[_0x40db('0x11')](_0x986543[_0x53a59b][0x0][_0x40db('0x17')]);_0x26fee9=_[_0x40db('0x39')](_0x26fee9,_0x3d7f27[_0x40db('0xe')]);}}return _0x1a5f5f['transaction'](function(_0x2e7cb6){return _0x1a5f5f[_0x40db('0x1')][_0x40db('0x4')][_0x40db('0x3b')]({'where':{'VoiceExtensionId':{'$in':_0x4ba9cc}},'transaction':_0x2e7cb6})[_0x40db('0x2')](function(_0x35c8b6){return _0x1a5f5f[_0x40db('0x1')][_0x40db('0x4')][_0x40db('0x3c')](_['sortBy'](_0x26fee9,_0x40db('0xd')),{'transaction':_0x2e7cb6});});});})['catch'](function(_0x2eff91){console[_0x40db('0x3d')](_0x2eff91);});}exports[_0x40db('0x3e')]=rewrite; \ No newline at end of file +var _0x488c=['util','findAll','then','intervals','models','IntervalId','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extension','find','extensions','push','type','CDR(type)=%s','VoiceExtensionId','inbound','Set','outbound','CDR(destination)=','cutdigits','${EXTEN}','context','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','toLowerCase','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash'];(function(_0x41800d,_0x3af58f){var _0x5a9c01=function(_0x44c43a){while(--_0x44c43a){_0x41800d['push'](_0x41800d['shift']());}};_0x5a9c01(++_0x3af58f);}(_0x488c,0xd4));var _0xc488=function(_0x4cc588,_0x4a9bc4){_0x4cc588=_0x4cc588-0x0;var _0x36619d=_0x488c[_0x4cc588];return _0x36619d;};'use strict';var _=require(_0xc488('0x0'));var util=require(_0xc488('0x1'));function rewrite(_0xfe5074,_0x3c66d4){var _0x4e87dd=this;return _0xfe5074['models']['Interval'][_0xc488('0x2')]({'raw':!![]})[_0xc488('0x3')](function(_0x3904c2){_0x4e87dd[_0xc488('0x4')]=_0x3904c2;return _0xfe5074[_0xc488('0x5')]['VoiceExtension'][_0xc488('0x2')]({'where':{'IntervalId':_0x3c66d4[_0xc488('0x6')]},'raw':!![]});})[_0xc488('0x3')](function(_0x4be7b5){return _0xfe5074[_0xc488('0x5')][_0xc488('0x7')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0xc488('0x8')](_0x4be7b5,_0xc488('0x9')))}},'order':[{'raw':_0xc488('0xa')}],'raw':!![]});})[_0xc488('0x3')](function(_0x5c6527){var _0x4785b7=_[_0xc488('0xb')](_0x5c6527,{'priority':'1'});var _0x5118a6=_['filter'](_0x5c6527,{'isApp':0x1});var _0x413b19=_[_0xc488('0xc')](_0x5118a6,_0xc488('0x9'));var _0x256916=[_0xc488('0xd'),_0xc488('0xe')];var _0x2af45f=[];var _0x2bc9b0=[];for(var _0x4da0a0 in _0x413b19){if(_0x413b19['hasOwnProperty'](_0x4da0a0)){_0x4e87dd[_0xc488('0xf')]=0x2;_0x4e87dd['extensions']=[];_0x4e87dd[_0xc488('0x10')]=_[_0xc488('0x11')](_0x4785b7,{'exten':_0x413b19[_0x4da0a0][0x0]['exten']});_0x4e87dd[_0xc488('0x12')][_0xc488('0x13')]({'type':_0x413b19[_0x4da0a0][0x0][_0xc488('0x14')],'app':'Set','appdata':util['format'](_0xc488('0x15'),_0x413b19[_0x4da0a0][0x0][_0xc488('0x14')]),'context':_0x413b19[_0x4da0a0][0x0]['context'],'exten':_0x413b19[_0x4da0a0][0x0][_0xc488('0x9')],'priority':_0x4e87dd[_0xc488('0xf')]++,'VoiceExtensionId':_0x413b19[_0x4da0a0][0x0][_0xc488('0x16')]});if(_0x413b19[_0x4da0a0][0x0][_0xc488('0x14')]===_0xc488('0x17')){_0x4e87dd['extensions'][_0xc488('0x13')]({'type':_0x413b19[_0x4da0a0][0x0]['type'],'app':_0xc488('0x18'),'appdata':'CDR(routeid)='+_0x413b19[_0x4da0a0][0x0][_0xc488('0x16')],'context':_0x413b19[_0x4da0a0][0x0]['context'],'exten':_0x413b19[_0x4da0a0][0x0][_0xc488('0x9')],'priority':_0x4e87dd[_0xc488('0xf')]++,'VoiceExtensionId':_0x413b19[_0x4da0a0][0x0]['VoiceExtensionId']});}else if(_0x413b19[_0x4da0a0][0x0][_0xc488('0x14')]===_0xc488('0x19')){if(_0x4e87dd[_0xc488('0x10')]){_0x4e87dd[_0xc488('0x12')][_0xc488('0x13')]({'type':_0x413b19[_0x4da0a0][0x0][_0xc488('0x14')],'app':_0xc488('0x18'),'appdata':_0xc488('0x1a')+(_0x4e87dd[_0xc488('0x10')][_0xc488('0x1b')]?'${EXTEN:'+_0x4e87dd[_0xc488('0x10')][_0xc488('0x1b')]+'}':_0xc488('0x1c')),'context':_0x413b19[_0x4da0a0][0x0][_0xc488('0x1d')],'exten':_0x413b19[_0x4da0a0][0x0]['exten'],'priority':_0x4e87dd[_0xc488('0xf')]++,'VoiceExtensionId':_0x413b19[_0x4da0a0][0x0]['VoiceExtensionId']});}_0x4e87dd[_0xc488('0x12')]['push']({'type':_0x413b19[_0x4da0a0][0x0]['type'],'app':_0xc488('0x18'),'appdata':_0xc488('0x1e')+_0x413b19[_0x4da0a0][0x0][_0xc488('0x16')],'context':_0x413b19[_0x4da0a0][0x0][_0xc488('0x1d')],'exten':_0x413b19[_0x4da0a0][0x0][_0xc488('0x9')],'priority':_0x4e87dd[_0xc488('0xf')]++,'VoiceExtensionId':_0x413b19[_0x4da0a0][0x0][_0xc488('0x16')]});var _0x2c2d90=_0x4e87dd[_0xc488('0xf')]++;_0x4e87dd['extensions'][_0xc488('0x13')]({'type':_0x413b19[_0x4da0a0][0x0][_0xc488('0x14')],'app':_0xc488('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2c2d90+0x2)+_0xc488('0x20')+(_0x2c2d90+0x1)+')','context':_0x413b19[_0x4da0a0][0x0][_0xc488('0x1d')],'exten':_0x413b19[_0x4da0a0][0x0][_0xc488('0x9')],'priority':_0x2c2d90,'VoiceExtensionId':_0x413b19[_0x4da0a0][0x0]['VoiceExtensionId']});if(_0x4e87dd[_0xc488('0x10')]){_0x4e87dd[_0xc488('0x12')][_0xc488('0x13')]({'type':_0x413b19[_0x4da0a0][0x0][_0xc488('0x14')],'app':_0xc488('0x18'),'appdata':_0x4e87dd['extension'][_0xc488('0x1b')]?_0xc488('0x21')+_0x4e87dd[_0xc488('0x10')]['cutdigits']+'}':_0xc488('0x22'),'context':_0x413b19[_0x4da0a0][0x0][_0xc488('0x1d')],'exten':_0x413b19[_0x4da0a0][0x0][_0xc488('0x9')],'priority':_0x4e87dd['priority']++,'VoiceExtensionId':_0x413b19[_0x4da0a0][0x0][_0xc488('0x16')]});}_0x4e87dd['extensions'][_0xc488('0x13')]({'type':_0x413b19[_0x4da0a0][0x0][_0xc488('0x14')],'app':_0xc488('0x18'),'appdata':_0xc488('0x23')+_0x413b19[_0x4da0a0][0x0]['VoiceExtensionId'],'context':_0x413b19[_0x4da0a0][0x0][_0xc488('0x1d')],'exten':_0x413b19[_0x4da0a0][0x0][_0xc488('0x9')],'priority':_0x4e87dd[_0xc488('0xf')]++,'VoiceExtensionId':_0x413b19[_0x4da0a0][0x0][_0xc488('0x16')]});if(_0x4e87dd[_0xc488('0x10')]&&_0x4e87dd['extension'][_0xc488('0x24')](_0xc488('0x25'))&&_0x4e87dd[_0xc488('0x10')][_0xc488('0x25')]!==_0xc488('0x26')){_0x4e87dd[_0xc488('0x12')][_0xc488('0x13')]({'type':_0x413b19[_0x4da0a0][0x0][_0xc488('0x14')],'app':'Set','appdata':_0xc488('0x27'),'context':_0x413b19[_0x4da0a0][0x0][_0xc488('0x1d')],'exten':_0x413b19[_0x4da0a0][0x0][_0xc488('0x9')],'priority':_0x4e87dd[_0xc488('0xf')]++,'VoiceExtensionId':_0x413b19[_0x4da0a0][0x0][_0xc488('0x16')]});_0x4e87dd[_0xc488('0x12')][_0xc488('0x13')]({'type':_0x413b19[_0x4da0a0][0x0][_0xc488('0x14')],'app':_0xc488('0x18'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4e87dd['extension'][_0xc488('0x25')]||'wav','context':_0x413b19[_0x4da0a0][0x0][_0xc488('0x1d')],'exten':_0x413b19[_0x4da0a0][0x0][_0xc488('0x9')],'priority':_0x4e87dd['priority']++,'VoiceExtensionId':_0x413b19[_0x4da0a0][0x0][_0xc488('0x16')]});}}_0x4e87dd['extensions'][_0xc488('0x13')]({'type':_0x413b19[_0x4da0a0][0x0][_0xc488('0x14')],'app':_0xc488('0x18'),'appdata':_0xc488('0x28'),'context':_0x413b19[_0x4da0a0][0x0][_0xc488('0x1d')],'exten':_0x413b19[_0x4da0a0][0x0][_0xc488('0x9')],'priority':_0x4e87dd['priority']++,'VoiceExtensionId':_0x413b19[_0x4da0a0][0x0][_0xc488('0x16')]});_0x4e87dd[_0xc488('0x12')]['push']({'type':_0x413b19[_0x4da0a0][0x0][_0xc488('0x14')],'app':_0xc488('0x18'),'appdata':_0xc488('0x29'),'context':_0x413b19[_0x4da0a0][0x0]['context'],'exten':_0x413b19[_0x4da0a0][0x0][_0xc488('0x9')],'priority':_0x4e87dd['priority']++,'VoiceExtensionId':_0x413b19[_0x4da0a0][0x0][_0xc488('0x16')]});_0x4e87dd[_0xc488('0x12')][_0xc488('0x13')]({'type':_0x413b19[_0x4da0a0][0x0][_0xc488('0x14')],'app':_0xc488('0x18'),'appdata':_0xc488('0x2a'),'context':_0x413b19[_0x4da0a0][0x0][_0xc488('0x1d')],'exten':_0x413b19[_0x4da0a0][0x0][_0xc488('0x9')],'priority':_0x4e87dd[_0xc488('0xf')]++,'VoiceExtensionId':_0x413b19[_0x4da0a0][0x0][_0xc488('0x16')]});for(var _0xc8a1fd=0x0,_0x389ced=0x0;_0xc8a1fd<_0x413b19[_0x4da0a0][_0xc488('0x2b')];_0xc8a1fd+=0x1,_0x389ced=0x0){var _0x247168=_0x413b19[_0x4da0a0][_0xc8a1fd];if(_0x247168[_0xc488('0x14')]){_0x247168[_0xc488('0x14')]=_0x247168[_0xc488('0x14')]['toLowerCase']();}var _0xfe8636=[];var _0x7edd2b=[];delete _0x247168['id'];delete _0x247168[_0xc488('0x2c')];delete _0x247168['updatedAt'];var _0x10757e=_0x247168[_0xc488('0x2d')]!=='*,*,*,*'?[_0x247168[_0xc488('0x2d')]]:_0x247168[_0xc488('0x6')]?_[_0xc488('0x8')](_['filter'](_0x4e87dd[_0xc488('0x4')],{'IntervalId':_0x247168[_0xc488('0x6')]}),_0xc488('0x2d')):[];if(_0x247168[_0xc488('0x24')](_0xc488('0x2e'))){if(_0x247168[_0xc488('0x2e')]&&_0x247168[_0xc488('0x2e')]!=='--'){_0xfe8636[_0xc488('0x13')]({'type':_0x247168['type'],'app':'Set','appdata':_0xc488('0x2f')+_0x247168[_0xc488('0x2e')],'context':_0x247168[_0xc488('0x1d')],'exten':_0x247168[_0xc488('0x9')],'priority':_0x10757e[_0xc488('0x2b')]+_0x4e87dd[_0xc488('0xf')]+_0x389ced++,'VoiceExtensionId':_0x247168['VoiceExtensionId']});}}if(_0x247168[_0xc488('0x14')]==='outbound'&&_0x247168[_0xc488('0x24')]('callerID')){if(_0x247168[_0xc488('0x30')]){_0xfe8636[_0xc488('0x13')]({'type':_0x247168[_0xc488('0x14')],'app':_0xc488('0x1f'),'appdata':_0xc488('0x31')+_0x247168[_0xc488('0x30')]+')','context':_0x247168[_0xc488('0x1d')],'exten':_0x247168[_0xc488('0x9')],'priority':_0x10757e[_0xc488('0x2b')]+_0x4e87dd[_0xc488('0xf')]+_0x389ced++,'VoiceExtensionId':_0x247168[_0xc488('0x16')]});}else{_0xfe8636['push']({'type':_0x247168['type'],'app':_0xc488('0x1f'),'appdata':_0xc488('0x32'),'context':_0x247168[_0xc488('0x1d')],'exten':_0x247168[_0xc488('0x9')],'priority':_0x10757e[_0xc488('0x2b')]+_0x4e87dd[_0xc488('0xf')]+_0x389ced++,'VoiceExtensionId':_0x247168['VoiceExtensionId']});}}if(_0x247168[_0xc488('0x24')](_0xc488('0x33'))){if(_0x256916['indexOf'](_0x247168[_0xc488('0x34')][_0xc488('0x35')]())>=0x0&&_0x247168[_0xc488('0x36')]!=='custom'){if(_0x247168[_0xc488('0x33')]){_0xfe8636[_0xc488('0x13')]({'type':_0x247168['type'],'app':_0xc488('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x247168[_0xc488('0x1d')],'exten':_0x247168[_0xc488('0x9')],'priority':_0x10757e[_0xc488('0x2b')]+_0x4e87dd['priority']+_0x389ced++,'VoiceExtensionId':_0x247168[_0xc488('0x16')]});_0xfe8636[_0xc488('0x13')]({'type':_0x247168[_0xc488('0x14')],'app':_0xc488('0x18'),'appdata':_0xc488('0x37'),'context':_0x247168['context'],'exten':_0x247168[_0xc488('0x9')],'priority':_0x10757e['length']+_0x4e87dd[_0xc488('0xf')]+_0x389ced++,'VoiceExtensionId':_0x247168[_0xc488('0x16')]});}else{_0xfe8636['push']({'type':_0x247168[_0xc488('0x14')],'app':'ExecIf','appdata':_0xc488('0x38'),'context':_0x247168[_0xc488('0x1d')],'exten':_0x247168[_0xc488('0x9')],'priority':_0x10757e[_0xc488('0x2b')]+_0x4e87dd[_0xc488('0xf')]+_0x389ced++,'VoiceExtensionId':_0x247168[_0xc488('0x16')]});_0xfe8636['push']({'type':_0x247168[_0xc488('0x14')],'app':'Set','appdata':_0xc488('0x39'),'context':_0x247168[_0xc488('0x1d')],'exten':_0x247168[_0xc488('0x9')],'priority':_0x10757e[_0xc488('0x2b')]+_0x4e87dd[_0xc488('0xf')]+_0x389ced++,'VoiceExtensionId':_0x247168['VoiceExtensionId']});}}}for(var _0x53c74b=0x0;_0x53c74b<_0x10757e[_0xc488('0x2b')];_0x53c74b+=0x1){var _0x55c381=_0x4e87dd[_0xc488('0xf')]+_0x10757e['length'];var _0x4fffa6=_0x53c74b===_0x10757e[_0xc488('0x2b')]-0x1?_0x4e87dd[_0xc488('0xf')]+_0xfe8636['length']+_0x7edd2b[_0xc488('0x2b')]+0x2:_0x4e87dd[_0xc488('0xf')]+_0x53c74b+0x1;_0xfe8636[_0xc488('0x3a')](_0x53c74b,0x0,{'type':_0x247168['type'],'app':_0xc488('0x3b'),'appdata':_0x10757e[_0x53c74b]+'?'+_0x247168['context']+_0xc488('0x3c')+_0x55c381+':'+_0x247168['context']+_0xc488('0x3c')+_0x4fffa6,'exten':_0x247168[_0xc488('0x9')],'context':_0x247168['context'],'priority':_0x4e87dd['priority']+_0x53c74b,'VoiceExtensionId':_0x413b19[_0x4da0a0][0x0][_0xc488('0x16')]});}_0x247168[_0xc488('0xf')]=_0xfe8636[_0xc488('0x2b')]?_[_0xc488('0x3d')](_0xfe8636)[_0xc488('0xf')]+0x1:_0x4e87dd['priority'];_0x4e87dd[_0xc488('0xf')]=(_0x7edd2b[_0xc488('0x2b')]?_[_0xc488('0x3d')](_0x7edd2b)[_0xc488('0xf')]:_0x247168[_0xc488('0xf')])+0x1;_0x4e87dd['extensions']=_[_0xc488('0x3e')](_0x4e87dd[_0xc488('0x12')],_0xfe8636,[_0x247168],_0x7edd2b);}_0x4e87dd['extensions'][_0xc488('0x13')]({'type':_0x413b19[_0x4da0a0][0x0]['type'],'app':_0xc488('0x3f'),'exten':_0x413b19[_0x4da0a0][0x0][_0xc488('0x9')],'context':_0x413b19[_0x4da0a0][0x0][_0xc488('0x1d')],'priority':_0x4e87dd[_0xc488('0xf')],'VoiceExtensionId':_0x413b19[_0x4da0a0][0x0][_0xc488('0x16')]});_0x2af45f[_0xc488('0x13')](_0x413b19[_0x4da0a0][0x0][_0xc488('0x16')]);_0x2bc9b0=_[_0xc488('0x3e')](_0x2bc9b0,_0x4e87dd[_0xc488('0x12')]);}}return _0xfe5074[_0xc488('0x40')](function(_0xd0586b){return _0xfe5074['models'][_0xc488('0x7')][_0xc488('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x2af45f}},'transaction':_0xd0586b})[_0xc488('0x3')](function(_0x35410b){return _0xfe5074['models']['VoiceExtension'][_0xc488('0x42')](_[_0xc488('0x43')](_0x2bc9b0,_0xc488('0xf')),{'transaction':_0xd0586b});});});})[_0xc488('0x44')](function(_0x205499){console[_0xc488('0x45')](_0x205499);});}exports[_0xc488('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index b9f2c5b..75856c1 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 _0x0440=['where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','id\x20IN\x20?','str','cm_hopper_final','\x20=\x20?','cm_hopper_black','fromQuery','VoiceQueue','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','always','push','query','VoiceQueueId','catch','sequelize','all','Campaign','onlyIfOpen','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','exit','info','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','ioredis','../../../mysqldb','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','Missing\x20filepath\x20parameter!','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','errors','map','message','join','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','CmContact','create','then','length','pick','Error\x20while\x20creating\x20contact:\x20','stringify','inspect','insert','into','createdAt','updatedAt','field','NOW()','scheduledAt','ContactId','toString','from','cm_contacts'];(function(_0x47d18c,_0x2b6b2c){var _0x2af37c=function(_0x300d79){while(--_0x300d79){_0x47d18c['push'](_0x47d18c['shift']());}};_0x2af37c(++_0x2b6b2c);}(_0x0440,0x1db));var _0x0044=function(_0x1139d0,_0x41e5f8){_0x1139d0=_0x1139d0-0x0;var _0xcc01a6=_0x0440[_0x1139d0];return _0xcc01a6;};'use strict';var BPromise=require(_0x0044('0x0'));var util=require('util');var _=require(_0x0044('0x1'));var fs=require('fs');var squel=require(_0x0044('0x2'));var Papa=require('papaparse');var Redis=require(_0x0044('0x3'));var db=require(_0x0044('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x0044('0x5'))('api');config[_0x0044('0x6')]=_[_0x0044('0x7')](config[_0x0044('0x6')],{'host':_0x0044('0x8'),'port':0x18eb});var socket=require(_0x0044('0x9'))(new Redis(config[_0x0044('0x6')]));require(_0x0044('0xa'))[_0x0044('0xb')](socket);try{if(!process[_0x0044('0xc')][0x2]||process[_0x0044('0xc')][0x2]==='undefined'||process[_0x0044('0xc')][0x2]==='null'){throw new Error(_0x0044('0xd'));}var FILEPATH=process[_0x0044('0xc')][0x2];if(!process[_0x0044('0xc')][0x3]||process[_0x0044('0xc')][0x3]===_0x0044('0xe')||process[_0x0044('0xc')][0x3]===_0x0044('0xf')||!process[_0x0044('0xc')][0x4]||process[_0x0044('0xc')][0x4]===_0x0044('0xe')||process[_0x0044('0xc')][0x4]===_0x0044('0xf')){throw new Error(_0x0044('0x10'));}var FIELDS=_[_0x0044('0x11')](process[_0x0044('0xc')][0x3][_0x0044('0x12')](','),process[_0x0044('0xc')][0x4]['split'](','));if(!process[_0x0044('0xc')][0x5]||process['argv'][0x5]==='undefined'||process[_0x0044('0xc')][0x5]===_0x0044('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0044('0xc')][0x5];var COMPANYID=process[_0x0044('0xc')][0x6]&&process[_0x0044('0xc')][0x6]!==_0x0044('0xe')&&process[_0x0044('0xc')][0x6]!=='null'?process[_0x0044('0xc')][0x6]:null;var DUPLICATES=process[_0x0044('0xc')][0x7]&&process['argv'][0x7]!==_0x0044('0xe')&&process[_0x0044('0xc')][0x7]!==_0x0044('0xf')?process[_0x0044('0xc')][0x7]:null;if(!process[_0x0044('0xc')][0x8]||process['argv'][0x8]==='undefined'||process[_0x0044('0xc')][0x8]===_0x0044('0xf')){throw new Error(_0x0044('0x13'));}var SOCKET_TIMESTAMP=process[_0x0044('0xc')][0x8];}catch(_0x239481){logger[_0x0044('0x14')](_0x239481);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(_0xd9bc75,_0x57f6a0,_0x3f202c,_0x247542){var _0x1b88b0={'message':_0x57f6a0};_0x1b88b0[_0xd9bc75]=!![];if(_0x3f202c){_0x1b88b0[_0x0044('0x15')]=_0x3f202c;}if(_0x247542){_0x1b88b0['index']=_0x247542;}return _0x1b88b0;}function isEmail(_0x58e549){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'](_0x58e549);}function checkRow(_0x244eda,_0x1750c6,_0x2dd346){return new BPromise(function(_0x13b6c3,_0x516b19){if(_[_0x0044('0x16')](_0x244eda)){return _0x516b19(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x2dd346));}if(_0x244eda[_0x0044('0x17')]&&_0x244eda['errors']['length']){var _0x3d4245=_[_0x0044('0x18')](_0x244eda[_0x0044('0x17')],_0x0044('0x19'))[_0x0044('0x1a')](';');return _0x516b19(handleCheckRowError(_0x0044('0x14'),_0x3d4245,null,_0x2dd346));}var _0x3697c1={};for(var _0x4dc4a6 in FIELDS){if(FIELDS['hasOwnProperty'](_0x4dc4a6)&&FIELDS[_0x4dc4a6]){_0x3697c1[_0x4dc4a6]=_0x244eda[_0x0044('0x1b')][0x0][FIELDS[_0x4dc4a6]]||_0x244eda[_0x0044('0x1b')][0x0]['\ufeff'+FIELDS[_0x4dc4a6]];}}if(!_0x3697c1['firstName']){return _0x516b19(handleCheckRowError(_0x0044('0x14'),_0x0044('0x1c'),null,_0x2dd346));}if(!_0x3697c1[_0x0044('0x1d')]){return _0x516b19(handleCheckRowError(_0x0044('0x14'),_0x0044('0x1e'),null,_0x2dd346));}if(_0x3697c1['birthDate']){var _0x1efe25=moment(_0x3697c1[_0x0044('0x1f')],_0x0044('0x20'));if(!_0x1efe25[_0x0044('0x21')]()){return _0x516b19(handleCheckRowError(_0x0044('0x14'),_0x0044('0x22'),null,_0x2dd346));}}if(_0x3697c1[_0x0044('0x23')]){if(!isEmail(_0x3697c1[_0x0044('0x23')])){return _0x516b19(handleCheckRowError(_0x0044('0x14'),_0x0044('0x24'),null,_0x2dd346));}}_0x3697c1[_0x0044('0x25')]=LISTID;_0x3697c1[_0x0044('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x1750c6){var _0x4e5b34={};for(var _0x5f41b7=0x0,_0x4a869d=DUPLICATES['length'];_0x5f41b7<_0x4a869d;_0x5f41b7+=0x1){_0x4e5b34[DUPLICATES[_0x5f41b7]]=_0x3697c1[DUPLICATES[_0x5f41b7]];}var _0x278f63=_[_0x0044('0x27')](_0x1750c6,_0x4e5b34);if(_0x278f63){return _0x516b19(handleCheckRowError(_0x0044('0x28'),'Duplicate\x20Contact',_0x278f63,_0x2dd346));}}return db[_0x0044('0x29')][_0x0044('0x2a')](_0x3697c1,{'raw':!![],'hooks':![],'fields':_['keys'](_0x3697c1)})[_0x0044('0x2b')](function(_0x50f239){if(DUPLICATES&&DUPLICATES[_0x0044('0x2c')]&&_0x1750c6){_0x1750c6['push'](_[_0x0044('0x2d')](_0x3697c1,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x50f239['id'];return _0x13b6c3();})['catch'](function(_0x185901){return _0x516b19(handleCheckRowError('error',_0x0044('0x2e')+(_0x185901[_0x0044('0x19')]||JSON[_0x0044('0x2f')](_0x185901)),null,_0x2dd346));});});}function checkHopper(){function _0x4e4824(){return function(_0x231e47){logger[_0x0044('0x14')]('cmContact','checkHopper',util[_0x0044('0x30')](_0x231e47,{'showHidden':![],'depth':null}));};}var _0x100251=function(_0x5c7bbe,_0x463776){var _0x167f6d=squel[_0x0044('0x31')]()[_0x0044('0x32')]('cm_hopper')['fromQuery']([_0x0044('0x1d'),'scheduledAt','ContactId',_0x0044('0x25'),_0x463776,_0x0044('0x33'),_0x0044('0x34')],squel['select']()[_0x0044('0x35')]('phone',_0x0044('0x1d'))[_0x0044('0x35')](_0x0044('0x36'),_0x0044('0x37'))[_0x0044('0x35')]('id',_0x0044('0x38'))[_0x0044('0x35')](LISTID[_0x0044('0x39')](),_0x0044('0x25'))[_0x0044('0x35')](_0x5c7bbe['id'][_0x0044('0x39')](),_0x463776)[_0x0044('0x35')](_0x0044('0x36'),'createdAt')[_0x0044('0x35')](_0x0044('0x36'),_0x0044('0x34'))[_0x0044('0x3a')](_0x0044('0x3b'))[_0x0044('0x3c')](_0x0044('0x3d'))[_0x0044('0x3c')](_0x0044('0x3e'),LISTID[_0x0044('0x39')]())[_0x0044('0x3c')](_0x0044('0x3f'))[_0x0044('0x3c')](_0x0044('0x40'),squel[_0x0044('0x41')]()[_0x0044('0x35')](_0x0044('0x1d'))[_0x0044('0x3a')]('cm_hopper')[_0x0044('0x3c')](_0x463776+'\x20=\x20?',_0x5c7bbe['id']['toString']())))[_0x0044('0x39')]();return _0x167f6d;};var _0x4ea45e=function(_0x2a966e,_0x2920c5){var _0x13b75f=squel[_0x0044('0x31')]()[_0x0044('0x32')](_0x0044('0x42'))['fromQuery']([_0x0044('0x1d'),_0x0044('0x37'),'ContactId',_0x0044('0x25'),_0x2920c5,_0x0044('0x33'),'updatedAt'],squel[_0x0044('0x41')]()[_0x0044('0x35')](_0x0044('0x1d'),_0x0044('0x1d'))['field'](_0x0044('0x36'),'scheduledAt')['field']('id',_0x0044('0x38'))['field'](LISTID['toString'](),_0x0044('0x25'))[_0x0044('0x35')](_0x2a966e['id'][_0x0044('0x39')](),_0x2920c5)[_0x0044('0x35')](_0x0044('0x36'),_0x0044('0x33'))['field'](_0x0044('0x36'),_0x0044('0x34'))['from'](_0x0044('0x3b'))['where'](_0x0044('0x3d'))[_0x0044('0x3c')](_0x0044('0x3e'),LISTID[_0x0044('0x39')]())[_0x0044('0x3c')](_0x0044('0x43'),squel[_0x0044('0x44')](hopperContacts))['where'](_0x0044('0x3f'))[_0x0044('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0044('0x41')]()[_0x0044('0x35')]('calleridnum')['from'](_0x0044('0x45'))[_0x0044('0x3c')](_0x2920c5+_0x0044('0x46'),_0x2a966e['id'][_0x0044('0x39')]()))['where'](_0x0044('0x40'),squel[_0x0044('0x41')]()[_0x0044('0x35')](_0x0044('0x1d'))[_0x0044('0x3a')](_0x0044('0x42'))[_0x0044('0x3c')](_0x2920c5+_0x0044('0x46'),_0x2a966e['id'][_0x0044('0x39')]())))[_0x0044('0x39')]();return _0x13b75f;};function _0x1b8de1(_0x55a765,_0xa9ee71){var _0x3b35db=squel[_0x0044('0x31')]()[_0x0044('0x32')](_0x0044('0x42'))['fromQuery']([_0x0044('0x1d'),'scheduledAt',_0x0044('0x38'),'ListId',_0xa9ee71,'createdAt',_0x0044('0x34')],squel[_0x0044('0x41')]()['field'](_0x0044('0x1d'),_0x0044('0x1d'))['field'](_0x0044('0x36'),'scheduledAt')['field']('id',_0x0044('0x38'))[_0x0044('0x35')](LISTID[_0x0044('0x39')](),_0x0044('0x25'))[_0x0044('0x35')](_0x55a765['id']['toString'](),_0xa9ee71)[_0x0044('0x35')](_0x0044('0x36'),_0x0044('0x33'))[_0x0044('0x35')]('NOW()',_0x0044('0x34'))[_0x0044('0x3a')](_0x0044('0x3b'))[_0x0044('0x3c')](_0x0044('0x3d'))[_0x0044('0x3c')]('ListId\x20=\x20?',LISTID[_0x0044('0x39')]())['where']('id\x20IN\x20?',squel[_0x0044('0x44')](hopperContacts))[_0x0044('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x0044('0x39')]();return _0x3b35db;}function _0x43f454(_0x1a4458,_0x56ecb9){var _0x5f0dc8=squel[_0x0044('0x31')]()['into'](_0x0044('0x47'))[_0x0044('0x48')](['phone',_0x0044('0x38'),'ListId',_0x56ecb9,_0x0044('0x33'),_0x0044('0x34')],squel[_0x0044('0x41')]()[_0x0044('0x35')]('phone','phone')[_0x0044('0x35')]('id',_0x0044('0x38'))['field'](LISTID[_0x0044('0x39')](),_0x0044('0x25'))[_0x0044('0x35')](_0x1a4458['id'][_0x0044('0x39')](),_0x56ecb9)[_0x0044('0x35')]('NOW()',_0x0044('0x33'))[_0x0044('0x35')]('NOW()',_0x0044('0x34'))[_0x0044('0x3a')](_0x0044('0x3b'))[_0x0044('0x3c')](_0x0044('0x3d'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0x0044('0x3c')](_0x0044('0x43'),squel['str'](hopperContacts))[_0x0044('0x3c')](_0x0044('0x3f')))['toString']();return _0x5f0dc8;}return db[_0x0044('0x49')][_0x0044('0x4a')]({'where':{'type':_0x0044('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x0044('0x4c')],'as':_0x0044('0x4d'),'where':{'id':LISTID}}]})[_0x0044('0x2b')](function(_0x349caa){var _0x527760=[];if(_0x349caa){var _0x2b847f;for(var _0x18b92d=0x0,_0x44e92b;_0x18b92d<_0x349caa[_0x0044('0x2c')];_0x18b92d+=0x1){_0x44e92b=_0x349caa[_0x18b92d][_0x0044('0x4e')]({'plain':!![]});switch(_0x44e92b[_0x0044('0x4f')]){case _0x0044('0x50'):_0x527760[_0x0044('0x51')](db['sequelize'][_0x0044('0x52')](_0x4ea45e(_0x44e92b,_0x0044('0x53')))[_0x0044('0x2b')](function(){})[_0x0044('0x54')](_0x4e4824()));break;case'onlyIfOpen':_0x527760[_0x0044('0x51')](db[_0x0044('0x55')]['query'](_0x100251(_0x44e92b,_0x0044('0x53')))[_0x0044('0x2b')](function(){})['catch'](_0x4e4824()));break;default:_0x527760['push'](db[_0x0044('0x55')]['query'](_0x1b8de1(_0x44e92b,_0x0044('0x53')))[_0x0044('0x2b')](function(){})[_0x0044('0x54')](_0x4e4824()));}}}return _0x527760;})[_0x0044('0x56')]()['then'](function(){return db[_0x0044('0x49')][_0x0044('0x4a')]({'where':{'type':_0x0044('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0044('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x13dd7d){var _0x8a962f=[];if(_0x13dd7d){var _0x16f06e;for(var _0x5e5422=0x0,_0x318604;_0x5e5422<_0x13dd7d['length'];_0x5e5422+=0x1){_0x318604=_0x13dd7d[_0x5e5422][_0x0044('0x4e')]({'plain':!![]});_0x8a962f['push'](db[_0x0044('0x55')][_0x0044('0x52')](_0x43f454(_0x318604,_0x0044('0x53')))['then'](function(){})['catch'](_0x4e4824()));}}return _0x8a962f;})[_0x0044('0x56')]();})[_0x0044('0x2b')](function(){return db[_0x0044('0x57')][_0x0044('0x4a')]({'attributes':['id',_0x0044('0x4f')],'include':[{'model':db[_0x0044('0x4c')],'as':_0x0044('0x4d'),'where':{'id':LISTID}}]})['then'](function(_0x251d8d){var _0xf8b693=[];if(_0x251d8d){for(var _0x1ee7f4=0x0,_0x3878ed;_0x1ee7f4<_0x251d8d[_0x0044('0x2c')];_0x1ee7f4+=0x1){_0x3878ed=_0x251d8d[_0x1ee7f4][_0x0044('0x4e')]({'plain':!![]});switch(_0x3878ed[_0x0044('0x4f')]){case'always':_0xf8b693[_0x0044('0x51')](db[_0x0044('0x55')]['query'](_0x4ea45e(_0x3878ed,'CampaignId'))[_0x0044('0x2b')](function(){})[_0x0044('0x54')](_0x4e4824()));break;case _0x0044('0x58'):_0xf8b693[_0x0044('0x51')](db[_0x0044('0x55')][_0x0044('0x52')](_0x100251(_0x3878ed,_0x0044('0x59')))[_0x0044('0x2b')](function(){})[_0x0044('0x54')](_0x4e4824()));break;default:_0xf8b693[_0x0044('0x51')](db[_0x0044('0x55')]['query'](_0x1b8de1(_0x3878ed,_0x0044('0x59')))['then'](function(){})[_0x0044('0x54')](_0x4e4824()));}}}return _0xf8b693;})[_0x0044('0x56')]();})[_0x0044('0x2b')](function(){return db['Campaign'][_0x0044('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x0044('0x4c')],'as':_0x0044('0x5a'),'where':{'id':LISTID}}]})[_0x0044('0x2b')](function(_0x348fea){var _0x112194=[];if(_0x348fea){for(var _0xe69d07=0x0,_0x265faf;_0xe69d07<_0x348fea[_0x0044('0x2c')];_0xe69d07+=0x1){_0x265faf=_0x348fea[_0xe69d07][_0x0044('0x4e')]({'plain':!![]});_0x112194['push'](db['sequelize'][_0x0044('0x52')](_0x43f454(_0x265faf,_0x0044('0x59')))[_0x0044('0x2b')](function(){})[_0x0044('0x54')](_0x4e4824()));}}return _0x112194;})[_0x0044('0x56')]();})[_0x0044('0x54')](function(_0x2d50de){logger[_0x0044('0x14')](_0x0044('0x5b'),_0x0044('0x5c'),_0x2d50de['message']);});}var processPromises=function(_0x2311db){return BPromise[_0x0044('0x56')](promises)[_0x0044('0x2b')](function(_0x53f60e){})[_0x0044('0x54')](function(_0x1643d6){logger[_0x0044('0x14')](_0x0044('0x5d'),JSON[_0x0044('0x2f')](_0x1643d6));})[_0x0044('0x5e')](function(){socket[_0x0044('0x5f')](_0x0044('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2311db){return _0x2311db[_0x0044('0x61')]();}});};var endCsv=function(){return BPromise[_0x0044('0x62')]()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x0044('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0044('0x63')](FILEPATH);}catch(_0x5bcf3b){logger[_0x0044('0x14')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0044('0x2f')](_0x5bcf3b));}finally{process[_0x0044('0x64')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0044('0x65')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x0044('0x62')]()[_0x0044('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0044('0x12')](',');return db[_0x0044('0x29')][_0x0044('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0044('0x2b')](function(_0x5ca467){var _0x301ddd=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0044('0x66')](_0x301ddd,{'header':!![],'skipEmptyLines':!![],'step':function(_0x510010,_0xf04403){total+=0x1;var _0x4ba1a6=total;promises[_0x0044('0x51')](checkRow(_0x510010,_0x5ca467,_0x4ba1a6)['then'](function(){success+=0x1;})[_0x0044('0x54')](function(_0x43a5df){if(_0x43a5df['error']){errors+=0x1;delete _0x43a5df[_0x0044('0x14')];}else if(_0x43a5df[_0x0044('0x28')]){duplicates+=0x1;delete _0x43a5df['duplicate'];}rows['push'](_0x43a5df);}));if(total%0xc8===0x0){_0xf04403[_0x0044('0x67')]();return processPromises(_0xf04403);}},'complete':function(){return processPromises()[_0x0044('0x2b')](function(){logger[_0x0044('0x65')](_0x0044('0x68'));endCsv();});},'error':function(_0x198f51,_0x3f0bf5){logger[_0x0044('0x65')](_0x0044('0x69'),JSON['stringify'](_0x198f51));endCsv();}});})[_0x0044('0x54')](function(_0x582d6e){logger['error'](_0x0044('0x6a'),JSON[_0x0044('0x2f')](_0x582d6e));});}main(); \ No newline at end of file +var _0x78f2=['create','then','push','pick','catch','stringify','cmContact','checkHopper','insert','fromQuery','scheduledAt','ContactId','createdAt','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','updatedAt','ListId\x20=\x20?','id\x20IN\x20?','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','into','cm_hopper_black','str','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','onlyIfOpen','query','VoiceQueueId','BlackLists','all','Campaign','CampaignId','Error\x20processing\x20rows\x20block:','finally','resume','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','resolve','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact'];(function(_0x5837a0,_0xe2cf75){var _0x24a514=function(_0x1b5a62){while(--_0x1b5a62){_0x5837a0['push'](_0x5837a0['shift']());}};_0x24a514(++_0xe2cf75);}(_0x78f2,0xa7));var _0x278f=function(_0x105f2a,_0x8b5cf1){_0x105f2a=_0x105f2a-0x0;var _0x5967e7=_0x78f2[_0x105f2a];return _0x5967e7;};'use strict';var BPromise=require(_0x278f('0x0'));var util=require(_0x278f('0x1'));var _=require(_0x278f('0x2'));var fs=require('fs');var squel=require(_0x278f('0x3'));var Papa=require(_0x278f('0x4'));var Redis=require('ioredis');var db=require(_0x278f('0x5'))['db'];var config=require(_0x278f('0x6'));var logger=require('../../../config/logger')(_0x278f('0x7'));config['redis']=_[_0x278f('0x8')](config[_0x278f('0x9')],{'host':_0x278f('0xa'),'port':0x18eb});var socket=require(_0x278f('0xb'))(new Redis(config[_0x278f('0x9')]));require(_0x278f('0xc'))[_0x278f('0xd')](socket);try{if(!process[_0x278f('0xe')][0x2]||process[_0x278f('0xe')][0x2]===_0x278f('0xf')||process[_0x278f('0xe')][0x2]===_0x278f('0x10')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x278f('0xe')][0x2];if(!process['argv'][0x3]||process[_0x278f('0xe')][0x3]===_0x278f('0xf')||process[_0x278f('0xe')][0x3]==='null'||!process['argv'][0x4]||process[_0x278f('0xe')][0x4]===_0x278f('0xf')||process[_0x278f('0xe')][0x4]===_0x278f('0x10')){throw new Error(_0x278f('0x11'));}var FIELDS=_[_0x278f('0x12')](process[_0x278f('0xe')][0x3][_0x278f('0x13')](','),process[_0x278f('0xe')][0x4][_0x278f('0x13')](','));if(!process[_0x278f('0xe')][0x5]||process[_0x278f('0xe')][0x5]===_0x278f('0xf')||process[_0x278f('0xe')][0x5]==='null'){throw new Error(_0x278f('0x14'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x278f('0xe')][0x6]&&process[_0x278f('0xe')][0x6]!==_0x278f('0xf')&&process[_0x278f('0xe')][0x6]!==_0x278f('0x10')?process['argv'][0x6]:null;var DUPLICATES=process[_0x278f('0xe')][0x7]&&process[_0x278f('0xe')][0x7]!==_0x278f('0xf')&&process[_0x278f('0xe')][0x7]!==_0x278f('0x10')?process[_0x278f('0xe')][0x7]:null;if(!process['argv'][0x8]||process[_0x278f('0xe')][0x8]===_0x278f('0xf')||process[_0x278f('0xe')][0x8]===_0x278f('0x10')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x1e61e2){logger['error'](_0x1e61e2);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(_0x5e604d,_0x2ac2fc,_0x306827,_0x497769){var _0x514d8a={'message':_0x2ac2fc};_0x514d8a[_0x5e604d]=!![];if(_0x306827){_0x514d8a['contact']=_0x306827;}if(_0x497769){_0x514d8a[_0x278f('0x15')]=_0x497769;}return _0x514d8a;}function isEmail(_0x368a28){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))*$/[_0x278f('0x16')](_0x368a28);}function checkRow(_0x5f042f,_0x22e5a1,_0x44913d){return new BPromise(function(_0x1bb4d0,_0x3f3df8){if(_['isNil'](_0x5f042f)){return _0x3f3df8(handleCheckRowError(_0x278f('0x17'),_0x278f('0x18'),null,_0x44913d));}if(_0x5f042f['errors']&&_0x5f042f[_0x278f('0x19')][_0x278f('0x1a')]){var _0x26a823=_['map'](_0x5f042f[_0x278f('0x19')],_0x278f('0x1b'))['join'](';');return _0x3f3df8(handleCheckRowError(_0x278f('0x17'),_0x26a823,null,_0x44913d));}var _0x123857={};for(var _0x2f1615 in FIELDS){if(FIELDS['hasOwnProperty'](_0x2f1615)&&FIELDS[_0x2f1615]){_0x123857[_0x2f1615]=_0x5f042f[_0x278f('0x1c')][0x0][FIELDS[_0x2f1615]]||_0x5f042f[_0x278f('0x1c')][0x0]['\ufeff'+FIELDS[_0x2f1615]];}}if(!_0x123857[_0x278f('0x1d')]){return _0x3f3df8(handleCheckRowError(_0x278f('0x17'),'firstName\x20not\x20specified!',null,_0x44913d));}if(!_0x123857[_0x278f('0x1e')]){return _0x3f3df8(handleCheckRowError('error',_0x278f('0x1f'),null,_0x44913d));}if(_0x123857['birthDate']){var _0x276b84=moment(_0x123857[_0x278f('0x20')],_0x278f('0x21'));if(!_0x276b84[_0x278f('0x22')]()){return _0x3f3df8(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x44913d));}}if(_0x123857[_0x278f('0x23')]){if(!isEmail(_0x123857[_0x278f('0x23')])){return _0x3f3df8(handleCheckRowError(_0x278f('0x17'),'email\x20format\x20is\x20not\x20valid!',null,_0x44913d));}}_0x123857[_0x278f('0x24')]=LISTID;_0x123857[_0x278f('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x278f('0x1a')]&&_0x22e5a1){var _0x11e897={};for(var _0xbbb7ff=0x0,_0x109716=DUPLICATES[_0x278f('0x1a')];_0xbbb7ff<_0x109716;_0xbbb7ff+=0x1){_0x11e897[DUPLICATES[_0xbbb7ff]]=_0x123857[DUPLICATES[_0xbbb7ff]];}var _0x4d1dc1=_[_0x278f('0x26')](_0x22e5a1,_0x11e897);if(_0x4d1dc1){return _0x3f3df8(handleCheckRowError(_0x278f('0x27'),_0x278f('0x28'),_0x4d1dc1,_0x44913d));}}return db['CmContact'][_0x278f('0x29')](_0x123857,{'raw':!![],'hooks':![],'fields':_['keys'](_0x123857)})[_0x278f('0x2a')](function(_0xd6b02c){if(DUPLICATES&&DUPLICATES[_0x278f('0x1a')]&&_0x22e5a1){_0x22e5a1[_0x278f('0x2b')](_[_0x278f('0x2c')](_0x123857,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xd6b02c['id'];return _0x1bb4d0();})[_0x278f('0x2d')](function(_0x4f6c39){return _0x3f3df8(handleCheckRowError(_0x278f('0x17'),'Error\x20while\x20creating\x20contact:\x20'+(_0x4f6c39[_0x278f('0x1b')]||JSON[_0x278f('0x2e')](_0x4f6c39)),null,_0x44913d));});});}function checkHopper(){function _0x15db1d(){return function(_0x543795){logger[_0x278f('0x17')](_0x278f('0x2f'),_0x278f('0x30'),util['inspect'](_0x543795,{'showHidden':![],'depth':null}));};}var _0x4a7be6=function(_0x47cb19,_0x197478){var _0x442339=squel[_0x278f('0x31')]()['into']('cm_hopper')[_0x278f('0x32')]([_0x278f('0x1e'),_0x278f('0x33'),_0x278f('0x34'),_0x278f('0x24'),_0x197478,_0x278f('0x35'),'updatedAt'],squel['select']()[_0x278f('0x36')](_0x278f('0x1e'),'phone')[_0x278f('0x36')](_0x278f('0x37'),_0x278f('0x33'))['field']('id',_0x278f('0x34'))['field'](LISTID[_0x278f('0x38')](),_0x278f('0x24'))[_0x278f('0x36')](_0x47cb19['id'][_0x278f('0x38')](),_0x197478)['field'](_0x278f('0x37'),_0x278f('0x35'))[_0x278f('0x36')](_0x278f('0x37'),'updatedAt')[_0x278f('0x39')](_0x278f('0x3a'))[_0x278f('0x3b')](_0x278f('0x3c'))[_0x278f('0x3b')]('ListId\x20=\x20?',LISTID[_0x278f('0x38')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x278f('0x3b')](_0x278f('0x3d'),squel[_0x278f('0x3e')]()[_0x278f('0x36')](_0x278f('0x1e'))[_0x278f('0x39')](_0x278f('0x3f'))[_0x278f('0x3b')](_0x197478+_0x278f('0x40'),_0x47cb19['id'][_0x278f('0x38')]())))['toString']();return _0x442339;};var _0x42c966=function(_0x6e3a54,_0x1ab9aa){var _0x9a9fa3=squel[_0x278f('0x31')]()['into'](_0x278f('0x3f'))[_0x278f('0x32')](['phone','scheduledAt','ContactId',_0x278f('0x24'),_0x1ab9aa,_0x278f('0x35'),_0x278f('0x41')],squel[_0x278f('0x3e')]()[_0x278f('0x36')](_0x278f('0x1e'),_0x278f('0x1e'))[_0x278f('0x36')]('NOW()',_0x278f('0x33'))[_0x278f('0x36')]('id',_0x278f('0x34'))[_0x278f('0x36')](LISTID[_0x278f('0x38')](),'ListId')[_0x278f('0x36')](_0x6e3a54['id'][_0x278f('0x38')](),_0x1ab9aa)[_0x278f('0x36')]('NOW()',_0x278f('0x35'))[_0x278f('0x36')](_0x278f('0x37'),'updatedAt')['from'](_0x278f('0x3a'))[_0x278f('0x3b')](_0x278f('0x3c'))[_0x278f('0x3b')](_0x278f('0x42'),LISTID[_0x278f('0x38')]())['where'](_0x278f('0x43'),squel['str'](hopperContacts))[_0x278f('0x3b')](_0x278f('0x44'))[_0x278f('0x3b')](_0x278f('0x3d'),squel[_0x278f('0x3e')]()[_0x278f('0x36')](_0x278f('0x45'))['from'](_0x278f('0x46'))[_0x278f('0x3b')](_0x1ab9aa+_0x278f('0x40'),_0x6e3a54['id'][_0x278f('0x38')]()))[_0x278f('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x278f('0x3e')]()[_0x278f('0x36')](_0x278f('0x1e'))['from']('cm_hopper')[_0x278f('0x3b')](_0x1ab9aa+'\x20=\x20?',_0x6e3a54['id'][_0x278f('0x38')]())))[_0x278f('0x38')]();return _0x9a9fa3;};function _0x8b6c6d(_0x5f2662,_0x4f2ed7){var _0x5947c1=squel['insert']()[_0x278f('0x47')](_0x278f('0x3f'))[_0x278f('0x32')]([_0x278f('0x1e'),_0x278f('0x33'),'ContactId','ListId',_0x4f2ed7,_0x278f('0x35'),_0x278f('0x41')],squel[_0x278f('0x3e')]()[_0x278f('0x36')](_0x278f('0x1e'),_0x278f('0x1e'))['field']('NOW()',_0x278f('0x33'))['field']('id','ContactId')[_0x278f('0x36')](LISTID['toString'](),_0x278f('0x24'))[_0x278f('0x36')](_0x5f2662['id']['toString'](),_0x4f2ed7)['field'](_0x278f('0x37'),_0x278f('0x35'))[_0x278f('0x36')]('NOW()',_0x278f('0x41'))[_0x278f('0x39')](_0x278f('0x3a'))[_0x278f('0x3b')](_0x278f('0x3c'))[_0x278f('0x3b')](_0x278f('0x42'),LISTID['toString']())[_0x278f('0x3b')]('id\x20IN\x20?',squel['str'](hopperContacts))['where'](_0x278f('0x44')))[_0x278f('0x38')]();return _0x5947c1;}function _0x5c3739(_0x4cee51,_0x56d96f){var _0xe66cd5=squel[_0x278f('0x31')]()[_0x278f('0x47')](_0x278f('0x48'))[_0x278f('0x32')]([_0x278f('0x1e'),'ContactId',_0x278f('0x24'),_0x56d96f,_0x278f('0x35'),_0x278f('0x41')],squel[_0x278f('0x3e')]()[_0x278f('0x36')](_0x278f('0x1e'),_0x278f('0x1e'))[_0x278f('0x36')]('id',_0x278f('0x34'))[_0x278f('0x36')](LISTID['toString'](),_0x278f('0x24'))[_0x278f('0x36')](_0x4cee51['id'][_0x278f('0x38')](),_0x56d96f)['field'](_0x278f('0x37'),_0x278f('0x35'))['field'](_0x278f('0x37'),_0x278f('0x41'))[_0x278f('0x39')](_0x278f('0x3a'))[_0x278f('0x3b')](_0x278f('0x3c'))[_0x278f('0x3b')](_0x278f('0x42'),LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x278f('0x49')](hopperContacts))[_0x278f('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0x278f('0x38')]();return _0xe66cd5;}return db[_0x278f('0x4a')][_0x278f('0x4b')]({'where':{'type':_0x278f('0x4c')},'attributes':['id',_0x278f('0x4d')],'include':[{'model':db[_0x278f('0x4e')],'as':_0x278f('0x4f'),'where':{'id':LISTID}}]})[_0x278f('0x2a')](function(_0x330faf){var _0x10e97d=[];if(_0x330faf){var _0xf9ef5;for(var _0x2ba7e3=0x0,_0x17ac5a;_0x2ba7e3<_0x330faf[_0x278f('0x1a')];_0x2ba7e3+=0x1){_0x17ac5a=_0x330faf[_0x2ba7e3][_0x278f('0x50')]({'plain':!![]});switch(_0x17ac5a[_0x278f('0x4d')]){case _0x278f('0x51'):_0x10e97d[_0x278f('0x2b')](db[_0x278f('0x52')]['query'](_0x42c966(_0x17ac5a,'VoiceQueueId'))['then'](function(){})[_0x278f('0x2d')](_0x15db1d()));break;case _0x278f('0x53'):_0x10e97d[_0x278f('0x2b')](db[_0x278f('0x52')][_0x278f('0x54')](_0x4a7be6(_0x17ac5a,'VoiceQueueId'))[_0x278f('0x2a')](function(){})[_0x278f('0x2d')](_0x15db1d()));break;default:_0x10e97d['push'](db[_0x278f('0x52')][_0x278f('0x54')](_0x8b6c6d(_0x17ac5a,_0x278f('0x55')))[_0x278f('0x2a')](function(){})['catch'](_0x15db1d()));}}}return _0x10e97d;})['all']()['then'](function(){return db[_0x278f('0x4a')][_0x278f('0x4b')]({'where':{'type':_0x278f('0x4c')},'attributes':['id'],'include':[{'model':db[_0x278f('0x4e')],'as':_0x278f('0x56'),'where':{'id':LISTID}}]})[_0x278f('0x2a')](function(_0x564269){var _0x5980f6=[];if(_0x564269){var _0x32d514;for(var _0x25a509=0x0,_0x1f6736;_0x25a509<_0x564269[_0x278f('0x1a')];_0x25a509+=0x1){_0x1f6736=_0x564269[_0x25a509][_0x278f('0x50')]({'plain':!![]});_0x5980f6[_0x278f('0x2b')](db[_0x278f('0x52')][_0x278f('0x54')](_0x5c3739(_0x1f6736,'VoiceQueueId'))[_0x278f('0x2a')](function(){})[_0x278f('0x2d')](_0x15db1d()));}}return _0x5980f6;})[_0x278f('0x57')]();})[_0x278f('0x2a')](function(){return db[_0x278f('0x58')][_0x278f('0x4b')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x278f('0x2a')](function(_0x4ba0e8){var _0x9e7bbe=[];if(_0x4ba0e8){for(var _0x3a1299=0x0,_0x5effb8;_0x3a1299<_0x4ba0e8[_0x278f('0x1a')];_0x3a1299+=0x1){_0x5effb8=_0x4ba0e8[_0x3a1299][_0x278f('0x50')]({'plain':!![]});switch(_0x5effb8[_0x278f('0x4d')]){case'always':_0x9e7bbe[_0x278f('0x2b')](db[_0x278f('0x52')]['query'](_0x42c966(_0x5effb8,_0x278f('0x59')))[_0x278f('0x2a')](function(){})['catch'](_0x15db1d()));break;case _0x278f('0x53'):_0x9e7bbe[_0x278f('0x2b')](db['sequelize'][_0x278f('0x54')](_0x4a7be6(_0x5effb8,_0x278f('0x59')))['then'](function(){})[_0x278f('0x2d')](_0x15db1d()));break;default:_0x9e7bbe[_0x278f('0x2b')](db[_0x278f('0x52')][_0x278f('0x54')](_0x8b6c6d(_0x5effb8,_0x278f('0x59')))[_0x278f('0x2a')](function(){})[_0x278f('0x2d')](_0x15db1d()));}}}return _0x9e7bbe;})[_0x278f('0x57')]();})[_0x278f('0x2a')](function(){return db[_0x278f('0x58')][_0x278f('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x278f('0x4e')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x278f('0x2a')](function(_0x19a661){var _0x23c2d9=[];if(_0x19a661){for(var _0x173fde=0x0,_0x20c8ee;_0x173fde<_0x19a661[_0x278f('0x1a')];_0x173fde+=0x1){_0x20c8ee=_0x19a661[_0x173fde][_0x278f('0x50')]({'plain':!![]});_0x23c2d9[_0x278f('0x2b')](db[_0x278f('0x52')][_0x278f('0x54')](_0x5c3739(_0x20c8ee,_0x278f('0x59')))['then'](function(){})['catch'](_0x15db1d()));}}return _0x23c2d9;})[_0x278f('0x57')]();})[_0x278f('0x2d')](function(_0x156080){logger[_0x278f('0x17')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x156080[_0x278f('0x1b')]);});}var processPromises=function(_0x451c8c){return BPromise[_0x278f('0x57')](promises)[_0x278f('0x2a')](function(_0xfc7448){})[_0x278f('0x2d')](function(_0x25e497){logger[_0x278f('0x17')](_0x278f('0x5a'),JSON['stringify'](_0x25e497));})[_0x278f('0x5b')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x451c8c){return _0x451c8c[_0x278f('0x5c')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x278f('0x2a')](function(){socket[_0x278f('0x5d')](_0x278f('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x278f('0x5f')](FILEPATH);}catch(_0x1ed98c){logger['error'](_0x278f('0x60'),JSON['stringify'](_0x1ed98c));}finally{process[_0x278f('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x278f('0x62')](_0x278f('0x63'));endCsv();});function main(){return BPromise[_0x278f('0x64')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x26c199){var _0x4203ba=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x278f('0x65')](_0x4203ba,{'header':!![],'skipEmptyLines':!![],'step':function(_0x9bd11c,_0x5dad0c){total+=0x1;var _0x23550a=total;promises[_0x278f('0x2b')](checkRow(_0x9bd11c,_0x26c199,_0x23550a)[_0x278f('0x2a')](function(){success+=0x1;})['catch'](function(_0x8975f4){if(_0x8975f4[_0x278f('0x17')]){errors+=0x1;delete _0x8975f4[_0x278f('0x17')];}else if(_0x8975f4[_0x278f('0x27')]){duplicates+=0x1;delete _0x8975f4['duplicate'];}rows[_0x278f('0x2b')](_0x8975f4);}));if(total%0xc8===0x0){_0x5dad0c['pause']();return processPromises(_0x5dad0c);}},'complete':function(){return processPromises()[_0x278f('0x2a')](function(){logger[_0x278f('0x62')](_0x278f('0x66'));endCsv();});},'error':function(_0x2112a7,_0x56d707){logger[_0x278f('0x62')](_0x278f('0x67'),JSON[_0x278f('0x2e')](_0x2112a7));endCsv();}});})['catch'](function(_0x4610cc){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x278f('0x2e')](_0x4610cc));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index f752384..677ae95 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 _0x0ce8=['MIN(id)','min_id','group','info','error','message','exit','code','sequelize','query','spread','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','catch','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','stringify','send','start','binding','socket_timestamp','server/files/tmp','.csv','ContactItemType','name','_description','header','writeFileSync','parse','createReadStream','rows','errors','data','trim','replace','isNumber','email','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','hasOwnProperty','find','itemTypeId','appendFileSync','emit','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','CREATE\x20TABLE\x20','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_blacklists','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','test','select','field','phone','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','isNil','split','CmContactHasItem','findOne','update','updated','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','insert','fromQuery','scheduledat','ContactId','ListId','createdAt','UserId','recallme','fields','from','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','into','cm_hopper_black','updatedAt','cm_contacts','.id\x20=\x20','ListId\x20=\x20?','cm_contacts.createdAt','priority','cm_contacts.updatedAt','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?'];(function(_0x3f77c7,_0x5c6535){var _0x5662fa=function(_0x42572d){while(--_0x42572d){_0x3f77c7['push'](_0x3f77c7['shift']());}};_0x5662fa(++_0x5c6535);}(_0x0ce8,0x1c6));var _0x80ce=function(_0x358411,_0x2e545d){_0x358411=_0x358411-0x0;var _0xec30d4=_0x0ce8[_0x358411];return _0xec30d4;};'use strict';var fs=require('fs');var path=require(_0x80ce('0x0'));var _=require(_0x80ce('0x1'));var Papa=require(_0x80ce('0x2'));var util=require(_0x80ce('0x3'));var BPromise=require(_0x80ce('0x4'));var moment=require('moment');var squel=require(_0x80ce('0x5'));var Redis=require(_0x80ce('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x80ce('0x7'));var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')(_0x80ce('0x8'));config[_0x80ce('0x9')]=_[_0x80ce('0xa')](config['redis'],{'host':_0x80ce('0xb'),'port':0x18eb});var socket=require(_0x80ce('0xc'))(new Redis(config[_0x80ce('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x80ce('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x80ce('0xe')](_0x80ce('0xd'));function isEmail(_0x2b837b){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))*$/[_0x80ce('0xf')](_0x2b837b);}function selectNotIn(_0x15cebb,_0x3eac36,_0x114b16,_0x32e6d5,_0x1d0415){return squel[_0x80ce('0x10')]()[_0x80ce('0x11')](_0x80ce('0x12'))['from'](_0x32e6d5)[_0x80ce('0x13')](_0x3eac36,null,_0x3eac36+'.id\x20=\x20'+_0x32e6d5+'.'+_0x114b16)[_0x80ce('0x14')](_0x32e6d5+'.'+_0x114b16+_0x80ce('0x15')+_0x15cebb+'.'+_0x114b16)[_0x80ce('0x14')](_0x3eac36+_0x80ce('0x16')+_0x1d0415[_0x80ce('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2fde45,_0xdd6f2e){promisesAdditionalPhones=[];return db[_0x80ce('0x17')][_0x80ce('0x18')]({'raw':!![],'attributes':['id',_0x80ce('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x80ce('0x1a')](function(_0x2f3762){if(_0x2f3762!==null){var _0xc16d3f=[];for(var _0x277ef4=0x0;_0x277ef4<_0x2f3762[_0x80ce('0x1b')];_0x277ef4++){var _0x3f002f=_0x2f3762[_0x277ef4];_0xc16d3f[_0x80ce('0x1c')](insertAdditionalPhones(_0x3f002f));}}Promise[_0x80ce('0x1d')](_0xc16d3f)[_0x80ce('0x1a')](function(){_0x2fde45({'val':0x1});});});});}function insertAdditionalPhones(_0x29ed92){return new Promise(function(_0x3af7cb,_0x39d1af){var _0x1bb800=_0x29ed92['AdditionalPhones'];var _0x2a1a54=_0x1bb800['split'](';');var _0x42365b=[];orderBy=0x0;for(var _0x325fd0=0x0;_0x325fd0<_0x2a1a54[_0x80ce('0x1b')];_0x325fd0++){_0x42365b['push'](splitAdditionalPhone(_0x29ed92['id'],_0x2a1a54[_0x325fd0]));}Promise[_0x80ce('0x1d')](_0x42365b)[_0x80ce('0x1a')](function(){_0x3af7cb({'val':_0x2a1a54[_0x80ce('0x1b')]});});});}function splitAdditionalPhone(_0xf0328d,_0x194515){return new Promise(function(_0x3e6642,_0x1d7aef){var _0x20e177=_0x194515['split'](':');var _0x21a02e=_0x20e177[0x0];var _0x473c87=_0x20e177[0x1];if(!_[_0x80ce('0x1e')](_0x473c87)){var _0x5917d0=_0x473c87[_0x80ce('0x1f')]('|');var _0x3888de=[];for(var _0x148592=0x0;_0x148592<_0x5917d0[_0x80ce('0x1b')];_0x148592++){if(_0x5917d0[_0x148592]!==''){var _0x4a26d4=_['filter'](promisesAdditionalPhones,{'contactId':_0xf0328d,'phone':_0x5917d0[_0x148592]});if(_0x4a26d4[_0x80ce('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x80ce('0x1c')]({'contactId':_0xf0328d,'contactTypeId':_0x21a02e,'phone':_0x5917d0[_0x148592],'orderBy':orderBy});}}}_0x3e6642({'ok':0x1});}else _0x3e6642({'res':0x0});});}function createAdditionalPhone(_0x259d3c,_0x265151,_0x432f01,_0x3161eb){var _0x420912='';var _0x54f7ab='';var _0x1e0536=_0x432f01[_0x80ce('0x1f')]('§');_0x420912=_0x1e0536[0x0];if(_0x1e0536[_0x80ce('0x1b')]==0x2)_0x54f7ab=_0x1e0536[0x1];return new Promise(function(_0x466628,_0x777db6){return db[_0x80ce('0x20')][_0x80ce('0x21')]({'where':{'CmContactId':_0x259d3c,'item':_0x420912}})[_0x80ce('0x1a')](function(_0x4e1232){if(_0x4e1232){return db[_0x80ce('0x20')][_0x80ce('0x22')]({'ItemTypeId':_0x265151,'description':_0x54f7ab,'OrderBy':_0x3161eb},{'where':{'CmContactId':_0x259d3c,'item':_0x420912}})[_0x80ce('0x1a')](function(_0x259274){_0x466628({'res':_0x80ce('0x23')});});}else{return db[_0x80ce('0x20')]['create']({'CmContactId':_0x259d3c,'item':_0x420912,'description':_0x54f7ab,'ItemTypeId':_0x265151,'OrderBy':_0x3161eb,'ItemClass':_0x80ce('0x24')})[_0x80ce('0x1a')](function(_0x1eeb87){_0x466628({'res':_0x80ce('0x25')});});}});});}function insertCmHopper(_0x5c4536,_0x155113,_0xe190bb,_0x901b3f,_0xd8dfda){var _0x27a802=['cm_contacts.phone',_0x80ce('0x26'),_0x80ce('0x27'),_0x80ce('0x28'),_0x155113+'.'+_0x901b3f,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x80ce('0x29'),_0x80ce('0x2a'),'\x22'+_0xd8dfda+'\x22'];return squel[_0x80ce('0x2b')]()['into']('cm_hopper')[_0x80ce('0x2c')]([_0x80ce('0x12'),_0x80ce('0x2d'),_0x80ce('0x2e'),_0x80ce('0x2f'),_0x901b3f,_0x80ce('0x30'),'updatedAt','priority',_0x80ce('0x31'),_0x80ce('0x32')],squel[_0x80ce('0x10')]()[_0x80ce('0x33')](_0x27a802)[_0x80ce('0x34')](_0x155113)['join']('cm_contacts',null,_0x80ce('0x35')+_0x155113+_0x80ce('0x36'))[_0x80ce('0x13')](_0xe190bb,null,_0xe190bb+'.id\x20=\x20'+_0x155113+'.'+_0x901b3f)[_0x80ce('0x14')](_0x155113+_0x80ce('0x37'),_0x5c4536)['where'](_0x80ce('0x38'),NOW)[_0x80ce('0x14')](_0x80ce('0x39'),selectNotIn(_0x155113,_0xe190bb,_0x901b3f,_0x80ce('0x3a'),[_0x80ce('0x3b'),_0x80ce('0x3c')]))['where'](_0x80ce('0x39'),selectNotIn(_0x155113,_0xe190bb,_0x901b3f,'cm_hopper',['\x22always\x22'])))[_0x80ce('0x3d')]();}function insertCmHopperBlack(_0x9ee26,_0x4b860e,_0x45433c,_0x47c7d7){var _0x10fee0=[_0x80ce('0x3e'),_0x80ce('0x27'),_0x80ce('0x28'),_0x4b860e+'.'+_0x47c7d7,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x80ce('0x2b')]()[_0x80ce('0x3f')](_0x80ce('0x40'))[_0x80ce('0x2c')]([_0x80ce('0x12'),_0x80ce('0x2e'),_0x80ce('0x2f'),_0x47c7d7,_0x80ce('0x30'),_0x80ce('0x41')],squel[_0x80ce('0x10')]()['fields'](_0x10fee0)[_0x80ce('0x34')](_0x4b860e)['join'](_0x80ce('0x42'),null,_0x80ce('0x35')+_0x4b860e+'.CmListId')[_0x80ce('0x13')](_0x45433c,null,_0x45433c+_0x80ce('0x43')+_0x4b860e+'.'+_0x47c7d7)[_0x80ce('0x14')](_0x4b860e+'.CmListId\x20=\x20?',_0x9ee26)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x80ce('0x14')](_0x80ce('0x39'),squel[_0x80ce('0x10')]()[_0x80ce('0x11')](_0x80ce('0x12'))['from'](_0x80ce('0x40'))[_0x80ce('0x14')](_0x80ce('0x44'),_0x9ee26)[_0x80ce('0x14')](_0x47c7d7+_0x80ce('0x15')+_0x4b860e+'.'+_0x47c7d7)))['toString']();}function insertTzCmHopper(_0x39e9d5,_0x37d028,_0xc149d2,_0x1c7d7c,_0x34123c,_0x49a327){var _0x18ccde=[_0x80ce('0x3e'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x49a327+'.offset-cm_contacts.utcOffset\x20minute)',_0x80ce('0x27'),_0x80ce('0x28'),_0x37d028+'.'+_0x1c7d7c,_0x80ce('0x45'),'cm_contacts.updatedAt',_0x80ce('0x29'),_0x80ce('0x2a'),'\x22'+_0x34123c+'\x22'];var _0x17a88a=squel[_0x80ce('0x2b')]()[_0x80ce('0x3f')](_0x80ce('0x3a'))['fromQuery']([_0x80ce('0x12'),_0x80ce('0x2d'),_0x80ce('0x2e'),'ListId',_0x1c7d7c,_0x80ce('0x30'),'updatedAt',_0x80ce('0x46'),'UserId',_0x80ce('0x32')],squel[_0x80ce('0x10')]()[_0x80ce('0x33')](_0x18ccde)[_0x80ce('0x34')](_0x37d028)[_0x80ce('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x37d028+_0x80ce('0x36'))[_0x80ce('0x13')](_0xc149d2,null,_0xc149d2+'.id\x20=\x20'+_0x37d028+'.'+_0x1c7d7c)[_0x80ce('0x13')](_0x49a327,null,_0x49a327+'.id\x20=\x20'+_0x37d028+'.'+_0x1c7d7c)[_0x80ce('0x14')](_0x37d028+_0x80ce('0x37'),_0x39e9d5)[_0x80ce('0x14')](_0x80ce('0x38'),NOW)['where'](_0x80ce('0x39'),selectNotIn(_0x37d028,_0xc149d2,_0x1c7d7c,_0x80ce('0x3a'),[_0x80ce('0x3b'),_0x80ce('0x3c')]))[_0x80ce('0x14')](_0x80ce('0x39'),selectNotIn(_0x37d028,_0xc149d2,_0x1c7d7c,_0x80ce('0x3a'),[_0x80ce('0x3b')])))['toString']();return _0x17a88a;}function insertTzCmHopperBlack(_0x137741,_0x51908d,_0x3f174a,_0x537ab4){var _0x20e13c=[_0x80ce('0x3e'),_0x80ce('0x27'),_0x80ce('0x28'),_0x51908d+'.'+_0x537ab4,_0x80ce('0x45'),_0x80ce('0x47')];return squel[_0x80ce('0x2b')]()[_0x80ce('0x3f')](_0x80ce('0x40'))[_0x80ce('0x2c')]([_0x80ce('0x12'),_0x80ce('0x2e'),_0x80ce('0x2f'),_0x537ab4,_0x80ce('0x30'),_0x80ce('0x41')],squel[_0x80ce('0x10')]()[_0x80ce('0x33')](_0x20e13c)[_0x80ce('0x34')](_0x51908d)[_0x80ce('0x13')](_0x80ce('0x42'),null,_0x80ce('0x35')+_0x51908d+_0x80ce('0x36'))[_0x80ce('0x13')](_0x3f174a,null,_0x3f174a+_0x80ce('0x43')+_0x51908d+'.'+_0x537ab4)['where'](_0x51908d+'.CmListId\x20=\x20?',_0x137741)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x80ce('0x14')](_0x80ce('0x39'),squel[_0x80ce('0x10')]()[_0x80ce('0x11')](_0x80ce('0x12'))[_0x80ce('0x34')](_0x80ce('0x40'))[_0x80ce('0x14')](_0x80ce('0x44'),_0x137741)[_0x80ce('0x14')](_0x537ab4+'\x20=\x20'+_0x51908d+'.'+_0x537ab4)))[_0x80ce('0x3d')]();}function insertCmHopperAdditionalPhones(_0x1a02e9){var _0x1aeef0=[_0x80ce('0x48'),_0x80ce('0x49'),'cm_contact_has_items.OrderBy',_0x80ce('0x4a'),_0x80ce('0x4b')];return squel['insert']()[_0x80ce('0x3f')]('cm_hopper_additional_phones')['fromQuery']([_0x80ce('0x4c'),'phone','OrderBy',_0x80ce('0x30'),'updatedAt'],squel[_0x80ce('0x10')]()[_0x80ce('0x33')](_0x1aeef0)[_0x80ce('0x34')](_0x80ce('0x3a'))[_0x80ce('0x13')](_0x80ce('0x42'),null,_0x80ce('0x4d'))[_0x80ce('0x13')](_0x80ce('0x4e'),null,_0x80ce('0x4f'))['where'](_0x80ce('0x50'),_0x1a02e9)[_0x80ce('0x14')](_0x80ce('0x38'),NOW))[_0x80ce('0x3d')]();}function insertCmContact(_0x285280,_0x22f5f3,_0x3aee6b,_0xebbb44){var _0x221969=_['concat'](_[_0x80ce('0x51')](_0xebbb44),['ListId',_0x80ce('0x52'),'createdAt',_0x80ce('0x41'),_0x80ce('0x53')]);return squel[_0x80ce('0x2b')]()[_0x80ce('0x3f')](_0x80ce('0x42'))[_0x80ce('0x2c')](_0x221969,squel[_0x80ce('0x10')]()[_0x80ce('0x33')](_0x221969)[_0x80ce('0x34')](_0x22f5f3)['where']('('+_0x3aee6b[_0x80ce('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0x80ce('0x10')]()[_0x80ce('0x33')](_0x3aee6b)[_0x80ce('0x34')](_0x80ce('0x42'))['where']('ListId\x20=\x20?',_0x285280)[_0x80ce('0x14')](_0x80ce('0x54')))['where'](_0x80ce('0x55'),squel[_0x80ce('0x10')]()[_0x80ce('0x11')](_0x80ce('0x56'),_0x80ce('0x57'))[_0x80ce('0x34')](_0x22f5f3)[_0x80ce('0x58')](_0x3aee6b['join'](','))))[_0x80ce('0x3d')]();}function handleStop(){logger[_0x80ce('0x59')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4bb841){logger[_0x80ce('0x5a')](_0x4bb841[_0x80ce('0x5b')]);process[_0x80ce('0x5c')](0x1);}function handleError(_0x241e04,_0x50486f){stats['errors'][_0x80ce('0x1c')]({'name':_0x50486f[_0x80ce('0x5d')],'message':_0x50486f[_0x80ce('0x5b')],'row':_0x241e04});}function handleQuery(_0x32644a){logger[_0x80ce('0x59')](_0x32644a);return db[_0x80ce('0x5e')][_0x80ce('0x5f')](_0x32644a)[_0x80ce('0x60')](function(_0x46baed){results[_0x80ce('0x1c')](_0x46baed);})['catch'](function(_0xfca2da){logger['error'](_0xfca2da[_0x80ce('0x5b')]);});}function updateTzCampaigns(_0x5a810c){return new Promise(function(_0x4bad11,_0x7ddbb){var _0x153bbe=squel['select']()[_0x80ce('0x33')]([_0x80ce('0x61'),_0x80ce('0x62')])[_0x80ce('0x34')](_0x80ce('0x63'))[_0x80ce('0x13')](_0x80ce('0x64'),null,_0x80ce('0x65'))[_0x80ce('0x14')](_0x80ce('0x66')+_0x5a810c);db[_0x80ce('0x5e')][_0x80ce('0x5f')](_0x153bbe['toString']())[_0x80ce('0x60')](function(_0x3dc6d0){var _0x25a652=[];for(var _0x2f2a7b=0x0;_0x2f2a7b<_0x3dc6d0[_0x80ce('0x1b')];_0x2f2a7b++){_0x25a652['push'](getTimezoneData(_0x3dc6d0[_0x2f2a7b],tmp_campaigns));}BPromise[_0x80ce('0x1d')](_0x25a652)['then'](function(){_0x4bad11({'val':0x1});});})[_0x80ce('0x67')](function(_0x411e63){logger[_0x80ce('0x5a')](_0x411e63[_0x80ce('0x5b')]);_0x4bad11({'val':0x0});});});}function updateTzVoiceQueues(_0x1c2d56){return new Promise(function(_0x31fb00,_0x2ed52b){var _0x33af62=squel['select']()['fields']([_0x80ce('0x68'),'voice_queues.dialTimezone'])[_0x80ce('0x34')](_0x80ce('0x69'))[_0x80ce('0x13')](_0x80ce('0x6a'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x80ce('0x14')](_0x80ce('0x6b')+_0x1c2d56);db[_0x80ce('0x5e')]['query'](_0x33af62[_0x80ce('0x3d')]())[_0x80ce('0x60')](function(_0x1798fc){var _0x3f007a=[];for(var _0xdbf3c2=0x0;_0xdbf3c2<_0x1798fc[_0x80ce('0x1b')];_0xdbf3c2++){_0x3f007a['push'](getTimezoneData(_0x1798fc[_0xdbf3c2],tmp_voice_queues));}BPromise[_0x80ce('0x1d')](_0x3f007a)['then'](function(){_0x31fb00({'val':0x1});});})[_0x80ce('0x67')](function(_0x15802f){logger[_0x80ce('0x5a')](_0x15802f['message']);_0x31fb00({'val':0x0});});});}function getTimezoneData(_0x22ba91,_0x382fda){return new Promise(function(_0x5d1899,_0x4e19de){var _0x2d0083=shared[_0x80ce('0x6c')];var _0x1ece9a=_0x2d0083[_0x22ba91[_0x80ce('0x6d')]];if(_['isNil'](_0x1ece9a)){_0x5d1899({'ret':0x1});}else{var _0x56056b=_0x1ece9a[_0x80ce('0x6e')];var _0x28d687=squel['insert']()['into'](_0x382fda)[_0x80ce('0x6f')]('id',_0x22ba91['id'])['set'](_0x80ce('0x70'),_0x56056b)[_0x80ce('0x6f')](_0x80ce('0x6d'),_0x22ba91[_0x80ce('0x6d')])[_0x80ce('0x3d')]();return db[_0x80ce('0x5e')][_0x80ce('0x5f')](_0x28d687)[_0x80ce('0x60')](function(_0x4fe4d1){_0x5d1899({'ret':0x1});})[_0x80ce('0x67')](function(_0x3ba0c2){logger['error'](_0x3ba0c2['message']);_0x4e19de({'ret':0x1});});}});}function handleTZQuery(_0x26c2f2){logger[_0x80ce('0x59')](_0x26c2f2);return db['sequelize'][_0x80ce('0x5f')](_0x26c2f2)[_0x80ce('0x60')](function(_0x442d1f){})['catch'](function(_0x228a29){logger[_0x80ce('0x5a')](_0x228a29[_0x80ce('0x5b')]);});}function main(_0x5e771c,_0x41d79a,_0x5acf9f,_0x37d279){logger['info']('main',_0x5e771c,JSON[_0x80ce('0x71')](_0x41d79a));process[_0x80ce('0x72')](_0x80ce('0x73'));var _0x3f7b9e=_0x41d79a[_0x80ce('0x74')];var _0x3530e0=_['clone'](_0x3f7b9e);var _0x5cb458=_0x41d79a[_0x80ce('0x75')];var _0x182579=path['join'](config['root'],_0x80ce('0x76'),_0x5cb458+_0x80ce('0x77'));hasTZ=_['keys'](_0x3f7b9e)['includes']('dialTimezone');var _0x1f6bd4=_['keys'](_0x3f7b9e)['join']();logger[_0x80ce('0x59')]('header',_0x1f6bd4);db[_0x80ce('0x78')]['findAll']({'raw':!![],'attributes':['id','name']})[_0x80ce('0x1a')](function(_0x33cb25){for(var _0x23313d=0x0;_0x23313d<_0x33cb25[_0x80ce('0x1b')];_0x23313d++){if(_0x33cb25[_0x23313d][_0x80ce('0x79')]in _0x3f7b9e){contactItemTypes[_0x80ce('0x1c')](_0x33cb25[_0x23313d]);delete _0x3530e0[_0x33cb25[_0x23313d][_0x80ce('0x79')]];hasAdditionalPhones=!![];}for(var _0x10889e in _0x3f7b9e){if(_0x33cb25[_0x23313d][_0x80ce('0x79')]+_0x80ce('0x7a')===_0x10889e){phoneDescriptions['push']({'itemTypeId':_0x33cb25[_0x23313d]['id'],'description':_0x10889e});delete _0x3530e0[_0x10889e];}}}if(hasAdditionalPhones)_0x3530e0[_0x80ce('0x19')]='';var _0x4cca4f=_['keys'](_0x3530e0)[_0x80ce('0x13')]();logger[_0x80ce('0x59')](_0x80ce('0x7b'),_0x4cca4f);fs[_0x80ce('0x7c')](_0x182579,_0x4cca4f+'\x0a');Papa[_0x80ce('0x7d')](fs[_0x80ce('0x7e')](_0x5e771c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x9f2a0d,_0x20bc1a){try{for(var _0x2ecac3=0x0,_0x3755d0=[];_0x2ecac3<_0x9f2a0d['data'][_0x80ce('0x1b')];_0x2ecac3++){stats[_0x80ce('0x7f')]+=0x1;if(_0x9f2a0d[_0x80ce('0x80')][_0x2ecac3]){handleError(_0x9f2a0d['data'][_0x2ecac3],_0x9f2a0d['errors'][_0x2ecac3]);}else{var _0x11e39f=[];var _0x3c381d=[];var _0x3cb7e1={};for(var _0x2209e8 in _0x3f7b9e){let _0x51e676=contactItemTypes['find'](_0x4e9faf=>_0x4e9faf[_0x80ce('0x79')]===_0x2209e8);let _0xc0b6c5=contactItemTypes['find'](_0x417287=>_0x417287[_0x80ce('0x79')]+_0x80ce('0x7a')===_0x2209e8);if(_[_0x80ce('0x1e')](_0x51e676)&&_['isNil'](_0xc0b6c5)){if(_0x3f7b9e['hasOwnProperty'](_0x2209e8)){if(_0x9f2a0d[_0x80ce('0x81')][_0x2ecac3][_0x3f7b9e[_0x2209e8]]){var _0x1b066f=_[_0x80ce('0x82')](_0x9f2a0d[_0x80ce('0x81')][_0x2ecac3][_0x3f7b9e[_0x2209e8]][_0x80ce('0x83')](/"/g,'\x27'));switch(_0x2209e8){case _0x80ce('0x2d'):var _0xb9ece5=moment(_0x1b066f,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0xb9ece5['isValid']()){_0x3755d0[_0x80ce('0x1c')]('\x22'+_0x1b066f+'\x22');}else{_0x11e39f[_0x80ce('0x1c')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x80ce('0x46'):var _0x37eab3=parseInt(_0x1b066f);_0x1b066f=_['isNaN'](_0x37eab3)||_0x37eab3<0x0||_0x37eab3>0x4?_0x37d279?0x3:0x2:_0x37eab3;_0x3755d0[_0x80ce('0x1c')]('\x22'+_0x1b066f+'\x22');break;case _0x80ce('0x31'):var _0x17b78a=parseInt(_0x1b066f);if(_[_0x80ce('0x84')](_0x17b78a)&&_['includes'](_0x5acf9f,_0x17b78a)){_0x3755d0[_0x80ce('0x1c')]('\x22'+_0x17b78a+'\x22');}else{_0x11e39f[_0x80ce('0x1c')]('agent\x20not\x20exists');}break;case _0x80ce('0x85'):if(isEmail(_0x1b066f)){_0x3755d0[_0x80ce('0x1c')]('\x22'+_0x1b066f+'\x22');}else{_0x11e39f[_0x80ce('0x1c')]('email\x20wrong\x20format');}break;case _0x80ce('0x86'):var _0x3140b2=moment(_0x1b066f,_0x80ce('0x87'),!![]);if(_0x3140b2[_0x80ce('0x88')]()){_0x3755d0[_0x80ce('0x1c')]('\x22'+_0x1b066f+'\x22');}else{_0x11e39f['push'](_0x80ce('0x89'));}break;case _0x80ce('0x6d'):var _0x24ce94=shared[_0x80ce('0x6c')];var _0x1dae8a=_0x24ce94[_0x1b066f];if(!_['isNil'](_0x1dae8a)){var _0x28bb78=_0x1dae8a[_0x80ce('0x6e')];_0x3755d0[_0x80ce('0x1c')]('\x22'+_0x1b066f+'\x22');_0x3755d0['push']('\x22'+_0x28bb78+'\x22');}break;default:_0x3755d0['push']('\x22'+_0x1b066f+'\x22');}}else{switch(_0x2209e8){case _0x80ce('0x8a'):case _0x80ce('0x12'):_0x11e39f['push'](_0x2209e8+_0x80ce('0x8b'));break;default:_0x3755d0[_0x80ce('0x1c')]('\x22\x22');}}}}else{var _0x3994b9='';if(!_[_0x80ce('0x1e')](_0x51e676)){if(!_0x3cb7e1[_0x80ce('0x8c')](_0x51e676['id'])){if(!_[_0x80ce('0x1e')](_0x9f2a0d['data'][_0x2ecac3][_0x3f7b9e[_0x2209e8]])){var _0x1b066f=_[_0x80ce('0x82')](_0x9f2a0d[_0x80ce('0x81')][_0x2ecac3][_0x3f7b9e[_0x2209e8]][_0x80ce('0x83')](/"/g,'\x27'));var _0x5ea0d3=phoneDescriptions[_0x80ce('0x8d')](_0x4e4260=>_0x4e4260[_0x80ce('0x8e')]===_0x51e676['id']);if(!_[_0x80ce('0x1e')](_0x5ea0d3)){var _0x500ae8=_[_0x80ce('0x82')](_0x9f2a0d[_0x80ce('0x81')][_0x2ecac3][_0x3f7b9e[_0x5ea0d3['description']]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x500ae8))_0x1b066f=_0x1b066f+'§'+_0x500ae8;}if(_0x3994b9=='')_0x3994b9=_0x1b066f;else _0x3994b9+='|'+_0x1b066f;}_0x3c381d[_0x80ce('0x1c')](_0x51e676['id']+':'+_0x3994b9);_0x3cb7e1[_0x51e676['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3755d0[_0x80ce('0x1c')]('\x22'+_0x3c381d[_0x80ce('0x13')](';')+'\x22');}if(_0x11e39f[_0x80ce('0x1b')]){handleError(_0x9f2a0d[_0x80ce('0x81')][_0x2ecac3],{'code':'SystemRow','message':_0x11e39f[_0x80ce('0x13')]()});}else{fs[_0x80ce('0x8f')](_0x182579,_0x3755d0[_0x80ce('0x13')]()+'\x0a');}_0x3755d0=[];}if(!(stats['rows']%0xc8)){socket[_0x80ce('0x90')]('contact:import:'+_0x5cb458,stats);stats['errors']=[];}}if(stopped){logger[_0x80ce('0x59')](_0x80ce('0x91'));_0x20bc1a[_0x80ce('0x92')]();}}catch(_0x2fc14a){handleError(_0x9f2a0d[_0x80ce('0x81')][_0x2ecac3],{'code':_0x80ce('0x93'),'message':_0x2fc14a[_0x80ce('0x5b')]});logger['error']('step',_0x2fc14a['message']);}},'complete':function(){try{var _0x290da0=[];var _0x44116c=[];var _0x4f0ab9='cm_contacts';if(_0x41d79a['duplicates']&&_0x41d79a[_0x80ce('0x94')][_0x80ce('0x1b')]){_0x4f0ab9=_0x80ce('0x95')+_0x5cb458;_0x290da0[_0x80ce('0x1c')]('CREATE\x20TABLE\x20'+_0x4f0ab9+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x80ce('0x96')+_0x5cb458;tmp_voice_queues=_0x80ce('0x97')+_0x5cb458;_0x44116c['push']('CREATE\x20TABLE\x20'+tmp_campaigns+_0x80ce('0x98'));_0x44116c[_0x80ce('0x1c')](_0x80ce('0x99')+tmp_voice_queues+_0x80ce('0x98'));BPromise[_0x80ce('0x9a')](_0x44116c,handleTZQuery)[_0x80ce('0x1a')](function(_0x44a84f){updateTzCampaigns(_0x41d79a[_0x80ce('0x2f')])[_0x80ce('0x1a')](function(_0x1f29bc){updateTzVoiceQueues(_0x41d79a[_0x80ce('0x2f')])['then'](function(_0x3b1c94){if(hasTZ)_0x4cca4f=_0x4cca4f[_0x80ce('0x83')]('dialTimezone','dialTimezone,utcOffset');var _0x118dea=util['format'](_0x80ce('0x9b'),_0x182579,_0x4f0ab9,_0x4cca4f,_0x41d79a[_0x80ce('0x2f')],_0x41d79a[_0x80ce('0x52')]||null,NOW,NOW);if(_[_0x80ce('0x1e')](_0x3f7b9e[_0x80ce('0x2d')])){_0x118dea+=_0x80ce('0x9c');}_0x290da0[_0x80ce('0x1c')](_0x118dea);if(_0x41d79a[_0x80ce('0x94')]&&_0x41d79a[_0x80ce('0x94')][_0x80ce('0x1b')]){_0x290da0[_0x80ce('0x1c')](insertCmContact(_0x41d79a[_0x80ce('0x2f')],_0x4f0ab9,_0x41d79a[_0x80ce('0x94')],_0x3f7b9e));_0x290da0[_0x80ce('0x1c')](_0x80ce('0x9d')+_0x4f0ab9+';');}BPromise['each'](_0x290da0,handleQuery)[_0x80ce('0x1a')](function(_0x537276){BPromise[_0x80ce('0x1d')]([handleAdditionalPhones()])[_0x80ce('0x1a')](function(){_0x290da0=[];for(var _0xb73f21=0x0;_0xb73f21\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','then','length','all','AdditionalPhones','push','split','isNil','filter','CmContactHasItem','findOne','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','createdAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','toString','ContactId','ListId','updatedAt','fields','field','cm_hopper_black','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','UserId','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','Received\x20SIGINT','error','message','exit','errors','info','query','spread','catch','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','sequelize','timezones','dialTimezone','utcOffset','set','offset','main','start','binding','clone','socket_timestamp','root','.csv','keys','includes','header','ContactItemType','findAll','name','_description','parse','createReadStream','data','rows','find','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)'];(function(_0xfd6596,_0xedb962){var _0x5a7e15=function(_0x1c96e3){while(--_0x1c96e3){_0xfd6596['push'](_0xfd6596['shift']());}};_0x5a7e15(++_0xedb962);}(_0x4792,0x1a0));var _0x2479=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x4792[_0x4ae829];return _0x256b31;};'use strict';var fs=require('fs');var path=require(_0x2479('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0x2479('0x1'));var BPromise=require(_0x2479('0x2'));var moment=require(_0x2479('0x3'));var squel=require(_0x2479('0x4'));var Redis=require(_0x2479('0x5'));var db=require(_0x2479('0x6'))['db'];var config=require('../../../config/environment');var shared=require(_0x2479('0x7'));var logger=require(_0x2479('0x8'))(_0x2479('0x9'));config['redis']=_['defaults'](config[_0x2479('0xa')],{'host':_0x2479('0xb'),'port':0x18eb});var socket=require(_0x2479('0xc'))(new Redis(config[_0x2479('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x2479('0xd')](_0x2479('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x2479('0xd')](_0x2479('0xe'));function isEmail(_0x33b898){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))*$/[_0x2479('0xf')](_0x33b898);}function selectNotIn(_0x45c81e,_0x2501b2,_0x543e63,_0x58f35b,_0x4b99ae){return squel[_0x2479('0x10')]()['field'](_0x2479('0x11'))[_0x2479('0x12')](_0x58f35b)['join'](_0x2501b2,null,_0x2501b2+_0x2479('0x13')+_0x58f35b+'.'+_0x543e63)[_0x2479('0x14')](_0x58f35b+'.'+_0x543e63+'\x20=\x20'+_0x45c81e+'.'+_0x543e63)[_0x2479('0x14')](_0x2501b2+_0x2479('0x15')+_0x4b99ae[_0x2479('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x152c35,_0x3fff45){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x2479('0x17')](function(_0x7f243c){if(_0x7f243c!==null){var _0x3718c4=[];for(var _0x5daa5c=0x0;_0x5daa5c<_0x7f243c[_0x2479('0x18')];_0x5daa5c++){var _0x176f68=_0x7f243c[_0x5daa5c];_0x3718c4['push'](insertAdditionalPhones(_0x176f68));}}Promise[_0x2479('0x19')](_0x3718c4)[_0x2479('0x17')](function(){_0x152c35({'val':0x1});});});});}function insertAdditionalPhones(_0x4e95be){return new Promise(function(_0x190dbd,_0x2858d8){var _0x26a834=_0x4e95be[_0x2479('0x1a')];var _0x2835d7=_0x26a834['split'](';');var _0x36cdaf=[];orderBy=0x0;for(var _0xd863c8=0x0;_0xd863c8<_0x2835d7[_0x2479('0x18')];_0xd863c8++){_0x36cdaf[_0x2479('0x1b')](splitAdditionalPhone(_0x4e95be['id'],_0x2835d7[_0xd863c8]));}Promise['all'](_0x36cdaf)['then'](function(){_0x190dbd({'val':_0x2835d7['length']});});});}function splitAdditionalPhone(_0x29cf7c,_0x3d191e){return new Promise(function(_0xecc544,_0x395de5){var _0x53eb01=_0x3d191e[_0x2479('0x1c')](':');var _0x460118=_0x53eb01[0x0];var _0x2d3a2f=_0x53eb01[0x1];if(!_[_0x2479('0x1d')](_0x2d3a2f)){var _0x9c71b8=_0x2d3a2f[_0x2479('0x1c')]('|');var _0x336eb0=[];for(var _0x5be9c5=0x0;_0x5be9c5<_0x9c71b8['length'];_0x5be9c5++){if(_0x9c71b8[_0x5be9c5]!==''){var _0x22e142=_[_0x2479('0x1e')](promisesAdditionalPhones,{'contactId':_0x29cf7c,'phone':_0x9c71b8[_0x5be9c5]});if(_0x22e142[_0x2479('0x18')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x29cf7c,'contactTypeId':_0x460118,'phone':_0x9c71b8[_0x5be9c5],'orderBy':orderBy});}}}_0xecc544({'ok':0x1});}else _0xecc544({'res':0x0});});}function createAdditionalPhone(_0x22c49b,_0x4e3d4c,_0x471cdc,_0x4dbe3d){var _0x3436b5='';var _0x3f89d8='';var _0xe67b99=_0x471cdc[_0x2479('0x1c')]('§');_0x3436b5=_0xe67b99[0x0];if(_0xe67b99[_0x2479('0x18')]==0x2)_0x3f89d8=_0xe67b99[0x1];return new Promise(function(_0x3c4a59,_0x432c58){return db[_0x2479('0x1f')][_0x2479('0x20')]({'where':{'CmContactId':_0x22c49b,'item':_0x3436b5}})['then'](function(_0xbe31a2){if(_0xbe31a2){return db[_0x2479('0x1f')][_0x2479('0x21')]({'ItemTypeId':_0x4e3d4c,'description':_0x3f89d8,'OrderBy':_0x4dbe3d},{'where':{'CmContactId':_0x22c49b,'item':_0x3436b5}})[_0x2479('0x17')](function(_0x40f29a){_0x3c4a59({'res':'updated'});});}else{return db[_0x2479('0x1f')][_0x2479('0x22')]({'CmContactId':_0x22c49b,'item':_0x3436b5,'description':_0x3f89d8,'ItemTypeId':_0x4e3d4c,'OrderBy':_0x4dbe3d,'ItemClass':_0x2479('0x23')})[_0x2479('0x17')](function(_0x3eb207){_0x3c4a59({'res':_0x2479('0x24')});});}});});}function insertCmHopper(_0x677658,_0x4f02b5,_0x599abb,_0x22577e,_0x34c30a){var _0x5b21ba=[_0x2479('0x25'),'cm_contacts.scheduledat',_0x2479('0x26'),_0x2479('0x27'),_0x4f02b5+'.'+_0x22577e,_0x2479('0x28'),_0x2479('0x29'),_0x2479('0x2a'),_0x2479('0x2b'),'\x22'+_0x34c30a+'\x22'];return squel[_0x2479('0x2c')]()[_0x2479('0x2d')]('cm_hopper')[_0x2479('0x2e')]([_0x2479('0x11'),_0x2479('0x2f'),'ContactId','ListId',_0x22577e,_0x2479('0x30'),'updatedAt',_0x2479('0x31'),'UserId',_0x2479('0x32')],squel[_0x2479('0x10')]()['fields'](_0x5b21ba)[_0x2479('0x12')](_0x4f02b5)[_0x2479('0x16')](_0x2479('0x33'),null,_0x2479('0x34')+_0x4f02b5+_0x2479('0x35'))['join'](_0x599abb,null,_0x599abb+'.id\x20=\x20'+_0x4f02b5+'.'+_0x22577e)['where'](_0x4f02b5+_0x2479('0x36'),_0x677658)[_0x2479('0x14')](_0x2479('0x37'),NOW)[_0x2479('0x14')](_0x2479('0x38'),selectNotIn(_0x4f02b5,_0x599abb,_0x22577e,'cm_hopper',['\x22always\x22','\x22onlyIfOpen\x22']))['where'](_0x2479('0x38'),selectNotIn(_0x4f02b5,_0x599abb,_0x22577e,_0x2479('0x39'),[_0x2479('0x3a')])))[_0x2479('0x3b')]();}function insertCmHopperBlack(_0x4f166e,_0x27ec22,_0x37644d,_0x5921e3){var _0x133d4c=[_0x2479('0x25'),_0x2479('0x26'),'cm_contacts.ListId',_0x27ec22+'.'+_0x5921e3,_0x2479('0x28'),_0x2479('0x29')];return squel[_0x2479('0x2c')]()['into']('cm_hopper_black')[_0x2479('0x2e')]([_0x2479('0x11'),_0x2479('0x3c'),_0x2479('0x3d'),_0x5921e3,_0x2479('0x30'),_0x2479('0x3e')],squel['select']()[_0x2479('0x3f')](_0x133d4c)[_0x2479('0x12')](_0x27ec22)[_0x2479('0x16')](_0x2479('0x33'),null,_0x2479('0x34')+_0x27ec22+'.CmListId')[_0x2479('0x16')](_0x37644d,null,_0x37644d+_0x2479('0x13')+_0x27ec22+'.'+_0x5921e3)[_0x2479('0x14')](_0x27ec22+_0x2479('0x36'),_0x4f166e)[_0x2479('0x14')](_0x2479('0x37'),NOW)[_0x2479('0x14')](_0x2479('0x38'),squel[_0x2479('0x10')]()[_0x2479('0x40')](_0x2479('0x11'))[_0x2479('0x12')](_0x2479('0x41'))['where']('ListId\x20=\x20?',_0x4f166e)[_0x2479('0x14')](_0x5921e3+_0x2479('0x42')+_0x27ec22+'.'+_0x5921e3)))['toString']();}function insertTzCmHopper(_0x5f1361,_0x5b0ccc,_0x471f40,_0x2334bd,_0x27fcd5,_0x560da7){var _0x4e0211=[_0x2479('0x25'),_0x2479('0x43')+_0x560da7+_0x2479('0x44'),_0x2479('0x26'),_0x2479('0x27'),_0x5b0ccc+'.'+_0x2334bd,_0x2479('0x28'),_0x2479('0x29'),'cm_contacts.priority',_0x2479('0x2b'),'\x22'+_0x27fcd5+'\x22'];var _0x1db780=squel[_0x2479('0x2c')]()[_0x2479('0x2d')](_0x2479('0x39'))['fromQuery'](['phone',_0x2479('0x2f'),'ContactId',_0x2479('0x3d'),_0x2334bd,_0x2479('0x30'),_0x2479('0x3e'),'priority',_0x2479('0x45'),_0x2479('0x32')],squel['select']()[_0x2479('0x3f')](_0x4e0211)[_0x2479('0x12')](_0x5b0ccc)[_0x2479('0x16')]('cm_contacts',null,_0x2479('0x34')+_0x5b0ccc+_0x2479('0x35'))[_0x2479('0x16')](_0x471f40,null,_0x471f40+_0x2479('0x13')+_0x5b0ccc+'.'+_0x2334bd)[_0x2479('0x16')](_0x560da7,null,_0x560da7+_0x2479('0x13')+_0x5b0ccc+'.'+_0x2334bd)[_0x2479('0x14')](_0x5b0ccc+_0x2479('0x36'),_0x5f1361)['where'](_0x2479('0x37'),NOW)[_0x2479('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5b0ccc,_0x471f40,_0x2334bd,_0x2479('0x39'),[_0x2479('0x3a'),'\x22onlyIfOpen\x22']))[_0x2479('0x14')](_0x2479('0x38'),selectNotIn(_0x5b0ccc,_0x471f40,_0x2334bd,_0x2479('0x39'),['\x22always\x22'])))[_0x2479('0x3b')]();return _0x1db780;}function insertTzCmHopperBlack(_0xea284b,_0x42929f,_0x5b9e49,_0x58d73a){var _0x3418ac=['cm_contacts.phone',_0x2479('0x26'),'cm_contacts.ListId',_0x42929f+'.'+_0x58d73a,'cm_contacts.createdAt',_0x2479('0x29')];return squel['insert']()[_0x2479('0x2d')](_0x2479('0x41'))[_0x2479('0x2e')]([_0x2479('0x11'),_0x2479('0x3c'),'ListId',_0x58d73a,_0x2479('0x30'),_0x2479('0x3e')],squel['select']()[_0x2479('0x3f')](_0x3418ac)[_0x2479('0x12')](_0x42929f)['join'](_0x2479('0x33'),null,_0x2479('0x34')+_0x42929f+'.CmListId')['join'](_0x5b9e49,null,_0x5b9e49+'.id\x20=\x20'+_0x42929f+'.'+_0x58d73a)[_0x2479('0x14')](_0x42929f+_0x2479('0x36'),_0xea284b)['where'](_0x2479('0x37'),NOW)[_0x2479('0x14')](_0x2479('0x38'),squel[_0x2479('0x10')]()['field'](_0x2479('0x11'))['from']('cm_hopper_black')[_0x2479('0x14')]('ListId\x20=\x20?',_0xea284b)[_0x2479('0x14')](_0x58d73a+_0x2479('0x42')+_0x42929f+'.'+_0x58d73a)))[_0x2479('0x3b')]();}function insertCmHopperAdditionalPhones(_0x1f6791){var _0x28961f=['cm_hopper.id',_0x2479('0x46'),_0x2479('0x47'),'cm_contact_has_items.createdAt',_0x2479('0x48')];return squel[_0x2479('0x2c')]()[_0x2479('0x2d')]('cm_hopper_additional_phones')[_0x2479('0x2e')]([_0x2479('0x49'),_0x2479('0x11'),'OrderBy',_0x2479('0x30'),_0x2479('0x3e')],squel[_0x2479('0x10')]()['fields'](_0x28961f)['from']('cm_hopper')['join'](_0x2479('0x33'),null,_0x2479('0x4a'))['join'](_0x2479('0x4b'),null,_0x2479('0x4c'))[_0x2479('0x14')](_0x2479('0x4d'),_0x1f6791)[_0x2479('0x14')](_0x2479('0x37'),NOW))[_0x2479('0x3b')]();}function insertCmContact(_0x581a2e,_0x3ffe18,_0x3dd407,_0x25238a){var _0x4e97fa=_[_0x2479('0x4e')](_['keys'](_0x25238a),[_0x2479('0x3d'),_0x2479('0x4f'),_0x2479('0x30'),_0x2479('0x3e'),_0x2479('0x50')]);return squel['insert']()[_0x2479('0x2d')](_0x2479('0x33'))[_0x2479('0x2e')](_0x4e97fa,squel[_0x2479('0x10')]()[_0x2479('0x3f')](_0x4e97fa)[_0x2479('0x12')](_0x3ffe18)[_0x2479('0x14')]('('+_0x3dd407['join'](',')+_0x2479('0x51'),squel['select']()[_0x2479('0x3f')](_0x3dd407)[_0x2479('0x12')](_0x2479('0x33'))[_0x2479('0x14')](_0x2479('0x52'),_0x581a2e)[_0x2479('0x14')](_0x2479('0x53')))[_0x2479('0x14')](_0x2479('0x54'),squel[_0x2479('0x10')]()[_0x2479('0x40')](_0x2479('0x55'),'min_id')[_0x2479('0x12')](_0x3ffe18)[_0x2479('0x56')](_0x3dd407[_0x2479('0x16')](','))))[_0x2479('0x3b')]();}function handleStop(){logger['info'](_0x2479('0x57'));stopped=!![];}function handleUncaughtException(_0x314b1f){logger[_0x2479('0x58')](_0x314b1f[_0x2479('0x59')]);process[_0x2479('0x5a')](0x1);}function handleError(_0xfb748d,_0x535f2e){stats[_0x2479('0x5b')][_0x2479('0x1b')]({'name':_0x535f2e['code'],'message':_0x535f2e[_0x2479('0x59')],'row':_0xfb748d});}function handleQuery(_0x27763f){logger[_0x2479('0x5c')](_0x27763f);return db['sequelize'][_0x2479('0x5d')](_0x27763f)[_0x2479('0x5e')](function(_0x34035a){results['push'](_0x34035a);})[_0x2479('0x5f')](function(_0x524163){logger[_0x2479('0x58')](_0x524163[_0x2479('0x59')]);});}function updateTzCampaigns(_0x16884a){return new Promise(function(_0x4a5ca9,_0x58fda0){var _0x5aed79=squel[_0x2479('0x10')]()[_0x2479('0x3f')](['campaigns.id',_0x2479('0x60')])[_0x2479('0x12')](_0x2479('0x61'))[_0x2479('0x16')](_0x2479('0x62'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x2479('0x14')](_0x2479('0x63')+_0x16884a);db['sequelize'][_0x2479('0x5d')](_0x5aed79[_0x2479('0x3b')]())[_0x2479('0x5e')](function(_0x3be1c1){var _0x58486e=[];for(var _0x2044c2=0x0;_0x2044c2<_0x3be1c1['length'];_0x2044c2++){_0x58486e[_0x2479('0x1b')](getTimezoneData(_0x3be1c1[_0x2044c2],tmp_campaigns));}BPromise['all'](_0x58486e)['then'](function(){_0x4a5ca9({'val':0x1});});})['catch'](function(_0x112c3e){logger[_0x2479('0x58')](_0x112c3e[_0x2479('0x59')]);_0x4a5ca9({'val':0x0});});});}function updateTzVoiceQueues(_0xa20d64){return new Promise(function(_0x553eec,_0x5c5cdc){var _0x22996f=squel[_0x2479('0x10')]()[_0x2479('0x3f')]([_0x2479('0x64'),_0x2479('0x65')])[_0x2479('0x12')](_0x2479('0x66'))[_0x2479('0x16')]('voice_queues_has_cm_lists',null,_0x2479('0x67'))[_0x2479('0x14')](_0x2479('0x68')+_0xa20d64);db[_0x2479('0x69')][_0x2479('0x5d')](_0x22996f[_0x2479('0x3b')]())[_0x2479('0x5e')](function(_0x52f4fe){var _0x4882f5=[];for(var _0x501248=0x0;_0x501248<_0x52f4fe['length'];_0x501248++){_0x4882f5[_0x2479('0x1b')](getTimezoneData(_0x52f4fe[_0x501248],tmp_voice_queues));}BPromise[_0x2479('0x19')](_0x4882f5)[_0x2479('0x17')](function(){_0x553eec({'val':0x1});});})[_0x2479('0x5f')](function(_0x56bf47){logger[_0x2479('0x58')](_0x56bf47[_0x2479('0x59')]);_0x553eec({'val':0x0});});});}function getTimezoneData(_0x59a6a8,_0x4a34c1){return new Promise(function(_0x18cec0,_0x412a30){var _0x85e609=shared[_0x2479('0x6a')];var _0x294914=_0x85e609[_0x59a6a8[_0x2479('0x6b')]];if(_[_0x2479('0x1d')](_0x294914)){_0x18cec0({'ret':0x1});}else{var _0x1b7e6b=_0x294914[_0x2479('0x6c')];var _0x30f63c=squel[_0x2479('0x2c')]()['into'](_0x4a34c1)[_0x2479('0x6d')]('id',_0x59a6a8['id'])[_0x2479('0x6d')](_0x2479('0x6e'),_0x1b7e6b)[_0x2479('0x6d')](_0x2479('0x6b'),_0x59a6a8[_0x2479('0x6b')])[_0x2479('0x3b')]();return db[_0x2479('0x69')][_0x2479('0x5d')](_0x30f63c)[_0x2479('0x5e')](function(_0x5908f7){_0x18cec0({'ret':0x1});})['catch'](function(_0x31fed6){logger[_0x2479('0x58')](_0x31fed6[_0x2479('0x59')]);_0x412a30({'ret':0x1});});}});}function handleTZQuery(_0x41ef26){logger[_0x2479('0x5c')](_0x41ef26);return db[_0x2479('0x69')][_0x2479('0x5d')](_0x41ef26)[_0x2479('0x5e')](function(_0x129e36){})[_0x2479('0x5f')](function(_0xe1efd9){logger[_0x2479('0x58')](_0xe1efd9[_0x2479('0x59')]);});}function main(_0x1e9c8,_0x1cba00,_0x4be26d,_0x5620ca){logger[_0x2479('0x5c')](_0x2479('0x6f'),_0x1e9c8,JSON['stringify'](_0x1cba00));process['send'](_0x2479('0x70'));var _0x5d0f2b=_0x1cba00[_0x2479('0x71')];var _0x384e6c=_[_0x2479('0x72')](_0x5d0f2b);var _0x2fc12a=_0x1cba00[_0x2479('0x73')];var _0x46989d=path['join'](config[_0x2479('0x74')],'server/files/tmp',_0x2fc12a+_0x2479('0x75'));hasTZ=_[_0x2479('0x76')](_0x5d0f2b)[_0x2479('0x77')]('dialTimezone');var _0x24b434=_[_0x2479('0x76')](_0x5d0f2b)['join']();logger[_0x2479('0x5c')](_0x2479('0x78'),_0x24b434);db[_0x2479('0x79')][_0x2479('0x7a')]({'raw':!![],'attributes':['id','name']})[_0x2479('0x17')](function(_0x2e727e){for(var _0x142fab=0x0;_0x142fab<_0x2e727e[_0x2479('0x18')];_0x142fab++){if(_0x2e727e[_0x142fab][_0x2479('0x7b')]in _0x5d0f2b){contactItemTypes[_0x2479('0x1b')](_0x2e727e[_0x142fab]);delete _0x384e6c[_0x2e727e[_0x142fab]['name']];hasAdditionalPhones=!![];}for(var _0x272ae9 in _0x5d0f2b){if(_0x2e727e[_0x142fab][_0x2479('0x7b')]+_0x2479('0x7c')===_0x272ae9){phoneDescriptions['push']({'itemTypeId':_0x2e727e[_0x142fab]['id'],'description':_0x272ae9});delete _0x384e6c[_0x272ae9];}}}if(hasAdditionalPhones)_0x384e6c['AdditionalPhones']='';var _0x50daf2=_[_0x2479('0x76')](_0x384e6c)[_0x2479('0x16')]();logger[_0x2479('0x5c')](_0x2479('0x78'),_0x50daf2);fs['writeFileSync'](_0x46989d,_0x50daf2+'\x0a');Papa[_0x2479('0x7d')](fs[_0x2479('0x7e')](_0x1e9c8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x71a539,_0x3922e){try{for(var _0x3631de=0x0,_0x42a654=[];_0x3631de<_0x71a539[_0x2479('0x7f')][_0x2479('0x18')];_0x3631de++){stats[_0x2479('0x80')]+=0x1;if(_0x71a539[_0x2479('0x5b')][_0x3631de]){handleError(_0x71a539[_0x2479('0x7f')][_0x3631de],_0x71a539[_0x2479('0x5b')][_0x3631de]);}else{var _0x1c69f4=[];var _0x1eb0a5=[];var _0x1925bf={};for(var _0x53a157 in _0x5d0f2b){let _0x333a2c=contactItemTypes['find'](_0x28ece6=>_0x28ece6[_0x2479('0x7b')]===_0x53a157);let _0x407932=contactItemTypes[_0x2479('0x81')](_0x11786d=>_0x11786d[_0x2479('0x7b')]+'_description'===_0x53a157);if(_[_0x2479('0x1d')](_0x333a2c)&&_[_0x2479('0x1d')](_0x407932)){if(_0x5d0f2b['hasOwnProperty'](_0x53a157)){if(_0x71a539[_0x2479('0x7f')][_0x3631de][_0x5d0f2b[_0x53a157]]){var _0x5f4abf=_[_0x2479('0x82')](_0x71a539['data'][_0x3631de][_0x5d0f2b[_0x53a157]]['replace'](/"/g,'\x27'));switch(_0x53a157){case _0x2479('0x2f'):var _0x196432=moment(_0x5f4abf,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x196432[_0x2479('0x83')]()){_0x42a654[_0x2479('0x1b')]('\x22'+_0x5f4abf+'\x22');}else{_0x1c69f4['push'](_0x2479('0x84'));}break;case'priority':var _0x21c985=parseInt(_0x5f4abf);_0x5f4abf=_[_0x2479('0x85')](_0x21c985)||_0x21c985<0x0||_0x21c985>0x4?_0x5620ca?0x3:0x2:_0x21c985;_0x42a654[_0x2479('0x1b')]('\x22'+_0x5f4abf+'\x22');break;case _0x2479('0x45'):var _0x36dab1=parseInt(_0x5f4abf);if(_['isNumber'](_0x36dab1)&&_['includes'](_0x4be26d,_0x36dab1)){_0x42a654[_0x2479('0x1b')]('\x22'+_0x36dab1+'\x22');}else{_0x1c69f4[_0x2479('0x1b')](_0x2479('0x86'));}break;case'email':if(isEmail(_0x5f4abf)){_0x42a654[_0x2479('0x1b')]('\x22'+_0x5f4abf+'\x22');}else{_0x1c69f4[_0x2479('0x1b')](_0x2479('0x87'));}break;case'dateOfBirth':var _0x38036e=moment(_0x5f4abf,_0x2479('0x88'),!![]);if(_0x38036e['isValid']()){_0x42a654[_0x2479('0x1b')]('\x22'+_0x5f4abf+'\x22');}else{_0x1c69f4[_0x2479('0x1b')](_0x2479('0x89'));}break;case _0x2479('0x6b'):var _0x29b47d=shared[_0x2479('0x6a')];var _0x910075=_0x29b47d[_0x5f4abf];if(!_[_0x2479('0x1d')](_0x910075)){var _0x4232b7=_0x910075[_0x2479('0x6c')];_0x42a654[_0x2479('0x1b')]('\x22'+_0x5f4abf+'\x22');_0x42a654[_0x2479('0x1b')]('\x22'+_0x4232b7+'\x22');}break;default:_0x42a654[_0x2479('0x1b')]('\x22'+_0x5f4abf+'\x22');}}else{switch(_0x53a157){case _0x2479('0x8a'):case'phone':_0x1c69f4['push'](_0x53a157+_0x2479('0x8b'));break;default:_0x42a654[_0x2479('0x1b')]('\x22\x22');}}}}else{var _0x108488='';if(!_[_0x2479('0x1d')](_0x333a2c)){if(!_0x1925bf['hasOwnProperty'](_0x333a2c['id'])){if(!_[_0x2479('0x1d')](_0x71a539['data'][_0x3631de][_0x5d0f2b[_0x53a157]])){var _0x5f4abf=_['trim'](_0x71a539[_0x2479('0x7f')][_0x3631de][_0x5d0f2b[_0x53a157]]['replace'](/"/g,'\x27'));var _0x29b326=phoneDescriptions[_0x2479('0x81')](_0x5a88f1=>_0x5a88f1[_0x2479('0x8c')]===_0x333a2c['id']);if(!_[_0x2479('0x1d')](_0x29b326)){var _0x45116d=_['trim'](_0x71a539['data'][_0x3631de][_0x5d0f2b[_0x29b326[_0x2479('0x8d')]]][_0x2479('0x8e')](/"/g,'\x27'));if(!_[_0x2479('0x1d')](_0x45116d))_0x5f4abf=_0x5f4abf+'§'+_0x45116d;}if(_0x108488=='')_0x108488=_0x5f4abf;else _0x108488+='|'+_0x5f4abf;}_0x1eb0a5[_0x2479('0x1b')](_0x333a2c['id']+':'+_0x108488);_0x1925bf[_0x333a2c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x42a654[_0x2479('0x1b')]('\x22'+_0x1eb0a5[_0x2479('0x16')](';')+'\x22');}if(_0x1c69f4[_0x2479('0x18')]){handleError(_0x71a539[_0x2479('0x7f')][_0x3631de],{'code':_0x2479('0x8f'),'message':_0x1c69f4[_0x2479('0x16')]()});}else{fs['appendFileSync'](_0x46989d,_0x42a654[_0x2479('0x16')]()+'\x0a');}_0x42a654=[];}if(!(stats[_0x2479('0x80')]%0xc8)){socket[_0x2479('0x90')](_0x2479('0x91')+_0x2fc12a,stats);stats[_0x2479('0x5b')]=[];}}if(stopped){logger[_0x2479('0x5c')](_0x2479('0x92'));_0x3922e[_0x2479('0x93')]();}}catch(_0x327546){handleError(_0x71a539['data'][_0x3631de],{'code':'SystemError','message':_0x327546[_0x2479('0x59')]});logger[_0x2479('0x58')]('step',_0x327546[_0x2479('0x59')]);}},'complete':function(){try{var _0x3bf2ee=[];var _0x1e81d8=[];var _0x352910='cm_contacts';if(_0x1cba00[_0x2479('0x94')]&&_0x1cba00['duplicates'][_0x2479('0x18')]){_0x352910=_0x2479('0x95')+_0x2fc12a;_0x3bf2ee[_0x2479('0x1b')]('CREATE\x20TABLE\x20'+_0x352910+_0x2479('0x96'));}tmp_campaigns=_0x2479('0x97')+_0x2fc12a;tmp_voice_queues=_0x2479('0x98')+_0x2fc12a;_0x1e81d8[_0x2479('0x1b')](_0x2479('0x99')+tmp_campaigns+_0x2479('0x9a'));_0x1e81d8[_0x2479('0x1b')](_0x2479('0x99')+tmp_voice_queues+_0x2479('0x9a'));BPromise[_0x2479('0x9b')](_0x1e81d8,handleTZQuery)['then'](function(_0x22a319){updateTzCampaigns(_0x1cba00[_0x2479('0x3d')])['then'](function(_0x13f92a){updateTzVoiceQueues(_0x1cba00[_0x2479('0x3d')])[_0x2479('0x17')](function(_0x1e56f2){if(hasTZ)_0x50daf2=_0x50daf2['replace'](_0x2479('0x6b'),_0x2479('0x9c'));var _0x6e31f6=util[_0x2479('0xd')]('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',_0x46989d,_0x352910,_0x50daf2,_0x1cba00[_0x2479('0x3d')],_0x1cba00[_0x2479('0x4f')]||null,NOW,NOW);if(_[_0x2479('0x1d')](_0x5d0f2b['scheduledat'])){_0x6e31f6+=_0x2479('0x9d');}_0x3bf2ee[_0x2479('0x1b')](_0x6e31f6);if(_0x1cba00[_0x2479('0x94')]&&_0x1cba00['duplicates'][_0x2479('0x18')]){_0x3bf2ee[_0x2479('0x1b')](insertCmContact(_0x1cba00[_0x2479('0x3d')],_0x352910,_0x1cba00[_0x2479('0x94')],_0x5d0f2b));_0x3bf2ee['push'](_0x2479('0x9e')+_0x352910+';');}BPromise[_0x2479('0x9b')](_0x3bf2ee,handleQuery)[_0x2479('0x17')](function(_0x2c2c48){BPromise[_0x2479('0x19')]([handleAdditionalPhones()])[_0x2479('0x17')](function(){_0x3bf2ee=[];for(var _0x1558c1=0x0;_0x1558c1\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','SIGINT','path','lodash','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','where','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','message','split','filter','CmContactHasItem','findOne','updated','create','PHONE','CmContact','CmHopper','update','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','from','cm_contacts','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_contacts.updatedAt','insert','cm_hopper_black','cm_contacts.ListId\x20=\x20','.CmListId','\x20=\x20?','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','exit','errors','code','catch','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','findAll','name','_description','header','writeFileSync','createReadStream','data','rows'];(function(_0x57f820,_0x162990){var _0x3637d9=function(_0x33eb7c){while(--_0x33eb7c){_0x57f820['push'](_0x57f820['shift']());}};_0x3637d9(++_0x162990);}(_0xdd6a,0x15d));var _0xadd6=function(_0x38d2a5,_0x3e4915){_0x38d2a5=_0x38d2a5-0x0;var _0x4d0941=_0xdd6a[_0x38d2a5];return _0x4d0941;};'use strict';var fs=require('fs');var path=require(_0xadd6('0x0'));var _=require(_0xadd6('0x1'));var Papa=require('papaparse');var util=require(_0xadd6('0x2'));var BPromise=require(_0xadd6('0x3'));var moment=require(_0xadd6('0x4'));var squel=require(_0xadd6('0x5'));var Redis=require('ioredis');var db=require(_0xadd6('0x6'))['db'];var config=require(_0xadd6('0x7'));var logger=require(_0xadd6('0x8'))(_0xadd6('0x9'));config[_0xadd6('0xa')]=_[_0xadd6('0xb')](config['redis'],{'host':_0xadd6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xadd6('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xadd6('0xd')](_0xadd6('0xe'));var tempTableName='cm_contacts_temp_'+moment()[_0xadd6('0xd')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2fdd60){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))*$/[_0xadd6('0xf')](_0x2fdd60);}function selectNotIn(_0x30c884,_0x1b27be,_0x307fce,_0x124a92,_0x4f9c25){return squel[_0xadd6('0x10')]()[_0xadd6('0x11')](_0xadd6('0x12'))['from'](_0x124a92)['join'](_0x1b27be,null,_0x1b27be+'.id\x20=\x20'+_0x124a92+'.'+_0x307fce)['where'](_0x124a92+'.'+_0x307fce+'\x20=\x20'+_0x30c884+'.'+_0x307fce)[_0xadd6('0x13')](_0x1b27be+_0xadd6('0x14')+_0x4f9c25[_0xadd6('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x132c4d,_0x5be9e0){promisesAdditionalPhones=[];promisesContact=[];return db[_0xadd6('0x16')]['query'](_0xadd6('0x17')+tempTableName)[_0xadd6('0x18')](function(_0x54ee9b){if(_0x54ee9b!==null){var _0x274a71=[];for(var _0x5a3577=0x0;_0x5a3577<_0x54ee9b[_0xadd6('0x19')];_0x5a3577++){var _0x5e0a4d=_0x54ee9b[_0x5a3577];if(!_['isNil'](_0x5e0a4d[_0xadd6('0x12')])){if(!_[_0xadd6('0x1a')](_0x5e0a4d[_0xadd6('0x1b')]))_0x274a71[_0xadd6('0x1c')](insertAdditionalPhones(_0x5e0a4d));promisesContact['push']({'contact':_0x5e0a4d});}}}Promise[_0xadd6('0x1d')](_0x274a71)[_0xadd6('0x1e')](function(){_0x132c4d({'val':0x1});});})['catch'](function(_0x329644){logger['error'](_0x329644[_0xadd6('0x1f')]);});});}function insertAdditionalPhones(_0x36d162){return new Promise(function(_0xc197a1,_0x381b06){var _0x5797a4=_0x36d162[_0xadd6('0x1b')];if(_[_0xadd6('0x1a')](_0x5797a4))_0x381b06({'val':0x0});else{var _0x11c155=_0x5797a4[_0xadd6('0x20')](';');var _0x1d08fc=[];orderBy=0x0;for(var _0x46ab76=0x0;_0x46ab76<_0x11c155[_0xadd6('0x19')];_0x46ab76++){_0x1d08fc[_0xadd6('0x1c')](splitAdditionalPhone(_0x36d162['id'],_0x11c155[_0x46ab76]));}Promise[_0xadd6('0x1d')](_0x1d08fc)[_0xadd6('0x1e')](function(){_0xc197a1({'val':_0x11c155[_0xadd6('0x19')]});});}});}function splitAdditionalPhone(_0x618ad7,_0x2855ea){return new Promise(function(_0xbb72d5,_0x4772b9){var _0x4b3e97=_0x2855ea[_0xadd6('0x20')](':');var _0x30f192=_0x4b3e97[0x0];var _0x365d2a=_0x4b3e97[0x1];if(_0x365d2a!==''){var _0x5138ad=_0x365d2a[_0xadd6('0x20')]('|');var _0x27d78a=[];for(var _0x279758=0x0;_0x279758<_0x5138ad[_0xadd6('0x19')];_0x279758++){if(_0x5138ad[_0x279758]!==''){var _0x10416d=_[_0xadd6('0x21')](promisesAdditionalPhones,{'contactId':_0x618ad7,'phone':_0x5138ad[_0x279758]});if(_0x10416d[_0xadd6('0x19')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x618ad7,'contactTypeId':_0x30f192,'phone':_0x5138ad[_0x279758],'orderBy':orderBy});}}}_0xbb72d5({'ok':0x1});}else _0xbb72d5({'res':0x0});});}function createAdditionalPhone(_0x39a3f7,_0xc16c2e,_0x3577fa,_0x2b1d19){var _0x3f13de='';var _0x16b610='';var _0x3135eb=_0x3577fa[_0xadd6('0x20')]('§');_0x3f13de=_0x3135eb[0x0];if(_0x3135eb[_0xadd6('0x19')]==0x2)_0x16b610=_0x3135eb[0x1];return new Promise(function(_0x380ffc,_0x299b6e){return db[_0xadd6('0x22')][_0xadd6('0x23')]({'where':{'CmContactId':_0x39a3f7,'item':_0x3f13de}})['then'](function(_0x5e2a9d){if(_0x5e2a9d){return db['CmContactHasItem']['update']({'ItemTypeId':_0xc16c2e,'description':_0x16b610,'OrderBy':_0x2b1d19},{'where':{'CmContactId':_0x39a3f7,'item':_0x3f13de}})['then'](function(_0x7a707c){_0x380ffc({'res':_0xadd6('0x24')});});}else{return db[_0xadd6('0x22')][_0xadd6('0x25')]({'CmContactId':_0x39a3f7,'item':_0x3f13de,'ItemTypeId':_0xc16c2e,'description':_0x16b610,'OrderBy':_0x2b1d19,'ItemClass':_0xadd6('0x26')})[_0xadd6('0x1e')](function(_0x570f9a){_0x380ffc({'res':'inserted'});});}});});}function updateContact(_0x45f1c8){return new Promise(function(_0x4bbb64,_0x25c9da){var _0xf2442d=_0x45f1c8['id'];delete _0x45f1c8['id'];return db[_0xadd6('0x27')]['update'](_0x45f1c8,{'where':{'id':_0xf2442d}})[_0xadd6('0x1e')](function(_0xc05dac){updatedRows+=0x1;return db[_0xadd6('0x28')][_0xadd6('0x29')]({'phone':_0x45f1c8[_0xadd6('0x12')]},{'where':{'ContactId':_0xf2442d}})['then'](function(_0x35bcfa){_0x4bbb64({'ret':'OK'});});});});}function insertCmHopper(_0x20c396,_0x10197b,_0x2aa23a,_0x3b5aee,_0x36fc27){var _0x443a3d=[_0xadd6('0x2a'),_0xadd6('0x2b'),'cm_contacts.id','cm_contacts.ListId',_0x10197b+'.'+_0x3b5aee,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xadd6('0x2c'),_0xadd6('0x2d'),'\x22'+_0x36fc27+'\x22'];return squel['insert']()[_0xadd6('0x2e')](_0xadd6('0x2f'))[_0xadd6('0x30')](['phone',_0xadd6('0x31'),_0xadd6('0x32'),_0xadd6('0x33'),_0x3b5aee,_0xadd6('0x34'),_0xadd6('0x35'),_0xadd6('0x36'),_0xadd6('0x37'),_0xadd6('0x38')],squel[_0xadd6('0x10')]()[_0xadd6('0x39')](_0x443a3d)[_0xadd6('0x3a')](_0x10197b)[_0xadd6('0x15')](_0xadd6('0x3b'),null,'cm_contacts.ListId\x20=\x20'+_0x10197b+'.CmListId')[_0xadd6('0x15')](_0x2aa23a,null,_0x2aa23a+_0xadd6('0x3c')+_0x10197b+'.'+_0x3b5aee)[_0xadd6('0x13')](_0x10197b+_0xadd6('0x3d'),_0x20c396)['where'](_0xadd6('0x3e'),NOW)[_0xadd6('0x13')](_0xadd6('0x3f'),selectNotIn(_0x10197b,_0x2aa23a,_0x3b5aee,_0xadd6('0x2f'),[_0xadd6('0x40'),_0xadd6('0x41')]))[_0xadd6('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x10197b,_0x2aa23a,_0x3b5aee,_0xadd6('0x2f'),['\x22always\x22'])))[_0xadd6('0x42')]();}function insertCmHopperBlack(_0xaec32f,_0x2c56e8,_0x4dfc22,_0x1e4bdc){var _0xcb4bd9=['cm_contacts.phone','cm_contacts.id','cm_contacts.ListId',_0x2c56e8+'.'+_0x1e4bdc,_0xadd6('0x43'),_0xadd6('0x44')];return squel[_0xadd6('0x45')]()[_0xadd6('0x2e')](_0xadd6('0x46'))['fromQuery']([_0xadd6('0x12'),_0xadd6('0x32'),_0xadd6('0x33'),_0x1e4bdc,'createdAt',_0xadd6('0x35')],squel['select']()['fields'](_0xcb4bd9)[_0xadd6('0x3a')](_0x2c56e8)[_0xadd6('0x15')](_0xadd6('0x3b'),null,_0xadd6('0x47')+_0x2c56e8+_0xadd6('0x48'))['join'](_0x4dfc22,null,_0x4dfc22+_0xadd6('0x3c')+_0x2c56e8+'.'+_0x1e4bdc)['where'](_0x2c56e8+_0xadd6('0x3d'),_0xaec32f)[_0xadd6('0x13')](_0xadd6('0x3e'),NOW)['where'](_0xadd6('0x3f'),squel[_0xadd6('0x10')]()[_0xadd6('0x11')](_0xadd6('0x12'))[_0xadd6('0x3a')](_0xadd6('0x46'))[_0xadd6('0x13')]('ListId\x20=\x20?',_0xaec32f)[_0xadd6('0x13')](_0x1e4bdc+_0xadd6('0x49'),_0x2c56e8+'.'+_0x1e4bdc)))[_0xadd6('0x42')]();}function insertCmHopperAdditionalPhones(_0x201344){var _0x2bd996=['cm_hopper.id','cm_contact_has_items.item',_0xadd6('0x4a'),_0xadd6('0x4b'),'cm_contact_has_items.updatedAt'];return squel[_0xadd6('0x45')]()[_0xadd6('0x2e')](_0xadd6('0x4c'))[_0xadd6('0x30')](['CmHopperId','phone',_0xadd6('0x4d'),_0xadd6('0x34'),_0xadd6('0x35')],squel[_0xadd6('0x10')]()['fields'](_0x2bd996)['from'](_0xadd6('0x2f'))[_0xadd6('0x15')](_0xadd6('0x3b'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xadd6('0x15')](_0xadd6('0x4e'),null,_0xadd6('0x4f'))[_0xadd6('0x13')]('cm_hopper.ListId\x20=\x20?',_0x201344)[_0xadd6('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xadd6('0x42')]();}function insertCmContact(_0x8c38f2,_0xac0d37,_0x43d5b9,_0x5e5544){var _0x3cf5b1=_[_0xadd6('0x50')](_[_0xadd6('0x51')](_0x5e5544),[_0xadd6('0x33'),_0xadd6('0x52'),'createdAt',_0xadd6('0x35')]);return squel[_0xadd6('0x45')]()['into']('cm_contacts')[_0xadd6('0x30')](_0x3cf5b1,squel[_0xadd6('0x10')]()[_0xadd6('0x39')](_0x3cf5b1)[_0xadd6('0x3a')](_0xac0d37)[_0xadd6('0x13')]('('+_0x43d5b9[_0xadd6('0x15')](',')+_0xadd6('0x53'),squel[_0xadd6('0x10')]()[_0xadd6('0x39')](_0x43d5b9)[_0xadd6('0x3a')](_0xadd6('0x3b'))[_0xadd6('0x13')](_0xadd6('0x54'),_0x8c38f2))[_0xadd6('0x13')](_0xadd6('0x55'),squel[_0xadd6('0x10')]()[_0xadd6('0x11')]('MIN(id)',_0xadd6('0x56'))[_0xadd6('0x3a')](_0xac0d37)[_0xadd6('0x57')](_0x43d5b9[_0xadd6('0x15')](','))))['toString']();}function handleStop(){logger[_0xadd6('0x58')](_0xadd6('0x59'));stopped=!![];}function handleUncaughtException(_0x1bdb94){logger[_0xadd6('0x5a')](_0x1bdb94[_0xadd6('0x1f')]);process[_0xadd6('0x5b')](0x1);}function handleError(_0xc66215,_0x2ba3ed){stats[_0xadd6('0x5c')][_0xadd6('0x1c')]({'name':_0x2ba3ed[_0xadd6('0x5d')],'message':_0x2ba3ed['message'],'row':_0xc66215});}function handleQuery(_0x5157d1){logger[_0xadd6('0x58')](_0x5157d1);return db['sequelize']['query'](_0x5157d1)[_0xadd6('0x18')](function(_0x1e3136){results[_0xadd6('0x1c')](_0x1e3136);})[_0xadd6('0x5e')](function(_0x1fe512){logger[_0xadd6('0x5a')](_0x1fe512[_0xadd6('0x1f')]);});}function main(_0x3afc3f,_0x4014ea,_0xb05e82,_0x3bac88){logger['info'](_0xadd6('0x5f'),_0x3afc3f,JSON[_0xadd6('0x60')](_0x4014ea));process[_0xadd6('0x61')](_0xadd6('0x62'));var _0x3d8f90=_0x4014ea[_0xadd6('0x63')];var _0x15ddf7=_[_0xadd6('0x64')](_0x3d8f90);var _0x1b5bbc=_0x4014ea[_0xadd6('0x65')];var _0x354c7b=path[_0xadd6('0x15')](config[_0xadd6('0x66')],_0xadd6('0x67'),_0x1b5bbc+_0xadd6('0x68'));logger['info']('body',_0x4014ea);db['ContactItemType'][_0xadd6('0x69')]({'raw':!![],'attributes':['id',_0xadd6('0x6a')]})['then'](function(_0x9f8ffa){for(var _0x1aeb28=0x0;_0x1aeb28<_0x9f8ffa[_0xadd6('0x19')];_0x1aeb28++){if(_0x9f8ffa[_0x1aeb28][_0xadd6('0x6a')]in _0x3d8f90){contactItemTypes[_0xadd6('0x1c')](_0x9f8ffa[_0x1aeb28]);delete _0x15ddf7[_0x9f8ffa[_0x1aeb28][_0xadd6('0x6a')]];hasAdditionalPhones=!![];}for(var _0x556ad9 in _0x3d8f90){if(_0x9f8ffa[_0x1aeb28][_0xadd6('0x6a')]+_0xadd6('0x6b')===_0x556ad9){phoneDescriptions['push']({'itemTypeId':_0x9f8ffa[_0x1aeb28]['id'],'description':_0x556ad9});delete _0x15ddf7[_0x556ad9];}}}if(hasAdditionalPhones)_0x15ddf7['AdditionalPhones']='';var _0x547dcb=_[_0xadd6('0x51')](_0x15ddf7)[_0xadd6('0x15')]();logger[_0xadd6('0x58')](_0xadd6('0x6c'),_0x547dcb);fs[_0xadd6('0x6d')](_0x354c7b,_0x547dcb+'\x0a');Papa['parse'](fs[_0xadd6('0x6e')](_0x3afc3f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e55fa,_0x34a709){try{for(var _0xf98a07=0x0,_0x5726c1=[];_0xf98a07<_0x1e55fa[_0xadd6('0x6f')][_0xadd6('0x19')];_0xf98a07++){stats[_0xadd6('0x70')]+=0x1;if(_0x1e55fa[_0xadd6('0x5c')][_0xf98a07]){handleError(_0x1e55fa[_0xadd6('0x6f')][_0xf98a07],_0x1e55fa[_0xadd6('0x5c')][_0xf98a07]);}else{var _0x3f020a=[];var _0x289825=[];var _0x473a23={};for(var _0x590dfc in _0x3d8f90){let _0x2fb256=contactItemTypes[_0xadd6('0x71')](_0x4dff7a=>_0x4dff7a[_0xadd6('0x6a')]===_0x590dfc);let _0x70dfce=contactItemTypes[_0xadd6('0x71')](_0x3c858d=>_0x3c858d[_0xadd6('0x6a')]+_0xadd6('0x6b')===_0x590dfc);if(_[_0xadd6('0x1a')](_0x2fb256)&&_['isNil'](_0x70dfce)){if(_0x3d8f90[_0xadd6('0x72')](_0x590dfc)){if(_0x1e55fa[_0xadd6('0x6f')][_0xf98a07][_0x3d8f90[_0x590dfc]]){var _0x327e88=_['trim'](_0x1e55fa[_0xadd6('0x6f')][_0xf98a07][_0x3d8f90[_0x590dfc]]['replace'](/"/g,'\x27'));switch(_0x590dfc){case _0xadd6('0x31'):var _0x3d3f8a=moment(_0x327e88,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3d3f8a[_0xadd6('0x73')]()){_0x5726c1[_0xadd6('0x1c')]('\x22'+_0x327e88+'\x22');}else{_0x3f020a[_0xadd6('0x1c')](_0xadd6('0x74'));}break;case _0xadd6('0x36'):var _0x347a5e=parseInt(_0x327e88);_0x327e88=_['isNaN'](_0x347a5e)||_0x347a5e<0x0||_0x347a5e>0x4?_0x3bac88?0x3:0x2:_0x347a5e;_0x5726c1['push']('\x22'+_0x327e88+'\x22');break;case _0xadd6('0x37'):var _0x1f55be=parseInt(_0x327e88);if(_[_0xadd6('0x75')](_0x1f55be)&&_['includes'](_0xb05e82,_0x1f55be)){_0x5726c1[_0xadd6('0x1c')]('\x22'+_0x1f55be+'\x22');}else{_0x3f020a[_0xadd6('0x1c')](_0xadd6('0x76'));}break;case _0xadd6('0x77'):if(isEmail(_0x327e88)){_0x5726c1[_0xadd6('0x1c')]('\x22'+_0x327e88+'\x22');}else{_0x3f020a['push']('email\x20wrong\x20format');}break;case _0xadd6('0x78'):var _0x5a61fe=moment(_0x327e88,'YYYY-MM-DD',!![]);if(_0x5a61fe['isValid']()){_0x5726c1[_0xadd6('0x1c')]('\x22'+_0x327e88+'\x22');}else{_0x3f020a['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x5726c1[_0xadd6('0x1c')]('\x22'+_0x327e88+'\x22');}}else{switch(_0x590dfc){case _0xadd6('0x79'):case _0xadd6('0x12'):_0x3f020a['push'](_0x590dfc+_0xadd6('0x7a'));break;default:_0x5726c1[_0xadd6('0x1c')]('\x22\x22');}}}}else{var _0x374b4c='';if(!_[_0xadd6('0x1a')](_0x2fb256)){if(!_0x473a23[_0xadd6('0x72')](_0x2fb256['id'])){for(var _0x3aa1bc=0x0;_0x3aa1bc<_0x3d8f90[_0x590dfc]['length'];_0x3aa1bc++){var _0x327e88=_[_0xadd6('0x7b')](_0x1e55fa[_0xadd6('0x6f')][_0xf98a07][_0x3d8f90[_0x590dfc][_0x3aa1bc]][_0xadd6('0x7c')](/"/g,'\x27'));var _0x2b2898=phoneDescriptions[_0xadd6('0x71')](_0x2c2b3e=>_0x2c2b3e[_0xadd6('0x7d')]===_0x2fb256['id']);if(!_[_0xadd6('0x1a')](_0x2b2898)){var _0x40c921=_['trim'](_0x1e55fa[_0xadd6('0x6f')][_0xf98a07][_0x3d8f90[_0x2b2898[_0xadd6('0x7e')]][0x0]][_0xadd6('0x7c')](/"/g,'\x27'));if(!_[_0xadd6('0x1a')](_0x40c921))_0x327e88=_0x327e88+'§'+_0x40c921;}if(_0x374b4c=='')_0x374b4c=_0x327e88;else _0x374b4c+='|'+_0x327e88;}_0x289825[_0xadd6('0x1c')](_0x2fb256['id']+':'+_0x374b4c);_0x473a23[_0x2fb256['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5726c1[_0xadd6('0x1c')]('\x22'+_0x289825['join'](';')+'\x22');}if(_0x3f020a[_0xadd6('0x19')]){handleError(_0x1e55fa[_0xadd6('0x6f')][_0xf98a07],{'code':_0xadd6('0x7f'),'message':_0x3f020a[_0xadd6('0x15')]()});}else{fs[_0xadd6('0x80')](_0x354c7b,_0x5726c1[_0xadd6('0x15')]()+'\x0a');}_0x5726c1=[];}if(!(stats[_0xadd6('0x70')]%0xc8)){socket[_0xadd6('0x81')](_0xadd6('0x82')+_0x1b5bbc,stats);stats['errors']=[];}}if(stopped){logger['info'](_0xadd6('0x83'));_0x34a709[_0xadd6('0x84')]();}}catch(_0x6a9819){handleError(_0x1e55fa['data'][_0xf98a07],{'code':_0xadd6('0x85'),'message':_0x6a9819[_0xadd6('0x1f')]});logger[_0xadd6('0x5a')]('step',_0x6a9819[_0xadd6('0x1f')]);}},'complete':function(){try{var _0x274a22=[];var _0x425904=tempTableName;_0x274a22[_0xadd6('0x1c')]('CREATE\x20TABLE\x20'+_0x425904+_0xadd6('0x86'));logger['info'](_0xadd6('0x87'),contactItemTypes[_0xadd6('0x19')]);var _0x207c02=util[_0xadd6('0xd')](_0xadd6('0x88'),_0x354c7b,_0x425904,_0x547dcb,_0x4014ea[_0xadd6('0x33')],_0x4014ea[_0xadd6('0x52')]||null,NOW,NOW);if(_[_0xadd6('0x1a')](_0x3d8f90[_0xadd6('0x31')])){_0x207c02+=',\x20scheduledAt\x20=\x20NOW()';}_0x274a22[_0xadd6('0x1c')](_0x207c02);BPromise['each'](_0x274a22,handleQuery)[_0xadd6('0x1e')](function(_0x39f61c){BPromise[_0xadd6('0x1d')]([handleAdditionalPhones()])['then'](function(){_0x274a22=[];for(var _0x9d929c=0x0;_0x9d929c_0x552fa4[_0x45cb('0x6b')]===_0x352fd2);let _0x40f3dc=contactItemTypes[_0x45cb('0x70')](_0x2ed3aa=>_0x2ed3aa[_0x45cb('0x6b')]+_0x45cb('0x6c')===_0x352fd2);if(_['isNil'](_0x3448da)&&_[_0x45cb('0x1e')](_0x40f3dc)){if(_0x3dd2e6[_0x45cb('0x71')](_0x352fd2)){if(_0x44cb0d[_0x45cb('0x6f')][_0x172236][_0x3dd2e6[_0x352fd2]]){var _0x50c0ed=_[_0x45cb('0x72')](_0x44cb0d[_0x45cb('0x6f')][_0x172236][_0x3dd2e6[_0x352fd2]][_0x45cb('0x73')](/"/g,'\x27'));switch(_0x352fd2){case _0x45cb('0x36'):var _0x3f095a=moment(_0x50c0ed,_0x45cb('0xe'),!![]);if(_0x3f095a[_0x45cb('0x74')]()){_0x45c8d1[_0x45cb('0x20')]('\x22'+_0x50c0ed+'\x22');}else{_0x39a0ff[_0x45cb('0x20')](_0x45cb('0x75'));}break;case _0x45cb('0x39'):var _0x4d1683=parseInt(_0x50c0ed);_0x50c0ed=_[_0x45cb('0x76')](_0x4d1683)||_0x4d1683<0x0||_0x4d1683>0x4?_0x58b7e0?0x3:0x2:_0x4d1683;_0x45c8d1['push']('\x22'+_0x50c0ed+'\x22');break;case _0x45cb('0x77'):var _0x4dabc1=parseInt(_0x50c0ed);if(_[_0x45cb('0x78')](_0x4dabc1)&&_[_0x45cb('0x79')](_0x3e4900,_0x4dabc1)){_0x45c8d1['push']('\x22'+_0x4dabc1+'\x22');}else{_0x39a0ff['push'](_0x45cb('0x7a'));}break;case _0x45cb('0x7b'):if(isEmail(_0x50c0ed)){_0x45c8d1[_0x45cb('0x20')]('\x22'+_0x50c0ed+'\x22');}else{_0x39a0ff['push']('email\x20wrong\x20format');}break;case _0x45cb('0x7c'):var _0x3700e8=moment(_0x50c0ed,'YYYY-MM-DD',!![]);if(_0x3700e8[_0x45cb('0x74')]()){_0x45c8d1[_0x45cb('0x20')]('\x22'+_0x50c0ed+'\x22');}else{_0x39a0ff[_0x45cb('0x20')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x45c8d1[_0x45cb('0x20')]('\x22'+_0x50c0ed+'\x22');}}else{switch(_0x352fd2){case _0x45cb('0x7d'):case'phone':_0x39a0ff[_0x45cb('0x20')](_0x352fd2+'\x20not\x20specified');break;default:_0x45c8d1['push']('\x22\x22');}}}}else{var _0x2d9ce4='';if(!_[_0x45cb('0x1e')](_0x3448da)){if(!_0x4e0d86[_0x45cb('0x71')](_0x3448da['id'])){for(var _0x4e3aec=0x0;_0x4e3aec<_0x3dd2e6[_0x352fd2][_0x45cb('0x26')];_0x4e3aec++){var _0x50c0ed=_[_0x45cb('0x72')](_0x44cb0d[_0x45cb('0x6f')][_0x172236][_0x3dd2e6[_0x352fd2][_0x4e3aec]][_0x45cb('0x73')](/"/g,'\x27'));var _0x5ce238=phoneDescriptions['find'](_0x5d9104=>_0x5d9104['itemTypeId']===_0x3448da['id']);if(!_[_0x45cb('0x1e')](_0x5ce238)){var _0x3c0713=_[_0x45cb('0x72')](_0x44cb0d[_0x45cb('0x6f')][_0x172236][_0x3dd2e6[_0x5ce238[_0x45cb('0x7e')]][0x0]][_0x45cb('0x73')](/"/g,'\x27'));if(!_['isNil'](_0x3c0713))_0x50c0ed=_0x50c0ed+'§'+_0x3c0713;}if(_0x2d9ce4=='')_0x2d9ce4=_0x50c0ed;else _0x2d9ce4+='|'+_0x50c0ed;}_0x3a2649['push'](_0x3448da['id']+':'+_0x2d9ce4);_0x4e0d86[_0x3448da['id']]=0x1;}}}}if(hasAdditionalPhones){_0x45c8d1[_0x45cb('0x20')]('\x22'+_0x3a2649['join'](';')+'\x22');}if(_0x39a0ff[_0x45cb('0x26')]){handleError(_0x44cb0d[_0x45cb('0x6f')][_0x172236],{'code':_0x45cb('0x7f'),'message':_0x39a0ff[_0x45cb('0x15')]()});}else{fs[_0x45cb('0x80')](_0x53ae33,_0x45c8d1['join']()+'\x0a');}_0x45c8d1=[];}if(!(stats['rows']%0xc8)){socket[_0x45cb('0x81')](_0x45cb('0x82')+_0x21c549,stats);stats[_0x45cb('0x5e')]=[];}}if(stopped){logger['info'](_0x45cb('0x83'));_0x30dd81['abort']();}}catch(_0x504cb2){handleError(_0x44cb0d[_0x45cb('0x6f')][_0x172236],{'code':'SystemError','message':_0x504cb2[_0x45cb('0x24')]});logger['error'](_0x45cb('0x84'),_0x504cb2[_0x45cb('0x24')]);}},'complete':function(){try{var _0x1ab418=[];var _0x13dd09=tempTableName;_0x1ab418[_0x45cb('0x20')]('CREATE\x20TABLE\x20'+_0x13dd09+_0x45cb('0x85'));logger[_0x45cb('0x5a')](_0x45cb('0x86'),contactItemTypes[_0x45cb('0x26')]);var _0x22ffec=util[_0x45cb('0xd')]('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',_0x53ae33,_0x13dd09,_0x4209ff,_0x90635a[_0x45cb('0x44')],_0x90635a['CompanyId']||null,NOW,NOW);if(_[_0x45cb('0x1e')](_0x3dd2e6['scheduledat'])){_0x22ffec+=',\x20scheduledAt\x20=\x20NOW()';}_0x1ab418['push'](_0x22ffec);BPromise[_0x45cb('0x87')](_0x1ab418,handleQuery)['then'](function(_0x5d9f17){BPromise[_0x45cb('0x21')]([handleAdditionalPhones()])['then'](function(){_0x1ab418=[];for(var _0x9beb8e=0x0;_0x9beb8e\x20\x20');}var _0x300e98=path['join'](config[_0x45cb('0x67')],_0x45cb('0x90'),process['argv'][0x2]);if(!fs[_0x45cb('0x91')](_0x300e98)){throw new Error(_0x45cb('0x92'));}var _0x4d2932={};try{_0x4d2932=JSON[_0x45cb('0x6e')](process[_0x45cb('0x8f')][0x3]);if(!_0x4d2932['binding']){throw new Error('binding\x20doesn\x27t\x20exists');}var _0x3d4f9d=0x0;if(_0x4d2932[_0x45cb('0x64')][_0x45cb('0x77')]){_0x3d4f9d=0x1;}if(!_0x4d2932[_0x45cb('0x44')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x2cfeb2){throw new Error(_0x45cb('0x93'));}var _0x37acd0=[];try{_0x37acd0=_[_0x45cb('0x94')](JSON[_0x45cb('0x6e')](process[_0x45cb('0x8f')][0x4]),'id');}catch(_0x4a36e4){logger[_0x45cb('0x5a')](_0x45cb('0x95'));}main(_0x300e98,_0x4d2932,_0x37acd0,_0x3d4f9d);}validate();process['on'](_0x45cb('0x96'),handleStop);process['on'](_0x45cb('0x97'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index f155957..e49026f 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x406b=['Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','***\x20Time\x20Info\x20***','Answer\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','***\x20Call\x20Info\x20***','keyValue','calleridname','Call\x20To','destexten'];(function(_0x343b78,_0x42394d){var _0x5869c5=function(_0x2bbe40){while(--_0x2bbe40){_0x343b78['push'](_0x343b78['shift']());}};_0x5869c5(++_0x42394d);}(_0x406b,0x193));var _0xb406=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x406b[_0x13e741];return _0x3f8bb3;};'use strict';exports[_0xb406('0x0')]=function(_0x91282b,_0xe11d23){var _0x26bf92=[{'type':_0xb406('0x1'),'content':_0xb406('0x2'),'variableName':null}];switch(_0x91282b[_0xb406('0x3')]()){case _0xb406('0x4'):switch(_0xe11d23[_0xb406('0x3')]()){case _0xb406('0x5'):_0x26bf92[_0xb406('0x6')]({'type':_0xb406('0x7'),'content':'','variableName':_0xb406('0x8')});_0x26bf92['push']({'type':_0xb406('0x7'),'content':'','variableName':_0xb406('0x9')});break;case _0xb406('0xa'):_0x26bf92[_0xb406('0x6')]({'type':_0xb406('0x1'),'content':_0xb406('0xb'),'variableName':null});_0x26bf92['push']({'type':_0xb406('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0x26bf92;};exports['getDescriptions']=function(_0x5ebd37,_0x3919ff){var _0x32df26=[];switch(_0x5ebd37[_0xb406('0x3')]()){case _0xb406('0x4'):switch(_0x3919ff[_0xb406('0x3')]()){case _0xb406('0x5'):_0x32df26=[{'type':_0xb406('0x1'),'content':_0xb406('0xc'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Caller\x20Number','keyType':'variable','variableName':'calleridnum'},{'type':_0xb406('0xd'),'content':'','key':'Caller\x20Name','keyType':_0xb406('0x7'),'variableName':_0xb406('0xe')},{'type':_0xb406('0xd'),'content':'','key':_0xb406('0xf'),'keyType':_0xb406('0x7'),'variableName':_0xb406('0x10')},{'type':'keyValue','content':'','key':_0xb406('0x11'),'keyType':'variable','variableName':_0xb406('0x8')},{'type':_0xb406('0xd'),'content':'','key':_0xb406('0x12'),'keyType':_0xb406('0x7'),'variableName':_0xb406('0x13')},{'type':_0xb406('0xd'),'content':'','key':_0xb406('0x14'),'keyType':_0xb406('0x7'),'variableName':_0xb406('0x15')},{'type':_0xb406('0x1'),'content':_0xb406('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0xb406('0xd'),'content':'','key':_0xb406('0x17'),'keyType':_0xb406('0x7'),'variableName':_0xb406('0x18')},{'type':_0xb406('0xd'),'content':'','key':_0xb406('0x19'),'keyType':_0xb406('0x7'),'variableName':_0xb406('0x1a')},{'type':_0xb406('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xb406('0xd'),'content':'','key':'Agent\x20Ring','keyType':_0xb406('0x7'),'variableName':'agentcalledAt'},{'type':'keyValue','content':'','key':_0xb406('0x1b'),'keyType':_0xb406('0x7'),'variableName':'agentconnectAt'},{'type':_0xb406('0xd'),'content':'','key':_0xb406('0x1c'),'keyType':_0xb406('0x7'),'variableName':_0xb406('0x1d')},{'type':_0xb406('0xd'),'content':'','key':'Hold\x20Time','keyType':_0xb406('0x7'),'variableName':_0xb406('0x1e')},{'type':'keyValue','content':'','key':_0xb406('0x1f'),'keyType':_0xb406('0x7'),'variableName':_0xb406('0x20')}];break;case _0xb406('0xa'):_0x32df26=[{'type':'string','content':_0xb406('0xc'),'variableName':null},{'type':_0xb406('0xd'),'content':'','key':_0xb406('0x21'),'keyType':_0xb406('0x7'),'keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':_0xb406('0x22'),'keyType':'variable','keyContent':'','variableName':'membername'},{'type':_0xb406('0xd'),'content':'','key':_0xb406('0x12'),'keyType':_0xb406('0x7'),'keyContent':'','variableName':_0xb406('0x13')},{'type':'keyValue','content':'','key':_0xb406('0x14'),'keyType':_0xb406('0x7'),'keyContent':'','variableName':'starttime'},{'type':_0xb406('0x1'),'content':_0xb406('0x23')},{'type':_0xb406('0xd'),'content':'','key':_0xb406('0x24'),'keyType':_0xb406('0x7'),'keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':'Complete\x20Time','keyType':_0xb406('0x7'),'keyContent':'','variableName':_0xb406('0x25')},{'type':_0xb406('0xd'),'content':'','key':_0xb406('0x26'),'keyType':_0xb406('0x7'),'keyContent':'','variableName':_0xb406('0x27')},{'type':_0xb406('0xd'),'content':'','key':_0xb406('0x28'),'keyType':_0xb406('0x7'),'keyContent':'','variableName':_0xb406('0x29')}];break;}}return _0x32df26;}; \ No newline at end of file +var _0xe2ad=['Talk\x20Time','talktime','Called\x20Number','membername','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','push','queue','variable','calleridnum','outbound','destcalleridnum','getDescriptions','inbound','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','Call\x20To','UniqueId','uniqueid','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','***\x20Time\x20Info\x20***','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime'];(function(_0x2bbdc4,_0x2cb88e){var _0x482d0c=function(_0x4da8ce){while(--_0x4da8ce){_0x2bbdc4['push'](_0x2bbdc4['shift']());}};_0x482d0c(++_0x2cb88e);}(_0xe2ad,0x1e5));var _0xde2a=function(_0x1d5098,_0xab456f){_0x1d5098=_0x1d5098-0x0;var _0x3463c5=_0xe2ad[_0x1d5098];return _0x3463c5;};'use strict';exports[_0xde2a('0x0')]=function(_0x2913b7,_0x53d04f){var _0x53abbe=[{'type':_0xde2a('0x1'),'content':_0xde2a('0x2'),'variableName':null}];switch(_0x2913b7[_0xde2a('0x3')]()){case _0xde2a('0x4'):switch(_0x53d04f[_0xde2a('0x3')]()){case'inbound':_0x53abbe[_0xde2a('0x5')]({'type':'variable','content':'','variableName':_0xde2a('0x6')});_0x53abbe[_0xde2a('0x5')]({'type':_0xde2a('0x7'),'content':'','variableName':_0xde2a('0x8')});break;case _0xde2a('0x9'):_0x53abbe[_0xde2a('0x5')]({'type':_0xde2a('0x1'),'content':'Outbound\x20Call','variableName':null});_0x53abbe[_0xde2a('0x5')]({'type':'variable','content':'','variableName':_0xde2a('0xa')});break;}}return _0x53abbe;};exports[_0xde2a('0xb')]=function(_0x1b6f4e,_0x5a0718){var _0x3626fa=[];switch(_0x1b6f4e[_0xde2a('0x3')]()){case _0xde2a('0x4'):switch(_0x5a0718[_0xde2a('0x3')]()){case _0xde2a('0xc'):_0x3626fa=[{'type':_0xde2a('0x1'),'content':_0xde2a('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xde2a('0xe'),'content':'','key':'Caller\x20Number','keyType':'variable','variableName':_0xde2a('0x8')},{'type':'keyValue','content':'','key':_0xde2a('0xf'),'keyType':_0xde2a('0x7'),'variableName':_0xde2a('0x10')},{'type':_0xde2a('0xe'),'content':'','key':_0xde2a('0x11'),'keyType':_0xde2a('0x7'),'variableName':'destexten'},{'type':_0xde2a('0xe'),'content':'','key':'Queue','keyType':_0xde2a('0x7'),'variableName':_0xde2a('0x6')},{'type':'keyValue','content':'','key':_0xde2a('0x12'),'keyType':_0xde2a('0x7'),'variableName':_0xde2a('0x13')},{'type':'keyValue','content':'','key':'Date','keyType':_0xde2a('0x7'),'variableName':'agentcalledAt'},{'type':'string','content':_0xde2a('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0xde2a('0xe'),'content':'','key':_0xde2a('0x15'),'keyType':_0xde2a('0x7'),'variableName':_0xde2a('0x16')},{'type':_0xde2a('0xe'),'content':'','key':'Agent\x20Number','keyType':_0xde2a('0x7'),'variableName':_0xde2a('0xa')},{'type':_0xde2a('0x1'),'content':_0xde2a('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0xde2a('0xe'),'content':'','key':'Agent\x20Ring','keyType':'variable','variableName':_0xde2a('0x18')},{'type':'keyValue','content':'','key':_0xde2a('0x19'),'keyType':_0xde2a('0x7'),'variableName':_0xde2a('0x1a')},{'type':'keyValue','content':'','key':_0xde2a('0x1b'),'keyType':_0xde2a('0x7'),'variableName':_0xde2a('0x1c')},{'type':'keyValue','content':'','key':_0xde2a('0x1d'),'keyType':'variable','variableName':_0xde2a('0x1e')},{'type':'keyValue','content':'','key':_0xde2a('0x1f'),'keyType':_0xde2a('0x7'),'variableName':_0xde2a('0x20')}];break;case _0xde2a('0x9'):_0x3626fa=[{'type':_0xde2a('0x1'),'content':_0xde2a('0xd'),'variableName':null},{'type':'keyValue','content':'','key':_0xde2a('0x21'),'keyType':_0xde2a('0x7'),'keyContent':'','variableName':_0xde2a('0xa')},{'type':_0xde2a('0xe'),'content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':_0xde2a('0x22')},{'type':'keyValue','content':'','key':_0xde2a('0x12'),'keyType':'variable','keyContent':'','variableName':_0xde2a('0x13')},{'type':_0xde2a('0xe'),'content':'','key':'Date','keyType':_0xde2a('0x7'),'keyContent':'','variableName':'starttime'},{'type':'string','content':_0xde2a('0x17')},{'type':_0xde2a('0xe'),'content':'','key':_0xde2a('0x23'),'keyType':_0xde2a('0x7'),'keyContent':'','variableName':_0xde2a('0x24')},{'type':_0xde2a('0xe'),'content':'','key':_0xde2a('0x25'),'keyType':_0xde2a('0x7'),'keyContent':'','variableName':_0xde2a('0x26')},{'type':'keyValue','content':'','key':_0xde2a('0x27'),'keyType':'variable','keyContent':'','variableName':_0xde2a('0x28')},{'type':_0xde2a('0xe'),'content':'','key':_0xde2a('0x29'),'keyType':'variable','keyContent':'','variableName':_0xde2a('0x2a')}];break;}}return _0x3626fa;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 5c2fbfb..205f417 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf2b=['closed','getClosedOrderClause','getFilteredInteractions','rows','catch','query','omit','mobile','updateUser','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','body','default','fields','having','read','tags','checkAccountsRestrictions','group','i.id','tag','countFilteredInteractions','count','order','forEach','contactName','DESC'];(function(_0x3d9b02,_0xa68ddc){var _0x5866e7=function(_0x2dbbdf){while(--_0x2dbbdf){_0x3d9b02['push'](_0x3d9b02['shift']());}};_0x5866e7(++_0xa68ddc);}(_0xdf2b,0x72));var _0xbdf2=function(_0x495f6f,_0x20c392){_0x495f6f=_0x495f6f-0x0;var _0x39bbf3=_0xdf2b[_0x495f6f];return _0x39bbf3;};'use strict';var _=require('lodash');var sqlUtils=require('./sql-utils');var utils=require(_0xbdf2('0x0'));exports[_0xbdf2('0x1')]=function(_0x3e7301,_0x46284f,_0x4d683e,_0x26943d,_0x68e6c6){var _0x272f70={'count':0x0,'rows':[]};var _0x380d50=sqlUtils[_0xbdf2('0x2')](_0x3e7301,_0x4d683e,_0x46284f);if(_0x380d50){return Promise[_0xbdf2('0x3')](_0x272f70);}var _0x1b5102=sqlUtils[_0xbdf2('0x4')](_0x3e7301);var _0x3df219={};return Promise[_0xbdf2('0x3')]()[_0xbdf2('0x5')](function(){if(_0x46284f[_0xbdf2('0x6')]){return sqlUtils[_0xbdf2('0x7')](_0x46284f[_0xbdf2('0x6')],_0x68e6c6);}else{return sqlUtils[_0xbdf2('0x8')](_0x3e7301,_0x46284f,_0x68e6c6);}})[_0xbdf2('0x5')](function(_0x25c594){_0x1b5102[_0xbdf2('0x9')](_0x25c594[_0xbdf2('0xa')]);_0x1b5102[_0xbdf2('0x9')](_0x25c594['contact']);_0x1b5102[_0xbdf2('0x9')](_0x25c594[_0xbdf2('0xb')]);_0x1b5102[_0xbdf2('0x9')](_0x25c594[_0xbdf2('0xc')]);_0x1b5102['where'](_0x25c594['filter']);_0x1b5102[_0xbdf2('0x9')](_0x25c594['user']);_0x1b5102[_0xbdf2('0xd')](_0x25c594[_0xbdf2('0xe')]);_0x3df219=_0x25c594[_0xbdf2('0xf')];return sqlUtils[_0xbdf2('0x10')](_0x3e7301,_0x4d683e,_0x46284f);})[_0xbdf2('0x5')](function(_0x56cb98){_0x1b5102[_0xbdf2('0x9')](_0x56cb98);_0x1b5102[_0xbdf2('0x11')](_0xbdf2('0x12'));var _0x2ba465=_0x46284f[_0xbdf2('0x6')]?_0x3df219['ids']:_0x46284f[_0xbdf2('0x13')];return sqlUtils[_0xbdf2('0x14')](_0x1b5102,_0x2ba465);})[_0xbdf2('0x5')](function(_0x4629ef){_0x272f70[_0xbdf2('0x15')]=_0x4629ef['length'];if(_0x272f70[_0xbdf2('0x15')]===0x0){return[];}_0x1b5102[_0xbdf2('0xd')](_0x3df219['clause']);if(_0x26943d[_0xbdf2('0x16')]){_0x26943d[_0xbdf2('0x16')][_0xbdf2('0x17')](function(_0x21f4f0){var _0x1fd76a=_0x21f4f0[0x0]===_0xbdf2('0x18')?_0x21f4f0[0x0]:'i.'+_0x21f4f0[0x0];_0x1b5102[_0xbdf2('0x16')](_0x1fd76a,_0x21f4f0[0x1]===_0xbdf2('0x19')?![]:!![]);if(_0x21f4f0[0x0]===_0xbdf2('0x1a')){var _0x1b97af=sqlUtils[_0xbdf2('0x1b')](_0x3e7301,_0x46284f);_0x1b5102[_0xbdf2('0x16')](_0x1b97af,_0x21f4f0[0x1]==='DESC'?![]:!![]);}});}return sqlUtils[_0xbdf2('0x1c')](_0x3e7301,_0x1b5102,_0x46284f,_0x26943d);})[_0xbdf2('0x5')](function(_0x5f0d9c){_0x272f70[_0xbdf2('0x1d')]=_0x5f0d9c;return _0x272f70;})[_0xbdf2('0x1e')](function(_0x306049){throw _0x306049;});};exports['tracked']=function(_0x3bdc3e,_0x212f1e){return function(_0x356c70,_0x3ff335,_0x2bd3eb){var _0x18df96=_0x356c70['user'];var _0x36341c={};var _0x474425=_0x356c70[_0xbdf2('0x1f')];if(_0x36341c){_0x36341c=_['clone'](_0x356c70[_0xbdf2('0xa')]);_0x36341c=_[_0xbdf2('0x20')](_0x36341c,[_0xbdf2('0xa'),'html','phone','fax',_0xbdf2('0x21')]);}utils[_0xbdf2('0x22')](_0x18df96,_0x36341c,_0x474425,_0x3bdc3e,_0x212f1e);_0x2bd3eb(null);};}; \ No newline at end of file +var _0x2976=['phone','fax','mobile','updateUser','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','search','parseAdvancedSearchFilter','parseQueryParameters','then','where','body','contact','default','fields','filter','user','having','read','checkAccountsRestrictions','ids','tag','countFilteredInteractions','count','length','order','forEach','contactName','DESC','closed','getClosedOrderClause','getFilteredInteractions','rows','catch','tracked','clone','html'];(function(_0x3c9fda,_0x188817){var _0x45b841=function(_0x1877db){while(--_0x1877db){_0x3c9fda['push'](_0x3c9fda['shift']());}};_0x45b841(++_0x188817);}(_0x2976,0x14c));var _0x6297=function(_0x54e155,_0x282b23){_0x54e155=_0x54e155-0x0;var _0x2c3206=_0x2976[_0x54e155];return _0x2c3206;};'use strict';var _=require(_0x6297('0x0'));var sqlUtils=require(_0x6297('0x1'));var utils=require(_0x6297('0x2'));exports[_0x6297('0x3')]=function(_0x1f4856,_0x6e7e88,_0x39c33b,_0x462f68,_0x20939d){var _0xef86fc={'count':0x0,'rows':[]};var _0x80915a=sqlUtils[_0x6297('0x4')](_0x1f4856,_0x39c33b,_0x6e7e88);if(_0x80915a){return Promise[_0x6297('0x5')](_0xef86fc);}var _0x304359=sqlUtils['getInteractionsQuery'](_0x1f4856);var _0x21b1fc={};return Promise[_0x6297('0x5')]()['then'](function(){if(_0x6e7e88[_0x6297('0x6')]){return sqlUtils[_0x6297('0x7')](_0x6e7e88[_0x6297('0x6')],_0x20939d);}else{return sqlUtils[_0x6297('0x8')](_0x1f4856,_0x6e7e88,_0x20939d);}})[_0x6297('0x9')](function(_0x187137){_0x304359[_0x6297('0xa')](_0x187137[_0x6297('0xb')]);_0x304359['where'](_0x187137[_0x6297('0xc')]);_0x304359[_0x6297('0xa')](_0x187137[_0x6297('0xd')]);_0x304359[_0x6297('0xa')](_0x187137[_0x6297('0xe')]);_0x304359['where'](_0x187137[_0x6297('0xf')]);_0x304359[_0x6297('0xa')](_0x187137[_0x6297('0x10')]);_0x304359[_0x6297('0x11')](_0x187137[_0x6297('0x12')]);_0x21b1fc=_0x187137['tags'];return sqlUtils[_0x6297('0x13')](_0x1f4856,_0x39c33b,_0x6e7e88);})[_0x6297('0x9')](function(_0x52bcee){_0x304359['where'](_0x52bcee);_0x304359['group']('i.id');var _0x43cef3=_0x6e7e88[_0x6297('0x6')]?_0x21b1fc[_0x6297('0x14')]:_0x6e7e88[_0x6297('0x15')];return sqlUtils[_0x6297('0x16')](_0x304359,_0x43cef3);})[_0x6297('0x9')](function(_0x25cb50){_0xef86fc[_0x6297('0x17')]=_0x25cb50[_0x6297('0x18')];if(_0xef86fc[_0x6297('0x17')]===0x0){return[];}_0x304359[_0x6297('0x11')](_0x21b1fc['clause']);if(_0x462f68['order']){_0x462f68[_0x6297('0x19')][_0x6297('0x1a')](function(_0x44b4c1){var _0x51ba31=_0x44b4c1[0x0]===_0x6297('0x1b')?_0x44b4c1[0x0]:'i.'+_0x44b4c1[0x0];_0x304359[_0x6297('0x19')](_0x51ba31,_0x44b4c1[0x1]===_0x6297('0x1c')?![]:!![]);if(_0x44b4c1[0x0]===_0x6297('0x1d')){var _0x51a3c4=sqlUtils[_0x6297('0x1e')](_0x1f4856,_0x6e7e88);_0x304359[_0x6297('0x19')](_0x51a3c4,_0x44b4c1[0x1]===_0x6297('0x1c')?![]:!![]);}});}return sqlUtils[_0x6297('0x1f')](_0x1f4856,_0x304359,_0x6e7e88,_0x462f68);})[_0x6297('0x9')](function(_0x5ee811){_0xef86fc[_0x6297('0x20')]=_0x5ee811;return _0xef86fc;})[_0x6297('0x21')](function(_0x25c764){throw _0x25c764;});};exports[_0x6297('0x22')]=function(_0x33e078,_0x219381){return function(_0x44c41f,_0x249aa6,_0x362021){var _0x40c96e=_0x44c41f[_0x6297('0x10')];var _0x2a6bb7={};var _0x207b2c=_0x44c41f['query'];if(_0x2a6bb7){_0x2a6bb7=_[_0x6297('0x23')](_0x44c41f[_0x6297('0xb')]);_0x2a6bb7=_['omit'](_0x2a6bb7,['body',_0x6297('0x24'),_0x6297('0x25'),_0x6297('0x26'),_0x6297('0x27')]);}utils[_0x6297('0x28')](_0x40c96e,_0x2a6bb7,_0x207b2c,_0x33e078,_0x219381);_0x362021(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index b9bc7b5..34d4e2b 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8040=['isEmail','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','name','buildExpression','default','value','start','end','read','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','type','text','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','body','keys','some','compact','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','get','chat','Websites','i.secondDisposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','getInteractionFK','capitalize','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.thirdDisposition','i.ContactId','i.MailAccountId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','enableEmailPreview','all','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','color','from','tools_tags','user_has_','u.fullname','ui.','left_join','users','length','where','\x20IN\x20?','map','getInteractionsTables','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','it.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','includes','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?'];(function(_0xf76443,_0x89f4fb){var _0x5a704e=function(_0x3507d8){while(--_0x3507d8){_0xf76443['push'](_0xf76443['shift']());}};_0x5a704e(++_0x89f4fb);}(_0x8040,0x74));var _0x0804=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x8040[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require('lodash');var squel=require(_0x0804('0x0'));var as=require(_0x0804('0x1'));var qs=require(_0x0804('0x2'));var updateInteraction=require('./update-interaction')[_0x0804('0x3')];var utils=require(_0x0804('0x4'));var db=require(_0x0804('0x5'))['db'];function skipInteractionsQuery(_0x375fba,_0x291fae,_0x31bdec){var _0x2fe06a=![];var _0x431d89=utils[_0x0804('0x6')](_0x375fba);if(_0x291fae[_0x0804('0x7')]===_0x0804('0x8')&&!_0x31bdec[_0x0804('0x9')]&&!_0x31bdec[_0x431d89]){_0x2fe06a=!![];}return _0x2fe06a;}function getTagsQuery(){return squel[_0x0804('0xa')]()[_0x0804('0xb')]('id')[_0x0804('0xb')]('name')[_0x0804('0xb')](_0x0804('0xc'))[_0x0804('0xd')](_0x0804('0xe'));}function getUsersQuery(_0x12f857,_0x5d4238){var _0x25f00e=utils['getInteractionFK'](_0x12f857);var _0x2ac283=_0x0804('0xf')+_0x12f857+'_interactions';var _0x32f33e=squel[_0x0804('0xa')]()['field']('u.id')[_0x0804('0xb')](_0x0804('0x10'))[_0x0804('0xb')](_0x0804('0x11')+_0x25f00e)['from'](_0x2ac283,'ui')[_0x0804('0x12')](_0x0804('0x13'),'u','u.id\x20=\x20ui.UserId');if(_0x5d4238[_0x0804('0x14')]>0x0){_0x32f33e[_0x0804('0x15')](_0x0804('0x11')+_0x25f00e+_0x0804('0x16'),_[_0x0804('0x17')](_0x5d4238,'id'));}return _0x32f33e;}function getInteractionsQuery(_0x343ec1){var _0x339f25=utils[_0x0804('0x18')](_0x343ec1);var _0x1d244c=utils[_0x0804('0x6')](_0x343ec1);var _0x593cd2=utils['getInteractionFK'](_0x343ec1);return squel[_0x0804('0xa')]()[_0x0804('0xd')](_0x339f25['interactions'],'i')['left_join'](_0x0804('0x19'),'c',_0x0804('0x1a'))[_0x0804('0x12')](_0x0804('0x13'),'o',_0x0804('0x1b'))['left_join'](_0x339f25[_0x0804('0x1c')],'a',_0x0804('0x1d')+_0x1d244c)['left_join'](_0x339f25[_0x0804('0x1e')],'me','me.'+_0x593cd2+'\x20=\x20i.id')[_0x0804('0x12')](_0x339f25['interactionsTags'],'it',_0x0804('0x1f')+_0x593cd2+_0x0804('0x20'))[_0x0804('0x12')]('tools_tags','t',_0x0804('0x21'));}function getSqlClauses(){var _0x388e53={'body':squel[_0x0804('0x22')](),'contact':squel[_0x0804('0x22')](),'default':squel[_0x0804('0x22')](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel[_0x0804('0x22')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x0804('0x22')]()};return _0x388e53;}function parseTagParameter(_0x3577af){var _0xf25489=squel[_0x0804('0x22')]();if(_0x3577af){var _0x4c83fb=utils[_0x0804('0x23')](_0x3577af);_0x4c83fb[_0x0804('0x24')](function(_0x429899){_0xf25489['or'](_0x0804('0x25'),'%,'+_0x429899+',%');});}return _0xf25489;}function parseReadParameter(_0x2cdb64){var _0x12073a='';if(_0x2cdb64){_0x12073a=_0x0804('0x26');if(_0x2cdb64==='1'){_0x12073a=_0x12073a[_0x0804('0x27')](_0x0804('0x28'),'=');}else{_0x12073a=_0x12073a[_0x0804('0x27')]('{OPERATOR}','>');}}return _0x12073a;}function parseSearchFilter(_0xfaaa41,_0x5bade1){var _0x560046=squel['expr']();if(_0x5bade1){var _0x57a26c=_0x5bade1['replace']('\x5c','\x5c\x5c')[_0x0804('0x27')](/'/g,'\x27\x27');if(qs[_0x0804('0x29')](_0x57a26c)){_0x560046['or'](_0x0804('0x2a'),_0x57a26c+'%');if([_0x0804('0x2b'),'whatsapp'][_0x0804('0x2c')](_0xfaaa41)){_0x560046['or']('i.phone\x20LIKE\x20?',_0x57a26c+'%');}else if(_0xfaaa41===_0x0804('0x2d')){_0x560046['or'](_0x0804('0x2e'),_0x57a26c+'%');}else if(_0xfaaa41===_0x0804('0x2f')){_0x560046['or'](_0x0804('0x30'),_0x57a26c+'%');}}else if(_0xfaaa41==='mail'&&qs[_0x0804('0x31')](_0x57a26c)){_0x560046['or']('c.email\x20LIKE\x20?',_0x57a26c+'%');}else{if(_0xfaaa41===_0x0804('0x32')){_0x560046['or'](_0x0804('0x33'),qs['getFullTextValue'](_0x57a26c,!![]))['or'](_0x0804('0x34'),qs['getFullTextValue'](_0x57a26c));}else if(_0xfaaa41!=='fax'){_0x560046['or'](_0x0804('0x35'),qs[_0x0804('0x36')](_0x57a26c));}_0x560046['or'](_0x0804('0x37'),qs[_0x0804('0x36')](_0x57a26c,!![]),null);}}return _0x560046;}function parseAdvancedSearchFilter(_0x3ffac7,_0x118bb7){var _0x2bdc6b=getSqlClauses();var _0x420385=as[_0x0804('0x38')](_0x3ffac7);var _0x3c1053=_0x420385[_0x0804('0x39')];for(var _0x192cb1=0x0;_0x192cb1<_0x420385[_0x0804('0x3a')]['length'];_0x192cb1++){var _0x230c9f=_0x420385[_0x0804('0x3a')][_0x192cb1];var _0x183323='i';var _0x8406fb=_['find'](_0x118bb7,[_0x0804('0x3b'),_0x230c9f['field']]);if(_0x8406fb){var _0x4e9ad2=as[_0x0804('0x3c')](_0x183323,_0x8406fb['type'],_0x230c9f);_0x2bdc6b[_0x0804('0x3d')][_0x3c1053](_0x4e9ad2['text'],_0x4e9ad2[_0x0804('0x3e')][_0x0804('0x3f')],_0x4e9ad2[_0x0804('0x3e')][_0x0804('0x40')]);}else{switch(_0x230c9f[_0x0804('0xb')]){case'unreadMessages':var _0x28aeab=parseReadParameter(_0x230c9f[_0x0804('0x3e')]);_0x2bdc6b[_0x0804('0x41')][_0x0804('0x42')](_0x28aeab);break;case _0x0804('0x43'):if(_0x230c9f[_0x0804('0x44')]===_0x0804('0x45')){if(_0x230c9f[_0x0804('0x3e')][_0x0804('0x46')]('\x20')[_0x0804('0x14')]>0x1){_0x2bdc6b['contact'][_0x3c1053](_0x0804('0x37'),qs[_0x0804('0x36')](_0x230c9f[_0x0804('0x3e')],!![]),null);}else{var _0x31b590='%'+_0x230c9f[_0x0804('0x3e')]+'%';_0x2bdc6b[_0x0804('0x47')][_0x3c1053](_0x0804('0x48'),_0x31b590,_0x31b590,_0x31b590);}}else{_0x8406fb=_['find'](_0x118bb7,['name','ContactId']);_0x230c9f[_0x0804('0xb')]='ContactId';_0x4e9ad2=as[_0x0804('0x3c')](_0x183323,_0x8406fb[_0x0804('0x49')],_0x230c9f);_0x2bdc6b[_0x0804('0x47')][_0x3c1053](_0x4e9ad2[_0x0804('0x4a')],_0x4e9ad2[_0x0804('0x3e')][_0x0804('0x3f')],_0x4e9ad2[_0x0804('0x3e')][_0x0804('0x40')]);}break;case'Tag':var _0x8c88c3=_0x230c9f[_0x0804('0x3e')][_0x0804('0x46')](',')[_0x0804('0x17')](function(_0x42a332){return Number(_0x42a332);});var _0x390f26=parseTagParameter(_0x8c88c3);_0x2bdc6b['tags'][_0x0804('0x4b')]['and'](_0x390f26);_0x2bdc6b['tags'][_0x0804('0x4c')]=_0x8c88c3;break;case _0x0804('0x4d'):if(_0x230c9f[_0x0804('0x44')]==='$substring'){_0x2bdc6b[_0x0804('0x4e')][_0x3c1053](_0x0804('0x4f'),'%'+_0x230c9f['value']+'%',null);}else{_0x8406fb=_[_0x0804('0x50')](_0x118bb7,[_0x0804('0x3b'),_0x0804('0x51')]);_0x230c9f[_0x0804('0xb')]=_0x0804('0x51');_0x4e9ad2=as[_0x0804('0x3c')](_0x183323,_0x8406fb[_0x0804('0x49')],_0x230c9f);_0x2bdc6b[_0x0804('0x4e')][_0x3c1053](_0x4e9ad2[_0x0804('0x4a')],_0x4e9ad2[_0x0804('0x3e')][_0x0804('0x3f')],_0x4e9ad2[_0x0804('0x3e')][_0x0804('0x40')]);}break;case _0x0804('0x52'):case'plainBody':_0x4e9ad2=as[_0x0804('0x3c')]('me',null,_0x230c9f);_0x2bdc6b['body'][_0x3c1053](_0x4e9ad2['text'],_0x4e9ad2['value']['start'],_0x4e9ad2[_0x0804('0x3e')][_0x0804('0x40')]);break;}}}return _0x2bdc6b;}function parseModelFields(_0x327717,_0x52a621,_0x4758f2){var _0x4ae50f=utils[_0x0804('0x6')](_0x327717);var _0xed9b0b=squel['expr']();var _0x37f0dd=_(_0x52a621)[_0x0804('0x53')]()[_0x0804('0x17')](function(_0x4da5c0){return _[_0x0804('0x54')](_0x4758f2,[_0x0804('0x3b'),_0x4da5c0])?_0x4da5c0:undefined;})[_0x0804('0x55')]()['value']();if(_0x37f0dd[_0x0804('0x14')]>0x0){_0x37f0dd['forEach'](function(_0x46eb78){if(_0x46eb78===_0x4ae50f){_0xed9b0b['and']('i.'+_0x4ae50f+_0x0804('0x16'),[][_0x0804('0x56')](_0x52a621[_0x46eb78]));}else if(_0x46eb78===_0x0804('0x57')){var _0x38ea67=JSON[_0x0804('0x58')](_0x52a621[_0x46eb78])[_0x0804('0x59')];var _0x2e8404=JSON['parse'](_0x52a621[_0x46eb78])['$lte'];_0xed9b0b[_0x0804('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x38ea67,_0x2e8404);}else{if(_0x52a621[_0x46eb78]===_0x0804('0x5a')){_0xed9b0b[_0x0804('0x42')]('i.'+_0x46eb78+_0x0804('0x5b'));}else{_0xed9b0b[_0x0804('0x42')]('i.'+_0x46eb78+_0x0804('0x5c'),_0x52a621[_0x46eb78]);}}});}return _0xed9b0b;}function parseQueryParameters(_0xd248c8,_0x5473ad,_0x164898){var _0x51719c=getSqlClauses();return Promise[_0x0804('0x5d')]()[_0x0804('0x5e')](function(){return parseModelFields(_0xd248c8,_0x5473ad,_0x164898);})[_0x0804('0x5e')](function(_0x335151){_0x51719c[_0x0804('0x5f')][_0x0804('0x42')](_0x335151);return parseReadParameter(_0x5473ad[_0x0804('0x41')]);})[_0x0804('0x5e')](function(_0x35c007){_0x51719c[_0x0804('0x41')][_0x0804('0x42')](_0x35c007);return parseTagParameter(_0x5473ad[_0x0804('0x60')]);})[_0x0804('0x5e')](function(_0x477b1d){_0x51719c['tags'][_0x0804('0x4b')][_0x0804('0x42')](_0x477b1d);return parseSearchFilter(_0xd248c8,_0x5473ad[_0x0804('0x61')]);})[_0x0804('0x5e')](function(_0x1a359a){_0x51719c[_0x0804('0x61')]=_0x1a359a;return _0x51719c;});}function checkAccountsRestrictions(_0x4571af,_0x2cac1c,_0x524b72){var _0xd9fc31=utils[_0x0804('0x6')](_0x4571af);var _0x4c7d21=_0x0804('0x62')+_['capitalize'](_0x4571af)+(_0x4571af===_0x0804('0x63')?_0x0804('0x64'):'Accounts');var _0x1a3cfc=squel[_0x0804('0x22')]();return Promise[_0x0804('0x5d')]()[_0x0804('0x5e')](function(){if(_0x524b72[_0x0804('0x9')]&&_0x2cac1c['role']==='agent'){return _0x2cac1c[_0x4c7d21]({'attributes':['id'],'raw':!![]});}})[_0x0804('0x5e')](function(_0x11875c){if(_0x11875c){if(_0x11875c['length']===0x0){_0x1a3cfc['and']('i.'+_0xd9fc31+_0x0804('0x5b'));}else{_0x1a3cfc[_0x0804('0x42')]('i.'+_0xd9fc31+_0x0804('0x16'),_['map'](_0x11875c,'id'));}}else if(!_0x524b72[_0xd9fc31]){_0x1a3cfc[_0x0804('0x42')]('i.'+_0xd9fc31+'\x20IS\x20NOT\x20NULL');}})[_0x0804('0x5e')](function(){return _0x1a3cfc;});}function getClosedOrderClause(_0x1e6d28,_0x212cdf){var _0x10e069='';var _0xe34eb=['i.thirdDisposition',_0x0804('0x65'),'i.disposition'];if(_0x1e6d28==='mail'){_0xe34eb['unshift'](_0x0804('0x66'));}if(_0x212cdf['closed']==='0'&&_0x1e6d28===_0x0804('0x32')){_0x10e069=_0x0804('0x66');}else{if(_0x212cdf[_0x0804('0x67')]==='1'){_0xe34eb[_0x0804('0x68')]();}_0x10e069=_0x0804('0x69')+_0xe34eb['join'](',\x20')+')';}return _0x10e069;}function getFilteredInteractions(_0x2df169,_0x319cb3,_0x2dbeb4,_0x23c906){var _0x34b647=utils[_0x0804('0x6a')](_0x2df169);var _0x48b132=_[_0x0804('0x6b')](_0x2df169)+_0x0804('0x6c');var _0x5b08fb=[];var _0x2ca634=getTagsQuery();var _0x322dce={'type':db[_0x0804('0x6d')][_0x0804('0x6e')][_0x0804('0x6f')],'raw':!![]};var _0x149331=[];var _0x1a9790=[];return db[_0x0804('0x70')][_0x0804('0x71')](_0x2ca634[_0x0804('0x72')](),_0x322dce)[_0x0804('0x5e')](function(_0x2fa701){_0x5b08fb=_[_0x0804('0x73')](_0x2fa701,'id');_0x322dce=_[_0x0804('0x74')](_0x322dce,{'model':db[_0x48b132],'mapToModel':!![],'nest':!![]});if(_0x2dbeb4[_0x0804('0x5f')]){_0x23c906[_0x0804('0x75')][_0x0804('0x24')](function(_0x4fc88d){_0x319cb3[_0x0804('0xb')]('i.'+_0x4fc88d);});}else{_0x319cb3[_0x0804('0xb')](_0x0804('0x76'),_0x0804('0x77'));_0x319cb3[_0x0804('0xb')](_0x0804('0x78'),_0x0804('0x79'));_0x319cb3[_0x0804('0xb')](_0x0804('0x7a'),_0x0804('0x7b'));if(_0x2df169==='mail'){_0x319cb3[_0x0804('0xb')](_0x0804('0x7c'),_0x0804('0x7d'));_0x319cb3[_0x0804('0xb')](_0x0804('0x7e'),_0x0804('0x7f'));_0x319cb3[_0x0804('0xb')]('i.id');_0x319cb3[_0x0804('0xb')](_0x0804('0x80'));_0x319cb3[_0x0804('0xb')](_0x0804('0x81'));_0x319cb3[_0x0804('0xb')](_0x0804('0x82'));_0x319cb3[_0x0804('0xb')](_0x0804('0x83'));_0x319cb3[_0x0804('0xb')]('i.attach');_0x319cb3[_0x0804('0xb')](_0x0804('0x84'));_0x319cb3['field'](_0x0804('0x85'));_0x319cb3[_0x0804('0xb')]('i.subject');_0x319cb3[_0x0804('0xb')](_0x0804('0x86'));_0x319cb3[_0x0804('0xb')](_0x0804('0x65'));_0x319cb3[_0x0804('0xb')](_0x0804('0x87'));_0x319cb3['field'](_0x0804('0x66'));_0x319cb3[_0x0804('0xb')]('i.to');_0x319cb3['field'](_0x0804('0x88'));_0x319cb3[_0x0804('0xb')](_0x0804('0x89'));_0x319cb3['field']('i.UserId');}else if(_0x2df169===_0x0804('0x2f')){_0x319cb3[_0x0804('0xb')](_0x0804('0x8a'),_0x0804('0x7f'));}else{_0x319cb3[_0x0804('0xb')](_0x0804('0x8b'),_0x0804('0x7f'));}if(_0x2df169!==_0x0804('0x32')){_0x319cb3[_0x0804('0xb')]('i.*');}_0x319cb3[_0x0804('0xb')]('c.firstName',_0x0804('0x8c'));_0x319cb3[_0x0804('0xb')](_0x0804('0x8d'),_0x0804('0x8e'));_0x319cb3['field'](_0x0804('0x8f'),_0x0804('0x90'));_0x319cb3[_0x0804('0xb')]('c.phone',_0x0804('0x91'));_0x319cb3[_0x0804('0xb')](_0x0804('0x92'),_0x0804('0x93'));_0x319cb3['field'](_0x0804('0x94'),_0x0804('0x95'));_0x319cb3['field'](_0x0804('0x96'),_0x0804('0x97'));_0x319cb3[_0x0804('0xb')](_0x0804('0x98'),'Owner.internal');_0x319cb3[_0x0804('0xb')](_0x0804('0x99'),_0x0804('0x9a'));}if(_0x23c906[_0x0804('0x9b')]){_0x319cb3[_0x0804('0x9b')](_0x23c906[_0x0804('0x9b')]);}if(_0x23c906[_0x0804('0x9c')]){_0x319cb3['offset'](_0x23c906['offset']);}return db[_0x0804('0x70')][_0x0804('0x71')](_0x319cb3[_0x0804('0x72')](),_0x322dce);})[_0x0804('0x5e')](function(_0x3d2b69){_0x149331=_0x3d2b69;var _0x25132a=getUsersQuery(_0x2df169,_0x149331);return db[_0x0804('0x70')]['query'](_0x25132a['toString'](),_0x322dce);})[_0x0804('0x5e')](function(_0x3621b4){_0x1a9790=_[_0x0804('0x9d')](_0x3621b4,_0x34b647);if(_0x2df169===_0x0804('0x32')){return db[_0x0804('0x9e')]['findOne']({'attributes':[_0x0804('0x9f')],'raw':!![]});}})[_0x0804('0x5e')](function(_0x197c5d){var _0x5638d2=_0x197c5d?_0x197c5d[_0x0804('0x9f')]:undefined;var _0x5e8a5f=_0x149331['map'](function(_0x3e319a){return updateInteraction(_0x3e319a,_0x5b08fb,_0x1a9790,_0x5638d2);});return Promise[_0x0804('0xa0')](_0x5e8a5f);});}function countFilteredInteractions(_0x4d7e30,_0x3b87d8){var _0x1543d0=_0x4d7e30['clone']();_0x1543d0[_0x0804('0xb')](_0x0804('0xa1'));_0x1543d0[_0x0804('0xb')](_0x0804('0x76'),_0x0804('0x77'));var _0x34e309=utils[_0x0804('0x23')](_0x3b87d8);if(!_[_0x0804('0xa2')](_0x34e309)){_0x1543d0[_0x0804('0x15')](_0x0804('0xa3'),_0x34e309);}var _0x4fbe08={'type':db[_0x0804('0x6d')][_0x0804('0x6e')]['SELECT'],'raw':!![]};return db['sequelize'][_0x0804('0x71')](_0x1543d0['toString'](),_0x4fbe08);}module[_0x0804('0xa4')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x4f9f=['includes','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','length','find','type','default','text','value','unreadMessages','read','and','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','end','Tag','clause','tags','ids','User','user','UserId','body','keys','some','concat','createdAt','parse','$gte','$lte','\x20IS\x20NULL','\x20=\x20?','then','fields','tag','filter','get','capitalize','chat','resolve','i.secondDisposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','Account.email','contactName','i.id','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','toString','groupBy','Setting','enableEmailPreview','all','clone','COUNT(*)','t.id\x20IN\x20?','exports','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','_interactions','u.id','ui.','users','u.id\x20=\x20ui.UserId','where','\x20IN\x20?','map','getInteractionsTables','interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x4f9f,0x1bd));var _0xf4f9=function(_0x2a1db6,_0x5bd31a){_0x2a1db6=_0x2a1db6-0x0;var _0x41d420=_0x4f9f[_0x2a1db6];return _0x41d420;};'use strict';var _=require('lodash');var squel=require(_0xf4f9('0x0'));var as=require(_0xf4f9('0x1'));var qs=require(_0xf4f9('0x2'));var updateInteraction=require(_0xf4f9('0x3'))['updateInteraction'];var utils=require(_0xf4f9('0x4'));var db=require(_0xf4f9('0x5'))['db'];function skipInteractionsQuery(_0xac633d,_0x228dce,_0x3cacd5){var _0x124109=![];var _0x6319c3=utils[_0xf4f9('0x6')](_0xac633d);if(_0x228dce[_0xf4f9('0x7')]===_0xf4f9('0x8')&&!_0x3cacd5[_0xf4f9('0x9')]&&!_0x3cacd5[_0x6319c3]){_0x124109=!![];}return _0x124109;}function getTagsQuery(){return squel[_0xf4f9('0xa')]()[_0xf4f9('0xb')]('id')['field'](_0xf4f9('0xc'))[_0xf4f9('0xb')](_0xf4f9('0xd'))[_0xf4f9('0xe')](_0xf4f9('0xf'));}function getUsersQuery(_0x40d9ec,_0x588b23){var _0x1599ef=utils[_0xf4f9('0x10')](_0x40d9ec);var _0x480f5f='user_has_'+_0x40d9ec+_0xf4f9('0x11');var _0x3cbc98=squel[_0xf4f9('0xa')]()[_0xf4f9('0xb')](_0xf4f9('0x12'))[_0xf4f9('0xb')]('u.fullname')[_0xf4f9('0xb')](_0xf4f9('0x13')+_0x1599ef)[_0xf4f9('0xe')](_0x480f5f,'ui')['left_join'](_0xf4f9('0x14'),'u',_0xf4f9('0x15'));if(_0x588b23['length']>0x0){_0x3cbc98[_0xf4f9('0x16')](_0xf4f9('0x13')+_0x1599ef+_0xf4f9('0x17'),_[_0xf4f9('0x18')](_0x588b23,'id'));}return _0x3cbc98;}function getInteractionsQuery(_0x1c8b0b){var _0x443dfe=utils[_0xf4f9('0x19')](_0x1c8b0b);var _0x3b0be2=utils[_0xf4f9('0x6')](_0x1c8b0b);var _0x598cbf=utils['getInteractionFK'](_0x1c8b0b);return squel[_0xf4f9('0xa')]()[_0xf4f9('0xe')](_0x443dfe[_0xf4f9('0x1a')],'i')[_0xf4f9('0x1b')](_0xf4f9('0x1c'),'c',_0xf4f9('0x1d'))[_0xf4f9('0x1b')]('users','o',_0xf4f9('0x1e'))['left_join'](_0x443dfe[_0xf4f9('0x1f')],'a',_0xf4f9('0x20')+_0x3b0be2)[_0xf4f9('0x1b')](_0x443dfe[_0xf4f9('0x21')],'me',_0xf4f9('0x22')+_0x598cbf+_0xf4f9('0x23'))['left_join'](_0x443dfe[_0xf4f9('0x24')],'it','it.'+_0x598cbf+_0xf4f9('0x23'))['left_join'](_0xf4f9('0xf'),'t',_0xf4f9('0x25'));}function getSqlClauses(){var _0x47f546={'body':squel['expr'](),'contact':squel[_0xf4f9('0x26')](),'default':squel[_0xf4f9('0x26')](),'fields':squel[_0xf4f9('0x26')](),'filter':squel['expr'](),'read':squel[_0xf4f9('0x26')](),'tags':{'clause':squel[_0xf4f9('0x26')](),'ids':null},'user':squel['expr']()};return _0x47f546;}function parseTagParameter(_0x37af5d){var _0xe715ca=squel[_0xf4f9('0x26')]();if(_0x37af5d){var _0x1ebc4f=utils[_0xf4f9('0x27')](_0x37af5d);_0x1ebc4f[_0xf4f9('0x28')](function(_0x4b5a67){_0xe715ca['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4b5a67+',%');});}return _0xe715ca;}function parseReadParameter(_0x19f5b7){var _0x10f11f='';if(_0x19f5b7){_0x10f11f='unreadMessages\x20{OPERATOR}\x200';if(_0x19f5b7==='1'){_0x10f11f=_0x10f11f[_0xf4f9('0x29')](_0xf4f9('0x2a'),'=');}else{_0x10f11f=_0x10f11f[_0xf4f9('0x29')](_0xf4f9('0x2a'),'>');}}return _0x10f11f;}function parseSearchFilter(_0x1d6660,_0x24d5d5){var _0x3bd653=squel[_0xf4f9('0x26')]();if(_0x24d5d5){var _0x43160f=_0x24d5d5[_0xf4f9('0x29')]('\x5c','\x5c\x5c')[_0xf4f9('0x29')](/'/g,'\x27\x27');if(qs[_0xf4f9('0x2b')](_0x43160f)){_0x3bd653['or'](_0xf4f9('0x2c'),_0x43160f+'%');if([_0xf4f9('0x2d'),_0xf4f9('0x2e')][_0xf4f9('0x2f')](_0x1d6660)){_0x3bd653['or']('i.phone\x20LIKE\x20?',_0x43160f+'%');}else if(_0x1d6660===_0xf4f9('0x30')){_0x3bd653['or'](_0xf4f9('0x31'),_0x43160f+'%');}else if(_0x1d6660===_0xf4f9('0x32')){_0x3bd653['or'](_0xf4f9('0x33'),_0x43160f+'%');}}else if(_0x1d6660===_0xf4f9('0x34')&&qs[_0xf4f9('0x35')](_0x43160f)){_0x3bd653['or'](_0xf4f9('0x36'),_0x43160f+'%');}else{if(_0x1d6660===_0xf4f9('0x34')){_0x3bd653['or'](_0xf4f9('0x37'),qs[_0xf4f9('0x38')](_0x43160f,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf4f9('0x38')](_0x43160f));}else if(_0x1d6660!==_0xf4f9('0x30')){_0x3bd653['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf4f9('0x38')](_0x43160f));}_0x3bd653['or'](_0xf4f9('0x39'),qs[_0xf4f9('0x38')](_0x43160f,!![]),null);}}return _0x3bd653;}function parseAdvancedSearchFilter(_0x36345c,_0x524df8){var _0x24023a=getSqlClauses();var _0x3d0e81=as[_0xf4f9('0x3a')](_0x36345c);var _0x4be18e=_0x3d0e81[_0xf4f9('0x3b')];for(var _0x363bde=0x0;_0x363bde<_0x3d0e81[_0xf4f9('0x3c')][_0xf4f9('0x3d')];_0x363bde++){var _0x4759a8=_0x3d0e81[_0xf4f9('0x3c')][_0x363bde];var _0x29d63d='i';var _0x284ff2=_[_0xf4f9('0x3e')](_0x524df8,[_0xf4f9('0xc'),_0x4759a8[_0xf4f9('0xb')]]);if(_0x284ff2){var _0x43822a=as['buildExpression'](_0x29d63d,_0x284ff2[_0xf4f9('0x3f')],_0x4759a8);_0x24023a[_0xf4f9('0x40')][_0x4be18e](_0x43822a[_0xf4f9('0x41')],_0x43822a[_0xf4f9('0x42')]['start'],_0x43822a[_0xf4f9('0x42')]['end']);}else{switch(_0x4759a8[_0xf4f9('0xb')]){case _0xf4f9('0x43'):var _0x303425=parseReadParameter(_0x4759a8[_0xf4f9('0x42')]);_0x24023a[_0xf4f9('0x44')][_0xf4f9('0x45')](_0x303425);break;case'Contact':if(_0x4759a8[_0xf4f9('0x46')]===_0xf4f9('0x47')){if(_0x4759a8[_0xf4f9('0x42')][_0xf4f9('0x48')]('\x20')[_0xf4f9('0x3d')]>0x1){_0x24023a[_0xf4f9('0x49')][_0x4be18e](_0xf4f9('0x39'),qs[_0xf4f9('0x38')](_0x4759a8[_0xf4f9('0x42')],!![]),null);}else{var _0x386b46='%'+_0x4759a8['value']+'%';_0x24023a[_0xf4f9('0x49')][_0x4be18e](_0xf4f9('0x4a'),_0x386b46,_0x386b46,_0x386b46);}}else{_0x284ff2=_['find'](_0x524df8,[_0xf4f9('0xc'),_0xf4f9('0x4b')]);_0x4759a8['field']='ContactId';_0x43822a=as[_0xf4f9('0x4c')](_0x29d63d,_0x284ff2[_0xf4f9('0x3f')],_0x4759a8);_0x24023a[_0xf4f9('0x49')][_0x4be18e](_0x43822a[_0xf4f9('0x41')],_0x43822a[_0xf4f9('0x42')][_0xf4f9('0x4d')],_0x43822a[_0xf4f9('0x42')][_0xf4f9('0x4e')]);}break;case _0xf4f9('0x4f'):var _0x2e6313=_0x4759a8[_0xf4f9('0x42')]['split'](',')[_0xf4f9('0x18')](function(_0x23f225){return Number(_0x23f225);});var _0x446831=parseTagParameter(_0x2e6313);_0x24023a['tags'][_0xf4f9('0x50')][_0xf4f9('0x45')](_0x446831);_0x24023a[_0xf4f9('0x51')][_0xf4f9('0x52')]=_0x2e6313;break;case _0xf4f9('0x53'):if(_0x4759a8[_0xf4f9('0x46')]===_0xf4f9('0x47')){_0x24023a[_0xf4f9('0x54')][_0x4be18e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4759a8['value']+'%',null);}else{_0x284ff2=_[_0xf4f9('0x3e')](_0x524df8,[_0xf4f9('0xc'),_0xf4f9('0x55')]);_0x4759a8[_0xf4f9('0xb')]=_0xf4f9('0x55');_0x43822a=as['buildExpression'](_0x29d63d,_0x284ff2[_0xf4f9('0x3f')],_0x4759a8);_0x24023a[_0xf4f9('0x54')][_0x4be18e](_0x43822a[_0xf4f9('0x41')],_0x43822a[_0xf4f9('0x42')][_0xf4f9('0x4d')],_0x43822a[_0xf4f9('0x42')][_0xf4f9('0x4e')]);}break;case _0xf4f9('0x56'):case'plainBody':_0x43822a=as[_0xf4f9('0x4c')]('me',null,_0x4759a8);_0x24023a[_0xf4f9('0x56')][_0x4be18e](_0x43822a[_0xf4f9('0x41')],_0x43822a['value'][_0xf4f9('0x4d')],_0x43822a[_0xf4f9('0x42')][_0xf4f9('0x4e')]);break;}}}return _0x24023a;}function parseModelFields(_0x2f1265,_0x4cf901,_0x512a45){var _0x31086e=utils[_0xf4f9('0x6')](_0x2f1265);var _0x119cb6=squel[_0xf4f9('0x26')]();var _0x1e0962=_(_0x4cf901)[_0xf4f9('0x57')]()['map'](function(_0x1efa5b){return _[_0xf4f9('0x58')](_0x512a45,[_0xf4f9('0xc'),_0x1efa5b])?_0x1efa5b:undefined;})['compact']()[_0xf4f9('0x42')]();if(_0x1e0962[_0xf4f9('0x3d')]>0x0){_0x1e0962[_0xf4f9('0x28')](function(_0x28e497){if(_0x28e497===_0x31086e){_0x119cb6[_0xf4f9('0x45')]('i.'+_0x31086e+_0xf4f9('0x17'),[][_0xf4f9('0x59')](_0x4cf901[_0x28e497]));}else if(_0x28e497===_0xf4f9('0x5a')){var _0x3ee00d=JSON[_0xf4f9('0x5b')](_0x4cf901[_0x28e497])[_0xf4f9('0x5c')];var _0x527082=JSON['parse'](_0x4cf901[_0x28e497])[_0xf4f9('0x5d')];_0x119cb6['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3ee00d,_0x527082);}else{if(_0x4cf901[_0x28e497]==='null'){_0x119cb6[_0xf4f9('0x45')]('i.'+_0x28e497+_0xf4f9('0x5e'));}else{_0x119cb6[_0xf4f9('0x45')]('i.'+_0x28e497+_0xf4f9('0x5f'),_0x4cf901[_0x28e497]);}}});}return _0x119cb6;}function parseQueryParameters(_0x45375b,_0x525bd0,_0x5c7874){var _0x308213=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x45375b,_0x525bd0,_0x5c7874);})[_0xf4f9('0x60')](function(_0xec58b5){_0x308213[_0xf4f9('0x61')][_0xf4f9('0x45')](_0xec58b5);return parseReadParameter(_0x525bd0[_0xf4f9('0x44')]);})[_0xf4f9('0x60')](function(_0x3537ce){_0x308213['read'][_0xf4f9('0x45')](_0x3537ce);return parseTagParameter(_0x525bd0[_0xf4f9('0x62')]);})[_0xf4f9('0x60')](function(_0x303cdb){_0x308213[_0xf4f9('0x51')][_0xf4f9('0x50')]['and'](_0x303cdb);return parseSearchFilter(_0x45375b,_0x525bd0[_0xf4f9('0x63')]);})['then'](function(_0x44ea07){_0x308213[_0xf4f9('0x63')]=_0x44ea07;return _0x308213;});}function checkAccountsRestrictions(_0x439918,_0x5ece9d,_0x2da388){var _0x4800e4=utils[_0xf4f9('0x6')](_0x439918);var _0x5dc498=_0xf4f9('0x64')+_[_0xf4f9('0x65')](_0x439918)+(_0x439918===_0xf4f9('0x66')?'Websites':'Accounts');var _0x1e8421=squel['expr']();return Promise[_0xf4f9('0x67')]()[_0xf4f9('0x60')](function(){if(_0x2da388[_0xf4f9('0x9')]&&_0x5ece9d['role']===_0xf4f9('0x8')){return _0x5ece9d[_0x5dc498]({'attributes':['id'],'raw':!![]});}})[_0xf4f9('0x60')](function(_0x26f5b){if(_0x26f5b){if(_0x26f5b[_0xf4f9('0x3d')]===0x0){_0x1e8421[_0xf4f9('0x45')]('i.'+_0x4800e4+'\x20IS\x20NULL');}else{_0x1e8421[_0xf4f9('0x45')]('i.'+_0x4800e4+'\x20IN\x20?',_[_0xf4f9('0x18')](_0x26f5b,'id'));}}else if(!_0x2da388[_0x4800e4]){_0x1e8421[_0xf4f9('0x45')]('i.'+_0x4800e4+'\x20IS\x20NOT\x20NULL');}})[_0xf4f9('0x60')](function(){return _0x1e8421;});}function getClosedOrderClause(_0x335807,_0x43b4d9){var _0x353bb5='';var _0x401475=['i.thirdDisposition',_0xf4f9('0x68'),'i.disposition'];if(_0x335807===_0xf4f9('0x34')){_0x401475[_0xf4f9('0x69')](_0xf4f9('0x6a'));}if(_0x43b4d9['closed']==='0'&&_0x335807==='mail'){_0x353bb5=_0xf4f9('0x6a');}else{if(_0x43b4d9[_0xf4f9('0x6b')]==='1'){_0x401475['shift']();}_0x353bb5=_0xf4f9('0x6c')+_0x401475[_0xf4f9('0x6d')](',\x20')+')';}return _0x353bb5;}function getFilteredInteractions(_0x9b2bc4,_0xe8938a,_0x4aa5b3,_0x1fde21){var _0x1389fc=utils[_0xf4f9('0x10')](_0x9b2bc4);var _0xe4b7d7=_[_0xf4f9('0x65')](_0x9b2bc4)+_0xf4f9('0x6e');var _0xa0bf7f=[];var _0x11f184=getTagsQuery();var _0xd8ee3b={'type':db[_0xf4f9('0x6f')][_0xf4f9('0x70')][_0xf4f9('0x71')],'raw':!![]};var _0x38c847=[];var _0x32b20f=[];return db[_0xf4f9('0x72')][_0xf4f9('0x73')](_0x11f184['toString'](),_0xd8ee3b)['then'](function(_0x543134){_0xa0bf7f=_['keyBy'](_0x543134,'id');_0xd8ee3b=_[_0xf4f9('0x74')](_0xd8ee3b,{'model':db[_0xe4b7d7],'mapToModel':!![],'nest':!![]});if(_0x4aa5b3[_0xf4f9('0x61')]){_0x1fde21[_0xf4f9('0x75')]['forEach'](function(_0x394f56){_0xe8938a[_0xf4f9('0xb')]('i.'+_0x394f56);});}else{_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x76'),'unreadMessages');_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x77'),'Account.key');_0xe8938a['field'](_0xf4f9('0x78'),_0xf4f9('0x79'));if(_0x9b2bc4===_0xf4f9('0x34')){_0xe8938a[_0xf4f9('0xb')]('a.email',_0xf4f9('0x7a'));_0xe8938a[_0xf4f9('0xb')]('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',_0xf4f9('0x7b'));_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x7c'));_0xe8938a[_0xf4f9('0xb')]('i.createdAt');_0xe8938a['field'](_0xf4f9('0x7d'));_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x7e'));_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x7f'));_0xe8938a['field'](_0xf4f9('0x80'));_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x81'));_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x82'));_0xe8938a['field'](_0xf4f9('0x83'));_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x84'));_0xe8938a['field']('i.secondDisposition');_0xe8938a['field'](_0xf4f9('0x85'));_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x6a'));_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x86'));_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x87'));_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x88'));_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x89'));}else if(_0x9b2bc4===_0xf4f9('0x32')){_0xe8938a['field']('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');}else{_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x8a'),_0xf4f9('0x7b'));}if(_0x9b2bc4!==_0xf4f9('0x34')){_0xe8938a['field'](_0xf4f9('0x8b'));}_0xe8938a[_0xf4f9('0xb')]('c.firstName',_0xf4f9('0x8c'));_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x8d'),_0xf4f9('0x8e'));_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x8f'),_0xf4f9('0x90'));_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x91'),_0xf4f9('0x92'));_0xe8938a[_0xf4f9('0xb')]('c.mobile',_0xf4f9('0x93'));_0xe8938a[_0xf4f9('0xb')]('c.fax',_0xf4f9('0x94'));_0xe8938a['field']('o.fullname',_0xf4f9('0x95'));_0xe8938a[_0xf4f9('0xb')]('o.internal',_0xf4f9('0x96'));_0xe8938a[_0xf4f9('0xb')](_0xf4f9('0x97'),_0xf4f9('0x98'));}if(_0x1fde21[_0xf4f9('0x99')]){_0xe8938a[_0xf4f9('0x99')](_0x1fde21['limit']);}if(_0x1fde21[_0xf4f9('0x9a')]){_0xe8938a[_0xf4f9('0x9a')](_0x1fde21[_0xf4f9('0x9a')]);}return db[_0xf4f9('0x72')][_0xf4f9('0x73')](_0xe8938a[_0xf4f9('0x9b')](),_0xd8ee3b);})[_0xf4f9('0x60')](function(_0x33e017){_0x38c847=_0x33e017;var _0x572f19=getUsersQuery(_0x9b2bc4,_0x38c847);return db[_0xf4f9('0x72')][_0xf4f9('0x73')](_0x572f19['toString'](),_0xd8ee3b);})[_0xf4f9('0x60')](function(_0x1115cf){_0x32b20f=_[_0xf4f9('0x9c')](_0x1115cf,_0x1389fc);if(_0x9b2bc4===_0xf4f9('0x34')){return db[_0xf4f9('0x9d')]['findOne']({'attributes':[_0xf4f9('0x9e')],'raw':!![]});}})['then'](function(_0x310de9){var _0x41c933=_0x310de9?_0x310de9[_0xf4f9('0x9e')]:undefined;var _0x2142e2=_0x38c847[_0xf4f9('0x18')](function(_0x303c5f){return updateInteraction(_0x303c5f,_0xa0bf7f,_0x32b20f,_0x41c933);});return Promise[_0xf4f9('0x9f')](_0x2142e2);});}function countFilteredInteractions(_0x1323e1,_0x25c506){var _0x41fc88=_0x1323e1[_0xf4f9('0xa0')]();_0x41fc88[_0xf4f9('0xb')](_0xf4f9('0xa1'));_0x41fc88[_0xf4f9('0xb')](_0xf4f9('0x76'),_0xf4f9('0x43'));var _0x29e49a=utils[_0xf4f9('0x27')](_0x25c506);if(!_['isEmpty'](_0x29e49a)){_0x41fc88[_0xf4f9('0x16')](_0xf4f9('0xa2'),_0x29e49a);}var _0x3e1f8d={'type':db['Sequelize'][_0xf4f9('0x70')][_0xf4f9('0x71')],'raw':!![]};return db['sequelize']['query'](_0x41fc88[_0xf4f9('0x9b')](),_0x3e1f8d);}module[_0xf4f9('0xa3')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index e47c3d9..637240c 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 _0xfed2=['findOne','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash','../../mysqldb','map','fullname','forEach','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage'];(function(_0x2c09f6,_0xa8d56d){var _0xce0246=function(_0x39505f){while(--_0x39505f){_0x2c09f6['push'](_0x2c09f6['shift']());}};_0xce0246(++_0xa8d56d);}(_0xfed2,0x143));var _0x2fed=function(_0x4da7a8,_0x41a631){_0x4da7a8=_0x4da7a8-0x0;var _0x2d5a1a=_0xfed2[_0x4da7a8];return _0x2d5a1a;};'use strict';var _=require(_0x2fed('0x0'));var db=require(_0x2fed('0x1'))['db'];function getInteractionUsers(_0x3269ac,_0x12d931){return new Promise(function(_0x5775c4,_0x173577){try{var _0x41222e=[];if(_0x12d931[_0x3269ac]){_0x41222e=_0x12d931[_0x3269ac][_0x2fed('0x2')](function(_0x2d5354){return{'id':_0x2d5354['id'],'fullname':_0x2d5354[_0x2fed('0x3')]};});}return _0x5775c4(_0x41222e);}catch(_0x4ce116){_0x173577(_0x4ce116);}});}function getInteractionTags(_0x352d9d,_0x4cafd4){var _0x3a1c5a=[];if(_0x352d9d){_0x352d9d['split'](',')[_0x2fed('0x4')](function(_0x48163f){_0x3a1c5a['push'](_0x4cafd4[_0x48163f]);});}return _0x3a1c5a;}function updateWaitingCounter(_0x4600da){if(_0x4600da[_0x2fed('0x5')]){_0x4600da[_0x2fed('0x5')]-=0x1;}}function updateInteractionCounters(_0x3de68e){_0x3de68e['waiting']=0x0;_0x3de68e[_0x2fed('0x6')]=0x0;_0x3de68e[_0x2fed('0x7')]=0x0;_0x3de68e[_0x2fed('0x8')]=0x0;_0x3de68e[_0x2fed('0x9')]=0x0;_0x3de68e[_0x2fed('0xa')]=0x0;if(_0x3de68e[_0x2fed('0xb')]){if(_0x3de68e[_0x2fed('0xc')]===_0x2fed('0x9')){_0x3de68e[_0x2fed('0x9')]+=0x1;updateWaitingCounter(_0x3de68e);}if(_0x3de68e[_0x2fed('0xd')]){_0x3de68e[_0x2fed('0x7')]+=0x1;if(_0x3de68e[_0x2fed('0x6')]){_0x3de68e['talking']-=0x1;}}else{if(_0x3de68e[_0x2fed('0xc')]){_0x3de68e[_0x2fed('0x8')]+=0x1;updateWaitingCounter(_0x3de68e);}}}else{if(!_0x3de68e[_0x2fed('0xd')]){_0x3de68e[_0x2fed('0x5')]+=0x1;}if(_0x3de68e[_0x2fed('0xd')]){_0x3de68e['talking']+=0x1;updateWaitingCounter(_0x3de68e);}}_0x3de68e[_0x2fed('0xa')]+=0x1;return _0x3de68e;}function getLastMessageText(_0x1a34cc){return db[_0x2fed('0xe')][_0x2fed('0xf')]({'where':{'$and':[{'MailInteractionId':_0x1a34cc['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x2fed('0x10')],'order':_0x2fed('0x11'),'raw':!![]})[_0x2fed('0x12')](function(_0xb54060){if(_0xb54060&&_0xb54060[_0x2fed('0x10')]){_0x1a34cc[_0x2fed('0x13')]=_[_0x2fed('0x14')](_0xb54060[_0x2fed('0x10')]);}return _0x1a34cc;})[_0x2fed('0x15')](function(_0x3ddbc6){throw _0x3ddbc6;});}exports[_0x2fed('0x16')]=function(_0x4e4691,_0x4ebd4e,_0x1a9e8a,_0x383dfc){return new Promise(function(_0x21043d,_0x409f2d){return getInteractionUsers(_0x4e4691['id'],_0x1a9e8a)['then'](function(_0x463f52){_0x4e4691[_0x2fed('0x17')]=_0x463f52;return getInteractionTags(_0x4e4691[_0x2fed('0x18')],_0x4ebd4e);})[_0x2fed('0x12')](function(_0x54e3b3){_0x4e4691[_0x2fed('0x19')]=_0x54e3b3;delete _0x4e4691[_0x2fed('0x18')];return updateInteractionCounters(_0x4e4691);})['then'](function(_0xb05982){if(_0x383dfc){return getLastMessageText(_0xb05982);}else{return _0xb05982;}})[_0x2fed('0x12')](function(_0x99ce6c){_0x21043d(_0x99ce6c);})[_0x2fed('0x15')](function(_0x2f9f5e){_0x409f2d(_0x2f9f5e);});});}; \ No newline at end of file +var _0x57ea=['fullname','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','plainBody','then','lastMsgText','catch','updateInteraction','Users','TagIds','lodash','map'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x57ea,0x1b7));var _0xa57e=function(_0x2b6b89,_0x172ec0){_0x2b6b89=_0x2b6b89-0x0;var _0x5aa6af=_0x57ea[_0x2b6b89];return _0x5aa6af;};'use strict';var _=require(_0xa57e('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x2cd9b9,_0x9409f3){return new Promise(function(_0x5b14bb,_0x25c6f3){try{var _0x594a74=[];if(_0x9409f3[_0x2cd9b9]){_0x594a74=_0x9409f3[_0x2cd9b9][_0xa57e('0x1')](function(_0x4cb7ec){return{'id':_0x4cb7ec['id'],'fullname':_0x4cb7ec[_0xa57e('0x2')]};});}return _0x5b14bb(_0x594a74);}catch(_0x2445e5){_0x25c6f3(_0x2445e5);}});}function getInteractionTags(_0x307973,_0x4ec90f){var _0x12ad08=[];if(_0x307973){_0x307973['split'](',')['forEach'](function(_0x5f4f5b){_0x12ad08[_0xa57e('0x3')](_0x4ec90f[_0x5f4f5b]);});}return _0x12ad08;}function updateWaitingCounter(_0x2c23d0){if(_0x2c23d0['waiting']){_0x2c23d0[_0xa57e('0x4')]-=0x1;}}function updateInteractionCounters(_0x157a62){_0x157a62[_0xa57e('0x4')]=0x0;_0x157a62[_0xa57e('0x5')]=0x0;_0x157a62[_0xa57e('0x6')]=0x0;_0x157a62[_0xa57e('0x7')]=0x0;_0x157a62[_0xa57e('0x8')]=0x0;_0x157a62[_0xa57e('0x9')]=0x0;if(_0x157a62[_0xa57e('0xa')]){if(_0x157a62[_0xa57e('0xb')]===_0xa57e('0x8')){_0x157a62[_0xa57e('0x8')]+=0x1;updateWaitingCounter(_0x157a62);}if(_0x157a62[_0xa57e('0xc')]){_0x157a62['answered']+=0x1;if(_0x157a62[_0xa57e('0x5')]){_0x157a62[_0xa57e('0x5')]-=0x1;}}else{if(_0x157a62[_0xa57e('0xb')]){_0x157a62[_0xa57e('0x7')]+=0x1;updateWaitingCounter(_0x157a62);}}}else{if(!_0x157a62['UserId']){_0x157a62[_0xa57e('0x4')]+=0x1;}if(_0x157a62[_0xa57e('0xc')]){_0x157a62[_0xa57e('0x5')]+=0x1;updateWaitingCounter(_0x157a62);}}_0x157a62[_0xa57e('0x9')]+=0x1;return _0x157a62;}function getLastMessageText(_0x5d6dfb){return db[_0xa57e('0xd')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x5d6dfb['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xa57e('0xe')],'order':'-id','raw':!![]})[_0xa57e('0xf')](function(_0x3dc4a1){if(_0x3dc4a1&&_0x3dc4a1['plainBody']){_0x5d6dfb[_0xa57e('0x10')]=_['trimStart'](_0x3dc4a1[_0xa57e('0xe')]);}return _0x5d6dfb;})[_0xa57e('0x11')](function(_0x112dd5){throw _0x112dd5;});}exports[_0xa57e('0x12')]=function(_0x178d5b,_0x3017f1,_0x3672a9,_0x3bafe8){return new Promise(function(_0x2bebe2,_0x49a8fb){return getInteractionUsers(_0x178d5b['id'],_0x3672a9)[_0xa57e('0xf')](function(_0x50cbc2){_0x178d5b[_0xa57e('0x13')]=_0x50cbc2;return getInteractionTags(_0x178d5b[_0xa57e('0x14')],_0x3017f1);})['then'](function(_0x305aa6){_0x178d5b['Tags']=_0x305aa6;delete _0x178d5b[_0xa57e('0x14')];return updateInteractionCounters(_0x178d5b);})[_0xa57e('0xf')](function(_0x22dcc4){if(_0x3bafe8){return getLastMessageText(_0x22dcc4);}else{return _0x22dcc4;}})[_0xa57e('0xf')](function(_0x190bf0){_0x2bebe2(_0x190bf0);})['catch'](function(_0x482dbb){_0x49a8fb(_0x482dbb);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index a7c4c80..9d4e992 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 _0xbc8b=['upperFirst','unknown','websites','accounts','_interaction_has_tags','_messages','user_has_','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','Interaction','update','then','info','catch','error','exports','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','capitalize','chat','Website','Account','InteractionId'];(function(_0x38b928,_0xd0adb7){var _0x1f34e3=function(_0x13c88b){while(--_0x13c88b){_0x38b928['push'](_0x38b928['shift']());}};_0x1f34e3(++_0xd0adb7);}(_0xbc8b,0x176));var _0xbbc8=function(_0x52121d,_0x1d1704){_0x52121d=_0x52121d-0x0;var _0x448627=_0xbc8b[_0x52121d];return _0x448627;};'use strict';var _=require('lodash');var db=require(_0xbbc8('0x0'))['db'];var loggers={'openchannel':require(_0xbbc8('0x1'))(_0xbbc8('0x2')),'mail':require(_0xbbc8('0x1'))('mail-interactions'),'fax':require(_0xbbc8('0x1'))(_0xbbc8('0x3')),'sms':require(_0xbbc8('0x1'))(_0xbbc8('0x4')),'chat':require(_0xbbc8('0x1'))('chat-interactions'),'whatsapp':require(_0xbbc8('0x1'))('whatsapp-interactions')};function getAccountFK(_0x2256aa){return _[_0xbbc8('0x5')](_0x2256aa)+(_0x2256aa===_0xbbc8('0x6')?_0xbbc8('0x7'):_0xbbc8('0x8'))+'Id';}function getInteractionFK(_0x1c3149){return _['capitalize'](_0x1c3149)+_0xbbc8('0x9');}function getInteractionId(_0x367bc6,_0x456115,_0x4bf327){if(_0x367bc6&&_0x367bc6[_[_0xbbc8('0xa')](_0x4bf327)+_0xbbc8('0x9')]){return _0x367bc6[_['upperFirst'](_0x4bf327)+_0xbbc8('0x9')];}else if(_0x367bc6&&_0x367bc6['id']){return _0x367bc6['id'];}else if(_0x456115&&_0x456115['id']){return _0x456115['id'];}else{return _0xbbc8('0xb');}}function getInteractionsTables(_0x1ec729){return{'accounts':_0x1ec729+'_'+(_0x1ec729===_0xbbc8('0x6')?_0xbbc8('0xc'):_0xbbc8('0xd')),'interactions':_0x1ec729+'_interactions','interactionsTags':_0x1ec729+_0xbbc8('0xe'),'messages':_0x1ec729+_0xbbc8('0xf'),'userInteractions':_0xbbc8('0x10')+_0x1ec729+_0xbbc8('0x11')};}function getSelectedTags(_0x4e3e5f){var _0x4b3724=[];if(_0x4e3e5f){_0x4b3724=Array[_0xbbc8('0x12')](_0x4e3e5f)?_0x4e3e5f:[_0x4e3e5f];}return _0x4b3724;}function log(_0x1953fd,_0x557f09,_0x288845,_0xe77939,_0x2bfed6,_0x5422b1){loggers[_0x2bfed6[_0xbbc8('0x13')]()][_0x1953fd](_0xbbc8('0x14'),_0x5422b1[_0xbbc8('0x15')](),_0x557f09?_0x557f09['id']:null,_0x557f09?_0x557f09[_0xbbc8('0x16')]:null,_0x557f09?_0x557f09[_0xbbc8('0x17')]:null,getInteractionId(_0x288845,_0xe77939,_0x2bfed6),_0x288845?JSON[_0xbbc8('0x18')](_0x288845):'null');}function updateUser(_0x14a069,_0x35c750,_0x1cb935,_0x53aa37,_0x20155a){db[_[_0xbbc8('0xa')](_0x53aa37)+_0xbbc8('0x19')]['findOne']({'where':{'id':getInteractionId(_0x35c750,_0x1cb935,_0x53aa37)}})['then'](function(_0x2470a1){if(_0x2470a1){return _0x2470a1[_0xbbc8('0x1a')]({'UserId':_0x14a069?_0x14a069['id']:null});}})[_0xbbc8('0x1b')](function(_0x21f128){if(_0x21f128){log(_0xbbc8('0x1c'),_0x14a069,_0x35c750,_0x1cb935,_0x53aa37,_0x20155a);}})[_0xbbc8('0x1d')](function(){log(_0xbbc8('0x1e'),_0x14a069,_0x35c750,_0x1cb935,_0x53aa37,_0x20155a);});}module[_0xbbc8('0x1f')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xe8c1=['name','role','stringify','null','Interaction','findOne','then','catch','error','exports','lodash','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','chat','Website','Account','capitalize','upperFirst','InteractionId','unknown','accounts','_interactions','_messages','isArray','toUpperCase'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe8c1,0xb8));var _0x1e8c=function(_0x31cc0e,_0x24ba4c){_0x31cc0e=_0x31cc0e-0x0;var _0x144862=_0xe8c1[_0x31cc0e];return _0x144862;};'use strict';var _=require(_0x1e8c('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0x1e8c('0x1'))(_0x1e8c('0x2')),'fax':require(_0x1e8c('0x1'))(_0x1e8c('0x3')),'sms':require(_0x1e8c('0x1'))(_0x1e8c('0x4')),'chat':require(_0x1e8c('0x1'))(_0x1e8c('0x5')),'whatsapp':require(_0x1e8c('0x1'))(_0x1e8c('0x6'))};function getAccountFK(_0x59a77a){return _['capitalize'](_0x59a77a)+(_0x59a77a===_0x1e8c('0x7')?_0x1e8c('0x8'):_0x1e8c('0x9'))+'Id';}function getInteractionFK(_0x369056){return _[_0x1e8c('0xa')](_0x369056)+'InteractionId';}function getInteractionId(_0x23a0cd,_0x2865a4,_0x1447ca){if(_0x23a0cd&&_0x23a0cd[_[_0x1e8c('0xb')](_0x1447ca)+'InteractionId']){return _0x23a0cd[_[_0x1e8c('0xb')](_0x1447ca)+_0x1e8c('0xc')];}else if(_0x23a0cd&&_0x23a0cd['id']){return _0x23a0cd['id'];}else if(_0x2865a4&&_0x2865a4['id']){return _0x2865a4['id'];}else{return _0x1e8c('0xd');}}function getInteractionsTables(_0x45cb4f){return{'accounts':_0x45cb4f+'_'+(_0x45cb4f==='chat'?'websites':_0x1e8c('0xe')),'interactions':_0x45cb4f+_0x1e8c('0xf'),'interactionsTags':_0x45cb4f+'_interaction_has_tags','messages':_0x45cb4f+_0x1e8c('0x10'),'userInteractions':'user_has_'+_0x45cb4f+_0x1e8c('0xf')};}function getSelectedTags(_0x223302){var _0x5aaac2=[];if(_0x223302){_0x5aaac2=Array[_0x1e8c('0x11')](_0x223302)?_0x223302:[_0x223302];}return _0x5aaac2;}function log(_0x426589,_0x5b0cd0,_0x4f294b,_0x5ccf79,_0x249dcf,_0x4e2ed2){loggers[_0x249dcf['toLowerCase']()][_0x426589]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4e2ed2[_0x1e8c('0x12')](),_0x5b0cd0?_0x5b0cd0['id']:null,_0x5b0cd0?_0x5b0cd0[_0x1e8c('0x13')]:null,_0x5b0cd0?_0x5b0cd0[_0x1e8c('0x14')]:null,getInteractionId(_0x4f294b,_0x5ccf79,_0x249dcf),_0x4f294b?JSON[_0x1e8c('0x15')](_0x4f294b):_0x1e8c('0x16'));}function updateUser(_0x102b71,_0x357700,_0x103d9a,_0x31d441,_0x1ab154){db[_[_0x1e8c('0xb')](_0x31d441)+_0x1e8c('0x17')][_0x1e8c('0x18')]({'where':{'id':getInteractionId(_0x357700,_0x103d9a,_0x31d441)}})['then'](function(_0x4e48ec){if(_0x4e48ec){return _0x4e48ec['update']({'UserId':_0x102b71?_0x102b71['id']:null});}})[_0x1e8c('0x19')](function(_0x4c3d8c){if(_0x4c3d8c){log('info',_0x102b71,_0x357700,_0x103d9a,_0x31d441,_0x1ab154);}})[_0x1e8c('0x1a')](function(){log(_0x1e8c('0x1b'),_0x102b71,_0x357700,_0x103d9a,_0x31d441,_0x1ab154);});}module[_0x1e8c('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 5b32001..94b3a3d 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 _0xd8b5=['user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','utf8','final','License','findOne','then','count','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin'];(function(_0x1a0a44,_0x43a6ab){var _0x98b48e=function(_0xd2fae1){while(--_0xd2fae1){_0x1a0a44['push'](_0x1a0a44['shift']());}};_0x98b48e(++_0x43a6ab);}(_0xd8b5,0xfc));var _0x5d8b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd8b5[_0x14add3];return _0x4a174f;};'use strict';var crypto=require(_0x5d8b('0x0'));var util=require(_0x5d8b('0x1'));var compose=require('composable-middleware');var db=require(_0x5d8b('0x2'))['db'];var config=require(_0x5d8b('0x3'));function getValueFromLicense(_0x2ce46b,_0x476e45){if(_0x2ce46b&&_0x476e45){if(_0x476e45[_0x5d8b('0x4')]&&_0x476e45[_0x5d8b('0x5')]){var _0x3fc45d=_0x476e45['data1'];var _0x4b1193=_0x476e45[_0x5d8b('0x5')];var _0x4ef04f=_0x3fc45d[_0x5d8b('0x6')]('-')[0x4];var _0x4ded02=_0x3fc45d[_0x5d8b('0x6')]('-')[0x0];var _0x598065=crypto[_0x5d8b('0x7')](_0x5d8b('0x8'),util['format'](_0x5d8b('0x9'),_0x4ef04f,_0x3fc45d,_0x4ded02));var _0xa230aa=_0x598065['update'](_0x4b1193,'base64',_0x5d8b('0xa'));_0xa230aa+=_0x598065[_0x5d8b('0xb')](_0x5d8b('0xa'));var _0x240505=JSON['parse'](_0xa230aa);return _0x240505['hasOwnProperty'](_0x2ce46b)?_0x240505[_0x2ce46b]:null;}}return null;}function isLimit(_0x61cf16,_0x5bb7a5,_0xfcc742,_0x459f37){var _0x1679a9=_0x5bb7a5;return compose()['use'](function(_0x4c239e,_0x57d5ce,_0x222572){return db[_0x5d8b('0xc')][_0x5d8b('0xd')]({'where':{'id':0x1},'raw':!![]})[_0x5d8b('0xe')](function(_0x3ad38d){var _0xf69724=getValueFromLicense(_0x61cf16,_0x3ad38d);return _0xf69724?_0xf69724:_0x1679a9;})[_0x5d8b('0xe')](function(_0x47ae17){_0x1679a9=_0x47ae17;return _0xfcc742[_0x5d8b('0xf')](_0x459f37);})[_0x5d8b('0xe')](function(_0x342a3f){if(_0x342a3f>=_0x1679a9){return _0x57d5ce['status'](0x193)[_0x5d8b('0x10')]({'message':util[_0x5d8b('0x11')](_0x5d8b('0x12'),_0x61cf16)});}_0x222572();})[_0x5d8b('0x13')](function(_0x5ea727){_0x222572(_0x5ea727);});});}function isUserLimit(){return isLimit(_0x5d8b('0x14'),0x1,db[_0x5d8b('0x15')],{'where':{'$or':[{'role':_0x5d8b('0x16')},{'role':_0x5d8b('0x17')}]}});}exports[_0x5d8b('0x18')]=isUserLimit; \ No newline at end of file +var _0x2658=['split','aes-256-ctr','%s:%s:%s','update','final','utf8','hasOwnProperty','License','then','count','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license'];(function(_0x2f20fd,_0xa482cf){var _0x527a87=function(_0x4036eb){while(--_0x4036eb){_0x2f20fd['push'](_0x2f20fd['shift']());}};_0x527a87(++_0xa482cf);}(_0x2658,0x1a3));var _0x8265=function(_0xb2d17c,_0x487d49){_0xb2d17c=_0xb2d17c-0x0;var _0x576b82=_0x2658[_0xb2d17c];return _0x576b82;};'use strict';var crypto=require(_0x8265('0x0'));var util=require('util');var compose=require(_0x8265('0x1'));var db=require(_0x8265('0x2'))['db'];var config=require(_0x8265('0x3'));function getValueFromLicense(_0xe67a81,_0x2e952a){if(_0xe67a81&&_0x2e952a){if(_0x2e952a[_0x8265('0x4')]&&_0x2e952a[_0x8265('0x5')]){var _0x2d702c=_0x2e952a[_0x8265('0x4')];var _0xb331a0=_0x2e952a['license'];var _0x1e1ca3=_0x2d702c[_0x8265('0x6')]('-')[0x4];var _0x21cf39=_0x2d702c[_0x8265('0x6')]('-')[0x0];var _0xae69c9=crypto['createDecipher'](_0x8265('0x7'),util['format'](_0x8265('0x8'),_0x1e1ca3,_0x2d702c,_0x21cf39));var _0x4a240f=_0xae69c9[_0x8265('0x9')](_0xb331a0,'base64','utf8');_0x4a240f+=_0xae69c9[_0x8265('0xa')](_0x8265('0xb'));var _0x304895=JSON['parse'](_0x4a240f);return _0x304895[_0x8265('0xc')](_0xe67a81)?_0x304895[_0xe67a81]:null;}}return null;}function isLimit(_0x15bcf2,_0xe326d7,_0x1f3e26,_0x4de0fe){var _0x3fa4ee=_0xe326d7;return compose()['use'](function(_0x1a77e8,_0x4ee2a3,_0x43ec3a){return db[_0x8265('0xd')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x8265('0xe')](function(_0x4c87a5){var _0x55a92b=getValueFromLicense(_0x15bcf2,_0x4c87a5);return _0x55a92b?_0x55a92b:_0x3fa4ee;})['then'](function(_0xfe2d14){_0x3fa4ee=_0xfe2d14;return _0x1f3e26[_0x8265('0xf')](_0x4de0fe);})[_0x8265('0xe')](function(_0x8f798e){if(_0x8f798e>=_0x3fa4ee){return _0x4ee2a3[_0x8265('0x10')](0x193)[_0x8265('0x11')]({'message':util[_0x8265('0x12')](_0x8265('0x13'),_0x15bcf2)});}_0x43ec3a();})[_0x8265('0x14')](function(_0x500e15){_0x43ec3a(_0x500e15);});});}function isUserLimit(){return isLimit(_0x8265('0x15'),0x1,db[_0x8265('0x16')],{'where':{'$or':[{'role':_0x8265('0x17')},{'role':_0x8265('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 9a56a73..8dd6436 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 _0x1781=['utcOffset','format','hours','add','seconds','lodash','parseSearch','startsWith','and','replace','[$or]','split','forEach','shift','match','filter','indexOf','map','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','YYYY-MM-DD','text','\x20AS\x20','castTo','field','$ne','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop'];(function(_0x18658a,_0xb2105b){var _0x819ec0=function(_0x1c435){while(--_0x1c435){_0x18658a['push'](_0x18658a['shift']());}};_0x819ec0(++_0xb2105b);}(_0x1781,0xa4));var _0x1178=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1781[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x1178('0x0'));var moment=require('moment');exports[_0x1178('0x1')]=function(_0x22ea4b){var _0x1e6d90={'conditions':[]};_0x1e6d90['sqlOperator']=_[_0x1178('0x2')](_0x22ea4b,'[$or]')?'or':_0x1178('0x3');var _0x253260=_0x22ea4b[_0x1178('0x4')]('[$and]','')[_0x1178('0x4')](_0x1178('0x5'),'')[_0x1178('0x6')]('||');for(var _0x37725e=0x0;_0x37725e<_0x253260['length'];_0x37725e++){var _0x249411=_0x253260[_0x37725e][_0x1178('0x6')](':=');var _0x2c43bf=_0x249411[0x0];var _0x264180=_0x249411['slice'](0x1);_0x264180[_0x1178('0x7')](function(_0x296758){var _0x2ccf95=_0x296758['split']('[')[_0x1178('0x8')]();var _0x583232=_0x296758[_0x1178('0x9')](/\[(.*?)\]/g);_0x583232[_0x1178('0x7')](function(_0x2ae893){var _0x591156=_0x2ae893[_0x1178('0x6')]('[')[_0x1178('0xa')](function(_0xe9ea96){return _0xe9ea96[_0x1178('0xb')](']')>-0x1;})[_0x1178('0xc')](function(_0x3aa5dc){return _0x3aa5dc[_0x1178('0x6')](']')[0x0];})[0x0];_0x1e6d90['conditions'][_0x1178('0xd')]({'field':_0x2c43bf,'operator':_0x2ccf95,'value':_0x591156});});});}return _0x1e6d90;};exports[_0x1178('0xe')]=function(_0x269f0d,_0x1dd09f,_0x3dc630){var _0x1d5df1={};if(_0x1dd09f===_0x1178('0xf')){if(_0x3dc630[_0x1178('0x10')]===_0x1178('0x11')){_0x3dc630['operator']=_0x1178('0x12');_0x3dc630[_0x1178('0x13')]+=','+_0x3dc630['value'];}else if(_[_0x1178('0x14')]([_0x1178('0x15'),_0x1178('0x16')],_0x3dc630[_0x1178('0x10')])){_0x3dc630[_0x1178('0x13')]=moment(_0x3dc630[_0x1178('0x13')])['add'](0x1,_0x1178('0x17'))['format'](_0x1178('0x18'));}}if(_0x3dc630['castTo']){_0x1dd09f=_0x3dc630['castTo'];_0x1d5df1[_0x1178('0x19')]='CAST('+_0x269f0d+'.'+_0x3dc630['field']+_0x1178('0x1a')+_0x3dc630[_0x1178('0x1b')]+')\x20'+parseOperator(_0x3dc630[_0x1178('0x10')]);}else{_0x1d5df1[_0x1178('0x19')]=_0x269f0d+'.'+_0x3dc630[_0x1178('0x1c')]+'\x20'+parseOperator(_0x3dc630[_0x1178('0x10')]);}if(_[_0x1178('0x14')]([_0x1178('0x1d'),_0x1178('0x1e')],_0x3dc630['operator']))_0x1d5df1[_0x1178('0x19')]='('+_0x1d5df1[_0x1178('0x19')]+_0x1178('0x1f')+_0x269f0d+'.'+_0x3dc630['field']+'\x20IS\x20NULL)';_0x1d5df1[_0x1178('0x13')]=parseValue(_0x1dd09f,_0x3dc630[_0x1178('0x10')],_0x3dc630[_0x1178('0x13')]);return _0x1d5df1;};function parseOperator(_0x4a400){var _0x12c87f;switch(_0x4a400){case _0x1178('0x20'):_0x12c87f=_0x1178('0x21');break;case _0x1178('0x1e'):_0x12c87f=_0x1178('0x22');break;case _0x1178('0x11'):_0x12c87f=_0x1178('0x23');break;case _0x1178('0x1d'):_0x12c87f='<>\x20?';break;case _0x1178('0x24'):case _0x1178('0x25'):case _0x1178('0x26'):_0x12c87f=_0x1178('0x27');break;case _0x1178('0x28'):_0x12c87f=_0x1178('0x29');break;case _0x1178('0x15'):_0x12c87f='>\x20?';break;case _0x1178('0x16'):_0x12c87f=_0x1178('0x2a');break;case _0x1178('0x2b'):_0x12c87f=_0x1178('0x2c');break;case _0x1178('0x12'):_0x12c87f=_0x1178('0x2d');break;}return _0x12c87f;}function parseValue(_0x59936f,_0x5801e8,_0x566192){var _0xcdd445={'start':undefined,'end':undefined};switch(_0x5801e8){case _0x1178('0x20'):case _0x1178('0x1e'):_0xcdd445[_0x1178('0x2e')]=_0x566192['split'](',');break;case _0x1178('0x24'):_0xcdd445[_0x1178('0x2e')]='%'+_0x566192+'%';break;case _0x1178('0x25'):_0xcdd445[_0x1178('0x2e')]=_0x566192+'%';break;case _0x1178('0x26'):_0xcdd445['start']='%'+_0x566192;break;case'$between':var _0x2c4bd9=_0x566192[_0x1178('0x6')](',');var _0x566192=_0x2c4bd9[_0x1178('0x8')]();var _0x27e2e4=_0x2c4bd9[_0x1178('0x2f')]();if(_0x59936f==='DATE'){_0x566192=moment(_0x566192)[_0x1178('0x30')](0x0,!![])[_0x1178('0x31')]();_0x27e2e4=moment(_0x27e2e4)[_0x1178('0x30')](0x0,!![])['add'](0x17,_0x1178('0x32'))[_0x1178('0x33')](0x3b,'minutes')[_0x1178('0x33')](0x3b,_0x1178('0x34'))[_0x1178('0x31')]();}_0xcdd445={'start':_0x566192,'end':_0x27e2e4};break;default:_0xcdd445[_0x1178('0x2e')]=_0x566192;break;}return _0xcdd445;} \ No newline at end of file +var _0x71ed=['start','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','and','replace','[$or]','split','forEach','shift','match','filter','map','conditions','push','DATE','operator','$eq','$between','value','includes','$lte','add','days','format','YYYY-MM-DD','text','CAST(','field','\x20AS\x20','castTo','$ne','$notIn','$in','NOT\x20IN\x20?','<>\x20?','$substring','LIKE\x20?','<\x20?','$gt','>\x20?','<=\x20?','>=\x20?','$startsWith','$endsWith'];(function(_0x4a3f5,_0x446c50){var _0x4d5c25=function(_0x1b48f8){while(--_0x1b48f8){_0x4a3f5['push'](_0x4a3f5['shift']());}};_0x4d5c25(++_0x446c50);}(_0x71ed,0x6c));var _0xd71e=function(_0x3aff76,_0x1e8c96){_0x3aff76=_0x3aff76-0x0;var _0x1a37c1=_0x71ed[_0x3aff76];return _0x1a37c1;};'use strict';var _=require(_0xd71e('0x0'));var moment=require(_0xd71e('0x1'));exports[_0xd71e('0x2')]=function(_0x4618a6){var _0x2cdd72={'conditions':[]};_0x2cdd72[_0xd71e('0x3')]=_['startsWith'](_0x4618a6,'[$or]')?'or':_0xd71e('0x4');var _0x1733ce=_0x4618a6[_0xd71e('0x5')]('[$and]','')[_0xd71e('0x5')](_0xd71e('0x6'),'')[_0xd71e('0x7')]('||');for(var _0x462e49=0x0;_0x462e49<_0x1733ce['length'];_0x462e49++){var _0x4b6bee=_0x1733ce[_0x462e49][_0xd71e('0x7')](':=');var _0x2a2536=_0x4b6bee[0x0];var _0x5cd193=_0x4b6bee['slice'](0x1);_0x5cd193[_0xd71e('0x8')](function(_0x2d5a63){var _0xc1e356=_0x2d5a63['split']('[')[_0xd71e('0x9')]();var _0x5c763e=_0x2d5a63[_0xd71e('0xa')](/\[(.*?)\]/g);_0x5c763e[_0xd71e('0x8')](function(_0x4801f5){var _0x21628d=_0x4801f5[_0xd71e('0x7')]('[')[_0xd71e('0xb')](function(_0x1b17a1){return _0x1b17a1['indexOf'](']')>-0x1;})[_0xd71e('0xc')](function(_0x4176e8){return _0x4176e8[_0xd71e('0x7')](']')[0x0];})[0x0];_0x2cdd72[_0xd71e('0xd')][_0xd71e('0xe')]({'field':_0x2a2536,'operator':_0xc1e356,'value':_0x21628d});});});}return _0x2cdd72;};exports['buildExpression']=function(_0x291e8c,_0x476778,_0x97255e){var _0x341c0b={};if(_0x476778===_0xd71e('0xf')){if(_0x97255e[_0xd71e('0x10')]===_0xd71e('0x11')){_0x97255e['operator']=_0xd71e('0x12');_0x97255e[_0xd71e('0x13')]+=','+_0x97255e['value'];}else if(_[_0xd71e('0x14')](['$gt',_0xd71e('0x15')],_0x97255e[_0xd71e('0x10')])){_0x97255e['value']=moment(_0x97255e[_0xd71e('0x13')])[_0xd71e('0x16')](0x1,_0xd71e('0x17'))[_0xd71e('0x18')](_0xd71e('0x19'));}}if(_0x97255e['castTo']){_0x476778=_0x97255e['castTo'];_0x341c0b[_0xd71e('0x1a')]=_0xd71e('0x1b')+_0x291e8c+'.'+_0x97255e[_0xd71e('0x1c')]+_0xd71e('0x1d')+_0x97255e[_0xd71e('0x1e')]+')\x20'+parseOperator(_0x97255e[_0xd71e('0x10')]);}else{_0x341c0b['text']=_0x291e8c+'.'+_0x97255e[_0xd71e('0x1c')]+'\x20'+parseOperator(_0x97255e[_0xd71e('0x10')]);}if(_['includes']([_0xd71e('0x1f'),_0xd71e('0x20')],_0x97255e[_0xd71e('0x10')]))_0x341c0b['text']='('+_0x341c0b[_0xd71e('0x1a')]+'\x20OR\x20'+_0x291e8c+'.'+_0x97255e['field']+'\x20IS\x20NULL)';_0x341c0b[_0xd71e('0x13')]=parseValue(_0x476778,_0x97255e[_0xd71e('0x10')],_0x97255e[_0xd71e('0x13')]);return _0x341c0b;};function parseOperator(_0x2e7256){var _0x16a834;switch(_0x2e7256){case _0xd71e('0x21'):_0x16a834='IN\x20?';break;case _0xd71e('0x20'):_0x16a834=_0xd71e('0x22');break;case'$eq':_0x16a834='=\x20?';break;case _0xd71e('0x1f'):_0x16a834=_0xd71e('0x23');break;case _0xd71e('0x24'):case'$startsWith':case'$endsWith':_0x16a834=_0xd71e('0x25');break;case'$lt':_0x16a834=_0xd71e('0x26');break;case _0xd71e('0x27'):_0x16a834=_0xd71e('0x28');break;case _0xd71e('0x15'):_0x16a834=_0xd71e('0x29');break;case'$gte':_0x16a834=_0xd71e('0x2a');break;case'$between':_0x16a834='BETWEEN\x20?\x20AND\x20?';break;}return _0x16a834;}function parseValue(_0x2b6dd7,_0x3306b4,_0x220b44){var _0x5099d2={'start':undefined,'end':undefined};switch(_0x3306b4){case'$in':case _0xd71e('0x20'):_0x5099d2['start']=_0x220b44[_0xd71e('0x7')](',');break;case'$substring':_0x5099d2['start']='%'+_0x220b44+'%';break;case _0xd71e('0x2b'):_0x5099d2['start']=_0x220b44+'%';break;case _0xd71e('0x2c'):_0x5099d2[_0xd71e('0x2d')]='%'+_0x220b44;break;case'$between':var _0x3ae1=_0x220b44['split'](',');var _0x220b44=_0x3ae1[_0xd71e('0x9')]();var _0xdb0b83=_0x3ae1[_0xd71e('0x2e')]();if(_0x2b6dd7===_0xd71e('0xf')){_0x220b44=moment(_0x220b44)[_0xd71e('0x2f')](0x0,!![])['format']();_0xdb0b83=moment(_0xdb0b83)[_0xd71e('0x2f')](0x0,!![])['add'](0x17,_0xd71e('0x30'))[_0xd71e('0x16')](0x3b,_0xd71e('0x31'))[_0xd71e('0x16')](0x3b,_0xd71e('0x32'))['format']();}_0x5099d2={'start':_0x220b44,'end':_0xdb0b83};break;default:_0x5099d2['start']=_0x220b44;break;}return _0x5099d2;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 97248dc..1582da2 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 _0x6299=['length','isObject','unset','hasOwnProperty','match','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','join','getOptions','query','$id','intersection','attributes','nolimit','order','where','pick','filter','object','columns','value','merge','VIRTUAL','lower','options','include','includeAll','moment','../../mysqldb','parse','keys','includes','model','alias','fields','filters','isEmpty','find','type','DATE','$gte','format','YYYY-MM-DD','$lte','utc','subtract','name','uniqueid','limit','offset','sort','split','map','indexOf','priority','cast','unsigned','substr','DESC','col','omit','isArray'];(function(_0x295a3d,_0x56d487){var _0x23a732=function(_0x15cfc2){while(--_0x15cfc2){_0x295a3d['push'](_0x295a3d['shift']());}};_0x23a732(++_0x56d487);}(_0x6299,0x169));var _0x9629=function(_0x3facfa,_0x500a26){_0x3facfa=_0x3facfa-0x0;var _0xfa8be9=_0x6299[_0x3facfa];return _0xfa8be9;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0x9629('0x0'));var db=require(_0x9629('0x1'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3cf1e1){var _0x35868a=['ne'];try{var _0x3c3ab2=JSON[_0x9629('0x2')](_0x3cf1e1);var _0x55d4ce=Object[_0x9629('0x3')](_0x3c3ab2)[0x0];return _0x35868a[_0x9629('0x4')](_0x55d4ce);}catch(_0x271658){return![];}}function getOperatorValue(_0x1edc13){var _0x1206bf=JSON['parse'](_0x1edc13);var _0x57c6fe=Object[_0x9629('0x3')](_0x1206bf)[0x0];var _0x1754e6=_0x1206bf[_0x57c6fe];return{['$'+_0x57c6fe]:_0x1754e6};}function parseIncludeModel(_0x533868){var _0x555ca5=JSON['parse'](_0x533868);return{'model':db[_0x555ca5[_0x9629('0x5')]],'as':_0x555ca5[_0x9629('0x6')],'attributes':_0x555ca5[_0x9629('0x7')],'raw':_0x555ca5['raw']};}exports[_0x9629('0x7')]=function(_0x3493de){var _0x21cd47=null;if(_0x3493de){_0x21cd47=_0x3493de['split'](',');}return _0x21cd47;};exports[_0x9629('0x8')]=function(_0x2ef67f,_0xd4ddd9){var _0x454251={};if(!_[_0x9629('0x9')](_0x2ef67f)){_['forOwn'](_0x2ef67f,function(_0x2e2964,_0xb53308){try{if(_0xd4ddd9){var _0x12ec05=_[_0x9629('0xa')](_0xd4ddd9,{'name':_0xb53308})||{};if(hasSequelizeOperator(_0x2e2964)){_0x454251[_0xb53308]=getOperatorValue(_0x2e2964);}else if(_0x12ec05[_0x9629('0xb')]===_0x9629('0xc')&&_['isPlainObject'](_0x2e2964)){var _0x358636=JSON[_0x9629('0x2')](_0x2e2964);var _0x73793b={'$gte':moment(moment(_0x358636[_0x9629('0xd')])[_0x9629('0xe')](_0x9629('0xf')))['utc']()[_0x9629('0xe')](),'$lte':moment(moment(_0x358636[_0x9629('0x10')])[_0x9629('0xe')](_0x9629('0xf')))[_0x9629('0x11')]()[_0x9629('0x12')](0x1,'s')[_0x9629('0xe')]()};_0x454251[_0xb53308]=_0x73793b;}else if(_0x12ec05[_0x9629('0x13')]===_0x9629('0x14')){_0x454251[_0xb53308]=_0x2e2964;}else{_0x454251[_0xb53308]=_['isArray'](_0x2e2964)?_0x2e2964:JSON[_0x9629('0x2')](_0x2e2964);}}else{_0x454251[_0xb53308]=_['isArray'](_0x2e2964)?_0x2e2964:JSON[_0x9629('0x2')](_0x2e2964);}}catch(_0x3dc1ed){_0x454251[_0xb53308]=_0x2e2964['split'](',');}});}return _0x454251;};exports[_0x9629('0x15')]=function(_0x4ab24f){_0x4ab24f=parseInt(_0x4ab24f,0xa);if(!_0x4ab24f||_0x4ab24f<0x0){_0x4ab24f=LIMIT_VALUE;}return _0x4ab24f;};exports[_0x9629('0x16')]=function(_0x2393b7){_0x2393b7=parseInt(_0x2393b7,0xa);if(!_0x2393b7||_0x2393b7<0x0){_0x2393b7=0x0;}return _0x2393b7;};exports[_0x9629('0x17')]=function(_0x49102e){var _0x4b3759,_0x248d17=null;if(_0x49102e){_0x4b3759=_0x49102e[_0x9629('0x18')](',');_0x248d17=_[_0x9629('0x19')](_0x4b3759,function(_0x58ff25){if(_0x58ff25[_0x9629('0x1a')]('-')===0x0){return[_0x58ff25===_0x9629('0x1b')?sequelize[_0x9629('0x1c')](sequelize['col']('priority'),_0x9629('0x1d')):_0x58ff25[_0x9629('0x1e')](0x1),_0x9629('0x1f')];}else{return[_0x58ff25===_0x9629('0x1b')?sequelize[_0x9629('0x1c')](sequelize[_0x9629('0x20')]('priority'),_0x9629('0x1d')):_0x58ff25,'ASC'];}});}return _0x248d17;};exports[_0x9629('0x21')]=function(_0x1db0d9,_0x453762){if(_[_0x9629('0x9')](_0x1db0d9)){return _0x1db0d9;}if(_[_0x9629('0x22')](_0x1db0d9)){for(var _0xe7c85c=0x0;_0xe7c85c<_0x1db0d9[_0x9629('0x23')];_0xe7c85c+=0x1){_0x1db0d9[_0xe7c85c]=this[_0x9629('0x21')](_0x1db0d9[_0xe7c85c],_0x453762);}return _0x1db0d9;}if(!_[_0x9629('0x24')](_0x1db0d9)){return _0x1db0d9;}if(_['isString'](_0x453762)){_0x453762=[_0x453762];}if(!_[_0x9629('0x22')](_0x453762)){return _0x1db0d9;}for(var _0x33b1cd=0x0;_0x33b1cd<_0x453762['length'];_0x33b1cd+=0x1){_[_0x9629('0x25')](_0x1db0d9,_0x453762[_0x33b1cd]);}for(var _0x27cf36 in _0x1db0d9){if(_0x1db0d9[_0x9629('0x26')](_0x27cf36)){_0x1db0d9[_0x27cf36]=this[_0x9629('0x21')](_0x1db0d9[_0x27cf36],_0x453762);}}return _0x1db0d9;};exports['isNumeric']=function(_0x3d6859){return _0x3d6859[_0x9629('0x27')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x9629('0x28')]=function(_0x505590){return _0x505590[_0x9629('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x9629('0x29')]=function(_0x51b1b9,_0x542210){var _0x2942ab=[];var _0x2cd400=/[ `!@#$%^&*()_\-?~]/;var _0x1c592e=_0x542210?_0x9629('0x2a'):_0x9629('0x2b');_0x51b1b9[_0x9629('0x18')](/[ ,]+/)[_0x9629('0x2c')](function(_0x44d844){_0x44d844=_0x44d844[_0x9629('0x2d')](/([^:]")"+/g,'$1');_0x44d844='+'+_0x44d844+'*';var _0xe2a23d=_0x44d844[_0x9629('0x27')](_0x2cd400);if(_0xe2a23d){_0x44d844='\x22'+_0x44d844+'\x22';}_0x2942ab['push'](_0x44d844);});_0x1c592e=_0x1c592e[_0x9629('0x2d')]('{EXPR}',_0x2942ab[_0x9629('0x2e')]('\x20'));return _0x1c592e;};exports[_0x9629('0x2f')]=function(_0x1ab2e8,_0x641e2e,_0x1a44dd){var _0x5c9c41={},_0x261b3f={};if(_0x641e2e[_0x9629('0x30')][_0x9629('0x31')]){_0x641e2e[_0x9629('0x30')]['id']=_0x641e2e[_0x9629('0x30')][_0x9629('0x31')];delete _0x641e2e['query'][_0x9629('0x31')];}_0x5c9c41[_0x9629('0x5')]=_['map'](_0x1ab2e8,'name');_0x5c9c41[_0x9629('0x30')]=_[_0x9629('0x3')](_0x641e2e[_0x9629('0x30')]);_0x5c9c41['filters']=_[_0x9629('0x32')](_0x5c9c41[_0x9629('0x5')],_0x5c9c41[_0x9629('0x30')]);_0x261b3f[_0x9629('0x33')]=_[_0x9629('0x32')](_0x5c9c41[_0x9629('0x5')],this[_0x9629('0x7')](_0x641e2e[_0x9629('0x30')][_0x9629('0x7')]));_0x261b3f[_0x9629('0x33')]=_0x261b3f[_0x9629('0x33')]['length']?_0x261b3f[_0x9629('0x33')]:_0x5c9c41[_0x9629('0x5')];if(!_0x641e2e[_0x9629('0x30')]['hasOwnProperty'](_0x9629('0x34'))){_0x261b3f[_0x9629('0x15')]=this['limit'](_0x641e2e[_0x9629('0x30')][_0x9629('0x15')]);_0x261b3f['offset']=this['offset'](_0x641e2e[_0x9629('0x30')][_0x9629('0x16')]);}_0x261b3f[_0x9629('0x35')]=this[_0x9629('0x17')](_0x641e2e['query'][_0x9629('0x17')]);_0x261b3f[_0x9629('0x36')]=this[_0x9629('0x8')](_[_0x9629('0x37')](_0x641e2e['query'],_0x5c9c41[_0x9629('0x8')]),_0x1ab2e8);if(_0x641e2e[_0x9629('0x30')][_0x9629('0x38')]){var _0x5052c1=_0x1ab2e8;var _0x59efb8=_0x641e2e[_0x9629('0x30')][_0x9629('0x38')];if(typeof _0x59efb8===_0x9629('0x39')){_0x5052c1=_['filter'](_0x1ab2e8,function(_0x5e9926){return _[_0x9629('0x4')](_0x59efb8[_0x9629('0x3a')],_0x5e9926[_0x9629('0x13')]);});_0x59efb8=_0x59efb8[_0x9629('0x3b')];}_0x261b3f[_0x9629('0x36')]=_[_0x9629('0x3c')](_0x261b3f['where'],{'$or':_[_0x9629('0x19')](_0x5052c1,function(_0x2b190b){if(_0x2b190b[_0x9629('0xb')]!==_0x9629('0x3d')){if(_0x1a44dd){return sequelize[_0x9629('0x36')](sequelize['fn'](_0x9629('0x3e'),sequelize[_0x9629('0x20')](_0x2b190b['name'])),{'$like':sequelize['fn']('lower','%'+_0x641e2e[_0x9629('0x30')][_0x9629('0x38')]+'%')});}else{var _0xba1216={};_0xba1216[_0x2b190b[_0x9629('0x13')]]={'$like':'%'+_0x641e2e[_0x9629('0x30')]['filter']+'%'};return _0xba1216;}}})});}_0x261b3f=_['merge']({},_0x261b3f,_0x641e2e[_0x9629('0x3f')]);return _0x261b3f;};exports[_0x9629('0x40')]=function(_0x4481dc){var _0x5ec50e=[];if(_0x4481dc[_0x9629('0x41')]){_0x5ec50e['push']({'all':!![]});}else if(_0x4481dc[_0x9629('0x40')]){if(Array[_0x9629('0x22')](_0x4481dc[_0x9629('0x40')])){_0x5ec50e=Object[_0x9629('0x3')](_0x4481dc[_0x9629('0x40')])['map'](function(_0x33be35){return parseIncludeModel(_0x4481dc[_0x9629('0x40')][_0x33be35]);});}else{var _0x553cf9=parseIncludeModel(_0x4481dc[_0x9629('0x40')]);_0x5ec50e['push'](_0x553cf9);}}return _0x5ec50e;}; \ No newline at end of file +var _0x794b=['sort','indexOf','cast','col','unsigned','DESC','priority','ASC','length','isObject','isString','unset','hasOwnProperty','omit','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','getOptions','query','$id','map','intersection','attributes','nolimit','offset','order','where','pick','filter','object','columns','merge','lower','options','include','moment','../../mysqldb','parse','keys','includes','model','alias','fields','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','format','YYYY-MM-DD','utc','$lte','name','isArray','limit'];(function(_0x2adfb1,_0x406e6e){var _0xa52d45=function(_0x2de16c){while(--_0x2de16c){_0x2adfb1['push'](_0x2adfb1['shift']());}};_0xa52d45(++_0x406e6e);}(_0x794b,0xa7));var _0xb794=function(_0x564f2b,_0x3e14c7){_0x564f2b=_0x564f2b-0x0;var _0x2145ad=_0x794b[_0x564f2b];return _0x2145ad;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0xb794('0x0'));var db=require(_0xb794('0x1'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x52e1a6){var _0x24614c=['ne'];try{var _0x57b821=JSON[_0xb794('0x2')](_0x52e1a6);var _0xa8f38a=Object[_0xb794('0x3')](_0x57b821)[0x0];return _0x24614c[_0xb794('0x4')](_0xa8f38a);}catch(_0x212cc7){return![];}}function getOperatorValue(_0x491b88){var _0x50e4a8=JSON[_0xb794('0x2')](_0x491b88);var _0x4ffd69=Object[_0xb794('0x3')](_0x50e4a8)[0x0];var _0x40520b=_0x50e4a8[_0x4ffd69];return{['$'+_0x4ffd69]:_0x40520b};}function parseIncludeModel(_0x20caa0){var _0x5d55eb=JSON[_0xb794('0x2')](_0x20caa0);return{'model':db[_0x5d55eb[_0xb794('0x5')]],'as':_0x5d55eb[_0xb794('0x6')],'attributes':_0x5d55eb[_0xb794('0x7')],'raw':_0x5d55eb['raw']};}exports['fields']=function(_0x17475c){var _0x23785a=null;if(_0x17475c){_0x23785a=_0x17475c[_0xb794('0x8')](',');}return _0x23785a;};exports[_0xb794('0x9')]=function(_0x7b7bdd,_0x2a475f){var _0x41e037={};if(!_[_0xb794('0xa')](_0x7b7bdd)){_[_0xb794('0xb')](_0x7b7bdd,function(_0x264fec,_0x47ef29){try{if(_0x2a475f){var _0x394f76=_['find'](_0x2a475f,{'name':_0x47ef29})||{};if(hasSequelizeOperator(_0x264fec)){_0x41e037[_0x47ef29]=getOperatorValue(_0x264fec);}else if(_0x394f76[_0xb794('0xc')]===_0xb794('0xd')&&_[_0xb794('0xe')](_0x264fec)){var _0x2e66bc=JSON[_0xb794('0x2')](_0x264fec);var _0x3fa62a={'$gte':moment(moment(_0x2e66bc['$gte'])[_0xb794('0xf')](_0xb794('0x10')))[_0xb794('0x11')]()[_0xb794('0xf')](),'$lte':moment(moment(_0x2e66bc[_0xb794('0x12')])[_0xb794('0xf')](_0xb794('0x10')))[_0xb794('0x11')]()['subtract'](0x1,'s')[_0xb794('0xf')]()};_0x41e037[_0x47ef29]=_0x3fa62a;}else if(_0x394f76[_0xb794('0x13')]==='uniqueid'){_0x41e037[_0x47ef29]=_0x264fec;}else{_0x41e037[_0x47ef29]=_[_0xb794('0x14')](_0x264fec)?_0x264fec:JSON['parse'](_0x264fec);}}else{_0x41e037[_0x47ef29]=_[_0xb794('0x14')](_0x264fec)?_0x264fec:JSON[_0xb794('0x2')](_0x264fec);}}catch(_0xea2b66){_0x41e037[_0x47ef29]=_0x264fec['split'](',');}});}return _0x41e037;};exports[_0xb794('0x15')]=function(_0xd495de){_0xd495de=parseInt(_0xd495de,0xa);if(!_0xd495de||_0xd495de<0x0){_0xd495de=LIMIT_VALUE;}return _0xd495de;};exports['offset']=function(_0x2486ed){_0x2486ed=parseInt(_0x2486ed,0xa);if(!_0x2486ed||_0x2486ed<0x0){_0x2486ed=0x0;}return _0x2486ed;};exports[_0xb794('0x16')]=function(_0x3d46d8){var _0x1e3c48,_0x216e83=null;if(_0x3d46d8){_0x1e3c48=_0x3d46d8['split'](',');_0x216e83=_['map'](_0x1e3c48,function(_0x1a1e34){if(_0x1a1e34[_0xb794('0x17')]('-')===0x0){return[_0x1a1e34==='priority'?sequelize[_0xb794('0x18')](sequelize[_0xb794('0x19')]('priority'),_0xb794('0x1a')):_0x1a1e34['substr'](0x1),_0xb794('0x1b')];}else{return[_0x1a1e34===_0xb794('0x1c')?sequelize['cast'](sequelize[_0xb794('0x19')]('priority'),_0xb794('0x1a')):_0x1a1e34,_0xb794('0x1d')];}});}return _0x216e83;};exports['omit']=function(_0x59d440,_0xd7a696){if(_[_0xb794('0xa')](_0x59d440)){return _0x59d440;}if(_['isArray'](_0x59d440)){for(var _0xa4efe9=0x0;_0xa4efe9<_0x59d440[_0xb794('0x1e')];_0xa4efe9+=0x1){_0x59d440[_0xa4efe9]=this['omit'](_0x59d440[_0xa4efe9],_0xd7a696);}return _0x59d440;}if(!_[_0xb794('0x1f')](_0x59d440)){return _0x59d440;}if(_[_0xb794('0x20')](_0xd7a696)){_0xd7a696=[_0xd7a696];}if(!_[_0xb794('0x14')](_0xd7a696)){return _0x59d440;}for(var _0x43e9a2=0x0;_0x43e9a2<_0xd7a696[_0xb794('0x1e')];_0x43e9a2+=0x1){_[_0xb794('0x21')](_0x59d440,_0xd7a696[_0x43e9a2]);}for(var _0x5a1e5b in _0x59d440){if(_0x59d440[_0xb794('0x22')](_0x5a1e5b)){_0x59d440[_0x5a1e5b]=this[_0xb794('0x23')](_0x59d440[_0x5a1e5b],_0xd7a696);}}return _0x59d440;};exports['isNumeric']=function(_0x5ebb84){return _0x5ebb84[_0xb794('0x24')](RegExp(_0xb794('0x25')))?!![]:![];};exports[_0xb794('0x26')]=function(_0x5885b2){return _0x5885b2[_0xb794('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0xb794('0x27')]=function(_0x728b46,_0x3d4556){var _0x4dbac8=[];var _0x5a57fe=/[ `!@#$%^&*()_\-?~]/;var _0xdcc9d6=_0x3d4556?_0xb794('0x28'):_0xb794('0x29');_0x728b46[_0xb794('0x8')](/[ ,]+/)[_0xb794('0x2a')](function(_0x17f704){_0x17f704=_0x17f704[_0xb794('0x2b')](/([^:]")"+/g,'$1');_0x17f704='+'+_0x17f704+'*';var _0x112890=_0x17f704['match'](_0x5a57fe);if(_0x112890){_0x17f704='\x22'+_0x17f704+'\x22';}_0x4dbac8[_0xb794('0x2c')](_0x17f704);});_0xdcc9d6=_0xdcc9d6[_0xb794('0x2b')]('{EXPR}',_0x4dbac8['join']('\x20'));return _0xdcc9d6;};exports[_0xb794('0x2d')]=function(_0x29c6dc,_0x266430,_0x3d28cb){var _0x24e89c={},_0x2520eb={};if(_0x266430[_0xb794('0x2e')][_0xb794('0x2f')]){_0x266430[_0xb794('0x2e')]['id']=_0x266430['query']['$id'];delete _0x266430[_0xb794('0x2e')][_0xb794('0x2f')];}_0x24e89c[_0xb794('0x5')]=_[_0xb794('0x30')](_0x29c6dc,_0xb794('0x13'));_0x24e89c[_0xb794('0x2e')]=_['keys'](_0x266430[_0xb794('0x2e')]);_0x24e89c['filters']=_[_0xb794('0x31')](_0x24e89c[_0xb794('0x5')],_0x24e89c[_0xb794('0x2e')]);_0x2520eb[_0xb794('0x32')]=_[_0xb794('0x31')](_0x24e89c[_0xb794('0x5')],this[_0xb794('0x7')](_0x266430[_0xb794('0x2e')]['fields']));_0x2520eb['attributes']=_0x2520eb[_0xb794('0x32')]['length']?_0x2520eb[_0xb794('0x32')]:_0x24e89c['model'];if(!_0x266430[_0xb794('0x2e')][_0xb794('0x22')](_0xb794('0x33'))){_0x2520eb[_0xb794('0x15')]=this[_0xb794('0x15')](_0x266430[_0xb794('0x2e')]['limit']);_0x2520eb['offset']=this['offset'](_0x266430[_0xb794('0x2e')][_0xb794('0x34')]);}_0x2520eb[_0xb794('0x35')]=this['sort'](_0x266430[_0xb794('0x2e')][_0xb794('0x16')]);_0x2520eb[_0xb794('0x36')]=this[_0xb794('0x9')](_[_0xb794('0x37')](_0x266430['query'],_0x24e89c['filters']),_0x29c6dc);if(_0x266430[_0xb794('0x2e')][_0xb794('0x38')]){var _0x479693=_0x29c6dc;var _0xa6dfcb=_0x266430[_0xb794('0x2e')][_0xb794('0x38')];if(typeof _0xa6dfcb===_0xb794('0x39')){_0x479693=_[_0xb794('0x38')](_0x29c6dc,function(_0x352119){return _[_0xb794('0x4')](_0xa6dfcb[_0xb794('0x3a')],_0x352119[_0xb794('0x13')]);});_0xa6dfcb=_0xa6dfcb['value'];}_0x2520eb[_0xb794('0x36')]=_[_0xb794('0x3b')](_0x2520eb[_0xb794('0x36')],{'$or':_[_0xb794('0x30')](_0x479693,function(_0xe5f5b7){if(_0xe5f5b7[_0xb794('0xc')]!=='VIRTUAL'){if(_0x3d28cb){return sequelize[_0xb794('0x36')](sequelize['fn'](_0xb794('0x3c'),sequelize[_0xb794('0x19')](_0xe5f5b7[_0xb794('0x13')])),{'$like':sequelize['fn'](_0xb794('0x3c'),'%'+_0x266430[_0xb794('0x2e')][_0xb794('0x38')]+'%')});}else{var _0x13f093={};_0x13f093[_0xe5f5b7[_0xb794('0x13')]]={'$like':'%'+_0x266430['query'][_0xb794('0x38')]+'%'};return _0x13f093;}}})});}_0x2520eb=_[_0xb794('0x3b')]({},_0x2520eb,_0x266430[_0xb794('0x3d')]);return _0x2520eb;};exports[_0xb794('0x3e')]=function(_0x45ef95){var _0x58d0db=[];if(_0x45ef95['includeAll']){_0x58d0db[_0xb794('0x2c')]({'all':!![]});}else if(_0x45ef95[_0xb794('0x3e')]){if(Array['isArray'](_0x45ef95[_0xb794('0x3e')])){_0x58d0db=Object['keys'](_0x45ef95['include'])['map'](function(_0x5f57e3){return parseIncludeModel(_0x45ef95['include'][_0x5f57e3]);});}else{var _0x4aa3d1=parseIncludeModel(_0x45ef95[_0xb794('0x3e')]);_0x58d0db[_0xb794('0x2c')](_0x4aa3d1);}}return _0x58d0db;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index d1aba17..412bb42 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 _0xb45d=['openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','busy','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','includes','getAgentIdsByStatus','resolve','name','fullname','voicePause','pauseType','globalStatus','split','fields','order','startsWith','ASC','getUpdatedSortOptions','fullname,internal','internal','indexOf','validateSortParameter','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatus','faxStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','mailStatus'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xb45d,0xfe));var _0xdb45=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0xb45d[_0x1e05c1];return _0x15f1ca;};'use strict';var _=require(_0xdb45('0x0'));var jayson=require(_0xdb45('0x1'));var db=require(_0xdb45('0x2'))['db'];var amiClient=jayson[_0xdb45('0x3')][_0xdb45('0x4')]({'port':0x232a});var routingClient=jayson[_0xdb45('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x29e3c2,_0x5c52c6){var _0x222a9d=[_0x29e3c2[_0xdb45('0x5')],_0x29e3c2[_0xdb45('0x6')],_0x29e3c2[_0xdb45('0x7')],_0x29e3c2[_0xdb45('0x8')],_0x29e3c2[_0xdb45('0x9')],_0x29e3c2['voicePause'],_0x29e3c2[_0xdb45('0xa')]];if(!_0x5c52c6)return _[_0xdb45('0xb')](_0x222a9d);var _0xb084ac=_[_0xdb45('0xc')](_0x222a9d);return _0xb084ac['length']>0x0&&_0xb084ac[_0xdb45('0xd')]<_0x222a9d[_0xdb45('0xd')]?!![]:![];}function isIdle(_0x5eff66){return _0x5eff66===_0xdb45('0xe')||_0x5eff66===_0xdb45('0xf')||_0x5eff66===_0xdb45('0x10')||_0x5eff66===_0xdb45('0x11')||_[_0xdb45('0x12')](_0x5eff66);}function isAgentIdle(_0x1f14a6){if(_0x1f14a6[_0xdb45('0x13')]!==_0xdb45('0xe')&&_0x1f14a6['voicePause']){_0x1f14a6[_0xdb45('0x13')]=_0xdb45('0x14');return![];}return _[_0xdb45('0xb')]([_0x1f14a6['chatStatus'],_0x1f14a6['faxStatus'],_0x1f14a6[_0xdb45('0x15')],_0x1f14a6[_0xdb45('0x16')],_0x1f14a6[_0xdb45('0x17')],_0x1f14a6[_0xdb45('0x13')],_0x1f14a6[_0xdb45('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xdb45('0x19')](_0xdb45('0x1a'),{})[_0xdb45('0x1b')](function(_0x570616){if(_0x570616[_0xdb45('0x1c')]){throw new Error(_0xdb45('0x1d'));}var _0x415651=_0x570616['result'];return routingClient[_0xdb45('0x19')](_0xdb45('0x1a'),{})[_0xdb45('0x1b')](function(_0x51c8a9){if(_0x51c8a9[_0xdb45('0x1c')]){throw new Error(_0xdb45('0x1e'));}var _0xd891d9=_0x51c8a9[_0xdb45('0x1f')];return _[_0xdb45('0x20')]({},_0x415651,_0xd891d9);});})[_0xdb45('0x21')](function(_0x2d7729){throw _0x2d7729;});}exports[_0xdb45('0x22')]=getRealtimeAgents;function getAgentStatus(_0x2610cc){var _0xf43393=_0xdb45('0xf');if(isAgentPaused(_0x2610cc))_0xf43393=_0xdb45('0x14');else if(isAgentPaused(_0x2610cc,!![]))_0xf43393='*pause';else if(isAgentIdle(_0x2610cc))_0xf43393=_0xdb45('0xe');else _0xf43393=_0xdb45('0x23');return _0xf43393;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x492090,_0x225a2d){var _0x142b62=_[_0xdb45('0x24')](_0x492090)?_0x492090:[_0x492090];var _0x4f46c0=_[_0xdb45('0x25')](_0x225a2d)+_0xdb45('0x26');var _0xbd9477=_[_0xdb45('0x27')](_0x142b62,function(_0x5d8bb2){return db[_0x4f46c0][_0xdb45('0x28')]({'where':{'id':_0x5d8bb2}})['then'](function(_0x5ba9e4){if(!_0x5ba9e4)return[];return _0x5ba9e4[_0xdb45('0x29')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xdb45('0x2a')](_0xbd9477)['then'](function(_0x594f16){var _0x1f0fef=_(_0x594f16)[_0xdb45('0x2b')]()[_0xdb45('0x27')]('id')[_0xdb45('0x2c')]()[_0xdb45('0x2d')]();return _0x1f0fef;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x106bff,_0x38b14a,_0x273e6e){try{if(_0x38b14a[_0xdb45('0xd')]>0x0){_0x106bff=_0x106bff[_0xdb45('0xc')](function(_0x4b07e9){return _0x38b14a[_0xdb45('0x2e')](_0x4b07e9['id']);});}var _0x2eed5e=_0x106bff[_0xdb45('0xc')](function(_0x5718f5){var _0xc3a2db=_0xdb45('0x23');if(isAgentIdle(_0x5718f5)){_0xc3a2db=_0xdb45('0xe');}return _0xc3a2db===_0x273e6e;});return _[_0xdb45('0x27')](_0x2eed5e,'id');}catch(_0x1d0f35){throw _0x1d0f35;}}exports[_0xdb45('0x2f')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x469c75,_0x555614,_0x2531ed){return Promise[_0xdb45('0x30')]()[_0xdb45('0x1b')](function(){if(_0x555614[_0xdb45('0xd')]>0x0){_0x469c75=_0x469c75[_0xdb45('0xc')](function(_0x2f5ef5){return _0x555614[_0xdb45('0x2e')](_0x2f5ef5['id']);});}return _0x469c75;})[_0xdb45('0x1b')](function(){return db['User']['findAll']({'attributes':['id',_0xdb45('0x31'),_0xdb45('0x32'),_0xdb45('0x5'),_0xdb45('0x6'),'mailPause',_0xdb45('0x8'),_0xdb45('0x9'),_0xdb45('0x33'),'whatsappPause',_0xdb45('0x34')],'where':{'id':{'$in':_[_0xdb45('0x27')](_0x469c75,'id')}},'raw':!![]});})['then'](function(_0x4cfb77){return _0x4cfb77['map'](function(_0x48718e){var _0x296089=_['find'](_0x469c75,['id',_0x48718e['id']]);var _0xa11c7=filterAgentAttributes(_0x296089);_[_0xdb45('0x20')](_0x48718e,_0xa11c7);_0x48718e[_0xdb45('0x35')]=getAgentStatus(_0x48718e);return _0x48718e;});})[_0xdb45('0x1b')](function(_0x4a7379){var _0x3a4f2f=sortAgentsByStatus(_0x4a7379,_0x2531ed);return _[_0xdb45('0x27')](_0x3a4f2f,'id');})[_0xdb45('0x21')](function(_0x10446e){throw _0x10446e;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x1966d0){var _0x4af75b={'fields':[],'order':null};var _0x4d02cf=_0x1966d0[_0xdb45('0x36')](',');_0x4af75b[_0xdb45('0x37')]=_[_0xdb45('0xc')](_0x4d02cf,function(_0x418cd1){if(!_0x418cd1[_0xdb45('0x2e')](_0xdb45('0x35'))){return!![];}_0x4af75b[_0xdb45('0x38')]=_[_0xdb45('0x39')](_0x418cd1,'-')?'DESC':_0xdb45('0x3a');return![];});return _0x4af75b;}exports[_0xdb45('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x54e856){if(!_0x54e856){_0x54e856=_0xdb45('0x3c');}if(_0x54e856['includes'](_0xdb45('0x32'))&&!_0x54e856[_0xdb45('0x2e')](_0xdb45('0x3d'))){var _0x94852f=_0x54e856['substring'](0x0,_0x54e856[_0xdb45('0x3e')](_0xdb45('0x32')));_0x54e856+=','+_0x94852f+'internal';}return _0x54e856;}exports[_0xdb45('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x28175f,_0x14862f){var _0x5b86da=_0x28175f['sort'](function(_0x26de39,_0x5780fa){if(_0x26de39[_0xdb45('0x35')]===_0x5780fa[_0xdb45('0x35')]){if(_0x26de39['globalStatus']===_0xdb45('0x14')){if(_0x14862f===_0xdb45('0x40')){return(_0x26de39[_0xdb45('0x34')]||'')<(_0x5780fa[_0xdb45('0x34')]||'')||_0x26de39[_0xdb45('0x32')][_0xdb45('0x41')]()>_0x5780fa['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x26de39[_0xdb45('0x34')]||'')<(_0x5780fa[_0xdb45('0x34')]||'')||_0x26de39[_0xdb45('0x32')][_0xdb45('0x41')]()>_0x5780fa[_0xdb45('0x32')][_0xdb45('0x41')]()?-0x1:0x1;}}else{if(_0x14862f==='DESC'){return _0x26de39[_0xdb45('0x32')][_0xdb45('0x41')]()<_0x5780fa[_0xdb45('0x32')][_0xdb45('0x41')]()?0x1:-0x1;}else{return _0x26de39['fullname'][_0xdb45('0x41')]()<_0x5780fa[_0xdb45('0x32')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x14862f===_0xdb45('0x40')){return _0x26de39[_0xdb45('0x35')]<_0x5780fa[_0xdb45('0x35')]?0x1:-0x1;}else{return _0x26de39['globalStatus']<_0x5780fa[_0xdb45('0x35')]?-0x1:0x1;}}});return _0x5b86da;}exports[_0xdb45('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0xf7a2e6){var _0x4f717d=[_0xdb45('0x43'),_0xdb45('0x44'),'lastLoginAt',_0xdb45('0x45'),_0xdb45('0x34'),_0xdb45('0x45'),_0xdb45('0x3d'),_0xdb45('0x46'),_0xdb45('0x5'),_0xdb45('0x8'),_0xdb45('0x7'),'smsPause',_0xdb45('0xa'),_0xdb45('0x6'),_0xdb45('0x33'),_0xdb45('0x47'),_0xdb45('0x48'),_0xdb45('0x49'),_0xdb45('0x4a'),'whatsappCapacity','faxCapacity',_0xdb45('0x4b'),'openchannelCurrentCapacity',_0xdb45('0x4c'),_0xdb45('0x4d'),'whatsappCurrentCapacity',_0xdb45('0x4e'),_0xdb45('0x4f'),_0xdb45('0x16'),_0xdb45('0x15'),_0xdb45('0x17'),_0xdb45('0x18'),_0xdb45('0x50'),_0xdb45('0x13'),'chatStatusTime',_0xdb45('0x51'),_0xdb45('0x52'),_0xdb45('0x53'),_0xdb45('0x54'),_0xdb45('0x55'),'voiceStatusTime',_0xdb45('0x56'),_0xdb45('0x57'),'screenrecording',_0xdb45('0x58'),_0xdb45('0x59'),_0xdb45('0x5a')];var _0xe51e65=['chatPause',_0xdb45('0x8'),_0xdb45('0x7'),_0xdb45('0x9'),'whatsappPause',_0xdb45('0x6'),_0xdb45('0x33'),'online'];var _0x48cc37=_(_0xf7a2e6)['omit'](_0xe51e65)['pick'](_0x4f717d)['value']();return _0x48cc37;}exports[_0xdb45('0x5b')]=filterAgentAttributes; \ No newline at end of file +var _0x18f4=['toLowerCase','pauseType','online','lastLoginAt','lastPauseAt','address','chatPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','smsStatus','chatStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','omit','value','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','http','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','busy','getAgentStatus','isArray','startCase','Queue','all','flatten','uniq','getAgentIdsByQueues','getAgentIdsByStatus','resolve','includes','fullname','faxPause','map','globalStatus','getSortedAgentsIdsByStatus','split','fields','startsWith','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','DESC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x18f4,0xda));var _0x418f=function(_0x8e60f3,_0x3843ab){_0x8e60f3=_0x8e60f3-0x0;var _0x583267=_0x18f4[_0x8e60f3];return _0x583267;};'use strict';var _=require(_0x418f('0x0'));var jayson=require(_0x418f('0x1'));var db=require(_0x418f('0x2'))['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson['client'][_0x418f('0x3')]({'port':0x232c});function isAgentPaused(_0x264334,_0x10cf52){var _0x4d3ac6=[_0x264334['chatPause'],_0x264334['faxPause'],_0x264334[_0x418f('0x4')],_0x264334[_0x418f('0x5')],_0x264334[_0x418f('0x6')],_0x264334[_0x418f('0x7')],_0x264334[_0x418f('0x8')]];if(!_0x10cf52)return _[_0x418f('0x9')](_0x4d3ac6);var _0x5a6f11=_[_0x418f('0xa')](_0x4d3ac6);return _0x5a6f11[_0x418f('0xb')]>0x0&&_0x5a6f11[_0x418f('0xb')]<_0x4d3ac6[_0x418f('0xb')]?!![]:![];}function isIdle(_0x502062){return _0x502062===_0x418f('0xc')||_0x502062===_0x418f('0xd')||_0x502062==='unavailable'||_0x502062===_0x418f('0xe')||_[_0x418f('0xf')](_0x502062);}function isAgentIdle(_0x587392){if(_0x587392[_0x418f('0x10')]!==_0x418f('0xc')&&_0x587392[_0x418f('0x7')]){_0x587392[_0x418f('0x10')]=_0x418f('0x11');return![];}return _[_0x418f('0x9')]([_0x587392[_0x418f('0x12')],_0x587392[_0x418f('0x13')],_0x587392[_0x418f('0x14')],_0x587392[_0x418f('0x15')],_0x587392['smsStatus'],_0x587392[_0x418f('0x10')],_0x587392[_0x418f('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x418f('0x17')](_0x418f('0x18'),{})[_0x418f('0x19')](function(_0x1caf59){if(_0x1caf59[_0x418f('0x1a')]){throw new Error(_0x418f('0x1b'));}var _0x5dc177=_0x1caf59['result'];return routingClient[_0x418f('0x17')](_0x418f('0x18'),{})[_0x418f('0x19')](function(_0x107b2e){if(_0x107b2e[_0x418f('0x1a')]){throw new Error(_0x418f('0x1c'));}var _0x5e668c=_0x107b2e[_0x418f('0x1d')];return _[_0x418f('0x1e')]({},_0x5dc177,_0x5e668c);});})[_0x418f('0x1f')](function(_0x39a299){throw _0x39a299;});}exports[_0x418f('0x20')]=getRealtimeAgents;function getAgentStatus(_0x214e8f){var _0x2aaeba='unknown';if(isAgentPaused(_0x214e8f))_0x2aaeba=_0x418f('0x11');else if(isAgentPaused(_0x214e8f,!![]))_0x2aaeba='*pause';else if(isAgentIdle(_0x214e8f))_0x2aaeba=_0x418f('0xc');else _0x2aaeba=_0x418f('0x21');return _0x2aaeba;}exports[_0x418f('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x5c40c4,_0x390746){var _0x5897d2=_[_0x418f('0x23')](_0x5c40c4)?_0x5c40c4:[_0x5c40c4];var _0xd123b0=_[_0x418f('0x24')](_0x390746)+_0x418f('0x25');var _0x3f4b77=_['map'](_0x5897d2,function(_0x18b964){return db[_0xd123b0]['findOne']({'where':{'id':_0x18b964}})[_0x418f('0x19')](function(_0x459e39){if(!_0x459e39)return[];return _0x459e39['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x418f('0x26')](_0x3f4b77)[_0x418f('0x19')](function(_0x5bdcbd){var _0x538972=_(_0x5bdcbd)[_0x418f('0x27')]()['map']('id')[_0x418f('0x28')]()['value']();return _0x538972;});}exports[_0x418f('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x15464a,_0x19eede,_0x32cc14){try{if(_0x19eede[_0x418f('0xb')]>0x0){_0x15464a=_0x15464a[_0x418f('0xa')](function(_0x31ec2c){return _0x19eede['includes'](_0x31ec2c['id']);});}var _0xdfd20a=_0x15464a[_0x418f('0xa')](function(_0x453d9f){var _0x1529dd=_0x418f('0x21');if(isAgentIdle(_0x453d9f)){_0x1529dd='idle';}return _0x1529dd===_0x32cc14;});return _['map'](_0xdfd20a,'id');}catch(_0x4d0110){throw _0x4d0110;}}exports[_0x418f('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x3a47f4,_0x1e27df,_0x46f8b8){return Promise[_0x418f('0x2b')]()[_0x418f('0x19')](function(){if(_0x1e27df[_0x418f('0xb')]>0x0){_0x3a47f4=_0x3a47f4[_0x418f('0xa')](function(_0x40e078){return _0x1e27df[_0x418f('0x2c')](_0x40e078['id']);});}return _0x3a47f4;})[_0x418f('0x19')](function(){return db['User']['findAll']({'attributes':['id','name',_0x418f('0x2d'),'chatPause',_0x418f('0x2e'),_0x418f('0x4'),_0x418f('0x5'),_0x418f('0x6'),_0x418f('0x7'),_0x418f('0x8'),'pauseType'],'where':{'id':{'$in':_['map'](_0x3a47f4,'id')}},'raw':!![]});})[_0x418f('0x19')](function(_0x57e739){return _0x57e739[_0x418f('0x2f')](function(_0x329870){var _0x128e4c=_['find'](_0x3a47f4,['id',_0x329870['id']]);var _0x554880=filterAgentAttributes(_0x128e4c);_[_0x418f('0x1e')](_0x329870,_0x554880);_0x329870[_0x418f('0x30')]=getAgentStatus(_0x329870);return _0x329870;});})[_0x418f('0x19')](function(_0x5176d7){var _0x4c7c0f=sortAgentsByStatus(_0x5176d7,_0x46f8b8);return _[_0x418f('0x2f')](_0x4c7c0f,'id');})[_0x418f('0x1f')](function(_0x50d71e){throw _0x50d71e;});}exports[_0x418f('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x306c8c){var _0x4d8902={'fields':[],'order':null};var _0x362aeb=_0x306c8c[_0x418f('0x32')](',');_0x4d8902[_0x418f('0x33')]=_[_0x418f('0xa')](_0x362aeb,function(_0x1dad9b){if(!_0x1dad9b[_0x418f('0x2c')](_0x418f('0x30'))){return!![];}_0x4d8902['order']=_[_0x418f('0x34')](_0x1dad9b,'-')?'DESC':_0x418f('0x35');return![];});return _0x4d8902;}exports[_0x418f('0x36')]=getUpdatedSortOptions;function validateSortParameter(_0x3ce9a2){if(!_0x3ce9a2){_0x3ce9a2='fullname,internal';}if(_0x3ce9a2[_0x418f('0x2c')](_0x418f('0x2d'))&&!_0x3ce9a2[_0x418f('0x2c')](_0x418f('0x37'))){var _0x57e505=_0x3ce9a2[_0x418f('0x38')](0x0,_0x3ce9a2[_0x418f('0x39')](_0x418f('0x2d')));_0x3ce9a2+=','+_0x57e505+_0x418f('0x37');}return _0x3ce9a2;}exports[_0x418f('0x3a')]=validateSortParameter;function sortAgentsByStatus(_0x317d89,_0x4de4bf){var _0x574b21=_0x317d89[_0x418f('0x3b')](function(_0x29e42e,_0x1e632e){if(_0x29e42e['globalStatus']===_0x1e632e['globalStatus']){if(_0x29e42e[_0x418f('0x30')]===_0x418f('0x11')){if(_0x4de4bf===_0x418f('0x3c')){return(_0x29e42e['pauseType']||'')<(_0x1e632e['pauseType']||'')||_0x29e42e[_0x418f('0x2d')][_0x418f('0x3d')]()>_0x1e632e[_0x418f('0x2d')][_0x418f('0x3d')]()?0x1:-0x1;}else{return(_0x29e42e[_0x418f('0x3e')]||'')<(_0x1e632e[_0x418f('0x3e')]||'')||_0x29e42e[_0x418f('0x2d')][_0x418f('0x3d')]()>_0x1e632e[_0x418f('0x2d')][_0x418f('0x3d')]()?-0x1:0x1;}}else{if(_0x4de4bf==='DESC'){return _0x29e42e['fullname']['toLowerCase']()<_0x1e632e[_0x418f('0x2d')][_0x418f('0x3d')]()?0x1:-0x1;}else{return _0x29e42e[_0x418f('0x2d')][_0x418f('0x3d')]()<_0x1e632e[_0x418f('0x2d')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x4de4bf===_0x418f('0x3c')){return _0x29e42e['globalStatus']<_0x1e632e[_0x418f('0x30')]?0x1:-0x1;}else{return _0x29e42e[_0x418f('0x30')]<_0x1e632e[_0x418f('0x30')]?-0x1:0x1;}}});return _0x574b21;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x406657){var _0x20ab39=['userpic',_0x418f('0x3f'),_0x418f('0x40'),_0x418f('0x41'),_0x418f('0x3e'),_0x418f('0x41'),'internal',_0x418f('0x42'),_0x418f('0x43'),'openchannelPause','mailPause',_0x418f('0x6'),_0x418f('0x8'),_0x418f('0x2e'),_0x418f('0x7'),_0x418f('0x44'),_0x418f('0x45'),_0x418f('0x46'),_0x418f('0x47'),_0x418f('0x48'),_0x418f('0x49'),_0x418f('0x4a'),_0x418f('0x4b'),_0x418f('0x4c'),_0x418f('0x4d'),_0x418f('0x4e'),_0x418f('0x4f'),_0x418f('0x12'),'openchannelStatus',_0x418f('0x14'),_0x418f('0x50'),'whatsappStatus',_0x418f('0x13'),_0x418f('0x10'),_0x418f('0x51'),'openchannelStatusTime',_0x418f('0x52'),_0x418f('0x53'),'whatsappStatusTime',_0x418f('0x54'),_0x418f('0x55'),'queue',_0x418f('0x56'),_0x418f('0x57'),'phoneBarEnableScreenRecordingByAgent',_0x418f('0x58'),_0x418f('0x59')];var _0x3a3f29=[_0x418f('0x43'),_0x418f('0x5'),_0x418f('0x4'),_0x418f('0x6'),_0x418f('0x8'),_0x418f('0x2e'),_0x418f('0x7'),_0x418f('0x3f')];var _0x497b36=_(_0x406657)[_0x418f('0x5a')](_0x3a3f29)['pick'](_0x20ab39)[_0x418f('0x5b')]();return _0x497b36;}exports[_0x418f('0x5c')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 4817e85..2ca5a30 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 _0x4692=['jayson/promise','util','http','available','loggedIn','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','originated','message','dialActive','dialMethod','startPredictive','startProgressive','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','getRealtimeQueues','inbound','map','paused','waiting','pTalking','find','merge','initializeQueues','lodash'];(function(_0x1f9503,_0x8e450b){var _0xaab94f=function(_0x5b0c4d){while(--_0x5b0c4d){_0x1f9503['push'](_0x1f9503['shift']());}};_0xaab94f(++_0x8e450b);}(_0x4692,0x1f3));var _0x2469=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x4692[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x2469('0x0'));var jayson=require(_0x2469('0x1'));var util=require(_0x2469('0x2'));var amiClient=jayson['client'][_0x2469('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x2469('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x2469('0x4'),_0x2469('0x5'),'paused','waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x2469('0x6'),_0x2469('0x7'),_0x2469('0x8'),_0x2469('0x9'),_0x2469('0xa'),_0x2469('0xb'),_0x2469('0xc'),_0x2469('0xd'),_0x2469('0xe'),_0x2469('0xf'),_0x2469('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x2469('0x11'),_0x2469('0x12'),'statusMessage',_0x2469('0x13'),_0x2469('0x14'),'Trunk',_0x2469('0x15'),_0x2469('0x16'),'erlangCalls',_0x2469('0x17'),'erlangAbandonmentRate',_0x2469('0x18'),_0x2469('0x19'),_0x2469('0x1a'),_0x2469('0x1b'),_0x2469('0x1c'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x2469('0x1d'),_0x2469('0x1e'),_0x2469('0x1f')];function getRealtimeQueues(_0x35f71b,_0x336289){var _0x22be90=_0x336289===_0x2469('0x20')?amiClient:routingClient;return _0x22be90[_0x2469('0x21')](_[_0x2469('0x22')](_0x336289)+_0x2469('0x23'),_0x35f71b)[_0x2469('0x24')](function(_0x5c37d1){if(_0x5c37d1[_0x2469('0x25')])throw new Error(util[_0x2469('0x26')](_0x2469('0x27'),_0x336289));return _0x5c37d1['result'];})[_0x2469('0x28')](function(_0x38a168){throw _0x38a168;});}exports[_0x2469('0x29')]=getRealtimeQueues;function initializeQueues(_0x23f9e0,_0x1b9102,_0x1af81f,_0x1aa5ed){var _0x409e7d=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1af81f==='voice'){if(_0x1aa5ed===_0x2469('0x2a')){_0x409e7d=_0x409e7d['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x1aa5ed==='outbound'){_0x409e7d=_0x409e7d['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x23f9e0[_0x2469('0x2b')](function(_0x472e74){var _0x477210=_0x472e74['get']({'plain':!![]});_0x477210[_0x2469('0x2c')]=0x0;_0x477210[_0x2469('0x9')]=0x0;_0x477210[_0x2469('0x5')]=0x0;_0x477210[_0x2469('0x4')]=0x0;_0x477210[_0x2469('0x2d')]=0x0;if(_0x1af81f===_0x2469('0x20')){_0x477210['talking']=0x0;_0x477210[_0x2469('0x6')]=0x0;if(_0x1aa5ed==='outbound'){_0x477210[_0x2469('0x2e')]=0x0;_0x477210[_0x2469('0x11')]=0x0;}}var _0x5bb04a=_[_0x2469('0x2f')](_0x1b9102,['id',_0x477210['id']]);if(_0x5bb04a){_[_0x2469('0x30')](_0x477210,_['pick'](_0x5bb04a,_0x409e7d));}return _0x477210;});}exports[_0x2469('0x31')]=initializeQueues; \ No newline at end of file +var _0x623a=['predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','concat','outbound','map','get','paused','find','merge','pick','initializeQueues','jayson/promise','util','http','client','available','loggedIn','waiting','busy','inUse','loggedInDb','notInUse','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable'];(function(_0x13a266,_0x4b8dd7){var _0xf6464e=function(_0x491483){while(--_0x491483){_0x13a266['push'](_0x13a266['shift']());}};_0xf6464e(++_0x4b8dd7);}(_0x623a,0x131));var _0xa623=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x623a[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var jayson=require(_0xa623('0x0'));var util=require(_0xa623('0x1'));var amiClient=jayson['client'][_0xa623('0x2')]({'port':0x232a});var routingClient=jayson[_0xa623('0x3')][_0xa623('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xa623('0x4'),_0xa623('0x5'),'paused',_0xa623('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0xa623('0x7'),_0xa623('0x8'),'invalid',_0xa623('0x9'),_0xa623('0xa'),'onHold',_0xa623('0xb'),_0xa623('0xc'),_0xa623('0xd'),_0xa623('0xe'),_0xa623('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xa623('0x10'),_0xa623('0x11'),_0xa623('0x12'),_0xa623('0x13'),_0xa623('0x14'),_0xa623('0x15'),'Trunk',_0xa623('0x16'),_0xa623('0x17'),_0xa623('0x18'),_0xa623('0x19'),_0xa623('0x1a'),_0xa623('0x1b'),_0xa623('0x1c'),'dialPredictiveIntervalMaxThreshold',_0xa623('0x1d'),_0xa623('0x1e'),_0xa623('0x1f'),_0xa623('0x20'),_0xa623('0x21'),_0xa623('0x22'),_0xa623('0x23'),_0xa623('0x24')];function getRealtimeQueues(_0x2db278,_0x366d99){var _0x41974=_0x366d99===_0xa623('0x25')?amiClient:routingClient;return _0x41974[_0xa623('0x26')](_['startCase'](_0x366d99)+_0xa623('0x27'),_0x2db278)[_0xa623('0x28')](function(_0x32dd53){if(_0x32dd53[_0xa623('0x29')])throw new Error(util[_0xa623('0x2a')](_0xa623('0x2b'),_0x366d99));return _0x32dd53[_0xa623('0x2c')];})[_0xa623('0x2d')](function(_0x2e6f88){throw _0x2e6f88;});}exports[_0xa623('0x2e')]=getRealtimeQueues;function initializeQueues(_0xfcfa33,_0x3a8a84,_0x2e6c52,_0x194f0d){var _0x22d2a3=DEFAULT_QUEUE_ATTRIBUTES;if(_0x2e6c52===_0xa623('0x25')){if(_0x194f0d==='inbound'){_0x22d2a3=_0x22d2a3[_0xa623('0x2f')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x194f0d===_0xa623('0x30')){_0x22d2a3=_0x22d2a3['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0xfcfa33[_0xa623('0x31')](function(_0x3f58d9){var _0xa6d566=_0x3f58d9[_0xa623('0x32')]({'plain':!![]});_0xa6d566[_0xa623('0x33')]=0x0;_0xa6d566[_0xa623('0x9')]=0x0;_0xa6d566[_0xa623('0x5')]=0x0;_0xa6d566[_0xa623('0x4')]=0x0;_0xa6d566['waiting']=0x0;if(_0x2e6c52===_0xa623('0x25')){_0xa6d566[_0xa623('0xd')]=0x0;_0xa6d566['busy']=0x0;if(_0x194f0d===_0xa623('0x30')){_0xa6d566[_0xa623('0x10')]=0x0;_0xa6d566[_0xa623('0x11')]=0x0;}}var _0x65e5d4=_[_0xa623('0x34')](_0x3a8a84,['id',_0xa6d566['id']]);if(_0x65e5d4){_[_0xa623('0x35')](_0xa6d566,_[_0xa623('0x36')](_0x65e5d4,_0x22d2a3));}return _0xa6d566;});}exports[_0xa623('0x37')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index b310161..61c482e 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(_0x13524d,_0x505b49){var _0x9918b4=function(_0xef1f0a){while(--_0xef1f0a){_0x13524d['push'](_0x13524d['shift']());}};_0x9918b4(++_0x505b49);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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(_0x59dccc,_0x184c1c){var _0xc97bcb=function(_0x1ddbcb){while(--_0x1ddbcb){_0x59dccc['push'](_0x59dccc['shift']());}};_0xc97bcb(++_0x184c1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 02eec90..c1ebb17 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 _0x918e=['getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','join','createHash','update','digest','hex'];(function(_0x4fb9ed,_0x187ea0){var _0x263645=function(_0x11c604){while(--_0x11c604){_0x4fb9ed['push'](_0x4fb9ed['shift']());}};_0x263645(++_0x187ea0);}(_0x918e,0x187));var _0xe918=function(_0x3f14ae,_0x2ea0c6){_0x3f14ae=_0x3f14ae-0x0;var _0x5d46eb=_0x918e[_0x3f14ae];return _0x5d46eb;};'use strict';var _=require(_0xe918('0x0'));var os=require('os');var crypto=require(_0xe918('0x1'));var machine=require(_0xe918('0x2'));var exec=require(_0xe918('0x3'))[_0xe918('0x4')];var config=require(_0xe918('0x5'));function getInterfaces(){var _0x3e9380=[];var _0x52b375=os[_0xe918('0x6')]();var _0x11ecd9=_[_0xe918('0x7')](_[_0xe918('0x8')](_0x52b375));for(var _0x113fd0=0x0;_0x113fd0<_0x11ecd9[_0xe918('0x9')];_0x113fd0++){var _0x342c42=_0x52b375[_0x11ecd9[_0x113fd0]]['filter'](function(_0x11720b){return _0x11720b[_0xe918('0xa')]===_0xe918('0xb')&&_0x11720b[_0xe918('0xc')]===![];});_0x3e9380=_0x3e9380[_0xe918('0xd')](_0x342c42);}return _0x3e9380;}function getFirstInterface(){var _0x385d5c=_[_0xe918('0xe')](getInterfaces());return{'macAddress':_0x385d5c&&_0x385d5c['mac']?_0x385d5c[_0xe918('0xf')]:_0xe918('0x10'),'ipAddress':_0x385d5c&&_0x385d5c[_0xe918('0x11')]?_0x385d5c['address']:'127.0.0.1'};}exports[_0xe918('0x12')]=getFirstInterface;function getCPUhash(){var _0x5e0a38=_['orderBy'](os[_0xe918('0x13')]()[_0xe918('0x14')](function(_0x486050){return _0x486050[_0xe918('0x15')];}))[_0xe918('0x16')](':');return crypto[_0xe918('0x17')]('md5')[_0xe918('0x18')](_0x5e0a38)[_0xe918('0x19')](_0xe918('0x1a'));}exports[_0xe918('0x1b')]=function(){var _0x4ce42a=os[_0xe918('0x1c')]();var _0x5cd853=/[0-9a-f-]{36}/;if(config[_0xe918('0x1d')]&&_0x5cd853['test'](config[_0xe918('0x1d')])){return config['licenseToken'];}else if(_0x4ce42a===_0xe918('0x1e')){return exec(_0xe918('0x1f'),{'encoding':_0xe918('0x20')})[_0xe918('0x21')]('\x0d\x0a','');}else{var _0x32a016=getFirstInterface();var _0x235301=getCPUhash();var _0x5e504b=_0x235301+'|'+os[_0xe918('0x22')]()+'|'+_0x32a016['macAddress']+'|'+_0x32a016[_0xe918('0x23')];var _0x5f542a=crypto[_0xe918('0x17')](_0xe918('0x24'))[_0xe918('0x18')](_0x5e504b)[_0xe918('0x19')](_0xe918('0x1a'));return _0x5f542a['substring'](0x0,0x8)+'-'+_0x5f542a[_0xe918('0x25')](0x8,0xc)+'-'+_0x5f542a[_0xe918('0x25')](0xc,0x10)+'-'+_0x5f542a[_0xe918('0x25')](0x10,0x14)+'-'+_0x5f542a['substring'](0x14);}}; \ No newline at end of file +var _0x27b2=['platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','substring','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid'];(function(_0x7ad6cb,_0xffee6c){var _0x22a0ba=function(_0x47f291){while(--_0x47f291){_0x7ad6cb['push'](_0x7ad6cb['shift']());}};_0x22a0ba(++_0xffee6c);}(_0x27b2,0x1de));var _0x227b=function(_0x2086ff,_0x5d9a5e){_0x2086ff=_0x2086ff-0x0;var _0xaa3bd3=_0x27b2[_0x2086ff];return _0xaa3bd3;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x227b('0x0'));var exec=require(_0x227b('0x1'))[_0x227b('0x2')];var config=require(_0x227b('0x3'));function getInterfaces(){var _0x1c97b0=[];var _0x38c921=os[_0x227b('0x4')]();var _0x41c965=_[_0x227b('0x5')](_['keys'](_0x38c921));for(var _0x42c114=0x0;_0x42c114<_0x41c965[_0x227b('0x6')];_0x42c114++){var _0x5e974f=_0x38c921[_0x41c965[_0x42c114]][_0x227b('0x7')](function(_0x2fd196){return _0x2fd196[_0x227b('0x8')]===_0x227b('0x9')&&_0x2fd196[_0x227b('0xa')]===![];});_0x1c97b0=_0x1c97b0[_0x227b('0xb')](_0x5e974f);}return _0x1c97b0;}function getFirstInterface(){var _0xba16aa=_['head'](getInterfaces());return{'macAddress':_0xba16aa&&_0xba16aa['mac']?_0xba16aa[_0x227b('0xc')]:_0x227b('0xd'),'ipAddress':_0xba16aa&&_0xba16aa[_0x227b('0xe')]?_0xba16aa['address']:_0x227b('0xf')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x29cd9f=_['orderBy'](os[_0x227b('0x10')]()[_0x227b('0x11')](function(_0x25e590){return _0x25e590[_0x227b('0x12')];}))[_0x227b('0x13')](':');return crypto[_0x227b('0x14')](_0x227b('0x15'))[_0x227b('0x16')](_0x29cd9f)[_0x227b('0x17')](_0x227b('0x18'));}exports[_0x227b('0x19')]=function(){var _0x43a51b=os[_0x227b('0x1a')]();var _0x30dbcf=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x30dbcf[_0x227b('0x1b')](config['licenseToken'])){return config[_0x227b('0x1c')];}else if(_0x43a51b===_0x227b('0x1d')){return exec(_0x227b('0x1e'),{'encoding':'utf8'})[_0x227b('0x1f')]('\x0d\x0a','');}else{var _0x183766=getFirstInterface();var _0x29e651=getCPUhash();var _0x56c83f=_0x29e651+'|'+os[_0x227b('0x20')]()+'|'+_0x183766[_0x227b('0x21')]+'|'+_0x183766[_0x227b('0x22')];var _0x147a4c=crypto[_0x227b('0x14')](_0x227b('0x15'))[_0x227b('0x16')](_0x56c83f)['digest'](_0x227b('0x18'));return _0x147a4c[_0x227b('0x23')](0x0,0x8)+'-'+_0x147a4c[_0x227b('0x23')](0x8,0xc)+'-'+_0x147a4c['substring'](0xc,0x10)+'-'+_0x147a4c['substring'](0x10,0x14)+'-'+_0x147a4c[_0x227b('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 1c6a229..b232cef 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 _0x906a=['version','../../mysqldb','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data1','data2','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x906a,0x74));var _0xa906=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x906a[_0x138adb];return _0x1b27f2;};'use strict';var util=require('util');var moment=require(_0xa906('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0xa906('0x1'));var db=require(_0xa906('0x2'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xa906('0x3'));var logger=require(_0xa906('0x4'))('license');var HOST=_0xa906('0x5');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x36bed7){return new BPromise(function(_0xf62022,_0x20a86b){var _0x37a531=util[_0xa906('0x6')](_0xa906('0x7'),HOST,_0x36bed7,module[_0xa906('0x8')]['version']);if(oldToken){_0x37a531=util[_0xa906('0x6')](_0xa906('0x9'),HOST,_0x36bed7,module[_0xa906('0x8')][_0xa906('0x1')],oldToken);}var _0x171674={'uri':_0x37a531,'method':_0xa906('0xa'),'timeout':0xea60,'json':!![]};return rp(_0x171674)[_0xa906('0xb')](function(_0x4324cc){_0xf62022(_0x4324cc);})['catch'](function(_0x26e62b){_0x20a86b(_0x26e62b);});});}function manageLicense(_0x20aa8f,_0x4baa02){var _0x3f68ce=_0x4baa02[_0xa906('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x3f68ce[_0xa906('0xd')]!==_0x20aa8f&&!_0x3f68ce[_0xa906('0xe')]){oldToken=_0x3f68ce['data1'];}httpRequest(_0x20aa8f)[_0xa906('0xb')](function(_0x271c05){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x271c05[_0xa906('0xf')]){isOldTokenSent=![];if(!_0x3f68ce['license']&&_0x3f68ce[_0xa906('0x10')]!=_0x271c05['license']||_0x3f68ce[_0xa906('0x10')]&&_0x3f68ce[_0xa906('0xe')]){logger[_0xa906('0x11')](_0xa906('0x12'));}if(_0x3f68ce[_0xa906('0x10')]&&!_0x3f68ce[_0xa906('0xe')]&&_0x3f68ce[_0xa906('0x10')]!=_0x271c05[_0xa906('0x10')]){logger[_0xa906('0x11')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3f68ce['license']&&!_0x3f68ce['data2']&&_0x3f68ce[_0xa906('0x10')]==_0x271c05['license']){return _0x4baa02;}return _0x4baa02[_0xa906('0x13')]({'data1':_0x20aa8f,'data2':null,'license':_0x271c05[_0xa906('0x10')]});}else{if(_0x271c05[_0xa906('0x10')]||_0x3f68ce[_0xa906('0x10')]){if(!_0x3f68ce[_0xa906('0xe')]){if(_0x3f68ce[_0xa906('0xd')]==_0x20aa8f){GRAY_PERIOD_REASON='Disabled';logger['info'](_0xa906('0x14'));}else{GRAY_PERIOD_REASON=_0xa906('0x15');logger[_0xa906('0x11')](_0xa906('0x16'),_0x3f68ce['data1'],_0x20aa8f);}logger[_0xa906('0x11')](_0xa906('0x17'),GRAY_PERIOD_REASON[_0xa906('0x18')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x4baa02[_0xa906('0x13')]({'data2':encryptor[_0xa906('0x19')](moment()[_0xa906('0x6')](_0xa906('0x1a')))});}else{if(moment()['diff'](encryptor[_0xa906('0x1b')](_0x3f68ce[_0xa906('0xe')]),_0xa906('0x1c'))>DAYS){logger['info'](_0xa906('0x1d'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x4baa02[_0xa906('0x13')]({'data1':_0x20aa8f,'data2':null,'license':null});}}}else{if(_0x3f68ce[_0xa906('0xd')]!=_0x20aa8f){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3f68ce[_0xa906('0xd')],_0x20aa8f);return _0x4baa02[_0xa906('0x13')]({'data1':_0x20aa8f,'data2':null,'license':null});}}}return _0x4baa02;})['then'](function(_0xcc1880){_0x4baa02=_0xcc1880;})[_0xa906('0x1e')](function(_0x3d09a2){logger[_0xa906('0x1f')](_0x3d09a2[_0xa906('0x20')]);})[_0xa906('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0xa906('0x22')](),_0x4baa02);},TIME);});}function defaultLicense(){var _0x5513b7=hardware[_0xa906('0x22')]();if(_0x5513b7){return db[_0xa906('0x23')][_0xa906('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x5513b7}})['spread'](function(_0x27d517,_0x2b874b){logger[_0xa906('0x11')](_0xa906('0x25'),_0x5513b7);manageLicense(_0x5513b7,_0x27d517);})[_0xa906('0x1e')](function(_0x577756){logger[_0xa906('0x1f')](_0x577756['message']);});}}exports[_0xa906('0x26')]=defaultLicense; \ No newline at end of file +var _0x34e8=['format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','catch','data1','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','License','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com'];(function(_0xf5b760,_0x160250){var _0x441e99=function(_0x58ec5b){while(--_0x58ec5b){_0xf5b760['push'](_0xf5b760['shift']());}};_0x441e99(++_0x160250);}(_0x34e8,0x1f1));var _0x834e=function(_0x1b23d8,_0x1948ee){_0x1b23d8=_0x1b23d8-0x0;var _0x4d33aa=_0x34e8[_0x1b23d8];return _0x4d33aa;};'use strict';var util=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var rp=require('request-promise');var BPromise=require(_0x834e('0x2'));var pkginfo=require(_0x834e('0x3'))(module,_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var encryptor=require(_0x834e('0x6'));var hardware=require('./hardware');var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var HOST=_0x834e('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x42b4f3){return new BPromise(function(_0x24a8c4,_0xe7ca76){var _0x17a077=util[_0x834e('0xa')](_0x834e('0xb'),HOST,_0x42b4f3,module[_0x834e('0xc')]['version']);if(oldToken){_0x17a077=util[_0x834e('0xa')](_0x834e('0xd'),HOST,_0x42b4f3,module[_0x834e('0xc')]['version'],oldToken);}var _0x532447={'uri':_0x17a077,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x532447)['then'](function(_0x237396){_0x24a8c4(_0x237396);})[_0x834e('0xe')](function(_0x255e32){_0xe7ca76(_0x255e32);});});}function manageLicense(_0x509c03,_0x56aa26){var _0x187d9c=_0x56aa26['get']({'plain':!![]});if(!isOldTokenSent&&_0x187d9c[_0x834e('0xf')]!==_0x509c03&&!_0x187d9c['data2']){oldToken=_0x187d9c[_0x834e('0xf')];}httpRequest(_0x509c03)[_0x834e('0x10')](function(_0x456a8d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x456a8d[_0x834e('0x11')]){isOldTokenSent=![];if(!_0x187d9c[_0x834e('0x8')]&&_0x187d9c[_0x834e('0x8')]!=_0x456a8d[_0x834e('0x8')]||_0x187d9c[_0x834e('0x8')]&&_0x187d9c['data2']){logger[_0x834e('0x12')](_0x834e('0x13'));}if(_0x187d9c[_0x834e('0x8')]&&!_0x187d9c[_0x834e('0x14')]&&_0x187d9c[_0x834e('0x8')]!=_0x456a8d[_0x834e('0x8')]){logger['info'](_0x834e('0x15'));}if(_0x187d9c[_0x834e('0x8')]&&!_0x187d9c[_0x834e('0x14')]&&_0x187d9c[_0x834e('0x8')]==_0x456a8d['license']){return _0x56aa26;}return _0x56aa26[_0x834e('0x16')]({'data1':_0x509c03,'data2':null,'license':_0x456a8d[_0x834e('0x8')]});}else{if(_0x456a8d[_0x834e('0x8')]||_0x187d9c[_0x834e('0x8')]){if(!_0x187d9c[_0x834e('0x14')]){if(_0x187d9c['data1']==_0x509c03){GRAY_PERIOD_REASON=_0x834e('0x17');logger[_0x834e('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x834e('0x18');logger[_0x834e('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x187d9c['data1'],_0x509c03);}logger[_0x834e('0x12')](_0x834e('0x19'),GRAY_PERIOD_REASON[_0x834e('0x1a')](),moment()[_0x834e('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x56aa26[_0x834e('0x16')]({'data2':encryptor['encryptString'](moment()[_0x834e('0xa')](_0x834e('0x1b')))});}else{if(moment()[_0x834e('0x1c')](encryptor['decryptString'](_0x187d9c['data2']),_0x834e('0x1d'))>DAYS){logger['info'](_0x834e('0x1e'),moment()[_0x834e('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x56aa26['update']({'data1':_0x509c03,'data2':null,'license':null});}}}else{if(_0x187d9c[_0x834e('0xf')]!=_0x509c03){logger[_0x834e('0x12')](_0x834e('0x1f'),_0x187d9c[_0x834e('0xf')],_0x509c03);return _0x56aa26[_0x834e('0x16')]({'data1':_0x509c03,'data2':null,'license':null});}}}return _0x56aa26;})[_0x834e('0x10')](function(_0x239b7d){_0x56aa26=_0x239b7d;})['catch'](function(_0x178172){logger[_0x834e('0x20')](_0x178172[_0x834e('0x21')]);})[_0x834e('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x834e('0x23')](),_0x56aa26);},TIME);});}function defaultLicense(){var _0x322e61=hardware['getUuid']();if(_0x322e61){return db[_0x834e('0x24')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x322e61}})['spread'](function(_0xa13d6f,_0x5207df){logger[_0x834e('0x12')](_0x834e('0x25'),_0x322e61);manageLicense(_0x322e61,_0xa13d6f);})[_0x834e('0xe')](function(_0x3076fe){logger[_0x834e('0x20')](_0x3076fe[_0x834e('0x21')]);});}}exports[_0x834e('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index b2ba063..739bb81 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 _0x6d99=['message','User','findAll','role','sequelize','COUNT','col','admin','user','telephone','telephones','forEach','count','countBy','License\x20limit\x20reached\x20for\x20telephones','util','lodash','bluebird','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','find','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','%s:%s:%s','parse','deadline','add','days','machineUuid','changed','disabled'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6d99,0x19b));var _0x96d9=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0x6d99[_0x4709c8];return _0x478cdd;};'use strict';var util=require(_0x96d9('0x0'));var _=require(_0x96d9('0x1'));var moment=require('moment');var BPromise=require(_0x96d9('0x2'));var hardware=require('./hardware');var encryptor=require(_0x96d9('0x3'));var db=require(_0x96d9('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x96d9('0x5'),'machineUuid':hardware[_0x96d9('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x96d9('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x96d9('0x8'),'machineUuid':hardware[_0x96d9('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2d16e7){return new BPromise(function(_0x4dd1fc,_0x1308b2){return db['License'][_0x96d9('0x9')](_['defaults'](_0x2d16e7,{'raw':!![],'where':{'id':0x1}}))[_0x96d9('0xa')](function(_0x78c311){return checkLicense(_0x78c311,null);})[_0x96d9('0xa')](function(_0x229fa5){_0x4dd1fc(_0x229fa5);return;})[_0x96d9('0xb')](function(_0x479952){_0x1308b2(_0x479952);});});}function checkLicense(_0x5c1b51,_0x48ed87){if(!_0x5c1b51){demoLicense[_0x96d9('0xc')]=_0x5c1b51['data1'];return demoLicense;}try{var _0xe9ab33=_0x48ed87||_0x5c1b51[_0x96d9('0xd')];if(_[_0x96d9('0xe')](_0xe9ab33)){throw new Error(_0x96d9('0xf'));}var _0x3994b0=_0x5c1b51[_0x96d9('0x10')];var _0xf7673b=_0x5c1b51[_0x96d9('0x11')];var _0x15555e=_0x3994b0[_0x96d9('0x12')]('-')[0x4];var _0x46a1e1=_0x3994b0[_0x96d9('0x12')]('-')[0x0];var _0x480168=encryptor[_0x96d9('0x13')](_0xe9ab33,util[_0x96d9('0x14')](_0x96d9('0x15'),_0x15555e,_0x3994b0,_0x46a1e1));var _0x52fc7d=JSON[_0x96d9('0x16')](_0x480168);_0x52fc7d['demo']=![];_0x52fc7d[_0x96d9('0xc')]=_0x3994b0;_0x52fc7d['machineUuid']=hardware[_0x96d9('0x6')]();if(_0xf7673b){var _0x5353db=encryptor['decryptString'](_0xf7673b);_0x52fc7d['gray']=_0x5353db;_0x52fc7d[_0x96d9('0x17')]=moment(_0x5353db)[_0x96d9('0x18')](0x7,_0x96d9('0x19'))['format']();_0x52fc7d['grayReason']=_0x52fc7d[_0x96d9('0xc')]!=_0x52fc7d[_0x96d9('0x1a')]?_0x96d9('0x1b'):_0x96d9('0x1c');}return _0x52fc7d;}catch(_0x4abfb3){breakingLicense[_0x96d9('0xc')]=_0x5c1b51[_0x96d9('0x10')];breakingLicense['message']=_0x4abfb3[_0x96d9('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x318c8d,_0x51834f){getLicense()[_0x96d9('0xa')](function(_0x127a0c){return db[_0x96d9('0x1e')][_0x96d9('0x1f')]({'attributes':[_0x96d9('0x20'),[db[_0x96d9('0x21')]['fn'](_0x96d9('0x22'),db[_0x96d9('0x21')][_0x96d9('0x23')](_0x96d9('0x20'))),'count']],'group':_0x96d9('0x20'),'where':{'role':{'$or':[_0x96d9('0x24'),_0x96d9('0x25'),_0x96d9('0x26')]}},'raw':!![]})[_0x96d9('0xa')](function(_0xb8cdb){var _0x1fed0f={'user':_0x127a0c['users']||0x0,'telephone':_0x127a0c[_0x96d9('0x27')]||0x0};_0xb8cdb[_0x96d9('0x28')](function(_0x3d72a1){var _0x24b345=_0x3d72a1[_0x96d9('0x20')]===_0x96d9('0x24')?_0x96d9('0x25'):_0x3d72a1[_0x96d9('0x20')];_0x1fed0f[_0x24b345]-=_0x3d72a1[_0x96d9('0x29')];if(_0x1fed0f[_0x24b345]<0x0)_0x1fed0f[_0x24b345]=0x0;});_0x318c8d(_0x1fed0f);return;});})[_0x96d9('0xb')](function(_0x2fc3f9){_0x51834f(_0x2fc3f9);});});}function checkUserLimits(_0xc7dee1){return new BPromise(function(_0x420c53,_0x294d1b){getLimits()['then'](function(_0x2b7570){var _0x54bbed=_['pick'](_[_0x96d9('0x2a')](_0xc7dee1,'role'),['admin','user','telephone']);var _0x809f70=(_0x54bbed[_0x96d9('0x24')]||0x0)+(_0x54bbed[_0x96d9('0x25')]||0x0);var _0x4fac0b=_0x54bbed[_0x96d9('0x26')]||0x0;if(_0x809f70>_0x2b7570[_0x96d9('0x25')])return _0x294d1b('License\x20limit\x20reached\x20for\x20users');if(_0x4fac0b>_0x2b7570[_0x96d9('0x26')])return _0x294d1b(_0x96d9('0x2b'));return _0x420c53();})['catch'](function(_0x5b316e){_0x294d1b(_0x5b316e);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xf7a9=['role','sequelize','col','count','admin','user','telephone','users','telephones','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','machineUuid','gray','add','days','grayReason','disabled','data1','message','User','findAll'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf7a9,0x148));var _0x9f7a=function(_0x3cd861,_0x27d8c2){_0x3cd861=_0x3cd861-0x0;var _0x1d677c=_0xf7a9[_0x3cd861];return _0x1d677c;};'use strict';var util=require(_0x9f7a('0x0'));var _=require(_0x9f7a('0x1'));var moment=require(_0x9f7a('0x2'));var BPromise=require(_0x9f7a('0x3'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0x9f7a('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9f7a('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9f7a('0x6'),'machineUuid':hardware[_0x9f7a('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9f7a('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x9f7a('0x8'),'machineUuid':hardware[_0x9f7a('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1bef76){return new BPromise(function(_0x1a3cf7,_0x2facd5){return db[_0x9f7a('0x9')][_0x9f7a('0xa')](_['defaults'](_0x1bef76,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x3a42a1){return checkLicense(_0x3a42a1,null);})[_0x9f7a('0xb')](function(_0x233bb0){_0x1a3cf7(_0x233bb0);return;})[_0x9f7a('0xc')](function(_0x6fa37){_0x2facd5(_0x6fa37);});});}function checkLicense(_0x49ea16,_0x5a419d){if(!_0x49ea16){demoLicense[_0x9f7a('0xd')]=_0x49ea16['data1'];return demoLicense;}try{var _0x12d1bc=_0x5a419d||_0x49ea16[_0x9f7a('0xe')];if(_[_0x9f7a('0xf')](_0x12d1bc)){throw new Error(_0x9f7a('0x10'));}var _0x18d54d=_0x49ea16['data1'];var _0x313d0b=_0x49ea16[_0x9f7a('0x11')];var _0xab027d=_0x18d54d[_0x9f7a('0x12')]('-')[0x4];var _0x1a6479=_0x18d54d[_0x9f7a('0x12')]('-')[0x0];var _0x54a958=encryptor[_0x9f7a('0x13')](_0x12d1bc,util[_0x9f7a('0x14')](_0x9f7a('0x15'),_0xab027d,_0x18d54d,_0x1a6479));var _0x472b0a=JSON['parse'](_0x54a958);_0x472b0a['demo']=![];_0x472b0a['uuid']=_0x18d54d;_0x472b0a[_0x9f7a('0x16')]=hardware[_0x9f7a('0x7')]();if(_0x313d0b){var _0x599567=encryptor[_0x9f7a('0x13')](_0x313d0b);_0x472b0a[_0x9f7a('0x17')]=_0x599567;_0x472b0a['deadline']=moment(_0x599567)[_0x9f7a('0x18')](0x7,_0x9f7a('0x19'))[_0x9f7a('0x14')]();_0x472b0a[_0x9f7a('0x1a')]=_0x472b0a[_0x9f7a('0xd')]!=_0x472b0a['machineUuid']?'changed':_0x9f7a('0x1b');}return _0x472b0a;}catch(_0x1bd71d){breakingLicense[_0x9f7a('0xd')]=_0x49ea16[_0x9f7a('0x1c')];breakingLicense[_0x9f7a('0x1d')]=_0x1bd71d['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3ca65a,_0x2d8da7){getLicense()[_0x9f7a('0xb')](function(_0x45d5ae){return db[_0x9f7a('0x1e')][_0x9f7a('0x1f')]({'attributes':[_0x9f7a('0x20'),[db['sequelize']['fn']('COUNT',db[_0x9f7a('0x21')][_0x9f7a('0x22')](_0x9f7a('0x20'))),_0x9f7a('0x23')]],'group':_0x9f7a('0x20'),'where':{'role':{'$or':[_0x9f7a('0x24'),_0x9f7a('0x25'),_0x9f7a('0x26')]}},'raw':!![]})[_0x9f7a('0xb')](function(_0x187914){var _0x97d27e={'user':_0x45d5ae[_0x9f7a('0x27')]||0x0,'telephone':_0x45d5ae[_0x9f7a('0x28')]||0x0};_0x187914['forEach'](function(_0x2d9a93){var _0x4d7c0d=_0x2d9a93[_0x9f7a('0x20')]===_0x9f7a('0x24')?_0x9f7a('0x25'):_0x2d9a93[_0x9f7a('0x20')];_0x97d27e[_0x4d7c0d]-=_0x2d9a93[_0x9f7a('0x23')];if(_0x97d27e[_0x4d7c0d]<0x0)_0x97d27e[_0x4d7c0d]=0x0;});_0x3ca65a(_0x97d27e);return;});})['catch'](function(_0x56f360){_0x2d8da7(_0x56f360);});});}function checkUserLimits(_0x3cdd53){return new BPromise(function(_0x16e8cb,_0x1ab2d3){getLimits()[_0x9f7a('0xb')](function(_0x19775c){var _0x1e7079=_[_0x9f7a('0x29')](_[_0x9f7a('0x2a')](_0x3cdd53,'role'),['admin',_0x9f7a('0x25'),_0x9f7a('0x26')]);var _0x26b687=(_0x1e7079[_0x9f7a('0x24')]||0x0)+(_0x1e7079[_0x9f7a('0x25')]||0x0);var _0x8211fc=_0x1e7079[_0x9f7a('0x26')]||0x0;if(_0x26b687>_0x19775c[_0x9f7a('0x25')])return _0x1ab2d3(_0x9f7a('0x2b'));if(_0x8211fc>_0x19775c[_0x9f7a('0x26')])return _0x1ab2d3('License\x20limit\x20reached\x20for\x20telephones');return _0x16e8cb();})[_0x9f7a('0xc')](function(_0x43946c){_0x1ab2d3(_0x43946c);});});}module[_0x9f7a('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 5283167..09eac76 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 _0x93e9=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x93e9,0xcc));var _0x993e=function(_0x5abbda,_0x21a99a){_0x5abbda=_0x5abbda-0x0;var _0x5e0877=_0x93e9[_0x5abbda];return _0x5e0877;};'use strict';module[_0x993e('0x0')]={'DOMAIN':_0x993e('0x1'),'SESSION_SECRET':_0x993e('0x2'),'GOOGLE_ID':_0x993e('0x3'),'GOOGLE_SECRET':_0x993e('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xb10b=['app-id','secret','exports','myappanuglar-secret'];(function(_0x28bb3c,_0x2d7a57){var _0x348c92=function(_0xd536d6){while(--_0xd536d6){_0x28bb3c['push'](_0x28bb3c['shift']());}};_0x348c92(++_0x2d7a57);}(_0xb10b,0x12a));var _0xbb10=function(_0x48910d,_0xe8d0e1){_0x48910d=_0x48910d-0x0;var _0x1b4c22=_0xb10b[_0x48910d];return _0x1b4c22;};'use strict';module[_0xbb10('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xbb10('0x1'),'GOOGLE_ID':_0xbb10('0x2'),'GOOGLE_SECRET':_0xbb10('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 64d13f6..5cc558f 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd999=['fileLogger','../utils/loggers'];(function(_0x4feee0,_0x357f7d){var _0x314a92=function(_0x3151ec){while(--_0x3151ec){_0x4feee0['push'](_0x4feee0['shift']());}};_0x314a92(++_0x357f7d);}(_0xd999,0x12b));var _0x9d99=function(_0x22dbd1,_0x47e0bb){_0x22dbd1=_0x22dbd1-0x0;var _0x50a4fd=_0xd999[_0x22dbd1];return _0x50a4fd;};'use strict';var fileLogger=require(_0x9d99('0x0'))[_0x9d99('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0xb6e1=['../utils/loggers','exports'];(function(_0x4930ae,_0x30cef6){var _0x741d47=function(_0x2d1f2a){while(--_0x2d1f2a){_0x4930ae['push'](_0x4930ae['shift']());}};_0x741d47(++_0x30cef6);}(_0xb6e1,0xa4));var _0x1b6e=function(_0x4e3932,_0x2f7e21){_0x4e3932=_0x4e3932-0x0;var _0x551655=_0xb6e1[_0x4e3932];return _0x551655;};'use strict';var fileLogger=require(_0x1b6e('0x0'))['fileLogger'];module[_0x1b6e('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 032415e..4dcd599 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 _0xee50=['root','legacy-libs','express','../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','routing','xdr','../../services/xdr/index.js','resolve','join'];(function(_0x3c35df,_0x35958b){var _0x41a4f5=function(_0x375e3b){while(--_0x375e3b){_0x3c35df['push'](_0x3c35df['shift']());}};_0x41a4f5(++_0x35958b);}(_0xee50,0xee));var _0x0ee5=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xee50[_0x50a0c2];return _0x5ebadd;};'use strict';var path=require('path');var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x0ee5('0x0')](path[_0x0ee5('0x1')](cfg[_0x0ee5('0x2')],_0x0ee5('0x3')))};var pm2config={'apps':[{'name':_0x0ee5('0x4'),'script':path['join'](__dirname,_0x0ee5('0x5')),'env':env},{'name':'ami','script':path[_0x0ee5('0x1')](__dirname,_0x0ee5('0x6')),'env':env},{'name':_0x0ee5('0x7'),'script':path['join'](__dirname,_0x0ee5('0x8')),'env':env},{'name':'email','script':path[_0x0ee5('0x1')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x0ee5('0x9'),'script':path['join'](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x0ee5('0xa'),'script':path[_0x0ee5('0x1')](__dirname,_0x0ee5('0xb')),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x66a4=['../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x66a4,0x76));var _0x466a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x66a4[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0x466a('0x0'));var cfg=require(_0x466a('0x1'));var env={'NODE_PATH':path[_0x466a('0x2')](path[_0x466a('0x3')](cfg[_0x466a('0x4')],_0x466a('0x5')))};var pm2config={'apps':[{'name':_0x466a('0x6'),'script':path[_0x466a('0x3')](__dirname,_0x466a('0x7')),'env':env},{'name':_0x466a('0x8'),'script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path['join'](__dirname,_0x466a('0x9')),'env':env},{'name':_0x466a('0xa'),'script':path[_0x466a('0x3')](__dirname,_0x466a('0xb')),'env':env},{'name':_0x466a('0xc'),'script':path[_0x466a('0x3')](__dirname,_0x466a('0xd')),'env':env},{'name':_0x466a('0xe'),'script':path['join'](__dirname,_0x466a('0xf')),'env':env}]};module[_0x466a('0x10')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 52d67d6..1544ab5 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 _0x8e0e=['pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved'];(function(_0x4627a3,_0x50343a){var _0x54a8c9=function(_0x2e5a22){while(--_0x2e5a22){_0x4627a3['push'](_0x4627a3['shift']());}};_0x54a8c9(++_0x50343a);}(_0x8e0e,0x195));var _0xe8e0=function(_0x4b043b,_0x598b17){_0x4b043b=_0x4b043b-0x0;var _0x398f5a=_0x8e0e[_0x4b043b];return _0x398f5a;};'use strict';var pm2=require(_0xe8e0('0x0'));var BPromise=require(_0xe8e0('0x1'));var config=require(_0xe8e0('0x2'));function connect(){return new BPromise(function(_0x499f93,_0x40e1ad){return pm2[_0xe8e0('0x3')](function(_0x250784){if(_0x250784){return _0x40e1ad(_0x250784);}return _0x499f93(_0xe8e0('0x4'));});});};exports[_0xe8e0('0x5')]=function(_0x4f2871){return connect()[_0xe8e0('0x6')](function(){return new BPromise(function(_0x3943e1,_0x4f72e2){return pm2[_0xe8e0('0x5')](_0x4f2871,function(_0x2e385b,_0x27a7c0){if(_0x2e385b){return _0x4f72e2(_0x2e385b);}pm2[_0xe8e0('0x7')]();return _0x3943e1(_0x27a7c0);});});});};exports[_0xe8e0('0x8')]=function(_0x5d2ae9){return connect()[_0xe8e0('0x6')](function(){return new BPromise(function(_0x95e5e5,_0x1a5578){return pm2[_0xe8e0('0x8')](_0x5d2ae9,function(_0x375e74,_0x8d8be5){if(_0x375e74){return _0x1a5578(_0x375e74);}pm2['disconnect']();return _0x95e5e5(_0x8d8be5);});});});};exports[_0xe8e0('0x9')]=function(_0x183d06){return connect()[_0xe8e0('0x6')](function(){return new BPromise(function(_0x8719b5,_0x145928){return pm2['restart'](_0x183d06,function(_0x5dcbce,_0x37adc2){if(_0x5dcbce){return _0x145928(_0x5dcbce);}pm2[_0xe8e0('0x7')]();return _0x8719b5(_0x37adc2);});});});};exports[_0xe8e0('0xa')]=function(){return connect()[_0xe8e0('0x6')](function(){return new BPromise(function(_0x1cb97b,_0x5391a4){return pm2[_0xe8e0('0xa')](function(_0x5318be,_0x10865c){if(_0x5318be){return _0x5391a4(_0x5318be);}pm2[_0xe8e0('0x7')]();return _0x1cb97b(_0x10865c);});});});};exports[_0xe8e0('0xb')]=function(_0x25a07a){return connect()['then'](function(){return new BPromise(function(_0x5afd53,_0x2994d1){return pm2[_0xe8e0('0xb')](_0x25a07a,function(_0x226b20,_0x47ae4e){if(_0x226b20){return _0x2994d1(_0x226b20);}pm2[_0xe8e0('0x7')]();return _0x5afd53(_0x47ae4e);});});});};exports[_0xe8e0('0xc')]=function(_0x4510d9){return connect()[_0xe8e0('0x6')](function(){return new BPromise(function(_0x2a30b2,_0x54efdc){return pm2[_0xe8e0('0xc')](_0x4510d9,function(_0x4c7967,_0x3a0260){if(_0x4c7967){return _0x54efdc(_0x4c7967);}pm2['disconnect']();return _0x2a30b2(_0x3a0260);});});});};exports[_0xe8e0('0xd')]=function(){return connect()[_0xe8e0('0x6')](function(){return new BPromise(function(_0x1fda9e,_0x5da78c){return pm2[_0xe8e0('0xd')](function(_0x1bd0a2){if(_0x1bd0a2){return _0x5da78c(_0x1bd0a2);}return _0x1fda9e(_0xe8e0('0xe'));});});});}; \ No newline at end of file +var _0x4bee=['delete','dump','saved','pm2','bluebird','./config','connect','start','then','disconnect','stop','restart','list','describe'];(function(_0x47b285,_0x8213d0){var _0xd7a83b=function(_0x21a02d){while(--_0x21a02d){_0x47b285['push'](_0x47b285['shift']());}};_0xd7a83b(++_0x8213d0);}(_0x4bee,0xab));var _0xe4be=function(_0x112fe3,_0x16b642){_0x112fe3=_0x112fe3-0x0;var _0x1ec903=_0x4bee[_0x112fe3];return _0x1ec903;};'use strict';var pm2=require(_0xe4be('0x0'));var BPromise=require(_0xe4be('0x1'));var config=require(_0xe4be('0x2'));function connect(){return new BPromise(function(_0x2355a8,_0x23ae83){return pm2[_0xe4be('0x3')](function(_0x5d716e){if(_0x5d716e){return _0x23ae83(_0x5d716e);}return _0x2355a8('connected');});});};exports[_0xe4be('0x4')]=function(_0x40e44c){return connect()[_0xe4be('0x5')](function(){return new BPromise(function(_0x5cde04,_0x1d7d20){return pm2[_0xe4be('0x4')](_0x40e44c,function(_0xb7f647,_0x3c4dbd){if(_0xb7f647){return _0x1d7d20(_0xb7f647);}pm2[_0xe4be('0x6')]();return _0x5cde04(_0x3c4dbd);});});});};exports[_0xe4be('0x7')]=function(_0x5c0be7){return connect()[_0xe4be('0x5')](function(){return new BPromise(function(_0x53d28a,_0x285d03){return pm2[_0xe4be('0x7')](_0x5c0be7,function(_0x2c44a2,_0x564d0d){if(_0x2c44a2){return _0x285d03(_0x2c44a2);}pm2['disconnect']();return _0x53d28a(_0x564d0d);});});});};exports['restart']=function(_0x3dc4c3){return connect()['then'](function(){return new BPromise(function(_0x159116,_0x1e9ac2){return pm2[_0xe4be('0x8')](_0x3dc4c3,function(_0x548853,_0x2a24c7){if(_0x548853){return _0x1e9ac2(_0x548853);}pm2[_0xe4be('0x6')]();return _0x159116(_0x2a24c7);});});});};exports[_0xe4be('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x55244b,_0x58d04c){return pm2[_0xe4be('0x9')](function(_0x548881,_0x3f1258){if(_0x548881){return _0x58d04c(_0x548881);}pm2[_0xe4be('0x6')]();return _0x55244b(_0x3f1258);});});});};exports[_0xe4be('0xa')]=function(_0x18ef87){return connect()[_0xe4be('0x5')](function(){return new BPromise(function(_0x2ef0a0,_0x30d0e4){return pm2['describe'](_0x18ef87,function(_0x544869,_0x1d6bf5){if(_0x544869){return _0x30d0e4(_0x544869);}pm2[_0xe4be('0x6')]();return _0x2ef0a0(_0x1d6bf5);});});});};exports[_0xe4be('0xb')]=function(_0x2c1bc1){return connect()[_0xe4be('0x5')](function(){return new BPromise(function(_0x4f7abc,_0x27253c){return pm2[_0xe4be('0xb')](_0x2c1bc1,function(_0x54d1ab,_0x110966){if(_0x54d1ab){return _0x27253c(_0x54d1ab);}pm2[_0xe4be('0x6')]();return _0x4f7abc(_0x110966);});});});};exports[_0xe4be('0xc')]=function(){return connect()[_0xe4be('0x5')](function(){return new BPromise(function(_0x137f37,_0x522562){return pm2[_0xe4be('0xc')](function(_0x4cf830){if(_0x4cf830){return _0x522562(_0x4cf830);}return _0x137f37(_0xe4be('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 47971ba..0408d5a 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 _0xc392=['defaults','Setting','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis'];(function(_0x5b92f1,_0x51e35e){var _0x4e60c2=function(_0x44305a){while(--_0x44305a){_0x5b92f1['push'](_0x5b92f1['shift']());}};_0x4e60c2(++_0x51e35e);}(_0xc392,0x121));var _0x2c39=function(_0x2aade3,_0x35112e){_0x2aade3=_0x2aade3-0x0;var _0x3ca467=_0xc392[_0x2aade3];return _0x3ca467;};'use strict';var _=require(_0x2c39('0x0'));var moment=require('moment');var Redis=require(_0x2c39('0x1'));var util=require(_0x2c39('0x2'));var config=require(_0x2c39('0x3'));var db=require(_0x2c39('0x4'))['db'];var logger=require(_0x2c39('0x5'))(_0x2c39('0x6'));config[_0x2c39('0x7')]=_[_0x2c39('0x8')](config[_0x2c39('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2c39('0x7')]));function closeInteractions(){var _0x209600=0x0;var _0x235885=[];return db[_0x2c39('0x9')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x2c39('0xa')](function(_0x57e32f){_0x209600=_0x57e32f[_0x2c39('0xb')];if(_0x209600){return db[_0x2c39('0xc')][_0x2c39('0xd')]({'raw':!![],'attributes':['id',_0x2c39('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2c39('0xf')](_0x57e32f['chatTimeout'],_0x2c39('0x10'))}}});}else{return[];}})['then'](function(_0x1110c0){if(_0x1110c0&&_0x1110c0['length']){_0x235885=_[_0x2c39('0x11')](_0x1110c0||[],'id');logger[_0x2c39('0x12')](_0x2c39('0x13'),_0x235885['join']());return db['ChatInteraction'][_0x2c39('0x14')]({'closeReason':_0x2c39('0x15'),'disposition':_0x2c39('0x16'),'closed':!![],'closedAt':moment()[_0x2c39('0x17')](_0x2c39('0x18'))},{'where':{'id':_0x235885}});}})[_0x2c39('0xa')](function(){if(_0x235885&&_0x235885['length']){logger[_0x2c39('0x12')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x235885['join']());for(var _0x3bdfbd=0x0;_0x3bdfbd<_0x235885['length'];_0x3bdfbd++){io['emit']('chatInteraction:update',{'id':_0x235885[_0x3bdfbd],'closed':!![]});}}})['catch'](function(_0x1709c1){logger['error'](_0x2c39('0x19'),_0x1709c1?util['inspect'](_0x1709c1,{'showHidden':![],'depth':null}):'');});}exports[_0x2c39('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2c58=['localhost','Setting','find','chatTimeout','ChatInteraction','subtract','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','then','emit','chatInteraction:update','catch','error','inspect','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults'];(function(_0x3a8114,_0x549ce8){var _0x4ebb2f=function(_0x1e9106){while(--_0x1e9106){_0x3a8114['push'](_0x3a8114['shift']());}};_0x4ebb2f(++_0x549ce8);}(_0x2c58,0x18e));var _0x82c5=function(_0x5e3240,_0x1df9d2){_0x5e3240=_0x5e3240-0x0;var _0x3bf6c3=_0x2c58[_0x5e3240];return _0x3bf6c3;};'use strict';var _=require('lodash');var moment=require(_0x82c5('0x0'));var Redis=require(_0x82c5('0x1'));var util=require(_0x82c5('0x2'));var config=require(_0x82c5('0x3'));var db=require(_0x82c5('0x4'))['db'];var logger=require(_0x82c5('0x5'))(_0x82c5('0x6'));config['redis']=_[_0x82c5('0x7')](config['redis'],{'host':_0x82c5('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x219880=0x0;var _0x8fc808=[];return db[_0x82c5('0x9')][_0x82c5('0xa')]({'raw':!![],'attributes':['id',_0x82c5('0xb')],'where':{'id':0x1}})['then'](function(_0x43054e){_0x219880=_0x43054e[_0x82c5('0xb')];if(_0x219880){return db[_0x82c5('0xc')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x82c5('0xd')](_0x43054e['chatTimeout'],_0x82c5('0xe'))}}});}else{return[];}})['then'](function(_0xbc477){if(_0xbc477&&_0xbc477[_0x82c5('0xf')]){_0x8fc808=_[_0x82c5('0x10')](_0xbc477||[],'id');logger['info'](_0x82c5('0x11'),_0x8fc808[_0x82c5('0x12')]());return db[_0x82c5('0xc')][_0x82c5('0x13')]({'closeReason':_0x82c5('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x82c5('0x15')](_0x82c5('0x16'))},{'where':{'id':_0x8fc808}});}})[_0x82c5('0x17')](function(){if(_0x8fc808&&_0x8fc808[_0x82c5('0xf')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x8fc808[_0x82c5('0x12')]());for(var _0x96565f=0x0;_0x96565f<_0x8fc808[_0x82c5('0xf')];_0x96565f++){io[_0x82c5('0x18')](_0x82c5('0x19'),{'id':_0x8fc808[_0x96565f],'closed':!![]});}}})[_0x82c5('0x1a')](function(_0x20e218){logger[_0x82c5('0x1b')]('[CHAT]\x20Error\x20closing\x20interactions',_0x20e218?util[_0x82c5('0x1c')](_0x20e218,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index adcbf4c..46bcb9d 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 _0xab6c=['startAllRefreshIntervals'];(function(_0x115cdc,_0x2533b9){var _0x43259f=function(_0x3a621b){while(--_0x3a621b){_0x115cdc['push'](_0x115cdc['shift']());}};_0x43259f(++_0x2533b9);}(_0xab6c,0x1b7));var _0xcab6=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xab6c[_0x1facfa];return _0x9ec701;};'use strict';function start(){var _0x57f3d9=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x57f3d9[_0xcab6('0x0')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x9a2b=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0xea21bb,_0x14899b){var _0x58ed97=function(_0x2edc04){while(--_0x2edc04){_0xea21bb['push'](_0xea21bb['shift']());}};_0x58ed97(++_0x14899b);}(_0x9a2b,0x10f));var _0xb9a2=function(_0x3015f9,_0x6eeb0d){_0x3015f9=_0x3015f9-0x0;var _0x3390b6=_0x9a2b[_0x3015f9];return _0x3390b6;};'use strict';function start(){var _0x53279c=require(_0xb9a2('0x0'));return _0x53279c['startAllRefreshIntervals']();}module[_0xb9a2('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index c5daf79..47a5480 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 _0x6041=['jobs','map','keyBy','toString','difference','intersection','length','stop','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','endAt','add','start','add\x20cron','exists','update','update\x20cron','stop\x20cron','util','path','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','email','bcc','subtractNumber','subtractUnit','join','../../files/reports','basename','extname','savename','zip','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','isNil','DefaultReportId','exec\x20defaul\x20report\x20id:%s','catch','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','then','no\x20report\x20id','Schedule','findAll','CloudProvider','keys'];(function(_0x2fcadf,_0x401da6){var _0x2a2c05=function(_0x54d612){while(--_0x54d612){_0x2fcadf['push'](_0x2fcadf['shift']());}};_0x2a2c05(++_0x401da6);}(_0x6041,0x1c7));var _0x1604=function(_0x59cc2f,_0x40ad99){_0x59cc2f=_0x59cc2f-0x0;var _0x136c14=_0x6041[_0x59cc2f];return _0x136c14;};'use strict';var fs=require('fs');var util=require(_0x1604('0x0'));var path=require(_0x1604('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0x1604('0x2'));var jayson=require(_0x1604('0x3'));var BPromise=require(_0x1604('0x4'));var logger=require(_0x1604('0x5'))('schedule');var db=require(_0x1604('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x1604('0x7'));var client=jayson[_0x1604('0x8')][_0x1604('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1e5b04,_0x2246fc){return function(){logger[_0x1604('0xa')](_0x1604('0xb'),_0x1e5b04['email']);var _0x15f0c6=!![];var _0x22af3b=_0x1e5b04[_0x1604('0xc')][_0x1604('0xd')]();var _0x227174={'account':_0x22af3b,'message':{'from':util[_0x1604('0xe')](_0x1604('0xf'),_0x1e5b04['MailAccount'][_0x1604('0x10')],_0x1e5b04['MailAccount']['email']||_0x1e5b04[_0x1604('0xc')][_0x1604('0x11')][_0x1604('0x12')]),'to':_0x1e5b04[_0x1604('0x13')],'cc':_0x1e5b04['cc'],'bcc':_0x1e5b04[_0x1604('0x14')],'subject':util[_0x1604('0xe')]('Report\x20%s\x20last\x20%s\x20%s',_0x2246fc[_0x1604('0x10')],_0x1e5b04[_0x1604('0x15')],_0x1e5b04[_0x1604('0x16')])}};var _0x1d25a4=path[_0x1604('0x17')](__dirname,_0x1604('0x18'));var _0x3dc6cb=_0x2246fc['savename'];var _0x4e4485=util[_0x1604('0xe')]('%s.%s',path[_0x1604('0x19')](_0x2246fc['savename'],path[_0x1604('0x1a')](_0x2246fc[_0x1604('0x1b')])),_0x1604('0x1c'));var _0x4c132a=path[_0x1604('0x17')](_0x1d25a4,_0x3dc6cb);var _0x3469c5=path['join'](_0x1d25a4,_0x4e4485);if(fs[_0x1604('0x1d')](_0x4c132a)){_0x2246fc[_0x1604('0x1e')]=_0x1604('0x1f');_0x227174[_0x1604('0x20')][_0x1604('0x21')]=[{'filename':_0x3dc6cb,'path':_0x4c132a}];_0x227174['message']['text']=util[_0x1604('0xe')](_0x1604('0x22'),JSON[_0x1604('0x23')](_0x2246fc,null,0x2));}else if(fs['existsSync'](_0x3469c5)){_0x2246fc[_0x1604('0x1e')]=_0x1604('0x1f');_0x227174[_0x1604('0x20')][_0x1604('0x21')]=[{'filename':_0x4e4485,'path':_0x3469c5}];}else{_0x227174[_0x1604('0x20')][_0x1604('0x24')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x1e5b04[_0x1604('0x25')]){_0x15f0c6=![];logger[_0x1604('0xa')](_0x1604('0x26'));}}if(_0x15f0c6){return client[_0x1604('0x27')](_0x1604('0x28'),_0x227174)['then'](function(_0x2c3f27){if(_0x2c3f27[_0x1604('0x29')]){return logger[_0x1604('0x29')](_0x1604('0x2a'),JSON[_0x1604('0x23')](_0x2c3f27));}return logger[_0x1604('0xa')](_0x1604('0x2b'));})['catch'](function(_0x532cfd){return logger['error'](_0x1604('0x2a'),JSON['stringify'](_0x532cfd));});}};}function handleError(){return function(_0x301e26){return logger['error'](JSON[_0x1604('0x23')](_0x301e26));};}function handleResult(_0x439a43){return function(_0x485ec5){logger[_0x1604('0xa')]('data',JSON['stringify'](_0x485ec5));if(_0x439a43[_0x1604('0xc')]&&_0x439a43[_0x1604('0xc')][_0x1604('0x11')]&&!_['isNil'](_0x439a43[_0x1604('0x13')])){setTimeout(handleSendEmail(_0x439a43,_0x485ec5),0x3c*0x3e8);}};}function handleJob(_0x453816){return function(){try{if(_['isNil'](_0x453816[_0x1604('0x15')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x453816[_0x1604('0x16')])){return logger[_0x1604('0xa')](_0x1604('0x2c'));}var _0x1f17de={'startDate':moment()['subtract'](_0x453816[_0x1604('0x15')],_0x453816[_0x1604('0x16')])[_0x1604('0xe')](_0x1604('0x2d')),'endDate':moment()[_0x1604('0xe')](_0x1604('0x2d')),'type':_0x1604('0x2e'),'output':_0x453816[_0x1604('0x2f')],'name':_0x453816[_0x1604('0x10')]};if(!_[_0x1604('0x30')](_0x453816[_0x1604('0x31')])){logger[_0x1604('0xa')](_0x1604('0x32'),_0x453816[_0x1604('0x31')]);return analyticDefaultReportController['runReport']({'id':_0x453816[_0x1604('0x31')]},_0x1f17de)['then'](handleResult(_0x453816))[_0x1604('0x33')](handleError());}if(!_[_0x1604('0x30')](_0x453816['CustomReportId'])){logger['info'](_0x1604('0x34'),_0x453816[_0x1604('0x35')]);return analyticCustomReportController[_0x1604('0x36')]({'id':_0x453816['CustomReportId']},_0x1f17de)[_0x1604('0x37')](handleResult(_0x453816))['catch'](handleError());}}catch(_0x5556db){logger[_0x1604('0x29')](JSON[_0x1604('0x23')](_0x5556db));}return logger['info'](_0x1604('0x38'));};}function getJobs(_0x443c2e){var _0x241c94={};if(_0x443c2e){_0x241c94['id']=_0x443c2e;}return db[_0x1604('0x39')][_0x1604('0x3a')]({'where':_0x241c94,'include':[{'model':db[_0x1604('0xc')],'attributes':['id',_0x1604('0x10'),'email'],'include':[{'model':db['MailServerOut'],'as':_0x1604('0x11'),'include':[{'model':db['CloudProvider'],'as':_0x1604('0x3b')}]}]}]})[_0x1604('0x37')](function(_0x2a46a0){var _0x4662f5=_[_0x1604('0x3c')](manager[_0x1604('0x3d')]);var _0x52becd=_[_0x1604('0x3e')](_0x2a46a0,function(_0x39aada){return _0x39aada['id']['toString']();});var _0x14caca=_[_0x1604('0x3f')](_0x2a46a0,function(_0x5132fa){return _0x5132fa['id'][_0x1604('0x40')]();});var _0x32b86c=_0x443c2e?_0x52becd:_[_0x1604('0x41')](_0x52becd,_0x4662f5);var _0x22beeb=_[_0x1604('0x42')](_0x52becd,_0x4662f5);var _0x4f3ed8=_[_0x1604('0x41')](_0x4662f5,_0x52becd);var _0x436ad4;var _0x2dbf06;for(_0x436ad4=0x0;_0x436ad4<_0x4f3ed8[_0x1604('0x43')]&&!_0x443c2e;_0x436ad4+=0x1){_0x2dbf06=_0x4f3ed8[_0x436ad4][_0x1604('0x40')]();if(manager['exists'](_0x2dbf06)){manager[_0x1604('0x44')](_0x2dbf06);manager[_0x1604('0x45')](_0x2dbf06);logger[_0x1604('0xa')]('delete\x20cron',_0x2dbf06);}}logger[_0x1604('0xa')](_0x1604('0x46'),JSON[_0x1604('0x23')](_0x32b86c));for(_0x436ad4=0x0;_0x436ad4<_0x32b86c[_0x1604('0x43')];_0x436ad4+=0x1){_0x2dbf06=_0x32b86c[_0x436ad4][_0x1604('0x40')]();logger['info'](_0x1604('0x47'),_0x2dbf06);if(_0x443c2e){logger[_0x1604('0xa')](_0x1604('0x48'),_0x443c2e);logger[_0x1604('0xa')](JSON['stringify'](_0x14caca[_0x2dbf06]));BPromise[_0x1604('0x49')]()[_0x1604('0x37')](handleJob(_0x14caca[_0x2dbf06]));logger[_0x1604('0xa')](_0x1604('0x4a'),_0x14caca[_0x2dbf06]['name'],_0x14caca[_0x2dbf06][_0x1604('0x4b')]);}else if(_0x14caca[_0x2dbf06][_0x1604('0x4b')]&&_0x14caca[_0x2dbf06][_0x1604('0x4c')]&&moment()[_0x1604('0x4d')](_0x14caca[_0x2dbf06]['startAt'],_0x14caca[_0x2dbf06][_0x1604('0x4e')])){manager[_0x1604('0x4f')](_0x2dbf06,_0x14caca[_0x2dbf06]['cron'],handleJob(_0x14caca[_0x2dbf06]));manager[_0x1604('0x50')](_0x2dbf06);logger[_0x1604('0xa')](_0x1604('0x51'),_0x14caca[_0x2dbf06][_0x1604('0x10')],_0x14caca[_0x2dbf06][_0x1604('0x4b')]);}else if(manager[_0x1604('0x52')](_0x2dbf06)){manager[_0x1604('0x44')](_0x2dbf06);manager[_0x1604('0x45')](_0x2dbf06);logger[_0x1604('0xa')]('stop\x20cron',_0x14caca[_0x2dbf06][_0x1604('0x10')],_0x14caca[_0x2dbf06][_0x1604('0x4b')]);}}for(_0x436ad4=0x0,_0x2dbf06;_0x436ad4<_0x22beeb[_0x1604('0x43')]&&!_0x443c2e;_0x436ad4+=0x1){_0x2dbf06=_0x22beeb[_0x436ad4][_0x1604('0x40')]();if(manager[_0x1604('0x52')](_0x2dbf06)){if(_0x14caca[_0x2dbf06][_0x1604('0x4b')]&&_0x14caca[_0x2dbf06]['active']&&moment()[_0x1604('0x4d')](_0x14caca[_0x2dbf06]['startAt'],_0x14caca[_0x2dbf06][_0x1604('0x4e')])){manager[_0x1604('0x53')](_0x2dbf06,_0x14caca[_0x2dbf06][_0x1604('0x4b')],handleJob(_0x14caca[_0x2dbf06]));logger[_0x1604('0xa')](_0x1604('0x54'),_0x14caca[_0x2dbf06][_0x1604('0x10')],_0x14caca[_0x2dbf06]['cron']);}else{manager[_0x1604('0x44')](_0x2dbf06);manager[_0x1604('0x45')](_0x2dbf06);logger['info'](_0x1604('0x55'),_0x14caca[_0x2dbf06][_0x1604('0x10')],_0x14caca[_0x2dbf06][_0x1604('0x4b')]);}}}})[_0x1604('0x33')](function(_0x5dc879){logger['error'](JSON[_0x1604('0x23')](_0x5dc879));});}exports['run']=function(_0x4bc8ce){return getJobs(_0x4bc8ce);};exports[_0x1604('0x50')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x2a9f=['active','startAt','update','update\x20cron','stop\x20cron','run','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','bcc','format','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','message','attachments','Sent','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','stringify','email\x20sent','catch','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','isBetween','endAt','start','add\x20cron'];(function(_0x529928,_0x427efd){var _0x2ff8fe=function(_0x2f1b66){while(--_0x2f1b66){_0x529928['push'](_0x529928['shift']());}};_0x2ff8fe(++_0x427efd);}(_0x2a9f,0x15e));var _0xf2a9=function(_0x5afd2f,_0x23bcf6){_0x5afd2f=_0x5afd2f-0x0;var _0xd4b7e=_0x2a9f[_0x5afd2f];return _0xd4b7e;};'use strict';var fs=require('fs');var util=require(_0xf2a9('0x0'));var path=require('path');var _=require(_0xf2a9('0x1'));var moment=require(_0xf2a9('0x2'));var CronJobManager=require(_0xf2a9('0x3'));var jayson=require(_0xf2a9('0x4'));var BPromise=require(_0xf2a9('0x5'));var logger=require('../logger')(_0xf2a9('0x6'));var db=require(_0xf2a9('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xf2a9('0x8'));var client=jayson[_0xf2a9('0x9')][_0xf2a9('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1c0706,_0x5a838b){return function(){logger[_0xf2a9('0xb')](_0xf2a9('0xc'),_0x1c0706[_0xf2a9('0xd')]);var _0x1211c3=!![];var _0x4d136e=_0x1c0706[_0xf2a9('0xe')][_0xf2a9('0xf')]();var _0x1f2de4={'account':_0x4d136e,'message':{'from':util['format'](_0xf2a9('0x10'),_0x1c0706[_0xf2a9('0xe')]['name'],_0x1c0706[_0xf2a9('0xe')]['email']||_0x1c0706[_0xf2a9('0xe')]['Smtp']['user']),'to':_0x1c0706[_0xf2a9('0xd')],'cc':_0x1c0706['cc'],'bcc':_0x1c0706[_0xf2a9('0x11')],'subject':util[_0xf2a9('0x12')](_0xf2a9('0x13'),_0x5a838b[_0xf2a9('0x14')],_0x1c0706[_0xf2a9('0x15')],_0x1c0706['subtractUnit'])}};var _0x29c24f=path[_0xf2a9('0x16')](__dirname,_0xf2a9('0x17'));var _0x674528=_0x5a838b[_0xf2a9('0x18')];var _0x5ecad1=util[_0xf2a9('0x12')](_0xf2a9('0x19'),path[_0xf2a9('0x1a')](_0x5a838b[_0xf2a9('0x18')],path[_0xf2a9('0x1b')](_0x5a838b[_0xf2a9('0x18')])),_0xf2a9('0x1c'));var _0x104862=path[_0xf2a9('0x16')](_0x29c24f,_0x674528);var _0x2c1e70=path[_0xf2a9('0x16')](_0x29c24f,_0x5ecad1);if(fs[_0xf2a9('0x1d')](_0x104862)){_0x5a838b[_0xf2a9('0x1e')]='Sent';_0x1f2de4[_0xf2a9('0x1f')][_0xf2a9('0x20')]=[{'filename':_0x674528,'path':_0x104862}];_0x1f2de4['message']['text']=util[_0xf2a9('0x12')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x5a838b,null,0x2));}else if(fs[_0xf2a9('0x1d')](_0x2c1e70)){_0x5a838b[_0xf2a9('0x1e')]=_0xf2a9('0x21');_0x1f2de4[_0xf2a9('0x1f')][_0xf2a9('0x20')]=[{'filename':_0x5ecad1,'path':_0x2c1e70}];}else{_0x1f2de4[_0xf2a9('0x1f')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x1c0706[_0xf2a9('0x22')]){_0x1211c3=![];logger['info'](_0xf2a9('0x23'));}}if(_0x1211c3){return client[_0xf2a9('0x24')](_0xf2a9('0x25'),_0x1f2de4)[_0xf2a9('0x26')](function(_0x3cf811){if(_0x3cf811[_0xf2a9('0x27')]){return logger[_0xf2a9('0x27')](_0xf2a9('0x28'),JSON[_0xf2a9('0x29')](_0x3cf811));}return logger[_0xf2a9('0xb')](_0xf2a9('0x2a'));})[_0xf2a9('0x2b')](function(_0xdfee5){return logger['error'](_0xf2a9('0x28'),JSON[_0xf2a9('0x29')](_0xdfee5));});}};}function handleError(){return function(_0x5a8d20){return logger[_0xf2a9('0x27')](JSON[_0xf2a9('0x29')](_0x5a8d20));};}function handleResult(_0x3add55){return function(_0x45a62b){logger[_0xf2a9('0xb')]('data',JSON[_0xf2a9('0x29')](_0x45a62b));if(_0x3add55[_0xf2a9('0xe')]&&_0x3add55[_0xf2a9('0xe')][_0xf2a9('0x2c')]&&!_[_0xf2a9('0x2d')](_0x3add55[_0xf2a9('0xd')])){setTimeout(handleSendEmail(_0x3add55,_0x45a62b),0x3c*0x3e8);}};}function handleJob(_0x10b24c){return function(){try{if(_[_0xf2a9('0x2d')](_0x10b24c[_0xf2a9('0x15')])){return logger[_0xf2a9('0xb')](_0xf2a9('0x2e'));}if(_[_0xf2a9('0x2d')](_0x10b24c[_0xf2a9('0x2f')])){return logger['info'](_0xf2a9('0x30'));}var _0x393539={'startDate':moment()['subtract'](_0x10b24c[_0xf2a9('0x15')],_0x10b24c[_0xf2a9('0x2f')])[_0xf2a9('0x12')](_0xf2a9('0x31')),'endDate':moment()[_0xf2a9('0x12')](_0xf2a9('0x31')),'type':_0xf2a9('0x32'),'output':_0x10b24c['output'],'name':_0x10b24c[_0xf2a9('0x14')]};if(!_[_0xf2a9('0x2d')](_0x10b24c[_0xf2a9('0x33')])){logger[_0xf2a9('0xb')](_0xf2a9('0x34'),_0x10b24c[_0xf2a9('0x33')]);return analyticDefaultReportController['runReport']({'id':_0x10b24c[_0xf2a9('0x33')]},_0x393539)[_0xf2a9('0x26')](handleResult(_0x10b24c))[_0xf2a9('0x2b')](handleError());}if(!_[_0xf2a9('0x2d')](_0x10b24c[_0xf2a9('0x35')])){logger['info'](_0xf2a9('0x36'),_0x10b24c[_0xf2a9('0x35')]);return analyticCustomReportController[_0xf2a9('0x37')]({'id':_0x10b24c[_0xf2a9('0x35')]},_0x393539)[_0xf2a9('0x26')](handleResult(_0x10b24c))[_0xf2a9('0x2b')](handleError());}}catch(_0x48456f){logger[_0xf2a9('0x27')](JSON[_0xf2a9('0x29')](_0x48456f));}return logger[_0xf2a9('0xb')](_0xf2a9('0x38'));};}function getJobs(_0x4de549){var _0x3c2fe4={};if(_0x4de549){_0x3c2fe4['id']=_0x4de549;}return db[_0xf2a9('0x39')]['findAll']({'where':_0x3c2fe4,'include':[{'model':db[_0xf2a9('0xe')],'attributes':['id','name','email'],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0xf2a9('0x3a')],'as':_0xf2a9('0x3a')}]}]}]})[_0xf2a9('0x26')](function(_0x51db7f){var _0x2e9ccf=_[_0xf2a9('0x3b')](manager[_0xf2a9('0x3c')]);var _0x5f2dfd=_[_0xf2a9('0x3d')](_0x51db7f,function(_0x400100){return _0x400100['id'][_0xf2a9('0x3e')]();});var _0x4cfd30=_[_0xf2a9('0x3f')](_0x51db7f,function(_0x346d65){return _0x346d65['id']['toString']();});var _0x373102=_0x4de549?_0x5f2dfd:_[_0xf2a9('0x40')](_0x5f2dfd,_0x2e9ccf);var _0x414469=_[_0xf2a9('0x41')](_0x5f2dfd,_0x2e9ccf);var _0x597720=_[_0xf2a9('0x40')](_0x2e9ccf,_0x5f2dfd);var _0x3abf8e;var _0x4b1d24;for(_0x3abf8e=0x0;_0x3abf8e<_0x597720[_0xf2a9('0x42')]&&!_0x4de549;_0x3abf8e+=0x1){_0x4b1d24=_0x597720[_0x3abf8e][_0xf2a9('0x3e')]();if(manager[_0xf2a9('0x43')](_0x4b1d24)){manager[_0xf2a9('0x44')](_0x4b1d24);manager[_0xf2a9('0x45')](_0x4b1d24);logger[_0xf2a9('0xb')](_0xf2a9('0x46'),_0x4b1d24);}}logger[_0xf2a9('0xb')](_0xf2a9('0x47'),JSON[_0xf2a9('0x29')](_0x373102));for(_0x3abf8e=0x0;_0x3abf8e<_0x373102[_0xf2a9('0x42')];_0x3abf8e+=0x1){_0x4b1d24=_0x373102[_0x3abf8e]['toString']();logger[_0xf2a9('0xb')](_0xf2a9('0x48'),_0x4b1d24);if(_0x4de549){logger['info'](_0xf2a9('0x49'),_0x4de549);logger[_0xf2a9('0xb')](JSON['stringify'](_0x4cfd30[_0x4b1d24]));BPromise['resolve']()[_0xf2a9('0x26')](handleJob(_0x4cfd30[_0x4b1d24]));logger[_0xf2a9('0xb')](_0xf2a9('0x4a'),_0x4cfd30[_0x4b1d24][_0xf2a9('0x14')],_0x4cfd30[_0x4b1d24][_0xf2a9('0x4b')]);}else if(_0x4cfd30[_0x4b1d24][_0xf2a9('0x4b')]&&_0x4cfd30[_0x4b1d24]['active']&&moment()[_0xf2a9('0x4c')](_0x4cfd30[_0x4b1d24]['startAt'],_0x4cfd30[_0x4b1d24][_0xf2a9('0x4d')])){manager['add'](_0x4b1d24,_0x4cfd30[_0x4b1d24][_0xf2a9('0x4b')],handleJob(_0x4cfd30[_0x4b1d24]));manager[_0xf2a9('0x4e')](_0x4b1d24);logger[_0xf2a9('0xb')](_0xf2a9('0x4f'),_0x4cfd30[_0x4b1d24]['name'],_0x4cfd30[_0x4b1d24][_0xf2a9('0x4b')]);}else if(manager[_0xf2a9('0x43')](_0x4b1d24)){manager[_0xf2a9('0x44')](_0x4b1d24);manager['deleteJob'](_0x4b1d24);logger[_0xf2a9('0xb')]('stop\x20cron',_0x4cfd30[_0x4b1d24][_0xf2a9('0x14')],_0x4cfd30[_0x4b1d24][_0xf2a9('0x4b')]);}}for(_0x3abf8e=0x0,_0x4b1d24;_0x3abf8e<_0x414469[_0xf2a9('0x42')]&&!_0x4de549;_0x3abf8e+=0x1){_0x4b1d24=_0x414469[_0x3abf8e][_0xf2a9('0x3e')]();if(manager[_0xf2a9('0x43')](_0x4b1d24)){if(_0x4cfd30[_0x4b1d24][_0xf2a9('0x4b')]&&_0x4cfd30[_0x4b1d24][_0xf2a9('0x50')]&&moment()[_0xf2a9('0x4c')](_0x4cfd30[_0x4b1d24][_0xf2a9('0x51')],_0x4cfd30[_0x4b1d24][_0xf2a9('0x4d')])){manager[_0xf2a9('0x52')](_0x4b1d24,_0x4cfd30[_0x4b1d24][_0xf2a9('0x4b')],handleJob(_0x4cfd30[_0x4b1d24]));logger[_0xf2a9('0xb')](_0xf2a9('0x53'),_0x4cfd30[_0x4b1d24][_0xf2a9('0x14')],_0x4cfd30[_0x4b1d24][_0xf2a9('0x4b')]);}else{manager[_0xf2a9('0x44')](_0x4b1d24);manager['deleteJob'](_0x4b1d24);logger[_0xf2a9('0xb')](_0xf2a9('0x54'),_0x4cfd30[_0x4b1d24][_0xf2a9('0x14')],_0x4cfd30[_0x4b1d24][_0xf2a9('0x4b')]);}}}})[_0xf2a9('0x2b')](function(_0x5ae5d7){logger['error'](JSON[_0xf2a9('0x29')](_0x5ae5d7));});}exports[_0xf2a9('0x55')]=function(_0x43582d){return getJobs(_0x43582d);};exports[_0xf2a9('0x4e')]=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 d9df167..8c4d439 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 _0x2cae=['Setting','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','inspect','start','lodash','aws-sdk','bluebird','../../mysqldb','transcribe','TranscribeService','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','COMPLETED','TranscriptionJob','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','Cloud\x20Provider\x20not\x20configured','Sentiment','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check'];(function(_0x469e00,_0x14202a){var _0x23da30=function(_0x4caa87){while(--_0x4caa87){_0x469e00['push'](_0x469e00['shift']());}};_0x23da30(++_0x14202a);}(_0x2cae,0x16b));var _0xe2ca=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0x2cae[_0x175a55];return _0x167adf;};var _=require(_0xe2ca('0x0'));var AWS=require(_0xe2ca('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require(_0xe2ca('0x2'));var db=require(_0xe2ca('0x3'))['db'];var logger=require('../../config/logger')(_0xe2ca('0x4'));function getTranscriptionJob(_0x10da6c,_0x2e883c,_0x1d3499,_0x4dc701){return new Promise(function(_0x2b4c70,_0x3cabde){var _0x4fbb20=new AWS[(_0xe2ca('0x5'))]({'accessKeyId':_0x2e883c,'secretAccessKey':_0x10da6c,'region':_0x1d3499});_0x4fbb20['getTranscriptionJob']({'TranscriptionJobName':_0x4dc701},function(_0x241511,_0x2036a2){if(_0x241511){return _0x3cabde(_0x241511);}else{return _0x2b4c70(_0x2036a2);}});});}function sentiment(_0x305db7,_0x1b7d25,_0x5e58bd,_0x50b617,_0x49d5bf){return new Promise(function(_0x4ebd58,_0x35a37f){var _0x2c029f=new AWS[(_0xe2ca('0x6'))]({'accessKeyId':_0x1b7d25,'secretAccessKey':_0x305db7,'region':_0x5e58bd});_0x2c029f[_0xe2ca('0x7')]({'Text':_0x50b617,'LanguageCode':_0x49d5bf[_0xe2ca('0x8')](0x0,0x2)},function(_0x474dd1,_0x3c42dc){if(_0x474dd1){return _0x35a37f(_0x474dd1);}else{return _0x4ebd58(_0x3c42dc);}});});}function checkTranscribeJob(_0x5869d9,_0x1138ee,_0x2773cc){var _0x199237;return new BPromise(function(_0x888224,_0x45f3d2){logger['info'](util[_0xe2ca('0x9')](_0xe2ca('0xa'),_0x5869d9['id'],_0x5869d9[_0xe2ca('0xb')]));return getTranscriptionJob(_0x2773cc[_0xe2ca('0xc')],_0x2773cc[_0xe2ca('0xd')],_0x1138ee[_0xe2ca('0xe')],_0x5869d9[_0xe2ca('0xb')])[_0xe2ca('0xf')](function(_0x326340){logger[_0xe2ca('0x10')](util['format'](_0xe2ca('0x11'),_0x5869d9['id'],_0x5869d9['transcribeName'],_0x326340['TranscriptionJob'][_0xe2ca('0x12')]));if(!_0x5869d9[_0xe2ca('0x13')]){switch(_0x326340['TranscriptionJob'][_0xe2ca('0x12')]){case _0xe2ca('0x14'):var _0xa22adb={'transcribeStatus':_0x326340['TranscriptionJob'][_0xe2ca('0x12')],'fileUri':_0x326340[_0xe2ca('0x15')][_0xe2ca('0x16')]['TranscriptFileUri']};logger[_0xe2ca('0x10')](util['format'](_0xe2ca('0x17'),_0x5869d9['id']));return rp({'uri':_0x326340[_0xe2ca('0x15')][_0xe2ca('0x16')][_0xe2ca('0x18')],'json':!![]})[_0xe2ca('0xf')](function(_0x1b98d8){logger['info'](util[_0xe2ca('0x9')](_0xe2ca('0x19'),_0x5869d9['id']));if(_0x1b98d8&&_0x1b98d8[_0xe2ca('0x1a')]&&_0x1b98d8[_0xe2ca('0x1a')][_0xe2ca('0x1b')]&&_0x1b98d8[_0xe2ca('0x1a')][_0xe2ca('0x1b')][_0xe2ca('0x1c')]){_0xa22adb[_0xe2ca('0x13')]='';for(var _0x567ceb=0x0;_0x567ceb<_0x1b98d8[_0xe2ca('0x1a')][_0xe2ca('0x1b')][_0xe2ca('0x1c')];_0x567ceb++){_0xa22adb[_0xe2ca('0x13')]+=_0x1b98d8[_0xe2ca('0x1a')]['transcripts'][_0x567ceb]['transcript']+'';}}return _0x5869d9[_0xe2ca('0x1d')](_0xa22adb);})[_0xe2ca('0xf')](function(){logger[_0xe2ca('0x10')](util[_0xe2ca('0x9')](_0xe2ca('0x1e'),_0x5869d9['id']));if(!_0x5869d9[_0xe2ca('0x1f')]){throw new db[(_0xe2ca('0x20'))][(_0xe2ca('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1138ee['sentiment']||!_0x1138ee[_0xe2ca('0x22')]||!_0x1138ee[_0xe2ca('0x23')]||!_0x1138ee[_0xe2ca('0x24')]||!_0x1138ee[_0xe2ca('0x25')]){throw new db[(_0xe2ca('0x20'))][(_0xe2ca('0x21'))](_0xe2ca('0x26'));}if(!_0xa22adb[_0xe2ca('0x13')]){throw new Error(_0xe2ca('0x27'));}if(_0x1138ee[_0xe2ca('0x22')]===_0x2773cc['id']){return _0x2773cc;}else{return db[_0xe2ca('0x28')][_0xe2ca('0x29')]({'where':{'id':_settings[_0xe2ca('0x22')]}});}})[_0xe2ca('0xf')](function(_0x4ada58){if(!_0x4ada58){throw new db[(_0xe2ca('0x20'))][(_0xe2ca('0x21'))](_0xe2ca('0x2a'));}if(!_0x4ada58[_0xe2ca('0xc')]||!_0x4ada58[_0xe2ca('0xd')]){throw new db[(_0xe2ca('0x20'))][(_0xe2ca('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x199237=_0x4ada58;logger['info'](util['format'](_0xe2ca('0x2b'),_0x5869d9['id']));return sentiment(_0x199237[_0xe2ca('0xc')],_0x199237[_0xe2ca('0xd')],_0x1138ee[_0xe2ca('0x23')],_0xa22adb[_0xe2ca('0x13')],_0x1138ee['language']);})[_0xe2ca('0xf')](function(_0x713af0){logger['info'](util[_0xe2ca('0x9')](_0xe2ca('0x2c'),_0x5869d9['id']));return _0x5869d9[_0xe2ca('0x1d')]({'sentiment':_0x713af0['Sentiment'],'sPositive':_0x713af0[_0xe2ca('0x2d')][_0xe2ca('0x2e')],'sNegative':_0x713af0[_0xe2ca('0x2d')]['Negative'],'sMixed':_0x713af0[_0xe2ca('0x2d')]['Mixed'],'sNeutral':_0x713af0[_0xe2ca('0x2d')]['Neutral']});})['then'](function(){logger[_0xe2ca('0x10')](util[_0xe2ca('0x9')](_0xe2ca('0x1e'),_0x5869d9['id']));_0x888224();});case'FAILED':return _0x5869d9[_0xe2ca('0x1d')]({'transcribeStatus':_0xe2ca('0x2f'),'failureReason':_0x326340[_0xe2ca('0x15')][_0xe2ca('0x30')]})['then'](function(){logger['info'](util[_0xe2ca('0x9')](_0xe2ca('0x1e'),_0x5869d9['id']));_0x888224();});default:logger['info'](util[_0xe2ca('0x9')](_0xe2ca('0x31'),_0x5869d9['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x5869d9['tempSentiment']){throw new db['Sequelize'][(_0xe2ca('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1138ee[_0xe2ca('0x32')]||!_0x1138ee[_0xe2ca('0x22')]||!_0x1138ee[_0xe2ca('0x23')]||!_0x1138ee['language']||!_0x1138ee['bucket']){throw new db[(_0xe2ca('0x20'))][(_0xe2ca('0x21'))](_0xe2ca('0x26'));}if(!_0x5869d9['fileText']){throw new Error(_0xe2ca('0x27'));}if(_0x1138ee[_0xe2ca('0x22')]===_0x2773cc['id']){return _0x2773cc;}else{return db[_0xe2ca('0x28')][_0xe2ca('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x5655dd){if(!_0x5655dd){throw new db[(_0xe2ca('0x20'))][(_0xe2ca('0x21'))](_0xe2ca('0x2a'));}if(!_0x5655dd[_0xe2ca('0xc')]||!_0x5655dd['data2']){throw new db[(_0xe2ca('0x20'))][(_0xe2ca('0x21'))](_0xe2ca('0x33'));}_0x199237=_0x5655dd;logger['info'](util[_0xe2ca('0x9')](_0xe2ca('0x2b'),_0x5869d9['id']));return sentiment(_0x199237[_0xe2ca('0xc')],_0x199237[_0xe2ca('0xd')],_0x1138ee[_0xe2ca('0x23')],_0x5869d9[_0xe2ca('0x13')],_0x1138ee[_0xe2ca('0x24')]);})[_0xe2ca('0xf')](function(_0x28531e){logger[_0xe2ca('0x10')](util[_0xe2ca('0x9')](_0xe2ca('0x2c'),_0x5869d9['id']));return _0x5869d9['update']({'sentiment':_0x28531e[_0xe2ca('0x34')],'sPositive':_0x28531e[_0xe2ca('0x2d')][_0xe2ca('0x2e')],'sNegative':_0x28531e[_0xe2ca('0x2d')]['Negative'],'sMixed':_0x28531e[_0xe2ca('0x2d')][_0xe2ca('0x35')],'sNeutral':_0x28531e[_0xe2ca('0x2d')]['Neutral'],'transcribeStatus':_0xe2ca('0x14')});})[_0xe2ca('0xf')](function(){logger[_0xe2ca('0x10')](util[_0xe2ca('0x9')](_0xe2ca('0x1e'),_0x5869d9['id']));_0x888224();});}})[_0xe2ca('0x36')](function(_0x2e1f5c){if(_0x2e1f5c){if(!_0x2e1f5c['name']||_0x2e1f5c[_0xe2ca('0x37')]!==_0xe2ca('0x38')){logger[_0xe2ca('0x39')](util[_0xe2ca('0x9')](_0xe2ca('0x3a'),_0x5869d9['id']),util['inspect'](_0x2e1f5c,{'showHidden':![],'depth':null}));}}_0x888224();});});}function checkTranscribe(){var _0x3625f5;var _0x532719;var _0x16f99d;return db[_0xe2ca('0x3b')][_0xe2ca('0x3c')]({'where':{'transcribeStatus':_0xe2ca('0x3d')}})[_0xe2ca('0xf')](function(_0x1bec07){if(!_0x1bec07||!_0x1bec07[_0xe2ca('0x1c')]){throw new db[(_0xe2ca('0x20'))][(_0xe2ca('0x21'))](_0xe2ca('0x3e'));}_0x3625f5=_0x1bec07;return db[_0xe2ca('0x3f')][_0xe2ca('0x29')]({'where':{'id':0x1}});})[_0xe2ca('0xf')](function(_0x598e25){if(!_0x598e25){throw new db[(_0xe2ca('0x20'))][(_0xe2ca('0x21'))]('Settings\x20not\x20available');}_0x532719=_0x598e25;if(!_0x532719['transcribe']||!_0x532719[_0xe2ca('0x40')]||!_0x532719[_0xe2ca('0xe')]||!_0x532719[_0xe2ca('0x24')]||!_0x532719['bucket']){throw new db[(_0xe2ca('0x20'))][(_0xe2ca('0x21'))](_0xe2ca('0x41'));}return db[_0xe2ca('0x28')]['findOne']({'where':{'id':_0x532719[_0xe2ca('0x40')]}});})[_0xe2ca('0xf')](function(_0x4a0e7f){if(!_0x4a0e7f){throw new db[(_0xe2ca('0x20'))][(_0xe2ca('0x21'))](_0xe2ca('0x2a'));}if(!_0x4a0e7f[_0xe2ca('0xc')]||!_0x4a0e7f['data2']){throw new db[(_0xe2ca('0x20'))][(_0xe2ca('0x21'))](_0xe2ca('0x33'));}_0x16f99d=_0x4a0e7f;var _0x20b737=[];_0x3625f5[_0xe2ca('0x42')](function(_0x5d966f){_0x20b737[_0xe2ca('0x43')](checkTranscribeJob(_0x5d966f,_0x532719,_0x16f99d));});return BPromise[_0xe2ca('0x44')](_0x20b737);})[_0xe2ca('0x36')](function(_0x4fec64){if(_0x4fec64){if(!_0x4fec64[_0xe2ca('0x37')]||_0x4fec64[_0xe2ca('0x37')]!==_0xe2ca('0x38')){logger[_0xe2ca('0x39')](util[_0xe2ca('0x45')](_0x4fec64,{'showHidden':![],'depth':null}));}}});}exports[_0xe2ca('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xd8d7=['FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Mixed','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','error','lodash','aws-sdk','request-promise','util','bluebird','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','format','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Sequelize','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral'];(function(_0x445c78,_0x3254ea){var _0x3f43f2=function(_0x13406d){while(--_0x13406d){_0x445c78['push'](_0x445c78['shift']());}};_0x3f43f2(++_0x3254ea);}(_0xd8d7,0x1d4));var _0x7d8d=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0xd8d7[_0x480bc8];return _0x28c245;};var _=require(_0x7d8d('0x0'));var AWS=require(_0x7d8d('0x1'));var rp=require(_0x7d8d('0x2'));var util=require(_0x7d8d('0x3'));var BPromise=require(_0x7d8d('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x4a0856,_0x39e284,_0x55bc9c,_0x3bc235){return new Promise(function(_0x35f2b2,_0x1dce79){var _0xc39292=new AWS[(_0x7d8d('0x5'))]({'accessKeyId':_0x39e284,'secretAccessKey':_0x4a0856,'region':_0x55bc9c});_0xc39292[_0x7d8d('0x6')]({'TranscriptionJobName':_0x3bc235},function(_0x1bac2e,_0x506fcd){if(_0x1bac2e){return _0x1dce79(_0x1bac2e);}else{return _0x35f2b2(_0x506fcd);}});});}function sentiment(_0x102889,_0xa5dd4c,_0x3e2f6e,_0x144911,_0x407423){return new Promise(function(_0x27efce,_0x2a0f33){var _0x5aa889=new AWS[(_0x7d8d('0x7'))]({'accessKeyId':_0xa5dd4c,'secretAccessKey':_0x102889,'region':_0x3e2f6e});_0x5aa889[_0x7d8d('0x8')]({'Text':_0x144911,'LanguageCode':_0x407423[_0x7d8d('0x9')](0x0,0x2)},function(_0x1a238c,_0xfc6750){if(_0x1a238c){return _0x2a0f33(_0x1a238c);}else{return _0x27efce(_0xfc6750);}});});}function checkTranscribeJob(_0x47b857,_0x1ba2b9,_0x444898){var _0x343421;return new BPromise(function(_0xd0c9ba,_0x44203e){logger[_0x7d8d('0xa')](util['format'](_0x7d8d('0xb'),_0x47b857['id'],_0x47b857[_0x7d8d('0xc')]));return getTranscriptionJob(_0x444898[_0x7d8d('0xd')],_0x444898[_0x7d8d('0xe')],_0x1ba2b9[_0x7d8d('0xf')],_0x47b857['transcribeName'])[_0x7d8d('0x10')](function(_0x5dfb62){logger[_0x7d8d('0xa')](util['format'](_0x7d8d('0x11'),_0x47b857['id'],_0x47b857[_0x7d8d('0xc')],_0x5dfb62[_0x7d8d('0x12')][_0x7d8d('0x13')]));if(!_0x47b857[_0x7d8d('0x14')]){switch(_0x5dfb62[_0x7d8d('0x12')][_0x7d8d('0x13')]){case _0x7d8d('0x15'):var _0x4b15c0={'transcribeStatus':_0x5dfb62[_0x7d8d('0x12')][_0x7d8d('0x13')],'fileUri':_0x5dfb62[_0x7d8d('0x12')][_0x7d8d('0x16')][_0x7d8d('0x17')]};logger[_0x7d8d('0xa')](util[_0x7d8d('0x18')](_0x7d8d('0x19'),_0x47b857['id']));return rp({'uri':_0x5dfb62[_0x7d8d('0x12')][_0x7d8d('0x16')][_0x7d8d('0x17')],'json':!![]})[_0x7d8d('0x10')](function(_0x1d822a){logger[_0x7d8d('0xa')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x47b857['id']));if(_0x1d822a&&_0x1d822a['results']&&_0x1d822a[_0x7d8d('0x1a')][_0x7d8d('0x1b')]&&_0x1d822a[_0x7d8d('0x1a')][_0x7d8d('0x1b')][_0x7d8d('0x1c')]){_0x4b15c0['fileText']='';for(var _0x4fdcb7=0x0;_0x4fdcb7<_0x1d822a[_0x7d8d('0x1a')][_0x7d8d('0x1b')][_0x7d8d('0x1c')];_0x4fdcb7++){_0x4b15c0[_0x7d8d('0x14')]+=_0x1d822a[_0x7d8d('0x1a')][_0x7d8d('0x1b')][_0x4fdcb7]['transcript']+'';}}return _0x47b857[_0x7d8d('0x1d')](_0x4b15c0);})[_0x7d8d('0x10')](function(){logger[_0x7d8d('0xa')](util[_0x7d8d('0x18')](_0x7d8d('0x1e'),_0x47b857['id']));if(!_0x47b857['tempSentiment']){throw new db['Sequelize'][(_0x7d8d('0x1f'))](_0x7d8d('0x20'));}if(!_0x1ba2b9[_0x7d8d('0x21')]||!_0x1ba2b9['sentimentAccountId']||!_0x1ba2b9[_0x7d8d('0x22')]||!_0x1ba2b9[_0x7d8d('0x23')]||!_0x1ba2b9[_0x7d8d('0x24')]){throw new db['Sequelize'][(_0x7d8d('0x1f'))](_0x7d8d('0x25'));}if(!_0x4b15c0['fileText']){throw new Error(_0x7d8d('0x26'));}if(_0x1ba2b9[_0x7d8d('0x27')]===_0x444898['id']){return _0x444898;}else{return db[_0x7d8d('0x28')][_0x7d8d('0x29')]({'where':{'id':_settings[_0x7d8d('0x27')]}});}})['then'](function(_0x47960c){if(!_0x47960c){throw new db[(_0x7d8d('0x2a'))][(_0x7d8d('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x47960c[_0x7d8d('0xd')]||!_0x47960c['data2']){throw new db[(_0x7d8d('0x2a'))][(_0x7d8d('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x343421=_0x47960c;logger[_0x7d8d('0xa')](util[_0x7d8d('0x18')](_0x7d8d('0x2b'),_0x47b857['id']));return sentiment(_0x343421[_0x7d8d('0xd')],_0x343421['data2'],_0x1ba2b9[_0x7d8d('0x22')],_0x4b15c0['fileText'],_0x1ba2b9[_0x7d8d('0x23')]);})[_0x7d8d('0x10')](function(_0x200745){logger[_0x7d8d('0xa')](util['format'](_0x7d8d('0x2c'),_0x47b857['id']));return _0x47b857[_0x7d8d('0x1d')]({'sentiment':_0x200745[_0x7d8d('0x2d')],'sPositive':_0x200745[_0x7d8d('0x2e')][_0x7d8d('0x2f')],'sNegative':_0x200745[_0x7d8d('0x2e')][_0x7d8d('0x30')],'sMixed':_0x200745[_0x7d8d('0x2e')]['Mixed'],'sNeutral':_0x200745[_0x7d8d('0x2e')][_0x7d8d('0x31')]});})[_0x7d8d('0x10')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x47b857['id']));_0xd0c9ba();});case _0x7d8d('0x32'):return _0x47b857[_0x7d8d('0x1d')]({'transcribeStatus':_0x7d8d('0x32'),'failureReason':_0x5dfb62[_0x7d8d('0x12')][_0x7d8d('0x33')]})['then'](function(){logger[_0x7d8d('0xa')](util[_0x7d8d('0x18')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x47b857['id']));_0xd0c9ba();});default:logger[_0x7d8d('0xa')](util[_0x7d8d('0x18')](_0x7d8d('0x34'),_0x47b857['id']));break;}}else{return BPromise[_0x7d8d('0x35')]()[_0x7d8d('0x10')](function(){if(!_0x47b857[_0x7d8d('0x36')]){throw new db[(_0x7d8d('0x2a'))][(_0x7d8d('0x1f'))](_0x7d8d('0x20'));}if(!_0x1ba2b9[_0x7d8d('0x21')]||!_0x1ba2b9['sentimentAccountId']||!_0x1ba2b9['sentimentRegion']||!_0x1ba2b9[_0x7d8d('0x23')]||!_0x1ba2b9['bucket']){throw new db[(_0x7d8d('0x2a'))][(_0x7d8d('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x47b857[_0x7d8d('0x14')]){throw new Error('Transcript\x20not\x20available');}if(_0x1ba2b9[_0x7d8d('0x27')]===_0x444898['id']){return _0x444898;}else{return db['CloudProvider'][_0x7d8d('0x29')]({'where':{'id':_settings[_0x7d8d('0x27')]}});}})[_0x7d8d('0x10')](function(_0x3cae70){if(!_0x3cae70){throw new db[(_0x7d8d('0x2a'))][(_0x7d8d('0x1f'))](_0x7d8d('0x37'));}if(!_0x3cae70[_0x7d8d('0xd')]||!_0x3cae70[_0x7d8d('0xe')]){throw new db[(_0x7d8d('0x2a'))][(_0x7d8d('0x1f'))](_0x7d8d('0x38'));}_0x343421=_0x3cae70;logger[_0x7d8d('0xa')](util[_0x7d8d('0x18')](_0x7d8d('0x2b'),_0x47b857['id']));return sentiment(_0x343421[_0x7d8d('0xd')],_0x343421[_0x7d8d('0xe')],_0x1ba2b9[_0x7d8d('0x22')],_0x47b857[_0x7d8d('0x14')],_0x1ba2b9[_0x7d8d('0x23')]);})[_0x7d8d('0x10')](function(_0x1237d6){logger[_0x7d8d('0xa')](util['format'](_0x7d8d('0x2c'),_0x47b857['id']));return _0x47b857[_0x7d8d('0x1d')]({'sentiment':_0x1237d6[_0x7d8d('0x2d')],'sPositive':_0x1237d6[_0x7d8d('0x2e')]['Positive'],'sNegative':_0x1237d6[_0x7d8d('0x2e')][_0x7d8d('0x30')],'sMixed':_0x1237d6['SentimentScore'][_0x7d8d('0x39')],'sNeutral':_0x1237d6[_0x7d8d('0x2e')][_0x7d8d('0x31')],'transcribeStatus':_0x7d8d('0x15')});})[_0x7d8d('0x10')](function(){logger['info'](util[_0x7d8d('0x18')](_0x7d8d('0x1e'),_0x47b857['id']));_0xd0c9ba();});}})[_0x7d8d('0x3a')](function(_0x123b49){if(_0x123b49){if(!_0x123b49[_0x7d8d('0x3b')]||_0x123b49['name']!==_0x7d8d('0x3c')){logger['error'](util[_0x7d8d('0x18')](_0x7d8d('0x3d'),_0x47b857['id']),util[_0x7d8d('0x3e')](_0x123b49,{'showHidden':![],'depth':null}));}}_0xd0c9ba();});});}function checkTranscribe(){var _0x1c562a;var _0x19ba28;var _0x3ddc1b;return db[_0x7d8d('0x3f')][_0x7d8d('0x40')]({'where':{'transcribeStatus':_0x7d8d('0x41')}})[_0x7d8d('0x10')](function(_0x1c077e){if(!_0x1c077e||!_0x1c077e[_0x7d8d('0x1c')]){throw new db['Sequelize'][(_0x7d8d('0x1f'))]('No\x20transcribe\x20job\x20to\x20check');}_0x1c562a=_0x1c077e;return db[_0x7d8d('0x42')][_0x7d8d('0x29')]({'where':{'id':0x1}});})[_0x7d8d('0x10')](function(_0x18e9fa){if(!_0x18e9fa){throw new db['Sequelize'][(_0x7d8d('0x1f'))]('Settings\x20not\x20available');}_0x19ba28=_0x18e9fa;if(!_0x19ba28[_0x7d8d('0x43')]||!_0x19ba28[_0x7d8d('0x44')]||!_0x19ba28[_0x7d8d('0xf')]||!_0x19ba28[_0x7d8d('0x23')]||!_0x19ba28[_0x7d8d('0x24')]){throw new db[(_0x7d8d('0x2a'))][(_0x7d8d('0x1f'))](_0x7d8d('0x45'));}return db[_0x7d8d('0x28')]['findOne']({'where':{'id':_0x19ba28[_0x7d8d('0x44')]}});})[_0x7d8d('0x10')](function(_0x31df6a){if(!_0x31df6a){throw new db[(_0x7d8d('0x2a'))]['ValidationError'](_0x7d8d('0x37'));}if(!_0x31df6a[_0x7d8d('0xd')]||!_0x31df6a[_0x7d8d('0xe')]){throw new db[(_0x7d8d('0x2a'))][(_0x7d8d('0x1f'))](_0x7d8d('0x38'));}_0x3ddc1b=_0x31df6a;var _0xa2c0b8=[];_0x1c562a[_0x7d8d('0x46')](function(_0x2a2ff4){_0xa2c0b8[_0x7d8d('0x47')](checkTranscribeJob(_0x2a2ff4,_0x19ba28,_0x3ddc1b));});return BPromise[_0x7d8d('0x48')](_0xa2c0b8);})[_0x7d8d('0x3a')](function(_0x5dd84e){if(_0x5dd84e){if(!_0x5dd84e[_0x7d8d('0x3b')]||_0x5dd84e[_0x7d8d('0x3b')]!==_0x7d8d('0x3c')){logger[_0x7d8d('0x49')](util[_0x7d8d('0x3e')](_0x5dd84e,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 5ecbf04..9832e6c 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 _0xb66b=['catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','util','../logger','schedule','defaults','redis','localhost','socket.io-emitter','findAll','subtract','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','timeout','YYYY-MM-DD\x20HH:mm:ss','then','emit','whatsappInteraction:update'];(function(_0x47d4f,_0x3ce2cd){var _0x185103=function(_0x4d6e36){while(--_0x4d6e36){_0x47d4f['push'](_0x47d4f['shift']());}};_0x185103(++_0x3ce2cd);}(_0xb66b,0x12d));var _0xbb66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb66b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbb66('0x0'));var moment=require(_0xbb66('0x1'));var Redis=require('ioredis');var util=require(_0xbb66('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xbb66('0x3'))(_0xbb66('0x4'));config['redis']=_[_0xbb66('0x5')](config[_0xbb66('0x6')],{'host':_0xbb66('0x7'),'port':0x18eb});var io=require(_0xbb66('0x8'))(new Redis(config[_0xbb66('0x6')]));function closeInteractions(){var _0x2c69a3=[];return db['WhatsappInteraction'][_0xbb66('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xbb66('0xa')](0x18,'hours')}}})['then'](function(_0x2ff6ef){if(_0x2ff6ef&&_0x2ff6ef[_0xbb66('0xb')]){_0x2c69a3=_[_0xbb66('0xc')](_0x2ff6ef||[],'id');logger[_0xbb66('0xd')](_0xbb66('0xe'),_0x2c69a3[_0xbb66('0xf')]());return db[_0xbb66('0x10')][_0xbb66('0x11')]({'closeReason':'system','disposition':_0xbb66('0x12'),'closed':!![],'closedAt':moment()['format'](_0xbb66('0x13'))},{'where':{'id':_0x2c69a3}});}})[_0xbb66('0x14')](function(){if(_0x2c69a3&&_0x2c69a3[_0xbb66('0xb')]){logger[_0xbb66('0xd')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x2c69a3[_0xbb66('0xf')]());for(var _0x1a2dc9=0x0;_0x1a2dc9<_0x2c69a3[_0xbb66('0xb')];_0x1a2dc9++){io[_0xbb66('0x15')](_0xbb66('0x16'),{'id':_0x2c69a3[_0x1a2dc9],'closed':!![]});}}})[_0xbb66('0x17')](function(_0x4edc92){logger[_0xbb66('0x18')](_0xbb66('0x19'),_0x4edc92?util[_0xbb66('0x1a')](_0x4edc92,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xafd8=['findAll','lastMsgAt','subtract','hours','then','length','map','info','join','update','timeout','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','redis','WhatsappInteraction'];(function(_0x42ad2a,_0x1414fe){var _0x4d1c71=function(_0x10aa04){while(--_0x10aa04){_0x42ad2a['push'](_0x42ad2a['shift']());}};_0x4d1c71(++_0x1414fe);}(_0xafd8,0x1b2));var _0x8afd=function(_0x279755,_0x42ad77){_0x279755=_0x279755-0x0;var _0x138178=_0xafd8[_0x279755];return _0x138178;};'use strict';var _=require(_0x8afd('0x0'));var moment=require(_0x8afd('0x1'));var Redis=require(_0x8afd('0x2'));var util=require(_0x8afd('0x3'));var config=require('../../config/environment');var db=require(_0x8afd('0x4'))['db'];var logger=require(_0x8afd('0x5'))('schedule');config[_0x8afd('0x6')]=_['defaults'](config[_0x8afd('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x587697=[];return db[_0x8afd('0x7')][_0x8afd('0x8')]({'raw':!![],'attributes':['id',_0x8afd('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8afd('0xa')](0x18,_0x8afd('0xb'))}}})[_0x8afd('0xc')](function(_0x1f990b){if(_0x1f990b&&_0x1f990b[_0x8afd('0xd')]){_0x587697=_[_0x8afd('0xe')](_0x1f990b||[],'id');logger[_0x8afd('0xf')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x587697[_0x8afd('0x10')]());return db[_0x8afd('0x7')][_0x8afd('0x11')]({'closeReason':'system','disposition':_0x8afd('0x12'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x587697}});}})[_0x8afd('0xc')](function(){if(_0x587697&&_0x587697[_0x8afd('0xd')]){logger['info'](_0x8afd('0x13'),_0x587697[_0x8afd('0x10')]());for(var _0x4fb94c=0x0;_0x4fb94c<_0x587697[_0x8afd('0xd')];_0x4fb94c++){io[_0x8afd('0x14')](_0x8afd('0x15'),{'id':_0x587697[_0x4fb94c],'closed':!![]});}}})[_0x8afd('0x16')](function(_0x5d321d){logger[_0x8afd('0x17')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x5d321d?util[_0x8afd('0x18')](_0x5d321d,{'showHidden':![],'depth':null}):'');});}exports[_0x8afd('0x19')]=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 17db4c8..b4f0a10 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ac7=['Innocenzo','Biondo','@xcally.com','push','now','innocenzo.biondo','destroy','CmContact','bulkCreate','then','log','finished\x20populating','CmHopper','hopper2','catch','util','../mysqldb'];(function(_0x49e056,_0x3b44ff){var _0x3430a6=function(_0x1a811e){while(--_0x1a811e){_0x49e056['push'](_0x49e056['shift']());}};_0x3430a6(++_0x3b44ff);}(_0x9ac7,0x152));var _0x79ac=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x9ac7[_0x23e7c1];return _0x1add43;};'use strict';var util=require(_0x79ac('0x0'));var db=require(_0x79ac('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x79ac('0x2')+i,'lastName':_0x79ac('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x79ac('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x79ac('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x79ac('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x79ac('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x79ac('0x5')]({'id':i,'firstName':_0x79ac('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x79ac('0x7')+i+_0x79ac('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x79ac('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x79ac('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x79ac('0x6')](),'updatedAt':Date['now']()});}db['CmContact'][_0x79ac('0x8')]({'where':{}})['then'](function(){return db[_0x79ac('0x9')][_0x79ac('0xa')](contacts);})[_0x79ac('0xb')](function(){console[_0x79ac('0xc')](_0x79ac('0xd'),'contacts1');return db['CmHopper']['destroy']({'where':{}});})[_0x79ac('0xb')](function(){return db[_0x79ac('0xe')][_0x79ac('0xa')](hopper);})['then'](function(){console[_0x79ac('0xc')](_0x79ac('0xd'),'hopper1');return db[_0x79ac('0x9')][_0x79ac('0xa')](contacts2);})[_0x79ac('0xb')](function(){console['log'](_0x79ac('0xd'),'contacts2');return db[_0x79ac('0xe')][_0x79ac('0xa')](hopper2);})[_0x79ac('0xb')](function(){console[_0x79ac('0xc')]('finished\x20populating',_0x79ac('0xf'));})[_0x79ac('0x10')](function(_0x5a1017){console[_0x79ac('0xc')](_0x5a1017);}); \ No newline at end of file +var _0x166c=['bulkCreate','log','contacts1','CmHopper','finished\x20populating','hopper2','util','push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','CmContact','destroy','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x166c,0x1c6));var _0xc166=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x166c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc166('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc166('0x1')]({'id':i,'firstName':_0xc166('0x2')+i,'lastName':_0xc166('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xc166('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc166('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xc166('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc166('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc166('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xc166('0x3')+i,'phone':0xf879fb460+i,'email':_0xc166('0x6')+i+_0xc166('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xc166('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc166('0x5')](),'updatedAt':Date['now']()});}db[_0xc166('0x7')][_0xc166('0x8')]({'where':{}})[_0xc166('0x9')](function(){return db[_0xc166('0x7')][_0xc166('0xa')](contacts);})[_0xc166('0x9')](function(){console[_0xc166('0xb')]('finished\x20populating',_0xc166('0xc'));return db[_0xc166('0xd')]['destroy']({'where':{}});})[_0xc166('0x9')](function(){return db['CmHopper'][_0xc166('0xa')](hopper);})[_0xc166('0x9')](function(){console['log']('finished\x20populating','hopper1');return db[_0xc166('0x7')][_0xc166('0xa')](contacts2);})[_0xc166('0x9')](function(){console[_0xc166('0xb')]('finished\x20populating','contacts2');return db['CmHopper'][_0xc166('0xa')](hopper2);})[_0xc166('0x9')](function(){console[_0xc166('0xb')](_0xc166('0xe'),_0xc166('0xf'));})['catch'](function(_0x4f3de0){console[_0xc166('0xb')](_0x4f3de0);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 6fe61f3..5305815 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1836=['log','add\x20user','catch','push','agent','%s%s','format','%s%s@xcally.com','password','friend','udp','yes','/etc/pki/tls/certs/motion.crt','actpass','User'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0x1836,0x102));var _0x6183=function(_0x479ef5,_0x2edee7){_0x479ef5=_0x479ef5-0x0;var _0x35a564=_0x1836[_0x479ef5];return _0x35a564;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x6183('0x0')]({'name':util['format']('%s%s',_0x6183('0x1'),i),'fullname':util['format'](_0x6183('0x2'),_0x6183('0x1'),i),'email':util[_0x6183('0x3')](_0x6183('0x4'),_0x6183('0x1'),i),'role':_0x6183('0x1'),'password':_0x6183('0x5'),'internal':0xfa0+i,'type':_0x6183('0x6'),'transport':[_0x6183('0x7'),'ws','wss'],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0x6183('0x3')]('%s%s',_0x6183('0x1'),i),'encryption':_0x6183('0x8'),'avpf':_0x6183('0x8'),'force_avp':_0x6183('0x8'),'icesupport':_0x6183('0x8'),'dtlsenable':_0x6183('0x8'),'dtlsverify':'no','dtlscertfile':_0x6183('0x9'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x6183('0xa'),'callerid':util[_0x6183('0x3')]('\x22%s\x22\x20<%s>',util[_0x6183('0x3')](_0x6183('0x2'),_0x6183('0x1'),i),0xfa0+i)});}db[_0x6183('0xb')]['bulkCreate'](users)['then'](function(){console[_0x6183('0xc')](_0x6183('0xd'));})[_0x6183('0xe')](function(_0x429039){console[_0x6183('0xc')](_0x429039);}); \ No newline at end of file +var _0x2fc3=['password','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','bulkCreate','log','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0x2fc3,0x6b));var _0x32fc=function(_0x52a715,_0x3765d1){_0x52a715=_0x52a715-0x0;var _0x2df520=_0x2fc3[_0x52a715];return _0x2df520;};'use strict';var util=require(_0x32fc('0x0'));var db=require(_0x32fc('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x32fc('0x2')]({'name':util[_0x32fc('0x3')](_0x32fc('0x4'),_0x32fc('0x5'),i),'fullname':util[_0x32fc('0x3')]('%s%s','agent',i),'email':util['format'](_0x32fc('0x6'),_0x32fc('0x5'),i),'role':_0x32fc('0x5'),'password':_0x32fc('0x7'),'internal':0xfa0+i,'type':_0x32fc('0x8'),'transport':[_0x32fc('0x9'),'ws','wss'],'disallow':[_0x32fc('0xa')],'allow':[_0x32fc('0xb')],'defaultuser':util[_0x32fc('0x3')](_0x32fc('0x4'),'agent',i),'encryption':'yes','avpf':_0x32fc('0xc'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0x32fc('0xc'),'dtlsverify':'no','dtlscertfile':_0x32fc('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x32fc('0xe'),'callerid':util[_0x32fc('0x3')](_0x32fc('0xf'),util['format'](_0x32fc('0x4'),'agent',i),0xfa0+i)});}db['User'][_0x32fc('0x10')](users)['then'](function(){console[_0x32fc('0x11')]('add\x20user');})[_0x32fc('0x12')](function(_0x2f748f){console[_0x32fc('0x11')](_0x2f748f);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 3afe581..927207b 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x803c=['util','bluebird','../mysqldb','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','resourceId','then','Campaign','where','type','format','%s:queue:%s','length','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','include','VoiceQueue','push','ChatQueue','SmsQueue','WhatsappQueue','user','ChatQueues','SmsQueues','MailQueue','Telephones','Trunk','IvrCampaigns','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','map','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','remoteAddress','remotePort','connectedAt','log','nsp','disconnect','CONNECTED','lodash'];(function(_0x58bf4b,_0x3e1be4){var _0x544f5b=function(_0xf64203){while(--_0xf64203){_0x58bf4b['push'](_0x58bf4b['shift']());}};_0x544f5b(++_0x3e1be4);}(_0x803c,0x65));var _0xc803=function(_0xb98963,_0x46e4eb){_0xb98963=_0xb98963-0x0;var _0x525fa0=_0x803c[_0xb98963];return _0x525fa0;};'use strict';var _=require(_0xc803('0x0'));var util=require(_0xc803('0x1'));var BPromise=require(_0xc803('0x2'));var db=require(_0xc803('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xc803('0x4')],'include':[{'as':_0xc803('0x5'),'model':db[_0xc803('0x6')],'attributes':['id','name',_0xc803('0x7')],'raw':!![],'where':{'role':_0xc803('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xc803('0x4')],'where':{'role':_0xc803('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xc803('0x4')],'where':{'role':_0xc803('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xc803('0x4'),'type'],'where':{'type':_0xc803('0xa')}};function getAssociatedResources(_0x1efab8,_0x5fa18d,_0x9a84f5){return db[_0xc803('0xb')][_0xc803('0xc')]({'where':{'name':_0x1efab8,'userProfileId':_0x5fa18d},'raw':!![]})['then'](function(_0x548d60){if(_0x548d60){if(_0x548d60[_0xc803('0xd')]){switch(_0x1efab8){case _0xc803('0xe'):case'ChatQueues':case _0xc803('0xf'):case'SmsQueues':case _0xc803('0x10'):case _0xc803('0x11'):case _0xc803('0x12'):return db[_0x9a84f5][_0xc803('0x13')](queryQueues);case'Telephones':return db[_0x9a84f5][_0xc803('0x13')](queryTelephones);case _0xc803('0x14'):return db[_0x9a84f5][_0xc803('0x13')](queryTrunks);case'IvrCampaigns':return db[_0x9a84f5]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0xc803('0x13')]({'attributes':[_0xc803('0x15')],'where':{'sectionId':_0x548d60['id']},'raw':!![]})[_0xc803('0x16')](function(_0x395c71){if(_0x395c71){var _0x5e38a1={'where':{'id':_['map'](_0x395c71,_0xc803('0x15'))},'raw':!![]};switch(_0x9a84f5){case _0xc803('0x6'):_0x5e38a1['where']['role']='telephone';break;case _0xc803('0x17'):_0x5e38a1[_0xc803('0x18')][_0xc803('0x19')]='ivr';break;}return db[_0x9a84f5][_0xc803('0x13')](_0x5e38a1);}else{return[];}});}}else{return[];}})[_0xc803('0x16')](function(_0x2d9a34){return _0x2d9a34;});}function joinOrLeaveQueues(_0x15b9d6,_0x123d9e,_0x1ddb76,_0x35e71a){_0x15b9d6[_0x123d9e](util[_0xc803('0x1a')](_0xc803('0x1b'),_0x1ddb76,_0x35e71a[_0xc803('0x4')]));if(_0x35e71a[_0xc803('0x5')]){for(var _0x5a5659=0x0;_0x5a5659<_0x35e71a[_0xc803('0x5')][_0xc803('0x1c')];_0x5a5659+=0x1){_0x15b9d6[_0x123d9e](util[_0xc803('0x1a')]('user:%s',_0x35e71a[_0xc803('0x5')][_0x5a5659][_0xc803('0x4')]));}}}function joinOrLeave(_0x17cedf,_0x20dbbf,_0x2189f3){var _0xd4780c;if(_0x17cedf[_0xc803('0x1d')]['query']['id']){db[_0xc803('0x6')][_0xc803('0x1e')]({'attributes':['id','name',_0xc803('0x7'),_0xc803('0x1f')],'where':{'id':_0x17cedf[_0xc803('0x1d')][_0xc803('0x20')]['id']},'include':[{'model':db[_0xc803('0x21')],'as':_0xc803('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xc803('0x23')],'as':_0xc803('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xc803('0x25')],'as':_0xc803('0x26'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xc803('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xc803('0x28')],'as':_0xc803('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xc803('0x2a')],'as':_0xc803('0x2b'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x6148d8){if(_0x6148d8){_0xd4780c=_0x6148d8;_0x17cedf[_0x20dbbf](util[_0xc803('0x1a')](_0xc803('0x2c'),_0x6148d8['name']));var _0x148116=[];switch(_0x6148d8['role']){case _0xc803('0x2d'):_0x17cedf[_0x20dbbf](_0xc803('0x2e'));_0x17cedf[_0x20dbbf](_0xc803('0x2f'));if(queryQueues['hasOwnProperty'](_0xc803('0x30'))){delete queryQueues[_0xc803('0x30')];}_0x148116['push'](db[_0xc803('0x31')][_0xc803('0x13')](queryQueues));_0x148116[_0xc803('0x32')](db[_0xc803('0x33')][_0xc803('0x13')](queryQueues));_0x148116[_0xc803('0x32')](db['FaxQueue'][_0xc803('0x13')](queryQueues));_0x148116[_0xc803('0x32')](db[_0xc803('0x34')][_0xc803('0x13')](queryQueues));_0x148116['push'](db['MailQueue'][_0xc803('0x13')](queryQueues));_0x148116[_0xc803('0x32')](db['OpenchannelQueue'][_0xc803('0x13')](queryQueues));_0x148116[_0xc803('0x32')](db[_0xc803('0x35')][_0xc803('0x13')](queryQueues));_0x148116[_0xc803('0x32')](db[_0xc803('0x6')][_0xc803('0x13')](queryTelephones));_0x148116['push'](db['Trunk'][_0xc803('0x13')](queryTrunks));_0x148116[_0xc803('0x32')](db[_0xc803('0x17')][_0xc803('0x13')](queryCampaigns));_0x148116[_0xc803('0x32')](db[_0xc803('0x6')]['findAll'](queryAgents));break;case _0xc803('0x36'):_0x17cedf[_0x20dbbf](_0xc803('0x2e'));_0x17cedf[_0x20dbbf]('voice:outbound');_0x148116[_0xc803('0x32')](getAssociatedResources('VoiceQueues',_0x6148d8[_0xc803('0x1f')],_0xc803('0x31')));_0x148116[_0xc803('0x32')](getAssociatedResources(_0xc803('0x37'),_0x6148d8[_0xc803('0x1f')],_0xc803('0x33')));_0x148116['push'](getAssociatedResources(_0xc803('0xf'),_0x6148d8[_0xc803('0x1f')],'FaxQueue'));_0x148116[_0xc803('0x32')](getAssociatedResources(_0xc803('0x38'),_0x6148d8[_0xc803('0x1f')],_0xc803('0x34')));_0x148116['push'](getAssociatedResources('MailQueues',_0x6148d8[_0xc803('0x1f')],_0xc803('0x39')));_0x148116[_0xc803('0x32')](getAssociatedResources(_0xc803('0x11'),_0x6148d8['userProfileId'],'OpenchannelQueue'));_0x148116['push'](getAssociatedResources('WhatsappQueues',_0x6148d8[_0xc803('0x1f')],'WhatsappQueue'));_0x148116[_0xc803('0x32')](getAssociatedResources(_0xc803('0x3a'),_0x6148d8[_0xc803('0x1f')],'User'));_0x148116[_0xc803('0x32')](getAssociatedResources('Trunks',_0x6148d8[_0xc803('0x1f')],_0xc803('0x3b')));_0x148116[_0xc803('0x32')](getAssociatedResources(_0xc803('0x3c'),_0x6148d8[_0xc803('0x1f')],_0xc803('0x17')));_0x148116[_0xc803('0x32')](db[_0xc803('0x6')]['findAll'](queryAgents));break;case _0xc803('0x8'):_0x17cedf[_0x20dbbf](_0xc803('0x2e'));_0x17cedf[_0x20dbbf]('voice:outbound');_0x148116[_0xc803('0x32')](_0x6148d8['getVoiceQueues']({'attributes':['id',_0xc803('0x4')]}));_0x148116[_0xc803('0x32')](_0x6148d8[_0xc803('0x3d')]({'attributes':['id','name']}));_0x148116[_0xc803('0x32')](_0x6148d8['getFaxQueues']({'attributes':['id','name']}));_0x148116[_0xc803('0x32')](_0x6148d8[_0xc803('0x3e')]({'attributes':['id',_0xc803('0x4')]}));_0x148116[_0xc803('0x32')](_0x6148d8[_0xc803('0x3f')]({'attributes':['id',_0xc803('0x4')]}));_0x148116[_0xc803('0x32')](_0x6148d8[_0xc803('0x40')]({'attributes':['id',_0xc803('0x4')]}));_0x148116[_0xc803('0x32')](_0x6148d8[_0xc803('0x41')]({'attributes':['id',_0xc803('0x4')]}));break;}return BPromise[_0xc803('0x42')](_0x148116);}})[_0xc803('0x16')](function(_0x529d1d){if(_0x529d1d&&_0x529d1d[_0xc803('0x1c')]){for(var _0xb4282=0x0;_0xb4282<_0x529d1d[_0xc803('0x1c')];_0xb4282+=0x1){for(var _0x4a3eba=0x0;_0x4a3eba<_0x529d1d[_0xb4282][_0xc803('0x1c')];_0x4a3eba+=0x1){switch(_0xb4282){case 0x0:joinOrLeaveQueues(_0x17cedf,_0x20dbbf,_0xc803('0x43'),_0x529d1d[_0xb4282][_0x4a3eba]);break;case 0x1:joinOrLeaveQueues(_0x17cedf,_0x20dbbf,_0xc803('0x44'),_0x529d1d[_0xb4282][_0x4a3eba]);break;case 0x2:joinOrLeaveQueues(_0x17cedf,_0x20dbbf,'fax',_0x529d1d[_0xb4282][_0x4a3eba]);break;case 0x3:joinOrLeaveQueues(_0x17cedf,_0x20dbbf,_0xc803('0x45'),_0x529d1d[_0xb4282][_0x4a3eba]);break;case 0x4:joinOrLeaveQueues(_0x17cedf,_0x20dbbf,_0xc803('0x46'),_0x529d1d[_0xb4282][_0x4a3eba]);break;case 0x5:joinOrLeaveQueues(_0x17cedf,_0x20dbbf,_0xc803('0x47'),_0x529d1d[_0xb4282][_0x4a3eba]);break;case 0x6:joinOrLeaveQueues(_0x17cedf,_0x20dbbf,_0xc803('0x48'),_0x529d1d[_0xb4282][_0x4a3eba]);break;case 0x7:if(_0xd4780c[_0xc803('0x7')]!==_0xc803('0x8'))_0x17cedf[_0x20dbbf](util[_0xc803('0x1a')](_0xc803('0x49'),_0x529d1d[_0xb4282][_0x4a3eba][_0xc803('0x4')]));break;case 0x8:if(_0xd4780c[_0xc803('0x7')]!=='agent')_0x17cedf[_0x20dbbf](util[_0xc803('0x1a')](_0xc803('0x4a'),_0x529d1d[_0xb4282][_0x4a3eba][_0xc803('0x4')]));break;case 0x9:if(_0xd4780c[_0xc803('0x7')]!==_0xc803('0x8'))_0x17cedf[_0x20dbbf](util[_0xc803('0x1a')](_0xc803('0x4b'),_0x529d1d[_0xb4282][_0x4a3eba][_0xc803('0x19')],_0x529d1d[_0xb4282][_0x4a3eba]['name']));break;case 0xa:_0x17cedf[_0x20dbbf](util[_0xc803('0x1a')](_0xc803('0x2c'),_0x529d1d[_0xb4282][_0x4a3eba][_0xc803('0x4')]));break;}}}}})[_0xc803('0x16')](function(){if(_0x20dbbf===_0xc803('0x4c')){var _0x2b6bec=_['map'](_0xd4780c[_0xc803('0x22')],'id');return _0xd4780c[_0xc803('0x4d')](_0x2b6bec)['then'](function(){for(var _0xf6134d=0x0;_0xf6134d<_0x2b6bec[_0xc803('0x1c')];_0xf6134d+=0x1){_0x2189f3[_0xc803('0x4e')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x2b6bec[_0xf6134d]),'UserId':Number(_0xd4780c['id'])});}});}})[_0xc803('0x16')](function(){if(_0x20dbbf===_0xc803('0x4c')){var _0x99fb13=_[_0xc803('0x4f')](_0xd4780c[_0xc803('0x24')],'id');return _0xd4780c[_0xc803('0x50')](_0x99fb13)['then'](function(){for(var _0x5e0ac3=0x0;_0x5e0ac3<_0x99fb13[_0xc803('0x1c')];_0x5e0ac3+=0x1){_0x2189f3['emit'](_0xc803('0x51'),{'MailInteractionId':Number(_0x99fb13[_0x5e0ac3]),'UserId':Number(_0xd4780c['id'])});}});}})[_0xc803('0x16')](function(){if(_0x20dbbf===_0xc803('0x4c')){var _0x11beb8=_['map'](_0xd4780c[_0xc803('0x26')],'id');return _0xd4780c[_0xc803('0x52')](_0x11beb8)[_0xc803('0x16')](function(){for(var _0x443171=0x0;_0x443171<_0x11beb8[_0xc803('0x1c')];_0x443171+=0x1){_0x2189f3['emit'](_0xc803('0x53'),{'FaxInteractionId':Number(_0x11beb8[_0x443171]),'UserId':Number(_0xd4780c['id'])});}});}})[_0xc803('0x16')](function(){if(_0x20dbbf===_0xc803('0x4c')){var _0xcd5019=_[_0xc803('0x4f')](_0xd4780c[_0xc803('0x27')],'id');return _0xd4780c[_0xc803('0x54')](_0xcd5019)[_0xc803('0x16')](function(){for(var _0x360008=0x0;_0x360008<_0xcd5019[_0xc803('0x1c')];_0x360008+=0x1){_0x2189f3[_0xc803('0x4e')](_0xc803('0x55'),{'SmsInteractionId':Number(_0xcd5019[_0x360008]),'UserId':Number(_0xd4780c['id'])});}});}})[_0xc803('0x16')](function(){if(_0x20dbbf===_0xc803('0x4c')){var _0x56922c=_[_0xc803('0x4f')](_0xd4780c[_0xc803('0x29')],'id');return _0xd4780c[_0xc803('0x56')](_0x56922c)[_0xc803('0x16')](function(){for(var _0x4fe36a=0x0;_0x4fe36a<_0x56922c[_0xc803('0x1c')];_0x4fe36a+=0x1){_0x2189f3[_0xc803('0x4e')](_0xc803('0x57'),{'OpenchannelInteractionId':Number(_0x56922c[_0x4fe36a]),'UserId':Number(_0xd4780c['id'])});}});}})[_0xc803('0x16')](function(){if(_0x20dbbf==='leave'){var _0x5ebc75=_[_0xc803('0x4f')](_0xd4780c[_0xc803('0x2b')],'id');return _0xd4780c['removeWhatsappInteractions'](_0x5ebc75)[_0xc803('0x16')](function(){for(var _0x5779aa=0x0;_0x5779aa<_0x5ebc75[_0xc803('0x1c')];_0x5779aa+=0x1){_0x2189f3[_0xc803('0x4e')](_0xc803('0x58'),{'WhatsappInteractionId':Number(_0x5ebc75[_0x5779aa]),'UserId':Number(_0xd4780c['id'])});}});}})[_0xc803('0x59')](function(_0x54e205){_0x17cedf['log'](_0x54e205);});}}function onDisconnect(_0x2eeae1,_0x3bfbab){joinOrLeave(_0x2eeae1,_0xc803('0x4c'),_0x3bfbab);}function onConnect(_0x567dce){joinOrLeave(_0x567dce,_0xc803('0x5a'));}exports[_0xc803('0x5b')]=function(_0x50431d){_0x50431d['on'](_0xc803('0x5c'),function(_0x239adc){_0x239adc[_0xc803('0x5d')](0x0);_0x239adc[_0xc803('0x5e')]=_0x239adc['request'][_0xc803('0x5c')][_0xc803('0x5f')]+':'+_0x239adc['request'][_0xc803('0x5c')][_0xc803('0x60')];_0x239adc[_0xc803('0x61')]=new Date();_0x239adc[_0xc803('0x62')]=function(_0x34c4a2){console[_0xc803('0x62')]('SocketIO\x20'+_0x239adc[_0xc803('0x63')][_0xc803('0x4')]+'['+_0x239adc[_0xc803('0x5e')]+']',_0x34c4a2);};_0x239adc['on'](_0xc803('0x64'),function(){onDisconnect(_0x239adc,_0x50431d);_0x239adc['log']('DISCONNECTED');});onConnect(_0x239adc);_0x239adc[_0xc803('0x62')](_0xc803('0x65'));});}; \ No newline at end of file +var _0x90b1=['FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','voice:inbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:outbound','VoiceQueue','SmsQueue','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','chat','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','name','Agents','User','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','role','Campaign','where','%s:queue:%s','format','user:%s','handshake','query','userProfileId','ChatInteraction','MailInteraction','MailInteractions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x90b1,0x1bb));var _0x190b=function(_0x34fe88,_0x36a469){_0x34fe88=_0x34fe88-0x0;var _0x3d6cd0=_0x90b1[_0x34fe88];return _0x3d6cd0;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var BPromise=require(_0x190b('0x2'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x190b('0x3')],'include':[{'as':_0x190b('0x4'),'model':db[_0x190b('0x5')],'attributes':['id',_0x190b('0x3'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x190b('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x190b('0x3')],'where':{'role':_0x190b('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x190b('0x3'),_0x190b('0x7')],'where':{'type':_0x190b('0x8')}};function getAssociatedResources(_0x32c30c,_0x5cf2b4,_0x14b93d){return db[_0x190b('0x9')][_0x190b('0xa')]({'where':{'name':_0x32c30c,'userProfileId':_0x5cf2b4},'raw':!![]})[_0x190b('0xb')](function(_0x41b788){if(_0x41b788){if(_0x41b788[_0x190b('0xc')]){switch(_0x32c30c){case _0x190b('0xd'):case _0x190b('0xe'):case'FaxQueues':case _0x190b('0xf'):case _0x190b('0x10'):case'OpenchannelQueues':case _0x190b('0x11'):return db[_0x14b93d][_0x190b('0x12')](queryQueues);case _0x190b('0x13'):return db[_0x14b93d][_0x190b('0x12')](queryTelephones);case _0x190b('0x14'):return db[_0x14b93d][_0x190b('0x12')](queryTrunks);case _0x190b('0x15'):return db[_0x14b93d][_0x190b('0x12')](queryCampaigns);}}else{return db[_0x190b('0x16')][_0x190b('0x12')]({'attributes':[_0x190b('0x17')],'where':{'sectionId':_0x41b788['id']},'raw':!![]})[_0x190b('0xb')](function(_0xab346){if(_0xab346){var _0x3e8781={'where':{'id':_[_0x190b('0x18')](_0xab346,_0x190b('0x17'))},'raw':!![]};switch(_0x14b93d){case _0x190b('0x5'):_0x3e8781['where'][_0x190b('0x19')]='telephone';break;case _0x190b('0x1a'):_0x3e8781[_0x190b('0x1b')][_0x190b('0x7')]=_0x190b('0x8');break;}return db[_0x14b93d]['findAll'](_0x3e8781);}else{return[];}});}}else{return[];}})[_0x190b('0xb')](function(_0x22d946){return _0x22d946;});}function joinOrLeaveQueues(_0x441a2b,_0x3c64d9,_0x1b5427,_0x177170){_0x441a2b[_0x3c64d9](util['format'](_0x190b('0x1c'),_0x1b5427,_0x177170[_0x190b('0x3')]));if(_0x177170['Agents']){for(var _0xb4c32b=0x0;_0xb4c32b<_0x177170['Agents']['length'];_0xb4c32b+=0x1){_0x441a2b[_0x3c64d9](util[_0x190b('0x1d')](_0x190b('0x1e'),_0x177170[_0x190b('0x4')][_0xb4c32b]['name']));}}}function joinOrLeave(_0x37465e,_0x2e633e,_0x16e989){var _0x292ce3;if(_0x37465e[_0x190b('0x1f')][_0x190b('0x20')]['id']){db[_0x190b('0x5')]['find']({'attributes':['id','name',_0x190b('0x19'),_0x190b('0x21')],'where':{'id':_0x37465e['handshake']['query']['id']},'include':[{'model':db[_0x190b('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x190b('0x23')],'as':_0x190b('0x24'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x190b('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x190b('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x190b('0x27')],'as':_0x190b('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x190b('0x29')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x3730cc){if(_0x3730cc){_0x292ce3=_0x3730cc;_0x37465e[_0x2e633e](util['format'](_0x190b('0x1e'),_0x3730cc[_0x190b('0x3')]));var _0x5b9cb6=[];switch(_0x3730cc[_0x190b('0x19')]){case'admin':_0x37465e[_0x2e633e](_0x190b('0x2a'));_0x37465e[_0x2e633e]('voice:outbound');if(queryQueues[_0x190b('0x2b')]('include')){delete queryQueues[_0x190b('0x2c')];}_0x5b9cb6[_0x190b('0x2d')](db['VoiceQueue'][_0x190b('0x12')](queryQueues));_0x5b9cb6[_0x190b('0x2d')](db[_0x190b('0x2e')][_0x190b('0x12')](queryQueues));_0x5b9cb6[_0x190b('0x2d')](db[_0x190b('0x2f')][_0x190b('0x12')](queryQueues));_0x5b9cb6[_0x190b('0x2d')](db['SmsQueue']['findAll'](queryQueues));_0x5b9cb6[_0x190b('0x2d')](db[_0x190b('0x30')]['findAll'](queryQueues));_0x5b9cb6[_0x190b('0x2d')](db[_0x190b('0x31')][_0x190b('0x12')](queryQueues));_0x5b9cb6[_0x190b('0x2d')](db[_0x190b('0x32')][_0x190b('0x12')](queryQueues));_0x5b9cb6[_0x190b('0x2d')](db['User']['findAll'](queryTelephones));_0x5b9cb6[_0x190b('0x2d')](db[_0x190b('0x33')][_0x190b('0x12')](queryTrunks));_0x5b9cb6['push'](db[_0x190b('0x1a')][_0x190b('0x12')](queryCampaigns));_0x5b9cb6[_0x190b('0x2d')](db['User'][_0x190b('0x12')](queryAgents));break;case'user':_0x37465e[_0x2e633e]('voice:inbound');_0x37465e[_0x2e633e](_0x190b('0x34'));_0x5b9cb6[_0x190b('0x2d')](getAssociatedResources('VoiceQueues',_0x3730cc[_0x190b('0x21')],_0x190b('0x35')));_0x5b9cb6[_0x190b('0x2d')](getAssociatedResources('ChatQueues',_0x3730cc[_0x190b('0x21')],_0x190b('0x2e')));_0x5b9cb6['push'](getAssociatedResources('FaxQueues',_0x3730cc[_0x190b('0x21')],'FaxQueue'));_0x5b9cb6[_0x190b('0x2d')](getAssociatedResources(_0x190b('0xf'),_0x3730cc[_0x190b('0x21')],_0x190b('0x36')));_0x5b9cb6['push'](getAssociatedResources(_0x190b('0x10'),_0x3730cc['userProfileId'],_0x190b('0x30')));_0x5b9cb6[_0x190b('0x2d')](getAssociatedResources('OpenchannelQueues',_0x3730cc[_0x190b('0x21')],_0x190b('0x31')));_0x5b9cb6[_0x190b('0x2d')](getAssociatedResources('WhatsappQueues',_0x3730cc[_0x190b('0x21')],'WhatsappQueue'));_0x5b9cb6['push'](getAssociatedResources('Telephones',_0x3730cc[_0x190b('0x21')],_0x190b('0x5')));_0x5b9cb6[_0x190b('0x2d')](getAssociatedResources(_0x190b('0x14'),_0x3730cc['userProfileId'],'Trunk'));_0x5b9cb6[_0x190b('0x2d')](getAssociatedResources('IvrCampaigns',_0x3730cc[_0x190b('0x21')],_0x190b('0x1a')));_0x5b9cb6['push'](db[_0x190b('0x5')][_0x190b('0x12')](queryAgents));break;case _0x190b('0x6'):_0x37465e[_0x2e633e]('voice:inbound');_0x37465e[_0x2e633e](_0x190b('0x34'));_0x5b9cb6[_0x190b('0x2d')](_0x3730cc['getVoiceQueues']({'attributes':['id',_0x190b('0x3')]}));_0x5b9cb6['push'](_0x3730cc[_0x190b('0x37')]({'attributes':['id',_0x190b('0x3')]}));_0x5b9cb6[_0x190b('0x2d')](_0x3730cc['getFaxQueues']({'attributes':['id',_0x190b('0x3')]}));_0x5b9cb6['push'](_0x3730cc[_0x190b('0x38')]({'attributes':['id',_0x190b('0x3')]}));_0x5b9cb6[_0x190b('0x2d')](_0x3730cc[_0x190b('0x39')]({'attributes':['id',_0x190b('0x3')]}));_0x5b9cb6[_0x190b('0x2d')](_0x3730cc[_0x190b('0x3a')]({'attributes':['id','name']}));_0x5b9cb6[_0x190b('0x2d')](_0x3730cc[_0x190b('0x3b')]({'attributes':['id',_0x190b('0x3')]}));break;}return BPromise['all'](_0x5b9cb6);}})[_0x190b('0xb')](function(_0x27314f){if(_0x27314f&&_0x27314f[_0x190b('0x3c')]){for(var _0x576660=0x0;_0x576660<_0x27314f[_0x190b('0x3c')];_0x576660+=0x1){for(var _0x5ec0e5=0x0;_0x5ec0e5<_0x27314f[_0x576660][_0x190b('0x3c')];_0x5ec0e5+=0x1){switch(_0x576660){case 0x0:joinOrLeaveQueues(_0x37465e,_0x2e633e,_0x190b('0x3d'),_0x27314f[_0x576660][_0x5ec0e5]);break;case 0x1:joinOrLeaveQueues(_0x37465e,_0x2e633e,_0x190b('0x3e'),_0x27314f[_0x576660][_0x5ec0e5]);break;case 0x2:joinOrLeaveQueues(_0x37465e,_0x2e633e,'fax',_0x27314f[_0x576660][_0x5ec0e5]);break;case 0x3:joinOrLeaveQueues(_0x37465e,_0x2e633e,_0x190b('0x3f'),_0x27314f[_0x576660][_0x5ec0e5]);break;case 0x4:joinOrLeaveQueues(_0x37465e,_0x2e633e,_0x190b('0x40'),_0x27314f[_0x576660][_0x5ec0e5]);break;case 0x5:joinOrLeaveQueues(_0x37465e,_0x2e633e,_0x190b('0x41'),_0x27314f[_0x576660][_0x5ec0e5]);break;case 0x6:joinOrLeaveQueues(_0x37465e,_0x2e633e,'whatsapp',_0x27314f[_0x576660][_0x5ec0e5]);break;case 0x7:if(_0x292ce3['role']!==_0x190b('0x6'))_0x37465e[_0x2e633e](util[_0x190b('0x1d')](_0x190b('0x42'),_0x27314f[_0x576660][_0x5ec0e5][_0x190b('0x3')]));break;case 0x8:if(_0x292ce3[_0x190b('0x19')]!==_0x190b('0x6'))_0x37465e[_0x2e633e](util['format'](_0x190b('0x43'),_0x27314f[_0x576660][_0x5ec0e5][_0x190b('0x3')]));break;case 0x9:if(_0x292ce3[_0x190b('0x19')]!=='agent')_0x37465e[_0x2e633e](util[_0x190b('0x1d')](_0x190b('0x44'),_0x27314f[_0x576660][_0x5ec0e5][_0x190b('0x7')],_0x27314f[_0x576660][_0x5ec0e5]['name']));break;case 0xa:_0x37465e[_0x2e633e](util[_0x190b('0x1d')](_0x190b('0x1e'),_0x27314f[_0x576660][_0x5ec0e5][_0x190b('0x3')]));break;}}}}})[_0x190b('0xb')](function(){if(_0x2e633e===_0x190b('0x45')){var _0x17b278=_[_0x190b('0x18')](_0x292ce3[_0x190b('0x46')],'id');return _0x292ce3[_0x190b('0x47')](_0x17b278)[_0x190b('0xb')](function(){for(var _0x279fd9=0x0;_0x279fd9<_0x17b278['length'];_0x279fd9+=0x1){_0x16e989[_0x190b('0x48')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x17b278[_0x279fd9]),'UserId':Number(_0x292ce3['id'])});}});}})[_0x190b('0xb')](function(){if(_0x2e633e===_0x190b('0x45')){var _0x4b2815=_[_0x190b('0x18')](_0x292ce3[_0x190b('0x24')],'id');return _0x292ce3[_0x190b('0x49')](_0x4b2815)[_0x190b('0xb')](function(){for(var _0x21b1c3=0x0;_0x21b1c3<_0x4b2815[_0x190b('0x3c')];_0x21b1c3+=0x1){_0x16e989[_0x190b('0x48')](_0x190b('0x4a'),{'MailInteractionId':Number(_0x4b2815[_0x21b1c3]),'UserId':Number(_0x292ce3['id'])});}});}})['then'](function(){if(_0x2e633e===_0x190b('0x45')){var _0x260adb=_[_0x190b('0x18')](_0x292ce3['FaxInteractions'],'id');return _0x292ce3[_0x190b('0x4b')](_0x260adb)['then'](function(){for(var _0x4a3db4=0x0;_0x4a3db4<_0x260adb[_0x190b('0x3c')];_0x4a3db4+=0x1){_0x16e989[_0x190b('0x48')](_0x190b('0x4c'),{'FaxInteractionId':Number(_0x260adb[_0x4a3db4]),'UserId':Number(_0x292ce3['id'])});}});}})[_0x190b('0xb')](function(){if(_0x2e633e===_0x190b('0x45')){var _0x20314b=_[_0x190b('0x18')](_0x292ce3[_0x190b('0x4d')],'id');return _0x292ce3[_0x190b('0x4e')](_0x20314b)[_0x190b('0xb')](function(){for(var _0x39a630=0x0;_0x39a630<_0x20314b[_0x190b('0x3c')];_0x39a630+=0x1){_0x16e989[_0x190b('0x48')](_0x190b('0x4f'),{'SmsInteractionId':Number(_0x20314b[_0x39a630]),'UserId':Number(_0x292ce3['id'])});}});}})['then'](function(){if(_0x2e633e===_0x190b('0x45')){var _0x2fa65a=_[_0x190b('0x18')](_0x292ce3[_0x190b('0x28')],'id');return _0x292ce3['removeOpenchannelInteractions'](_0x2fa65a)['then'](function(){for(var _0x487783=0x0;_0x487783<_0x2fa65a[_0x190b('0x3c')];_0x487783+=0x1){_0x16e989['emit'](_0x190b('0x50'),{'OpenchannelInteractionId':Number(_0x2fa65a[_0x487783]),'UserId':Number(_0x292ce3['id'])});}});}})['then'](function(){if(_0x2e633e===_0x190b('0x45')){var _0x1aae8e=_[_0x190b('0x18')](_0x292ce3['WhatsappInteractions'],'id');return _0x292ce3[_0x190b('0x51')](_0x1aae8e)[_0x190b('0xb')](function(){for(var _0xffe7cb=0x0;_0xffe7cb<_0x1aae8e[_0x190b('0x3c')];_0xffe7cb+=0x1){_0x16e989[_0x190b('0x48')](_0x190b('0x52'),{'WhatsappInteractionId':Number(_0x1aae8e[_0xffe7cb]),'UserId':Number(_0x292ce3['id'])});}});}})[_0x190b('0x53')](function(_0x12293e){_0x37465e[_0x190b('0x54')](_0x12293e);});}}function onDisconnect(_0x49a0f5,_0x4b44f7){joinOrLeave(_0x49a0f5,_0x190b('0x45'),_0x4b44f7);}function onConnect(_0x30b6ac){joinOrLeave(_0x30b6ac,_0x190b('0x55'));}exports[_0x190b('0x56')]=function(_0x4af037){_0x4af037['on'](_0x190b('0x57'),function(_0x43003f){_0x43003f['setMaxListeners'](0x0);_0x43003f[_0x190b('0x58')]=_0x43003f[_0x190b('0x59')][_0x190b('0x57')][_0x190b('0x5a')]+':'+_0x43003f[_0x190b('0x59')][_0x190b('0x57')][_0x190b('0x5b')];_0x43003f[_0x190b('0x5c')]=new Date();_0x43003f['log']=function(_0x14d1b8){console['log']('SocketIO\x20'+_0x43003f[_0x190b('0x5d')][_0x190b('0x3')]+'['+_0x43003f[_0x190b('0x58')]+']',_0x14d1b8);};_0x43003f['on']('disconnect',function(){onDisconnect(_0x43003f,_0x4af037);_0x43003f['log'](_0x190b('0x5e'));});onConnect(_0x43003f);_0x43003f[_0x190b('0x54')](_0x190b('0x5f'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 61d3ea2..673cfe8 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 _0xd9cf=['util','../../mysqldb','../logger','triggers','client','Chat','ChatInteraction','afterCreate','afterUpdate','closedinteraction','newmessage','ChatOfflineMessage','SmsInteraction','newinteraction','Sms','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','then','info','Trigger,\x20%s','error','code','catch','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','QueryTypes','SELECT','contact','UserId','interface','format','name','agent','channel','incomingmessage','outgoingmessage','offlineMessage','get','SIP/%s','AfterCreate','changed','closed','substatus','sequelize','Sequelize','AfterUpdate','find','fullname','default','length','hasOwnProperty','model','hook','toLowerCase','condition'];(function(_0x3cf701,_0xdf7c9d){var _0x4feeb1=function(_0x48c264){while(--_0x48c264){_0x3cf701['push'](_0x3cf701['shift']());}};_0x4feeb1(++_0xdf7c9d);}(_0xd9cf,0x1b0));var _0xfd9c=function(_0xbb3cd6,_0x541447){_0xbb3cd6=_0xbb3cd6-0x0;var _0x43d902=_0xd9cf[_0xbb3cd6];return _0x43d902;};'use strict';var util=require(_0xfd9c('0x0'));var db=require(_0xfd9c('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0xfd9c('0x2'))(_0xfd9c('0x3'));var client=jayson[_0xfd9c('0x4')]['http']({'port':0x232a});var triggers=[{'channel':_0xfd9c('0x5'),'model':_0xfd9c('0x6'),'event':_0xfd9c('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':'Chat','model':_0xfd9c('0x6'),'event':_0xfd9c('0x8'),'condition':_0xfd9c('0x9'),'callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':_0xfd9c('0x7'),'condition':_0xfd9c('0xa'),'callback':afterCreateMessage},{'channel':_0xfd9c('0x5'),'model':_0xfd9c('0xb'),'event':_0xfd9c('0x7'),'condition':_0xfd9c('0xa'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0xfd9c('0xc'),'event':_0xfd9c('0x7'),'condition':_0xfd9c('0xd'),'callback':afterCreate},{'channel':_0xfd9c('0xe'),'model':_0xfd9c('0xc'),'event':_0xfd9c('0x8'),'condition':_0xfd9c('0x9'),'callback':afterUpdate},{'channel':_0xfd9c('0xe'),'model':_0xfd9c('0xf'),'event':_0xfd9c('0x7'),'condition':_0xfd9c('0xa'),'callback':afterCreateMessage},{'channel':_0xfd9c('0x10'),'model':_0xfd9c('0x11'),'event':_0xfd9c('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':_0xfd9c('0x11'),'event':'afterUpdate','condition':_0xfd9c('0x9'),'callback':afterUpdate},{'channel':_0xfd9c('0x10'),'model':_0xfd9c('0x12'),'event':_0xfd9c('0x7'),'condition':_0xfd9c('0xa'),'callback':afterCreateMessage},{'channel':_0xfd9c('0x13'),'model':_0xfd9c('0x14'),'event':'afterCreate','condition':_0xfd9c('0xd'),'callback':afterCreate},{'channel':_0xfd9c('0x13'),'model':_0xfd9c('0x14'),'event':_0xfd9c('0x8'),'condition':_0xfd9c('0x9'),'callback':afterUpdate},{'channel':'Fax','model':_0xfd9c('0x15'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xfd9c('0x16'),'model':_0xfd9c('0x17'),'event':_0xfd9c('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xfd9c('0x16'),'model':_0xfd9c('0x17'),'event':_0xfd9c('0x8'),'condition':_0xfd9c('0x9'),'callback':afterUpdate},{'channel':_0xfd9c('0x16'),'model':'MailMessage','event':_0xfd9c('0x7'),'condition':_0xfd9c('0xa'),'callback':afterCreateMessage},{'channel':_0xfd9c('0x18'),'model':_0xfd9c('0x19'),'event':'afterCreate','condition':_0xfd9c('0xd'),'callback':afterCreate},{'channel':'Openchannel','model':_0xfd9c('0x19'),'event':'afterUpdate','condition':_0xfd9c('0x9'),'callback':afterUpdate},{'channel':_0xfd9c('0x18'),'model':_0xfd9c('0x1a'),'event':_0xfd9c('0x7'),'condition':_0xfd9c('0xa'),'callback':afterCreateMessage}];function request(_0x42487a){return client['request'](_0xfd9c('0x1b'),_0x42487a)[_0xfd9c('0x1c')](function(_0x1cb970){logger[_0xfd9c('0x1d')](_0xfd9c('0x1e'),_0xfd9c('0x1b'),_0x1cb970);if(_0x1cb970[_0xfd9c('0x1f')]){if(_0x1cb970[_0xfd9c('0x1f')][_0xfd9c('0x20')]===0x1f4){logger[_0xfd9c('0x1f')](_0xfd9c('0x1e'),_0xfd9c('0x1b'),_0x1cb970[_0xfd9c('0x1f')]);}}})[_0xfd9c('0x21')](function(_0x151bee){logger['error'](_0xfd9c('0x1e'),_0xfd9c('0x1b'),_0x151bee);});}function afterCreateMessage(_0x572c77){return function(_0xdcbd00){_0xdcbd00=_0xdcbd00['get']({'plain':!![]});_0xdcbd00['channel']=_0x572c77;_0xdcbd00[_0xfd9c('0x22')]=_0x572c77;_0xdcbd00[_0xfd9c('0x23')]=_0xdcbd00[_0xfd9c('0x24')];Promise[_0xfd9c('0x25')]()[_0xfd9c('0x1c')](function(){if(typeof _0xdcbd00[_0xfd9c('0x26')]===_0xfd9c('0x27'))return null;var _0x3bdcea=_0xfd9c('0x28')+_0xdcbd00['ContactId'];return db['sequelize'][_0xfd9c('0x29')](_0x3bdcea,{'type':db['Sequelize'][_0xfd9c('0x2a')][_0xfd9c('0x2b')],'raw':!![]});})[_0xfd9c('0x1c')](function(_0x206706){if(_0x206706){_0xdcbd00[_0xfd9c('0x2c')]=_0x206706[0x0];}if(typeof _0xdcbd00[_0xfd9c('0x2d')]===_0xfd9c('0x27'))return;return getAgent(_0xdcbd00['UserId']);})[_0xfd9c('0x1c')](function(_0x2fe64f){if(_0x2fe64f){_0xdcbd00[_0xfd9c('0x2e')]=util[_0xfd9c('0x2f')]('SIP/%s',_0x2fe64f[_0xfd9c('0x30')]);_0xdcbd00[_0xfd9c('0x31')]=_0x2fe64f;_0xdcbd00[_0xfd9c('0x32')]=_0x572c77;return request({'event':_0xfd9c('0x33'),'message':_0xdcbd00});}else{return request({'event':_0xfd9c('0x34'),'message':_0xdcbd00});}})['catch'](function(_0x1e6ce6){logger[_0xfd9c('0x1f')](_0xfd9c('0x1e'),'AfterCreateMessage',_0x1e6ce6);});};}function afterCreateOfflineMessage(_0x1fc37b){return function(_0x4a08bd){_0x4a08bd=_0x4a08bd['get']({'plain':!![]});_0x4a08bd['channel']=_0x1fc37b;_0x4a08bd[_0xfd9c('0x22')]=_0x1fc37b;_0x4a08bd['event']=_0xfd9c('0x35');return request({'event':_0x4a08bd['event'],'message':_0x4a08bd});};}function afterCreate(_0xf102cb,_0x11dbac){return function(_0x4f1e0d){_0x4f1e0d=_0x4f1e0d[_0xfd9c('0x36')]({'plain':!![]});_0x4f1e0d['channel']=_0xf102cb;_0x4f1e0d['motionChannel']=_0xf102cb;_0x4f1e0d[_0xfd9c('0x23')]='opened';Promise[_0xfd9c('0x25')]()[_0xfd9c('0x1c')](function(){var _0x98d8da=_0xfd9c('0x28')+_0x4f1e0d[_0xfd9c('0x26')];return db['sequelize'][_0xfd9c('0x29')](_0x98d8da,{'type':db['Sequelize'][_0xfd9c('0x2a')]['SELECT'],'raw':!![]});})[_0xfd9c('0x1c')](function(_0x143d77){if(_0x143d77){_0x4f1e0d[_0xfd9c('0x2c')]=_0x143d77[0x0];}if(typeof _0x4f1e0d[_0xfd9c('0x2d')]==='undefined')return;return getAgent(_0x4f1e0d['UserId']);})[_0xfd9c('0x1c')](function(_0x3c7206){if(_0x3c7206){_0x4f1e0d[_0xfd9c('0x2e')]=util[_0xfd9c('0x2f')](_0xfd9c('0x37'),_0x3c7206['name']);_0x4f1e0d[_0xfd9c('0x31')]=_0x3c7206;}return request({'event':_0x11dbac,'message':_0x4f1e0d});})[_0xfd9c('0x21')](function(_0x5f1f63){logger[_0xfd9c('0x1f')](_0xfd9c('0x1e'),_0xfd9c('0x38'),_0x5f1f63);});};}function afterUpdate(_0x7bc8e3){return function(_0x8b809){var _0x38054=_0x8b809[_0xfd9c('0x39')]('closed')&&_0x8b809[_0xfd9c('0x3a')];var _0x502237=_0x8b809[_0xfd9c('0x39')](_0xfd9c('0x3b'));if(_0x38054||_0x502237){var _0x303146=_0x38054?'closedinteraction':_0xfd9c('0x3b');var _0x331e4a=_0x8b809[_0xfd9c('0x36')]({'plain':!![]});_0x331e4a['channel']=_0x7bc8e3;_0x331e4a[_0xfd9c('0x22')]=_0x7bc8e3;_0x331e4a[_0xfd9c('0x23')]=_0x38054?_0xfd9c('0x3a'):_0xfd9c('0x3b');var _0x25f297=_0xfd9c('0x28')+_0x331e4a[_0xfd9c('0x26')];return db[_0xfd9c('0x3c')]['query'](_0x25f297,{'type':db[_0xfd9c('0x3d')][_0xfd9c('0x2a')]['SELECT'],'raw':!![]})['then'](function(_0x44966c){if(_0x44966c){_0x331e4a[_0xfd9c('0x2c')]=_0x44966c[0x0];}if(typeof _0x331e4a[_0xfd9c('0x2d')]===_0xfd9c('0x27'))return;return getAgent(_0x331e4a[_0xfd9c('0x2d')]);})[_0xfd9c('0x1c')](function(_0x4f8fd4){if(_0x4f8fd4){_0x331e4a[_0xfd9c('0x2e')]=util[_0xfd9c('0x2f')](_0xfd9c('0x37'),_0x4f8fd4['name']);_0x331e4a[_0xfd9c('0x31')]=_0x4f8fd4;}return request({'event':_0x303146,'message':_0x331e4a});})[_0xfd9c('0x21')](function(_0x1d3076){logger[_0xfd9c('0x1f')]('Trigger,\x20%s',_0xfd9c('0x3e'),_0x1d3076);});}};}function getAgent(_0x508429){return db['User'][_0xfd9c('0x3f')]({'where':{'id':_0x508429},'attributes':['id','name',_0xfd9c('0x40'),'email','internal'],'raw':!![]})[_0xfd9c('0x1c')](function(_0x5692e8){return _0x5692e8;});}exports[_0xfd9c('0x41')]=function(){for(var _0x2898ea=0x0;_0x2898ea=_0x6f8bbc[_0xa66c('0x14')]){throw Error(_0xa66c('0x15'));}_0x112c36(_0x3ff237);})[_0xa66c('0x16')](function(_0x34431c){_0x12ac92(_0x34431c);});});}; \ No newline at end of file +var _0xaefa=['lodash','mail','chat','fax','whatsapp','openchannel','getChannels','isValidChannel','includes','isUndefined','updateAttributes','getLicense','agent','User','then','agents','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x48cd5f,_0xe0e885){var _0x51204d=function(_0x915a91){while(--_0x915a91){_0x48cd5f['push'](_0x48cd5f['shift']());}};_0x51204d(++_0xe0e885);}(_0xaefa,0x121));var _0xaaef=function(_0x57bf42,_0x13eb7d){_0x57bf42=_0x57bf42-0x0;var _0x4cd488=_0xaefa[_0x57bf42];return _0x4cd488;};'use strict';var _=require(_0xaaef('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=['voice',_0xaaef('0x1'),_0xaaef('0x2'),_0xaaef('0x3'),'sms',_0xaaef('0x4'),_0xaaef('0x5')];exports[_0xaaef('0x6')]=function(){return channels;};exports[_0xaaef('0x7')]=function(_0x14d549){_0x14d549=_0x14d549['toLowerCase']();return _[_0xaaef('0x8')](channels,_0x14d549);};exports['clearBlockUser']=function(_0x41f70c,_0x46b80b,_0x5cdaf6,_0xd7e140){var _0x237e68={'loginAttempts':_0x46b80b,'blocked':_0x5cdaf6};if(!_[_0xaaef('0x9')](_0xd7e140)){_0x237e68['blockedAt']=_0xd7e140;}return _0x41f70c[_0xaaef('0xa')](_0x237e68);};exports[_0xaaef('0xb')]=function(_0x2980c3){return new BPromise(function(_0x38fd2b,_0x2686ed){var _0x13ada3=0x0;if(_0x2980c3['role']!==_0xaaef('0xc')){_0x38fd2b(_0x2980c3);}db[_0xaaef('0xd')]['count']({'where':{'role':_0xaaef('0xc'),'online':!![],'id':{'$ne':_0x2980c3['id']}}})[_0xaaef('0xe')](function(_0x375ea2){_0x13ada3=_0x375ea2;return util['getLicense']();})[_0xaaef('0xe')](function(_0x2c20e1){if(_0x2c20e1&&_0x2c20e1[_0xaaef('0xf')]&&_0x13ada3>=_0x2c20e1[_0xaaef('0xf')]){throw Error(_0xaaef('0x10'));}_0x38fd2b(_0x2980c3);})['catch'](function(_0x597388){_0x2686ed(_0x597388);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index fe1c14d..3ffb026 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','stack'];(function(_0x1c8e95,_0x2cca4a){var _0x4e1e2d=function(_0x2d3901){while(--_0x2d3901){_0x1c8e95['push'](_0x1c8e95['shift']());}};_0x4e1e2d(++_0x2cca4a);}(_0x814b,0x1a2));var _0xb814=function(_0x493503,_0x351993){_0x493503=_0x493503-0x0;var _0x1986d0=_0x814b[_0x493503];return _0x1986d0;};'use strict';var util=require(_0xb814('0x0'));var logger=require(_0xb814('0x1'))(_0xb814('0x2'));var APIError=function(_0x2f4ece,_0xfbb64b){this[_0xb814('0x3')]=_0x2f4ece||'Internal\x20Server\x20Error';this[_0xb814('0x4')]=_0xfbb64b||_0xb814('0x5');util[_0xb814('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4237bc){this[_0xb814('0x3')]=_0x4237bc||_0xb814('0x7');this['name']=_0xb814('0x7');util[_0xb814('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5c8539){this[_0xb814('0x3')]=_0x5c8539||_0xb814('0x8');this[_0xb814('0x4')]=_0xb814('0x9');util[_0xb814('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x21d4a5){this[_0xb814('0x3')]=_0x21d4a5||_0xb814('0xa');this[_0xb814('0x4')]=_0xb814('0xb');util[_0xb814('0x6')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x4b5f14){switch(_0x4b5f14){case _0xb814('0x7'):return 0x190;case'Forbidden',_0xb814('0xb'):return 0x193;case _0xb814('0x9'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x35b10d){if(_0x35b10d===_0xb814('0xb'))return _0x35b10d;return null;}function handleError(_0x2ce718){return function(_0x3bde14){logger[_0xb814('0xc')](_0x3bde14[_0xb814('0xd')]);var _0xa0a2e5=getStatusCode(_0x3bde14[_0xb814('0x4')]);var _0x3f4881=getCustomStatusMessage(_0x3bde14[_0xb814('0x4')]);if(_0x3bde14[_0xb814('0x4')])delete _0x3bde14[_0xb814('0x4')];if(_0x3f4881)_0x2ce718[_0xb814('0xe')]=_0x3f4881;return _0x2ce718[_0xb814('0xf')](_0xa0a2e5)[_0xb814('0x10')](_0x3bde14);};}module[_0xb814('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x7a54=['Bad\x20Request','Forbidden','Out\x20Of\x20Interval','Not\x20Found','error','stack','statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Entity\x20not\x20found'];(function(_0x1c2527,_0x1ac1b6){var _0x56c1ae=function(_0x28f9ff){while(--_0x28f9ff){_0x1c2527['push'](_0x1c2527['shift']());}};_0x56c1ae(++_0x1ac1b6);}(_0x7a54,0x106));var _0x47a5=function(_0x5b8ca3,_0x22c495){_0x5b8ca3=_0x5b8ca3-0x0;var _0x1636b3=_0x7a54[_0x5b8ca3];return _0x1636b3;};'use strict';var util=require(_0x47a5('0x0'));var logger=require(_0x47a5('0x1'))(_0x47a5('0x2'));var APIError=function(_0x58157c,_0x1d33e){this[_0x47a5('0x3')]=_0x58157c||'Internal\x20Server\x20Error';this[_0x47a5('0x4')]=_0x1d33e||_0x47a5('0x5');util[_0x47a5('0x6')](APIError,Error);};var APIBadRequestError=function(_0x3717e1){this[_0x47a5('0x3')]=_0x3717e1||'Bad\x20Request';this[_0x47a5('0x4')]='Bad\x20Request';util[_0x47a5('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x30e405){this['message']=_0x30e405||_0x47a5('0x7');this['name']='Not\x20Found';util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2a0e98){this[_0x47a5('0x3')]=_0x2a0e98||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x47a5('0x4')]='Out\x20Of\x20Interval';util['inherits'](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1f47f4){switch(_0x1f47f4){case _0x47a5('0x8'):return 0x190;case _0x47a5('0x9'),_0x47a5('0xa'):return 0x193;case _0x47a5('0xb'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0xd308b8){if(_0xd308b8===_0x47a5('0xa'))return _0xd308b8;return null;}function handleError(_0x5beb89){return function(_0x44bd3e){logger[_0x47a5('0xc')](_0x44bd3e[_0x47a5('0xd')]);var _0x711793=getStatusCode(_0x44bd3e[_0x47a5('0x4')]);var _0x620ee9=getCustomStatusMessage(_0x44bd3e[_0x47a5('0x4')]);if(_0x44bd3e[_0x47a5('0x4')])delete _0x44bd3e['name'];if(_0x620ee9)_0x5beb89[_0x47a5('0xe')]=_0x620ee9;return _0x5beb89[_0x47a5('0xf')](_0x711793)[_0x47a5('0x10')](_0x44bd3e);};}module[_0x47a5('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 9354334..7f5947e 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2884=['404','status','send','exports'];(function(_0x5e92fe,_0x4bcbba){var _0x5acbfa=function(_0x1facd5){while(--_0x1facd5){_0x5e92fe['push'](_0x5e92fe['shift']());}};_0x5acbfa(++_0x4bcbba);}(_0x2884,0x1eb));var _0x4288=function(_0x44e00a,_0x248bbc){_0x44e00a=_0x44e00a-0x0;var _0x2bdfba=_0x2884[_0x44e00a];return _0x2bdfba;};'use strict';module[_0x4288('0x0')][0x194]=function pageNotFound(_0x5d24c9,_0x456d02){var _0x311198=_0x4288('0x1');var _0x495f38=0x194;var _0x2a7195={'status':_0x495f38};_0x456d02[_0x4288('0x2')](_0x2a7195['status']);_0x456d02['render'](_0x311198,{},function(_0x1ac6e7,_0x250772){if(_0x1ac6e7){return _0x456d02[_0x4288('0x2')](_0x2a7195['status'])['json'](_0x2a7195);}_0x456d02[_0x4288('0x3')](_0x250772);});}; \ No newline at end of file +var _0x4d05=['status','render','json','send','exports','404'];(function(_0x1a5ce0,_0x1efb2f){var _0x5ef5ee=function(_0x47d127){while(--_0x47d127){_0x1a5ce0['push'](_0x1a5ce0['shift']());}};_0x5ef5ee(++_0x1efb2f);}(_0x4d05,0xee));var _0x54d0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4d05[_0x501510];return _0x1e6ee5;};'use strict';module[_0x54d0('0x0')][0x194]=function pageNotFound(_0xe53464,_0x3dd265){var _0x2492b8=_0x54d0('0x1');var _0x1b25ec=0x194;var _0x2d939b={'status':_0x1b25ec};_0x3dd265[_0x54d0('0x2')](_0x2d939b[_0x54d0('0x2')]);_0x3dd265[_0x54d0('0x3')](_0x2492b8,{},function(_0x313626,_0x476854){if(_0x313626){return _0x3dd265[_0x54d0('0x2')](_0x2d939b['status'])[_0x54d0('0x4')](_0x2d939b);}_0x3dd265[_0x54d0('0x5')](_0x476854);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index f319f13..c5bfb86 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../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','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','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','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','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','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x3ff685,_0x304b9e){var _0x2046c9=function(_0x7a10e9){while(--_0x7a10e9){_0x3ff685['push'](_0x3ff685['shift']());}};_0x2046c9(++_0x304b9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../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','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','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','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','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','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 18036e1..ecc789a 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0b5=['/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/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/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/authLocal','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','root','/apidoc','static','join','/www','/demo','/snippet','snippet','3.5.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/mohs','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','./api/faxApplication','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./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/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','./api/chatProactiveAction','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/disposition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/voiceQueuesLog'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd0b5,0x1b8));var _0x5d0b=function(_0x61bcd8,_0x5e7b64){_0x61bcd8=_0x61bcd8-0x0;var _0x2f793b=_0xd0b5[_0x61bcd8];return _0x2f793b;};'use strict';var path=require('path');var express=require('express');var errors=require(_0x5d0b('0x0'));var config=require(_0x5d0b('0x1'));var setupLoggers=require('./utils/client-side-logger')[_0x5d0b('0x2')];var clientSideLogs=require(_0x5d0b('0x3'));exports[_0x5d0b('0x4')]=function(_0xb4d787){return setupLoggers(_0xb4d787)[_0x5d0b('0x5')](function(){_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x7'),require(_0x5d0b('0x8')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x9'),require(_0x5d0b('0xa')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xb'),require('./api/voiceContext'));_0xb4d787[_0x5d0b('0x6')]('/api/voice/extensions',require('./api/voiceExtension'));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xc'),require('./api/voiceMusicOnHold'));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xd'),require('./api/voiceQueue'));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xe'),require(_0x5d0b('0xf')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x10'),require(_0x5d0b('0x11')));_0xb4d787['use'](_0x5d0b('0x12'),require(_0x5d0b('0x13')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x14'),require('./api/voiceMailMessage'));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x15'),require('./api/voiceCallReport'));_0xb4d787[_0x5d0b('0x6')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x16'),require(_0x5d0b('0x17')));_0xb4d787[_0x5d0b('0x6')]('/api/voice/queues/reports',require(_0x5d0b('0x18')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x19'),require(_0x5d0b('0x1a')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x1b'),require(_0x5d0b('0x1c')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x1d'),require(_0x5d0b('0x1e')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x1f'),require(_0x5d0b('0x20')));_0xb4d787['use']('/api/mail/accounts',require(_0x5d0b('0x21')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x22'),require(_0x5d0b('0x23')));_0xb4d787[_0x5d0b('0x6')]('/api/mail/substatuses',require(_0x5d0b('0x24')));_0xb4d787[_0x5d0b('0x6')]('/api/mail/interactions',require(_0x5d0b('0x25')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x26'),require(_0x5d0b('0x27')));_0xb4d787[_0x5d0b('0x6')]('/api/mail/applications',require(_0x5d0b('0x28')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x29'),require(_0x5d0b('0x2a')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x2b'),require(_0x5d0b('0x2c')));_0xb4d787['use'](_0x5d0b('0x2d'),require('./api/dashboardItem'));_0xb4d787['use'](_0x5d0b('0x2e'),require(_0x5d0b('0x2f')));_0xb4d787[_0x5d0b('0x6')]('/api/fax/applications',require(_0x5d0b('0x30')));_0xb4d787[_0x5d0b('0x6')]('/api/fax/interactions',require(_0x5d0b('0x31')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x32'),require('./api/faxMessage'));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x33'),require(_0x5d0b('0x34')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x35'),require(_0x5d0b('0x36')));_0xb4d787['use'](_0x5d0b('0x37'),require(_0x5d0b('0x38')));_0xb4d787['use'](_0x5d0b('0x39'),require(_0x5d0b('0x3a')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x3b'),require(_0x5d0b('0x3c')));_0xb4d787[_0x5d0b('0x6')]('/api/sms/messages',require(_0x5d0b('0x3d')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x3e'),require('./api/smsQueue'));_0xb4d787['use'](_0x5d0b('0x3f'),require(_0x5d0b('0x40')));_0xb4d787['use'](_0x5d0b('0x41'),require(_0x5d0b('0x42')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x43'),require(_0x5d0b('0x44')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x45'),require(_0x5d0b('0x46')));_0xb4d787['use'](_0x5d0b('0x47'),require('./api/openchannelQueue'));_0xb4d787['use']('/api/chat/websites',require('./api/chatWebsite'));_0xb4d787['use'](_0x5d0b('0x48'),require(_0x5d0b('0x49')));_0xb4d787['use'](_0x5d0b('0x4a'),require(_0x5d0b('0x4b')));_0xb4d787[_0x5d0b('0x6')]('/api/chat/interactions',require(_0x5d0b('0x4c')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x4d'),require(_0x5d0b('0x4e')));_0xb4d787['use'](_0x5d0b('0x4f'),require(_0x5d0b('0x50')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x51'),require(_0x5d0b('0x52')));_0xb4d787[_0x5d0b('0x6')]('/api/chat/groups',require(_0x5d0b('0x53')));_0xb4d787['use']('/api/chat/proactive_actions',require(_0x5d0b('0x54')));_0xb4d787['use']('/api/cm/companies',require('./api/cmCompany'));_0xb4d787[_0x5d0b('0x6')]('/api/cm/contacts',require('./api/cmContact'));_0xb4d787['use'](_0x5d0b('0x55'),require(_0x5d0b('0x56')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x57'),require(_0x5d0b('0x58')));_0xb4d787['use']('/api/cm/hopper_final',require(_0x5d0b('0x59')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x5a'),require(_0x5d0b('0x5b')));_0xb4d787[_0x5d0b('0x6')]('/api/cm/custom_fields',require(_0x5d0b('0x5c')));_0xb4d787['use'](_0x5d0b('0x5d'),require(_0x5d0b('0x5e')));_0xb4d787['use'](_0x5d0b('0x5f'),require('./api/automation'));_0xb4d787['use'](_0x5d0b('0x60'),require('./api/cannedAnswer'));_0xb4d787[_0x5d0b('0x6')]('/api/dispositions',require(_0x5d0b('0x61')));_0xb4d787['use']('/api/conditions',require('./api/condition'));_0xb4d787['use'](_0x5d0b('0x62'),require(_0x5d0b('0x63')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x64'),require(_0x5d0b('0x65')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x66'),require('./api/cdr'));_0xb4d787[_0x5d0b('0x6')]('/api/voiceQueuesLog',require(_0x5d0b('0x67')));_0xb4d787[_0x5d0b('0x6')]('/api/schedules',require('./api/schedule'));_0xb4d787['use'](_0x5d0b('0x68'),require(_0x5d0b('0x69')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x6a'),require(_0x5d0b('0x6b')));_0xb4d787['use'](_0x5d0b('0x6c'),require(_0x5d0b('0x6d')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x6e'),require(_0x5d0b('0x6f')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x70'),require(_0x5d0b('0x71')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x72'),require(_0x5d0b('0x73')));_0xb4d787[_0x5d0b('0x6')]('/api/triggers',require(_0x5d0b('0x74')));_0xb4d787[_0x5d0b('0x6')]('/api/variables',require(_0x5d0b('0x75')));_0xb4d787['use'](_0x5d0b('0x76'),require('./api/integration'));_0xb4d787['use'](_0x5d0b('0x77'),require(_0x5d0b('0x78')));_0xb4d787[_0x5d0b('0x6')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x79'),require('./api/analyticDefaultReport'));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x7a'),require(_0x5d0b('0x7b')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x7c'),require(_0x5d0b('0x7d')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x7e'),require(_0x5d0b('0x7f')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x80'),require(_0x5d0b('0x81')));_0xb4d787['use'](_0x5d0b('0x82'),require(_0x5d0b('0x83')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x84'),require(_0x5d0b('0x85')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x86'),require(_0x5d0b('0x87')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x88'),require(_0x5d0b('0x89')));_0xb4d787['use'](_0x5d0b('0x8a'),require(_0x5d0b('0x8b')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x8c'),require(_0x5d0b('0x8d')));_0xb4d787['use'](_0x5d0b('0x8e'),require(_0x5d0b('0x8f')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x90'),require(_0x5d0b('0x91')));_0xb4d787[_0x5d0b('0x6')]('/api/integrations/desk/fields',require(_0x5d0b('0x92')));_0xb4d787[_0x5d0b('0x6')]('/api/integrations/zoho/accounts',require(_0x5d0b('0x93')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x94'),require(_0x5d0b('0x95')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x96'),require(_0x5d0b('0x97')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x98'),require(_0x5d0b('0x99')));_0xb4d787['use']('/api/integrations/zendesk/configurations',require(_0x5d0b('0x9a')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x9b'),require(_0x5d0b('0x9c')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x9d'),require('./api/intFreshdeskAccount'));_0xb4d787['use'](_0x5d0b('0x9e'),require(_0x5d0b('0x9f')));_0xb4d787[_0x5d0b('0x6')]('/api/integrations/freshdesk/fields',require(_0x5d0b('0xa0')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xa1'),require(_0x5d0b('0xa2')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xa3'),require('./api/intVtigerConfiguration'));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xa4'),require(_0x5d0b('0xa5')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xa6'),require(_0x5d0b('0xa7')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xa8'),require(_0x5d0b('0xa9')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xaa'),require('./api/intServicenowField'));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xab'),require(_0x5d0b('0xac')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xad'),require(_0x5d0b('0xae')));_0xb4d787['use']('/api/integrations/dynamics365/fields',require(_0x5d0b('0xaf')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xb0'),require(_0x5d0b('0xb1')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xb2'),require('./api/intFreshsalesConfiguration'));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xb3'),require('./api/intFreshsalesField'));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xb4'),require('./api/network'));_0xb4d787['use'](_0x5d0b('0xb5'),require(_0x5d0b('0xb6')));_0xb4d787['use'](_0x5d0b('0xb7'),require('./api/chatInternalMessage'));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xb8'),require(_0x5d0b('0xb9')));_0xb4d787[_0x5d0b('0x6')]('/api/jscripty/questions/reports',require(_0x5d0b('0xba')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xbb'),require(_0x5d0b('0xbc')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xbd'),require(_0x5d0b('0xbe')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xbf'),require(_0x5d0b('0xc0')));_0xb4d787['use']('/api/square/details/reports',require(_0x5d0b('0xc1')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xc2'),require(_0x5d0b('0xc3')));_0xb4d787['use'](_0x5d0b('0xc4'),require(_0x5d0b('0xc5')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xc6'),require('./api/squareOdbc'));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xc7'),require(_0x5d0b('0xc8')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xc9'),require(_0x5d0b('0xca')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xcb'),require(_0x5d0b('0xcc')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xcd'),require('./api/team'));_0xb4d787['use'](_0x5d0b('0xce'),require(_0x5d0b('0xcf')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xd0'),require(_0x5d0b('0xd1')));_0xb4d787['use']('/api/migrations',require('./api/migration'));_0xb4d787[_0x5d0b('0x6')]('/api/attachments',require(_0x5d0b('0xd2')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xd3'),require('./api/plugin'));_0xb4d787['use'](_0x5d0b('0xd4'),require('./api/mailTransferReport'));_0xb4d787[_0x5d0b('0x6')]('/api/chat/reports/transfer',require(_0x5d0b('0xd5')));_0xb4d787['use'](_0x5d0b('0xd6'),require(_0x5d0b('0xd7')));_0xb4d787['use']('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xd8'),require(_0x5d0b('0xd9')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xda'),require(_0x5d0b('0xdb')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xdc'),require(_0x5d0b('0xdd')));_0xb4d787['use']('/api/userProfiles',require(_0x5d0b('0xde')));_0xb4d787[_0x5d0b('0x6')]('/api/userProfile/sections',require(_0x5d0b('0xdf')));_0xb4d787['use']('/api/userProfile/resources',require(_0x5d0b('0xe0')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xe1'),require('./api/userNotification'));_0xb4d787[_0x5d0b('0x6')]('/api/whatsapp/accounts',require(_0x5d0b('0xe2')));_0xb4d787[_0x5d0b('0x6')]('/api/whatsapp/applications',require(_0x5d0b('0xe3')));_0xb4d787[_0x5d0b('0x6')]('/api/whatsapp/interactions',require(_0x5d0b('0xe4')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xe5'),require(_0x5d0b('0xe6')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xe7'),require(_0x5d0b('0xe8')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xe9'),require(_0x5d0b('0xea')));_0xb4d787['use']('/api/whatsapp/queues',require(_0x5d0b('0xeb')));_0xb4d787['use'](_0x5d0b('0xec'),require(_0x5d0b('0xed')));_0xb4d787['use'](_0x5d0b('0xee'),require('./api/realtime'));_0xb4d787['use']('/api/user-settings',require('./api/user-setting'));_0xb4d787[_0x5d0b('0x6')]('/api/auth/local',require(_0x5d0b('0xef')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xf0'),require(_0x5d0b('0xf1')));_0xb4d787[_0x5d0b('0x6')]('/api/auth/activedirectory',require(_0x5d0b('0xf2')));_0xb4d787[_0x5d0b('0x6')]('/api/jira',require(_0x5d0b('0xf3')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xf4'),require(_0x5d0b('0xf5')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xf6'),require(_0x5d0b('0xf7')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xf8'),require(_0x5d0b('0xf9')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xfa'),require(_0x5d0b('0xfb')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xfc'),require(_0x5d0b('0xfd')));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0xfe'),clientSideLogs);_0xb4d787['use']('/apidoc',express['static'](path['join'](config[_0x5d0b('0xff')],_0x5d0b('0x100'))));_0xb4d787[_0x5d0b('0x6')]('/www',express[_0x5d0b('0x101')](path[_0x5d0b('0x102')](config[_0x5d0b('0xff')],_0x5d0b('0x103'))));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x104'),express[_0x5d0b('0x101')](path['join'](config[_0x5d0b('0xff')],_0x5d0b('0x104'))));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x105'),express[_0x5d0b('0x101')](path['join'](config[_0x5d0b('0xff')],_0x5d0b('0x106'),_0x5d0b('0x107'))));_0xb4d787[_0x5d0b('0x6')](_0x5d0b('0x108'),express[_0x5d0b('0x101')](path[_0x5d0b('0x102')](config[_0x5d0b('0xff')],_0x5d0b('0x109'))));_0xb4d787[_0x5d0b('0x10a')](_0x5d0b('0x10b'))['get'](errors[0x194]);_0xb4d787[_0x5d0b('0x10a')]('/*')[_0x5d0b('0x10c')](function(_0xb82ff5,_0x514438){_0x514438['sendFile'](path[_0x5d0b('0x10d')](_0xb4d787[_0x5d0b('0x10c')](_0x5d0b('0x10e'))+_0x5d0b('0x10f')));});return _0xb4d787;});}; \ No newline at end of file +var _0x0434=['/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','./api/team','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userNotifications','./api/userNotification','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','join','/apidoc','/www','static','/demo','root','/snippet','snippet','/plugins','/server/files/plugins','route','get','resolve','path','express','./errors','./config/environment','./utils/client-side-logger','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/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/mailInteraction','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/fax/accounts','./api/faxAccount','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/openchannelAccount','/api/openchannel/applications','/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/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x0434,0x1ad));var _0x4043=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x0434[_0x548627];return _0x844a84;};'use strict';var path=require(_0x4043('0x0'));var express=require(_0x4043('0x1'));var errors=require(_0x4043('0x2'));var config=require(_0x4043('0x3'));var setupLoggers=require(_0x4043('0x4'))['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports[_0x4043('0x5')]=function(_0xfa9ae8){return setupLoggers(_0xfa9ae8)[_0x4043('0x6')](function(){_0xfa9ae8[_0x4043('0x7')](_0x4043('0x8'),require(_0x4043('0x9')));_0xfa9ae8['use'](_0x4043('0xa'),require(_0x4043('0xb')));_0xfa9ae8['use']('/api/voice/contexts',require(_0x4043('0xc')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xd'),require(_0x4043('0xe')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xf'),require(_0x4043('0x10')));_0xfa9ae8[_0x4043('0x7')]('/api/voice/queues',require(_0x4043('0x11')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x12'),require(_0x4043('0x13')));_0xfa9ae8[_0x4043('0x7')]('/api/screen/recordings',require(_0x4043('0x14')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x15'),require(_0x4043('0x16')));_0xfa9ae8[_0x4043('0x7')]('/api/voice/mails/messages',require(_0x4043('0x17')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x18'),require(_0x4043('0x19')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x1a'),require(_0x4043('0x1b')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x1c'),require(_0x4043('0x1d')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x1e'),require('./api/voiceQueueReport'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x1f'),require(_0x4043('0x20')));_0xfa9ae8['use'](_0x4043('0x21'),require(_0x4043('0x22')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x23'),require(_0x4043('0x24')));_0xfa9ae8['use'](_0x4043('0x25'),require('./api/mailServerOut'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x26'),require(_0x4043('0x27')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x28'),require(_0x4043('0x29')));_0xfa9ae8['use'](_0x4043('0x2a'),require(_0x4043('0x2b')));_0xfa9ae8['use']('/api/mail/interactions',require(_0x4043('0x2c')));_0xfa9ae8['use']('/api/mail/messages',require(_0x4043('0x2d')));_0xfa9ae8[_0x4043('0x7')]('/api/mail/applications',require(_0x4043('0x2e')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x2f'),require(_0x4043('0x30')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x31'),require(_0x4043('0x32')));_0xfa9ae8[_0x4043('0x7')]('/api/dashboards/items',require('./api/dashboardItem'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x33'),require(_0x4043('0x34')));_0xfa9ae8['use']('/api/fax/applications',require(_0x4043('0x35')));_0xfa9ae8[_0x4043('0x7')]('/api/fax/interactions',require(_0x4043('0x36')));_0xfa9ae8[_0x4043('0x7')]('/api/fax/messages',require(_0x4043('0x37')));_0xfa9ae8['use'](_0x4043('0x38'),require(_0x4043('0x39')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x3a'),require(_0x4043('0x3b')));_0xfa9ae8[_0x4043('0x7')]('/api/sms/accounts',require(_0x4043('0x3c')));_0xfa9ae8[_0x4043('0x7')]('/api/sms/applications',require(_0x4043('0x3d')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x3e'),require(_0x4043('0x3f')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x40'),require(_0x4043('0x41')));_0xfa9ae8[_0x4043('0x7')]('/api/sms/queues',require('./api/smsQueue'));_0xfa9ae8['use']('/api/openchannel/accounts',require(_0x4043('0x42')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x43'),require('./api/openchannelApplication'));_0xfa9ae8[_0x4043('0x7')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0xfa9ae8['use'](_0x4043('0x44'),require(_0x4043('0x45')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x46'),require(_0x4043('0x47')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x48'),require(_0x4043('0x49')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x4a'),require(_0x4043('0x4b')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x4c'),require('./api/chatApplication'));_0xfa9ae8['use'](_0x4043('0x4d'),require(_0x4043('0x4e')));_0xfa9ae8[_0x4043('0x7')]('/api/chat/messages',require(_0x4043('0x4f')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x50'),require(_0x4043('0x51')));_0xfa9ae8[_0x4043('0x7')]('/api/chat/queues',require(_0x4043('0x52')));_0xfa9ae8['use']('/api/chat/groups',require(_0x4043('0x53')));_0xfa9ae8['use'](_0x4043('0x54'),require(_0x4043('0x55')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x56'),require(_0x4043('0x57')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x58'),require('./api/cmContact'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x59'),require('./api/cmHopper'));_0xfa9ae8[_0x4043('0x7')]('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0xfa9ae8[_0x4043('0x7')]('/api/cm/hopper_final',require(_0x4043('0x5a')));_0xfa9ae8['use']('/api/cm/hopper_history',require(_0x4043('0x5b')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x5c'),require(_0x4043('0x5d')));_0xfa9ae8[_0x4043('0x7')]('/api/actions',require(_0x4043('0x5e')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x5f'),require(_0x4043('0x60')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x61'),require(_0x4043('0x62')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x63'),require(_0x4043('0x64')));_0xfa9ae8['use'](_0x4043('0x65'),require(_0x4043('0x66')));_0xfa9ae8['use'](_0x4043('0x67'),require(_0x4043('0x68')));_0xfa9ae8['use']('/api/pauses',require('./api/pause'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x69'),require(_0x4043('0x6a')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x6b'),require(_0x4043('0x6c')));_0xfa9ae8[_0x4043('0x7')]('/api/schedules',require(_0x4043('0x6d')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x6e'),require(_0x4043('0x6f')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x70'),require('./api/tag'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x71'),require(_0x4043('0x72')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x73'),require('./api/cmContactHasItem'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x74'),require(_0x4043('0x75')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x76'),require('./api/template'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x77'),require(_0x4043('0x78')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x79'),require(_0x4043('0x7a')));_0xfa9ae8[_0x4043('0x7')]('/api/integrations',require(_0x4043('0x7b')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x7c'),require('./api/integrationReport'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x7d'),require('./api/analyticCustomReport'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x7e'),require(_0x4043('0x7f')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x80'),require(_0x4043('0x81')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x82'),require(_0x4043('0x83')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x84'),require(_0x4043('0x85')));_0xfa9ae8['use']('/api/analytics/tree_reports',require(_0x4043('0x86')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x87'),require(_0x4043('0x88')));_0xfa9ae8['use'](_0x4043('0x89'),require(_0x4043('0x8a')));_0xfa9ae8[_0x4043('0x7')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0xfa9ae8[_0x4043('0x7')]('/api/integrations/sugarcrm/accounts',require(_0x4043('0x8b')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x8c'),require(_0x4043('0x8d')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x8e'),require(_0x4043('0x8f')));_0xfa9ae8[_0x4043('0x7')]('/api/integrations/desk/accounts',require(_0x4043('0x90')));_0xfa9ae8['use'](_0x4043('0x91'),require(_0x4043('0x92')));_0xfa9ae8['use']('/api/integrations/desk/fields',require('./api/intDeskField'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x93'),require('./api/intZohoAccount'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x94'),require(_0x4043('0x95')));_0xfa9ae8['use'](_0x4043('0x96'),require(_0x4043('0x97')));_0xfa9ae8[_0x4043('0x7')]('/api/integrations/zendesk/accounts',require(_0x4043('0x98')));_0xfa9ae8['use'](_0x4043('0x99'),require(_0x4043('0x9a')));_0xfa9ae8[_0x4043('0x7')]('/api/integrations/zendesk/fields',require(_0x4043('0x9b')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x9c'),require('./api/intFreshdeskAccount'));_0xfa9ae8['use'](_0x4043('0x9d'),require(_0x4043('0x9e')));_0xfa9ae8['use'](_0x4043('0x9f'),require(_0x4043('0xa0')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xa1'),require(_0x4043('0xa2')));_0xfa9ae8[_0x4043('0x7')]('/api/integrations/vtiger/configurations',require(_0x4043('0xa3')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xa4'),require(_0x4043('0xa5')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xa6'),require(_0x4043('0xa7')));_0xfa9ae8[_0x4043('0x7')]('/api/integrations/servicenow/configurations',require(_0x4043('0xa8')));_0xfa9ae8['use']('/api/integrations/servicenow/fields',require(_0x4043('0xa9')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xaa'),require(_0x4043('0xab')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xac'),require('./api/intDynamics365Configuration'));_0xfa9ae8['use'](_0x4043('0xad'),require('./api/intDynamics365Field'));_0xfa9ae8['use'](_0x4043('0xae'),require(_0x4043('0xaf')));_0xfa9ae8['use']('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0xfa9ae8['use'](_0x4043('0xb0'),require('./api/intFreshsalesField'));_0xfa9ae8['use'](_0x4043('0xb1'),require('./api/network'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xb2'),require(_0x4043('0xb3')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xb4'),require('./api/chatInternalMessage'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xb5'),require('./api/jscriptyAnswerReport'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xb6'),require(_0x4043('0xb7')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xb8'),require(_0x4043('0xb9')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xba'),require('./api/smsQueueReport'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xbb'),require(_0x4043('0xbc')));_0xfa9ae8[_0x4043('0x7')]('/api/square/details/reports',require(_0x4043('0xbd')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xbe'),require(_0x4043('0xbf')));_0xfa9ae8['use'](_0x4043('0xc0'),require(_0x4043('0xc1')));_0xfa9ae8[_0x4043('0x7')]('/api/square/odbc',require(_0x4043('0xc2')));_0xfa9ae8[_0x4043('0x7')]('/api/square/projects',require(_0x4043('0xc3')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xc4'),require('./api/squareRecording'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xc5'),require(_0x4043('0xc6')));_0xfa9ae8[_0x4043('0x7')]('/api/teams',require(_0x4043('0xc7')));_0xfa9ae8[_0x4043('0x7')]('/api/license',require(_0x4043('0xc8')));_0xfa9ae8[_0x4043('0x7')]('/api/campaigns',require(_0x4043('0xc9')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xca'),require(_0x4043('0xcb')));_0xfa9ae8['use'](_0x4043('0xcc'),require(_0x4043('0xcd')));_0xfa9ae8[_0x4043('0x7')]('/api/plugins',require('./api/plugin'));_0xfa9ae8['use'](_0x4043('0xce'),require(_0x4043('0xcf')));_0xfa9ae8[_0x4043('0x7')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xd0'),require(_0x4043('0xd1')));_0xfa9ae8['use'](_0x4043('0xd2'),require(_0x4043('0xd3')));_0xfa9ae8['use'](_0x4043('0xd4'),require(_0x4043('0xd5')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xd6'),require('./api/cmList'));_0xfa9ae8[_0x4043('0x7')]('/api/voice/prefixes',require('./api/voicePrefix'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xd7'),require(_0x4043('0xd8')));_0xfa9ae8['use'](_0x4043('0xd9'),require(_0x4043('0xda')));_0xfa9ae8[_0x4043('0x7')]('/api/userProfile/resources',require('./api/userProfileResource'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xdb'),require(_0x4043('0xdc')));_0xfa9ae8[_0x4043('0x7')]('/api/whatsapp/accounts',require(_0x4043('0xdd')));_0xfa9ae8[_0x4043('0x7')]('/api/whatsapp/applications',require(_0x4043('0xde')));_0xfa9ae8[_0x4043('0x7')]('/api/whatsapp/interactions',require(_0x4043('0xdf')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xe0'),require(_0x4043('0xe1')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xe2'),require(_0x4043('0xe3')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xe4'),require('./api/whatsappTransferReport'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xe5'),require(_0x4043('0xe6')));_0xfa9ae8[_0x4043('0x7')]('/api/cloudProviders',require('./api/cloudProvider'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xe7'),require(_0x4043('0xe8')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xe9'),require(_0x4043('0xea')));_0xfa9ae8['use'](_0x4043('0xeb'),require('./api/authLocal'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xec'),require(_0x4043('0xed')));_0xfa9ae8['use'](_0x4043('0xee'),require('./api/authActiveDirectory'));_0xfa9ae8[_0x4043('0x7')]('/api/jira',require('./api/jira'));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xef'),require(_0x4043('0xf0')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xf1'),require(_0x4043('0xf2')));_0xfa9ae8['use']('/api/system',require(_0x4043('0xf3')));_0xfa9ae8['use'](_0x4043('0xf4'),require(_0x4043('0xf5')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xf6'),require(_0x4043('0xf7')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xf8'),clientSideLogs);_0xfa9ae8[_0x4043('0x7')]('/apidoc',express['static'](path[_0x4043('0xf9')](config['root'],_0x4043('0xfa'))));_0xfa9ae8['use'](_0x4043('0xfb'),express[_0x4043('0xfc')](path['join'](config['root'],_0x4043('0xfb'))));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xfd'),express[_0x4043('0xfc')](path[_0x4043('0xf9')](config[_0x4043('0xfe')],_0x4043('0xfd'))));_0xfa9ae8[_0x4043('0x7')](_0x4043('0xff'),express[_0x4043('0xfc')](path[_0x4043('0xf9')](config[_0x4043('0xfe')],_0x4043('0x100'),'3.5.0')));_0xfa9ae8[_0x4043('0x7')](_0x4043('0x101'),express[_0x4043('0xfc')](path[_0x4043('0xf9')](config[_0x4043('0xfe')],_0x4043('0x102'))));_0xfa9ae8[_0x4043('0x103')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x4043('0x104')](errors[0x194]);_0xfa9ae8[_0x4043('0x103')]('/*')['get'](function(_0x4e3420,_0x750938){_0x750938['sendFile'](path[_0x4043('0x105')](_0xfa9ae8[_0x4043('0x104')]('appPath')+'/index.html'));});return _0xfa9ae8;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 19721d9..3b038bc 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f4d=['../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.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/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','log','../config/triggers','RPC\x20listening\x20on\x20','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc'];(function(_0x29239b,_0xa4307d){var _0x4d06c1=function(_0x155fdf){while(--_0x155fdf){_0x29239b['push'](_0x29239b['shift']());}};_0x4d06c1(++_0xa4307d);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x178815,_0x2496af){_0x178815=_0x178815-0x0;var _0x13e7bc=_0x0f4d[_0x178815];return _0x13e7bc;};'use strict';var jayson=require('jayson/promise');var _=require('lodash');var config=require('../config/environment');exports[_0xd0f4('0x0')]=function(){return new Promise(function(_0x5c8510,_0x20e395){var _0x2c06de={};_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x2')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x3')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x4')));_0x2c06de=_['merge'](_0x2c06de,require(_0xd0f4('0x5')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x6')));_0x2c06de=_['merge'](_0x2c06de,require(_0xd0f4('0x7')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x8')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require('../api/trunk/trunk.rpc'));_0x2c06de=_['merge'](_0x2c06de,require(_0xd0f4('0x9')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0xa')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0xb')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0xc')));_0x2c06de=_['merge'](_0x2c06de,require(_0xd0f4('0xd')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require('../api/mailInteraction/mailInteraction.rpc'));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require('../api/mailMessage/mailMessage.rpc'));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require('../api/mailApplication/mailApplication.rpc'));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x2c06de=_['merge'](_0x2c06de,require('../api/faxAccount/faxAccount.rpc'));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0xe')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0xf')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x10')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x11')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x12')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x13')));_0x2c06de=_['merge'](_0x2c06de,require(_0xd0f4('0x14')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x15')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x16')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x17')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x18')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x19')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x1a')));_0x2c06de=_['merge'](_0x2c06de,require(_0xd0f4('0x1b')));_0x2c06de=_['merge'](_0x2c06de,require(_0xd0f4('0x1c')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x1d')));_0x2c06de=_['merge'](_0x2c06de,require(_0xd0f4('0x1e')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x1f')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x20')));_0x2c06de=_['merge'](_0x2c06de,require(_0xd0f4('0x21')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x22')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x23')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x24')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x25')));_0x2c06de=_['merge'](_0x2c06de,require(_0xd0f4('0x26')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x27')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require('../api/variable/variable.rpc'));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2c06de=_['merge'](_0x2c06de,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x28')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x29')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x2a')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x2b')));_0x2c06de=_['merge'](_0x2c06de,require(_0xd0f4('0x2c')));_0x2c06de=_['merge'](_0x2c06de,require(_0xd0f4('0x2d')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x2c06de=_['merge'](_0x2c06de,require(_0xd0f4('0x2e')));_0x2c06de=_['merge'](_0x2c06de,require(_0xd0f4('0x2f')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x30')));_0x2c06de=_['merge'](_0x2c06de,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x31')));_0x2c06de=_['merge'](_0x2c06de,require(_0xd0f4('0x32')));_0x2c06de=_['merge'](_0x2c06de,require(_0xd0f4('0x33')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require('../api/squareRecording/squareRecording.rpc'));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x34')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x35')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require('../api/attachment/attachment.rpc'));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x36')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x37')));_0x2c06de=_['merge'](_0x2c06de,require(_0xd0f4('0x38')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x39')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require(_0xd0f4('0x3a')));_0x2c06de=_[_0xd0f4('0x1')](_0x2c06de,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x269629=jayson[_0xd0f4('0x3b')](_0x2c06de)[_0xd0f4('0x3c')]();var _0x4c9926=config[_0xd0f4('0x3d')][_0xd0f4('0x3e')]||config['port']+0x1;var _0xeda633=config[_0xd0f4('0x3d')]['ip']||'localhost';_0x269629['on']('error',function(_0x3bb4ab){return _0x20e395(_0x3bb4ab);});_0x269629[_0xd0f4('0x0')](_0x4c9926,_0xeda633,function(){console[_0xd0f4('0x3f')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0xeda633,_0x4c9926);require(_0xd0f4('0x40'))['default']();return _0x5c8510(_0xd0f4('0x41')+_0xeda633+':'+_0x4c9926);});});}; \ No newline at end of file +var _0xf7c7=['../api/trigger/trigger.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/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.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/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','log','../config/triggers','default','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../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/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'];(function(_0x4044d2,_0x3492e0){var _0x488e63=function(_0x85d4f0){while(--_0x85d4f0){_0x4044d2['push'](_0x4044d2['shift']());}};_0x488e63(++_0x3492e0);}(_0xf7c7,0x1d3));var _0x7f7c=function(_0x3d5420,_0x3b60b0){_0x3d5420=_0x3d5420-0x0;var _0x955bb3=_0xf7c7[_0x3d5420];return _0x955bb3;};'use strict';var jayson=require(_0x7f7c('0x0'));var _=require(_0x7f7c('0x1'));var config=require(_0x7f7c('0x2'));exports[_0x7f7c('0x3')]=function(){return new Promise(function(_0x13b2e0,_0x4391e1){var _0x36e969={};_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x5')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x6')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require('../api/voiceQueue/voiceQueue.rpc'));_0x36e969=_['merge'](_0x36e969,require('../api/voiceRecording/voiceRecording.rpc'));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0x7')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x8')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x9')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0xa')));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0xb')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0xc')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0xd')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0xe')));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0xf')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x10')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x11')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x12')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x13')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x14')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x15')));_0x36e969=_['merge'](_0x36e969,require('../api/faxAccount/faxAccount.rpc'));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x16')));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0x17')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require('../api/faxMessage/faxMessage.rpc'));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x18')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0x19')));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0x1a')));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0x1b')));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0x1c')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x1d')));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0x1e')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x1f')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x20')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x21')));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0x22')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x23')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x24')));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0x25')));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0x26')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x27')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x28')));_0x36e969=_['merge'](_0x36e969,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require('../api/interval/interval.rpc'));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x29')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x2a')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x2b')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require('../api/template/template.rpc'));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x2c')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require('../api/variable/variable.rpc'));_0x36e969=_['merge'](_0x36e969,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x2d')));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0x2e')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x2f')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x30')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x31')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x32')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x33')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x34')));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0x35')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x36')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require('../api/setting/setting.rpc'));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x37')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x38')));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0x39')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x3a')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x3b')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x3c')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require('../api/plugin/plugin.rpc'));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0x3d')));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0x3e')));_0x36e969=_['merge'](_0x36e969,require(_0x7f7c('0x3f')));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x36e969=_[_0x7f7c('0x4')](_0x36e969,require(_0x7f7c('0x40')));var _0x25ac9c=jayson[_0x7f7c('0x41')](_0x36e969)[_0x7f7c('0x42')]();var _0xfbaa6c=config[_0x7f7c('0x43')][_0x7f7c('0x44')]||config[_0x7f7c('0x44')]+0x1;var _0x5f070a=config['rpc']['ip']||_0x7f7c('0x45');_0x25ac9c['on']('error',function(_0x5a5cd0){return _0x4391e1(_0x5a5cd0);});_0x25ac9c[_0x7f7c('0x3')](_0xfbaa6c,_0x5f070a,function(){console[_0x7f7c('0x46')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x5f070a,_0xfbaa6c);require(_0x7f7c('0x47'))[_0x7f7c('0x48')]();return _0x13b2e0('RPC\x20listening\x20on\x20'+_0x5f070a+':'+_0xfbaa6c);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index b98f193..83bf2e1 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 _0xad5f=['match','error','close','timeout','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','noop','getVariable','wav','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','no\x20code','replace','result=','indexOf','substr','startsWith','split','length'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xad5f,0x1a8));var _0xfad5=function(_0x48ccc1,_0x55e9cb){_0x48ccc1=_0x48ccc1-0x0;var _0x9ffe13=_0xad5f[_0x48ccc1];return _0x9ffe13;};'use strict';var util=require(_0xfad5('0x0'));var _=require(_0xfad5('0x1'));var EventEmitter=require(_0xfad5('0x2'))[_0xfad5('0x3')];var AGIReply=require(_0xfad5('0x4'));var AGIError=require(_0xfad5('0x5'));function AGIChannel(_0x4fcbea){var _0xcc61b1=this,_0x316561=new AGIReply(),_0x1ae06d=![],_0x2da73e={};EventEmitter[_0xfad5('0x6')](_0xcc61b1);_0x4fcbea[_0xfad5('0x7')](_0xfad5('0x8'));_0x4fcbea['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x316561[_0xfad5('0x7')](_0xfad5('0x8'));_0x316561['on'](_0xfad5('0x9'),function(_0xbe8f56){for(var _0x535cb5 in _0xbe8f56){_0xcc61b1[_0x535cb5]=_0xbe8f56[_0x535cb5];}_0xcc61b1[_0xfad5('0xa')](_0xfad5('0xb'));});_0x316561['on'](_0xfad5('0xc'),function(_0x84b640){if(_0x84b640[_0xfad5('0xd')]()==_0xfad5('0xe')){_0xcc61b1[_0xfad5('0xa')]('hangup');return;}if(_0x84b640[_0xfad5('0xf')](0x0,0xb)==_0xfad5('0x10')){_0x1ae06d=!![];}if(_0x1ae06d){_0x2da73e['rx']+=_0x84b640+'\x0a';if(_0x84b640[_0xfad5('0x11')]('520\x20End\x20of\x20proper')!=-0x1){_0x1ae06d=![];}}else{_0x2da73e['rx']=_0x84b640;}if(_0x1ae06d){return;}if(typeof _0x2da73e['cb']=='function'){var _0x28ac32=_0x2da73e['rx'][_0xfad5('0xf')](0x0,0x3),_0x665534=null,_0xb1a9f6=null;_0x28ac32=parseInt(_0x28ac32);if(isNaN(_0x28ac32)){_0x2da73e['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xfad5('0x12')});return;}if(_0x28ac32!=0xc8){_0x2da73e['cb'](null,{'code':_0x28ac32,'result':-0x1,'extra':'KO'});return;}_0x665534=_0x2da73e['rx']['substring'](0x4)[_0xfad5('0x13')](_0xfad5('0x14'),'');if(_0x665534[_0xfad5('0x15')]('\x20')!=-0x1){_0x665534=_0x665534[_0xfad5('0x16')](0x0,_0x665534[_0xfad5('0x15')]('\x20'));}if(_[_0xfad5('0x17')](_0x665534,'-1')){_0x665534=parseInt(_0x665534);}_0xb1a9f6=_0x2da73e['rx'][_0xfad5('0x18')]('\x20');if(_0xb1a9f6['length']==0x3){_0xb1a9f6=_0xb1a9f6[0x2]['substring'](0x1,_0xb1a9f6[0x2][_0xfad5('0x19')]-0x1);}else if(_0xb1a9f6[_0xfad5('0x19')]>0x3){var _0x311e75=/\((.+)\)/;var _0xe94444=_0x2da73e['rx'][_0xfad5('0x1a')](_0x311e75);if(_0xe94444){_0xb1a9f6=_0xe94444[0x1];}else{_0xb1a9f6=null;}}else{_0xb1a9f6=null;}_0x2da73e['cb'](null,{'code':_0x28ac32,'result':_0x665534,'extra':_0xb1a9f6});}});_0x4fcbea['on'](_0xfad5('0x1b'),function(_0x10ae77){_0xcc61b1[_0xfad5('0xa')](_0xfad5('0x1b'),new AGIError('E_AGI_SOCKET_ERROR',_0x10ae77['code']));});_0x4fcbea['on'](_0xfad5('0x1c'),function(){_0xcc61b1[_0xfad5('0xa')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x4fcbea['on'](_0xfad5('0x1d'),function(){_0xcc61b1[_0xfad5('0xa')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4fcbea[_0xfad5('0x1e')]();});_0x4fcbea[_0xfad5('0x1f')](_0x316561);this[_0xfad5('0x20')]=function(_0x102b20,_0x46f4e7){var _0x102b20=_0x102b20||'',_0x46f4e7=typeof _0x46f4e7=='function'?_0x46f4e7:new Function();_0x2da73e={'tx':_0x102b20,'rx':'','cb':_0x46f4e7};_0x4fcbea[_0xfad5('0x21')](_0x102b20+'\x0a');},this[_0xfad5('0x1c')]=function(){_0x4fcbea[_0xfad5('0x1e')]();};}util[_0xfad5('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xfad5('0x23')][_0xfad5('0x24')]=function(_0x178894){return this[_0xfad5('0x20')][_0xfad5('0x25')](this,_0x178894);};AGIChannel[_0xfad5('0x23')][_0xfad5('0x26')]=function(){return this['sendRequest'](_0xfad5('0x27'));};AGIChannel[_0xfad5('0x23')][_0xfad5('0x28')]=function(_0xc772e6,_0x66b172,_0x59e2f4){_0xc772e6=_0xc772e6===undefined?_0xfad5('0x29'):_0xc772e6;_0x66b172=_0x66b172===undefined?'5':_0x66b172;_0x59e2f4=_0x59e2f4===undefined?'1':_0x59e2f4;return this[_0xfad5('0x24')](util[_0xfad5('0x2a')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0xc772e6,_0x66b172*0x3e8,_0x59e2f4));};AGIChannel[_0xfad5('0x23')]['noop']=function(_0x24fe92){_0x24fe92=_0x24fe92||_0xfad5('0x2b');return this[_0xfad5('0x24')](util['format'](_0xfad5('0x2c'),_0x24fe92));};AGIChannel['prototype']['exec']=function(_0x4c0e11,_0x3fa9b6){if(_[_0xfad5('0x2d')](_0x3fa9b6)){return this[_0xfad5('0x24')](util[_0xfad5('0x2a')](_0xfad5('0x2e'),_0x4c0e11,_0x3fa9b6[_0xfad5('0x2f')](',')));}return this[_0xfad5('0x24')](util[_0xfad5('0x2a')](_0xfad5('0x2e'),_0x4c0e11,_0x3fa9b6));};AGIChannel[_0xfad5('0x23')]['setContext']=function(_0x2c01ef){return this[_0xfad5('0x24')](util[_0xfad5('0x2a')]('SET\x20CONTEXT\x20%s',_0x2c01ef));};AGIChannel[_0xfad5('0x23')][_0xfad5('0x30')]=function(_0x3d014f){return this[_0xfad5('0x24')](util['format'](_0xfad5('0x31'),_0x3d014f));};AGIChannel[_0xfad5('0x23')][_0xfad5('0x32')]=function(_0x44703b){return this[_0xfad5('0x24')](util['format'](_0xfad5('0x33'),_0x44703b));};AGIChannel[_0xfad5('0x23')][_0xfad5('0xe')]=function(){return this['sendRequest'](_0xfad5('0x34'));};AGIChannel[_0xfad5('0x23')]['setVariable']=function(_0x57f3ae,_0x334b10){var _0x362e2=_[_0xfad5('0x35')](_0x334b10)||_[_0xfad5('0x36')](_0x334b10)?_0x334b10[_0xfad5('0x37')]():_0x334b10;return this[_0xfad5('0x24')](util[_0xfad5('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x57f3ae,_0x362e2?_0x362e2[_0xfad5('0x37')]()[_0xfad5('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xfad5('0x23')][_0xfad5('0x38')]=function(_0x22f008,_0x5eb58b){return this[_0xfad5('0x24')](util[_0xfad5('0x2a')]('SAY\x20NUMBER\x20%s\x20%s',_0x22f008,_0x5eb58b));};AGIChannel[_0xfad5('0x23')][_0xfad5('0x39')]=function(_0x474bc6,_0x59d4e4){return this['sendRequest'](util[_0xfad5('0x2a')](_0xfad5('0x3a'),_0x474bc6,_0x59d4e4));};AGIChannel[_0xfad5('0x23')][_0xfad5('0x3b')]=function(_0x3daddf,_0x3e0bf8){return this[_0xfad5('0x24')](util[_0xfad5('0x2a')](_0xfad5('0x3c'),_0x3daddf,_0x3e0bf8));};AGIChannel[_0xfad5('0x23')][_0xfad5('0x3d')]=function(_0x103b8e,_0x47630a,_0x3038e0){_0x47630a=_0x47630a||this[_0xfad5('0x3e')];_0x3038e0=_0x3038e0||0x1;this[_0xfad5('0x3f')](_0x103b8e);this[_0xfad5('0x30')](_0x47630a);this[_0xfad5('0x32')](_0x3038e0);return this[_0xfad5('0x40')](util[_0xfad5('0x2a')]('GOTO\x20%s\x20%s\x20%s',_0x103b8e,_0x47630a,_0x3038e0));};AGIChannel[_0xfad5('0x23')][_0xfad5('0x41')]=function(_0x598028){return this[_0xfad5('0x24')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x598028));};AGIChannel[_0xfad5('0x23')]['recordFile']=function(_0x170809,_0x59d34f,_0x209087,_0x474458,_0x589b05,_0x3b9a27){_0x59d34f=_0x59d34f||_0xfad5('0x42');_0x209087=_0x209087||'';_0x474458=_0x474458===undefined?-0x1:_0x474458==='-1'?-0x1:_0x474458*0x3e8;_0x589b05=_0x589b05===undefined?'':'s='+_0x589b05;_0x3b9a27=_0x3b9a27?'BEEP':'';return this['sendRequest'](util[_0xfad5('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x170809,_0x59d34f,_0x209087,_0x474458,_0x3b9a27,_0x589b05));};AGIChannel['prototype'][_0xfad5('0x43')]=function(_0x528b00,_0x2b882a){_0x2b882a=_0x2b882a||'';return this[_0xfad5('0x24')](util[_0xfad5('0x2a')](_0xfad5('0x44'),_0x528b00,_0x2b882a));};AGIChannel[_0xfad5('0x23')]['agi']=function(_0x43fa48){return this[_0xfad5('0x45')](_0xfad5('0x46'),_0x43fa48);};AGIChannel['prototype'][_0xfad5('0x47')]=function(_0x21e7a2){return this['exec'](_0xfad5('0x48'),_0x21e7a2);};AGIChannel[_0xfad5('0x23')]['error']=function(_0x51b87a,_0x48ec83){this[_0xfad5('0x40')](util[_0xfad5('0x2a')](_0xfad5('0x49'),_0x51b87a['id'],_0x51b87a[_0xfad5('0x4a')],_0x48ec83));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x405f=['indexOf','substr','startsWith','length','match','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','pipe','function','write','destroy','inherits','prototype','sendRequest','command','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','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','error','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','ready','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','result='];(function(_0x5e9efd,_0x4945ce){var _0x1bf6ac=function(_0x5d02a9){while(--_0x5d02a9){_0x5e9efd['push'](_0x5e9efd['shift']());}};_0x1bf6ac(++_0x4945ce);}(_0x405f,0x1d8));var _0xf405=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x405f[_0x1a36a5];return _0x746243;};'use strict';var util=require('util');var _=require(_0xf405('0x0'));var EventEmitter=require(_0xf405('0x1'))[_0xf405('0x2')];var AGIReply=require(_0xf405('0x3'));var AGIError=require(_0xf405('0x4'));function AGIChannel(_0xcb090a){var _0xad927a=this,_0x87010a=new AGIReply(),_0x39d9d4=![],_0x3b702f={};EventEmitter[_0xf405('0x5')](_0xad927a);_0xcb090a[_0xf405('0x6')](_0xf405('0x7'));_0xcb090a[_0xf405('0x8')](0x8*0x3c*0x3c*0x3e8);_0x87010a[_0xf405('0x6')](_0xf405('0x7'));_0x87010a['on'](_0xf405('0x9'),function(_0x218a4a){for(var _0x175d4e in _0x218a4a){_0xad927a[_0x175d4e]=_0x218a4a[_0x175d4e];}_0xad927a['emit'](_0xf405('0xa'));});_0x87010a['on']('line',function(_0x3afed5){if(_0x3afed5[_0xf405('0xb')]()==_0xf405('0xc')){_0xad927a[_0xf405('0xd')]('hangup');return;}if(_0x3afed5[_0xf405('0xe')](0x0,0xb)==_0xf405('0xf')){_0x39d9d4=!![];}if(_0x39d9d4){_0x3b702f['rx']+=_0x3afed5+'\x0a';if(_0x3afed5[_0xf405('0x10')](_0xf405('0x11'))!=-0x1){_0x39d9d4=![];}}else{_0x3b702f['rx']=_0x3afed5;}if(_0x39d9d4){return;}if(typeof _0x3b702f['cb']=='function'){var _0x40629d=_0x3b702f['rx'][_0xf405('0xe')](0x0,0x3),_0x55d236=null,_0x212a9d=null;_0x40629d=parseInt(_0x40629d);if(isNaN(_0x40629d)){_0x3b702f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xf405('0x12')});return;}if(_0x40629d!=0xc8){_0x3b702f['cb'](null,{'code':_0x40629d,'result':-0x1,'extra':'KO'});return;}_0x55d236=_0x3b702f['rx'][_0xf405('0xe')](0x4)['replace'](_0xf405('0x13'),'');if(_0x55d236[_0xf405('0x14')]('\x20')!=-0x1){_0x55d236=_0x55d236[_0xf405('0x15')](0x0,_0x55d236['indexOf']('\x20'));}if(_[_0xf405('0x16')](_0x55d236,'-1')){_0x55d236=parseInt(_0x55d236);}_0x212a9d=_0x3b702f['rx']['split']('\x20');if(_0x212a9d[_0xf405('0x17')]==0x3){_0x212a9d=_0x212a9d[0x2][_0xf405('0xe')](0x1,_0x212a9d[0x2][_0xf405('0x17')]-0x1);}else if(_0x212a9d[_0xf405('0x17')]>0x3){var _0x1a5c5a=/\((.+)\)/;var _0x1bf3c1=_0x3b702f['rx'][_0xf405('0x18')](_0x1a5c5a);if(_0x1bf3c1){_0x212a9d=_0x1bf3c1[0x1];}else{_0x212a9d=null;}}else{_0x212a9d=null;}_0x3b702f['cb'](null,{'code':_0x40629d,'result':_0x55d236,'extra':_0x212a9d});}});_0xcb090a['on']('error',function(_0x23434d){_0xad927a['emit']('error',new AGIError(_0xf405('0x19'),_0x23434d[_0xf405('0x1a')]));});_0xcb090a['on'](_0xf405('0x1b'),function(){_0xad927a[_0xf405('0xd')](_0xf405('0x1b'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0xcb090a['on'](_0xf405('0x1c'),function(){_0xad927a[_0xf405('0xd')](_0xf405('0x1c'),new AGIError(_0xf405('0x1d')));_0xcb090a['destroy']();});_0xcb090a[_0xf405('0x1e')](_0x87010a);this['command']=function(_0x5bafe,_0x2336b0){var _0x5bafe=_0x5bafe||'',_0x2336b0=typeof _0x2336b0==_0xf405('0x1f')?_0x2336b0:new Function();_0x3b702f={'tx':_0x5bafe,'rx':'','cb':_0x2336b0};_0xcb090a[_0xf405('0x20')](_0x5bafe+'\x0a');},this['close']=function(){_0xcb090a[_0xf405('0x21')]();};}util[_0xf405('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xf405('0x23')][_0xf405('0x24')]=function(_0x2d3609){return this[_0xf405('0x25')][_0xf405('0x26')](this,_0x2d3609);};AGIChannel['prototype'][_0xf405('0x27')]=function(){return this['sendRequest'](_0xf405('0x28'));};AGIChannel[_0xf405('0x23')][_0xf405('0x29')]=function(_0x3141d6,_0x39782e,_0xd66417){_0x3141d6=_0x3141d6===undefined?_0xf405('0x2a'):_0x3141d6;_0x39782e=_0x39782e===undefined?'5':_0x39782e;_0xd66417=_0xd66417===undefined?'1':_0xd66417;return this[_0xf405('0x24')](util[_0xf405('0x2b')](_0xf405('0x2c'),_0x3141d6,_0x39782e*0x3e8,_0xd66417));};AGIChannel['prototype'][_0xf405('0x2d')]=function(_0x3121e6){_0x3121e6=_0x3121e6||_0xf405('0x2e');return this[_0xf405('0x24')](util[_0xf405('0x2b')](_0xf405('0x2f'),_0x3121e6));};AGIChannel[_0xf405('0x23')][_0xf405('0x30')]=function(_0x1252af,_0x24cf15){if(_[_0xf405('0x31')](_0x24cf15)){return this[_0xf405('0x24')](util[_0xf405('0x2b')](_0xf405('0x32'),_0x1252af,_0x24cf15[_0xf405('0x33')](',')));}return this[_0xf405('0x24')](util[_0xf405('0x2b')]('EXEC\x20%s\x20%s',_0x1252af,_0x24cf15));};AGIChannel[_0xf405('0x23')][_0xf405('0x34')]=function(_0x1348e9){return this['sendRequest'](util['format']('SET\x20CONTEXT\x20%s',_0x1348e9));};AGIChannel[_0xf405('0x23')][_0xf405('0x35')]=function(_0x42a037){return this[_0xf405('0x24')](util[_0xf405('0x2b')](_0xf405('0x36'),_0x42a037));};AGIChannel['prototype'][_0xf405('0x37')]=function(_0x4ce9ff){return this[_0xf405('0x24')](util[_0xf405('0x2b')](_0xf405('0x38'),_0x4ce9ff));};AGIChannel['prototype']['hangup']=function(){return this[_0xf405('0x24')](_0xf405('0x39'));};AGIChannel['prototype']['setVariable']=function(_0xc252da,_0x5aedc3){var _0x1e11f1=_[_0xf405('0x3a')](_0x5aedc3)||_[_0xf405('0x3b')](_0x5aedc3)?_0x5aedc3[_0xf405('0x3c')]():_0x5aedc3;return this[_0xf405('0x24')](util[_0xf405('0x2b')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xc252da,_0x1e11f1?_0x1e11f1['toString']()[_0xf405('0x3d')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xf405('0x23')][_0xf405('0x3e')]=function(_0x20ca19,_0x152ec6){return this[_0xf405('0x24')](util[_0xf405('0x2b')](_0xf405('0x3f'),_0x20ca19,_0x152ec6));};AGIChannel[_0xf405('0x23')][_0xf405('0x40')]=function(_0x21cd25,_0x3f6a23){return this[_0xf405('0x24')](util[_0xf405('0x2b')](_0xf405('0x41'),_0x21cd25,_0x3f6a23));};AGIChannel[_0xf405('0x23')]['sayPhonetic']=function(_0x3ed88d,_0x2e7ef1){return this['sendRequest'](util['format'](_0xf405('0x42'),_0x3ed88d,_0x2e7ef1));};AGIChannel[_0xf405('0x23')]['continueAt']=function(_0x1c303c,_0x4fad52,_0x3236d9){_0x4fad52=_0x4fad52||this[_0xf405('0x43')];_0x3236d9=_0x3236d9||0x1;this[_0xf405('0x34')](_0x1c303c);this[_0xf405('0x35')](_0x4fad52);this[_0xf405('0x37')](_0x3236d9);return this[_0xf405('0x2d')](util[_0xf405('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x1c303c,_0x4fad52,_0x3236d9));};AGIChannel[_0xf405('0x23')][_0xf405('0x44')]=function(_0x518718){return this[_0xf405('0x24')](util[_0xf405('0x2b')](_0xf405('0x45'),_0x518718));};AGIChannel['prototype'][_0xf405('0x46')]=function(_0x2738ef,_0x484795,_0x2b8f7e,_0x5c878f,_0xa5a6f4,_0x4afa4d){_0x484795=_0x484795||_0xf405('0x47');_0x2b8f7e=_0x2b8f7e||'';_0x5c878f=_0x5c878f===undefined?-0x1:_0x5c878f==='-1'?-0x1:_0x5c878f*0x3e8;_0xa5a6f4=_0xa5a6f4===undefined?'':'s='+_0xa5a6f4;_0x4afa4d=_0x4afa4d?'BEEP':'';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',_0x2738ef,_0x484795,_0x2b8f7e,_0x5c878f,_0x4afa4d,_0xa5a6f4));};AGIChannel[_0xf405('0x23')][_0xf405('0x48')]=function(_0x35102b,_0x3dade3){_0x3dade3=_0x3dade3||'';return this[_0xf405('0x24')](util['format'](_0xf405('0x49'),_0x35102b,_0x3dade3));};AGIChannel[_0xf405('0x23')][_0xf405('0x4a')]=function(_0x2f2b73){return this['exec'](_0xf405('0x4b'),_0x2f2b73);};AGIChannel['prototype'][_0xf405('0x4c')]=function(_0x42a8b2){return this[_0xf405('0x30')](_0xf405('0x4d'),_0x42a8b2);};AGIChannel[_0xf405('0x23')][_0xf405('0x4e')]=function(_0x56d596,_0x176703){this[_0xf405('0x2d')](util[_0xf405('0x2b')](_0xf405('0x4f'),_0x56d596['id'],_0x56d596[_0xf405('0x50')],_0x176703));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xf405('0x51')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 931a993..556bfe8 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 _0x6ed4=['name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message'];(function(_0x467a23,_0x41914b){var _0x54caad=function(_0x3a6173){while(--_0x3a6173){_0x467a23['push'](_0x467a23['shift']());}};_0x54caad(++_0x41914b);}(_0x6ed4,0x182));var _0x46ed=function(_0xa293f8,_0x94558f){_0xa293f8=_0xa293f8-0x0;var _0x2ca83e=_0x6ed4[_0xa293f8];return _0x2ca83e;};'use strict';var util=require(_0x46ed('0x0'));var error={'E_AGI_UNDEFINED':_0x46ed('0x1'),'E_AGI_ARGUMENT_PORT':_0x46ed('0x2'),'E_AGI_SERVER_ERROR':_0x46ed('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x46ed('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x46ed('0x5'),'E_AGI_SOCKET_ERROR':_0x46ed('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x46ed('0x7'),'E_AGI_IVR_ENTRY':_0x46ed('0x8')};function AGIError(_0x5d8ef2){var _0x5d8ef2=_0x5d8ef2||null,_0x1c6af8=_0x1c6af8||[],_0x43083e=0x1,_0x4a267b='';if(!error[_0x5d8ef2]){_0x5d8ef2=_0x46ed('0x9');}_0x1c6af8[_0x46ed('0xa')](error[_0x5d8ef2]);while(arguments[_0x43083e]){_0x1c6af8[_0x46ed('0xa')](arguments[_0x43083e]);_0x43083e++;}_0x4a267b=util[_0x46ed('0xb')][_0x46ed('0xc')](util,_0x1c6af8);this[_0x46ed('0xd')]=_0x4a267b;this[_0x46ed('0xe')]=_0x5d8ef2;}module[_0x46ed('0xf')]=AGIError; \ No newline at end of file +var _0xb052=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.'];(function(_0x95a193,_0x5651e3){var _0x5b4b40=function(_0x2e4529){while(--_0x2e4529){_0x95a193['push'](_0x95a193['shift']());}};_0x5b4b40(++_0x5651e3);}(_0xb052,0x1db));var _0x2b05=function(_0x962fc5,_0x58f074){_0x962fc5=_0x962fc5-0x0;var _0x43667c=_0xb052[_0x962fc5];return _0x43667c;};'use strict';var util=require(_0x2b05('0x0'));var error={'E_AGI_UNDEFINED':_0x2b05('0x1'),'E_AGI_ARGUMENT_PORT':_0x2b05('0x2'),'E_AGI_SERVER_ERROR':_0x2b05('0x3'),'E_AGI_SERVER_CLOSE':_0x2b05('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x2b05('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x2b05('0x6'),'E_AGI_SOCKET_ERROR':_0x2b05('0x7'),'E_AGI_SOCKET_CLOSE':_0x2b05('0x8'),'E_AGI_SOCKET_TIMEOUT':_0x2b05('0x9'),'E_AGI_COMMAND_EMPTY':_0x2b05('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x2b05('0xb'),'E_AGI_IVR_ENTRY':_0x2b05('0xc')};function AGIError(_0x547eb7){var _0x547eb7=_0x547eb7||null,_0x58208c=_0x58208c||[],_0x11a35b=0x1,_0x3ac572='';if(!error[_0x547eb7]){_0x547eb7=_0x2b05('0xd');}_0x58208c[_0x2b05('0xe')](error[_0x547eb7]);while(arguments[_0x11a35b]){_0x58208c[_0x2b05('0xe')](arguments[_0x11a35b]);_0x11a35b++;}_0x3ac572=util[_0x2b05('0xf')][_0x2b05('0x10')](util,_0x58208c);this[_0x2b05('0x11')]=_0x3ac572;this[_0x2b05('0x12')]=_0x547eb7;}module[_0x2b05('0x13')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 18e9e88..25230c6 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 _0xffee=['agi','emit','error','parse','projectUpdate','E_AGI_SERVER_ERROR','lodash','events','./error','../../config/environment','redis','defaults','localhost','subscribe'];(function(_0xc06b86,_0x5793c8){var _0xc51fd1=function(_0x181172){while(--_0x181172){_0xc06b86['push'](_0xc06b86['shift']());}};_0xc51fd1(++_0x5793c8);}(_0xffee,0xa0));var _0xeffe=function(_0x18fa5a,_0x3a6dde){_0x18fa5a=_0x18fa5a-0x0;var _0x39f1d3=_0xffee[_0x18fa5a];return _0x39f1d3;};'use strict';var _=require(_0xeffe('0x0'));var EventEmitter=require(_0xeffe('0x1'))['EventEmitter'];var Redis=require('ioredis');var AGIError=require(_0xeffe('0x2'));var config=require(_0xeffe('0x3'));config[_0xeffe('0x4')]=_[_0xeffe('0x5')](config['redis'],{'host':_0xeffe('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xeffe('0x4')]);sub[_0xeffe('0x7')](_0xeffe('0x8'),function(_0x574fcd){if(_0x574fcd)return eventEmitter[_0xeffe('0x9')](_0xeffe('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x574fcd));});sub['on']('message',function(_0x5c0e79,_0x3e85c4){if(_0x5c0e79!=='agi')return;try{var _0x31f8a7=JSON[_0xeffe('0xb')](_0x3e85c4);eventEmitter['emit'](_0xeffe('0xc'),_0x31f8a7);}catch(_0x32d070){eventEmitter[_0xeffe('0x9')](_0xeffe('0xa'),new AGIError(_0xeffe('0xd'),_0x32d070));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xa2f2=['parse','emit','exports','lodash','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','agi','error','E_AGI_SERVER_ERROR'];(function(_0x10a904,_0x2bf292){var _0x53815a=function(_0x2e6ce4){while(--_0x2e6ce4){_0x10a904['push'](_0x10a904['shift']());}};_0x53815a(++_0x2bf292);}(_0xa2f2,0xe4));var _0x2a2f=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa2f2[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x2a2f('0x0'));var EventEmitter=require('events')[_0x2a2f('0x1')];var Redis=require(_0x2a2f('0x2'));var AGIError=require(_0x2a2f('0x3'));var config=require(_0x2a2f('0x4'));config[_0x2a2f('0x5')]=_[_0x2a2f('0x6')](config[_0x2a2f('0x5')],{'host':_0x2a2f('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x2a2f('0x5')]);sub[_0x2a2f('0x8')](_0x2a2f('0x9'),function(_0xb91c0a){if(_0xb91c0a)return eventEmitter['emit'](_0x2a2f('0xa'),new AGIError(_0x2a2f('0xb'),_0xb91c0a));});sub['on']('message',function(_0x2d2add,_0x13c734){if(_0x2d2add!=='agi')return;try{var _0x33e81f=JSON[_0x2a2f('0xc')](_0x13c734);eventEmitter[_0x2a2f('0xd')]('projectUpdate',_0x33e81f);}catch(_0xdba535){eventEmitter[_0x2a2f('0xd')]('error',new AGIError('E_AGI_SERVER_ERROR',_0xdba535));}});module[_0x2a2f('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 4aad5b9..c73ef9e 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 _0xf60a=['agicommand','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','lodash','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','split'];(function(_0x5a4dfc,_0x5a3b0c){var _0x127d2b=function(_0x4ba433){while(--_0x4ba433){_0x5a4dfc['push'](_0x5a4dfc['shift']());}};_0x127d2b(++_0x5a3b0c);}(_0xf60a,0x10d));var _0xaf60=function(_0x1ba9b9,_0x1f0144){_0x1ba9b9=_0x1ba9b9-0x0;var _0x12db6d=_0xf60a[_0x1ba9b9];return _0x12db6d;};'use strict';var _=require(_0xaf60('0x0'));var logger=require('../../../config/logger')(_0xaf60('0x1'));var verticesWithRetry=[_0xaf60('0x2'),_0xaf60('0x3'),_0xaf60('0x4')];var Graph=function(){this[_0xaf60('0x5')]={};this[_0xaf60('0x6')]={};this[_0xaf60('0x7')]=0x0;};Graph[_0xaf60('0x8')][_0xaf60('0x9')]=function(_0x5a3edf){this[_0xaf60('0x5')][_0x5a3edf['id']]=_0x5a3edf;this[_0xaf60('0x6')][_0x5a3edf['id']]=[];};Graph[_0xaf60('0x8')][_0xaf60('0xa')]=function(_0x2c413d,_0x314d0b,_0x198859){this[_0xaf60('0x6')][_0x2c413d]['push']({'target':_0x314d0b,'condition':_0x198859});this[_0xaf60('0x7')]+=0x1;};Graph['prototype'][_0xaf60('0xb')]=function(){return _['size'](this['vertices']);};Graph[_0xaf60('0x8')][_0xaf60('0xc')]=function(){return this[_0xaf60('0x7')];};Graph['prototype'][_0xaf60('0xd')]=function(_0x478af6){return this['vertices'][_0x478af6];};Graph[_0xaf60('0x8')][_0xaf60('0xe')]=function(_0x295967,_0x3ffdc8){if(!this[_0xaf60('0x5')][_0x295967]){return logger[_0xaf60('0xf')](_0xaf60('0x10'));}var _0x55dd4a=_0x3ffdc8(this['vertices'][_0x295967]);if(!_0x55dd4a){return logger[_0xaf60('0xf')]('stop\x20traverse');}if(this[_0xaf60('0x6')][_0x295967][_0xaf60('0x11')]===0x0){return logger[_0xaf60('0xf')](_0xaf60('0x12'));}for(var _0x386a98=0x0,_0x1df505=[],_0xd3cc19=![];_0x386a98\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./project','./events','agi','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','splice','push','log','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','[%s]\x20%s','name','message','[ERROR]\x20%s','info','calleridname','callerid','uniqueid','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','evtHangup','createSquareReport','then','catch','hasOwnProperty'];(function(_0x3791bc,_0x1828a7){var _0x5ed5e2=function(_0x3b92d6){while(--_0x3b92d6){_0x3791bc['push'](_0x3791bc['shift']());}};_0x5ed5e2(++_0x1828a7);}(_0x3cee,0x1ab));var _0xe3ce=function(_0x5cb50a,_0x490f25){_0x5cb50a=_0x5cb50a-0x0;var _0x5eaf4b=_0x3cee[_0x5cb50a];return _0x5eaf4b;};'use strict';var _=require(_0xe3ce('0x0'));var syncho=require(_0xe3ce('0x1'));var util=require(_0xe3ce('0x2'));var config=require(_0xe3ce('0x3'));var logger=require(_0xe3ce('0x4'))('agi');var utilLicense=require(_0xe3ce('0x5'));var rpc=require('./rpc');var Project=require(_0xe3ce('0x6'));var AGIEmitter=require(_0xe3ce('0x7'))['EventEmitter'];var projects=[];config[_0xe3ce('0x8')]=_[_0xe3ce('0x9')](config[_0xe3ce('0x8')],{'ip':_0xe3ce('0xa'),'port':0x11dd});AGIEmitter['on'](_0xe3ce('0xb'),projectUpdateHandler);function connectionHandler(_0x21b98c){process[_0xe3ce('0xc')](function(){syncho(function(){try{setChannelVariables(_0x21b98c);agiHandler(_0x21b98c);}catch(_0x4d25a7){logger[_0xe3ce('0xd')](_0x4d25a7[_0xe3ce('0xe')]);}});});}function projectUpdateHandler(_0x487967){try{var _0x4d0b2f=_['findIndex'](projects,['id',_0x487967['id']]);if(_0x4d0b2f>-0x1){if(_0x487967['deleted']===!![]){projects[_0xe3ce('0xf')](_0x4d0b2f,0x1);}else{projects[_0x4d0b2f]=_0x487967;}}else{projects[_0xe3ce('0x10')](_0x487967);}}catch(_0x8bc9c5){logger[_0xe3ce('0xd')](_0x8bc9c5[_0xe3ce('0xe')]);}}function listeningHandler(){console[_0xe3ce('0x11')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xe3ce('0x8')]['port']);logger['info'](util[_0xe3ce('0x12')](_0xe3ce('0x13'),config[_0xe3ce('0x8')]['ip'],config[_0xe3ce('0x8')][_0xe3ce('0x14')]));}function errorHandler(_0x4de22a){if(_0x4de22a&&_0x4de22a['name']&&_0x4de22a['message']){logger[_0xe3ce('0xd')](util['format'](_0xe3ce('0x15'),_0x4de22a[_0xe3ce('0x16')],_0x4de22a[_0xe3ce('0x17')]));}else{logger[_0xe3ce('0xd')](util['format'](_0xe3ce('0x18'),_0x4de22a[_0xe3ce('0xe')]));}}function closeHandler(){logger[_0xe3ce('0x19')](util[_0xe3ce('0x12')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0xe3ce('0x1a')],this[_0xe3ce('0x1b')],this['dnid'],this[_0xe3ce('0x1c')]));try{createSquareReport(this);}catch(_0x29b81f){logger['error'](_0x29b81f[_0xe3ce('0xe')]);}}function timeoutHandler(){logger[_0xe3ce('0x19')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xe3ce('0x1d')],this[_0xe3ce('0x1a')],this[_0xe3ce('0x1b')],this['dnid'],this[_0xe3ce('0x1c')]));}function hangupHandler(){logger[_0xe3ce('0x19')](util[_0xe3ce('0x12')](_0xe3ce('0x1e'),this['arg_1'],this[_0xe3ce('0x1a')],this[_0xe3ce('0x1b')],this[_0xe3ce('0x1f')],this[_0xe3ce('0x1c')]));this[_0xe3ce('0x20')]=!![];}function createSquareReport(_0x2a5b63,_0x599082){rpc[_0xe3ce('0x21')](_0x2a5b63)[_0xe3ce('0x22')](function(_0x20e620){if(_0x599082){_0x599082(null,_0x20e620);}})[_0xe3ce('0x23')](function(_0x473475){if(_0x599082){_0x599082(null,_0x473475);}});}function setChannelVariables(_0x17acb1){for(var _0x254e24 in _0x17acb1){if(_0x17acb1[_0xe3ce('0x24')](_0x254e24)){if(_0x254e24[_0xe3ce('0x25')](_0xe3ce('0x26'))===0x0){_0x17acb1[_0x254e24[_0xe3ce('0x27')](0x4)]=_0x17acb1[_0x254e24];delete _0x17acb1[_0x254e24];}}}}function agiHandler(_0x57cb3d){logger['debug'](_0xe3ce('0x28'),JSON[_0xe3ce('0x29')](_0x57cb3d,null,0x2));logger[_0xe3ce('0x19')](util[_0xe3ce('0x12')](_0xe3ce('0x2a'),_0x57cb3d[_0xe3ce('0x1d')],_0x57cb3d[_0xe3ce('0x1a')],_0x57cb3d[_0xe3ce('0x1b')],_0x57cb3d['dnid'],_0x57cb3d[_0xe3ce('0x1c')]));_0x57cb3d['on'](_0xe3ce('0xd'),errorHandler);_0x57cb3d['on'](_0xe3ce('0x2b'),closeHandler);_0x57cb3d['on'](_0xe3ce('0x2c'),timeoutHandler);_0x57cb3d[_0xe3ce('0x20')]=![];_0x57cb3d['on']('hangup',hangupHandler);var _0x3801ad=_['find'](projects,[_0xe3ce('0x16'),_0x57cb3d['arg_1']]);if(!_0x3801ad)return Project[_0xe3ce('0x2d')](_0x57cb3d);if(!_0x3801ad[_0xe3ce('0x2e')])return Project[_0xe3ce('0x2f')](_0x57cb3d);return Project[_0xe3ce('0x30')](_0x3801ad,_0x57cb3d);}function main(){var _0x1573be;return utilLicense[_0xe3ce('0x31')]()[_0xe3ce('0x22')](function(_0x27f614){if(!_0x27f614)return;if(_0x27f614[_0xe3ce('0x32')]){if(_0x27f614[_0xe3ce('0x33')]&&_0x27f614[_0xe3ce('0x33')]>0x0){logger[_0xe3ce('0x19')](util[_0xe3ce('0x12')](_0xe3ce('0x34'),_0x27f614['callysquare']));_0x1573be=_0x27f614[_0xe3ce('0x33')];}else{logger[_0xe3ce('0x19')](_0xe3ce('0x35'));}}else{logger[_0xe3ce('0x19')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x1573be=-0x1;}})['then'](function(){return Project['getAll']();})[_0xe3ce('0x22')](function(_0x36d433){projects=_0x36d433;return;})[_0xe3ce('0x23')](function(_0x16c79b){logger[_0xe3ce('0xd')](_0xe3ce('0x36'),_0x16c79b['stack']);})['finally'](function(){var _0x5b3603=require(_0xe3ce('0x37'))(config['agi'][_0xe3ce('0x14')],config[_0xe3ce('0x8')]['ip'],_0x1573be);_0x5b3603['on']('error',errorHandler);_0x5b3603['on'](_0xe3ce('0x38'),listeningHandler);_0x5b3603['on'](_0xe3ce('0x39'),connectionHandler);_0x5b3603['on'](_0xe3ce('0x2b'),closeHandler);});}main(); \ No newline at end of file +var _0x7aec=['splice','push','error','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','agi','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','find','production','handleUnpublished','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','./server','listening','connection','lodash','syncho','util','../../config/logger','../../config/license/util','./rpc','./events','EventEmitter','defaults','127.0.0.1','stack','findIndex','deleted'];(function(_0x495ac3,_0x15d02b){var _0x4bdac1=function(_0x194622){while(--_0x194622){_0x495ac3['push'](_0x495ac3['shift']());}};_0x4bdac1(++_0x15d02b);}(_0x7aec,0xa1));var _0xc7ae=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x7aec[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0xc7ae('0x0'));var syncho=require(_0xc7ae('0x1'));var util=require(_0xc7ae('0x2'));var config=require('../../config/environment');var logger=require(_0xc7ae('0x3'))('agi');var utilLicense=require(_0xc7ae('0x4'));var rpc=require(_0xc7ae('0x5'));var Project=require('./project');var AGIEmitter=require(_0xc7ae('0x6'))[_0xc7ae('0x7')];var projects=[];config['agi']=_[_0xc7ae('0x8')](config['agi'],{'ip':_0xc7ae('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x515df7){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x515df7);agiHandler(_0x515df7);}catch(_0x4829b9){logger['error'](_0x4829b9[_0xc7ae('0xa')]);}});});}function projectUpdateHandler(_0x8c2bfb){try{var _0xe3929f=_[_0xc7ae('0xb')](projects,['id',_0x8c2bfb['id']]);if(_0xe3929f>-0x1){if(_0x8c2bfb[_0xc7ae('0xc')]===!![]){projects[_0xc7ae('0xd')](_0xe3929f,0x1);}else{projects[_0xe3929f]=_0x8c2bfb;}}else{projects[_0xc7ae('0xe')](_0x8c2bfb);}}catch(_0x5b43ec){logger[_0xc7ae('0xf')](_0x5b43ec[_0xc7ae('0xa')]);}}function listeningHandler(){console['log'](_0xc7ae('0x10'),config['agi'][_0xc7ae('0x11')]);logger[_0xc7ae('0x12')](util[_0xc7ae('0x13')](_0xc7ae('0x14'),config['agi']['ip'],config[_0xc7ae('0x15')][_0xc7ae('0x11')]));}function errorHandler(_0x32eb87){if(_0x32eb87&&_0x32eb87[_0xc7ae('0x16')]&&_0x32eb87[_0xc7ae('0x17')]){logger[_0xc7ae('0xf')](util[_0xc7ae('0x13')](_0xc7ae('0x18'),_0x32eb87[_0xc7ae('0x16')],_0x32eb87['message']));}else{logger[_0xc7ae('0xf')](util[_0xc7ae('0x13')](_0xc7ae('0x19'),_0x32eb87['stack']));}}function closeHandler(){logger[_0xc7ae('0x12')](util[_0xc7ae('0x13')](_0xc7ae('0x1a'),this[_0xc7ae('0x1b')],this[_0xc7ae('0x1c')],this[_0xc7ae('0x1d')],this[_0xc7ae('0x1e')],this[_0xc7ae('0x1f')]));try{createSquareReport(this);}catch(_0x126848){logger['error'](_0x126848[_0xc7ae('0xa')]);}}function timeoutHandler(){logger[_0xc7ae('0x12')](util[_0xc7ae('0x13')](_0xc7ae('0x20'),this['arg_1'],this['calleridname'],this[_0xc7ae('0x1d')],this[_0xc7ae('0x1e')],this[_0xc7ae('0x1f')]));}function hangupHandler(){logger[_0xc7ae('0x12')](util[_0xc7ae('0x13')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xc7ae('0x1b')],this['calleridname'],this[_0xc7ae('0x1d')],this['dnid'],this['uniqueid']));this[_0xc7ae('0x21')]=!![];}function createSquareReport(_0x1c486c,_0x350f85){rpc[_0xc7ae('0x22')](_0x1c486c)[_0xc7ae('0x23')](function(_0x56b68f){if(_0x350f85){_0x350f85(null,_0x56b68f);}})[_0xc7ae('0x24')](function(_0x2d6ea6){if(_0x350f85){_0x350f85(null,_0x2d6ea6);}});}function setChannelVariables(_0x42ca65){for(var _0xf04c7d in _0x42ca65){if(_0x42ca65[_0xc7ae('0x25')](_0xf04c7d)){if(_0xf04c7d[_0xc7ae('0x26')](_0xc7ae('0x27'))===0x0){_0x42ca65[_0xf04c7d['substring'](0x4)]=_0x42ca65[_0xf04c7d];delete _0x42ca65[_0xf04c7d];}}}}function agiHandler(_0x2c55ef){logger[_0xc7ae('0x28')]('variables',JSON[_0xc7ae('0x29')](_0x2c55ef,null,0x2));logger['info'](util['format'](_0xc7ae('0x2a'),_0x2c55ef['arg_1'],_0x2c55ef['calleridname'],_0x2c55ef[_0xc7ae('0x1d')],_0x2c55ef['dnid'],_0x2c55ef[_0xc7ae('0x1f')]));_0x2c55ef['on'](_0xc7ae('0xf'),errorHandler);_0x2c55ef['on']('close',closeHandler);_0x2c55ef['on'](_0xc7ae('0x2b'),timeoutHandler);_0x2c55ef[_0xc7ae('0x21')]=![];_0x2c55ef['on'](_0xc7ae('0x2c'),hangupHandler);var _0x4046ab=_[_0xc7ae('0x2d')](projects,[_0xc7ae('0x16'),_0x2c55ef[_0xc7ae('0x1b')]]);if(!_0x4046ab)return Project['handleNotFound'](_0x2c55ef);if(!_0x4046ab[_0xc7ae('0x2e')])return Project[_0xc7ae('0x2f')](_0x2c55ef);return Project[_0xc7ae('0x30')](_0x4046ab,_0x2c55ef);}function main(){var _0x21fa8d;return utilLicense['getLicense']()[_0xc7ae('0x23')](function(_0x4e6210){if(!_0x4e6210)return;if(_0x4e6210[_0xc7ae('0x31')]){if(_0x4e6210['callysquare']&&_0x4e6210[_0xc7ae('0x32')]>0x0){logger[_0xc7ae('0x12')](util['format'](_0xc7ae('0x33'),_0x4e6210[_0xc7ae('0x32')]));_0x21fa8d=_0x4e6210[_0xc7ae('0x32')];}else{logger[_0xc7ae('0x12')](_0xc7ae('0x34'));}}else{logger[_0xc7ae('0x12')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x21fa8d=-0x1;}})[_0xc7ae('0x23')](function(){return Project[_0xc7ae('0x35')]();})[_0xc7ae('0x23')](function(_0x32e46e){projects=_0x32e46e;return;})[_0xc7ae('0x24')](function(_0x56a5f9){logger[_0xc7ae('0xf')](_0xc7ae('0x36'),_0x56a5f9[_0xc7ae('0xa')]);})['finally'](function(){var _0x431131=require(_0xc7ae('0x37'))(config[_0xc7ae('0x15')][_0xc7ae('0x11')],config[_0xc7ae('0x15')]['ip'],_0x21fa8d);_0x431131['on'](_0xc7ae('0xf'),errorHandler);_0x431131['on'](_0xc7ae('0x38'),listeningHandler);_0x431131['on'](_0xc7ae('0x39'),connectionHandler);_0x431131['on']('close',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 aa9acbd..724a868 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 _0xe840=['jayson/promise','client','then','error','message','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0xfd495c,_0x4a3c1a){var _0x561dd8=function(_0x83e915){while(--_0x83e915){_0xfd495c['push'](_0xfd495c['shift']());}};_0x561dd8(++_0x4a3c1a);}(_0xe840,0xb3));var _0x0e84=function(_0x573d99,_0x575834){_0x573d99=_0x573d99-0x0;var _0x3079b2=_0xe840[_0x573d99];return _0x3079b2;};'use strict';var BPromise=require(_0x0e84('0x0'));var jayson=require(_0x0e84('0x1'));var client=jayson[_0x0e84('0x2')]['http']({'port':0x232b});function request(_0xd3987b,_0x50b10c){return new BPromise(function(_0x3b2160,_0x47fe08){return client['request'](_0xd3987b,_0x50b10c)[_0x0e84('0x3')](function(_0x5a803e){if(_0x5a803e[_0x0e84('0x4')]){return _0x47fe08(_0x5a803e[_0x0e84('0x4')][_0x0e84('0x5')]);}else{return _0x3b2160(_0x5a803e[_0x0e84('0x6')]);}})[_0x0e84('0x7')](function(_0x44d6f2){return _0x47fe08(_0x44d6f2);});});}exports[_0x0e84('0x8')]=function(_0x2b7c54,_0x5e19a5){return request(_0x0e84('0x9'),{'account':_0x2b7c54,'message':_0x5e19a5});}; \ No newline at end of file +var _0x6d0a=['then','error','message','result','catch','sendMailMessage','jayson/promise','client','http','request'];(function(_0x3a6e4b,_0x118cd9){var _0x36572d=function(_0x2a53cf){while(--_0x2a53cf){_0x3a6e4b['push'](_0x3a6e4b['shift']());}};_0x36572d(++_0x118cd9);}(_0x6d0a,0x1e6));var _0xa6d0=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x6d0a[_0x1d1779];return _0x2377e9;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xa6d0('0x0'));var client=jayson[_0xa6d0('0x1')][_0xa6d0('0x2')]({'port':0x232b});function request(_0xb6e67b,_0x63ea4b){return new BPromise(function(_0x88fbaa,_0x18d886){return client[_0xa6d0('0x3')](_0xb6e67b,_0x63ea4b)[_0xa6d0('0x4')](function(_0x4e8bcd){if(_0x4e8bcd[_0xa6d0('0x5')]){return _0x18d886(_0x4e8bcd['error'][_0xa6d0('0x6')]);}else{return _0x88fbaa(_0x4e8bcd[_0xa6d0('0x7')]);}})[_0xa6d0('0x8')](function(_0x40c6ac){return _0x18d886(_0x40c6ac);});});}exports[_0xa6d0('0x9')]=function(_0x43d9d6,_0x4d81ae){return request('SendMail',{'account':_0x43d9d6,'message':_0x4d81ae});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 144dedd..2a79afa 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 _0x036e=['./rpc','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','maxRetry','addVertex','mxCell','hasOwnProperty','length','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','start','format','omit','info','arg_1','calleridname','dnid','uniqueid','traverseBFS','clear','debug','stringify','gotoc','context','extension','priority','response','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','vertex','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','Project\x20%s\x20not\x20published','continueAt','exports','lodash','xml2json','util','../../config/logger'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x036e,0x1b4));var _0xe036=function(_0x39668e,_0x38da81){_0x39668e=_0x39668e-0x0;var _0x2321e1=_0x036e[_0x39668e];return _0x2321e1;};'use strict';var _=require(_0xe036('0x0'));var moment=require('moment');var parser=require(_0xe036('0x1'));var util=require(_0xe036('0x2'));var logger=require(_0xe036('0x3'))('agi');var rpc=require(_0xe036('0x4'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xe036('0x5')](function(_0x4d4d77){logger[_0xe036('0x6')](_0xe036('0x7'),_0x4d4d77[_0xe036('0x8')]);return[];});}function addVertex(_0x37c2ca,_0x261ff4,_0x226acd){_0x261ff4[_0xe036('0x9')]=_0x226acd;if(_0x261ff4['hasOwnProperty'](_0xe036('0xa'))){_0x261ff4[_0xe036('0xb')]=parseInt(_0x261ff4[_0xe036('0xa')],0xa);}_0x37c2ca[_0xe036('0xc')](_['omit'](_0x261ff4,_0xe036('0xd')));}function initGraph(_0x1c668d,_0x56ef02){var _0x4bb787=new Graph();for(var _0x2a1c9e in _0x1c668d){if(_0x1c668d[_0xe036('0xe')](_0x2a1c9e)){if(_['isArray'](_0x1c668d[_0x2a1c9e])){for(var _0x4fa7ca=0x0;_0x4fa7ca<_0x1c668d[_0x2a1c9e][_0xe036('0xf')];_0x4fa7ca+=0x1){addVertex(_0x4bb787,_0x1c668d[_0x2a1c9e][_0x4fa7ca],_0x2a1c9e);}}else{addVertex(_0x4bb787,_0x1c668d[_0x2a1c9e],_0x2a1c9e);}}}for(var _0x36fc22=0x0;_0x36fc22<_0x56ef02[_0xe036('0xf')];_0x36fc22+=0x1){if(_0x56ef02[_0x36fc22]['source']&&_0x56ef02[_0x36fc22][_0xe036('0x10')]){_0x4bb787[_0xe036('0x11')](_0x56ef02[_0x36fc22]['source'],_0x56ef02[_0x36fc22]['target'],_0x56ef02[_0x36fc22][_0xe036('0x12')]);}}return _0x4bb787;}function getRoot(_0xf4c140){return parser[_0xe036('0x13')](_0xf4c140,{'object':!![]})[_0xe036('0x14')][_0xe036('0x15')];}function inspect(_0x15ca43){return util[_0xe036('0x16')](_0x15ca43,{'showHidden':![],'depth':null});}function initialize(_0x164e5c,_0x50d585){var _0x55a5ae=getRoot(_0x164e5c[_0xe036('0x17')]);if(!_0x55a5ae||!_0x55a5ae[_0xe036('0x18')])return;var _0x17a543,_0x223a83,_0x4251ab;logger['debug'](_0xe036('0x15'),JSON['stringify'](_0x55a5ae,null,0x2));_0x50d585['joinAt']=moment()[_0xe036('0x19')]('YYYY-MM-DD\x20HH:mm:ss');_0x17a543=initGraph(_[_0xe036('0x1a')](_0x55a5ae,_0xe036('0xd')),_0x55a5ae[_0xe036('0xd')]);_0x223a83=new Vertices(_0x50d585,rpc,mailRpc);logger[_0xe036('0x1b')](util[_0xe036('0x19')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x50d585[_0xe036('0x1c')],_0x50d585[_0xe036('0x1d')],_0x50d585['callerid'],_0x50d585[_0xe036('0x1e')],_0x50d585[_0xe036('0x1f')]));_0x17a543[_0xe036('0x20')](_0x55a5ae['start']['id'],function(_0x34eb6b){try{_0x34eb6b=_0x223a83[_0xe036('0x21')](_0x34eb6b);logger[_0xe036('0x22')]('vertex',JSON[_0xe036('0x23')](_0x34eb6b,null,0x2));if(_0x34eb6b[_0xe036('0x9')]===_0xe036('0x24')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x50d585[_0xe036('0x25')]=_0x34eb6b['context']||_0x50d585[_0xe036('0x25')];_0x50d585[_0xe036('0x26')]=_0x34eb6b[_0xe036('0x26')];_0x50d585[_0xe036('0x27')]=_0x34eb6b[_0xe036('0x27')]?_0x34eb6b[_0xe036('0x27')]-0x1:0x1;return null;}else if(_0x34eb6b&&_0x223a83[_0x34eb6b[_0xe036('0x9')]]){_0x4251ab=_0x223a83[_0x34eb6b[_0xe036('0x9')]](_0x34eb6b);logger[_0xe036('0x1b')](_0xe036('0x28'),JSON[_0xe036('0x23')](_0x4251ab,null,0x2));if(_0x4251ab&&_0x4251ab['code']===AGI_CODE_SUCCESS&&_0x4251ab['result']!==AGI_RESULT_ERROR&&!_0x50d585['evtHangup']){logger[_0xe036('0x22')](_0xe036('0x28'),inspect(_0x4251ab));return _[_0xe036('0x29')](_0x4251ab[_0xe036('0x2a')])?null:_0x4251ab[_0xe036('0x2a')][_0xe036('0x2b')]();}else{logger['error'](_0xe036('0x28'),inspect(_0x4251ab));return null;}}else{logger[_0xe036('0x6')]('agicommand\x20not\x20found');return null;}}catch(_0x1214e4){logger[_0xe036('0x6')](_0x1214e4[_0xe036('0x8')]);return null;}});if(_0x55a5ae[_0xe036('0x2c')]){logger[_0xe036('0x1b')](util[_0xe036('0x19')](_0xe036('0x2d'),_0x50d585[_0xe036('0x1c')],_0x50d585[_0xe036('0x1d')],_0x50d585[_0xe036('0x2e')],_0x50d585[_0xe036('0x1e')],_0x50d585[_0xe036('0x1f')]));_0x17a543[_0xe036('0x20')](_0x55a5ae[_0xe036('0x2c')]['id'],function(_0x2d9803){try{_0x2d9803=_0x223a83['clear'](_0x2d9803);logger[_0xe036('0x22')](_0xe036('0x2f'),JSON['stringify'](_0x2d9803,null,0x2));if(_0x2d9803&&_0x223a83[_0x2d9803['agicommand']]){_0x4251ab=_0x223a83[_0x2d9803[_0xe036('0x9')]](_0x2d9803);if(_0x4251ab){logger[_0xe036('0x22')]('response',inspect(_0x4251ab));return _[_0xe036('0x29')](_0x4251ab[_0xe036('0x2a')])?null:_0x4251ab[_0xe036('0x2a')]['toString']();}else{logger[_0xe036('0x6')](_0xe036('0x28'),inspect(_0x4251ab));return null;}}else{logger['error'](_0xe036('0x30'));return null;}}catch(_0x2db63a){logger[_0xe036('0x6')](_0x2db63a[_0xe036('0x8')]);return null;}});}logger[_0xe036('0x1b')](util[_0xe036('0x19')](_0xe036('0x31'),_0x50d585['arg_1'],_0x50d585[_0xe036('0x1d')],_0x50d585[_0xe036('0x2e')],_0x50d585[_0xe036('0x1e')],_0x50d585[_0xe036('0x1f')]));logger[_0xe036('0x1b')](util[_0xe036('0x19')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x50d585[_0xe036('0x25')],_0x50d585[_0xe036('0x26')],parseInt(_0x50d585[_0xe036('0x27')],0xa)+0x1));_0x50d585['continueAt'](_0x50d585['context'],_0x50d585[_0xe036('0x26')],parseInt(_0x50d585[_0xe036('0x27')],0xa)+0x1);_0x50d585[_0xe036('0x32')]();}function handleNotFound(_0x502ee1){logger[_0xe036('0x6')](util[_0xe036('0x19')](_0xe036('0x33'),_0x502ee1['arg_1']));_0x502ee1['continueAt'](_0x502ee1['context'],_0x502ee1[_0xe036('0x26')],parseInt(_0x502ee1[_0xe036('0x27')],0xa)+0x1);_0x502ee1[_0xe036('0x32')]();}function handleUnpublished(_0x1f7ab2){logger[_0xe036('0x6')](util[_0xe036('0x19')](_0xe036('0x34'),_0x1f7ab2[_0xe036('0x1c')]));_0x1f7ab2[_0xe036('0x35')](_0x1f7ab2[_0xe036('0x25')],_0x1f7ab2['extension'],parseInt(_0x1f7ab2[_0xe036('0x27')],0xa)+0x1);_0x1f7ab2['close']();}module[_0xe036('0x36')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x7409=['[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','agicommand','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','maxRetry','retry','omit','mxCell','isArray','length','source','target','value','mxGraphModel','inspect','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','arg_1','calleridname','dnid','uniqueid','start','stringify','gotoc','context','extension','priority','response','code','result','evtHangup','debug','isUndefined','toString','agicommand\x20not\x20found','finally'];(function(_0x3d728e,_0x1843b8){var _0x4ef29e=function(_0x1d3290){while(--_0x1d3290){_0x3d728e['push'](_0x3d728e['shift']());}};_0x4ef29e(++_0x1843b8);}(_0x7409,0x1be));var _0x9740=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0x7409[_0x3203a1];return _0x24215e;};'use strict';var _=require(_0x9740('0x0'));var moment=require(_0x9740('0x1'));var parser=require(_0x9740('0x2'));var util=require(_0x9740('0x3'));var logger=require(_0x9740('0x4'))(_0x9740('0x5'));var rpc=require(_0x9740('0x6'));var mailRpc=require(_0x9740('0x7'));var Graph=require(_0x9740('0x8'));var Vertices=require(_0x9740('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x9740('0xa')]()[_0x9740('0xb')](function(_0x1fe44c){logger[_0x9740('0xc')](_0x9740('0xd'),_0x1fe44c[_0x9740('0xe')]);return[];});}function addVertex(_0x283a75,_0x54db06,_0x396a74){_0x54db06['agicommand']=_0x396a74;if(_0x54db06[_0x9740('0xf')]('retry')){_0x54db06[_0x9740('0x10')]=parseInt(_0x54db06[_0x9740('0x11')],0xa);}_0x283a75['addVertex'](_[_0x9740('0x12')](_0x54db06,_0x9740('0x13')));}function initGraph(_0x34a6f0,_0x3baa24){var _0x4442ef=new Graph();for(var _0x13d072 in _0x34a6f0){if(_0x34a6f0[_0x9740('0xf')](_0x13d072)){if(_[_0x9740('0x14')](_0x34a6f0[_0x13d072])){for(var _0x5c060b=0x0;_0x5c060b<_0x34a6f0[_0x13d072][_0x9740('0x15')];_0x5c060b+=0x1){addVertex(_0x4442ef,_0x34a6f0[_0x13d072][_0x5c060b],_0x13d072);}}else{addVertex(_0x4442ef,_0x34a6f0[_0x13d072],_0x13d072);}}}for(var _0x2643d8=0x0;_0x2643d8<_0x3baa24[_0x9740('0x15')];_0x2643d8+=0x1){if(_0x3baa24[_0x2643d8][_0x9740('0x16')]&&_0x3baa24[_0x2643d8][_0x9740('0x17')]){_0x4442ef['addEdge'](_0x3baa24[_0x2643d8][_0x9740('0x16')],_0x3baa24[_0x2643d8][_0x9740('0x17')],_0x3baa24[_0x2643d8][_0x9740('0x18')]);}}return _0x4442ef;}function getRoot(_0x45ab7c){return parser['toJson'](_0x45ab7c,{'object':!![]})[_0x9740('0x19')]['root'];}function inspect(_0x5f3cad){return util[_0x9740('0x1a')](_0x5f3cad,{'showHidden':![],'depth':null});}function initialize(_0x10617b,_0x3cb7cc){var _0x4e9dfc=getRoot(_0x10617b['production']);if(!_0x4e9dfc||!_0x4e9dfc['start'])return;var _0x42fa6e,_0x4b22f0,_0x98b06c;logger['debug']('root',JSON['stringify'](_0x4e9dfc,null,0x2));_0x3cb7cc[_0x9740('0x1b')]=moment()[_0x9740('0x1c')](_0x9740('0x1d'));_0x42fa6e=initGraph(_[_0x9740('0x12')](_0x4e9dfc,_0x9740('0x13')),_0x4e9dfc[_0x9740('0x13')]);_0x4b22f0=new Vertices(_0x3cb7cc,rpc,mailRpc);logger[_0x9740('0x1e')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3cb7cc[_0x9740('0x1f')],_0x3cb7cc[_0x9740('0x20')],_0x3cb7cc['callerid'],_0x3cb7cc[_0x9740('0x21')],_0x3cb7cc[_0x9740('0x22')]));_0x42fa6e['traverseBFS'](_0x4e9dfc[_0x9740('0x23')]['id'],function(_0x81a6ca){try{_0x81a6ca=_0x4b22f0['clear'](_0x81a6ca);logger['debug']('vertex',JSON[_0x9740('0x24')](_0x81a6ca,null,0x2));if(_0x81a6ca['agicommand']===_0x9740('0x25')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x3cb7cc[_0x9740('0x26')]=_0x81a6ca[_0x9740('0x26')]||_0x3cb7cc['context'];_0x3cb7cc[_0x9740('0x27')]=_0x81a6ca[_0x9740('0x27')];_0x3cb7cc[_0x9740('0x28')]=_0x81a6ca['priority']?_0x81a6ca['priority']-0x1:0x1;return null;}else if(_0x81a6ca&&_0x4b22f0[_0x81a6ca['agicommand']]){_0x98b06c=_0x4b22f0[_0x81a6ca['agicommand']](_0x81a6ca);logger[_0x9740('0x1e')](_0x9740('0x29'),JSON[_0x9740('0x24')](_0x98b06c,null,0x2));if(_0x98b06c&&_0x98b06c[_0x9740('0x2a')]===AGI_CODE_SUCCESS&&_0x98b06c[_0x9740('0x2b')]!==AGI_RESULT_ERROR&&!_0x3cb7cc[_0x9740('0x2c')]){logger[_0x9740('0x2d')](_0x9740('0x29'),inspect(_0x98b06c));return _[_0x9740('0x2e')](_0x98b06c['result'])?null:_0x98b06c[_0x9740('0x2b')][_0x9740('0x2f')]();}else{logger[_0x9740('0xc')](_0x9740('0x29'),inspect(_0x98b06c));return null;}}else{logger[_0x9740('0xc')](_0x9740('0x30'));return null;}}catch(_0x1a6d82){logger['error'](_0x1a6d82[_0x9740('0xe')]);return null;}});if(_0x4e9dfc[_0x9740('0x31')]){logger[_0x9740('0x1e')](util['format'](_0x9740('0x32'),_0x3cb7cc[_0x9740('0x1f')],_0x3cb7cc[_0x9740('0x20')],_0x3cb7cc['callerid'],_0x3cb7cc['dnid'],_0x3cb7cc[_0x9740('0x22')]));_0x42fa6e[_0x9740('0x33')](_0x4e9dfc[_0x9740('0x31')]['id'],function(_0x2a2405){try{_0x2a2405=_0x4b22f0[_0x9740('0x34')](_0x2a2405);logger[_0x9740('0x2d')](_0x9740('0x35'),JSON[_0x9740('0x24')](_0x2a2405,null,0x2));if(_0x2a2405&&_0x4b22f0[_0x2a2405[_0x9740('0x36')]]){_0x98b06c=_0x4b22f0[_0x2a2405['agicommand']](_0x2a2405);if(_0x98b06c){logger[_0x9740('0x2d')](_0x9740('0x29'),inspect(_0x98b06c));return _[_0x9740('0x2e')](_0x98b06c[_0x9740('0x2b')])?null:_0x98b06c['result']['toString']();}else{logger[_0x9740('0xc')]('response',inspect(_0x98b06c));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x342d17){logger[_0x9740('0xc')](_0x342d17['stack']);return null;}});}logger[_0x9740('0x1e')](util[_0x9740('0x1c')](_0x9740('0x37'),_0x3cb7cc[_0x9740('0x1f')],_0x3cb7cc['calleridname'],_0x3cb7cc[_0x9740('0x38')],_0x3cb7cc[_0x9740('0x21')],_0x3cb7cc[_0x9740('0x22')]));logger[_0x9740('0x1e')](util[_0x9740('0x1c')](_0x9740('0x39'),_0x3cb7cc[_0x9740('0x26')],_0x3cb7cc[_0x9740('0x27')],parseInt(_0x3cb7cc[_0x9740('0x28')],0xa)+0x1));_0x3cb7cc[_0x9740('0x3a')](_0x3cb7cc[_0x9740('0x26')],_0x3cb7cc[_0x9740('0x27')],parseInt(_0x3cb7cc['priority'],0xa)+0x1);_0x3cb7cc[_0x9740('0x3b')]();}function handleNotFound(_0x1a89f5){logger[_0x9740('0xc')](util[_0x9740('0x1c')]('Project\x20%s\x20not\x20found',_0x1a89f5[_0x9740('0x1f')]));_0x1a89f5[_0x9740('0x3a')](_0x1a89f5[_0x9740('0x26')],_0x1a89f5[_0x9740('0x27')],parseInt(_0x1a89f5[_0x9740('0x28')],0xa)+0x1);_0x1a89f5[_0x9740('0x3b')]();}function handleUnpublished(_0x3e0c08){logger[_0x9740('0xc')](util['format'](_0x9740('0x3c'),_0x3e0c08[_0x9740('0x1f')]));_0x3e0c08[_0x9740('0x3a')](_0x3e0c08[_0x9740('0x26')],_0x3e0c08[_0x9740('0x27')],parseInt(_0x3e0c08['priority'],0xa)+0x1);_0x3e0c08[_0x9740('0x3b')]();}module[_0x9740('0x3d')]={'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 1b844df..141bdc3 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 _0x9819=['prototype','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','length','split','slice','trim','emit','headers','exports','stream','call','_localBuffer','_inBody','inherits'];(function(_0x1a5a55,_0x1bb50f){var _0x1c1f06=function(_0xd2f1ed){while(--_0xd2f1ed){_0x1a5a55['push'](_0x1a5a55['shift']());}};_0x1c1f06(++_0x1bb50f);}(_0x9819,0x13e));var _0x9981=function(_0x3bf7a9,_0x3fff0f){_0x3bf7a9=_0x3bf7a9-0x0;var _0xc04ee0=_0x9819[_0x3bf7a9];return _0xc04ee0;};'use strict';var util=require('util');var Transform=require(_0x9981('0x0'))['Transform'];function AGIReply(_0x2d7d3e){Transform[_0x9981('0x1')](this,_0x2d7d3e);this[_0x9981('0x2')]='';this[_0x9981('0x3')]=![];}util[_0x9981('0x4')](AGIReply,Transform);AGIReply[_0x9981('0x5')][_0x9981('0x6')]=function(_0x4b3693,_0x1aa0d8,_0x2f0986){var _0x4dc674='\x0a',_0x480b7b=['\x0a\x0a',_0x9981('0x7')],_0x5ac863=-0x1,_0x227315=-0x1,_0x43c877='',_0x294ca7=0x0,_0x6b9cc='',_0xf6387a='';this[_0x9981('0x2')]+=_0x4b3693['toString']();_0x6b9cc=this[_0x9981('0x2')];if(!this['_inBody']){_0x294ca7=0x0;while(_0x480b7b[_0x294ca7]){while((_0x227315=_0x6b9cc[_0x9981('0x8')](_0x480b7b[_0x294ca7]))!=-0x1){_0x43c877=_0x480b7b[_0x294ca7];_0xf6387a=_0x6b9cc['substring'](0x0,_0x227315);_0x6b9cc=_0x6b9cc[_0x9981('0x9')](_0x227315+_0x43c877[_0x9981('0xa')]);var _0x39212a=_0xf6387a[_0x9981('0xb')](_0x4dc674),_0x508e47=0x0,_0x44ba8f={},_0x2a512='',_0x5502ef='',_0x8ae601=-0x1;while(_0x39212a[_0x508e47]){_0x8ae601=_0x39212a[_0x508e47]['indexOf'](':');if(_0x8ae601!=-0x1){_0x2a512=_0x39212a[_0x508e47][_0x9981('0xc')](0x0,_0x8ae601)['trim']();_0x5502ef=_0x39212a[_0x508e47]['slice'](_0x8ae601+0x1)[_0x9981('0xd')]();if(_0x2a512[_0x9981('0xa')]>0x0){_0x44ba8f[_0x2a512]=_0x5502ef;}}else{}_0x508e47++;}this[_0x9981('0xe')](_0x9981('0xf'),_0x44ba8f);this[_0x9981('0x3')]=!![];}_0x294ca7++;}this['_localBuffer']=_0x6b9cc;}else{while((_0x5ac863=_0x6b9cc[_0x9981('0x8')](_0x4dc674))!=-0x1){_0xf6387a=_0x6b9cc[_0x9981('0x9')](0x0,_0x5ac863);this[_0x9981('0xe')]('line',_0xf6387a);_0x6b9cc=_0x6b9cc[_0x9981('0x9')](_0x5ac863+_0x4dc674['length']);}this[_0x9981('0x2')]=_0x6b9cc;}_0x2f0986();};module[_0x9981('0x10')]=AGIReply; \ No newline at end of file +var _0xa9c6=['call','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','toString','_localBuffer','indexOf','substring','slice','trim','emit','headers','line','length','exports','util','stream','Transform'];(function(_0x270ce7,_0x432827){var _0x3c3ff5=function(_0x337f80){while(--_0x337f80){_0x270ce7['push'](_0x270ce7['shift']());}};_0x3c3ff5(++_0x432827);}(_0xa9c6,0x140));var _0x6a9c=function(_0x596891,_0x3194b2){_0x596891=_0x596891-0x0;var _0x4ee241=_0xa9c6[_0x596891];return _0x4ee241;};'use strict';var util=require(_0x6a9c('0x0'));var Transform=require(_0x6a9c('0x1'))[_0x6a9c('0x2')];function AGIReply(_0x841463){Transform[_0x6a9c('0x3')](this,_0x841463);this['_localBuffer']='';this[_0x6a9c('0x4')]=![];}util[_0x6a9c('0x5')](AGIReply,Transform);AGIReply['prototype'][_0x6a9c('0x6')]=function(_0x8c1bb7,_0x317a6e,_0x563f1b){var _0x525c4b='\x0a',_0x14e6b5=['\x0a\x0a',_0x6a9c('0x7')],_0x63d3ed=-0x1,_0x2bb8cc=-0x1,_0x7e802='',_0x56f51a=0x0,_0x42556c='',_0x1843dc='';this['_localBuffer']+=_0x8c1bb7[_0x6a9c('0x8')]();_0x42556c=this[_0x6a9c('0x9')];if(!this['_inBody']){_0x56f51a=0x0;while(_0x14e6b5[_0x56f51a]){while((_0x2bb8cc=_0x42556c[_0x6a9c('0xa')](_0x14e6b5[_0x56f51a]))!=-0x1){_0x7e802=_0x14e6b5[_0x56f51a];_0x1843dc=_0x42556c[_0x6a9c('0xb')](0x0,_0x2bb8cc);_0x42556c=_0x42556c[_0x6a9c('0xb')](_0x2bb8cc+_0x7e802['length']);var _0x37d395=_0x1843dc['split'](_0x525c4b),_0x8c3ddd=0x0,_0x52e3de={},_0x741656='',_0x2cdb81='',_0x467a9e=-0x1;while(_0x37d395[_0x8c3ddd]){_0x467a9e=_0x37d395[_0x8c3ddd][_0x6a9c('0xa')](':');if(_0x467a9e!=-0x1){_0x741656=_0x37d395[_0x8c3ddd]['slice'](0x0,_0x467a9e)['trim']();_0x2cdb81=_0x37d395[_0x8c3ddd][_0x6a9c('0xc')](_0x467a9e+0x1)[_0x6a9c('0xd')]();if(_0x741656['length']>0x0){_0x52e3de[_0x741656]=_0x2cdb81;}}else{}_0x8c3ddd++;}this[_0x6a9c('0xe')](_0x6a9c('0xf'),_0x52e3de);this[_0x6a9c('0x4')]=!![];}_0x56f51a++;}this[_0x6a9c('0x9')]=_0x42556c;}else{while((_0x63d3ed=_0x42556c[_0x6a9c('0xa')](_0x525c4b))!=-0x1){_0x1843dc=_0x42556c[_0x6a9c('0xb')](0x0,_0x63d3ed);this[_0x6a9c('0xe')](_0x6a9c('0x10'),_0x1843dc);_0x42556c=_0x42556c[_0x6a9c('0xb')](_0x63d3ed+_0x525c4b[_0x6a9c('0x11')]);}this[_0x6a9c('0x9')]=_0x42556c;}_0x563f1b();};module[_0x6a9c('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 99d58ab..749246c 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 _0xd493=['getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','createCmContact','ShowCmHopper','phone','ListId','then','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','lodash','jayson/promise','client','request','error','message','result','getSquareProjects','GetSquareProjects','name','production'];(function(_0x586513,_0x59722d){var _0xc4258b=function(_0x4ecd70){while(--_0x4ecd70){_0x586513['push'](_0x586513['shift']());}};_0xc4258b(++_0x59722d);}(_0xd493,0x1bd));var _0x3d49=function(_0x378972,_0x5ac8fa){_0x378972=_0x378972-0x0;var _0x163600=_0xd493[_0x378972];return _0x163600;};'use strict';var _=require(_0x3d49('0x0'));var moment=require('moment');var jayson=require(_0x3d49('0x1'));var client=jayson[_0x3d49('0x2')]['http']({'port':0x2329});function request(_0x4c751d,_0x4a877d){return new Promise(function(_0x58dce8,_0x439989){return client[_0x3d49('0x3')](_0x4c751d,_0x4a877d)['then'](function(_0x5905c6){if(_0x5905c6[_0x3d49('0x4')]){return _0x439989(_0x5905c6[_0x3d49('0x4')][_0x3d49('0x5')]);}else{return _0x58dce8(_0x5905c6[_0x3d49('0x6')]);}})['catch'](function(_0x3d2d14){return _0x439989(_0x3d2d14);});});}exports[_0x3d49('0x7')]=function(){return request(_0x3d49('0x8'),{'options':{'raw':![],'attributes':['id',_0x3d49('0x9'),_0x3d49('0xa')]}});};exports[_0x3d49('0xb')]=function(_0x3d347e){return request(_0x3d49('0xc'),{'options':{'raw':![],'where':{'name':_0x3d347e},'attributes':[_0x3d49('0xa')]}});};exports[_0x3d49('0xd')]=function(_0x5bac1c){return request(_0x3d49('0xe'),{'options':{'raw':![],'where':{'id':_0x5bac1c},'include':[{'model':'MailServerOut','as':_0x3d49('0xf'),'include':[{'model':_0x3d49('0x10'),'as':_0x3d49('0x10')}]}],'attributes':['id',_0x3d49('0x9'),_0x3d49('0x11')],'smtp':!![]}});};exports[_0x3d49('0x12')]=function(_0x423240){return request(_0x3d49('0xc'),{'options':{'where':{'id':_0x423240},'attributes':[_0x3d49('0x9')]}});};exports[_0x3d49('0x13')]=function(_0x342cf7){return request(_0x3d49('0x14'),{'options':{'where':{'id':_0x342cf7},'attributes':[_0x3d49('0x9')]}});};exports['getVariableById']=function(_0x143d42){return request(_0x3d49('0x15'),{'options':{'where':{'id':_0x143d42},'attributes':[_0x3d49('0x9')]}});};exports[_0x3d49('0x16')]=function(_0x1dc095){return request(_0x3d49('0x17'),{'options':{'where':{'id':_0x1dc095},'attributes':[_0x3d49('0x18')]}});};exports[_0x3d49('0x19')]=function(_0x7126d5){return request('ShowUser',{'options':{'where':{'id':_0x7126d5},'attributes':[_0x3d49('0x9')]}});};exports[_0x3d49('0x1a')]=function(_0x42d858){return request(_0x3d49('0x1b'),{'options':{'where':{'phone':_0x42d858['phone']},'attributes':['id']}});};exports[_0x3d49('0x1c')]=function(_0x46313e){return request(_0x3d49('0x1d'),{'options':{'where':{'id':_0x46313e},'attributes':['name']}});};exports[_0x3d49('0x1e')]=function(_0x51f17c){return request('ShowSound',{'options':{'where':{'id':_0x51f17c},'attributes':[_0x3d49('0x1f')]}});};exports[_0x3d49('0x20')]=function(_0x245d87){return request(_0x3d49('0x21'),{'options':{'raw':![],'where':{'id':_0x245d87},'include':[{'model':_0x3d49('0x22'),'as':_0x3d49('0x23')}]}});};exports['getSmsAccountById']=function(_0x29240e){return request(_0x3d49('0x24'),{'options':{'where':{'id':_0x29240e},'attributes':['id',_0x3d49('0x9')]}});};exports[_0x3d49('0x25')]=function(_0x2125ee){return request('CreateSmsMessage',{'body':_0x2125ee});};exports[_0x3d49('0x26')]=function(_0xed879c){return request('CreateSquareDetailsReport',{'body':_0xed879c});};exports['createSquareReport']=function(_0x1b87af){return request(_0x3d49('0x27'),{'body':_[_0x3d49('0x28')](_0x1b87af,{'project_name':_0x1b87af[_0x3d49('0x29')],'prev_project_name':_0x1b87af[_0x3d49('0x2a')]||'','is_subproject':_0x1b87af[_0x3d49('0x2a')]?!![]:![],'leaveAt':moment()['format'](_0x3d49('0x2b'))})});};exports['createSquareRecording']=function(_0x353f92){return request('CreateSquareRecording',{'body':_0x353f92});};exports[_0x3d49('0x2c')]=function(_0x1bc6d3){return request('CreateSquareMessage',{'body':_0x1bc6d3});};exports[_0x3d49('0x2d')]=function(_0x125b52){return request(_0x3d49('0x2e'),{'options':{'raw':![],'where':{'phone':_0x125b52[_0x3d49('0x2f')],'ListId':_0x125b52[_0x3d49('0x30')]}}})[_0x3d49('0x31')](function(_0xccc754){if(_0xccc754){return _0xccc754;}return request('CreateCmContact',{'body':_0x125b52});});};exports[_0x3d49('0x32')]=function(_0x2fb486){return request(_0x3d49('0x33'),{'options':{'where':{'id':_0x2fb486},'attributes':[_0x3d49('0x9')]}});};exports[_0x3d49('0x34')]=function(_0x1d90c4,_0x421aa4){return request(_0x3d49('0x35'),{'body':{'interface':_0x421aa4},'options':{'where':_0x1d90c4}});};exports[_0x3d49('0x36')]=function(_0x371eef,_0x2bfbdc,_0x28bb85){return request('PauseUser',{'body':{'type':_0x2bfbdc,'uniqueid':_0x28bb85},'options':{'where':_0x371eef}});};exports[_0x3d49('0x37')]=function(_0x4056c1){return request(_0x3d49('0x38'),{'body':{},'options':{'where':_0x4056c1}});};exports['agentLogout']=function(_0x450160){return request('LogoutUser',{'body':{},'options':{'where':_0x450160}});}; \ No newline at end of file +var _0x8388=['dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','request','error','message','result','catch','getSquareProjects','production','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc'];(function(_0x114749,_0x9b572a){var _0x499080=function(_0x564790){while(--_0x564790){_0x114749['push'](_0x114749['shift']());}};_0x499080(++_0x9b572a);}(_0x8388,0x18d));var _0x8838=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0x8388[_0x586fa2];return _0x515be9;};'use strict';var _=require(_0x8838('0x0'));var moment=require(_0x8838('0x1'));var jayson=require(_0x8838('0x2'));var client=jayson[_0x8838('0x3')]['http']({'port':0x2329});function request(_0x140ee6,_0x3dbcd4){return new Promise(function(_0x316297,_0x20a813){return client[_0x8838('0x4')](_0x140ee6,_0x3dbcd4)['then'](function(_0x303377){if(_0x303377[_0x8838('0x5')]){return _0x20a813(_0x303377['error'][_0x8838('0x6')]);}else{return _0x316297(_0x303377[_0x8838('0x7')]);}})[_0x8838('0x8')](function(_0x56596f){return _0x20a813(_0x56596f);});});}exports[_0x8838('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name',_0x8838('0xa')]}});};exports['getSquareProject']=function(_0x4aedc9){return request(_0x8838('0xb'),{'options':{'raw':![],'where':{'name':_0x4aedc9},'attributes':[_0x8838('0xa')]}});};exports[_0x8838('0xc')]=function(_0x35096b){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x35096b},'include':[{'model':_0x8838('0xd'),'as':_0x8838('0xe'),'include':[{'model':_0x8838('0xf'),'as':_0x8838('0xf')}]}],'attributes':['id','name',_0x8838('0x10')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x530bac){return request(_0x8838('0xb'),{'options':{'where':{'id':_0x530bac},'attributes':[_0x8838('0x11')]}});};exports[_0x8838('0x12')]=function(_0x43b446){return request(_0x8838('0x13'),{'options':{'where':{'id':_0x43b446},'attributes':[_0x8838('0x11')]}});};exports[_0x8838('0x14')]=function(_0x8daaab){return request('ShowVariable',{'options':{'where':{'id':_0x8daaab},'attributes':[_0x8838('0x11')]}});};exports[_0x8838('0x15')]=function(_0x5eecf2){return request(_0x8838('0x16'),{'options':{'where':{'id':_0x5eecf2},'attributes':[_0x8838('0x17')]}});};exports[_0x8838('0x18')]=function(_0x4d0c2e){return request(_0x8838('0x19'),{'options':{'where':{'id':_0x4d0c2e},'attributes':['name']}});};exports[_0x8838('0x1a')]=function(_0x204120){return request(_0x8838('0x1b'),{'options':{'where':{'phone':_0x204120['phone']},'attributes':['id']}});};exports[_0x8838('0x1c')]=function(_0x7b836e){return request('ShowTrunk',{'options':{'where':{'id':_0x7b836e},'attributes':[_0x8838('0x11')]}});};exports[_0x8838('0x1d')]=function(_0x4c5bed){return request(_0x8838('0x1e'),{'options':{'where':{'id':_0x4c5bed},'attributes':[_0x8838('0x1f')]}});};exports['getIntervalById']=function(_0x55ccbc){return request(_0x8838('0x20'),{'options':{'raw':![],'where':{'id':_0x55ccbc},'include':[{'model':_0x8838('0x21'),'as':_0x8838('0x22')}]}});};exports[_0x8838('0x23')]=function(_0x109341){return request(_0x8838('0x24'),{'options':{'where':{'id':_0x109341},'attributes':['id',_0x8838('0x11')]}});};exports[_0x8838('0x25')]=function(_0x46b603){return request('CreateSmsMessage',{'body':_0x46b603});};exports[_0x8838('0x26')]=function(_0x584779){return request(_0x8838('0x27'),{'body':_0x584779});};exports[_0x8838('0x28')]=function(_0x4c58a1){return request('CreateSquareReport',{'body':_[_0x8838('0x29')](_0x4c58a1,{'project_name':_0x4c58a1[_0x8838('0x2a')],'prev_project_name':_0x4c58a1[_0x8838('0x2b')]||'','is_subproject':_0x4c58a1[_0x8838('0x2b')]?!![]:![],'leaveAt':moment()[_0x8838('0x2c')](_0x8838('0x2d'))})});};exports[_0x8838('0x2e')]=function(_0x1fe141){return request(_0x8838('0x2f'),{'body':_0x1fe141});};exports[_0x8838('0x30')]=function(_0x5921eb){return request('CreateSquareMessage',{'body':_0x5921eb});};exports[_0x8838('0x31')]=function(_0x52907a){return request(_0x8838('0x32'),{'options':{'raw':![],'where':{'phone':_0x52907a[_0x8838('0x33')],'ListId':_0x52907a['ListId']}}})['then'](function(_0x2ac2b1){if(_0x2ac2b1){return _0x2ac2b1;}return request('CreateCmContact',{'body':_0x52907a});});};exports['getPauseById']=function(_0x1b605d){return request(_0x8838('0x34'),{'options':{'where':{'id':_0x1b605d},'attributes':['name']}});};exports[_0x8838('0x35')]=function(_0x296ba1,_0x4d8007){return request(_0x8838('0x36'),{'body':{'interface':_0x4d8007},'options':{'where':_0x296ba1}});};exports[_0x8838('0x37')]=function(_0x229aef,_0xdd28e2,_0x508ed4){return request(_0x8838('0x38'),{'body':{'type':_0xdd28e2,'uniqueid':_0x508ed4},'options':{'where':_0x229aef}});};exports[_0x8838('0x39')]=function(_0x4a263b){return request('UnpauseUser',{'body':{},'options':{'where':_0x4a263b}});};exports[_0x8838('0x3a')]=function(_0x5f5890){return request(_0x8838('0x3b'),{'body':{},'options':{'where':_0x5f5890}});}; \ 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 91cd696..34a47d5 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 _0xcbd3=['./lex','exports','./polly'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0xcbd3,0x1eb));var _0x3cbd=function(_0x4c825e,_0x271eb1){_0x4c825e=_0x4c825e-0x0;var _0x3c18c2=_0xcbd3[_0x4c825e];return _0x3c18c2;};var polly=require(_0x3cbd('0x0'));var lex=require(_0x3cbd('0x1'));module[_0x3cbd('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xc492=['./lex','exports','./polly'];(function(_0x5e0bfe,_0x747312){var _0x6468b8=function(_0x20e5e0){while(--_0x20e5e0){_0x5e0bfe['push'](_0x5e0bfe['shift']());}};_0x6468b8(++_0x747312);}(_0xc492,0xd7));var _0x2c49=function(_0xa420c8,_0x3cde78){_0xa420c8=_0xa420c8-0x0;var _0x32d536=_0xc492[_0xa420c8];return _0x32d536;};var polly=require(_0x2c49('0x0'));var lex=require(_0x2c49('0x1'));module[_0x2c49('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 4c5fe80..c7ca254 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 _0x702d=['exports','./lib/api'];(function(_0x2d7368,_0x17478e){var _0x5a0eee=function(_0x3305d0){while(--_0x3305d0){_0x2d7368['push'](_0x2d7368['shift']());}};_0x5a0eee(++_0x17478e);}(_0x702d,0x147));var _0xd702=function(_0x2a0b71,_0x418be3){_0x2a0b71=_0x2a0b71-0x0;var _0x3cc758=_0x702d[_0x2a0b71];return _0x3cc758;};'use strict';var lex=require(_0xd702('0x0'));module[_0xd702('0x1')]=function(_0x37c2c5,_0x33e7c5,_0x37ed5c,_0x5c2b9e,_0x20c11a,_0xebbd7c){return lex(_0x37c2c5,_0x33e7c5,_0x37ed5c,_0x5c2b9e,_0x20c11a,_0xebbd7c);}; \ No newline at end of file +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(_0x3866a0,_0x501e9a){_0x3866a0=_0x3866a0-0x0;var _0x4de61c=_0x6324[_0x3866a0];return _0x4de61c;};'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 diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index bea997f..365b4e3 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(_0xf4ba18,_0x552ab6){var _0x15fd2f=function(_0x5d680f){while(--_0x5d680f){_0xf4ba18['push'](_0xf4ba18['shift']());}};_0x15fd2f(++_0x552ab6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x4950f3,_0x322f5d){var _0x9bef71=function(_0x381f03){while(--_0x381f03){_0x4950f3['push'](_0x4950f3['shift']());}};_0x9bef71(++_0x322f5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 cf44a80..8df7fd0 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 _0x3095=['exports','./lib/api'];(function(_0x3abe27,_0xf7f784){var _0x4ca32a=function(_0x2b9ccd){while(--_0x2b9ccd){_0x3abe27['push'](_0x3abe27['shift']());}};_0x4ca32a(++_0xf7f784);}(_0x3095,0x9d));var _0x5309=function(_0x4e96d8,_0x20304f){_0x4e96d8=_0x4e96d8-0x0;var _0x5cb02d=_0x3095[_0x4e96d8];return _0x5cb02d;};'use strict';var polly=require(_0x5309('0x0'));module[_0x5309('0x1')]=function(_0x2ad129,_0x3110c1,_0x53d5c4,_0x1f5b61,_0x2fb6a7,_0x197c68,_0x1bd784){return polly(_0x2ad129,_0x3110c1,_0x53d5c4,_0x1f5b61,_0x2fb6a7,_0x197c68,_0x1bd784);}; \ No newline at end of file +var _0x2d1e=['./lib/api'];(function(_0x4070af,_0x18615b){var _0x15e8a1=function(_0x36ae74){while(--_0x36ae74){_0x4070af['push'](_0x4070af['shift']());}};_0x15e8a1(++_0x18615b);}(_0x2d1e,0x17b));var _0xe2d1=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2d1e[_0x5b644e];return _0x49c6bf;};'use strict';var polly=require(_0xe2d1('0x0'));module['exports']=function(_0x51ce29,_0x5a7985,_0xadb40e,_0x42dfe6,_0x21a4bc,_0x28d43f,_0xd9eafa){return polly(_0x51ce29,_0x5a7985,_0xadb40e,_0x42dfe6,_0x21a4bc,_0x28d43f,_0xd9eafa);}; \ 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 6b0f6dc..0a30cf3 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 _0x14f5=['Polly','mp3','path','aws-sdk','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x14f5,0x68));var _0x514f=function(_0x353e55,_0x384e65){_0x353e55=_0x353e55-0x0;var _0xe1646a=_0x14f5[_0x353e55];return _0xe1646a;};'use strict';var fs=require('fs');var path=require(_0x514f('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0x514f('0x1'));function pollyResult(_0x597d08,_0x2acbd4,_0x38b75c){return new BPromise(function(_0x2cf66d,_0xacee04){_0x597d08['synthesizeSpeech'](_0x2acbd4,function(_0x259942,_0xeeb043){if(_0x259942){_0xacee04(_0x259942);}else if(_0xeeb043){if(_0xeeb043['AudioStream']instanceof Buffer){fs[_0x514f('0x2')](_0x38b75c,_0xeeb043['AudioStream'],function(_0x314521){if(_0x314521){_0xacee04(_0x314521);}else{_0x2cf66d();}});}else{_0xacee04(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0xacee04(new Error(_0x514f('0x3')));}});});}module['exports']=function(_0x5b48bc,_0x538e44,_0x1b900d,_0x3425f6,_0x50477f,_0x186001,_0x3efc26){var _0x578c05=new AWS[(_0x514f('0x4'))]({'accessKeyId':_0x5b48bc,'secretAccessKey':_0x538e44,'region':_0x1b900d});var _0x5c79b1={'Text':_0x50477f,'TextType':_0x186001||'text','OutputFormat':_0x514f('0x5'),'VoiceId':_0x3425f6};return pollyResult(_0x578c05,_0x5c79b1,_0x3efc26);}; \ No newline at end of file +var _0x1093=['mp3','path','bluebird','randomstring','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','text'];(function(_0x3a2246,_0xd434fa){var _0x21ceb3=function(_0x23f878){while(--_0x23f878){_0x3a2246['push'](_0x3a2246['shift']());}};_0x21ceb3(++_0xd434fa);}(_0x1093,0x14a));var _0x3109=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x1093[_0x580576];return _0x3f55a0;};'use strict';var fs=require('fs');var path=require(_0x3109('0x0'));var BPromise=require(_0x3109('0x1'));var rs=require(_0x3109('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x4eea76,_0x54e707,_0x2e23ec){return new BPromise(function(_0x19303f,_0x2e436e){_0x4eea76['synthesizeSpeech'](_0x54e707,function(_0x25df00,_0x6105f4){if(_0x25df00){_0x2e436e(_0x25df00);}else if(_0x6105f4){if(_0x6105f4[_0x3109('0x3')]instanceof Buffer){fs['writeFile'](_0x2e23ec,_0x6105f4['AudioStream'],function(_0x4aca19){if(_0x4aca19){_0x2e436e(_0x4aca19);}else{_0x19303f();}});}else{_0x2e436e(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x2e436e(new Error(_0x3109('0x4')));}});});}module['exports']=function(_0x18b30d,_0x49a1b3,_0x1e67ca,_0x56e090,_0x4e1736,_0xf5d978,_0x117af5){var _0xd3be22=new AWS['Polly']({'accessKeyId':_0x18b30d,'secretAccessKey':_0x49a1b3,'region':_0x1e67ca});var _0x36211a={'Text':_0x4e1736,'TextType':_0xf5d978||_0x3109('0x5'),'OutputFormat':_0x3109('0x6'),'VoiceId':_0x56e090};return pollyResult(_0xd3be22,_0x36211a,_0x117af5);}; \ 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 0d092b5..b1764ea 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 _0x9082=['./lib/api'];(function(_0x44b694,_0x195b96){var _0x3fd117=function(_0x3bd3db){while(--_0x3bd3db){_0x44b694['push'](_0x44b694['shift']());}};_0x3fd117(++_0x195b96);}(_0x9082,0xaf));var _0x2908=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0x9082[_0x333798];return _0x389f4e;};'use strict';var asr=require(_0x2908('0x0'));module['exports']=function(_0x96721f,_0x27bbec,_0x210889,_0x464348){return asr(_0x96721f,_0x27bbec,_0x210889);}; \ No newline at end of file +var _0x16c9=['./lib/api'];(function(_0x114120,_0x4ea78a){var _0x4e8d0b=function(_0x3f79ed){while(--_0x3f79ed){_0x114120['push'](_0x114120['shift']());}};_0x4e8d0b(++_0x4ea78a);}(_0x16c9,0x170));var _0x916c=function(_0x463688,_0x56fcc3){_0x463688=_0x463688-0x0;var _0x3a4a06=_0x16c9[_0x463688];return _0x3a4a06;};'use strict';var asr=require(_0x916c('0x0'));module['exports']=function(_0x1b92ac,_0x2b41c9,_0x3318e0,_0x3365eb){return asr(_0x1b92ac,_0x2b41c9,_0x3318e0);}; \ 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 280dbef..2174c06 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 _0x579c=['undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x51e782,_0x2123b0){var _0x82eedc=function(_0x2a63a5){while(--_0x2a63a5){_0x51e782['push'](_0x51e782['shift']());}};_0x82eedc(++_0x2123b0);}(_0x579c,0xda));var _0xc579=function(_0x2b5182,_0x1f0ac0){_0x2b5182=_0x2b5182-0x0;var _0x2c8a4d=_0x579c[_0x2b5182];return _0x2c8a4d;};'use strict';var url=require(_0xc579('0x0'));var BPromise=require(_0xc579('0x1'));var fs=require('fs');var host=_0xc579('0x2');module[_0xc579('0x3')]=function(_0x397136,_0x586948,_0x1e2808){return new BPromise(function(_0x5399d7,_0x21a0a2){var _0x3b913c;if(typeof _0x397136!==_0xc579('0x4')||_0x397136[_0xc579('0x5')]===0x0){return _0x21a0a2(_0xc579('0x6'));}if(typeof _0x586948!==_0xc579('0x4')||_0x586948[_0xc579('0x5')]===0x0){return _0x21a0a2('key\x20should\x20be\x20a\x20string');}if(typeof _0x1e2808!==_0xc579('0x7')&&(typeof _0x1e2808!==_0xc579('0x4')||_0x1e2808[_0xc579('0x5')]===0x0)){return _0x21a0a2(_0xc579('0x8'));}try{_0x3b913c=fs[_0xc579('0x9')](_0x397136)[_0xc579('0xa')](_0xc579('0xb'));}catch(_0xf9847f){return _0x21a0a2(_0xf9847f);}return _0x5399d7({'method':'POST','uri':host+_0xc579('0xc')+_0x586948,'body':{'config':{'encoding':_0xc579('0xd'),'sampleRateHertz':_0xc579('0xe'),'languageCode':_0x1e2808},'audio':{'content':_0x3b913c}},'json':!![]});});}; \ No newline at end of file +var _0x4c6d=['string','length','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x46e48f,_0x1aa884){var _0xbcc8a=function(_0x34864c){while(--_0x34864c){_0x46e48f['push'](_0x46e48f['shift']());}};_0xbcc8a(++_0x1aa884);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x709b5b,_0x38944b){_0x709b5b=_0x709b5b-0x0;var _0x3400ac=_0x4c6d[_0x709b5b];return _0x3400ac;};'use strict';var url=require(_0xd4c6('0x0'));var BPromise=require(_0xd4c6('0x1'));var fs=require('fs');var host=_0xd4c6('0x2');module[_0xd4c6('0x3')]=function(_0x350cc0,_0x5448bc,_0x209f99){return new BPromise(function(_0x60355c,_0x306766){var _0x4b2d75;if(typeof _0x350cc0!==_0xd4c6('0x4')||_0x350cc0[_0xd4c6('0x5')]===0x0){return _0x306766('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x5448bc!==_0xd4c6('0x4')||_0x5448bc[_0xd4c6('0x5')]===0x0){return _0x306766(_0xd4c6('0x6'));}if(typeof _0x209f99!=='undefined'&&(typeof _0x209f99!==_0xd4c6('0x4')||_0x209f99[_0xd4c6('0x5')]===0x0)){return _0x306766(_0xd4c6('0x7'));}try{_0x4b2d75=fs['readFileSync'](_0x350cc0)[_0xd4c6('0x8')](_0xd4c6('0x9'));}catch(_0x249a86){return _0x306766(_0x249a86);}return _0x60355c({'method':'POST','uri':host+_0xd4c6('0xa')+_0x5448bc,'body':{'config':{'encoding':_0xd4c6('0xb'),'sampleRateHertz':_0xd4c6('0xc'),'languageCode':_0x209f99},'audio':{'content':_0x4b2d75}},'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 aa45eae..a2ff496 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 _0xa5cb=['./asr','exports'];(function(_0xa26838,_0x45923f){var _0x497ed9=function(_0x1ae576){while(--_0x1ae576){_0xa26838['push'](_0xa26838['shift']());}};_0x497ed9(++_0x45923f);}(_0xa5cb,0x1c4));var _0xba5c=function(_0x200c46,_0x1edb86){_0x200c46=_0x200c46-0x0;var _0x580f7a=_0xa5cb[_0x200c46];return _0x580f7a;};var asr=require(_0xba5c('0x0'));module[_0xba5c('0x1')]={'asr':asr}; \ No newline at end of file +var _0x34a9=['exports'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x34a9,0x97));var _0x934a=function(_0x376b97,_0x621da3){_0x376b97=_0x376b97-0x0;var _0x55ec6a=_0x34a9[_0x376b97];return _0x55ec6a;};var asr=require('./asr');module[_0x934a('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index a31d921..bc1e6fd 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 _0xdf30=['download\x20error','pipe','end','https:','data','transcode','wav','finish\x20to\x20convert','start','generate','.wav','base64','then','unlink','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','POST','resolve','.mp3','from','audioContent','777','info','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','tmp','writeFileSync','googleASR','asr','uri','results','map','alternatives','transcript','join','googleASR\x20transcription','googleASR\x20confidence','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','confidence','awsPolly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','parse','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','http','https','md5','path','request-promise','randomstring','sox','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','request\x20to\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close'];(function(_0xa059ea,_0x5cb91e){var _0x156a4c=function(_0x1b4717){while(--_0x1b4717){_0xa059ea['push'](_0xa059ea['shift']());}};_0x156a4c(++_0x5cb91e);}(_0xdf30,0xf5));var _0x0df3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf30[_0x3dd15e];return _0x231fd0;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x0df3('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x0df3('0x1'));var https=require(_0x0df3('0x2'));var md5=require(_0x0df3('0x3'));var path=require(_0x0df3('0x4'));var querystring=require('querystring');var rp=require(_0x0df3('0x5'));var rs=require(_0x0df3('0x6'));var sox=require(_0x0df3('0x7'));var tts=require('google-tts-api');var urlParse=require('url')['parse'];var util=require(_0x0df3('0x8'));var aws=require(_0x0df3('0x9'));var google=require(_0x0df3('0xa'));var sestek=require(_0x0df3('0xb'));var tilde=require('./tilde');var logger=require(_0x0df3('0xc'))(_0x0df3('0xd'));var ISPEECH_API=_0x0df3('0xe');function downloadFile(_0x4628fd,_0x236b91){return new BPromise(function(_0x2cb799,_0x49ecdf){var _0x2949af=urlParse(_0x4628fd);var _0x1cef76=_0x2949af['protocol']==='https:'?https:http;var _0x4ba272={'host':_0x2949af[_0x0df3('0xf')],'path':_0x2949af[_0x0df3('0x4')],'headers':{'user-agent':_0x0df3('0x10')}};_0x1cef76[_0x0df3('0x11')](_0x4ba272,function(_0x194775){if(_0x194775[_0x0df3('0x12')]!==0xc8){logger[_0x0df3('0x13')]('request\x20to\x20'+_0x4628fd+_0x0df3('0x14')+_0x194775['statusCode']+'\x20('+_0x194775['statusMessage']+')');_0x49ecdf(new Error(_0x0df3('0x15')+_0x4628fd+_0x0df3('0x14')+_0x194775[_0x0df3('0x12')]+'\x20('+_0x194775[_0x0df3('0x16')]+')'));return;}var _0xc6b804=fs[_0x0df3('0x17')](_0x236b91);_0xc6b804['on'](_0x0df3('0x18'),function(){logger['info'](_0x0df3('0x19'));_0xc6b804[_0x0df3('0x1a')](_0x2cb799);});_0xc6b804['on']('error',function(_0x540c4e){fs['unlink'](_0x236b91);logger[_0x0df3('0x13')](_0x0df3('0x1b'),_0x540c4e);_0x49ecdf(_0x540c4e);});_0x194775[_0x0df3('0x1c')](_0xc6b804);})['on'](_0x0df3('0x13'),function(_0x2c6133){logger['error'](_0x2c6133);_0x49ecdf(_0x2c6133);})[_0x0df3('0x1d')]();});}function uploadFile(_0x2173c9){return new BPromise(function(_0x55fb74,_0x55411d){var _0x10098b=urlParse(_0x2173c9);var _0x47709e=_0x10098b['protocol']===_0x0df3('0x1e')?https:http;var _0x3b3b82={'host':_0x10098b['host'],'path':_0x10098b[_0x0df3('0x4')],'headers':{'user-agent':_0x0df3('0x10')}};_0x47709e['get'](_0x3b3b82,function(_0x3f6fc8){if(_0x3f6fc8['statusCode']!==0xc8){_0x55411d(new Error(_0x0df3('0x15')+_0x2173c9+'\x20failed,\x20status\x20code\x20=\x20'+_0x3f6fc8['statusCode']+'\x20('+_0x3f6fc8[_0x0df3('0x16')]+')'));return;}var _0x288653='';_0x3f6fc8['on'](_0x0df3('0x1f'),function(_0x4ec4e6){_0x288653+=_0x4ec4e6;});_0x3f6fc8['on']('end',function(){_0x55fb74(_0x288653);});})['on'](_0x0df3('0x13'),function(_0x11eccc){_0x55411d(_0x11eccc);})[_0x0df3('0x1d')]();});}function convertFile(_0x597f25,_0x41c012){return new BPromise(function(_0x2b3ab5,_0x541dc4){var _0x4bfb30=sox[_0x0df3('0x20')](_0x597f25,_0x41c012,{'sampleRate':0x1f40,'format':_0x0df3('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4bfb30['on'](_0x0df3('0x13'),function(_0x2c7f31){logger[_0x0df3('0x13')]('error\x20convert',_0x2c7f31);_0x541dc4(_0x2c7f31);});_0x4bfb30['on'](_0x0df3('0x1d'),function(){logger['info'](_0x0df3('0x22'));_0x2b3ab5();});_0x4bfb30[_0x0df3('0x23')]();});}function base64Decode(_0x5a9e9f,_0x105ef7){var _0x3505b7=path['resolve'](__dirname,'tmp',rs[_0x0df3('0x24')](0x4)+_0x0df3('0x25'));fs['writeFileSync'](_0x3505b7,_0x5a9e9f,_0x0df3('0x26'));return convertFile(_0x3505b7,_0x105ef7)[_0x0df3('0x27')](function(){try{fs[_0x0df3('0x28')](_0x3505b7);fs[_0x0df3('0x29')](_0x105ef7,'777');}catch(_0x1a174c){logger[_0x0df3('0x13')](_0x1a174c);}return _0x105ef7[_0x0df3('0x2a')]('.')[0x0];});}function base64Encode(_0x4ded30){var _0x456534=fs[_0x0df3('0x2b')](_0x4ded30);return new Buffer(_0x456534)[_0x0df3('0x2c')](_0x0df3('0x26'));}exports[_0x0df3('0x2d')]=function(_0x39defc,_0x46677c,_0x36c0cb,_0x21a0c7,_0x11b64c,_0x47230f){var _0x3c2e31,_0x290b9a;var _0x298443=_0x0df3('0x2e');var _0x8ac5b1=_0x0df3('0x2f')+_0x39defc;var _0xa2306f={};if(_0x46677c===_0x0df3('0x30')){_0xa2306f[_0x0df3('0x31')]={'ssml':_0x36c0cb};}else{_0xa2306f[_0x0df3('0x31')]={'text':_0x36c0cb};};_0xa2306f['voice']={'languageCode':_0x21a0c7,'ssmlGender':_0x11b64c};_0xa2306f[_0x0df3('0x32')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x248282={'url':_0x298443+'text:synthesize'+_0x8ac5b1,'method':_0x0df3('0x33'),'json':!![],'body':_0xa2306f};return rp(_0x248282)['then'](function(_0x3cade1){return new BPromise(function(_0x10af4,_0xa388f9){_0x3c2e31=path[_0x0df3('0x34')](__dirname,'tmp',rs[_0x0df3('0x24')](0x4)+_0x0df3('0x35'));var _0x57cb6a=Buffer[_0x0df3('0x36')](_0x3cade1[_0x0df3('0x37')],_0x0df3('0x26'));return fs['writeFile'](_0x3c2e31,_0x57cb6a,function(_0x581293){_0xa388f9(_0x581293);},function(_0x569ded){fs[_0x0df3('0x29')](_0x3c2e31,_0x0df3('0x38'));_0x10af4(_0x569ded);});});})['then'](function(_0x2fe364){_0x290b9a=path[_0x0df3('0x34')](__dirname,'tmp',rs[_0x0df3('0x24')](0x4)+_0x0df3('0x25'));return convertFile(_0x3c2e31,_0x290b9a);})[_0x0df3('0x27')](function(){try{fs[_0x0df3('0x28')](_0x3c2e31);fs[_0x0df3('0x29')](_0x290b9a,'777');}catch(_0x59bc05){logger[_0x0df3('0x13')](_0x59bc05);}logger[_0x0df3('0x39')](_0x0df3('0x3a'),_0x290b9a[_0x0df3('0x2a')]('.')[0x0]);return _0x290b9a[_0x0df3('0x2a')]('.')[0x0];});};exports[_0x0df3('0x3b')]=function(_0x3deefd,_0x261347){var _0xc19a11='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x39c425,_0x222021;var _0x3b5563;var _0x3ea9db={'encoding':_0x0df3('0x3c'),'method':_0x0df3('0x33'),'timeout':0x2710,'url':_0xc19a11,'headers':{'Content-Type':_0x0df3('0x3d')},'body':_0x0df3('0x3e')+encodeURIComponent(JSON[_0x0df3('0x3f')]([[[_0x0df3('0x40'),JSON[_0x0df3('0x3f')]([_0x3deefd,_0x261347||'en',![],_0x0df3('0x41')]),null,'generic']]]))};return rp(_0x3ea9db)[_0x0df3('0x27')](function(_0x1c20a2){try{_0x3b5563=eval(_0x1c20a2[_0x0df3('0x42')](0x5))[0x0][0x2];}catch(_0x4525ca){throw new Error(_0x0df3('0x43')+_0x1c20a2[_0x0df3('0x1f')]);}if(!_0x3b5563){if(_0x3deefd[_0x0df3('0x44')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x0df3('0x45')+_0x261347+_0x0df3('0x46'));}}try{_0x3b5563=eval(_0x3b5563)[0x0];}catch(_0x36540a){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x0df3('0x1f')]);}const _0x17e7ef=_0x3b5563;_0x39c425=path[_0x0df3('0x34')](__dirname,_0x0df3('0x47'),rs[_0x0df3('0x24')](0x4)+_0x0df3('0x35'));fs[_0x0df3('0x48')](_0x39c425,_0x3b5563,{'encoding':'base64'});_0x222021=path['resolve'](__dirname,_0x0df3('0x47'),rs['generate'](0x4)+'.wav');return convertFile(_0x39c425,_0x222021);})['then'](function(){try{fs[_0x0df3('0x28')](_0x39c425);fs[_0x0df3('0x29')](_0x222021,'777');}catch(_0x11e4c0){logger[_0x0df3('0x13')](_0x11e4c0);}logger[_0x0df3('0x39')]('goggleTTS\x20path',_0x222021[_0x0df3('0x2a')]('.')[0x0]);return _0x222021[_0x0df3('0x2a')]('.')[0x0];});};exports[_0x0df3('0x49')]=function(_0x3cd4ed,_0x32b82a,_0x1ada27){return google[_0x0df3('0x4a')](_0x3cd4ed,_0x32b82a,_0x1ada27)[_0x0df3('0x27')](function(_0x33ed04){logger[_0x0df3('0x39')](_0x33ed04[_0x0df3('0x4b')]);return rp(_0x33ed04);})[_0x0df3('0x27')](function(_0x484280){var _0x21b161='';var _0x5a9273=0x0;try{fs[_0x0df3('0x28')](_0x3cd4ed);}catch(_0x14ff22){logger[_0x0df3('0x13')](_0x14ff22);}if(_0x484280&&_0x484280['results']){_0x21b161=_0x484280[_0x0df3('0x4c')][_0x0df3('0x4d')](function(_0x3c0bf6){return _0x3c0bf6&&_0x3c0bf6[_0x0df3('0x4e')][0x0]&&_0x3c0bf6['alternatives'][0x0][_0x0df3('0x4f')]?_0x3c0bf6[_0x0df3('0x4e')][0x0]['transcript']:'';})['join']('\x0a');_0x5a9273=_0x484280[_0x0df3('0x4c')][_0x0df3('0x4d')](function(_0x461a03){return _0x461a03&&_0x461a03[_0x0df3('0x4e')][0x0]&&_0x461a03[_0x0df3('0x4e')][0x0]['confidence']?_0x461a03['alternatives'][0x0]['confidence']:0x0;})[_0x0df3('0x50')]('\x0a');}logger['info'](_0x0df3('0x51'),_0x21b161);logger['info'](_0x0df3('0x52'),_0x5a9273);return{'transcript':_0x21b161,'confidence':_0x5a9273};})['catch'](function(_0x1efd3e){logger[_0x0df3('0x13')]('[%s]\x20%s:%s',_0x1efd3e[_0x0df3('0x12')],_0x1efd3e[_0x0df3('0x53')],_0x1efd3e[_0x0df3('0x54')]);});};exports[_0x0df3('0x55')]=function(_0x5488db,_0xfbae07,_0x38103b,_0x948150){var _0x5b1040=apiai(_0xfbae07,{'language':_0x948150||'en'});return _0x5b1040[_0x0df3('0x56')](_0x38103b,{'sessionId':md5(_0x5488db)})['then'](function(_0x1cd8d0){logger[_0x0df3('0x39')](JSON['stringify'](_0x1cd8d0));return{'source':_0x1cd8d0[_0x0df3('0x57')][_0x0df3('0x58')],'resolvedQuery':_0x1cd8d0[_0x0df3('0x57')][_0x0df3('0x59')],'action':_0x1cd8d0[_0x0df3('0x57')]['action'],'actionIncomplete':_0x1cd8d0[_0x0df3('0x57')][_0x0df3('0x5a')],'speech':_0x1cd8d0[_0x0df3('0x57')][_0x0df3('0x5b')][_0x0df3('0x5c')],'score':_0x1cd8d0['result'][_0x0df3('0x5d')],'statusCode':_0x1cd8d0[_0x0df3('0x5e')][_0x0df3('0x5f')],'endConversation':_0x1cd8d0['result'][_0x0df3('0x60')][_0x0df3('0x61')]||![],'isFallbackIntent':_0x1cd8d0[_0x0df3('0x57')][_0x0df3('0x60')][_0x0df3('0x62')]};});};exports[_0x0df3('0x63')]=function(_0x5093b1,_0x511fb1,_0x4f3d2b,_0x1ca4c9,_0x3be7da,_0x20d8cb){var _0x3bec20=_0x1ca4c9[_0x0df3('0x64')](/\\n/g,'\x0a');var _0x18eb64={'credentials':{'private_key':_0x3bec20,'client_email':_0x4f3d2b}};var _0xfc9849=new dialogflow[(_0x0df3('0x65'))](_0x18eb64);var _0x229109=_0xfc9849[_0x0df3('0x66')](_0x511fb1,md5(_0x5093b1));var _0x17fa57={'session':_0x229109,'queryInput':{'text':{'text':_0x3be7da,'languageCode':_0x20d8cb}}};return _0xfc9849[_0x0df3('0x67')](_0x17fa57)[_0x0df3('0x27')](function(_0x18d0aa){if(_0x18d0aa&&_0x18d0aa[_0x0df3('0x44')]){logger[_0x0df3('0x39')](_0x0df3('0x68'),JSON[_0x0df3('0x3f')](_0x18d0aa));var _0x53c11f=_0x18d0aa[0x0];if(_0x53c11f){var _0x536634={'action':_0x53c11f[_0x0df3('0x69')][_0x0df3('0x6a')],'allRequiredParamsPresent':_0x53c11f[_0x0df3('0x69')]['allRequiredParamsPresent'],'endConversation':_0x53c11f[_0x0df3('0x69')][_0x0df3('0x6b')]&&_0x53c11f[_0x0df3('0x69')][_0x0df3('0x6b')][_0x0df3('0x6c')]?_0x53c11f[_0x0df3('0x69')]['diagnosticInfo']['fields'][_0x0df3('0x6d')][_0x0df3('0x6e')]:![],'fulfillmentText':_0x53c11f['queryResult']['fulfillmentText'],'intentName':_0x53c11f[_0x0df3('0x69')][_0x0df3('0x6f')][_0x0df3('0x53')],'intentDisplayName':_0x53c11f[_0x0df3('0x69')][_0x0df3('0x6f')][_0x0df3('0x70')],'isFallbackIntent':_0x53c11f[_0x0df3('0x69')][_0x0df3('0x6f')]['isFallback'],'languageCode':_0x53c11f[_0x0df3('0x69')]['languageCode'],'queryText':_0x53c11f[_0x0df3('0x69')][_0x0df3('0x71')],'responseId':_0x53c11f[_0x0df3('0x72')],'score':_0x53c11f[_0x0df3('0x69')][_0x0df3('0x73')],'speech':_0x53c11f['queryResult'][_0x0df3('0x74')],'providerResponse':JSON[_0x0df3('0x3f')](_0x18d0aa)};return _0x536634;}}});};exports[_0x0df3('0x75')]=function(_0x224eb1,_0x4c03b2,_0xedff5b,_0x458502){return tilde[_0x0df3('0x4a')](_0x224eb1,_0x4c03b2,_0xedff5b,_0x458502)[_0x0df3('0x27')](function(_0x226fca){try{fs[_0x0df3('0x28')](_0x224eb1);}catch(_0xbb9c38){logger[_0x0df3('0x13')](_0xbb9c38);}logger[_0x0df3('0x39')](_0x0df3('0x76'),_0x226fca[_0x0df3('0x4f')]);logger['info']('Tilde\x20ASR\x20confidence',_0x226fca[_0x0df3('0x77')]);return _0x226fca;});};exports[_0x0df3('0x78')]=function(_0x308399,_0x1a5401,_0x56c873,_0x2a52d1,_0x23cbdf,_0x2a8a73){var _0x37c003=path[_0x0df3('0x34')](__dirname,'tmp',rs[_0x0df3('0x24')](0x4)+_0x0df3('0x35'));var _0x36a82d;return aws['polly'](_0x308399,_0x1a5401,_0x56c873,_0x2a52d1,_0x23cbdf,_0x2a8a73,_0x37c003)[_0x0df3('0x27')](function(){_0x36a82d=path[_0x0df3('0x34')](__dirname,_0x0df3('0x47'),rs[_0x0df3('0x24')](0x4)+_0x0df3('0x25'));return convertFile(_0x37c003,_0x36a82d);})[_0x0df3('0x27')](function(){try{fs[_0x0df3('0x28')](_0x37c003);fs[_0x0df3('0x29')](_0x36a82d,_0x0df3('0x38'));}catch(_0x27934f){logger['error'](_0x27934f);}return _0x36a82d['split']('.')[0x0];});};exports[_0x0df3('0x79')]=function(_0x5a349c,_0xa00fcf,_0x48af0e,_0x4fe8a6,_0xa7d1f5,_0x7ebaee){return aws[_0x0df3('0x7a')](_0x5a349c,_0xa00fcf,_0x48af0e,_0x4fe8a6,_0xa7d1f5,_0x7ebaee)[_0x0df3('0x27')](function(_0x76c34f){logger['info'](JSON[_0x0df3('0x3f')](_0x76c34f));return _0x76c34f;});};exports[_0x0df3('0x7b')]=function(_0x405d81,_0xe26a76,_0x60a27b,_0x5bf215){var _0x2c6d2d=util[_0x0df3('0x7c')](_0x0df3('0x7d'),ISPEECH_API,_0x405d81,encodeURIComponent(_0xe26a76),_0x60a27b,_0x5bf215);var _0x1dedfc=path['resolve'](__dirname,'tmp',rs[_0x0df3('0x24')](0x4)+_0x0df3('0x35'));var _0x2c0ab0;return downloadFile(_0x2c6d2d,_0x1dedfc)[_0x0df3('0x27')](function(){_0x2c0ab0=path['resolve'](__dirname,_0x0df3('0x47'),rs[_0x0df3('0x24')](0x4)+_0x0df3('0x25'));return convertFile(_0x1dedfc,_0x2c0ab0);})[_0x0df3('0x27')](function(){try{fs[_0x0df3('0x28')](_0x1dedfc);fs[_0x0df3('0x29')](_0x2c0ab0,_0x0df3('0x38'));}catch(_0x3d56e4){logger[_0x0df3('0x13')](_0x3d56e4);}return _0x2c0ab0[_0x0df3('0x2a')]('.')[0x0];});};exports['ispeechASR']=function(_0x62907d,_0x1c7f72,_0x466fbf,_0xafd984){var _0x5b2cd5=util[_0x0df3('0x7c')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1c7f72,_0x466fbf,base64Encode(_0x62907d),_0xafd984?util[_0x0df3('0x7c')](_0x0df3('0x7e'),encodeURIComponent(_0xafd984)):'freeform=3');return uploadFile(_0x5b2cd5)['then'](function(_0x29663a){return querystring[_0x0df3('0x7f')](_0x29663a);});};exports['sestekNDA']=function(_0x6e7250,_0x1b8d65){return sestek[_0x0df3('0x80')](_0x6e7250,_0x1b8d65)[_0x0df3('0x27')](function(_0x5c2ae8){logger[_0x0df3('0x39')](JSON[_0x0df3('0x3f')](_0x5c2ae8));var _0x2d5745={'speech':_0x5c2ae8[_0x0df3('0x81')],'action':_0x5c2ae8[_0x0df3('0x82')]?_0x5c2ae8[_0x0df3('0x82')]['CustomAction']:undefined,'actiondata':_0x5c2ae8['channelData']?_0x5c2ae8[_0x0df3('0x82')][_0x0df3('0x83')]:undefined};if(_0x5c2ae8[_0x0df3('0x82')]&&_0x5c2ae8['channelData'][_0x0df3('0x84')]){return base64Decode(_0x5c2ae8[_0x0df3('0x82')][_0x0df3('0x84')][_0x0df3('0x85')],path[_0x0df3('0x34')](__dirname,_0x0df3('0x47'),rs[_0x0df3('0x24')](0x4)+_0x0df3('0x25')))[_0x0df3('0x27')](function(_0x180bf6){_0x2d5745[_0x0df3('0x86')]=_0x180bf6;return _0x2d5745;});}return _0x2d5745;});};exports[_0x0df3('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0x8c01=['lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','chmodSync','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','confidence','join','googleASR\x20confidence','catch','message','result','source','resolvedQuery','action','actionIncomplete','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','format','ispeechASR','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','dirName','bluebird','dialogflow','https','path','request-promise','sox','google-tts-api','url','parse','util','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','https:','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','error','unlink','pipe','end','protocol','WHAT_EVER','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','base64','then','777','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','text:synthesize','POST','.mp3','from','audioContent','writeFile','generate','.wav','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c01,0xbc));var _0x18c0=function(_0x1a4681,_0x3a807e){_0x1a4681=_0x1a4681-0x0;var _0x19c301=_0x8c01[_0x1a4681];return _0x19c301;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x18c0('0x0'));var dialogflow=require(_0x18c0('0x1'));var fs=require('fs');var http=require('http');var https=require(_0x18c0('0x2'));var md5=require('md5');var path=require(_0x18c0('0x3'));var querystring=require('querystring');var rp=require(_0x18c0('0x4'));var rs=require('randomstring');var sox=require(_0x18c0('0x5'));var tts=require(_0x18c0('0x6'));var urlParse=require(_0x18c0('0x7'))[_0x18c0('0x8')];var util=require(_0x18c0('0x9'));var aws=require('./aws');var google=require(_0x18c0('0xa'));var sestek=require(_0x18c0('0xb'));var tilde=require(_0x18c0('0xc'));var logger=require(_0x18c0('0xd'))('agi');var ISPEECH_API=_0x18c0('0xe');function downloadFile(_0x20a533,_0x4124bf){return new BPromise(function(_0x198831,_0x461818){var _0x4db863=urlParse(_0x20a533);var _0x3bd5d4=_0x4db863['protocol']===_0x18c0('0xf')?https:http;var _0x17422d={'host':_0x4db863['host'],'path':_0x4db863[_0x18c0('0x3')],'headers':{'user-agent':'WHAT_EVER'}};_0x3bd5d4['get'](_0x17422d,function(_0x2e1081){if(_0x2e1081[_0x18c0('0x10')]!==0xc8){logger['error'](_0x18c0('0x11')+_0x20a533+_0x18c0('0x12')+_0x2e1081['statusCode']+'\x20('+_0x2e1081[_0x18c0('0x13')]+')');_0x461818(new Error('request\x20to\x20'+_0x20a533+_0x18c0('0x12')+_0x2e1081[_0x18c0('0x10')]+'\x20('+_0x2e1081[_0x18c0('0x13')]+')'));return;}var _0x5a1987=fs[_0x18c0('0x14')](_0x4124bf);_0x5a1987['on'](_0x18c0('0x15'),function(){logger[_0x18c0('0x16')]('finish\x20download\x20file');_0x5a1987[_0x18c0('0x17')](_0x198831);});_0x5a1987['on'](_0x18c0('0x18'),function(_0x256663){fs[_0x18c0('0x19')](_0x4124bf);logger[_0x18c0('0x18')]('download\x20error',_0x256663);_0x461818(_0x256663);});_0x2e1081[_0x18c0('0x1a')](_0x5a1987);})['on']('error',function(_0x888c05){logger[_0x18c0('0x18')](_0x888c05);_0x461818(_0x888c05);})[_0x18c0('0x1b')]();});}function uploadFile(_0x215c3e){return new BPromise(function(_0x525024,_0x6bdbf2){var _0x2f980f=urlParse(_0x215c3e);var _0x5802fe=_0x2f980f[_0x18c0('0x1c')]===_0x18c0('0xf')?https:http;var _0x14d20e={'host':_0x2f980f['host'],'path':_0x2f980f['path'],'headers':{'user-agent':_0x18c0('0x1d')}};_0x5802fe['get'](_0x14d20e,function(_0x254873){if(_0x254873['statusCode']!==0xc8){_0x6bdbf2(new Error(_0x18c0('0x11')+_0x215c3e+_0x18c0('0x12')+_0x254873[_0x18c0('0x10')]+'\x20('+_0x254873[_0x18c0('0x13')]+')'));return;}var _0x3d7d67='';_0x254873['on']('data',function(_0x55898c){_0x3d7d67+=_0x55898c;});_0x254873['on'](_0x18c0('0x1b'),function(){_0x525024(_0x3d7d67);});})['on'](_0x18c0('0x18'),function(_0x5bd7c2){_0x6bdbf2(_0x5bd7c2);})[_0x18c0('0x1b')]();});}function convertFile(_0x1a8718,_0x29d9d9){return new BPromise(function(_0x1b1ebc,_0x423604){var _0x1652c8=sox[_0x18c0('0x1e')](_0x1a8718,_0x29d9d9,{'sampleRate':0x1f40,'format':_0x18c0('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1652c8['on'](_0x18c0('0x18'),function(_0x566af7){logger[_0x18c0('0x18')](_0x18c0('0x20'),_0x566af7);_0x423604(_0x566af7);});_0x1652c8['on'](_0x18c0('0x1b'),function(){logger[_0x18c0('0x16')](_0x18c0('0x21'));_0x1b1ebc();});_0x1652c8[_0x18c0('0x22')]();});}function base64Decode(_0x322acb,_0x45794a){var _0x7bf42d=path[_0x18c0('0x23')](__dirname,_0x18c0('0x24'),rs['generate'](0x4)+'.wav');fs['writeFileSync'](_0x7bf42d,_0x322acb,_0x18c0('0x25'));return convertFile(_0x7bf42d,_0x45794a)[_0x18c0('0x26')](function(){try{fs[_0x18c0('0x19')](_0x7bf42d);fs['chmodSync'](_0x45794a,_0x18c0('0x27'));}catch(_0x355850){logger[_0x18c0('0x18')](_0x355850);}return _0x45794a['split']('.')[0x0];});}function base64Encode(_0x15ba8a){var _0x38289f=fs['readFileSync'](_0x15ba8a);return new Buffer(_0x38289f)[_0x18c0('0x28')](_0x18c0('0x25'));}exports[_0x18c0('0x29')]=function(_0x142c50,_0x21bef7,_0x2ab55d,_0x33e94b,_0x56e6b8,_0x2108d5){var _0x48e774,_0x3c9890;var _0x1b5f34=_0x18c0('0x2a');var _0x15c293=_0x18c0('0x2b')+_0x142c50;var _0x3e4227={};if(_0x21bef7===_0x18c0('0x2c')){_0x3e4227[_0x18c0('0x2d')]={'ssml':_0x2ab55d};}else{_0x3e4227[_0x18c0('0x2d')]={'text':_0x2ab55d};};_0x3e4227['voice']={'languageCode':_0x33e94b,'ssmlGender':_0x56e6b8};_0x3e4227[_0x18c0('0x2e')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x113294={'url':_0x1b5f34+_0x18c0('0x2f')+_0x15c293,'method':_0x18c0('0x30'),'json':!![],'body':_0x3e4227};return rp(_0x113294)[_0x18c0('0x26')](function(_0xaff7e1){return new BPromise(function(_0x1485bf,_0x377a86){_0x48e774=path[_0x18c0('0x23')](__dirname,_0x18c0('0x24'),rs['generate'](0x4)+_0x18c0('0x31'));var _0x2c4bc4=Buffer[_0x18c0('0x32')](_0xaff7e1[_0x18c0('0x33')],_0x18c0('0x25'));return fs[_0x18c0('0x34')](_0x48e774,_0x2c4bc4,function(_0x2616cf){_0x377a86(_0x2616cf);},function(_0xd6a37c){fs['chmodSync'](_0x48e774,_0x18c0('0x27'));_0x1485bf(_0xd6a37c);});});})[_0x18c0('0x26')](function(_0xdba364){_0x3c9890=path[_0x18c0('0x23')](__dirname,_0x18c0('0x24'),rs[_0x18c0('0x35')](0x4)+_0x18c0('0x36'));return convertFile(_0x48e774,_0x3c9890);})['then'](function(){try{fs[_0x18c0('0x19')](_0x48e774);fs['chmodSync'](_0x3c9890,_0x18c0('0x27'));}catch(_0xea6af4){logger['error'](_0xea6af4);}logger[_0x18c0('0x16')]('googleCloudTTS\x20path',_0x3c9890[_0x18c0('0x37')]('.')[0x0]);return _0x3c9890[_0x18c0('0x37')]('.')[0x0];});};exports[_0x18c0('0x38')]=function(_0x5c0fb0,_0x413ffb){var _0x3c38b8=_0x18c0('0x39');var _0x5f17e6,_0x45ac76;var _0x5e7754;var _0x45c6e3={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x3c38b8,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x18c0('0x3a')+encodeURIComponent(JSON[_0x18c0('0x3b')]([[[_0x18c0('0x3c'),JSON['stringify']([_0x5c0fb0,_0x413ffb||'en',![],_0x18c0('0x3d')]),null,_0x18c0('0x3e')]]]))};return rp(_0x45c6e3)['then'](function(_0x110db4){try{_0x5e7754=eval(_0x110db4[_0x18c0('0x3f')](0x5))[0x0][0x2];}catch(_0x11ca28){throw new Error(_0x18c0('0x40')+_0x110db4[_0x18c0('0x41')]);}if(!_0x5e7754){if(_0x5c0fb0[_0x18c0('0x42')]>0xc8){throw new Error(_0x18c0('0x43'));}else{throw new Error(_0x18c0('0x44')+_0x413ffb+_0x18c0('0x45'));}}try{_0x5e7754=eval(_0x5e7754)[0x0];}catch(_0x28165c){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x31be97=_0x5e7754;_0x5f17e6=path['resolve'](__dirname,'tmp',rs[_0x18c0('0x35')](0x4)+_0x18c0('0x31'));fs[_0x18c0('0x46')](_0x5f17e6,_0x5e7754,{'encoding':_0x18c0('0x25')});_0x45ac76=path[_0x18c0('0x23')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x5f17e6,_0x45ac76);})[_0x18c0('0x26')](function(){try{fs[_0x18c0('0x19')](_0x5f17e6);fs[_0x18c0('0x47')](_0x45ac76,_0x18c0('0x27'));}catch(_0x338c7c){logger[_0x18c0('0x18')](_0x338c7c);}logger['info'](_0x18c0('0x48'),_0x45ac76['split']('.')[0x0]);return _0x45ac76[_0x18c0('0x37')]('.')[0x0];});};exports[_0x18c0('0x49')]=function(_0x13cb3a,_0x32c8bd,_0x50392b){return google[_0x18c0('0x4a')](_0x13cb3a,_0x32c8bd,_0x50392b)['then'](function(_0x2920d7){logger['info'](_0x2920d7['uri']);return rp(_0x2920d7);})[_0x18c0('0x26')](function(_0x5e4f23){var _0x57e26c='';var _0x25083d=0x0;try{fs[_0x18c0('0x19')](_0x13cb3a);}catch(_0x498c4c){logger['error'](_0x498c4c);}if(_0x5e4f23&&_0x5e4f23[_0x18c0('0x4b')]){_0x57e26c=_0x5e4f23[_0x18c0('0x4b')][_0x18c0('0x4c')](function(_0x247058){return _0x247058&&_0x247058[_0x18c0('0x4d')][0x0]&&_0x247058[_0x18c0('0x4d')][0x0][_0x18c0('0x4e')]?_0x247058[_0x18c0('0x4d')][0x0]['transcript']:'';})['join']('\x0a');_0x25083d=_0x5e4f23[_0x18c0('0x4b')][_0x18c0('0x4c')](function(_0x2c66fe){return _0x2c66fe&&_0x2c66fe['alternatives'][0x0]&&_0x2c66fe[_0x18c0('0x4d')][0x0]['confidence']?_0x2c66fe[_0x18c0('0x4d')][0x0][_0x18c0('0x4f')]:0x0;})[_0x18c0('0x50')]('\x0a');}logger[_0x18c0('0x16')]('googleASR\x20transcription',_0x57e26c);logger[_0x18c0('0x16')](_0x18c0('0x51'),_0x25083d);return{'transcript':_0x57e26c,'confidence':_0x25083d};})[_0x18c0('0x52')](function(_0x493c71){logger[_0x18c0('0x18')]('[%s]\x20%s:%s',_0x493c71[_0x18c0('0x10')],_0x493c71['name'],_0x493c71[_0x18c0('0x53')]);});};exports['googleDialogflow']=function(_0x60101d,_0x3967c5,_0x3d8f8d,_0x13da5c){var _0x318151=apiai(_0x3967c5,{'language':_0x13da5c||'en'});return _0x318151['textRequest'](_0x3d8f8d,{'sessionId':md5(_0x60101d)})[_0x18c0('0x26')](function(_0x1f23ea){logger['info'](JSON[_0x18c0('0x3b')](_0x1f23ea));return{'source':_0x1f23ea[_0x18c0('0x54')][_0x18c0('0x55')],'resolvedQuery':_0x1f23ea[_0x18c0('0x54')][_0x18c0('0x56')],'action':_0x1f23ea[_0x18c0('0x54')][_0x18c0('0x57')],'actionIncomplete':_0x1f23ea[_0x18c0('0x54')][_0x18c0('0x58')],'speech':_0x1f23ea['result']['fulfillment']['speech'],'score':_0x1f23ea[_0x18c0('0x54')][_0x18c0('0x59')],'statusCode':_0x1f23ea[_0x18c0('0x5a')][_0x18c0('0x5b')],'endConversation':_0x1f23ea[_0x18c0('0x54')][_0x18c0('0x5c')][_0x18c0('0x5d')]||![],'isFallbackIntent':_0x1f23ea[_0x18c0('0x54')][_0x18c0('0x5c')][_0x18c0('0x5e')]};});};exports[_0x18c0('0x5f')]=function(_0x4667b3,_0x2fe737,_0x6cc08f,_0x4e5158,_0x4d5375,_0x433a01){var _0x5d9f3e=_0x4e5158[_0x18c0('0x60')](/\\n/g,'\x0a');var _0x39d34c={'credentials':{'private_key':_0x5d9f3e,'client_email':_0x6cc08f}};var _0x33089b=new dialogflow[(_0x18c0('0x61'))](_0x39d34c);var _0x384b42=_0x33089b[_0x18c0('0x62')](_0x2fe737,md5(_0x4667b3));var _0x505146={'session':_0x384b42,'queryInput':{'text':{'text':_0x4d5375,'languageCode':_0x433a01}}};return _0x33089b[_0x18c0('0x63')](_0x505146)[_0x18c0('0x26')](function(_0x208c7f){if(_0x208c7f&&_0x208c7f[_0x18c0('0x42')]){logger[_0x18c0('0x16')](_0x18c0('0x64'),JSON[_0x18c0('0x3b')](_0x208c7f));var _0x3067d8=_0x208c7f[0x0];if(_0x3067d8){var _0x4e079b={'action':_0x3067d8['queryResult'][_0x18c0('0x57')],'allRequiredParamsPresent':_0x3067d8['queryResult'][_0x18c0('0x65')],'endConversation':_0x3067d8['queryResult']['diagnosticInfo']&&_0x3067d8[_0x18c0('0x66')][_0x18c0('0x67')][_0x18c0('0x68')]?_0x3067d8[_0x18c0('0x66')]['diagnosticInfo']['fields'][_0x18c0('0x69')][_0x18c0('0x6a')]:![],'fulfillmentText':_0x3067d8[_0x18c0('0x66')][_0x18c0('0x6b')],'intentName':_0x3067d8[_0x18c0('0x66')][_0x18c0('0x6c')]['name'],'intentDisplayName':_0x3067d8['queryResult'][_0x18c0('0x6c')][_0x18c0('0x6d')],'isFallbackIntent':_0x3067d8['queryResult'][_0x18c0('0x6c')][_0x18c0('0x6e')],'languageCode':_0x3067d8[_0x18c0('0x66')][_0x18c0('0x6f')],'queryText':_0x3067d8[_0x18c0('0x66')]['queryText'],'responseId':_0x3067d8[_0x18c0('0x70')],'score':_0x3067d8[_0x18c0('0x66')][_0x18c0('0x71')],'speech':_0x3067d8[_0x18c0('0x66')]['fulfillmentText'],'providerResponse':JSON[_0x18c0('0x3b')](_0x208c7f)};return _0x4e079b;}}});};exports[_0x18c0('0x72')]=function(_0x107ed1,_0x45f081,_0x5105eb,_0x9fab9f){return tilde['asr'](_0x107ed1,_0x45f081,_0x5105eb,_0x9fab9f)[_0x18c0('0x26')](function(_0x3e8a21){try{fs[_0x18c0('0x19')](_0x107ed1);}catch(_0x509f48){logger['error'](_0x509f48);}logger[_0x18c0('0x16')]('Tilde\x20ASR\x20transcription',_0x3e8a21['transcript']);logger['info'](_0x18c0('0x73'),_0x3e8a21[_0x18c0('0x4f')]);return _0x3e8a21;});};exports['awsPolly']=function(_0xfe5db6,_0x50f47b,_0x864831,_0x2eda2f,_0x1582d2,_0xef1dad){var _0x343cfd=path[_0x18c0('0x23')](__dirname,'tmp',rs[_0x18c0('0x35')](0x4)+'.mp3');var _0x202662;return aws['polly'](_0xfe5db6,_0x50f47b,_0x864831,_0x2eda2f,_0x1582d2,_0xef1dad,_0x343cfd)[_0x18c0('0x26')](function(){_0x202662=path[_0x18c0('0x23')](__dirname,_0x18c0('0x24'),rs[_0x18c0('0x35')](0x4)+_0x18c0('0x36'));return convertFile(_0x343cfd,_0x202662);})[_0x18c0('0x26')](function(){try{fs[_0x18c0('0x19')](_0x343cfd);fs[_0x18c0('0x47')](_0x202662,_0x18c0('0x27'));}catch(_0x4f6503){logger[_0x18c0('0x18')](_0x4f6503);}return _0x202662[_0x18c0('0x37')]('.')[0x0];});};exports['awsLex']=function(_0x227945,_0x4a3602,_0x52997d,_0x3a0cc9,_0x44646a,_0x41a9df){return aws['lex'](_0x227945,_0x4a3602,_0x52997d,_0x3a0cc9,_0x44646a,_0x41a9df)[_0x18c0('0x26')](function(_0x27392f){logger[_0x18c0('0x16')](JSON[_0x18c0('0x3b')](_0x27392f));return _0x27392f;});};exports['ispeechTTS']=function(_0x1113bf,_0x19b769,_0x45bcef,_0x39e96d){var _0x5ca286=util[_0x18c0('0x74')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x1113bf,encodeURIComponent(_0x19b769),_0x45bcef,_0x39e96d);var _0x5d617d=path[_0x18c0('0x23')](__dirname,_0x18c0('0x24'),rs[_0x18c0('0x35')](0x4)+_0x18c0('0x31'));var _0x25b6ba;return downloadFile(_0x5ca286,_0x5d617d)['then'](function(){_0x25b6ba=path['resolve'](__dirname,_0x18c0('0x24'),rs[_0x18c0('0x35')](0x4)+'.wav');return convertFile(_0x5d617d,_0x25b6ba);})[_0x18c0('0x26')](function(){try{fs[_0x18c0('0x19')](_0x5d617d);fs[_0x18c0('0x47')](_0x25b6ba,_0x18c0('0x27'));}catch(_0xbd4bc8){logger['error'](_0xbd4bc8);}return _0x25b6ba[_0x18c0('0x37')]('.')[0x0];});};exports[_0x18c0('0x75')]=function(_0x309b47,_0x47ae6c,_0x52f0b8,_0x428577){var _0x54e41d=util[_0x18c0('0x74')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x47ae6c,_0x52f0b8,base64Encode(_0x309b47),_0x428577?util[_0x18c0('0x74')](_0x18c0('0x76'),encodeURIComponent(_0x428577)):_0x18c0('0x77'));return uploadFile(_0x54e41d)[_0x18c0('0x26')](function(_0x199ea2){return querystring['parse'](_0x199ea2);});};exports[_0x18c0('0x78')]=function(_0x2ee46e,_0x1eab38){return sestek[_0x18c0('0x79')](_0x2ee46e,_0x1eab38)[_0x18c0('0x26')](function(_0x4c23d7){logger[_0x18c0('0x16')](JSON[_0x18c0('0x3b')](_0x4c23d7));var _0x55bc78={'speech':_0x4c23d7[_0x18c0('0x7a')],'action':_0x4c23d7['channelData']?_0x4c23d7['channelData']['CustomAction']:undefined,'actiondata':_0x4c23d7[_0x18c0('0x7b')]?_0x4c23d7['channelData'][_0x18c0('0x7c')]:undefined};if(_0x4c23d7[_0x18c0('0x7b')]&&_0x4c23d7['channelData'][_0x18c0('0x7d')]){return base64Decode(_0x4c23d7['channelData'][_0x18c0('0x7d')][_0x18c0('0x7e')],path[_0x18c0('0x23')](__dirname,_0x18c0('0x24'),rs[_0x18c0('0x35')](0x4)+'.wav'))[_0x18c0('0x26')](function(_0x55e9a9){_0x55bc78['audiofile']=_0x55e9a9;return _0x55bc78;});}return _0x55bc78;});};exports[_0x18c0('0x7f')]=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 56bb43d..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 _0x5e27=['./nda'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5e27,0x9b));var _0x75e2=function(_0x732f97,_0x2fd726){_0x732f97=_0x732f97-0x0;var _0x4e586e=_0x5e27[_0x732f97];return _0x4e586e;};var nda=require(_0x75e2('0x0'));module['exports']={'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 c720296..ff930ec 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 _0xdace=['info','request-promise','../../../../../config/logger','agi','exports','POST','resolve','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','Nda','uniqueid','dnid','extension','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData'];(function(_0x226465,_0x5c7f92){var _0x556a32=function(_0x16638e){while(--_0x16638e){_0x226465['push'](_0x226465['shift']());}};_0x556a32(++_0x5c7f92);}(_0xdace,0xc5));var _0xedac=function(_0x56b138,_0x2396d6){_0x56b138=_0x56b138-0x0;var _0x3df878=_0xdace[_0x56b138];return _0x3df878;};'use strict';var rp=require(_0xedac('0x0'));var url=require('url');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));module[_0xedac('0x3')]=function(_0x518516,_0x413d77){var _0x36bcd2={'method':_0xedac('0x4'),'uri':url[_0xedac('0x5')](_0x413d77['ndauth_url'],_0xedac('0x6')),'form':{'grant_type':_0xedac('0x7'),'username':_0x413d77[_0xedac('0x8')],'password':_0x413d77['password']},'json':!![]};return rp(_0x36bcd2)[_0xedac('0x9')](function(_0x21440e){var _0x162eea={'method':'POST','uri':url[_0xedac('0x5')](_0x413d77[_0xedac('0xa')],_0xedac('0xb')),'body':{'type':_0x413d77['ndaactivity_type']||'message','channelId':_0xedac('0xc'),'conversation':{'id':_0x518516[_0xedac('0xd')]},'from':{'id':_0x518516['callerid'],'name':_0x518516['calleridname']},'recipient':{'id':_0x518516[_0xedac('0xe')],'name':_0x518516[_0xedac('0xf')]},'text':_0x413d77['text'],'channelData':{}},'headers':{'Authorization':_0xedac('0x10')+_0x21440e['access_token']},'json':!![]};if(_0x413d77[_0xedac('0x11')]){_0x162eea[_0xedac('0x12')][_0xedac('0x13')][_0xedac('0x14')]=_0x413d77[_0xedac('0x11')];}if(_0x413d77[_0xedac('0x15')]=='1'){_0x162eea[_0xedac('0x12')][_0xedac('0x13')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xedac('0x16')};}if(_0x413d77[_0xedac('0x17')]){_0x162eea[_0xedac('0x12')][_0xedac('0x13')][_0xedac('0x18')]=_0x413d77['custom_action'];if(_0x413d77[_0xedac('0x19')]){_0x162eea['body'][_0xedac('0x13')][_0xedac('0x1a')]=_0x413d77[_0xedac('0x19')];}}logger[_0xedac('0x1b')](JSON['stringify'](_0x162eea));return rp(_0x162eea);});}; \ No newline at end of file +var _0xe28e=['resolve','ndauth_url','/token','password','then','ndassistant_url','Nda','uniqueid','calleridname','dnid','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST'];(function(_0x31f3ba,_0x265f34){var _0x3ff7f8=function(_0x5e0245){while(--_0x5e0245){_0x31f3ba['push'](_0x31f3ba['shift']());}};_0x3ff7f8(++_0x265f34);}(_0xe28e,0x1ba));var _0xee28=function(_0x104510,_0x80cee2){_0x104510=_0x104510-0x0;var _0x4bab72=_0xe28e[_0x104510];return _0x4bab72;};'use strict';var rp=require(_0xee28('0x0'));var url=require(_0xee28('0x1'));var logger=require(_0xee28('0x2'))(_0xee28('0x3'));module[_0xee28('0x4')]=function(_0x117a12,_0x3e541a){var _0x9f2216={'method':_0xee28('0x5'),'uri':url[_0xee28('0x6')](_0x3e541a[_0xee28('0x7')],_0xee28('0x8')),'form':{'grant_type':_0xee28('0x9'),'username':_0x3e541a['username'],'password':_0x3e541a[_0xee28('0x9')]},'json':!![]};return rp(_0x9f2216)[_0xee28('0xa')](function(_0x3f9bd9){var _0x66d0b6={'method':_0xee28('0x5'),'uri':url[_0xee28('0x6')](_0x3e541a[_0xee28('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3e541a['ndaactivity_type']||'message','channelId':_0xee28('0xc'),'conversation':{'id':_0x117a12[_0xee28('0xd')]},'from':{'id':_0x117a12['callerid'],'name':_0x117a12[_0xee28('0xe')]},'recipient':{'id':_0x117a12[_0xee28('0xf')],'name':_0x117a12['extension']},'text':_0x3e541a[_0xee28('0x10')],'channelData':{}},'headers':{'Authorization':_0xee28('0x11')+_0x3f9bd9[_0xee28('0x12')]},'json':!![]};if(_0x3e541a[_0xee28('0x13')]){_0x66d0b6[_0xee28('0x14')][_0xee28('0x15')][_0xee28('0x16')]=_0x3e541a['project'];}if(_0x3e541a[_0xee28('0x17')]=='1'){_0x66d0b6[_0xee28('0x14')][_0xee28('0x15')][_0xee28('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xee28('0x19')};}if(_0x3e541a['custom_action']){_0x66d0b6[_0xee28('0x14')][_0xee28('0x15')][_0xee28('0x1a')]=_0x3e541a[_0xee28('0x1b')];if(_0x3e541a[_0xee28('0x1c')]){_0x66d0b6[_0xee28('0x14')]['channelData'][_0xee28('0x1d')]=_0x3e541a['custom_action_data'];}}logger[_0xee28('0x1e')](JSON[_0xee28('0x1f')](_0x66d0b6));return rp(_0x66d0b6);});}; \ 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 3724183..c2a943b 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 _0xebcf=['exports','./lib/api'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xebcf,0x191));var _0xfebc=function(_0xa119cf,_0x267a00){_0xa119cf=_0xa119cf-0x0;var _0x326ceb=_0xebcf[_0xa119cf];return _0x326ceb;};'use strict';var asr=require(_0xfebc('0x0'));module[_0xfebc('0x1')]=function(_0xc6b27,_0x29b093,_0x126cea,_0x19ae24){return asr(_0xc6b27,_0x29b093,_0x126cea,_0x19ae24);}; \ No newline at end of file +var _0x3505=['./lib/api'];(function(_0x2f63b0,_0x4cb57e){var _0x416b4e=function(_0x41be53){while(--_0x41be53){_0x2f63b0['push'](_0x2f63b0['shift']());}};_0x416b4e(++_0x4cb57e);}(_0x3505,0x112));var _0x5350=function(_0x329768,_0xfb5053){_0x329768=_0x329768-0x0;var _0xbca2a6=_0x3505[_0x329768];return _0xbca2a6;};'use strict';var asr=require(_0x5350('0x0'));module['exports']=function(_0x56dff1,_0x29c9f9,_0x104824,_0x56a9c0){return asr(_0x56dff1,_0x29c9f9,_0x104824,_0x56a9c0);}; \ 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 985a245..a9bca21 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 _0xa33a=['transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xa33a,0x187));var _0xaa33=function(_0x4b19e3,_0x2b63c3){_0x4b19e3=_0x4b19e3-0x0;var _0x2ce22a=_0xa33a[_0x4b19e3];return _0x2ce22a;};'use strict';var BPromise=require(_0xaa33('0x0'));var _=require(_0xaa33('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xaa33('0x2'));var logger=require(_0xaa33('0x3'))(_0xaa33('0x4'));module[_0xaa33('0x5')]=function(_0x2d5387,_0x20f0b2,_0x1d3ade,_0x3ba16a){return new BPromise(function(_0x41ed12,_0x5603e4){logger[_0xaa33('0x6')](_0xaa33('0x7'),_0x3ba16a||_0xaa33('0x8'));var _0x47db31=new WebSocket(_0x3ba16a||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x28f99a='';var _0x30bf9c='0';var _0x4f02dd='1';var _0x5a1d50=_0xaa33('0x9');function _0x594b75(_0x8c46f3){var _0x3ccd0c=crypto['createHash'](_0xaa33('0xa'));_0x3ccd0c['update'](_0x8c46f3);return _0x3ccd0c[_0xaa33('0xb')](_0xaa33('0xc'));}function _0x3a3662(){try{logger['info'](_0xaa33('0xd'));var _0x2d4373=moment()[_0xaa33('0xe')]();var _0x4cde98=_0x594b75(_0x2d4373+_0x20f0b2+_0x1d3ade);_0x47db31[_0xaa33('0xf')](JSON[_0xaa33('0x10')]({'appID':_0x20f0b2,'timestamp':_0x2d4373,'appKey':_0x4cde98}));var _0x64d705=fs[_0xaa33('0x11')](_0x2d5387);_0x64d705['on'](_0xaa33('0x12'),function(_0x415098){_0x47db31[_0xaa33('0xf')](_0x415098);});_0x64d705['on'](_0xaa33('0x13'),function(){_0x47db31['send'](_0xaa33('0x14'));});}catch(_0x2a7a80){logger['error'](_0xaa33('0x15'),JSON['stringify'](_0x2a7a80));_0x47db31[_0xaa33('0x16')]();}}function _0x4547f3(_0x2e163f){try{if(_0x2e163f){var _0x28b00a=JSON[_0xaa33('0x17')](_0x2e163f);switch(_0x28b00a[_0xaa33('0x18')]){case 0x0:if(_0x28b00a[_0xaa33('0x19')]){if(_0x28b00a[_0xaa33('0x19')][_0xaa33('0x1a')]){logger[_0xaa33('0x6')](_0xaa33('0x1b'),JSON[_0xaa33('0x10')](_0x28b00a[_0xaa33('0x19')][_0xaa33('0x1c')]));_0x28f99a=_0x28b00a[_0xaa33('0x19')][_0xaa33('0x1c')][0x0][_0xaa33('0x1d')];_0x30bf9c=_0x28b00a[_0xaa33('0x19')][_0xaa33('0x1c')][0x0][_0xaa33('0x1e')];_0x4f02dd='0';_0x5a1d50=_0xaa33('0x1f');_0x47db31[_0xaa33('0x16')]();}}break;case 0x1:logger[_0xaa33('0x6')](_0xaa33('0x9'));_0x4f02dd='1';_0x5a1d50=_0xaa33('0x9');break;case 0x2:logger['info'](_0xaa33('0x20'));_0x4f02dd='2';_0x5a1d50='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xaa33('0x6')](_0xaa33('0x21'));_0x4f02dd='9';_0x5a1d50='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xaa33('0x6')](_0xaa33('0x22'));_0x4f02dd='10';_0x5a1d50=_0xaa33('0x22');break;case 0xb:logger[_0xaa33('0x6')](_0xaa33('0x23'));_0x4f02dd='11';_0x5a1d50=_0xaa33('0x23');}}}catch(_0x3a2ba9){logger[_0xaa33('0x24')](_0xaa33('0x25'),JSON[_0xaa33('0x10')](_0x3a2ba9));_0x47db31[_0xaa33('0x16')]();}}function _0x4f7ec1(){logger[_0xaa33('0x6')](_0xaa33('0x26'));_0x41ed12({'transcript':_0x28f99a,'confidence':_0x30bf9c,'status':_0x4f02dd,'status_message':_0x5a1d50});}function _0x400979(_0x48511b){logger[_0xaa33('0x24')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xaa33('0x27')](_0x48511b)){logger[_0xaa33('0x24')](_[_0xaa33('0x28')](_0x48511b)?JSON[_0xaa33('0x10')](_0x48511b):_0x48511b);}}_0x47db31['on']('open',_0x3a3662);_0x47db31['on'](_0xaa33('0x29'),_0x4547f3);_0x47db31['on'](_0xaa33('0x13'),_0x4f7ec1);_0x47db31['on'](_0xaa33('0x24'),_0x400979);});}; \ No newline at end of file +var _0x1756=['hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','message','bluebird','lodash','moment','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','digest'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1756,0x18d));var _0x6175=function(_0x8b2a2b,_0x405dcd){_0x8b2a2b=_0x8b2a2b-0x0;var _0x48781b=_0x1756[_0x8b2a2b];return _0x48781b;};'use strict';var BPromise=require(_0x6175('0x0'));var _=require(_0x6175('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x6175('0x2'));var crypto=require('crypto');var logger=require(_0x6175('0x3'))('agi');module[_0x6175('0x4')]=function(_0xdd1838,_0x4792e5,_0x51de83,_0x3444f4){return new BPromise(function(_0x2fc76e,_0x31229e){logger[_0x6175('0x5')](_0x6175('0x6'),_0x3444f4||_0x6175('0x7'));var _0x455354=new WebSocket(_0x3444f4||_0x6175('0x7'),{'perMessageDeflate':![]});var _0x127923='';var _0x20ae3c='0';var _0x2ea66c='1';var _0x5291a3='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x1e8529(_0x5c3d7e){var _0x57027f=crypto['createHash'](_0x6175('0x8'));_0x57027f['update'](_0x5c3d7e);return _0x57027f[_0x6175('0x9')](_0x6175('0xa'));}function _0x4b9c49(){try{logger[_0x6175('0x5')](_0x6175('0xb'));var _0xe362d0=moment()['unix']();var _0x1614bd=_0x1e8529(_0xe362d0+_0x4792e5+_0x51de83);_0x455354[_0x6175('0xc')](JSON[_0x6175('0xd')]({'appID':_0x4792e5,'timestamp':_0xe362d0,'appKey':_0x1614bd}));var _0x2ba800=fs[_0x6175('0xe')](_0xdd1838);_0x2ba800['on'](_0x6175('0xf'),function(_0x416d40){_0x455354[_0x6175('0xc')](_0x416d40);});_0x2ba800['on'](_0x6175('0x10'),function(){_0x455354['send'](_0x6175('0x11'));});}catch(_0x40ff7e){logger[_0x6175('0x12')](_0x6175('0x13'),JSON[_0x6175('0xd')](_0x40ff7e));_0x455354[_0x6175('0x14')]();}}function _0xf324a2(_0x1a99fd){try{if(_0x1a99fd){var _0x56c027=JSON[_0x6175('0x15')](_0x1a99fd);switch(_0x56c027[_0x6175('0x16')]){case 0x0:if(_0x56c027[_0x6175('0x17')]){if(_0x56c027[_0x6175('0x17')][_0x6175('0x18')]){logger[_0x6175('0x5')](_0x6175('0x19'),JSON[_0x6175('0xd')](_0x56c027[_0x6175('0x17')][_0x6175('0x1a')]));_0x127923=_0x56c027['result']['hypotheses'][0x0][_0x6175('0x1b')];_0x20ae3c=_0x56c027[_0x6175('0x17')][_0x6175('0x1a')][0x0]['likelihood'];_0x2ea66c='0';_0x5291a3='Success.';_0x455354['terminate']();}}break;case 0x1:logger['info'](_0x6175('0x1c'));_0x2ea66c='1';_0x5291a3=_0x6175('0x1c');break;case 0x2:logger[_0x6175('0x5')](_0x6175('0x1d'));_0x2ea66c='2';_0x5291a3=_0x6175('0x1d');break;case 0x9:logger[_0x6175('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2ea66c='9';_0x5291a3='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x6175('0x5')](_0x6175('0x1e'));_0x2ea66c='10';_0x5291a3=_0x6175('0x1e');break;case 0xb:logger[_0x6175('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x2ea66c='11';_0x5291a3=_0x6175('0x1f');}}}catch(_0x17190c){logger[_0x6175('0x12')](_0x6175('0x20'),JSON[_0x6175('0xd')](_0x17190c));_0x455354[_0x6175('0x14')]();}}function _0x509aea(){logger[_0x6175('0x5')](_0x6175('0x21'));_0x2fc76e({'transcript':_0x127923,'confidence':_0x20ae3c,'status':_0x2ea66c,'status_message':_0x5291a3});}function _0x25a822(_0x16b5a7){logger[_0x6175('0x12')](_0x6175('0x22'));if(!_[_0x6175('0x23')](_0x16b5a7)){logger[_0x6175('0x12')](_['isObject'](_0x16b5a7)?JSON[_0x6175('0xd')](_0x16b5a7):_0x16b5a7);}}_0x455354['on']('open',_0x4b9c49);_0x455354['on'](_0x6175('0x24'),_0xf324a2);_0x455354['on'](_0x6175('0x10'),_0x509aea);_0x455354['on']('error',_0x25a822);});}; \ 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 37e743e..5a5c4f0 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 _0x7635=['exports'];(function(_0x71480b,_0x477a42){var _0x321df8=function(_0x418ff6){while(--_0x418ff6){_0x71480b['push'](_0x71480b['shift']());}};_0x321df8(++_0x477a42);}(_0x7635,0x146));var _0x5763=function(_0xed4f9e,_0x328fce){_0xed4f9e=_0xed4f9e-0x0;var _0x3f542b=_0x7635[_0xed4f9e];return _0x3f542b;};var asr=require('./asr');module[_0x5763('0x0')]={'asr':asr}; \ No newline at end of file +var _0xa679=['exports','./asr'];(function(_0x59dd54,_0x495d0a){var _0x1025d3=function(_0x4fe209){while(--_0x4fe209){_0x59dd54['push'](_0x59dd54['shift']());}};_0x1025d3(++_0x495d0a);}(_0xa679,0x6b));var _0x9a67=function(_0x360a09,_0x4fa605){_0x360a09=_0x360a09-0x0;var _0x39fd08=_0xa679[_0x360a09];return _0x39fd08;};var asr=require(_0x9a67('0x0'));module[_0x9a67('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 1387840..39894a5 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 _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x3407cd,_0x33f66c){var _0xbcc4ee=function(_0x12d193){while(--_0x12d193){_0x3407cd['push'](_0x3407cd['shift']());}};_0xbcc4ee(++_0x33f66c);}(_0x34e8,0x12c));var _0x834e=function(_0x3484ff,_0x132f02){_0x3484ff=_0x3484ff-0x0;var _0x3c9283=_0x34e8[_0x3484ff];return _0x3c9283;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 833329b..419aa1f 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 _0xb717=['shelljs','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','prototype','getVariable','getVariableById','name','catch','rpc','getVoiceQueueById','getSquareProject','then','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSound','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','text','languageCode','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','number','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','uri','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','clone','hasOwnProperty','replaceObjectAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','isString','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','toString','getAndSetVariable','sync','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','list_id','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','no\x20text\x20configured','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','keys','forEach','dial','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','phone','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getData','test','mindigit','maxdigit','no\x20variable\x20found','generate','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','.wav','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue_id','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','%s/recordings/%s','RECORDING_SAVENAME','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','template_id','debug','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','voicemail','VOICEMAIL','mailbox','join','exports','util'];(function(_0x11ec6c,_0x1a8169){var _0xb59506=function(_0x58e31d){while(--_0x58e31d){_0x11ec6c['push'](_0x11ec6c['shift']());}};_0xb59506(++_0x1a8169);}(_0xb717,0x1b4));var _0x7b71=function(_0x9037f6,_0x1fe86a){_0x9037f6=_0x9037f6-0x0;var _0x384028=_0xb717[_0x9037f6];return _0x384028;};'use strict';var fs=require('fs');var util=require(_0x7b71('0x0'));var _=require('lodash');var sh=require(_0x7b71('0x1'));var odbc=require('odbc')();var rs=require(_0x7b71('0x2'));var moment=require(_0x7b71('0x3'));var Mustache=require(_0x7b71('0x4'));var rp=require('request-promise');var logger=require(_0x7b71('0x5'))(_0x7b71('0x6'));var config=require(_0x7b71('0x7'));var scripts=require(_0x7b71('0x8'));var FILES_PATH=_0x7b71('0x9');var recursiveMapAttributes=['rawHeaders',_0x7b71('0xa')];var verticesWithRetry=[_0x7b71('0xb'),_0x7b71('0xc'),_0x7b71('0xd')];var AGIVertices=function(_0xc46853,_0x570e98,_0x18867f){this[_0x7b71('0xe')]=_0xc46853;this['rpc']=_0x570e98;this[_0x7b71('0xf')]=_0x18867f;};AGIVertices[_0x7b71('0x10')][_0x7b71('0x11')]=function(_0x55c72a,_0x2aed3b){this['rpc'][_0x7b71('0x12')](_0x55c72a)['then'](function(_0x191289){_0x2aed3b(null,_0x191289?_0x191289[_0x7b71('0x13')]:![]);})[_0x7b71('0x14')](function(_0x101181){_0x2aed3b(_0x101181);});};AGIVertices[_0x7b71('0x10')]['getVoiceQueue']=function(_0x453d50,_0x481d32){this[_0x7b71('0x15')][_0x7b71('0x16')](_0x453d50)['then'](function(_0x351442){_0x481d32(null,_0x351442?_0x351442[_0x7b71('0x13')]:![]);})[_0x7b71('0x14')](function(_0x5888f9){_0x481d32(_0x5888f9);});};AGIVertices['prototype'][_0x7b71('0x17')]=function(_0x3dc48a,_0x35c943){this[_0x7b71('0x15')]['getSquareProjectById'](_0x3dc48a)[_0x7b71('0x18')](function(_0x5ca420){_0x35c943(null,_0x5ca420?_0x5ca420['name']:![]);})[_0x7b71('0x14')](function(_0xbde25){_0x35c943(_0xbde25);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x19')]=function(_0x2fc4a0,_0x51d647){this[_0x7b71('0x15')][_0x7b71('0x1a')](_0x2fc4a0)[_0x7b71('0x18')](function(_0x1941b9){_0x51d647(null,_0x1941b9?_0x1941b9[_0x7b71('0x1b')]:![]);})[_0x7b71('0x14')](function(_0x527e3f){_0x51d647(_0x527e3f);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x1c')]=function(_0x204c69,_0x375f85){this['rpc']['getUserById'](_0x204c69)[_0x7b71('0x18')](function(_0xbd752b){_0x375f85(null,_0xbd752b?_0xbd752b[_0x7b71('0x13')]:![]);})[_0x7b71('0x14')](function(_0x3aca34){_0x375f85(_0x3aca34);});};AGIVertices['prototype'][_0x7b71('0x1d')]=function(_0x58591c,_0x16c1f3){this[_0x7b71('0x15')][_0x7b71('0x1e')](_0x58591c)[_0x7b71('0x18')](function(_0x49ce76){_0x16c1f3(null,_0x49ce76?_0x49ce76['name']:![]);})[_0x7b71('0x14')](function(_0x28841d){_0x16c1f3(_0x28841d);});};AGIVertices['prototype'][_0x7b71('0x1f')]=function(_0x214555,_0x7c978b){var _0x2f9ca9=this;this[_0x7b71('0x15')]['getSoundById'](_0x214555)['then'](function(_0x2b323b){_0x7c978b(null,_0x2b323b?_0x2f9ca9['getSoundPath'](_0x2b323b[_0x7b71('0x20')]):![]);})['catch'](function(_0x18cc43){_0x7c978b(_0x18cc43);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x21')]=function(_0x5539b3,_0x1e4e89){this[_0x7b71('0x15')][_0x7b71('0x22')](_0x5539b3)['then'](function(_0x5e11e1){_0x1e4e89(null,_0x5e11e1?_0x5e11e1:![]);})[_0x7b71('0x14')](function(_0x14ff72){_0x1e4e89(_0x14ff72);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x23')]=function(_0x43925c,_0x38c1a8,_0x4761cb){this['mailRpc'][_0x7b71('0x23')](_0x43925c,_0x38c1a8)[_0x7b71('0x18')](function(){_0x4761cb(null);})[_0x7b71('0x14')](function(_0x57e8ce){_0x4761cb(_0x57e8ce);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x24')]=function(_0x2de811,_0x37ef84){this[_0x7b71('0x15')][_0x7b71('0x25')](_0x2de811)['then'](function(_0x3f231c){if(_0x3f231c){if(_0x3f231c[_0x7b71('0x26')]){_0x37ef84(null,[_0x3f231c[_0x7b71('0x27')]]);}else{_0x37ef84(null,_[_0x7b71('0x28')](_0x3f231c[_0x7b71('0x29')],'interval'));}}else{_0x37ef84(null,![]);}})[_0x7b71('0x14')](function(_0x31e0d1){_0x37ef84(_0x31e0d1);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x2a')]=function(_0x7cb6c1){return util[_0x7b71('0x2b')](_0x7b71('0x2c'),FILES_PATH,_0x7cb6c1);};AGIVertices[_0x7b71('0x10')]['getQueryOdbc']=function(_0x3be99c,_0x3074aa,_0x2a3330){odbc[_0x7b71('0x2d')](_0x3be99c,function(_0x4b816f){if(_0x4b816f){logger[_0x7b71('0x2e')](_0x7b71('0x2f'),_0x4b816f);_0x2a3330(_0x4b816f);}else{logger['info'](_0x7b71('0x30'));odbc[_0x7b71('0x31')](_0x3074aa,function(_0x12b48d,_0x1af1c6){if(_0x12b48d){logger['info'](_0x7b71('0x32'),_0x3074aa);_0x2a3330(_0x12b48d);}else{logger[_0x7b71('0x33')](_0x7b71('0x34'),_0x3074aa);odbc[_0x7b71('0x35')](function(_0x25b7f4){if(_0x25b7f4){logger[_0x7b71('0x2e')](_0x7b71('0x36'),_0x25b7f4);}_0x2a3330(null,_0x1af1c6);});}});}});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x37')]=function(_0x6cc0ab,_0xa1db9f){this[_0x7b71('0x15')]['getSmsAccountById'](_0x6cc0ab)[_0x7b71('0x18')](function(_0x3f795b){_0xa1db9f(null,_0x3f795b?_0x3f795b:![]);})['catch'](function(_0x1b30e8){_0xa1db9f(_0x1b30e8);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x38')]=function(_0x1719b8,_0x20b8fc){this['rpc'][_0x7b71('0x38')](_0x1719b8)[_0x7b71('0x18')](function(_0x2d6f20){_0x20b8fc(null,_0x2d6f20);})[_0x7b71('0x14')](function(_0x136070){_0x20b8fc(_0x136070);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x3f9e98,_0x541730,_0x2c2729){this[_0x7b71('0x15')][_0x7b71('0x39')]({'uniqueid':this[_0x7b71('0xe')][_0x7b71('0x3a')],'node':_0x3f9e98[_0x7b71('0x3b')],'application':_0x3f9e98[_0x7b71('0x3c')],'data':_0x541730||null,'project_name':this['channel'][_0x7b71('0x3d')],'callerid':this[_0x7b71('0xe')]['callerid']})[_0x7b71('0x18')](function(_0x96c37e){if(_0x2c2729){_0x2c2729(null,_0x96c37e);}})[_0x7b71('0x14')](function(_0x443e61){if(_0x2c2729){_0x2c2729(_0x443e61);}});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x3e')]=function(_0xf78be9,_0x227b5e,_0x18435c,_0x4412ca){this[_0x7b71('0x15')][_0x7b71('0x3e')]({'uniqueid':this[_0x7b71('0xe')]['uniqueid'],'callerid':this[_0x7b71('0xe')][_0x7b71('0x3f')],'calleridname':this['channel']['calleridname'],'context':this['channel'][_0x7b71('0x40')],'extension':this[_0x7b71('0xe')][_0x7b71('0x41')],'priority':this['channel'][_0x7b71('0x42')],'accountcode':this[_0x7b71('0xe')]['accountcode'],'dnid':this[_0x7b71('0xe')][_0x7b71('0x43')],'projectName':this[_0x7b71('0xe')]['arg_1'],'saveName':_0x227b5e,'filename':_0xf78be9[_0x7b71('0x44')]||_0x227b5e,'savePath':_0x18435c})[_0x7b71('0x18')](function(_0x945c68){_0x4412ca(null,_0x945c68);})[_0x7b71('0x14')](function(_0x20e9ed){_0x4412ca(_0x20e9ed);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x45')]=function(_0x30e8d8,_0xdb438,_0x32bf02,_0x35b792,_0xe6825d){this['rpc'][_0x7b71('0x45')]({'uniqueid':this['channel'][_0x7b71('0x3a')],'body':_0x30e8d8,'direction':_0xdb438,'providerName':_0x32bf02,'providerResponse':_0x35b792})[_0x7b71('0x18')](function(_0x45f94b){if(_0xe6825d){_0xe6825d(null,_0x45f94b);}})[_0x7b71('0x14')](function(_0x3571d0){if(_0xe6825d){_0xe6825d(_0x3571d0);}});};AGIVertices[_0x7b71('0x10')]['createCmContact']=function(_0x318605,_0x5c6146){this['rpc'][_0x7b71('0x46')]({'firstName':_['isEmpty'](_0x318605[_0x7b71('0x13')])||_[_0x7b71('0x47')](_0x318605[_0x7b71('0x13')])?_0x7b71('0x48')+Math[_0x7b71('0x49')]():_0x318605[_0x7b71('0x13')],'lastName':_[_0x7b71('0x4a')](_0x318605[_0x7b71('0x4b')])||_[_0x7b71('0x47')](_0x318605[_0x7b71('0x4b')])?null:_0x318605[_0x7b71('0x4b')],'phone':_0x318605['phone'],'ListId':_0x318605['list_id'],'scheduledat':_0x318605[_0x7b71('0x4c')],'callbackUniqueid':this['channel'][_0x7b71('0x3a')],'tags':_0x7b71('0x4d'),'description':_0x7b71('0x4e')+_0x318605['scheduledAt']['toString'](),'priority':_0x318605['callback_priority']})[_0x7b71('0x18')](function(_0x48b486){_0x5c6146(null,_0x48b486);})[_0x7b71('0x14')](function(_0x1af6a2){_0x5c6146(_0x1af6a2);});};AGIVertices['prototype'][_0x7b71('0x4f')]=function(_0x5c8dd2,_0x46c589){this['rpc'][_0x7b71('0x50')](_0x5c8dd2)['then'](function(_0x2256f6){_0x46c589(null,_0x2256f6?_0x2256f6['name']:![]);})[_0x7b71('0x14')](function(_0x53e33a){_0x46c589(_0x53e33a);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x51')]=function(_0x2980e7,_0x5bfdfb,_0x510a30){var _0x265b04={'role':_0x7b71('0x52')};_0x265b04[_0x2980e7]=this[_0x7b71('0xe')][_0x7b71('0x3f')];this[_0x7b71('0x15')][_0x7b71('0x51')](_0x265b04,_0x5bfdfb,this['channel'][_0x7b71('0x3a')])[_0x7b71('0x18')](function(_0x4dd001){_0x510a30(null,_[_0x7b71('0x47')](_0x4dd001)?![]:!![]);})['catch'](function(_0x5bc4f9){logger[_0x7b71('0x2e')](_0x5bc4f9);_0x510a30(null,![]);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x53')]=function(_0x4e478d,_0x38dbd7){var _0x361d38={'role':_0x7b71('0x52')};_0x361d38[_0x4e478d]=this[_0x7b71('0xe')][_0x7b71('0x3f')];this[_0x7b71('0x15')][_0x7b71('0x53')](_0x361d38)[_0x7b71('0x18')](function(_0x46856b){_0x38dbd7(null,_['isNil'](_0x46856b)?![]:!![]);})[_0x7b71('0x14')](function(_0x2304b7){logger[_0x7b71('0x2e')](_0x2304b7);_0x38dbd7(null,![]);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x54')]=function(_0x3a138a,_0x3cadf7){var _0x2f1b0b={'role':_0x7b71('0x52')};_0x2f1b0b[_0x3a138a]=this[_0x7b71('0xe')]['callerid'];this[_0x7b71('0x15')]['agentLogout'](_0x2f1b0b)['then'](function(_0x43261a){_0x3cadf7(null,_[_0x7b71('0x47')](_0x43261a)?![]:!![]);})[_0x7b71('0x14')](function(_0x964817){logger[_0x7b71('0x2e')](_0x964817);_0x3cadf7(null,![]);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x55')]=function(_0x17f0e2,_0x33cdb5){var _0x50b77d={'role':_0x7b71('0x52')};_0x50b77d[_0x17f0e2]=this[_0x7b71('0xe')][_0x7b71('0x3f')];var _0x487320=_0x17f0e2!=_0x7b71('0x56')?util[_0x7b71('0x2b')](_0x7b71('0x57'),_0x7b71('0x58'),this['channel']['callerid']):undefined;this[_0x7b71('0x15')][_0x7b71('0x55')](_0x50b77d,_0x487320)[_0x7b71('0x18')](function(_0x763ce1){_0x33cdb5(null,_[_0x7b71('0x47')](_0x763ce1)?![]:!![]);})[_0x7b71('0x14')](function(_0x4073f3){logger[_0x7b71('0x2e')](_0x4073f3);_0x33cdb5(null,![]);});};AGIVertices[_0x7b71('0x10')]['shellCommand']=function(_0x9d6c3c,_0xcd130f){sh[_0x7b71('0x59')](_[_0x7b71('0x5a')](_0x9d6c3c),function(_0x90f3b1,_0x47759b){var _0x3f2952=_0x47759b[_0x7b71('0x5b')](/(\r\n|\n|\r)/gm,'');_0xcd130f(null,_0x3f2952);});};AGIVertices['prototype'][_0x7b71('0x5c')]=function(_0x1e983c,_0x4e40f7){scripts[_0x7b71('0x5c')](_0x1e983c['apiKey'],_0x1e983c['google_cloud_tts_text_type']||'text',_0x1e983c[_0x7b71('0x5d')],_0x1e983c[_0x7b71('0x5e')]||'en-US',_0x1e983c['ssmlGender']||_0x7b71('0x5f'),_0x1e983c[_0x7b71('0x60')]||_0x7b71('0x61'))[_0x7b71('0x18')](function(_0x33042d){_0x4e40f7(null,_0x33042d);})[_0x7b71('0x14')](function(_0x743a94){_0x4e40f7(_0x743a94);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x62')]=function(_0x4364a3,_0x33a0a9){scripts[_0x7b71('0x62')](_0x4364a3[_0x7b71('0x5d')],_0x4364a3[_0x7b71('0x63')]||'en',0x1)[_0x7b71('0x18')](function(_0x6da04d){_0x33a0a9(null,_0x6da04d);})[_0x7b71('0x14')](function(_0x1d4152){_0x33a0a9(_0x1d4152);});};AGIVertices['prototype']['restAPI']=function(_0x564b69,_0x4269a6){var _0x58ed1d={'uri':_0x564b69[_0x7b71('0x64')],'method':_0x564b69[_0x7b71('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x564b69[_0x7b71('0x66')])===_0x7b71('0x67')&&parseInt(_0x564b69[_0x7b71('0x66')])>=0x1?parseInt(_0x564b69[_0x7b71('0x66')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x7b71('0x68'),_0x7b71('0x69')],_0x58ed1d[_0x7b71('0x65')][_0x7b71('0x6a')]())){try{_0x58ed1d[_0x7b71('0x6b')]=_0x564b69['rawBody']?JSON['parse'](_0x564b69[_0x7b71('0xa')]):{};}catch(_0x10445b){logger[_0x7b71('0x2e')](_0x7b71('0x6c'),_0x10445b);}}try{_0x58ed1d[_0x7b71('0x6d')]=_0x564b69[_0x7b71('0x6e')]?JSON[_0x7b71('0x6f')](_0x564b69[_0x7b71('0x6e')]):{};}catch(_0x2461b6){logger[_0x7b71('0x2e')](_0x7b71('0x70'),_0x2461b6);}if(_0x564b69['computedVariables']){try{var _0x45cecd=require(_0x564b69['computedVariables'])['sync'](this,_0x58ed1d);_0x58ed1d[_0x7b71('0x71')]=Mustache['render'](_0x564b69[_0x7b71('0x64')],_0x45cecd,{},['$$','$$']);if(_0x58ed1d['headers']){_0x58ed1d['headers']=JSON[_0x7b71('0x6f')](Mustache[_0x7b71('0x72')](JSON[_0x7b71('0x73')](_0x58ed1d['headers']),_0x45cecd,{},['$$','$$']));}if(_0x58ed1d[_0x7b71('0x6b')]){_0x58ed1d[_0x7b71('0x6b')]=JSON[_0x7b71('0x6f')](Mustache['render'](JSON[_0x7b71('0x73')](_0x58ed1d[_0x7b71('0x6b')]),_0x45cecd,{},['$$','$$']));}}catch(_0x4458f8){logger[_0x7b71('0x2e')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4458f8);}}rp(_0x58ed1d)[_0x7b71('0x18')](function(_0x311476){var _0x2681ae={'statusCode':_0x311476[_0x7b71('0x74')]||0xc8,'statusMessage':_0x311476[_0x7b71('0x75')]||'OK','headers':_0x311476[_0x7b71('0x6d')]||{},'body':_0x311476[_0x7b71('0x6b')]||{}};_0x4269a6(null,_0x2681ae);})[_0x7b71('0x14')](function(_0x718699){var _0x3d298c={'statusCode':_0x718699[_0x7b71('0x74')]||0x1f4,'statusMessage':_0x718699[_0x7b71('0x76')]||_0x7b71('0x77'),'headers':_0x718699[_0x7b71('0x78')]['headers']||{},'body':_0x718699['options'][_0x7b71('0x6b')]||{}};_0x4269a6(null,_0x3d298c);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x79')]=function(_0x3553de,_0x457115){scripts['googleDialogflow'](this[_0x7b71('0xe')][_0x7b71('0x3a')],_0x3553de[_0x7b71('0x7a')],_0x3553de[_0x7b71('0x5d')],_0x3553de[_0x7b71('0x7b')]||'en')[_0x7b71('0x18')](function(_0x37446f){_0x457115(null,_0x37446f);})[_0x7b71('0x14')](function(_0x4973f8){_0x457115(_0x4973f8);});};AGIVertices[_0x7b71('0x10')]['googleDialogflowV2']=function(_0x56f4d0,_0x5768b5){scripts[_0x7b71('0x7c')](this[_0x7b71('0xe')][_0x7b71('0x3a')],_0x56f4d0['dialogflowV2_project_id'],_0x56f4d0[_0x7b71('0x7d')],_0x56f4d0[_0x7b71('0x7e')],_0x56f4d0[_0x7b71('0x5d')],_0x56f4d0[_0x7b71('0x7f')]||'en')['then'](function(_0x16755e){_0x5768b5(null,_0x16755e);})[_0x7b71('0x14')](function(_0x43041f){_0x5768b5(_0x43041f);});};AGIVertices[_0x7b71('0x10')]['sestekNDA']=function(_0x1e0728,_0x2b4c3f){scripts[_0x7b71('0x80')](this[_0x7b71('0xe')],_0x1e0728)['then'](function(_0x21eeb0){_0x2b4c3f(null,_0x21eeb0);})['catch'](function(_0x366b4b){_0x2b4c3f(_0x366b4b);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x81')]=function(_0x490e5b,_0x82c11d){scripts[_0x7b71('0x81')](_0x490e5b['key'],_0x490e5b['text'],_0x490e5b[_0x7b71('0x82')]||'en-US',_0x490e5b[_0x7b71('0x83')])[_0x7b71('0x18')](function(_0x2cde65){_0x82c11d(null,_0x2cde65);})['catch'](function(_0x5b133a){_0x82c11d(_0x5b133a);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x84')]=function(_0x1be4eb,_0x1a5633,_0x4132c0){scripts[_0x7b71('0x84')](_0x1a5633,_0x1be4eb[_0x7b71('0x7a')],_0x1be4eb[_0x7b71('0x85')]||_0x7b71('0x86'),this[_0x7b71('0x87')](_0x1be4eb[_0x7b71('0x88')])?_0x1be4eb['model']:undefined)[_0x7b71('0x18')](function(_0x34e61a){_0x4132c0(null,_0x34e61a);})[_0x7b71('0x14')](function(_0x4b7678){_0x4132c0(_0x4b7678);});};AGIVertices[_0x7b71('0x10')]['awsPolly']=function(_0xcfe64f,_0x35d65f){scripts[_0x7b71('0x89')](_0xcfe64f[_0x7b71('0x8a')],_0xcfe64f['aws_secret_access_key'],_0xcfe64f[_0x7b71('0x8b')],_0xcfe64f['aws_polly_voice']||'Amy',_0xcfe64f[_0x7b71('0x5d')],_0xcfe64f['aws_text_type']||_0x7b71('0x5d'))[_0x7b71('0x18')](function(_0x3a489e){_0x35d65f(null,_0x3a489e);})[_0x7b71('0x14')](function(_0x5ab7b8){_0x35d65f(_0x5ab7b8);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x8c')]=function(_0x513d92,_0x12b00b){scripts[_0x7b71('0x8c')](this['channel'][_0x7b71('0x3a')],_0x513d92[_0x7b71('0x8a')],_0x513d92['aws_secret_access_key'],_0x513d92[_0x7b71('0x8d')],_0x513d92[_0x7b71('0x5d')],_0x513d92[_0x7b71('0x8e')])[_0x7b71('0x18')](function(_0xd8a3f0){_0x12b00b(null,_0xd8a3f0);})['catch'](function(_0x29abe0){_0x12b00b(_0x29abe0);});};AGIVertices[_0x7b71('0x10')]['googleASR']=function(_0x2efaea,_0xa8e84f,_0x95cf38){scripts[_0x7b71('0x8f')](_0xa8e84f,_0x2efaea['key'],_0x2efaea[_0x7b71('0x90')]||_0x7b71('0x86'))[_0x7b71('0x18')](function(_0x3f6670){_0x95cf38(null,_0x3f6670);})[_0x7b71('0x14')](function(_0x2fbce9){_0x95cf38(_0x2fbce9);});};AGIVertices['prototype'][_0x7b71('0x91')]=function(_0x2a791e,_0x452dc4,_0xe0323f){scripts[_0x7b71('0x91')](_0x452dc4,_0x2a791e[_0x7b71('0x92')],_0x2a791e[_0x7b71('0x93')],_0x2a791e['uri'])['then'](function(_0x31f22d){_0xe0323f(null,_0x31f22d);})[_0x7b71('0x14')](function(_0x145827){_0xe0323f(_0x145827);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x94')]=function(_0x1351a5){var _0x5839c4=_[_0x7b71('0x95')](verticesWithRetry,_0x1351a5[_0x7b71('0x3c')])?_0x1351a5:_[_0x7b71('0x96')](_0x1351a5);for(var _0x14ef43 in _0x5839c4){if(_0x5839c4[_0x7b71('0x97')](_0x14ef43)){if(_0x5839c4[_0x14ef43]&&_['isString'](_0x5839c4[_0x14ef43])){if(_[_0x7b71('0x95')](recursiveMapAttributes,_0x14ef43)){_0x5839c4[_0x14ef43]=this[_0x7b71('0x98')](_0x5839c4[_0x14ef43]);}else{_0x5839c4[_0x14ef43]=this['replaceAllVariables'](_0x5839c4[_0x14ef43]);}}}}return _0x5839c4;};AGIVertices[_0x7b71('0x10')]['recursiveNodeIndex']=function(_0x1bbad5){for(var _0x1e2cc9 in _0x1bbad5){if(_0x1bbad5[_0x7b71('0x97')](_0x1e2cc9)){if(_[_0x7b71('0x99')](_0x1bbad5[_0x1e2cc9])){this[_0x7b71('0x9a')](_0x1bbad5[_0x1e2cc9]);}else if(_[_0x7b71('0x9b')](_0x1bbad5[_0x1e2cc9])){for(var _0x2d0389=0x0;_0x2d0389<_0x1bbad5[_0x1e2cc9][_0x7b71('0x9c')];_0x2d0389++){this[_0x7b71('0x9a')](_0x1bbad5[_0x1e2cc9][_0x2d0389]);}}else if(_[_0x7b71('0x9d')](_0x1bbad5[_0x1e2cc9])){_0x1bbad5[_0x1e2cc9]=this[_0x7b71('0x9e')](_0x1bbad5[_0x1e2cc9]);}}}};AGIVertices[_0x7b71('0x10')]['saveRestApiResult']=function(_0x56405c,_0x4cc313){for(var _0x1531c0 in _0x56405c){if(_0x56405c[_0x7b71('0x97')](_0x1531c0)){if(_[_0x7b71('0x99')](_0x56405c[_0x1531c0])){if(!_['isEmpty'](_0x56405c[_0x1531c0])){this['saveRestApiResult'](_0x56405c[_0x1531c0],util[_0x7b71('0x2b')]('%s.%s',_0x4cc313,_0x1531c0));}}else if(_['isArray'](_0x56405c[_0x1531c0])){for(var _0x4a4f73=0x0;_0x4a4f73<_0x56405c[_0x1531c0][_0x7b71('0x9c')];_0x4a4f73++){this[_0x7b71('0x9f')](_0x56405c[_0x1531c0][_0x4a4f73],util[_0x7b71('0x2b')](_0x7b71('0xa0'),_0x4cc313,_0x1531c0+'['+_0x4a4f73+']'));}}else{if(!_[_0x7b71('0x47')](_0x56405c[_0x1531c0])){this[_0x7b71('0xe')][_0x7b71('0xa1')](util[_0x7b71('0x2b')](_0x7b71('0xa0'),_0x4cc313,_0x1531c0),_0x56405c[_0x1531c0]);}}}}};AGIVertices['prototype'][_0x7b71('0x98')]=function(_0x174e6a){try{var _0x326663=JSON[_0x7b71('0x6f')](_0x174e6a);this[_0x7b71('0x9a')](_0x326663);return JSON[_0x7b71('0x73')](_0x326663);}catch(_0x1e2f82){return this['replaceAllVariables'](_0x174e6a);}};AGIVertices[_0x7b71('0x10')]['replaceAllVariables']=function(_0x5c38ed){var _0x8bb6fc=_0x5c38ed[_0x7b71('0xa2')]('{');for(var _0x35ccb9=0x1;_0x35ccb9<_0x8bb6fc[_0x7b71('0x9c')];_0x35ccb9+=0x1){var _0x2f156f=_0x8bb6fc[_0x35ccb9][_0x7b71('0xa2')]('}');if(_0x2f156f[_0x7b71('0x9c')]>0x1){_0x5c38ed=_0x5c38ed[_0x7b71('0xa3')]('{'+_0x2f156f[0x0]+'}',this[_0x7b71('0xe')][_0x7b71('0x11')](_0x2f156f[0x0])[_0x7b71('0xa4')]||_0x2f156f[0x0]);}}if(_0x8bb6fc[_0x7b71('0x9c')]===0x1){return _0x5c38ed[_0x7b71('0xa5')]();}return this[_0x7b71('0x9e')](_0x5c38ed);};AGIVertices[_0x7b71('0x10')][_0x7b71('0xa6')]=function(_0x4b927a,_0x3a24d7){var _0x188bac=this[_0x7b71('0xe')][_0x7b71('0x11')](_0x4b927a);if(_0x188bac['result']===-0x1){return _0x188bac;}logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x3a24d7,_0x188bac[_0x7b71('0xa4')]));return this[_0x7b71('0xe')][_0x7b71('0xa1')](_0x3a24d7,_0x188bac['extra']);};AGIVertices[_0x7b71('0x10')]['isConfigured']=function(_0x5673db){return _0x5673db&&_0x5673db!=='0'&&_0x5673db!=='-1'&&_0x5673db!=='';};AGIVertices[_0x7b71('0x10')]['maxRetry']=function(_0x5dc3c3){this[_0x7b71('0x39')][_0x7b71('0xa7')](this,_0x5dc3c3,'-');_0x5dc3c3['retry']=_0x5dc3c3[_0x7b71('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x7b71('0xa9')]=function(_0x235350){logger[_0x7b71('0x33')](util['format'](_0x7b71('0xaa'),_0x235350['label']));if(!this[_0x7b71('0x87')](_0x235350['text'])){return this[_0x7b71('0xe')][_0x7b71('0xab')]('no\x20text\x20configured');}var _0x2d1fe3='\x22'+_0x235350[_0x7b71('0x5d')]+'\x22';if(this[_0x7b71('0x87')](_0x235350[_0x7b71('0x78')])){_0x2d1fe3+=','+_0x235350[_0x7b71('0x78')];}var _0x42f6d7=this['channel'][_0x7b71('0x59')](_0x7b71('0xac'),_0x2d1fe3);if(_0x42f6d7[_0x7b71('0xad')]===-0x1){return _0x42f6d7;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xae'),_0x2d1fe3));};AGIVertices[_0x7b71('0x10')][_0x7b71('0xaf')]=function(_0x360bd5){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x360bd5[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x360bd5[_0x7b71('0xb0')])){return this[_0x7b71('0xe')][_0x7b71('0xab')]('no\x20grammar\x20configured');}var _0xf7d3db=_0x360bd5['grammar'];if(this[_0x7b71('0x87')](_0x360bd5[_0x7b71('0x78')])){_0xf7d3db+=','+_0x360bd5[_0x7b71('0x78')];}var _0x1d6f93=this['channel'][_0x7b71('0x59')](_0x7b71('0xb1'),_0xf7d3db);if(_0x1d6f93[_0x7b71('0xad')]===-0x1){return _0x1d6f93;}var _0x3778d6=this[_0x7b71('0xa6')](_0x7b71('0xb2'),'MRCP_RECOG_CONFIDENCE');if(_0x3778d6[_0x7b71('0xad')]===-0x1){return _0x3778d6;}var _0x56e0ab=this['getAndSetVariable'](_0x7b71('0xb3'),_0x7b71('0xb4'));if(_0x56e0ab[_0x7b71('0xad')]===-0x1){return _0x56e0ab;}var _0xcf3dd6=this[_0x7b71('0xa6')](_0x7b71('0xb5'),_0x7b71('0xb6'));if(_0xcf3dd6['result']===-0x1){return _0xcf3dd6;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xb7'),_0xf7d3db));};AGIVertices[_0x7b71('0x10')][_0x7b71('0x6')]=function(_0x41dc95){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0xb8'),_0x41dc95[_0x7b71('0x3b')]));return this['channel']['agi']([_0x41dc95[_0x7b71('0xb9')],_0x41dc95[_0x7b71('0xba')]]);};AGIVertices[_0x7b71('0x10')][_0x7b71('0xbb')]=function(_0x513f35){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0xbc'),_0x513f35[_0x7b71('0x3b')]));if(this['isConfigured'](_0x513f35[_0x7b71('0x66')])){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x513f35[_0x7b71('0x66')]));var _0x3748e6=this[_0x7b71('0xe')][_0x7b71('0xbd')](_0x513f35[_0x7b71('0x66')]);if(_0x3748e6['result']===-0x1){return _0x3748e6;}}return this[_0x7b71('0xe')]['answer']();};AGIVertices[_0x7b71('0x10')][_0x7b71('0x4d')]=function(_0x54eeb8){logger[_0x7b71('0x33')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x54eeb8[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x54eeb8[_0x7b71('0xbe')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x54eeb8,'no\x20list\x20selected');}_0x54eeb8[_0x7b71('0x4c')]=moment();if(this['isConfigured'](_0x54eeb8[_0x7b71('0xbf')])){_0x54eeb8[_0x7b71('0x4c')]=moment()[_0x7b71('0xc0')](_0x54eeb8[_0x7b71('0xbf')],_0x7b71('0xc1'));}if(!this[_0x7b71('0x87')](_0x54eeb8['callback_priority'])){_0x54eeb8['callback_priority']=0x2;}this[_0x7b71('0x46')][_0x7b71('0xa7')](this,_0x54eeb8);return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xc2'),_0x54eeb8['phone'],_0x54eeb8[_0x7b71('0xbe')],_0x54eeb8[_0x7b71('0x4c')]));};AGIVertices[_0x7b71('0x10')][_0x7b71('0xc3')]=function(_0x57e3a6){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0xc4'),_0x57e3a6[_0x7b71('0x3b')]));var _0x5d14b5=this['channel'][_0x7b71('0x59')](_0x57e3a6[_0x7b71('0xc5')],_0x57e3a6[_0x7b71('0x78')]);if(_0x5d14b5['result']===-0x1){return _0x5d14b5;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xc6'),_0x57e3a6[_0x7b71('0xc5')],_0x57e3a6[_0x7b71('0x78')]));};AGIVertices[_0x7b71('0x10')][_0x7b71('0xc7')]=function(_0x1d308f){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1d308f[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x1d308f[_0x7b71('0x5d')])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xc8'));}var _0x169397='\x22'+_0x1d308f['text']+'\x22';if(this[_0x7b71('0x87')](_0x1d308f[_0x7b71('0x78')])){_0x169397+=','+_0x1d308f[_0x7b71('0x78')];}var _0x520011=this[_0x7b71('0xe')][_0x7b71('0x59')](_0x7b71('0xac'),_0x169397);if(_0x520011[_0x7b71('0xad')]===-0x1){return _0x520011;}return this[_0x7b71('0xe')]['noop'](util[_0x7b71('0x2b')](_0x7b71('0xae'),_0x169397));};AGIVertices['prototype'][_0x7b71('0xc9')]=function(_0x394db2){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x394db2[_0x7b71('0x3b')]));if(!this['isConfigured'](_0x394db2['text'])){return this['channel'][_0x7b71('0xab')](_0x7b71('0xc8'));}var _0x4bf980='\x22'+_0x394db2[_0x7b71('0x5d')]+'\x22';if(this[_0x7b71('0x87')](_0x394db2['options'])){_0x4bf980+=','+_0x394db2[_0x7b71('0x78')];}var _0x320356=this[_0x7b71('0xe')][_0x7b71('0x59')](_0x7b71('0xac'),_0x4bf980);if(_0x320356['result']===-0x1){return _0x320356;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xae'),_0x4bf980));};AGIVertices[_0x7b71('0x10')][_0x7b71('0xca')]=function(_0xcadd1b){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0xcb'),_0xcadd1b[_0x7b71('0x3b')]));if(!this['isConfigured'](_0xcadd1b['grammar'])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xcc'));}var _0x1a7212=_0xcadd1b[_0x7b71('0xb0')];if(this['isConfigured'](_0xcadd1b[_0x7b71('0x78')])){_0x1a7212+=','+_0xcadd1b[_0x7b71('0x78')];}var _0x57f295=this['channel'][_0x7b71('0x59')](_0x7b71('0xb1'),_0x1a7212);if(_0x57f295['result']===-0x1){return _0x57f295;}var _0xf67613=this[_0x7b71('0xa6')]('RECOG_CONFIDENCE()',_0x7b71('0xcd'));if(_0xf67613[_0x7b71('0xad')]===-0x1){return _0xf67613;}var _0xd138b=this[_0x7b71('0xa6')](_0x7b71('0xb3'),_0x7b71('0xce'));if(_0xd138b['result']===-0x1){return _0xd138b;}var _0x1476f4=this[_0x7b71('0xa6')]('RECOG_INSTANCE()',_0x7b71('0xcf'));if(_0x1476f4[_0x7b71('0xad')]===-0x1){return _0x1476f4;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x1a7212));};AGIVertices[_0x7b71('0x10')][_0x7b71('0xd0')]=function(_0x5f36a6){logger['info'](util[_0x7b71('0x2b')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x5f36a6[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x5f36a6['grammar'])){return this['channel'][_0x7b71('0xab')](_0x7b71('0xcc'));}var _0x56b2d5=_0x5f36a6[_0x7b71('0xb0')];if(this[_0x7b71('0x87')](_0x5f36a6[_0x7b71('0x78')])){_0x56b2d5+=','+_0x5f36a6[_0x7b71('0x78')];}var _0x1b634d=this[_0x7b71('0xe')][_0x7b71('0x59')](_0x7b71('0xb1'),_0x56b2d5);if(_0x1b634d[_0x7b71('0xad')]===-0x1){return _0x1b634d;}var _0xc843a9=this['getAndSetVariable'](_0x7b71('0xb2'),_0x7b71('0xd1'));if(_0xc843a9[_0x7b71('0xad')]===-0x1){return _0xc843a9;}var _0x55b3af=this['getAndSetVariable'](_0x7b71('0xb3'),'SESTEK_ASR_TRANSCRIPT');if(_0x55b3af[_0x7b71('0xad')]===-0x1){return _0x55b3af;}var _0x2b8f55=this['getAndSetVariable'](_0x7b71('0xb5'),_0x7b71('0xd2'));if(_0x2b8f55[_0x7b71('0xad')]===-0x1){return _0x2b8f55;}return this['channel'][_0x7b71('0xab')](util[_0x7b71('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x56b2d5));};AGIVertices[_0x7b71('0x10')]['database']=function(_0x2e16e5){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0xd3'),_0x2e16e5[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x2e16e5['odbc_id'])){return this[_0x7b71('0xe')]['error'](_0x2e16e5,_0x7b71('0xd4'));}var _0xeb3f38=this[_0x7b71('0x19')][_0x7b71('0xa7')](this,_0x2e16e5['odbc_id']);if(!_0xeb3f38){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x2e16e5,_0x7b71('0xd5'));}if(!this[_0x7b71('0x87')](_0x2e16e5[_0x7b71('0x31')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x2e16e5,_0x7b71('0xd6'));}var _0x3d8ecc=_0x2e16e5[_0x7b71('0x31')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x7b71('0xe')]['noop'](util[_0x7b71('0x2b')](_0x7b71('0xd7'),_0x3d8ecc));var _0x40890e=this[_0x7b71('0xd8')]['sync'](this,_0xeb3f38,_0x3d8ecc);this[_0x7b71('0x39')][_0x7b71('0xa7')](this,_0x2e16e5,_0x3d8ecc);if(!this[_0x7b71('0x87')](_0x2e16e5[_0x7b71('0xd9')])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xda'));}var _0x517bd8=this[_0x7b71('0x11')][_0x7b71('0xa7')](this,_0x2e16e5[_0x7b71('0xd9')]);if(!_0x517bd8){return this['channel'][_0x7b71('0x2e')](_0x2e16e5,'no\x20variable\x20found');}var _0x3a88f4=this;_0x40890e['forEach'](function(_0x5b3fcf,_0x3fa2c0){Object[_0x7b71('0xdb')](_0x5b3fcf)[_0x7b71('0xdc')](function(_0x1728f1){_0x3a88f4[_0x7b71('0xe')][_0x7b71('0xa1')](util[_0x7b71('0x2b')]('%s[%s][%s]',_0x517bd8,_0x3fa2c0,_0x1728f1),_0x5b3fcf[_0x1728f1]);});});this['channel'][_0x7b71('0xa1')](util[_0x7b71('0x2b')]('%s_ROWS_COUNT',_0x517bd8),_0x40890e[_0x7b71('0x9c')]);return this['channel'][_0x7b71('0xab')](util[_0x7b71('0x2b')]('variable\x20%s\x20set',_0x517bd8));};AGIVertices[_0x7b71('0x10')][_0x7b71('0xdd')]=function(_0x2ddc64){logger['debug'](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x2ddc64[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x2ddc64[_0x7b71('0xde')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x2ddc64,'no\x20user\x20selected');}var _0x5e70c6=this[_0x7b71('0x1c')]['sync'](this,_0x2ddc64[_0x7b71('0xde')]);if(!_0x5e70c6){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x2ddc64,'no\x20user\x20found');}var _0x1944d0=this['channel'][_0x7b71('0x59')](_0x7b71('0xdf'),[util[_0x7b71('0x2b')](_0x7b71('0xe0'),_0x5e70c6),_0x2ddc64[_0x7b71('0x66')],_0x2ddc64[_0x7b71('0xe1')],_0x2ddc64[_0x7b71('0x64')]]);if(_0x1944d0[_0x7b71('0xad')]===-0x1){return _0x1944d0;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xe2'),'DIAL'));};AGIVertices[_0x7b71('0x10')][_0x7b71('0xe3')]=function(_0x150f2d){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x150f2d[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x150f2d[_0x7b71('0x7a')])){return this['channel'][_0x7b71('0xab')]('no\x20key\x20configured');}if(!this[_0x7b71('0x87')](_0x150f2d[_0x7b71('0x5d')])){return this['channel'][_0x7b71('0xab')]('no\x20text\x20configured');}this[_0x7b71('0xe')][_0x7b71('0xe4')]=!![];this[_0x7b71('0x39')](_0x150f2d);this[_0x7b71('0x45')](_0x150f2d[_0x7b71('0x5d')],'in','','');this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xe5'),_0x150f2d[_0x7b71('0x5d')]));var _0x2c11eb=this[_0x7b71('0x79')][_0x7b71('0xa7')](this,_0x150f2d);if(_0x2c11eb){for(var _0x511f88 in _0x2c11eb){if(_0x2c11eb[_0x7b71('0x97')](_0x511f88)){this[_0x7b71('0xe')][_0x7b71('0xa1')](util[_0x7b71('0x2b')]('DIALOGFLOW_%s',_0x511f88[_0x7b71('0x6a')]()),_0x2c11eb[_0x511f88]);}}this[_0x7b71('0x45')](_0x2c11eb[_0x7b71('0xe6')],_0x7b71('0xe7'),_0x7b71('0xe3'),'');return this[_0x7b71('0xe')]['noop'](util['format'](_0x7b71('0xe8'),_0x2c11eb[_0x7b71('0xe6')]));}return this['channel']['error'](_0x150f2d,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype']['dialogflowV2']=function(_0x15a001){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x15a001[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x15a001[_0x7b71('0xe9')])){return this['channel']['noop'](_0x7b71('0xea'));}if(!this[_0x7b71('0x87')](_0x15a001['client_email'])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xeb'));}if(!this[_0x7b71('0x87')](_0x15a001[_0x7b71('0x7e')])){return this[_0x7b71('0xe')]['noop'](_0x7b71('0xec'));}if(!this[_0x7b71('0x87')](_0x15a001[_0x7b71('0x7f')])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xed'));}if(!this[_0x7b71('0x87')](_0x15a001[_0x7b71('0x5d')])){return this[_0x7b71('0xe')]['noop']('no\x20text\x20configured');}this[_0x7b71('0xe')][_0x7b71('0xe4')]=!![];this[_0x7b71('0x39')](_0x15a001);this[_0x7b71('0x45')](_0x15a001[_0x7b71('0x5d')],'in','','');this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xee'),_0x15a001[_0x7b71('0x5d')]));var _0x36f1fb=this[_0x7b71('0x7c')][_0x7b71('0xa7')](this,_0x15a001);if(_0x36f1fb){for(var _0x5c6127 in _0x36f1fb){if(_0x36f1fb[_0x7b71('0x97')](_0x5c6127)){if(_0x5c6127!==_0x7b71('0xef')){this[_0x7b71('0xe')][_0x7b71('0xa1')](util[_0x7b71('0x2b')](_0x7b71('0xf0'),_0x5c6127[_0x7b71('0x6a')]()),_0x36f1fb[_0x5c6127]);}}}this[_0x7b71('0x45')](_0x36f1fb['speech'],_0x7b71('0xe7'),_0x7b71('0xf1'),_0x36f1fb[_0x7b71('0xef')]);return this[_0x7b71('0xe')]['noop'](util['format'](_0x7b71('0xf2'),_0x36f1fb[_0x7b71('0xe6')]));}return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x15a001,_0x7b71('0xf3'));};AGIVertices['prototype'][_0x7b71('0xf4')]=function(_0xdb046f){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0xdb046f[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0xdb046f[_0x7b71('0xf5')])){return this['channel'][_0x7b71('0xab')](_0x7b71('0xf6'));}if(!this[_0x7b71('0x87')](_0xdb046f[_0x7b71('0xf7')])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xf8'));}if(!this[_0x7b71('0x87')](_0xdb046f['password'])){return this[_0x7b71('0xe')][_0x7b71('0xab')]('no\x20password\x20configured');}if(!this[_0x7b71('0x87')](_0xdb046f[_0x7b71('0xf9')])){return this['channel'][_0x7b71('0xab')](_0x7b71('0xc8'));}this[_0x7b71('0xe')][_0x7b71('0xe4')]=!![];this['createSquareDetailsReport'](_0xdb046f);this['createSquareMessage'](_0xdb046f[_0x7b71('0x5d')],'in','','');this['channel']['noop'](util[_0x7b71('0x2b')](_0x7b71('0xfa'),_0xdb046f[_0x7b71('0x5d')]));var _0x298952=this[_0x7b71('0x80')][_0x7b71('0xa7')](this,_0xdb046f);if(_0x298952){for(var _0x35929f in _0x298952){if(_0x298952[_0x7b71('0x97')](_0x35929f)){this['channel'][_0x7b71('0xa1')](util['format']('SESTEK_NDA_%s',_0x35929f['toUpperCase']()),_0x298952[_0x35929f]);}}this[_0x7b71('0x45')](_0x298952[_0x7b71('0xe6')],_0x7b71('0xe7'),_0x7b71('0xf4'),'');if(_0x298952[_0x7b71('0xfb')]){this[_0x7b71('0xe')]['noop'](util[_0x7b71('0x2b')](_0x7b71('0xfc'),_0x298952[_0x7b71('0xfb')]));var _0x59c39f=this[_0x7b71('0xe')][_0x7b71('0xfd')](_0x298952[_0x7b71('0xfb')]);try{fs[_0x7b71('0xfe')](_0x298952[_0x7b71('0xfb')]+'.wav');}catch(_0x506881){logger[_0x7b71('0x2e')](_0x506881);}return _0x59c39f;}else{return this[_0x7b71('0xe')][_0x7b71('0xab')](util['format'](_0x7b71('0xff'),_0x298952['speech']));}}return this['channel'][_0x7b71('0x2e')](_0xdb046f,_0x7b71('0x100'));};AGIVertices['prototype'][_0x7b71('0x101')]=function(_0x23e4bc){logger['info'](util['format'](_0x7b71('0x102'),_0x23e4bc['label']));return this['channel'][_0x7b71('0xab')](_0x7b71('0x101'));};AGIVertices['prototype'][_0x7b71('0x103')]=function(_0x2a7868){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x104'),_0x2a7868['label']));var _0x51687c='';if(_0x2a7868[_0x7b71('0x105')]){if(!this['isConfigured'](_0x2a7868['trunk_id'])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x2a7868,_0x7b71('0x106'));}else{var _0x276f13=parseInt(_0x2a7868['trunk_id'],0xa);if(isNaN(_0x276f13)){_0x51687c=_0x2a7868[_0x7b71('0x105')];}else{_0x51687c=this[_0x7b71('0x1d')][_0x7b71('0xa7')](this,_0x2a7868['trunk_id']);if(!_0x51687c){return this['channel']['error'](_0x2a7868,_0x7b71('0x107'));}}}}else if(_0x2a7868['trunk_name']){_0x51687c=_0x2a7868[_0x7b71('0x108')];}else{return this['channel']['error'](_0x2a7868,'no\x20trunk\x20selected');}var _0x555954=this[_0x7b71('0xe')][_0x7b71('0x59')](_0x7b71('0xdf'),[util[_0x7b71('0x2b')](_0x7b71('0x109'),_0x51687c,_0x2a7868[_0x7b71('0x10a')]),_0x2a7868[_0x7b71('0x66')],_0x2a7868[_0x7b71('0xe1')],_0x2a7868[_0x7b71('0x64')]]);if(_0x555954[_0x7b71('0xad')]===-0x1){return _0x555954;}return this['channel'][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xe2'),_0x7b71('0xdf')));};AGIVertices['prototype'][_0x7b71('0x10b')]=function(_0x5563a0){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x10c'),_0x5563a0[_0x7b71('0x3b')]));return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0x10b'));};AGIVertices[_0x7b71('0x10')][_0x7b71('0xc')]=function(_0x66c78){logger['info'](util[_0x7b71('0x2b')](_0x7b71('0x10d'),_0x66c78[_0x7b71('0x3b')]));if(_0x66c78[_0x7b71('0x10e')]===0x0){return this[_0x7b71('0xa8')](_0x66c78);}_0x66c78[_0x7b71('0x10e')]-=0x1;if(!this[_0x7b71('0x87')](_0x66c78[_0x7b71('0x10f')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x66c78,_0x7b71('0x110'));}var _0x3aad7a=this[_0x7b71('0x1f')]['sync'](this,_0x66c78[_0x7b71('0x10f')]);if(!_0x3aad7a){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x66c78,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x66c78[_0x7b71('0xd9')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x7b71('0xda'));}var _0x13d21d=this['channel'][_0x7b71('0x111')](_0x3aad7a,_0x66c78['response'],_0x66c78['maxdigit']);var _0x4f463d=_0x13d21d['result']?_0x13d21d['result']['toString']():'';logger[_0x7b71('0x33')](_0x7b71('0x112'),JSON[_0x7b71('0x73')](_0x13d21d));if(_0x13d21d['result']===-0x1){this['createSquareDetailsReport'][_0x7b71('0xa7')](this,_0x66c78,_0x4f463d);return _0x13d21d;}else if(_0x13d21d['extra']===_0x7b71('0x66')){_0x13d21d[_0x7b71('0xad')]=_0x4f463d[_0x7b71('0x9c')]>=parseInt(_0x66c78[_0x7b71('0x113')])?'x':'i';}else{_0x13d21d['result']=_0x4f463d['length']>=parseInt(_0x66c78[_0x7b71('0x113')])&&_0x4f463d['length']<=parseInt(_0x66c78[_0x7b71('0x114')])?'x':'i';}var _0x2a8282=this[_0x7b71('0x11')][_0x7b71('0xa7')](this,_0x66c78[_0x7b71('0xd9')]);if(!_0x2a8282){return this['channel'][_0x7b71('0x2e')](_0x66c78,_0x7b71('0x115'));}this[_0x7b71('0xe')][_0x7b71('0xa1')](_0x2a8282,_0x4f463d);if(this[_0x7b71('0x87')](_0x66c78['hiddendigitsnum'])){var _0x5f2519=parseInt(_0x66c78['hiddendigitsnum'],0xa);var _0x14e82f=rs[_0x7b71('0x116')]({'charset':'*','length':_0x5f2519});var _0x55342a=_0x4f463d[_0x7b71('0x9c')];if(_0x55342a>0x0){if(_0x55342a>_0x5f2519){this[_0x7b71('0x39')][_0x7b71('0xa7')](this,_0x66c78,_0x66c78['hiddendigitspos']==='first'?_0x14e82f+_0x4f463d[_0x7b71('0x117')](_0x5f2519):_0x4f463d[_0x7b71('0x117')](0x0,_0x55342a-_0x5f2519)+_0x14e82f);}else{this[_0x7b71('0x39')][_0x7b71('0xa7')](this,_0x66c78,rs[_0x7b71('0x116')]({'charset':'*','length':_0x55342a}));}}else{this[_0x7b71('0x39')]['sync'](this,_0x66c78,'');}}else{this[_0x7b71('0x39')][_0x7b71('0xa7')](this,_0x66c78,_0x4f463d);}return _0x13d21d;};AGIVertices[_0x7b71('0x10')][_0x7b71('0xd')]=function(_0x4cd59f){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x4cd59f[_0x7b71('0x3b')]));return this['getdigits'](_0x4cd59f);};AGIVertices[_0x7b71('0x10')][_0x7b71('0x118')]=function(_0x1d4e15){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x119'),_0x1d4e15[_0x7b71('0x3b')]));this[_0x7b71('0x39')]['sync'](this,_0x1d4e15,_0x1d4e15[_0x7b71('0x11a')]);return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')]('GOAL\x20%s',_0x1d4e15[_0x7b71('0x11a')]));};AGIVertices['prototype']['awspolly']=function(_0x783b5f){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x11b'),_0x783b5f[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x783b5f[_0x7b71('0x8a')])||!this[_0x7b71('0x87')](_0x783b5f[_0x7b71('0x11c')])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0x11d'));}if(!this[_0x7b71('0x87')](_0x783b5f[_0x7b71('0x5d')])){return this[_0x7b71('0xe')][_0x7b71('0xab')]('no\x20text\x20configured');}this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x11e'),_0x783b5f['text']));var _0x58cb84=this['awsPolly'][_0x7b71('0xa7')](this,_0x783b5f);if(_0x58cb84){this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x11f'),_0x58cb84));var _0x16e5d5=this[_0x7b71('0xe')][_0x7b71('0xfd')](_0x58cb84);try{fs[_0x7b71('0xfe')](_0x58cb84+'.wav');}catch(_0xf52364){logger[_0x7b71('0x2e')](_0xf52364);}return _0x16e5d5;}return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x783b5f,_0x7b71('0x120'));};AGIVertices['prototype'][_0x7b71('0x121')]=function(_0x30fdfd){logger[_0x7b71('0x33')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x30fdfd[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x30fdfd[_0x7b71('0x8a')])||!this[_0x7b71('0x87')](_0x30fdfd[_0x7b71('0x11c')])){return this[_0x7b71('0xe')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x7b71('0x87')](_0x30fdfd[_0x7b71('0x8e')])){return this[_0x7b71('0xe')]['noop'](_0x7b71('0x122'));}if(!this[_0x7b71('0x87')](_0x30fdfd[_0x7b71('0x5d')])){return this[_0x7b71('0xe')]['noop'](_0x7b71('0xc8'));}this[_0x7b71('0xe')]['bot']=!![];this[_0x7b71('0x39')](_0x30fdfd);this[_0x7b71('0x45')](_0x30fdfd[_0x7b71('0x5d')],'in','','');this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x123'),_0x30fdfd[_0x7b71('0x5d')]));var _0x321a2c=this[_0x7b71('0x8c')]['sync'](this,_0x30fdfd);if(_0x321a2c){for(var _0x47f1c9 in _0x321a2c){if(_0x321a2c[_0x7b71('0x97')](_0x47f1c9)&&_[_0x7b71('0x9d')](_0x321a2c[_0x47f1c9])){this[_0x7b71('0xe')][_0x7b71('0xa1')](util['format'](_0x7b71('0x124'),_0x47f1c9['toUpperCase']()),_0x321a2c[_0x47f1c9]);}}if(_[_0x7b71('0x47')](_0x321a2c[_0x7b71('0x76')])){return this[_0x7b71('0xe')]['noop'](_0x7b71('0x125'));}else{this[_0x7b71('0x45')](_0x321a2c[_0x7b71('0x76')],'out',_0x7b71('0x126'),'');return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x127'),_0x321a2c[_0x7b71('0x76')]));}}return this['channel'][_0x7b71('0x2e')](_0x30fdfd,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x7b71('0x10')][_0x7b71('0x128')]=function(_0x588d86){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x129'),_0x588d86[_0x7b71('0x3b')],_0x588d86[_0x7b71('0x66')]));if(!this['isConfigured'](_0x588d86['key'])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0x12a'));}var _0x1a0500=_0x7b71('0x12b');var _0x1689e1=util[_0x7b71('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0x7b71('0x116')](0x4));var _0x7c551c=util[_0x7b71('0x2b')](_0x7b71('0xa0'),_0x1689e1,_0x1a0500);var _0x332a7b=!![];if(_0x588d86[_0x7b71('0x12c')]==='NOBEEP'){_0x332a7b=![];}var _0x1735d2=this[_0x7b71('0xe')][_0x7b71('0x12d')](_0x1689e1,_0x1a0500,_0x588d86[_0x7b71('0x12e')],_0x588d86['timeout'],undefined,_0x332a7b);if(_0x1735d2[_0x7b71('0xad')]!==-0x1){this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x12f'),_0x7c551c));var _0x932ff8=this[_0x7b71('0x8f')][_0x7b71('0xa7')](this,_0x588d86,_0x7c551c);if(_0x932ff8){for(var _0x373b96 in _0x932ff8){if(_0x932ff8[_0x7b71('0x97')](_0x373b96)){this[_0x7b71('0xe')][_0x7b71('0xa1')](util[_0x7b71('0x2b')](_0x7b71('0x130'),_0x373b96['toUpperCase']()),_0x932ff8[_0x373b96]);}}return this[_0x7b71('0xe')]['noop'](util[_0x7b71('0x2b')](_0x7b71('0x131'),JSON[_0x7b71('0x73')](_0x932ff8)));}}return _0x1735d2;};AGIVertices[_0x7b71('0x10')]['tildeasr']=function(_0x139700){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x132'),_0x139700[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x139700[_0x7b71('0x92')])){return this[_0x7b71('0xe')]['noop'](_0x7b71('0x133'));}if(!this[_0x7b71('0x87')](_0x139700[_0x7b71('0x93')])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0x134'));}var _0xf4ecac='wav';var _0x112da2=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x7b71('0x116')](0x4));var _0x1ce689=util[_0x7b71('0x2b')]('%s.%s',_0x112da2,_0xf4ecac);var _0x5007b1=!![];if(_0x139700[_0x7b71('0x12c')]===_0x7b71('0x135')){_0x5007b1=![];}var _0x2576db=this[_0x7b71('0xe')][_0x7b71('0x12d')](_0x112da2,_0xf4ecac,_0x139700['intKey'],_0x139700[_0x7b71('0x66')],undefined,_0x5007b1);if(_0x2576db['result']!==-0x1){this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x136'),_0x1ce689));var _0x13bbc0=this['tildeASR'][_0x7b71('0xa7')](this,_0x139700,_0x1ce689);if(_0x13bbc0){for(var _0x12a279 in _0x13bbc0){if(_0x13bbc0[_0x7b71('0x97')](_0x12a279)){this[_0x7b71('0xe')][_0x7b71('0xa1')](util[_0x7b71('0x2b')](_0x7b71('0x137'),_0x12a279['toUpperCase']()),_0x13bbc0[_0x12a279]);}}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x138'),JSON[_0x7b71('0x73')](_0x13bbc0)));}}return _0x2576db;};AGIVertices[_0x7b71('0x10')]['gotoc']=function(_0x2e76c5){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x2e76c5[_0x7b71('0x3b')]));return this[_0x7b71('0xe')][_0x7b71('0x139')](_0x2e76c5[_0x7b71('0x40')],_0x2e76c5[_0x7b71('0x41')],_0x2e76c5[_0x7b71('0x42')]);};AGIVertices[_0x7b71('0x10')]['gotoif']=function(_0x11170b){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x11170b[_0x7b71('0x3b')]));if(!this['isConfigured'](_0x11170b[_0x7b71('0x13a')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x11170b,_0x7b71('0x13b'));}try{var _0x33f111=eval(_0x11170b[_0x7b71('0x13a')])?_0x7b71('0x13c'):_0x7b71('0x13d');this['channel'][_0x7b71('0xab')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x11170b[_0x7b71('0x13a')],_0x33f111));return{'code':0xc8,'result':_0x33f111};}catch(_0xdca961){return{'code':0xc8,'result':_0x7b71('0x13d')};}};AGIVertices[_0x7b71('0x10')][_0x7b71('0x13e')]=function(_0x55735f){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x13f'),_0x55735f[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x55735f[_0x7b71('0x140')])){return this['channel'][_0x7b71('0x2e')](_0x55735f,_0x7b71('0x141'));}var _0x364b99=this['getIntervals'][_0x7b71('0xa7')](this,_0x55735f[_0x7b71('0x140')]);if(!_0x364b99){return this[_0x7b71('0xe')]['error'](_0x55735f,_0x7b71('0x142'));}for(var _0x1e1df6=0x0;_0x1e1df6<_0x364b99[_0x7b71('0x9c')];_0x1e1df6+=0x1){var _0x142ce1=this[_0x7b71('0xe')][_0x7b71('0x11')](util[_0x7b71('0x2b')](_0x7b71('0x143'),_0x364b99[_0x1e1df6]));if(_0x142ce1['result']===-0x1){return _0x142ce1;}logger[_0x7b71('0x33')](util['format'](_0x7b71('0x144'),_0x364b99[_0x1e1df6],_0x142ce1[_0x7b71('0xa4')]));if(_0x142ce1[_0x7b71('0xa4')]===_0x7b71('0x13c')){logger['info'](util[_0x7b71('0x2b')](_0x7b71('0x144'),_0x364b99[_0x1e1df6],_0x7b71('0x13c')));this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')]('IFTIME\x20%s\x20%s',_0x364b99[_0x1e1df6],_0x7b71('0x13c')));return{'code':0xc8,'result':'true'};}else{logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x144'),_0x364b99[_0x1e1df6],'false'));this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x144'),_0x364b99[_0x1e1df6],_0x7b71('0x13d')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x7b71('0x10')][_0x7b71('0x145')]=function(_0x30b996){logger['info'](util[_0x7b71('0x2b')](_0x7b71('0x146'),_0x30b996[_0x7b71('0x3b')]));return this['channel'][_0x7b71('0x145')]();};AGIVertices[_0x7b71('0x10')][_0x7b71('0x147')]=function(_0x35eb13){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x148'),_0x35eb13[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x35eb13[_0x7b71('0x7a')])){return this['channel'][_0x7b71('0xab')](_0x7b71('0x12a'));}var _0x18b6a0=_0x7b71('0x12b');var _0x2051f4=util[_0x7b71('0x2b')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x137daa=util[_0x7b71('0x2b')](_0x7b71('0xa0'),_0x2051f4,_0x18b6a0);var _0x14d2a6=!![];if(_0x35eb13[_0x7b71('0x12c')]==='NOBEEP'){_0x14d2a6=![];}var _0x556536=this[_0x7b71('0xe')][_0x7b71('0x12d')](_0x2051f4,_0x18b6a0,_0x35eb13['intKey'],_0x35eb13[_0x7b71('0x66')],undefined,_0x14d2a6);if(_0x556536[_0x7b71('0xad')]!==-0x1){this['channel'][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x149'),_0x137daa));var _0x2cce64=this[_0x7b71('0x84')]['sync'](this,_0x35eb13,_0x137daa);if(_0x2cce64){for(var _0x560a8d in _0x2cce64){if(_0x2cce64['hasOwnProperty'](_0x560a8d)){this[_0x7b71('0xe')]['setVariable'](util['format']('ISPEECH_ASR_%s',_0x560a8d[_0x7b71('0x6a')]()),_0x2cce64[_0x560a8d]);}}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x14a'),JSON[_0x7b71('0x73')](_0x2cce64)));}}return _0x556536;};AGIVertices[_0x7b71('0x10')]['ispeechtts']=function(_0x41495d){logger['info'](util['format'](_0x7b71('0x14b'),_0x41495d['label']));if(!this['isConfigured'](_0x41495d[_0x7b71('0x7a')])){return this[_0x7b71('0xe')]['noop'](_0x7b71('0x12a'));}if(!this[_0x7b71('0x87')](_0x41495d['text'])){return this[_0x7b71('0xe')][_0x7b71('0xab')]('no\x20text\x20configured');}this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x14c'),_0x41495d['text']));var _0x2d9fa7=this['ispeechTTS'][_0x7b71('0xa7')](this,_0x41495d);if(_0x2d9fa7){this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x149'),_0x2d9fa7));var _0x18a96f=this['channel'][_0x7b71('0xfd')](_0x2d9fa7,_0x41495d[_0x7b71('0x12e')]);try{fs['unlink'](_0x2d9fa7+_0x7b71('0x14d'));}catch(_0x497190){logger['error'](_0x497190);}return _0x18a96f;}return this['channel'][_0x7b71('0x2e')](_0x41495d,_0x7b71('0x14e'));};AGIVertices['prototype'][_0x7b71('0x14f')]=function(_0x3809a3){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x150'),_0x3809a3['label']));if(!this[_0x7b71('0x87')](_0x3809a3[_0x7b71('0x151')])){return this['channel']['error'](_0x3809a3,_0x7b71('0x152'));}logger['info'](util[_0x7b71('0x2b')](_0x7b71('0x153'),this['channel'][_0x7b71('0x3f')],_0x3809a3['findBy']));var _0x59be22=this[_0x7b71('0x55')][_0x7b71('0xa7')](this,_0x3809a3[_0x7b71('0x151')]);if(_0x59be22){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x154'),this['channel'][_0x7b71('0x3f')],_0x3809a3[_0x7b71('0x151')]));this[_0x7b71('0xe')][_0x7b71('0xab')](util['format'](_0x7b71('0x154'),this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x3809a3['findBy']));return{'code':0xc8,'result':_0x7b71('0x155')};}else{logger['info'](util[_0x7b71('0x2b')](_0x7b71('0x156'),this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x3809a3[_0x7b71('0x151')]));this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x156'),this[_0x7b71('0xe')]['callerid'],_0x3809a3[_0x7b71('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7b71('0x10')][_0x7b71('0x157')]=function(_0x446f9e){logger[_0x7b71('0x33')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x446f9e[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x446f9e[_0x7b71('0x151')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x446f9e,_0x7b71('0x152'));}logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x153'),this['channel'][_0x7b71('0x3f')],_0x446f9e[_0x7b71('0x151')]));var _0x5bf531=this[_0x7b71('0x54')]['sync'](this,_0x446f9e[_0x7b71('0x151')]);if(_0x5bf531){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x154'),this['channel'][_0x7b71('0x3f')],_0x446f9e[_0x7b71('0x151')]));this['channel']['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x446f9e['findBy']));return{'code':0xc8,'result':_0x7b71('0x155')};}else{logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x156'),this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x446f9e[_0x7b71('0x151')]));this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x156'),this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x446f9e[_0x7b71('0x151')]));return{'code':0xc8,'result':_0x7b71('0x158')};}};AGIVertices[_0x7b71('0x10')]['math']=function(_0x4b48d3){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x159'),_0x4b48d3[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x4b48d3[_0x7b71('0x15a')])){return this[_0x7b71('0xe')]['error'](_0x4b48d3,'no\x20operation\x20configured');}this[_0x7b71('0xe')][_0x7b71('0xab')](util['format'](_0x7b71('0x15b'),_0x4b48d3[_0x7b71('0x15a')]));var _0x455858=eval(_0x4b48d3['operation']);if(!this[_0x7b71('0x87')](_0x4b48d3[_0x7b71('0xd9')])){return this[_0x7b71('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1031b3=this[_0x7b71('0x11')][_0x7b71('0xa7')](this,_0x4b48d3['variable_id']);if(!_0x1031b3){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x4b48d3,_0x7b71('0x115'));}if(_[_0x7b71('0x9b')](_0x455858)){var _0x24e67c=this;_0x455858[_0x7b71('0xdc')](function(_0x2247e2,_0x507341){_0x24e67c[_0x7b71('0xe')]['setVariable'](util[_0x7b71('0x2b')]('%s[%s]',_0x1031b3,_0x507341),_0x2247e2);});return this[_0x7b71('0xe')]['noop'](util['format'](_0x7b71('0x15c'),_0x1031b3));}else{return this[_0x7b71('0xe')][_0x7b71('0xa1')](_0x1031b3,_0x455858);}};AGIVertices[_0x7b71('0x10')][_0x7b71('0xb')]=function(_0x25a9cd){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x15d'),_0x25a9cd[_0x7b71('0x3b')]));if(_0x25a9cd['retry']===0x0){return this[_0x7b71('0xa8')](_0x25a9cd);}_0x25a9cd[_0x7b71('0x10e')]-=0x1;if(!this['isConfigured'](_0x25a9cd[_0x7b71('0x10f')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x25a9cd,_0x7b71('0x110'));}var _0x26b243=this[_0x7b71('0x1f')][_0x7b71('0xa7')](this,_0x25a9cd[_0x7b71('0x10f')]);if(!_0x26b243){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x25a9cd,_0x7b71('0x15e'));}var _0x4d9bc3=this[_0x7b71('0xe')][_0x7b71('0x111')](_0x26b243,_0x25a9cd[_0x7b71('0x15f')],_0x25a9cd[_0x7b71('0x160')]);var _0x4c3d9b=_0x4d9bc3[_0x7b71('0xad')];if(_0x4d9bc3[_0x7b71('0xad')]===-0x1){this[_0x7b71('0x39')]['sync'](this,_0x25a9cd,'-1');return _0x4d9bc3;}else if(_0x4d9bc3[_0x7b71('0xa4')]===_0x7b71('0x66')){_0x4d9bc3[_0x7b71('0xad')]=_0x4d9bc3[_0x7b71('0xad')][_0x7b71('0x9c')]>0x0?_0x4d9bc3[_0x7b71('0xad')]:'t';}else if(_[_0x7b71('0x4a')](_0x4d9bc3['result'])){_0x4d9bc3['result']='#';_0x4c3d9b='#';}if(!this[_0x7b71('0x87')](_0x25a9cd['variable_id'])){this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xda'));}else{var _0x130787=this[_0x7b71('0x11')][_0x7b71('0xa7')](this,_0x25a9cd[_0x7b71('0xd9')]);if(!_0x130787){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x25a9cd,_0x7b71('0x115'));}this['channel'][_0x7b71('0xa1')](_0x130787,_0x4c3d9b);}this[_0x7b71('0x39')]['sync'](this,_0x25a9cd,_0x4c3d9b);return _0x4d9bc3;};AGIVertices[_0x7b71('0x10')][_0x7b71('0xab')]=function(_0x1db714){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x161'),_0x1db714[_0x7b71('0x3b')]));return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x1db714['output']||_0x1db714[_0x7b71('0x3b')]);};AGIVertices[_0x7b71('0x10')][_0x7b71('0x162')]=function(_0x2e74ff){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x163'),_0x2e74ff[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x2e74ff['findBy'])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x2e74ff,_0x7b71('0x152'));}logger[_0x7b71('0x33')](util['format'](_0x7b71('0x153'),this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x2e74ff['findBy']));var _0x4acaa2=this[_0x7b71('0x4f')][_0x7b71('0xa7')](this,_0x2e74ff[_0x7b71('0x164')]);var _0xa29f32=this[_0x7b71('0x51')][_0x7b71('0xa7')](this,_0x2e74ff[_0x7b71('0x151')],_0x4acaa2);if(_0xa29f32){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x154'),this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x2e74ff[_0x7b71('0x151')]));this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x7b71('0x3f')],_0x2e74ff['findBy']));return{'code':0xc8,'result':_0x7b71('0x155')};}else{logger['info'](util[_0x7b71('0x2b')](_0x7b71('0x156'),this['channel'][_0x7b71('0x3f')],_0x2e74ff[_0x7b71('0x151')]));this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x7b71('0x3f')],_0x2e74ff[_0x7b71('0x151')]));return{'code':0xc8,'result':_0x7b71('0x158')};}};AGIVertices[_0x7b71('0x10')][_0x7b71('0x165')]=function(_0x217fd9){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x166'),_0x217fd9[_0x7b71('0x3b')]));if(!this['isConfigured'](_0x217fd9[_0x7b71('0x10f')])){return this[_0x7b71('0xe')]['error'](_0x217fd9,_0x7b71('0x110'));}var _0x343d7f=this[_0x7b71('0x1f')][_0x7b71('0xa7')](this,_0x217fd9[_0x7b71('0x10f')]);if(!_0x343d7f){return this['channel']['error'](_0x217fd9,_0x7b71('0x15e'));}var _0x2efa23=this[_0x7b71('0xe')][_0x7b71('0x59')](_0x7b71('0x167'),[_0x343d7f,_0x217fd9['opts']]);if(_0x2efa23[_0x7b71('0xad')]===-0x1){return _0x2efa23;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xc6'),'PLAYBACK',_0x343d7f));};AGIVertices[_0x7b71('0x10')]['queue']=function(_0x478558){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x478558[_0x7b71('0x3b')]));if(!this['isConfigured'](_0x478558[_0x7b71('0x168')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x478558,'no\x20queue\x20selected');}var _0x20ce9c='';var _0x316576=parseInt(_0x478558[_0x7b71('0x168')],0xa);if(isNaN(_0x316576)){_0x20ce9c=_0x478558[_0x7b71('0x168')];}else{_0x20ce9c=this['getVoiceQueue'][_0x7b71('0xa7')](this,_0x478558[_0x7b71('0x168')]);if(!_0x20ce9c){return this[_0x7b71('0xe')]['error'](_0x478558,'no\x20queue\x20found');}}var _0x697f0f='';if(this[_0x7b71('0x87')](_0x478558[_0x7b71('0x10f')])){var _0x3c9325=this[_0x7b71('0x1f')][_0x7b71('0xa7')](this,_0x478558['file_id']);if(_0x3c9325){_0x697f0f=_0x3c9325;}}this[_0x7b71('0x39')][_0x7b71('0xa7')](this,_0x478558,_0x20ce9c);if(_0x478558[_0x7b71('0xe1')]['indexOf']('x')<0x0){_0x478558[_0x7b71('0xe1')]+='x';}if(_0x478558[_0x7b71('0xe1')]['indexOf']('X')<0x0){_0x478558[_0x7b71('0xe1')]+='X';}this[_0x7b71('0xe')][_0x7b71('0xa1')](_0x7b71('0x169'),_0x20ce9c?_0x20ce9c[_0x7b71('0x16a')]():'');var _0x514dce=this['channel']['exec'](_0x7b71('0x16b'),[_0x20ce9c,_0x478558['opts'],_0x478558['url'],_0x697f0f,_0x478558['timeout'],_0x478558[_0x7b71('0x6')],_0x478558[_0x7b71('0x16c')],_0x478558[_0x7b71('0x16d')],'',_0x478558[_0x7b71('0x16e')]]);if(_0x514dce[_0x7b71('0xad')]===-0x1){return _0x514dce;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xc6'),_0x7b71('0x16b'),_0x20ce9c));};AGIVertices[_0x7b71('0x10')][_0x7b71('0x16f')]=function(_0x56988d){logger['info'](util[_0x7b71('0x2b')](_0x7b71('0x170'),_0x56988d[_0x7b71('0x3b')]));var _0x2c790c=_0x56988d[_0x7b71('0x171')]||'wav';var _0xf98623=util[_0x7b71('0x2b')](_0x7b71('0x172'),this['channel'][_0x7b71('0x3a')],rs[_0x7b71('0x116')](0x5));var _0x133fb0=util['format'](_0x7b71('0x173'),FILES_PATH,_0xf98623,_0x2c790c);var _0x4c34b7=util['format'](_0x7b71('0x174'),FILES_PATH,_0xf98623);this[_0x7b71('0x3e')][_0x7b71('0xa7')](this,_0x56988d,_0xf98623,_0x133fb0);this[_0x7b71('0xe')][_0x7b71('0xa1')](_0x7b71('0x175'),_0xf98623);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x4c34b7,_0x2c790c,_0x56988d[_0x7b71('0x176')],_0x56988d[_0x7b71('0x66')]);return this[_0x7b71('0xe')][_0x7b71('0x12d')](_0x4c34b7,_0x2c790c,_0x56988d[_0x7b71('0x176')],_0x56988d[_0x7b71('0x66')],undefined,!![]);};AGIVertices[_0x7b71('0x10')][_0x7b71('0x177')]=function(_0x12e4cf){logger['info'](util[_0x7b71('0x2b')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x12e4cf[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x12e4cf['url'])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0x178'));}var _0x39397e=this['restAPI'][_0x7b71('0xa7')](this,_0x12e4cf);logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x179'),util[_0x7b71('0x17a')](_0x39397e,{'showHidden':![],'depth':null})));if(!this[_0x7b71('0x87')](_0x12e4cf[_0x7b71('0xd9')])){return this[_0x7b71('0xe')][_0x7b71('0xab')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x1bef21=this[_0x7b71('0x11')]['sync'](this,_0x12e4cf[_0x7b71('0xd9')]);if(!_0x1bef21){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x12e4cf,_0x7b71('0x115'));}this['channel'][_0x7b71('0xa1')](util[_0x7b71('0x2b')](_0x7b71('0x17b'),_0x1bef21),_0x39397e['statusCode']?_0x39397e[_0x7b71('0x74')]:'200');this[_0x7b71('0xe')]['setVariable'](util[_0x7b71('0x2b')](_0x7b71('0x17c'),_0x1bef21),_0x39397e[_0x7b71('0x75')]?_0x39397e[_0x7b71('0x75')]:'OK');if(_0x39397e[_0x7b71('0x6b')]){try{this[_0x7b71('0x9f')](_0x39397e[_0x7b71('0x6b')],_0x1bef21);}catch(_0x415729){logger[_0x7b71('0x2e')](util['format'](_0x7b71('0x17d'),_0x1bef21));}}return this['channel']['noop'](util[_0x7b71('0x2b')]('variable\x20%s\x20set',_0x1bef21));};AGIVertices[_0x7b71('0x10')][_0x7b71('0x17e')]=function(_0x2a9b4f){logger['info'](util['format'](_0x7b71('0x17f'),_0x2a9b4f[_0x7b71('0x3b')]));return this[_0x7b71('0xe')]['sayDigits'](_0x2a9b4f[_0x7b71('0x180')][_0x7b71('0x5b')](/\s+/g,''),_0x2a9b4f['escape_digits']);};AGIVertices[_0x7b71('0x10')]['saynumber']=function(_0x4506a5){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x181'),_0x4506a5['label']));return this[_0x7b71('0xe')]['sayNumber'](_0x4506a5[_0x7b71('0x67')]['replace'](/\s+/g,''),_0x4506a5['escape_digits']);};AGIVertices[_0x7b71('0x10')][_0x7b71('0x182')]=function(_0x5cc919){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x5cc919[_0x7b71('0x3b')]));return this['channel'][_0x7b71('0x183')](_0x5cc919[_0x7b71('0x5d')],_0x5cc919['escape_digits']);};AGIVertices[_0x7b71('0x10')][_0x7b71('0x184')]=function(_0x27b291){logger['info'](util[_0x7b71('0x2b')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x27b291['label']));if(!this[_0x7b71('0x87')](_0x27b291[_0x7b71('0x185')])){return this[_0x7b71('0xe')]['noop'](_0x7b71('0x186'));}var _0xe58fe=this[_0x7b71('0x21')][_0x7b71('0xa7')](this,_0x27b291[_0x7b71('0x185')]);if(!_0xe58fe||!_0xe58fe[_0x7b71('0x187')]){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x27b291,_0x7b71('0x188'));}var _0x2df42a={'from':util[_0x7b71('0x2b')](_0x7b71('0x189'),_0xe58fe[_0x7b71('0x13')],_0xe58fe['email']||_0xe58fe['Smtp']['user']),'to':_0x27b291['to']||'','cc':_0x27b291['cc']||'','bcc':_0x27b291['bcc']||'','subject':_0x27b291['subject'],'html':_0x27b291[_0x7b71('0x5d')],'text':_0x27b291[_0x7b71('0x5d')]};if(this[_0x7b71('0x87')](_0x27b291[_0x7b71('0x18a')])){}logger[_0x7b71('0x18b')](_0x7b71('0x18c'),JSON[_0x7b71('0x73')](_0x2df42a));this['createSquareDetailsReport'][_0x7b71('0xa7')](this,_0x27b291,_0x27b291[_0x7b71('0x185')]);this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')]('Trying\x20SendMail\x20with\x20account\x20%s',_0xe58fe[_0x7b71('0x13')]));this[_0x7b71('0x23')][_0x7b71('0xa7')](this,_0xe58fe['smtpOptions'],_0x2df42a);return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0x18d'));};AGIVertices[_0x7b71('0x10')][_0x7b71('0x18e')]=function(_0x4ce27d){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x18f'),_0x4ce27d['label']));return this[_0x7b71('0xe')][_0x7b71('0xab')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x7b71('0x10')]['sendSMS']=function(_0x7a11c1){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x7a11c1[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x7a11c1[_0x7b71('0x190')])){return this['channel'][_0x7b71('0xab')](_0x7b71('0x191'));}var _0x1bda6e=this[_0x7b71('0x37')][_0x7b71('0xa7')](this,_0x7a11c1[_0x7b71('0x190')]);if(!_0x1bda6e){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x7a11c1,_0x7b71('0x192'));}var _0x34d8ec={'body':_0x7a11c1[_0x7b71('0x193')],'phone':_0x7a11c1['to']||'','SmsAccountId':_0x1bda6e['id']};logger[_0x7b71('0x18b')](_0x7b71('0x194'),JSON[_0x7b71('0x73')](_0x34d8ec));this[_0x7b71('0x39')][_0x7b71('0xa7')](this,_0x7a11c1,_0x7a11c1[_0x7b71('0x190')]);this[_0x7b71('0xe')]['noop'](util['format'](_0x7b71('0x195'),_0x1bda6e[_0x7b71('0x13')]));this[_0x7b71('0x38')]['sync'](this,_0x34d8ec);return this[_0x7b71('0xe')]['noop'](_0x7b71('0x196'));};AGIVertices[_0x7b71('0x10')]['set']=function(_0x14df27){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x14df27[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x14df27[_0x7b71('0xd9')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x14df27,_0x7b71('0x197'));}var _0x34b4e9=this[_0x7b71('0x11')][_0x7b71('0xa7')](this,_0x14df27['variable_id']);if(!_0x34b4e9){return this['channel'][_0x7b71('0x2e')](_0x14df27,'no\x20variable\x20found');}return this[_0x7b71('0xe')]['setVariable'](_0x34b4e9,_0x14df27[_0x7b71('0x198')]);};AGIVertices[_0x7b71('0x10')][_0x7b71('0x199')]=function(_0x3481ab){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x19a'),_0x3481ab[_0x7b71('0x3b')]));this[_0x7b71('0xe')]['noop'](_0x7b71('0x19b'));var _0x2321e3=this['channel'][_0x7b71('0x11')](_0x7b71('0x19c'));if(!_[_0x7b71('0x4a')](_0x2321e3[_0x7b71('0xa4')])){this[_0x7b71('0xe')][_0x7b71('0x3a')]=_0x2321e3[_0x7b71('0xa4')];}if(_0x3481ab[_0x7b71('0xbb')]==='yes'){this[_0x7b71('0xe')]['noop'](_0x7b71('0x19d'));return this[_0x7b71('0xe')][_0x7b71('0xbb')]();}return this['channel'][_0x7b71('0xab')](_0x7b71('0x19e'));};AGIVertices[_0x7b71('0x10')]['subproject']=function(_0x3a4be2){logger['info'](util[_0x7b71('0x2b')](_0x7b71('0x19f'),_0x3a4be2[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x3a4be2[_0x7b71('0x1a0')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x3a4be2,_0x7b71('0x1a1'));}var _0x2f15ba=this[_0x7b71('0x17')][_0x7b71('0xa7')](this,_0x3a4be2['project_id']);if(!this[_0x7b71('0x87')](_0x2f15ba)){return this[_0x7b71('0xe')]['error'](_0x3a4be2,util[_0x7b71('0x2b')](_0x7b71('0x1a2'),_0x3a4be2[_0x7b71('0x1a0')]));}if(_0x2f15ba===this[_0x7b71('0xe')][_0x7b71('0x3d')]){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x3a4be2,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x7b71('0x39')]['sync'](this,_0x3a4be2,_0x2f15ba);var _0x540902=this[_0x7b71('0xe')][_0x7b71('0x59')](_0x7b71('0x1a3'),util[_0x7b71('0x2b')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x7b71('0x6')]['host']||'127.0.0.1',_0x2f15ba,this[_0x7b71('0xe')][_0x7b71('0x3d')]));if(_0x540902[_0x7b71('0xad')]===-0x1){return _0x540902;}return this['channel']['noop'](util[_0x7b71('0x2b')]('Executed\x20command\x20%s\x20%s',_0x7b71('0x1a3'),_0x2f15ba));};AGIVertices[_0x7b71('0x10')]['system']=function(_0x4995bc){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x1a4'),_0x4995bc['label']));var _0x48aa8b=this[_0x7b71('0x1a5')][_0x7b71('0xa7')](this,_0x4995bc[_0x7b71('0xb9')]);this[_0x7b71('0x39')]['sync'](this,_0x4995bc,_0x4995bc[_0x7b71('0xb9')]);if(this[_0x7b71('0x87')](_0x4995bc[_0x7b71('0xd9')])){var _0x5d0389=this[_0x7b71('0x11')][_0x7b71('0xa7')](this,_0x4995bc['variable_id']);if(_0x5d0389){this[_0x7b71('0xe')]['setVariable'](_0x5d0389,_0x48aa8b);return this[_0x7b71('0xe')][_0x7b71('0xab')](util['format'](_0x7b71('0x1a6'),_0x4995bc[_0x7b71('0xb9')],_0x5d0389));}}return this[_0x7b71('0xe')]['noop'](util[_0x7b71('0x2b')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x4995bc[_0x7b71('0xb9')]));};AGIVertices[_0x7b71('0x10')][_0x7b71('0x1a7')]=function(_0x20e3db){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x20e3db[_0x7b71('0x3b')]));_0x20e3db[_0x7b71('0x5d')]=_0x20e3db[_0x7b71('0x5d')][_0x7b71('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7b71('0x87')](_0x20e3db[_0x7b71('0x1a8')])){return this[_0x7b71('0xe')]['noop'](_0x7b71('0x1a9'));}if(!this[_0x7b71('0x87')](_0x20e3db[_0x7b71('0x5d')])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xc8'));}this[_0x7b71('0xe')][_0x7b71('0xab')](util['format'](_0x7b71('0x1aa'),_0x20e3db[_0x7b71('0x5d')]));var _0x56511b=this[_0x7b71('0x5c')][_0x7b71('0xa7')](this,_0x20e3db);if(_0x56511b){this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x1ab'),_0x56511b));var _0x59f4ef=this[_0x7b71('0xe')][_0x7b71('0xfd')](_0x56511b);try{fs[_0x7b71('0xfe')](_0x56511b+'.wav');}catch(_0xc4c4ec){logger['error'](_0xc4c4ec);}return _0x59f4ef;}return this['channel'][_0x7b71('0x2e')](_0x20e3db,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x7b71('0x1ac')]=function(_0x3c5355){logger[_0x7b71('0x33')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x3c5355[_0x7b71('0x3b')]));_0x3c5355[_0x7b71('0x5d')]=_0x3c5355[_0x7b71('0x5d')][_0x7b71('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7b71('0x87')](_0x3c5355['text'])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xc8'));}this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x1ad'),_0x3c5355[_0x7b71('0x5d')]));var _0x37cdae=this[_0x7b71('0x62')][_0x7b71('0xa7')](this,_0x3c5355);if(_0x37cdae){this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x1ae'),_0x37cdae));var _0x498cb9=this['channel'][_0x7b71('0xfd')](_0x37cdae);try{fs[_0x7b71('0xfe')](_0x37cdae+_0x7b71('0x14d'));}catch(_0x4bb5a9){logger[_0x7b71('0x2e')](_0x4bb5a9);}return _0x498cb9;}return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x3c5355,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x7b71('0x1af')]=function(_0x35cd57){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x35cd57['label']));if(!this[_0x7b71('0x87')](_0x35cd57[_0x7b71('0x151')])){return this['channel'][_0x7b71('0x2e')](_0x35cd57,'no\x20find\x20by\x20configured');}logger['info'](util[_0x7b71('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x35cd57['findBy']));var _0x50393c=this['agentUnpause'][_0x7b71('0xa7')](this,_0x35cd57[_0x7b71('0x151')]);if(_0x50393c){logger[_0x7b71('0x33')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x35cd57['findBy']));this['channel'][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x154'),this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x35cd57[_0x7b71('0x151')]));return{'code':0xc8,'result':_0x7b71('0x155')};}else{logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7b71('0xe')]['callerid'],_0x35cd57[_0x7b71('0x151')]));this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x156'),this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x35cd57['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7b71('0x10')][_0x7b71('0x1b0')]=function(_0x346e4a){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x346e4a['label']));var _0x56caee=this[_0x7b71('0xe')]['exec'](_0x7b71('0x1b1'),[_0x346e4a[_0x7b71('0x1b2')],_0x346e4a[_0x7b71('0x78')]]);if(_0x56caee['result']===-0x1){return _0x56caee;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xc6'),_0x7b71('0x1b1'),_0x346e4a[_0x7b71('0x1b2')]));};AGIVertices[_0x7b71('0x10')]['vswitch']=function(_0x36cb50){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x36cb50[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x36cb50[_0x7b71('0xd9')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x36cb50,'no\x20variable\x20selected');}var _0x14500e=this[_0x7b71('0x11')]['sync'](this,_0x36cb50[_0x7b71('0xd9')]);if(!_0x14500e){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x36cb50,_0x7b71('0x115'));}var _0xf2619c=this[_0x7b71('0xe')][_0x7b71('0x11')](_0x14500e);return{'code':0xc8,'result':_0xf2619c[_0x7b71('0xa4')]?_0xf2619c[_0x7b71('0xa4')]:'-'};};String[_0x7b71('0x10')][_0x7b71('0xa3')]=function(_0x2fe57a,_0x3694ca){return this[_0x7b71('0xa2')](_0x2fe57a)[_0x7b71('0x1b3')](_0x3694ca);};module[_0x7b71('0x1b4')]=AGIVertices; \ No newline at end of file +var _0x9a19=['Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','getAndSetVariable','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','googleDialogflow','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','sesteknda','audiofile','streamFile','unlink','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','getdigits','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','beep','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','variable_id','no\x20variable\x20found','isArray','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','gosub','position','QUEUE','record','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','\x22%s\x22\x20<%s>','user','bcc','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','command','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','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','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','LOCAL','agentLogin','shellCommand','trim','replace','googleCloudTTS','apiKey','text','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','client_email','private_key','sestekNDA','ispeechTTS','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','saveRestApiResult','isPlainObject','%s.%s','length','setVariable','split','replaceAll','extra','maxRetry','sync','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','result','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','exec','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9a19,0x114));var _0x99a1=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9a19[_0x2d2c16];return _0x53f2fb;};'use strict';var fs=require('fs');var util=require(_0x99a1('0x0'));var _=require(_0x99a1('0x1'));var sh=require(_0x99a1('0x2'));var odbc=require('odbc')();var rs=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var Mustache=require(_0x99a1('0x5'));var rp=require(_0x99a1('0x6'));var logger=require(_0x99a1('0x7'))(_0x99a1('0x8'));var config=require(_0x99a1('0x9'));var scripts=require(_0x99a1('0xa'));var FILES_PATH=_0x99a1('0xb');var recursiveMapAttributes=[_0x99a1('0xc'),_0x99a1('0xd')];var verticesWithRetry=['menu','getdigits','getsecretdigits'];var AGIVertices=function(_0x56f50,_0x29ffbb,_0x500164){this['channel']=_0x56f50;this[_0x99a1('0xe')]=_0x29ffbb;this[_0x99a1('0xf')]=_0x500164;};AGIVertices[_0x99a1('0x10')][_0x99a1('0x11')]=function(_0x1551a1,_0x537032){this[_0x99a1('0xe')][_0x99a1('0x12')](_0x1551a1)[_0x99a1('0x13')](function(_0x418dee){_0x537032(null,_0x418dee?_0x418dee[_0x99a1('0x14')]:![]);})[_0x99a1('0x15')](function(_0x2ff655){_0x537032(_0x2ff655);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x16')]=function(_0x40c19c,_0x3a865c){this[_0x99a1('0xe')][_0x99a1('0x17')](_0x40c19c)[_0x99a1('0x13')](function(_0x39ee55){_0x3a865c(null,_0x39ee55?_0x39ee55['name']:![]);})[_0x99a1('0x15')](function(_0x3e45d4){_0x3a865c(_0x3e45d4);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x18')]=function(_0x384f05,_0x33e2c1){this[_0x99a1('0xe')]['getSquareProjectById'](_0x384f05)['then'](function(_0x6702d8){_0x33e2c1(null,_0x6702d8?_0x6702d8[_0x99a1('0x14')]:![]);})[_0x99a1('0x15')](function(_0x1fcd00){_0x33e2c1(_0x1fcd00);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x19')]=function(_0x228442,_0x3cd62c){this[_0x99a1('0xe')][_0x99a1('0x1a')](_0x228442)[_0x99a1('0x13')](function(_0x5eabcb){_0x3cd62c(null,_0x5eabcb?_0x5eabcb[_0x99a1('0x1b')]:![]);})[_0x99a1('0x15')](function(_0x5bed38){_0x3cd62c(_0x5bed38);});};AGIVertices[_0x99a1('0x10')]['getUser']=function(_0x458ed3,_0x2927b0){this[_0x99a1('0xe')][_0x99a1('0x1c')](_0x458ed3)['then'](function(_0x3eab51){_0x2927b0(null,_0x3eab51?_0x3eab51[_0x99a1('0x14')]:![]);})['catch'](function(_0x44df2d){_0x2927b0(_0x44df2d);});};AGIVertices['prototype'][_0x99a1('0x1d')]=function(_0x1e5cc6,_0x179597){this[_0x99a1('0xe')][_0x99a1('0x1e')](_0x1e5cc6)[_0x99a1('0x13')](function(_0x4fe7f7){_0x179597(null,_0x4fe7f7?_0x4fe7f7[_0x99a1('0x14')]:![]);})['catch'](function(_0x5dc733){_0x179597(_0x5dc733);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x1f')]=function(_0xa6799b,_0x15a0b6){var _0x25d560=this;this[_0x99a1('0xe')][_0x99a1('0x20')](_0xa6799b)['then'](function(_0xf41b0d){_0x15a0b6(null,_0xf41b0d?_0x25d560['getSoundPath'](_0xf41b0d[_0x99a1('0x21')]):![]);})[_0x99a1('0x15')](function(_0x26fbae){_0x15a0b6(_0x26fbae);});};AGIVertices['prototype'][_0x99a1('0x22')]=function(_0x2ab46b,_0x5718b9){this[_0x99a1('0xe')][_0x99a1('0x23')](_0x2ab46b)[_0x99a1('0x13')](function(_0x303d1e){_0x5718b9(null,_0x303d1e?_0x303d1e:![]);})[_0x99a1('0x15')](function(_0x969f6e){_0x5718b9(_0x969f6e);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x24')]=function(_0x52da8d,_0x4960e4,_0x3fa342){this['mailRpc'][_0x99a1('0x24')](_0x52da8d,_0x4960e4)[_0x99a1('0x13')](function(){_0x3fa342(null);})['catch'](function(_0xa5972b){_0x3fa342(_0xa5972b);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x25')]=function(_0x547ed3,_0x13f4db){this[_0x99a1('0xe')][_0x99a1('0x26')](_0x547ed3)[_0x99a1('0x13')](function(_0x1db0f8){if(_0x1db0f8){if(_0x1db0f8[_0x99a1('0x27')]){_0x13f4db(null,[_0x1db0f8[_0x99a1('0x28')]]);}else{_0x13f4db(null,_[_0x99a1('0x29')](_0x1db0f8[_0x99a1('0x2a')],_0x99a1('0x28')));}}else{_0x13f4db(null,![]);}})['catch'](function(_0x53fed5){_0x13f4db(_0x53fed5);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x2b')]=function(_0x416a36){return util[_0x99a1('0x2c')](_0x99a1('0x2d'),FILES_PATH,_0x416a36);};AGIVertices[_0x99a1('0x10')][_0x99a1('0x2e')]=function(_0x54840d,_0x355f9d,_0x506613){odbc['open'](_0x54840d,function(_0x26ce0e){if(_0x26ce0e){logger[_0x99a1('0x2f')](_0x99a1('0x30'),_0x26ce0e);_0x506613(_0x26ce0e);}else{logger[_0x99a1('0x31')](_0x99a1('0x32'));odbc[_0x99a1('0x33')](_0x355f9d,function(_0x30e8a9,_0x2f8135){if(_0x30e8a9){logger[_0x99a1('0x31')](_0x99a1('0x34'),_0x355f9d);_0x506613(_0x30e8a9);}else{logger[_0x99a1('0x31')](_0x99a1('0x35'),_0x355f9d);odbc[_0x99a1('0x36')](function(_0x5018e9){if(_0x5018e9){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x5018e9);}_0x506613(null,_0x2f8135);});}});}});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x37')]=function(_0x1d3f85,_0x279662){this[_0x99a1('0xe')]['getSmsAccountById'](_0x1d3f85)[_0x99a1('0x13')](function(_0x173d7f){_0x279662(null,_0x173d7f?_0x173d7f:![]);})[_0x99a1('0x15')](function(_0x51efe5){_0x279662(_0x51efe5);});};AGIVertices['prototype'][_0x99a1('0x38')]=function(_0x14722b,_0x4a5050){this['rpc'][_0x99a1('0x38')](_0x14722b)[_0x99a1('0x13')](function(_0x1b5d2d){_0x4a5050(null,_0x1b5d2d);})[_0x99a1('0x15')](function(_0x24c242){_0x4a5050(_0x24c242);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x39')]=function(_0x29d0a0,_0x1c4ce4,_0x2be9e3){this['rpc'][_0x99a1('0x39')]({'uniqueid':this[_0x99a1('0x3a')][_0x99a1('0x3b')],'node':_0x29d0a0['label'],'application':_0x29d0a0[_0x99a1('0x3c')],'data':_0x1c4ce4||null,'project_name':this['channel'][_0x99a1('0x3d')],'callerid':this[_0x99a1('0x3a')][_0x99a1('0x3e')]})[_0x99a1('0x13')](function(_0x3344b6){if(_0x2be9e3){_0x2be9e3(null,_0x3344b6);}})[_0x99a1('0x15')](function(_0x5822b1){if(_0x2be9e3){_0x2be9e3(_0x5822b1);}});};AGIVertices[_0x99a1('0x10')]['createSquareRecording']=function(_0x14da1e,_0x40b757,_0x1bff94,_0x278e22){this[_0x99a1('0xe')][_0x99a1('0x3f')]({'uniqueid':this[_0x99a1('0x3a')][_0x99a1('0x3b')],'callerid':this[_0x99a1('0x3a')][_0x99a1('0x3e')],'calleridname':this[_0x99a1('0x3a')]['calleridname'],'context':this[_0x99a1('0x3a')][_0x99a1('0x40')],'extension':this['channel'][_0x99a1('0x41')],'priority':this[_0x99a1('0x3a')][_0x99a1('0x42')],'accountcode':this[_0x99a1('0x3a')][_0x99a1('0x43')],'dnid':this[_0x99a1('0x3a')][_0x99a1('0x44')],'projectName':this['channel'][_0x99a1('0x3d')],'saveName':_0x40b757,'filename':_0x14da1e['file']||_0x40b757,'savePath':_0x1bff94})[_0x99a1('0x13')](function(_0x269798){_0x278e22(null,_0x269798);})['catch'](function(_0x5433f2){_0x278e22(_0x5433f2);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x45')]=function(_0x462c15,_0x4519fb,_0xee2b1b,_0x597836,_0x539a05){this['rpc'][_0x99a1('0x45')]({'uniqueid':this[_0x99a1('0x3a')][_0x99a1('0x3b')],'body':_0x462c15,'direction':_0x4519fb,'providerName':_0xee2b1b,'providerResponse':_0x597836})[_0x99a1('0x13')](function(_0x2065ea){if(_0x539a05){_0x539a05(null,_0x2065ea);}})[_0x99a1('0x15')](function(_0x1059b1){if(_0x539a05){_0x539a05(_0x1059b1);}});};AGIVertices['prototype'][_0x99a1('0x46')]=function(_0x22bfd8,_0x451824){this['rpc'][_0x99a1('0x46')]({'firstName':_['isEmpty'](_0x22bfd8['name'])||_[_0x99a1('0x47')](_0x22bfd8[_0x99a1('0x14')])?_0x99a1('0x48')+Math[_0x99a1('0x49')]():_0x22bfd8[_0x99a1('0x14')],'lastName':_[_0x99a1('0x4a')](_0x22bfd8[_0x99a1('0x4b')])||_[_0x99a1('0x47')](_0x22bfd8[_0x99a1('0x4b')])?null:_0x22bfd8['lastName'],'phone':_0x22bfd8[_0x99a1('0x4c')],'ListId':_0x22bfd8['list_id'],'scheduledat':_0x22bfd8[_0x99a1('0x4d')],'callbackUniqueid':this[_0x99a1('0x3a')]['uniqueid'],'tags':_0x99a1('0x4e'),'description':_0x99a1('0x4f')+_0x22bfd8[_0x99a1('0x4d')][_0x99a1('0x50')](),'priority':_0x22bfd8[_0x99a1('0x51')]})[_0x99a1('0x13')](function(_0x157c49){_0x451824(null,_0x157c49);})[_0x99a1('0x15')](function(_0x28ba8f){_0x451824(_0x28ba8f);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x52')]=function(_0x14d7b9,_0x5ab2cb){this['rpc'][_0x99a1('0x53')](_0x14d7b9)[_0x99a1('0x13')](function(_0x28caeb){_0x5ab2cb(null,_0x28caeb?_0x28caeb[_0x99a1('0x14')]:![]);})[_0x99a1('0x15')](function(_0x572557){_0x5ab2cb(_0x572557);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x54')]=function(_0x529f66,_0x6107cd,_0x95f20a){var _0x1376f0={'role':_0x99a1('0x55')};_0x1376f0[_0x529f66]=this[_0x99a1('0x3a')]['callerid'];this[_0x99a1('0xe')][_0x99a1('0x54')](_0x1376f0,_0x6107cd,this[_0x99a1('0x3a')][_0x99a1('0x3b')])[_0x99a1('0x13')](function(_0x10289c){_0x95f20a(null,_['isNil'](_0x10289c)?![]:!![]);})[_0x99a1('0x15')](function(_0x1e65fa){logger['error'](_0x1e65fa);_0x95f20a(null,![]);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x56')]=function(_0x3ad349,_0xb126dd){var _0x318217={'role':'agent'};_0x318217[_0x3ad349]=this[_0x99a1('0x3a')]['callerid'];this['rpc']['agentUnpause'](_0x318217)[_0x99a1('0x13')](function(_0x3f7c16){_0xb126dd(null,_['isNil'](_0x3f7c16)?![]:!![]);})['catch'](function(_0x2c605f){logger['error'](_0x2c605f);_0xb126dd(null,![]);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x57')]=function(_0x332330,_0x180c1e){var _0x56d6cf={'role':_0x99a1('0x55')};_0x56d6cf[_0x332330]=this[_0x99a1('0x3a')][_0x99a1('0x3e')];this['rpc'][_0x99a1('0x57')](_0x56d6cf)['then'](function(_0x4ddfcf){_0x180c1e(null,_[_0x99a1('0x47')](_0x4ddfcf)?![]:!![]);})[_0x99a1('0x15')](function(_0x125a88){logger[_0x99a1('0x2f')](_0x125a88);_0x180c1e(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x4fc962,_0x79b784){var _0x35e38a={'role':'agent'};_0x35e38a[_0x4fc962]=this['channel'][_0x99a1('0x3e')];var _0x2f5587=_0x4fc962!=_0x99a1('0x58')?util['format']('%s/%s@from-sip/n',_0x99a1('0x59'),this['channel'][_0x99a1('0x3e')]):undefined;this[_0x99a1('0xe')][_0x99a1('0x5a')](_0x35e38a,_0x2f5587)['then'](function(_0x447e7d){_0x79b784(null,_[_0x99a1('0x47')](_0x447e7d)?![]:!![]);})['catch'](function(_0x4c14ed){logger[_0x99a1('0x2f')](_0x4c14ed);_0x79b784(null,![]);});};AGIVertices['prototype'][_0x99a1('0x5b')]=function(_0x3a5f6a,_0x30a0a5){sh['exec'](_[_0x99a1('0x5c')](_0x3a5f6a),function(_0x35278b,_0x367c55){var _0x2a12bf=_0x367c55[_0x99a1('0x5d')](/(\r\n|\n|\r)/gm,'');_0x30a0a5(null,_0x2a12bf);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x149293,_0xf1d00c){scripts[_0x99a1('0x5e')](_0x149293[_0x99a1('0x5f')],_0x149293['google_cloud_tts_text_type']||_0x99a1('0x60'),_0x149293['text'],_0x149293['languageCode']||_0x99a1('0x61'),_0x149293[_0x99a1('0x62')]||_0x99a1('0x63'),_0x149293['audioEncoding']||_0x99a1('0x64'))[_0x99a1('0x13')](function(_0x25a738){_0xf1d00c(null,_0x25a738);})[_0x99a1('0x15')](function(_0x164d41){_0xf1d00c(_0x164d41);});};AGIVertices['prototype'][_0x99a1('0x65')]=function(_0x19e306,_0x95efd2){scripts[_0x99a1('0x65')](_0x19e306[_0x99a1('0x60')],_0x19e306[_0x99a1('0x66')]||'en',0x1)['then'](function(_0x235aaf){_0x95efd2(null,_0x235aaf);})[_0x99a1('0x15')](function(_0x2421bc){_0x95efd2(_0x2421bc);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x67')]=function(_0x579271,_0x18843d){var _0x68c944={'uri':_0x579271[_0x99a1('0x68')],'method':_0x579271[_0x99a1('0x69')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x579271[_0x99a1('0x6a')])===_0x99a1('0x6b')&&parseInt(_0x579271['timeout'])>=0x1?parseInt(_0x579271[_0x99a1('0x6a')])*0x3e8:0x5*0x3e8};if(_[_0x99a1('0x6c')](['POST','PUT'],_0x68c944[_0x99a1('0x69')][_0x99a1('0x6d')]())){try{_0x68c944['body']=_0x579271[_0x99a1('0xd')]?JSON[_0x99a1('0x6e')](_0x579271[_0x99a1('0xd')]):{};}catch(_0x21e89d){logger[_0x99a1('0x2f')](_0x99a1('0x6f'),_0x21e89d);}}try{_0x68c944[_0x99a1('0x70')]=_0x579271[_0x99a1('0xc')]?JSON[_0x99a1('0x6e')](_0x579271[_0x99a1('0xc')]):{};}catch(_0x114f09){logger[_0x99a1('0x2f')](_0x99a1('0x71'),_0x114f09);}if(_0x579271['computedVariables']){try{var _0x285897=require(_0x579271['computedVariables'])['sync'](this,_0x68c944);_0x68c944[_0x99a1('0x72')]=Mustache[_0x99a1('0x73')](_0x579271[_0x99a1('0x68')],_0x285897,{},['$$','$$']);if(_0x68c944[_0x99a1('0x70')]){_0x68c944[_0x99a1('0x70')]=JSON[_0x99a1('0x6e')](Mustache[_0x99a1('0x73')](JSON[_0x99a1('0x74')](_0x68c944[_0x99a1('0x70')]),_0x285897,{},['$$','$$']));}if(_0x68c944['body']){_0x68c944[_0x99a1('0x75')]=JSON[_0x99a1('0x6e')](Mustache[_0x99a1('0x73')](JSON[_0x99a1('0x74')](_0x68c944[_0x99a1('0x75')]),_0x285897,{},['$$','$$']));}}catch(_0xbba599){logger[_0x99a1('0x2f')](_0x99a1('0x76'),_0xbba599);}}rp(_0x68c944)['then'](function(_0x51dbe3){var _0x51c289={'statusCode':_0x51dbe3[_0x99a1('0x77')]||0xc8,'statusMessage':_0x51dbe3[_0x99a1('0x78')]||'OK','headers':_0x51dbe3['headers']||{},'body':_0x51dbe3[_0x99a1('0x75')]||{}};_0x18843d(null,_0x51c289);})[_0x99a1('0x15')](function(_0x28393c){var _0x2570fa={'statusCode':_0x28393c['statusCode']||0x1f4,'statusMessage':_0x28393c[_0x99a1('0x79')]||_0x99a1('0x7a'),'headers':_0x28393c[_0x99a1('0x7b')][_0x99a1('0x70')]||{},'body':_0x28393c['options'][_0x99a1('0x75')]||{}};_0x18843d(null,_0x2570fa);});};AGIVertices['prototype']['googleDialogflow']=function(_0x590f39,_0x21eb8b){scripts['googleDialogflow'](this[_0x99a1('0x3a')][_0x99a1('0x3b')],_0x590f39[_0x99a1('0x7c')],_0x590f39[_0x99a1('0x60')],_0x590f39[_0x99a1('0x7d')]||'en')[_0x99a1('0x13')](function(_0x444e43){_0x21eb8b(null,_0x444e43);})['catch'](function(_0x4fcd65){_0x21eb8b(_0x4fcd65);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x7e')]=function(_0xff43dd,_0x4af45f){scripts[_0x99a1('0x7e')](this[_0x99a1('0x3a')][_0x99a1('0x3b')],_0xff43dd['dialogflowV2_project_id'],_0xff43dd[_0x99a1('0x7f')],_0xff43dd[_0x99a1('0x80')],_0xff43dd[_0x99a1('0x60')],_0xff43dd['dialogflowV2_language']||'en')['then'](function(_0x2867f5){_0x4af45f(null,_0x2867f5);})[_0x99a1('0x15')](function(_0x14e25d){_0x4af45f(_0x14e25d);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x81')]=function(_0x59b471,_0x467661){scripts['sestekNDA'](this[_0x99a1('0x3a')],_0x59b471)[_0x99a1('0x13')](function(_0x5b7cdf){_0x467661(null,_0x5b7cdf);})[_0x99a1('0x15')](function(_0x1e00b3){_0x467661(_0x1e00b3);});};AGIVertices[_0x99a1('0x10')]['ispeechTTS']=function(_0x200a43,_0x98eae2){scripts[_0x99a1('0x82')](_0x200a43[_0x99a1('0x7c')],_0x200a43[_0x99a1('0x60')],_0x200a43['ispeech_tts_language']||_0x99a1('0x61'),_0x200a43['speed'])[_0x99a1('0x13')](function(_0x2c7600){_0x98eae2(null,_0x2c7600);})['catch'](function(_0x38538e){_0x98eae2(_0x38538e);});};AGIVertices['prototype'][_0x99a1('0x83')]=function(_0x4778ba,_0x104e0e,_0x10a95a){scripts[_0x99a1('0x83')](_0x104e0e,_0x4778ba[_0x99a1('0x7c')],_0x4778ba['ispeech_asr_language']||_0x99a1('0x61'),this[_0x99a1('0x84')](_0x4778ba['model'])?_0x4778ba[_0x99a1('0x85')]:undefined)[_0x99a1('0x13')](function(_0x1d905e){_0x10a95a(null,_0x1d905e);})['catch'](function(_0x2f7239){_0x10a95a(_0x2f7239);});};AGIVertices['prototype'][_0x99a1('0x86')]=function(_0x15dedf,_0x37dd1f){scripts[_0x99a1('0x86')](_0x15dedf[_0x99a1('0x87')],_0x15dedf['aws_secret_access_key'],_0x15dedf[_0x99a1('0x88')],_0x15dedf['aws_polly_voice']||'Amy',_0x15dedf[_0x99a1('0x60')],_0x15dedf[_0x99a1('0x89')]||'text')[_0x99a1('0x13')](function(_0x3195c7){_0x37dd1f(null,_0x3195c7);})[_0x99a1('0x15')](function(_0x5c3eb9){_0x37dd1f(_0x5c3eb9);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x8a')]=function(_0x32ecc5,_0x57fb68){scripts[_0x99a1('0x8a')](this[_0x99a1('0x3a')]['uniqueid'],_0x32ecc5[_0x99a1('0x87')],_0x32ecc5[_0x99a1('0x8b')],_0x32ecc5['aws_lex_region'],_0x32ecc5['text'],_0x32ecc5[_0x99a1('0x8c')])[_0x99a1('0x13')](function(_0xa85a0f){_0x57fb68(null,_0xa85a0f);})['catch'](function(_0x3ff7c3){_0x57fb68(_0x3ff7c3);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x8d')]=function(_0x2a7b32,_0x253de8,_0x39a1fd){scripts['googleASR'](_0x253de8,_0x2a7b32['key'],_0x2a7b32['google_asr_language']||_0x99a1('0x61'))[_0x99a1('0x13')](function(_0x3b0b30){_0x39a1fd(null,_0x3b0b30);})[_0x99a1('0x15')](function(_0x218a3f){_0x39a1fd(_0x218a3f);});};AGIVertices['prototype'][_0x99a1('0x8e')]=function(_0xf2970b,_0x500cb6,_0x49351f){scripts[_0x99a1('0x8e')](_0x500cb6,_0xf2970b[_0x99a1('0x8f')],_0xf2970b[_0x99a1('0x90')],_0xf2970b['uri'])[_0x99a1('0x13')](function(_0x596ebf){_0x49351f(null,_0x596ebf);})[_0x99a1('0x15')](function(_0x50bd70){_0x49351f(_0x50bd70);});};AGIVertices[_0x99a1('0x10')][_0x99a1('0x91')]=function(_0x4fb561){var _0x25b4bf=_[_0x99a1('0x6c')](verticesWithRetry,_0x4fb561['agicommand'])?_0x4fb561:_[_0x99a1('0x92')](_0x4fb561);for(var _0x2447e4 in _0x25b4bf){if(_0x25b4bf[_0x99a1('0x93')](_0x2447e4)){if(_0x25b4bf[_0x2447e4]&&_[_0x99a1('0x94')](_0x25b4bf[_0x2447e4])){if(_[_0x99a1('0x6c')](recursiveMapAttributes,_0x2447e4)){_0x25b4bf[_0x2447e4]=this[_0x99a1('0x95')](_0x25b4bf[_0x2447e4]);}else{_0x25b4bf[_0x2447e4]=this[_0x99a1('0x96')](_0x25b4bf[_0x2447e4]);}}}}return _0x25b4bf;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x366bbb){for(var _0x45eb4a in _0x366bbb){if(_0x366bbb['hasOwnProperty'](_0x45eb4a)){if(_['isPlainObject'](_0x366bbb[_0x45eb4a])){this[_0x99a1('0x97')](_0x366bbb[_0x45eb4a]);}else if(_['isArray'](_0x366bbb[_0x45eb4a])){for(var _0x4e26b6=0x0;_0x4e26b6<_0x366bbb[_0x45eb4a]['length'];_0x4e26b6++){this[_0x99a1('0x97')](_0x366bbb[_0x45eb4a][_0x4e26b6]);}}else if(_['isString'](_0x366bbb[_0x45eb4a])){_0x366bbb[_0x45eb4a]=this[_0x99a1('0x96')](_0x366bbb[_0x45eb4a]);}}}};AGIVertices[_0x99a1('0x10')][_0x99a1('0x98')]=function(_0x97552e,_0x141c1b){for(var _0x2740de in _0x97552e){if(_0x97552e['hasOwnProperty'](_0x2740de)){if(_[_0x99a1('0x99')](_0x97552e[_0x2740de])){if(!_[_0x99a1('0x4a')](_0x97552e[_0x2740de])){this[_0x99a1('0x98')](_0x97552e[_0x2740de],util[_0x99a1('0x2c')](_0x99a1('0x9a'),_0x141c1b,_0x2740de));}}else if(_['isArray'](_0x97552e[_0x2740de])){for(var _0x22ba9c=0x0;_0x22ba9c<_0x97552e[_0x2740de][_0x99a1('0x9b')];_0x22ba9c++){this[_0x99a1('0x98')](_0x97552e[_0x2740de][_0x22ba9c],util[_0x99a1('0x2c')](_0x99a1('0x9a'),_0x141c1b,_0x2740de+'['+_0x22ba9c+']'));}}else{if(!_[_0x99a1('0x47')](_0x97552e[_0x2740de])){this[_0x99a1('0x3a')][_0x99a1('0x9c')](util['format'](_0x99a1('0x9a'),_0x141c1b,_0x2740de),_0x97552e[_0x2740de]);}}}}};AGIVertices[_0x99a1('0x10')][_0x99a1('0x95')]=function(_0x18cf49){try{var _0xab6473=JSON['parse'](_0x18cf49);this[_0x99a1('0x97')](_0xab6473);return JSON['stringify'](_0xab6473);}catch(_0x431f54){return this[_0x99a1('0x96')](_0x18cf49);}};AGIVertices[_0x99a1('0x10')][_0x99a1('0x96')]=function(_0x59049e){var _0x6031da=_0x59049e[_0x99a1('0x9d')]('{');for(var _0x3f029e=0x1;_0x3f029e<_0x6031da['length'];_0x3f029e+=0x1){var _0x1a2b48=_0x6031da[_0x3f029e][_0x99a1('0x9d')]('}');if(_0x1a2b48[_0x99a1('0x9b')]>0x1){_0x59049e=_0x59049e[_0x99a1('0x9e')]('{'+_0x1a2b48[0x0]+'}',this[_0x99a1('0x3a')][_0x99a1('0x11')](_0x1a2b48[0x0])[_0x99a1('0x9f')]||_0x1a2b48[0x0]);}}if(_0x6031da[_0x99a1('0x9b')]===0x1){return _0x59049e[_0x99a1('0x50')]();}return this[_0x99a1('0x96')](_0x59049e);};AGIVertices[_0x99a1('0x10')]['getAndSetVariable']=function(_0x212b11,_0x4ca1ac){var _0x1efd92=this[_0x99a1('0x3a')][_0x99a1('0x11')](_0x212b11);if(_0x1efd92['result']===-0x1){return _0x1efd92;}logger[_0x99a1('0x31')](util[_0x99a1('0x2c')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x4ca1ac,_0x1efd92[_0x99a1('0x9f')]));return this['channel'][_0x99a1('0x9c')](_0x4ca1ac,_0x1efd92[_0x99a1('0x9f')]);};AGIVertices[_0x99a1('0x10')][_0x99a1('0x84')]=function(_0x61013d){return _0x61013d&&_0x61013d!=='0'&&_0x61013d!=='-1'&&_0x61013d!=='';};AGIVertices['prototype'][_0x99a1('0xa0')]=function(_0x4a1ba4){this['createSquareDetailsReport'][_0x99a1('0xa1')](this,_0x4a1ba4,'-');_0x4a1ba4['retry']=_0x4a1ba4['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x99a1('0x10')][_0x99a1('0xa2')]=function(_0x45b3c9){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0xa3'),_0x45b3c9[_0x99a1('0xa4')]));if(!this[_0x99a1('0x84')](_0x45b3c9[_0x99a1('0x60')])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0xa6'));}var _0x556879='\x22'+_0x45b3c9[_0x99a1('0x60')]+'\x22';if(this[_0x99a1('0x84')](_0x45b3c9[_0x99a1('0x7b')])){_0x556879+=','+_0x45b3c9[_0x99a1('0x7b')];}var _0x46a31a=this[_0x99a1('0x3a')]['exec'](_0x99a1('0xa7'),_0x556879);if(_0x46a31a[_0x99a1('0xa8')]===-0x1){return _0x46a31a;}return this[_0x99a1('0x3a')][_0x99a1('0xa5')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x556879));};AGIVertices[_0x99a1('0x10')][_0x99a1('0xa9')]=function(_0x1880b7){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0xaa'),_0x1880b7[_0x99a1('0xa4')]));if(!this[_0x99a1('0x84')](_0x1880b7[_0x99a1('0xab')])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0xac'));}var _0x29c620=_0x1880b7[_0x99a1('0xab')];if(this[_0x99a1('0x84')](_0x1880b7[_0x99a1('0x7b')])){_0x29c620+=','+_0x1880b7['options'];}var _0x27ddd2=this['channel'][_0x99a1('0xad')](_0x99a1('0xae'),_0x29c620);if(_0x27ddd2['result']===-0x1){return _0x27ddd2;}var _0x5e7b99=this['getAndSetVariable'](_0x99a1('0xaf'),'MRCP_RECOG_CONFIDENCE');if(_0x5e7b99[_0x99a1('0xa8')]===-0x1){return _0x5e7b99;}var _0x4c7e31=this['getAndSetVariable'](_0x99a1('0xb0'),'MRCP_RECOG_TRANSCRIPT');if(_0x4c7e31[_0x99a1('0xa8')]===-0x1){return _0x4c7e31;}var _0x530158=this['getAndSetVariable'](_0x99a1('0xb1'),_0x99a1('0xb2'));if(_0x530158['result']===-0x1){return _0x530158;}return this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0xb3'),_0x29c620));};AGIVertices[_0x99a1('0x10')]['agi']=function(_0x484da3){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0xb4'),_0x484da3[_0x99a1('0xa4')]));return this[_0x99a1('0x3a')]['agi']([_0x484da3['command'],_0x484da3[_0x99a1('0xb5')]]);};AGIVertices[_0x99a1('0x10')][_0x99a1('0xb6')]=function(_0x2ce26e){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0xb7'),_0x2ce26e[_0x99a1('0xa4')]));if(this[_0x99a1('0x84')](_0x2ce26e[_0x99a1('0x6a')])){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0xb8'),_0x2ce26e[_0x99a1('0x6a')]));var _0x236f79=this['channel'][_0x99a1('0xb9')](_0x2ce26e[_0x99a1('0x6a')]);if(_0x236f79[_0x99a1('0xa8')]===-0x1){return _0x236f79;}}return this[_0x99a1('0x3a')][_0x99a1('0xb6')]();};AGIVertices[_0x99a1('0x10')][_0x99a1('0x4e')]=function(_0x343396){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0xba'),_0x343396['label']));if(!this['isConfigured'](_0x343396[_0x99a1('0xbb')])){return this['channel']['error'](_0x343396,'no\x20list\x20selected');}_0x343396[_0x99a1('0x4d')]=moment();if(this[_0x99a1('0x84')](_0x343396[_0x99a1('0xbc')])){_0x343396[_0x99a1('0x4d')]=moment()[_0x99a1('0xbd')](_0x343396[_0x99a1('0xbc')],_0x99a1('0xbe'));}if(!this[_0x99a1('0x84')](_0x343396[_0x99a1('0x51')])){_0x343396[_0x99a1('0x51')]=0x2;}this[_0x99a1('0x46')][_0x99a1('0xa1')](this,_0x343396);return this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0xbf'),_0x343396['phone'],_0x343396[_0x99a1('0xbb')],_0x343396[_0x99a1('0x4d')]));};AGIVertices['prototype'][_0x99a1('0xc0')]=function(_0x24531e){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x24531e[_0x99a1('0xa4')]));var _0x5e0bdc=this['channel']['exec'](_0x24531e['application'],_0x24531e[_0x99a1('0x7b')]);if(_0x5e0bdc[_0x99a1('0xa8')]===-0x1){return _0x5e0bdc;}return this['channel']['noop'](util['format'](_0x99a1('0xc1'),_0x24531e['application'],_0x24531e['options']));};AGIVertices[_0x99a1('0x10')][_0x99a1('0xc2')]=function(_0x61816f){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0xc3'),_0x61816f[_0x99a1('0xa4')]));if(!this[_0x99a1('0x84')](_0x61816f[_0x99a1('0x60')])){return this[_0x99a1('0x3a')]['noop'](_0x99a1('0xa6'));}var _0x3a5fdb='\x22'+_0x61816f['text']+'\x22';if(this[_0x99a1('0x84')](_0x61816f[_0x99a1('0x7b')])){_0x3a5fdb+=','+_0x61816f[_0x99a1('0x7b')];}var _0x1bd078=this[_0x99a1('0x3a')][_0x99a1('0xad')](_0x99a1('0xa7'),_0x3a5fdb);if(_0x1bd078['result']===-0x1){return _0x1bd078;}return this[_0x99a1('0x3a')][_0x99a1('0xa5')](util['format'](_0x99a1('0xc4'),_0x3a5fdb));};AGIVertices['prototype'][_0x99a1('0xc5')]=function(_0x2528ac){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0xc6'),_0x2528ac[_0x99a1('0xa4')]));if(!this[_0x99a1('0x84')](_0x2528ac['text'])){return this[_0x99a1('0x3a')]['noop'](_0x99a1('0xa6'));}var _0x42dc9d='\x22'+_0x2528ac['text']+'\x22';if(this[_0x99a1('0x84')](_0x2528ac[_0x99a1('0x7b')])){_0x42dc9d+=','+_0x2528ac[_0x99a1('0x7b')];}var _0x518438=this['channel'][_0x99a1('0xad')]('MRCPSynth',_0x42dc9d);if(_0x518438[_0x99a1('0xa8')]===-0x1){return _0x518438;}return this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0xc4'),_0x42dc9d));};AGIVertices[_0x99a1('0x10')][_0x99a1('0xc7')]=function(_0xf557cd){logger[_0x99a1('0x31')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0xf557cd['label']));if(!this[_0x99a1('0x84')](_0xf557cd[_0x99a1('0xab')])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0xac'));}var _0x34fc6d=_0xf557cd[_0x99a1('0xab')];if(this[_0x99a1('0x84')](_0xf557cd[_0x99a1('0x7b')])){_0x34fc6d+=','+_0xf557cd['options'];}var _0x4611a7=this[_0x99a1('0x3a')]['exec'](_0x99a1('0xae'),_0x34fc6d);if(_0x4611a7[_0x99a1('0xa8')]===-0x1){return _0x4611a7;}var _0x10bd69=this[_0x99a1('0xc8')](_0x99a1('0xaf'),'LUMENVOX_ASR_CONFIDENCE');if(_0x10bd69[_0x99a1('0xa8')]===-0x1){return _0x10bd69;}var _0x278af6=this[_0x99a1('0xc8')](_0x99a1('0xb0'),_0x99a1('0xc9'));if(_0x278af6[_0x99a1('0xa8')]===-0x1){return _0x278af6;}var _0x2c8f12=this[_0x99a1('0xc8')](_0x99a1('0xb1'),_0x99a1('0xca'));if(_0x2c8f12['result']===-0x1){return _0x2c8f12;}return this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0xb3'),_0x34fc6d));};AGIVertices[_0x99a1('0x10')][_0x99a1('0xcb')]=function(_0xba7aed){logger[_0x99a1('0x31')](util['format'](_0x99a1('0xcc'),_0xba7aed['label']));if(!this[_0x99a1('0x84')](_0xba7aed['grammar'])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')]('no\x20grammar\x20configured');}var _0x40cc2f=_0xba7aed[_0x99a1('0xab')];if(this[_0x99a1('0x84')](_0xba7aed[_0x99a1('0x7b')])){_0x40cc2f+=','+_0xba7aed[_0x99a1('0x7b')];}var _0x15645e=this['channel'][_0x99a1('0xad')](_0x99a1('0xae'),_0x40cc2f);if(_0x15645e[_0x99a1('0xa8')]===-0x1){return _0x15645e;}var _0x4b3993=this[_0x99a1('0xc8')](_0x99a1('0xaf'),'SESTEK_ASR_CONFIDENCE');if(_0x4b3993[_0x99a1('0xa8')]===-0x1){return _0x4b3993;}var _0x8640fa=this['getAndSetVariable']('RECOG_INPUT()',_0x99a1('0xcd'));if(_0x8640fa[_0x99a1('0xa8')]===-0x1){return _0x8640fa;}var _0x3cc132=this[_0x99a1('0xc8')](_0x99a1('0xb1'),_0x99a1('0xce'));if(_0x3cc132[_0x99a1('0xa8')]===-0x1){return _0x3cc132;}return this['channel'][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0xb3'),_0x40cc2f));};AGIVertices['prototype'][_0x99a1('0xcf')]=function(_0x57695b){logger['info'](util[_0x99a1('0x2c')](_0x99a1('0xd0'),_0x57695b['label']));if(!this[_0x99a1('0x84')](_0x57695b['odbc_id'])){return this[_0x99a1('0x3a')]['error'](_0x57695b,'no\x20database\x20selected');}var _0x582acf=this['getSquareOdbc'][_0x99a1('0xa1')](this,_0x57695b[_0x99a1('0xd1')]);if(!_0x582acf){return this['channel']['error'](_0x57695b,_0x99a1('0xd2'));}if(!this['isConfigured'](_0x57695b[_0x99a1('0x33')])){return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x57695b,'no\x20query\x20configured');}var _0x548c0a=_0x57695b['query'][_0x99a1('0x5d')](/(\r\n|\n|\r)/gm,'\x20');this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0xd3'),_0x548c0a));var _0x182baf=this[_0x99a1('0x2e')][_0x99a1('0xa1')](this,_0x582acf,_0x548c0a);this[_0x99a1('0x39')][_0x99a1('0xa1')](this,_0x57695b,_0x548c0a);if(!this[_0x99a1('0x84')](_0x57695b['variable_id'])){return this[_0x99a1('0x3a')]['noop'](_0x99a1('0xd4'));}var _0x251df4=this['getVariable']['sync'](this,_0x57695b['variable_id']);if(!_0x251df4){return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x57695b,'no\x20variable\x20found');}var _0x4823f5=this;_0x182baf['forEach'](function(_0x27af45,_0x211b44){Object['keys'](_0x27af45)[_0x99a1('0xd5')](function(_0x3a0a91){_0x4823f5[_0x99a1('0x3a')][_0x99a1('0x9c')](util[_0x99a1('0x2c')](_0x99a1('0xd6'),_0x251df4,_0x211b44,_0x3a0a91),_0x27af45[_0x3a0a91]);});});this[_0x99a1('0x3a')][_0x99a1('0x9c')](util[_0x99a1('0x2c')]('%s_ROWS_COUNT',_0x251df4),_0x182baf[_0x99a1('0x9b')]);return this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0xd7'),_0x251df4));};AGIVertices[_0x99a1('0x10')][_0x99a1('0xd8')]=function(_0x742f74){logger[_0x99a1('0xd9')](util[_0x99a1('0x2c')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x742f74[_0x99a1('0xa4')]));if(!this['isConfigured'](_0x742f74[_0x99a1('0xda')])){return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x742f74,_0x99a1('0xdb'));}var _0x14fddd=this[_0x99a1('0xdc')]['sync'](this,_0x742f74[_0x99a1('0xda')]);if(!_0x14fddd){return this['channel'][_0x99a1('0x2f')](_0x742f74,_0x99a1('0xdd'));}var _0x2ce91d=this[_0x99a1('0x3a')][_0x99a1('0xad')](_0x99a1('0xde'),[util['format'](_0x99a1('0xdf'),_0x14fddd),_0x742f74[_0x99a1('0x6a')],_0x742f74[_0x99a1('0xe0')],_0x742f74[_0x99a1('0x68')]]);if(_0x2ce91d[_0x99a1('0xa8')]===-0x1){return _0x2ce91d;}return this[_0x99a1('0x3a')][_0x99a1('0xa5')](util['format'](_0x99a1('0xe1'),'DIAL'));};AGIVertices[_0x99a1('0x10')][_0x99a1('0xe2')]=function(_0x37bbb2){logger[_0x99a1('0x31')](util['format'](_0x99a1('0xe3'),_0x37bbb2['label']));if(!this[_0x99a1('0x84')](_0x37bbb2[_0x99a1('0x7c')])){return this['channel'][_0x99a1('0xa5')](_0x99a1('0xe4'));}if(!this[_0x99a1('0x84')](_0x37bbb2[_0x99a1('0x60')])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0xa6'));}this[_0x99a1('0x3a')][_0x99a1('0xe5')]=!![];this[_0x99a1('0x39')](_0x37bbb2);this[_0x99a1('0x45')](_0x37bbb2[_0x99a1('0x60')],'in','','');this['channel']['noop'](util[_0x99a1('0x2c')](_0x99a1('0xe6'),_0x37bbb2['text']));var _0x66da9d=this[_0x99a1('0xe7')][_0x99a1('0xa1')](this,_0x37bbb2);if(_0x66da9d){for(var _0x325ed1 in _0x66da9d){if(_0x66da9d['hasOwnProperty'](_0x325ed1)){this[_0x99a1('0x3a')]['setVariable'](util[_0x99a1('0x2c')](_0x99a1('0xe8'),_0x325ed1[_0x99a1('0x6d')]()),_0x66da9d[_0x325ed1]);}}this[_0x99a1('0x45')](_0x66da9d[_0x99a1('0xe9')],'out',_0x99a1('0xe2'),'');return this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0xea'),_0x66da9d['speech']));}return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x37bbb2,_0x99a1('0xeb'));};AGIVertices[_0x99a1('0x10')]['dialogflowV2']=function(_0x4cbe76){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0xec'),_0x4cbe76[_0x99a1('0xa4')]));if(!this[_0x99a1('0x84')](_0x4cbe76[_0x99a1('0xed')])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')]('no\x20project_id\x20configured');}if(!this[_0x99a1('0x84')](_0x4cbe76[_0x99a1('0x7f')])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0xee'));}if(!this[_0x99a1('0x84')](_0x4cbe76[_0x99a1('0x80')])){return this['channel'][_0x99a1('0xa5')](_0x99a1('0xef'));}if(!this[_0x99a1('0x84')](_0x4cbe76['dialogflowV2_language'])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')]('no\x20anguage\x20configured');}if(!this[_0x99a1('0x84')](_0x4cbe76[_0x99a1('0x60')])){return this['channel'][_0x99a1('0xa5')]('no\x20text\x20configured');}this[_0x99a1('0x3a')][_0x99a1('0xe5')]=!![];this[_0x99a1('0x39')](_0x4cbe76);this['createSquareMessage'](_0x4cbe76['text'],'in','','');this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0xf0'),_0x4cbe76[_0x99a1('0x60')]));var _0x5b76a4=this['googleDialogflowV2'][_0x99a1('0xa1')](this,_0x4cbe76);if(_0x5b76a4){for(var _0x21589f in _0x5b76a4){if(_0x5b76a4[_0x99a1('0x93')](_0x21589f)){if(_0x21589f!==_0x99a1('0xf1')){this[_0x99a1('0x3a')]['setVariable'](util['format'](_0x99a1('0xe8'),_0x21589f[_0x99a1('0x6d')]()),_0x5b76a4[_0x21589f]);}}}this[_0x99a1('0x45')](_0x5b76a4[_0x99a1('0xe9')],'out',_0x99a1('0xf2'),_0x5b76a4['providerResponse']);return this[_0x99a1('0x3a')][_0x99a1('0xa5')](util['format'](_0x99a1('0xf3'),_0x5b76a4['speech']));}return this['channel'][_0x99a1('0x2f')](_0x4cbe76,_0x99a1('0xf4'));};AGIVertices[_0x99a1('0x10')]['sesteknda']=function(_0xba944){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0xf5'),_0xba944[_0x99a1('0xa4')]));if(!this['isConfigured'](_0xba944[_0x99a1('0xf6')])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0xf7'));}if(!this['isConfigured'](_0xba944[_0x99a1('0xf8')])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0xf9'));}if(!this['isConfigured'](_0xba944[_0x99a1('0xfa')])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')]('no\x20password\x20configured');}if(!this['isConfigured'](_0xba944[_0x99a1('0xfb')])){return this[_0x99a1('0x3a')]['noop'](_0x99a1('0xa6'));}this[_0x99a1('0x3a')][_0x99a1('0xe5')]=!![];this[_0x99a1('0x39')](_0xba944);this[_0x99a1('0x45')](_0xba944[_0x99a1('0x60')],'in','','');this[_0x99a1('0x3a')][_0x99a1('0xa5')](util['format'](_0x99a1('0xfc'),_0xba944[_0x99a1('0x60')]));var _0x3ac09a=this[_0x99a1('0x81')]['sync'](this,_0xba944);if(_0x3ac09a){for(var _0xe30c3d in _0x3ac09a){if(_0x3ac09a[_0x99a1('0x93')](_0xe30c3d)){this['channel'][_0x99a1('0x9c')](util[_0x99a1('0x2c')](_0x99a1('0xfd'),_0xe30c3d[_0x99a1('0x6d')]()),_0x3ac09a[_0xe30c3d]);}}this[_0x99a1('0x45')](_0x3ac09a[_0x99a1('0xe9')],_0x99a1('0xfe'),_0x99a1('0xff'),'');if(_0x3ac09a[_0x99a1('0x100')]){this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x3ac09a[_0x99a1('0x100')]));var _0x1f2219=this[_0x99a1('0x3a')][_0x99a1('0x101')](_0x3ac09a[_0x99a1('0x100')]);try{fs[_0x99a1('0x102')](_0x3ac09a[_0x99a1('0x100')]+'.wav');}catch(_0x1a6043){logger['error'](_0x1a6043);}return _0x1f2219;}else{return this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')]('SestekNDA\x20Result\x20%s',_0x3ac09a[_0x99a1('0xe9')]));}}return this['channel'][_0x99a1('0x2f')](_0xba944,_0x99a1('0x103'));};AGIVertices[_0x99a1('0x10')][_0x99a1('0x104')]=function(_0x10f60b){logger['info'](util[_0x99a1('0x2c')]('Enter\x20in\x20END\x20(%s)\x20block',_0x10f60b[_0x99a1('0xa4')]));return this[_0x99a1('0x3a')][_0x99a1('0xa5')]('end');};AGIVertices['prototype'][_0x99a1('0x105')]=function(_0x21d5c0){logger['info'](util['format'](_0x99a1('0x106'),_0x21d5c0['label']));var _0x337549='';if(_0x21d5c0[_0x99a1('0x107')]){if(!this['isConfigured'](_0x21d5c0[_0x99a1('0x107')])){return this['channel'][_0x99a1('0x2f')](_0x21d5c0,_0x99a1('0x108'));}else{var _0x3aad2e=parseInt(_0x21d5c0[_0x99a1('0x107')],0xa);if(isNaN(_0x3aad2e)){_0x337549=_0x21d5c0['trunk_id'];}else{_0x337549=this[_0x99a1('0x1d')][_0x99a1('0xa1')](this,_0x21d5c0[_0x99a1('0x107')]);if(!_0x337549){return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x21d5c0,'no\x20trunk\x20found');}}}}else if(_0x21d5c0[_0x99a1('0x109')]){_0x337549=_0x21d5c0[_0x99a1('0x109')];}else{return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x21d5c0,_0x99a1('0x108'));}var _0x3caa51=this[_0x99a1('0x3a')][_0x99a1('0xad')]('DIAL',[util[_0x99a1('0x2c')](_0x99a1('0x10a'),_0x337549,_0x21d5c0['phone']),_0x21d5c0[_0x99a1('0x6a')],_0x21d5c0['opts'],_0x21d5c0[_0x99a1('0x68')]]);if(_0x3caa51[_0x99a1('0xa8')]===-0x1){return _0x3caa51;}return this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0xe1'),_0x99a1('0xde')));};AGIVertices[_0x99a1('0x10')][_0x99a1('0x10b')]=function(_0x16c436){logger['info'](util[_0x99a1('0x2c')](_0x99a1('0x10c'),_0x16c436['label']));return this[_0x99a1('0x3a')]['noop'](_0x99a1('0x10b'));};AGIVertices[_0x99a1('0x10')]['getdigits']=function(_0x548ab6){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x10d'),_0x548ab6[_0x99a1('0xa4')]));if(_0x548ab6[_0x99a1('0x10e')]===0x0){return this[_0x99a1('0xa0')](_0x548ab6);}_0x548ab6['retry']-=0x1;if(!this['isConfigured'](_0x548ab6[_0x99a1('0x10f')])){return this[_0x99a1('0x3a')]['error'](_0x548ab6,_0x99a1('0x110'));}var _0x20804e=this['getSound']['sync'](this,_0x548ab6['file_id']);if(!_0x20804e){return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x548ab6,_0x99a1('0x111'));}if(!this['isConfigured'](_0x548ab6['variable_id'])){return this['channel']['error'](_0x99a1('0xd4'));}var _0x4ca37e=this[_0x99a1('0x3a')][_0x99a1('0x112')](_0x20804e,_0x548ab6[_0x99a1('0x113')],_0x548ab6[_0x99a1('0x114')]);var _0x24dcbf=_0x4ca37e[_0x99a1('0xa8')]?_0x4ca37e['result'][_0x99a1('0x50')]():'';logger[_0x99a1('0x31')](_0x99a1('0x115'),JSON[_0x99a1('0x74')](_0x4ca37e));if(_0x4ca37e[_0x99a1('0xa8')]===-0x1){this[_0x99a1('0x39')][_0x99a1('0xa1')](this,_0x548ab6,_0x24dcbf);return _0x4ca37e;}else if(_0x4ca37e[_0x99a1('0x9f')]===_0x99a1('0x6a')){_0x4ca37e[_0x99a1('0xa8')]=_0x24dcbf['length']>=parseInt(_0x548ab6['mindigit'])?'x':'i';}else{_0x4ca37e[_0x99a1('0xa8')]=_0x24dcbf[_0x99a1('0x9b')]>=parseInt(_0x548ab6['mindigit'])&&_0x24dcbf[_0x99a1('0x9b')]<=parseInt(_0x548ab6[_0x99a1('0x114')])?'x':'i';}var _0x2a6f8b=this['getVariable']['sync'](this,_0x548ab6['variable_id']);if(!_0x2a6f8b){return this['channel']['error'](_0x548ab6,'no\x20variable\x20found');}this[_0x99a1('0x3a')][_0x99a1('0x9c')](_0x2a6f8b,_0x24dcbf);if(this['isConfigured'](_0x548ab6['hiddendigitsnum'])){var _0x267f31=parseInt(_0x548ab6[_0x99a1('0x116')],0xa);var _0x313e6d=rs[_0x99a1('0x117')]({'charset':'*','length':_0x267f31});var _0x2daada=_0x24dcbf[_0x99a1('0x9b')];if(_0x2daada>0x0){if(_0x2daada>_0x267f31){this[_0x99a1('0x39')][_0x99a1('0xa1')](this,_0x548ab6,_0x548ab6['hiddendigitspos']===_0x99a1('0x118')?_0x313e6d+_0x24dcbf[_0x99a1('0x119')](_0x267f31):_0x24dcbf['substr'](0x0,_0x2daada-_0x267f31)+_0x313e6d);}else{this[_0x99a1('0x39')][_0x99a1('0xa1')](this,_0x548ab6,rs[_0x99a1('0x117')]({'charset':'*','length':_0x2daada}));}}else{this[_0x99a1('0x39')]['sync'](this,_0x548ab6,'');}}else{this['createSquareDetailsReport'][_0x99a1('0xa1')](this,_0x548ab6,_0x24dcbf);}return _0x4ca37e;};AGIVertices[_0x99a1('0x10')]['getsecretdigits']=function(_0x2dcf32){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x11a'),_0x2dcf32[_0x99a1('0xa4')]));return this[_0x99a1('0x11b')](_0x2dcf32);};AGIVertices[_0x99a1('0x10')]['goal']=function(_0x301584){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x11c'),_0x301584[_0x99a1('0xa4')]));this[_0x99a1('0x39')][_0x99a1('0xa1')](this,_0x301584,_0x301584['goalname']);return this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0x11d'),_0x301584['goalname']));};AGIVertices[_0x99a1('0x10')][_0x99a1('0x11e')]=function(_0x5e11bd){logger['info'](util[_0x99a1('0x2c')](_0x99a1('0x11f'),_0x5e11bd[_0x99a1('0xa4')]));if(!this[_0x99a1('0x84')](_0x5e11bd['aws_access_key_id'])||!this[_0x99a1('0x84')](_0x5e11bd['aws_secret_access_key'])){return this[_0x99a1('0x3a')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x99a1('0x84')](_0x5e11bd[_0x99a1('0x60')])){return this[_0x99a1('0x3a')]['noop']('no\x20text\x20configured');}this['channel'][_0x99a1('0xa5')](util['format'](_0x99a1('0x120'),_0x5e11bd[_0x99a1('0x60')]));var _0x1065cc=this[_0x99a1('0x86')][_0x99a1('0xa1')](this,_0x5e11bd);if(_0x1065cc){this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0x121'),_0x1065cc));var _0x413c8b=this[_0x99a1('0x3a')][_0x99a1('0x101')](_0x1065cc);try{fs[_0x99a1('0x102')](_0x1065cc+_0x99a1('0x122'));}catch(_0x2a110c){logger['error'](_0x2a110c);}return _0x413c8b;}return this[_0x99a1('0x3a')]['error'](_0x5e11bd,_0x99a1('0x123'));};AGIVertices[_0x99a1('0x10')][_0x99a1('0x124')]=function(_0x2740ed){logger[_0x99a1('0x31')](util['format'](_0x99a1('0x125'),_0x2740ed[_0x99a1('0xa4')]));if(!this[_0x99a1('0x84')](_0x2740ed[_0x99a1('0x87')])||!this['isConfigured'](_0x2740ed[_0x99a1('0x8b')])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0x126'));}if(!this[_0x99a1('0x84')](_0x2740ed[_0x99a1('0x8c')])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0x127'));}if(!this[_0x99a1('0x84')](_0x2740ed['text'])){return this[_0x99a1('0x3a')]['noop']('no\x20text\x20configured');}this['channel'][_0x99a1('0xe5')]=!![];this[_0x99a1('0x39')](_0x2740ed);this[_0x99a1('0x45')](_0x2740ed[_0x99a1('0x60')],'in','','');this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')]('Trying\x20Amazon\x20Lex:\x20%s',_0x2740ed[_0x99a1('0x60')]));var _0x2121b5=this[_0x99a1('0x8a')]['sync'](this,_0x2740ed);if(_0x2121b5){for(var _0x3fadc5 in _0x2121b5){if(_0x2121b5[_0x99a1('0x93')](_0x3fadc5)&&_[_0x99a1('0x94')](_0x2121b5[_0x3fadc5])){this[_0x99a1('0x3a')]['setVariable'](util[_0x99a1('0x2c')](_0x99a1('0x128'),_0x3fadc5[_0x99a1('0x6d')]()),_0x2121b5[_0x3fadc5]);}}if(_[_0x99a1('0x47')](_0x2121b5[_0x99a1('0x79')])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0x129'));}else{this[_0x99a1('0x45')](_0x2121b5[_0x99a1('0x79')],_0x99a1('0xfe'),_0x99a1('0x12a'),'');return this[_0x99a1('0x3a')]['noop'](util['format'](_0x99a1('0x12b'),_0x2121b5[_0x99a1('0x79')]));}}return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x2740ed,_0x99a1('0x12c'));};AGIVertices[_0x99a1('0x10')][_0x99a1('0x12d')]=function(_0x27d6d6){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x12e'),_0x27d6d6['label'],_0x27d6d6['timeout']));if(!this['isConfigured'](_0x27d6d6[_0x99a1('0x7c')])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0xe4'));}var _0x5d5f13='wav';var _0x4ef4c9=util[_0x99a1('0x2c')](_0x99a1('0x12f'),FILES_PATH,rs[_0x99a1('0x117')](0x4));var _0x14e207=util[_0x99a1('0x2c')]('%s.%s',_0x4ef4c9,_0x5d5f13);var _0xc8f07b=!![];if(_0x27d6d6['beep']===_0x99a1('0x130')){_0xc8f07b=![];}var _0x2bf2c0=this[_0x99a1('0x3a')]['recordFile'](_0x4ef4c9,_0x5d5f13,_0x27d6d6[_0x99a1('0x131')],_0x27d6d6[_0x99a1('0x6a')],undefined,_0xc8f07b);if(_0x2bf2c0[_0x99a1('0xa8')]!==-0x1){this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0x132'),_0x14e207));var _0x3dee2=this[_0x99a1('0x8d')][_0x99a1('0xa1')](this,_0x27d6d6,_0x14e207);if(_0x3dee2){for(var _0x4805a8 in _0x3dee2){if(_0x3dee2[_0x99a1('0x93')](_0x4805a8)){this['channel'][_0x99a1('0x9c')](util[_0x99a1('0x2c')](_0x99a1('0x133'),_0x4805a8['toUpperCase']()),_0x3dee2[_0x4805a8]);}}return this[_0x99a1('0x3a')]['noop'](util['format'](_0x99a1('0x134'),JSON[_0x99a1('0x74')](_0x3dee2)));}}return _0x2bf2c0;};AGIVertices[_0x99a1('0x10')]['tildeasr']=function(_0x32ee64){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x32ee64[_0x99a1('0xa4')]));if(!this['isConfigured'](_0x32ee64[_0x99a1('0x8f')])){return this[_0x99a1('0x3a')]['noop'](_0x99a1('0x135'));}if(!this[_0x99a1('0x84')](_0x32ee64[_0x99a1('0x90')])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0x136'));}var _0x4df111=_0x99a1('0x137');var _0x128c44=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x99a1('0x117')](0x4));var _0x3e5104=util[_0x99a1('0x2c')](_0x99a1('0x9a'),_0x128c44,_0x4df111);var _0x322aa3=!![];if(_0x32ee64[_0x99a1('0x138')]==='NOBEEP'){_0x322aa3=![];}var _0x17c738=this[_0x99a1('0x3a')][_0x99a1('0x139')](_0x128c44,_0x4df111,_0x32ee64[_0x99a1('0x131')],_0x32ee64[_0x99a1('0x6a')],undefined,_0x322aa3);if(_0x17c738['result']!==-0x1){this['channel'][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0x13a'),_0x3e5104));var _0x4f039d=this['tildeASR'][_0x99a1('0xa1')](this,_0x32ee64,_0x3e5104);if(_0x4f039d){for(var _0x1e42cd in _0x4f039d){if(_0x4f039d[_0x99a1('0x93')](_0x1e42cd)){this[_0x99a1('0x3a')][_0x99a1('0x9c')](util['format'](_0x99a1('0x13b'),_0x1e42cd[_0x99a1('0x6d')]()),_0x4f039d[_0x1e42cd]);}}return this[_0x99a1('0x3a')]['noop'](util[_0x99a1('0x2c')]('TildeASR\x20Result\x20%s',JSON[_0x99a1('0x74')](_0x4f039d)));}}return _0x17c738;};AGIVertices[_0x99a1('0x10')][_0x99a1('0x13c')]=function(_0x286c29){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x13d'),_0x286c29[_0x99a1('0xa4')]));return this[_0x99a1('0x3a')][_0x99a1('0x13e')](_0x286c29[_0x99a1('0x40')],_0x286c29[_0x99a1('0x41')],_0x286c29[_0x99a1('0x42')]);};AGIVertices[_0x99a1('0x10')][_0x99a1('0x13f')]=function(_0x1afbf8){logger[_0x99a1('0x31')](util['format'](_0x99a1('0x140'),_0x1afbf8[_0x99a1('0xa4')]));if(!this[_0x99a1('0x84')](_0x1afbf8[_0x99a1('0x141')])){return this[_0x99a1('0x3a')]['error'](_0x1afbf8,'no\x20condition\x20configured');}try{var _0x591cc9=eval(_0x1afbf8[_0x99a1('0x141')])?'true':_0x99a1('0x142');this[_0x99a1('0x3a')][_0x99a1('0xa5')](util['format'](_0x99a1('0x143'),_0x1afbf8[_0x99a1('0x141')],_0x591cc9));return{'code':0xc8,'result':_0x591cc9};}catch(_0x32d01b){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x99a1('0x10')][_0x99a1('0x144')]=function(_0xc7f90a){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x145'),_0xc7f90a['label']));if(!this[_0x99a1('0x84')](_0xc7f90a[_0x99a1('0x146')])){return this['channel'][_0x99a1('0x2f')](_0xc7f90a,_0x99a1('0x147'));}var _0x27d467=this[_0x99a1('0x25')][_0x99a1('0xa1')](this,_0xc7f90a[_0x99a1('0x146')]);if(!_0x27d467){return this[_0x99a1('0x3a')]['error'](_0xc7f90a,_0x99a1('0x148'));}for(var _0x31abcb=0x0;_0x31abcb<_0x27d467[_0x99a1('0x9b')];_0x31abcb+=0x1){var _0x4ec422=this[_0x99a1('0x3a')]['getVariable'](util['format'](_0x99a1('0x149'),_0x27d467[_0x31abcb]));if(_0x4ec422['result']===-0x1){return _0x4ec422;}logger[_0x99a1('0x31')](util[_0x99a1('0x2c')]('IFTIME\x20%s\x20%s',_0x27d467[_0x31abcb],_0x4ec422[_0x99a1('0x9f')]));if(_0x4ec422[_0x99a1('0x9f')]===_0x99a1('0x14a')){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')]('IFTIME\x20%s\x20%s',_0x27d467[_0x31abcb],_0x99a1('0x14a')));this['channel'][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0x14b'),_0x27d467[_0x31abcb],_0x99a1('0x14a')));return{'code':0xc8,'result':_0x99a1('0x14a')};}else{logger[_0x99a1('0x31')](util['format'](_0x99a1('0x14b'),_0x27d467[_0x31abcb],_0x99a1('0x142')));this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')]('IFTIME\x20%s\x20%s',_0x27d467[_0x31abcb],_0x99a1('0x142')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x99a1('0x14c')]=function(_0x4f3352){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x14d'),_0x4f3352[_0x99a1('0xa4')]));return this[_0x99a1('0x3a')]['hangup']();};AGIVertices[_0x99a1('0x10')][_0x99a1('0x14e')]=function(_0x3c94dd){logger[_0x99a1('0x31')](util['format'](_0x99a1('0x14f'),_0x3c94dd[_0x99a1('0xa4')]));if(!this['isConfigured'](_0x3c94dd[_0x99a1('0x7c')])){return this[_0x99a1('0x3a')]['noop'](_0x99a1('0xe4'));}var _0x158613=_0x99a1('0x137');var _0x2e9e98=util['format'](_0x99a1('0x12f'),FILES_PATH,rs[_0x99a1('0x117')](0x4));var _0x1afa2c=util[_0x99a1('0x2c')](_0x99a1('0x9a'),_0x2e9e98,_0x158613);var _0x119f3d=!![];if(_0x3c94dd[_0x99a1('0x138')]===_0x99a1('0x130')){_0x119f3d=![];}var _0x50ef47=this[_0x99a1('0x3a')][_0x99a1('0x139')](_0x2e9e98,_0x158613,_0x3c94dd['intKey'],_0x3c94dd[_0x99a1('0x6a')],undefined,_0x119f3d);if(_0x50ef47[_0x99a1('0xa8')]!==-0x1){this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0x150'),_0x1afa2c));var _0x25d525=this[_0x99a1('0x83')][_0x99a1('0xa1')](this,_0x3c94dd,_0x1afa2c);if(_0x25d525){for(var _0x234322 in _0x25d525){if(_0x25d525[_0x99a1('0x93')](_0x234322)){this[_0x99a1('0x3a')][_0x99a1('0x9c')](util[_0x99a1('0x2c')](_0x99a1('0x151'),_0x234322[_0x99a1('0x6d')]()),_0x25d525[_0x234322]);}}return this['channel'][_0x99a1('0xa5')](util[_0x99a1('0x2c')]('IspeechASR\x20Result\x20%s',JSON[_0x99a1('0x74')](_0x25d525)));}}return _0x50ef47;};AGIVertices[_0x99a1('0x10')]['ispeechtts']=function(_0x16a0a3){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x152'),_0x16a0a3[_0x99a1('0xa4')]));if(!this['isConfigured'](_0x16a0a3['key'])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0xe4'));}if(!this['isConfigured'](_0x16a0a3[_0x99a1('0x60')])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')]('no\x20text\x20configured');}this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0x153'),_0x16a0a3[_0x99a1('0x60')]));var _0x36316b=this[_0x99a1('0x82')][_0x99a1('0xa1')](this,_0x16a0a3);if(_0x36316b){this['channel'][_0x99a1('0xa5')](util['format'](_0x99a1('0x150'),_0x36316b));var _0x547bc4=this[_0x99a1('0x3a')]['streamFile'](_0x36316b,_0x16a0a3[_0x99a1('0x131')]);try{fs[_0x99a1('0x102')](_0x36316b+_0x99a1('0x122'));}catch(_0x3dc351){logger[_0x99a1('0x2f')](_0x3dc351);}return _0x547bc4;}return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x16a0a3,_0x99a1('0x154'));};AGIVertices[_0x99a1('0x10')][_0x99a1('0x155')]=function(_0x16f0ca){logger[_0x99a1('0x31')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x16f0ca['label']));if(!this['isConfigured'](_0x16f0ca[_0x99a1('0x156')])){return this[_0x99a1('0x3a')]['error'](_0x16f0ca,'no\x20find\x20by\x20configured');}logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x157'),this[_0x99a1('0x3a')]['callerid'],_0x16f0ca[_0x99a1('0x156')]));var _0x4fe27c=this[_0x99a1('0x5a')][_0x99a1('0xa1')](this,_0x16f0ca[_0x99a1('0x156')]);if(_0x4fe27c){logger['info'](util[_0x99a1('0x2c')](_0x99a1('0x158'),this[_0x99a1('0x3a')][_0x99a1('0x3e')],_0x16f0ca['findBy']));this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x99a1('0x3a')]['callerid'],_0x16f0ca[_0x99a1('0x156')]));return{'code':0xc8,'result':_0x99a1('0x159')};}else{logger[_0x99a1('0x31')](util[_0x99a1('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x99a1('0x3a')]['callerid'],_0x16f0ca[_0x99a1('0x156')]));this[_0x99a1('0x3a')]['noop'](util[_0x99a1('0x2c')](_0x99a1('0x15a'),this['channel'][_0x99a1('0x3e')],_0x16f0ca[_0x99a1('0x156')]));return{'code':0xc8,'result':_0x99a1('0x15b')};}};AGIVertices[_0x99a1('0x10')]['logout']=function(_0x242a1f){logger['info'](util[_0x99a1('0x2c')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x242a1f[_0x99a1('0xa4')]));if(!this[_0x99a1('0x84')](_0x242a1f[_0x99a1('0x156')])){return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x242a1f,_0x99a1('0x15c'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x99a1('0x3a')][_0x99a1('0x3e')],_0x242a1f['findBy']));var _0x1dd93a=this[_0x99a1('0x57')][_0x99a1('0xa1')](this,_0x242a1f[_0x99a1('0x156')]);if(_0x1dd93a){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x158'),this['channel']['callerid'],_0x242a1f[_0x99a1('0x156')]));this[_0x99a1('0x3a')]['noop'](util[_0x99a1('0x2c')](_0x99a1('0x158'),this['channel'][_0x99a1('0x3e')],_0x242a1f[_0x99a1('0x156')]));return{'code':0xc8,'result':_0x99a1('0x159')};}else{logger[_0x99a1('0x31')](util[_0x99a1('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x99a1('0x3a')][_0x99a1('0x3e')],_0x242a1f[_0x99a1('0x156')]));this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0x15a'),this[_0x99a1('0x3a')]['callerid'],_0x242a1f['findBy']));return{'code':0xc8,'result':_0x99a1('0x15b')};}};AGIVertices[_0x99a1('0x10')][_0x99a1('0x15d')]=function(_0x9db5d3){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x15e'),_0x9db5d3[_0x99a1('0xa4')]));if(!this[_0x99a1('0x84')](_0x9db5d3[_0x99a1('0x15f')])){return this['channel'][_0x99a1('0x2f')](_0x9db5d3,_0x99a1('0x160'));}this['channel'][_0x99a1('0xa5')](util[_0x99a1('0x2c')]('math\x20%s',_0x9db5d3[_0x99a1('0x15f')]));var _0x13d647=eval(_0x9db5d3[_0x99a1('0x15f')]);if(!this[_0x99a1('0x84')](_0x9db5d3[_0x99a1('0x161')])){return this[_0x99a1('0x3a')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2903f3=this['getVariable']['sync'](this,_0x9db5d3[_0x99a1('0x161')]);if(!_0x2903f3){return this['channel'][_0x99a1('0x2f')](_0x9db5d3,_0x99a1('0x162'));}if(_[_0x99a1('0x163')](_0x13d647)){var _0x17226b=this;_0x13d647[_0x99a1('0xd5')](function(_0x5bcee7,_0x9dff4c){_0x17226b[_0x99a1('0x3a')]['setVariable'](util[_0x99a1('0x2c')](_0x99a1('0x164'),_0x2903f3,_0x9dff4c),_0x5bcee7);});return this['channel'][_0x99a1('0xa5')](util['format'](_0x99a1('0x165'),_0x2903f3));}else{return this[_0x99a1('0x3a')][_0x99a1('0x9c')](_0x2903f3,_0x13d647);}};AGIVertices[_0x99a1('0x10')]['menu']=function(_0x4d8def){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x166'),_0x4d8def['label']));if(_0x4d8def[_0x99a1('0x10e')]===0x0){return this[_0x99a1('0xa0')](_0x4d8def);}_0x4d8def[_0x99a1('0x10e')]-=0x1;if(!this['isConfigured'](_0x4d8def[_0x99a1('0x10f')])){return this[_0x99a1('0x3a')]['error'](_0x4d8def,'no\x20file\x20audio\x20selected');}var _0x407a35=this[_0x99a1('0x1f')][_0x99a1('0xa1')](this,_0x4d8def['file_id']);if(!_0x407a35){return this['channel']['error'](_0x4d8def,_0x99a1('0x111'));}var _0x33b319=this[_0x99a1('0x3a')]['getData'](_0x407a35,_0x4d8def[_0x99a1('0x113')],_0x4d8def[_0x99a1('0x167')]);var _0x42db2d=_0x33b319[_0x99a1('0xa8')];if(_0x33b319['result']===-0x1){this[_0x99a1('0x39')][_0x99a1('0xa1')](this,_0x4d8def,'-1');return _0x33b319;}else if(_0x33b319[_0x99a1('0x9f')]===_0x99a1('0x6a')){_0x33b319['result']=_0x33b319[_0x99a1('0xa8')][_0x99a1('0x9b')]>0x0?_0x33b319['result']:'t';}else if(_['isEmpty'](_0x33b319['result'])){_0x33b319[_0x99a1('0xa8')]='#';_0x42db2d='#';}if(!this['isConfigured'](_0x4d8def[_0x99a1('0x161')])){this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0xd4'));}else{var _0x1bc548=this[_0x99a1('0x11')][_0x99a1('0xa1')](this,_0x4d8def[_0x99a1('0x161')]);if(!_0x1bc548){return this['channel'][_0x99a1('0x2f')](_0x4d8def,_0x99a1('0x162'));}this[_0x99a1('0x3a')]['setVariable'](_0x1bc548,_0x42db2d);}this[_0x99a1('0x39')][_0x99a1('0xa1')](this,_0x4d8def,_0x42db2d);return _0x33b319;};AGIVertices[_0x99a1('0x10')][_0x99a1('0xa5')]=function(_0x9894d9){logger['info'](util[_0x99a1('0x2c')](_0x99a1('0x168'),_0x9894d9[_0x99a1('0xa4')]));return this['channel'][_0x99a1('0xa5')](_0x9894d9[_0x99a1('0x169')]||_0x9894d9[_0x99a1('0xa4')]);};AGIVertices['prototype'][_0x99a1('0x16a')]=function(_0x6a4547){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x16b'),_0x6a4547[_0x99a1('0xa4')]));if(!this[_0x99a1('0x84')](_0x6a4547[_0x99a1('0x156')])){return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x6a4547,_0x99a1('0x15c'));}logger['info'](util['format'](_0x99a1('0x157'),this['channel'][_0x99a1('0x3e')],_0x6a4547[_0x99a1('0x156')]));var _0x10d6ee=this[_0x99a1('0x52')][_0x99a1('0xa1')](this,_0x6a4547[_0x99a1('0x16c')]);var _0x1dd3d4=this[_0x99a1('0x54')]['sync'](this,_0x6a4547[_0x99a1('0x156')],_0x10d6ee);if(_0x1dd3d4){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x158'),this[_0x99a1('0x3a')][_0x99a1('0x3e')],_0x6a4547[_0x99a1('0x156')]));this[_0x99a1('0x3a')]['noop'](util[_0x99a1('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x99a1('0x3a')]['callerid'],_0x6a4547['findBy']));return{'code':0xc8,'result':_0x99a1('0x159')};}else{logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x15a'),this[_0x99a1('0x3a')]['callerid'],_0x6a4547['findBy']));this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0x158'),this[_0x99a1('0x3a')]['callerid'],_0x6a4547['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x99a1('0x10')][_0x99a1('0x16d')]=function(_0x36a6f2){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x36a6f2[_0x99a1('0xa4')]));if(!this[_0x99a1('0x84')](_0x36a6f2[_0x99a1('0x10f')])){return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x36a6f2,_0x99a1('0x110'));}var _0x5c8d71=this[_0x99a1('0x1f')]['sync'](this,_0x36a6f2['file_id']);if(!_0x5c8d71){return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x36a6f2,'no\x20file\x20audio\x20found');}var _0x1cb21c=this[_0x99a1('0x3a')]['exec'](_0x99a1('0x16e'),[_0x5c8d71,_0x36a6f2[_0x99a1('0xe0')]]);if(_0x1cb21c[_0x99a1('0xa8')]===-0x1){return _0x1cb21c;}return this['channel']['noop'](util['format'](_0x99a1('0xc1'),'PLAYBACK',_0x5c8d71));};AGIVertices[_0x99a1('0x10')][_0x99a1('0x16f')]=function(_0x4acf66){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x170'),_0x4acf66['label']));if(!this[_0x99a1('0x84')](_0x4acf66[_0x99a1('0x171')])){return this['channel'][_0x99a1('0x2f')](_0x4acf66,'no\x20queue\x20selected');}var _0x5d4a8e='';var _0x376133=parseInt(_0x4acf66[_0x99a1('0x171')],0xa);if(isNaN(_0x376133)){_0x5d4a8e=_0x4acf66['queue_id'];}else{_0x5d4a8e=this['getVoiceQueue'][_0x99a1('0xa1')](this,_0x4acf66['queue_id']);if(!_0x5d4a8e){return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x4acf66,_0x99a1('0x172'));}}var _0x4ebb25='';if(this[_0x99a1('0x84')](_0x4acf66['file_id'])){var _0x4ca60a=this[_0x99a1('0x1f')][_0x99a1('0xa1')](this,_0x4acf66[_0x99a1('0x10f')]);if(_0x4ca60a){_0x4ebb25=_0x4ca60a;}}this[_0x99a1('0x39')][_0x99a1('0xa1')](this,_0x4acf66,_0x5d4a8e);if(_0x4acf66[_0x99a1('0xe0')]['indexOf']('x')<0x0){_0x4acf66[_0x99a1('0xe0')]+='x';}if(_0x4acf66['opts'][_0x99a1('0x173')]('X')<0x0){_0x4acf66[_0x99a1('0xe0')]+='X';}this[_0x99a1('0x3a')]['setVariable'](_0x99a1('0x174'),_0x5d4a8e?_0x5d4a8e[_0x99a1('0x175')]():'');var _0x585321=this[_0x99a1('0x3a')][_0x99a1('0xad')]('QUEUE',[_0x5d4a8e,_0x4acf66['opts'],_0x4acf66[_0x99a1('0x68')],_0x4ebb25,_0x4acf66[_0x99a1('0x6a')],_0x4acf66[_0x99a1('0x8')],_0x4acf66['macro'],_0x4acf66[_0x99a1('0x176')],'',_0x4acf66[_0x99a1('0x177')]]);if(_0x585321[_0x99a1('0xa8')]===-0x1){return _0x585321;}return this[_0x99a1('0x3a')][_0x99a1('0xa5')](util['format'](_0x99a1('0xc1'),_0x99a1('0x178'),_0x5d4a8e));};AGIVertices[_0x99a1('0x10')][_0x99a1('0x179')]=function(_0x127ea4){logger['info'](util[_0x99a1('0x2c')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x127ea4[_0x99a1('0xa4')]));var _0x47db99=_0x127ea4['recordingFormat']||_0x99a1('0x137');var _0x2da7b0=util['format'](_0x99a1('0x17a'),this[_0x99a1('0x3a')][_0x99a1('0x3b')],rs[_0x99a1('0x117')](0x5));var _0x55cb2f=util[_0x99a1('0x2c')](_0x99a1('0x17b'),FILES_PATH,_0x2da7b0,_0x47db99);var _0x4d8cb7=util[_0x99a1('0x2c')](_0x99a1('0x12f'),FILES_PATH,_0x2da7b0);this[_0x99a1('0x3f')][_0x99a1('0xa1')](this,_0x127ea4,_0x2da7b0,_0x55cb2f);this[_0x99a1('0x3a')]['setVariable']('RECORDING_SAVENAME',_0x2da7b0);logger['info'](_0x99a1('0x17c'),_0x4d8cb7,_0x47db99,_0x127ea4[_0x99a1('0x17d')],_0x127ea4[_0x99a1('0x6a')]);return this['channel'][_0x99a1('0x139')](_0x4d8cb7,_0x47db99,_0x127ea4['escape_digits'],_0x127ea4['timeout'],undefined,!![]);};AGIVertices[_0x99a1('0x10')]['restapi']=function(_0x40282f){logger['info'](util[_0x99a1('0x2c')](_0x99a1('0x17e'),_0x40282f[_0x99a1('0xa4')]));if(!this[_0x99a1('0x84')](_0x40282f['url'])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0x17f'));}var _0x320f1c=this[_0x99a1('0x67')]['sync'](this,_0x40282f);logger['info'](util['format']('Response:',util[_0x99a1('0x180')](_0x320f1c,{'showHidden':![],'depth':null})));if(!this[_0x99a1('0x84')](_0x40282f[_0x99a1('0x161')])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x5b9141=this[_0x99a1('0x11')]['sync'](this,_0x40282f[_0x99a1('0x161')]);if(!_0x5b9141){return this[_0x99a1('0x3a')]['error'](_0x40282f,_0x99a1('0x162'));}this[_0x99a1('0x3a')][_0x99a1('0x9c')](util['format'](_0x99a1('0x181'),_0x5b9141),_0x320f1c['statusCode']?_0x320f1c['statusCode']:_0x99a1('0x182'));this[_0x99a1('0x3a')][_0x99a1('0x9c')](util['format']('%s_STATUS_MESSAGE',_0x5b9141),_0x320f1c[_0x99a1('0x78')]?_0x320f1c[_0x99a1('0x78')]:'OK');if(_0x320f1c[_0x99a1('0x75')]){try{this['saveRestApiResult'](_0x320f1c['body'],_0x5b9141);}catch(_0x336390){logger[_0x99a1('0x2f')](util[_0x99a1('0x2c')](_0x99a1('0x183'),_0x5b9141));}}return this[_0x99a1('0x3a')]['noop'](util[_0x99a1('0x2c')]('variable\x20%s\x20set',_0x5b9141));};AGIVertices['prototype'][_0x99a1('0x184')]=function(_0x817a7e){logger[_0x99a1('0x31')](util['format'](_0x99a1('0x185'),_0x817a7e[_0x99a1('0xa4')]));return this[_0x99a1('0x3a')][_0x99a1('0x186')](_0x817a7e[_0x99a1('0x187')][_0x99a1('0x5d')](/\s+/g,''),_0x817a7e[_0x99a1('0x17d')]);};AGIVertices['prototype']['saynumber']=function(_0x3ebd03){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x188'),_0x3ebd03[_0x99a1('0xa4')]));return this[_0x99a1('0x3a')][_0x99a1('0x189')](_0x3ebd03[_0x99a1('0x6b')][_0x99a1('0x5d')](/\s+/g,''),_0x3ebd03[_0x99a1('0x17d')]);};AGIVertices['prototype'][_0x99a1('0x18a')]=function(_0x4ea9c0){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x18b'),_0x4ea9c0[_0x99a1('0xa4')]));return this[_0x99a1('0x3a')]['sayPhonetic'](_0x4ea9c0[_0x99a1('0x60')],_0x4ea9c0[_0x99a1('0x17d')]);};AGIVertices[_0x99a1('0x10')][_0x99a1('0x18c')]=function(_0x275fa8){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x18d'),_0x275fa8[_0x99a1('0xa4')]));if(!this['isConfigured'](_0x275fa8[_0x99a1('0x18e')])){return this[_0x99a1('0x3a')]['noop']('no\x20mail\x20account\x20configured');}var _0x312bcf=this['getMailAccount'][_0x99a1('0xa1')](this,_0x275fa8[_0x99a1('0x18e')]);if(!_0x312bcf||!_0x312bcf[_0x99a1('0x18f')]){return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x275fa8,'no\x20mail\x20account\x20found');}var _0x184e0b={'from':util['format'](_0x99a1('0x190'),_0x312bcf[_0x99a1('0x14')],_0x312bcf['email']||_0x312bcf['Smtp'][_0x99a1('0x191')]),'to':_0x275fa8['to']||'','cc':_0x275fa8['cc']||'','bcc':_0x275fa8[_0x99a1('0x192')]||'','subject':_0x275fa8['subject'],'html':_0x275fa8['text'],'text':_0x275fa8['text']};if(this[_0x99a1('0x84')](_0x275fa8[_0x99a1('0x193')])){}logger[_0x99a1('0xd9')](_0x99a1('0x194'),JSON['stringify'](_0x184e0b));this[_0x99a1('0x39')]['sync'](this,_0x275fa8,_0x275fa8['account_id']);this[_0x99a1('0x3a')][_0x99a1('0xa5')](util['format'](_0x99a1('0x195'),_0x312bcf[_0x99a1('0x14')]));this['sendMailMessage'][_0x99a1('0xa1')](this,_0x312bcf[_0x99a1('0x196')],_0x184e0b);return this[_0x99a1('0x3a')]['noop'](_0x99a1('0x197'));};AGIVertices['prototype'][_0x99a1('0x198')]=function(_0x35a23a){logger['info'](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x35a23a[_0x99a1('0xa4')]));return this[_0x99a1('0x3a')]['noop'](_0x99a1('0x199'));};AGIVertices[_0x99a1('0x10')][_0x99a1('0x19a')]=function(_0x5c64a7){logger['info'](util[_0x99a1('0x2c')](_0x99a1('0x19b'),_0x5c64a7[_0x99a1('0xa4')]));if(!this[_0x99a1('0x84')](_0x5c64a7['sms_account_id'])){return this['channel'][_0x99a1('0xa5')](_0x99a1('0x19c'));}var _0x160e46=this[_0x99a1('0x37')][_0x99a1('0xa1')](this,_0x5c64a7['sms_account_id']);if(!_0x160e46){return this['channel'][_0x99a1('0x2f')](_0x5c64a7,_0x99a1('0x19d'));}var _0x501d4e={'body':_0x5c64a7[_0x99a1('0x19e')],'phone':_0x5c64a7['to']||'','SmsAccountId':_0x160e46['id']};logger[_0x99a1('0xd9')](_0x99a1('0x19f'),JSON[_0x99a1('0x74')](_0x501d4e));this[_0x99a1('0x39')][_0x99a1('0xa1')](this,_0x5c64a7,_0x5c64a7[_0x99a1('0x1a0')]);this['channel']['noop'](util[_0x99a1('0x2c')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x160e46['name']));this[_0x99a1('0x38')]['sync'](this,_0x501d4e);return this['channel'][_0x99a1('0xa5')](_0x99a1('0x1a1'));};AGIVertices[_0x99a1('0x10')][_0x99a1('0x1a2')]=function(_0x1738a6){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x1a3'),_0x1738a6[_0x99a1('0xa4')]));if(!this[_0x99a1('0x84')](_0x1738a6[_0x99a1('0x161')])){return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x1738a6,_0x99a1('0x1a4'));}var _0x46be2b=this[_0x99a1('0x11')]['sync'](this,_0x1738a6[_0x99a1('0x161')]);if(!_0x46be2b){return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x1738a6,_0x99a1('0x162'));}return this[_0x99a1('0x3a')][_0x99a1('0x9c')](_0x46be2b,_0x1738a6[_0x99a1('0x1a5')]);};AGIVertices[_0x99a1('0x10')][_0x99a1('0x1a6')]=function(_0x4f3ae7){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')]('Enter\x20in\x20START\x20(%s)\x20block',_0x4f3ae7[_0x99a1('0xa4')]));this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0x1a7'));var _0x2eb6c8=this[_0x99a1('0x3a')][_0x99a1('0x11')](_0x99a1('0x1a8'));if(!_[_0x99a1('0x4a')](_0x2eb6c8[_0x99a1('0x9f')])){this[_0x99a1('0x3a')]['uniqueid']=_0x2eb6c8[_0x99a1('0x9f')];}if(_0x4f3ae7['answer']===_0x99a1('0x1a9')){this[_0x99a1('0x3a')]['noop'](_0x99a1('0x1aa'));return this['channel'][_0x99a1('0xb6')]();}return this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0x1ab'));};AGIVertices[_0x99a1('0x10')]['subproject']=function(_0x49e059){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x1ac'),_0x49e059[_0x99a1('0xa4')]));if(!this['isConfigured'](_0x49e059[_0x99a1('0x1ad')])){return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x49e059,_0x99a1('0x1ae'));}var _0x5c4fc9=this['getSquareProject'][_0x99a1('0xa1')](this,_0x49e059['project_id']);if(!this[_0x99a1('0x84')](_0x5c4fc9)){return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x49e059,util['format'](_0x99a1('0x1af'),_0x49e059[_0x99a1('0x1ad')]));}if(_0x5c4fc9===this['channel']['arg_1']){return this['channel'][_0x99a1('0x2f')](_0x49e059,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x99a1('0x39')][_0x99a1('0xa1')](this,_0x49e059,_0x5c4fc9);var _0x1f7ddf=this['channel'][_0x99a1('0xad')]('AGI',util[_0x99a1('0x2c')](_0x99a1('0x1b0'),config[_0x99a1('0x8')][_0x99a1('0x1b1')]||_0x99a1('0x1b2'),_0x5c4fc9,this['channel'][_0x99a1('0x3d')]));if(_0x1f7ddf[_0x99a1('0xa8')]===-0x1){return _0x1f7ddf;}return this[_0x99a1('0x3a')]['noop'](util[_0x99a1('0x2c')](_0x99a1('0xc1'),_0x99a1('0x1b3'),_0x5c4fc9));};AGIVertices[_0x99a1('0x10')][_0x99a1('0x1b4')]=function(_0x471ee3){logger['info'](util[_0x99a1('0x2c')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x471ee3[_0x99a1('0xa4')]));var _0x3f0101=this[_0x99a1('0x5b')][_0x99a1('0xa1')](this,_0x471ee3['command']);this[_0x99a1('0x39')][_0x99a1('0xa1')](this,_0x471ee3,_0x471ee3[_0x99a1('0x1b5')]);if(this[_0x99a1('0x84')](_0x471ee3[_0x99a1('0x161')])){var _0x4cce15=this['getVariable'][_0x99a1('0xa1')](this,_0x471ee3[_0x99a1('0x161')]);if(_0x4cce15){this[_0x99a1('0x3a')][_0x99a1('0x9c')](_0x4cce15,_0x3f0101);return this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x471ee3[_0x99a1('0x1b5')],_0x4cce15));}}return this['channel'][_0x99a1('0xa5')](util[_0x99a1('0x2c')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x471ee3[_0x99a1('0x1b5')]));};AGIVertices[_0x99a1('0x10')]['google_cloud_tts']=function(_0x2313dc){logger[_0x99a1('0x31')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x2313dc[_0x99a1('0xa4')]));_0x2313dc[_0x99a1('0x60')]=_0x2313dc[_0x99a1('0x60')][_0x99a1('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x99a1('0x84')](_0x2313dc[_0x99a1('0x5f')])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0x1b6'));}if(!this[_0x99a1('0x84')](_0x2313dc['text'])){return this[_0x99a1('0x3a')][_0x99a1('0xa5')](_0x99a1('0xa6'));}this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0x1b7'),_0x2313dc['text']));var _0x265a5f=this[_0x99a1('0x5e')][_0x99a1('0xa1')](this,_0x2313dc);if(_0x265a5f){this[_0x99a1('0x3a')]['noop'](util[_0x99a1('0x2c')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x265a5f));var _0x52361c=this[_0x99a1('0x3a')]['streamFile'](_0x265a5f);try{fs['unlink'](_0x265a5f+_0x99a1('0x122'));}catch(_0x75269c){logger['error'](_0x75269c);}return _0x52361c;}return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x2313dc,_0x99a1('0x1b8'));};AGIVertices['prototype'][_0x99a1('0x1b9')]=function(_0x1e9e03){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x1e9e03[_0x99a1('0xa4')]));_0x1e9e03[_0x99a1('0x60')]=_0x1e9e03[_0x99a1('0x60')][_0x99a1('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1e9e03[_0x99a1('0x60')])){return this[_0x99a1('0x3a')]['noop'](_0x99a1('0xa6'));}this[_0x99a1('0x3a')][_0x99a1('0xa5')](util[_0x99a1('0x2c')](_0x99a1('0x1ba'),_0x1e9e03[_0x99a1('0x60')]));var _0xa1b99a=this[_0x99a1('0x65')][_0x99a1('0xa1')](this,_0x1e9e03);if(_0xa1b99a){this[_0x99a1('0x3a')][_0x99a1('0xa5')](util['format'](_0x99a1('0x1bb'),_0xa1b99a));var _0x130ff3=this[_0x99a1('0x3a')]['streamFile'](_0xa1b99a);try{fs[_0x99a1('0x102')](_0xa1b99a+_0x99a1('0x122'));}catch(_0x46465c){logger['error'](_0x46465c);}return _0x130ff3;}return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x1e9e03,_0x99a1('0x1bc'));};AGIVertices['prototype'][_0x99a1('0x1bd')]=function(_0x2bf42f){logger[_0x99a1('0x31')](util['format'](_0x99a1('0x1be'),_0x2bf42f['label']));if(!this[_0x99a1('0x84')](_0x2bf42f[_0x99a1('0x156')])){return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x2bf42f,_0x99a1('0x15c'));}logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x157'),this[_0x99a1('0x3a')][_0x99a1('0x3e')],_0x2bf42f['findBy']));var _0x14dbf4=this[_0x99a1('0x56')][_0x99a1('0xa1')](this,_0x2bf42f[_0x99a1('0x156')]);if(_0x14dbf4){logger['info'](util[_0x99a1('0x2c')](_0x99a1('0x158'),this[_0x99a1('0x3a')]['callerid'],_0x2bf42f[_0x99a1('0x156')]));this[_0x99a1('0x3a')]['noop'](util['format'](_0x99a1('0x158'),this[_0x99a1('0x3a')][_0x99a1('0x3e')],_0x2bf42f['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x99a1('0x31')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x99a1('0x3a')][_0x99a1('0x3e')],_0x2bf42f[_0x99a1('0x156')]));this['channel'][_0x99a1('0xa5')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x99a1('0x3a')][_0x99a1('0x3e')],_0x2bf42f[_0x99a1('0x156')]));return{'code':0xc8,'result':_0x99a1('0x15b')};}};AGIVertices[_0x99a1('0x10')][_0x99a1('0x1bf')]=function(_0x4c41b2){logger[_0x99a1('0x31')](util[_0x99a1('0x2c')](_0x99a1('0x1c0'),_0x4c41b2['label']));var _0x4d55e2=this[_0x99a1('0x3a')]['exec']('VOICEMAIL',[_0x4c41b2['mailbox'],_0x4c41b2[_0x99a1('0x7b')]]);if(_0x4d55e2['result']===-0x1){return _0x4d55e2;}return this[_0x99a1('0x3a')]['noop'](util[_0x99a1('0x2c')]('Executed\x20command\x20%s\x20%s',_0x99a1('0x1c1'),_0x4c41b2[_0x99a1('0x1c2')]));};AGIVertices[_0x99a1('0x10')][_0x99a1('0x1c3')]=function(_0x21e535){logger['info'](util['format'](_0x99a1('0x1c4'),_0x21e535['label']));if(!this[_0x99a1('0x84')](_0x21e535['variable_id'])){return this[_0x99a1('0x3a')]['error'](_0x21e535,_0x99a1('0x1a4'));}var _0x194aa1=this[_0x99a1('0x11')][_0x99a1('0xa1')](this,_0x21e535[_0x99a1('0x161')]);if(!_0x194aa1){return this[_0x99a1('0x3a')][_0x99a1('0x2f')](_0x21e535,_0x99a1('0x162'));}var _0x40693d=this[_0x99a1('0x3a')][_0x99a1('0x11')](_0x194aa1);return{'code':0xc8,'result':_0x40693d['extra']?_0x40693d[_0x99a1('0x9f')]:'-'};};String[_0x99a1('0x10')][_0x99a1('0x9e')]=function(_0x2aca91,_0x59a109){return this[_0x99a1('0x9d')](_0x2aca91)[_0x99a1('0x1c5')](_0x59a109);};module[_0x99a1('0x1c6')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 972ce75..b86d93f 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 _0x77a9=['[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','updateAcw','timer','update','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','startAcw','channels','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','resolve','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','[ACW][START]\x20%s','message','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','attended','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all'];(function(_0x41b918,_0x579bca){var _0x422a41=function(_0x16d31e){while(--_0x16d31e){_0x41b918['push'](_0x41b918['shift']());}};_0x422a41(++_0x579bca);}(_0x77a9,0x19e));var _0x977a=function(_0x139a13,_0x5bf1c2){_0x139a13=_0x139a13-0x0;var _0x3d088a=_0x77a9[_0x139a13];return _0x3d088a;};'use strict';var _=require(_0x977a('0x0'));var moment=require('moment');var ami=require(_0x977a('0x1'));var logger=require('../../../config/logger')(_0x977a('0x2'));var RpcUser=require(_0x977a('0x3'));var RpcVoiceAgentReport=require(_0x977a('0x4'));function Acw(_0x368664){this['voiceQueues']=_0x368664[_0x977a('0x5')];this[_0x977a('0x6')]=_0x368664[_0x977a('0x6')];this[_0x977a('0x7')]=_0x368664[_0x977a('0x7')];this['channels']={};ami['on']('agentconnect',this[_0x977a('0x8')][_0x977a('0x9')](this));ami['on']('hanguprequest',this[_0x977a('0xa')][_0x977a('0x9')](this));ami['on'](_0x977a('0xb'),this[_0x977a('0xc')][_0x977a('0x9')](this));ami['on'](_0x977a('0xd'),this[_0x977a('0xe')][_0x977a('0x9')](this));ami['on'](_0x977a('0xf'),this[_0x977a('0x10')]['bind'](this));ami['on'](_0x977a('0x11'),this[_0x977a('0x12')][_0x977a('0x9')](this));ami['on'](_0x977a('0x13'),this[_0x977a('0x14')][_0x977a('0x9')](this));}function getDiff(_0x42ccb8){var _0x2fc086=moment()[_0x977a('0x15')](0x0);var _0x3192b4=moment(_0x42ccb8)['milliseconds'](0x0);return _0x2fc086[_0x977a('0x16')](_0x3192b4,'seconds');}Acw[_0x977a('0x17')][_0x977a('0x18')]=function(_0x51caa0,_0x11a0ab){var _0x432c16=this;var _0x25e169=getDiff(_0x432c16[_0x977a('0x7')][_0x51caa0]['lastPauseAt']);clearTimeout(_0x432c16[_0x977a('0x7')][_0x51caa0][_0x977a('0x19')]);_0x432c16[_0x977a('0x7')][_0x51caa0]['timer']=![];return RpcVoiceAgentReport[_0x977a('0x1a')]({'acwtime':_0x25e169},_0x432c16[_0x977a('0x7')][_0x51caa0]['uniqueid'],_0x51caa0)[_0x977a('0x1b')](function(_0x5bb56d){logger[_0x977a('0x1c')](_0x977a('0x1d'),_0x11a0ab,_0x25e169,_0x5bb56d);})[_0x977a('0x1e')](function(_0xcbb2df){logger[_0x977a('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x11a0ab,_0xcbb2df);})[_0x977a('0x20')](function(){delete _0x432c16[_0x977a('0x7')][_0x51caa0];});};Acw[_0x977a('0x17')][_0x977a('0x21')]=function(_0x22898f){try{var _0x50ba0a=this;var _0x4e3130=this[_0x977a('0x22')][_0x22898f][_0x977a('0x23')];var _0x3f99c3=this[_0x977a('0x22')][_0x22898f][_0x977a('0x24')];var _0x51f4b6=this[_0x977a('0x5')][_0x3f99c3];var _0x5e9ed5=![];var _0x35888f=_0x977a('0x25');if(_0x51f4b6[_0x977a('0x26')]&&_0x51f4b6['mandatoryDispositionPause'][_0x977a('0x27')]){_0x5e9ed5=!![];_0x35888f=_0x51f4b6[_0x977a('0x28')][_0x977a('0x27')];}if(!_0x50ba0a['agents'][_0x4e3130]){return Promise[_0x977a('0x29')]();}return RpcUser['getAgent'](_0x50ba0a[_0x977a('0x6')][_0x4e3130]['id'])[_0x977a('0x1b')](function(_0x141e1d){if(!_0x141e1d||_0x141e1d['voicePause']){logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x22898f,_0x4e3130,_0x3f99c3);return;}logger[_0x977a('0x1c')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x22898f,_0x4e3130,_0x3f99c3);var _0x48fa58=_0x50ba0a[_0x977a('0x22')][_0x22898f]['attended']&&_0x50ba0a[_0x977a('0x22')][_0x22898f]['destlinkedid']?_0x50ba0a[_0x977a('0x22')][_0x22898f][_0x977a('0x2a')]:_0x22898f;return RpcUser[_0x977a('0x2b')](_0x50ba0a[_0x977a('0x6')][_0x4e3130],_0x35888f,_0x48fa58);})['then'](function(_0x1f1063){if(_0x5e9ed5||!_0x1f1063){return;}_0x50ba0a[_0x977a('0x7')][_0x4e3130]={};logger[_0x977a('0x1c')](_0x977a('0x2c'),_0x22898f,_0x50ba0a[_0x977a('0x5')][_0x3f99c3]['acwTimeout'],_0x4e3130,_0x3f99c3);_0x50ba0a['timers'][_0x4e3130][_0x977a('0x19')]=setTimeout(_0x50ba0a[_0x977a('0x2d')][_0x977a('0x9')](_0x50ba0a,_0x4e3130),_0x50ba0a['voiceQueues'][_0x3f99c3][_0x977a('0x2e')]*0x3e8);_0x50ba0a[_0x977a('0x7')][_0x4e3130][_0x977a('0x2f')]=moment()['format'](_0x977a('0x30'));_0x50ba0a[_0x977a('0x7')][_0x4e3130][_0x977a('0x31')]=_0x22898f;_0x50ba0a[_0x977a('0x7')][_0x4e3130][_0x977a('0x24')]=_0x3f99c3;_0x50ba0a['timers'][_0x4e3130][_0x977a('0x18')]=_0x50ba0a[_0x977a('0x18')][_0x977a('0x9')](_0x50ba0a,_0x4e3130,_0x22898f);})[_0x977a('0x1e')](function(){logger[_0x977a('0x1f')](_0x977a('0x2c'),_0x22898f,_0x50ba0a[_0x977a('0x5')][_0x3f99c3][_0x977a('0x2e')],_0x4e3130,_0x3f99c3);})['finally'](function(){delete _0x50ba0a[_0x977a('0x22')][_0x22898f];});}catch(_0x25af42){logger[_0x977a('0x1f')](_0x977a('0x32'),_0x25af42[_0x977a('0x33')]);}};Acw[_0x977a('0x17')][_0x977a('0x2d')]=function(_0x4d7415){try{var _0xe71e2e=this;if(_0xe71e2e['timers'][_0x4d7415]){_0xe71e2e[_0x977a('0x7')][_0x4d7415]['timer']=![];var _0x4a1345=_0xe71e2e[_0x977a('0x7')][_0x4d7415][_0x977a('0x31')];var _0x2073b7=_0xe71e2e['timers'][_0x4d7415]['queue'];var _0x8cb9e6=_0xe71e2e[_0x977a('0x5')][_0x2073b7][_0x977a('0x2e')];logger[_0x977a('0x1c')]('[%s][TIMER][STOP][AGENT:%s]',_0x4a1345,_0x4d7415);RpcUser['saveUnpause'](this[_0x977a('0x6')][_0x4d7415]);RpcVoiceAgentReport[_0x977a('0x1a')]({'acwtime':_0x8cb9e6,'agentacw':!![]},_0x4a1345,_0x4d7415)[_0x977a('0x1b')](function(_0x552eb2){logger[_0x977a('0x1c')]('[%s][UPDATE][ACWTIME:%s]',_0x4a1345,_0x8cb9e6,_0x552eb2);})['catch'](function(_0x90772f){logger['error'](_0x977a('0x34'),_0x4a1345,_0x90772f);});}else{logger[_0x977a('0x1f')](_0x977a('0x35'),_0x4d7415);if(_0xe71e2e[_0x977a('0x7')]){logger[_0x977a('0x1c')](_0x977a('0x36'),JSON[_0x977a('0x37')](_0xe71e2e['timers']));}}}catch(_0x537102){logger[_0x977a('0x1f')](_0x977a('0x38'),_0x537102[_0x977a('0x33')]);}};Acw[_0x977a('0x17')][_0x977a('0x8')]=function(_0xe986f5){try{if(this[_0x977a('0x5')][_0xe986f5[_0x977a('0x24')]]&&(this[_0x977a('0x5')][_0xe986f5['queue']][_0x977a('0x2')]||this[_0x977a('0x5')][_0xe986f5[_0x977a('0x24')]][_0x977a('0x26')])){if(this[_0x977a('0x6')][_0xe986f5[_0x977a('0x23')]]){this['channels'][_0xe986f5[_0x977a('0x31')]]={'queue':_0xe986f5[_0x977a('0x24')],'interface':_0xe986f5[_0x977a('0x23')],'destlinkedid':_0xe986f5['destlinkedid']};}}}catch(_0x57113d){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x57113d[_0x977a('0x33')]);}};Acw[_0x977a('0x17')][_0x977a('0x14')]=function(_0x4443d4){try{if(this[_0x977a('0x5')][_0x4443d4[_0x977a('0x24')]]&&(this[_0x977a('0x5')][_0x4443d4[_0x977a('0x24')]][_0x977a('0x2')]||this[_0x977a('0x5')][_0x4443d4[_0x977a('0x24')]][_0x977a('0x26')])){if(this['agents'][_0x4443d4[_0x977a('0x23')]]){this[_0x977a('0x22')][_0x4443d4['uniqueid']]={'queue':_0x4443d4['queue'],'interface':_0x4443d4[_0x977a('0x23')]};}}}catch(_0x2449d3){logger['error'](_0x977a('0x39'),_0x2449d3['message']);}};Acw[_0x977a('0x17')][_0x977a('0xa')]=function(_0x1b6fcc){try{if(this['channels'][_0x1b6fcc[_0x977a('0x31')]]&&_[_0x977a('0x3a')](this['channels'][_0x1b6fcc[_0x977a('0x31')]]['attended'])){logger[_0x977a('0x1c')](_0x977a('0x3b'),_0x1b6fcc['uniqueid']);this[_0x977a('0x21')](_0x1b6fcc[_0x977a('0x31')]);}else if(this[_0x977a('0x22')][_0x1b6fcc[_0x977a('0x3c')]]&&_[_0x977a('0x3a')](this[_0x977a('0x22')][_0x1b6fcc[_0x977a('0x3c')]][_0x977a('0x3d')])){logger[_0x977a('0x1c')](_0x977a('0x3e'),_0x1b6fcc['linkedid']);this['startAcw'](_0x1b6fcc[_0x977a('0x3c')]);}}catch(_0x5e928a){logger['error'](_0x977a('0x3f'),_0x5e928a['message']);}};Acw['prototype']['syncHangup']=function(_0x1bcf73){try{if(this[_0x977a('0x22')][_0x1bcf73['uniqueid']]&&this['channels'][_0x1bcf73[_0x977a('0x31')]][_0x977a('0x3d')]){logger[_0x977a('0x1c')](_0x977a('0x40'),_0x1bcf73[_0x977a('0x31')]);this[_0x977a('0x21')](_0x1bcf73[_0x977a('0x31')]);}else if(this[_0x977a('0x22')][_0x1bcf73[_0x977a('0x3c')]]&&this[_0x977a('0x22')][_0x1bcf73[_0x977a('0x3c')]]['attended']){logger[_0x977a('0x1c')](_0x977a('0x41'),_0x1bcf73[_0x977a('0x3c')]);this['startAcw'](_0x1bcf73[_0x977a('0x3c')]);}}catch(_0x5598f7){logger[_0x977a('0x1f')](_0x977a('0x42'),_0x5598f7[_0x977a('0x33')]);}};Acw['prototype'][_0x977a('0x10')]=function(_0x59d6e3){try{if(!_[_0x977a('0x43')](this[_0x977a('0x22')][_0x59d6e3[_0x977a('0x44')]])){this[_0x977a('0x21')](_0x59d6e3[_0x977a('0x44')]);if(this[_0x977a('0x22')][_0x59d6e3[_0x977a('0x45')]]){this[_0x977a('0x22')][_0x59d6e3[_0x977a('0x45')]][_0x977a('0x3d')]=!![];this[_0x977a('0x22')][_0x59d6e3['transfertargetuniqueid']]=this['channels'][_0x59d6e3['secondtransfereruniqueid']];delete this[_0x977a('0x22')][_0x59d6e3[_0x977a('0x45')]];}}else if(!_[_0x977a('0x43')](this[_0x977a('0x22')][_0x59d6e3[_0x977a('0x46')]])){this[_0x977a('0x21')](_0x59d6e3[_0x977a('0x46')]);if(this[_0x977a('0x22')][_0x59d6e3[_0x977a('0x47')]]){this['channels'][_0x59d6e3['origtransfereruniqueid']][_0x977a('0x3d')]=!![];this[_0x977a('0x22')][_0x59d6e3['transfereeuniqueid']]=this[_0x977a('0x22')][_0x59d6e3['origtransfereruniqueid']];delete this[_0x977a('0x22')][_0x59d6e3[_0x977a('0x47')]];}}}catch(_0x4069b3){logger[_0x977a('0x1f')]('[ACW][syncAttendedTransfer]\x20%s',_0x4069b3[_0x977a('0x33')]);}};Acw['prototype'][_0x977a('0x12')]=function(_0x5b5946){try{if(this[_0x977a('0x22')][_0x5b5946['transfereruniqueid']]){logger[_0x977a('0x1c')](_0x977a('0x48'),JSON[_0x977a('0x37')](_0x5b5946['transfereruniqueid']));this[_0x977a('0x21')](_0x5b5946[_0x977a('0x49')]);}else if(this[_0x977a('0x22')][_0x5b5946['transfererlinkedid']]){logger[_0x977a('0x1c')](_0x977a('0x4a'),JSON[_0x977a('0x37')](_0x5b5946['transfererlinkedid']));this['startAcw'](_0x5b5946['transfererlinkedid']);}}catch(_0x27cd03){logger[_0x977a('0x1f')](_0x977a('0x4b'),_0x27cd03['message']);}};Acw[_0x977a('0x17')][_0x977a('0xe')]=function(_0x3605f1){try{if(this[_0x977a('0x5')][_0x3605f1[_0x977a('0x24')]]&&this[_0x977a('0x5')][_0x3605f1['queue']][_0x977a('0x4c')]===_0x977a('0x4d')){if(this[_0x977a('0x6')][_0x3605f1[_0x977a('0x23')]]){logger[_0x977a('0x1c')](_0x977a('0x4e'),_0x3605f1[_0x977a('0x31')],_0x3605f1[_0x977a('0x23')],_0x3605f1[_0x977a('0x24')]);return RpcUser[_0x977a('0x2b')](this[_0x977a('0x6')][_0x3605f1[_0x977a('0x23')]],_0x977a('0x4f'),_0x3605f1['uniqueid']);}}}catch(_0x1cd292){logger['error'](_0x977a('0x50'),_0x1cd292[_0x977a('0x33')]);}};module[_0x977a('0x51')]=Acw; \ No newline at end of file +var _0xa456=['[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','blindtransfer','syncAgentConnectPreview','milliseconds','diff','seconds','updateAcw','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','then','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','finally','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','stringify','acw','[ACW][syncAgentConnect]\x20%s','syncHangupRequest','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause'];(function(_0x48d5b2,_0x257a0b){var _0x1d0f1b=function(_0x49a481){while(--_0x49a481){_0x48d5b2['push'](_0x48d5b2['shift']());}};_0x1d0f1b(++_0x257a0b);}(_0xa456,0x142));var _0x6a45=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xa456[_0x368fb9];return _0x4892fb;};'use strict';var _=require(_0x6a45('0x0'));var moment=require(_0x6a45('0x1'));var ami=require(_0x6a45('0x2'));var logger=require(_0x6a45('0x3'))('acw');var RpcUser=require(_0x6a45('0x4'));var RpcVoiceAgentReport=require(_0x6a45('0x5'));function Acw(_0x3f7448){this['voiceQueues']=_0x3f7448[_0x6a45('0x6')];this[_0x6a45('0x7')]=_0x3f7448[_0x6a45('0x7')];this[_0x6a45('0x8')]=_0x3f7448['timers'];this[_0x6a45('0x9')]={};ami['on'](_0x6a45('0xa'),this[_0x6a45('0xb')][_0x6a45('0xc')](this));ami['on'](_0x6a45('0xd'),this['syncHangupRequest'][_0x6a45('0xc')](this));ami['on']('hangup',this[_0x6a45('0xe')][_0x6a45('0xc')](this));ami['on'](_0x6a45('0xf'),this[_0x6a45('0x10')][_0x6a45('0xc')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x6a45('0xc')](this));ami['on'](_0x6a45('0x11'),this['syncBlindTransfer']['bind'](this));ami['on']('custom:agentConnectPreview',this[_0x6a45('0x12')][_0x6a45('0xc')](this));}function getDiff(_0x4298de){var _0x3f01f6=moment()[_0x6a45('0x13')](0x0);var _0x5a9f29=moment(_0x4298de)['milliseconds'](0x0);return _0x3f01f6[_0x6a45('0x14')](_0x5a9f29,_0x6a45('0x15'));}Acw['prototype'][_0x6a45('0x16')]=function(_0x171176,_0x3fab82){var _0x13adc0=this;var _0x548634=getDiff(_0x13adc0['timers'][_0x171176]['lastPauseAt']);clearTimeout(_0x13adc0[_0x6a45('0x8')][_0x171176][_0x6a45('0x17')]);_0x13adc0[_0x6a45('0x8')][_0x171176]['timer']=![];return RpcVoiceAgentReport[_0x6a45('0x18')]({'acwtime':_0x548634},_0x13adc0[_0x6a45('0x8')][_0x171176][_0x6a45('0x19')],_0x171176)['then'](function(_0x52e7bf){logger['info'](_0x6a45('0x1a'),_0x3fab82,_0x548634,_0x52e7bf);})[_0x6a45('0x1b')](function(_0x5bdaef){logger[_0x6a45('0x1c')](_0x6a45('0x1d'),_0x3fab82,_0x5bdaef);})['finally'](function(){delete _0x13adc0[_0x6a45('0x8')][_0x171176];});};Acw[_0x6a45('0x1e')][_0x6a45('0x1f')]=function(_0x458b99){try{var _0x15ad0e=this;var _0x487666=this['channels'][_0x458b99][_0x6a45('0x20')];var _0x59af4b=this[_0x6a45('0x9')][_0x458b99][_0x6a45('0x21')];var _0x25a380=this[_0x6a45('0x6')][_0x59af4b];var _0x170623=![];var _0x4692f5=_0x6a45('0x22');if(_0x25a380[_0x6a45('0x23')]&&_0x25a380[_0x6a45('0x24')][_0x6a45('0x25')]){_0x170623=!![];_0x4692f5=_0x25a380['mandatoryDispositionPause'][_0x6a45('0x25')];}if(!_0x15ad0e['agents'][_0x487666]){return Promise[_0x6a45('0x26')]();}return RpcUser[_0x6a45('0x27')](_0x15ad0e[_0x6a45('0x7')][_0x487666]['id'])[_0x6a45('0x28')](function(_0x3ede76){if(!_0x3ede76||_0x3ede76['voicePause']){logger[_0x6a45('0x29')](_0x6a45('0x2a'),_0x458b99,_0x487666,_0x59af4b);return;}logger[_0x6a45('0x29')](_0x6a45('0x2b'),_0x458b99,_0x487666,_0x59af4b);var _0x8265d9=_0x15ad0e[_0x6a45('0x9')][_0x458b99][_0x6a45('0x2c')]&&_0x15ad0e[_0x6a45('0x9')][_0x458b99]['destlinkedid']?_0x15ad0e[_0x6a45('0x9')][_0x458b99][_0x6a45('0x2d')]:_0x458b99;return RpcUser[_0x6a45('0x2e')](_0x15ad0e[_0x6a45('0x7')][_0x487666],_0x4692f5,_0x8265d9);})[_0x6a45('0x28')](function(_0x5dc288){if(_0x170623||!_0x5dc288){return;}_0x15ad0e[_0x6a45('0x8')][_0x487666]={};logger[_0x6a45('0x29')](_0x6a45('0x2f'),_0x458b99,_0x15ad0e[_0x6a45('0x6')][_0x59af4b]['acwTimeout'],_0x487666,_0x59af4b);_0x15ad0e['timers'][_0x487666][_0x6a45('0x17')]=setTimeout(_0x15ad0e['stopAcw'][_0x6a45('0xc')](_0x15ad0e,_0x487666),_0x15ad0e['voiceQueues'][_0x59af4b][_0x6a45('0x30')]*0x3e8);_0x15ad0e[_0x6a45('0x8')][_0x487666][_0x6a45('0x31')]=moment()[_0x6a45('0x32')](_0x6a45('0x33'));_0x15ad0e[_0x6a45('0x8')][_0x487666][_0x6a45('0x19')]=_0x458b99;_0x15ad0e[_0x6a45('0x8')][_0x487666][_0x6a45('0x21')]=_0x59af4b;_0x15ad0e[_0x6a45('0x8')][_0x487666][_0x6a45('0x16')]=_0x15ad0e[_0x6a45('0x16')][_0x6a45('0xc')](_0x15ad0e,_0x487666,_0x458b99);})['catch'](function(){logger[_0x6a45('0x1c')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x458b99,_0x15ad0e[_0x6a45('0x6')][_0x59af4b][_0x6a45('0x30')],_0x487666,_0x59af4b);})[_0x6a45('0x34')](function(){delete _0x15ad0e[_0x6a45('0x9')][_0x458b99];});}catch(_0x462d1f){logger[_0x6a45('0x1c')]('[ACW][START]\x20%s',_0x462d1f[_0x6a45('0x35')]);}};Acw[_0x6a45('0x1e')][_0x6a45('0x36')]=function(_0xc6a7){try{var _0x9e6869=this;if(_0x9e6869[_0x6a45('0x8')][_0xc6a7]){_0x9e6869['timers'][_0xc6a7][_0x6a45('0x17')]=![];var _0xbd573b=_0x9e6869['timers'][_0xc6a7][_0x6a45('0x19')];var _0x32f014=_0x9e6869[_0x6a45('0x8')][_0xc6a7][_0x6a45('0x21')];var _0x476176=_0x9e6869['voiceQueues'][_0x32f014][_0x6a45('0x30')];logger[_0x6a45('0x29')](_0x6a45('0x37'),_0xbd573b,_0xc6a7);RpcUser[_0x6a45('0x38')](this[_0x6a45('0x7')][_0xc6a7]);RpcVoiceAgentReport[_0x6a45('0x18')]({'acwtime':_0x476176,'agentacw':!![]},_0xbd573b,_0xc6a7)[_0x6a45('0x28')](function(_0x59ce5a){logger[_0x6a45('0x29')]('[%s][UPDATE][ACWTIME:%s]',_0xbd573b,_0x476176,_0x59ce5a);})[_0x6a45('0x1b')](function(_0x402d7f){logger[_0x6a45('0x1c')](_0x6a45('0x1d'),_0xbd573b,_0x402d7f);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0xc6a7);if(_0x9e6869[_0x6a45('0x8')]){logger[_0x6a45('0x29')]('[ACW][TIMERS]',JSON[_0x6a45('0x39')](_0x9e6869[_0x6a45('0x8')]));}}}catch(_0x3bd926){logger[_0x6a45('0x1c')]('[ACW][STOP]\x20%s',_0x3bd926['message']);}};Acw['prototype']['syncAgentConnect']=function(_0xe90201){try{if(this[_0x6a45('0x6')][_0xe90201[_0x6a45('0x21')]]&&(this[_0x6a45('0x6')][_0xe90201[_0x6a45('0x21')]][_0x6a45('0x3a')]||this[_0x6a45('0x6')][_0xe90201[_0x6a45('0x21')]]['mandatoryDisposition'])){if(this[_0x6a45('0x7')][_0xe90201['interface']]){this['channels'][_0xe90201[_0x6a45('0x19')]]={'queue':_0xe90201[_0x6a45('0x21')],'interface':_0xe90201['interface'],'destlinkedid':_0xe90201[_0x6a45('0x2d')]};}}}catch(_0x537ff2){logger[_0x6a45('0x1c')](_0x6a45('0x3b'),_0x537ff2[_0x6a45('0x35')]);}};Acw[_0x6a45('0x1e')]['syncAgentConnectPreview']=function(_0x1d6200){try{if(this[_0x6a45('0x6')][_0x1d6200[_0x6a45('0x21')]]&&(this[_0x6a45('0x6')][_0x1d6200[_0x6a45('0x21')]]['acw']||this[_0x6a45('0x6')][_0x1d6200['queue']][_0x6a45('0x23')])){if(this[_0x6a45('0x7')][_0x1d6200['interface']]){this[_0x6a45('0x9')][_0x1d6200[_0x6a45('0x19')]]={'queue':_0x1d6200[_0x6a45('0x21')],'interface':_0x1d6200[_0x6a45('0x20')]};}}}catch(_0x524296){logger[_0x6a45('0x1c')]('[ACW][syncAgentConnectPreview]\x20%s',_0x524296[_0x6a45('0x35')]);}};Acw['prototype'][_0x6a45('0x3c')]=function(_0x146801){try{if(this[_0x6a45('0x9')][_0x146801[_0x6a45('0x19')]]&&_['isUndefined'](this[_0x6a45('0x9')][_0x146801[_0x6a45('0x19')]][_0x6a45('0x2c')])){logger[_0x6a45('0x29')](_0x6a45('0x3d'),_0x146801[_0x6a45('0x19')]);this[_0x6a45('0x1f')](_0x146801[_0x6a45('0x19')]);}else if(this[_0x6a45('0x9')][_0x146801[_0x6a45('0x3e')]]&&_['isUndefined'](this[_0x6a45('0x9')][_0x146801[_0x6a45('0x3e')]][_0x6a45('0x2c')])){logger[_0x6a45('0x29')]('[%s][HANGUP:LINKEDID]',_0x146801[_0x6a45('0x3e')]);this[_0x6a45('0x1f')](_0x146801[_0x6a45('0x3e')]);}}catch(_0x5709c5){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x5709c5[_0x6a45('0x35')]);}};Acw[_0x6a45('0x1e')][_0x6a45('0xe')]=function(_0x1c20d8){try{if(this['channels'][_0x1c20d8[_0x6a45('0x19')]]&&this[_0x6a45('0x9')][_0x1c20d8[_0x6a45('0x19')]][_0x6a45('0x2c')]){logger['info'](_0x6a45('0x3f'),_0x1c20d8[_0x6a45('0x19')]);this[_0x6a45('0x1f')](_0x1c20d8['uniqueid']);}else if(this['channels'][_0x1c20d8[_0x6a45('0x3e')]]&&this[_0x6a45('0x9')][_0x1c20d8['linkedid']][_0x6a45('0x2c')]){logger[_0x6a45('0x29')](_0x6a45('0x40'),_0x1c20d8[_0x6a45('0x3e')]);this[_0x6a45('0x1f')](_0x1c20d8['linkedid']);}}catch(_0x58ec02){logger[_0x6a45('0x1c')]('[ACW][syncHangup]\x20%s',_0x58ec02['message']);}};Acw['prototype'][_0x6a45('0x41')]=function(_0x364a68){try{if(!_[_0x6a45('0x42')](this[_0x6a45('0x9')][_0x364a68['transfereeuniqueid']])){this[_0x6a45('0x1f')](_0x364a68[_0x6a45('0x43')]);if(this[_0x6a45('0x9')][_0x364a68[_0x6a45('0x44')]]){this[_0x6a45('0x9')][_0x364a68[_0x6a45('0x44')]]['attended']=!![];this[_0x6a45('0x9')][_0x364a68[_0x6a45('0x45')]]=this[_0x6a45('0x9')][_0x364a68[_0x6a45('0x44')]];delete this[_0x6a45('0x9')][_0x364a68[_0x6a45('0x44')]];}}else if(!_[_0x6a45('0x42')](this[_0x6a45('0x9')][_0x364a68[_0x6a45('0x45')]])){this['startAcw'](_0x364a68[_0x6a45('0x45')]);if(this[_0x6a45('0x9')][_0x364a68[_0x6a45('0x46')]]){this['channels'][_0x364a68[_0x6a45('0x46')]]['attended']=!![];this[_0x6a45('0x9')][_0x364a68[_0x6a45('0x43')]]=this['channels'][_0x364a68[_0x6a45('0x46')]];delete this[_0x6a45('0x9')][_0x364a68['origtransfereruniqueid']];}}}catch(_0x9da93b){logger[_0x6a45('0x1c')]('[ACW][syncAttendedTransfer]\x20%s',_0x9da93b['message']);}};Acw[_0x6a45('0x1e')][_0x6a45('0x47')]=function(_0x3e9d3a){try{if(this[_0x6a45('0x9')][_0x3e9d3a[_0x6a45('0x48')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x6a45('0x39')](_0x3e9d3a[_0x6a45('0x48')]));this['startAcw'](_0x3e9d3a[_0x6a45('0x48')]);}else if(this[_0x6a45('0x9')][_0x3e9d3a[_0x6a45('0x49')]]){logger[_0x6a45('0x29')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x6a45('0x39')](_0x3e9d3a[_0x6a45('0x49')]));this[_0x6a45('0x1f')](_0x3e9d3a[_0x6a45('0x49')]);}}catch(_0x3fc08f){logger[_0x6a45('0x1c')](_0x6a45('0x4a'),_0x3fc08f[_0x6a45('0x35')]);}};Acw[_0x6a45('0x1e')][_0x6a45('0x10')]=function(_0x403711){try{if(this[_0x6a45('0x6')][_0x403711[_0x6a45('0x21')]]&&this[_0x6a45('0x6')][_0x403711[_0x6a45('0x21')]][_0x6a45('0x4b')]===_0x6a45('0x4c')){if(this[_0x6a45('0x7')][_0x403711['interface']]){logger[_0x6a45('0x29')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x403711[_0x6a45('0x19')],_0x403711['interface'],_0x403711[_0x6a45('0x21')]);return RpcUser[_0x6a45('0x2e')](this[_0x6a45('0x7')][_0x403711[_0x6a45('0x20')]],_0x6a45('0x4d'),_0x403711[_0x6a45('0x19')]);}}}catch(_0x9cd01c){logger[_0x6a45('0x1c')](_0x6a45('0x4e'),_0x9cd01c['message']);}};module[_0x6a45('0x4f')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index bc2dc34..a733561 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 _0xa639=['actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionQueueSummary','catch','close','asterisk-manager','bluebird','util','../../config/logger','port','asterisk','username','password','keepConnected','promisify','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist'];(function(_0x5e9504,_0x113151){var _0x4115c2=function(_0xc906b3){while(--_0xc906b3){_0x5e9504['push'](_0x5e9504['shift']());}};_0x4115c2(++_0x113151);}(_0xa639,0x1a9));var _0x9a63=function(_0x57f4b5,_0x50dc69){_0x57f4b5=_0x57f4b5-0x0;var _0x398d8e=_0xa639[_0x57f4b5];return _0x398d8e;};'use strict';var Manager=require(_0x9a63('0x0'));var BPromise=require(_0x9a63('0x1'));var util=require(_0x9a63('0x2'));var logger=require(_0x9a63('0x3'))('ami');var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0x9a63('0x4')],config[_0x9a63('0x5')]['ip'],config['asterisk'][_0x9a63('0x6')],config[_0x9a63('0x5')][_0x9a63('0x7')],!![]);ami[_0x9a63('0x8')]();ami['Action']=BPromise[_0x9a63('0x9')](ami['action']);function error(_0x5154df){logger[_0x9a63('0xa')](util['format'](_0x9a63('0xb'),config['asterisk'][_0x9a63('0x6')],config[_0x9a63('0x5')]['ip'],config['asterisk']['port'],util['inspect'](_0x5154df,![],null)));}function close(){logger['error'](util[_0x9a63('0xc')](_0x9a63('0xd'),config[_0x9a63('0x5')][_0x9a63('0x6')],config[_0x9a63('0x5')]['ip'],config[_0x9a63('0x5')][_0x9a63('0x4')]));}ami[_0x9a63('0xe')]=function(){return function(){return ami[_0x9a63('0xf')]({'action':_0x9a63('0x10')});};};ami[_0x9a63('0x11')]=function(){return function(){return ami['Action']({'action':_0x9a63('0x12')});};};ami[_0x9a63('0x13')]=function(){return function(){return ami[_0x9a63('0xf')]({'action':_0x9a63('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x9a63('0xf')]({'action':_0x9a63('0x15')});};};ami[_0x9a63('0x16')]=function(){return function(){return ami[_0x9a63('0xf')]({'action':_0x9a63('0x17')});};};function connect(){logger[_0x9a63('0x18')](util['format'](_0x9a63('0x19'),config[_0x9a63('0x5')][_0x9a63('0x6')],config[_0x9a63('0x5')]['ip'],config[_0x9a63('0x5')]['port']));ami[_0x9a63('0x1a')](_0x9a63('0xa'),error);ami[_0x9a63('0x1a')]('close',close);}ami['on'](_0x9a63('0x1b'),connect);ami['on']('shutdown',function(_0x4a05e6){logger['info'](util['format'](_0x9a63('0x1c'),config['asterisk']['username'],config['asterisk']['ip'],config['asterisk'][_0x9a63('0x4')],util[_0x9a63('0x1d')](_0x4a05e6,![],null)));});ami['on'](_0x9a63('0x1e'),function(){logger['info'](util[_0x9a63('0xc')](_0x9a63('0x1f'),config[_0x9a63('0x5')]['username'],config[_0x9a63('0x5')]['ip'],config['asterisk'][_0x9a63('0x4')]));return Promise[_0x9a63('0x20')]()[_0x9a63('0x21')](ami['actionSipShowRegistry']())[_0x9a63('0x21')](ami['actionDeviceStateList']())[_0x9a63('0x21')](ami[_0x9a63('0x13')]())[_0x9a63('0x21')](ami[_0x9a63('0x22')]())[_0x9a63('0x21')](ami['actionCoreShowChannels']())[_0x9a63('0x23')](function(_0xfb0755){logger[_0x9a63('0xa')]('[ami.js][fullybooted]',util[_0x9a63('0x1d')](_0xfb0755,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami[_0x9a63('0x1a')](_0x9a63('0x24'),close);module['exports']=ami; \ No newline at end of file +var _0xa82c=['queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionQueueSummary','[ami.js][fullybooted]','once','exports','asterisk-manager','bluebird','util','ami','../../config/environment','asterisk','port','username','password','Action','promisify','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0x287d51,_0x46b59f){var _0x3709c7=function(_0x57180f){while(--_0x57180f){_0x287d51['push'](_0x287d51['shift']());}};_0x3709c7(++_0x46b59f);}(_0xa82c,0x172));var _0xca82=function(_0x3e965c,_0x2ac0a3){_0x3e965c=_0x3e965c-0x0;var _0x565600=_0xa82c[_0x3e965c];return _0x565600;};'use strict';var Manager=require(_0xca82('0x0'));var BPromise=require(_0xca82('0x1'));var util=require(_0xca82('0x2'));var logger=require('../../config/logger')(_0xca82('0x3'));var config=require(_0xca82('0x4'));var ami=new Manager(config[_0xca82('0x5')][_0xca82('0x6')],config['asterisk']['ip'],config['asterisk'][_0xca82('0x7')],config[_0xca82('0x5')][_0xca82('0x8')],!![]);ami['keepConnected']();ami[_0xca82('0x9')]=BPromise[_0xca82('0xa')](ami['action']);function error(_0x34c433){logger[_0xca82('0xb')](util['format'](_0xca82('0xc'),config[_0xca82('0x5')][_0xca82('0x7')],config['asterisk']['ip'],config['asterisk'][_0xca82('0x6')],util['inspect'](_0x34c433,![],null)));}function close(){logger[_0xca82('0xb')](util[_0xca82('0xd')](_0xca82('0xe'),config['asterisk']['username'],config[_0xca82('0x5')]['ip'],config[_0xca82('0x5')][_0xca82('0x6')]));}ami[_0xca82('0xf')]=function(){return function(){return ami[_0xca82('0x9')]({'action':_0xca82('0x10')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0xca82('0x11')});};};ami[_0xca82('0x12')]=function(){return function(){return ami[_0xca82('0x9')]({'action':_0xca82('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xca82('0x9')]({'action':_0xca82('0x14')});};};ami[_0xca82('0x15')]=function(){return function(){return ami[_0xca82('0x9')]({'action':_0xca82('0x16')});};};function connect(){logger[_0xca82('0x17')](util[_0xca82('0xd')](_0xca82('0x18'),config['asterisk'][_0xca82('0x7')],config[_0xca82('0x5')]['ip'],config[_0xca82('0x5')][_0xca82('0x6')]));ami['once'](_0xca82('0xb'),error);ami['once'](_0xca82('0x19'),close);}ami['on'](_0xca82('0x1a'),connect);ami['on'](_0xca82('0x1b'),function(_0x26fbde){logger[_0xca82('0x17')](util['format'](_0xca82('0x1c'),config[_0xca82('0x5')][_0xca82('0x7')],config['asterisk']['ip'],config['asterisk']['port'],util[_0xca82('0x1d')](_0x26fbde,![],null)));});ami['on'](_0xca82('0x1e'),function(){logger['info'](util[_0xca82('0xd')](_0xca82('0x1f'),config[_0xca82('0x5')][_0xca82('0x7')],config[_0xca82('0x5')]['ip'],config[_0xca82('0x5')][_0xca82('0x6')]));return Promise[_0xca82('0x20')]()[_0xca82('0x21')](ami['actionSipShowRegistry']())['then'](ami[_0xca82('0x22')]())[_0xca82('0x21')](ami[_0xca82('0x12')]())[_0xca82('0x21')](ami[_0xca82('0x23')]())[_0xca82('0x21')](ami[_0xca82('0x15')]())['catch'](function(_0x4b0e5){logger[_0xca82('0xb')](_0xca82('0x24'),util['inspect'](_0x4b0e5,{'showHidden':![],'depth':null}));});});ami[_0xca82('0x25')]('error',error);ami[_0xca82('0x25')]('close',close);module[_0xca82('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 2977ab6..a10b6e1 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xda3f,0xec));var _0xfda3=function(_0x1b1957,_0x545e09){_0x1b1957=_0x1b1957-0x0;var _0x24bd88=_0xda3f[_0x1b1957];return _0x24bd88;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5e8d3e,_0x18ed2e){_0x5e8d3e=_0x5e8d3e-0x0;var _0x1348c0=_0xcb91[_0x5e8d3e];return _0x1348c0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index dd74970..9b7232d 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 _0x5f48=['callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','Machine','buildObj','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialGlobalMaxRetry','reason19\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','Unknow','syncQueueSummary','queuesSummary','running','statusMessage','getQueueCampaignStatusMessage','inUse','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','syncQueueSummaryComplete','throttle','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','clearZombieChannels','[actions]','[Dialer][checkChannel]','getVoiceQueueRtPauses','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','getCaller','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','extractCalleridName','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','talking','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','loggedIn','predictiveIntervalPauses','busyFactor','erlangCallToSecond','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','Contact','[actionOriginate]\x20','checkIsBlackListIvr','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','abandonmentRate','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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[busyFactor]','Umin\x20=\x20','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','syncHangup','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','emit','debug','inspect','voice:queue:%s','name','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','---------------------------','merge','getSeconds','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','\x20NOT\x20Active','isIVRCampaign','format','campaign:save','sendMessageOneNotActive','INACTIVE','is\x20not\x20active','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','reachable','unmonitored','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTimeIntervals','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','push','Action','command','iftime\x20%s,%s','interval','content','true','catch','timezones','indexOf','all','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaignActive','resolve','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','intervalIftime','OVERTIME_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','type','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','uniqueid','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','additional','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','callAdditionalPhoneAfterMin','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','actionid','strategy','rrmemory','roundrobin','isNil','paused','stateinterface','locked','idHopper','status','CampaignId','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','Success'];(function(_0xd9b0f7,_0x4e91d3){var _0x259786=function(_0x5367fc){while(--_0x5367fc){_0xd9b0f7['push'](_0xd9b0f7['shift']());}};_0x259786(++_0x4e91d3);}(_0x5f48,0x115));var _0x85f4=function(_0x17a05a,_0x5682d8){_0x17a05a=_0x17a05a-0x0;var _0x34e538=_0x5f48[_0x17a05a];return _0x34e538;};'use strict';var util=require(_0x85f4('0x0'));var _=require(_0x85f4('0x1'));var uuid=require(_0x85f4('0x2'));var moment=require(_0x85f4('0x3'));var rr=require('rr');var Redis=require(_0x85f4('0x4'));var utils=require(_0x85f4('0x5'));var hopperUtils=require(_0x85f4('0x6'));var ut=require(_0x85f4('0x7'));var config=require(_0x85f4('0x8'));var logger=require(_0x85f4('0x9'))(_0x85f4('0xa'));var loggerBooked=require(_0x85f4('0x9'))(_0x85f4('0xb'));var loggerPredictive=require(_0x85f4('0x9'))(_0x85f4('0xc'));var loggerPredictiveCalls=require('../../../config/logger')(_0x85f4('0xd'));var loggerSyncQueueSummary=require(_0x85f4('0x9'))('syncQueueSummary');var ami=require(_0x85f4('0xe'));config[_0x85f4('0xf')]=_[_0x85f4('0x10')](config[_0x85f4('0xf')],{'host':_0x85f4('0x11'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x85f4('0xf')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Interval=require(_0x85f4('0x12'));var Action=require(_0x85f4('0x13'));var History=require(_0x85f4('0x14'));var Final=require(_0x85f4('0x15'));var AgentComplete=require(_0x85f4('0x16'));var QueueCallerAbandon=require(_0x85f4('0x17'));var Hangup=require(_0x85f4('0x18'));var ipAgi=process[_0x85f4('0x19')]['XCALLY_IP_AGI']||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x85f4('0x1a')][_0x85f4('0x1b')]=function(_0x22aac3){this[_0x85f4('0x1c')]=this[_0x85f4('0x1c')]?this[_0x85f4('0x1c')][_0x85f4('0x1d')](_0x22aac3):_0x22aac3();};function Dialer(_0x56c001,_0x129a3e){this['sequence']=new Sequence();this[_0x85f4('0x1e')]=_0x129a3e;this['voiceQueues']=_0x56c001[_0x85f4('0x1f')];this[_0x85f4('0x20')]=_0x56c001[_0x85f4('0x20')];this[_0x85f4('0x21')]=_0x56c001[_0x85f4('0x21')];this[_0x85f4('0x22')]=_0x56c001['trunks'];this[_0x85f4('0x23')]=config[_0x85f4('0x23')]||0x2;this['channels']={};this[_0x85f4('0x24')]={};this[_0x85f4('0x25')]={};this[_0x85f4('0x26')]={};this[_0x85f4('0x27')]={};this[_0x85f4('0x28')]={};this[_0x85f4('0x29')]={};this[_0x85f4('0x2a')]={};this[_0x85f4('0x2b')]={};this[_0x85f4('0x2c')]={};this['queuesSummary']={};ami['on'](_0x85f4('0x2d'),this[_0x85f4('0x2e')][_0x85f4('0x2f')](this));ami['on'](_0x85f4('0x30'),this['syncQueueCallerAbandon'][_0x85f4('0x2f')](this));ami['on']('originateresponse',this[_0x85f4('0x31')]['bind'](this));ami['on'](_0x85f4('0x32'),this[_0x85f4('0x33')][_0x85f4('0x2f')](this));ami['on'](_0x85f4('0x34'),this['syncQueueSummary']['bind'](this));ami['on'](_0x85f4('0x35'),this['syncQueueSummaryComplete'][_0x85f4('0x2f')](this));ami['on'](_0x85f4('0x36'),this[_0x85f4('0x37')]['bind'](this));ami['on']('newexten',this[_0x85f4('0x38')]['bind'](this));ami['on'](_0x85f4('0x39'),this['syncVarSet'][_0x85f4('0x2f')](this));ami['on'](_0x85f4('0x3a'),this[_0x85f4('0x3b')][_0x85f4('0x2f')](this));ami['on'](_0x85f4('0x3c'),this['syncQueueStatusComplete'][_0x85f4('0x2f')](this));this[_0x85f4('0x3d')]();this[_0x85f4('0x3e')]();RpcSetting[_0x85f4('0x3f')]()[_0x85f4('0x40')](function(_0x19fc64){previewRecallmeReminderInterval=_0x19fc64['previewRecallmeReminderInterval'];});}function isNotNull(_0x10b872){return _0x10b872!==null&&!_[_0x85f4('0x41')](_0x10b872);}function msgResponse(_0xf5b84e,_0x182360,_0x2915eb){return{'action':_0xf5b84e,'response':_0x182360,'message':_0x2915eb,'stack':_0x2915eb};}function emit(_0x3dfb99,_0x5f4b2c,_0x16a27a){io['to'](_0x3dfb99)[_0x85f4('0x42')](_0x5f4b2c,_0x16a27a);}function emitOutboundVoiceQueueSummary(_0x48c314){if(_0x48c314['type']==='outbound'){logger[_0x85f4('0x43')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x85f4('0x44')](_0x48c314,{'showHidden':![],'depth':null}));emit(util['format'](_0x85f4('0x45'),_0x48c314[_0x85f4('0x46')]),'voice_queue:save',_0x48c314);}}function checkGetDataPredictive(_0x5502bb){if(isNotNull(_0x5502bb)&&!_[_0x85f4('0x47')](_0x5502bb)){loggerPredictive['info'](_0x85f4('0x48'));loggerPredictive[_0x85f4('0x49')](_0x85f4('0x4a'),_0x5502bb[_0x85f4('0x4b')]);loggerPredictive[_0x85f4('0x49')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5502bb['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x85f4('0x4c'),_0x5502bb[_0x85f4('0x4d')]);loggerPredictive[_0x85f4('0x49')](_0x85f4('0x4e'),_0x5502bb['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x85f4('0x49')](_0x85f4('0x4f'),_0x5502bb[_0x85f4('0x50')]);loggerPredictive[_0x85f4('0x49')](_0x85f4('0x51'),_0x5502bb[_0x85f4('0x52')]);loggerPredictive[_0x85f4('0x49')]('---------------------------');if(_0x5502bb['predictiveIntervalTotalCalls']>0x0){if(!_[_0x85f4('0x41')](_0x5502bb[_0x85f4('0x52')])&&_0x5502bb[_0x85f4('0x52')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x85f4('0x41')](_0x5502bb[_0x85f4('0x50')])&&_0x5502bb[_0x85f4('0x50')]>0x0){return!![];}loggerPredictive[_0x85f4('0x49')](_0x85f4('0x53'));}else{loggerPredictive[_0x85f4('0x49')](_0x85f4('0x54'));}}else{loggerPredictive[_0x85f4('0x49')](_0x85f4('0x55'));}return![];}function mergeDataErlangB(_0x3a31ca){return function(_0x127bf5){loggerPredictive[_0x85f4('0x49')](_0x85f4('0x56'));loggerPredictive[_0x85f4('0x49')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x127bf5[_0x85f4('0x57')]);loggerPredictive[_0x85f4('0x49')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x127bf5['erlangCallToSecond']);loggerPredictive['info'](_0x85f4('0x58'),_0x127bf5[_0x85f4('0x59')]);loggerPredictive[_0x85f4('0x49')](_0x85f4('0x5a'),_0x127bf5[_0x85f4('0x5b')]);loggerPredictive[_0x85f4('0x49')](_0x85f4('0x58'),_0x127bf5['erlangAbandonmentRate']);loggerPredictive[_0x85f4('0x49')](_0x85f4('0x5c'));_[_0x85f4('0x5d')](_0x3a31ca,_0x127bf5);};}function ifInterval(_0xa19b19,_0x78a38e){if(_[_0x85f4('0x41')](_0x78a38e)){return![];}return utils[_0x85f4('0x5e')](undefined,_0x78a38e)<_0xa19b19*0x3c;}function clearPredictiveAttributes(_0x1c3598){if(_0x1c3598[_0x85f4('0x29')]){_0x1c3598[_0x85f4('0x29')]=undefined;loggerPredictive[_0x85f4('0x43')](_0x1c3598[_0x85f4('0x46')],'startProgressive\x20value\x20cleared');}if(_0x1c3598[_0x85f4('0x28')]){_0x1c3598['startPredictive']=undefined;loggerPredictive[_0x85f4('0x43')](_0x1c3598[_0x85f4('0x46')],_0x85f4('0x5f'));}if(_0x1c3598[_0x85f4('0x60')]){clearInterval(_0x1c3598['handlePredictive']);_0x1c3598[_0x85f4('0x60')]=undefined;loggerPredictive[_0x85f4('0x43')](_0x1c3598[_0x85f4('0x46')],_0x85f4('0x61'));}}function loggerCatchPredictive(_0x9e8d06,_0x24c130){return function(_0x4fa570){loggerPredictive[_0x85f4('0x62')](_0x24c130[_0x85f4('0x46')],_0x9e8d06);loggerPredictive[_0x85f4('0x62')](_0x4fa570[_0x85f4('0x63')]);clearPredictiveAttributes(_0x24c130);};}function loggerCatch(_0x7e1693){return function(_0x27cf19){logger['error'](_0x7e1693,util[_0x85f4('0x44')](_0x27cf19,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x2ea5c1,_0xe9d538,_0x1b3077){return function(_0x4ca114){utils[_0x85f4('0x64')](_0xe9d538,_0x1b3077,0x0);_0xe9d538[_0x85f4('0x65')]=0x0;logger[_0x85f4('0x62')](_0x2ea5c1,util[_0x85f4('0x44')](_0x4ca114,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5c4ffe){return function(_0xbcddef){if(isNotNull(_0xbcddef)&&isNotNull(_0xbcddef[0x0])){if(_0xbcddef[0x0][_0x85f4('0x66')]>0x0){_0x5c4ffe['message']=utils[_0x85f4('0x67')][_0x85f4('0x68')];logger[_0x85f4('0x49')](_0x85f4('0x69')+_0x5c4ffe[_0x85f4('0x46')],_0xbcddef[0x0][_0x85f4('0x66')],_0x85f4('0x6a'));}else{_0x5c4ffe[_0x85f4('0x6b')]=utils[_0x85f4('0x67')][_0x85f4('0x6c')];logger[_0x85f4('0x49')]('[getContactDialer2][Empty]'+_0x5c4ffe['name']);}}};}function createObjHistory(_0x8f857e,_0x401d50,_0x4632bf,_0x189054,_0xc6b50){_0x8f857e[_0x85f4('0x6b')]=_0x4632bf;var _0x25c7ed=new Action(_0x8f857e,_0x401d50);var _0x3573b2=new History(_0x25c7ed);_0x3573b2[_0x85f4('0x6d')]=_0x189054;_0x3573b2[_0x85f4('0x6e')]=_0xc6b50;_0x3573b2[_0x85f4('0x6f')]=_0x25c7ed[_0x85f4('0x70')];return _0x3573b2;}function unlockQueueStatus(_0x368683,_0x242c54){setTimeout(function(){if(_[_0x85f4('0x41')](_0x368683[_0x85f4('0x71')])){loggerBooked['error'](_0x85f4('0x72'),_0x242c54);}_0x368683[_0x85f4('0x71')]=!![];loggerBooked[_0x85f4('0x49')](_0x85f4('0x73'),_0x242c54,JSON[_0x85f4('0x74')](_[_0x85f4('0x75')](_0x368683,['name',_0x85f4('0x71')])));},0x1f3);}function checkInterval(_0x4e326f){return function(){if(!isNotNull(_0x4e326f['Interval'])){_0x4e326f[_0x85f4('0x6b')]=utils[_0x85f4('0x67')][_0x85f4('0x76')];throw _0x4e326f['name']+_0x85f4('0x77');}if(!isNotNull(_0x4e326f[_0x85f4('0x78')][_0x85f4('0x79')])){_0x4e326f['message']=utils[_0x85f4('0x67')][_0x85f4('0x76')];throw _0x4e326f[_0x85f4('0x46')]+_0x85f4('0x77');}if(!isNotNull(_['isEmpty'](_0x4e326f[_0x85f4('0x78')][_0x85f4('0x79')]))){_0x4e326f[_0x85f4('0x6b')]=utils['CAMPAIGN_STATUS'][_0x85f4('0x76')];throw _0x4e326f['name']+_0x85f4('0x77');}};}function checkIsIVRCampaignActive(_0x3a2058){return function(){if(!utils['isIVRCampaignActive'](_0x3a2058)){_0x3a2058[_0x85f4('0x6b')]=utils[_0x85f4('0x67')]['INACTIVE'];throw _0x3a2058[_0x85f4('0x46')]+_0x85f4('0x7a');}};}function emitCampaignSummary(_0x2c4bee){if(utils[_0x85f4('0x7b')](_0x2c4bee)){emit(util[_0x85f4('0x7c')]('campaign:ivr:%s',_0x2c4bee[_0x85f4('0x46')]),_0x85f4('0x7d'),_0x2c4bee);}}function loggerCatchQueueSummary(_0x61009a,_0x5a3cbc){return function(_0x5d64c6){clearPredictiveAttributes(_0x5a3cbc);emitCampaignSummary(_0x5a3cbc);loggerSyncQueueSummary['debug'](_0x61009a,util[_0x85f4('0x44')](_0x5d64c6,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x587812){if(_0x587812[_0x85f4('0x7e')]){if(_0x587812['originated']===0x0){_0x587812[_0x85f4('0x7e')]=![];_0x587812[_0x85f4('0x6b')]=utils[_0x85f4('0x67')][_0x85f4('0x7f')];loggerSyncQueueSummary[_0x85f4('0x43')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x587812[_0x85f4('0x46')],_0x85f4('0x80'));}else{_0x587812[_0x85f4('0x6b')]=utils[_0x85f4('0x67')]['DISACTIVED'];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x587812[_0x85f4('0x46')],_0x85f4('0x81'));}emitCampaignSummary(_0x587812);}}function myreject(_0x58ebb7){return function(_0x121db3){return _0x58ebb7(msgResponse(_0x85f4('0x82'),_0x85f4('0x83'),JSON[_0x85f4('0x74')](_0x121db3)));};}Dialer[_0x85f4('0x1a')][_0x85f4('0x84')]=function(_0x2c7a85){return!_[_0x85f4('0x41')](_0x2c7a85)&&_0x2c7a85&&!_[_0x85f4('0x41')](_0x2c7a85['name'])&&!_[_0x85f4('0x41')](_0x2c7a85[_0x85f4('0x85')])&&_0x2c7a85['active']&&(this['trunks'][util[_0x85f4('0x7c')](_0x85f4('0x86'),_0x2c7a85[_0x85f4('0x46')])]['status']===_0x85f4('0x87')||this[_0x85f4('0x22')][util[_0x85f4('0x7c')](_0x85f4('0x86'),_0x2c7a85[_0x85f4('0x46')])]['status']===_0x85f4('0x88'));};Dialer[_0x85f4('0x1a')]['checkIsTrunkReachable']=function(_0x4ba04d){var _0xb78cfa=this;return function(){if(!_0xb78cfa[_0x85f4('0x84')](_0x4ba04d['Trunk'])){if(!_0xb78cfa[_0x85f4('0x84')](_0x4ba04d[_0x85f4('0x89')])){_0x4ba04d[_0x85f4('0x6b')]=utils[_0x85f4('0x67')][_0x85f4('0x8a')];throw _0x4ba04d[_0x85f4('0x46')]+_0x85f4('0x8b');}}};};Dialer['prototype']['checkIfTime']=function(_0x1366ec,_0x266dba,_0x513fcc,_0x45e4ac){var _0x8c0d59=this;return function(){var _0x27c0ca=!![];return _0x8c0d59['ifTimeIvr'](_0x1366ec,_0x266dba,_0x513fcc,_0x45e4ac,_0x27c0ca);};};Dialer[_0x85f4('0x1a')][_0x85f4('0x8c')]=function(_0x445dff,_0x36643d,_0x4117d6,_0x3505a9){var _0x17fca0=this;return function(){var _0x14788a=![];return _0x17fca0['ifTimeIvr'](_0x445dff[_0x85f4('0x79')],_0x36643d,_0x4117d6,_0x3505a9,_0x14788a);};};Dialer[_0x85f4('0x1a')]['ifTimeIvr']=function(_0x54cfb9,_0x10e7c9,_0x503192,_0x1b79f5,_0x399905){var _0x3e77ac=[];return new Promise(function(_0x890c20,_0x45edc6){if(!isNotNull(_0x54cfb9)){_0x1b79f5[_0x85f4('0x6b')]=utils[_0x85f4('0x67')][_0x85f4('0x76')];return _0x45edc6(msgResponse(_0x85f4('0x8d'),_0x85f4('0x8e'),_0x503192+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x85f4('0x47')](_0x54cfb9)){_0x1b79f5[_0x85f4('0x6b')]=utils[_0x85f4('0x67')][_0x85f4('0x8f')];return _0x45edc6(msgResponse(_0x85f4('0x8d'),_0x85f4('0x8e'),_0x503192+_0x85f4('0x90')));}if(_0x10e7c9&&_[_0x85f4('0x41')](config['timezones'][_0x10e7c9])){_0x1b79f5[_0x85f4('0x6b')]=utils[_0x85f4('0x67')][_0x85f4('0x91')];return _0x45edc6(msgResponse(_0x85f4('0x8d'),'Failure',_0x503192+_0x85f4('0x92')+_0x10e7c9));}if(_[_0x85f4('0x93')](_0x54cfb9)){for(var _0x222b9e=0x0;_0x222b9e<_0x54cfb9['length'];_0x222b9e+=0x1){_0x3e77ac[_0x85f4('0x94')](ami[_0x85f4('0x95')]({'action':_0x85f4('0x96'),'command':util['format'](_0x85f4('0x97'),_0x54cfb9[_0x222b9e][_0x85f4('0x98')],!_[_0x85f4('0x41')](config['timezones'][_0x10e7c9])?_0x10e7c9:'')})[_0x85f4('0x40')](function(_0x103f5f){return _0x103f5f[_0x85f4('0x99')]['indexOf'](_0x85f4('0x9a'))>=0x0;})[_0x85f4('0x9b')](myreject(_0x45edc6)));}}else{_0x3e77ac[_0x85f4('0x94')](ami[_0x85f4('0x95')]({'action':'command','command':util[_0x85f4('0x7c')](_0x85f4('0x97'),_0x54cfb9,!_[_0x85f4('0x41')](config[_0x85f4('0x9c')][_0x10e7c9])?_0x10e7c9:'')})['then'](function(_0x52816d){return _0x52816d['content'][_0x85f4('0x9d')]('true')>=0x0;})['catch'](myreject(_0x45edc6)));}Promise[_0x85f4('0x9e')](_0x3e77ac)[_0x85f4('0x40')](function(_0x304ac0){var _0x209686=_[_0x85f4('0x9f')](_0x304ac0);if(_0x209686){return _0x890c20(_0x209686);}else{_0x1b79f5['message']=_0x399905?utils[_0x85f4('0x67')][_0x85f4('0xa0')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];return _0x45edc6(msgResponse(_0x85f4('0xa1'),_0x85f4('0x8e'),_0x85f4('0xa2')+_0x399905+'\x20'+_0x503192+_0x85f4('0xa3')+util[_0x85f4('0x44')](_0x54cfb9,{'showHidden':![],'depth':null})+_0x85f4('0xa4')+_0x10e7c9));}})[_0x85f4('0x9b')](function(_0x578f85){return _0x45edc6(msgResponse(_0x85f4('0x8d'),_0x85f4('0x8e'),JSON[_0x85f4('0x74')](_0x578f85)));});});};Dialer[_0x85f4('0x1a')][_0x85f4('0x3d')]=function(){var _0x12c424=this;return cmHopper[_0x85f4('0xa5')]({'active':![]},{'where':{'active':!![]}})[_0x85f4('0x40')](function(){setInterval(function(){_0x12c424[_0x85f4('0xa6')]();},0x3e8);});};Dialer[_0x85f4('0x1a')][_0x85f4('0xa6')]=function(){var _0x1f50d7=this;var _0x31d042;for(var _0x2452f3 in this[_0x85f4('0x20')]){if(typeof this[_0x85f4('0x20')][_0x2452f3]!==_0x85f4('0xa7')){_0x31d042=this[_0x85f4('0x20')][_0x2452f3];if(utils[_0x85f4('0x7b')](_0x31d042)&&utils[_0x85f4('0xa8')](_0x31d042)){_0x31d042['sendMessageOneNotActive']=!![];Promise[_0x85f4('0xa9')]()[_0x85f4('0x40')](checkIsIVRCampaignActive(_0x31d042))['then'](checkInterval(_0x31d042))[_0x85f4('0x40')](_0x1f50d7[_0x85f4('0xaa')](_0x31d042))[_0x85f4('0x40')](_0x1f50d7['checkIfTime'](_0x31d042[_0x85f4('0xab')],_0x31d042[_0x85f4('0xac')],_0x31d042['name'],_0x31d042))[_0x85f4('0x40')](_0x1f50d7['checkIfTimeIntervals'](_0x31d042[_0x85f4('0x78')],_0x31d042[_0x85f4('0xac')],_0x31d042[_0x85f4('0x46')],_0x31d042))[_0x85f4('0x40')](_0x1f50d7[_0x85f4('0xad')](_0x31d042))[_0x85f4('0x9b')](loggerCatchQueueSummary(_0x85f4('0xae'),_0x31d042));}else{notSendMessagesCampaign(_0x31d042);}}}};Dialer[_0x85f4('0x1a')][_0x85f4('0xaf')]=function(_0x5d4646){if(_0x5d4646['dialMethod']!==_0x85f4('0xc')){clearPredictiveAttributes(_0x5d4646);}switch(_0x5d4646[_0x85f4('0xb0')]){case _0x85f4('0xb1'):this['handlePower'](_0x5d4646,0x1);break;case'power':this[_0x85f4('0xb2')](_0x5d4646,_0x5d4646['dialPowerLevel']);break;case _0x85f4('0xc'):this[_0x85f4('0xc')](_0x5d4646);break;case'booked':this[_0x85f4('0xb2')](_0x5d4646,0x1);break;default:logger[_0x85f4('0x62')](_0x85f4('0xb3'),_0x5d4646[_0x85f4('0x46')],_0x85f4('0xb4'));}};Dialer[_0x85f4('0x1a')][_0x85f4('0x8d')]=function(_0xc1ac2b,_0x541234){var _0x2ffe3a=_0xc1ac2b['dialTimezone'];var _0x497320=_0x541234?_0xc1ac2b[_0x85f4('0xab')]:_0xc1ac2b[_0x85f4('0x78')]['Intervals'];logger[_0x85f4('0xb5')](_0x85f4('0xb6'),_0x497320,_0x2ffe3a,_0xc1ac2b[_0x85f4('0x46')],util[_0x85f4('0x7c')]('Voice\x20Queue\x20%s\x20$s',_0xc1ac2b['name'],_0xc1ac2b['id']));var _0x5beb7c=null;return Interval[_0x85f4('0xb7')](_0x497320,_0x2ffe3a)[_0x85f4('0x40')](function(_0x4ac899){if(_0x4ac899===!![]){return _0x4ac899;}else{_0xc1ac2b[_0x85f4('0x6b')]=_0x541234?utils[_0x85f4('0x67')][_0x85f4('0xa0')]:utils[_0x85f4('0x67')][_0x85f4('0xb8')];_0x5beb7c=msgResponse(_0x85f4('0xa1'),_0x85f4('0x8e'),_0x85f4('0xa2')+_0x541234+'\x20'+_0xc1ac2b[_0x85f4('0x46')]+_0x85f4('0xa3')+util['inspect'](_0x497320,{'showHidden':![],'depth':null})+_0x85f4('0xa4')+_0x2ffe3a);}if(_0x5beb7c!==null){logger[_0x85f4('0xb5')](_0x85f4('0xb9'),_0x5beb7c);_0x5beb7c[_0x85f4('0xba')]=_0x541234;throw _0x5beb7c;}})[_0x85f4('0x9b')](function(_0x1ecdd0){logger[_0x85f4('0x62')](_0x85f4('0xbb'),_0x1ecdd0);throw msgResponse(_0x85f4('0x82'),_0x85f4('0x83'),util['inspect'](_0x1ecdd0,{'showHidden':![],'depth':null}));});};Dialer[_0x85f4('0x1a')][_0x85f4('0x2e')]=function(_0x351300){if(this[_0x85f4('0x1f')][_0x351300[_0x85f4('0xbc')]]){if(this[_0x85f4('0x26')][_0x351300['uniqueid']]&&this[_0x85f4('0x26')][_0x351300['uniqueid']][_0x85f4('0xbd')]!==_0x85f4('0xbe')){this[_0x85f4('0xbf')](this[_0x85f4('0x1f')][_0x351300[_0x85f4('0xbc')]]);this[_0x85f4('0x26')][_0x351300['uniqueid']][_0x85f4('0xc0')]=moment()[_0x85f4('0x7c')](_0x85f4('0xc1'));}}};Dialer[_0x85f4('0x1a')][_0x85f4('0x33')]=function(_0x15b023){var _0x449dbb=this[_0x85f4('0x26')][_0x15b023[_0x85f4('0xc2')]];if(this['voiceQueues'][_0x15b023[_0x85f4('0xbc')]]){if(_0x449dbb&&_0x449dbb['type']!==_0x85f4('0xbe')){delete this[_0x85f4('0x26')][_0x15b023[_0x85f4('0xc2')]];this['voiceQueues'][_0x15b023['queue']][_0x85f4('0xc3')]+=0x1;var _0x423f5b=new AgentComplete(_0x449dbb,_0x15b023);if(_0x15b023[_0x85f4('0xc4')]===_0x85f4('0xc5')){_0x423f5b[_0x85f4('0xc6')]=this['voiceQueues'][_0x15b023[_0x85f4('0xbc')]][_0x85f4('0xc7')]&&this[_0x85f4('0x1f')][_0x15b023[_0x85f4('0xbc')]]['dialAgiAfterHangupAgent']?moment()['format'](_0x85f4('0xc1')):undefined;}hopperUtils[_0x85f4('0xc8')](_0x423f5b)[_0x85f4('0x9b')](loggerCatch(_0x85f4('0xc9')));hopperUtils[_0x85f4('0xca')](_0x423f5b)['catch'](loggerCatch(_0x85f4('0xcb')));}}};Dialer[_0x85f4('0x1a')]['syncQueueCallerAbandon']=function(_0x4c62cc){var _0x40d0f5=this[_0x85f4('0x26')][_0x4c62cc['uniqueid']];var _0x464fae=this;var _0x1bd617=![];var _0x3a9c5c;var _0x279806;if(this[_0x85f4('0x1f')][_0x4c62cc[_0x85f4('0xbc')]]){if(_0x40d0f5&&_0x40d0f5['type']!==_0x85f4('0xbe')){delete this[_0x85f4('0x26')][_0x4c62cc[_0x85f4('0xc2')]];this[_0x85f4('0xbf')](this['voiceQueues'][_0x4c62cc[_0x85f4('0xbc')]]);_0x40d0f5[_0x85f4('0xcc')]=moment()[_0x85f4('0x7c')](_0x85f4('0xc1'));var _0x21ff54=new QueueCallerAbandon(_0x40d0f5,_0x4c62cc);if(utils[_0x85f4('0x5e')](_0x40d0f5[_0x85f4('0xcc')],_0x40d0f5[_0x85f4('0xcd')])>=_0x40d0f5[_0x85f4('0xce')]){this['voiceQueues'][_0x4c62cc[_0x85f4('0xbc')]][_0x85f4('0x4d')]+=0x1;this[_0x85f4('0x1f')][_0x4c62cc['queue']][_0x85f4('0xcf')]+=0x1;this[_0x85f4('0x1f')][_0x4c62cc[_0x85f4('0xbc')]][_0x85f4('0xd0')]+=0x1;_0x21ff54[_0x85f4('0x6d')]=0xa;_0x21ff54[_0x85f4('0x6e')]=_0x85f4('0xd1');_0x21ff54[_0x85f4('0xd2')]=_0x85f4('0xd3');_0x21ff54['agiafterat']=this['voiceQueues'][_0x4c62cc[_0x85f4('0xbc')]][_0x85f4('0xc7')]?moment()[_0x85f4('0x7c')](_0x85f4('0xc1')):undefined;_0x21ff54[_0x85f4('0xd4')]+=0x1;_0x21ff54[_0x85f4('0xd5')]+=0x1;_0x3a9c5c=this[_0x85f4('0x1f')][_0x4c62cc['queue']][_0x85f4('0xd6')];_0x279806=this['voiceQueues'][_0x4c62cc[_0x85f4('0xbc')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x85f4('0xd7')](_0x21ff54,_0x21ff54[_0x85f4('0x6d')],_0x40d0f5['voiceQueue'])[_0x85f4('0x40')](function(_0xae6ee7){_0x1bd617=_0xae6ee7[_0x85f4('0xd8')]==0x1;if(_0x21ff54['countdropretry']>=_0x464fae[_0x85f4('0x1f')][_0x4c62cc[_0x85f4('0xbc')]]['dialDropMaxRetry']){_0x464fae[_0x85f4('0xd9')](_0x21ff54,_0xae6ee7['additional']);}else{hopperUtils[_0x85f4('0xda')]({'active':![],'countdropretry':_0x21ff54[_0x85f4('0xd4')],'scheduledat':moment()[_0x85f4('0xdb')](_0x464fae[_0x85f4('0x1f')][_0x4c62cc['queue']][_0x85f4('0xd6')],_0x85f4('0xdc'))[_0x85f4('0x7c')](_0x85f4('0xc1')),'ContactId':_0x40d0f5[_0x85f4('0xdd')],'ListId':_0x40d0f5[_0x85f4('0xde')],'VoiceQueueId':_0x40d0f5[_0x85f4('0xdf')]||undefined,'CampaignId':_0x40d0f5['CampaignId']||undefined})[_0x85f4('0x9b')](loggerCatch(_0x85f4('0xe0')));var _0xcbbba0=new History(_0x21ff54);_0xcbbba0[_0x85f4('0x6d')]=0xa;_0xcbbba0[_0x85f4('0x6e')]=_0x85f4('0xd1');_0xcbbba0[_0x85f4('0x70')]=moment()[_0x85f4('0x7c')](_0x85f4('0xc1'));_0xcbbba0['endtime']=_0xcbbba0['starttime'];_0xcbbba0['calleridname']=_0x21ff54[_0x85f4('0xe1')];_0xcbbba0[_0x85f4('0xe2')]=_0x21ff54['calleridnum'];hopperUtils[_0x85f4('0xc8')](_0xcbbba0)[_0x85f4('0x9b')](loggerCatch(_0x85f4('0xe3')));}})[_0x85f4('0x40')](function(){if(_0x1bd617)hopperUtils['swapAdditionalPhones'](_0x21ff54,_0x3a9c5c,_0x279806)['then'](function(){return 0x1;});});}else{this[_0x85f4('0x1f')][_0x4c62cc[_0x85f4('0xbc')]][_0x85f4('0xe4')]+=0x1;this[_0x85f4('0x1f')][_0x4c62cc[_0x85f4('0xbc')]][_0x85f4('0xe5')]+=0x1;_0x21ff54['state']=0xb;_0x21ff54[_0x85f4('0x6e')]=_0x85f4('0xe6');_0x21ff54[_0x85f4('0xd2')]='CALLEREXIT';_0x21ff54[_0x85f4('0xe7')]+=0x1;_0x21ff54[_0x85f4('0xd5')]+=0x1;_0x3a9c5c=this[_0x85f4('0x1f')][_0x4c62cc['queue']]['dialAbandonedRetryFrequency'];_0x279806=this[_0x85f4('0x1f')][_0x4c62cc[_0x85f4('0xbc')]][_0x85f4('0xe8')];hopperUtils[_0x85f4('0xd7')](_0x21ff54,_0x21ff54['state'],_0x40d0f5['voiceQueue'])[_0x85f4('0x40')](function(_0x1f4e33){if(_0x21ff54[_0x85f4('0xe7')]>=_0x464fae[_0x85f4('0x1f')][_0x4c62cc['queue']]['dialAbandonedMaxRetry']){_0x464fae[_0x85f4('0xd9')](_0x21ff54,_0x1f4e33['additional']);}else{hopperUtils[_0x85f4('0xda')]({'active':![],'countabandonedretry':_0x21ff54[_0x85f4('0xe7')],'scheduledat':moment()[_0x85f4('0xdb')](_0x464fae['voiceQueues'][_0x4c62cc['queue']][_0x85f4('0xe9')],_0x85f4('0xdc'))[_0x85f4('0x7c')](_0x85f4('0xc1')),'ContactId':_0x40d0f5[_0x85f4('0xdd')],'ListId':_0x40d0f5[_0x85f4('0xde')],'VoiceQueueId':_0x40d0f5[_0x85f4('0xdf')]||undefined,'CampaignId':_0x40d0f5['CampaignId']||undefined})[_0x85f4('0x9b')](loggerCatch(_0x85f4('0xea')));var _0x249969=new History(_0x21ff54);_0x249969[_0x85f4('0x6d')]=0xb;_0x249969[_0x85f4('0x6e')]=_0x85f4('0xe6');_0x249969['starttime']=moment()[_0x85f4('0x7c')](_0x85f4('0xc1'));_0x249969[_0x85f4('0x6f')]=_0x249969[_0x85f4('0x70')];_0x249969[_0x85f4('0xe1')]=_0x21ff54[_0x85f4('0xe1')];_0x249969[_0x85f4('0xe2')]=_0x21ff54['calleridnum'];hopperUtils[_0x85f4('0xc8')](_0x249969)[_0x85f4('0x9b')](loggerCatch(_0x85f4('0xeb')));}})[_0x85f4('0x40')](function(){if(_0x1bd617)hopperUtils[_0x85f4('0xec')](_0x21ff54,_0x3a9c5c,_0x279806)[_0x85f4('0x40')](function(){return 0x1;});});}}}};Dialer[_0x85f4('0x1a')]['syncNewExten']=function(_0x5374a8){if(this[_0x85f4('0x24')][_0x5374a8[_0x85f4('0xc2')]]){this[_0x85f4('0x24')][_0x5374a8[_0x85f4('0xc2')]][_0x85f4('0xed')]=_0x5374a8[_0x85f4('0xed')];}if(this[_0x85f4('0x26')][_0x5374a8[_0x85f4('0xc2')]]){this[_0x85f4('0x26')][_0x5374a8['uniqueid']][_0x85f4('0xed')]=_0x5374a8[_0x85f4('0xed')];}};Dialer[_0x85f4('0x1a')][_0x85f4('0x3b')]=function(_0x57064c){if(!this['actions'][_0x57064c['actionid']]){return;}var _0xd26a42=this[_0x85f4('0x1f')][this[_0x85f4('0x24')][_0x57064c[_0x85f4('0xee')]][_0x85f4('0xbc')]][_0x85f4('0xef')]||_0x85f4('0xf0');if(_0xd26a42===_0x85f4('0xf1')){if(this[_0x85f4('0x24')][_0x57064c[_0x85f4('0xee')]]&&_[_0x85f4('0xf2')](this['actions'][_0x57064c[_0x85f4('0xee')]]['locked'])&&_0x57064c['status']==='1'&&_0x57064c[_0x85f4('0xf3')]==='0'){if(this[_0x85f4('0x21')][_0x57064c[_0x85f4('0xf4')]]){if(!this[_0x85f4('0x21')][_0x57064c[_0x85f4('0xf4')]]['locked']){this['agents'][_0x57064c[_0x85f4('0xf4')]][_0x85f4('0xf5')]=!![];this[_0x85f4('0x24')][_0x57064c[_0x85f4('0xee')]][_0x85f4('0xf5')]=!![];this[_0x85f4('0x24')][_0x57064c[_0x85f4('0xee')]][_0x85f4('0xf4')]=_0x57064c['stateinterface'];}}}}else if(_0xd26a42===_0x85f4('0xf0')){if(this[_0x85f4('0x24')][_0x57064c[_0x85f4('0xee')]]){if(this['agents'][_0x57064c['stateinterface']]){this[_0x85f4('0x24')][_0x57064c[_0x85f4('0xee')]]['stateinterface']=_0x57064c[_0x85f4('0xf4')];if(_['isNil'](this[_0x85f4('0x2b')][this[_0x85f4('0x24')][_0x57064c[_0x85f4('0xee')]]['queue']])){this['queueBooked'][this[_0x85f4('0x24')][_0x57064c[_0x85f4('0xee')]][_0x85f4('0xbc')]]=[];}this['queueBooked'][this[_0x85f4('0x24')][_0x57064c[_0x85f4('0xee')]][_0x85f4('0xbc')]][_0x85f4('0x94')](_[_0x85f4('0x5d')](_[_0x85f4('0x75')](this[_0x85f4('0x24')][_0x57064c[_0x85f4('0xee')]],[_0x85f4('0xf6'),_0x85f4('0xf4')]),{'status':_0x57064c[_0x85f4('0xf7')],'paused':_0x57064c['paused']}));}}}};Dialer[_0x85f4('0x1a')]['syncQueueStatusComplete']=function(_0x5454a6){if(!this[_0x85f4('0x24')][_0x5454a6[_0x85f4('0xee')]]){return;}var _0x5c9326=this;var _0x29c884=this[_0x85f4('0x1f')][this[_0x85f4('0x24')][_0x5454a6[_0x85f4('0xee')]][_0x85f4('0xbc')]];var _0x35fec1=_0x29c884[_0x85f4('0xef')]||_0x85f4('0xf0');if(_0x35fec1===_0x85f4('0xf1')){if(this[_0x85f4('0x24')][_0x5454a6[_0x85f4('0xee')]]&&this[_0x85f4('0x24')][_0x5454a6[_0x85f4('0xee')]]['stateinterface']){this[_0x85f4('0x1e')]['run'](this[_0x85f4('0x24')][_0x5454a6[_0x85f4('0xee')]][_0x85f4('0xf6')],this[_0x85f4('0x24')][_0x5454a6[_0x85f4('0xee')]][_0x85f4('0xf4')])[_0x85f4('0x9b')](function(_0x35fe4a){logger[_0x85f4('0x62')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x85f4('0x44')](_0x35fe4a,{'showHidden':![],'depth':null}));})['finally'](function(){_0x5c9326[_0x85f4('0xbf')](_0x5c9326['voiceQueues'][_0x5c9326['actions'][_0x5454a6[_0x85f4('0xee')]][_0x85f4('0xbc')]]);_0x5c9326[_0x85f4('0x21')][_0x5c9326['actions'][_0x5454a6[_0x85f4('0xee')]][_0x85f4('0xf4')]][_0x85f4('0xf5')]=![];delete _0x5c9326[_0x85f4('0x24')][_0x5454a6['actionid']];unlockQueueStatus(_0x29c884);});}else{this[_0x85f4('0xbf')](this[_0x85f4('0x1f')][this[_0x85f4('0x24')][_0x5454a6[_0x85f4('0xee')]]['queue']]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x5454a6[_0x85f4('0xee')]][_0x85f4('0xdd')],'ListId':this[_0x85f4('0x24')][_0x5454a6[_0x85f4('0xee')]]['ListId'],'VoiceQueueId':this[_0x85f4('0x24')][_0x5454a6['actionid']][_0x85f4('0xdf')]||undefined,'CampaignId':this[_0x85f4('0x24')][_0x5454a6[_0x85f4('0xee')]][_0x85f4('0xf8')]||undefined})[_0x85f4('0x9b')](loggerCatch(_0x85f4('0xf9')));delete this[_0x85f4('0x24')][_0x5454a6[_0x85f4('0xee')]];unlockQueueStatus(_0x29c884);}}else if(_0x35fec1===_0x85f4('0xf0')){var _0x1d4c06;if(this[_0x85f4('0x24')][_0x5454a6['actionid']]&&!_[_0x85f4('0x47')](this['queueBooked'][this['actions'][_0x5454a6[_0x85f4('0xee')]]['queue']])){if(this[_0x85f4('0x2c')][_0x5c9326[_0x85f4('0x24')][_0x5454a6[_0x85f4('0xee')]]['queue']]){this[_0x85f4('0x2c')][_0x5c9326[_0x85f4('0x24')][_0x5454a6[_0x85f4('0xee')]][_0x85f4('0xbc')]]=this[_0x85f4('0x2c')][this['actions'][_0x5454a6[_0x85f4('0xee')]][_0x85f4('0xbc')]]?this['queueBookedRR'][this[_0x85f4('0x24')][_0x5454a6['actionid']][_0x85f4('0xbc')]]:this[_0x85f4('0x2b')][this[_0x85f4('0x24')][_0x5454a6[_0x85f4('0xee')]][_0x85f4('0xbc')]]?this[_0x85f4('0x2b')][this[_0x85f4('0x24')][_0x5454a6[_0x85f4('0xee')]][_0x85f4('0xbc')]][_0x85f4('0xfa')]||0x0:0x0;}this[_0x85f4('0x2b')][this[_0x85f4('0x24')][_0x5454a6['actionid']][_0x85f4('0xbc')]][_0x85f4('0xfa')]=this[_0x85f4('0x2c')][this[_0x85f4('0x24')][_0x5454a6[_0x85f4('0xee')]][_0x85f4('0xbc')]];for(var _0x66a027=0x0;_0x66a027=_0x57e649['dialGlobalMaxRetry']){_0x5370eb[_0x85f4('0x124')](_0x148a5b,_0x20d59b,_0x194002,'reason19\x20machine....');}else{if(_0x148a5b[_0x85f4('0x122')]>=_0x57e649[_0x85f4('0x125')]){_0x5370eb[_0x85f4('0x126')](_0x148a5b,_0x20d59b,_0x194002,_0x85f4('0x127'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x148a5b[_0x85f4('0x122')],'scheduledat':moment()[_0x85f4('0xdb')](_0x57e649['dialMachineRetryFrequency'],_0x85f4('0xdc'))['format'](_0x85f4('0xc1')),'ContactId':_0x148a5b[_0x85f4('0xdd')],'ListId':_0x148a5b[_0x85f4('0xde')],'VoiceQueueId':_0x148a5b[_0x85f4('0xdf')]||undefined,'CampaignId':_0x148a5b[_0x85f4('0xf8')]||undefined})[_0x85f4('0x9b')](loggerCatch(_0x85f4('0x128')));_0x20d59b({'reschedule':0x1});}}});}if(_0x5ebb16[_0x85f4('0xbd')]===_0x85f4('0xbe')&&this[_0x85f4('0x20')][_0x5ebb16[_0x85f4('0xbc')]][_0x85f4('0x110')]&&_0x11870b[_0x85f4('0x11b')]===_0x85f4('0x111')){delete this[_0x85f4('0x26')][_0x11870b[_0x85f4('0xc2')]];this[_0x85f4('0xbf')](this[_0x85f4('0x20')][_0x5ebb16[_0x85f4('0xbc')]]);_0x2c7c96=new Hangup(_0x5ebb16,_0x11870b);_0x2c7c96[_0x85f4('0x6d')]=0x12;_0x2c7c96[_0x85f4('0x6e')]=_0x85f4('0x113');_0x2c7c96[_0x85f4('0x114')]=_0x85f4('0x115');ami['emit']('custom:amd',ut['buildObj'](_0x2c7c96,_0x85f4('0x117')));this[_0x85f4('0x118')](_0x2c7c96,_0x85f4('0x129'),_0x85f4('0x12a'));}if(_0x5ebb16['type']==='ivr'&&this['campaigns'][_0x5ebb16[_0x85f4('0xbc')]]['dialAMDActive']&&_0x11870b[_0x85f4('0x11b')]==='MACHINE'){return new Promise(function(_0x2fa224,_0xa09ddf){delete _0x5370eb['uniqueId'][_0x11870b['uniqueid']];_0x5370eb['updateOriginated'](_0x5370eb[_0x85f4('0x20')][_0x5ebb16['queue']]);_0x5370eb[_0x85f4('0x20')][_0x5ebb16[_0x85f4('0xbc')]]['outboundAnswerCallsDay']+=0x1;_0x5370eb[_0x85f4('0x20')][_0x5ebb16[_0x85f4('0xbc')]][_0x85f4('0x112')]+=0x1;var _0x2dadd4=_0x5370eb[_0x85f4('0x20')][_0x5ebb16['queue']];var _0x1ef872=new Hangup(_0x5ebb16,_0x11870b);_0x1ef872[_0x85f4('0x6d')]=0x13;_0x1ef872[_0x85f4('0x6e')]=_0x85f4('0x11c');_0x1ef872[_0x85f4('0x114')]=_0x85f4('0x115');_0x1ef872['countmachineretry']+=0x1;_0x1ef872[_0x85f4('0xd5')]+=0x1;_0x1ef872[_0x85f4('0x117')]=!![];ami['emit'](_0x85f4('0x116'),ut['buildObj'](_0x1ef872,_0x85f4('0x117')));hopperUtils[_0x85f4('0xc8')](_0x1ef872)[_0x85f4('0x9b')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1ef872[_0x85f4('0x11e')]+_0x1ef872[_0x85f4('0x11f')]+_0x1ef872[_0x85f4('0x120')]+_0x1ef872[_0x85f4('0x121')]+_0x1ef872[_0x85f4('0xd4')]+_0x1ef872[_0x85f4('0xe7')]+_0x1ef872['countmachineretry']+_0x1ef872[_0x85f4('0x123')]>=_0x2dadd4[_0x85f4('0x12b')]){_0x5370eb['stateGlobal'](_0x1ef872,_0x2fa224,_0xa09ddf,_0x85f4('0x12c'));}else{if(_0x1ef872[_0x85f4('0x122')]>=_0x2dadd4['dialMachineMaxRetry']){_0x5370eb['createStateFinal'](_0x1ef872,_0x2fa224,_0xa09ddf,_0x85f4('0x127'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x1ef872[_0x85f4('0x122')],'scheduledat':moment()[_0x85f4('0xdb')](_0x2dadd4['dialMachineRetryFrequency'],_0x85f4('0xdc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ef872[_0x85f4('0xdd')],'ListId':_0x1ef872['ListId'],'VoiceQueueId':_0x1ef872['VoiceQueueId']||undefined,'CampaignId':_0x1ef872[_0x85f4('0xf8')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x2fa224({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x5562e9){var _0x34a201=this['uniqueId'][_0x5562e9[_0x85f4('0xc2')]];var _0x529323;if(_0x34a201&&_0x34a201[_0x85f4('0xbd')]===_0x85f4('0xbe')){delete this[_0x85f4('0x26')][_0x5562e9[_0x85f4('0xc2')]];this[_0x85f4('0xbf')](this[_0x85f4('0x20')][_0x34a201[_0x85f4('0xbc')]]);this['campaigns'][_0x34a201['queue']][_0x85f4('0x12d')]+=0x1;_0x529323=new Hangup(_0x34a201,_0x5562e9);hopperUtils[_0x85f4('0xc8')](_0x529323)['catch'](loggerCatch(_0x85f4('0x12e')));hopperUtils[_0x85f4('0xca')](_0x529323)[_0x85f4('0x9b')](loggerCatch(_0x85f4('0x12f')));}if(_0x34a201&&_0x34a201['type']!==_0x85f4('0xbe')&&isNotNull(this[_0x85f4('0x1f')][_0x34a201[_0x85f4('0xbc')]][_0x85f4('0x130')])){delete this[_0x85f4('0x26')][_0x5562e9[_0x85f4('0xc2')]];this['updateOriginated'](this[_0x85f4('0x1f')][_0x34a201[_0x85f4('0xbc')]]);this[_0x85f4('0x1f')][_0x34a201['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x85f4('0x1f')][_0x34a201[_0x85f4('0xbc')]][_0x85f4('0x112')]+=0x1;_0x529323=new Hangup(_0x34a201,_0x5562e9);_0x529323['state']=0x10;_0x529323['statedesc']=_0x85f4('0x131');_0x529323[_0x85f4('0x114')]='AGI';hopperUtils[_0x85f4('0xc8')](_0x529323)['catch'](loggerCatch(_0x85f4('0x12e')));hopperUtils[_0x85f4('0xca')](_0x529323)[_0x85f4('0x9b')](loggerCatch('[syncHangupIvr]'));}if(_0x34a201&&_0x34a201[_0x85f4('0xbd')]!==_0x85f4('0xbe')&&!isNotNull(this[_0x85f4('0x1f')][_0x34a201[_0x85f4('0xbc')]][_0x85f4('0x130')])){delete this[_0x85f4('0x26')][_0x5562e9[_0x85f4('0xc2')]];this[_0x85f4('0xbf')](this[_0x85f4('0x1f')][_0x34a201['queue']]);this[_0x85f4('0x1f')][_0x34a201[_0x85f4('0xbc')]][_0x85f4('0x132')]+=0x1;_0x529323=new Hangup(_0x34a201,_0x5562e9);_0x529323[_0x85f4('0x6d')]=0xc;_0x529323[_0x85f4('0x6e')]=_0x5562e9['cause-txt'];_0x529323[_0x85f4('0x114')]=_0x85f4('0x133');hopperUtils[_0x85f4('0xc8')](_0x529323)[_0x85f4('0x9b')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x85f4('0xca')](_0x529323)['catch'](loggerCatch(_0x85f4('0x12f')));}};Dialer[_0x85f4('0x1a')][_0x85f4('0x134')]=function(_0x42100d){var _0x335087=this;if(!_0x335087[_0x85f4('0x135')][_0x42100d['name']]){_0x335087['queuesSummary'][_0x42100d['name']]={'running':![]};}else if(_0x335087[_0x85f4('0x135')][_0x42100d[_0x85f4('0x46')]][_0x85f4('0x136')]===!![]){return;}else if(_0x335087[_0x85f4('0x135')][_0x42100d[_0x85f4('0x46')]]['running']===![]){_0x335087[_0x85f4('0x135')][_0x42100d[_0x85f4('0x46')]][_0x85f4('0x136')]=!![];}var _0x5aa8b6=_0x335087[_0x85f4('0x1f')][_0x42100d[_0x85f4('0x46')]];var _0x325ce6=_0x5aa8b6[_0x85f4('0x6b')]!==utils['CAMPAIGN_STATUS'][_0x85f4('0x7f')];var _0x52afcc=utils['isPreviewCampaign'](_0x5aa8b6);_0x5aa8b6[_0x85f4('0x137')]=utils[_0x85f4('0x138')](_0x5aa8b6,_0x335087[_0x85f4('0x22')]);Promise[_0x85f4('0xa9')]()[_0x85f4('0x40')](function(){if(_0x5aa8b6['statusMessage']===utils[_0x85f4('0x67')][_0x85f4('0x7f')]){if(_0x325ce6){clearPredictiveAttributes(_0x5aa8b6);_0x42100d[_0x85f4('0x28')]=undefined;_0x42100d[_0x85f4('0x29')]=undefined;}if(_0x5aa8b6[_0x85f4('0x137')]===utils[_0x85f4('0x67')]['INACTIVE']){_0x42100d['available']=0x0;_0x42100d[_0x85f4('0xf3')]=0x0;_0x42100d[_0x85f4('0x139')]=0x0;_0x42100d['talking']=0x0;_0x42100d[_0x85f4('0x13a')]=0x0;}}else if(_0x5aa8b6[_0x85f4('0x137')]===utils['CAMPAIGN_STATUS']['ACTIVE']&&!_0x52afcc){return _0x335087[_0x85f4('0x8d')](_0x5aa8b6,!![])[_0x85f4('0x40')](function(){return _0x335087[_0x85f4('0x8d')](_0x5aa8b6,![]);})[_0x85f4('0x40')](function(){return _0x335087[_0x85f4('0xaf')](_0x5aa8b6);})[_0x85f4('0x9b')](function(_0x585935){loggerSyncQueueSummary[_0x85f4('0x43')](_0x85f4('0x13b'),util[_0x85f4('0x44')](_0x585935,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5aa8b6);});}else{clearPredictiveAttributes(_0x5aa8b6);}})['then'](function(){var _0x22ef40=_0x42100d[_0x85f4('0x13c')](_0x5aa8b6);if(_0x22ef40||_0x5aa8b6[_0x85f4('0x13d')]){_0x5aa8b6[_0x85f4('0x13d')]=![];_0x42100d['updateReportFromOutboundQueue'](_0x5aa8b6);Object[_0x85f4('0x13e')](_0x5aa8b6,_0x42100d);emitOutboundVoiceQueueSummary(_0x42100d);}_0x335087[_0x85f4('0x135')][_0x5aa8b6['name']][_0x85f4('0x136')]=![];})['catch'](function(_0x152fdb){logger[_0x85f4('0x62')](_0x85f4('0x13b'),util[_0x85f4('0x44')](_0x152fdb,{'showHidden':![],'depth':null}));_0x335087[_0x85f4('0x135')][_0x5aa8b6['name']][_0x85f4('0x136')]=![];});};Dialer[_0x85f4('0x1a')][_0x85f4('0x13f')]=_[_0x85f4('0x140')](function(){var _0x2954e2=_['filter'](this[_0x85f4('0x1f')],function(_0x103a23){return _0x103a23['dialPreviewRecallmeReminder'];});var _0x42e2e7=_['filter'](this['agents'],function(_0x15f892){return _0x15f892[_0x85f4('0x141')]&&_0x15f892[_0x85f4('0xf7')]==='reachable';});if(_0x2954e2[_0x85f4('0xfb')]>0x0&&_0x42e2e7[_0x85f4('0xfb')]>0x0){return Promise['resolve']()[_0x85f4('0x40')](cmHopper[_0x85f4('0x142')](_['map'](_0x2954e2,'id'),previewRecallmeReminderInterval,_[_0x85f4('0x143')](_0x42e2e7,'id')))[_0x85f4('0x40')](function(_0x1f82aa){for(var _0x5d3ade=0x0;_0x5d3ade<_0x1f82aa['length'];_0x5d3ade++){var _0x5b18c9=_0x1f82aa[_0x5d3ade][_0x85f4('0x144')][_0x85f4('0x46')];if(_0x5b18c9)io['to'](util[_0x85f4('0x7c')](_0x85f4('0x145'),_0x5b18c9))[_0x85f4('0x42')](_0x85f4('0x146'),{'hopper':_0x1f82aa[_0x5d3ade]});}})[_0x85f4('0x9b')](function(_0x523327){logger[_0x85f4('0x62')](_0x85f4('0x147'),_0x523327);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x85f4('0x1a')][_0x85f4('0x3e')]=function(){var _0x2638a1=this;setInterval(function(){_0x2638a1['clearZombieChannels'](_0x2638a1[_0x85f4('0x26')],_0x85f4('0x148'));_0x2638a1[_0x85f4('0x149')](_0x2638a1[_0x85f4('0x24')],_0x85f4('0x14a'));},0x32c8);};Dialer[_0x85f4('0x1a')][_0x85f4('0x149')]=function(_0x3e26da,_0x2d9c9b){var _0x492d69=this;for(var _0x19c85d in _0x3e26da){if(typeof _0x3e26da[_0x19c85d]!=='undefined'){this['sequence'][_0x85f4('0x1b')](function(){if(!_[_0x85f4('0xf2')](_0x3e26da[_0x19c85d])){return ami[_0x85f4('0x95')]({'action':_0x85f4('0xf7'),'channel':_0x3e26da[_0x19c85d][_0x85f4('0xed')]})[_0x85f4('0x9b')](function(_0x56a063){if(_0x56a063['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x3e26da[_0x19c85d]&&_0x3e26da[_0x19c85d][_0x85f4('0xbd')]!==_0x85f4('0xbe')){_0x492d69[_0x85f4('0xbf')](_0x492d69[_0x85f4('0x1f')][_0x3e26da[_0x19c85d]['queue']]);logger[_0x85f4('0x62')](_0x85f4('0x14b'),_0x2d9c9b,_0x19c85d,_0x3e26da[_0x19c85d][_0x85f4('0xbc')]);delete _0x3e26da[_0x19c85d];}if(_0x3e26da[_0x19c85d]&&_0x3e26da[_0x19c85d][_0x85f4('0xbd')]===_0x85f4('0xbe')){_0x492d69[_0x85f4('0xbf')](_0x492d69[_0x85f4('0x20')][_0x3e26da[_0x19c85d][_0x85f4('0xbc')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x2d9c9b,_0x19c85d,_0x3e26da[_0x19c85d][_0x85f4('0xbc')]);delete _0x3e26da[_0x19c85d];}},0x2328);}});}});}}};Dialer[_0x85f4('0x1a')]['getVoiceQueueRtPauses']=function(_0x4a263c){return Promise[_0x85f4('0xa9')]()[_0x85f4('0x40')](voiceQueueRt[_0x85f4('0x14c')](_0x4a263c))[_0x85f4('0x9b')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x85f4('0x1a')]['updateOriginated']=function(_0x193993){if(!_[_0x85f4('0x41')](_0x193993)&&_0x193993!==null){if(typeof _0x193993[_0x85f4('0x14d')]!=='undefined'){if(_0x193993[_0x85f4('0x14d')]>0x0){_0x193993['originated']-=0x1;}else{logger[_0x85f4('0x62')](_0x85f4('0x14e'));}}}else{logger[_0x85f4('0x62')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x85f4('0x1a')][_0x85f4('0x14f')]=function(_0x26bb27,_0x32cea4){var _0x381ff8=this;return function(_0x72519a){_0x381ff8['updateOriginated'](_0x32cea4);logger[_0x85f4('0x62')](_0x26bb27,util[_0x85f4('0x44')](_0x72519a,{'showHidden':![],'depth':null}));};};Dialer[_0x85f4('0x1a')][_0x85f4('0x150')]=function(_0x4b179b,_0x78c0e8,_0x226409){var _0x530e8d={'state':0x19,'statedesc':_0x85f4('0x151')};this[_0x85f4('0xbf')](_0x78c0e8);this['saveInDb'](_[_0x85f4('0x5d')](_0x530e8d,_[_0x85f4('0x75')](_0x226409,['ContactId',_0x85f4('0xde'),_0x85f4('0x152'),_0x85f4('0xdf'),'CampaignId'])),_0x85f4('0x153'),'[emptyContact]');logger[_0x85f4('0x62')](_0x4b179b);};Dialer['prototype']['saveInDb']=function(_0x1b74ef,_0x28a063,_0x2e19c1){hopperUtils[_0x85f4('0xc8')](_0x1b74ef)[_0x85f4('0x9b')](loggerCatch(_0x28a063));hopperUtils['moveContactManagedDialer'](_0x1b74ef)['catch'](loggerCatch(_0x2e19c1));};Dialer[_0x85f4('0x1a')][_0x85f4('0xd9')]=function(_0x5dda44,_0x59bb96){hopperUtils[_0x85f4('0xc8')](_0x5dda44)['catch'](loggerCatch(_0x85f4('0xc9')));if(_0x59bb96==0x0){hopperUtils['moveContactManagedDialer'](_0x5dda44)[_0x85f4('0x9b')](loggerCatch(_0x85f4('0x154')));}};Dialer['prototype']['checkPreviewRecallReminder']=function(_0xfea463){return Promise['resolve']()[_0x85f4('0x40')](cmHopper[_0x85f4('0x142')](_0xfea463['id'],previewRecallmeReminderInterval))[_0x85f4('0x40')](function(_0x5fd498){for(var _0x509d77=0x0;_0x509d77<_0x5fd498['length'];_0x509d77++){var _0x41c01f=_0x5fd498[_0x509d77][_0x85f4('0x144')]['name'];if(_0x41c01f)io['to'](util[_0x85f4('0x7c')](_0x85f4('0x145'),_0x41c01f))['emit'](_0x85f4('0x146'),{'hopper':_0x5fd498[_0x509d77]});}})[_0x85f4('0x9b')](function(){});};Dialer[_0x85f4('0x1a')][_0x85f4('0xad')]=function(_0x17994e){var _0x2576d6=this;return function(){_0x2576d6[_0x85f4('0x155')](_0x17994e);};};Dialer[_0x85f4('0x1a')][_0x85f4('0x156')]=function(_0x86029d,_0x52cddf){var _0xcdac41=this;var _0x3ad289=uuid['v4']();this[_0x85f4('0x24')][_0x3ad289]=new Action(_0x86029d,_0x52cddf,_0x3ad289);return new Promise(function(_0x55e43f,_0x4a7394){if(_['isUndefined'](_0x86029d)&&typeof _0x86029d!==_0x85f4('0x157')){return _0x4a7394(msgResponse('originate',_0x85f4('0x8e'),_0x85f4('0x158')));}if(_[_0x85f4('0x41')](_0x52cddf[_0x85f4('0x159')])||_0x52cddf[_0x85f4('0x159')]===null){return _0x4a7394(msgResponse(_0x85f4('0x15a'),_0x85f4('0x8e'),_0x85f4('0x15b')));}var _0x1950c9={'XMD-CALLERID':_0xcdac41[_0x85f4('0x24')][_0x3ad289]['getCaller'](),'XMD-AGI':_0x86029d[_0x85f4('0x130')]?util[_0x85f4('0x7c')](_0x85f4('0x15c'),ipAgi,_0x86029d[_0x85f4('0x130')]):_0x85f4('0x15d'),'XMD-AGIAFTER':_0x86029d[_0x85f4('0xc7')]?util[_0x85f4('0x7c')]('\x22agi://%s/square,%s\x22',ipAgi,_0x86029d['dialQueueProject2']):_0x85f4('0x15d'),'XMD-QUEUE':utils[_0x85f4('0x15e')](_0x86029d)?util[_0x85f4('0x7c')](_0x85f4('0x15f'),_0x86029d[_0x85f4('0x46')],_0x86029d[_0x85f4('0x160')]||'',_0x86029d[_0x85f4('0x161')]?'c':'',_0x86029d[_0x85f4('0xce')]||0x3):_0x85f4('0x15d'),'XMD-CONTACTID':_0x52cddf['ContactId'],'XMD-CDRTYPE':_0x85f4('0xa'),'CALLERID(all)':_0xcdac41[_0x85f4('0x24')][_0x3ad289][_0x85f4('0x162')](),'XMD-AMD':_0x86029d[_0x85f4('0x110')]?_0x85f4('0x163'):_0x85f4('0x15d'),'XMD-DESTINATION':_0x85f4('0x164')};if(_0x86029d[_0x85f4('0x110')]){_0x1950c9[_0x85f4('0x165')]=_0x86029d['dialAMDInitialSilence']||0x9c4;_0x1950c9[_0x85f4('0x166')]=_0x86029d['dialAMDGreeting']||0x5dc;_0x1950c9[_0x85f4('0x167')]=_0x86029d[_0x85f4('0x168')]||0x320;_0x1950c9['XMD-AMDTOTALANALYSISTIME']=_0x86029d[_0x85f4('0x169')]||0x1388;_0x1950c9['XMD-AMDMINWORDLENGTH']=_0x86029d[_0x85f4('0x16a')]||0x64;_0x1950c9[_0x85f4('0x16b')]=_0x86029d[_0x85f4('0x16c')]||0x32;_0x1950c9[_0x85f4('0x16d')]=_0x86029d[_0x85f4('0x16e')]||0x3;_0x1950c9[_0x85f4('0x16f')]=_0x86029d['dialAMDSilenceThreshold']||0x100;_0x1950c9[_0x85f4('0x170')]=_0x86029d['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x85f4('0x15e')](_0x86029d)){_0x1950c9[_0x85f4('0x171')]=_0x52cddf[_0x85f4('0xdf')];}else{_0x1950c9[_0x85f4('0x172')]=_0x52cddf[_0x85f4('0xf8')];}var _0x20d5fb=utils[_0x85f4('0x173')](_0x52cddf['Contact']);Object[_0x85f4('0x13e')](_0x1950c9,_0x20d5fb);var _0x4a070e=_0xcdac41[_0x85f4('0x84')](_0x86029d[_0x85f4('0x174')])?utils[_0x85f4('0x175')](_0x86029d[_0x85f4('0x174')][_0x85f4('0x176')],_0x86029d[_0x85f4('0x177')],_0x86029d[_0x85f4('0x178')]>0x0?utils['getCallerIdRandom'](_0x86029d[_0x85f4('0x179')],_0x86029d[_0x85f4('0x178')]):_0x86029d[_0x85f4('0x179')]):utils['getCallerId'](_[_0x85f4('0xf2')](_0x86029d[_0x85f4('0x89')])?_0x86029d[_0x85f4('0x174')][_0x85f4('0x176')]:_0x86029d['TrunkBackup'][_0x85f4('0x176')],_0x86029d[_0x85f4('0x177')],_0x86029d[_0x85f4('0x178')]>0x0?utils['getCallerIdRandom'](_0x86029d[_0x85f4('0x179')],_0x86029d[_0x85f4('0x178')]):_0x86029d[_0x85f4('0x179')]);if(_0x4a070e){_0x1950c9['XMD-ORIGINATECALLERIDNAME']=_0xcdac41[_0x85f4('0x24')][_0x3ad289]['originatecalleridname']=utils[_0x85f4('0x17a')](_0x4a070e);_0x1950c9['XMD-ORIGINATECALLERIDNUM']=_0x52cddf[_0x85f4('0x159')];}_0x86029d['variables']=_0x1950c9;return ami['Action']({'actionid':_0x3ad289,'action':_0x85f4('0x15a'),'channel':_0xcdac41['isTrunkReachable'](_0x86029d[_0x85f4('0x174')])?util['format'](_0x85f4('0x17b'),_0x86029d['Trunk'][_0x85f4('0x46')],isNotNull(_0x86029d[_0x85f4('0x17c')])?_0x86029d[_0x85f4('0x17c')][_0x85f4('0x17d')]()||'':'',_0x86029d[_0x85f4('0x17e')]>0x0?_0x52cddf[_0x85f4('0x159')][_0x85f4('0x17f')](_0x86029d[_0x85f4('0x17e')]):_0x52cddf[_0x85f4('0x159')]):util['format'](_0x85f4('0x17b'),_[_0x85f4('0xf2')](_0x86029d[_0x85f4('0x89')])?_0x86029d['Trunk']['name']:_0x86029d['TrunkBackup'][_0x85f4('0x46')],isNotNull(_0x86029d[_0x85f4('0x17c')])?_0x86029d[_0x85f4('0x17c')]['trim']()||'':'',_0x86029d[_0x85f4('0x17e')]>0x0?_0x52cddf[_0x85f4('0x159')]['substring'](_0x86029d[_0x85f4('0x17e')]):_0x52cddf[_0x85f4('0x159')]),'callerid':_0x4a070e,'Exten':_0x85f4('0x164'),'Context':_0x85f4('0x180'),'Priority':'1','variable':_0x1950c9,'timeout':(_0x86029d[_0x85f4('0x181')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3ad289})[_0x85f4('0x40')](function(_0x30d662){return _0x55e43f(_0x30d662);})[_0x85f4('0x9b')](function(_0x936c3d){_0x86029d[_0x85f4('0x182')]+=0x1;var _0x41efc2=new History(_0xcdac41['actions'][_0x3ad289]);logger[_0x85f4('0x62')](util['format'](_0x85f4('0x183'),JSON['stringify'](_0x936c3d)));_0x41efc2[_0x85f4('0x6d')]=0xe;_0x41efc2['statedesc']=_0x85f4('0x184');_0x41efc2[_0x85f4('0x70')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x41efc2[_0x85f4('0x6f')]=_0x41efc2[_0x85f4('0x70')];hopperUtils[_0x85f4('0xc8')](_0x41efc2)[_0x85f4('0x9b')](loggerCatch('[originate][error]'));_0xcdac41['moveContactManagedDialer'](_0x41efc2)[_0x85f4('0x9b')](loggerCatch('[originate][error]'))[_0x85f4('0x1d')](function(){delete _0xcdac41[_0x85f4('0x24')][_0x3ad289];return _0x4a7394(msgResponse(_0x85f4('0x15a'),_0x85f4('0x83'),_0x85f4('0x185')));});});});};Dialer[_0x85f4('0x1a')][_0x85f4('0x186')]=function(_0x19c0d8,_0x2b0589,_0x509b2b){var _0x3e987e=new History(_0x2b0589);if(_0x3e987e['countbusyretry']+_0x3e987e[_0x85f4('0x11f')]+_0x3e987e['countnoanswerretry']+_0x3e987e[_0x85f4('0x121')]+_0x3e987e[_0x85f4('0xd4')]+_0x3e987e[_0x85f4('0xe7')]+_0x3e987e[_0x85f4('0x122')]+_0x3e987e[_0x85f4('0x123')]>=_0x509b2b[_0x85f4('0x12b')]-0x1){return!![];}switch(_0x19c0d8){case 0x3:if(_0x3e987e[_0x85f4('0x120')]>=_0x509b2b[_0x85f4('0x187')]-0x1){return!![];}hopperUtils[_0x85f4('0xda')]({'active':![],'countnoanswerretry':_0x3e987e[_0x85f4('0x120')]+=0x1,'scheduledat':moment()[_0x85f4('0xdb')](_0x509b2b[_0x85f4('0x188')],_0x85f4('0xdc'))[_0x85f4('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3e987e[_0x85f4('0xdd')],'ListId':_0x3e987e['ListId'],'VoiceQueueId':_0x3e987e[_0x85f4('0xdf')]||undefined,'CampaignId':_0x3e987e[_0x85f4('0xf8')]||undefined})[_0x85f4('0x9b')](loggerCatch(_0x85f4('0x189')));break;case 0x5:if(_0x3e987e[_0x85f4('0x11e')]>=_0x509b2b[_0x85f4('0x18a')]-0x1){return!![];}hopperUtils[_0x85f4('0xda')]({'active':![],'countbusyretry':_0x3e987e[_0x85f4('0x11e')]+=0x1,'scheduledat':moment()[_0x85f4('0xdb')](_0x509b2b[_0x85f4('0x18b')],_0x85f4('0xdc'))[_0x85f4('0x7c')](_0x85f4('0xc1')),'ContactId':_0x3e987e[_0x85f4('0xdd')],'ListId':_0x3e987e[_0x85f4('0xde')],'VoiceQueueId':_0x3e987e[_0x85f4('0xdf')]||undefined,'CampaignId':_0x3e987e[_0x85f4('0xf8')]||undefined})[_0x85f4('0x9b')](loggerCatch(_0x85f4('0x18c')));break;case 0x8:if(_0x3e987e[_0x85f4('0x11f')]>=_0x509b2b[_0x85f4('0x18d')]-0x1){return!![];}hopperUtils[_0x85f4('0xda')]({'active':![],'countcongestionretry':_0x3e987e[_0x85f4('0x11f')]+=0x1,'scheduledat':moment()['add'](_0x509b2b['dialCongestionRetryFrequency'],_0x85f4('0xdc'))[_0x85f4('0x7c')](_0x85f4('0xc1')),'ContactId':_0x3e987e[_0x85f4('0xdd')],'ListId':_0x3e987e[_0x85f4('0xde')],'VoiceQueueId':_0x3e987e[_0x85f4('0xdf')]||undefined,'CampaignId':_0x3e987e['CampaignId']||undefined})[_0x85f4('0x9b')](loggerCatch(_0x85f4('0x18e')));break;case 0x0:if(_0x3e987e[_0x85f4('0x121')]>=_0x509b2b[_0x85f4('0x18f')]-0x1){return!![];}else{hopperUtils[_0x85f4('0xda')]({'active':![],'countnosuchnumberretry':_0x3e987e[_0x85f4('0x121')]+=0x1,'scheduledat':moment()[_0x85f4('0xdb')](_0x509b2b['dialNoSuchNumberRetryFrequency'],_0x85f4('0xdc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3e987e[_0x85f4('0xdd')],'ListId':_0x3e987e['ListId'],'VoiceQueueId':_0x3e987e['VoiceQueueId']||undefined,'CampaignId':_0x3e987e[_0x85f4('0xf8')]||undefined})[_0x85f4('0x9b')](loggerCatch(_0x85f4('0x190')));}break;case 0xa:if(_0x3e987e['countdropretry']>=_0x509b2b[_0x85f4('0x191')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x3e987e['countdropretry']+=0x1,'scheduledat':moment()[_0x85f4('0xdb')](_0x509b2b['dialDropRetryFrequency'],_0x85f4('0xdc'))['format'](_0x85f4('0xc1')),'ContactId':_0x3e987e['ContactId'],'ListId':_0x3e987e[_0x85f4('0xde')],'VoiceQueueId':_0x3e987e[_0x85f4('0xdf')]||undefined,'CampaignId':_0x3e987e[_0x85f4('0xf8')]||undefined})[_0x85f4('0x9b')](loggerCatch(_0x85f4('0xe0')));break;case 0xb:if(_0x3e987e['countabandonedretry']>=_0x509b2b[_0x85f4('0x192')]-0x1){return!![];}hopperUtils[_0x85f4('0xda')]({'active':![],'countabandonedretry':_0x3e987e[_0x85f4('0xe7')]+=0x1,'scheduledat':moment()[_0x85f4('0xdb')](_0x509b2b[_0x85f4('0xe9')],_0x85f4('0xdc'))[_0x85f4('0x7c')](_0x85f4('0xc1')),'ContactId':_0x3e987e['ContactId'],'ListId':_0x3e987e['ListId'],'VoiceQueueId':_0x3e987e[_0x85f4('0xdf')]||undefined,'CampaignId':_0x3e987e[_0x85f4('0xf8')]||undefined})[_0x85f4('0x9b')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x3e987e['countmachineretry']>=_0x509b2b[_0x85f4('0x125')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x3e987e['countmachineretry']+=0x1,'scheduledat':moment()[_0x85f4('0xdb')](_0x509b2b[_0x85f4('0x193')],_0x85f4('0xdc'))[_0x85f4('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3e987e[_0x85f4('0xdd')],'ListId':_0x3e987e['ListId'],'VoiceQueueId':_0x3e987e['VoiceQueueId']||undefined,'CampaignId':_0x3e987e['CampaignId']||undefined})[_0x85f4('0x9b')](loggerCatch(_0x85f4('0x128')));break;case 0x14:if(_0x3e987e[_0x85f4('0x123')]>=_0x509b2b['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x85f4('0xda')]({'active':![],'countagentrejectretry':_0x3e987e[_0x85f4('0x123')]+=0x1,'scheduledat':moment()[_0x85f4('0xdb')](_0x509b2b[_0x85f4('0x194')],'minutes')[_0x85f4('0x7c')](_0x85f4('0xc1')),'ContactId':_0x3e987e['ContactId'],'ListId':_0x3e987e[_0x85f4('0xde')],'VoiceQueueId':_0x3e987e[_0x85f4('0xdf')]||undefined,'CampaignId':_0x3e987e[_0x85f4('0xf8')]||undefined})[_0x85f4('0x9b')](loggerCatch(_0x85f4('0x195')));break;default:return!![];}};Dialer[_0x85f4('0x1a')][_0x85f4('0x10a')]=function(_0x370f85,_0x30a22b,_0x494831){var _0x58f2d2=this;var _0x2760d5=new History(_0x370f85);var _0x1236eb=![];var _0x505854;var _0x35c6d5;return new Promise(function(_0x5e4cb9,_0x2b8b94){if(_['isUndefined'](_0x30a22b)&&typeof _0x30a22b!==_0x85f4('0x157')){return _0x2b8b94(msgResponse('[callProgressDetecting]',_0x85f4('0x8e'),'entity\x20is\x20undefine'));}if(_[_0x85f4('0x41')](_0x494831)&&typeof _0x494831!==_0x85f4('0x157')){return _0x2b8b94(msgResponse(_0x85f4('0x196'),_0x85f4('0x8e'),_0x85f4('0x197')));}hopperUtils['verifyAdditionalPhones'](_0x2760d5,_0x494831[_0x85f4('0xc4')],_0x30a22b)[_0x85f4('0x40')](function(_0x22fad1){if(_0x22fad1[_0x85f4('0xd8')]==0x1)_0x1236eb=!![];switch(_0x494831['reason']){case'0':_0x30a22b[_0x85f4('0x198')]+=0x1;_0x2760d5[_0x85f4('0x6d')]=0x0;_0x2760d5[_0x85f4('0x6e')]=_0x85f4('0x199');_0x2760d5[_0x85f4('0x121')]+=0x1;_0x2760d5[_0x85f4('0xd5')]+=0x1;ami[_0x85f4('0x42')](_0x85f4('0x19a'),ut[_0x85f4('0x11d')](_0x370f85,_0x85f4('0x19b')));_0x505854=_0x30a22b[_0x85f4('0x19c')];_0x35c6d5=_0x30a22b['callAdditionalPhoneAfterMin'];hopperUtils[_0x85f4('0xc8')](_0x2760d5)[_0x85f4('0x9b')](loggerCatch(_0x85f4('0x19d')));if(_0x58f2d2['checkRetriveMax'](0x0,_0x370f85,_0x30a22b)&&!_0x1236eb){if(_0x2760d5[_0x85f4('0x121')]>=_0x30a22b[_0x85f4('0x18f')]){_0x58f2d2[_0x85f4('0x126')](_0x2760d5,_0x5e4cb9,_0x2b8b94,'reason\x200\x20no\x20such\x20number....');}else{_0x58f2d2[_0x85f4('0x124')](_0x2760d5,_0x5e4cb9,_0x2b8b94,_0x85f4('0x19e'));}}break;case'3':_0x30a22b[_0x85f4('0x19f')]+=0x1;_0x2760d5[_0x85f4('0x6d')]=0x3;_0x2760d5['statedesc']=_0x85f4('0x1a0');_0x2760d5[_0x85f4('0x120')]+=0x1;_0x2760d5[_0x85f4('0xd5')]+=0x1;var _0x57fb51=ut[_0x85f4('0x1a1')](_0x370f85,_0x30a22b);ami[_0x85f4('0x42')]('custom:agentnoanswer',_0x57fb51);_0x505854=_0x30a22b[_0x85f4('0x188')];_0x35c6d5=_0x30a22b[_0x85f4('0xe8')];hopperUtils[_0x85f4('0xc8')](_0x2760d5)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x58f2d2[_0x85f4('0x186')](0x3,_0x370f85,_0x30a22b)&&!_0x1236eb){if(_0x2760d5[_0x85f4('0x120')]>=_0x30a22b[_0x85f4('0x187')]){_0x58f2d2['createStateFinal'](_0x2760d5,_0x5e4cb9,_0x2b8b94,'reason\x203\x20ringing\x20no\x20answer');}else{_0x58f2d2['stateGlobal'](_0x2760d5,_0x5e4cb9,_0x2b8b94,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x30a22b[_0x85f4('0x1a2')]+=0x1;_0x2760d5['state']=0x5;_0x2760d5[_0x85f4('0x6e')]='Busy';_0x2760d5['countbusyretry']+=0x1;_0x2760d5[_0x85f4('0xd5')]+=0x1;ami['emit'](_0x85f4('0x1a3'),ut['buildObj'](_0x370f85,_0x85f4('0x1a4')));_0x505854=_0x30a22b['dialBusyRetryFrequency'];_0x35c6d5=_0x30a22b[_0x85f4('0xe8')];hopperUtils[_0x85f4('0xc8')](_0x2760d5)[_0x85f4('0x9b')](loggerCatch(_0x85f4('0x1a5')));if(_0x58f2d2[_0x85f4('0x186')](0x5,_0x370f85,_0x30a22b)&&!_0x1236eb){if(_0x2760d5['countbusyretry']>=_0x30a22b['dialBusyMaxRetry']){_0x58f2d2[_0x85f4('0x126')](_0x2760d5,_0x5e4cb9,_0x2b8b94,'reason\x205\x20busy');}else{_0x58f2d2[_0x85f4('0x124')](_0x2760d5,_0x5e4cb9,_0x2b8b94,_0x85f4('0x1a6'));}}break;case'8':_0x30a22b[_0x85f4('0x1a7')]+=0x1;_0x2760d5['state']=0x8;_0x2760d5[_0x85f4('0x6e')]=_0x85f4('0x1a8');_0x2760d5[_0x85f4('0x11f')]+=0x1;_0x2760d5[_0x85f4('0xd5')]+=0x1;_0x505854=_0x30a22b[_0x85f4('0x1a9')];_0x35c6d5=_0x30a22b['callAdditionalPhoneAfterMin'];ami[_0x85f4('0x42')]('custom:agentcongestion',ut['buildObj'](_0x370f85,'congestion'));hopperUtils['createHistory'](_0x2760d5)['catch'](loggerCatch(_0x85f4('0x1aa')));if(_0x58f2d2[_0x85f4('0x186')](0x8,_0x370f85,_0x30a22b)&&!_0x1236eb){if(_0x2760d5['countcongestionretry']>=_0x30a22b['dialCongestionMaxRetry']){_0x58f2d2[_0x85f4('0x126')](_0x2760d5,_0x5e4cb9,_0x2b8b94,_0x85f4('0x1ab'));}else{_0x58f2d2['stateGlobal'](_0x2760d5,_0x5e4cb9,_0x2b8b94,_0x85f4('0x1ab'));}}break;case'11':_0x30a22b[_0x85f4('0x1ac')]+=0x1;_0x2760d5[_0x85f4('0x6d')]=0xb;_0x2760d5[_0x85f4('0x6e')]='Abandoned';_0x2760d5[_0x85f4('0xe7')]+=0x1;_0x2760d5[_0x85f4('0xd5')]+=0x1;_0x505854=_0x30a22b['dialAbandonedRetryFrequency'];_0x35c6d5=_0x30a22b[_0x85f4('0xe8')];hopperUtils[_0x85f4('0xc8')](_0x2760d5)[_0x85f4('0x9b')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x58f2d2['checkRetriveMax'](0xb,_0x370f85,_0x30a22b)&&!_0x1236eb){if(_0x2760d5[_0x85f4('0xe7')]>=_0x30a22b[_0x85f4('0x192')]){_0x58f2d2[_0x85f4('0x126')](_0x2760d5,_0x5e4cb9,_0x2b8b94,'reason\x2011\x20abandoned');}else{_0x58f2d2[_0x85f4('0x124')](_0x2760d5,_0x5e4cb9,_0x2b8b94,_0x85f4('0x1ad'));}}break;case'20':_0x30a22b[_0x85f4('0x1ae')]+=0x1;_0x2760d5[_0x85f4('0x6d')]=0x14;_0x2760d5[_0x85f4('0x6e')]=_0x85f4('0x1af');_0x2760d5[_0x85f4('0x123')]+=0x1;_0x2760d5['countglobal']+=0x1;_0x505854=_0x30a22b['dialAgentRejectRetryFrequency'];_0x35c6d5=_0x30a22b[_0x85f4('0xe8')];ami[_0x85f4('0x42')](_0x85f4('0x1b0'),ut['buildObj'](_0x370f85,_0x85f4('0x1b1')));hopperUtils['createHistory'](_0x2760d5)['catch'](loggerCatch(_0x85f4('0x1b2')));if(_0x58f2d2[_0x85f4('0x186')](0x14,_0x370f85,_0x30a22b)&&!_0x1236eb){if(_0x2760d5[_0x85f4('0x123')]>=_0x30a22b[_0x85f4('0x1b3')]){_0x58f2d2[_0x85f4('0x126')](_0x2760d5,_0x5e4cb9,_0x2b8b94,_0x85f4('0x1b4'));}else{_0x58f2d2[_0x85f4('0x124')](_0x2760d5,_0x5e4cb9,_0x2b8b94,_0x85f4('0x1b4'));}}break;default:_0x30a22b[_0x85f4('0x132')]+=0x1;_0x2760d5[_0x85f4('0x6d')]=0xc;_0x2760d5[_0x85f4('0x6e')]=_0x494831[_0x85f4('0xc4')];_0x505854=_0x30a22b[_0x85f4('0x194')];_0x35c6d5=_0x30a22b['callAdditionalPhoneAfterMin'];hopperUtils[_0x85f4('0xc8')](_0x2760d5)[_0x85f4('0x9b')](loggerCatch(_0x85f4('0x1b5')));if(_0x58f2d2[_0x85f4('0x186')](_0x494831[_0x85f4('0xc4')],_0x370f85,_0x30a22b)&&!_0x1236eb){if(_0x2760d5['countbusyretry']+_0x2760d5[_0x85f4('0x11f')]+_0x2760d5[_0x85f4('0x120')]+_0x2760d5[_0x85f4('0x121')]+_0x2760d5['countdropretry']+_0x2760d5[_0x85f4('0xe7')]+_0x2760d5[_0x85f4('0x122')]+_0x2760d5[_0x85f4('0x123')]>=_0x30a22b[_0x85f4('0x12b')]){_0x58f2d2[_0x85f4('0x124')](_0x2760d5,_0x5e4cb9,_0x2b8b94,_0x494831[_0x85f4('0xc4')]);}else{_0x58f2d2[_0x85f4('0x126')](_0x2760d5,_0x5e4cb9,_0x2b8b94,_0x494831[_0x85f4('0xc4')]);}}}})[_0x85f4('0x40')](function(){if(_0x1236eb){hopperUtils[_0x85f4('0xec')](_0x2760d5,_0x505854,_0x35c6d5)[_0x85f4('0x40')](function(){return _0x5e4cb9(0x1);});}});});};Dialer[_0x85f4('0x1a')][_0x85f4('0x124')]=function(_0x22d450,_0x169a24,_0x5e2948,_0x32f287){var _0x1cda8a=new Final(_0x22d450);_0x1cda8a[_0x85f4('0x6d')]=0xf;_0x1cda8a[_0x85f4('0x6e')]=_0x85f4('0x1b6');this[_0x85f4('0x126')](_0x1cda8a,_0x169a24,_0x5e2948,_0x32f287);};Dialer[_0x85f4('0x1a')][_0x85f4('0x126')]=function(_0x12599c,_0x238a2a,_0x40743a,_0x40e844){hopperUtils[_0x85f4('0xca')](_0x12599c)[_0x85f4('0x40')](function(){return _0x238a2a(msgResponse(_0x85f4('0x196'),_0x85f4('0x109'),_0x40e844));})['catch'](function(){return _0x40743a(msgResponse(_0x85f4('0x1b7'),'Failure',_0x85f4('0x1b8')));});};Dialer[_0x85f4('0x1a')][_0x85f4('0xc')]=function(_0x504053){var _0x5dece9=_0x504053[_0x85f4('0x1b9')]/0x64;var _0x461111=_0x504053[_0x85f4('0xcf')]/(_0x504053['outboundDropCallsDayTimeout']+_0x504053[_0x85f4('0xc3')]);var _0x17bfd6=Math['round'](_0x504053[_0x85f4('0x1ba')]*(_0x504053[_0x85f4('0x1bb')]/0x64));var _0x3305d4=Math['round'](_0x504053[_0x85f4('0x1ba')]*(_0x504053['predictiveIntervalMinThreshold']/0x64));var _0xabf2b4=_0x504053['available']+_0x504053[_0x85f4('0x1bc')];var _0x1d4815=Math[_0x85f4('0x1bd')](_0x504053[_0x85f4('0x57')]*_0x504053[_0x85f4('0x59')]*_0x504053[_0x85f4('0x1be')]*_0x504053[_0x85f4('0x1bf')]);if(_[_0x85f4('0x41')](_0x504053[_0x85f4('0x29')])){if(!_['isUndefined'](_0x504053['startPredictive'])){_0x504053[_0x85f4('0x28')]=undefined;loggerPredictive['error'](_0x85f4('0x1c0'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x85f4('0x41')](_0x504053[_0x85f4('0x60')])){loggerPredictive[_0x85f4('0x62')](_0x85f4('0x1c0'),_0x85f4('0x1c1'));clearInterval(_0x504053[_0x85f4('0x60')]);_0x504053['handlePredictive']=undefined;}_0x504053['startProgressive']=moment()[_0x85f4('0x7c')](_0x85f4('0xc1'));loggerPredictive['info'](_0x504053[_0x85f4('0x46')],_0x85f4('0x1c2'),_0x504053[_0x85f4('0x29')]);this[_0x85f4('0xb2')](_0x504053,0x1);}else if(ifInterval(_0x504053[_0x85f4('0x1c3')],_0x504053['startProgressive'])){this[_0x85f4('0xb2')](_0x504053,0x1);loggerPredictiveCalls[_0x85f4('0x49')](_0x85f4('0x1c4'),_0x504053[_0x85f4('0x29')],_0x504053[_0x85f4('0x46')]);_0x504053[_0x85f4('0x57')]=0x0;_0x504053['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x5dece9<_0x461111&&_0x504053[_0x85f4('0x1c5')]===_0x85f4('0x1c6')){clearPredictiveAttributes(_0x504053);loggerPredictive[_0x85f4('0x49')](_0x85f4('0x1c7'),_0x85f4('0x1c8'),_0x461111,_0x85f4('0x29'),_0x504053[_0x85f4('0x46')]);}else if(_0x1d4815<_0x504053[_0x85f4('0xd0')]&&_0x504053[_0x85f4('0x1c5')]==='dropRate'){clearPredictiveAttributes(_0x504053);loggerPredictive[_0x85f4('0x49')](_0x85f4('0x1c9'),_0x85f4('0x1ca'),_0x1d4815,'Drop\x20in\x20this\x20interval',_0x504053['predictiveIntervalErlangCallsDroppedCalls'],_0x85f4('0x29'),_0x504053[_0x85f4('0x46')]);}else if(!ifInterval(_0x504053[_0x85f4('0x1c3')],_0x504053['startProgressive'])&&_[_0x85f4('0x41')](_0x504053['startPredictive'])&&!_['isUndefined'](_0x504053[_0x85f4('0x29')])){_0x504053[_0x85f4('0x28')]=moment()[_0x85f4('0x7c')](_0x85f4('0xc1'));loggerPredictive[_0x85f4('0x49')](_0x504053['name'],_0x85f4('0x1cb'),_0x504053['startPredictive']);hopperUtils['avgHandleTime'](_0x504053[_0x85f4('0x1c3')])[_0x85f4('0x40')](this[_0x85f4('0x1cc')](_0x504053))[_0x85f4('0x40')](mergeDataErlangB(_0x504053))[_0x85f4('0x40')](this[_0x85f4('0x1cd')](_0x504053))[_0x85f4('0x9b')](loggerCatchPredictive(_0x85f4('0x1ce'),_0x504053));}else if(!ifInterval(_0x504053[_0x85f4('0x1c3')],_0x504053[_0x85f4('0x28')])){_0x504053[_0x85f4('0xd0')]=0x0;_0x504053[_0x85f4('0x28')]=moment()['format'](_0x85f4('0xc1'));loggerPredictive['info'](_0x504053[_0x85f4('0x46')],_0x85f4('0x1cf'),_0x504053[_0x85f4('0x28')]);clearInterval(_0x504053[_0x85f4('0x60')]);_0x504053[_0x85f4('0x60')]=undefined;hopperUtils[_0x85f4('0x1d0')](_0x504053['dialPredictiveInterval'])[_0x85f4('0x40')](this[_0x85f4('0x1cc')](_0x504053))[_0x85f4('0x40')](mergeDataErlangB(_0x504053))[_0x85f4('0x40')](this[_0x85f4('0x1cd')](_0x504053))[_0x85f4('0x9b')](loggerCatchPredictive(_0x85f4('0x1d1'),_0x504053));}else if(_0x504053['predictiveIntervalAvailable']&&_0xabf2b4<_0x504053[_0x85f4('0x1ba')]-_0x3305d4){clearPredictiveAttributes(_0x504053);loggerPredictive[_0x85f4('0x49')](_0x504053['name'],_0x85f4('0x1d2'),_0xabf2b4,_0x85f4('0x1d3'),_0x504053['predictiveIntervalAvailable'],'-',_0x3305d4,'=',_0x504053[_0x85f4('0x1ba')]-_0x3305d4,')');}else if(_0x504053['predictiveIntervalAvailable']&&_0xabf2b4>_0x504053[_0x85f4('0x1ba')]+_0x17bfd6){clearPredictiveAttributes(_0x504053);loggerPredictive['info'](_0x504053[_0x85f4('0x46')],_0x85f4('0x1d2'),_0xabf2b4,_0x85f4('0x1d4'),_0x504053[_0x85f4('0x1ba')],'+',_0x17bfd6,'=',_0x504053[_0x85f4('0x1ba')]+_0x17bfd6,')');}};Dialer['prototype'][_0x85f4('0x1cc')]=function(_0x65ba46){var _0x490ffd=this;return function(_0xa3cd95){return new Promise(function(_0x3419b2,_0x3eb144){_[_0x85f4('0x5d')](_0x65ba46,_0xa3cd95[0x0]);if(checkGetDataPredictive(_0xa3cd95[0x0])){var _0x244a1e=_0x65ba46[_0x85f4('0x1ba')]=_0x65ba46[_0x85f4('0x1bc')]+_0x65ba46['available'];var _0x418500=_0x65ba46[_0x85f4('0x1c3')]*0x3c;var _0x5e1754=_0xa3cd95[0x0][_0x85f4('0x52')]+_0xa3cd95[0x0][_0x85f4('0x50')];var _0x3e73a9=(_0xa3cd95[0x0][_0x85f4('0x1d5')]+_0xa3cd95[0x0][_0x85f4('0x4d')]+_0xa3cd95[0x0][_0x85f4('0xe4')])/_0xa3cd95[0x0][_0x85f4('0x4b')];_0x65ba46[_0x85f4('0x1be')]=_0x3e73a9>0x0?_0x3e73a9:0x1;switch(_0x65ba46[_0x85f4('0x1c5')]){case'dropRate':var _0x5c0b82=_0x65ba46['dialPredictiveOptimizationPercentage']/0x64;return _0x490ffd['abandonmentRate'](_0x244a1e,_0x418500,_0x5e1754,_0x3e73a9,_0x5c0b82)[_0x85f4('0x40')](function(_0x2542a2){return _0x3419b2(_0x2542a2);});case _0x85f4('0x1d6'):var _0x244112=_0x65ba46[_0x85f4('0x1b9')]/0x64;return _0x490ffd['busyFactor'](_0x244a1e,_0x418500,_0x5e1754,_0x3e73a9,_0x244112)['then'](function(_0x5aff43){return _0x3419b2(_0x5aff43);});default:return _0x3eb144(msgResponse(_0x85f4('0x1d7'),_0x85f4('0x8e'),_0x85f4('0x1d8')));}}else{return _0x3eb144(msgResponse('[getDataPredictive]',_0x85f4('0x8e'),_0x85f4('0x1d9')));}});};};Dialer['prototype'][_0x85f4('0x1da')]=function(_0x8cd4c6){var _0xaa3689=this;return function(_0x3a8cf8){return new Promise(function(_0x2472fe,_0x2a5d9f){_['merge'](_0x8cd4c6,_0x3a8cf8[0x0]);if(checkGetDataPredictive(_0x3a8cf8[0x0])){loggerPredictive[_0x85f4('0x49')](JSON[_0x85f4('0x74')](_0x3a8cf8[0x0]));if(_0x8cd4c6['dialPredictiveOptimization']===_0x85f4('0x1c6')){return _0xaa3689[_0x85f4('0x14c')](_0x8cd4c6['id'])[_0x85f4('0x40')](function(_0x2bd059){var _0x4c4e24=_0x8cd4c6['loggedIn']-_0x2bd059[0x0][_0x85f4('0x1db')];var _0x6eca9=_0x8cd4c6[_0x85f4('0x1c3')]*0x3c;var _0x17cb81=_0x3a8cf8[0x0][_0x85f4('0x52')]+_0x3a8cf8[0x0][_0x85f4('0x50')];var _0x388cac=(_0x3a8cf8[0x0]['predictiveIntervalAnsweredCalls']+_0x3a8cf8[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3a8cf8[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3a8cf8[0x0][_0x85f4('0x4b')];var _0x2112a3=_0x8cd4c6['dialPredictiveOptimizationPercentage']/0x64;_0x8cd4c6['predictiveIntervalPauses']=_0x2bd059[0x0]['outboundQueuePauses']||0x0;_0x8cd4c6['predictiveIntervalHitRate']=_0x388cac>0x0?_0x388cac:0x1;return _0xaa3689['abandonmentRate'](_0x4c4e24,_0x6eca9,_0x17cb81,_0x388cac,_0x2112a3);})[_0x85f4('0x40')](function(_0x59248f){return _0x2472fe(_0x59248f);})[_0x85f4('0x9b')](function(_0x27922e){return _0x2a5d9f(msgResponse(_0x85f4('0x1dc'),'Failure',JSON[_0x85f4('0x74')](_0x27922e)));});}if(_0x8cd4c6[_0x85f4('0x1c5')]===_0x85f4('0x1d6')){return _0xaa3689[_0x85f4('0x14c')](_0x8cd4c6['id'])[_0x85f4('0x40')](function(_0x4b5191){var _0x4c343b=_0x8cd4c6[_0x85f4('0x1dd')]-_0x4b5191[0x0][_0x85f4('0x1db')];var _0x12d831=_0x8cd4c6[_0x85f4('0x1c3')]*0x3c;var _0x3329a5=_0x3a8cf8[0x0][_0x85f4('0x52')]+_0x3a8cf8[0x0]['predictiveIntervalAvgHoldtime'];var _0x18ef7d=(_0x3a8cf8[0x0][_0x85f4('0x1d5')]+_0x3a8cf8[0x0][_0x85f4('0x4d')]+_0x3a8cf8[0x0][_0x85f4('0xe4')])/_0x3a8cf8[0x0][_0x85f4('0x4b')];var _0x506b0d=_0x8cd4c6[_0x85f4('0x1b9')]/0x64;_0x8cd4c6[_0x85f4('0x1de')]=_0x4b5191[0x0][_0x85f4('0x1db')]||0x0;_0x8cd4c6[_0x85f4('0x1be')]=_0x18ef7d>0x0?_0x18ef7d:0x1;return _0xaa3689[_0x85f4('0x1df')](_0x4c343b,_0x12d831,_0x3329a5,_0x18ef7d,_0x506b0d);})[_0x85f4('0x40')](function(_0x5b1e68){return _0x2472fe(_0x5b1e68);})[_0x85f4('0x9b')](function(_0x76f6f1){return _0x2a5d9f(msgResponse(_0x85f4('0x1dc'),_0x85f4('0x8e'),JSON[_0x85f4('0x74')](_0x76f6f1)));});}}else{return _0x2a5d9f(msgResponse(_0x85f4('0x1d7'),'Failure',_0x85f4('0x1d9')));}});};};Dialer[_0x85f4('0x1a')][_0x85f4('0x1cd')]=function(_0x532a43){var _0x654442=this;return function(){var _0x798bb4=0x0;var _0x2aa16a=Math['floor'](_0x532a43[_0x85f4('0x1e0')]*0x3e8);if(_0x2aa16a>0x0){_0x2aa16a=_0x2aa16a<0x64?0x64:_0x2aa16a;loggerPredictive[_0x85f4('0x49')](_0x532a43['name'],'one\x20call\x20every:',_0x2aa16a,_0x85f4('0x1e1'));_0x532a43[_0x85f4('0x60')]=setInterval(function(){_0x654442[_0x85f4('0x60')](_0x532a43);loggerPredictiveCalls[_0x85f4('0x49')](_0x85f4('0x1e2'),_0x798bb4+=0x1);},_0x2aa16a);}else{loggerPredictive[_0x85f4('0x49')](_0x532a43[_0x85f4('0x46')],_0x85f4('0x1e3'));}};};Dialer[_0x85f4('0x1a')][_0x85f4('0x1e4')]=function(_0x179ea1,_0x8e494e){var _0x374fc2=this;return function(_0x1eedf9){if(_[_0x85f4('0x47')](_0x1eedf9)){if(_[_0x85f4('0xf2')](_0x8e494e[_0x85f4('0x152')])||!_0x8e494e[_0x85f4('0x1e5')]){if(_0x179ea1[_0x85f4('0xb0')]===_0x85f4('0xb')){_0x179ea1[_0x85f4('0x71')]=_[_0x85f4('0x41')](_0x179ea1[_0x85f4('0x71')])?!![]:_0x179ea1['queueStatusComplete'];var _0x573699=uuid['v4']();_0x374fc2['actions'][_0x573699]=new Action(_0x179ea1,_0x8e494e,_0x573699);loggerBooked[_0x85f4('0x49')]('[booked][checkContactBlack]',_0x573699,_0x85f4('0x1e6'),JSON[_0x85f4('0x74')](_0x179ea1[_0x85f4('0x71')]),_0x85f4('0x1e7'),_0x179ea1[_0x85f4('0x46')]);if(_0x179ea1[_0x85f4('0x71')]){_0x179ea1['queueStatusComplete']=![];_0x374fc2[_0x85f4('0x2b')][_0x374fc2[_0x85f4('0x24')][_0x573699][_0x85f4('0xbc')]]=[];ami[_0x85f4('0x95')]({'actionid':_0x573699,'action':_0x85f4('0x1e8'),'queue':_0x179ea1['name']})['catch'](function(){_0x374fc2[_0x85f4('0xbf')](_0x179ea1);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x374fc2[_0x85f4('0x24')][_0x573699][_0x85f4('0xdd')],'ListId':_0x374fc2[_0x85f4('0x24')][_0x573699]['ListId'],'VoiceQueueId':_0x374fc2['actions'][_0x573699][_0x85f4('0xdf')]||undefined,'CampaignId':_0x374fc2['actions'][_0x573699][_0x85f4('0xf8')]||undefined})[_0x85f4('0x9b')](loggerCatch(_0x85f4('0x1e9')));delete _0x374fc2[_0x85f4('0x24')][_0x573699];});}else{loggerBooked[_0x85f4('0x49')](_0x85f4('0x1ea'),JSON[_0x85f4('0x74')](_0x179ea1[_0x85f4('0x71')]),_0x85f4('0x1e7'),_0x179ea1['name']);_0x374fc2[_0x85f4('0xbf')](_0x179ea1);hopperUtils[_0x85f4('0xda')]({'active':![],'ContactId':_0x374fc2[_0x85f4('0x24')][_0x573699][_0x85f4('0xdd')],'ListId':_0x374fc2[_0x85f4('0x24')][_0x573699]['ListId'],'VoiceQueueId':_0x374fc2['actions'][_0x573699][_0x85f4('0xdf')]||undefined,'CampaignId':_0x374fc2[_0x85f4('0x24')][_0x573699][_0x85f4('0xf8')]||undefined})[_0x85f4('0x9b')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x374fc2[_0x85f4('0x24')][_0x573699];}}else{return _0x374fc2[_0x85f4('0x156')](_0x179ea1,_0x8e494e);}}else{if(utils[_0x85f4('0x5e')](undefined,_0x8e494e[_0x85f4('0x1eb')])<_0x179ea1['dialRecallMeTimeout']*0x3c){if(_0x8e494e[_0x85f4('0x144')]&&!_0x8e494e[_0x85f4('0x144')][_0x85f4('0x1ec')]){_0x374fc2[_0x85f4('0x1e')][_0x85f4('0x100')](_0x8e494e['id'])[_0x85f4('0x1d')](function(){_0x374fc2['updateOriginated'](_0x179ea1);});}else{hopperUtils[_0x85f4('0x1ed')]({'active':![]},_0x8e494e['id'],0x1)['finally'](function(){_0x374fc2['updateOriginated'](_0x179ea1);});}}else{_0x179ea1[_0x85f4('0x1ee')]+=0x1;_0x374fc2[_0x85f4('0xbf')](_0x179ea1);if(_0x179ea1[_0x85f4('0x1ef')]){hopperUtils[_0x85f4('0xda')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x8e494e['ContactId'],'ListId':_0x8e494e[_0x85f4('0xde')],'VoiceQueueId':_0x8e494e['VoiceQueueId']||undefined,'CampaignId':_0x8e494e['CampaignId']||undefined})[_0x85f4('0x9b')](loggerCatch(_0x85f4('0x1f0')));hopperUtils[_0x85f4('0xc8')](createObjHistory(_0x179ea1,_0x8e494e,utils['CAMPAIGN_STATUS']['QUEUE_RECALL'],0x17,_0x85f4('0x1f1')))[_0x85f4('0x9b')](loggerCatch(_0x85f4('0x1f2')));}else{_0x374fc2[_0x85f4('0x118')](createObjHistory(_0x179ea1,_0x8e494e,utils[_0x85f4('0x67')][_0x85f4('0x1f3')],0x16,_0x85f4('0x1f4')),_0x85f4('0x1f5'),_0x85f4('0x1f6'));}}}}else{_0x179ea1[_0x85f4('0x1f7')]+=0x1;_0x374fc2[_0x85f4('0x118')](createObjHistory(_0x179ea1,_0x8e494e,utils['CAMPAIGN_STATUS'][_0x85f4('0x1f8')],0xd,'Blacklist'),_0x85f4('0x1f9'),_0x85f4('0x1fa'));throw _0x85f4('0x1fb');}};};Dialer[_0x85f4('0x1a')][_0x85f4('0x155')]=function(_0x233790){var _0x4f2184=this;var _0x158f74=_0x233790[_0x85f4('0x1fc')]-_0x233790['originated'];emitCampaignSummary(_0x233790);if(_0x158f74>0x0&&_0x233790['temp']==0x0){if(_0x158f74>this[_0x85f4('0x23')]){_0x158f74=this['maxNumberOriginate'];}_0x233790[_0x85f4('0x65')]=0x1;hopperUtils[_0x85f4('0x1fd')](_0x233790,_0x158f74)[_0x85f4('0x40')](function(_0x24b858){_0x233790[_0x85f4('0x65')]=0x0;if(_0x24b858){if(!utils[_0x85f4('0x1fe')](_0x24b858)){_0x233790['message']=utils[_0x85f4('0x67')][_0x85f4('0x6c')];logger['info'](_0x85f4('0x1ff')+_0x233790[_0x85f4('0x46')]);}else{_0x233790[_0x85f4('0x14d')]+=_0x24b858['length'];_0x233790['message']=utils['CAMPAIGN_STATUS'][_0x85f4('0x200')];for(var _0x1c8890=0x0;_0x1c8890<_0x24b858[_0x85f4('0xfb')];_0x1c8890+=0x1){_0x233790['ivrTotalCallsDays']+=0x1;if(_[_0x85f4('0xf2')](_0x24b858[_0x1c8890])||_[_0x85f4('0xf2')](_0x24b858[_0x1c8890][_0x85f4('0x201')])||_['isNil'](_0x24b858[_0x1c8890][_0x85f4('0x159')])){_0x4f2184[_0x85f4('0x150')](_0x85f4('0x202'),_0x233790,_0x24b858[_0x1c8890]);}else{hopperUtils[_0x85f4('0x203')](_[_0x85f4('0x75')](_0x24b858[_0x1c8890],[_0x85f4('0xf8'),_0x85f4('0x159')]))[_0x85f4('0x40')](_0x4f2184[_0x85f4('0x1e4')](_0x233790,_0x24b858[_0x1c8890]))[_0x85f4('0x9b')](_0x4f2184[_0x85f4('0x14f')]('[actionOriginateIvr]\x20',_0x233790));}}}}})['catch'](loggerGetContactDialer(_0x85f4('0x204'),_0x233790,_0x158f74));}};Dialer['prototype']['handlePower']=function(_0x50558a,_0x4477f5){var _0x3eb5a5=this;var _0x4383e0=[];if(_0x4477f5<0x1||_0x50558a[_0x85f4('0xb0')]==='booked'){_0x4477f5=0x1;}var _0x43b623=Math['floor'](_0x50558a['available']*_0x4477f5)-_0x50558a[_0x85f4('0x14d')];if(_0x50558a[_0x85f4('0x205')]>0x0){var _0x32f824=_0x50558a[_0x85f4('0x205')]-_0x50558a[_0x85f4('0x14d')]-_0x50558a[_0x85f4('0x1bc')]-_0x50558a['pTalking'];if(_0x43b623>_0x32f824){_0x43b623=_0x32f824;}}if(_0x43b623>0x0&&_0x50558a[_0x85f4('0x65')]==0x0){if(_0x50558a[_0x85f4('0xb0')]===_0x85f4('0xb')){_0x43b623=0x1;}if(_0x43b623>this[_0x85f4('0x23')]){_0x43b623=this[_0x85f4('0x23')];}for(var _0x2fe3dd in this['agents']){if(typeof this['agents'][_0x2fe3dd]!==_0x85f4('0xa7')){if(this[_0x85f4('0x21')][_0x2fe3dd][_0x85f4('0x6d')]===_0x85f4('0x206')&&this[_0x85f4('0x21')][_0x2fe3dd]['status']===_0x85f4('0x87')){_0x4383e0[_0x85f4('0x94')](this[_0x85f4('0x21')][_0x2fe3dd]['id']);}}}_0x50558a['temp']=0x1;hopperUtils[_0x85f4('0x207')](_0x50558a,_0x4383e0,_0x43b623)[_0x85f4('0x40')](function(_0x1b2291){_0x50558a[_0x85f4('0x65')]=0x0;if(_0x1b2291){if(!utils[_0x85f4('0x1fe')](_0x1b2291)){hopperUtils[_0x85f4('0x208')](_0x50558a)[_0x85f4('0x40')](sendMessageReschedule(_0x50558a))[_0x85f4('0x9b')](loggerCatch(_0x85f4('0x209')));}else{_0x50558a[_0x85f4('0x14d')]+=_0x1b2291[_0x85f4('0xfb')];_0x50558a[_0x85f4('0x6b')]=_0x50558a[_0x85f4('0xb0')]==='booked'?utils[_0x85f4('0x67')][_0x85f4('0x163')]:utils[_0x85f4('0x67')]['RUNNING'];for(var _0x46ca43=0x0;_0x46ca43<_0x1b2291[_0x85f4('0xfb')];_0x46ca43+=0x1){if(_['isNil'](_0x1b2291[_0x46ca43])||_['isNil'](_0x1b2291[_0x46ca43][_0x85f4('0x201')])||_[_0x85f4('0xf2')](_0x1b2291[_0x46ca43][_0x85f4('0x159')])){_0x3eb5a5[_0x85f4('0x150')](_0x85f4('0x202'),_0x50558a,_0x1b2291[_0x46ca43]);}else{hopperUtils[_0x85f4('0x20a')](_[_0x85f4('0x75')](_0x1b2291[_0x46ca43],[_0x85f4('0xdf'),'phone']))['then'](_0x3eb5a5[_0x85f4('0x1e4')](_0x50558a,_0x1b2291[_0x46ca43]))[_0x85f4('0x9b')](_0x3eb5a5['loggerHandler'](_0x85f4('0x202'),_0x50558a));}}}}})[_0x85f4('0x9b')](loggerGetContactDialer(_0x85f4('0x20b'),_0x50558a,_0x43b623));}};Dialer[_0x85f4('0x1a')]['handlePredictive']=function(_0x4178f1){if(_0x4178f1[_0x85f4('0x205')]>0x0){var _0x51f304=_0x4178f1['dialLimitQueue']-_0x4178f1[_0x85f4('0x14d')]-_0x4178f1['talking'];if(_0x51f304>0x0&&_0x4178f1[_0x85f4('0x65')]==0x0){this[_0x85f4('0x20c')](_0x4178f1);}else{loggerPredictiveCalls[_0x85f4('0x49')](_0x85f4('0x20d'));}}else{this[_0x85f4('0x20c')](_0x4178f1);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x51f734){var _0x52e1c9=this;var _0x5c900f=[];_0x51f734[_0x85f4('0x14d')]+=0x1;for(var _0x6df7d in this[_0x85f4('0x21')]){if(typeof this[_0x85f4('0x21')][_0x6df7d]!==_0x85f4('0xa7')){if(this[_0x85f4('0x21')][_0x6df7d][_0x85f4('0x6d')]==='not_inuse'&&this['agents'][_0x6df7d][_0x85f4('0xf7')]==='reachable'){_0x5c900f[_0x85f4('0x94')](this['agents'][_0x6df7d]['id']);}}}_0x51f734[_0x85f4('0x65')]=0x1;return this['getContactDialer'](_0x51f734['id'],_0x5c900f,0x1,_0x51f734['dialOrderByScheduledAt'],_0x51f734)['then'](function(_0x1ef4c3){_0x51f734[_0x85f4('0x65')]=0x1;if(_0x1ef4c3){if(!utils[_0x85f4('0x1fe')](_0x1ef4c3)){utils['checkContactLowerLimitOriginate'](_0x51f734,0x1,0x0);return hopperUtils[_0x85f4('0x208')](_0x51f734)[_0x85f4('0x40')](sendMessageReschedule(_0x51f734))[_0x85f4('0x9b')](loggerCatch(_0x85f4('0x209')));}else{_0x51f734[_0x85f4('0x6b')]=utils[_0x85f4('0x67')][_0x85f4('0x200')];if(_[_0x85f4('0xf2')](_0x1ef4c3[0x0])||_[_0x85f4('0xf2')](_0x1ef4c3[0x0]['Contact'])||_[_0x85f4('0xf2')](_0x1ef4c3[0x0]['phone'])){_0x52e1c9[_0x85f4('0x150')](_0x85f4('0x202'),_0x51f734,_0x1ef4c3[0x0]);}else{return hopperUtils[_0x85f4('0x20a')](_[_0x85f4('0x75')](_0x1ef4c3[0x0],[_0x85f4('0xdf'),_0x85f4('0x159')]))['then'](_0x52e1c9[_0x85f4('0x1e4')](_0x51f734,_0x1ef4c3[0x0]))[_0x85f4('0x9b')](_0x52e1c9[_0x85f4('0x14f')](_0x85f4('0x20e'),_0x51f734));}}}})[_0x85f4('0x9b')](loggerGetContactDialer('[getContactDialerPredictive]',_0x51f734,0x1));};Dialer[_0x85f4('0x1a')][_0x85f4('0x20f')]=function(_0x2d003b,_0x3ca36c,_0x369c7f,_0x5d3b5d,_0x2ea82a,_0x211076){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x85f4('0x49')](_0x85f4('0x210'),_0x2d003b);loggerPredictive['info'](_0x85f4('0x211'),_0x3ca36c);loggerPredictive[_0x85f4('0x49')](_0x85f4('0x212'),_0x369c7f);loggerPredictive[_0x85f4('0x49')]('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',_0x5d3b5d);loggerPredictive[_0x85f4('0x49')](_0x85f4('0x213'),_0x2ea82a);loggerPredictive[_0x85f4('0x49')](_0x85f4('0x5c'));return new Promise(function(_0x208f79,_0x1c50ca){if(_0x2d003b<=0x0||isNaN(_0x2d003b)){return _0x1c50ca(msgResponse(_0x85f4('0x214'),_0x85f4('0x83'),'m\x20=\x20'+_0x2d003b));}if(_0x369c7f<=0x0||isNaN(_0x369c7f)){return _0x1c50ca(msgResponse(_0x85f4('0x214'),_0x85f4('0x83'),_0x85f4('0x215')+_0x369c7f));}if(_0x5d3b5d<=0x0||isNaN(_0x5d3b5d)){return _0x1c50ca(msgResponse(_0x85f4('0x214'),_0x85f4('0x83'),_0x85f4('0x216')+_0x5d3b5d));}if(_0x3ca36c<=0x0||isNaN(_0x3ca36c)){return _0x1c50ca(msgResponse('[abandonmentRate]',_0x85f4('0x83'),_0x85f4('0x217')+_0x3ca36c));}if(_0x2ea82a<=0x0||isNaN(_0x2ea82a)){return _0x1c50ca(msgResponse(_0x85f4('0x214'),'Error',_0x85f4('0x218')+_0x2ea82a));}_0x211076=_0x211076||0x0;var _0x1bc203=0x1/_0x369c7f;var _0x3eec3d=0x0;var _0xb10880=0x0;var _0x1a11e1=0x0;var _0x1efe66=0x0;for(var _0x513a4d=0x0;_0x1a11e1<_0x2ea82a;_0x513a4d+=0x1){_0xb10880=_0x513a4d/_0x3ca36c;_0x3eec3d=(_0x5d3b5d*_0xb10880+_0x211076)/_0x1bc203;_0x1a11e1=utils[_0x85f4('0x219')](_0x3eec3d,_0x2d003b);_0x1efe66=_0x3eec3d/_0x2d003b*(0x1-utils[_0x85f4('0x219')](_0x3eec3d,_0x2d003b));}return _0x208f79({'erlangCalls':_0x513a4d,'erlangCallToSecond':_0x3ca36c/_0x513a4d,'erlangAbandonmentRate':_0x1a11e1,'erlangBusyFactor':_0x1efe66});});};Dialer[_0x85f4('0x1a')][_0x85f4('0x1df')]=function(_0x3adb48,_0x4490a3,_0x41b476,_0xe9adaf,_0x5a210e,_0x235acd){loggerPredictive[_0x85f4('0x49')](_0x85f4('0x21a'));loggerPredictive['info'](_0x85f4('0x210'),_0x3adb48);loggerPredictive[_0x85f4('0x49')](_0x85f4('0x211'),_0x4490a3);loggerPredictive[_0x85f4('0x49')](_0x85f4('0x212'),_0x41b476);loggerPredictive['info']('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',_0xe9adaf);loggerPredictive[_0x85f4('0x49')](_0x85f4('0x21b'),_0x5a210e);loggerPredictive[_0x85f4('0x49')](_0x85f4('0x5c'));return new Promise(function(_0x296208,_0x144f7c){if(_0x3adb48<=0x0||isNaN(_0x3adb48)){return _0x144f7c(msgResponse('[busyFactor]',_0x85f4('0x83'),_0x85f4('0x21c')+_0x3adb48));}if(_0x41b476<=0x0||isNaN(_0x41b476)){return _0x144f7c(msgResponse(_0x85f4('0x21d'),_0x85f4('0x83'),_0x85f4('0x215')+_0x41b476));}if(_0xe9adaf<=0x0||isNaN(_0xe9adaf)){return _0x144f7c(msgResponse(_0x85f4('0x21d'),_0x85f4('0x83'),_0x85f4('0x216')+_0xe9adaf));}if(_0x4490a3<=0x0||isNaN(_0x4490a3)){return _0x144f7c(msgResponse(_0x85f4('0x21d'),_0x85f4('0x83'),_0x85f4('0x217')+_0x4490a3));}if(_0x5a210e<=0x0||isNaN(_0x5a210e)){return _0x144f7c(msgResponse('[busyFactor]',_0x85f4('0x83'),_0x85f4('0x21e')+_0x5a210e));}_0x235acd=_0x235acd||0x0;var _0x366119=0x1/_0x41b476;var _0x1a43b3=0x0;var _0x270cbf=0x0;var _0xbdaad4=0x0;var _0xc45ae0=0x0;for(var _0x27f2a0=0x0;_0xc45ae0<_0x5a210e;_0x27f2a0+=0x1){_0x270cbf=_0x27f2a0/_0x4490a3;_0x1a43b3=(_0xe9adaf*_0x270cbf+_0x235acd)/_0x366119;_0xbdaad4=utils['erlangb'](_0x1a43b3,_0x3adb48);_0xc45ae0=_0x1a43b3/_0x3adb48*(0x1-utils['erlangb'](_0x1a43b3,_0x3adb48));}return _0x296208({'erlangCalls':_0x27f2a0,'erlangCallToSecond':_0x4490a3/_0x27f2a0,'erlangAbandonmentRate':_0xbdaad4,'erlangBusyFactor':_0xc45ae0});});};module['exports']=Dialer; \ No newline at end of file +var _0x027b=['OVERTIME_INTERVAL','[ifTime][promiseAll]','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','queue','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agent','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','moveContactManagedDialer','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','TIMEOUT','agiafterat','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','minutes','ListId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','CALLEREXIT','countabandonedretry','add','dialAbandonedRetryFrequency','ContactId','[rescheduleContact][Abandoned]','Abandoned','actions','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','push','idHopper','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','finally','VoiceQueueId','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','pick','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','amdstatus','exten','value','HangupInAMD','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','dialAMDActive','Machine','membername','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr]','MACHINE','outboundAnswerAgiCallsDay','dialMachineMaxRetry','dialMachineRetryFrequency','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','Unknow','syncQueueSummary','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','dialPreviewRecallmeReminder','filter','online','handlePreviewRecallNotifications','map','user:dialPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','UserId','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','Agent','user:%s','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','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','assign','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','substring','trim','dialCutDigit','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangAbandonmentRate','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','Max\x20Drop\x20','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','busyFactor','erlangCallToSecond','milliseconds','[handlePredictive]','checkContactBlack','[booked][checkContactBlack]','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','[countReScheduled]\x20','dialMethod','RUNNING','checkIsBlackList','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','getContactDialer','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','util','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','predictiveIntervalAvgHoldtime','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','isIVRCampaign','campaign:save','originated','INACTIVE','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','status','reachable','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','Action','iftime\x20%s,%s','interval','content','indexOf','true','command','catch','all','some','OVERTIME_GLOBAL_INTERVAL','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','undefined','resolve','dialTimezone','checkIfTimeIntervals','launchHandleIvr','[syncCampaigns]','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime'];(function(_0x22754d,_0x3ffa6b){var _0x4e2724=function(_0x3e4691){while(--_0x3e4691){_0x22754d['push'](_0x22754d['shift']());}};_0x4e2724(++_0x3ffa6b);}(_0x027b,0x170));var _0xb027=function(_0x538ee5,_0x33ae3d){_0x538ee5=_0x538ee5-0x0;var _0x4cfd10=_0x027b[_0x538ee5];return _0x4cfd10;};'use strict';var util=require(_0xb027('0x0'));var _=require('lodash');var uuid=require('uuid');var moment=require(_0xb027('0x1'));var rr=require('rr');var Redis=require(_0xb027('0x2'));var utils=require(_0xb027('0x3'));var hopperUtils=require(_0xb027('0x4'));var ut=require(_0xb027('0x5'));var config=require(_0xb027('0x6'));var logger=require(_0xb027('0x7'))('dialer');var loggerBooked=require(_0xb027('0x7'))(_0xb027('0x8'));var loggerPredictive=require(_0xb027('0x7'))(_0xb027('0x9'));var loggerPredictiveCalls=require(_0xb027('0x7'))(_0xb027('0xa'));var loggerSyncQueueSummary=require(_0xb027('0x7'))('syncQueueSummary');var ami=require(_0xb027('0xb'));config[_0xb027('0xc')]=_['defaults'](config[_0xb027('0xc')],{'host':_0xb027('0xd'),'port':0x18eb});var io=require(_0xb027('0xe'))(new Redis(config[_0xb027('0xc')]));var cmHopper=require(_0xb027('0xf'));var voiceQueueRt=require(_0xb027('0x10'));var RpcSetting=require(_0xb027('0x11'));var Interval=require(_0xb027('0x12'));var Action=require(_0xb027('0x13'));var History=require('./models/history');var Final=require(_0xb027('0x14'));var AgentComplete=require(_0xb027('0x15'));var QueueCallerAbandon=require(_0xb027('0x16'));var Hangup=require(_0xb027('0x17'));var ipAgi=process[_0xb027('0x18')][_0xb027('0x19')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xb027('0x1a')][_0xb027('0x1b')]=function(_0x3d266e){this[_0xb027('0x1c')]=this[_0xb027('0x1c')]?this[_0xb027('0x1c')]['finally'](_0x3d266e):_0x3d266e();};function Dialer(_0x4b14fd,_0x57c342){this[_0xb027('0x1d')]=new Sequence();this[_0xb027('0x1e')]=_0x57c342;this['voiceQueues']=_0x4b14fd[_0xb027('0x1f')];this[_0xb027('0x20')]=_0x4b14fd[_0xb027('0x20')];this[_0xb027('0x21')]=_0x4b14fd[_0xb027('0x21')];this[_0xb027('0x22')]=_0x4b14fd[_0xb027('0x22')];this[_0xb027('0x23')]=config[_0xb027('0x23')]||0x2;this[_0xb027('0x24')]={};this['actions']={};this[_0xb027('0x25')]={};this[_0xb027('0x26')]={};this[_0xb027('0x27')]={};this[_0xb027('0x28')]={};this['startProgressive']={};this[_0xb027('0x29')]={};this[_0xb027('0x2a')]={};this[_0xb027('0x2b')]={};this['queuesSummary']={};ami['on']('agentconnect',this[_0xb027('0x2c')][_0xb027('0x2d')](this));ami['on'](_0xb027('0x2e'),this['syncQueueCallerAbandon'][_0xb027('0x2d')](this));ami['on'](_0xb027('0x2f'),this['syncOriginateResponse'][_0xb027('0x2d')](this));ami['on']('agentcomplete',this[_0xb027('0x30')][_0xb027('0x2d')](this));ami['on'](_0xb027('0x31'),this['syncQueueSummary'][_0xb027('0x2d')](this));ami['on'](_0xb027('0x32'),this[_0xb027('0x33')]['bind'](this));ami['on'](_0xb027('0x34'),this['syncHangup']['bind'](this));ami['on'](_0xb027('0x35'),this[_0xb027('0x36')][_0xb027('0x2d')](this));ami['on'](_0xb027('0x37'),this[_0xb027('0x38')][_0xb027('0x2d')](this));ami['on']('queuemember',this[_0xb027('0x39')][_0xb027('0x2d')](this));ami['on'](_0xb027('0x3a'),this['syncQueueStatusComplete'][_0xb027('0x2d')](this));this[_0xb027('0x3b')]();this[_0xb027('0x3c')]();RpcSetting[_0xb027('0x3d')]()[_0xb027('0x3e')](function(_0x45d8fd){previewRecallmeReminderInterval=_0x45d8fd[_0xb027('0x3f')];});}function isNotNull(_0x727f6d){return _0x727f6d!==null&&!_[_0xb027('0x40')](_0x727f6d);}function msgResponse(_0x3aabd1,_0x2733af,_0x421fe9){return{'action':_0x3aabd1,'response':_0x2733af,'message':_0x421fe9,'stack':_0x421fe9};}function emit(_0x5a2735,_0xb86409,_0x2aede0){io['to'](_0x5a2735)[_0xb027('0x41')](_0xb86409,_0x2aede0);}function emitOutboundVoiceQueueSummary(_0x250b6d){if(_0x250b6d[_0xb027('0x42')]===_0xb027('0x43')){logger[_0xb027('0x44')](_0xb027('0x45'),util[_0xb027('0x46')](_0x250b6d,{'showHidden':![],'depth':null}));emit(util[_0xb027('0x47')](_0xb027('0x48'),_0x250b6d[_0xb027('0x49')]),_0xb027('0x4a'),_0x250b6d);}}function checkGetDataPredictive(_0x21dd4d){if(isNotNull(_0x21dd4d)&&!_[_0xb027('0x4b')](_0x21dd4d)){loggerPredictive[_0xb027('0x4c')](_0xb027('0x4d'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x21dd4d[_0xb027('0x4e')]);loggerPredictive[_0xb027('0x4c')](_0xb027('0x4f'),_0x21dd4d[_0xb027('0x50')]);loggerPredictive[_0xb027('0x4c')](_0xb027('0x51'),_0x21dd4d['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xb027('0x4c')](_0xb027('0x52'),_0x21dd4d[_0xb027('0x53')]);loggerPredictive[_0xb027('0x4c')](_0xb027('0x54'),_0x21dd4d['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xb027('0x4c')](_0xb027('0x55'),_0x21dd4d[_0xb027('0x56')]);loggerPredictive[_0xb027('0x4c')]('---------------------------');if(_0x21dd4d[_0xb027('0x4e')]>0x0){if(!_['isUndefined'](_0x21dd4d['predictiveIntervalAvgTalktime'])&&_0x21dd4d[_0xb027('0x56')]>0x0){return!![];}loggerPredictive[_0xb027('0x4c')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xb027('0x40')](_0x21dd4d['predictiveIntervalAvgHoldtime'])&&_0x21dd4d[_0xb027('0x57')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xb027('0x4c')](_0xb027('0x58'));}return![];}function mergeDataErlangB(_0x181b34){return function(_0x7cda8){loggerPredictive[_0xb027('0x4c')](_0xb027('0x59'));loggerPredictive[_0xb027('0x4c')](_0xb027('0x5a'),_0x7cda8[_0xb027('0x5b')]);loggerPredictive[_0xb027('0x4c')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x7cda8['erlangCallToSecond']);loggerPredictive[_0xb027('0x4c')](_0xb027('0x5c'),_0x7cda8['erlangAbandonmentRate']);loggerPredictive[_0xb027('0x4c')](_0xb027('0x5d'),_0x7cda8[_0xb027('0x5e')]);loggerPredictive[_0xb027('0x4c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x7cda8['erlangAbandonmentRate']);loggerPredictive[_0xb027('0x4c')]('---------------------------');_[_0xb027('0x5f')](_0x181b34,_0x7cda8);};}function ifInterval(_0x11adb6,_0x64a6fd){if(_[_0xb027('0x40')](_0x64a6fd)){return![];}return utils[_0xb027('0x60')](undefined,_0x64a6fd)<_0x11adb6*0x3c;}function clearPredictiveAttributes(_0x2e3951){if(_0x2e3951[_0xb027('0x61')]){_0x2e3951[_0xb027('0x61')]=undefined;loggerPredictive[_0xb027('0x44')](_0x2e3951['name'],_0xb027('0x62'));}if(_0x2e3951[_0xb027('0x28')]){_0x2e3951[_0xb027('0x28')]=undefined;loggerPredictive[_0xb027('0x44')](_0x2e3951[_0xb027('0x49')],_0xb027('0x63'));}if(_0x2e3951[_0xb027('0x64')]){clearInterval(_0x2e3951[_0xb027('0x64')]);_0x2e3951['handlePredictive']=undefined;loggerPredictive['debug'](_0x2e3951[_0xb027('0x49')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x1dd7ff,_0x4740c1){return function(_0x1a2419){loggerPredictive[_0xb027('0x65')](_0x4740c1[_0xb027('0x49')],_0x1dd7ff);loggerPredictive[_0xb027('0x65')](_0x1a2419[_0xb027('0x66')]);clearPredictiveAttributes(_0x4740c1);};}function loggerCatch(_0x216195){return function(_0x3aeee3){logger['error'](_0x216195,util[_0xb027('0x46')](_0x3aeee3,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x101993,_0x1dd9ff,_0x178f6a){return function(_0x1d9306){utils[_0xb027('0x67')](_0x1dd9ff,_0x178f6a,0x0);_0x1dd9ff['temp']=0x0;logger['error'](_0x101993,util[_0xb027('0x46')](_0x1d9306,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1b82c2){return function(_0x1130ee){if(isNotNull(_0x1130ee)&&isNotNull(_0x1130ee[0x0])){if(_0x1130ee[0x0][_0xb027('0x68')]>0x0){_0x1b82c2[_0xb027('0x69')]=utils[_0xb027('0x6a')][_0xb027('0x6b')];logger[_0xb027('0x4c')](_0xb027('0x6c')+_0x1b82c2[_0xb027('0x49')],_0x1130ee[0x0][_0xb027('0x68')],_0xb027('0x6d'));}else{_0x1b82c2[_0xb027('0x69')]=utils[_0xb027('0x6a')][_0xb027('0x6e')];logger[_0xb027('0x4c')](_0xb027('0x6f')+_0x1b82c2[_0xb027('0x49')]);}}};}function createObjHistory(_0x36fc75,_0x2d27b3,_0x4f9788,_0x495952,_0x46c8c7){_0x36fc75[_0xb027('0x69')]=_0x4f9788;var _0x1f8a85=new Action(_0x36fc75,_0x2d27b3);var _0x5cb696=new History(_0x1f8a85);_0x5cb696[_0xb027('0x70')]=_0x495952;_0x5cb696['statedesc']=_0x46c8c7;_0x5cb696[_0xb027('0x71')]=_0x1f8a85[_0xb027('0x72')];return _0x5cb696;}function unlockQueueStatus(_0x5d8826,_0xc99fc6){setTimeout(function(){if(_[_0xb027('0x40')](_0x5d8826[_0xb027('0x73')])){loggerBooked['error'](_0xb027('0x74'),_0xc99fc6);}_0x5d8826['queueStatusComplete']=!![];loggerBooked[_0xb027('0x4c')]('[booked][unlockQueueStatus]',_0xc99fc6,JSON[_0xb027('0x75')](_['pick'](_0x5d8826,[_0xb027('0x49'),_0xb027('0x73')])));},0x1f3);}function checkInterval(_0x233bd9){return function(){if(!isNotNull(_0x233bd9['Interval'])){_0x233bd9[_0xb027('0x69')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x233bd9[_0xb027('0x49')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x233bd9[_0xb027('0x76')]['Intervals'])){_0x233bd9[_0xb027('0x69')]=utils[_0xb027('0x6a')][_0xb027('0x77')];throw _0x233bd9[_0xb027('0x49')]+_0xb027('0x78');}if(!isNotNull(_['isEmpty'](_0x233bd9[_0xb027('0x76')][_0xb027('0x79')]))){_0x233bd9[_0xb027('0x69')]=utils[_0xb027('0x6a')][_0xb027('0x77')];throw _0x233bd9[_0xb027('0x49')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0xa57d61){return function(){if(!utils[_0xb027('0x7a')](_0xa57d61)){_0xa57d61[_0xb027('0x69')]=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0xa57d61[_0xb027('0x49')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x3a2164){if(utils[_0xb027('0x7b')](_0x3a2164)){emit(util[_0xb027('0x47')]('campaign:ivr:%s',_0x3a2164[_0xb027('0x49')]),_0xb027('0x7c'),_0x3a2164);}}function loggerCatchQueueSummary(_0x43ca77,_0x184e95){return function(_0x4810c5){clearPredictiveAttributes(_0x184e95);emitCampaignSummary(_0x184e95);loggerSyncQueueSummary[_0xb027('0x44')](_0x43ca77,util[_0xb027('0x46')](_0x4810c5,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x587828){if(_0x587828['sendMessageOneNotActive']){if(_0x587828[_0xb027('0x7d')]===0x0){_0x587828['sendMessageOneNotActive']=![];_0x587828[_0xb027('0x69')]=utils[_0xb027('0x6a')][_0xb027('0x7e')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x587828[_0xb027('0x49')],_0xb027('0x7f'));}else{_0x587828[_0xb027('0x69')]=utils[_0xb027('0x6a')][_0xb027('0x80')];loggerSyncQueueSummary[_0xb027('0x44')](_0xb027('0x81'),_0x587828[_0xb027('0x49')],_0xb027('0x82'));}emitCampaignSummary(_0x587828);}}function myreject(_0x2a0895){return function(_0x3357a7){return _0x2a0895(msgResponse(_0xb027('0x83'),_0xb027('0x84'),JSON[_0xb027('0x75')](_0x3357a7)));};}Dialer[_0xb027('0x1a')][_0xb027('0x85')]=function(_0x3d96ae){return!_[_0xb027('0x40')](_0x3d96ae)&&_0x3d96ae&&!_['isUndefined'](_0x3d96ae[_0xb027('0x49')])&&!_['isUndefined'](_0x3d96ae['active'])&&_0x3d96ae[_0xb027('0x86')]&&(this[_0xb027('0x22')][util[_0xb027('0x47')]('SIP/%s',_0x3d96ae[_0xb027('0x49')])][_0xb027('0x87')]===_0xb027('0x88')||this[_0xb027('0x22')][util['format']('SIP/%s',_0x3d96ae[_0xb027('0x49')])][_0xb027('0x87')]==='unmonitored');};Dialer[_0xb027('0x1a')][_0xb027('0x89')]=function(_0x39cf25){var _0x1a40ed=this;return function(){if(!_0x1a40ed[_0xb027('0x85')](_0x39cf25[_0xb027('0x8a')])){if(!_0x1a40ed[_0xb027('0x85')](_0x39cf25[_0xb027('0x8b')])){_0x39cf25['message']=utils[_0xb027('0x6a')][_0xb027('0x8c')];throw _0x39cf25[_0xb027('0x49')]+_0xb027('0x8d');}}};};Dialer[_0xb027('0x1a')][_0xb027('0x8e')]=function(_0x24af6e,_0x4d2128,_0xce9252,_0x4ed806){var _0x484a5c=this;return function(){var _0x27b6db=!![];return _0x484a5c[_0xb027('0x8f')](_0x24af6e,_0x4d2128,_0xce9252,_0x4ed806,_0x27b6db);};};Dialer['prototype']['checkIfTimeIntervals']=function(_0x2e0aac,_0x1c05d3,_0x139d83,_0x44da0a){var _0x31dbbd=this;return function(){var _0x120ade=![];return _0x31dbbd['ifTimeIvr'](_0x2e0aac[_0xb027('0x79')],_0x1c05d3,_0x139d83,_0x44da0a,_0x120ade);};};Dialer[_0xb027('0x1a')][_0xb027('0x8f')]=function(_0xb7776a,_0x1ca509,_0x33d78a,_0x52a398,_0x5e349c){var _0x539837=[];return new Promise(function(_0x227495,_0x5f3457){if(!isNotNull(_0xb7776a)){_0x52a398[_0xb027('0x69')]=utils[_0xb027('0x6a')][_0xb027('0x77')];return _0x5f3457(msgResponse(_0xb027('0x90'),_0xb027('0x91'),_0x33d78a+'\x20Intervals\x20is\x20null\x20'));}if(_[_0xb027('0x4b')](_0xb7776a)){_0x52a398[_0xb027('0x69')]=utils['CAMPAIGN_STATUS']['EMPTY_INTERVAL'];return _0x5f3457(msgResponse('ifTime',_0xb027('0x91'),_0x33d78a+_0xb027('0x92')));}if(_0x1ca509&&_[_0xb027('0x40')](config[_0xb027('0x93')][_0x1ca509])){_0x52a398[_0xb027('0x69')]=utils[_0xb027('0x6a')][_0xb027('0x94')];return _0x5f3457(msgResponse('ifTime',_0xb027('0x91'),_0x33d78a+_0xb027('0x95')+_0x1ca509));}if(_[_0xb027('0x96')](_0xb7776a)){for(var _0x1fe7f3=0x0;_0x1fe7f3<_0xb7776a[_0xb027('0x97')];_0x1fe7f3+=0x1){_0x539837['push'](ami[_0xb027('0x98')]({'action':'command','command':util[_0xb027('0x47')](_0xb027('0x99'),_0xb7776a[_0x1fe7f3][_0xb027('0x9a')],!_[_0xb027('0x40')](config[_0xb027('0x93')][_0x1ca509])?_0x1ca509:'')})[_0xb027('0x3e')](function(_0x469e12){return _0x469e12[_0xb027('0x9b')][_0xb027('0x9c')](_0xb027('0x9d'))>=0x0;})['catch'](myreject(_0x5f3457)));}}else{_0x539837['push'](ami[_0xb027('0x98')]({'action':_0xb027('0x9e'),'command':util['format'](_0xb027('0x99'),_0xb7776a,!_[_0xb027('0x40')](config['timezones'][_0x1ca509])?_0x1ca509:'')})[_0xb027('0x3e')](function(_0xe3abb2){return _0xe3abb2[_0xb027('0x9b')][_0xb027('0x9c')](_0xb027('0x9d'))>=0x0;})[_0xb027('0x9f')](myreject(_0x5f3457)));}Promise[_0xb027('0xa0')](_0x539837)[_0xb027('0x3e')](function(_0x444b37){var _0x3ae139=_[_0xb027('0xa1')](_0x444b37);if(_0x3ae139){return _0x227495(_0x3ae139);}else{_0x52a398[_0xb027('0x69')]=_0x5e349c?utils[_0xb027('0x6a')][_0xb027('0xa2')]:utils[_0xb027('0x6a')]['OVERTIME_INTERVAL'];return _0x5f3457(msgResponse('[ifTime][promiseAll]',_0xb027('0x91'),'Global:\x20'+_0x5e349c+'\x20'+_0x33d78a+_0xb027('0xa3')+util[_0xb027('0x46')](_0xb7776a,{'showHidden':![],'depth':null})+_0xb027('0xa4')+_0x1ca509));}})[_0xb027('0x9f')](function(_0x5ba361){return _0x5f3457(msgResponse(_0xb027('0x90'),'Failure',JSON[_0xb027('0x75')](_0x5ba361)));});});};Dialer['prototype'][_0xb027('0x3b')]=function(){var _0x403fc1=this;return cmHopper[_0xb027('0xa5')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x403fc1['syncCampaigns']();},0x3e8);});};Dialer[_0xb027('0x1a')]['syncCampaigns']=function(){var _0x2d997d=this;var _0x1f216d;for(var _0x325c52 in this['campaigns']){if(typeof this[_0xb027('0x20')][_0x325c52]!==_0xb027('0xa6')){_0x1f216d=this[_0xb027('0x20')][_0x325c52];if(utils['isIVRCampaign'](_0x1f216d)&&utils[_0xb027('0x7a')](_0x1f216d)){_0x1f216d['sendMessageOneNotActive']=!![];Promise[_0xb027('0xa7')]()[_0xb027('0x3e')](checkIsIVRCampaignActive(_0x1f216d))['then'](checkInterval(_0x1f216d))[_0xb027('0x3e')](_0x2d997d[_0xb027('0x89')](_0x1f216d))[_0xb027('0x3e')](_0x2d997d[_0xb027('0x8e')](_0x1f216d['dialGlobalInterval'],_0x1f216d[_0xb027('0xa8')],_0x1f216d['name'],_0x1f216d))[_0xb027('0x3e')](_0x2d997d[_0xb027('0xa9')](_0x1f216d['Interval'],_0x1f216d[_0xb027('0xa8')],_0x1f216d['name'],_0x1f216d))[_0xb027('0x3e')](_0x2d997d[_0xb027('0xaa')](_0x1f216d))[_0xb027('0x9f')](loggerCatchQueueSummary(_0xb027('0xab'),_0x1f216d));}else{notSendMessagesCampaign(_0x1f216d);}}}};Dialer[_0xb027('0x1a')]['checkDialMethod']=function(_0x40ac94){if(_0x40ac94['dialMethod']!==_0xb027('0x9')){clearPredictiveAttributes(_0x40ac94);}switch(_0x40ac94['dialMethod']){case'progressive':this['handlePower'](_0x40ac94,0x1);break;case'power':this[_0xb027('0xac')](_0x40ac94,_0x40ac94[_0xb027('0xad')]);break;case'predictive':this['predictive'](_0x40ac94);break;case'booked':this[_0xb027('0xac')](_0x40ac94,0x1);break;default:logger[_0xb027('0x65')](_0xb027('0xae'),_0x40ac94[_0xb027('0x49')],_0xb027('0xaf'));}};Dialer[_0xb027('0x1a')]['ifTime']=function(_0x52ea3a,_0xbdad05){var _0x274510=_0x52ea3a[_0xb027('0xa8')];var _0x49f363=_0xbdad05?_0x52ea3a[_0xb027('0xb0')]:_0x52ea3a[_0xb027('0x76')][_0xb027('0x79')];logger[_0xb027('0xb1')](_0xb027('0xb2'),_0x49f363,_0x274510,_0x52ea3a['name'],util['format'](_0xb027('0xb3'),_0x52ea3a['name'],_0x52ea3a['id']));var _0x254234=null;return Interval[_0xb027('0xb4')](_0x49f363,_0x274510)[_0xb027('0x3e')](function(_0x39fe34){if(_0x39fe34===!![]){return _0x39fe34;}else{_0x52ea3a[_0xb027('0x69')]=_0xbdad05?utils[_0xb027('0x6a')][_0xb027('0xa2')]:utils[_0xb027('0x6a')][_0xb027('0xb5')];_0x254234=msgResponse(_0xb027('0xb6'),_0xb027('0x91'),'Global:\x20'+_0xbdad05+'\x20'+_0x52ea3a[_0xb027('0x49')]+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x49f363,{'showHidden':![],'depth':null})+_0xb027('0xa4')+_0x274510);}if(_0x254234!==null){logger[_0xb027('0xb1')](_0xb027('0xb7'),_0x254234);_0x254234[_0xb027('0xb8')]=_0xbdad05;throw _0x254234;}})[_0xb027('0x9f')](function(_0x1cdbd0){logger[_0xb027('0x65')]('AMI\x20IfTime',_0x1cdbd0);throw msgResponse('[ifTime][Action]',_0xb027('0x84'),util[_0xb027('0x46')](_0x1cdbd0,{'showHidden':![],'depth':null}));});};Dialer[_0xb027('0x1a')][_0xb027('0x2c')]=function(_0x363a18){if(this[_0xb027('0x1f')][_0x363a18[_0xb027('0xb9')]]){if(this[_0xb027('0x26')][_0x363a18[_0xb027('0xba')]]&&this[_0xb027('0x26')][_0x363a18['uniqueid']]['type']!==_0xb027('0xbb')){this[_0xb027('0xbc')](this[_0xb027('0x1f')][_0x363a18[_0xb027('0xb9')]]);this[_0xb027('0x26')][_0x363a18[_0xb027('0xba')]][_0xb027('0xbd')]=moment()[_0xb027('0x47')](_0xb027('0xbe'));}}};Dialer['prototype'][_0xb027('0x30')]=function(_0x5aedcc){var _0x16bf2b=this[_0xb027('0x26')][_0x5aedcc['uniqueid']];if(this[_0xb027('0x1f')][_0x5aedcc['queue']]){if(_0x16bf2b&&_0x16bf2b['type']!=='ivr'){delete this[_0xb027('0x26')][_0x5aedcc['uniqueid']];this[_0xb027('0x1f')][_0x5aedcc[_0xb027('0xb9')]][_0xb027('0xbf')]+=0x1;var _0x241be4=new AgentComplete(_0x16bf2b,_0x5aedcc);if(_0x5aedcc['reason']===_0xb027('0xc0')){_0x241be4['agiafterat']=this[_0xb027('0x1f')][_0x5aedcc[_0xb027('0xb9')]][_0xb027('0xc1')]&&this['voiceQueues'][_0x5aedcc['queue']][_0xb027('0xc2')]?moment()[_0xb027('0x47')](_0xb027('0xbe')):undefined;}hopperUtils[_0xb027('0xc3')](_0x241be4)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0xb027('0xc4')](_0x241be4)[_0xb027('0x9f')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xb027('0x1a')][_0xb027('0xc5')]=function(_0x412ae7){var _0x56581d=this[_0xb027('0x26')][_0x412ae7[_0xb027('0xba')]];var _0x8d5865=this;var _0x29684d=![];var _0x5cdcb1;var _0x542901;if(this[_0xb027('0x1f')][_0x412ae7[_0xb027('0xb9')]]){if(_0x56581d&&_0x56581d[_0xb027('0x42')]!==_0xb027('0xbb')){delete this[_0xb027('0x26')][_0x412ae7[_0xb027('0xba')]];this[_0xb027('0xbc')](this['voiceQueues'][_0x412ae7[_0xb027('0xb9')]]);_0x56581d[_0xb027('0xc6')]=moment()[_0xb027('0x47')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4cbd42=new QueueCallerAbandon(_0x56581d,_0x412ae7);if(utils[_0xb027('0x60')](_0x56581d[_0xb027('0xc6')],_0x56581d[_0xb027('0xc7')])>=_0x56581d[_0xb027('0xc8')]){this[_0xb027('0x1f')][_0x412ae7['queue']][_0xb027('0xc9')]+=0x1;this[_0xb027('0x1f')][_0x412ae7[_0xb027('0xb9')]][_0xb027('0xca')]+=0x1;this[_0xb027('0x1f')][_0x412ae7[_0xb027('0xb9')]][_0xb027('0xcb')]+=0x1;_0x4cbd42[_0xb027('0x70')]=0xa;_0x4cbd42[_0xb027('0xcc')]=_0xb027('0xcd');_0x4cbd42[_0xb027('0xce')]=_0xb027('0xcf');_0x4cbd42[_0xb027('0xd0')]=this[_0xb027('0x1f')][_0x412ae7[_0xb027('0xb9')]][_0xb027('0xc1')]?moment()[_0xb027('0x47')](_0xb027('0xbe')):undefined;_0x4cbd42[_0xb027('0xd1')]+=0x1;_0x4cbd42[_0xb027('0xd2')]+=0x1;_0x5cdcb1=this[_0xb027('0x1f')][_0x412ae7[_0xb027('0xb9')]]['dialDropRetryFrequency'];_0x542901=this[_0xb027('0x1f')][_0x412ae7[_0xb027('0xb9')]][_0xb027('0xd3')];hopperUtils[_0xb027('0xd4')](_0x4cbd42,_0x4cbd42[_0xb027('0x70')],_0x56581d[_0xb027('0xd5')])[_0xb027('0x3e')](function(_0x206491){_0x29684d=_0x206491[_0xb027('0xd6')]==0x1;if(_0x4cbd42[_0xb027('0xd1')]>=_0x8d5865[_0xb027('0x1f')][_0x412ae7[_0xb027('0xb9')]][_0xb027('0xd7')]){_0x8d5865[_0xb027('0xd8')](_0x4cbd42,_0x206491[_0xb027('0xd6')]);}else{hopperUtils[_0xb027('0xd9')]({'active':![],'countdropretry':_0x4cbd42[_0xb027('0xd1')],'scheduledat':moment()['add'](_0x8d5865[_0xb027('0x1f')][_0x412ae7[_0xb027('0xb9')]]['dialDropRetryFrequency'],_0xb027('0xda'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x56581d['ContactId'],'ListId':_0x56581d[_0xb027('0xdb')],'VoiceQueueId':_0x56581d['VoiceQueueId']||undefined,'CampaignId':_0x56581d[_0xb027('0xdc')]||undefined})['catch'](loggerCatch(_0xb027('0xdd')));var _0x5e4275=new History(_0x4cbd42);_0x5e4275[_0xb027('0x70')]=0xa;_0x5e4275[_0xb027('0xcc')]=_0xb027('0xcd');_0x5e4275[_0xb027('0x72')]=moment()[_0xb027('0x47')](_0xb027('0xbe'));_0x5e4275['endtime']=_0x5e4275[_0xb027('0x72')];_0x5e4275[_0xb027('0xde')]=_0x4cbd42['calleridname'];_0x5e4275[_0xb027('0xdf')]=_0x4cbd42['calleridnum'];hopperUtils[_0xb027('0xc3')](_0x5e4275)[_0xb027('0x9f')](loggerCatch(_0xb027('0xe0')));}})[_0xb027('0x3e')](function(){if(_0x29684d)hopperUtils[_0xb027('0xe1')](_0x4cbd42,_0x5cdcb1,_0x542901)[_0xb027('0x3e')](function(){return 0x1;});});}else{this['voiceQueues'][_0x412ae7[_0xb027('0xb9')]][_0xb027('0x53')]+=0x1;this[_0xb027('0x1f')][_0x412ae7['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x4cbd42[_0xb027('0x70')]=0xb;_0x4cbd42[_0xb027('0xcc')]='Abandoned';_0x4cbd42[_0xb027('0xce')]=_0xb027('0xe2');_0x4cbd42[_0xb027('0xe3')]+=0x1;_0x4cbd42[_0xb027('0xd2')]+=0x1;_0x5cdcb1=this[_0xb027('0x1f')][_0x412ae7[_0xb027('0xb9')]]['dialAbandonedRetryFrequency'];_0x542901=this[_0xb027('0x1f')][_0x412ae7[_0xb027('0xb9')]][_0xb027('0xd3')];hopperUtils['verifyAdditionalPhones'](_0x4cbd42,_0x4cbd42['state'],_0x56581d[_0xb027('0xd5')])[_0xb027('0x3e')](function(_0x9707b4){if(_0x4cbd42[_0xb027('0xe3')]>=_0x8d5865[_0xb027('0x1f')][_0x412ae7[_0xb027('0xb9')]]['dialAbandonedMaxRetry']){_0x8d5865[_0xb027('0xd8')](_0x4cbd42,_0x9707b4[_0xb027('0xd6')]);}else{hopperUtils[_0xb027('0xd9')]({'active':![],'countabandonedretry':_0x4cbd42[_0xb027('0xe3')],'scheduledat':moment()[_0xb027('0xe4')](_0x8d5865[_0xb027('0x1f')][_0x412ae7[_0xb027('0xb9')]][_0xb027('0xe5')],_0xb027('0xda'))[_0xb027('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x56581d[_0xb027('0xe6')],'ListId':_0x56581d['ListId'],'VoiceQueueId':_0x56581d['VoiceQueueId']||undefined,'CampaignId':_0x56581d[_0xb027('0xdc')]||undefined})[_0xb027('0x9f')](loggerCatch(_0xb027('0xe7')));var _0x293c08=new History(_0x4cbd42);_0x293c08[_0xb027('0x70')]=0xb;_0x293c08[_0xb027('0xcc')]=_0xb027('0xe8');_0x293c08[_0xb027('0x72')]=moment()[_0xb027('0x47')](_0xb027('0xbe'));_0x293c08['endtime']=_0x293c08[_0xb027('0x72')];_0x293c08[_0xb027('0xde')]=_0x4cbd42['calleridname'];_0x293c08[_0xb027('0xdf')]=_0x4cbd42[_0xb027('0xdf')];hopperUtils[_0xb027('0xc3')](_0x293c08)[_0xb027('0x9f')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})['then'](function(){if(_0x29684d)hopperUtils[_0xb027('0xe1')](_0x4cbd42,_0x5cdcb1,_0x542901)[_0xb027('0x3e')](function(){return 0x1;});});}}}};Dialer[_0xb027('0x1a')][_0xb027('0x36')]=function(_0x39a779){if(this[_0xb027('0xe9')][_0x39a779[_0xb027('0xba')]]){this[_0xb027('0xe9')][_0x39a779[_0xb027('0xba')]][_0xb027('0xea')]=_0x39a779[_0xb027('0xea')];}if(this[_0xb027('0x26')][_0x39a779[_0xb027('0xba')]]){this[_0xb027('0x26')][_0x39a779['uniqueid']][_0xb027('0xea')]=_0x39a779[_0xb027('0xea')];}};Dialer['prototype'][_0xb027('0x39')]=function(_0x4fb9d1){if(!this[_0xb027('0xe9')][_0x4fb9d1['actionid']]){return;}var _0x496f13=this[_0xb027('0x1f')][this[_0xb027('0xe9')][_0x4fb9d1[_0xb027('0xeb')]][_0xb027('0xb9')]][_0xb027('0xec')]||_0xb027('0xed');if(_0x496f13===_0xb027('0xee')){if(this[_0xb027('0xe9')][_0x4fb9d1[_0xb027('0xeb')]]&&_[_0xb027('0xef')](this[_0xb027('0xe9')][_0x4fb9d1[_0xb027('0xeb')]][_0xb027('0xf0')])&&_0x4fb9d1['status']==='1'&&_0x4fb9d1[_0xb027('0xf1')]==='0'){if(this[_0xb027('0x21')][_0x4fb9d1[_0xb027('0xf2')]]){if(!this[_0xb027('0x21')][_0x4fb9d1['stateinterface']][_0xb027('0xf0')]){this[_0xb027('0x21')][_0x4fb9d1[_0xb027('0xf2')]][_0xb027('0xf0')]=!![];this[_0xb027('0xe9')][_0x4fb9d1[_0xb027('0xeb')]][_0xb027('0xf0')]=!![];this[_0xb027('0xe9')][_0x4fb9d1[_0xb027('0xeb')]][_0xb027('0xf2')]=_0x4fb9d1['stateinterface'];}}}}else if(_0x496f13===_0xb027('0xed')){if(this[_0xb027('0xe9')][_0x4fb9d1['actionid']]){if(this[_0xb027('0x21')][_0x4fb9d1[_0xb027('0xf2')]]){this[_0xb027('0xe9')][_0x4fb9d1['actionid']][_0xb027('0xf2')]=_0x4fb9d1['stateinterface'];if(_[_0xb027('0xef')](this[_0xb027('0x2a')][this[_0xb027('0xe9')][_0x4fb9d1[_0xb027('0xeb')]][_0xb027('0xb9')]])){this[_0xb027('0x2a')][this[_0xb027('0xe9')][_0x4fb9d1['actionid']]['queue']]=[];}this[_0xb027('0x2a')][this[_0xb027('0xe9')][_0x4fb9d1[_0xb027('0xeb')]][_0xb027('0xb9')]][_0xb027('0xf3')](_[_0xb027('0x5f')](_['pick'](this[_0xb027('0xe9')][_0x4fb9d1['actionid']],[_0xb027('0xf4'),_0xb027('0xf2')]),{'status':_0x4fb9d1['status'],'paused':_0x4fb9d1[_0xb027('0xf1')]}));}}}};Dialer[_0xb027('0x1a')][_0xb027('0xf5')]=function(_0x202175){if(!this[_0xb027('0xe9')][_0x202175[_0xb027('0xeb')]]){return;}var _0x59a86a=this;var _0x2ebe66=this['voiceQueues'][this[_0xb027('0xe9')][_0x202175['actionid']][_0xb027('0xb9')]];var _0x4881cd=_0x2ebe66[_0xb027('0xec')]||'rrmemory';if(_0x4881cd===_0xb027('0xee')){if(this[_0xb027('0xe9')][_0x202175[_0xb027('0xeb')]]&&this[_0xb027('0xe9')][_0x202175[_0xb027('0xeb')]]['stateinterface']){this[_0xb027('0x1e')][_0xb027('0xf6')](this[_0xb027('0xe9')][_0x202175[_0xb027('0xeb')]][_0xb027('0xf4')],this['actions'][_0x202175['actionid']]['stateinterface'])['catch'](function(_0x58a4a4){logger[_0xb027('0x65')](_0xb027('0xf7'),util[_0xb027('0x46')](_0x58a4a4,{'showHidden':![],'depth':null}));})[_0xb027('0xf8')](function(){_0x59a86a[_0xb027('0xbc')](_0x59a86a['voiceQueues'][_0x59a86a[_0xb027('0xe9')][_0x202175[_0xb027('0xeb')]]['queue']]);_0x59a86a[_0xb027('0x21')][_0x59a86a['actions'][_0x202175['actionid']][_0xb027('0xf2')]][_0xb027('0xf0')]=![];delete _0x59a86a[_0xb027('0xe9')][_0x202175['actionid']];unlockQueueStatus(_0x2ebe66);});}else{this['updateOriginated'](this[_0xb027('0x1f')][this[_0xb027('0xe9')][_0x202175[_0xb027('0xeb')]][_0xb027('0xb9')]]);hopperUtils[_0xb027('0xd9')]({'active':![],'ContactId':this[_0xb027('0xe9')][_0x202175['actionid']][_0xb027('0xe6')],'ListId':this['actions'][_0x202175[_0xb027('0xeb')]][_0xb027('0xdb')],'VoiceQueueId':this[_0xb027('0xe9')][_0x202175['actionid']][_0xb027('0xf9')]||undefined,'CampaignId':this['actions'][_0x202175[_0xb027('0xeb')]]['CampaignId']||undefined})[_0xb027('0x9f')](loggerCatch(_0xb027('0xfa')));delete this['actions'][_0x202175['actionid']];unlockQueueStatus(_0x2ebe66);}}else if(_0x4881cd==='rrmemory'){var _0x482395;if(this['actions'][_0x202175[_0xb027('0xeb')]]&&!_[_0xb027('0x4b')](this['queueBooked'][this[_0xb027('0xe9')][_0x202175[_0xb027('0xeb')]]['queue']])){if(this[_0xb027('0x2b')][_0x59a86a[_0xb027('0xe9')][_0x202175[_0xb027('0xeb')]][_0xb027('0xb9')]]){this[_0xb027('0x2b')][_0x59a86a[_0xb027('0xe9')][_0x202175[_0xb027('0xeb')]][_0xb027('0xb9')]]=this[_0xb027('0x2b')][this['actions'][_0x202175[_0xb027('0xeb')]]['queue']]?this[_0xb027('0x2b')][this['actions'][_0x202175[_0xb027('0xeb')]][_0xb027('0xb9')]]:this[_0xb027('0x2a')][this[_0xb027('0xe9')][_0x202175[_0xb027('0xeb')]][_0xb027('0xb9')]]?this[_0xb027('0x2a')][this[_0xb027('0xe9')][_0x202175[_0xb027('0xeb')]]['queue']][_0xb027('0xfb')]||0x0:0x0;}this[_0xb027('0x2a')][this[_0xb027('0xe9')][_0x202175[_0xb027('0xeb')]]['queue']][_0xb027('0xfb')]=this[_0xb027('0x2b')][this[_0xb027('0xe9')][_0x202175[_0xb027('0xeb')]][_0xb027('0xb9')]];for(var _0x2cb967=0x0;_0x2cb967=_0x2ed2d0[_0xb027('0x11e')]){_0x258750[_0xb027('0x11f')](_0x379f7c,_0x2737cd,_0x232dfb,_0xb027('0x120'));}else{if(_0x379f7c['countmachineretry']>=_0x2ed2d0['dialMachineMaxRetry']){_0x258750[_0xb027('0x121')](_0x379f7c,_0x2737cd,_0x232dfb,_0xb027('0x122'));}else{hopperUtils[_0xb027('0xd9')]({'active':![],'countmachineretry':_0x379f7c[_0xb027('0x118')],'scheduledat':moment()['add'](_0x2ed2d0['dialMachineRetryFrequency'],_0xb027('0xda'))[_0xb027('0x47')](_0xb027('0xbe')),'ContactId':_0x379f7c[_0xb027('0xe6')],'ListId':_0x379f7c[_0xb027('0xdb')],'VoiceQueueId':_0x379f7c[_0xb027('0xf9')]||undefined,'CampaignId':_0x379f7c[_0xb027('0xdc')]||undefined})[_0xb027('0x9f')](loggerCatch(_0xb027('0x123')));_0x2737cd({'reschedule':0x1});}}});}if(_0x2ea277['type']===_0xb027('0xbb')&&this['campaigns'][_0x2ea277['queue']][_0xb027('0x115')]&&_0x2b4b98[_0xb027('0x10d')]===_0xb027('0x124')){delete this[_0xb027('0x26')][_0x2b4b98['uniqueid']];this[_0xb027('0xbc')](this[_0xb027('0x20')][_0x2ea277[_0xb027('0xb9')]]);_0x1e6665=new Hangup(_0x2ea277,_0x2b4b98);_0x1e6665[_0xb027('0x70')]=0x12;_0x1e6665['statedesc']='HangupInAMD';_0x1e6665['membername']=_0xb027('0x10f');ami[_0xb027('0x41')](_0xb027('0x110'),ut[_0xb027('0x111')](_0x1e6665,_0xb027('0x112')));this[_0xb027('0x113')](_0x1e6665,'[syncHangupInAMDIvr][createHistory]',_0xb027('0x125'));}if(_0x2ea277[_0xb027('0x42')]==='ivr'&&this[_0xb027('0x20')][_0x2ea277[_0xb027('0xb9')]][_0xb027('0x115')]&&_0x2b4b98[_0xb027('0x10d')]===_0xb027('0x126')){return new Promise(function(_0x1eda13,_0xe828fd){delete _0x258750[_0xb027('0x26')][_0x2b4b98[_0xb027('0xba')]];_0x258750['updateOriginated'](_0x258750[_0xb027('0x20')][_0x2ea277[_0xb027('0xb9')]]);_0x258750[_0xb027('0x20')][_0x2ea277['queue']][_0xb027('0xbf')]+=0x1;_0x258750[_0xb027('0x20')][_0x2ea277[_0xb027('0xb9')]][_0xb027('0x127')]+=0x1;var _0x39c5e7=_0x258750[_0xb027('0x20')][_0x2ea277['queue']];var _0x4a655f=new Hangup(_0x2ea277,_0x2b4b98);_0x4a655f['state']=0x13;_0x4a655f['statedesc']=_0xb027('0x116');_0x4a655f[_0xb027('0x117')]=_0xb027('0x10f');_0x4a655f[_0xb027('0x118')]+=0x1;_0x4a655f[_0xb027('0xd2')]+=0x1;_0x4a655f[_0xb027('0x112')]=!![];ami['emit'](_0xb027('0x110'),ut[_0xb027('0x111')](_0x4a655f,_0xb027('0x112')));hopperUtils[_0xb027('0xc3')](_0x4a655f)[_0xb027('0x9f')](loggerCatch(_0xb027('0x119')));if(_0x4a655f[_0xb027('0x11a')]+_0x4a655f[_0xb027('0x11b')]+_0x4a655f['countnoanswerretry']+_0x4a655f[_0xb027('0x11c')]+_0x4a655f[_0xb027('0xd1')]+_0x4a655f[_0xb027('0xe3')]+_0x4a655f['countmachineretry']+_0x4a655f[_0xb027('0x11d')]>=_0x39c5e7[_0xb027('0x11e')]){_0x258750[_0xb027('0x11f')](_0x4a655f,_0x1eda13,_0xe828fd,'reason19\x20machine....');}else{if(_0x4a655f[_0xb027('0x118')]>=_0x39c5e7[_0xb027('0x128')]){_0x258750[_0xb027('0x121')](_0x4a655f,_0x1eda13,_0xe828fd,_0xb027('0x122'));}else{hopperUtils[_0xb027('0xd9')]({'active':![],'countmachineretry':_0x4a655f[_0xb027('0x118')],'scheduledat':moment()[_0xb027('0xe4')](_0x39c5e7[_0xb027('0x129')],_0xb027('0xda'))[_0xb027('0x47')](_0xb027('0xbe')),'ContactId':_0x4a655f[_0xb027('0xe6')],'ListId':_0x4a655f['ListId'],'VoiceQueueId':_0x4a655f[_0xb027('0xf9')]||undefined,'CampaignId':_0x4a655f[_0xb027('0xdc')]||undefined})[_0xb027('0x9f')](loggerCatch('[rescheduleContact][Machine]'));_0x1eda13({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xb027('0x12a')]=function(_0x574f83){var _0x57cc92=this[_0xb027('0x26')][_0x574f83[_0xb027('0xba')]];var _0x1c6ccb;if(_0x57cc92&&_0x57cc92[_0xb027('0x42')]===_0xb027('0xbb')){delete this[_0xb027('0x26')][_0x574f83[_0xb027('0xba')]];this['updateOriginated'](this[_0xb027('0x20')][_0x57cc92[_0xb027('0xb9')]]);this[_0xb027('0x20')][_0x57cc92[_0xb027('0xb9')]][_0xb027('0x12b')]+=0x1;_0x1c6ccb=new Hangup(_0x57cc92,_0x574f83);hopperUtils['createHistory'](_0x1c6ccb)['catch'](loggerCatch(_0xb027('0x12c')));hopperUtils[_0xb027('0xc4')](_0x1c6ccb)[_0xb027('0x9f')](loggerCatch(_0xb027('0x12d')));}if(_0x57cc92&&_0x57cc92[_0xb027('0x42')]!==_0xb027('0xbb')&&isNotNull(this[_0xb027('0x1f')][_0x57cc92[_0xb027('0xb9')]][_0xb027('0x12e')])){delete this[_0xb027('0x26')][_0x574f83[_0xb027('0xba')]];this[_0xb027('0xbc')](this[_0xb027('0x1f')][_0x57cc92[_0xb027('0xb9')]]);this[_0xb027('0x1f')][_0x57cc92[_0xb027('0xb9')]]['outboundAnswerCallsDay']+=0x1;this[_0xb027('0x1f')][_0x57cc92['queue']][_0xb027('0x127')]+=0x1;_0x1c6ccb=new Hangup(_0x57cc92,_0x574f83);_0x1c6ccb[_0xb027('0x70')]=0x10;_0x1c6ccb[_0xb027('0xcc')]=_0xb027('0x12f');_0x1c6ccb['membername']=_0xb027('0x130');hopperUtils[_0xb027('0xc3')](_0x1c6ccb)['catch'](loggerCatch(_0xb027('0x12c')));hopperUtils['moveContactManagedDialer'](_0x1c6ccb)[_0xb027('0x9f')](loggerCatch(_0xb027('0x12d')));}if(_0x57cc92&&_0x57cc92['type']!==_0xb027('0xbb')&&!isNotNull(this[_0xb027('0x1f')][_0x57cc92['queue']]['dialQueueProject'])){delete this[_0xb027('0x26')][_0x574f83[_0xb027('0xba')]];this[_0xb027('0xbc')](this[_0xb027('0x1f')][_0x57cc92[_0xb027('0xb9')]]);this[_0xb027('0x1f')][_0x57cc92['queue']][_0xb027('0x131')]+=0x1;_0x1c6ccb=new Hangup(_0x57cc92,_0x574f83);_0x1c6ccb['state']=0xc;_0x1c6ccb[_0xb027('0xcc')]=_0x574f83['cause-txt'];_0x1c6ccb[_0xb027('0x117')]=_0xb027('0x132');hopperUtils[_0xb027('0xc3')](_0x1c6ccb)['catch'](loggerCatch(_0xb027('0x12c')));hopperUtils[_0xb027('0xc4')](_0x1c6ccb)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype'][_0xb027('0x133')]=function(_0x12d771){var _0x21810f=this;if(!_0x21810f[_0xb027('0x134')][_0x12d771[_0xb027('0x49')]]){_0x21810f['queuesSummary'][_0x12d771[_0xb027('0x49')]]={'running':![]};}else if(_0x21810f[_0xb027('0x134')][_0x12d771['name']]['running']===!![]){return;}else if(_0x21810f[_0xb027('0x134')][_0x12d771[_0xb027('0x49')]][_0xb027('0x135')]===![]){_0x21810f[_0xb027('0x134')][_0x12d771['name']][_0xb027('0x135')]=!![];}var _0x4e0259=_0x21810f['voiceQueues'][_0x12d771[_0xb027('0x49')]];var _0x348e76=_0x4e0259['message']!==utils[_0xb027('0x6a')][_0xb027('0x7e')];var _0x478c8e=utils[_0xb027('0x136')](_0x4e0259);_0x4e0259[_0xb027('0x137')]=utils[_0xb027('0x138')](_0x4e0259,_0x21810f['trunks']);Promise[_0xb027('0xa7')]()[_0xb027('0x3e')](function(){if(_0x4e0259['statusMessage']===utils[_0xb027('0x6a')]['INACTIVE']){if(_0x348e76){clearPredictiveAttributes(_0x4e0259);_0x12d771[_0xb027('0x28')]=undefined;_0x12d771[_0xb027('0x61')]=undefined;}if(_0x4e0259['statusMessage']===utils['CAMPAIGN_STATUS']['INACTIVE']){_0x12d771[_0xb027('0x139')]=0x0;_0x12d771[_0xb027('0xf1')]=0x0;_0x12d771[_0xb027('0x13a')]=0x0;_0x12d771[_0xb027('0x13b')]=0x0;_0x12d771[_0xb027('0x13c')]=0x0;}}else if(_0x4e0259[_0xb027('0x137')]===utils['CAMPAIGN_STATUS'][_0xb027('0x13d')]&&!_0x478c8e){return _0x21810f[_0xb027('0x90')](_0x4e0259,!![])[_0xb027('0x3e')](function(){return _0x21810f[_0xb027('0x90')](_0x4e0259,![]);})[_0xb027('0x3e')](function(){return _0x21810f['checkDialMethod'](_0x4e0259);})[_0xb027('0x9f')](function(_0x2bd30d){loggerSyncQueueSummary[_0xb027('0x44')](_0xb027('0x13e'),util[_0xb027('0x46')](_0x2bd30d,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4e0259);});}else{clearPredictiveAttributes(_0x4e0259);}})[_0xb027('0x3e')](function(){var _0x1466d9=_0x12d771[_0xb027('0x13f')](_0x4e0259);if(_0x1466d9||_0x4e0259[_0xb027('0x140')]){_0x4e0259[_0xb027('0x140')]=![];_0x12d771[_0xb027('0x141')](_0x4e0259);Object['assign'](_0x4e0259,_0x12d771);emitOutboundVoiceQueueSummary(_0x12d771);}_0x21810f[_0xb027('0x134')][_0x4e0259['name']]['running']=![];})[_0xb027('0x9f')](function(_0x37d706){logger['error'](_0xb027('0x13e'),util[_0xb027('0x46')](_0x37d706,{'showHidden':![],'depth':null}));_0x21810f[_0xb027('0x134')][_0x4e0259[_0xb027('0x49')]][_0xb027('0x135')]=![];});};Dialer[_0xb027('0x1a')][_0xb027('0x33')]=_['throttle'](function(){var _0x1a314a=_['filter'](this['voiceQueues'],function(_0x93ca2a){return _0x93ca2a[_0xb027('0x142')];});var _0x2c026f=_[_0xb027('0x143')](this[_0xb027('0x21')],function(_0x58ff87){return _0x58ff87[_0xb027('0x144')]&&_0x58ff87[_0xb027('0x87')]===_0xb027('0x88');});if(_0x1a314a[_0xb027('0x97')]>0x0&&_0x2c026f[_0xb027('0x97')]>0x0){return Promise[_0xb027('0xa7')]()[_0xb027('0x3e')](cmHopper[_0xb027('0x145')](_['map'](_0x1a314a,'id'),previewRecallmeReminderInterval,_[_0xb027('0x146')](_0x2c026f,'id')))['then'](function(_0x278205){for(var _0x52560a=0x0;_0x52560a<_0x278205[_0xb027('0x97')];_0x52560a++){var _0x45e846=_0x278205[_0x52560a]['Agent'][_0xb027('0x49')];if(_0x45e846)io['to'](util[_0xb027('0x47')]('user:%s',_0x45e846))[_0xb027('0x41')](_0xb027('0x147'),{'hopper':_0x278205[_0x52560a]});}})[_0xb027('0x9f')](function(_0x4b6483){logger[_0xb027('0x65')]('checkPreviewRecallReminder',_0x4b6483);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xb027('0x1a')][_0xb027('0x3c')]=function(){var _0x2791d3=this;setInterval(function(){_0x2791d3[_0xb027('0x148')](_0x2791d3[_0xb027('0x26')],_0xb027('0x149'));_0x2791d3['clearZombieChannels'](_0x2791d3[_0xb027('0xe9')],_0xb027('0x14a'));},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x165be7,_0x1e8a86){var _0x4cfefc=this;for(var _0x53f27e in _0x165be7){if(typeof _0x165be7[_0x53f27e]!==_0xb027('0xa6')){this[_0xb027('0x1d')]['enqueue'](function(){if(!_[_0xb027('0xef')](_0x165be7[_0x53f27e])){return ami['Action']({'action':'status','channel':_0x165be7[_0x53f27e][_0xb027('0xea')]})[_0xb027('0x9f')](function(_0xc1b4da){if(_0xc1b4da[_0xb027('0x69')]===_0xb027('0x14b')){setTimeout(function(){if(_0x165be7[_0x53f27e]&&_0x165be7[_0x53f27e]['type']!==_0xb027('0xbb')){_0x4cfefc['updateOriginated'](_0x4cfefc[_0xb027('0x1f')][_0x165be7[_0x53f27e][_0xb027('0xb9')]]);logger[_0xb027('0x65')](_0xb027('0x14c'),_0x1e8a86,_0x53f27e,_0x165be7[_0x53f27e][_0xb027('0xb9')]);delete _0x165be7[_0x53f27e];}if(_0x165be7[_0x53f27e]&&_0x165be7[_0x53f27e][_0xb027('0x42')]==='ivr'){_0x4cfefc[_0xb027('0xbc')](_0x4cfefc[_0xb027('0x20')][_0x165be7[_0x53f27e]['queue']]);logger['error'](_0xb027('0x14d'),_0x1e8a86,_0x53f27e,_0x165be7[_0x53f27e][_0xb027('0xb9')]);delete _0x165be7[_0x53f27e];}},0x2328);}});}});}}};Dialer[_0xb027('0x1a')][_0xb027('0x14e')]=function(_0xf887e){return Promise['resolve']()[_0xb027('0x3e')](voiceQueueRt[_0xb027('0x14e')](_0xf887e))['catch'](loggerCatch(_0xb027('0x14f')));};Dialer[_0xb027('0x1a')][_0xb027('0xbc')]=function(_0x207f13){if(!_['isUndefined'](_0x207f13)&&_0x207f13!==null){if(typeof _0x207f13[_0xb027('0x7d')]!==_0xb027('0xa6')){if(_0x207f13[_0xb027('0x7d')]>0x0){_0x207f13[_0xb027('0x7d')]-=0x1;}else{logger[_0xb027('0x65')](_0xb027('0x150'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype'][_0xb027('0x151')]=function(_0x1a7c7a,_0x49232c){var _0x197352=this;return function(_0x5d81b0){_0x197352['updateOriginated'](_0x49232c);logger['error'](_0x1a7c7a,util[_0xb027('0x46')](_0x5d81b0,{'showHidden':![],'depth':null}));};};Dialer[_0xb027('0x1a')][_0xb027('0x152')]=function(_0xb7dd70,_0xb42524,_0x4b351a){var _0x4b3a00={'state':0x19,'statedesc':_0xb027('0x153')};this['updateOriginated'](_0xb42524);this[_0xb027('0x113')](_[_0xb027('0x5f')](_0x4b3a00,_[_0xb027('0xff')](_0x4b351a,['ContactId',_0xb027('0xdb'),_0xb027('0x154'),_0xb027('0xf9'),_0xb027('0xdc')])),'[emptyContact][createHistory]','[emptyContact]');logger[_0xb027('0x65')](_0xb7dd70);};Dialer['prototype']['saveInDb']=function(_0x1132df,_0x2544cd,_0x53d05a){hopperUtils['createHistory'](_0x1132df)['catch'](loggerCatch(_0x2544cd));hopperUtils['moveContactManagedDialer'](_0x1132df)[_0xb027('0x9f')](loggerCatch(_0x53d05a));};Dialer[_0xb027('0x1a')][_0xb027('0xd8')]=function(_0x2cb4d4,_0x11fe7f){hopperUtils['createHistory'](_0x2cb4d4)['catch'](loggerCatch(_0xb027('0x155')));if(_0x11fe7f==0x0){hopperUtils['moveContactManagedDialer'](_0x2cb4d4)[_0xb027('0x9f')](loggerCatch(_0xb027('0x156')));}};Dialer[_0xb027('0x1a')][_0xb027('0x157')]=function(_0x18d35d){return Promise[_0xb027('0xa7')]()[_0xb027('0x3e')](cmHopper['handlePreviewRecallNotifications'](_0x18d35d['id'],previewRecallmeReminderInterval))[_0xb027('0x3e')](function(_0x2a9411){for(var _0x29c52b=0x0;_0x29c52b<_0x2a9411[_0xb027('0x97')];_0x29c52b++){var _0x262dd2=_0x2a9411[_0x29c52b][_0xb027('0x158')][_0xb027('0x49')];if(_0x262dd2)io['to'](util['format'](_0xb027('0x159'),_0x262dd2))['emit'](_0xb027('0x147'),{'hopper':_0x2a9411[_0x29c52b]});}})[_0xb027('0x9f')](function(){});};Dialer[_0xb027('0x1a')][_0xb027('0xaa')]=function(_0xc1c524){var _0x3fda14=this;return function(){_0x3fda14[_0xb027('0x15a')](_0xc1c524);};};Dialer[_0xb027('0x1a')][_0xb027('0x15b')]=function(_0x19eaa4,_0x169547){var _0x1614fc=this;var _0x509fa8=uuid['v4']();this[_0xb027('0xe9')][_0x509fa8]=new Action(_0x19eaa4,_0x169547,_0x509fa8);return new Promise(function(_0x117ffc,_0x5e91df){if(_[_0xb027('0x40')](_0x19eaa4)&&typeof _0x19eaa4!==_0xb027('0x15c')){return _0x5e91df(msgResponse(_0xb027('0x15d'),_0xb027('0x91'),_0xb027('0x15e')));}if(_[_0xb027('0x40')](_0x169547[_0xb027('0x15f')])||_0x169547[_0xb027('0x15f')]===null){return _0x5e91df(msgResponse('originate',_0xb027('0x91'),_0xb027('0x160')));}var _0x1fcd25={'XMD-CALLERID':_0x1614fc[_0xb027('0xe9')][_0x509fa8][_0xb027('0x161')](),'XMD-AGI':_0x19eaa4[_0xb027('0x12e')]?util[_0xb027('0x47')](_0xb027('0x162'),ipAgi,_0x19eaa4[_0xb027('0x12e')]):_0xb027('0x163'),'XMD-AGIAFTER':_0x19eaa4[_0xb027('0xc1')]?util['format'](_0xb027('0x162'),ipAgi,_0x19eaa4[_0xb027('0xc1')]):_0xb027('0x163'),'XMD-QUEUE':utils[_0xb027('0x164')](_0x19eaa4)?util[_0xb027('0x47')](_0xb027('0x165'),_0x19eaa4[_0xb027('0x49')],_0x19eaa4['dialQueueOptions']||'',_0x19eaa4[_0xb027('0xc2')]?'c':'',_0x19eaa4[_0xb027('0xc8')]||0x3):_0xb027('0x163'),'XMD-CONTACTID':_0x169547['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1614fc[_0xb027('0xe9')][_0x509fa8][_0xb027('0x161')](),'XMD-AMD':_0x19eaa4[_0xb027('0x115')]?_0xb027('0x13d'):_0xb027('0x163'),'XMD-DESTINATION':_0xb027('0x166')};if(_0x19eaa4['dialAMDActive']){_0x1fcd25['XMD-AMDINITIALSILENCE']=_0x19eaa4[_0xb027('0x167')]||0x9c4;_0x1fcd25[_0xb027('0x168')]=_0x19eaa4[_0xb027('0x169')]||0x5dc;_0x1fcd25['XMD-AMDAFTERGREETINGSILENCE']=_0x19eaa4[_0xb027('0x16a')]||0x320;_0x1fcd25[_0xb027('0x16b')]=_0x19eaa4[_0xb027('0x16c')]||0x1388;_0x1fcd25[_0xb027('0x16d')]=_0x19eaa4['dialAMDMinWordLength']||0x64;_0x1fcd25[_0xb027('0x16e')]=_0x19eaa4[_0xb027('0x16f')]||0x32;_0x1fcd25[_0xb027('0x170')]=_0x19eaa4['dialAMDMaximumNumberOfWords']||0x3;_0x1fcd25[_0xb027('0x171')]=_0x19eaa4['dialAMDSilenceThreshold']||0x100;_0x1fcd25[_0xb027('0x172')]=_0x19eaa4[_0xb027('0x173')]||0x1388;}if(utils[_0xb027('0x164')](_0x19eaa4)){_0x1fcd25[_0xb027('0x174')]=_0x169547['VoiceQueueId'];}else{_0x1fcd25[_0xb027('0x175')]=_0x169547['CampaignId'];}var _0x5a6256=utils[_0xb027('0x176')](_0x169547[_0xb027('0x177')]);Object[_0xb027('0x178')](_0x1fcd25,_0x5a6256);var _0xa19e49=_0x1614fc['isTrunkReachable'](_0x19eaa4[_0xb027('0x8a')])?utils[_0xb027('0x179')](_0x19eaa4[_0xb027('0x8a')]['callerid'],_0x19eaa4[_0xb027('0x17a')],_0x19eaa4[_0xb027('0x17b')]>0x0?utils[_0xb027('0x17c')](_0x19eaa4['dialOriginateCallerIdNumber'],_0x19eaa4[_0xb027('0x17b')]):_0x19eaa4['dialOriginateCallerIdNumber']):utils[_0xb027('0x179')](_[_0xb027('0xef')](_0x19eaa4[_0xb027('0x8b')])?_0x19eaa4[_0xb027('0x8a')]['callerid']:_0x19eaa4[_0xb027('0x8b')]['callerid'],_0x19eaa4[_0xb027('0x17a')],_0x19eaa4[_0xb027('0x17b')]>0x0?utils['getCallerIdRandom'](_0x19eaa4[_0xb027('0x17d')],_0x19eaa4[_0xb027('0x17b')]):_0x19eaa4[_0xb027('0x17d')]);if(_0xa19e49){_0x1fcd25[_0xb027('0x17e')]=_0x1614fc[_0xb027('0xe9')][_0x509fa8][_0xb027('0x17f')]=utils['extractCalleridName'](_0xa19e49);_0x1fcd25[_0xb027('0x180')]=_0x169547[_0xb027('0x15f')];}_0x19eaa4[_0xb027('0x181')]=_0x1fcd25;return ami[_0xb027('0x98')]({'actionid':_0x509fa8,'action':_0xb027('0x15d'),'channel':_0x1614fc[_0xb027('0x85')](_0x19eaa4[_0xb027('0x8a')])?util[_0xb027('0x47')](_0xb027('0x182'),_0x19eaa4[_0xb027('0x8a')][_0xb027('0x49')],isNotNull(_0x19eaa4[_0xb027('0x183')])?_0x19eaa4['dialPrefix']['trim']()||'':'',_0x19eaa4['dialCutDigit']>0x0?_0x169547['phone'][_0xb027('0x184')](_0x19eaa4['dialCutDigit']):_0x169547[_0xb027('0x15f')]):util[_0xb027('0x47')](_0xb027('0x182'),_['isNil'](_0x19eaa4['TrunkBackup'])?_0x19eaa4[_0xb027('0x8a')][_0xb027('0x49')]:_0x19eaa4[_0xb027('0x8b')][_0xb027('0x49')],isNotNull(_0x19eaa4[_0xb027('0x183')])?_0x19eaa4[_0xb027('0x183')][_0xb027('0x185')]()||'':'',_0x19eaa4[_0xb027('0x186')]>0x0?_0x169547[_0xb027('0x15f')]['substring'](_0x19eaa4[_0xb027('0x186')]):_0x169547[_0xb027('0x15f')]),'callerid':_0xa19e49,'Exten':_0xb027('0x166'),'Context':_0xb027('0x187'),'Priority':'1','variable':_0x1fcd25,'timeout':(_0x19eaa4['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x509fa8})[_0xb027('0x3e')](function(_0x3045ee){return _0x117ffc(_0x3045ee);})[_0xb027('0x9f')](function(_0x455b82){_0x19eaa4[_0xb027('0x188')]+=0x1;var _0x4f8a2e=new History(_0x1614fc[_0xb027('0xe9')][_0x509fa8]);logger[_0xb027('0x65')](util[_0xb027('0x47')](_0xb027('0x189'),JSON[_0xb027('0x75')](_0x455b82)));_0x4f8a2e[_0xb027('0x70')]=0xe;_0x4f8a2e[_0xb027('0xcc')]='OriginateError';_0x4f8a2e['starttime']=moment()[_0xb027('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f8a2e[_0xb027('0x71')]=_0x4f8a2e[_0xb027('0x72')];hopperUtils[_0xb027('0xc3')](_0x4f8a2e)['catch'](loggerCatch(_0xb027('0x18a')));_0x1614fc[_0xb027('0xc4')](_0x4f8a2e)['catch'](loggerCatch(_0xb027('0x18a')))[_0xb027('0xf8')](function(){delete _0x1614fc[_0xb027('0xe9')][_0x509fa8];return _0x5e91df(msgResponse(_0xb027('0x15d'),_0xb027('0x84'),_0xb027('0x18b')));});});});};Dialer[_0xb027('0x1a')][_0xb027('0x18c')]=function(_0x358e39,_0x400a74,_0x478f06){var _0x362dd7=new History(_0x400a74);if(_0x362dd7[_0xb027('0x11a')]+_0x362dd7[_0xb027('0x11b')]+_0x362dd7['countnoanswerretry']+_0x362dd7['countnosuchnumberretry']+_0x362dd7[_0xb027('0xd1')]+_0x362dd7[_0xb027('0xe3')]+_0x362dd7['countmachineretry']+_0x362dd7[_0xb027('0x11d')]>=_0x478f06['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x358e39){case 0x3:if(_0x362dd7[_0xb027('0x18d')]>=_0x478f06[_0xb027('0x18e')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x362dd7[_0xb027('0x18d')]+=0x1,'scheduledat':moment()[_0xb027('0xe4')](_0x478f06['dialNoAnswerRetryFrequency'],_0xb027('0xda'))[_0xb027('0x47')](_0xb027('0xbe')),'ContactId':_0x362dd7['ContactId'],'ListId':_0x362dd7[_0xb027('0xdb')],'VoiceQueueId':_0x362dd7[_0xb027('0xf9')]||undefined,'CampaignId':_0x362dd7['CampaignId']||undefined})[_0xb027('0x9f')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x362dd7[_0xb027('0x11a')]>=_0x478f06[_0xb027('0x18f')]-0x1){return!![];}hopperUtils[_0xb027('0xd9')]({'active':![],'countbusyretry':_0x362dd7[_0xb027('0x11a')]+=0x1,'scheduledat':moment()['add'](_0x478f06['dialBusyRetryFrequency'],_0xb027('0xda'))[_0xb027('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x362dd7['ContactId'],'ListId':_0x362dd7[_0xb027('0xdb')],'VoiceQueueId':_0x362dd7[_0xb027('0xf9')]||undefined,'CampaignId':_0x362dd7['CampaignId']||undefined})[_0xb027('0x9f')](loggerCatch(_0xb027('0x190')));break;case 0x8:if(_0x362dd7[_0xb027('0x11b')]>=_0x478f06[_0xb027('0x191')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x362dd7[_0xb027('0x11b')]+=0x1,'scheduledat':moment()[_0xb027('0xe4')](_0x478f06[_0xb027('0x192')],_0xb027('0xda'))[_0xb027('0x47')](_0xb027('0xbe')),'ContactId':_0x362dd7[_0xb027('0xe6')],'ListId':_0x362dd7[_0xb027('0xdb')],'VoiceQueueId':_0x362dd7[_0xb027('0xf9')]||undefined,'CampaignId':_0x362dd7[_0xb027('0xdc')]||undefined})[_0xb027('0x9f')](loggerCatch(_0xb027('0x193')));break;case 0x0:if(_0x362dd7['countnosuchnumberretry']>=_0x478f06[_0xb027('0x194')]-0x1){return!![];}else{hopperUtils[_0xb027('0xd9')]({'active':![],'countnosuchnumberretry':_0x362dd7[_0xb027('0x11c')]+=0x1,'scheduledat':moment()['add'](_0x478f06[_0xb027('0x195')],_0xb027('0xda'))[_0xb027('0x47')](_0xb027('0xbe')),'ContactId':_0x362dd7['ContactId'],'ListId':_0x362dd7[_0xb027('0xdb')],'VoiceQueueId':_0x362dd7[_0xb027('0xf9')]||undefined,'CampaignId':_0x362dd7[_0xb027('0xdc')]||undefined})[_0xb027('0x9f')](loggerCatch(_0xb027('0x196')));}break;case 0xa:if(_0x362dd7[_0xb027('0xd1')]>=_0x478f06[_0xb027('0xd7')]-0x1){return!![];}hopperUtils[_0xb027('0xd9')]({'active':![],'countdropretry':_0x362dd7[_0xb027('0xd1')]+=0x1,'scheduledat':moment()[_0xb027('0xe4')](_0x478f06[_0xb027('0x197')],_0xb027('0xda'))[_0xb027('0x47')](_0xb027('0xbe')),'ContactId':_0x362dd7['ContactId'],'ListId':_0x362dd7[_0xb027('0xdb')],'VoiceQueueId':_0x362dd7[_0xb027('0xf9')]||undefined,'CampaignId':_0x362dd7[_0xb027('0xdc')]||undefined})[_0xb027('0x9f')](loggerCatch(_0xb027('0xdd')));break;case 0xb:if(_0x362dd7[_0xb027('0xe3')]>=_0x478f06[_0xb027('0x198')]-0x1){return!![];}hopperUtils[_0xb027('0xd9')]({'active':![],'countabandonedretry':_0x362dd7[_0xb027('0xe3')]+=0x1,'scheduledat':moment()['add'](_0x478f06[_0xb027('0xe5')],_0xb027('0xda'))[_0xb027('0x47')](_0xb027('0xbe')),'ContactId':_0x362dd7[_0xb027('0xe6')],'ListId':_0x362dd7['ListId'],'VoiceQueueId':_0x362dd7[_0xb027('0xf9')]||undefined,'CampaignId':_0x362dd7[_0xb027('0xdc')]||undefined})[_0xb027('0x9f')](loggerCatch(_0xb027('0xe7')));break;case 0x13:if(_0x362dd7['countmachineretry']>=_0x478f06['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0xb027('0xd9')]({'active':![],'countmachineretry':_0x362dd7[_0xb027('0x118')]+=0x1,'scheduledat':moment()[_0xb027('0xe4')](_0x478f06[_0xb027('0x129')],_0xb027('0xda'))['format'](_0xb027('0xbe')),'ContactId':_0x362dd7[_0xb027('0xe6')],'ListId':_0x362dd7[_0xb027('0xdb')],'VoiceQueueId':_0x362dd7[_0xb027('0xf9')]||undefined,'CampaignId':_0x362dd7[_0xb027('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x362dd7[_0xb027('0x11d')]>=_0x478f06[_0xb027('0x199')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x362dd7[_0xb027('0x11d')]+=0x1,'scheduledat':moment()[_0xb027('0xe4')](_0x478f06[_0xb027('0x19a')],_0xb027('0xda'))[_0xb027('0x47')](_0xb027('0xbe')),'ContactId':_0x362dd7[_0xb027('0xe6')],'ListId':_0x362dd7[_0xb027('0xdb')],'VoiceQueueId':_0x362dd7[_0xb027('0xf9')]||undefined,'CampaignId':_0x362dd7['CampaignId']||undefined})[_0xb027('0x9f')](loggerCatch(_0xb027('0x19b')));break;default:return!![];}};Dialer[_0xb027('0x1a')][_0xb027('0x109')]=function(_0x28aa87,_0x4f55c4,_0x4fce8c){var _0x500291=this;var _0x3bf1fc=new History(_0x28aa87);var _0x88ff8b=![];var _0x233443;var _0x23ee73;return new Promise(function(_0x1cf03c,_0x5dbd43){if(_['isUndefined'](_0x4f55c4)&&typeof _0x4f55c4!==_0xb027('0x15c')){return _0x5dbd43(msgResponse(_0xb027('0x19c'),_0xb027('0x91'),_0xb027('0x19d')));}if(_['isUndefined'](_0x4fce8c)&&typeof _0x4fce8c!==_0xb027('0x15c')){return _0x5dbd43(msgResponse('[callProgressDetecting]',_0xb027('0x91'),'evt\x20is\x20undefine'));}hopperUtils[_0xb027('0xd4')](_0x3bf1fc,_0x4fce8c[_0xb027('0x19e')],_0x4f55c4)[_0xb027('0x3e')](function(_0x1f3725){if(_0x1f3725['additional']==0x1)_0x88ff8b=!![];switch(_0x4fce8c[_0xb027('0x19e')]){case'0':_0x4f55c4[_0xb027('0x19f')]+=0x1;_0x3bf1fc[_0xb027('0x70')]=0x0;_0x3bf1fc[_0xb027('0xcc')]=_0xb027('0x1a0');_0x3bf1fc['countnosuchnumberretry']+=0x1;_0x3bf1fc[_0xb027('0xd2')]+=0x1;ami[_0xb027('0x41')](_0xb027('0x1a1'),ut[_0xb027('0x111')](_0x28aa87,'nosuchnumber'));_0x233443=_0x4f55c4[_0xb027('0x195')];_0x23ee73=_0x4f55c4[_0xb027('0xd3')];hopperUtils[_0xb027('0xc3')](_0x3bf1fc)[_0xb027('0x9f')](loggerCatch(_0xb027('0x119')));if(_0x500291[_0xb027('0x18c')](0x0,_0x28aa87,_0x4f55c4)&&!_0x88ff8b){if(_0x3bf1fc[_0xb027('0x11c')]>=_0x4f55c4[_0xb027('0x194')]){_0x500291[_0xb027('0x121')](_0x3bf1fc,_0x1cf03c,_0x5dbd43,_0xb027('0x1a2'));}else{_0x500291[_0xb027('0x11f')](_0x3bf1fc,_0x1cf03c,_0x5dbd43,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x4f55c4[_0xb027('0x1a3')]+=0x1;_0x3bf1fc[_0xb027('0x70')]=0x3;_0x3bf1fc['statedesc']=_0xb027('0x1a4');_0x3bf1fc[_0xb027('0x18d')]+=0x1;_0x3bf1fc[_0xb027('0xd2')]+=0x1;var _0x562749=ut[_0xb027('0x1a5')](_0x28aa87,_0x4f55c4);ami[_0xb027('0x41')]('custom:agentnoanswer',_0x562749);_0x233443=_0x4f55c4[_0xb027('0x1a6')];_0x23ee73=_0x4f55c4[_0xb027('0xd3')];hopperUtils[_0xb027('0xc3')](_0x3bf1fc)['catch'](loggerCatch(_0xb027('0x1a7')));if(_0x500291['checkRetriveMax'](0x3,_0x28aa87,_0x4f55c4)&&!_0x88ff8b){if(_0x3bf1fc[_0xb027('0x18d')]>=_0x4f55c4[_0xb027('0x18e')]){_0x500291[_0xb027('0x121')](_0x3bf1fc,_0x1cf03c,_0x5dbd43,_0xb027('0x1a8'));}else{_0x500291[_0xb027('0x11f')](_0x3bf1fc,_0x1cf03c,_0x5dbd43,_0xb027('0x1a8'));}}break;case'5':_0x4f55c4[_0xb027('0x1a9')]+=0x1;_0x3bf1fc[_0xb027('0x70')]=0x5;_0x3bf1fc[_0xb027('0xcc')]=_0xb027('0x1aa');_0x3bf1fc['countbusyretry']+=0x1;_0x3bf1fc[_0xb027('0xd2')]+=0x1;ami[_0xb027('0x41')]('custom:agentbusy',ut['buildObj'](_0x28aa87,_0xb027('0x1ab')));_0x233443=_0x4f55c4[_0xb027('0x1ac')];_0x23ee73=_0x4f55c4[_0xb027('0xd3')];hopperUtils[_0xb027('0xc3')](_0x3bf1fc)[_0xb027('0x9f')](loggerCatch(_0xb027('0x1ad')));if(_0x500291['checkRetriveMax'](0x5,_0x28aa87,_0x4f55c4)&&!_0x88ff8b){if(_0x3bf1fc[_0xb027('0x11a')]>=_0x4f55c4[_0xb027('0x18f')]){_0x500291[_0xb027('0x121')](_0x3bf1fc,_0x1cf03c,_0x5dbd43,_0xb027('0x1ae'));}else{_0x500291[_0xb027('0x11f')](_0x3bf1fc,_0x1cf03c,_0x5dbd43,_0xb027('0x1ae'));}}break;case'8':_0x4f55c4[_0xb027('0x1af')]+=0x1;_0x3bf1fc[_0xb027('0x70')]=0x8;_0x3bf1fc[_0xb027('0xcc')]=_0xb027('0x1b0');_0x3bf1fc[_0xb027('0x11b')]+=0x1;_0x3bf1fc[_0xb027('0xd2')]+=0x1;_0x233443=_0x4f55c4['dialCongestionRetryFrequency'];_0x23ee73=_0x4f55c4['callAdditionalPhoneAfterMin'];ami[_0xb027('0x41')](_0xb027('0x1b1'),ut[_0xb027('0x111')](_0x28aa87,_0xb027('0x1b2')));hopperUtils[_0xb027('0xc3')](_0x3bf1fc)[_0xb027('0x9f')](loggerCatch(_0xb027('0x1b3')));if(_0x500291[_0xb027('0x18c')](0x8,_0x28aa87,_0x4f55c4)&&!_0x88ff8b){if(_0x3bf1fc[_0xb027('0x11b')]>=_0x4f55c4[_0xb027('0x191')]){_0x500291[_0xb027('0x121')](_0x3bf1fc,_0x1cf03c,_0x5dbd43,_0xb027('0x1b4'));}else{_0x500291[_0xb027('0x11f')](_0x3bf1fc,_0x1cf03c,_0x5dbd43,'reason\x208\x20congestion');}}break;case'11':_0x4f55c4[_0xb027('0x1b5')]+=0x1;_0x3bf1fc[_0xb027('0x70')]=0xb;_0x3bf1fc[_0xb027('0xcc')]=_0xb027('0xe8');_0x3bf1fc[_0xb027('0xe3')]+=0x1;_0x3bf1fc['countglobal']+=0x1;_0x233443=_0x4f55c4['dialAbandonedRetryFrequency'];_0x23ee73=_0x4f55c4[_0xb027('0xd3')];hopperUtils[_0xb027('0xc3')](_0x3bf1fc)[_0xb027('0x9f')](loggerCatch(_0xb027('0x1b6')));if(_0x500291[_0xb027('0x18c')](0xb,_0x28aa87,_0x4f55c4)&&!_0x88ff8b){if(_0x3bf1fc[_0xb027('0xe3')]>=_0x4f55c4[_0xb027('0x198')]){_0x500291['createStateFinal'](_0x3bf1fc,_0x1cf03c,_0x5dbd43,'reason\x2011\x20abandoned');}else{_0x500291['stateGlobal'](_0x3bf1fc,_0x1cf03c,_0x5dbd43,_0xb027('0x1b7'));}}break;case'20':_0x4f55c4[_0xb027('0x1b8')]+=0x1;_0x3bf1fc[_0xb027('0x70')]=0x14;_0x3bf1fc[_0xb027('0xcc')]=_0xb027('0x1b9');_0x3bf1fc['countagentrejectretry']+=0x1;_0x3bf1fc[_0xb027('0xd2')]+=0x1;_0x233443=_0x4f55c4[_0xb027('0x19a')];_0x23ee73=_0x4f55c4[_0xb027('0xd3')];ami['emit'](_0xb027('0x1ba'),ut[_0xb027('0x111')](_0x28aa87,'agentreject'));hopperUtils[_0xb027('0xc3')](_0x3bf1fc)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x500291[_0xb027('0x18c')](0x14,_0x28aa87,_0x4f55c4)&&!_0x88ff8b){if(_0x3bf1fc[_0xb027('0x11d')]>=_0x4f55c4[_0xb027('0x199')]){_0x500291[_0xb027('0x121')](_0x3bf1fc,_0x1cf03c,_0x5dbd43,_0xb027('0x1bb'));}else{_0x500291[_0xb027('0x11f')](_0x3bf1fc,_0x1cf03c,_0x5dbd43,_0xb027('0x1bb'));}}break;default:_0x4f55c4[_0xb027('0x131')]+=0x1;_0x3bf1fc['state']=0xc;_0x3bf1fc[_0xb027('0xcc')]=_0x4fce8c[_0xb027('0x19e')];_0x233443=_0x4f55c4[_0xb027('0x19a')];_0x23ee73=_0x4f55c4['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x3bf1fc)[_0xb027('0x9f')](loggerCatch(_0xb027('0x1bc')));if(_0x500291[_0xb027('0x18c')](_0x4fce8c[_0xb027('0x19e')],_0x28aa87,_0x4f55c4)&&!_0x88ff8b){if(_0x3bf1fc['countbusyretry']+_0x3bf1fc['countcongestionretry']+_0x3bf1fc[_0xb027('0x18d')]+_0x3bf1fc[_0xb027('0x11c')]+_0x3bf1fc[_0xb027('0xd1')]+_0x3bf1fc[_0xb027('0xe3')]+_0x3bf1fc[_0xb027('0x118')]+_0x3bf1fc['countagentrejectretry']>=_0x4f55c4[_0xb027('0x11e')]){_0x500291['stateGlobal'](_0x3bf1fc,_0x1cf03c,_0x5dbd43,_0x4fce8c[_0xb027('0x19e')]);}else{_0x500291['createStateFinal'](_0x3bf1fc,_0x1cf03c,_0x5dbd43,_0x4fce8c[_0xb027('0x19e')]);}}}})[_0xb027('0x3e')](function(){if(_0x88ff8b){hopperUtils['swapAdditionalPhones'](_0x3bf1fc,_0x233443,_0x23ee73)[_0xb027('0x3e')](function(){return _0x1cf03c(0x1);});}});});};Dialer[_0xb027('0x1a')][_0xb027('0x11f')]=function(_0x3d59fa,_0x5ab5c3,_0x5f1e6e,_0x3095f3){var _0x181ae6=new Final(_0x3d59fa);_0x181ae6[_0xb027('0x70')]=0xf;_0x181ae6[_0xb027('0xcc')]='Global';this['createStateFinal'](_0x181ae6,_0x5ab5c3,_0x5f1e6e,_0x3095f3);};Dialer[_0xb027('0x1a')][_0xb027('0x121')]=function(_0x31669f,_0x25e6c4,_0x25cb12,_0x3c2b98){hopperUtils[_0xb027('0xc4')](_0x31669f)[_0xb027('0x3e')](function(){return _0x25e6c4(msgResponse('[callProgressDetecting]',_0xb027('0x108'),_0x3c2b98));})[_0xb027('0x9f')](function(){return _0x25cb12(msgResponse(_0xb027('0x1bd'),_0xb027('0x91'),_0xb027('0x1be')));});};Dialer[_0xb027('0x1a')][_0xb027('0x9')]=function(_0x18e187){var _0x2b40bd=_0x18e187[_0xb027('0x1bf')]/0x64;var _0x597e15=_0x18e187[_0xb027('0xca')]/(_0x18e187[_0xb027('0xca')]+_0x18e187[_0xb027('0xbf')]);var _0x1e6b1b=Math[_0xb027('0x1c0')](_0x18e187[_0xb027('0x1c1')]*(_0x18e187[_0xb027('0x1c2')]/0x64));var _0x126459=Math[_0xb027('0x1c0')](_0x18e187[_0xb027('0x1c1')]*(_0x18e187[_0xb027('0x1c3')]/0x64));var _0x2a5db2=_0x18e187[_0xb027('0x139')]+_0x18e187[_0xb027('0x13b')];var _0x1e5aba=Math[_0xb027('0x1c4')](_0x18e187['erlangCalls']*_0x18e187[_0xb027('0x1c5')]*_0x18e187[_0xb027('0x1c6')]*_0x18e187[_0xb027('0x1c7')]);if(_['isUndefined'](_0x18e187[_0xb027('0x61')])){if(!_[_0xb027('0x40')](_0x18e187[_0xb027('0x28')])){_0x18e187[_0xb027('0x28')]=undefined;loggerPredictive[_0xb027('0x65')](_0xb027('0x1c8'),_0xb027('0x1c9'));}if(!_[_0xb027('0x40')](_0x18e187['handlePredictive'])){loggerPredictive[_0xb027('0x65')](_0xb027('0x1c8'),_0xb027('0x1ca'));clearInterval(_0x18e187[_0xb027('0x64')]);_0x18e187[_0xb027('0x64')]=undefined;}_0x18e187[_0xb027('0x61')]=moment()[_0xb027('0x47')](_0xb027('0xbe'));loggerPredictive['info'](_0x18e187[_0xb027('0x49')],_0xb027('0x1cb'),_0x18e187[_0xb027('0x61')]);this[_0xb027('0xac')](_0x18e187,0x1);}else if(ifInterval(_0x18e187[_0xb027('0x1cc')],_0x18e187[_0xb027('0x61')])){this[_0xb027('0xac')](_0x18e187,0x1);loggerPredictiveCalls[_0xb027('0x4c')](_0xb027('0x1cd'),_0x18e187['startProgressive'],_0x18e187[_0xb027('0x49')]);_0x18e187[_0xb027('0x5b')]=0x0;_0x18e187[_0xb027('0xcb')]=0x0;}else if(_0x2b40bd<_0x597e15&&_0x18e187['dialPredictiveOptimization']===_0xb027('0x1ce')){clearPredictiveAttributes(_0x18e187);loggerPredictive['info'](_0xb027('0x1cf'),_0xb027('0x1d0'),_0x597e15,'startProgressive',_0x18e187[_0xb027('0x49')]);}else if(_0x1e5aba<_0x18e187[_0xb027('0xcb')]&&_0x18e187[_0xb027('0x1d1')]==='dropRate'){clearPredictiveAttributes(_0x18e187);loggerPredictive[_0xb027('0x4c')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xb027('0x1d2'),_0x1e5aba,'Drop\x20in\x20this\x20interval',_0x18e187['predictiveIntervalErlangCallsDroppedCalls'],_0xb027('0x61'),_0x18e187[_0xb027('0x49')]);}else if(!ifInterval(_0x18e187[_0xb027('0x1cc')],_0x18e187[_0xb027('0x61')])&&_[_0xb027('0x40')](_0x18e187[_0xb027('0x28')])&&!_[_0xb027('0x40')](_0x18e187[_0xb027('0x61')])){_0x18e187[_0xb027('0x28')]=moment()[_0xb027('0x47')](_0xb027('0xbe'));loggerPredictive[_0xb027('0x4c')](_0x18e187[_0xb027('0x49')],'started\x20in\x20predictive\x20at',_0x18e187[_0xb027('0x28')]);hopperUtils[_0xb027('0x1d3')](_0x18e187[_0xb027('0x1cc')])[_0xb027('0x3e')](this[_0xb027('0x1d4')](_0x18e187))[_0xb027('0x3e')](mergeDataErlangB(_0x18e187))[_0xb027('0x3e')](this[_0xb027('0x1d5')](_0x18e187))['catch'](loggerCatchPredictive(_0xb027('0x1d6'),_0x18e187));}else if(!ifInterval(_0x18e187[_0xb027('0x1cc')],_0x18e187['startPredictive'])){_0x18e187[_0xb027('0xcb')]=0x0;_0x18e187[_0xb027('0x28')]=moment()[_0xb027('0x47')](_0xb027('0xbe'));loggerPredictive['info'](_0x18e187[_0xb027('0x49')],'recalculate\x20predictive\x20at',_0x18e187[_0xb027('0x28')]);clearInterval(_0x18e187[_0xb027('0x64')]);_0x18e187[_0xb027('0x64')]=undefined;hopperUtils[_0xb027('0x1d3')](_0x18e187[_0xb027('0x1cc')])[_0xb027('0x3e')](this[_0xb027('0x1d4')](_0x18e187))[_0xb027('0x3e')](mergeDataErlangB(_0x18e187))[_0xb027('0x3e')](this[_0xb027('0x1d5')](_0x18e187))[_0xb027('0x9f')](loggerCatchPredictive(_0xb027('0x1d7'),_0x18e187));}else if(_0x18e187['predictiveIntervalAvailable']&&_0x2a5db2<_0x18e187['predictiveIntervalAvailable']-_0x126459){clearPredictiveAttributes(_0x18e187);loggerPredictive[_0xb027('0x4c')](_0x18e187[_0xb027('0x49')],_0xb027('0x1d8'),_0x2a5db2,_0xb027('0x1d9'),_0x18e187[_0xb027('0x1c1')],'-',_0x126459,'=',_0x18e187[_0xb027('0x1c1')]-_0x126459,')');}else if(_0x18e187[_0xb027('0x1c1')]&&_0x2a5db2>_0x18e187['predictiveIntervalAvailable']+_0x1e6b1b){clearPredictiveAttributes(_0x18e187);loggerPredictive[_0xb027('0x4c')](_0x18e187[_0xb027('0x49')],_0xb027('0x1d8'),_0x2a5db2,_0xb027('0x1da'),_0x18e187[_0xb027('0x1c1')],'+',_0x1e6b1b,'=',_0x18e187['predictiveIntervalAvailable']+_0x1e6b1b,')');}};Dialer['prototype']['getDataPredictive']=function(_0x4ab86f){var _0x51fdc9=this;return function(_0xaa5005){return new Promise(function(_0x47a394,_0x5e4c91){_[_0xb027('0x5f')](_0x4ab86f,_0xaa5005[0x0]);if(checkGetDataPredictive(_0xaa5005[0x0])){var _0x19c600=_0x4ab86f[_0xb027('0x1c1')]=_0x4ab86f['talking']+_0x4ab86f[_0xb027('0x139')];var _0x2fe348=_0x4ab86f[_0xb027('0x1cc')]*0x3c;var _0xe1dfb0=_0xaa5005[0x0][_0xb027('0x56')]+_0xaa5005[0x0]['predictiveIntervalAvgHoldtime'];var _0x2f24fc=(_0xaa5005[0x0][_0xb027('0x50')]+_0xaa5005[0x0][_0xb027('0xc9')]+_0xaa5005[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xaa5005[0x0][_0xb027('0x4e')];_0x4ab86f[_0xb027('0x1c6')]=_0x2f24fc>0x0?_0x2f24fc:0x1;switch(_0x4ab86f['dialPredictiveOptimization']){case'dropRate':var _0x317c03=_0x4ab86f[_0xb027('0x1bf')]/0x64;return _0x51fdc9[_0xb027('0x1db')](_0x19c600,_0x2fe348,_0xe1dfb0,_0x2f24fc,_0x317c03)[_0xb027('0x3e')](function(_0x1b06ae){return _0x47a394(_0x1b06ae);});case _0xb027('0x1dc'):var _0x3308e7=_0x4ab86f[_0xb027('0x1bf')]/0x64;return _0x51fdc9['busyFactor'](_0x19c600,_0x2fe348,_0xe1dfb0,_0x2f24fc,_0x3308e7)[_0xb027('0x3e')](function(_0x492fde){return _0x47a394(_0x492fde);});default:return _0x5e4c91(msgResponse(_0xb027('0x1dd'),'Failure',_0xb027('0x1de')));}}else{return _0x5e4c91(msgResponse(_0xb027('0x1dd'),'Failure',_0xb027('0x1df')));}});};};Dialer[_0xb027('0x1a')][_0xb027('0x1e0')]=function(_0x1a52e5){var _0x1ff9fd=this;return function(_0x8e6a6){return new Promise(function(_0x2d18b6,_0x25b839){_['merge'](_0x1a52e5,_0x8e6a6[0x0]);if(checkGetDataPredictive(_0x8e6a6[0x0])){loggerPredictive[_0xb027('0x4c')](JSON[_0xb027('0x75')](_0x8e6a6[0x0]));if(_0x1a52e5['dialPredictiveOptimization']===_0xb027('0x1ce')){return _0x1ff9fd['getVoiceQueueRtPauses'](_0x1a52e5['id'])[_0xb027('0x3e')](function(_0x1030d4){var _0x26d76b=_0x1a52e5[_0xb027('0x1e1')]-_0x1030d4[0x0][_0xb027('0x1e2')];var _0x303e9c=_0x1a52e5[_0xb027('0x1cc')]*0x3c;var _0x4a3766=_0x8e6a6[0x0]['predictiveIntervalAvgTalktime']+_0x8e6a6[0x0][_0xb027('0x57')];var _0x556e02=(_0x8e6a6[0x0][_0xb027('0x50')]+_0x8e6a6[0x0][_0xb027('0xc9')]+_0x8e6a6[0x0][_0xb027('0x53')])/_0x8e6a6[0x0][_0xb027('0x4e')];var _0x36c341=_0x1a52e5['dialPredictiveOptimizationPercentage']/0x64;_0x1a52e5[_0xb027('0x1e3')]=_0x1030d4[0x0]['outboundQueuePauses']||0x0;_0x1a52e5[_0xb027('0x1c6')]=_0x556e02>0x0?_0x556e02:0x1;return _0x1ff9fd[_0xb027('0x1db')](_0x26d76b,_0x303e9c,_0x4a3766,_0x556e02,_0x36c341);})['then'](function(_0x5073d7){return _0x2d18b6(_0x5073d7);})['catch'](function(_0x5a0506){return _0x25b839(msgResponse(_0xb027('0x1e4'),_0xb027('0x91'),JSON[_0xb027('0x75')](_0x5a0506)));});}if(_0x1a52e5[_0xb027('0x1d1')]==='agentBusyFactor'){return _0x1ff9fd[_0xb027('0x14e')](_0x1a52e5['id'])[_0xb027('0x3e')](function(_0x37402e){var _0x20ebbc=_0x1a52e5[_0xb027('0x1e1')]-_0x37402e[0x0][_0xb027('0x1e2')];var _0x4ac03f=_0x1a52e5[_0xb027('0x1cc')]*0x3c;var _0x18479a=_0x8e6a6[0x0][_0xb027('0x56')]+_0x8e6a6[0x0][_0xb027('0x57')];var _0x168efe=(_0x8e6a6[0x0][_0xb027('0x50')]+_0x8e6a6[0x0][_0xb027('0xc9')]+_0x8e6a6[0x0][_0xb027('0x53')])/_0x8e6a6[0x0][_0xb027('0x4e')];var _0x3551e5=_0x1a52e5[_0xb027('0x1bf')]/0x64;_0x1a52e5[_0xb027('0x1e3')]=_0x37402e[0x0]['outboundQueuePauses']||0x0;_0x1a52e5[_0xb027('0x1c6')]=_0x168efe>0x0?_0x168efe:0x1;return _0x1ff9fd[_0xb027('0x1e5')](_0x20ebbc,_0x4ac03f,_0x18479a,_0x168efe,_0x3551e5);})[_0xb027('0x3e')](function(_0x248aa6){return _0x2d18b6(_0x248aa6);})[_0xb027('0x9f')](function(_0x54836f){return _0x25b839(msgResponse(_0xb027('0x1e4'),'Failure',JSON['stringify'](_0x54836f)));});}}else{return _0x25b839(msgResponse(_0xb027('0x1dd'),_0xb027('0x91'),_0xb027('0x1df')));}});};};Dialer[_0xb027('0x1a')][_0xb027('0x1d5')]=function(_0x2a7e17){var _0x42a9ae=this;return function(){var _0x52b67c=0x0;var _0x596596=Math[_0xb027('0x1c4')](_0x2a7e17[_0xb027('0x1e6')]*0x3e8);if(_0x596596>0x0){_0x596596=_0x596596<0x64?0x64:_0x596596;loggerPredictive['info'](_0x2a7e17['name'],'one\x20call\x20every:',_0x596596,_0xb027('0x1e7'));_0x2a7e17[_0xb027('0x64')]=setInterval(function(){_0x42a9ae[_0xb027('0x64')](_0x2a7e17);loggerPredictiveCalls[_0xb027('0x4c')](_0xb027('0x1e8'),_0x52b67c+=0x1);},_0x596596);}else{loggerPredictive[_0xb027('0x4c')](_0x2a7e17['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0xb027('0x1e9')]=function(_0x5ea888,_0x39d77e){var _0x3c251d=this;return function(_0x22837b){if(_[_0xb027('0x4b')](_0x22837b)){if(_[_0xb027('0xef')](_0x39d77e[_0xb027('0x154')])||!_0x39d77e['recallme']){if(_0x5ea888['dialMethod']===_0xb027('0x8')){_0x5ea888[_0xb027('0x73')]=_[_0xb027('0x40')](_0x5ea888[_0xb027('0x73')])?!![]:_0x5ea888[_0xb027('0x73')];var _0x5949f9=uuid['v4']();_0x3c251d[_0xb027('0xe9')][_0x5949f9]=new Action(_0x5ea888,_0x39d77e,_0x5949f9);loggerBooked['info'](_0xb027('0x1ea'),_0x5949f9,'queueStatusComplete:\x20',JSON[_0xb027('0x75')](_0x5ea888['queueStatusComplete']),_0xb027('0x1eb'),_0x5ea888[_0xb027('0x49')]);if(_0x5ea888['queueStatusComplete']){_0x5ea888[_0xb027('0x73')]=![];_0x3c251d[_0xb027('0x2a')][_0x3c251d[_0xb027('0xe9')][_0x5949f9][_0xb027('0xb9')]]=[];ami[_0xb027('0x98')]({'actionid':_0x5949f9,'action':_0xb027('0x1ec'),'queue':_0x5ea888[_0xb027('0x49')]})['catch'](function(){_0x3c251d[_0xb027('0xbc')](_0x5ea888);hopperUtils[_0xb027('0xd9')]({'active':![],'ContactId':_0x3c251d[_0xb027('0xe9')][_0x5949f9][_0xb027('0xe6')],'ListId':_0x3c251d[_0xb027('0xe9')][_0x5949f9][_0xb027('0xdb')],'VoiceQueueId':_0x3c251d[_0xb027('0xe9')][_0x5949f9][_0xb027('0xf9')]||undefined,'CampaignId':_0x3c251d[_0xb027('0xe9')][_0x5949f9]['CampaignId']||undefined})[_0xb027('0x9f')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x3c251d[_0xb027('0xe9')][_0x5949f9];});}else{loggerBooked[_0xb027('0x4c')](_0xb027('0x1ed'),JSON[_0xb027('0x75')](_0x5ea888[_0xb027('0x73')]),_0xb027('0x1eb'),_0x5ea888[_0xb027('0x49')]);_0x3c251d[_0xb027('0xbc')](_0x5ea888);hopperUtils[_0xb027('0xd9')]({'active':![],'ContactId':_0x3c251d[_0xb027('0xe9')][_0x5949f9][_0xb027('0xe6')],'ListId':_0x3c251d[_0xb027('0xe9')][_0x5949f9][_0xb027('0xdb')],'VoiceQueueId':_0x3c251d['actions'][_0x5949f9][_0xb027('0xf9')]||undefined,'CampaignId':_0x3c251d[_0xb027('0xe9')][_0x5949f9]['CampaignId']||undefined})[_0xb027('0x9f')](loggerCatch(_0xb027('0x1ee')));delete _0x3c251d['actions'][_0x5949f9];}}else{return _0x3c251d[_0xb027('0x15b')](_0x5ea888,_0x39d77e);}}else{if(utils[_0xb027('0x60')](undefined,_0x39d77e[_0xb027('0x1ef')])<_0x5ea888['dialRecallMeTimeout']*0x3c){if(_0x39d77e[_0xb027('0x158')]&&!_0x39d77e[_0xb027('0x158')][_0xb027('0x1f0')]){_0x3c251d['preview']['run'](_0x39d77e['id'])[_0xb027('0xf8')](function(){_0x3c251d[_0xb027('0xbc')](_0x5ea888);});}else{hopperUtils[_0xb027('0x1f1')]({'active':![]},_0x39d77e['id'],0x1)[_0xb027('0xf8')](function(){_0x3c251d[_0xb027('0xbc')](_0x5ea888);});}}else{_0x5ea888[_0xb027('0x1f2')]+=0x1;_0x3c251d[_0xb027('0xbc')](_0x5ea888);if(_0x5ea888[_0xb027('0x1f3')]){hopperUtils[_0xb027('0xd9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x39d77e[_0xb027('0xe6')],'ListId':_0x39d77e['ListId'],'VoiceQueueId':_0x39d77e[_0xb027('0xf9')]||undefined,'CampaignId':_0x39d77e['CampaignId']||undefined})[_0xb027('0x9f')](loggerCatch(_0xb027('0x1f4')));hopperUtils[_0xb027('0xc3')](createObjHistory(_0x5ea888,_0x39d77e,utils[_0xb027('0x6a')][_0xb027('0x1f5')],0x17,_0xb027('0x1f6')))[_0xb027('0x9f')](loggerCatch(_0xb027('0x1f7')));}else{_0x3c251d['saveInDb'](createObjHistory(_0x5ea888,_0x39d77e,utils['CAMPAIGN_STATUS'][_0xb027('0x1f8')],0x16,_0xb027('0x1f9')),_0xb027('0x1fa'),_0xb027('0x1fb'));}}}}else{_0x5ea888['outboundBlacklistCallsDay']+=0x1;_0x3c251d['saveInDb'](createObjHistory(_0x5ea888,_0x39d77e,utils['CAMPAIGN_STATUS'][_0xb027('0x1fc')],0xd,_0xb027('0x1fd')),_0xb027('0x1fe'),_0xb027('0x1ff'));throw'inBlackList';}};};Dialer[_0xb027('0x1a')][_0xb027('0x15a')]=function(_0x48053a){var _0x3126b8=this;var _0x47b30a=_0x48053a['limitCalls']-_0x48053a[_0xb027('0x7d')];emitCampaignSummary(_0x48053a);if(_0x47b30a>0x0&&_0x48053a[_0xb027('0x200')]==0x0){if(_0x47b30a>this[_0xb027('0x23')]){_0x47b30a=this[_0xb027('0x23')];}_0x48053a['temp']=0x1;hopperUtils[_0xb027('0x201')](_0x48053a,_0x47b30a)[_0xb027('0x3e')](function(_0x39644f){_0x48053a[_0xb027('0x200')]=0x0;if(_0x39644f){if(!utils[_0xb027('0x202')](_0x39644f)){_0x48053a[_0xb027('0x69')]=utils['CAMPAIGN_STATUS'][_0xb027('0x6e')];logger[_0xb027('0x4c')](_0xb027('0x203')+_0x48053a['name']);}else{_0x48053a[_0xb027('0x7d')]+=_0x39644f[_0xb027('0x97')];_0x48053a[_0xb027('0x69')]=utils[_0xb027('0x6a')]['RUNNING'];for(var _0x562154=0x0;_0x562154<_0x39644f[_0xb027('0x97')];_0x562154+=0x1){_0x48053a[_0xb027('0x204')]+=0x1;if(_[_0xb027('0xef')](_0x39644f[_0x562154])||_[_0xb027('0xef')](_0x39644f[_0x562154][_0xb027('0x177')])||_[_0xb027('0xef')](_0x39644f[_0x562154]['phone'])){_0x3126b8[_0xb027('0x152')](_0xb027('0x205'),_0x48053a,_0x39644f[_0x562154]);}else{hopperUtils['checkIsBlackListIvr'](_[_0xb027('0xff')](_0x39644f[_0x562154],[_0xb027('0xdc'),_0xb027('0x15f')]))['then'](_0x3126b8['checkContactBlack'](_0x48053a,_0x39644f[_0x562154]))[_0xb027('0x9f')](_0x3126b8['loggerHandler'](_0xb027('0x206'),_0x48053a));}}}}})[_0xb027('0x9f')](loggerGetContactDialer('[getContactCampaign2]',_0x48053a,_0x47b30a));}};Dialer['prototype'][_0xb027('0xac')]=function(_0x145bd4,_0x437388){var _0x1aa756=this;var _0xed67b3=[];if(_0x437388<0x1||_0x145bd4['dialMethod']===_0xb027('0x8')){_0x437388=0x1;}var _0x1a483c=Math[_0xb027('0x1c4')](_0x145bd4[_0xb027('0x139')]*_0x437388)-_0x145bd4[_0xb027('0x7d')];if(_0x145bd4['dialLimitQueue']>0x0){var _0x571340=_0x145bd4[_0xb027('0x207')]-_0x145bd4['originated']-_0x145bd4['talking']-_0x145bd4[_0xb027('0x13c')];if(_0x1a483c>_0x571340){_0x1a483c=_0x571340;}}if(_0x1a483c>0x0&&_0x145bd4[_0xb027('0x200')]==0x0){if(_0x145bd4['dialMethod']===_0xb027('0x8')){_0x1a483c=0x1;}if(_0x1a483c>this[_0xb027('0x23')]){_0x1a483c=this[_0xb027('0x23')];}for(var _0x39e582 in this[_0xb027('0x21')]){if(typeof this['agents'][_0x39e582]!=='undefined'){if(this[_0xb027('0x21')][_0x39e582][_0xb027('0x70')]===_0xb027('0x208')&&this[_0xb027('0x21')][_0x39e582][_0xb027('0x87')]==='reachable'){_0xed67b3[_0xb027('0xf3')](this[_0xb027('0x21')][_0x39e582]['id']);}}}_0x145bd4[_0xb027('0x200')]=0x1;hopperUtils['getContactDialer'](_0x145bd4,_0xed67b3,_0x1a483c)['then'](function(_0xf75c55){_0x145bd4[_0xb027('0x200')]=0x0;if(_0xf75c55){if(!utils[_0xb027('0x202')](_0xf75c55)){hopperUtils['countReScheduled'](_0x145bd4)['then'](sendMessageReschedule(_0x145bd4))[_0xb027('0x9f')](loggerCatch(_0xb027('0x209')));}else{_0x145bd4[_0xb027('0x7d')]+=_0xf75c55[_0xb027('0x97')];_0x145bd4['message']=_0x145bd4[_0xb027('0x20a')]==='booked'?utils[_0xb027('0x6a')][_0xb027('0x13d')]:utils[_0xb027('0x6a')][_0xb027('0x20b')];for(var _0x5819ee=0x0;_0x5819ee<_0xf75c55['length'];_0x5819ee+=0x1){if(_[_0xb027('0xef')](_0xf75c55[_0x5819ee])||_[_0xb027('0xef')](_0xf75c55[_0x5819ee][_0xb027('0x177')])||_['isNil'](_0xf75c55[_0x5819ee][_0xb027('0x15f')])){_0x1aa756[_0xb027('0x152')](_0xb027('0x205'),_0x145bd4,_0xf75c55[_0x5819ee]);}else{hopperUtils[_0xb027('0x20c')](_[_0xb027('0xff')](_0xf75c55[_0x5819ee],[_0xb027('0xf9'),_0xb027('0x15f')]))['then'](_0x1aa756['checkContactBlack'](_0x145bd4,_0xf75c55[_0x5819ee]))[_0xb027('0x9f')](_0x1aa756['loggerHandler'](_0xb027('0x205'),_0x145bd4));}}}}})['catch'](loggerGetContactDialer(_0xb027('0x20d'),_0x145bd4,_0x1a483c));}};Dialer[_0xb027('0x1a')]['handlePredictive']=function(_0x4aa429){if(_0x4aa429[_0xb027('0x207')]>0x0){var _0x2836c5=_0x4aa429['dialLimitQueue']-_0x4aa429[_0xb027('0x7d')]-_0x4aa429['talking'];if(_0x2836c5>0x0&&_0x4aa429['temp']==0x0){this['tryOriginatePredictive'](_0x4aa429);}else{loggerPredictiveCalls[_0xb027('0x4c')](_0xb027('0x20e'));}}else{this[_0xb027('0x20f')](_0x4aa429);}};Dialer['prototype']['tryOriginatePredictive']=function(_0xc845a4){var _0x116603=this;var _0x858882=[];_0xc845a4[_0xb027('0x7d')]+=0x1;for(var _0x1c6665 in this['agents']){if(typeof this['agents'][_0x1c6665]!==_0xb027('0xa6')){if(this[_0xb027('0x21')][_0x1c6665][_0xb027('0x70')]===_0xb027('0x208')&&this[_0xb027('0x21')][_0x1c6665][_0xb027('0x87')]===_0xb027('0x88')){_0x858882[_0xb027('0xf3')](this[_0xb027('0x21')][_0x1c6665]['id']);}}}_0xc845a4[_0xb027('0x200')]=0x1;return this[_0xb027('0x210')](_0xc845a4['id'],_0x858882,0x1,_0xc845a4[_0xb027('0x211')],_0xc845a4)[_0xb027('0x3e')](function(_0x3318eb){_0xc845a4[_0xb027('0x200')]=0x1;if(_0x3318eb){if(!utils['checkContactEmpty'](_0x3318eb)){utils['checkContactLowerLimitOriginate'](_0xc845a4,0x1,0x0);return hopperUtils['countReScheduled'](_0xc845a4)[_0xb027('0x3e')](sendMessageReschedule(_0xc845a4))[_0xb027('0x9f')](loggerCatch(_0xb027('0x209')));}else{_0xc845a4[_0xb027('0x69')]=utils[_0xb027('0x6a')]['RUNNING'];if(_[_0xb027('0xef')](_0x3318eb[0x0])||_[_0xb027('0xef')](_0x3318eb[0x0][_0xb027('0x177')])||_[_0xb027('0xef')](_0x3318eb[0x0][_0xb027('0x15f')])){_0x116603['emptyContact'](_0xb027('0x205'),_0xc845a4,_0x3318eb[0x0]);}else{return hopperUtils[_0xb027('0x20c')](_[_0xb027('0xff')](_0x3318eb[0x0],[_0xb027('0xf9'),_0xb027('0x15f')]))[_0xb027('0x3e')](_0x116603[_0xb027('0x1e9')](_0xc845a4,_0x3318eb[0x0]))[_0xb027('0x9f')](_0x116603['loggerHandler'](_0xb027('0x212'),_0xc845a4));}}}})[_0xb027('0x9f')](loggerGetContactDialer('[getContactDialerPredictive]',_0xc845a4,0x1));};Dialer[_0xb027('0x1a')][_0xb027('0x1db')]=function(_0x5dc1be,_0x2a1f2d,_0x376992,_0x1604ce,_0x5c497d,_0x13036d){loggerPredictive[_0xb027('0x4c')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xb027('0x4c')](_0xb027('0x213'),_0x5dc1be);loggerPredictive[_0xb027('0x4c')](_0xb027('0x214'),_0x2a1f2d);loggerPredictive[_0xb027('0x4c')](_0xb027('0x215'),_0x376992);loggerPredictive['info'](_0xb027('0x216'),_0x1604ce);loggerPredictive[_0xb027('0x4c')](_0xb027('0x217'),_0x5c497d);loggerPredictive[_0xb027('0x4c')](_0xb027('0x218'));return new Promise(function(_0x44d450,_0x19037e){if(_0x5dc1be<=0x0||isNaN(_0x5dc1be)){return _0x19037e(msgResponse(_0xb027('0x219'),_0xb027('0x84'),_0xb027('0x21a')+_0x5dc1be));}if(_0x376992<=0x0||isNaN(_0x376992)){return _0x19037e(msgResponse(_0xb027('0x219'),_0xb027('0x84'),_0xb027('0x21b')+_0x376992));}if(_0x1604ce<=0x0||isNaN(_0x1604ce)){return _0x19037e(msgResponse('[abandonmentRate]','Error','p\x20=\x20'+_0x1604ce));}if(_0x2a1f2d<=0x0||isNaN(_0x2a1f2d)){return _0x19037e(msgResponse(_0xb027('0x219'),_0xb027('0x84'),_0xb027('0x21c')+_0x2a1f2d));}if(_0x5c497d<=0x0||isNaN(_0x5c497d)){return _0x19037e(msgResponse(_0xb027('0x219'),_0xb027('0x84'),_0xb027('0x21d')+_0x5c497d));}_0x13036d=_0x13036d||0x0;var _0x68e8dd=0x1/_0x376992;var _0x46fd56=0x0;var _0x1391de=0x0;var _0x48166b=0x0;var _0x2ebb34=0x0;for(var _0x320936=0x0;_0x48166b<_0x5c497d;_0x320936+=0x1){_0x1391de=_0x320936/_0x2a1f2d;_0x46fd56=(_0x1604ce*_0x1391de+_0x13036d)/_0x68e8dd;_0x48166b=utils[_0xb027('0x21e')](_0x46fd56,_0x5dc1be);_0x2ebb34=_0x46fd56/_0x5dc1be*(0x1-utils[_0xb027('0x21e')](_0x46fd56,_0x5dc1be));}return _0x44d450({'erlangCalls':_0x320936,'erlangCallToSecond':_0x2a1f2d/_0x320936,'erlangAbandonmentRate':_0x48166b,'erlangBusyFactor':_0x2ebb34});});};Dialer['prototype'][_0xb027('0x1e5')]=function(_0x4a7390,_0xb54db9,_0x449263,_0x437705,_0x647920,_0x22e7b3){loggerPredictive[_0xb027('0x4c')](_0xb027('0x21f'));loggerPredictive[_0xb027('0x4c')]('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',_0x4a7390);loggerPredictive[_0xb027('0x4c')](_0xb027('0x214'),_0xb54db9);loggerPredictive[_0xb027('0x4c')](_0xb027('0x215'),_0x449263);loggerPredictive[_0xb027('0x4c')](_0xb027('0x216'),_0x437705);loggerPredictive[_0xb027('0x4c')](_0xb027('0x220'),_0x647920);loggerPredictive[_0xb027('0x4c')](_0xb027('0x218'));return new Promise(function(_0x2c9087,_0x5d228b){if(_0x4a7390<=0x0||isNaN(_0x4a7390)){return _0x5d228b(msgResponse(_0xb027('0x221'),'Error',_0xb027('0x21a')+_0x4a7390));}if(_0x449263<=0x0||isNaN(_0x449263)){return _0x5d228b(msgResponse(_0xb027('0x221'),_0xb027('0x84'),'Ts\x20=\x20'+_0x449263));}if(_0x437705<=0x0||isNaN(_0x437705)){return _0x5d228b(msgResponse(_0xb027('0x221'),'Error',_0xb027('0x222')+_0x437705));}if(_0xb54db9<=0x0||isNaN(_0xb54db9)){return _0x5d228b(msgResponse(_0xb027('0x221'),_0xb027('0x84'),_0xb027('0x21c')+_0xb54db9));}if(_0x647920<=0x0||isNaN(_0x647920)){return _0x5d228b(msgResponse(_0xb027('0x221'),_0xb027('0x84'),_0xb027('0x223')+_0x647920));}_0x22e7b3=_0x22e7b3||0x0;var _0x10867b=0x1/_0x449263;var _0x545f2c=0x0;var _0x145ffe=0x0;var _0x329aa0=0x0;var _0x5d2eda=0x0;for(var _0x2dfd74=0x0;_0x5d2eda<_0x647920;_0x2dfd74+=0x1){_0x145ffe=_0x2dfd74/_0xb54db9;_0x545f2c=(_0x437705*_0x145ffe+_0x22e7b3)/_0x10867b;_0x329aa0=utils[_0xb027('0x21e')](_0x545f2c,_0x4a7390);_0x5d2eda=_0x545f2c/_0x4a7390*(0x1-utils[_0xb027('0x21e')](_0x545f2c,_0x4a7390));}return _0x2c9087({'erlangCalls':_0x2dfd74,'erlangCallToSecond':_0xb54db9/_0x2dfd74,'erlangAbandonmentRate':_0x329aa0,'erlangBusyFactor':_0x5d2eda});});};module[_0xb027('0x224')]=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 7697047..4d8315d 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 _0xd4d3=['countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','util','lodash','moment','isNil','voiceQueue','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry'];(function(_0x68fdb0,_0x1229f4){var _0x35881d=function(_0x4d07fe){while(--_0x4d07fe){_0x68fdb0['push'](_0x68fdb0['shift']());}};_0x35881d(++_0x1229f4);}(_0xd4d3,0xe5));var _0x3d4d=function(_0x162533,_0x285cc0){_0x162533=_0x162533-0x0;var _0x5163e2=_0xd4d3[_0x162533];return _0x5163e2;};'use strict';var util=require(_0x3d4d('0x0'));var _=require(_0x3d4d('0x1'));var moment=require(_0x3d4d('0x2'));function checkNameSurname(_0x396f94,_0x46c293,_0x57c677){var _0x566657='';if(!_[_0x3d4d('0x3')](_0x46c293)&&'string'===typeof _0x46c293){_0x566657+=_0x46c293;}if(!_['isNil'](_0x57c677)&&'string'===typeof _0x57c677){_0x566657+='\x20'+_0x57c677;}if(_0x566657!==''){return _0x566657;}return _0x396f94;}function Action(_0x420ae5,_0xbf9ff3,_0x384c7d){this[_0x3d4d('0x4')]=_0x420ae5;this['uniqueid']=_0x384c7d||undefined;this[_0x3d4d('0x5')]=checkNameSurname(_0xbf9ff3[_0x3d4d('0x6')][_0x3d4d('0x7')],_0xbf9ff3[_0x3d4d('0x6')]['firstName'],_0xbf9ff3[_0x3d4d('0x6')][_0x3d4d('0x8')]);this[_0x3d4d('0x9')]=_0xbf9ff3['phone'];this[_0x3d4d('0xa')]=_0x420ae5['name'];this[_0x3d4d('0xb')]=_0xbf9ff3[_0x3d4d('0xb')]||![];this[_0x3d4d('0xc')]=_0x420ae5[_0x3d4d('0xc')];this[_0x3d4d('0xd')]=_0x420ae5[_0x3d4d('0xd')]||0x3;this[_0x3d4d('0xe')]=_0xbf9ff3['scheduledat'];this[_0x3d4d('0xf')]=_0xbf9ff3[_0x3d4d('0xf')];this['countcongestionretry']=_0xbf9ff3[_0x3d4d('0x10')];this[_0x3d4d('0x11')]=_0xbf9ff3[_0x3d4d('0x11')];this['countnosuchnumberretry']=_0xbf9ff3['countnosuchnumberretry'];this[_0x3d4d('0x12')]=_0xbf9ff3[_0x3d4d('0x12')];this['countabandonedretry']=_0xbf9ff3[_0x3d4d('0x13')];this['countmachineretry']=_0xbf9ff3[_0x3d4d('0x14')];this['countagentrejectretry']=_0xbf9ff3[_0x3d4d('0x15')];this[_0x3d4d('0x16')]=_0xbf9ff3[_0x3d4d('0x16')];this['ListId']=_0xbf9ff3[_0x3d4d('0x17')];this[_0x3d4d('0x18')]=_0xbf9ff3['UserId'];this[_0x3d4d('0x19')]=_0xbf9ff3['VoiceQueueId'];this[_0x3d4d('0x1a')]=_0xbf9ff3[_0x3d4d('0x1a')];this[_0x3d4d('0x1b')]=_0xbf9ff3['id'];this['ContactFirstName']=_0xbf9ff3[_0x3d4d('0x6')]['firstName']||'';this['starttime']=moment()['format'](_0x3d4d('0x1c'));this[_0x3d4d('0x1d')]=_0xbf9ff3[_0x3d4d('0x1d')];this['callbackuniqueid']=_0xbf9ff3[_0x3d4d('0x1e')];this[_0x3d4d('0x1f')]=_0xbf9ff3[_0x3d4d('0x1f')];this[_0x3d4d('0x20')]=_0xbf9ff3['recallme'];this[_0x3d4d('0x21')]='';this[_0x3d4d('0x22')]='';}Action[_0x3d4d('0x23')][_0x3d4d('0x24')]=function(){return util['format'](_0x3d4d('0x25'),this['name'],this[_0x3d4d('0x4')][_0x3d4d('0x26')]>0x0?this[_0x3d4d('0x9')][_0x3d4d('0x27')](this[_0x3d4d('0x4')][_0x3d4d('0x26')]):this[_0x3d4d('0x9')]);};Action[_0x3d4d('0x23')]['getQueue']=function(){return this[_0x3d4d('0xa')];};module[_0x3d4d('0x28')]=Action; \ No newline at end of file +var _0x18c5=['moment','isNil','string','voiceQueue','Contact','firstName','lastName','number','phone','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','queue','lodash'];(function(_0x55daf2,_0x568c88){var _0x41b7ca=function(_0x1d1552){while(--_0x1d1552){_0x55daf2['push'](_0x55daf2['shift']());}};_0x41b7ca(++_0x568c88);}(_0x18c5,0x1eb));var _0x518c=function(_0x1a37e3,_0x5db8f6){_0x1a37e3=_0x1a37e3-0x0;var _0x4db78a=_0x18c5[_0x1a37e3];return _0x4db78a;};'use strict';var util=require('util');var _=require(_0x518c('0x0'));var moment=require(_0x518c('0x1'));function checkNameSurname(_0x4e3a32,_0x25ed79,_0x4f0475){var _0x29075f='';if(!_[_0x518c('0x2')](_0x25ed79)&&_0x518c('0x3')===typeof _0x25ed79){_0x29075f+=_0x25ed79;}if(!_[_0x518c('0x2')](_0x4f0475)&&_0x518c('0x3')===typeof _0x4f0475){_0x29075f+='\x20'+_0x4f0475;}if(_0x29075f!==''){return _0x29075f;}return _0x4e3a32;}function Action(_0x7fa51c,_0x1708d9,_0x4b064c){this[_0x518c('0x4')]=_0x7fa51c;this['uniqueid']=_0x4b064c||undefined;this['name']=checkNameSurname(_0x1708d9[_0x518c('0x5')]['phone'],_0x1708d9[_0x518c('0x5')][_0x518c('0x6')],_0x1708d9[_0x518c('0x5')][_0x518c('0x7')]);this[_0x518c('0x8')]=_0x1708d9[_0x518c('0x9')];this['queue']=_0x7fa51c[_0x518c('0xa')];this[_0x518c('0xb')]=_0x1708d9[_0x518c('0xb')]||![];this[_0x518c('0xc')]=_0x7fa51c[_0x518c('0xc')];this[_0x518c('0xd')]=_0x7fa51c[_0x518c('0xd')]||0x3;this[_0x518c('0xe')]=_0x1708d9[_0x518c('0xe')];this['countbusyretry']=_0x1708d9[_0x518c('0xf')];this['countcongestionretry']=_0x1708d9[_0x518c('0x10')];this[_0x518c('0x11')]=_0x1708d9[_0x518c('0x11')];this['countnosuchnumberretry']=_0x1708d9[_0x518c('0x12')];this['countdropretry']=_0x1708d9[_0x518c('0x13')];this[_0x518c('0x14')]=_0x1708d9[_0x518c('0x14')];this[_0x518c('0x15')]=_0x1708d9[_0x518c('0x15')];this[_0x518c('0x16')]=_0x1708d9[_0x518c('0x16')];this[_0x518c('0x17')]=_0x1708d9[_0x518c('0x17')];this[_0x518c('0x18')]=_0x1708d9[_0x518c('0x18')];this['UserId']=_0x1708d9[_0x518c('0x19')];this[_0x518c('0x1a')]=_0x1708d9[_0x518c('0x1a')];this['CampaignId']=_0x1708d9[_0x518c('0x1b')];this['idHopper']=_0x1708d9['id'];this['ContactFirstName']=_0x1708d9[_0x518c('0x5')][_0x518c('0x6')]||'';this['starttime']=moment()[_0x518c('0x1c')](_0x518c('0x1d'));this[_0x518c('0x1e')]=_0x1708d9[_0x518c('0x1e')];this['callbackuniqueid']=_0x1708d9[_0x518c('0x1f')];this[_0x518c('0x20')]=_0x1708d9[_0x518c('0x20')];this['recallme']=_0x1708d9[_0x518c('0x21')];this[_0x518c('0x22')]='';this['originatecalleridname']='';}Action[_0x518c('0x23')][_0x518c('0x24')]=function(){return util['format'](_0x518c('0x25'),this[_0x518c('0xa')],this[_0x518c('0x4')]['dialCutDigit']>0x0?this[_0x518c('0x8')][_0x518c('0x26')](this[_0x518c('0x4')][_0x518c('0x27')]):this['number']);};Action[_0x518c('0x23')]['getQueue']=function(){return this[_0x518c('0x28')];};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 2365970..9ed550d 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 _0xbd83=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','starttime','talktime','getSeconds','membername','reason','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x3f4098,_0x3365b2){var _0x3d5d0c=function(_0x3a7cdb){while(--_0x3a7cdb){_0x3f4098['push'](_0x3f4098['shift']());}};_0x3d5d0c(++_0x3365b2);}(_0xbd83,0x186));var _0x3bd8=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xbd83[_0x413feb];return _0x40ee88;};'use strict';var moment=require(_0x3bd8('0x0'));var utils=require(_0x3bd8('0x1'));function AgentComplete(_0x1f5e1d,_0x3a69db){this['state']=0x4;this[_0x3bd8('0x2')]=_0x3bd8('0x3');this[_0x3bd8('0x4')]=_0x1f5e1d[_0x3bd8('0x4')];this[_0x3bd8('0x5')]=_0x1f5e1d['type'];this['campaigntype']=_0x1f5e1d[_0x3bd8('0x5')]===_0x3bd8('0x6')?_0x3bd8('0x7'):_0x1f5e1d[_0x3bd8('0x5')];this[_0x3bd8('0x8')]=_0x1f5e1d[_0x3bd8('0x8')];this['countcongestionretry']=_0x1f5e1d[_0x3bd8('0x9')];this[_0x3bd8('0xa')]=_0x1f5e1d[_0x3bd8('0xa')];this[_0x3bd8('0xb')]=_0x1f5e1d['countbusyretry']+_0x1f5e1d['countcongestionretry']+_0x1f5e1d['countnoanswerretry']+_0x1f5e1d[_0x3bd8('0xc')]+_0x1f5e1d[_0x3bd8('0xd')]+_0x1f5e1d[_0x3bd8('0xe')]+_0x1f5e1d[_0x3bd8('0xf')]+_0x1f5e1d[_0x3bd8('0x10')];this[_0x3bd8('0xc')]=_0x1f5e1d['countnosuchnumberretry'];this[_0x3bd8('0xd')]=_0x1f5e1d[_0x3bd8('0xd')];this['countabandonedretry']=_0x1f5e1d[_0x3bd8('0xe')];this['countmachineretry']=_0x1f5e1d['countmachineretry'];this['countagentrejectretry']=_0x1f5e1d['countagentrejectretry'];this['uniqueid']=_0x3a69db[_0x3bd8('0x11')];this[_0x3bd8('0x12')]=_0x1f5e1d['name'];this[_0x3bd8('0x13')]=_0x1f5e1d[_0x3bd8('0x14')];this['starttime']=_0x1f5e1d['starttime'];this[_0x3bd8('0x15')]=_0x1f5e1d[_0x3bd8('0x15')];this[_0x3bd8('0x16')]=_0x1f5e1d[_0x3bd8('0x16')];this[_0x3bd8('0x17')]=moment()['format'](_0x3bd8('0x18'));this['ringtime']=utils['getSeconds'](_0x1f5e1d[_0x3bd8('0x15')],_0x1f5e1d[_0x3bd8('0x19')]);this['holdtime']=utils['getSeconds'](_0x1f5e1d[_0x3bd8('0x16')],_0x1f5e1d['responsetime']);this[_0x3bd8('0x1a')]=utils[_0x3bd8('0x1b')](this[_0x3bd8('0x17')],_0x1f5e1d[_0x3bd8('0x16')]);this[_0x3bd8('0x7')]=_0x3a69db[_0x3bd8('0x7')];this[_0x3bd8('0x1c')]=_0x3a69db[_0x3bd8('0x1c')];this[_0x3bd8('0x1d')]=_0x3a69db[_0x3bd8('0x1d')];this['callback']=_0x1f5e1d['callback'];this['callbackuniqueid']=_0x1f5e1d['callbackuniqueid'];this['callbackat']=_0x1f5e1d['callbackat'];this[_0x3bd8('0x1e')]=_0x1f5e1d[_0x3bd8('0x1e')];this[_0x3bd8('0x1f')]=_0x1f5e1d['ContactId'];this[_0x3bd8('0x20')]=_0x1f5e1d[_0x3bd8('0x20')];this['UserId']=_0x1f5e1d[_0x3bd8('0x21')];this[_0x3bd8('0x22')]=_0x1f5e1d[_0x3bd8('0x22')];this[_0x3bd8('0x23')]=_0x1f5e1d[_0x3bd8('0x23')];this[_0x3bd8('0x24')]=_0x1f5e1d[_0x3bd8('0x24')]||'';this[_0x3bd8('0x25')]=_0x1f5e1d[_0x3bd8('0x25')]||'';this[_0x3bd8('0x26')]=_0x1f5e1d[_0x3bd8('0x26')];}module[_0x3bd8('0x27')]=AgentComplete; \ No newline at end of file +var _0x5e68=['UserId','VoiceQueueId','CampaignId','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x2f07c6,_0x5c6b20){var _0x29db6b=function(_0x55bac7){while(--_0x55bac7){_0x2f07c6['push'](_0x2f07c6['shift']());}};_0x29db6b(++_0x5c6b20);}(_0x5e68,0x11a));var _0x85e6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5e68[_0x432682];return _0x463d05;};'use strict';var moment=require(_0x85e6('0x0'));var utils=require(_0x85e6('0x1'));function AgentComplete(_0x3b63fc,_0x5e6c9c){this[_0x85e6('0x2')]=0x4;this[_0x85e6('0x3')]=_0x85e6('0x4');this[_0x85e6('0x5')]=_0x3b63fc[_0x85e6('0x5')];this[_0x85e6('0x6')]=_0x3b63fc['type'];this[_0x85e6('0x7')]=_0x3b63fc[_0x85e6('0x6')]===_0x85e6('0x8')?_0x85e6('0x9'):_0x3b63fc[_0x85e6('0x6')];this[_0x85e6('0xa')]=_0x3b63fc[_0x85e6('0xa')];this['countcongestionretry']=_0x3b63fc[_0x85e6('0xb')];this[_0x85e6('0xc')]=_0x3b63fc[_0x85e6('0xc')];this['countglobal']=_0x3b63fc['countbusyretry']+_0x3b63fc[_0x85e6('0xb')]+_0x3b63fc[_0x85e6('0xc')]+_0x3b63fc[_0x85e6('0xd')]+_0x3b63fc[_0x85e6('0xe')]+_0x3b63fc[_0x85e6('0xf')]+_0x3b63fc[_0x85e6('0x10')]+_0x3b63fc[_0x85e6('0x11')];this[_0x85e6('0xd')]=_0x3b63fc['countnosuchnumberretry'];this[_0x85e6('0xe')]=_0x3b63fc['countdropretry'];this[_0x85e6('0xf')]=_0x3b63fc[_0x85e6('0xf')];this[_0x85e6('0x10')]=_0x3b63fc[_0x85e6('0x10')];this[_0x85e6('0x11')]=_0x3b63fc[_0x85e6('0x11')];this[_0x85e6('0x12')]=_0x5e6c9c[_0x85e6('0x12')];this[_0x85e6('0x13')]=_0x3b63fc[_0x85e6('0x14')];this[_0x85e6('0x15')]=_0x3b63fc[_0x85e6('0x16')];this[_0x85e6('0x17')]=_0x3b63fc[_0x85e6('0x17')];this[_0x85e6('0x18')]=_0x3b63fc['responsetime'];this[_0x85e6('0x19')]=_0x3b63fc[_0x85e6('0x19')];this[_0x85e6('0x1a')]=moment()['format'](_0x85e6('0x1b'));this[_0x85e6('0x1c')]=utils[_0x85e6('0x1d')](_0x3b63fc[_0x85e6('0x18')],_0x3b63fc[_0x85e6('0x17')]);this[_0x85e6('0x1e')]=utils[_0x85e6('0x1d')](_0x3b63fc[_0x85e6('0x19')],_0x3b63fc[_0x85e6('0x18')]);this[_0x85e6('0x1f')]=utils[_0x85e6('0x1d')](this[_0x85e6('0x1a')],_0x3b63fc[_0x85e6('0x19')]);this[_0x85e6('0x9')]=_0x5e6c9c[_0x85e6('0x9')];this[_0x85e6('0x20')]=_0x5e6c9c[_0x85e6('0x20')];this['reason']=_0x5e6c9c[_0x85e6('0x21')];this[_0x85e6('0x22')]=_0x3b63fc[_0x85e6('0x22')];this[_0x85e6('0x23')]=_0x3b63fc[_0x85e6('0x23')];this[_0x85e6('0x24')]=_0x3b63fc[_0x85e6('0x24')];this['recallme']=_0x3b63fc[_0x85e6('0x25')];this[_0x85e6('0x26')]=_0x3b63fc[_0x85e6('0x26')];this[_0x85e6('0x27')]=_0x3b63fc[_0x85e6('0x27')];this[_0x85e6('0x28')]=_0x3b63fc['UserId'];this['VoiceQueueId']=_0x3b63fc[_0x85e6('0x29')];this[_0x85e6('0x2a')]=_0x3b63fc[_0x85e6('0x2a')];this['originatecalleridnum']=_0x3b63fc['originatecalleridnum']||'';this[_0x85e6('0x2b')]=_0x3b63fc[_0x85e6('0x2b')]||'';this[_0x85e6('0x2c')]=_0x3b63fc[_0x85e6('0x2c')];}module[_0x85e6('0x2d')]=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 220a60f..d84ec78 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 _0x3760=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype'];(function(_0xe6a9e1,_0x2c2117){var _0x8cc109=function(_0x481f0d){while(--_0x481f0d){_0xe6a9e1['push'](_0xe6a9e1['shift']());}};_0x8cc109(++_0x2c2117);}(_0x3760,0x164));var _0x0376=function(_0x4a45b4,_0x59804f){_0x4a45b4=_0x4a45b4-0x0;var _0x1a99c9=_0x3760[_0x4a45b4];return _0x1a99c9;};'use strict';function Final(_0xeeed98){this[_0x0376('0x0')]=_0xeeed98[_0x0376('0x0')];this[_0x0376('0x1')]=_0xeeed98[_0x0376('0x1')];this[_0x0376('0x2')]=_0xeeed98[_0x0376('0x2')];this[_0x0376('0x3')]=_0xeeed98[_0x0376('0x2')]===_0x0376('0x4')?_0x0376('0x5'):_0xeeed98[_0x0376('0x2')];this[_0x0376('0x6')]=_0xeeed98['countbusyretry'];this[_0x0376('0x7')]=_0xeeed98[_0x0376('0x7')];this[_0x0376('0x8')]=_0xeeed98[_0x0376('0x8')];this[_0x0376('0x9')]=_0xeeed98['countbusyretry']+_0xeeed98['countcongestionretry']+_0xeeed98[_0x0376('0x8')]+_0xeeed98[_0x0376('0xa')]+_0xeeed98[_0x0376('0xb')]+_0xeeed98[_0x0376('0xc')]+_0xeeed98[_0x0376('0xd')]+_0xeeed98[_0x0376('0xe')];this[_0x0376('0xa')]=_0xeeed98[_0x0376('0xa')];this[_0x0376('0xb')]=_0xeeed98[_0x0376('0xb')];this[_0x0376('0xc')]=_0xeeed98[_0x0376('0xc')];this[_0x0376('0xd')]=_0xeeed98[_0x0376('0xd')];this[_0x0376('0xe')]=_0xeeed98['countagentrejectretry'];this[_0x0376('0x5')]=_0xeeed98[_0x0376('0x5')];this[_0x0376('0xf')]=_0xeeed98[_0x0376('0xf')];this['calleridnum']=_0xeeed98[_0x0376('0x10')];this['starttime']=_0xeeed98[_0x0376('0x11')];this['responsetime']=_0xeeed98[_0x0376('0x12')];this[_0x0376('0x13')]=_0xeeed98[_0x0376('0x12')];this[_0x0376('0x14')]=_0xeeed98[_0x0376('0x14')]||0x0;this[_0x0376('0x15')]=_0xeeed98[_0x0376('0x15')]||0x0;this[_0x0376('0x16')]=_0xeeed98[_0x0376('0x16')]||0x0;this[_0x0376('0x17')]=_0xeeed98[_0x0376('0x17')];this[_0x0376('0x18')]=_0xeeed98[_0x0376('0x18')];this[_0x0376('0x19')]=_0xeeed98['callbackat'];this[_0x0376('0x1a')]=_0xeeed98[_0x0376('0x1a')];this['ContactId']=_0xeeed98['ContactId'];this[_0x0376('0x1b')]=_0xeeed98['ListId'];this[_0x0376('0x1c')]=_0xeeed98[_0x0376('0x1c')];this[_0x0376('0x1d')]=_0xeeed98[_0x0376('0x1d')];this[_0x0376('0x1e')]=_0xeeed98[_0x0376('0x1e')];this[_0x0376('0x1f')]=_0xeeed98[_0x0376('0x1f')]||'';this[_0x0376('0x20')]=_0xeeed98[_0x0376('0x20')]||'';this[_0x0376('0x21')]=_0xeeed98['state'];this['statedesc']=_0xeeed98[_0x0376('0x22')];}module[_0x0376('0x23')]=Final; \ No newline at end of file +var _0x5fae=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x5fae,0xec));var _0xe5fa=function(_0x202fcc,_0x1ffe77){_0x202fcc=_0x202fcc-0x0;var _0xb9ba8b=_0x5fae[_0x202fcc];return _0xb9ba8b;};'use strict';function Final(_0x1ca99d){this['uniqueid']=_0x1ca99d[_0xe5fa('0x0')];this['scheduledat']=_0x1ca99d[_0xe5fa('0x1')];this['type']=_0x1ca99d[_0xe5fa('0x2')];this[_0xe5fa('0x3')]=_0x1ca99d[_0xe5fa('0x2')]==='outbound'?_0xe5fa('0x4'):_0x1ca99d[_0xe5fa('0x2')];this[_0xe5fa('0x5')]=_0x1ca99d['countbusyretry'];this[_0xe5fa('0x6')]=_0x1ca99d[_0xe5fa('0x6')];this[_0xe5fa('0x7')]=_0x1ca99d[_0xe5fa('0x7')];this[_0xe5fa('0x8')]=_0x1ca99d[_0xe5fa('0x5')]+_0x1ca99d[_0xe5fa('0x6')]+_0x1ca99d['countnoanswerretry']+_0x1ca99d[_0xe5fa('0x9')]+_0x1ca99d[_0xe5fa('0xa')]+_0x1ca99d[_0xe5fa('0xb')]+_0x1ca99d[_0xe5fa('0xc')]+_0x1ca99d['countagentrejectretry'];this[_0xe5fa('0x9')]=_0x1ca99d['countnosuchnumberretry'];this['countdropretry']=_0x1ca99d[_0xe5fa('0xa')];this[_0xe5fa('0xb')]=_0x1ca99d[_0xe5fa('0xb')];this[_0xe5fa('0xc')]=_0x1ca99d[_0xe5fa('0xc')];this['countagentrejectretry']=_0x1ca99d[_0xe5fa('0xd')];this[_0xe5fa('0x4')]=_0x1ca99d['queue'];this[_0xe5fa('0xe')]=_0x1ca99d[_0xe5fa('0xe')];this[_0xe5fa('0xf')]=_0x1ca99d[_0xe5fa('0xf')];this[_0xe5fa('0x10')]=_0x1ca99d[_0xe5fa('0x10')];this['responsetime']=_0x1ca99d[_0xe5fa('0x11')];this[_0xe5fa('0x12')]=_0x1ca99d[_0xe5fa('0x11')];this[_0xe5fa('0x13')]=_0x1ca99d[_0xe5fa('0x13')]||0x0;this[_0xe5fa('0x14')]=_0x1ca99d['holdtime']||0x0;this[_0xe5fa('0x15')]=_0x1ca99d['talktime']||0x0;this[_0xe5fa('0x16')]=_0x1ca99d[_0xe5fa('0x16')];this[_0xe5fa('0x17')]=_0x1ca99d[_0xe5fa('0x17')];this['callbackat']=_0x1ca99d['callbackat'];this[_0xe5fa('0x18')]=_0x1ca99d[_0xe5fa('0x18')];this[_0xe5fa('0x19')]=_0x1ca99d[_0xe5fa('0x19')];this[_0xe5fa('0x1a')]=_0x1ca99d[_0xe5fa('0x1a')];this[_0xe5fa('0x1b')]=_0x1ca99d[_0xe5fa('0x1b')];this[_0xe5fa('0x1c')]=_0x1ca99d[_0xe5fa('0x1c')];this[_0xe5fa('0x1d')]=_0x1ca99d['CampaignId'];this[_0xe5fa('0x1e')]=_0x1ca99d[_0xe5fa('0x1e')]||'';this[_0xe5fa('0x1f')]=_0x1ca99d['originatecalleridname']||'';this[_0xe5fa('0x20')]=_0x1ca99d[_0xe5fa('0x20')];this[_0xe5fa('0x21')]=_0x1ca99d[_0xe5fa('0x21')];}module[_0xe5fa('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 bc72b11..c2b3f49 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 _0x4ea2=['type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','getSeconds','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','moment','../utils','state','statedesc','Answer','scheduledat'];(function(_0xfd8716,_0x1ebee2){var _0x1bb6b3=function(_0x4c207f){while(--_0x4c207f){_0xfd8716['push'](_0xfd8716['shift']());}};_0x1bb6b3(++_0x1ebee2);}(_0x4ea2,0x15a));var _0x24ea=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0x4ea2[_0x5b7788];return _0x573871;};'use strict';var moment=require(_0x24ea('0x0'));var utils=require(_0x24ea('0x1'));function Hangup(_0x1b4055,_0x438bb5){this[_0x24ea('0x2')]=0x4;this[_0x24ea('0x3')]=_0x24ea('0x4');this[_0x24ea('0x5')]=_0x1b4055[_0x24ea('0x5')];this[_0x24ea('0x6')]=_0x1b4055['type'];this[_0x24ea('0x7')]=_0x1b4055['type']===_0x24ea('0x8')?_0x24ea('0x9'):_0x1b4055[_0x24ea('0x6')];this[_0x24ea('0xa')]=_0x1b4055[_0x24ea('0xa')]||![];this[_0x24ea('0xb')]=_0x1b4055[_0x24ea('0xb')];this[_0x24ea('0xc')]=_0x1b4055[_0x24ea('0xc')];this['countnoanswerretry']=_0x1b4055['countnoanswerretry'];this[_0x24ea('0xd')]=_0x1b4055[_0x24ea('0xb')]+_0x1b4055['countcongestionretry']+_0x1b4055[_0x24ea('0xe')]+_0x1b4055[_0x24ea('0xf')]+_0x1b4055['countdropretry']+_0x1b4055[_0x24ea('0x10')]+_0x1b4055[_0x24ea('0x11')]+_0x1b4055['countagentrejectretry'];this['countnosuchnumberretry']=_0x1b4055['countnosuchnumberretry'];this[_0x24ea('0x12')]=_0x1b4055[_0x24ea('0x12')];this['countabandonedretry']=_0x1b4055[_0x24ea('0x10')];this['countmachineretry']=_0x1b4055[_0x24ea('0x11')];this[_0x24ea('0x13')]=_0x1b4055[_0x24ea('0x13')];this['uniqueid']=_0x438bb5[_0x24ea('0x14')];this['calleridname']=_0x1b4055[_0x24ea('0x15')];this[_0x24ea('0x16')]=_0x1b4055[_0x24ea('0x17')];this[_0x24ea('0x18')]=_0x1b4055['starttime'];this[_0x24ea('0x19')]=_0x1b4055['responsetime'];this[_0x24ea('0x1a')]=moment()['format'](_0x24ea('0x1b'));this[_0x24ea('0x1c')]=utils['getSeconds'](_0x1b4055[_0x24ea('0x19')],_0x1b4055[_0x24ea('0x18')]);this[_0x24ea('0x1d')]=0x0;this[_0x24ea('0x1e')]=utils[_0x24ea('0x1f')](this[_0x24ea('0x1a')],_0x1b4055['responsetime']);this[_0x24ea('0x9')]=_0x1b4055[_0x24ea('0x9')];this[_0x24ea('0x20')]=_0x24ea('0x21');this[_0x24ea('0x22')]=_0x438bb5[_0x24ea('0x23')];this[_0x24ea('0x24')]=_0x1b4055[_0x24ea('0x24')];this[_0x24ea('0x25')]=_0x1b4055[_0x24ea('0x25')];this[_0x24ea('0x26')]=_0x1b4055['callbackat'];this[_0x24ea('0x27')]=_0x1b4055[_0x24ea('0x27')];this[_0x24ea('0x28')]=_0x1b4055['ContactId'];this[_0x24ea('0x29')]=_0x1b4055[_0x24ea('0x29')];this['UserId']=_0x1b4055[_0x24ea('0x2a')];this['VoiceQueueId']=_0x1b4055[_0x24ea('0x2b')];this['CampaignId']=_0x1b4055['CampaignId'];}module['exports']=Hangup; \ No newline at end of file +var _0xbddc=['reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','responsetime'];(function(_0x232719,_0x37a326){var _0x21ee88=function(_0x4494ff){while(--_0x4494ff){_0x232719['push'](_0x232719['shift']());}};_0x21ee88(++_0x37a326);}(_0xbddc,0x9c));var _0xcbdd=function(_0x5235cb,_0xc52229){_0x5235cb=_0x5235cb-0x0;var _0x364ff5=_0xbddc[_0x5235cb];return _0x364ff5;};'use strict';var moment=require(_0xcbdd('0x0'));var utils=require('../utils');function Hangup(_0x27905c,_0x48e95c){this[_0xcbdd('0x1')]=0x4;this[_0xcbdd('0x2')]=_0xcbdd('0x3');this[_0xcbdd('0x4')]=_0x27905c[_0xcbdd('0x4')];this[_0xcbdd('0x5')]=_0x27905c[_0xcbdd('0x5')];this[_0xcbdd('0x6')]=_0x27905c[_0xcbdd('0x5')]==='outbound'?_0xcbdd('0x7'):_0x27905c[_0xcbdd('0x5')];this['amd']=_0x27905c[_0xcbdd('0x8')]||![];this[_0xcbdd('0x9')]=_0x27905c[_0xcbdd('0x9')];this[_0xcbdd('0xa')]=_0x27905c['countcongestionretry'];this['countnoanswerretry']=_0x27905c[_0xcbdd('0xb')];this['countglobal']=_0x27905c[_0xcbdd('0x9')]+_0x27905c['countcongestionretry']+_0x27905c['countnoanswerretry']+_0x27905c[_0xcbdd('0xc')]+_0x27905c[_0xcbdd('0xd')]+_0x27905c[_0xcbdd('0xe')]+_0x27905c[_0xcbdd('0xf')]+_0x27905c[_0xcbdd('0x10')];this[_0xcbdd('0xc')]=_0x27905c[_0xcbdd('0xc')];this['countdropretry']=_0x27905c['countdropretry'];this[_0xcbdd('0xe')]=_0x27905c[_0xcbdd('0xe')];this[_0xcbdd('0xf')]=_0x27905c[_0xcbdd('0xf')];this[_0xcbdd('0x10')]=_0x27905c[_0xcbdd('0x10')];this['uniqueid']=_0x48e95c['uniqueid'];this['calleridname']=_0x27905c['name'];this['calleridnum']=_0x27905c['number'];this[_0xcbdd('0x11')]=_0x27905c['starttime'];this['responsetime']=_0x27905c['responsetime'];this[_0xcbdd('0x12')]=moment()[_0xcbdd('0x13')](_0xcbdd('0x14'));this[_0xcbdd('0x15')]=utils[_0xcbdd('0x16')](_0x27905c[_0xcbdd('0x17')],_0x27905c[_0xcbdd('0x11')]);this['holdtime']=0x0;this['talktime']=utils['getSeconds'](this[_0xcbdd('0x12')],_0x27905c[_0xcbdd('0x17')]);this[_0xcbdd('0x7')]=_0x27905c['queue'];this['membername']='IVR';this[_0xcbdd('0x18')]=_0x48e95c[_0xcbdd('0x19')];this[_0xcbdd('0x1a')]=_0x27905c[_0xcbdd('0x1a')];this['callbackuniqueid']=_0x27905c[_0xcbdd('0x1b')];this[_0xcbdd('0x1c')]=_0x27905c[_0xcbdd('0x1c')];this[_0xcbdd('0x1d')]=_0x27905c['recallme'];this[_0xcbdd('0x1e')]=_0x27905c[_0xcbdd('0x1e')];this['ListId']=_0x27905c[_0xcbdd('0x1f')];this[_0xcbdd('0x20')]=_0x27905c[_0xcbdd('0x20')];this[_0xcbdd('0x21')]=_0x27905c[_0xcbdd('0x21')];this[_0xcbdd('0x22')]=_0x27905c['CampaignId'];}module[_0xcbdd('0x23')]=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 e40f15f..7cc601a 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 _0xce0a=['state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x5014af,_0x42a7e5){var _0x433e0a=function(_0x20be81){while(--_0x20be81){_0x5014af['push'](_0x5014af['shift']());}};_0x433e0a(++_0x42a7e5);}(_0xce0a,0xc1));var _0xace0=function(_0x23f0e1,_0x11d94b){_0x23f0e1=_0x23f0e1-0x0;var _0x257f0d=_0xce0a[_0x23f0e1];return _0x257f0d;};'use strict';var utils=require(_0xace0('0x0'));function History(_0x49255a){this[_0xace0('0x1')]=_0x49255a[_0xace0('0x1')];this[_0xace0('0x2')]=_0x49255a[_0xace0('0x2')]||undefined;this[_0xace0('0x3')]=_0x49255a[_0xace0('0x3')];this[_0xace0('0x4')]=_0x49255a[_0xace0('0x3')]==='outbound'?_0xace0('0x5'):_0x49255a['type'];this[_0xace0('0x6')]=_0x49255a[_0xace0('0x6')];this['countcongestionretry']=_0x49255a[_0xace0('0x7')];this[_0xace0('0x8')]=_0x49255a['countnoanswerretry'];this[_0xace0('0x9')]=_0x49255a[_0xace0('0x6')]+_0x49255a[_0xace0('0x7')]+_0x49255a[_0xace0('0x8')]+_0x49255a[_0xace0('0xa')]+_0x49255a['countdropretry']+_0x49255a[_0xace0('0xb')]+_0x49255a[_0xace0('0xc')]+_0x49255a['countagentrejectretry'];this[_0xace0('0xa')]=_0x49255a[_0xace0('0xa')];this['countdropretry']=_0x49255a[_0xace0('0xd')];this['countabandonedretry']=_0x49255a[_0xace0('0xb')];this[_0xace0('0xc')]=_0x49255a['countmachineretry'];this['countagentrejectretry']=_0x49255a[_0xace0('0xe')];this[_0xace0('0x5')]=_0x49255a['queue'];this[_0xace0('0xf')]=_0x49255a[_0xace0('0x10')];this[_0xace0('0x11')]=_0x49255a['number'];this[_0xace0('0x12')]=_0x49255a[_0xace0('0x12')];this[_0xace0('0x13')]=_0x49255a['responsetime'];this[_0xace0('0x14')]=_0x49255a[_0xace0('0x13')];this[_0xace0('0x15')]=utils[_0xace0('0x16')](_0x49255a[_0xace0('0x13')],_0x49255a[_0xace0('0x12')]);this[_0xace0('0x17')]=0x0;this['talktime']=0x0;this[_0xace0('0x18')]=_0x49255a[_0xace0('0x18')];this[_0xace0('0x19')]=_0x49255a[_0xace0('0x19')];this[_0xace0('0x1a')]=_0x49255a[_0xace0('0x1a')];this[_0xace0('0x1b')]=_0x49255a[_0xace0('0x1b')];this['ContactId']=_0x49255a[_0xace0('0x1c')];this[_0xace0('0x1d')]=_0x49255a[_0xace0('0x1d')];this[_0xace0('0x1e')]=_0x49255a[_0xace0('0x1e')];this['VoiceQueueId']=_0x49255a[_0xace0('0x1f')];this[_0xace0('0x20')]=_0x49255a[_0xace0('0x20')];this[_0xace0('0x21')]=_0x49255a[_0xace0('0x21')]||'';this[_0xace0('0x22')]=_0x49255a[_0xace0('0x22')]||'';this['state']=_0x49255a[_0xace0('0x23')];this[_0xace0('0x24')]=_0x49255a[_0xace0('0x24')];}module[_0xace0('0x25')]=History; \ No newline at end of file +var _0x65da=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x65da,0xfb));var _0xa65d=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x65da[_0x8c43de];return _0xa6591b;};'use strict';var utils=require(_0xa65d('0x0'));function History(_0x145262){this[_0xa65d('0x1')]=_0x145262[_0xa65d('0x1')];this[_0xa65d('0x2')]=_0x145262['scheduledat']||undefined;this[_0xa65d('0x3')]=_0x145262[_0xa65d('0x3')];this[_0xa65d('0x4')]=_0x145262[_0xa65d('0x3')]===_0xa65d('0x5')?'queue':_0x145262[_0xa65d('0x3')];this[_0xa65d('0x6')]=_0x145262[_0xa65d('0x6')];this[_0xa65d('0x7')]=_0x145262[_0xa65d('0x7')];this[_0xa65d('0x8')]=_0x145262[_0xa65d('0x8')];this[_0xa65d('0x9')]=_0x145262['countbusyretry']+_0x145262[_0xa65d('0x7')]+_0x145262[_0xa65d('0x8')]+_0x145262[_0xa65d('0xa')]+_0x145262[_0xa65d('0xb')]+_0x145262[_0xa65d('0xc')]+_0x145262['countmachineretry']+_0x145262[_0xa65d('0xd')];this['countnosuchnumberretry']=_0x145262[_0xa65d('0xa')];this['countdropretry']=_0x145262['countdropretry'];this[_0xa65d('0xc')]=_0x145262[_0xa65d('0xc')];this[_0xa65d('0xe')]=_0x145262[_0xa65d('0xe')];this[_0xa65d('0xd')]=_0x145262[_0xa65d('0xd')];this[_0xa65d('0xf')]=_0x145262[_0xa65d('0xf')];this[_0xa65d('0x10')]=_0x145262[_0xa65d('0x11')];this[_0xa65d('0x12')]=_0x145262[_0xa65d('0x13')];this['starttime']=_0x145262[_0xa65d('0x14')];this[_0xa65d('0x15')]=_0x145262['responsetime'];this[_0xa65d('0x16')]=_0x145262[_0xa65d('0x15')];this[_0xa65d('0x17')]=utils[_0xa65d('0x18')](_0x145262[_0xa65d('0x15')],_0x145262['starttime']);this[_0xa65d('0x19')]=0x0;this['talktime']=0x0;this[_0xa65d('0x1a')]=_0x145262[_0xa65d('0x1a')];this['callbackuniqueid']=_0x145262[_0xa65d('0x1b')];this[_0xa65d('0x1c')]=_0x145262[_0xa65d('0x1c')];this[_0xa65d('0x1d')]=_0x145262[_0xa65d('0x1d')];this[_0xa65d('0x1e')]=_0x145262['ContactId'];this['ListId']=_0x145262[_0xa65d('0x1f')];this[_0xa65d('0x20')]=_0x145262['UserId'];this[_0xa65d('0x21')]=_0x145262[_0xa65d('0x21')];this[_0xa65d('0x22')]=_0x145262['CampaignId'];this[_0xa65d('0x23')]=_0x145262['originatecalleridnum']||'';this[_0xa65d('0x24')]=_0x145262['originatecalleridname']||'';this[_0xa65d('0x25')]=_0x145262[_0xa65d('0x25')];this['statedesc']=_0x145262[_0xa65d('0x26')];}module[_0xa65d('0x27')]=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 351deee..18e9948 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 _0x8827=['CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0xd36852,_0x40cd81){var _0x151f99=function(_0x509582){while(--_0x509582){_0xd36852['push'](_0xd36852['shift']());}};_0x151f99(++_0x40cd81);}(_0x8827,0xb7));var _0x7882=function(_0x508945,_0xe4a4b4){_0x508945=_0x508945-0x0;var _0x1b3883=_0x8827[_0x508945];return _0x1b3883;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x4ffb3d,_0x1c23ab){this[_0x7882('0x0')]=_0x4ffb3d[_0x7882('0x0')];this[_0x7882('0x1')]=_0x4ffb3d[_0x7882('0x1')];this[_0x7882('0x2')]=_0x4ffb3d[_0x7882('0x1')]==='outbound'?_0x7882('0x3'):_0x4ffb3d[_0x7882('0x1')];this[_0x7882('0x4')]=_0x4ffb3d['countbusyretry'];this[_0x7882('0x5')]=_0x4ffb3d[_0x7882('0x5')];this[_0x7882('0x6')]=_0x4ffb3d[_0x7882('0x6')];this[_0x7882('0x7')]=_0x4ffb3d['countbusyretry']+_0x4ffb3d[_0x7882('0x5')]+_0x4ffb3d[_0x7882('0x6')]+_0x4ffb3d[_0x7882('0x8')]+_0x4ffb3d[_0x7882('0x9')]+_0x4ffb3d['countabandonedretry']+_0x4ffb3d['countmachineretry']+_0x4ffb3d[_0x7882('0xa')];this[_0x7882('0x8')]=_0x4ffb3d['countnosuchnumberretry'];this[_0x7882('0x9')]=_0x4ffb3d[_0x7882('0x9')];this[_0x7882('0xb')]=_0x4ffb3d[_0x7882('0xb')];this[_0x7882('0xc')]=_0x4ffb3d[_0x7882('0xc')];this[_0x7882('0xa')]=_0x4ffb3d[_0x7882('0xa')];this[_0x7882('0xd')]=_0x1c23ab[_0x7882('0xd')];this[_0x7882('0xe')]=_0x4ffb3d[_0x7882('0xf')];this[_0x7882('0x10')]=_0x4ffb3d[_0x7882('0x11')];this[_0x7882('0x12')]=_0x4ffb3d['starttime'];this[_0x7882('0x13')]=_0x4ffb3d['responsetime'];this['droptime']=_0x4ffb3d[_0x7882('0x14')];this[_0x7882('0x15')]=_0x4ffb3d['dropreason'];this[_0x7882('0x16')]=this['droptime'];this[_0x7882('0x17')]=utils[_0x7882('0x18')](_0x4ffb3d[_0x7882('0x13')],_0x4ffb3d[_0x7882('0x12')]);this[_0x7882('0x19')]=utils['getSeconds'](this[_0x7882('0x14')],_0x4ffb3d['responsetime']);this[_0x7882('0x1a')]=0x0;this[_0x7882('0x3')]=_0x1c23ab[_0x7882('0x3')];this['membername']=_0x1c23ab[_0x7882('0x1b')];this[_0x7882('0x1c')]=_0x1c23ab[_0x7882('0x1c')];this['callback']=_0x4ffb3d[_0x7882('0x1d')];this['callbackuniqueid']=_0x4ffb3d[_0x7882('0x1e')];this[_0x7882('0x1f')]=_0x4ffb3d[_0x7882('0x1f')];this[_0x7882('0x20')]=_0x4ffb3d[_0x7882('0x20')];this['ContactId']=_0x4ffb3d[_0x7882('0x21')];this['ListId']=_0x4ffb3d[_0x7882('0x22')];this['UserId']=_0x4ffb3d[_0x7882('0x23')];this[_0x7882('0x24')]=_0x4ffb3d[_0x7882('0x24')];this[_0x7882('0x25')]=_0x4ffb3d[_0x7882('0x25')];this[_0x7882('0x26')]=_0x4ffb3d[_0x7882('0x26')]||'';this[_0x7882('0x27')]=_0x4ffb3d['originatecalleridname']||'';this[_0x7882('0x28')]=_0x4ffb3d[_0x7882('0x28')];this[_0x7882('0x29')]=_0x4ffb3d['state'];this[_0x7882('0x2a')]=_0x4ffb3d[_0x7882('0x2a')];}module[_0x7882('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0xcba4=['name','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcba4,0xa3));var _0x4cba=function(_0x5f5a06,_0x2f73a4){_0x5f5a06=_0x5f5a06-0x0;var _0xea5ed8=_0xcba4[_0x5f5a06];return _0xea5ed8;};'use strict';var utils=require(_0x4cba('0x0'));function QueueCallerAbandon(_0x4ff0df,_0x3fe802){this[_0x4cba('0x1')]=_0x4ff0df[_0x4cba('0x1')];this[_0x4cba('0x2')]=_0x4ff0df[_0x4cba('0x2')];this[_0x4cba('0x3')]=_0x4ff0df[_0x4cba('0x2')]===_0x4cba('0x4')?_0x4cba('0x5'):_0x4ff0df[_0x4cba('0x2')];this['countbusyretry']=_0x4ff0df[_0x4cba('0x6')];this[_0x4cba('0x7')]=_0x4ff0df[_0x4cba('0x7')];this[_0x4cba('0x8')]=_0x4ff0df[_0x4cba('0x8')];this[_0x4cba('0x9')]=_0x4ff0df[_0x4cba('0x6')]+_0x4ff0df[_0x4cba('0x7')]+_0x4ff0df['countnoanswerretry']+_0x4ff0df[_0x4cba('0xa')]+_0x4ff0df[_0x4cba('0xb')]+_0x4ff0df[_0x4cba('0xc')]+_0x4ff0df[_0x4cba('0xd')]+_0x4ff0df[_0x4cba('0xe')];this[_0x4cba('0xa')]=_0x4ff0df['countnosuchnumberretry'];this['countdropretry']=_0x4ff0df['countdropretry'];this[_0x4cba('0xc')]=_0x4ff0df['countabandonedretry'];this[_0x4cba('0xd')]=_0x4ff0df[_0x4cba('0xd')];this[_0x4cba('0xe')]=_0x4ff0df[_0x4cba('0xe')];this[_0x4cba('0xf')]=_0x3fe802[_0x4cba('0xf')];this[_0x4cba('0x10')]=_0x4ff0df[_0x4cba('0x11')];this['calleridnum']=_0x4ff0df[_0x4cba('0x12')];this[_0x4cba('0x13')]=_0x4ff0df[_0x4cba('0x13')];this[_0x4cba('0x14')]=_0x4ff0df[_0x4cba('0x14')];this[_0x4cba('0x15')]=_0x4ff0df[_0x4cba('0x15')];this[_0x4cba('0x16')]=_0x4ff0df['dropreason'];this[_0x4cba('0x17')]=this['droptime'];this[_0x4cba('0x18')]=utils[_0x4cba('0x19')](_0x4ff0df[_0x4cba('0x14')],_0x4ff0df[_0x4cba('0x13')]);this[_0x4cba('0x1a')]=utils[_0x4cba('0x19')](this[_0x4cba('0x15')],_0x4ff0df[_0x4cba('0x14')]);this[_0x4cba('0x1b')]=0x0;this[_0x4cba('0x5')]=_0x3fe802[_0x4cba('0x5')];this['membername']=_0x3fe802[_0x4cba('0x1c')];this[_0x4cba('0x1d')]=_0x3fe802['reason'];this[_0x4cba('0x1e')]=_0x4ff0df[_0x4cba('0x1e')];this['callbackuniqueid']=_0x4ff0df[_0x4cba('0x1f')];this[_0x4cba('0x20')]=_0x4ff0df[_0x4cba('0x20')];this['recallme']=_0x4ff0df[_0x4cba('0x21')];this[_0x4cba('0x22')]=_0x4ff0df[_0x4cba('0x22')];this[_0x4cba('0x23')]=_0x4ff0df['ListId'];this[_0x4cba('0x24')]=_0x4ff0df[_0x4cba('0x24')];this[_0x4cba('0x25')]=_0x4ff0df[_0x4cba('0x25')];this[_0x4cba('0x26')]=_0x4ff0df['CampaignId'];this[_0x4cba('0x27')]=_0x4ff0df['originatecalleridnum']||'';this[_0x4cba('0x28')]=_0x4ff0df[_0x4cba('0x28')]||'';this[_0x4cba('0x29')]=_0x4ff0df[_0x4cba('0x29')];this['state']=_0x4ff0df[_0x4cba('0x2a')];this['statedesc']=_0x4ff0df[_0x4cba('0x2b')];}module[_0x4cba('0x2c')]=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 941a6e3..507f6a4 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 _0x5fab=['[rescheduleContact]','rescheduleContact','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[avgHandleTime]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','temp','error','catch','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]'];(function(_0x41ea76,_0x43dbd4){var _0x242b0f=function(_0x4650ac){while(--_0x4650ac){_0x41ea76['push'](_0x41ea76['shift']());}};_0x242b0f(++_0x43dbd4);}(_0x5fab,0x177));var _0xb5fa=function(_0x429d68,_0x1aa5a2){_0x429d68=_0x429d68-0x0;var _0x172ef0=_0x5fab[_0x429d68];return _0x172ef0;};'use strict';var util=require(_0xb5fa('0x0'));var logger=require(_0xb5fa('0x1'))('dialer');var cmHopper=require(_0xb5fa('0x2'));var cmHopperAdditionalPhone=require(_0xb5fa('0x3'));var cmHopperBlack=require(_0xb5fa('0x4'));var cmHopperHistory=require(_0xb5fa('0x5'));function inspectError(_0x67e8e8){return util[_0xb5fa('0x6')](_0x67e8e8,{'showHidden':![],'depth':null});}function getContactDialer(_0x29390a,_0x4341d3,_0x10361d){return cmHopper[_0xb5fa('0x7')](_0x29390a['id'],_0x4341d3,_0x10361d,_0x29390a['dialOrderByScheduledAt'])['catch'](function(_0x2e3804){_0x29390a[_0xb5fa('0x8')]=0x0;logger[_0xb5fa('0x9')]('[getContactDialer]',inspectError(_0x2e3804));});}exports[_0xb5fa('0x7')]=getContactDialer;function getContactDialerIvr(_0x38d9a3,_0x2cf4a5){return cmHopper['getContactDialerIvr'](_0x38d9a3['id'],_0x2cf4a5,_0x38d9a3['dialOrderByScheduledAt'])[_0xb5fa('0xa')](function(_0x23d124){_0x38d9a3[_0xb5fa('0x8')]=0x0;logger[_0xb5fa('0x9')](_0xb5fa('0xb'),inspectError(_0x23d124));});}exports[_0xb5fa('0xc')]=getContactDialerIvr;function countReScheduled(_0x65c6b6){return cmHopper[_0xb5fa('0xd')](_0x65c6b6)[_0xb5fa('0xa')](function(_0x4d3576){logger[_0xb5fa('0x9')](_0xb5fa('0xe'),inspectError(_0x4d3576));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x116849){return cmHopper['rescheduleContact'](_0x116849)[_0xb5fa('0xa')](function(_0x3fc372){logger[_0xb5fa('0x9')](_0xb5fa('0xf'),inspectError(_0x3fc372));});}exports[_0xb5fa('0x10')]=rescheduleContact;function unlockContact(_0x5371cf,_0x567f31,_0x38e964){return cmHopper[_0xb5fa('0x11')](_0x5371cf,_0x567f31,_0x38e964)[_0xb5fa('0xa')](function(_0x27c8f7){logger['error']('[unlockContact]',inspectError(_0x27c8f7));});}exports[_0xb5fa('0x11')]=unlockContact;function moveContactManagedDialer(_0x1f7f05){return cmHopper[_0xb5fa('0x12')](_0x1f7f05)[_0xb5fa('0xa')](function(_0x324ba5){logger[_0xb5fa('0x9')](_0xb5fa('0x13'),inspectError(_0x324ba5));});}exports[_0xb5fa('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0xc14dc4){return cmHopperBlack[_0xb5fa('0x14')](_0xc14dc4)[_0xb5fa('0xa')](function(_0x1f5064){logger['error'](_0xb5fa('0x15'),inspectError(_0x1f5064));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x37ae06){return cmHopperBlack['checkIsBlackListIvr'](_0x37ae06)[_0xb5fa('0xa')](function(_0x43c09f){logger['error'](_0xb5fa('0x16'),inspectError(_0x43c09f));});}exports[_0xb5fa('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x283a56,_0x47f71a,_0x32a85c){return cmHopperAdditionalPhone[_0xb5fa('0x18')](_0x283a56,_0x47f71a,_0x32a85c)[_0xb5fa('0xa')](function(_0x542348){logger[_0xb5fa('0x9')]('[verifyAdditionalPhone]',inspectError(_0x542348));});}exports[_0xb5fa('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x264591,_0x11053a,_0x543edf){return cmHopperAdditionalPhone[_0xb5fa('0x19')](_0x264591,_0x11053a,_0x543edf)[_0xb5fa('0xa')](function(_0x6a455c){logger[_0xb5fa('0x9')]('[swapAdditionalPhone]',inspectError(_0x6a455c));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x5bdf11){return cmHopperHistory['avgHandleTime'](_0x5bdf11)[_0xb5fa('0xa')](function(_0x460b54){logger[_0xb5fa('0x9')](_0xb5fa('0x1a'),inspectError(_0x460b54));});}exports[_0xb5fa('0x1b')]=avgHandleTime;function createHistory(_0x3506a4){return cmHopperHistory[_0xb5fa('0x1c')](_0x3506a4)[_0xb5fa('0xa')](function(_0x409af9){logger[_0xb5fa('0x9')](_0xb5fa('0x1d'),inspectError(_0x409af9));});}exports[_0xb5fa('0x1c')]=createHistory; \ No newline at end of file +var _0x0a6b=['verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','temp','error','getContactDialerIvr','catch','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x18e0f7,_0x3e567c){_0x18e0f7=_0x18e0f7-0x0;var _0x4364f7=_0x0a6b[_0x18e0f7];return _0x4364f7;};'use strict';var util=require(_0xb0a6('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0xb0a6('0x1'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xb0a6('0x2'));function inspectError(_0x13dc41){return util[_0xb0a6('0x3')](_0x13dc41,{'showHidden':![],'depth':null});}function getContactDialer(_0x544a64,_0x102ecd,_0x4cc3ae){return cmHopper[_0xb0a6('0x4')](_0x544a64['id'],_0x102ecd,_0x4cc3ae,_0x544a64[_0xb0a6('0x5')])['catch'](function(_0x11cd5b){_0x544a64[_0xb0a6('0x6')]=0x0;logger[_0xb0a6('0x7')]('[getContactDialer]',inspectError(_0x11cd5b));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x5161af,_0x2ded05){return cmHopper[_0xb0a6('0x8')](_0x5161af['id'],_0x2ded05,_0x5161af[_0xb0a6('0x5')])[_0xb0a6('0x9')](function(_0x5252ed){_0x5161af[_0xb0a6('0x6')]=0x0;logger[_0xb0a6('0x7')]('[getContactDialerIvr]',inspectError(_0x5252ed));});}exports[_0xb0a6('0x8')]=getContactDialerIvr;function countReScheduled(_0x24e4fd){return cmHopper[_0xb0a6('0xa')](_0x24e4fd)[_0xb0a6('0x9')](function(_0x471d0f){logger[_0xb0a6('0x7')](_0xb0a6('0xb'),inspectError(_0x471d0f));});}exports[_0xb0a6('0xa')]=countReScheduled;function rescheduleContact(_0x392f48){return cmHopper[_0xb0a6('0xc')](_0x392f48)['catch'](function(_0x2b801a){logger['error'](_0xb0a6('0xd'),inspectError(_0x2b801a));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x25582f,_0x59730e,_0x1d837f){return cmHopper[_0xb0a6('0xe')](_0x25582f,_0x59730e,_0x1d837f)[_0xb0a6('0x9')](function(_0x5673ad){logger['error'](_0xb0a6('0xf'),inspectError(_0x5673ad));});}exports[_0xb0a6('0xe')]=unlockContact;function moveContactManagedDialer(_0x59bc9c){return cmHopper[_0xb0a6('0x10')](_0x59bc9c)[_0xb0a6('0x9')](function(_0x13a1c8){logger['error'](_0xb0a6('0x11'),inspectError(_0x13a1c8));});}exports[_0xb0a6('0x10')]=moveContactManagedDialer;function checkIsBlackList(_0x372457){return cmHopperBlack[_0xb0a6('0x12')](_0x372457)[_0xb0a6('0x9')](function(_0x30ac04){logger['error'](_0xb0a6('0x13'),inspectError(_0x30ac04));});}exports[_0xb0a6('0x12')]=checkIsBlackList;function checkIsBlackListIvr(_0x2d0fca){return cmHopperBlack[_0xb0a6('0x14')](_0x2d0fca)[_0xb0a6('0x9')](function(_0x10e56b){logger[_0xb0a6('0x7')](_0xb0a6('0x15'),inspectError(_0x10e56b));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x3db6a6,_0x5c6e66,_0x1322ec){return cmHopperAdditionalPhone[_0xb0a6('0x16')](_0x3db6a6,_0x5c6e66,_0x1322ec)['catch'](function(_0x4aa68d){logger[_0xb0a6('0x7')](_0xb0a6('0x17'),inspectError(_0x4aa68d));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x3ea787,_0x24574a,_0x259f47){return cmHopperAdditionalPhone[_0xb0a6('0x18')](_0x3ea787,_0x24574a,_0x259f47)['catch'](function(_0x5e2a7c){logger[_0xb0a6('0x7')](_0xb0a6('0x19'),inspectError(_0x5e2a7c));});}exports[_0xb0a6('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x58d923){return cmHopperHistory[_0xb0a6('0x1a')](_0x58d923)[_0xb0a6('0x9')](function(_0x3edd9a){logger[_0xb0a6('0x7')](_0xb0a6('0x1b'),inspectError(_0x3edd9a));});}exports[_0xb0a6('0x1a')]=avgHandleTime;function createHistory(_0x94d47f){return cmHopperHistory[_0xb0a6('0x1c')](_0x94d47f)[_0xb0a6('0x9')](function(_0x4ced9f){logger[_0xb0a6('0x7')](_0xb0a6('0x1d'),inspectError(_0x4ced9f));});}exports[_0xb0a6('0x1c')]=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 636d8c4..326a974 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 _0x33f6=['INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','isIVRCampaign','outbound','isOutboundQueue','dialActive','active','isIVRCampaignActive','milliseconds','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','SIP/','reachable','unmonitored','status','TrunkBackup','ACTIVE','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','includes','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL'];(function(_0x4c98db,_0x1278da){var _0x4a8303=function(_0x4d9594){while(--_0x4d9594){_0x4c98db['push'](_0x4c98db['shift']());}};_0x4a8303(++_0x1278da);}(_0x33f6,0x108));var _0x633f=function(_0x17550f,_0x49eabe){_0x17550f=_0x17550f-0x0;var _0x1f187b=_0x33f6[_0x17550f];return _0x1f187b;};'use strict';var _=require(_0x633f('0x0'));var moment=require(_0x633f('0x1'));var util=require('util');var logger=require(_0x633f('0x2'))(_0x633f('0x3'));var timezones=require(_0x633f('0x4'))[_0x633f('0x5')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0x633f('0x6'),'CONTACTS_RESCHEDULED':_0x633f('0x7'),'DEACTIVATED':_0x633f('0x8'),'DISACTIVED':_0x633f('0x9'),'EMPTY_INTERVAL':_0x633f('0xa'),'INACTIVE':_0x633f('0xb'),'NO_AGENTS_LOGGED':_0x633f('0xc'),'NO_AVAILABLE_CONTACTS':_0x633f('0xd'),'NULL_INTERVAL':_0x633f('0xe'),'OVERTIME_INTERVAL':_0x633f('0xf'),'OVERTIME_GLOBAL_INTERVAL':_0x633f('0x10'),'QUEUE_RECALL':_0x633f('0x11'),'RECALL_TIMEOUT':_0x633f('0x12'),'RUNNING':_0x633f('0x13'),'UNKNOWN_TIMEZONE':_0x633f('0x14'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x633f('0x15')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3693db){return _0x3693db[_0x633f('0x16')]===_0x633f('0x17');}exports[_0x633f('0x18')]=isPreviewCampaign;function isIVRCampaign(_0x3d7424){return _0x3d7424['type']==='ivr';}exports[_0x633f('0x19')]=isIVRCampaign;function isOutboundQueue(_0xd61e61){return _0xd61e61['type']===_0x633f('0x1a');}exports[_0x633f('0x1b')]=isOutboundQueue;function isQueueCampaignActive(_0x5973e2){return _0x5973e2[_0x633f('0x1c')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0xb882ea){return _0xb882ea[_0x633f('0x1d')];}exports[_0x633f('0x1e')]=isIVRCampaignActive;function getSeconds(_0x1f71b2,_0x5e54c5){var _0x2a6afa=moment(_0x1f71b2)[_0x633f('0x1f')](0x0);var _0x590728=moment(_0x5e54c5)[_0x633f('0x1f')](0x0);return _0x2a6afa['diff'](_0x590728,_0x633f('0x20'));}exports[_0x633f('0x21')]=getSeconds;function hasQueueCampaignDataChanged(_0x4028b2,_0x5c7a76){var _0x3c71ef=![];var _0x3762df=_0x4028b2[_0x633f('0x16')]!==_0x5c7a76[_0x633f('0x16')]||_0x4028b2[_0x633f('0x1c')]!==_0x5c7a76[_0x633f('0x1c')]||_0x4028b2[_0x633f('0x22')]!==_0x5c7a76[_0x633f('0x22')];var _0x27069e=_0x4028b2[_0x633f('0x23')]!==_0x5c7a76[_0x633f('0x23')]||_0x4028b2[_0x633f('0x24')]!==_0x5c7a76[_0x633f('0x24')]||_0x4028b2[_0x633f('0x25')]!==_0x5c7a76[_0x633f('0x25')]||_0x4028b2[_0x633f('0x26')]!==_0x5c7a76[_0x633f('0x26')]||_0x4028b2[_0x633f('0x27')]!==_0x5c7a76[_0x633f('0x27')]||_0x4028b2[_0x633f('0x28')]!==_0x5c7a76[_0x633f('0x28')]||_0x4028b2[_0x633f('0x29')]!==_0x5c7a76['waiting']||_0x4028b2[_0x633f('0x2a')]!==_0x5c7a76[_0x633f('0x2a')]||_0x4028b2['originated']!==_0x5c7a76[_0x633f('0x2b')];if(_0x4028b2['Trunk']&&_0x5c7a76['Trunk']){_0x3c71ef=_0x4028b2['Trunk']['name']!==_0x5c7a76[_0x633f('0x2c')][_0x633f('0x2d')]||_0x4028b2[_0x633f('0x2c')][_0x633f('0x1d')]!==_0x5c7a76['Trunk'][_0x633f('0x1d')];}return _0x3762df||_0x27069e||_0x3c71ef;}exports[_0x633f('0x2e')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x3ba841){var _0x1a7a88=null;var _0x5b48a2=_0x3ba841[_0x633f('0x2f')];if(_[_0x633f('0x30')](_0x3ba841[_0x633f('0x31')])||_[_0x633f('0x30')](_0x3ba841[_0x633f('0x32')])||_['isNil'](_0x3ba841['Interval']['Intervals'])){_0x1a7a88=CAMPAIGN_STATUS[_0x633f('0x33')];}else if(_[_0x633f('0x34')](_0x3ba841['dialGlobalInterval'])||_[_0x633f('0x34')](_0x3ba841['Interval']['Intervals'])){_0x1a7a88=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x5b48a2&&!timezones[_0x5b48a2]){_0x1a7a88=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x1a7a88;}function checkAnyValidTrunk(_0xdaaa7c,_0x515c3a){var _0x5239fc=null;var _0x23ab36=_0x633f('0x35');var _0x7798b=[_0x633f('0x36'),_0x633f('0x37')];var _0x352a22=!![];if(_0xdaaa7c[_0x633f('0x2c')]&&_0xdaaa7c[_0x633f('0x2c')][_0x633f('0x1d')]){_0x23ab36+=_0xdaaa7c[_0x633f('0x2c')][_0x633f('0x2d')];_0x5239fc=_0x515c3a[_0x23ab36];_0x352a22=_0x7798b['includes'](_0x5239fc[_0x633f('0x38')]);}else if(_0xdaaa7c[_0x633f('0x39')]&&_0xdaaa7c[_0x633f('0x39')]['active']){_0x23ab36+=_0xdaaa7c['TrunkBackup'][_0x633f('0x2d')];_0x5239fc=_0x515c3a[_0x23ab36];_0x352a22=_0x7798b['includes'](_0x5239fc[_0x633f('0x38')]);}return _0x352a22;}function getQueueCampaignStatusMessage(_0x24112f,_0x204850){var _0x355388=CAMPAIGN_STATUS[_0x633f('0x3a')];var _0x16da15=isPreviewCampaign(_0x24112f);if(!isQueueCampaignActive(_0x24112f)){if(_0x16da15){_0x355388=CAMPAIGN_STATUS[_0x633f('0x3b')];}else{if(_0x24112f[_0x633f('0x2b')]===0x0&&_0x24112f['talking']===0x0&&_0x24112f[_0x633f('0x29')]===0x0&&(_0x24112f[_0x633f('0x28')]||0x0)===0x0){_0x355388=CAMPAIGN_STATUS[_0x633f('0x3b')];}else{_0x355388=CAMPAIGN_STATUS[_0x633f('0x3c')];}}}else if(_0x24112f[_0x633f('0x24')]===0x0){_0x355388=CAMPAIGN_STATUS[_0x633f('0x3d')];}else if(!checkAnyValidTrunk(_0x24112f,_0x204850)){_0x355388=CAMPAIGN_STATUS[_0x633f('0x3e')];}else if(!isPreviewCampaign(_0x24112f)){var _0x479b02=checkAnyValidQueueCampaignInterval(_0x24112f);if(_0x479b02){_0x355388=_0x479b02;}}return _0x355388;}exports[_0x633f('0x3f')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2b7d7e){var _0x241f2a=CAMPAIGN_STATUS[_0x633f('0x3c')];if(_0x2b7d7e[_0x633f('0x2b')]===0x0&&_0x2b7d7e[_0x633f('0x27')]===0x0&&_0x2b7d7e['waiting']===0x0&&(_0x2b7d7e[_0x633f('0x28')]||0x0)===0x0){_0x241f2a=CAMPAIGN_STATUS['INACTIVE'];}return _0x241f2a;}exports[_0x633f('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x1df916){var _0x330a2d=_0x1df916[_0x633f('0x41')](/"(.*?)"/);return _0x330a2d?_0x330a2d[0x1]:_0x1df916;}exports[_0x633f('0x42')]=extractCalleridName;function getCallerId(_0x3ab5ba,_0x5135f8,_0x8d5258){if(!_['isUndefined'](_0x8d5258)&&typeof _0x8d5258===_0x633f('0x43')&&!_[_0x633f('0x34')](_0x8d5258)){if(!_[_0x633f('0x44')](_0x5135f8)&&typeof _0x5135f8===_0x633f('0x43')&&!_[_0x633f('0x34')](_0x5135f8)){return util[_0x633f('0x45')](_0x633f('0x46'),_0x5135f8,_0x8d5258);}return util['format'](_0x633f('0x46'),_0x8d5258,_0x8d5258);}if(!_[_0x633f('0x44')](_0x3ab5ba)&&typeof _0x3ab5ba===_0x633f('0x43')&&!_[_0x633f('0x34')](_0x3ab5ba)){return _0x3ab5ba;}return _0x633f('0x47');}exports[_0x633f('0x48')]=getCallerId;function getCallerIdRandom(_0xbab2cb,_0x1802fa){var _0x4cdfa1;var _0x1565f9;var _0xabfacf;if(_0x1802fa<=0x0){_0x1802fa=0x1;}_0x4cdfa1=new RegExp(_0x633f('0x49')+_0x1802fa+'}$');_0x1565f9=Math[_0x633f('0x4a')](0xa,_0x1802fa-0x1);_0xabfacf=Math['pow'](0xa,_0x1802fa)-0x1;return util[_0x633f('0x45')]('%s',_[_0x633f('0x4b')](_0xbab2cb,_0x4cdfa1,_[_0x633f('0x4c')](_0x1565f9,_0xabfacf)[_0x633f('0x4d')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0xb1cbd5){if(_0xb1cbd5[_0x633f('0x2b')]&&_0xb1cbd5['originated']>0x0){_0xb1cbd5[_0x633f('0x2b')]-=0x1;}else{logger[_0x633f('0x4e')](_0x633f('0x4f'));}}exports[_0x633f('0x50')]=decrementOriginate;function checkContactEmpty(_0x27ae53){return _0x27ae53&&_0x27ae53[_0x633f('0x51')]>0x0;}exports[_0x633f('0x52')]=checkContactEmpty;function erlangb(_0x1cce99,_0x5710f2){if(_0x5710f2===0x0){return 0x0;}var _0x87b29d=0x1;for(var _0x516249=0x1;_0x516249<=_0x5710f2;_0x516249+=0x1){_0x87b29d=0x1+_0x87b29d*_0x516249/_0x1cce99;}return 0x1/_0x87b29d;}exports[_0x633f('0x53')]=erlangb;function checkContactLowerLimitOriginate(_0x23adab,_0x4939ec,_0xe3202){if(_0x4939ec>_0xe3202){for(var _0x580595=0x0;_0x580595<_0x4939ec-_0xe3202;_0x580595+=0x1){decrementOriginate(_0x23adab);}}}exports[_0x633f('0x54')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x4cc6ae){var _0x44325e={};var _0x465c32=['id',_0x633f('0x55'),_0x633f('0x56'),_0x633f('0x57'),'updatedAt'];if(_0x4cc6ae){for(var _0x31b5ca in _0x4cc6ae){if(typeof _0x4cc6ae[_0x31b5ca]!=='undefined'){if(!_[_0x633f('0x30')](_0x4cc6ae[_0x31b5ca])&&!_0x465c32[_0x633f('0x58')](_0x31b5ca)){_0x44325e[util[_0x633f('0x45')](_0x633f('0x59'),_0x633f('0x5a'),_0x31b5ca[_0x633f('0x5b')]())]=_0x4cc6ae[_0x31b5ca];}}}}return _0x44325e;}exports[_0x633f('0x5c')]=setXMDContactVariables; \ No newline at end of file +var _0xad59=['dialTimezone','isNil','Interval','NULL_INTERVAL','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','extractCalleridName','string','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','description','updatedAt','undefined','includes','%s%s','toUpperCase','lodash','moment','util','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isOutboundQueue','dialActive','isIVRCampaignActive','milliseconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','active','hasQueueCampaignDataChanged'];(function(_0x4255fa,_0x5dfbbc){var _0x530188=function(_0x334dd1){while(--_0x334dd1){_0x4255fa['push'](_0x4255fa['shift']());}};_0x530188(++_0x5dfbbc);}(_0xad59,0xca));var _0x9ad5=function(_0x36a891,_0xc50072){_0x36a891=_0x36a891-0x0;var _0x1ae92e=_0xad59[_0x36a891];return _0x1ae92e;};'use strict';var _=require(_0x9ad5('0x0'));var moment=require(_0x9ad5('0x1'));var util=require(_0x9ad5('0x2'));var logger=require('../../../../config/logger')(_0x9ad5('0x3'));var timezones=require(_0x9ad5('0x4'))[_0x9ad5('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x9ad5('0x6'),'BLACKLIST':_0x9ad5('0x7'),'CONTACTS_RESCHEDULED':_0x9ad5('0x8'),'DEACTIVATED':_0x9ad5('0x9'),'DISACTIVED':_0x9ad5('0xa'),'EMPTY_INTERVAL':_0x9ad5('0xb'),'INACTIVE':_0x9ad5('0xc'),'NO_AGENTS_LOGGED':_0x9ad5('0xd'),'NO_AVAILABLE_CONTACTS':_0x9ad5('0xe'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0x9ad5('0xf'),'OVERTIME_GLOBAL_INTERVAL':_0x9ad5('0x10'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x9ad5('0x11'),'RUNNING':_0x9ad5('0x12'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x9ad5('0x13')};exports[_0x9ad5('0x14')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2f1666){return _0x2f1666[_0x9ad5('0x15')]===_0x9ad5('0x16');}exports[_0x9ad5('0x17')]=isPreviewCampaign;function isIVRCampaign(_0x1e1086){return _0x1e1086[_0x9ad5('0x18')]===_0x9ad5('0x19');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x322ebe){return _0x322ebe[_0x9ad5('0x18')]==='outbound';}exports[_0x9ad5('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0x320452){return _0x320452[_0x9ad5('0x1b')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x5b0004){return _0x5b0004['active'];}exports[_0x9ad5('0x1c')]=isIVRCampaignActive;function getSeconds(_0x5e2325,_0x2a85a1){var _0x2b74cf=moment(_0x5e2325)['milliseconds'](0x0);var _0x268f83=moment(_0x2a85a1)[_0x9ad5('0x1d')](0x0);return _0x2b74cf['diff'](_0x268f83,'seconds');}exports[_0x9ad5('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x46af15,_0x1db4cb){var _0x5db647=![];var _0xdb9282=_0x46af15['dialMethod']!==_0x1db4cb[_0x9ad5('0x15')]||_0x46af15['dialActive']!==_0x1db4cb[_0x9ad5('0x1b')]||_0x46af15[_0x9ad5('0x1f')]!==_0x1db4cb[_0x9ad5('0x1f')];var _0xa8ccaa=_0x46af15[_0x9ad5('0x20')]!==_0x1db4cb[_0x9ad5('0x20')]||_0x46af15[_0x9ad5('0x21')]!==_0x1db4cb[_0x9ad5('0x21')]||_0x46af15[_0x9ad5('0x22')]!==_0x1db4cb[_0x9ad5('0x22')]||_0x46af15[_0x9ad5('0x23')]!==_0x1db4cb[_0x9ad5('0x23')]||_0x46af15[_0x9ad5('0x24')]!==_0x1db4cb[_0x9ad5('0x24')]||_0x46af15['pTalking']!==_0x1db4cb[_0x9ad5('0x25')]||_0x46af15[_0x9ad5('0x26')]!==_0x1db4cb[_0x9ad5('0x26')]||_0x46af15['inUse']!==_0x1db4cb[_0x9ad5('0x27')]||_0x46af15[_0x9ad5('0x28')]!==_0x1db4cb[_0x9ad5('0x28')];if(_0x46af15[_0x9ad5('0x29')]&&_0x1db4cb[_0x9ad5('0x29')]){_0x5db647=_0x46af15[_0x9ad5('0x29')]['name']!==_0x1db4cb[_0x9ad5('0x29')]['name']||_0x46af15[_0x9ad5('0x29')]['active']!==_0x1db4cb[_0x9ad5('0x29')][_0x9ad5('0x2a')];}return _0xdb9282||_0xa8ccaa||_0x5db647;}exports[_0x9ad5('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5d4f45){var _0x42fa09=null;var _0x33112f=_0x5d4f45[_0x9ad5('0x2c')];if(_[_0x9ad5('0x2d')](_0x5d4f45['dialGlobalInterval'])||_['isNil'](_0x5d4f45[_0x9ad5('0x2e')])||_[_0x9ad5('0x2d')](_0x5d4f45[_0x9ad5('0x2e')]['Intervals'])){_0x42fa09=CAMPAIGN_STATUS[_0x9ad5('0x2f')];}else if(_[_0x9ad5('0x30')](_0x5d4f45['dialGlobalInterval'])||_['isEmpty'](_0x5d4f45[_0x9ad5('0x2e')][_0x9ad5('0x31')])){_0x42fa09=CAMPAIGN_STATUS[_0x9ad5('0x32')];}else if(_0x33112f&&!timezones[_0x33112f]){_0x42fa09=CAMPAIGN_STATUS[_0x9ad5('0x33')];}return _0x42fa09;}function checkAnyValidTrunk(_0xfe8d14,_0x3c80ed){var _0x5b509f=null;var _0x2eed06=_0x9ad5('0x34');var _0x2fffbf=['reachable','unmonitored'];var _0x4c5ee2=!![];if(_0xfe8d14[_0x9ad5('0x29')]&&_0xfe8d14['Trunk'][_0x9ad5('0x2a')]){_0x2eed06+=_0xfe8d14[_0x9ad5('0x29')]['name'];_0x5b509f=_0x3c80ed[_0x2eed06];_0x4c5ee2=_0x2fffbf['includes'](_0x5b509f[_0x9ad5('0x35')]);}else if(_0xfe8d14['TrunkBackup']&&_0xfe8d14[_0x9ad5('0x36')][_0x9ad5('0x2a')]){_0x2eed06+=_0xfe8d14[_0x9ad5('0x36')]['name'];_0x5b509f=_0x3c80ed[_0x2eed06];_0x4c5ee2=_0x2fffbf['includes'](_0x5b509f[_0x9ad5('0x35')]);}return _0x4c5ee2;}function getQueueCampaignStatusMessage(_0x25bc08,_0x1714ff){var _0x45cc01=CAMPAIGN_STATUS['ACTIVE'];var _0x2f3f9f=isPreviewCampaign(_0x25bc08);if(!isQueueCampaignActive(_0x25bc08)){if(_0x2f3f9f){_0x45cc01=CAMPAIGN_STATUS[_0x9ad5('0x37')];}else{if(_0x25bc08[_0x9ad5('0x28')]===0x0&&_0x25bc08[_0x9ad5('0x24')]===0x0&&_0x25bc08[_0x9ad5('0x26')]===0x0&&(_0x25bc08['pTalking']||0x0)===0x0){_0x45cc01=CAMPAIGN_STATUS['INACTIVE'];}else{_0x45cc01=CAMPAIGN_STATUS[_0x9ad5('0x38')];}}}else if(_0x25bc08[_0x9ad5('0x21')]===0x0){_0x45cc01=CAMPAIGN_STATUS[_0x9ad5('0x39')];}else if(!checkAnyValidTrunk(_0x25bc08,_0x1714ff)){_0x45cc01=CAMPAIGN_STATUS[_0x9ad5('0x3a')];}else if(!isPreviewCampaign(_0x25bc08)){var _0x319a77=checkAnyValidQueueCampaignInterval(_0x25bc08);if(_0x319a77){_0x45cc01=_0x319a77;}}return _0x45cc01;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x388289){var _0xfbdd8f=CAMPAIGN_STATUS['DISACTIVED'];if(_0x388289['originated']===0x0&&_0x388289[_0x9ad5('0x24')]===0x0&&_0x388289['waiting']===0x0&&(_0x388289[_0x9ad5('0x25')]||0x0)===0x0){_0xfbdd8f=CAMPAIGN_STATUS[_0x9ad5('0x37')];}return _0xfbdd8f;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x15955a){var _0x6d9077=_0x15955a['match'](/"(.*?)"/);return _0x6d9077?_0x6d9077[0x1]:_0x15955a;}exports[_0x9ad5('0x3b')]=extractCalleridName;function getCallerId(_0x2216ef,_0x482cda,_0xb06255){if(!_['isUndefined'](_0xb06255)&&typeof _0xb06255===_0x9ad5('0x3c')&&!_['isEmpty'](_0xb06255)){if(!_['isUndefined'](_0x482cda)&&typeof _0x482cda===_0x9ad5('0x3c')&&!_[_0x9ad5('0x30')](_0x482cda)){return util[_0x9ad5('0x3d')](_0x9ad5('0x3e'),_0x482cda,_0xb06255);}return util['format'](_0x9ad5('0x3e'),_0xb06255,_0xb06255);}if(!_[_0x9ad5('0x3f')](_0x2216ef)&&typeof _0x2216ef===_0x9ad5('0x3c')&&!_[_0x9ad5('0x30')](_0x2216ef)){return _0x2216ef;}return _0x9ad5('0x40');}exports[_0x9ad5('0x41')]=getCallerId;function getCallerIdRandom(_0x5ab371,_0x54ed80){var _0x5b650f;var _0x5ecc14;var _0x50d894;if(_0x54ed80<=0x0){_0x54ed80=0x1;}_0x5b650f=new RegExp(_0x9ad5('0x42')+_0x54ed80+'}$');_0x5ecc14=Math[_0x9ad5('0x43')](0xa,_0x54ed80-0x1);_0x50d894=Math[_0x9ad5('0x43')](0xa,_0x54ed80)-0x1;return util[_0x9ad5('0x3d')]('%s',_['replace'](_0x5ab371,_0x5b650f,_[_0x9ad5('0x44')](_0x5ecc14,_0x50d894)[_0x9ad5('0x45')]()));}exports[_0x9ad5('0x46')]=getCallerIdRandom;function decrementOriginate(_0x535204){if(_0x535204[_0x9ad5('0x28')]&&_0x535204['originated']>0x0){_0x535204[_0x9ad5('0x28')]-=0x1;}else{logger['error'](_0x9ad5('0x47'));}}exports[_0x9ad5('0x48')]=decrementOriginate;function checkContactEmpty(_0x189021){return _0x189021&&_0x189021['length']>0x0;}exports[_0x9ad5('0x49')]=checkContactEmpty;function erlangb(_0x6ae3b,_0x3df91d){if(_0x3df91d===0x0){return 0x0;}var _0x3e7441=0x1;for(var _0x7167a5=0x1;_0x7167a5<=_0x3df91d;_0x7167a5+=0x1){_0x3e7441=0x1+_0x3e7441*_0x7167a5/_0x6ae3b;}return 0x1/_0x3e7441;}exports[_0x9ad5('0x4a')]=erlangb;function checkContactLowerLimitOriginate(_0x42bae8,_0x11f250,_0x925cc1){if(_0x11f250>_0x925cc1){for(var _0x5262d9=0x0;_0x5262d9<_0x11f250-_0x925cc1;_0x5262d9+=0x1){decrementOriginate(_0x42bae8);}}}exports[_0x9ad5('0x4b')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0xc77abb){var _0x40637c={};var _0xc010fb=['id','createdAt',_0x9ad5('0x4c'),'tags',_0x9ad5('0x4d')];if(_0xc77abb){for(var _0x7ab3e2 in _0xc77abb){if(typeof _0xc77abb[_0x7ab3e2]!==_0x9ad5('0x4e')){if(!_[_0x9ad5('0x2d')](_0xc77abb[_0x7ab3e2])&&!_0xc010fb[_0x9ad5('0x4f')](_0x7ab3e2)){_0x40637c[util['format'](_0x9ad5('0x50'),'XMD-',_0x7ab3e2[_0x9ad5('0x51')]())]=_0xc77abb[_0x7ab3e2];}}}}return _0x40637c;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 8fd51bc..12e3391 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(_0x1dde9e,_0x6fda35){var _0x13ea84=function(_0x49fd01){while(--_0x49fd01){_0x1dde9e['push'](_0x1dde9e['shift']());}};_0x13ea84(++_0x6fda35);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x57d078,_0x5604a2){var _0x178d91=function(_0x23c47f){while(--_0x23c47f){_0x57d078['push'](_0x57d078['shift']());}};_0x178d91(++_0x5604a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 619c3c8..b06a636 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 _0xcc13=['Is\x20Valid','exports','util','lodash','bluebird','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','syncNewState','bind','newexten','syncNewExten','faxstatus','receivefax','hangup','syncHangup','syncOriginateResponse','prototype','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','dir','XMF-PATH','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path'];(function(_0x1d8633,_0x4a6240){var _0x328e0e=function(_0x70f29a){while(--_0x70f29a){_0x1d8633['push'](_0x1d8633['shift']());}};_0x328e0e(++_0x4a6240);}(_0xcc13,0x15e));var _0x3cc1=function(_0x2d6993,_0x3d621b){_0x2d6993=_0x2d6993-0x0;var _0x1cc0d1=_0xcc13[_0x2d6993];return _0x1cc0d1;};'use strict';var util=require(_0x3cc1('0x0'));var _=require(_0x3cc1('0x1'));var BPromise=require(_0x3cc1('0x2'));var uuid=require('uuid');var moment=require('moment');var path=require(_0x3cc1('0x3'));var tiff2pdf=require(_0x3cc1('0x4'));var gs=require(_0x3cc1('0x5'));var logger=require('../../../config/logger')(_0x3cc1('0x6'));var ami=require(_0x3cc1('0x7'));var rpcDb=require(_0x3cc1('0x8'));var Channel=require(_0x3cc1('0x9'));var ut=require(_0x3cc1('0xa'));var Action=require('./action');var faxAccount=require(_0x3cc1('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x3cc1('0xc'));function Fax(_0x35c5f5){this[_0x3cc1('0xd')]={};this[_0x3cc1('0xe')]=_0x35c5f5[_0x3cc1('0xe')];this[_0x3cc1('0xf')]=_0x35c5f5[_0x3cc1('0xf')];this[_0x3cc1('0x10')]={};ami['on'](_0x3cc1('0x11'),this[_0x3cc1('0x12')]['bind'](this));ami['on'](_0x3cc1('0x13'),this[_0x3cc1('0x14')]['bind'](this));ami['on']('newstate',this[_0x3cc1('0x15')][_0x3cc1('0x16')](this));ami['on'](_0x3cc1('0x17'),this[_0x3cc1('0x18')][_0x3cc1('0x16')](this));ami['on'](_0x3cc1('0x19'),this['syncFaxStatus']['bind'](this));ami['on'](_0x3cc1('0x1a'),this['syncReceiveFax']['bind'](this));ami['on'](_0x3cc1('0x1b'),this[_0x3cc1('0x1c')]['bind'](this));ami['on']('originateresponse',this[_0x3cc1('0x1d')]['bind'](this));}Fax[_0x3cc1('0x1e')]['syncNewchannel']=function(_0x317469){if(_0x317469['context']==='from-voip-provider'){for(var _0xcbf9e1 in this[_0x3cc1('0xe')]){if(this[_0x3cc1('0xe')][_0x3cc1('0x1f')](_0xcbf9e1)){if(_0x317469[_0x3cc1('0x20')]===this[_0x3cc1('0xe')][_0xcbf9e1][_0x3cc1('0x21')]){this[_0x3cc1('0xd')][_0x317469['uniqueid']]={};this['channels'][_0x317469[_0x3cc1('0x22')]][_0x3cc1('0x23')]=_0x317469[_0x3cc1('0x23')];this[_0x3cc1('0xd')][_0x317469[_0x3cc1('0x22')]]['id']=this[_0x3cc1('0xe')][_0xcbf9e1]['id'];this[_0x3cc1('0xd')][_0x317469['uniqueid']][_0x3cc1('0x24')]=this[_0x3cc1('0xe')][_0xcbf9e1]['name'];logger[_0x3cc1('0x25')](_0x317469[_0x3cc1('0x22')],'\x20syncNewchannel\x20');}}}}if(this[_0x3cc1('0x10')][_0x317469['uniqueid']]){this[_0x3cc1('0xd')][_0x317469[_0x3cc1('0x22')]]={};this['channels'][_0x317469[_0x3cc1('0x22')]][_0x3cc1('0x23')]=_0x317469[_0x3cc1('0x23')];logger[_0x3cc1('0x25')](_0x317469[_0x3cc1('0x22')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0x3cc1('0x14')]=function(_0x57471a){if(this['channels'][_0x57471a[_0x3cc1('0x22')]]){for(var _0x5bd7b7 in _0x57471a[_0x3cc1('0x26')]){if(_0x57471a[_0x3cc1('0x26')]['hasOwnProperty'](_0x5bd7b7)){this['channels'][_0x57471a[_0x3cc1('0x22')]][_0x5bd7b7]=_0x57471a[_0x3cc1('0x27')];}}}};Fax[_0x3cc1('0x1e')][_0x3cc1('0x15')]=function(_0x267308){if(this[_0x3cc1('0xd')][_0x267308[_0x3cc1('0x22')]]){this[_0x3cc1('0xd')][_0x267308['uniqueid']][_0x3cc1('0x28')]=_0x267308[_0x3cc1('0x28')];this[_0x3cc1('0xd')][_0x267308[_0x3cc1('0x22')]][_0x3cc1('0x29')]=_0x267308[_0x3cc1('0x29')];}};Fax[_0x3cc1('0x1e')]['syncNewExten']=function(_0x519285){if(this[_0x3cc1('0xd')][_0x519285[_0x3cc1('0x22')]]){for(var _0xb7556d in _0x519285[_0x3cc1('0x26')]){if(_0x519285[_0x3cc1('0x26')][_0x3cc1('0x1f')](_0xb7556d)){this['channels'][_0x519285['uniqueid']][_0xb7556d]=_0x519285[_0x3cc1('0x27')];}}}};Fax[_0x3cc1('0x1e')]['syncFaxStatus']=function(_0x199ede){if(this[_0x3cc1('0xd')][_0x199ede[_0x3cc1('0x22')]]){this['channels'][_0x199ede['uniqueid']][_0x3cc1('0x2a')]=_0x199ede[_0x3cc1('0x2a')];this[_0x3cc1('0xd')][_0x199ede[_0x3cc1('0x22')]][_0x3cc1('0x2b')]=_0x199ede[_0x3cc1('0x2b')];this[_0x3cc1('0xd')][_0x199ede['uniqueid']][_0x3cc1('0x21')]=_0x199ede['localstationid'];this[_0x3cc1('0xd')][_0x199ede[_0x3cc1('0x22')]][_0x3cc1('0x2c')]=_0x199ede[_0x3cc1('0x2c')];logger[_0x3cc1('0x25')](_0x199ede[_0x3cc1('0x22')],_0x3cc1('0x2d'));}};Fax[_0x3cc1('0x1e')][_0x3cc1('0x2e')]=function(_0x21df50){var _0x5a39ee=this;if(this[_0x3cc1('0xd')][_0x21df50[_0x3cc1('0x22')]]){var _0x5a8d9f=this[_0x3cc1('0xd')][_0x21df50['uniqueid']]['id'];this[_0x3cc1('0xd')][_0x21df50[_0x3cc1('0x22')]][_0x3cc1('0x2f')]=_0x21df50['remotestationid'];this[_0x3cc1('0xd')][_0x21df50['uniqueid']][_0x3cc1('0x30')]=_0x21df50[_0x3cc1('0x30')];this[_0x3cc1('0xd')][_0x21df50[_0x3cc1('0x22')]]['localstationid']=_0x21df50[_0x3cc1('0x21')];this[_0x3cc1('0xd')][_0x21df50['uniqueid']][_0x3cc1('0x31')]=_0x21df50[_0x3cc1('0x31')];this[_0x3cc1('0xd')][_0x21df50[_0x3cc1('0x22')]][_0x3cc1('0x32')]=_0x21df50['transferrate'];this['channels'][_0x21df50[_0x3cc1('0x22')]]['filename']=_0x21df50[_0x3cc1('0x2c')];this['channels'][_0x21df50['uniqueid']][_0x3cc1('0x33')]=_0x21df50[_0x3cc1('0x33')];if(this[_0x3cc1('0xd')][_0x21df50['uniqueid']][_0x3cc1('0x30')]>0x0){tiff2pdf(_0x21df50[_0x3cc1('0x2c')],_0x3cc1('0x34'),function(_0x22c621){logger['info'](_0x21df50['uniqueid'],_0x3cc1('0x35'),_0x22c621['message']);attachment[_0x3cc1('0x36')]({'name':path[_0x3cc1('0x37')](_0x21df50[_0x3cc1('0x2c')])['name'],'basename':path['parse'](_0x21df50[_0x3cc1('0x2c')])[_0x3cc1('0x24')]+_0x3cc1('0x38'),'type':_0x3cc1('0x39')})[_0x3cc1('0x3a')](function(_0x50b2d5){faxAccount[_0x3cc1('0x3b')](_0x5a8d9f,{'from':_0x21df50['calleridnum'],'mapKey':_0x3cc1('0x6'),'body':path['parse'](_0x21df50[_0x3cc1('0x2c')])[_0x3cc1('0x24')]+_0x3cc1('0x38'),'AttachmentId':_0x50b2d5['id']})[_0x3cc1('0x3c')](function(_0x4ab0b1){logger[_0x3cc1('0x3d')](_0x21df50[_0x3cc1('0x22')],_0x3cc1('0x3e'),JSON[_0x3cc1('0x3f')](_0x4ab0b1));});})[_0x3cc1('0x3c')](function(_0x109eba){logger[_0x3cc1('0x3d')](_0x21df50[_0x3cc1('0x22')],'\x20receiveFax\x20',JSON[_0x3cc1('0x3f')](_0x109eba));});});}logger[_0x3cc1('0x25')](_0x21df50['uniqueid'],_0x3cc1('0x40'));}};Fax[_0x3cc1('0x1e')]['syncOriginateResponse']=function(_0x321e42){if(this[_0x3cc1('0x10')][_0x321e42[_0x3cc1('0x22')]]){_[_0x3cc1('0x41')](this[_0x3cc1('0xd')][_0x321e42[_0x3cc1('0x22')]],_[_0x3cc1('0x42')](_0x321e42,[_0x3cc1('0x43'),_0x3cc1('0x44')]));}};function updateStatus(_0xb1b119){if(_0xb1b119[_0x3cc1('0x45')]){faxMessage[_0x3cc1('0x46')](_0xb1b119[_0x3cc1('0x45')],{'failMessage':_0x3cc1('0x47')})[_0x3cc1('0x3a')](function(_0x18918d){ut[_0x3cc1('0x48')](_0x3cc1('0x49'),_0x18918d);})[_0x3cc1('0x3c')](function(_0x163ac5){ut[_0x3cc1('0x48')](_0x3cc1('0x4a'),_0x163ac5);});}else{ut[_0x3cc1('0x48')](_0x3cc1('0x4b'));}}Fax[_0x3cc1('0x1e')]['updateStatus']=function(_0x3f3b21,_0x492330,_0x4dd482){var _0x3f7402=this;var _0x4cd58f={};if(_0x492330){_0x4cd58f={'read':_0x492330};}else{_0x4cd58f={'failMessage':_0x4dd482};}if(this[_0x3cc1('0x10')][_0x3f3b21][_0x3cc1('0x45')]){faxMessage['update'](this[_0x3cc1('0x10')][_0x3f3b21]['AttachmentId'],_0x4cd58f)[_0x3cc1('0x3a')](function(_0x28c2d3){ut[_0x3cc1('0x48')](_0x3cc1('0x4c'),_0x28c2d3);})[_0x3cc1('0x3c')](function(_0x45ccd0){ut['logger']('[Fax][Message][NoUpdate1]',_0x45ccd0);})['finally'](function(){delete _0x3f7402[_0x3cc1('0xd')][_0x3f3b21];delete _0x3f7402['actions'][_0x3f3b21];});}else{ut['logger'](_0x3cc1('0x4d'));delete this[_0x3cc1('0xd')][_0x3f3b21];delete this[_0x3cc1('0x10')][_0x3f3b21];}};Fax['prototype'][_0x3cc1('0x1c')]=function(_0x3cf06d){var _0x467c39=this;if(this[_0x3cc1('0xd')][_0x3cf06d[_0x3cc1('0x22')]]){if(this[_0x3cc1('0x10')][_0x3cf06d[_0x3cc1('0x22')]]){this['channels'][_0x3cf06d[_0x3cc1('0x22')]]['id']=this[_0x3cc1('0x10')][_0x3cf06d[_0x3cc1('0x22')]]['id'];this[_0x3cc1('0xd')][_0x3cf06d[_0x3cc1('0x22')]]['name']=this[_0x3cc1('0x10')][_0x3cf06d[_0x3cc1('0x22')]][_0x3cc1('0x24')];}logger[_0x3cc1('0x25')](_0x3cf06d[_0x3cc1('0x22')],this[_0x3cc1('0x10')][_0x3cf06d[_0x3cc1('0x22')]]?'\x20hangup\x20sendFile\x20':_0x3cc1('0x4e'),JSON[_0x3cc1('0x3f')](this['channels'][_0x3cf06d[_0x3cc1('0x22')]]));if(this[_0x3cc1('0x10')][_0x3cf06d[_0x3cc1('0x22')]]){if(this[_0x3cc1('0xd')][_0x3cf06d[_0x3cc1('0x22')]][_0x3cc1('0x4f')]>0x0&&this[_0x3cc1('0xd')][_0x3cf06d['uniqueid']]['faxstatus']==='SUCCESS'){this[_0x3cc1('0x50')](_0x3cf06d[_0x3cc1('0x22')],!![]);}else{this[_0x3cc1('0x50')](_0x3cf06d[_0x3cc1('0x22')],![],this[_0x3cc1('0xd')][_0x3cf06d[_0x3cc1('0x22')]][_0x3cc1('0x51')]?_0x3cc1('0x52')+this[_0x3cc1('0xd')][_0x3cf06d[_0x3cc1('0x22')]]['faxstatusstring']:_0x3cc1('0x53'));}}}};Fax[_0x3cc1('0x1e')]['send']=function(_0x7bf8a7){var _0x1c510b=this;return new BPromise(function(_0x3dfd24,_0x357750){_0x1c510b[_0x3cc1('0x54')](_0x7bf8a7,_0x1c510b[_0x3cc1('0xe')][_0x7bf8a7['FaxAccountId']])['then'](function(_0x30b5ad){ut[_0x3cc1('0x48')]('[Fax][execOriginate][success]',_0x30b5ad);_0x3dfd24(ut[_0x3cc1('0x55')](_0x3cc1('0x56')));})[_0x3cc1('0x3c')](function(_0x3cacd2){ut[_0x3cc1('0x48')](_0x3cc1('0x57'),_0x3cacd2);updateStatus(_0x7bf8a7);_0x357750(ut[_0x3cc1('0x55')](_0x3cc1('0x58')));});});};Fax[_0x3cc1('0x1e')][_0x3cc1('0x59')]=function(_0x507651){var _0x4a320b=this;return new BPromise(function(_0x5c5e8d,_0x52b800){var _0x2adac7=_0x4a320b['checkTrunk'](_0x4a320b[_0x3cc1('0xe')][_0x507651['FaxAccountId']][_0x3cc1('0x5a')],_0x507651);if(_0x2adac7[_0x3cc1('0x5b')]){_0x5c5e8d(ut['message'](_0x3cc1('0x5c')));}else{_0x52b800(ut[_0x3cc1('0x55')](_0x2adac7[_0x3cc1('0x55')]));}});};function originate(_0x31b687,_0x87d691,_0x368bc3){return new BPromise(function(_0xb48d90,_0x3c728c){if(_0x368bc3){var _0x3d7e21=util['format'](_0x3cc1('0x5d'),path['parse'](_0x31b687['path'])[_0x3cc1('0x24')],_0x31b687[_0x3cc1('0x3')]);gs[_0x3cc1('0x5e')](_0x3d7e21)['then'](function(){_0x31b687['path']=util[_0x3cc1('0x5f')]('%s/%s.tif',path[_0x3cc1('0x37')](_0x31b687['path'])[_0x3cc1('0x60')],path[_0x3cc1('0x37')](_0x31b687[_0x3cc1('0x3')])['name']);_0x87d691[_0x3cc1('0x61')]=_0x31b687['path'];ut[_0x3cc1('0x48')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut[_0x3cc1('0x62')](_0x31b687,_0x87d691))[_0x3cc1('0x3a')](function(_0x5994e1){_0xb48d90(_0x5994e1);})[_0x3cc1('0x3c')](function(_0x3f2de4){_0x3c728c(_0x3f2de4);});})[_0x3cc1('0x3c')](function(_0x45bb68){_0x3c728c(_0x45bb68);});}else{ami[_0x3cc1('0x63')](ut[_0x3cc1('0x62')](_0x31b687,_0x87d691))[_0x3cc1('0x3a')](function(_0x2524f9){_0xb48d90(_0x2524f9);})[_0x3cc1('0x3c')](function(_0x2eda71){_0x3c728c(_0x2eda71);});}});}Fax[_0x3cc1('0x1e')]['execOriginate']=function(_0x1f4c3b,_0x3f4b76){var _0x3ad507=this;return new BPromise(function(_0x40548c,_0x907f86){var _0x98046f=uuid['v4']();var _0x4e5e94=ut[_0x3cc1('0x64')](_0x1f4c3b,_0x3f4b76);_0x3ad507[_0x3cc1('0x10')][_0x98046f]=new Action(_0x98046f,_0x3f4b76,_0x1f4c3b);var _0x3aea9a=_0x3ad507[_0x3cc1('0x10')][_0x98046f];if(path[_0x3cc1('0x37')](_0x1f4c3b[_0x3cc1('0x3')])[_0x3cc1('0x65')]==='.pdf'){originate(_0x3aea9a,_0x4e5e94,!![])[_0x3cc1('0x3a')](function(_0x42b5af){_0x40548c(_0x42b5af);})[_0x3cc1('0x3c')](function(_0x5cc3dd){_0x907f86(_0x5cc3dd);});}else{originate(_0x3aea9a,_0x4e5e94,![])['then'](function(_0x743364){_0x40548c(_0x743364);})['catch'](function(_0x4a4e37){_0x907f86(_0x4a4e37);});}});};Fax['prototype'][_0x3cc1('0x66')]=function(_0x2609ba){return!_[_0x3cc1('0x67')](_0x2609ba)&&!_['isNil'](_0x2609ba[_0x3cc1('0x24')])&&!_[_0x3cc1('0x67')](_0x2609ba[_0x3cc1('0x68')])&&_0x2609ba[_0x3cc1('0x68')]&&!_[_0x3cc1('0x67')](this[_0x3cc1('0xf')][util[_0x3cc1('0x5f')](_0x3cc1('0x69'),_0x2609ba['name'])])&&!_[_0x3cc1('0x67')](this['trunks'][util[_0x3cc1('0x5f')](_0x3cc1('0x69'),_0x2609ba['name'])][_0x3cc1('0x2b')])&&(this['trunks'][util[_0x3cc1('0x5f')]('SIP/%s',_0x2609ba[_0x3cc1('0x24')])][_0x3cc1('0x2b')]===_0x3cc1('0x6a')||this['trunks'][util[_0x3cc1('0x5f')](_0x3cc1('0x69'),_0x2609ba['name'])]['status']==='unmonitored');};Fax[_0x3cc1('0x1e')][_0x3cc1('0x6b')]=function(_0x3639f4,_0x52d49e){if(!this['isTrunkReachable'](_0x3639f4)){ut['logger'](_0x3cc1('0x6c'),_[_0x3cc1('0x67')](_0x3639f4)?'':_0x3639f4[_0x3cc1('0x24')]+_0x3cc1('0x6d'));return{'isValid':![],'message':_0x3cc1('0x6e')};}if(_[_0x3cc1('0x67')](_0x52d49e[_0x3cc1('0x6')])){ut['logger'](_0x3cc1('0x6f'),JSON[_0x3cc1('0x3f')](_0x52d49e));return{'isValid':![],'message':_0x3cc1('0x70')};}if(_[_0x3cc1('0x67')](_0x52d49e[_0x3cc1('0x3')])){ut[_0x3cc1('0x48')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x3cc1('0x3f')](_0x52d49e));return{'isValid':![],'message':_0x3cc1('0x71')};}return{'isValid':!![],'message':_0x3cc1('0x72')};};module[_0x3cc1('0x73')]=Fax; \ No newline at end of file +var _0x9d8d=['format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','error','stringify','\x20receiveFax\x20','syncOriginateResponse','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','catch','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x9d8d,0x8e));var _0xd9d8=function(_0xae65e1,_0x3f9f94){_0xae65e1=_0xae65e1-0x0;var _0x291c5e=_0x9d8d[_0xae65e1];return _0x291c5e;};'use strict';var util=require('util');var _=require(_0xd9d8('0x0'));var BPromise=require(_0xd9d8('0x1'));var uuid=require(_0xd9d8('0x2'));var moment=require(_0xd9d8('0x3'));var path=require(_0xd9d8('0x4'));var tiff2pdf=require(_0xd9d8('0x5'));var gs=require(_0xd9d8('0x6'));var logger=require(_0xd9d8('0x7'))(_0xd9d8('0x8'));var ami=require(_0xd9d8('0x9'));var rpcDb=require(_0xd9d8('0xa'));var Channel=require(_0xd9d8('0xb'));var ut=require(_0xd9d8('0xc'));var Action=require(_0xd9d8('0xd'));var faxAccount=require(_0xd9d8('0xe'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x4f7d11){this[_0xd9d8('0xf')]={};this['faxAccounts']=_0x4f7d11[_0xd9d8('0x10')];this[_0xd9d8('0x11')]=_0x4f7d11[_0xd9d8('0x11')];this[_0xd9d8('0x12')]={};ami['on'](_0xd9d8('0x13'),this[_0xd9d8('0x14')]['bind'](this));ami['on'](_0xd9d8('0x15'),this[_0xd9d8('0x16')][_0xd9d8('0x17')](this));ami['on']('newstate',this[_0xd9d8('0x18')][_0xd9d8('0x17')](this));ami['on'](_0xd9d8('0x19'),this[_0xd9d8('0x1a')][_0xd9d8('0x17')](this));ami['on'](_0xd9d8('0x1b'),this['syncFaxStatus']['bind'](this));ami['on'](_0xd9d8('0x1c'),this[_0xd9d8('0x1d')][_0xd9d8('0x17')](this));ami['on'](_0xd9d8('0x1e'),this[_0xd9d8('0x1f')][_0xd9d8('0x17')](this));ami['on'](_0xd9d8('0x20'),this['syncOriginateResponse'][_0xd9d8('0x17')](this));}Fax['prototype'][_0xd9d8('0x14')]=function(_0x3e670b){if(_0x3e670b[_0xd9d8('0x21')]===_0xd9d8('0x22')){for(var _0xc1d253 in this[_0xd9d8('0x10')]){if(this['faxAccounts'][_0xd9d8('0x23')](_0xc1d253)){if(_0x3e670b[_0xd9d8('0x24')]===this[_0xd9d8('0x10')][_0xc1d253][_0xd9d8('0x25')]){this[_0xd9d8('0xf')][_0x3e670b[_0xd9d8('0x26')]]={};this[_0xd9d8('0xf')][_0x3e670b['uniqueid']][_0xd9d8('0x27')]=_0x3e670b[_0xd9d8('0x27')];this[_0xd9d8('0xf')][_0x3e670b['uniqueid']]['id']=this['faxAccounts'][_0xc1d253]['id'];this[_0xd9d8('0xf')][_0x3e670b[_0xd9d8('0x26')]][_0xd9d8('0x28')]=this[_0xd9d8('0x10')][_0xc1d253]['name'];logger[_0xd9d8('0x29')](_0x3e670b[_0xd9d8('0x26')],_0xd9d8('0x2a'));}}}}if(this['actions'][_0x3e670b[_0xd9d8('0x26')]]){this[_0xd9d8('0xf')][_0x3e670b[_0xd9d8('0x26')]]={};this[_0xd9d8('0xf')][_0x3e670b[_0xd9d8('0x26')]][_0xd9d8('0x27')]=_0x3e670b['channel'];logger['info'](_0x3e670b[_0xd9d8('0x26')],_0xd9d8('0x2a'));}};Fax[_0xd9d8('0x2b')][_0xd9d8('0x16')]=function(_0xb4bf33){if(this['channels'][_0xb4bf33[_0xd9d8('0x26')]]){for(var _0x4428cc in _0xb4bf33[_0xd9d8('0x2c')]){if(_0xb4bf33['variable'][_0xd9d8('0x23')](_0x4428cc)){this[_0xd9d8('0xf')][_0xb4bf33[_0xd9d8('0x26')]][_0x4428cc]=_0xb4bf33[_0xd9d8('0x2d')];}}}};Fax[_0xd9d8('0x2b')][_0xd9d8('0x18')]=function(_0x3f8dbd){if(this['channels'][_0x3f8dbd[_0xd9d8('0x26')]]){this[_0xd9d8('0xf')][_0x3f8dbd[_0xd9d8('0x26')]][_0xd9d8('0x2e')]=_0x3f8dbd['channelstate'];this[_0xd9d8('0xf')][_0x3f8dbd[_0xd9d8('0x26')]][_0xd9d8('0x2f')]=_0x3f8dbd['channelstatedesc'];}};Fax[_0xd9d8('0x2b')][_0xd9d8('0x1a')]=function(_0x31bb8d){if(this['channels'][_0x31bb8d[_0xd9d8('0x26')]]){for(var _0x40c8b7 in _0x31bb8d[_0xd9d8('0x2c')]){if(_0x31bb8d['variable'][_0xd9d8('0x23')](_0x40c8b7)){this[_0xd9d8('0xf')][_0x31bb8d['uniqueid']][_0x40c8b7]=_0x31bb8d[_0xd9d8('0x2d')];}}}};Fax[_0xd9d8('0x2b')][_0xd9d8('0x30')]=function(_0x59225f){if(this[_0xd9d8('0xf')][_0x59225f['uniqueid']]){this[_0xd9d8('0xf')][_0x59225f['uniqueid']]['operation']=_0x59225f[_0xd9d8('0x31')];this[_0xd9d8('0xf')][_0x59225f[_0xd9d8('0x26')]][_0xd9d8('0x32')]=_0x59225f['status'];this[_0xd9d8('0xf')][_0x59225f['uniqueid']][_0xd9d8('0x25')]=_0x59225f[_0xd9d8('0x25')];this[_0xd9d8('0xf')][_0x59225f[_0xd9d8('0x26')]][_0xd9d8('0x33')]=_0x59225f[_0xd9d8('0x33')];logger[_0xd9d8('0x29')](_0x59225f['uniqueid'],_0xd9d8('0x34'));}};Fax[_0xd9d8('0x2b')][_0xd9d8('0x1d')]=function(_0x2a3526){var _0x5cf975=this;if(this['channels'][_0x2a3526[_0xd9d8('0x26')]]){var _0x238f1f=this[_0xd9d8('0xf')][_0x2a3526[_0xd9d8('0x26')]]['id'];this[_0xd9d8('0xf')][_0x2a3526[_0xd9d8('0x26')]][_0xd9d8('0x35')]=_0x2a3526[_0xd9d8('0x35')];this['channels'][_0x2a3526[_0xd9d8('0x26')]][_0xd9d8('0x36')]=_0x2a3526[_0xd9d8('0x36')];this[_0xd9d8('0xf')][_0x2a3526[_0xd9d8('0x26')]][_0xd9d8('0x25')]=_0x2a3526['localstationid'];this[_0xd9d8('0xf')][_0x2a3526[_0xd9d8('0x26')]]['resolution']=_0x2a3526[_0xd9d8('0x37')];this[_0xd9d8('0xf')][_0x2a3526['uniqueid']][_0xd9d8('0x38')]=_0x2a3526[_0xd9d8('0x38')];this[_0xd9d8('0xf')][_0x2a3526[_0xd9d8('0x26')]]['filename']=_0x2a3526[_0xd9d8('0x33')];this['channels'][_0x2a3526[_0xd9d8('0x26')]][_0xd9d8('0x39')]=_0x2a3526[_0xd9d8('0x39')];if(this[_0xd9d8('0xf')][_0x2a3526[_0xd9d8('0x26')]][_0xd9d8('0x36')]>0x0){tiff2pdf(_0x2a3526[_0xd9d8('0x33')],'/var/opt/motion2/server/files/attachments/',function(_0x1a0885){logger['info'](_0x2a3526[_0xd9d8('0x26')],_0xd9d8('0x3a'),_0x1a0885[_0xd9d8('0x3b')]);attachment[_0xd9d8('0x3c')]({'name':path[_0xd9d8('0x3d')](_0x2a3526['filename'])[_0xd9d8('0x28')],'basename':path[_0xd9d8('0x3d')](_0x2a3526[_0xd9d8('0x33')])[_0xd9d8('0x28')]+_0xd9d8('0x3e'),'type':_0xd9d8('0x3f')})[_0xd9d8('0x40')](function(_0x48f8e6){faxAccount[_0xd9d8('0x41')](_0x238f1f,{'from':_0x2a3526['calleridnum'],'mapKey':'fax','body':path[_0xd9d8('0x3d')](_0x2a3526[_0xd9d8('0x33')])[_0xd9d8('0x28')]+_0xd9d8('0x3e'),'AttachmentId':_0x48f8e6['id']})['catch'](function(_0x268787){logger[_0xd9d8('0x42')](_0x2a3526[_0xd9d8('0x26')],'\x20notify\x20',JSON['stringify'](_0x268787));});})['catch'](function(_0x154822){logger['error'](_0x2a3526['uniqueid'],'\x20receiveFax\x20',JSON[_0xd9d8('0x43')](_0x154822));});});}logger[_0xd9d8('0x29')](_0x2a3526[_0xd9d8('0x26')],_0xd9d8('0x44'));}};Fax[_0xd9d8('0x2b')][_0xd9d8('0x45')]=function(_0x6fb82b){if(this[_0xd9d8('0x12')][_0x6fb82b['uniqueid']]){_['merge'](this['channels'][_0x6fb82b[_0xd9d8('0x26')]],_[_0xd9d8('0x46')](_0x6fb82b,[_0xd9d8('0x47'),_0xd9d8('0x48')]));}};function updateStatus(_0x3db487){if(_0x3db487[_0xd9d8('0x49')]){faxMessage[_0xd9d8('0x4a')](_0x3db487[_0xd9d8('0x49')],{'failMessage':_0xd9d8('0x4b')})[_0xd9d8('0x40')](function(_0xd46226){ut[_0xd9d8('0x4c')](_0xd9d8('0x4d'),_0xd46226);})[_0xd9d8('0x4e')](function(_0xa8f9cb){ut[_0xd9d8('0x4c')](_0xd9d8('0x4f'),_0xa8f9cb);});}else{ut[_0xd9d8('0x4c')](_0xd9d8('0x50'));}}Fax[_0xd9d8('0x2b')][_0xd9d8('0x51')]=function(_0x329af7,_0x33f776,_0x467f20){var _0x4b8898=this;var _0x1345fb={};if(_0x33f776){_0x1345fb={'read':_0x33f776};}else{_0x1345fb={'failMessage':_0x467f20};}if(this[_0xd9d8('0x12')][_0x329af7][_0xd9d8('0x49')]){faxMessage[_0xd9d8('0x4a')](this[_0xd9d8('0x12')][_0x329af7][_0xd9d8('0x49')],_0x1345fb)[_0xd9d8('0x40')](function(_0x196b9e){ut[_0xd9d8('0x4c')](_0xd9d8('0x52'),_0x196b9e);})[_0xd9d8('0x4e')](function(_0x5abc03){ut['logger'](_0xd9d8('0x53'),_0x5abc03);})[_0xd9d8('0x54')](function(){delete _0x4b8898[_0xd9d8('0xf')][_0x329af7];delete _0x4b8898['actions'][_0x329af7];});}else{ut[_0xd9d8('0x4c')](_0xd9d8('0x55'));delete this[_0xd9d8('0xf')][_0x329af7];delete this['actions'][_0x329af7];}};Fax[_0xd9d8('0x2b')]['syncHangup']=function(_0x503b13){var _0xd38d73=this;if(this[_0xd9d8('0xf')][_0x503b13[_0xd9d8('0x26')]]){if(this[_0xd9d8('0x12')][_0x503b13[_0xd9d8('0x26')]]){this[_0xd9d8('0xf')][_0x503b13['uniqueid']]['id']=this[_0xd9d8('0x12')][_0x503b13[_0xd9d8('0x26')]]['id'];this[_0xd9d8('0xf')][_0x503b13[_0xd9d8('0x26')]][_0xd9d8('0x28')]=this[_0xd9d8('0x12')][_0x503b13[_0xd9d8('0x26')]][_0xd9d8('0x28')];}logger[_0xd9d8('0x29')](_0x503b13['uniqueid'],this['actions'][_0x503b13[_0xd9d8('0x26')]]?_0xd9d8('0x56'):_0xd9d8('0x57'),JSON[_0xd9d8('0x43')](this[_0xd9d8('0xf')][_0x503b13[_0xd9d8('0x26')]]));if(this[_0xd9d8('0x12')][_0x503b13[_0xd9d8('0x26')]]){if(this[_0xd9d8('0xf')][_0x503b13[_0xd9d8('0x26')]][_0xd9d8('0x58')]>0x0&&this[_0xd9d8('0xf')][_0x503b13[_0xd9d8('0x26')]][_0xd9d8('0x1b')]===_0xd9d8('0x59')){this[_0xd9d8('0x51')](_0x503b13[_0xd9d8('0x26')],!![]);}else{this['updateStatus'](_0x503b13[_0xd9d8('0x26')],![],this['channels'][_0x503b13['uniqueid']][_0xd9d8('0x5a')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x503b13[_0xd9d8('0x26')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax['prototype']['send']=function(_0x4f006a){var _0x40f6ef=this;return new BPromise(function(_0x1cb335,_0x13ab30){_0x40f6ef[_0xd9d8('0x5b')](_0x4f006a,_0x40f6ef[_0xd9d8('0x10')][_0x4f006a[_0xd9d8('0x5c')]])[_0xd9d8('0x40')](function(_0x52980d){ut[_0xd9d8('0x4c')](_0xd9d8('0x5d'),_0x52980d);_0x1cb335(ut['message'](_0xd9d8('0x5e')));})['catch'](function(_0x3e7b30){ut['logger'](_0xd9d8('0x5f'),_0x3e7b30);updateStatus(_0x4f006a);_0x13ab30(ut[_0xd9d8('0x3b')](_0xd9d8('0x60')));});});};Fax[_0xd9d8('0x2b')][_0xd9d8('0x61')]=function(_0x4a01a8){var _0x23e415=this;return new BPromise(function(_0x4b6b65,_0x17a798){var _0xadb884=_0x23e415[_0xd9d8('0x62')](_0x23e415['faxAccounts'][_0x4a01a8[_0xd9d8('0x5c')]][_0xd9d8('0x63')],_0x4a01a8);if(_0xadb884[_0xd9d8('0x64')]){_0x4b6b65(ut[_0xd9d8('0x3b')](_0xd9d8('0x65')));}else{_0x17a798(ut[_0xd9d8('0x3b')](_0xadb884[_0xd9d8('0x3b')]));}});};function originate(_0x429971,_0x312953,_0x43a60b){return new BPromise(function(_0x297dd3,_0x1c86e1){if(_0x43a60b){var _0xc3219e=util[_0xd9d8('0x66')](_0xd9d8('0x67'),path[_0xd9d8('0x3d')](_0x429971['path'])['name'],_0x429971[_0xd9d8('0x4')]);gs[_0xd9d8('0x68')](_0xc3219e)[_0xd9d8('0x40')](function(){_0x429971[_0xd9d8('0x4')]=util[_0xd9d8('0x66')](_0xd9d8('0x69'),path[_0xd9d8('0x3d')](_0x429971[_0xd9d8('0x4')])['dir'],path['parse'](_0x429971[_0xd9d8('0x4')])[_0xd9d8('0x28')]);_0x312953[_0xd9d8('0x6a')]=_0x429971[_0xd9d8('0x4')];ut[_0xd9d8('0x4c')](_0xd9d8('0x6b'),'');ami[_0xd9d8('0x6c')](ut[_0xd9d8('0x6d')](_0x429971,_0x312953))['then'](function(_0x4fc56a){_0x297dd3(_0x4fc56a);})[_0xd9d8('0x4e')](function(_0x3003ef){_0x1c86e1(_0x3003ef);});})['catch'](function(_0x967afe){_0x1c86e1(_0x967afe);});}else{ami[_0xd9d8('0x6c')](ut[_0xd9d8('0x6d')](_0x429971,_0x312953))[_0xd9d8('0x40')](function(_0x1a6d56){_0x297dd3(_0x1a6d56);})[_0xd9d8('0x4e')](function(_0x29f6e3){_0x1c86e1(_0x29f6e3);});}});}Fax[_0xd9d8('0x2b')]['execOriginate']=function(_0x5aaec3,_0x2544d8){var _0x1fb1ea=this;return new BPromise(function(_0x412ac4,_0x130369){var _0x4ecde8=uuid['v4']();var _0x8721aa=ut[_0xd9d8('0x6e')](_0x5aaec3,_0x2544d8);_0x1fb1ea[_0xd9d8('0x12')][_0x4ecde8]=new Action(_0x4ecde8,_0x2544d8,_0x5aaec3);var _0x185544=_0x1fb1ea[_0xd9d8('0x12')][_0x4ecde8];if(path['parse'](_0x5aaec3[_0xd9d8('0x4')])['ext']===_0xd9d8('0x3e')){originate(_0x185544,_0x8721aa,!![])[_0xd9d8('0x40')](function(_0x5aeca6){_0x412ac4(_0x5aeca6);})[_0xd9d8('0x4e')](function(_0x4e10cc){_0x130369(_0x4e10cc);});}else{originate(_0x185544,_0x8721aa,![])[_0xd9d8('0x40')](function(_0x1af5b5){_0x412ac4(_0x1af5b5);})['catch'](function(_0x4a2ce4){_0x130369(_0x4a2ce4);});}});};Fax[_0xd9d8('0x2b')][_0xd9d8('0x6f')]=function(_0x1afc55){return!_[_0xd9d8('0x70')](_0x1afc55)&&!_[_0xd9d8('0x70')](_0x1afc55[_0xd9d8('0x28')])&&!_['isNil'](_0x1afc55['active'])&&_0x1afc55[_0xd9d8('0x71')]&&!_[_0xd9d8('0x70')](this[_0xd9d8('0x11')][util[_0xd9d8('0x66')](_0xd9d8('0x72'),_0x1afc55[_0xd9d8('0x28')])])&&!_[_0xd9d8('0x70')](this[_0xd9d8('0x11')][util['format'](_0xd9d8('0x72'),_0x1afc55[_0xd9d8('0x28')])][_0xd9d8('0x32')])&&(this[_0xd9d8('0x11')][util[_0xd9d8('0x66')](_0xd9d8('0x72'),_0x1afc55[_0xd9d8('0x28')])][_0xd9d8('0x32')]===_0xd9d8('0x73')||this[_0xd9d8('0x11')][util['format']('SIP/%s',_0x1afc55[_0xd9d8('0x28')])][_0xd9d8('0x32')]===_0xd9d8('0x74'));};Fax[_0xd9d8('0x2b')][_0xd9d8('0x62')]=function(_0x4437ce,_0x3be8f4){if(!this[_0xd9d8('0x6f')](_0x4437ce)){ut[_0xd9d8('0x4c')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0xd9d8('0x70')](_0x4437ce)?'':_0x4437ce[_0xd9d8('0x28')]+_0xd9d8('0x75'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xd9d8('0x70')](_0x3be8f4['fax'])){ut[_0xd9d8('0x4c')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xd9d8('0x43')](_0x3be8f4));return{'isValid':![],'message':_0xd9d8('0x76')};}if(_['isNil'](_0x3be8f4[_0xd9d8('0x4')])){ut[_0xd9d8('0x4c')](_0xd9d8('0x77'),JSON[_0xd9d8('0x43')](_0x3be8f4));return{'isValid':![],'message':_0xd9d8('0x78')};}return{'isValid':!![],'message':_0xd9d8('0x79')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index a06f28f..bf676a3 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 _0xc263=['preview','lodash','../rpc/faxAccount','error','resolve','then','notify','catch','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x41de92,_0x4ee8b6){var _0xaa1224=function(_0x47206f){while(--_0x47206f){_0x41de92['push'](_0x41de92['shift']());}};_0xaa1224(++_0x4ee8b6);}(_0xc263,0x81));var _0x3c26=function(_0x451ef0,_0x3c5d06){_0x451ef0=_0x451ef0-0x0;var _0x302f88=_0xc263[_0x451ef0];return _0x302f88;};'use strict';var util=require(_0x3c26('0x0'));var BPromise=require(_0x3c26('0x1'));var logger=require(_0x3c26('0x2'))(_0x3c26('0x3'));var _=require(_0x3c26('0x4'));var faxAccount=require(_0x3c26('0x5'));function loggerCatch(_0x2b5bd4){return function(_0x1d8e7e){logger[_0x3c26('0x6')](_0x2b5bd4,util['inspect'](_0x1d8e7e,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x53ee5c,_0x5b849d){return BPromise[_0x3c26('0x7')]()[_0x3c26('0x8')](faxAccount[_0x3c26('0x9')](_0x53ee5c,_0x5b849d))[_0x3c26('0xa')](loggerCatch(_0x3c26('0xb')));}; \ No newline at end of file +var _0x85b2=['resolve','catch','[Notify]\x20','util','bluebird','preview','lodash','../rpc/faxAccount','error','notify'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0x85b2,0x161));var _0x285b=function(_0x41716c,_0x222315){_0x41716c=_0x41716c-0x0;var _0x20f724=_0x85b2[_0x41716c];return _0x20f724;};'use strict';var util=require(_0x285b('0x0'));var BPromise=require(_0x285b('0x1'));var logger=require('../../../config/logger')(_0x285b('0x2'));var _=require(_0x285b('0x3'));var faxAccount=require(_0x285b('0x4'));function loggerCatch(_0x103c69){return function(_0x5cd269){logger[_0x285b('0x5')](_0x103c69,util['inspect'](_0x5cd269,{'showHidden':![],'depth':null}));};}exports[_0x285b('0x6')]=function(_0x3305c6,_0x1fd5ce){return BPromise[_0x285b('0x7')]()['then'](faxAccount['notify'](_0x3305c6,_0x1fd5ce))[_0x285b('0x8')](loggerCatch(_0x285b('0x9')));}; \ 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 01a01ef..0c233bd 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 _0x934f=['child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x934f,0x7b));var _0xf934=function(_0x11fc67,_0x1eda19){_0x11fc67=_0x11fc67-0x0;var _0x50bb19=_0x934f[_0x11fc67];return _0x50bb19;};'use strict';var util=require(_0xf934('0x0'));var logger=require(_0xf934('0x1'))('fax');var BPromise=require(_0xf934('0x2'));var exec=require(_0xf934('0x3'))[_0xf934('0x4')];exports[_0xf934('0x5')]=function(_0x55db91){return new BPromise(function(_0x2dd3d2,_0x498cf6){exec(_0x55db91,function(_0x4bc76c,_0x14451e,_0x5a34e1){logger[_0xf934('0x6')](_0xf934('0x7'),_0x14451e);if(_0x4bc76c){logger[_0xf934('0x6')](_0xf934('0x7'),_0xf934('0x8'),util['inspect'](_0x4bc76c,{'showHidden':![],'depth':null}),_0x14451e,_0x5a34e1);_0x498cf6(_0x4bc76c);}_0x2dd3d2(_0x14451e);});});}; \ No newline at end of file +var _0x8364=['child_process','exec','info','Exec\x20gs','\x20Error\x20:','inspect','util','fax','bluebird'];(function(_0x557173,_0x443208){var _0x29b819=function(_0xce87d8){while(--_0xce87d8){_0x557173['push'](_0x557173['shift']());}};_0x29b819(++_0x443208);}(_0x8364,0x1da));var _0x4836=function(_0x1f50f3,_0x4d4ae9){_0x1f50f3=_0x1f50f3-0x0;var _0x33b87b=_0x8364[_0x1f50f3];return _0x33b87b;};'use strict';var util=require(_0x4836('0x0'));var logger=require('../../../../config/logger')(_0x4836('0x1'));var BPromise=require(_0x4836('0x2'));var exec=require(_0x4836('0x3'))[_0x4836('0x4')];exports['execute']=function(_0xb9404b){return new BPromise(function(_0x26a7f5,_0x53d06f){exec(_0xb9404b,function(_0x3ffecc,_0x312554,_0xb1a00a){logger[_0x4836('0x5')](_0x4836('0x6'),_0x312554);if(_0x3ffecc){logger[_0x4836('0x5')](_0x4836('0x6'),_0x4836('0x7'),util[_0x4836('0x8')](_0x3ffecc,{'showHidden':![],'depth':null}),_0x312554,_0xb1a00a);_0x53d06f(_0x3ffecc);}_0x26a7f5(_0x312554);});});}; \ 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 0d7de24..8c6a6d8 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 _0x82c7=['modem','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','minrate','maxrate','format'];(function(_0x1184c2,_0x20de75){var _0x2dcf40=function(_0x1cdc3c){while(--_0x1cdc3c){_0x1184c2['push'](_0x1184c2['shift']());}};_0x2dcf40(++_0x20de75);}(_0x82c7,0x1c0));var _0x782c=function(_0x1505e5,_0x5cc291){_0x1505e5=_0x1505e5-0x0;var _0x5b1dcd=_0x82c7[_0x1505e5];return _0x5b1dcd;};'use strict';var util=require(_0x782c('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x782c('0x1'))(_0x782c('0x2'));exports[_0x782c('0x3')]=function(_0x3c0f53){return{'message':_0x3c0f53};};exports[_0x782c('0x4')]=function(_0x394841,_0x3ac25a){logger[_0x782c('0x5')](_0x394841,util[_0x782c('0x6')](_0x3ac25a,{'showHidden':![],'depth':null}));};exports[_0x782c('0x7')]=function(_0x28ae00,_0xc3da9b){var _0xb0eff9={'XMF-ECM':_0xc3da9b[_0x782c('0x8')],'XMF-HEADERINFO':_0xc3da9b['headerinfo'],'XMF-MINRATE':_0xc3da9b[_0x782c('0x9')],'XMF-MAXRATE':_0xc3da9b[_0x782c('0xa')],'XMF-MODEM':util[_0x782c('0xb')]('\x22%s\x22',_0xc3da9b[_0x782c('0xc')]),'XMF-GATEWAY':_0xc3da9b['gateway'],'XMF-FAXDETECT':_0xc3da9b['faxdetect'],'XMF-T38TIMEOUT':_0xc3da9b[_0x782c('0xd')],'XMF-LOCALSTATIONID':_0xc3da9b[_0x782c('0xe')],'XMF-PATH':_0x28ae00['path']};return _0xb0eff9;};exports[_0x782c('0xf')]=function(_0x4c2d41,_0x12bacc){return{'actionid':_0x4c2d41[_0x782c('0x10')],'action':_0x782c('0x11'),'channel':_0x4c2d41[_0x782c('0x12')],'Exten':_0x782c('0x13'),'Context':_0x782c('0x14'),'Priority':'1','callerid':util['format'](_0x782c('0x15'),_0x4c2d41['headerinfo']?_0x4c2d41[_0x782c('0x16')]:'',_0x4c2d41[_0x782c('0xe')]),'variable':_0x12bacc,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4c2d41[_0x782c('0x10')]};}; \ No newline at end of file +var _0xb8a7=['fax','message','logger','info','addVariables','headerinfo','minrate','maxrate','format','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger'];(function(_0x1e04f8,_0x18b0a0){var _0x485d1a=function(_0x572152){while(--_0x572152){_0x1e04f8['push'](_0x1e04f8['shift']());}};_0x485d1a(++_0x18b0a0);}(_0xb8a7,0xe6));var _0x7b8a=function(_0x36882e,_0xede215){_0x36882e=_0x36882e-0x0;var _0x3beffe=_0xb8a7[_0x36882e];return _0x3beffe;};'use strict';var util=require(_0x7b8a('0x0'));var _=require(_0x7b8a('0x1'));var moment=require(_0x7b8a('0x2'));var logger=require(_0x7b8a('0x3'))(_0x7b8a('0x4'));exports[_0x7b8a('0x5')]=function(_0x28ec81){return{'message':_0x28ec81};};exports[_0x7b8a('0x6')]=function(_0x44075e,_0x33553b){logger[_0x7b8a('0x7')](_0x44075e,util['inspect'](_0x33553b,{'showHidden':![],'depth':null}));};exports[_0x7b8a('0x8')]=function(_0x48d311,_0x3b6481){var _0x357a22={'XMF-ECM':_0x3b6481['ecm'],'XMF-HEADERINFO':_0x3b6481[_0x7b8a('0x9')],'XMF-MINRATE':_0x3b6481[_0x7b8a('0xa')],'XMF-MAXRATE':_0x3b6481[_0x7b8a('0xb')],'XMF-MODEM':util[_0x7b8a('0xc')]('\x22%s\x22',_0x3b6481[_0x7b8a('0xd')]),'XMF-GATEWAY':_0x3b6481[_0x7b8a('0xe')],'XMF-FAXDETECT':_0x3b6481[_0x7b8a('0xf')],'XMF-T38TIMEOUT':_0x3b6481[_0x7b8a('0x10')],'XMF-LOCALSTATIONID':_0x3b6481[_0x7b8a('0x11')],'XMF-PATH':_0x48d311[_0x7b8a('0x12')]};return _0x357a22;};exports[_0x7b8a('0x13')]=function(_0x269ba4,_0x3b8a3d){return{'actionid':_0x269ba4[_0x7b8a('0x14')],'action':_0x7b8a('0x15'),'channel':_0x269ba4[_0x7b8a('0x16')],'Exten':_0x7b8a('0x17'),'Context':_0x7b8a('0x18'),'Priority':'1','callerid':util[_0x7b8a('0xc')](_0x7b8a('0x19'),_0x269ba4['headerinfo']?_0x269ba4[_0x7b8a('0x9')]:'',_0x269ba4[_0x7b8a('0x11')]),'variable':_0x3b8a3d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x269ba4[_0x7b8a('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index a7df88b..275a1f3 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 _0xbb7d=['./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','sync','[index.js][main]','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory'];(function(_0x55d76f,_0x3ec4e8){var _0x27f726=function(_0x5ccf34){while(--_0x5ccf34){_0x55d76f['push'](_0x55d76f['shift']());}};_0x27f726(++_0x3ec4e8);}(_0xbb7d,0x10b));var _0xdbb7=function(_0x2e81d4,_0x13abd1){_0x2e81d4=_0x2e81d4-0x0;var _0x4f8b5c=_0xbb7d[_0x2e81d4];return _0x4f8b5c;};'use strict';var util=require(_0xdbb7('0x0'));var moment=require(_0xdbb7('0x1'));var server=require('./server');var Realtime=require(_0xdbb7('0x2'));var Report=require(_0xdbb7('0x3'));var Acw=require(_0xdbb7('0x4'));var Trigger=require(_0xdbb7('0x5'));var Dialer=require(_0xdbb7('0x6'));var Preview=require(_0xdbb7('0x7'));var Fax=require(_0xdbb7('0x8'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xdbb7('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0xdbb7('0xa'));var template=require(_0xdbb7('0xb'));var cmHopperHistory=require(_0xdbb7('0xc'));var campaign=require(_0xdbb7('0xd'));var voiceExtension=require(_0xdbb7('0xe'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xdbb7('0xf'));var salesforce=require(_0xdbb7('0x10'));var sugarcrm=require(_0xdbb7('0x11'));var freshdesk=require(_0xdbb7('0x12'));var desk=require(_0xdbb7('0x13'));var zoho=require(_0xdbb7('0x14'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xdbb7('0x15'));var servicenow=require(_0xdbb7('0x16'));var dynamics365=require(_0xdbb7('0x17'));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('../../config/logger')(_0xdbb7('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xdbb7('0x19')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xdbb7('0x19')](_0xdbb7('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xdbb7('0x1b')]()['then'](user['getAgents']())[_0xdbb7('0x1c')](realtime['initAgents']())[_0xdbb7('0x1c')](user['getTelephones']())[_0xdbb7('0x1c')](realtime[_0xdbb7('0x1d')]())['then'](trunk['getTrunks']())[_0xdbb7('0x1c')](realtime[_0xdbb7('0x1e')]())[_0xdbb7('0x1c')](voiceQueue[_0xdbb7('0x1f')]())[_0xdbb7('0x1c')](realtime[_0xdbb7('0x20')]())['then'](trigger[_0xdbb7('0x21')]())[_0xdbb7('0x1c')](realtime[_0xdbb7('0x22')]())[_0xdbb7('0x1c')](template['getTemplates']())[_0xdbb7('0x1c')](realtime[_0xdbb7('0x23')]())[_0xdbb7('0x1c')](zendesk[_0xdbb7('0x24')]())[_0xdbb7('0x1c')](realtime[_0xdbb7('0x25')]())[_0xdbb7('0x1c')](salesforce[_0xdbb7('0x26')]())[_0xdbb7('0x1c')](realtime['initSalesforceAccounts']())[_0xdbb7('0x1c')](sugarcrm[_0xdbb7('0x27')]())[_0xdbb7('0x1c')](realtime[_0xdbb7('0x28')]())[_0xdbb7('0x1c')](freshdesk[_0xdbb7('0x29')]())[_0xdbb7('0x1c')](realtime[_0xdbb7('0x2a')]())[_0xdbb7('0x1c')](desk[_0xdbb7('0x2b')]())[_0xdbb7('0x1c')](realtime[_0xdbb7('0x2c')]())['then'](zoho[_0xdbb7('0x2d')]())[_0xdbb7('0x1c')](realtime[_0xdbb7('0x2e')]())[_0xdbb7('0x1c')](vtiger[_0xdbb7('0x2f')]())['then'](realtime[_0xdbb7('0x30')]())[_0xdbb7('0x1c')](freshsales['getFreshsalesAccounts']())[_0xdbb7('0x1c')](realtime['initFreshsalesAccounts']())[_0xdbb7('0x1c')](servicenow[_0xdbb7('0x31')]())['then'](realtime['initServicenowAccounts']())[_0xdbb7('0x1c')](dynamics365[_0xdbb7('0x32')]())[_0xdbb7('0x1c')](realtime[_0xdbb7('0x33')]())['then'](campaign[_0xdbb7('0x34')]())['then'](realtime[_0xdbb7('0x35')]())[_0xdbb7('0x1c')](voiceExtension[_0xdbb7('0x36')]())['then'](realtime[_0xdbb7('0x37')]())[_0xdbb7('0x1c')](faxAccount[_0xdbb7('0x38')]())[_0xdbb7('0x1c')](realtime[_0xdbb7('0x39')]())[_0xdbb7('0x1c')](function(){return realtime;});}function initParams(){return Promise[_0xdbb7('0x1b')]()[_0xdbb7('0x1c')](voiceQueueReport[_0xdbb7('0x3a')]())[_0xdbb7('0x1c')](realtime['initVoiceQueueReports']())[_0xdbb7('0x1c')](cmHopperHistory[_0xdbb7('0x3b')]())[_0xdbb7('0x1c')](realtime[_0xdbb7('0x3c')]())[_0xdbb7('0x1c')](cmHopperHistory[_0xdbb7('0x3d')]())[_0xdbb7('0x1c')](realtime['initCampaignHopperHistory']())[_0xdbb7('0x1c')](voiceCallReport[_0xdbb7('0x3e')]())[_0xdbb7('0x1c')](realtime[_0xdbb7('0x3f')]())[_0xdbb7('0x40')](function(_0xc0fdb2){logger[_0xdbb7('0x41')]('[index.js][initParams]',util[_0xdbb7('0x42')](_0xc0fdb2,{'showHidden':![],'depth':null}));});}function main(){return server[_0xdbb7('0x43')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0xdbb7('0x1c')](function(){return initParams();})[_0xdbb7('0x1c')](function(){report[_0xdbb7('0x44')]();setInterval(initRealtime,0x1388);})[_0xdbb7('0x40')](function(_0x3e53d6){logger[_0xdbb7('0x41')](_0xdbb7('0x45'),util[_0xdbb7('0x42')](_0x3e53d6,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x9b6e=['initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','error','[index.js][main]','moment','./server','./acw','./dialer','./fax','./rpc/voiceQueue','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','resolve','then','getAgents','getTelephones','initVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory'];(function(_0x14437a,_0x5067c2){var _0x36485e=function(_0x3f7782){while(--_0x3f7782){_0x14437a['push'](_0x14437a['shift']());}};_0x36485e(++_0x5067c2);}(_0x9b6e,0x146));var _0xe9b6=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x9b6e[_0x15c421];return _0x5e5ed5;};'use strict';var util=require('util');var moment=require(_0xe9b6('0x0'));var server=require(_0xe9b6('0x1'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0xe9b6('0x2'));var Trigger=require('./trigger');var Dialer=require(_0xe9b6('0x3'));var Preview=require('./preview');var Fax=require(_0xe9b6('0x4'));var user=require('./rpc/user');var voiceQueue=require(_0xe9b6('0x5'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xe9b6('0x6'));var trigger=require(_0xe9b6('0x7'));var template=require(_0xe9b6('0x8'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xe9b6('0x9'));var voiceExtension=require(_0xe9b6('0xa'));var faxAccount=require(_0xe9b6('0xb'));var zendesk=require(_0xe9b6('0xc'));var salesforce=require(_0xe9b6('0xd'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xe9b6('0xe'));var zoho=require(_0xe9b6('0xf'));var vtiger=require(_0xe9b6('0x10'));var freshsales=require(_0xe9b6('0x11'));var servicenow=require(_0xe9b6('0x12'));var dynamics365=require(_0xe9b6('0x13'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xe9b6('0x14'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe9b6('0x15')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xe9b6('0x16')]()[_0xe9b6('0x17')](user[_0xe9b6('0x18')]())['then'](realtime['initAgents']())[_0xe9b6('0x17')](user[_0xe9b6('0x19')]())['then'](realtime['initTelephones']())[_0xe9b6('0x17')](trunk['getTrunks']())[_0xe9b6('0x17')](realtime['initTrunks']())['then'](voiceQueue['getVoiceQueues']())[_0xe9b6('0x17')](realtime[_0xe9b6('0x1a')]())[_0xe9b6('0x17')](trigger['getTriggers']())['then'](realtime[_0xe9b6('0x1b')]())[_0xe9b6('0x17')](template['getTemplates']())[_0xe9b6('0x17')](realtime[_0xe9b6('0x1c')]())[_0xe9b6('0x17')](zendesk[_0xe9b6('0x1d')]())[_0xe9b6('0x17')](realtime[_0xe9b6('0x1e')]())['then'](salesforce[_0xe9b6('0x1f')]())[_0xe9b6('0x17')](realtime[_0xe9b6('0x20')]())[_0xe9b6('0x17')](sugarcrm['getSugarcrmAccounts']())[_0xe9b6('0x17')](realtime[_0xe9b6('0x21')]())['then'](freshdesk[_0xe9b6('0x22')]())['then'](realtime[_0xe9b6('0x23')]())[_0xe9b6('0x17')](desk[_0xe9b6('0x24')]())[_0xe9b6('0x17')](realtime[_0xe9b6('0x25')]())['then'](zoho['getZohoAccounts']())[_0xe9b6('0x17')](realtime[_0xe9b6('0x26')]())['then'](vtiger['getVtigerAccounts']())[_0xe9b6('0x17')](realtime[_0xe9b6('0x27')]())[_0xe9b6('0x17')](freshsales['getFreshsalesAccounts']())[_0xe9b6('0x17')](realtime[_0xe9b6('0x28')]())[_0xe9b6('0x17')](servicenow[_0xe9b6('0x29')]())[_0xe9b6('0x17')](realtime[_0xe9b6('0x2a')]())['then'](dynamics365[_0xe9b6('0x2b')]())[_0xe9b6('0x17')](realtime[_0xe9b6('0x2c')]())['then'](campaign['getCampaigns']())['then'](realtime[_0xe9b6('0x2d')]())[_0xe9b6('0x17')](voiceExtension[_0xe9b6('0x2e')]())['then'](realtime[_0xe9b6('0x2f')]())[_0xe9b6('0x17')](faxAccount[_0xe9b6('0x30')]())[_0xe9b6('0x17')](realtime[_0xe9b6('0x31')]())[_0xe9b6('0x17')](function(){return realtime;});}function initParams(){return Promise[_0xe9b6('0x16')]()[_0xe9b6('0x17')](voiceQueueReport[_0xe9b6('0x32')]())[_0xe9b6('0x17')](realtime['initVoiceQueueReports']())[_0xe9b6('0x17')](cmHopperHistory[_0xe9b6('0x33')]())[_0xe9b6('0x17')](realtime[_0xe9b6('0x34')]())[_0xe9b6('0x17')](cmHopperHistory['getCampaignHopperHistory']())[_0xe9b6('0x17')](realtime[_0xe9b6('0x35')]())[_0xe9b6('0x17')](voiceCallReport[_0xe9b6('0x36')]())['then'](realtime[_0xe9b6('0x37')]())[_0xe9b6('0x38')](function(_0x8e116c){logger['error'](_0xe9b6('0x39'),util[_0xe9b6('0x3a')](_0x8e116c,{'showHidden':![],'depth':null}));});}function main(){return server[_0xe9b6('0x3b')](realtime,preview,fax)[_0xe9b6('0x17')](function(){return initRealtime();})[_0xe9b6('0x17')](function(){return initParams();})[_0xe9b6('0x17')](function(){report[_0xe9b6('0x3c')]();setInterval(initRealtime,0x1388);})[_0xe9b6('0x38')](function(_0x574f8b){logger[_0xe9b6('0x3d')](_0xe9b6('0x3e'),util['inspect'](_0x574f8b,{'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 83546ae..b305ec9 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 _0x9fa3=['state','unknown','status','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','md5','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','statePause','format','stateTime','voiceStatusCallerIdNumber','stringify','user:%s','omit','emit','user:presence','exports','util','moment','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname'];(function(_0x32dfe2,_0x322887){var _0x58609b=function(_0xe111fb){while(--_0xe111fb){_0x32dfe2['push'](_0x32dfe2['shift']());}};_0x58609b(++_0x322887);}(_0x9fa3,0x67));var _0x39fa=function(_0x34bcd6,_0x26f04e){_0x34bcd6=_0x34bcd6-0x0;var _0x331ad5=_0x9fa3[_0x34bcd6];return _0x331ad5;};'use strict';var _=require('lodash');var util=require(_0x39fa('0x0'));var moment=require(_0x39fa('0x1'));var md5=require('md5');var Redis=require(_0x39fa('0x2'));var config=require(_0x39fa('0x3'));config[_0x39fa('0x4')]=_['defaults'](config['redis'],{'host':_0x39fa('0x5'),'port':0x18eb});var io=require(_0x39fa('0x6'))(new Redis(config[_0x39fa('0x4')]));function Agent(_0xce8de8){this['id']=_0xce8de8['id']||0x0;this[_0x39fa('0x7')]=_0xce8de8[_0x39fa('0x7')]||'';this['email']=_0xce8de8[_0x39fa('0x8')]||'';this[_0x39fa('0x9')]=_0xce8de8['accountcode']||'';this[_0x39fa('0xa')]=_0xce8de8[_0x39fa('0xa')]||'';this[_0x39fa('0xb')]=_0x39fa('0xc');this['stateTime']=0x0;this[_0x39fa('0xd')]=_0x39fa('0xc');this[_0x39fa('0xe')]='';this['phone']='';this[_0x39fa('0xf')]='';this[_0x39fa('0x10')]='';this[_0x39fa('0x11')]=_0xce8de8[_0x39fa('0x11')]||![];this[_0x39fa('0x12')]='unknown';this[_0x39fa('0x13')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x39fa('0x14')]='';this[_0x39fa('0x15')]=![];this['local']=![];this[_0x39fa('0x16')]='';}Agent['prototype'][_0x39fa('0x17')]=function(_0x425a24){var _0x4bdcc3;if(_0x425a24&&_0x425a24[_0x39fa('0xb')]){_0x4bdcc3=_0x425a24[_0x39fa('0xb')][_0x39fa('0x18')]();switch(_0x4bdcc3){case _0x39fa('0x19'):_0x4bdcc3=_0x39fa('0x1a');break;case _0x39fa('0x1b'):_0x4bdcc3='talking';break;}}if(_0x4bdcc3&&this['voiceStatus']!==_0x4bdcc3||_0x425a24[_0x39fa('0x1c')]){this[_0x39fa('0x13')]=_['toNumber'](moment()[_0x39fa('0x1d')]('x'));}if(_0x4bdcc3){this['voiceStatus']=_0x4bdcc3;}var _0x1e4167={'id':this['id'],'name':this['name'],'email':this[_0x39fa('0x8')],'accountcode':this[_0x39fa('0x9')],'fullname':this['fullname'],'state':this[_0x39fa('0xb')],'stateTime':this[_0x39fa('0x1e')],'status':this[_0x39fa('0xd')],'address':this[_0x39fa('0xe')],'online':this[_0x39fa('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x39fa('0x13')],'voiceStatusCallerIdNumber':this[_0x39fa('0x1f')],'voiceStatusQueue':this[_0x39fa('0x14')],'interface':this['interface'],'onhold':this[_0x39fa('0x15')]};var _0x701d23=md5(JSON[_0x39fa('0x20')](_0x1e4167));if(this[_0x39fa('0x16')]!==_0x701d23){this[_0x39fa('0x16')]=_0x701d23;io['to'](util[_0x39fa('0x1d')](_0x39fa('0x21'),_0x1e4167[_0x39fa('0x7')]))['emit']('user:ami:update',_[_0x39fa('0x22')](_0x1e4167,[_0x39fa('0x11')]));io[_0x39fa('0x23')](_0x39fa('0x24'),_0x1e4167);}};module[_0x39fa('0x25')]=Agent; \ No newline at end of file +var _0x9f7d=['state','unknown','stateTime','status','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','talking','toNumber','format','address','onhold','user:%s','emit','user:ami:update','omit','user:presence','lodash','util','moment','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','fullname'];(function(_0x43dc7e,_0x49a390){var _0x21e12d=function(_0x15cc1a){while(--_0x15cc1a){_0x43dc7e['push'](_0x43dc7e['shift']());}};_0x21e12d(++_0x49a390);}(_0x9f7d,0x67));var _0xd9f7=function(_0x314eed,_0x4d33f0){_0x314eed=_0x314eed-0x0;var _0xa5afe6=_0x9f7d[_0x314eed];return _0xa5afe6;};'use strict';var _=require(_0xd9f7('0x0'));var util=require(_0xd9f7('0x1'));var moment=require(_0xd9f7('0x2'));var md5=require(_0xd9f7('0x3'));var Redis=require(_0xd9f7('0x4'));var config=require(_0xd9f7('0x5'));config['redis']=_[_0xd9f7('0x6')](config[_0xd9f7('0x7')],{'host':_0xd9f7('0x8'),'port':0x18eb});var io=require(_0xd9f7('0x9'))(new Redis(config['redis']));function Agent(_0x53ad54){this['id']=_0x53ad54['id']||0x0;this['name']=_0x53ad54[_0xd9f7('0xa')]||'';this[_0xd9f7('0xb')]=_0x53ad54[_0xd9f7('0xb')]||'';this[_0xd9f7('0xc')]=_0x53ad54['accountcode']||'';this[_0xd9f7('0xd')]=_0x53ad54[_0xd9f7('0xd')]||'';this[_0xd9f7('0xe')]=_0xd9f7('0xf');this[_0xd9f7('0x10')]=0x0;this[_0xd9f7('0x11')]='unknown';this['address']='';this['phone']='';this['mobile']='';this[_0xd9f7('0x12')]='';this[_0xd9f7('0x13')]=_0x53ad54[_0xd9f7('0x13')]||![];this[_0xd9f7('0x14')]=_0xd9f7('0xf');this[_0xd9f7('0x15')]=0x0;this[_0xd9f7('0x16')]='';this[_0xd9f7('0x17')]='';this['onhold']=![];this[_0xd9f7('0x18')]=![];this[_0xd9f7('0x3')]='';}Agent[_0xd9f7('0x19')][_0xd9f7('0x1a')]=function(_0x11aa4c){var _0x1c6499;if(_0x11aa4c&&_0x11aa4c[_0xd9f7('0xe')]){_0x1c6499=_0x11aa4c[_0xd9f7('0xe')][_0xd9f7('0x1b')]();switch(_0x1c6499){case _0xd9f7('0x1c'):_0x1c6499='idle';break;case'inuse':_0x1c6499=_0xd9f7('0x1d');break;}}if(_0x1c6499&&this[_0xd9f7('0x14')]!==_0x1c6499||_0x11aa4c['statePause']){this[_0xd9f7('0x15')]=_[_0xd9f7('0x1e')](moment()[_0xd9f7('0x1f')]('x'));}if(_0x1c6499){this[_0xd9f7('0x14')]=_0x1c6499;}var _0x5c3348={'id':this['id'],'name':this[_0xd9f7('0xa')],'email':this['email'],'accountcode':this[_0xd9f7('0xc')],'fullname':this[_0xd9f7('0xd')],'state':this['state'],'stateTime':this[_0xd9f7('0x10')],'status':this[_0xd9f7('0x11')],'address':this[_0xd9f7('0x20')],'online':this['online'],'voiceStatus':this[_0xd9f7('0x14')],'voiceStatusTime':this[_0xd9f7('0x15')],'voiceStatusCallerIdNumber':this[_0xd9f7('0x16')],'voiceStatusQueue':this[_0xd9f7('0x17')],'interface':this[_0xd9f7('0x12')],'onhold':this[_0xd9f7('0x21')]};var _0x5e1acc=md5(JSON['stringify'](_0x5c3348));if(this[_0xd9f7('0x3')]!==_0x5e1acc){this[_0xd9f7('0x3')]=_0x5e1acc;io['to'](util['format'](_0xd9f7('0x22'),_0x5c3348[_0xd9f7('0xa')]))[_0xd9f7('0x23')](_0xd9f7('0x24'),_[_0xd9f7('0x25')](_0x5c3348,['online']));io['emit'](_0xd9f7('0x26'),_0x5c3348);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 1cf4f76..17e5551 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 _0x9d9e=['dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x9d9e,0x1a6));var _0xe9d9=function(_0x11500e,_0x457be0){_0x11500e=_0x11500e-0x0;var _0x135e1a=_0x9d9e[_0x11500e];return _0x135e1a;};'use strict';function Campaign(_0x149cef){this['id']=_0x149cef['id']||0x0;this[_0xe9d9('0x0')]=_0x149cef[_0xe9d9('0x0')]||'';this['type']=_0x149cef[_0xe9d9('0x1')]||_0xe9d9('0x2');this[_0xe9d9('0x3')]=0x0;this['temp']=0x0;this[_0xe9d9('0x4')]=0x0;this[_0xe9d9('0x5')]=0x0;this[_0xe9d9('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0xe9d9('0x7')]=_0x149cef['active'];this[_0xe9d9('0x8')]=_0x149cef[_0xe9d9('0x8')];this[_0xe9d9('0x9')]=_0x149cef[_0xe9d9('0x9')]||null;this[_0xe9d9('0xa')]=_0x149cef[_0xe9d9('0xa')]?_0x149cef[_0xe9d9('0xa')]:null;this[_0xe9d9('0xb')]=_0x149cef[_0xe9d9('0xb')];this['dialOriginateCallerIdNumber']=_0x149cef['dialOriginateCallerIdNumber'];this[_0xe9d9('0xc')]=_0x149cef['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x149cef[_0xe9d9('0xd')];this[_0xe9d9('0xe')]=_0x149cef[_0xe9d9('0xe')];this['dialBusyMaxRetry']=_0x149cef[_0xe9d9('0xf')];this['dialBusyRetryFrequency']=_0x149cef[_0xe9d9('0x10')];this[_0xe9d9('0x11')]=_0x149cef[_0xe9d9('0x11')];this[_0xe9d9('0x12')]=_0x149cef['dialNoAnswerRetryFrequency'];this[_0xe9d9('0x13')]=_0x149cef['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x149cef[_0xe9d9('0x14')]||0x3;this[_0xe9d9('0x15')]=_0x149cef[_0xe9d9('0x15')]||0x96;this[_0xe9d9('0x16')]=_0x149cef[_0xe9d9('0x16')]||0x3;this[_0xe9d9('0x17')]=_0x149cef[_0xe9d9('0x17')]||0x96;this[_0xe9d9('0x18')]=_0x149cef['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x149cef[_0xe9d9('0x19')]||0x96;this[_0xe9d9('0x1a')]=_0x149cef['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x149cef[_0xe9d9('0x1b')]||0x96;this[_0xe9d9('0x1c')]=_0x149cef[_0xe9d9('0x1c')]||0x3;this[_0xe9d9('0x1d')]=_0x149cef[_0xe9d9('0x1d')]||0x96;this[_0xe9d9('0x1e')]=_0x149cef[_0xe9d9('0x1e')]||_0xe9d9('0x1f');this[_0xe9d9('0x20')]=_0x149cef[_0xe9d9('0x20')]||undefined;this[_0xe9d9('0x21')]=_0x149cef[_0xe9d9('0x21')]||undefined;this['dialCutDigit']=_0x149cef[_0xe9d9('0x22')]||undefined;this['TrunkBackup']=_0x149cef[_0xe9d9('0x23')]?_0x149cef[_0xe9d9('0x23')]:undefined;this[_0xe9d9('0x24')]=_0x149cef[_0xe9d9('0x24')]?_0x149cef[_0xe9d9('0x24')]:undefined;this[_0xe9d9('0x25')]=_0x149cef[_0xe9d9('0x25')]?_0x149cef[_0xe9d9('0x25')]:undefined;this['SquareProject']=_0x149cef['SquareProject']?_0x149cef[_0xe9d9('0x26')]:undefined;this[_0xe9d9('0x27')]=_0x149cef['SquareProject']?_0x149cef[_0xe9d9('0x26')][_0xe9d9('0x0')]:undefined;this['dialAMDActive']=_0x149cef[_0xe9d9('0x28')]||![];this[_0xe9d9('0x29')]=_0x149cef[_0xe9d9('0x29')];this[_0xe9d9('0x2a')]=_0x149cef[_0xe9d9('0x2a')];this[_0xe9d9('0x2b')]=_0x149cef[_0xe9d9('0x2b')];this[_0xe9d9('0x2c')]=_0x149cef[_0xe9d9('0x2c')];this[_0xe9d9('0x2d')]=_0x149cef[_0xe9d9('0x2d')];this['dialAMDBetweenWordsSilence']=_0x149cef[_0xe9d9('0x2e')];this[_0xe9d9('0x2f')]=_0x149cef[_0xe9d9('0x2f')];this['dialAMDSilenceThreshold']=_0x149cef['dialAMDSilenceThreshold'];this[_0xe9d9('0x30')]=_0x149cef['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0xd5c0=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry'];(function(_0x5a12fc,_0x276e4a){var _0x190a7c=function(_0xf91b7e){while(--_0xf91b7e){_0x5a12fc['push'](_0x5a12fc['shift']());}};_0x190a7c(++_0x276e4a);}(_0xd5c0,0xa6));var _0x0d5c=function(_0x5b674c,_0xc560b){_0x5b674c=_0x5b674c-0x0;var _0x3da567=_0xd5c0[_0x5b674c];return _0x3da567;};'use strict';function Campaign(_0xc59da4){this['id']=_0xc59da4['id']||0x0;this['name']=_0xc59da4[_0x0d5c('0x0')]||'';this[_0x0d5c('0x1')]=_0xc59da4[_0x0d5c('0x1')]||_0x0d5c('0x2');this[_0x0d5c('0x3')]=0x0;this[_0x0d5c('0x4')]=0x0;this[_0x0d5c('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x0d5c('0x6')]='';this[_0x0d5c('0x7')]=!![];this[_0x0d5c('0x8')]=_0xc59da4['active'];this[_0x0d5c('0x9')]=_0xc59da4[_0x0d5c('0x9')];this[_0x0d5c('0xa')]=_0xc59da4['dialTimezone']||null;this[_0x0d5c('0xb')]=_0xc59da4[_0x0d5c('0xb')]?_0xc59da4[_0x0d5c('0xb')]:null;this[_0x0d5c('0xc')]=_0xc59da4[_0x0d5c('0xc')];this[_0x0d5c('0xd')]=_0xc59da4['dialOriginateCallerIdNumber'];this[_0x0d5c('0xe')]=_0xc59da4[_0x0d5c('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0xc59da4['dialCongestionMaxRetry'];this[_0x0d5c('0xf')]=_0xc59da4[_0x0d5c('0xf')];this[_0x0d5c('0x10')]=_0xc59da4[_0x0d5c('0x10')];this[_0x0d5c('0x11')]=_0xc59da4[_0x0d5c('0x11')];this[_0x0d5c('0x12')]=_0xc59da4[_0x0d5c('0x12')];this[_0x0d5c('0x13')]=_0xc59da4[_0x0d5c('0x13')];this[_0x0d5c('0x14')]=_0xc59da4[_0x0d5c('0x14')];this[_0x0d5c('0x15')]=_0xc59da4['dialNoSuchNumberMaxRetry']||0x3;this[_0x0d5c('0x16')]=_0xc59da4[_0x0d5c('0x16')]||0x96;this[_0x0d5c('0x17')]=_0xc59da4[_0x0d5c('0x17')]||0x3;this['dialDropRetryFrequency']=_0xc59da4['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0xc59da4[_0x0d5c('0x18')]||0x3;this['dialAbandonedRetryFrequency']=_0xc59da4['dialAbandonedRetryFrequency']||0x96;this[_0x0d5c('0x19')]=_0xc59da4['dialMachineMaxRetry']||0x3;this[_0x0d5c('0x1a')]=_0xc59da4['dialMachineRetryFrequency']||0x96;this[_0x0d5c('0x1b')]=_0xc59da4[_0x0d5c('0x1b')]||0x3;this[_0x0d5c('0x1c')]=_0xc59da4[_0x0d5c('0x1c')]||0x96;this['dialOrderByScheduledAt']=_0xc59da4['dialOrderByScheduledAt']||_0x0d5c('0x1d');this['dialPrefix']=_0xc59da4['dialPrefix']||undefined;this[_0x0d5c('0x1e')]=_0xc59da4['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x0d5c('0x1f')]=_0xc59da4[_0x0d5c('0x1f')]||undefined;this['TrunkBackup']=_0xc59da4['TrunkBackup']?_0xc59da4[_0x0d5c('0x20')]:undefined;this[_0x0d5c('0x21')]=_0xc59da4[_0x0d5c('0x21')]?_0xc59da4['Trunk']:undefined;this[_0x0d5c('0x22')]=_0xc59da4[_0x0d5c('0x22')]?_0xc59da4['Interval']:undefined;this[_0x0d5c('0x23')]=_0xc59da4[_0x0d5c('0x23')]?_0xc59da4[_0x0d5c('0x23')]:undefined;this['dialQueueProject']=_0xc59da4[_0x0d5c('0x23')]?_0xc59da4['SquareProject']['name']:undefined;this[_0x0d5c('0x24')]=_0xc59da4[_0x0d5c('0x24')]||![];this[_0x0d5c('0x25')]=_0xc59da4[_0x0d5c('0x25')];this[_0x0d5c('0x26')]=_0xc59da4[_0x0d5c('0x26')];this[_0x0d5c('0x27')]=_0xc59da4[_0x0d5c('0x27')];this[_0x0d5c('0x28')]=_0xc59da4[_0x0d5c('0x28')];this['dialAMDMinWordLength']=_0xc59da4[_0x0d5c('0x29')];this[_0x0d5c('0x2a')]=_0xc59da4['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0xc59da4[_0x0d5c('0x2b')];this['dialAMDSilenceThreshold']=_0xc59da4[_0x0d5c('0x2c')];this['dialAMDMaximumWordLength']=_0xc59da4[_0x0d5c('0x2d')];}module[_0x0d5c('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index f360c84..c8e5241 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 _0x556a=['mohtime','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum'];(function(_0x2cea4c,_0x4b6b97){var _0x523aeb=function(_0x23bfcd){while(--_0x23bfcd){_0x2cea4c['push'](_0x2cea4c['shift']());}};_0x523aeb(++_0x4b6b97);}(_0x556a,0x1dd));var _0xa556=function(_0x3ea196,_0x19f049){_0x3ea196=_0x3ea196-0x0;var _0xc8e6d3=_0x556a[_0x3ea196];return _0xc8e6d3;};'use strict';function Channel(){this[_0xa556('0x0')]=null;this[_0xa556('0x1')]='';this[_0xa556('0x2')]='';this[_0xa556('0x3')]=0x0;this[_0xa556('0x4')]='';this[_0xa556('0x5')]=undefined;this[_0xa556('0x6')]=undefined;this[_0xa556('0x7')]=0x0;this[_0xa556('0x8')]='';this['uniqueid']=0x0;this[_0xa556('0x9')]=0x0;this[_0xa556('0xa')]=0x0;this[_0xa556('0xb')]=![];this[_0xa556('0xc')]=null;this[_0xa556('0xd')]=null;this['unmanaged']=![];this[_0xa556('0xe')]=![];this[_0xa556('0xf')]='';this[_0xa556('0x10')]='';this[_0xa556('0x11')]=0x0;this['billableseconds']=0x0;this[_0xa556('0x12')]=0x0;this[_0xa556('0x13')]=null;this[_0xa556('0x14')]=null;this[_0xa556('0x15')]=null;this[_0xa556('0x16')]=![];this[_0xa556('0x17')]=null;this[_0xa556('0x18')]=null;this[_0xa556('0x19')]=[];this['transfercalleridnum']=undefined;this[_0xa556('0x1a')]=undefined;this['transferType']=undefined;this[_0xa556('0x1b')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x3e9f=['mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','disposition','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x3e9f,0x98));var _0xf3e9=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x3e9f[_0x3d42d8];return _0x27fc41;};'use strict';function Channel(){this[_0xf3e9('0x0')]=null;this[_0xf3e9('0x1')]='';this[_0xf3e9('0x2')]='';this[_0xf3e9('0x3')]=0x0;this['calleridname']='';this[_0xf3e9('0x4')]=undefined;this[_0xf3e9('0x5')]=undefined;this[_0xf3e9('0x6')]=0x0;this[_0xf3e9('0x7')]='';this[_0xf3e9('0x8')]=0x0;this[_0xf3e9('0x9')]=0x0;this[_0xf3e9('0xa')]=0x0;this[_0xf3e9('0xb')]=![];this[_0xf3e9('0xc')]=null;this[_0xf3e9('0xd')]=null;this[_0xf3e9('0xe')]=![];this[_0xf3e9('0xf')]=![];this[_0xf3e9('0x10')]='';this[_0xf3e9('0x11')]='';this[_0xf3e9('0x12')]=0x0;this[_0xf3e9('0x13')]=0x0;this[_0xf3e9('0x14')]=0x0;this[_0xf3e9('0x15')]=null;this['tag']=null;this[_0xf3e9('0x16')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0xf3e9('0x17')]=null;this[_0xf3e9('0x18')]=[];this[_0xf3e9('0x19')]=undefined;this[_0xf3e9('0x1a')]=undefined;this[_0xf3e9('0x1b')]=undefined;this[_0xf3e9('0x1c')]=0x0;}module[_0xf3e9('0x1d')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 5ec437c..12a5137 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 _0x34f4=['serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0x34f4,0x86));var _0x434f=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x34f4[_0x6131cd];return _0x47e916;};'use strict';function DeskAccount(_0x3600b7){this['id']=_0x3600b7['id']||0x0;this[_0x434f('0x0')]=_0x3600b7['name']||'';this[_0x434f('0x1')]=_0x3600b7[_0x434f('0x1')]||'';this[_0x434f('0x2')]=_0x3600b7[_0x434f('0x2')]||'';this[_0x434f('0x3')]=_0x3600b7['authType']||'';this[_0x434f('0x4')]=_0x3600b7[_0x434f('0x4')]||'';this[_0x434f('0x5')]=_0x3600b7[_0x434f('0x5')]||'';this[_0x434f('0x6')]=_0x3600b7[_0x434f('0x6')]||'';this[_0x434f('0x7')]=_0x3600b7['token']||'';this[_0x434f('0x8')]=_0x3600b7[_0x434f('0x8')]||'';this['type']=_0x3600b7['type']||'';this[_0x434f('0x9')]=_0x3600b7[_0x434f('0x9')]||'';this[_0x434f('0xa')]=_0x3600b7[_0x434f('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xb69b=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x44a117,_0x35f739){var _0x14e802=function(_0x5b083e){while(--_0x5b083e){_0x44a117['push'](_0x44a117['shift']());}};_0x14e802(++_0x35f739);}(_0xb69b,0x1ea));var _0xbb69=function(_0x65ab0b,_0x447f5a){_0x65ab0b=_0x65ab0b-0x0;var _0x143aaf=_0xb69b[_0x65ab0b];return _0x143aaf;};'use strict';function DeskAccount(_0x29fc4b){this['id']=_0x29fc4b['id']||0x0;this[_0xbb69('0x0')]=_0x29fc4b['name']||'';this[_0xbb69('0x1')]=_0x29fc4b['username']||'';this[_0xbb69('0x2')]=_0x29fc4b['remoteUri']||'';this['authType']=_0x29fc4b[_0xbb69('0x3')]||'';this[_0xbb69('0x4')]=_0x29fc4b[_0xbb69('0x4')]||'';this[_0xbb69('0x5')]=_0x29fc4b[_0xbb69('0x5')]||'';this['consumerSecret']=_0x29fc4b[_0xbb69('0x6')]||'';this[_0xbb69('0x7')]=_0x29fc4b[_0xbb69('0x7')]||'';this[_0xbb69('0x8')]=_0x29fc4b[_0xbb69('0x8')]||'';this[_0xbb69('0x9')]=_0x29fc4b['type']||'';this[_0xbb69('0xa')]=_0x29fc4b[_0xbb69('0xa')]||'';this[_0xbb69('0xb')]=_0x29fc4b[_0xbb69('0xb')]||{};}module[_0xbb69('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 7e6ee04..f3e1ed5 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 _0xa05e=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x1f70cf,_0x5d1f9c){var _0x41f4e7=function(_0x561d3d){while(--_0x561d3d){_0x1f70cf['push'](_0x1f70cf['shift']());}};_0x41f4e7(++_0x5d1f9c);}(_0xa05e,0xcd));var _0xea05=function(_0x1d1c37,_0x4ed944){_0x1d1c37=_0x1d1c37-0x0;var _0xe5aba5=_0xa05e[_0x1d1c37];return _0xe5aba5;};'use strict';function Dynamics365Account(_0x1f12d2){this['id']=_0x1f12d2['id']||0x0;this['name']=_0x1f12d2[_0xea05('0x0')]||'';this[_0xea05('0x1')]=_0x1f12d2[_0xea05('0x1')]||'';this[_0xea05('0x2')]=_0x1f12d2['password']||'';this[_0xea05('0x3')]=_0x1f12d2['remoteUri']||'';this[_0xea05('0x4')]=_0x1f12d2[_0xea05('0x4')]||'';this[_0xea05('0x5')]=_0x1f12d2[_0xea05('0x5')]||'';this[_0xea05('0x6')]=_0x1f12d2[_0xea05('0x6')]||{};this['serverUrl']=_0x1f12d2[_0xea05('0x7')]||'';this[_0xea05('0x8')]=_0x1f12d2[_0xea05('0x8')]||![];this[_0xea05('0x9')]=_0x1f12d2[_0xea05('0x9')]||{};this[_0xea05('0xa')]=_0x1f12d2['CloudProvider']||{};}module[_0xea05('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x9e93=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name'];(function(_0x2765e1,_0xb416f7){var _0x3f6fb1=function(_0x36f7ab){while(--_0x36f7ab){_0x2765e1['push'](_0x2765e1['shift']());}};_0x3f6fb1(++_0xb416f7);}(_0x9e93,0x83));var _0x39e9=function(_0x29f80e,_0x9027ff){_0x29f80e=_0x29f80e-0x0;var _0x5c7eaa=_0x9e93[_0x29f80e];return _0x5c7eaa;};'use strict';function Dynamics365Account(_0xb61fb){this['id']=_0xb61fb['id']||0x0;this[_0x39e9('0x0')]=_0xb61fb['name']||'';this[_0x39e9('0x1')]=_0xb61fb['username']||'';this[_0x39e9('0x2')]=_0xb61fb['password']||'';this[_0x39e9('0x3')]=_0xb61fb[_0x39e9('0x3')]||'';this[_0x39e9('0x4')]=_0xb61fb[_0x39e9('0x4')]||'';this[_0x39e9('0x5')]=_0xb61fb[_0x39e9('0x5')]||'';this[_0x39e9('0x6')]=_0xb61fb[_0x39e9('0x6')]||{};this[_0x39e9('0x7')]=_0xb61fb[_0x39e9('0x7')]||'';this['modernAuthentication']=_0xb61fb[_0x39e9('0x8')]||![];this[_0x39e9('0x9')]=_0xb61fb[_0x39e9('0x9')]||{};this[_0x39e9('0xa')]=_0xb61fb[_0x39e9('0xa')]||{};}module[_0x39e9('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 ce7c7c3..241193c 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 _0x1dfc=['description','headerinfo','minrate','maxrate','modem','v17,v27,v29','gateway','t38timeout','SIP','Trunk','ListId','key','name'];(function(_0x556848,_0x55a54c){var _0x10380e=function(_0x13d691){while(--_0x13d691){_0x556848['push'](_0x556848['shift']());}};_0x10380e(++_0x55a54c);}(_0x1dfc,0x16b));var _0xc1df=function(_0x2f0b4b,_0x259907){_0x2f0b4b=_0x2f0b4b-0x0;var _0x93bd43=_0x1dfc[_0x2f0b4b];return _0x93bd43;};'use strict';function FaxAccount(_0x820410){this['id']=_0x820410['id']||0x0;this[_0xc1df('0x0')]=_0x820410[_0xc1df('0x0')]||'';this[_0xc1df('0x1')]=_0x820410[_0xc1df('0x1')];this['ecm']=_0x820410['ecm'];this[_0xc1df('0x2')]=_0x820410[_0xc1df('0x2')];this['localstationid']=_0x820410['localstationid'];this[_0xc1df('0x3')]=_0x820410[_0xc1df('0x3')]||0x960;this[_0xc1df('0x4')]=_0x820410[_0xc1df('0x4')]||0x3840;this[_0xc1df('0x5')]=_0x820410[_0xc1df('0x5')]||_0xc1df('0x6');this[_0xc1df('0x7')]=_0x820410[_0xc1df('0x7')]||'no';this['faxdetect']=_0x820410['faxdetect']||'no';this[_0xc1df('0x8')]=_0x820410[_0xc1df('0x8')]||0x1388;this['tech']=_0x820410['tech']||_0xc1df('0x9');this[_0xc1df('0xa')]=_0x820410['Trunk']?_0x820410[_0xc1df('0xa')]:undefined;this[_0xc1df('0xb')]=_0x820410[_0xc1df('0xb')];this['key']=_0x820410[_0xc1df('0xc')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xf707=['Trunk','ListId','key','name','ecm','headerinfo','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf707,0xf1));var _0x7f70=function(_0x298dd0,_0x34fc3d){_0x298dd0=_0x298dd0-0x0;var _0x4442d6=_0xf707[_0x298dd0];return _0x4442d6;};'use strict';function FaxAccount(_0x42e442){this['id']=_0x42e442['id']||0x0;this[_0x7f70('0x0')]=_0x42e442[_0x7f70('0x0')]||'';this['description']=_0x42e442['description'];this[_0x7f70('0x1')]=_0x42e442[_0x7f70('0x1')];this[_0x7f70('0x2')]=_0x42e442['headerinfo'];this['localstationid']=_0x42e442['localstationid'];this[_0x7f70('0x3')]=_0x42e442[_0x7f70('0x3')]||0x960;this[_0x7f70('0x4')]=_0x42e442[_0x7f70('0x4')]||0x3840;this[_0x7f70('0x5')]=_0x42e442[_0x7f70('0x5')]||'v17,v27,v29';this[_0x7f70('0x6')]=_0x42e442['gateway']||'no';this[_0x7f70('0x7')]=_0x42e442[_0x7f70('0x7')]||'no';this[_0x7f70('0x8')]=_0x42e442['t38timeout']||0x1388;this[_0x7f70('0x9')]=_0x42e442[_0x7f70('0x9')]||_0x7f70('0xa');this[_0x7f70('0xb')]=_0x42e442[_0x7f70('0xb')]?_0x42e442['Trunk']:undefined;this['ListId']=_0x42e442[_0x7f70('0xc')];this[_0x7f70('0xd')]=_0x42e442[_0x7f70('0xd')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 944194b..d51ff2e 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 _0x33d2=['remoteUri','serverUrl','Configurations','username','apiKey','token'];(function(_0x568eee,_0xdddb2a){var _0x1ef6cf=function(_0x12bd56){while(--_0x12bd56){_0x568eee['push'](_0x568eee['shift']());}};_0x1ef6cf(++_0xdddb2a);}(_0x33d2,0x87));var _0x233d=function(_0x431ac5,_0x5e319f){_0x431ac5=_0x431ac5-0x0;var _0x235779=_0x33d2[_0x431ac5];return _0x235779;};'use strict';function FreshdeskAccount(_0x22508b){this['id']=_0x22508b['id']||0x0;this['name']=_0x22508b['name']||'';this['username']=_0x22508b[_0x233d('0x0')]||'';this[_0x233d('0x1')]=_0x22508b[_0x233d('0x2')]||'';this[_0x233d('0x3')]=_0x22508b[_0x233d('0x3')]||'';this['serverUrl']=_0x22508b[_0x233d('0x4')]||'';this[_0x233d('0x5')]=_0x22508b[_0x233d('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xbaff=['name','username','apiKey','token','serverUrl','Configurations','exports'];(function(_0x525b28,_0x5cf5a0){var _0x180178=function(_0x43e066){while(--_0x43e066){_0x525b28['push'](_0x525b28['shift']());}};_0x180178(++_0x5cf5a0);}(_0xbaff,0x111));var _0xfbaf=function(_0x306a59,_0x13903c){_0x306a59=_0x306a59-0x0;var _0x11724f=_0xbaff[_0x306a59];return _0x11724f;};'use strict';function FreshdeskAccount(_0x410f5a){this['id']=_0x410f5a['id']||0x0;this[_0xfbaf('0x0')]=_0x410f5a[_0xfbaf('0x0')]||'';this[_0xfbaf('0x1')]=_0x410f5a[_0xfbaf('0x1')]||'';this[_0xfbaf('0x2')]=_0x410f5a[_0xfbaf('0x3')]||'';this['remoteUri']=_0x410f5a['remoteUri']||'';this[_0xfbaf('0x4')]=_0x410f5a[_0xfbaf('0x4')]||'';this[_0xfbaf('0x5')]=_0x410f5a[_0xfbaf('0x5')]||{};}module[_0xfbaf('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 245d36b..8197b9d 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 _0x5a52=['token','remoteUri','serverUrl','Configurations','exports','username','apiKey'];(function(_0x221e5e,_0x3b5ff5){var _0x1f45c3=function(_0x138ad4){while(--_0x138ad4){_0x221e5e['push'](_0x221e5e['shift']());}};_0x1f45c3(++_0x3b5ff5);}(_0x5a52,0x18d));var _0x25a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a52[_0x3dd15e];return _0x231fd0;};'use strict';function FreshsalesAccount(_0x529b41){this['id']=_0x529b41['id']||0x0;this['name']=_0x529b41['name']||'';this['username']=_0x529b41[_0x25a5('0x0')]||'';this[_0x25a5('0x1')]=_0x529b41[_0x25a5('0x2')]||'';this[_0x25a5('0x3')]=_0x529b41[_0x25a5('0x3')]||'';this[_0x25a5('0x4')]=_0x529b41[_0x25a5('0x4')]||'';this[_0x25a5('0x5')]=_0x529b41['Configurations']||{};}module[_0x25a5('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xbe52=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x25fd71,_0x493b52){var _0x15917d=function(_0x4337f6){while(--_0x4337f6){_0x25fd71['push'](_0x25fd71['shift']());}};_0x15917d(++_0x493b52);}(_0xbe52,0x164));var _0x2be5=function(_0x5829d4,_0x5d6c73){_0x5829d4=_0x5829d4-0x0;var _0x350630=_0xbe52[_0x5829d4];return _0x350630;};'use strict';function FreshsalesAccount(_0x21fb70){this['id']=_0x21fb70['id']||0x0;this[_0x2be5('0x0')]=_0x21fb70[_0x2be5('0x0')]||'';this[_0x2be5('0x1')]=_0x21fb70[_0x2be5('0x1')]||'';this['apiKey']=_0x21fb70[_0x2be5('0x2')]||'';this[_0x2be5('0x3')]=_0x21fb70[_0x2be5('0x3')]||'';this[_0x2be5('0x4')]=_0x21fb70[_0x2be5('0x4')]||'';this[_0x2be5('0x5')]=_0x21fb70[_0x2be5('0x5')]||{};}module[_0x2be5('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index f3acd65..0bd870a 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 _0xccd3=['channel','connectedlinename','accountcode','context','exten','holdtime','lastAssignedTo','motionChannel','routealias','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','count','queuecallercomplete','queuecallerexit','originalposition'];(function(_0x2263cc,_0x2e1dc9){var _0x1ba214=function(_0x2c4fe3){while(--_0x2c4fe3){_0x2263cc['push'](_0x2263cc['shift']());}};_0x1ba214(++_0x2e1dc9);}(_0xccd3,0x16f));var _0x3ccd=function(_0x1b15a8,_0x202962){_0x1b15a8=_0x1b15a8-0x0;var _0x87e23=_0xccd3[_0x1b15a8];return _0x87e23;};'use strict';function QueueReport(){this[_0x3ccd('0x0')]=_0x3ccd('0x1');this[_0x3ccd('0x2')]='';this[_0x3ccd('0x3')]='';this[_0x3ccd('0x4')]='';this[_0x3ccd('0x5')]='';this['queuecallerjoinAt']=null;this[_0x3ccd('0x6')]=null;this['position']=0x1;this[_0x3ccd('0x7')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0x3ccd('0x8')]=![];this['queuecallercompleteAt']=null;this[_0x3ccd('0x9')]=![];this['queuecallerexitAt']=null;this[_0x3ccd('0xa')]=0x1;this[_0x3ccd('0xb')]='';this['connectedlinenum']='';this[_0x3ccd('0xc')]='';this[_0x3ccd('0xd')]='';this[_0x3ccd('0xe')]='';this[_0x3ccd('0xf')]='';this['priority']='';this[_0x3ccd('0x10')]=0x0;this['assigned']=![];this[_0x3ccd('0x11')]='';this[_0x3ccd('0x12')]='voice';this[_0x3ccd('0x13')]=null;this['mohtime']=0x0;this['variables']={};}module[_0x3ccd('0x14')]=QueueReport; \ No newline at end of file +var _0xd498=['connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','routealias','mohtime','exports','type','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','channel'];(function(_0x5460ff,_0x6b725){var _0x15b943=function(_0x26768f){while(--_0x26768f){_0x5460ff['push'](_0x5460ff['shift']());}};_0x15b943(++_0x6b725);}(_0xd498,0x165));var _0x8d49=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xd498[_0x4c7fb5];return _0x2e10ac;};'use strict';function QueueReport(){this[_0x8d49('0x0')]='inbound';this['uniqueid']='';this['calleridnum']='';this[_0x8d49('0x1')]='';this['queue']='';this[_0x8d49('0x2')]=null;this[_0x8d49('0x3')]=null;this[_0x8d49('0x4')]=0x1;this[_0x8d49('0x5')]=0x1;this[_0x8d49('0x6')]=![];this['queuecallerabandonAt']=null;this[_0x8d49('0x7')]=![];this[_0x8d49('0x8')]=null;this[_0x8d49('0x9')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0x8d49('0xa')]='';this[_0x8d49('0xb')]='';this[_0x8d49('0xc')]='';this[_0x8d49('0xd')]='';this[_0x8d49('0xe')]='';this[_0x8d49('0xf')]='';this[_0x8d49('0x10')]='';this[_0x8d49('0x11')]=0x0;this[_0x8d49('0x12')]=![];this[_0x8d49('0x13')]='';this['motionChannel']='voice';this[_0x8d49('0x14')]=null;this[_0x8d49('0x15')]=0x0;this['variables']={};}module[_0x8d49('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index ac8dcf3..a5844f1 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 _0x8848=['integrationTab','serverUrl','Configurations','exports','username','remoteUri','password','clientId','securityToken','type'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x8848,0x1b2));var _0x8884=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x8848[_0x4dc7b9];return _0x3ab114;};'use strict';function SalesforceAccount(_0x31b4cb){this['id']=_0x31b4cb['id']||0x0;this['name']=_0x31b4cb['name']||'';this[_0x8884('0x0')]=_0x31b4cb[_0x8884('0x0')]||'';this[_0x8884('0x1')]=_0x31b4cb[_0x8884('0x1')]||'';this[_0x8884('0x2')]=_0x31b4cb[_0x8884('0x2')]||'';this[_0x8884('0x3')]=_0x31b4cb[_0x8884('0x3')]||'';this['clientSecret']=_0x31b4cb['clientSecret']||'';this[_0x8884('0x4')]=_0x31b4cb[_0x8884('0x4')]||'';this[_0x8884('0x5')]=_0x31b4cb[_0x8884('0x5')]||_0x8884('0x6');this[_0x8884('0x7')]=_0x31b4cb[_0x8884('0x7')]||'';this['Configurations']=_0x31b4cb[_0x8884('0x8')]||{};}module[_0x8884('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x8549=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x38c0b2,_0x6a67a5){var _0x283c00=function(_0x259f03){while(--_0x259f03){_0x38c0b2['push'](_0x38c0b2['shift']());}};_0x283c00(++_0x6a67a5);}(_0x8549,0x113));var _0x9854=function(_0x17b5ce,_0x4e4b75){_0x17b5ce=_0x17b5ce-0x0;var _0x483ec5=_0x8549[_0x17b5ce];return _0x483ec5;};'use strict';function SalesforceAccount(_0x4205bb){this['id']=_0x4205bb['id']||0x0;this['name']=_0x4205bb['name']||'';this[_0x9854('0x0')]=_0x4205bb['username']||'';this[_0x9854('0x1')]=_0x4205bb['remoteUri']||'';this[_0x9854('0x2')]=_0x4205bb[_0x9854('0x2')]||'';this[_0x9854('0x3')]=_0x4205bb[_0x9854('0x3')]||'';this[_0x9854('0x4')]=_0x4205bb['clientSecret']||'';this['securityToken']=_0x4205bb[_0x9854('0x5')]||'';this[_0x9854('0x6')]=_0x4205bb['type']||_0x9854('0x7');this['serverUrl']=_0x4205bb[_0x9854('0x8')]||'';this[_0x9854('0x9')]=_0x4205bb[_0x9854('0x9')]||{};}module[_0x9854('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 c8a4288..cb4849c 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 _0x5399=['password','remoteUri','serverUrl','exports','name','username'];(function(_0x4c3ffe,_0x457374){var _0x28d3eb=function(_0x3ae2a3){while(--_0x3ae2a3){_0x4c3ffe['push'](_0x4c3ffe['shift']());}};_0x28d3eb(++_0x457374);}(_0x5399,0xe2));var _0x9539=function(_0x39782f,_0x4aa931){_0x39782f=_0x39782f-0x0;var _0x47768c=_0x5399[_0x39782f];return _0x47768c;};'use strict';function ServicenowAccount(_0x291b1f){this['id']=_0x291b1f['id']||0x0;this[_0x9539('0x0')]=_0x291b1f[_0x9539('0x0')]||'';this[_0x9539('0x1')]=_0x291b1f['username']||'';this['password']=_0x291b1f[_0x9539('0x2')]||'';this[_0x9539('0x3')]=_0x291b1f[_0x9539('0x3')]||'';this['serverUrl']=_0x291b1f[_0x9539('0x4')]||'';this['Configurations']=_0x291b1f['Configurations']||{};}module[_0x9539('0x5')]=ServicenowAccount; \ No newline at end of file +var _0xff6f=['exports','name','password','remoteUri','serverUrl','Configurations'];(function(_0x5d4db8,_0x4ad01b){var _0x415548=function(_0x7ae456){while(--_0x7ae456){_0x5d4db8['push'](_0x5d4db8['shift']());}};_0x415548(++_0x4ad01b);}(_0xff6f,0xeb));var _0xfff6=function(_0xd0ebf2,_0x9596d9){_0xd0ebf2=_0xd0ebf2-0x0;var _0x47ec74=_0xff6f[_0xd0ebf2];return _0x47ec74;};'use strict';function ServicenowAccount(_0x536abb){this['id']=_0x536abb['id']||0x0;this[_0xfff6('0x0')]=_0x536abb[_0xfff6('0x0')]||'';this['username']=_0x536abb['username']||'';this[_0xfff6('0x1')]=_0x536abb[_0xfff6('0x1')]||'';this[_0xfff6('0x2')]=_0x536abb['remoteUri']||'';this['serverUrl']=_0x536abb[_0xfff6('0x3')]||'';this[_0xfff6('0x4')]=_0x536abb['Configurations']||{};}module[_0xfff6('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 943b430..26f9180 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 _0x5b2d=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x5cfce3,_0x326c9b){var _0x5bc798=function(_0x1b0002){while(--_0x1b0002){_0x5cfce3['push'](_0x5cfce3['shift']());}};_0x5bc798(++_0x326c9b);}(_0x5b2d,0x17e));var _0xd5b2=function(_0x1dde7,_0x51ce40){_0x1dde7=_0x1dde7-0x0;var _0x3fed9f=_0x5b2d[_0x1dde7];return _0x3fed9f;};'use strict';function SugarcrmAccount(_0x5acdf6){this['id']=_0x5acdf6['id']||0x0;this[_0xd5b2('0x0')]=_0x5acdf6[_0xd5b2('0x0')]||'';this[_0xd5b2('0x1')]=_0x5acdf6['username']||'';this['password']=_0x5acdf6[_0xd5b2('0x2')]||'';this[_0xd5b2('0x3')]=_0x5acdf6[_0xd5b2('0x3')]||'';this[_0xd5b2('0x4')]=_0x5acdf6[_0xd5b2('0x4')]||'';this['Configurations']=_0x5acdf6[_0xd5b2('0x5')]||{};}module[_0xd5b2('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x2f7a=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x285b48,_0x41b4c6){var _0x5020e9=function(_0x537f18){while(--_0x537f18){_0x285b48['push'](_0x285b48['shift']());}};_0x5020e9(++_0x41b4c6);}(_0x2f7a,0x151));var _0xa2f7=function(_0x2f71f3,_0x13130a){_0x2f71f3=_0x2f71f3-0x0;var _0x265599=_0x2f7a[_0x2f71f3];return _0x265599;};'use strict';function SugarcrmAccount(_0x2215a5){this['id']=_0x2215a5['id']||0x0;this[_0xa2f7('0x0')]=_0x2215a5['name']||'';this['username']=_0x2215a5[_0xa2f7('0x1')]||'';this[_0xa2f7('0x2')]=_0x2215a5[_0xa2f7('0x2')]||'';this[_0xa2f7('0x3')]=_0x2215a5[_0xa2f7('0x3')]||'';this[_0xa2f7('0x4')]=_0x2215a5[_0xa2f7('0x4')]||'';this[_0xa2f7('0x5')]=_0x2215a5[_0xa2f7('0x5')]||{};}module[_0xa2f7('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 28d54ac..36158a4 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 _0x9a6a=['status','address','name','accountcode','unknown','stateTime'];(function(_0x538bf3,_0x22782a){var _0x1673fd=function(_0x319663){while(--_0x319663){_0x538bf3['push'](_0x538bf3['shift']());}};_0x1673fd(++_0x22782a);}(_0x9a6a,0xce));var _0xa9a6=function(_0x2b128e,_0x9f8dd0){_0x2b128e=_0x2b128e-0x0;var _0x3822a3=_0x9a6a[_0x2b128e];return _0x3822a3;};'use strict';function Telephone(_0x1d1505){this['id']=_0x1d1505['id']||0x0;this[_0xa9a6('0x0')]=_0x1d1505['name']||'';this[_0xa9a6('0x1')]=_0x1d1505[_0xa9a6('0x1')]||'';this['state']=_0xa9a6('0x2');this[_0xa9a6('0x3')]=0x0;this[_0xa9a6('0x4')]=_0xa9a6('0x2');this[_0xa9a6('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x20fa=['stateTime','unknown','exports','accountcode','state'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x20fa,0x166));var _0xa20f=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0x20fa[_0x1fc18b];return _0x16a351;};'use strict';function Telephone(_0x34193c){this['id']=_0x34193c['id']||0x0;this['name']=_0x34193c['name']||'';this[_0xa20f('0x0')]=_0x34193c['accountcode']||'';this[_0xa20f('0x1')]='unknown';this[_0xa20f('0x2')]=0x0;this['status']=_0xa20f('0x3');this['address']='';}module[_0xa20f('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 3dbb6ed..bc98221 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x40d8c2,_0x4d5f1c){var _0x5a396b=function(_0x522202){while(--_0x522202){_0x40d8c2['push'](_0x40d8c2['shift']());}};_0x5a396b(++_0x4d5f1c);}(_0xb10b,0x12a));var _0xbb10=function(_0x13cbfb,_0x5b397d){_0x13cbfb=_0x13cbfb-0x0;var _0x2b4439=_0xb10b[_0x13cbfb];return _0x2b4439;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x1be957,_0x382ecd){var _0x3a9a76=function(_0x130ca1){while(--_0x130ca1){_0x1be957['push'](_0x1be957['shift']());}};_0x3a9a76(++_0x382ecd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 6b1b8a8..addbae9 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x194fe7,_0x4dec49){var _0x305ed2=function(_0x587ccb){while(--_0x587ccb){_0x194fe7['push'](_0x194fe7['shift']());}};_0x305ed2(++_0x4dec49);}(_0xb10b,0x12a));var _0xbb10=function(_0x38767a,_0x530907){_0x38767a=_0x38767a-0x0;var _0x377de8=_0xb10b[_0x38767a];return _0x377de8;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file +var _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x294f82,_0x2d002a){var _0x4f1455=function(_0x303a20){while(--_0x303a20){_0x294f82['push'](_0x294f82['shift']());}};_0x4f1455(++_0x2d002a);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2fd4f1,_0x28b695){_0x2fd4f1=_0x2fd4f1-0x0;var _0x228eb7=_0x9ffd[_0x2fd4f1];return _0x228eb7;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 6393015..7e3f484 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 _0x7238=['domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','unknown','stateTime','registry','indexOf','host','port'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7238,0x18d));var _0x8723=function(_0xa5e664,_0x4ddb13){_0xa5e664=_0xa5e664-0x0;var _0x25088e=_0x7238[_0xa5e664];return _0x25088e;};'use strict';function Trunk(_0x901bab){this['id']=_0x901bab['id']||0x0;this['active']=_0x901bab[_0x8723('0x0')]||![];this['name']=_0x901bab[_0x8723('0x1')]||'';this['state']=_0x8723('0x2');this[_0x8723('0x3')]=0x0;this['status']='unknown';this[_0x8723('0x4')]=_0x901bab[_0x8723('0x4')]&&_0x901bab[_0x8723('0x4')][_0x8723('0x5')](':')?_0x901bab[_0x8723('0x4')]['split'](':')[0x0]:'';this[_0x8723('0x6')]='';this[_0x8723('0x7')]='';this['domain']='';this[_0x8723('0x8')]='';this[_0x8723('0x9')]='';this[_0x8723('0xa')]=_0x8723('0x2');this[_0x8723('0xb')]='';this[_0x8723('0xc')]='';this[_0x8723('0xd')]=_0x901bab['defaultuser']||'';}module[_0x8723('0xe')]=Trunk; \ No newline at end of file +var _0x985d=['registrationtime','exports','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domain','domainport'];(function(_0x3e347c,_0x1a7328){var _0x5bbf89=function(_0x460d19){while(--_0x460d19){_0x3e347c['push'](_0x3e347c['shift']());}};_0x5bbf89(++_0x1a7328);}(_0x985d,0x18a));var _0xd985=function(_0x283fba,_0x338553){_0x283fba=_0x283fba-0x0;var _0xe7f615=_0x985d[_0x283fba];return _0xe7f615;};'use strict';function Trunk(_0x2a4e5b){this['id']=_0x2a4e5b['id']||0x0;this['active']=_0x2a4e5b['active']||![];this[_0xd985('0x0')]=_0x2a4e5b[_0xd985('0x0')]||'';this[_0xd985('0x1')]=_0xd985('0x2');this[_0xd985('0x3')]=0x0;this[_0xd985('0x4')]=_0xd985('0x2');this['registry']=_0x2a4e5b[_0xd985('0x5')]&&_0x2a4e5b['registry'][_0xd985('0x6')](':')?_0x2a4e5b[_0xd985('0x5')][_0xd985('0x7')](':')[0x0]:'';this[_0xd985('0x8')]='';this[_0xd985('0x9')]='';this[_0xd985('0xa')]='';this[_0xd985('0xb')]='';this['refresh']='';this['stateRegistry']='unknown';this[_0xd985('0xc')]='';this['address']='';this['defaultuser']=_0x2a4e5b['defaultuser']||'';}module[_0xd985('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 55e31d0..adf5d7c 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 _0x658a=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x1e8889,_0x345a71){var _0x470dff=function(_0x2800c9){while(--_0x2800c9){_0x1e8889['push'](_0x1e8889['shift']());}};_0x470dff(++_0x345a71);}(_0x658a,0xf2));var _0xa658=function(_0xe6dd67,_0x1d295e){_0xe6dd67=_0xe6dd67-0x0;var _0x5d5ef5=_0x658a[_0xe6dd67];return _0x5d5ef5;};'use strict';function voiceExtension(_0x2f5f57){this['id']=_0x2f5f57['id']||0x0;this[_0xa658('0x0')]=_0x2f5f57['exten']||'';this['recordingFormat']=_0x2f5f57[_0xa658('0x1')]||_0xa658('0x2');this[_0xa658('0x3')]=_0x2f5f57['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x639f=['exten','recordingFormat','none'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x639f,0x1c8));var _0xf639=function(_0x477322,_0xef9f38){_0x477322=_0x477322-0x0;var _0x70453b=_0x639f[_0x477322];return _0x70453b;};'use strict';function voiceExtension(_0x3e70f1){this['id']=_0x3e70f1['id']||0x0;this[_0xf639('0x0')]=_0x3e70f1['exten']||'';this[_0xf639('0x1')]=_0x3e70f1['recordingFormat']||_0xf639('0x2');this['mandatoryDisposition']=_0x3e70f1['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 5d27771..2bfd8c9 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 _0x5d58=['predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','linear','random','roundrobin','rrmemory','wrandom','name','monitor_format','type','inbound','total','answered','sumDuration','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','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','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5d58,0x187));var _0x85d5=function(_0x267abd,_0x42537a){_0x267abd=_0x267abd-0x0;var _0x3d219a=_0x5d58[_0x267abd];return _0x3d219a;};'use strict';var monitorFormat={'wav':'wav','wav49':'wav49','gsm':'gsm'};var strategy={'fewestcalls':'fewestcalls','leastrecent':'leastrecent','linear':_0x85d5('0x0'),'random':_0x85d5('0x1'),'ringall':'ringall','rr':_0x85d5('0x2'),'rrmemory':_0x85d5('0x3'),'rrordered':'rrordered','wrandom':_0x85d5('0x4')};function VoiceQueue(_0x2d457a){this['id']=_0x2d457a['id']||0x0;this[_0x85d5('0x5')]=_0x2d457a[_0x85d5('0x5')]||'';this['monitor_format']=_0x2d457a[_0x85d5('0x6')]||'';this[_0x85d5('0x7')]=_0x2d457a['type']||_0x85d5('0x8');this['waiting']=0x0;this[_0x85d5('0x9')]=0x0;this[_0x85d5('0xa')]=0x0;this[_0x85d5('0xb')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0x85d5('0xc')]=0x0;this[_0x85d5('0xd')]=0x0;this[_0x85d5('0xe')]=0x0;this[_0x85d5('0xf')]=0x0;this[_0x85d5('0x10')]=0x0;this[_0x85d5('0x11')]=0x0;this[_0x85d5('0x12')]=0x0;this['onHold']=0x0;this['paused']=0x0;this['ringing']=0x0;this[_0x85d5('0x13')]=0x0;this[_0x85d5('0x14')]=0x0;this[_0x85d5('0x15')]=0x0;this[_0x85d5('0x16')]=0x0;this[_0x85d5('0x17')]=_0x2d457a[_0x85d5('0x17')]||![];this[_0x85d5('0x18')]=_0x2d457a['acwTimeout']||0xa;this[_0x85d5('0x19')]=_0x2d457a[_0x85d5('0x19')]||'no';this[_0x85d5('0x1a')]=!![];this[_0x85d5('0x1b')]='';this[_0x85d5('0x1c')]='';this[_0x85d5('0x1d')]=0x0;this[_0x85d5('0x1e')]=0x0;this[_0x85d5('0x1f')]=_0x2d457a[_0x85d5('0x1f')]||null;this[_0x85d5('0x20')]=_0x2d457a[_0x85d5('0x20')]?_0x2d457a[_0x85d5('0x20')]:null;this[_0x85d5('0x21')]=_0x2d457a[_0x85d5('0x21')];this[_0x85d5('0x22')]=_0x2d457a[_0x85d5('0x22')]||_0x85d5('0x23');this[_0x85d5('0x24')]=_0x2d457a['dialLimitChannel']||0x0;this[_0x85d5('0x25')]=_0x2d457a[_0x85d5('0x25')]||0x0;this['dialPowerLevel']=_0x2d457a[_0x85d5('0x26')]||0x1;this[_0x85d5('0x27')]=_0x2d457a['dialPredictiveOptimization']||'dropRate';this[_0x85d5('0x28')]=_0x2d457a['dialPredictiveOptimizationPercentage']||0.03;this[_0x85d5('0x29')]=_0x2d457a['dialPredictiveInterval']||0x258;this[_0x85d5('0x2a')]=_0x2d457a[_0x85d5('0x2a')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x2d457a['dialOriginateCallerIdNumber']||'anonymous';this[_0x85d5('0x2b')]=_0x2d457a[_0x85d5('0x2b')]||0x1e;this[_0x85d5('0x2c')]=_0x2d457a[_0x85d5('0x2c')]||_0x85d5('0x2d');this[_0x85d5('0x2e')]=_0x2d457a['dialQueueTimeout']||0x3;this[_0x85d5('0x2f')]=_0x2d457a['dialQueueProject']||undefined;this[_0x85d5('0x30')]=_0x2d457a[_0x85d5('0x30')]||0x3;this[_0x85d5('0x31')]=_0x2d457a['dialCongestionRetryFrequency']||0x96;this[_0x85d5('0x32')]=_0x2d457a[_0x85d5('0x32')]||0x3;this[_0x85d5('0x33')]=_0x2d457a[_0x85d5('0x33')]||0x96;this[_0x85d5('0x34')]=_0x2d457a['dialNoAnswerMaxRetry']||0x3;this[_0x85d5('0x35')]=_0x2d457a[_0x85d5('0x35')]||0x96;this[_0x85d5('0x36')]=_0x2d457a[_0x85d5('0x36')]||0x3;this[_0x85d5('0x37')]=_0x2d457a['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x2d457a[_0x85d5('0x38')]||0x3;this[_0x85d5('0x39')]=_0x2d457a[_0x85d5('0x39')]||0x96;this[_0x85d5('0x3a')]=_0x2d457a[_0x85d5('0x3a')]||0x3;this['dialAbandonedRetryFrequency']=_0x2d457a[_0x85d5('0x3b')]||0x96;this[_0x85d5('0x3c')]=_0x2d457a['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x2d457a[_0x85d5('0x3d')]||0x96;this[_0x85d5('0x3e')]=_0x2d457a['dialAgentRejectMaxRetry']||0x3;this[_0x85d5('0x3f')]=_0x2d457a['dialAgentRejectRetryFrequency']||0x96;this[_0x85d5('0x40')]=_0x2d457a[_0x85d5('0x40')]||0x3;this['dialGlobalMaxRetry']=_0x2d457a[_0x85d5('0x41')]||0x4;this[_0x85d5('0x42')]=_0x2d457a[_0x85d5('0x42')]?_0x2d457a[_0x85d5('0x42')]:undefined;this['TrunkBackup']=_0x2d457a['TrunkBackup']?_0x2d457a[_0x85d5('0x43')]:undefined;this[_0x85d5('0x44')]=_0x2d457a[_0x85d5('0x44')]||undefined;this[_0x85d5('0x45')]=_0x2d457a[_0x85d5('0x45')]?_0x2d457a[_0x85d5('0x45')]:undefined;this[_0x85d5('0x46')]=_0x2d457a[_0x85d5('0x46')]||_0x85d5('0x47');this['dialRandomLastDigitCallerIdNumber']=_0x2d457a['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x85d5('0x48')]=_0x2d457a[_0x85d5('0x48')]||undefined;this[_0x85d5('0x49')]=strategy[_0x2d457a[_0x85d5('0x49')]];this[_0x85d5('0x4a')]=!![];this[_0x85d5('0x4b')]=_0x2d457a[_0x85d5('0x4b')]||![];this[_0x85d5('0x4c')]=_0x2d457a['dialAMDInitialSilence'];this[_0x85d5('0x4d')]=_0x2d457a[_0x85d5('0x4d')];this[_0x85d5('0x4e')]=_0x2d457a[_0x85d5('0x4e')];this['dialAMDTotalAnalysisTime']=_0x2d457a[_0x85d5('0x4f')];this[_0x85d5('0x50')]=_0x2d457a[_0x85d5('0x50')];this[_0x85d5('0x51')]=_0x2d457a['dialAMDBetweenWordsSilence'];this[_0x85d5('0x52')]=_0x2d457a['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x2d457a[_0x85d5('0x53')];this['dialAMDMaximumWordLength']=_0x2d457a[_0x85d5('0x54')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x85d5('0x55')]=_0x2d457a[_0x85d5('0x55')];this[_0x85d5('0x56')]=0x0;this[_0x85d5('0x57')]=0x0;this[_0x85d5('0x58')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x85d5('0x59')]=0x0;this[_0x85d5('0x5a')]=0x0;this[_0x85d5('0x5b')]=0x0;this[_0x85d5('0x5c')]=0x0;this[_0x85d5('0x5d')]=0x0;this[_0x85d5('0x5e')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0x85d5('0x5f')]=0x0;this['startProgressive']=undefined;this[_0x85d5('0x60')]=undefined;this[_0x85d5('0x61')]=undefined;this[_0x85d5('0x62')]=1.05;this[_0x85d5('0x63')]=0x0;this[_0x85d5('0x64')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x85d5('0x65')]=0x0;this[_0x85d5('0x66')]=0x0;this[_0x85d5('0x67')]=0x0;this[_0x85d5('0x68')]=0x0;this[_0x85d5('0x69')]=_0x2d457a[_0x85d5('0x6a')]||0x14;this[_0x85d5('0x6b')]=_0x2d457a[_0x85d5('0x6a')]||0xa;this[_0x85d5('0x6c')]=0x0;this[_0x85d5('0x6d')]=0x0;this[_0x85d5('0x6e')]=0x1;this[_0x85d5('0x6f')]=0x0;this[_0x85d5('0x70')]=0x0;this[_0x85d5('0x71')]=0x0;this[_0x85d5('0x72')]=0x0;this[_0x85d5('0x73')]=_0x2d457a[_0x85d5('0x73')]||0x1e;this['dialRecallInQueue']=_0x2d457a['dialRecallInQueue']||![];this[_0x85d5('0x74')]=!!_0x2d457a[_0x85d5('0x74')]||![];this[_0x85d5('0x75')]=!!_0x2d457a[_0x85d5('0x75')]||![];this[_0x85d5('0x76')]=_0x2d457a[_0x85d5('0x76')]||undefined;this['dialAgiAfterHangupClient']=_0x2d457a[_0x85d5('0x77')]||![];this['dialAgiAfterHangupAgent']=_0x2d457a['dialAgiAfterHangupAgent']||![];this[_0x85d5('0x6')]=monitorFormat[_0x2d457a[_0x85d5('0x6')]]?monitorFormat[_0x2d457a[_0x85d5('0x6')]]:undefined;this[_0x85d5('0x78')]=_0x2d457a[_0x85d5('0x78')]||![];this['mandatoryDispositionPause']=_0x2d457a[_0x85d5('0x79')]?_0x2d457a['mandatoryDispositionPause']:undefined;this[_0x85d5('0x7a')]=![];}module[_0x85d5('0x7b')]=VoiceQueue; \ No newline at end of file +var _0xdd41=['invalid','loggedIn','notInUse','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav','wav49','gsm','fewestcalls','linear','random','rrmemory','rrordered','name','monitor_format','waiting','answered','sumDuration','sumHoldTime','sumBillable','abandoned','busy','inUse'];(function(_0x5e7fe0,_0x48f825){var _0x4a38d6=function(_0x1d5a28){while(--_0x1d5a28){_0x5e7fe0['push'](_0x5e7fe0['shift']());}};_0x4a38d6(++_0x48f825);}(_0xdd41,0x1f2));var _0x1dd4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd41[_0x3dd15e];return _0x231fd0;};'use strict';var monitorFormat={'wav':_0x1dd4('0x0'),'wav49':_0x1dd4('0x1'),'gsm':_0x1dd4('0x2')};var strategy={'fewestcalls':_0x1dd4('0x3'),'leastrecent':'leastrecent','linear':_0x1dd4('0x4'),'random':_0x1dd4('0x5'),'ringall':'ringall','rr':'roundrobin','rrmemory':_0x1dd4('0x6'),'rrordered':_0x1dd4('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0xaa0c85){this['id']=_0xaa0c85['id']||0x0;this[_0x1dd4('0x8')]=_0xaa0c85['name']||'';this[_0x1dd4('0x9')]=_0xaa0c85['monitor_format']||'';this['type']=_0xaa0c85['type']||'inbound';this[_0x1dd4('0xa')]=0x0;this['total']=0x0;this[_0x1dd4('0xb')]=0x0;this[_0x1dd4('0xc')]=0x0;this[_0x1dd4('0xd')]=0x0;this[_0x1dd4('0xe')]=0x0;this['unmanaged']=0x0;this[_0x1dd4('0xf')]=0x0;this['available']=0x0;this[_0x1dd4('0x10')]=0x0;this[_0x1dd4('0x11')]=0x0;this[_0x1dd4('0x12')]=0x0;this[_0x1dd4('0x13')]=0x0;this[_0x1dd4('0x14')]=0x0;this['onHold']=0x0;this[_0x1dd4('0x15')]=0x0;this[_0x1dd4('0x16')]=0x0;this[_0x1dd4('0x17')]=0x0;this[_0x1dd4('0x18')]=0x0;this[_0x1dd4('0x19')]=0x0;this[_0x1dd4('0x1a')]=0x0;this[_0x1dd4('0x1b')]=_0xaa0c85['acw']||![];this[_0x1dd4('0x1c')]=_0xaa0c85[_0x1dd4('0x1c')]||0xa;this[_0x1dd4('0x1d')]=_0xaa0c85[_0x1dd4('0x1d')]||'no';this[_0x1dd4('0x1e')]=!![];this[_0x1dd4('0x1f')]='';this[_0x1dd4('0x20')]='';this[_0x1dd4('0x21')]=0x0;this[_0x1dd4('0x22')]=0x0;this[_0x1dd4('0x23')]=_0xaa0c85['dialTimezone']||null;this['dialGlobalInterval']=_0xaa0c85[_0x1dd4('0x24')]?_0xaa0c85[_0x1dd4('0x24')]:null;this[_0x1dd4('0x25')]=_0xaa0c85[_0x1dd4('0x25')];this[_0x1dd4('0x26')]=_0xaa0c85['dialMethod']||'progressive';this[_0x1dd4('0x27')]=_0xaa0c85['dialLimitChannel']||0x0;this[_0x1dd4('0x28')]=_0xaa0c85[_0x1dd4('0x28')]||0x0;this[_0x1dd4('0x29')]=_0xaa0c85[_0x1dd4('0x29')]||0x1;this[_0x1dd4('0x2a')]=_0xaa0c85[_0x1dd4('0x2a')]||_0x1dd4('0x2b');this[_0x1dd4('0x2c')]=_0xaa0c85['dialPredictiveOptimizationPercentage']||0.03;this[_0x1dd4('0x2d')]=_0xaa0c85['dialPredictiveInterval']||0x258;this[_0x1dd4('0x2e')]=_0xaa0c85[_0x1dd4('0x2e')]||_0x1dd4('0x2f');this[_0x1dd4('0x30')]=_0xaa0c85[_0x1dd4('0x30')]||_0x1dd4('0x2f');this['dialOriginateTimeout']=_0xaa0c85[_0x1dd4('0x31')]||0x1e;this[_0x1dd4('0x32')]=_0xaa0c85[_0x1dd4('0x32')]||_0x1dd4('0x33');this[_0x1dd4('0x34')]=_0xaa0c85[_0x1dd4('0x34')]||0x3;this[_0x1dd4('0x35')]=_0xaa0c85[_0x1dd4('0x35')]||undefined;this['dialCongestionMaxRetry']=_0xaa0c85['dialCongestionMaxRetry']||0x3;this[_0x1dd4('0x36')]=_0xaa0c85[_0x1dd4('0x36')]||0x96;this[_0x1dd4('0x37')]=_0xaa0c85['dialBusyMaxRetry']||0x3;this[_0x1dd4('0x38')]=_0xaa0c85[_0x1dd4('0x38')]||0x96;this['dialNoAnswerMaxRetry']=_0xaa0c85[_0x1dd4('0x39')]||0x3;this['dialNoAnswerRetryFrequency']=_0xaa0c85[_0x1dd4('0x3a')]||0x96;this[_0x1dd4('0x3b')]=_0xaa0c85[_0x1dd4('0x3b')]||0x3;this[_0x1dd4('0x3c')]=_0xaa0c85[_0x1dd4('0x3c')]||0x96;this[_0x1dd4('0x3d')]=_0xaa0c85[_0x1dd4('0x3d')]||0x3;this['dialDropRetryFrequency']=_0xaa0c85[_0x1dd4('0x3e')]||0x96;this[_0x1dd4('0x3f')]=_0xaa0c85[_0x1dd4('0x3f')]||0x3;this[_0x1dd4('0x40')]=_0xaa0c85['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0xaa0c85[_0x1dd4('0x41')]||0x3;this[_0x1dd4('0x42')]=_0xaa0c85[_0x1dd4('0x42')]||0x96;this[_0x1dd4('0x43')]=_0xaa0c85[_0x1dd4('0x43')]||0x3;this[_0x1dd4('0x44')]=_0xaa0c85[_0x1dd4('0x44')]||0x96;this['callAdditionalPhoneAfterMin']=_0xaa0c85[_0x1dd4('0x45')]||0x3;this[_0x1dd4('0x46')]=_0xaa0c85[_0x1dd4('0x46')]||0x4;this['Trunk']=_0xaa0c85[_0x1dd4('0x47')]?_0xaa0c85['Trunk']:undefined;this['TrunkBackup']=_0xaa0c85[_0x1dd4('0x48')]?_0xaa0c85[_0x1dd4('0x48')]:undefined;this[_0x1dd4('0x49')]=_0xaa0c85['dialPrefix']||undefined;this[_0x1dd4('0x4a')]=_0xaa0c85['Interval']?_0xaa0c85['Interval']:undefined;this['dialOrderByScheduledAt']=_0xaa0c85[_0x1dd4('0x4b')]||_0x1dd4('0x4c');this['dialRandomLastDigitCallerIdNumber']=_0xaa0c85['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0xaa0c85[_0x1dd4('0x4d')]||undefined;this[_0x1dd4('0x4e')]=strategy[_0xaa0c85[_0x1dd4('0x4e')]];this[_0x1dd4('0x4f')]=!![];this['dialAMDActive']=_0xaa0c85[_0x1dd4('0x50')]||![];this['dialAMDInitialSilence']=_0xaa0c85[_0x1dd4('0x51')];this[_0x1dd4('0x52')]=_0xaa0c85['dialAMDGreeting'];this[_0x1dd4('0x53')]=_0xaa0c85[_0x1dd4('0x53')];this['dialAMDTotalAnalysisTime']=_0xaa0c85[_0x1dd4('0x54')];this[_0x1dd4('0x55')]=_0xaa0c85[_0x1dd4('0x55')];this[_0x1dd4('0x56')]=_0xaa0c85[_0x1dd4('0x56')];this[_0x1dd4('0x57')]=_0xaa0c85['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0xaa0c85[_0x1dd4('0x58')];this[_0x1dd4('0x59')]=_0xaa0c85[_0x1dd4('0x59')];this[_0x1dd4('0x5a')]=0x0;this['pTalking']=0x0;this[_0x1dd4('0x5b')]=_0xaa0c85[_0x1dd4('0x5b')];this[_0x1dd4('0x5c')]=0x0;this[_0x1dd4('0x5d')]=0x0;this[_0x1dd4('0x5e')]=0x0;this[_0x1dd4('0x5f')]=0x0;this[_0x1dd4('0x60')]=0x0;this[_0x1dd4('0x61')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x1dd4('0x62')]=0x0;this[_0x1dd4('0x63')]=0x0;this[_0x1dd4('0x64')]=0x0;this[_0x1dd4('0x65')]=0x0;this[_0x1dd4('0x66')]=0x0;this[_0x1dd4('0x67')]=0x0;this[_0x1dd4('0x68')]=0x0;this[_0x1dd4('0x69')]=undefined;this[_0x1dd4('0x6a')]=undefined;this[_0x1dd4('0x6b')]=undefined;this[_0x1dd4('0x6c')]=1.05;this[_0x1dd4('0x6d')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x1dd4('0x6e')]=0x0;this[_0x1dd4('0x6f')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x1dd4('0x70')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x1dd4('0x71')]=0x0;this[_0x1dd4('0x72')]=_0xaa0c85['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x1dd4('0x73')]=_0xaa0c85[_0x1dd4('0x74')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x1dd4('0x75')]=0x0;this['erlangCallToSecond']=0x0;this[_0x1dd4('0x76')]=0x0;this['erlangBusyFactor']=0x0;this[_0x1dd4('0x77')]=_0xaa0c85[_0x1dd4('0x77')]||0x1e;this['dialRecallInQueue']=_0xaa0c85[_0x1dd4('0x78')]||![];this['dialPreviewAutoRecallMe']=!!_0xaa0c85[_0x1dd4('0x79')]||![];this[_0x1dd4('0x7a')]=!!_0xaa0c85[_0x1dd4('0x7a')]||![];this[_0x1dd4('0x7b')]=_0xaa0c85[_0x1dd4('0x7b')]||undefined;this[_0x1dd4('0x7c')]=_0xaa0c85[_0x1dd4('0x7c')]||![];this[_0x1dd4('0x7d')]=_0xaa0c85[_0x1dd4('0x7d')]||![];this[_0x1dd4('0x9')]=monitorFormat[_0xaa0c85[_0x1dd4('0x9')]]?monitorFormat[_0xaa0c85[_0x1dd4('0x9')]]:undefined;this['mandatoryDisposition']=_0xaa0c85[_0x1dd4('0x7e')]||![];this[_0x1dd4('0x7f')]=_0xaa0c85[_0x1dd4('0x7f')]?_0xaa0c85[_0x1dd4('0x7f')]:undefined;this[_0x1dd4('0x80')]=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index f4adfaa..ee1d722 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 _0x34aa=['message','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','status','booked','keys','dialer','exten','some','compareToOutboundQueue','statusMessage','updateReportFromOutboundQueue','available','loggedInDb','paused','ringing','talking','answered','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumBillable','sumDuration','total','waiting','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive'];(function(_0x6c0b0a,_0x496391){var _0x5f456a=function(_0x5ae918){while(--_0x5ae918){_0x6c0b0a['push'](_0x6c0b0a['shift']());}};_0x5f456a(++_0x496391);}(_0x34aa,0x171));var _0xa34a=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0x34aa[_0x52e68e];return _0x3211a4;};'use strict';var INBOUND_COUNTERS=[_0xa34a('0x0'),'loggedIn',_0xa34a('0x1'),_0xa34a('0x2'),_0xa34a('0x3'),_0xa34a('0x4'),'waiting'];var OUTBOUND_COUNTERS=[_0xa34a('0x0'),_0xa34a('0x5'),_0xa34a('0x6'),_0xa34a('0x7'),_0xa34a('0x1'),_0xa34a('0x8'),_0xa34a('0x9'),_0xa34a('0xa'),_0xa34a('0xb'),_0xa34a('0xc'),_0xa34a('0xd'),'outboundNoAnswerCallsDay',_0xa34a('0xe'),_0xa34a('0xf'),_0xa34a('0x10'),_0xa34a('0x11'),_0xa34a('0x2'),'pTalking',_0xa34a('0x4'),_0xa34a('0x12'),_0xa34a('0x13'),_0xa34a('0x14'),_0xa34a('0x15')];function VoiceQueueSummary(_0x20b219){this['id']=_0x20b219['id'];this[_0xa34a('0x16')]=_0x20b219['name'];this[_0xa34a('0x17')]=_0x20b219[_0xa34a('0x17')];this[_0xa34a('0x18')]=_0x20b219['abandoned']||0x0;this[_0xa34a('0x5')]=_0x20b219[_0xa34a('0x5')]||0x0;this['available']=_0x20b219[_0xa34a('0x0')]||0x0;this[_0xa34a('0x19')]=_0x20b219['busy']||0x0;this[_0xa34a('0x6')]=_0x20b219[_0xa34a('0x6')]||0x0;this[_0xa34a('0x1a')]=_0x20b219[_0xa34a('0x1a')]||0x0;this[_0xa34a('0x7')]=_0x20b219['loggedIn']||0x0;this[_0xa34a('0x1')]=_0x20b219['loggedInDb']||0x0;this[_0xa34a('0x1b')]=_0x20b219[_0xa34a('0x1b')]||0x0;this[_0xa34a('0x1c')]=_0x20b219[_0xa34a('0x1c')]||0x0;this['paused']=_0x20b219[_0xa34a('0x2')]||0x0;this[_0xa34a('0x3')]=_0x20b219[_0xa34a('0x3')]||0x0;this[_0xa34a('0x1d')]=_0x20b219[_0xa34a('0x1d')];this['sumBillable']=_0x20b219[_0xa34a('0x12')];this[_0xa34a('0x13')]=_0x20b219[_0xa34a('0x13')];this['sumHoldTime']=_0x20b219[_0xa34a('0x1e')]||0x0;this[_0xa34a('0x4')]=_0x20b219[_0xa34a('0x4')]||0x0;this[_0xa34a('0x14')]=_0x20b219[_0xa34a('0x14')]||0x0;this[_0xa34a('0x1f')]=_0x20b219['type'];this[_0xa34a('0x20')]=_0x20b219[_0xa34a('0x20')]||0x0;this['unknown']=_0x20b219[_0xa34a('0x21')]||0x0;this[_0xa34a('0x22')]=_0x20b219[_0xa34a('0x22')]||0x0;this[_0xa34a('0x15')]=_0x20b219[_0xa34a('0x15')]||0x0;if(_0x20b219[_0xa34a('0x1f')]===_0xa34a('0x23')){this['pTalking']=_0x20b219[_0xa34a('0x24')]||0x0;this[_0xa34a('0x25')]=_0x20b219[_0xa34a('0x25')];this[_0xa34a('0x26')]=_0x20b219['dialMethod'];this[_0xa34a('0x27')]=_0x20b219[_0xa34a('0x27')];this[_0xa34a('0x28')]=_0x20b219[_0xa34a('0x28')];this['dialOriginateTimeout']=_0x20b219[_0xa34a('0x29')];this[_0xa34a('0x2a')]=_0x20b219[_0xa34a('0x2a')];this[_0xa34a('0x2b')]=_0x20b219['temp'];this[_0xa34a('0x2c')]=_0x20b219[_0xa34a('0x2c')];this[_0xa34a('0xa')]=_0x20b219[_0xa34a('0xa')];this['outboundBlacklistCallsDay']=_0x20b219[_0xa34a('0xb')];this[_0xa34a('0xc')]=_0x20b219['outboundBusyCallsDay'];this[_0xa34a('0xd')]=_0x20b219[_0xa34a('0xd')];this['outboundDropCallsDayACS']=_0x20b219['outboundDropCallsDayACS'];this[_0xa34a('0x2d')]=_0x20b219[_0xa34a('0x2d')];this[_0xa34a('0x2e')]=_0x20b219[_0xa34a('0x2e')];this[_0xa34a('0x2f')]=_0x20b219[_0xa34a('0x2f')];this['outboundNoSuchCallsDay']=_0x20b219[_0xa34a('0xe')];this[_0xa34a('0x30')]=_0x20b219['outboundOriginateFailureCallsDay'];this[_0xa34a('0xf')]=_0x20b219[_0xa34a('0xf')];this[_0xa34a('0x10')]=_0x20b219[_0xa34a('0x10')];this['outboundUnknownCallsDay']=_0x20b219[_0xa34a('0x11')];this[_0xa34a('0x31')]=_0x20b219[_0xa34a('0x31')];this['predictiveIntervalAvgHoldtime']=_0x20b219[_0xa34a('0x32')];this[_0xa34a('0x33')]=_0x20b219[_0xa34a('0x33')];this[_0xa34a('0x34')]=_0x20b219[_0xa34a('0x34')];this[_0xa34a('0x35')]=_0x20b219['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x20b219['predictiveIntervalErlangCalls'];this[_0xa34a('0x36')]=_0x20b219[_0xa34a('0x36')];this[_0xa34a('0x37')]=_0x20b219[_0xa34a('0x37')];this[_0xa34a('0x38')]=_0x20b219[_0xa34a('0x38')];this['predictiveIntervalPauses']=_0x20b219[_0xa34a('0x39')];this[_0xa34a('0x3a')]=_0x20b219[_0xa34a('0x3a')];this[_0xa34a('0x3b')]=_0x20b219[_0xa34a('0x3b')];this[_0xa34a('0x8')]=_0x20b219['originated'];this[_0xa34a('0x3c')]=_0x20b219[_0xa34a('0x3c')];this['erlangCallToSecond']=_0x20b219[_0xa34a('0x3d')];this['erlangAbandonmentRate']=_0x20b219[_0xa34a('0x3e')];this[_0xa34a('0x3f')]=_0x20b219[_0xa34a('0x3f')];this[_0xa34a('0x40')]=_0x20b219[_0xa34a('0x40')];this[_0xa34a('0x41')]=_0x20b219[_0xa34a('0x41')];this[_0xa34a('0x42')]=_0x20b219[_0xa34a('0x42')];this['statusMessage']=_0x20b219['statusMessage'];}if(_0x20b219[_0xa34a('0x43')]){this[_0xa34a('0x43')]={'id':_0x20b219['Trunk']['id'],'name':_0x20b219[_0xa34a('0x43')][_0xa34a('0x16')],'active':_0x20b219[_0xa34a('0x43')][_0xa34a('0x44')],'callerid':_0x20b219['Trunk'][_0xa34a('0x45')]};}}VoiceQueueSummary[_0xa34a('0x46')][_0xa34a('0x47')]=function(_0x10960b,_0x48cd69,_0x575f28,_0x478d83){this[_0xa34a('0x1')]=0x0;this['talking']=0x0;this[_0xa34a('0x2')]=0x0;this[_0xa34a('0x21')]=0x0;this[_0xa34a('0x1c')]=0x0;this[_0xa34a('0x6')]=0x0;this[_0xa34a('0x19')]=0x0;this['invalid']=0x0;this[_0xa34a('0x20')]=0x0;this[_0xa34a('0x3')]=0x0;this[_0xa34a('0x1d')]=0x0;this[_0xa34a('0x1b')]=0x0;if(_0x575f28){if(_0x575f28[_0xa34a('0x0')]){this[_0xa34a('0x0')]=Number(_0x575f28['available']);}if(_0x575f28[_0xa34a('0x48')]){this[_0xa34a('0x7')]=Number(_0x575f28[_0xa34a('0x48')]);}if(_0x575f28[_0xa34a('0x49')]){this[_0xa34a('0x15')]=Number(_0x575f28[_0xa34a('0x49')]);}}for(var _0x5914dc=0x0;_0x5914dc<_0x10960b[_0xa34a('0x4a')];_0x5914dc++){var _0x4fcf57=_0x48cd69[_0xa34a('0x4b')+_0x10960b[_0x5914dc][_0xa34a('0x16')]];if(_0x4fcf57&&_0x4fcf57[_0xa34a('0x4c')]){this['loggedInDb']+=0x1;}if(_0x10960b[_0x5914dc][_0xa34a('0x4d')]==='1'){this['talking']+=0x1;}if(_0x10960b[_0x5914dc][_0xa34a('0x2')]==='1'&&!['2','7','8']['includes'](_0x10960b[_0x5914dc][_0xa34a('0x4e')])){this[_0xa34a('0x2')]+=0x1;}switch(_0x10960b[_0x5914dc][_0xa34a('0x4e')]){case'0':this[_0xa34a('0x21')]+=0x1;break;case'1':this[_0xa34a('0x1c')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xa34a('0x19')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0xa34a('0x20')]+=0x1;break;case'6':this[_0xa34a('0x3')]+=0x1;break;case'7':this[_0xa34a('0x1d')]+=0x1;break;case'8':this[_0xa34a('0x1b')]+=0x1;break;}}if(this[_0xa34a('0x26')]===_0xa34a('0x4f')){var _0x30d59a=Object[_0xa34a('0x50')](_0x478d83);for(var _0x4be0d0=0x0;_0x4be0d0<_0x30d59a[_0xa34a('0x4a')];_0x4be0d0++){var _0x54ded6=_0x30d59a[_0x4be0d0];var _0x573bd1=_0x478d83[_0x54ded6];if(_0x573bd1['queue']===this[_0xa34a('0x16')]&&_0x573bd1['type']===_0xa34a('0x51')&&_0x573bd1[_0xa34a('0x52')]==='xcally-motion-preview'){this[_0xa34a('0x4')]+=0x1;}}if(this['talking']>this[_0xa34a('0x6')]){this[_0xa34a('0x4')]=this[_0xa34a('0x6')];}this[_0xa34a('0x24')]=0x0;}return this;};VoiceQueueSummary['prototype']['compareToInboundQueue']=function(_0x1978e3){var _0x2e4b89=![];if(_0x1978e3){_0x2e4b89=INBOUND_COUNTERS[_0xa34a('0x53')](function(_0x1a9468){return this[_0x1a9468]!==_0x1978e3[_0x1a9468];},this);}return _0x2e4b89;};VoiceQueueSummary[_0xa34a('0x46')][_0xa34a('0x54')]=function(_0x611761){var _0xa80976=![];var _0x3d09ba=![];var _0x2ba5d3=![];if(_0x611761){_0xa80976=this['dialMethod']!==_0x611761[_0xa34a('0x26')]||this[_0xa34a('0x25')]!==_0x611761[_0xa34a('0x25')]||this['message']!==_0x611761[_0xa34a('0x42')]||this[_0xa34a('0x55')]!==_0x611761['statusMessage'];_0x3d09ba=OUTBOUND_COUNTERS['some'](function(_0xd19b6c){return this[_0xd19b6c]!==_0x611761[_0xd19b6c];},this);if(this[_0xa34a('0x43')]&&_0x611761[_0xa34a('0x43')]){_0x2ba5d3=this[_0xa34a('0x43')][_0xa34a('0x16')]!==_0x611761['Trunk'][_0xa34a('0x16')]||this[_0xa34a('0x43')][_0xa34a('0x44')]!==_0x611761[_0xa34a('0x43')][_0xa34a('0x44')];}}return _0xa80976||_0x3d09ba||_0x2ba5d3;};VoiceQueueSummary['prototype'][_0xa34a('0x56')]=function(_0x3e9cf7){this[_0xa34a('0x5')]=_0x3e9cf7[_0xa34a('0x5')];this[_0xa34a('0x42')]=_0x3e9cf7['message'];this[_0xa34a('0x55')]=_0x3e9cf7['statusMessage'];this[_0xa34a('0x8')]=_0x3e9cf7[_0xa34a('0x8')];this[_0xa34a('0x9')]=_0x3e9cf7[_0xa34a('0x9')];this[_0xa34a('0xa')]=_0x3e9cf7['outboundAnswerCallsDay'];this[_0xa34a('0xb')]=_0x3e9cf7['outboundBlacklistCallsDay'];this[_0xa34a('0xc')]=_0x3e9cf7['outboundBusyCallsDay'];this[_0xa34a('0xd')]=_0x3e9cf7[_0xa34a('0xd')];this['outboundNoAnswerCallsDay']=_0x3e9cf7[_0xa34a('0x2f')];this[_0xa34a('0xe')]=_0x3e9cf7['outboundNoSuchCallsDay'];this[_0xa34a('0xf')]=_0x3e9cf7[_0xa34a('0xf')];this['outboundRejectCallsDay']=_0x3e9cf7['outboundRejectCallsDay'];this[_0xa34a('0x11')]=_0x3e9cf7['outboundUnknownCallsDay'];this['sumBillable']=_0x3e9cf7[_0xa34a('0x12')];this[_0xa34a('0x13')]=_0x3e9cf7[_0xa34a('0x13')];this[_0xa34a('0x14')]=_0x3e9cf7[_0xa34a('0x14')];if(this['dialMethod']==='preview'){this[_0xa34a('0x24')]=_0x3e9cf7[_0xa34a('0x24')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x165d=['waiting','answered','inUse','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','invalid','onHold','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','notInUse','busy','loggedin','length','SIP/','online','status','booked','queue','dialer','exten','xcally-motion-preview','some','available','loggedIn','loggedInDb','paused','ringing','talking'];(function(_0xc7a0cb,_0x389964){var _0x10ce8e=function(_0x3a6dcf){while(--_0x3a6dcf){_0xc7a0cb['push'](_0xc7a0cb['shift']());}};_0x10ce8e(++_0x389964);}(_0x165d,0x14a));var _0xd165=function(_0x2aaa28,_0x59589b){_0x2aaa28=_0x2aaa28-0x0;var _0x18b2d1=_0x165d[_0x2aaa28];return _0x18b2d1;};'use strict';var INBOUND_COUNTERS=[_0xd165('0x0'),_0xd165('0x1'),_0xd165('0x2'),_0xd165('0x3'),_0xd165('0x4'),_0xd165('0x5'),_0xd165('0x6')];var OUTBOUND_COUNTERS=['available',_0xd165('0x7'),_0xd165('0x8'),'loggedIn','loggedInDb','originated',_0xd165('0x9'),_0xd165('0xa'),'outboundBlacklistCallsDay','outboundBusyCallsDay',_0xd165('0xb'),_0xd165('0xc'),_0xd165('0xd'),_0xd165('0xe'),_0xd165('0xf'),_0xd165('0x10'),_0xd165('0x3'),_0xd165('0x11'),'talking',_0xd165('0x12'),_0xd165('0x13'),_0xd165('0x14'),'waiting'];function VoiceQueueSummary(_0x3bde9a){this['id']=_0x3bde9a['id'];this['name']=_0x3bde9a[_0xd165('0x15')];this[_0xd165('0x16')]=_0x3bde9a[_0xd165('0x16')];this[_0xd165('0x17')]=_0x3bde9a['abandoned']||0x0;this['answered']=_0x3bde9a[_0xd165('0x7')]||0x0;this[_0xd165('0x0')]=_0x3bde9a[_0xd165('0x0')]||0x0;this['busy']=_0x3bde9a['busy']||0x0;this['inUse']=_0x3bde9a[_0xd165('0x8')]||0x0;this[_0xd165('0x18')]=_0x3bde9a['invalid']||0x0;this[_0xd165('0x1')]=_0x3bde9a[_0xd165('0x1')]||0x0;this['loggedInDb']=_0x3bde9a['loggedInDb']||0x0;this[_0xd165('0x19')]=_0x3bde9a[_0xd165('0x19')]||0x0;this['notInUse']=_0x3bde9a['notInUse']||0x0;this['paused']=_0x3bde9a['paused']||0x0;this[_0xd165('0x4')]=_0x3bde9a[_0xd165('0x4')]||0x0;this[_0xd165('0x1a')]=_0x3bde9a[_0xd165('0x1a')];this[_0xd165('0x12')]=_0x3bde9a[_0xd165('0x12')];this[_0xd165('0x13')]=_0x3bde9a[_0xd165('0x13')];this[_0xd165('0x1b')]=_0x3bde9a['sumHoldTime']||0x0;this[_0xd165('0x5')]=_0x3bde9a['talking']||0x0;this[_0xd165('0x14')]=_0x3bde9a[_0xd165('0x14')]||0x0;this['type']=_0x3bde9a[_0xd165('0x1c')];this[_0xd165('0x1d')]=_0x3bde9a['unavailable']||0x0;this[_0xd165('0x1e')]=_0x3bde9a[_0xd165('0x1e')]||0x0;this[_0xd165('0x1f')]=_0x3bde9a['unmanaged']||0x0;this[_0xd165('0x6')]=_0x3bde9a[_0xd165('0x6')]||0x0;if(_0x3bde9a[_0xd165('0x1c')]===_0xd165('0x20')){this[_0xd165('0x11')]=_0x3bde9a[_0xd165('0x11')]||0x0;this['dialActive']=_0x3bde9a[_0xd165('0x21')];this[_0xd165('0x22')]=_0x3bde9a[_0xd165('0x22')];this[_0xd165('0x23')]=_0x3bde9a[_0xd165('0x23')];this[_0xd165('0x24')]=_0x3bde9a[_0xd165('0x24')];this['dialOriginateTimeout']=_0x3bde9a[_0xd165('0x25')];this['dialPrefix']=_0x3bde9a[_0xd165('0x26')];this[_0xd165('0x27')]=_0x3bde9a[_0xd165('0x27')];this['outboundAnswerAgiCallsDay']=_0x3bde9a[_0xd165('0x28')];this[_0xd165('0xa')]=_0x3bde9a[_0xd165('0xa')];this[_0xd165('0x29')]=_0x3bde9a['outboundBlacklistCallsDay'];this[_0xd165('0x2a')]=_0x3bde9a[_0xd165('0x2a')];this[_0xd165('0xb')]=_0x3bde9a[_0xd165('0xb')];this[_0xd165('0x2b')]=_0x3bde9a[_0xd165('0x2b')];this['outboundDropCallsDayCallersExit']=_0x3bde9a[_0xd165('0x2c')];this[_0xd165('0x2d')]=_0x3bde9a['outboundDropCallsDayTimeout'];this[_0xd165('0xc')]=_0x3bde9a[_0xd165('0xc')];this[_0xd165('0xd')]=_0x3bde9a[_0xd165('0xd')];this[_0xd165('0x2e')]=_0x3bde9a[_0xd165('0x2e')];this['outboundReCallsDay']=_0x3bde9a['outboundReCallsDay'];this[_0xd165('0xf')]=_0x3bde9a['outboundRejectCallsDay'];this[_0xd165('0x10')]=_0x3bde9a['outboundUnknownCallsDay'];this[_0xd165('0x2f')]=_0x3bde9a['predictiveIntervalAnsweredCalls'];this[_0xd165('0x30')]=_0x3bde9a[_0xd165('0x30')];this[_0xd165('0x31')]=_0x3bde9a[_0xd165('0x31')];this[_0xd165('0x32')]=_0x3bde9a[_0xd165('0x32')];this[_0xd165('0x33')]=_0x3bde9a[_0xd165('0x33')];this[_0xd165('0x34')]=_0x3bde9a[_0xd165('0x34')];this[_0xd165('0x35')]=_0x3bde9a[_0xd165('0x35')];this[_0xd165('0x36')]=_0x3bde9a[_0xd165('0x36')];this['predictiveIntervalMultiplicativeFactor']=_0x3bde9a[_0xd165('0x37')];this[_0xd165('0x38')]=_0x3bde9a[_0xd165('0x38')];this[_0xd165('0x39')]=_0x3bde9a[_0xd165('0x39')];this['predictiveIntervalTotalCalls']=_0x3bde9a['predictiveIntervalTotalCalls'];this['originated']=_0x3bde9a[_0xd165('0x3a')];this[_0xd165('0x3b')]=_0x3bde9a[_0xd165('0x3b')];this[_0xd165('0x3c')]=_0x3bde9a[_0xd165('0x3c')];this[_0xd165('0x3d')]=_0x3bde9a[_0xd165('0x3d')];this[_0xd165('0x3e')]=_0x3bde9a[_0xd165('0x3e')];this[_0xd165('0x3f')]=_0x3bde9a[_0xd165('0x3f')];this['startProgressive']=_0x3bde9a[_0xd165('0x40')];this[_0xd165('0x41')]=_0x3bde9a[_0xd165('0x41')];this[_0xd165('0x42')]=_0x3bde9a[_0xd165('0x42')];}if(_0x3bde9a['Trunk']){this[_0xd165('0x43')]={'id':_0x3bde9a[_0xd165('0x43')]['id'],'name':_0x3bde9a['Trunk'][_0xd165('0x15')],'active':_0x3bde9a[_0xd165('0x43')][_0xd165('0x44')],'callerid':_0x3bde9a[_0xd165('0x43')][_0xd165('0x45')]};}}VoiceQueueSummary[_0xd165('0x46')]['createReport']=function(_0x4a5b12,_0x3da80f,_0x1d1d49,_0xdbd859){this[_0xd165('0x2')]=0x0;this[_0xd165('0x5')]=0x0;this[_0xd165('0x3')]=0x0;this[_0xd165('0x1e')]=0x0;this[_0xd165('0x47')]=0x0;this['inUse']=0x0;this[_0xd165('0x48')]=0x0;this['invalid']=0x0;this[_0xd165('0x1d')]=0x0;this[_0xd165('0x4')]=0x0;this[_0xd165('0x1a')]=0x0;this[_0xd165('0x19')]=0x0;if(_0x1d1d49){if(_0x1d1d49[_0xd165('0x0')]){this[_0xd165('0x0')]=Number(_0x1d1d49['available']);}if(_0x1d1d49[_0xd165('0x49')]){this[_0xd165('0x1')]=Number(_0x1d1d49[_0xd165('0x49')]);}if(_0x1d1d49['callers']){this[_0xd165('0x6')]=Number(_0x1d1d49['callers']);}}for(var _0x873316=0x0;_0x873316<_0x4a5b12[_0xd165('0x4a')];_0x873316++){var _0x3a8b35=_0x3da80f[_0xd165('0x4b')+_0x4a5b12[_0x873316][_0xd165('0x15')]];if(_0x3a8b35&&_0x3a8b35[_0xd165('0x4c')]){this[_0xd165('0x2')]+=0x1;}if(_0x4a5b12[_0x873316]['incall']==='1'){this['talking']+=0x1;}if(_0x4a5b12[_0x873316]['paused']==='1'&&!['2','7','8']['includes'](_0x4a5b12[_0x873316]['status'])){this[_0xd165('0x3')]+=0x1;}switch(_0x4a5b12[_0x873316][_0xd165('0x4d')]){case'0':this[_0xd165('0x1e')]+=0x1;break;case'1':this[_0xd165('0x47')]+=0x1;break;case'2':this[_0xd165('0x8')]+=0x1;break;case'3':this[_0xd165('0x48')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xd165('0x4')]+=0x1;break;case'7':this[_0xd165('0x1a')]+=0x1;break;case'8':this[_0xd165('0x19')]+=0x1;break;}}if(this[_0xd165('0x22')]===_0xd165('0x4e')){var _0x51738a=Object['keys'](_0xdbd859);for(var _0xd0e787=0x0;_0xd0e787<_0x51738a[_0xd165('0x4a')];_0xd0e787++){var _0x4f7012=_0x51738a[_0xd0e787];var _0x267582=_0xdbd859[_0x4f7012];if(_0x267582[_0xd165('0x4f')]===this[_0xd165('0x15')]&&_0x267582[_0xd165('0x1c')]===_0xd165('0x50')&&_0x267582[_0xd165('0x51')]===_0xd165('0x52')){this[_0xd165('0x5')]+=0x1;}}if(this[_0xd165('0x5')]>this[_0xd165('0x8')]){this[_0xd165('0x5')]=this['inUse'];}this[_0xd165('0x11')]=0x0;}return this;};VoiceQueueSummary[_0xd165('0x46')]['compareToInboundQueue']=function(_0x5ab530){var _0x63b247=![];if(_0x5ab530){_0x63b247=INBOUND_COUNTERS[_0xd165('0x53')](function(_0x4480ac){return this[_0x4480ac]!==_0x5ab530[_0x4480ac];},this);}return _0x63b247;};VoiceQueueSummary[_0xd165('0x46')]['compareToOutboundQueue']=function(_0x3229e3){var _0x3bf663=![];var _0x1ca08c=![];var _0x3d264e=![];if(_0x3229e3){_0x3bf663=this['dialMethod']!==_0x3229e3['dialMethod']||this['dialActive']!==_0x3229e3[_0xd165('0x21')]||this['message']!==_0x3229e3[_0xd165('0x41')]||this[_0xd165('0x42')]!==_0x3229e3['statusMessage'];_0x1ca08c=OUTBOUND_COUNTERS['some'](function(_0x538278){return this[_0x538278]!==_0x3229e3[_0x538278];},this);if(this['Trunk']&&_0x3229e3[_0xd165('0x43')]){_0x3d264e=this[_0xd165('0x43')][_0xd165('0x15')]!==_0x3229e3[_0xd165('0x43')]['name']||this[_0xd165('0x43')][_0xd165('0x44')]!==_0x3229e3['Trunk'][_0xd165('0x44')];}}return _0x3bf663||_0x1ca08c||_0x3d264e;};VoiceQueueSummary[_0xd165('0x46')]['updateReportFromOutboundQueue']=function(_0x1e9baa){this[_0xd165('0x7')]=_0x1e9baa[_0xd165('0x7')];this[_0xd165('0x41')]=_0x1e9baa[_0xd165('0x41')];this[_0xd165('0x42')]=_0x1e9baa[_0xd165('0x42')];this['originated']=_0x1e9baa['originated'];this['outboundAbandonedCallsDay']=_0x1e9baa[_0xd165('0x9')];this[_0xd165('0xa')]=_0x1e9baa['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x1e9baa['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x1e9baa['outboundBusyCallsDay'];this[_0xd165('0xb')]=_0x1e9baa[_0xd165('0xb')];this['outboundNoAnswerCallsDay']=_0x1e9baa['outboundNoAnswerCallsDay'];this[_0xd165('0xd')]=_0x1e9baa['outboundNoSuchCallsDay'];this['outboundReCallsDay']=_0x1e9baa[_0xd165('0xe')];this[_0xd165('0xf')]=_0x1e9baa[_0xd165('0xf')];this['outboundUnknownCallsDay']=_0x1e9baa[_0xd165('0x10')];this['sumBillable']=_0x1e9baa['sumBillable'];this[_0xd165('0x13')]=_0x1e9baa[_0xd165('0x13')];this[_0xd165('0x14')]=_0x1e9baa[_0xd165('0x14')];if(this[_0xd165('0x22')]==='preview'){this[_0xd165('0x11')]=_0x1e9baa['pTalking'];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index e389aab..8d1854b 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 _0xc3c9=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x2b1e46,_0xebe6a2){var _0x50cc26=function(_0x30f82b){while(--_0x30f82b){_0x2b1e46['push'](_0x2b1e46['shift']());}};_0x50cc26(++_0xebe6a2);}(_0xc3c9,0xa6));var _0x9c3c=function(_0x1b54f5,_0x83ee6a){_0x1b54f5=_0x1b54f5-0x0;var _0x3b9975=_0xc3c9[_0x1b54f5];return _0x3b9975;};'use strict';function VtigerAccount(_0x59c999){this['id']=_0x59c999['id']||0x0;this[_0x9c3c('0x0')]=_0x59c999['name']||'';this[_0x9c3c('0x1')]=_0x59c999['username']||'';this[_0x9c3c('0x2')]=_0x59c999[_0x9c3c('0x2')]||'';this[_0x9c3c('0x3')]=_0x59c999[_0x9c3c('0x3')]||'';this[_0x9c3c('0x4')]=_0x59c999[_0x9c3c('0x4')]||'';this[_0x9c3c('0x5')]=_0x59c999[_0x9c3c('0x5')]||{};}module[_0x9c3c('0x6')]=VtigerAccount; \ No newline at end of file +var _0xfe67=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x388914,_0x3c63f9){var _0x1f9111=function(_0x23dd69){while(--_0x23dd69){_0x388914['push'](_0x388914['shift']());}};_0x1f9111(++_0x3c63f9);}(_0xfe67,0x98));var _0x7fe6=function(_0x9154ee,_0x5f2a85){_0x9154ee=_0x9154ee-0x0;var _0x24c414=_0xfe67[_0x9154ee];return _0x24c414;};'use strict';function VtigerAccount(_0x4d1cb6){this['id']=_0x4d1cb6['id']||0x0;this[_0x7fe6('0x0')]=_0x4d1cb6[_0x7fe6('0x0')]||'';this[_0x7fe6('0x1')]=_0x4d1cb6[_0x7fe6('0x1')]||'';this[_0x7fe6('0x2')]=_0x4d1cb6[_0x7fe6('0x2')]||'';this[_0x7fe6('0x3')]=_0x4d1cb6['remoteUri']||'';this['serverUrl']=_0x4d1cb6[_0x7fe6('0x4')]||'';this[_0x7fe6('0x5')]=_0x4d1cb6['Configurations']||{};}module[_0x7fe6('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index cd18e7a..88949f9 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 _0xb8e9=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xb8e9,0x69));var _0x9b8e=function(_0x4d729f,_0x52bf8b){_0x4d729f=_0x4d729f-0x0;var _0x5ce12a=_0xb8e9[_0x4d729f];return _0x5ce12a;};'use strict';function ZendeskAccount(_0x175af0){this['id']=_0x175af0['id']||0x0;this[_0x9b8e('0x0')]=_0x175af0['name']||'';this[_0x9b8e('0x1')]=_0x175af0[_0x9b8e('0x1')]||'';this[_0x9b8e('0x2')]=_0x175af0[_0x9b8e('0x2')]||'';this['token']=_0x175af0[_0x9b8e('0x3')]||'';this[_0x9b8e('0x4')]=_0x175af0[_0x9b8e('0x4')]||'';this[_0x9b8e('0x5')]=_0x175af0[_0x9b8e('0x5')]||'';this[_0x9b8e('0x6')]=_0x175af0[_0x9b8e('0x6')]||_0x9b8e('0x7');this[_0x9b8e('0x8')]=_0x175af0['serverUrl']||'';this[_0x9b8e('0x9')]=_0x175af0[_0x9b8e('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xcf28=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x4e3bd3,_0x4f9cc4){var _0x1fb687=function(_0x5e26d6){while(--_0x5e26d6){_0x4e3bd3['push'](_0x4e3bd3['shift']());}};_0x1fb687(++_0x4f9cc4);}(_0xcf28,0x172));var _0x8cf2=function(_0x52f0c1,_0x17e813){_0x52f0c1=_0x52f0c1-0x0;var _0x1a6d5c=_0xcf28[_0x52f0c1];return _0x1a6d5c;};'use strict';function ZendeskAccount(_0x45f733){this['id']=_0x45f733['id']||0x0;this['name']=_0x45f733[_0x8cf2('0x0')]||'';this[_0x8cf2('0x1')]=_0x45f733['username']||'';this[_0x8cf2('0x2')]=_0x45f733[_0x8cf2('0x2')]||'';this['token']=_0x45f733[_0x8cf2('0x3')]||'';this[_0x8cf2('0x4')]=_0x45f733['remoteUri']||'';this[_0x8cf2('0x5')]=_0x45f733[_0x8cf2('0x5')]||'';this[_0x8cf2('0x6')]=_0x45f733[_0x8cf2('0x6')]||_0x8cf2('0x7');this[_0x8cf2('0x8')]=_0x45f733[_0x8cf2('0x8')]||'';this[_0x8cf2('0x9')]=_0x45f733['Configurations']||{};}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 dd2c6ba..ea462a1 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 _0x863b=['name','description','host','zone','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x863b,0x64));var _0xb863=function(_0x754ab4,_0x56daa7){_0x754ab4=_0x754ab4-0x0;var _0x34079a=_0x863b[_0x754ab4];return _0x34079a;};'use strict';function ZohoAccount(_0x4c7be5){this['id']=_0x4c7be5['id']||0x0;this[_0xb863('0x0')]=_0x4c7be5[_0xb863('0x0')]||'';this[_0xb863('0x1')]=_0x4c7be5[_0xb863('0x1')]||'';this['host']=_0x4c7be5[_0xb863('0x2')]||'';this['zone']=_0x4c7be5[_0xb863('0x3')]||'';this['clientId']=_0x4c7be5['clientId']||'';this[_0xb863('0x4')]=_0x4c7be5[_0xb863('0x4')]||'';this['serverUrl']=_0x4c7be5[_0xb863('0x5')]||'';this[_0xb863('0x6')]=_0x4c7be5[_0xb863('0x6')]||'';this[_0xb863('0x7')]=_0x4c7be5[_0xb863('0x7')]||'';this[_0xb863('0x8')]=_0x4c7be5[_0xb863('0x8')]||{};}module[_0xb863('0x9')]=ZohoAccount; \ No newline at end of file +var _0xcc72=['refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x3a3a7d,_0x58e12f){var _0x82c974=function(_0x252de6){while(--_0x252de6){_0x3a3a7d['push'](_0x3a3a7d['shift']());}};_0x82c974(++_0x58e12f);}(_0xcc72,0xbe));var _0x2cc7=function(_0x2446e6,_0x49d22f){_0x2446e6=_0x2446e6-0x0;var _0x5a048a=_0xcc72[_0x2446e6];return _0x5a048a;};'use strict';function ZohoAccount(_0x296421){this['id']=_0x296421['id']||0x0;this['name']=_0x296421[_0x2cc7('0x0')]||'';this[_0x2cc7('0x1')]=_0x296421[_0x2cc7('0x1')]||'';this[_0x2cc7('0x2')]=_0x296421[_0x2cc7('0x2')]||'';this['zone']=_0x296421[_0x2cc7('0x3')]||'';this[_0x2cc7('0x4')]=_0x296421[_0x2cc7('0x4')]||'';this['clientSecret']=_0x296421[_0x2cc7('0x5')]||'';this[_0x2cc7('0x6')]=_0x296421[_0x2cc7('0x6')]||'';this[_0x2cc7('0x7')]=_0x296421[_0x2cc7('0x7')]||'';this['refreshToken']=_0x296421[_0x2cc7('0x8')]||'';this[_0x2cc7('0x9')]=_0x296421['Configurations']||{};}module[_0x2cc7('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index f747340..4d5b29e 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 _0x5c3c=['prototype','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','idContact','queue','type','dialAnswer','Agent','channelAgent','membername','SIP/%s','calleridname','phone','Contact','firstName','lastName','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum'];(function(_0x5a9666,_0x30bc94){var _0x28601f=function(_0x52e447){while(--_0x52e447){_0x5a9666['push'](_0x5a9666['shift']());}};_0x28601f(++_0x30bc94);}(_0x5c3c,0x132));var _0xc5c3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5c3c[_0x17d9e3];return _0x14192d;};'use strict';var util=require(_0xc5c3('0x0'));var _=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));function checkNameSurname(_0x32103c,_0x4b9233,_0x400726){var _0x3c5552='';if(!_[_0xc5c3('0x3')](_0x4b9233)&&_0xc5c3('0x4')===typeof _0x4b9233){_0x3c5552+=_0x4b9233;}if(!_[_0xc5c3('0x3')](_0x400726)&&_0xc5c3('0x4')===typeof _0x400726){_0x3c5552+='\x20'+_0x400726;}if(_0x3c5552!==''){return _0x3c5552;}return _0x32103c;}function Action(_0xe85098,_0x23a6b5,_0x28bdd9,_0x5a392b,_0x4b8404){this['uniqueid']=_0x28bdd9||undefined;this[_0xc5c3('0x5')]=_0xe85098['id'];this[_0xc5c3('0x6')]=_0x23a6b5['name'];this[_0xc5c3('0x7')]=_0x23a6b5[_0xc5c3('0x7')];this['campaigntype']=_0xc5c3('0x6');this[_0xc5c3('0x8')]=![];this['membername']=_[_0xc5c3('0x3')](_0xe85098[_0xc5c3('0x9')])?undefined:_0xe85098[_0xc5c3('0x9')]['name'];this[_0xc5c3('0xa')]=this[_0xc5c3('0xb')]?util['format'](_0xc5c3('0xc'),this[_0xc5c3('0xb')]):_0x5a392b||undefined;this[_0xc5c3('0xd')]=checkNameSurname(_0xe85098['Contact'][_0xc5c3('0xe')],_0xe85098[_0xc5c3('0xf')][_0xc5c3('0x10')],_0xe85098[_0xc5c3('0xf')][_0xc5c3('0x11')]);this['active']=_0xe85098['active']||![];this[_0xc5c3('0x12')]=_0xe85098[_0xc5c3('0xe')];this[_0xc5c3('0x13')]=_0xe85098[_0xc5c3('0x13')];this['countbusyretry']=_0xe85098['countbusyretry']||0x0;this[_0xc5c3('0x14')]=_0xe85098['countcongestionretry']||0x0;this[_0xc5c3('0x15')]=_0xe85098[_0xc5c3('0x15')]||0x0;this[_0xc5c3('0x16')]=(_0xe85098[_0xc5c3('0x17')]||0x0)+(_0xe85098[_0xc5c3('0x14')]||0x0)+(_0xe85098['countnoanswerretry']||0x0)+(_0xe85098[_0xc5c3('0x18')]||0x0)+(_0xe85098[_0xc5c3('0x19')]||0x0)+(_0xe85098[_0xc5c3('0x1a')]||0x0)+(_0xe85098[_0xc5c3('0x1b')]||0x0)+(_0xe85098['countagentrejectretry']||0x0);this[_0xc5c3('0x18')]=_0xe85098[_0xc5c3('0x18')]||0x0;this[_0xc5c3('0x19')]=_0xe85098[_0xc5c3('0x19')]||0x0;this[_0xc5c3('0x1a')]=_0xe85098['countabandonedretry']||0x0;this[_0xc5c3('0x1b')]=_0xe85098[_0xc5c3('0x1b')]||0x0;this[_0xc5c3('0x1c')]=_0xe85098[_0xc5c3('0x1c')]||0x0;this[_0xc5c3('0x1d')]=_0xe85098[_0xc5c3('0x1d')];this[_0xc5c3('0x1e')]=_0xe85098['callbackuniqueid'];this['callbackat']=_0xe85098[_0xc5c3('0x1f')];this[_0xc5c3('0x20')]=_0xe85098['recallme'];this['ContactId']=_0xe85098[_0xc5c3('0x21')];this[_0xc5c3('0x22')]=_0xe85098[_0xc5c3('0x22')];this['UserId']=_['isNil'](_0xe85098[_0xc5c3('0x9')])?_0xe85098[_0xc5c3('0x23')]:_0xe85098[_0xc5c3('0x9')]['id'];this[_0xc5c3('0x24')]=_0xe85098['VoiceQueueId'];this[_0xc5c3('0x25')]='';this['originatecalleridname']='';}Action[_0xc5c3('0x26')]['getCaller']=function(){return util[_0xc5c3('0x27')](_0xc5c3('0x28'),this[_0xc5c3('0xd')],this[_0xc5c3('0x29')]);};module[_0xc5c3('0x2a')]=Action; \ No newline at end of file +var _0xd914=['format','SIP/%s','phone','Contact','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','Agent','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','calleridname','util','lodash','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','channelAgent'];(function(_0x4c8d7e,_0x481321){var _0xf5e4e8=function(_0x2e8c3d){while(--_0x2e8c3d){_0x4c8d7e['push'](_0x4c8d7e['shift']());}};_0xf5e4e8(++_0x481321);}(_0xd914,0x17f));var _0x4d91=function(_0x246f0c,_0x39f734){_0x246f0c=_0x246f0c-0x0;var _0x30fe50=_0xd914[_0x246f0c];return _0x30fe50;};'use strict';var util=require(_0x4d91('0x0'));var _=require(_0x4d91('0x1'));var moment=require('moment');function checkNameSurname(_0x212202,_0x17d4ce,_0x3b8cae){var _0x2314d1='';if(!_[_0x4d91('0x2')](_0x17d4ce)&&_0x4d91('0x3')===typeof _0x17d4ce){_0x2314d1+=_0x17d4ce;}if(!_['isNil'](_0x3b8cae)&&_0x4d91('0x3')===typeof _0x3b8cae){_0x2314d1+='\x20'+_0x3b8cae;}if(_0x2314d1!==''){return _0x2314d1;}return _0x212202;}function Action(_0x5d8af4,_0x3ab6f8,_0x42d7ae,_0x175ce3,_0x27c0d5){this[_0x4d91('0x4')]=_0x42d7ae||undefined;this[_0x4d91('0x5')]=_0x5d8af4['id'];this[_0x4d91('0x6')]=_0x3ab6f8[_0x4d91('0x7')];this['type']=_0x3ab6f8[_0x4d91('0x8')];this[_0x4d91('0x9')]=_0x4d91('0x6');this[_0x4d91('0xa')]=![];this[_0x4d91('0xb')]=_[_0x4d91('0x2')](_0x5d8af4['Agent'])?undefined:_0x5d8af4['Agent'][_0x4d91('0x7')];this[_0x4d91('0xc')]=this[_0x4d91('0xb')]?util[_0x4d91('0xd')](_0x4d91('0xe'),this[_0x4d91('0xb')]):_0x175ce3||undefined;this['calleridname']=checkNameSurname(_0x5d8af4['Contact'][_0x4d91('0xf')],_0x5d8af4[_0x4d91('0x10')][_0x4d91('0x11')],_0x5d8af4[_0x4d91('0x10')][_0x4d91('0x12')]);this[_0x4d91('0x13')]=_0x5d8af4[_0x4d91('0x13')]||![];this['calleridnum']=_0x5d8af4[_0x4d91('0xf')];this[_0x4d91('0x14')]=_0x5d8af4[_0x4d91('0x14')];this[_0x4d91('0x15')]=_0x5d8af4[_0x4d91('0x15')]||0x0;this['countcongestionretry']=_0x5d8af4[_0x4d91('0x16')]||0x0;this[_0x4d91('0x17')]=_0x5d8af4[_0x4d91('0x17')]||0x0;this[_0x4d91('0x18')]=(_0x5d8af4['countbusyretry']||0x0)+(_0x5d8af4[_0x4d91('0x16')]||0x0)+(_0x5d8af4[_0x4d91('0x17')]||0x0)+(_0x5d8af4[_0x4d91('0x19')]||0x0)+(_0x5d8af4['countdropretry']||0x0)+(_0x5d8af4[_0x4d91('0x1a')]||0x0)+(_0x5d8af4[_0x4d91('0x1b')]||0x0)+(_0x5d8af4[_0x4d91('0x1c')]||0x0);this[_0x4d91('0x19')]=_0x5d8af4[_0x4d91('0x19')]||0x0;this[_0x4d91('0x1d')]=_0x5d8af4[_0x4d91('0x1d')]||0x0;this[_0x4d91('0x1a')]=_0x5d8af4[_0x4d91('0x1a')]||0x0;this[_0x4d91('0x1b')]=_0x5d8af4['countmachineretry']||0x0;this[_0x4d91('0x1c')]=_0x5d8af4['countagentrejectretry']||0x0;this['callback']=_0x5d8af4[_0x4d91('0x1e')];this[_0x4d91('0x1f')]=_0x5d8af4[_0x4d91('0x1f')];this[_0x4d91('0x20')]=_0x5d8af4[_0x4d91('0x20')];this[_0x4d91('0x21')]=_0x5d8af4[_0x4d91('0x21')];this[_0x4d91('0x22')]=_0x5d8af4['ContactId'];this['ListId']=_0x5d8af4[_0x4d91('0x23')];this[_0x4d91('0x24')]=_[_0x4d91('0x2')](_0x5d8af4[_0x4d91('0x25')])?_0x5d8af4[_0x4d91('0x24')]:_0x5d8af4[_0x4d91('0x25')]['id'];this[_0x4d91('0x26')]=_0x5d8af4['VoiceQueueId'];this[_0x4d91('0x27')]='';this[_0x4d91('0x28')]='';}Action[_0x4d91('0x29')]['getCaller']=function(){return util['format'](_0x4d91('0x2a'),this[_0x4d91('0x2b')],this['number']);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 4678301..4e71d3c 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 _0x62b8=['util','lodash','moment','preview','../../../config/logger','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./util/util','../dialer/utils','redis','defaults','localhost','prototype','enqueue','tail','finally','trunks','actions','agents','originateresponse','syncOriginateResponse','hangup','bind','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','info','stringify','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','message','logger','\x20is\x20deactivated','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','type','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pTalking','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','channel','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','then','isNil','length','getDiff','scheduledat','Agent','voicePause','run','logger2','catch','[RecallMe]','disableContact','starttime','format','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','Trunk','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','callAdditionalPhoneAfterMin','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','activeContact','linkedid','incrementPreviewCounters','idContact','ANSWER','YYYY-MM-DD\x20HH:mm:ss','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','additional','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','unlockAgent','swapAdditionalPhones','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','scheduledAt','outboundRejectCallsDay','countagentrejectretry','dialAgentRejectRetryFrequency','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','status','unmonitored','execRun','unlockContact','getContactPreview','recallme','validateContact','[Preview][checkIsBlackList]','Call\x20unsuccessful','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','callerid','getCallerIdRandom','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','assign','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','lookAgent','logLookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','addVariable','filterKey','keys','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports'];(function(_0x5c85a5,_0x3029d5){var _0x2861b2=function(_0x2a515c){while(--_0x2a515c){_0x5c85a5['push'](_0x5c85a5['shift']());}};_0x2861b2(++_0x3029d5);}(_0x62b8,0x142));var _0x862b=function(_0x497b1e,_0x586379){_0x497b1e=_0x497b1e-0x0;var _0x3f72e1=_0x62b8[_0x497b1e];return _0x3f72e1;};'use strict';var util=require(_0x862b('0x0'));var _=require(_0x862b('0x1'));var uuid=require('uuid');var moment=require(_0x862b('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x862b('0x3'));var loggerAction=require(_0x862b('0x4'))(_0x862b('0x5'));var ami=require('../ami');var rpcDb=require(_0x862b('0x6'));var cmHopperAdditionalPhone=require(_0x862b('0x7'));var Action=require('./action');var ut=require(_0x862b('0x8'));var utils=require(_0x862b('0x9'));config[_0x862b('0xa')]=_[_0x862b('0xb')](config[_0x862b('0xa')],{'host':_0x862b('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x862b('0xa')]));var Sequence=function(){};Sequence[_0x862b('0xd')][_0x862b('0xe')]=function(_0x59be9f){this[_0x862b('0xf')]=this[_0x862b('0xf')]?this[_0x862b('0xf')][_0x862b('0x10')](_0x59be9f):_0x59be9f();};function Preview(_0x1d1423){this['sequence']=new Sequence();this['campaignsPreview']=_0x1d1423['voiceQueues'];this['trunks']=_0x1d1423[_0x862b('0x11')];this[_0x862b('0x12')]={};this[_0x862b('0x13')]=_0x1d1423[_0x862b('0x13')];this['clockClearZombieChannels']=0x0;ami['on'](_0x862b('0x14'),this[_0x862b('0x15')]['bind'](this));ami['on'](_0x862b('0x16'),this['syncHangup'][_0x862b('0x17')](this));ami['on']('hanguprequest',this[_0x862b('0x18')][_0x862b('0x17')](this));ami['on']('dialend',this[_0x862b('0x19')][_0x862b('0x17')](this));ami['on'](_0x862b('0x1a'),this[_0x862b('0x1b')][_0x862b('0x17')](this));ami['on'](_0x862b('0x1c'),this[_0x862b('0x1d')][_0x862b('0x17')](this));ami['on'](_0x862b('0x1e'),this[_0x862b('0x1f')]['bind'](this));ami['on'](_0x862b('0x20'),this[_0x862b('0x21')][_0x862b('0x17')](this));this[_0x862b('0x22')](this[_0x862b('0x23')]);}function emit(_0xd93935,_0x89a113,_0x6068ac){io['to'](_0xd93935)[_0x862b('0x24')](_0x89a113,_0x6068ac);}function emitVoiceQueueChannelRemove(_0x401660){logger[_0x862b('0x25')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x862b('0x26')](_0x401660));emit(util['format']('voice:queue:%s',_0x401660[_0x862b('0x27')]),_0x862b('0x28'),_0x401660);io['emit'](_0x862b('0x29'),_0x401660);}function notSendMessagesQueue(_0x1bad82){if(_0x1bad82[_0x862b('0x2a')]){if(_0x1bad82[_0x862b('0x2b')]===0x0&&_0x1bad82['pTalking']===0x0){_0x1bad82['sendMessageOneNotActive']=![];_0x1bad82[_0x862b('0x2c')]=0x0;_0x1bad82['paused']=0x0;_0x1bad82['message']=utils[_0x862b('0x2d')][_0x862b('0x2e')];ut['logger'](_0x862b('0x2f'),_0x1bad82[_0x862b('0x27')]+'\x20is\x20not\x20active');}else{_0x1bad82[_0x862b('0x30')]=utils['CAMPAIGN_STATUS']['DEACTIVATED'];ut[_0x862b('0x31')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x1bad82[_0x862b('0x27')]+_0x862b('0x32'));}}}Preview[_0x862b('0xd')]['loopCampaigns']=function(){var _0x5a4f1e=this;setInterval(function(){_0x5a4f1e[_0x862b('0x33')]();},0x7cf);};Preview['prototype'][_0x862b('0x33')]=function(){var _0x4f514f=this['campaignsPreview'];this[_0x862b('0x34')]+=0x1;for(var _0x32ce49 in _0x4f514f){if(_0x4f514f[_0x862b('0x35')](_0x32ce49)&&(_0x4f514f[_0x32ce49][_0x862b('0x36')]===_0x862b('0x3')||_0x4f514f[_0x32ce49][_0x862b('0x36')]===_0x862b('0x37'))&&_0x4f514f[_0x32ce49][_0x862b('0x38')]==='outbound'){if(this[_0x862b('0x34')]>0x7){this[_0x862b('0x34')]=0x0;this[_0x862b('0x39')]();}}if(_0x4f514f['hasOwnProperty'](_0x32ce49)&&_0x4f514f[_0x32ce49][_0x862b('0x36')]===_0x862b('0x3')&&_0x4f514f[_0x32ce49][_0x862b('0x38')]==='outbound'){if(_0x4f514f[_0x32ce49][_0x862b('0x3a')]){this[_0x862b('0x3b')](_0x4f514f[_0x32ce49]);if(_0x4f514f[_0x32ce49][_0x862b('0x3c')])this['recallMe'](_0x4f514f[_0x32ce49]);}else{notSendMessagesQueue(_0x4f514f[_0x32ce49]);}}}};Preview['prototype'][_0x862b('0x3d')]=function(_0x559de6){var _0x3b2d13=this;this['sequence'][_0x862b('0xe')](function(){if(!_['isNil'](_0x3b2d13['actions'][_0x559de6])){loggerAction['info'](_0x862b('0x3e'),_0x559de6,_0x862b('0x3f'),_0x3b2d13[_0x862b('0x12')][_0x559de6][_0x862b('0x40')],_0x862b('0x41'),JSON[_0x862b('0x26')](_0x3b2d13['campaignsPreview'][_0x3b2d13[_0x862b('0x12')][_0x559de6]['queue']][_0x862b('0x2b')]),_0x862b('0x42'),JSON[_0x862b('0x26')](_0x3b2d13['campaignsPreview'][_0x3b2d13[_0x862b('0x12')][_0x559de6][_0x862b('0x40')]][_0x862b('0x43')]),JSON[_0x862b('0x26')](_0x3b2d13[_0x862b('0x12')][_0x559de6][_0x862b('0x44')]),JSON[_0x862b('0x26')](_[_0x862b('0x45')](_0x3b2d13[_0x862b('0x12')][_0x559de6],[_0x862b('0x46'),_0x862b('0x47'),_0x862b('0x48'),_0x862b('0x49')])));return ami[_0x862b('0x4a')]({'action':'status','channel':_0x3b2d13[_0x862b('0x12')][_0x559de6][_0x862b('0x4b')]})['catch'](function(_0x4184ca){if(_0x4184ca[_0x862b('0x30')]===_0x862b('0x4c')){setTimeout(function(){if(_0x3b2d13[_0x862b('0x12')][_0x559de6]){ut[_0x862b('0x4d')](_0x3b2d13[_0x862b('0x23')][_0x3b2d13[_0x862b('0x12')][_0x559de6][_0x862b('0x40')]],'[clearZombieChannel]');if(_0x3b2d13['actions'][_0x559de6][_0x862b('0x44')]===!![]){ut[_0x862b('0x4e')](_0x3b2d13['campaignsPreview'][_0x3b2d13['actions'][_0x559de6][_0x862b('0x40')]],_0x862b('0x4f'));ut[_0x862b('0x50')](_0x862b('0x51')+_0x559de6,_0x3b2d13['actions'][_0x559de6][_0x862b('0x40')]);}ut[_0x862b('0x50')](_0x862b('0x52')+_0x559de6,_0x3b2d13[_0x862b('0x12')][_0x559de6][_0x862b('0x40')]);delete _0x3b2d13[_0x862b('0x12')][_0x559de6];}},0x2328);}});}});};Preview[_0x862b('0xd')][_0x862b('0x39')]=function(){var _0x2d36b7=this;loggerAction['info'](_0x862b('0x53'),_[_0x862b('0x54')](this['actions']));for(var _0x3e4481 in this[_0x862b('0x12')]){if(_0x2d36b7[_0x862b('0x12')][_0x862b('0x35')](_0x3e4481)){_0x2d36b7[_0x862b('0x3d')](_0x3e4481);}}};Preview['prototype']['recallMe']=function(_0x2ae7fa){var _0x583aed=this;rpcDb[_0x862b('0x55')](_0x2ae7fa['id'],ut['agentReadyId'](this['agents']))[_0x862b('0x56')](function(_0x2004cb){if(!_[_0x862b('0x57')](_0x2004cb)){for(var _0x1879ec=0x0;_0x1879ec<_0x2004cb[_0x862b('0x58')];_0x1879ec+=0x1){if(ut[_0x862b('0x59')](_0x2004cb[_0x1879ec][_0x862b('0x5a')])<_0x2ae7fa['dialRecallMeTimeout']*0x3c){if(_0x2004cb[_0x1879ec][_0x862b('0x5b')]&&!_0x2004cb[_0x1879ec]['Agent'][_0x862b('0x5c')]){_0x583aed[_0x862b('0x5d')](_0x2004cb[_0x1879ec]['id'])[_0x862b('0x56')](ut[_0x862b('0x5e')]('[RecallMe]'))[_0x862b('0x5f')](ut['logger2'](_0x862b('0x60')));}else{rpcDb[_0x862b('0x61')](_0x2004cb[_0x1879ec]['id']);}}else{var _0x2bbe46=new Action(_0x2004cb[_0x1879ec],_0x2ae7fa);_0x2bbe46[_0x862b('0x62')]=moment()[_0x862b('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x2ae7fa[_0x862b('0x64')]+=0x1;ut[_0x862b('0x65')](_0x2bbe46,0x17,_0x862b('0x66'));if(_0x2ae7fa[_0x862b('0x67')]){rpcDb[_0x862b('0x68')](ut[_0x862b('0x69')](_0x2004cb[_0x1879ec]));rpcDb[_0x862b('0x6a')](_0x2bbe46,_0x862b('0x6b'));}else{ut[_0x862b('0x65')](_0x2bbe46,0x16,'RecallFailedTimeout');rpcDb[_0x862b('0x6a')](_0x2bbe46,_0x862b('0x6c'));rpcDb['createCustomerFinal'](_0x2bbe46,_0x862b('0x6c'));}}}}})[_0x862b('0x5f')](ut[_0x862b('0x5e')]('[getContactRecallMe]'));};Preview[_0x862b('0xd')][_0x862b('0x3b')]=function(_0x6ddc71){_0x6ddc71[_0x862b('0x2a')]=!![];if(ut[_0x862b('0x6d')](_0x6ddc71[_0x862b('0x6e')])){_0x6ddc71['message']=utils['CAMPAIGN_STATUS'][_0x862b('0x6f')];}else if(!ut[_0x862b('0x70')](_0x6ddc71[_0x862b('0x3a')])){_0x6ddc71[_0x862b('0x30')]=utils[_0x862b('0x2d')]['INACTIVE'];}else if(!this['isTrunkReachable'](_0x6ddc71[_0x862b('0x71')])){if(!this[_0x862b('0x72')](_0x6ddc71[_0x862b('0x73')])){_0x6ddc71[_0x862b('0x30')]=utils[_0x862b('0x2d')][_0x862b('0x74')];}else{_0x6ddc71[_0x862b('0x30')]=utils['CAMPAIGN_STATUS'][_0x862b('0x75')];}}else{_0x6ddc71[_0x862b('0x30')]=utils[_0x862b('0x2d')][_0x862b('0x75')];}};Preview['prototype'][_0x862b('0x76')]=function(_0x2a7b63,_0xa5ce0d,_0x27997a){var _0x2a9c10=this;var _0x2bfd5f=this[_0x862b('0x12')][_0xa5ce0d];var _0x3ef433=this[_0x862b('0x23')][_0x2bfd5f[_0x862b('0x40')]];var _0x1ad22f;var _0x433f0d=![];var _0x123127=0x2;var _0x426522=0x3;if(_0x3ef433){switch(_0x27997a){case'1':_0x3ef433['outboundNoSuchCallsDay']+=0x1;_0x2bfd5f['countnosuchnumberretry']+=0x1;_0x2bfd5f[_0x862b('0x77')]=ut[_0x862b('0x78')](_0x2bfd5f);ut[_0x862b('0x65')](_0x2bfd5f,0x0,_0x862b('0x79'));ami[_0x862b('0x24')](_0x862b('0x7a'),ut[_0x862b('0x7b')](_0x2bfd5f,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x2bfd5f,_0x862b('0x7c'));_0x2a9c10[_0x862b('0x7d')](_0x2bfd5f,'0',_0x3ef433)['then'](function(_0x2f09b7){_0x433f0d=_0x2f09b7['additional']==0x1;_0x123127=_0x3ef433['dialNoSuchNumberRetryFrequency'];_0x426522=_0x3ef433[_0x862b('0x7e')];if(!_0x433f0d){if(ut[_0x862b('0x78')](_0x2bfd5f)>=_0x3ef433['dialGlobalMaxRetry']){_0x1ad22f=ut[_0x862b('0x7f')](_0x2bfd5f,0xf,_0x862b('0x80'));rpcDb[_0x862b('0x81')](_0x1ad22f,_0x862b('0x82'));}else{if(_0x2bfd5f[_0x862b('0x83')]>=_0x3ef433[_0x862b('0x84')]){rpcDb[_0x862b('0x81')](_0x2bfd5f,_0x862b('0x82'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x2bfd5f,_0x862b('0x83'),_0x3ef433[_0x862b('0x85')]),_0x2bfd5f['unlockAgent'],_0x2bfd5f[_0x862b('0x86')]);}}delete this[_0x862b('0x12')][_0x2a7b63[_0x862b('0x87')]];}else{_0x2bfd5f[_0x862b('0x83')]++;logger[_0x862b('0x25')]('actioncountonusuch',_0x2bfd5f[_0x862b('0x83')]);logger[_0x862b('0x25')]('id',_0x2bfd5f['idContact']);_0x2a9c10[_0x862b('0x88')]({'id':_0x2bfd5f[_0x862b('0x89')],'field':{'countnosuchnumberretry':_0x2bfd5f[_0x862b('0x83')]}})[_0x862b('0x56')](function(){_0x2a9c10['swapAdditionalPhones'](_0x2bfd5f,_0x123127,_0x426522)[_0x862b('0x56')](function(){});});}});break;case _0x862b('0x8a'):var _0x4ddf46=moment()[_0x862b('0x63')](_0x862b('0x8b'));_0x2bfd5f['responsetime']=_0x4ddf46;_0x2bfd5f[_0x862b('0x8c')]=_0x4ddf46;_0x2bfd5f[_0x862b('0x44')]=!![];_0x3ef433[_0x862b('0x43')]+=0x1;logger[_0x862b('0x25')](_0x862b('0x8d'),_0x2bfd5f[_0x862b('0x8e')],_0x862b('0x8f'),_0x3ef433[_0x862b('0x27')],_0x862b('0x42'),_0x3ef433[_0x862b('0x43')]);ami[_0x862b('0x24')](_0x862b('0x90'),ut[_0x862b('0x7b')](_0x2bfd5f,_0x862b('0x91'),this[_0x862b('0x23')][_0x2bfd5f['queue']]));if(_0x3ef433[_0x862b('0x92')]){ami[_0x862b('0x24')]('custom:agentConnectPreview',ut[_0x862b('0x93')](_0x2bfd5f));}break;case'16':ami[_0x862b('0x24')](_0x862b('0x94'),ut['buildObj'](_0x2bfd5f,_0x862b('0x95'),this[_0x862b('0x23')][_0x2bfd5f[_0x862b('0x40')]]));emitVoiceQueueChannelRemove(ut[_0x862b('0x7b')](_0x2bfd5f,_0x862b('0x95')));_0x3ef433[_0x862b('0x96')]+=0x1;_0x3ef433[_0x862b('0x97')]+=0x1;_0x3ef433[_0x862b('0x98')]+=0x1;ut['decrementTalkink'](_0x3ef433,_0x862b('0x99'));_0x2bfd5f[_0x862b('0x77')]=ut[_0x862b('0x78')](_0x2bfd5f);ut[_0x862b('0x65')](_0x2bfd5f,0x4,'Answer');rpcDb['createCustomerHistory'](_0x2bfd5f,_0x862b('0x9a'));rpcDb[_0x862b('0x81')](_0x2bfd5f,_0x862b('0x9b'));rpcDb[_0x862b('0x9c')](_0x2bfd5f);_0x3ef433[_0x862b('0x9d')]+=_0x2bfd5f[_0x862b('0x9e')];_0x3ef433[_0x862b('0x9f')]+=_0x2bfd5f[_0x862b('0x9e')];logger['info'](_0x862b('0xa0'),_0x2bfd5f[_0x862b('0x8e')],_0x862b('0x8f'),_0x3ef433[_0x862b('0x27')],_0x862b('0x42'),_0x3ef433['pTalking']);delete this['actions'][_0x2a7b63['linkedid']];break;case _0x862b('0xa1'):_0x3ef433[_0x862b('0xa2')]+=0x1;_0x2bfd5f[_0x862b('0xa3')]+=0x1;_0x2bfd5f['countglobal']=ut[_0x862b('0x78')](_0x2bfd5f);ut['logCustomer'](_0x2bfd5f,0x5,_0x862b('0xa4'));_0x123127=_0x3ef433[_0x862b('0xa5')];_0x426522=_0x3ef433[_0x862b('0x7e')];ami['emit'](_0x862b('0xa6'),ut[_0x862b('0x7b')](_0x2bfd5f,'busy'));rpcDb['createCustomerHistory'](_0x2bfd5f,_0x862b('0xa7'));_0x2a9c10[_0x862b('0x7d')](_0x2bfd5f,'5',_0x3ef433)[_0x862b('0x56')](function(_0x5a8744){_0x433f0d=_0x5a8744[_0x862b('0xa8')]==0x1;if(!_0x433f0d){if(ut[_0x862b('0x78')](_0x2bfd5f)>=_0x3ef433[_0x862b('0xa9')]){_0x1ad22f=ut[_0x862b('0x7f')](_0x2bfd5f,0xf,_0x862b('0x80'));rpcDb[_0x862b('0x81')](_0x1ad22f,_0x862b('0xaa'));}else{if(_0x2bfd5f['countbusyretry']>=_0x3ef433[_0x862b('0xab')]){rpcDb['createCustomerFinal'](_0x2bfd5f,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x862b('0xac')](ut['scheduledAt'](_0x2bfd5f,_0x862b('0xa3'),_0x3ef433[_0x862b('0xa5')]),_0x2bfd5f[_0x862b('0xad')],_0x2bfd5f[_0x862b('0x86')]);}}}else{_0x2bfd5f[_0x862b('0xa3')]++;_0x2a9c10[_0x862b('0x88')]({'id':_0x2bfd5f[_0x862b('0x89')],'field':{'countbusyretry':_0x2bfd5f[_0x862b('0xa3')]}})['then'](function(){_0x2a9c10[_0x862b('0xae')](_0x2bfd5f,_0x123127,_0x426522)[_0x862b('0x56')](function(){});});}});break;case _0x862b('0xaf'):_0x3ef433['outboundNoAnswerCallsDay']+=0x1;_0x2bfd5f[_0x862b('0xb0')]+=0x1;_0x2bfd5f['countglobal']=ut['totalGlobal'](_0x2bfd5f);ut[_0x862b('0x65')](_0x2bfd5f,0x3,'NoAnswer');_0x123127=_0x3ef433[_0x862b('0xb1')];_0x426522=_0x3ef433[_0x862b('0x7e')];var _0x2fd881=ut[_0x862b('0xb2')](_0x2bfd5f,_0x3ef433);ami[_0x862b('0x24')](_0x862b('0xb3'),_0x2fd881);rpcDb[_0x862b('0x6a')](_0x2bfd5f,'[callProgressDetectingCustomer][logNoAnswer]');_0x2a9c10[_0x862b('0x7d')](_0x2bfd5f,'3',_0x3ef433)[_0x862b('0x56')](function(_0x3afb27){_0x433f0d=_0x3afb27[_0x862b('0xa8')]==0x1;if(!_0x433f0d){if(ut[_0x862b('0x78')](_0x2bfd5f)>=_0x3ef433[_0x862b('0xa9')]){_0x1ad22f=ut[_0x862b('0x7f')](_0x2bfd5f,0xf,'Global');rpcDb['createCustomerFinal'](_0x1ad22f,_0x862b('0xb4'));}else{if(_0x2bfd5f[_0x862b('0xb0')]>=_0x3ef433[_0x862b('0xb5')]){rpcDb[_0x862b('0x81')](_0x2bfd5f,_0x862b('0xb6'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x2bfd5f,'countnoanswerretry',_0x3ef433[_0x862b('0xb1')]),_0x2bfd5f[_0x862b('0xad')],_0x2bfd5f[_0x862b('0x86')]);}}}else{_0x2bfd5f[_0x862b('0xb0')]++;_0x2a9c10[_0x862b('0x88')]({'id':_0x2bfd5f[_0x862b('0x89')],'field':{'countnoanswerretry':_0x2bfd5f[_0x862b('0xb0')]}})[_0x862b('0x56')](function(){_0x2a9c10[_0x862b('0xae')](_0x2bfd5f,_0x123127,_0x426522)[_0x862b('0x56')](function(){});});}});break;case _0x862b('0xb7'):_0x3ef433['outboundCongestionCallsDay']+=0x1;_0x2bfd5f[_0x862b('0xb8')]+=0x1;_0x2bfd5f['countglobal']=ut[_0x862b('0x78')](_0x2bfd5f);ut['logCustomer'](_0x2bfd5f,0x8,_0x862b('0xb9'));_0x123127=_0x3ef433[_0x862b('0xba')];_0x426522=_0x3ef433['callAdditionalPhoneAfterMin'];ami[_0x862b('0x24')](_0x862b('0xbb'),ut[_0x862b('0x7b')](_0x2bfd5f,_0x862b('0xbc')));rpcDb['createCustomerHistory'](_0x2bfd5f,_0x862b('0xbd'));_0x2a9c10[_0x862b('0x7d')](_0x2bfd5f,'8',_0x3ef433)[_0x862b('0x56')](function(_0x4e6f9c){_0x433f0d=_0x4e6f9c[_0x862b('0xa8')]==0x1;if(!_0x433f0d){if(ut[_0x862b('0x78')](_0x2bfd5f)>=_0x3ef433['dialGlobalMaxRetry']){_0x1ad22f=ut[_0x862b('0x7f')](_0x2bfd5f,0xf,_0x862b('0x80'));rpcDb[_0x862b('0x81')](_0x1ad22f,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x2bfd5f[_0x862b('0xb8')]>=_0x3ef433[_0x862b('0xbe')]){rpcDb['createCustomerFinal'](_0x2bfd5f,_0x862b('0xbd'));}else{rpcDb[_0x862b('0xac')](ut[_0x862b('0xbf')](_0x2bfd5f,'countcongestionretry',_0x3ef433[_0x862b('0xa5')]),_0x2bfd5f[_0x862b('0xad')],_0x2bfd5f['activeContact']);}}}else{_0x2bfd5f[_0x862b('0xb8')]++;_0x2a9c10[_0x862b('0x88')]({'id':_0x2bfd5f[_0x862b('0x89')],'field':{'countcongestionretry':_0x2bfd5f[_0x862b('0xb8')]}})[_0x862b('0x56')](function(){_0x2a9c10['swapAdditionalPhones'](_0x2bfd5f,_0x123127,_0x426522)['then'](function(){});});}});break;case'CANCEL':_0x3ef433[_0x862b('0xc0')]+=0x1;_0x2bfd5f[_0x862b('0xc1')]+=0x1;_0x2bfd5f['countglobal']=ut[_0x862b('0x78')](_0x2bfd5f);ut[_0x862b('0x65')](_0x2bfd5f,0x14,'AgentReject');_0x123127=_0x3ef433[_0x862b('0xc2')];_0x426522=_0x3ef433['callAdditionalPhoneAfterMin'];ami[_0x862b('0x24')]('custom:agentreject',ut[_0x862b('0x7b')](_0x2bfd5f,_0x862b('0xc3')));rpcDb[_0x862b('0x6a')](_0x2bfd5f,'[syncHangupRequest][logAgentReject]');_0x2a9c10[_0x862b('0x7d')](_0x2bfd5f,'20',_0x3ef433)[_0x862b('0x56')](function(_0x55771f){_0x433f0d=_0x55771f[_0x862b('0xa8')]==0x1;if(!_0x433f0d){if(ut['totalGlobal'](_0x2bfd5f)>=_0x3ef433[_0x862b('0xa9')]){_0x1ad22f=ut['cloneAction'](_0x2bfd5f,0x14,_0x862b('0xc4'));rpcDb['createCustomerFinal'](_0x1ad22f,_0x862b('0xc5'));}else{if(_0x2bfd5f[_0x862b('0xc1')]>=_0x3ef433[_0x862b('0xc6')]){rpcDb[_0x862b('0x81')](_0x2bfd5f,_0x862b('0xc5'));}else{rpcDb[_0x862b('0xac')](ut[_0x862b('0xbf')](_0x2bfd5f,'countagentrejectretry',_0x3ef433['dialAgentRejectRetryFrequency']),_0x2bfd5f['unlockAgent'],_0x2bfd5f[_0x862b('0x86')]);}}}else{_0x2bfd5f[_0x862b('0xb0')]++;_0x2a9c10['incrementPreviewCounters']({'id':_0x2bfd5f[_0x862b('0x89')],'field':{'countnoanswerretry':_0x2bfd5f[_0x862b('0xb0')]}})['then'](function(){_0x2a9c10[_0x862b('0xae')](_0x2bfd5f,_0x123127,_0x426522)[_0x862b('0x56')](function(){});});}});break;case'ABANDONED':_0x3ef433[_0x862b('0xc7')]+=0x1;_0x2bfd5f[_0x862b('0xc8')]+=0x1;_0x2bfd5f[_0x862b('0x77')]=ut[_0x862b('0x78')](_0x2bfd5f);ut[_0x862b('0x65')](_0x2bfd5f,0xb,_0x862b('0xc9'));rpcDb['createCustomerHistory'](_0x2bfd5f,'[callProgressDetectingCustomer][logAbandoned]');_0x2a9c10['verifyAdditionalPhones'](_0x2bfd5f,'11',_0x3ef433)['then'](function(_0x551ae6){_0x433f0d=_0x551ae6[_0x862b('0xa8')]==0x1;if(!_0x433f0d){if(ut[_0x862b('0x78')](_0x2bfd5f)>=_0x3ef433[_0x862b('0xa9')]){_0x1ad22f=ut[_0x862b('0x7f')](_0x2bfd5f,0xf,_0x862b('0x80'));rpcDb[_0x862b('0x81')](_0x1ad22f,_0x862b('0xca'));}else{if(_0x2bfd5f[_0x862b('0xcb')]>=_0x3ef433[_0x862b('0xcc')]){rpcDb[_0x862b('0x81')](_0x2bfd5f,_0x862b('0xca'));}else{rpcDb[_0x862b('0xac')](ut['scheduledAt'](_0x2bfd5f,_0x862b('0xc8'),_0x3ef433['dialAbandonedRetryFrequency']),_0x2bfd5f[_0x862b('0xad')],_0x2bfd5f[_0x862b('0x86')]);}}}else{_0x2bfd5f[_0x862b('0xb0')]++;_0x2a9c10[_0x862b('0x88')]({'id':_0x2bfd5f['idContact'],'field':{'countnoanswerretry':_0x2bfd5f[_0x862b('0xb0')]}})[_0x862b('0x56')](function(){_0x2a9c10[_0x862b('0xae')](_0x2bfd5f,_0x123127,_0x426522)['then'](function(){});});}});break;case'18':_0x3ef433[_0x862b('0xcd')]+=0x1;_0x2bfd5f[_0x862b('0xce')]+=0x1;_0x2bfd5f[_0x862b('0x77')]=ut['totalGlobal'](_0x2bfd5f);ut[_0x862b('0x65')](_0x2bfd5f,0x12,_0x2a7b63['cause-txt']||_0x2a7b63[_0x862b('0xcf')]);ami[_0x862b('0x24')](_0x862b('0xd0'),ut[_0x862b('0x7b')](_0x2bfd5f,_0x862b('0xd1')));rpcDb['createCustomerHistory'](_0x2bfd5f,_0x862b('0xd2'));_0x2a9c10['verifyAdditionalPhones'](_0x2bfd5f,'18',_0x3ef433)['then'](function(_0x148f58){_0x433f0d=_0x148f58[_0x862b('0xa8')]==0x1;if(!_0x433f0d){if(ut[_0x862b('0x78')](_0x2bfd5f)>=_0x3ef433[_0x862b('0xa9')]){_0x1ad22f=ut['cloneAction'](_0x2bfd5f,0x12,'Global');rpcDb[_0x862b('0x81')](_0x1ad22f,_0x862b('0xd2'));}else{rpcDb[_0x862b('0x81')](_0x2bfd5f,_0x862b('0xd2'));}}else{_0x2bfd5f[_0x862b('0xb0')]++;_0x2a9c10[_0x862b('0x88')]({'id':_0x2bfd5f[_0x862b('0x89')],'field':{'countnoanswerretry':_0x2bfd5f[_0x862b('0xb0')]}})[_0x862b('0x56')](function(){_0x2a9c10[_0x862b('0xae')](_0x2bfd5f,_0x123127,_0x426522)[_0x862b('0x56')](function(){});});}});delete this[_0x862b('0x12')][_0x2a7b63[_0x862b('0x87')]];break;case'19':_0x3ef433[_0x862b('0xcd')]+=0x1;_0x2bfd5f[_0x862b('0x77')]=ut[_0x862b('0x78')](_0x2bfd5f);ut[_0x862b('0x65')](_0x2bfd5f,0x13,_0x2a7b63[_0x862b('0xd3')]||_0x2a7b63['dialstatus']);ami[_0x862b('0x24')](_0x862b('0xd0'),ut[_0x862b('0x7b')](_0x2bfd5f,'amd'));rpcDb[_0x862b('0x6a')](_0x2bfd5f,_0x862b('0xd4'));_0x2a9c10['verifyAdditionalPhones'](_0x2bfd5f,'18',_0x3ef433)[_0x862b('0x56')](function(_0x493209){_0x433f0d=_0x493209['additional']==0x1;if(!_0x433f0d){if(ut[_0x862b('0x78')](_0x2bfd5f)>=_0x3ef433[_0x862b('0xa9')]){_0x1ad22f=ut[_0x862b('0x7f')](_0x2bfd5f,0xf,_0x862b('0x80'));rpcDb[_0x862b('0x81')](_0x1ad22f,_0x862b('0xd4'));}else{rpcDb[_0x862b('0x81')](_0x2bfd5f,_0x862b('0xd4'));}}else{_0x2bfd5f[_0x862b('0xb0')]++;_0x2a9c10['incrementPreviewCounters']({'id':_0x2bfd5f['idContact'],'field':{'countnoanswerretry':_0x2bfd5f[_0x862b('0xb0')]}})[_0x862b('0x56')](function(){_0x2a9c10['swapAdditionalPhones'](_0x2bfd5f,_0x123127,_0x426522)['then'](function(){});});}});delete this[_0x862b('0x12')][_0x2a7b63[_0x862b('0x87')]];break;default:if(_0x2bfd5f[_0x862b('0x44')]){ut[_0x862b('0x4e')](_0x3ef433,'[default]');ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x3ef433[_0x862b('0x27')],_0x2a7b63);}_0x3ef433[_0x862b('0xcd')]+=0x1;_0x2bfd5f[_0x862b('0x77')]=ut['totalGlobal'](_0x2bfd5f);ut[_0x862b('0x65')](_0x2bfd5f,0xc,_0x2a7b63[_0x862b('0xd3')]||_0x2a7b63[_0x862b('0xcf')]);_0x123127=_0x3ef433[_0x862b('0xc2')];_0x426522=_0x3ef433[_0x862b('0x7e')];rpcDb['createCustomerHistory'](_0x2bfd5f,_0x862b('0xd5'));_0x2a9c10[_0x862b('0x7d')](_0x2bfd5f,'20',_0x3ef433)[_0x862b('0x56')](function(_0x3625a8){_0x433f0d=_0x3625a8[_0x862b('0xa8')]==0x1;if(!_0x433f0d){if(ut[_0x862b('0x78')](_0x2bfd5f)>=_0x3ef433[_0x862b('0xa9')]){_0x1ad22f=ut['cloneAction'](_0x2bfd5f,0xf,_0x862b('0x80'));rpcDb[_0x862b('0x81')](_0x1ad22f,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x862b('0x81')](_0x2bfd5f,_0x862b('0xd6'));}delete this[_0x862b('0x12')][_0x2a7b63['linkedid']];}else{_0x2a9c10[_0x862b('0xae')](_0x2bfd5f,_0x123127,_0x426522)[_0x862b('0x56')](function(){});}});}if(!(_0x2bfd5f[_0x862b('0x44')]&&_0x27997a==='16')){ut[_0x862b('0x4d')](_0x3ef433,_0x862b('0xd7'));logger['info'](_0x862b('0xd8'),_0x2bfd5f[_0x862b('0x8e')],_0x862b('0x8f'),_0x3ef433[_0x862b('0x27')],_0x862b('0x41'),_0x3ef433[_0x862b('0x2b')]);}if(_0x27997a!==_0x862b('0x8a')){delete this[_0x862b('0x12')][_0x2a7b63[_0x862b('0x87')]];delete this[_0x862b('0x12')][_0x2a7b63[_0x862b('0xd9')]];}_0x3ef433['queueSummaryCountersUpdated']=!![];}};Preview[_0x862b('0xd')][_0x862b('0xda')]=function(_0x1f07d3,_0x34705a,_0x58b07a){if(_[_0x862b('0xdb')](_0x34705a)&&'object'!==typeof _0x34705a){return;}if(_[_0x862b('0xdb')](_0x58b07a)&&_0x862b('0xdc')!==typeof _0x58b07a){return;}switch(_0x58b07a[_0x862b('0xdd')]){case'0':ut[_0x862b('0xde')](_0x1f07d3,0x0,_0x862b('0x79'));rpcDb[_0x862b('0xdf')](_0x1f07d3,_0x862b('0xe0'));break;case'3':ut[_0x862b('0xde')](_0x1f07d3,0x3,_0x862b('0xe1'));rpcDb[_0x862b('0xdf')](_0x1f07d3,_0x862b('0xe2'));break;case'5':ut[_0x862b('0xde')](_0x1f07d3,0x5,_0x862b('0xa4'));rpcDb[_0x862b('0xdf')](_0x1f07d3,_0x862b('0xe3'));break;case'8':ut[_0x862b('0xde')](_0x1f07d3,0x8,_0x862b('0xb9'));rpcDb['createAgentHistory'](_0x1f07d3,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x1f07d3,0x16,_0x862b('0xe4'));rpcDb[_0x862b('0xdf')](_0x1f07d3,_0x862b('0xe5'));break;default:ut['logAgent'](_0x1f07d3,0xc,_0x58b07a['reason']);rpcDb[_0x862b('0xdf')](_0x1f07d3,_0x862b('0xe6'));}ut[_0x862b('0x4d')](_0x34705a,_0x862b('0xe7'));logger[_0x862b('0x25')](_0x862b('0xe8'),_0x1f07d3['uniqueid'],'\x20Queue',_0x34705a[_0x862b('0x27')],_0x862b('0x41'),_0x34705a[_0x862b('0x2b')]);delete this[_0x862b('0x12')][_0x1f07d3[_0x862b('0x8e')]];};Preview[_0x862b('0xd')]['verifyAdditionalPhones']=function(_0x25bd6f,_0x2f10a7,_0x128e04){return cmHopperAdditionalPhone[_0x862b('0x7d')](_0x25bd6f,_0x2f10a7,_0x128e04)[_0x862b('0x5f')](logger['info'](_0x862b('0xe9')));};Preview['prototype'][_0x862b('0xae')]=function(_0x58d6f5,_0x93cf4d,_0x435aba){return cmHopperAdditionalPhone[_0x862b('0xae')](_0x58d6f5,_0x93cf4d,_0x435aba)['catch'](logger[_0x862b('0x25')](_0x862b('0xea')));};Preview['prototype'][_0x862b('0x88')]=function(_0x203111){return Promise[_0x862b('0xeb')]()[_0x862b('0x56')](cmHopperAdditionalPhone[_0x862b('0x88')](_0x203111))[_0x862b('0x5f')](logger[_0x862b('0x25')]('[incrementPreviewCounters]\x20'));};Preview[_0x862b('0xd')][_0x862b('0xec')]=function(_0x5141bf,_0x277d4d,_0x223820,_0xb03bf7,_0x120271){var _0x1f51b7=this;return new Promise(function(_0x3a398d,_0x25cabc){if(_[_0x862b('0x57')](_0x277d4d)||_[_0x862b('0x57')](_0x277d4d[_0x862b('0xed')])||_[_0x862b('0x57')](_0x277d4d[_0x862b('0xee')])||_[_0x862b('0x57')](_0x277d4d['VoiceQueueId'])){_0x25cabc(ut[_0x862b('0x30')](_0x862b('0xef'),_0xb03bf7,_0x120271));return;}var _0x4a4ef0=uuid['v4']();var _0x3ff6e0=_0x1f51b7[_0x862b('0x23')][_0x277d4d[_0x862b('0x3f')][_0x862b('0x27')]];var _0x2b8fee=_0x223820?_0x1f51b7[_0x862b('0x13')][_0x223820]['id']:undefined;_0x1f51b7['actions'][_0x4a4ef0]=new Action(_0x277d4d,_0x3ff6e0,_0x4a4ef0,_0x223820,_0x2b8fee);var _0x37621a=_0x1f51b7[_0x862b('0x12')][_0x4a4ef0];_0x37621a[_0x862b('0xad')]=_0xb03bf7;_0x37621a[_0x862b('0x86')]=_0x120271;_0x37621a['lookAgent']=_0x223820;if(_['isEmpty'](_0x5141bf)){_0x1f51b7[_0x862b('0xf0')](_0x37621a,_0x3ff6e0,_0x277d4d,_0x223820)[_0x862b('0x56')](function(_0x297926){logger[_0x862b('0x25')](_0x862b('0xf1'),_0x862b('0xf2')+_0x37621a['queue']+_0x862b('0xf3')+_0x37621a[_0x862b('0x89')],JSON['stringify'](_0x297926));ami[_0x862b('0x24')](_0x862b('0xf4'),ut['buildObj'](_0x37621a,_0x862b('0xf5'),_0x1f51b7[_0x862b('0x23')][_0x37621a[_0x862b('0x40')]]));_0x3a398d(ut[_0x862b('0x30')]('Calling'));})[_0x862b('0x5f')](function(_0x364587){ut[_0x862b('0x31')](_0x862b('0xf6'),_0x364587);_0x25cabc(ut[_0x862b('0x30')](_0x862b('0xf7'),_0xb03bf7,_0x120271));});}else{_0x3ff6e0[_0x862b('0xf8')]+=0x1;ut[_0x862b('0xf9')](_0x37621a);rpcDb[_0x862b('0xfa')](_0x37621a,_0x862b('0xfb'));delete _0x1f51b7[_0x862b('0x12')][_0x4a4ef0];_0x25cabc(ut['message']('Contact\x20in\x20black\x20List',_0xb03bf7,_0x120271));}});};Preview[_0x862b('0xd')]['isTrunkReachable']=function(_0x4d3962){return!_[_0x862b('0x57')](_0x4d3962)&&!_[_0x862b('0x57')](_0x4d3962[_0x862b('0x27')])&&!_[_0x862b('0x57')](_0x4d3962[_0x862b('0xfc')])&&_0x4d3962[_0x862b('0xfc')]&&!_[_0x862b('0x57')](this[_0x862b('0x11')][util[_0x862b('0x63')]('SIP/%s',_0x4d3962[_0x862b('0x27')])])&&!_['isNil'](this[_0x862b('0x11')][util[_0x862b('0x63')](_0x862b('0xfd'),_0x4d3962[_0x862b('0x27')])][_0x862b('0xfe')])&&(this[_0x862b('0x11')][util[_0x862b('0x63')](_0x862b('0xfd'),_0x4d3962[_0x862b('0x27')])][_0x862b('0xfe')]==='reachable'||this[_0x862b('0x11')][util['format'](_0x862b('0xfd'),_0x4d3962['name'])][_0x862b('0xfe')]===_0x862b('0xff'));};Preview[_0x862b('0xd')][_0x862b('0x5d')]=function(_0x50c1b8,_0x27ef6e){return this[_0x862b('0x100')](_0x50c1b8,_0x27ef6e)[_0x862b('0x56')](function(_0x1ae7c4){return _['pick'](_0x1ae7c4,[_0x862b('0x30')]);})[_0x862b('0x5f')](function(_0x225b82){if(_0x225b82['unlock']){rpcDb[_0x862b('0x101')](_0x50c1b8);}if(_0x225b82[_0x862b('0xfc')]){rpcDb['disableContact'](_0x50c1b8);}throw _['pick'](_0x225b82,[_0x862b('0x30')]);});};Preview[_0x862b('0xd')][_0x862b('0x100')]=function(_0x14ad61,_0x282915){var _0x45ef61=this;var _0x5e7e5a,_0x572e47;return rpcDb[_0x862b('0x102')](_0x14ad61)[_0x862b('0x56')](function(_0x1c227b){if(!_[_0x862b('0x57')](_0x1c227b[0x0])){_0x572e47=_0x1c227b[0x0][_0x862b('0x103')]?![]:!![];_0x5e7e5a=_0x1c227b[0x0][_0x862b('0x103')]?!![]:![];_0x5e7e5a=_0x282915?!![]:_0x5e7e5a;}var _0x38a198=_0x45ef61[_0x862b('0x104')](_0x1c227b);if(_0x38a198['isValid']){rpcDb['checkIsBlackList'](_['pick'](_0x1c227b[0x0],[_0x862b('0x48'),_0x862b('0xee')]))['then'](function(_0xff461d){_0x45ef61[_0x862b('0xec')](_0xff461d,_0x1c227b[0x0],_0x282915,_0x572e47,_0x5e7e5a)[_0x862b('0x56')](function(_0x24dc1b){return _0x24dc1b;})[_0x862b('0x5f')](function(_0x396afb){throw _0x396afb;});})[_0x862b('0x5f')](function(_0x21747d){ut[_0x862b('0x31')](_0x862b('0x105'),_0x21747d);throw ut[_0x862b('0x30')]('Call\x20unsuccessful',_0x572e47,_0x5e7e5a);});}else{throw ut['message'](_0x38a198[_0x862b('0x30')],_0x572e47,_0x5e7e5a);}})[_0x862b('0x5f')](function(_0x40b8d6){ut[_0x862b('0x31')]('[Preview][getContactPreview]',_0x40b8d6);throw ut[_0x862b('0x30')](_0x862b('0x106'),![],!![]);});};Preview[_0x862b('0xd')]['validateContact']=function(_0x2ade8b){if(_[_0x862b('0x57')](_0x2ade8b)||_[_0x862b('0x107')](_0x2ade8b)||!_[_0x862b('0x57')](_0x2ade8b[0x0][_0x862b('0x5b')])&&_['isNil'](_0x2ade8b[0x0]['Agent'][_0x862b('0x27')])){ut[_0x862b('0x31')](_0x862b('0x108'),_0x2ade8b);return{'isValid':![],'message':_0x862b('0x109')};}var _0x21d488=this[_0x862b('0x23')][_0x2ade8b[0x0][_0x862b('0x3f')][_0x862b('0x27')]];_0x21d488['message']=utils[_0x862b('0x2d')]['ACTIVE'];if(_[_0x862b('0x57')](_0x21d488)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x21d488);return{'isValid':![],'message':_0x862b('0x10a')};}if(!this[_0x862b('0x72')](_0x21d488[_0x862b('0x71')])){ut['logger'](_0x862b('0x10b'),_0x862b('0x10c')+_0x21d488[_0x862b('0x27')]+_0x862b('0x10d'));if(!this[_0x862b('0x72')](_0x21d488['TrunkBackup'])){ut['logger'](_0x862b('0x10b'),_0x21d488['name']+_0x862b('0x10e'));return{'isValid':![],'message':_0x862b('0x10f')};}}if(!ut[_0x862b('0x70')](_0x21d488[_0x862b('0x3a')])){ut[_0x862b('0x31')](_0x862b('0x110'),_0x21d488[_0x862b('0x27')]+_0x862b('0x111'));return{'isValid':![],'message':_0x862b('0x10c')+_0x21d488['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x862b('0xd')][_0x862b('0xf0')]=function(_0x616184,_0x79a0e0,_0x42ed9e,_0x54da5d){var _0x324d29=this;return new Promise(function(_0x138625,_0x286d99){var _0x5da19b=_0x616184[_0x862b('0x8e')];var _0x54b89d=_0x324d29['isTrunkReachable'](_0x79a0e0[_0x862b('0x71')])?util[_0x862b('0x63')](_0x862b('0x112'),_0x79a0e0[_0x862b('0x71')][_0x862b('0x27')],_[_0x862b('0x57')](_0x79a0e0[_0x862b('0x113')])?'':_0x79a0e0[_0x862b('0x113')][_0x862b('0x114')]()||'',_0x79a0e0[_0x862b('0x115')]>0x0?_0x42ed9e['phone']['substring'](_0x79a0e0['dialCutDigit']):_0x42ed9e[_0x862b('0xee')]):util[_0x862b('0x63')]('SIP/%s/%s%s',_['isNil'](_0x79a0e0[_0x862b('0x73')])?_0x79a0e0[_0x862b('0x71')]['name']:_0x79a0e0[_0x862b('0x73')]['name'],_[_0x862b('0x57')](_0x79a0e0[_0x862b('0x113')])?'':_0x79a0e0['dialPrefix'][_0x862b('0x114')]()||'',_0x79a0e0['dialCutDigit']>0x0?_0x42ed9e[_0x862b('0xee')][_0x862b('0x116')](_0x79a0e0['dialCutDigit']):_0x42ed9e[_0x862b('0xee')]);var _0x498695=_0x324d29['isTrunkReachable'](_0x79a0e0['Trunk'])?ut[_0x862b('0x117')](_0x79a0e0[_0x862b('0x71')]['callerid'],_0x79a0e0[_0x862b('0x118')],_0x79a0e0[_0x862b('0x119')]>0x0?ut['getCallerIdRandom'](_0x79a0e0[_0x862b('0x11a')],_0x79a0e0['dialRandomLastDigitCallerIdNumber']):_0x79a0e0[_0x862b('0x11a')]):ut['getCallerId'](_[_0x862b('0x57')](_0x79a0e0[_0x862b('0x73')])?_0x79a0e0[_0x862b('0x71')][_0x862b('0x11b')]:_0x79a0e0[_0x862b('0x73')][_0x862b('0x11b')],_0x79a0e0[_0x862b('0x118')],_0x79a0e0['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x862b('0x11c')](_0x79a0e0[_0x862b('0x11a')],_0x79a0e0[_0x862b('0x119')]):_0x79a0e0[_0x862b('0x11a')]);if(_0x498695){_0x616184['originatecalleridname']=ut[_0x862b('0x11d')](_0x498695);_0x616184['originatecalleridnum']=ut[_0x862b('0x11e')](_0x498695);}var _0x5e2d14=ut[_0x862b('0x11f')](_0x79a0e0,_0x42ed9e,_0x54b89d,_0x498695,_0x5da19b,_0x616184);var _0x157b89=utils[_0x862b('0x120')](_0x42ed9e[_0x862b('0xed')]);Object[_0x862b('0x121')](_0x5e2d14,_0x157b89);_['merge'](_0x616184,ut[_0x862b('0x122')](_0x5e2d14));_0x616184[_0x862b('0x62')]=moment()[_0x862b('0x63')](_0x862b('0x8b'));_0x79a0e0[_0x862b('0x123')]=_0x5e2d14;var _0x45c77f=ut[_0x862b('0x124')](_0x616184,_0x79a0e0,_0x5e2d14,_0x616184[_0x862b('0x86')],_0x54da5d);return ami['Action'](_0x45c77f)[_0x862b('0x56')](function(_0x3d0a9b){_0x79a0e0[_0x862b('0x2b')]+=0x1;logger[_0x862b('0x25')](_0x862b('0x125'),_0x5da19b,_0x862b('0x8f'),_0x79a0e0[_0x862b('0x27')],'originated:\x20',_0x79a0e0[_0x862b('0x2b')]);_0x138625(_0x3d0a9b);})[_0x862b('0x5f')](function(_0x420263){ut[_0x862b('0xde')](_0x616184,0xe,_0x862b('0x126'));rpcDb['createAgentHistory'](_0x616184,'[originateFailure][logOriginateFailure]');_0x286d99(_0x420263);});});};Preview[_0x862b('0xd')]['syncNewExten']=function(_0x73e37a){if(this['actions'][_0x73e37a[_0x862b('0x87')]]){this[_0x862b('0x12')][_0x73e37a['linkedid']][_0x862b('0x4b')]=_0x73e37a[_0x862b('0x4b')];}};Preview[_0x862b('0xd')]['syncOriginateResponse']=function(_0x41ccfc){var _0x421e38=this;var _0x4ffdf0=this[_0x862b('0x12')][_0x41ccfc['actionid']];if(_0x4ffdf0){if(_0x4ffdf0[_0x862b('0x127')]&&this[_0x862b('0x13')][_0x4ffdf0[_0x862b('0x127')]]){ut[_0x862b('0x128')](_0x4ffdf0,this[_0x862b('0x13')][_0x4ffdf0[_0x862b('0x127')]][_0x862b('0x27')],this[_0x862b('0x13')][_0x4ffdf0[_0x862b('0x127')]]['id']);}var _0x4baaa9=_[_0x862b('0x129')](_0x4ffdf0);_0x4baaa9[_0x862b('0x12a')]=moment()[_0x862b('0x63')](_0x862b('0x8b'));var _0x3c89b0=_0x421e38[_0x862b('0x23')][_0x4ffdf0['queue']];if(ut[_0x862b('0x12b')](_0x41ccfc[_0x862b('0x12c')])){if(_0x4ffdf0[_0x862b('0xad')]){rpcDb[_0x862b('0x101')](_0x4ffdf0[_0x862b('0x89')]);}if(_0x4ffdf0['activeContact']){rpcDb[_0x862b('0x61')](_0x4ffdf0[_0x862b('0x89')]);}ami[_0x862b('0x24')](_0x862b('0x12d'),ut[_0x862b('0x7b')](_0x4ffdf0,_0x862b('0x12e'),this[_0x862b('0x23')][_0x4ffdf0[_0x862b('0x40')]]));this[_0x862b('0xda')](_0x4baaa9,_0x3c89b0,_0x41ccfc);}else{_0x4ffdf0[_0x862b('0x62')]=moment()['format'](_0x862b('0x8b'));ut[_0x862b('0xde')](_0x4baaa9,0x4,_0x862b('0x12f'));rpcDb[_0x862b('0xdf')](_0x4baaa9,_0x862b('0x130'));}}};Preview['prototype'][_0x862b('0x131')]=function(_0x3396e9){var _0x4cd3a9=this[_0x862b('0x12')][_0x3396e9['linkedid']];var _0x537b6f;if(_0x4cd3a9){_0x537b6f=this[_0x862b('0x23')][_0x4cd3a9['queue']];logger[_0x862b('0x25')](_0x862b('0x132'),_0x3396e9[_0x862b('0x87')],_0x862b('0x8f'),_0x537b6f[_0x862b('0x27')],'pTalking:\x20',_0x537b6f[_0x862b('0x43')]);}if(this[_0x862b('0x12')][_0x3396e9[_0x862b('0x87')]]&&_0x3396e9['linkedid']!==_0x3396e9[_0x862b('0x8e')]){if(_0x3396e9[_0x862b('0x133')]==='16'&&this['actions'][_0x3396e9[_0x862b('0x87')]][_0x862b('0x44')]){this['callProgressDetectingCustomer'](_0x3396e9,_0x3396e9['linkedid'],_0x3396e9[_0x862b('0x133')]);}else if(this[_0x862b('0x12')][_0x3396e9[_0x862b('0x87')]][_0x862b('0x44')]){logger['info'](_0x862b('0x134'),_0x3396e9[_0x862b('0x87')],_0x3396e9['cause'],'\x20Queue',_0x537b6f[_0x862b('0x27')],'pTalking:\x20',_0x537b6f[_0x862b('0x43')]);this[_0x862b('0x76')](_0x3396e9,_0x3396e9['linkedid'],_0x3396e9['cause']);}}else if(_0x4cd3a9&&_[_0x862b('0x57')](_0x4cd3a9[_0x862b('0x135')])&&_0x537b6f['dialQueueProject']&&_0x3396e9[_0x862b('0x87')]===_0x3396e9[_0x862b('0x8e')]&&_[_0x862b('0x57')](_0x3396e9[_0x862b('0xdd')])&&_0x3396e9[_0x862b('0x133')]==='16'&&_0x3396e9[_0x862b('0x136')]==='6'&&_[_0x862b('0xdb')](_0x4cd3a9[_0x862b('0x137')])){if(_0x4cd3a9[_0x862b('0xad')]){rpcDb[_0x862b('0x101')](_0x4cd3a9[_0x862b('0x89')]);}if(_0x4cd3a9[_0x862b('0x86')]){rpcDb[_0x862b('0x61')](_0x4cd3a9[_0x862b('0x89')]);}_0x3396e9[_0x862b('0xdd')]='22';this['callProgressDetectingAgent'](_0x4cd3a9,_0x537b6f,_0x3396e9);}else if(_0x4cd3a9&&_0x4cd3a9[_0x862b('0x137')]){if(_0x3396e9[_0x862b('0x133')]==='16'&&this[_0x862b('0x12')][_0x3396e9[_0x862b('0x87')]]['dialAnswer']){logger[_0x862b('0x25')](_0x862b('0x138'),_0x3396e9[_0x862b('0x87')],_0x3396e9[_0x862b('0x133')],_0x862b('0x8f'),_0x537b6f['name'],_0x862b('0x42'),_0x537b6f[_0x862b('0x43')]);this[_0x862b('0x76')](_0x3396e9,_0x3396e9[_0x862b('0x87')],_0x3396e9[_0x862b('0x133')]);}else if(this['actions'][_0x3396e9[_0x862b('0x87')]]['dialAnswer']){logger[_0x862b('0x25')](_0x862b('0x134'),_0x3396e9[_0x862b('0x87')],_0x3396e9[_0x862b('0x133')],_0x862b('0x8f'),_0x537b6f[_0x862b('0x27')],_0x862b('0x42'),_0x537b6f[_0x862b('0x43')]);this['callProgressDetectingCustomer'](_0x3396e9,_0x3396e9[_0x862b('0x87')],_0x3396e9[_0x862b('0x133')]);}}};Preview[_0x862b('0xd')][_0x862b('0x19')]=function(_0x52c997){if(this[_0x862b('0x12')][_0x52c997[_0x862b('0xd9')]]&&_0x52c997[_0x862b('0xd9')]!==_0x52c997['destuniqueid']){this[_0x862b('0x76')](_0x52c997,_0x52c997['destlinkedid'],_0x52c997[_0x862b('0xcf')]);}};Preview['prototype'][_0x862b('0x18')]=function(_0x315aaf){if(this[_0x862b('0x12')][_0x315aaf[_0x862b('0x87')]]&&_0x315aaf[_0x862b('0x87')]!==_0x315aaf[_0x862b('0x8e')]&&!this[_0x862b('0x12')][_0x315aaf[_0x862b('0x87')]]['dialAnswer']){if(_0x315aaf[_0x862b('0x133')]==='1'){this[_0x862b('0x76')](_0x315aaf,_0x315aaf[_0x862b('0x87')],_0x315aaf['cause']);}}};Preview[_0x862b('0xd')][_0x862b('0x139')]=function(_0x52d995,_0x14a492,_0x2a2df8){if(this[_0x862b('0x12')][_0x52d995]){if(_[_0x862b('0x57')](this['actions'][_0x52d995][_0x862b('0x123')])){this[_0x862b('0x12')][_0x52d995][_0x862b('0x123')]={};}this[_0x862b('0x12')][_0x52d995][_0x862b('0x123')][_0x14a492]=_0x2a2df8;}};Preview[_0x862b('0xd')][_0x862b('0x1d')]=function(_0x378f2d){try{if(!_[_0x862b('0x57')](_0x378f2d)){if(ut[_0x862b('0x13a')](_[_0x862b('0x13b')](_0x378f2d['variable'])[0x0])){this[_0x862b('0x139')](_0x378f2d[_0x862b('0x8e')],_[_0x862b('0x13b')](_0x378f2d['variable'])[0x0],_0x378f2d[_0x862b('0x13c')]);}}}catch(_0xdafc70){logger[_0x862b('0x13d')]('[syncVarSet][Preview]',util[_0x862b('0x13e')](_0xdafc70,{'showHidden':![],'depth':null}));}};Preview[_0x862b('0xd')][_0x862b('0x1f')]=function(_0x5aa825){if(_0x5aa825){if(this['actions'][_0x5aa825['transfertargetlinkedid']]){this[_0x862b('0x12')][_0x5aa825[_0x862b('0x13f')]][_0x862b('0x137')]=!![];}}};Preview[_0x862b('0xd')][_0x862b('0x21')]=function(_0x459d7c){if(_0x459d7c){if(this[_0x862b('0x12')][_0x459d7c[_0x862b('0x140')]]){this[_0x862b('0x12')][_0x459d7c['transfererlinkedid']][_0x862b('0x137')]=!![];}}};module[_0x862b('0x141')]=Preview; \ No newline at end of file +var _0x6f8e=['rejected','callProgressDetectingAgent','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','keys','variable','addVariable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','uuid','ioredis','preview','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','pTalking','sendMessageOneNotActive','available','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','syncCampaigns','clockClearZombieChannels','dialMethod','booked','outbound','hasOwnProperty','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','originated:\x20','originated','pick','contactId','UserId','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','info','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','createCustomerFinal','rescheduleContact','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','scheduledAt','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialAgentRejectRetryFrequency','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','isUndefined','object','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlockContact','getContactPreview','recallme','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','response','custom:agentringnoanswer'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x6f8e,0x15a));var _0xe6f8=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x6f8e[_0x4cf98e];return _0x1623ac;};'use strict';var util=require(_0xe6f8('0x0'));var _=require(_0xe6f8('0x1'));var uuid=require(_0xe6f8('0x2'));var moment=require('moment');var Redis=require(_0xe6f8('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xe6f8('0x4'));var loggerAction=require(_0xe6f8('0x5'))(_0xe6f8('0x6'));var ami=require(_0xe6f8('0x7'));var rpcDb=require(_0xe6f8('0x8'));var cmHopperAdditionalPhone=require(_0xe6f8('0x9'));var Action=require(_0xe6f8('0xa'));var ut=require(_0xe6f8('0xb'));var utils=require('../dialer/utils');config[_0xe6f8('0xc')]=_[_0xe6f8('0xd')](config[_0xe6f8('0xc')],{'host':_0xe6f8('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe6f8('0xc')]));var Sequence=function(){};Sequence[_0xe6f8('0xf')][_0xe6f8('0x10')]=function(_0x29e87f){this[_0xe6f8('0x11')]=this[_0xe6f8('0x11')]?this[_0xe6f8('0x11')][_0xe6f8('0x12')](_0x29e87f):_0x29e87f();};function Preview(_0x4473d3){this[_0xe6f8('0x13')]=new Sequence();this[_0xe6f8('0x14')]=_0x4473d3[_0xe6f8('0x15')];this['trunks']=_0x4473d3[_0xe6f8('0x16')];this[_0xe6f8('0x17')]={};this[_0xe6f8('0x18')]=_0x4473d3[_0xe6f8('0x18')];this['clockClearZombieChannels']=0x0;ami['on'](_0xe6f8('0x19'),this[_0xe6f8('0x1a')][_0xe6f8('0x1b')](this));ami['on']('hangup',this[_0xe6f8('0x1c')][_0xe6f8('0x1b')](this));ami['on'](_0xe6f8('0x1d'),this[_0xe6f8('0x1e')][_0xe6f8('0x1b')](this));ami['on'](_0xe6f8('0x1f'),this[_0xe6f8('0x20')][_0xe6f8('0x1b')](this));ami['on'](_0xe6f8('0x21'),this[_0xe6f8('0x22')][_0xe6f8('0x1b')](this));ami['on'](_0xe6f8('0x23'),this[_0xe6f8('0x24')]['bind'](this));ami['on'](_0xe6f8('0x25'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xe6f8('0x26'),this[_0xe6f8('0x27')]['bind'](this));this[_0xe6f8('0x28')](this[_0xe6f8('0x14')]);}function emit(_0x33bd72,_0x2ccaec,_0x341f1e){io['to'](_0x33bd72)[_0xe6f8('0x29')](_0x2ccaec,_0x341f1e);}function emitVoiceQueueChannelRemove(_0x4005f7){logger['info'](_0xe6f8('0x2a'),JSON[_0xe6f8('0x2b')](_0x4005f7));emit(util[_0xe6f8('0x2c')](_0xe6f8('0x2d'),_0x4005f7[_0xe6f8('0x2e')]),_0xe6f8('0x2f'),_0x4005f7);io[_0xe6f8('0x29')](_0xe6f8('0x30'),_0x4005f7);}function notSendMessagesQueue(_0x19bf11){if(_0x19bf11['sendMessageOneNotActive']){if(_0x19bf11['originated']===0x0&&_0x19bf11[_0xe6f8('0x31')]===0x0){_0x19bf11[_0xe6f8('0x32')]=![];_0x19bf11[_0xe6f8('0x33')]=0x0;_0x19bf11['paused']=0x0;_0x19bf11[_0xe6f8('0x34')]=utils[_0xe6f8('0x35')][_0xe6f8('0x36')];ut[_0xe6f8('0x37')](_0xe6f8('0x38'),_0x19bf11[_0xe6f8('0x2e')]+_0xe6f8('0x39'));}else{_0x19bf11[_0xe6f8('0x34')]=utils[_0xe6f8('0x35')][_0xe6f8('0x3a')];ut['logger'](_0xe6f8('0x38'),_0x19bf11[_0xe6f8('0x2e')]+'\x20is\x20deactivated');}}}Preview['prototype']['loopCampaigns']=function(){var _0x489e78=this;setInterval(function(){_0x489e78[_0xe6f8('0x3b')]();},0x7cf);};Preview[_0xe6f8('0xf')]['syncCampaigns']=function(){var _0x45ae3d=this[_0xe6f8('0x14')];this[_0xe6f8('0x3c')]+=0x1;for(var _0x577aa1 in _0x45ae3d){if(_0x45ae3d['hasOwnProperty'](_0x577aa1)&&(_0x45ae3d[_0x577aa1][_0xe6f8('0x3d')]===_0xe6f8('0x4')||_0x45ae3d[_0x577aa1]['dialMethod']===_0xe6f8('0x3e'))&&_0x45ae3d[_0x577aa1]['type']===_0xe6f8('0x3f')){if(this[_0xe6f8('0x3c')]>0x7){this[_0xe6f8('0x3c')]=0x0;this['clearZombieChannels']();}}if(_0x45ae3d[_0xe6f8('0x40')](_0x577aa1)&&_0x45ae3d[_0x577aa1]['dialMethod']===_0xe6f8('0x4')&&_0x45ae3d[_0x577aa1]['type']==='outbound'){if(_0x45ae3d[_0x577aa1][_0xe6f8('0x41')]){this[_0xe6f8('0x42')](_0x45ae3d[_0x577aa1]);if(_0x45ae3d[_0x577aa1][_0xe6f8('0x43')])this[_0xe6f8('0x44')](_0x45ae3d[_0x577aa1]);}else{notSendMessagesQueue(_0x45ae3d[_0x577aa1]);}}}};Preview[_0xe6f8('0xf')][_0xe6f8('0x45')]=function(_0x4b2c17){var _0x477c80=this;this[_0xe6f8('0x13')]['enqueue'](function(){if(!_['isNil'](_0x477c80[_0xe6f8('0x17')][_0x4b2c17])){loggerAction['info'](_0xe6f8('0x46'),_0x4b2c17,_0xe6f8('0x47'),_0x477c80[_0xe6f8('0x17')][_0x4b2c17][_0xe6f8('0x48')],_0xe6f8('0x49'),JSON['stringify'](_0x477c80[_0xe6f8('0x14')][_0x477c80['actions'][_0x4b2c17][_0xe6f8('0x48')]][_0xe6f8('0x4a')]),'pTalking:\x20',JSON['stringify'](_0x477c80[_0xe6f8('0x14')][_0x477c80[_0xe6f8('0x17')][_0x4b2c17][_0xe6f8('0x48')]][_0xe6f8('0x31')]),JSON[_0xe6f8('0x2b')](_0x477c80[_0xe6f8('0x17')][_0x4b2c17]['dialAnswer']),JSON[_0xe6f8('0x2b')](_[_0xe6f8('0x4b')](_0x477c80[_0xe6f8('0x17')][_0x4b2c17],[_0xe6f8('0x4c'),_0xe6f8('0x4d'),_0xe6f8('0x4e'),'ListId'])));return ami[_0xe6f8('0x4f')]({'action':_0xe6f8('0x50'),'channel':_0x477c80[_0xe6f8('0x17')][_0x4b2c17][_0xe6f8('0x51')]})[_0xe6f8('0x52')](function(_0x3cde0c){if(_0x3cde0c[_0xe6f8('0x34')]===_0xe6f8('0x53')){setTimeout(function(){if(_0x477c80[_0xe6f8('0x17')][_0x4b2c17]){ut[_0xe6f8('0x54')](_0x477c80[_0xe6f8('0x14')][_0x477c80['actions'][_0x4b2c17][_0xe6f8('0x48')]],_0xe6f8('0x55'));if(_0x477c80[_0xe6f8('0x17')][_0x4b2c17][_0xe6f8('0x56')]===!![]){ut[_0xe6f8('0x57')](_0x477c80[_0xe6f8('0x14')][_0x477c80[_0xe6f8('0x17')][_0x4b2c17][_0xe6f8('0x48')]],_0xe6f8('0x55'));ut['loggerError'](_0xe6f8('0x58')+_0x4b2c17,_0x477c80[_0xe6f8('0x17')][_0x4b2c17][_0xe6f8('0x48')]);}ut[_0xe6f8('0x59')](_0xe6f8('0x5a')+_0x4b2c17,_0x477c80[_0xe6f8('0x17')][_0x4b2c17][_0xe6f8('0x48')]);delete _0x477c80[_0xe6f8('0x17')][_0x4b2c17];}},0x2328);}});}});};Preview[_0xe6f8('0xf')][_0xe6f8('0x5b')]=function(){var _0x2f38a1=this;loggerAction[_0xe6f8('0x5c')]('[action]',_['size'](this[_0xe6f8('0x17')]));for(var _0x2cd2a1 in this[_0xe6f8('0x17')]){if(_0x2f38a1['actions'][_0xe6f8('0x40')](_0x2cd2a1)){_0x2f38a1[_0xe6f8('0x45')](_0x2cd2a1);}}};Preview[_0xe6f8('0xf')][_0xe6f8('0x44')]=function(_0x3814fe){var _0x52ebd6=this;rpcDb[_0xe6f8('0x5d')](_0x3814fe['id'],ut[_0xe6f8('0x5e')](this[_0xe6f8('0x18')]))[_0xe6f8('0x5f')](function(_0x46d5a7){if(!_[_0xe6f8('0x60')](_0x46d5a7)){for(var _0x3bcc09=0x0;_0x3bcc09<_0x46d5a7[_0xe6f8('0x61')];_0x3bcc09+=0x1){if(ut[_0xe6f8('0x62')](_0x46d5a7[_0x3bcc09][_0xe6f8('0x63')])<_0x3814fe['dialRecallMeTimeout']*0x3c){if(_0x46d5a7[_0x3bcc09]['Agent']&&!_0x46d5a7[_0x3bcc09][_0xe6f8('0x64')][_0xe6f8('0x65')]){_0x52ebd6[_0xe6f8('0x66')](_0x46d5a7[_0x3bcc09]['id'])[_0xe6f8('0x5f')](ut[_0xe6f8('0x67')](_0xe6f8('0x68')))['catch'](ut[_0xe6f8('0x67')](_0xe6f8('0x68')));}else{rpcDb[_0xe6f8('0x69')](_0x46d5a7[_0x3bcc09]['id']);}}else{var _0x492634=new Action(_0x46d5a7[_0x3bcc09],_0x3814fe);_0x492634[_0xe6f8('0x6a')]=moment()[_0xe6f8('0x2c')](_0xe6f8('0x6b'));_0x3814fe[_0xe6f8('0x6c')]+=0x1;ut[_0xe6f8('0x6d')](_0x492634,0x17,'RecallInQueue');if(_0x3814fe[_0xe6f8('0x6e')]){rpcDb[_0xe6f8('0x6f')](ut['createBody'](_0x46d5a7[_0x3bcc09]));rpcDb['createCustomerHistory'](_0x492634,_0xe6f8('0x70'));}else{ut['logCustomer'](_0x492634,0x16,_0xe6f8('0x71'));rpcDb[_0xe6f8('0x72')](_0x492634,_0xe6f8('0x73'));rpcDb['createCustomerFinal'](_0x492634,'[HistoryRecallClose]');}}}}})['catch'](ut[_0xe6f8('0x67')](_0xe6f8('0x74')));};Preview['prototype'][_0xe6f8('0x42')]=function(_0x5b0f3a){_0x5b0f3a['sendMessageOneNotActive']=!![];if(ut[_0xe6f8('0x75')](_0x5b0f3a[_0xe6f8('0x76')])){_0x5b0f3a[_0xe6f8('0x34')]=utils[_0xe6f8('0x35')][_0xe6f8('0x77')];}else if(!ut[_0xe6f8('0x78')](_0x5b0f3a['dialActive'])){_0x5b0f3a[_0xe6f8('0x34')]=utils['CAMPAIGN_STATUS'][_0xe6f8('0x36')];}else if(!this[_0xe6f8('0x79')](_0x5b0f3a[_0xe6f8('0x7a')])){if(!this[_0xe6f8('0x79')](_0x5b0f3a['TrunkBackup'])){_0x5b0f3a['message']=utils['CAMPAIGN_STATUS'][_0xe6f8('0x7b')];}else{_0x5b0f3a[_0xe6f8('0x34')]=utils[_0xe6f8('0x35')][_0xe6f8('0x7c')];}}else{_0x5b0f3a[_0xe6f8('0x34')]=utils[_0xe6f8('0x35')]['ACTIVE'];}};Preview['prototype'][_0xe6f8('0x7d')]=function(_0xcc37de,_0xa4e50e,_0x5b8399){var _0x197848=this;var _0x523906=this[_0xe6f8('0x17')][_0xa4e50e];var _0x1f2fd0=this['campaignsPreview'][_0x523906['queue']];var _0x35771e;var _0x4d98f2=![];var _0x5c557e=0x2;var _0x483900=0x3;if(_0x1f2fd0){switch(_0x5b8399){case'1':_0x1f2fd0['outboundNoSuchCallsDay']+=0x1;_0x523906[_0xe6f8('0x7e')]+=0x1;_0x523906[_0xe6f8('0x7f')]=ut[_0xe6f8('0x80')](_0x523906);ut['logCustomer'](_0x523906,0x0,'NoSuchNumber');ami['emit'](_0xe6f8('0x81'),ut['buildObj'](_0x523906,_0xe6f8('0x82')));rpcDb[_0xe6f8('0x72')](_0x523906,_0xe6f8('0x83'));_0x197848[_0xe6f8('0x84')](_0x523906,'0',_0x1f2fd0)[_0xe6f8('0x5f')](function(_0x487e05){_0x4d98f2=_0x487e05[_0xe6f8('0x85')]==0x1;_0x5c557e=_0x1f2fd0[_0xe6f8('0x86')];_0x483900=_0x1f2fd0[_0xe6f8('0x87')];if(!_0x4d98f2){if(ut[_0xe6f8('0x80')](_0x523906)>=_0x1f2fd0[_0xe6f8('0x88')]){_0x35771e=ut[_0xe6f8('0x89')](_0x523906,0xf,_0xe6f8('0x8a'));rpcDb['createCustomerFinal'](_0x35771e,_0xe6f8('0x8b'));}else{if(_0x523906[_0xe6f8('0x7e')]>=_0x1f2fd0[_0xe6f8('0x8c')]){rpcDb[_0xe6f8('0x8d')](_0x523906,_0xe6f8('0x8b'));}else{rpcDb[_0xe6f8('0x8e')](ut['scheduledAt'](_0x523906,_0xe6f8('0x7e'),_0x1f2fd0['dialNoSuchNumberRetryFrequency']),_0x523906['unlockAgent'],_0x523906[_0xe6f8('0x8f')]);}}delete this['actions'][_0xcc37de[_0xe6f8('0x90')]];}else{_0x523906[_0xe6f8('0x7e')]++;logger[_0xe6f8('0x5c')](_0xe6f8('0x91'),_0x523906[_0xe6f8('0x7e')]);logger['info']('id',_0x523906['idContact']);_0x197848[_0xe6f8('0x92')]({'id':_0x523906[_0xe6f8('0x93')],'field':{'countnosuchnumberretry':_0x523906[_0xe6f8('0x7e')]}})[_0xe6f8('0x5f')](function(){_0x197848[_0xe6f8('0x94')](_0x523906,_0x5c557e,_0x483900)[_0xe6f8('0x5f')](function(){});});}});break;case _0xe6f8('0x95'):var _0x16da96=moment()['format'](_0xe6f8('0x6b'));_0x523906[_0xe6f8('0x96')]=_0x16da96;_0x523906[_0xe6f8('0x97')]=_0x16da96;_0x523906['dialAnswer']=!![];_0x1f2fd0[_0xe6f8('0x31')]+=0x1;logger[_0xe6f8('0x5c')](_0xe6f8('0x98'),_0x523906[_0xe6f8('0x99')],_0xe6f8('0x9a'),_0x1f2fd0['name'],_0xe6f8('0x9b'),_0x1f2fd0[_0xe6f8('0x31')]);ami[_0xe6f8('0x29')](_0xe6f8('0x9c'),ut[_0xe6f8('0x9d')](_0x523906,_0xe6f8('0x9e'),this[_0xe6f8('0x14')][_0x523906[_0xe6f8('0x48')]]));if(_0x1f2fd0[_0xe6f8('0x9f')]){ami['emit'](_0xe6f8('0xa0'),ut[_0xe6f8('0xa1')](_0x523906));}break;case'16':ami[_0xe6f8('0x29')](_0xe6f8('0xa2'),ut['buildObj'](_0x523906,_0xe6f8('0xa3'),this[_0xe6f8('0x14')][_0x523906[_0xe6f8('0x48')]]));emitVoiceQueueChannelRemove(ut[_0xe6f8('0x9d')](_0x523906,_0xe6f8('0xa3')));_0x1f2fd0[_0xe6f8('0xa4')]+=0x1;_0x1f2fd0[_0xe6f8('0xa5')]+=0x1;_0x1f2fd0[_0xe6f8('0xa6')]+=0x1;ut['decrementTalkink'](_0x1f2fd0,_0xe6f8('0xa7'));_0x523906[_0xe6f8('0x7f')]=ut[_0xe6f8('0x80')](_0x523906);ut[_0xe6f8('0x6d')](_0x523906,0x4,'Answer');rpcDb['createCustomerHistory'](_0x523906,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0x523906,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x523906);_0x1f2fd0[_0xe6f8('0xa8')]+=_0x523906[_0xe6f8('0xa9')];_0x1f2fd0[_0xe6f8('0xaa')]+=_0x523906['talktime'];logger[_0xe6f8('0x5c')](_0xe6f8('0xab'),_0x523906[_0xe6f8('0x99')],'\x20Queue',_0x1f2fd0[_0xe6f8('0x2e')],_0xe6f8('0x9b'),_0x1f2fd0['pTalking']);delete this['actions'][_0xcc37de[_0xe6f8('0x90')]];break;case'BUSY':_0x1f2fd0['outboundBusyCallsDay']+=0x1;_0x523906[_0xe6f8('0xac')]+=0x1;_0x523906[_0xe6f8('0x7f')]=ut[_0xe6f8('0x80')](_0x523906);ut[_0xe6f8('0x6d')](_0x523906,0x5,_0xe6f8('0xad'));_0x5c557e=_0x1f2fd0[_0xe6f8('0xae')];_0x483900=_0x1f2fd0[_0xe6f8('0x87')];ami[_0xe6f8('0x29')](_0xe6f8('0xaf'),ut[_0xe6f8('0x9d')](_0x523906,_0xe6f8('0xb0')));rpcDb['createCustomerHistory'](_0x523906,'[callProgressDetectingCustomer][logBusy]');_0x197848['verifyAdditionalPhones'](_0x523906,'5',_0x1f2fd0)[_0xe6f8('0x5f')](function(_0x1f5a38){_0x4d98f2=_0x1f5a38[_0xe6f8('0x85')]==0x1;if(!_0x4d98f2){if(ut[_0xe6f8('0x80')](_0x523906)>=_0x1f2fd0[_0xe6f8('0x88')]){_0x35771e=ut[_0xe6f8('0x89')](_0x523906,0xf,_0xe6f8('0x8a'));rpcDb[_0xe6f8('0x8d')](_0x35771e,_0xe6f8('0xb1'));}else{if(_0x523906[_0xe6f8('0xac')]>=_0x1f2fd0[_0xe6f8('0xb2')]){rpcDb[_0xe6f8('0x8d')](_0x523906,_0xe6f8('0xb3'));}else{rpcDb[_0xe6f8('0x8e')](ut[_0xe6f8('0xb4')](_0x523906,_0xe6f8('0xac'),_0x1f2fd0[_0xe6f8('0xae')]),_0x523906[_0xe6f8('0xb5')],_0x523906[_0xe6f8('0x8f')]);}}}else{_0x523906[_0xe6f8('0xac')]++;_0x197848[_0xe6f8('0x92')]({'id':_0x523906[_0xe6f8('0x93')],'field':{'countbusyretry':_0x523906[_0xe6f8('0xac')]}})[_0xe6f8('0x5f')](function(){_0x197848[_0xe6f8('0x94')](_0x523906,_0x5c557e,_0x483900)[_0xe6f8('0x5f')](function(){});});}});break;case _0xe6f8('0xb6'):_0x1f2fd0[_0xe6f8('0xb7')]+=0x1;_0x523906[_0xe6f8('0xb8')]+=0x1;_0x523906['countglobal']=ut[_0xe6f8('0x80')](_0x523906);ut[_0xe6f8('0x6d')](_0x523906,0x3,_0xe6f8('0xb9'));_0x5c557e=_0x1f2fd0['dialNoAnswerRetryFrequency'];_0x483900=_0x1f2fd0[_0xe6f8('0x87')];var _0x3cec20=ut[_0xe6f8('0xba')](_0x523906,_0x1f2fd0);ami[_0xe6f8('0x29')](_0xe6f8('0xbb'),_0x3cec20);rpcDb[_0xe6f8('0x72')](_0x523906,_0xe6f8('0xbc'));_0x197848[_0xe6f8('0x84')](_0x523906,'3',_0x1f2fd0)[_0xe6f8('0x5f')](function(_0x38dea9){_0x4d98f2=_0x38dea9['additional']==0x1;if(!_0x4d98f2){if(ut[_0xe6f8('0x80')](_0x523906)>=_0x1f2fd0['dialGlobalMaxRetry']){_0x35771e=ut[_0xe6f8('0x89')](_0x523906,0xf,'Global');rpcDb[_0xe6f8('0x8d')](_0x35771e,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x523906[_0xe6f8('0xb8')]>=_0x1f2fd0['dialNoAnswerMaxRetry']){rpcDb[_0xe6f8('0x8d')](_0x523906,_0xe6f8('0xbc'));}else{rpcDb[_0xe6f8('0x8e')](ut[_0xe6f8('0xb4')](_0x523906,'countnoanswerretry',_0x1f2fd0[_0xe6f8('0xbd')]),_0x523906[_0xe6f8('0xb5')],_0x523906['activeContact']);}}}else{_0x523906[_0xe6f8('0xb8')]++;_0x197848[_0xe6f8('0x92')]({'id':_0x523906['idContact'],'field':{'countnoanswerretry':_0x523906[_0xe6f8('0xb8')]}})[_0xe6f8('0x5f')](function(){_0x197848[_0xe6f8('0x94')](_0x523906,_0x5c557e,_0x483900)[_0xe6f8('0x5f')](function(){});});}});break;case _0xe6f8('0xbe'):_0x1f2fd0['outboundCongestionCallsDay']+=0x1;_0x523906[_0xe6f8('0xbf')]+=0x1;_0x523906[_0xe6f8('0x7f')]=ut[_0xe6f8('0x80')](_0x523906);ut['logCustomer'](_0x523906,0x8,_0xe6f8('0xc0'));_0x5c557e=_0x1f2fd0[_0xe6f8('0xc1')];_0x483900=_0x1f2fd0[_0xe6f8('0x87')];ami['emit'](_0xe6f8('0xc2'),ut[_0xe6f8('0x9d')](_0x523906,_0xe6f8('0xc3')));rpcDb['createCustomerHistory'](_0x523906,_0xe6f8('0xc4'));_0x197848['verifyAdditionalPhones'](_0x523906,'8',_0x1f2fd0)[_0xe6f8('0x5f')](function(_0x567016){_0x4d98f2=_0x567016['additional']==0x1;if(!_0x4d98f2){if(ut[_0xe6f8('0x80')](_0x523906)>=_0x1f2fd0['dialGlobalMaxRetry']){_0x35771e=ut[_0xe6f8('0x89')](_0x523906,0xf,_0xe6f8('0x8a'));rpcDb[_0xe6f8('0x8d')](_0x35771e,_0xe6f8('0xc5'));}else{if(_0x523906['countcongestionretry']>=_0x1f2fd0[_0xe6f8('0xc6')]){rpcDb[_0xe6f8('0x8d')](_0x523906,_0xe6f8('0xc4'));}else{rpcDb[_0xe6f8('0x8e')](ut[_0xe6f8('0xb4')](_0x523906,_0xe6f8('0xbf'),_0x1f2fd0[_0xe6f8('0xae')]),_0x523906[_0xe6f8('0xb5')],_0x523906[_0xe6f8('0x8f')]);}}}else{_0x523906[_0xe6f8('0xbf')]++;_0x197848[_0xe6f8('0x92')]({'id':_0x523906[_0xe6f8('0x93')],'field':{'countcongestionretry':_0x523906[_0xe6f8('0xbf')]}})[_0xe6f8('0x5f')](function(){_0x197848[_0xe6f8('0x94')](_0x523906,_0x5c557e,_0x483900)[_0xe6f8('0x5f')](function(){});});}});break;case _0xe6f8('0xc7'):_0x1f2fd0[_0xe6f8('0xc8')]+=0x1;_0x523906[_0xe6f8('0xc9')]+=0x1;_0x523906[_0xe6f8('0x7f')]=ut[_0xe6f8('0x80')](_0x523906);ut[_0xe6f8('0x6d')](_0x523906,0x14,_0xe6f8('0xca'));_0x5c557e=_0x1f2fd0['dialAgentRejectRetryFrequency'];_0x483900=_0x1f2fd0['callAdditionalPhoneAfterMin'];ami[_0xe6f8('0x29')](_0xe6f8('0xcb'),ut[_0xe6f8('0x9d')](_0x523906,_0xe6f8('0xcc')));rpcDb[_0xe6f8('0x72')](_0x523906,'[syncHangupRequest][logAgentReject]');_0x197848[_0xe6f8('0x84')](_0x523906,'20',_0x1f2fd0)[_0xe6f8('0x5f')](function(_0x4a7466){_0x4d98f2=_0x4a7466[_0xe6f8('0x85')]==0x1;if(!_0x4d98f2){if(ut[_0xe6f8('0x80')](_0x523906)>=_0x1f2fd0[_0xe6f8('0x88')]){_0x35771e=ut[_0xe6f8('0x89')](_0x523906,0x14,_0xe6f8('0xca'));rpcDb[_0xe6f8('0x8d')](_0x35771e,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x523906[_0xe6f8('0xc9')]>=_0x1f2fd0[_0xe6f8('0xcd')]){rpcDb[_0xe6f8('0x8d')](_0x523906,_0xe6f8('0xce'));}else{rpcDb[_0xe6f8('0x8e')](ut[_0xe6f8('0xb4')](_0x523906,_0xe6f8('0xc9'),_0x1f2fd0['dialAgentRejectRetryFrequency']),_0x523906[_0xe6f8('0xb5')],_0x523906['activeContact']);}}}else{_0x523906[_0xe6f8('0xb8')]++;_0x197848[_0xe6f8('0x92')]({'id':_0x523906['idContact'],'field':{'countnoanswerretry':_0x523906[_0xe6f8('0xb8')]}})[_0xe6f8('0x5f')](function(){_0x197848[_0xe6f8('0x94')](_0x523906,_0x5c557e,_0x483900)[_0xe6f8('0x5f')](function(){});});}});break;case _0xe6f8('0xcf'):_0x1f2fd0[_0xe6f8('0xd0')]+=0x1;_0x523906[_0xe6f8('0xd1')]+=0x1;_0x523906['countglobal']=ut[_0xe6f8('0x80')](_0x523906);ut[_0xe6f8('0x6d')](_0x523906,0xb,'Abandoned');rpcDb[_0xe6f8('0x72')](_0x523906,_0xe6f8('0xd2'));_0x197848['verifyAdditionalPhones'](_0x523906,'11',_0x1f2fd0)['then'](function(_0x32f4f2){_0x4d98f2=_0x32f4f2[_0xe6f8('0x85')]==0x1;if(!_0x4d98f2){if(ut['totalGlobal'](_0x523906)>=_0x1f2fd0['dialGlobalMaxRetry']){_0x35771e=ut['cloneAction'](_0x523906,0xf,_0xe6f8('0x8a'));rpcDb['createCustomerFinal'](_0x35771e,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x523906['countabandonedetry']>=_0x1f2fd0[_0xe6f8('0xd3')]){rpcDb[_0xe6f8('0x8d')](_0x523906,_0xe6f8('0xd2'));}else{rpcDb[_0xe6f8('0x8e')](ut[_0xe6f8('0xb4')](_0x523906,_0xe6f8('0xd1'),_0x1f2fd0['dialAbandonedRetryFrequency']),_0x523906['unlockAgent'],_0x523906[_0xe6f8('0x8f')]);}}}else{_0x523906[_0xe6f8('0xb8')]++;_0x197848['incrementPreviewCounters']({'id':_0x523906['idContact'],'field':{'countnoanswerretry':_0x523906['countnoanswerretry']}})[_0xe6f8('0x5f')](function(){_0x197848[_0xe6f8('0x94')](_0x523906,_0x5c557e,_0x483900)[_0xe6f8('0x5f')](function(){});});}});break;case'18':_0x1f2fd0[_0xe6f8('0xd4')]+=0x1;_0x523906[_0xe6f8('0xd5')]+=0x1;_0x523906[_0xe6f8('0x7f')]=ut[_0xe6f8('0x80')](_0x523906);ut[_0xe6f8('0x6d')](_0x523906,0x12,_0xcc37de[_0xe6f8('0xd6')]||_0xcc37de['dialstatus']);ami[_0xe6f8('0x29')](_0xe6f8('0xd7'),ut['buildObj'](_0x523906,_0xe6f8('0xd8')));rpcDb[_0xe6f8('0x72')](_0x523906,_0xe6f8('0xd9'));_0x197848[_0xe6f8('0x84')](_0x523906,'18',_0x1f2fd0)[_0xe6f8('0x5f')](function(_0x4f69ce){_0x4d98f2=_0x4f69ce['additional']==0x1;if(!_0x4d98f2){if(ut[_0xe6f8('0x80')](_0x523906)>=_0x1f2fd0[_0xe6f8('0x88')]){_0x35771e=ut[_0xe6f8('0x89')](_0x523906,0x12,_0xe6f8('0x8a'));rpcDb['createCustomerFinal'](_0x35771e,_0xe6f8('0xd9'));}else{rpcDb[_0xe6f8('0x8d')](_0x523906,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x523906[_0xe6f8('0xb8')]++;_0x197848[_0xe6f8('0x92')]({'id':_0x523906[_0xe6f8('0x93')],'field':{'countnoanswerretry':_0x523906[_0xe6f8('0xb8')]}})['then'](function(){_0x197848[_0xe6f8('0x94')](_0x523906,_0x5c557e,_0x483900)[_0xe6f8('0x5f')](function(){});});}});delete this[_0xe6f8('0x17')][_0xcc37de[_0xe6f8('0x90')]];break;case'19':_0x1f2fd0[_0xe6f8('0xd4')]+=0x1;_0x523906[_0xe6f8('0x7f')]=ut[_0xe6f8('0x80')](_0x523906);ut['logCustomer'](_0x523906,0x13,_0xcc37de['cause-txt']||_0xcc37de[_0xe6f8('0xda')]);ami[_0xe6f8('0x29')](_0xe6f8('0xd7'),ut[_0xe6f8('0x9d')](_0x523906,'amd'));rpcDb['createCustomerHistory'](_0x523906,_0xe6f8('0xdb'));_0x197848[_0xe6f8('0x84')](_0x523906,'18',_0x1f2fd0)[_0xe6f8('0x5f')](function(_0x1233cd){_0x4d98f2=_0x1233cd[_0xe6f8('0x85')]==0x1;if(!_0x4d98f2){if(ut[_0xe6f8('0x80')](_0x523906)>=_0x1f2fd0[_0xe6f8('0x88')]){_0x35771e=ut[_0xe6f8('0x89')](_0x523906,0xf,_0xe6f8('0x8a'));rpcDb[_0xe6f8('0x8d')](_0x35771e,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xe6f8('0x8d')](_0x523906,_0xe6f8('0xdb'));}}else{_0x523906[_0xe6f8('0xb8')]++;_0x197848[_0xe6f8('0x92')]({'id':_0x523906[_0xe6f8('0x93')],'field':{'countnoanswerretry':_0x523906[_0xe6f8('0xb8')]}})[_0xe6f8('0x5f')](function(){_0x197848[_0xe6f8('0x94')](_0x523906,_0x5c557e,_0x483900)[_0xe6f8('0x5f')](function(){});});}});delete this['actions'][_0xcc37de[_0xe6f8('0x90')]];break;default:if(_0x523906[_0xe6f8('0x56')]){ut[_0xe6f8('0x57')](_0x1f2fd0,'[default]');ut[_0xe6f8('0x59')](_0xe6f8('0xdc')+_0x1f2fd0['name'],_0xcc37de);}_0x1f2fd0[_0xe6f8('0xd4')]+=0x1;_0x523906[_0xe6f8('0x7f')]=ut[_0xe6f8('0x80')](_0x523906);ut[_0xe6f8('0x6d')](_0x523906,0xc,_0xcc37de[_0xe6f8('0xd6')]||_0xcc37de['dialstatus']);_0x5c557e=_0x1f2fd0[_0xe6f8('0xdd')];_0x483900=_0x1f2fd0['callAdditionalPhoneAfterMin'];rpcDb[_0xe6f8('0x72')](_0x523906,'[callProgressDetectingCustomer][logUnknown]');_0x197848[_0xe6f8('0x84')](_0x523906,'20',_0x1f2fd0)[_0xe6f8('0x5f')](function(_0x52de63){_0x4d98f2=_0x52de63[_0xe6f8('0x85')]==0x1;if(!_0x4d98f2){if(ut['totalGlobal'](_0x523906)>=_0x1f2fd0[_0xe6f8('0x88')]){_0x35771e=ut['cloneAction'](_0x523906,0xf,'Global');rpcDb[_0xe6f8('0x8d')](_0x35771e,_0xe6f8('0xde'));}else{rpcDb[_0xe6f8('0x8d')](_0x523906,_0xe6f8('0xde'));}delete this[_0xe6f8('0x17')][_0xcc37de[_0xe6f8('0x90')]];}else{_0x197848['swapAdditionalPhones'](_0x523906,_0x5c557e,_0x483900)[_0xe6f8('0x5f')](function(){});}});}if(!(_0x523906[_0xe6f8('0x56')]&&_0x5b8399==='16')){ut[_0xe6f8('0x54')](_0x1f2fd0,_0xe6f8('0xdf'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x523906[_0xe6f8('0x99')],_0xe6f8('0x9a'),_0x1f2fd0['name'],_0xe6f8('0x49'),_0x1f2fd0['originated']);}if(_0x5b8399!=='ANSWER'){delete this['actions'][_0xcc37de['linkedid']];delete this[_0xe6f8('0x17')][_0xcc37de[_0xe6f8('0xe0')]];}_0x1f2fd0[_0xe6f8('0xe1')]=!![];}};Preview[_0xe6f8('0xf')]['callProgressDetectingAgent']=function(_0x57051d,_0xadf906,_0x398918){if(_[_0xe6f8('0xe2')](_0xadf906)&&_0xe6f8('0xe3')!==typeof _0xadf906){return;}if(_['isUndefined'](_0x398918)&&_0xe6f8('0xe3')!==typeof _0x398918){return;}switch(_0x398918['reason']){case'0':ut['logAgent'](_0x57051d,0x0,_0xe6f8('0xe4'));rpcDb[_0xe6f8('0xe5')](_0x57051d,_0xe6f8('0xe6'));break;case'3':ut[_0xe6f8('0xe7')](_0x57051d,0x3,_0xe6f8('0xb9'));rpcDb[_0xe6f8('0xe5')](_0x57051d,_0xe6f8('0xe8'));break;case'5':ut[_0xe6f8('0xe7')](_0x57051d,0x5,_0xe6f8('0xad'));rpcDb['createAgentHistory'](_0x57051d,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xe6f8('0xe7')](_0x57051d,0x8,_0xe6f8('0xc0'));rpcDb[_0xe6f8('0xe5')](_0x57051d,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xe6f8('0xe7')](_0x57051d,0x16,'AnswerAGI');rpcDb[_0xe6f8('0xe5')](_0x57051d,_0xe6f8('0xe9'));break;default:ut[_0xe6f8('0xe7')](_0x57051d,0xc,_0x398918[_0xe6f8('0xea')]);rpcDb['createAgentHistory'](_0x57051d,_0xe6f8('0xeb'));}ut[_0xe6f8('0x54')](_0xadf906,_0xe6f8('0xec'));logger[_0xe6f8('0x5c')](_0xe6f8('0xed'),_0x57051d[_0xe6f8('0x99')],'\x20Queue',_0xadf906[_0xe6f8('0x2e')],_0xe6f8('0x49'),_0xadf906[_0xe6f8('0x4a')]);delete this['actions'][_0x57051d[_0xe6f8('0x99')]];};Preview['prototype'][_0xe6f8('0x84')]=function(_0x2e7199,_0x40f688,_0x26014e){return cmHopperAdditionalPhone[_0xe6f8('0x84')](_0x2e7199,_0x40f688,_0x26014e)[_0xe6f8('0x52')](logger[_0xe6f8('0x5c')](_0xe6f8('0xee')));};Preview[_0xe6f8('0xf')]['swapAdditionalPhones']=function(_0x3b7dec,_0x12c854,_0x5dff6c){return cmHopperAdditionalPhone[_0xe6f8('0x94')](_0x3b7dec,_0x12c854,_0x5dff6c)[_0xe6f8('0x52')](logger['info'](_0xe6f8('0xef')));};Preview[_0xe6f8('0xf')]['incrementPreviewCounters']=function(_0x2d8710){return Promise[_0xe6f8('0xf0')]()['then'](cmHopperAdditionalPhone[_0xe6f8('0x92')](_0x2d8710))[_0xe6f8('0x52')](logger[_0xe6f8('0x5c')](_0xe6f8('0xf1')));};Preview[_0xe6f8('0xf')][_0xe6f8('0xf2')]=function(_0x152a3d,_0x3cc0f2,_0x560392,_0x193e96,_0x18576a){var _0x31f30a=this;return new Promise(function(_0x3e4c77,_0xbc7e25){if(_[_0xe6f8('0x60')](_0x3cc0f2)||_['isNil'](_0x3cc0f2[_0xe6f8('0xf3')])||_[_0xe6f8('0x60')](_0x3cc0f2[_0xe6f8('0xf4')])||_[_0xe6f8('0x60')](_0x3cc0f2[_0xe6f8('0x4e')])){_0xbc7e25(ut['message'](_0xe6f8('0xf5'),_0x193e96,_0x18576a));return;}var _0x170830=uuid['v4']();var _0x498bbf=_0x31f30a[_0xe6f8('0x14')][_0x3cc0f2[_0xe6f8('0x47')]['name']];var _0x9c7e1b=_0x560392?_0x31f30a[_0xe6f8('0x18')][_0x560392]['id']:undefined;_0x31f30a[_0xe6f8('0x17')][_0x170830]=new Action(_0x3cc0f2,_0x498bbf,_0x170830,_0x560392,_0x9c7e1b);var _0xcfebba=_0x31f30a[_0xe6f8('0x17')][_0x170830];_0xcfebba[_0xe6f8('0xb5')]=_0x193e96;_0xcfebba['activeContact']=_0x18576a;_0xcfebba[_0xe6f8('0xf6')]=_0x560392;if(_[_0xe6f8('0xf7')](_0x152a3d)){_0x31f30a[_0xe6f8('0xf8')](_0xcfebba,_0x498bbf,_0x3cc0f2,_0x560392)[_0xe6f8('0x5f')](function(_0x5bd09b){logger[_0xe6f8('0x5c')](_0xe6f8('0xf9'),'Queue:\x20'+_0xcfebba[_0xe6f8('0x48')]+'\x20IdHopper:\x20'+_0xcfebba[_0xe6f8('0x93')],JSON[_0xe6f8('0x2b')](_0x5bd09b));ami[_0xe6f8('0x29')](_0xe6f8('0xfa'),ut[_0xe6f8('0x9d')](_0xcfebba,_0xe6f8('0xfb'),_0x31f30a['campaignsPreview'][_0xcfebba[_0xe6f8('0x48')]]));_0x3e4c77(ut[_0xe6f8('0x34')](_0xe6f8('0xfc')));})['catch'](function(_0x52a5d3){ut[_0xe6f8('0x37')](_0xe6f8('0xfd'),_0x52a5d3);_0xbc7e25(ut[_0xe6f8('0x34')]('Call\x20failed',_0x193e96,_0x18576a));});}else{_0x498bbf[_0xe6f8('0xfe')]+=0x1;ut[_0xe6f8('0xff')](_0xcfebba);rpcDb[_0xe6f8('0x100')](_0xcfebba,_0xe6f8('0x101'));delete _0x31f30a[_0xe6f8('0x17')][_0x170830];_0xbc7e25(ut[_0xe6f8('0x34')](_0xe6f8('0x102'),_0x193e96,_0x18576a));}});};Preview[_0xe6f8('0xf')][_0xe6f8('0x79')]=function(_0x51d0d2){return!_[_0xe6f8('0x60')](_0x51d0d2)&&!_[_0xe6f8('0x60')](_0x51d0d2[_0xe6f8('0x2e')])&&!_[_0xe6f8('0x60')](_0x51d0d2[_0xe6f8('0x103')])&&_0x51d0d2['active']&&!_['isNil'](this['trunks'][util['format']('SIP/%s',_0x51d0d2[_0xe6f8('0x2e')])])&&!_[_0xe6f8('0x60')](this['trunks'][util[_0xe6f8('0x2c')](_0xe6f8('0x104'),_0x51d0d2[_0xe6f8('0x2e')])][_0xe6f8('0x50')])&&(this[_0xe6f8('0x16')][util[_0xe6f8('0x2c')](_0xe6f8('0x104'),_0x51d0d2[_0xe6f8('0x2e')])][_0xe6f8('0x50')]===_0xe6f8('0x105')||this[_0xe6f8('0x16')][util[_0xe6f8('0x2c')]('SIP/%s',_0x51d0d2[_0xe6f8('0x2e')])][_0xe6f8('0x50')]===_0xe6f8('0x106'));};Preview['prototype'][_0xe6f8('0x66')]=function(_0x428e04,_0x17d101){return this[_0xe6f8('0x107')](_0x428e04,_0x17d101)[_0xe6f8('0x5f')](function(_0x180c78){return _[_0xe6f8('0x4b')](_0x180c78,[_0xe6f8('0x34')]);})[_0xe6f8('0x52')](function(_0x5e8cb7){if(_0x5e8cb7['unlock']){rpcDb[_0xe6f8('0x108')](_0x428e04);}if(_0x5e8cb7[_0xe6f8('0x103')]){rpcDb[_0xe6f8('0x69')](_0x428e04);}throw _[_0xe6f8('0x4b')](_0x5e8cb7,[_0xe6f8('0x34')]);});};Preview[_0xe6f8('0xf')]['execRun']=function(_0x32d618,_0x166ac0){var _0x3847be=this;var _0x54eb12,_0x227941;return rpcDb[_0xe6f8('0x109')](_0x32d618)[_0xe6f8('0x5f')](function(_0x25ed91){if(!_['isNil'](_0x25ed91[0x0])){_0x227941=_0x25ed91[0x0][_0xe6f8('0x10a')]?![]:!![];_0x54eb12=_0x25ed91[0x0][_0xe6f8('0x10a')]?!![]:![];_0x54eb12=_0x166ac0?!![]:_0x54eb12;}var _0xcdbb6a=_0x3847be['validateContact'](_0x25ed91);if(_0xcdbb6a[_0xe6f8('0x10b')]){rpcDb['checkIsBlackList'](_['pick'](_0x25ed91[0x0],['VoiceQueueId',_0xe6f8('0xf4')]))[_0xe6f8('0x5f')](function(_0x7a4bab){_0x3847be[_0xe6f8('0xf2')](_0x7a4bab,_0x25ed91[0x0],_0x166ac0,_0x227941,_0x54eb12)[_0xe6f8('0x5f')](function(_0x34a67e){return _0x34a67e;})[_0xe6f8('0x52')](function(_0x4c675e){throw _0x4c675e;});})[_0xe6f8('0x52')](function(_0x229b92){ut[_0xe6f8('0x37')](_0xe6f8('0x10c'),_0x229b92);throw ut[_0xe6f8('0x34')]('Call\x20unsuccessful',_0x227941,_0x54eb12);});}else{throw ut['message'](_0xcdbb6a[_0xe6f8('0x34')],_0x227941,_0x54eb12);}})[_0xe6f8('0x52')](function(_0x1d0e51){ut[_0xe6f8('0x37')]('[Preview][getContactPreview]',_0x1d0e51);throw ut[_0xe6f8('0x34')](_0xe6f8('0x10d'),![],!![]);});};Preview['prototype'][_0xe6f8('0x10e')]=function(_0x1fb8e3){if(_[_0xe6f8('0x60')](_0x1fb8e3)||_[_0xe6f8('0xf7')](_0x1fb8e3)||!_[_0xe6f8('0x60')](_0x1fb8e3[0x0][_0xe6f8('0x64')])&&_['isNil'](_0x1fb8e3[0x0][_0xe6f8('0x64')][_0xe6f8('0x2e')])){ut[_0xe6f8('0x37')](_0xe6f8('0x10f'),_0x1fb8e3);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x4cc0b1=this[_0xe6f8('0x14')][_0x1fb8e3[0x0][_0xe6f8('0x47')][_0xe6f8('0x2e')]];_0x4cc0b1['message']=utils[_0xe6f8('0x35')][_0xe6f8('0x7c')];if(_[_0xe6f8('0x60')](_0x4cc0b1)){ut[_0xe6f8('0x37')]('[Preview][validateContact][Empty\x20Campaign]',_0x4cc0b1);return{'isValid':![],'message':_0xe6f8('0x110')};}if(!this[_0xe6f8('0x79')](_0x4cc0b1[_0xe6f8('0x7a')])){ut[_0xe6f8('0x37')](_0xe6f8('0x111'),'campaign\x20Name:\x20'+_0x4cc0b1[_0xe6f8('0x2e')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xe6f8('0x79')](_0x4cc0b1[_0xe6f8('0x112')])){ut[_0xe6f8('0x37')](_0xe6f8('0x111'),_0x4cc0b1['name']+_0xe6f8('0x113'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0xe6f8('0x78')](_0x4cc0b1[_0xe6f8('0x41')])){ut[_0xe6f8('0x37')](_0xe6f8('0x114'),_0x4cc0b1[_0xe6f8('0x2e')]+_0xe6f8('0x115'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4cc0b1[_0xe6f8('0x2e')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xe6f8('0x116')};};Preview[_0xe6f8('0xf')][_0xe6f8('0xf8')]=function(_0x2203de,_0x22027f,_0xb10108,_0x46c9ee){var _0x5124c2=this;return new Promise(function(_0x21ccdf,_0x44b751){var _0x230ead=_0x2203de[_0xe6f8('0x99')];var _0x326221=_0x5124c2[_0xe6f8('0x79')](_0x22027f[_0xe6f8('0x7a')])?util['format']('SIP/%s/%s%s',_0x22027f[_0xe6f8('0x7a')][_0xe6f8('0x2e')],_[_0xe6f8('0x60')](_0x22027f['dialPrefix'])?'':_0x22027f[_0xe6f8('0x117')][_0xe6f8('0x118')]()||'',_0x22027f[_0xe6f8('0x119')]>0x0?_0xb10108[_0xe6f8('0xf4')][_0xe6f8('0x11a')](_0x22027f[_0xe6f8('0x119')]):_0xb10108[_0xe6f8('0xf4')]):util[_0xe6f8('0x2c')]('SIP/%s/%s%s',_['isNil'](_0x22027f['TrunkBackup'])?_0x22027f['Trunk'][_0xe6f8('0x2e')]:_0x22027f[_0xe6f8('0x112')][_0xe6f8('0x2e')],_['isNil'](_0x22027f[_0xe6f8('0x117')])?'':_0x22027f[_0xe6f8('0x117')][_0xe6f8('0x118')]()||'',_0x22027f[_0xe6f8('0x119')]>0x0?_0xb10108[_0xe6f8('0xf4')]['substring'](_0x22027f['dialCutDigit']):_0xb10108[_0xe6f8('0xf4')]);var _0x256fbc=_0x5124c2['isTrunkReachable'](_0x22027f[_0xe6f8('0x7a')])?ut[_0xe6f8('0x11b')](_0x22027f['Trunk'][_0xe6f8('0x11c')],_0x22027f[_0xe6f8('0x11d')],_0x22027f['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xe6f8('0x11e')](_0x22027f['dialOriginateCallerIdNumber'],_0x22027f[_0xe6f8('0x11f')]):_0x22027f[_0xe6f8('0x120')]):ut['getCallerId'](_[_0xe6f8('0x60')](_0x22027f[_0xe6f8('0x112')])?_0x22027f[_0xe6f8('0x7a')]['callerid']:_0x22027f['TrunkBackup'][_0xe6f8('0x11c')],_0x22027f[_0xe6f8('0x11d')],_0x22027f[_0xe6f8('0x11f')]>0x0?ut['getCallerIdRandom'](_0x22027f[_0xe6f8('0x120')],_0x22027f[_0xe6f8('0x11f')]):_0x22027f[_0xe6f8('0x120')]);if(_0x256fbc){_0x2203de['originatecalleridname']=ut[_0xe6f8('0x121')](_0x256fbc);_0x2203de['originatecalleridnum']=ut[_0xe6f8('0x122')](_0x256fbc);}var _0x4aafc6=ut[_0xe6f8('0x123')](_0x22027f,_0xb10108,_0x326221,_0x256fbc,_0x230ead,_0x2203de);var _0x3a3cc0=utils[_0xe6f8('0x124')](_0xb10108[_0xe6f8('0xf3')]);Object[_0xe6f8('0x125')](_0x4aafc6,_0x3a3cc0);_[_0xe6f8('0x126')](_0x2203de,ut[_0xe6f8('0x127')](_0x4aafc6));_0x2203de['starttime']=moment()[_0xe6f8('0x2c')](_0xe6f8('0x6b'));_0x22027f[_0xe6f8('0x128')]=_0x4aafc6;var _0x2577f0=ut[_0xe6f8('0x129')](_0x2203de,_0x22027f,_0x4aafc6,_0x2203de[_0xe6f8('0x8f')],_0x46c9ee);return ami['Action'](_0x2577f0)[_0xe6f8('0x5f')](function(_0xc232be){_0x22027f['originated']+=0x1;logger[_0xe6f8('0x5c')](_0xe6f8('0x12a'),_0x230ead,_0xe6f8('0x9a'),_0x22027f[_0xe6f8('0x2e')],_0xe6f8('0x49'),_0x22027f[_0xe6f8('0x4a')]);_0x21ccdf(_0xc232be);})['catch'](function(_0x14795f){ut[_0xe6f8('0xe7')](_0x2203de,0xe,_0xe6f8('0x12b'));rpcDb[_0xe6f8('0xe5')](_0x2203de,_0xe6f8('0x12c'));_0x44b751(_0x14795f);});});};Preview[_0xe6f8('0xf')]['syncNewExten']=function(_0x280d20){if(this[_0xe6f8('0x17')][_0x280d20['linkedid']]){this['actions'][_0x280d20[_0xe6f8('0x90')]][_0xe6f8('0x51')]=_0x280d20['channel'];}};Preview['prototype'][_0xe6f8('0x1a')]=function(_0x3b82f1){var _0x57ee28=this;var _0x494a3c=this[_0xe6f8('0x17')][_0x3b82f1[_0xe6f8('0x12d')]];if(_0x494a3c){if(_0x494a3c[_0xe6f8('0xf6')]&&this['agents'][_0x494a3c[_0xe6f8('0xf6')]]){ut[_0xe6f8('0x12e')](_0x494a3c,this[_0xe6f8('0x18')][_0x494a3c[_0xe6f8('0xf6')]][_0xe6f8('0x2e')],this['agents'][_0x494a3c[_0xe6f8('0xf6')]]['id']);}var _0x4dae4d=_[_0xe6f8('0x12f')](_0x494a3c);_0x4dae4d[_0xe6f8('0x96')]=moment()['format'](_0xe6f8('0x6b'));var _0x3d8719=_0x57ee28[_0xe6f8('0x14')][_0x494a3c['queue']];if(ut['isFailure'](_0x3b82f1[_0xe6f8('0x130')])){if(_0x494a3c[_0xe6f8('0xb5')]){rpcDb['unlockContact'](_0x494a3c[_0xe6f8('0x93')]);}if(_0x494a3c[_0xe6f8('0x8f')]){rpcDb[_0xe6f8('0x69')](_0x494a3c[_0xe6f8('0x93')]);}ami['emit'](_0xe6f8('0x131'),ut[_0xe6f8('0x9d')](_0x494a3c,_0xe6f8('0x132'),this[_0xe6f8('0x14')][_0x494a3c[_0xe6f8('0x48')]]));this[_0xe6f8('0x133')](_0x4dae4d,_0x3d8719,_0x3b82f1);}else{_0x494a3c[_0xe6f8('0x6a')]=moment()[_0xe6f8('0x2c')](_0xe6f8('0x6b'));ut[_0xe6f8('0xe7')](_0x4dae4d,0x4,_0xe6f8('0x134'));rpcDb[_0xe6f8('0xe5')](_0x4dae4d,_0xe6f8('0x135'));}}};Preview['prototype'][_0xe6f8('0x1c')]=function(_0x3dea3d){var _0x556081=this[_0xe6f8('0x17')][_0x3dea3d[_0xe6f8('0x90')]];var _0x252a97;if(_0x556081){_0x252a97=this[_0xe6f8('0x14')][_0x556081['queue']];logger[_0xe6f8('0x5c')](_0xe6f8('0x136'),_0x3dea3d[_0xe6f8('0x90')],'\x20Queue',_0x252a97['name'],_0xe6f8('0x9b'),_0x252a97['pTalking']);}if(this[_0xe6f8('0x17')][_0x3dea3d[_0xe6f8('0x90')]]&&_0x3dea3d['linkedid']!==_0x3dea3d[_0xe6f8('0x99')]){if(_0x3dea3d[_0xe6f8('0x137')]==='16'&&this['actions'][_0x3dea3d[_0xe6f8('0x90')]][_0xe6f8('0x56')]){this['callProgressDetectingCustomer'](_0x3dea3d,_0x3dea3d[_0xe6f8('0x90')],_0x3dea3d[_0xe6f8('0x137')]);}else if(this[_0xe6f8('0x17')][_0x3dea3d[_0xe6f8('0x90')]][_0xe6f8('0x56')]){logger[_0xe6f8('0x5c')](_0xe6f8('0x138'),_0x3dea3d[_0xe6f8('0x90')],_0x3dea3d['cause'],_0xe6f8('0x9a'),_0x252a97[_0xe6f8('0x2e')],_0xe6f8('0x9b'),_0x252a97['pTalking']);this[_0xe6f8('0x7d')](_0x3dea3d,_0x3dea3d[_0xe6f8('0x90')],_0x3dea3d['cause']);}}else if(_0x556081&&_[_0xe6f8('0x60')](_0x556081[_0xe6f8('0x139')])&&_0x252a97[_0xe6f8('0x13a')]&&_0x3dea3d[_0xe6f8('0x90')]===_0x3dea3d[_0xe6f8('0x99')]&&_[_0xe6f8('0x60')](_0x3dea3d[_0xe6f8('0xea')])&&_0x3dea3d['cause']==='16'&&_0x3dea3d['channelstate']==='6'&&_['isUndefined'](_0x556081[_0xe6f8('0x13b')])){if(_0x556081['unlockAgent']){rpcDb[_0xe6f8('0x108')](_0x556081[_0xe6f8('0x93')]);}if(_0x556081[_0xe6f8('0x8f')]){rpcDb[_0xe6f8('0x69')](_0x556081[_0xe6f8('0x93')]);}_0x3dea3d['reason']='22';this[_0xe6f8('0x133')](_0x556081,_0x252a97,_0x3dea3d);}else if(_0x556081&&_0x556081[_0xe6f8('0x13b')]){if(_0x3dea3d[_0xe6f8('0x137')]==='16'&&this[_0xe6f8('0x17')][_0x3dea3d[_0xe6f8('0x90')]][_0xe6f8('0x56')]){logger[_0xe6f8('0x5c')](_0xe6f8('0x13c'),_0x3dea3d[_0xe6f8('0x90')],_0x3dea3d[_0xe6f8('0x137')],_0xe6f8('0x9a'),_0x252a97['name'],_0xe6f8('0x9b'),_0x252a97[_0xe6f8('0x31')]);this[_0xe6f8('0x7d')](_0x3dea3d,_0x3dea3d[_0xe6f8('0x90')],_0x3dea3d[_0xe6f8('0x137')]);}else if(this[_0xe6f8('0x17')][_0x3dea3d[_0xe6f8('0x90')]]['dialAnswer']){logger[_0xe6f8('0x5c')]('[syncHangup][talking][cause]',_0x3dea3d['linkedid'],_0x3dea3d[_0xe6f8('0x137')],'\x20Queue',_0x252a97[_0xe6f8('0x2e')],'pTalking:\x20',_0x252a97['pTalking']);this[_0xe6f8('0x7d')](_0x3dea3d,_0x3dea3d[_0xe6f8('0x90')],_0x3dea3d[_0xe6f8('0x137')]);}}};Preview[_0xe6f8('0xf')][_0xe6f8('0x20')]=function(_0xb9b301){if(this[_0xe6f8('0x17')][_0xb9b301[_0xe6f8('0xe0')]]&&_0xb9b301['destlinkedid']!==_0xb9b301[_0xe6f8('0x13d')]){this[_0xe6f8('0x7d')](_0xb9b301,_0xb9b301[_0xe6f8('0xe0')],_0xb9b301['dialstatus']);}};Preview[_0xe6f8('0xf')]['syncHangupRequest']=function(_0x12ff86){if(this[_0xe6f8('0x17')][_0x12ff86[_0xe6f8('0x90')]]&&_0x12ff86[_0xe6f8('0x90')]!==_0x12ff86[_0xe6f8('0x99')]&&!this[_0xe6f8('0x17')][_0x12ff86['linkedid']][_0xe6f8('0x56')]){if(_0x12ff86[_0xe6f8('0x137')]==='1'){this[_0xe6f8('0x7d')](_0x12ff86,_0x12ff86[_0xe6f8('0x90')],_0x12ff86[_0xe6f8('0x137')]);}}};Preview[_0xe6f8('0xf')]['addVariable']=function(_0x21ecb9,_0x4f4bc7,_0x1d4608){if(this[_0xe6f8('0x17')][_0x21ecb9]){if(_[_0xe6f8('0x60')](this[_0xe6f8('0x17')][_0x21ecb9]['variables'])){this[_0xe6f8('0x17')][_0x21ecb9][_0xe6f8('0x128')]={};}this[_0xe6f8('0x17')][_0x21ecb9]['variables'][_0x4f4bc7]=_0x1d4608;}};Preview[_0xe6f8('0xf')]['syncVarSet']=function(_0xb2fba){try{if(!_[_0xe6f8('0x60')](_0xb2fba)){if(ut['filterKey'](_[_0xe6f8('0x13e')](_0xb2fba[_0xe6f8('0x13f')])[0x0])){this[_0xe6f8('0x140')](_0xb2fba[_0xe6f8('0x99')],_['keys'](_0xb2fba[_0xe6f8('0x13f')])[0x0],_0xb2fba[_0xe6f8('0x141')]);}}}catch(_0x5f2809){logger['error'](_0xe6f8('0x142'),util[_0xe6f8('0x143')](_0x5f2809,{'showHidden':![],'depth':null}));}};Preview[_0xe6f8('0xf')]['syncAttendedTransfer']=function(_0x54c1ff){if(_0x54c1ff){if(this[_0xe6f8('0x17')][_0x54c1ff[_0xe6f8('0x144')]]){this[_0xe6f8('0x17')][_0x54c1ff['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0xe6f8('0xf')][_0xe6f8('0x27')]=function(_0x262c2e){if(_0x262c2e){if(this[_0xe6f8('0x17')][_0x262c2e['transfererlinkedid']]){this[_0xe6f8('0x17')][_0x262c2e[_0xe6f8('0x145')]][_0xe6f8('0x13b')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 3bc4b9f..71268a4 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 _0xe04f=['[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active'];(function(_0x3a08a8,_0x481207){var _0x4e679d=function(_0x8282d5){while(--_0x8282d5){_0x3a08a8['push'](_0x3a08a8['shift']());}};_0x4e679d(++_0x481207);}(_0xe04f,0xc3));var _0xfe04=function(_0x5ece84,_0xc06c9f){_0x5ece84=_0x5ece84-0x0;var _0x2a12c4=_0xe04f[_0x5ece84];return _0x2a12c4;};'use strict';var util=require(_0xfe04('0x0'));var BPromise=require(_0xfe04('0x1'));var logger=require(_0xfe04('0x2'))('preview');var cmHopper=require(_0xfe04('0x3'));var cmHopperHistory=require(_0xfe04('0x4'));var cmHopperBlack=require(_0xfe04('0x5'));var agentReportPreview=require(_0xfe04('0x6'));var voiceQueueReport=require(_0xfe04('0x7'));function loggerCatch(_0x4fa68a){return function(_0x83a633){logger[_0xfe04('0x8')](_0x4fa68a,util[_0xfe04('0x9')](_0x83a633,{'showHidden':![],'depth':null}));};}function create(_0xa534fb){return cmHopperHistory[_0xfe04('0xa')](_0xa534fb)[_0xfe04('0xb')](loggerCatch(_0xfe04('0xc')));}function createAgent(_0x4e6917){return BPromise[_0xfe04('0xd')]()[_0xfe04('0xe')](agentReportPreview[_0xfe04('0xa')](_0x4e6917))['catch'](loggerCatch(_0xfe04('0xc')));}function moveContact(_0x2e8eb4){return cmHopper[_0xfe04('0xf')](_0x2e8eb4,!![])['catch'](loggerCatch(_0xfe04('0x10')));}exports[_0xfe04('0x11')]=function(_0x2e8a39){return cmHopperBlack[_0xfe04('0x11')](_0x2e8a39)[_0xfe04('0xb')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xfe04('0x12')]=function(_0x5412f6){return BPromise[_0xfe04('0xd')]()[_0xfe04('0xe')](cmHopper[_0xfe04('0x12')](_0x5412f6))[_0xfe04('0xb')](loggerCatch(_0xfe04('0x13')));};exports[_0xfe04('0xa')]=function(_0x11ba42,_0x168456){create(_0x11ba42)[_0xfe04('0xb')](loggerCatch(_0x168456));moveContact(_0x11ba42)[_0xfe04('0xb')](loggerCatch(_0x168456));};exports['createAgentHistory']=function(_0x2cd725,_0x1d10f9){createAgent(_0x2cd725)[_0xfe04('0xb')](loggerCatch(_0x1d10f9));};exports[_0xfe04('0x14')]=function(_0x57b239,_0x2601fa){create(_0x57b239)['catch'](loggerCatch(_0x2601fa));};exports[_0xfe04('0x15')]=function(_0x106f16,_0xfc81cd){moveContact(_0x106f16)['catch'](loggerCatch(_0xfc81cd));};exports[_0xfe04('0x16')]=function(_0x6bb728,_0x49c0b0,_0x161935){if(_0x49c0b0){_0x6bb728[_0xfe04('0x17')]=null;}if(_0x161935){_0x6bb728[_0xfe04('0x18')]=![];}return cmHopper['rescheduleContact'](_0x6bb728)['catch'](loggerCatch(_0xfe04('0x19')));};exports[_0xfe04('0x1a')]=function(_0x3e15b1){return cmHopper['countReScheduled'](_0x3e15b1)[_0xfe04('0xb')](loggerCatch('[countReScheduled]\x20'));};exports[_0xfe04('0x1b')]=function(_0x5ed497){return cmHopper['unlockContact']({'UserId':null},_0x5ed497,0x1)[_0xfe04('0xb')](loggerCatch(_0xfe04('0x1c')));};exports['disableContact']=function(_0x308762){return cmHopper[_0xfe04('0x1b')]({'active':![]},_0x308762,0x1)[_0xfe04('0xb')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x166d92){var _0x5214f5={};_0x5214f5[_0xfe04('0x1d')]=_0x166d92[_0xfe04('0x1d')];_0x5214f5[_0xfe04('0x1e')]=_0x166d92[_0xfe04('0x1e')];_0x5214f5[_0xfe04('0x1f')]=_0x166d92[_0xfe04('0x1f')];_0x5214f5[_0xfe04('0x20')]=_0x166d92[_0xfe04('0x20')];_0x5214f5[_0xfe04('0x21')]=_0x166d92[_0xfe04('0x21')];_0x5214f5[_0xfe04('0x22')]=_0x166d92[_0xfe04('0x23')];_0x5214f5[_0xfe04('0x24')]=_0x166d92[_0xfe04('0x23')];_0x5214f5[_0xfe04('0x25')]=0x1;_0x5214f5['queuecallercompleteAt']=_0x166d92['endtime'];_0x5214f5[_0xfe04('0x26')]=_0x166d92[_0xfe04('0x27')];_0x5214f5[_0xfe04('0x28')]=_0xfe04('0x29');_0x5214f5[_0xfe04('0x2a')]=_0xfe04('0x2b');_0x5214f5[_0xfe04('0x2c')]=0x0;_0x5214f5[_0xfe04('0x2d')]=0x1;_0x5214f5[_0xfe04('0x2e')]=_0x166d92[_0xfe04('0x27')];_0x5214f5[_0xfe04('0x2f')]=_0xfe04('0x30');return BPromise['resolve']()[_0xfe04('0xe')](voiceQueueReport[_0xfe04('0x31')](_0x5214f5))[_0xfe04('0xb')](loggerCatch(_0xfe04('0x32')));};exports[_0xfe04('0x33')]=function(_0x324f6d,_0x45b0d9){return BPromise[_0xfe04('0xd')]()[_0xfe04('0xe')](cmHopper[_0xfe04('0x33')](_0x324f6d,_0x45b0d9))[_0xfe04('0xb')](loggerCatch(_0xfe04('0x34')));};exports[_0xfe04('0x35')]=function(_0x56c5b8){return cmHopper['rescheduleContact'](_0x56c5b8,!![],!![])[_0xfe04('0xb')](loggerCatch(_0xfe04('0x36')));}; \ No newline at end of file +var _0x2a87=['queuecallerjoinAt','answertime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','[createHistory]\x20','resolve','then','createHistory','catch','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue'];(function(_0x390b37,_0x23ed18){var _0x265e6e=function(_0x2a06b9){while(--_0x2a06b9){_0x390b37['push'](_0x390b37['shift']());}};_0x265e6e(++_0x23ed18);}(_0x2a87,0x197));var _0x72a8=function(_0x295811,_0x2825f4){_0x295811=_0x295811-0x0;var _0x147146=_0x2a87[_0x295811];return _0x147146;};'use strict';var util=require(_0x72a8('0x0'));var BPromise=require(_0x72a8('0x1'));var logger=require(_0x72a8('0x2'))(_0x72a8('0x3'));var cmHopper=require(_0x72a8('0x4'));var cmHopperHistory=require(_0x72a8('0x5'));var cmHopperBlack=require(_0x72a8('0x6'));var agentReportPreview=require(_0x72a8('0x7'));var voiceQueueReport=require(_0x72a8('0x8'));function loggerCatch(_0x339c5a){return function(_0x2e84f5){logger['error'](_0x339c5a,util[_0x72a8('0x9')](_0x2e84f5,{'showHidden':![],'depth':null}));};}function create(_0x39570d){return cmHopperHistory['createHistory'](_0x39570d)['catch'](loggerCatch(_0x72a8('0xa')));}function createAgent(_0xb0f743){return BPromise[_0x72a8('0xb')]()[_0x72a8('0xc')](agentReportPreview[_0x72a8('0xd')](_0xb0f743))[_0x72a8('0xe')](loggerCatch(_0x72a8('0xa')));}function moveContact(_0x551a98){return cmHopper['moveContactManagedDialer'](_0x551a98,!![])[_0x72a8('0xe')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x72a8('0xf')]=function(_0x1462e6){return cmHopperBlack[_0x72a8('0xf')](_0x1462e6)['catch'](loggerCatch(_0x72a8('0x10')));};exports[_0x72a8('0x11')]=function(_0x3d6c63){return BPromise[_0x72a8('0xb')]()['then'](cmHopper[_0x72a8('0x11')](_0x3d6c63))[_0x72a8('0xe')](loggerCatch(_0x72a8('0x12')));};exports[_0x72a8('0xd')]=function(_0xc37842,_0x2a1a66){create(_0xc37842)[_0x72a8('0xe')](loggerCatch(_0x2a1a66));moveContact(_0xc37842)['catch'](loggerCatch(_0x2a1a66));};exports[_0x72a8('0x13')]=function(_0x44ad8a,_0x59ca25){createAgent(_0x44ad8a)[_0x72a8('0xe')](loggerCatch(_0x59ca25));};exports['createCustomerHistory']=function(_0x3b5ad8,_0x112cc5){create(_0x3b5ad8)['catch'](loggerCatch(_0x112cc5));};exports[_0x72a8('0x14')]=function(_0x2937fc,_0x10b0b9){moveContact(_0x2937fc)[_0x72a8('0xe')](loggerCatch(_0x10b0b9));};exports[_0x72a8('0x15')]=function(_0xa077ce,_0x1b4545,_0x47f255){if(_0x1b4545){_0xa077ce[_0x72a8('0x16')]=null;}if(_0x47f255){_0xa077ce[_0x72a8('0x17')]=![];}return cmHopper[_0x72a8('0x15')](_0xa077ce)[_0x72a8('0xe')](loggerCatch(_0x72a8('0x18')));};exports[_0x72a8('0x19')]=function(_0xf7e369){return cmHopper[_0x72a8('0x19')](_0xf7e369)['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x72a8('0x1a')]=function(_0x5e8090){return cmHopper['unlockContact']({'UserId':null},_0x5e8090,0x1)[_0x72a8('0xe')](loggerCatch('[unlockContact]\x20'));};exports[_0x72a8('0x1b')]=function(_0x21a235){return cmHopper['unlockContact']({'active':![]},_0x21a235,0x1)['catch'](loggerCatch(_0x72a8('0x1c')));};exports[_0x72a8('0x1d')]=function(_0x4af59f){var _0x34b953={};_0x34b953['type']=_0x4af59f['type'];_0x34b953[_0x72a8('0x1e')]=_0x4af59f[_0x72a8('0x1e')];_0x34b953[_0x72a8('0x1f')]=_0x4af59f[_0x72a8('0x1f')];_0x34b953[_0x72a8('0x20')]=_0x4af59f[_0x72a8('0x20')];_0x34b953[_0x72a8('0x21')]=_0x4af59f['queue'];_0x34b953[_0x72a8('0x22')]=_0x4af59f[_0x72a8('0x23')];_0x34b953['queuecallerleaveAt']=_0x4af59f[_0x72a8('0x23')];_0x34b953['queuecallercomplete']=0x1;_0x34b953['queuecallercompleteAt']=_0x4af59f['endtime'];_0x34b953[_0x72a8('0x24')]=_0x4af59f[_0x72a8('0x25')];_0x34b953[_0x72a8('0x26')]=_0x72a8('0x27');_0x34b953[_0x72a8('0x28')]='xcally-motion-preview';_0x34b953[_0x72a8('0x29')]=0x0;_0x34b953[_0x72a8('0x2a')]=0x1;_0x34b953[_0x72a8('0x2b')]=_0x4af59f[_0x72a8('0x25')];_0x34b953[_0x72a8('0x2c')]=_0x72a8('0x2d');return BPromise[_0x72a8('0xb')]()[_0x72a8('0xc')](voiceQueueReport['create'](_0x34b953))[_0x72a8('0xe')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x72a8('0x2e')]=function(_0x3e170b,_0x34dba1){return BPromise[_0x72a8('0xb')]()['then'](cmHopper[_0x72a8('0x2e')](_0x3e170b,_0x34dba1))[_0x72a8('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x72a8('0x2f')]=function(_0x3702f7){return cmHopper[_0x72a8('0x15')](_0x3702f7,!![],!![])[_0x72a8('0xe')](loggerCatch(_0x72a8('0x30')));}; \ 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 f9a3b61..e44be92 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 _0xaf33=['xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosrttbridged','bridgepvtcallid','\x5cw{0,','pow','extractCalleridName','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','inspect','logger','info','loggerError','error','message','getCallerId','string','isEmpty','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','Queue','name','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','statedesc','Blacklist','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','state','ringtime','getSeconds','logLookAgent','logCustomer','talktime','answertime','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','add','minutes','ListId','decrementTalkink','isNil','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','seconds','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','countcongestionretry','countglobal','callback','callbackat','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xaf33,0xaa));var _0x3af3=function(_0x1fc63b,_0x46916b){_0x1fc63b=_0x1fc63b-0x0;var _0x281345=_0xaf33[_0x1fc63b];return _0x281345;};'use strict';var util=require(_0x3af3('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x3af3('0x1'))(_0x3af3('0x2'));var ipAgi=process[_0x3af3('0x3')][_0x3af3('0x4')]||_0x3af3('0x5');var utils=require(_0x3af3('0x6'));exports[_0x3af3('0x7')]=function(_0x49bc66){return function(_0x5bfc48){logger['error'](_0x49bc66,util[_0x3af3('0x8')](_0x5bfc48,{'showHidden':![],'depth':null}));};};exports[_0x3af3('0x9')]=function(_0x555352,_0x5ed359){logger[_0x3af3('0xa')](_0x555352,util[_0x3af3('0x8')](_0x5ed359,{'showHidden':![],'depth':null}));};exports[_0x3af3('0xb')]=function(_0x965c4d,_0x570129){logger[_0x3af3('0xc')](_0x965c4d,util[_0x3af3('0x8')](_0x570129,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x430eac){return function(_0x4b8a88){logger[_0x3af3('0xa')](_0x430eac,util[_0x3af3('0x8')](_0x4b8a88,{'showHidden':![],'depth':null}));};};exports[_0x3af3('0xd')]=function(_0x46f2ec,_0x17e0cb,_0x38e8d0){return{'message':_0x46f2ec,'unlock':_0x17e0cb,'active':_0x38e8d0};};exports[_0x3af3('0xe')]=function(_0x89a85b,_0x52b306,_0x2fad08){if(!_['isUndefined'](_0x2fad08)&&_0x3af3('0xf')===typeof _0x2fad08&&!_[_0x3af3('0x10')](_0x2fad08)){if(!_['isUndefined'](_0x52b306)&&_0x3af3('0xf')===typeof _0x52b306&&!_[_0x3af3('0x10')](_0x52b306)){return util['format']('\x22%s\x22\x20<%s>',_0x52b306,_0x2fad08);}return util[_0x3af3('0x11')](_0x3af3('0x12'),_0x2fad08,_0x2fad08);}if(!_[_0x3af3('0x13')](_0x89a85b)&&_0x3af3('0xf')===typeof _0x89a85b&&!_[_0x3af3('0x10')](_0x89a85b)){return _0x89a85b;}return _0x3af3('0x14');};exports['isActive']=function(_0x11170b){if(_['isNil'](_0x11170b)){return![];}return _0x11170b;};exports['addVariables']=function(_0x564cc6,_0x2c9a7d,_0x146b78,_0x4c1514,_0x11b776,_0x5eaac3){var _0x6b2a70={'XMD-QUEUE':_0x2c9a7d['Queue']?_0x2c9a7d[_0x3af3('0x15')][_0x3af3('0x16')]:'','XMD-CALLERID':_0x4c1514,'XMD-CALLERID-PREVIEW':_0x5eaac3?util[_0x3af3('0x11')](_0x3af3('0x12'),_0x5eaac3['calleridname'],_0x5eaac3['calleridnum']):_0x4c1514,'XMD-DIALID':_0x11b776,'XMD-CONTACTID':_0x2c9a7d[_0x3af3('0x17')],'XMD-CDRTYPE':_0x3af3('0x18'),'CALLERID(all)':_0x4c1514,'XMD-VOICEQUEUEID':_0x2c9a7d[_0x3af3('0x19')],'XMD-DIALCHANNEL':_0x146b78,'XMD-DIALTIMEOUT':_0x564cc6[_0x3af3('0x1a')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x3af3('0x1b'),_0x564cc6[_0x3af3('0x1c')]?'g':'',_[_0x3af3('0x10')](_0x564cc6[_0x3af3('0x1d')])?'':_0x3af3('0x1e')),'XMD-DIALURL':_0x564cc6[_0x3af3('0x1f')]||'','XMD-AGI':_0x564cc6[_0x3af3('0x20')]?util[_0x3af3('0x11')](_0x3af3('0x21'),ipAgi,_0x564cc6[_0x3af3('0x20')]):_0x3af3('0x22'),'XMD-AGIAFTER':_0x564cc6[_0x3af3('0x1c')]?util['format'](_0x3af3('0x21'),ipAgi,_0x564cc6[_0x3af3('0x1c')]):_0x3af3('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x5eaac3?_0x5eaac3[_0x3af3('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x5eaac3?_0x5eaac3[_0x3af3('0x24')]:'','XMD-DESTINATION':_0x3af3('0x25'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x3af3('0x10')](_0x564cc6['monitor_format'])){_0x6b2a70[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x564cc6[_0x3af3('0x1d')];_0x6b2a70[util[_0x3af3('0x11')]('%s',_0x3af3('0x26'))]=_0x11b776;}return _0x6b2a70;};exports['toLowerVariables']=function(_0x52f917){var _0x4c7119={};for(var _0x32e91a in _0x52f917){if(_0x52f917[_0x3af3('0x27')](_0x32e91a)){_0x4c7119[util['format']('%s',_[_0x3af3('0x28')](_0x32e91a))]=_0x52f917[_0x32e91a];}}return{'variables':_0x4c7119};};exports[_0x3af3('0x29')]=function(_0x474e8b,_0x3d1309){if(!_['isNil'](_0x474e8b)){if(_0x474e8b[_0x3af3('0x27')]('originated')){if(_0x474e8b[_0x3af3('0x2a')]>0x0){_0x474e8b[_0x3af3('0x2a')]-=0x1;}else{logger[_0x3af3('0xc')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x3d1309);}}}else{logger['error'](_0x3af3('0x2b'),_0x3d1309);}};exports[_0x3af3('0x2c')]=function(_0x1d2638){var _0x2a24cd=moment()[_0x3af3('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d2638['state']=0xd;_0x1d2638[_0x3af3('0x2d')]=_0x3af3('0x2e');_0x1d2638[_0x3af3('0x2f')]=_0x2a24cd;_0x1d2638[_0x3af3('0x30')]=_0x2a24cd;_0x1d2638[_0x3af3('0x31')]=_0x2a24cd;};exports['logAgent']=function(_0x3ade64,_0x3a0d4c,_0x41cce1){var _0x28d0c0=moment()[_0x3af3('0x11')](_0x3af3('0x32'));_0x3ade64[_0x3af3('0x33')]=_0x3a0d4c;_0x3ade64[_0x3af3('0x2d')]=_0x41cce1;_0x3ade64[_0x3af3('0x30')]=_0x28d0c0;_0x3ade64[_0x3af3('0x34')]=utils[_0x3af3('0x35')](_0x3ade64[_0x3af3('0x30')],_0x3ade64[_0x3af3('0x2f')]);};exports[_0x3af3('0x36')]=function(_0x37780c,_0x589afb,_0xc73456){_0x37780c['membername']=_0x589afb;_0x37780c['UserId']=_0xc73456;};exports[_0x3af3('0x37')]=function(_0x4459f2,_0xedddfc,_0x74b3c2){var _0x47d175=moment()[_0x3af3('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x4459f2['state']=_0xedddfc;_0x4459f2[_0x3af3('0x2d')]=_0x74b3c2;_0x4459f2[_0x3af3('0x30')]=_0x4459f2['responsetime']?_0x4459f2[_0x3af3('0x30')]:_0x47d175;_0x4459f2['endtime']=_0x4459f2[_0x3af3('0x31')]?_0x4459f2['endtime']:_0x47d175;_0x4459f2['ringtime']=utils['getSeconds'](_0x4459f2['responsetime']||0x0,_0x4459f2[_0x3af3('0x2f')]||0x0);_0x4459f2[_0x3af3('0x38')]=_0x4459f2[_0x3af3('0x39')]?utils[_0x3af3('0x35')](_0x4459f2[_0x3af3('0x31')],_0x4459f2[_0x3af3('0x39')]):0x0;};exports['isFailure']=function(_0x4a1533){return _0x4a1533===_0x3af3('0x3a');};exports[_0x3af3('0x3b')]=function(_0x728823,_0x248c5c,_0x1a630c,_0x1391dd,_0x5ce40c){var _0x760d38=_0x1391dd?_0x3af3('0x3c'):_0x728823[_0x3af3('0x3d')];_0x760d38=_0x5ce40c?_0x3af3('0x3e'):_0x760d38;return{'actionid':_0x728823[_0x3af3('0x3f')],'action':_0x3af3('0x40'),'channel':_0x728823[_0x3af3('0x41')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x760d38,_0x728823[_0x3af3('0x42')]),'Exten':'xcally-motion-preview','Context':_0x3af3('0x43'),'Priority':'1','variable':_0x1a630c,'timeout':(_0x248c5c[_0x3af3('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x728823[_0x3af3('0x3f')]};};exports[_0x3af3('0x45')]=function(_0x5bc9c2){return _0x5bc9c2[_0x3af3('0x46')]+_0x5bc9c2['countcongestionretry']+_0x5bc9c2[_0x3af3('0x47')]+_0x5bc9c2[_0x3af3('0x48')]+_0x5bc9c2[_0x3af3('0x49')];};exports[_0x3af3('0x4a')]=function(_0x518392){var _0x3ad106=_[_0x3af3('0x4b')](_0x518392);_0x3ad106[_0x3af3('0x33')]=0xf;_0x3ad106[_0x3af3('0x2d')]=_0x3af3('0x4c');return _0x3ad106;};exports['scheduledAt']=function(_0x23e2fd,_0x3bcd95,_0x2facd8){var _0x54dbe3={};_0x54dbe3[_0x3bcd95]=_0x23e2fd[_0x3bcd95];_0x54dbe3[_0x3af3('0x4d')]=![];_0x54dbe3[_0x3af3('0x4e')]=moment()[_0x3af3('0x4f')](_0x2facd8,_0x3af3('0x50'))[_0x3af3('0x11')](_0x3af3('0x32'));_0x54dbe3[_0x3af3('0x17')]=_0x23e2fd[_0x3af3('0x17')];_0x54dbe3[_0x3af3('0x51')]=_0x23e2fd['ListId'];_0x54dbe3[_0x3af3('0x19')]=_0x23e2fd['VoiceQueueId']||undefined;return _0x54dbe3;};exports[_0x3af3('0x52')]=function(_0x128310,_0x2e8965){if(!_[_0x3af3('0x53')](_0x128310)){if(_0x128310[_0x3af3('0x54')]>0x0){_0x128310['pTalking']-=0x1;}else{logger[_0x3af3('0xc')](_0x2e8965,_0x3af3('0x55'));}}else{logger[_0x3af3('0xc')](_0x2e8965,_0x3af3('0x56'));}};exports[_0x3af3('0x57')]=function(_0x262159){if(_0x262159<=0x0){return!![];}return![];};function buildObj(_0x5b3eb7,_0x2c67e5,_0x4704ba){_0x5b3eb7['lastevent']=_0x2c67e5;_0x5b3eb7[_0x3af3('0x16')]=_0x5b3eb7[_0x3af3('0x58')];_0x5b3eb7[_0x3af3('0x59')]=_0x5b3eb7[_0x3af3('0x41')];_0x5b3eb7['motionChannel']=_0x3af3('0x5a');if(_0x4704ba){_0x5b3eb7[_0x3af3('0x5b')]=_0x4704ba['mandatoryDisposition'];}return _0x5b3eb7;}exports[_0x3af3('0x5c')]=buildObj;exports[_0x3af3('0x5d')]=function(_0x34da96){var _0x204abc={};_0x204abc['queue']=_0x34da96[_0x3af3('0x58')];_0x204abc[_0x3af3('0x59')]=_0x34da96['channelAgent'];_0x204abc['uniqueid']=_0x34da96[_0x3af3('0x3f')];return _0x204abc;};exports[_0x3af3('0x5e')]=function(_0x1fbb7e){var _0x29c8be=[];for(var _0x585e06 in _0x1fbb7e){if(_0x1fbb7e['hasOwnProperty'](_0x585e06)){if(!_[_0x3af3('0x53')](_0x1fbb7e[_0x585e06])&&_0x1fbb7e[_0x585e06][_0x3af3('0x33')]===_0x3af3('0x5f')&&_0x1fbb7e[_0x585e06][_0x3af3('0x60')]===_0x3af3('0x61')){_0x29c8be[_0x3af3('0x62')](_0x1fbb7e[_0x585e06]['id']);}}}return _0x29c8be;};exports[_0x3af3('0x63')]=function(_0x3b91c6){var _0x5d3278=moment()[_0x3af3('0x64')](0x0);var _0x3040ff=moment(_0x3b91c6)[_0x3af3('0x64')](0x0);return _0x5d3278['diff'](_0x3040ff,_0x3af3('0x65'));};exports[_0x3af3('0x66')]=function(_0x2d5d2e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2d5d2e[_0x3af3('0x17')],'ListId':_0x2d5d2e['ListId'],'VoiceQueueId':_0x2d5d2e[_0x3af3('0x19')]||undefined,'CampaignId':_0x2d5d2e[_0x3af3('0x67')]||undefined};};exports[_0x3af3('0x68')]=function(_0x44a1e6){if(_0x44a1e6==='uniqueid'||_0x44a1e6===_0x3af3('0x69')||_0x44a1e6===_0x3af3('0x58')||_0x44a1e6==='type'||_0x44a1e6===_0x3af3('0x6a')||_0x44a1e6===_0x3af3('0x6b')||_0x44a1e6===_0x3af3('0x6c')||_0x44a1e6===_0x3af3('0x41')||_0x44a1e6==='calleridname'||_0x44a1e6==='active'||_0x44a1e6===_0x3af3('0x42')||_0x44a1e6===_0x3af3('0x4e')||_0x44a1e6===_0x3af3('0x46')||_0x44a1e6===_0x3af3('0x6d')||_0x44a1e6==='countnoanswerretry'||_0x44a1e6===_0x3af3('0x6e')||_0x44a1e6===_0x3af3('0x6f')||_0x44a1e6==='callbackuniqueid'||_0x44a1e6===_0x3af3('0x70')||_0x44a1e6==='recallme'||_0x44a1e6==='ContactId'||_0x44a1e6===_0x3af3('0x51')||_0x44a1e6===_0x3af3('0x71')||_0x44a1e6==='VoiceQueueId'||_0x44a1e6===_0x3af3('0x72')||_0x44a1e6===_0x3af3('0x73')||_0x44a1e6===_0x3af3('0x74')||_0x44a1e6===_0x3af3('0x75')||_0x44a1e6==='xmd-listid'||_0x44a1e6===_0x3af3('0x76')||_0x44a1e6==='xmd-dialtimeout'||_0x44a1e6===_0x3af3('0x77')||_0x44a1e6===_0x3af3('0x78')||_0x44a1e6==='xmd-dialchannel'||_0x44a1e6===_0x3af3('0x79')||_0x44a1e6===_0x3af3('0x7a')||_0x44a1e6===_0x3af3('0x7b')||_0x44a1e6===_0x3af3('0x7c')||_0x44a1e6===_0x3af3('0x7d')||_0x44a1e6==='rtpaudioqos'||_0x44a1e6===_0x3af3('0x7e')||_0x44a1e6===_0x3af3('0x7f')||_0x44a1e6==='rtpaudioqosjitterbridged'||_0x44a1e6===_0x3af3('0x80')||_0x44a1e6===_0x3af3('0x81')||_0x44a1e6===_0x3af3('0x82')||_0x44a1e6==='rtpaudioqosrttbridged'||_0x44a1e6===_0x3af3('0x83')||_0x44a1e6===_0x3af3('0x7e')||_0x44a1e6===_0x3af3('0x7f')||_0x44a1e6==='rtpaudioqosjitterbridged'||_0x44a1e6===_0x3af3('0x80')||_0x44a1e6===_0x3af3('0x81')||_0x44a1e6===_0x3af3('0x82')||_0x44a1e6===_0x3af3('0x84')||_0x44a1e6==='bridgepeer'||_0x44a1e6===_0x3af3('0x85')||_0x44a1e6==='state'||_0x44a1e6===_0x3af3('0x2d')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x1e559c,_0xb92212){var _0x4b4c6a,_0x2189ec,_0x46d804;if(_0xb92212<=0x0){_0xb92212=0x1;}_0x4b4c6a=new RegExp(_0x3af3('0x86')+_0xb92212+'}$');_0x2189ec=Math[_0x3af3('0x87')](0xa,_0xb92212-0x1);_0x46d804=Math['pow'](0xa,_0xb92212)-0x1;return util[_0x3af3('0x11')]('%s',_['replace'](_0x1e559c,_0x4b4c6a,_['random'](_0x2189ec,_0x46d804)));};exports[_0x3af3('0x88')]=function(_0x4012cb){var _0x357abf=_0x4012cb['match'](/"(.*?)"/);return _0x357abf?_0x357abf[0x1]:_0x4012cb;};exports['extractCalleridNumber']=function(_0xe0735e){var _0xfd8286=_0xe0735e[_0x3af3('0x89')](/<(.*?)>/);return _0xfd8286?_0xfd8286[0x1]:_0xe0735e;};function buildNoAnswerEventPayload(_0x45340f,_0x31c5b0){var _0x2ec0dc=buildObj(_0x45340f,_0x3af3('0x8a'));if(!_['isEmpty'](_0x31c5b0[_0x3af3('0x8b')])){Object[_0x3af3('0x8c')](_0x31c5b0[_0x3af3('0x8b')])[_0x3af3('0x8d')](function(_0x5a3749){_0x2ec0dc[_0x5a3749[_0x3af3('0x8e')]()]=_0x31c5b0[_0x3af3('0x8b')][_0x5a3749];});}return _0x2ec0dc;}exports[_0x3af3('0x8f')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x93a3=['Queue','ContactId','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','statedesc','responsetime','logAgent','state','starttime','logLookAgent','membername','logCustomer','YYYY-MM-DD\x20HH:mm:ss','endtime','ringtime','getSeconds','talktime','answertime','isFailure','Failure','variablesAction','calleridname','originate','channelAgent','calleridnum','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','active','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','voice','mandatoryDisposition','buildObj','buildAcw','push','getDiff','milliseconds','diff','createBody','CampaignId','type','campaigntype','dialAnswer','scheduledat','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosjitterbridged','bridgepvtcallid','\x5cw{0,','pow','replace','extractCalleridName','match','noanswer','forEach','toLowerCase','variables','buildNoAnswerEventPayload','util','lodash','preview','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables'];(function(_0x420f58,_0x20bae3){var _0x5a785f=function(_0xd5c9b1){while(--_0xd5c9b1){_0x420f58['push'](_0x420f58['shift']());}};_0x5a785f(++_0x20bae3);}(_0x93a3,0x71));var _0x393a=function(_0xd797ad,_0x8a92b1){_0xd797ad=_0xd797ad-0x0;var _0x1fb246=_0x93a3[_0xd797ad];return _0x1fb246;};'use strict';var util=require(_0x393a('0x0'));var _=require(_0x393a('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x393a('0x2'));var ipAgi=process['env'][_0x393a('0x3')]||_0x393a('0x4');var utils=require(_0x393a('0x5'));exports[_0x393a('0x6')]=function(_0x2942ce){return function(_0x40eb27){logger[_0x393a('0x7')](_0x2942ce,util[_0x393a('0x8')](_0x40eb27,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x3923bd,_0x1e56a9){logger[_0x393a('0x9')](_0x3923bd,util['inspect'](_0x1e56a9,{'showHidden':![],'depth':null}));};exports[_0x393a('0xa')]=function(_0x10de3f,_0x597666){logger['error'](_0x10de3f,util[_0x393a('0x8')](_0x597666,{'showHidden':![],'depth':null}));};exports[_0x393a('0xb')]=function(_0x366ada){return function(_0x30dab6){logger[_0x393a('0x9')](_0x366ada,util[_0x393a('0x8')](_0x30dab6,{'showHidden':![],'depth':null}));};};exports[_0x393a('0xc')]=function(_0x106c19,_0x3fb482,_0x5d4753){return{'message':_0x106c19,'unlock':_0x3fb482,'active':_0x5d4753};};exports[_0x393a('0xd')]=function(_0xe63a72,_0x49feb5,_0xa275d6){if(!_[_0x393a('0xe')](_0xa275d6)&&_0x393a('0xf')===typeof _0xa275d6&&!_[_0x393a('0x10')](_0xa275d6)){if(!_[_0x393a('0xe')](_0x49feb5)&&_0x393a('0xf')===typeof _0x49feb5&&!_[_0x393a('0x10')](_0x49feb5)){return util[_0x393a('0x11')](_0x393a('0x12'),_0x49feb5,_0xa275d6);}return util[_0x393a('0x11')](_0x393a('0x12'),_0xa275d6,_0xa275d6);}if(!_[_0x393a('0xe')](_0xe63a72)&&_0x393a('0xf')===typeof _0xe63a72&&!_['isEmpty'](_0xe63a72)){return _0xe63a72;}return _0x393a('0x13');};exports['isActive']=function(_0x5677a8){if(_[_0x393a('0x14')](_0x5677a8)){return![];}return _0x5677a8;};exports[_0x393a('0x15')]=function(_0x2b3647,_0x903288,_0x37bf5a,_0x444aba,_0x51f589,_0x2025bd){var _0x578557={'XMD-QUEUE':_0x903288[_0x393a('0x16')]?_0x903288[_0x393a('0x16')]['name']:'','XMD-CALLERID':_0x444aba,'XMD-CALLERID-PREVIEW':_0x2025bd?util[_0x393a('0x11')](_0x393a('0x12'),_0x2025bd['calleridname'],_0x2025bd['calleridnum']):_0x444aba,'XMD-DIALID':_0x51f589,'XMD-CONTACTID':_0x903288[_0x393a('0x17')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x444aba,'XMD-VOICEQUEUEID':_0x903288[_0x393a('0x18')],'XMD-DIALCHANNEL':_0x37bf5a,'XMD-DIALTIMEOUT':_0x2b3647[_0x393a('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0x393a('0x11')]('\x22rtTxX%s%s\x22',_0x2b3647[_0x393a('0x1a')]?'g':'',_['isEmpty'](_0x2b3647[_0x393a('0x1b')])?'':_0x393a('0x1c')),'XMD-DIALURL':_0x2b3647[_0x393a('0x1d')]||'','XMD-AGI':_0x2b3647['dialQueueProject']?util[_0x393a('0x11')](_0x393a('0x1e'),ipAgi,_0x2b3647[_0x393a('0x1f')]):'NONE','XMD-AGIAFTER':_0x2b3647[_0x393a('0x1a')]?util[_0x393a('0x11')](_0x393a('0x1e'),ipAgi,_0x2b3647['dialQueueProject2']):_0x393a('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x2025bd?_0x2025bd[_0x393a('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x2025bd?_0x2025bd[_0x393a('0x22')]:'','XMD-DESTINATION':_0x393a('0x23'),'SIPADDHEADER':_0x393a('0x24')};if(!_[_0x393a('0x10')](_0x2b3647[_0x393a('0x1b')])){_0x578557[util[_0x393a('0x11')]('%s',_0x393a('0x25'))]=_0x2b3647[_0x393a('0x1b')];_0x578557[util[_0x393a('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x51f589;}return _0x578557;};exports[_0x393a('0x26')]=function(_0x1d531e){var _0x3c2f71={};for(var _0x577027 in _0x1d531e){if(_0x1d531e[_0x393a('0x27')](_0x577027)){_0x3c2f71[util['format']('%s',_[_0x393a('0x28')](_0x577027))]=_0x1d531e[_0x577027];}}return{'variables':_0x3c2f71};};exports[_0x393a('0x29')]=function(_0x509f32,_0x79536b){if(!_[_0x393a('0x14')](_0x509f32)){if(_0x509f32[_0x393a('0x27')](_0x393a('0x2a'))){if(_0x509f32['originated']>0x0){_0x509f32[_0x393a('0x2a')]-=0x1;}else{logger[_0x393a('0x7')](_0x393a('0x2b'),_0x79536b);}}}else{logger[_0x393a('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x79536b);}};exports[_0x393a('0x2c')]=function(_0x18bd15){var _0x572cae=moment()[_0x393a('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x18bd15['state']=0xd;_0x18bd15[_0x393a('0x2d')]='Blacklist';_0x18bd15['starttime']=_0x572cae;_0x18bd15[_0x393a('0x2e')]=_0x572cae;_0x18bd15['endtime']=_0x572cae;};exports[_0x393a('0x2f')]=function(_0x4b5790,_0x2c2abb,_0x38e5a4){var _0x25d91d=moment()[_0x393a('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x4b5790[_0x393a('0x30')]=_0x2c2abb;_0x4b5790['statedesc']=_0x38e5a4;_0x4b5790[_0x393a('0x2e')]=_0x25d91d;_0x4b5790['ringtime']=utils['getSeconds'](_0x4b5790[_0x393a('0x2e')],_0x4b5790[_0x393a('0x31')]);};exports[_0x393a('0x32')]=function(_0x479dea,_0x267835,_0x3a336a){_0x479dea[_0x393a('0x33')]=_0x267835;_0x479dea['UserId']=_0x3a336a;};exports[_0x393a('0x34')]=function(_0x3e4c31,_0x47c265,_0x5b3230){var _0x39b6df=moment()['format'](_0x393a('0x35'));_0x3e4c31[_0x393a('0x30')]=_0x47c265;_0x3e4c31['statedesc']=_0x5b3230;_0x3e4c31[_0x393a('0x2e')]=_0x3e4c31['responsetime']?_0x3e4c31[_0x393a('0x2e')]:_0x39b6df;_0x3e4c31[_0x393a('0x36')]=_0x3e4c31['endtime']?_0x3e4c31['endtime']:_0x39b6df;_0x3e4c31[_0x393a('0x37')]=utils[_0x393a('0x38')](_0x3e4c31[_0x393a('0x2e')]||0x0,_0x3e4c31[_0x393a('0x31')]||0x0);_0x3e4c31[_0x393a('0x39')]=_0x3e4c31[_0x393a('0x3a')]?utils['getSeconds'](_0x3e4c31['endtime'],_0x3e4c31[_0x393a('0x3a')]):0x0;};exports[_0x393a('0x3b')]=function(_0x5e4cd0){return _0x5e4cd0===_0x393a('0x3c');};exports[_0x393a('0x3d')]=function(_0x58e947,_0x4b4187,_0x54ff98,_0x1bc9b5,_0x3a7fab){var _0x36191b=_0x1bc9b5?'RECALL':_0x58e947[_0x393a('0x3e')];_0x36191b=_0x3a7fab?'BOOKED':_0x36191b;return{'actionid':_0x58e947['uniqueid'],'action':_0x393a('0x3f'),'channel':_0x58e947[_0x393a('0x40')],'callerid':util[_0x393a('0x11')](_0x393a('0x12'),_0x36191b,_0x58e947[_0x393a('0x41')]),'Exten':'xcally-motion-preview','Context':_0x393a('0x42'),'Priority':'1','variable':_0x54ff98,'timeout':(_0x4b4187[_0x393a('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x58e947[_0x393a('0x44')]};};exports[_0x393a('0x45')]=function(_0x9b5b6f){return _0x9b5b6f[_0x393a('0x46')]+_0x9b5b6f[_0x393a('0x47')]+_0x9b5b6f[_0x393a('0x48')]+_0x9b5b6f['countagentrejectretry']+_0x9b5b6f[_0x393a('0x49')];};exports[_0x393a('0x4a')]=function(_0x21d743){var _0x5b3c7a=_[_0x393a('0x4b')](_0x21d743);_0x5b3c7a[_0x393a('0x30')]=0xf;_0x5b3c7a[_0x393a('0x2d')]=_0x393a('0x4c');return _0x5b3c7a;};exports['scheduledAt']=function(_0x255093,_0x3429cf,_0x484a30){var _0x26ac21={};_0x26ac21[_0x3429cf]=_0x255093[_0x3429cf];_0x26ac21[_0x393a('0x4d')]=![];_0x26ac21['scheduledat']=moment()['add'](_0x484a30,_0x393a('0x4e'))[_0x393a('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x26ac21['ContactId']=_0x255093['ContactId'];_0x26ac21['ListId']=_0x255093[_0x393a('0x4f')];_0x26ac21[_0x393a('0x18')]=_0x255093[_0x393a('0x18')]||undefined;return _0x26ac21;};exports[_0x393a('0x50')]=function(_0x100167,_0x44ede9){if(!_[_0x393a('0x14')](_0x100167)){if(_0x100167[_0x393a('0x51')]>0x0){_0x100167['pTalking']-=0x1;}else{logger['error'](_0x44ede9,_0x393a('0x52'));}}else{logger[_0x393a('0x7')](_0x44ede9,_0x393a('0x53'));}};exports[_0x393a('0x54')]=function(_0x59825b){if(_0x59825b<=0x0){return!![];}return![];};function buildObj(_0x24bca5,_0x2f55ca,_0x2520fe){_0x24bca5['lastevent']=_0x2f55ca;_0x24bca5['name']=_0x24bca5[_0x393a('0x55')];_0x24bca5[_0x393a('0x56')]=_0x24bca5['channelAgent'];_0x24bca5['motionChannel']=_0x393a('0x57');if(_0x2520fe){_0x24bca5[_0x393a('0x58')]=_0x2520fe[_0x393a('0x58')];}return _0x24bca5;}exports[_0x393a('0x59')]=buildObj;exports[_0x393a('0x5a')]=function(_0x505794){var _0x4ecf49={};_0x4ecf49[_0x393a('0x55')]=_0x505794[_0x393a('0x55')];_0x4ecf49[_0x393a('0x56')]=_0x505794[_0x393a('0x40')];_0x4ecf49['uniqueid']=_0x505794[_0x393a('0x44')];return _0x4ecf49;};exports['agentReadyId']=function(_0x33edc1){var _0x2adede=[];for(var _0x5dbf89 in _0x33edc1){if(_0x33edc1[_0x393a('0x27')](_0x5dbf89)){if(!_['isNil'](_0x33edc1[_0x5dbf89])&&_0x33edc1[_0x5dbf89][_0x393a('0x30')]==='not_inuse'&&_0x33edc1[_0x5dbf89]['status']==='reachable'){_0x2adede[_0x393a('0x5b')](_0x33edc1[_0x5dbf89]['id']);}}}return _0x2adede;};exports[_0x393a('0x5c')]=function(_0x23d6eb){var _0x356878=moment()['milliseconds'](0x0);var _0x1e94ee=moment(_0x23d6eb)[_0x393a('0x5d')](0x0);return _0x356878[_0x393a('0x5e')](_0x1e94ee,'seconds');};exports[_0x393a('0x5f')]=function(_0x552ebd){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x552ebd['ContactId'],'ListId':_0x552ebd[_0x393a('0x4f')],'VoiceQueueId':_0x552ebd[_0x393a('0x18')]||undefined,'CampaignId':_0x552ebd[_0x393a('0x60')]||undefined};};exports['filterKey']=function(_0x295f87){if(_0x295f87===_0x393a('0x44')||_0x295f87==='idContact'||_0x295f87==='queue'||_0x295f87===_0x393a('0x61')||_0x295f87===_0x393a('0x62')||_0x295f87===_0x393a('0x63')||_0x295f87===_0x393a('0x33')||_0x295f87===_0x393a('0x40')||_0x295f87===_0x393a('0x3e')||_0x295f87===_0x393a('0x4d')||_0x295f87===_0x393a('0x41')||_0x295f87===_0x393a('0x64')||_0x295f87==='countbusyretry'||_0x295f87==='countcongestionretry'||_0x295f87===_0x393a('0x48')||_0x295f87===_0x393a('0x65')||_0x295f87===_0x393a('0x66')||_0x295f87===_0x393a('0x67')||_0x295f87===_0x393a('0x68')||_0x295f87===_0x393a('0x69')||_0x295f87===_0x393a('0x17')||_0x295f87===_0x393a('0x4f')||_0x295f87===_0x393a('0x6a')||_0x295f87===_0x393a('0x18')||_0x295f87==='sipcallid'||_0x295f87===_0x393a('0x6b')||_0x295f87===_0x393a('0x6c')||_0x295f87===_0x393a('0x6d')||_0x295f87===_0x393a('0x6e')||_0x295f87===_0x393a('0x6f')||_0x295f87===_0x393a('0x70')||_0x295f87===_0x393a('0x71')||_0x295f87===_0x393a('0x72')||_0x295f87===_0x393a('0x73')||_0x295f87==='xmd-contactid'||_0x295f87==='xmd-cdrtype'||_0x295f87===_0x393a('0x74')||_0x295f87===_0x393a('0x75')||_0x295f87==='xmd-agi'||_0x295f87===_0x393a('0x76')||_0x295f87===_0x393a('0x77')||_0x295f87===_0x393a('0x78')||_0x295f87==='rtpaudioqosjitterbridged'||_0x295f87===_0x393a('0x79')||_0x295f87===_0x393a('0x7a')||_0x295f87==='rtpaudioqosrtt'||_0x295f87==='rtpaudioqosrttbridged'||_0x295f87===_0x393a('0x76')||_0x295f87===_0x393a('0x77')||_0x295f87===_0x393a('0x78')||_0x295f87===_0x393a('0x7b')||_0x295f87==='rtpaudioqosloss'||_0x295f87===_0x393a('0x7a')||_0x295f87==='rtpaudioqosrtt'||_0x295f87==='rtpaudioqosrttbridged'||_0x295f87==='bridgepeer'||_0x295f87===_0x393a('0x7c')||_0x295f87==='state'||_0x295f87==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x277c23,_0x143dce){var _0x3b2aae,_0x4a665d,_0x3e95cd;if(_0x143dce<=0x0){_0x143dce=0x1;}_0x3b2aae=new RegExp(_0x393a('0x7d')+_0x143dce+'}$');_0x4a665d=Math[_0x393a('0x7e')](0xa,_0x143dce-0x1);_0x3e95cd=Math[_0x393a('0x7e')](0xa,_0x143dce)-0x1;return util[_0x393a('0x11')]('%s',_[_0x393a('0x7f')](_0x277c23,_0x3b2aae,_['random'](_0x4a665d,_0x3e95cd)));};exports[_0x393a('0x80')]=function(_0x1bd2ca){var _0x3b5912=_0x1bd2ca[_0x393a('0x81')](/"(.*?)"/);return _0x3b5912?_0x3b5912[0x1]:_0x1bd2ca;};exports['extractCalleridNumber']=function(_0x1e0407){var _0x136100=_0x1e0407[_0x393a('0x81')](/<(.*?)>/);return _0x136100?_0x136100[0x1]:_0x1e0407;};function buildNoAnswerEventPayload(_0x16650a,_0x11b22c){var _0x4eb419=buildObj(_0x16650a,_0x393a('0x82'));if(!_[_0x393a('0x10')](_0x11b22c['variables'])){Object['keys'](_0x11b22c['variables'])[_0x393a('0x83')](function(_0x15682a){_0x4eb419[_0x15682a[_0x393a('0x84')]()]=_0x11b22c[_0x393a('0x85')][_0x15682a];});}return _0x4eb419;}exports[_0x393a('0x86')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index f4c2047..0228c60 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 _0x651c=['voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','number','boolean','queueremove','queuepause'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x651c,0x186));var _0xc651=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0x651c[_0x29c261];return _0x1a9335;};'use strict';exports[_0xc651('0x0')]={'queue':{'type':_0xc651('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xc651('0x2'),'required':![]},'paused':{'type':_0xc651('0x3'),'required':![]}};exports[_0xc651('0x4')]={'queue':{'type':_0xc651('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xc651('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xc651('0x3')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0xc651('0x6')]={'uniqueid':{'type':_0xc651('0x1'),'required':!![]}};exports[_0xc651('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xc651('0x1')},'format':{'type':_0xc651('0x1')},'mixmonitorid':{'type':_0xc651('0x1')}};exports[_0xc651('0x8')]={'uniqueid':{'type':_0xc651('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xc651('0x1'),'required':!![]},'context':{'type':_0xc651('0x1')}}; \ No newline at end of file +var _0xf44c=['voicequeuechannelredirect','queueadd','string','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x5e7073,_0x508642){var _0x183361=function(_0x12df8b){while(--_0x12df8b){_0x5e7073['push'](_0x5e7073['shift']());}};_0x183361(++_0x508642);}(_0xf44c,0x89));var _0xcf44=function(_0x433ebf,_0x4f70ab){_0x433ebf=_0x433ebf-0x0;var _0x5aaebc=_0xf44c[_0x433ebf];return _0x5aaebc;};'use strict';exports[_0xcf44('0x0')]={'queue':{'type':_0xcf44('0x1'),'required':!![]},'interface':{'type':_0xcf44('0x1'),'required':!![]},'membername':{'type':_0xcf44('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xcf44('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0xcf44('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xcf44('0x1'),'required':!![]},'paused':{'type':_0xcf44('0x2')},'reason':{'type':_0xcf44('0x1'),'required':![]}};exports[_0xcf44('0x3')]={'module':{'type':_0xcf44('0x1'),'required':![]}};exports[_0xcf44('0x4')]={'uniqueid':{'type':_0xcf44('0x1'),'required':!![]}};exports[_0xcf44('0x5')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0xcf44('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xcf44('0x6')]={'uniqueid':{'type':_0xcf44('0x1'),'required':!![]}};exports[_0xcf44('0x7')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xcf44('0x1'),'required':!![]},'context':{'type':_0xcf44('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 0d2ba56..2295960 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x10a649,_0x2df15f){var _0x11a95f=function(_0x44cde5){while(--_0x44cde5){_0x10a649['push'](_0x10a649['shift']());}};_0x11a95f(++_0x2df15f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4ee698,_0x4b588f){_0x4ee698=_0x4ee698-0x0;var _0x503343=_0x5f2f[_0x4ee698];return _0x503343;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file +var _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x1ba658,_0x52f8be){var _0x111537=function(_0x416851){while(--_0x416851){_0x1ba658['push'](_0x1ba658['shift']());}};_0x111537(++_0x52f8be);}(_0xdb28,0x106));var _0x8db2=function(_0x500c6d,_0x55a426){_0x500c6d=_0x500c6d-0x0;var _0x23b3b8=_0xdb28[_0x500c6d];return _0x23b3b8;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 6afe133..fc6f7fb 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 _0x796d=['mergeDBDataToRealtime','assign'];(function(_0x2f8c05,_0x551e3d){var _0x14cfde=function(_0x282d66){while(--_0x282d66){_0x2f8c05['push'](_0x2f8c05['shift']());}};_0x14cfde(++_0x551e3d);}(_0x796d,0x143));var _0xd796=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x796d[_0x5b78e8];return _0xf2c321;};'use strict';function mergeDBDataToRealtime(_0x57cdfe,_0x2e5e19){var _0x323cbf=Object[_0xd796('0x0')]({},_0x57cdfe);for(var _0x3d7165 in _0x2e5e19){if(_0x323cbf['hasOwnProperty'](_0x3d7165)){_0x323cbf[_0x3d7165]=_0x2e5e19[_0x3d7165];}}return _0x323cbf;}exports[_0xd796('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xdafb=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x34d19a,_0x5689da){var _0x3a8ddd=function(_0x25e301){while(--_0x25e301){_0x34d19a['push'](_0x34d19a['shift']());}};_0x3a8ddd(++_0x5689da);}(_0xdafb,0x90));var _0xbdaf=function(_0x5b9dde,_0x20e2bb){_0x5b9dde=_0x5b9dde-0x0;var _0x2c199a=_0xdafb[_0x5b9dde];return _0x2c199a;};'use strict';function mergeDBDataToRealtime(_0x247bbe,_0x51e9e4){var _0x4c6bbd=Object[_0xbdaf('0x0')]({},_0x247bbe);for(var _0xd01ab6 in _0x51e9e4){if(_0x4c6bbd[_0xbdaf('0x1')](_0xd01ab6)){_0x4c6bbd[_0xd01ab6]=_0x51e9e4[_0xd01ab6];}}return _0x4c6bbd;}exports[_0xbdaf('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 972b769..2d34073 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 _0x81c9=['destination','type','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','calleridpreview','originatecalleridnum','destinationchannel','\x22%s\x22\x20<%s>','transfers','linkedid','uniqueid','UserId','membername','create','monitors','monitorFilename','filename','createdAt','exten','xcally-motion-preview','calleridname','connectedlinename','isArray','forEach','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','find','accountcode','name','isNil','interface','format','length','findAgent','connectedlinenum','assigned','lastAssignedTo','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','getAgentByInternal','keys','getCallType','channel','calleridnum','outbound'];(function(_0x3b0969,_0x4d45bf){var _0x2c2fa6=function(_0x3ebfde){while(--_0x3ebfde){_0x3b0969['push'](_0x3b0969['shift']());}};_0x2c2fa6(++_0x4d45bf);}(_0x81c9,0x196));var _0x981c=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x81c9[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x981c('0x0'));var moment=require(_0x981c('0x1'));var util=require(_0x981c('0x2'));var config=require(_0x981c('0x3'));var ami=require(_0x981c('0x4'));var RpcVoiceAgentReport=require(_0x981c('0x5'));var RpcVoiceCallReport=require(_0x981c('0x6'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x981c('0x7'));var RpcVoiceQueueReport=require(_0x981c('0x8'));var RpcVoiceRecording=require(_0x981c('0x9'));var RpcVoiceTransferReport=require(_0x981c('0xa'));var VoiceQueueReport=require(_0x981c('0xb'));var VoiceCallReport=require(_0x981c('0xc'));var VoiceAgentReport=require(_0x981c('0xd'));var VoiceDialReport=require(_0x981c('0xe'));var UserReport=require(_0x981c('0xf'));function Report(_0x416f01){this[_0x981c('0x10')]=_0x416f01;this[_0x981c('0x11')]=_0x416f01[_0x981c('0x11')];this[_0x981c('0x12')]=_0x416f01['telephones'];}Report[_0x981c('0x13')][_0x981c('0x14')]=function(_0x12539e){var _0x1f617=new VoiceQueueReport(this[_0x981c('0x10')]);var _0x4141da=new VoiceAgentReport(this[_0x981c('0x10')]);var _0x280b5f=new VoiceDialReport(this[_0x981c('0x10')]);var _0x23185b=new VoiceCallReport(this[_0x981c('0x10')]);var _0x40d329=new UserReport(this[_0x981c('0x10')]);if(config[_0x981c('0x15')]&&config[_0x981c('0x15')][_0x981c('0x16')]){ami['on'](_0x981c('0x17'),this[_0x981c('0x18')][_0x981c('0x19')](this));ami['on']('custom:voiceCallReport',this[_0x981c('0x1a')]['bind'](this));ami['on'](_0x981c('0x1b'),this[_0x981c('0x1c')]['bind'](this));ami['on'](_0x981c('0x1d'),this[_0x981c('0x1e')][_0x981c('0x19')](this));ami['on']('blindtransfer',this[_0x981c('0x1f')][_0x981c('0x19')](this));ami['on'](_0x981c('0x20'),this[_0x981c('0x21')][_0x981c('0x19')](this));}};Report['prototype']['findAgent']=function(_0x3b870b){var _0x554096;_0x554096=_[_0x981c('0x22')](this[_0x981c('0x11')],function(_0x383d6c){return _0x383d6c[_0x981c('0x23')]==_0x3b870b||_0x383d6c[_0x981c('0x24')]==_0x3b870b;});if(_[_0x981c('0x25')](_0x554096)){var _0x48f2e1=_[_0x981c('0x22')](this['telephones'],function(_0x15099e){return _0x15099e[_0x981c('0x23')]==_0x3b870b||_0x15099e[_0x981c('0x24')]==_0x3b870b;});if(_0x48f2e1){_0x554096=_[_0x981c('0x22')](this[_0x981c('0x11')],function(_0xee37c7){return _0xee37c7[_0x981c('0x26')]==util[_0x981c('0x27')]('SIP/%s',_0x48f2e1[_0x981c('0x24')]);});}}return _0x554096;};Report[_0x981c('0x13')][_0x981c('0x18')]=function(_0x89b5c8){for(var _0x6d9892=0x0;_0x6d9892<_0x89b5c8[_0x981c('0x28')];_0x6d9892+=0x1){var _0x59e2b4=this[_0x981c('0x29')](_0x89b5c8[_0x6d9892][_0x981c('0x2a')]);if(_0x59e2b4){_0x89b5c8[_0x6d9892]['accountcode']=_0x59e2b4['accountcode'];_0x89b5c8[_0x6d9892][_0x981c('0x2b')]=!![];_0x89b5c8[_0x6d9892][_0x981c('0x2c')]=_0x59e2b4[_0x981c('0x24')];_0x89b5c8[_0x6d9892][_0x981c('0x26')]=_[_0x981c('0x25')](_0x59e2b4[_0x981c('0x26')])?util[_0x981c('0x27')](_0x981c('0x2d'),_0x59e2b4[_0x981c('0x24')]):_0x59e2b4[_0x981c('0x26')];if(_0x89b5c8[_0x6d9892]['queuecallercomplete']){_0x89b5c8[_0x6d9892]['queuecallercompleteAt']=moment()['format'](_0x981c('0x2e'));}if(_0x89b5c8[_0x6d9892]['queuecallerexit']){_0x89b5c8[_0x6d9892][_0x981c('0x2f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x981c('0x18')](_0x89b5c8[_0x6d9892]);}RpcVoiceQueueReport['create'](_0x89b5c8[_0x6d9892]);}};function extractCalleridNumber(_0x16313c){var _0x25858d=_0x16313c['match'](/<(.*?)>/);return _0x25858d?_0x25858d[0x1]:_0x16313c;}Report['prototype'][_0x981c('0x30')]=function(_0x246c0f){for(var _0x5d7866=0x0;_0x5d7866','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','split','membername','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','transfererlinkedid','exports','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceTransferReport'];(function(_0x11de96,_0x3b172b){var _0x26d213=function(_0x178662){while(--_0x178662){_0x11de96['push'](_0x11de96['shift']());}};_0x26d213(++_0x3b172b);}(_0x653a,0x1ba));var _0xa653=function(_0x458e33,_0x4f8045){_0x458e33=_0x458e33-0x0;var _0x5109b0=_0x653a[_0x458e33];return _0x5109b0;};'use strict';var _=require(_0xa653('0x0'));var moment=require(_0xa653('0x1'));var util=require(_0xa653('0x2'));var config=require('../../../config/environment');var ami=require(_0xa653('0x3'));var RpcVoiceAgentReport=require(_0xa653('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xa653('0x5'));var RpcMemberReport=require(_0xa653('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xa653('0x7'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xa653('0x8'));var VoiceAgentReport=require(_0xa653('0x9'));var VoiceDialReport=require(_0xa653('0xa'));var UserReport=require(_0xa653('0xb'));function Report(_0x2c64a0){this['realtime']=_0x2c64a0;this[_0xa653('0xc')]=_0x2c64a0['agents'];this[_0xa653('0xd')]=_0x2c64a0[_0xa653('0xd')];}Report[_0xa653('0xe')][_0xa653('0xf')]=function(_0x2bbf5d){var _0x23a5a1=new VoiceQueueReport(this[_0xa653('0x10')]);var _0x4753dd=new VoiceAgentReport(this['realtime']);var _0x3716be=new VoiceDialReport(this[_0xa653('0x10')]);var _0x36a022=new VoiceCallReport(this['realtime']);var _0x5b6663=new UserReport(this[_0xa653('0x10')]);if(config[_0xa653('0x11')]&&config['xdr'][_0xa653('0x12')]){ami['on']('custom:voiceQueueReport',this[_0xa653('0x13')]['bind'](this));ami['on'](_0xa653('0x14'),this['voiceCallReport'][_0xa653('0x15')](this));ami['on'](_0xa653('0x16'),this[_0xa653('0x17')]['bind'](this));ami['on']('custom:voiceDialReport',this['voiceDialReport'][_0xa653('0x15')](this));ami['on'](_0xa653('0x18'),this[_0xa653('0x19')][_0xa653('0x15')](this));ami['on'](_0xa653('0x1a'),this[_0xa653('0x1b')][_0xa653('0x15')](this));}};Report[_0xa653('0xe')][_0xa653('0x1c')]=function(_0x4f456e){var _0xd0f0bf;_0xd0f0bf=_['find'](this[_0xa653('0xc')],function(_0x1cccc9){return _0x1cccc9[_0xa653('0x1d')]==_0x4f456e||_0x1cccc9[_0xa653('0x1e')]==_0x4f456e;});if(_[_0xa653('0x1f')](_0xd0f0bf)){var _0x52b1b0=_[_0xa653('0x20')](this[_0xa653('0xd')],function(_0x3a45f7){return _0x3a45f7['accountcode']==_0x4f456e||_0x3a45f7['name']==_0x4f456e;});if(_0x52b1b0){_0xd0f0bf=_['find'](this[_0xa653('0xc')],function(_0x261250){return _0x261250['interface']==util[_0xa653('0x21')](_0xa653('0x22'),_0x52b1b0[_0xa653('0x1e')]);});}}return _0xd0f0bf;};Report['prototype'][_0xa653('0x13')]=function(_0x3d529b){for(var _0x1d1f44=0x0;_0x1d1f44<_0x3d529b[_0xa653('0x23')];_0x1d1f44+=0x1){var _0x396f88=this[_0xa653('0x1c')](_0x3d529b[_0x1d1f44][_0xa653('0x24')]);if(_0x396f88){_0x3d529b[_0x1d1f44][_0xa653('0x1d')]=_0x396f88['accountcode'];_0x3d529b[_0x1d1f44]['assigned']=!![];_0x3d529b[_0x1d1f44][_0xa653('0x25')]=_0x396f88[_0xa653('0x1e')];_0x3d529b[_0x1d1f44][_0xa653('0x26')]=_[_0xa653('0x1f')](_0x396f88[_0xa653('0x26')])?util[_0xa653('0x21')](_0xa653('0x22'),_0x396f88[_0xa653('0x1e')]):_0x396f88['interface'];if(_0x3d529b[_0x1d1f44][_0xa653('0x27')]){_0x3d529b[_0x1d1f44][_0xa653('0x28')]=moment()[_0xa653('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3d529b[_0x1d1f44][_0xa653('0x29')]){_0x3d529b[_0x1d1f44]['queuecallerexitAt']=moment()[_0xa653('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x3d529b[_0x1d1f44]);}RpcVoiceQueueReport[_0xa653('0x2a')](_0x3d529b[_0x1d1f44]);}};function extractCalleridNumber(_0xde279c){var _0xd42300=_0xde279c['match'](/<(.*?)>/);return _0xd42300?_0xd42300[0x1]:_0xde279c;}Report[_0xa653('0xe')][_0xa653('0x2b')]=function(_0x2ae936){for(var _0xf7593e=0x0;_0xf7593e0x0?!![]:![];if(!_0x1267c5){return this[_0xb07a('0x14')](this[_0xb07a('0x10')][_0xb07a('0x6c')]);}};VoiceQueueReport[_0xb07a('0x35')][_0xb07a('0x6d')]=function(_0x3a3af9){var _0x384056=this[_0xb07a('0x10')]['id'];if(this[_0xb07a('0x10')][_0xb07a('0x5f')][_0x384056]&&this['summary'][_0xb07a('0x5f')][_0x384056][_0x3a3af9[_0xb07a('0x5e')]]){this['summary']['queuestatus'][_0x384056][_0x3a3af9['actionid']][_0xb07a('0xc')]['push'](_0x3a3af9);}};VoiceQueueReport[_0xb07a('0x35')][_0xb07a('0x12')]=function(_0x193993){var _0x57965c=this;try{if(this[_0xb07a('0x57')](_0x193993)&&this[_0xb07a('0x57')](_0x193993[_0xb07a('0x4f')])){logger[_0xb07a('0x45')](_0xb07a('0x6e'),util['inspect'](_0x193993,{'showHidden':![],'depth':null}));var _0x155f0a=this[_0xb07a('0xe')][_0x193993[_0xb07a('0x4f')]];if(_0x155f0a){logger['debug'](_0xb07a('0x6f'),_0x155f0a[_0xb07a('0x55')]);this[_0xb07a('0x10')][_0xb07a('0x58')][_0x155f0a[_0xb07a('0x55')]]={'summaryEvent':_0x193993};this[_0xb07a('0x10')]['statusRequests']+=0x1;return ami[_0xb07a('0x38')]({'action':_0xb07a('0x5f'),'queue':_0x155f0a['name']})['then'](function(_0x2552ad){if(!_0x57965c[_0xb07a('0x10')][_0xb07a('0x5f')][_0x193993['actionid']]){_0x57965c[_0xb07a('0x10')][_0xb07a('0x5f')][_0x193993[_0xb07a('0x5e')]]={};}_0x57965c[_0xb07a('0x10')][_0xb07a('0x5f')][_0x193993[_0xb07a('0x5e')]][_0x2552ad[_0xb07a('0x5e')]]={'queue':_0x155f0a[_0xb07a('0x55')],'agents':[]};})[_0xb07a('0x39')](function(_0x427109){throw _0x427109;});}}}catch(_0x5dddda){logger['error'](_0xb07a('0x60'),util[_0xb07a('0x3d')](_0x5dddda,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb07a('0x35')][_0xb07a('0x14')]=function(_0x1158e8){if(this[_0xb07a('0x10')][_0xb07a('0x6b')]>0x0){this[_0xb07a('0x10')]['completeEvent']=_0x1158e8;return;}logger[_0xb07a('0x45')](_0xb07a('0x70'),util[_0xb07a('0x3d')](_0x1158e8,{'showHidden':![],'depth':null}));this[_0xb07a('0x10')]=initializeSummary();ami['emit']('custom:queuesummarycomplete',{});};VoiceQueueReport['prototype'][_0xb07a('0x1a')]=function(_0x2db9df){try{if(this['isNotNull'](_0x2db9df)){logger[_0xb07a('0x45')](_0xb07a('0x71'),_0x2db9df[_0xb07a('0x47')],util[_0xb07a('0x3d')](_0x2db9df,{'showHidden':![],'depth':null}));if(_[_0xb07a('0x72')](this[_0xb07a('0x3e')][_0x2db9df['uniqueid']])){this[_0xb07a('0x3e')][_0x2db9df[_0xb07a('0x47')]]=[];}if(_[_0xb07a('0x72')](this[_0xb07a('0xd')][_0x2db9df[_0xb07a('0x47')]])){this[_0xb07a('0xd')][_0x2db9df[_0xb07a('0x47')]]={};}var _0x5d8063=new QueueReport();_0x5d8063[_0xb07a('0x4f')]=_0x2db9df[_0xb07a('0x4f')];_0x5d8063[_0xb07a('0x52')]=this[_0xb07a('0xe')][_0x5d8063[_0xb07a('0x4f')]]&&this['voiceQueues'][_0x5d8063[_0xb07a('0x4f')]][_0xb07a('0x52')]?this['voiceQueues'][_0x5d8063['queue']][_0xb07a('0x52')]||_0xb07a('0x53'):_0xb07a('0x53');_0x5d8063[_0xb07a('0x73')]=moment()['format'](_0xb07a('0x74'));_0x5d8063['position']=_0x2db9df[_0xb07a('0x75')];_0x5d8063[_0xb07a('0x76')]=_0x2db9df[_0xb07a('0x76')];_0x5d8063[_0xb07a('0x47')]=_0x2db9df[_0xb07a('0x47')];_0x5d8063[_0xb07a('0x77')]=this[_0xb07a('0xd')][_0x2db9df['uniqueid']]['routealias'];logger[_0xb07a('0x78')](_0xb07a('0x79'),_0x5d8063['queue'],_0x5d8063[_0xb07a('0x52')]);Object[_0xb07a('0x65')](_0x5d8063,_[_0xb07a('0x7a')](_0x2db9df,_[_0xb07a('0x7b')](_0x5d8063)));this[_0xb07a('0x3e')][_0x2db9df[_0xb07a('0x47')]][_0xb07a('0x7c')](_0x5d8063);this['channels'][_0x2db9df[_0xb07a('0x47')]]=_0x5d8063;this[_0xb07a('0x44')](_0x5d8063,_0xb07a('0x19'));}}catch(_0x1cd0ae){logger[_0xb07a('0x3b')]('[%s][voiceQueueReport][queuecallerjoin]',_0x2db9df['uniqueid'],util[_0xb07a('0x3d')](_0x1cd0ae,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x3b6b5b){try{if(this[_0xb07a('0x57')](_0x3b6b5b)){logger[_0xb07a('0x45')](_0xb07a('0x7d'),_0x3b6b5b['uniqueid'],util[_0xb07a('0x3d')](_0x3b6b5b,{'showHidden':![],'depth':null}));if(this[_0xb07a('0x3e')][_0x3b6b5b[_0xb07a('0x47')]]){var _0x5cbf01=_[_0xb07a('0x7e')](this[_0xb07a('0x3e')][_0x3b6b5b['uniqueid']]);_0x5cbf01['queuecallercomplete']=![];_0x5cbf01[_0xb07a('0x7f')]=null;_0x5cbf01[_0xb07a('0x80')]=_0x3b6b5b[_0xb07a('0x80')];_0x5cbf01[_0xb07a('0x81')]=_0x3b6b5b[_0xb07a('0x81')];_0x5cbf01[_0xb07a('0x34')]=!![];_0x5cbf01[_0xb07a('0x82')]=moment()['format'](_0xb07a('0x74'));_0x5cbf01[_0xb07a('0x4e')]=_0xb07a('0x83');_0x5cbf01[_0xb07a('0x84')]=null;logger['info'](_0xb07a('0x85'),_0x5cbf01[_0xb07a('0x4f')],_0x5cbf01['type']);this['channels'][_0x3b6b5b[_0xb07a('0x47')]]=_0x5cbf01;this[_0xb07a('0x4c')](_0x5cbf01,_0xb07a('0x34'));}}}catch(_0x3f72a4){logger['error'](_0xb07a('0x7d'),_0x3b6b5b[_0xb07a('0x47')],util[_0xb07a('0x3d')](_0x3f72a4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x34704a){try{if(this[_0xb07a('0x57')](_0x34704a)){logger[_0xb07a('0x45')]('[%s][voiceQueueReport][queuecallerleave]',_0x34704a[_0xb07a('0x47')],util['inspect'](_0x34704a,{'showHidden':![],'depth':null}));if(this[_0xb07a('0x3e')][_0x34704a[_0xb07a('0x47')]]){var _0x18c79a=_[_0xb07a('0x7e')](this[_0xb07a('0x3e')][_0x34704a[_0xb07a('0x47')]]);_0x18c79a[_0xb07a('0x86')]=moment()['format'](_0xb07a('0x74'));_0x18c79a[_0xb07a('0x87')]=_0x34704a[_0xb07a('0x87')];_0x18c79a[_0xb07a('0x88')]=_0x34704a[_0xb07a('0x88')];logger[_0xb07a('0x78')](_0xb07a('0x89'),_0x18c79a[_0xb07a('0x4f')],_0x18c79a[_0xb07a('0x52')],_0x34704a[_0xb07a('0x87')],_0x34704a[_0xb07a('0x88')]);this[_0xb07a('0xd')][_0x34704a[_0xb07a('0x47')]]=_0x18c79a;this[_0xb07a('0x44')](_0x18c79a,'queuecallerleave');}}}catch(_0x28e005){logger[_0xb07a('0x3b')]('[%s][voiceQueueReport][queuecallerleave]',_0x34704a[_0xb07a('0x47')],util[_0xb07a('0x3d')](_0x28e005,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xb07a('0x21')]=function(_0x47ff09){try{if(this[_0xb07a('0x57')](_0x47ff09)){logger[_0xb07a('0x45')](_0xb07a('0x8a'),_0x47ff09['uniqueid'],util[_0xb07a('0x3d')](_0x47ff09,{'showHidden':![],'depth':null}));if(this[_0xb07a('0x3e')][_0x47ff09[_0xb07a('0x47')]]){var _0x184fff=_[_0xb07a('0x7e')](this[_0xb07a('0x3e')][_0x47ff09['uniqueid']]);_0x184fff['queuecallercomplete']=!![];_0x184fff[_0xb07a('0x4e')]=_0xb07a('0x8b');logger[_0xb07a('0x78')](_0xb07a('0x8c'),_0x184fff[_0xb07a('0x4f')],_0x184fff[_0xb07a('0x52')]);}}}catch(_0x1e403a){logger[_0xb07a('0x3b')](_0xb07a('0x8a'),_0x47ff09[_0xb07a('0x47')],util[_0xb07a('0x3d')](_0x1e403a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x29d80a){try{if(this[_0xb07a('0x57')](_0x29d80a)){logger[_0xb07a('0x45')]('[%s][voiceQueueReport][agentcomplete]',_0x29d80a['uniqueid'],util[_0xb07a('0x3d')](_0x29d80a,{'showHidden':![],'depth':null}));if(this[_0xb07a('0x3e')][_0x29d80a[_0xb07a('0x47')]]){var _0x19e17d=_[_0xb07a('0x7e')](this[_0xb07a('0x3e')][_0x29d80a[_0xb07a('0x47')]]);_0x19e17d['queuecallerabandon']=![];_0x19e17d[_0xb07a('0x82')]=null;_0x19e17d['assigned']=!![];_0x19e17d['lastAssignedTo']=_0x29d80a[_0xb07a('0x8d')];_0x19e17d['holdtime']=_0x29d80a[_0xb07a('0x80')];_0x19e17d[_0xb07a('0x8e')]=!![];_0x19e17d['queuecallerexit']=![];_0x19e17d[_0xb07a('0x8f')]=null;if(!_0x19e17d['transfer']){if(_0x29d80a[_0xb07a('0x90')]=='transfer'){_0x19e17d[_0xb07a('0x4e')]=_0xb07a('0x91');logger['info'](_0xb07a('0x92'),_0x19e17d['queue'],_0x19e17d[_0xb07a('0x52')]);}else{if(_[_0xb07a('0x93')](_0x29d80a['channel'][_0xb07a('0x94')](),_0xb07a('0x95'))){if(this[_0xb07a('0x3e')][_0x29d80a[_0xb07a('0x96')]]){var _0x4f57cf=_['last'](this[_0xb07a('0x3e')][_0x29d80a[_0xb07a('0x96')]]);_0x4f57cf[_0xb07a('0x8e')]=![];_0x4f57cf[_0xb07a('0x33')]=!![];_0x4f57cf[_0xb07a('0x8f')]=moment(_0x19e17d['queuecallerjoinAt'])['add'](_0x29d80a[_0xb07a('0x80')],_0xb07a('0x97'))[_0xb07a('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f57cf[_0xb07a('0x4e')]='FORWARDTRANSFER';_0x4f57cf[_0xb07a('0x98')]=!![];_0x4f57cf[_0xb07a('0x99')]=_0xb07a('0x9a');_0x4f57cf['transferexten']=_0x29d80a[_0xb07a('0x9b')];_0x4f57cf[_0xb07a('0x9c')]=_0x29d80a[_0xb07a('0x47')];logger[_0xb07a('0x78')](_0xb07a('0x9d'),_0x4f57cf[_0xb07a('0x4f')],_0x4f57cf[_0xb07a('0x52')]);var _0x40e4ff=this['queueReports'][_0x29d80a['linkedid']];this[_0xb07a('0x3e')][_0x29d80a[_0xb07a('0x96')]]=this['queueReports'][_0x29d80a[_0xb07a('0x47')]];this[_0xb07a('0x3e')][_0x29d80a[_0xb07a('0x47')]]=_0x40e4ff;}}else{_0x19e17d[_0xb07a('0x4e')]=_0xb07a('0x9e')+_0x29d80a['reason'][_0xb07a('0x9f')]();logger[_0xb07a('0x78')](_0xb07a('0xa0'),_0x19e17d[_0xb07a('0x4f')],_0x19e17d[_0xb07a('0x52')],_0x19e17d['queuecallerexitreason']);}}}this[_0xb07a('0xd')][_0x29d80a[_0xb07a('0x47')]]=_0x19e17d;}}}catch(_0x59d5d9){logger[_0xb07a('0x3b')](_0xb07a('0xa1'),_0x29d80a['uniqueid'],util['inspect'](_0x59d5d9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb07a('0x35')][_0xb07a('0x22')]=function(_0x4a7ed4){try{if(this['isNotNull'](_0x4a7ed4)){logger['debug'](_0xb07a('0xa2'),_0x4a7ed4['uniqueid'],util['inspect'](_0x4a7ed4,{'showHidden':![],'depth':null}));this['addVariable'](_0x4a7ed4['uniqueid'],_[_0xb07a('0x7b')](_0x4a7ed4[_0xb07a('0xa3')])[0x0],_0x4a7ed4[_0xb07a('0xa4')]);if(this[_0xb07a('0x3e')][_0x4a7ed4[_0xb07a('0x47')]]){var _0x19a73f=_['last'](this['queueReports'][_0x4a7ed4[_0xb07a('0x47')]]);if(_0x19a73f){if(this['isNotNull'](_0x4a7ed4['variable'])&&this[_0xb07a('0x57')](_0x4a7ed4['variable'][_0xb07a('0x5f')])){switch(_0x4a7ed4[_0xb07a('0xa4')]){case _0xb07a('0xa5'):_0x19a73f[_0xb07a('0x33')]=![];_0x19a73f['queuecallerexitAt']=null;break;case _0xb07a('0xa6'):_0x19a73f['lastevent']=_0xb07a('0xa7');_0x19a73f[_0xb07a('0x33')]=!![];_0x19a73f[_0xb07a('0x8f')]=moment()[_0xb07a('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x19a73f[_0xb07a('0x86')]=moment()['format'](_0xb07a('0x74'));logger[_0xb07a('0x45')](_0xb07a('0xa8'),_0x4a7ed4[_0xb07a('0x47')],util['inspect'](_0x19a73f,{'showHidden':![],'depth':null}));ami[_0xb07a('0x43')](_0xb07a('0xa9'),_0x19a73f);break;default:_0x19a73f[_0xb07a('0x33')]=!![];_0x19a73f[_0xb07a('0x8f')]=moment()['format'](_0xb07a('0x74'));_0x19a73f['queuecallerleaveAt']=moment()[_0xb07a('0x48')](_0xb07a('0x74'));}_0x19a73f[_0xb07a('0x34')]=![];_0x19a73f[_0xb07a('0x82')]=null;_0x19a73f[_0xb07a('0x4e')]=_0x4a7ed4[_0xb07a('0xa4')];this[_0xb07a('0xd')][_0x4a7ed4[_0xb07a('0x47')]]=_0x19a73f;this[_0xb07a('0x4c')](_0x19a73f,_0xb07a('0xaa'));}else if(this[_0xb07a('0x57')](_0x4a7ed4[_0xb07a('0xa3')])&&this[_0xb07a('0x57')](_0x4a7ed4[_0xb07a('0xa3')][_0xb07a('0xab')])){if(!_0x19a73f['queuecallerabandon']){_0x19a73f[_0xb07a('0x33')]=!![];_0x19a73f['queuecallerexitAt']=moment()[_0xb07a('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x19a73f[_0xb07a('0x4e')]=_0xb07a('0xac');_0x19a73f['queuecallerleaveAt']=moment()[_0xb07a('0x48')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb07a('0xd')][_0x4a7ed4['uniqueid']]=_0x19a73f;}}logger[_0xb07a('0x78')](_0xb07a('0xad'),_0x4a7ed4[_0xb07a('0x47')],_0x19a73f[_0xb07a('0x4f')],_0x19a73f[_0xb07a('0x52')],_[_0xb07a('0x7b')](_0x4a7ed4[_0xb07a('0xa3')])[0x0],_0x4a7ed4['value']);_0x19a73f['variables']=this[_0xb07a('0x11')][_0x4a7ed4[_0xb07a('0x47')]];}}}}catch(_0x248c19){logger[_0xb07a('0x3b')](_0xb07a('0xa2'),_0x4a7ed4['uniqueid'],util[_0xb07a('0x3d')](_0x248c19,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb07a('0x35')][_0xb07a('0xae')]=function(_0x4fdec6,_0x58fa75,_0x1c375a){var _0x4deb44=[_0xb07a('0xaf'),_0xb07a('0xb0'),_0xb07a('0xb1'),_0xb07a('0xb2'),_0xb07a('0xb3'),_0xb07a('0xb4'),'rtpaudioqosrtt',_0xb07a('0xb5'),_0xb07a('0xb6'),_0xb07a('0xb7'),_0xb07a('0xb8'),'bridgepvtcallid',_0xb07a('0xb9'),_0xb07a('0xba'),_0xb07a('0xbb'),'memberlastcall',_0xb07a('0x8d'),_0xb07a('0xbc'),_0xb07a('0xbd')];if(!_[_0xb07a('0xbe')](_0x58fa75)&&!_[_0xb07a('0xbf')](_0x4deb44,_0x58fa75)){if(_[_0xb07a('0x72')](this['variables'][_0x4fdec6])){this[_0xb07a('0x11')][_0x4fdec6]={};}this[_0xb07a('0x11')][_0x4fdec6][_0x58fa75]=_0x1c375a;}};VoiceQueueReport['prototype'][_0xb07a('0xc0')]=function(_0x3b6929,_0x314e4d,_0x7357fc){try{var _0x5544b5={};if(this[_0xb07a('0x3e')][_0x3b6929]){for(var _0x3cbaba=0x0;_0x3cbaba0x0?!![]:![];if(!_0x3d1646){return this['syncQueueSummaryComplete'](this[_0x461d('0x15')]['completeEvent']);}};VoiceQueueReport['prototype'][_0x461d('0x1c')]=function(_0x346938){var _0x2a3b61=this[_0x461d('0x15')]['id'];if(this[_0x461d('0x15')][_0x461d('0x69')][_0x2a3b61]&&this[_0x461d('0x15')][_0x461d('0x69')][_0x2a3b61][_0x346938['actionid']]){this[_0x461d('0x15')][_0x461d('0x69')][_0x2a3b61][_0x346938[_0x461d('0x67')]]['agents']['push'](_0x346938);}};VoiceQueueReport[_0x461d('0xb')][_0x461d('0x18')]=function(_0x38ad10){var _0x496817=this;try{if(this['isNotNull'](_0x38ad10)&&this[_0x461d('0x71')](_0x38ad10['queue'])){logger[_0x461d('0x4f')](_0x461d('0x72'),util[_0x461d('0x46')](_0x38ad10,{'showHidden':![],'depth':null}));var _0x13f791=this[_0x461d('0x13')][_0x38ad10[_0x461d('0x53')]];if(_0x13f791){logger[_0x461d('0x4f')](_0x461d('0x73'),_0x13f791[_0x461d('0x61')]);this[_0x461d('0x15')]['queues'][_0x13f791[_0x461d('0x61')]]={'summaryEvent':_0x38ad10};this[_0x461d('0x15')][_0x461d('0x70')]+=0x1;return ami[_0x461d('0x41')]({'action':'queuestatus','queue':_0x13f791[_0x461d('0x61')]})['then'](function(_0x1307a2){if(!_0x496817[_0x461d('0x15')][_0x461d('0x69')][_0x38ad10['actionid']]){_0x496817[_0x461d('0x15')]['queuestatus'][_0x38ad10[_0x461d('0x67')]]={};}_0x496817[_0x461d('0x15')][_0x461d('0x69')][_0x38ad10['actionid']][_0x1307a2[_0x461d('0x67')]]={'queue':_0x13f791['name'],'agents':[]};})[_0x461d('0x43')](function(_0x83edc0){throw _0x83edc0;});}}}catch(_0x2673e9){logger[_0x461d('0x47')](_0x461d('0x6a'),util['inspect'](_0x2673e9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x461d('0xb')][_0x461d('0x1a')]=function(_0x1cd7fa){if(this[_0x461d('0x15')][_0x461d('0x70')]>0x0){this[_0x461d('0x15')][_0x461d('0x74')]=_0x1cd7fa;return;}logger[_0x461d('0x4f')](_0x461d('0x75'),util[_0x461d('0x46')](_0x1cd7fa,{'showHidden':![],'depth':null}));this[_0x461d('0x15')]=initializeSummary();ami[_0x461d('0x4d')](_0x461d('0x76'),{});};VoiceQueueReport[_0x461d('0xb')][_0x461d('0x77')]=function(_0x309f91){try{if(this[_0x461d('0x71')](_0x309f91)){logger[_0x461d('0x4f')](_0x461d('0x78'),_0x309f91[_0x461d('0x51')],util['inspect'](_0x309f91,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x461d('0xf')][_0x309f91[_0x461d('0x51')]])){this[_0x461d('0xf')][_0x309f91[_0x461d('0x51')]]=[];}if(_['isUndefined'](this['channels'][_0x309f91[_0x461d('0x51')]])){this[_0x461d('0x11')][_0x309f91[_0x461d('0x51')]]={};}var _0x30abab=new QueueReport();_0x30abab['queue']=_0x309f91[_0x461d('0x53')];_0x30abab[_0x461d('0x5e')]=this[_0x461d('0x13')][_0x30abab[_0x461d('0x53')]]&&this[_0x461d('0x13')][_0x30abab[_0x461d('0x53')]]['type']?this[_0x461d('0x13')][_0x30abab[_0x461d('0x53')]][_0x461d('0x5e')]||_0x461d('0x5f'):_0x461d('0x5f');_0x30abab[_0x461d('0x79')]=moment()[_0x461d('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x30abab[_0x461d('0x7a')]=_0x309f91[_0x461d('0x7a')];_0x30abab[_0x461d('0x7b')]=_0x309f91[_0x461d('0x7b')];_0x30abab[_0x461d('0x51')]=_0x309f91[_0x461d('0x51')];_0x30abab['routealias']=this[_0x461d('0x11')][_0x309f91[_0x461d('0x51')]][_0x461d('0x7c')];logger[_0x461d('0x7d')](_0x461d('0x7e'),_0x30abab[_0x461d('0x53')],_0x30abab['type']);Object['assign'](_0x30abab,_['pick'](_0x309f91,_[_0x461d('0x7f')](_0x30abab)));this[_0x461d('0xf')][_0x309f91[_0x461d('0x51')]][_0x461d('0x80')](_0x30abab);this[_0x461d('0x11')][_0x309f91[_0x461d('0x51')]]=_0x30abab;this[_0x461d('0x4e')](_0x30abab,_0x461d('0x81'));}}catch(_0x5e4f09){logger[_0x461d('0x47')](_0x461d('0x78'),_0x309f91[_0x461d('0x51')],util['inspect'](_0x5e4f09,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x461d('0xb')][_0x461d('0x20')]=function(_0x1b6e26){try{if(this[_0x461d('0x71')](_0x1b6e26)){logger[_0x461d('0x4f')](_0x461d('0x82'),_0x1b6e26[_0x461d('0x51')],util[_0x461d('0x46')](_0x1b6e26,{'showHidden':![],'depth':null}));if(this[_0x461d('0xf')][_0x1b6e26[_0x461d('0x51')]]){var _0x4b9d94=_[_0x461d('0x83')](this[_0x461d('0xf')][_0x1b6e26[_0x461d('0x51')]]);_0x4b9d94[_0x461d('0x3d')]=![];_0x4b9d94[_0x461d('0x84')]=null;_0x4b9d94[_0x461d('0x85')]=_0x1b6e26[_0x461d('0x85')];_0x4b9d94[_0x461d('0x86')]=_0x1b6e26['originalposition'];_0x4b9d94['queuecallerabandon']=!![];_0x4b9d94['queuecallerabandonAt']=moment()['format'](_0x461d('0x87'));_0x4b9d94[_0x461d('0x58')]=_0x461d('0x88');_0x4b9d94[_0x461d('0x89')]=null;logger[_0x461d('0x7d')](_0x461d('0x8a'),_0x4b9d94['queue'],_0x4b9d94[_0x461d('0x5e')]);this[_0x461d('0x11')][_0x1b6e26[_0x461d('0x51')]]=_0x4b9d94;this[_0x461d('0x56')](_0x4b9d94,_0x461d('0x1f'));}}}catch(_0x35934b){logger[_0x461d('0x47')](_0x461d('0x82'),_0x1b6e26[_0x461d('0x51')],util[_0x461d('0x46')](_0x35934b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x461d('0x22')]=function(_0x5018a7){try{if(this[_0x461d('0x71')](_0x5018a7)){logger['debug'](_0x461d('0x8b'),_0x5018a7['uniqueid'],util['inspect'](_0x5018a7,{'showHidden':![],'depth':null}));if(this[_0x461d('0xf')][_0x5018a7['uniqueid']]){var _0x2bd7b2=_[_0x461d('0x83')](this[_0x461d('0xf')][_0x5018a7['uniqueid']]);_0x2bd7b2['queuecallerleaveAt']=moment()[_0x461d('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x2bd7b2['connectedlinenum']=_0x5018a7[_0x461d('0x8c')];_0x2bd7b2[_0x461d('0x8d')]=_0x5018a7[_0x461d('0x8d')];logger[_0x461d('0x7d')](_0x461d('0x8e'),_0x2bd7b2['queue'],_0x2bd7b2[_0x461d('0x5e')],_0x5018a7[_0x461d('0x8c')],_0x5018a7[_0x461d('0x8d')]);this['channels'][_0x5018a7[_0x461d('0x51')]]=_0x2bd7b2;this[_0x461d('0x4e')](_0x2bd7b2,_0x461d('0x21'));}}}catch(_0x35f0b2){logger[_0x461d('0x47')]('[%s][voiceQueueReport][queuecallerleave]',_0x5018a7['uniqueid'],util[_0x461d('0x46')](_0x35f0b2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x461d('0xb')]['syncAgentConnect']=function(_0x537cf7){try{if(this[_0x461d('0x71')](_0x537cf7)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x537cf7[_0x461d('0x51')],util['inspect'](_0x537cf7,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x537cf7[_0x461d('0x51')]]){var _0xbe5ef=_[_0x461d('0x83')](this[_0x461d('0xf')][_0x537cf7[_0x461d('0x51')]]);_0xbe5ef[_0x461d('0x3d')]=!![];_0xbe5ef[_0x461d('0x58')]=_0x461d('0x8f');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0xbe5ef[_0x461d('0x53')],_0xbe5ef[_0x461d('0x5e')]);}}}catch(_0x36b4b8){logger[_0x461d('0x47')](_0x461d('0x90'),_0x537cf7[_0x461d('0x51')],util['inspect'](_0x36b4b8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0xc02a){try{if(this[_0x461d('0x71')](_0xc02a)){logger[_0x461d('0x4f')]('[%s][voiceQueueReport][agentcomplete]',_0xc02a[_0x461d('0x51')],util[_0x461d('0x46')](_0xc02a,{'showHidden':![],'depth':null}));if(this[_0x461d('0xf')][_0xc02a['uniqueid']]){var _0xdf1332=_[_0x461d('0x83')](this[_0x461d('0xf')][_0xc02a[_0x461d('0x51')]]);_0xdf1332[_0x461d('0x1f')]=![];_0xdf1332[_0x461d('0x91')]=null;_0xdf1332['assigned']=!![];_0xdf1332[_0x461d('0x89')]=_0xc02a['membername'];_0xdf1332[_0x461d('0x85')]=_0xc02a[_0x461d('0x85')];_0xdf1332['queuecallercomplete']=!![];_0xdf1332[_0x461d('0x92')]=![];_0xdf1332[_0x461d('0x93')]=null;if(!_0xdf1332[_0x461d('0x94')]){if(_0xc02a[_0x461d('0x95')]==_0x461d('0x94')){_0xdf1332[_0x461d('0x58')]='COMPLETED';logger[_0x461d('0x7d')](_0x461d('0x96'),_0xdf1332[_0x461d('0x53')],_0xdf1332[_0x461d('0x5e')]);}else{if(_[_0x461d('0x97')](_0xc02a['channel'][_0x461d('0x98')](),_0x461d('0x99'))){if(this[_0x461d('0xf')][_0xc02a[_0x461d('0x9a')]]){var _0x500640=_[_0x461d('0x83')](this[_0x461d('0xf')][_0xc02a[_0x461d('0x9a')]]);_0x500640['queuecallercomplete']=![];_0x500640[_0x461d('0x92')]=!![];_0x500640[_0x461d('0x93')]=moment(_0xdf1332[_0x461d('0x79')])[_0x461d('0x9b')](_0xc02a[_0x461d('0x85')],'seconds')[_0x461d('0x52')](_0x461d('0x87'));_0x500640[_0x461d('0x58')]=_0x461d('0x9c');_0x500640[_0x461d('0x94')]=!![];_0x500640['transfertype']='FORWARD';_0x500640[_0x461d('0x9d')]=_0xc02a[_0x461d('0x9e')];_0x500640[_0x461d('0x9f')]=_0xc02a[_0x461d('0x51')];logger[_0x461d('0x7d')](_0x461d('0xa0'),_0x500640[_0x461d('0x53')],_0x500640['type']);var _0x247fae=this[_0x461d('0xf')][_0xc02a[_0x461d('0x9a')]];this[_0x461d('0xf')][_0xc02a[_0x461d('0x9a')]]=this['queueReports'][_0xc02a[_0x461d('0x51')]];this['queueReports'][_0xc02a[_0x461d('0x51')]]=_0x247fae;}}else{_0xdf1332['queuecallerexitreason']=_0x461d('0xa1')+_0xc02a[_0x461d('0x95')][_0x461d('0xa2')]();logger['info'](_0x461d('0xa3'),_0xdf1332[_0x461d('0x53')],_0xdf1332['type'],_0xdf1332[_0x461d('0x58')]);}}}this['channels'][_0xc02a[_0x461d('0x51')]]=_0xdf1332;}}}catch(_0x5ddc25){logger[_0x461d('0x47')]('[%s][voiceQueueReport][agentcomplete]',_0xc02a['uniqueid'],util[_0x461d('0x46')](_0x5ddc25,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x461d('0x28')]=function(_0x2f4c49){try{if(this['isNotNull'](_0x2f4c49)){logger['debug'](_0x461d('0xa4'),_0x2f4c49[_0x461d('0x51')],util[_0x461d('0x46')](_0x2f4c49,{'showHidden':![],'depth':null}));this[_0x461d('0xa5')](_0x2f4c49[_0x461d('0x51')],_['keys'](_0x2f4c49['variable'])[0x0],_0x2f4c49[_0x461d('0xa6')]);if(this[_0x461d('0xf')][_0x2f4c49['uniqueid']]){var _0x105b31=_[_0x461d('0x83')](this[_0x461d('0xf')][_0x2f4c49['uniqueid']]);if(_0x105b31){if(this[_0x461d('0x71')](_0x2f4c49['variable'])&&this[_0x461d('0x71')](_0x2f4c49[_0x461d('0xa7')][_0x461d('0x69')])){switch(_0x2f4c49['value']){case _0x461d('0xa8'):_0x105b31[_0x461d('0x92')]=![];_0x105b31[_0x461d('0x93')]=null;break;case'TIMEOUT':_0x105b31[_0x461d('0xa9')]=_0x461d('0xaa');_0x105b31[_0x461d('0x92')]=!![];_0x105b31[_0x461d('0x93')]=moment()[_0x461d('0x52')](_0x461d('0x87'));_0x105b31[_0x461d('0xab')]=moment()[_0x461d('0x52')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x461d('0x4f')](_0x461d('0xac'),_0x2f4c49[_0x461d('0x51')],util[_0x461d('0x46')](_0x105b31,{'showHidden':![],'depth':null}));ami[_0x461d('0x4d')](_0x461d('0xad'),_0x105b31);break;default:_0x105b31[_0x461d('0x92')]=!![];_0x105b31['queuecallerexitAt']=moment()[_0x461d('0x52')](_0x461d('0x87'));_0x105b31[_0x461d('0xab')]=moment()[_0x461d('0x52')](_0x461d('0x87'));}_0x105b31[_0x461d('0x1f')]=![];_0x105b31[_0x461d('0x91')]=null;_0x105b31[_0x461d('0x58')]=_0x2f4c49[_0x461d('0xa6')];this[_0x461d('0x11')][_0x2f4c49[_0x461d('0x51')]]=_0x105b31;this[_0x461d('0x56')](_0x105b31,_0x461d('0x27'));}else if(this[_0x461d('0x71')](_0x2f4c49[_0x461d('0xa7')])&&this[_0x461d('0x71')](_0x2f4c49['variable'][_0x461d('0xae')])){if(!_0x105b31[_0x461d('0x1f')]){_0x105b31['queuecallerexit']=!![];_0x105b31[_0x461d('0x93')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x105b31[_0x461d('0x58')]=_0x461d('0xaf');_0x105b31['queuecallerleaveAt']=moment()[_0x461d('0x52')](_0x461d('0x87'));this[_0x461d('0x11')][_0x2f4c49['uniqueid']]=_0x105b31;}}logger['info'](_0x461d('0xb0'),_0x2f4c49[_0x461d('0x51')],_0x105b31[_0x461d('0x53')],_0x105b31[_0x461d('0x5e')],_[_0x461d('0x7f')](_0x2f4c49[_0x461d('0xa7')])[0x0],_0x2f4c49[_0x461d('0xa6')]);_0x105b31[_0x461d('0x16')]=this['variables'][_0x2f4c49[_0x461d('0x51')]];}}}}catch(_0x45e617){logger[_0x461d('0x47')](_0x461d('0xa4'),_0x2f4c49[_0x461d('0x51')],util[_0x461d('0x46')](_0x45e617,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x461d('0xb')][_0x461d('0xa5')]=function(_0x2c948b,_0x4865d4,_0x228e57){var _0x124c60=[_0x461d('0xb1'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x461d('0xb2'),'rtpaudioqosloss',_0x461d('0xb3'),'rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid',_0x461d('0xb4'),'bridgepeer',_0x461d('0xb5'),_0x461d('0xb6'),_0x461d('0xb7'),_0x461d('0xb8'),'memberlastcall',_0x461d('0xb9'),_0x461d('0xba'),'memberrealtime'];if(!_[_0x461d('0x40')](_0x4865d4)&&!_[_0x461d('0xbb')](_0x124c60,_0x4865d4)){if(_[_0x461d('0x63')](this[_0x461d('0x16')][_0x2c948b])){this['variables'][_0x2c948b]={};}this[_0x461d('0x16')][_0x2c948b][_0x4865d4]=_0x228e57;}};VoiceQueueReport[_0x461d('0xb')][_0x461d('0xbc')]=function(_0x107f15,_0xf641c4,_0xf500cd){try{var _0x1998a9={};if(this['queueReports'][_0x107f15]){for(var _0x4f87f0=0x0;_0x4f87f0=0x0?moment(_0x52f01e[_0x7391('0x19')])[_0x7391('0xc')](_0x52f01e[_0x7391('0x18')],'seconds'):null,'data1':_0x7391('0x1a'),'data2':_0x52f01e[_0x7391('0x12')],'data3':_0x52f01e[_0x7391('0x10')],'data4':_0x52f01e['dialstring']||null,'role':_0x7391('0x1b'),'internal':_0x52f01e['accountcode']?_[_0x7391('0x13')](_0x52f01e[_0x7391('0x12')]):undefined,'uniqueid':_0x52f01e[_0x7391('0x14')]},'log':_0x7391('0x6')});}; \ No newline at end of file +var _0x0f8e=['starttime','outbound','dialstring','toNumber','moment','util','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','format','SIP/%s','interface','queuecallerleaveAt','diff','seconds','calleridnum','exten','queue','agent','accountcode','uniqueid','voiceDialReport','Request','membername','TALKING','endtime'];(function(_0x34b02a,_0xc897da){var _0x393178=function(_0x465fbf){while(--_0x465fbf){_0x34b02a['push'](_0x34b02a['shift']());}};_0x393178(++_0xc897da);}(_0x0f8e,0xe4));var _0xe0f8=function(_0x472caf,_0x42c3d5){_0x472caf=_0x472caf-0x0;var _0x16cd58=_0x0f8e[_0x472caf];return _0x16cd58;};'use strict';var moment=require(_0xe0f8('0x0'));var _=require('lodash');var util=require(_0xe0f8('0x1'));var client=require('../client');exports['voiceQueueReport']=function(_0x19dcec){var _0x319b6b=_0x19dcec[_0xe0f8('0x2')]||_0x19dcec[_0xe0f8('0x3')];return client['Request'](_0xe0f8('0x4'),{'body':{'channel':_0xe0f8('0x5'),'membername':_0x19dcec[_0xe0f8('0x6')],'interface':_['isNil'](_0x19dcec['interface'])?util[_0xe0f8('0x7')](_0xe0f8('0x8'),_0x19dcec[_0xe0f8('0x6')]):_0x19dcec[_0xe0f8('0x9')],'type':'TALKING','enterAt':_0x19dcec[_0xe0f8('0xa')],'exitAt':_0x319b6b,'duration':moment(_0x319b6b)[_0xe0f8('0xb')](_0x19dcec[_0xe0f8('0xa')],_0xe0f8('0xc')),'data1':'inbound','data2':_0x19dcec[_0xe0f8('0xd')],'data3':_0x19dcec[_0xe0f8('0xe')],'data4':null,'data5':_0x19dcec[_0xe0f8('0xf')],'role':_0xe0f8('0x10'),'internal':_0x19dcec['accountcode']?_['toNumber'](_0x19dcec[_0xe0f8('0x11')]):undefined,'uniqueid':_0x19dcec[_0xe0f8('0x12')]},'log':_0xe0f8('0x4')});};exports[_0xe0f8('0x13')]=function(_0x3fdad1){return client[_0xe0f8('0x14')](_0xe0f8('0x4'),{'body':{'channel':_0xe0f8('0x5'),'membername':_0x3fdad1[_0xe0f8('0x15')],'interface':_0x3fdad1[_0xe0f8('0x9')],'type':_0xe0f8('0x16'),'enterAt':_0x3fdad1['starttime'],'exitAt':_0x3fdad1[_0xe0f8('0x17')],'duration':moment(_0x3fdad1[_0xe0f8('0x17')])['diff'](_0x3fdad1[_0xe0f8('0x18')],_0xe0f8('0xc'))>=0x0?moment(_0x3fdad1['endtime'])[_0xe0f8('0xb')](_0x3fdad1[_0xe0f8('0x18')],_0xe0f8('0xc')):null,'data1':_0xe0f8('0x19'),'data2':_0x3fdad1[_0xe0f8('0x11')],'data3':_0x3fdad1[_0xe0f8('0xe')],'data4':_0x3fdad1[_0xe0f8('0x1a')]||null,'role':_0xe0f8('0x10'),'internal':_0x3fdad1[_0xe0f8('0x11')]?_[_0xe0f8('0x1b')](_0x3fdad1[_0xe0f8('0x11')]):undefined,'uniqueid':_0x3fdad1['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 0c7cc10..a1409dc 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 _0x8c8c=['getSettings','Request','ShowSetting','previewRecallmeReminderInterval','../client'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x8c8c,0x185));var _0xc8c8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8c8c[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xc8c8('0x0'));exports[_0xc8c8('0x1')]=function(){return client[_0xc8c8('0x2')](_0xc8c8('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0xc8c8('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x2b65=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0x2b65,0x131));var _0x52b6=function(_0x5ed024,_0x20fcac){_0x5ed024=_0x5ed024-0x0;var _0x529b32=_0x2b65[_0x5ed024];return _0x529b32;};'use strict';var client=require(_0x52b6('0x0'));exports[_0x52b6('0x1')]=function(){return client[_0x52b6('0x2')](_0x52b6('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x52b6('0x4'),_0x52b6('0x5')]},'log':_0x52b6('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 803f80d..fac3fa8 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 _0xe1e0=['GetTemplate','html','../client','Request'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xe1e0,0x1b2));var _0x0e1e=function(_0x29cc78,_0x161353){_0x29cc78=_0x29cc78-0x0;var _0x2cf121=_0xe1e0[_0x29cc78];return _0x2cf121;};'use strict';var client=require(_0x0e1e('0x0'));exports['getTemplates']=function(_0x2b1e4f){return function(_0x59cad5){return client[_0x0e1e('0x1')](_0x0e1e('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x0e1e('0x3')]},'log':_0x0e1e('0x2')});};}; \ No newline at end of file +var _0xbb80=['GetTemplate','name','../client'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xbb80,0x8c));var _0x0bb8=function(_0x358e3b,_0x72233f){_0x358e3b=_0x358e3b-0x0;var _0x4906c0=_0xbb80[_0x358e3b];return _0x4906c0;};'use strict';var client=require(_0x0bb8('0x0'));exports['getTemplates']=function(_0x44256d){return function(_0x10d5ff){return client['Request'](_0x0bb8('0x1'),{'options':{'raw':!![],'attributes':['id',_0x0bb8('0x2'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 0e7961c..c73dc77 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 _0x9d6b=['name','channel','status','field','operator','value','Condition','AnyConditions','Action','Actions','action','data1','data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger'];(function(_0x49b72e,_0x4db0de){var _0x30a4d8=function(_0x559a52){while(--_0x559a52){_0x49b72e['push'](_0x49b72e['shift']());}};_0x30a4d8(++_0x4db0de);}(_0x9d6b,0x161));var _0xb9d6=function(_0xf0592b,_0x32760e){_0xf0592b=_0xf0592b-0x0;var _0x492fb2=_0x9d6b[_0xf0592b];return _0x492fb2;};'use strict';var client=require(_0xb9d6('0x0'));exports[_0xb9d6('0x1')]=function(_0x364c56){return function(_0x4bf21f){return client[_0xb9d6('0x2')](_0xb9d6('0x3'),{'options':{'raw':![],'attributes':['id',_0xb9d6('0x4'),_0xb9d6('0x5'),_0xb9d6('0x6')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0xb9d6('0x7'),_0xb9d6('0x8'),_0xb9d6('0x9')]},{'model':_0xb9d6('0xa'),'as':_0xb9d6('0xb'),'attributes':['id',_0xb9d6('0x7'),_0xb9d6('0x8'),'value']},{'model':_0xb9d6('0xc'),'as':_0xb9d6('0xd'),'attributes':['id',_0xb9d6('0xe'),_0xb9d6('0xf'),'data2',_0xb9d6('0x10'),_0xb9d6('0x11'),_0xb9d6('0x12'),_0xb9d6('0x13'),_0xb9d6('0x14')]}]},'log':_0xb9d6('0x3')});};}; \ No newline at end of file +var _0x5914=['field','operator','value','Action','Actions','action','data1','data3','data4','data5','data6','data7','../client','getTriggers','Request','name','channel','status','Condition','AllConditions','AnyConditions'];(function(_0x1d4c33,_0x30274f){var _0x3abfa2=function(_0x15d1ea){while(--_0x15d1ea){_0x1d4c33['push'](_0x1d4c33['shift']());}};_0x3abfa2(++_0x30274f);}(_0x5914,0x147));var _0x4591=function(_0x3d4f58,_0x5a2bc9){_0x3d4f58=_0x3d4f58-0x0;var _0x52361d=_0x5914[_0x3d4f58];return _0x52361d;};'use strict';var client=require(_0x4591('0x0'));exports[_0x4591('0x1')]=function(_0x26f3ef){return function(_0x539719){return client[_0x4591('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x4591('0x3'),_0x4591('0x4'),_0x4591('0x5')],'include':[{'model':_0x4591('0x6'),'as':_0x4591('0x7'),'attributes':['id','field','operator','value']},{'model':'Condition','as':_0x4591('0x8'),'attributes':['id',_0x4591('0x9'),_0x4591('0xa'),_0x4591('0xb')]},{'model':_0x4591('0xc'),'as':_0x4591('0xd'),'attributes':['id',_0x4591('0xe'),_0x4591('0xf'),'data2',_0x4591('0x10'),_0x4591('0x11'),_0x4591('0x12'),_0x4591('0x13'),_0x4591('0x14')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index ec0cd99..3875bd9 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 _0xa0e7=['GetTrunk','defaultuser','../client','getTrunks'];(function(_0x14d452,_0x25fa91){var _0x1a07dc=function(_0x388f1f){while(--_0x388f1f){_0x14d452['push'](_0x14d452['shift']());}};_0x1a07dc(++_0x25fa91);}(_0xa0e7,0xaa));var _0x7a0e=function(_0x13de97,_0x59c9df){_0x13de97=_0x13de97-0x0;var _0x4dbe99=_0xa0e7[_0x13de97];return _0x4dbe99;};'use strict';var client=require(_0x7a0e('0x0'));exports[_0x7a0e('0x1')]=function(_0x5eab55){return function(_0x114c23){return client['Request'](_0x7a0e('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0x7a0e('0x3')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x24ca=['../client','Request','name','registry','defaultuser','GetTrunk'];(function(_0x490f79,_0x38fa7b){var _0x10f42e=function(_0x537265){while(--_0x537265){_0x490f79['push'](_0x490f79['shift']());}};_0x10f42e(++_0x38fa7b);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0x24ca[_0x3a04ab];return _0x4bff6d;};'use strict';var client=require(_0xa24c('0x0'));exports['getTrunks']=function(_0x2cf7df){return function(_0x4ebab4){return client[_0xa24c('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa24c('0x2'),_0xa24c('0x3'),_0xa24c('0x4')]},'log':_0xa24c('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 303f06f..99f78c4 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x4c4178,_0x4fab21){var _0x160868=function(_0x598a56){while(--_0x598a56){_0x4c4178['push'](_0x4c4178['shift']());}};_0x160868(++_0x4fab21);}(_0x34e8,0x12c));var _0x834e=function(_0x1aff92,_0x92a0c0){_0x1aff92=_0x1aff92-0x0;var _0x27efca=_0x34e8[_0x1aff92];return _0x27efca;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file +var _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x38b8c2,_0x510106){var _0x1c271a=function(_0x27762b){while(--_0x27762b){_0x38b8c2['push'](_0x38b8c2['shift']());}};_0x1c271a(++_0x510106);}(_0x34e8,0x12c));var _0x834e=function(_0x2f970f,_0x2d6303){_0x2f970f=_0x2f970f-0x0;var _0x200992=_0x34e8[_0x2f970f];return _0x200992;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 32bf5ad..15afdf2 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 _0x85db=['create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x299143,_0xe7c526){var _0xea4d22=function(_0x3e8161){while(--_0x3e8161){_0x299143['push'](_0x299143['shift']());}};_0xea4d22(++_0xe7c526);}(_0x85db,0xac));var _0xb85d=function(_0x33dcf7,_0x3d5390){_0x33dcf7=_0x33dcf7-0x0;var _0x542d4e=_0x85db[_0x33dcf7];return _0x542d4e;};'use strict';var client=require('../client');exports[_0xb85d('0x0')]=function(_0x20317f){return client[_0xb85d('0x1')](_0xb85d('0x2'),{'body':_0x20317f,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x21f919,_0x2e84ab,_0x556659){return client[_0xb85d('0x1')](_0xb85d('0x3'),{'body':_0x21f919,'options':{'where':{'uniqueid':_0x2e84ab,'interface':_0x556659,'agentcomplete':!![]}},'log':_0xb85d('0x3')});}; \ No newline at end of file +var _0xe176=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x501480,_0x37ddb6){var _0x2b39f2=function(_0x14e115){while(--_0x14e115){_0x501480['push'](_0x501480['shift']());}};_0x2b39f2(++_0x37ddb6);}(_0xe176,0x13d));var _0x6e17=function(_0x5efdc0,_0x2f7a64){_0x5efdc0=_0x5efdc0-0x0;var _0x377ab5=_0xe176[_0x5efdc0];return _0x377ab5;};'use strict';var client=require(_0x6e17('0x0'));exports[_0x6e17('0x1')]=function(_0x3cc812){return client[_0x6e17('0x2')](_0x6e17('0x3'),{'body':_0x3cc812,'log':_0x6e17('0x3')});};exports[_0x6e17('0x4')]=function(_0x2f96c0,_0x168df9,_0x513ce1){return client[_0x6e17('0x2')](_0x6e17('0x5'),{'body':_0x2f96c0,'options':{'where':{'uniqueid':_0x168df9,'interface':_0x513ce1,'agentcomplete':!![]}},'log':_0x6e17('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 3ac58aa..e7fb095 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 _0x7d64=['merge','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','format','YYYY-MM-DD\x20HH:mm:ss','day','type','duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request','CreateVoiceCallReport'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0x7d64,0x176));var _0x47d6=function(_0x517d8e,_0x123ccd){_0x517d8e=_0x517d8e-0x0;var _0x14aee4=_0x7d64[_0x517d8e];return _0x14aee4;};'use strict';var moment=require(_0x47d6('0x0'));var util=require('util');var _=require(_0x47d6('0x1'));var client=require(_0x47d6('0x2'));exports[_0x47d6('0x3')]=function(_0x634803){return client[_0x47d6('0x4')](_0x47d6('0x5'),{'body':_[_0x47d6('0x6')](_0x634803,{'source':_0x634803[_0x47d6('0x7')],'destinationcontext':_0x634803[_0x47d6('0x8')],'callerid':_0x634803[_0x47d6('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0x47d6('0x5')});};exports[_0x47d6('0xa')]=function(){return function(){return client[_0x47d6('0x4')](_0x47d6('0xb'),{'options':{'where':{'type':[_0x47d6('0xc')],'createdAt':{'$between':[moment()['startOf']('day')[_0x47d6('0xd')](_0x47d6('0xe')),moment()['endOf'](_0x47d6('0xf'))['format'](_0x47d6('0xe'))]}},'attributes':[_0x47d6('0x10'),'disposition',_0x47d6('0x11'),_0x47d6('0x12')]},'log':_0x47d6('0x13')});};}; \ No newline at end of file +var _0x069b=['util','lodash','CreateVoiceCallReport','merge','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','duration','GetVoiceCallReports','moment'];(function(_0x454b5a,_0x577f7e){var _0x34e60e=function(_0x1d7e54){while(--_0x1d7e54){_0x454b5a['push'](_0x454b5a['shift']());}};_0x34e60e(++_0x577f7e);}(_0x069b,0x175));var _0xb069=function(_0x24d33e,_0x56de8e){_0x24d33e=_0x24d33e-0x0;var _0x557c3d=_0x069b[_0x24d33e];return _0x557c3d;};'use strict';var moment=require(_0xb069('0x0'));var util=require(_0xb069('0x1'));var _=require(_0xb069('0x2'));var client=require('../client');exports['create']=function(_0x39da12){return client['Request'](_0xb069('0x3'),{'body':_[_0xb069('0x4')](_0x39da12,{'source':_0x39da12['calleridnum'],'destinationcontext':_0x39da12['context'],'callerid':_0x39da12['callerid'],'amaflags':_0xb069('0x5')}),'log':_0xb069('0x3')});};exports[_0xb069('0x6')]=function(){return function(){return client[_0xb069('0x7')](_0xb069('0x8'),{'options':{'where':{'type':[_0xb069('0x9')],'createdAt':{'$between':[moment()[_0xb069('0xa')](_0xb069('0xb'))[_0xb069('0xc')](_0xb069('0xd')),moment()['endOf'](_0xb069('0xb'))[_0xb069('0xc')](_0xb069('0xd'))]}},'attributes':[_0xb069('0xe'),'disposition',_0xb069('0xf'),'billableseconds']},'log':_0xb069('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a3b92c3..75fcc70 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 _0x76cb=['create','CreateVoiceDialReport','../client'];(function(_0x2bd8fe,_0x4aeef7){var _0x2979e6=function(_0x2431ea){while(--_0x2431ea){_0x2bd8fe['push'](_0x2bd8fe['shift']());}};_0x2979e6(++_0x4aeef7);}(_0x76cb,0x86));var _0xb76c=function(_0x4eab61,_0x1a6e6d){_0x4eab61=_0x4eab61-0x0;var _0x342426=_0x76cb[_0x4eab61];return _0x342426;};'use strict';var client=require(_0xb76c('0x0'));exports[_0xb76c('0x1')]=function(_0x581ea3){return client['Request'](_0xb76c('0x2'),{'body':_0x581ea3,'log':_0xb76c('0x2')});}; \ No newline at end of file +var _0xadec=['Request','CreateVoiceDialReport'];(function(_0xc3aae7,_0x3bfa91){var _0x1f365a=function(_0x465838){while(--_0x465838){_0xc3aae7['push'](_0xc3aae7['shift']());}};_0x1f365a(++_0x3bfa91);}(_0xadec,0xc4));var _0xcade=function(_0x523f6e,_0x2f6f07){_0x523f6e=_0x523f6e-0x0;var _0x51aaab=_0xadec[_0x523f6e];return _0x51aaab;};'use strict';var client=require('../client');exports['create']=function(_0x11dadf){return client[_0xcade('0x0')](_0xcade('0x1'),{'body':_0x11dadf,'log':_0xcade('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 441e613..557f45a 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 _0xac4a=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x1cd0c0,_0x53ae33){var _0x561fab=function(_0x2305ec){while(--_0x2305ec){_0x1cd0c0['push'](_0x1cd0c0['shift']());}};_0x561fab(++_0x53ae33);}(_0xac4a,0x13f));var _0xaac4=function(_0x1b717c,_0x3a387b){_0x1b717c=_0x1b717c-0x0;var _0xc4727=_0xac4a[_0x1b717c];return _0xc4727;};'use strict';var client=require(_0xaac4('0x0'));exports[_0xaac4('0x1')]=function(){return function(){return client[_0xaac4('0x2')](_0xaac4('0x3'),{'options':{'raw':!![],'attributes':['id',_0xaac4('0x4'),_0xaac4('0x5')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x6e77=['exten','recordingFormat','getVoiceExtensions'];(function(_0x2bd935,_0x1b421a){var _0x390f7d=function(_0x396fb0){while(--_0x396fb0){_0x2bd935['push'](_0x2bd935['shift']());}};_0x390f7d(++_0x1b421a);}(_0x6e77,0xef));var _0x76e7=function(_0x1f9ee0,_0x2152a2){_0x1f9ee0=_0x1f9ee0-0x0;var _0x4274b5=_0x6e77[_0x1f9ee0];return _0x4274b5;};'use strict';var client=require('../client');exports[_0x76e7('0x0')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x76e7('0x1'),_0x76e7('0x2')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 5dcadf6..af063a4 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 _0xa229=['dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acwTimeout','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout'];(function(_0x36453b,_0x104046){var _0x1173aa=function(_0x132779){while(--_0x132779){_0x36453b['push'](_0x36453b['shift']());}};_0x1173aa(++_0x104046);}(_0xa229,0x156));var _0x9a22=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa229[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x9a22('0x0'));exports[_0x9a22('0x1')]=function(){return function(){return client[_0x9a22('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x9a22('0x3'),'acw',_0x9a22('0x4'),_0x9a22('0x5'),'monitor_format',_0x9a22('0x6'),_0x9a22('0x7'),_0x9a22('0x8'),_0x9a22('0x9'),_0x9a22('0xa'),_0x9a22('0xb'),'dialPredictiveOptimization',_0x9a22('0xc'),_0x9a22('0xd'),_0x9a22('0xe'),_0x9a22('0xf'),_0x9a22('0x10'),_0x9a22('0x11'),_0x9a22('0x12'),_0x9a22('0x13'),_0x9a22('0x14'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x9a22('0x15'),_0x9a22('0x16'),_0x9a22('0x17'),_0x9a22('0x18'),'dialTimezone',_0x9a22('0x19'),_0x9a22('0x1a'),'dialCheckDuplicateType',_0x9a22('0x1b'),_0x9a22('0x1c'),_0x9a22('0x1d'),_0x9a22('0x1e'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x9a22('0x1f'),_0x9a22('0x20'),_0x9a22('0x21'),_0x9a22('0x22'),_0x9a22('0x23'),'dialRecallInQueue',_0x9a22('0x24'),_0x9a22('0x25'),_0x9a22('0x26'),_0x9a22('0x27'),'monitor_format',_0x9a22('0x28'),_0x9a22('0x29'),_0x9a22('0x2a'),_0x9a22('0x2b'),_0x9a22('0x2c'),_0x9a22('0x2d'),_0x9a22('0x2e'),_0x9a22('0x2f'),'dialAbandonedRetryFrequency',_0x9a22('0x30'),_0x9a22('0x31'),_0x9a22('0x32'),'dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x9a22('0x33'),_0x9a22('0x34'),_0x9a22('0x35')],'include':[{'model':_0x9a22('0x36'),'as':_0x9a22('0x36'),'attributes':['id',_0x9a22('0x3'),'callerid',_0x9a22('0x37')]},{'model':_0x9a22('0x38'),'as':_0x9a22('0x39'),'attributes':['id',_0x9a22('0x3')]},{'model':_0x9a22('0x36'),'as':_0x9a22('0x3a'),'attributes':['id',_0x9a22('0x3'),_0x9a22('0x3b'),_0x9a22('0x37')]},{'model':'Interval','as':_0x9a22('0x3c'),'attributes':['id',_0x9a22('0x3')],'include':[{'model':_0x9a22('0x3c'),'as':_0x9a22('0x3d'),'attributes':['id',_0x9a22('0x3'),_0x9a22('0x3e')]}]}]},'log':_0x9a22('0x1')});};}; \ No newline at end of file +var _0x2d9d=['dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','mandatoryDispositionPause','Interval','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2d9d,0x88));var _0xd2d9=function(_0x449f69,_0x4e9444){_0x449f69=_0x449f69-0x0;var _0x550426=_0x2d9d[_0x449f69];return _0x550426;};'use strict';var client=require(_0xd2d9('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xd2d9('0x1')](_0xd2d9('0x2'),{'options':{'raw':![],'attributes':['id',_0xd2d9('0x3'),_0xd2d9('0x4'),_0xd2d9('0x5'),_0xd2d9('0x6'),_0xd2d9('0x7'),'type',_0xd2d9('0x8'),_0xd2d9('0x9'),_0xd2d9('0xa'),_0xd2d9('0xb'),_0xd2d9('0xc'),_0xd2d9('0xd'),_0xd2d9('0xe'),_0xd2d9('0xf'),_0xd2d9('0x10'),_0xd2d9('0x11'),_0xd2d9('0x12'),_0xd2d9('0x13'),_0xd2d9('0x14'),'dialQueueProject',_0xd2d9('0x15'),_0xd2d9('0x16'),_0xd2d9('0x17'),_0xd2d9('0x18'),'dialNoAnswerMaxRetry',_0xd2d9('0x19'),_0xd2d9('0x1a'),'dialTimezone',_0xd2d9('0x1b'),_0xd2d9('0x1c'),_0xd2d9('0x1d'),'dialAMDActive','dialAMDInitialSilence','dialAMDGreeting',_0xd2d9('0x1e'),_0xd2d9('0x1f'),'dialAMDMinWordLength',_0xd2d9('0x20'),'dialAMDMaximumNumberOfWords',_0xd2d9('0x21'),_0xd2d9('0x22'),_0xd2d9('0x23'),_0xd2d9('0x24'),'dialRecallInQueue',_0xd2d9('0x25'),_0xd2d9('0x26'),'dialAgiAfterHangupClient',_0xd2d9('0x27'),_0xd2d9('0x7'),'strategy','dialRandomLastDigitCallerIdNumber',_0xd2d9('0x28'),'dialNoSuchNumberMaxRetry',_0xd2d9('0x29'),_0xd2d9('0x2a'),_0xd2d9('0x2b'),_0xd2d9('0x2c'),_0xd2d9('0x2d'),_0xd2d9('0x2e'),_0xd2d9('0x2f'),_0xd2d9('0x30'),_0xd2d9('0x31'),_0xd2d9('0x32'),_0xd2d9('0x33'),'dialPredictiveIntervalMinThreshold',_0xd2d9('0x34'),_0xd2d9('0x35')],'include':[{'model':_0xd2d9('0x36'),'as':_0xd2d9('0x36'),'attributes':['id',_0xd2d9('0x3'),_0xd2d9('0x37'),_0xd2d9('0x38')]},{'model':'Pause','as':_0xd2d9('0x39'),'attributes':['id',_0xd2d9('0x3')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0xd2d9('0x3'),_0xd2d9('0x37'),'active']},{'model':_0xd2d9('0x3a'),'as':'Interval','attributes':['id',_0xd2d9('0x3')],'include':[{'model':_0xd2d9('0x3a'),'as':'Intervals','attributes':['id',_0xd2d9('0x3'),_0xd2d9('0x3b')]}]}]},'log':_0xd2d9('0x3c')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 871d4b0..755bbc1 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(_0x12d26c,_0x28541a){var _0x2c19fe=function(_0x57762f){while(--_0x57762f){_0x12d26c['push'](_0x12d26c['shift']());}};_0x2c19fe(++_0x28541a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x47df85,_0x40626a){var _0x5744af=function(_0x109e3d){while(--_0x109e3d){_0x47df85['push'](_0x47df85['shift']());}};_0x5744af(++_0x40626a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 570a67e..8d64621 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 _0x473e=['Request','GetVoiceQueueRtPauses'];(function(_0x25a986,_0x1195ae){var _0x5363a8=function(_0x15e2e5){while(--_0x15e2e5){_0x25a986['push'](_0x25a986['shift']());}};_0x5363a8(++_0x1195ae);}(_0x473e,0xe0));var _0xe473=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x473e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x2075ce){return function(){return client[_0xe473('0x0')](_0xe473('0x1'),{'options':{'where':{'VoiceQueueId':_0x2075ce,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xcab8=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x5224c0,_0x408d12){var _0x491ac5=function(_0x146281){while(--_0x146281){_0x5224c0['push'](_0x5224c0['shift']());}};_0x491ac5(++_0x408d12);}(_0xcab8,0xc0));var _0x8cab=function(_0x4e8d91,_0x26f01c){_0x4e8d91=_0x4e8d91-0x0;var _0x2bb126=_0xcab8[_0x4e8d91];return _0x2bb126;};'use strict';var client=require(_0x8cab('0x0'));exports[_0x8cab('0x1')]=function(_0x5bebd6){return function(){return client[_0x8cab('0x2')](_0x8cab('0x3'),{'options':{'where':{'VoiceQueueId':_0x5bebd6,'paused':!![]},'raw':!![]},'log':_0x8cab('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index c7f3b8b..f5089c4 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x3de0cd,_0x31d111){var _0x568451=function(_0x30aafe){while(--_0x30aafe){_0x3de0cd['push'](_0x3de0cd['shift']());}};_0x568451(++_0x31d111);}(_0x7a54,0x106));var _0x47a5=function(_0x31604c,_0x3a2266){_0x31604c=_0x31604c-0x0;var _0x2906fb=_0x7a54[_0x31604c];return _0x2906fb;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x3d851d,_0x176fce){var _0x1ac292=function(_0x11c053){while(--_0x11c053){_0x3d851d['push'](_0x3d851d['shift']());}};_0x1ac292(++_0x176fce);}(_0x7a54,0x106));var _0x47a5=function(_0x1a5361,_0x36d81d){_0x1a5361=_0x1a5361-0x0;var _0x4996d6=_0x7a54[_0x1a5361];return _0x4996d6;};'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 2987400..94b986d 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 _0xc0dc=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext','attended','../client','transfers','blindTransfer','result','transfererchannel','transferercalleridname','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','extension','attendedTransfer','Request','CreateVoiceTransferReport','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x4ded50,_0x4a6af3){var _0xa92135=function(_0xe09b41){while(--_0xe09b41){_0x4ded50['push'](_0x4ded50['shift']());}};_0xa92135(++_0x4a6af3);}(_0xc0dc,0x14f));var _0xcc0d=function(_0x19d29c,_0x8da505){_0x19d29c=_0x19d29c-0x0;var _0x449f49=_0xc0dc[_0x19d29c];return _0x449f49;};'use strict';var client=require(_0xcc0d('0x0'));exports[_0xcc0d('0x1')]={};exports[_0xcc0d('0x2')]=function(_0x140305){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x140305[_0xcc0d('0x3')],'transfererchannel':_0x140305[_0xcc0d('0x4')],'transferercalleridnum':_0x140305['transferercalleridnum'],'transferercalleridname':_0x140305[_0xcc0d('0x5')],'transfererconnectedlinenum':_0x140305['transfererconnectedlinenum'],'transfererconnectedlinename':_0x140305['transfererconnectedlinename'],'transfereraccountcode':_0x140305[_0xcc0d('0x6')],'transferercontext':_0x140305[_0xcc0d('0x7')],'transfererexten':_0x140305[_0xcc0d('0x8')],'transfererlinkedid':_0x140305[_0xcc0d('0x9')],'transfereechannel':_0x140305['transfereechannel'],'transfereecalleridnum':_0x140305[_0xcc0d('0xa')],'transfereecalleridname':_0x140305[_0xcc0d('0xb')],'transfereeconnectedlinenum':_0x140305[_0xcc0d('0xc')],'transfereeconnectedlinename':_0x140305[_0xcc0d('0xd')],'transfereeaccountcode':_0x140305[_0xcc0d('0xe')],'transfereecontext':_0x140305[_0xcc0d('0xf')],'transfereeexten':_0x140305[_0xcc0d('0x10')],'transfereelinkedid':_0x140305['transfereelinkedid'],'isexternal':_0x140305['isexternal'],'context':_0x140305['context'],'extension':_0x140305[_0xcc0d('0x11')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0xcc0d('0x12')]=function(_0x56d9b6){return client[_0xcc0d('0x13')](_0xcc0d('0x14'),{'body':{'result':_0x56d9b6['result'],'transfererchannel':_0x56d9b6['origtransfererchannel'],'transferercalleridnum':_0x56d9b6[_0xcc0d('0x15')],'transferercalleridname':_0x56d9b6[_0xcc0d('0x16')],'transfererconnectedlinenum':_0x56d9b6[_0xcc0d('0x17')],'transfererconnectedlinename':_0x56d9b6[_0xcc0d('0x18')],'transfereraccountcode':_0x56d9b6[_0xcc0d('0x19')],'transferercontext':_0x56d9b6[_0xcc0d('0x1a')],'transfererexten':_0x56d9b6[_0xcc0d('0x1b')],'transfererlinkedid':_0x56d9b6[_0xcc0d('0x1c')],'transfereechannel':_0x56d9b6[_0xcc0d('0x1d')],'transfereecalleridnum':_0x56d9b6[_0xcc0d('0x1e')],'transfereecalleridname':_0x56d9b6[_0xcc0d('0x1f')],'transfereeconnectedlinenum':_0x56d9b6[_0xcc0d('0x20')],'transfereeconnectedlinename':_0x56d9b6[_0xcc0d('0x21')],'transfereeaccountcode':_0x56d9b6[_0xcc0d('0x22')],'transfereecontext':_0x56d9b6[_0xcc0d('0x23')],'transfereeexten':_0x56d9b6['transfertargetexten'],'transfereelinkedid':_0x56d9b6[_0xcc0d('0x24')],'isexternal':_0x56d9b6[_0xcc0d('0x25')],'context':_0x56d9b6[_0xcc0d('0x26')],'extension':_0x56d9b6['origtransfererexten'],'type':_0xcc0d('0x27')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x5a27=['CreateVoiceTransferReport','attendedTransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','../client','transfers','Request','result','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension'];(function(_0x5a7f64,_0x347d57){var _0x3d30f1=function(_0x4bd1d6){while(--_0x4bd1d6){_0x5a7f64['push'](_0x5a7f64['shift']());}};_0x3d30f1(++_0x347d57);}(_0x5a27,0x163));var _0x75a2=function(_0x12fd87,_0x463b56){_0x12fd87=_0x12fd87-0x0;var _0x328f8b=_0x5a27[_0x12fd87];return _0x328f8b;};'use strict';var client=require(_0x75a2('0x0'));exports[_0x75a2('0x1')]={};exports['blindTransfer']=function(_0x43cbdd){return client[_0x75a2('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x43cbdd[_0x75a2('0x3')],'transfererchannel':_0x43cbdd['transfererchannel'],'transferercalleridnum':_0x43cbdd[_0x75a2('0x4')],'transferercalleridname':_0x43cbdd[_0x75a2('0x5')],'transfererconnectedlinenum':_0x43cbdd['transfererconnectedlinenum'],'transfererconnectedlinename':_0x43cbdd[_0x75a2('0x6')],'transfereraccountcode':_0x43cbdd[_0x75a2('0x7')],'transferercontext':_0x43cbdd[_0x75a2('0x8')],'transfererexten':_0x43cbdd[_0x75a2('0x9')],'transfererlinkedid':_0x43cbdd[_0x75a2('0xa')],'transfereechannel':_0x43cbdd[_0x75a2('0xb')],'transfereecalleridnum':_0x43cbdd['transfereecalleridnum'],'transfereecalleridname':_0x43cbdd['transfereecalleridname'],'transfereeconnectedlinenum':_0x43cbdd['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x43cbdd[_0x75a2('0xc')],'transfereeaccountcode':_0x43cbdd[_0x75a2('0xd')],'transfereecontext':_0x43cbdd[_0x75a2('0xe')],'transfereeexten':_0x43cbdd[_0x75a2('0xf')],'transfereelinkedid':_0x43cbdd['transfereelinkedid'],'isexternal':_0x43cbdd[_0x75a2('0x10')],'context':_0x43cbdd[_0x75a2('0x11')],'extension':_0x43cbdd[_0x75a2('0x12')],'type':'blind'},'log':_0x75a2('0x13')});};exports[_0x75a2('0x14')]=function(_0x299b3e){return client[_0x75a2('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x299b3e[_0x75a2('0x3')],'transfererchannel':_0x299b3e['origtransfererchannel'],'transferercalleridnum':_0x299b3e[_0x75a2('0x15')],'transferercalleridname':_0x299b3e[_0x75a2('0x16')],'transfererconnectedlinenum':_0x299b3e[_0x75a2('0x17')],'transfererconnectedlinename':_0x299b3e['secondtransfererconnectedlinename'],'transfereraccountcode':_0x299b3e['origtransfereraccountcode'],'transferercontext':_0x299b3e['secondtransferercontext'],'transfererexten':_0x299b3e[_0x75a2('0x18')],'transfererlinkedid':_0x299b3e[_0x75a2('0x19')],'transfereechannel':_0x299b3e['transfertargetchannel'],'transfereecalleridnum':_0x299b3e[_0x75a2('0x1a')],'transfereecalleridname':_0x299b3e[_0x75a2('0x1b')],'transfereeconnectedlinenum':_0x299b3e[_0x75a2('0x1c')],'transfereeconnectedlinename':_0x299b3e[_0x75a2('0x1d')],'transfereeaccountcode':_0x299b3e['transfertargetaccountcode'],'transfereecontext':_0x299b3e[_0x75a2('0x1e')],'transfereeexten':_0x299b3e[_0x75a2('0x1f')],'transfereelinkedid':_0x299b3e['transfertargetlinkedid'],'isexternal':_0x299b3e[_0x75a2('0x10')],'context':_0x299b3e[_0x75a2('0x20')],'extension':_0x299b3e[_0x75a2('0x21')],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 0825491..c9b9c8f 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 _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(_0x14fbe7,_0x4c68bd){var _0x58d207=function(_0x1ff549){while(--_0x1ff549){_0x14fbe7['push'](_0x14fbe7['shift']());}};_0x58d207(++_0x4c68bd);}(_0xb10b,0x12a));var _0xbb10=function(_0x2d4521,_0x8d98b6){_0x2d4521=_0x2d4521-0x0;var _0x5d765f=_0xb10b[_0x2d4521];return _0x5d765f;};'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 +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(_0x21f3be,_0xecb684){var _0x4ab639=function(_0xde2974){while(--_0xde2974){_0x21f3be['push'](_0x21f3be['shift']());}};_0x4ab639(++_0xecb684);}(_0x7a54,0x106));var _0x47a5=function(_0x21131a,_0x22568d){_0x21131a=_0x21131a-0x0;var _0xc96221=_0x7a54[_0x21131a];return _0xc96221;};'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 diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 2797fcb..54bf90a 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 _0x1dcc=['xmd-contactid','data3','split','phone','$or','map','routeId','firstName','mobile','fax','scheduledAt','updatedAt','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','destcalleridnum','calleridname','Unknown','destcalleridname','','resolve','then','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','action','toLowerCase','merge','length','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data2','isNil','data5'];(function(_0x479746,_0x574758){var _0x36d2aa=function(_0x27e29d){while(--_0x27e29d){_0x479746['push'](_0x479746['shift']());}};_0x36d2aa(++_0x574758);}(_0x1dcc,0x8c));var _0xc1dc=function(_0x390cc2,_0x111121){_0x390cc2=_0x390cc2-0x0;var _0x28bb90=_0x1dcc[_0x390cc2];return _0x28bb90;};'use strict';var _=require(_0xc1dc('0x0'));var BPromise=require(_0xc1dc('0x1'));var Redis=require(_0xc1dc('0x2'));var util=require('util');var config=require(_0xc1dc('0x3'));var logger=require(_0xc1dc('0x4'))(_0xc1dc('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0xc1dc('0x6')]=_['defaults'](config[_0xc1dc('0x6')],{'host':_0xc1dc('0x7'),'port':0x18eb});var io=require(_0xc1dc('0x8'))(new Redis(config[_0xc1dc('0x6')]));function emit(_0x552593,_0x3168f8,_0x1a9399,_0x128d3c,_0x56679b){logger[_0xc1dc('0x9')](_0xc1dc('0xa'),_0x552593,_0x3168f8['id'],_0x1a9399,_0x128d3c,JSON[_0xc1dc('0xb')](_0x56679b));io['to'](_0x1a9399)['emit'](_0x128d3c,_0x56679b);}exports[_0xc1dc('0xc')]=function(_0x5d2c8a,_0x566693,_0xffa5f8,_0x41a7d4){var _0x775fea,_0x1c577e;var _0x1ae99f={};var _0x27d4ca;var _0x32fcc0=Number(_0xffa5f8['data1']);var _0x144e89=_0xffa5f8[_0xc1dc('0xd')]?Boolean(Number(_0xffa5f8[_0xc1dc('0xd')])):![];var _0x399f01;var _0x757cb7=![];if(!_[_0xc1dc('0xe')](_0xffa5f8[_0xc1dc('0xf')])){if(_0xffa5f8[_0xc1dc('0xf')]=='1')_0x757cb7=!![];}if(!_0x757cb7){if(_0x41a7d4[_0xc1dc('0x10')]){_0x1ae99f['id']=_0x41a7d4[_0xc1dc('0x10')];}}if(!_0x1ae99f['id']){_0x1ae99f['ListId']=_0x32fcc0;_0x399f01=_0xffa5f8[_0xc1dc('0x11')]&&_0xffa5f8[_0xc1dc('0x11')]!=='0'?_0xffa5f8[_0xc1dc('0x11')][_0xc1dc('0x12')](','):[_0xc1dc('0x13')];_0x1ae99f[_0xc1dc('0x14')]=_[_0xc1dc('0x15')](_0x399f01,function(_0x13996a){var _0x2e674f={};_0x2e674f[_0x13996a]=_0x41a7d4[_0xc1dc('0x16')]?_0x41a7d4['destcalleridnum']:_0x41a7d4['calleridnum'];return _0x2e674f;});_0x27d4ca=_0x41a7d4[_0xc1dc('0x16')]?_0x41a7d4['destcalleridnum']:_0x41a7d4['calleridnum'];}var _0x18dadd=['id',_0xc1dc('0x17'),'lastName',_0xc1dc('0x13'),_0xc1dc('0x18'),_0xc1dc('0x19'),'ListId','createdAt',_0xc1dc('0x1a'),_0xc1dc('0x1b')];var _0x338580=_['union'](_0x18dadd,_0x399f01);BPromise['resolve']()['then'](cmContactRpc[_0xc1dc('0x1c')]({'attributes':_0x338580,'where':_0x1ae99f,'phone':_0x27d4ca}))['then'](function(_0x3b7400){_0x1c577e=_0x3b7400;if(!_[_0xc1dc('0x1d')](_0x1c577e)){if(_0x1c577e['length']===0x1){_0x775fea=_0x1c577e[0x0];logger[_0xc1dc('0x9')](_0xc1dc('0x1e'),_0x41a7d4[_0xc1dc('0x1f')],_0x566693['id'],_0x775fea['id']);}else{logger[_0xc1dc('0x9')](_0xc1dc('0x20'),_0x41a7d4[_0xc1dc('0x1f')],_0x566693['id'],_[_0xc1dc('0x15')](_0x1c577e,'id')['join'](','));}return;}else{logger['info'](_0xc1dc('0x21'),_0x41a7d4[_0xc1dc('0x1f')],_0x566693['id']);var _0x22b1fc={'ListId':_0x32fcc0};var _0x4a561e=_0xffa5f8[_0xc1dc('0x22')]&&_0xffa5f8['data4']!=='0'?_0xffa5f8[_0xc1dc('0x22')]:_0xc1dc('0x13');if(_0x144e89){logger[_0xc1dc('0x9')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x41a7d4[_0xc1dc('0x1f')],_0x566693['id']);_0x22b1fc[_0x4a561e]=_[_0xc1dc('0xe')](_0x41a7d4[_0xc1dc('0x16')])?_0x41a7d4['calleridnum']:_0x41a7d4[_0xc1dc('0x23')];if(_['isNil'](_0x41a7d4[_0xc1dc('0x16')])){_0x22b1fc['firstName']=_0x41a7d4[_0xc1dc('0x24')]&&_0x41a7d4['calleridname']!==''?_0x41a7d4[_0xc1dc('0x24')]:_0xc1dc('0x25');}else{_0x22b1fc['firstName']=_0x41a7d4['destcalleridname']&&_0x41a7d4[_0xc1dc('0x26')]!==_0xc1dc('0x27')?_0x41a7d4[_0xc1dc('0x26')]:_0xc1dc('0x25');}return BPromise[_0xc1dc('0x28')]()[_0xc1dc('0x29')](cmContactRpc[_0xc1dc('0x2a')](_0x22b1fc))[_0xc1dc('0x29')](function(_0x2c4b5e){_0x775fea=_0x2c4b5e;_0x1c577e[_0xc1dc('0x2b')](_0x2c4b5e);if(_0x775fea){logger[_0xc1dc('0x9')](_0xc1dc('0x2c'),_0x41a7d4[_0xc1dc('0x1f')],_0x566693['id'],_0x775fea['id']);}return;});}else{logger['info'](_0xc1dc('0x2d'),_0x41a7d4[_0xc1dc('0x1f')],_0x566693['id']);_0x22b1fc[_0x4a561e]=_['isNil'](_0x41a7d4[_0xc1dc('0x16')])?_0x41a7d4['calleridnum']:_0x41a7d4['destcalleridnum'];if(_[_0xc1dc('0xe')](_0x41a7d4[_0xc1dc('0x16')])){_0x22b1fc[_0xc1dc('0x17')]=_0x41a7d4[_0xc1dc('0x24')]&&_0x41a7d4['calleridname']!==_0xc1dc('0x27')?_0x41a7d4['calleridname']:_0xc1dc('0x25');}else{_0x22b1fc['firstName']=_0x41a7d4['destcalleridname']&&_0x41a7d4[_0xc1dc('0x26')]!==_0xc1dc('0x27')?_0x41a7d4['destcalleridname']:'Unknown';}_0x775fea=_0x22b1fc;_0x1c577e[_0xc1dc('0x2b')](_0x22b1fc);return;}}})['then'](function(){if(_0x5d2c8a){emit(_0x41a7d4['uniqueid'],_0x566693,util[_0xc1dc('0x2e')](_0xc1dc('0x2f'),_0x5d2c8a['name']),util['format']('trigger:%s',_0xffa5f8[_0xc1dc('0x30')][_0xc1dc('0x31')]()),{'evt':_[_0xc1dc('0x32')](_0x41a7d4,{'autoCreate':_0x144e89}),'contact':_0x775fea===undefined?{}:_0x775fea,'contacts':_0x1c577e[_0xc1dc('0x33')]===0x0?undefined:_0x1c577e});}});}; \ No newline at end of file +var _0x5194=['$or','routeId','destcalleridnum','calleridnum','firstName','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length','uniqueid','data4','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','action','toLowerCase','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','data2','isNil','data5','xmd-contactid','data3','split','phone'];(function(_0xe4f11,_0x3c2ff6){var _0x673bbd=function(_0x402aa8){while(--_0x402aa8){_0xe4f11['push'](_0xe4f11['shift']());}};_0x673bbd(++_0x3c2ff6);}(_0x5194,0x173));var _0x4519=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x5194[_0x51020b];return _0x371e47;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0x4519('0x0'));var util=require(_0x4519('0x1'));var config=require(_0x4519('0x2'));var logger=require(_0x4519('0x3'))(_0x4519('0x4'));var cmContactRpc=require(_0x4519('0x5'));config[_0x4519('0x6')]=_[_0x4519('0x7')](config[_0x4519('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x4519('0x8'))(new Redis(config[_0x4519('0x6')]));function emit(_0x6de583,_0x2d41df,_0x4e4537,_0x554121,_0x5eb1c4){logger[_0x4519('0x9')](_0x4519('0xa'),_0x6de583,_0x2d41df['id'],_0x4e4537,_0x554121,JSON[_0x4519('0xb')](_0x5eb1c4));io['to'](_0x4e4537)['emit'](_0x554121,_0x5eb1c4);}exports[_0x4519('0xc')]=function(_0x31210e,_0x41dde8,_0x5ad793,_0x1f2f63){var _0x4a371e,_0x4fd88e;var _0x55881f={};var _0x11ee7e;var _0x2fcd8f=Number(_0x5ad793[_0x4519('0xd')]);var _0x41fc25=_0x5ad793[_0x4519('0xe')]?Boolean(Number(_0x5ad793['data2'])):![];var _0x4b671e;var _0x2870c8=![];if(!_[_0x4519('0xf')](_0x5ad793[_0x4519('0x10')])){if(_0x5ad793[_0x4519('0x10')]=='1')_0x2870c8=!![];}if(!_0x2870c8){if(_0x1f2f63['xmd-contactid']){_0x55881f['id']=_0x1f2f63[_0x4519('0x11')];}}if(!_0x55881f['id']){_0x55881f['ListId']=_0x2fcd8f;_0x4b671e=_0x5ad793[_0x4519('0x12')]&&_0x5ad793[_0x4519('0x12')]!=='0'?_0x5ad793['data3'][_0x4519('0x13')](','):[_0x4519('0x14')];_0x55881f[_0x4519('0x15')]=_['map'](_0x4b671e,function(_0xc10171){var _0x569605={};_0x569605[_0xc10171]=_0x1f2f63[_0x4519('0x16')]?_0x1f2f63[_0x4519('0x17')]:_0x1f2f63[_0x4519('0x18')];return _0x569605;});_0x11ee7e=_0x1f2f63[_0x4519('0x16')]?_0x1f2f63['destcalleridnum']:_0x1f2f63['calleridnum'];}var _0x1cbea4=['id',_0x4519('0x19'),'lastName',_0x4519('0x14'),'mobile',_0x4519('0x1a'),'ListId',_0x4519('0x1b'),_0x4519('0x1c'),_0x4519('0x1d')];var _0x1bc8a=_[_0x4519('0x1e')](_0x1cbea4,_0x4b671e);BPromise[_0x4519('0x1f')]()[_0x4519('0x20')](cmContactRpc[_0x4519('0x21')]({'attributes':_0x1bc8a,'where':_0x55881f,'phone':_0x11ee7e}))['then'](function(_0x2f9777){_0x4fd88e=_0x2f9777;if(!_['isEmpty'](_0x4fd88e)){if(_0x4fd88e[_0x4519('0x22')]===0x1){_0x4a371e=_0x4fd88e[0x0];logger[_0x4519('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x1f2f63['uniqueid'],_0x41dde8['id'],_0x4a371e['id']);}else{logger[_0x4519('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x1f2f63[_0x4519('0x23')],_0x41dde8['id'],_['map'](_0x4fd88e,'id')['join'](','));}return;}else{logger[_0x4519('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x1f2f63['uniqueid'],_0x41dde8['id']);var _0x3865ec={'ListId':_0x2fcd8f};var _0x10dde9=_0x5ad793['data4']&&_0x5ad793[_0x4519('0x24')]!=='0'?_0x5ad793['data4']:_0x4519('0x14');if(_0x41fc25){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x1f2f63[_0x4519('0x23')],_0x41dde8['id']);_0x3865ec[_0x10dde9]=_[_0x4519('0xf')](_0x1f2f63[_0x4519('0x16')])?_0x1f2f63[_0x4519('0x18')]:_0x1f2f63[_0x4519('0x17')];if(_[_0x4519('0xf')](_0x1f2f63[_0x4519('0x16')])){_0x3865ec['firstName']=_0x1f2f63['calleridname']&&_0x1f2f63[_0x4519('0x25')]!==_0x4519('0x26')?_0x1f2f63[_0x4519('0x25')]:_0x4519('0x27');}else{_0x3865ec[_0x4519('0x19')]=_0x1f2f63[_0x4519('0x28')]&&_0x1f2f63[_0x4519('0x28')]!==_0x4519('0x26')?_0x1f2f63['destcalleridname']:_0x4519('0x27');}return BPromise[_0x4519('0x1f')]()[_0x4519('0x20')](cmContactRpc['createContact'](_0x3865ec))[_0x4519('0x20')](function(_0x33346b){_0x4a371e=_0x33346b;_0x4fd88e[_0x4519('0x29')](_0x33346b);if(_0x4a371e){logger[_0x4519('0x9')](_0x4519('0x2a'),_0x1f2f63[_0x4519('0x23')],_0x41dde8['id'],_0x4a371e['id']);}return;});}else{logger[_0x4519('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x1f2f63[_0x4519('0x23')],_0x41dde8['id']);_0x3865ec[_0x10dde9]=_[_0x4519('0xf')](_0x1f2f63[_0x4519('0x16')])?_0x1f2f63[_0x4519('0x18')]:_0x1f2f63['destcalleridnum'];if(_[_0x4519('0xf')](_0x1f2f63[_0x4519('0x16')])){_0x3865ec[_0x4519('0x19')]=_0x1f2f63[_0x4519('0x25')]&&_0x1f2f63[_0x4519('0x25')]!==_0x4519('0x26')?_0x1f2f63[_0x4519('0x25')]:'Unknown';}else{_0x3865ec[_0x4519('0x19')]=_0x1f2f63[_0x4519('0x28')]&&_0x1f2f63['destcalleridname']!==''?_0x1f2f63[_0x4519('0x28')]:_0x4519('0x27');}_0x4a371e=_0x3865ec;_0x4fd88e[_0x4519('0x29')](_0x3865ec);return;}}})[_0x4519('0x20')](function(){if(_0x31210e){emit(_0x1f2f63[_0x4519('0x23')],_0x41dde8,util[_0x4519('0x2b')](_0x4519('0x2c'),_0x31210e[_0x4519('0x2d')]),util['format'](_0x4519('0x2e'),_0x5ad793[_0x4519('0x2f')][_0x4519('0x30')]()),{'evt':_['merge'](_0x1f2f63,{'autoCreate':_0x41fc25}),'contact':_0x4a371e===undefined?{}:_0x4a371e,'contacts':_0x4fd88e[_0x4519('0x22')]===0x0?undefined:_0x4fd88e});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 701f31e..702cb15 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 _0x2e96=['routeId','urlforward','script','parse','search','replace','checkTrigger','channel','AllConditions','every','checkConditions','AnyConditions','some','evt','field','chat','ChatWebsiteId','operator','upperFirst','interaction','message','event','value','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','exports','util','url','mustache','ioredis','./urlforward','./cmContact','./script','../../../config/logger','trigger','../ami','defaults','redis','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','vtigerAccounts','custom:agentcalled','custom:agentconnect','bind','custom:agentringnoanswer','syncCustomEvent','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','emit','info','stringify','prototype','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','hasOwnProperty','status','merge','variables','Actions','length','toLowerCase','contactmanager','motionbar','browser','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','location','windowWidth','data5','800','windowHeight','600','data6','winArguments','format','user:%s','name','trigger:%s:%s','action','data1','jscripty','interface','trigger:%s','exec','accounts','queue'];(function(_0x540714,_0xa1537a){var _0x353ab0=function(_0x138a36){while(--_0x138a36){_0x540714['push'](_0x540714['shift']());}};_0x353ab0(++_0xa1537a);}(_0x2e96,0x9d));var _0x62e9=function(_0x7430b6,_0x4fe9f4){_0x7430b6=_0x7430b6-0x0;var _0x3cd462=_0x2e96[_0x7430b6];return _0x3cd462;};'use strict';var util=require(_0x62e9('0x0'));var _=require('lodash');var url=require(_0x62e9('0x1'));var Mustache=require(_0x62e9('0x2'));var Redis=require(_0x62e9('0x3'));var urlforward=require(_0x62e9('0x4'));var integration=require('./integration');var cmContact=require(_0x62e9('0x5'));var script=require(_0x62e9('0x6'));var config=require('../../../config/environment');var logger=require(_0x62e9('0x7'))(_0x62e9('0x8'));var ami=require(_0x62e9('0x9'));config['redis']=_[_0x62e9('0xa')](config[_0x62e9('0xb')],{'host':_0x62e9('0xc'),'port':0x18eb});var io=require(_0x62e9('0xd'))(new Redis(config['redis']));var operators={'equals':function(_0xfaa4f5,_0x417605){return _0xfaa4f5==_0x417605;},'not_equals':function(_0x34f20e,_0x3a6f3c){return _0x34f20e!=_0x3a6f3c;}};var barAndWebActions=[_0x62e9('0xe'),_0x62e9('0x1'),'winapp'];function Trigger(_0x4ee8d7){this[_0x62e9('0xf')]=_0x4ee8d7[_0x62e9('0xf')];this[_0x62e9('0x10')]=_0x4ee8d7[_0x62e9('0x10')];this[_0x62e9('0x11')]=_0x4ee8d7[_0x62e9('0x11')];this[_0x62e9('0x12')]=_0x4ee8d7[_0x62e9('0x12')];this[_0x62e9('0x13')]=_0x4ee8d7[_0x62e9('0x13')];this[_0x62e9('0x14')]=_0x4ee8d7[_0x62e9('0x14')];this[_0x62e9('0x15')]=_0x4ee8d7['freshdeskAccounts'];this[_0x62e9('0x16')]=_0x4ee8d7[_0x62e9('0x16')];this[_0x62e9('0x17')]=_0x4ee8d7['sugarcrmAccounts'];this[_0x62e9('0x18')]=_0x4ee8d7['zohoAccounts'];this[_0x62e9('0x19')]=_0x4ee8d7[_0x62e9('0x19')];this['vtigerAccounts']=_0x4ee8d7['vtigerAccounts'];this[_0x62e9('0x1a')]=_0x4ee8d7['servicenowAccounts'];this[_0x62e9('0x1b')]=_0x4ee8d7[_0x62e9('0x1b')];this['freshsalesAccounts']=_0x4ee8d7[_0x62e9('0x1c')];this['accounts']={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x62e9('0x16')],'freshdesk':this[_0x62e9('0x15')],'sugarcrm':this[_0x62e9('0x17')],'zoho':this['zohoAccounts'],'desk':this[_0x62e9('0x19')],'vtiger':this[_0x62e9('0x1d')],'dynamics365':this[_0x62e9('0x1b')],'freshsales':this[_0x62e9('0x1c')],'servicenow':this[_0x62e9('0x1a')]};ami['on'](_0x62e9('0x1e'),this['syncCustomEvent']['bind'](this));ami['on'](_0x62e9('0x1f'),this['syncCustomEvent'][_0x62e9('0x20')](this));ami['on'](_0x62e9('0x21'),this[_0x62e9('0x22')][_0x62e9('0x20')](this));ami['on'](_0x62e9('0x23'),this[_0x62e9('0x22')]['bind'](this));ami['on'](_0x62e9('0x24'),this[_0x62e9('0x22')][_0x62e9('0x20')](this));ami['on'](_0x62e9('0x25'),this[_0x62e9('0x22')][_0x62e9('0x20')](this));ami['on']('custom:agentbusy',this[_0x62e9('0x22')][_0x62e9('0x20')](this));ami['on']('custom:agentcongestion',this[_0x62e9('0x22')]['bind'](this));ami['on']('custom:agentreject',this[_0x62e9('0x22')][_0x62e9('0x20')](this));ami['on']('custom:amd',this['syncCustomEvent']['bind'](this));ami['on'](_0x62e9('0x26'),this['syncCustomEvent'][_0x62e9('0x20')](this));ami['on']('custom:timeout',this[_0x62e9('0x22')]['bind'](this));ami['on'](_0x62e9('0x27'),this[_0x62e9('0x28')][_0x62e9('0x20')](this));ami['on'](_0x62e9('0x29'),this['syncAgentDial']['bind'](this));ami['on']('custom:dialend',this[_0x62e9('0x28')][_0x62e9('0x20')](this));ami['on']('custom:newinteraction',this[_0x62e9('0x22')]['bind'](this));ami['on']('custom:closedinteraction',this[_0x62e9('0x22')]['bind'](this));ami['on']('custom:substatus',this['syncCustomEvent']['bind'](this));ami['on'](_0x62e9('0x2a'),this['syncCustomEvent']['bind'](this));ami['on'](_0x62e9('0x2b'),this[_0x62e9('0x22')][_0x62e9('0x20')](this));ami['on'](_0x62e9('0x2c'),this['syncCustomEvent'][_0x62e9('0x20')](this));ami['on'](_0x62e9('0x2d'),this[_0x62e9('0x22')][_0x62e9('0x20')](this));ami['on'](_0x62e9('0x2e'),this['syncCustomEvent'][_0x62e9('0x20')](this));}Trigger['prototype'][_0x62e9('0x2f')]=function(_0x1c9e43,_0xa4b174,_0x338f2f){logger[_0x62e9('0x30')](_0x1c9e43,_0xa4b174,JSON[_0x62e9('0x31')](_0x338f2f));io['to'](_0x1c9e43)['emit'](_0xa4b174,_0x338f2f);};Trigger[_0x62e9('0x32')][_0x62e9('0x22')]=function(_0x1a6d8a){var _0x38e053=_[_0x62e9('0x33')](_0x1a6d8a);if(typeof _0x38e053[_0x62e9('0x34')]===_0x62e9('0x35')){_0x38e053[_0x62e9('0x34')]=_0x62e9('0x36');}logger[_0x62e9('0x37')](_0x62e9('0x22'),util[_0x62e9('0x38')](_0x38e053,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x38e053);};Trigger[_0x62e9('0x32')]['syncAgentDial']=function(_0x44a4e2){if(this[_0x62e9('0x10')][_0x44a4e2['interface']]){this[_0x62e9('0x22')](_0x44a4e2);}};Trigger['prototype'][_0x62e9('0x39')]=function(_0x296bd2){var _0x48de03;for(var _0x3c3998 in this[_0x62e9('0xf')]){if(this[_0x62e9('0xf')][_0x62e9('0x3a')](_0x3c3998)){if(this[_0x62e9('0xf')][_0x3c3998][_0x62e9('0x3b')]){_0x48de03=this['checkTrigger'](this[_0x62e9('0xf')][_0x3c3998],_0x296bd2);if(_0x48de03){_[_0x62e9('0x3c')](_0x296bd2,_0x296bd2[_0x62e9('0x3d')]);for(var _0x1e4874=0x0,_0x24a985,_0x3fcb1d,_0x79c91d;_0x1e48740x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x594835,_0x36e43c){var _0x2fe815=function(_0x38a1d5){while(--_0x38a1d5){_0x594835['push'](_0x594835['shift']());}};_0x2fe815(++_0x36e43c);}(_0x7217,0x19e));var _0x7721=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x7217[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 3a0e058..1285657 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 _0x1fca=['ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','data2','resolve','username','password','clientSecret','then','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','catch','toLowerCase','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','value','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','length','forEach','includes','string','picklist','type','nameField','customField','indexOf','content','ticketType','incident','POST','incidents','getString','/contacts(','Fields','phonecall','callDirection','queue','Subjects','Descriptions','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','CloudProvider','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5'];(function(_0x99c180,_0x33e906){var _0x11482f=function(_0x454197){while(--_0x454197){_0x99c180['push'](_0x99c180['shift']());}};_0x11482f(++_0x33e906);}(_0x1fca,0xdc));var _0xa1fc=function(_0xfb361b,_0xebf207){_0xfb361b=_0xfb361b-0x0;var _0x551f56=_0x1fca[_0xfb361b];return _0x551f56;};'use strict';var _=require('lodash');var rp=require(_0xa1fc('0x0'));var util=require(_0xa1fc('0x1'));var intUtil=require(_0xa1fc('0x2'));var md5=require(_0xa1fc('0x3'));var Redis=require(_0xa1fc('0x4'));var logger=require(_0xa1fc('0x5'))(_0xa1fc('0x6'));var config=require(_0xa1fc('0x7'));config[_0xa1fc('0x8')]=_[_0xa1fc('0x9')](config[_0xa1fc('0x8')],{'host':_0xa1fc('0xa'),'port':0x18eb});var io=require(_0xa1fc('0xb'))(new Redis(config[_0xa1fc('0x8')]));function getAuthToken(_0x173523,_0x45b163,_0x1536be){if(_0x173523[_0xa1fc('0xc')]){_0x173523[_0xa1fc('0xd')]=_0x173523['CloudProvider'][_0xa1fc('0xe')];_0x173523['tenantId']=_0x173523['CloudProvider'][_0xa1fc('0xf')];return Promise[_0xa1fc('0x10')](_0x173523['CloudProvider']['data5']);}var _0x327d87={'method':'POST','uri':_0x45b163,'form':{'client_id':_0x173523['clientId'],'resource':_0x173523[_0xa1fc('0xd')],'username':_0x173523[_0xa1fc('0x11')],'password':_0x173523[_0xa1fc('0x12')],'grant_type':_0xa1fc('0x12'),'client_secret':_0x173523[_0xa1fc('0x13')]},'json':!![]};return rp(_0x327d87)[_0xa1fc('0x14')](function(_0x5d3aeb){return _0x5d3aeb['access_token'];})['catch'](function(_0x1ae5ce){logger[_0xa1fc('0x15')]('['+[_0x1536be[_0xa1fc('0x16')]()]+']\x20Wrong\x20credentials!');return _0x1ae5ce[_0xa1fc('0x17')];});}function getUser(_0x41ca6e,_0xb8a1f4,_0x498842,_0x28d587,_0x44c8e4,_0x484070){return new Promise(function(_0xdc258a,_0x44091e){return getAuthToken(_0xb8a1f4,_0x28d587,_0x484070)[_0xa1fc('0x14')](function(_0x3775f8){var _0x357bc2={'method':_0xa1fc('0x18'),'uri':_0x44c8e4+_0xa1fc('0x19'),'headers':{'Authorization':_0xa1fc('0x1a')+_0x3775f8,'OData-Version':_0xa1fc('0x1b')},'json':!![]};return rp(_0x357bc2);})[_0xa1fc('0x14')](function(_0x412461){var _0x1fcab6=_0x412461['value'];var _0x5cac75=![];var _0x46ab93=null;if(!_[_0xa1fc('0x1c')](_0x498842)){if(intUtil[_0xa1fc('0x1d')](_0x498842[_0xa1fc('0x1e')])){_0x41ca6e[_0xa1fc('0x1f')]=_0x498842[_0xa1fc('0x1e')];for(_0x46ab93=0x0;_0x46ab93<_0x1fcab6['length'];_0x46ab93++){if(_0x1fcab6[_0x46ab93][_0xa1fc('0x20')]===_0x498842[_0xa1fc('0x1e')]&&!_0x1fcab6[_0x46ab93][_0xa1fc('0x21')]){_0x5cac75=!![];logger[_0xa1fc('0x22')]('['+[_0x484070[_0xa1fc('0x16')]()]+_0xa1fc('0x23')+_0x1fcab6[_0x46ab93][_0xa1fc('0x24')]+'!');_0x41ca6e[_0xa1fc('0x25')]=_0x1fcab6[_0x46ab93][_0xa1fc('0x24')];}}}}if(!_0x5cac75){logger[_0xa1fc('0x22')]('['+[_0x484070[_0xa1fc('0x16')]()]+_0xa1fc('0x26'));_0x41ca6e[_0xa1fc('0x1f')]=_0xb8a1f4['username'];for(_0x46ab93=0x0;_0x46ab93<_0x1fcab6['length'];_0x46ab93++){if(_0x1fcab6[_0x46ab93][_0xa1fc('0x20')]===_0xb8a1f4[_0xa1fc('0x11')]){_0x41ca6e[_0xa1fc('0x25')]=_0x1fcab6[_0x46ab93][_0xa1fc('0x24')];}}}_0xdc258a(_0x41ca6e);})['catch'](function(_0x442e76){_0x44091e(_0x442e76['message']);});});}function createEndUser(_0x438bdd,_0x5ec81b,_0x2adf89,_0x4f1ec8,_0x4fe245,_0x3b6236,_0x26fbf6){return new Promise(function(_0x3dcd8b,_0x344181){return getAuthToken(_0x5ec81b,_0x2adf89,_0x3b6236)[_0xa1fc('0x14')](function(_0x4ef3ba){var _0x4b5b45=_0x3b6236['toLowerCase']()===_0xa1fc('0x27')?_0x4fe245[_0xa1fc('0x28')]:_0x4fe245[_0xa1fc('0x29')];var _0x47d06b={'method':'POST','uri':_0x4f1ec8+_0xa1fc('0x2a'),'body':{'fullname':_0x4b5b45,'firstname':_0x4b5b45,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xa1fc('0x2b')+_0x438bdd[_0xa1fc('0x25')]+')'},'headers':{'Authorization':_0xa1fc('0x1a')+_0x4ef3ba,'OData-Version':_0xa1fc('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x47d06b['body'][_0x26fbf6]=_0x4b5b45;return rp(_0x47d06b);})[_0xa1fc('0x14')](function(_0x32c461){var _0x4c638d=_0x32c461['headers'][_0xa1fc('0x2c')];var _0x36c5aa=_0x4c638d[_0xa1fc('0x2d')](_0x4c638d['lastIndexOf']('(')+0x1,_0x4c638d[_0xa1fc('0x2e')](')'));_0x438bdd['enduserId']=_0x36c5aa;_0x3dcd8b(_0x438bdd);})[_0xa1fc('0x2f')](function(_0x39fd27){_0x344181(_0x39fd27[_0xa1fc('0x17')]);});});}function getEndUser(_0x1afa0a,_0x6ebf8c,_0x1b89b9,_0x231982,_0x1bbce9,_0x5d64b8,_0x32309a,_0x299a97){var _0x546487=_0x5d64b8[_0xa1fc('0x30')]()==='outbound'?_0x1bbce9[_0xa1fc('0x28')]:_0x1bbce9[_0xa1fc('0x29')];return getAuthToken(_0x6ebf8c,_0x1b89b9,_0x5d64b8)[_0xa1fc('0x14')](function(_0x322e59){_0x299a97=_0x299a97?_0x299a97:_0xa1fc('0x31');var _0x314278={'method':_0xa1fc('0x18'),'uri':_0x231982+_0xa1fc('0x32')+_0x299a97+_0xa1fc('0x33')+_0x299a97+_0xa1fc('0x34')+_0x546487[_0xa1fc('0x35')]('+','%2b')+'\x27','headers':{'Authorization':_0xa1fc('0x1a')+_0x322e59,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x314278);})[_0xa1fc('0x14')](function(_0x99f37e){var _0x37954e=![];if(!_0x99f37e)return _0x37954e;var _0x18f4d1=_0x99f37e[_0xa1fc('0x36')];for(var _0x4a07d2=0x0;_0x4a07d2<_0x18f4d1['length'];_0x4a07d2++){if(_0x18f4d1[_0x4a07d2][_0x299a97]===_0x546487){_0x37954e=!![];_0x1afa0a[_0xa1fc('0x37')]=_0x18f4d1[_0x4a07d2][_0xa1fc('0x38')];}}return _0x37954e;})[_0xa1fc('0x14')](function(_0x4f7fd8){if(_0x4f7fd8)return _0x1afa0a;if(_0x32309a===_0xa1fc('0x39')){logger['info']('['+[_0x5d64b8[_0xa1fc('0x16')]()]+_0xa1fc('0x3a'));return _0x1afa0a;}return createEndUser(_0x1afa0a,_0x6ebf8c,_0x1b89b9,_0x231982,_0x1bbce9,_0x5d64b8,_0x299a97)[_0xa1fc('0x14')](function(_0x3f4c2e){logger[_0xa1fc('0x22')]('['+[_0x5d64b8[_0xa1fc('0x16')]()]+_0xa1fc('0x3b'),_0x3f4c2e[_0xa1fc('0x37')]);return _0x3f4c2e;});});}function getCustomFields(_0x32f069,_0x1007d3,_0x335841){var _0x4e4c25={};if(_0x32f069[_0xa1fc('0x3c')]>0x0){_[_0xa1fc('0x3d')](_0x32f069,function(_0x3a359f){if(_[_0xa1fc('0x3e')]([_0xa1fc('0x3f'),_0xa1fc('0x40')],_0x3a359f[_0xa1fc('0x41')])&&_0x3a359f[_0xa1fc('0x42')]&&!_0x3a359f[_0xa1fc('0x43')]){var _0x397fe4=_0x3a359f['idField'][_0xa1fc('0x30')]();var _0x2bf82f=_0x397fe4[_0xa1fc('0x2d')](0x0,_0x397fe4[_0xa1fc('0x44')]('_'));var _0x2024b8=_0x397fe4[_0xa1fc('0x2d')](_0x397fe4[_0xa1fc('0x44')]('_')+0x1);if(_0x2bf82f===_0x335841){_0x4e4c25[_0x2024b8]=_0x3a359f[_0xa1fc('0x45')];}}});}return _0x4e4c25;}function getTicket(_0x54959e,_0x41e651,_0x3466b7,_0x59681a,_0x114f74,_0x11bb97,_0xc07648){return new Promise(function(_0xdaf429,_0xc962ce){var _0x46aa7f;return getAuthToken(_0x41e651,_0x3466b7,_0xc07648)[_0xa1fc('0x14')](function(_0x3cb073){if(_0x11bb97[_0xa1fc('0x46')]===_0xa1fc('0x47')){_0x46aa7f={'method':_0xa1fc('0x48'),'uri':_0x59681a+_0xa1fc('0x49'),'body':Object['assign']({},{'title':intUtil[_0xa1fc('0x4a')](_0x11bb97['Subjects'],_0x114f74,'\x20'),'description':intUtil[_0xa1fc('0x4a')](_0x11bb97['Descriptions'],_0x114f74,'\x0a'),'customerid_contact@odata.bind':_0x54959e[_0xa1fc('0x37')]?_0xa1fc('0x4b')+_0x54959e[_0xa1fc('0x37')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x54959e[_0xa1fc('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x11bb97[_0xa1fc('0x4c')],_0x114f74,_0x11bb97[_0xa1fc('0x46')])),'headers':{'Authorization':_0xa1fc('0x1a')+_0x3cb073,'OData-Version':_0xa1fc('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x11bb97[_0xa1fc('0x46')]===_0xa1fc('0x4d')){var _0x5d0fd6=_0x54959e[_0xa1fc('0x37')]?[{'partyid_systemuser@odata.bind':_0xa1fc('0x2b')+_0x54959e[_0xa1fc('0x25')]+')','participationtypemask':_0x54959e[_0xa1fc('0x4e')]===_0xa1fc('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0xa1fc('0x4b')+_0x54959e['enduserId']+')','participationtypemask':_0x54959e[_0xa1fc('0x4e')]===_0xa1fc('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xa1fc('0x2b')+_0x54959e[_0xa1fc('0x25')]+')','participationtypemask':_0x54959e['callDirection']===_0xa1fc('0x4f')?0x2:0x1}];_0x46aa7f={'method':_0xa1fc('0x48'),'uri':_0x59681a+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0xa1fc('0x4a')](_0x11bb97[_0xa1fc('0x50')],_0x114f74,'\x20'),'phonenumber':String(_0x114f74[_0xa1fc('0x29')]),'description':intUtil[_0xa1fc('0x4a')](_0x11bb97[_0xa1fc('0x51')],_0x114f74,'\x0a'),'regardingobjectid_contact@odata.bind':_0x54959e[_0xa1fc('0x37')]?_0xa1fc('0x4b')+_0x54959e[_0xa1fc('0x37')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x54959e['userId']+')','directioncode':_0x54959e['callDirection']===_0xa1fc('0x4f')?![]:!![],'phonecall_activity_parties':_0x5d0fd6},getCustomFields(_0x11bb97[_0xa1fc('0x4c')],_0x114f74,_0x11bb97[_0xa1fc('0x46')])),'headers':{'Authorization':_0xa1fc('0x1a')+_0x3cb073,'OData-Version':_0xa1fc('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x46aa7f);})['then'](function(_0x4f52b4){var _0x2dcb58=_0x4f52b4[_0xa1fc('0x52')][_0xa1fc('0x2c')];var _0x569ff8=_0x2dcb58[_0xa1fc('0x2d')](_0x2dcb58[_0xa1fc('0x2e')]('(')+0x1,_0x2dcb58['lastIndexOf'](')'));_0x54959e[_0xa1fc('0x53')]=_0x569ff8;_0xdaf429(_0x54959e);})[_0xa1fc('0x2f')](function(_0x2161b7){_0xc962ce(_0x2161b7[_0xa1fc('0x17')]);});});}function emit(_0x4b19e1,_0x198e2c,_0x1f6cd3,_0x3e9dec){var _0x3a7b57={'uri':util[_0xa1fc('0x54')](_0xa1fc('0x55'),_0x4b19e1,_0x1f6cd3,_0x3e9dec)};io['to'](util[_0xa1fc('0x54')](_0xa1fc('0x56'),_0x198e2c))['emit'](_0xa1fc('0x57'),_0x3a7b57);}exports['cs']=function(_0x123947,_0x59752f,_0x376aa8,_0x420668,_0x42278a,_0x3e7b1c,_0x4c9714,_0x29e50c){var _0x14875a={};_0x3e7b1c[_0xa1fc('0xd')]=_0x3e7b1c[_0xa1fc('0xc')]?intUtil[_0xa1fc('0x58')](_0x3e7b1c[_0xa1fc('0x59')][_0xa1fc('0xe')]):intUtil['stripTrailingSlash'](_0x3e7b1c[_0xa1fc('0xd')]);_0x3e7b1c[_0xa1fc('0x5a')]=intUtil[_0xa1fc('0x58')](_0x3e7b1c[_0xa1fc('0x5a')]);_0x14875a[_0xa1fc('0x4e')]=_0x29e50c===_0xa1fc('0x4f')||_0x29e50c===_0xa1fc('0x5b')?_0xa1fc('0x4f'):'outbound';var _0x48de44=_0x3e7b1c[_0xa1fc('0xc')]?util[_0xa1fc('0x54')](_0xa1fc('0x5c'),_0x3e7b1c[_0xa1fc('0x59')][_0xa1fc('0xe')]):util[_0xa1fc('0x54')](_0xa1fc('0x5c'),_0x3e7b1c[_0xa1fc('0xd')]);var _0x5621f3=util[_0xa1fc('0x54')](_0xa1fc('0x5d'),_0x3e7b1c[_0xa1fc('0x5e')]);var _0x239d6f=util[_0xa1fc('0x54')](_0xa1fc('0x5f'),_0x3e7b1c[_0xa1fc('0x5a')],_0x59752f[_0xa1fc('0x60')],md5(_0x59752f[_0xa1fc('0x60')]));if(_0x42278a&&_0x42278a[_0xa1fc('0x61')]){logger[_0xa1fc('0x22')]('[QUEUE]','Recording\x20is\x20enabled!');_0x59752f[_0xa1fc('0x62')]=_0x239d6f;}else if(_0x4c9714&&_0x4c9714['recordingFormat']&&_0x4c9714[_0xa1fc('0x63')]!=='none'){logger[_0xa1fc('0x22')]('[OUTBOUND]',_0xa1fc('0x64'));_0x59752f[_0xa1fc('0x62')]=_0x239d6f;}else{_0x59752f[_0xa1fc('0x62')]='';}return getUser(_0x14875a,_0x3e7b1c,_0x420668,_0x5621f3,_0x48de44,_0x29e50c)[_0xa1fc('0x14')](function(_0x2a2a8e){logger[_0xa1fc('0x22')]('['+_0x29e50c['toUpperCase']()+_0xa1fc('0x65'),_0x2a2a8e[_0xa1fc('0x25')]);logger['info']('['+_0x29e50c['toUpperCase']()+_0xa1fc('0x66'),_0x2a2a8e[_0xa1fc('0x1f')]);return getEndUser(_0x2a2a8e,_0x3e7b1c,_0x5621f3,_0x48de44,_0x59752f,_0x29e50c,_0x376aa8[_0xa1fc('0x67')],_0x376aa8['additionalSearchContact']);})[_0xa1fc('0x14')](function(_0x5b9908){logger[_0xa1fc('0x22')]('['+_0x29e50c[_0xa1fc('0x16')]()+_0xa1fc('0x68'),_0x5b9908[_0xa1fc('0x37')]);logger['info']('['+_0x29e50c['toUpperCase']()+_0xa1fc('0x69'),_0x59752f[_0xa1fc('0x29')]);return getTicket(_0x5b9908,_0x3e7b1c,_0x5621f3,_0x48de44,_0x59752f,_0x376aa8,_0x29e50c);})['then'](function(_0x18576d){logger['info'](util[_0xa1fc('0x54')]('['+_0x29e50c[_0xa1fc('0x16')]()+_0xa1fc('0x6a'),_0x376aa8[_0xa1fc('0x46')],_0x18576d[_0xa1fc('0x53')]));logger[_0xa1fc('0x22')](util[_0xa1fc('0x54')]('['+_0x29e50c['toUpperCase']()+_0xa1fc('0x6b'),_0x29e50c));if(_0x29e50c!==_0xa1fc('0x5b')&&_0x376aa8[_0xa1fc('0x6c')]){logger[_0xa1fc('0x22')]('['+_0x29e50c[_0xa1fc('0x16')]()+']',_0xa1fc('0x6d'));emit(_0x3e7b1c['remoteUri'],_0x420668['name'],_0x376aa8[_0xa1fc('0x46')],_0x18576d[_0xa1fc('0x53')]);}})[_0xa1fc('0x2f')](function(_0x1de108){logger[_0xa1fc('0x15')]('['+_0x29e50c[_0xa1fc('0x16')]()+_0xa1fc('0x6e'),_0x1de108[_0xa1fc('0x17')]);console['error'](_0xa1fc('0x6f'),_0x1de108);});}; \ No newline at end of file +var _0x246c=['modernAuthentication','data7','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','tenantId','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','remoteUri','CloudProvider','resolve','clientId','username','password','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','userId','systemuserid','info','catch','outbound','destcalleridnum','POST','contacts','4.0','body','headers','odata-entityid','lastIndexOf','enduserId','calleridnum','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','idField','toLowerCase','substring','indexOf','content','ticketType','incidents','assign','Subjects','getString','Descriptions','/contacts(','/systemusers(','phonecall','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s'];(function(_0x46ff4a,_0x1b501b){var _0x2a2a31=function(_0x544d81){while(--_0x544d81){_0x46ff4a['push'](_0x46ff4a['shift']());}};_0x2a2a31(++_0x1b501b);}(_0x246c,0x14a));var _0xc246=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x246c[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xc246('0x0'));var rp=require(_0xc246('0x1'));var util=require('util');var intUtil=require(_0xc246('0x2'));var md5=require('md5');var Redis=require('ioredis');var logger=require(_0xc246('0x3'))(_0xc246('0x4'));var config=require(_0xc246('0x5'));config[_0xc246('0x6')]=_[_0xc246('0x7')](config[_0xc246('0x6')],{'host':_0xc246('0x8'),'port':0x18eb});var io=require(_0xc246('0x9'))(new Redis(config[_0xc246('0x6')]));function getAuthToken(_0x509830,_0x1e5edd,_0x572e63){if(_0x509830['modernAuthentication']){_0x509830[_0xc246('0xa')]=_0x509830[_0xc246('0xb')]['data7'];_0x509830['tenantId']=_0x509830[_0xc246('0xb')]['data2'];return Promise[_0xc246('0xc')](_0x509830[_0xc246('0xb')]['data5']);}var _0x55136f={'method':'POST','uri':_0x1e5edd,'form':{'client_id':_0x509830[_0xc246('0xd')],'resource':_0x509830['remoteUri'],'username':_0x509830[_0xc246('0xe')],'password':_0x509830[_0xc246('0xf')],'grant_type':'password','client_secret':_0x509830['clientSecret']},'json':!![]};return rp(_0x55136f)[_0xc246('0x10')](function(_0x4ca8e4){return _0x4ca8e4[_0xc246('0x11')];})['catch'](function(_0x447caa){logger[_0xc246('0x12')]('['+[_0x572e63[_0xc246('0x13')]()]+_0xc246('0x14'));return _0x447caa[_0xc246('0x15')];});}function getUser(_0x59645c,_0x5363be,_0x3e4df7,_0x91ecfa,_0x241b92,_0xbb7263){return new Promise(function(_0x40e894,_0x1f5875){return getAuthToken(_0x5363be,_0x91ecfa,_0xbb7263)[_0xc246('0x10')](function(_0x29bbce){var _0x2226dd={'method':'GET','uri':_0x241b92+_0xc246('0x16'),'headers':{'Authorization':_0xc246('0x17')+_0x29bbce,'OData-Version':'4.0'},'json':!![]};return rp(_0x2226dd);})[_0xc246('0x10')](function(_0x4ae7bc){var _0x57a5c0=_0x4ae7bc[_0xc246('0x18')];var _0x5863ac=![];var _0x488d2c=null;if(!_[_0xc246('0x19')](_0x3e4df7)){if(intUtil[_0xc246('0x1a')](_0x3e4df7[_0xc246('0x1b')])){_0x59645c[_0xc246('0x1c')]=_0x3e4df7[_0xc246('0x1b')];for(_0x488d2c=0x0;_0x488d2c<_0x57a5c0[_0xc246('0x1d')];_0x488d2c++){if(_0x57a5c0[_0x488d2c][_0xc246('0x1e')]===_0x3e4df7[_0xc246('0x1b')]&&!_0x57a5c0[_0x488d2c][_0xc246('0x1f')]){_0x5863ac=!![];logger['info']('['+[_0xbb7263[_0xc246('0x13')]()]+_0xc246('0x20')+_0x57a5c0[_0x488d2c]['systemuserid']+'!');_0x59645c[_0xc246('0x21')]=_0x57a5c0[_0x488d2c][_0xc246('0x22')];}}}}if(!_0x5863ac){logger[_0xc246('0x23')]('['+[_0xbb7263[_0xc246('0x13')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x59645c[_0xc246('0x1c')]=_0x5363be[_0xc246('0xe')];for(_0x488d2c=0x0;_0x488d2c<_0x57a5c0['length'];_0x488d2c++){if(_0x57a5c0[_0x488d2c]['internalemailaddress']===_0x5363be['username']){_0x59645c[_0xc246('0x21')]=_0x57a5c0[_0x488d2c][_0xc246('0x22')];}}}_0x40e894(_0x59645c);})[_0xc246('0x24')](function(_0x5e7604){_0x1f5875(_0x5e7604[_0xc246('0x15')]);});});}function createEndUser(_0x4cb3e0,_0x465ee0,_0x48d1ef,_0x4aa10d,_0x3a4be6,_0x5d1b5a,_0x430c35){return new Promise(function(_0x494d55,_0x3791ef){return getAuthToken(_0x465ee0,_0x48d1ef,_0x5d1b5a)[_0xc246('0x10')](function(_0x5f3029){var _0x276c2a=_0x5d1b5a['toLowerCase']()===_0xc246('0x25')?_0x3a4be6[_0xc246('0x26')]:_0x3a4be6['calleridnum'];var _0x1d54fb={'method':_0xc246('0x27'),'uri':_0x4aa10d+_0xc246('0x28'),'body':{'fullname':_0x276c2a,'firstname':_0x276c2a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x4cb3e0['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x5f3029,'OData-Version':_0xc246('0x29')},'json':!![],'resolveWithFullResponse':!![]};_0x1d54fb[_0xc246('0x2a')][_0x430c35]=_0x276c2a;return rp(_0x1d54fb);})['then'](function(_0x318299){var _0x5108d7=_0x318299[_0xc246('0x2b')][_0xc246('0x2c')];var _0x4bd887=_0x5108d7['substring'](_0x5108d7[_0xc246('0x2d')]('(')+0x1,_0x5108d7[_0xc246('0x2d')](')'));_0x4cb3e0[_0xc246('0x2e')]=_0x4bd887;_0x494d55(_0x4cb3e0);})[_0xc246('0x24')](function(_0x38eb1f){_0x3791ef(_0x38eb1f[_0xc246('0x15')]);});});}function getEndUser(_0x31e9ea,_0x3a0163,_0x271b6c,_0x5a916e,_0x2d3f56,_0x265421,_0x3f85e3,_0x5792f4){var _0xd7f024=_0x265421['toLowerCase']()===_0xc246('0x25')?_0x2d3f56[_0xc246('0x26')]:_0x2d3f56[_0xc246('0x2f')];return getAuthToken(_0x3a0163,_0x271b6c,_0x265421)['then'](function(_0x2ab698){_0x5792f4=_0x5792f4?_0x5792f4:_0xc246('0x30');var _0x4da498={'method':_0xc246('0x31'),'uri':_0x5a916e+_0xc246('0x32')+_0x5792f4+_0xc246('0x33')+_0x5792f4+_0xc246('0x34')+_0xd7f024[_0xc246('0x35')]('+',_0xc246('0x36'))+'\x27','headers':{'Authorization':_0xc246('0x17')+_0x2ab698,'If-None-Match':null,'OData-Version':_0xc246('0x29')},'json':!![]};return rp(_0x4da498);})[_0xc246('0x10')](function(_0x2e6a3d){var _0x1127ac=![];if(!_0x2e6a3d)return _0x1127ac;var _0x6e08ef=_0x2e6a3d[_0xc246('0x18')];for(var _0x3fcf88=0x0;_0x3fcf88<_0x6e08ef[_0xc246('0x1d')];_0x3fcf88++){if(_0x6e08ef[_0x3fcf88][_0x5792f4]===_0xd7f024){_0x1127ac=!![];_0x31e9ea[_0xc246('0x2e')]=_0x6e08ef[_0x3fcf88][_0xc246('0x37')];}}return _0x1127ac;})[_0xc246('0x10')](function(_0x496a95){if(_0x496a95)return _0x31e9ea;if(_0x3f85e3===_0xc246('0x38')){logger['info']('['+[_0x265421[_0xc246('0x13')]()]+_0xc246('0x39'));return _0x31e9ea;}return createEndUser(_0x31e9ea,_0x3a0163,_0x271b6c,_0x5a916e,_0x2d3f56,_0x265421,_0x5792f4)[_0xc246('0x10')](function(_0xee9b08){logger[_0xc246('0x23')]('['+[_0x265421['toUpperCase']()]+_0xc246('0x3a'),_0xee9b08[_0xc246('0x2e')]);return _0xee9b08;});});}function getCustomFields(_0x6f422b,_0x31d702,_0x193064){var _0x446816={};if(_0x6f422b['length']>0x0){_[_0xc246('0x3b')](_0x6f422b,function(_0x49e955){if(_[_0xc246('0x3c')]([_0xc246('0x3d'),_0xc246('0x3e')],_0x49e955['type'])&&_0x49e955['nameField']&&!_0x49e955['customField']){var _0x153c02=_0x49e955[_0xc246('0x3f')][_0xc246('0x40')]();var _0xea6229=_0x153c02[_0xc246('0x41')](0x0,_0x153c02[_0xc246('0x42')]('_'));var _0x36ef41=_0x153c02[_0xc246('0x41')](_0x153c02[_0xc246('0x42')]('_')+0x1);if(_0xea6229===_0x193064){_0x446816[_0x36ef41]=_0x49e955[_0xc246('0x43')];}}});}return _0x446816;}function getTicket(_0x316d8f,_0x5dd25f,_0xc6ebe1,_0x31dc85,_0x34b45e,_0x34325f,_0x3b5fc5){return new Promise(function(_0x52a2ed,_0x560517){var _0x40217c;return getAuthToken(_0x5dd25f,_0xc6ebe1,_0x3b5fc5)[_0xc246('0x10')](function(_0x50e101){if(_0x34325f[_0xc246('0x44')]==='incident'){_0x40217c={'method':'POST','uri':_0x31dc85+_0xc246('0x45'),'body':Object[_0xc246('0x46')]({},{'title':intUtil['getString'](_0x34325f[_0xc246('0x47')],_0x34b45e,'\x20'),'description':intUtil[_0xc246('0x48')](_0x34325f[_0xc246('0x49')],_0x34b45e,'\x0a'),'customerid_contact@odata.bind':_0x316d8f[_0xc246('0x2e')]?_0xc246('0x4a')+_0x316d8f['enduserId']+')':undefined,'ownerid@odata.bind':_0xc246('0x4b')+_0x316d8f[_0xc246('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x34325f['Fields'],_0x34b45e,_0x34325f[_0xc246('0x44')])),'headers':{'Authorization':_0xc246('0x17')+_0x50e101,'OData-Version':_0xc246('0x29')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x34325f[_0xc246('0x44')]===_0xc246('0x4c')){var _0x16b002=_0x316d8f[_0xc246('0x2e')]?[{'partyid_systemuser@odata.bind':_0xc246('0x4b')+_0x316d8f[_0xc246('0x21')]+')','participationtypemask':_0x316d8f[_0xc246('0x4d')]===_0xc246('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0xc246('0x4a')+_0x316d8f[_0xc246('0x2e')]+')','participationtypemask':_0x316d8f['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x316d8f[_0xc246('0x21')]+')','participationtypemask':_0x316d8f[_0xc246('0x4d')]==='queue'?0x2:0x1}];_0x40217c={'method':_0xc246('0x27'),'uri':_0x31dc85+'phonecalls','body':Object[_0xc246('0x46')]({},{'subject':intUtil[_0xc246('0x48')](_0x34325f[_0xc246('0x47')],_0x34b45e,'\x20'),'phonenumber':String(_0x34b45e[_0xc246('0x2f')]),'description':intUtil['getString'](_0x34325f['Descriptions'],_0x34b45e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x316d8f[_0xc246('0x2e')]?_0xc246('0x4a')+_0x316d8f[_0xc246('0x2e')]+')':undefined,'ownerid@odata.bind':_0xc246('0x4b')+_0x316d8f[_0xc246('0x21')]+')','directioncode':_0x316d8f[_0xc246('0x4d')]===_0xc246('0x4e')?![]:!![],'phonecall_activity_parties':_0x16b002},getCustomFields(_0x34325f['Fields'],_0x34b45e,_0x34325f[_0xc246('0x44')])),'headers':{'Authorization':'Bearer\x20'+_0x50e101,'OData-Version':_0xc246('0x29')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x40217c);})[_0xc246('0x10')](function(_0x17df58){var _0x3dff92=_0x17df58[_0xc246('0x2b')]['odata-entityid'];var _0x1c0a35=_0x3dff92[_0xc246('0x41')](_0x3dff92['lastIndexOf']('(')+0x1,_0x3dff92[_0xc246('0x2d')](')'));_0x316d8f[_0xc246('0x4f')]=_0x1c0a35;_0x52a2ed(_0x316d8f);})[_0xc246('0x24')](function(_0xcd063e){_0x560517(_0xcd063e[_0xc246('0x15')]);});});}function emit(_0x4d9737,_0x5002a2,_0x3fe324,_0x4f92ba){var _0xb292={'uri':util[_0xc246('0x50')](_0xc246('0x51'),_0x4d9737,_0x3fe324,_0x4f92ba)};io['to'](util[_0xc246('0x50')]('user:%s',_0x5002a2))['emit']('trigger:browser:url',_0xb292);}exports['cs']=function(_0xca17a0,_0x410c89,_0x24973d,_0x18945d,_0x574690,_0x130246,_0x1f01e1,_0x1b3bff){var _0x192c9b={};_0x130246['remoteUri']=_0x130246[_0xc246('0x52')]?intUtil['stripTrailingSlash'](_0x130246[_0xc246('0xb')][_0xc246('0x53')]):intUtil[_0xc246('0x54')](_0x130246['remoteUri']);_0x130246[_0xc246('0x55')]=intUtil[_0xc246('0x54')](_0x130246[_0xc246('0x55')]);_0x192c9b[_0xc246('0x4d')]=_0x1b3bff===_0xc246('0x4e')||_0x1b3bff==='unmanaged'?_0xc246('0x4e'):_0xc246('0x25');var _0x10564f=_0x130246[_0xc246('0x52')]?util[_0xc246('0x50')](_0xc246('0x56'),_0x130246[_0xc246('0xb')][_0xc246('0x53')]):util[_0xc246('0x50')]('%s/api/data/v9.0/',_0x130246[_0xc246('0xa')]);var _0x2ad38b=util[_0xc246('0x50')]('https://login.microsoftonline.com/%s/oauth2/token',_0x130246[_0xc246('0x57')]);var _0x208509=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x130246['serverUrl'],_0x410c89[_0xc246('0x58')],md5(_0x410c89['uniqueid']));if(_0x574690&&_0x574690['monitor_format']){logger[_0xc246('0x23')](_0xc246('0x59'),_0xc246('0x5a'));_0x410c89[_0xc246('0x5b')]=_0x208509;}else if(_0x1f01e1&&_0x1f01e1[_0xc246('0x5c')]&&_0x1f01e1['recordingFormat']!==_0xc246('0x5d')){logger['info'](_0xc246('0x5e'),_0xc246('0x5a'));_0x410c89[_0xc246('0x5b')]=_0x208509;}else{_0x410c89[_0xc246('0x5b')]='';}return getUser(_0x192c9b,_0x130246,_0x18945d,_0x2ad38b,_0x10564f,_0x1b3bff)[_0xc246('0x10')](function(_0x56a8a8){logger[_0xc246('0x23')]('['+_0x1b3bff['toUpperCase']()+_0xc246('0x5f'),_0x56a8a8[_0xc246('0x21')]);logger[_0xc246('0x23')]('['+_0x1b3bff[_0xc246('0x13')]()+']\x20The\x20User\x20email\x20is:',_0x56a8a8['userEmail']);return getEndUser(_0x56a8a8,_0x130246,_0x2ad38b,_0x10564f,_0x410c89,_0x1b3bff,_0x24973d[_0xc246('0x60')],_0x24973d['additionalSearchContact']);})['then'](function(_0x2a2bf3){logger[_0xc246('0x23')]('['+_0x1b3bff[_0xc246('0x13')]()+_0xc246('0x61'),_0x2a2bf3[_0xc246('0x2e')]);logger[_0xc246('0x23')]('['+_0x1b3bff[_0xc246('0x13')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x410c89[_0xc246('0x2f')]);return getTicket(_0x2a2bf3,_0x130246,_0x2ad38b,_0x10564f,_0x410c89,_0x24973d,_0x1b3bff);})['then'](function(_0x2e8ec6){logger[_0xc246('0x23')](util['format']('['+_0x1b3bff['toUpperCase']()+_0xc246('0x62'),_0x24973d[_0xc246('0x44')],_0x2e8ec6[_0xc246('0x4f')]));logger[_0xc246('0x23')](util['format']('['+_0x1b3bff[_0xc246('0x13')]()+_0xc246('0x63'),_0x1b3bff));if(_0x1b3bff!==_0xc246('0x64')&&_0x24973d['openNewTab']){logger[_0xc246('0x23')]('['+_0x1b3bff[_0xc246('0x13')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x130246[_0xc246('0xa')],_0x18945d[_0xc246('0x65')],_0x24973d[_0xc246('0x44')],_0x2e8ec6[_0xc246('0x4f')]);}})['catch'](function(_0x3d6c34){logger[_0xc246('0x12')]('['+_0x1b3bff[_0xc246('0x13')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x3d6c34['message']);console[_0xc246('0x12')](_0xc246('0x66'),_0x3d6c34);});}; \ 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 f35a0b0..f6ff6dc 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 _0xe82b=['Descriptions','
','Tags','name','Fields','custom_fields','keyBy','value','format','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','destcalleridname','destcalleridnum','catch','unmanaged','lastevent','toUpperCase','lodash','request-promise','util','./util','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','Caller\x20-\x20%s','calleridname','getString'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe82b,0x1b2));var _0xbe82=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xe82b[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xbe82('0x0'));var rp=require(_0xbe82('0x1'));var md5=require('md5');var util=require(_0xbe82('0x2'));var Redis=require('ioredis');var intUtil=require(_0xbe82('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe82('0x4'))(_0xbe82('0x5'));config['redis']=_['defaults'](config[_0xbe82('0x6')],{'host':_0xbe82('0x7'),'port':0x18eb});var io=require(_0xbe82('0x8'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0xbe82('0x9')};function emit(_0x3ecb6a,_0x4aadc4,_0x3c69f3){io['to'](_0x3ecb6a)[_0xbe82('0xa')](_0x4aadc4,_0x3c69f3);}function getTicket(_0x3f0dd2,_0x4292ff,_0x198a02,_0x314292,_0x4bf757){logger[_0xbe82('0xb')](_0xbe82('0xc'));var _0x24b4a5=_['merge']({'responder_id':_0x4292ff['id'],'requester_id':_0x198a02['id'],'name':util['format'](_0xbe82('0xd'),_0x4bf757[_0xbe82('0xe')]),'phone':_0x4bf757['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xbe82('0xf')](_0x314292['Subjects'],_0x4bf757,'\x20'),'description':intUtil[_0xbe82('0xf')](_0x314292[_0xbe82('0x10')],_0x4bf757,_0xbe82('0x11')),'tags':getTags(_0x314292[_0xbe82('0x12')],_0xbe82('0x13'))},getCustomFields(_0x314292[_0xbe82('0x14')],_0x4bf757));_0x24b4a5[_0xbe82('0x15')]=_['mapValues'](_[_0xbe82('0x16')](_0x24b4a5[_0xbe82('0x15')],'id'),_0xbe82('0x17'));return request({'uri':util[_0xbe82('0x18')]('%s/api/v2/tickets',_0x3f0dd2[_0xbe82('0x19')]),'method':_0xbe82('0x1a'),'body':_0x24b4a5})[_0xbe82('0x1b')](function(_0x47588e){logger['info'](_0xbe82('0x1c'));return _0x47588e;});}function getUser(_0x2fc03c,_0x2869a8){if(intUtil[_0xbe82('0x1d')](_0x2869a8)){return request({'uri':util[_0xbe82('0x18')](_0xbe82('0x1e'),_0x2fc03c['remoteUri']),'qs':{'email':_0x2869a8}})[_0xbe82('0x1b')](function(_0x319cb4){if(_0x319cb4[_0xbe82('0x1f')]){logger[_0xbe82('0xb')](_0xbe82('0x20'));return _[_0xbe82('0x21')](_0x319cb4,function(_0x12a01d){return _0x12a01d[_0xbe82('0x22')][_0xbe82('0x23')]===_0x2869a8;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/api/v2/agents/me',_0x2fc03c[_0xbe82('0x19')])})[_0xbe82('0x1b')](function(_0xaeb2fe){logger[_0xbe82('0xb')]('Admin\x20account\x20selected.');return _0xaeb2fe;});}});}else{logger[_0xbe82('0xb')](_0xbe82('0x24'));return request({'uri':util[_0xbe82('0x18')]('%s/api/v2/agents/me',_0x2fc03c[_0xbe82('0x19')])})[_0xbe82('0x1b')](function(_0x1a63de){logger[_0xbe82('0xb')]('Admin\x20account\x20selected.');return _0x1a63de;});}}function getEndUser(_0x1c737f,_0x2696a9,_0xd18b67){logger[_0xbe82('0xb')](_0xbe82('0x25'),_0xd18b67);return request({'uri':util[_0xbe82('0x18')]('%s/api/v2/contacts',_0x1c737f[_0xbe82('0x19')]),'qs':{'phone':_0xd18b67}})[_0xbe82('0x1b')](function(_0x382a50){if(_0x382a50[_0xbe82('0x1f')]){logger[_0xbe82('0xb')](_0xbe82('0x26'));return _[_0xbe82('0x21')](_0x382a50,{'phone':_0xd18b67});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe82('0x18')]('%s/api/v2/contacts',_0x1c737f[_0xbe82('0x19')]),'method':_0xbe82('0x1a'),'body':{'name':_0x2696a9,'phone':_0xd18b67}})['then'](function(_0x4eb732){logger['info']('Enduser\x20created.');return _0x4eb732;});}});}function getAuth(_0x512eb3){return util[_0xbe82('0x18')](_0xbe82('0x27'),new Buffer(_0x512eb3['apiKey']+':X')[_0xbe82('0x28')](_0xbe82('0x29')));}function request(_0x22a6f8){logger[_0xbe82('0x2a')](_0xbe82('0x2b'),JSON[_0xbe82('0x2c')](_0x22a6f8));return rp(_[_0xbe82('0x2d')](_0x22a6f8,{'method':_0xbe82('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x3ffc64,_0x3b4745){var _0x16b776=[];if(_0x3ffc64&&_0x3ffc64[_0xbe82('0x1f')]>0x0){_0x16b776=_[_0xbe82('0x2f')](_0x3ffc64,_0x3b4745);}return _0x16b776;}function getCustomFields(_0x1cca45,_0x45b5f2){var _0x2bb618=[];var _0x179f72={'custom_fields':[]};if(_0x1cca45[_0xbe82('0x1f')]>0x0){_['forEach'](_0x1cca45,function(_0x5bb035){if(_[_0xbe82('0x30')](['string',_0xbe82('0x31')],_0x5bb035[_0xbe82('0x32')])&&_0x5bb035[_0xbe82('0x33')]&&!_0x5bb035[_0xbe82('0x34')]){_0x179f72[_0x5bb035[_0xbe82('0x33')][_0xbe82('0x35')]()]=_0x5bb035[_0xbe82('0x36')][_0xbe82('0x28')]();}else if(_[_0xbe82('0x30')]([_0xbe82('0x37'),'picklist'],_0x5bb035['type'])&&_0x5bb035[_0xbe82('0x38')]&&_0x5bb035[_0xbe82('0x34')]){_0x179f72['custom_fields'][_0xbe82('0x39')]({'id':_0x5bb035[_0xbe82('0x38')],'value':_0x5bb035[_0xbe82('0x36')][_0xbe82('0x28')]()});}else if(_0x5bb035[_0xbe82('0x32')]===_0xbe82('0x3a')&&_0x5bb035[_0xbe82('0x3b')]&&_0x5bb035[_0xbe82('0x38')]&&_0x5bb035['customField']){_0x45b5f2[_0x5bb035[_0xbe82('0x3b')]]&&_0x179f72[_0xbe82('0x15')][_0xbe82('0x39')]({'id':_0x5bb035['idField'],'value':_0x45b5f2[_0x5bb035[_0xbe82('0x3b')]][_0xbe82('0x28')]()});}else if(_0x5bb035[_0xbe82('0x32')]===_0xbe82('0x3c')&&_0x5bb035['Variable']&&_0x5bb035['Variable'][_0xbe82('0x13')]&&_0x5bb035['idField']&&_0x5bb035[_0xbe82('0x34')]){_0x45b5f2[_0x5bb035['Variable'][_0xbe82('0x13')][_0xbe82('0x35')]()]&&_0x179f72['custom_fields'][_0xbe82('0x39')]({'id':_0x5bb035[_0xbe82('0x38')],'value':_0x45b5f2[_0x5bb035[_0xbe82('0x3d')][_0xbe82('0x13')][_0xbe82('0x35')]()][_0xbe82('0x28')]()});}});}return _0x179f72;}exports[_0xbe82('0x3e')]=function(_0x3badf1,_0x1becec,_0x336735,_0xf97a41,_0x45f52c,_0x12c65b){var _0x589f5c,_0x595577;_0x12c65b[_0xbe82('0x19')]=intUtil[_0xbe82('0x3f')](_0x12c65b[_0xbe82('0x19')]);_0x12c65b[_0xbe82('0x40')]=intUtil[_0xbe82('0x3f')](_0x12c65b[_0xbe82('0x40')]);if(_0x45f52c&&_0x45f52c[_0xbe82('0x41')]){logger['info'](_0xbe82('0x42'),'Recording\x20is\x20enabled!');_0x1becec['recordingURL']=util[_0xbe82('0x18')](_0xbe82('0x43'),_0x12c65b[_0xbe82('0x40')],_0x1becec['uniqueid'],md5(_0x1becec[_0xbe82('0x44')]));}else{_0x1becec[_0xbe82('0x45')]='';}headers['Authorization']=getAuth(_0x12c65b);return getUser(_0x12c65b,_0xf97a41['email'])[_0xbe82('0x1b')](function(_0x290df4){_0x589f5c=_0x290df4;logger[_0xbe82('0xb')](_0xbe82('0x46'),_0x589f5c['id']);return getEndUser(_0x12c65b,_0x1becec['calleridname'],_0x1becec[_0xbe82('0x47')]);})[_0xbe82('0x1b')](function(_0x5ca31a){_0x595577=_0x5ca31a;logger[_0xbe82('0xb')](_0xbe82('0x48'),_0x595577['id']);return getTicket(_0x12c65b,_0x589f5c,_0x595577,_0x336735,_0x1becec);})[_0xbe82('0x1b')](function(_0x114cd3){if(_0x114cd3&&_0x114cd3['id']){logger[_0xbe82('0xb')]('Ticket\x20created!');logger[_0xbe82('0xb')]('The\x20Ticket\x20ID\x20is:',_0x114cd3['id']);logger['info'](_0xbe82('0x42'),_0xbe82('0x49'));emit(util[_0xbe82('0x18')](_0xbe82('0x4a'),_0xf97a41[_0xbe82('0x13')]),_0xbe82('0x4b'),{'uri':util['format'](_0xbe82('0x4c'),_0x12c65b[_0xbe82('0x19')],_0x114cd3['id'])});}})['catch'](function(_0x40a96e){logger[_0xbe82('0x4d')]('[QUEUE]',JSON[_0xbe82('0x2c')](_0x40a96e));});};exports[_0xbe82('0x4e')]=function(_0xf4ebea,_0x28f23c,_0x1694f5,_0x4fa5f1,_0x1bdd9b,_0x9bde97,_0x243b09){var _0x1c4bd4,_0xb2aad;_0x9bde97[_0xbe82('0x19')]=intUtil['stripTrailingSlash'](_0x9bde97['remoteUri']);_0x9bde97[_0xbe82('0x40')]=intUtil['stripTrailingSlash'](_0x9bde97[_0xbe82('0x40')]);if(_0x243b09&&_0x243b09['recordingFormat']&&_0x243b09[_0xbe82('0x4f')]!==_0xbe82('0x50')){logger['info'](_0xbe82('0x51'),_0xbe82('0x52'));_0x28f23c[_0xbe82('0x45')]=util[_0xbe82('0x18')](_0xbe82('0x43'),_0x9bde97[_0xbe82('0x40')],_0x28f23c[_0xbe82('0x44')],md5(_0x28f23c[_0xbe82('0x44')]));}headers[_0xbe82('0x53')]=getAuth(_0x9bde97);return getUser(_0x9bde97,_0x4fa5f1[_0xbe82('0x23')])[_0xbe82('0x1b')](function(_0xa3f37d){_0x1c4bd4=_0xa3f37d;logger[_0xbe82('0xb')](_0xbe82('0x46'),_0x1c4bd4['id']);return getEndUser(_0x9bde97,_0x28f23c[_0xbe82('0x54')],_0x28f23c[_0xbe82('0x55')]);})[_0xbe82('0x1b')](function(_0x1584f2){_0xb2aad=_0x1584f2;logger[_0xbe82('0xb')](_0xbe82('0x48'),_0xb2aad['id']);return getTicket(_0x9bde97,_0x1c4bd4,_0xb2aad,_0x1694f5,_0x28f23c);})[_0xbe82('0x1b')](function(_0x3dcdb6){if(_0x3dcdb6&&_0x3dcdb6['id']){logger[_0xbe82('0xb')](_0xbe82('0x1c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x3dcdb6['id']);logger[_0xbe82('0xb')](_0xbe82('0x51'),_0xbe82('0x49'));emit(util[_0xbe82('0x18')](_0xbe82('0x4a'),_0x4fa5f1[_0xbe82('0x13')]),'trigger:browser:url',{'uri':util[_0xbe82('0x18')]('%s/helpdesk/tickets/%d',_0x9bde97[_0xbe82('0x19')],_0x3dcdb6['id'])});}})[_0xbe82('0x56')](function(_0x59e3d7){logger[_0xbe82('0x4d')]('[OUTBOUND]',JSON[_0xbe82('0x2c')](_0x59e3d7));});};exports[_0xbe82('0x57')]=function(_0x298d03,_0xa8534d,_0x48345d,_0x4d0f7d,_0x317854,_0x27faf5){var _0x81a5a5,_0x5b03c7;_0x27faf5[_0xbe82('0x19')]=intUtil[_0xbe82('0x3f')](_0x27faf5[_0xbe82('0x19')]);_0x27faf5[_0xbe82('0x40')]=intUtil[_0xbe82('0x3f')](_0x27faf5[_0xbe82('0x40')]);if(_0x317854&&_0x317854[_0xbe82('0x41')]){logger['info']('['+_0xa8534d[_0xbe82('0x58')][_0xbe82('0x59')]()+']',_0xbe82('0x52'));_0xa8534d[_0xbe82('0x45')]=util[_0xbe82('0x18')](_0xbe82('0x43'),_0x27faf5[_0xbe82('0x40')],_0xa8534d['uniqueid'],md5(_0xa8534d[_0xbe82('0x44')]));}else{_0xa8534d['recordingURL']='';}headers[_0xbe82('0x53')]=getAuth(_0x27faf5);return getUser(_0x27faf5,'')['then'](function(_0x5b1cc6){_0x81a5a5=_0x5b1cc6;logger[_0xbe82('0xb')](_0xbe82('0x46'),_0x81a5a5['id']);return getEndUser(_0x27faf5,_0xa8534d[_0xbe82('0xe')],_0xa8534d[_0xbe82('0x47')]);})[_0xbe82('0x1b')](function(_0xb112eb){_0x5b03c7=_0xb112eb;logger[_0xbe82('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5b03c7['id']);return getTicket(_0x27faf5,_0x81a5a5,_0x5b03c7,_0x48345d,_0xa8534d);})[_0xbe82('0x1b')](function(_0x34995f){if(_0x34995f){logger[_0xbe82('0xb')](_0xbe82('0x1c'));logger[_0xbe82('0xb')]('The\x20Ticket\x20ID\x20is:',_0x34995f['id']);}})[_0xbe82('0x56')](function(_0x144761){logger['error']('['+_0xa8534d[_0xbe82('0x58')][_0xbe82('0x59')]()+']',JSON[_0xbe82('0x2c')](_0x144761));});}; \ No newline at end of file +var _0x4dec=['Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','uniqueid','destcalleridname','destcalleridnum','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','application/json','Creating\x20new\x20ticket...','calleridnum','getString','Subjects','
','Tags','name','Fields','custom_fields','keyBy','format','remoteUri','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','info','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','find','%s/api/v2/contacts','Enduser\x20created.','apiKey','debug','[HTTP]','stringify','defaults','GET','forEach','includes','string','nameField','customField','toLowerCase','toString','picklist','type','idField','push','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:'];(function(_0x450076,_0x10983b){var _0x2029cc=function(_0x4a5e76){while(--_0x4a5e76){_0x450076['push'](_0x450076['shift']());}};_0x2029cc(++_0x10983b);}(_0x4dec,0x123));var _0xc4de=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4dec[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var rp=require(_0xc4de('0x0'));var md5=require(_0xc4de('0x1'));var util=require(_0xc4de('0x2'));var Redis=require(_0xc4de('0x3'));var intUtil=require(_0xc4de('0x4'));var config=require(_0xc4de('0x5'));var logger=require(_0xc4de('0x6'))(_0xc4de('0x7'));config[_0xc4de('0x8')]=_['defaults'](config[_0xc4de('0x8')],{'host':_0xc4de('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc4de('0x8')]));var headers={'Content-Type':_0xc4de('0xa'),'Accept':'application/json'};function emit(_0x1b914a,_0x242ca4,_0x86510a){io['to'](_0x1b914a)['emit'](_0x242ca4,_0x86510a);}function getTicket(_0x1e6384,_0x541739,_0x1c241e,_0x4af045,_0x57ed97){logger['info'](_0xc4de('0xb'));var _0x544018=_['merge']({'responder_id':_0x541739['id'],'requester_id':_0x1c241e['id'],'name':util['format']('Caller\x20-\x20%s',_0x57ed97['calleridname']),'phone':_0x57ed97[_0xc4de('0xc')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc4de('0xd')](_0x4af045[_0xc4de('0xe')],_0x57ed97,'\x20'),'description':intUtil[_0xc4de('0xd')](_0x4af045['Descriptions'],_0x57ed97,_0xc4de('0xf')),'tags':getTags(_0x4af045[_0xc4de('0x10')],_0xc4de('0x11'))},getCustomFields(_0x4af045[_0xc4de('0x12')],_0x57ed97));_0x544018[_0xc4de('0x13')]=_['mapValues'](_[_0xc4de('0x14')](_0x544018[_0xc4de('0x13')],'id'),'value');return request({'uri':util[_0xc4de('0x15')]('%s/api/v2/tickets',_0x1e6384[_0xc4de('0x16')]),'method':_0xc4de('0x17'),'body':_0x544018})['then'](function(_0x354778){logger['info'](_0xc4de('0x18'));return _0x354778;});}function getUser(_0xdc7351,_0x4c3caf){if(intUtil[_0xc4de('0x19')](_0x4c3caf)){return request({'uri':util['format'](_0xc4de('0x1a'),_0xdc7351[_0xc4de('0x16')]),'qs':{'email':_0x4c3caf}})[_0xc4de('0x1b')](function(_0x357441){if(_0x357441[_0xc4de('0x1c')]){logger[_0xc4de('0x1d')](_0xc4de('0x1e'));return _['find'](_0x357441,function(_0x33c5ad){return _0x33c5ad[_0xc4de('0x1f')][_0xc4de('0x20')]===_0x4c3caf;});}else{logger['info'](_0xc4de('0x21'));return request({'uri':util[_0xc4de('0x15')](_0xc4de('0x22'),_0xdc7351[_0xc4de('0x16')])})[_0xc4de('0x1b')](function(_0x4e1651){logger['info'](_0xc4de('0x23'));return _0x4e1651;});}});}else{logger[_0xc4de('0x1d')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xc4de('0x15')](_0xc4de('0x22'),_0xdc7351['remoteUri'])})[_0xc4de('0x1b')](function(_0x1a90dc){logger[_0xc4de('0x1d')]('Admin\x20account\x20selected.');return _0x1a90dc;});}}function getEndUser(_0x30bfb5,_0x42451c,_0x5b83ea){logger[_0xc4de('0x1d')](_0xc4de('0x24'),_0x5b83ea);return request({'uri':util[_0xc4de('0x15')]('%s/api/v2/contacts',_0x30bfb5[_0xc4de('0x16')]),'qs':{'phone':_0x5b83ea}})[_0xc4de('0x1b')](function(_0xf73f33){if(_0xf73f33[_0xc4de('0x1c')]){logger[_0xc4de('0x1d')]('Enduser\x20found!');return _[_0xc4de('0x25')](_0xf73f33,{'phone':_0x5b83ea});}else{logger[_0xc4de('0x1d')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xc4de('0x15')](_0xc4de('0x26'),_0x30bfb5[_0xc4de('0x16')]),'method':'POST','body':{'name':_0x42451c,'phone':_0x5b83ea}})[_0xc4de('0x1b')](function(_0x26744c){logger[_0xc4de('0x1d')](_0xc4de('0x27'));return _0x26744c;});}});}function getAuth(_0x29c6b6){return util[_0xc4de('0x15')]('Basic\x20%s',new Buffer(_0x29c6b6[_0xc4de('0x28')]+':X')['toString']('base64'));}function request(_0x12815d){logger[_0xc4de('0x29')](_0xc4de('0x2a'),JSON[_0xc4de('0x2b')](_0x12815d));return rp(_[_0xc4de('0x2c')](_0x12815d,{'method':_0xc4de('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x58f328,_0x40ca32){var _0xf6419e=[];if(_0x58f328&&_0x58f328[_0xc4de('0x1c')]>0x0){_0xf6419e=_['map'](_0x58f328,_0x40ca32);}return _0xf6419e;}function getCustomFields(_0x40244e,_0x11741f){var _0x32b5f3=[];var _0x19b9ff={'custom_fields':[]};if(_0x40244e['length']>0x0){_[_0xc4de('0x2e')](_0x40244e,function(_0x1663a2){if(_[_0xc4de('0x2f')]([_0xc4de('0x30'),'picklist'],_0x1663a2['type'])&&_0x1663a2[_0xc4de('0x31')]&&!_0x1663a2[_0xc4de('0x32')]){_0x19b9ff[_0x1663a2['nameField'][_0xc4de('0x33')]()]=_0x1663a2['content'][_0xc4de('0x34')]();}else if(_[_0xc4de('0x2f')]([_0xc4de('0x30'),_0xc4de('0x35')],_0x1663a2[_0xc4de('0x36')])&&_0x1663a2[_0xc4de('0x37')]&&_0x1663a2[_0xc4de('0x32')]){_0x19b9ff['custom_fields'][_0xc4de('0x38')]({'id':_0x1663a2[_0xc4de('0x37')],'value':_0x1663a2[_0xc4de('0x39')][_0xc4de('0x34')]()});}else if(_0x1663a2[_0xc4de('0x36')]===_0xc4de('0x3a')&&_0x1663a2[_0xc4de('0x3b')]&&_0x1663a2[_0xc4de('0x37')]&&_0x1663a2['customField']){_0x11741f[_0x1663a2[_0xc4de('0x3b')]]&&_0x19b9ff['custom_fields'][_0xc4de('0x38')]({'id':_0x1663a2[_0xc4de('0x37')],'value':_0x11741f[_0x1663a2[_0xc4de('0x3b')]]['toString']()});}else if(_0x1663a2[_0xc4de('0x36')]===_0xc4de('0x3c')&&_0x1663a2[_0xc4de('0x3d')]&&_0x1663a2[_0xc4de('0x3d')][_0xc4de('0x11')]&&_0x1663a2[_0xc4de('0x37')]&&_0x1663a2['customField']){_0x11741f[_0x1663a2[_0xc4de('0x3d')][_0xc4de('0x11')]['toLowerCase']()]&&_0x19b9ff[_0xc4de('0x13')][_0xc4de('0x38')]({'id':_0x1663a2[_0xc4de('0x37')],'value':_0x11741f[_0x1663a2[_0xc4de('0x3d')][_0xc4de('0x11')]['toLowerCase']()][_0xc4de('0x34')]()});}});}return _0x19b9ff;}exports[_0xc4de('0x3e')]=function(_0x4b2d03,_0x12b0ac,_0x357a8f,_0x514d86,_0x5a9513,_0x326f4b){var _0xd8d6ed,_0x160c7d;_0x326f4b[_0xc4de('0x16')]=intUtil[_0xc4de('0x3f')](_0x326f4b[_0xc4de('0x16')]);_0x326f4b[_0xc4de('0x40')]=intUtil['stripTrailingSlash'](_0x326f4b['serverUrl']);if(_0x5a9513&&_0x5a9513[_0xc4de('0x41')]){logger['info'](_0xc4de('0x42'),'Recording\x20is\x20enabled!');_0x12b0ac[_0xc4de('0x43')]=util['format'](_0xc4de('0x44'),_0x326f4b['serverUrl'],_0x12b0ac['uniqueid'],md5(_0x12b0ac['uniqueid']));}else{_0x12b0ac[_0xc4de('0x43')]='';}headers[_0xc4de('0x45')]=getAuth(_0x326f4b);return getUser(_0x326f4b,_0x514d86[_0xc4de('0x20')])[_0xc4de('0x1b')](function(_0x43703a){_0xd8d6ed=_0x43703a;logger['info']('The\x20User\x20ID\x20is:',_0xd8d6ed['id']);return getEndUser(_0x326f4b,_0x12b0ac[_0xc4de('0x46')],_0x12b0ac[_0xc4de('0xc')]);})['then'](function(_0x2592b1){_0x160c7d=_0x2592b1;logger[_0xc4de('0x1d')](_0xc4de('0x47'),_0x160c7d['id']);return getTicket(_0x326f4b,_0xd8d6ed,_0x160c7d,_0x357a8f,_0x12b0ac);})[_0xc4de('0x1b')](function(_0x2f569c){if(_0x2f569c&&_0x2f569c['id']){logger[_0xc4de('0x1d')](_0xc4de('0x18'));logger['info'](_0xc4de('0x48'),_0x2f569c['id']);logger[_0xc4de('0x1d')](_0xc4de('0x42'),_0xc4de('0x49'));emit(util[_0xc4de('0x15')](_0xc4de('0x4a'),_0x514d86['name']),_0xc4de('0x4b'),{'uri':util[_0xc4de('0x15')]('%s/helpdesk/tickets/%d',_0x326f4b[_0xc4de('0x16')],_0x2f569c['id'])});}})[_0xc4de('0x4c')](function(_0x5b4ebe){logger[_0xc4de('0x4d')](_0xc4de('0x42'),JSON['stringify'](_0x5b4ebe));});};exports[_0xc4de('0x4e')]=function(_0x19e9ea,_0x1616ae,_0x4d3cf0,_0x484de6,_0x5cfff0,_0x4e7d94,_0x1f93ed){var _0x5d7d5a,_0x44d6c7;_0x4e7d94[_0xc4de('0x16')]=intUtil[_0xc4de('0x3f')](_0x4e7d94[_0xc4de('0x16')]);_0x4e7d94['serverUrl']=intUtil['stripTrailingSlash'](_0x4e7d94[_0xc4de('0x40')]);if(_0x1f93ed&&_0x1f93ed[_0xc4de('0x4f')]&&_0x1f93ed[_0xc4de('0x4f')]!==_0xc4de('0x50')){logger[_0xc4de('0x1d')](_0xc4de('0x51'),_0xc4de('0x52'));_0x1616ae[_0xc4de('0x43')]=util[_0xc4de('0x15')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4e7d94[_0xc4de('0x40')],_0x1616ae[_0xc4de('0x53')],md5(_0x1616ae[_0xc4de('0x53')]));}headers['Authorization']=getAuth(_0x4e7d94);return getUser(_0x4e7d94,_0x484de6[_0xc4de('0x20')])['then'](function(_0x1459dd){_0x5d7d5a=_0x1459dd;logger[_0xc4de('0x1d')]('The\x20User\x20ID\x20is:',_0x5d7d5a['id']);return getEndUser(_0x4e7d94,_0x1616ae[_0xc4de('0x54')],_0x1616ae[_0xc4de('0x55')]);})[_0xc4de('0x1b')](function(_0x28f1a9){_0x44d6c7=_0x28f1a9;logger['info'](_0xc4de('0x47'),_0x44d6c7['id']);return getTicket(_0x4e7d94,_0x5d7d5a,_0x44d6c7,_0x4d3cf0,_0x1616ae);})[_0xc4de('0x1b')](function(_0x540b6c){if(_0x540b6c&&_0x540b6c['id']){logger['info'](_0xc4de('0x18'));logger[_0xc4de('0x1d')](_0xc4de('0x48'),_0x540b6c['id']);logger[_0xc4de('0x1d')]('[OUTBOUND]',_0xc4de('0x49'));emit(util[_0xc4de('0x15')](_0xc4de('0x4a'),_0x484de6[_0xc4de('0x11')]),_0xc4de('0x4b'),{'uri':util[_0xc4de('0x15')](_0xc4de('0x56'),_0x4e7d94['remoteUri'],_0x540b6c['id'])});}})[_0xc4de('0x4c')](function(_0xfa4721){logger[_0xc4de('0x4d')]('[OUTBOUND]',JSON['stringify'](_0xfa4721));});};exports[_0xc4de('0x57')]=function(_0x27b444,_0x496abd,_0x5de4e7,_0x30742a,_0x44558c,_0x46ca5e){var _0xbab7b4,_0x3136a0;_0x46ca5e[_0xc4de('0x16')]=intUtil['stripTrailingSlash'](_0x46ca5e[_0xc4de('0x16')]);_0x46ca5e[_0xc4de('0x40')]=intUtil[_0xc4de('0x3f')](_0x46ca5e[_0xc4de('0x40')]);if(_0x44558c&&_0x44558c[_0xc4de('0x41')]){logger['info']('['+_0x496abd[_0xc4de('0x58')][_0xc4de('0x59')]()+']',_0xc4de('0x52'));_0x496abd[_0xc4de('0x43')]=util[_0xc4de('0x15')](_0xc4de('0x44'),_0x46ca5e[_0xc4de('0x40')],_0x496abd[_0xc4de('0x53')],md5(_0x496abd['uniqueid']));}else{_0x496abd[_0xc4de('0x43')]='';}headers[_0xc4de('0x45')]=getAuth(_0x46ca5e);return getUser(_0x46ca5e,'')[_0xc4de('0x1b')](function(_0x5137e3){_0xbab7b4=_0x5137e3;logger[_0xc4de('0x1d')](_0xc4de('0x5a'),_0xbab7b4['id']);return getEndUser(_0x46ca5e,_0x496abd['calleridname'],_0x496abd['calleridnum']);})[_0xc4de('0x1b')](function(_0x4c504e){_0x3136a0=_0x4c504e;logger[_0xc4de('0x1d')](_0xc4de('0x47'),_0x3136a0['id']);return getTicket(_0x46ca5e,_0xbab7b4,_0x3136a0,_0x5de4e7,_0x496abd);})[_0xc4de('0x1b')](function(_0x11791c){if(_0x11791c){logger[_0xc4de('0x1d')]('Ticket\x20created!');logger[_0xc4de('0x1d')](_0xc4de('0x48'),_0x11791c['id']);}})['catch'](function(_0x59b18d){logger[_0xc4de('0x4d')]('['+_0x496abd['lastevent'][_0xc4de('0x59')]()+']',JSON['stringify'](_0x59b18d));});}; \ 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 2857daa..07ec6f0 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 _0x5e23=['getString','Descriptions','Contact','add','ticketId','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','Admin\x20selected','error','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects'];(function(_0x58b77c,_0x59ff0e){var _0x130d6c=function(_0xbdec12){while(--_0xbdec12){_0x58b77c['push'](_0x58b77c['shift']());}};_0x130d6c(++_0x59ff0e);}(_0x5e23,0xc2));var _0x35e2=function(_0x5b45ac,_0x5abbe1){_0x5b45ac=_0x5b45ac-0x0;var _0x52380a=_0x5e23[_0x5b45ac];return _0x52380a;};'use strict';var _=require(_0x35e2('0x0'));var rp=require(_0x35e2('0x1'));var md5=require('md5');var util=require(_0x35e2('0x2'));var moment=require(_0x35e2('0x3'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0x35e2('0x4'));var config=require(_0x35e2('0x5'));var logger=require(_0x35e2('0x6'))(_0x35e2('0x7'));config[_0x35e2('0x8')]=_[_0x35e2('0x9')](config[_0x35e2('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x35e2('0xa'))(new Redis(config[_0x35e2('0x8')]));function getAdminId(_0x44c2cd,_0x50e7d0,_0x4b174d,_0x49e929){return new Promise(function(_0x3e30f3,_0x1a38b3){var _0x4f6328=![];var _0x120ef2={'method':_0x35e2('0xb'),'uri':_0x49e929+_0x35e2('0xc'),'json':!![]};_0x120ef2[_0x35e2('0xd')]=_0x4b174d;logger[_0x35e2('0xe')](_0x35e2('0xf'));return rp(_0x120ef2)[_0x35e2('0x10')](function(_0x534d3b){if(_0x534d3b){var _0x41ef75=_0x534d3b[_0x35e2('0x11')];var _0x15dfa5=null;for(_0x15dfa5=0x0;_0x15dfa5<_0x41ef75[_0x35e2('0x12')];_0x15dfa5++){if(_0x41ef75[_0x15dfa5]['email']===_0x44c2cd[_0x35e2('0x13')]){_0x44c2cd['adminId']=_0x41ef75[_0x15dfa5]['id'];_0x4f6328=!![];}}if(_0x4f6328){logger[_0x35e2('0xe')](_0x35e2('0x14'),_0x44c2cd[_0x35e2('0x15')]);_0x3e30f3(_0x44c2cd);}else{_0x1a38b3({'statusCode':0x194,'message':_0x35e2('0x16')});}}else{_0x1a38b3({'statusCode':0x194,'message':_0x35e2('0x16')});}})[_0x35e2('0x17')](function(_0x31a37d){logger['error']('['+[_0x50e7d0[_0x35e2('0x18')]()]+']',_0x31a37d[_0x35e2('0x19')]);_0x1a38b3(_0x31a37d);});});}function getUser(_0x3f8500,_0x140b70,_0x1b1730){return function(_0x3d6a18){return new Promise(function(_0x3c4505,_0x18aba2){var _0x249cce={'method':_0x35e2('0xb'),'uri':_0x1b1730+_0x35e2('0xc'),'json':!![]};_0x249cce[_0x35e2('0xd')]=_0x140b70;logger[_0x35e2('0xe')](_0x35e2('0x1a'));return rp(_0x249cce)[_0x35e2('0x10')](function(_0x14827d){if(_0x14827d){var _0xb5136=_0x14827d['users'];var _0x43b8e4=![];var _0x5a55ce=null;if(_0x3d6a18[_0x35e2('0x1b')]!==null){logger[_0x35e2('0xe')](_0x35e2('0x1c'),_0x3d6a18[_0x35e2('0x1b')]);_0x3d6a18[_0x35e2('0x1d')]=_0x3d6a18[_0x35e2('0x1b')];for(_0x5a55ce=0x0;_0x5a55ce<_0xb5136['length'];_0x5a55ce++){if(_0xb5136[_0x5a55ce][_0x35e2('0x1e')]===_0x3d6a18['agentEmail']){_0x43b8e4=!![];_0x3d6a18['userId']=_0xb5136[_0x5a55ce]['id'];logger[_0x35e2('0xe')]('User\x20found:',_0x3d6a18[_0x35e2('0x1f')]);}}}if(!_0x43b8e4){logger[_0x35e2('0xe')](_0x35e2('0x20'));_0x3d6a18[_0x35e2('0x1d')]=_0x3d6a18[_0x35e2('0x13')];_0x3d6a18[_0x35e2('0x1f')]=_0x3d6a18[_0x35e2('0x15')];_0x43b8e4=!![];}if(_0x43b8e4){_0x3c4505(_0x3d6a18);}else{_0x18aba2({'statusCode':0x194,'message':_0x35e2('0x16')});}}else{_0x18aba2({'statusCode':0x194,'message':_0x35e2('0x16')});}})[_0x35e2('0x17')](function(_0x5e44f7){logger[_0x35e2('0x21')]('['+[_0x3f8500['toUpperCase']()]+']',_0x5e44f7['message']);_0x18aba2(_0x5e44f7);});});};}function searchContact(_0x1a3808,_0x389334,_0x26ad7e,_0x70ce56){return new Promise(function(_0x5781db,_0x40915a){var _0x1c6b9a={'method':_0x35e2('0xb'),'headers':_0x389334,'uri':_0x1a3808+'/api/lookup?q='+_0x70ce56+_0x35e2('0x22')+_0x26ad7e+_0x35e2('0x23'),'json':!![]};rp(_0x1c6b9a)[_0x35e2('0x10')](function(_0xc9eb6e){var _0x3e2b74=_['find'](_0xc9eb6e[_0x35e2('0x24')][_0x35e2('0x24')],[_0x26ad7e,_0x70ce56]);_0x5781db(_0x3e2b74);})[_0x35e2('0x17')](function(_0x179423){_0x40915a(_0x179423);});});}function getEndUser(_0x5c1ad1,_0x238905,_0x12ba1d){return function(_0x57acb4){return new Promise(function(_0x2a8837,_0x22fd39){logger['info'](util[_0x35e2('0x25')](_0x35e2('0x26'),_0x57acb4[_0x35e2('0x27')]));searchContact(_0x12ba1d,_0x238905,_0x35e2('0x28'),_0x57acb4['contactNumber'])[_0x35e2('0x10')](function(_0x2380df){if(_0x2380df){_0x57acb4['endUserId']=_0x2380df['id'];logger[_0x35e2('0xe')](_0x35e2('0x29'),_0x57acb4[_0x35e2('0x2a')]);return _0x2a8837(_0x57acb4);}searchContact(_0x12ba1d,_0x238905,'work_number',_0x57acb4[_0x35e2('0x27')])[_0x35e2('0x10')](function(_0x3a79a1){if(_0x3a79a1){_0x57acb4[_0x35e2('0x2a')]=_0x3a79a1['id'];logger[_0x35e2('0xe')]('Contact\x20found\x20work_number:',_0x57acb4['endUserId']);return _0x2a8837(_0x57acb4);}createEndUser(_0x57acb4,_0x5c1ad1,_0x238905,_0x12ba1d)[_0x35e2('0x10')](function(_0x4114df){logger['info'](_0x35e2('0x2b'),_0x4114df[_0x35e2('0x2a')]);return _0x2a8837(_0x4114df);});});})[_0x35e2('0x17')](function(_0x829ee0){_0x22fd39(_0x829ee0);});});};}function createEndUser(_0x5969f5,_0x3a948b,_0xc25046,_0x3cab2e){return new Promise(function(_0x3266bc,_0x27d5f3){var _0x136477=moment();var _0x59bb68={'method':_0x35e2('0x2c'),'uri':_0x3cab2e+_0x35e2('0x2d'),'body':{'contact':{'last_name':_0x5969f5[_0x35e2('0x27')],'work_number':_0x5969f5[_0x35e2('0x27')],'mobile_number':_0x5969f5[_0x35e2('0x27')],'owner_id':_0x5969f5[_0x35e2('0x1f')],'created_at':_0x136477['format'](_0x35e2('0x2e'))}},'json':!![]};_0x59bb68[_0x35e2('0xd')]=_0xc25046;logger[_0x35e2('0xe')](_0x35e2('0x2f'));return rp(_0x59bb68)[_0x35e2('0x10')](function(_0x2cb0db){_0x5969f5[_0x35e2('0x2a')]=_0x2cb0db[_0x35e2('0x30')]['id'];_0x3266bc(_0x5969f5);})[_0x35e2('0x17')](function(_0x1534b4){logger['error']('['+[_0x3a948b[_0x35e2('0x18')]()]+']',_0x1534b4[_0x35e2('0x19')]);_0x27d5f3(_0x1534b4['message']);});});}function getTicket(_0x218d11,_0xb3ff24,_0x447140,_0x3c59dc,_0x12d7d3){return function(_0x3f1058){logger[_0x35e2('0xe')](_0x35e2('0x31'));return new Promise(function(_0x128a39,_0x36501a){var _0x979c66=moment();var _0x12e0c3={'method':_0x35e2('0x2c'),'uri':_0x447140+_0x35e2('0x32'),'body':{'title':intUtil['getString'](_0x3c59dc[_0x35e2('0x33')],_0x12d7d3,'\x20'),'description':intUtil[_0x35e2('0x34')](_0x3c59dc[_0x35e2('0x35')],_0x12d7d3,'\x0a'),'owner_id':_0x3f1058[_0x35e2('0x1f')],'creater_id':_0x3f1058[_0x35e2('0x15')],'targetable_id':_0x3f1058[_0x35e2('0x2a')],'targetable_type':_0x35e2('0x36'),'created_at':_0x979c66['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x979c66[_0x35e2('0x37')](0x1e,'m')[_0x35e2('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x12e0c3[_0x35e2('0xd')]=_0xb3ff24;return rp(_0x12e0c3)['then'](function(_0x30a290){_0x3f1058[_0x35e2('0x38')]=_0x30a290['task']['id'];logger[_0x35e2('0xe')](_0x35e2('0x39'),_0x3f1058[_0x35e2('0x38')]);_0x128a39(_0x3f1058);})[_0x35e2('0x17')](function(_0x3874a1){logger['error']('['+[_0x218d11[_0x35e2('0x18')]()]+']',_0x3874a1[_0x35e2('0x19')]);_0x36501a(_0x3874a1[_0x35e2('0x19')]);});});};}function emit(_0x5a24a5,_0x4bba7e,_0x5a49d6){var _0xdeb77b={'uri':_0x5a24a5+'/contacts/'+_0x5a49d6};io['to'](util['format'](_0x35e2('0x3a'),_0x4bba7e))[_0x35e2('0x3b')](_0x35e2('0x3c'),_0xdeb77b);}exports['cs']=function(_0x5d4930,_0x12b60f,_0x27c3a9,_0x125806,_0x157ac7,_0x21db29,_0x566bcf,_0x29f280){var _0x1151fa={};var _0x169e66={'Authorization':_0x35e2('0x3d')+_0x21db29[_0x35e2('0x3e')]};_0x21db29['remoteUri']=intUtil[_0x35e2('0x3f')](_0x21db29[_0x35e2('0x40')]);_0x21db29[_0x35e2('0x41')]=intUtil[_0x35e2('0x3f')](_0x21db29['serverUrl']);var _0x2741ab=_0x21db29[_0x35e2('0x40')];_0x1151fa[_0x35e2('0x13')]=_0x21db29['username'];_0x1151fa[_0x35e2('0x27')]=_0x29f280['toLowerCase']()===_0x35e2('0x42')?_0x12b60f['destcalleridnum']:_0x12b60f[_0x35e2('0x43')];_0x1151fa[_0x35e2('0x44')]=_0x29f280===_0x35e2('0x45')||_0x29f280===_0x35e2('0x46')?_0x35e2('0x45'):_0x35e2('0x42');if(_0x125806){_0x1151fa[_0x35e2('0x1b')]=_0x125806[_0x35e2('0x1e')];}var _0x4aa315=util[_0x35e2('0x25')](_0x35e2('0x47'),_0x21db29[_0x35e2('0x41')],_0x12b60f[_0x35e2('0x48')],md5(_0x12b60f[_0x35e2('0x48')]));if(_0x157ac7&&_0x157ac7['monitor_format']){logger[_0x35e2('0xe')](_0x35e2('0x49'),_0x35e2('0x4a'));_0x12b60f[_0x35e2('0x4b')]=_0x4aa315;}else if(_0x566bcf&&_0x566bcf[_0x35e2('0x4c')]&&_0x566bcf[_0x35e2('0x4c')]!==_0x35e2('0x4d')){logger[_0x35e2('0xe')](_0x35e2('0x4e'),_0x35e2('0x4a'));_0x12b60f[_0x35e2('0x4b')]=_0x4aa315;}else{_0x12b60f['recordingURL']='';}return getAdminId(_0x1151fa,_0x29f280,_0x169e66,_0x2741ab)[_0x35e2('0x10')](getUser(_0x29f280,_0x169e66,_0x2741ab))[_0x35e2('0x10')](getEndUser(_0x29f280,_0x169e66,_0x2741ab))[_0x35e2('0x10')](getTicket(_0x29f280,_0x169e66,_0x2741ab,_0x27c3a9,_0x12b60f))['then'](function(_0x14b483){logger[_0x35e2('0xe')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x14b483[_0x35e2('0x38')]));if(_0x29f280!=='unmanaged'){logger['info']('['+[_0x29f280[_0x35e2('0x18')]()]+']',_0x35e2('0x4f'));emit(_0x2741ab,_0x125806['name'],_0x14b483[_0x35e2('0x2a')]);}})[_0x35e2('0x17')](function(_0x31b360){logger[_0x35e2('0x21')]('['+[_0x29f280[_0x35e2('0x18')]()]+_0x35e2('0x50'),util[_0x35e2('0x51')](_0x31b360,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xdba0=['request-promise','md5','util','moment','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','adminEmail','info','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20with\x20email','agentEmail','userEmail','email','userId','User\x20found:','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','message','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','adminId','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash'];(function(_0x39609a,_0x28a563){var _0xecd92=function(_0x57241a){while(--_0x57241a){_0x39609a['push'](_0x39609a['shift']());}};_0xecd92(++_0x28a563);}(_0xdba0,0x19e));var _0x0dba=function(_0x5d225a,_0x2debe9){_0x5d225a=_0x5d225a-0x0;var _0x1e7761=_0xdba0[_0x5d225a];return _0x1e7761;};'use strict';var _=require(_0x0dba('0x0'));var rp=require(_0x0dba('0x1'));var md5=require(_0x0dba('0x2'));var util=require(_0x0dba('0x3'));var moment=require(_0x0dba('0x4'));var Promise=require('bluebird');var Redis=require(_0x0dba('0x5'));var intUtil=require(_0x0dba('0x6'));var config=require(_0x0dba('0x7'));var logger=require('../../../../config/logger')('freshsales');config[_0x0dba('0x8')]=_[_0x0dba('0x9')](config[_0x0dba('0x8')],{'host':_0x0dba('0xa'),'port':0x18eb});var io=require(_0x0dba('0xb'))(new Redis(config[_0x0dba('0x8')]));function getAdminId(_0x4b5dc7,_0x4c43ff,_0x496081,_0x18cdd0){return new Promise(function(_0x4600db,_0x16514e){var _0x175ab9=![];var _0x9a3dec={'method':_0x0dba('0xc'),'uri':_0x18cdd0+_0x0dba('0xd'),'json':!![]};_0x9a3dec[_0x0dba('0xe')]=_0x496081;logger['info'](_0x0dba('0xf'));return rp(_0x9a3dec)[_0x0dba('0x10')](function(_0x1551fe){if(_0x1551fe){var _0x291113=_0x1551fe[_0x0dba('0x11')];var _0x3717b1=null;for(_0x3717b1=0x0;_0x3717b1<_0x291113[_0x0dba('0x12')];_0x3717b1++){if(_0x291113[_0x3717b1]['email']===_0x4b5dc7[_0x0dba('0x13')]){_0x4b5dc7['adminId']=_0x291113[_0x3717b1]['id'];_0x175ab9=!![];}}if(_0x175ab9){logger[_0x0dba('0x14')]('Admin\x20found:',_0x4b5dc7['adminId']);_0x4600db(_0x4b5dc7);}else{_0x16514e({'statusCode':0x194,'message':_0x0dba('0x15')});}}else{_0x16514e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x0dba('0x16')](function(_0xf59703){logger[_0x0dba('0x17')]('['+[_0x4c43ff[_0x0dba('0x18')]()]+']',_0xf59703['message']);_0x16514e(_0xf59703);});});}function getUser(_0x47f208,_0x18ba26,_0x279d6b){return function(_0x48d263){return new Promise(function(_0x24d24f,_0x4b414a){var _0x244078={'method':_0x0dba('0xc'),'uri':_0x279d6b+_0x0dba('0xd'),'json':!![]};_0x244078[_0x0dba('0xe')]=_0x18ba26;logger[_0x0dba('0x14')]('Getting\x20user\x20list');return rp(_0x244078)[_0x0dba('0x10')](function(_0x948880){if(_0x948880){var _0xa1d500=_0x948880[_0x0dba('0x11')];var _0x503178=![];var _0x15e954=null;if(_0x48d263['agentEmail']!==null){logger[_0x0dba('0x14')](_0x0dba('0x19'),_0x48d263[_0x0dba('0x1a')]);_0x48d263[_0x0dba('0x1b')]=_0x48d263[_0x0dba('0x1a')];for(_0x15e954=0x0;_0x15e954<_0xa1d500[_0x0dba('0x12')];_0x15e954++){if(_0xa1d500[_0x15e954][_0x0dba('0x1c')]===_0x48d263[_0x0dba('0x1a')]){_0x503178=!![];_0x48d263[_0x0dba('0x1d')]=_0xa1d500[_0x15e954]['id'];logger['info'](_0x0dba('0x1e'),_0x48d263[_0x0dba('0x1d')]);}}}if(!_0x503178){logger[_0x0dba('0x14')]('Admin\x20selected');_0x48d263[_0x0dba('0x1b')]=_0x48d263[_0x0dba('0x13')];_0x48d263['userId']=_0x48d263['adminId'];_0x503178=!![];}if(_0x503178){_0x24d24f(_0x48d263);}else{_0x4b414a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4b414a({'statusCode':0x194,'message':_0x0dba('0x15')});}})[_0x0dba('0x16')](function(_0x16a6d8){logger[_0x0dba('0x17')]('['+[_0x47f208[_0x0dba('0x18')]()]+']',_0x16a6d8['message']);_0x4b414a(_0x16a6d8);});});};}function searchContact(_0x500b51,_0x1c01be,_0x3e100f,_0x5bf3eb){return new Promise(function(_0x1e750b,_0x350d90){var _0x28a648={'method':_0x0dba('0xc'),'headers':_0x1c01be,'uri':_0x500b51+_0x0dba('0x1f')+_0x5bf3eb+_0x0dba('0x20')+_0x3e100f+'&entities=contact','json':!![]};rp(_0x28a648)['then'](function(_0x1a2641){var _0x1a9a52=_[_0x0dba('0x21')](_0x1a2641[_0x0dba('0x22')][_0x0dba('0x22')],[_0x3e100f,_0x5bf3eb]);_0x1e750b(_0x1a9a52);})[_0x0dba('0x16')](function(_0x15de96){_0x350d90(_0x15de96);});});}function getEndUser(_0x1b86ba,_0x994a8b,_0x288cae){return function(_0x98cc39){return new Promise(function(_0x2aed01,_0x3e8f0b){logger['info'](util[_0x0dba('0x23')](_0x0dba('0x24'),_0x98cc39[_0x0dba('0x25')]));searchContact(_0x288cae,_0x994a8b,_0x0dba('0x26'),_0x98cc39[_0x0dba('0x25')])[_0x0dba('0x10')](function(_0x39ffab){if(_0x39ffab){_0x98cc39[_0x0dba('0x27')]=_0x39ffab['id'];logger[_0x0dba('0x14')](_0x0dba('0x28'),_0x98cc39[_0x0dba('0x27')]);return _0x2aed01(_0x98cc39);}searchContact(_0x288cae,_0x994a8b,_0x0dba('0x29'),_0x98cc39[_0x0dba('0x25')])[_0x0dba('0x10')](function(_0x5d8ae8){if(_0x5d8ae8){_0x98cc39['endUserId']=_0x5d8ae8['id'];logger[_0x0dba('0x14')]('Contact\x20found\x20work_number:',_0x98cc39[_0x0dba('0x27')]);return _0x2aed01(_0x98cc39);}createEndUser(_0x98cc39,_0x1b86ba,_0x994a8b,_0x288cae)[_0x0dba('0x10')](function(_0x18519e){logger[_0x0dba('0x14')]('Contact\x20created:',_0x18519e[_0x0dba('0x27')]);return _0x2aed01(_0x18519e);});});})[_0x0dba('0x16')](function(_0x23019a){_0x3e8f0b(_0x23019a);});});};}function createEndUser(_0xb6d2fd,_0x1f4d1f,_0xd44596,_0x3c94bf){return new Promise(function(_0x196a00,_0x135e65){var _0x2332ba=moment();var _0x35f23f={'method':_0x0dba('0x2a'),'uri':_0x3c94bf+_0x0dba('0x2b'),'body':{'contact':{'last_name':_0xb6d2fd[_0x0dba('0x25')],'work_number':_0xb6d2fd[_0x0dba('0x25')],'mobile_number':_0xb6d2fd[_0x0dba('0x25')],'owner_id':_0xb6d2fd[_0x0dba('0x1d')],'created_at':_0x2332ba[_0x0dba('0x23')](_0x0dba('0x2c'))}},'json':!![]};_0x35f23f['headers']=_0xd44596;logger[_0x0dba('0x14')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x35f23f)[_0x0dba('0x10')](function(_0x7b283b){_0xb6d2fd[_0x0dba('0x27')]=_0x7b283b[_0x0dba('0x2d')]['id'];_0x196a00(_0xb6d2fd);})[_0x0dba('0x16')](function(_0x2425a2){logger[_0x0dba('0x17')]('['+[_0x1f4d1f[_0x0dba('0x18')]()]+']',_0x2425a2[_0x0dba('0x2e')]);_0x135e65(_0x2425a2[_0x0dba('0x2e')]);});});}function getTicket(_0x5d9071,_0x10be99,_0x1e04fb,_0x4e6804,_0x531449){return function(_0x295a84){logger['info'](_0x0dba('0x2f'));return new Promise(function(_0x213e5c,_0x2c5a1d){var _0x6aa304=moment();var _0x48e70e={'method':'POST','uri':_0x1e04fb+_0x0dba('0x30'),'body':{'title':intUtil[_0x0dba('0x31')](_0x4e6804[_0x0dba('0x32')],_0x531449,'\x20'),'description':intUtil[_0x0dba('0x31')](_0x4e6804[_0x0dba('0x33')],_0x531449,'\x0a'),'owner_id':_0x295a84[_0x0dba('0x1d')],'creater_id':_0x295a84[_0x0dba('0x34')],'targetable_id':_0x295a84[_0x0dba('0x27')],'targetable_type':'Contact','created_at':_0x6aa304[_0x0dba('0x23')](_0x0dba('0x2c')),'due_date':_0x6aa304['add'](0x1e,'m')[_0x0dba('0x23')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x48e70e[_0x0dba('0xe')]=_0x10be99;return rp(_0x48e70e)[_0x0dba('0x10')](function(_0x3ff279){_0x295a84[_0x0dba('0x35')]=_0x3ff279[_0x0dba('0x36')]['id'];logger[_0x0dba('0x14')](_0x0dba('0x37'),_0x295a84[_0x0dba('0x35')]);_0x213e5c(_0x295a84);})[_0x0dba('0x16')](function(_0x5908d0){logger[_0x0dba('0x17')]('['+[_0x5d9071['toUpperCase']()]+']',_0x5908d0[_0x0dba('0x2e')]);_0x2c5a1d(_0x5908d0[_0x0dba('0x2e')]);});});};}function emit(_0x2391c9,_0xf8b5cd,_0x1481e1){var _0x303b71={'uri':_0x2391c9+_0x0dba('0x38')+_0x1481e1};io['to'](util['format'](_0x0dba('0x39'),_0xf8b5cd))['emit'](_0x0dba('0x3a'),_0x303b71);}exports['cs']=function(_0x39b1ae,_0x223da4,_0x2c4985,_0x484741,_0xdfa6e7,_0x30f66b,_0x1d2437,_0x2449d2){var _0x22225b={};var _0x2caa21={'Authorization':_0x0dba('0x3b')+_0x30f66b[_0x0dba('0x3c')]};_0x30f66b[_0x0dba('0x3d')]=intUtil[_0x0dba('0x3e')](_0x30f66b['remoteUri']);_0x30f66b[_0x0dba('0x3f')]=intUtil[_0x0dba('0x3e')](_0x30f66b[_0x0dba('0x3f')]);var _0x1ccc35=_0x30f66b[_0x0dba('0x3d')];_0x22225b['adminEmail']=_0x30f66b['username'];_0x22225b['contactNumber']=_0x2449d2[_0x0dba('0x40')]()===_0x0dba('0x41')?_0x223da4[_0x0dba('0x42')]:_0x223da4[_0x0dba('0x43')];_0x22225b[_0x0dba('0x44')]=_0x2449d2===_0x0dba('0x45')||_0x2449d2===_0x0dba('0x46')?_0x0dba('0x45'):'outbound';if(_0x484741){_0x22225b[_0x0dba('0x1a')]=_0x484741[_0x0dba('0x1c')];}var _0x4da1b5=util['format'](_0x0dba('0x47'),_0x30f66b['serverUrl'],_0x223da4[_0x0dba('0x48')],md5(_0x223da4[_0x0dba('0x48')]));if(_0xdfa6e7&&_0xdfa6e7[_0x0dba('0x49')]){logger[_0x0dba('0x14')]('[QUEUE]','Recording\x20is\x20enabled!');_0x223da4[_0x0dba('0x4a')]=_0x4da1b5;}else if(_0x1d2437&&_0x1d2437['recordingFormat']&&_0x1d2437['recordingFormat']!==_0x0dba('0x4b')){logger[_0x0dba('0x14')](_0x0dba('0x4c'),_0x0dba('0x4d'));_0x223da4[_0x0dba('0x4a')]=_0x4da1b5;}else{_0x223da4['recordingURL']='';}return getAdminId(_0x22225b,_0x2449d2,_0x2caa21,_0x1ccc35)[_0x0dba('0x10')](getUser(_0x2449d2,_0x2caa21,_0x1ccc35))[_0x0dba('0x10')](getEndUser(_0x2449d2,_0x2caa21,_0x1ccc35))[_0x0dba('0x10')](getTicket(_0x2449d2,_0x2caa21,_0x1ccc35,_0x2c4985,_0x223da4))[_0x0dba('0x10')](function(_0x12eaa8){logger[_0x0dba('0x14')](util[_0x0dba('0x23')](_0x0dba('0x4e'),_0x12eaa8['ticketId']));if(_0x2449d2!==_0x0dba('0x46')){logger['info']('['+[_0x2449d2[_0x0dba('0x18')]()]+']',_0x0dba('0x4f'));emit(_0x1ccc35,_0x484741[_0x0dba('0x50')],_0x12eaa8[_0x0dba('0x27')]);}})[_0x0dba('0x16')](function(_0x2094ab){logger['error']('['+[_0x2449d2[_0x0dba('0x18')]()]+_0x0dba('0x51'),util[_0x0dba('0x52')](_0x2094ab,{'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 5d546ae..747e47f 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 _0xff73=['toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','freshdesk','desk','log','unknown\x20integration','[EXEC]','format','../../../../config/logger','error','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./sugarcrm','./zoho','./desk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xff73,0xac));var _0x3ff7=function(_0x555c42,_0x1aad30){_0x555c42=_0x555c42-0x0;var _0x482a6b=_0xff73[_0x555c42];return _0x482a6b;};'use strict';var _=require(_0x3ff7('0x0'));var util=require('util');var zendesk=require(_0x3ff7('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0x3ff7('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0x3ff7('0x3'));var desk=require(_0x3ff7('0x4'));var vtiger=require('./vtiger');var servicenow=require(_0x3ff7('0x5'));var dynamics365=require(_0x3ff7('0x6'));var freshsales=require(_0x3ff7('0x7'));var integrations=[_0x3ff7('0x8'),_0x3ff7('0x9'),_0x3ff7('0xa'),'freshdesk',_0x3ff7('0xb'),'desk',_0x3ff7('0xc'),_0x3ff7('0xd'),_0x3ff7('0xe'),_0x3ff7('0xf')];exports[_0x3ff7('0x10')]=function(_0x271acf,_0x349238,_0x5cfd2b,_0x5f03d4,_0x2982e1,_0x333642){if(_0x5cfd2b){if(_[_0x3ff7('0x11')](integrations,_0x271acf['data1'][_0x3ff7('0x12')]())){try{var _0x8dddeb=null;var _0x53add2='';var _0x368fbe=_0x5cfd2b[_0x271acf[_0x3ff7('0x13')][_0x3ff7('0x12')]()];if(_0x368fbe){var _0x25d693=_0x368fbe[_0x271acf[_0x3ff7('0x14')]];if(_0x25d693){var _0x566316=_[_0x3ff7('0x15')](_0x25d693[_0x3ff7('0x16')],{'id':parseInt(_0x271acf[_0x3ff7('0x17')],0xa)});if(_0x566316){if(_0x5f03d4){if(_0x2982e1&&_0x349238[_0x3ff7('0x18')]){_0x53add2=_0x3ff7('0x18');}else if(_0x349238[_0x3ff7('0x19')]){_0x53add2=_0x3ff7('0x1a');}else{console['log'](_0x3ff7('0x1b'),_0x349238);}}else{_0x53add2=_0x3ff7('0x1c');}switch(_0x271acf[_0x3ff7('0x13')][_0x3ff7('0x12')]()){case _0x3ff7('0x8'):zendesk[_0x53add2](_0x271acf,_0x349238,_0x566316,_0x5f03d4,_0x2982e1,_0x25d693,_0x333642);break;case'salesforce':salesforce[_0x53add2](_0x271acf,_0x349238,_0x566316,_0x5f03d4,_0x2982e1,_0x25d693,_0x333642);break;case _0x3ff7('0xa'):sugarcrm[_0x53add2](_0x271acf,_0x349238,_0x566316,_0x5f03d4,_0x2982e1,_0x25d693,_0x333642);break;case _0x3ff7('0x1d'):freshdesk[_0x53add2](_0x271acf,_0x349238,_0x566316,_0x5f03d4,_0x2982e1,_0x25d693,_0x333642);break;case'zoho':zoho[_0x53add2](_0x271acf,_0x349238,_0x566316,_0x5f03d4,_0x2982e1,_0x25d693,_0x333642);break;case _0x3ff7('0x1e'):desk[_0x53add2](_0x271acf,_0x349238,_0x566316,_0x5f03d4,_0x2982e1,_0x25d693,_0x333642);break;case _0x3ff7('0xc'):vtiger[_0x53add2](_0x271acf,_0x349238,_0x566316,_0x5f03d4,_0x2982e1,_0x25d693,_0x333642);break;case _0x3ff7('0xe'):freshsales['cs'](_0x271acf,_0x349238,_0x566316,_0x5f03d4,_0x2982e1,_0x25d693,_0x333642,_0x53add2);break;case'servicenow':servicenow['cs'](_0x271acf,_0x349238,_0x566316,_0x5f03d4,_0x2982e1,_0x25d693,_0x333642,_0x53add2);break;case _0x3ff7('0xd'):dynamics365['cs'](_0x271acf,_0x349238,_0x566316,_0x5f03d4,_0x2982e1,_0x25d693,_0x333642,_0x53add2);break;default:console[_0x3ff7('0x1f')](_0x3ff7('0x20'));}}else{_0x8dddeb=require('../../../../config/logger')(_0x271acf[_0x3ff7('0x13')][_0x3ff7('0x12')]());_0x8dddeb['error'](_0x3ff7('0x21'),util[_0x3ff7('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x271acf[_0x3ff7('0x13')][_0x3ff7('0x12')](),_0x271acf[_0x3ff7('0x17')]));}}else{_0x8dddeb=require(_0x3ff7('0x23'))(_0x271acf[_0x3ff7('0x13')][_0x3ff7('0x12')]());_0x8dddeb[_0x3ff7('0x24')](_0x3ff7('0x21'),util[_0x3ff7('0x22')](_0x3ff7('0x25'),_0x271acf[_0x3ff7('0x13')][_0x3ff7('0x12')](),_0x271acf[_0x3ff7('0x14')]));}}else{}}catch(_0x6c5d4f){console['error'](_0x6c5d4f);}}}}; \ No newline at end of file +var _0x2a33=['./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','zoho','dynamics365','freshsales','exec','includes','data1','toLowerCase','data2','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','desk','vtiger','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce'];(function(_0x52d21d,_0x1cd6d0){var _0x130d1f=function(_0x2a0a90){while(--_0x2a0a90){_0x52d21d['push'](_0x52d21d['shift']());}};_0x130d1f(++_0x1cd6d0);}(_0x2a33,0x153));var _0x32a3=function(_0x2f6590,_0xb67829){_0x2f6590=_0x2f6590-0x0;var _0x53263c=_0x2a33[_0x2f6590];return _0x53263c;};'use strict';var _=require(_0x32a3('0x0'));var util=require(_0x32a3('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x32a3('0x2'));var sugarcrm=require(_0x32a3('0x3'));var freshdesk=require(_0x32a3('0x4'));var zoho=require(_0x32a3('0x5'));var desk=require(_0x32a3('0x6'));var vtiger=require(_0x32a3('0x7'));var servicenow=require(_0x32a3('0x8'));var dynamics365=require(_0x32a3('0x9'));var freshsales=require(_0x32a3('0xa'));var integrations=[_0x32a3('0xb'),'salesforce',_0x32a3('0xc'),'freshdesk',_0x32a3('0xd'),'desk','vtiger',_0x32a3('0xe'),_0x32a3('0xf'),'servicenow'];exports[_0x32a3('0x10')]=function(_0x3619fd,_0xc5f0d0,_0x3d2678,_0x4eeb73,_0x39807e,_0x389b89){if(_0x3d2678){if(_[_0x32a3('0x11')](integrations,_0x3619fd['data1']['toLowerCase']())){try{var _0x5db4a7=null;var _0x182179='';var _0x218819=_0x3d2678[_0x3619fd[_0x32a3('0x12')][_0x32a3('0x13')]()];if(_0x218819){var _0x393c54=_0x218819[_0x3619fd[_0x32a3('0x14')]];if(_0x393c54){var _0x216922=_['find'](_0x393c54['Configurations'],{'id':parseInt(_0x3619fd[_0x32a3('0x15')],0xa)});if(_0x216922){if(_0x4eeb73){if(_0x39807e&&_0xc5f0d0[_0x32a3('0x16')]){_0x182179='queue';}else if(_0xc5f0d0[_0x32a3('0x17')]){_0x182179=_0x32a3('0x18');}else{console[_0x32a3('0x19')](_0x32a3('0x1a'),_0xc5f0d0);}}else{_0x182179=_0x32a3('0x1b');}switch(_0x3619fd[_0x32a3('0x12')]['toLowerCase']()){case'zendesk':zendesk[_0x182179](_0x3619fd,_0xc5f0d0,_0x216922,_0x4eeb73,_0x39807e,_0x393c54,_0x389b89);break;case'salesforce':salesforce[_0x182179](_0x3619fd,_0xc5f0d0,_0x216922,_0x4eeb73,_0x39807e,_0x393c54,_0x389b89);break;case _0x32a3('0xc'):sugarcrm[_0x182179](_0x3619fd,_0xc5f0d0,_0x216922,_0x4eeb73,_0x39807e,_0x393c54,_0x389b89);break;case _0x32a3('0x1c'):freshdesk[_0x182179](_0x3619fd,_0xc5f0d0,_0x216922,_0x4eeb73,_0x39807e,_0x393c54,_0x389b89);break;case _0x32a3('0xd'):zoho[_0x182179](_0x3619fd,_0xc5f0d0,_0x216922,_0x4eeb73,_0x39807e,_0x393c54,_0x389b89);break;case _0x32a3('0x1d'):desk[_0x182179](_0x3619fd,_0xc5f0d0,_0x216922,_0x4eeb73,_0x39807e,_0x393c54,_0x389b89);break;case _0x32a3('0x1e'):vtiger[_0x182179](_0x3619fd,_0xc5f0d0,_0x216922,_0x4eeb73,_0x39807e,_0x393c54,_0x389b89);break;case _0x32a3('0xf'):freshsales['cs'](_0x3619fd,_0xc5f0d0,_0x216922,_0x4eeb73,_0x39807e,_0x393c54,_0x389b89,_0x182179);break;case _0x32a3('0x1f'):servicenow['cs'](_0x3619fd,_0xc5f0d0,_0x216922,_0x4eeb73,_0x39807e,_0x393c54,_0x389b89,_0x182179);break;case _0x32a3('0xe'):dynamics365['cs'](_0x3619fd,_0xc5f0d0,_0x216922,_0x4eeb73,_0x39807e,_0x393c54,_0x389b89,_0x182179);break;default:console[_0x32a3('0x19')](_0x32a3('0x20'));}}else{_0x5db4a7=require(_0x32a3('0x21'))(_0x3619fd[_0x32a3('0x12')][_0x32a3('0x13')]());_0x5db4a7[_0x32a3('0x22')](_0x32a3('0x23'),util['format'](_0x32a3('0x24'),_0x3619fd[_0x32a3('0x12')]['toLowerCase'](),_0x3619fd[_0x32a3('0x15')]));}}else{_0x5db4a7=require(_0x32a3('0x21'))(_0x3619fd['data1']['toLowerCase']());_0x5db4a7[_0x32a3('0x22')](_0x32a3('0x23'),util['format'](_0x32a3('0x25'),_0x3619fd[_0x32a3('0x12')][_0x32a3('0x13')](),_0x3619fd[_0x32a3('0x14')]));}}else{}}catch(_0x1b4734){console[_0x32a3('0x22')](_0x1b4734);}}}}; \ 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 7209b4a..a337e48 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 _0x29d3=['./util','salesforce','redis','defaults','localhost','emit','assign','getString','Descriptions','Task','ActivityDate','utc','IsRecurrence','contact','endUserType','account','Case','ContactId','AccountId','leadId','info','sobject','create','isNil','validateEmail','User','find','execute','length','Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','display_name','identity','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','additionalSearchAccount','additionalSearchLead','Lead','lead','Account','first','Name','Phone','type','moduleCreate','LastName','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','string','picklist','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','securityToken','remoteUri','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','catch','unmanaged','lastevent','toUpperCase','calleridname',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','ioredis'];(function(_0x381bd9,_0x11a623){var _0x181d89=function(_0x5cf626){while(--_0x5cf626){_0x381bd9['push'](_0x381bd9['shift']());}};_0x181d89(++_0x11a623);}(_0x29d3,0xed));var _0x329d=function(_0x3633ab,_0x50d387){_0x3633ab=_0x3633ab-0x0;var _0x38ceee=_0x29d3[_0x3633ab];return _0x38ceee;};'use strict';var _=require(_0x329d('0x0'));var rp=require(_0x329d('0x1'));var moment=require(_0x329d('0x2'));var BPromise=require('bluebird');var md5=require(_0x329d('0x3'));var jsforce=require(_0x329d('0x4'));var util=require(_0x329d('0x5'));var Redis=require(_0x329d('0x6'));var intUtil=require(_0x329d('0x7'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x329d('0x8'));config[_0x329d('0x9')]=_[_0x329d('0xa')](config[_0x329d('0x9')],{'host':_0x329d('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x329d('0x9')]));function emit(_0x464209,_0x46a113,_0xc036f0){io['to'](_0x464209)[_0x329d('0xc')](_0x46a113,_0xc036f0);}function getTicket(_0x3ac725,_0x556b0d,_0x41b47e,_0x5f5126,_0xd4d41d,_0x29920b,_0x3d65fa,_0x3e1e78){var _0x13055e=Object[_0x329d('0xd')]({},{'OwnerId':_0x556b0d['id'],'Subject':intUtil[_0x329d('0xe')](_0x5f5126['Subjects'],_0xd4d41d,'\x20'),'Description':intUtil['getString'](_0x5f5126[_0x329d('0xf')],_0xd4d41d,'\x0a')},getCustomFields(_0x29920b,_0xd4d41d));if(_0x41b47e){if(_0x5f5126['ticketType']===_0x329d('0x10')){_0x13055e[_0x329d('0x11')]=moment[_0x329d('0x12')]();_0x13055e['IsReminderSet']=![];_0x13055e[_0x329d('0x13')]=![];if(_0x41b47e['endUserType']===_0x329d('0x14')||_0x41b47e[_0x329d('0x15')]==='lead'){_0x13055e['WhoId']=_0x41b47e['id'];}else if(_0x41b47e['endUserType']===_0x329d('0x16')){_0x13055e['WhatId']=_0x41b47e['id'];}}else if(_0x5f5126['ticketType']===_0x329d('0x17')){if(_0x41b47e[_0x329d('0x15')]==='contact'){_0x13055e[_0x329d('0x18')]=_0x41b47e['id'];}else if(_0x41b47e['endUserType']===_0x329d('0x16')){_0x13055e[_0x329d('0x19')]=_0x41b47e['id'];}else if(_0x41b47e['endUserType']==='lead'&&_0x5f5126['leadId']){_0x13055e[_0x5f5126[_0x329d('0x1a')]]=_0x41b47e['id'];}else{logger[_0x329d('0x1b')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x3d65fa[_0x329d('0x1c')](_0x5f5126['ticketType'])[_0x329d('0x1d')](_0x13055e);}function getUser(_0x40d472,_0x28b40d,_0x4f2513){if(!_[_0x329d('0x1e')](_0x28b40d)&&intUtil[_0x329d('0x1f')](_0x28b40d)){var _0x44aaaf={'Email':_0x28b40d};var _0x1417b5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4f2513[_0x329d('0x1c')](_0x329d('0x20'))[_0x329d('0x21')](_0x44aaaf,_0x1417b5)[_0x329d('0x22')]()['then'](function(_0x4a16c9){if(_0x4a16c9[_0x329d('0x23')]){var _0x264fe0=_['find'](_0x4a16c9,function(_0x45ecdf){return _0x45ecdf['Email']===_0x28b40d;});if(_0x264fe0){logger[_0x329d('0x1b')](_0x329d('0x24'),_0x28b40d);return BPromise['resolve']({'id':_0x264fe0['Id'],'name':_0x264fe0['Name']});}}else{logger[_0x329d('0x1b')](_0x329d('0x25'),_0x28b40d);return _0x4f2513['identity']()[_0x329d('0x26')](function(_0x4500c9){return BPromise['resolve']({'id':_0x4500c9[_0x329d('0x27')],'name':_0x4500c9[_0x329d('0x28')]});});}});}else{logger[_0x329d('0x1b')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x28b40d);return _0x4f2513[_0x329d('0x29')]()[_0x329d('0x26')](function(_0x36e031){return BPromise['resolve']({'id':_0x36e031['user_id'],'name':_0x36e031[_0x329d('0x28')]});});}}function getEndUser(_0x12dc37,_0x2c775e,_0x25e2b9,_0x95e6e7,_0x59e78e){var _0xaa415a={'$or':{'Phone':_0x95e6e7}};var _0x18178a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x329d('0x2a')]()[_0x329d('0x26')](function(){logger['info'](_0x329d('0x2b'),_0x95e6e7,_0x2c775e[_0x329d('0x2c')]);switch(_0x2c775e['moduleSearch']){case'contact_lead':var _0x5acf29=_[_0x329d('0x2d')](_0xaa415a);if(_0x2c775e[_0x329d('0x2e')]){var _0x4e1e95={};_0x4e1e95[_0x2c775e[_0x329d('0x2e')]]=_0x95e6e7;_[_0x329d('0x2f')](_0x5acf29[_0x329d('0x30')],_0x4e1e95);}return _0x59e78e[_0x329d('0x1c')]('Contact')[_0x329d('0x21')](_0x5acf29,_0x18178a)[_0x329d('0x22')]()[_0x329d('0x26')](function(_0x26f09c){if(_0x26f09c&&_0x26f09c[_0x329d('0x23')]){return _0x26f09c;}else{var _0x46cac2=_[_0x329d('0x2d')](_0xaa415a);if(_0x2c775e['additionalSearchLead']){var _0x1f47e8={};_0x1f47e8[_0x2c775e['additionalSearchLead']]=_0x95e6e7;_[_0x329d('0x2f')](_0x46cac2[_0x329d('0x30')],_0x1f47e8);}return _0x59e78e['sobject']('Lead')[_0x329d('0x21')](_0x46cac2,_0x18178a);}});case'account_contact_lead':var _0x48c0f3=_[_0x329d('0x2d')](_0xaa415a);if(_0x2c775e[_0x329d('0x31')]){var _0x4e1e95={};_0x4e1e95[_0x2c775e[_0x329d('0x31')]]=_0x95e6e7;_[_0x329d('0x2f')](_0x48c0f3[_0x329d('0x30')],_0x4e1e95);}return _0x59e78e['sobject']('Account')[_0x329d('0x21')](_0x48c0f3,_0x18178a)[_0x329d('0x22')]()[_0x329d('0x26')](function(_0x24c5f5){if(_0x24c5f5&&_0x24c5f5[_0x329d('0x23')]){return _0x24c5f5;}else{var _0x1d1a61=_[_0x329d('0x2d')](_0xaa415a);if(_0x2c775e[_0x329d('0x2e')]){var _0x1dd3ce={};_0x1dd3ce[_0x2c775e[_0x329d('0x2e')]]=_0x95e6e7;_[_0x329d('0x2f')](_0x1d1a61[_0x329d('0x30')],_0x1dd3ce);}return _0x59e78e[_0x329d('0x1c')]('Contact')[_0x329d('0x21')](_0x1d1a61,_0x18178a)[_0x329d('0x26')](function(_0x38d50f){if(_0x38d50f&&_0x38d50f[_0x329d('0x23')]){return _0x38d50f;}else{var _0x59e6cd=_['cloneDeep'](_0xaa415a);if(_0x2c775e[_0x329d('0x32')]){var _0x370c15={};_0x370c15[_0x2c775e[_0x329d('0x32')]]=_0x95e6e7;_[_0x329d('0x2f')](_0x59e6cd[_0x329d('0x30')],_0x370c15);}return _0x59e78e['sobject'](_0x329d('0x33'))[_0x329d('0x21')](_0x59e6cd,_0x18178a);}});}});case _0x329d('0x14'):var _0x5acf29=_[_0x329d('0x2d')](_0xaa415a);if(_0x2c775e[_0x329d('0x2e')]){var _0x4e1e95={};_0x4e1e95[_0x2c775e[_0x329d('0x2e')]]=_0x95e6e7;_[_0x329d('0x2f')](_0x5acf29['$or'],_0x4e1e95);}return _0x59e78e['sobject']('Contact')['find'](_0x5acf29,_0x18178a)[_0x329d('0x22')]();case _0x329d('0x34'):var _0x20ad50=_['cloneDeep'](_0xaa415a);if(_0x2c775e[_0x329d('0x32')]){var _0x4e1e95={};_0x4e1e95[_0x2c775e[_0x329d('0x32')]]=_0x95e6e7;_[_0x329d('0x2f')](_0x20ad50[_0x329d('0x30')],_0x4e1e95);}return _0x59e78e[_0x329d('0x1c')](_0x329d('0x33'))[_0x329d('0x21')](_0x20ad50,_0x18178a);case _0x329d('0x16'):var _0x48c0f3=_[_0x329d('0x2d')](_0xaa415a);if(_0x2c775e[_0x329d('0x31')]){var _0x4e1e95={};_0x4e1e95[_0x2c775e[_0x329d('0x31')]]=_0x95e6e7;_['merge'](_0x48c0f3[_0x329d('0x30')],_0x4e1e95);}return _0x59e78e[_0x329d('0x1c')](_0x329d('0x35'))[_0x329d('0x21')](_0x48c0f3,_0x18178a);default:return null;}})[_0x329d('0x26')](function(_0x34afb3){if(_0x34afb3&&_0x34afb3[_0x329d('0x23')]){var _0x47572a=_[_0x329d('0x36')](_0x34afb3);if(_0x47572a){return BPromise['resolve']({'id':_0x47572a['Id'],'name':_0x47572a[_0x329d('0x37')],'phone':_0x47572a[_0x329d('0x38')],'endUserType':_0x47572a['attributes'][_0x329d('0x39')]['toLowerCase']()});}}})[_0x329d('0x26')](function(_0x4cb883){if(_0x4cb883){logger[_0x329d('0x1b')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x4cb883['endUserType'],_0x95e6e7);return BPromise[_0x329d('0x2a')](_0x4cb883);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x95e6e7);var _0x17cebb={'Phone':_0x95e6e7};if(_0x2c775e[_0x329d('0x3a')]){if(_0x2c775e[_0x329d('0x3a')]===_0x329d('0x14')){logger[_0x329d('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x95e6e7,_0x2c775e[_0x329d('0x3a')]);_0x17cebb[_0x329d('0x3b')]=_0x25e2b9!==_0x329d('0x3c')?_0x25e2b9:util[_0x329d('0x3d')](_0x329d('0x3e'),_0x95e6e7);}else if(_0x2c775e[_0x329d('0x3a')]===_0x329d('0x34')){logger[_0x329d('0x1b')](_0x329d('0x3f'),_0x95e6e7,_0x2c775e['moduleCreate']);_0x17cebb[_0x329d('0x3b')]=_0x25e2b9!==_0x329d('0x3c')?_0x25e2b9:util['format'](_0x329d('0x3e'),_0x95e6e7);_0x17cebb[_0x329d('0x40')]=_0x329d('0x41');}else if(_0x2c775e[_0x329d('0x3a')]==='account'){logger['info'](_0x329d('0x3f'),_0x95e6e7,_0x2c775e[_0x329d('0x3a')]);_0x17cebb[_0x329d('0x37')]=_0x25e2b9!==''?_0x25e2b9:util[_0x329d('0x3d')]('Caller\x20-\x20%s',_0x95e6e7);}else{return null;}}return _0x59e78e[_0x329d('0x1c')](_['upperFirst'](_0x2c775e[_0x329d('0x3a')]))[_0x329d('0x1d')](_0x17cebb)[_0x329d('0x26')](function(_0x1098fd){return BPromise[_0x329d('0x2a')]({'id':_0x1098fd['id'],'endUserType':_0x2c775e[_0x329d('0x3a')]});});}});}function getCustomFields(_0x45dc71,_0xd69c26){var _0x58b017={};if(_0x45dc71['length']>0x0){_['forEach'](_0x45dc71,function(_0x5136ed){if(_['includes']([_0x329d('0x42'),_0x329d('0x43')],_0x5136ed['type'])&&_0x5136ed[_0x329d('0x44')]){_0x58b017[_0x5136ed[_0x329d('0x44')]]=_0x5136ed[_0x329d('0x45')]['toString']();}else if(_0x5136ed[_0x329d('0x39')]===_0x329d('0x46')&&_0x5136ed[_0x329d('0x47')]&&_0x5136ed[_0x329d('0x44')]){_0xd69c26[_0x5136ed['variableName']]&&(_0x58b017[_0x5136ed[_0x329d('0x44')]]=_0xd69c26[_0x5136ed['variableName']][_0x329d('0x48')]());}else if(_0x5136ed[_0x329d('0x39')]===_0x329d('0x49')&&_0x5136ed[_0x329d('0x4a')]&&_0x5136ed[_0x329d('0x4a')][_0x329d('0x4b')]&&_0x5136ed[_0x329d('0x44')]){_0xd69c26[_0x5136ed[_0x329d('0x4a')]['name']['toLowerCase']()]&&(_0x58b017[_0x5136ed[_0x329d('0x44')]]=_0xd69c26[_0x5136ed[_0x329d('0x4a')][_0x329d('0x4b')][_0x329d('0x4c')]()][_0x329d('0x48')]());}});}return _0x58b017;}function getConnection(_0x3c1c69){var _0x5ced5b=_0x3c1c69[_0x329d('0x4d')][_0x329d('0x4e')](_0x3c1c69[_0x329d('0x4f')]);var _0x350fde=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3c1c69[_0x329d('0x50')]||'https://login.salesforce.com','clientId':_0x3c1c69[_0x329d('0x51')],'clientSecret':_0x3c1c69['clientSecret']}});return _0x350fde[_0x329d('0x52')](_0x3c1c69[_0x329d('0x53')],_0x5ced5b)['then'](function(){logger['info'](_0x329d('0x54'));return _0x350fde;});}exports[_0x329d('0x55')]=function(_0x4feb3a,_0xbf9379,_0xeb2ff8,_0x3cdd65,_0x422c7e,_0x5a2637){var _0x2d3dd8,_0x5579b0,_0xac47a6,_0x17e640;_0x5a2637[_0x329d('0x56')]=intUtil[_0x329d('0x57')](_0x5a2637[_0x329d('0x56')]);_0x5a2637[_0x329d('0x50')]=intUtil['stripTrailingSlash'](_0x5a2637[_0x329d('0x50')]);if(_0x422c7e&&_0x422c7e[_0x329d('0x58')]){logger[_0x329d('0x1b')](_0x329d('0x59'),'Recording\x20is\x20enabled!');_0xbf9379[_0x329d('0x5a')]=util['format'](_0x329d('0x5b'),_0x5a2637['serverUrl'],_0xbf9379['uniqueid'],md5(_0xbf9379[_0x329d('0x5c')]));}else{_0xbf9379[_0x329d('0x5a')]='';}return getConnection(_0x5a2637)[_0x329d('0x26')](function(_0x7be62b){_0x17e640=_0x7be62b;return getUser(_0x5a2637,_0x3cdd65[_0x329d('0x5d')],_0x17e640);})['then'](function(_0x3de4c6){_0x2d3dd8=_0x3de4c6;return getEndUser(_0x5a2637,_0xeb2ff8,_0xbf9379['calleridname'],_0xbf9379[_0x329d('0x5e')],_0x17e640);})[_0x329d('0x26')](function(_0x6a9295){_0x5579b0=_0x6a9295;return getTicket(_0x5a2637,_0x2d3dd8,_0x5579b0,_0xeb2ff8,_0xbf9379,_0xeb2ff8[_0x329d('0x5f')],_0x17e640,'queue');})[_0x329d('0x26')](function(_0x213fdd){_0xac47a6=_0x213fdd;logger['info'](_0x329d('0x60'),_0xac47a6['id']);logger[_0x329d('0x1b')](_0x329d('0x61'),_0xac47a6['id'],_0x3cdd65[_0x329d('0x4b')],_0x5a2637[_0x329d('0x39')]);switch(_0x5a2637[_0x329d('0x39')]){case _0x329d('0x62'):emit(util[_0x329d('0x3d')](_0x329d('0x63'),_0x3cdd65[_0x329d('0x4b')]),_0x329d('0x64'),{'recordId':_0xac47a6['id']});break;case _0x329d('0x65'):emit(util[_0x329d('0x3d')](_0x329d('0x63'),_0x3cdd65[_0x329d('0x4b')]),_0x329d('0x66'),{'uri':util[_0x329d('0x3d')](_0x329d('0x67'),_0x17e640[_0x329d('0x68')],_0xac47a6['id'])});break;default:logger[_0x329d('0x69')](_0x329d('0x6a'));}})['catch'](function(_0x2077e4){logger[_0x329d('0x69')](_0x329d('0x59'),_0x2077e4);});};exports[_0x329d('0x6b')]=function(_0x52844b,_0x5adfe4,_0x25f474,_0x2752bf,_0x33e829,_0x3d8a89,_0x50a4b6){var _0x3068fb,_0x407c93,_0x4af0a1,_0x52ae4b;_0x3d8a89[_0x329d('0x56')]=intUtil['stripTrailingSlash'](_0x3d8a89['serverUrl']);_0x3d8a89[_0x329d('0x50')]=intUtil[_0x329d('0x57')](_0x3d8a89[_0x329d('0x50')]);if(_0x50a4b6&&_0x50a4b6['recordingFormat']&&_0x50a4b6[_0x329d('0x6c')]!==_0x329d('0x6d')){logger[_0x329d('0x1b')](_0x329d('0x6e'),_0x329d('0x6f'));_0x5adfe4['recordingURL']=util['format'](_0x329d('0x5b'),_0x3d8a89[_0x329d('0x56')],_0x5adfe4['uniqueid'],md5(_0x5adfe4[_0x329d('0x5c')]));}return getConnection(_0x3d8a89)[_0x329d('0x26')](function(_0x13be5c){_0x52ae4b=_0x13be5c;return getUser(_0x3d8a89,_0x2752bf[_0x329d('0x5d')],_0x52ae4b);})[_0x329d('0x26')](function(_0x145669){_0x3068fb=_0x145669;return getEndUser(_0x3d8a89,_0x25f474,_0x5adfe4[_0x329d('0x70')],_0x5adfe4[_0x329d('0x71')],_0x52ae4b);})[_0x329d('0x26')](function(_0x2c7291){_0x407c93=_0x2c7291;return getTicket(_0x3d8a89,_0x3068fb,_0x407c93,_0x25f474,_0x5adfe4,_0x25f474[_0x329d('0x5f')],_0x52ae4b,_0x329d('0x6b'));})[_0x329d('0x26')](function(_0x38a38e){_0x4af0a1=_0x38a38e;logger[_0x329d('0x1b')](_0x329d('0x72'),_0x4af0a1['id']);logger[_0x329d('0x1b')](_0x329d('0x73'),_0x4af0a1['id'],_0x2752bf['name'],_0x3d8a89[_0x329d('0x39')]);switch(_0x3d8a89[_0x329d('0x39')]){case _0x329d('0x62'):emit(util[_0x329d('0x3d')](_0x329d('0x63'),_0x2752bf[_0x329d('0x4b')]),'trigger:salesforce:display',{'recordId':_0x4af0a1['id']});break;case'newTab':emit(util['format'](_0x329d('0x63'),_0x2752bf[_0x329d('0x4b')]),'trigger:browser:url',{'uri':util[_0x329d('0x3d')](_0x329d('0x67'),_0x52ae4b[_0x329d('0x68')],_0x4af0a1['id'])});break;default:logger['error']('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x329d('0x74')](function(_0x9d9baf){logger['error'](_0x329d('0x6e'),_0x9d9baf);});};exports[_0x329d('0x75')]=function(_0x17ef8f,_0x55b220,_0x1251f4,_0x35ebb1,_0x111063,_0x20636f){var _0xfbe2a3,_0x308466,_0x281853,_0x30d0fb;_0x20636f['serverUrl']=intUtil[_0x329d('0x57')](_0x20636f[_0x329d('0x56')]);_0x20636f[_0x329d('0x50')]=intUtil['stripTrailingSlash'](_0x20636f[_0x329d('0x50')]);if(_0x111063&&_0x111063[_0x329d('0x58')]){logger[_0x329d('0x1b')]('['+_0x55b220[_0x329d('0x76')][_0x329d('0x77')]()+']','Recording\x20is\x20enabled!');_0x55b220['recordingURL']=util[_0x329d('0x3d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20636f['serverUrl'],_0x55b220['uniqueid'],md5(_0x55b220[_0x329d('0x5c')]));}else{_0x55b220[_0x329d('0x5a')]='';}return getConnection(_0x20636f)[_0x329d('0x26')](function(_0x2d284b){_0x30d0fb=_0x2d284b;if(!_[_0x329d('0x1e')](_0x35ebb1)){return getUser(_0x20636f,_0x35ebb1[_0x329d('0x4b')],_0x30d0fb);}else{return getUser(_0x20636f,null,_0x30d0fb);}})['then'](function(_0x32f871){_0xfbe2a3=_0x32f871;return getEndUser(_0x20636f,_0x1251f4,_0x55b220[_0x329d('0x78')],_0x55b220[_0x329d('0x5e')],_0x30d0fb);})[_0x329d('0x26')](function(_0x158609){_0x308466=_0x158609;return getTicket(_0x20636f,_0xfbe2a3,_0x308466,_0x1251f4,_0x55b220,_0x1251f4[_0x329d('0x5f')],_0x30d0fb);})['then'](function(_0xaafeb6){_0x281853=_0xaafeb6;logger[_0x329d('0x1b')]('['+_0x55b220[_0x329d('0x76')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x281853['id']);logger['info']('['+_0x55b220[_0x329d('0x76')]['toUpperCase']()+_0x329d('0x79'),_0x20636f[_0x329d('0x39')]);})['catch'](function(_0x47ef3e){logger['error']('['+_0x55b220[_0x329d('0x76')][_0x329d('0x77')]()+']',_0x47ef3e);});}; \ No newline at end of file +var _0x1dc6=['validateEmail','sobject','User','find','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','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','create','forEach','includes','string','picklist','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','username','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:browser:url','%s/%s/e','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','md5','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','socket.io-emitter','emit','assign','Subjects','getString','Descriptions','ticketType','IsReminderSet','endUserType','contact','WhoId','WhatId','Case','ContactId','account','lead','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped'];(function(_0x2e11df,_0x29f5c8){var _0x1ff40d=function(_0xa7a697){while(--_0xa7a697){_0x2e11df['push'](_0x2e11df['shift']());}};_0x1ff40d(++_0x29f5c8);}(_0x1dc6,0x1d0));var _0x61dc=function(_0x20f461,_0x277e53){_0x20f461=_0x20f461-0x0;var _0x423f98=_0x1dc6[_0x20f461];return _0x423f98;};'use strict';var _=require(_0x61dc('0x0'));var rp=require('request-promise');var moment=require(_0x61dc('0x1'));var BPromise=require('bluebird');var md5=require(_0x61dc('0x2'));var jsforce=require('jsforce');var util=require(_0x61dc('0x3'));var Redis=require(_0x61dc('0x4'));var intUtil=require(_0x61dc('0x5'));var config=require(_0x61dc('0x6'));var logger=require('../../../../config/logger')(_0x61dc('0x7'));config[_0x61dc('0x8')]=_[_0x61dc('0x9')](config[_0x61dc('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x61dc('0xa'))(new Redis(config[_0x61dc('0x8')]));function emit(_0x2aaf8a,_0x1b8a61,_0x471411){io['to'](_0x2aaf8a)[_0x61dc('0xb')](_0x1b8a61,_0x471411);}function getTicket(_0x5c42ae,_0x346aa9,_0x30c0c2,_0x4afe48,_0x3f83ea,_0x52e229,_0x475c06,_0x22a6f5){var _0xb84a5e=Object[_0x61dc('0xc')]({},{'OwnerId':_0x346aa9['id'],'Subject':intUtil['getString'](_0x4afe48[_0x61dc('0xd')],_0x3f83ea,'\x20'),'Description':intUtil[_0x61dc('0xe')](_0x4afe48[_0x61dc('0xf')],_0x3f83ea,'\x0a')},getCustomFields(_0x52e229,_0x3f83ea));if(_0x30c0c2){if(_0x4afe48[_0x61dc('0x10')]==='Task'){_0xb84a5e['ActivityDate']=moment['utc']();_0xb84a5e[_0x61dc('0x11')]=![];_0xb84a5e['IsRecurrence']=![];if(_0x30c0c2[_0x61dc('0x12')]===_0x61dc('0x13')||_0x30c0c2[_0x61dc('0x12')]==='lead'){_0xb84a5e[_0x61dc('0x14')]=_0x30c0c2['id'];}else if(_0x30c0c2[_0x61dc('0x12')]==='account'){_0xb84a5e[_0x61dc('0x15')]=_0x30c0c2['id'];}}else if(_0x4afe48[_0x61dc('0x10')]===_0x61dc('0x16')){if(_0x30c0c2[_0x61dc('0x12')]===_0x61dc('0x13')){_0xb84a5e[_0x61dc('0x17')]=_0x30c0c2['id'];}else if(_0x30c0c2[_0x61dc('0x12')]===_0x61dc('0x18')){_0xb84a5e['AccountId']=_0x30c0c2['id'];}else if(_0x30c0c2['endUserType']===_0x61dc('0x19')&&_0x4afe48['leadId']){_0xb84a5e[_0x4afe48['leadId']]=_0x30c0c2['id'];}else{logger[_0x61dc('0x1a')](_0x61dc('0x1b'));}}}return _0x475c06['sobject'](_0x4afe48[_0x61dc('0x10')])['create'](_0xb84a5e);}function getUser(_0x4ae3bf,_0x4c0efb,_0xcb24ff){if(!_['isNil'](_0x4c0efb)&&intUtil[_0x61dc('0x1c')](_0x4c0efb)){var _0x25ee4c={'Email':_0x4c0efb};var _0x28870c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xcb24ff[_0x61dc('0x1d')](_0x61dc('0x1e'))[_0x61dc('0x1f')](_0x25ee4c,_0x28870c)['execute']()[_0x61dc('0x20')](function(_0x2c5533){if(_0x2c5533[_0x61dc('0x21')]){var _0x4d4d8c=_['find'](_0x2c5533,function(_0x1e3c5d){return _0x1e3c5d[_0x61dc('0x22')]===_0x4c0efb;});if(_0x4d4d8c){logger['info']('Agent\x20%s\x20found.',_0x4c0efb);return BPromise[_0x61dc('0x23')]({'id':_0x4d4d8c['Id'],'name':_0x4d4d8c[_0x61dc('0x24')]});}}else{logger[_0x61dc('0x1a')](_0x61dc('0x25'),_0x4c0efb);return _0xcb24ff['identity']()[_0x61dc('0x20')](function(_0x5be310){return BPromise[_0x61dc('0x23')]({'id':_0x5be310['user_id'],'name':_0x5be310['display_name']});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x4c0efb);return _0xcb24ff[_0x61dc('0x26')]()[_0x61dc('0x20')](function(_0x19ab5e){return BPromise[_0x61dc('0x23')]({'id':_0x19ab5e[_0x61dc('0x27')],'name':_0x19ab5e[_0x61dc('0x28')]});});}}function getEndUser(_0x4eea2a,_0x589add,_0xa25698,_0x202274,_0x3cc924){var _0x42720b={'$or':{'Phone':_0x202274}};var _0x2986ea={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x61dc('0x23')]()[_0x61dc('0x20')](function(){logger[_0x61dc('0x1a')](_0x61dc('0x29'),_0x202274,_0x589add['moduleSearch']);switch(_0x589add[_0x61dc('0x2a')]){case _0x61dc('0x2b'):var _0x35166b=_[_0x61dc('0x2c')](_0x42720b);if(_0x589add[_0x61dc('0x2d')]){var _0x3200e5={};_0x3200e5[_0x589add['additionalSearchContact']]=_0x202274;_[_0x61dc('0x2e')](_0x35166b[_0x61dc('0x2f')],_0x3200e5);}return _0x3cc924[_0x61dc('0x1d')](_0x61dc('0x30'))[_0x61dc('0x1f')](_0x35166b,_0x2986ea)[_0x61dc('0x31')]()[_0x61dc('0x20')](function(_0x225d90){if(_0x225d90&&_0x225d90[_0x61dc('0x21')]){return _0x225d90;}else{var _0x2f9fb5=_[_0x61dc('0x2c')](_0x42720b);if(_0x589add[_0x61dc('0x32')]){var _0x19e838={};_0x19e838[_0x589add['additionalSearchLead']]=_0x202274;_[_0x61dc('0x2e')](_0x2f9fb5[_0x61dc('0x2f')],_0x19e838);}return _0x3cc924[_0x61dc('0x1d')](_0x61dc('0x33'))[_0x61dc('0x1f')](_0x2f9fb5,_0x2986ea);}});case _0x61dc('0x34'):var _0x51d7c7=_[_0x61dc('0x2c')](_0x42720b);if(_0x589add[_0x61dc('0x35')]){var _0x3200e5={};_0x3200e5[_0x589add['additionalSearchAccount']]=_0x202274;_[_0x61dc('0x2e')](_0x51d7c7['$or'],_0x3200e5);}return _0x3cc924['sobject'](_0x61dc('0x36'))[_0x61dc('0x1f')](_0x51d7c7,_0x2986ea)[_0x61dc('0x31')]()['then'](function(_0x336e40){if(_0x336e40&&_0x336e40[_0x61dc('0x21')]){return _0x336e40;}else{var _0x2d8383=_['cloneDeep'](_0x42720b);if(_0x589add[_0x61dc('0x2d')]){var _0xe09478={};_0xe09478[_0x589add[_0x61dc('0x2d')]]=_0x202274;_[_0x61dc('0x2e')](_0x2d8383[_0x61dc('0x2f')],_0xe09478);}return _0x3cc924[_0x61dc('0x1d')](_0x61dc('0x30'))['find'](_0x2d8383,_0x2986ea)[_0x61dc('0x20')](function(_0x413ec1){if(_0x413ec1&&_0x413ec1[_0x61dc('0x21')]){return _0x413ec1;}else{var _0x500eb4=_[_0x61dc('0x2c')](_0x42720b);if(_0x589add[_0x61dc('0x32')]){var _0x4bf366={};_0x4bf366[_0x589add[_0x61dc('0x32')]]=_0x202274;_[_0x61dc('0x2e')](_0x500eb4['$or'],_0x4bf366);}return _0x3cc924[_0x61dc('0x1d')](_0x61dc('0x33'))[_0x61dc('0x1f')](_0x500eb4,_0x2986ea);}});}});case _0x61dc('0x13'):var _0x35166b=_[_0x61dc('0x2c')](_0x42720b);if(_0x589add[_0x61dc('0x2d')]){var _0x3200e5={};_0x3200e5[_0x589add[_0x61dc('0x2d')]]=_0x202274;_['merge'](_0x35166b['$or'],_0x3200e5);}return _0x3cc924[_0x61dc('0x1d')](_0x61dc('0x30'))['find'](_0x35166b,_0x2986ea)[_0x61dc('0x31')]();case _0x61dc('0x19'):var _0x4b4921=_[_0x61dc('0x2c')](_0x42720b);if(_0x589add[_0x61dc('0x32')]){var _0x3200e5={};_0x3200e5[_0x589add['additionalSearchLead']]=_0x202274;_[_0x61dc('0x2e')](_0x4b4921[_0x61dc('0x2f')],_0x3200e5);}return _0x3cc924['sobject'](_0x61dc('0x33'))[_0x61dc('0x1f')](_0x4b4921,_0x2986ea);case _0x61dc('0x18'):var _0x51d7c7=_['cloneDeep'](_0x42720b);if(_0x589add[_0x61dc('0x35')]){var _0x3200e5={};_0x3200e5[_0x589add[_0x61dc('0x35')]]=_0x202274;_[_0x61dc('0x2e')](_0x51d7c7[_0x61dc('0x2f')],_0x3200e5);}return _0x3cc924[_0x61dc('0x1d')](_0x61dc('0x36'))[_0x61dc('0x1f')](_0x51d7c7,_0x2986ea);default:return null;}})[_0x61dc('0x20')](function(_0x55d7a2){if(_0x55d7a2&&_0x55d7a2[_0x61dc('0x21')]){var _0x2cbd22=_[_0x61dc('0x37')](_0x55d7a2);if(_0x2cbd22){return BPromise[_0x61dc('0x23')]({'id':_0x2cbd22['Id'],'name':_0x2cbd22['Name'],'phone':_0x2cbd22[_0x61dc('0x38')],'endUserType':_0x2cbd22[_0x61dc('0x39')][_0x61dc('0x3a')]['toLowerCase']()});}}})[_0x61dc('0x20')](function(_0x360f06){if(_0x360f06){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x360f06['endUserType'],_0x202274);return BPromise[_0x61dc('0x23')](_0x360f06);}else{logger[_0x61dc('0x1a')](_0x61dc('0x3b'),_0x202274);var _0x1cc980={'Phone':_0x202274};if(_0x589add['moduleCreate']){if(_0x589add[_0x61dc('0x3c')]==='contact'){logger[_0x61dc('0x1a')](_0x61dc('0x3d'),_0x202274,_0x589add[_0x61dc('0x3c')]);_0x1cc980[_0x61dc('0x3e')]=_0xa25698!==_0x61dc('0x3f')?_0xa25698:util[_0x61dc('0x40')](_0x61dc('0x41'),_0x202274);}else if(_0x589add[_0x61dc('0x3c')]==='lead'){logger[_0x61dc('0x1a')](_0x61dc('0x3d'),_0x202274,_0x589add['moduleCreate']);_0x1cc980['LastName']=_0xa25698!==''?_0xa25698:util[_0x61dc('0x40')](_0x61dc('0x41'),_0x202274);_0x1cc980[_0x61dc('0x42')]='No\x20Company';}else if(_0x589add['moduleCreate']==='account'){logger[_0x61dc('0x1a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x202274,_0x589add[_0x61dc('0x3c')]);_0x1cc980[_0x61dc('0x24')]=_0xa25698!==''?_0xa25698:util['format'](_0x61dc('0x41'),_0x202274);}else{return null;}}return _0x3cc924[_0x61dc('0x1d')](_['upperFirst'](_0x589add[_0x61dc('0x3c')]))[_0x61dc('0x43')](_0x1cc980)[_0x61dc('0x20')](function(_0x1ad75b){return BPromise[_0x61dc('0x23')]({'id':_0x1ad75b['id'],'endUserType':_0x589add['moduleCreate']});});}});}function getCustomFields(_0x19d96d,_0x1cc4eb){var _0x3fb464={};if(_0x19d96d[_0x61dc('0x21')]>0x0){_[_0x61dc('0x44')](_0x19d96d,function(_0x46062d){if(_[_0x61dc('0x45')]([_0x61dc('0x46'),_0x61dc('0x47')],_0x46062d[_0x61dc('0x3a')])&&_0x46062d[_0x61dc('0x48')]){_0x3fb464[_0x46062d['idField']]=_0x46062d[_0x61dc('0x49')][_0x61dc('0x4a')]();}else if(_0x46062d['type']==='variable'&&_0x46062d[_0x61dc('0x4b')]&&_0x46062d['idField']){_0x1cc4eb[_0x46062d[_0x61dc('0x4b')]]&&(_0x3fb464[_0x46062d[_0x61dc('0x48')]]=_0x1cc4eb[_0x46062d[_0x61dc('0x4b')]][_0x61dc('0x4a')]());}else if(_0x46062d[_0x61dc('0x3a')]===_0x61dc('0x4c')&&_0x46062d[_0x61dc('0x4d')]&&_0x46062d[_0x61dc('0x4d')][_0x61dc('0x4e')]&&_0x46062d['idField']){_0x1cc4eb[_0x46062d[_0x61dc('0x4d')][_0x61dc('0x4e')][_0x61dc('0x4f')]()]&&(_0x3fb464[_0x46062d[_0x61dc('0x48')]]=_0x1cc4eb[_0x46062d[_0x61dc('0x4d')]['name'][_0x61dc('0x4f')]()][_0x61dc('0x4a')]());}});}return _0x3fb464;}function getConnection(_0x17335d){var _0x4499d4=_0x17335d['password'][_0x61dc('0x50')](_0x17335d[_0x61dc('0x51')]);var _0x2e8e3a=new jsforce[(_0x61dc('0x52'))]({'oauth2':{'loginUrl':_0x17335d['remoteUri']||_0x61dc('0x53'),'clientId':_0x17335d[_0x61dc('0x54')],'clientSecret':_0x17335d[_0x61dc('0x55')]}});return _0x2e8e3a['login'](_0x17335d[_0x61dc('0x56')],_0x4499d4)[_0x61dc('0x20')](function(){logger['info']('Connection\x20established.');return _0x2e8e3a;});}exports[_0x61dc('0x57')]=function(_0x39d2cb,_0x29519c,_0xf8eb43,_0x27cf0b,_0x4b7199,_0x38d04b){var _0x481baf,_0x2ee3a2,_0x7689cd,_0x2c81dd;_0x38d04b[_0x61dc('0x58')]=intUtil[_0x61dc('0x59')](_0x38d04b[_0x61dc('0x58')]);_0x38d04b[_0x61dc('0x5a')]=intUtil['stripTrailingSlash'](_0x38d04b[_0x61dc('0x5a')]);if(_0x4b7199&&_0x4b7199[_0x61dc('0x5b')]){logger[_0x61dc('0x1a')]('[QUEUE]',_0x61dc('0x5c'));_0x29519c[_0x61dc('0x5d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38d04b['serverUrl'],_0x29519c['uniqueid'],md5(_0x29519c[_0x61dc('0x5e')]));}else{_0x29519c[_0x61dc('0x5d')]='';}return getConnection(_0x38d04b)[_0x61dc('0x20')](function(_0x3b0967){_0x2c81dd=_0x3b0967;return getUser(_0x38d04b,_0x27cf0b[_0x61dc('0x5f')],_0x2c81dd);})[_0x61dc('0x20')](function(_0x4db092){_0x481baf=_0x4db092;return getEndUser(_0x38d04b,_0xf8eb43,_0x29519c[_0x61dc('0x60')],_0x29519c[_0x61dc('0x61')],_0x2c81dd);})[_0x61dc('0x20')](function(_0x1d42f4){_0x2ee3a2=_0x1d42f4;return getTicket(_0x38d04b,_0x481baf,_0x2ee3a2,_0xf8eb43,_0x29519c,_0xf8eb43[_0x61dc('0x62')],_0x2c81dd,_0x61dc('0x57'));})[_0x61dc('0x20')](function(_0x50760b){_0x7689cd=_0x50760b;logger['info'](_0x61dc('0x63'),_0x7689cd['id']);logger['info'](_0x61dc('0x64'),_0x7689cd['id'],_0x27cf0b[_0x61dc('0x4e')],_0x38d04b[_0x61dc('0x3a')]);switch(_0x38d04b[_0x61dc('0x3a')]){case _0x61dc('0x65'):emit(util[_0x61dc('0x40')]('user:%s',_0x27cf0b[_0x61dc('0x4e')]),_0x61dc('0x66'),{'recordId':_0x7689cd['id']});break;case _0x61dc('0x67'):emit(util[_0x61dc('0x40')](_0x61dc('0x68'),_0x27cf0b[_0x61dc('0x4e')]),'trigger:browser:url',{'uri':util[_0x61dc('0x40')]('%s/%s/e',_0x2c81dd[_0x61dc('0x69')],_0x7689cd['id'])});break;default:logger[_0x61dc('0x6a')](_0x61dc('0x6b'));}})[_0x61dc('0x6c')](function(_0x21c60d){logger[_0x61dc('0x6a')](_0x61dc('0x6d'),_0x21c60d);});};exports[_0x61dc('0x6e')]=function(_0x3aa490,_0x10a150,_0x59b3ed,_0x2846f7,_0x2531d6,_0x586e5e,_0x40f163){var _0x348f06,_0x11db21,_0x48896c,_0x37a5c8;_0x586e5e[_0x61dc('0x58')]=intUtil[_0x61dc('0x59')](_0x586e5e[_0x61dc('0x58')]);_0x586e5e[_0x61dc('0x5a')]=intUtil['stripTrailingSlash'](_0x586e5e[_0x61dc('0x5a')]);if(_0x40f163&&_0x40f163[_0x61dc('0x6f')]&&_0x40f163['recordingFormat']!=='none'){logger[_0x61dc('0x1a')]('[OUTBOUND]',_0x61dc('0x5c'));_0x10a150[_0x61dc('0x5d')]=util['format'](_0x61dc('0x70'),_0x586e5e[_0x61dc('0x58')],_0x10a150[_0x61dc('0x5e')],md5(_0x10a150[_0x61dc('0x5e')]));}return getConnection(_0x586e5e)[_0x61dc('0x20')](function(_0x1c59c9){_0x37a5c8=_0x1c59c9;return getUser(_0x586e5e,_0x2846f7[_0x61dc('0x5f')],_0x37a5c8);})[_0x61dc('0x20')](function(_0x1c89d4){_0x348f06=_0x1c89d4;return getEndUser(_0x586e5e,_0x59b3ed,_0x10a150[_0x61dc('0x71')],_0x10a150['destcalleridnum'],_0x37a5c8);})[_0x61dc('0x20')](function(_0x5b5ba2){_0x11db21=_0x5b5ba2;return getTicket(_0x586e5e,_0x348f06,_0x11db21,_0x59b3ed,_0x10a150,_0x59b3ed['Fields'],_0x37a5c8,_0x61dc('0x6e'));})['then'](function(_0x3f7f8c){_0x48896c=_0x3f7f8c;logger[_0x61dc('0x1a')](_0x61dc('0x72'),_0x48896c['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x48896c['id'],_0x2846f7[_0x61dc('0x4e')],_0x586e5e['type']);switch(_0x586e5e['type']){case _0x61dc('0x65'):emit(util[_0x61dc('0x40')](_0x61dc('0x68'),_0x2846f7[_0x61dc('0x4e')]),_0x61dc('0x66'),{'recordId':_0x48896c['id']});break;case'newTab':emit(util[_0x61dc('0x40')](_0x61dc('0x68'),_0x2846f7[_0x61dc('0x4e')]),_0x61dc('0x73'),{'uri':util['format'](_0x61dc('0x74'),_0x37a5c8[_0x61dc('0x69')],_0x48896c['id'])});break;default:logger[_0x61dc('0x6a')](_0x61dc('0x75'),_0x61dc('0x76'));}})['catch'](function(_0x40ec85){logger[_0x61dc('0x6a')]('[OUTBOUND]',_0x40ec85);});};exports[_0x61dc('0x77')]=function(_0xba2864,_0x14eeff,_0x27a4cb,_0x2522ab,_0x12cd77,_0x1ac9d5){var _0x33496f,_0x7beee6,_0x5ea123,_0x27f8ee;_0x1ac9d5[_0x61dc('0x58')]=intUtil[_0x61dc('0x59')](_0x1ac9d5[_0x61dc('0x58')]);_0x1ac9d5['remoteUri']=intUtil[_0x61dc('0x59')](_0x1ac9d5[_0x61dc('0x5a')]);if(_0x12cd77&&_0x12cd77[_0x61dc('0x5b')]){logger[_0x61dc('0x1a')]('['+_0x14eeff[_0x61dc('0x78')][_0x61dc('0x79')]()+']',_0x61dc('0x5c'));_0x14eeff['recordingURL']=util[_0x61dc('0x40')](_0x61dc('0x70'),_0x1ac9d5['serverUrl'],_0x14eeff[_0x61dc('0x5e')],md5(_0x14eeff[_0x61dc('0x5e')]));}else{_0x14eeff['recordingURL']='';}return getConnection(_0x1ac9d5)[_0x61dc('0x20')](function(_0x22f37b){_0x27f8ee=_0x22f37b;if(!_['isNil'](_0x2522ab)){return getUser(_0x1ac9d5,_0x2522ab[_0x61dc('0x4e')],_0x27f8ee);}else{return getUser(_0x1ac9d5,null,_0x27f8ee);}})[_0x61dc('0x20')](function(_0x38af56){_0x33496f=_0x38af56;return getEndUser(_0x1ac9d5,_0x27a4cb,_0x14eeff[_0x61dc('0x60')],_0x14eeff[_0x61dc('0x61')],_0x27f8ee);})[_0x61dc('0x20')](function(_0x266574){_0x7beee6=_0x266574;return getTicket(_0x1ac9d5,_0x33496f,_0x7beee6,_0x27a4cb,_0x14eeff,_0x27a4cb[_0x61dc('0x62')],_0x27f8ee);})[_0x61dc('0x20')](function(_0x1b3746){_0x5ea123=_0x1b3746;logger[_0x61dc('0x1a')]('['+_0x14eeff['lastevent'][_0x61dc('0x79')]()+']\x20Ticket\x20%s\x20created.',_0x5ea123['id']);logger[_0x61dc('0x1a')]('['+_0x14eeff['lastevent'][_0x61dc('0x79')]()+_0x61dc('0x7a'),_0x1ac9d5[_0x61dc('0x3a')]);})[_0x61dc('0x6c')](function(_0x37ab85){logger['error']('['+_0x14eeff[_0x61dc('0x78')][_0x61dc('0x79')]()+']',_0x37ab85);});}; \ 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 bcdd51c..ce47b59 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 _0x2756=['ioredis','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','content','toString','idField','customField','toLowerCase','variable','variableName','customVariable','Variable','name','outbound','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','Recording\x20is\x20enabled!','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','request-promise','md5'];(function(_0x1df6bd,_0x4e909f){var _0x455416=function(_0x38ad98){while(--_0x38ad98){_0x1df6bd['push'](_0x1df6bd['shift']());}};_0x455416(++_0x4e909f);}(_0x2756,0x145));var _0x6275=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0x2756[_0x1ebe90];return _0x447c82;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0x6275('0x0'));var util=require('util');var md5=require(_0x6275('0x1'));var Redis=require(_0x6275('0x2'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x6275('0x3'))(_0x6275('0x4'));config[_0x6275('0x5')]=_[_0x6275('0x6')](config[_0x6275('0x5')],{'host':_0x6275('0x7'),'port':0x18eb});var io=require(_0x6275('0x8'))(new Redis(config[_0x6275('0x5')]));function getAdminUser(_0xf7e21b,_0x52628b,_0x321466,_0x265475,_0x4f44a1,_0xad237){return new Promise(function(_0x4ae40f,_0x5f3737){var _0x24a44c={'method':_0x6275('0x9'),'uri':_0x265475+_0x6275('0xa')+'&'+_0x4f44a1+'&'+_0xad237,'auth':_0x52628b,'json':!![]};return rp(_0x24a44c)['then'](function(_0xc08a6c){if(_0xc08a6c[_0x6275('0xb')][_0x6275('0xc')]>0x0){_0x321466[_0x6275('0xd')]=_0xc08a6c[_0x6275('0xb')][0x0][_0x6275('0xe')];}logger['info']('['+[_0xf7e21b[_0x6275('0xf')]()]+_0x6275('0x10'),_0x321466);_0x4ae40f(_0x321466);})[_0x6275('0x11')](function(_0x34c00b){logger[_0x6275('0x12')]('['+[_0xf7e21b['toUpperCase']()]+']',_0x34c00b[_0x6275('0x13')]);_0x5f3737(_0x34c00b[_0x6275('0x13')]);});});}function getUser(_0x43973b,_0x3e5e3f,_0x17f9c9,_0x1352d2,_0xfbd8c0){return function(_0x5e6bcc){logger[_0x6275('0x14')]('['+[_0x43973b[_0x6275('0xf')]()]+_0x6275('0x15'),_0x5e6bcc);return new Promise(function(_0x57230e,_0x58cdb2){if(intUtil[_0x6275('0x16')](_0x5e6bcc[_0x6275('0x17')])){var _0xda194c={'method':_0x6275('0x9'),'uri':_0x17f9c9+_0x6275('0x18')+_0x5e6bcc['userEmail']+'&'+_0x1352d2+'&'+_0xfbd8c0,'auth':_0x3e5e3f,'json':!![]};logger[_0x6275('0x14')]('['+[_0x43973b['toUpperCase']()]+_0x6275('0x19'),_0xda194c);return rp(_0xda194c)[_0x6275('0x1a')](function(_0x1586c){logger[_0x6275('0x14')]('['+[_0x43973b['toUpperCase']()]+_0x6275('0x1b'),_0x1586c);if(_0x1586c[_0x6275('0xb')][_0x6275('0xc')]>0x0&&String(_0x1586c['result'][0x0][_0x6275('0x1c')])===_0x6275('0x1d')){_0x5e6bcc[_0x6275('0x1e')]=_0x1586c[_0x6275('0xb')][0x0][_0x6275('0xe')];}else{_0x5e6bcc['userId']=_0x5e6bcc[_0x6275('0xd')];_0x5e6bcc[_0x6275('0x17')]=_0x5e6bcc['adminEmail'];}logger[_0x6275('0x14')]('['+[_0x43973b['toUpperCase']()]+_0x6275('0x1f'),_0x5e6bcc);_0x57230e(_0x5e6bcc);})[_0x6275('0x11')](function(_0x399089){logger[_0x6275('0x12')]('['+[_0x43973b[_0x6275('0xf')]()]+']',_0x399089['message']);_0x58cdb2(_0x399089[_0x6275('0x13')]);});}else{logger[_0x6275('0x14')]('['+[_0x43973b[_0x6275('0xf')]()]+_0x6275('0x20'));_0x5e6bcc['userId']=_0x5e6bcc[_0x6275('0xd')];_0x5e6bcc[_0x6275('0x17')]=_0x5e6bcc[_0x6275('0x21')];_0x57230e(_0x5e6bcc);}});};}function createEndUser(_0x41b96a,_0x3225b1,_0x3d6faf,_0x3eafa7,_0x2369ea){logger['info']('['+[_0x41b96a[_0x6275('0xf')]()]+'],\x20createEndUser\x20input\x20crm',_0x3d6faf);return new Promise(function(_0x5a287,_0x5dd33a){var _0x489b79={'method':_0x6275('0x22'),'uri':_0x3eafa7+_0x6275('0x23')+_0x2369ea,'body':{'user_name':_0x3d6faf[_0x6275('0x24')],'roles':_0x6275('0x25'),'first_name':_0x3d6faf[_0x6275('0x24')],'active':'true','date_format':'System','phone':_0x3d6faf[_0x6275('0x24')]},'auth':_0x3225b1,'json':!![]};return rp(_0x489b79)[_0x6275('0x1a')](function(_0x41251d){logger[_0x6275('0x14')]('['+[_0x41b96a[_0x6275('0xf')]()]+_0x6275('0x26'),_0x41251d[_0x6275('0xb')]);_0x3d6faf[_0x6275('0x27')]=_0x41251d['result'][_0x6275('0xe')];_0x5a287(_0x3d6faf);})[_0x6275('0x11')](function(_0x24a517){logger[_0x6275('0x12')]('['+[_0x41b96a[_0x6275('0xf')]()]+']',_0x24a517[_0x6275('0x13')]);_0x5dd33a(_0x24a517[_0x6275('0x13')]);});});}function getEndUser(_0x1b6409,_0x46fd74,_0x4b4d2c,_0x2e953a,_0x4871b1){return function(_0xaf4587){logger['info']('['+[_0x1b6409[_0x6275('0xf')]()]+_0x6275('0x28'),_0xaf4587);return new Promise(function(_0x6f9dac,_0x18b8d5){var _0x4f34b9={'method':_0x6275('0x9'),'uri':_0x4b4d2c+_0x6275('0x29')+_0xaf4587[_0x6275('0x24')]+'&'+_0x2e953a+'&'+_0x4871b1,'auth':_0x46fd74,'json':!![]};return rp(_0x4f34b9)[_0x6275('0x1a')](function(_0x578aae){if(_0x578aae[_0x6275('0xb')][_0x6275('0xc')]>0x0){_0xaf4587[_0x6275('0x27')]=_0x578aae[_0x6275('0xb')][0x0]['sys_id'];logger[_0x6275('0x14')]('['+[_0x1b6409[_0x6275('0xf')]()]+_0x6275('0x2a'),_0xaf4587);_0x6f9dac(_0xaf4587);}else{return createEndUser(_0x1b6409,_0x46fd74,_0xaf4587,_0x4b4d2c,_0x2e953a)[_0x6275('0x1a')](function(_0xdf0ea3){logger[_0x6275('0x14')]('['+[_0x1b6409[_0x6275('0xf')]()]+_0x6275('0x2b'),_0xdf0ea3);_0x6f9dac(_0xdf0ea3);});}})[_0x6275('0x11')](function(_0x306756){logger[_0x6275('0x12')]('['+[_0x1b6409['toUpperCase']()]+']',_0x306756[_0x6275('0x13')]);_0x18b8d5(_0x306756['message']);});});};}function getCustomFields(_0x170c10,_0xe07677){var _0x5e4dcf={};if(_0x170c10[_0x6275('0xc')]>0x0){_[_0x6275('0x2c')](_0x170c10,function(_0x4aa3c5){if(_[_0x6275('0x2d')]([_0x6275('0x2e'),_0x6275('0x2f')],_0x4aa3c5[_0x6275('0x30')])&&_0x4aa3c5[_0x6275('0x31')]&&!_0x4aa3c5['customField']){_0x5e4dcf[_0x4aa3c5[_0x6275('0x31')]['toLowerCase']()]=_0x4aa3c5[_0x6275('0x32')][_0x6275('0x33')]();}else if(_[_0x6275('0x2d')]([_0x6275('0x2e'),_0x6275('0x2f')],_0x4aa3c5[_0x6275('0x30')])&&_0x4aa3c5[_0x6275('0x34')]&&_0x4aa3c5[_0x6275('0x35')]){_0x5e4dcf[_0x4aa3c5[_0x6275('0x34')][_0x6275('0x36')]()]=_0x4aa3c5['content'][_0x6275('0x33')]();}else if(_0x4aa3c5[_0x6275('0x30')]===_0x6275('0x37')&&_0x4aa3c5['variableName']&&_0x4aa3c5[_0x6275('0x34')]&&_0x4aa3c5['customField']){_0x5e4dcf[_0x4aa3c5[_0x6275('0x34')][_0x6275('0x36')]()]=_0xe07677[_0x4aa3c5[_0x6275('0x38')]]['toString']();}else if(_0x4aa3c5[_0x6275('0x30')]===_0x6275('0x39')&&_0x4aa3c5[_0x6275('0x3a')]&&_0x4aa3c5['Variable'][_0x6275('0x3b')]&&_0x4aa3c5[_0x6275('0x34')]&&_0x4aa3c5[_0x6275('0x35')]){_0x5e4dcf[_0x4aa3c5[_0x6275('0x34')]['toLowerCase']()]=_0xe07677[_0x4aa3c5[_0x6275('0x3a')][_0x6275('0x3b')][_0x6275('0x36')]()]['toString']();}});}return _0x5e4dcf;}function getTicket(_0x3c4f15,_0x1f6bce,_0x4eaf01,_0x211b99,_0x132ace,_0x271c74){return function(_0x28bd8a){logger[_0x6275('0x14')]('['+[_0x3c4f15[_0x6275('0xf')]()]+']\x20getTicket\x20input\x20crm',_0x28bd8a);return new Promise(function(_0x12e16a,_0x369d15){var _0x22313a=_0x3c4f15[_0x6275('0x36')]()===_0x6275('0x3c')?_0x28bd8a[_0x6275('0x1e')]:_0x28bd8a[_0x6275('0x27')];var _0x4556fe={'method':_0x6275('0x22'),'uri':_0x4eaf01+'incident'+'?'+_0x271c74,'body':Object[_0x6275('0x3d')]({},{'active':_0x6275('0x1d'),'caller_id':_0x22313a,'assigned_to':_0x28bd8a[_0x6275('0x1e')],'short_description':intUtil[_0x6275('0x3e')](_0x211b99[_0x6275('0x3f')],_0x132ace,'\x20'),'description':intUtil['getString'](_0x211b99['Descriptions'],_0x132ace,'\x0a')},getCustomFields(_0x211b99[_0x6275('0x40')],_0x132ace)),'auth':_0x1f6bce,'json':!![]};return rp(_0x4556fe)[_0x6275('0x1a')](function(_0x421944){logger[_0x6275('0x14')]('['+[_0x3c4f15[_0x6275('0xf')]()]+_0x6275('0x41'),_0x421944[_0x6275('0xb')]);_0x28bd8a[_0x6275('0x42')]=_0x421944['result']['sys_id'];_0x28bd8a['ticketNumber']=_0x421944[_0x6275('0xb')]['number'];logger[_0x6275('0x14')]('['+[_0x3c4f15[_0x6275('0xf')]()]+_0x6275('0x43'),_0x28bd8a);_0x12e16a(_0x28bd8a);})['catch'](function(_0x4d9b96){logger[_0x6275('0x12')]('['+[_0x3c4f15[_0x6275('0xf')]()]+']',_0x4d9b96['message']);_0x369d15(_0x4d9b96['message']);});});};}function createRemoteTag(_0x1a715e,_0x5d0388,_0xa6e3ca,_0x5c05bf){return new Promise(function(_0x46f1f1,_0x3f9adf){var _0x15a6f1={'method':_0x6275('0x22'),'uri':_0xa6e3ca+_0x6275('0x44')+'?'+_0x5c05bf,'body':{'short_description':_0x1a715e,'global':!![],'active':!![],'name':_0x1a715e},'auth':_0x5d0388,'json':!![]};return rp(_0x15a6f1)['then'](function(_0x113332){var _0x36c03b=_0x113332[_0x6275('0xb')][_0x6275('0xe')];_0x46f1f1(_0x36c03b);});});}function getRemoteTag(_0x2253c7,_0x1e024d,_0x22e3c6,_0x27717e,_0x589b65){return new Promise(function(_0x5d75b6,_0xefe268){var _0x24e56c={'method':_0x6275('0x9'),'uri':_0x22e3c6+_0x6275('0x44')+_0x6275('0x45')+_0x2253c7+'&'+_0x27717e,'auth':_0x1e024d,'json':!![]};return rp(_0x24e56c)['then'](function(_0x585ffe){if(_0x585ffe[_0x6275('0xb')]['length']>0x0){var _0x148318=_0x585ffe[_0x6275('0xb')][0x0][_0x6275('0xe')];_0x5d75b6(_0x148318);}else{return createRemoteTag(_0x2253c7,_0x1e024d,_0x22e3c6,_0x27717e)[_0x6275('0x1a')](function(_0x4c4f18){_0x5d75b6(_0x4c4f18);});}});});}function assignTagToIncident(_0x516ce0,_0x3a6e8b,_0x1075a7,_0x1d4948,_0x1b6565){return new Promise(function(_0x1b72e5,_0xee24f){var _0x1368f1={'method':_0x6275('0x22'),'uri':_0x1075a7+_0x6275('0x46')+'?'+_0x1b6565,'body':{'label':_0x516ce0,'table':_0x6275('0x47'),'id_type':'Incident','table_key':_0x1d4948['ticketId'],'title':_0x6275('0x48')+_0x1d4948[_0x6275('0x49')],'id_display':_0x1d4948[_0x6275('0x49')]},'auth':_0x3a6e8b,'json':!![]};return rp(_0x1368f1)[_0x6275('0x1a')](function(_0x42a584){_0x1b72e5();})[_0x6275('0x11')](function(){_0x1b72e5();});});}function manageTags(_0x3312cc,_0x1e65e2,_0x5dd083,_0x26157b,_0x4523e0,_0x75f65e,_0x12174b){return new Promise(function(_0x36cc9c,_0x57283e){var _0x355e8d=[];_0x1e65e2[_0x6275('0x2c')](function(_0x5cfb6d){_0x355e8d[_0x6275('0x4a')](getRemoteTag(_0x5cfb6d,_0x5dd083,_0x26157b,_0x75f65e,_0x12174b));});return Promise[_0x6275('0x4b')](_0x355e8d)[_0x6275('0x1a')](function(_0x1a5414){if(_0x1a5414['length']){logger['info']('['+[_0x3312cc[_0x6275('0xf')]()]+_0x6275('0x4c'),_0x1a5414);var _0x5935cc=[];_0x1a5414['forEach'](function(_0xcbc99f){_0x5935cc[_0x6275('0x4a')](assignTagToIncident(_0xcbc99f,_0x5dd083,_0x26157b,_0x4523e0,_0x75f65e));});return Promise[_0x6275('0x4b')](_0x5935cc)['then'](function(){_0x36cc9c();})[_0x6275('0x11')](function(){_0x36cc9c();});}else{_0x36cc9c();}});});}function getTags(_0x227d8c,_0xe3e886,_0x10b56f,_0x1e592f,_0x444781,_0x455d55){return function(_0x432fc9){return new Promise(function(_0x15a2b7,_0x53bb4f){var _0xa7d689=[];var _0x1bc5aa=_0x1e592f[_0x6275('0x4d')];if(_0x1bc5aa&&_0x1bc5aa['length']>0x0){_0xa7d689=_[_0x6275('0x4e')](_0x1bc5aa,_0x6275('0x3b'));}if(_0xa7d689[_0x6275('0xc')]>0x0){return manageTags(_0x227d8c,_0xa7d689,_0xe3e886,_0x10b56f,_0x432fc9,_0x444781,_0x455d55)[_0x6275('0x1a')](function(){_0x15a2b7(_0x432fc9);});}else{_0x15a2b7(_0x432fc9);}});};}function emit(_0x54ac02,_0x18efd9,_0x58a387){var _0x28fc32=_0x6275('0x4f')+_0x6275('0x50')+_0x6275('0x51')+'%255EORDERBYDESCnumber';var _0x126813={'uri':_0x54ac02+_0x6275('0x52')+_0x58a387+_0x28fc32};io['to'](util['format'](_0x6275('0x53'),_0x18efd9))[_0x6275('0x54')](_0x6275('0x55'),_0x126813);}exports['cs']=function(_0x553e7a,_0x59b6df,_0x56d0fa,_0x5e1295,_0x2a1fbd,_0x18dcbc,_0x447416,_0x29587e){var _0x193a0d={};var _0x154cb1={'user':_0x18dcbc['username'],'pass':_0x18dcbc[_0x6275('0x56')]};var _0x3ad8c4=_0x6275('0x57');var _0x12bcbc='sysparm_display_value=true';_0x18dcbc[_0x6275('0x58')]=intUtil[_0x6275('0x59')](_0x18dcbc['remoteUri']);_0x18dcbc[_0x6275('0x5a')]=intUtil['stripTrailingSlash'](_0x18dcbc[_0x6275('0x5a')]);var _0x2f79ce=util[_0x6275('0x5b')](_0x6275('0x5c'),_0x18dcbc[_0x6275('0x58')]);_0x193a0d[_0x6275('0x17')]=!_['isNil'](_0x5e1295)?_0x5e1295['email']:null;_0x193a0d[_0x6275('0x21')]=_0x18dcbc[_0x6275('0x5d')];_0x193a0d[_0x6275('0x24')]=_0x29587e[_0x6275('0x36')]()===_0x6275('0x3c')?_0x59b6df[_0x6275('0x5e')]:_0x59b6df[_0x6275('0x5f')];_0x193a0d[_0x6275('0x60')]=_0x29587e===_0x6275('0x61')||_0x29587e===_0x6275('0x62')?_0x6275('0x61'):_0x6275('0x3c');var _0x1aa329=util['format'](_0x6275('0x63'),_0x18dcbc[_0x6275('0x5a')],_0x59b6df[_0x6275('0x64')],md5(_0x59b6df[_0x6275('0x64')]));if(_0x2a1fbd&&_0x2a1fbd[_0x6275('0x65')]){logger[_0x6275('0x14')](_0x6275('0x66'),'Recording\x20is\x20enabled!');_0x59b6df[_0x6275('0x67')]=_0x1aa329;}else if(_0x447416&&_0x447416['recordingFormat']&&_0x447416[_0x6275('0x68')]!=='none'){logger[_0x6275('0x14')]('[OUTBOUND]',_0x6275('0x69'));_0x59b6df[_0x6275('0x67')]=_0x1aa329;}else{_0x59b6df[_0x6275('0x67')]='';}return getAdminUser(_0x29587e,_0x154cb1,_0x193a0d,_0x2f79ce,_0x12bcbc,_0x3ad8c4)[_0x6275('0x1a')](getUser(_0x29587e,_0x154cb1,_0x2f79ce,_0x12bcbc,_0x3ad8c4))['then'](getEndUser(_0x29587e,_0x154cb1,_0x2f79ce,_0x12bcbc,_0x3ad8c4))[_0x6275('0x1a')](getTicket(_0x29587e,_0x154cb1,_0x2f79ce,_0x56d0fa,_0x59b6df,_0x12bcbc))[_0x6275('0x1a')](function(_0x447a12){logger['info'](util[_0x6275('0x5b')]('The\x20ticket\x20ID\x20is:\x20%s',_0x447a12[_0x6275('0x42')]));logger[_0x6275('0x14')](util[_0x6275('0x5b')]('call\x20direction:\x20%s',_0x29587e));if(_0x29587e!==_0x6275('0x62')){logger[_0x6275('0x14')]('['+[_0x29587e[_0x6275('0xf')]()]+']',_0x6275('0x6a'));emit(_0x18dcbc[_0x6275('0x58')],_0x5e1295[_0x6275('0x3b')],_0x447a12[_0x6275('0x42')]);}})['catch'](function(_0x53772c){logger[_0x6275('0x12')]('['+[_0x29587e[_0x6275('0xf')]()]+_0x6275('0x6b'),util[_0x6275('0x6c')](_0x53772c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x35a7=['%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','isNil','email','adminEmail','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','request-promise','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','userId','adminId','userEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','string','picklist','type','nameField','toLowerCase','toString','includes','idField','content','variable','customField','Variable','name','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','ticketId','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','forEach','Tags','map'];(function(_0x2201e1,_0x50ba88){var _0x5a063f=function(_0x147463){while(--_0x147463){_0x2201e1['push'](_0x2201e1['shift']());}};_0x5a063f(++_0x50ba88);}(_0x35a7,0x1bb));var _0x735a=function(_0x4f51e2,_0x4508cd){_0x4f51e2=_0x4f51e2-0x0;var _0x3d1fd6=_0x35a7[_0x4f51e2];return _0x3d1fd6;};'use strict';var _=require(_0x735a('0x0'));var Promise=require('bluebird');var rp=require(_0x735a('0x1'));var util=require(_0x735a('0x2'));var md5=require(_0x735a('0x3'));var Redis=require(_0x735a('0x4'));var intUtil=require(_0x735a('0x5'));var config=require(_0x735a('0x6'));var logger=require('../../../../config/logger')(_0x735a('0x7'));config[_0x735a('0x8')]=_[_0x735a('0x9')](config[_0x735a('0x8')],{'host':_0x735a('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x735a('0x8')]));function getAdminUser(_0x22e742,_0x375be0,_0xc3a7b8,_0x3b0db1,_0xf29421,_0x5c4889){return new Promise(function(_0x4590d5,_0x3ea3c0){var _0xc9f701={'method':_0x735a('0xb'),'uri':_0x3b0db1+_0x735a('0xc')+'&'+_0xf29421+'&'+_0x5c4889,'auth':_0x375be0,'json':!![]};return rp(_0xc9f701)[_0x735a('0xd')](function(_0x2b3f88){if(_0x2b3f88[_0x735a('0xe')][_0x735a('0xf')]>0x0){_0xc3a7b8['adminId']=_0x2b3f88[_0x735a('0xe')][0x0][_0x735a('0x10')];}logger[_0x735a('0x11')]('['+[_0x22e742[_0x735a('0x12')]()]+_0x735a('0x13'),_0xc3a7b8);_0x4590d5(_0xc3a7b8);})[_0x735a('0x14')](function(_0x5edaba){logger[_0x735a('0x15')]('['+[_0x22e742['toUpperCase']()]+']',_0x5edaba[_0x735a('0x16')]);_0x3ea3c0(_0x5edaba['message']);});});}function getUser(_0x8b7303,_0x224525,_0x1720ba,_0xa05b9d,_0x1fd2fd){return function(_0xb75cd5){logger[_0x735a('0x11')]('['+[_0x8b7303[_0x735a('0x12')]()]+'],\x20getUser\x20input\x20crm',_0xb75cd5);return new Promise(function(_0x4fc0bf,_0x4d6765){if(intUtil[_0x735a('0x17')](_0xb75cd5['userEmail'])){var _0x4fe49d={'method':_0x735a('0xb'),'uri':_0x1720ba+_0x735a('0x18')+_0xb75cd5['userEmail']+'&'+_0xa05b9d+'&'+_0x1fd2fd,'auth':_0x224525,'json':!![]};logger['info']('['+[_0x8b7303[_0x735a('0x12')]()]+'],\x20getUser\x20rp\x20obj',_0x4fe49d);return rp(_0x4fe49d)['then'](function(_0x470d7c){logger[_0x735a('0x11')]('['+[_0x8b7303[_0x735a('0x12')]()]+_0x735a('0x19'),_0x470d7c);if(_0x470d7c[_0x735a('0xe')][_0x735a('0xf')]>0x0&&String(_0x470d7c[_0x735a('0xe')][0x0][_0x735a('0x1a')])===_0x735a('0x1b')){_0xb75cd5[_0x735a('0x1c')]=_0x470d7c[_0x735a('0xe')][0x0][_0x735a('0x10')];}else{_0xb75cd5[_0x735a('0x1c')]=_0xb75cd5[_0x735a('0x1d')];_0xb75cd5[_0x735a('0x1e')]=_0xb75cd5['adminEmail'];}logger[_0x735a('0x11')]('['+[_0x8b7303['toUpperCase']()]+_0x735a('0x1f'),_0xb75cd5);_0x4fc0bf(_0xb75cd5);})[_0x735a('0x14')](function(_0x50a78e){logger[_0x735a('0x15')]('['+[_0x8b7303[_0x735a('0x12')]()]+']',_0x50a78e[_0x735a('0x16')]);_0x4d6765(_0x50a78e[_0x735a('0x16')]);});}else{logger[_0x735a('0x11')]('['+[_0x8b7303[_0x735a('0x12')]()]+_0x735a('0x20'));_0xb75cd5[_0x735a('0x1c')]=_0xb75cd5[_0x735a('0x1d')];_0xb75cd5[_0x735a('0x1e')]=_0xb75cd5['adminEmail'];_0x4fc0bf(_0xb75cd5);}});};}function createEndUser(_0x39e8a4,_0x22a953,_0x47b399,_0x59ffa0,_0x4c2d67){logger['info']('['+[_0x39e8a4[_0x735a('0x12')]()]+_0x735a('0x21'),_0x47b399);return new Promise(function(_0x5717f9,_0x49aa64){var _0x22805d={'method':_0x735a('0x22'),'uri':_0x59ffa0+_0x735a('0x23')+_0x4c2d67,'body':{'user_name':_0x47b399[_0x735a('0x24')],'roles':_0x735a('0x25'),'first_name':_0x47b399[_0x735a('0x24')],'active':_0x735a('0x1b'),'date_format':_0x735a('0x26'),'phone':_0x47b399[_0x735a('0x24')]},'auth':_0x22a953,'json':!![]};return rp(_0x22805d)[_0x735a('0xd')](function(_0x23e444){logger[_0x735a('0x11')]('['+[_0x39e8a4['toUpperCase']()]+_0x735a('0x27'),_0x23e444[_0x735a('0xe')]);_0x47b399[_0x735a('0x28')]=_0x23e444[_0x735a('0xe')]['sys_id'];_0x5717f9(_0x47b399);})['catch'](function(_0x5e8721){logger[_0x735a('0x15')]('['+[_0x39e8a4[_0x735a('0x12')]()]+']',_0x5e8721[_0x735a('0x16')]);_0x49aa64(_0x5e8721[_0x735a('0x16')]);});});}function getEndUser(_0x6ecd1b,_0x302639,_0x3df87e,_0x52af4f,_0x968f9e){return function(_0x3a34f5){logger[_0x735a('0x11')]('['+[_0x6ecd1b[_0x735a('0x12')]()]+_0x735a('0x29'),_0x3a34f5);return new Promise(function(_0xafd09b,_0x46dd82){var _0x1fcff3={'method':_0x735a('0xb'),'uri':_0x3df87e+_0x735a('0x2a')+_0x3a34f5[_0x735a('0x24')]+'&'+_0x52af4f+'&'+_0x968f9e,'auth':_0x302639,'json':!![]};return rp(_0x1fcff3)['then'](function(_0xed46aa){if(_0xed46aa[_0x735a('0xe')][_0x735a('0xf')]>0x0){_0x3a34f5[_0x735a('0x28')]=_0xed46aa[_0x735a('0xe')][0x0][_0x735a('0x10')];logger[_0x735a('0x11')]('['+[_0x6ecd1b[_0x735a('0x12')]()]+_0x735a('0x2b'),_0x3a34f5);_0xafd09b(_0x3a34f5);}else{return createEndUser(_0x6ecd1b,_0x302639,_0x3a34f5,_0x3df87e,_0x52af4f)[_0x735a('0xd')](function(_0x1770b8){logger[_0x735a('0x11')]('['+[_0x6ecd1b[_0x735a('0x12')]()]+'],\x20createEndUser\x20crm',_0x1770b8);_0xafd09b(_0x1770b8);});}})[_0x735a('0x14')](function(_0x5a7ffd){logger[_0x735a('0x15')]('['+[_0x6ecd1b[_0x735a('0x12')]()]+']',_0x5a7ffd['message']);_0x46dd82(_0x5a7ffd[_0x735a('0x16')]);});});};}function getCustomFields(_0x3be576,_0x1acf61){var _0x579ed7={};if(_0x3be576[_0x735a('0xf')]>0x0){_['forEach'](_0x3be576,function(_0x1b9d83){if(_['includes']([_0x735a('0x2c'),_0x735a('0x2d')],_0x1b9d83[_0x735a('0x2e')])&&_0x1b9d83['nameField']&&!_0x1b9d83['customField']){_0x579ed7[_0x1b9d83[_0x735a('0x2f')][_0x735a('0x30')]()]=_0x1b9d83['content'][_0x735a('0x31')]();}else if(_[_0x735a('0x32')]([_0x735a('0x2c'),_0x735a('0x2d')],_0x1b9d83[_0x735a('0x2e')])&&_0x1b9d83[_0x735a('0x33')]&&_0x1b9d83['customField']){_0x579ed7[_0x1b9d83[_0x735a('0x33')]['toLowerCase']()]=_0x1b9d83[_0x735a('0x34')][_0x735a('0x31')]();}else if(_0x1b9d83[_0x735a('0x2e')]===_0x735a('0x35')&&_0x1b9d83['variableName']&&_0x1b9d83[_0x735a('0x33')]&&_0x1b9d83[_0x735a('0x36')]){_0x579ed7[_0x1b9d83['idField'][_0x735a('0x30')]()]=_0x1acf61[_0x1b9d83['variableName']][_0x735a('0x31')]();}else if(_0x1b9d83[_0x735a('0x2e')]==='customVariable'&&_0x1b9d83[_0x735a('0x37')]&&_0x1b9d83['Variable']['name']&&_0x1b9d83[_0x735a('0x33')]&&_0x1b9d83[_0x735a('0x36')]){_0x579ed7[_0x1b9d83[_0x735a('0x33')][_0x735a('0x30')]()]=_0x1acf61[_0x1b9d83['Variable'][_0x735a('0x38')][_0x735a('0x30')]()][_0x735a('0x31')]();}});}return _0x579ed7;}function getTicket(_0xba98b7,_0x560861,_0x4352d2,_0x556312,_0x508666,_0x219953){return function(_0x46b01a){logger[_0x735a('0x11')]('['+[_0xba98b7[_0x735a('0x12')]()]+']\x20getTicket\x20input\x20crm',_0x46b01a);return new Promise(function(_0x5114de,_0x46c46b){var _0x4b1eab=_0xba98b7[_0x735a('0x30')]()===_0x735a('0x39')?_0x46b01a[_0x735a('0x1c')]:_0x46b01a[_0x735a('0x28')];var _0x54b70a={'method':_0x735a('0x22'),'uri':_0x4352d2+_0x735a('0x3a')+'?'+_0x219953,'body':Object[_0x735a('0x3b')]({},{'active':'true','caller_id':_0x4b1eab,'assigned_to':_0x46b01a[_0x735a('0x1c')],'short_description':intUtil[_0x735a('0x3c')](_0x556312[_0x735a('0x3d')],_0x508666,'\x20'),'description':intUtil[_0x735a('0x3c')](_0x556312[_0x735a('0x3e')],_0x508666,'\x0a')},getCustomFields(_0x556312[_0x735a('0x3f')],_0x508666)),'auth':_0x560861,'json':!![]};return rp(_0x54b70a)['then'](function(_0x2e726d){logger[_0x735a('0x11')]('['+[_0xba98b7[_0x735a('0x12')]()]+_0x735a('0x40'),_0x2e726d[_0x735a('0xe')]);_0x46b01a['ticketId']=_0x2e726d[_0x735a('0xe')][_0x735a('0x10')];_0x46b01a[_0x735a('0x41')]=_0x2e726d[_0x735a('0xe')][_0x735a('0x42')];logger[_0x735a('0x11')]('['+[_0xba98b7['toUpperCase']()]+_0x735a('0x43'),_0x46b01a);_0x5114de(_0x46b01a);})[_0x735a('0x14')](function(_0x2ca322){logger[_0x735a('0x15')]('['+[_0xba98b7[_0x735a('0x12')]()]+']',_0x2ca322[_0x735a('0x16')]);_0x46c46b(_0x2ca322[_0x735a('0x16')]);});});};}function createRemoteTag(_0x33607a,_0x3eb6f5,_0x3eace6,_0x495b27){return new Promise(function(_0x463f0e,_0x509e8c){var _0x291650={'method':_0x735a('0x22'),'uri':_0x3eace6+_0x735a('0x44')+'?'+_0x495b27,'body':{'short_description':_0x33607a,'global':!![],'active':!![],'name':_0x33607a},'auth':_0x3eb6f5,'json':!![]};return rp(_0x291650)['then'](function(_0x16d870){var _0x1de714=_0x16d870['result'][_0x735a('0x10')];_0x463f0e(_0x1de714);});});}function getRemoteTag(_0x55a7fd,_0x78dcda,_0x18b04d,_0x4b35fd,_0x58cfca){return new Promise(function(_0x46e120,_0x25f9a7){var _0xa78a6b={'method':_0x735a('0xb'),'uri':_0x18b04d+_0x735a('0x44')+'?sysparm_query=name%3D'+_0x55a7fd+'&'+_0x4b35fd,'auth':_0x78dcda,'json':!![]};return rp(_0xa78a6b)[_0x735a('0xd')](function(_0x4aa22f){if(_0x4aa22f[_0x735a('0xe')][_0x735a('0xf')]>0x0){var _0x14ffc9=_0x4aa22f['result'][0x0]['sys_id'];_0x46e120(_0x14ffc9);}else{return createRemoteTag(_0x55a7fd,_0x78dcda,_0x18b04d,_0x4b35fd)[_0x735a('0xd')](function(_0xeb11c8){_0x46e120(_0xeb11c8);});}});});}function assignTagToIncident(_0x262c73,_0x35d73f,_0x1add46,_0x22412b,_0x1197e3){return new Promise(function(_0x4aa765,_0x26364a){var _0x2beb2b={'method':_0x735a('0x22'),'uri':_0x1add46+'label_entry'+'?'+_0x1197e3,'body':{'label':_0x262c73,'table':_0x735a('0x3a'),'id_type':'Incident','table_key':_0x22412b[_0x735a('0x45')],'title':_0x735a('0x46')+_0x22412b[_0x735a('0x41')],'id_display':_0x22412b['ticketNumber']},'auth':_0x35d73f,'json':!![]};return rp(_0x2beb2b)[_0x735a('0xd')](function(_0x5ef521){_0x4aa765();})[_0x735a('0x14')](function(){_0x4aa765();});});}function manageTags(_0x1089d8,_0xbf83e,_0x11ab8c,_0x2f8e6d,_0x41ca99,_0xb46530,_0x164956){return new Promise(function(_0x6f0415,_0x1006a5){var _0x355eb7=[];_0xbf83e['forEach'](function(_0x26f19e){_0x355eb7[_0x735a('0x47')](getRemoteTag(_0x26f19e,_0x11ab8c,_0x2f8e6d,_0xb46530,_0x164956));});return Promise[_0x735a('0x48')](_0x355eb7)['then'](function(_0x4bb37e){if(_0x4bb37e[_0x735a('0xf')]){logger[_0x735a('0x11')]('['+[_0x1089d8[_0x735a('0x12')]()]+_0x735a('0x49'),_0x4bb37e);var _0x24eb58=[];_0x4bb37e[_0x735a('0x4a')](function(_0xef0d03){_0x24eb58[_0x735a('0x47')](assignTagToIncident(_0xef0d03,_0x11ab8c,_0x2f8e6d,_0x41ca99,_0xb46530));});return Promise['all'](_0x24eb58)[_0x735a('0xd')](function(){_0x6f0415();})[_0x735a('0x14')](function(){_0x6f0415();});}else{_0x6f0415();}});});}function getTags(_0x2957c6,_0x2bcca5,_0x1acec8,_0x125132,_0x3b0e0a,_0x30499a){return function(_0x2ecd87){return new Promise(function(_0x18040f,_0x232a8c){var _0x3bd22a=[];var _0x49357a=_0x125132[_0x735a('0x4b')];if(_0x49357a&&_0x49357a['length']>0x0){_0x3bd22a=_[_0x735a('0x4c')](_0x49357a,_0x735a('0x38'));}if(_0x3bd22a[_0x735a('0xf')]>0x0){return manageTags(_0x2957c6,_0x3bd22a,_0x2bcca5,_0x1acec8,_0x2ecd87,_0x3b0e0a,_0x30499a)[_0x735a('0xd')](function(){_0x18040f(_0x2ecd87);});}else{_0x18040f(_0x2ecd87);}});};}function emit(_0x481e3d,_0x459dfb,_0x449332){var _0x34cc0b='%26sysparm_record_target%3Dincident'+_0x735a('0x4d')+_0x735a('0x4e')+_0x735a('0x4f');var _0x2ef494={'uri':_0x481e3d+_0x735a('0x50')+_0x449332+_0x34cc0b};io['to'](util['format'](_0x735a('0x51'),_0x459dfb))['emit']('trigger:browser:url',_0x2ef494);}exports['cs']=function(_0x3e5e6d,_0xb8709d,_0x347c4b,_0x115635,_0x2ac31a,_0x265015,_0x50f448,_0x319037){var _0x4fbc0b={};var _0x146585={'user':_0x265015[_0x735a('0x52')],'pass':_0x265015['password']};var _0x429b75=_0x735a('0x53');var _0x58eaee=_0x735a('0x54');_0x265015[_0x735a('0x55')]=intUtil[_0x735a('0x56')](_0x265015[_0x735a('0x55')]);_0x265015[_0x735a('0x57')]=intUtil['stripTrailingSlash'](_0x265015[_0x735a('0x57')]);var _0x4337e2=util[_0x735a('0x58')]('%s/api/now/table/',_0x265015['remoteUri']);_0x4fbc0b['userEmail']=!_[_0x735a('0x59')](_0x115635)?_0x115635[_0x735a('0x5a')]:null;_0x4fbc0b[_0x735a('0x5b')]=_0x265015['email'];_0x4fbc0b['endUserNumber']=_0x319037[_0x735a('0x30')]()===_0x735a('0x39')?_0xb8709d[_0x735a('0x5c')]:_0xb8709d[_0x735a('0x5d')];_0x4fbc0b[_0x735a('0x5e')]=_0x319037===_0x735a('0x5f')||_0x319037===_0x735a('0x60')?'queue':_0x735a('0x39');var _0x16fccd=util[_0x735a('0x58')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x265015[_0x735a('0x57')],_0xb8709d[_0x735a('0x61')],md5(_0xb8709d[_0x735a('0x61')]));if(_0x2ac31a&&_0x2ac31a['monitor_format']){logger['info']('[QUEUE]',_0x735a('0x62'));_0xb8709d[_0x735a('0x63')]=_0x16fccd;}else if(_0x50f448&&_0x50f448[_0x735a('0x64')]&&_0x50f448['recordingFormat']!=='none'){logger[_0x735a('0x11')]('[OUTBOUND]',_0x735a('0x62'));_0xb8709d[_0x735a('0x63')]=_0x16fccd;}else{_0xb8709d['recordingURL']='';}return getAdminUser(_0x319037,_0x146585,_0x4fbc0b,_0x4337e2,_0x58eaee,_0x429b75)[_0x735a('0xd')](getUser(_0x319037,_0x146585,_0x4337e2,_0x58eaee,_0x429b75))[_0x735a('0xd')](getEndUser(_0x319037,_0x146585,_0x4337e2,_0x58eaee,_0x429b75))['then'](getTicket(_0x319037,_0x146585,_0x4337e2,_0x347c4b,_0xb8709d,_0x58eaee))['then'](function(_0x253d55){logger[_0x735a('0x11')](util['format'](_0x735a('0x65'),_0x253d55[_0x735a('0x45')]));logger[_0x735a('0x11')](util[_0x735a('0x58')]('call\x20direction:\x20%s',_0x319037));if(_0x319037!==_0x735a('0x60')){logger[_0x735a('0x11')]('['+[_0x319037['toUpperCase']()]+']',_0x735a('0x66'));emit(_0x265015[_0x735a('0x55')],_0x115635['name'],_0x253d55[_0x735a('0x45')]);}})[_0x735a('0x14')](function(_0x24b62d){logger['error']('['+[_0x319037[_0x735a('0x12')]()]+_0x735a('0x67'),util['inspect'](_0x24b62d,{'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 751d044..de175da 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 _0x3ae1=['name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','duration_hours','parent_id','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','Basic\x20%s','apiKey','base64','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','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','debug','[HTTP]','merge','map','string','nameField','toLowerCase','content','type','custom_fields','toString','variable','customField','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','contacts','unmanaged','lastevent','toUpperCase','calleridname','Inbound','catch','lodash','request-promise','util','ioredis','./util','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...'];(function(_0x37c3b5,_0xfabbd0){var _0xb93b=function(_0x2ee89a){while(--_0x2ee89a){_0x37c3b5['push'](_0x37c3b5['shift']());}};_0xb93b(++_0xfabbd0);}(_0x3ae1,0x6f));var _0x13ae=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x3ae1[_0x34021d];return _0x16597b;};'use strict';var _=require(_0x13ae('0x0'));var rp=require(_0x13ae('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x13ae('0x2'));var Redis=require(_0x13ae('0x3'));var intUtil=require(_0x13ae('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x13ae('0x5'));config[_0x13ae('0x6')]=_[_0x13ae('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x13ae('0x8'))(new Redis(config[_0x13ae('0x6')]));var def={'method':_0x13ae('0x9'),'json':!![]};function emit(_0x31dbd2,_0x290c6a,_0x204997){io['to'](_0x31dbd2)[_0x13ae('0xa')](_0x290c6a,_0x204997);}function getTicket(_0x56f351,_0x3c1a04,_0x52a137,_0x51533a,_0x52dd0d,_0x3db653,_0x455309,_0x4ec736){logger['info'](_0x13ae('0xb'));var _0x65bedb=new Date();var _0x4f1330=[{'name':_0x13ae('0xc'),'value':intUtil[_0x13ae('0xd')](_0x51533a[_0x13ae('0xe')],_0x52dd0d,'\x20')},{'name':_0x13ae('0xf'),'value':_0x3c1a04['id']},{'name':'created_by','value':_0x3c1a04['id']},{'name':_0x13ae('0x10'),'value':intUtil[_0x13ae('0xd')](_0x51533a[_0x13ae('0x11')],_0x52dd0d,'\x0a')},{'name':_0x13ae('0x12'),'value':_0x65bedb[_0x13ae('0x13')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x13ae('0x14'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x13ae('0x15'),'value':_0x52a137['id']},{'name':'parent_type','value':_0x13ae('0x16')},{'name':_0x13ae('0x17'),'value':_0x52a137['name']},{'name':_0x13ae('0x18'),'value':_0x4ec736}];if(_0x3db653[_0x13ae('0x19')]){_[_0x13ae('0x1a')](_0x3db653,function(_0x1e1443){if(_0x52dd0d[_0x1e1443[_0x13ae('0x1b')]]){_0x4f1330[_0x13ae('0x1c')]({'name':_0x1e1443[_0x13ae('0x1d')],'value':_0x52dd0d[_0x1e1443['variableName']]});}});}return request({'form':{'method':_0x13ae('0x1e'),'input_type':_0x13ae('0x1f'),'response_type':'JSON','rest_data':JSON[_0x13ae('0x20')]({'session':_0x455309['id'],'module_name':_0x13ae('0x21'),'name_value_list':_0x4f1330})}});}function getAuth(_0x5c08fe){return util['format'](_0x13ae('0x22'),new Buffer(_0x5c08fe[_0x13ae('0x23')]+':X')['toString'](_0x13ae('0x24')));}function getServerInfo(_0x1ae301){return request({'form':{'method':_0x13ae('0x25'),'input_type':_0x13ae('0x1f'),'response_type':_0x13ae('0x1f'),'rest_data':JSON['stringify']({'session':_0x1ae301['id']})}});}function getUser(_0x56958e,_0x4b857b,_0x4cac92){if(!_[_0x13ae('0x26')](_0x4b857b)){logger[_0x13ae('0x27')](_0x13ae('0x28'),_0x4b857b);return request({'form':{'method':'get_entry_list','input_type':_0x13ae('0x1f'),'response_type':_0x13ae('0x1f'),'rest_data':JSON[_0x13ae('0x20')]({'session':_0x4cac92['id'],'module_name':_0x13ae('0x29'),'query':util[_0x13ae('0x2a')](_0x13ae('0x2b'),_0x4b857b),'order_by':'','offset':'0','select_fields':['id',_0x13ae('0xc'),_0x13ae('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x13ae('0x2d')](function(_0x10ca56){if(_0x10ca56['entry_list']['length']){var _0xcceb3e=_[_0x13ae('0x2e')](_0x10ca56[_0x13ae('0x2f')],function(_0x523f4f){return _0x523f4f[_0x13ae('0x30')]['user_name'][_0x13ae('0x31')]===_0x4b857b;});if(_0xcceb3e){logger['info']('Agent\x20found!');return BPromise[_0x13ae('0x32')]({'id':_0xcceb3e[_0x13ae('0x30')]['id']['value'],'name':_0xcceb3e['name_value_list'][_0x13ae('0xc')][_0x13ae('0x31')]});}}logger[_0x13ae('0x27')](_0x13ae('0x33'));return BPromise[_0x13ae('0x32')]({'id':_0x4cac92['name_value_list'][_0x13ae('0x34')][_0x13ae('0x31')],'name':_0x4cac92[_0x13ae('0x30')]['user_name'][_0x13ae('0x31')]});});}else{logger[_0x13ae('0x27')](_0x13ae('0x35'));return BPromise['resolve']({'id':_0x4cac92[_0x13ae('0x30')][_0x13ae('0x34')]['value'],'name':_0x4cac92[_0x13ae('0x30')][_0x13ae('0x2c')][_0x13ae('0x31')]});}}function getEndUser(_0x191c5d,_0x2b4b35,_0x25e4a5,_0x4d9757){logger['info'](_0x13ae('0x36'),_0x25e4a5);return request({'form':{'method':_0x13ae('0x37'),'input_type':_0x13ae('0x1f'),'response_type':_0x13ae('0x1f'),'rest_data':JSON[_0x13ae('0x20')]({'session':_0x4d9757['id'],'module_name':_0x13ae('0x16'),'query':util[_0x13ae('0x2a')](_0x13ae('0x38'),_0x25e4a5),'order_by':'','offset':'0','select_fields':['id',_0x13ae('0xc'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x13ae('0x2d')](function(_0x5436be){if(_0x5436be[_0x13ae('0x2f')][_0x13ae('0x19')]){var _0x1c899c=_[_0x13ae('0x2e')](_0x5436be[_0x13ae('0x2f')],function(_0x5a4f99){return _0x5a4f99[_0x13ae('0x30')][_0x13ae('0x39')][_0x13ae('0x31')]===_0x25e4a5;});if(_0x1c899c){logger[_0x13ae('0x27')](_0x13ae('0x3a'));return BPromise[_0x13ae('0x32')]({'id':_0x1c899c[_0x13ae('0x30')]['id'][_0x13ae('0x31')],'name':_0x1c899c[_0x13ae('0x30')][_0x13ae('0xc')][_0x13ae('0x31')],'phone':_0x1c899c[_0x13ae('0x30')]['phone_home'][_0x13ae('0x31')]});}}else{logger[_0x13ae('0x27')](_0x13ae('0x3b'));return request({'form':{'method':'set_entry','input_type':_0x13ae('0x1f'),'response_type':_0x13ae('0x1f'),'rest_data':JSON[_0x13ae('0x20')]({'session':_0x4d9757['id'],'module_name':_0x13ae('0x16'),'name_value_list':[{'name':_0x13ae('0x3c'),'value':_0x2b4b35!==''?_0x2b4b35:util[_0x13ae('0x2a')](_0x13ae('0x3d'),_0x25e4a5)},{'name':_0x13ae('0x39'),'value':_0x25e4a5}]})}})[_0x13ae('0x2d')](function(_0x1c0d99){logger[_0x13ae('0x27')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x1c0d99['id'],'name':_0x1c0d99[_0x13ae('0x2f')][_0x13ae('0x3c')]['value'],'phone':_0x1c0d99['entry_list'][_0x13ae('0x39')][_0x13ae('0x31')]});});}});}function request(_0x2f701a){logger[_0x13ae('0x3e')](_0x13ae('0x3f'),JSON[_0x13ae('0x20')](_0x2f701a));return rp(_[_0x13ae('0x40')](def,_0x2f701a));}function getTags(_0xf712a0,_0x59f2ff){var _0x4fb9e1=[];if(_0xf712a0&&_0xf712a0[_0x13ae('0x19')]>0x0){_0x4fb9e1=_[_0x13ae('0x41')](_0xf712a0,_0x59f2ff);}return _0x4fb9e1;}function getCustomFields(_0x403835,_0x21a238){var _0x5854c9=[];var _0x2e792b={'custom_fields':[]};if(_0x403835[_0x13ae('0x19')]>0x0){_[_0x13ae('0x1a')](_0x403835,function(_0x570cf9){if(_0x570cf9['type']===_0x13ae('0x42')&&_0x570cf9[_0x13ae('0x43')]&&!_0x570cf9['customField']){_0x2e792b[_0x570cf9[_0x13ae('0x43')][_0x13ae('0x44')]()]=_0x570cf9[_0x13ae('0x45')]['toString']();}else if(_0x570cf9[_0x13ae('0x46')]===_0x13ae('0x42')&&_0x570cf9[_0x13ae('0x1d')]&&_0x570cf9['customField']){_0x2e792b[_0x13ae('0x47')]['push']({'id':_0x570cf9[_0x13ae('0x1d')],'value':_0x570cf9['content'][_0x13ae('0x48')]()});}else if(_0x570cf9[_0x13ae('0x46')]===_0x13ae('0x49')&&_0x570cf9[_0x13ae('0x1b')]&&_0x570cf9['idField']&&_0x570cf9[_0x13ae('0x4a')]){_0x21a238[_0x570cf9['variableName']]&&_0x2e792b[_0x13ae('0x47')][_0x13ae('0x1c')]({'id':_0x570cf9['idField'],'value':_0x21a238[_0x570cf9[_0x13ae('0x1b')]][_0x13ae('0x48')]()});}else if(_0x570cf9[_0x13ae('0x46')]==='customVariable'&&_0x570cf9[_0x13ae('0x4b')]&&_0x570cf9[_0x13ae('0x4b')][_0x13ae('0xc')]&&_0x570cf9[_0x13ae('0x1d')]&&_0x570cf9[_0x13ae('0x4a')]){_0x21a238[_0x570cf9[_0x13ae('0x4b')][_0x13ae('0xc')][_0x13ae('0x44')]()]&&_0x2e792b[_0x13ae('0x47')][_0x13ae('0x1c')]({'id':_0x570cf9[_0x13ae('0x1d')],'value':_0x21a238[_0x570cf9['Variable']['name'][_0x13ae('0x44')]()][_0x13ae('0x48')]()});}});}return _0x2e792b;}function getConnection(_0xe6dc47){return request({'method':_0x13ae('0x9'),'form':{'method':_0x13ae('0x4c'),'input_type':'JSON','response_type':_0x13ae('0x1f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0xe6dc47[_0x13ae('0x4d')],'password':_0xe6dc47['password'],'encryption':_0x13ae('0x4e')},'application':_0x13ae('0x4f')})}})[_0x13ae('0x2d')](function(_0xbd76b2){var _0x3899ed=_0xbd76b2;if(_0x3899ed['id']){def[_0x13ae('0x50')]=_0x3899ed['id'];return BPromise[_0x13ae('0x32')](_0x3899ed);}else{throw new Error(util[_0x13ae('0x2a')](_0x13ae('0x51'),_0xe6dc47['id']));}});}function setRelationship(_0x19cd3b,_0x36d426,_0x398044,_0x1dabc1){return request({'form':{'method':_0x13ae('0x52'),'input_type':'JSON','response_type':_0x13ae('0x1f'),'rest_data':JSON[_0x13ae('0x20')]({'session':_0x19cd3b['id'],'module_name':_0x13ae('0x21'),'module_id':_0x398044['id'],'link_field_name':_0x1dabc1,'related_ids':[_0x36d426['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x13ae('0x53')]=function(_0x349539,_0x4ee35e,_0x255e5d,_0xa7d28e,_0x2eaac2,_0x55c567){var _0x4eda1c,_0x6adb43,_0x45bfbf,_0x39e3d1;_0x55c567[_0x13ae('0x54')]=intUtil[_0x13ae('0x55')](_0x55c567[_0x13ae('0x54')]);_0x55c567[_0x13ae('0x56')]=intUtil[_0x13ae('0x55')](_0x55c567[_0x13ae('0x56')]);def[_0x13ae('0x57')]=util[_0x13ae('0x2a')](_0x13ae('0x58'),_0x55c567[_0x13ae('0x54')]);if(_0x2eaac2&&_0x2eaac2[_0x13ae('0x59')]){logger[_0x13ae('0x27')](_0x13ae('0x5a'),_0x13ae('0x5b'));_0x4ee35e[_0x13ae('0x5c')]=util[_0x13ae('0x2a')](_0x13ae('0x5d'),_0x55c567[_0x13ae('0x56')],_0x4ee35e['uniqueid'],md5(_0x4ee35e[_0x13ae('0x5e')]));}else{_0x4ee35e['recordingURL']='';}return getConnection(_0x55c567)[_0x13ae('0x2d')](function(_0x3b7477){_0x39e3d1=_0x3b7477;return getUser(_0x55c567,_0xa7d28e[_0x13ae('0xc')],_0x39e3d1);})[_0x13ae('0x2d')](function(_0x1305ea){_0x4eda1c=_0x1305ea;logger[_0x13ae('0x27')](_0x13ae('0x5f'),_0x4eda1c['id']);return getEndUser(_0x55c567,_0x4ee35e['calleridname'],_0x4ee35e[_0x13ae('0x60')],_0x39e3d1);})[_0x13ae('0x2d')](function(_0x1a1f3a){_0x6adb43=_0x1a1f3a;logger[_0x13ae('0x27')](_0x13ae('0x61'),_0x6adb43['id']);return getTicket(_0x55c567,_0x4eda1c,_0x6adb43,_0x255e5d,_0x4ee35e,_0x255e5d['Fields'],_0x39e3d1,'Inbound');})['then'](function(_0x1c9649){_0x45bfbf=_0x1c9649;logger[_0x13ae('0x27')](_0x13ae('0x62'));logger['info'](_0x13ae('0x63'),_0x45bfbf['id']);return setRelationship(_0x39e3d1,_0x4eda1c,_0x45bfbf,_0x13ae('0x64'));})[_0x13ae('0x2d')](function(){return setRelationship(_0x39e3d1,_0x6adb43,_0x45bfbf,'contacts');})['then'](function(){return getServerInfo(_0x39e3d1);})[_0x13ae('0x2d')](function(_0x2c2745){var _0x2880f2=parseInt(_0x2c2745[_0x13ae('0x65')][_0x13ae('0x66')](0x0));var _0x19b1b7=util[_0x13ae('0x2a')](_0x13ae('0x67'),_0x55c567[_0x13ae('0x54')],_0x45bfbf['id']);if(_0x2880f2>0x6){_0x19b1b7=util[_0x13ae('0x2a')](_0x13ae('0x68'),_0x55c567[_0x13ae('0x54')],_0x45bfbf['id']);}logger[_0x13ae('0x27')](_0x13ae('0x5a'),_0x13ae('0x69'));emit(util['format'](_0x13ae('0x6a'),_0xa7d28e['name']),_0x13ae('0x6b'),{'uri':_0x19b1b7});})['catch'](function(_0x225ba7){logger[_0x13ae('0x6c')]('[QUEUE]',JSON['stringify'](_0x225ba7));});};exports[_0x13ae('0x6d')]=function(_0x3da093,_0x2428ae,_0xf869c7,_0x489f11,_0x2f144e,_0x477090,_0x4e7775){var _0x45b827,_0x38f66d,_0x4385bf,_0x22bcbf;_0x477090[_0x13ae('0x54')]=intUtil['stripTrailingSlash'](_0x477090[_0x13ae('0x54')]);_0x477090[_0x13ae('0x56')]=intUtil[_0x13ae('0x55')](_0x477090[_0x13ae('0x56')]);def[_0x13ae('0x57')]=util[_0x13ae('0x2a')](_0x13ae('0x58'),_0x477090[_0x13ae('0x54')]);if(_0x4e7775&&_0x4e7775[_0x13ae('0x6e')]&&_0x4e7775[_0x13ae('0x6e')]!==_0x13ae('0x6f')){logger[_0x13ae('0x27')](_0x13ae('0x70'),_0x13ae('0x5b'));_0x2428ae['recordingURL']=util[_0x13ae('0x2a')](_0x13ae('0x5d'),_0x477090[_0x13ae('0x56')],_0x2428ae[_0x13ae('0x5e')],md5(_0x2428ae[_0x13ae('0x5e')]));}return getConnection(_0x477090)[_0x13ae('0x2d')](function(_0x1f4130){_0x22bcbf=_0x1f4130;return getUser(_0x477090,_0x489f11[_0x13ae('0xc')],_0x22bcbf);})[_0x13ae('0x2d')](function(_0x1e6711){_0x45b827=_0x1e6711;logger[_0x13ae('0x27')]('The\x20User\x20ID\x20is:',_0x45b827['id']);return getEndUser(_0x477090,_0x2428ae[_0x13ae('0x71')],_0x2428ae[_0x13ae('0x72')],_0x22bcbf);})['then'](function(_0x34c791){_0x38f66d=_0x34c791;logger[_0x13ae('0x27')](_0x13ae('0x61'),_0x38f66d['id']);return getTicket(_0x477090,_0x45b827,_0x38f66d,_0xf869c7,_0x2428ae,_0xf869c7[_0x13ae('0x73')],_0x22bcbf,'Outbound');})['then'](function(_0x37af5d){_0x4385bf=_0x37af5d;logger[_0x13ae('0x27')](_0x13ae('0x62'));logger[_0x13ae('0x27')]('The\x20Ticket\x20ID\x20is:',_0x4385bf['id']);return setRelationship(_0x22bcbf,_0x45b827,_0x4385bf,_0x13ae('0x64'));})[_0x13ae('0x2d')](function(){return setRelationship(_0x22bcbf,_0x38f66d,_0x4385bf,_0x13ae('0x74'));})[_0x13ae('0x2d')](function(){return getServerInfo(_0x22bcbf);})['then'](function(_0x8ee7e6){var _0x3e841a=parseInt(_0x8ee7e6[_0x13ae('0x65')][_0x13ae('0x66')](0x0));var _0x3b7d94=util[_0x13ae('0x2a')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x477090[_0x13ae('0x54')],_0x4385bf['id']);if(_0x3e841a>0x6){_0x3b7d94=util[_0x13ae('0x2a')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x477090['remoteUri'],_0x4385bf['id']);}logger[_0x13ae('0x27')]('[OUTBOUND]',_0x13ae('0x69'));emit(util['format']('user:%s',_0x489f11[_0x13ae('0xc')]),_0x13ae('0x6b'),{'uri':_0x3b7d94});})['catch'](function(_0x55521d){logger['error'](_0x13ae('0x70'),JSON[_0x13ae('0x20')](_0x55521d));});};exports[_0x13ae('0x75')]=function(_0x14f16,_0x5242ef,_0x2a311a,_0x40b961,_0x280a7b,_0x50b84e){var _0x5b6623,_0x233abd,_0x5b4c86,_0x486f56;_0x50b84e[_0x13ae('0x54')]=intUtil[_0x13ae('0x55')](_0x50b84e['remoteUri']);_0x50b84e[_0x13ae('0x56')]=intUtil[_0x13ae('0x55')](_0x50b84e[_0x13ae('0x56')]);def[_0x13ae('0x57')]=util[_0x13ae('0x2a')]('%s/service/v4_1/rest.php',_0x50b84e[_0x13ae('0x54')]);if(_0x280a7b&&_0x280a7b[_0x13ae('0x59')]){logger[_0x13ae('0x27')]('['+_0x5242ef[_0x13ae('0x76')][_0x13ae('0x77')]()+']',_0x13ae('0x5b'));_0x5242ef[_0x13ae('0x5c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x50b84e['serverUrl'],_0x5242ef[_0x13ae('0x5e')],md5(_0x5242ef['uniqueid']));}else{_0x5242ef['recordingURL']='';}return getConnection(_0x50b84e)['then'](function(_0x49ac4a){_0x486f56=_0x49ac4a;if(!_[_0x13ae('0x26')](_0x40b961)){return getUser(_0x50b84e,_0x40b961[_0x13ae('0xc')],_0x486f56);}else{return getUser(_0x50b84e,null,_0x486f56);}})['then'](function(_0x16c7c8){_0x5b6623=_0x16c7c8;logger[_0x13ae('0x27')](_0x13ae('0x5f'),_0x5b6623['id']);return getEndUser(_0x50b84e,_0x5242ef[_0x13ae('0x78')],_0x5242ef['calleridnum'],_0x486f56);})[_0x13ae('0x2d')](function(_0x4a55b8){_0x233abd=_0x4a55b8;logger[_0x13ae('0x27')](_0x13ae('0x61'),_0x233abd['id']);return getTicket(_0x50b84e,_0x5b6623,_0x233abd,_0x2a311a,_0x5242ef,_0x2a311a['Fields'],_0x486f56,_0x13ae('0x79'));})[_0x13ae('0x2d')](function(_0x341ef4){_0x5b4c86=_0x341ef4;logger[_0x13ae('0x27')](_0x13ae('0x62'));logger[_0x13ae('0x27')](_0x13ae('0x63'),_0x5b4c86['id']);return setRelationship(_0x486f56,_0x5b6623,_0x5b4c86,_0x13ae('0x64'));})['then'](function(){return setRelationship(_0x486f56,_0x233abd,_0x5b4c86,_0x13ae('0x74'));})[_0x13ae('0x2d')](function(){return getServerInfo(_0x486f56);})[_0x13ae('0x7a')](function(_0x25c023){logger[_0x13ae('0x6c')]('['+_0x5242ef[_0x13ae('0x76')][_0x13ae('0x77')]()+']',JSON[_0x13ae('0x20')](_0x25c023));});}; \ No newline at end of file +var _0x28e8=['description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','idField','stringify','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','JSON','isNil','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','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','Caller\x20-\x20%s','[HTTP]','merge','map','type','string','nameField','toLowerCase','content','toString','custom_fields','push','variable','customField','customVariable','Variable','login','username','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Fields','Inbound','Ticket\x20created!','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','recordingURL','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','catch','error','unmanaged','lastevent','toUpperCase','calleridname','contacts','lodash','request-promise','bluebird','md5','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x28e8,0x68));var _0x828e=function(_0x4fc48f,_0x18229f){_0x4fc48f=_0x4fc48f-0x0;var _0x2a2d5b=_0x28e8[_0x4fc48f];return _0x2a2d5b;};'use strict';var _=require(_0x828e('0x0'));var rp=require(_0x828e('0x1'));var BPromise=require(_0x828e('0x2'));var md5=require(_0x828e('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x828e('0x4'));var logger=require('../../../../config/logger')('sugarcrm');config[_0x828e('0x5')]=_[_0x828e('0x6')](config[_0x828e('0x5')],{'host':_0x828e('0x7'),'port':0x18eb});var io=require(_0x828e('0x8'))(new Redis(config[_0x828e('0x5')]));var def={'method':_0x828e('0x9'),'json':!![]};function emit(_0x275d00,_0x38cc6a,_0x22c5b6){io['to'](_0x275d00)[_0x828e('0xa')](_0x38cc6a,_0x22c5b6);}function getTicket(_0x3db561,_0x520866,_0x10f7f5,_0x3ec11b,_0x24c6bd,_0x1de476,_0x5d810b,_0x21d594){logger[_0x828e('0xb')]('Creating\x20new\x20ticket...');var _0x4fa1bc=new Date();var _0x2b19a6=[{'name':_0x828e('0xc'),'value':intUtil[_0x828e('0xd')](_0x3ec11b[_0x828e('0xe')],_0x24c6bd,'\x20')},{'name':_0x828e('0xf'),'value':_0x520866['id']},{'name':_0x828e('0x10'),'value':_0x520866['id']},{'name':_0x828e('0x11'),'value':intUtil[_0x828e('0xd')](_0x3ec11b[_0x828e('0x12')],_0x24c6bd,'\x0a')},{'name':_0x828e('0x13'),'value':_0x4fa1bc[_0x828e('0x14')]()[_0x828e('0x15')](0x0,0x13)[_0x828e('0x16')]('T','\x20')},{'name':_0x828e('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x828e('0x18'),'value':_0x10f7f5['id']},{'name':_0x828e('0x19'),'value':_0x828e('0x1a')},{'name':_0x828e('0x1b'),'value':_0x10f7f5[_0x828e('0xc')]},{'name':_0x828e('0x1c'),'value':_0x21d594}];if(_0x1de476[_0x828e('0x1d')]){_[_0x828e('0x1e')](_0x1de476,function(_0xdc41ff){if(_0x24c6bd[_0xdc41ff[_0x828e('0x1f')]]){_0x2b19a6['push']({'name':_0xdc41ff[_0x828e('0x20')],'value':_0x24c6bd[_0xdc41ff[_0x828e('0x1f')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x828e('0x21')]({'session':_0x5d810b['id'],'module_name':_0x828e('0x22'),'name_value_list':_0x2b19a6})}});}function getAuth(_0x47cccd){return util[_0x828e('0x23')](_0x828e('0x24'),new Buffer(_0x47cccd[_0x828e('0x25')]+':X')['toString'](_0x828e('0x26')));}function getServerInfo(_0x995c5f){return request({'form':{'method':_0x828e('0x27'),'input_type':_0x828e('0x28'),'response_type':_0x828e('0x28'),'rest_data':JSON[_0x828e('0x21')]({'session':_0x995c5f['id']})}});}function getUser(_0xedb7cf,_0x36cb43,_0x3b9df3){if(!_[_0x828e('0x29')](_0x36cb43)){logger[_0x828e('0xb')](_0x828e('0x2a'),_0x36cb43);return request({'form':{'method':_0x828e('0x2b'),'input_type':_0x828e('0x28'),'response_type':_0x828e('0x28'),'rest_data':JSON[_0x828e('0x21')]({'session':_0x3b9df3['id'],'module_name':_0x828e('0x2c'),'query':util[_0x828e('0x23')](_0x828e('0x2d'),_0x36cb43),'order_by':'','offset':'0','select_fields':['id',_0x828e('0xc'),_0x828e('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x828e('0x2f')](function(_0x1819d0){if(_0x1819d0[_0x828e('0x30')][_0x828e('0x1d')]){var _0x1a6e61=_[_0x828e('0x31')](_0x1819d0[_0x828e('0x30')],function(_0x14fb2a){return _0x14fb2a[_0x828e('0x32')][_0x828e('0x2e')][_0x828e('0x33')]===_0x36cb43;});if(_0x1a6e61){logger['info'](_0x828e('0x34'));return BPromise[_0x828e('0x35')]({'id':_0x1a6e61[_0x828e('0x32')]['id'][_0x828e('0x33')],'name':_0x1a6e61['name_value_list'][_0x828e('0xc')]['value']});}}logger[_0x828e('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x3b9df3[_0x828e('0x32')][_0x828e('0x36')][_0x828e('0x33')],'name':_0x3b9df3['name_value_list']['user_name']['value']});});}else{logger['info'](_0x828e('0x37'));return BPromise['resolve']({'id':_0x3b9df3[_0x828e('0x32')]['user_id'][_0x828e('0x33')],'name':_0x3b9df3[_0x828e('0x32')]['user_name'][_0x828e('0x33')]});}}function getEndUser(_0xc141ff,_0x537d25,_0x4bfca8,_0x530a69){logger[_0x828e('0xb')](_0x828e('0x38'),_0x4bfca8);return request({'form':{'method':_0x828e('0x2b'),'input_type':_0x828e('0x28'),'response_type':_0x828e('0x28'),'rest_data':JSON['stringify']({'session':_0x530a69['id'],'module_name':'Contacts','query':util[_0x828e('0x23')](_0x828e('0x39'),_0x4bfca8),'order_by':'','offset':'0','select_fields':['id',_0x828e('0xc'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x828e('0x2f')](function(_0x525d67){if(_0x525d67['entry_list'][_0x828e('0x1d')]){var _0xf7db5f=_[_0x828e('0x31')](_0x525d67[_0x828e('0x30')],function(_0x5ebe70){return _0x5ebe70[_0x828e('0x32')][_0x828e('0x3a')][_0x828e('0x33')]===_0x4bfca8;});if(_0xf7db5f){logger[_0x828e('0xb')](_0x828e('0x3b'));return BPromise[_0x828e('0x35')]({'id':_0xf7db5f[_0x828e('0x32')]['id']['value'],'name':_0xf7db5f[_0x828e('0x32')][_0x828e('0xc')]['value'],'phone':_0xf7db5f[_0x828e('0x32')][_0x828e('0x3a')][_0x828e('0x33')]});}}else{logger[_0x828e('0xb')](_0x828e('0x3c'));return request({'form':{'method':_0x828e('0x3d'),'input_type':_0x828e('0x28'),'response_type':_0x828e('0x28'),'rest_data':JSON['stringify']({'session':_0x530a69['id'],'module_name':_0x828e('0x1a'),'name_value_list':[{'name':_0x828e('0x3e'),'value':_0x537d25!==''?_0x537d25:util['format'](_0x828e('0x3f'),_0x4bfca8)},{'name':_0x828e('0x3a'),'value':_0x4bfca8}]})}})[_0x828e('0x2f')](function(_0x354717){logger['info']('Enduser\x20created.');return BPromise[_0x828e('0x35')]({'id':_0x354717['id'],'name':_0x354717[_0x828e('0x30')][_0x828e('0x3e')]['value'],'phone':_0x354717[_0x828e('0x30')][_0x828e('0x3a')][_0x828e('0x33')]});});}});}function request(_0x4b0f1c){logger['debug'](_0x828e('0x40'),JSON[_0x828e('0x21')](_0x4b0f1c));return rp(_[_0x828e('0x41')](def,_0x4b0f1c));}function getTags(_0x11d836,_0xb7a6b6){var _0x180f43=[];if(_0x11d836&&_0x11d836[_0x828e('0x1d')]>0x0){_0x180f43=_[_0x828e('0x42')](_0x11d836,_0xb7a6b6);}return _0x180f43;}function getCustomFields(_0x59fd09,_0x3e3204){var _0x49c8ee=[];var _0x283e5c={'custom_fields':[]};if(_0x59fd09[_0x828e('0x1d')]>0x0){_[_0x828e('0x1e')](_0x59fd09,function(_0x5c20bb){if(_0x5c20bb[_0x828e('0x43')]===_0x828e('0x44')&&_0x5c20bb[_0x828e('0x45')]&&!_0x5c20bb['customField']){_0x283e5c[_0x5c20bb[_0x828e('0x45')][_0x828e('0x46')]()]=_0x5c20bb[_0x828e('0x47')][_0x828e('0x48')]();}else if(_0x5c20bb['type']===_0x828e('0x44')&&_0x5c20bb[_0x828e('0x20')]&&_0x5c20bb['customField']){_0x283e5c[_0x828e('0x49')][_0x828e('0x4a')]({'id':_0x5c20bb[_0x828e('0x20')],'value':_0x5c20bb[_0x828e('0x47')][_0x828e('0x48')]()});}else if(_0x5c20bb[_0x828e('0x43')]===_0x828e('0x4b')&&_0x5c20bb[_0x828e('0x1f')]&&_0x5c20bb['idField']&&_0x5c20bb[_0x828e('0x4c')]){_0x3e3204[_0x5c20bb[_0x828e('0x1f')]]&&_0x283e5c[_0x828e('0x49')]['push']({'id':_0x5c20bb[_0x828e('0x20')],'value':_0x3e3204[_0x5c20bb[_0x828e('0x1f')]][_0x828e('0x48')]()});}else if(_0x5c20bb[_0x828e('0x43')]===_0x828e('0x4d')&&_0x5c20bb[_0x828e('0x4e')]&&_0x5c20bb[_0x828e('0x4e')][_0x828e('0xc')]&&_0x5c20bb[_0x828e('0x20')]&&_0x5c20bb[_0x828e('0x4c')]){_0x3e3204[_0x5c20bb[_0x828e('0x4e')][_0x828e('0xc')]['toLowerCase']()]&&_0x283e5c[_0x828e('0x49')][_0x828e('0x4a')]({'id':_0x5c20bb[_0x828e('0x20')],'value':_0x3e3204[_0x5c20bb[_0x828e('0x4e')][_0x828e('0xc')][_0x828e('0x46')]()][_0x828e('0x48')]()});}});}return _0x283e5c;}function getConnection(_0x316f78){return request({'method':_0x828e('0x9'),'form':{'method':_0x828e('0x4f'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x316f78[_0x828e('0x50')],'password':_0x316f78['password'],'encryption':_0x828e('0x51')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x828e('0x2f')](function(_0x4740cb){var _0x482073=_0x4740cb;if(_0x482073['id']){def[_0x828e('0x52')]=_0x482073['id'];return BPromise[_0x828e('0x35')](_0x482073);}else{throw new Error(util['format'](_0x828e('0x53'),_0x316f78['id']));}});}function setRelationship(_0x16ee6b,_0x145332,_0x9c4e42,_0x156925){return request({'form':{'method':'set_relationship','input_type':_0x828e('0x28'),'response_type':'JSON','rest_data':JSON[_0x828e('0x21')]({'session':_0x16ee6b['id'],'module_name':_0x828e('0x22'),'module_id':_0x9c4e42['id'],'link_field_name':_0x156925,'related_ids':[_0x145332['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x529839,_0x2fcc83,_0xa6b859,_0x4471d9,_0x4bb4b5,_0x4892f2){var _0x34da45,_0x3380a4,_0x5f3b5a,_0x3261c2;_0x4892f2[_0x828e('0x54')]=intUtil['stripTrailingSlash'](_0x4892f2['remoteUri']);_0x4892f2[_0x828e('0x55')]=intUtil[_0x828e('0x56')](_0x4892f2[_0x828e('0x55')]);def[_0x828e('0x57')]=util['format'](_0x828e('0x58'),_0x4892f2['remoteUri']);if(_0x4bb4b5&&_0x4bb4b5['monitor_format']){logger[_0x828e('0xb')](_0x828e('0x59'),_0x828e('0x5a'));_0x2fcc83['recordingURL']=util[_0x828e('0x23')](_0x828e('0x5b'),_0x4892f2[_0x828e('0x55')],_0x2fcc83['uniqueid'],md5(_0x2fcc83[_0x828e('0x5c')]));}else{_0x2fcc83['recordingURL']='';}return getConnection(_0x4892f2)[_0x828e('0x2f')](function(_0x47fd2b){_0x3261c2=_0x47fd2b;return getUser(_0x4892f2,_0x4471d9[_0x828e('0xc')],_0x3261c2);})[_0x828e('0x2f')](function(_0x1a1750){_0x34da45=_0x1a1750;logger[_0x828e('0xb')](_0x828e('0x5d'),_0x34da45['id']);return getEndUser(_0x4892f2,_0x2fcc83['calleridname'],_0x2fcc83[_0x828e('0x5e')],_0x3261c2);})[_0x828e('0x2f')](function(_0x2dba7e){_0x3380a4=_0x2dba7e;logger[_0x828e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3380a4['id']);return getTicket(_0x4892f2,_0x34da45,_0x3380a4,_0xa6b859,_0x2fcc83,_0xa6b859[_0x828e('0x5f')],_0x3261c2,_0x828e('0x60'));})['then'](function(_0x42aef0){_0x5f3b5a=_0x42aef0;logger['info'](_0x828e('0x61'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f3b5a['id']);return setRelationship(_0x3261c2,_0x34da45,_0x5f3b5a,_0x828e('0x62'));})['then'](function(){return setRelationship(_0x3261c2,_0x3380a4,_0x5f3b5a,'contacts');})[_0x828e('0x2f')](function(){return getServerInfo(_0x3261c2);})[_0x828e('0x2f')](function(_0x4c2b49){var _0x1a93ee=parseInt(_0x4c2b49[_0x828e('0x63')][_0x828e('0x64')](0x0));var _0x9efcb1=util['format'](_0x828e('0x65'),_0x4892f2[_0x828e('0x54')],_0x5f3b5a['id']);if(_0x1a93ee>0x6){_0x9efcb1=util[_0x828e('0x23')](_0x828e('0x66'),_0x4892f2[_0x828e('0x54')],_0x5f3b5a['id']);}logger[_0x828e('0xb')](_0x828e('0x59'),_0x828e('0x67'));emit(util['format']('user:%s',_0x4471d9[_0x828e('0xc')]),_0x828e('0x68'),{'uri':_0x9efcb1});})['catch'](function(_0x64e2e6){logger['error']('[QUEUE]',JSON[_0x828e('0x21')](_0x64e2e6));});};exports[_0x828e('0x69')]=function(_0x20b125,_0xf66d05,_0x2f5e66,_0x5b488c,_0x119773,_0xb833d1,_0x37ca95){var _0x346ec3,_0x14842e,_0x519c69,_0x1bdb9b;_0xb833d1['remoteUri']=intUtil[_0x828e('0x56')](_0xb833d1[_0x828e('0x54')]);_0xb833d1['serverUrl']=intUtil[_0x828e('0x56')](_0xb833d1[_0x828e('0x55')]);def[_0x828e('0x57')]=util[_0x828e('0x23')](_0x828e('0x58'),_0xb833d1[_0x828e('0x54')]);if(_0x37ca95&&_0x37ca95[_0x828e('0x6a')]&&_0x37ca95[_0x828e('0x6a')]!=='none'){logger['info']('[OUTBOUND]',_0x828e('0x5a'));_0xf66d05[_0x828e('0x6b')]=util[_0x828e('0x23')](_0x828e('0x5b'),_0xb833d1[_0x828e('0x55')],_0xf66d05['uniqueid'],md5(_0xf66d05[_0x828e('0x5c')]));}return getConnection(_0xb833d1)['then'](function(_0x4b8b5b){_0x1bdb9b=_0x4b8b5b;return getUser(_0xb833d1,_0x5b488c[_0x828e('0xc')],_0x1bdb9b);})[_0x828e('0x2f')](function(_0x1bbbff){_0x346ec3=_0x1bbbff;logger[_0x828e('0xb')](_0x828e('0x5d'),_0x346ec3['id']);return getEndUser(_0xb833d1,_0xf66d05[_0x828e('0x6c')],_0xf66d05[_0x828e('0x6d')],_0x1bdb9b);})[_0x828e('0x2f')](function(_0x1988cb){_0x14842e=_0x1988cb;logger[_0x828e('0xb')](_0x828e('0x6e'),_0x14842e['id']);return getTicket(_0xb833d1,_0x346ec3,_0x14842e,_0x2f5e66,_0xf66d05,_0x2f5e66[_0x828e('0x5f')],_0x1bdb9b,_0x828e('0x6f'));})[_0x828e('0x2f')](function(_0x3fee06){_0x519c69=_0x3fee06;logger[_0x828e('0xb')](_0x828e('0x61'));logger[_0x828e('0xb')](_0x828e('0x70'),_0x519c69['id']);return setRelationship(_0x1bdb9b,_0x346ec3,_0x519c69,_0x828e('0x62'));})[_0x828e('0x2f')](function(){return setRelationship(_0x1bdb9b,_0x14842e,_0x519c69,'contacts');})['then'](function(){return getServerInfo(_0x1bdb9b);})[_0x828e('0x2f')](function(_0x34c48b){var _0x3211f7=parseInt(_0x34c48b[_0x828e('0x63')][_0x828e('0x64')](0x0));var _0x55f6bc=util[_0x828e('0x23')](_0x828e('0x65'),_0xb833d1[_0x828e('0x54')],_0x519c69['id']);if(_0x3211f7>0x6){_0x55f6bc=util[_0x828e('0x23')](_0x828e('0x66'),_0xb833d1[_0x828e('0x54')],_0x519c69['id']);}logger[_0x828e('0xb')](_0x828e('0x71'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x5b488c[_0x828e('0xc')]),_0x828e('0x68'),{'uri':_0x55f6bc});})[_0x828e('0x72')](function(_0x2877a4){logger[_0x828e('0x73')](_0x828e('0x71'),JSON['stringify'](_0x2877a4));});};exports[_0x828e('0x74')]=function(_0x2d0875,_0x5b0ea0,_0x23f3b3,_0x22f63d,_0x66cb63,_0x265720){var _0x2442f7,_0x457df2,_0x1883c4,_0x7e76d5;_0x265720['remoteUri']=intUtil[_0x828e('0x56')](_0x265720[_0x828e('0x54')]);_0x265720['serverUrl']=intUtil[_0x828e('0x56')](_0x265720[_0x828e('0x55')]);def['uri']=util[_0x828e('0x23')](_0x828e('0x58'),_0x265720[_0x828e('0x54')]);if(_0x66cb63&&_0x66cb63['monitor_format']){logger[_0x828e('0xb')]('['+_0x5b0ea0[_0x828e('0x75')][_0x828e('0x76')]()+']',_0x828e('0x5a'));_0x5b0ea0[_0x828e('0x6b')]=util[_0x828e('0x23')](_0x828e('0x5b'),_0x265720[_0x828e('0x55')],_0x5b0ea0[_0x828e('0x5c')],md5(_0x5b0ea0[_0x828e('0x5c')]));}else{_0x5b0ea0[_0x828e('0x6b')]='';}return getConnection(_0x265720)[_0x828e('0x2f')](function(_0x2ba9aa){_0x7e76d5=_0x2ba9aa;if(!_['isNil'](_0x22f63d)){return getUser(_0x265720,_0x22f63d['name'],_0x7e76d5);}else{return getUser(_0x265720,null,_0x7e76d5);}})[_0x828e('0x2f')](function(_0x3a70d9){_0x2442f7=_0x3a70d9;logger[_0x828e('0xb')](_0x828e('0x5d'),_0x2442f7['id']);return getEndUser(_0x265720,_0x5b0ea0[_0x828e('0x77')],_0x5b0ea0[_0x828e('0x5e')],_0x7e76d5);})[_0x828e('0x2f')](function(_0x2944a8){_0x457df2=_0x2944a8;logger[_0x828e('0xb')](_0x828e('0x6e'),_0x457df2['id']);return getTicket(_0x265720,_0x2442f7,_0x457df2,_0x23f3b3,_0x5b0ea0,_0x23f3b3[_0x828e('0x5f')],_0x7e76d5,_0x828e('0x60'));})['then'](function(_0xef3dbe){_0x1883c4=_0xef3dbe;logger[_0x828e('0xb')](_0x828e('0x61'));logger['info'](_0x828e('0x70'),_0x1883c4['id']);return setRelationship(_0x7e76d5,_0x2442f7,_0x1883c4,_0x828e('0x62'));})[_0x828e('0x2f')](function(){return setRelationship(_0x7e76d5,_0x457df2,_0x1883c4,_0x828e('0x78'));})[_0x828e('0x2f')](function(){return getServerInfo(_0x7e76d5);})[_0x828e('0x72')](function(_0x289aa4){logger[_0x828e('0x73')]('['+_0x5b0ea0[_0x828e('0x75')][_0x828e('0x76')]()+']',JSON[_0x828e('0x21')](_0x289aa4));});}; \ 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 727fabc..288ff15 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 _0x559b=['variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','format','key','keyContent','keyType','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','string','push','content','type','variable'];(function(_0x3d387f,_0x4a5da7){var _0x52e235=function(_0x36cd40){while(--_0x36cd40){_0x3d387f['push'](_0x3d387f['shift']());}};_0x52e235(++_0x4a5da7);}(_0x559b,0xe6));var _0xb559=function(_0x1e8124,_0x35dd90){_0x1e8124=_0x1e8124-0x0;var _0x10d852=_0x559b[_0x1e8124];return _0x10d852;};'use strict';var _=require(_0xb559('0x0'));var util=require(_0xb559('0x1'));exports[_0xb559('0x2')]=function(_0x26d437,_0x544e32,_0x179486){var _0x4bcab8=[];if(_0x26d437[_0xb559('0x3')]>0x0){var _0x333571=_[_0xb559('0x4')](_0x26d437,['id']);for(var _0x35ce81=0x0;_0x35ce81<_0x333571['length'];_0x35ce81++){var _0x575658=_0x333571[_0x35ce81];if(_0x575658['type']===_0xb559('0x5')){_0x4bcab8[_0xb559('0x6')](_0x575658[_0xb559('0x7')]);}else if(_0x575658[_0xb559('0x8')]===_0xb559('0x9')&&_0x575658['variableName']){_0x544e32[_0x575658['variableName']]&&_0x4bcab8[_0xb559('0x6')](_0x544e32[_0x575658[_0xb559('0xa')]][_0xb559('0xb')]());}else if(_0x575658[_0xb559('0x8')]===_0xb559('0xc')&&_0x575658[_0xb559('0xd')]&&_0x575658[_0xb559('0xd')][_0xb559('0xe')]){_0x544e32[_0x575658[_0xb559('0xd')][_0xb559('0xe')][_0xb559('0xf')]()]&&_0x4bcab8[_0xb559('0x6')](_0x544e32[_0x575658[_0xb559('0xd')][_0xb559('0xe')][_0xb559('0xf')]()][_0xb559('0xb')]());}else if(_0x575658['type']===_0xb559('0x10')){if(_0x575658['keyType']==='string'&&_0x575658['key']){_0x4bcab8[_0xb559('0x6')](util[_0xb559('0x11')]('%s:\x20%s',_0x575658[_0xb559('0x12')],_0x575658[_0xb559('0x13')]));}else if(_0x575658[_0xb559('0x14')]===_0xb559('0x9')&&_0x575658[_0xb559('0xa')]&&_0x575658[_0xb559('0x12')]){_0x544e32[_0x575658['variableName']]&&_0x4bcab8[_0xb559('0x6')](util[_0xb559('0x11')]('%s:\x20%s',_0x575658[_0xb559('0x12')],_0x544e32[_0x575658[_0xb559('0xa')]]));}else if(_0x575658[_0xb559('0x14')]===_0xb559('0xc')&&_0x575658['Variable']&&_0x575658['Variable'][_0xb559('0xe')]&&_0x575658[_0xb559('0x12')]){_0x544e32[_0x575658[_0xb559('0xd')][_0xb559('0xe')]['toLowerCase']()]&&_0x4bcab8[_0xb559('0x6')](util['format'](_0xb559('0x15'),_0x575658[_0xb559('0x12')],_0x544e32[_0x575658[_0xb559('0xd')]['name'][_0xb559('0xf')]()]));}}}}return _0x4bcab8[_0xb559('0x16')](_0x179486);};exports[_0xb559('0x17')]=function(_0x18fa40){var _0x3cf79f=_0x18fa40[_0xb559('0x18')](-0x1);if(_0x3cf79f==='/'){_0x18fa40=_0x18fa40[_0xb559('0x19')](0x0,_0x18fa40[_0xb559('0x1a')](_0x3cf79f));}return _0x18fa40;};exports[_0xb559('0x1b')]=function(_0x2e643b){if(!_[_0xb559('0x1c')](_0x2e643b)&&_0x2e643b!==''){var _0x66ea97=/^(([^<>()\[\]\\.,;:\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 _0x66ea97[_0xb559('0x1d')](String(_0x2e643b)[_0xb559('0xf')]());}else{return![];}}; \ No newline at end of file +var _0xf6e0=['toString','type','customVariable','Variable','name','toLowerCase','keyValue','string','key','%s:\x20%s','keyContent','keyType','format','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','util','getString','length','sortBy','push','content','variable','variableName'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf6e0,0xf4));var _0x0f6e=function(_0x463741,_0x3e8521){_0x463741=_0x463741-0x0;var _0x41da54=_0xf6e0[_0x463741];return _0x41da54;};'use strict';var _=require('lodash');var util=require(_0x0f6e('0x0'));exports[_0x0f6e('0x1')]=function(_0x4437bd,_0x26d5ac,_0xeb40ee){var _0x2af7a1=[];if(_0x4437bd[_0x0f6e('0x2')]>0x0){var _0x1c03ef=_[_0x0f6e('0x3')](_0x4437bd,['id']);for(var _0x538c3d=0x0;_0x538c3d<_0x1c03ef[_0x0f6e('0x2')];_0x538c3d++){var _0x2b2885=_0x1c03ef[_0x538c3d];if(_0x2b2885['type']==='string'){_0x2af7a1[_0x0f6e('0x4')](_0x2b2885[_0x0f6e('0x5')]);}else if(_0x2b2885['type']===_0x0f6e('0x6')&&_0x2b2885['variableName']){_0x26d5ac[_0x2b2885['variableName']]&&_0x2af7a1[_0x0f6e('0x4')](_0x26d5ac[_0x2b2885[_0x0f6e('0x7')]][_0x0f6e('0x8')]());}else if(_0x2b2885[_0x0f6e('0x9')]===_0x0f6e('0xa')&&_0x2b2885[_0x0f6e('0xb')]&&_0x2b2885[_0x0f6e('0xb')]['name']){_0x26d5ac[_0x2b2885['Variable'][_0x0f6e('0xc')][_0x0f6e('0xd')]()]&&_0x2af7a1['push'](_0x26d5ac[_0x2b2885[_0x0f6e('0xb')][_0x0f6e('0xc')]['toLowerCase']()][_0x0f6e('0x8')]());}else if(_0x2b2885[_0x0f6e('0x9')]===_0x0f6e('0xe')){if(_0x2b2885['keyType']===_0x0f6e('0xf')&&_0x2b2885[_0x0f6e('0x10')]){_0x2af7a1[_0x0f6e('0x4')](util['format'](_0x0f6e('0x11'),_0x2b2885[_0x0f6e('0x10')],_0x2b2885[_0x0f6e('0x12')]));}else if(_0x2b2885[_0x0f6e('0x13')]==='variable'&&_0x2b2885[_0x0f6e('0x7')]&&_0x2b2885['key']){_0x26d5ac[_0x2b2885[_0x0f6e('0x7')]]&&_0x2af7a1[_0x0f6e('0x4')](util[_0x0f6e('0x14')](_0x0f6e('0x11'),_0x2b2885['key'],_0x26d5ac[_0x2b2885[_0x0f6e('0x7')]]));}else if(_0x2b2885[_0x0f6e('0x13')]===_0x0f6e('0xa')&&_0x2b2885[_0x0f6e('0xb')]&&_0x2b2885[_0x0f6e('0xb')][_0x0f6e('0xc')]&&_0x2b2885[_0x0f6e('0x10')]){_0x26d5ac[_0x2b2885[_0x0f6e('0xb')]['name'][_0x0f6e('0xd')]()]&&_0x2af7a1['push'](util[_0x0f6e('0x14')](_0x0f6e('0x11'),_0x2b2885[_0x0f6e('0x10')],_0x26d5ac[_0x2b2885[_0x0f6e('0xb')][_0x0f6e('0xc')][_0x0f6e('0xd')]()]));}}}}return _0x2af7a1[_0x0f6e('0x15')](_0xeb40ee);};exports[_0x0f6e('0x16')]=function(_0x15bc33){var _0x39a681=_0x15bc33[_0x0f6e('0x17')](-0x1);if(_0x39a681==='/'){_0x15bc33=_0x15bc33[_0x0f6e('0x18')](0x0,_0x15bc33[_0x0f6e('0x19')](_0x39a681));}return _0x15bc33;};exports[_0x0f6e('0x1a')]=function(_0x4cf2db){if(!_[_0x0f6e('0x1b')](_0x4cf2db)&&_0x4cf2db!==''){var _0x1d814a=/^(([^<>()\[\]\\.,;:\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 _0x1d814a['test'](String(_0x4cf2db)[_0x0f6e('0xd')]());}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 eb9d556..66dfe57 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x33e5f1,_0x143609){var _0x26ecd0=function(_0x47aaf8){while(--_0x47aaf8){_0x33e5f1['push'](_0x33e5f1['shift']());}};_0x26ecd0(++_0x143609);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x399c47,_0x4ce04a){var _0x225873=function(_0x1a53a3){while(--_0x1a53a3){_0x399c47['push'](_0x399c47['shift']());}};_0x225873(++_0x4ce04a);}(_0x34e8,0x12c));var _0x834e=function(_0x4d326b,_0x528d36){_0x4d326b=_0x4d326b-0x0;var _0x3748df=_0x34e8[_0x4d326b];return _0x3748df;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 23a9dd8..485474e 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 _0x7d2f=['toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','user','%s/search.json','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','debug','stringify','map','forEach','string','picklist','nameField','toLowerCase','content','toString','includes','customField','custom_fields','push','idField','type','variableName','customVariable','Variable','queue','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','serverUrl','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','Authorization'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x7d2f,0x71));var _0xf7d2=function(_0x18fba4,_0x11b065){_0x18fba4=_0x18fba4-0x0;var _0x1a8ea5=_0x7d2f[_0x18fba4];return _0x1a8ea5;};'use strict';var _=require(_0xf7d2('0x0'));var rp=require('request-promise');var md5=require(_0xf7d2('0x1'));var util=require(_0xf7d2('0x2'));var Redis=require(_0xf7d2('0x3'));var intUtil=require(_0xf7d2('0x4'));var config=require(_0xf7d2('0x5'));var logger=require(_0xf7d2('0x6'))(_0xf7d2('0x7'));config[_0xf7d2('0x8')]=_[_0xf7d2('0x9')](config[_0xf7d2('0x8')],{'host':_0xf7d2('0xa'),'port':0x18eb});var io=require(_0xf7d2('0xb'))(new Redis(config[_0xf7d2('0x8')]));function emit(_0x5ad2eb,_0x47d7a9,_0x3efdc7){io['to'](_0x5ad2eb)[_0xf7d2('0xc')](_0x47d7a9,_0x3efdc7);}var headers={'Content-Type':_0xf7d2('0xd'),'Accept':_0xf7d2('0xd')};function getTicket(_0xfadb2f,_0x519703,_0x145d34,_0x3c2ab4,_0x37f9cd){logger[_0xf7d2('0xe')](_0xf7d2('0xf'));return request({'uri':util[_0xf7d2('0x10')](_0xf7d2('0x11'),_0xfadb2f['remoteUri']),'method':_0xf7d2('0x12'),'body':{'ticket':_['merge']({'requester_id':_0x145d34['id'],'submitter_id':_0x519703?_0x519703['id']:undefined,'assignee_id':_0x519703?_0x519703['id']:undefined,'tags':getTags(_0x3c2ab4[_0xf7d2('0x13')],_0xf7d2('0x14')),'subject':intUtil['getString'](_0x3c2ab4['Subjects'],_0x37f9cd,'\x20'),'description':intUtil[_0xf7d2('0x15')](_0x3c2ab4[_0xf7d2('0x16')],_0x37f9cd,'\x0a'),'comment':{'public':![],'body':intUtil[_0xf7d2('0x15')](_0x3c2ab4[_0xf7d2('0x16')],_0x37f9cd,'\x0a')}},getCustomFields(_0x3c2ab4[_0xf7d2('0x17')],_0x37f9cd))}})[_0xf7d2('0x18')](function(_0x2278b6){logger[_0xf7d2('0xe')](_0xf7d2('0x19'));return _0x2278b6['ticket'];});}function getUser(_0x32fb37,_0x2efbb5){if(intUtil[_0xf7d2('0x1a')](_0x2efbb5)){logger[_0xf7d2('0xe')](_0xf7d2('0x1b'),_0x2efbb5);return request({'uri':util[_0xf7d2('0x10')]('%s/search.json',_0x32fb37['remoteUri']),'qs':{'query':util[_0xf7d2('0x10')]('type:user\x20role:agent\x20email:%s',_0x2efbb5)}})[_0xf7d2('0x18')](function(_0x405a4d){if(_0x405a4d[_0xf7d2('0x1c')]){logger['info'](_0xf7d2('0x1d'));return _[_0xf7d2('0x1e')](_0x405a4d[_0xf7d2('0x1f')],{'email':_0x2efbb5,'role':_0xf7d2('0x20')});}else{logger[_0xf7d2('0xe')](_0xf7d2('0x21'));return request({'uri':util[_0xf7d2('0x10')](_0xf7d2('0x22'),_0x32fb37[_0xf7d2('0x23')])})[_0xf7d2('0x18')](function(_0x293e14){logger[_0xf7d2('0xe')]('Admin\x20account\x20selected.');return _0x293e14[_0xf7d2('0x24')];});}});}else{logger[_0xf7d2('0xe')](_0xf7d2('0x21'));return request({'uri':util[_0xf7d2('0x10')]('%s/users/me.json',_0x32fb37[_0xf7d2('0x23')])})['then'](function(_0x5d2198){logger[_0xf7d2('0xe')]('Admin\x20account\x20selected.');return _0x5d2198[_0xf7d2('0x24')];});}}function getEndUser(_0x33ca87,_0x41f144,_0x19efe2){logger[_0xf7d2('0xe')]('Searching\x20enduser\x20with\x20phone',_0x19efe2);return request({'uri':util['format'](_0xf7d2('0x25'),_0x33ca87['remoteUri']),'qs':{'query':util[_0xf7d2('0x10')]('type:user\x20role:end-user\x20phone:%s',_0x19efe2)}})[_0xf7d2('0x18')](function(_0x168e17){var _0x259ac7;if(_0x168e17['results']['length']){_0x168e17['results']=_['filter'](_0x168e17[_0xf7d2('0x1f')],{'suspended':![],'role':_0xf7d2('0x26')});if(_0x168e17[_0xf7d2('0x1f')][_0xf7d2('0x27')]){_0x259ac7=_[_0xf7d2('0x28')](_0x168e17[_0xf7d2('0x1f')]);}}if(_0x259ac7){logger['info'](_0xf7d2('0x29'));return _0x259ac7;}else{logger[_0xf7d2('0xe')](_0xf7d2('0x2a'));return request({'uri':util[_0xf7d2('0x10')](_0xf7d2('0x2b'),_0x33ca87[_0xf7d2('0x23')]),'method':_0xf7d2('0x12'),'body':{'user':{'role':_0xf7d2('0x26'),'name':util['format'](_0xf7d2('0x2c'),_0x41f144||_0x19efe2),'phone':_0x19efe2}}})[_0xf7d2('0x18')](function(_0x118e32){logger['info']('Enduser\x20created.');return _0x118e32[_0xf7d2('0x24')];});}});}function getAuth(_0x1c7206){var _0x20b4d0;if(_0x1c7206[_0xf7d2('0x2d')]==='password'){_0x20b4d0=util['format'](_0xf7d2('0x2e'),_0x1c7206[_0xf7d2('0x2f')],_0x1c7206[_0xf7d2('0x30')]);}else if(_0x1c7206[_0xf7d2('0x2d')]===_0xf7d2('0x31')){_0x20b4d0=util[_0xf7d2('0x10')](_0xf7d2('0x32'),_0x1c7206[_0xf7d2('0x2f')],_0x1c7206[_0xf7d2('0x31')]);}return util['format'](_0xf7d2('0x33'),new Buffer(_0x20b4d0)['toString'](_0xf7d2('0x34')));}function request(_0x162505){logger[_0xf7d2('0x35')]('[HTTP]',JSON[_0xf7d2('0x36')](_0x162505));return rp(_[_0xf7d2('0x9')](_0x162505,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x474f5d,_0x4820e5){var _0x44532c=[];if(_0x474f5d&&_0x474f5d[_0xf7d2('0x27')]>0x0){_0x44532c=_[_0xf7d2('0x37')](_0x474f5d,_0x4820e5);}return _0x44532c;}function getCustomFields(_0x443fec,_0x43ee37){var _0x480b2b=[];var _0x40b3c3={'custom_fields':[]};if(_0x443fec[_0xf7d2('0x27')]>0x0){_[_0xf7d2('0x38')](_0x443fec,function(_0x17f6b9){if(_['includes']([_0xf7d2('0x39'),_0xf7d2('0x3a')],_0x17f6b9['type'])&&_0x17f6b9[_0xf7d2('0x3b')]&&!_0x17f6b9['customField']){_0x40b3c3[_0x17f6b9[_0xf7d2('0x3b')][_0xf7d2('0x3c')]()]=_0x17f6b9[_0xf7d2('0x3d')][_0xf7d2('0x3e')]();}else if(_[_0xf7d2('0x3f')]([_0xf7d2('0x39'),_0xf7d2('0x3a')],_0x17f6b9['type'])&&_0x17f6b9['idField']&&_0x17f6b9[_0xf7d2('0x40')]){_0x40b3c3[_0xf7d2('0x41')][_0xf7d2('0x42')]({'id':_0x17f6b9[_0xf7d2('0x43')],'value':_0x17f6b9[_0xf7d2('0x3d')][_0xf7d2('0x3e')]()});}else if(_0x17f6b9[_0xf7d2('0x44')]==='variable'&&_0x17f6b9[_0xf7d2('0x45')]&&_0x17f6b9[_0xf7d2('0x43')]&&_0x17f6b9['customField']){_0x43ee37[_0x17f6b9[_0xf7d2('0x45')]]&&_0x40b3c3[_0xf7d2('0x41')][_0xf7d2('0x42')]({'id':_0x17f6b9[_0xf7d2('0x43')],'value':_0x43ee37[_0x17f6b9['variableName']][_0xf7d2('0x3e')]()});}else if(_0x17f6b9[_0xf7d2('0x44')]===_0xf7d2('0x46')&&_0x17f6b9[_0xf7d2('0x47')]&&_0x17f6b9[_0xf7d2('0x47')][_0xf7d2('0x14')]&&_0x17f6b9[_0xf7d2('0x43')]&&_0x17f6b9[_0xf7d2('0x40')]){_0x43ee37[_0x17f6b9[_0xf7d2('0x47')]['name'][_0xf7d2('0x3c')]()]&&_0x40b3c3[_0xf7d2('0x41')][_0xf7d2('0x42')]({'id':_0x17f6b9[_0xf7d2('0x43')],'value':_0x43ee37[_0x17f6b9[_0xf7d2('0x47')][_0xf7d2('0x14')][_0xf7d2('0x3c')]()][_0xf7d2('0x3e')]()});}});}return _0x40b3c3;}exports[_0xf7d2('0x48')]=function(_0x1847a9,_0x4f16b1,_0x538ec3,_0x373bb6,_0x451188,_0x3d1076){var _0x4b5d06,_0x15357d;_0x3d1076[_0xf7d2('0x23')]=intUtil[_0xf7d2('0x49')](_0x3d1076[_0xf7d2('0x23')]);_0x3d1076['serverUrl']=intUtil['stripTrailingSlash'](_0x3d1076['serverUrl']);if(_0x451188&&_0x451188[_0xf7d2('0x4a')]){logger[_0xf7d2('0xe')](_0xf7d2('0x4b'),'Recording\x20is\x20enabled!');_0x4f16b1['recordingURL']=util[_0xf7d2('0x10')](_0xf7d2('0x4c'),_0x3d1076['serverUrl'],_0x4f16b1[_0xf7d2('0x4d')],md5(_0x4f16b1['uniqueid']));}else{_0x4f16b1['recordingURL']='';}headers['Authorization']=getAuth(_0x3d1076);return getUser(_0x3d1076,_0x373bb6[_0xf7d2('0x4e')])['then'](function(_0x330292){_0x4b5d06=_0x330292;logger['info'](_0xf7d2('0x4f'),_0x4b5d06['id']);return getEndUser(_0x3d1076,_0x4f16b1[_0xf7d2('0x50')],_0x4f16b1[_0xf7d2('0x51')]);})[_0xf7d2('0x18')](function(_0x161eb2){_0x15357d=_0x161eb2;logger['info'](_0xf7d2('0x52'),_0x15357d['id']);return getTicket(_0x3d1076,_0x4b5d06,_0x15357d,_0x538ec3,_0x4f16b1);})[_0xf7d2('0x18')](function(_0x2cf478){if(_0x2cf478){logger['info']('The\x20Ticket\x20ID\x20is:',_0x2cf478['id']);switch(_0x3d1076[_0xf7d2('0x44')]){case _0xf7d2('0x53'):logger[_0xf7d2('0xe')](_0xf7d2('0x4b'),_0xf7d2('0x54'));return request({'uri':util[_0xf7d2('0x10')](_0xf7d2('0x55'),_0x3d1076[_0xf7d2('0x23')],_0x4b5d06['id'],_0x2cf478['id']),'method':_0xf7d2('0x12')});case _0xf7d2('0x56'):logger[_0xf7d2('0xe')](_0xf7d2('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xf7d2('0x57'),_0x373bb6[_0xf7d2('0x14')]),_0xf7d2('0x58'),{'uri':util[_0xf7d2('0x10')](_0xf7d2('0x59'),_0x3d1076[_0xf7d2('0x23')][_0xf7d2('0x5a')]('/api/v2',''),_0x2cf478['id'])});break;default:logger[_0xf7d2('0x5b')](_0xf7d2('0x4b'),_0xf7d2('0x5c'));}}})[_0xf7d2('0x5d')](function(_0x9bb185){logger[_0xf7d2('0x5b')](_0xf7d2('0x5e'),util[_0xf7d2('0x5f')](_0x9bb185,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x2708ad,_0x30f01e,_0x273721,_0x36208f,_0x507634,_0x5937e8,_0x386ab5){var _0x1e2d13,_0x357bbb;_0x5937e8['remoteUri']=intUtil['stripTrailingSlash'](_0x5937e8[_0xf7d2('0x23')]);_0x5937e8[_0xf7d2('0x60')]=intUtil[_0xf7d2('0x49')](_0x5937e8[_0xf7d2('0x60')]);if(_0x386ab5&&_0x386ab5[_0xf7d2('0x61')]&&_0x386ab5[_0xf7d2('0x61')]!=='none'){logger['info'](_0xf7d2('0x62'),_0xf7d2('0x63'));_0x30f01e[_0xf7d2('0x64')]=util[_0xf7d2('0x10')](_0xf7d2('0x4c'),_0x5937e8[_0xf7d2('0x60')],_0x30f01e[_0xf7d2('0x4d')],md5(_0x30f01e[_0xf7d2('0x4d')]));}headers['Authorization']=getAuth(_0x5937e8);return getUser(_0x5937e8,_0x36208f[_0xf7d2('0x4e')])['then'](function(_0x57d370){_0x1e2d13=_0x57d370;logger[_0xf7d2('0xe')](_0xf7d2('0x4f'),_0x1e2d13['id']);return getEndUser(_0x5937e8,_0x30f01e[_0xf7d2('0x65')],_0x30f01e[_0xf7d2('0x66')]);})[_0xf7d2('0x18')](function(_0x2514b8){_0x357bbb=_0x2514b8;logger[_0xf7d2('0xe')]('The\x20Enduser\x20ID\x20is:',_0x357bbb['id']);return getTicket(_0x5937e8,_0x1e2d13,_0x357bbb,_0x273721,_0x30f01e);})['then'](function(_0x3b5333){if(_0x3b5333){logger[_0xf7d2('0xe')]('The\x20Ticket\x20ID\x20is:',_0x3b5333['id']);switch(_0x5937e8[_0xf7d2('0x44')]){case _0xf7d2('0x53'):logger[_0xf7d2('0xe')](_0xf7d2('0x62'),_0xf7d2('0x54'));return request({'uri':util[_0xf7d2('0x10')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5937e8[_0xf7d2('0x23')],_0x1e2d13['id'],_0x3b5333['id']),'method':_0xf7d2('0x12')});case _0xf7d2('0x56'):logger[_0xf7d2('0xe')](_0xf7d2('0x62'),_0xf7d2('0x67'));emit(util[_0xf7d2('0x10')]('user:%s',_0x36208f[_0xf7d2('0x14')]),_0xf7d2('0x58'),{'uri':util[_0xf7d2('0x10')](_0xf7d2('0x59'),_0x5937e8[_0xf7d2('0x23')][_0xf7d2('0x5a')](_0xf7d2('0x68'),''),_0x3b5333['id'])});break;default:logger[_0xf7d2('0x5b')](_0xf7d2('0x62'),_0xf7d2('0x5c'));}}})[_0xf7d2('0x5d')](function(_0x31a8b9){logger[_0xf7d2('0x5b')](_0xf7d2('0x69'),util[_0xf7d2('0x5f')](_0x31a8b9,{'showHidden':!![],'depth':null}));});};exports[_0xf7d2('0x6a')]=function(_0x586602,_0xa5f83e,_0x54862a,_0x2c54aa,_0x399417,_0x14974a){var _0x3499f0,_0xe60101;_0x14974a[_0xf7d2('0x23')]=intUtil[_0xf7d2('0x49')](_0x14974a['remoteUri']);_0x14974a[_0xf7d2('0x60')]=intUtil[_0xf7d2('0x49')](_0x14974a[_0xf7d2('0x60')]);if(_0x399417&&_0x399417[_0xf7d2('0x4a')]){logger[_0xf7d2('0xe')]('['+_0xa5f83e[_0xf7d2('0x6b')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xa5f83e['recordingURL']=util['format'](_0xf7d2('0x4c'),_0x14974a[_0xf7d2('0x60')],_0xa5f83e['uniqueid'],md5(_0xa5f83e[_0xf7d2('0x4d')]));}else{_0xa5f83e[_0xf7d2('0x64')]='';}headers[_0xf7d2('0x6c')]=getAuth(_0x14974a);return getUser(_0x14974a)[_0xf7d2('0x18')](function(_0xd67899){_0x3499f0=_0xd67899;logger[_0xf7d2('0xe')]('The\x20User\x20ID\x20is:',_0x3499f0['id']);return getEndUser(_0x14974a,_0xa5f83e[_0xf7d2('0x50')],_0xa5f83e[_0xf7d2('0x51')]);})[_0xf7d2('0x18')](function(_0x442c4d){_0xe60101=_0x442c4d;logger['info']('The\x20Enduser\x20ID\x20is:',_0xe60101['id']);return getTicket(_0x14974a,_0x3499f0,_0xe60101,_0x54862a,_0xa5f83e);})[_0xf7d2('0x18')](function(_0x1e2a7f){if(_0x1e2a7f){logger[_0xf7d2('0xe')]('The\x20Ticket\x20ID\x20is:',_0x1e2a7f['id']);}})['catch'](function(_0x1386a7){logger[_0xf7d2('0x5b')]('['+_0xa5f83e[_0xf7d2('0x6b')][_0xf7d2('0x6d')]()+']'+_0xf7d2('0x6e'),util[_0xf7d2('0x5f')](_0x1386a7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0091=['toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','%s/tickets.json','remoteUri','POST','Tags','getString','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','format','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','authType','token','%s/token:%s','username','toString','base64','debug','[HTTP]','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','idField','custom_fields','push','content','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','user:%s','Zendesk\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x0091,0x159));var _0x1009=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0091[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1009('0x0'));var rp=require(_0x1009('0x1'));var md5=require(_0x1009('0x2'));var util=require(_0x1009('0x3'));var Redis=require(_0x1009('0x4'));var intUtil=require(_0x1009('0x5'));var config=require(_0x1009('0x6'));var logger=require(_0x1009('0x7'))(_0x1009('0x8'));config[_0x1009('0x9')]=_['defaults'](config[_0x1009('0x9')],{'host':_0x1009('0xa'),'port':0x18eb});var io=require(_0x1009('0xb'))(new Redis(config[_0x1009('0x9')]));function emit(_0x44fccd,_0x2e2011,_0x10d8fc){io['to'](_0x44fccd)[_0x1009('0xc')](_0x2e2011,_0x10d8fc);}var headers={'Content-Type':_0x1009('0xd'),'Accept':_0x1009('0xd')};function getTicket(_0x274ae8,_0x185099,_0x79f44f,_0xf76e,_0x460e90){logger[_0x1009('0xe')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x1009('0xf'),_0x274ae8[_0x1009('0x10')]),'method':_0x1009('0x11'),'body':{'ticket':_['merge']({'requester_id':_0x79f44f['id'],'submitter_id':_0x185099?_0x185099['id']:undefined,'assignee_id':_0x185099?_0x185099['id']:undefined,'tags':getTags(_0xf76e[_0x1009('0x12')],'name'),'subject':intUtil[_0x1009('0x13')](_0xf76e['Subjects'],_0x460e90,'\x20'),'description':intUtil[_0x1009('0x13')](_0xf76e[_0x1009('0x14')],_0x460e90,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0xf76e['Descriptions'],_0x460e90,'\x0a')}},getCustomFields(_0xf76e[_0x1009('0x15')],_0x460e90))}})[_0x1009('0x16')](function(_0x4f5037){logger[_0x1009('0xe')](_0x1009('0x17'));return _0x4f5037['ticket'];});}function getUser(_0x52618a,_0x3a29fc){if(intUtil[_0x1009('0x18')](_0x3a29fc)){logger['info'](_0x1009('0x19'),_0x3a29fc);return request({'uri':util['format'](_0x1009('0x1a'),_0x52618a[_0x1009('0x10')]),'qs':{'query':util[_0x1009('0x1b')](_0x1009('0x1c'),_0x3a29fc)}})[_0x1009('0x16')](function(_0x23b0fe){if(_0x23b0fe[_0x1009('0x1d')]){logger[_0x1009('0xe')](_0x1009('0x1e'));return _[_0x1009('0x1f')](_0x23b0fe[_0x1009('0x20')],{'email':_0x3a29fc,'role':_0x1009('0x21')});}else{logger[_0x1009('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1009('0x1b')](_0x1009('0x22'),_0x52618a[_0x1009('0x10')])})['then'](function(_0x525a74){logger['info'](_0x1009('0x23'));return _0x525a74[_0x1009('0x24')];});}});}else{logger[_0x1009('0xe')](_0x1009('0x25'));return request({'uri':util[_0x1009('0x1b')]('%s/users/me.json',_0x52618a[_0x1009('0x10')])})[_0x1009('0x16')](function(_0xe14e94){logger[_0x1009('0xe')](_0x1009('0x23'));return _0xe14e94[_0x1009('0x24')];});}}function getEndUser(_0x723d35,_0x38a827,_0x3fd829){logger[_0x1009('0xe')](_0x1009('0x26'),_0x3fd829);return request({'uri':util[_0x1009('0x1b')](_0x1009('0x1a'),_0x723d35[_0x1009('0x10')]),'qs':{'query':util[_0x1009('0x1b')]('type:user\x20role:end-user\x20phone:%s',_0x3fd829)}})[_0x1009('0x16')](function(_0x35cc94){var _0x3b7173;if(_0x35cc94[_0x1009('0x20')][_0x1009('0x27')]){_0x35cc94[_0x1009('0x20')]=_[_0x1009('0x28')](_0x35cc94['results'],{'suspended':![],'role':_0x1009('0x29')});if(_0x35cc94[_0x1009('0x20')][_0x1009('0x27')]){_0x3b7173=_[_0x1009('0x2a')](_0x35cc94['results']);}}if(_0x3b7173){logger[_0x1009('0xe')]('Enduser\x20found!');return _0x3b7173;}else{logger[_0x1009('0xe')](_0x1009('0x2b'));return request({'uri':util[_0x1009('0x1b')](_0x1009('0x2c'),_0x723d35[_0x1009('0x10')]),'method':'POST','body':{'user':{'role':_0x1009('0x29'),'name':util[_0x1009('0x1b')](_0x1009('0x2d'),_0x38a827||_0x3fd829),'phone':_0x3fd829}}})[_0x1009('0x16')](function(_0x4f1225){logger[_0x1009('0xe')](_0x1009('0x2e'));return _0x4f1225[_0x1009('0x24')];});}});}function getAuth(_0x2393c0){var _0xf4073c;if(_0x2393c0['authType']===_0x1009('0x2f')){_0xf4073c=util[_0x1009('0x1b')](_0x1009('0x30'),_0x2393c0['username'],_0x2393c0['password']);}else if(_0x2393c0[_0x1009('0x31')]===_0x1009('0x32')){_0xf4073c=util[_0x1009('0x1b')](_0x1009('0x33'),_0x2393c0[_0x1009('0x34')],_0x2393c0[_0x1009('0x32')]);}return util['format']('Basic\x20%s',new Buffer(_0xf4073c)[_0x1009('0x35')](_0x1009('0x36')));}function request(_0x429b03){logger[_0x1009('0x37')](_0x1009('0x38'),JSON['stringify'](_0x429b03));return rp(_['defaults'](_0x429b03,{'method':_0x1009('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x11aa4e,_0x345df3){var _0x4d7faf=[];if(_0x11aa4e&&_0x11aa4e[_0x1009('0x27')]>0x0){_0x4d7faf=_[_0x1009('0x3a')](_0x11aa4e,_0x345df3);}return _0x4d7faf;}function getCustomFields(_0x4db076,_0x3a1d6f){var _0x15680f=[];var _0x5b8af1={'custom_fields':[]};if(_0x4db076[_0x1009('0x27')]>0x0){_[_0x1009('0x3b')](_0x4db076,function(_0x56c28f){if(_[_0x1009('0x3c')](['string',_0x1009('0x3d')],_0x56c28f[_0x1009('0x3e')])&&_0x56c28f[_0x1009('0x3f')]&&!_0x56c28f[_0x1009('0x40')]){_0x5b8af1[_0x56c28f['nameField'][_0x1009('0x41')]()]=_0x56c28f['content'][_0x1009('0x35')]();}else if(_[_0x1009('0x3c')](['string',_0x1009('0x3d')],_0x56c28f[_0x1009('0x3e')])&&_0x56c28f[_0x1009('0x42')]&&_0x56c28f[_0x1009('0x40')]){_0x5b8af1[_0x1009('0x43')][_0x1009('0x44')]({'id':_0x56c28f['idField'],'value':_0x56c28f[_0x1009('0x45')][_0x1009('0x35')]()});}else if(_0x56c28f[_0x1009('0x3e')]==='variable'&&_0x56c28f['variableName']&&_0x56c28f[_0x1009('0x42')]&&_0x56c28f[_0x1009('0x40')]){_0x3a1d6f[_0x56c28f[_0x1009('0x46')]]&&_0x5b8af1[_0x1009('0x43')][_0x1009('0x44')]({'id':_0x56c28f[_0x1009('0x42')],'value':_0x3a1d6f[_0x56c28f[_0x1009('0x46')]][_0x1009('0x35')]()});}else if(_0x56c28f['type']===_0x1009('0x47')&&_0x56c28f[_0x1009('0x48')]&&_0x56c28f['Variable'][_0x1009('0x49')]&&_0x56c28f[_0x1009('0x42')]&&_0x56c28f[_0x1009('0x40')]){_0x3a1d6f[_0x56c28f[_0x1009('0x48')][_0x1009('0x49')][_0x1009('0x41')]()]&&_0x5b8af1[_0x1009('0x43')][_0x1009('0x44')]({'id':_0x56c28f['idField'],'value':_0x3a1d6f[_0x56c28f[_0x1009('0x48')]['name'][_0x1009('0x41')]()][_0x1009('0x35')]()});}});}return _0x5b8af1;}exports[_0x1009('0x4a')]=function(_0x2d0040,_0x5bb883,_0x542b3d,_0x1c1f44,_0x577e2b,_0x242b35){var _0x244367,_0x5a4e85;_0x242b35[_0x1009('0x10')]=intUtil[_0x1009('0x4b')](_0x242b35[_0x1009('0x10')]);_0x242b35['serverUrl']=intUtil['stripTrailingSlash'](_0x242b35[_0x1009('0x4c')]);if(_0x577e2b&&_0x577e2b[_0x1009('0x4d')]){logger[_0x1009('0xe')](_0x1009('0x4e'),'Recording\x20is\x20enabled!');_0x5bb883[_0x1009('0x4f')]=util['format'](_0x1009('0x50'),_0x242b35[_0x1009('0x4c')],_0x5bb883[_0x1009('0x51')],md5(_0x5bb883['uniqueid']));}else{_0x5bb883[_0x1009('0x4f')]='';}headers['Authorization']=getAuth(_0x242b35);return getUser(_0x242b35,_0x1c1f44[_0x1009('0x52')])[_0x1009('0x16')](function(_0x19d70b){_0x244367=_0x19d70b;logger[_0x1009('0xe')]('The\x20User\x20ID\x20is:',_0x244367['id']);return getEndUser(_0x242b35,_0x5bb883[_0x1009('0x53')],_0x5bb883[_0x1009('0x54')]);})[_0x1009('0x16')](function(_0x43cb54){_0x5a4e85=_0x43cb54;logger[_0x1009('0xe')](_0x1009('0x55'),_0x5a4e85['id']);return getTicket(_0x242b35,_0x244367,_0x5a4e85,_0x542b3d,_0x5bb883);})[_0x1009('0x16')](function(_0x15c63d){if(_0x15c63d){logger[_0x1009('0xe')]('The\x20Ticket\x20ID\x20is:',_0x15c63d['id']);switch(_0x242b35[_0x1009('0x3e')]){case'integrationTab':logger['info'](_0x1009('0x4e'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x1009('0x1b')](_0x1009('0x56'),_0x242b35[_0x1009('0x10')],_0x244367['id'],_0x15c63d['id']),'method':_0x1009('0x11')});case'newTab':logger[_0x1009('0xe')](_0x1009('0x4e'),_0x1009('0x57'));emit(util['format']('user:%s',_0x1c1f44[_0x1009('0x49')]),_0x1009('0x58'),{'uri':util[_0x1009('0x1b')](_0x1009('0x59'),_0x242b35[_0x1009('0x10')][_0x1009('0x5a')](_0x1009('0x5b'),''),_0x15c63d['id'])});break;default:logger['error'](_0x1009('0x4e'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x791d72){logger[_0x1009('0x5c')](_0x1009('0x5d'),util['inspect'](_0x791d72,{'showHidden':!![],'depth':null}));});};exports[_0x1009('0x5e')]=function(_0x5b3a1f,_0x3def41,_0x47b4d2,_0x538bea,_0x27f916,_0x5d8342,_0x452d91){var _0x53b894,_0x1e730c;_0x5d8342[_0x1009('0x10')]=intUtil[_0x1009('0x4b')](_0x5d8342[_0x1009('0x10')]);_0x5d8342[_0x1009('0x4c')]=intUtil[_0x1009('0x4b')](_0x5d8342[_0x1009('0x4c')]);if(_0x452d91&&_0x452d91['recordingFormat']&&_0x452d91[_0x1009('0x5f')]!==_0x1009('0x60')){logger[_0x1009('0xe')](_0x1009('0x61'),_0x1009('0x62'));_0x3def41[_0x1009('0x4f')]=util[_0x1009('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5d8342[_0x1009('0x4c')],_0x3def41[_0x1009('0x51')],md5(_0x3def41[_0x1009('0x51')]));}headers[_0x1009('0x63')]=getAuth(_0x5d8342);return getUser(_0x5d8342,_0x538bea['email'])[_0x1009('0x16')](function(_0x57612d){_0x53b894=_0x57612d;logger[_0x1009('0xe')](_0x1009('0x64'),_0x53b894['id']);return getEndUser(_0x5d8342,_0x3def41[_0x1009('0x65')],_0x3def41[_0x1009('0x66')]);})['then'](function(_0x38da20){_0x1e730c=_0x38da20;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1e730c['id']);return getTicket(_0x5d8342,_0x53b894,_0x1e730c,_0x47b4d2,_0x3def41);})[_0x1009('0x16')](function(_0x1209f2){if(_0x1209f2){logger[_0x1009('0xe')](_0x1009('0x67'),_0x1209f2['id']);switch(_0x5d8342['type']){case'integrationTab':logger['info'](_0x1009('0x61'),_0x1009('0x68'));return request({'uri':util[_0x1009('0x1b')](_0x1009('0x56'),_0x5d8342['remoteUri'],_0x53b894['id'],_0x1209f2['id']),'method':_0x1009('0x11')});case _0x1009('0x69'):logger['info'](_0x1009('0x61'),_0x1009('0x57'));emit(util[_0x1009('0x1b')](_0x1009('0x6a'),_0x538bea['name']),_0x1009('0x58'),{'uri':util['format'](_0x1009('0x59'),_0x5d8342[_0x1009('0x10')]['replace']('/api/v2',''),_0x1209f2['id'])});break;default:logger[_0x1009('0x5c')]('[OUTBOUND]',_0x1009('0x6b'));}}})[_0x1009('0x6c')](function(_0x2f8023){logger[_0x1009('0x5c')](_0x1009('0x6d'),util[_0x1009('0x6e')](_0x2f8023,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x4712e1,_0x577a5e,_0x3ead8c,_0x4c105a,_0x5b0dcf,_0x5d322b){var _0x13510b,_0x37cda4;_0x5d322b['remoteUri']=intUtil[_0x1009('0x4b')](_0x5d322b['remoteUri']);_0x5d322b[_0x1009('0x4c')]=intUtil[_0x1009('0x4b')](_0x5d322b[_0x1009('0x4c')]);if(_0x5b0dcf&&_0x5b0dcf[_0x1009('0x4d')]){logger[_0x1009('0xe')]('['+_0x577a5e['lastevent'][_0x1009('0x6f')]()+']','Recording\x20is\x20enabled!');_0x577a5e[_0x1009('0x4f')]=util[_0x1009('0x1b')](_0x1009('0x50'),_0x5d322b[_0x1009('0x4c')],_0x577a5e[_0x1009('0x51')],md5(_0x577a5e[_0x1009('0x51')]));}else{_0x577a5e['recordingURL']='';}headers['Authorization']=getAuth(_0x5d322b);return getUser(_0x5d322b)[_0x1009('0x16')](function(_0x80685b){_0x13510b=_0x80685b;logger[_0x1009('0xe')](_0x1009('0x64'),_0x13510b['id']);return getEndUser(_0x5d322b,_0x577a5e[_0x1009('0x53')],_0x577a5e['calleridnum']);})[_0x1009('0x16')](function(_0x1a8d6f){_0x37cda4=_0x1a8d6f;logger[_0x1009('0xe')](_0x1009('0x55'),_0x37cda4['id']);return getTicket(_0x5d322b,_0x13510b,_0x37cda4,_0x3ead8c,_0x577a5e);})['then'](function(_0x355df3){if(_0x355df3){logger[_0x1009('0xe')](_0x1009('0x67'),_0x355df3['id']);}})[_0x1009('0x6c')](function(_0x4fbf99){logger[_0x1009('0x5c')]('['+_0x577a5e[_0x1009('0x70')][_0x1009('0x6f')]()+']'+_0x1009('0x71'),util[_0x1009('0x6e')](_0x4fbf99,{'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 ace4ea7..56ddd68 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 _0xabd8=['/api/voice/recordings/','com','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','monitor_format','toUpperCase','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','clientSecret','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','findIndex','users','email','info','Agent\x20found!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','https://www.zohoapis.','role','first_name','data','code','SUCCESS','details','enduserType','startCase','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','moduleCreate','lead','Owner','administrator','last_name','Subject','getString','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','lastevent','called','complete','connect','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','queue','host','serverUrl','stripTrailingSlash','[QUEUE]','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xabd8,0x142));var _0x8abd=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0xabd8[_0x4c9380];return _0x49a523;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x8abd('0x0'));var intUtil=require(_0x8abd('0x1'));var moment=require(_0x8abd('0x2'));var Redis=require('ioredis');var BPromise=require(_0x8abd('0x3'));var config=require(_0x8abd('0x4'));var logger=require(_0x8abd('0x5'))(_0x8abd('0x6'));config[_0x8abd('0x7')]=_[_0x8abd('0x8')](config[_0x8abd('0x7')],{'host':_0x8abd('0x9'),'port':0x18eb});var io=require(_0x8abd('0xa'))(new Redis(config[_0x8abd('0x7')]));function emit(_0x14c8c5,_0x7c4bd0,_0x324d79){io['to'](_0x14c8c5)['emit'](_0x7c4bd0,_0x324d79);}function request(_0x30d682){logger[_0x8abd('0xb')](_0x8abd('0xc'),JSON[_0x8abd('0xd')](_0x30d682));return rp(_0x30d682);}function getCustomFields(_0x2366b3,_0x3b3492){var _0x1013af={};if(_0x2366b3[_0x8abd('0xe')]>0x0){_[_0x8abd('0xf')](_0x2366b3,function(_0x8ee50e){if(_['includes']([_0x8abd('0x10'),_0x8abd('0x11')],_0x8ee50e[_0x8abd('0x12')])&&_0x8ee50e['idField']){_0x1013af[_0x8ee50e[_0x8abd('0x13')]]=_0x8ee50e[_0x8abd('0x14')][_0x8abd('0x15')]();}else if(_0x8ee50e[_0x8abd('0x12')]===_0x8abd('0x16')&&_0x8ee50e[_0x8abd('0x17')]&&_0x8ee50e[_0x8abd('0x13')]&&_0x3b3492[_0x8ee50e[_0x8abd('0x17')]]){_0x1013af[_0x8ee50e['idField']]=_0x3b3492[_0x8ee50e[_0x8abd('0x17')]][_0x8abd('0x15')]();}else if(_0x8ee50e[_0x8abd('0x12')]===_0x8abd('0x18')&&_0x8ee50e[_0x8abd('0x19')]&&_0x8ee50e[_0x8abd('0x19')][_0x8abd('0x1a')]&&_0x8ee50e[_0x8abd('0x13')]&&_0x3b3492[_0x8ee50e['Variable'][_0x8abd('0x1a')][_0x8abd('0x1b')]()]){_0x1013af[_0x8ee50e[_0x8abd('0x13')]]=_0x3b3492[_0x8ee50e[_0x8abd('0x19')][_0x8abd('0x1a')][_0x8abd('0x1b')]()][_0x8abd('0x15')]();}});}return _0x1013af;}function getName(_0x57b3e4){if(_0x57b3e4['indexOf']('\x20')>0x0){var _0x40b82a=_0x57b3e4[_0x8abd('0x1c')](/ (.+)/);if(_0x40b82a[0x1]){return _0x40b82a;}}return[_0x57b3e4,_0x57b3e4];}var accountsTokens={};function getAccessToken(_0x13166c){return new Promise(function(_0x581835,_0x30568e){if(!_[_0x8abd('0x1d')](accountsTokens[_0x13166c['id']])&&!_['isNil'](accountsTokens[_0x13166c['id']][_0x8abd('0x1e')])){if(moment()[_0x8abd('0x1f')](accountsTokens[_0x13166c['id']][_0x8abd('0x20')])){_0x581835(accountsTokens[_0x13166c['id']][_0x8abd('0x1e')]);}}var _0x4d74a6;switch(_0x13166c[_0x8abd('0x21')]){case'US':_0x4d74a6=_0x8abd('0x22');break;case'AU':_0x4d74a6=_0x8abd('0x23');break;case'EU':_0x4d74a6=_0x8abd('0x24');break;case'IN':_0x4d74a6=_0x8abd('0x25');break;case'CN':_0x4d74a6='https://accounts.zoho.com.cn';break;default:_0x4d74a6=_0x8abd('0x24');break;}var _0x26a041={'method':_0x8abd('0x26'),'uri':_0x4d74a6+_0x8abd('0x27'),'qs':{'refresh_token':_0x13166c['refreshToken'],'client_id':_0x13166c[_0x8abd('0x28')],'client_secret':_0x13166c[_0x8abd('0x29')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x26a041)[_0x8abd('0x2a')](function(_0x2f4a39){accountsTokens[_0x13166c['id']]={'access_token':_0x2f4a39['access_token'],'expires_in':moment()[_0x8abd('0x2b')](_0x2f4a39['expires_in'],_0x8abd('0x2c'))};_0x581835(_0x2f4a39[_0x8abd('0x1e')]);})[_0x8abd('0x2d')](function(_0x2d47ef){logger[_0x8abd('0x2e')](_0x8abd('0x2f'),_0x2d47ef[_0x8abd('0x30')]);_0x30568e(_0x2d47ef);});});}function getUser(_0x1b43a6,_0x449aa3,_0x57a157,_0x51acfe){logger['info'](_0x8abd('0x31'));return request({'method':_0x8abd('0x32'),'uri':util[_0x8abd('0x33')]('https://www.zohoapis.%s/crm/v2/users',_0x449aa3),'qs':{'type':_0x8abd('0x34')},'headers':{'Authorization':_0x8abd('0x35')+_0x1b43a6},'json':!![]})['then'](function(_0x3bd2d1){if(_0x3bd2d1['users']){var _0x23420e=-0x1;if(_[_0x8abd('0x36')](_0x3bd2d1['users'])){if(!_['isNil'](_0x51acfe)){_0x23420e=_[_0x8abd('0x37')](_0x3bd2d1[_0x8abd('0x38')],function(_0x4e9d1a){return _0x4e9d1a[_0x8abd('0x39')]===_0x51acfe;});}if(_0x23420e>=0x0){logger[_0x8abd('0x3a')](_0x8abd('0x3b'));}else{logger[_0x8abd('0x3a')]('Using\x20the\x20admin\x20account!');_0x23420e=_[_0x8abd('0x37')](_0x3bd2d1['users'],function(_0x5938ac){return _0x5938ac[_0x8abd('0x3c')][_0x8abd('0x1a')]===_0x8abd('0x3d');});}return _0x3bd2d1['users'][_0x23420e];}else{if(_0x3bd2d1['user']['profile'][_0x8abd('0x1a')]==='Administrator'){logger[_0x8abd('0x3a')]('Using\x20the\x20admin\x20account!');user=_0x3bd2d1[_0x8abd('0x3e')];return user;}else{logger[_0x8abd('0x2e')](_0x8abd('0x3f'),JSON['stringify'](_0x3bd2d1));throw new Error(_0x8abd('0x40')+JSON[_0x8abd('0xd')](_0x3bd2d1));}}}else{logger[_0x8abd('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x8abd('0xd')](_0x3bd2d1));throw new Error(_0x8abd('0x40')+JSON['stringify'](_0x3bd2d1));}})['catch'](function(_0x1a7eba){console[_0x8abd('0x2e')](_0x1a7eba);});}function getZohoUser(_0x23908c,_0x5101e4){return new BPromise(function(_0x3b0d43,_0x2f8a96){request(_0x23908c)[_0x8abd('0x2a')](function(_0x204800){var _0x339948=null;if(_0x204800){_0x339948=_0x204800['data'][0x0];_0x339948['enduserType']=_0x5101e4;}_0x3b0d43(_0x339948);})[_0x8abd('0x2d')](function(_0x55b3c5){_0x2f8a96(_0x55b3c5);});});}function createEndUser(_0x38b396,_0x4689d8,_0x86db51,_0x198c4d,_0x32a85f,_0x41536f){var _0x86db51=getName(_0x86db51);return request({'method':_0x8abd('0x26'),'uri':_0x8abd('0x41')+_0x4689d8+'/crm/v2/'+_['startCase'](_0x41536f['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x86db51[0x1],'First_Name':_0x86db51[0x0],'Phone':_0x198c4d,'Owner':{'name':!_['isNil'](_0x32a85f[_0x8abd('0x42')][_0x8abd('0x1a')])?_0x32a85f[_0x8abd('0x42')][_0x8abd('0x1a')]:!_[_0x8abd('0x1d')](_0x32a85f['first_name'])?_0x32a85f[_0x8abd('0x43')]+'\x20'+_0x32a85f['last_name']:_0x32a85f['last_name'],'id':_0x32a85f['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x38b396},'json':!![]})[_0x8abd('0x2a')](function(_0x2bf9b2){if(_0x2bf9b2&&_0x2bf9b2[_0x8abd('0x44')][0x0][_0x8abd('0x45')]===_0x8abd('0x46')){var _0x4e23c1=_0x2bf9b2[_0x8abd('0x44')][0x0][_0x8abd('0x47')];_0x4e23c1[_0x8abd('0x48')]=_[_0x8abd('0x49')](_0x41536f['moduleCreate'])+'s';return _0x4e23c1;}logger['error'](_0x8abd('0x3f'),JSON[_0x8abd('0xd')](data));throw new Error('Error:\x20'+JSON[_0x8abd('0xd')](data));})[_0x8abd('0x2d')](function(_0x1014a4){console[_0x8abd('0x4a')](_0x8abd('0x4b'),_0x1014a4);});}function getEndUser(_0x2cd318,_0x5595e9,_0x5eb5a6,_0x22511e,_0x38b5ca,_0x55f0ce,_0x428ec4){var _0x1eeb0e={'method':_0x8abd('0x32'),'uri':'','headers':{'Authorization':_0x8abd('0x35')+_0x2cd318},'json':!![]};switch(_0x428ec4[_0x8abd('0x4c')]){case _0x8abd('0x4d'):_0x1eeb0e[_0x8abd('0x4e')]=_0x8abd('0x41')+_0x5595e9+_0x8abd('0x4f')+_0x38b5ca+'))';return getZohoUser(_0x1eeb0e,'Contacts')[_0x8abd('0x2a')](function(_0xc1852a){if(_0xc1852a)return _0xc1852a;_0x1eeb0e[_0x8abd('0x4e')]='https://www.zohoapis.'+_0x5595e9+_0x8abd('0x50')+_0x38b5ca+'))';return getZohoUser(_0x1eeb0e,_0x8abd('0x51'))[_0x8abd('0x2a')](function(_0x42a17e){if(_0x42a17e)return _0x42a17e;if(_0x428ec4['moduleCreate']!=_0x8abd('0x52')){return createEndUser(_0x2cd318,_0x5595e9,_0x22511e,_0x38b5ca,_0x55f0ce,_0x428ec4);}else{return{};}});});break;case _0x8abd('0x53'):_0x1eeb0e[_0x8abd('0x4e')]=_0x8abd('0x41')+_0x5595e9+_0x8abd('0x4f')+_0x38b5ca+'))';return getZohoUser(_0x1eeb0e,_0x8abd('0x54'))[_0x8abd('0x2a')](function(_0x308950){if(_0x308950)return _0x308950;if(_0x428ec4[_0x8abd('0x55')]!=_0x8abd('0x52')){return createEndUser(_0x2cd318,_0x5595e9,_0x22511e,_0x38b5ca,_0x55f0ce,_0x428ec4);}else{return{};}});break;case _0x8abd('0x56'):_0x1eeb0e['uri']=_0x8abd('0x41')+_0x5595e9+_0x8abd('0x50')+_0x38b5ca+'))';return getZohoUser(_0x1eeb0e,_0x8abd('0x51'))[_0x8abd('0x2a')](function(_0xb065a2){if(_0xb065a2)return _0xb065a2;if(_0x428ec4['moduleCreate']!=_0x8abd('0x52')){return createEndUser(_0x2cd318,_0x5595e9,_0x22511e,_0x38b5ca,_0x55f0ce,_0x428ec4);}else{return{};}});break;}}function getCall(_0x2dd052,_0x4de409,_0x29fad8,_0x141b39,_0x5d5d75,_0x47e32e,_0x1a06b6,_0x4206cc){logger[_0x8abd('0x3a')]('Creating\x20new\x20call...');var _0x5368bc={};_0x5368bc[_0x8abd('0x57')]={'name':!_[_0x8abd('0x1d')](_0x141b39[_0x8abd('0x42')][_0x8abd('0x1a')])&&!_[_0x8abd('0x1d')](_0x141b39[_0x8abd('0x3c')]['name'])&&_0x141b39[_0x8abd('0x3c')]['name']===_0x8abd('0x58')?_0x141b39[_0x8abd('0x42')]['name']:!_['isNil'](_0x141b39[_0x8abd('0x43')])?_0x141b39[_0x8abd('0x43')]+'\x20'+_0x141b39[_0x8abd('0x59')]:_0x141b39[_0x8abd('0x59')],'id':_0x141b39['id']};_0x5368bc[_0x8abd('0x5a')]=intUtil[_0x8abd('0x5b')](_0x47e32e['Subjects'],_0x1a06b6,'\x20');_0x5368bc[_0x8abd('0x5c')]=intUtil[_0x8abd('0x5b')](_0x47e32e['Descriptions'],_0x1a06b6,'\x0a');if(_0x5d5d75[_0x8abd('0x48')]==='Contacts'){_0x5368bc[_0x8abd('0x5d')]={'name':!_[_0x8abd('0x1d')](_0x5d5d75[_0x8abd('0x5e')])?_0x5d5d75[_0x8abd('0x5e')]:!_[_0x8abd('0x1d')](_0x5d5d75[_0x8abd('0x5f')])?_0x5d5d75[_0x8abd('0x5f')]+'\x20'+_0x5d5d75[_0x8abd('0x60')]:_0x5d5d75[_0x8abd('0x60')],'id':_0x5d5d75['id']};}if(_0x5d5d75[_0x8abd('0x48')]===_0x8abd('0x51')){_0x5368bc[_0x8abd('0x61')]={'name':!_[_0x8abd('0x1d')](_0x5d5d75[_0x8abd('0x5e')])?_0x5d5d75['Full_Name']:!_[_0x8abd('0x1d')](_0x5d5d75[_0x8abd('0x5f')])?_0x5d5d75[_0x8abd('0x5f')]+'\x20'+_0x5d5d75[_0x8abd('0x60')]:_0x5d5d75[_0x8abd('0x60')],'id':_0x5d5d75['id']};_0x5368bc[_0x8abd('0x62')]=_['startCase'](_0x5d5d75[_0x8abd('0x48')]);}if(_0x1a06b6[_0x8abd('0x63')]){_0x5368bc[_0x8abd('0x64')]=moment[_0x8abd('0x65')](parseInt(_0x1a06b6[_0x8abd('0x63')])*0x3e8)['format'](_0x8abd('0x66'));}else if(_0x1a06b6[_0x8abd('0x67')]&&_0x1a06b6[_0x8abd('0x68')]){_0x5368bc[_0x8abd('0x64')]=moment[_0x8abd('0x65')](moment(_0x1a06b6[_0x8abd('0x68')],'YYYY-MM-DDTHH:mm:ss')[_0x8abd('0x69')](moment(_0x1a06b6[_0x8abd('0x6a')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0x8abd('0x66'));}switch(_0x1a06b6[_0x8abd('0x6b')]){case _0x8abd('0x6c'):_0x5368bc['Call_Result']='Called';break;case _0x8abd('0x6d'):case _0x8abd('0x6e'):_0x5368bc[_0x8abd('0x6f')]=_0x8abd('0x70');break;case _0x8abd('0x71'):_0x5368bc['Call_Result']=_0x8abd('0x72');break;case _0x8abd('0x73'):_0x5368bc['Call_Result']=_0x8abd('0x74');break;case _0x8abd('0x75'):_0x5368bc[_0x8abd('0x6f')]=_0x8abd('0x76');default:}_0x5368bc[_0x8abd('0x77')]=(_0x4206cc===_0x8abd('0x78')?moment(_0x1a06b6[_0x8abd('0x6a')])[_0x8abd('0x33')](_0x8abd('0x79')):moment(_0x1a06b6[_0x8abd('0x7a')])[_0x8abd('0x33')](_0x8abd('0x79')))||moment()[_0x8abd('0x33')](_0x8abd('0x79'));_0x5368bc[_0x8abd('0x7b')]=_0x4206cc||'Inbound';_0x5368bc=_[_0x8abd('0x7c')](_0x5368bc,getCustomFields(_0x47e32e[_0x8abd('0x7d')],_0x1a06b6));return request({'method':_0x8abd('0x26'),'uri':_0x8abd('0x41')+_0x4de409+_0x8abd('0x7e'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2dd052},'body':{'data':[_0x5368bc]},'json':!![]})[_0x8abd('0x2a')](function(_0x308c0f){if(_0x308c0f&&_0x308c0f[_0x8abd('0x44')][0x0][_0x8abd('0x45')]===_0x8abd('0x46')){logger[_0x8abd('0x3a')](_0x8abd('0x7f'));return{'id':_0x308c0f[_0x8abd('0x44')][0x0]['details']['id']};}})[_0x8abd('0x2d')](function(_0x28b500){logger[_0x8abd('0x3a')]('err',_0x28b500['stack']);console[_0x8abd('0x4a')]('err',_0x28b500);});}exports[_0x8abd('0x80')]=function(_0x2785eb,_0x3640bf,_0x3eec7f,_0xd537cd,_0x5443e6,_0x41ae46){var _0x1ed8a9,_0x2b6ca6,_0x593e23;_0x41ae46[_0x8abd('0x81')]=intUtil['stripTrailingSlash'](_0x41ae46[_0x8abd('0x81')]);_0x41ae46[_0x8abd('0x82')]=intUtil[_0x8abd('0x83')](_0x41ae46[_0x8abd('0x82')]);if(_0x5443e6&&_0x5443e6['monitor_format']){logger[_0x8abd('0x3a')](_0x8abd('0x84'),'Recording\x20is\x20enabled!');_0x3640bf['recordingURL']=_0x41ae46[_0x8abd('0x82')]+'/api/voice/recordings/'+_0x3640bf[_0x8abd('0x85')]+_0x8abd('0x86')+md5(_0x3640bf[_0x8abd('0x85')]);}else{_0x3640bf[_0x8abd('0x87')]='';}var _0x1548f0=_0x41ae46[_0x8abd('0x81')]===_0x8abd('0x88')?'eu':'com';return getAccessToken(_0x41ae46)[_0x8abd('0x2a')](function(_0x85dc4d){_0x593e23=_0x85dc4d;return getUser(_0x593e23,_0x1548f0,_0x41ae46,_0xd537cd[_0x8abd('0x39')]);})['then'](function(_0x3119ff){_0x1ed8a9=_0x3119ff;logger['info'](_0x8abd('0x89'),_0x1ed8a9['id']);return getEndUser(_0x593e23,_0x1548f0,_0x41ae46,_0x3640bf[_0x8abd('0x8a')],_0x3640bf[_0x8abd('0x8b')],_0x1ed8a9,_0x3eec7f);})[_0x8abd('0x2a')](function(_0x3ca544){_0x2b6ca6=_0x3ca544;return getCall(_0x593e23,_0x1548f0,_0x41ae46,_0x1ed8a9,_0x2b6ca6,_0x3eec7f,_0x3640bf,_0x8abd('0x8c'));})[_0x8abd('0x2a')](function(_0x3728bb){if(_0x3728bb){logger[_0x8abd('0x3a')](_0x8abd('0x8d'),_0x3728bb['id']);logger[_0x8abd('0x3a')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0xd537cd[_0x8abd('0x1a')]),_0x8abd('0x8e'),{'uri':_0x8abd('0x8f')+_0x41ae46[_0x8abd('0x81')]+_0x8abd('0x90')+_0x3728bb['id']});}})['catch'](function(_0x145db2){logger['error'](_0x8abd('0x84'),JSON[_0x8abd('0xd')](_0x145db2));});};exports[_0x8abd('0x78')]=function(_0x344176,_0x12775f,_0x29a929,_0xa5afa3,_0x65b989,_0x3e7037,_0x1bbd87){var _0x2ec2a3,_0x4ff818,_0x58bb37;_0x3e7037[_0x8abd('0x81')]=intUtil[_0x8abd('0x83')](_0x3e7037['host']);_0x3e7037[_0x8abd('0x82')]=intUtil[_0x8abd('0x83')](_0x3e7037[_0x8abd('0x82')]);if(_0x1bbd87&&_0x1bbd87['recordingFormat']&&_0x1bbd87[_0x8abd('0x91')]!==_0x8abd('0x92')){logger[_0x8abd('0x3a')](_0x8abd('0x93'),_0x8abd('0x94'));_0x12775f[_0x8abd('0x87')]=_0x3e7037[_0x8abd('0x82')]+_0x8abd('0x95')+_0x12775f[_0x8abd('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x12775f[_0x8abd('0x85')]);}var _0x32d550=_0x3e7037[_0x8abd('0x81')]==='zoho.eu'?'eu':_0x8abd('0x96');return getAccessToken(_0x3e7037)['then'](function(_0x3e6575){_0x58bb37=_0x3e6575;return getUser(_0x58bb37,_0x32d550,_0x3e7037,_0xa5afa3[_0x8abd('0x39')]);})[_0x8abd('0x2a')](function(_0x4d25e2){_0x2ec2a3=_0x4d25e2;logger[_0x8abd('0x3a')](_0x8abd('0x89'),_0x2ec2a3['id']);return getEndUser(_0x58bb37,_0x32d550,_0x3e7037,_0x12775f['destcalleridname'],_0x12775f[_0x8abd('0x97')],_0x2ec2a3,_0x29a929);})[_0x8abd('0x2a')](function(_0x28ec50){_0x4ff818=_0x28ec50;return getCall(_0x58bb37,_0x32d550,_0x3e7037,_0x2ec2a3,_0x4ff818,_0x29a929,_0x12775f,_0x8abd('0x98'));})['then'](function(_0x5b401b){if(_0x5b401b){logger[_0x8abd('0x3a')]('The\x20Call\x20ID\x20is:',_0x5b401b['id']);logger['info'](_0x8abd('0x93'),_0x8abd('0x99'));emit(util[_0x8abd('0x33')](_0x8abd('0x9a'),_0xa5afa3[_0x8abd('0x1a')]),_0x8abd('0x8e'),{'uri':_0x8abd('0x8f')+_0x3e7037[_0x8abd('0x81')]+'/crm/EntityInfo.do?module=Calls&id='+_0x5b401b['id']});}})[_0x8abd('0x2d')](function(_0x229b2e){logger['error'](_0x8abd('0x93'),JSON[_0x8abd('0xd')](_0x229b2e));});};exports['unmanaged']=function(_0x23397a,_0x5be277,_0x2d674f,_0xd1b34,_0x5f232b,_0xe4d67b){var _0x1877e4,_0x3dd16e,_0x3734e8;_0xe4d67b[_0x8abd('0x81')]=intUtil[_0x8abd('0x83')](_0xe4d67b[_0x8abd('0x81')]);_0xe4d67b['serverUrl']=intUtil[_0x8abd('0x83')](_0xe4d67b[_0x8abd('0x82')]);if(_0x5f232b&&_0x5f232b[_0x8abd('0x9b')]){logger[_0x8abd('0x3a')]('['+_0x5be277[_0x8abd('0x6b')][_0x8abd('0x9c')]()+']','Recording\x20is\x20enabled!');_0x5be277[_0x8abd('0x87')]=_0xe4d67b[_0x8abd('0x82')]+'/api/voice/recordings/'+_0x5be277[_0x8abd('0x85')]+_0x8abd('0x86')+md5(_0x5be277[_0x8abd('0x85')]);}else{_0x5be277['recordingURL']='';}var _0x277dfa=_0xe4d67b[_0x8abd('0x81')]===_0x8abd('0x88')?'eu':_0x8abd('0x96');return getAccessToken(_0xe4d67b)[_0x8abd('0x2a')](function(_0x5a7d66){_0x3734e8=_0x5a7d66;return getUser(_0x3734e8,_0x277dfa,_0xe4d67b);})[_0x8abd('0x2a')](function(_0x4aa2f5){_0x1877e4=_0x4aa2f5;logger[_0x8abd('0x3a')](_0x8abd('0x89'),_0x1877e4['id']);return getEndUser(_0x3734e8,_0x277dfa,_0xe4d67b,_0x5be277[_0x8abd('0x8a')],_0x5be277[_0x8abd('0x8b')],_0x1877e4,_0x2d674f);})[_0x8abd('0x2a')](function(_0xa83f1e){_0x3dd16e=_0xa83f1e;return getCall(_0x3734e8,_0x277dfa,_0xe4d67b,_0x1877e4,_0x3dd16e,_0x2d674f,_0x5be277,_0x8abd('0x8c'));})[_0x8abd('0x2a')](function(_0x9207a8){if(_0x9207a8){logger[_0x8abd('0x3a')](_0x8abd('0x8d'),_0x9207a8['id']);}})['catch'](function(_0x152f6b){logger[_0x8abd('0x2e')]('['+_0x5be277[_0x8abd('0x6b')][_0x8abd('0x9c')]()+']',JSON[_0x8abd('0xd')](_0x152f6b));});}; \ No newline at end of file +var _0xf8aa=['unmanaged','lastevent','toUpperCase','/downloads?type=uniqueid&token=','calleridnum','lodash','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','indexOf','split','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','Zoho-oauthtoken\x20','users','isArrayLikeObject','isNil','findIndex','email','info','Using\x20the\x20admin\x20account!','profile','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','data','SUCCESS','details','Error:\x20','CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Creating\x20new\x20call...','Owner','Subjects','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','mm:ss','answertime','Call_Duration','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','complete','connect','Answered','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','code','Call\x20created!','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:'];(function(_0x27b220,_0x4c887b){var _0x1fa604=function(_0x202285){while(--_0x202285){_0x27b220['push'](_0x27b220['shift']());}};_0x1fa604(++_0x4c887b);}(_0xf8aa,0x13b));var _0xaf8a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf8aa[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xaf8a('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xaf8a('0x1'));var intUtil=require('./util');var moment=require(_0xaf8a('0x2'));var Redis=require(_0xaf8a('0x3'));var BPromise=require(_0xaf8a('0x4'));var config=require(_0xaf8a('0x5'));var logger=require(_0xaf8a('0x6'))(_0xaf8a('0x7'));config[_0xaf8a('0x8')]=_[_0xaf8a('0x9')](config[_0xaf8a('0x8')],{'host':_0xaf8a('0xa'),'port':0x18eb});var io=require(_0xaf8a('0xb'))(new Redis(config[_0xaf8a('0x8')]));function emit(_0xac1082,_0x3e667d,_0x35dcf1){io['to'](_0xac1082)['emit'](_0x3e667d,_0x35dcf1);}function request(_0x45932f){logger[_0xaf8a('0xc')](_0xaf8a('0xd'),JSON[_0xaf8a('0xe')](_0x45932f));return rp(_0x45932f);}function getCustomFields(_0x20f52b,_0x250ce9){var _0x48fc30={};if(_0x20f52b[_0xaf8a('0xf')]>0x0){_[_0xaf8a('0x10')](_0x20f52b,function(_0x1eb352){if(_[_0xaf8a('0x11')]([_0xaf8a('0x12'),_0xaf8a('0x13')],_0x1eb352[_0xaf8a('0x14')])&&_0x1eb352[_0xaf8a('0x15')]){_0x48fc30[_0x1eb352[_0xaf8a('0x15')]]=_0x1eb352[_0xaf8a('0x16')][_0xaf8a('0x17')]();}else if(_0x1eb352[_0xaf8a('0x14')]===_0xaf8a('0x18')&&_0x1eb352[_0xaf8a('0x19')]&&_0x1eb352[_0xaf8a('0x15')]&&_0x250ce9[_0x1eb352[_0xaf8a('0x19')]]){_0x48fc30[_0x1eb352[_0xaf8a('0x15')]]=_0x250ce9[_0x1eb352[_0xaf8a('0x19')]]['toString']();}else if(_0x1eb352[_0xaf8a('0x14')]===_0xaf8a('0x1a')&&_0x1eb352[_0xaf8a('0x1b')]&&_0x1eb352[_0xaf8a('0x1b')]['name']&&_0x1eb352['idField']&&_0x250ce9[_0x1eb352[_0xaf8a('0x1b')]['name']['toLowerCase']()]){_0x48fc30[_0x1eb352['idField']]=_0x250ce9[_0x1eb352[_0xaf8a('0x1b')][_0xaf8a('0x1c')]['toLowerCase']()][_0xaf8a('0x17')]();}});}return _0x48fc30;}function getName(_0x99a165){if(_0x99a165[_0xaf8a('0x1d')]('\x20')>0x0){var _0x35b708=_0x99a165[_0xaf8a('0x1e')](/ (.+)/);if(_0x35b708[0x1]){return _0x35b708;}}return[_0x99a165,_0x99a165];}var accountsTokens={};function getAccessToken(_0x5a01d4){return new Promise(function(_0x4d5a55,_0x3ba000){if(!_['isNil'](accountsTokens[_0x5a01d4['id']])&&!_['isNil'](accountsTokens[_0x5a01d4['id']][_0xaf8a('0x1f')])){if(moment()[_0xaf8a('0x20')](accountsTokens[_0x5a01d4['id']][_0xaf8a('0x21')])){_0x4d5a55(accountsTokens[_0x5a01d4['id']][_0xaf8a('0x1f')]);}}var _0x123bfa;switch(_0x5a01d4[_0xaf8a('0x22')]){case'US':_0x123bfa=_0xaf8a('0x23');break;case'AU':_0x123bfa=_0xaf8a('0x24');break;case'EU':_0x123bfa='https://accounts.zoho.eu';break;case'IN':_0x123bfa=_0xaf8a('0x25');break;case'CN':_0x123bfa=_0xaf8a('0x26');break;default:_0x123bfa=_0xaf8a('0x27');break;}var _0xe4e23b={'method':_0xaf8a('0x28'),'uri':_0x123bfa+_0xaf8a('0x29'),'qs':{'refresh_token':_0x5a01d4[_0xaf8a('0x2a')],'client_id':_0x5a01d4[_0xaf8a('0x2b')],'client_secret':_0x5a01d4[_0xaf8a('0x2c')],'grant_type':_0xaf8a('0x2d')},'json':!![]};return rp(_0xe4e23b)[_0xaf8a('0x2e')](function(_0x31150c){accountsTokens[_0x5a01d4['id']]={'access_token':_0x31150c[_0xaf8a('0x1f')],'expires_in':moment()[_0xaf8a('0x2f')](_0x31150c[_0xaf8a('0x21')],_0xaf8a('0x30'))};_0x4d5a55(_0x31150c[_0xaf8a('0x1f')]);})[_0xaf8a('0x31')](function(_0x24efaf){logger[_0xaf8a('0x32')](_0xaf8a('0x33'),_0x24efaf[_0xaf8a('0x34')]);_0x3ba000(_0x24efaf);});});}function getUser(_0x5e6d16,_0x17544a,_0x1f7642,_0x238e09){logger['info'](_0xaf8a('0x35'));return request({'method':_0xaf8a('0x36'),'uri':util[_0xaf8a('0x37')]('https://www.zohoapis.%s/crm/v2/users',_0x17544a),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xaf8a('0x38')+_0x5e6d16},'json':!![]})['then'](function(_0xe9f525){if(_0xe9f525[_0xaf8a('0x39')]){var _0x46b292=-0x1;if(_[_0xaf8a('0x3a')](_0xe9f525[_0xaf8a('0x39')])){if(!_[_0xaf8a('0x3b')](_0x238e09)){_0x46b292=_[_0xaf8a('0x3c')](_0xe9f525[_0xaf8a('0x39')],function(_0x150c01){return _0x150c01[_0xaf8a('0x3d')]===_0x238e09;});}if(_0x46b292>=0x0){logger[_0xaf8a('0x3e')]('Agent\x20found!');}else{logger[_0xaf8a('0x3e')](_0xaf8a('0x3f'));_0x46b292=_[_0xaf8a('0x3c')](_0xe9f525[_0xaf8a('0x39')],function(_0x3e884e){return _0x3e884e[_0xaf8a('0x40')][_0xaf8a('0x1c')]==='Administrator';});}return _0xe9f525[_0xaf8a('0x39')][_0x46b292];}else{if(_0xe9f525['user'][_0xaf8a('0x40')]['name']===_0xaf8a('0x41')){logger[_0xaf8a('0x3e')](_0xaf8a('0x3f'));user=_0xe9f525['user'];return user;}else{logger['error'](_0xaf8a('0x42'),JSON[_0xaf8a('0xe')](_0xe9f525));throw new Error(_0xaf8a('0x43')+JSON[_0xaf8a('0xe')](_0xe9f525));}}}else{logger[_0xaf8a('0x32')](_0xaf8a('0x42'),JSON[_0xaf8a('0xe')](_0xe9f525));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xaf8a('0xe')](_0xe9f525));}})[_0xaf8a('0x31')](function(_0x454a8e){console['error'](_0x454a8e);});}function getZohoUser(_0x22ca96,_0x40cf6c){return new BPromise(function(_0x1bbc2c,_0x373ef5){request(_0x22ca96)['then'](function(_0x210799){var _0x134cd9=null;if(_0x210799){_0x134cd9=_0x210799['data'][0x0];_0x134cd9[_0xaf8a('0x44')]=_0x40cf6c;}_0x1bbc2c(_0x134cd9);})[_0xaf8a('0x31')](function(_0x348712){_0x373ef5(_0x348712);});});}function createEndUser(_0x5bdbd2,_0x3f666a,_0x5674e9,_0x5f304a,_0x1f3394,_0x2f882b){var _0x5674e9=getName(_0x5674e9);return request({'method':_0xaf8a('0x28'),'uri':_0xaf8a('0x45')+_0x3f666a+_0xaf8a('0x46')+_[_0xaf8a('0x47')](_0x2f882b[_0xaf8a('0x48')])+'s','body':{'data':[{'Last_Name':_0x5674e9[0x1],'First_Name':_0x5674e9[0x0],'Phone':_0x5f304a,'Owner':{'name':!_[_0xaf8a('0x3b')](_0x1f3394[_0xaf8a('0x49')][_0xaf8a('0x1c')])?_0x1f3394[_0xaf8a('0x49')][_0xaf8a('0x1c')]:!_[_0xaf8a('0x3b')](_0x1f3394[_0xaf8a('0x4a')])?_0x1f3394[_0xaf8a('0x4a')]+'\x20'+_0x1f3394[_0xaf8a('0x4b')]:_0x1f3394[_0xaf8a('0x4b')],'id':_0x1f3394['id']}}]},'headers':{'Authorization':_0xaf8a('0x38')+_0x5bdbd2},'json':!![]})['then'](function(_0x2e1298){if(_0x2e1298&&_0x2e1298[_0xaf8a('0x4c')][0x0]['code']===_0xaf8a('0x4d')){var _0x8cdcb2=_0x2e1298[_0xaf8a('0x4c')][0x0][_0xaf8a('0x4e')];_0x8cdcb2[_0xaf8a('0x44')]=_[_0xaf8a('0x47')](_0x2f882b[_0xaf8a('0x48')])+'s';return _0x8cdcb2;}logger[_0xaf8a('0x32')](_0xaf8a('0x42'),JSON[_0xaf8a('0xe')](data));throw new Error(_0xaf8a('0x4f')+JSON['stringify'](data));})['catch'](function(_0x260ece){console['log'](_0xaf8a('0x50'),_0x260ece);});}function getEndUser(_0x3891ad,_0xe539eb,_0x56e4c7,_0x5604de,_0x1cbd8c,_0x2411f1,_0x5219a1){var _0x1fd53d={'method':_0xaf8a('0x36'),'uri':'','headers':{'Authorization':_0xaf8a('0x38')+_0x3891ad},'json':!![]};switch(_0x5219a1['moduleSearch']){case _0xaf8a('0x51'):_0x1fd53d['uri']=_0xaf8a('0x45')+_0xe539eb+_0xaf8a('0x52')+_0x1cbd8c+'))';return getZohoUser(_0x1fd53d,_0xaf8a('0x53'))['then'](function(_0x3ffd37){if(_0x3ffd37)return _0x3ffd37;_0x1fd53d[_0xaf8a('0x54')]=_0xaf8a('0x45')+_0xe539eb+_0xaf8a('0x55')+_0x1cbd8c+'))';return getZohoUser(_0x1fd53d,_0xaf8a('0x56'))['then'](function(_0x590283){if(_0x590283)return _0x590283;if(_0x5219a1[_0xaf8a('0x48')]!='nothing'){return createEndUser(_0x3891ad,_0xe539eb,_0x5604de,_0x1cbd8c,_0x2411f1,_0x5219a1);}else{return{};}});});break;case'contact':_0x1fd53d[_0xaf8a('0x54')]=_0xaf8a('0x45')+_0xe539eb+_0xaf8a('0x52')+_0x1cbd8c+'))';return getZohoUser(_0x1fd53d,_0xaf8a('0x53'))[_0xaf8a('0x2e')](function(_0x171608){if(_0x171608)return _0x171608;if(_0x5219a1[_0xaf8a('0x48')]!=_0xaf8a('0x57')){return createEndUser(_0x3891ad,_0xe539eb,_0x5604de,_0x1cbd8c,_0x2411f1,_0x5219a1);}else{return{};}});break;case _0xaf8a('0x58'):_0x1fd53d[_0xaf8a('0x54')]=_0xaf8a('0x45')+_0xe539eb+_0xaf8a('0x55')+_0x1cbd8c+'))';return getZohoUser(_0x1fd53d,_0xaf8a('0x56'))[_0xaf8a('0x2e')](function(_0x12e622){if(_0x12e622)return _0x12e622;if(_0x5219a1[_0xaf8a('0x48')]!=_0xaf8a('0x57')){return createEndUser(_0x3891ad,_0xe539eb,_0x5604de,_0x1cbd8c,_0x2411f1,_0x5219a1);}else{return{};}});break;}}function getCall(_0x1568d0,_0x7d9451,_0xcbf406,_0x14bc00,_0x4170c6,_0xd4271b,_0x477714,_0xe018aa){logger[_0xaf8a('0x3e')](_0xaf8a('0x59'));var _0x43c7b2={};_0x43c7b2[_0xaf8a('0x5a')]={'name':!_[_0xaf8a('0x3b')](_0x14bc00['role']['name'])&&!_[_0xaf8a('0x3b')](_0x14bc00[_0xaf8a('0x40')]['name'])&&_0x14bc00[_0xaf8a('0x40')][_0xaf8a('0x1c')]==='administrator'?_0x14bc00[_0xaf8a('0x49')][_0xaf8a('0x1c')]:!_['isNil'](_0x14bc00[_0xaf8a('0x4a')])?_0x14bc00[_0xaf8a('0x4a')]+'\x20'+_0x14bc00[_0xaf8a('0x4b')]:_0x14bc00[_0xaf8a('0x4b')],'id':_0x14bc00['id']};_0x43c7b2['Subject']=intUtil['getString'](_0xd4271b[_0xaf8a('0x5b')],_0x477714,'\x20');_0x43c7b2['Description']=intUtil['getString'](_0xd4271b['Descriptions'],_0x477714,'\x0a');if(_0x4170c6['enduserType']==='Contacts'){_0x43c7b2[_0xaf8a('0x5c')]={'name':!_[_0xaf8a('0x3b')](_0x4170c6['Full_Name'])?_0x4170c6[_0xaf8a('0x5d')]:!_['isNil'](_0x4170c6[_0xaf8a('0x5e')])?_0x4170c6['First_Name']+'\x20'+_0x4170c6['Last_Name']:_0x4170c6[_0xaf8a('0x5f')],'id':_0x4170c6['id']};}if(_0x4170c6['enduserType']===_0xaf8a('0x56')){_0x43c7b2[_0xaf8a('0x60')]={'name':!_[_0xaf8a('0x3b')](_0x4170c6['Full_Name'])?_0x4170c6[_0xaf8a('0x5d')]:!_[_0xaf8a('0x3b')](_0x4170c6[_0xaf8a('0x5e')])?_0x4170c6[_0xaf8a('0x5e')]+'\x20'+_0x4170c6[_0xaf8a('0x5f')]:_0x4170c6[_0xaf8a('0x5f')],'id':_0x4170c6['id']};_0x43c7b2[_0xaf8a('0x61')]=_['startCase'](_0x4170c6[_0xaf8a('0x44')]);}if(_0x477714[_0xaf8a('0x62')]){_0x43c7b2['Call_Duration']=moment['utc'](parseInt(_0x477714[_0xaf8a('0x62')])*0x3e8)['format'](_0xaf8a('0x63'));}else if(_0x477714[_0xaf8a('0x64')]&&_0x477714['endtime']){_0x43c7b2[_0xaf8a('0x65')]=moment[_0xaf8a('0x66')](moment(_0x477714[_0xaf8a('0x67')],_0xaf8a('0x68'))[_0xaf8a('0x69')](moment(_0x477714[_0xaf8a('0x6a')],_0xaf8a('0x68'))))[_0xaf8a('0x37')](_0xaf8a('0x63'));}switch(_0x477714['lastevent']){case _0xaf8a('0x6b'):_0x43c7b2[_0xaf8a('0x6c')]=_0xaf8a('0x6d');break;case _0xaf8a('0x6e'):case _0xaf8a('0x6f'):_0x43c7b2[_0xaf8a('0x6c')]=_0xaf8a('0x70');break;case'rejected':_0x43c7b2['Call_Result']=_0xaf8a('0x71');break;case _0xaf8a('0x72'):_0x43c7b2['Call_Result']=_0xaf8a('0x73');break;case _0xaf8a('0x74'):_0x43c7b2[_0xaf8a('0x6c')]='Timeout';default:}_0x43c7b2[_0xaf8a('0x75')]=(_0xe018aa===_0xaf8a('0x76')?moment(_0x477714[_0xaf8a('0x6a')])[_0xaf8a('0x37')](_0xaf8a('0x68')):moment(_0x477714[_0xaf8a('0x77')])[_0xaf8a('0x37')](_0xaf8a('0x68')))||moment()[_0xaf8a('0x37')]('YYYY-MM-DDTHH:mm:ss');_0x43c7b2[_0xaf8a('0x78')]=_0xe018aa||_0xaf8a('0x79');_0x43c7b2=_['merge'](_0x43c7b2,getCustomFields(_0xd4271b[_0xaf8a('0x7a')],_0x477714));return request({'method':'POST','uri':_0xaf8a('0x45')+_0x7d9451+'/crm/v2/Calls','headers':{'Authorization':_0xaf8a('0x38')+_0x1568d0},'body':{'data':[_0x43c7b2]},'json':!![]})[_0xaf8a('0x2e')](function(_0x54affb){if(_0x54affb&&_0x54affb[_0xaf8a('0x4c')][0x0][_0xaf8a('0x7b')]===_0xaf8a('0x4d')){logger['info'](_0xaf8a('0x7c'));return{'id':_0x54affb['data'][0x0][_0xaf8a('0x4e')]['id']};}})[_0xaf8a('0x31')](function(_0x2fbecb){logger[_0xaf8a('0x3e')](_0xaf8a('0x7d'),_0x2fbecb['stack']);console['log']('err',_0x2fbecb);});}exports[_0xaf8a('0x7e')]=function(_0x22beac,_0x5bc383,_0x54f974,_0x4caa4d,_0x214f4c,_0xbce3de){var _0x22119c,_0x5978aa,_0x1eb588;_0xbce3de[_0xaf8a('0x7f')]=intUtil['stripTrailingSlash'](_0xbce3de[_0xaf8a('0x7f')]);_0xbce3de[_0xaf8a('0x80')]=intUtil[_0xaf8a('0x81')](_0xbce3de[_0xaf8a('0x80')]);if(_0x214f4c&&_0x214f4c[_0xaf8a('0x82')]){logger[_0xaf8a('0x3e')](_0xaf8a('0x83'),'Recording\x20is\x20enabled!');_0x5bc383[_0xaf8a('0x84')]=_0xbce3de[_0xaf8a('0x80')]+_0xaf8a('0x85')+_0x5bc383[_0xaf8a('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x5bc383['uniqueid']);}else{_0x5bc383['recordingURL']='';}var _0x46c15e=_0xbce3de[_0xaf8a('0x7f')]===_0xaf8a('0x87')?'eu':_0xaf8a('0x88');return getAccessToken(_0xbce3de)[_0xaf8a('0x2e')](function(_0x371e91){_0x1eb588=_0x371e91;return getUser(_0x1eb588,_0x46c15e,_0xbce3de,_0x4caa4d[_0xaf8a('0x3d')]);})['then'](function(_0x32c29c){_0x22119c=_0x32c29c;logger[_0xaf8a('0x3e')](_0xaf8a('0x89'),_0x22119c['id']);return getEndUser(_0x1eb588,_0x46c15e,_0xbce3de,_0x5bc383[_0xaf8a('0x8a')],_0x5bc383['calleridnum'],_0x22119c,_0x54f974);})[_0xaf8a('0x2e')](function(_0xab3a6f){_0x5978aa=_0xab3a6f;return getCall(_0x1eb588,_0x46c15e,_0xbce3de,_0x22119c,_0x5978aa,_0x54f974,_0x5bc383,_0xaf8a('0x79'));})[_0xaf8a('0x2e')](function(_0x291149){if(_0x291149){logger['info']('The\x20Call\x20ID\x20is:',_0x291149['id']);logger[_0xaf8a('0x3e')](_0xaf8a('0x83'),_0xaf8a('0x8b'));emit(util[_0xaf8a('0x37')](_0xaf8a('0x8c'),_0x4caa4d[_0xaf8a('0x1c')]),_0xaf8a('0x8d'),{'uri':_0xaf8a('0x8e')+_0xbce3de['host']+_0xaf8a('0x8f')+_0x291149['id']});}})[_0xaf8a('0x31')](function(_0x2fa3bc){logger[_0xaf8a('0x32')](_0xaf8a('0x83'),JSON[_0xaf8a('0xe')](_0x2fa3bc));});};exports[_0xaf8a('0x76')]=function(_0x20f69e,_0x31a5d9,_0x21f804,_0x5236c7,_0x314d28,_0x588281,_0x57abb2){var _0x51af2e,_0x3c2034,_0x3ed71a;_0x588281[_0xaf8a('0x7f')]=intUtil[_0xaf8a('0x81')](_0x588281[_0xaf8a('0x7f')]);_0x588281[_0xaf8a('0x80')]=intUtil[_0xaf8a('0x81')](_0x588281['serverUrl']);if(_0x57abb2&&_0x57abb2[_0xaf8a('0x90')]&&_0x57abb2[_0xaf8a('0x90')]!=='none'){logger[_0xaf8a('0x3e')](_0xaf8a('0x91'),_0xaf8a('0x92'));_0x31a5d9['recordingURL']=_0x588281['serverUrl']+_0xaf8a('0x85')+_0x31a5d9['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x31a5d9[_0xaf8a('0x86')]);}var _0x3148a0=_0x588281[_0xaf8a('0x7f')]===_0xaf8a('0x87')?'eu':_0xaf8a('0x88');return getAccessToken(_0x588281)[_0xaf8a('0x2e')](function(_0x4b8cac){_0x3ed71a=_0x4b8cac;return getUser(_0x3ed71a,_0x3148a0,_0x588281,_0x5236c7[_0xaf8a('0x3d')]);})[_0xaf8a('0x2e')](function(_0x24ac75){_0x51af2e=_0x24ac75;logger[_0xaf8a('0x3e')]('The\x20User\x20ID\x20is:',_0x51af2e['id']);return getEndUser(_0x3ed71a,_0x3148a0,_0x588281,_0x31a5d9['destcalleridname'],_0x31a5d9[_0xaf8a('0x93')],_0x51af2e,_0x21f804);})['then'](function(_0xb6bccf){_0x3c2034=_0xb6bccf;return getCall(_0x3ed71a,_0x3148a0,_0x588281,_0x51af2e,_0x3c2034,_0x21f804,_0x31a5d9,_0xaf8a('0x94'));})['then'](function(_0x3e1106){if(_0x3e1106){logger[_0xaf8a('0x3e')](_0xaf8a('0x95'),_0x3e1106['id']);logger[_0xaf8a('0x3e')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xaf8a('0x8c'),_0x5236c7[_0xaf8a('0x1c')]),_0xaf8a('0x8d'),{'uri':_0xaf8a('0x8e')+_0x588281[_0xaf8a('0x7f')]+_0xaf8a('0x8f')+_0x3e1106['id']});}})['catch'](function(_0x3c5e63){logger['error'](_0xaf8a('0x91'),JSON[_0xaf8a('0xe')](_0x3c5e63));});};exports[_0xaf8a('0x96')]=function(_0x2c9a97,_0x1628d4,_0x429955,_0x168c39,_0x17f42e,_0x7b84c8){var _0x254def,_0x3049a3,_0x2a3d17;_0x7b84c8['host']=intUtil['stripTrailingSlash'](_0x7b84c8['host']);_0x7b84c8[_0xaf8a('0x80')]=intUtil[_0xaf8a('0x81')](_0x7b84c8['serverUrl']);if(_0x17f42e&&_0x17f42e[_0xaf8a('0x82')]){logger[_0xaf8a('0x3e')]('['+_0x1628d4[_0xaf8a('0x97')][_0xaf8a('0x98')]()+']',_0xaf8a('0x92'));_0x1628d4[_0xaf8a('0x84')]=_0x7b84c8[_0xaf8a('0x80')]+'/api/voice/recordings/'+_0x1628d4[_0xaf8a('0x86')]+_0xaf8a('0x99')+md5(_0x1628d4[_0xaf8a('0x86')]);}else{_0x1628d4[_0xaf8a('0x84')]='';}var _0x39c17e=_0x7b84c8[_0xaf8a('0x7f')]===_0xaf8a('0x87')?'eu':'com';return getAccessToken(_0x7b84c8)[_0xaf8a('0x2e')](function(_0x1e41e0){_0x2a3d17=_0x1e41e0;return getUser(_0x2a3d17,_0x39c17e,_0x7b84c8);})[_0xaf8a('0x2e')](function(_0x1a5514){_0x254def=_0x1a5514;logger[_0xaf8a('0x3e')](_0xaf8a('0x89'),_0x254def['id']);return getEndUser(_0x2a3d17,_0x39c17e,_0x7b84c8,_0x1628d4[_0xaf8a('0x8a')],_0x1628d4[_0xaf8a('0x9a')],_0x254def,_0x429955);})[_0xaf8a('0x2e')](function(_0x2c8e51){_0x3049a3=_0x2c8e51;return getCall(_0x2a3d17,_0x39c17e,_0x7b84c8,_0x254def,_0x3049a3,_0x429955,_0x1628d4,_0xaf8a('0x79'));})[_0xaf8a('0x2e')](function(_0x3b5e16){if(_0x3b5e16){logger['info'](_0xaf8a('0x95'),_0x3b5e16['id']);}})[_0xaf8a('0x31')](function(_0x996fb3){logger[_0xaf8a('0x32')]('['+_0x1628d4[_0xaf8a('0x97')][_0xaf8a('0x98')]()+']',JSON[_0xaf8a('0xe')](_0x996fb3));});}; \ 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 06358f8..f485d2f 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 _0x2665=['trigger','exec','data2','Script','data3','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','../../../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2665,0x13c));var _0x5266=function(_0x4e7cf7,_0xe7f870){_0x4e7cf7=_0x4e7cf7-0x0;var _0x26b633=_0x2665[_0x4e7cf7];return _0x26b633;};'use strict';var util=require(_0x5266('0x0'));var sh=require(_0x5266('0x1'));var Mustache=require('mustache');var logger=require(_0x5266('0x2'))(_0x5266('0x3'));exports[_0x5266('0x4')]=function(_0x3959e6,_0x456da9){var _0x2c15e2=_0x3959e6['data2']?_0x3959e6[_0x5266('0x5')]:_0x5266('0x6');var _0x24e0ec=_0x3959e6[_0x5266('0x7')]?Mustache['render'](_0x3959e6['data3'],_0x456da9):_0x456da9;sh[_0x5266('0x4')](_0x24e0ec,function(_0x312b67,_0x5db2d7,_0x114184){if(_0x312b67!==0x0){logger['error'](util[_0x5266('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x2c15e2,_0x24e0ec,_0x312b67,_0x114184));}else{logger[_0x5266('0x9')](util[_0x5266('0x8')](_0x5266('0xa'),_0x2c15e2,_0x24e0ec,_0x5db2d7));}});}; \ No newline at end of file +var _0xeedb=['util','mustache','../../../../config/logger','exec','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','format'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xeedb,0x142));var _0xbeed=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xeedb[_0x2763f2];return _0x3ef471;};'use strict';var util=require(_0xbeed('0x0'));var sh=require('shelljs');var Mustache=require(_0xbeed('0x1'));var logger=require(_0xbeed('0x2'))('trigger');exports[_0xbeed('0x3')]=function(_0x47cb22,_0x2bc001){var _0x264799=_0x47cb22['data2']?_0x47cb22['data2']:'Script';var _0x4acb40=_0x47cb22[_0xbeed('0x4')]?Mustache['render'](_0x47cb22[_0xbeed('0x4')],_0x2bc001):_0x2bc001;sh[_0xbeed('0x3')](_0x4acb40,function(_0x1f7542,_0x370f38,_0x98c04a){if(_0x1f7542!==0x0){logger['error'](util['format'](_0xbeed('0x5'),_0x264799,_0x4acb40,_0x1f7542,_0x98c04a));}else{logger['info'](util[_0xbeed('0x6')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x264799,_0x4acb40,_0x370f38));}});}; \ 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 f2356cd..a23cf8c 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 _0x2aab=['GET','DELETE','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','util','lodash','mustache','../../../../config/logger','data1','toUpperCase','render','data2','data5','number','headers','parse','data6','error','stack'];(function(_0x51e9d4,_0x18de27){var _0x31f849=function(_0x39cbd1){while(--_0x39cbd1){_0x51e9d4['push'](_0x51e9d4['shift']());}};_0x31f849(++_0x18de27);}(_0x2aab,0x9a));var _0xb2aa=function(_0x3c4661,_0x5cd886){_0x3c4661=_0x3c4661-0x0;var _0x475e95=_0x2aab[_0x3c4661];return _0x475e95;};'use strict';var rp=require(_0xb2aa('0x0'));var util=require(_0xb2aa('0x1'));var _=require(_0xb2aa('0x2'));var Mustache=require(_0xb2aa('0x3'));var logger=require(_0xb2aa('0x4'))('trigger');exports['exec']=function(_0x500f54,_0x3f9c2b){var _0x1219e4,_0xfbeb7f;var _0x3a0eb7={'method':_0x500f54[_0xb2aa('0x5')][_0xb2aa('0x6')](),'uri':Mustache[_0xb2aa('0x7')](_0x500f54[_0xb2aa('0x8')],_0x3f9c2b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x500f54[_0xb2aa('0x9')])===_0xb2aa('0xa')&&parseInt(_0x500f54[_0xb2aa('0x9')])>=0x1&&parseInt(_0x500f54[_0xb2aa('0x9')])<=0xa?parseInt(_0x500f54[_0xb2aa('0x9')])*0x3e8:0x5*0x3e8};try{_0x3a0eb7[_0xb2aa('0xb')]=_0x500f54['data6']?JSON[_0xb2aa('0xc')](Mustache['render'](_0x500f54[_0xb2aa('0xd')],_0x3f9c2b)):{};}catch(_0x1560f0){logger[_0xb2aa('0xe')](_0x1560f0[_0xb2aa('0xf')]);}switch(_0x500f54[_0xb2aa('0x5')][_0xb2aa('0x6')]()){case _0xb2aa('0x10'):case _0xb2aa('0x11'):_0x1219e4=null;_0x3a0eb7['qs']=_0x3f9c2b;break;case'POST':case _0xb2aa('0x12'):if(_0x500f54['data7']){try{_0x1219e4=JSON[_0xb2aa('0xc')](Mustache[_0xb2aa('0x7')](_0x500f54[_0xb2aa('0x13')],_0x3f9c2b));_0x3a0eb7[_0xb2aa('0x14')]=_0x1219e4;}catch(_0x1053ef){logger[_0xb2aa('0xe')](_0x1053ef['stack']);logger['error'](_0xb2aa('0x15'));}}else{_0x1219e4=_0x3f9c2b;_0x3a0eb7[_0xb2aa('0x14')]=_0x1219e4;}break;}logger[_0xb2aa('0x16')](util[_0xb2aa('0x17')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x500f54['data1'],_0x500f54[_0xb2aa('0x8')],JSON[_0xb2aa('0x18')](_0x3a0eb7)));rp(_0x3a0eb7)[_0xb2aa('0x19')](function(_0x51f671){_0x1219e4=!_[_0xb2aa('0x1a')](_0x1219e4)?_0xb2aa('0x1b')+_0x1219e4:'';_0xfbeb7f=typeof _0x51f671[_0xb2aa('0x14')]===_0xb2aa('0x1c')?JSON[_0xb2aa('0x18')](_0x51f671[_0xb2aa('0x14')]):_0x51f671['body'];logger[_0xb2aa('0x16')](util[_0xb2aa('0x17')](_0xb2aa('0x1d'),_0x500f54[_0xb2aa('0x5')],_0x500f54['data2'],_0x51f671[_0xb2aa('0x1e')],_0xfbeb7f));})[_0xb2aa('0x1f')](function(_0x20af70){logger[_0xb2aa('0xe')](util[_0xb2aa('0x17')](_0xb2aa('0x20'),_0x500f54[_0xb2aa('0x5')],_0x500f54[_0xb2aa('0x8')],_0x20af70[_0xb2aa('0x1e')],_0x20af70[_0xb2aa('0x21')],_0x20af70['message']));});}; \ No newline at end of file +var _0x414a=['info','format','stringify','then','isNil',',\x20request\x20body:\x20','object','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','data2','request-promise','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data5','headers','parse','data6','error','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format'];(function(_0x2353fe,_0x4b0bca){var _0x4d43f6=function(_0x5d0bd9){while(--_0x5d0bd9){_0x2353fe['push'](_0x2353fe['shift']());}};_0x4d43f6(++_0x4b0bca);}(_0x414a,0x68));var _0xa414=function(_0x2b5468,_0xacf789){_0x2b5468=_0x2b5468-0x0;var _0x798814=_0x414a[_0x2b5468];return _0x798814;};'use strict';var rp=require(_0xa414('0x0'));var util=require('util');var _=require('lodash');var Mustache=require(_0xa414('0x1'));var logger=require(_0xa414('0x2'))(_0xa414('0x3'));exports[_0xa414('0x4')]=function(_0x468f2d,_0x41333e){var _0xb85aff,_0x442af0;var _0x5aa7d9={'method':_0x468f2d[_0xa414('0x5')][_0xa414('0x6')](),'uri':Mustache[_0xa414('0x7')](_0x468f2d['data2'],_0x41333e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x468f2d[_0xa414('0x8')])==='number'&&parseInt(_0x468f2d[_0xa414('0x8')])>=0x1&&parseInt(_0x468f2d[_0xa414('0x8')])<=0xa?parseInt(_0x468f2d[_0xa414('0x8')])*0x3e8:0x5*0x3e8};try{_0x5aa7d9[_0xa414('0x9')]=_0x468f2d['data6']?JSON[_0xa414('0xa')](Mustache['render'](_0x468f2d[_0xa414('0xb')],_0x41333e)):{};}catch(_0x3a9bec){logger[_0xa414('0xc')](_0x3a9bec['stack']);}switch(_0x468f2d['data1'][_0xa414('0x6')]()){case _0xa414('0xd'):case _0xa414('0xe'):_0xb85aff=null;_0x5aa7d9['qs']=_0x41333e;break;case _0xa414('0xf'):case _0xa414('0x10'):if(_0x468f2d[_0xa414('0x11')]){try{_0xb85aff=JSON['parse'](Mustache['render'](_0x468f2d[_0xa414('0x11')],_0x41333e));_0x5aa7d9[_0xa414('0x12')]=_0xb85aff;}catch(_0x7f2ac5){logger[_0xa414('0xc')](_0x7f2ac5['stack']);logger[_0xa414('0xc')](_0xa414('0x13'));}}else{_0xb85aff=_0x41333e;_0x5aa7d9[_0xa414('0x12')]=_0xb85aff;}break;}logger[_0xa414('0x14')](util[_0xa414('0x15')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x468f2d['data1'],_0x468f2d['data2'],JSON[_0xa414('0x16')](_0x5aa7d9)));rp(_0x5aa7d9)[_0xa414('0x17')](function(_0x23300c){_0xb85aff=!_[_0xa414('0x18')](_0xb85aff)?_0xa414('0x19')+_0xb85aff:'';_0x442af0=typeof _0x23300c[_0xa414('0x12')]===_0xa414('0x1a')?JSON[_0xa414('0x16')](_0x23300c['body']):_0x23300c['body'];logger['info'](util[_0xa414('0x15')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x468f2d[_0xa414('0x5')],_0x468f2d['data2'],_0x23300c[_0xa414('0x1b')],_0x442af0));})[_0xa414('0x1c')](function(_0x450759){logger[_0xa414('0xc')](util['format'](_0xa414('0x1d'),_0x468f2d[_0xa414('0x5')],_0x468f2d[_0xa414('0x1e')],_0x450759[_0xa414('0x1b')],_0x450759['name'],_0x450759['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 9d11253..39ea17c 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 _0x95d5=['catch','jayson/promise','bluebird','../../config/logger','routing','Request','request','debug','rpc','error','message','result'];(function(_0x2c36fb,_0x4aa319){var _0x12253c=function(_0x55a486){while(--_0x55a486){_0x2c36fb['push'](_0x2c36fb['shift']());}};_0x12253c(++_0x4aa319);}(_0x95d5,0x121));var _0x595d=function(_0x26dcd8,_0x461d6b){_0x26dcd8=_0x26dcd8-0x0;var _0x1654e9=_0x95d5[_0x26dcd8];return _0x1654e9;};'use strict';var jayson=require(_0x595d('0x0'));var BPromise=require(_0x595d('0x1'));var logger=require(_0x595d('0x2'))(_0x595d('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x595d('0x4')]=function(_0x25c7ce,_0x31e349){return new BPromise(function(_0x1a016c,_0x141e9b){return client[_0x595d('0x5')](_0x25c7ce,_0x31e349)['then'](function(_0x137406){logger[_0x595d('0x6')](_0x595d('0x7'),_0x595d('0x3'),_0x25c7ce,_0x31e349,_0x137406);if(_0x137406['error']){logger[_0x595d('0x8')](_0x595d('0x7'),'routing',_0x25c7ce,_0x137406[_0x595d('0x8')][_0x595d('0x9')],_0x31e349);return _0x141e9b(_0x137406[_0x595d('0x8')]['message']);}else{return _0x1a016c(_0x137406[_0x595d('0xa')]);}})[_0x595d('0xb')](function(_0x1f68cc){logger['error'](_0x595d('0x7'),_0x595d('0x3'),_0x25c7ce,_0x1f68cc,_0x31e349);return _0x141e9b(_0x1f68cc);});});};module['exports']=client; \ No newline at end of file +var _0x1b5c=['debug','error','message','result','catch','rpc','exports','jayson/promise','../../config/logger','routing','client','http','request','then'];(function(_0x5543c8,_0x13cbeb){var _0xf033ad=function(_0x48c1ac){while(--_0x48c1ac){_0x5543c8['push'](_0x5543c8['shift']());}};_0xf033ad(++_0x13cbeb);}(_0x1b5c,0x1c7));var _0xc1b5=function(_0x4a93bb,_0x495404){_0x4a93bb=_0x4a93bb-0x0;var _0x208468=_0x1b5c[_0x4a93bb];return _0x208468;};'use strict';var jayson=require(_0xc1b5('0x0'));var BPromise=require('bluebird');var logger=require(_0xc1b5('0x1'))(_0xc1b5('0x2'));var client=jayson[_0xc1b5('0x3')][_0xc1b5('0x4')]({'port':0x2329});client['Request']=function(_0x3a4f4c,_0x441694){return new BPromise(function(_0x4684da,_0x369af3){return client[_0xc1b5('0x5')](_0x3a4f4c,_0x441694)[_0xc1b5('0x6')](function(_0x2d7f39){logger[_0xc1b5('0x7')]('rpc','routing',_0x3a4f4c,_0x441694,_0x2d7f39);if(_0x2d7f39[_0xc1b5('0x8')]){logger['error']('rpc',_0xc1b5('0x2'),_0x3a4f4c,_0x2d7f39[_0xc1b5('0x8')][_0xc1b5('0x9')],_0x441694);return _0x369af3(_0x2d7f39['error'][_0xc1b5('0x9')]);}else{return _0x4684da(_0x2d7f39[_0xc1b5('0xa')]);}})[_0xc1b5('0xb')](function(_0x592556){logger[_0xc1b5('0x8')](_0xc1b5('0xc'),'routing',_0x3a4f4c,_0x592556,_0x441694);return _0x369af3(_0x592556);});});};module[_0xc1b5('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 6bb7a6c..848445d 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 _0x452a=['./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x452a,0xcc));var _0xa452=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x452a[_0x235482];return _0x5f5bea;};'use strict';var server=require(_0xa452('0x0'));var Realtime=require(_0xa452('0x1'));var EmailChannel=require(_0xa452('0x2'));var mailAccount=require(_0xa452('0x3'));var setting=require(_0xa452('0x4'));var logger=require(_0xa452('0x5'))(_0xa452('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xa452('0x7')]()[_0xa452('0x8')](mailAccount['getMailAccounts']())[_0xa452('0x8')](realtime[_0xa452('0x9')]())[_0xa452('0x8')](function(){email[_0xa452('0xa')](realtime[_0xa452('0xb')]);return realtime;});}function main(){return server[_0xa452('0xc')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0xa452('0xd')]();})[_0xa452('0x8')](function(_0x509373){return setInterval(initRealtime,_0x509373[_0xa452('0xe')]*0x3e8);})['catch'](function(_0x68abe7){logger[_0xa452('0xf')](_0xa452('0x10'),_0x68abe7);});}main(); \ No newline at end of file +var _0x3c2d=['../../config/logger','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x2abdb7,_0x59aaab){var _0x3a5b95=function(_0xf09089){while(--_0xf09089){_0x2abdb7['push'](_0x2abdb7['shift']());}};_0x3a5b95(++_0x59aaab);}(_0x3c2d,0xce));var _0xd3c2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3c2d[_0x122ef9];return _0x42fba0;};'use strict';var server=require(_0xd3c2('0x0'));var Realtime=require(_0xd3c2('0x1'));var EmailChannel=require(_0xd3c2('0x2'));var mailAccount=require(_0xd3c2('0x3'));var setting=require('./rpc/setting');var logger=require(_0xd3c2('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xd3c2('0x5')]()[_0xd3c2('0x6')](mailAccount[_0xd3c2('0x7')]())[_0xd3c2('0x6')](realtime[_0xd3c2('0x8')]())['then'](function(){email['refresh'](realtime[_0xd3c2('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xd3c2('0x6')](function(){return initRealtime();})['then'](function(){return setting[_0xd3c2('0xa')]();})['then'](function(_0x2c2575){return setInterval(initRealtime,_0x2c2575[_0xd3c2('0xb')]*0x3e8);})[_0xd3c2('0xc')](function(_0x580bbd){logger[_0xd3c2('0xd')](_0xd3c2('0xe'),_0x580bbd);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 7a322fb..de6422a 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 _0x1e6d=['notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','send','Smtp','verified','exports','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','status','Imap','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','imapAccounts','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','messageStatus','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName'];(function(_0x4f5d9c,_0x26d3de){var _0x3444a7=function(_0x2fa164){while(--_0x2fa164){_0x4f5d9c['push'](_0x4f5d9c['shift']());}};_0x3444a7(++_0x26d3de);}(_0x1e6d,0x13b));var _0xd1e6=function(_0x1dab5f,_0x10cd21){_0x1dab5f=_0x1dab5f-0x0;var _0x40c2f3=_0x1e6d[_0x1dab5f];return _0x40c2f3;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xd1e6('0x0'));var md5=require(_0xd1e6('0x1'));var Redis=require('ioredis');var config=require(_0xd1e6('0x2'));var logger=require(_0xd1e6('0x3'))(_0xd1e6('0x4'));config[_0xd1e6('0x5')]=_[_0xd1e6('0x6')](config[_0xd1e6('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xd1e6('0x7'))(new Redis(config[_0xd1e6('0x5')]));var EmailImap=require(_0xd1e6('0x8'));var EmailSmtp=require(_0xd1e6('0x9'));var mailAccount=require(_0xd1e6('0xa'));var md5Accounts={};function EmailChannel(_0x427e6b){logger[_0xd1e6('0xb')](_0xd1e6('0xc'));this['mailAccounts']=_0x427e6b[_0xd1e6('0xd')];this['imapAccounts']={};this[_0xd1e6('0xe')]=new EmailSmtp();}EmailChannel[_0xd1e6('0xf')][_0xd1e6('0x10')]=function(_0x59a2fe){var _0x135f70=this[_0xd1e6('0xd')][_0x59a2fe];var _0x1e3f1f={'id':_0x135f70['id'],'name':_0x135f70[_0xd1e6('0x11')],'key':_0x135f70[_0xd1e6('0x12')],'active':_0x135f70['active'],'Imap':{'status':_0x135f70['Imap'][_0xd1e6('0x13')],'messageStatus':_0x135f70[_0xd1e6('0x14')]['messageStatus'],'total':_0x135f70[_0xd1e6('0x14')][_0xd1e6('0x15')]}};if(_[_0xd1e6('0x16')](md5Accounts[_0x59a2fe])){md5Accounts[_0x59a2fe]={};}var _0x1ec585=md5(JSON[_0xd1e6('0x17')](_0x1e3f1f));if(md5Accounts[_0x59a2fe]['md5']!==_0x1ec585){md5Accounts[_0x59a2fe]['md5']=_0x1ec585;io[_0xd1e6('0x10')](_0xd1e6('0x18'),_0x1e3f1f);}};EmailChannel['prototype'][_0xd1e6('0x19')]=function(_0x349711){for(var _0x10b907 in _0x349711){if(_0x349711[_0xd1e6('0x1a')](_0x10b907)){if(_0x349711[_0x10b907][_0xd1e6('0x14')]&&_0x349711[_0x10b907]['active']){var _0x2b1ecc=_0x349711[_0x10b907][_0xd1e6('0x14')];if(!_0x2b1ecc[_0xd1e6('0x1b')]&&_0x349711[_0x10b907][_0xd1e6('0x1c')]!=='custom')_0x2b1ecc[_0xd1e6('0x1b')]=_0x349711[_0x10b907][_0xd1e6('0x1c')];if(!this[_0xd1e6('0x1d')]['hasOwnProperty'](_0x2b1ecc['id'])){this[_0xd1e6('0x1d')][_0x2b1ecc['id']]=new EmailImap(_0x2b1ecc,_0x349711[_0x10b907][_0xd1e6('0x4')]);this['imapAccounts'][_0x2b1ecc['id']]['on'](_0xd1e6('0x1e'),this[_0xd1e6('0x1f')]['bind'](this,_0x10b907));this[_0xd1e6('0x1d')][_0x2b1ecc['id']]['on'](_0xd1e6('0x4'),this['handleImapEmail'][_0xd1e6('0x20')](this,_0x10b907));this['imapAccounts'][_0x2b1ecc['id']]['on'](_0xd1e6('0x21'),this[_0xd1e6('0x22')]['bind'](this,_0x10b907));this['imapAccounts'][_0x2b1ecc['id']]['on'](_0xd1e6('0x23'),this[_0xd1e6('0x24')][_0xd1e6('0x20')](this,_0x10b907));}}else{if(_['isNil'](this['mailAccounts'][_0x10b907]['Imap'])){this['mailAccounts'][_0x10b907][_0xd1e6('0x14')]={};}this[_0xd1e6('0xd')][_0x10b907][_0xd1e6('0x14')][_0xd1e6('0x13')]='disabled';this[_0xd1e6('0xd')][_0x10b907][_0xd1e6('0x14')][_0xd1e6('0x25')]='';this['emit'](_0x10b907);}}}};EmailChannel['prototype'][_0xd1e6('0x1f')]=function(_0x48d80f,_0x910419){if(this[_0xd1e6('0xd')][_0x48d80f]){this[_0xd1e6('0xd')][_0x48d80f][_0xd1e6('0x14')][_0xd1e6('0x13')]='connected';this['mailAccounts'][_0x48d80f][_0xd1e6('0x14')]['messageStatus']=_0x910419['name'];if(_0x910419['messages']){this['mailAccounts'][_0x48d80f][_0xd1e6('0x14')][_0xd1e6('0x15')]=_0x910419[_0xd1e6('0x26')][_0xd1e6('0x15')];}return this[_0xd1e6('0x10')](_0x48d80f);}};EmailChannel['prototype'][_0xd1e6('0x27')]=function(_0x3e986d,_0x323de2){logger['info'](_0xd1e6('0x28'),_0x323de2['firstName'],_0x323de2[_0xd1e6('0x29')],_0x323de2['from'],_0x3e986d);if(this['mailAccounts'][_0x3e986d]){return mailAccount[_0xd1e6('0x2a')](_0x3e986d,_0x323de2)[_0xd1e6('0x2b')](function(_0x22ec4c){if(_0x22ec4c){logger['info'](_0xd1e6('0x2c'));}})[_0xd1e6('0x2d')](function(_0xf511a1){logger['error'](_0xd1e6('0x2e'),JSON[_0xd1e6('0x17')](_0xf511a1));});}};EmailChannel['prototype'][_0xd1e6('0x22')]=function(_0x40ae18){if(this[_0xd1e6('0xd')][_0x40ae18]&&this[_0xd1e6('0xd')][_0x40ae18][_0xd1e6('0x14')]){if(this['imapAccounts'][this['mailAccounts'][_0x40ae18][_0xd1e6('0x14')]['id']]){delete this[_0xd1e6('0x1d')][this[_0xd1e6('0xd')][_0x40ae18][_0xd1e6('0x14')]['id']];}this[_0xd1e6('0xd')][_0x40ae18][_0xd1e6('0x14')]['lastSync']=moment();this[_0xd1e6('0x10')](_0x40ae18);}};EmailChannel[_0xd1e6('0xf')][_0xd1e6('0x24')]=function(_0xf0cf60,_0x3e63c){if(this[_0xd1e6('0xd')][_0xf0cf60]){this['mailAccounts'][_0xf0cf60][_0xd1e6('0x14')][_0xd1e6('0x13')]=_0xd1e6('0x23');this['mailAccounts'][_0xf0cf60][_0xd1e6('0x14')][_0xd1e6('0x25')]=_0x3e63c;return this[_0xd1e6('0x10')](_0xf0cf60);}};EmailChannel[_0xd1e6('0xf')]['sendMail']=function(_0x370564,_0x511595){return this[_0xd1e6('0xe')][_0xd1e6('0x2f')](_0x370564,_0x511595);};EmailChannel['prototype']['verifySmtp']=function(_0x5923ed){var _0x4ffc3a=this;if(this[_0xd1e6('0xd')][_0x5923ed['id']]){if(_[_0xd1e6('0x16')](this[_0xd1e6('0xd')][_0x5923ed['id']][_0xd1e6('0x30')])){this[_0xd1e6('0xd')][_0x5923ed['id']][_0xd1e6('0x30')]={};}this['mailAccounts'][_0x5923ed['id']][_0xd1e6('0x30')]['lastSync']=moment();return new BPromise(function(_0x67c361,_0x3246c8){return _0x4ffc3a[_0xd1e6('0xe')]['verify'](_0x5923ed)[_0xd1e6('0x2b')](function(_0x1ab4b2){_0x4ffc3a[_0xd1e6('0xd')][_0x5923ed['id']][_0xd1e6('0x30')][_0xd1e6('0x13')]=_0xd1e6('0x31');_0x4ffc3a[_0xd1e6('0xd')][_0x5923ed['id']][_0xd1e6('0x30')][_0xd1e6('0x25')]='';_0x4ffc3a[_0xd1e6('0x10')](_0x5923ed['id']);_0x67c361(_0x1ab4b2);})[_0xd1e6('0x2d')](function(_0x2cddca){_0x4ffc3a[_0xd1e6('0xd')][_0x5923ed['id']][_0xd1e6('0x30')][_0xd1e6('0x13')]=_0xd1e6('0x23');_0x4ffc3a['mailAccounts'][_0x5923ed['id']]['Smtp'][_0xd1e6('0x25')]=_0x2cddca;_0x4ffc3a[_0xd1e6('0x10')](_0x5923ed['id']);_0x3246c8(_0x2cddca);});});}return this['smtp']['verify'](_0x5923ed);};module[_0xd1e6('0x32')]=EmailChannel; \ No newline at end of file +var _0x683e=['total','isNil','stringify','mailAccount:update','refresh','service','provider','custom','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp','verify','then','verified','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','defaults','redis','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','status','Imap','messageStatus'];(function(_0x396101,_0x2d5b6c){var _0x4006c0=function(_0x365cec){while(--_0x365cec){_0x396101['push'](_0x396101['shift']());}};_0x4006c0(++_0x2d5b6c);}(_0x683e,0x95));var _0xe683=function(_0x21b36c,_0x543483){_0x21b36c=_0x21b36c-0x0;var _0x236627=_0x683e[_0x21b36c];return _0x236627;};'use strict';var _=require(_0xe683('0x0'));var moment=require(_0xe683('0x1'));var BPromise=require(_0xe683('0x2'));var md5=require(_0xe683('0x3'));var Redis=require('ioredis');var config=require(_0xe683('0x4'));var logger=require(_0xe683('0x5'))(_0xe683('0x6'));config['redis']=_[_0xe683('0x7')](config[_0xe683('0x8')],{'host':_0xe683('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe683('0x8')]));var EmailImap=require(_0xe683('0xa'));var EmailSmtp=require(_0xe683('0xb'));var mailAccount=require(_0xe683('0xc'));var md5Accounts={};function EmailChannel(_0x4e057f){logger[_0xe683('0xd')](_0xe683('0xe'));this[_0xe683('0xf')]=_0x4e057f[_0xe683('0xf')];this[_0xe683('0x10')]={};this[_0xe683('0x11')]=new EmailSmtp();}EmailChannel[_0xe683('0x12')][_0xe683('0x13')]=function(_0x420144){var _0x3e15fa=this[_0xe683('0xf')][_0x420144];var _0x2d4b43={'id':_0x3e15fa['id'],'name':_0x3e15fa[_0xe683('0x14')],'key':_0x3e15fa['key'],'active':_0x3e15fa[_0xe683('0x15')],'Imap':{'status':_0x3e15fa['Imap'][_0xe683('0x16')],'messageStatus':_0x3e15fa[_0xe683('0x17')][_0xe683('0x18')],'total':_0x3e15fa[_0xe683('0x17')][_0xe683('0x19')]}};if(_[_0xe683('0x1a')](md5Accounts[_0x420144])){md5Accounts[_0x420144]={};}var _0x4e39dc=md5(JSON[_0xe683('0x1b')](_0x2d4b43));if(md5Accounts[_0x420144]['md5']!==_0x4e39dc){md5Accounts[_0x420144][_0xe683('0x3')]=_0x4e39dc;io[_0xe683('0x13')](_0xe683('0x1c'),_0x2d4b43);}};EmailChannel[_0xe683('0x12')][_0xe683('0x1d')]=function(_0x1f2bf8){for(var _0x5c5b1d in _0x1f2bf8){if(_0x1f2bf8['hasOwnProperty'](_0x5c5b1d)){if(_0x1f2bf8[_0x5c5b1d][_0xe683('0x17')]&&_0x1f2bf8[_0x5c5b1d]['active']){var _0xe9e244=_0x1f2bf8[_0x5c5b1d]['Imap'];if(!_0xe9e244[_0xe683('0x1e')]&&_0x1f2bf8[_0x5c5b1d][_0xe683('0x1f')]!==_0xe683('0x20'))_0xe9e244[_0xe683('0x1e')]=_0x1f2bf8[_0x5c5b1d][_0xe683('0x1f')];if(!this[_0xe683('0x10')][_0xe683('0x21')](_0xe9e244['id'])){this[_0xe683('0x10')][_0xe9e244['id']]=new EmailImap(_0xe9e244,_0x1f2bf8[_0x5c5b1d]['email']);this[_0xe683('0x10')][_0xe9e244['id']]['on'](_0xe683('0x22'),this[_0xe683('0x23')][_0xe683('0x24')](this,_0x5c5b1d));this[_0xe683('0x10')][_0xe9e244['id']]['on'](_0xe683('0x6'),this[_0xe683('0x25')]['bind'](this,_0x5c5b1d));this['imapAccounts'][_0xe9e244['id']]['on'](_0xe683('0x26'),this[_0xe683('0x27')]['bind'](this,_0x5c5b1d));this['imapAccounts'][_0xe9e244['id']]['on'](_0xe683('0x28'),this[_0xe683('0x29')]['bind'](this,_0x5c5b1d));}}else{if(_[_0xe683('0x1a')](this[_0xe683('0xf')][_0x5c5b1d][_0xe683('0x17')])){this['mailAccounts'][_0x5c5b1d][_0xe683('0x17')]={};}this[_0xe683('0xf')][_0x5c5b1d][_0xe683('0x17')][_0xe683('0x16')]=_0xe683('0x2a');this[_0xe683('0xf')][_0x5c5b1d]['Imap'][_0xe683('0x18')]='';this['emit'](_0x5c5b1d);}}}};EmailChannel[_0xe683('0x12')][_0xe683('0x23')]=function(_0x1210ce,_0x212e1a){if(this['mailAccounts'][_0x1210ce]){this[_0xe683('0xf')][_0x1210ce][_0xe683('0x17')][_0xe683('0x16')]=_0xe683('0x2b');this['mailAccounts'][_0x1210ce][_0xe683('0x17')][_0xe683('0x18')]=_0x212e1a[_0xe683('0x14')];if(_0x212e1a[_0xe683('0x2c')]){this[_0xe683('0xf')][_0x1210ce]['Imap']['total']=_0x212e1a[_0xe683('0x2c')]['total'];}return this[_0xe683('0x13')](_0x1210ce);}};EmailChannel['prototype'][_0xe683('0x25')]=function(_0x3ddc32,_0xfcae28){logger['info'](_0xe683('0x2d'),_0xfcae28[_0xe683('0x2e')],_0xfcae28[_0xe683('0x2f')],_0xfcae28[_0xe683('0x30')],_0x3ddc32);if(this[_0xe683('0xf')][_0x3ddc32]){return mailAccount['notify'](_0x3ddc32,_0xfcae28)['then'](function(_0x30656e){if(_0x30656e){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0xe683('0x31')](function(_0x28dbaf){logger['error'](_0xe683('0x32'),JSON[_0xe683('0x1b')](_0x28dbaf));});}};EmailChannel[_0xe683('0x12')][_0xe683('0x27')]=function(_0x41c297){if(this['mailAccounts'][_0x41c297]&&this[_0xe683('0xf')][_0x41c297][_0xe683('0x17')]){if(this[_0xe683('0x10')][this[_0xe683('0xf')][_0x41c297][_0xe683('0x17')]['id']]){delete this[_0xe683('0x10')][this[_0xe683('0xf')][_0x41c297][_0xe683('0x17')]['id']];}this[_0xe683('0xf')][_0x41c297][_0xe683('0x17')][_0xe683('0x33')]=moment();this[_0xe683('0x13')](_0x41c297);}};EmailChannel[_0xe683('0x12')]['handleImapError']=function(_0x40ac16,_0x4ecdce){if(this[_0xe683('0xf')][_0x40ac16]){this['mailAccounts'][_0x40ac16][_0xe683('0x17')][_0xe683('0x16')]=_0xe683('0x28');this['mailAccounts'][_0x40ac16][_0xe683('0x17')][_0xe683('0x18')]=_0x4ecdce;return this[_0xe683('0x13')](_0x40ac16);}};EmailChannel[_0xe683('0x12')][_0xe683('0x34')]=function(_0x520d64,_0x1289d0){return this[_0xe683('0x11')][_0xe683('0x35')](_0x520d64,_0x1289d0);};EmailChannel[_0xe683('0x12')]['verifySmtp']=function(_0x19b3a1){var _0x4eb548=this;if(this[_0xe683('0xf')][_0x19b3a1['id']]){if(_[_0xe683('0x1a')](this[_0xe683('0xf')][_0x19b3a1['id']][_0xe683('0x36')])){this[_0xe683('0xf')][_0x19b3a1['id']]['Smtp']={};}this[_0xe683('0xf')][_0x19b3a1['id']]['Smtp'][_0xe683('0x33')]=moment();return new BPromise(function(_0x74d638,_0x5d9512){return _0x4eb548[_0xe683('0x11')][_0xe683('0x37')](_0x19b3a1)[_0xe683('0x38')](function(_0x3e3774){_0x4eb548[_0xe683('0xf')][_0x19b3a1['id']][_0xe683('0x36')]['status']=_0xe683('0x39');_0x4eb548[_0xe683('0xf')][_0x19b3a1['id']]['Smtp'][_0xe683('0x18')]='';_0x4eb548[_0xe683('0x13')](_0x19b3a1['id']);_0x74d638(_0x3e3774);})['catch'](function(_0x1ebc72){_0x4eb548[_0xe683('0xf')][_0x19b3a1['id']][_0xe683('0x36')][_0xe683('0x16')]=_0xe683('0x28');_0x4eb548[_0xe683('0xf')][_0x19b3a1['id']][_0xe683('0x36')][_0xe683('0x18')]=_0x1ebc72;_0x4eb548['emit'](_0x19b3a1['id']);_0x5d9512(_0x1ebc72);});});}return this[_0xe683('0x11')][_0xe683('0x37')](_0x19b3a1);};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 e564edb..1d515dd 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 _0xaabf=['Iconv','events','./utils','../../../config/logger','email','mailbox','account','once','ready','bind','end','handleError','connect','inherits','getAccount','connTimeout','authTimeout','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','user','password','authentication','host','port','tls','prototype','openBox','handleOpenBox','emit','readUnseen','search','UNSEEN','fetch','message','handleFetchMessage','error','handleCloseBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','handleFetchEnd','handleFetchError','closeBox','handleEnd','textCode','hasOwnProperty','upperFirst','exports','util','imap','mailparser','simpleParser','iconv'];(function(_0x1862cc,_0x36e7e1){var _0x3d592f=function(_0x56a7cb){while(--_0x56a7cb){_0x1862cc['push'](_0x1862cc['shift']());}};_0x3d592f(++_0x36e7e1);}(_0xaabf,0x163));var _0xfaab=function(_0x17acce,_0x44631c){_0x17acce=_0x17acce-0x0;var _0x37608f=_0xaabf[_0x17acce];return _0x37608f;};'use strict';var _=require('lodash');var util=require(_0xfaab('0x0'));var Imap=require(_0xfaab('0x1'));var simpleParser=require(_0xfaab('0x2'))[_0xfaab('0x3')];var Iconv=require(_0xfaab('0x4'))[_0xfaab('0x5')];var EventEmitter=require(_0xfaab('0x6'))['EventEmitter'];var utils=require(_0xfaab('0x7'));var logger=require(_0xfaab('0x8'))(_0xfaab('0x9'));function EmailImap(_0x308dd9,_0x4d5878){this[_0xfaab('0xa')]=_0x308dd9['mailbox'];this[_0xfaab('0xb')]=this['getAccount'](_0x308dd9,_0x4d5878);this['imap']=new Imap(this[_0xfaab('0xb')]);this[_0xfaab('0x1')][_0xfaab('0xc')](_0xfaab('0xd'),this['handleReady'][_0xfaab('0xe')](this));this['imap']['once'](_0xfaab('0xf'),this['handleEnd'][_0xfaab('0xe')](this));this[_0xfaab('0x1')]['on']('error',this[_0xfaab('0x10')][_0xfaab('0xe')](this));this[_0xfaab('0x1')][_0xfaab('0x11')]();}util[_0xfaab('0x12')](EmailImap,EventEmitter);EmailImap['prototype'][_0xfaab('0x13')]=function(_0x1f9144,_0x4fc7eb){var _0x5f2550={'connTimeout':_0x1f9144[_0xfaab('0x14')]?_0x1f9144[_0xfaab('0x14')]*0x3e8:0x2710,'authTimeout':_0x1f9144[_0xfaab('0x15')]?_0x1f9144['authTimeout']*0x3e8:0x1388};if(_0x1f9144['service']){_0x5f2550['user']=_0x1f9144['user'];if(_0x1f9144[_0xfaab('0x16')]){_0x5f2550[_0xfaab('0x17')]=utils[_0xfaab('0x18')](_0x1f9144[_0xfaab('0x19')][_0xfaab('0x1a')],_0x1f9144[_0xfaab('0x1b')]);}else{_0x5f2550[_0xfaab('0x1c')]=_0x1f9144[_0xfaab('0x1c')];}}else{if(_0x1f9144[_0xfaab('0x1d')]){_0x5f2550['user']=_0x1f9144[_0xfaab('0x1b')];_0x5f2550['password']=_0x1f9144[_0xfaab('0x1c')];}}_0x5f2550[_0xfaab('0x9')]=_0x4fc7eb||_0x1f9144[_0xfaab('0x1b')]||'anonymous@xcally.com';_0x5f2550[_0xfaab('0x1e')]=_0x1f9144['host'];_0x5f2550[_0xfaab('0x1f')]=_0x1f9144[_0xfaab('0x1f')]||0x3e1;if(_0x1f9144[_0xfaab('0x20')]){_0x5f2550[_0xfaab('0x20')]=!![];}else{_0x5f2550[_0xfaab('0x20')]=![];_0x5f2550['autotls']='required';}return _0x5f2550;};EmailImap[_0xfaab('0x21')]['handleReady']=function(){this['imap'][_0xfaab('0x22')](this[_0xfaab('0xa')],![],this['handleOpenBox'][_0xfaab('0xe')](this));};EmailImap[_0xfaab('0x21')][_0xfaab('0x23')]=function(_0x5dd7dd,_0x5ba9d0){if(_0x5dd7dd){this['handleError'](_0x5dd7dd,!![]);}else{this[_0xfaab('0x24')]('box',_0x5ba9d0);this[_0xfaab('0x25')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x469141){if(_0x469141){this[_0xfaab('0x10')](_0x469141,!![]);}else{this[_0xfaab('0x1')][_0xfaab('0xf')]();}};EmailImap[_0xfaab('0x21')][_0xfaab('0x25')]=function(){this['imap'][_0xfaab('0x26')]([_0xfaab('0x27')],this['handleReadUnseen'][_0xfaab('0xe')](this));};EmailImap[_0xfaab('0x21')]['handleReadUnseen']=function(_0x41e64c,_0x5ee56b){if(_0x41e64c){this[_0xfaab('0x10')](_0x41e64c,!![]);}else{if(_0x5ee56b['length']){try{var _0x344f72=this[_0xfaab('0x1')][_0xfaab('0x28')](_0x5ee56b,{'bodies':'','markSeen':!![]});_0x344f72['on'](_0xfaab('0x29'),this[_0xfaab('0x2a')][_0xfaab('0xe')](this));_0x344f72[_0xfaab('0xc')](_0xfaab('0x2b'),this['handleFetchError'][_0xfaab('0xe')](this));_0x344f72[_0xfaab('0xc')](_0xfaab('0xf'),this['handleFetchEnd'][_0xfaab('0xe')](this));}catch(_0x130968){logger[_0xfaab('0x2b')](_0x130968);}}else{this[_0xfaab('0x1')]['closeBox'](!![],this[_0xfaab('0x2c')]['bind'](this));}}};EmailImap[_0xfaab('0x21')]['handleFetchMessage']=function(_0x356355){_0x356355['on'](_0xfaab('0x2d'),this['handleMessageBody'][_0xfaab('0xe')](this));_0x356355[_0xfaab('0xc')](_0xfaab('0x2e'),this[_0xfaab('0x2f')][_0xfaab('0xe')](this));_0x356355[_0xfaab('0xc')](_0xfaab('0xf'),this[_0xfaab('0x30')][_0xfaab('0xe')](this));};EmailImap[_0xfaab('0x21')][_0xfaab('0x31')]=function(_0x4cd089){simpleParser(_0x4cd089,{'Iconv':Iconv},this[_0xfaab('0x32')][_0xfaab('0xe')](this));};EmailImap[_0xfaab('0x21')][_0xfaab('0x2f')]=function(){};EmailImap[_0xfaab('0x21')]['handleMessageEnd']=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x1a56b8,_0x3f16a3){if(_0x1a56b8){logger[_0xfaab('0x2b')](_0x1a56b8);}else{var _0x27830a=this;utils[_0xfaab('0x33')](this[_0xfaab('0xb')],_0x3f16a3,function(_0x25e04e){_0x27830a[_0xfaab('0x24')](_0xfaab('0x9'),_0x25e04e);});}};EmailImap['prototype'][_0xfaab('0x34')]=function(){this[_0xfaab('0x1')]['closeBox'](!![],this[_0xfaab('0x2c')][_0xfaab('0xe')](this));};EmailImap['prototype'][_0xfaab('0x35')]=function(_0x1f6060){this[_0xfaab('0x10')](_0x1f6060);this['imap'][_0xfaab('0x36')](!![],this[_0xfaab('0x2c')]['bind'](this));};EmailImap[_0xfaab('0x21')][_0xfaab('0x37')]=function(){this[_0xfaab('0x24')](_0xfaab('0xf'));};EmailImap[_0xfaab('0x21')]['handleError']=function(_0x4fa113,_0x10ded2){logger[_0xfaab('0x2b')](_0xfaab('0x10'),this[_0xfaab('0xb')][_0xfaab('0x9')],JSON['stringify'](_0x4fa113));var _0x16a461='';if(_0x4fa113){if(_0x4fa113[_0xfaab('0x38')]){_0x16a461=_0x4fa113['textCode'];}else{for(var _0x3e3c99 in _0x4fa113){if(_0x4fa113[_0xfaab('0x39')](_0x3e3c99)){_0x16a461+=_[_0xfaab('0x3a')](_0x3e3c99)+':\x20'+_0x4fa113[_0x3e3c99]+'\x0a';}}}}if(_0x10ded2){this[_0xfaab('0x1')][_0xfaab('0xf')]();}else{this[_0xfaab('0x24')](_0xfaab('0x2b'),_0x16a461);this[_0xfaab('0x24')]('end');}};module[_0xfaab('0x3b')]=EmailImap; \ No newline at end of file +var _0x7355=['tls','autotls','required','prototype','handleOpenBox','emit','box','readUnseen','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleCloseBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','closeBox','handleFetchError','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','iconv','events','EventEmitter','../../../config/logger','email','mailbox','getAccount','account','once','ready','handleReady','bind','end','error','handleError','inherits','connTimeout','authTimeout','service','user','modernAuthentication','data5','password','authentication','anonymous@xcally.com','host','port'];(function(_0x153314,_0x1f3a0f){var _0x1ad899=function(_0x4b4f3c){while(--_0x4b4f3c){_0x153314['push'](_0x153314['shift']());}};_0x1ad899(++_0x1f3a0f);}(_0x7355,0x1c1));var _0x5735=function(_0x266228,_0x375429){_0x266228=_0x266228-0x0;var _0x26c295=_0x7355[_0x266228];return _0x26c295;};'use strict';var _=require(_0x5735('0x0'));var util=require(_0x5735('0x1'));var Imap=require(_0x5735('0x2'));var simpleParser=require(_0x5735('0x3'))['simpleParser'];var Iconv=require(_0x5735('0x4'))['Iconv'];var EventEmitter=require(_0x5735('0x5'))[_0x5735('0x6')];var utils=require('./utils');var logger=require(_0x5735('0x7'))(_0x5735('0x8'));function EmailImap(_0x4f6d81,_0x3ef329){this[_0x5735('0x9')]=_0x4f6d81[_0x5735('0x9')];this['account']=this[_0x5735('0xa')](_0x4f6d81,_0x3ef329);this['imap']=new Imap(this[_0x5735('0xb')]);this[_0x5735('0x2')][_0x5735('0xc')](_0x5735('0xd'),this[_0x5735('0xe')][_0x5735('0xf')](this));this[_0x5735('0x2')][_0x5735('0xc')](_0x5735('0x10'),this['handleEnd'][_0x5735('0xf')](this));this[_0x5735('0x2')]['on'](_0x5735('0x11'),this[_0x5735('0x12')][_0x5735('0xf')](this));this[_0x5735('0x2')]['connect']();}util[_0x5735('0x13')](EmailImap,EventEmitter);EmailImap['prototype'][_0x5735('0xa')]=function(_0x40c40a,_0x4f7989){var _0x482652={'connTimeout':_0x40c40a[_0x5735('0x14')]?_0x40c40a[_0x5735('0x14')]*0x3e8:0x2710,'authTimeout':_0x40c40a[_0x5735('0x15')]?_0x40c40a[_0x5735('0x15')]*0x3e8:0x1388};if(_0x40c40a[_0x5735('0x16')]){_0x482652['user']=_0x40c40a[_0x5735('0x17')];if(_0x40c40a[_0x5735('0x18')]){_0x482652['xoauth2']=utils['generateXOAuth2Token'](_0x40c40a['CloudProvider'][_0x5735('0x19')],_0x40c40a['user']);}else{_0x482652[_0x5735('0x1a')]=_0x40c40a['password'];}}else{if(_0x40c40a[_0x5735('0x1b')]){_0x482652['user']=_0x40c40a[_0x5735('0x17')];_0x482652[_0x5735('0x1a')]=_0x40c40a[_0x5735('0x1a')];}}_0x482652[_0x5735('0x8')]=_0x4f7989||_0x40c40a[_0x5735('0x17')]||_0x5735('0x1c');_0x482652[_0x5735('0x1d')]=_0x40c40a[_0x5735('0x1d')];_0x482652['port']=_0x40c40a[_0x5735('0x1e')]||0x3e1;if(_0x40c40a[_0x5735('0x1f')]){_0x482652['tls']=!![];}else{_0x482652[_0x5735('0x1f')]=![];_0x482652[_0x5735('0x20')]=_0x5735('0x21');}return _0x482652;};EmailImap[_0x5735('0x22')]['handleReady']=function(){this[_0x5735('0x2')]['openBox'](this[_0x5735('0x9')],![],this[_0x5735('0x23')]['bind'](this));};EmailImap['prototype'][_0x5735('0x23')]=function(_0x280e3f,_0x35add8){if(_0x280e3f){this[_0x5735('0x12')](_0x280e3f,!![]);}else{this[_0x5735('0x24')](_0x5735('0x25'),_0x35add8);this[_0x5735('0x26')]();}};EmailImap[_0x5735('0x22')]['handleCloseBox']=function(_0x2ccacc){if(_0x2ccacc){this[_0x5735('0x12')](_0x2ccacc,!![]);}else{this[_0x5735('0x2')][_0x5735('0x10')]();}};EmailImap[_0x5735('0x22')]['readUnseen']=function(){this[_0x5735('0x2')]['search']([_0x5735('0x27')],this[_0x5735('0x28')][_0x5735('0xf')](this));};EmailImap[_0x5735('0x22')][_0x5735('0x28')]=function(_0x51aa19,_0x3c0813){if(_0x51aa19){this[_0x5735('0x12')](_0x51aa19,!![]);}else{if(_0x3c0813[_0x5735('0x29')]){try{var _0x5c9bad=this[_0x5735('0x2')][_0x5735('0x2a')](_0x3c0813,{'bodies':'','markSeen':!![]});_0x5c9bad['on']('message',this[_0x5735('0x2b')][_0x5735('0xf')](this));_0x5c9bad[_0x5735('0xc')](_0x5735('0x11'),this['handleFetchError'][_0x5735('0xf')](this));_0x5c9bad[_0x5735('0xc')](_0x5735('0x10'),this['handleFetchEnd'][_0x5735('0xf')](this));}catch(_0x411306){logger[_0x5735('0x11')](_0x411306);}}else{this[_0x5735('0x2')]['closeBox'](!![],this[_0x5735('0x2c')][_0x5735('0xf')](this));}}};EmailImap[_0x5735('0x22')][_0x5735('0x2b')]=function(_0x408b62){_0x408b62['on']('body',this[_0x5735('0x2d')][_0x5735('0xf')](this));_0x408b62[_0x5735('0xc')](_0x5735('0x2e'),this[_0x5735('0x2f')][_0x5735('0xf')](this));_0x408b62[_0x5735('0xc')](_0x5735('0x10'),this[_0x5735('0x30')]['bind'](this));};EmailImap[_0x5735('0x22')][_0x5735('0x2d')]=function(_0x53d5aa){simpleParser(_0x53d5aa,{'Iconv':Iconv},this[_0x5735('0x31')][_0x5735('0xf')](this));};EmailImap[_0x5735('0x22')][_0x5735('0x2f')]=function(){};EmailImap[_0x5735('0x22')][_0x5735('0x30')]=function(){};EmailImap[_0x5735('0x22')][_0x5735('0x31')]=function(_0x56a7a6,_0x3742cb){if(_0x56a7a6){logger[_0x5735('0x11')](_0x56a7a6);}else{var _0x401c15=this;utils[_0x5735('0x32')](this['account'],_0x3742cb,function(_0x6bcf48){_0x401c15[_0x5735('0x24')]('email',_0x6bcf48);});}};EmailImap[_0x5735('0x22')][_0x5735('0x33')]=function(){this[_0x5735('0x2')][_0x5735('0x34')](!![],this['handleCloseBox'][_0x5735('0xf')](this));};EmailImap[_0x5735('0x22')][_0x5735('0x35')]=function(_0x4ae905){this[_0x5735('0x12')](_0x4ae905);this[_0x5735('0x2')][_0x5735('0x34')](!![],this[_0x5735('0x2c')][_0x5735('0xf')](this));};EmailImap[_0x5735('0x22')][_0x5735('0x36')]=function(){this[_0x5735('0x24')](_0x5735('0x10'));};EmailImap['prototype'][_0x5735('0x12')]=function(_0x31eb1a,_0x4c5232){logger[_0x5735('0x11')](_0x5735('0x12'),this['account'][_0x5735('0x8')],JSON[_0x5735('0x37')](_0x31eb1a));var _0x5b7064='';if(_0x31eb1a){if(_0x31eb1a[_0x5735('0x38')]){_0x5b7064=_0x31eb1a[_0x5735('0x38')];}else{for(var _0x10f132 in _0x31eb1a){if(_0x31eb1a[_0x5735('0x39')](_0x10f132)){_0x5b7064+=_[_0x5735('0x3a')](_0x10f132)+':\x20'+_0x31eb1a[_0x10f132]+'\x0a';}}}}if(_0x4c5232){this[_0x5735('0x2')]['end']();}else{this[_0x5735('0x24')]('error',_0x5b7064);this[_0x5735('0x24')](_0x5735('0x10'));}};module[_0x5735('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index c30ee83..bbc1ff9 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46cb=['createTransport','use','verify','toString','Not\x20verifired','exports','nodemailer','prototype','send'];(function(_0x26e502,_0x5a9f70){var _0x4f38ae=function(_0x2de740){while(--_0x2de740){_0x26e502['push'](_0x26e502['shift']());}};_0x4f38ae(++_0x5a9f70);}(_0x46cb,0xa8));var _0xb46c=function(_0x48ec91,_0x212edc){_0x48ec91=_0x48ec91-0x0;var _0x22766c=_0x46cb[_0x48ec91];return _0x22766c;};'use strict';var nodemailer=require(_0xb46c('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xb46c('0x1')][_0xb46c('0x2')]=function(_0x3d28c3,_0x9c6f33){return new Promise(function(_0x3467b7,_0x38337e){var _0x191161=nodemailer[_0xb46c('0x3')](_0x3d28c3);_0x191161[_0xb46c('0x4')]('compile',inlineBase64());_0x191161['sendMail'](_0x9c6f33,function(_0x452a56,_0x244b66){if(_0x452a56){_0x38337e(_0x452a56['toString']());}else{_0x3467b7(_0x244b66);}});});};EmailSmtp[_0xb46c('0x1')][_0xb46c('0x5')]=function(_0x2f0442){return new Promise(function(_0x309c74,_0x5f5c1b){var _0x558293=nodemailer[_0xb46c('0x3')](_0x2f0442);_0x558293[_0xb46c('0x5')](function(_0x5a2f2e,_0x426959){if(_0x5a2f2e){_0x5f5c1b(_0x5a2f2e[_0xb46c('0x6')]());}else{if(_0x426959){_0x309c74(_0x426959);}else{_0x5f5c1b(_0xb46c('0x7'));}}});});};module[_0xb46c('0x8')]=EmailSmtp; \ No newline at end of file +var _0x87c5=['toString','prototype','verify','Not\x20verifired','send','createTransport','compile','sendMail'];(function(_0x5906a5,_0x48af0a){var _0x1b9a31=function(_0x4b72ac){while(--_0x4b72ac){_0x5906a5['push'](_0x5906a5['shift']());}};_0x1b9a31(++_0x48af0a);}(_0x87c5,0x1d4));var _0x587c=function(_0x139692,_0x260da9){_0x139692=_0x139692-0x0;var _0x409b0b=_0x87c5[_0x139692];return _0x409b0b;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0x587c('0x0')]=function(_0x57216a,_0x1154e5){return new Promise(function(_0x24e0bc,_0x5775f9){var _0x3ca5f1=nodemailer[_0x587c('0x1')](_0x57216a);_0x3ca5f1['use'](_0x587c('0x2'),inlineBase64());_0x3ca5f1[_0x587c('0x3')](_0x1154e5,function(_0x565c45,_0x522932){if(_0x565c45){_0x5775f9(_0x565c45[_0x587c('0x4')]());}else{_0x24e0bc(_0x522932);}});});};EmailSmtp[_0x587c('0x5')][_0x587c('0x6')]=function(_0x1ff6e5){return new Promise(function(_0x5eac98,_0x349a75){var _0x42adc4=nodemailer[_0x587c('0x1')](_0x1ff6e5);_0x42adc4['verify'](function(_0x212864,_0x45bbd2){if(_0x212864){_0x349a75(_0x212864['toString']());}else{if(_0x45bbd2){_0x5eac98(_0x45bbd2);}else{_0x349a75(_0x587c('0x7'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 40ea07e..b11ed59 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x158c=['Precedence:\x20auto_reply','indexOf','line','isAutoreply','parser','from','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','

Empty\x20message

','Attachments','Title','Data','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','@xcally.com','name','substring','split','length','slice','join','Anonymous','pop','isEmpty','anonymous','generate','html','test','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x1f92dc[_0xc158('0xf')](0x0,-0x1)[_0xc158('0x10')]('\x20'):_0xa364b5['name'];}return _0xc158('0x11');}function getLastName(_0x3fa46c){var _0x17b373=_['head'](_0x3fa46c['value']);if(_0x17b373&&_0x17b373['name']){var _0x2b99fb=_0x17b373[_0xc158('0xb')][_0xc158('0xd')](/\s+/);return _0x2b99fb[_0xc158('0xe')]>0x1?_0x2b99fb[_0xc158('0x12')]():'';}return'';}function getMails(_0x4789c9,_0x473a42){var _0x485702='';for(var _0x45d5d2=0x0;_0x45d5d2<_0x473a42[_0xc158('0x8')][_0xc158('0xe')];_0x45d5d2+=0x1){if(_0x473a42[_0xc158('0x8')][_0x45d5d2][_0xc158('0x9')]!==_0x4789c9){if(!_[_0xc158('0x13')](_0x485702)){_0x485702+=',';}_0x485702+=_0x473a42[_0xc158('0x8')][_0x45d5d2]['name']||_0x473a42[_0xc158('0x8')][_0x45d5d2][_0xc158('0x9')]||'';_0x485702+='\x20<';_0x485702+=_0x473a42[_0xc158('0x8')][_0x45d5d2][_0xc158('0x9')]?_0x473a42[_0xc158('0x8')][_0x45d5d2][_0xc158('0x9')]:_0xc158('0x14')+random[_0xc158('0x15')](0x6)+_0xc158('0xa');_0x485702+='>';}}return _0x485702;}function parseEmail(_0x401ebb,_0x4ceae1,_0xa21bf5){if(_0x4ceae1[_0xc158('0x16')]){var _0x268612=/)<[^<]*)*<\/script>/gi;while(_0x268612[_0xc158('0x17')](_0x4ceae1[_0xc158('0x16')])){_0x4ceae1[_0xc158('0x16')]=_0x4ceae1[_0xc158('0x16')]['replace'](_0x268612,'');}if(_0x4ceae1[_0xc158('0x16')]['includes'](_0xc158('0x18'))){var _0x3e3364=[];_0x4ceae1['attachments'][_0xc158('0x19')](_0x334017=>{_0x3e3364[_0xc158('0x1a')](_0x334017[_0xc158('0x1b')]);});var _0x58cc8b=/]+>/g;var _0x377fef=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3d58b0=_0x4ceae1[_0xc158('0x16')]['replace'](_0x377fef,_0xc158('0x1c'));var _0xf3735a=_0x3d58b0[_0xc158('0x1d')](_0x58cc8b,_0xc158('0x1e'));for(let _0x13acf9=0x0;_0x13acf9<_0x3e3364['length'];_0x13acf9++){var _0x5c0577=_0xf3735a[_0xc158('0x1d')](_0xc158('0x1e'),_0xc158('0x1f')+_0x3e3364[_0x13acf9]+_0xc158('0x20'));_0xf3735a=_0x5c0577;}_0x4ceae1[_0xc158('0x16')]=_0xf3735a;}_0xa21bf5[_0xc158('0x21')]=_0x4ceae1[_0xc158('0x16')];}else{_0xa21bf5[_0xc158('0x21')]=_0x4ceae1[_0xc158('0x22')];}if(_0xa21bf5['body']){_0xa21bf5[_0xc158('0x21')]=_0xa21bf5[_0xc158('0x21')][_0xc158('0x1d')](/0x0){var _0x58e2c2=[_0xc158('0x37'),_0xc158('0x38'),_0xc158('0x39')];for(var _0x580462=0x0;_0x580462<_0x4ceae1[_0xc158('0x36')][_0xc158('0xe')];_0x580462++){var _0x4fe2fb=_[_0xc158('0x3a')](_0x58e2c2,_0x4ceae1[_0xc158('0x36')][_0x580462][_0xc158('0x3b')]);if(_0x4fe2fb>=0x0){_0xa21bf5[_0xc158('0x3c')]=!![];}}}return _0xa21bf5;}exports[_0xc158('0x3d')]=function(_0x4d8749,_0x57188d,_0x1b3dab){var _0x5769f0={'from':getAddress(_0x57188d[_0xc158('0x3e')]),'firstName':getFirstName(_0x57188d[_0xc158('0x3e')]),'lastName':getLastName(_0x57188d[_0xc158('0x3e')]),'mapKey':'email','message':{'from':getMails(_0x4d8749[_0xc158('0x24')],_0x57188d[_0xc158('0x3e')]),'to':_0x4d8749[_0xc158('0x24')],'cc':'','subject':_0x57188d['subject']||'','messageId':_0x57188d[_0xc158('0x3f')],'inReplyTo':_0x57188d[_0xc158('0x40')],'sentAt':moment(_0x57188d[_0xc158('0x41')])[_0xc158('0x2f')](_0xc158('0x42')),'attach':![],'attachments':[]}};if(!_0x57188d[_0xc158('0x16')]&&!_0x57188d[_0xc158('0x22')]){var _0x3ea20e=_[_0xc158('0x43')](_0x57188d['attachments'],{'contentType':_0xc158('0x44')});if(_0x3ea20e[_0xc158('0xe')]){logger[_0xc158('0x45')](util[_0xc158('0x2f')](_0xc158('0x46'),_0x57188d[_0xc158('0x3f')]));tnef[_0xc158('0x47')](_['first'](_0x3ea20e)[_0xc158('0x35')],function(_0x37f824,_0x3c04de){if(_0x3c04de){_0x57188d['html']=_0x3c04de['BodyHTML']||_0xc158('0x48');if(_0x3c04de[_0xc158('0x49')]){for(var _0x1052e9=0x0;_0x1052e9<_0x3c04de['Attachments'][_0xc158('0xe')];_0x1052e9++){var _0x2d8b8c=_0x3c04de[_0xc158('0x49')][_0x1052e9];_0x5769f0['message'][_0xc158('0x2a')]['push']({'filename':_0x2d8b8c[_0xc158('0x4a')],'content':Buffer['from'](_0x2d8b8c[_0xc158('0x4b')])});}}}_0x1b3dab(parseEmail(_0x4d8749,_0x57188d,_0x5769f0));});}else{_0x57188d[_0xc158('0x16')]=_0xc158('0x48');_0x1b3dab(parseEmail(_0x4d8749,_0x57188d,_0x5769f0));}}else{_0x1b3dab(parseEmail(_0x4d8749,_0x57188d,_0x5769f0));}};exports['generateXOAuth2Token']=function(_0x279051,_0x224742){var _0x43b00b=[_0xc158('0x4c')+(_0x224742||''),_0xc158('0x4d')+_0x279051,'',''];return Buffer[_0xc158('0x3e')](_0x43b00b[_0xc158('0x10')](''),_0xc158('0x4e'))[_0xc158('0x4f')](_0xc158('0x50'));}; \ No newline at end of file +var _0x1711=['generate','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','isEmpty','html','replace','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','base64','lodash','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous'];(function(_0xb804b,_0x32b2ed){var _0x13e777=function(_0x58b8ba){while(--_0x58b8ba){_0xb804b['push'](_0xb804b['shift']());}};_0x13e777(++_0x32b2ed);}(_0x1711,0x88));var _0x1171=function(_0x598ec6,_0x3a2b3a){_0x598ec6=_0x598ec6-0x0;var _0x43ebf6=_0x1711[_0x598ec6];return _0x43ebf6;};'use strict';var _=require(_0x1171('0x0'));var moment=require('moment');var random=require(_0x1171('0x1'));var fs=require('fs');var path=require(_0x1171('0x2'));var util=require(_0x1171('0x3'));var tnef=require(_0x1171('0x4'));var logger=require(_0x1171('0x5'))(_0x1171('0x6'));var config=require(_0x1171('0x7'));function getAddress(_0x33e295){var _0xf06b49=_[_0x1171('0x8')](_0x33e295[_0x1171('0x9')]);return _0xf06b49&&_0xf06b49[_0x1171('0xa')]?_0xf06b49[_0x1171('0xa')]:_0x1171('0xb')+random[_0x1171('0xc')](0x6)+_0x1171('0xd');}function getFirstName(_0x5cbd40){var _0x18edf9=_[_0x1171('0x8')](_0x5cbd40['value']);if(_0x18edf9&&_0x18edf9['name']){if(_0x18edf9[_0x1171('0xe')]==_0x18edf9[_0x1171('0xa')]){return _0x18edf9[_0x1171('0xe')][_0x1171('0xf')](0x0,_0x18edf9[_0x1171('0xe')][_0x1171('0x10')]('@'));}var _0x5b60f5=_0x18edf9['name'][_0x1171('0x11')](/\s+/);return _0x5b60f5[_0x1171('0x12')]>0x1?_0x5b60f5[_0x1171('0x13')](0x0,-0x1)[_0x1171('0x14')]('\x20'):_0x18edf9['name'];}return _0x1171('0x15');}function getLastName(_0x110ff8){var _0x5b2bf4=_['head'](_0x110ff8[_0x1171('0x9')]);if(_0x5b2bf4&&_0x5b2bf4[_0x1171('0xe')]){var _0x47587f=_0x5b2bf4[_0x1171('0xe')]['split'](/\s+/);return _0x47587f[_0x1171('0x12')]>0x1?_0x47587f['pop']():'';}return'';}function getMails(_0x44669a,_0x42238a){var _0xec1e1c='';for(var _0x3c1f54=0x0;_0x3c1f54<_0x42238a['value'][_0x1171('0x12')];_0x3c1f54+=0x1){if(_0x42238a[_0x1171('0x9')][_0x3c1f54]['address']!==_0x44669a){if(!_[_0x1171('0x16')](_0xec1e1c)){_0xec1e1c+=',';}_0xec1e1c+=_0x42238a[_0x1171('0x9')][_0x3c1f54]['name']||_0x42238a['value'][_0x3c1f54][_0x1171('0xa')]||'';_0xec1e1c+='\x20<';_0xec1e1c+=_0x42238a[_0x1171('0x9')][_0x3c1f54][_0x1171('0xa')]?_0x42238a[_0x1171('0x9')][_0x3c1f54]['address']:_0x1171('0xb')+random[_0x1171('0xc')](0x6)+_0x1171('0xd');_0xec1e1c+='>';}}return _0xec1e1c;}function parseEmail(_0x12c5d4,_0x56d9a2,_0x229873){if(_0x56d9a2[_0x1171('0x17')]){var _0x26911e=/)<[^<]*)*<\/script>/gi;while(_0x26911e['test'](_0x56d9a2[_0x1171('0x17')])){_0x56d9a2[_0x1171('0x17')]=_0x56d9a2[_0x1171('0x17')][_0x1171('0x18')](_0x26911e,'');}if(_0x56d9a2[_0x1171('0x17')]['includes'](_0x1171('0x19'))){var _0x2db0de=[];_0x56d9a2[_0x1171('0x1a')][_0x1171('0x1b')](_0x54974a=>{_0x2db0de[_0x1171('0x1c')](_0x54974a[_0x1171('0x1d')]);});var _0x1763a7=/]+>/g;var _0x5d5419=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2ef598=_0x56d9a2[_0x1171('0x17')][_0x1171('0x18')](_0x5d5419,_0x1171('0x1e'));var _0x500b4a=_0x2ef598[_0x1171('0x18')](_0x1763a7,_0x1171('0x1f'));for(let _0x30f98c=0x0;_0x30f98c<_0x2db0de[_0x1171('0x12')];_0x30f98c++){var _0x597672=_0x500b4a[_0x1171('0x18')](_0x1171('0x1f'),_0x1171('0x20')+_0x2db0de[_0x30f98c]+_0x1171('0x21'));_0x500b4a=_0x597672;}_0x56d9a2[_0x1171('0x17')]=_0x500b4a;}_0x229873[_0x1171('0x22')]=_0x56d9a2[_0x1171('0x17')];}else{_0x229873[_0x1171('0x22')]=_0x56d9a2['textAsHtml'];}if(_0x229873['body']){_0x229873['body']=_0x229873[_0x1171('0x22')][_0x1171('0x18')](/0x0){var _0x4fc95a=['Auto-Submitted:\x20auto-replied',_0x1171('0x35'),_0x1171('0x36')];for(var _0x57a37a=0x0;_0x57a37a<_0x56d9a2[_0x1171('0x34')][_0x1171('0x12')];_0x57a37a++){var _0x70f632=_[_0x1171('0x10')](_0x4fc95a,_0x56d9a2['headerLines'][_0x57a37a][_0x1171('0x37')]);if(_0x70f632>=0x0){_0x229873['isAutoreply']=!![];}}}return _0x229873;}exports[_0x1171('0x38')]=function(_0x11233e,_0x4548af,_0x2033c5){var _0x1e80b9={'from':getAddress(_0x4548af['from']),'firstName':getFirstName(_0x4548af['from']),'lastName':getLastName(_0x4548af[_0x1171('0x39')]),'mapKey':_0x1171('0x6'),'message':{'from':getMails(_0x11233e[_0x1171('0x6')],_0x4548af[_0x1171('0x39')]),'to':_0x11233e[_0x1171('0x6')],'cc':'','subject':_0x4548af['subject']||'','messageId':_0x4548af[_0x1171('0x3a')],'inReplyTo':_0x4548af[_0x1171('0x3b')],'sentAt':moment(_0x4548af['date'])[_0x1171('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x4548af['html']&&!_0x4548af[_0x1171('0x3c')]){var _0x52f2d9=_[_0x1171('0x3d')](_0x4548af[_0x1171('0x1a')],{'contentType':_0x1171('0x3e')});if(_0x52f2d9[_0x1171('0x12')]){logger[_0x1171('0x3f')](util[_0x1171('0x2c')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x4548af[_0x1171('0x3a')]));tnef['parseBuffer'](_[_0x1171('0x40')](_0x52f2d9)[_0x1171('0x32')],function(_0x6472f7,_0x474c2a){if(_0x474c2a){_0x4548af['html']=_0x474c2a['BodyHTML']||_0x1171('0x41');if(_0x474c2a[_0x1171('0x42')]){for(var _0x4c7097=0x0;_0x4c7097<_0x474c2a[_0x1171('0x42')]['length'];_0x4c7097++){var _0x4f4569=_0x474c2a[_0x1171('0x42')][_0x4c7097];_0x1e80b9[_0x1171('0x24')][_0x1171('0x1a')][_0x1171('0x1c')]({'filename':_0x4f4569[_0x1171('0x43')],'content':Buffer[_0x1171('0x39')](_0x4f4569[_0x1171('0x44')])});}}}_0x2033c5(parseEmail(_0x11233e,_0x4548af,_0x1e80b9));});}else{_0x4548af[_0x1171('0x17')]='

Empty\x20message

';_0x2033c5(parseEmail(_0x11233e,_0x4548af,_0x1e80b9));}}else{_0x2033c5(parseEmail(_0x11233e,_0x4548af,_0x1e80b9));}};exports[_0x1171('0x45')]=function(_0x508f84,_0x2073f2){var _0xe7b05c=['user='+(_0x2073f2||''),_0x1171('0x46')+_0x508f84,'',''];return Buffer['from'](_0xe7b05c[_0x1171('0x14')](''),_0x1171('0x47'))[_0x1171('0x48')](_0x1171('0x49'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 2cf5819..05e3039 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 _0x0520=['name','key','SERV','active','Imap','Smtp','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0520,0x8c));var _0x0052=function(_0xd4968a,_0x5dc8fa){_0xd4968a=_0xd4968a-0x0;var _0x4afdae=_0x0520[_0xd4968a];return _0x4afdae;};'use strict';var _=require('lodash');function MailAccount(_0x36c60c){this['id']=_0x36c60c['id']||0x0;this[_0x0052('0x0')]=_0x36c60c['name']||'Service';this[_0x0052('0x1')]=_0x36c60c[_0x0052('0x1')]||_0x0052('0x2');this[_0x0052('0x3')]=_0x36c60c[_0x0052('0x3')]||![];this[_0x0052('0x4')]=_0x36c60c[_0x0052('0x4')]||[];this[_0x0052('0x5')]=_0x36c60c['Smtp']||[];}module[_0x0052('0x6')]=MailAccount; \ No newline at end of file +var _0xc18a=['name','Service','key','SERV','active','Imap','Smtp','exports','lodash'];(function(_0x3bdc5f,_0x3107ca){var _0x1634ec=function(_0x315007){while(--_0x315007){_0x3bdc5f['push'](_0x3bdc5f['shift']());}};_0x1634ec(++_0x3107ca);}(_0xc18a,0x182));var _0xac18=function(_0x29f866,_0x325482){_0x29f866=_0x29f866-0x0;var _0x1697de=_0xc18a[_0x29f866];return _0x1697de;};'use strict';var _=require(_0xac18('0x0'));function MailAccount(_0x17d15b){this['id']=_0x17d15b['id']||0x0;this[_0xac18('0x1')]=_0x17d15b[_0xac18('0x1')]||_0xac18('0x2');this[_0xac18('0x3')]=_0x17d15b[_0xac18('0x3')]||_0xac18('0x4');this[_0xac18('0x5')]=_0x17d15b[_0xac18('0x5')]||![];this[_0xac18('0x6')]=_0x17d15b[_0xac18('0x6')]||[];this[_0xac18('0x7')]=_0x17d15b['Smtp']||[];}module[_0xac18('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index b428451..a3f13c6 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 _0x338f=['length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','prototype'];(function(_0x4dc8fc,_0x27d9a5){var _0x18d77f=function(_0x49050c){while(--_0x49050c){_0x4dc8fc['push'](_0x4dc8fc['shift']());}};_0x18d77f(++_0x27d9a5);}(_0x338f,0x109));var _0xf338=function(_0x110924,_0x1374bb){_0x110924=_0x110924-0x0;var _0x12905b=_0x338f[_0x110924];return _0x12905b;};'use strict';var _=require(_0xf338('0x0'));var MailAccount=require(_0xf338('0x1'));var Realtime=function(){this[_0xf338('0x2')]={};};function freeIsNotKey(_0x576bdc,_0x4b121e,_0x2fddcd){var _0x3d0647=_[_0xf338('0x3')](_0x576bdc,function(_0x5a2cc8,_0x18a29e){return _0x5a2cc8[_0x2fddcd];});for(var _0xcd6818 in _0x4b121e){if(_0x4b121e['hasOwnProperty'](_0xcd6818)){if(!_0x3d0647[_0xcd6818]){delete _0x4b121e[_0xcd6818];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x5c93d1,_0x2e3c1b){for(var _0x1c6b64 in _0x2e3c1b){if(_0x5c93d1['hasOwnProperty'](_0x1c6b64)){_0x5c93d1[_0x1c6b64]=_0x2e3c1b[_0x1c6b64];}}};Realtime[_0xf338('0x4')]['initMailAccounts']=function(){var _0x240f1b=this;return function(_0x3f176f){if(_0x3f176f){freeIsNotKey(_0x3f176f,_0x240f1b['mailAccounts'],'id');for(var _0x299b5f=0x0,_0x118332={},_0xb3a5cd={};_0x299b5f<_0x3f176f[_0xf338('0x5')];_0x299b5f+=0x1){_0x118332=_0x3f176f[_0x299b5f];if(_[_0xf338('0x6')](_0x240f1b['mailAccounts'][_0x118332['id']])){_0x240f1b[_0xf338('0x2')][_0x118332['id']]=new MailAccount(_0x118332);}else{_[_0xf338('0x7')](_0x240f1b[_0xf338('0x2')][_0x118332['id']],_0x118332);}}}return _0x240f1b[_0xf338('0x2')];};};module[_0xf338('0x8')]=Realtime; \ No newline at end of file +var _0x3ca6=['isUndefined','merge','exports','lodash','mailAccounts','prototype','initMailAccounts','length'];(function(_0x1b2872,_0x269f38){var _0x4fb2fa=function(_0x5b5f08){while(--_0x5b5f08){_0x1b2872['push'](_0x1b2872['shift']());}};_0x4fb2fa(++_0x269f38);}(_0x3ca6,0x143));var _0x63ca=function(_0x4c03f9,_0x22d71f){_0x4c03f9=_0x4c03f9-0x0;var _0x2ad02b=_0x3ca6[_0x4c03f9];return _0x2ad02b;};'use strict';var _=require(_0x63ca('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x63ca('0x1')]={};};function freeIsNotKey(_0x2ea9dd,_0x52919a,_0x17eb7f){var _0x327fba=_['mapKeys'](_0x2ea9dd,function(_0x504dff,_0x327510){return _0x504dff[_0x17eb7f];});for(var _0x2dd344 in _0x52919a){if(_0x52919a['hasOwnProperty'](_0x2dd344)){if(!_0x327fba[_0x2dd344]){delete _0x52919a[_0x2dd344];}}}}Realtime[_0x63ca('0x2')]['mergeFromDatabase']=function(_0x486c68,_0x44ec28){for(var _0x150924 in _0x44ec28){if(_0x486c68['hasOwnProperty'](_0x150924)){_0x486c68[_0x150924]=_0x44ec28[_0x150924];}}};Realtime['prototype'][_0x63ca('0x3')]=function(){var _0x400bdd=this;return function(_0x1555c3){if(_0x1555c3){freeIsNotKey(_0x1555c3,_0x400bdd[_0x63ca('0x1')],'id');for(var _0x39656d=0x0,_0x17eba1={},_0x4b8a61={};_0x39656d<_0x1555c3[_0x63ca('0x4')];_0x39656d+=0x1){_0x17eba1=_0x1555c3[_0x39656d];if(_[_0x63ca('0x5')](_0x400bdd[_0x63ca('0x1')][_0x17eba1['id']])){_0x400bdd['mailAccounts'][_0x17eba1['id']]=new MailAccount(_0x17eba1);}else{_[_0x63ca('0x6')](_0x400bdd[_0x63ca('0x1')][_0x17eba1['id']],_0x17eba1);}}}return _0x400bdd[_0x63ca('0x1')];};};module[_0x63ca('0x7')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 7d4ea0c..c26d200 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 _0xea1c=['GetMailAccount','name','provider','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','service','type','MailServerOut','Smtp','data5','getMailAccount','notify','NotifyMailAccount','Request'];(function(_0x1c7ad0,_0x448315){var _0x27314b=function(_0x49bd56){while(--_0x49bd56){_0x1c7ad0['push'](_0x1c7ad0['shift']());}};_0x27314b(++_0x448315);}(_0xea1c,0x117));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0xcea1('0x0')](_0xcea1('0x1'),{'options':{'attributes':['id',_0xcea1('0x2'),_0xcea1('0x3'),'service',_0xcea1('0x4'),_0xcea1('0x5'),_0xcea1('0x6'),_0xcea1('0x7'),_0xcea1('0x8')],'raw':![],'include':[{'model':_0xcea1('0x9'),'as':_0xcea1('0xa'),'include':[{'model':_0xcea1('0xb'),'attributes':['id',_0xcea1('0x2'),_0xcea1('0xc'),_0xcea1('0xd'),'data5'],'as':_0xcea1('0xb')}]},{'model':_0xcea1('0xe'),'as':_0xcea1('0xf'),'include':[{'model':'CloudProvider','attributes':['id',_0xcea1('0x2'),_0xcea1('0xc'),_0xcea1('0xd'),_0xcea1('0x10')],'as':_0xcea1('0xb')}]}]},'log':_0xcea1('0x11')});};};exports[_0xcea1('0x12')]=function(_0x264a05,_0x33370a){return client[_0xcea1('0x0')](_0xcea1('0x13'),{'account':{'id':_0x264a05},'body':_0x33370a,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x8c7a=['service','type','MailServerOut','Smtp','data5','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','active','key','ListId','TemplateId','Imap','CloudProvider'];(function(_0x2803dc,_0x1cdaf1){var _0x552ae4=function(_0x15f1ef){while(--_0x15f1ef){_0x2803dc['push'](_0x2803dc['shift']());}};_0x552ae4(++_0x1cdaf1);}(_0x8c7a,0x197));var _0xa8c7=function(_0x3a5cbb,_0x40b878){_0x3a5cbb=_0x3a5cbb-0x0;var _0x4acb5c=_0x8c7a[_0x3a5cbb];return _0x4acb5c;};'use strict';var client=require(_0xa8c7('0x0'));exports[_0xa8c7('0x1')]=function(){return function(){return client[_0xa8c7('0x2')](_0xa8c7('0x3'),{'options':{'attributes':['id',_0xa8c7('0x4'),'provider','service','email',_0xa8c7('0x5'),_0xa8c7('0x6'),_0xa8c7('0x7'),_0xa8c7('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0xa8c7('0x9'),'include':[{'model':_0xa8c7('0xa'),'attributes':['id',_0xa8c7('0x4'),_0xa8c7('0xb'),_0xa8c7('0xc'),'data5'],'as':_0xa8c7('0xa')}]},{'model':_0xa8c7('0xd'),'as':_0xa8c7('0xe'),'include':[{'model':_0xa8c7('0xa'),'attributes':['id',_0xa8c7('0x4'),_0xa8c7('0xb'),_0xa8c7('0xc'),_0xa8c7('0xf')],'as':_0xa8c7('0xa')}]}]},'log':_0xa8c7('0x10')});};};exports[_0xa8c7('0x11')]=function(_0x2d92ab,_0x4dd19b){return client[_0xa8c7('0x2')]('NotifyMailAccount',{'account':{'id':_0x2d92ab},'body':_0x4dd19b,'log':_0xa8c7('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 3f2ac5f..f53aba8 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 _0xb48f=['../client','Request','ShowSetting','GetSettings'];(function(_0x9ef61e,_0x2837d9){var _0x1fc375=function(_0x213a35){while(--_0x213a35){_0x9ef61e['push'](_0x9ef61e['shift']());}};_0x1fc375(++_0x2837d9);}(_0xb48f,0x84));var _0xfb48=function(_0x169d18,_0x4bb3dd){_0x169d18=_0x169d18-0x0;var _0x37fe3c=_0xb48f[_0x169d18];return _0x37fe3c;};'use strict';var client=require(_0xfb48('0x0'));exports['getSettings']=function(){return client[_0xfb48('0x1')](_0xfb48('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xfb48('0x3')});}; \ No newline at end of file +var _0x08bb=['ShowSetting','../client','getSettings','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x08bb,0x1ad));var _0xb08b=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x08bb[_0x36c5b0];return _0xf19333;};'use strict';var client=require(_0xb08b('0x0'));exports[_0xb08b('0x1')]=function(){return client[_0xb08b('0x2')](_0xb08b('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'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 b57fc39..bdfdbcb 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 d3183dc..d548b8e 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 _0xd36b=['../../config/socketio','../../config/express','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','lodash','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','redis','defaults','localhost','adapter','../../config/triggers','default'];(function(_0x57a223,_0x2d8610){var _0x163e9c=function(_0x15dcd){while(--_0x15dcd){_0x57a223['push'](_0x57a223['shift']());}};_0x163e9c(++_0x2d8610);}(_0xd36b,0xee));var _0xbd36=function(_0x1dd3eb,_0x2c6371){_0x1dd3eb=_0x1dd3eb-0x0;var _0x3c937f=_0xd36b[_0x1dd3eb];return _0x3c937f;};'use strict';var _=require(_0xbd36('0x0'));var http=require('http');var express=require(_0xbd36('0x1'));var sticky=require(_0xbd36('0x2'));var Redis=require(_0xbd36('0x3'));var config=require(_0xbd36('0x4'));var app=express();var server=http[_0xbd36('0x5')](app);server[_0xbd36('0x6')]=0xdbba0;if(sticky[_0xbd36('0x7')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':['websocket','polling']});config[_0xbd36('0x8')]=_[_0xbd36('0x9')](config[_0xbd36('0x8')],{'host':_0xbd36('0xa'),'port':0x18eb});socketio[_0xbd36('0xb')](require('socket.io-redis')({'pubClient':new Redis(config[_0xbd36('0x8')]),'subClient':new Redis(config[_0xbd36('0x8')])}));require(_0xbd36('0xc'))[_0xbd36('0xd')]();require(_0xbd36('0xe'))['default'](socketio);require(_0xbd36('0xf'))['default'](app);require(_0xbd36('0x10'))[_0xbd36('0xd')](app);}else{server['once'](_0xbd36('0x11'),function(){console[_0xbd36('0x12')](_0xbd36('0x13'),config[_0xbd36('0x14')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xd15c=['listen','port','websocket','redis','defaults','adapter','../../config/triggers','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd15c,0x12d));var _0xcd15=function(_0x103229,_0x520da1){_0x103229=_0x103229-0x0;var _0x511b30=_0xd15c[_0x103229];return _0x511b30;};'use strict';var _=require('lodash');var http=require(_0xcd15('0x0'));var express=require(_0xcd15('0x1'));var sticky=require(_0xcd15('0x2'));var Redis=require(_0xcd15('0x3'));var config=require(_0xcd15('0x4'));var app=express();var server=http[_0xcd15('0x5')](app);server[_0xcd15('0x6')]=0xdbba0;if(sticky[_0xcd15('0x7')](server,config[_0xcd15('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0xcd15('0x9'),'polling']});config[_0xcd15('0xa')]=_[_0xcd15('0xb')](config[_0xcd15('0xa')],{'host':'localhost','port':0x18eb});socketio[_0xcd15('0xc')](require('socket.io-redis')({'pubClient':new Redis(config[_0xcd15('0xa')]),'subClient':new Redis(config[_0xcd15('0xa')])}));require(_0xcd15('0xd'))['default']();require('../../config/socketio')[_0xcd15('0xe')](socketio);require(_0xcd15('0xf'))[_0xcd15('0xe')](app);require(_0xcd15('0x10'))[_0xcd15('0xe')](app);}else{server[_0xcd15('0x11')](_0xcd15('0x12'),function(){console[_0xcd15('0x13')](_0xcd15('0x14'),config['port']);});}exports=module[_0xcd15('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index ac4a056..5c0741a 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 _0x8b1d=['Request','then','debug','rpc','routing','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x1c4da3,_0x4d3970){var _0x365b1c=function(_0x51733b){while(--_0x51733b){_0x1c4da3['push'](_0x1c4da3['shift']());}};_0x365b1c(++_0x4d3970);}(_0x8b1d,0xcd));var _0xd8b1=function(_0x361a15,_0x58bedd){_0x361a15=_0x361a15-0x0;var _0x3548f5=_0x8b1d[_0x361a15];return _0x3548f5;};'use strict';var jayson=require(_0xd8b1('0x0'));var BPromise=require(_0xd8b1('0x1'));var logger=require(_0xd8b1('0x2'))('routing');var client=jayson['client']['http']({'port':0x2329});client[_0xd8b1('0x3')]=function(_0x56c9b7,_0x6183c2){return new BPromise(function(_0x26331d,_0x20cd78){return client['request'](_0x56c9b7,_0x6183c2)[_0xd8b1('0x4')](function(_0x585624){logger[_0xd8b1('0x5')](_0xd8b1('0x6'),_0xd8b1('0x7'),_0x56c9b7,_0x6183c2,_0x585624);if(_0x585624['error']){logger[_0xd8b1('0x8')](_0xd8b1('0x6'),_0xd8b1('0x7'),_0x56c9b7,_0x585624[_0xd8b1('0x8')]['message'],_0x6183c2);return _0x20cd78(_0x585624[_0xd8b1('0x8')][_0xd8b1('0x9')]);}else{return _0x26331d(_0x585624[_0xd8b1('0xa')]);}})[_0xd8b1('0xb')](function(_0x4b9617){logger['error']('rpc',_0xd8b1('0x7'),_0x56c9b7,_0x4b9617,_0x6183c2);return _0x20cd78(_0x4b9617);});});};module[_0xd8b1('0xc')]=client; \ No newline at end of file +var _0xa53b=['jayson/promise','bluebird','../../config/logger','routing','client','http','request','then','debug','rpc','error','message','result','catch','exports'];(function(_0x615361,_0x4566eb){var _0x286404=function(_0x45ff69){while(--_0x45ff69){_0x615361['push'](_0x615361['shift']());}};_0x286404(++_0x4566eb);}(_0xa53b,0x1c2));var _0xba53=function(_0x394dd2,_0x41d78a){_0x394dd2=_0x394dd2-0x0;var _0x5a46d4=_0xa53b[_0x394dd2];return _0x5a46d4;};'use strict';var jayson=require(_0xba53('0x0'));var BPromise=require(_0xba53('0x1'));var logger=require(_0xba53('0x2'))(_0xba53('0x3'));var client=jayson[_0xba53('0x4')][_0xba53('0x5')]({'port':0x2329});client['Request']=function(_0xefd11c,_0x1a7acf){return new BPromise(function(_0x2a9a7e,_0x3a1193){return client[_0xba53('0x6')](_0xefd11c,_0x1a7acf)[_0xba53('0x7')](function(_0x314854){logger[_0xba53('0x8')]('rpc','routing',_0xefd11c,_0x1a7acf,_0x314854);if(_0x314854['error']){logger['error'](_0xba53('0x9'),_0xba53('0x3'),_0xefd11c,_0x314854[_0xba53('0xa')][_0xba53('0xb')],_0x1a7acf);return _0x3a1193(_0x314854[_0xba53('0xa')][_0xba53('0xb')]);}else{return _0x2a9a7e(_0x314854[_0xba53('0xc')]);}})[_0xba53('0xd')](function(_0x420407){logger['error'](_0xba53('0x9'),_0xba53('0x3'),_0xefd11c,_0x420407,_0x1a7acf);return _0x3a1193(_0x420407);});});};module[_0xba53('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 269ee11..731b8ac 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 _0xad09=['initSmsQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues'];(function(_0x510b15,_0x479bdb){var _0x3ec2f3=function(_0x2f13de){while(--_0x2f13de){_0x510b15['push'](_0x510b15['shift']());}};_0x3ec2f3(++_0x479bdb);}(_0xad09,0x148));var _0x9ad0=function(_0x197191,_0x412830){_0x197191=_0x197191-0x0;var _0x15d150=_0xad09[_0x197191];return _0x15d150;};'use strict';var BPromise=require(_0x9ad0('0x0'));var server=require(_0x9ad0('0x1'));var Realtime=require(_0x9ad0('0x2'));var user=require(_0x9ad0('0x3'));var interval=require(_0x9ad0('0x4'));var openchannelQueue=require(_0x9ad0('0x5'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x9ad0('0x6'));var mailQueue=require(_0x9ad0('0x7'));var faxQueue=require(_0x9ad0('0x8'));var whatsappQueue=require(_0x9ad0('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x9ad0('0xa')](user[_0x9ad0('0xb')]())[_0x9ad0('0xa')](realtime['initAgents']())['then'](interval[_0x9ad0('0xc')]())[_0x9ad0('0xa')](realtime['initIntervals']())[_0x9ad0('0xa')](openchannelQueue[_0x9ad0('0xd')]())[_0x9ad0('0xa')](realtime[_0x9ad0('0xe')]())[_0x9ad0('0xa')](chatQueue[_0x9ad0('0xf')]())[_0x9ad0('0xa')](realtime[_0x9ad0('0x10')]())[_0x9ad0('0xa')](smsQueue['getSmsQueues']())[_0x9ad0('0xa')](realtime[_0x9ad0('0x11')]())[_0x9ad0('0xa')](mailQueue['getMailQueues']())[_0x9ad0('0xa')](realtime[_0x9ad0('0x12')]())[_0x9ad0('0xa')](faxQueue[_0x9ad0('0x13')]())['then'](realtime['initFaxQueues']())[_0x9ad0('0xa')](whatsappQueue[_0x9ad0('0x14')]())[_0x9ad0('0xa')](realtime[_0x9ad0('0x15')]())[_0x9ad0('0xa')](function(){return realtime;});}function main(){return server[_0x9ad0('0x16')](realtime)[_0x9ad0('0xa')](function(_0x4993f8){return initRealtime();})[_0x9ad0('0xa')](function(_0x2ad0af){return setInterval(initRealtime,0x1388);})['catch'](function(_0x394434){console['log'](_0x394434);});}main(); \ No newline at end of file +var _0xdd54=['./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue'];(function(_0xf136bc,_0x4cb677){var _0x447aa6=function(_0x5c6f9b){while(--_0x5c6f9b){_0xf136bc['push'](_0xf136bc['shift']());}};_0x447aa6(++_0x4cb677);}(_0xdd54,0x1cc));var _0x4dd5=function(_0x3452ce,_0x124927){_0x3452ce=_0x3452ce-0x0;var _0xee20c5=_0xdd54[_0x3452ce];return _0xee20c5;};'use strict';var BPromise=require(_0x4dd5('0x0'));var server=require(_0x4dd5('0x1'));var Realtime=require(_0x4dd5('0x2'));var user=require(_0x4dd5('0x3'));var interval=require(_0x4dd5('0x4'));var openchannelQueue=require(_0x4dd5('0x5'));var chatQueue=require(_0x4dd5('0x6'));var smsQueue=require(_0x4dd5('0x7'));var mailQueue=require(_0x4dd5('0x8'));var faxQueue=require(_0x4dd5('0x9'));var whatsappQueue=require(_0x4dd5('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x4dd5('0xb')]()[_0x4dd5('0xc')](user[_0x4dd5('0xd')]())[_0x4dd5('0xc')](realtime[_0x4dd5('0xe')]())[_0x4dd5('0xc')](interval[_0x4dd5('0xf')]())[_0x4dd5('0xc')](realtime[_0x4dd5('0x10')]())[_0x4dd5('0xc')](openchannelQueue[_0x4dd5('0x11')]())[_0x4dd5('0xc')](realtime[_0x4dd5('0x12')]())[_0x4dd5('0xc')](chatQueue[_0x4dd5('0x13')]())['then'](realtime[_0x4dd5('0x14')]())['then'](smsQueue[_0x4dd5('0x15')]())['then'](realtime[_0x4dd5('0x16')]())[_0x4dd5('0xc')](mailQueue[_0x4dd5('0x17')]())[_0x4dd5('0xc')](realtime['initMailQueues']())[_0x4dd5('0xc')](faxQueue['getFaxQueues']())['then'](realtime['initFaxQueues']())[_0x4dd5('0xc')](whatsappQueue['getWhatsappQueues']())[_0x4dd5('0xc')](realtime['initWhatsappQueues']())[_0x4dd5('0xc')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x4dd5('0xc')](function(_0x4dd6c1){return initRealtime();})['then'](function(_0x29b710){return setInterval(initRealtime,0x1388);})[_0x4dd5('0x18')](function(_0x34a8a5){console[_0x4dd5('0x19')](_0x34a8a5);});}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 b14dd6f..e2d15a3 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 _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x43efcc,_0x4ae4ac){var _0x5ad164=function(_0x59055b){while(--_0x59055b){_0x43efcc['push'](_0x43efcc['shift']());}};_0x5ad164(++_0x4ae4ac);}(_0xe14b,0x93));var _0xbe14=function(_0x5376c6,_0xba32d2){_0x5376c6=_0x5376c6-0x0;var _0x3f923b=_0xe14b[_0x5376c6];return _0x3f923b;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x55e7a3,_0x2be8c9){var _0x9eac71=function(_0x32e2cc){while(--_0x32e2cc){_0x55e7a3['push'](_0x55e7a3['shift']());}};_0x9eac71(++_0x2be8c9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc4aa[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index f5754e9..2171126 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 _0x5ef9=['request','then','error','message','result','catch','sendMailMessage','SendMail','jayson/promise','client'];(function(_0x5c9f56,_0x42c9ad){var _0x2a726b=function(_0x4a13cd){while(--_0x4a13cd){_0x5c9f56['push'](_0x5c9f56['shift']());}};_0x2a726b(++_0x42c9ad);}(_0x5ef9,0x120));var _0x95ef=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x5ef9[_0x4ed520];return _0x4415a6;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x95ef('0x0'));var client=jayson[_0x95ef('0x1')]['http']({'port':0x232b});function request(_0x26a23f,_0x13f824){return new BPromise(function(_0x48bec9,_0x5f408a){return client[_0x95ef('0x2')](_0x26a23f,_0x13f824)[_0x95ef('0x3')](function(_0x49a922){if(_0x49a922[_0x95ef('0x4')]){return _0x5f408a(_0x49a922[_0x95ef('0x4')][_0x95ef('0x5')]);}else{return _0x48bec9(_0x49a922[_0x95ef('0x6')]);}})[_0x95ef('0x7')](function(_0x2b76e1){return _0x5f408a(_0x2b76e1);});});}exports[_0x95ef('0x8')]=function(_0x13af4a,_0x364489){return request(_0x95ef('0x9'),{'account':_0x13af4a,'message':_0x364489});}; \ No newline at end of file +var _0xd567=['sendMailMessage','SendMail','http','then','error','result','catch'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xd567,0x9c));var _0x7d56=function(_0xf1499f,_0x4142c1){_0xf1499f=_0xf1499f-0x0;var _0x3321b2=_0xd567[_0xf1499f];return _0x3321b2;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson['client'][_0x7d56('0x0')]({'port':0x232b});function request(_0x24be93,_0x573d9e){return new BPromise(function(_0x5605ad,_0x1c3151){return client['request'](_0x24be93,_0x573d9e)[_0x7d56('0x1')](function(_0x47d6fb){if(_0x47d6fb[_0x7d56('0x2')]){return _0x1c3151(_0x47d6fb['error']['message']);}else{return _0x5605ad(_0x47d6fb[_0x7d56('0x3')]);}})[_0x7d56('0x4')](function(_0x3c4643){return _0x1c3151(_0x3c4643);});});}exports[_0x7d56('0x5')]=function(_0x295bbd,_0x2714c3){return request(_0x7d56('0x6'),{'account':_0x295bbd,'message':_0x2714c3});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 77a3dda..f970552 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 _0x7bd0=['faxCurrentCapacity','emit','user:routing:update','omit','exports','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','getChannelStatus','Status','toNumber','format','mailStatusTime'];(function(_0x263721,_0x10ce8e){var _0x5d503b=function(_0x10972a){while(--_0x10972a){_0x263721['push'](_0x263721['shift']());}};_0x5d503b(++_0x10ce8e);}(_0x7bd0,0x111));var _0x07bd=function(_0x1a4a06,_0x36a5c2){_0x1a4a06=_0x1a4a06-0x0;var _0x49ec08=_0x7bd0[_0x1a4a06];return _0x49ec08;};'use strict';var _=require(_0x07bd('0x0'));var md5=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var Redis=require(_0x07bd('0x3'));var config=require(_0x07bd('0x4'));config[_0x07bd('0x5')]=_[_0x07bd('0x6')](config[_0x07bd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x07bd('0x7'))(new Redis(config[_0x07bd('0x5')]));function Agent(_0x38f3f1){this['id']=_0x38f3f1['id']||0x0;this[_0x07bd('0x8')]=_0x38f3f1[_0x07bd('0x8')]||'';this[_0x07bd('0x9')]=_0x38f3f1[_0x07bd('0x9')]||!![];this['voicePause']=_0x38f3f1[_0x07bd('0xa')]||![];this['chatPause']=_0x38f3f1[_0x07bd('0xb')]||![];this[_0x07bd('0xc')]=_0x38f3f1[_0x07bd('0xc')]||![];this['faxPause']=_0x38f3f1[_0x07bd('0xd')]||![];this[_0x07bd('0xe')]=_0x38f3f1[_0x07bd('0xe')]||![];this[_0x07bd('0xf')]=_0x38f3f1['openchannelPause']||![];this[_0x07bd('0x10')]=_0x07bd('0x11');this[_0x07bd('0x12')]=0x0;this[_0x07bd('0x13')]=_0x38f3f1[_0x07bd('0x13')]||0x0;this[_0x07bd('0x14')]=0x0;this[_0x07bd('0x15')]=_0x07bd('0x11');this['mailStatusTime']=0x0;this['mailCapacity']=_0x38f3f1[_0x07bd('0x16')]||0x0;this[_0x07bd('0x17')]=0x0;this[_0x07bd('0x18')]=_0x07bd('0x11');this[_0x07bd('0x19')]=0x0;this[_0x07bd('0x1a')]=_0x38f3f1[_0x07bd('0x1a')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x07bd('0x1b')]='unknown';this[_0x07bd('0x1c')]=0x0;this[_0x07bd('0x1d')]=_0x38f3f1[_0x07bd('0x1d')]||0x0;this[_0x07bd('0x1e')]=0x0;this[_0x07bd('0x1f')]='unknown';this[_0x07bd('0x20')]=0x0;this[_0x07bd('0x21')]=_0x38f3f1['whatsappCapacity']||0x0;this[_0x07bd('0x22')]=0x0;this[_0x07bd('0x23')]=_0x07bd('0x11');this[_0x07bd('0x24')]=0x0;this[_0x07bd('0x25')]=_0x38f3f1[_0x07bd('0x25')]||0x0;this[_0x07bd('0x26')]=0x0;this[_0x07bd('0x27')]=![];this[_0x07bd('0x28')]=undefined;this['md5']='';this[_0x07bd('0x29')]={};this[_0x07bd('0x2a')]={};this[_0x07bd('0x2b')]={};this[_0x07bd('0x2c')]={};this[_0x07bd('0x2d')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0x07bd('0x2e')]['getChannelStatus']=function(_0x2b0dee){if(this[_0x2b0dee+'CurrentCapacity']>0x0){if(this[_0x2b0dee+'Capacity']>0x0&&this[_0x2b0dee+_0x07bd('0x2f')]>=this[_0x2b0dee+_0x07bd('0x30')]){return _0x07bd('0x31');}else{return _0x07bd('0x32');}}else{return _0x07bd('0x33');}};Agent[_0x07bd('0x2e')]['updateRealtime']=function(){var _0x180b43=[_0x07bd('0x34'),_0x07bd('0x35'),_0x07bd('0x36'),_0x07bd('0x37'),_0x07bd('0x38'),'whatsapp'];for(var _0x56687f=0x0;_0x56687f<_0x180b43['length'];_0x56687f+=0x1){var _0x335d61=this[_0x07bd('0x39')](_0x180b43[_0x56687f]);if(this[_0x180b43[_0x56687f]+_0x07bd('0x3a')]!==_0x335d61){this[_0x180b43[_0x56687f]+'StatusTime']=_[_0x07bd('0x3b')](moment()[_0x07bd('0x3c')]('x'));}this[_0x180b43[_0x56687f]+_0x07bd('0x3a')]=_0x335d61;}var _0x46ed12={'id':this['id'],'name':this[_0x07bd('0x8')],'online':this[_0x07bd('0x9')],'voicePause':this['voicePause'],'chatPause':this[_0x07bd('0xb')],'mailPause':this[_0x07bd('0xc')],'smsPause':this[_0x07bd('0xe')],'faxPause':this[_0x07bd('0xd')],'openchannelPause':this[_0x07bd('0xf')],'chatStatus':this[_0x07bd('0x10')],'chatStatusTime':this[_0x07bd('0x12')],'chatCapacity':this[_0x07bd('0x13')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x07bd('0x3d')],'mailCapacity':this[_0x07bd('0x16')],'mailCurrentCapacity':this[_0x07bd('0x17')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x07bd('0x19')],'faxCapacity':this[_0x07bd('0x1a')],'faxCurrentCapacity':this[_0x07bd('0x3e')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x07bd('0x1d')],'smsCurrentCapacity':this[_0x07bd('0x1e')],'whatsappStatus':this[_0x07bd('0x1f')],'whatsappStatusTime':this[_0x07bd('0x20')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x07bd('0x22')],'openchannelStatus':this[_0x07bd('0x23')],'openchannelStatusTime':this[_0x07bd('0x24')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x07bd('0x26')],'busy':this[_0x07bd('0x27')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x07bd('0x29')],'faxWaitingInteractions':this[_0x07bd('0x2a')],'mailWaitingInteractions':this[_0x07bd('0x2b')],'openchannelWaitingInteractions':this[_0x07bd('0x2c')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x290e0f=md5(JSON['stringify'](_0x46ed12));if(this[_0x07bd('0x1')]!==_0x290e0f){this[_0x07bd('0x1')]=_0x290e0f;io[_0x07bd('0x3f')](_0x07bd('0x40'),_[_0x07bd('0x41')](_0x46ed12,[_0x07bd('0x9')]));}};module[_0x07bd('0x42')]=Agent; \ No newline at end of file +var _0x5f2f=['mailPause','faxPause','smsPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','working','idle','prototype','mail','chat','openchannel','fax','whatsapp','length','Status','format','chatStatusTime','busyQueue','faxWaitingInteractions','stringify','user:routing:update','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','name','online','voicePause','chatPause'];(function(_0x1ba5de,_0x110bf0){var _0x239919=function(_0x58df9b){while(--_0x58df9b){_0x1ba5de['push'](_0x1ba5de['shift']());}};_0x239919(++_0x110bf0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1e72d3,_0xf9bb07){_0x1e72d3=_0x1e72d3-0x0;var _0x5643b7=_0x5f2f[_0x1e72d3];return _0x5643b7;};'use strict';var _=require(_0xf5f2('0x0'));var md5=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var Redis=require(_0xf5f2('0x3'));var config=require(_0xf5f2('0x4'));config[_0xf5f2('0x5')]=_[_0xf5f2('0x6')](config[_0xf5f2('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf5f2('0x5')]));function Agent(_0x192215){this['id']=_0x192215['id']||0x0;this[_0xf5f2('0x7')]=_0x192215[_0xf5f2('0x7')]||'';this[_0xf5f2('0x8')]=_0x192215[_0xf5f2('0x8')]||!![];this['voicePause']=_0x192215[_0xf5f2('0x9')]||![];this[_0xf5f2('0xa')]=_0x192215[_0xf5f2('0xa')]||![];this['mailPause']=_0x192215[_0xf5f2('0xb')]||![];this[_0xf5f2('0xc')]=_0x192215[_0xf5f2('0xc')]||![];this['smsPause']=_0x192215[_0xf5f2('0xd')]||![];this['openchannelPause']=_0x192215['openchannelPause']||![];this[_0xf5f2('0xe')]=_0xf5f2('0xf');this['chatStatusTime']=0x0;this[_0xf5f2('0x10')]=_0x192215[_0xf5f2('0x10')]||0x0;this[_0xf5f2('0x11')]=0x0;this[_0xf5f2('0x12')]=_0xf5f2('0xf');this[_0xf5f2('0x13')]=0x0;this['mailCapacity']=_0x192215[_0xf5f2('0x14')]||0x0;this[_0xf5f2('0x15')]=0x0;this[_0xf5f2('0x16')]=_0xf5f2('0xf');this[_0xf5f2('0x17')]=0x0;this['faxCapacity']=_0x192215[_0xf5f2('0x18')]||0x0;this[_0xf5f2('0x19')]=0x0;this[_0xf5f2('0x1a')]=_0xf5f2('0xf');this[_0xf5f2('0x1b')]=0x0;this[_0xf5f2('0x1c')]=_0x192215[_0xf5f2('0x1c')]||0x0;this[_0xf5f2('0x1d')]=0x0;this[_0xf5f2('0x1e')]=_0xf5f2('0xf');this[_0xf5f2('0x1f')]=0x0;this[_0xf5f2('0x20')]=_0x192215[_0xf5f2('0x20')]||0x0;this[_0xf5f2('0x21')]=0x0;this[_0xf5f2('0x22')]=_0xf5f2('0xf');this[_0xf5f2('0x23')]=0x0;this['openchannelCapacity']=_0x192215[_0xf5f2('0x24')]||0x0;this[_0xf5f2('0x25')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0xf5f2('0x1')]='';this[_0xf5f2('0x26')]={};this['faxWaitingInteractions']={};this[_0xf5f2('0x27')]={};this[_0xf5f2('0x28')]={};this[_0xf5f2('0x29')]={};this[_0xf5f2('0x2a')]={};this[_0xf5f2('0x2b')]();}Agent['prototype'][_0xf5f2('0x2c')]=function(_0x4669a6){if(this[_0x4669a6+_0xf5f2('0x2d')]>0x0){if(this[_0x4669a6+_0xf5f2('0x2e')]>0x0&&this[_0x4669a6+_0xf5f2('0x2d')]>=this[_0x4669a6+'Capacity']){return'maxcapacity';}else{return _0xf5f2('0x2f');}}else{return _0xf5f2('0x30');}};Agent[_0xf5f2('0x31')][_0xf5f2('0x2b')]=function(){var _0xf6c58d=[_0xf5f2('0x32'),_0xf5f2('0x33'),_0xf5f2('0x34'),_0xf5f2('0x35'),'sms',_0xf5f2('0x36')];for(var _0x102449=0x0;_0x102449<_0xf6c58d[_0xf5f2('0x37')];_0x102449+=0x1){var _0x31bfcb=this[_0xf5f2('0x2c')](_0xf6c58d[_0x102449]);if(this[_0xf6c58d[_0x102449]+_0xf5f2('0x38')]!==_0x31bfcb){this[_0xf6c58d[_0x102449]+'StatusTime']=_['toNumber'](moment()[_0xf5f2('0x39')]('x'));}this[_0xf6c58d[_0x102449]+_0xf5f2('0x38')]=_0x31bfcb;}var _0x11c771={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0xf5f2('0x9')],'chatPause':this[_0xf5f2('0xa')],'mailPause':this[_0xf5f2('0xb')],'smsPause':this[_0xf5f2('0xd')],'faxPause':this[_0xf5f2('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xf5f2('0x3a')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xf5f2('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xf5f2('0x13')],'mailCapacity':this[_0xf5f2('0x14')],'mailCurrentCapacity':this[_0xf5f2('0x15')],'faxStatus':this[_0xf5f2('0x16')],'faxStatusTime':this[_0xf5f2('0x17')],'faxCapacity':this[_0xf5f2('0x18')],'faxCurrentCapacity':this[_0xf5f2('0x19')],'smsStatus':this[_0xf5f2('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xf5f2('0x1c')],'smsCurrentCapacity':this[_0xf5f2('0x1d')],'whatsappStatus':this[_0xf5f2('0x1e')],'whatsappStatusTime':this[_0xf5f2('0x1f')],'whatsappCapacity':this[_0xf5f2('0x20')],'whatsappCurrentCapacity':this[_0xf5f2('0x21')],'openchannelStatus':this[_0xf5f2('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xf5f2('0x24')],'openchannelCurrentCapacity':this[_0xf5f2('0x25')],'busy':this['busy'],'busyQueue':this[_0xf5f2('0x3b')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xf5f2('0x3c')],'mailWaitingInteractions':this[_0xf5f2('0x27')],'openchannelWaitingInteractions':this[_0xf5f2('0x28')],'smsWaitingInteractions':this[_0xf5f2('0x29')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x5a98d7=md5(JSON[_0xf5f2('0x3d')](_0x11c771));if(this[_0xf5f2('0x1')]!==_0x5a98d7){this[_0xf5f2('0x1')]=_0x5a98d7;io['emit'](_0xf5f2('0x3e'),_['omit'](_0x11c771,[_0xf5f2('0x8')]));}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 829f5c0..141a445 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 _0x9ed2=['prototype','_rr','loggedIn','paused','length','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','localhost','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x2b7fa5,_0x569e9c){var _0x48acbb=function(_0x31f8ed){while(--_0x31f8ed){_0x2b7fa5['push'](_0x2b7fa5['shift']());}};_0x48acbb(++_0x569e9c);}(_0x9ed2,0xdf));var _0x29ed=function(_0x4be8ba,_0x5d10ba){_0x4be8ba=_0x4be8ba-0x0;var _0x1af822=_0x9ed2[_0x4be8ba];return _0x1af822;};'use strict';var _=require(_0x29ed('0x0'));var md5=require(_0x29ed('0x1'));var util=require(_0x29ed('0x2'));var Redis=require(_0x29ed('0x3'));var config=require(_0x29ed('0x4'));config['redis']=_[_0x29ed('0x5')](config['redis'],{'host':_0x29ed('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x29ed('0x7')]));function ChatQueue(_0x3a74b5){this['id']=_0x3a74b5['id']||0x0;this[_0x29ed('0x8')]=_0x3a74b5[_0x29ed('0x8')]||'';this[_0x29ed('0x9')]=_0x3a74b5[_0x29ed('0x9')]||0xa;this[_0x29ed('0xa')]=_0x3a74b5[_0x29ed('0xa')]||_0x29ed('0xb');this[_0x29ed('0xc')]=_0x3a74b5['Agents'];this[_0x29ed('0xd')]={};this[_0x29ed('0xe')]=0x0;this[_0x29ed('0x1')]='';this[_0x29ed('0xf')]();this[_0x29ed('0x10')]();}ChatQueue[_0x29ed('0x11')]['updateRouting']=function(){var _0xc652f1=this[_0x29ed('0xd')][_0x29ed('0x12')];this[_0x29ed('0xd')]=_['map'](this['Agents'],'id');this[_0x29ed('0xd')][_0x29ed('0x12')]=_0xc652f1;};ChatQueue['prototype']['updateRealtime']=function(){this[_0x29ed('0x13')]=0x0;this[_0x29ed('0x14')]=0x0;for(var _0x36a245=0x0;_0x36a245=0x0?this[_0x29ed('0x17')]:0x0;var _0x186759={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x29ed('0x8')],'paused':this[_0x29ed('0x14')],'waiting':this[_0x29ed('0xe')]};var _0x2f0e32=md5(JSON[_0x29ed('0x18')](_0x186759));if(this[_0x29ed('0x1')]!==_0x2f0e32){this[_0x29ed('0x1')]=_0x2f0e32;io['to'](util[_0x29ed('0x19')](_0x29ed('0x1a'),_0x186759[_0x29ed('0x8')]))[_0x29ed('0x1b')](_0x29ed('0x1c'),_0x186759);}};module[_0x29ed('0x1d')]=ChatQueue; \ No newline at end of file +var _0xe7bc=['available','waiting','stringify','chat:queue:%s','emit','chat_queue:save','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn'];(function(_0x403a8,_0x4474ea){var _0x2da522=function(_0x3e3f6f){while(--_0x3e3f6f){_0x403a8['push'](_0x403a8['shift']());}};_0x2da522(++_0x4474ea);}(_0xe7bc,0x18e));var _0xce7b=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xe7bc[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0xce7b('0x0'));var md5=require(_0xce7b('0x1'));var util=require('util');var Redis=require(_0xce7b('0x2'));var config=require(_0xce7b('0x3'));config['redis']=_[_0xce7b('0x4')](config[_0xce7b('0x5')],{'host':_0xce7b('0x6'),'port':0x18eb});var io=require(_0xce7b('0x7'))(new Redis(config[_0xce7b('0x5')]));function ChatQueue(_0x4eaace){this['id']=_0x4eaace['id']||0x0;this[_0xce7b('0x8')]=_0x4eaace['name']||'';this[_0xce7b('0x9')]=_0x4eaace['timeout']||0xa;this[_0xce7b('0xa')]=_0x4eaace['strategy']||'beepall';this[_0xce7b('0xb')]=_0x4eaace[_0xce7b('0xb')];this[_0xce7b('0xc')]={};this['waiting']=0x0;this[_0xce7b('0x1')]='';this[_0xce7b('0xd')]();this[_0xce7b('0xe')]();}ChatQueue[_0xce7b('0xf')]['updateRouting']=function(){var _0x2dac88=this['mapAgentsId'][_0xce7b('0x10')];this[_0xce7b('0xc')]=_[_0xce7b('0x11')](this[_0xce7b('0xb')],'id');this[_0xce7b('0xc')][_0xce7b('0x10')]=_0x2dac88;};ChatQueue[_0xce7b('0xf')][_0xce7b('0xe')]=function(){this['loggedIn']=0x0;this[_0xce7b('0x12')]=0x0;for(var _0x242adc=0x0;_0x242adc=0x0?this[_0xce7b('0x16')]:0x0;var _0x307bed={'id':this['id'],'available':this[_0xce7b('0x16')],'loggedIn':this[_0xce7b('0x15')],'name':this['name'],'paused':this[_0xce7b('0x12')],'waiting':this[_0xce7b('0x17')]};var _0xf18a50=md5(JSON[_0xce7b('0x18')](_0x307bed));if(this['md5']!==_0xf18a50){this[_0xce7b('0x1')]=_0xf18a50;io['to'](util['format'](_0xce7b('0x19'),_0x307bed[_0xce7b('0x8')]))[_0xce7b('0x1a')](_0xce7b('0x1b'),_0x307bed);}};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 5aa1ede..f32dccd 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 _0x041d=['stringify','format','fax:queue:%s','fax_queue:save','exports','lodash','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','faxPause','available'];(function(_0x459583,_0x28b662){var _0x4ff716=function(_0x1156b1){while(--_0x1156b1){_0x459583['push'](_0x459583['shift']());}};_0x4ff716(++_0x28b662);}(_0x041d,0x17e));var _0xd041=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x041d[_0x500419];return _0x241c1a;};'use strict';var _=require(_0xd041('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0xd041('0x1'));config[_0xd041('0x2')]=_[_0xd041('0x3')](config['redis'],{'host':_0xd041('0x4'),'port':0x18eb});var io=require(_0xd041('0x5'))(new Redis(config[_0xd041('0x2')]));function FaxQueue(_0x3e1707){this['id']=_0x3e1707['id']||0x0;this['name']=_0x3e1707[_0xd041('0x6')]||'';this['timeout']=_0x3e1707[_0xd041('0x7')]||0xa;this['strategy']=_0x3e1707[_0xd041('0x8')]||_0xd041('0x9');this['Agents']=_0x3e1707[_0xd041('0xa')];this[_0xd041('0xb')]={};this[_0xd041('0xc')]=0x0;this[_0xd041('0xd')]='';this[_0xd041('0xe')]();this[_0xd041('0xf')]();}FaxQueue[_0xd041('0x10')][_0xd041('0xe')]=function(){var _0x40b5c3=this['mapAgentsId'][_0xd041('0x11')];this['mapAgentsId']=_[_0xd041('0x12')](this[_0xd041('0xa')],'id');this['mapAgentsId'][_0xd041('0x11')]=_0x40b5c3;};FaxQueue[_0xd041('0x10')][_0xd041('0xf')]=function(){this[_0xd041('0x13')]=0x0;this[_0xd041('0x14')]=0x0;for(var _0x244e53=0x0;_0x244e53=0x0?this['available']:0x0;var _0x11af99={'id':this['id'],'available':this[_0xd041('0x17')],'loggedIn':this[_0xd041('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x3ea62d=md5(JSON[_0xd041('0x18')](_0x11af99));if(this[_0xd041('0xd')]!==_0x3ea62d){this[_0xd041('0xd')]=_0x3ea62d;io['to'](util[_0xd041('0x19')](_0xd041('0x1a'),_0x11af99[_0xd041('0x6')]))['emit'](_0xd041('0x1b'),_0x11af99);}};module[_0xd041('0x1c')]=FaxQueue; \ No newline at end of file +var _0x9f38=['updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','length','online','available','waiting','stringify','format','emit','fax_queue:save','exports','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting'];(function(_0x46b1c9,_0x169f87){var _0x17569c=function(_0x4b7c45){while(--_0x4b7c45){_0x46b1c9['push'](_0x46b1c9['shift']());}};_0x17569c(++_0x169f87);}(_0x9f38,0x189));var _0x89f3=function(_0xe91925,_0x3e5e5d){_0xe91925=_0xe91925-0x0;var _0x3c53fb=_0x9f38[_0xe91925];return _0x3c53fb;};'use strict';var _=require('lodash');var md5=require(_0x89f3('0x0'));var util=require('util');var Redis=require(_0x89f3('0x1'));var config=require(_0x89f3('0x2'));config['redis']=_['defaults'](config[_0x89f3('0x3')],{'host':_0x89f3('0x4'),'port':0x18eb});var io=require(_0x89f3('0x5'))(new Redis(config[_0x89f3('0x3')]));function FaxQueue(_0x20ef4f){this['id']=_0x20ef4f['id']||0x0;this[_0x89f3('0x6')]=_0x20ef4f['name']||'';this[_0x89f3('0x7')]=_0x20ef4f[_0x89f3('0x7')]||0xa;this[_0x89f3('0x8')]=_0x20ef4f[_0x89f3('0x8')]||_0x89f3('0x9');this[_0x89f3('0xa')]=_0x20ef4f[_0x89f3('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x89f3('0x0')]='';this[_0x89f3('0xb')]();this[_0x89f3('0xc')]();}FaxQueue[_0x89f3('0xd')][_0x89f3('0xb')]=function(){var _0x2562f0=this[_0x89f3('0xe')][_0x89f3('0xf')];this[_0x89f3('0xe')]=_['map'](this[_0x89f3('0xa')],'id');this[_0x89f3('0xe')][_0x89f3('0xf')]=_0x2562f0;};FaxQueue['prototype'][_0x89f3('0xc')]=function(){this[_0x89f3('0x10')]=0x0;this[_0x89f3('0x11')]=0x0;for(var _0xdfc69d=0x0;_0xdfc69d=0x0?this[_0x89f3('0x14')]:0x0;var _0x2dc423={'id':this['id'],'available':this[_0x89f3('0x14')],'loggedIn':this[_0x89f3('0x10')],'name':this[_0x89f3('0x6')],'paused':this[_0x89f3('0x11')],'waiting':this[_0x89f3('0x15')]};var _0x42ea12=md5(JSON[_0x89f3('0x16')](_0x2dc423));if(this[_0x89f3('0x0')]!==_0x42ea12){this[_0x89f3('0x0')]=_0x42ea12;io['to'](util[_0x89f3('0x17')]('fax:queue:%s',_0x2dc423[_0x89f3('0x6')]))[_0x89f3('0x18')](_0x89f3('0x19'),_0x2dc423);}};module[_0x89f3('0x1a')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 4052046..9c9ae5e 100644 --- a/server/services/routing/model/interval.js +++ b/server/services/routing/model/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07bd=['name','Intervals'];(function(_0x55cbf9,_0x38f1ec){var _0x582a5b=function(_0xd968f2){while(--_0xd968f2){_0x55cbf9['push'](_0x55cbf9['shift']());}};_0x582a5b(++_0x38f1ec);}(_0x07bd,0x156));var _0xd07b=function(_0x12716a,_0x32f2b8){_0x12716a=_0x12716a-0x0;var _0x19c86a=_0x07bd[_0x12716a];return _0x19c86a;};'use strict';function Interval(_0x21a7a1){this['id']=_0x21a7a1['id']||0x0;this[_0xd07b('0x0')]=_0x21a7a1[_0xd07b('0x0')]||'';this[_0xd07b('0x1')]=_0x21a7a1[_0xd07b('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x3cb2=['name','Intervals'];(function(_0x20178b,_0xc2bd0){var _0x4d4b10=function(_0x1d1451){while(--_0x1d1451){_0x20178b['push'](_0x20178b['shift']());}};_0x4d4b10(++_0xc2bd0);}(_0x3cb2,0x92));var _0x23cb=function(_0x26b5af,_0x38291e){_0x26b5af=_0x26b5af-0x0;var _0x13dad4=_0x3cb2[_0x26b5af];return _0x13dad4;};'use strict';function Interval(_0x340f94){this['id']=_0x340f94['id']||0x0;this[_0x23cb('0x0')]=_0x340f94[_0x23cb('0x0')]||'';this[_0x23cb('0x1')]=_0x340f94[_0x23cb('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index e312756..e375934 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 _0x1629=['loggedIn','length','online','mailPause','paused','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x58fae5,_0xea34ed){var _0x2c5345=function(_0x16879f){while(--_0x16879f){_0x58fae5['push'](_0x58fae5['shift']());}};_0x2c5345(++_0xea34ed);}(_0x1629,0x14b));var _0x9162=function(_0xd445cc,_0x406dd4){_0xd445cc=_0xd445cc-0x0;var _0x5b3ce0=_0x1629[_0xd445cc];return _0x5b3ce0;};'use strict';var _=require(_0x9162('0x0'));var md5=require(_0x9162('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x9162('0x2'));config[_0x9162('0x3')]=_['defaults'](config[_0x9162('0x3')],{'host':_0x9162('0x4'),'port':0x18eb});var io=require(_0x9162('0x5'))(new Redis(config[_0x9162('0x3')]));function MailQueue(_0x3b4216){this['id']=_0x3b4216['id']||0x0;this[_0x9162('0x6')]=_0x3b4216[_0x9162('0x6')]||'';this['timeout']=_0x3b4216['timeout']||0xa;this['strategy']=_0x3b4216[_0x9162('0x7')]||_0x9162('0x8');this[_0x9162('0x9')]=_0x3b4216[_0x9162('0x9')];this[_0x9162('0xa')]={};this[_0x9162('0xb')]=0x0;this[_0x9162('0x1')]='';this[_0x9162('0xc')]();this[_0x9162('0xd')]();}MailQueue[_0x9162('0xe')]['updateRouting']=function(){var _0x4cf2a8=this[_0x9162('0xa')][_0x9162('0xf')];this[_0x9162('0xa')]=_[_0x9162('0x10')](this['Agents'],'id');this[_0x9162('0xa')][_0x9162('0xf')]=_0x4cf2a8;};MailQueue[_0x9162('0xe')][_0x9162('0xd')]=function(){this[_0x9162('0x11')]=0x0;this['paused']=0x0;for(var _0x55585b=0x0;_0x55585b=0x0?this[_0x9162('0x16')]:0x0;var _0x42ddf6={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9162('0x11')],'name':this['name'],'paused':this[_0x9162('0x15')],'waiting':this[_0x9162('0xb')]};var _0x11edcd=md5(JSON[_0x9162('0x17')](_0x42ddf6));if(this[_0x9162('0x1')]!==_0x11edcd){this[_0x9162('0x1')]=_0x11edcd;io['to'](util[_0x9162('0x18')](_0x9162('0x19'),_0x42ddf6[_0x9162('0x6')]))[_0x9162('0x1a')](_0x9162('0x1b'),_0x42ddf6);}};module[_0x9162('0x1c')]=MailQueue; \ No newline at end of file +var _0xf05e=['online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length'];(function(_0x38517a,_0x35cc24){var _0x31fdd5=function(_0x14c9c3){while(--_0x14c9c3){_0x38517a['push'](_0x38517a['shift']());}};_0x31fdd5(++_0x35cc24);}(_0xf05e,0x69));var _0xef05=function(_0x116287,_0x237cc7){_0x116287=_0x116287-0x0;var _0x541467=_0xf05e[_0x116287];return _0x541467;};'use strict';var _=require(_0xef05('0x0'));var md5=require(_0xef05('0x1'));var util=require(_0xef05('0x2'));var Redis=require(_0xef05('0x3'));var config=require(_0xef05('0x4'));config[_0xef05('0x5')]=_['defaults'](config[_0xef05('0x5')],{'host':_0xef05('0x6'),'port':0x18eb});var io=require(_0xef05('0x7'))(new Redis(config[_0xef05('0x5')]));function MailQueue(_0x4a4db2){this['id']=_0x4a4db2['id']||0x0;this[_0xef05('0x8')]=_0x4a4db2['name']||'';this[_0xef05('0x9')]=_0x4a4db2[_0xef05('0x9')]||0xa;this['strategy']=_0x4a4db2[_0xef05('0xa')]||_0xef05('0xb');this[_0xef05('0xc')]=_0x4a4db2[_0xef05('0xc')];this[_0xef05('0xd')]={};this[_0xef05('0xe')]=0x0;this[_0xef05('0x1')]='';this[_0xef05('0xf')]();this[_0xef05('0x10')]();}MailQueue[_0xef05('0x11')][_0xef05('0xf')]=function(){var _0x44472a=this[_0xef05('0xd')]['_rr'];this['mapAgentsId']=_[_0xef05('0x12')](this[_0xef05('0xc')],'id');this['mapAgentsId'][_0xef05('0x13')]=_0x44472a;};MailQueue[_0xef05('0x11')][_0xef05('0x10')]=function(){this[_0xef05('0x14')]=0x0;this[_0xef05('0x15')]=0x0;for(var _0x10bd0e=0x0;_0x10bd0e=0x0?this['available']:0x0;var _0x1deff8={'id':this['id'],'available':this[_0xef05('0x19')],'loggedIn':this[_0xef05('0x14')],'name':this['name'],'paused':this[_0xef05('0x15')],'waiting':this['waiting']};var _0x3dddc6=md5(JSON[_0xef05('0x1a')](_0x1deff8));if(this[_0xef05('0x1')]!==_0x3dddc6){this[_0xef05('0x1')]=_0x3dddc6;io['to'](util[_0xef05('0x1b')](_0xef05('0x1c'),_0x1deff8[_0xef05('0x8')]))[_0xef05('0x1d')](_0xef05('0x1e'),_0x1deff8);}};module[_0xef05('0x1f')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 961470d..ba8ff6c 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 _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x326f,0xd1));var _0xf326=function(_0x3ccf7a,_0xa6558b){_0x3ccf7a=_0x3ccf7a-0x0;var _0x151b89=_0x326f[_0x3ccf7a];return _0x151b89;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x3f9ea9,_0x19840d){var _0x291e7f=function(_0x8012b4){while(--_0x8012b4){_0x3f9ea9['push'](_0x3f9ea9['shift']());}};_0x291e7f(++_0x19840d);}(_0xadb5,0xad));var _0x5adb=function(_0x2fc310,_0x429c55){_0x2fc310=_0x2fc310-0x0;var _0x48c6d1=_0xadb5[_0x2fc310];return _0x48c6d1;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};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 5e89bf0..9e7eebe 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 _0x6fad=['localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','updateRealtime','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','redis'];(function(_0x2a1adf,_0x1d37c7){var _0x4ba437=function(_0x47296e){while(--_0x47296e){_0x2a1adf['push'](_0x2a1adf['shift']());}};_0x4ba437(++_0x1d37c7);}(_0x6fad,0x174));var _0xd6fa=function(_0x509b2a,_0xf91802){_0x509b2a=_0x509b2a-0x0;var _0x59ff9e=_0x6fad[_0x509b2a];return _0x59ff9e;};'use strict';var _=require(_0xd6fa('0x0'));var md5=require(_0xd6fa('0x1'));var util=require(_0xd6fa('0x2'));var Redis=require(_0xd6fa('0x3'));var config=require('../../../config/environment');config[_0xd6fa('0x4')]=_['defaults'](config[_0xd6fa('0x4')],{'host':_0xd6fa('0x5'),'port':0x18eb});var io=require(_0xd6fa('0x6'))(new Redis(config[_0xd6fa('0x4')]));function SmsQueue(_0x58325c){this['id']=_0x58325c['id']||0x0;this[_0xd6fa('0x7')]=_0x58325c[_0xd6fa('0x7')]||'';this[_0xd6fa('0x8')]=_0x58325c[_0xd6fa('0x8')]||0xa;this['strategy']=_0x58325c[_0xd6fa('0x9')]||'beepall';this[_0xd6fa('0xa')]=_0x58325c[_0xd6fa('0xa')];this[_0xd6fa('0xb')]={};this[_0xd6fa('0xc')]=0x0;this[_0xd6fa('0x1')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xd6fa('0xd')][_0xd6fa('0xe')]=function(){var _0x4e91f4=this[_0xd6fa('0xb')][_0xd6fa('0xf')];this['mapAgentsId']=_['map'](this[_0xd6fa('0xa')],'id');this['mapAgentsId']['_rr']=_0x4e91f4;};SmsQueue[_0xd6fa('0xd')][_0xd6fa('0x10')]=function(){this[_0xd6fa('0x11')]=0x0;this[_0xd6fa('0x12')]=0x0;for(var _0x3cd6fa=0x0;_0x3cd6fa=0x0?this['available']:0x0;var _0xe458aa={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd6fa('0x11')],'name':this['name'],'paused':this[_0xd6fa('0x12')],'waiting':this[_0xd6fa('0xc')]};var _0x2ee97a=md5(JSON[_0xd6fa('0x17')](_0xe458aa));if(this[_0xd6fa('0x1')]!==_0x2ee97a){this[_0xd6fa('0x1')]=_0x2ee97a;io['to'](util[_0xd6fa('0x18')](_0xd6fa('0x19'),_0xe458aa[_0xd6fa('0x7')]))[_0xd6fa('0x1a')](_0xd6fa('0x1b'),_0xe458aa);}};module[_0xd6fa('0x1c')]=SmsQueue; \ No newline at end of file +var _0x5b02=['updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x5b02,0xe9));var _0x25b0=function(_0x4df3ec,_0x4adf0b){_0x4df3ec=_0x4df3ec-0x0;var _0x1397ba=_0x5b02[_0x4df3ec];return _0x1397ba;};'use strict';var _=require(_0x25b0('0x0'));var md5=require(_0x25b0('0x1'));var util=require(_0x25b0('0x2'));var Redis=require(_0x25b0('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x25b0('0x4')](config['redis'],{'host':_0x25b0('0x5'),'port':0x18eb});var io=require(_0x25b0('0x6'))(new Redis(config[_0x25b0('0x7')]));function SmsQueue(_0x1928e8){this['id']=_0x1928e8['id']||0x0;this[_0x25b0('0x8')]=_0x1928e8['name']||'';this[_0x25b0('0x9')]=_0x1928e8[_0x25b0('0x9')]||0xa;this['strategy']=_0x1928e8[_0x25b0('0xa')]||'beepall';this['Agents']=_0x1928e8[_0x25b0('0xb')];this[_0x25b0('0xc')]={};this[_0x25b0('0xd')]=0x0;this['md5']='';this[_0x25b0('0xe')]();this[_0x25b0('0xf')]();}SmsQueue[_0x25b0('0x10')][_0x25b0('0xe')]=function(){var _0x2c72f3=this[_0x25b0('0xc')][_0x25b0('0x11')];this[_0x25b0('0xc')]=_[_0x25b0('0x12')](this[_0x25b0('0xb')],'id');this[_0x25b0('0xc')][_0x25b0('0x11')]=_0x2c72f3;};SmsQueue[_0x25b0('0x10')][_0x25b0('0xf')]=function(){this[_0x25b0('0x13')]=0x0;this[_0x25b0('0x14')]=0x0;for(var _0x293203=0x0;_0x293203=0x0?this[_0x25b0('0x18')]:0x0;var _0x213a77={'id':this['id'],'available':this[_0x25b0('0x18')],'loggedIn':this[_0x25b0('0x13')],'name':this[_0x25b0('0x8')],'paused':this[_0x25b0('0x14')],'waiting':this['waiting']};var _0x348d36=md5(JSON[_0x25b0('0x19')](_0x213a77));if(this[_0x25b0('0x1')]!==_0x348d36){this[_0x25b0('0x1')]=_0x348d36;io['to'](util[_0x25b0('0x1a')](_0x25b0('0x1b'),_0x213a77[_0x25b0('0x8')]))[_0x25b0('0x1c')](_0x25b0('0x1d'),_0x213a77);}};module[_0x25b0('0x1e')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 7ad0303..f948903 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 _0x7dac=['map','loggedIn','paused','whatsappPause','available','stringify','format','emit','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr'];(function(_0x4bc7f0,_0x23d2a6){var _0xa189fc=function(_0x57256e){while(--_0x57256e){_0x4bc7f0['push'](_0x4bc7f0['shift']());}};_0xa189fc(++_0x23d2a6);}(_0x7dac,0x188));var _0xc7da=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x7dac[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var md5=require(_0xc7da('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0xc7da('0x1'));config[_0xc7da('0x2')]=_[_0xc7da('0x3')](config[_0xc7da('0x2')],{'host':_0xc7da('0x4'),'port':0x18eb});var io=require(_0xc7da('0x5'))(new Redis(config[_0xc7da('0x2')]));function WhatsappQueue(_0x2cec97){this['id']=_0x2cec97['id']||0x0;this[_0xc7da('0x6')]=_0x2cec97['name']||'';this['timeout']=_0x2cec97['timeout']||0xa;this[_0xc7da('0x7')]=_0x2cec97['strategy']||_0xc7da('0x8');this[_0xc7da('0x9')]=_0x2cec97[_0xc7da('0x9')];this[_0xc7da('0xa')]={};this[_0xc7da('0xb')]=0x0;this[_0xc7da('0x0')]='';this['updateRouting']();this[_0xc7da('0xc')]();}WhatsappQueue[_0xc7da('0xd')][_0xc7da('0xe')]=function(){var _0x4dc197=this[_0xc7da('0xa')][_0xc7da('0xf')];this[_0xc7da('0xa')]=_[_0xc7da('0x10')](this[_0xc7da('0x9')],'id');this['mapAgentsId']['_rr']=_0x4dc197;};WhatsappQueue[_0xc7da('0xd')][_0xc7da('0xc')]=function(){this[_0xc7da('0x11')]=0x0;this[_0xc7da('0x12')]=0x0;for(var _0x1e026e=0x0;_0x1e026e=0x0?this[_0xc7da('0x14')]:0x0;var _0x36b69c={'id':this['id'],'available':this['available'],'loggedIn':this[_0xc7da('0x11')],'name':this[_0xc7da('0x6')],'paused':this[_0xc7da('0x12')],'waiting':this[_0xc7da('0xb')]};var _0x3363b8=md5(JSON[_0xc7da('0x15')](_0x36b69c));if(this[_0xc7da('0x0')]!==_0x3363b8){this[_0xc7da('0x0')]=_0x3363b8;io['to'](util[_0xc7da('0x16')]('whatsapp:queue:%s',_0x36b69c[_0xc7da('0x6')]))[_0xc7da('0x17')]('whatsapp_queue:save',_0x36b69c);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x60fb=['lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','whatsappPause','available','paused','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0x60fb,0x12c));var _0xb60f=function(_0xa2bf0b,_0x43563d){_0xa2bf0b=_0xa2bf0b-0x0;var _0x106286=_0x60fb[_0xa2bf0b];return _0x106286;};'use strict';var _=require(_0xb60f('0x0'));var md5=require(_0xb60f('0x1'));var util=require(_0xb60f('0x2'));var Redis=require(_0xb60f('0x3'));var config=require('../../../config/environment');config[_0xb60f('0x4')]=_[_0xb60f('0x5')](config[_0xb60f('0x4')],{'host':_0xb60f('0x6'),'port':0x18eb});var io=require(_0xb60f('0x7'))(new Redis(config[_0xb60f('0x4')]));function WhatsappQueue(_0x4e5aba){this['id']=_0x4e5aba['id']||0x0;this[_0xb60f('0x8')]=_0x4e5aba[_0xb60f('0x8')]||'';this[_0xb60f('0x9')]=_0x4e5aba[_0xb60f('0x9')]||0xa;this['strategy']=_0x4e5aba[_0xb60f('0xa')]||_0xb60f('0xb');this[_0xb60f('0xc')]=_0x4e5aba[_0xb60f('0xc')];this['mapAgentsId']={};this[_0xb60f('0xd')]=0x0;this[_0xb60f('0x1')]='';this[_0xb60f('0xe')]();this[_0xb60f('0xf')]();}WhatsappQueue[_0xb60f('0x10')]['updateRouting']=function(){var _0x5c1480=this[_0xb60f('0x11')][_0xb60f('0x12')];this[_0xb60f('0x11')]=_[_0xb60f('0x13')](this[_0xb60f('0xc')],'id');this[_0xb60f('0x11')][_0xb60f('0x12')]=_0x5c1480;};WhatsappQueue[_0xb60f('0x10')][_0xb60f('0xf')]=function(){this[_0xb60f('0x14')]=0x0;this['paused']=0x0;for(var _0x4ef92c=0x0;_0x4ef92c=0x0?this[_0xb60f('0x17')]:0x0;var _0x293097={'id':this['id'],'available':this[_0xb60f('0x17')],'loggedIn':this[_0xb60f('0x14')],'name':this['name'],'paused':this[_0xb60f('0x18')],'waiting':this[_0xb60f('0xd')]};var _0x31f9dd=md5(JSON['stringify'](_0x293097));if(this[_0xb60f('0x1')]!==_0x31f9dd){this['md5']=_0x31f9dd;io['to'](util[_0xb60f('0x19')](_0xb60f('0x1a'),_0x293097[_0xb60f('0x8')]))[_0xb60f('0x1b')](_0xb60f('0x1c'),_0x293097);}};module[_0xb60f('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 8496a34..66ff1f7 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x39af69,_0x311324){var _0x223c72=function(_0x62f1aa){while(--_0x62f1aa){_0x39af69['push'](_0x39af69['shift']());}};_0x223c72(++_0x311324);}(_0xb10b,0x12a));var _0xbb10=function(_0x168765,_0x534f44){_0x168765=_0x168765-0x0;var _0x3ee3a0=_0xb10b[_0x168765];return _0x3ee3a0;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 2223bfc..c4770f9 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 _0x25bf=['addTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x237c7b,_0xa9c775){var _0x56695b=function(_0x21b00f){while(--_0x21b00f){_0x237c7b['push'](_0x237c7b['shift']());}};_0x56695b(++_0xa9c775);}(_0x25bf,0xbe));var _0xf25b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x25bf[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xf25b('0x0'));exports['update']=function(_0x2e4d2f,_0x4b7e1a){return client[_0xf25b('0x1')](_0xf25b('0x2'),{'body':_0x4b7e1a,'options':{'where':{'id':_0x2e4d2f}},'log':_0xf25b('0x3')});};exports[_0xf25b('0x4')]=function(_0x43e965,_0x4636e2){return client['Request'](_0xf25b('0x5'),{'body':_0x4636e2,'options':{'where':{'id':_0x43e965}},'log':_0xf25b('0x6')});}; \ No newline at end of file +var _0xdfb5=['UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x3f69ba,_0x2a831b){var _0x61254d=function(_0x1d7e83){while(--_0x1d7e83){_0x3f69ba['push'](_0x3f69ba['shift']());}};_0x61254d(++_0x2a831b);}(_0xdfb5,0x154));var _0x5dfb=function(_0x5dfe2a,_0x8e6a4e){_0x5dfe2a=_0x5dfe2a-0x0;var _0x5e4ba1=_0xdfb5[_0x5dfe2a];return _0x5e4ba1;};'use strict';var client=require(_0x5dfb('0x0'));exports['update']=function(_0xc1e27e,_0x5b0478){return client[_0x5dfb('0x1')](_0x5dfb('0x2'),{'body':_0x5b0478,'options':{'where':{'id':_0xc1e27e}},'log':_0x5dfb('0x3')});};exports['addTags']=function(_0x25bca6,_0x370faf){return client[_0x5dfb('0x1')](_0x5dfb('0x4'),{'body':_0x370faf,'options':{'where':{'id':_0x25bca6}},'log':_0x5dfb('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index e422e12..c5bbb34 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 _0x994d=['Request','CreateChatMessage','createChatMessage','../client'];(function(_0x174a72,_0x46034c){var _0x32cecd=function(_0x188a47){while(--_0x188a47){_0x174a72['push'](_0x174a72['shift']());}};_0x32cecd(++_0x46034c);}(_0x994d,0x11f));var _0xd994=function(_0x343924,_0x2a9592){_0x343924=_0x343924-0x0;var _0x2061a4=_0x994d[_0x343924];return _0x2061a4;};'use strict';var client=require(_0xd994('0x0'));exports['create']=function(_0x3af1f0){return client[_0xd994('0x1')](_0xd994('0x2'),{'body':_0x3af1f0,'log':_0xd994('0x3')});}; \ No newline at end of file +var _0x63a1=['create','createChatMessage','../client'];(function(_0x3a78aa,_0x5bb9b6){var _0x1868c5=function(_0x1b6b08){while(--_0x1b6b08){_0x3a78aa['push'](_0x3a78aa['shift']());}};_0x1868c5(++_0x5bb9b6);}(_0x63a1,0x1d3));var _0x163a=function(_0x4c0d80,_0x224815){_0x4c0d80=_0x4c0d80-0x0;var _0x5669f9=_0x63a1[_0x4c0d80];return _0x5669f9;};'use strict';var client=require(_0x163a('0x0'));exports[_0x163a('0x1')]=function(_0x12d3f0){return client['Request']('CreateChatMessage',{'body':_0x12d3f0,'log':_0x163a('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 1be9002..eb9c353 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 _0x92bc=['chatPause','../client','getChatQueues','Request','timeout','strategy','User','Agents','online'];(function(_0x25701b,_0x2a6976){var _0x3a8a2c=function(_0x1a5e78){while(--_0x1a5e78){_0x25701b['push'](_0x25701b['shift']());}};_0x3a8a2c(++_0x2a6976);}(_0x92bc,0x106));var _0xc92b=function(_0x577604,_0xcbc303){_0x577604=_0x577604-0x0;var _0x31045f=_0x92bc[_0x577604];return _0x31045f;};'use strict';var client=require(_0xc92b('0x0'));exports[_0xc92b('0x1')]=function(){return function(){return client[_0xc92b('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0xc92b('0x3'),_0xc92b('0x4')],'include':[{'model':_0xc92b('0x5'),'as':_0xc92b('0x6'),'attributes':['id','name',_0xc92b('0x7'),_0xc92b('0x8')]}]},'log':_0xc92b('0x1')});};}; \ No newline at end of file +var _0x7a08=['name','timeout','strategy','User','Agents','online','chatPause','../client','getChatQueues'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x7a08,0x11e));var _0x87a0=function(_0xa24985,_0x1d2c15){_0xa24985=_0xa24985-0x0;var _0x2f7c36=_0x7a08[_0xa24985];return _0x2f7c36;};'use strict';var client=require(_0x87a0('0x0'));exports[_0x87a0('0x1')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x87a0('0x2'),_0x87a0('0x3'),_0x87a0('0x4')],'include':[{'model':_0x87a0('0x5'),'as':_0x87a0('0x6'),'attributes':['id',_0x87a0('0x2'),_0x87a0('0x7'),_0x87a0('0x8')]}]},'log':_0x87a0('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 825a617..030ca69 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 _0x2ce1=['CreateChatQueueReport','update','DESC','UpdateChatQueueReport','Request'];(function(_0x1918a8,_0x56f70a){var _0x194237=function(_0x38337c){while(--_0x38337c){_0x1918a8['push'](_0x1918a8['shift']());}};_0x194237(++_0x56f70a);}(_0x2ce1,0x8b));var _0x12ce=function(_0x205bf2,_0x556a0d){_0x205bf2=_0x205bf2-0x0;var _0x14d6d3=_0x2ce1[_0x205bf2];return _0x14d6d3;};'use strict';var client=require('../client');exports['create']=function(_0x5cfde5){return client[_0x12ce('0x0')](_0x12ce('0x1'),{'body':_0x5cfde5,'log':_0x12ce('0x1')});};exports[_0x12ce('0x2')]=function(_0x4918dc,_0x37b568){return client[_0x12ce('0x0')]('UpdateChatQueueReport',{'body':_0x37b568,'options':{'where':{'uniqueid':_0x4918dc},'order':[['id',_0x12ce('0x3')]],'limit':0x1},'log':_0x12ce('0x4')});}; \ No newline at end of file +var _0xb48d=['DESC','UpdateChatQueueReport','../client','CreateChatQueueReport','update','Request'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0xb48d,0x194));var _0xdb48=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xb48d[_0x3305de];return _0x3b5a84;};'use strict';var client=require(_0xdb48('0x0'));exports['create']=function(_0x267789){return client['Request'](_0xdb48('0x1'),{'body':_0x267789,'log':_0xdb48('0x1')});};exports[_0xdb48('0x2')]=function(_0x3802d6,_0x56dd38){return client[_0xdb48('0x3')]('UpdateChatQueueReport',{'body':_0x56dd38,'options':{'where':{'uniqueid':_0x3802d6},'order':[['id',_0xdb48('0x4')]],'limit':0x1},'log':_0xdb48('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index a40c909..6a06b7d 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(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x7a54,0x106));var _0x47a5=function(_0xfe1784,_0x2e9239){_0xfe1784=_0xfe1784-0x0;var _0x968561=_0x7a54[_0xfe1784];return _0x968561;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x4fe7d5,_0x112c3d){var _0x46e5b3=function(_0xf01719){while(--_0xf01719){_0x4fe7d5['push'](_0x4fe7d5['shift']());}};_0x46e5b3(++_0x112c3d);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 9645c3f..53b28a5 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 _0x3076=['createFaxMessage','../client','Request'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3076,0x100));var _0x6307=function(_0x3e8802,_0x2bd819){_0x3e8802=_0x3e8802-0x0;var _0x26d594=_0x3076[_0x3e8802];return _0x26d594;};'use strict';var client=require(_0x6307('0x0'));exports['create']=function(_0x3ae4d2){return client[_0x6307('0x1')]('CreateFaxMessage',{'body':_0x3ae4d2,'log':_0x6307('0x2')});}; \ No newline at end of file +var _0x0c5c=['CreateFaxMessage','../client','create','Request'];(function(_0x1ac86a,_0x2fa581){var _0xe54ffc=function(_0x242681){while(--_0x242681){_0x1ac86a['push'](_0x1ac86a['shift']());}};_0xe54ffc(++_0x2fa581);}(_0x0c5c,0x6d));var _0xc0c5=function(_0x578fd4,_0x481aa3){_0x578fd4=_0x578fd4-0x0;var _0x2b6f9a=_0x0c5c[_0x578fd4];return _0x2b6f9a;};'use strict';var client=require(_0xc0c5('0x0'));exports[_0xc0c5('0x1')]=function(_0x3d2845){return client[_0xc0c5('0x2')](_0xc0c5('0x3'),{'body':_0x3d2845,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 09fe76c..034e0cf 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 _0x77ad=['online','faxPause','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x202a86,_0x55524b){var _0x3df18b=function(_0x3df49d){while(--_0x3df49d){_0x202a86['push'](_0x202a86['shift']());}};_0x3df18b(++_0x55524b);}(_0x77ad,0x87));var _0xd77a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x77ad[_0x432682];return _0x463d05;};'use strict';var client=require('../client');exports[_0xd77a('0x0')]=function(){return function(){return client[_0xd77a('0x1')](_0xd77a('0x2'),{'options':{'raw':![],'attributes':['id',_0xd77a('0x3'),_0xd77a('0x4'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0xd77a('0x5'),_0xd77a('0x6')]}]},'log':_0xd77a('0x0')});};}; \ No newline at end of file +var _0x07af=['online','faxPause','../client','getFaxQueues','GetFaxQueue','name','strategy'];(function(_0x3eab2e,_0xfeca3){var _0x1cc34c=function(_0xb0e25d){while(--_0xb0e25d){_0x3eab2e['push'](_0x3eab2e['shift']());}};_0x1cc34c(++_0xfeca3);}(_0x07af,0x167));var _0xf07a=function(_0x1a976b,_0x5dff79){_0x1a976b=_0x1a976b-0x0;var _0x251a8c=_0x07af[_0x1a976b];return _0x251a8c;};'use strict';var client=require(_0xf07a('0x0'));exports[_0xf07a('0x1')]=function(){return function(){return client['Request'](_0xf07a('0x2'),{'options':{'raw':![],'attributes':['id',_0xf07a('0x3'),'timeout',_0xf07a('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xf07a('0x3'),_0xf07a('0x5'),_0xf07a('0x6')]}]},'log':_0xf07a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 3b26824..c65e7fc 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 _0xc2b2=['CreateFaxQueueReport','DESC','../client','create'];(function(_0x534bd8,_0x5ae7d0){var _0x2f1784=function(_0x5a1962){while(--_0x5a1962){_0x534bd8['push'](_0x534bd8['shift']());}};_0x2f1784(++_0x5ae7d0);}(_0xc2b2,0x6a));var _0x2c2b=function(_0x52e15d,_0x5d67ab){_0x52e15d=_0x52e15d-0x0;var _0x1777f9=_0xc2b2[_0x52e15d];return _0x1777f9;};'use strict';var client=require(_0x2c2b('0x0'));exports[_0x2c2b('0x1')]=function(_0x1f6d0f){return client['Request'](_0x2c2b('0x2'),{'body':_0x1f6d0f,'log':_0x2c2b('0x2')});};exports['update']=function(_0x5edfe0,_0x45a6c1){return client['Request']('UpdateFaxQueueReport',{'body':_0x45a6c1,'options':{'where':{'uniqueid':_0x5edfe0},'order':[['id',_0x2c2b('0x3')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xf572=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x28bfed,_0x4278db){var _0x3c29b9=function(_0x294c8b){while(--_0x294c8b){_0x28bfed['push'](_0x28bfed['shift']());}};_0x3c29b9(++_0x4278db);}(_0xf572,0x11a));var _0x2f57=function(_0x1ff194,_0x1ace30){_0x1ff194=_0x1ff194-0x0;var _0x29b7a5=_0xf572[_0x1ff194];return _0x29b7a5;};'use strict';var client=require(_0x2f57('0x0'));exports[_0x2f57('0x1')]=function(_0x317759){return client[_0x2f57('0x2')](_0x2f57('0x3'),{'body':_0x317759,'log':'CreateFaxQueueReport'});};exports[_0x2f57('0x4')]=function(_0x4dbb26,_0x5082c2){return client[_0x2f57('0x2')](_0x2f57('0x5'),{'body':_0x5082c2,'options':{'where':{'uniqueid':_0x4dbb26},'order':[['id',_0x2f57('0x6')]],'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 cb105cb..9557630 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 _0xd1c3=['getIntervals','Request','GetInterval','name','Interval','Intervals','interval','../client'];(function(_0x16c0c7,_0x241a49){var _0x272884=function(_0x52b962){while(--_0x52b962){_0x16c0c7['push'](_0x16c0c7['shift']());}};_0x272884(++_0x241a49);}(_0xd1c3,0x19f));var _0x3d1c=function(_0x294473,_0x23278a){_0x294473=_0x294473-0x0;var _0xc740bb=_0xd1c3[_0x294473];return _0xc740bb;};'use strict';var client=require(_0x3d1c('0x0'));exports[_0x3d1c('0x1')]=function(){return function(){return client[_0x3d1c('0x2')](_0x3d1c('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x3d1c('0x4')],'include':[{'model':_0x3d1c('0x5'),'as':_0x3d1c('0x6'),'attributes':['id',_0x3d1c('0x4'),_0x3d1c('0x7')]}]},'log':_0x3d1c('0x1')});};}; \ No newline at end of file +var _0x956c=['getIntervals','../client','Request','name','Interval','Intervals','interval'];(function(_0x12b9fa,_0x3c3ae6){var _0x464cbd=function(_0x480926){while(--_0x480926){_0x12b9fa['push'](_0x12b9fa['shift']());}};_0x464cbd(++_0x3c3ae6);}(_0x956c,0x13c));var _0xc956=function(_0x162b7a,_0x5572f3){_0x162b7a=_0x162b7a-0x0;var _0x5eeae1=_0x956c[_0x162b7a];return _0x5eeae1;};'use strict';var client=require(_0xc956('0x0'));exports['getIntervals']=function(){return function(){return client[_0xc956('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xc956('0x2')],'include':[{'model':_0xc956('0x3'),'as':_0xc956('0x4'),'attributes':['id',_0xc956('0x2'),_0xc956('0x5')]}]},'log':_0xc956('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 3b692f8..c8b91eb 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 _0x3423=['AddTagsToMailInteraction','addTagsToChatInteraction','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x1a27df,_0x4dff9a){var _0x530f59=function(_0x3e4bfe){while(--_0x3e4bfe){_0x1a27df['push'](_0x1a27df['shift']());}};_0x530f59(++_0x4dff9a);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['update']=function(_0x381e58,_0x16bdb3){return client[_0x3342('0x0')](_0x3342('0x1'),{'body':_0x16bdb3,'options':{'where':{'id':_0x381e58}},'log':_0x3342('0x2')});};exports[_0x3342('0x3')]=function(_0x2207ce,_0x3c5d8d){return client[_0x3342('0x0')](_0x3342('0x4'),{'body':_0x3c5d8d,'options':{'where':{'id':_0x2207ce}},'log':_0x3342('0x5')});}; \ No newline at end of file +var _0x1967=['Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','update'];(function(_0x285b2d,_0x2cc104){var _0x2069c6=function(_0x1732b3){while(--_0x1732b3){_0x285b2d['push'](_0x285b2d['shift']());}};_0x2069c6(++_0x2cc104);}(_0x1967,0x173));var _0x7196=function(_0xf32f4b,_0x279c72){_0xf32f4b=_0xf32f4b-0x0;var _0xd733d5=_0x1967[_0xf32f4b];return _0xd733d5;};'use strict';var client=require('../client');exports[_0x7196('0x0')]=function(_0xdb72bb,_0x4d0a98){return client[_0x7196('0x1')](_0x7196('0x2'),{'body':_0x4d0a98,'options':{'where':{'id':_0xdb72bb}},'log':_0x7196('0x3')});};exports[_0x7196('0x4')]=function(_0x1aaddd,_0x458ae8){return client[_0x7196('0x1')]('AddTagsToMailInteraction',{'body':_0x458ae8,'options':{'where':{'id':_0x1aaddd}},'log':_0x7196('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index ad4c7d2..4a57bb2 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 _0xc5f9=['create','createMailMessage'];(function(_0x15f3c0,_0x165a64){var _0x1adfe0=function(_0x212cfc){while(--_0x212cfc){_0x15f3c0['push'](_0x15f3c0['shift']());}};_0x1adfe0(++_0x165a64);}(_0xc5f9,0x8a));var _0x9c5f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc5f9[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0x9c5f('0x0')]=function(_0x2de2ca){return client['Request']('CreateMailMessage',{'body':_0x2de2ca,'log':_0x9c5f('0x1')});}; \ No newline at end of file +var _0x4746=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x2c27ef,_0x28374d){var _0x2a1449=function(_0x1d5087){while(--_0x1d5087){_0x2c27ef['push'](_0x2c27ef['shift']());}};_0x2a1449(++_0x28374d);}(_0x4746,0x8c));var _0x6474=function(_0x5bb6bc,_0x22070b){_0x5bb6bc=_0x5bb6bc-0x0;var _0x441472=_0x4746[_0x5bb6bc];return _0x441472;};'use strict';var client=require(_0x6474('0x0'));exports[_0x6474('0x1')]=function(_0x260598){return client[_0x6474('0x2')](_0x6474('0x3'),{'body':_0x260598,'log':_0x6474('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 13c172e..632710d 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 _0x8bef=['Agents','online','../client','getMailQueues','GetMailQueue','name','timeout','strategy'];(function(_0xdb01a,_0x54a83a){var _0x107ede=function(_0x98f457){while(--_0x98f457){_0xdb01a['push'](_0xdb01a['shift']());}};_0x107ede(++_0x54a83a);}(_0x8bef,0x72));var _0xf8be=function(_0x1b2a4c,_0x5e55be){_0x1b2a4c=_0x1b2a4c-0x0;var _0x395fb7=_0x8bef[_0x1b2a4c];return _0x395fb7;};'use strict';var client=require(_0xf8be('0x0'));exports[_0xf8be('0x1')]=function(){return function(){return client['Request'](_0xf8be('0x2'),{'options':{'raw':![],'attributes':['id',_0xf8be('0x3'),_0xf8be('0x4'),_0xf8be('0x5')],'include':[{'model':'User','as':_0xf8be('0x6'),'attributes':['id','name',_0xf8be('0x7'),'mailPause']}]},'log':_0xf8be('0x1')});};}; \ No newline at end of file +var _0xec72=['GetMailQueue','timeout','Agents','name','online','mailPause','../client','getMailQueues','Request'];(function(_0x23ca2f,_0x271c2b){var _0x4f4b51=function(_0x1cb6c0){while(--_0x1cb6c0){_0x23ca2f['push'](_0x23ca2f['shift']());}};_0x4f4b51(++_0x271c2b);}(_0xec72,0x165));var _0x2ec7=function(_0x147765,_0x17dce6){_0x147765=_0x147765-0x0;var _0x991e18=_0xec72[_0x147765];return _0x991e18;};'use strict';var client=require(_0x2ec7('0x0'));exports[_0x2ec7('0x1')]=function(){return function(){return client[_0x2ec7('0x2')](_0x2ec7('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x2ec7('0x4'),'strategy'],'include':[{'model':'User','as':_0x2ec7('0x5'),'attributes':['id',_0x2ec7('0x6'),_0x2ec7('0x7'),_0x2ec7('0x8')]}]},'log':_0x2ec7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index bce4cfb..4559aea 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 _0x9dba=['Request','CreateMailQueueReport','update','DESC','../client','create'];(function(_0x455a1a,_0x2c9231){var _0x25277a=function(_0x444a46){while(--_0x444a46){_0x455a1a['push'](_0x455a1a['shift']());}};_0x25277a(++_0x2c9231);}(_0x9dba,0x12a));var _0xa9db=function(_0x12740e,_0x476c3f){_0x12740e=_0x12740e-0x0;var _0x5e0410=_0x9dba[_0x12740e];return _0x5e0410;};'use strict';var client=require(_0xa9db('0x0'));exports[_0xa9db('0x1')]=function(_0x5c6059){return client[_0xa9db('0x2')](_0xa9db('0x3'),{'body':_0x5c6059,'log':_0xa9db('0x3')});};exports[_0xa9db('0x4')]=function(_0x53b503,_0x20e2e7){return client[_0xa9db('0x2')]('UpdateMailQueueReport',{'body':_0x20e2e7,'options':{'where':{'uniqueid':_0x53b503},'order':[['id',_0xa9db('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x93b2=['../client','create','Request','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0x140f09,_0x3b06f0){var _0x49d969=function(_0x1842c6){while(--_0x1842c6){_0x140f09['push'](_0x140f09['shift']());}};_0x49d969(++_0x3b06f0);}(_0x93b2,0xcd));var _0x293b=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x93b2[_0x32f7d7];return _0x133d09;};'use strict';var client=require(_0x293b('0x0'));exports[_0x293b('0x1')]=function(_0x9493d4){return client[_0x293b('0x2')](_0x293b('0x3'),{'body':_0x9493d4,'log':_0x293b('0x3')});};exports['update']=function(_0x22a647,_0x5abc18){return client[_0x293b('0x2')](_0x293b('0x4'),{'body':_0x5abc18,'options':{'where':{'uniqueid':_0x22a647},'order':[['id','DESC']],'limit':0x1},'log':_0x293b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 1666c9c..fad11dc 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 _0xc20d=['addTags','Request','AddTagsToOpenchannelInteraction','update','updateOpenchannelInteraction'];(function(_0x23be99,_0x34b6e0){var _0x2c99c5=function(_0x56dfdb){while(--_0x56dfdb){_0x23be99['push'](_0x23be99['shift']());}};_0x2c99c5(++_0x34b6e0);}(_0xc20d,0x116));var _0xdc20=function(_0x56b138,_0x2396d6){_0x56b138=_0x56b138-0x0;var _0x3df878=_0xc20d[_0x56b138];return _0x3df878;};'use strict';var client=require('../client');exports[_0xdc20('0x0')]=function(_0x58cfe7,_0x4024f4){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x4024f4,'options':{'where':{'id':_0x58cfe7}},'log':_0xdc20('0x1')});};exports[_0xdc20('0x2')]=function(_0xe7e340,_0x4fd44b){return client[_0xdc20('0x3')](_0xdc20('0x4'),{'body':_0x4fd44b,'options':{'where':{'id':_0xe7e340}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x0e09=['addTags','Request','addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x29ec17,_0x4409af){var _0x581c26=function(_0x4c9131){while(--_0x4c9131){_0x29ec17['push'](_0x29ec17['shift']());}};_0x581c26(++_0x4409af);}(_0x0e09,0x88));var _0x90e0=function(_0x53e5ca,_0x3742a1){_0x53e5ca=_0x53e5ca-0x0;var _0x5926c5=_0x0e09[_0x53e5ca];return _0x5926c5;};'use strict';var client=require(_0x90e0('0x0'));exports[_0x90e0('0x1')]=function(_0x1e1f82,_0x11202c){return client['Request'](_0x90e0('0x2'),{'body':_0x11202c,'options':{'where':{'id':_0x1e1f82}},'log':_0x90e0('0x3')});};exports[_0x90e0('0x4')]=function(_0x19ed03,_0x4b8268){return client[_0x90e0('0x5')]('AddTagsToOpenchannelInteraction',{'body':_0x4b8268,'options':{'where':{'id':_0x19ed03}},'log':_0x90e0('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index ca6dbea..2021bba 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 _0x1385=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x58b900,_0x4067f4){var _0x142565=function(_0x475ac2){while(--_0x475ac2){_0x58b900['push'](_0x58b900['shift']());}};_0x142565(++_0x4067f4);}(_0x1385,0x8c));var _0x5138=function(_0x49d8df,_0x166246){_0x49d8df=_0x49d8df-0x0;var _0x1d6e0d=_0x1385[_0x49d8df];return _0x1d6e0d;};'use strict';var client=require(_0x5138('0x0'));exports[_0x5138('0x1')]=function(_0x162803){return client[_0x5138('0x2')](_0x5138('0x3'),{'body':_0x162803,'log':_0x5138('0x4')});}; \ No newline at end of file +var _0x3876=['create','createOpenchannelMessage','../client'];(function(_0x4230b3,_0x1831d9){var _0x377033=function(_0x17bc64){while(--_0x17bc64){_0x4230b3['push'](_0x4230b3['shift']());}};_0x377033(++_0x1831d9);}(_0x3876,0x1a3));var _0x6387=function(_0xbb3c6,_0x250015){_0xbb3c6=_0xbb3c6-0x0;var _0xc85c14=_0x3876[_0xbb3c6];return _0xc85c14;};'use strict';var client=require(_0x6387('0x0'));exports[_0x6387('0x1')]=function(_0x397cf1){return client['Request']('CreateOpenchannelMessage',{'body':_0x397cf1,'log':_0x6387('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index bc6b144..f228eeb 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 _0x1320=['timeout','strategy','Agents','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name'];(function(_0x4dac43,_0x1a286d){var _0x5447ad=function(_0x476475){while(--_0x476475){_0x4dac43['push'](_0x4dac43['shift']());}};_0x5447ad(++_0x1a286d);}(_0x1320,0x140));var _0x0132=function(_0x4625ce,_0x55986a){_0x4625ce=_0x4625ce-0x0;var _0x5d5e26=_0x1320[_0x4625ce];return _0x5d5e26;};'use strict';var client=require('../client');exports[_0x0132('0x0')]=function(){return function(){return client[_0x0132('0x1')](_0x0132('0x2'),{'options':{'raw':![],'attributes':['id',_0x0132('0x3'),_0x0132('0x4'),_0x0132('0x5')],'include':[{'model':'User','as':_0x0132('0x6'),'attributes':['id',_0x0132('0x3'),_0x0132('0x7'),_0x0132('0x8')]}]},'log':_0x0132('0x0')});};}; \ No newline at end of file +var _0x5cfe=['Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User'];(function(_0x595dd0,_0x1473e4){var _0x9e3cde=function(_0x4e0471){while(--_0x4e0471){_0x595dd0['push'](_0x595dd0['shift']());}};_0x9e3cde(++_0x1473e4);}(_0x5cfe,0x1b0));var _0xe5cf=function(_0x45a37d,_0x4791d7){_0x45a37d=_0x45a37d-0x0;var _0x148463=_0x5cfe[_0x45a37d];return _0x148463;};'use strict';var client=require(_0xe5cf('0x0'));exports[_0xe5cf('0x1')]=function(){return function(){return client[_0xe5cf('0x2')](_0xe5cf('0x3'),{'options':{'raw':![],'attributes':['id',_0xe5cf('0x4'),_0xe5cf('0x5'),_0xe5cf('0x6')],'include':[{'model':_0xe5cf('0x7'),'as':_0xe5cf('0x8'),'attributes':['id','name',_0xe5cf('0x9'),_0xe5cf('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 ca5f489..712cab5 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 _0x9106=['update','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x14fabe,_0x452d4d){var _0x5af3a4=function(_0x2204a4){while(--_0x2204a4){_0x14fabe['push'](_0x14fabe['shift']());}};_0x5af3a4(++_0x452d4d);}(_0x9106,0x6e));var _0x6910=function(_0x48fd4f,_0x4d071e){_0x48fd4f=_0x48fd4f-0x0;var _0x479dd3=_0x9106[_0x48fd4f];return _0x479dd3;};'use strict';var client=require(_0x6910('0x0'));exports[_0x6910('0x1')]=function(_0x1fec30){return client[_0x6910('0x2')]('CreateOpenchannelQueueReport',{'body':_0x1fec30,'log':_0x6910('0x3')});};exports[_0x6910('0x4')]=function(_0x414b0e,_0x588e4d){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x588e4d,'options':{'where':{'uniqueid':_0x414b0e},'order':[['id','DESC']],'limit':0x1},'log':_0x6910('0x5')});}; \ No newline at end of file +var _0x930d=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client'];(function(_0x44d385,_0x1a313a){var _0x5c2cc5=function(_0x5d1d76){while(--_0x5d1d76){_0x44d385['push'](_0x44d385['shift']());}};_0x5c2cc5(++_0x1a313a);}(_0x930d,0x72));var _0xd930=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x930d[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0xd930('0x0'));exports['create']=function(_0x278450){return client[_0xd930('0x1')](_0xd930('0x2'),{'body':_0x278450,'log':'CreateOpenchannelQueueReport'});};exports[_0xd930('0x3')]=function(_0x2a0281,_0x222cf9){return client[_0xd930('0x1')](_0xd930('0x4'),{'body':_0x222cf9,'options':{'where':{'uniqueid':_0x2a0281},'order':[['id','DESC']],'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 f0c7eff..05729be 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 _0x5aaa=['../client','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction'];(function(_0x1d1746,_0x2ab0ad){var _0x167cba=function(_0x4bac48){while(--_0x4bac48){_0x1d1746['push'](_0x1d1746['shift']());}};_0x167cba(++_0x2ab0ad);}(_0x5aaa,0xff));var _0xa5aa=function(_0x22f226,_0x5e0f2b){_0x22f226=_0x22f226-0x0;var _0x44371e=_0x5aaa[_0x22f226];return _0x44371e;};'use strict';var client=require(_0xa5aa('0x0'));exports['update']=function(_0x58b34e,_0x4d2ac2){return client['Request']('UpdateSmsInteraction',{'body':_0x4d2ac2,'options':{'where':{'id':_0x58b34e}},'log':_0xa5aa('0x1')});};exports[_0xa5aa('0x2')]=function(_0x473061,_0x54ca19){return client[_0xa5aa('0x3')](_0xa5aa('0x4'),{'body':_0x54ca19,'options':{'where':{'id':_0x473061}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x0738=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0738,0x6e));var _0x8073=function(_0x18546c,_0x4daf94){_0x18546c=_0x18546c-0x0;var _0x46ef43=_0x0738[_0x18546c];return _0x46ef43;};'use strict';var client=require(_0x8073('0x0'));exports['update']=function(_0xd9684a,_0x3b3772){return client[_0x8073('0x1')](_0x8073('0x2'),{'body':_0x3b3772,'options':{'where':{'id':_0xd9684a}},'log':_0x8073('0x3')});};exports[_0x8073('0x4')]=function(_0x176f52,_0x38b47d){return client[_0x8073('0x1')](_0x8073('0x5'),{'body':_0x38b47d,'options':{'where':{'id':_0x176f52}},'log':_0x8073('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 812e242..749366b 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 _0x98ce=['createSmsMessage','../client','Request'];(function(_0x5808fd,_0x508ae3){var _0x2b09d5=function(_0x50c2e2){while(--_0x50c2e2){_0x5808fd['push'](_0x5808fd['shift']());}};_0x2b09d5(++_0x508ae3);}(_0x98ce,0xb2));var _0xe98c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x98ce[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0xe98c('0x0'));exports['create']=function(_0x59e902){return client[_0xe98c('0x1')]('CreateSmsMessage',{'body':_0x59e902,'log':_0xe98c('0x2')});}; \ No newline at end of file +var _0xdddc=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0xad23c5,_0x2d7c1e){var _0x3d1c3d=function(_0x2c925a){while(--_0x2c925a){_0xad23c5['push'](_0xad23c5['shift']());}};_0x3d1c3d(++_0x2d7c1e);}(_0xdddc,0x196));var _0xcddd=function(_0x2b7012,_0x5cc64c){_0x2b7012=_0x2b7012-0x0;var _0x5076fb=_0xdddc[_0x2b7012];return _0x5076fb;};'use strict';var client=require(_0xcddd('0x0'));exports[_0xcddd('0x1')]=function(_0x4b37bd){return client[_0xcddd('0x2')](_0xcddd('0x3'),{'body':_0x4b37bd,'log':_0xcddd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 92a62cd..703bc1b 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x70e0,0x17b));var _0x070e=function(_0x2aaf46,_0x1e0fc8){_0x2aaf46=_0x2aaf46-0x0;var _0x2b45b0=_0x70e0[_0x2aaf46];return _0x2b45b0;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x5163fa,_0x41741e){var _0xd6adc5=function(_0x358f1b){while(--_0x358f1b){_0x5163fa['push'](_0x5163fa['shift']());}};_0xd6adc5(++_0x41741e);}(_0xb7e7,0x121));var _0x7b7e=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xb7e7[_0xac151d];return _0x111dba;};'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 a389b37..d89ba12 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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x351985,_0x25a3bd){var _0xbafa4b=function(_0xb3dedb){while(--_0xb3dedb){_0x351985['push'](_0x351985['shift']());}};_0xbafa4b(++_0x25a3bd);}(_0x70e0,0x17b));var _0x070e=function(_0x58dc90,_0x47469c){_0x58dc90=_0x58dc90-0x0;var _0x7bded3=_0x70e0[_0x58dc90];return _0x7bded3;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x2dc92b,_0x740792){var _0x406cd4=function(_0x2290c1){while(--_0x2290c1){_0x2dc92b['push'](_0x2dc92b['shift']());}};_0x406cd4(++_0x740792);}(_0x3e74,0x175));var _0x43e7=function(_0x2983ff,_0x15479c){_0x2983ff=_0x2983ff-0x0;var _0x135f09=_0x3e74[_0x2983ff];return _0x135f09;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index b3efc56..d32e05e 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(_0x30468f,_0x2c5db6){var _0x302978=function(_0x4a2437){while(--_0x4a2437){_0x30468f['push'](_0x30468f['shift']());}};_0x302978(++_0x2c5db6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x4e736a,_0x1d728f){var _0x3f5555=function(_0x53e066){while(--_0x53e066){_0x4e736a['push'](_0x4e736a['shift']());}};_0x3f5555(++_0x1d728f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 c411c2c..67e956f 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 _0x0650=['AddTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','addTags'];(function(_0x589f60,_0x3cb1bb){var _0x4da5c9=function(_0x262053){while(--_0x262053){_0x589f60['push'](_0x589f60['shift']());}};_0x4da5c9(++_0x3cb1bb);}(_0x0650,0xed));var _0x0065=function(_0x16295e,_0x4a9b05){_0x16295e=_0x16295e-0x0;var _0x2d9e54=_0x0650[_0x16295e];return _0x2d9e54;};'use strict';var client=require(_0x0065('0x0'));exports['update']=function(_0x3fbf43,_0x42d2cd){return client['Request'](_0x0065('0x1'),{'body':_0x42d2cd,'options':{'where':{'id':_0x3fbf43}},'log':'updateWhatsappInteraction'});};exports[_0x0065('0x2')]=function(_0x8260ba,_0x3dd8c6){return client['Request'](_0x0065('0x3'),{'body':_0x3dd8c6,'options':{'where':{'id':_0x8260ba}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x4279=['addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x440e87,_0x165c4b){var _0x224a88=function(_0x5c6675){while(--_0x5c6675){_0x440e87['push'](_0x440e87['shift']());}};_0x224a88(++_0x165c4b);}(_0x4279,0x8d));var _0x9427=function(_0x3e952a,_0xc6ec59){_0x3e952a=_0x3e952a-0x0;var _0xfbb428=_0x4279[_0x3e952a];return _0xfbb428;};'use strict';var client=require('../client');exports[_0x9427('0x0')]=function(_0x218ae7,_0x594cbc){return client[_0x9427('0x1')](_0x9427('0x2'),{'body':_0x594cbc,'options':{'where':{'id':_0x218ae7}},'log':_0x9427('0x3')});};exports[_0x9427('0x4')]=function(_0x54cdfb,_0x426911){return client['Request'](_0x9427('0x5'),{'body':_0x426911,'options':{'where':{'id':_0x54cdfb}},'log':_0x9427('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index c48396f..7fac9a3 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 _0xb189=['create','Request','CreateWhatsappMessage'];(function(_0x5d6cde,_0x5d10dd){var _0x29721f=function(_0x40d198){while(--_0x40d198){_0x5d6cde['push'](_0x5d6cde['shift']());}};_0x29721f(++_0x5d10dd);}(_0xb189,0x13b));var _0x9b18=function(_0x1d979e,_0x1ea2c5){_0x1d979e=_0x1d979e-0x0;var _0x42b995=_0xb189[_0x1d979e];return _0x42b995;};'use strict';var client=require('../client');exports[_0x9b18('0x0')]=function(_0x1337e6){return client[_0x9b18('0x1')](_0x9b18('0x2'),{'body':_0x1337e6,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x67db=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x2c54db,_0x4decb4){var _0x40c4e4=function(_0x22acbc){while(--_0x22acbc){_0x2c54db['push'](_0x2c54db['shift']());}};_0x40c4e4(++_0x4decb4);}(_0x67db,0xe0));var _0xb67d=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x67db[_0xbd08b4];return _0x314f1e;};'use strict';var client=require(_0xb67d('0x0'));exports[_0xb67d('0x1')]=function(_0x10f0b0){return client[_0xb67d('0x2')](_0xb67d('0x3'),{'body':_0x10f0b0,'log':_0xb67d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 8b22181..087eac1 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 _0xc2ad=['strategy','User','Agents','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout'];(function(_0x242a4f,_0x369c57){var _0x122117=function(_0x55a797){while(--_0x55a797){_0x242a4f['push'](_0x242a4f['shift']());}};_0x122117(++_0x369c57);}(_0xc2ad,0xed));var _0xdc2a=function(_0x48a943,_0x4c5a41){_0x48a943=_0x48a943-0x0;var _0x5b80a7=_0xc2ad[_0x48a943];return _0x5b80a7;};'use strict';var client=require(_0xdc2a('0x0'));exports[_0xdc2a('0x1')]=function(){return function(){return client[_0xdc2a('0x2')](_0xdc2a('0x3'),{'options':{'raw':![],'attributes':['id',_0xdc2a('0x4'),_0xdc2a('0x5'),_0xdc2a('0x6')],'include':[{'model':_0xdc2a('0x7'),'as':_0xdc2a('0x8'),'attributes':['id','name','online','whatsappPause']}]},'log':_0xdc2a('0x1')});};}; \ No newline at end of file +var _0xa7c2=['Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','whatsappPause','getWhatsappQueues'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xa7c2,0xc5));var _0x2a7c=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xa7c2[_0x5d4607];return _0x5e4a86;};'use strict';var client=require('../client');exports[_0x2a7c('0x0')]=function(){return function(){return client[_0x2a7c('0x1')](_0x2a7c('0x2'),{'options':{'raw':![],'attributes':['id',_0x2a7c('0x3'),_0x2a7c('0x4'),_0x2a7c('0x5')],'include':[{'model':_0x2a7c('0x6'),'as':_0x2a7c('0x7'),'attributes':['id',_0x2a7c('0x3'),'online',_0x2a7c('0x8')]}]},'log':_0x2a7c('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 02c8033..37f292a 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 _0xe383=['../client','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0xf1b709,_0x7b8410){var _0x4f5eb9=function(_0x106af0){while(--_0x106af0){_0xf1b709['push'](_0xf1b709['shift']());}};_0x4f5eb9(++_0x7b8410);}(_0xe383,0xde));var _0x3e38=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe383[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require(_0x3e38('0x0'));exports['create']=function(_0xcb51d4){return client[_0x3e38('0x1')]('CreateWhatsappQueueReport',{'body':_0xcb51d4,'log':_0x3e38('0x2')});};exports[_0x3e38('0x3')]=function(_0x490ece,_0x1952c6){return client['Request'](_0x3e38('0x4'),{'body':_0x1952c6,'options':{'where':{'uniqueid':_0x490ece},'order':[['id',_0x3e38('0x5')]],'limit':0x1},'log':_0x3e38('0x4')});}; \ No newline at end of file +var _0xb1ef=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x2ce9c3,_0x1444f9){var _0xc89661=function(_0x1c1190){while(--_0x1c1190){_0x2ce9c3['push'](_0x2ce9c3['shift']());}};_0xc89661(++_0x1444f9);}(_0xb1ef,0x1e5));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0xfb1e('0x0'));exports['create']=function(_0x527ef0){return client[_0xfb1e('0x1')]('CreateWhatsappQueueReport',{'body':_0x527ef0,'log':_0xfb1e('0x2')});};exports[_0xfb1e('0x3')]=function(_0x4b666e,_0x20fe8a){return client[_0xfb1e('0x1')](_0xfb1e('0x4'),{'body':_0x20fe8a,'options':{'where':{'uniqueid':_0x4b666e},'order':[['id',_0xfb1e('0x5')]],'limit':0x1},'log':_0xfb1e('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 1df9adc..ee9a208 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 _0x2b2b=['info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','error','map','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x2aafc5,_0x5b77f0){var _0x585fd5=function(_0x1e82bb){while(--_0x1e82bb){_0x2aafc5['push'](_0x2aafc5['shift']());}};_0x585fd5(++_0x5b77f0);}(_0x2b2b,0x184));var _0xb2b2=function(_0x58b387,_0x5da34b){_0x58b387=_0x58b387-0x0;var _0x183e4d=_0x2b2b[_0x58b387];return _0x183e4d;};'use strict';var schema=require('validate');var _=require(_0xb2b2('0x0'));var util=require(_0xb2b2('0x1'));var seqqueue=require(_0xb2b2('0x2'));var logger=require(_0xb2b2('0x3'))('routing');var strategy=require(_0xb2b2('0x4'));var queue=schema({'name':{'type':_0xb2b2('0x5'),'required':!![],'message':_0xb2b2('0x6')},'timeout':{'type':_0xb2b2('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x377869,_0x476255,_0x25f5b7){return logger[_0xb2b2('0x8')](util[_0xb2b2('0x9')](_0xb2b2('0xa'),_0x377869,_0x476255[_0xb2b2('0xb')],_0x25f5b7));}function handleFindAgent(_0x3465fc){return function(_0x521035){return _0x521035[_0xb2b2('0xb')][_0xb2b2('0xc')]()===_0x3465fc[_0xb2b2('0xc')]();};}exports['consequence']=function(_0x30f7a4,_0x22c154,_0x11a47b,_0xd86271){return function(_0x2e2b26){try{var _0x3bbc95={'name':_0x22c154[0x0],'timeout':_0x22c154[0x1]};var _0x34eb5f=queue['validate'](_0x3bbc95,{'typecast':!![]});if(_0x34eb5f['length']){logger[_0xb2b2('0xd')]('[%s][AGENT]\x20%s',_0x30f7a4,_[_0xb2b2('0xe')](_0x34eb5f,'message')[_0xb2b2('0xf')](',\x20'));_0x2e2b26[_0xb2b2('0x10')]();}else{var _0x111e8b=_[_0xb2b2('0x11')](_0x11a47b[_0xb2b2('0x12')],handleFindAgent(_0x3bbc95[_0xb2b2('0xb')]));if(_0x111e8b){var _0x201f28=(_0x3bbc95[_0xb2b2('0x13')]||0xa)*0x3e8;var _0xffdb8a,_0x5a629c;var _0xf5bb1e=seqqueue[_0xb2b2('0x14')](_0x201f28);_0xf5bb1e['id']=_0x30f7a4;_0xf5bb1e[_0xb2b2('0x15')]=_0x201f28;_0xf5bb1e[_0xb2b2('0x16')]=_0xd86271[_0xb2b2('0x16')];writeLog(_0x30f7a4,_0x111e8b,util[_0xb2b2('0x9')](_0xb2b2('0x17'),_0x201f28));_0x11a47b[_0xb2b2('0x18')][_0x30f7a4]['on'](_0xb2b2('0x19'),function(){logger[_0xb2b2('0x8')](_0xb2b2('0x1a'),_0x30f7a4);clearTimeout(_0x5a629c);_0x5a629c=undefined;_0xf5bb1e[_0xb2b2('0x1b')]();if(_0x11a47b[_0xb2b2('0x18')][_0x30f7a4]){delete _0x11a47b['rules'][_0x30f7a4];}_0x2e2b26[_0xb2b2('0x10')]();});_0x11a47b[_0xb2b2('0x18')][_0x30f7a4]['on'](_0xb2b2('0x1c'),function(){if(_0x11a47b['rules'][_0x30f7a4]){delete _0x11a47b[_0xb2b2('0x18')][_0x30f7a4];}});_0x5a629c=setTimeout(function(){logger[_0xb2b2('0x8')](_0xb2b2('0x1d'),_0x30f7a4);clearTimeout(_0x5a629c);_0xf5bb1e['close']();_0x2e2b26[_0xb2b2('0x1e')]();},_0x201f28);strategy[_0xb2b2('0x1f')](_0xf5bb1e,_0x111e8b,_0x11a47b,_0xd86271);}else{logger[_0xb2b2('0xd')](_0xb2b2('0x20'),_0x30f7a4,_0x3bbc95[_0xb2b2('0xb')]);_0x2e2b26[_0xb2b2('0x10')]();}}}catch(_0x3d8b5a){console[_0xb2b2('0x21')](_0x3d8b5a);logger[_0xb2b2('0xd')](_0xb2b2('0x22'),_0x30f7a4,_0x3d8b5a[_0xb2b2('0x23')]);_0x2e2b26[_0xb2b2('0x10')]();}};}; \ No newline at end of file +var _0x05a1=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','join','stop','find','timeout','createQueue','atimeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','log','stack','lodash','seq-queue','../../../../config/logger','routing','string'];(function(_0x401414,_0x59c611){var _0x151616=function(_0x32cf0e){while(--_0x32cf0e){_0x401414['push'](_0x401414['shift']());}};_0x151616(++_0x59c611);}(_0x05a1,0xe2));var _0x105a=function(_0x2fece0,_0x12682c){_0x2fece0=_0x2fece0-0x0;var _0x2f9cd9=_0x05a1[_0x2fece0];return _0x2f9cd9;};'use strict';var schema=require('validate');var _=require(_0x105a('0x0'));var util=require('util');var seqqueue=require(_0x105a('0x1'));var logger=require(_0x105a('0x2'))(_0x105a('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x105a('0x4'),'required':!![],'message':_0x105a('0x5')},'timeout':{'type':_0x105a('0x6'),'message':_0x105a('0x7')}});function writeLog(_0x411d68,_0x9c78e1,_0xa08ab7){return logger[_0x105a('0x8')](util[_0x105a('0x9')](_0x105a('0xa'),_0x411d68,_0x9c78e1[_0x105a('0xb')],_0xa08ab7));}function handleFindAgent(_0x425aef){return function(_0x37ee05){return _0x37ee05[_0x105a('0xb')][_0x105a('0xc')]()===_0x425aef['toLowerCase']();};}exports[_0x105a('0xd')]=function(_0x623942,_0x2324a9,_0x258834,_0x2b09f0){return function(_0x5ae97c){try{var _0x50047c={'name':_0x2324a9[0x0],'timeout':_0x2324a9[0x1]};var _0x248db4=queue[_0x105a('0xe')](_0x50047c,{'typecast':!![]});if(_0x248db4[_0x105a('0xf')]){logger[_0x105a('0x10')](_0x105a('0x11'),_0x623942,_['map'](_0x248db4,'message')[_0x105a('0x12')](',\x20'));_0x5ae97c[_0x105a('0x13')]();}else{var _0x1bce48=_[_0x105a('0x14')](_0x258834['agents'],handleFindAgent(_0x50047c['name']));if(_0x1bce48){var _0x4c39e1=(_0x50047c[_0x105a('0x15')]||0xa)*0x3e8;var _0x74b652,_0x1bf650;var _0xa2ec8f=seqqueue[_0x105a('0x16')](_0x4c39e1);_0xa2ec8f['id']=_0x623942;_0xa2ec8f[_0x105a('0x17')]=_0x4c39e1;_0xa2ec8f['channel']=_0x2b09f0[_0x105a('0x18')];writeLog(_0x623942,_0x1bce48,util[_0x105a('0x9')](_0x105a('0x19'),_0x4c39e1));_0x258834[_0x105a('0x1a')][_0x623942]['on']('end',function(){logger[_0x105a('0x8')](_0x105a('0x1b'),_0x623942);clearTimeout(_0x1bf650);_0x1bf650=undefined;_0xa2ec8f[_0x105a('0x1c')]();if(_0x258834['rules'][_0x623942]){delete _0x258834[_0x105a('0x1a')][_0x623942];}_0x5ae97c[_0x105a('0x13')]();});_0x258834['rules'][_0x623942]['on'](_0x105a('0x1d'),function(){if(_0x258834[_0x105a('0x1a')][_0x623942]){delete _0x258834['rules'][_0x623942];}});_0x1bf650=setTimeout(function(){logger[_0x105a('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x623942);clearTimeout(_0x1bf650);_0xa2ec8f['close']();_0x5ae97c[_0x105a('0x1e')]();},_0x4c39e1);strategy['agent'](_0xa2ec8f,_0x1bce48,_0x258834,_0x2b09f0);}else{logger[_0x105a('0x10')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x623942,_0x50047c['name']);_0x5ae97c[_0x105a('0x13')]();}}}catch(_0x332a78){console[_0x105a('0x1f')](_0x332a78);logger['error']('[%s][QUEUE]\x20%s',_0x623942,_0x332a78[_0x105a('0x20')]);_0x5ae97c[_0x105a('0x13')]();}};}; \ 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 00234d3..d7702a7 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 _0xd4cc=['stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','then','dialogState','Failed','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','created','isEmpty','body','getMustacheRender','Message','create','catch','error','stringify','finally'];(function(_0x29bc8c,_0x1077ab){var _0x528c62=function(_0x1172f8){while(--_0x1172f8){_0x29bc8c['push'](_0x29bc8c['shift']());}};_0x528c62(++_0x1077ab);}(_0xd4cc,0x1b3));var _0xcd4c=function(_0x34f781,_0x178de7){_0x34f781=_0x34f781-0x0;var _0x53eb45=_0xd4cc[_0x34f781];return _0x53eb45;};'use strict';var _=require('lodash');var moment=require(_0xcd4c('0x0'));var AWS=require('aws-sdk');var utils=require(_0xcd4c('0x1'));var logger=require(_0xcd4c('0x2'))(_0xcd4c('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xcd4c('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xcd4c('0x5')),'faxMessage':require(_0xcd4c('0x6')),'whatsappMessage':require(_0xcd4c('0x7'))};exports[_0xcd4c('0x8')]=function(_0x88d163,_0x116155){return function(_0x6ff46c){try{if(!_['isNil'](this[_0xcd4c('0x9')][_0xcd4c('0xa')])){logger[_0xcd4c('0xb')](_0xcd4c('0xc'),_0x88d163,_0xcd4c('0xd'));return _0x6ff46c[_0xcd4c('0xe')]();}var _0x1ae41e={'ContactId':this[_0xcd4c('0xf')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xcd4c('0x10')]===_0xcd4c('0x11')||this[_0xcd4c('0x10')]===_0xcd4c('0x12')){_0x1ae41e[_0xcd4c('0x13')]=this[_0xcd4c('0x9')][_0xcd4c('0x13')];}var _0x342b10=this[_0xcd4c('0x10')];if(_0x342b10===_0xcd4c('0x14')){_0x1ae41e[_0xcd4c('0x15')]=this['account']['id'];}else{_0x1ae41e[_[_0xcd4c('0x16')](_0x342b10)+_0xcd4c('0x17')]=this[_0xcd4c('0x18')]['id'];}_0x1ae41e[_[_0xcd4c('0x16')](_0x342b10)+'InteractionId']=this[_0xcd4c('0x9')]['id'];if(this[_0xcd4c('0x9')][_0xcd4c('0x19')]){var _0x1798b0=_0x116155[0x4];if(!_[_0xcd4c('0x1a')](_0x1798b0)){_0x1ae41e[_0xcd4c('0x1b')]=utils[_0xcd4c('0x1c')](_0x1798b0,this);return rpc[_0x342b10+_0xcd4c('0x1d')][_0xcd4c('0x1e')](_0x1ae41e)['then'](function(_0x205e6c){logger[_0xcd4c('0xb')](_0xcd4c('0xc'),_0x88d163,_0x1ae41e[_0xcd4c('0x1b')]);})[_0xcd4c('0x1f')](function(_0x451feb){logger[_0xcd4c('0x20')]('[%s][AMAZONLEX]\x20%s',_0x88d163,JSON[_0xcd4c('0x21')](_0x451feb));})[_0xcd4c('0x22')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x88d163);_0x6ff46c[_0xcd4c('0x23')]();});}else{logger[_0xcd4c('0xb')](_0xcd4c('0x24'),_0x88d163);_0x6ff46c[_0xcd4c('0x23')]();}}else{var _0x15f166=this;var _0x33d9ea=new AWS[(_0xcd4c('0x25'))]({'accessKeyId':_0x116155[0x0],'secretAccessKey':_0x116155[0x1],'region':_0x116155[0x2]});var _0x349e7e={'botAlias':_0xcd4c('0x26'),'botName':_0x116155[0x3],'inputText':this[_0xcd4c('0x27')][_0xcd4c('0x1b')],'userId':this[_0xcd4c('0x10')]+':'+this[_0xcd4c('0x9')]['id'][_0xcd4c('0x28')]()};_0x33d9ea[_0xcd4c('0x29')](_0x349e7e,function(_0x5af2aa,_0x220c7d){if(_0x5af2aa){logger[_0xcd4c('0x20')](_0xcd4c('0xc'),_0x88d163,_0x5af2aa[_0xcd4c('0x27')]);_0x6ff46c[_0xcd4c('0xe')]();}else if(_0x220c7d&&_0x220c7d[_0xcd4c('0x27')]){_0x15f166[_0xcd4c('0x1b')][_0xcd4c('0x2a')]=_0x220c7d;_0x1ae41e[_0xcd4c('0x1b')]=_0x220c7d[_0xcd4c('0x27')];_0x1ae41e[_0xcd4c('0x2b')]=_0xcd4c('0x2a');_0x1ae41e['providerResponse']=JSON[_0xcd4c('0x21')](_0x220c7d);return rpc[_0x342b10+_0xcd4c('0x1d')][_0xcd4c('0x1e')](_0x1ae41e)[_0xcd4c('0x2c')](function(_0x28ef34){logger[_0xcd4c('0xb')](_0xcd4c('0xc'),_0x88d163,_0x1ae41e['body']);if(_0x220c7d[_0xcd4c('0x2d')]==_0xcd4c('0x2e')){_0x6ff46c[_0xcd4c('0xe')]();}else{_0x6ff46c[_0xcd4c('0x23')]();}})[_0xcd4c('0x1f')](function(_0x628fdd){logger[_0xcd4c('0x20')](_0xcd4c('0xc'),_0x88d163,JSON['stringify'](_0x628fdd));_0x6ff46c[_0xcd4c('0xe')]();});}else{_0x6ff46c[_0xcd4c('0xe')]();}});}}catch(_0x53383b){logger[_0xcd4c('0x20')]('[%s][AMAZONLEX]\x20%s',_0x88d163,JSON['stringify'](_0x53383b));_0x6ff46c[_0xcd4c('0x23')]();}};}; \ No newline at end of file +var _0x8494=['YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','created','isEmpty','body','getMustacheRender','Message','then','error','[%s][AMAZONLEX]\x20%s','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','toString','postText','message','amazonlex','providerResponse','create','dialogState','Failed','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','info','next','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8494,0xa4));var _0x4849=function(_0x24573f,_0x1c334a){_0x24573f=_0x24573f-0x0;var _0x19a80b=_0x8494[_0x24573f];return _0x19a80b;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0x4849('0x0'));var logger=require(_0x4849('0x1'))(_0x4849('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4849('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x4849('0x4')),'faxMessage':require(_0x4849('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x4849('0x6')]=function(_0x4e8d54,_0x4fdbcb){return function(_0xc519be){try{if(!_['isNil'](this[_0x4849('0x7')][_0x4849('0x8')])){logger[_0x4849('0x9')]('[%s][AMAZONLEX]\x20%s',_0x4e8d54,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xc519be[_0x4849('0xa')]();}var _0x1ab0fe={'ContactId':this['contact']['id'],'sentAt':moment()[_0x4849('0xb')](_0x4849('0xc')),'direction':_0x4849('0xd')};if(this['channel']===_0x4849('0xe')||this[_0x4849('0xf')]===_0x4849('0x10')){_0x1ab0fe['phone']=this['interaction'][_0x4849('0x11')];}var _0x6d87ef=this['channel'];if(_0x6d87ef===_0x4849('0x12')){_0x1ab0fe[_0x4849('0x13')]=this[_0x4849('0x14')]['id'];}else{_0x1ab0fe[_['upperFirst'](_0x6d87ef)+_0x4849('0x15')]=this[_0x4849('0x14')]['id'];}_0x1ab0fe[_['upperFirst'](_0x6d87ef)+'InteractionId']=this[_0x4849('0x7')]['id'];if(this[_0x4849('0x7')][_0x4849('0x16')]){var _0x140dc6=_0x4fdbcb[0x4];if(!_[_0x4849('0x17')](_0x140dc6)){_0x1ab0fe[_0x4849('0x18')]=utils[_0x4849('0x19')](_0x140dc6,this);return rpc[_0x6d87ef+_0x4849('0x1a')]['create'](_0x1ab0fe)[_0x4849('0x1b')](function(_0x37c0ed){logger[_0x4849('0x9')]('[%s][AMAZONLEX]\x20%s',_0x4e8d54,_0x1ab0fe['body']);})['catch'](function(_0x363489){logger[_0x4849('0x1c')](_0x4849('0x1d'),_0x4e8d54,JSON[_0x4849('0x1e')](_0x363489));})['finally'](function(){logger['info'](_0x4849('0x1f'),_0x4e8d54);_0xc519be[_0x4849('0x20')]();});}else{logger['info'](_0x4849('0x21'),_0x4e8d54);_0xc519be[_0x4849('0x20')]();}}else{var _0x4f827b=this;var _0x6900d2=new AWS[(_0x4849('0x22'))]({'accessKeyId':_0x4fdbcb[0x0],'secretAccessKey':_0x4fdbcb[0x1],'region':_0x4fdbcb[0x2]});var _0x5cd4c2={'botAlias':_0x4849('0x23'),'botName':_0x4fdbcb[0x3],'inputText':this['message'][_0x4849('0x18')],'userId':this[_0x4849('0xf')]+':'+this[_0x4849('0x7')]['id'][_0x4849('0x24')]()};_0x6900d2[_0x4849('0x25')](_0x5cd4c2,function(_0x23389e,_0x1daee7){if(_0x23389e){logger[_0x4849('0x1c')](_0x4849('0x1d'),_0x4e8d54,_0x23389e[_0x4849('0x26')]);_0xc519be['next']();}else if(_0x1daee7&&_0x1daee7[_0x4849('0x26')]){_0x4f827b[_0x4849('0x18')][_0x4849('0x27')]=_0x1daee7;_0x1ab0fe[_0x4849('0x18')]=_0x1daee7[_0x4849('0x26')];_0x1ab0fe['providerName']=_0x4849('0x27');_0x1ab0fe[_0x4849('0x28')]=JSON['stringify'](_0x1daee7);return rpc[_0x6d87ef+_0x4849('0x1a')][_0x4849('0x29')](_0x1ab0fe)['then'](function(_0x4ef2e1){logger[_0x4849('0x9')](_0x4849('0x1d'),_0x4e8d54,_0x1ab0fe['body']);if(_0x1daee7[_0x4849('0x2a')]==_0x4849('0x2b')){_0xc519be['next']();}else{_0xc519be[_0x4849('0x20')]();}})['catch'](function(_0x4fdb23){logger[_0x4849('0x1c')](_0x4849('0x1d'),_0x4e8d54,JSON[_0x4849('0x1e')](_0x4fdb23));_0xc519be['next']();});}else{_0xc519be['next']();}});}}catch(_0x163eac){logger[_0x4849('0x1c')](_0x4849('0x1d'),_0x4e8d54,JSON[_0x4849('0x1e')](_0x163eac));_0xc519be['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index a58e3fc..0fac2b1 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 _0xb024=['Message','inReplyTo','messageId','html','','replace','','auto_reply','sendMailMessage','create','then','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stringify','[%s][AUTOREPLY]\x20%s','stop','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','created','interaction','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0x26fb2b,_0x52deea){var _0x4afd06=function(_0x3f5c1d){while(--_0x3f5c1d){_0x26fb2b['push'](_0x26fb2b['shift']());}};_0x4afd06(++_0x52deea);}(_0xb024,0x1e5));var _0x4b02=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xb024[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var moment=require(_0x4b02('0x0'));var utils=require(_0x4b02('0x1'));var logger=require('../../../../config/logger')(_0x4b02('0x2'));var rpc={'chatMessage':require(_0x4b02('0x3')),'openchannelMessage':require(_0x4b02('0x4')),'mailMessage':require(_0x4b02('0x5')),'smsMessage':require(_0x4b02('0x6')),'faxMessage':require(_0x4b02('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x4b02('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x4b02('0x9')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x4b02('0xa'))};var mailRpc=require(_0x4b02('0xb'));exports[_0x4b02('0xc')]=function(_0x5b2dad,_0xb7811e,_0x52b67a,_0x229521){return function(_0x1086d4){try{var _0x491bf3=this[_0x4b02('0xd')];if(_0x491bf3===_0x4b02('0xe')&&_0x229521[_0x4b02('0xf')][_0x4b02('0x10')]){logger[_0x4b02('0x11')]('[%s][AUTOREPLY]\x20%s',_0x5b2dad,_0x4b02('0x12'));return _0x1086d4['next']();}if(_0xb7811e[0x0]==='1'&&(_[_0x4b02('0x13')](this['interaction'][_0x4b02('0x14')])||!this[_0x4b02('0x15')][_0x4b02('0x14')])){logger[_0x4b02('0x11')]('[%s][AUTOREPLY]\x20%s',_0x5b2dad,_0x4b02('0x16'));return _0x1086d4[_0x4b02('0x17')]();}if(_0xb7811e[0x0]==='2'&&this['interaction'][_0x4b02('0x18')]){logger['info'](_0x4b02('0x19'),_0x5b2dad,_0x4b02('0x1a'));return _0x1086d4[_0x4b02('0x17')]();}var _0x3c4e4f={'ContactId':this['contact']['id'],'sentAt':moment()[_0x4b02('0x1b')](_0x4b02('0x1c')),'direction':_0x4b02('0x1d')};if(this[_0x4b02('0xd')]==='mail'){_0x3c4e4f[_0x4b02('0xf')]=utils[_0x4b02('0x1e')](_0xb7811e[0x2],this);}else{_0x3c4e4f['body']=utils[_0x4b02('0x1e')](_0xb7811e[0x1],this);}if(this['message']){_0x3c4e4f['to']=this[_0x4b02('0x1f')][_0x4b02('0x20')]||'';if(this[_0x4b02('0xd')]==='mail'&&_0xb7811e[0x1]==='1'){_0x3c4e4f['cc']=this[_0x4b02('0x1f')]['cc']||'';}_0x3c4e4f['from']=this[_0x4b02('0x1f')]['to']||'';_0x3c4e4f[_0x4b02('0x21')]=this[_0x4b02('0x1f')][_0x4b02('0x21')]||'';_0x3c4e4f[_0x4b02('0x22')]=!![];if(this[_0x4b02('0x1f')][_0x4b02('0x23')]){_0x3c4e4f[_0x4b02('0x23')]='';_0x3c4e4f[_0x4b02('0x23')]+=_[_0x4b02('0x24')](this['message']['subject'],_0x4b02('0x25'))?'':'Re:\x20';_0x3c4e4f[_0x4b02('0x23')]+=this[_0x4b02('0x1f')][_0x4b02('0x23')];}}if(this[_0x4b02('0xd')]===_0x4b02('0x26')){_0x3c4e4f[_0x4b02('0x27')]=this[_0x4b02('0x28')]['id'];}else{_0x3c4e4f[_[_0x4b02('0x29')](this['channel'])+_0x4b02('0x2a')]=this[_0x4b02('0x28')]['id'];}_0x3c4e4f[_['upperFirst'](this[_0x4b02('0xd')])+'InteractionId']=this[_0x4b02('0x15')]['id'];var _0x399969=this[_0x4b02('0x15')];if(rpc[this['channel']+_0x4b02('0x2b')]){if(this[_0x4b02('0xd')]===_0x4b02('0xe')){_0x3c4e4f[_0x4b02('0x2c')]=this[_0x4b02('0x1f')][_0x4b02('0x2d')];_0x3c4e4f[_0x4b02('0x2e')]=_0x4b02('0x2f')+_[_0x4b02('0x30')](_0x3c4e4f[_0x4b02('0xf')],'','','headers','auto-replied','All','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT'];(function(_0x563a8e,_0x4dd781){var _0x45baa0=function(_0x36fbf9){while(--_0x36fbf9){_0x563a8e['push'](_0x563a8e['shift']());}};_0x45baa0(++_0x4dd781);}(_0x0670,0x8f));var _0x0067=function(_0x39782f,_0x4aa931){_0x39782f=_0x39782f-0x0;var _0x47768c=_0x0670[_0x39782f];return _0x47768c;};'use strict';var _=require(_0x0067('0x0'));var moment=require(_0x0067('0x1'));var utils=require(_0x0067('0x2'));var logger=require(_0x0067('0x3'))('routing');var rpc={'chatMessage':require(_0x0067('0x4')),'openchannelMessage':require(_0x0067('0x5')),'mailMessage':require(_0x0067('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x0067('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x0067('0x8')),'openchannelInteraction':require(_0x0067('0x9')),'mailInteraction':require(_0x0067('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x0067('0xb'));exports[_0x0067('0xc')]=function(_0x42331c,_0x2c80da,_0x24b143,_0x1fe7c8){return function(_0x58890b){try{var _0x3be1c2=this[_0x0067('0xd')];if(_0x3be1c2===_0x0067('0xe')&&_0x1fe7c8[_0x0067('0xf')][_0x0067('0x10')]){logger[_0x0067('0x11')]('[%s][AUTOREPLY]\x20%s',_0x42331c,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x58890b[_0x0067('0x12')]();}if(_0x2c80da[0x0]==='1'&&(_[_0x0067('0x13')](this[_0x0067('0x14')][_0x0067('0x15')])||!this[_0x0067('0x14')]['created'])){logger[_0x0067('0x11')](_0x0067('0x16'),_0x42331c,_0x0067('0x17'));return _0x58890b[_0x0067('0x12')]();}if(_0x2c80da[0x0]==='2'&&this[_0x0067('0x14')][_0x0067('0x18')]){logger[_0x0067('0x11')](_0x0067('0x19'),_0x42331c,_0x0067('0x1a'));return _0x58890b[_0x0067('0x12')]();}var _0x21b362={'ContactId':this[_0x0067('0x1b')]['id'],'sentAt':moment()['format'](_0x0067('0x1c')),'direction':_0x0067('0x1d')};if(this[_0x0067('0xd')]===_0x0067('0xe')){_0x21b362['body']=utils[_0x0067('0x1e')](_0x2c80da[0x2],this);}else{_0x21b362[_0x0067('0xf')]=utils['getMustacheRender'](_0x2c80da[0x1],this);}if(this[_0x0067('0x1f')]){_0x21b362['to']=this[_0x0067('0x1f')][_0x0067('0x20')]||'';if(this['channel']===_0x0067('0xe')&&_0x2c80da[0x1]==='1'){_0x21b362['cc']=this[_0x0067('0x1f')]['cc']||'';}_0x21b362[_0x0067('0x20')]=this['message']['to']||'';_0x21b362[_0x0067('0x21')]=this[_0x0067('0x1f')]['phone']||'';_0x21b362['read']=!![];if(this['message']['subject']){_0x21b362[_0x0067('0x22')]='';_0x21b362[_0x0067('0x22')]+=_[_0x0067('0x23')](this[_0x0067('0x1f')][_0x0067('0x22')],'Re:')?'':_0x0067('0x24');_0x21b362['subject']+=this[_0x0067('0x1f')]['subject'];}}if(this['channel']==='chat'){_0x21b362[_0x0067('0x25')]=this[_0x0067('0x26')]['id'];}else{_0x21b362[_['upperFirst'](this['channel'])+_0x0067('0x27')]=this[_0x0067('0x26')]['id'];}_0x21b362[_[_0x0067('0x28')](this[_0x0067('0xd')])+_0x0067('0x29')]=this[_0x0067('0x14')]['id'];var _0x5497f0=this[_0x0067('0x14')];if(rpc[this['channel']+_0x0067('0x2a')]){if(this[_0x0067('0xd')]===_0x0067('0xe')){_0x21b362[_0x0067('0x2b')]=this[_0x0067('0x1f')]['messageId'];_0x21b362[_0x0067('0x2c')]=_0x0067('0x2d')+_['replace'](_0x21b362['body'],_0x0067('0x2e'),']+(>|$)/g,''),'priorityTrue':_0x1e5996[0x1],'priorityFalse':_0x1e5996[0x2]};var _0x2d8825=gotoif[_0x817d('0x0')](_0xc2d7a3,{'typecast':!![]});if(_0x2d8825['length']){logger[_0x817d('0xd')]('[%s][GOTOIF]\x20%s',_0x3831de,_[_0x817d('0xe')](_0x2d8825,_0x817d('0xf'))[_0x817d('0x10')](',\x20'));_0x45efea['stop']();}else{try{var _0x494671=eval('('+_0xc2d7a3['condition']+')');var _0x15226b=_0x494671?_0xc2d7a3['priorityTrue']:_0xc2d7a3['priorityFalse'];logger[_0x817d('0x11')](_0x817d('0x12'),_0x3831de,_0xc2d7a3[_0x817d('0x13')],_0x494671,_0x15226b||_0x817d('0x14'));if(_0x15226b){var _0x7748ce=_[_0x817d('0x15')](_0x45efea[_0x817d('0x16')](),{'p':_0x15226b});if(_0x7748ce>=0x0){logger['info'](_0x817d('0x17'),_0x3831de,_0x15226b||_0x817d('0x14'),_0x7748ce);_0x45efea[_0x817d('0x14')](_0x7748ce);}else{logger[_0x817d('0x11')](_0x817d('0x18'),_0x3831de,_0x15226b||'next');_0x45efea[_0x817d('0x19')]();}}else{_0x45efea[_0x817d('0x14')]();}}catch(_0x5df02e){logger[_0x817d('0xd')](_0x817d('0x1a'),_0x3831de,_0x5df02e['message']);_0x45efea[_0x817d('0x19')]();}}}catch(_0x4d76fc){logger[_0x817d('0xd')](_0x817d('0x1b'),_0x3831de,JSON[_0x817d('0x1c')](_0x4d76fc));_0x45efea[_0x817d('0x19')]();}};}; \ No newline at end of file +var _0x0fab=['condition','priorityTrue','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join'];(function(_0x1a9e78,_0x180720){var _0x113e06=function(_0x229c64){while(--_0x229c64){_0x1a9e78['push'](_0x1a9e78['shift']());}};_0x113e06(++_0x180720);}(_0x0fab,0x18c));var _0xb0fa=function(_0x4c149d,_0x5bab42){_0x4c149d=_0x4c149d-0x0;var _0x1b0050=_0x0fab[_0x4c149d];return _0x1b0050;};'use strict';var schema=require(_0xb0fa('0x0'));var _=require(_0xb0fa('0x1'));var htmlToText=require(_0xb0fa('0x2'));var utils=require(_0xb0fa('0x3'));var logger=require(_0xb0fa('0x4'))(_0xb0fa('0x5'));var gotoif=schema({'condition':{'type':_0xb0fa('0x6'),'required':!![],'message':_0xb0fa('0x7')},'priorityTrue':{'type':_0xb0fa('0x8'),'message':_0xb0fa('0x9')},'priorityFalse':{'type':'number','message':_0xb0fa('0xa')}});exports['consequence']=function(_0x1a58ce,_0x3d8998){return function(_0x1ff1d2){try{var _0xbe47d9={'condition':htmlToText[_0xb0fa('0xb')](utils[_0xb0fa('0xc')](_0x3d8998[0x0],this),{'wordwrap':![]})[_0xb0fa('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3d8998[0x1],'priorityFalse':_0x3d8998[0x2]};var _0x271832=gotoif[_0xb0fa('0x0')](_0xbe47d9,{'typecast':!![]});if(_0x271832[_0xb0fa('0xe')]){logger[_0xb0fa('0xf')](_0xb0fa('0x10'),_0x1a58ce,_[_0xb0fa('0x11')](_0x271832,_0xb0fa('0x12'))[_0xb0fa('0x13')](',\x20'));_0x1ff1d2['stop']();}else{try{var _0x4a61e5=eval('('+_0xbe47d9[_0xb0fa('0x14')]+')');var _0x2282b0=_0x4a61e5?_0xbe47d9[_0xb0fa('0x15')]:_0xbe47d9[_0xb0fa('0x16')];logger[_0xb0fa('0x17')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1a58ce,_0xbe47d9['condition'],_0x4a61e5,_0x2282b0||_0xb0fa('0x18'));if(_0x2282b0){var _0x104c33=_[_0xb0fa('0x19')](_0x1ff1d2[_0xb0fa('0x1a')](),{'p':_0x2282b0});if(_0x104c33>=0x0){logger[_0xb0fa('0x17')](_0xb0fa('0x1b'),_0x1a58ce,_0x2282b0||'next',_0x104c33);_0x1ff1d2[_0xb0fa('0x18')](_0x104c33);}else{logger['info'](_0xb0fa('0x1c'),_0x1a58ce,_0x2282b0||_0xb0fa('0x18'));_0x1ff1d2[_0xb0fa('0x1d')]();}}else{_0x1ff1d2[_0xb0fa('0x18')]();}}catch(_0x1aeee7){logger['error'](_0xb0fa('0x1e'),_0x1a58ce,_0x1aeee7[_0xb0fa('0x12')]);_0x1ff1d2[_0xb0fa('0x1d')]();}}}catch(_0x579c74){logger[_0xb0fa('0xf')](_0xb0fa('0x10'),_0x1a58ce,JSON[_0xb0fa('0x1f')](_0x579c74));_0x1ff1d2[_0xb0fa('0x1d')]();}};}; \ 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 8e1faf6..8b407e7 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 _0x5903=['info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','validate','lodash','../../../../config/logger','routing','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join'];(function(_0x444e05,_0x1a3c13){var _0x155a39=function(_0x156d52){while(--_0x156d52){_0x444e05['push'](_0x444e05['shift']());}};_0x155a39(++_0x1a3c13);}(_0x5903,0x95));var _0x3590=function(_0x478e9a,_0x304a98){_0x478e9a=_0x478e9a-0x0;var _0x1ab8b1=_0x5903[_0x478e9a];return _0x1ab8b1;};'use strict';var schema=require(_0x3590('0x0'));var _=require(_0x3590('0x1'));var logger=require(_0x3590('0x2'))(_0x3590('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x3590('0x4')]=function(_0x3610c3,_0x4c49ea){return function(_0x2a05ac){try{var _0x56b3d2={'priority':_0x4c49ea[0x0]};var _0x212c7e=gotop['validate'](_0x56b3d2,{'typecast':!![]});if(_0x212c7e[_0x3590('0x5')]){logger[_0x3590('0x6')](_0x3590('0x7'),_0x3610c3,_[_0x3590('0x8')](_0x212c7e,_0x3590('0x9'))[_0x3590('0xa')](',\x20'));_0x2a05ac['stop']();}else{logger[_0x3590('0xb')](_0x3590('0xc'),_0x3610c3,_0x56b3d2[_0x3590('0xd')]);if(_0x56b3d2[_0x3590('0xd')]){var _0x29c829=_[_0x3590('0xe')](_0x2a05ac[_0x3590('0xf')](),{'p':_0x56b3d2[_0x3590('0xd')]});if(_0x29c829>=0x0){logger[_0x3590('0xb')](_0x3590('0x10'),_0x3610c3,_0x56b3d2[_0x3590('0xd')]||_0x3590('0x11'),_0x29c829);_0x2a05ac[_0x3590('0x11')](_0x29c829);}else{logger[_0x3590('0xb')](_0x3590('0x12'),_0x3610c3,_0x56b3d2[_0x3590('0xd')]||_0x3590('0x11'));_0x2a05ac['stop']();}}else{_0x2a05ac[_0x3590('0x11')]();}}}catch(_0x124a35){logger['error'](_0x3590('0x7'),_0x3610c3,JSON['stringify'](_0x124a35));_0x2a05ac[_0x3590('0x13')]();}};}; \ No newline at end of file +var _0x5b2c=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][GOTOP]\x20%s','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x8abf50,_0x5d0dba){var _0x415bae=function(_0x836fd0){while(--_0x836fd0){_0x8abf50['push'](_0x8abf50['shift']());}};_0x415bae(++_0x5d0dba);}(_0x5b2c,0x13e));var _0xc5b2=function(_0x2e2134,_0x7cc51f){_0x2e2134=_0x2e2134-0x0;var _0x3f5b1a=_0x5b2c[_0x2e2134];return _0x3f5b1a;};'use strict';var schema=require('validate');var _=require(_0xc5b2('0x0'));var logger=require(_0xc5b2('0x1'))(_0xc5b2('0x2'));var gotop=schema({'priority':{'type':_0xc5b2('0x3'),'required':!![],'message':_0xc5b2('0x4')}});exports[_0xc5b2('0x5')]=function(_0x4f14ef,_0x4e9869){return function(_0x11c71e){try{var _0x7b421f={'priority':_0x4e9869[0x0]};var _0x13a1f6=gotop[_0xc5b2('0x6')](_0x7b421f,{'typecast':!![]});if(_0x13a1f6[_0xc5b2('0x7')]){logger['error'](_0xc5b2('0x8'),_0x4f14ef,_['map'](_0x13a1f6,_0xc5b2('0x9'))['join'](',\x20'));_0x11c71e[_0xc5b2('0xa')]();}else{logger[_0xc5b2('0xb')](_0xc5b2('0xc'),_0x4f14ef,_0x7b421f[_0xc5b2('0xd')]);if(_0x7b421f[_0xc5b2('0xd')]){var _0x545d99=_[_0xc5b2('0xe')](_0x11c71e[_0xc5b2('0xf')](),{'p':_0x7b421f[_0xc5b2('0xd')]});if(_0x545d99>=0x0){logger[_0xc5b2('0xb')](_0xc5b2('0x10'),_0x4f14ef,_0x7b421f[_0xc5b2('0xd')]||_0xc5b2('0x11'),_0x545d99);_0x11c71e[_0xc5b2('0x11')](_0x545d99);}else{logger[_0xc5b2('0xb')](_0xc5b2('0x12'),_0x4f14ef,_0x7b421f[_0xc5b2('0xd')]||_0xc5b2('0x11'));_0x11c71e[_0xc5b2('0xa')]();}}else{_0x11c71e[_0xc5b2('0x11')]();}}}catch(_0x36be8c){logger[_0xc5b2('0x13')](_0xc5b2('0x8'),_0x4f14ef,JSON[_0xc5b2('0x14')](_0x36be8c));_0x11c71e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index e76fb14..9b39da8 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 _0x6da1=['Message','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','account','AccountId','upperFirst','InteractionId','interaction'];(function(_0xee5d2a,_0x534134){var _0x346948=function(_0x458fdf){while(--_0x458fdf){_0xee5d2a['push'](_0xee5d2a['shift']());}};_0x346948(++_0x534134);}(_0x6da1,0x1b8));var _0x16da=function(_0xcfe8cc,_0xb83aeb){_0xcfe8cc=_0xcfe8cc-0x0;var _0x55ac53=_0x6da1[_0xcfe8cc];return _0x55ac53;};'use strict';var _=require('lodash');var utils=require(_0x16da('0x0'));var logger=require('../../../../config/logger')(_0x16da('0x1'));var rpc={'chatMessage':require(_0x16da('0x2')),'openchannelMessage':require(_0x16da('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x16da('0x4')),'faxMessage':require(_0x16da('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x16da('0x6')]=function(_0x43a2b9,_0x3058f2){return function(_0x57612f){try{var _0x4aa4b0={'body':utils[_0x16da('0x7')](_0x3058f2[0x0],this),'ContactId':this[_0x16da('0x8')]['id']};if(this[_0x16da('0x9')]===_0x16da('0xa')){_0x4aa4b0['ChatWebsiteId']=this[_0x16da('0xb')]['id'];}else{_0x4aa4b0[_['upperFirst'](this[_0x16da('0x9')])+_0x16da('0xc')]=this[_0x16da('0xb')]['id'];}_0x4aa4b0[_[_0x16da('0xd')](this[_0x16da('0x9')])+_0x16da('0xe')]=this[_0x16da('0xf')]['id'];if(rpc[this[_0x16da('0x9')]+_0x16da('0x10')]){return rpc[this[_0x16da('0x9')]+_0x16da('0x10')]['create'](_0x4aa4b0)['then'](function(_0x51face){logger[_0x16da('0x11')](_0x16da('0x12'),_0x43a2b9,_0x4aa4b0[_0x16da('0x13')]);_0x57612f['next']();})[_0x16da('0x14')](function(_0x2a00a9){logger[_0x16da('0x15')]('[%s][MESSAGE]\x20%s',_0x43a2b9,JSON[_0x16da('0x16')](_0x2a00a9));_0x57612f[_0x16da('0x17')]();});}}catch(_0x469178){logger[_0x16da('0x15')]('[%s][MESSAGE]\x20%s',_0x43a2b9,JSON[_0x16da('0x16')](_0x469178));_0x57612f[_0x16da('0x17')]();}};}; \ No newline at end of file +var _0x0053=['../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','catch','error','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage'];(function(_0x207140,_0x4c6556){var _0x39e8cf=function(_0x16b730){while(--_0x16b730){_0x207140['push'](_0x207140['shift']());}};_0x39e8cf(++_0x4c6556);}(_0x0053,0x14b));var _0x3005=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0053[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var utils=require(_0x3005('0x0'));var logger=require(_0x3005('0x1'))(_0x3005('0x2'));var rpc={'chatMessage':require(_0x3005('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3005('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x3005('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x3005('0x6')]=function(_0x54350d,_0x17c82a){return function(_0x3c6aa2){try{var _0xacb443={'body':utils[_0x3005('0x7')](_0x17c82a[0x0],this),'ContactId':this[_0x3005('0x8')]['id']};if(this[_0x3005('0x9')]===_0x3005('0xa')){_0xacb443[_0x3005('0xb')]=this[_0x3005('0xc')]['id'];}else{_0xacb443[_[_0x3005('0xd')](this[_0x3005('0x9')])+_0x3005('0xe')]=this[_0x3005('0xc')]['id'];}_0xacb443[_[_0x3005('0xd')](this['channel'])+'InteractionId']=this[_0x3005('0xf')]['id'];if(rpc[this[_0x3005('0x9')]+_0x3005('0x10')]){return rpc[this[_0x3005('0x9')]+_0x3005('0x10')][_0x3005('0x11')](_0xacb443)[_0x3005('0x12')](function(_0xf2ba06){logger['info'](_0x3005('0x13'),_0x54350d,_0xacb443['body']);_0x3c6aa2['next']();})[_0x3005('0x14')](function(_0x115ed1){logger[_0x3005('0x15')](_0x3005('0x13'),_0x54350d,JSON[_0x3005('0x16')](_0x115ed1));_0x3c6aa2[_0x3005('0x17')]();});}}catch(_0x16de4c){logger[_0x3005('0x15')](_0x3005('0x13'),_0x54350d,JSON['stringify'](_0x16de4c));_0x3c6aa2[_0x3005('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 26eefe5..5a6a17e 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 _0x866e=['getMustacheRender','stringify','stop','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x5ada2f,_0x2ccb88){var _0x4aa8d7=function(_0x371119){while(--_0x371119){_0x5ada2f['push'](_0x5ada2f['shift']());}};_0x4aa8d7(++_0x2ccb88);}(_0x866e,0xd3));var _0xe866=function(_0x4c9925,_0x2f8a0d){_0x4c9925=_0x4c9925-0x0;var _0x2cc564=_0x866e[_0x4c9925];return _0x2cc564;};'use strict';var utils=require('./utils');var logger=require(_0xe866('0x0'))(_0xe866('0x1'));exports[_0xe866('0x2')]=function(_0x3612a9,_0x57780e){return function(_0x59d00e){try{logger[_0xe866('0x3')](_0xe866('0x4'),_0x3612a9,utils[_0xe866('0x5')](_0x57780e[0x0],this));_0x59d00e['next']();}catch(_0x260634){logger['error'](_0xe866('0x4'),_0x3612a9,JSON[_0xe866('0x6')](_0x260634));_0x59d00e[_0xe866('0x7')]();}};}; \ No newline at end of file +var _0xb628=['stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb628,0x10f));var _0x8b62=function(_0xae4cb3,_0x36485d){_0xae4cb3=_0xae4cb3-0x0;var _0x2c08aa=_0xb628[_0xae4cb3];return _0x2c08aa;};'use strict';var utils=require(_0x8b62('0x0'));var logger=require('../../../../config/logger')(_0x8b62('0x1'));exports[_0x8b62('0x2')]=function(_0x5a0daa,_0x4381fa){return function(_0x3936aa){try{logger[_0x8b62('0x3')](_0x8b62('0x4'),_0x5a0daa,utils[_0x8b62('0x5')](_0x4381fa[0x0],this));_0x3936aa[_0x8b62('0x6')]();}catch(_0x52a513){logger[_0x8b62('0x7')]('[%s][NOOP]\x20%s',_0x5a0daa,JSON[_0x8b62('0x8')](_0x52a513));_0x3936aa[_0x8b62('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 c277626..679810b 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 _0x887d=['routing','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','push','capitalize','InteractionId','format','pick','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','remove','../../rpc/mailQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','contact','list','upperFirst','QueueId','channel','interaction','MessageId','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','message','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','stop','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','lodash','util','seq-queue','moment','ioredis','../../../../config/logger'];(function(_0x2d7fb5,_0x308ec6){var _0x4971ff=function(_0x18f503){while(--_0x18f503){_0x2d7fb5['push'](_0x2d7fb5['shift']());}};_0x4971ff(++_0x308ec6);}(_0x887d,0x142));var _0xd887=function(_0xdce64c,_0x1a8f0b){_0xdce64c=_0xdce64c-0x0;var _0x7f7cb3=_0x887d[_0xdce64c];return _0x7f7cb3;};'use strict';var schema=require('validate');var _=require(_0xd887('0x0'));var util=require(_0xd887('0x1'));var seqqueue=require(_0xd887('0x2'));var moment=require(_0xd887('0x3'));var Redis=require(_0xd887('0x4'));var config=require('../../../../config/environment');var logger=require(_0xd887('0x5'))(_0xd887('0x6'));var strategy=require('./strategy');config[_0xd887('0x7')]=_[_0xd887('0x8')](config['redis'],{'host':_0xd887('0x9'),'port':0x18eb});var io=require(_0xd887('0xa'))(new Redis(config[_0xd887('0x7')]));var attributes=['id',_0xd887('0xb'),_0xd887('0xc'),_0xd887('0xd'),_0xd887('0xe'),_0xd887('0xf')];function emit(_0x40d1f5,_0x282daf,_0x19459e){io['to'](_0x40d1f5)[_0xd887('0x10')](_0x282daf,_0x19459e);}function emitChannelQueueInteraction(_0x2616a8,_0x46f603,_0xe134a1,_0x500403,_0x16118c,_0x30c58a,_0xef4b80,_0x1db55b){var _0x50bd73=_[_0xd887('0x11')](_0xe134a1);_0x50bd73[_0xd887('0xb')]=_0x1db55b;_0x50bd73[_0xd887('0xd')]=_0x46f603;_0x50bd73['account']=_0x500403;_0x50bd73['id']=_0x16118c;if(_0x30c58a){attributes[_0xd887('0x12')](_[_0xd887('0x13')](_0x2616a8)+_0xd887('0x14'));_0xef4b80[util[_0xd887('0x15')]('%sQueuesWaitingInteractions',_0x2616a8)][_0x16118c]=_[_0xd887('0x16')](_0x50bd73,attributes);}else{delete _0xef4b80[util[_0xd887('0x15')](_0xd887('0x17'),_0x2616a8)][_0x16118c];}emit(util[_0xd887('0x15')]('%s:queue:%s',_0x2616a8,_0x46f603),util[_0xd887('0x15')](_0xd887('0x18'),_0x2616a8,_0x30c58a?'save':_0xd887('0x19')),_[_0xd887('0x16')](_0x50bd73,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xd887('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xd887('0x1b')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0xd887('0x1c')),'mailInteraction':require(_0xd887('0x1d')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0xd887('0x1e'))};var queue=schema({'name':{'type':_0xd887('0x1f'),'required':!![],'message':_0xd887('0x20')},'timeout':{'type':_0xd887('0x21'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x11a18c,_0x2c8b15,_0x346aea,_0x81fbcb){if(_0x11a18c&&_0x2c8b15&&_0x346aea){_0x2c8b15[_0xd887('0x22')]+=0x1;var _0xce1bc3={'uniqueid':_0x11a18c,'from':_0x346aea[_0xd887('0x23')]?_0x346aea[_0xd887('0x23')][_0xd887('0xe')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x346aea[_0xd887('0x24')]?_0x346aea[_0xd887('0x24')]['id']:null,'ListId':_0x346aea[_0xd887('0x25')]?_0x346aea[_0xd887('0x25')]['id']:null};_0xce1bc3[_[_0xd887('0x26')](_0x346aea['channel'])+_0xd887('0x27')]=_0x2c8b15['id']||null;_0xce1bc3[_[_0xd887('0x26')](_0x346aea[_0xd887('0x28')])+'InteractionId']=_0x346aea[_0xd887('0x29')]?_0x346aea[_0xd887('0x29')]['id']:null;_0xce1bc3[_[_0xd887('0x26')](_0x346aea[_0xd887('0x28')])+_0xd887('0x2a')]=_0x346aea['message']?_0x346aea['message']['id']:null;_0xce1bc3[_[_0xd887('0x26')](_0x346aea[_0xd887('0x28')])+(_0x346aea[_0xd887('0x28')]!==_0xd887('0x2b')?_0xd887('0x2c'):_0xd887('0x2d'))]=_0x346aea[_0xd887('0xc')]?_0x346aea[_0xd887('0xc')]['id']:null;logger[_0xd887('0x2e')](util['format'](_0xd887('0x2f'),_0x11a18c,_0x2c8b15[_0xd887('0x30')]));emitChannelQueueInteraction(_0x346aea['channel'],_0x2c8b15[_0xd887('0x30')],_0xce1bc3,_0x346aea['account'][_0xd887('0x30')],_0x346aea[_0xd887('0x31')]['id'],!![],_0x81fbcb,_0x2c8b15['id']);if(rpc[_0x346aea['channel']+_0xd887('0x32')]){return rpc[_0x346aea[_0xd887('0x28')]+_0xd887('0x32')][_0xd887('0x33')](_0xce1bc3)[_0xd887('0x34')](function(_0x584463){logger[_0xd887('0x35')](_0xd887('0x36'),_0x584463);});}}}function stopRouting(_0x54a0f9,_0x313207,_0x5d70ae,_0x53ae7c){if(_0x54a0f9&&_0x313207){_0x313207[_0xd887('0x22')]-=0x1;var _0x21472c={'leaveAt':moment()['format'](_0xd887('0x37')),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xd887('0x38')};logger[_0xd887('0x2e')](util[_0xd887('0x15')]('[%s][STOP:QUEUE][NAME:%s]',_0x54a0f9,_0x313207['name']));emitChannelQueueInteraction(_0x5d70ae[_0xd887('0x28')],_0x313207[_0xd887('0x30')],_0x5d70ae[_0xd887('0x23')],_0x5d70ae[_0xd887('0xc')][_0xd887('0x30')],_0x5d70ae[_0xd887('0x31')]['id'],![],_0x53ae7c,_0x313207['id']);return rpc[_0x5d70ae[_0xd887('0x28')]+'Interaction'][_0xd887('0x39')](_0x5d70ae[_0xd887('0x29')]['id'],{'queueId':_0x313207['id']})['then'](function(){if(rpc[_0x5d70ae[_0xd887('0x28')]+_0xd887('0x32')]){return rpc[_0x5d70ae[_0xd887('0x28')]+_0xd887('0x32')][_0xd887('0x39')](_0x54a0f9,_0x21472c)['catch'](function(_0x1005b0){logger[_0xd887('0x35')](_0xd887('0x3a'),_0x1005b0);});}});}}function endRouting(_0x3005e9,_0x10032f,_0x50ffdb,_0x1c9992){if(_0x3005e9&&_0x10032f){_0x10032f[_0xd887('0x22')]-=0x1;var _0x52fe23={'leaveAt':moment()[_0xd887('0x15')](_0xd887('0x37')),'exitAt':moment()[_0xd887('0x15')](_0xd887('0x37')),'reason':'timeout'};logger[_0xd887('0x2e')](util[_0xd887('0x15')](_0xd887('0x3b'),_0x3005e9,_0x10032f[_0xd887('0x30')]));emitChannelQueueInteraction(_0x50ffdb['channel'],_0x10032f[_0xd887('0x30')],_0x50ffdb[_0xd887('0x23')],_0x50ffdb[_0xd887('0xc')][_0xd887('0x30')],_0x50ffdb[_0xd887('0x31')]['id'],![],_0x1c9992);if(rpc[_0x50ffdb[_0xd887('0x28')]+_0xd887('0x32')]){return rpc[_0x50ffdb[_0xd887('0x28')]+'QueueReport']['update'](_0x3005e9,_0x52fe23)[_0xd887('0x34')](function(_0x1eabce){logger[_0xd887('0x35')]('update\x20queue\x20report',_0x1eabce);});}}}function handleFindQueue(_0x17de05){return function(_0x24d236){return _0x24d236[_0xd887('0x30')][_0xd887('0x3c')]()===_0x17de05[_0xd887('0x3c')]();};}exports[_0xd887('0x3d')]=function(_0x55577a,_0x27a0d9,_0x557c1c,_0xa2b7fc){return function(_0xa3804a){try{var _0x2bc507={'name':_0x27a0d9[0x0],'timeout':_0x27a0d9[0x1]};var _0x3baa81=queue[_0xd887('0x3e')](_0x2bc507,{'typecast':!![]});if(_0x3baa81[_0xd887('0x3f')]){logger[_0xd887('0x35')](_0xd887('0x40'),_0x55577a,_[_0xd887('0x41')](_0x3baa81,_0xd887('0x31'))[_0xd887('0x42')](',\x20'));_0xa3804a[_0xd887('0x43')]();}else{var _0x52206d=_['find'](_0x557c1c[_0xa2b7fc[_0xd887('0x28')]+_0xd887('0x44')],handleFindQueue(_0x2bc507['name']));if(_0x52206d){startRouting(_0x55577a,_0x52206d,_0xa2b7fc,_0x557c1c);var _0x48e884=(_0x52206d['timeout']||0xa)*0x3e8;var _0x27b006=(_0x2bc507['timeout']||0x14)*0x3e8;var _0x327ab4;if(_0x48e884>_0x27b006){_0x27b006=_0x48e884;}var _0x466b81=seqqueue[_0xd887('0x45')](_0x48e884);_0x466b81['id']=_0x55577a;_0x466b81[_0xd887('0x46')]=_0x48e884;_0x466b81[_0xd887('0x47')]=_0x27b006;_0x466b81['channel']=_0xa2b7fc[_0xd887('0x28')];_0x557c1c[_0xd887('0x48')][_0x55577a]['on'](_0xd887('0x49'),function(){logger[_0xd887('0x2e')](_0xd887('0x4a'),_0x55577a);stopRouting(_0x55577a,_0x52206d,_0xa2b7fc,_0x557c1c);clearTimeout(_0x327ab4);_0x327ab4=undefined;_0x466b81[_0xd887('0x4b')](!![]);if(_0x557c1c[_0xd887('0x48')][_0x55577a]){delete _0x557c1c[_0xd887('0x48')][_0x55577a];}_0xa3804a[_0xd887('0x43')]();});_0x557c1c[_0xd887('0x48')][_0x55577a]['on']('complete',function(){if(_0x557c1c[_0xd887('0x48')][_0x55577a]){delete _0x557c1c['rules'][_0x55577a];}});_0x327ab4=setTimeout(function(){logger[_0xd887('0x2e')](_0xd887('0x4c'),_0x55577a);endRouting(_0x55577a,_0x52206d,_0xa2b7fc,_0x557c1c);clearTimeout(_0x327ab4);_0x466b81[_0xd887('0x4b')](!![]);_0xa3804a[_0xd887('0x4d')]();},_0x27b006);switch(_0x52206d[_0xd887('0x4e')]){case'rrmemory':strategy[_0xd887('0x4f')](_0x466b81,_0x52206d,_0x557c1c,_0xa2b7fc);break;default:strategy[_0xd887('0x50')](_0x466b81,_0x52206d,_0x557c1c,_0xa2b7fc);}}else{logger['error'](_0xd887('0x51'),_0x55577a,_0x2bc507[_0xd887('0x30')]);_0xa3804a['stop']();}}}catch(_0x3af4dc){logger[_0xd887('0x35')]('[%s][QUEUE]\x20%s',_0x55577a,_0x3af4dc['stack']);_0xa3804a[_0xd887('0x43')]();}};}; \ No newline at end of file +var _0x87ef=['clone','push','capitalize','InteractionId','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','then','update\x20queue\x20report','timeout','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','createQueue','rules','end','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from'];(function(_0x537e7e,_0x4b5e85){var _0x5f4787=function(_0x1ca725){while(--_0x1ca725){_0x537e7e['push'](_0x537e7e['shift']());}};_0x5f4787(++_0x4b5e85);}(_0x87ef,0x13f));var _0xf87e=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x87ef[_0x243217];return _0x478029;};'use strict';var schema=require(_0xf87e('0x0'));var _=require('lodash');var util=require(_0xf87e('0x1'));var seqqueue=require(_0xf87e('0x2'));var moment=require(_0xf87e('0x3'));var Redis=require(_0xf87e('0x4'));var config=require(_0xf87e('0x5'));var logger=require(_0xf87e('0x6'))(_0xf87e('0x7'));var strategy=require(_0xf87e('0x8'));config[_0xf87e('0x9')]=_[_0xf87e('0xa')](config['redis'],{'host':_0xf87e('0xb'),'port':0x18eb});var io=require(_0xf87e('0xc'))(new Redis(config[_0xf87e('0x9')]));var attributes=['id',_0xf87e('0xd'),_0xf87e('0xe'),_0xf87e('0xf'),_0xf87e('0x10'),'joinAt'];function emit(_0x6e1408,_0x5677fd,_0x39d896){io['to'](_0x6e1408)['emit'](_0x5677fd,_0x39d896);}function emitChannelQueueInteraction(_0x1e9b81,_0x373d43,_0x537e74,_0x2a214c,_0x5cceaf,_0x186cf4,_0x437ef5,_0x20bf22){var _0x2055f2=_[_0xf87e('0x11')](_0x537e74);_0x2055f2['queue_id']=_0x20bf22;_0x2055f2['queue']=_0x373d43;_0x2055f2[_0xf87e('0xe')]=_0x2a214c;_0x2055f2['id']=_0x5cceaf;if(_0x186cf4){attributes[_0xf87e('0x12')](_[_0xf87e('0x13')](_0x1e9b81)+_0xf87e('0x14'));_0x437ef5[util['format']('%sQueuesWaitingInteractions',_0x1e9b81)][_0x5cceaf]=_[_0xf87e('0x15')](_0x2055f2,attributes);}else{delete _0x437ef5[util[_0xf87e('0x16')]('%sQueuesWaitingInteractions',_0x1e9b81)][_0x5cceaf];}emit(util[_0xf87e('0x16')](_0xf87e('0x17'),_0x1e9b81,_0x373d43),util[_0xf87e('0x16')](_0xf87e('0x18'),_0x1e9b81,_0x186cf4?'save':_0xf87e('0x19')),_[_0xf87e('0x15')](_0x2055f2,attributes));}var rpc={'openchannelQueueReport':require(_0xf87e('0x1a')),'mailQueueReport':require(_0xf87e('0x1b')),'chatQueueReport':require(_0xf87e('0x1c')),'smsQueueReport':require(_0xf87e('0x1d')),'faxQueueReport':require(_0xf87e('0x1e')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0xf87e('0x1f')),'faxInteraction':require(_0xf87e('0x20')),'mailInteraction':require(_0xf87e('0x21')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xf87e('0x22')),'whatsappInteraction':require(_0xf87e('0x23'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xf87e('0x24')},'timeout':{'type':_0xf87e('0x25'),'message':_0xf87e('0x26')}});function startRouting(_0x5dad04,_0x23e56f,_0x4ef633,_0x16bfc7){if(_0x5dad04&&_0x23e56f&&_0x4ef633){_0x23e56f['waiting']+=0x1;var _0x2da0b4={'uniqueid':_0x5dad04,'from':_0x4ef633[_0xf87e('0x27')]?_0x4ef633[_0xf87e('0x27')][_0xf87e('0x10')]:'','joinAt':moment()[_0xf87e('0x16')](_0xf87e('0x28')),'ContactId':_0x4ef633[_0xf87e('0x29')]?_0x4ef633[_0xf87e('0x29')]['id']:null,'ListId':_0x4ef633[_0xf87e('0x2a')]?_0x4ef633[_0xf87e('0x2a')]['id']:null};_0x2da0b4[_[_0xf87e('0x2b')](_0x4ef633[_0xf87e('0x2c')])+_0xf87e('0x2d')]=_0x23e56f['id']||null;_0x2da0b4[_[_0xf87e('0x2b')](_0x4ef633['channel'])+_0xf87e('0x14')]=_0x4ef633[_0xf87e('0x2e')]?_0x4ef633[_0xf87e('0x2e')]['id']:null;_0x2da0b4[_[_0xf87e('0x2b')](_0x4ef633[_0xf87e('0x2c')])+_0xf87e('0x2f')]=_0x4ef633[_0xf87e('0x30')]?_0x4ef633[_0xf87e('0x30')]['id']:null;_0x2da0b4[_[_0xf87e('0x2b')](_0x4ef633[_0xf87e('0x2c')])+(_0x4ef633[_0xf87e('0x2c')]!=='chat'?_0xf87e('0x31'):_0xf87e('0x32'))]=_0x4ef633[_0xf87e('0xe')]?_0x4ef633['account']['id']:null;logger[_0xf87e('0x33')](util[_0xf87e('0x16')](_0xf87e('0x34'),_0x5dad04,_0x23e56f[_0xf87e('0x35')]));emitChannelQueueInteraction(_0x4ef633[_0xf87e('0x2c')],_0x23e56f[_0xf87e('0x35')],_0x2da0b4,_0x4ef633['account'][_0xf87e('0x35')],_0x4ef633[_0xf87e('0x30')]['id'],!![],_0x16bfc7,_0x23e56f['id']);if(rpc[_0x4ef633[_0xf87e('0x2c')]+_0xf87e('0x36')]){return rpc[_0x4ef633[_0xf87e('0x2c')]+_0xf87e('0x36')][_0xf87e('0x37')](_0x2da0b4)[_0xf87e('0x38')](function(_0x3133f1){logger[_0xf87e('0x39')](_0xf87e('0x3a'),_0x3133f1);});}}}function stopRouting(_0x536276,_0x2d63ff,_0x135764,_0x3c1d7d){if(_0x536276&&_0x2d63ff){_0x2d63ff['waiting']-=0x1;var _0x8d801d={'leaveAt':moment()['format'](_0xf87e('0x28')),'acceptAt':moment()[_0xf87e('0x16')](_0xf87e('0x28')),'reason':_0xf87e('0x3b')};logger['info'](util[_0xf87e('0x16')](_0xf87e('0x3c'),_0x536276,_0x2d63ff[_0xf87e('0x35')]));emitChannelQueueInteraction(_0x135764[_0xf87e('0x2c')],_0x2d63ff[_0xf87e('0x35')],_0x135764[_0xf87e('0x27')],_0x135764[_0xf87e('0xe')][_0xf87e('0x35')],_0x135764[_0xf87e('0x30')]['id'],![],_0x3c1d7d,_0x2d63ff['id']);return rpc[_0x135764['channel']+'Interaction'][_0xf87e('0x3d')](_0x135764[_0xf87e('0x2e')]['id'],{'queueId':_0x2d63ff['id']})[_0xf87e('0x3e')](function(){if(rpc[_0x135764['channel']+_0xf87e('0x36')]){return rpc[_0x135764[_0xf87e('0x2c')]+_0xf87e('0x36')][_0xf87e('0x3d')](_0x536276,_0x8d801d)['catch'](function(_0x492af9){logger[_0xf87e('0x39')](_0xf87e('0x3f'),_0x492af9);});}});}}function endRouting(_0x1aa926,_0x22a8fd,_0x412297,_0x1d2445){if(_0x1aa926&&_0x22a8fd){_0x22a8fd['waiting']-=0x1;var _0x178c17={'leaveAt':moment()[_0xf87e('0x16')](_0xf87e('0x28')),'exitAt':moment()[_0xf87e('0x16')](_0xf87e('0x28')),'reason':_0xf87e('0x40')};logger['info'](util[_0xf87e('0x16')]('[%s][END:QUEUE][NAME:%s]',_0x1aa926,_0x22a8fd[_0xf87e('0x35')]));emitChannelQueueInteraction(_0x412297[_0xf87e('0x2c')],_0x22a8fd[_0xf87e('0x35')],_0x412297['body'],_0x412297['account'][_0xf87e('0x35')],_0x412297[_0xf87e('0x30')]['id'],![],_0x1d2445);if(rpc[_0x412297[_0xf87e('0x2c')]+_0xf87e('0x36')]){return rpc[_0x412297[_0xf87e('0x2c')]+'QueueReport'][_0xf87e('0x3d')](_0x1aa926,_0x178c17)[_0xf87e('0x38')](function(_0x58ca6a){logger[_0xf87e('0x39')](_0xf87e('0x3f'),_0x58ca6a);});}}}function handleFindQueue(_0x1adfd2){return function(_0x563591){return _0x563591[_0xf87e('0x35')][_0xf87e('0x41')]()===_0x1adfd2[_0xf87e('0x41')]();};}exports[_0xf87e('0x42')]=function(_0xf5f96d,_0x2a6e69,_0x423e8f,_0x5a1963){return function(_0x1fea6a){try{var _0x251b74={'name':_0x2a6e69[0x0],'timeout':_0x2a6e69[0x1]};var _0x263240=queue['validate'](_0x251b74,{'typecast':!![]});if(_0x263240[_0xf87e('0x43')]){logger[_0xf87e('0x39')](_0xf87e('0x44'),_0xf5f96d,_[_0xf87e('0x45')](_0x263240,_0xf87e('0x30'))[_0xf87e('0x46')](',\x20'));_0x1fea6a['stop']();}else{var _0x5bff24=_[_0xf87e('0x47')](_0x423e8f[_0x5a1963['channel']+'Queues'],handleFindQueue(_0x251b74[_0xf87e('0x35')]));if(_0x5bff24){startRouting(_0xf5f96d,_0x5bff24,_0x5a1963,_0x423e8f);var _0x42ecc1=(_0x5bff24[_0xf87e('0x40')]||0xa)*0x3e8;var _0x3849c0=(_0x251b74['timeout']||0x14)*0x3e8;var _0x43f8c9;if(_0x42ecc1>_0x3849c0){_0x3849c0=_0x42ecc1;}var _0x7ebfc1=seqqueue[_0xf87e('0x48')](_0x42ecc1);_0x7ebfc1['id']=_0xf5f96d;_0x7ebfc1['atimeout']=_0x42ecc1;_0x7ebfc1['qtimeout']=_0x3849c0;_0x7ebfc1[_0xf87e('0x2c')]=_0x5a1963['channel'];_0x423e8f[_0xf87e('0x49')][_0xf5f96d]['on'](_0xf87e('0x4a'),function(){logger[_0xf87e('0x33')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0xf5f96d);stopRouting(_0xf5f96d,_0x5bff24,_0x5a1963,_0x423e8f);clearTimeout(_0x43f8c9);_0x43f8c9=undefined;_0x7ebfc1['close'](!![]);if(_0x423e8f[_0xf87e('0x49')][_0xf5f96d]){delete _0x423e8f[_0xf87e('0x49')][_0xf5f96d];}_0x1fea6a[_0xf87e('0x4b')]();});_0x423e8f['rules'][_0xf5f96d]['on'](_0xf87e('0x4c'),function(){if(_0x423e8f[_0xf87e('0x49')][_0xf5f96d]){delete _0x423e8f[_0xf87e('0x49')][_0xf5f96d];}});_0x43f8c9=setTimeout(function(){logger[_0xf87e('0x33')](_0xf87e('0x4d'),_0xf5f96d);endRouting(_0xf5f96d,_0x5bff24,_0x5a1963,_0x423e8f);clearTimeout(_0x43f8c9);_0x7ebfc1[_0xf87e('0x4e')](!![]);_0x1fea6a['next']();},_0x3849c0);switch(_0x5bff24[_0xf87e('0x4f')]){case _0xf87e('0x50'):strategy['rrmemory'](_0x7ebfc1,_0x5bff24,_0x423e8f,_0x5a1963);break;default:strategy[_0xf87e('0x51')](_0x7ebfc1,_0x5bff24,_0x423e8f,_0x5a1963);}}else{logger[_0xf87e('0x39')](_0xf87e('0x52'),_0xf5f96d,_0x251b74[_0xf87e('0x35')]);_0x1fea6a[_0xf87e('0x4b')]();}}}catch(_0x21c184){logger['error'](_0xf87e('0x44'),_0xf5f96d,_0x21c184[_0xf87e('0x53')]);_0x1fea6a[_0xf87e('0x4b')]();}};}; \ 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 951470c..3f45ec3 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 _0xe5b3=['exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','handleRun','bind','handleTimeout','drained','handleDrained','prototype','push','[%s][AGENT]\x20try\x20with\x20%s','realtime','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','channel','busy','busyQueue','saveWaitingNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','TIMEOUT'];(function(_0x1f2145,_0x46c66e){var _0x24cde9=function(_0x3abb95){while(--_0x3abb95){_0x1f2145['push'](_0x1f2145['shift']());}};_0x24cde9(++_0x46c66e);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2cd17f,_0x3e9c94){_0x2cd17f=_0x2cd17f-0x0;var _0x5bab50=_0xe5b3[_0x2cd17f];return _0x5bab50;};'use strict';var _=require('lodash');var uuid=require(_0x3e5b('0x0'));var util=require(_0x3e5b('0x1'));var logger=require(_0x3e5b('0x2'))(_0x3e5b('0x3'));var Agent=function(_0x2a71ef,_0x3171c5,_0x7f1cc0,_0x1e58ed){this[_0x3e5b('0x4')]=uuid['v4']();this[_0x3e5b('0x5')]=_0x2a71ef;this[_0x3e5b('0x6')]=_0x3171c5;this['realtime']=_0x7f1cc0;this[_0x3e5b('0x3')]=_0x1e58ed;this[_0x3e5b('0x5')]['push'](this[_0x3e5b('0x7')][_0x3e5b('0x8')](this),this[_0x3e5b('0x9')][_0x3e5b('0x8')](this));this['squeue']['on']('timeout',this[_0x3e5b('0x9')][_0x3e5b('0x8')](this));this[_0x3e5b('0x5')]['on'](_0x3e5b('0xa'),this[_0x3e5b('0xb')]['bind'](this));};Agent[_0x3e5b('0xc')]['push']=function(){this[_0x3e5b('0x5')][_0x3e5b('0xd')](this[_0x3e5b('0x7')][_0x3e5b('0x8')](this),this[_0x3e5b('0x9')][_0x3e5b('0x8')](this));};Agent[_0x3e5b('0xc')]['handleDrained']=function(){this[_0x3e5b('0x9')](!![]);};Agent['prototype']['handleRun']=function(){logger['debug'](_0x3e5b('0xe'),this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0x6')]['id']);if(_['isNil'](this[_0x3e5b('0xf')]['agents'][this['agent']['id']])){logger[_0x3e5b('0x10')](_0x3e5b('0x11'),this['squeue']['id'],this[_0x3e5b('0x6')]['id']);setTimeout(this[_0x3e5b('0xd')]['bind'](this),0x3e8);}else{if(this[_0x3e5b('0x3')][_0x3e5b('0x12')]||util['isAgentAvailable'](this['squeue']['id'],this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']],this[_0x3e5b('0x5')][_0x3e5b('0x14')],![])){this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x15')]=!![];this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x16')]=undefined;util[_0x3e5b('0x17')](this['realtime'],this[_0x3e5b('0x3')],this[_0x3e5b('0x6')],this[_0x3e5b('0x5')][_0x3e5b('0x14')]);util['showNotification'](this[_0x3e5b('0x4')],this['squeue']['id'],this[_0x3e5b('0xf')][_0x3e5b('0x13')][this['agent']['id']],null,this[_0x3e5b('0x3')]);util[_0x3e5b('0x18')](this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']],_0x3e5b('0x19')+(this[_0x3e5b('0x3')]['forcedOwnership']?_0x3e5b('0x1a'):''));}else{logger['debug'](_0x3e5b('0x1b'),this['squeue']['id'],this[_0x3e5b('0x6')]['id']);setTimeout(this[_0x3e5b('0xd')][_0x3e5b('0x8')](this),0x3e8);}}};Agent[_0x3e5b('0xc')][_0x3e5b('0x9')]=function(_0x3cfaf6){if(_[_0x3e5b('0x1c')](this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']])){return logger[_0x3e5b('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0x6')]['id']);}else{logger[_0x3e5b('0x10')](_0x3e5b('0x1d'),this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0x6')]['id']);util[_0x3e5b('0x1e')](this['notificationId'],this[_0x3e5b('0x5')]['id'],this['realtime']['agents'][this[_0x3e5b('0x6')]['id']],null,this[_0x3e5b('0x3')]);this['realtime'][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x15')]=![];this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x16')]=undefined;util[_0x3e5b('0x1f')](this[_0x3e5b('0xf')],this[_0x3e5b('0x3')],this[_0x3e5b('0x6')],this[_0x3e5b('0x5')]['channel']);util[_0x3e5b('0x18')](this[_0x3e5b('0x5')]['id'],this['realtime']['agents'][this[_0x3e5b('0x6')]['id']],_0x3cfaf6?'STOP':_0x3e5b('0x20'));}if(!_0x3cfaf6){setTimeout(this[_0x3e5b('0xd')][_0x3e5b('0x8')](this),0x3e8);}};function agent(_0x32594a,_0x5389e3,_0x18b07f,_0x4cdcb1){return new Agent(_0x32594a,_0x5389e3,_0x18b07f,_0x4cdcb1);}module[_0x3e5b('0x21')]=agent; \ No newline at end of file +var _0xf021=['routing','notificationId','realtime','squeue','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','forcedOwnership','busyQueue','channel','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','busy','STOP','lodash','uuid','./util','../../../../../config/logger'];(function(_0xa4caec,_0x4a1ea6){var _0x489fd6=function(_0x516e08){while(--_0x516e08){_0xa4caec['push'](_0xa4caec['shift']());}};_0x489fd6(++_0x4a1ea6);}(_0xf021,0x18f));var _0x1f02=function(_0xcf131b,_0x45d38f){_0xcf131b=_0xcf131b-0x0;var _0x52844d=_0xf021[_0xcf131b];return _0x52844d;};'use strict';var _=require(_0x1f02('0x0'));var uuid=require(_0x1f02('0x1'));var util=require(_0x1f02('0x2'));var logger=require(_0x1f02('0x3'))(_0x1f02('0x4'));var Agent=function(_0x53cc42,_0x1027d2,_0x54cd44,_0x2e8594){this[_0x1f02('0x5')]=uuid['v4']();this['squeue']=_0x53cc42;this['agent']=_0x1027d2;this[_0x1f02('0x6')]=_0x54cd44;this['routing']=_0x2e8594;this[_0x1f02('0x7')][_0x1f02('0x8')](this[_0x1f02('0x9')][_0x1f02('0xa')](this),this[_0x1f02('0xb')]['bind'](this));this[_0x1f02('0x7')]['on']('timeout',this['handleTimeout']['bind'](this));this[_0x1f02('0x7')]['on'](_0x1f02('0xc'),this[_0x1f02('0xd')][_0x1f02('0xa')](this));};Agent[_0x1f02('0xe')]['push']=function(){this[_0x1f02('0x7')][_0x1f02('0x8')](this[_0x1f02('0x9')]['bind'](this),this[_0x1f02('0xb')][_0x1f02('0xa')](this));};Agent[_0x1f02('0xe')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x1f02('0x9')]=function(){logger[_0x1f02('0xf')](_0x1f02('0x10'),this[_0x1f02('0x7')]['id'],this[_0x1f02('0x11')]['id']);if(_[_0x1f02('0x12')](this[_0x1f02('0x6')][_0x1f02('0x13')][this['agent']['id']])){logger[_0x1f02('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x1f02('0xa')](this),0x3e8);}else{if(this[_0x1f02('0x4')][_0x1f02('0x14')]||util['isAgentAvailable'](this[_0x1f02('0x7')]['id'],this[_0x1f02('0x6')][_0x1f02('0x13')][this[_0x1f02('0x11')]['id']],this['squeue']['channel'],![])){this[_0x1f02('0x6')][_0x1f02('0x13')][this['agent']['id']]['busy']=!![];this[_0x1f02('0x6')][_0x1f02('0x13')][this[_0x1f02('0x11')]['id']][_0x1f02('0x15')]=undefined;util['saveWaitingNotification'](this[_0x1f02('0x6')],this[_0x1f02('0x4')],this[_0x1f02('0x11')],this[_0x1f02('0x7')][_0x1f02('0x16')]);util[_0x1f02('0x17')](this[_0x1f02('0x5')],this['squeue']['id'],this[_0x1f02('0x6')][_0x1f02('0x13')][this['agent']['id']],null,this[_0x1f02('0x4')]);util[_0x1f02('0x18')](this['squeue']['id'],this['realtime'][_0x1f02('0x13')][this[_0x1f02('0x11')]['id']],_0x1f02('0x19')+(this[_0x1f02('0x4')][_0x1f02('0x14')]?_0x1f02('0x1a'):''));}else{logger[_0x1f02('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x1f02('0x8')][_0x1f02('0xa')](this),0x3e8);}}};Agent[_0x1f02('0xe')]['handleTimeout']=function(_0x5c2c42){if(_[_0x1f02('0x12')](this[_0x1f02('0x6')][_0x1f02('0x13')][this[_0x1f02('0x11')]['id']])){return logger[_0x1f02('0xf')](_0x1f02('0x1b'),this[_0x1f02('0x7')]['id'],this[_0x1f02('0x11')]['id']);}else{logger[_0x1f02('0xf')](_0x1f02('0x1c'),this['squeue']['id'],this[_0x1f02('0x11')]['id']);util['hideNotification'](this[_0x1f02('0x5')],this[_0x1f02('0x7')]['id'],this[_0x1f02('0x6')][_0x1f02('0x13')][this[_0x1f02('0x11')]['id']],null,this[_0x1f02('0x4')]);this['realtime']['agents'][this[_0x1f02('0x11')]['id']][_0x1f02('0x1d')]=![];this['realtime'][_0x1f02('0x13')][this['agent']['id']][_0x1f02('0x15')]=undefined;util['removeWaitingNotification'](this[_0x1f02('0x6')],this['routing'],this['agent'],this[_0x1f02('0x7')][_0x1f02('0x16')]);util[_0x1f02('0x18')](this[_0x1f02('0x7')]['id'],this['realtime'][_0x1f02('0x13')][this[_0x1f02('0x11')]['id']],_0x5c2c42?_0x1f02('0x1e'):'TIMEOUT');}if(!_0x5c2c42){setTimeout(this[_0x1f02('0x8')][_0x1f02('0xa')](this),0x3e8);}};function agent(_0x2a82fa,_0x390686,_0x4292b7,_0x2dbdc5){return new Agent(_0x2a82fa,_0x390686,_0x4292b7,_0x2dbdc5);}module['exports']=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 b341c85..83229b4 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 _0x4c6f=['length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','name','saveWaitingNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','timeout','handleTimeout','bind','handleDrained','prototype','handleRun','isNil','Agents'];(function(_0x358a0a,_0x4cffea){var _0x41a6ad=function(_0x3f78c0){while(--_0x3f78c0){_0x358a0a['push'](_0x358a0a['shift']());}};_0x41a6ad(++_0x4cffea);}(_0x4c6f,0x7e));var _0xf4c6=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0x4c6f[_0x5e9a69];return _0x5979c8;};'use strict';var _=require(_0xf4c6('0x0'));var uuid=require(_0xf4c6('0x1'));var util=require(_0xf4c6('0x2'));var logger=require(_0xf4c6('0x3'))(_0xf4c6('0x4'));var Beepall=function(_0x4d3865,_0x3c7254,_0x29e12c,_0x5dd5a8){this[_0xf4c6('0x5')]=uuid['v4']();this[_0xf4c6('0x6')]=_0x4d3865;this[_0xf4c6('0x7')]=_0x3c7254;this[_0xf4c6('0x8')]=_0x29e12c;this[_0xf4c6('0x4')]=_0x5dd5a8;this[_0xf4c6('0x6')][_0xf4c6('0x9')](this['handleRun']['bind'](this),this['handleTimeout']['bind'](this));this['squeue']['on'](_0xf4c6('0xa'),this[_0xf4c6('0xb')][_0xf4c6('0xc')](this));this[_0xf4c6('0x6')]['on']('drained',this[_0xf4c6('0xd')][_0xf4c6('0xc')](this));};Beepall[_0xf4c6('0xe')][_0xf4c6('0x9')]=function(){this[_0xf4c6('0x6')]['push'](this[_0xf4c6('0xf')][_0xf4c6('0xc')](this),this[_0xf4c6('0xb')][_0xf4c6('0xc')](this));};Beepall[_0xf4c6('0xe')][_0xf4c6('0xd')]=function(){this['handleTimeout'](!![]);};Beepall[_0xf4c6('0xe')][_0xf4c6('0xf')]=function(){var _0x2f04dd=!![];if(!_[_0xf4c6('0x10')](this['queue'])&&!_[_0xf4c6('0x10')](this[_0xf4c6('0x7')][_0xf4c6('0x11')])&&this['queue']['Agents']['length']>0x0){for(var _0xca09b4=0x0,_0x3e615f;_0xca09b40x0){for(var _0x11ab13=0x0,_0x2fb09c;_0x11ab130x0&&_0x307d7e[_0x4e6f4c+_0xa0a9('0x20')]>=_0x307d7e[_0x4e6f4c+'Capacity']){writeLog(_0x54a9a9,_0x307d7e,_0x4e6f4c[_0xa0a9('0x22')]()+_0xa0a9('0x23'));return![];}}return!![];};exports[_0xa0a9('0x24')]=function(_0x3f4bea,_0x526dd1,_0x35a915,_0x38e454,_0x2eae30){return sendNotification(!![],_0x3f4bea,_0x526dd1,_0x35a915,_0x38e454,_0x2eae30);};exports['hideNotification']=function(_0x54125d,_0x2b3cbb,_0x3ba07e,_0x10bbfd,_0x38e342){return sendNotification(![],_0x54125d,_0x2b3cbb,_0x3ba07e,_0x10bbfd,_0x38e342);};exports[_0xa0a9('0x25')]=function(_0xe218ff,_0x2386c9,_0x24e744){var _0xc6a4=_0x2386c9[_0xa0a9('0x26')][_0xa0a9('0x27')];if(!_0xc6a4&&_0x24e744){_0xc6a4=_0x24e744['id'];}var _0x554191=_[_0xa0a9('0x28')](_0xe218ff[_0x2386c9[_0xa0a9('0x29')]+'QueuesWaitingInteractions'],function(_0x2f21ea){var _0x122f56=_['capitalize'](_0x2386c9['channel'])+_0xa0a9('0x2a');return _0x2f21ea[_0x122f56]===_0x2386c9['interaction']['id'];});if(!_0x554191&&_0xc6a4&&_0xe218ff['agents'][_0xc6a4]){_0x554191=_[_0xa0a9('0x28')](_0xe218ff[_0xa0a9('0x2b')][_0xc6a4][_0x2386c9[_0xa0a9('0x29')]+_0xa0a9('0x2c')],function(_0x37f2d){return _0x37f2d['id']===_0x2386c9[_0xa0a9('0x26')]['id'];});}return _0x554191;};exports[_0xa0a9('0x2d')]=function(_0x4bbcc2,_0x366ba9,_0x1b2f64,_0x539807){if(_0x1b2f64&&_0x1b2f64['id']&&_0x4bbcc2[_0xa0a9('0x2b')]&&_0x4bbcc2[_0xa0a9('0x2b')][_0x1b2f64['id']]){_0x4bbcc2[_0xa0a9('0x2b')][_0x1b2f64['id']][_0x539807+'WaitingInteractions'][_0x366ba9['message']['id']]={'id':_0x366ba9[_0xa0a9('0x26')]['id']};}};exports[_0xa0a9('0x2e')]=function(_0x2cab58,_0x42fd7a,_0x520817,_0x70a275){if(_0x520817&&_0x520817['id']&&_0x2cab58[_0xa0a9('0x2b')]&&_0x2cab58[_0xa0a9('0x2b')][_0x520817['id']]){delete _0x2cab58['agents'][_0x520817['id']][_0x70a275+_0xa0a9('0x2c')][_0x42fd7a[_0xa0a9('0x14')]['id']];}};exports[_0xa0a9('0x2f')]=writeLog; \ No newline at end of file +var _0xa74a=['some','saveWaitingNotification','agents','WaitingInteractions','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','redis','defaults','user:%s','emit','user:save','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','format','[%s][QUEUE]\x20%s','message','name','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','interaction','UserId','channel','capitalize','InteractionId'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa74a,0x66));var _0xaa74=function(_0x316b81,_0x280f2e){_0x316b81=_0x316b81-0x0;var _0x55fe22=_0xa74a[_0x316b81];return _0x55fe22;};'use strict';var _=require(_0xaa74('0x0'));var util=require(_0xaa74('0x1'));var utils=require(_0xaa74('0x2'));var Redis=require(_0xaa74('0x3'));var config=require(_0xaa74('0x4'));var logger=require(_0xaa74('0x5'))('routing');config[_0xaa74('0x6')]=_[_0xaa74('0x7')](config[_0xaa74('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaa74('0x6')]));function sendNotification(_0x44250c,_0x44002b,_0x3aca05,_0x10e7ce,_0x5a3684,_0x197336){io['to'](util['format'](_0xaa74('0x8'),_0x10e7ce['name']))[_0xaa74('0x9')](_0xaa74('0xa'),_0x10e7ce);var _0x4e5c4e=_0x197336||{};var _0x45fb8b=_0x3aca05['split']('.');var _0x3fc80e={'uniqueid':_0x44002b,'channel':_0x45fb8b[0x0],'id':_0x45fb8b[0x1],'title':_0x45fb8b[0x0]+_0xaa74('0xb'),'interactionId':_0x45fb8b[0x2],'queue':_0x5a3684?_0x5a3684['name']:null,'sound':_0x4e5c4e[_0xaa74('0xc')][_0xaa74('0xd')],'shake':_0x4e5c4e[_0xaa74('0xc')][_0xaa74('0xe')]};try{if(!_0x4e5c4e[_0xaa74('0xf')]){_0x4e5c4e[_0xaa74('0xf')]={};}if(_0x5a3684){_0x4e5c4e[_0xaa74('0xf')][_0xaa74('0x10')]=_0x5a3684;}else if(_0x4e5c4e[_0xaa74('0xf')][_0xaa74('0x10')]){delete _0x4e5c4e[_0xaa74('0xf')]['queue'];}_0x3fc80e[_0xaa74('0x11')]=utils[_0xaa74('0x12')](_0x4e5c4e['account'][_0xaa74('0x13')],_0x4e5c4e);}catch(_0x587a89){_0x3fc80e['msg']='I\x20can\x27t\x20render\x20your\x20template';logger['error'](util[_0xaa74('0x14')](_0xaa74('0x15'),_0x44002b,_0x587a89[_0xaa74('0x16')]));}io['to'](util['format'](_0xaa74('0x8'),_0x10e7ce[_0xaa74('0x17')]))[_0xaa74('0x9')](util['format']('notification:%s',_0x44250c?'save':'remove'),_0x3fc80e);}function writeLog(_0xe1d61e,_0x163f06,_0x2c27dd){return logger[_0xaa74('0x18')](util[_0xaa74('0x14')](_0xaa74('0x19'),_0xe1d61e,_0x163f06[_0xaa74('0x17')],_0x2c27dd));}exports[_0xaa74('0x1a')]=function(_0x512ca1,_0x444596,_0x18f54c,_0x99721e){if(_0x444596[_0xaa74('0x1b')]){writeLog(_0x512ca1,_0x444596,_0xaa74('0x1c'));return![];}if(!_0x444596[_0xaa74('0x1d')]){writeLog(_0x512ca1,_0x444596,_0xaa74('0x1e'));return![];}if(_0x444596[_0x18f54c+_0xaa74('0x1f')]){writeLog(_0x512ca1,_0x444596,_0xaa74('0x20'));return![];}if(_0x99721e&&_0x444596[_0xaa74('0x21')](_0x18f54c+'Capacity')&&_0x444596[_0xaa74('0x21')](_0x18f54c+_0xaa74('0x22'))){if(_0x444596[_0x18f54c+'Capacity']>0x0&&_0x444596[_0x18f54c+_0xaa74('0x22')]>=_0x444596[_0x18f54c+'Capacity']){writeLog(_0x512ca1,_0x444596,_0x18f54c[_0xaa74('0x23')]()+_0xaa74('0x24'));return![];}}return!![];};exports['showNotification']=function(_0x1361d6,_0x393a1f,_0x5e5bfa,_0x5b4738,_0x1ae058){return sendNotification(!![],_0x1361d6,_0x393a1f,_0x5e5bfa,_0x5b4738,_0x1ae058);};exports['hideNotification']=function(_0x40f328,_0x229418,_0x5a313b,_0x40bc29,_0x2eb111){return sendNotification(![],_0x40f328,_0x229418,_0x5a313b,_0x40bc29,_0x2eb111);};exports['checkWaitingNotifications']=function(_0x58e640,_0x34c982,_0x2d1dd1){var _0x220c54=_0x34c982[_0xaa74('0x25')][_0xaa74('0x26')];if(!_0x220c54&&_0x2d1dd1){_0x220c54=_0x2d1dd1['id'];}var _0x25e24f=_['some'](_0x58e640[_0x34c982[_0xaa74('0x27')]+'QueuesWaitingInteractions'],function(_0xa8eefe){var _0x52fdfe=_[_0xaa74('0x28')](_0x34c982[_0xaa74('0x27')])+_0xaa74('0x29');return _0xa8eefe[_0x52fdfe]===_0x34c982[_0xaa74('0x25')]['id'];});if(!_0x25e24f&&_0x220c54&&_0x58e640['agents'][_0x220c54]){_0x25e24f=_[_0xaa74('0x2a')](_0x58e640['agents'][_0x220c54][_0x34c982[_0xaa74('0x27')]+'WaitingInteractions'],function(_0xa27abe){return _0xa27abe['id']===_0x34c982['interaction']['id'];});}return _0x25e24f;};exports[_0xaa74('0x2b')]=function(_0x599610,_0x2f564e,_0x57e646,_0x30fdaa){if(_0x57e646&&_0x57e646['id']&&_0x599610[_0xaa74('0x2c')]&&_0x599610[_0xaa74('0x2c')][_0x57e646['id']]){_0x599610['agents'][_0x57e646['id']][_0x30fdaa+_0xaa74('0x2d')][_0x2f564e[_0xaa74('0x16')]['id']]={'id':_0x2f564e[_0xaa74('0x25')]['id']};}};exports[_0xaa74('0x2e')]=function(_0x4fd713,_0xa093f3,_0xe5e32f,_0x546971){if(_0xe5e32f&&_0xe5e32f['id']&&_0x4fd713[_0xaa74('0x2c')]&&_0x4fd713[_0xaa74('0x2c')][_0xe5e32f['id']]){delete _0x4fd713['agents'][_0xe5e32f['id']][_0x546971+_0xaa74('0x2d')][_0xa093f3['message']['id']];}};exports[_0xaa74('0x2f')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index a4bfd67..e90a790 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 _0xd04b=['join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','[%s][SYSTEM]\x20no\x20variable','body','validate','shelljs','lodash','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message'];(function(_0x5a2655,_0x3e36c3){var _0x4ddb50=function(_0x484f5e){while(--_0x484f5e){_0x5a2655['push'](_0x5a2655['shift']());}};_0x4ddb50(++_0x3e36c3);}(_0xd04b,0x145));var _0xbd04=function(_0x5d0e02,_0x1027e8){_0x5d0e02=_0x5d0e02-0x0;var _0x1c5efa=_0xd04b[_0x5d0e02];return _0x1c5efa;};'use strict';var schema=require(_0xbd04('0x0'));var sh=require(_0xbd04('0x1'));var _=require(_0xbd04('0x2'));var utils=require('./utils');var logger=require(_0xbd04('0x3'))('routing');var system=schema({'command':{'type':_0xbd04('0x4'),'required':!![],'message':_0xbd04('0x5')}});exports[_0xbd04('0x6')]=function(_0xe948b3,_0x36218a){return function(_0x29b317){try{var _0x11d6ce={'command':_0x36218a[0x0]};var _0x2d8811=system[_0xbd04('0x0')](_0x11d6ce,{'typecast':!![]});if(_0x2d8811[_0xbd04('0x7')]){logger[_0xbd04('0x8')]('[%s][SYSTEM]\x20%s',_0xe948b3,_[_0xbd04('0x9')](_0x2d8811,_0xbd04('0xa'))[_0xbd04('0xb')](',\x20'));logger[_0xbd04('0xc')](_0xbd04('0xd'),_0xe948b3);_0x29b317[_0xbd04('0xe')]();}else{var _0x105673=this;var _0x8247fd=utils['getMustacheRender'](_0x36218a[0x0],this);logger[_0xbd04('0xc')](_0xbd04('0xf'),_0xe948b3,_0x8247fd);sh[_0xbd04('0x10')](_[_0xbd04('0x11')](_0x8247fd),function(_0x4f5135,_0x2ec37b){logger[_0xbd04('0xc')](_0xbd04('0x12'),_0xe948b3,_0x4f5135);if(_0x4f5135==0x0){var _0x57baa6=_0x2ec37b['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x36218a[0x1])||_['isEmpty'](_0x36218a[0x1])){logger[_0xbd04('0xc')](_0xbd04('0x13'),_0xe948b3);_0x105673[_0xbd04('0x14')][_0x36218a[0x1]]=_0x57baa6;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0xe948b3,_0x36218a[0x1],_0x57baa6);_0x105673[_0xbd04('0x14')][_0x36218a[0x1]]=_0x57baa6;}}_0x29b317['next']();});}}catch(_0x2fe6bf){logger[_0xbd04('0x8')]('[%s][SYSTEM]\x20%s',_0xe948b3,_['isObject'](_0x2fe6bf)?JSON['stringify'](_0x2fe6bf):_0x2fe6bf);logger[_0xbd04('0xc')](_0xbd04('0xd'),_0xe948b3);_0x29b317[_0xbd04('0xe')]();}};}; \ No newline at end of file +var _0xf969=['message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','info','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject','validate','shelljs','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map'];(function(_0x2fc3ae,_0x42da14){var _0x26175b=function(_0x57fec6){while(--_0x57fec6){_0x2fc3ae['push'](_0x2fc3ae['shift']());}};_0x26175b(++_0x42da14);}(_0xf969,0x13a));var _0x9f96=function(_0x28dcf3,_0x1912aa){_0x28dcf3=_0x28dcf3-0x0;var _0x3a0072=_0xf969[_0x28dcf3];return _0x3a0072;};'use strict';var schema=require(_0x9f96('0x0'));var sh=require(_0x9f96('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require(_0x9f96('0x2'))(_0x9f96('0x3'));var system=schema({'command':{'type':_0x9f96('0x4'),'required':!![],'message':_0x9f96('0x5')}});exports[_0x9f96('0x6')]=function(_0x2ca4c2,_0x4fcda8){return function(_0x1e7518){try{var _0x4439c5={'command':_0x4fcda8[0x0]};var _0x1c927c=system['validate'](_0x4439c5,{'typecast':!![]});if(_0x1c927c[_0x9f96('0x7')]){logger[_0x9f96('0x8')](_0x9f96('0x9'),_0x2ca4c2,_[_0x9f96('0xa')](_0x1c927c,_0x9f96('0xb'))[_0x9f96('0xc')](',\x20'));logger['info'](_0x9f96('0xd'),_0x2ca4c2);_0x1e7518[_0x9f96('0xe')]();}else{var _0x1593ae=this;var _0x141733=utils[_0x9f96('0xf')](_0x4fcda8[0x0],this);logger['info'](_0x9f96('0x10'),_0x2ca4c2,_0x141733);sh[_0x9f96('0x11')](_['trim'](_0x141733),function(_0x372f90,_0x122e1d){logger[_0x9f96('0x12')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x2ca4c2,_0x372f90);if(_0x372f90==0x0){var _0x470584=_0x122e1d[_0x9f96('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x9f96('0x14')](_0x4fcda8[0x1])||_[_0x9f96('0x15')](_0x4fcda8[0x1])){logger[_0x9f96('0x12')](_0x9f96('0x16'),_0x2ca4c2);_0x1593ae[_0x9f96('0x17')][_0x4fcda8[0x1]]=_0x470584;}else{logger[_0x9f96('0x12')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x2ca4c2,_0x4fcda8[0x1],_0x470584);_0x1593ae['body'][_0x4fcda8[0x1]]=_0x470584;}}_0x1e7518[_0x9f96('0xe')]();});}}catch(_0x143ba8){logger[_0x9f96('0x8')](_0x9f96('0x9'),_0x2ca4c2,_[_0x9f96('0x18')](_0x143ba8)?JSON['stringify'](_0x143ba8):_0x143ba8);logger['info'](_0x9f96('0xd'),_0x2ca4c2);_0x1e7518[_0x9f96('0xe')]();}};}; \ 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 54491be..e5a4cfc 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 _0xa54c=['lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','message','join','info','next','Interaction','channel','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','[%s][TAG]\x20%s','stringify','error','isObject'];(function(_0x2c5192,_0x58872f){var _0xf12042=function(_0x4b75ef){while(--_0x4b75ef){_0x2c5192['push'](_0x2c5192['shift']());}};_0xf12042(++_0x58872f);}(_0xa54c,0x1c2));var _0xca54=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0xa54c[_0x9729d7];return _0x3c4ac6;};'use strict';var schema=require('validate');var _=require(_0xca54('0x0'));var rpc={'chatInteraction':require(_0xca54('0x1')),'openchannelInteraction':require(_0xca54('0x2')),'smsInteraction':require(_0xca54('0x3')),'mailInteraction':require(_0xca54('0x4')),'faxInteraction':require(_0xca54('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xca54('0x6'))(_0xca54('0x7'));var tag=schema({'tag':{'type':_0xca54('0x8'),'required':!![],'message':_0xca54('0x9')}});exports[_0xca54('0xa')]=function(_0x8f2df0,_0x4eaa4c,_0x453ae1,_0x1c8293){return function(_0x58a667){try{var _0x51e55c={'tag':_0x4eaa4c[0x0]};var _0x1d0aec=tag[_0xca54('0xb')](_0x51e55c,{'typecast':!![]});if(_0x1d0aec[_0xca54('0xc')]){logger['error']('[%s][TAG]\x20%s',_0x8f2df0,_['map'](_0x1d0aec,_0xca54('0xd'))[_0xca54('0xe')](',\x20'));logger[_0xca54('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x8f2df0);_0x58a667[_0xca54('0x10')]();}else{var _0x1f3b81={'ids':[_0x4eaa4c[0x0]]};if(rpc[_0x1c8293['channel']+_0xca54('0x11')]){rpc[_0x1c8293[_0xca54('0x12')]+'Interaction']['addTags'](_0x1c8293[_0xca54('0x13')]['id'],_0x1f3b81)['then'](function(_0x1e8dd1){logger[_0xca54('0xf')](_0xca54('0x14'),_0x8f2df0,_0x4eaa4c[0x1],_0x1c8293[_0xca54('0x12')],_0x1c8293['interaction']['id']);})['catch'](function(_0x173a85){logger['error'](_0xca54('0x15'),_0x8f2df0,JSON[_0xca54('0x16')](_0x173a85));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x8f2df0);})['finally'](function(){_0x58a667['next']();});}}}catch(_0x5ec38b){logger[_0xca54('0x17')](_0xca54('0x15'),_0x8f2df0,_[_0xca54('0x18')](_0x5ec38b)?JSON[_0xca54('0x16')](_0x5ec38b):_0x5ec38b);logger[_0xca54('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x8f2df0);_0x58a667[_0xca54('0x10')]();}};}; \ No newline at end of file +var _0x0e5f=['interaction','stringify','finally','isObject','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e5f,0x86));var _0xf0e5=function(_0x5a6e4b,_0x442766){_0x5a6e4b=_0x5a6e4b-0x0;var _0x4bf365=_0x0e5f[_0x5a6e4b];return _0x4bf365;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0xf0e5('0x0')),'openchannelInteraction':require(_0xf0e5('0x1')),'smsInteraction':require(_0xf0e5('0x2')),'mailInteraction':require(_0xf0e5('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xf0e5('0x4'))};var logger=require(_0xf0e5('0x5'))(_0xf0e5('0x6'));var tag=schema({'tag':{'type':_0xf0e5('0x7'),'required':!![],'message':_0xf0e5('0x8')}});exports[_0xf0e5('0x9')]=function(_0x37a50b,_0x57837f,_0x3b5af9,_0x50b873){return function(_0x3cea54){try{var _0x45a26a={'tag':_0x57837f[0x0]};var _0x47aa02=tag['validate'](_0x45a26a,{'typecast':!![]});if(_0x47aa02[_0xf0e5('0xa')]){logger[_0xf0e5('0xb')](_0xf0e5('0xc'),_0x37a50b,_[_0xf0e5('0xd')](_0x47aa02,'message')[_0xf0e5('0xe')](',\x20'));logger[_0xf0e5('0xf')](_0xf0e5('0x10'),_0x37a50b);_0x3cea54[_0xf0e5('0x11')]();}else{var _0x8c5779={'ids':[_0x57837f[0x0]]};if(rpc[_0x50b873[_0xf0e5('0x12')]+_0xf0e5('0x13')]){rpc[_0x50b873[_0xf0e5('0x12')]+_0xf0e5('0x13')][_0xf0e5('0x14')](_0x50b873['interaction']['id'],_0x8c5779)['then'](function(_0x2a7197){logger[_0xf0e5('0xf')](_0xf0e5('0x15'),_0x37a50b,_0x57837f[0x1],_0x50b873['channel'],_0x50b873[_0xf0e5('0x16')]['id']);})['catch'](function(_0x5713b8){logger[_0xf0e5('0xb')](_0xf0e5('0xc'),_0x37a50b,JSON[_0xf0e5('0x17')](_0x5713b8));logger[_0xf0e5('0xf')](_0xf0e5('0x10'),_0x37a50b);})[_0xf0e5('0x18')](function(){_0x3cea54[_0xf0e5('0x11')]();});}}}catch(_0x14330c){logger[_0xf0e5('0xb')](_0xf0e5('0xc'),_0x37a50b,_[_0xf0e5('0x19')](_0x14330c)?JSON['stringify'](_0x14330c):_0x14330c);logger[_0xf0e5('0xf')](_0xf0e5('0x10'),_0x37a50b);_0x3cea54[_0xf0e5('0x11')]();}};}; \ 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 a3b464e..81df5af 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 _0x5415=['../../../../config/logger','routing','lodash','consequence','replace','push','urlOnAnswer','?params=','urlOnRing','title','method','login','params','stringify','utf8','POST','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise'];(function(_0x4eee65,_0x412ba0){var _0x1f6a3a=function(_0x22628a){while(--_0x22628a){_0x4eee65['push'](_0x4eee65['shift']());}};_0x1f6a3a(++_0x412ba0);}(_0x5415,0x1db));var _0x5541=function(_0x913765,_0x535119){_0x913765=_0x913765-0x0;var _0x1054aa=_0x5415[_0x913765];return _0x1054aa;};'use strict';var rp=require(_0x5541('0x0'));var logger=require(_0x5541('0x1'))(_0x5541('0x2'));var _=require(_0x5541('0x3'));var arr=[];exports[_0x5541('0x4')]=function(_0x251d3d,_0x4d328d){return function(_0xf654a3){var _0x34aca1=_0x4d328d[0xa];var _0x3cda9d=_0x4d328d[0xb];var _0x5463f4=_0x4d328d[0xc];var _0x4a1e10=_0x4d328d[0xd];var _0x89730=_0x4d328d[0xe];var _0x26c291=_0x4d328d[0xf]['replace'](/\n/g,'\x20-\x20');var _0xf5c1f=_0x4d328d[0x10][_0x5541('0x5')](/\n/g,'\x20');if(!arr['includes'](_0x3cda9d)){arr[_0x5541('0x6')](_0x3cda9d);var _0x453896=_0x4d328d[0x3];var _0x2ead52=_0x4d328d[0x4];var _0x737372=_0x4d328d[0x1];var _0x3499c9=_0x4d328d[0x0];var _0x21738f={};_0x21738f[_0x5541('0x7')]=_0x4d328d[0x8]+_0x5541('0x8')+_0x5463f4+'|'+_0x34aca1+'|'+_0x4a1e10+'|'+_0x3cda9d+'|'+_0x89730;_0x21738f[_0x5541('0x9')]=_0x4d328d[0x7]+_0x5541('0x8')+_0x5463f4+'|'+_0x34aca1+'|'+_0x4a1e10+'|'+_0x3cda9d+'|'+_0x89730+'|'+_0x26c291+'|'+_0xf5c1f;_0x21738f[_0x5541('0xa')]=_0x4d328d[0x9];var _0x1e8e3d={};_0x1e8e3d['jsonrpc']='2.0';_0x1e8e3d[_0x5541('0xb')]=_0x5541('0xc');var _0x2e51bf=[];_0x2e51bf[_0x5541('0x6')](_0x4d328d[0x2]);_0x2e51bf[_0x5541('0x6')](_0x4d328d[0x5]);_0x2e51bf[_0x5541('0x6')](_0x4d328d[0x6]);_0x1e8e3d[_0x5541('0xd')]=_0x2e51bf;_0x1e8e3d['id']=0x1;var _0x33aa37=JSON[_0x5541('0xe')](_0x1e8e3d);var _0x292ff5={'encoding':_0x5541('0xf'),'method':_0x5541('0x10'),'timeout':0x2710,'url':_0x453896,'headers':{'Content-Type':_0x5541('0x11')},'body':_0x33aa37};return rp(_0x292ff5)[_0x5541('0x12')](function(_0x168b43){const _0x4e405d=JSON[_0x5541('0x13')](_0x168b43);if(!_0x4e405d['result'][_0x5541('0x14')]){throw new Error(_0x5541('0x15'));}var _0x395b5f=_0x3cda9d;var _0xd190db=_0x5541('0x16')+_0x737372+_0x5541('0x17')+_0x3499c9+_0x5541('0x18')+_0x395b5f+_0x5541('0x19')+JSON['stringify'](_0x21738f);var _0x5b41c1=_0x2ead52+'?'+_0xd190db;return rp(_0x5b41c1);})[_0x5541('0x12')](function(_0x1336d0){logger[_0x5541('0x1a')](_0x5541('0x1b'),_0x251d3d,_0x1336d0);_0xf654a3[_0x5541('0x1c')]();})[_0x5541('0x1d')](function(_0x12c9d7){logger[_0x5541('0x1e')](_0x5541('0x1f'),_0x251d3d,_['isObject'](_0x12c9d7)?JSON[_0x5541('0xe')](_0x12c9d7):_0x12c9d7);_0xf654a3['stop']();});}else{logger[_0x5541('0x1a')](_0x5541('0x20'),_0x251d3d);_0xf654a3[_0x5541('0x21')]();}};}; \ No newline at end of file +var _0xe35e=['lodash','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','push','params','stringify','utf8','POST','application/json-rpc','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe35e,0xd7));var _0xee35=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0xe35e[_0xcfc44];return _0x307a25;};'use strict';var rp=require(_0xee35('0x0'));var logger=require('../../../../config/logger')('routing');var _=require(_0xee35('0x1'));var arr=[];exports['consequence']=function(_0x49ce9a,_0x2e4b45){return function(_0x335808){var _0x378470=_0x2e4b45[0xa];var _0x4d887c=_0x2e4b45[0xb];var _0x4728ec=_0x2e4b45[0xc];var _0x360606=_0x2e4b45[0xd];var _0x2e9655=_0x2e4b45[0xe];var _0x577526=_0x2e4b45[0xf][_0xee35('0x2')](/\n/g,_0xee35('0x3'));var _0xef42ea=_0x2e4b45[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xee35('0x4')](_0x4d887c)){arr['push'](_0x4d887c);var _0xe0041=_0x2e4b45[0x3];var _0x381f1c=_0x2e4b45[0x4];var _0x1a920e=_0x2e4b45[0x1];var _0x2cece0=_0x2e4b45[0x0];var _0x5d8ad2={};_0x5d8ad2[_0xee35('0x5')]=_0x2e4b45[0x8]+_0xee35('0x6')+_0x4728ec+'|'+_0x378470+'|'+_0x360606+'|'+_0x4d887c+'|'+_0x2e9655;_0x5d8ad2[_0xee35('0x7')]=_0x2e4b45[0x7]+_0xee35('0x6')+_0x4728ec+'|'+_0x378470+'|'+_0x360606+'|'+_0x4d887c+'|'+_0x2e9655+'|'+_0x577526+'|'+_0xef42ea;_0x5d8ad2[_0xee35('0x8')]=_0x2e4b45[0x9];var _0x160986={};_0x160986[_0xee35('0x9')]=_0xee35('0xa');_0x160986[_0xee35('0xb')]=_0xee35('0xc');var _0x66696e=[];_0x66696e[_0xee35('0xd')](_0x2e4b45[0x2]);_0x66696e[_0xee35('0xd')](_0x2e4b45[0x5]);_0x66696e[_0xee35('0xd')](_0x2e4b45[0x6]);_0x160986[_0xee35('0xe')]=_0x66696e;_0x160986['id']=0x1;var _0x590c32=JSON[_0xee35('0xf')](_0x160986);var _0x488714={'encoding':_0xee35('0x10'),'method':_0xee35('0x11'),'timeout':0x2710,'url':_0xe0041,'headers':{'Content-Type':_0xee35('0x12')},'body':_0x590c32};return rp(_0x488714)['then'](function(_0x2fa9f2){const _0x5489e6=JSON[_0xee35('0x13')](_0x2fa9f2);if(!_0x5489e6[_0xee35('0x14')][_0xee35('0x15')]){throw new Error(_0xee35('0x16'));}var _0x1fb503=_0x4d887c;var _0x28cfa8=_0xee35('0x17')+_0x1a920e+_0xee35('0x18')+_0x2cece0+_0xee35('0x19')+_0x1fb503+_0xee35('0x1a')+JSON[_0xee35('0xf')](_0x5d8ad2);var _0x4d454a=_0x381f1c+'?'+_0x28cfa8;return rp(_0x4d454a);})[_0xee35('0x1b')](function(_0xdf4ad2){logger[_0xee35('0x1c')](_0xee35('0x1d'),_0x49ce9a,_0xdf4ad2);_0x335808[_0xee35('0x1e')]();})[_0xee35('0x1f')](function(_0x1cb080){logger[_0xee35('0x20')](_0xee35('0x21'),_0x49ce9a,_[_0xee35('0x22')](_0x1cb080)?JSON[_0xee35('0xf')](_0x1cb080):_0x1cb080);_0x335808[_0xee35('0x1e')]();});}else{logger['info'](_0xee35('0x23'),_0x49ce9a);_0x335808['next']();}};}; \ 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 f83a01b..d9aae08 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x4f308d,_0x2b2c44){var _0x2330dc=function(_0xc7b5e1){while(--_0xc7b5e1){_0x4f308d['push'](_0x4f308d['shift']());}};_0x2330dc(++_0x2b2c44);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0xd20ce0,_0x5c04b5){var _0x34b86d=function(_0x5e5800){while(--_0x5e5800){_0xd20ce0['push'](_0xd20ce0['shift']());}};_0x34b86d(++_0x5c04b5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index c7c72a5..cbacd1c 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 _0x6209=['routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','join','app','.js','toLowerCase','appdata','split','mail','push','slice','length','dialogflow','amazonlex','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','format','./applications/','consequence','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','info','Applications\x20executed','stringify','matchPath','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','emit','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','chatQueues','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','available','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','server','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util'];(function(_0x30317a,_0x346194){var _0x491755=function(_0x198303){while(--_0x198303){_0x30317a['push'](_0x30317a['shift']());}};_0x491755(++_0x346194);}(_0x6209,0x1e8));var _0x9620=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6209[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x9620('0x0'));var util=require(_0x9620('0x1'));var path=require(_0x9620('0x2'));var fs=require('fs');var jayson=require(_0x9620('0x3'));var BPromise=require(_0x9620('0x4'));var utils=require(_0x9620('0x5'));var sUtils=require(_0x9620('0x6'));var logger=require('../../../config/logger')(_0x9620('0x7'));var rpc={'openchannelQueueReport':require(_0x9620('0x8')),'mailQueueReport':require(_0x9620('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x9620('0xa')),'faxQueueReport':require(_0x9620('0xb')),'whatsappQueueReport':require(_0x9620('0xc'))};var RuleEngine=require(_0x9620('0xd'));function getId(_0x488d59,_0x4e9082,_0x11af3d){return util['format'](_0x9620('0xe'),_0x488d59,_0x4e9082||0x0,_0x11af3d||0x0);}function getIntervals(_0x345acb,_0x186b36){var _0x10e8c3=[];if(!_[_0x9620('0xf')](_0x186b36[_0x9620('0x10')])&&!_[_0x9620('0xf')](_0x345acb[_0x186b36['IntervalId']])&&!_[_0x9620('0xf')](_0x345acb[_0x186b36['IntervalId']][_0x9620('0x11')])){_0x10e8c3=_[_0x9620('0x12')](_0x345acb[_0x186b36[_0x9620('0x10')]][_0x9620('0x11')],_0x9620('0x13'));}else if(!_[_0x9620('0xf')](_0x186b36[_0x9620('0x13')])){_0x10e8c3=[_0x186b36[_0x9620('0x13')]];}return _0x10e8c3;}exports[_0x9620('0x14')]=function(_0x2f1f34){_0x2f1f34['rules']={};return new BPromise(function(_0x5aba4e,_0x2b144b){var _0x301805={'Start':function(_0x51f0a7){var _0x6d97fa=this;return new Promise(function(_0x309b4c,_0x34168b){if(_0x51f0a7){try{var _0x1a75d8=[];var _0x4f399c=getId(_0x51f0a7[_0x9620('0x15')],_0x51f0a7[_0x9620('0x16')]?_0x51f0a7['message']['id']:0x0,_0x51f0a7[_0x9620('0x17')]?_0x51f0a7['interaction']['id']:0x0);var _0x10a166=sUtils[_0x9620('0x18')](_0x2f1f34,_0x51f0a7);if(_0x51f0a7[_0x9620('0x19')]||!_0x10a166&&_0x51f0a7[_0x9620('0x1a')]&&_[_0x9620('0x1b')](_0x51f0a7['applications'])&&_0x51f0a7[_0x9620('0x1a')]['length']){for(var _0x519c1e=0x0;_0x519c1e<_0x51f0a7['applications']['length'];_0x519c1e+=0x1){var _0x5c44df=_0x51f0a7[_0x9620('0x1a')][_0x519c1e];if(fs['existsSync'](path[_0x9620('0x1c')](__dirname,_0x9620('0x1a'),_0x5c44df[_0x9620('0x1d')]+_0x9620('0x1e')))){var _0x23f937=[];switch(_0x5c44df[_0x9620('0x1d')][_0x9620('0x1f')]()){case'autoreply':var _0x54bbbf=_0x5c44df[_0x9620('0x20')][_0x9620('0x21')](',');if(_0x51f0a7['channel']===_0x9620('0x22')){_0x23f937[_0x9620('0x23')](_0x54bbbf[0x0]);_0x23f937[_0x9620('0x23')](_0x54bbbf[0x1]);_0x23f937[_0x9620('0x23')](_0x54bbbf[_0x9620('0x24')](0x2,_0x54bbbf[_0x9620('0x25')])[_0x9620('0x1c')](','));}else{_0x23f937[_0x9620('0x23')](_0x54bbbf[0x0]);_0x23f937[_0x9620('0x23')](_0x54bbbf[_0x9620('0x24')](0x1,_0x54bbbf[_0x9620('0x25')])['join'](','));}break;case _0x9620('0x26'):var _0x3e40aa=_0x5c44df[_0x9620('0x20')][_0x9620('0x21')](',');_0x23f937['push'](_0x3e40aa[0x0]);_0x23f937['push'](_0x3e40aa[0x1]);_0x23f937[_0x9620('0x23')](_0x3e40aa['slice'](0x2,_0x3e40aa[_0x9620('0x25')])['join'](','));break;case'dialogflowv2':var _0x2a359f=_0x5c44df[_0x9620('0x20')][_0x9620('0x21')](',');_0x23f937['push'](_0x2a359f[0x0]);_0x23f937[_0x9620('0x23')](_0x2a359f[0x1]);_0x23f937[_0x9620('0x23')](_0x2a359f[0x2]);_0x23f937[_0x9620('0x23')](_0x2a359f[0x3]);_0x23f937['push'](_0x2a359f[_0x9620('0x24')](0x4,_0x2a359f['length'])[_0x9620('0x1c')](','));break;case _0x9620('0x27'):var _0x4e5878=_0x5c44df[_0x9620('0x20')][_0x9620('0x21')](',');_0x23f937[_0x9620('0x23')](_0x4e5878[0x0]);_0x23f937[_0x9620('0x23')](_0x4e5878[0x1]);_0x23f937['push'](_0x4e5878[0x2]);_0x23f937['push'](_0x4e5878[0x3]);_0x23f937['push'](_0x4e5878['slice'](0x4,_0x4e5878[_0x9620('0x25')])[_0x9620('0x1c')](','));break;case'message':_0x23f937[_0x9620('0x23')](_0x5c44df[_0x9620('0x20')]);break;case'tag':_0x23f937[_0x9620('0x23')](_0x5c44df[_0x9620('0x28')]);_0x23f937['push'](_0x5c44df[_0x9620('0x20')]);break;case _0x9620('0x29'):var _0x72d28f=utils[_0x9620('0x2a')](_0x51f0a7['account'][_0x9620('0x2b')],_0x51f0a7);var _0x4d63b8=_0x5c44df[_0x9620('0x20')][_0x9620('0x21')](',');_0x23f937['push'](_0x4d63b8[0x0]);_0x23f937['push'](_0x4d63b8[0x1]);_0x23f937[_0x9620('0x23')](_0x4d63b8[0x2]);_0x23f937[_0x9620('0x23')](_0x4d63b8[0x3]);_0x23f937[_0x9620('0x23')](_0x4d63b8[0x4]);_0x23f937[_0x9620('0x23')](_0x4d63b8[0x5]);_0x23f937[_0x9620('0x23')](_0x4d63b8[0x6]);_0x23f937['push'](_0x4d63b8[0x7]);_0x23f937[_0x9620('0x23')](_0x4d63b8[0x8]);_0x23f937[_0x9620('0x23')](_0x4d63b8[0x9]);_0x23f937[_0x9620('0x23')](_0x4d63b8[0xa]);_0x23f937[_0x9620('0x23')](_0x51f0a7[_0x9620('0x17')]['id']);_0x23f937['push'](_0x51f0a7[_0x9620('0x16')]['id']);_0x23f937[_0x9620('0x23')](_0x5c44df[_0x9620('0x2c')]);_0x23f937['push'](_0x51f0a7[_0x9620('0x17')][_0x9620('0x2d')]);_0x23f937['push'](_0x51f0a7[_0x9620('0x2e')]['body']);_0x23f937[_0x9620('0x23')](_0x72d28f);break;default:_0x23f937=_[_0x9620('0xf')](_0x5c44df[_0x9620('0x20')])?[]:_0x5c44df['appdata'][_0x9620('0x21')](',');}var _0x26876d={'id':util[_0x9620('0x2f')]('%s:%s:%s',_0x4f399c,_0x5c44df['id'],_0x5c44df[_0x9620('0x1d')]),'condition':require('./interval')['condition'](_0x4f399c,getIntervals(_0x2f1f34['intervals'],_0x5c44df),_0x2f1f34),'consequence':require(_0x9620('0x30')+_0x5c44df['app'])[_0x9620('0x31')](_0x4f399c,_0x23f937,_0x2f1f34,_0x51f0a7),'p':_0x5c44df['priority']||0x0};logger['info'](_0x9620('0x32'),_0x26876d['id'],_0x9620('0x33'),getIntervals(_0x2f1f34[_0x9620('0x34')],_0x5c44df)['join'](_0x9620('0x35')));_0x1a75d8[_0x9620('0x23')](_0x26876d);}else{logger[_0x9620('0x36')](_0x9620('0x37'),path[_0x9620('0x1c')](__dirname,_0x9620('0x1a'),_0x5c44df[_0x9620('0x1d')]+_0x9620('0x1e')));}}_0x2f1f34[_0x9620('0x38')][_0x4f399c]=new RuleEngine(_0x1a75d8);_0x2f1f34[_0x9620('0x38')][_0x4f399c]['execute'](_0x51f0a7,function(_0x6b6174){logger[_0x9620('0x39')](_0x9620('0x3a'),JSON[_0x9620('0x3b')](_0x6b6174[_0x9620('0x3c')]));if(_0x2f1f34[_0x9620('0x38')][_0x4f399c]){_0x2f1f34[_0x9620('0x38')][_0x4f399c]['emit'](_0x9620('0x3d'));}});return _0x309b4c({'code':0xc8,'message':_0x51f0a7});}else{if(_0x10a166){logger['info'](util[_0x9620('0x2f')](_0x9620('0x3e'),_0x4f399c));}else{logger[_0x9620('0x39')](_0x9620('0x3f'));}return _0x309b4c({'code':0xc8,'message':_0x51f0a7});}}catch(_0x4ba242){logger['error'](_0x4ba242['stack']);return _0x34168b(_0x6d97fa[_0x9620('0x36')](0x1f4,_0x4ba242));}}return _0x34168b(_0x9620('0x40'));});},'AcceptMessage':function(_0x4cd39d){var _0x254d28=this;return new Promise(function(_0x3866aa,_0x4f437e){if(_0x4cd39d[_0x9620('0x41')]&&_0x4cd39d[_0x9620('0x41')]['id']){if(_0x2f1f34['agents'][_0x4cd39d[_0x9620('0x41')]['id']]){_0x2f1f34[_0x9620('0x42')][_0x4cd39d['agent']['id']][_0x9620('0x43')]=![];_0x2f1f34['agents'][_0x4cd39d[_0x9620('0x41')]['id']]['busyQueue']=undefined;}}if(_0x4cd39d[_0x9620('0x16')]&&_0x4cd39d['message']['id']){try{var _0x32284b=getId(_0x4cd39d[_0x9620('0x15')],_0x4cd39d[_0x9620('0x16')]?_0x4cd39d['message']['id']:0x0,_0x4cd39d[_0x9620('0x17')]?_0x4cd39d[_0x9620('0x17')]['id']:0x0);if(_0x2f1f34[_0x9620('0x38')][_0x32284b]){_0x2f1f34[_0x9620('0x38')][_0x32284b][_0x9620('0x44')](_0x9620('0x45'));if(rpc[_0x4cd39d[_0x9620('0x15')]+_0x9620('0x46')]){rpc[_0x4cd39d[_0x9620('0x15')]+_0x9620('0x46')][_0x9620('0x47')](_0x32284b,{'UserId':_0x4cd39d[_0x9620('0x16')][_0x9620('0x48')]})['catch'](function(){logger[_0x9620('0x36')](_0x9620('0x49'));});}}return _0x3866aa({'code':0xc8,'message':_0x4cd39d});}catch(_0x575cba){logger[_0x9620('0x36')](_0x575cba[_0x9620('0x4a')]);return _0x4f437e(_0x254d28[_0x9620('0x36')](0x1f4,_0x575cba));}}logger[_0x9620('0x36')](_0x9620('0x4b'));return _0x4f437e(_0x254d28['error'](0x1f4,_0x9620('0x4b')));});},'RejectMessage':function(_0x1c6d25){var _0x5d2ab9=this;return new Promise(function(_0x6f371a,_0x15883f){if(_0x1c6d25[_0x9620('0x41')]&&_0x1c6d25[_0x9620('0x41')]['id']){try{if(_0x2f1f34[_0x9620('0x42')][_0x1c6d25[_0x9620('0x41')]['id']]){_0x2f1f34[_0x9620('0x42')][_0x1c6d25[_0x9620('0x41')]['id']]['busy']=![];_0x2f1f34[_0x9620('0x42')][_0x1c6d25[_0x9620('0x41')]['id']]['busyQueue']=undefined;}return _0x6f371a({'code':0xc8,'message':_0x1c6d25});}catch(_0x304c2f){logger[_0x9620('0x36')](_0x304c2f[_0x9620('0x4a')]);return _0x15883f(_0x5d2ab9['error'](0x1f4,_0x304c2f));}}logger[_0x9620('0x36')](_0x9620('0x4b'));return _0x15883f(_0x5d2ab9[_0x9620('0x36')](0x1f4,_0x9620('0x4b')));});},'AbandonInteraction':function(_0x59b655){var _0x1742ae=this;return new Promise(function(_0x4d68ea,_0x42ac56){if(_0x59b655[_0x9620('0x15')]&&_0x59b655['interaction']&&_0x59b655[_0x9620('0x17')]['id']){try{var _0x588b5f=getId(_0x59b655[_0x9620('0x15')],_0x59b655[_0x9620('0x16')]?_0x59b655[_0x9620('0x16')]['id']:0x0,_0x59b655[_0x9620('0x17')]?_0x59b655['interaction']['id']:0x0);if(_0x2f1f34[_0x9620('0x38')][_0x588b5f]){_0x2f1f34[_0x9620('0x38')][_0x588b5f][_0x9620('0x44')]('end');}return _0x4d68ea({'code':0xc8,'message':_0x59b655});}catch(_0x1f44bc){logger[_0x9620('0x36')](_0x1f44bc['stack']);return _0x42ac56(_0x1742ae[_0x9620('0x36')](0x1f4,_0x1f44bc));}}logger['error']('message\x20is\x20empty');return _0x42ac56(_0x1742ae[_0x9620('0x36')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x4f0715){var _0x398deb=this;return new Promise(function(_0x4884a1,_0x23779d){if(_0x2f1f34[_0x9620('0x42')][_0x9620('0x4c')](_0x4f0715['id'])){for(var _0x34082c in _0x4f0715[_0x9620('0x4d')]){if(_0x4f0715[_0x9620('0x4d')][_0x9620('0x4c')](_0x34082c)){if(_0x2f1f34['agents'][_0x4f0715['id']]['hasOwnProperty'](_0x34082c+_0x9620('0x4e'))){_0x2f1f34[_0x9620('0x42')][_0x4f0715['id']][_0x34082c+_0x9620('0x4e')]=parseInt(_0x4f0715[_0x9620('0x4d')][_0x34082c],0xa);}}}_0x2f1f34[_0x9620('0x42')][_0x4f0715['id']][_0x9620('0x4f')]();return _0x4884a1({'code':0xc8,'message':_0x2f1f34[_0x9620('0x42')][_0x4f0715['id']]});}else{return _0x23779d(_0x398deb[_0x9620('0x36')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x5b1752){return new Promise(function(_0x283d4b){var _0x2be4b4=_['values'](_0x2f1f34[_0x9620('0x42')]);if(_0x5b1752&&_0x5b1752['id']){var _0x5883e6=_['find'](_0x2be4b4,function(_0x4c8beb){return _0x4c8beb['id']===_0x5b1752['id'];});_0x283d4b(_0x5883e6);}else{_0x283d4b({'count':_0x2be4b4['length'],'rows':_0x2be4b4});}});},'ChatQueues':function(){return new Promise(function(_0x43bfa4){var _0xd57ca2=[];for(var _0x18b7b7 in _0x2f1f34['chatQueues']){if(_0x2f1f34['chatQueues'][_0x9620('0x4c')](_0x18b7b7)){var _0x111e99=_0x2f1f34[_0x9620('0x50')][_0x18b7b7];var _0x2035a5={'id':_0x111e99['id'],'available':_0x111e99['available'],'loggedIn':_0x111e99[_0x9620('0x51')],'name':_0x111e99[_0x9620('0x52')],'paused':_0x111e99[_0x9620('0x53')],'waiting':_0x111e99['waiting']};_0xd57ca2[_0x9620('0x23')](_0x2035a5);}}_0x43bfa4({'count':_0xd57ca2[_0x9620('0x25')],'rows':_0xd57ca2});});},'MailQueues':function(){return new Promise(function(_0x17e2da){var _0x5ec77b=[];for(var _0x2db54e in _0x2f1f34[_0x9620('0x54')]){if(_0x2f1f34[_0x9620('0x54')][_0x9620('0x4c')](_0x2db54e)){var _0x507b86=_0x2f1f34[_0x9620('0x54')][_0x2db54e];var _0x7b65cc={'id':_0x507b86['id'],'available':_0x507b86['available'],'loggedIn':_0x507b86['loggedIn'],'name':_0x507b86['name'],'paused':_0x507b86[_0x9620('0x53')],'waiting':_0x507b86[_0x9620('0x55')]};_0x5ec77b[_0x9620('0x23')](_0x7b65cc);}}_0x17e2da({'count':_0x5ec77b[_0x9620('0x25')],'rows':_0x5ec77b});});},'OpenchannelQueues':function(){return new Promise(function(_0x36aaaa){var _0x426028=[];for(var _0x3ff660 in _0x2f1f34[_0x9620('0x56')]){if(_0x2f1f34['openchannelQueues'][_0x9620('0x4c')](_0x3ff660)){var _0x40658d=_0x2f1f34['openchannelQueues'][_0x3ff660];var _0x18d980={'id':_0x40658d['id'],'available':_0x40658d[_0x9620('0x57')],'loggedIn':_0x40658d[_0x9620('0x51')],'name':_0x40658d[_0x9620('0x52')],'paused':_0x40658d[_0x9620('0x53')],'waiting':_0x40658d[_0x9620('0x55')]};_0x426028[_0x9620('0x23')](_0x18d980);}}_0x36aaaa({'count':_0x426028[_0x9620('0x25')],'rows':_0x426028});});},'SmsQueues':function(){return new Promise(function(_0x2a98c9){var _0x1d30a3=[];for(var _0x2adecf in _0x2f1f34['smsQueues']){if(_0x2f1f34[_0x9620('0x58')][_0x9620('0x4c')](_0x2adecf)){var _0x16ba20=_0x2f1f34['smsQueues'][_0x2adecf];var _0x560711={'id':_0x16ba20['id'],'available':_0x16ba20['available'],'loggedIn':_0x16ba20[_0x9620('0x51')],'name':_0x16ba20['name'],'paused':_0x16ba20[_0x9620('0x53')],'waiting':_0x16ba20[_0x9620('0x55')]};_0x1d30a3['push'](_0x560711);}}_0x2a98c9({'count':_0x1d30a3[_0x9620('0x25')],'rows':_0x1d30a3});});},'FaxQueues':function(){return new Promise(function(_0x36f5fd){var _0x2f0880=[];for(var _0x1ebbf6 in _0x2f1f34[_0x9620('0x59')]){if(_0x2f1f34['faxQueues'][_0x9620('0x4c')](_0x1ebbf6)){var _0x389b8e=_0x2f1f34[_0x9620('0x59')][_0x1ebbf6];var _0x339d19={'id':_0x389b8e['id'],'available':_0x389b8e[_0x9620('0x57')],'loggedIn':_0x389b8e[_0x9620('0x51')],'name':_0x389b8e[_0x9620('0x52')],'paused':_0x389b8e['paused'],'waiting':_0x389b8e[_0x9620('0x55')]};_0x2f0880[_0x9620('0x23')](_0x339d19);}}_0x36f5fd({'count':_0x2f0880['length'],'rows':_0x2f0880});});},'WhatsappQueues':function(){return new Promise(function(_0x11742e){var _0x38091c=[];for(var _0x271110 in _0x2f1f34[_0x9620('0x5a')]){if(_0x2f1f34[_0x9620('0x5a')][_0x9620('0x4c')](_0x271110)){var _0x4d78e3=_0x2f1f34[_0x9620('0x5a')][_0x271110];var _0x279179={'id':_0x4d78e3['id'],'available':_0x4d78e3[_0x9620('0x57')],'loggedIn':_0x4d78e3['loggedIn'],'name':_0x4d78e3[_0x9620('0x52')],'paused':_0x4d78e3[_0x9620('0x53')],'waiting':_0x4d78e3[_0x9620('0x55')]};_0x38091c[_0x9620('0x23')](_0x279179);}}_0x11742e({'count':_0x38091c[_0x9620('0x25')],'rows':_0x38091c});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x164b7d){var _0x24387e=_[_0x9620('0x5b')](_0x2f1f34[_0x9620('0x5c')]);_0x164b7d({'count':_0x24387e[_0x9620('0x25')],'rows':_0x24387e});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x44865f){var _0x43022c=_['values'](_0x2f1f34[_0x9620('0x5d')]);_0x44865f({'count':_0x43022c[_0x9620('0x25')],'rows':_0x43022c});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x446468){var _0x133779=_['values'](_0x2f1f34[_0x9620('0x5e')]);_0x446468({'count':_0x133779[_0x9620('0x25')],'rows':_0x133779});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x267e68){var _0x40a5a0=_[_0x9620('0x5b')](_0x2f1f34['smsQueuesWaitingInteractions']);_0x267e68({'count':_0x40a5a0[_0x9620('0x25')],'rows':_0x40a5a0});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x594dde){var _0x57f6d4=_[_0x9620('0x5b')](_0x2f1f34['faxQueuesWaitingInteractions']);_0x594dde({'count':_0x57f6d4[_0x9620('0x25')],'rows':_0x57f6d4});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3dece1){var _0x3056eb=_[_0x9620('0x5b')](_0x2f1f34['whatsappQueuesWaitingInteractions']);_0x3dece1({'count':_0x3056eb[_0x9620('0x25')],'rows':_0x3056eb});});}};var _0x6ac770=jayson[_0x9620('0x5f')](_0x301805)['http']();_0x6ac770['on']('error',function(_0x1d9350){logger[_0x9620('0x36')](JSON['stringify'](_0x1d9350));return _0x2b144b(_0x1d9350);});_0x6ac770[_0x9620('0x14')](0x232c,_0x9620('0x60'),function(){console[_0x9620('0x61')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x5aba4e(_0x9620('0x62')+0x232c);});});}; \ No newline at end of file +var _0xd4a2=['account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','complete','info','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','emit','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','paused','waiting','mailQueues','loggedIn','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','./applications/utils','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender'];(function(_0x23c980,_0x82eb3){var _0x94fb83=function(_0x3e8e8f){while(--_0x3e8e8f){_0x23c980['push'](_0x23c980['shift']());}};_0x94fb83(++_0x82eb3);}(_0xd4a2,0x173));var _0x2d4a=function(_0x1b3bbd,_0x33b79e){_0x1b3bbd=_0x1b3bbd-0x0;var _0x1155fd=_0xd4a2[_0x1b3bbd];return _0x1155fd;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0x2d4a('0x1'));var BPromise=require('bluebird');var utils=require(_0x2d4a('0x2'));var sUtils=require('./applications/strategy/util');var logger=require(_0x2d4a('0x3'))('routing');var rpc={'openchannelQueueReport':require(_0x2d4a('0x4')),'mailQueueReport':require(_0x2d4a('0x5')),'chatQueueReport':require(_0x2d4a('0x6')),'smsQueueReport':require(_0x2d4a('0x7')),'faxQueueReport':require(_0x2d4a('0x8')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x2d4a('0x9'));function getId(_0x41b161,_0x1f237e,_0x29597e){return util[_0x2d4a('0xa')](_0x2d4a('0xb'),_0x41b161,_0x1f237e||0x0,_0x29597e||0x0);}function getIntervals(_0xb9f016,_0x113839){var _0x33b786=[];if(!_[_0x2d4a('0xc')](_0x113839[_0x2d4a('0xd')])&&!_[_0x2d4a('0xc')](_0xb9f016[_0x113839['IntervalId']])&&!_['isNil'](_0xb9f016[_0x113839[_0x2d4a('0xd')]]['Intervals'])){_0x33b786=_[_0x2d4a('0xe')](_0xb9f016[_0x113839[_0x2d4a('0xd')]][_0x2d4a('0xf')],_0x2d4a('0x10'));}else if(!_[_0x2d4a('0xc')](_0x113839[_0x2d4a('0x10')])){_0x33b786=[_0x113839[_0x2d4a('0x10')]];}return _0x33b786;}exports[_0x2d4a('0x11')]=function(_0x544622){_0x544622['rules']={};return new BPromise(function(_0x2a1d0f,_0x5b6c4f){var _0x11c64a={'Start':function(_0x175bda){var _0x11896d=this;return new Promise(function(_0x3a3156,_0x4c5287){if(_0x175bda){try{var _0x5f825d=[];var _0x5a6378=getId(_0x175bda[_0x2d4a('0x12')],_0x175bda['message']?_0x175bda[_0x2d4a('0x13')]['id']:0x0,_0x175bda[_0x2d4a('0x14')]?_0x175bda[_0x2d4a('0x14')]['id']:0x0);var _0x388371=sUtils['checkWaitingNotifications'](_0x544622,_0x175bda);if(_0x175bda['transfer']||!_0x388371&&_0x175bda['applications']&&_[_0x2d4a('0x15')](_0x175bda[_0x2d4a('0x16')])&&_0x175bda[_0x2d4a('0x16')][_0x2d4a('0x17')]){for(var _0x46c331=0x0;_0x46c331<_0x175bda[_0x2d4a('0x16')]['length'];_0x46c331+=0x1){var _0x49f378=_0x175bda[_0x2d4a('0x16')][_0x46c331];if(fs[_0x2d4a('0x18')](path[_0x2d4a('0x19')](__dirname,_0x2d4a('0x16'),_0x49f378[_0x2d4a('0x1a')]+_0x2d4a('0x1b')))){var _0x22dd0b=[];switch(_0x49f378[_0x2d4a('0x1a')]['toLowerCase']()){case _0x2d4a('0x1c'):var _0x3240a2=_0x49f378[_0x2d4a('0x1d')][_0x2d4a('0x1e')](',');if(_0x175bda[_0x2d4a('0x12')]===_0x2d4a('0x1f')){_0x22dd0b[_0x2d4a('0x20')](_0x3240a2[0x0]);_0x22dd0b[_0x2d4a('0x20')](_0x3240a2[0x1]);_0x22dd0b['push'](_0x3240a2['slice'](0x2,_0x3240a2['length'])[_0x2d4a('0x19')](','));}else{_0x22dd0b['push'](_0x3240a2[0x0]);_0x22dd0b[_0x2d4a('0x20')](_0x3240a2[_0x2d4a('0x21')](0x1,_0x3240a2[_0x2d4a('0x17')])[_0x2d4a('0x19')](','));}break;case _0x2d4a('0x22'):var _0x326c38=_0x49f378[_0x2d4a('0x1d')][_0x2d4a('0x1e')](',');_0x22dd0b['push'](_0x326c38[0x0]);_0x22dd0b[_0x2d4a('0x20')](_0x326c38[0x1]);_0x22dd0b['push'](_0x326c38[_0x2d4a('0x21')](0x2,_0x326c38[_0x2d4a('0x17')])[_0x2d4a('0x19')](','));break;case _0x2d4a('0x23'):var _0x101382=_0x49f378[_0x2d4a('0x1d')][_0x2d4a('0x1e')](',');_0x22dd0b[_0x2d4a('0x20')](_0x101382[0x0]);_0x22dd0b['push'](_0x101382[0x1]);_0x22dd0b[_0x2d4a('0x20')](_0x101382[0x2]);_0x22dd0b[_0x2d4a('0x20')](_0x101382[0x3]);_0x22dd0b[_0x2d4a('0x20')](_0x101382[_0x2d4a('0x21')](0x4,_0x101382[_0x2d4a('0x17')])['join'](','));break;case _0x2d4a('0x24'):var _0x31d8ae=_0x49f378[_0x2d4a('0x1d')][_0x2d4a('0x1e')](',');_0x22dd0b[_0x2d4a('0x20')](_0x31d8ae[0x0]);_0x22dd0b['push'](_0x31d8ae[0x1]);_0x22dd0b[_0x2d4a('0x20')](_0x31d8ae[0x2]);_0x22dd0b[_0x2d4a('0x20')](_0x31d8ae[0x3]);_0x22dd0b[_0x2d4a('0x20')](_0x31d8ae[_0x2d4a('0x21')](0x4,_0x31d8ae[_0x2d4a('0x17')])[_0x2d4a('0x19')](','));break;case'message':_0x22dd0b[_0x2d4a('0x20')](_0x49f378[_0x2d4a('0x1d')]);break;case _0x2d4a('0x25'):_0x22dd0b[_0x2d4a('0x20')](_0x49f378[_0x2d4a('0x26')]);_0x22dd0b['push'](_0x49f378[_0x2d4a('0x1d')]);break;case _0x2d4a('0x27'):var _0x54d652=utils[_0x2d4a('0x28')](_0x175bda[_0x2d4a('0x29')][_0x2d4a('0x2a')],_0x175bda);var _0x94e857=_0x49f378[_0x2d4a('0x1d')][_0x2d4a('0x1e')](',');_0x22dd0b['push'](_0x94e857[0x0]);_0x22dd0b[_0x2d4a('0x20')](_0x94e857[0x1]);_0x22dd0b[_0x2d4a('0x20')](_0x94e857[0x2]);_0x22dd0b[_0x2d4a('0x20')](_0x94e857[0x3]);_0x22dd0b[_0x2d4a('0x20')](_0x94e857[0x4]);_0x22dd0b[_0x2d4a('0x20')](_0x94e857[0x5]);_0x22dd0b[_0x2d4a('0x20')](_0x94e857[0x6]);_0x22dd0b['push'](_0x94e857[0x7]);_0x22dd0b['push'](_0x94e857[0x8]);_0x22dd0b[_0x2d4a('0x20')](_0x94e857[0x9]);_0x22dd0b['push'](_0x94e857[0xa]);_0x22dd0b[_0x2d4a('0x20')](_0x175bda[_0x2d4a('0x14')]['id']);_0x22dd0b['push'](_0x175bda[_0x2d4a('0x13')]['id']);_0x22dd0b[_0x2d4a('0x20')](_0x49f378[_0x2d4a('0x2b')]);_0x22dd0b[_0x2d4a('0x20')](_0x175bda[_0x2d4a('0x14')][_0x2d4a('0x2c')]);_0x22dd0b[_0x2d4a('0x20')](_0x175bda[_0x2d4a('0x2d')][_0x2d4a('0x2d')]);_0x22dd0b[_0x2d4a('0x20')](_0x54d652);break;default:_0x22dd0b=_[_0x2d4a('0xc')](_0x49f378['appdata'])?[]:_0x49f378[_0x2d4a('0x1d')][_0x2d4a('0x1e')](',');}var _0x2bc864={'id':util[_0x2d4a('0xa')](_0x2d4a('0x2e'),_0x5a6378,_0x49f378['id'],_0x49f378['app']),'condition':require('./interval')['condition'](_0x5a6378,getIntervals(_0x544622['intervals'],_0x49f378),_0x544622),'consequence':require(_0x2d4a('0x2f')+_0x49f378[_0x2d4a('0x1a')])[_0x2d4a('0x30')](_0x5a6378,_0x22dd0b,_0x544622,_0x175bda),'p':_0x49f378[_0x2d4a('0x31')]||0x0};logger['info'](_0x2d4a('0x32'),_0x2bc864['id'],_0x2d4a('0x33'),getIntervals(_0x544622['intervals'],_0x49f378)[_0x2d4a('0x19')](_0x2d4a('0x34')));_0x5f825d[_0x2d4a('0x20')](_0x2bc864);}else{logger[_0x2d4a('0x35')](_0x2d4a('0x36'),path[_0x2d4a('0x19')](__dirname,'applications',_0x49f378[_0x2d4a('0x1a')]+_0x2d4a('0x1b')));}}_0x544622[_0x2d4a('0x37')][_0x5a6378]=new RuleEngine(_0x5f825d);_0x544622[_0x2d4a('0x37')][_0x5a6378][_0x2d4a('0x38')](_0x175bda,function(_0x1d9e3f){logger['info'](_0x2d4a('0x39'),JSON[_0x2d4a('0x3a')](_0x1d9e3f[_0x2d4a('0x3b')]));if(_0x544622['rules'][_0x5a6378]){_0x544622[_0x2d4a('0x37')][_0x5a6378]['emit'](_0x2d4a('0x3c'));}});return _0x3a3156({'code':0xc8,'message':_0x175bda});}else{if(_0x388371){logger[_0x2d4a('0x3d')](util[_0x2d4a('0xa')](_0x2d4a('0x3e'),_0x5a6378));}else{logger[_0x2d4a('0x3d')]('No\x20applications\x20to\x20execute');}return _0x3a3156({'code':0xc8,'message':_0x175bda});}}catch(_0x5d481c){logger[_0x2d4a('0x35')](_0x5d481c[_0x2d4a('0x3f')]);return _0x4c5287(_0x11896d['error'](0x1f4,_0x5d481c));}}return _0x4c5287(_0x2d4a('0x40'));});},'AcceptMessage':function(_0x5b0008){var _0x16b858=this;return new Promise(function(_0x13f768,_0x43aea1){if(_0x5b0008['agent']&&_0x5b0008[_0x2d4a('0x41')]['id']){if(_0x544622['agents'][_0x5b0008[_0x2d4a('0x41')]['id']]){_0x544622[_0x2d4a('0x42')][_0x5b0008[_0x2d4a('0x41')]['id']][_0x2d4a('0x43')]=![];_0x544622[_0x2d4a('0x42')][_0x5b0008[_0x2d4a('0x41')]['id']][_0x2d4a('0x44')]=undefined;}}if(_0x5b0008[_0x2d4a('0x13')]&&_0x5b0008[_0x2d4a('0x13')]['id']){try{var _0x2a94ff=getId(_0x5b0008[_0x2d4a('0x12')],_0x5b0008['message']?_0x5b0008[_0x2d4a('0x13')]['id']:0x0,_0x5b0008[_0x2d4a('0x14')]?_0x5b0008[_0x2d4a('0x14')]['id']:0x0);if(_0x544622[_0x2d4a('0x37')][_0x2a94ff]){_0x544622[_0x2d4a('0x37')][_0x2a94ff]['emit'](_0x2d4a('0x45'));if(rpc[_0x5b0008[_0x2d4a('0x12')]+_0x2d4a('0x46')]){rpc[_0x5b0008[_0x2d4a('0x12')]+_0x2d4a('0x46')]['update'](_0x2a94ff,{'UserId':_0x5b0008['message'][_0x2d4a('0x47')]})[_0x2d4a('0x48')](function(){logger['error'](_0x2d4a('0x49'));});}}return _0x13f768({'code':0xc8,'message':_0x5b0008});}catch(_0x33f413){logger[_0x2d4a('0x35')](_0x33f413[_0x2d4a('0x3f')]);return _0x43aea1(_0x16b858['error'](0x1f4,_0x33f413));}}logger[_0x2d4a('0x35')]('message\x20is\x20empty');return _0x43aea1(_0x16b858[_0x2d4a('0x35')](0x1f4,_0x2d4a('0x4a')));});},'RejectMessage':function(_0x298fed){var _0x1174e2=this;return new Promise(function(_0x1866c3,_0x3103ca){if(_0x298fed[_0x2d4a('0x41')]&&_0x298fed[_0x2d4a('0x41')]['id']){try{if(_0x544622['agents'][_0x298fed[_0x2d4a('0x41')]['id']]){_0x544622[_0x2d4a('0x42')][_0x298fed[_0x2d4a('0x41')]['id']][_0x2d4a('0x43')]=![];_0x544622[_0x2d4a('0x42')][_0x298fed[_0x2d4a('0x41')]['id']][_0x2d4a('0x44')]=undefined;}return _0x1866c3({'code':0xc8,'message':_0x298fed});}catch(_0x1d7af6){logger[_0x2d4a('0x35')](_0x1d7af6[_0x2d4a('0x3f')]);return _0x3103ca(_0x1174e2[_0x2d4a('0x35')](0x1f4,_0x1d7af6));}}logger[_0x2d4a('0x35')](_0x2d4a('0x4a'));return _0x3103ca(_0x1174e2[_0x2d4a('0x35')](0x1f4,_0x2d4a('0x4a')));});},'AbandonInteraction':function(_0x268a2f){var _0x1e18a9=this;return new Promise(function(_0x4cce5e,_0x3515b8){if(_0x268a2f[_0x2d4a('0x12')]&&_0x268a2f['interaction']&&_0x268a2f[_0x2d4a('0x14')]['id']){try{var _0x343f25=getId(_0x268a2f[_0x2d4a('0x12')],_0x268a2f[_0x2d4a('0x13')]?_0x268a2f[_0x2d4a('0x13')]['id']:0x0,_0x268a2f[_0x2d4a('0x14')]?_0x268a2f[_0x2d4a('0x14')]['id']:0x0);if(_0x544622[_0x2d4a('0x37')][_0x343f25]){_0x544622[_0x2d4a('0x37')][_0x343f25][_0x2d4a('0x4b')](_0x2d4a('0x45'));}return _0x4cce5e({'code':0xc8,'message':_0x268a2f});}catch(_0x302323){logger['error'](_0x302323[_0x2d4a('0x3f')]);return _0x3515b8(_0x1e18a9[_0x2d4a('0x35')](0x1f4,_0x302323));}}logger['error'](_0x2d4a('0x4a'));return _0x3515b8(_0x1e18a9[_0x2d4a('0x35')](0x1f4,_0x2d4a('0x4a')));});},'AgentCapacity':function(_0xb4f74c){var _0x23510e=this;return new Promise(function(_0x1e86c3,_0x35fb34){if(_0x544622[_0x2d4a('0x42')][_0x2d4a('0x4c')](_0xb4f74c['id'])){for(var _0x282df8 in _0xb4f74c['capacity']){if(_0xb4f74c[_0x2d4a('0x4d')][_0x2d4a('0x4c')](_0x282df8)){if(_0x544622[_0x2d4a('0x42')][_0xb4f74c['id']]['hasOwnProperty'](_0x282df8+_0x2d4a('0x4e'))){_0x544622[_0x2d4a('0x42')][_0xb4f74c['id']][_0x282df8+_0x2d4a('0x4e')]=parseInt(_0xb4f74c[_0x2d4a('0x4d')][_0x282df8],0xa);}}}_0x544622[_0x2d4a('0x42')][_0xb4f74c['id']][_0x2d4a('0x4f')]();return _0x1e86c3({'code':0xc8,'message':_0x544622[_0x2d4a('0x42')][_0xb4f74c['id']]});}else{return _0x35fb34(_0x23510e[_0x2d4a('0x35')](0x1f4,_0x2d4a('0x50')));}});},'Agents':function(_0x508648){return new Promise(function(_0x21b8e9){var _0x17ade0=_[_0x2d4a('0x51')](_0x544622[_0x2d4a('0x42')]);if(_0x508648&&_0x508648['id']){var _0x2c50e7=_[_0x2d4a('0x52')](_0x17ade0,function(_0x53f52b){return _0x53f52b['id']===_0x508648['id'];});_0x21b8e9(_0x2c50e7);}else{_0x21b8e9({'count':_0x17ade0[_0x2d4a('0x17')],'rows':_0x17ade0});}});},'ChatQueues':function(){return new Promise(function(_0x3a675e){var _0x22707f=[];for(var _0x4809af in _0x544622[_0x2d4a('0x53')]){if(_0x544622[_0x2d4a('0x53')]['hasOwnProperty'](_0x4809af)){var _0x2b0e4c=_0x544622[_0x2d4a('0x53')][_0x4809af];var _0x47a975={'id':_0x2b0e4c['id'],'available':_0x2b0e4c[_0x2d4a('0x54')],'loggedIn':_0x2b0e4c['loggedIn'],'name':_0x2b0e4c['name'],'paused':_0x2b0e4c[_0x2d4a('0x55')],'waiting':_0x2b0e4c[_0x2d4a('0x56')]};_0x22707f[_0x2d4a('0x20')](_0x47a975);}}_0x3a675e({'count':_0x22707f[_0x2d4a('0x17')],'rows':_0x22707f});});},'MailQueues':function(){return new Promise(function(_0x4b9a3d){var _0x3bd40d=[];for(var _0x52e392 in _0x544622[_0x2d4a('0x57')]){if(_0x544622[_0x2d4a('0x57')]['hasOwnProperty'](_0x52e392)){var _0x4d8111=_0x544622[_0x2d4a('0x57')][_0x52e392];var _0x56fecc={'id':_0x4d8111['id'],'available':_0x4d8111[_0x2d4a('0x54')],'loggedIn':_0x4d8111[_0x2d4a('0x58')],'name':_0x4d8111[_0x2d4a('0x59')],'paused':_0x4d8111[_0x2d4a('0x55')],'waiting':_0x4d8111[_0x2d4a('0x56')]};_0x3bd40d['push'](_0x56fecc);}}_0x4b9a3d({'count':_0x3bd40d[_0x2d4a('0x17')],'rows':_0x3bd40d});});},'OpenchannelQueues':function(){return new Promise(function(_0x23fdb2){var _0xf3d514=[];for(var _0x398439 in _0x544622['openchannelQueues']){if(_0x544622[_0x2d4a('0x5a')][_0x2d4a('0x4c')](_0x398439)){var _0x32a048=_0x544622[_0x2d4a('0x5a')][_0x398439];var _0x4a4f05={'id':_0x32a048['id'],'available':_0x32a048[_0x2d4a('0x54')],'loggedIn':_0x32a048[_0x2d4a('0x58')],'name':_0x32a048['name'],'paused':_0x32a048[_0x2d4a('0x55')],'waiting':_0x32a048[_0x2d4a('0x56')]};_0xf3d514[_0x2d4a('0x20')](_0x4a4f05);}}_0x23fdb2({'count':_0xf3d514['length'],'rows':_0xf3d514});});},'SmsQueues':function(){return new Promise(function(_0x14a913){var _0x7552a3=[];for(var _0x41f2bd in _0x544622[_0x2d4a('0x5b')]){if(_0x544622[_0x2d4a('0x5b')][_0x2d4a('0x4c')](_0x41f2bd)){var _0x3bc965=_0x544622['smsQueues'][_0x41f2bd];var _0x3f080a={'id':_0x3bc965['id'],'available':_0x3bc965[_0x2d4a('0x54')],'loggedIn':_0x3bc965[_0x2d4a('0x58')],'name':_0x3bc965[_0x2d4a('0x59')],'paused':_0x3bc965[_0x2d4a('0x55')],'waiting':_0x3bc965['waiting']};_0x7552a3[_0x2d4a('0x20')](_0x3f080a);}}_0x14a913({'count':_0x7552a3['length'],'rows':_0x7552a3});});},'FaxQueues':function(){return new Promise(function(_0x3a2aab){var _0x3b6117=[];for(var _0x2a05f7 in _0x544622[_0x2d4a('0x5c')]){if(_0x544622[_0x2d4a('0x5c')][_0x2d4a('0x4c')](_0x2a05f7)){var _0x40640b=_0x544622[_0x2d4a('0x5c')][_0x2a05f7];var _0x250c75={'id':_0x40640b['id'],'available':_0x40640b[_0x2d4a('0x54')],'loggedIn':_0x40640b['loggedIn'],'name':_0x40640b[_0x2d4a('0x59')],'paused':_0x40640b['paused'],'waiting':_0x40640b[_0x2d4a('0x56')]};_0x3b6117[_0x2d4a('0x20')](_0x250c75);}}_0x3a2aab({'count':_0x3b6117[_0x2d4a('0x17')],'rows':_0x3b6117});});},'WhatsappQueues':function(){return new Promise(function(_0x45153d){var _0x21517f=[];for(var _0x43a2b3 in _0x544622[_0x2d4a('0x5d')]){if(_0x544622[_0x2d4a('0x5d')][_0x2d4a('0x4c')](_0x43a2b3)){var _0x51b96b=_0x544622[_0x2d4a('0x5d')][_0x43a2b3];var _0x74bc62={'id':_0x51b96b['id'],'available':_0x51b96b[_0x2d4a('0x54')],'loggedIn':_0x51b96b[_0x2d4a('0x58')],'name':_0x51b96b['name'],'paused':_0x51b96b[_0x2d4a('0x55')],'waiting':_0x51b96b[_0x2d4a('0x56')]};_0x21517f[_0x2d4a('0x20')](_0x74bc62);}}_0x45153d({'count':_0x21517f[_0x2d4a('0x17')],'rows':_0x21517f});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x240b28){var _0xd1adbe=_['values'](_0x544622[_0x2d4a('0x5e')]);_0x240b28({'count':_0xd1adbe[_0x2d4a('0x17')],'rows':_0xd1adbe});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x54350d){var _0x42e4e5=_[_0x2d4a('0x51')](_0x544622[_0x2d4a('0x5f')]);_0x54350d({'count':_0x42e4e5[_0x2d4a('0x17')],'rows':_0x42e4e5});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x429579){var _0x3139fc=_[_0x2d4a('0x51')](_0x544622[_0x2d4a('0x60')]);_0x429579({'count':_0x3139fc[_0x2d4a('0x17')],'rows':_0x3139fc});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x70c4a0){var _0x567ced=_[_0x2d4a('0x51')](_0x544622['smsQueuesWaitingInteractions']);_0x70c4a0({'count':_0x567ced[_0x2d4a('0x17')],'rows':_0x567ced});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x135ec0){var _0x285b93=_[_0x2d4a('0x51')](_0x544622[_0x2d4a('0x61')]);_0x135ec0({'count':_0x285b93[_0x2d4a('0x17')],'rows':_0x285b93});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x305d45){var _0x49d196=_[_0x2d4a('0x51')](_0x544622[_0x2d4a('0x62')]);_0x305d45({'count':_0x49d196[_0x2d4a('0x17')],'rows':_0x49d196});});}};var _0xfc7b53=jayson[_0x2d4a('0x63')](_0x11c64a)['http']();_0xfc7b53['on']('error',function(_0x49b2f3){logger[_0x2d4a('0x35')](JSON[_0x2d4a('0x3a')](_0x49b2f3));return _0x5b6c4f(_0x49b2f3);});_0xfc7b53[_0x2d4a('0x11')](0x232c,'127.0.0.1',function(){console[_0x2d4a('0x64')](_0x2d4a('0x65'),0x232c);return _0x2a1d0f(_0x2d4a('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 7a5414b..2a92760 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 _0xf1c6=['iftime','../../../config/logger','routing','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','stop','lodash','../../../utils/iftime'];(function(_0x1e9404,_0x1f17f3){var _0x3217b5=function(_0x2fc5ff){while(--_0x2fc5ff){_0x1e9404['push'](_0x1e9404['shift']());}};_0x3217b5(++_0x1f17f3);}(_0xf1c6,0x174));var _0x6f1c=function(_0x3750ea,_0x15cecf){_0x3750ea=_0x3750ea-0x0;var _0x2a3426=_0xf1c6[_0x3750ea];return _0x2a3426;};'use strict';var _=require(_0x6f1c('0x0'));var iftime=require(_0x6f1c('0x1'))[_0x6f1c('0x2')];var logger=require(_0x6f1c('0x3'))(_0x6f1c('0x4'));exports[_0x6f1c('0x5')]=function(_0x52fa43,_0x2cdf64,_0xe02d1f){return function(_0x38445b){if(_0xe02d1f['rules']&&!_0xe02d1f[_0x6f1c('0x6')][_0x52fa43]){logger[_0x6f1c('0x7')](_0x6f1c('0x8'),_0x52fa43);return _0x38445b['stop']();}var _0x4c6db6=_0x2cdf64[_0x6f1c('0x9')](function(_0x541f08){return iftime(_0x541f08);});var _0x109e42=_[_0x6f1c('0xa')](_0x4c6db6);if(_0x109e42){logger[_0x6f1c('0x7')](_0x6f1c('0xb'),_0x52fa43,_0x2cdf64[_0x6f1c('0xc')](_0x6f1c('0xd')),_0x109e42);_0x38445b[_0x6f1c('0xe')](_0x109e42);}else{logger[_0x6f1c('0x7')](_0x6f1c('0xf'),_0x52fa43,_0x2cdf64[_0x6f1c('0xc')](_0x6f1c('0xd')));_0x38445b[_0x6f1c('0x10')]();}};}; \ No newline at end of file +var _0x85a8=['\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','lodash','../../../utils/iftime','../../../config/logger','routing','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','some','join'];(function(_0x50f0c7,_0x24874d){var _0x5bb043=function(_0x4fcb52){while(--_0x4fcb52){_0x50f0c7['push'](_0x50f0c7['shift']());}};_0x5bb043(++_0x24874d);}(_0x85a8,0xc6));var _0x885a=function(_0x2bdb64,_0x667f22){_0x2bdb64=_0x2bdb64-0x0;var _0x3ec1d1=_0x85a8[_0x2bdb64];return _0x3ec1d1;};'use strict';var _=require(_0x885a('0x0'));var iftime=require(_0x885a('0x1'))['iftime'];var logger=require(_0x885a('0x2'))(_0x885a('0x3'));exports[_0x885a('0x4')]=function(_0xa2f19e,_0x31b3a3,_0x2ea80c){return function(_0x479333){if(_0x2ea80c['rules']&&!_0x2ea80c[_0x885a('0x5')][_0xa2f19e]){logger[_0x885a('0x6')](_0x885a('0x7'),_0xa2f19e);return _0x479333[_0x885a('0x8')]();}var _0x38b0f2=_0x31b3a3[_0x885a('0x9')](function(_0x58bd45){return iftime(_0x58bd45);});var _0x16eeef=_[_0x885a('0xa')](_0x38b0f2);if(_0x16eeef){logger[_0x885a('0x6')]('[%s][INTERVAL\x20VALID]\x20%s\x20%s',_0xa2f19e,_0x31b3a3[_0x885a('0xb')](_0x885a('0xc')),_0x16eeef);_0x479333[_0x885a('0xd')](_0x16eeef);}else{logger[_0x885a('0x6')](_0x885a('0xe'),_0xa2f19e,_0x31b3a3[_0x885a('0xb')]('\x20|\x20'));_0x479333['stop']();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index e363b7d..69135ab 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 _0xe205=['interface','calleridnum','then','type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','lastevent','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','debug','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswer','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','transfertargetuniqueid','clone','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe205,0xa7));var _0x5e20=function(_0x10e123,_0x10e50c){_0x10e123=_0x10e123-0x0;var _0x28e079=_0xe205[_0x10e123];return _0x28e079;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var utils=require(_0x5e20('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3cdbb0,_0x6c1585){utils[_0x5e20('0x3')](util[_0x5e20('0x4')](_0x5e20('0x5'),_0x3cdbb0[_0x5e20('0x6')],_0x3cdbb0['channel'],_0x3cdbb0[_0x5e20('0x7')],_0x3cdbb0[_0x5e20('0x8')],_0x3cdbb0[_0x5e20('0x9')],_0x3cdbb0[_0x5e20('0xa')],_0x3cdbb0['connectedlinenum'],_0x3cdbb0['lastevent']));if(_0x3cdbb0[_0x5e20('0x7')]){utils['getVoiceQueueByName'](_0x3cdbb0['queue'])[_0x5e20('0xb')](function(_0x28c142){if(_0x28c142){_0x3cdbb0['type']=_0x28c142[_0x5e20('0xc')];_0x3cdbb0[_0x5e20('0xd')]=_0x3cdbb0[_0x5e20('0xe')]?_0x28c142[_0x5e20('0xf')]:![];_0x3cdbb0['acwtime']=_0x3cdbb0[_0x5e20('0xd')]?_0x28c142[_0x5e20('0x10')]:0x0;}utils[_0x5e20('0x11')](_0x5e20('0x12'),_0x3cdbb0);});}else{utils[_0x5e20('0x11')](_0x5e20('0x12'),_0x3cdbb0);}if(_0x6c1585){delete transfers[_0x3cdbb0['uniqueid']];}else{delete agents[_0x3cdbb0[_0x5e20('0x13')]];}}exports[_0x5e20('0x14')]=function(_0x22540d){try{utils['debug'](util[_0x5e20('0x4')]('[%s][agents][agentcalled]',_0x22540d[_0x5e20('0x6')]),_0x22540d);agents[_0x22540d['destuniqueid']]=_0x22540d;agents[_0x22540d[_0x5e20('0x13')]][_0x5e20('0x15')]=utils[_0x5e20('0x16')]();agents[_0x22540d[_0x5e20('0x13')]][_0x5e20('0x17')]='called';agents[_0x22540d[_0x5e20('0x13')]][_0x5e20('0x18')]=null;agents[_0x22540d[_0x5e20('0x13')]][_0x5e20('0x19')]=null;utils[_0x5e20('0x3')](util[_0x5e20('0x4')](_0x5e20('0x1a'),_0x22540d[_0x5e20('0x6')],agents[_0x22540d['destuniqueid']][_0x5e20('0x8')],_0x22540d[_0x5e20('0x13')]));}catch(_0x4f900b){utils[_0x5e20('0x1b')](util[_0x5e20('0x4')](_0x5e20('0x1c'),_0x22540d[_0x5e20('0x6')]),_0x4f900b);}};exports['agentringnoanswer']=function(_0x2954fc){try{if(!_['isNil'](agents[_0x2954fc['destuniqueid']])){utils['debug'](util['format'](_0x5e20('0x1d'),_0x2954fc['uniqueid']),_0x2954fc);utils[_0x5e20('0x3')](util[_0x5e20('0x4')](_0x5e20('0x1e'),_0x2954fc[_0x5e20('0x6')],agents[_0x2954fc[_0x5e20('0x13')]][_0x5e20('0x8')],_0x2954fc['destuniqueid']));agents[_0x2954fc[_0x5e20('0x13')]]['agentringnoanswer']=!![];agents[_0x2954fc['destuniqueid']][_0x5e20('0x1f')]=utils[_0x5e20('0x16')]();agents[_0x2954fc[_0x5e20('0x13')]][_0x5e20('0x17')]=_0x5e20('0x20');agents[_0x2954fc[_0x5e20('0x13')]][_0x5e20('0x21')]='timeout';agents[_0x2954fc[_0x5e20('0x13')]][_0x5e20('0x22')]=_0x2954fc[_0x5e20('0x23')]?parseInt(_0x2954fc[_0x5e20('0x23')])/0x3e8:0x0;agents[_0x2954fc['destuniqueid']][_0x5e20('0x24')]=0x0;unanswered[_0x5e20('0x25')](_0x2954fc[_0x5e20('0x13')]);}}catch(_0x222e7a){utils[_0x5e20('0x1b')](util[_0x5e20('0x4')]('[%s][agents][agentringnoanswer]',_0x2954fc[_0x5e20('0x6')]),_0x222e7a);}};exports[_0x5e20('0x26')]=function(_0x543c29){try{_[_0x5e20('0x27')](agents,function(_0x21d1d8,_0x335f1e){if(_0x21d1d8[_0x5e20('0x6')]==_0x543c29[_0x5e20('0x6')]&&!_[_0x5e20('0x28')](unanswered,_0x21d1d8['destuniqueid'])){utils[_0x5e20('0x29')](util[_0x5e20('0x4')](_0x5e20('0x2a'),_0x543c29[_0x5e20('0x6')]),_0x543c29);utils[_0x5e20('0x3')](util[_0x5e20('0x4')](_0x5e20('0x2b'),_0x543c29[_0x5e20('0x6')],_0x21d1d8[_0x5e20('0x8')],_0x21d1d8[_0x5e20('0x13')]));_0x21d1d8[_0x5e20('0x2c')]=!![];_0x21d1d8['agentringnoanswerAt']=utils[_0x5e20('0x16')]();_0x21d1d8[_0x5e20('0x17')]=_0x5e20('0x2d');_0x21d1d8['reason']=_0x5e20('0x2d');_0x21d1d8[_0x5e20('0x22')]=_0x543c29[_0x5e20('0x22')];_0x21d1d8[_0x5e20('0x24')]=0x0;writeDB(_0x21d1d8);}});}catch(_0x244209){utils[_0x5e20('0x1b')](util[_0x5e20('0x4')](_0x5e20('0x2a'),_0x543c29[_0x5e20('0x6')]),_0x244209);}};exports[_0x5e20('0x2e')]=function(_0x36e825){try{if(agents[_0x36e825[_0x5e20('0x13')]]){utils[_0x5e20('0x29')](util[_0x5e20('0x4')]('[%s][agents][agentconnect]',_0x36e825[_0x5e20('0x6')]),_0x36e825);utils['info'](util['format'](_0x5e20('0x2f'),_0x36e825[_0x5e20('0x6')],agents[_0x36e825['destuniqueid']][_0x5e20('0x8')],_0x36e825[_0x5e20('0x13')]));agents[_0x36e825['destuniqueid']][_0x5e20('0x30')]=utils[_0x5e20('0x16')]();agents[_0x36e825[_0x5e20('0x13')]][_0x5e20('0x18')]=_0x36e825[_0x5e20('0x18')];agents[_0x36e825[_0x5e20('0x13')]][_0x5e20('0x19')]=_0x36e825[_0x5e20('0x19')];agents[_0x36e825[_0x5e20('0x13')]][_0x5e20('0x22')]=_0x36e825[_0x5e20('0x23')];agents[_0x36e825[_0x5e20('0x13')]][_0x5e20('0x17')]=_0x5e20('0x31');_[_0x5e20('0x27')](agents,function(_0x3d618c,_0x20e83d){if(_0x3d618c[_0x5e20('0x13')]!=_0x36e825['destuniqueid']&&_0x3d618c[_0x5e20('0x6')]==_0x36e825[_0x5e20('0x6')]){_0x3d618c[_0x5e20('0x24')]=0x0;_0x3d618c[_0x5e20('0x22')]=_0x36e825[_0x5e20('0x23')];_0x3d618c['agentringnoanswer']=!![];_0x3d618c[_0x5e20('0x1f')]=utils[_0x5e20('0x16')]();_0x3d618c[_0x5e20('0x17')]=_0x5e20('0x32');_0x3d618c[_0x5e20('0x21')]=_0x5e20('0x32');_0x3d618c['answeredelsewheredestinationuniqueid']=_0x36e825[_0x5e20('0x13')];_0x3d618c[_0x5e20('0x33')]=_0x36e825[_0x5e20('0x8')];writeDB(_0x3d618c);}});}}catch(_0x5a21f0){utils[_0x5e20('0x1b')](util[_0x5e20('0x4')](_0x5e20('0x34'),_0x36e825[_0x5e20('0x6')]),_0x5a21f0);}};exports[_0x5e20('0xe')]=function(_0x336d61){try{if(!_[_0x5e20('0x35')](agents[_0x336d61[_0x5e20('0x13')]])){utils['debug'](util[_0x5e20('0x4')](_0x5e20('0x36'),_0x336d61[_0x5e20('0x6')]),_0x336d61);utils['info'](util[_0x5e20('0x4')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x336d61[_0x5e20('0x6')],agents[_0x336d61[_0x5e20('0x13')]][_0x5e20('0x8')],_0x336d61[_0x5e20('0x13')]));agents[_0x336d61[_0x5e20('0x13')]]['agentcomplete']=!![];agents[_0x336d61[_0x5e20('0x13')]]['agentcompleteAt']=utils['now']();agents[_0x336d61[_0x5e20('0x13')]][_0x5e20('0x24')]=utils[_0x5e20('0x37')](agents[_0x336d61[_0x5e20('0x13')]][_0x5e20('0x38')],agents[_0x336d61[_0x5e20('0x13')]][_0x5e20('0x30')]);agents[_0x336d61['destuniqueid']]['reason']=_0x336d61[_0x5e20('0x21')];agents[_0x336d61[_0x5e20('0x13')]]['lastevent']=_0x5e20('0x39');writeDB(agents[_0x336d61[_0x5e20('0x13')]]);}}catch(_0xf1e97c){utils[_0x5e20('0x1b')](util[_0x5e20('0x4')]('[%s][agents][agentcomplete]',_0x336d61[_0x5e20('0x6')]),_0xf1e97c);}};exports[_0x5e20('0x3a')]=function(_0x25491e){try{if(!_[_0x5e20('0x35')](agents[_0x25491e[_0x5e20('0x3b')]])){utils[_0x5e20('0x29')](util[_0x5e20('0x4')](_0x5e20('0x3c'),_0x25491e['uniqueid']),_0x25491e);utils['info'](util['format'](_0x5e20('0x3d'),_0x25491e[_0x5e20('0x6')],agents[_0x25491e['transfereruniqueid']][_0x5e20('0x8')],agents[_0x25491e['transfereruniqueid']][_0x5e20('0x6')]));agents[_0x25491e['transfereruniqueid']][_0x5e20('0x3e')]=!![];agents[_0x25491e['transfereruniqueid']][_0x5e20('0x3f')]=_0x5e20('0x40');agents[_0x25491e[_0x5e20('0x3b')]][_0x5e20('0x41')]=_0x25491e[_0x5e20('0x42')];agents[_0x25491e[_0x5e20('0x3b')]][_0x5e20('0x43')]=agents[_0x25491e[_0x5e20('0x3b')]][_0x5e20('0x6')];}}catch(_0x43e890){utils[_0x5e20('0x1b')](util[_0x5e20('0x4')](_0x5e20('0x3c'),_0x25491e[_0x5e20('0x6')]),_0x43e890);}};exports[_0x5e20('0x44')]=function(_0xe7759c){try{utils[_0x5e20('0x29')](util[_0x5e20('0x4')]('[%s][agents][attendedtransfer]',_0xe7759c['origtransfereruniqueid']),_0xe7759c);if(_0xe7759c[_0x5e20('0x45')]==_0xe7759c['origtransfererlinkedid']){if(!_[_0x5e20('0x35')](agents[_0xe7759c[_0x5e20('0x46')]])){utils[_0x5e20('0x3')](util['format'](_0x5e20('0x47'),_0xe7759c[_0x5e20('0x45')],agents[_0xe7759c[_0x5e20('0x46')]]['membername']));agents[_0xe7759c['secondtransfereruniqueid']]['transfer']=!![];agents[_0xe7759c[_0x5e20('0x46')]][_0x5e20('0x3f')]=_0x5e20('0x48');agents[_0xe7759c[_0x5e20('0x46')]][_0x5e20('0x41')]=_0xe7759c[_0x5e20('0x49')];agents[_0xe7759c['secondtransfereruniqueid']][_0x5e20('0x43')]=_0xe7759c['origtransfereruniqueid'];}if(_0xe7759c[_0x5e20('0x4a')]&&agents[_0xe7759c['transfereeuniqueid']]){agents[_0xe7759c[_0x5e20('0x4a')]][_0x5e20('0x4b')]=0x1;transfers[_0xe7759c[_0x5e20('0x4a')]]=_['clone'](agents[_0xe7759c[_0x5e20('0x4a')]]);transfers[_0xe7759c[_0x5e20('0x4a')]][_0x5e20('0xa')]=agents[_0xe7759c[_0x5e20('0x46')]][_0x5e20('0xa')];transfers[_0xe7759c[_0x5e20('0x4a')]][_0x5e20('0x4c')]=agents[_0xe7759c['secondtransfereruniqueid']][_0x5e20('0x4c')];transfers[_0xe7759c[_0x5e20('0x4a')]][_0x5e20('0x15')]=utils[_0x5e20('0x16')]();transfers[_0xe7759c['transfereeuniqueid']][_0x5e20('0x30')]=utils[_0x5e20('0x16')]();transfers[_0xe7759c[_0x5e20('0x4a')]][_0x5e20('0x22')]=0x0;transfers[_0xe7759c['transfereeuniqueid']][_0x5e20('0x4b')]=0x2;}}else if(_0xe7759c[_0x5e20('0x46')]==_0xe7759c[_0x5e20('0x4d')]){if(!_['isNil'](agents[_0xe7759c['origtransfereruniqueid']])){utils['info'](util[_0x5e20('0x4')](_0x5e20('0x47'),_0xe7759c['origtransfereruniqueid'],agents[_0xe7759c[_0x5e20('0x45')]][_0x5e20('0x8')]));agents[_0xe7759c[_0x5e20('0x45')]]['transfer']=!![];agents[_0xe7759c[_0x5e20('0x45')]][_0x5e20('0x3f')]='ATTENDED';agents[_0xe7759c[_0x5e20('0x45')]][_0x5e20('0x41')]=_0xe7759c['secondtransfererexten'];agents[_0xe7759c[_0x5e20('0x45')]][_0x5e20('0x43')]=_0xe7759c[_0x5e20('0x46')];}if(_0xe7759c[_0x5e20('0x4e')]&&agents[_0xe7759c['transfertargetuniqueid']]){agents[_0xe7759c[_0x5e20('0x4e')]]['agententerreason']=0x1;transfers[_0xe7759c['transfertargetuniqueid']]=_[_0x5e20('0x4f')](agents[_0xe7759c[_0x5e20('0x4e')]]);transfers[_0xe7759c[_0x5e20('0x4e')]][_0x5e20('0xa')]=agents[_0xe7759c[_0x5e20('0x45')]][_0x5e20('0xa')];transfers[_0xe7759c['transfertargetuniqueid']]['calleridname']=agents[_0xe7759c[_0x5e20('0x45')]][_0x5e20('0x4c')];transfers[_0xe7759c[_0x5e20('0x4e')]]['agentcalledAt']=utils[_0x5e20('0x16')]();transfers[_0xe7759c[_0x5e20('0x4e')]]['agentconnectAt']=utils[_0x5e20('0x16')]();transfers[_0xe7759c['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0xe7759c[_0x5e20('0x4e')]]['agententerreason']=0x2;}}}catch(_0x3e4500){utils[_0x5e20('0x1b')](util[_0x5e20('0x4')]('[%s][agents][attendedtransfer]',_0xe7759c[_0x5e20('0x45')]),_0x3e4500);}};exports[_0x5e20('0x50')]=function(_0xd10013){try{utils[_0x5e20('0x29')](util[_0x5e20('0x4')]('[%s][agents][hangup]',_0xd10013[_0x5e20('0x6')]),_0xd10013);if(agents[_0xd10013[_0x5e20('0x6')]]&&agents[_0xd10013['uniqueid']][_0x5e20('0x21')]===_0x5e20('0x20')){if(_0xd10013[_0x5e20('0x51')]==='21'){agents[_0xd10013['uniqueid']][_0x5e20('0x21')]=_0x5e20('0x52');agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x17')]=_0x5e20('0x52');}utils['info'](util[_0x5e20('0x4')](_0x5e20('0x53'),_0xd10013[_0x5e20('0x6')],agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x8')],agents[_0xd10013['uniqueid']][_0x5e20('0x21')],agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x17')]));writeDB(agents[_0xd10013[_0x5e20('0x6')]]);var _0x1e7cf8=unanswered[_0x5e20('0x54')](_0xd10013[_0x5e20('0x6')]);if(_0x1e7cf8>-0x1){unanswered[_0x5e20('0x55')](_0x1e7cf8,0x1);}}if(transfers[_0xd10013['uniqueid']]){transfers[_0xd10013[_0x5e20('0x6')]]['agentcomplete']=!![];transfers[_0xd10013['uniqueid']][_0x5e20('0x38')]=utils[_0x5e20('0x16')]();transfers[_0xd10013['uniqueid']][_0x5e20('0x24')]=utils[_0x5e20('0x37')](transfers[_0xd10013['uniqueid']][_0x5e20('0x38')],transfers[_0xd10013['uniqueid']][_0x5e20('0x30')]);transfers[_0xd10013['uniqueid']][_0x5e20('0x21')]=_0x5e20('0x56');transfers[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x17')]=_0x5e20('0x39');utils['info'](util[_0x5e20('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xd10013[_0x5e20('0x6')],transfers[_0xd10013['uniqueid']][_0x5e20('0x8')],transfers[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x21')],transfers[_0xd10013[_0x5e20('0x6')]]['lastevent']));writeDB(transfers[_0xd10013[_0x5e20('0x6')]],!![]);}if(agents[_0xd10013[_0x5e20('0x6')]]&&agents[_0xd10013['uniqueid']]['agentconnectAt']){agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0xe')]=!![];agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x38')]=utils[_0x5e20('0x16')]();agents[_0xd10013['uniqueid']][_0x5e20('0x24')]=utils['diffTime'](agents[_0xd10013['uniqueid']][_0x5e20('0x38')],agents[_0xd10013['uniqueid']]['agentconnectAt']);agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x21')]=agents[_0xd10013['uniqueid']][_0x5e20('0x3e')]?_0x5e20('0x3e'):_0x5e20('0x56');agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x17')]='complete';utils[_0x5e20('0x3')](util[_0x5e20('0x4')](_0x5e20('0x53'),_0xd10013[_0x5e20('0x6')],agents[_0xd10013['uniqueid']]['membername'],agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x21')],agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x17')]));writeDB(agents[_0xd10013[_0x5e20('0x6')]]);}}catch(_0xdc9ff4){utils[_0x5e20('0x1b')](util[_0x5e20('0x4')](_0x5e20('0x57'),_0xd10013[_0x5e20('0x6')]),_0xdc9ff4);}}; \ No newline at end of file +var _0xb9a7=['connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete','[%s][agents][blindtransfer]','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','transfereeuniqueid','calleridname','agententerreason','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','splice','agentcompleteAt','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','util','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','agentacw','agentcomplete','acwtime','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','format','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','ringtime','talktime','queuecallerabandon','forIn','includes','agentringnoanswerAt','abandoned','holdtime','[%s][agents][queuecallerabandon]','agentconnect','agentconnectAt','connectedlinename'];(function(_0xd90e67,_0x51521a){var _0x11f75f=function(_0x436a22){while(--_0x436a22){_0xd90e67['push'](_0xd90e67['shift']());}};_0x11f75f(++_0x51521a);}(_0xb9a7,0x112));var _0x7b9a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xb9a7[_0x11005e];return _0x29338f;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x563857,_0x5f1a52){utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x2'),_0x563857[_0x7b9a('0x3')],_0x563857[_0x7b9a('0x4')],_0x563857[_0x7b9a('0x5')],_0x563857[_0x7b9a('0x6')],_0x563857[_0x7b9a('0x7')],_0x563857[_0x7b9a('0x8')],_0x563857[_0x7b9a('0x9')],_0x563857[_0x7b9a('0xa')]));if(_0x563857[_0x7b9a('0x5')]){utils['getVoiceQueueByName'](_0x563857[_0x7b9a('0x5')])[_0x7b9a('0xb')](function(_0x56a199){if(_0x56a199){_0x563857['type']=_0x56a199['type'];_0x563857[_0x7b9a('0xc')]=_0x563857[_0x7b9a('0xd')]?_0x56a199['acw']:![];_0x563857[_0x7b9a('0xe')]=_0x563857['agentacw']?_0x56a199[_0x7b9a('0xf')]:0x0;}utils['request'](_0x7b9a('0x10'),_0x563857);});}else{utils[_0x7b9a('0x11')](_0x7b9a('0x10'),_0x563857);}if(_0x5f1a52){delete transfers[_0x563857['uniqueid']];}else{delete agents[_0x563857[_0x7b9a('0x12')]];}}exports[_0x7b9a('0x13')]=function(_0x5e3875){try{utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')]('[%s][agents][agentcalled]',_0x5e3875[_0x7b9a('0x3')]),_0x5e3875);agents[_0x5e3875[_0x7b9a('0x12')]]=_0x5e3875;agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0x16')]=utils[_0x7b9a('0x17')]();agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x18');agents[_0x5e3875[_0x7b9a('0x12')]]['connectedlinenum']=null;agents[_0x5e3875[_0x7b9a('0x12')]]['connectedlinename']=null;utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x19'),_0x5e3875[_0x7b9a('0x3')],agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0x6')],_0x5e3875[_0x7b9a('0x12')]));}catch(_0x283cc3){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x1b'),_0x5e3875[_0x7b9a('0x3')]),_0x283cc3);}};exports[_0x7b9a('0x1c')]=function(_0x58aed7){try{if(!_[_0x7b9a('0x1d')](agents[_0x58aed7['destuniqueid']])){utils[_0x7b9a('0x14')](util['format'](_0x7b9a('0x1e'),_0x58aed7[_0x7b9a('0x3')]),_0x58aed7);utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x1f'),_0x58aed7[_0x7b9a('0x3')],agents[_0x58aed7['destuniqueid']][_0x7b9a('0x6')],_0x58aed7[_0x7b9a('0x12')]));agents[_0x58aed7[_0x7b9a('0x12')]][_0x7b9a('0x1c')]=!![];agents[_0x58aed7[_0x7b9a('0x12')]]['agentringnoanswerAt']=utils[_0x7b9a('0x17')]();agents[_0x58aed7[_0x7b9a('0x12')]]['lastevent']=_0x7b9a('0x20');agents[_0x58aed7['destuniqueid']][_0x7b9a('0x21')]=_0x7b9a('0x20');agents[_0x58aed7['destuniqueid']]['holdtime']=_0x58aed7[_0x7b9a('0x22')]?parseInt(_0x58aed7['ringtime'])/0x3e8:0x0;agents[_0x58aed7['destuniqueid']][_0x7b9a('0x23')]=0x0;unanswered['push'](_0x58aed7['destuniqueid']);}}catch(_0x3847b4){utils['error'](util[_0x7b9a('0x15')](_0x7b9a('0x1e'),_0x58aed7['uniqueid']),_0x3847b4);}};exports[_0x7b9a('0x24')]=function(_0x2e6144){try{_[_0x7b9a('0x25')](agents,function(_0x5b64d7,_0x45ccf5){if(_0x5b64d7[_0x7b9a('0x3')]==_0x2e6144[_0x7b9a('0x3')]&&!_[_0x7b9a('0x26')](unanswered,_0x5b64d7[_0x7b9a('0x12')])){utils[_0x7b9a('0x14')](util['format']('[%s][agents][queuecallerabandon]',_0x2e6144[_0x7b9a('0x3')]),_0x2e6144);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2e6144[_0x7b9a('0x3')],_0x5b64d7[_0x7b9a('0x6')],_0x5b64d7['destuniqueid']));_0x5b64d7['agentringnoanswer']=!![];_0x5b64d7[_0x7b9a('0x27')]=utils[_0x7b9a('0x17')]();_0x5b64d7['lastevent']=_0x7b9a('0x28');_0x5b64d7[_0x7b9a('0x21')]=_0x7b9a('0x28');_0x5b64d7[_0x7b9a('0x29')]=_0x2e6144[_0x7b9a('0x29')];_0x5b64d7['talktime']=0x0;writeDB(_0x5b64d7);}});}catch(_0x46bcd0){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x2a'),_0x2e6144[_0x7b9a('0x3')]),_0x46bcd0);}};exports[_0x7b9a('0x2b')]=function(_0x5f1da4){try{if(agents[_0x5f1da4['destuniqueid']]){utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')]('[%s][agents][agentconnect]',_0x5f1da4[_0x7b9a('0x3')]),_0x5f1da4);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x5f1da4[_0x7b9a('0x3')],agents[_0x5f1da4[_0x7b9a('0x12')]]['membername'],_0x5f1da4['destuniqueid']));agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x2c')]=utils[_0x7b9a('0x17')]();agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x9')]=_0x5f1da4[_0x7b9a('0x9')];agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x2d')]=_0x5f1da4['connectedlinename'];agents[_0x5f1da4[_0x7b9a('0x12')]]['holdtime']=_0x5f1da4[_0x7b9a('0x22')];agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x2e');_[_0x7b9a('0x25')](agents,function(_0x89951b,_0x5e504f){if(_0x89951b[_0x7b9a('0x12')]!=_0x5f1da4[_0x7b9a('0x12')]&&_0x89951b[_0x7b9a('0x3')]==_0x5f1da4[_0x7b9a('0x3')]){_0x89951b['talktime']=0x0;_0x89951b[_0x7b9a('0x29')]=_0x5f1da4[_0x7b9a('0x22')];_0x89951b[_0x7b9a('0x1c')]=!![];_0x89951b[_0x7b9a('0x27')]=utils['now']();_0x89951b[_0x7b9a('0xa')]='answered_elsewhere';_0x89951b[_0x7b9a('0x21')]=_0x7b9a('0x2f');_0x89951b[_0x7b9a('0x30')]=_0x5f1da4[_0x7b9a('0x12')];_0x89951b[_0x7b9a('0x31')]=_0x5f1da4[_0x7b9a('0x6')];writeDB(_0x89951b);}});}}catch(_0x56e274){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x32'),_0x5f1da4['uniqueid']),_0x56e274);}};exports['agentcomplete']=function(_0x3724fe){try{if(!_[_0x7b9a('0x1d')](agents[_0x3724fe[_0x7b9a('0x12')]])){utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')](_0x7b9a('0x33'),_0x3724fe['uniqueid']),_0x3724fe);utils['info'](util['format'](_0x7b9a('0x34'),_0x3724fe[_0x7b9a('0x3')],agents[_0x3724fe['destuniqueid']][_0x7b9a('0x6')],_0x3724fe[_0x7b9a('0x12')]));agents[_0x3724fe[_0x7b9a('0x12')]]['agentcomplete']=!![];agents[_0x3724fe[_0x7b9a('0x12')]]['agentcompleteAt']=utils[_0x7b9a('0x17')]();agents[_0x3724fe[_0x7b9a('0x12')]][_0x7b9a('0x23')]=utils[_0x7b9a('0x35')](agents[_0x3724fe[_0x7b9a('0x12')]]['agentcompleteAt'],agents[_0x3724fe[_0x7b9a('0x12')]]['agentconnectAt']);agents[_0x3724fe[_0x7b9a('0x12')]]['reason']=_0x3724fe['reason'];agents[_0x3724fe[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x36');writeDB(agents[_0x3724fe[_0x7b9a('0x12')]]);}}catch(_0x1cbd5a){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x33'),_0x3724fe[_0x7b9a('0x3')]),_0x1cbd5a);}};exports['blindtransfer']=function(_0x1d7957){try{if(!_[_0x7b9a('0x1d')](agents[_0x1d7957['transfereruniqueid']])){utils['debug'](util['format'](_0x7b9a('0x37'),_0x1d7957[_0x7b9a('0x3')]),_0x1d7957);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x1d7957[_0x7b9a('0x3')],agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x6')],agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3')]));agents[_0x1d7957['transfereruniqueid']][_0x7b9a('0x39')]=!![];agents[_0x1d7957['transfereruniqueid']][_0x7b9a('0x3a')]=_0x7b9a('0x3b');agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3c')]=_0x1d7957['extension'];agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3d')]=agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3')];}}catch(_0x2b0db5){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')]('[%s][agents][blindtransfer]',_0x1d7957['uniqueid']),_0x2b0db5);}};exports['attendedtransfer']=function(_0x12c5bf){try{utils[_0x7b9a('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x12c5bf['origtransfereruniqueid']),_0x12c5bf);if(_0x12c5bf['origtransfereruniqueid']==_0x12c5bf[_0x7b9a('0x3e')]){if(!_[_0x7b9a('0x1d')](agents[_0x12c5bf[_0x7b9a('0x3f')]])){utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x40'),_0x12c5bf[_0x7b9a('0x41')],agents[_0x12c5bf[_0x7b9a('0x3f')]]['membername']));agents[_0x12c5bf[_0x7b9a('0x3f')]]['transfer']=!![];agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x3a')]=_0x7b9a('0x42');agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x3c')]=_0x12c5bf['origtransfererexten'];agents[_0x12c5bf[_0x7b9a('0x3f')]]['transferuniqueid']=_0x12c5bf[_0x7b9a('0x41')];}if(_0x12c5bf[_0x7b9a('0x43')]&&agents[_0x12c5bf[_0x7b9a('0x43')]]){agents[_0x12c5bf['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x12c5bf['transfereeuniqueid']]=_['clone'](agents[_0x12c5bf[_0x7b9a('0x43')]]);transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x8')]=agents[_0x12c5bf['secondtransfereruniqueid']][_0x7b9a('0x8')];transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x44')]=agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x44')];transfers[_0x12c5bf['transfereeuniqueid']][_0x7b9a('0x16')]=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf[_0x7b9a('0x43')]]['agentconnectAt']=utils['now']();transfers[_0x12c5bf['transfereeuniqueid']][_0x7b9a('0x29')]=0x0;transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x45')]=0x2;}}else if(_0x12c5bf['secondtransfereruniqueid']==_0x12c5bf[_0x7b9a('0x46')]){if(!_[_0x7b9a('0x1d')](agents[_0x12c5bf['origtransfereruniqueid']])){utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x40'),_0x12c5bf['origtransfereruniqueid'],agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x6')]));agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x39')]=!![];agents[_0x12c5bf['origtransfereruniqueid']][_0x7b9a('0x3a')]=_0x7b9a('0x42');agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x3c')]=_0x12c5bf['secondtransfererexten'];agents[_0x12c5bf[_0x7b9a('0x41')]]['transferuniqueid']=_0x12c5bf[_0x7b9a('0x3f')];}if(_0x12c5bf['transfertargetuniqueid']&&agents[_0x12c5bf[_0x7b9a('0x47')]]){agents[_0x12c5bf['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x12c5bf['transfertargetuniqueid']]=_['clone'](agents[_0x12c5bf[_0x7b9a('0x47')]]);transfers[_0x12c5bf[_0x7b9a('0x47')]][_0x7b9a('0x8')]=agents[_0x12c5bf[_0x7b9a('0x41')]]['calleridnum'];transfers[_0x12c5bf[_0x7b9a('0x47')]]['calleridname']=agents[_0x12c5bf['origtransfereruniqueid']][_0x7b9a('0x44')];transfers[_0x12c5bf['transfertargetuniqueid']]['agentcalledAt']=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf[_0x7b9a('0x47')]]['agentconnectAt']=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf['transfertargetuniqueid']][_0x7b9a('0x29')]=0x0;transfers[_0x12c5bf[_0x7b9a('0x47')]][_0x7b9a('0x45')]=0x2;}}}catch(_0x5118b3){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0x12c5bf[_0x7b9a('0x41')]),_0x5118b3);}};exports[_0x7b9a('0x48')]=function(_0x3fd697){try{utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')](_0x7b9a('0x49'),_0x3fd697[_0x7b9a('0x3')]),_0x3fd697);if(agents[_0x3fd697['uniqueid']]&&agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]==='timeout'){if(_0x3fd697[_0x7b9a('0x4a')]==='21'){agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]='rejected';agents[_0x3fd697['uniqueid']][_0x7b9a('0xa')]=_0x7b9a('0x4b');}utils['info'](util[_0x7b9a('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3fd697[_0x7b9a('0x3')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x6')],agents[_0x3fd697['uniqueid']][_0x7b9a('0x21')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]));writeDB(agents[_0x3fd697[_0x7b9a('0x3')]]);var _0x2090ef=unanswered['indexOf'](_0x3fd697['uniqueid']);if(_0x2090ef>-0x1){unanswered[_0x7b9a('0x4c')](_0x2090ef,0x1);}}if(transfers[_0x3fd697[_0x7b9a('0x3')]]){transfers[_0x3fd697['uniqueid']][_0x7b9a('0xd')]=!![];transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')]=utils['now']();transfers[_0x3fd697['uniqueid']][_0x7b9a('0x23')]=utils[_0x7b9a('0x35')](transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')],transfers[_0x3fd697['uniqueid']][_0x7b9a('0x2c')]);transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]='agent';transfers[_0x3fd697['uniqueid']][_0x7b9a('0xa')]=_0x7b9a('0x36');utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3fd697[_0x7b9a('0x3')],transfers[_0x3fd697[_0x7b9a('0x3')]]['membername'],transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')],transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]));writeDB(transfers[_0x3fd697[_0x7b9a('0x3')]],!![]);}if(agents[_0x3fd697[_0x7b9a('0x3')]]&&agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x2c')]){agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xd')]=!![];agents[_0x3fd697[_0x7b9a('0x3')]]['agentcompleteAt']=utils['now']();agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x23')]=utils['diffTime'](agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')],agents[_0x3fd697['uniqueid']][_0x7b9a('0x2c')]);agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]=agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x39')]?_0x7b9a('0x39'):_0x7b9a('0x4e');agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]='complete';utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x4f'),_0x3fd697[_0x7b9a('0x3')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x6')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')],agents[_0x3fd697['uniqueid']][_0x7b9a('0xa')]));writeDB(agents[_0x3fd697[_0x7b9a('0x3')]]);}}catch(_0x3022e0){utils['error'](util[_0x7b9a('0x15')](_0x7b9a('0x49'),_0x3fd697[_0x7b9a('0x3')]),_0x3022e0);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index f0f32e9..e6ad0bb 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 _0x75ce=['UserId','CreateVoiceCallReport','request','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','format','newstate','debug','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','ANSWERED','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','starttime','attendedtransfer','[%s][calls][attendedtransfer]','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','diffTime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','lastdata','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','noop','execif','gotoif','lodash','util','NO\x20ANSWER','FAILED','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x75ce,0x1a9));var _0xe75c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x75ce[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xe75c('0x0'));var util=require(_0xe75c('0x1'));var utils=require('./utils');var dispositions=[_0xe75c('0x2'),_0xe75c('0x3'),_0xe75c('0x3'),_0xe75c('0x2'),_0xe75c('0x2'),_0xe75c('0x2'),'ANSWERED','BUSY','FAILED',_0xe75c('0x3'),'FAILED'];var channels={};function writeDB(_0x99d88e){utils[_0xe75c('0x4')](util['format'](_0xe75c('0x5'),_0x99d88e[_0xe75c('0x6')],_0x99d88e[_0xe75c('0x7')],_0x99d88e[_0xe75c('0x8')],_0x99d88e['membername'],_0x99d88e[_0xe75c('0x9')],_0x99d88e[_0xe75c('0xa')],_0x99d88e[_0xe75c('0xb')],_0x99d88e[_0xe75c('0xc')]));if(_0x99d88e['accountcode']){utils[_0xe75c('0xd')](_0x99d88e[_0xe75c('0xe')])['then'](function(_0x31661e){if(_0x31661e){_0x99d88e[_0xe75c('0xf')]=_0x31661e['id'];}utils['request'](_0xe75c('0x10'),_0x99d88e);});}else{utils[_0xe75c('0x11')](_0xe75c('0x10'),_0x99d88e);}if(channels[_0x99d88e['uniqueid']]){delete channels[_0x99d88e['uniqueid']];}}exports[_0xe75c('0x12')]=function(_0x2c147b){try{utils['debug'](util['format'](_0xe75c('0x13'),_0x2c147b[_0xe75c('0x6')]),_0x2c147b);if(_0x2c147b['uniqueid']==_0x2c147b[_0xe75c('0x14')]&&_0x2c147b[_0xe75c('0x7')]!=_0xe75c('0x15')){utils[_0xe75c('0x4')](util['format'](_0xe75c('0x16'),_0x2c147b[_0xe75c('0x6')],_0x2c147b[_0xe75c('0x17')],_0x2c147b[_0xe75c('0x18')]));channels[_0x2c147b[_0xe75c('0x6')]]={'uniqueid':_0x2c147b[_0xe75c('0x6')],'accountcode':_0x2c147b[_0xe75c('0xe')],'source':_0x2c147b[_0xe75c('0xa')],'destination':_0x2c147b['exten'],'destinationcontext':_0x2c147b[_0xe75c('0x17')],'channel':_0x2c147b['channel'],'starttime':utils[_0xe75c('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xe75c('0x2'),'amaflags':_0xe75c('0x1a')};}}catch(_0x390705){utils[_0xe75c('0x1b')](util[_0xe75c('0x1c')](_0xe75c('0x13'),_0x2c147b['uniqueid']),_0x390705);}};exports[_0xe75c('0x1d')]=function(_0x2ee9d8){try{utils[_0xe75c('0x1e')](util[_0xe75c('0x1c')]('[%s][calls][newstate]',_0x2ee9d8[_0xe75c('0x6')]),_0x2ee9d8);if(!_[_0xe75c('0x1f')](channels[_0x2ee9d8[_0xe75c('0x6')]])&&_0x2ee9d8[_0xe75c('0x20')]==0x6){utils[_0xe75c('0x4')](util[_0xe75c('0x1c')](_0xe75c('0x21'),_0x2ee9d8['uniqueid'],_0x2ee9d8[_0xe75c('0x17')],_0x2ee9d8[_0xe75c('0x7')]));if(_[_0xe75c('0x1f')](channels[_0x2ee9d8[_0xe75c('0x6')]]['systemanswertime'])){channels[_0x2ee9d8[_0xe75c('0x6')]][_0xe75c('0x22')]=utils[_0xe75c('0x19')]();}}else if(!_[_0xe75c('0x1f')](channels[_0x2ee9d8[_0xe75c('0x14')]])&&_0x2ee9d8[_0xe75c('0x20')]==0x6&&_0x2ee9d8['context']!=_0xe75c('0x23')){utils['info'](util[_0xe75c('0x1c')](_0xe75c('0x24'),_0x2ee9d8[_0xe75c('0x6')],_0x2ee9d8['linkedid'],_0x2ee9d8[_0xe75c('0x17')],_0x2ee9d8['channel']));channels[_0x2ee9d8[_0xe75c('0x14')]][_0xe75c('0xe')]=_0x2ee9d8[_0xe75c('0xe')];channels[_0x2ee9d8[_0xe75c('0x14')]][_0xe75c('0x25')]=_0x2ee9d8[_0xe75c('0x7')];if(_[_0xe75c('0x1f')](channels[_0x2ee9d8[_0xe75c('0x14')]][_0xe75c('0x26')])){channels[_0x2ee9d8[_0xe75c('0x14')]][_0xe75c('0x26')]=utils[_0xe75c('0x19')]();}channels[_0x2ee9d8[_0xe75c('0x14')]][_0xe75c('0x27')]=dispositions[_[_0xe75c('0x28')](_0x2ee9d8[_0xe75c('0x20')])]||_0xe75c('0x29');}}catch(_0x3927e0){utils[_0xe75c('0x1b')](util['format'](_0xe75c('0x2a'),_0x2ee9d8['uniqueid']),_0x3927e0);}};exports[_0xe75c('0x2b')]=function(_0x15f621){try{if(!_[_0xe75c('0x1f')](channels[_0x15f621[_0xe75c('0x6')]])){utils['debug'](util[_0xe75c('0x1c')](_0xe75c('0x2c'),_0x15f621[_0xe75c('0x6')]),_0x15f621);if(_[_0xe75c('0x1f')](channels[_0x15f621['uniqueid']][_0xe75c('0x2d')])){channels[_0x15f621[_0xe75c('0x6')]][_0xe75c('0x2d')]=_0x15f621[_0xe75c('0x2e')]+'\x20<'+_0x15f621[_0xe75c('0xa')]+'>';}utils[_0xe75c('0x4')](util[_0xe75c('0x1c')](_0xe75c('0x2f'),_0x15f621[_0xe75c('0x6')],channels[_0x15f621[_0xe75c('0x6')]][_0xe75c('0x2d')],_0x15f621['cause-txt']));channels[_0x15f621[_0xe75c('0x6')]][_0xe75c('0x30')]=utils[_0xe75c('0x19')]();channels[_0x15f621['uniqueid']][_0xe75c('0x31')]=utils['diffTime'](channels[_0x15f621['uniqueid']][_0xe75c('0x30')],channels[_0x15f621[_0xe75c('0x6')]][_0xe75c('0x32')]);channels[_0x15f621[_0xe75c('0x6')]]['billableseconds']=channels[_0x15f621[_0xe75c('0x6')]][_0xe75c('0x26')]?utils['diffTime'](channels[_0x15f621[_0xe75c('0x6')]][_0xe75c('0x30')],channels[_0x15f621[_0xe75c('0x6')]][_0xe75c('0x26')]):0x0;writeDB(channels[_0x15f621[_0xe75c('0x6')]]);}}catch(_0xaa779b){utils[_0xe75c('0x1b')](util['format']('[%s][calls][hangup]',_0x15f621[_0xe75c('0x6')]),_0xaa779b);}};exports[_0xe75c('0x33')]=function(_0x420af4){try{if(!_[_0xe75c('0x1f')](channels[_0x420af4['localtwolinkedid']])){utils[_0xe75c('0x1e')](util[_0xe75c('0x1c')](_0xe75c('0x34'),_0x420af4['origtransfereruniqueid']),_0x420af4);if(channels[_0x420af4[_0xe75c('0x35')]]['channel']==_0x420af4[_0xe75c('0x36')]){utils[_0xe75c('0x4')](util[_0xe75c('0x1c')](_0xe75c('0x37'),_0x420af4[_0xe75c('0x38')],_0x420af4[_0xe75c('0x35')],_0x420af4[_0xe75c('0x39')]));channels[_0x420af4[_0xe75c('0x35')]][_0xe75c('0x25')]=_0x420af4['secondtransfererchannel'];channels[_0x420af4[_0xe75c('0x35')]][_0xe75c('0x3a')]=_0xe75c('0x3b');}else if(channels[_0x420af4['localtwolinkedid']][_0xe75c('0x7')]=_0x420af4[_0xe75c('0x3c')]){utils[_0xe75c('0x4')](util[_0xe75c('0x1c')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x420af4[_0xe75c('0x38')],_0x420af4[_0xe75c('0x35')],_0x420af4[_0xe75c('0x3d')]));channels[_0x420af4['localtwolinkedid']][_0xe75c('0x25')]=_0x420af4['origtransfererchannel'];channels[_0x420af4[_0xe75c('0x35')]][_0xe75c('0x3a')]=_0xe75c('0x3b');}}}catch(_0x3829f2){utils[_0xe75c('0x1b')](util[_0xe75c('0x1c')](_0xe75c('0x34'),_0x420af4[_0xe75c('0x38')]),_0x3829f2);}};exports['musiconholdstart']=function(_0x3085f2){try{if(!_[_0xe75c('0x1f')](channels[_0x3085f2['uniqueid']])){utils[_0xe75c('0x1e')](util['format'](_0xe75c('0x3e'),_0x3085f2[_0xe75c('0x6')]),_0x3085f2);channels[_0x3085f2[_0xe75c('0x6')]][_0xe75c('0x3f')]=utils['now']();utils[_0xe75c('0x4')](util[_0xe75c('0x1c')](_0xe75c('0x40'),_0x3085f2[_0xe75c('0x6')],channels[_0x3085f2[_0xe75c('0x6')]]['musiconholdstartAt']));}}catch(_0x325215){utils[_0xe75c('0x1b')](util[_0xe75c('0x1c')](_0xe75c('0x3e'),_0x3085f2[_0xe75c('0x6')]),_0x325215);}};exports[_0xe75c('0x41')]=function(_0x4ac6aa){try{if(!_[_0xe75c('0x1f')](channels[_0x4ac6aa[_0xe75c('0x6')]])){utils[_0xe75c('0x1e')](util[_0xe75c('0x1c')](_0xe75c('0x42'),_0x4ac6aa[_0xe75c('0x6')]),_0x4ac6aa);if(!_[_0xe75c('0x1f')](channels[_0x4ac6aa['uniqueid']]['musiconholdstartAt'])){channels[_0x4ac6aa[_0xe75c('0x6')]][_0xe75c('0x43')]+=utils[_0xe75c('0x44')](utils[_0xe75c('0x19')](),channels[_0x4ac6aa[_0xe75c('0x6')]][_0xe75c('0x3f')]);utils[_0xe75c('0x4')](util[_0xe75c('0x1c')](_0xe75c('0x45'),_0x4ac6aa[_0xe75c('0x6')],channels[_0x4ac6aa[_0xe75c('0x6')]]['mohtime']));delete channels[_0x4ac6aa[_0xe75c('0x6')]][_0xe75c('0x3f')];}}}catch(_0x21f168){utils['error'](util[_0xe75c('0x1c')]('[%s][calls][musiconholdstop]',_0x4ac6aa[_0xe75c('0x6')]),_0x21f168);}};exports[_0xe75c('0x46')]=function(_0x4c214f){try{if(!_['isNil'](channels[_0x4c214f[_0xe75c('0x6')]])){utils[_0xe75c('0x1e')](util[_0xe75c('0x1c')](_0xe75c('0x47'),_0x4c214f[_0xe75c('0x6')]),_0x4c214f);if(!_[_0xe75c('0x1f')](_0x4c214f[_0xe75c('0x48')][_0xe75c('0x49')])){utils[_0xe75c('0x4')](util['format'](_0xe75c('0x4a'),_0x4c214f['uniqueid'],_0x4c214f[_0xe75c('0x4b')]));channels[_0x4c214f[_0xe75c('0x6')]][_0xe75c('0x4c')]=_0x4c214f[_0xe75c('0x4b')];}if(!_[_0xe75c('0x1f')](_0x4c214f[_0xe75c('0x48')][_0xe75c('0x4d')])){utils[_0xe75c('0x4')](util[_0xe75c('0x1c')](_0xe75c('0x4e'),_0x4c214f[_0xe75c('0x6')],_0x4c214f['value']));channels[_0x4c214f[_0xe75c('0x6')]][_0xe75c('0x4f')]=_0x4c214f[_0xe75c('0x4b')];channels[_0x4c214f[_0xe75c('0x6')]][_0xe75c('0x2d')]='\x22'+_0x4c214f[_0xe75c('0x4b')]+_0xe75c('0x50')+_0x4c214f[_0xe75c('0x4b')]+'>';}if(!_['isNil'](_0x4c214f[_0xe75c('0x48')][_0xe75c('0x51')])||!_[_0xe75c('0x1f')](_0x4c214f['variable'][_0xe75c('0x52')])){utils[_0xe75c('0x4')](util[_0xe75c('0x1c')](_0xe75c('0x53'),_0x4c214f[_0xe75c('0x6')],!_[_0xe75c('0x1f')](_0x4c214f['variable'][_0xe75c('0x51')])?_0xe75c('0x51'):_0xe75c('0x52'),_0x4c214f[_0xe75c('0x4b')]));channels[_0x4c214f[_0xe75c('0x6')]][_0xe75c('0x2d')]=_0x4c214f['value'];}if(!_[_0xe75c('0x1f')](_0x4c214f[_0xe75c('0x48')][_0xe75c('0x54')])||!_[_0xe75c('0x1f')](_0x4c214f[_0xe75c('0x48')][_0xe75c('0x55')])){utils[_0xe75c('0x4')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4c214f[_0xe75c('0x6')],!_[_0xe75c('0x1f')](_0x4c214f[_0xe75c('0x48')]['xmd-queue'])?_0xe75c('0x54'):_0xe75c('0x55'),_0x4c214f[_0xe75c('0x4b')]));channels[_0x4c214f['uniqueid']]['lastapplication']=_0xe75c('0x56');channels[_0x4c214f[_0xe75c('0x6')]][_0xe75c('0x57')]=_0x4c214f[_0xe75c('0x4b')];channels[_0x4c214f[_0xe75c('0x6')]]['queue']=!![];}if(!_[_0xe75c('0x1f')](_0x4c214f[_0xe75c('0x48')]['xmd-contactid'])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x4c214f[_0xe75c('0x6')],_0x4c214f[_0xe75c('0x4b')]));channels[_0x4c214f[_0xe75c('0x6')]][_0xe75c('0x58')]=_0x4c214f['value'];}if(!_[_0xe75c('0x1f')](_0x4c214f[_0xe75c('0x48')][_0xe75c('0x59')])){utils[_0xe75c('0x4')](util[_0xe75c('0x1c')](_0xe75c('0x5a'),_0x4c214f[_0xe75c('0x6')],_0x4c214f[_0xe75c('0x4b')]));channels[_0x4c214f[_0xe75c('0x6')]][_0xe75c('0x5b')]=_0x4c214f['value'];}if(!_[_0xe75c('0x1f')](_0x4c214f[_0xe75c('0x48')][_0xe75c('0x5c')])){utils['info'](util[_0xe75c('0x1c')](_0xe75c('0x5d'),_0x4c214f[_0xe75c('0x6')],_0x4c214f[_0xe75c('0x4b')]));channels[_0x4c214f['uniqueid']][_0xe75c('0x5e')]=_0x4c214f[_0xe75c('0x4b')];}if(!_[_0xe75c('0x1f')](_0x4c214f[_0xe75c('0x48')][_0xe75c('0x5f')])){utils['info'](util['format'](_0xe75c('0x60'),_0x4c214f[_0xe75c('0x6')],_0x4c214f[_0xe75c('0x4b')]));channels[_0x4c214f[_0xe75c('0x6')]]['sipcallid']=_0x4c214f[_0xe75c('0x4b')];}}}catch(_0x34a586){utils[_0xe75c('0x1b')](util[_0xe75c('0x1c')](_0xe75c('0x47'),_0x4c214f[_0xe75c('0x6')]),_0x34a586);}};exports[_0xe75c('0x61')]=function(_0x396a8c){try{if(!_[_0xe75c('0x1f')](channels[_0x396a8c[_0xe75c('0x6')]])){utils[_0xe75c('0x1e')](util[_0xe75c('0x1c')](_0xe75c('0x62'),_0x396a8c['uniqueid']),_0x396a8c);utils['info'](util[_0xe75c('0x1c')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x396a8c[_0xe75c('0x6')],_0x396a8c[_0xe75c('0x63')],_0x396a8c[_0xe75c('0x64')]));if(_0x396a8c[_0xe75c('0x63')][_0xe75c('0x65')]()==_0xe75c('0x66')&&_['startsWith'](_0x396a8c[_0xe75c('0x64')][_0xe75c('0x65')](),_0xe75c('0x67'))){var _0x624d1f=_0x396a8c[_0xe75c('0x64')][_0xe75c('0x68')]('=');var _0x53facf=_0x624d1f[0x0][_0xe75c('0x69')](_0x624d1f[0x0]['lastIndexOf']('(')+0x1,_0x624d1f[0x0][_0xe75c('0x6a')](')'));var _0x4458da=_0x624d1f[0x1];channels[_0x396a8c[_0xe75c('0x6')]][_0x53facf]=_0x4458da;}if(!_['includes']([_0xe75c('0x2b'),_0xe75c('0x6b'),_0xe75c('0x6c'),_0xe75c('0x66'),_0xe75c('0x6d')],_0x396a8c[_0xe75c('0x63')]['toLowerCase']())){channels[_0x396a8c[_0xe75c('0x6')]]['lastapplication']=_0x396a8c[_0xe75c('0x63')];channels[_0x396a8c['uniqueid']][_0xe75c('0x57')]=_0x396a8c[_0xe75c('0x64')];}}}catch(_0x256f35){utils['error'](util[_0xe75c('0x1c')](_0xe75c('0x62'),_0x396a8c[_0xe75c('0x6')]),_0x256f35);}}; \ No newline at end of file +var _0x9133=['queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','debug','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','destinationchannel','answertime','now','disposition','toNumber','hangup','[%s][calls][hangup]','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','callerid','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','[%s][calls][newexten]','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel'];(function(_0x2f6398,_0x5ce67c){var _0x288926=function(_0x459c43){while(--_0x459c43){_0x2f6398['push'](_0x2f6398['shift']());}};_0x288926(++_0x5ce67c);}(_0x9133,0x131));var _0x3913=function(_0x36c9fb,_0x307935){_0x36c9fb=_0x36c9fb-0x0;var _0x818f0a=_0x9133[_0x36c9fb];return _0x818f0a;};'use strict';var _=require(_0x3913('0x0'));var util=require(_0x3913('0x1'));var utils=require(_0x3913('0x2'));var dispositions=[_0x3913('0x3'),_0x3913('0x4'),_0x3913('0x4'),_0x3913('0x3'),_0x3913('0x3'),'NO\x20ANSWER',_0x3913('0x5'),'BUSY','FAILED',_0x3913('0x4'),_0x3913('0x4')];var channels={};function writeDB(_0x417a61){utils['info'](util[_0x3913('0x6')](_0x3913('0x7'),_0x417a61[_0x3913('0x8')],_0x417a61[_0x3913('0x9')],_0x417a61[_0x3913('0xa')],_0x417a61[_0x3913('0xb')],_0x417a61[_0x3913('0xc')],_0x417a61[_0x3913('0xd')],_0x417a61[_0x3913('0xe')],_0x417a61['lastevent']));if(_0x417a61[_0x3913('0xf')]){utils[_0x3913('0x10')](_0x417a61[_0x3913('0xf')])[_0x3913('0x11')](function(_0x3f4262){if(_0x3f4262){_0x417a61['UserId']=_0x3f4262['id'];}utils[_0x3913('0x12')](_0x3913('0x13'),_0x417a61);});}else{utils[_0x3913('0x12')](_0x3913('0x13'),_0x417a61);}if(channels[_0x417a61['uniqueid']]){delete channels[_0x417a61['uniqueid']];}}exports[_0x3913('0x14')]=function(_0x1bf30e){try{utils[_0x3913('0x15')](util[_0x3913('0x6')]('[%s][calls][newchannel]',_0x1bf30e[_0x3913('0x8')]),_0x1bf30e);if(_0x1bf30e[_0x3913('0x8')]==_0x1bf30e[_0x3913('0x16')]&&_0x1bf30e['channel']!=_0x3913('0x17')){utils[_0x3913('0x18')](util[_0x3913('0x6')](_0x3913('0x19'),_0x1bf30e['uniqueid'],_0x1bf30e['context'],_0x1bf30e[_0x3913('0x1a')]));channels[_0x1bf30e[_0x3913('0x8')]]={'uniqueid':_0x1bf30e[_0x3913('0x8')],'accountcode':_0x1bf30e[_0x3913('0xf')],'source':_0x1bf30e[_0x3913('0xd')],'destination':_0x1bf30e[_0x3913('0x1a')],'destinationcontext':_0x1bf30e[_0x3913('0x1b')],'channel':_0x1bf30e[_0x3913('0x9')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x3913('0x3'),'amaflags':_0x3913('0x1c')};}}catch(_0x31ba39){utils[_0x3913('0x1d')](util[_0x3913('0x6')](_0x3913('0x1e'),_0x1bf30e[_0x3913('0x8')]),_0x31ba39);}};exports[_0x3913('0x1f')]=function(_0x31c446){try{utils[_0x3913('0x15')](util['format'](_0x3913('0x20'),_0x31c446[_0x3913('0x8')]),_0x31c446);if(!_['isNil'](channels[_0x31c446[_0x3913('0x8')]])&&_0x31c446['channelstate']==0x6){utils[_0x3913('0x18')](util[_0x3913('0x6')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x31c446['uniqueid'],_0x31c446[_0x3913('0x1b')],_0x31c446[_0x3913('0x9')]));if(_[_0x3913('0x21')](channels[_0x31c446[_0x3913('0x8')]]['systemanswertime'])){channels[_0x31c446[_0x3913('0x8')]]['systemanswertime']=utils['now']();}}else if(!_[_0x3913('0x21')](channels[_0x31c446[_0x3913('0x16')]])&&_0x31c446['channelstate']==0x6&&_0x31c446[_0x3913('0x1b')]!='transfer'){utils[_0x3913('0x18')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x31c446[_0x3913('0x8')],_0x31c446[_0x3913('0x16')],_0x31c446[_0x3913('0x1b')],_0x31c446[_0x3913('0x9')]));channels[_0x31c446[_0x3913('0x16')]]['accountcode']=_0x31c446[_0x3913('0xf')];channels[_0x31c446[_0x3913('0x16')]][_0x3913('0x22')]=_0x31c446[_0x3913('0x9')];if(_[_0x3913('0x21')](channels[_0x31c446[_0x3913('0x16')]][_0x3913('0x23')])){channels[_0x31c446[_0x3913('0x16')]][_0x3913('0x23')]=utils[_0x3913('0x24')]();}channels[_0x31c446[_0x3913('0x16')]][_0x3913('0x25')]=dispositions[_[_0x3913('0x26')](_0x31c446['channelstate'])]||'ANSWERED';}}catch(_0xa72213){utils[_0x3913('0x1d')](util[_0x3913('0x6')](_0x3913('0x20'),_0x31c446['uniqueid']),_0xa72213);}};exports[_0x3913('0x27')]=function(_0x39818d){try{if(!_[_0x3913('0x21')](channels[_0x39818d['uniqueid']])){utils['debug'](util['format'](_0x3913('0x28'),_0x39818d[_0x3913('0x8')]),_0x39818d);if(_[_0x3913('0x21')](channels[_0x39818d['uniqueid']]['callerid'])){channels[_0x39818d['uniqueid']]['callerid']=_0x39818d[_0x3913('0x29')]+'\x20<'+_0x39818d[_0x3913('0xd')]+'>';}utils['info'](util['format'](_0x3913('0x2a'),_0x39818d[_0x3913('0x8')],channels[_0x39818d[_0x3913('0x8')]][_0x3913('0x2b')],_0x39818d[_0x3913('0x2c')]));channels[_0x39818d[_0x3913('0x8')]][_0x3913('0x2d')]=utils[_0x3913('0x24')]();channels[_0x39818d['uniqueid']][_0x3913('0x2e')]=utils[_0x3913('0x2f')](channels[_0x39818d[_0x3913('0x8')]][_0x3913('0x2d')],channels[_0x39818d[_0x3913('0x8')]][_0x3913('0x30')]);channels[_0x39818d['uniqueid']][_0x3913('0x31')]=channels[_0x39818d[_0x3913('0x8')]][_0x3913('0x23')]?utils[_0x3913('0x2f')](channels[_0x39818d[_0x3913('0x8')]][_0x3913('0x2d')],channels[_0x39818d[_0x3913('0x8')]][_0x3913('0x23')]):0x0;writeDB(channels[_0x39818d[_0x3913('0x8')]]);}}catch(_0x8cca58){utils[_0x3913('0x1d')](util[_0x3913('0x6')](_0x3913('0x28'),_0x39818d['uniqueid']),_0x8cca58);}};exports['attendedtransfer']=function(_0x142c59){try{if(!_[_0x3913('0x21')](channels[_0x142c59[_0x3913('0x32')]])){utils[_0x3913('0x15')](util[_0x3913('0x6')]('[%s][calls][attendedtransfer]',_0x142c59[_0x3913('0x33')]),_0x142c59);if(channels[_0x142c59[_0x3913('0x32')]][_0x3913('0x9')]==_0x142c59[_0x3913('0x34')]){utils[_0x3913('0x18')](util[_0x3913('0x6')](_0x3913('0x35'),_0x142c59['origtransfereruniqueid'],_0x142c59['localtwolinkedid'],_0x142c59[_0x3913('0x36')]));channels[_0x142c59[_0x3913('0x32')]][_0x3913('0x22')]=_0x142c59['secondtransfererchannel'];channels[_0x142c59[_0x3913('0x32')]][_0x3913('0x37')]=_0x3913('0x38');}else if(channels[_0x142c59[_0x3913('0x32')]][_0x3913('0x9')]=_0x142c59[_0x3913('0x39')]){utils[_0x3913('0x18')](util[_0x3913('0x6')](_0x3913('0x35'),_0x142c59[_0x3913('0x33')],_0x142c59['localtwolinkedid'],_0x142c59['origtransfererchannel']));channels[_0x142c59[_0x3913('0x32')]][_0x3913('0x22')]=_0x142c59[_0x3913('0x3a')];channels[_0x142c59[_0x3913('0x32')]]['userfield']=_0x3913('0x38');}}}catch(_0x5aaf1f){utils[_0x3913('0x1d')](util[_0x3913('0x6')](_0x3913('0x3b'),_0x142c59['origtransfereruniqueid']),_0x5aaf1f);}};exports['musiconholdstart']=function(_0x20d122){try{if(!_['isNil'](channels[_0x20d122[_0x3913('0x8')]])){utils['debug'](util[_0x3913('0x6')](_0x3913('0x3c'),_0x20d122[_0x3913('0x8')]),_0x20d122);channels[_0x20d122[_0x3913('0x8')]][_0x3913('0x3d')]=utils[_0x3913('0x24')]();utils[_0x3913('0x18')](util[_0x3913('0x6')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x20d122[_0x3913('0x8')],channels[_0x20d122['uniqueid']][_0x3913('0x3d')]));}}catch(_0x4f103e){utils[_0x3913('0x1d')](util[_0x3913('0x6')](_0x3913('0x3c'),_0x20d122[_0x3913('0x8')]),_0x4f103e);}};exports[_0x3913('0x3e')]=function(_0xde810){try{if(!_[_0x3913('0x21')](channels[_0xde810[_0x3913('0x8')]])){utils['debug'](util[_0x3913('0x6')](_0x3913('0x3f'),_0xde810[_0x3913('0x8')]),_0xde810);if(!_['isNil'](channels[_0xde810[_0x3913('0x8')]]['musiconholdstartAt'])){channels[_0xde810['uniqueid']][_0x3913('0x40')]+=utils[_0x3913('0x2f')](utils[_0x3913('0x24')](),channels[_0xde810['uniqueid']]['musiconholdstartAt']);utils['info'](util['format'](_0x3913('0x41'),_0xde810[_0x3913('0x8')],channels[_0xde810[_0x3913('0x8')]][_0x3913('0x40')]));delete channels[_0xde810[_0x3913('0x8')]][_0x3913('0x3d')];}}}catch(_0xb35cd){utils['error'](util['format'](_0x3913('0x3f'),_0xde810[_0x3913('0x8')]),_0xb35cd);}};exports[_0x3913('0x42')]=function(_0x368993){try{if(!_[_0x3913('0x21')](channels[_0x368993[_0x3913('0x8')]])){utils[_0x3913('0x15')](util[_0x3913('0x6')]('[%s][calls][varset]',_0x368993[_0x3913('0x8')]),_0x368993);if(!_[_0x3913('0x21')](_0x368993['variable'][_0x3913('0x43')])){utils[_0x3913('0x18')](util[_0x3913('0x6')](_0x3913('0x44'),_0x368993[_0x3913('0x8')],_0x368993['value']));channels[_0x368993[_0x3913('0x8')]]['source']=_0x368993[_0x3913('0x45')];}if(!_['isNil'](_0x368993[_0x3913('0x46')][_0x3913('0x47')])){utils[_0x3913('0x18')](util[_0x3913('0x6')](_0x3913('0x48'),_0x368993[_0x3913('0x8')],_0x368993[_0x3913('0x45')]));channels[_0x368993['uniqueid']]['destination']=_0x368993[_0x3913('0x45')];channels[_0x368993[_0x3913('0x8')]][_0x3913('0x2b')]='\x22'+_0x368993[_0x3913('0x45')]+_0x3913('0x49')+_0x368993[_0x3913('0x45')]+'>';}if(!_[_0x3913('0x21')](_0x368993[_0x3913('0x46')][_0x3913('0x4a')])||!_[_0x3913('0x21')](_0x368993[_0x3913('0x46')][_0x3913('0x4b')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x368993[_0x3913('0x8')],!_[_0x3913('0x21')](_0x368993[_0x3913('0x46')]['xmd-callerid-preview'])?_0x3913('0x4a'):_0x3913('0x4b'),_0x368993[_0x3913('0x45')]));channels[_0x368993[_0x3913('0x8')]]['callerid']=_0x368993[_0x3913('0x45')];}if(!_[_0x3913('0x21')](_0x368993[_0x3913('0x46')]['xmd-queue'])||!_[_0x3913('0x21')](_0x368993['variable'][_0x3913('0x4c')])){utils['info'](util[_0x3913('0x6')](_0x3913('0x4d'),_0x368993[_0x3913('0x8')],!_[_0x3913('0x21')](_0x368993[_0x3913('0x46')][_0x3913('0x4e')])?_0x3913('0x4e'):'xmcs-queue',_0x368993[_0x3913('0x45')]));channels[_0x368993[_0x3913('0x8')]][_0x3913('0x4f')]=_0x3913('0x50');channels[_0x368993[_0x3913('0x8')]][_0x3913('0x51')]=_0x368993[_0x3913('0x45')];channels[_0x368993[_0x3913('0x8')]][_0x3913('0xa')]=!![];}if(!_[_0x3913('0x21')](_0x368993[_0x3913('0x46')]['xmd-contactid'])){utils[_0x3913('0x18')](util[_0x3913('0x6')](_0x3913('0x52'),_0x368993['uniqueid'],_0x368993['value']));channels[_0x368993[_0x3913('0x8')]][_0x3913('0x53')]=_0x368993[_0x3913('0x45')];}if(!_[_0x3913('0x21')](_0x368993['variable'][_0x3913('0x54')])){utils[_0x3913('0x18')](util[_0x3913('0x6')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x368993[_0x3913('0x8')],_0x368993[_0x3913('0x45')]));channels[_0x368993[_0x3913('0x8')]]['type']=_0x368993[_0x3913('0x45')];}if(!_[_0x3913('0x21')](_0x368993[_0x3913('0x46')][_0x3913('0x55')])){utils['info'](util['format'](_0x3913('0x56'),_0x368993['uniqueid'],_0x368993[_0x3913('0x45')]));channels[_0x368993['uniqueid']][_0x3913('0x57')]=_0x368993[_0x3913('0x45')];}if(!_[_0x3913('0x21')](_0x368993['variable'][_0x3913('0x58')])){utils[_0x3913('0x18')](util[_0x3913('0x6')](_0x3913('0x59'),_0x368993[_0x3913('0x8')],_0x368993[_0x3913('0x45')]));channels[_0x368993[_0x3913('0x8')]][_0x3913('0x58')]=_0x368993[_0x3913('0x45')];}}}catch(_0x2f0bc2){utils[_0x3913('0x1d')](util['format']('[%s][calls][varset]',_0x368993[_0x3913('0x8')]),_0x2f0bc2);}};exports['newexten']=function(_0x455dd0){try{if(!_[_0x3913('0x21')](channels[_0x455dd0[_0x3913('0x8')]])){utils[_0x3913('0x15')](util[_0x3913('0x6')]('[%s][calls][newexten]',_0x455dd0['uniqueid']),_0x455dd0);utils['info'](util[_0x3913('0x6')](_0x3913('0x5a'),_0x455dd0['uniqueid'],_0x455dd0[_0x3913('0x5b')],_0x455dd0[_0x3913('0x5c')]));if(_0x455dd0['application'][_0x3913('0x5d')]()==_0x3913('0x5e')&&_[_0x3913('0x5f')](_0x455dd0[_0x3913('0x5c')][_0x3913('0x5d')](),_0x3913('0x60'))){var _0x1e7939=_0x455dd0[_0x3913('0x5c')][_0x3913('0x61')]('=');var _0x5e418d=_0x1e7939[0x0][_0x3913('0x62')](_0x1e7939[0x0][_0x3913('0x63')]('(')+0x1,_0x1e7939[0x0][_0x3913('0x63')](')'));var _0xe9f312=_0x1e7939[0x1];channels[_0x455dd0[_0x3913('0x8')]][_0x5e418d]=_0xe9f312;}if(!_[_0x3913('0x64')]([_0x3913('0x27'),_0x3913('0x65'),_0x3913('0x66'),'set',_0x3913('0x67')],_0x455dd0[_0x3913('0x5b')]['toLowerCase']())){channels[_0x455dd0[_0x3913('0x8')]][_0x3913('0x4f')]=_0x455dd0[_0x3913('0x5b')];channels[_0x455dd0[_0x3913('0x8')]]['lastdata']=_0x455dd0[_0x3913('0x5c')];}}}catch(_0x51c04a){utils[_0x3913('0x1d')](util[_0x3913('0x6')](_0x3913('0x68'),_0x455dd0[_0x3913('0x8')]),_0x51c04a);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index bc651b6..b13930e 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 _0x793c=['shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','info','[core]\x20connected'];(function(_0x1e2e30,_0x48b693){var _0x49169c=function(_0x220462){while(--_0x220462){_0x1e2e30['push'](_0x1e2e30['shift']());}};_0x49169c(++_0x48b693);}(_0x793c,0x9d));var _0xc793=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x793c[_0x172747];return _0x509692;};'use strict';var utils=require(_0xc793('0x0'));exports['connect']=function(){utils[_0xc793('0x1')](_0xc793('0x2'));};exports[_0xc793('0x3')]=function(){utils[_0xc793('0x1')]('[core]\x20shutdown');};exports[_0xc793('0x4')]=function(){utils[_0xc793('0x1')]('[core]\x20fullybooted');};exports[_0xc793('0x5')]=function(_0x5007dd){utils['error'](_0xc793('0x6'),_0x5007dd);};exports[_0xc793('0x7')]=function(){utils['info'](_0xc793('0x8'));};exports[_0xc793('0x9')]=function(_0x585d65){}; \ No newline at end of file +var _0x623e=['info','[core]\x20connected','shutdown','[core]\x20shutdown','error','[core]\x20error','[core]\x20close','managerevent','./utils'];(function(_0x51ebc2,_0x222091){var _0x3e786d=function(_0x52c126){while(--_0x52c126){_0x51ebc2['push'](_0x51ebc2['shift']());}};_0x3e786d(++_0x222091);}(_0x623e,0x182));var _0xe623=function(_0x3d3fe5,_0x2fcf2b){_0x3d3fe5=_0x3d3fe5-0x0;var _0xb4ce88=_0x623e[_0x3d3fe5];return _0xb4ce88;};'use strict';var utils=require(_0xe623('0x0'));exports['connect']=function(){utils[_0xe623('0x1')](_0xe623('0x2'));};exports[_0xe623('0x3')]=function(){utils[_0xe623('0x1')](_0xe623('0x4'));};exports['fullybooted']=function(){utils['info']('[core]\x20fullybooted');};exports[_0xe623('0x5')]=function(_0x8c8aef){utils['error'](_0xe623('0x6'),_0x8c8aef);};exports['close']=function(){utils['info'](_0xe623('0x7'));};exports[_0xe623('0x8')]=function(_0x4602cf){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 46729b2..5b7a258 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 _0xc088=['startsWith','cdr(routeid)','split','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','error','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','dialstatus','ANSWER','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','answertime','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xc088,0x15a));var _0x8c08=function(_0x5972c1,_0x138486){_0x5972c1=_0x5972c1-0x0;var _0x4c9e1f=_0xc088[_0x5972c1];return _0x4c9e1f;};'use strict';var _=require('lodash');var util=require(_0x8c08('0x0'));var utils=require(_0x8c08('0x1'));var dials={};function writeDB(_0x14c41f){utils[_0x8c08('0x2')](util[_0x8c08('0x3')](_0x8c08('0x4'),_0x14c41f[_0x8c08('0x5')],_0x14c41f['channel'],_0x14c41f['dialstring'],_0x14c41f[_0x8c08('0x6')],_0x14c41f[_0x8c08('0x7')],_0x14c41f['dialstatus']));utils[_0x8c08('0x8')](_0x8c08('0x9'),_0x14c41f);delete dials[_0x14c41f[_0x8c08('0x5')]];}exports[_0x8c08('0xa')]=function(_0x1d7579){try{utils[_0x8c08('0xb')](util[_0x8c08('0x3')](_0x8c08('0xc'),_0x1d7579[_0x8c08('0x5')]),_0x1d7579);utils[_0x8c08('0x2')](util[_0x8c08('0x3')](_0x8c08('0xd'),_0x1d7579[_0x8c08('0x5')],_0x1d7579[_0x8c08('0xe')],_0x1d7579[_0x8c08('0xf')]));if(_0x1d7579['application'][_0x8c08('0x10')]()==_0x8c08('0x11')&&_[_0x8c08('0x12')](_0x1d7579[_0x8c08('0xf')]['toLowerCase'](),_0x8c08('0x13'))){var _0x7c4452=_0x1d7579[_0x8c08('0xf')][_0x8c08('0x14')]('=');dials[_0x1d7579['uniqueid']]={'routeId':_0x7c4452[0x1]};}}catch(_0x3a6d10){utils['error'](util[_0x8c08('0x3')]('[%s][dials][newexten]',_0x1d7579['uniqueid']),_0x3a6d10);}};exports[_0x8c08('0x15')]=function(_0x5657c6){try{utils[_0x8c08('0xb')](util[_0x8c08('0x3')](_0x8c08('0x16'),_0x5657c6[_0x8c08('0x5')]),_0x5657c6);if(!_[_0x8c08('0x17')](_0x5657c6[_0x8c08('0x18')][_0x8c08('0x19')])){utils[_0x8c08('0x2')](util[_0x8c08('0x3')](_0x8c08('0x1a'),_0x5657c6[_0x8c08('0x5')],_0x5657c6['value']));dials[_0x5657c6[_0x8c08('0x5')]]={'routeId':_0x5657c6['value']};}}catch(_0x5bbadf){utils[_0x8c08('0x1b')](util[_0x8c08('0x3')](_0x8c08('0x16'),_0x5657c6[_0x8c08('0x5')]),_0x5bbadf);}};exports[_0x8c08('0x1c')]=function(_0x7bddcf){try{if(!_[_0x8c08('0x17')](dials[_0x7bddcf[_0x8c08('0x5')]])){utils[_0x8c08('0xb')](util[_0x8c08('0x3')](_0x8c08('0x1d'),_0x7bddcf[_0x8c08('0x5')]),_0x7bddcf);dials[_0x7bddcf[_0x8c08('0x5')]]=_[_0x8c08('0x1e')](dials[_0x7bddcf[_0x8c08('0x5')]],_0x7bddcf);dials[_0x7bddcf[_0x8c08('0x5')]][_0x8c08('0x1f')]=utils[_0x8c08('0x20')]();dials[_0x7bddcf[_0x8c08('0x5')]][_0x8c08('0x21')]=_0x8c08('0x22');utils['info'](util[_0x8c08('0x3')](_0x8c08('0x23'),_0x7bddcf[_0x8c08('0x5')],dials[_0x7bddcf[_0x8c08('0x5')]]['starttime']));}}catch(_0x1657b3){utils[_0x8c08('0x1b')](util[_0x8c08('0x3')](_0x8c08('0x1d'),_0x7bddcf['uniqueid']),_0x1657b3);}};exports[_0x8c08('0x24')]=function(_0x53479b){try{if(!_[_0x8c08('0x17')](dials[_0x53479b['uniqueid']])){utils['debug'](util[_0x8c08('0x3')]('[%s][dials][dialend]',_0x53479b['uniqueid']),_0x53479b);dials[_0x53479b[_0x8c08('0x5')]][_0x8c08('0x25')]=_0x53479b[_0x8c08('0x25')];if(_0x53479b[_0x8c08('0x25')]==_0x8c08('0x26')){dials[_0x53479b['uniqueid']]=_[_0x8c08('0x1e')](dials[_0x53479b[_0x8c08('0x5')]],_0x53479b);dials[_0x53479b[_0x8c08('0x5')]]['answertime']=utils[_0x8c08('0x20')]();dials[_0x53479b[_0x8c08('0x5')]][_0x8c08('0x21')]='connect';utils[_0x8c08('0x2')](util[_0x8c08('0x3')](_0x8c08('0x27'),_0x53479b[_0x8c08('0x5')],_0x53479b[_0x8c08('0x25')],dials[_0x53479b['uniqueid']]['answertime']));}else{utils[_0x8c08('0x2')](util['format'](_0x8c08('0x28'),_0x53479b[_0x8c08('0x5')],_0x53479b[_0x8c08('0x25')]));}}}catch(_0x1edf7b){utils[_0x8c08('0x1b')](util[_0x8c08('0x3')](_0x8c08('0x29'),_0x53479b[_0x8c08('0x5')]),_0x1edf7b);}};exports[_0x8c08('0x2a')]=function(_0x266453){try{if(!_[_0x8c08('0x17')](dials[_0x266453[_0x8c08('0x5')]])){utils[_0x8c08('0xb')](util[_0x8c08('0x3')](_0x8c08('0x2b'),_0x266453[_0x8c08('0x5')]),_0x266453);utils[_0x8c08('0x2')](util[_0x8c08('0x3')](_0x8c08('0x2c'),_0x266453[_0x8c08('0x5')],_0x266453[_0x8c08('0x6')],_0x266453[_0x8c08('0x2d')],_0x266453[_0x8c08('0x2e')]));dials[_0x266453[_0x8c08('0x5')]]=_['assign'](dials[_0x266453['uniqueid']],{'endtime':utils[_0x8c08('0x20')](),'lastevent':_0x8c08('0x2f')});dials[_0x266453[_0x8c08('0x5')]][_0x8c08('0x30')]=utils[_0x8c08('0x31')](dials[_0x266453[_0x8c08('0x5')]][_0x8c08('0x32')],dials[_0x266453[_0x8c08('0x5')]][_0x8c08('0x1f')]);dials[_0x266453[_0x8c08('0x5')]]['holdtime']=utils[_0x8c08('0x31')](dials[_0x266453[_0x8c08('0x5')]][_0x8c08('0x33')]||dials[_0x266453['uniqueid']][_0x8c08('0x32')],dials[_0x266453[_0x8c08('0x5')]]['starttime']);dials[_0x266453[_0x8c08('0x5')]]['billableseconds']=dials[_0x266453[_0x8c08('0x5')]][_0x8c08('0x33')]?utils['diffTime'](dials[_0x266453[_0x8c08('0x5')]]['endtime'],dials[_0x266453['uniqueid']][_0x8c08('0x33')]):0x0;writeDB(dials[_0x266453[_0x8c08('0x5')]]);}}catch(_0x3a141b){utils['error'](util[_0x8c08('0x3')](_0x8c08('0x2b'),_0x266453[_0x8c08('0x5')]),_0x3a141b);}}; \ No newline at end of file +var _0x4dbc=['outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','isNil','[%s][dials][dialbegin]','assign','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','dialstatus','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','complete','duration','diffTime','endtime','holdtime','billableseconds','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','request','CreateVoiceDialReport','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','split','varset','debug','[%s][dials][varset]','variable'];(function(_0xa0971f,_0x5c9dc0){var _0x487736=function(_0x102445){while(--_0x102445){_0xa0971f['push'](_0xa0971f['shift']());}};_0x487736(++_0x5c9dc0);}(_0x4dbc,0xb2));var _0xc4db=function(_0x2feb2,_0x2c0b5b){_0x2feb2=_0x2feb2-0x0;var _0x51f951=_0x4dbc[_0x2feb2];return _0x51f951;};'use strict';var _=require('lodash');var util=require(_0xc4db('0x0'));var utils=require(_0xc4db('0x1'));var dials={};function writeDB(_0x511961){utils[_0xc4db('0x2')](util['format'](_0xc4db('0x3'),_0x511961[_0xc4db('0x4')],_0x511961[_0xc4db('0x5')],_0x511961[_0xc4db('0x6')],_0x511961['calleridnum'],_0x511961[_0xc4db('0x7')],_0x511961['dialstatus']));utils[_0xc4db('0x8')](_0xc4db('0x9'),_0x511961);delete dials[_0x511961[_0xc4db('0x4')]];}exports['newexten']=function(_0x819915){try{utils['debug'](util[_0xc4db('0xa')](_0xc4db('0xb'),_0x819915[_0xc4db('0x4')]),_0x819915);utils[_0xc4db('0x2')](util[_0xc4db('0xa')](_0xc4db('0xc'),_0x819915['uniqueid'],_0x819915[_0xc4db('0xd')],_0x819915[_0xc4db('0xe')]));if(_0x819915[_0xc4db('0xd')][_0xc4db('0xf')]()==_0xc4db('0x10')&&_['startsWith'](_0x819915[_0xc4db('0xe')]['toLowerCase'](),'cdr(routeid)')){var _0x2dd249=_0x819915['appdata'][_0xc4db('0x11')]('=');dials[_0x819915[_0xc4db('0x4')]]={'routeId':_0x2dd249[0x1]};}}catch(_0x390c60){utils['error'](util[_0xc4db('0xa')](_0xc4db('0xb'),_0x819915[_0xc4db('0x4')]),_0x390c60);}};exports[_0xc4db('0x12')]=function(_0x2ec069){try{utils[_0xc4db('0x13')](util[_0xc4db('0xa')](_0xc4db('0x14'),_0x2ec069['uniqueid']),_0x2ec069);if(!_['isNil'](_0x2ec069[_0xc4db('0x15')][_0xc4db('0x16')])){utils['info'](util[_0xc4db('0xa')](_0xc4db('0x17'),_0x2ec069[_0xc4db('0x4')],_0x2ec069[_0xc4db('0x18')]));dials[_0x2ec069[_0xc4db('0x4')]]={'routeId':_0x2ec069[_0xc4db('0x18')]};}}catch(_0x21f12b){utils[_0xc4db('0x19')](util[_0xc4db('0xa')](_0xc4db('0x14'),_0x2ec069[_0xc4db('0x4')]),_0x21f12b);}};exports[_0xc4db('0x1a')]=function(_0x598689){try{if(!_[_0xc4db('0x1b')](dials[_0x598689['uniqueid']])){utils[_0xc4db('0x13')](util[_0xc4db('0xa')](_0xc4db('0x1c'),_0x598689[_0xc4db('0x4')]),_0x598689);dials[_0x598689[_0xc4db('0x4')]]=_[_0xc4db('0x1d')](dials[_0x598689[_0xc4db('0x4')]],_0x598689);dials[_0x598689[_0xc4db('0x4')]]['starttime']=utils[_0xc4db('0x1e')]();dials[_0x598689[_0xc4db('0x4')]][_0xc4db('0x1f')]='called';utils[_0xc4db('0x2')](util[_0xc4db('0xa')](_0xc4db('0x20'),_0x598689[_0xc4db('0x4')],dials[_0x598689[_0xc4db('0x4')]][_0xc4db('0x21')]));}}catch(_0x7fe83b){utils['error'](util[_0xc4db('0xa')]('[%s][dials][dialbegin]',_0x598689[_0xc4db('0x4')]),_0x7fe83b);}};exports[_0xc4db('0x22')]=function(_0x57d857){try{if(!_['isNil'](dials[_0x57d857[_0xc4db('0x4')]])){utils[_0xc4db('0x13')](util['format'](_0xc4db('0x23'),_0x57d857[_0xc4db('0x4')]),_0x57d857);dials[_0x57d857[_0xc4db('0x4')]]['dialstatus']=_0x57d857[_0xc4db('0x24')];if(_0x57d857[_0xc4db('0x24')]=='ANSWER'){dials[_0x57d857['uniqueid']]=_[_0xc4db('0x1d')](dials[_0x57d857[_0xc4db('0x4')]],_0x57d857);dials[_0x57d857['uniqueid']][_0xc4db('0x25')]=utils[_0xc4db('0x1e')]();dials[_0x57d857[_0xc4db('0x4')]][_0xc4db('0x1f')]=_0xc4db('0x26');utils['info'](util[_0xc4db('0xa')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x57d857['uniqueid'],_0x57d857[_0xc4db('0x24')],dials[_0x57d857[_0xc4db('0x4')]][_0xc4db('0x25')]));}else{utils['info'](util['format'](_0xc4db('0x27'),_0x57d857['uniqueid'],_0x57d857[_0xc4db('0x24')]));}}}catch(_0x5819a8){utils[_0xc4db('0x19')](util[_0xc4db('0xa')](_0xc4db('0x23'),_0x57d857[_0xc4db('0x4')]),_0x5819a8);}};exports[_0xc4db('0x28')]=function(_0x145f3f){try{if(!_[_0xc4db('0x1b')](dials[_0x145f3f['uniqueid']])){utils[_0xc4db('0x13')](util[_0xc4db('0xa')]('[%s][dials][hangup]',_0x145f3f['uniqueid']),_0x145f3f);utils[_0xc4db('0x2')](util['format'](_0xc4db('0x29'),_0x145f3f['uniqueid'],_0x145f3f[_0xc4db('0x2a')],_0x145f3f[_0xc4db('0x2b')],_0x145f3f['cause-txt']));dials[_0x145f3f[_0xc4db('0x4')]]=_[_0xc4db('0x1d')](dials[_0x145f3f[_0xc4db('0x4')]],{'endtime':utils[_0xc4db('0x1e')](),'lastevent':_0xc4db('0x2c')});dials[_0x145f3f[_0xc4db('0x4')]][_0xc4db('0x2d')]=utils[_0xc4db('0x2e')](dials[_0x145f3f[_0xc4db('0x4')]][_0xc4db('0x2f')],dials[_0x145f3f[_0xc4db('0x4')]]['starttime']);dials[_0x145f3f[_0xc4db('0x4')]][_0xc4db('0x30')]=utils[_0xc4db('0x2e')](dials[_0x145f3f[_0xc4db('0x4')]][_0xc4db('0x25')]||dials[_0x145f3f['uniqueid']][_0xc4db('0x2f')],dials[_0x145f3f['uniqueid']][_0xc4db('0x21')]);dials[_0x145f3f['uniqueid']][_0xc4db('0x31')]=dials[_0x145f3f[_0xc4db('0x4')]][_0xc4db('0x25')]?utils[_0xc4db('0x2e')](dials[_0x145f3f['uniqueid']][_0xc4db('0x2f')],dials[_0x145f3f['uniqueid']][_0xc4db('0x25')]):0x0;writeDB(dials[_0x145f3f[_0xc4db('0x4')]]);}}catch(_0x3cf606){utils[_0xc4db('0x19')](util['format']('[%s][dials][hangup]',_0x145f3f[_0xc4db('0x4')]),_0x3cf606);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 6d65859..2b4045a 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 _0x8a05=['./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','env','production','local','port','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller'];(function(_0x304259,_0x4ca12e){var _0x42b70d=function(_0x3980cb){while(--_0x3980cb){_0x304259['push'](_0x304259['shift']());}};_0x42b70d(++_0x4ca12e);}(_0x8a05,0x1b0));var _0x58a0=function(_0x4e065f,_0x15a55e){_0x4e065f=_0x4e065f-0x0;var _0x36cae4=_0x8a05[_0x4e065f];return _0x36cae4;};var AsteriskManager=require(_0x58a0('0x0'));var config=require(_0x58a0('0x1'));var utils=require(_0x58a0('0x2'));var util=require('util');var isXDREnabled=config['xdr']&&config[_0x58a0('0x3')][_0x58a0('0x4')]?!config[_0x58a0('0x3')][_0x58a0('0x4')]:!![];var isProduction=config[_0x58a0('0x5')]===_0x58a0('0x6')||![];var isLocalAsterisk=config['xdr']&&config['xdr'][_0x58a0('0x7')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x58a0('0x8')],config[_0x58a0('0x9')]['ip'],config['asterisk'][_0x58a0('0xa')],config['asterisk'][_0x58a0('0xb')],!![]);ami[_0x58a0('0xc')]();if(!isXDREnabled){utils[_0x58a0('0xd')](_0x58a0('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x58a0('0xf'));}else{var agents=require(_0x58a0('0x10'));var calls=require(_0x58a0('0x11'));var queues=require(_0x58a0('0x12'));var recordings=require(_0x58a0('0x13'));var members=require(_0x58a0('0x14'));var dials=require(_0x58a0('0x15'));var transfers=require(_0x58a0('0x16'));var core=require(_0x58a0('0x17'));ami['on'](_0x58a0('0x18'),core[_0x58a0('0x18')]);ami['on'](_0x58a0('0x19'),core[_0x58a0('0x19')]);ami['on'](_0x58a0('0x1a'),core[_0x58a0('0x1a')]);ami['on']('error',core[_0x58a0('0x1b')]);ami['on'](_0x58a0('0x1c'),core['close']);ami['on'](_0x58a0('0x1d'),core[_0x58a0('0x1d')]);ami['on'](_0x58a0('0x1e'),function(_0x20ca20){try{utils[_0x58a0('0x1f')](util[_0x58a0('0x20')](_0x58a0('0x21'),_0x20ca20[_0x58a0('0x22')]),_0x20ca20);members[_0x58a0('0x1e')](_0x20ca20);}catch(_0x5e4533){utils[_0x58a0('0x1b')](util['format'](_0x58a0('0x21'),_0x20ca20[_0x58a0('0x22')]),_0x5e4533);}});ami['on'](_0x58a0('0x23'),function(_0x1a5455){try{utils[_0x58a0('0x1f')](util['format'](_0x58a0('0x24'),_0x1a5455[_0x58a0('0x25')]),_0x1a5455);agents[_0x58a0('0x23')](_0x1a5455);}catch(_0x95c52){utils['error'](util[_0x58a0('0x20')](_0x58a0('0x24'),_0x1a5455['uniqueid']),_0x95c52);}});ami['on'](_0x58a0('0x26'),function(_0x566e8c){try{utils[_0x58a0('0x1f')](util[_0x58a0('0x20')](_0x58a0('0x27'),_0x566e8c[_0x58a0('0x25')]),_0x566e8c);agents[_0x58a0('0x26')](_0x566e8c);}catch(_0x46f948){utils[_0x58a0('0x1b')](util[_0x58a0('0x20')](_0x58a0('0x27'),_0x566e8c[_0x58a0('0x25')]),_0x46f948);}});ami['on'](_0x58a0('0x28'),function(_0x446dcb){try{utils['debug'](util[_0x58a0('0x20')](_0x58a0('0x29'),_0x446dcb[_0x58a0('0x25')]),_0x446dcb);agents['agentconnect'](_0x446dcb);queues[_0x58a0('0x28')](_0x446dcb);}catch(_0x15ed88){utils['error'](util[_0x58a0('0x20')](_0x58a0('0x29'),_0x446dcb[_0x58a0('0x25')]),_0x15ed88);}});ami['on'](_0x58a0('0x2a'),function(_0x1e4e24){try{utils[_0x58a0('0x1f')](util[_0x58a0('0x20')](_0x58a0('0x2b'),_0x1e4e24[_0x58a0('0x25')]),_0x1e4e24);agents[_0x58a0('0x2a')](_0x1e4e24);queues[_0x58a0('0x2a')](_0x1e4e24);members[_0x58a0('0x2a')](_0x1e4e24);}catch(_0x3bb42e){utils[_0x58a0('0x1b')](util[_0x58a0('0x20')](_0x58a0('0x2b'),_0x1e4e24[_0x58a0('0x25')]),_0x3bb42e);}});ami['on']('queuecallerabandon',function(_0x5926d0){try{utils['debug'](util[_0x58a0('0x20')](_0x58a0('0x2c'),_0x5926d0[_0x58a0('0x25')]),_0x5926d0);agents[_0x58a0('0x2d')](_0x5926d0);queues[_0x58a0('0x2d')](_0x5926d0);}catch(_0x45e9dc){utils['error'](util['format'](_0x58a0('0x2c'),_0x5926d0[_0x58a0('0x25')]),_0x45e9dc);}});ami['on'](_0x58a0('0x2e'),function(_0x127ac4){try{utils[_0x58a0('0x1f')](util[_0x58a0('0x20')]('[%s][index][queuecallerjoin]',_0x127ac4['uniqueid']),_0x127ac4);queues[_0x58a0('0x2e')](_0x127ac4);recordings['queuecallerjoin'](_0x127ac4);}catch(_0x18f626){utils['error'](util['format'](_0x58a0('0x2f'),_0x127ac4['uniqueid']),_0x18f626);}});ami['on'](_0x58a0('0x30'),function(_0x46e69f){try{utils['debug'](util[_0x58a0('0x20')]('[%s][index][queuecallerleave]',_0x46e69f['uniqueid']),_0x46e69f);queues[_0x58a0('0x30')](_0x46e69f);}catch(_0x516247){utils[_0x58a0('0x1b')](util[_0x58a0('0x20')](_0x58a0('0x31'),_0x46e69f['uniqueid']),_0x516247);}});ami['on'](_0x58a0('0x32'),function(_0x3203c8){try{utils['debug'](util['format'](_0x58a0('0x33'),_0x3203c8[_0x58a0('0x25')]),_0x3203c8);queues['musiconholdstart'](_0x3203c8);calls[_0x58a0('0x32')](_0x3203c8);}catch(_0x58cb4d){utils[_0x58a0('0x1b')](util[_0x58a0('0x20')](_0x58a0('0x33'),_0x3203c8[_0x58a0('0x25')]),_0x58cb4d);}});ami['on'](_0x58a0('0x34'),function(_0x34ac5e){try{utils[_0x58a0('0x1f')](util[_0x58a0('0x20')](_0x58a0('0x35'),_0x34ac5e[_0x58a0('0x25')]),_0x34ac5e);queues['musiconholdstop'](_0x34ac5e);calls[_0x58a0('0x34')](_0x34ac5e);}catch(_0xe5553c){utils[_0x58a0('0x1b')](util['format'](_0x58a0('0x35'),_0x34ac5e[_0x58a0('0x25')]),_0xe5553c);}});ami['on'](_0x58a0('0x36'),function(_0x4ec6e1){try{utils[_0x58a0('0x1f')](util[_0x58a0('0x20')](_0x58a0('0x37'),_0x4ec6e1[_0x58a0('0x25')]),_0x4ec6e1);calls[_0x58a0('0x36')](_0x4ec6e1);recordings[_0x58a0('0x36')](_0x4ec6e1);}catch(_0x5d2238){utils['error'](util[_0x58a0('0x20')]('[%s][index][newstate]',_0x4ec6e1[_0x58a0('0x25')]),_0x5d2238);}});ami['on']('hangup',function(_0x42da90){try{utils[_0x58a0('0x1f')](util[_0x58a0('0x20')](_0x58a0('0x38'),_0x42da90[_0x58a0('0x25')]),_0x42da90);calls[_0x58a0('0x39')](_0x42da90);recordings[_0x58a0('0x39')](_0x42da90);dials[_0x58a0('0x39')](_0x42da90);agents[_0x58a0('0x39')](_0x42da90);queues[_0x58a0('0x39')](_0x42da90);}catch(_0x44be26){utils['error'](util[_0x58a0('0x20')](_0x58a0('0x38'),_0x42da90[_0x58a0('0x25')]),_0x44be26);}});ami['on']('cdr',function(_0x38e2a6){try{utils[_0x58a0('0x1f')](util[_0x58a0('0x20')]('[%s][index][cdr]',_0x38e2a6[_0x58a0('0x25')]),_0x38e2a6);members[_0x58a0('0x3a')](_0x38e2a6);}catch(_0x41bc26){utils[_0x58a0('0x1b')](util[_0x58a0('0x20')](_0x58a0('0x3b'),_0x38e2a6[_0x58a0('0x25')]),_0x41bc26);}});ami['on'](_0x58a0('0x3c'),function(_0x9659c6){try{utils[_0x58a0('0x1f')](util['format']('[%s][index][blindtransfer]',_0x9659c6[_0x58a0('0x25')]),_0x9659c6);queues[_0x58a0('0x3c')](_0x9659c6);agents[_0x58a0('0x3c')](_0x9659c6);transfers[_0x58a0('0x3c')](_0x9659c6);}catch(_0x5b2273){utils[_0x58a0('0x1b')](util[_0x58a0('0x20')](_0x58a0('0x3d'),_0x9659c6[_0x58a0('0x25')]),_0x5b2273);}});ami['on'](_0x58a0('0x3e'),function(_0x112779){try{utils['debug'](util[_0x58a0('0x20')]('[%s][index][attendedtransfer]',_0x112779['origtransfereruniqueid']),_0x112779);queues[_0x58a0('0x3e')](_0x112779);transfers['attendedtransfer'](_0x112779);agents[_0x58a0('0x3e')](_0x112779);calls[_0x58a0('0x3e')](_0x112779);}catch(_0x21c86e){utils['error'](util[_0x58a0('0x20')](_0x58a0('0x3f'),_0x112779[_0x58a0('0x40')]),_0x21c86e);}});ami['on'](_0x58a0('0x41'),function(_0x311aac){try{utils[_0x58a0('0x1f')](util['format'](_0x58a0('0x42'),_0x311aac[_0x58a0('0x25')]),_0x311aac);queues[_0x58a0('0x41')](_0x311aac);recordings['varset'](_0x311aac);calls['varset'](_0x311aac);dials[_0x58a0('0x41')](_0x311aac);}catch(_0x887620){utils[_0x58a0('0x1b')](util['format'](_0x58a0('0x42'),_0x311aac[_0x58a0('0x25')]),_0x887620);}});ami['on'](_0x58a0('0x43'),function(_0x5ab59c){try{utils[_0x58a0('0x1f')](util[_0x58a0('0x20')]('[%s][index][newexten]',_0x5ab59c[_0x58a0('0x25')]),_0x5ab59c);calls[_0x58a0('0x43')](_0x5ab59c);recordings['newexten'](_0x5ab59c);dials[_0x58a0('0x43')](_0x5ab59c);}catch(_0x3ea9e1){utils[_0x58a0('0x1b')](util['format'](_0x58a0('0x44'),_0x5ab59c[_0x58a0('0x25')]),_0x3ea9e1);}});ami['on'](_0x58a0('0x45'),function(_0x3ab3fe){try{utils['debug'](util[_0x58a0('0x20')](_0x58a0('0x46'),_0x3ab3fe[_0x58a0('0x25')]),_0x3ab3fe);calls[_0x58a0('0x45')](_0x3ab3fe);recordings[_0x58a0('0x45')](_0x3ab3fe);}catch(_0xb8863c){utils[_0x58a0('0x1b')](util['format']('[%s][index][newchannel]',_0x3ab3fe['uniqueid']),_0xb8863c);}});ami['on'](_0x58a0('0x47'),function(_0x23c877){try{utils[_0x58a0('0x1f')](util[_0x58a0('0x20')](_0x58a0('0x48'),_0x23c877['uniqueid']),_0x23c877);dials[_0x58a0('0x47')](_0x23c877);}catch(_0x3ab8cb){utils['error'](util[_0x58a0('0x20')](_0x58a0('0x49'),_0x23c877['uniqueid']),_0x3ab8cb);}});ami['on']('dialend',function(_0x416e7c){try{utils[_0x58a0('0x1f')](util['format'](_0x58a0('0x4a'),_0x416e7c[_0x58a0('0x25')]),_0x416e7c);dials['dialend'](_0x416e7c);}catch(_0x4f5dcf){utils[_0x58a0('0x1b')](util[_0x58a0('0x20')](_0x58a0('0x4a'),_0x416e7c['uniqueid']),_0x4f5dcf);}});} \ No newline at end of file +var _0x10b2=['debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','xdr','disabled','env','production','local','port','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','device','format','[%s][index][devicestatechange]','agentcalled'];(function(_0x3c11eb,_0x198b3f){var _0xf445ff=function(_0x1b6413){while(--_0x1b6413){_0x3c11eb['push'](_0x3c11eb['shift']());}};_0xf445ff(++_0x198b3f);}(_0x10b2,0x13f));var _0x210b=function(_0x18799b,_0x17b1da){_0x18799b=_0x18799b-0x0;var _0x411b80=_0x10b2[_0x18799b];return _0x411b80;};var AsteriskManager=require(_0x210b('0x0'));var config=require(_0x210b('0x1'));var utils=require('./utils');var util=require('util');var isXDREnabled=config[_0x210b('0x2')]&&config['xdr']['disabled']?!config['xdr'][_0x210b('0x3')]:!![];var isProduction=config[_0x210b('0x4')]===_0x210b('0x5')||![];var isLocalAsterisk=config[_0x210b('0x2')]&&config['xdr'][_0x210b('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x210b('0x7')],config[_0x210b('0x8')]['ip'],config[_0x210b('0x8')][_0x210b('0x9')],config[_0x210b('0x8')][_0x210b('0xa')],!![]);ami[_0x210b('0xb')]();if(!isXDREnabled){utils[_0x210b('0xc')](_0x210b('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x210b('0xc')](_0x210b('0xe'));}else{var agents=require(_0x210b('0xf'));var calls=require(_0x210b('0x10'));var queues=require(_0x210b('0x11'));var recordings=require('./recordings.controller');var members=require(_0x210b('0x12'));var dials=require(_0x210b('0x13'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0x210b('0x14'),core[_0x210b('0x14')]);ami['on'](_0x210b('0x15'),core[_0x210b('0x15')]);ami['on'](_0x210b('0x16'),core[_0x210b('0x16')]);ami['on']('error',core[_0x210b('0x17')]);ami['on'](_0x210b('0x18'),core['close']);ami['on'](_0x210b('0x19'),core[_0x210b('0x19')]);ami['on'](_0x210b('0x1a'),function(_0x172be4){try{utils['debug'](util['format']('[%s][index][devicestatechange]',_0x172be4[_0x210b('0x1b')]),_0x172be4);members[_0x210b('0x1a')](_0x172be4);}catch(_0x157a7b){utils[_0x210b('0x17')](util[_0x210b('0x1c')](_0x210b('0x1d'),_0x172be4[_0x210b('0x1b')]),_0x157a7b);}});ami['on'](_0x210b('0x1e'),function(_0x21040c){try{utils[_0x210b('0x1f')](util[_0x210b('0x1c')](_0x210b('0x20'),_0x21040c['uniqueid']),_0x21040c);agents[_0x210b('0x1e')](_0x21040c);}catch(_0x3bcfde){utils[_0x210b('0x17')](util['format']('[%s][index][agentcalled]',_0x21040c[_0x210b('0x21')]),_0x3bcfde);}});ami['on'](_0x210b('0x22'),function(_0x5ba46d){try{utils[_0x210b('0x1f')](util[_0x210b('0x1c')](_0x210b('0x23'),_0x5ba46d[_0x210b('0x21')]),_0x5ba46d);agents[_0x210b('0x22')](_0x5ba46d);}catch(_0x3961ab){utils[_0x210b('0x17')](util[_0x210b('0x1c')]('[%s][index][agentringnoanswer]',_0x5ba46d['uniqueid']),_0x3961ab);}});ami['on'](_0x210b('0x24'),function(_0x3c63fe){try{utils['debug'](util['format']('[%s][index][agentconnect]',_0x3c63fe[_0x210b('0x21')]),_0x3c63fe);agents['agentconnect'](_0x3c63fe);queues[_0x210b('0x24')](_0x3c63fe);}catch(_0x25716d){utils['error'](util[_0x210b('0x1c')](_0x210b('0x25'),_0x3c63fe[_0x210b('0x21')]),_0x25716d);}});ami['on'](_0x210b('0x26'),function(_0xf29a11){try{utils['debug'](util['format'](_0x210b('0x27'),_0xf29a11['uniqueid']),_0xf29a11);agents['agentcomplete'](_0xf29a11);queues[_0x210b('0x26')](_0xf29a11);members[_0x210b('0x26')](_0xf29a11);}catch(_0x143909){utils['error'](util['format'](_0x210b('0x27'),_0xf29a11[_0x210b('0x21')]),_0x143909);}});ami['on'](_0x210b('0x28'),function(_0x154fdc){try{utils['debug'](util[_0x210b('0x1c')](_0x210b('0x29'),_0x154fdc['uniqueid']),_0x154fdc);agents[_0x210b('0x28')](_0x154fdc);queues[_0x210b('0x28')](_0x154fdc);}catch(_0x41270a){utils['error'](util[_0x210b('0x1c')](_0x210b('0x29'),_0x154fdc[_0x210b('0x21')]),_0x41270a);}});ami['on']('queuecallerjoin',function(_0x44ce63){try{utils['debug'](util[_0x210b('0x1c')](_0x210b('0x2a'),_0x44ce63[_0x210b('0x21')]),_0x44ce63);queues[_0x210b('0x2b')](_0x44ce63);recordings[_0x210b('0x2b')](_0x44ce63);}catch(_0x21f00a){utils[_0x210b('0x17')](util[_0x210b('0x1c')]('[%s][index][queuecallerjoin]',_0x44ce63[_0x210b('0x21')]),_0x21f00a);}});ami['on'](_0x210b('0x2c'),function(_0x39e897){try{utils[_0x210b('0x1f')](util[_0x210b('0x1c')](_0x210b('0x2d'),_0x39e897[_0x210b('0x21')]),_0x39e897);queues[_0x210b('0x2c')](_0x39e897);}catch(_0xd11cbc){utils[_0x210b('0x17')](util[_0x210b('0x1c')]('[%s][index][queuecallerleave]',_0x39e897[_0x210b('0x21')]),_0xd11cbc);}});ami['on'](_0x210b('0x2e'),function(_0xaa4790){try{utils['debug'](util[_0x210b('0x1c')]('[%s][index][musiconholdstart]',_0xaa4790[_0x210b('0x21')]),_0xaa4790);queues[_0x210b('0x2e')](_0xaa4790);calls[_0x210b('0x2e')](_0xaa4790);}catch(_0x3df725){utils[_0x210b('0x17')](util[_0x210b('0x1c')](_0x210b('0x2f'),_0xaa4790['uniqueid']),_0x3df725);}});ami['on'](_0x210b('0x30'),function(_0x54f978){try{utils[_0x210b('0x1f')](util['format']('[%s][index][musiconholdstop]',_0x54f978[_0x210b('0x21')]),_0x54f978);queues[_0x210b('0x30')](_0x54f978);calls[_0x210b('0x30')](_0x54f978);}catch(_0x3bff0d){utils[_0x210b('0x17')](util[_0x210b('0x1c')]('[%s][index][musiconholdstop]',_0x54f978[_0x210b('0x21')]),_0x3bff0d);}});ami['on'](_0x210b('0x31'),function(_0x4f3cee){try{utils['debug'](util[_0x210b('0x1c')](_0x210b('0x32'),_0x4f3cee[_0x210b('0x21')]),_0x4f3cee);calls['newstate'](_0x4f3cee);recordings[_0x210b('0x31')](_0x4f3cee);}catch(_0x398f85){utils[_0x210b('0x17')](util[_0x210b('0x1c')](_0x210b('0x32'),_0x4f3cee[_0x210b('0x21')]),_0x398f85);}});ami['on'](_0x210b('0x33'),function(_0x33d66e){try{utils[_0x210b('0x1f')](util[_0x210b('0x1c')]('[%s][index][hangup]',_0x33d66e[_0x210b('0x21')]),_0x33d66e);calls[_0x210b('0x33')](_0x33d66e);recordings[_0x210b('0x33')](_0x33d66e);dials[_0x210b('0x33')](_0x33d66e);agents['hangup'](_0x33d66e);queues[_0x210b('0x33')](_0x33d66e);}catch(_0x5f4392){utils['error'](util[_0x210b('0x1c')](_0x210b('0x34'),_0x33d66e[_0x210b('0x21')]),_0x5f4392);}});ami['on'](_0x210b('0x35'),function(_0x4b67dc){try{utils['debug'](util[_0x210b('0x1c')](_0x210b('0x36'),_0x4b67dc[_0x210b('0x21')]),_0x4b67dc);members[_0x210b('0x35')](_0x4b67dc);}catch(_0x2a31e0){utils['error'](util['format'](_0x210b('0x36'),_0x4b67dc['uniqueid']),_0x2a31e0);}});ami['on'](_0x210b('0x37'),function(_0x5a03f7){try{utils[_0x210b('0x1f')](util[_0x210b('0x1c')](_0x210b('0x38'),_0x5a03f7[_0x210b('0x21')]),_0x5a03f7);queues[_0x210b('0x37')](_0x5a03f7);agents[_0x210b('0x37')](_0x5a03f7);transfers[_0x210b('0x37')](_0x5a03f7);}catch(_0x3f01fb){utils[_0x210b('0x17')](util[_0x210b('0x1c')](_0x210b('0x38'),_0x5a03f7['uniqueid']),_0x3f01fb);}});ami['on']('attendedtransfer',function(_0x330ac4){try{utils[_0x210b('0x1f')](util[_0x210b('0x1c')](_0x210b('0x39'),_0x330ac4[_0x210b('0x3a')]),_0x330ac4);queues[_0x210b('0x3b')](_0x330ac4);transfers[_0x210b('0x3b')](_0x330ac4);agents[_0x210b('0x3b')](_0x330ac4);calls[_0x210b('0x3b')](_0x330ac4);}catch(_0x251ee3){utils['error'](util[_0x210b('0x1c')]('[%s][index][attendedtransfer]',_0x330ac4[_0x210b('0x3a')]),_0x251ee3);}});ami['on'](_0x210b('0x3c'),function(_0x2cc68a){try{utils[_0x210b('0x1f')](util[_0x210b('0x1c')](_0x210b('0x3d'),_0x2cc68a[_0x210b('0x21')]),_0x2cc68a);queues['varset'](_0x2cc68a);recordings[_0x210b('0x3c')](_0x2cc68a);calls[_0x210b('0x3c')](_0x2cc68a);dials[_0x210b('0x3c')](_0x2cc68a);}catch(_0x31d06c){utils['error'](util[_0x210b('0x1c')]('[%s][index][varset]',_0x2cc68a['uniqueid']),_0x31d06c);}});ami['on']('newexten',function(_0x6afc08){try{utils[_0x210b('0x1f')](util['format'](_0x210b('0x3e'),_0x6afc08[_0x210b('0x21')]),_0x6afc08);calls['newexten'](_0x6afc08);recordings['newexten'](_0x6afc08);dials['newexten'](_0x6afc08);}catch(_0x869cf8){utils[_0x210b('0x17')](util[_0x210b('0x1c')]('[%s][index][newexten]',_0x6afc08['uniqueid']),_0x869cf8);}});ami['on'](_0x210b('0x3f'),function(_0x582d41){try{utils[_0x210b('0x1f')](util['format']('[%s][index][newchannel]',_0x582d41[_0x210b('0x21')]),_0x582d41);calls[_0x210b('0x3f')](_0x582d41);recordings[_0x210b('0x3f')](_0x582d41);}catch(_0x2ff358){utils[_0x210b('0x17')](util[_0x210b('0x1c')](_0x210b('0x40'),_0x582d41[_0x210b('0x21')]),_0x2ff358);}});ami['on'](_0x210b('0x41'),function(_0x305395){try{utils[_0x210b('0x1f')](util['format'](_0x210b('0x42'),_0x305395['uniqueid']),_0x305395);dials['dialbegin'](_0x305395);}catch(_0x2104e5){utils[_0x210b('0x17')](util[_0x210b('0x1c')](_0x210b('0x43'),_0x305395[_0x210b('0x21')]),_0x2104e5);}});ami['on']('dialend',function(_0xb65753){try{utils[_0x210b('0x1f')](util[_0x210b('0x1c')](_0x210b('0x44'),_0xb65753[_0x210b('0x21')]),_0xb65753);dials[_0x210b('0x45')](_0xb65753);}catch(_0x38d056){utils[_0x210b('0x17')](util[_0x210b('0x1c')](_0x210b('0x44'),_0xb65753[_0x210b('0x21')]),_0x38d056);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 12a9856..e8aa0f6 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 _0xe2cc=['info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','membername','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','error','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','data1','data2','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','lodash','util','Queue:'];(function(_0x17e19a,_0x43fccf){var _0x5ce668=function(_0x13e564){while(--_0x13e564){_0x17e19a['push'](_0x17e19a['shift']());}};_0x5ce668(++_0x43fccf);}(_0xe2cc,0x69));var _0xce2c=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xe2cc[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xce2c('0x0'));var util=require(_0xce2c('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0xce2c('0x2')];function writeDB(_0x1e5b84){utils[_0xce2c('0x3')](util[_0xce2c('0x4')](_0xce2c('0x5'),_0x1e5b84[_0xce2c('0x6')],_0x1e5b84[_0xce2c('0x7')],_0x1e5b84[_0xce2c('0x8')],_0x1e5b84['data2'],_0x1e5b84['membername'],_0x1e5b84[_0xce2c('0x9')]));if(_0x1e5b84[_0xce2c('0x7')]){utils[_0xce2c('0xa')](_0x1e5b84[_0xce2c('0x7')])[_0xce2c('0xb')](function(_0x166965){if(_0x166965){_0x1e5b84['membername']=_0x166965[_0xce2c('0xc')];_0x1e5b84[_0xce2c('0xd')]=_0x166965[_0xce2c('0xd')];utils[_0xce2c('0xe')](_0xce2c('0xf'),_0x1e5b84);}else{utils[_0xce2c('0x10')](_0x1e5b84[_0xce2c('0x7')][_0xce2c('0x11')]('/')[0x1])[_0xce2c('0xb')](function(_0x1fede4){if(_0x1fede4){_0x1e5b84[_0xce2c('0x12')]=_0x1fede4[_0xce2c('0xc')];_0x1e5b84[_0xce2c('0xd')]=_0x1fede4[_0xce2c('0xd')];utils[_0xce2c('0xe')]('CreateMemberReport',_0x1e5b84);}});}})['catch'](function(_0x166328){utils['error'](util[_0xce2c('0x4')](_0xce2c('0x13'),_0x1e5b84[_0xce2c('0x6')]),_0x166328);});}delete members[_0x1e5b84[_0xce2c('0x7')]];}function startsWith(_0x4873e6,_0xb99213){return _[_0xce2c('0x14')](_0x4873e6,function(_0x146830){return _[_0xce2c('0x15')](_0xb99213,_0x146830);});}exports[_0xce2c('0x16')]=function(_0x35136f){try{utils[_0xce2c('0x17')](util['format'](_0xce2c('0x18'),members[_0x35136f[_0xce2c('0x19')]]?members[_0x35136f[_0xce2c('0x19')]][_0xce2c('0x6')]:_0x35136f[_0xce2c('0x19')]),_0x35136f);utils['info'](util[_0xce2c('0x4')](_0xce2c('0x1a'),members[_0x35136f['device']]?members[_0x35136f['device']][_0xce2c('0x6')]:_0x35136f[_0xce2c('0x19')],_0x35136f[_0xce2c('0x1b')],_0x35136f[_0xce2c('0x19')]));switch(_0x35136f[_0xce2c('0x1b')]){case _0xce2c('0x1c'):case _0xce2c('0x1d'):if(!startsWith(exclude,_0x35136f['device'])){members[_0x35136f[_0xce2c('0x19')]]={'channel':_0xce2c('0x1e'),'interface':_0x35136f[_0xce2c('0x19')],'type':_0xce2c('0x1f'),'enterAt':utils[_0xce2c('0x20')](),'role':_0xce2c('0x21')};}break;case _0xce2c('0x22'):if(!_[_0xce2c('0x23')](members[_0x35136f[_0xce2c('0x19')]])){members[_0x35136f[_0xce2c('0x19')]]['exitAt']=utils[_0xce2c('0x20')]();members[_0x35136f[_0xce2c('0x19')]][_0xce2c('0x24')]=utils[_0xce2c('0x25')](members[_0x35136f[_0xce2c('0x19')]][_0xce2c('0x26')],members[_0x35136f['device']][_0xce2c('0x27')]);if(members[_0x35136f['device']][_0xce2c('0x6')]){writeDB(members[_0x35136f[_0xce2c('0x19')]]);}}break;default:break;}}catch(_0xbb1756){utils[_0xce2c('0x28')](util[_0xce2c('0x4')](_0xce2c('0x18'),members[_0x35136f[_0xce2c('0x19')]]?members[_0x35136f[_0xce2c('0x19')]][_0xce2c('0x6')]:_0x35136f[_0xce2c('0x19')]),_0xbb1756);}};exports[_0xce2c('0x29')]=function(_0x45efae){try{if(!_[_0xce2c('0x23')](members[_0x45efae['interface']])){utils[_0xce2c('0x17')](util[_0xce2c('0x4')](_0xce2c('0x2a'),_0x45efae[_0xce2c('0x6')]),_0x45efae);utils[_0xce2c('0x3')](util['format'](_0xce2c('0x2b'),_0x45efae[_0xce2c('0x6')],_0x45efae['interface'],_0x45efae[_0xce2c('0x2c')]));members[_0x45efae[_0xce2c('0x7')]]=_[_0xce2c('0x2d')](members[_0x45efae[_0xce2c('0x7')]],{'data4':_0x45efae[_0xce2c('0x2c')],'uniqueid':_0x45efae['uniqueid']});}}catch(_0x348207){utils['error'](util[_0xce2c('0x4')](_0xce2c('0x2a'),_0x45efae['uniqueid']),_0x348207);}};exports[_0xce2c('0x2e')]=function(_0x3ea946){try{utils[_0xce2c('0x17')](util[_0xce2c('0x4')]('[%s][members][cdr]',_0x3ea946[_0xce2c('0x6')]),_0x3ea946);if(_0x3ea946[_0xce2c('0x8')]){var _0x493d4f=_0x3ea946[_0xce2c('0x8')][_0xce2c('0x11')]('-')[0x0];if(!_[_0xce2c('0x23')](members[_0x493d4f])){members[_0x493d4f]=_[_0xce2c('0x2d')](members[_0x493d4f],{'data1':members[_0x493d4f][_0xce2c('0x2f')]||_0x3ea946[_0xce2c('0x9')],'data2':members[_0x493d4f][_0xce2c('0x30')]||_0x3ea946[_0xce2c('0x31')],'data3':members[_0x493d4f]['data3']||_0x3ea946[_0xce2c('0x32')],'uniqueid':members[_0x493d4f][_0xce2c('0x6')]||_0x3ea946['uniqueid']});utils[_0xce2c('0x3')](util[_0xce2c('0x4')](_0xce2c('0x33'),_0x3ea946[_0xce2c('0x6')],members[_0x493d4f][_0xce2c('0x2f')],members[_0x493d4f][_0xce2c('0x30')],members[_0x493d4f][_0xce2c('0x34')]));if(members[_0x493d4f][_0xce2c('0x26')]){writeDB(members[_0x493d4f]);}}}if(_0x3ea946[_0xce2c('0x35')]){var _0x306f58=_0x3ea946[_0xce2c('0x35')]['split']('-')[0x0];if(!_[_0xce2c('0x23')](members[_0x306f58])){members[_0x306f58]=_[_0xce2c('0x2d')](members[_0x306f58],{'data1':members[_0x306f58][_0xce2c('0x2f')]||_0x3ea946[_0xce2c('0x9')],'data2':members[_0x306f58][_0xce2c('0x30')]||_0x3ea946[_0xce2c('0x31')],'data3':members[_0x306f58][_0xce2c('0x34')]||_0x3ea946[_0xce2c('0x32')],'uniqueid':members[_0x306f58][_0xce2c('0x6')]||_0x3ea946[_0xce2c('0x6')]});utils[_0xce2c('0x3')](util[_0xce2c('0x4')](_0xce2c('0x33'),_0x3ea946[_0xce2c('0x6')],members[_0x306f58]['data1'],members[_0x306f58]['data2'],members[_0x306f58]['data3']));if(members[_0x306f58]['exitAt']){writeDB(members[_0x306f58]);}}}}catch(_0x35f35f){utils[_0xce2c('0x28')](util['format']('[%s][members][cdr]',_0x3ea946[_0xce2c('0x6')]),_0x35f35f);}}; \ No newline at end of file +var _0x7df8=['lodash','util','./utils','Local/_attended@transfer','Queue:','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','getUserByInterface','then','internal','membername','name','request','CreateMemberReport','error','format','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','info','state','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt','agentcomplete','debug','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','split','assign','data1','type','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data2','destinationchannel','source'];(function(_0xb0d66d,_0x498820){var _0xd5bc13=function(_0x39cec4){while(--_0x39cec4){_0xb0d66d['push'](_0xb0d66d['shift']());}};_0xd5bc13(++_0x498820);}(_0x7df8,0x1a0));var _0x87df=function(_0x4d4f89,_0x43006f){_0x4d4f89=_0x4d4f89-0x0;var _0x528164=_0x7df8[_0x4d4f89];return _0x528164;};'use strict';var _=require(_0x87df('0x0'));var util=require(_0x87df('0x1'));var utils=require(_0x87df('0x2'));var members={};var exclude=[_0x87df('0x3'),_0x87df('0x4')];function writeDB(_0x3de7e2){utils['info'](util['format'](_0x87df('0x5'),_0x3de7e2[_0x87df('0x6')],_0x3de7e2['interface'],_0x3de7e2['channel'],_0x3de7e2['data2'],_0x3de7e2['membername'],_0x3de7e2['type']));if(_0x3de7e2[_0x87df('0x7')]){utils[_0x87df('0x8')](_0x3de7e2[_0x87df('0x7')])[_0x87df('0x9')](function(_0x464e30){if(_0x464e30){_0x3de7e2['membername']=_0x464e30['name'];_0x3de7e2[_0x87df('0xa')]=_0x464e30[_0x87df('0xa')];utils['request']('CreateMemberReport',_0x3de7e2);}else{utils['getUserByName'](_0x3de7e2['interface']['split']('/')[0x1])[_0x87df('0x9')](function(_0x302270){if(_0x302270){_0x3de7e2[_0x87df('0xb')]=_0x302270[_0x87df('0xc')];_0x3de7e2[_0x87df('0xa')]=_0x302270[_0x87df('0xa')];utils[_0x87df('0xd')](_0x87df('0xe'),_0x3de7e2);}});}})['catch'](function(_0x543c2b){utils[_0x87df('0xf')](util[_0x87df('0x10')](_0x87df('0x11'),_0x3de7e2[_0x87df('0x6')]),_0x543c2b);});}delete members[_0x3de7e2[_0x87df('0x7')]];}function startsWith(_0xe0d57f,_0x38544c){return _[_0x87df('0x12')](_0xe0d57f,function(_0x5026c8){return _[_0x87df('0x13')](_0x38544c,_0x5026c8);});}exports[_0x87df('0x14')]=function(_0x15a429){try{utils['debug'](util['format'](_0x87df('0x15'),members[_0x15a429[_0x87df('0x16')]]?members[_0x15a429['device']]['uniqueid']:_0x15a429[_0x87df('0x16')]),_0x15a429);utils[_0x87df('0x17')](util[_0x87df('0x10')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x15a429[_0x87df('0x16')]]?members[_0x15a429[_0x87df('0x16')]][_0x87df('0x6')]:_0x15a429[_0x87df('0x16')],_0x15a429[_0x87df('0x18')],_0x15a429['device']));switch(_0x15a429[_0x87df('0x18')]){case'INUSE':case _0x87df('0x19'):if(!startsWith(exclude,_0x15a429[_0x87df('0x16')])){members[_0x15a429[_0x87df('0x16')]]={'channel':_0x87df('0x1a'),'interface':_0x15a429['device'],'type':_0x87df('0x1b'),'enterAt':utils[_0x87df('0x1c')](),'role':_0x87df('0x1d')};}break;case _0x87df('0x1e'):if(!_[_0x87df('0x1f')](members[_0x15a429['device']])){members[_0x15a429[_0x87df('0x16')]][_0x87df('0x20')]=utils[_0x87df('0x1c')]();members[_0x15a429[_0x87df('0x16')]][_0x87df('0x21')]=utils['diffTime'](members[_0x15a429[_0x87df('0x16')]][_0x87df('0x20')],members[_0x15a429[_0x87df('0x16')]][_0x87df('0x22')]);if(members[_0x15a429[_0x87df('0x16')]]['uniqueid']){writeDB(members[_0x15a429['device']]);}}break;default:break;}}catch(_0x2b4beb){utils[_0x87df('0xf')](util[_0x87df('0x10')](_0x87df('0x15'),members[_0x15a429['device']]?members[_0x15a429[_0x87df('0x16')]][_0x87df('0x6')]:_0x15a429[_0x87df('0x16')]),_0x2b4beb);}};exports[_0x87df('0x23')]=function(_0x58c670){try{if(!_[_0x87df('0x1f')](members[_0x58c670[_0x87df('0x7')]])){utils[_0x87df('0x24')](util[_0x87df('0x10')]('[%s][members][agentcomplete]',_0x58c670[_0x87df('0x6')]),_0x58c670);utils[_0x87df('0x17')](util[_0x87df('0x10')](_0x87df('0x25'),_0x58c670[_0x87df('0x6')],_0x58c670[_0x87df('0x7')],_0x58c670['queue']));members[_0x58c670['interface']]=_['assign'](members[_0x58c670[_0x87df('0x7')]],{'data4':_0x58c670[_0x87df('0x26')],'uniqueid':_0x58c670[_0x87df('0x6')]});}}catch(_0x1e0ba4){utils['error'](util[_0x87df('0x10')](_0x87df('0x27'),_0x58c670[_0x87df('0x6')]),_0x1e0ba4);}};exports[_0x87df('0x28')]=function(_0x4aedd8){try{utils['debug'](util[_0x87df('0x10')](_0x87df('0x29'),_0x4aedd8[_0x87df('0x6')]),_0x4aedd8);if(_0x4aedd8['channel']){var _0xc312f3=_0x4aedd8['channel'][_0x87df('0x2a')]('-')[0x0];if(!_['isNil'](members[_0xc312f3])){members[_0xc312f3]=_[_0x87df('0x2b')](members[_0xc312f3],{'data1':members[_0xc312f3][_0x87df('0x2c')]||_0x4aedd8[_0x87df('0x2d')],'data2':members[_0xc312f3]['data2']||_0x4aedd8['source'],'data3':members[_0xc312f3][_0x87df('0x2e')]||_0x4aedd8[_0x87df('0x2f')],'uniqueid':members[_0xc312f3][_0x87df('0x6')]||_0x4aedd8[_0x87df('0x6')]});utils[_0x87df('0x17')](util[_0x87df('0x10')](_0x87df('0x30'),_0x4aedd8['uniqueid'],members[_0xc312f3]['data1'],members[_0xc312f3][_0x87df('0x31')],members[_0xc312f3][_0x87df('0x2e')]));if(members[_0xc312f3]['exitAt']){writeDB(members[_0xc312f3]);}}}if(_0x4aedd8[_0x87df('0x32')]){var _0x59c858=_0x4aedd8[_0x87df('0x32')][_0x87df('0x2a')]('-')[0x0];if(!_[_0x87df('0x1f')](members[_0x59c858])){members[_0x59c858]=_[_0x87df('0x2b')](members[_0x59c858],{'data1':members[_0x59c858][_0x87df('0x2c')]||_0x4aedd8[_0x87df('0x2d')],'data2':members[_0x59c858][_0x87df('0x31')]||_0x4aedd8[_0x87df('0x33')],'data3':members[_0x59c858][_0x87df('0x2e')]||_0x4aedd8['destination'],'uniqueid':members[_0x59c858][_0x87df('0x6')]||_0x4aedd8[_0x87df('0x6')]});utils[_0x87df('0x17')](util[_0x87df('0x10')](_0x87df('0x30'),_0x4aedd8[_0x87df('0x6')],members[_0x59c858][_0x87df('0x2c')],members[_0x59c858]['data2'],members[_0x59c858]['data3']));if(members[_0x59c858][_0x87df('0x20')]){writeDB(members[_0x59c858]);}}}}catch(_0x4e397a){utils[_0x87df('0xf')](util['format'](_0x87df('0x29'),_0x4aedd8[_0x87df('0x6')]),_0x4e397a);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index f3a69b2..3579091 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 _0x09ed=['transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','transferuniqueid','transfereelinkedid','clone','calleridnum','calleridname','mohtime','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','error','[%s][queues][hangup]','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND'];(function(_0x5b2488,_0x170d3c){var _0x583867=function(_0xab27cb){while(--_0xab27cb){_0x5b2488['push'](_0x5b2488['shift']());}};_0x583867(++_0x170d3c);}(_0x09ed,0xf2));var _0xd09e=function(_0x5c9c89,_0x10da41){_0x5c9c89=_0x5c9c89-0x0;var _0x35d7d3=_0x09ed[_0x5c9c89];return _0x35d7d3;};'use strict';var _=require('lodash');var util=require(_0xd09e('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x4855d5){utils[_0xd09e('0x1')](util[_0xd09e('0x2')](_0xd09e('0x3'),_0x4855d5[_0xd09e('0x4')],_0x4855d5[_0xd09e('0x5')],_0x4855d5[_0xd09e('0x6')],_0x4855d5[_0xd09e('0x7')],_0x4855d5['calleridnum'],_0x4855d5[_0xd09e('0x8')],_0x4855d5[_0xd09e('0x9')]));if(_0x4855d5[_0xd09e('0x6')]){utils['getVoiceQueueByName'](_0x4855d5[_0xd09e('0x6')])[_0xd09e('0xa')](function(_0x55b3d1){if(_0x55b3d1){_0x4855d5[_0xd09e('0xb')]=_0x55b3d1[_0xd09e('0xb')];}utils[_0xd09e('0xc')](_0xd09e('0xd'),_0x4855d5);});}else{utils[_0xd09e('0xc')](_0xd09e('0xd'),_0x4855d5);}if(_0x4855d5[_0xd09e('0xe')]){delete queues[_0x4855d5['transfereduniqueid']];}else{delete queues[_0x4855d5[_0xd09e('0x4')]];}}exports[_0xd09e('0xf')]=function(_0x445243){try{utils[_0xd09e('0x10')](util['format'](_0xd09e('0x11'),_0x445243[_0xd09e('0x4')]),_0x445243);utils['info'](util[_0xd09e('0x2')](_0xd09e('0x12'),_0x445243[_0xd09e('0x4')],_0x445243['queue'],_0x445243[_0xd09e('0x13')]));queues[_0x445243[_0xd09e('0x4')]]=_[_0xd09e('0x14')](_0x445243,{'originalposition':_0x445243[_0xd09e('0x13')],'queuecallerjoinAt':utils[_0xd09e('0x15')](),'mohtime':0x0});}catch(_0x3df208){utils['error'](util[_0xd09e('0x2')](_0xd09e('0x11'),_0x445243['uniqueid']),_0x3df208);}};exports['hangup']=function(_0x44f7cb){try{if(!_[_0xd09e('0x16')](queues[_0x44f7cb[_0xd09e('0x4')]])){utils['debug'](util[_0xd09e('0x2')]('[%s][queues][hangup]',_0x44f7cb[_0xd09e('0x4')]),_0x44f7cb);if(queues[_0x44f7cb[_0xd09e('0x4')]]['queuecallerleaveAt']){if(!queues[_0x44f7cb[_0xd09e('0x4')]][_0xd09e('0x17')]&&!queues[_0x44f7cb[_0xd09e('0x4')]][_0xd09e('0x18')]){queues[_0x44f7cb[_0xd09e('0x4')]][_0xd09e('0x19')]=!![];queues[_0x44f7cb['uniqueid']][_0xd09e('0x1a')]=utils[_0xd09e('0x15')]();queues[_0x44f7cb[_0xd09e('0x4')]][_0xd09e('0x9')]=_0xd09e('0x1b');}utils['info'](util['format'](_0xd09e('0x1c'),_0x44f7cb[_0xd09e('0x4')],queues[_0x44f7cb[_0xd09e('0x4')]]['name'],queues[_0x44f7cb[_0xd09e('0x4')]][_0xd09e('0x9')]));writeDB(queues[_0x44f7cb['uniqueid']]);}else if(queues[_0x44f7cb[_0xd09e('0x4')]][_0xd09e('0xe')]){utils[_0xd09e('0x1')](util[_0xd09e('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x44f7cb[_0xd09e('0x4')],queues[_0x44f7cb[_0xd09e('0x4')]][_0xd09e('0x1d')],queues[_0x44f7cb[_0xd09e('0x4')]]['transfereduniqueid']));queues[queues[_0x44f7cb['uniqueid']][_0xd09e('0xe')]]=queues[_0x44f7cb[_0xd09e('0x4')]];queues[queues[_0x44f7cb['uniqueid']][_0xd09e('0xe')]][_0xd09e('0x1e')]=0x2;delete queues[_0x44f7cb[_0xd09e('0x4')]];}}}catch(_0x3c2d3c){utils[_0xd09e('0x1f')](util['format'](_0xd09e('0x20'),_0x44f7cb[_0xd09e('0x4')]),_0x3c2d3c);}};exports[_0xd09e('0x21')]=function(_0x4feea3){try{utils[_0xd09e('0x10')](util[_0xd09e('0x2')](_0xd09e('0x22'),_0x4feea3[_0xd09e('0x4')]),_0x4feea3);if(!_[_0xd09e('0x16')](_0x4feea3['variable'][_0xd09e('0x23')])&&_0x4feea3[_0xd09e('0x24')][_0xd09e('0x25')]()!==_0xd09e('0x26')){if(!_['isNil'](queues[_0x4feea3[_0xd09e('0x4')]])){queues[_0x4feea3['uniqueid']][_0xd09e('0x17')]=![];queues[_0x4feea3['uniqueid']][_0xd09e('0x27')]=null;queues[_0x4feea3[_0xd09e('0x4')]]['queuecallerexit']=!![];queues[_0x4feea3['uniqueid']][_0xd09e('0x28')]=utils[_0xd09e('0x15')]();queues[_0x4feea3[_0xd09e('0x4')]][_0xd09e('0x9')]=_0x4feea3[_0xd09e('0x24')][_0xd09e('0x25')]();utils['info'](util[_0xd09e('0x2')](_0xd09e('0x29'),_0x4feea3[_0xd09e('0x4')],queues[_0x4feea3[_0xd09e('0x4')]][_0xd09e('0x1d')],_0x4feea3[_0xd09e('0x24')],queues[_0x4feea3[_0xd09e('0x4')]][_0xd09e('0x9')]));writeDB(queues[_0x4feea3['uniqueid']]);}}else if(!_[_0xd09e('0x16')](_0x4feea3[_0xd09e('0x2a')][_0xd09e('0x2b')])){if(!_[_0xd09e('0x16')](queues[_0x4feea3[_0xd09e('0x4')]])&&!queues[_0x4feea3[_0xd09e('0x4')]][_0xd09e('0x17')]){queues[_0x4feea3[_0xd09e('0x4')]]['queuecallerabandon']=![];queues[_0x4feea3[_0xd09e('0x4')]][_0xd09e('0x27')]=null;queues[_0x4feea3['uniqueid']][_0xd09e('0x18')]=!![];queues[_0x4feea3[_0xd09e('0x4')]][_0xd09e('0x28')]=utils[_0xd09e('0x15')]();queues[_0x4feea3[_0xd09e('0x4')]][_0xd09e('0x9')]=_0xd09e('0x2c');utils[_0xd09e('0x1')](util['format'](_0xd09e('0x2d'),_0x4feea3['uniqueid'],queues[_0x4feea3[_0xd09e('0x4')]]['name'],_0x4feea3[_0xd09e('0x24')],queues[_0x4feea3[_0xd09e('0x4')]][_0xd09e('0x9')]));}}}catch(_0x4b5522){utils['error'](util[_0xd09e('0x2')](_0xd09e('0x22'),_0x4feea3[_0xd09e('0x4')]),_0x4b5522);}};exports[_0xd09e('0x17')]=function(_0x126072){try{if(!_[_0xd09e('0x16')](queues[_0x126072[_0xd09e('0x4')]])){utils[_0xd09e('0x10')](util['format'](_0xd09e('0x2e'),_0x126072[_0xd09e('0x4')]),_0x126072);queues[_0x126072[_0xd09e('0x4')]][_0xd09e('0x18')]=![];queues[_0x126072[_0xd09e('0x4')]]['queuecallerexitAt']=null;queues[_0x126072['uniqueid']][_0xd09e('0x17')]=!![];queues[_0x126072['uniqueid']][_0xd09e('0x27')]=utils[_0xd09e('0x15')]();queues[_0x126072[_0xd09e('0x4')]][_0xd09e('0x9')]='ABANDONED';utils['info'](util[_0xd09e('0x2')](_0xd09e('0x2f'),_0x126072[_0xd09e('0x4')],queues[_0x126072[_0xd09e('0x4')]]['name'],queues[_0x126072[_0xd09e('0x4')]][_0xd09e('0x9')]));}}catch(_0x6da400){utils[_0xd09e('0x1f')](util['format'](_0xd09e('0x2e'),_0x126072[_0xd09e('0x4')]),_0x6da400);}};exports['queuecallerleave']=function(_0x13db36){try{if(!_[_0xd09e('0x16')](queues[_0x13db36[_0xd09e('0x4')]])){utils[_0xd09e('0x10')](util[_0xd09e('0x2')](_0xd09e('0x30'),_0x13db36[_0xd09e('0x4')]),_0x13db36);utils[_0xd09e('0x1')](util[_0xd09e('0x2')](_0xd09e('0x31'),_0x13db36[_0xd09e('0x4')],queues[_0x13db36[_0xd09e('0x4')]][_0xd09e('0x1d')],_0x13db36[_0xd09e('0x32')],_0x13db36[_0xd09e('0x33')]));queues[_0x13db36[_0xd09e('0x4')]][_0xd09e('0x34')]=!![];queues[_0x13db36['uniqueid']][_0xd09e('0x35')]=utils[_0xd09e('0x15')]();queues[_0x13db36[_0xd09e('0x4')]][_0xd09e('0x36')]=utils[_0xd09e('0x37')](queues[_0x13db36[_0xd09e('0x4')]][_0xd09e('0x35')],queues[_0x13db36[_0xd09e('0x4')]][_0xd09e('0x38')]);queues[_0x13db36['uniqueid']][_0xd09e('0x13')]=_0x13db36[_0xd09e('0x13')];queues[_0x13db36[_0xd09e('0x4')]][_0xd09e('0x39')]=_0x13db36[_0xd09e('0x39')];queues[_0x13db36[_0xd09e('0x4')]]['connectedlinenum']=_0x13db36[_0xd09e('0x32')];queues[_0x13db36[_0xd09e('0x4')]][_0xd09e('0x33')]=_0x13db36[_0xd09e('0x33')];}}catch(_0x412372){utils[_0xd09e('0x1f')](util[_0xd09e('0x2')](_0xd09e('0x30'),_0x13db36['uniqueid']),_0x412372);}};exports[_0xd09e('0x3a')]=function(_0x16249f){try{if(!_[_0xd09e('0x16')](queues[_0x16249f['uniqueid']])){utils['debug'](util[_0xd09e('0x2')](_0xd09e('0x3b'),_0x16249f[_0xd09e('0x4')]),_0x16249f);utils[_0xd09e('0x1')](util[_0xd09e('0x2')](_0xd09e('0x3c'),_0x16249f[_0xd09e('0x4')],queues[_0x16249f[_0xd09e('0x4')]]['name'],_0x16249f[_0xd09e('0x3d')],_0x16249f['destaccountcode']));queues[_0x16249f[_0xd09e('0x4')]][_0xd09e('0x17')]=![];queues[_0x16249f[_0xd09e('0x4')]][_0xd09e('0x17')]=![];queues[_0x16249f[_0xd09e('0x4')]][_0xd09e('0x27')]=null;queues[_0x16249f[_0xd09e('0x4')]][_0xd09e('0x18')]=![];queues[_0x16249f[_0xd09e('0x4')]][_0xd09e('0x9')]=null;queues[_0x16249f['uniqueid']][_0xd09e('0x28')]=null;queues[_0x16249f[_0xd09e('0x4')]][_0xd09e('0x3e')]=!![];queues[_0x16249f[_0xd09e('0x4')]][_0xd09e('0x8')]=_0x16249f[_0xd09e('0x3f')];queues[_0x16249f[_0xd09e('0x4')]][_0xd09e('0x7')]=_0x16249f[_0xd09e('0x3d')];}}catch(_0x3ac3b2){utils[_0xd09e('0x1f')](util[_0xd09e('0x2')](_0xd09e('0x3b'),_0x16249f[_0xd09e('0x4')]),_0x3ac3b2);}};exports[_0xd09e('0x40')]=function(_0x242cff){try{if(!_[_0xd09e('0x16')](queues[_0x242cff[_0xd09e('0x4')]])){if(queues[_0x242cff[_0xd09e('0x4')]][_0xd09e('0x35')]){utils[_0xd09e('0x10')](util[_0xd09e('0x2')](_0xd09e('0x41'),_0x242cff[_0xd09e('0x4')]),_0x242cff);queues[_0x242cff[_0xd09e('0x4')]][_0xd09e('0x17')]=![];queues[_0x242cff[_0xd09e('0x4')]][_0xd09e('0x17')]=![];queues[_0x242cff[_0xd09e('0x4')]][_0xd09e('0x27')]=null;queues[_0x242cff[_0xd09e('0x4')]][_0xd09e('0x18')]=![];queues[_0x242cff['uniqueid']]['queuecallerexitAt']=null;queues[_0x242cff[_0xd09e('0x4')]]['assigned']=!![];queues[_0x242cff[_0xd09e('0x4')]][_0xd09e('0x7')]=_0x242cff['membername'];queues[_0x242cff[_0xd09e('0x4')]][_0xd09e('0x19')]=!![];queues[_0x242cff[_0xd09e('0x4')]][_0xd09e('0x1a')]=utils[_0xd09e('0x15')]();if(_0x242cff[_0xd09e('0x42')]=='transfer'){if(!queues[_0x242cff[_0xd09e('0x4')]][_0xd09e('0x43')]){queues[_0x242cff[_0xd09e('0x4')]]['queuecallerexitreason']=_0xd09e('0x44');}}else{queues[_0x242cff['uniqueid']]['queuecallerexitreason']=_0xd09e('0x45')+_0x242cff['reason'][_0xd09e('0x25')]();}utils['info'](util[_0xd09e('0x2')](_0xd09e('0x46'),_0x242cff[_0xd09e('0x4')],queues[_0x242cff['uniqueid']][_0xd09e('0x1d')],_0x242cff[_0xd09e('0x3d')],queues[_0x242cff[_0xd09e('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x242cff[_0xd09e('0x4')]]);}}}catch(_0x1a2923){utils['error'](util[_0xd09e('0x2')](_0xd09e('0x41'),_0x242cff['uniqueid']),_0x1a2923);}};exports[_0xd09e('0x47')]=function(_0x5de6ad){try{if(!_['isNil'](queues[_0x5de6ad[_0xd09e('0x48')]])){utils['debug'](util[_0xd09e('0x2')](_0xd09e('0x49'),_0x5de6ad[_0xd09e('0x4')]),_0x5de6ad);queues[_0x5de6ad[_0xd09e('0x48')]][_0xd09e('0x43')]=!![];queues[_0x5de6ad[_0xd09e('0x48')]][_0xd09e('0x4a')]=_0xd09e('0x4b');queues[_0x5de6ad['transfereeuniqueid']][_0xd09e('0x4c')]=_0x5de6ad[_0xd09e('0x4d')];queues[_0x5de6ad[_0xd09e('0x48')]]['transferuniqueid']=_0x5de6ad[_0xd09e('0x48')];queues[_0x5de6ad[_0xd09e('0x48')]]['queuecallerexitreason']=_0xd09e('0x4e');utils[_0xd09e('0x1')](util['format'](_0xd09e('0x4f'),_0x5de6ad['uniqueid'],queues[_0x5de6ad['transfereeuniqueid']][_0xd09e('0x1d')],_0x5de6ad[_0xd09e('0x48')],_0x5de6ad[_0xd09e('0x4d')]));}}catch(_0x4d7bed){utils[_0xd09e('0x1f')](util[_0xd09e('0x2')]('[%s][queues][blindtransfer]',_0x5de6ad['uniqueid']),_0x4d7bed);}};exports[_0xd09e('0x50')]=function(_0x13f375){try{utils[_0xd09e('0x10')](util['format'](_0xd09e('0x51'),_0x13f375[_0xd09e('0x52')]),_0x13f375);if(_0x13f375[_0xd09e('0x52')]==_0x13f375[_0xd09e('0x53')]){if(!_[_0xd09e('0x16')](queues[_0x13f375[_0xd09e('0x54')]])){utils[_0xd09e('0x1')](util[_0xd09e('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x13f375['origtransfereruniqueid'],queues[_0x13f375[_0xd09e('0x54')]][_0xd09e('0x1d')],_0x13f375['origtransfererexten']));queues[_0x13f375[_0xd09e('0x54')]]['transfer']=!![];queues[_0x13f375['secondtransfererlinkedid']][_0xd09e('0x4a')]=_0xd09e('0x55');queues[_0x13f375[_0xd09e('0x54')]][_0xd09e('0x4c')]=_0x13f375[_0xd09e('0x56')];queues[_0x13f375[_0xd09e('0x54')]][_0xd09e('0x57')]=_0x13f375[_0xd09e('0x52')];queues[_0x13f375[_0xd09e('0x54')]][_0xd09e('0x9')]='ATTENDEDTRANSFER';}if(!_[_0xd09e('0x16')](queues[_0x13f375[_0xd09e('0x53')]])){if(_0x13f375['transfereelinkedid']&&queues[_0x13f375[_0xd09e('0x58')]]){queues[_0x13f375['transfereelinkedid']][_0xd09e('0x1e')]=0x1;queues[_0x13f375[_0xd09e('0x48')]]=_[_0xd09e('0x59')](queues[_0x13f375[_0xd09e('0x58')]]);queues[_0x13f375[_0xd09e('0x48')]]['transfereduniqueid']=_0x13f375['transfertargetuniqueid'];queues[_0x13f375['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x13f375[_0xd09e('0x48')]][_0xd09e('0x5a')]=queues[_0x13f375[_0xd09e('0x54')]][_0xd09e('0x5a')];queues[_0x13f375['transfereeuniqueid']][_0xd09e('0x5b')]=queues[_0x13f375[_0xd09e('0x54')]][_0xd09e('0x5b')];queues[_0x13f375[_0xd09e('0x48')]]['queuecallerjoinAt']=utils['now']();queues[_0x13f375[_0xd09e('0x48')]][_0xd09e('0x35')]=utils[_0xd09e('0x15')]();queues[_0x13f375[_0xd09e('0x48')]][_0xd09e('0x36')]=0x0;queues[_0x13f375['transfereeuniqueid']][_0xd09e('0x5c')]=0x0;utils[_0xd09e('0x1')](util[_0xd09e('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x13f375[_0xd09e('0x52')],queues[_0x13f375['transfereeuniqueid']][_0xd09e('0x1d')],queues[_0x13f375[_0xd09e('0x48')]][_0xd09e('0x5a')],queues[_0x13f375['transfereeuniqueid']]['calleridname']));}else{utils[_0xd09e('0x1')](util[_0xd09e('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x13f375[_0xd09e('0x52')],queues[_0x13f375[_0xd09e('0x53')]][_0xd09e('0x1d')],_0x13f375['secondtransfererlinkedid']));queues[_0x13f375[_0xd09e('0x53')]][_0xd09e('0xe')]=_0x13f375[_0xd09e('0x54')];}}}else if(_0x13f375[_0xd09e('0x5d')]==_0x13f375[_0xd09e('0x54')]){if(!_[_0xd09e('0x16')](queues[_0x13f375[_0xd09e('0x53')]])){utils[_0xd09e('0x1')](util[_0xd09e('0x2')](_0xd09e('0x5e'),_0x13f375[_0xd09e('0x52')],queues[_0x13f375[_0xd09e('0x53')]]['name'],_0x13f375['secondtransfereruniqueid'],_0x13f375[_0xd09e('0x5f')]));queues[_0x13f375[_0xd09e('0x53')]][_0xd09e('0x43')]=!![];queues[_0x13f375[_0xd09e('0x53')]]['transfertype']=_0xd09e('0x55');queues[_0x13f375[_0xd09e('0x53')]][_0xd09e('0x4c')]=_0x13f375[_0xd09e('0x5f')];queues[_0x13f375[_0xd09e('0x53')]]['transferuniqueid']=_0x13f375[_0xd09e('0x5d')];queues[_0x13f375[_0xd09e('0x53')]][_0xd09e('0x9')]=_0xd09e('0x60');}if(!_[_0xd09e('0x16')](queues[_0x13f375[_0xd09e('0x54')]])){if(_0x13f375['transfertargetlinkedid']&&queues[_0x13f375[_0xd09e('0x61')]]){queues[_0x13f375['transfertargetlinkedid']][_0xd09e('0x1e')]=0x1;queues[_0x13f375[_0xd09e('0x62')]]=_['clone'](queues[_0x13f375['transfertargetlinkedid']]);queues[_0x13f375[_0xd09e('0x62')]][_0xd09e('0xe')]=_0x13f375[_0xd09e('0x62')];queues[_0x13f375['transfertargetuniqueid']][_0xd09e('0x1e')]=0x2;queues[_0x13f375[_0xd09e('0x62')]][_0xd09e('0x5a')]=queues[_0x13f375[_0xd09e('0x53')]]['calleridnum'];queues[_0x13f375[_0xd09e('0x62')]][_0xd09e('0x5b')]=queues[_0x13f375[_0xd09e('0x53')]][_0xd09e('0x5b')];queues[_0x13f375['transfertargetuniqueid']][_0xd09e('0x38')]=utils[_0xd09e('0x15')]();queues[_0x13f375['transfertargetuniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x13f375[_0xd09e('0x62')]][_0xd09e('0x36')]=0x0;queues[_0x13f375[_0xd09e('0x62')]][_0xd09e('0x5c')]=0x0;utils[_0xd09e('0x1')](util[_0xd09e('0x2')](_0xd09e('0x63'),_0x13f375[_0xd09e('0x52')],queues[_0x13f375[_0xd09e('0x62')]][_0xd09e('0x1d')],queues[_0x13f375['transfertargetuniqueid']][_0xd09e('0xe')],queues[_0x13f375[_0xd09e('0x62')]][_0xd09e('0x5a')],queues[_0x13f375[_0xd09e('0x62')]][_0xd09e('0x5b')]));}else{utils[_0xd09e('0x1')](util[_0xd09e('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x13f375[_0xd09e('0x52')],queues[_0x13f375['secondtransfererlinkedid']][_0xd09e('0x1d')],_0x13f375[_0xd09e('0x53')]));queues[_0x13f375['secondtransfererlinkedid']][_0xd09e('0xe')]=_0x13f375[_0xd09e('0x53')];}}}}catch(_0x1295fa){utils[_0xd09e('0x1f')](util[_0xd09e('0x2')](_0xd09e('0x51'),_0x13f375[_0xd09e('0x52')]),_0x1295fa);}};exports[_0xd09e('0x64')]=function(_0x4dc4fb){try{if(!_[_0xd09e('0x16')](queues[_0x4dc4fb[_0xd09e('0x4')]])){utils[_0xd09e('0x10')](util[_0xd09e('0x2')]('[%s][queues][musiconholdstart]',_0x4dc4fb[_0xd09e('0x4')]),_0x4dc4fb);queues[_0x4dc4fb[_0xd09e('0x4')]][_0xd09e('0x65')]=utils[_0xd09e('0x15')]();utils[_0xd09e('0x1')](util['format'](_0xd09e('0x66'),_0x4dc4fb[_0xd09e('0x4')],queues[_0x4dc4fb[_0xd09e('0x4')]][_0xd09e('0x1d')],queues[_0x4dc4fb['uniqueid']][_0xd09e('0x65')]));}}catch(_0x1d6abb){utils[_0xd09e('0x1f')](util['format']('[%s][queues][musiconholdstart]',_0x4dc4fb[_0xd09e('0x4')]),_0x1d6abb);}};exports[_0xd09e('0x67')]=function(_0x2e1521){try{if(!_[_0xd09e('0x16')](queues[_0x2e1521['uniqueid']])){if(!_[_0xd09e('0x16')](queues[_0x2e1521[_0xd09e('0x4')]]['musiconholdstartAt'])){utils[_0xd09e('0x10')](util['format'](_0xd09e('0x68'),_0x2e1521[_0xd09e('0x4')]),_0x2e1521);queues[_0x2e1521[_0xd09e('0x4')]]['mohtime']+=utils['diffTime'](utils['now'](),queues[_0x2e1521[_0xd09e('0x4')]][_0xd09e('0x65')]);utils[_0xd09e('0x1')](util[_0xd09e('0x2')](_0xd09e('0x69'),_0x2e1521['uniqueid'],queues[_0x2e1521[_0xd09e('0x4')]]['name'],queues[_0x2e1521['uniqueid']][_0xd09e('0x5c')]));delete queues[_0x2e1521[_0xd09e('0x4')]][_0xd09e('0x65')];}}}catch(_0x2bd524){utils[_0xd09e('0x1f')](util[_0xd09e('0x2')](_0xd09e('0x68'),_0x2e1521[_0xd09e('0x4')]),_0x2bd524);}}; \ No newline at end of file +var _0xc61f=['[%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]','lodash','util','info','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','[%s][queues][queuecallerjoin]','hangup','debug','queuecallerabandon','queuecallerexit','queuecallercomplete','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','isNil','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleaveAt','holdtime','diffTime','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','queuecallercompleteAt','transfer','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','extension','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','origtransfererlinkedid','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid'];(function(_0xf81da,_0x4f5608){var _0x17686b=function(_0x5e479c){while(--_0x5e479c){_0xf81da['push'](_0xf81da['shift']());}};_0x17686b(++_0x4f5608);}(_0xc61f,0x69));var _0xfc61=function(_0x586acb,_0x21f4d1){_0x586acb=_0x586acb-0x0;var _0x587434=_0xc61f[_0x586acb];return _0x587434;};'use strict';var _=require(_0xfc61('0x0'));var util=require(_0xfc61('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x1e482f){utils[_0xfc61('0x2')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x1e482f[_0xfc61('0x3')],_0x1e482f[_0xfc61('0x4')],_0x1e482f[_0xfc61('0x5')],_0x1e482f[_0xfc61('0x6')],_0x1e482f[_0xfc61('0x7')],_0x1e482f[_0xfc61('0x8')],_0x1e482f[_0xfc61('0x9')]));if(_0x1e482f['queue']){utils[_0xfc61('0xa')](_0x1e482f['queue'])['then'](function(_0x41eb2d){if(_0x41eb2d){_0x1e482f[_0xfc61('0xb')]=_0x41eb2d[_0xfc61('0xb')];}utils[_0xfc61('0xc')](_0xfc61('0xd'),_0x1e482f);});}else{utils[_0xfc61('0xc')](_0xfc61('0xd'),_0x1e482f);}if(_0x1e482f[_0xfc61('0xe')]){delete queues[_0x1e482f[_0xfc61('0xe')]];}else{delete queues[_0x1e482f[_0xfc61('0x3')]];}}exports[_0xfc61('0xf')]=function(_0x361d79){try{utils['debug'](util[_0xfc61('0x10')]('[%s][queues][queuecallerjoin]',_0x361d79['uniqueid']),_0x361d79);utils[_0xfc61('0x2')](util[_0xfc61('0x10')](_0xfc61('0x11'),_0x361d79['uniqueid'],_0x361d79[_0xfc61('0x5')],_0x361d79[_0xfc61('0x12')]));queues[_0x361d79[_0xfc61('0x3')]]=_[_0xfc61('0x13')](_0x361d79,{'originalposition':_0x361d79[_0xfc61('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x295d6c){utils[_0xfc61('0x14')](util['format'](_0xfc61('0x15'),_0x361d79[_0xfc61('0x3')]),_0x295d6c);}};exports[_0xfc61('0x16')]=function(_0x14cf13){try{if(!_['isNil'](queues[_0x14cf13[_0xfc61('0x3')]])){utils[_0xfc61('0x17')](util[_0xfc61('0x10')]('[%s][queues][hangup]',_0x14cf13[_0xfc61('0x3')]),_0x14cf13);if(queues[_0x14cf13[_0xfc61('0x3')]]['queuecallerleaveAt']){if(!queues[_0x14cf13[_0xfc61('0x3')]][_0xfc61('0x18')]&&!queues[_0x14cf13['uniqueid']][_0xfc61('0x19')]){queues[_0x14cf13[_0xfc61('0x3')]][_0xfc61('0x1a')]=!![];queues[_0x14cf13[_0xfc61('0x3')]]['queuecallercompleteAt']=utils[_0xfc61('0x1b')]();queues[_0x14cf13[_0xfc61('0x3')]][_0xfc61('0x9')]=_0xfc61('0x1c');}utils[_0xfc61('0x2')](util[_0xfc61('0x10')](_0xfc61('0x1d'),_0x14cf13[_0xfc61('0x3')],queues[_0x14cf13['uniqueid']][_0xfc61('0x1e')],queues[_0x14cf13[_0xfc61('0x3')]][_0xfc61('0x9')]));writeDB(queues[_0x14cf13[_0xfc61('0x3')]]);}else if(queues[_0x14cf13[_0xfc61('0x3')]][_0xfc61('0xe')]){utils['info'](util['format'](_0xfc61('0x1f'),_0x14cf13['uniqueid'],queues[_0x14cf13[_0xfc61('0x3')]][_0xfc61('0x1e')],queues[_0x14cf13['uniqueid']][_0xfc61('0xe')]));queues[queues[_0x14cf13[_0xfc61('0x3')]][_0xfc61('0xe')]]=queues[_0x14cf13[_0xfc61('0x3')]];queues[queues[_0x14cf13['uniqueid']]['transfereduniqueid']][_0xfc61('0x20')]=0x2;delete queues[_0x14cf13[_0xfc61('0x3')]];}}}catch(_0x4b1da7){utils['error'](util['format'](_0xfc61('0x21'),_0x14cf13['uniqueid']),_0x4b1da7);}};exports[_0xfc61('0x22')]=function(_0x516e13){try{utils[_0xfc61('0x17')](util['format'](_0xfc61('0x23'),_0x516e13[_0xfc61('0x3')]),_0x516e13);if(!_[_0xfc61('0x24')](_0x516e13['variable'][_0xfc61('0x25')])&&_0x516e13[_0xfc61('0x26')][_0xfc61('0x27')]()!==_0xfc61('0x28')){if(!_[_0xfc61('0x24')](queues[_0x516e13['uniqueid']])){queues[_0x516e13[_0xfc61('0x3')]][_0xfc61('0x18')]=![];queues[_0x516e13[_0xfc61('0x3')]][_0xfc61('0x29')]=null;queues[_0x516e13[_0xfc61('0x3')]]['queuecallerexit']=!![];queues[_0x516e13[_0xfc61('0x3')]]['queuecallerexitAt']=utils[_0xfc61('0x1b')]();queues[_0x516e13['uniqueid']][_0xfc61('0x9')]=_0x516e13['value']['toUpperCase']();utils[_0xfc61('0x2')](util['format'](_0xfc61('0x2a'),_0x516e13['uniqueid'],queues[_0x516e13[_0xfc61('0x3')]][_0xfc61('0x1e')],_0x516e13[_0xfc61('0x26')],queues[_0x516e13['uniqueid']][_0xfc61('0x9')]));writeDB(queues[_0x516e13[_0xfc61('0x3')]]);}}else if(!_[_0xfc61('0x24')](_0x516e13['variable'][_0xfc61('0x2b')])){if(!_['isNil'](queues[_0x516e13[_0xfc61('0x3')]])&&!queues[_0x516e13[_0xfc61('0x3')]][_0xfc61('0x18')]){queues[_0x516e13[_0xfc61('0x3')]][_0xfc61('0x18')]=![];queues[_0x516e13[_0xfc61('0x3')]][_0xfc61('0x29')]=null;queues[_0x516e13[_0xfc61('0x3')]][_0xfc61('0x19')]=!![];queues[_0x516e13[_0xfc61('0x3')]][_0xfc61('0x2c')]=utils[_0xfc61('0x1b')]();queues[_0x516e13[_0xfc61('0x3')]][_0xfc61('0x9')]='EXITWITHKEY';utils[_0xfc61('0x2')](util[_0xfc61('0x10')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x516e13[_0xfc61('0x3')],queues[_0x516e13['uniqueid']][_0xfc61('0x1e')],_0x516e13['value'],queues[_0x516e13['uniqueid']][_0xfc61('0x9')]));}}}catch(_0x325fd3){utils[_0xfc61('0x14')](util['format'](_0xfc61('0x23'),_0x516e13[_0xfc61('0x3')]),_0x325fd3);}};exports[_0xfc61('0x18')]=function(_0x44c014){try{if(!_[_0xfc61('0x24')](queues[_0x44c014[_0xfc61('0x3')]])){utils[_0xfc61('0x17')](util[_0xfc61('0x10')]('[%s][queues][queuecallerabandon]',_0x44c014['uniqueid']),_0x44c014);queues[_0x44c014[_0xfc61('0x3')]]['queuecallerexit']=![];queues[_0x44c014[_0xfc61('0x3')]][_0xfc61('0x2c')]=null;queues[_0x44c014['uniqueid']][_0xfc61('0x18')]=!![];queues[_0x44c014['uniqueid']][_0xfc61('0x29')]=utils[_0xfc61('0x1b')]();queues[_0x44c014[_0xfc61('0x3')]][_0xfc61('0x9')]=_0xfc61('0x2d');utils[_0xfc61('0x2')](util[_0xfc61('0x10')](_0xfc61('0x2e'),_0x44c014[_0xfc61('0x3')],queues[_0x44c014[_0xfc61('0x3')]]['name'],queues[_0x44c014[_0xfc61('0x3')]][_0xfc61('0x9')]));}}catch(_0x4c53c7){utils[_0xfc61('0x14')](util['format'](_0xfc61('0x2f'),_0x44c014['uniqueid']),_0x4c53c7);}};exports['queuecallerleave']=function(_0x482499){try{if(!_['isNil'](queues[_0x482499[_0xfc61('0x3')]])){utils['debug'](util['format']('[%s][queues][queuecallerleave]',_0x482499[_0xfc61('0x3')]),_0x482499);utils[_0xfc61('0x2')](util[_0xfc61('0x10')](_0xfc61('0x30'),_0x482499['uniqueid'],queues[_0x482499[_0xfc61('0x3')]]['name'],_0x482499[_0xfc61('0x31')],_0x482499['connectedlinename']));queues[_0x482499['uniqueid']]['queuecallerleave']=!![];queues[_0x482499[_0xfc61('0x3')]][_0xfc61('0x32')]=utils[_0xfc61('0x1b')]();queues[_0x482499[_0xfc61('0x3')]][_0xfc61('0x33')]=utils[_0xfc61('0x34')](queues[_0x482499[_0xfc61('0x3')]][_0xfc61('0x32')],queues[_0x482499[_0xfc61('0x3')]]['queuecallerjoinAt']);queues[_0x482499[_0xfc61('0x3')]][_0xfc61('0x12')]=_0x482499['position'];queues[_0x482499[_0xfc61('0x3')]][_0xfc61('0x35')]=_0x482499[_0xfc61('0x35')];queues[_0x482499[_0xfc61('0x3')]][_0xfc61('0x31')]=_0x482499[_0xfc61('0x31')];queues[_0x482499[_0xfc61('0x3')]]['connectedlinename']=_0x482499['connectedlinename'];}}catch(_0x2855b7){utils[_0xfc61('0x14')](util[_0xfc61('0x10')](_0xfc61('0x36'),_0x482499[_0xfc61('0x3')]),_0x2855b7);}};exports[_0xfc61('0x37')]=function(_0x3b728e){try{if(!_['isNil'](queues[_0x3b728e[_0xfc61('0x3')]])){utils[_0xfc61('0x17')](util[_0xfc61('0x10')](_0xfc61('0x38'),_0x3b728e[_0xfc61('0x3')]),_0x3b728e);utils[_0xfc61('0x2')](util['format'](_0xfc61('0x39'),_0x3b728e[_0xfc61('0x3')],queues[_0x3b728e[_0xfc61('0x3')]]['name'],_0x3b728e[_0xfc61('0x3a')],_0x3b728e[_0xfc61('0x3b')]));queues[_0x3b728e['uniqueid']][_0xfc61('0x18')]=![];queues[_0x3b728e[_0xfc61('0x3')]][_0xfc61('0x18')]=![];queues[_0x3b728e['uniqueid']][_0xfc61('0x29')]=null;queues[_0x3b728e[_0xfc61('0x3')]][_0xfc61('0x19')]=![];queues[_0x3b728e[_0xfc61('0x3')]][_0xfc61('0x9')]=null;queues[_0x3b728e[_0xfc61('0x3')]][_0xfc61('0x2c')]=null;queues[_0x3b728e[_0xfc61('0x3')]][_0xfc61('0x3c')]=!![];queues[_0x3b728e['uniqueid']][_0xfc61('0x8')]=_0x3b728e[_0xfc61('0x3b')];queues[_0x3b728e['uniqueid']][_0xfc61('0x6')]=_0x3b728e[_0xfc61('0x3a')];}}catch(_0x4a7171){utils[_0xfc61('0x14')](util[_0xfc61('0x10')](_0xfc61('0x38'),_0x3b728e[_0xfc61('0x3')]),_0x4a7171);}};exports[_0xfc61('0x3d')]=function(_0x548332){try{if(!_[_0xfc61('0x24')](queues[_0x548332['uniqueid']])){if(queues[_0x548332[_0xfc61('0x3')]][_0xfc61('0x32')]){utils[_0xfc61('0x17')](util[_0xfc61('0x10')]('[%s][queues][agentcomplete]',_0x548332['uniqueid']),_0x548332);queues[_0x548332[_0xfc61('0x3')]][_0xfc61('0x18')]=![];queues[_0x548332[_0xfc61('0x3')]][_0xfc61('0x18')]=![];queues[_0x548332[_0xfc61('0x3')]]['queuecallerabandonAt']=null;queues[_0x548332[_0xfc61('0x3')]][_0xfc61('0x19')]=![];queues[_0x548332[_0xfc61('0x3')]][_0xfc61('0x2c')]=null;queues[_0x548332[_0xfc61('0x3')]][_0xfc61('0x3c')]=!![];queues[_0x548332[_0xfc61('0x3')]][_0xfc61('0x6')]=_0x548332[_0xfc61('0x3a')];queues[_0x548332[_0xfc61('0x3')]][_0xfc61('0x1a')]=!![];queues[_0x548332[_0xfc61('0x3')]][_0xfc61('0x3e')]=utils[_0xfc61('0x1b')]();if(_0x548332['reason']==_0xfc61('0x3f')){if(!queues[_0x548332[_0xfc61('0x3')]]['transfer']){queues[_0x548332['uniqueid']][_0xfc61('0x9')]='TRANSFER';}}else{queues[_0x548332[_0xfc61('0x3')]][_0xfc61('0x9')]=_0xfc61('0x40')+_0x548332[_0xfc61('0x41')][_0xfc61('0x27')]();}utils['info'](util[_0xfc61('0x10')](_0xfc61('0x42'),_0x548332[_0xfc61('0x3')],queues[_0x548332[_0xfc61('0x3')]][_0xfc61('0x1e')],_0x548332[_0xfc61('0x3a')],queues[_0x548332[_0xfc61('0x3')]][_0xfc61('0x9')]));writeDB(queues[_0x548332[_0xfc61('0x3')]]);}}}catch(_0x2540b7){utils[_0xfc61('0x14')](util['format'](_0xfc61('0x43'),_0x548332['uniqueid']),_0x2540b7);}};exports[_0xfc61('0x44')]=function(_0x397622){try{if(!_['isNil'](queues[_0x397622[_0xfc61('0x45')]])){utils['debug'](util['format'](_0xfc61('0x46'),_0x397622[_0xfc61('0x3')]),_0x397622);queues[_0x397622[_0xfc61('0x45')]][_0xfc61('0x3f')]=!![];queues[_0x397622[_0xfc61('0x45')]][_0xfc61('0x47')]=_0xfc61('0x48');queues[_0x397622[_0xfc61('0x45')]][_0xfc61('0x49')]=_0x397622['extension'];queues[_0x397622[_0xfc61('0x45')]][_0xfc61('0x4a')]=_0x397622[_0xfc61('0x45')];queues[_0x397622[_0xfc61('0x45')]][_0xfc61('0x9')]=_0xfc61('0x4b');utils['info'](util[_0xfc61('0x10')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x397622['uniqueid'],queues[_0x397622[_0xfc61('0x45')]][_0xfc61('0x1e')],_0x397622[_0xfc61('0x45')],_0x397622[_0xfc61('0x4c')]));}}catch(_0x14875e){utils['error'](util[_0xfc61('0x10')](_0xfc61('0x46'),_0x397622[_0xfc61('0x3')]),_0x14875e);}};exports['attendedtransfer']=function(_0x2c6b4c){try{utils[_0xfc61('0x17')](util[_0xfc61('0x10')](_0xfc61('0x4d'),_0x2c6b4c[_0xfc61('0x4e')]),_0x2c6b4c);if(_0x2c6b4c[_0xfc61('0x4e')]==_0x2c6b4c['origtransfererlinkedid']){if(!_[_0xfc61('0x24')](queues[_0x2c6b4c[_0xfc61('0x4f')]])){utils['info'](util[_0xfc61('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x2c6b4c['origtransfereruniqueid'],queues[_0x2c6b4c[_0xfc61('0x4f')]][_0xfc61('0x1e')],_0x2c6b4c['origtransfererexten']));queues[_0x2c6b4c[_0xfc61('0x4f')]]['transfer']=!![];queues[_0x2c6b4c[_0xfc61('0x4f')]]['transfertype']=_0xfc61('0x50');queues[_0x2c6b4c[_0xfc61('0x4f')]]['transferexten']=_0x2c6b4c['origtransfererexten'];queues[_0x2c6b4c[_0xfc61('0x4f')]][_0xfc61('0x4a')]=_0x2c6b4c[_0xfc61('0x4e')];queues[_0x2c6b4c['secondtransfererlinkedid']][_0xfc61('0x9')]=_0xfc61('0x51');}if(!_[_0xfc61('0x24')](queues[_0x2c6b4c['origtransfererlinkedid']])){if(_0x2c6b4c[_0xfc61('0x52')]&&queues[_0x2c6b4c['transfereelinkedid']]){queues[_0x2c6b4c[_0xfc61('0x52')]][_0xfc61('0x20')]=0x1;queues[_0x2c6b4c[_0xfc61('0x45')]]=_[_0xfc61('0x53')](queues[_0x2c6b4c[_0xfc61('0x52')]]);queues[_0x2c6b4c[_0xfc61('0x45')]][_0xfc61('0xe')]=_0x2c6b4c['transfertargetuniqueid'];queues[_0x2c6b4c[_0xfc61('0x45')]][_0xfc61('0x20')]=0x2;queues[_0x2c6b4c[_0xfc61('0x45')]][_0xfc61('0x7')]=queues[_0x2c6b4c[_0xfc61('0x4f')]][_0xfc61('0x7')];queues[_0x2c6b4c[_0xfc61('0x45')]][_0xfc61('0x54')]=queues[_0x2c6b4c[_0xfc61('0x4f')]]['calleridname'];queues[_0x2c6b4c[_0xfc61('0x45')]]['queuecallerjoinAt']=utils[_0xfc61('0x1b')]();queues[_0x2c6b4c[_0xfc61('0x45')]][_0xfc61('0x32')]=utils[_0xfc61('0x1b')]();queues[_0x2c6b4c['transfereeuniqueid']][_0xfc61('0x33')]=0x0;queues[_0x2c6b4c['transfereeuniqueid']][_0xfc61('0x55')]=0x0;utils[_0xfc61('0x2')](util['format'](_0xfc61('0x56'),_0x2c6b4c[_0xfc61('0x4e')],queues[_0x2c6b4c['transfereeuniqueid']]['name'],queues[_0x2c6b4c[_0xfc61('0x45')]][_0xfc61('0x7')],queues[_0x2c6b4c[_0xfc61('0x45')]][_0xfc61('0x54')]));}else{utils[_0xfc61('0x2')](util[_0xfc61('0x10')](_0xfc61('0x57'),_0x2c6b4c['origtransfereruniqueid'],queues[_0x2c6b4c[_0xfc61('0x58')]]['name'],_0x2c6b4c[_0xfc61('0x4f')]));queues[_0x2c6b4c[_0xfc61('0x58')]][_0xfc61('0xe')]=_0x2c6b4c[_0xfc61('0x4f')];}}}else if(_0x2c6b4c[_0xfc61('0x59')]==_0x2c6b4c[_0xfc61('0x4f')]){if(!_[_0xfc61('0x24')](queues[_0x2c6b4c[_0xfc61('0x58')]])){utils[_0xfc61('0x2')](util[_0xfc61('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x2c6b4c['origtransfereruniqueid'],queues[_0x2c6b4c[_0xfc61('0x58')]][_0xfc61('0x1e')],_0x2c6b4c[_0xfc61('0x59')],_0x2c6b4c[_0xfc61('0x5a')]));queues[_0x2c6b4c[_0xfc61('0x58')]]['transfer']=!![];queues[_0x2c6b4c[_0xfc61('0x58')]][_0xfc61('0x47')]=_0xfc61('0x50');queues[_0x2c6b4c[_0xfc61('0x58')]][_0xfc61('0x49')]=_0x2c6b4c[_0xfc61('0x5a')];queues[_0x2c6b4c[_0xfc61('0x58')]]['transferuniqueid']=_0x2c6b4c['secondtransfereruniqueid'];queues[_0x2c6b4c[_0xfc61('0x58')]][_0xfc61('0x9')]=_0xfc61('0x51');}if(!_['isNil'](queues[_0x2c6b4c[_0xfc61('0x4f')]])){if(_0x2c6b4c[_0xfc61('0x5b')]&&queues[_0x2c6b4c[_0xfc61('0x5b')]]){queues[_0x2c6b4c[_0xfc61('0x5b')]][_0xfc61('0x20')]=0x1;queues[_0x2c6b4c[_0xfc61('0x5c')]]=_['clone'](queues[_0x2c6b4c['transfertargetlinkedid']]);queues[_0x2c6b4c['transfertargetuniqueid']][_0xfc61('0xe')]=_0x2c6b4c[_0xfc61('0x5c')];queues[_0x2c6b4c[_0xfc61('0x5c')]]['queuecallerenterreason']=0x2;queues[_0x2c6b4c[_0xfc61('0x5c')]][_0xfc61('0x7')]=queues[_0x2c6b4c[_0xfc61('0x58')]][_0xfc61('0x7')];queues[_0x2c6b4c[_0xfc61('0x5c')]][_0xfc61('0x54')]=queues[_0x2c6b4c['origtransfererlinkedid']][_0xfc61('0x54')];queues[_0x2c6b4c[_0xfc61('0x5c')]]['queuecallerjoinAt']=utils[_0xfc61('0x1b')]();queues[_0x2c6b4c[_0xfc61('0x5c')]][_0xfc61('0x32')]=utils[_0xfc61('0x1b')]();queues[_0x2c6b4c[_0xfc61('0x5c')]][_0xfc61('0x33')]=0x0;queues[_0x2c6b4c[_0xfc61('0x5c')]][_0xfc61('0x55')]=0x0;utils[_0xfc61('0x2')](util[_0xfc61('0x10')](_0xfc61('0x5d'),_0x2c6b4c['origtransfereruniqueid'],queues[_0x2c6b4c[_0xfc61('0x5c')]][_0xfc61('0x1e')],queues[_0x2c6b4c[_0xfc61('0x5c')]]['transfereduniqueid'],queues[_0x2c6b4c['transfertargetuniqueid']]['calleridnum'],queues[_0x2c6b4c['transfertargetuniqueid']][_0xfc61('0x54')]));}else{utils[_0xfc61('0x2')](util[_0xfc61('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x2c6b4c['origtransfereruniqueid'],queues[_0x2c6b4c[_0xfc61('0x4f')]]['name'],_0x2c6b4c[_0xfc61('0x58')]));queues[_0x2c6b4c[_0xfc61('0x4f')]][_0xfc61('0xe')]=_0x2c6b4c[_0xfc61('0x58')];}}}}catch(_0x418179){utils[_0xfc61('0x14')](util[_0xfc61('0x10')](_0xfc61('0x4d'),_0x2c6b4c[_0xfc61('0x4e')]),_0x418179);}};exports['musiconholdstart']=function(_0x3a5170){try{if(!_[_0xfc61('0x24')](queues[_0x3a5170[_0xfc61('0x3')]])){utils['debug'](util[_0xfc61('0x10')](_0xfc61('0x5e'),_0x3a5170['uniqueid']),_0x3a5170);queues[_0x3a5170[_0xfc61('0x3')]][_0xfc61('0x5f')]=utils['now']();utils[_0xfc61('0x2')](util[_0xfc61('0x10')](_0xfc61('0x60'),_0x3a5170[_0xfc61('0x3')],queues[_0x3a5170[_0xfc61('0x3')]][_0xfc61('0x1e')],queues[_0x3a5170[_0xfc61('0x3')]][_0xfc61('0x5f')]));}}catch(_0x2b8a6e){utils[_0xfc61('0x14')](util[_0xfc61('0x10')]('[%s][queues][musiconholdstart]',_0x3a5170[_0xfc61('0x3')]),_0x2b8a6e);}};exports[_0xfc61('0x61')]=function(_0xb67f7e){try{if(!_[_0xfc61('0x24')](queues[_0xb67f7e['uniqueid']])){if(!_['isNil'](queues[_0xb67f7e['uniqueid']]['musiconholdstartAt'])){utils[_0xfc61('0x17')](util[_0xfc61('0x10')](_0xfc61('0x62'),_0xb67f7e[_0xfc61('0x3')]),_0xb67f7e);queues[_0xb67f7e[_0xfc61('0x3')]]['mohtime']+=utils['diffTime'](utils[_0xfc61('0x1b')](),queues[_0xb67f7e[_0xfc61('0x3')]]['musiconholdstartAt']);utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0xb67f7e[_0xfc61('0x3')],queues[_0xb67f7e['uniqueid']][_0xfc61('0x1e')],queues[_0xb67f7e[_0xfc61('0x3')]][_0xfc61('0x55')]));delete queues[_0xb67f7e['uniqueid']][_0xfc61('0x5f')];}}}catch(_0x15dddf){utils[_0xfc61('0x14')](util[_0xfc61('0x10')](_0xfc61('0x62'),_0xb67f7e[_0xfc61('0x3')]),_0x15dddf);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index ac04e36..fa9c04c 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 _0xa6b5=['newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','error','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','calleridname','calleridnum','connectedlinenum','connectedlinename','outbound','clone','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','UserId','CreateVoiceRecording','request','newchannel','debug','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','[%s][recordings][newchannel]'];(function(_0x1a7f79,_0x28fe2d){var _0x1760ab=function(_0x4ed576){while(--_0x4ed576){_0x1a7f79['push'](_0x1a7f79['shift']());}};_0x1760ab(++_0x28fe2d);}(_0xa6b5,0x94));var _0x5a6b=function(_0x2adedb,_0x13074c){_0x2adedb=_0x2adedb-0x0;var _0x3798aa=_0xa6b5[_0x2adedb];return _0x3798aa;};'use strict';var _=require(_0x5a6b('0x0'));var util=require(_0x5a6b('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x4df035){utils['info'](util[_0x5a6b('0x2')](_0x5a6b('0x3'),_0x4df035[_0x5a6b('0x4')]));if(_0x4df035[_0x5a6b('0x5')]){utils[_0x5a6b('0x6')](_0x4df035[_0x5a6b('0x5')])[_0x5a6b('0x7')](function(_0x32a7ff){if(_0x32a7ff){_0x4df035[_0x5a6b('0x8')]=_0x32a7ff['name'];_0x4df035[_0x5a6b('0x9')]=_0x32a7ff['id'];}utils['request'](_0x5a6b('0xa'),_0x4df035);});}else{utils[_0x5a6b('0xb')](_0x5a6b('0xa'),_0x4df035);}}exports[_0x5a6b('0xc')]=function(_0x3633e9){try{utils[_0x5a6b('0xd')](util[_0x5a6b('0x2')]('[%s][recordings][newchannel]',_0x3633e9[_0x5a6b('0x4')]),_0x3633e9);if(_0x3633e9[_0x5a6b('0x4')]==_0x3633e9['linkedid']){utils[_0x5a6b('0xe')](util[_0x5a6b('0x2')](_0x5a6b('0xf'),_0x3633e9[_0x5a6b('0x4')],_0x3633e9[_0x5a6b('0x10')],_0x3633e9['exten']));recordings[_0x3633e9[_0x5a6b('0x4')]]={'uniqueid':_0x3633e9[_0x5a6b('0x4')],'accountcode':_0x3633e9[_0x5a6b('0x5')],'exten':_0x3633e9[_0x5a6b('0x11')],'context':_0x3633e9[_0x5a6b('0x10')],'channel':_0x3633e9[_0x5a6b('0x12')],'monitors':[]};}}catch(_0x538f87){utils['error'](util[_0x5a6b('0x2')](_0x5a6b('0x13'),_0x3633e9[_0x5a6b('0x4')]),_0x538f87);}};exports[_0x5a6b('0x14')]=function(_0x273b96){try{utils[_0x5a6b('0xd')](util['format'](_0x5a6b('0x15'),_0x273b96['uniqueid']),_0x273b96);if(!_[_0x5a6b('0x16')](recordings[_0x273b96[_0x5a6b('0x4')]])&&_0x273b96[_0x5a6b('0x17')]==0x6){utils[_0x5a6b('0xe')](util[_0x5a6b('0x2')](_0x5a6b('0x18'),_0x273b96[_0x5a6b('0x4')],_0x273b96['context'],_0x273b96[_0x5a6b('0x12')]));}else if(!_[_0x5a6b('0x16')](recordings[_0x273b96[_0x5a6b('0x19')]])&&_0x273b96[_0x5a6b('0x17')]==0x6&&_0x273b96[_0x5a6b('0x10')]!='transfer'){utils['info'](util[_0x5a6b('0x2')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x273b96[_0x5a6b('0x4')],_0x273b96[_0x5a6b('0x19')],_0x273b96[_0x5a6b('0x10')],_0x273b96[_0x5a6b('0x12')]));recordings[_0x273b96[_0x5a6b('0x19')]][_0x5a6b('0x5')]=_0x273b96[_0x5a6b('0x5')];}}catch(_0x4cfea2){utils[_0x5a6b('0x1a')](util['format']('[%s][recordings][newstate]',_0x273b96['uniqueid']),_0x4cfea2);}};exports['varset']=function(_0x332a76){try{if(!_[_0x5a6b('0x16')](_0x332a76[_0x5a6b('0x1b')])&&!_[_0x5a6b('0x16')](_0x332a76[_0x5a6b('0x1b')][_0x5a6b('0x1c')])){utils[_0x5a6b('0xd')](util[_0x5a6b('0x2')](_0x5a6b('0x1d'),_0x332a76[_0x5a6b('0x4')]),_0x332a76);utils[_0x5a6b('0xe')](util['format'](_0x5a6b('0x1e'),_0x332a76[_0x5a6b('0x4')],_0x332a76['variable'],_0x332a76[_0x5a6b('0x1f')]));if(_[_0x5a6b('0x20')](_0x332a76[_0x5a6b('0x1f')],'.wav49')){_0x332a76['value']=_0x332a76[_0x5a6b('0x1f')]['replace']('.wav49',_0x5a6b('0x21'));}if(recordings[_0x332a76[_0x5a6b('0x19')]]){var _0x15dfb6=_[_0x5a6b('0x22')](recordings[_0x332a76[_0x5a6b('0x19')]][_0x5a6b('0x23')],{'value':_0x332a76['value']});if(_[_0x5a6b('0x16')](_0x15dfb6)){recordings[_0x332a76[_0x5a6b('0x19')]][_0x5a6b('0x23')][_0x5a6b('0x24')]({'value':_0x332a76[_0x5a6b('0x1f')]});}}}}catch(_0x3014bd){utils[_0x5a6b('0x1a')](util[_0x5a6b('0x2')]('[%s][recordings][varset]',_0x332a76['uniqueid']),_0x3014bd);}};exports[_0x5a6b('0x25')]=function(_0x65d5a4){try{if(!_[_0x5a6b('0x16')](recordings[_0x65d5a4[_0x5a6b('0x4')]])){utils['debug'](util[_0x5a6b('0x2')](_0x5a6b('0x26'),_0x65d5a4[_0x5a6b('0x4')]),_0x65d5a4);utils[_0x5a6b('0xe')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x65d5a4[_0x5a6b('0x4')],_0x65d5a4['calleridnum'],_0x65d5a4[_0x5a6b('0x27')],_0x65d5a4['cause-txt']));recordings[_0x65d5a4['uniqueid']][_0x5a6b('0x28')]=_0x65d5a4[_0x5a6b('0x28')];recordings[_0x65d5a4[_0x5a6b('0x4')]][_0x5a6b('0x27')]=_0x65d5a4['calleridname'];recordings[_0x65d5a4[_0x5a6b('0x4')]][_0x5a6b('0x29')]=_0x65d5a4[_0x5a6b('0x29')];recordings[_0x65d5a4['uniqueid']]['connectedlinename']=_0x65d5a4[_0x5a6b('0x2a')];if(recordings[_0x65d5a4[_0x5a6b('0x4')]]['type']==_0x5a6b('0x2b')&&recordings[_0x65d5a4[_0x5a6b('0x4')]][_0x5a6b('0x5')]){recordings[_0x65d5a4[_0x5a6b('0x4')]][_0x5a6b('0x29')]=recordings[_0x65d5a4[_0x5a6b('0x4')]][_0x5a6b('0x5')];recordings[_0x65d5a4[_0x5a6b('0x4')]]['connectedlinename']='';}recordings[_0x65d5a4[_0x5a6b('0x4')]][_0x5a6b('0x23')]['forEach'](function(_0xcf1050){var _0x233ed9=_[_0x5a6b('0x2c')](recordings[_0x65d5a4[_0x5a6b('0x4')]]);_0x233ed9[_0x5a6b('0x1f')]=_0xcf1050['value'];writeDB(_0x233ed9);});delete recordings[_0x65d5a4['uniqueid']];}}catch(_0x203281){utils['error'](util[_0x5a6b('0x2')](_0x5a6b('0x26'),_0x65d5a4[_0x5a6b('0x4')]),_0x203281);}};exports['newexten']=function(_0x2fa222){try{if(!_['isNil'](recordings[_0x2fa222[_0x5a6b('0x4')]])){utils[_0x5a6b('0xd')](util['format']('[%s][recordings][newexten]',_0x2fa222[_0x5a6b('0x4')]),_0x2fa222);utils[_0x5a6b('0xe')](util[_0x5a6b('0x2')](_0x5a6b('0x2d'),_0x2fa222['uniqueid'],_0x2fa222[_0x5a6b('0x2e')],_0x2fa222[_0x5a6b('0x2f')]));if(_0x2fa222[_0x5a6b('0x2e')][_0x5a6b('0x30')]()==_0x5a6b('0x31')&&_['startsWith'](_0x2fa222[_0x5a6b('0x2f')]['toLowerCase'](),_0x5a6b('0x32'))){var _0x5b0a39=_0x2fa222[_0x5a6b('0x2f')]['split']('=');var _0x23cb8c=_0x5b0a39[0x0][_0x5a6b('0x33')](_0x5b0a39[0x0]['lastIndexOf']('(')+0x1,_0x5b0a39[0x0][_0x5a6b('0x34')](')'));var _0x2e103a=_0x5b0a39[0x1];recordings[_0x2fa222[_0x5a6b('0x4')]][_0x23cb8c]=_0x2e103a;}}}catch(_0x48b1d2){utils[_0x5a6b('0x1a')](util[_0x5a6b('0x2')]('[%s][recordings][newexten]',_0x2fa222[_0x5a6b('0x4')]),_0x48b1d2);}};exports[_0x5a6b('0x35')]=function(_0x38f3bd){try{if(!_[_0x5a6b('0x16')](recordings[_0x38f3bd[_0x5a6b('0x4')]])){utils['debug'](util[_0x5a6b('0x2')](_0x5a6b('0x36'),_0x38f3bd[_0x5a6b('0x4')]),_0x38f3bd);utils['info'](util[_0x5a6b('0x2')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x38f3bd[_0x5a6b('0x4')],_0x38f3bd[_0x5a6b('0x37')]));recordings[_0x38f3bd[_0x5a6b('0x4')]]['queue']=_0x38f3bd[_0x5a6b('0x37')];}}catch(_0x2b3cd8){utils['error'](util[_0x5a6b('0x2')](_0x5a6b('0x36'),_0x38f3bd[_0x5a6b('0x4')]),_0x2b3cd8);}}; \ No newline at end of file +var _0xc86c=['channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','isNil'];(function(_0x2fde38,_0x67a9){var _0x58dbd0=function(_0xa54424){while(--_0xa54424){_0x2fde38['push'](_0x2fde38['shift']());}};_0x58dbd0(++_0x67a9);}(_0xc86c,0x1b0));var _0xcc86=function(_0x5a9c07,_0x5d8f85){_0x5a9c07=_0x5a9c07-0x0;var _0x38db24=_0xc86c[_0x5a9c07];return _0x38db24;};'use strict';var _=require(_0xcc86('0x0'));var util=require(_0xcc86('0x1'));var utils=require(_0xcc86('0x2'));var recordings={};function writeDB(_0x4cc959){utils[_0xcc86('0x3')](util[_0xcc86('0x4')](_0xcc86('0x5'),_0x4cc959[_0xcc86('0x6')]));if(_0x4cc959[_0xcc86('0x7')]){utils[_0xcc86('0x8')](_0x4cc959[_0xcc86('0x7')])['then'](function(_0x3e320a){if(_0x3e320a){_0x4cc959['membername']=_0x3e320a['name'];_0x4cc959[_0xcc86('0x9')]=_0x3e320a['id'];}utils[_0xcc86('0xa')](_0xcc86('0xb'),_0x4cc959);});}else{utils[_0xcc86('0xa')](_0xcc86('0xb'),_0x4cc959);}}exports[_0xcc86('0xc')]=function(_0x29d35a){try{utils[_0xcc86('0xd')](util[_0xcc86('0x4')](_0xcc86('0xe'),_0x29d35a['uniqueid']),_0x29d35a);if(_0x29d35a[_0xcc86('0x6')]==_0x29d35a[_0xcc86('0xf')]){utils[_0xcc86('0x3')](util[_0xcc86('0x4')](_0xcc86('0x10'),_0x29d35a[_0xcc86('0x6')],_0x29d35a[_0xcc86('0x11')],_0x29d35a[_0xcc86('0x12')]));recordings[_0x29d35a['uniqueid']]={'uniqueid':_0x29d35a[_0xcc86('0x6')],'accountcode':_0x29d35a[_0xcc86('0x7')],'exten':_0x29d35a[_0xcc86('0x12')],'context':_0x29d35a[_0xcc86('0x11')],'channel':_0x29d35a[_0xcc86('0x13')],'monitors':[]};}}catch(_0xf80e18){utils['error'](util['format'](_0xcc86('0xe'),_0x29d35a[_0xcc86('0x6')]),_0xf80e18);}};exports[_0xcc86('0x14')]=function(_0x1ff311){try{utils[_0xcc86('0xd')](util[_0xcc86('0x4')](_0xcc86('0x15'),_0x1ff311[_0xcc86('0x6')]),_0x1ff311);if(!_[_0xcc86('0x16')](recordings[_0x1ff311[_0xcc86('0x6')]])&&_0x1ff311[_0xcc86('0x17')]==0x6){utils['info'](util[_0xcc86('0x4')](_0xcc86('0x18'),_0x1ff311[_0xcc86('0x6')],_0x1ff311[_0xcc86('0x11')],_0x1ff311[_0xcc86('0x13')]));}else if(!_[_0xcc86('0x16')](recordings[_0x1ff311[_0xcc86('0xf')]])&&_0x1ff311[_0xcc86('0x17')]==0x6&&_0x1ff311[_0xcc86('0x11')]!=_0xcc86('0x19')){utils[_0xcc86('0x3')](util[_0xcc86('0x4')](_0xcc86('0x1a'),_0x1ff311[_0xcc86('0x6')],_0x1ff311[_0xcc86('0xf')],_0x1ff311['context'],_0x1ff311['channel']));recordings[_0x1ff311['linkedid']]['accountcode']=_0x1ff311[_0xcc86('0x7')];}}catch(_0x255359){utils[_0xcc86('0x1b')](util[_0xcc86('0x4')](_0xcc86('0x15'),_0x1ff311[_0xcc86('0x6')]),_0x255359);}};exports[_0xcc86('0x1c')]=function(_0x25cc13){try{if(!_[_0xcc86('0x16')](_0x25cc13[_0xcc86('0x1d')])&&!_[_0xcc86('0x16')](_0x25cc13[_0xcc86('0x1d')][_0xcc86('0x1e')])){utils['debug'](util[_0xcc86('0x4')](_0xcc86('0x1f'),_0x25cc13['uniqueid']),_0x25cc13);utils[_0xcc86('0x3')](util[_0xcc86('0x4')](_0xcc86('0x20'),_0x25cc13[_0xcc86('0x6')],_0x25cc13['variable'],_0x25cc13[_0xcc86('0x21')]));if(_[_0xcc86('0x22')](_0x25cc13[_0xcc86('0x21')],_0xcc86('0x23'))){_0x25cc13['value']=_0x25cc13['value']['replace'](_0xcc86('0x23'),'.WAV');}if(recordings[_0x25cc13['linkedid']]){var _0x2cd94a=_[_0xcc86('0x24')](recordings[_0x25cc13[_0xcc86('0xf')]][_0xcc86('0x25')],{'value':_0x25cc13[_0xcc86('0x21')]});if(_[_0xcc86('0x16')](_0x2cd94a)){recordings[_0x25cc13[_0xcc86('0xf')]][_0xcc86('0x25')][_0xcc86('0x26')]({'value':_0x25cc13[_0xcc86('0x21')]});}}}}catch(_0x5c6e84){utils[_0xcc86('0x1b')](util['format'](_0xcc86('0x1f'),_0x25cc13[_0xcc86('0x6')]),_0x5c6e84);}};exports[_0xcc86('0x27')]=function(_0x576b61){try{if(!_[_0xcc86('0x16')](recordings[_0x576b61[_0xcc86('0x6')]])){utils[_0xcc86('0xd')](util[_0xcc86('0x4')](_0xcc86('0x28'),_0x576b61[_0xcc86('0x6')]),_0x576b61);utils['info'](util[_0xcc86('0x4')](_0xcc86('0x29'),_0x576b61[_0xcc86('0x6')],_0x576b61['calleridnum'],_0x576b61[_0xcc86('0x2a')],_0x576b61[_0xcc86('0x2b')]));recordings[_0x576b61[_0xcc86('0x6')]][_0xcc86('0x2c')]=_0x576b61[_0xcc86('0x2c')];recordings[_0x576b61[_0xcc86('0x6')]][_0xcc86('0x2a')]=_0x576b61[_0xcc86('0x2a')];recordings[_0x576b61[_0xcc86('0x6')]][_0xcc86('0x2d')]=_0x576b61['connectedlinenum'];recordings[_0x576b61[_0xcc86('0x6')]][_0xcc86('0x2e')]=_0x576b61[_0xcc86('0x2e')];if(recordings[_0x576b61[_0xcc86('0x6')]]['type']==_0xcc86('0x2f')&&recordings[_0x576b61['uniqueid']][_0xcc86('0x7')]){recordings[_0x576b61[_0xcc86('0x6')]][_0xcc86('0x2d')]=recordings[_0x576b61[_0xcc86('0x6')]]['accountcode'];recordings[_0x576b61[_0xcc86('0x6')]][_0xcc86('0x2e')]='';}recordings[_0x576b61['uniqueid']][_0xcc86('0x25')][_0xcc86('0x30')](function(_0x276729){var _0x5784c7=_[_0xcc86('0x31')](recordings[_0x576b61[_0xcc86('0x6')]]);_0x5784c7['value']=_0x276729[_0xcc86('0x21')];writeDB(_0x5784c7);});delete recordings[_0x576b61[_0xcc86('0x6')]];}}catch(_0x1b1519){utils[_0xcc86('0x1b')](util[_0xcc86('0x4')](_0xcc86('0x28'),_0x576b61['uniqueid']),_0x1b1519);}};exports[_0xcc86('0x32')]=function(_0x279ab7){try{if(!_[_0xcc86('0x16')](recordings[_0x279ab7['uniqueid']])){utils[_0xcc86('0xd')](util['format'](_0xcc86('0x33'),_0x279ab7[_0xcc86('0x6')]),_0x279ab7);utils[_0xcc86('0x3')](util[_0xcc86('0x4')](_0xcc86('0x34'),_0x279ab7[_0xcc86('0x6')],_0x279ab7['application'],_0x279ab7[_0xcc86('0x35')]));if(_0x279ab7[_0xcc86('0x36')][_0xcc86('0x37')]()==_0xcc86('0x38')&&_['startsWith'](_0x279ab7[_0xcc86('0x35')][_0xcc86('0x37')](),_0xcc86('0x39'))){var _0x3765eb=_0x279ab7['appdata'][_0xcc86('0x3a')]('=');var _0x46b35a=_0x3765eb[0x0][_0xcc86('0x3b')](_0x3765eb[0x0]['lastIndexOf']('(')+0x1,_0x3765eb[0x0][_0xcc86('0x3c')](')'));var _0x423970=_0x3765eb[0x1];recordings[_0x279ab7['uniqueid']][_0x46b35a]=_0x423970;}}}catch(_0x3ae381){utils[_0xcc86('0x1b')](util[_0xcc86('0x4')](_0xcc86('0x33'),_0x279ab7[_0xcc86('0x6')]),_0x3ae381);}};exports[_0xcc86('0x3d')]=function(_0x4ead81){try{if(!_['isNil'](recordings[_0x4ead81[_0xcc86('0x6')]])){utils[_0xcc86('0xd')](util[_0xcc86('0x4')](_0xcc86('0x3e'),_0x4ead81[_0xcc86('0x6')]),_0x4ead81);utils[_0xcc86('0x3')](util[_0xcc86('0x4')](_0xcc86('0x3f'),_0x4ead81[_0xcc86('0x6')],_0x4ead81[_0xcc86('0x40')]));recordings[_0x4ead81[_0xcc86('0x6')]]['queue']=_0x4ead81[_0xcc86('0x40')];}}catch(_0x1c630d){utils[_0xcc86('0x1b')](util[_0xcc86('0x4')](_0xcc86('0x3e'),_0x4ead81[_0xcc86('0x6')]),_0x1c630d);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 1ba5bc5..a2634b6 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 _0xcc1e=['transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','origtransfereruniqueid','uniqueid','type','request','blindtransfer','debug','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','blind','error','[%s][transfers][blindtransfer]','attendedtransfer','format','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetcalleridname'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcc1e,0xcc));var _0xecc1=function(_0x5efb02,_0x3f68e4){_0x5efb02=_0x5efb02-0x0;var _0x3f93bf=_0xcc1e[_0x5efb02];return _0x3f93bf;};'use strict';var _=require(_0xecc1('0x0'));var util=require(_0xecc1('0x1'));var utils=require(_0xecc1('0x2'));function writeDB(_0xe6eb4){utils['info'](util['format']('[%s][transfers][writeDB]\x20type:%s',_0xe6eb4['type']==='attended'?_0xe6eb4[_0xecc1('0x3')]:_0xe6eb4[_0xecc1('0x4')],_0xe6eb4[_0xecc1('0x5')]));utils[_0xecc1('0x6')]('CreateVoiceTransferReport',_0xe6eb4);}exports[_0xecc1('0x7')]=function(_0x2b2abe){try{utils[_0xecc1('0x8')](util['format']('[%s][transfers][blindtransfer]',_0x2b2abe[_0xecc1('0x4')]),_0x2b2abe);utils[_0xecc1('0x9')](util['format'](_0xecc1('0xa'),_0x2b2abe[_0xecc1('0x4')],_0x2b2abe[_0xecc1('0xb')],_0x2b2abe['transferercalleridname'],_0x2b2abe[_0xecc1('0xc')],_0x2b2abe['transfereecalleridname']));_0x2b2abe['type']=_0xecc1('0xd');writeDB(_0x2b2abe);}catch(_0x20aa4e){utils[_0xecc1('0xe')](util['format'](_0xecc1('0xf'),_0x2b2abe[_0xecc1('0x4')]),_0x20aa4e);}};exports[_0xecc1('0x10')]=function(_0x126358){try{utils[_0xecc1('0x8')](util[_0xecc1('0x11')](_0xecc1('0x12'),_0x126358['origtransfereruniqueid']),_0x126358);utils[_0xecc1('0x9')](util[_0xecc1('0x11')](_0xecc1('0x13'),_0x126358[_0xecc1('0x3')],_0x126358['origtransferercalleridnum'],_0x126358[_0xecc1('0x14')],_0x126358[_0xecc1('0x15')],_0x126358['transfertargetcalleridname']));_0x126358=_[_0xecc1('0x16')](_0x126358,{'transfererchannel':_0x126358[_0xecc1('0x17')],'transferercalleridnum':_0x126358[_0xecc1('0x18')],'transferercalleridname':_0x126358['origtransferercalleridname'],'transfererconnectedlinenum':_0x126358[_0xecc1('0x19')],'transfererconnectedlinename':_0x126358[_0xecc1('0x1a')],'transfereraccountcode':_0x126358[_0xecc1('0x1b')],'transferercontext':_0x126358[_0xecc1('0x1c')],'transfererexten':_0x126358[_0xecc1('0x1d')],'transfererlinkedid':_0x126358[_0xecc1('0x1e')],'context':_0x126358[_0xecc1('0x1f')],'extension':_0x126358[_0xecc1('0x20')],'type':'attended'});if(_[_0xecc1('0x21')](_0x126358['transfereechannel'])){_0x126358=_[_0xecc1('0x16')](_0x126358,{'transfereechannel':_0x126358[_0xecc1('0x22')],'transfereecalleridnum':_0x126358[_0xecc1('0x15')],'transfereecalleridname':_0x126358[_0xecc1('0x23')],'transfereeconnectedlinenum':_0x126358['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x126358['transfertargetconnectedlinename'],'transfereeaccountcode':_0x126358[_0xecc1('0x24')],'transfereecontext':_0x126358[_0xecc1('0x25')],'transfereeexten':_0x126358[_0xecc1('0x26')],'transfereelinkedid':_0x126358[_0xecc1('0x27')]});}writeDB(_0x126358);}catch(_0x3ea8cf){utils[_0xecc1('0xe')](util['format']('[%s][transfers][attendedtransfer]',_0x126358[_0xecc1('0x3')]),_0x3ea8cf);}}; \ No newline at end of file +var _0xfd4d=['blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','./utils','info','format','type','attended','origtransfereruniqueid','uniqueid','blindtransfer','debug','transferercalleridnum','transferercalleridname','transfereecalleridnum'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xfd4d,0x12e));var _0xdfd4=function(_0x43e9b1,_0x1bdb27){_0x43e9b1=_0x43e9b1-0x0;var _0x1850ba=_0xfd4d[_0x43e9b1];return _0x1850ba;};'use strict';var _=require(_0xdfd4('0x0'));var util=require('util');var utils=require(_0xdfd4('0x1'));function writeDB(_0x23f71e){utils[_0xdfd4('0x2')](util[_0xdfd4('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x23f71e[_0xdfd4('0x4')]===_0xdfd4('0x5')?_0x23f71e[_0xdfd4('0x6')]:_0x23f71e[_0xdfd4('0x7')],_0x23f71e['type']));utils['request']('CreateVoiceTransferReport',_0x23f71e);}exports[_0xdfd4('0x8')]=function(_0x51a799){try{utils[_0xdfd4('0x9')](util['format']('[%s][transfers][blindtransfer]',_0x51a799[_0xdfd4('0x7')]),_0x51a799);utils[_0xdfd4('0x2')](util[_0xdfd4('0x3')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x51a799['uniqueid'],_0x51a799[_0xdfd4('0xa')],_0x51a799[_0xdfd4('0xb')],_0x51a799[_0xdfd4('0xc')],_0x51a799['transfereecalleridname']));_0x51a799[_0xdfd4('0x4')]=_0xdfd4('0xd');writeDB(_0x51a799);}catch(_0x2f181a){utils[_0xdfd4('0xe')](util['format']('[%s][transfers][blindtransfer]',_0x51a799[_0xdfd4('0x7')]),_0x2f181a);}};exports[_0xdfd4('0xf')]=function(_0x17e3c9){try{utils[_0xdfd4('0x9')](util['format'](_0xdfd4('0x10'),_0x17e3c9[_0xdfd4('0x6')]),_0x17e3c9);utils[_0xdfd4('0x2')](util[_0xdfd4('0x3')](_0xdfd4('0x11'),_0x17e3c9[_0xdfd4('0x6')],_0x17e3c9[_0xdfd4('0x12')],_0x17e3c9['origtransferercalleridname'],_0x17e3c9[_0xdfd4('0x13')],_0x17e3c9[_0xdfd4('0x14')]));_0x17e3c9=_['assign'](_0x17e3c9,{'transfererchannel':_0x17e3c9[_0xdfd4('0x15')],'transferercalleridnum':_0x17e3c9[_0xdfd4('0x12')],'transferercalleridname':_0x17e3c9[_0xdfd4('0x16')],'transfererconnectedlinenum':_0x17e3c9[_0xdfd4('0x17')],'transfererconnectedlinename':_0x17e3c9[_0xdfd4('0x18')],'transfereraccountcode':_0x17e3c9[_0xdfd4('0x19')],'transferercontext':_0x17e3c9['secondtransferercontext'],'transfererexten':_0x17e3c9[_0xdfd4('0x1a')],'transfererlinkedid':_0x17e3c9['origtransfererlinkedid'],'context':_0x17e3c9['origtransferercontext'],'extension':_0x17e3c9['origtransfererexten'],'type':'attended'});if(_[_0xdfd4('0x1b')](_0x17e3c9[_0xdfd4('0x1c')])){_0x17e3c9=_['assign'](_0x17e3c9,{'transfereechannel':_0x17e3c9[_0xdfd4('0x1d')],'transfereecalleridnum':_0x17e3c9[_0xdfd4('0x13')],'transfereecalleridname':_0x17e3c9['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x17e3c9[_0xdfd4('0x1e')],'transfereeconnectedlinename':_0x17e3c9[_0xdfd4('0x1f')],'transfereeaccountcode':_0x17e3c9[_0xdfd4('0x20')],'transfereecontext':_0x17e3c9[_0xdfd4('0x21')],'transfereeexten':_0x17e3c9[_0xdfd4('0x22')],'transfereelinkedid':_0x17e3c9['transfertargetlinkedid']});}writeDB(_0x17e3c9);}catch(_0x4e98cc){utils[_0xdfd4('0xe')](util[_0xdfd4('0x3')](_0xdfd4('0x10'),_0x17e3c9[_0xdfd4('0x6')]),_0x4e98cc);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index a2713ce..7d09f6c 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 _0xc741=['inspect','debug','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]','getUserByName','notfound','[utils][getUserByName]','getVoiceQueueByName','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','format','YYYY-MM-DD\x20HH:mm:ss','subtract','seconds','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info'];(function(_0x1c7536,_0x118bee){var _0x45b934=function(_0x1d4b72){while(--_0x1d4b72){_0x1c7536['push'](_0x1c7536['shift']());}};_0x45b934(++_0x118bee);}(_0xc741,0xe7));var _0x1c74=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc741[_0x53ccf2];return _0x5a2964;};'use strict';var BPromise=require(_0x1c74('0x0'));var jayson=require(_0x1c74('0x1'));var moment=require(_0x1c74('0x2'));var util=require(_0x1c74('0x3'));var client=jayson[_0x1c74('0x4')][_0x1c74('0x5')]({'port':0x2329});var logger=require(_0x1c74('0x6'))(_0x1c74('0x7'));exports[_0x1c74('0x8')]=function(_0x15193c,_0x215962){logger['info'](_0x15193c,_0x215962?util[_0x1c74('0x9')](_0x215962,{'showHidden':![],'depth':null}):'');};exports[_0x1c74('0xa')]=function(_0x3abc3d,_0x5d16c5){logger['debug'](_0x3abc3d,_0x5d16c5?util['inspect'](_0x5d16c5,{'showHidden':![],'depth':null}):'');};exports[_0x1c74('0xb')]=function(_0xb46a1e,_0x378455){logger[_0x1c74('0xb')](_0xb46a1e,_0x378455?util[_0x1c74('0x9')](_0x378455,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x5f2a82,_0x3649a){return client[_0x1c74('0xc')](_0x5f2a82,{'body':_0x3649a})[_0x1c74('0xd')](function(_0x39598a){logger['debug'](_0x1c74('0xe'),_0x5f2a82,_0x39598a?util[_0x1c74('0x9')](_0x39598a,{'showHidden':![],'depth':null}):'');})[_0x1c74('0xf')](function(_0x2a8ae4){logger[_0x1c74('0xb')]('[utils][request]\x20name:%s',_0x5f2a82,_0x2a8ae4?util[_0x1c74('0x9')](_0x2a8ae4,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4c6c1b){return client['request'](_0x1c74('0x10'),{'options':{'raw':!![],'attributes':['id',_0x1c74('0x11'),_0x1c74('0x12'),_0x1c74('0x13')],'where':_0x4c6c1b,'limit':0x1}})['then'](function(_0x5e7f5){logger[_0x1c74('0xa')](_0x1c74('0x14'),JSON[_0x1c74('0x15')](_0x4c6c1b),_0x5e7f5?util[_0x1c74('0x9')](_0x5e7f5,{'showHidden':![],'depth':null}):'');return _0x5e7f5[_0x1c74('0x16')]['length']?_0x5e7f5[_0x1c74('0x16')][0x0]:null;});}exports[_0x1c74('0x17')]=function(_0x3340df){return new BPromise(function(_0x3f39ef,_0x197efb){if(_0x3340df){return getUser({'internal':_0x3340df})['then'](function(_0x107717){logger[_0x1c74('0x8')](_0x1c74('0x18'),_0x3340df,_0x107717?_0x1c74('0x19'):'notfound');return _0x3f39ef(_0x107717);})['catch'](function(_0x558a5f){logger[_0x1c74('0xb')](_0x1c74('0x1a'),_0x558a5f?util[_0x1c74('0x9')](_0x558a5f,{'showHidden':![],'depth':null}):'');return _0x3f39ef(null);});}return _0x3f39ef(null);});};exports[_0x1c74('0x1b')]=function(_0x336b28){return new BPromise(function(_0x189c8d,_0x2233f6){if(_0x336b28){return getUser({'interface':_0x336b28})[_0x1c74('0xd')](function(_0x308cc2){logger[_0x1c74('0x8')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x336b28,_0x308cc2?_0x1c74('0x19'):'notfound');return _0x189c8d(_0x308cc2);})[_0x1c74('0xf')](function(_0x16709e){logger[_0x1c74('0xb')](_0x1c74('0x1c'),_0x16709e?util[_0x1c74('0x9')](_0x16709e,{'showHidden':![],'depth':null}):'');return _0x189c8d(null);});}return _0x189c8d(null);});};exports[_0x1c74('0x1d')]=function(_0x5deaad){return new BPromise(function(_0x291d1c,_0x441387){if(_0x5deaad){return getUser({'name':_0x5deaad})['then'](function(_0x55e378){logger[_0x1c74('0x8')]('[utils][getUserByName]\x20name:%s\x20%s',_0x5deaad,_0x55e378?_0x1c74('0x19'):_0x1c74('0x1e'));return _0x291d1c(_0x55e378);})['catch'](function(_0x12f92c){logger[_0x1c74('0xb')](_0x1c74('0x1f'),_0x12f92c?util[_0x1c74('0x9')](_0x12f92c,{'showHidden':![],'depth':null}):'');return _0x291d1c(null);});}return _0x291d1c(null);});};exports[_0x1c74('0x20')]=function(_0x6120bb){return new BPromise(function(_0x2a38d1,_0x18c159){if(_0x6120bb){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x1c74('0x12'),'type',_0x1c74('0x21'),'acwTimeout'],'where':{'name':_0x6120bb},'limit':0x1}})[_0x1c74('0xd')](function(_0x56f5b1){logger[_0x1c74('0xa')](_0x1c74('0x22'),_0x6120bb,_0x56f5b1?util['inspect'](_0x56f5b1,{'showHidden':![],'depth':null}):'');logger[_0x1c74('0x8')](_0x1c74('0x23'),_0x6120bb,_0x56f5b1?_0x1c74('0x19'):_0x1c74('0x1e'));return _0x2a38d1(_0x56f5b1[_0x1c74('0x16')][_0x1c74('0x24')]?_0x56f5b1[_0x1c74('0x16')][0x0]:null);})[_0x1c74('0xf')](function(_0x1122af){logger[_0x1c74('0xb')](_0x1c74('0x25'),_0x1122af?util[_0x1c74('0x9')](_0x1122af,{'showHidden':![],'depth':null}):'');return _0x2a38d1(null);});}return _0x2a38d1(null);});};exports[_0x1c74('0x26')]=function(_0x501e7f,_0x3085c8){return moment(_0x501e7f)['add'](_0x3085c8,'seconds')[_0x1c74('0x27')](_0x1c74('0x28'));};exports['subtractTime']=function(_0x470e33,_0x2174a5){return moment(_0x470e33)[_0x1c74('0x29')](_0x2174a5,_0x1c74('0x2a'))[_0x1c74('0x27')](_0x1c74('0x28'));};exports[_0x1c74('0x2b')]=function(_0x17cfb6,_0x18f93d){return moment(_0x17cfb6)[_0x1c74('0x2c')](moment(_0x18f93d),_0x1c74('0x2a'));};exports['sumTime']=function(_0x24fe39,_0x45dab7){return parseInt(_0x24fe39,0xa)+parseInt(_0x45dab7,0xa);};exports[_0x1c74('0x2d')]=function(){return moment()[_0x1c74('0x27')](_0x1c74('0x28'));};exports['isAfter']=function(_0x8b354b,_0x47bb03){if(_0x47bb03){return moment(_0x8b354b)[_0x1c74('0x2e')](_0x47bb03);}return!![];};exports['isBefore']=function(_0xee6e8,_0x18080c){if(_0x18080c){return moment(_0xee6e8)[_0x1c74('0x2f')](_0x18080c);}else if(_0xee6e8){return!![];}return![];}; \ No newline at end of file +var _0x75bc=['[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','[utils][request]\x20name:%s','catch','request','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','then','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','notfound','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length'];(function(_0xc66af2,_0x14f6d8){var _0x38d439=function(_0x544ab8){while(--_0x544ab8){_0xc66af2['push'](_0xc66af2['shift']());}};_0x38d439(++_0x14f6d8);}(_0x75bc,0x10f));var _0xc75b=function(_0x49a5cd,_0x112875){_0x49a5cd=_0x49a5cd-0x0;var _0x3241fd=_0x75bc[_0x49a5cd];return _0x3241fd;};'use strict';var BPromise=require(_0xc75b('0x0'));var jayson=require(_0xc75b('0x1'));var moment=require(_0xc75b('0x2'));var util=require(_0xc75b('0x3'));var client=jayson[_0xc75b('0x4')][_0xc75b('0x5')]({'port':0x2329});var logger=require(_0xc75b('0x6'))(_0xc75b('0x7'));exports[_0xc75b('0x8')]=function(_0x477967,_0x402361){logger[_0xc75b('0x8')](_0x477967,_0x402361?util[_0xc75b('0x9')](_0x402361,{'showHidden':![],'depth':null}):'');};exports[_0xc75b('0xa')]=function(_0x14c121,_0x1d77d1){logger[_0xc75b('0xa')](_0x14c121,_0x1d77d1?util[_0xc75b('0x9')](_0x1d77d1,{'showHidden':![],'depth':null}):'');};exports[_0xc75b('0xb')]=function(_0x979d2b,_0x400d6e){logger['error'](_0x979d2b,_0x400d6e?util[_0xc75b('0x9')](_0x400d6e,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x1ad13f,_0xf0a931){return client['request'](_0x1ad13f,{'body':_0xf0a931})['then'](function(_0x1853f2){logger['debug'](_0xc75b('0xc'),_0x1ad13f,_0x1853f2?util[_0xc75b('0x9')](_0x1853f2,{'showHidden':![],'depth':null}):'');})[_0xc75b('0xd')](function(_0x43e22e){logger[_0xc75b('0xb')](_0xc75b('0xc'),_0x1ad13f,_0x43e22e?util[_0xc75b('0x9')](_0x43e22e,{'showHidden':![],'depth':null}):'');});};function getUser(_0x17ccdd){return client[_0xc75b('0xe')](_0xc75b('0xf'),{'options':{'raw':!![],'attributes':['id',_0xc75b('0x10'),_0xc75b('0x11'),_0xc75b('0x12')],'where':_0x17ccdd,'limit':0x1}})['then'](function(_0x352684){logger['debug'](_0xc75b('0x13'),JSON[_0xc75b('0x14')](_0x17ccdd),_0x352684?util[_0xc75b('0x9')](_0x352684,{'showHidden':![],'depth':null}):'');return _0x352684[_0xc75b('0x15')]['length']?_0x352684['result'][0x0]:null;});}exports[_0xc75b('0x16')]=function(_0x1dd543){return new BPromise(function(_0x3c6f1d,_0x49fb24){if(_0x1dd543){return getUser({'internal':_0x1dd543})[_0xc75b('0x17')](function(_0x5dccdf){logger[_0xc75b('0x8')](_0xc75b('0x18'),_0x1dd543,_0x5dccdf?_0xc75b('0x19'):'notfound');return _0x3c6f1d(_0x5dccdf);})[_0xc75b('0xd')](function(_0x34b11e){logger[_0xc75b('0xb')](_0xc75b('0x1a'),_0x34b11e?util['inspect'](_0x34b11e,{'showHidden':![],'depth':null}):'');return _0x3c6f1d(null);});}return _0x3c6f1d(null);});};exports[_0xc75b('0x1b')]=function(_0x1ba9cd){return new BPromise(function(_0x468646,_0x3d8f14){if(_0x1ba9cd){return getUser({'interface':_0x1ba9cd})[_0xc75b('0x17')](function(_0x4bfc45){logger[_0xc75b('0x8')](_0xc75b('0x1c'),_0x1ba9cd,_0x4bfc45?'found':'notfound');return _0x468646(_0x4bfc45);})[_0xc75b('0xd')](function(_0x11d202){logger[_0xc75b('0xb')](_0xc75b('0x1d'),_0x11d202?util[_0xc75b('0x9')](_0x11d202,{'showHidden':![],'depth':null}):'');return _0x468646(null);});}return _0x468646(null);});};exports['getUserByName']=function(_0x376982){return new BPromise(function(_0x2b40d6,_0x2fa6a8){if(_0x376982){return getUser({'name':_0x376982})[_0xc75b('0x17')](function(_0x284e5b){logger[_0xc75b('0x8')](_0xc75b('0x1e'),_0x376982,_0x284e5b?'found':_0xc75b('0x1f'));return _0x2b40d6(_0x284e5b);})[_0xc75b('0xd')](function(_0x39d83a){logger[_0xc75b('0xb')](_0xc75b('0x20'),_0x39d83a?util[_0xc75b('0x9')](_0x39d83a,{'showHidden':![],'depth':null}):'');return _0x2b40d6(null);});}return _0x2b40d6(null);});};exports[_0xc75b('0x21')]=function(_0x5ee7b4){return new BPromise(function(_0x3da2fb,_0xaea4ff){if(_0x5ee7b4){return client[_0xc75b('0xe')](_0xc75b('0x22'),{'options':{'raw':!![],'attributes':['id',_0xc75b('0x11'),_0xc75b('0x23'),_0xc75b('0x24'),_0xc75b('0x25')],'where':{'name':_0x5ee7b4},'limit':0x1}})[_0xc75b('0x17')](function(_0x1bba97){logger[_0xc75b('0xa')](_0xc75b('0x26'),_0x5ee7b4,_0x1bba97?util[_0xc75b('0x9')](_0x1bba97,{'showHidden':![],'depth':null}):'');logger[_0xc75b('0x8')](_0xc75b('0x27'),_0x5ee7b4,_0x1bba97?_0xc75b('0x19'):_0xc75b('0x1f'));return _0x3da2fb(_0x1bba97['result'][_0xc75b('0x28')]?_0x1bba97[_0xc75b('0x15')][0x0]:null);})[_0xc75b('0xd')](function(_0x2fc82a){logger[_0xc75b('0xb')](_0xc75b('0x29'),_0x2fc82a?util[_0xc75b('0x9')](_0x2fc82a,{'showHidden':![],'depth':null}):'');return _0x3da2fb(null);});}return _0x3da2fb(null);});};exports[_0xc75b('0x2a')]=function(_0x163c04,_0x468695){return moment(_0x163c04)[_0xc75b('0x2b')](_0x468695,_0xc75b('0x2c'))[_0xc75b('0x2d')](_0xc75b('0x2e'));};exports['subtractTime']=function(_0x51574d,_0x4d6575){return moment(_0x51574d)['subtract'](_0x4d6575,_0xc75b('0x2c'))['format'](_0xc75b('0x2e'));};exports[_0xc75b('0x2f')]=function(_0x1ffdf4,_0x247bec){return moment(_0x1ffdf4)['diff'](moment(_0x247bec),_0xc75b('0x2c'));};exports[_0xc75b('0x30')]=function(_0x48760d,_0x33ee4f){return parseInt(_0x48760d,0xa)+parseInt(_0x33ee4f,0xa);};exports[_0xc75b('0x31')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xc75b('0x32')]=function(_0x232a4c,_0x20a18d){if(_0x20a18d){return moment(_0x232a4c)[_0xc75b('0x32')](_0x20a18d);}return!![];};exports['isBefore']=function(_0x5d0976,_0x5611ea){if(_0x5611ea){return moment(_0x5d0976)[_0xc75b('0x33')](_0x5611ea);}else if(_0x5d0976){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 233039b..6a5421e 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 _0xd737=['log','role','name','ensureDir','then','client','catch','user','no-user','data','timestamp','auth','set','client-side-logger','use','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','remoteAddress','url','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','agent_name','setupLoggers','fs-extra','lodash','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var'];(function(_0x3dba9d,_0x1bf0ae){var _0xda9a67=function(_0x2355dc){while(--_0x2355dc){_0x3dba9d['push'](_0x3dba9d['shift']());}};_0xda9a67(++_0x1bf0ae);}(_0xd737,0x16c));var _0x7d73=function(_0xc6b104,_0x1d805a){_0xc6b104=_0xc6b104-0x0;var _0x1c6fce=_0xd737[_0xc6b104];return _0x1c6fce;};var fs=require(_0x7d73('0x0'));var _=require(_0x7d73('0x1'));var ewinston=require('express-winston');var path=require(_0x7d73('0x2'));var util=require(_0x7d73('0x3'));var fileLogger=require(_0x7d73('0x4'))[_0x7d73('0x5')];var safeTemplate=require(_0x7d73('0x6'))[_0x7d73('0x7')];var maskSensitiveData=require(_0x7d73('0x8'))[_0x7d73('0x9')];function ClientSideLogger(){function _0x1afc88(_0x38be95){var _0x1cdfb5=path[_0x7d73('0xa')](_0x7d73('0xb'),_0x7d73('0xc'),'xcally');var _0x1ce94a=path[_0x7d73('0xa')]('client',_0x38be95[_0x7d73('0xd')]+'-'+_0x38be95[_0x7d73('0xe')]);return fs[_0x7d73('0xf')](path[_0x7d73('0xa')](_0x1cdfb5,_0x1ce94a))[_0x7d73('0x10')](function(){var _0x5a87da=fileLogger(_0x7d73('0x11'),path['join'](_0x1cdfb5,_0x1ce94a));return _0x5a87da;})[_0x7d73('0x12')](function(_0x10f665){throw _0x10f665;});}this['log']=function(_0x434f61,_0x437456,_0x4057ec,_0x11a748){return _0x1afc88(_0x434f61[_0x7d73('0x13')])[_0x7d73('0x10')](function(_0x316d39){var _0x19800c=_0x316d39[_0x437456];return _0x19800c;})[_0x7d73('0x10')](function(_0x37cdbd){var _0x292698=_0x434f61[_0x7d73('0x13')]?_0x434f61[_0x7d73('0x13')]['id']:_0x7d73('0x14');var _0x330a90=_0x11a748[_0x7d73('0x15')];var _0x4590e5=_0x11a748[_0x7d73('0x16')];var _0x310a13=new Date(Number(_0x4590e5));return _0x37cdbd(_0x292698,_0x310a13,_0x4057ec,_0x330a90);})[_0x7d73('0x12')](function(_0x22e118){fileLogger('client')['error'](_0x22e118);});};}function setupLoggers(_0x4f5d42){return new Promise(function(_0x3d1bb3){var _0x211c9c=new ClientSideLogger();var _0x4ef11e=fileLogger('api');var _0x4eeb85=fileLogger(_0x7d73('0x17'));_0x4f5d42[_0x7d73('0x18')](_0x7d73('0x19'),_0x211c9c);_0x4f5d42[_0x7d73('0x1a')](ewinston[_0x7d73('0x1b')]({'winstonInstance':_0x4ef11e,'meta':![],'statusLevels':!![],'msg':function(_0x77105d,_0x43f77b){var _0x3b23ab=_0x7d73('0x1c');if(!_[_0x7d73('0x1d')](_0x77105d[_0x7d73('0x1e')])){_0x3b23ab+='\x20body=%s';var _0x28e7de=_0x77105d[_0x7d73('0x1e')];maskSensitiveData(_0x28e7de);}return safeTemplate(util[_0x7d73('0x1f')](_0x3b23ab,_0x77105d[_0x7d73('0x20')],_0x77105d['headers']['x-forwarded-for']?_0x77105d[_0x7d73('0x21')][_0x7d73('0x22')]:_0x77105d[_0x7d73('0x23')][_0x7d73('0x24')]||_0x77105d['ip'],_0x77105d[_0x7d73('0x25')],_0x43f77b[_0x7d73('0x26')],_0x43f77b['responseTime'],_0x77105d['user']?_0x77105d[_0x7d73('0x13')]['id']:null,_0x77105d[_0x7d73('0x13')]?_0x77105d['user'][_0x7d73('0xe')]:null,_0x77105d[_0x7d73('0x13')]?_0x77105d['user'][_0x7d73('0xd')]:null,_0x28e7de?util[_0x7d73('0x27')](_0x28e7de,![],null):''));}}));_0x4f5d42['use'](ewinston[_0x7d73('0x1b')]({'winstonInstance':_0x4eeb85,'meta':![],'statusLevels':!![],'msg':function(_0x181d05,_0xea281a){var _0x3bbc26=_0x7d73('0x28');if(_0x181d05[_0x7d73('0x1e')]&&_0x181d05[_0x7d73('0x1e')][_0x7d73('0x29')]&&_0x181d05[_0x7d73('0x1e')][_0x7d73('0x2a')]){_0x3bbc26=_0x7d73('0x2b');}return util['format'](_0x3bbc26,_0x181d05['method'],_0x181d05[_0x7d73('0x21')]['x-forwarded-for']?_0x181d05[_0x7d73('0x21')][_0x7d73('0x22')]:_0x181d05['connection'][_0x7d73('0x24')]||_0x181d05['ip'],_0x181d05[_0x7d73('0x25')],_0xea281a[_0x7d73('0x26')],_0xea281a[_0x7d73('0x2c')],_0x181d05[_0x7d73('0x13')]?_0x181d05[_0x7d73('0x13')]['id']:null,_0x181d05[_0x7d73('0x13')]?_0x181d05['user'][_0x7d73('0xe')]:null,_0x181d05[_0x7d73('0x13')]?_0x181d05['user'][_0x7d73('0xd')]:null,_0x181d05[_0x7d73('0x1e')]&&_0x181d05['body'][_0x7d73('0x29')]?_0x181d05[_0x7d73('0x1e')][_0x7d73('0x29')]:'other',_0x181d05[_0x7d73('0x1e')]&&_0x181d05[_0x7d73('0x1e')][_0x7d73('0x2a')]?_0x181d05[_0x7d73('0x1e')][_0x7d73('0x2a')]:'',_0x181d05[_0x7d73('0x1e')]&&_0x181d05[_0x7d73('0x1e')][_0x7d73('0x2d')]?_0x181d05['body'][_0x7d73('0x2d')]:'');},'ignoreRoute':function(_0x483ec9){var _0x561e7c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x561e7c['test'](_0x483ec9[_0x7d73('0x25')]);}}));return _0x3d1bb3();});}exports[_0x7d73('0x2e')]=setupLoggers; \ No newline at end of file +var _0x0e28=['client','catch','log','user','no-user','data','timestamp','error','api','auth','set','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','format','method','headers','x-forwarded-for','remoteAddress','statusCode','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','body','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','url','responseTime','role','other','agent_name','setupLoggers','fs-extra','express-winston','path','util','./loggers','./safe-template','safeTemplate','maskSensitiveData','join','/var','name','ensureDir','then'];(function(_0x4e5e7d,_0x3c8421){var _0x490677=function(_0x45e94b){while(--_0x45e94b){_0x4e5e7d['push'](_0x4e5e7d['shift']());}};_0x490677(++_0x3c8421);}(_0x0e28,0x1d3));var _0x80e2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0e28[_0x2c91e9];return _0x13f0ff;};var fs=require(_0x80e2('0x0'));var _=require('lodash');var ewinston=require(_0x80e2('0x1'));var path=require(_0x80e2('0x2'));var util=require(_0x80e2('0x3'));var fileLogger=require(_0x80e2('0x4'))['fileLogger'];var safeTemplate=require(_0x80e2('0x5'))[_0x80e2('0x6')];var maskSensitiveData=require('./mask-sensitive-data')[_0x80e2('0x7')];function ClientSideLogger(){function _0x5ee88d(_0x3e64da){var _0x2a9f9d=path[_0x80e2('0x8')](_0x80e2('0x9'),'log','xcally');var _0x4b4a1b=path[_0x80e2('0x8')]('client',_0x3e64da['role']+'-'+_0x3e64da[_0x80e2('0xa')]);return fs[_0x80e2('0xb')](path[_0x80e2('0x8')](_0x2a9f9d,_0x4b4a1b))[_0x80e2('0xc')](function(){var _0x54402a=fileLogger(_0x80e2('0xd'),path[_0x80e2('0x8')](_0x2a9f9d,_0x4b4a1b));return _0x54402a;})[_0x80e2('0xe')](function(_0x1bef30){throw _0x1bef30;});}this[_0x80e2('0xf')]=function(_0x52df51,_0x5a29a0,_0x18946e,_0x5d0402){return _0x5ee88d(_0x52df51['user'])[_0x80e2('0xc')](function(_0x4038dc){var _0x479509=_0x4038dc[_0x5a29a0];return _0x479509;})['then'](function(_0x5cc9f4){var _0x23cf79=_0x52df51[_0x80e2('0x10')]?_0x52df51[_0x80e2('0x10')]['id']:_0x80e2('0x11');var _0xffe8e1=_0x5d0402[_0x80e2('0x12')];var _0x453a7c=_0x5d0402[_0x80e2('0x13')];var _0x2f9ae8=new Date(Number(_0x453a7c));return _0x5cc9f4(_0x23cf79,_0x2f9ae8,_0x18946e,_0xffe8e1);})[_0x80e2('0xe')](function(_0x268880){fileLogger(_0x80e2('0xd'))[_0x80e2('0x14')](_0x268880);});};}function setupLoggers(_0x1e0153){return new Promise(function(_0x2fde01){var _0x61f7b8=new ClientSideLogger();var _0x1843cb=fileLogger(_0x80e2('0x15'));var _0x1deed7=fileLogger(_0x80e2('0x16'));_0x1e0153[_0x80e2('0x17')]('client-side-logger',_0x61f7b8);_0x1e0153[_0x80e2('0x18')](ewinston['logger']({'winstonInstance':_0x1843cb,'meta':![],'statusLevels':!![],'msg':function(_0x5f015c,_0x5d934d){var _0x4b16cf=_0x80e2('0x19');if(!_[_0x80e2('0x1a')](_0x5f015c['body'])){_0x4b16cf+=_0x80e2('0x1b');var _0x2e3185=_0x5f015c['body'];maskSensitiveData(_0x2e3185);}return safeTemplate(util[_0x80e2('0x1c')](_0x4b16cf,_0x5f015c[_0x80e2('0x1d')],_0x5f015c[_0x80e2('0x1e')][_0x80e2('0x1f')]?_0x5f015c['headers']['x-forwarded-for']:_0x5f015c['connection'][_0x80e2('0x20')]||_0x5f015c['ip'],_0x5f015c['url'],_0x5d934d[_0x80e2('0x21')],_0x5d934d['responseTime'],_0x5f015c['user']?_0x5f015c['user']['id']:null,_0x5f015c[_0x80e2('0x10')]?_0x5f015c['user'][_0x80e2('0xa')]:null,_0x5f015c[_0x80e2('0x10')]?_0x5f015c['user']['role']:null,_0x2e3185?util[_0x80e2('0x22')](_0x2e3185,![],null):''));}}));_0x1e0153[_0x80e2('0x18')](ewinston[_0x80e2('0x23')]({'winstonInstance':_0x1deed7,'meta':![],'statusLevels':!![],'msg':function(_0x3828ae,_0x245cbc){var _0x231e37=_0x80e2('0x24');if(_0x3828ae['body']&&_0x3828ae['body'][_0x80e2('0x25')]&&_0x3828ae[_0x80e2('0x26')][_0x80e2('0x27')]){_0x231e37=_0x80e2('0x28');}return util[_0x80e2('0x1c')](_0x231e37,_0x3828ae[_0x80e2('0x1d')],_0x3828ae['headers'][_0x80e2('0x1f')]?_0x3828ae[_0x80e2('0x1e')][_0x80e2('0x1f')]:_0x3828ae[_0x80e2('0x29')]['remoteAddress']||_0x3828ae['ip'],_0x3828ae[_0x80e2('0x2a')],_0x245cbc['statusCode'],_0x245cbc[_0x80e2('0x2b')],_0x3828ae[_0x80e2('0x10')]?_0x3828ae[_0x80e2('0x10')]['id']:null,_0x3828ae[_0x80e2('0x10')]?_0x3828ae[_0x80e2('0x10')][_0x80e2('0xa')]:null,_0x3828ae[_0x80e2('0x10')]?_0x3828ae[_0x80e2('0x10')][_0x80e2('0x2c')]:null,_0x3828ae[_0x80e2('0x26')]&&_0x3828ae[_0x80e2('0x26')][_0x80e2('0x25')]?_0x3828ae[_0x80e2('0x26')][_0x80e2('0x25')]:_0x80e2('0x2d'),_0x3828ae[_0x80e2('0x26')]&&_0x3828ae[_0x80e2('0x26')]['agent_id']?_0x3828ae['body'][_0x80e2('0x27')]:'',_0x3828ae[_0x80e2('0x26')]&&_0x3828ae[_0x80e2('0x26')][_0x80e2('0x2e')]?_0x3828ae[_0x80e2('0x26')]['agent_name']:'');},'ignoreRoute':function(_0x427ff5){var _0x1f7447=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1f7447['test'](_0x427ff5[_0x80e2('0x2a')]);}}));return _0x2fde01();});}exports[_0x80e2('0x2f')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index d21eaa6..a7c835b 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5610=['circularDoWInterval','monthsShort','toLowerCase','indexOf','concat','clone','hours','minutes','isBefore','day','endOf','isBetween','timeCompare','ddd','includes','dowCompare','date','daysInMonth','min','max','domCompare','format','monthCompare','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','Date\x20not\x20valid','split','locale','weekdaysShort','slice','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5610,0x100));var _0x0561=function(_0x103882,_0x185710){_0x103882=_0x103882-0x0;var _0x326fc7=_0x5610[_0x103882];return _0x326fc7;};var _=require(_0x0561('0x0'));var moment=require(_0x0561('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][_0x0561('0x2')](function(_0x1041d1){return _0x1041d1[_0x0561('0x3')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x0561('0x4');function throwIfDateNotValid(_0x125194){if(!_0x125194['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x5d29e9){var _0x99f20e=_0x5d29e9[_0x0561('0x5')](':')[_0x0561('0x2')](function(_0xe6b8b2){return parseInt(_0xe6b8b2,0xa);});var _0x4c5635=_0x99f20e[0x0];var _0x4556ac=_0x99f20e[0x1];if(_0x4c5635<0x0||_0x4c5635>0x17||_0x4556ac<0x0||_0x4556ac>0x3b){throw new Error(EINVALID_DATE);}return[_0x4c5635,_0x4556ac];}function circularDoWInterval(_0x109cad,_0x1348e6){if(_0x109cad===_0x1348e6){return[_0x109cad];}else{var _0x207a5d=moment[_0x0561('0x6')]();moment[_0x0561('0x6')]('en');var _0x54b55e=moment[_0x0561('0x7')]()[_0x0561('0x2')](function(_0x7e730){return _0x7e730['toLowerCase']();});moment[_0x0561('0x6')](_0x207a5d);var _0x2d1ebb=_0x54b55e['indexOf'](_0x109cad);var _0x23e459=_0x54b55e['indexOf'](_0x1348e6);if(_0x23e459>_0x2d1ebb){return _0x54b55e['slice'](_0x2d1ebb,_0x23e459+0x1);}else{var _0x30c0a7=_0x54b55e[_0x0561('0x8')](0x0,_0x23e459+0x1);var _0x116bd7=_0x54b55e[_0x0561('0x8')](_0x2d1ebb);return _0x116bd7['concat'](_0x30c0a7);}}}module[_0x0561('0x9')][_0x0561('0xa')]=circularDoWInterval;function circularMonthInterval(_0x13bcb0,_0x2038d6){if(_0x13bcb0===_0x2038d6){return[_0x13bcb0];}else{var _0x534350=moment[_0x0561('0x6')]();moment['locale']('en');var _0x38a5ba=moment[_0x0561('0xb')]()[_0x0561('0x2')](function(_0x4c2dd4){return _0x4c2dd4[_0x0561('0xc')]();});moment[_0x0561('0x6')](_0x534350);var _0x5677c8=_0x38a5ba[_0x0561('0xd')](_0x13bcb0);var _0x5386db=_0x38a5ba[_0x0561('0xd')](_0x2038d6);if(_0x5386db>_0x5677c8){return _0x38a5ba[_0x0561('0x8')](_0x5677c8,_0x5386db+0x1);}else{var _0x328305=_0x38a5ba[_0x0561('0x8')](0x0,_0x5386db+0x1);var _0xa9a3b=_0x38a5ba['slice'](_0x5677c8);return _0xa9a3b[_0x0561('0xe')](_0x328305);}}}module[_0x0561('0x9')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x147f1c){var _0x3cdfdd=parseInt(_0x147f1c,0xa);if(_0x3cdfdd<0x1||_0x3cdfdd>0x1f){throw new Error(EINVALID_DATE);}return _0x3cdfdd;}function timeCompare(_0x2b87fe,_0x196008,_0x18b334){var _0x5acbc3=_0x2b87fe[_0x0561('0xf')]();var _0x498f2a=extractTime(_0x196008);var _0x246f01=_0x498f2a[0x0];var _0x20f533=_0x498f2a[0x1];var _0x2da2d5=_0x2b87fe[_0x0561('0xf')]()[_0x0561('0x10')](_0x246f01)['minutes'](_0x20f533);throwIfDateNotValid(_0x2da2d5);var _0x3912db=extractTime(_0x18b334);var _0x32d3e5=_0x3912db[0x0];var _0x5ebcf8=_0x3912db[0x1];var _0x24fbc3=_0x2b87fe[_0x0561('0xf')]()['hours'](_0x32d3e5)[_0x0561('0x11')](_0x5ebcf8);throwIfDateNotValid(_0x24fbc3);if(_0x24fbc3[_0x0561('0x12')](_0x2da2d5)){var _0xe05b8c=_0x5acbc3[_0x0561('0xf')]()['startOf'](_0x0561('0x13'));var _0x439f4e=_0x5acbc3[_0x0561('0xf')]()[_0x0561('0x14')](_0x0561('0x13'));return _0x5acbc3[_0x0561('0x15')](_0x2da2d5,_0x439f4e,undefined,'[]')||_0x5acbc3[_0x0561('0x15')](_0xe05b8c,_0x24fbc3,undefined,'[]');}else{return _0x5acbc3[_0x0561('0x15')](_0x2da2d5,_0x24fbc3,undefined,'[]');}}module[_0x0561('0x9')][_0x0561('0x16')]=timeCompare;function dowCompare(_0xea6cc3,_0x4cd50c,_0x25c74e){var _0x31b069=_0xea6cc3[_0x0561('0x6')]('en')['format'](_0x0561('0x17'))[_0x0561('0xc')]();return circularDoWInterval(_0x4cd50c,_0x25c74e)[_0x0561('0x18')](_0x31b069);}module[_0x0561('0x9')][_0x0561('0x19')]=dowCompare;function domCompare(_0x2099a1,_0x357e7a,_0x2371de){var _0x52b74a=_0x2099a1[_0x0561('0x1a')]();if(_0x357e7a===_0x2371de){return _0x52b74a===_0x357e7a;}else{var _0xa1f71c=_0x2099a1[_0x0561('0x1b')]();var _0x51a719=_0x357e7a<_0x2371de;let _0x2d5145=![];var _0x174812=0x0;var _0x1afea8=0x0;if(_0x51a719){_0x174812=Math['max'](0x1,_0x357e7a);_0x1afea8=Math[_0x0561('0x1c')](_0x2371de,_0xa1f71c);_0x2d5145=_0x52b74a>=_0x174812&&_0x52b74a<=_0x1afea8;}else{_0x174812=Math[_0x0561('0x1c')](_0x357e7a,_0xa1f71c);_0x1afea8=Math[_0x0561('0x1d')](0x1,_0x2371de);_0x2d5145=_0x52b74a>=_0x174812||_0x52b74a<=_0x1afea8;}return _0x2d5145;}}module[_0x0561('0x9')][_0x0561('0x1e')]=domCompare;function monthCompare(_0x509941,_0x370c8d,_0x2c388e){var _0x29a221=_0x509941[_0x0561('0x6')]('en')[_0x0561('0x1f')]('MMM')[_0x0561('0xc')]();return circularMonthInterval(_0x370c8d,_0x2c388e)['includes'](_0x29a221);}module[_0x0561('0x9')][_0x0561('0x20')]=monthCompare;function iftime(_0x101df1,_0x4ad87f=moment['tz']['guess'](),_0x5728dd=moment()){if(!validateRx[_0x0561('0x21')](_0x101df1)){throw new Error(EINVALID_STRING);}else{var _0x42153c=(moment[_0x0561('0x22')](_0x5728dd)?_0x5728dd[_0x0561('0xf')]():moment(_0x5728dd))['tz'](_0x4ad87f)['locale']('en');throwIfDateNotValid(_0x42153c);var _0x5dde38=_0x101df1[_0x0561('0x5')](',');var _0x216ea4=_0x5dde38[0x0];var _0x9e1708=_0x5dde38[0x1];var _0x5c07b9=_0x5dde38[0x2];var _0x1d2916=_0x5dde38[0x3];let _0x45076b=!![];if(_0x216ea4!=='*'){var _0x41c677=_0x216ea4[_0x0561('0x5')]('-');var _0x4cb942=_['padStart'](_0x41c677[0x0],0x5,'0');var _0x12ca2a=_0x41c677['length']===0x2?_[_0x0561('0x23')](_0x41c677[0x1],0x5,'0'):_0x4cb942;_0x45076b=timeCompare(_0x42153c,_0x4cb942,_0x12ca2a);}let _0x24ff8e=!![];if(_0x9e1708!=='*'){var _0x469768=_0x9e1708['split']('-');var _0x5657a3=_0x469768[0x0];var _0x99349=_0x469768[_0x0561('0x24')]===0x2?_0x469768[0x1]:_0x5657a3;_0x24ff8e=dowCompare(_0x42153c,_0x5657a3,_0x99349);}let _0x3ea21d=!![];if(_0x5c07b9!=='*'){var _0x1278d6=_0x5c07b9[_0x0561('0x5')]('-');var _0x92ca59=parseDom(_0x1278d6[0x0]);var _0x3ced74=_0x1278d6[_0x0561('0x24')]===0x2?parseDom(_0x1278d6[0x1]):_0x92ca59;_0x3ea21d=domCompare(_0x42153c,_0x92ca59,_0x3ced74);}let _0xa5295d=!![];if(_0x1d2916!=='*'){var _0x157e99=_0x1d2916[_0x0561('0x5')]('-');var _0x1169ee=_0x157e99[0x0];var _0xdd1cd7=_0x157e99[_0x0561('0x24')]===0x2?_0x157e99[0x1]:_0x157e99[0x0];_0xa5295d=monthCompare(_0x42153c,_0x1169ee,_0xdd1cd7);}return _0x45076b&&_0x24ff8e&&_0x3ea21d&&_0xa5295d;}}module[_0x0561('0x9')][_0x0561('0x25')]=iftime; \ No newline at end of file +var _0xd467=['map','source','join','Date\x20not\x20valid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','circularDoWInterval','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','includes','dowCompare','date','max','min','domCompare','MMM','monthCompare','guess','isMoment','padStart','length','iftime','moment-timezone'];(function(_0x131585,_0x1abd33){var _0x1fcca2=function(_0x8f165b){while(--_0x8f165b){_0x131585['push'](_0x131585['shift']());}};_0x1fcca2(++_0x1abd33);}(_0xd467,0xbd));var _0x7d46=function(_0x13055d,_0xb3e265){_0x13055d=_0x13055d-0x0;var _0x237802=_0xd467[_0x13055d];return _0x237802;};var _=require('lodash');var moment=require(_0x7d46('0x0'));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][_0x7d46('0x1')](function(_0x488852){return _0x488852[_0x7d46('0x2')];})[_0x7d46('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x7d46('0x4');function throwIfDateNotValid(_0x509ac9){if(!_0x509ac9['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x343a74){var _0x87dcb6=_0x343a74[_0x7d46('0x5')](':')['map'](function(_0x46a01a){return parseInt(_0x46a01a,0xa);});var _0x48689f=_0x87dcb6[0x0];var _0x574db4=_0x87dcb6[0x1];if(_0x48689f<0x0||_0x48689f>0x17||_0x574db4<0x0||_0x574db4>0x3b){throw new Error(EINVALID_DATE);}return[_0x48689f,_0x574db4];}function circularDoWInterval(_0x3ae94b,_0x368510){if(_0x3ae94b===_0x368510){return[_0x3ae94b];}else{var _0x4a49d0=moment[_0x7d46('0x6')]();moment[_0x7d46('0x6')]('en');var _0xd6b8cd=moment[_0x7d46('0x7')]()['map'](function(_0x1b7fc6){return _0x1b7fc6[_0x7d46('0x8')]();});moment[_0x7d46('0x6')](_0x4a49d0);var _0x236a93=_0xd6b8cd['indexOf'](_0x3ae94b);var _0x4c8631=_0xd6b8cd[_0x7d46('0x9')](_0x368510);if(_0x4c8631>_0x236a93){return _0xd6b8cd[_0x7d46('0xa')](_0x236a93,_0x4c8631+0x1);}else{var _0x2ee875=_0xd6b8cd[_0x7d46('0xa')](0x0,_0x4c8631+0x1);var _0x217ad5=_0xd6b8cd[_0x7d46('0xa')](_0x236a93);return _0x217ad5[_0x7d46('0xb')](_0x2ee875);}}}module['exports'][_0x7d46('0xc')]=circularDoWInterval;function circularMonthInterval(_0x89dae6,_0x29277d){if(_0x89dae6===_0x29277d){return[_0x89dae6];}else{var _0x2d61c3=moment[_0x7d46('0x6')]();moment['locale']('en');var _0x6ba43a=moment['monthsShort']()[_0x7d46('0x1')](function(_0xbfe97){return _0xbfe97['toLowerCase']();});moment[_0x7d46('0x6')](_0x2d61c3);var _0x14291e=_0x6ba43a[_0x7d46('0x9')](_0x89dae6);var _0xac8168=_0x6ba43a[_0x7d46('0x9')](_0x29277d);if(_0xac8168>_0x14291e){return _0x6ba43a[_0x7d46('0xa')](_0x14291e,_0xac8168+0x1);}else{var _0x4d4cba=_0x6ba43a['slice'](0x0,_0xac8168+0x1);var _0x3d6d8e=_0x6ba43a['slice'](_0x14291e);return _0x3d6d8e['concat'](_0x4d4cba);}}}module[_0x7d46('0xd')][_0x7d46('0xe')]=circularMonthInterval;function parseDom(_0x26abc5){var _0x4f970a=parseInt(_0x26abc5,0xa);if(_0x4f970a<0x1||_0x4f970a>0x1f){throw new Error(EINVALID_DATE);}return _0x4f970a;}function timeCompare(_0xf420b2,_0x406029,_0x11c8d0){var _0x383e9b=_0xf420b2[_0x7d46('0xf')]();var _0x228a82=extractTime(_0x406029);var _0x4db28e=_0x228a82[0x0];var _0x171c91=_0x228a82[0x1];var _0x2bede4=_0xf420b2[_0x7d46('0xf')]()[_0x7d46('0x10')](_0x4db28e)[_0x7d46('0x11')](_0x171c91);throwIfDateNotValid(_0x2bede4);var _0x2a31a5=extractTime(_0x11c8d0);var _0x1b9547=_0x2a31a5[0x0];var _0x4b9de4=_0x2a31a5[0x1];var _0x49ede4=_0xf420b2[_0x7d46('0xf')]()[_0x7d46('0x10')](_0x1b9547)[_0x7d46('0x11')](_0x4b9de4);throwIfDateNotValid(_0x49ede4);if(_0x49ede4[_0x7d46('0x12')](_0x2bede4)){var _0x5b6af4=_0x383e9b[_0x7d46('0xf')]()[_0x7d46('0x13')](_0x7d46('0x14'));var _0x3b354f=_0x383e9b[_0x7d46('0xf')]()['endOf']('day');return _0x383e9b[_0x7d46('0x15')](_0x2bede4,_0x3b354f,undefined,'[]')||_0x383e9b[_0x7d46('0x15')](_0x5b6af4,_0x49ede4,undefined,'[]');}else{return _0x383e9b[_0x7d46('0x15')](_0x2bede4,_0x49ede4,undefined,'[]');}}module[_0x7d46('0xd')][_0x7d46('0x16')]=timeCompare;function dowCompare(_0x3c6b47,_0x19722f,_0x33a67f){var _0x383b78=_0x3c6b47['locale']('en')[_0x7d46('0x17')](_0x7d46('0x18'))[_0x7d46('0x8')]();return circularDoWInterval(_0x19722f,_0x33a67f)[_0x7d46('0x19')](_0x383b78);}module[_0x7d46('0xd')][_0x7d46('0x1a')]=dowCompare;function domCompare(_0x5e1b06,_0x5a7f6d,_0x16084d){var _0x301065=_0x5e1b06[_0x7d46('0x1b')]();if(_0x5a7f6d===_0x16084d){return _0x301065===_0x5a7f6d;}else{var _0x1c40ef=_0x5e1b06['daysInMonth']();var _0x1b1a13=_0x5a7f6d<_0x16084d;let _0x2d0194=![];var _0x32e402=0x0;var _0x3b9677=0x0;if(_0x1b1a13){_0x32e402=Math[_0x7d46('0x1c')](0x1,_0x5a7f6d);_0x3b9677=Math[_0x7d46('0x1d')](_0x16084d,_0x1c40ef);_0x2d0194=_0x301065>=_0x32e402&&_0x301065<=_0x3b9677;}else{_0x32e402=Math[_0x7d46('0x1d')](_0x5a7f6d,_0x1c40ef);_0x3b9677=Math[_0x7d46('0x1c')](0x1,_0x16084d);_0x2d0194=_0x301065>=_0x32e402||_0x301065<=_0x3b9677;}return _0x2d0194;}}module[_0x7d46('0xd')][_0x7d46('0x1e')]=domCompare;function monthCompare(_0x35533,_0x292f4b,_0xab6b4f){var _0x409e86=_0x35533['locale']('en')[_0x7d46('0x17')](_0x7d46('0x1f'))[_0x7d46('0x8')]();return circularMonthInterval(_0x292f4b,_0xab6b4f)[_0x7d46('0x19')](_0x409e86);}module[_0x7d46('0xd')][_0x7d46('0x20')]=monthCompare;function iftime(_0x1f8c9d,_0x211e68=moment['tz'][_0x7d46('0x21')](),_0x57217c=moment()){if(!validateRx['test'](_0x1f8c9d)){throw new Error(EINVALID_STRING);}else{var _0x43b029=(moment[_0x7d46('0x22')](_0x57217c)?_0x57217c['clone']():moment(_0x57217c))['tz'](_0x211e68)[_0x7d46('0x6')]('en');throwIfDateNotValid(_0x43b029);var _0x588762=_0x1f8c9d[_0x7d46('0x5')](',');var _0x2c43de=_0x588762[0x0];var _0x3a9052=_0x588762[0x1];var _0xf442c0=_0x588762[0x2];var _0x1f0fca=_0x588762[0x3];let _0xc94519=!![];if(_0x2c43de!=='*'){var _0x3f23ae=_0x2c43de[_0x7d46('0x5')]('-');var _0x3b8216=_[_0x7d46('0x23')](_0x3f23ae[0x0],0x5,'0');var _0x165175=_0x3f23ae[_0x7d46('0x24')]===0x2?_[_0x7d46('0x23')](_0x3f23ae[0x1],0x5,'0'):_0x3b8216;_0xc94519=timeCompare(_0x43b029,_0x3b8216,_0x165175);}let _0x592d75=!![];if(_0x3a9052!=='*'){var _0x44b331=_0x3a9052['split']('-');var _0x3d004a=_0x44b331[0x0];var _0x169e2a=_0x44b331[_0x7d46('0x24')]===0x2?_0x44b331[0x1]:_0x3d004a;_0x592d75=dowCompare(_0x43b029,_0x3d004a,_0x169e2a);}let _0x2e7357=!![];if(_0xf442c0!=='*'){var _0x15cf10=_0xf442c0[_0x7d46('0x5')]('-');var _0x9379a1=parseDom(_0x15cf10[0x0]);var _0x31813b=_0x15cf10[_0x7d46('0x24')]===0x2?parseDom(_0x15cf10[0x1]):_0x9379a1;_0x2e7357=domCompare(_0x43b029,_0x9379a1,_0x31813b);}let _0x3336ed=!![];if(_0x1f0fca!=='*'){var _0x3e1988=_0x1f0fca[_0x7d46('0x5')]('-');var _0x2baa3d=_0x3e1988[0x0];var _0x3a9113=_0x3e1988[_0x7d46('0x24')]===0x2?_0x3e1988[0x1]:_0x3e1988[0x0];_0x3336ed=monthCompare(_0x43b029,_0x2baa3d,_0x3a9113);}return _0xc94519&&_0x592d75&&_0x2e7357&&_0x3336ed;}}module[_0x7d46('0xd')][_0x7d46('0x25')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 5b6ec1d..260d7a4 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7aef=['Console','warn','consoleLogger','fileLogger','path','util','moment','../config/environment','debugLevel','toLowerCase','redBG\x20white','red','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','{{{','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports','File','%s-%s','error'];(function(_0x4c618d,_0x36f807){var _0x6c891d=function(_0x2d3196){while(--_0x2d3196){_0x4c618d['push'](_0x4c618d['shift']());}};_0x6c891d(++_0x36f807);}(_0x7aef,0xa4));var _0xf7ae=function(_0x422b2a,_0x2f107a){_0x422b2a=_0x422b2a-0x0;var _0x8dbded=_0x7aef[_0x422b2a];return _0x8dbded;};'use strict';var path=require(_0xf7ae('0x0'));var util=require(_0xf7ae('0x1'));var moment=require(_0xf7ae('0x2'));var winston=require('winston');var config=require(_0xf7ae('0x3'));var debugLevel=config[_0xf7ae('0x4')]?config[_0xf7ae('0x4')][_0xf7ae('0x5')]():'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':_0xf7ae('0x6'),'error':_0xf7ae('0x7'),'warn':'bold\x20yellow','info':_0xf7ae('0x8'),'print':_0xf7ae('0x9'),'success':_0xf7ae('0xa'),'http':_0xf7ae('0xb'),'verbose':_0xf7ae('0xc'),'debug':'bold\x20blue','silly':_0xf7ae('0xd')};winston[_0xf7ae('0xe')](XC_LOG_COLORS);function getLogFileName(_0x15d4cd,_0x46c328,_0x2c0072){var _0x2c3d6e=_0x15d4cd||_0xf7ae('0xf');return path[_0xf7ae('0x10')](_0x2c3d6e,util[_0xf7ae('0x11')](_0xf7ae('0x12'),_0x46c328,_0x2c0072));}function formatter(_0x52e168,_0x1062b7){_0x1062b7[_0xf7ae('0x13')]=_0x1062b7['message'][_0xf7ae('0x14')](/@@{/g,'{{{')[_0xf7ae('0x14')](/}@@/g,_0xf7ae('0x15'))[_0xf7ae('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xf7ae('0x11')](_0xf7ae('0x16'),moment()[_0xf7ae('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0x1062b7['level']['toUpperCase'](),_0x52e168,_0x1062b7[_0xf7ae('0x13')]);}function fileFormat(_0x52fbc6,_0x50d61e){_0x50d61e[_0xf7ae('0x13')]=_0x50d61e['message'][_0xf7ae('0x14')](/@@{/g,_0xf7ae('0x17'))[_0xf7ae('0x14')](/}@@/g,'}}}')[_0xf7ae('0x14')](/@{/g,'{{')[_0xf7ae('0x14')](/}@/g,'}}');var _0x287085=_0x50d61e[_0xf7ae('0x18')]&&Object['keys'](_0x50d61e['meta'])[_0xf7ae('0x19')]?'\x0a\x09'+JSON[_0xf7ae('0x1a')](_0x50d61e[_0xf7ae('0x18')]):'';return util['format'](_0xf7ae('0x1b'),moment()[_0xf7ae('0x11')](_0xf7ae('0x1c')),_0x50d61e[_0xf7ae('0x1d')][_0xf7ae('0x1e')](),_0x52fbc6,_0x50d61e[_0xf7ae('0x13')],_0x287085);}function consoleLogger(){var _0xedd6dc=new winston[(_0xf7ae('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':'warn','json':![],'formatter':function(_0x273c73){return formatter('',_0x273c73);}})]});return _0xedd6dc;}function fileLogger(_0x219024,_0x33b823){var _0x27a27f=new winston[(_0xf7ae('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf7ae('0x20'))][(_0xf7ae('0x21'))]({'name':util[_0xf7ae('0x11')](_0xf7ae('0x22'),_0x219024,_0xf7ae('0x23')),'filename':getLogFileName(_0x33b823,_0x219024,_0xf7ae('0x23')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2b889e){return fileFormat(_0x219024,_0x2b889e);}}),new winston['transports']['File']({'name':util[_0xf7ae('0x11')](_0xf7ae('0x22'),_0x219024,debugLevel),'filename':getLogFileName(_0x33b823,_0x219024,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x35b9cd){return fileFormat(_0x219024,_0x35b9cd);}}),new winston[(_0xf7ae('0x20'))][(_0xf7ae('0x24'))]({'level':_0xf7ae('0x25'),'json':![],'formatter':function(_0x4885be){return fileFormat(_0x219024,_0x4885be);}})]});return _0x27a27f;}exports[_0xf7ae('0x26')]=consoleLogger;exports[_0xf7ae('0x27')]=fileLogger; \ No newline at end of file +var _0xbbe5=['winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors','format','message','{{{','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','}}}','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','Console','warn','File','%s-%s','error','transports','fileLogger','path','moment'];(function(_0x5c431c,_0x3f1b8c){var _0x3ce6fb=function(_0xdc78c1){while(--_0xdc78c1){_0x5c431c['push'](_0x5c431c['shift']());}};_0x3ce6fb(++_0x3f1b8c);}(_0xbbe5,0x6d));var _0x5bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe5[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0x5bbe('0x0'));var util=require('util');var moment=require(_0x5bbe('0x1'));var winston=require(_0x5bbe('0x2'));var config=require(_0x5bbe('0x3'));var debugLevel=config[_0x5bbe('0x4')]?config['debugLevel'][_0x5bbe('0x5')]():_0x5bbe('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x5bbe('0x7'),'error':_0x5bbe('0x8'),'warn':_0x5bbe('0x9'),'info':_0x5bbe('0xa'),'print':'bold\x20white','success':_0x5bbe('0xb'),'http':_0x5bbe('0xc'),'verbose':_0x5bbe('0xd'),'debug':'bold\x20blue','silly':_0x5bbe('0xe')};winston[_0x5bbe('0xf')](XC_LOG_COLORS);function getLogFileName(_0x5a007d,_0x5467b5,_0x11d1ab){var _0x214198=_0x5a007d||'/var/log/xcally';return path['join'](_0x214198,util[_0x5bbe('0x10')]('%s-%s.log',_0x5467b5,_0x11d1ab));}function formatter(_0x35cf7b,_0x4bba28){_0x4bba28[_0x5bbe('0x11')]=_0x4bba28[_0x5bbe('0x11')]['replace'](/@@{/g,_0x5bbe('0x12'))[_0x5bbe('0x13')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0x5bbe('0x13')](/}@/g,'}}');return util[_0x5bbe('0x10')](_0x5bbe('0x14'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x4bba28[_0x5bbe('0x15')][_0x5bbe('0x16')](),_0x35cf7b,_0x4bba28[_0x5bbe('0x11')]);}function fileFormat(_0x5d16c2,_0x4278a3){_0x4278a3[_0x5bbe('0x11')]=_0x4278a3[_0x5bbe('0x11')][_0x5bbe('0x13')](/@@{/g,_0x5bbe('0x12'))[_0x5bbe('0x13')](/}@@/g,_0x5bbe('0x17'))[_0x5bbe('0x13')](/@{/g,'{{')[_0x5bbe('0x13')](/}@/g,'}}');var _0x593c59=_0x4278a3[_0x5bbe('0x18')]&&Object[_0x5bbe('0x19')](_0x4278a3[_0x5bbe('0x18')])[_0x5bbe('0x1a')]?'\x0a\x09'+JSON[_0x5bbe('0x1b')](_0x4278a3[_0x5bbe('0x18')]):'';return util[_0x5bbe('0x10')](_0x5bbe('0x1c'),moment()[_0x5bbe('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x4278a3[_0x5bbe('0x15')][_0x5bbe('0x16')](),_0x5d16c2,_0x4278a3[_0x5bbe('0x11')],_0x593c59);}function consoleLogger(){var _0x3c470b=new winston[(_0x5bbe('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x5bbe('0x1e'))]({'level':_0x5bbe('0x1f'),'json':![],'formatter':function(_0x331694){return formatter('',_0x331694);}})]});return _0x3c470b;}function fileLogger(_0x46f981,_0x5c98f5){var _0x9356bd=new winston[(_0x5bbe('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x5bbe('0x20'))]({'name':util['format'](_0x5bbe('0x21'),_0x46f981,_0x5bbe('0x22')),'filename':getLogFileName(_0x5c98f5,_0x46f981,'error'),'level':_0x5bbe('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x595be7){return fileFormat(_0x46f981,_0x595be7);}}),new winston[(_0x5bbe('0x23'))][(_0x5bbe('0x20'))]({'name':util[_0x5bbe('0x10')](_0x5bbe('0x21'),_0x46f981,debugLevel),'filename':getLogFileName(_0x5c98f5,_0x46f981,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x132a8b){return fileFormat(_0x46f981,_0x132a8b);}}),new winston['transports'][(_0x5bbe('0x1e'))]({'level':_0x5bbe('0x1f'),'json':![],'formatter':function(_0x17d126){return fileFormat(_0x46f981,_0x17d126);}})]});return _0x9356bd;}exports['consoleLogger']=consoleLogger;exports[_0x5bbe('0x24')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 1346481..44a798c 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 _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x1967,0x173));var _0x7196=function(_0x5c8903,_0x392568){_0x5c8903=_0x5c8903-0x0;var _0x998c1f=_0x1967[_0x5c8903];return _0x998c1f;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x3918d5,_0x14dc21){var _0x3f1bd5=function(_0x140a03){while(--_0x140a03){_0x3918d5['push'](_0x3918d5['shift']());}};_0x3f1bd5(++_0x14dc21);}(_0xadb5,0xad));var _0x5adb=function(_0x54e670,_0x2946e4){_0x54e670=_0x54e670-0x0;var _0x220062=_0xadb5[_0x54e670];return _0x220062;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 17f17f3..d7a3697 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 _0xed3c=['{\x20{\x20','\x20}\x20}','string','replace','isPlainObject','keys','reduce','safeTemplate','lodash'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xed3c,0x1a6));var _0xced3=function(_0x1cd71f,_0x2a9d19){_0x1cd71f=_0x1cd71f-0x0;var _0x33d362=_0xed3c[_0x1cd71f];return _0x33d362;};var _=require(_0xced3('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x408853){return _0x408853==='{{'?_0xced3('0x1'):_0xced3('0x2');}function safeTemplate(_0x558ee8){var _0xfdc1ed=_0x558ee8;if(typeof _0x558ee8===_0xced3('0x3')){_0xfdc1ed=_0x558ee8[_0xced3('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x558ee8)){_0xfdc1ed=_0x558ee8['map'](function(_0x3d3aa0){return safeTemplate(_0x3d3aa0);});}else if(_[_0xced3('0x5')](_0x558ee8)){_0xfdc1ed=Object[_0xced3('0x6')](_0x558ee8)[_0xced3('0x7')](function(_0x4795cd,_0x510164){_0x4795cd[_0x510164]=safeTemplate(_0x558ee8[_0x510164]);return _0x4795cd;},{});}return _0xfdc1ed;}module['exports'][_0xced3('0x8')]=safeTemplate; \ No newline at end of file +var _0x0abf=['safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','isArray','map','isPlainObject','keys','reduce','exports'];(function(_0x47ab0f,_0x366c34){var _0x66cf76=function(_0x2b3b65){while(--_0x2b3b65){_0x47ab0f['push'](_0x47ab0f['shift']());}};_0x66cf76(++_0x366c34);}(_0x0abf,0xe8));var _0xf0ab=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0abf[_0x432682];return _0x463d05;};var _=require(_0xf0ab('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4d04cc){return _0x4d04cc==='{{'?_0xf0ab('0x1'):_0xf0ab('0x2');}function safeTemplate(_0x528ef7){var _0x598001=_0x528ef7;if(typeof _0x528ef7===_0xf0ab('0x3')){_0x598001=_0x528ef7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xf0ab('0x4')](_0x528ef7)){_0x598001=_0x528ef7[_0xf0ab('0x5')](function(_0x2efe43){return safeTemplate(_0x2efe43);});}else if(_[_0xf0ab('0x6')](_0x528ef7)){_0x598001=Object[_0xf0ab('0x7')](_0x528ef7)[_0xf0ab('0x8')](function(_0x233afe,_0x57ff3b){_0x233afe[_0x57ff3b]=safeTemplate(_0x528ef7[_0x57ff3b]);return _0x233afe;},{});}return _0x598001;}module[_0xf0ab('0x9')][_0xf0ab('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 993ac0b..58492b4 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 _0xeb1e=['env','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','fs-extra','path','root','resolve','server/app.json','isArray','apps','findIndex','name','motion2'];(function(_0xd11e83,_0x330cd3){var _0x2ac20e=function(_0x4c2ed3){while(--_0x4c2ed3){_0xd11e83['push'](_0xd11e83['shift']());}};_0x2ac20e(++_0x330cd3);}(_0xeb1e,0x116));var _0xeeb1=function(_0x1b1c24,_0x15d76a){_0x1b1c24=_0x1b1c24-0x0;var _0x335035=_0xeb1e[_0x1b1c24];return _0x335035;};var fs=require(_0xeeb1('0x0'));var path=require(_0xeeb1('0x1'));var config=require('../config/environment');var root=config[_0xeeb1('0x2')];var APP_JSON_PATH=path[_0xeeb1('0x3')](root,_0xeeb1('0x4'));var NODEPATH=path[_0xeeb1('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x34b9df){let _0x5679e6=![];if(Array[_0xeeb1('0x5')](_0x34b9df[_0xeeb1('0x6')])){var _0x2c7de6=_0x34b9df[_0xeeb1('0x6')][_0xeeb1('0x7')](function(_0x4d5c87){return _0x4d5c87[_0xeeb1('0x8')]===_0xeeb1('0x9');});if(_0x2c7de6>-0x1){var _0x1f312c=_0x34b9df[_0xeeb1('0x6')][_0x2c7de6];if(typeof _0x1f312c[_0xeeb1('0xa')]['NODE_PATH']!=='string'){_0x1f312c[_0xeeb1('0xa')]['NODE_PATH']=NODEPATH;_0x5679e6=!![];}}return{'appConfig':_0x34b9df,'updated':_0x5679e6};}}function updateAppConfig(_0x3b672b){return fs[_0xeeb1('0xb')](APP_JSON_PATH)[_0xeeb1('0xc')](function(_0x42a819){if(_0x42a819){return fs[_0xeeb1('0xd')](APP_JSON_PATH)[_0xeeb1('0xc')](function(_0x2717e7){var _0x44f556=setLegacyLibsNodeEnvPath(_0x2717e7);if(_0x44f556[_0xeeb1('0xe')]){_0x3b672b[_0xeeb1('0xf')](_0xeeb1('0x10'));return fs[_0xeeb1('0x11')](APP_JSON_PATH,_0x2717e7,{'spaces':0x2});}else{return Promise[_0xeeb1('0x3')]();}});}else{return Promise[_0xeeb1('0x3')]();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0xc695=['updated','Updating\x20app.json','writeJSON','resolve','fs-extra','path','root','legacy-libs','isArray','apps','env','NODE_PATH','string','readJSON','then'];(function(_0x5dd703,_0x7fe88c){var _0x557f8e=function(_0x326b81){while(--_0x326b81){_0x5dd703['push'](_0x5dd703['shift']());}};_0x557f8e(++_0x7fe88c);}(_0xc695,0xc7));var _0x5c69=function(_0x3a3d20,_0x244316){_0x3a3d20=_0x3a3d20-0x0;var _0x33bc94=_0xc695[_0x3a3d20];return _0x33bc94;};var fs=require(_0x5c69('0x0'));var path=require(_0x5c69('0x1'));var config=require('../config/environment');var root=config[_0x5c69('0x2')];var APP_JSON_PATH=path['resolve'](root,'server/app.json');var NODEPATH=path['resolve'](root,_0x5c69('0x3'));function setLegacyLibsNodeEnvPath(_0x201c41){let _0x4ac870=![];if(Array[_0x5c69('0x4')](_0x201c41[_0x5c69('0x5')])){var _0x29f9ae=_0x201c41[_0x5c69('0x5')]['findIndex'](function(_0x351266){return _0x351266['name']==='motion2';});if(_0x29f9ae>-0x1){var _0x508b0b=_0x201c41[_0x5c69('0x5')][_0x29f9ae];if(typeof _0x508b0b[_0x5c69('0x6')][_0x5c69('0x7')]!==_0x5c69('0x8')){_0x508b0b['env']['NODE_PATH']=NODEPATH;_0x4ac870=!![];}}return{'appConfig':_0x201c41,'updated':_0x4ac870};}}function updateAppConfig(_0x20d135){return fs['pathExists'](APP_JSON_PATH)['then'](function(_0x13d7c8){if(_0x13d7c8){return fs[_0x5c69('0x9')](APP_JSON_PATH)[_0x5c69('0xa')](function(_0x5b95ee){var _0x363616=setLegacyLibsNodeEnvPath(_0x5b95ee);if(_0x363616[_0x5c69('0xb')]){_0x20d135['info'](_0x5c69('0xc'));return fs[_0x5c69('0xd')](APP_JSON_PATH,_0x5b95ee,{'spaces':0x2});}else{return Promise[_0x5c69('0xe')]();}});}else{return Promise[_0x5c69('0xe')]();}});}module['exports']=updateAppConfig; \ No newline at end of file